From 5e74700a30ae5eff9c5adae6dad2aa9ff1db9aec Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Aug 2002 14:28:33 +0000 Subject: [PATCH 0001/2994] Initial revision --- BitKeeper/etc/config | 0 BitKeeper/etc/ignore | 0 ChangeSet | 0 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 BitKeeper/etc/config create mode 100644 BitKeeper/etc/ignore create mode 100644 ChangeSet diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config new file mode 100644 index 00000000..e69de29b diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore new file mode 100644 index 00000000..e69de29b diff --git a/ChangeSet b/ChangeSet new file mode 100644 index 00000000..e69de29b From 9126c604fc19f76d0bdefe9b2cc1b5cf009f1bdd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Aug 2002 14:28:33 +0000 Subject: [PATCH 0002/2994] (Logical change 1.2) --- BitKeeper/etc/config | 7 +++++++ BitKeeper/etc/ignore | 2 ++ 2 files changed, 9 insertions(+) diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config index e69de29b..e0aa4002 100644 --- a/BitKeeper/etc/config +++ b/BitKeeper/etc/config @@ -0,0 +1,7 @@ +description: Linux NTFS userspace library and utilities +category: System Environment/Base +logging: logging@openlogging.org +compression: gzip +autofix: yes +contact: Anton Altaparmakov +email: aia21@cantab.net diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index e69de29b..f9513232 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -0,0 +1,2 @@ +BitKeeper/*/* +PENDING/* From 2f509bc87573c6bd841f8fa37a12863881349398 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Aug 2002 14:28:33 +0000 Subject: [PATCH 0003/2994] Initial repository create BKrev: 3d64f511qgPlhfO9hP8MTNf-3YQE3Q From b07bb68ea87c7d989a497de7c2db631a2afe14e6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Aug 2002 14:41:28 +0000 Subject: [PATCH 0004/2994] Initial revision --- BitKeeper/etc/logging_ok | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 BitKeeper/etc/logging_ok diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok new file mode 100644 index 00000000..e69de29b From 67a9124c4dea32e891a8e420b35cf26c4916e324 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Aug 2002 14:41:28 +0000 Subject: [PATCH 0005/2994] (Logical change 1.3) --- BitKeeper/etc/logging_ok | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index e69de29b..5e360a8c 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -0,0 +1 @@ +aia21@cantab.net From a6eb37f5afe1189f18275afa61d2f6d429ce9c7a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Aug 2002 14:41:28 +0000 Subject: [PATCH 0006/2994] Update config file with our wanted defaults. (Logical change 1.3) --- BitKeeper/etc/config | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config index e0aa4002..2566178b 100644 --- a/BitKeeper/etc/config +++ b/BitKeeper/etc/config @@ -1,7 +1,10 @@ description: Linux NTFS userspace library and utilities -category: System Environment/Base -logging: logging@openlogging.org +category: System Environment/Base +homepage: http://linux-ntfs.sf.net/ +bkweb: http://linux-ntfs.bkbits.net:8080/ntfs-progs +contact: Anton Altaparmakov +email: aia21@cantab.net +logging: logging@openlogging.org +checkout: get compression: gzip -autofix: yes -contact: Anton Altaparmakov -email: aia21@cantab.net +autofix: yes From b1d7b5a059d99ed73f942c5201d949e156fddac2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Aug 2002 14:41:28 +0000 Subject: [PATCH 0007/2994] Update config file with our wanted defaults. BKrev: 3d64f818DgkfNfT_NaEsKHuq3K_J1A From 3aaa8ebe68890d97a8254beac73a68bed6fa2311 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Aug 2002 14:44:22 +0000 Subject: [PATCH 0008/2994] Don't ask each user if they agree to open logging. (Logical change 1.4) --- BitKeeper/etc/config | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config index 2566178b..9fce5dd4 100644 --- a/BitKeeper/etc/config +++ b/BitKeeper/etc/config @@ -5,6 +5,7 @@ bkweb: http://linux-ntfs.bkbits.net:8080/ntfs-progs contact: Anton Altaparmakov email: aia21@cantab.net logging: logging@openlogging.org +logging_ask: no checkout: get compression: gzip autofix: yes From 856c10c4aefc3d1bc2367fc8b2825097dc3fc0b3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Aug 2002 14:44:22 +0000 Subject: [PATCH 0009/2994] Don't ask each user if they agree to open logging. BKrev: 3d64f8c6gOhCOZ3mda5KgsU5MsOmjA From 3fbf5c3625e23332b6e2ced4d14e04013192edfd Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0010/2994] Initial revision --- COPYING | 0 CREDITS | 0 INSTALL | 0 TODO.include | 0 TODO.libntfs | 0 acconfig.h | 0 aclocal.m4 | 0 autogen.sh | 0 config.guess | 0 config.h.in | 0 config.sub | 0 doc/CodingStyle | 0 doc/Makefile.am | 0 doc/Makefile.in | 0 doc/attribute_definitions | 0 doc/attributes.txt | 0 doc/compression.txt | 0 doc/system_files.txt | 0 doc/system_security_descriptors.txt | 0 doc/tunable_settings | 0 include/inode.h | 0 install-sh | 0 ltconfig | 0 ltmain.sh | 0 missing | 0 mkinstalldirs | 0 ntfstools/attrdef.c | 0 ntfstools/boot.c | 0 ntfstools/mkntfs.8.in | 0 ntfstools/mkntfs.c | 0 ntfstools/ntfsfix.8.in | 0 ntfstools/ntfsinfo.8.in | 0 ntfstools/ntfslabel.8.in | 0 ntfstools/upcase.c | 0 stamp-h.in | 0 35 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 COPYING create mode 100644 CREDITS create mode 100644 INSTALL create mode 100644 TODO.include create mode 100644 TODO.libntfs create mode 100644 acconfig.h create mode 100644 aclocal.m4 create mode 100755 autogen.sh create mode 100755 config.guess create mode 100644 config.h.in create mode 100755 config.sub create mode 100644 doc/CodingStyle create mode 100644 doc/Makefile.am create mode 100644 doc/Makefile.in create mode 100644 doc/attribute_definitions create mode 100644 doc/attributes.txt create mode 100644 doc/compression.txt create mode 100644 doc/system_files.txt create mode 100644 doc/system_security_descriptors.txt create mode 100644 doc/tunable_settings create mode 100644 include/inode.h create mode 100755 install-sh create mode 100755 ltconfig create mode 100755 ltmain.sh create mode 100755 missing create mode 100755 mkinstalldirs create mode 100644 ntfstools/attrdef.c create mode 100644 ntfstools/boot.c create mode 100644 ntfstools/mkntfs.8.in create mode 100644 ntfstools/mkntfs.c create mode 100644 ntfstools/ntfsfix.8.in create mode 100644 ntfstools/ntfsinfo.8.in create mode 100644 ntfstools/ntfslabel.8.in create mode 100644 ntfstools/upcase.c create mode 100644 stamp-h.in diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..e69de29b diff --git a/CREDITS b/CREDITS new file mode 100644 index 00000000..e69de29b diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..e69de29b diff --git a/TODO.include b/TODO.include new file mode 100644 index 00000000..e69de29b diff --git a/TODO.libntfs b/TODO.libntfs new file mode 100644 index 00000000..e69de29b diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 00000000..e69de29b diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 00000000..e69de29b diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..e69de29b diff --git a/config.guess b/config.guess new file mode 100755 index 00000000..e69de29b diff --git a/config.h.in b/config.h.in new file mode 100644 index 00000000..e69de29b diff --git a/config.sub b/config.sub new file mode 100755 index 00000000..e69de29b diff --git a/doc/CodingStyle b/doc/CodingStyle new file mode 100644 index 00000000..e69de29b diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 00000000..e69de29b diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 00000000..e69de29b diff --git a/doc/attribute_definitions b/doc/attribute_definitions new file mode 100644 index 00000000..e69de29b diff --git a/doc/attributes.txt b/doc/attributes.txt new file mode 100644 index 00000000..e69de29b diff --git a/doc/compression.txt b/doc/compression.txt new file mode 100644 index 00000000..e69de29b diff --git a/doc/system_files.txt b/doc/system_files.txt new file mode 100644 index 00000000..e69de29b diff --git a/doc/system_security_descriptors.txt b/doc/system_security_descriptors.txt new file mode 100644 index 00000000..e69de29b diff --git a/doc/tunable_settings b/doc/tunable_settings new file mode 100644 index 00000000..e69de29b diff --git a/include/inode.h b/include/inode.h new file mode 100644 index 00000000..e69de29b diff --git a/install-sh b/install-sh new file mode 100755 index 00000000..e69de29b diff --git a/ltconfig b/ltconfig new file mode 100755 index 00000000..e69de29b diff --git a/ltmain.sh b/ltmain.sh new file mode 100755 index 00000000..e69de29b diff --git a/missing b/missing new file mode 100755 index 00000000..e69de29b diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 00000000..e69de29b diff --git a/ntfstools/attrdef.c b/ntfstools/attrdef.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/boot.c b/ntfstools/boot.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/mkntfs.8.in b/ntfstools/mkntfs.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/mkntfs.c b/ntfstools/mkntfs.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfsfix.8.in b/ntfstools/ntfsfix.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfsinfo.8.in b/ntfstools/ntfsinfo.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfslabel.8.in b/ntfstools/ntfslabel.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/upcase.c b/ntfstools/upcase.c new file mode 100644 index 00000000..e69de29b diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 00000000..e69de29b From 6a4f3f919ee3ef9138c73e12636e0dbf3cfcbd65 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0011/2994] Add Szakacsits Szabolcs (and myself) to CREDITS. 2002/07/03 21:56:00-00:00 !antona Updates 2002/04/12 15:23:47-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2001/08/02 01:44:56-00:00 !antona Add ntfsfix man page and spell fixes. Update to 1.2.1 version and update all text files to go with it and the rpm spec file. 2001/06/01 02:07:23-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/02 01:15:17-00:00 !antona Updated documentation and other text files. Preparing for initial release. 2001/01/30 12:29:03-00:00 !antona And the last move into CVS. The make files. (Note: compilation is untested and all changes have been done without testing so if it doesn't compile at the moment don't be too surprised.) (Logical change 1.5) --- CREDITS | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CREDITS b/CREDITS index e69de29b..23ebcc41 100644 --- a/CREDITS +++ b/CREDITS @@ -0,0 +1,22 @@ +The following people have contributed directly or indirectly to the linux-ntfs +project. + +The list is sorted alphabetically, so please keep it this way! + +Please let me know (email Anton Altaparmakov ) if you believe +someone is missing or if you prefer to not be listed. + + +Anton Altaparmakov +Albert D. Cahalan +Matthew J. Fanto +David Martínez Moreno +Yuri Per +Richard Russon +Szakacsits Szabolcs + +Also, various code snippets and especially the autoconf/automake automated +configuration, compilation and installation system have been ripped shamelessly +from numerous different GNU and Gnome utilities and libraries so "Many thanks!" +to all the people who have participated in their creation! + From 72da03cc86405d6ef4f529687e95c1a54f577c7d Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0012/2994] Add description of compression algorithm. (Logical change 1.5) --- doc/compression.txt | 153 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/doc/compression.txt b/doc/compression.txt index e69de29b..90d2f0c1 100644 --- a/doc/compression.txt +++ b/doc/compression.txt @@ -0,0 +1,153 @@ + +Description of the NTFS (de)compression algorithm (based on a modified LZ77 +algorithm) + +Copyright (c) 2001 Anton Altaparmakov. + +This document is published under the GNU General Public License. + +Credits: This is based on notes taken from various places (most notably from +Regis Duchesne's NTFS documentation and from various LZ77 descriptions) and +further refined by looking at a few compressed streams to figure out some +uncertainties. + +Note: You should also read the run list description with regards to compression +in linux-ntfs/include/layout.h. Just search for "Attribute compression". +FIXME: Should merge the info from there into this document some time. + +Compressed data is organized in logical "compression" blocks (cb). Each cb has +a size (cb_size) of 2^compression_unit clusters. In all versions of Windows, +NTFS (NT/2k/XP, NTFS 1.2-3.1), the only valid compression_unit is 4, IOW, each +cb is 2^4 = 16 clusters in size. + +We detect and warn about a compression_unit != 4 but we try to decompress the +data anyway. + +Compression is only supported for cluster sizes between 512 and 4096. Thus a +cb can be between 8 and 64kiB in size. + +Each cb is independent of the other cbs and is thus the minimal unit we have +to parse even if we wanted to decompress only one byte. + +Also, a cb can be totally uncompressed and this would be indicated as a sparse +cb in the run list. + +Thus, we need to look at the run list of the compressed data stream, starting +at the beginning of the first cb overlapping @page. So we convert the page +offset into units of clusters (vcn), and round the vcn down to a mutliple of +cb_size clusters. + +We then scan the run list for the appropriate position. Based on what we find +there, we decide how to proceed. + +If the cb is not compressed at all, and covers the whole of @page, we pretend +to be accessing an uncompressed file, so we fall back to what we do in +aops.c::ntfs_file_readpage(), i.e. we do: + return block_read_full_page(page, ntfs_file_get_block); + +If the cb is completely sparse, and covers the whole of @page, we can just +zero out @page and complete the io (set @page up-to-date, unlock it, and +finally return 0). + +In all other cases we initiate the decompression engine, but first some more +on the compression algorithm. + +Before compression the data of each cb is further divided into 4kiB blocks, we +call them "sub compression" blocks (sb), each including a header specifying +its compressed length. So we could just scan the cb for the first sb +overlapping @page and skip the sbs before that, or we could decompress the +whole cb injecting the superfluous decompressed pages into the page cache as a +form of read ahead (this is what zisofs does for example). + +In either case, we then need to read and decompress all sbs overlapping @page, +potentially having to decompress one or more other cbs, too. + +As soon as @page is completed we could either stop or continue until we finish +the current cb, injecting pages as we go along (again following the zisofs +example). + +Because the sbs follow each other directly, we need to actually read in the +whole cb in order to be able to scan through the cb to find the first sb +overlapping @page, so it does make sense to follow the zisofs approach of +decompressing the whole cb and injecting pages as we go along. So all +discussion from now on will assume that we are going to do that. Although it +might make sense not to decompress any sbs locate before @page because this +would be a kind of "read-behind" which is probably silly, unless someone is +reading the file backwards. Performing read-ahead by decompressing all sbs +following @page OTOH, is very likely to be a good idea. + +So, we read the whole cb from disk and start at the first sb. + +As mentioned above, each sb is started with a header. The header is 16 bits of +which the lower twelve bits (i.e. bits 0 to 11) are the length (L) - 3 of the +sb (including the two bytes for the header itself, or L - 1 not counting the +two bytes for the header). The higher four bits are set to 1011 (0xb) by the +compressor for a compressed block, or to 0000 for an uncompressed block, but +the decompressor only checks the most significant bit taking a 1 to signify a +compressed block, and a 0 an uncompressed block. + +So from the header we know how many compressed bytes we need to decompress to +obtain the next 4kiB of uncompressed data and if we didn't want to decompress +this sb we could just seek to the next next one using the length read from the +header. We could then continue seeking until we reach the first sb overlapping +@page. + +In either case, we will reach a sb which we want to decompress. + +Having dealt with the 16-bit header of the sb, we now have length bytes of +compressed data to decompress. This compressed stream is further split into +tokens which are organized into groups of eight tokens. Each token group (tg) +starts with a tag byte, which is an eight bit bitmap, the bits specifying the +type of each of the following eight tokens. The least significant bit (LSB) +corresponds to the first token and the most significant bit (MSB) corresponds +to the last token. + +The two types of tokens are symbol tokens, specified by a zero bit, and phrase +tokens, specified by a set bit. + +A symbol token (st) is a single byte and is to be taken literally and copied +into the sliding window (the decompressed data). + +A phrase token (pt) is a pointer back into the sliding window (in bytes), +together with a length (again in bytes), starting at the byte the back pointer +is pointing to. Thus a phrase token defines a sequence of bytes in the sliding +window which need to be copied at the current position into the sliding window +(the decompressed data stream). + +Each pt consists of 2 bytes split into the back pointer (p) and the length (l), +each of variable bit width (but the sum of the widths of p and l is fixed at +16 bits). p is at least 4 bits and l is at most 12 bits. + +The most significant bits contain the back pointer (p), while the least +significant bits contain the length (l). + +l is actually stored as the number of bytes minus 3 (unsigned) as anything +shorter than that would be at least as long as the 2 bytes needed for the +actual pt, so no compression would be achieved. + +p is stored as the positive number of bytes minus 1 (unsigned) as going zero +bytes back is meaningless. + +Note that decompression has to occur byte by byte, as it is possible that some +of the bytes pointed to by the pt will only be generated in the sliding window +as the byte sequence pointed to by the pt is being copied into it! + +To give a concrete example; a block full of the letter A would be compressed +by storing the byte A once as a symbol token, followed by a single phrase +token with back pointer -1 (p = 0, therefore go back by -(0 + 1) bytes) and +length 4095 (l=0xffc, therefore length 0xffc + 3 bytes). + +The widths of p and l are determined from the current position within the +decompressed data (cur_pos). We don't actually care about the widths as such +however, but instead we want the mask (l_mask) with which to AND the pt to +obtain l, and the number of bits (p_shift) by which to right shift the pt to +obtain p. These are determined using the following algorithm: + +for (i = cur_pos, l_mask = 0xfff, p_shift = 12; i >= 0x10; i >>= 1) { + l_mask >>= 1; + p_shift--; +} + +Note, that as usual in NTFS, the sb header, as well as each pt, are stored in +little endian format. + From 40ca008347220c28e34c38b4bb78b3ef23497afb Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0013/2994] Added CodingStyle document to doc directory. (Logical change 1.5) --- doc/CodingStyle | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/CodingStyle b/doc/CodingStyle index e69de29b..a2606be6 100644 --- a/doc/CodingStyle +++ b/doc/CodingStyle @@ -0,0 +1,13 @@ + +The standard K&R coding style is used in this project and the guidelines +outlined in the Linux kernel CodingStyle document (found in the Linux kernel +main directory in Documentation/CodingStyle) should be adhered to as strictly +as possible. + +Special notes: + + Capitals are used when declaring NTFS on-disk structures which you + can't just go ahead modifying without getting killed (in a bug sense, + not literally...). In memory structures are named with lower case as + usual. + From 6793494c496f48aab9f648db01861f66e40ab85f Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0014/2994] Added cvs Id header. 2001/03/02 15:04:24-00:00 !antona Update to latest docs. 2001/01/28 05:49:57-00:00 !antona More header development. AttrDef description. (Logical change 1.5) --- doc/tunable_settings | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc/tunable_settings b/doc/tunable_settings index e69de29b..8181d290 100644 --- a/doc/tunable_settings +++ b/doc/tunable_settings @@ -0,0 +1,31 @@ +The following settings can be tuned in Windows NT in the registry under the key +\Registry\Machine\System\CurrentControlSet\Control\FileSystem. + +NtfsDisable8dot3NameCreation default is to enable 8.3 creation + +NtfsAllowExtendedCharacterIn8dot3Name default is to disallow extended chars + +NtfsDisableLastAccessUpdate default is enable the last acc. update + +__u32 NtfsMftZoneReservation: + If not present set the variable _NtfsMftZoneMultiplier to 1. + If = 0 or > 4, again set the variable _NtfsMftZoneMultiplier to 1. + Otherwise, set the variable _NtfsMftZoneMultiplier to the value of + NtfsMftZoneReservation. + + Value = Space % of volume reserved for MftZone + 1 = 12.5% + 2 = 25% + 3 = 37.5% + 4 = 50% + +The zone multiplier is ONLY read accessed when mount_volume is called and +when deallocate_clusters is called. +The zone multiplier is ONLY write accessed when the driver initializes. + +Win2k adds: + +NtfsQuotaNotifyRate ? + +NtfsEncryptionService ? + From 9cbb7f7777f6ab862c4ea41662d2972ba768a428 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0015/2994] Added cvs Id header. 2001/03/26 03:39:59-00:00 !antona Updates 2001/03/07 15:53:20-00:00 !antona Some corrections/additions to attributes documentation. 2001/01/30 12:57:44-00:00 !antona Some documentation I wrote on how attributes work in NTFS. (Logical change 1.5) --- doc/attributes.txt | 113 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/doc/attributes.txt b/doc/attributes.txt index e69de29b..7469dd7e 100644 --- a/doc/attributes.txt +++ b/doc/attributes.txt @@ -0,0 +1,113 @@ +$Id$ + +Notes on the storage of attributes. +=================================== + +Resident attributes +=================== + +Resident attributes are small enough to be stored in the mft record itself. + +When an attribute becomes too big to fit in the mft record or when the number +of attributes grows so large that there is no more space in the mft record, the +largest attribute(s) is(are) made non-resident. (Note, that some attributes +cannot be non-resident.) + +Non-resident attributes +======================= + +Non-resident attributes contain only their non-resident attribute header in the +mft record and the actual attribute value is stored anywhere on the volume +(but not in other mft records). + +The value of the attribute is saved as a sequence of clusters, named virtual +clusters, beginning at virtual cluster number (vcn) zero. Each vcn corresponds +to a cluster on the volume, or a logical cluster number (lcn). The lcns on the +volume begin with lcn zero for the very first cluster on the volume. + +The location of the attribute value is described by the mapping pairs array +present in the non-resident attribute header structure. The mapping pairs array +contains, in compressed form, the mapping between the attribute's vcns and the +corresponding lcns on the volume. + +When the mapping pairs array of a non-resident attribute becomes too large to +fit in the mft record or when there are so many attributes in the mft record +that, even though all attributes that can be non-resident have been made +non-resident, they still do not fit in the mft record, the larger non-resident +attributes are moved away from the mft record to make space. + +This is done by moving whole non-resident attribute header structures to other +mft records and/or by splitting the mapping pairs array of attributes into +several non-resident attribute headers, each containing a chunk of the +original mapping pairs array. These non-resident attribute headers each +describing the same attribute value (but different parts of it) are called +extents. + +Attribute list attribute +======================== + +The attribute list attribute is then added to the base mft record to describe +the location of each attribute. + +The attribute list attribute lists all attributes that belong to this mft +record (with the exception of itself). Each entry in the attribute list +describes the attribute listed and in which mft record it's attribute header can +be found. For resident attributes this will be the same number as the base mft +record in which the attribute list attribute is located itself. For non-resident +attributes, this will be another mft record, called an extension mft record. +Naturally, all extension mft records point back to their base mft record. + +Only one attribute is stored in an extension mft record, even if the attribute +is very small. At least this is the case with Windows NT4 SP6a driver. + +Should the mapping pairs array of an attribute become so large as to not fit +into an extenstion mft record, even though it's attribute is the only attribute +in this extension record, then the attribute is splitt into several extents. +The first extent starts at vcn 0 and has it's lowest vcn value set to zero and +continues up to it's highest vcn value. This is determined by splitting up the +mapping pairs array into chunks which just fit into an extension mft record +each. Thus the first mapping pairs array chunk will determine the value of +the highest vcn for the first extent. The attribute list will contain an entry +for this extent. Then, a second extent is created which has it's lowest vcn +value set to the highest vcn of the previous extent + 1 and the next chunk of +the mapping pairs array is inserted into this extent. Again, an entry for this +extent is placed into the attribute list, and so on, until the whole +non-resident attribute's mapping pairs array has been accomodated. + +Should the attribute list become too big to fit inside the base mft record it +is made non-resident. However, it's maximum value size is determined by the +Windows cache manager to be 256kb (the size of a VACB). Also, the mapping pairs +array of the attribute list has to fit inside the base mft record, as an +attribute list can't be described by itself and attribute lists are not allowed to be nested. + +Compressed attributes +===================== + +The attribute value of each $DATA attribute can be compressed to save space. +If this is the case, the ATTR_IS_COMPRESSED flag is set. + +See the discussion on compression in include/attrib.h for more details. +FIXME: The discussion belongs here! (AIA) + +Sparse attributes (NTFS 3.0+) +============================= + +The attribute value of each $DATA attribute can be sparse to save space. +If this is the case, the ATTR_IS_SPARSE flag is set. Note, that compressed +attributes are by definition sparse, as well as compressed, without having the +ATTR_IS_SPARSE flag set. + +See the discussion on compression in include/attrib.h for more details. +FIXME: The discussion belongs here! (AIA) + +Encrypted attributes (NTFS 3.0+) +================================ + +Since NTFS 3.0, the attribute value of each $DATA attribute can be encrypted, +to protect the contents from spying eyes. If this is the case, the +ATTR_IS_ENCRYPTED flag is set. + +FIXME: Write notes on attribute encryption. The descussions from the articles +"Inside the Encrypting File System" in Windows NT magazine (?) are very good +starting points. (AIA) + From bd5e13a59b89dcaaef4681416c984b20ac7243a3 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0016/2994] Change sizedetection for files so we work with sparse files, too. 2002/07/15 16:41:48-00:00 !flatcap AT_NONAME -> AT_UNNAMED 2002/07/15 15:09:21-00:00 !flatcap lingering attribute name problems 2002/07/11 16:20:34-00:00 !flatcap whitespace and include guards 2002/07/09 19:17:49-00:00 !flatcap move the runlist functions from attrib.c to runlist.c 2002/07/08 23:27:16-00:00 !flatcap added AT_NONAME so we can search for a (un)named attribute or just iterate through all attributes 2002/07/06 20:07:59-00:00 !antona New API for compressing run lists into mapping pairs arrays and adapt mkntfs to that API. Addition of ntfs_walk_attrs(). 2002/07/03 21:56:01-00:00 !antona Updates 2002/07/02 23:47:11-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/04/27 19:49:10-00:00 !antona Update library, new APIs ntfs_attr_find_vcn(), misc fixes and cleanups, make all the utilities compile, fix bugs I noticed in ntfslabel and it now works properly. 2002/04/23 23:27:33-00:00 !antona Fixup the force option in mkntfs.c. Change the ntfs_check_if_mounted so it works on system not implementing {set,get,end}mntent, too. Also make it more powerful in telling us not only if something is mounted but also if it is the fs root and if it is read-only. 2002/04/23 19:37:18-00:00 !mattjf Removed the check_mount() function and added ntfs_check_if_mounted() to mkntfs 2002/04/22 10:34:32-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/21 01:26:39-00:00 !antona Cleanup/streamline include file dependencies. 2002/04/21 01:12:55-00:00 !antona Fix mkntfs again. 2002/04/20 23:09:43-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/19 21:09:55-00:00 !antona Finished provisional inode.c::ntfs_{open,close}_inode() functions. Also, started defining API provided by attrib.[ch], so far only done search context related stuff. 2002/04/18 18:15:46-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2002/04/16 15:34:32-00:00 !antona Fix the library... 2002/04/15 21:41:16-00:00 !antona Little fix of a fix. (-: 2002/04/15 20:04:29-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/15 19:02:41-00:00 !antona Really fix the library and mkntfs while at it. 2002/04/14 15:26:24-00:00 !antona Remove find_first_attr and make all users use get_attr_search_ctx + find_attr instead. 2002/03/12 22:11:02-00:00 !antona Final tidyups. 2002/03/12 22:00:44-00:00 !antona Fix a few small mistakes 2002/03/12 21:48:27-00:00 !antona Change version numbers of mkntfs and ntfsfix to match linux-ntfs release and add options to mkntfs to disable content indexing on the volume and to enable compression on the volume. 2002/03/12 00:34:35-00:00 !antona Fix typo in mkntfs usage information. 2002/02/01 02:46:16-00:00 !antona Attempt to fix compile warnings on powerpc. 2002/01/10 10:54:27-00:00 !antona Updates 2002/01/10 10:11:46-00:00 !antona Fix logfile size calculation. 2001/12/15 05:26:07-00:00 !antona Hm, it would appear that on my SuSE 7.2 + many other thins + 2.5.1-pre11 kernel mkntfs gets an EINVAL from seek instead of ENOSPACE crashes out. Converted the crash into a warning only. 2001/11/10 16:24:13-00:00 !antona More logfile size updates so we are more sane with floppies. 2001/11/10 14:47:39-00:00 !antona Debug display bug fixes. 2001/11/10 14:27:38-00:00 !antona And more typos. 2001/11/10 14:25:33-00:00 !antona Oops. Didn't compile. Typo 2001/11/10 14:22:15-00:00 !antona Remove obsoleted disklabel.h stuff. 2001/11/10 14:17:39-00:00 !antona Enhance mkntfs' device size determination. 2001/11/10 03:06:05-00:00 !antona Bug fixes and debug output enhancements. 2001/11/09 23:36:17-00:00 !antona Bug fixes 2001/11/09 21:18:22-00:00 !antona More fixes and allow small volumes down to 1MiB, scaling down the $LogFile as much as necessary. 2001/11/09 19:21:09-00:00 !antona Fix directories on large clusters and allow 4MB volumes. 2001/08/27 16:58:07-00:00 !antona Updates. 2001/07/25 22:49:25-00:00 !antona Small tidying up of a misspelling. 2001/07/25 22:30:34-00:00 !antona Bug fixes for cluster sizes > 4kb involving corrections to mft mirror size and contents, mft data attribute position and mft bitmap size. Some of those were nasty so this is a major improvement. 2001/06/16 19:22:45-00:00 !antona Get rid of logfile stuff for mkntfs as it is clearly not needed. 2001/06/16 18:26:34-00:00 !antona Make mft bitmap non resident and located just after $Boot. This fixes all the crashes experienced! This makes mkntfs complete and bug free AFAIK. 2001/06/15 16:47:47-00:00 !antona Integrate logfile.c into mkntfs 2001/06/13 19:00:56-00:00 !antona More cleanups and man page final updates/polishing. 2001/06/13 18:07:00-00:00 !antona Some output cleanup. 2001/06/13 12:21:51-00:00 !flatcap the backup boot sector is in no-mans-land beyond the normal clusters 2001/06/13 11:51:17-00:00 !flatcap fixed sector/cluster typo 2001/06/13 11:47:05-00:00 !flatcap $bitmap - set bits beyond volume 2001/06/13 01:35:02-00:00 !antona fix backup boot sector problem with error message instead of crashing out. we rely on chkdsk to fix this as it is a kernel limitation we can't do anything about atm. 2001/06/13 00:13:38-00:00 !antona Fix run list corruption stupidity. 2001/06/12 22:39:35-00:00 !antona Testing 2001/06/12 22:17:30-00:00 !antona Testing. 2001/06/12 21:58:32-00:00 !antona Fix stupid bugs in calculating the clusters per mft/index record values. 2001/06/12 20:13:35-00:00 !antona Fix nr_sectors / sector_size problems with previous commit. 2001/06/12 20:02:50-00:00 !antona Enable automatic determination of file size of non-block devices instead of crashing out. A user specified size stil overrides the actual size, we assume the file size will be adjusted automatically by the seek to the last sector and write of the backup boot sector. 2001/06/11 20:31:29-00:00 !antona Bugfixing of mkntfs.c. Loads of it. (-8 2001/06/11 04:02:09-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/10 15:54:20-00:00 !antona Linux-NTFS 0.1.0-pre1 ===================== -fixed up ntfsfix and ntfsdump_logfile -corrected stuff -several bug fixes -fixed (hopefully) final bug with mkntfs (sd generator was wrong due to brain'o) -mkntfs now completed, only need to add a few command line options before first public release. -rpm generation file updated and autostrip modified to make use of install-stip make target instead of stripping manually -made bootsector check verbosity during mount dependent on --enable-debug configure option. 2001/06/10 14:00:12-00:00 !antona mkntfs alpha 4 ============== - set back up boot sector as used in volume bitmap - almost no errors left. only thing chkdsk now complains about is the root dir security descriptor. 2001/06/10 02:25:38-00:00 !antona mkntfs alpha 3 ============== - Several bugfixes (root dir link count wasn't incremented, mftmirror usns weren't correct [off by one too high], etc). - Implement new $UpCase generation using flatcap (Richard Russon)'s algorithm for generating it. This dropped the stripped mkntfs executable from 204kb down to 78kb in size. A whopping 62% size decrease! Yey! And the source code dropped ny over 600kb in size as well. And compilation got quicker, too. 2001/06/09 18:32:57-00:00 !antona mkntfs alpha 2 create_hardlink() was forgetting to increment the use count! 2001/06/09 16:31:13-00:00 !antona mkntfs alpha release is here! Yey! The only thing I am worried about is the fact that the system call to get the number of sectors on the device returns a value rounded to the nearest 1024 bytes (converted to 512 byte blocks) thus we might be writting the backup boot sector too early instead of on the real last sector but there is nothing I can do apart from starting to play games like accessing the main device for hds instead of the partition device which wouldn't help in the case of the last partition though... Alternatively have to place the backup boot sector in the middle of the disk like WinNT3.51 and earlier did but I need an image to see exactly how they did it and even then we have the problem of not knowing where the middle of the disk is as we don't really know how many sectors there are for real with Linux kernel lying to us. 2001/06/09 00:25:56-00:00 !antona mkntfs delayed. more reverse engineering required to determine exact method of index entry collation. first few helper functions are already done and entered into ntfslib in unistr.c 2001/06/08 19:58:25-00:00 !antona getting closer to mkntfs alpha. 2001/06/08 14:09:52-00:00 !antona mkntfs compiles. But untested. Also there are still things to do... 2001/06/07 23:31:54-00:00 !antona mkntfs - the end to the saga draws closer... 2001/06/06 22:55:49-00:00 !antona And some more mkntfs + some updates to layout.h concerning directories and alignment requirements. 2001/06/05 23:45:47-00:00 !antona The mkntfs saga continues. 2001/06/05 10:33:02-00:00 !antona Update automatic config/make process and mkntfs to use the cvs release tag for version reporting. 2001/06/05 10:19:53-00:00 !antona mkntfs update. 2001/06/04 23:38:55-00:00 !antona Integrate ldm.c into automatic build process. A bit more on mkntfs and make it compile (do _not_ run as it is - am working on directory creation so chances are it will hang if you run it or something). 2001/06/04 14:04:31-00:00 !antona More work on mkntfs dir stuff. 2001/06/04 11:29:45-00:00 !antona *** empty log message *** 2001/06/03 12:04:30-00:00 !antona More directory work in mkntfs 2001/06/03 02:09:08-00:00 !antona Fix/expand dircetory info in layout.h and add creation of index root attribute to mkntfs.c. 2001/06/01 19:04:08-00:00 !antona Updates & fixes. 2001/06/01 02:07:26-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/03/02 15:09:25-00:00 !antona Added begin of mkntfs utility. (Doesn't do anything, including doesn't compile at the moment.) (Logical change 1.5) --- ntfstools/mkntfs.c | 3554 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 3554 insertions(+) diff --git a/ntfstools/mkntfs.c b/ntfstools/mkntfs.c index e69de29b..47357c76 100644 --- a/ntfstools/mkntfs.c +++ b/ntfstools/mkntfs.c @@ -0,0 +1,3554 @@ +/* + * $Id$ + * + * mkntfs - Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (C) 2001-2002 Richard Russon. + * + * This utility will create an NTFS 1.2 (Windows NT 4.0) volume on a user + * specified (block) device. + * + * Some things (option handling and determination of mount status) have been + * adapted from e2fsprogs-1.19 and lib/ext2fs/ismounted.c and misc/mke2fs.c in + * particular. + * + * Anton Altaparmakov + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS source + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * WARNING: This program might not work on architectures which do not allow + * unaligned access. For those, the program would need to start using + * get/put_unaligned macros (#include ), but not doing it yet, + * since NTFS really mostly applies to ia32 only, which does allow unaligned + * accesses. We might not actually have a problem though, since the structs are + * defined as being packed so that might be enough for gcc to insert the + * correct code. + * + * If anyone using a non-little endian and/or an aligned access only CPU tries + * this program please let me know whether it works or not! + * + * Anton Altaparmakov + */ + +#include "config.h" + +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDARG_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_ERRNO_H +# include +#endif +#include +#ifdef HAVE_LINUX_FD_H +# include +# include +#endif +#include +#ifdef HAVE_GETOPT_H +# include +#else + extern char *optarg; + extern int optind; +#endif +#include +#ifdef HAVE_LINUX_MAJOR_H +# include +#endif +#ifndef MAJOR +# define MAJOR(dev) ((dev) >> 8) +# define MINOR(dev) ((dev) & 0xff) +#endif +#ifndef SCSI_BLK_MAJOR +# define SCSI_BLK_MAJOR(m) ((m) == SCSI_DISK_MAJOR || \ + (m) == SCSI_CDROM_MAJOR) +#endif +#include + +#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE) +# define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ +#endif + +#if defined(__linux__) && defined(_IO) && !defined(BLKSSZGET) +# define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytse. */ +#endif + +#include "types.h" +#include "bootsect.h" +#include "disk_io.h" +#include "attrib.h" +#include "bitmap.h" +#include "mst.h" +#include "dir.h" +#include "runlist.h" + +extern const unsigned char attrdef_ntfs12_array[2400]; +extern const unsigned char boot_array[3429]; +extern void init_system_file_sd(int sys_file_no, char **sd_val, + int *sd_val_len); +extern void init_upcase_table(uchar_t *uc, u32 uc_len); + +/* Page size on ia32. Can change to 8192 on Alpha. */ +#define NTFS_PAGE_SIZE 4096 + +const char *EXEC_NAME = "mkntfs"; + +/* Need these global so mkntfs_exit can access them. */ +struct flock flk; +char *buf = NULL; +char *buf2 = NULL; +int buf2_size = 0; +int mft_bitmap_size, mft_bitmap_byte_size; +unsigned char *mft_bitmap = NULL; +int lcn_bitmap_byte_size; +unsigned char *lcn_bitmap = NULL; +run_list *rl = NULL, *rl_mft = NULL, *rl_mft_bmp = NULL, *rl_mftmirr = NULL; +run_list *rl_logfile = NULL, *rl_boot = NULL, *rl_bad = NULL, *rl_index; +INDEX_ALLOCATION *index_block = NULL; +ntfs_volume *vol; + +struct { + int sector_size; /* -s, in bytes, power of 2, default is + 512 bytes. */ + long long nr_sectors; /* size of device in sectors */ + long long nr_clusters; /* Note: Win2k treats clusters as + 32-bit entities! */ + long long volume_size; /* in bytes, or suffixed + with k for kB, m or M for MB, or + g or G for GB, or t or T for TB */ + int index_block_size; /* in bytes. */ + int mft_size; /* The bigger of 16kB & one cluster. */ + long long mft_lcn; /* lcn of $MFT, $DATA attribute. */ + long long mftmirr_lcn; /* lcn of $MFTMirr, $DATA. */ + long long logfile_lcn; /* lcn of $LogFile, $DATA. */ + int logfile_size; /* in bytes, determined from + volume_size. */ + char mft_zone_multiplier; /* -z, value from 1 to 4. Default is + 1. */ + long long mft_zone_end; /* Determined from volume_size and + mft_zone_multiplier, in clusters. */ + char no_action; /* -n, do not write to device, only + display what would be done. */ + char check_bad_blocks; /* read-only test for bad + clusters. */ + long long *bad_blocks; /* Array of bad clusters. */ + long long nr_bad_blocks; /* Number of bad clusters. */ + char *bad_blocks_filename; /* filename, file to read list of + bad clusters from. */ + ATTR_DEF *attr_defs; /* filename, attribute defs. */ + int attr_defs_len; /* in bytes */ + uchar_t *upcase; /* filename, upcase table. */ + u32 upcase_len; /* Determined automatically. */ + char quiet; /* -q, quiet execution. */ + char verbose; /* -v, verbose execution, given twice, + * really verbose execution (debug + * mode). */ + char force; /* -F, force fs creation. */ + char quick_format; /* -f or -Q, fast format, don't zero + the volume first. */ + char enable_compression; /* -C, enables compression of all files + on the volume by default. */ + char disable_indexing; /* -I, disables indexing of file + contents on the volume by default. */ + /* -V, print version and exit. */ +} opt; + +/* Error output. Ignores quiet (-q). */ +void Eprintf(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); +} + +void err_exit(const char *fmt, ...) __attribute__ ((noreturn)); + +/* Error output and terminate. Ignores quiet (-q). */ +void err_exit(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "Aborting...\n"); + exit(1); +} + +/* Debugging output (-vv). Overriden by quiet (-q). */ +void Dprintf(const char *fmt, ...) +{ + va_list ap; + + if (!opt.quiet && opt.verbose > 1) { + printf("DEBUG: "); + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } +} + +/* Verbose output (-v). */ +void Vprintf(const char *fmt, ...) +{ + va_list ap; + + if (!opt.quiet && opt.verbose > 0) { + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } +} + +/* Quietable output (if not -q). */ +void Qprintf(const char *fmt, ...) +{ + va_list ap; + + if (!opt.quiet) { + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } +} + +void append_to_bad_blocks(unsigned long block) +{ + long long *new_buf; + + if (!(opt.nr_bad_blocks & 15)) { + new_buf = realloc(opt.bad_blocks, (opt.nr_bad_blocks + 16) * + sizeof(long long)); + if (!new_buf) + err_exit("Reallocating memory for bad blocks list " + "failed: %s\n", strerror(errno)); + if (opt.bad_blocks != new_buf) + free(opt.bad_blocks); + opt.bad_blocks = new_buf; + } + opt.bad_blocks[opt.nr_bad_blocks++] = block; +} + +__inline__ long long mkntfs_write(int fd, const void *buf, long long count) +{ + long long bytes_written, total; + int retry; + + if (opt.no_action) + return count; + total = 0LL; + retry = 0; + do { + bytes_written = write(fd, buf, count); + if (bytes_written == -1LL) { + retry = errno; + Eprintf("Error writing to %s: %s\n", vol->dev_name, + strerror(errno)); + errno = retry; + return bytes_written; + } else if (!bytes_written) + ++retry; + else { + count -= bytes_written; + total += bytes_written; + } + } while (count && retry < 3); + if (count) + Eprintf("Failed to complete writing to %s after three retries." + "\n", vol->dev_name); + return total; +} + +/* + * Write to disk the clusters contained in the run list @rl taking the data + * from @val. Take @val_len bytes from @val and pad the rest with zeroes. + * + * If the @rl specifies a completely sparse file, @val is allowed to be NULL. + * + * @inited_size if not NULL points to an output variable which will contain + * the actual number of bytes written to disk. I.e. this will not include + * sparse bytes for example. + * + * Return the number of bytes written (minus padding) or -1 on error. Errno + * will be set to the error code. + */ +s64 ntfs_rlwrite(int fd, const run_list *rl, const char *val, + const s64 val_len, s64 *inited_size) +{ + s64 bytes_written, total, length, delta; + int retry, i; + + if (inited_size) + *inited_size = 0LL; + if (opt.no_action) + return val_len; + total = delta = 0LL; + for (i = 0; rl[i].length; i++) { + length = rl[i].length * vol->cluster_size; + /* Don't write sparse runs. */ + if (rl[i].lcn == -1) { + total += length; + if (!val) + continue; + // TODO: Check that *val is really zero at pos and len. + continue; + } + if (lseek(fd, rl[i].lcn * vol->cluster_size, SEEK_SET) == + (off_t)-1) + return -1LL; + retry = 0; + do { + if (total + length > val_len) { + delta = length; + length = val_len - total; + delta -= length; + } + bytes_written = write(fd, val + total, length); + if (bytes_written == -1LL) { + retry = errno; + Eprintf("Error writing to %s: %s\n", + vol->dev_name, strerror(errno)); + errno = retry; + return bytes_written; + } + if (bytes_written) { + length -= bytes_written; + total += bytes_written; + if (inited_size) + *inited_size += bytes_written; + } else + ++retry; + } while (length && retry < 3); + if (length) { + Eprintf("Failed to complete writing to %s after three " + "retries.\n", vol->dev_name); + return total; + } + } + if (delta) { + char *buf = (char*)calloc(1, delta); + if (!buf) + err_exit("Error allocating internal buffer: " + "%s\n", strerror(errno)); + bytes_written = mkntfs_write(fd, buf, delta); + free(buf); + if (bytes_written == -1LL) + return bytes_written; + } + return total; +} + +/** + * ucslen - determine the length of a fixed-size unicode-character string + * @s: pointer to unicode-character string + * + * Return the number of unicode-characters in @s up to a maximum of maxlen + * unicode-characters, not including the terminating (uchar_t)'\0'. If there + * is no (uchar_t)'\0' between s and s+maxlen, maxlen is returned. + * + * This function never looks beyond s+maxlen. + */ +int ucsnlen(const uchar_t *s, int maxlen) +{ + int i; + + for (i = 0; i < maxlen; i++) + if (!s[i]) + break; + return i; +} + +/** + * ucstos - convert unicode-character string to ASCII + * @dest: points to buffer to receive the converted string + * @src: points to string to convert + * @maxlen: size of @dest buffer in bytes + * + * Return the number of characters written to @dest, not including the + * terminating null byte. If a unicode character was encountered which could + * not be converted -1 is returned. + */ +int ucstos(char *dest, const uchar_t *src, int maxlen) +{ + uchar_t u; + int i; + + /* Need one byte for null terminator. */ + maxlen--; + for (i = 0; i < maxlen; i++) { + u = le16_to_cpu(src[i]); + if (!u) + break; + if (u & 0xff00) + return -1; + dest[i] = u & 0xff; + } + dest[i] = 0; + return i; +} + +/** + * stoucs - convert ASCII string to unicode-character string + * @dest: points to buffer to receive the converted string + * @src: points to string to convert + * @maxlen: size of @dest buffer in bytes + * + * Return the number of characters written to @dest, not including the + * terminating null unicode character. + */ +int stoucs(uchar_t *dest, const char *src, int maxlen) +{ + char c; + int i; + + /* Need two bytes for null terminator. */ + maxlen -= 2; + for (i = 0; i < maxlen; i++) { + c = src[i]; + if (!c) + break; + dest[i] = cpu_to_le16(c); + } + dest[i] = cpu_to_le16('\0'); + return i; +} + +void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) +{ + const char *don_t_know = "Don't know what to do with this attribute " + "type yet."; + const char *skip = "Skipping display of $%s attribute value.\n"; + const char *todo = "This is still work in progress."; + char *buf; + int i, j; + + switch (type) { + case AT_STANDARD_INFORMATION: + // TODO + printf("%s\n", todo); + return; + case AT_ATTRIBUTE_LIST: + // TODO + printf("%s\n", todo); + return; + case AT_FILE_NAME: + // TODO + printf("%s\n", todo); + return; + case AT_OBJECT_ID: + // TODO + printf("%s\n", todo); + return; + case AT_SECURITY_DESCRIPTOR: + // TODO + printf("%s\n", todo); + return; + case AT_VOLUME_NAME: + printf("Volume name length = %i\n", val_len); + if (val_len) { + buf = calloc(1, val_len); + if (!buf) + err_exit("Failed to allocate internal buffer: " + "%s\n", strerror(errno)); + i = ucstos(buf, (uchar_t*)val, val_len); + if (i == -1) + printf("Volume name contains non-displayable " + "Unicode characters.\n"); + printf("Volume name = %s\n", buf); + free(buf); + } + return; + case AT_VOLUME_INFORMATION: +#define VOL_INF(x) ((VOLUME_INFORMATION *)(x)) + printf("NTFS version %i.%i\n", VOL_INF(val)->major_ver, + VOL_INF(val)->minor_ver); + i = VOL_INF(val)->flags; +#undef VOL_INF + printf("Volume flags = 0x%x: ", i); + if (!i) { + printf("NONE\n"); + return; + } + j = 0; + if (i & VOLUME_MODIFIED_BY_CHKDSK) { + j = 1; + printf("VOLUME_MODIFIED_BY_CHKDSK"); + } + if (i & VOLUME_REPAIR_OBJECT_ID) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_REPAIR_OBJECT_ID"); + } + if (i & VOLUME_DELETE_USN_UNDERWAY) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_DELETE_USN_UNDERWAY"); + } + if (i & VOLUME_MOUNTED_ON_NT4) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_MOUNTED_ON_NT4"); + } + if (i & VOLUME_UPGRADE_ON_MOUNT) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_UPGRADE_ON_MOUNT"); + } + if (i & VOLUME_RESIZE_LOG_FILE) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_RESIZE_LOG_FILE"); + } + if (i & VOLUME_IS_DIRTY) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_IS_DIRTY"); + } + printf("\n"); + return; + case AT_DATA: + printf(skip, "DATA"); + return; + case AT_INDEX_ROOT: + // TODO + printf("%s\n", todo); + return; + case AT_INDEX_ALLOCATION: + // TODO + printf("%s\n", todo); + return; + case AT_BITMAP: + printf(skip, "BITMAP"); + return; + case AT_REPARSE_POINT: + // TODO + printf("%s\n", todo); + return; + case AT_EA_INFORMATION: + // TODO + printf("%s\n", don_t_know); + return; + case AT_EA: + // TODO + printf("%s\n", don_t_know); + return; + case AT_LOGGED_UTILITY_STREAM: + // TODO + printf("%s\n", don_t_know); + return; + default: + i = le32_to_cpu(type); + printf("Cannot display unknown %s defined attribute type 0x%x" + ".\n", i >= + le32_to_cpu(AT_FIRST_USER_DEFINED_ATTRIBUTE) ? + "user" : "system", i); + } +} + +void dump_resident_attr(ATTR_RECORD *a) +{ + int i; + + i = le32_to_cpu(a->value_length); + printf("Attribute value length = %u (0x%x)\n", i, i); + i = le16_to_cpu(a->value_offset); + printf("Attribute value offset = %u (0x%x)\n", i, i); + i = a->resident_flags; + printf("Resident flags = 0x%x: ", i); + if (!i) + printf("NONE\n"); + else if (i & ~RESIDENT_ATTR_IS_INDEXED) + printf("UNKNOWN FLAG(S)\n"); + else + printf("RESIDENT_ATTR_IS_INDEXED\n"); + dump_resident_attr_val(a->type, (char*)a + le16_to_cpu(a->value_offset), + le32_to_cpu(a->value_length)); +} + +void dump_mapping_pairs_array(char *b, unsigned int max_len) +{ + // TODO + return; +} + +void dump_non_resident_attr(ATTR_RECORD *a) +{ + s64 l; + int i; + + l = sle64_to_cpu(a->lowest_vcn); + printf("Lowest VCN = %Li (0x%Lx)\n", l, l); + l = sle64_to_cpu(a->highest_vcn); + printf("Highest VCN = %Li (0x%Lx)\n", l, l); + printf("Mapping pairs array offset = 0x%x\n", + le16_to_cpu(a->mapping_pairs_offset)); + printf("Compression unit = 0x%x: %sCOMPRESSED\n", a->compression_unit, + a->compression_unit ? "" : "NOT "); + if (sle64_to_cpu(a->lowest_vcn)) + printf("Attribute is not the first extent. The following " + "sizes are meaningless:\n"); + l = sle64_to_cpu(a->allocated_size); + printf("Allocated size = %Li (0x%Lx)\n", l, l); + l = sle64_to_cpu(a->data_size); + printf("Data size = %Li (0x%Lx)\n", l, l); + l = sle64_to_cpu(a->initialized_size); + printf("Initialized size = %Li (0x%Lx)\n", l, l); + if (a->flags & ATTR_COMPRESSION_MASK) { + l = sle64_to_cpu(a->compressed_size); + printf("Compressed size = %Li (0x%Lx)\n", l, l); + } + i = le16_to_cpu(a->mapping_pairs_offset); + dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); +} + +void dump_attr_record(ATTR_RECORD *a) +{ + unsigned int u; + char s[0x200]; + int i; + + printf("-- Beginning dump of attribute record. --\n"); + if (a->type == AT_END) { + printf("Attribute type = 0x%x ($END)\n", le32_to_cpu(AT_END)); + u = le32_to_cpu(a->length); + printf("Length of resident part = %u (0x%x)\n", u, u); + return; + } + u = le32_to_cpu(a->type); + for (i = 0; opt.attr_defs[i].type; i++) + if (le32_to_cpu(opt.attr_defs[i].type) >= u) + break; + if (opt.attr_defs[i].type) { +// printf("type = 0x%x\n", le32_to_cpu(opt.attr_defs[i].type)); +// { char *p = (char*)opt.attr_defs[i].name; +// printf("name = %c%c%c%c%c\n", *p, p[1], p[2], p[3], p[4]); +// } + if (ucstos(s, opt.attr_defs[i].name, sizeof(s)) == -1) { + Eprintf("Could not convert Unicode string to single " + "byte string in current locale.\n"); + strncpy(s, "Error converting Unicode string", + sizeof(s)); + } + } else + strncpy(s, "UNKNOWN_TYPE", sizeof(s)); + printf("Attribute type = 0x%x (%s)\n", u, s); + u = le32_to_cpu(a->length); + printf("Length of resident part = %u (0x%x)\n", u, u); + printf("Attribute is %sresident\n", a->non_resident ? "non-" : ""); + printf("Name length = %u unicode characters\n", a->name_length); + printf("Name offset = %u (0x%x)\n", cpu_to_le16(a->name_offset), + cpu_to_le16(a->name_offset)); + u = a->flags; + if (a->name_length) { + if (ucstos(s, (uchar_t*)((char*)a + + cpu_to_le16(a->name_offset)), + min(sizeof(s), a->name_length + 1)) == -1) { + Eprintf("Could not convert Unicode string to single " + "byte string in current locale.\n"); + strncpy(s, "Error converting Unicode string", + sizeof(s)); + + } + printf("Name = %s\n", s); + } + printf("Attribute flags = 0x%x: ", le16_to_cpu(u)); + if (!u) + printf("NONE"); + else { + int first = TRUE; + if (u & ATTR_COMPRESSION_MASK) { + if (u & ATTR_IS_COMPRESSED) { + printf("ATTR_IS_COMPRESSED"); + first = FALSE; + } + if ((u & ATTR_COMPRESSION_MASK) & ~ATTR_IS_COMPRESSED) { + if (!first) + printf(" | "); + else + first = FALSE; + printf("ATTR_UNKNOWN_COMPRESSION"); + } + } + if (u & ATTR_IS_ENCRYPTED) { + if (!first) + printf(" | "); + else + first = FALSE; + printf("ATTR_IS_ENCRYPTED"); + } + if (u & ATTR_IS_SPARSE) { + if (!first) + printf(" | "); + else + first = FALSE; + printf("ATTR_IS_SPARSE"); + } + } + printf("\n"); + printf("Attribute instance = %u\n", le16_to_cpu(a->instance)); + if (a->non_resident) { + dump_non_resident_attr(a); + } else { + dump_resident_attr(a); + } +} + +void dump_mft_record(MFT_RECORD *m) +{ + ATTR_RECORD *a; + unsigned int u; + MFT_REF r; + + printf("-- Beginning dump of mft record. --\n"); + u = le32_to_cpu(m->magic); + printf("Mft record signature (magic) = %c%c%c%c\n", u & 0xff, + u >> 8 & 0xff, u >> 16 & 0xff, u >> 24 & 0xff); + u = le16_to_cpu(m->usa_ofs); + printf("Update sequence array offset = %u (0x%x)\n", u, u); + printf("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); + printf("$LogFile sequence number (lsn) = %Lu\n", le64_to_cpu(m->lsn)); + printf("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); + printf("Reference (hard link) count = %u\n", + le16_to_cpu(m->link_count)); + u = le16_to_cpu(m->attrs_offset); + printf("First attribute offset = %u (0x%x)\n", u, u); + printf("Flags = %u: ", le16_to_cpu(m->flags)); + if (m->flags & MFT_RECORD_IN_USE) + printf("MFT_RECORD_IN_USE"); + else + printf("MFT_RECORD_NOT_IN_USE"); + if (m->flags & MFT_RECORD_IS_DIRECTORY) + printf(" | MFT_RECORD_IS_DIRECTORY"); + printf("\n"); + u = le32_to_cpu(m->bytes_in_use); + printf("Bytes in use = %u (0x%x)\n", u, u); + u = le32_to_cpu(m->bytes_allocated); + printf("Bytes allocated = %u (0x%x)\n", u, u); + r = le64_to_cpu(m->base_mft_record); + printf("Base mft record reference:\n\tMft record number = %Lu\n\t" + "Sequence number = %u\n", MREF(r), MSEQNO(r)); + printf("Next attribute instance = %u\n", + le16_to_cpu(m->next_attr_instance)); + a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); + printf("-- Beginning dump of attributes within mft record. --\n"); + while ((char*)a < (char*)m + le32_to_cpu(m->bytes_in_use)) { + dump_attr_record(a); + if (a->type == AT_END) + break; + a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); + }; + printf("-- End of attributes. --\n"); +} + +void format_mft_record(MFT_RECORD *m) +{ + ATTR_RECORD *a; + + memset(m, 0, vol->mft_record_size); + m->magic = magic_FILE; + /* Aligned to 2-byte boundary. */ + m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD) + 1) & ~1); + if (vol->mft_record_size >= NTFS_SECTOR_SIZE) + m->usa_count = cpu_to_le16(vol->mft_record_size / + NTFS_SECTOR_SIZE + 1); + else { + m->usa_count = cpu_to_le16(1); + Qprintf("Sector size is bigger than MFT record size. Setting " + "usa_count to 1. If Windows\nchkdsk reports this as " + "corruption, please email linux-ntfs-dev@lists.sf.net\n" + "stating that you saw this message and that the file " + "system created was corrupt.\nThank you."); + } + /* Set the update sequence number to 1. */ + *(u16*)((char*)m + ((sizeof(MFT_RECORD) + 1) & ~1)) = cpu_to_le16(1); + m->lsn = cpu_to_le64(0LL); + m->sequence_number = cpu_to_le16(1); + m->link_count = cpu_to_le16(0); + /* Aligned to 8-byte boundary. */ + m->attrs_offset = cpu_to_le16((le16_to_cpu(m->usa_ofs) + + (le16_to_cpu(m->usa_count) << 1) + 7) & ~7); + m->flags = cpu_to_le16(0); + /* + * Using attrs_offset plus eight bytes (for the termination attribute), + * aligned to 8-byte boundary. + */ + m->bytes_in_use = cpu_to_le32((le16_to_cpu(m->attrs_offset) + 8 + 7) & + ~7); + m->bytes_allocated = cpu_to_le32(vol->mft_record_size); + m->base_mft_record = cpu_to_le64((MFT_REF)0); + m->next_attr_instance = cpu_to_le16(0); + a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); + a->type = AT_END; + a->length = cpu_to_le32(0); +#if 0 + if (!opt.quiet && opt.verbose > 1) + dump_mft_record(m); +#endif +} + +/** + * make_room_for_attribute - make room for an attribute inside an mft record + * @m: mft record + * @pos: position at which to make space + * @size: byte size to make available at this position + * + * @pos points to the attribute in front of which we want to make space. + * + * Return 0 on success or -errno on error. Possible error codes are: + * + * -ENOSPC There is not enough space available to complete + * operation. The caller has to make space before calling + * this. + * -EINVAL Can only occur if mkntfs was compiled with -DEBUG. Means + * the input parameters were faulty. + */ +int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) +{ + u32 biu; + + if (!size) + return 0; +#ifdef DEBUG + /* + * Rigorous consistency checks. Always return -EINVAL even if more + * appropriate codes exist for simplicity of parsing the return value. + */ + if (size != ((size + 7) & ~7)) { + Eprintf("make_room_for_attribute() received non 8-byte aligned" + "size.\n"); + return -EINVAL; + } + if (!m || !pos) + return -EINVAL; + if (pos < (char*)m || pos + size < (char*)m || + pos > (char*)m + le32_to_cpu(m->bytes_allocated) || + pos + size > (char*)m + le32_to_cpu(m->bytes_allocated)) + return -EINVAL; + /* The -8 is for the attribute terminator. */ + if (pos - (char*)m > le32_to_cpu(m->bytes_in_use) - 8) + return -EINVAL; +#endif + biu = le32_to_cpu(m->bytes_in_use); + /* Do we have enough space? */ + if (biu + size > le32_to_cpu(m->bytes_allocated)) + return -ENOSPC; + /* Move everything after pos to pos + size. */ + memmove(pos + size, pos, biu - (pos - (char*)m)); + /* Update mft record. */ + m->bytes_in_use = cpu_to_le32(biu + size); + return 0; +} + +/* Return 0 on success and -errno on error. */ +int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, + const u32 new_vsize) +{ + int new_alen, new_muse; + + /* New attribute length and mft record bytes used. */ + new_alen = (le32_to_cpu(a->length) - le32_to_cpu(a->value_length) + + new_vsize + 7) & ~7; + new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + + new_alen; + /* Check for sufficient space. */ + if (new_muse > le32_to_cpu(m->bytes_allocated) ) { + // Aarrgghh! Need to make space. Probably want generic function + // for this as we need to call it from other places, too. + return -ENOTSUP; + } + /* Move attributes behind @a to their new location. */ + memmove((char*)a + new_alen, (char*)a + le32_to_cpu(a->length), + le32_to_cpu(m->bytes_in_use) - ((char*)a - (char*)m) - + le32_to_cpu(a->length)); + /* Adjust @m to reflect change in used space. */ + m->bytes_in_use = cpu_to_le32(new_muse); + /* Adjust @a to reflect new value size. */ + a->length = cpu_to_le32(new_alen); + a->value_length = cpu_to_le32(new_vsize); + return 0; +} + +void deallocate_scattered_clusters(const run_list *rl) +{ + LCN j; + int i; + + if (!rl) + return; + /* Iterate over all runs in the run list @rl. */ + for (i = 0; rl[i].length; i++) { + /* Skip sparse runs. */ + if (rl[i].lcn == -1LL) + continue; + /* Deallocate the current run. */ + for (j = rl[i].lcn; j < rl[i].lcn + rl[i].length; j++) + ntfs_set_bit(lcn_bitmap, j, 0); + } +} + +/* + * Allocate @clusters and create a run list of the allocated clusters. + * + * Return the allocated run list. Caller has to free the run list when finished + * with it. + * + * On error return NULL and errno is set to the error code. + * + * TODO: We should be returning the size as well, but for mkntfs this is not + * necessary. + */ +run_list *allocate_scattered_clusters(s64 clusters) +{ + run_list *rl = NULL, *rlt; + VCN vcn = 0LL; + LCN lcn, end, prev_lcn = 0LL; + int rlpos = 0; + int rlsize = 0; + s64 prev_run_len = 0LL; + char bit; + + end = opt.nr_clusters; + /* Loop until all clusters are allocated. */ + while (clusters) { + /* Loop in current zone until we run out of free clusters. */ + for (lcn = opt.mft_zone_end; lcn < end; lcn++) { + bit = ntfs_get_and_set_bit(lcn_bitmap, lcn, 1); + if (bit) + continue; + /* + * Reallocate memory if necessary. Make sure we have + * enough for the terminator entry as well. + */ + if ((rlpos + 2) * sizeof(run_list) >= rlsize) { + rlsize += 4096; /* PAGE_SIZE */ + rlt = realloc(rl, rlsize); + if (!rlt) + goto err_end; + rl = rlt; + } + /* Coalesce with previous run if adjacent LCNs. */ + if (prev_lcn == lcn - prev_run_len) { + rl[rlpos - 1].length = ++prev_run_len; + vcn++; + } else { + rl[rlpos].vcn = vcn++; + rl[rlpos].lcn = prev_lcn = lcn; + rl[rlpos].length = prev_run_len = 1LL; + rlpos++; + } + /* Done? */ + if (!--clusters) { + /* Add terminator element and return. */ + rl[rlpos].vcn = vcn; + rl[rlpos].lcn = rl[rlpos].length = 0LL; + return rl; + } + + } + /* Switch to next zone, decreasing mft zone by factor 2. */ + end = opt.mft_zone_end; + opt.mft_zone_end >>= 1; + /* Have we run out of space on the volume? */ + if (opt.mft_zone_end <= 0) + goto err_end; + } + return rl; +err_end: + if (rl) { + /* Add terminator element. */ + rl[rlpos].vcn = vcn; + rl[rlpos].lcn = -1LL; + rl[rlpos].length = 0LL; + /* Deallocate all allocated clusters. */ + deallocate_scattered_clusters(rl); + /* Free the run list. */ + free(rl); + } + return NULL; +} + +/* + * Create a non-resident attribute with a predefined on disk location + * specified by the run_list @rl. The clusters specified by @rl are assumed to + * be allocated already. + * + * Return 0 on success and -errno on error. + */ +int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, + const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, + const ATTR_FLAGS flags, const run_list *rl, + const char *val, const s64 val_len) +{ + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + u16 hdr_size; + int asize, mpa_size, err, i; + s64 bw = 0, inited_size; + VCN highest_vcn; + uchar_t *uname; +/* + if (base record) + lookup_attr(); + else +*/ + if (name_len) { + i = (name_len + 1) * sizeof(uchar_t); + uname = (uchar_t*)calloc(1, i); + if (!uname) + return -errno; + name_len = stoucs(uname, name, i); + if (name_len > 0xff) { + free(uname); + return -ENAMETOOLONG; + } + } else + uname = NULL; + /* Check if the attribute is already there. */ + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + Eprintf("Failed to allocate attribute search context.\n"); + err = -ENOMEM; + goto err_out; + } + if (ic == IGNORE_CASE) { + Eprintf("FIXME: Hit unimplemented code path #1.\n"); + err = -ENOTSUP; + goto err_out; + } + if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, NULL, 0, ctx)) { + err = -EEXIST; + goto err_out; + } + if (errno != ENOENT) { + Eprintf("Corrupt inode.\n"); + err = -errno; + goto err_out; + } + a = ctx->attr; + if (flags & ATTR_COMPRESSION_MASK) { + Eprintf("Compressed attributes not supported yet.\n"); + // FIXME: Compress attribute into a temporary buffer, set + // val accordingly and save the compressed size. + err = -ENOTSUP; + goto err_out; + } + if (flags & (ATTR_IS_ENCRYPTED || ATTR_IS_SPARSE)) { + Eprintf("Encrypted/sparse attributes not supported yet.\n"); + err = -ENOTSUP; + goto err_out; + } + if (flags & ATTR_COMPRESSION_MASK) { + hdr_size = 72; + // FIXME: This compression stuff is all wrong. Never mind for + // now. (AIA) + if (val_len) + mpa_size = 0; //get_size_for_compressed_mapping_pairs(rl); + else + mpa_size = 0; + } else { + hdr_size = 64; + if (val_len) { + mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl); + if (mpa_size < 0) { + err = -errno; + Eprintf("Failed to get size for mapping " + "pairs.\n"); + goto err_out; + } + } else + mpa_size = 0; + } + /* Mapping pairs array and next attribute must be 8-byte aligned. */ + asize = (((int)hdr_size + ((name_len + 7) & ~7) + mpa_size) + 7) & ~7; + /* Get the highest vcn. */ + for (i = 0, highest_vcn = 0LL; rl[i].length; i++) + highest_vcn += rl[i].length; + /* Does the value fit inside the allocated size? */ + if (highest_vcn * vol->cluster_size < val_len) { + Eprintf("BUG: Allocated size is smaller than data size!\n"); + err = -EINVAL; + goto err_out; + } + err = make_room_for_attribute(m, (char*)a, asize); + if (err == -ENOSPC) { + // FIXME: Make space! (AIA) + // can we make it non-resident? if yes, do that. + // does it fit now? yes -> do it. + // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? + // yes -> make non-resident + // does it fit now? yes -> do it. + // make all attributes non-resident + // does it fit now? yes -> do it. + // m is a base record? yes -> allocate extension record + // does the new attribute fit in there? yes -> do it. + // split up run_list into extents and place each in an extension + // record. + // FIXME: the check for needing extension records should be + // earlier on as it is very quick: asize > m->bytes_allocated? + err = -ENOTSUP; + goto err_out; + } +#ifdef DEBUG + else if (err == -EINVAL) { + fprintf(stderr, "BUG(): in insert_positioned_attribute_in_mft_" + "record(): make_room_for_attribute() returned " + "error: EINVAL!\n"); + goto err_out; + } +#endif + a->type = type; + a->length = cpu_to_le32(asize); + a->non_resident = 1; + a->name_length = name_len; + a->name_offset = cpu_to_le16(hdr_size); + a->flags = flags; + a->instance = m->next_attr_instance; + m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance) + + 1) & 0xffff); + a->lowest_vcn = cpu_to_le64(0); + a->highest_vcn = cpu_to_le64(highest_vcn - 1LL); + a->mapping_pairs_offset = cpu_to_le16(hdr_size + ((name_len + 7) & ~7)); + memset(a->reserved1, 0, sizeof(a->reserved1)); + // FIXME: Allocated size depends on compression. + a->allocated_size = cpu_to_le64(highest_vcn * vol->cluster_size); + a->data_size = cpu_to_le64(val_len); + if (name_len) + memcpy((char*)a + hdr_size, uname, name_len << 1); + if (flags & ATTR_COMPRESSION_MASK) { + if (flags & ATTR_COMPRESSION_MASK & ~ATTR_IS_COMPRESSED) { + Eprintf("Unknown compression format. Reverting to " + "standard compression.\n"); + a->flags &= ~ATTR_COMPRESSION_MASK; + a->flags |= ATTR_IS_COMPRESSED; + } + a->compression_unit = 4; + inited_size = val_len; + // FIXME: Set the compressed size. + a->compressed_size = cpu_to_le64(0); + // FIXME: Write out the compressed data. + // FIXME: err = build_mapping_pairs_compressed(); + err = -ENOTSUP; + } else { + a->compression_unit = 0; + bw = ntfs_rlwrite(vol->fd, rl, val, val_len, &inited_size); + if (bw != val_len) + Eprintf("Error writing non-resident attribute value." + "\n"); + err = ntfs_build_mapping_pairs(vol, (s8*)a + hdr_size + + ((name_len + 7) & ~7), mpa_size, rl); + } + a->initialized_size = cpu_to_le64(inited_size); + if (err < 0 || bw != val_len) { + // FIXME: Handle error. + // deallocate clusters + // remove attribute + if (err >= 0) + err = -EIO; + Eprintf("insert_positioned_attr_in_mft_record failed with " + "error %i.\n", err < 0 ? err : bw); + } +err_out: + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (uname) + free(uname); + return err; +} + +/* Return 0 on success and -errno on error. */ +int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, + const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, + const ATTR_FLAGS flags, const char *val, const s64 val_len) +{ + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + u16 hdr_size; + int asize, mpa_size, err, i; + run_list *rl = NULL; + s64 bw = 0; + uchar_t *uname; +/* + if (base record) + lookup_attr(); + else +*/ + if (name_len) { + i = (name_len + 1) * sizeof(uchar_t); + uname = (uchar_t*)calloc(1, i); + if (!uname) + return -errno; + name_len = stoucs(uname, name, i); + if (name_len > 0xff) { + free(uname); + return -ENAMETOOLONG; + } + } else + uname = AT_UNNAMED; + /* Check if the attribute is already there. */ + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + Eprintf("Failed to allocate attribute search context.\n"); + err = -ENOMEM; + goto err_out; + } + if (ic == IGNORE_CASE) { + Eprintf("FIXME: Hit unimplemented code path #2.\n"); + err = -ENOTSUP; + goto err_out; + } + if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, NULL, 0, ctx)) { + err = -EEXIST; + goto err_out; + } + if (errno != ENOENT) { + Eprintf("Corrupt inode.\n"); + err = -errno; + goto err_out; + } + a = ctx->attr; + if (flags & ATTR_COMPRESSION_MASK) { + Eprintf("Compressed attributes not supported yet.\n"); + // FIXME: Compress attribute into a temporary buffer, set + // val accordingly and save the compressed size. + err = -ENOTSUP; + goto err_out; + } + if (flags & (ATTR_IS_ENCRYPTED || ATTR_IS_SPARSE)) { + Eprintf("Encrypted/sparse attributes not supported yet.\n"); + err = -ENOTSUP; + goto err_out; + } + if (val_len) { + rl = allocate_scattered_clusters((val_len + + vol->cluster_size - 1) / vol->cluster_size); + if (!rl) { + err = -errno; + Eprintf("Failed to allocate scattered clusters: %s\n", + strerror(-err)); + goto err_out; + } + } else + rl = NULL; + if (flags & ATTR_COMPRESSION_MASK) { + hdr_size = 72; + // FIXME: This compression stuff is all wrong. Never mind for + // now. (AIA) + if (val_len) + mpa_size = 0; //get_size_for_compressed_mapping_pairs(rl); + else + mpa_size = 0; + } else { + hdr_size = 64; + if (val_len) { + mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl); + if (mpa_size < 0) { + err = -errno; + Eprintf("Failed to get size for mapping " + "pairs.\n"); + goto err_out; + } + } else + mpa_size = 0; + } + /* Mapping pairs array and next attribute must be 8-byte aligned. */ + asize = (((int)hdr_size + ((name_len + 7) & ~7) + mpa_size) + 7) & ~7; + err = make_room_for_attribute(m, (char*)a, asize); + if (err == -ENOSPC) { + // FIXME: Make space! (AIA) + // can we make it non-resident? if yes, do that. + // does it fit now? yes -> do it. + // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? + // yes -> make non-resident + // does it fit now? yes -> do it. + // make all attributes non-resident + // does it fit now? yes -> do it. + // m is a base record? yes -> allocate extension record + // does the new attribute fit in there? yes -> do it. + // split up run_list into extents and place each in an extension + // record. + // FIXME: the check for needing extension records should be + // earlier on as it is very quick: asize > m->bytes_allocated? + err = -ENOTSUP; + goto err_out; + } +#ifdef DEBUG + else if (err == -EINVAL) { + fprintf(stderr, "BUG(): in insert_non_resident_attribute_in_" + "mft_record(): make_room_for_attribute() " + "returned error: EINVAL!\n"); + goto err_out; + } +#endif + a->type = type; + a->length = cpu_to_le32(asize); + a->non_resident = 1; + a->name_length = name_len; + a->name_offset = cpu_to_le16(hdr_size); + a->flags = flags; + a->instance = m->next_attr_instance; + m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance) + + 1) & 0xffff); + a->lowest_vcn = cpu_to_le64(0); + for (i = 0; rl[i].length; i++) + ; + a->highest_vcn = cpu_to_le64(rl[i].vcn - 1); + a->mapping_pairs_offset = cpu_to_le16(hdr_size + ((name_len + 7) & ~7)); + memset(a->reserved1, 0, sizeof(a->reserved1)); + // FIXME: Allocated size depends on compression. + a->allocated_size = cpu_to_le64((val_len + (vol->cluster_size - 1)) & + ~(vol->cluster_size - 1)); + a->data_size = cpu_to_le64(val_len); + a->initialized_size = cpu_to_le64(val_len); + if (name_len) + memcpy((char*)a + hdr_size, uname, name_len << 1); + if (flags & ATTR_COMPRESSION_MASK) { + if (flags & ATTR_COMPRESSION_MASK & ~ATTR_IS_COMPRESSED) { + Eprintf("Unknown compression format. Reverting to " + "standard compression.\n"); + a->flags &= ~ATTR_COMPRESSION_MASK; + a->flags |= ATTR_IS_COMPRESSED; + } + a->compression_unit = 4; + // FIXME: Set the compressed size. + a->compressed_size = cpu_to_le64(0); + // FIXME: Write out the compressed data. + // FIXME: err = build_mapping_pairs_compressed(); + err = -ENOTSUP; + } else { + a->compression_unit = 0; + bw = ntfs_rlwrite(vol->fd, rl, val, val_len, NULL); + if (bw != val_len) + Eprintf("Error writing non-resident attribute value." + "\n"); + err = ntfs_build_mapping_pairs(vol, (s8*)a + hdr_size + + ((name_len + 7) & ~7), mpa_size, rl); + } + if (err < 0 || bw != val_len) { + // FIXME: Handle error. + // deallocate clusters + // remove attribute + if (err >= 0) + err = -EIO; + Eprintf("insert_non_resident_attr_in_mft_record failed with " + "error %i.\n", err < 0 ? err : bw); + } +err_out: + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (uname && (uname != AT_UNNAMED)) + free(uname); + if (rl) + free(rl); + return err; +} + +/* Return 0 on success and -errno on error. */ +int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, + const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, + const ATTR_FLAGS flags, const RESIDENT_ATTR_FLAGS res_flags, + const char *val, const u32 val_len) +{ + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + int asize, err, i; + uchar_t *uname; +/* + if (base record) + lookup_attr(); + else +*/ + if (name_len) { + i = (name_len + 1) * sizeof(uchar_t); + uname = (uchar_t*)calloc(1, i); + name_len = stoucs(uname, name, i); + if (name_len > 0xff) + return -ENAMETOOLONG; + } else + uname = AT_UNNAMED; + /* Check if the attribute is already there. */ + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + Eprintf("Failed to allocate attribute search context.\n"); + err = -ENOMEM; + goto err_out; + } + if (ic == IGNORE_CASE) { + Eprintf("FIXME: Hit unimplemented code path #3.\n"); + err = -ENOTSUP; + goto err_out; + } + if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, val, val_len, + ctx)) { + err = -EEXIST; + goto err_out; + } + if (errno != ENOENT) { + Eprintf("Corrupt inode.\n"); + err = -errno; + goto err_out; + } + a = ctx->attr; + /* sizeof(resident attribute record header) == 24 */ + asize = ((24 + ((name_len + 7) & ~7) + val_len) + 7) & ~7; + err = make_room_for_attribute(m, (char*)a, asize); + if (err == -ENOSPC) { + // FIXME: Make space! (AIA) + // can we make it non-resident? if yes, do that. + // does it fit now? yes -> do it. + // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? + // yes -> make non-resident + // does it fit now? yes -> do it. + // make all attributes non-resident + // does it fit now? yes -> do it. + // m is a base record? yes -> allocate extension record + // does the new attribute fit in there? yes -> do it. + // split up run_list into extents and place each in an extension + // record. + // FIXME: the check for needing extension records should be + // earlier on as it is very quick: asize > m->bytes_allocated? + err = -ENOTSUP; + goto err_out; + } +#ifdef DEBUG + if (err == -EINVAL) { + fprintf(stderr, "BUG(): in insert_resident_attribute_in_mft_" + "record(): make_room_for_attribute() returned " + "error: EINVAL!\n"); + goto err_out; + } +#endif + a->type = type; + a->length = cpu_to_le32(asize); + a->non_resident = 0; + a->name_length = name_len; + a->name_offset = cpu_to_le16(24); + a->flags = cpu_to_le16(flags); + a->instance = m->next_attr_instance; + m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance) + + 1) & 0xffff); + a->value_length = cpu_to_le32(val_len); + a->value_offset = cpu_to_le16(24 + ((name_len + 7) & ~7)); + a->resident_flags = res_flags; + a->reservedR = 0; + if (name_len) + memcpy((char*)a + 24, uname, name_len << 1); + if (val_len) + memcpy((char*)a + le16_to_cpu(a->value_offset), val, val_len); +err_out: + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (uname && (uname != AT_UNNAMED)) + free(uname); + return err; +} + +s64 time2ntfs(s64 time) +{ + return cpu_to_le64((time + (s64)(369 * 365 + 89) * 24 * 3600) + * 10000000); +} + +/* Return 0 on success or -errno on error. */ +int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) +{ + STANDARD_INFORMATION si; + int err; + + si.creation_time = time2ntfs(time(NULL)); + si.last_data_change_time = si.creation_time; + si.last_mft_change_time = si.creation_time; + si.last_access_time = si.creation_time; + si.file_attributes = flags; /* already LE */ + if (vol->major_ver < 3) + memset(&si.reserved12, 0, sizeof(si.reserved12)); + else { + si.maximum_versions = cpu_to_le32(0); + si.version_number = cpu_to_le32(0); + si.class_id = cpu_to_le32(0); + /* FIXME: $Secure support... */ + si.security_id = cpu_to_le32(0); + /* FIXME: $Quota support... */ + si.owner_id = cpu_to_le32(0); + si.quota_charged = cpu_to_le64(0ULL); + /* FIXME: $UsnJrnl support... */ + si.usn = cpu_to_le64(0ULL); + } + /* NTFS 1.2: size of si = 48, NTFS 3.0: size of si = 72 */ + err = insert_resident_attr_in_mft_record(m, AT_STANDARD_INFORMATION, + NULL, 0, 0, 0, 0, (char*)&si, + vol->major_ver < 3 ? 48 : 72); + if (err < 0) + Eprintf("add_attr_std_info failed: %s\n", strerror(-err)); + return err; +} + +/* Return 0 on success or -errno on error. */ +int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, + const s64 allocated_size, const s64 data_size, + const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, + const u32 reparse_point_tag, const char *file_name, + const FILE_NAME_TYPE_FLAGS file_name_type) +{ + ntfs_attr_search_ctx *ctx; + STANDARD_INFORMATION *si; + FILE_NAME_ATTR *fn; + int i, fn_size; + + /* Check if the attribute is already there. */ + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + Eprintf("Failed to allocate attribute search context.\n"); + return -ENOMEM; + } + if (ntfs_lookup_attr(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, + ctx)) { + int eo = errno; + Eprintf("BUG: Standard information attribute not present in " + "file record\n"); + ntfs_put_attr_search_ctx(ctx); + return -eo; + } + si = (STANDARD_INFORMATION*)((char*)ctx->attr + + le16_to_cpu(ctx->attr->value_offset)); + i = (strlen(file_name) + 1) * sizeof(uchar_t); + fn_size = sizeof(FILE_NAME_ATTR) + i; + fn = (FILE_NAME_ATTR*)malloc(fn_size); + if (!fn) { + ntfs_put_attr_search_ctx(ctx); + return -errno; + } + fn->parent_directory = parent_dir; + + fn->creation_time = si->creation_time; + fn->last_data_change_time = si->last_data_change_time; + fn->last_mft_change_time = si->last_mft_change_time; + fn->last_access_time = si->last_access_time; + ntfs_put_attr_search_ctx(ctx); + + fn->allocated_size = cpu_to_le64(allocated_size); + fn->data_size = cpu_to_le64(data_size); + fn->file_attributes = flags; + /* These are in a union so can't have both. */ + if (packed_ea_size && reparse_point_tag) { + free(fn); + return -EINVAL; + } + if (packed_ea_size) { + fn->packed_ea_size = cpu_to_le16(packed_ea_size); + fn->reserved = cpu_to_le16(0); + } else + fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); + fn->file_name_type = file_name_type; + i = stoucs(fn->file_name, file_name, i); + if (i < 1) { + free(fn); + return -EINVAL; + } + if (i > 0xff) { + free(fn); + return -ENAMETOOLONG; + } + /* No terminating null in file names. */ + fn->file_name_length = i; + fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(uchar_t); + i = insert_resident_attr_in_mft_record(m, AT_FILE_NAME, NULL, 0, 0, + 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size); + free(fn); + if (i < 0) + Eprintf("add_attr_file_name failed: %s\n", strerror(-i)); + return i; +} + +/* + * Create the security descriptor attribute adding the security descriptor @sd + * of length @sd_len to the mft record @m. + * + * Return 0 on success or -errno on error. + */ +int add_attr_sd(MFT_RECORD *m, const char *sd, const s64 sd_len) +{ + int err; + + /* Does it fit? NO: create non-resident. YES: create resident. */ + if (le32_to_cpu(m->bytes_in_use) + 24 + sd_len > + le32_to_cpu(m->bytes_allocated)) + err = insert_non_resident_attr_in_mft_record(m, + AT_SECURITY_DESCRIPTOR, NULL, 0, 0, 0, sd, + sd_len); + else + err = insert_resident_attr_in_mft_record(m, + AT_SECURITY_DESCRIPTOR, NULL, 0, 0, 0, 0, sd, + sd_len); + if (err < 0) + Eprintf("add_attr_sd failed: %s\n", strerror(-err)); + return err; +} + +/* Return 0 on success or -errno on error. */ +int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, + const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, + const char *val, const s64 val_len) +{ + int err; + + /* + * Does it fit? NO: create non-resident. YES: create resident. + * + * FIXME: Introduced arbitrary limit of mft record allocated size - 512. + * This is to get around the problem that if $Bitmap/$DATA becomes too + * big, but is just small enough to be resident, we would make it + * resident, and later run out of space when creating the other + * attributes and this would cause us to abort as making resident + * attributes non-resident is not supported yet. + * The proper fix is to support making resident attribute non-resident. + */ + if (le32_to_cpu(m->bytes_in_use) + 24 + val_len > + min(le32_to_cpu(m->bytes_allocated), + le32_to_cpu(m->bytes_allocated) - 512)) + err = insert_non_resident_attr_in_mft_record(m, AT_DATA, name, + name_len, ic, flags, val, val_len); + else + err = insert_resident_attr_in_mft_record(m, AT_DATA, name, + name_len, ic, flags, 0, val, val_len); + + if (err < 0) + Eprintf("add_attr_data failed: %s\n", strerror(-err)); + return err; +} + +/* + * Create a non-resident data attribute with a predefined on disk location + * specified by the run_list @rl. The clusters specified by @rl are assumed to + * be allocated already. + * + * Return 0 on success or -errno on error. + */ +int add_attr_data_positioned(MFT_RECORD *m, const char *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const ATTR_FLAGS flags, const run_list *rl, + const char *val, const s64 val_len) +{ + int err; + + err = insert_positioned_attr_in_mft_record(m, AT_DATA, name, name_len, + ic, flags, rl, val, val_len); + if (err < 0) + Eprintf("add_attr_data_positioned failed: %s\n", + strerror(-err)); + return err; +} + +/* + * Create volume name attribute specifying the volume name @vol_name as a null + * terminated char string of length @vol_name_len (number of characters not + * including the terminating null), which is converted internally to a little + * endian uchar_t string. The name is at least 1 character long and at most + * 0xff characters long (not counting the terminating null). + * + * Return 0 on success or -errno on error. + */ +int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, + const int vol_name_len) +{ + uchar_t *uname; + int i, len; + + if (vol_name_len) { + len = (vol_name_len + 1) * sizeof(uchar_t); + uname = calloc(1, len); + if (!uname) + return -errno; + i = (stoucs(uname, vol_name, len) + 1) * sizeof(uchar_t); + if (!i) { + free(uname); + return -EINVAL; + } + if (i > 0xff) { + free(uname); + return -ENAMETOOLONG; + } + } else { + uname = NULL; + len = 0; + } + i = insert_resident_attr_in_mft_record(m, AT_VOLUME_NAME, NULL, 0, 0, + 0, 0, (char*)uname, len); + if (uname) + free(uname); + if (i < 0) + Eprintf("add_attr_vol_name failed: %s\n", strerror(-i)); + return i; +} + +/* Return 0 on success or -errno on error. */ +int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags, + const u8 major_ver, const u8 minor_ver) +{ + VOLUME_INFORMATION vi; + int err; + + memset(&vi, 0, sizeof(vi)); + vi.major_ver = major_ver; + vi.minor_ver = minor_ver; + vi.flags = flags & VOLUME_FLAGS_MASK; + err = insert_resident_attr_in_mft_record(m, AT_VOLUME_INFORMATION, NULL, + 0, 0, 0, 0, (char*)&vi, sizeof(vi)); + if (err < 0) + Eprintf("add_attr_vol_info failed: %s\n", strerror(-err)); + return err; +} + +/* Return 0 on success or -errno on error. */ +int add_attr_index_root(MFT_RECORD *m, const char *name, const u32 name_len, + const IGNORE_CASE_BOOL ic, const ATTR_TYPES indexed_attr_type, + const COLLATION_RULES collation_rule, + const u32 index_block_size) +{ + INDEX_ROOT *r; + INDEX_ENTRY_HEADER *e; + int err, val_len; + + val_len = sizeof(INDEX_ROOT) + sizeof(INDEX_ENTRY_HEADER); + r = (INDEX_ROOT*)malloc(val_len); + if (!r) + return -errno; + r->type = indexed_attr_type == AT_FILE_NAME ? AT_FILE_NAME : 0; + if (indexed_attr_type == AT_FILE_NAME && + collation_rule != COLLATION_FILE_NAME) { + free(r); + Eprintf("add_attr_index_root: indexed attribute is $FILE_NAME " + "but collation rule is not COLLATION_FILE_NAME.\n"); + return -EINVAL; + } + r->collation_rule = collation_rule; + r->index_block_size = cpu_to_le32(index_block_size); + if (index_block_size >= vol->cluster_size) { + if (index_block_size % vol->cluster_size) { + Eprintf("add_attr_index_root: index block size is not " + "a multiple of the cluster size.\n"); + free(r); + return -EINVAL; + } + r->clusters_per_index_block = index_block_size / + vol->cluster_size; + } else /* if (vol->cluster_size > index_block_size) */ { + if (index_block_size & (index_block_size - 1)) { + Eprintf("add_attr_index_root: index block size is not " + "a power of 2.\n"); + free(r); + return -EINVAL; + } + if (index_block_size < opt.sector_size) { + Eprintf("add_attr_index_root: index block size is " + "smaller than the sector size.\n"); + free(r); + return -EINVAL; + } + r->clusters_per_index_block = index_block_size / + opt.sector_size; + } + memset(&r->reserved, 0, sizeof(r->reserved)); + r->index.entries_offset = cpu_to_le32(sizeof(INDEX_HEADER)); + r->index.index_length = cpu_to_le32(sizeof(INDEX_HEADER) + + sizeof(INDEX_ENTRY_HEADER)); + r->index.allocated_size = r->index.index_length; + r->index.flags = SMALL_INDEX; + memset(&r->index.reserved, 0, sizeof(r->index.reserved)); + e = (INDEX_ENTRY_HEADER*)((char*)&r->index + + le32_to_cpu(r->index.entries_offset)); + /* + * No matter whether this is a file index or a view as this is a + * termination entry, hence no key value / data is associated with it + * at all. Thus, we just need the union to be all zero. + */ + e->indexed_file = cpu_to_le64(0LL); + e->length = cpu_to_le16(sizeof(INDEX_ENTRY_HEADER)); + e->key_length = cpu_to_le16(0); + e->flags = INDEX_ENTRY_END; + e->reserved = cpu_to_le16(0); + err = insert_resident_attr_in_mft_record(m, AT_INDEX_ROOT, name, + name_len, ic, 0, 0, (char*)r, val_len); + free(r); + if (err < 0) + Eprintf("add_attr_index_root failed: %s\n", strerror(-err)); + return err; +} + +/* Return 0 on success or -errno on error. */ +int add_attr_index_alloc(MFT_RECORD *m, const char *name, const u32 name_len, + const IGNORE_CASE_BOOL ic, const char *index_alloc_val, + const u32 index_alloc_val_len) +{ + int err; + + err = insert_non_resident_attr_in_mft_record(m, AT_INDEX_ALLOCATION, + name, name_len, ic, 0, index_alloc_val, + index_alloc_val_len); + if (err < 0) + Eprintf("add_attr_index_alloc failed: %s\n", strerror(-err)); + return err; +} + +/* Return 0 on success or -errno on error. */ +int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, + const IGNORE_CASE_BOOL ic, const char *bitmap, + const u32 bitmap_len) +{ + int err; + + /* Does it fit? NO: create non-resident. YES: create resident. */ + if (le32_to_cpu(m->bytes_in_use) + 24 + bitmap_len > + le32_to_cpu(m->bytes_allocated)) + err = insert_non_resident_attr_in_mft_record(m, AT_BITMAP, name, + name_len, ic, 0, bitmap, bitmap_len); + else + err = insert_resident_attr_in_mft_record(m, AT_BITMAP, name, + name_len, ic, 0, 0, bitmap, bitmap_len); + + if (err < 0) + Eprintf("add_attr_bitmap failed: %s\n", strerror(-err)); + return err; +} + +/* + * Create a non-resident bitmap attribute with a predefined on disk location + * specified by the run_list @rl. The clusters specified by @rl are assumed to + * be allocated already. + * + * Return 0 on success or -errno on error. + */ +int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const run_list *rl, const char *bitmap, const u32 bitmap_len) +{ + int err; + + err = insert_positioned_attr_in_mft_record(m, AT_BITMAP, name, name_len, + ic, 0, rl, bitmap, bitmap_len); + if (err < 0) + Eprintf("add_attr_bitmap_positioned failed: %s\n", + strerror(-err)); + return err; +} + +/* + * Create bitmap and index allocation attributes, modify index root + * attribute accordingly and move all of the index entries from the index root + * into the index allocation. + * + * Return 0 on success or -errno on error. + */ +int upgrade_to_large_index(MFT_RECORD *m, const char *name, + u32 name_len, const IGNORE_CASE_BOOL ic, + INDEX_ALLOCATION **index) +{ + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + INDEX_ROOT *r; + INDEX_ENTRY *re; + INDEX_ALLOCATION *ia_val = NULL; + uchar_t *uname; + char bmp[8]; + char *re_start, *re_end; + int i, err, index_block_size; + + if (name_len) { + i = (name_len + 1) * sizeof(uchar_t); + uname = (uchar_t*)calloc(1, i); + if (!uname) + return -errno; + name_len = stoucs(uname, name, i); + if (name_len > 0xff) { + free(uname); + return -ENAMETOOLONG; + } + } else + uname = NULL; + /* Find the index root attribute. */ + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + Eprintf("Failed to allocate attribute search context.\n"); + return -ENOMEM; + } + if (ic == IGNORE_CASE) { + Eprintf("FIXME: Hit unimplemented code path #4.\n"); + err = -ENOTSUP; + goto err_out; + } + err = ntfs_lookup_attr(AT_INDEX_ROOT, uname, name_len, ic, 0, NULL, 0, + ctx); + if (uname) + free(uname); + if (err) { + err = -ENOTDIR; + goto err_out; + } + a = ctx->attr; + if (a->non_resident || a->flags) { + err = -EINVAL; + goto err_out; + } + r = (INDEX_ROOT*)((char*)a + le16_to_cpu(a->value_offset)); + re_end = (char*)r + le32_to_cpu(a->value_length); + re_start = (char*)&r->index + le32_to_cpu(r->index.entries_offset); + re = (INDEX_ENTRY*)re_start; + index_block_size = le32_to_cpu(r->index_block_size); + memset(bmp, 0, sizeof(bmp)); + ntfs_set_bit(bmp, 0ULL, 1); + /* Bitmap has to be at least 8 bytes in size. */ + err = add_attr_bitmap(m, name, name_len, ic, (char*)&bmp, sizeof(bmp)); + if (err) + goto err_out; + ia_val = calloc(1, index_block_size); + if (!ia_val) { + err = -errno; + goto err_out; + } + /* Setup header. */ + ia_val->magic = magic_INDX; + ia_val->usa_ofs = cpu_to_le16(sizeof(INDEX_ALLOCATION)); + if (index_block_size >= NTFS_SECTOR_SIZE) + ia_val->usa_count = cpu_to_le16(index_block_size / + NTFS_SECTOR_SIZE + 1); + else { + ia_val->usa_count = cpu_to_le16(1); + Qprintf("Sector size is bigger than index block size. Setting " + "usa_count to 1. If Windows\nchkdsk reports this as " + "corruption, please email linux-ntfs-dev@lists.sf.net\n" + "stating that you saw this message and that the file " + "system created was corrupt.\nThank you."); + } + /* Set USN to 1. */ + *(u16*)((char*)ia_val + le16_to_cpu(ia_val->usa_ofs)) = + cpu_to_le16(1); + ia_val->lsn = cpu_to_le64(0); + ia_val->index_block_vcn = cpu_to_le64(0); + ia_val->index.flags = LEAF_NODE; + /* Align to 8-byte boundary. */ + ia_val->index.entries_offset = cpu_to_le32((sizeof(INDEX_HEADER) + + le16_to_cpu(ia_val->usa_count) * 2 + 7) & ~7); + ia_val->index.allocated_size = cpu_to_le32(index_block_size - + (sizeof(INDEX_ALLOCATION) - sizeof(INDEX_HEADER))); + /* Find the last entry in the index root and save it in re. */ + while ((char*)re < re_end && !(re->flags & INDEX_ENTRY_END)) { + /* Next entry in index root. */ + re = (INDEX_ENTRY*)((char*)re + le16_to_cpu(re->length)); + } + /* Copy all the entries including the termination entry. */ + i = (char*)re - re_start + le16_to_cpu(re->length); + memcpy((char*)&ia_val->index + + le32_to_cpu(ia_val->index.entries_offset), re_start, i); + /* Finish setting up index allocation. */ + ia_val->index.index_length = cpu_to_le32(i + + le32_to_cpu(ia_val->index.entries_offset)); + /* Move the termination entry forward to the beginning if necessary. */ + if ((char*)re > re_start) { + memmove(re_start, (char*)re, le16_to_cpu(re->length)); + re = (INDEX_ENTRY*)re_start; + } + /* Now fixup empty index root with pointer to index allocation VCN 0. */ + r->index.flags = LARGE_INDEX; + re->flags |= INDEX_ENTRY_NODE; + if (le16_to_cpu(re->length) < sizeof(INDEX_ENTRY_HEADER) + sizeof(VCN)) + re->length = cpu_to_le16(le16_to_cpu(re->length) + sizeof(VCN)); + r->index.index_length = cpu_to_le32(le32_to_cpu(r->index.entries_offset) + + le16_to_cpu(re->length)); + r->index.allocated_size = r->index.index_length; + /* Resize index root attribute. */ + err = resize_resident_attribute_value(m, a, sizeof(INDEX_ROOT) - + sizeof(INDEX_HEADER) + + le32_to_cpu(r->index.allocated_size)); + if (err) { + // TODO: Remove the added bitmap! + // Revert index root from index allocation. + goto err_out; + } + /* Set VCN pointer to 0LL. */ + *(VCN*)((char*)re + cpu_to_le16(re->length) - sizeof(VCN)) = + cpu_to_le64(0); + err = ntfs_pre_write_mst_fixup((NTFS_RECORD*)ia_val, index_block_size); + if (err) { + err = -errno; + Eprintf("ntfs_pre_write_mst_fixup() failed in " + "upgrade_to_large_index.\n"); + goto err_out; + } + err = add_attr_index_alloc(m, name, name_len, ic, (char*)ia_val, + index_block_size); + ntfs_post_write_mst_fixup((NTFS_RECORD*)ia_val); + if (err) { + // TODO: Remove the added bitmap! + // Revert index root from index allocation. + goto err_out; + } + *index = ia_val; + return 0; +err_out: + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (ia_val) + free(ia_val); + return err; +} + +/* + * Create space of @size bytes at position @pos inside the index block @index. + * + * Return 0 on success or -errno on error. + */ +int make_room_for_index_entry_in_index_block(INDEX_BLOCK *index, + INDEX_ENTRY *pos, u32 size) +{ + u32 biu; + + if (!size) + return 0; +#ifdef DEBUG + /* + * Rigorous consistency checks. Always return -EINVAL even if more + * appropriate codes exist for simplicity of parsing the return value. + */ + if (size != ((size + 7) & ~7)) { + Eprintf("make_room_for_index_entry_in_index_block() received " + "non 8-byte aligned size.\n"); + return -EINVAL; + } + if (!index || !pos) + return -EINVAL; + if ((char*)pos < (char*)index || (char*)pos + size < (char*)index || + (char*)pos > (char*)index + sizeof(INDEX_BLOCK) - + sizeof(INDEX_HEADER) + + le32_to_cpu(index->index.allocated_size) || + (char*)pos + size > (char*)index + sizeof(INDEX_BLOCK) - + sizeof(INDEX_HEADER) + + le32_to_cpu(index->index.allocated_size)) + return -EINVAL; + /* The - sizeof(INDEX_ENTRY_HEADER) is for the index terminator. */ + if ((char*)pos - (char*)&index->index > + le32_to_cpu(index->index.index_length) + - sizeof(INDEX_ENTRY_HEADER)) + return -EINVAL; +#endif + biu = le32_to_cpu(index->index.index_length); + /* Do we have enough space? */ + if (biu + size > le32_to_cpu(index->index.allocated_size)) + return -ENOSPC; + /* Move everything after pos to pos + size. */ + memmove((char*)pos + size, (char*)pos, biu - ((char*)pos - + (char*)&index->index)); + /* Update index block. */ + index->index.index_length = cpu_to_le32(biu + size); + return 0; +} + +/* + * Insert the fully completed FILE_NAME_ATTR @file_name which is inside + * the file with mft reference @file_ref into the index (allocation) block + * @index (which belongs to @file_ref's parent directory). + * + * Return 0 on success or -errno on error. + */ +int insert_file_link_in_dir_index(INDEX_BLOCK *index, MFT_REF file_ref, + FILE_NAME_ATTR *file_name, u32 file_name_size) +{ + int err, i; + INDEX_ENTRY *ie; + char *index_end; + + /* + * Lookup dir entry @file_name in dir @index to determine correct + * insertion location. FIXME: Using a very oversimplified lookup + * method which is sufficient for mkntfs but no good whatsoever in + * real world scenario. (AIA) + */ + index_end = (char*)&index->index + + le32_to_cpu(index->index.index_length); + ie = (INDEX_ENTRY*)((char*)&index->index + + le32_to_cpu(index->index.entries_offset)); + /* + * Loop until we exceed valid memory (corruption case) or until we + * reach the last entry. + */ + while ((char*)ie < index_end && !(ie->flags & INDEX_ENTRY_END)) { +/* +#ifdef DEBUG + Dprintf("file_name_attr1->file_name_length = %i\n", + file_name->file_name_length); + if (file_name->file_name_length) { + char *__buf; + __buf = (char*)calloc(1, file_name->file_name_length + + 1); + if (!__buf) + err_exit("Failed to allocate internal buffer: " + "%s\n", strerror(errno)); + i = ucstos(__buf, (uchar_t*)&file_name->file_name, + file_name->file_name_length + 1); + if (i == -1) + Dprintf("Name contains non-displayable " + "Unicode characters.\n"); + Dprintf("file_name_attr1->file_name = %s\n", __buf); + free(__buf); + } + Dprintf("file_name_attr2->file_name_length = %i\n", + ie->key.file_name.file_name_length); + if (ie->key.file_name.file_name_length) { + char *__buf; + __buf = (char*)calloc(1, + ie->key.file_name.file_name_length + 1); + if (!__buf) + err_exit("Failed to allocate internal buffer: " + "%s\n", strerror(errno)); + i = ucstos(__buf, ie->key.file_name.file_name, + ie->key.file_name.file_name_length + 1); + if (i == -1) + Dprintf("Name contains non-displayable " + "Unicode characters.\n"); + Dprintf("file_name_attr2->file_name = %s\n", __buf); + free(__buf); + } +#endif +*/ + i = ntfs_file_compare_values(file_name, + (FILE_NAME_ATTR*)&ie->key.file_name, 1, + IGNORE_CASE, vol->upcase, vol->upcase_len); + /* + * If @file_name collates before ie->key.file_name, there is no + * matching index entry. + */ + if (i == -1) + break; + /* If file names are not equal, continue search. */ + if (i) + goto do_next; + /* File names are equal when compared ignoring case. */ + /* + * If BOTH file names are in the POSIX namespace, do a case + * sensitive comparison as well. Otherwise the names match so + * we return -EEXIST. FIXME: There are problems with this in a + * real world scenario, when one is POSIX and one isn't, but + * fine for mkntfs where we don't use POSIX namespace at all + * and hence this following code is luxury. (AIA) + */ + if (file_name->file_name_type != FILE_NAME_POSIX || + ie->key.file_name.file_name_type != FILE_NAME_POSIX) + return -EEXIST; + i = ntfs_file_compare_values(file_name, + (FILE_NAME_ATTR*)&ie->key.file_name, 1, + CASE_SENSITIVE, vol->upcase, vol->upcase_len); + if (i == -1) + break; + /* Complete match. Bugger. Can't insert. */ + if (!i) + return -EEXIST; +do_next: +#ifdef DEBUG + /* Next entry. */ + if (!ie->length) { + Dprintf("BUG: ie->length is zero, breaking out of " + "loop.\n"); + break; + } +#endif + ie = (INDEX_ENTRY*)((char*)ie + le16_to_cpu(ie->length)); + }; + i = (sizeof(INDEX_ENTRY_HEADER) + file_name_size + 7) & ~7; + err = make_room_for_index_entry_in_index_block(index, ie, i); + if (err) { + Eprintf("make_room_for_index_entry_in_index_block failed: " + "%s\n", strerror(-err)); + return err; + } + /* Create entry in place and copy file name attribute value. */ + ie->indexed_file = file_ref; + ie->length = cpu_to_le16(i); + ie->key_length = cpu_to_le16(file_name_size); + ie->flags = cpu_to_le16(0); + ie->reserved = cpu_to_le16(0); + memcpy((char*)&ie->key.file_name, (char*)file_name, file_name_size); + return 0; +} + +/* + * Create a file_name_attribute in the mft record @m_file which points to the + * parent directory with mft reference @ref_parent. + * + * Then, insert an index entry with this file_name_attribute in the index + * block @index of the index allocation attribute of the parent directory. + * + * @ref_file is the mft reference of @m_file. + * + * Return 0 on success or -errno on error. + */ +int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, + MFT_RECORD *m_file, const MFT_REF ref_file, + const s64 allocated_size, const s64 data_size, + const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, + const u32 reparse_point_tag, const char *file_name, + const FILE_NAME_TYPE_FLAGS file_name_type) +{ + FILE_NAME_ATTR *fn; + int i, fn_size; + + /* Create the file_name attribute. */ + i = (strlen(file_name) + 1) * sizeof(uchar_t); + fn_size = sizeof(FILE_NAME_ATTR) + i; + fn = (FILE_NAME_ATTR*)malloc(fn_size); + if (!fn) + return -errno; + fn->parent_directory = ref_parent; + // FIXME: Is this correct? Or do we have to copy the creation_time + // from the std info? + fn->creation_time = time2ntfs(time(NULL)); + fn->last_data_change_time = fn->creation_time; + fn->last_mft_change_time = fn->creation_time; + fn->last_access_time = fn->creation_time; + fn->allocated_size = cpu_to_le64(allocated_size); + fn->data_size = cpu_to_le64(data_size); + fn->file_attributes = flags; + /* These are in a union so can't have both. */ + if (packed_ea_size && reparse_point_tag) { + free(fn); + return -EINVAL; + } + if (packed_ea_size) { + fn->packed_ea_size = cpu_to_le16(packed_ea_size); + fn->reserved = cpu_to_le16(0); + } else + fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); + fn->file_name_type = file_name_type; + i = stoucs(fn->file_name, file_name, i); + if (i < 1) { + free(fn); + return -EINVAL; + } + if (i > 0xff) { + free(fn); + return -ENAMETOOLONG; + } + /* No terminating null in file names. */ + fn->file_name_length = i; + fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(uchar_t); + /* Increment the link count of @m_file. */ + i = le16_to_cpu(m_file->link_count); + if (i == 0xffff) { + Eprintf("Too many hardlinks present already.\n"); + free(fn); + return -EINVAL; + } + m_file->link_count = cpu_to_le16(i + 1); + /* Add the file_name to @m_file. */ + i = insert_resident_attr_in_mft_record(m_file, AT_FILE_NAME, NULL, 0, 0, + 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size); + if (i < 0) { + Eprintf("create_hardlink failed adding file name attribute: " + "%s\n", strerror(-i)); + free(fn); + /* Undo link count increment. */ + m_file->link_count = cpu_to_le16( + le16_to_cpu(m_file->link_count) - 1); + return i; + } + /* Insert the index entry for file_name in @index. */ + i = insert_file_link_in_dir_index(index, ref_file, fn, fn_size); + if (i < 0) { + Eprintf("create_hardlink failed inserting index entry: %s\n", + strerror(-i)); + /* FIXME: Remove the file name attribute from @m_file. */ + free(fn); + /* Undo link count increment. */ + m_file->link_count = cpu_to_le16( + le16_to_cpu(m_file->link_count) - 1); + return i; + } + free(fn); + return 0; +} + +void init_options() +{ + memset(&opt, 0, sizeof(opt)); + opt.index_block_size = 4096; + opt.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; + opt.attr_defs_len = sizeof(attrdef_ntfs12_array); + //Dprintf("Attr_defs table length = %u\n", opt.attr_defs_len); +} + +void usage(void) __attribute__ ((noreturn)); + +void usage(void) +{ + fprintf(stderr, "Copyright (c) 2001,2002 Anton Altaparmakov.\n" + "Create an NTFS volume on a user specified (block) device.\n" + "Usage: %s [-s sector-size] [-c cluster-size] " + "[-L volume-label]\n\t[-z mft-zone-multiplier] " + "[-fnqvvCFIQV] device [number-of-sectors]\n", + EXEC_NAME); + exit(1); +} + +void parse_options(int argc, char *argv[]) +{ + int c; + long l; + unsigned long u; + char *s; + +// Need to have: mft record size, index record size, ntfs version, mft size, +// logfile size, list of bad blocks, check for bad blocks, ... + if (argc && *argv) + EXEC_NAME = *argv; + fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); + while ((c = getopt(argc, argv, "c:fnqs:vz:CFIL:QV")) != EOF) + switch (c) { + case 'n': + opt.no_action = 1; + break; + case 'c': + l = strtol(optarg, &s, 0); + if (!l || l > INT_MAX || *s) + err_exit("Invalid cluster size.\n"); + vol->cluster_size = l; + break; + case 'f': + case 'Q': + opt.quick_format = 1; + break; + case 'q': + opt.quiet = 1; + break; + case 's': + l = strtol(optarg, &s, 0); + if (!l || l > INT_MAX || *s) + err_exit("Invalid sector size.\n"); + opt.sector_size = l; + break; + case 'v': + opt.verbose++; + break; + case 'z': + l = strtol(optarg, &s, 0); + if (l < 1 || l > 4 || *s) + err_exit("Invalid MFT zone multiplier.\n"); + opt.mft_zone_multiplier = l; + break; + case 'C': + opt.enable_compression = 1; + break; + case 'F': + opt.force = 1; + break; + case 'I': + opt.disable_indexing = 1; + break; + case 'L': + vol->vol_name = optarg; + break; + case 'V': + /* Version number already printed, so just exit. */ + exit(0); + default: + usage(); + } + if (optind == argc) + usage(); + vol->dev_name = argv[optind++]; + if (optind < argc) { + u = strtoul(argv[optind++], &s, 0); + if (*s || !u || (u >= ULONG_MAX && errno == ERANGE)) + err_exit("Invalid number of sectors: %s\n", + argv[optind - 1]); + opt.nr_sectors = u; + } + if (optind < argc) + usage(); +} + +void mkntfs_exit(void) +{ + int err; + + if (index_block) + free(index_block); + if (buf) + free(buf); + if (buf2) + free(buf2); + if (lcn_bitmap) + free(lcn_bitmap); + if (mft_bitmap) + free(mft_bitmap); + if (rl) + free(rl); + if (rl_mft) + free(rl_mft); + if (rl_mft_bmp) + free(rl_mft_bmp); + if (rl_mftmirr) + free(rl_mftmirr); + if (rl_logfile) + free(rl_logfile); + if (rl_boot) + free(rl_boot); + if (rl_bad) + free(rl_bad); + if (rl_index) + free(rl_index); + if (opt.bad_blocks) + free(opt.bad_blocks); + if (opt.attr_defs != (ATTR_DEF*)attrdef_ntfs12_array) + free(opt.attr_defs); + if (vol->upcase) + free(vol->upcase); + flk.l_type = F_UNLCK; + err = fcntl(vol->fd, F_SETLK, &flk); + if (err == -1) + Eprintf("Warning: Could not unlock %s: %s\n", vol->dev_name, + strerror(errno)); + err = close(vol->fd); + if (err == -1) + Eprintf("Warning: Could not close %s: %s\n", vol->dev_name, + strerror(errno)); + if (vol) + free(vol); +} + +#define MAKE_MFT_REF(_ref, _seqno) cpu_to_le64((((u64)(_seqno)) << 48) \ + | ((u64)(_ref))) + +static inline int valid_offset(int f, long long ofs) +{ + char ch; + + if (lseek(f, ofs, SEEK_SET) >= 0 && read(f, &ch, 1) == 1) + return 1; + return 0; +} + +/* + * Returns the number of bs sized blocks in a partition. Adapted from + * e2fsutils-1.19, Copyright (C) 1995 Theodore Ts'o. + */ +long long get_device_size(int f, int bs) +{ + long long high, low; +#ifdef BLKGETSIZE + long size; + + if (ioctl(f, BLKGETSIZE, &size) >= 0) { + Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, + size); + return (long long)size * 512 / bs; + } +#endif +#ifdef FDGETPRM + { struct floppy_struct this_floppy; + + if (ioctl(f, FDGETPRM, &this_floppy) >= 0) { + Dprintf("FDGETPRM nr 512 byte blocks = %ld (0x%ld)\n", + this_floppy.size, this_floppy.size); + return (long long)this_floppy.size * 512 / bs; + } + } +#endif + /* + * We couldn't figure it out by using a specialized ioctl, + * so do binary search to find the size of the partition. + */ + low = 0LL; + for (high = 1024LL; valid_offset(f, high); high <<= 1) + low = high; + while (low < high - 1LL) { + const long long mid = (low + high) / 2; + + if (valid_offset(f, mid)) + low = mid; + else + high = mid; + } + lseek(f, 0LL, SEEK_SET); + return (low + 1LL) / bs; +} + +int main(int argc, char **argv) +{ + int i, j, err; + ssize_t bw; + struct stat sbuf; + long long lw, pos; + MFT_RECORD *m; + ATTR_RECORD *a; + MFT_REF root_ref; + ntfs_attr_search_ctx *ctx; + char *sd; + NTFS_BOOT_SECTOR *bs; + unsigned long mnt_flags; + + /* Initialize the random number generator with the current time. */ + srandom(time(NULL)); + /* Initialize ntfs_volume structure vol. */ + vol = (ntfs_volume*)calloc(1, sizeof(*vol)); + if (!vol) + err_exit("Could not allocate memory for internal buffer.\n"); + vol->major_ver = 1; + vol->minor_ver = 2; + vol->mft_record_size = 1024; + vol->mft_record_size_bits = 10; + /* Length is in unicode characters. */ + vol->upcase_len = 65536; + vol->upcase = (uchar_t*)malloc(vol->upcase_len * sizeof(uchar_t)); + if (!vol->upcase) + err_exit("Could not allocate memory for internal buffer.\n"); + init_upcase_table(vol->upcase, vol->upcase_len * sizeof(uchar_t)); + /* Initialize opt to zero / required values. */ + init_options(); + /* Parse command line options. */ + parse_options(argc, argv); + /* Verify we are dealing with a block device. */ + if (stat(vol->dev_name, &sbuf) == -1) { + if (errno == ENOENT) + err_exit("The device doesn't exist; did you specify " + "it correctly?\n"); + err_exit("Error getting information about %s: %s\n", + vol->dev_name, strerror(errno)); + } + if (!S_ISBLK(sbuf.st_mode)) { + Eprintf("%s is not a block device.\n", vol->dev_name); + if (!opt.force) + err_exit("Refusing to make a filesystem here!\n"); + if (!opt.nr_sectors) { + if (!sbuf.st_size && !sbuf.st_blocks) + err_exit("You must specify the number of " + "sectors.\n"); + if (opt.sector_size) { + if (sbuf.st_size) + opt.nr_sectors = sbuf.st_size / + opt.sector_size; + else + opt.nr_sectors = ((s64)sbuf.st_blocks + << 9) / opt.sector_size; + } else { + if (sbuf.st_size) + opt.nr_sectors = sbuf.st_size / 512; + else + opt.nr_sectors = sbuf.st_blocks; + opt.sector_size = 512; + } + } + fprintf(stderr, "mkntfs forced anyway.\n"); + } +#ifdef HAVE_LINUX_MAJOR_H + else if ((MAJOR(sbuf.st_rdev) == HD_MAJOR && + MINOR(sbuf.st_rdev) % 64 == 0) || + (SCSI_BLK_MAJOR(MAJOR(sbuf.st_rdev)) && + MINOR(sbuf.st_rdev) % 16 == 0)) { + err_exit("%s is entire device, not just one partition!\n", + vol->dev_name); + } +#endif + /* Make sure the file system is not mounted. */ + if (ntfs_check_if_mounted(vol->dev_name, &mnt_flags)) + Eprintf("Failed to determine whether %s is mounted: %s\n", + vol->dev_name, strerror(errno)); + else if (mnt_flags & NTFS_MF_MOUNTED) { + Eprintf("%s is mounted.\n", vol->dev_name); + if (!opt.force) + err_exit("Refusing to make a filesystem here!\n"); + fprintf(stderr, "mkntfs forced anyway. Hope /etc/mtab is " + "incorrect.\n"); + } + + /* Open the device for reading or reading and writing. */ + if (opt.no_action) { + Qprintf("Running in READ-ONLY mode!\n"); + i = O_RDONLY; + } else + i = O_RDWR; + vol->fd = open(vol->dev_name, i); + if (vol->fd == -1) + err_exit("Could not open %s: %s\n", vol->dev_name, + strerror(errno)); + /* Acquire exlusive (mandatory) write lock on the whole device. */ + memset(&flk, 0, sizeof(flk)); + if (opt.no_action) + flk.l_type = F_RDLCK; + else + flk.l_type = F_WRLCK; + flk.l_whence = SEEK_SET; + flk.l_start = flk.l_len = 0LL; + err = fcntl(vol->fd, F_SETLK, &flk); + if (err == -1) { + Eprintf("Could not lock %s for %s: %s\n", vol->dev_name, + opt.no_action ? "reading" : "writing", + strerror(errno)); + err = close(vol->fd); + if (err == -1) + Eprintf("Warning: Could not close %s: %s\n", + vol->dev_name, strerror(errno)); + exit(1); + } + /* Register our exit function which will unlock and close the device. */ + err = atexit(&mkntfs_exit); + if (err == -1) { + Eprintf("Could not set up exit() function because atexit() " + "failed. Aborting...\n"); + mkntfs_exit(); + exit(1); + } + /* If user didn't specify the sector size, determine it now. */ + if (!opt.sector_size) { +#ifdef BLKSSZGET + int _sect_size = 0; + + if (ioctl(vol->fd, BLKSSZGET, &_sect_size) >= 0) + opt.sector_size = _sect_size; + else +#endif + { + Eprintf("No sector size specified for %s and it could " + "not be obtained automatically.\n" + "Assuming sector size is 512 bytes.\n", + vol->dev_name); + opt.sector_size = 512; + } + } + /* Validate sector size. */ + if ((opt.sector_size - 1) & opt.sector_size || + opt.sector_size < 256 || opt.sector_size > 4096) + err_exit("Error: sector_size is invalid. It must be a power " + "of two, and it must be\n greater or equal 256 and " + "less than or equal 4096 bytes.\n"); + Dprintf("sector size = %i bytes\n", opt.sector_size); + /* If user didn't specify the number of sectors, determine it now. */ + if (!opt.nr_sectors) { + opt.nr_sectors = get_device_size(vol->fd, opt.sector_size); + if (opt.nr_sectors <= 0) + err_exit("get_device_size(%s) failed. Please specify " + "it manually.\n", vol->dev_name); + } + Dprintf("number of sectors = %Ld (0x%Lx)\n", opt.nr_sectors, + opt.nr_sectors); + /* Reserve the last sector for the backup boot sector. */ + opt.nr_sectors--; + /* If user didn't specify the volume size, determine it now. */ + if (!opt.volume_size) + opt.volume_size = opt.nr_sectors * opt.sector_size; + else if (opt.volume_size & (opt.sector_size - 1)) + err_exit("Error: volume_size is not a multiple of " + "sector_size.\n"); + /* Validate volume size. */ + if (opt.volume_size < 1 << 20 /* 1MiB */) + err_exit("Error: device is too small (%ikiB). Minimum NTFS " + "volume size is 1MiB.\n", opt.volume_size / 1024); + Dprintf("volume size = %LikiB\n", opt.volume_size / 1024); + /* If user didn't specify the cluster size, determine it now. */ + if (!vol->cluster_size) { + if (opt.volume_size <= 512LL << 20) /* <= 512MB */ + vol->cluster_size = 512; + else if (opt.volume_size <= 1LL << 30) /* ]512MB-1GB] */ + vol->cluster_size = 1024; + else if (opt.volume_size <= 2LL << 30) /* ]1GB-2GB] */ + vol->cluster_size = 2048; + else + vol->cluster_size = 4096; + /* For small volumes on devices with large sector sizes. */ + if (vol->cluster_size < opt.sector_size) + vol->cluster_size = opt.sector_size; + } + /* Validate cluster size. */ + if (vol->cluster_size & (vol->cluster_size - 1) || + vol->cluster_size < opt.sector_size || + vol->cluster_size > 128 * opt.sector_size || + vol->cluster_size > 65536) + err_exit("Error: cluster_size is invalid. It must be a power " + "of two, be at least\nthe same as sector_size, be " + "maximum 64kB, and the sectors per cluster value " + "has\nto fit inside eight bits. (We do not support " + "larger cluster sizes yet.)\n"); + vol->cluster_size_bits = ffs(vol->cluster_size) - 1; + Dprintf("cluster size = %i bytes\n", vol->cluster_size); + if (vol->cluster_size > 4096) { + if (opt.enable_compression) { + if (!opt.force) + err_exit("Error: cluster_size is above 4096 " + "bytes and compression is " + "requested.\nThis is not " + "possible due to limitations " + "in the compression algorithm " + "used by\nWindows.\n"); + opt.enable_compression = 0; + } + Qprintf("Warning: compression will be disabled on this volume " + "because it is not\nsupported when the cluster " + "size is above 4096 bytes. This is due to \n" + "limitations in the compression algorithm used " + "by Windows.\n"); + } + /* If user didn't specify the number of clusters, determine it now. */ + if (!opt.nr_clusters) + opt.nr_clusters = opt.volume_size / vol->cluster_size; + /* + * Check the cluster_size and nr_sectors for consistency with + * sector_size and nr_sectors. And check both of these for consistency + * with volume_size. + */ + if (opt.nr_clusters != (opt.nr_sectors * opt.sector_size) / + vol->cluster_size || + opt.volume_size / opt.sector_size != opt.nr_sectors || + opt.volume_size / vol->cluster_size != opt.nr_clusters) + err_exit("Illegal combination of volume/cluster/sector size " + "and/or cluster/sector number.\n"); + Dprintf("number of clusters = %Lu (0x%Lx)\n", opt.nr_clusters, + opt.nr_clusters); + /* Determine lcn bitmap byte size and allocate it. */ + lcn_bitmap_byte_size = (opt.nr_clusters + 7) >> 3; + /* Needs to be multiple of 8 bytes. */ + lcn_bitmap_byte_size = (lcn_bitmap_byte_size + 7) & ~7; + i = (lcn_bitmap_byte_size + vol->cluster_size - 1) & + ~(vol->cluster_size - 1); + Dprintf("lcn_bitmap_byte_size = %i, allocated = %i\n", + lcn_bitmap_byte_size, i); + lcn_bitmap = (unsigned char *)calloc(1, lcn_bitmap_byte_size); + if (!lcn_bitmap) + err_exit("Failed to allocate internal buffer: %s", + strerror(errno)); + /* + * $Bitmap can overlap the end of the volume. Any bits in this region + * must be set. This region also encompasses the backup boot sector. + */ + for (i = opt.nr_clusters; i < lcn_bitmap_byte_size << 3; i++) + ntfs_set_bit(lcn_bitmap, (u64)i, 1); + /* + * Determine mft_size: 16 mft records or 1 cluster, which ever is + * bigger, rounded to multiples of cluster size. + */ + opt.mft_size = (16 * vol->mft_record_size + vol->cluster_size - 1) + & ~(vol->cluster_size - 1); + Dprintf("MFT size = %i (0x%x) bytes\n", opt.mft_size, opt.mft_size); + /* Determine mft bitmap size and allocate it. */ + mft_bitmap_size = opt.mft_size / vol->mft_record_size; + /* Convert to bytes, at least one. */ + mft_bitmap_byte_size = (mft_bitmap_size + 7) >> 3; + /* Mft bitmap is allocated in multiples of 8 bytes. */ + mft_bitmap_byte_size = (mft_bitmap_byte_size + 7) & ~7; + Dprintf("mft_bitmap_size = %i, mft_bitmap_byte_size = %i\n", + mft_bitmap_size, mft_bitmap_byte_size); + mft_bitmap = (unsigned char *)calloc(1, mft_bitmap_byte_size); + if (!mft_bitmap) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + /* Create run list for mft bitmap. */ + rl_mft_bmp = (run_list *)malloc(2 * sizeof(run_list)); + if (!rl_mft_bmp) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + rl_mft_bmp[0].vcn = 0LL; + /* Mft bitmap is right after $Boot's data. */ + j = (8192 + vol->cluster_size - 1) / vol->cluster_size; + rl_mft_bmp[0].lcn = j; + /* + * Size is always one cluster, even though valid data size and + * initialized data size are only 8 bytes. + */ + rl_mft_bmp[1].vcn = rl_mft_bmp[0].length = 1LL; + rl_mft_bmp[1].lcn = -1LL; + rl_mft_bmp[1].length = 0LL; + /* Allocate cluster for mft bitmap. */ + ntfs_set_bit(lcn_bitmap, (s64)j, 1); + /* If user didn't specify the mft lcn, determine it now. */ + if (!opt.mft_lcn) { + /* + * We start at the higher value out of 16kiB and just after the + * mft bitmap. + */ + opt.mft_lcn = rl_mft_bmp[0].lcn + rl_mft_bmp[0].length; + if (opt.mft_lcn * vol->cluster_size < 16 * 1024) + opt.mft_lcn = (16 * 1024 + vol->cluster_size - 1) / + vol->cluster_size; + } + Dprintf("$MFT logical cluster number = 0x%x\n", opt.mft_lcn); + /* Determine MFT zone size. */ + opt.mft_zone_end = opt.nr_clusters; + switch (opt.mft_zone_multiplier) { /* % of volume size in clusters */ + case 4: + opt.mft_zone_end = opt.mft_zone_end >> 1; /* 50% */ + break; + case 3: + opt.mft_zone_end = opt.mft_zone_end * 3 >> 3; /* 37.5% */ + break; + case 2: + opt.mft_zone_end = opt.mft_zone_end >> 2; /* 25% */ + break; + /* case 1: */ + default: + opt.mft_zone_end = opt.mft_zone_end >> 3; /* 12.5% */ + break; + } + Dprintf("MFT zone size = %lukiB\n", opt.mft_zone_end / 1024); + /* + * The mft zone begins with the mft data attribute, not at the beginning + * of the device. + */ + opt.mft_zone_end += opt.mft_lcn; + /* Create run list for mft. */ + rl_mft = (run_list *)malloc(2 * sizeof(run_list)); + if (!rl_mft) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + rl_mft[0].vcn = 0LL; + rl_mft[0].lcn = opt.mft_lcn; + /* We already rounded mft size up to a cluster. */ + j = opt.mft_size / vol->cluster_size; + rl_mft[1].vcn = rl_mft[0].length = j; + rl_mft[1].lcn = -1LL; + rl_mft[1].length = 0LL; + /* Allocate clusters for mft. */ + for (i = 0; i < j; i++) + ntfs_set_bit(lcn_bitmap, opt.mft_lcn + i, 1); + /* Determine mftmirr_lcn (middle of volume). */ + opt.mftmirr_lcn = (opt.nr_sectors * opt.sector_size >> 1) + / vol->cluster_size; + Dprintf("$MFTMirr logical cluster number = 0x%x\n", opt.mftmirr_lcn); + /* Create run list for mft mirror. */ + rl_mftmirr = (run_list *)malloc(2 * sizeof(run_list)); + if (!rl_mftmirr) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + rl_mftmirr[0].vcn = 0LL; + rl_mftmirr[0].lcn = opt.mftmirr_lcn; + /* + * The mft mirror is either 4kb (the first four records) or one cluster + * in size, which ever is bigger. In either case, it contains a + * byte-for-byte identical copy of the beginning of the mft (i.e. either + * ther first four records (4kb) or the first cluster worth of records, + * whichever is bigger). + */ + j = (4 * vol->mft_record_size + vol->cluster_size - 1) / vol->cluster_size; + rl_mftmirr[1].vcn = rl_mftmirr[0].length = j; + rl_mftmirr[1].lcn = -1LL; + rl_mftmirr[1].length = 0LL; + /* Allocate clusters for mft mirror. */ + for (i = 0; i < j; i++) + ntfs_set_bit(lcn_bitmap, opt.mftmirr_lcn + i, 1); + opt.logfile_lcn = opt.mftmirr_lcn + j; + Dprintf("$LogFile logical cluster number = 0x%x\n", opt.logfile_lcn); + /* Create run list for log file. */ + rl_logfile = (run_list *)malloc(2 * sizeof(run_list)); + if (!rl_logfile) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + rl_logfile[0].vcn = 0LL; + rl_logfile[0].lcn = opt.logfile_lcn; + /* + * Determine logfile_size from volume_size (rounded up to a cluster), + * making sure it does not overflow the end of the volume. + */ + if (opt.volume_size < 2048LL * 1024) /* < 2MiB */ + opt.logfile_size = 256LL * 1024; /* -> 256kiB */ + else if (opt.volume_size < 4000000LL) /* < 4MB */ + opt.logfile_size = 512LL * 1024; /* -> 512kiB */ + else if (opt.volume_size <= 200LL * 1024 * 1024)/* < 200MiB */ + opt.logfile_size = 2048LL * 1024; /* -> 2MiB */ + else if (opt.volume_size >= 400LL << 20) /* > 400MiB */ + opt.logfile_size = 4 << 20; /* -> 4MiB */ + else + opt.logfile_size = (opt.volume_size / 100) & + ~(vol->cluster_size - 1); + j = opt.logfile_size / vol->cluster_size; + while (rl_logfile[0].lcn + j >= opt.nr_clusters) { + /* + * $Logfile would overflow volume. Need to make it smaller than + * the standard size. It's ok as we are creating a non-standard + * volume anyway if it is that small. + */ + opt.logfile_size >>= 1; + j = opt.logfile_size / vol->cluster_size; + } + opt.logfile_size = (opt.logfile_size + vol->cluster_size - 1) & + ~(vol->cluster_size - 1); + Dprintf("$LogFile (journal) size = %ikiB\n", opt.logfile_size / 1024); + /* + * FIXME: The 256kiB limit is arbitrary. Should find out what the real + * minimum requirement for Windows is so it doesn't blue screen. + */ + if (opt.logfile_size < 256 << 10) + err_exit("$LogFile would be created with invalid size. This " + "is not allowed as it would cause Windows to " + "blue screen and during boot.\n"); + rl_logfile[1].vcn = rl_logfile[0].length = j; + rl_logfile[1].lcn = -1LL; + rl_logfile[1].length = 0LL; + /* Allocate clusters for log file. */ + for (i = 0; i < j; i++) + ntfs_set_bit(lcn_bitmap, opt.logfile_lcn + i, 1); + /* Create run list for $Boot. */ + rl_boot = (run_list *)malloc(2 * sizeof(run_list)); + if (!rl_boot) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + rl_boot[0].vcn = 0LL; + rl_boot[0].lcn = 0LL; + /* + * $Boot is always 8192 (0x2000) bytes or 1 cluster, whichever is + * bigger. + */ + j = (8192 + vol->cluster_size - 1) / vol->cluster_size; + rl_boot[1].vcn = rl_boot[0].length = j; + rl_boot[1].lcn = -1LL; + rl_boot[1].length = 0LL; + /* Allocate clusters for $Boot. */ + for (i = 0; i < j; i++) + ntfs_set_bit(lcn_bitmap, 0LL + i, 1); + /* Allocate a buffer large enough to hold the mft. */ + buf = calloc(1, opt.mft_size); + if (!buf) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + /* Create run list for $BadClus, $DATA named stream $Bad. */ + rl_bad = (run_list *)malloc(2 * sizeof(run_list)); + if (!rl_bad) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + rl_bad[0].vcn = 0LL; + rl_bad[0].lcn = -1LL; + /* + * $BadClus named stream $Bad contains the whole volume as a single + * sparse run list entry. + */ + rl_bad[1].vcn = rl_bad[0].length = opt.nr_clusters; + rl_bad[1].lcn = -1LL; + rl_bad[1].length = 0LL; + + // TODO: Mark bad blocks as such. + + /* + * If not quick format, fill the device with 0s. + * FIXME: Except bad blocks! (AIA) + */ + if (!opt.quick_format) { + unsigned long position; + unsigned long mid_clust; + float progress_inc = (float)opt.nr_clusters / 100; + + Qprintf("Initialising device with zeroes: 0%%"); + fflush(stdout); + mid_clust = (opt.volume_size >> 1) / vol->cluster_size; + for (position = 0; position < opt.nr_clusters; position++) { + if (!(position % (int)(progress_inc+1))) { + Qprintf("\b\b\b\b%3.0f%%", position / + progress_inc); + fflush(stdout); + } + bw = mkntfs_write(vol->fd, buf, vol->cluster_size); + if (bw != vol->cluster_size) { + if (bw != -1 || errno != EIO) + err_exit("This should not happen.\n"); + if (!position) + err_exit("Error: Cluster zero is bad. " + "Cannot create NTFS file " + "system.\n"); + if (position == mid_clust && + (vol->major_ver < 1 || + (vol->major_ver == 1 && + vol->minor_ver < 2))) + err_exit("Error: Bad cluster found in " + "location reserved for system " + "file $Boot.\n"); + /* Add the baddie to our bad blocks list. */ + append_to_bad_blocks(position); + Qprintf("\nFound bad cluster (%ld). Adding to " + "list of bad blocks.\nInitialising " + "device with zeroes: %3.0i%%", position, + position / progress_inc); + /* Seek to next cluster. */ + lseek(vol->fd, ((off_t)position + 1) * + vol->cluster_size, SEEK_SET); + } + } + Qprintf("\b\b\b\b100%%"); + position = (opt.volume_size & (vol->cluster_size - 1)) / + opt.sector_size; + for (i = 0; i < position; i++) { + bw = mkntfs_write(vol->fd, buf, opt.sector_size); + if (bw != opt.sector_size) { + if (bw != -1 || errno != EIO) + err_exit("This should not happen.\n"); + else if (i + 1 == position && + (vol->major_ver >= 2 || + (vol->major_ver == 1 && + vol->minor_ver >= 2))) + err_exit("Error: Bad cluster found in " + "location reserved for system " + "file $Boot.\n"); + /* Seek to next sector. */ + lseek(vol->fd, opt.sector_size, SEEK_CUR); + } + } + Qprintf(" - Done.\n"); + } + Qprintf("Creating NTFS volume structures.\n"); + /* Setup an empty mft record. */ + format_mft_record((MFT_RECORD*)buf); + /* + * Copy the mft record onto all 16 records in the buffer and setup the + * sequence numbers of each system file to equal the mft record number + * of that file (only for $MFT is the sequence number 1 rather than 0). + */ + for (i = 1; i < 16; i++) { + m = (MFT_RECORD*)(buf + i * vol->mft_record_size); + memcpy(m, buf, vol->mft_record_size); + m->sequence_number = cpu_to_le16(i); + } + /* + * If a cluster contains more than the 16 system files, fill the rest + * with empty, formatted records. + */ + if (vol->cluster_size > 16 * vol->mft_record_size) { + for (i = 16; i * vol->mft_record_size < vol->cluster_size; i++) + memcpy(buf + i * vol->mft_record_size, buf, + vol->mft_record_size); + } + /* + * Create the 16 system files, adding the system information attribute + * to each as well as marking them in use in the mft bitmap. + */ + for (i = 0; i < 16; i++) { + u32 file_attrs; + + m = (MFT_RECORD*)(buf + i * vol->mft_record_size); + m->flags |= MFT_RECORD_IN_USE; + ntfs_set_bit(mft_bitmap, 0LL + i, 1); + file_attrs = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM; + if (i == FILE_root) { + if (opt.disable_indexing) + file_attrs |= FILE_ATTR_NOT_CONTENT_INDEXED; + if (opt.enable_compression) + file_attrs |= FILE_ATTR_COMPRESSED; + } + add_attr_std_info(m, file_attrs); + // dump_mft_record(m); + } + /* The root directory mft reference. */ + root_ref = MAKE_MFT_REF(FILE_root, FILE_root); + Vprintf("Creating root directory (mft record 5)\n"); + m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_DIRECTORY; + m->link_count = cpu_to_le16(le16_to_cpu(m->link_count) + 1); + err = add_attr_file_name(m, root_ref, 0LL, 0LL, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | + FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, + ".", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_root, &sd, &i); + err = add_attr_sd(m, sd, i); + } + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, + COLLATION_FILE_NAME, opt.index_block_size); + // FIXME: This should be IGNORE_CASE + if (!err) + err = upgrade_to_large_index(m, "$I30", 4, 0, &index_block); + if (!err) { + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) + err_exit("Failed to allocate attribute search " + "context: %s\n", strerror(errno)); + /* There is exactly one file name so this is ok. */ + if (ntfs_lookup_attr(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, + ctx)) { + ntfs_put_attr_search_ctx(ctx); + err_exit("BUG: $FILE_NAME attribute not found.\n"); + } + a = ctx->attr; + err = insert_file_link_in_dir_index(index_block, root_ref, + (FILE_NAME_ATTR*)((char*)a + + le16_to_cpu(a->value_offset)), + le32_to_cpu(a->value_length)); + ntfs_put_attr_search_ctx(ctx); + } + if (err) + err_exit("Couldn't create root directory: %s\n", + strerror(-err)); + // dump_mft_record(m); + /* Add all other attributes, on a per-file basis for clarity. */ + Vprintf("Creating $MFT (mft record 0)\n"); + m = (MFT_RECORD*)buf; + err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mft, buf, + opt.mft_size); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_MFT, 1), opt.mft_size, + opt.mft_size, FILE_ATTR_HIDDEN | + FILE_ATTR_SYSTEM, 0, 0, "$MFT", + FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_MFT, &sd, &i); + err = add_attr_sd(m, sd, i); + } + /* mft_bitmap is not modified in mkntfs; no need to sync it later. */ + if (!err) + err = add_attr_bitmap_positioned(m, NULL, 0, 0, rl_mft_bmp, + mft_bitmap, mft_bitmap_byte_size); + if (err < 0) + err_exit("Couldn't create $MFT: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $MFTMirr (mft record 1)\n"); + m = (MFT_RECORD*)(buf + 1 * vol->mft_record_size); + err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mftmirr, buf, + rl_mftmirr[0].length * vol->cluster_size); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_MFTMirr, FILE_MFTMirr), + rl_mftmirr[0].length * vol->cluster_size, + rl_mftmirr[0].length * vol->cluster_size, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$MFTMirr", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_MFTMirr, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $MFTMirr: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $LogFile (mft record 2)\n"); + m = (MFT_RECORD*)(buf + 2 * vol->mft_record_size); + buf2 = malloc(opt.logfile_size); + if (!buf2) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + memset(buf2, -1, opt.logfile_size); + err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_logfile, buf2, + opt.logfile_size); + free(buf2); + buf2 = NULL; + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_LogFile, FILE_LogFile), + opt.logfile_size, opt.logfile_size, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$LogFile", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_LogFile, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $LogFile: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $Volume (mft record 3)\n"); + m = (MFT_RECORD*)(buf + 3 * vol->mft_record_size); + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_Volume, FILE_Volume), 0LL, 0LL, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$Volume", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_Volume, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (!err) + err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); + if (!err) + err = add_attr_vol_name(m, vol->vol_name, vol->vol_name ? + strlen(vol->vol_name) : 0); + if (!err) { + Qprintf("Setting the volume dirty so check disk runs on next " + "reboot into Windows.\n"); + err = add_attr_vol_info(m, VOLUME_IS_DIRTY, vol->major_ver, + vol->minor_ver); + } + if (err < 0) + err_exit("Couldn't create $Volume: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $AttrDef (mft record 4)\n"); + m = (MFT_RECORD*)(buf + 4 * vol->mft_record_size); + if (vol->major_ver < 3) + buf2_size = 36000; + else + buf2_size = opt.attr_defs_len; + buf2 = (char*)calloc(1, buf2_size); + if (!buf2) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + memcpy(buf2, opt.attr_defs, opt.attr_defs_len); + err = add_attr_data(m, NULL, 0, 0, 0, buf2, buf2_size); + free(buf2); + buf2 = NULL; + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_AttrDef, FILE_AttrDef), + (buf2_size + vol->cluster_size - 1) & + ~(vol->cluster_size - 1), buf2_size, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$AttrDef", FILE_NAME_WIN32_AND_DOS); + buf2_size = 0; + if (!err) { + init_system_file_sd(FILE_AttrDef, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $AttrDef: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $Bitmap (mft record 6)\n"); + m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); + err = add_attr_data(m, NULL, 0, 0, 0, lcn_bitmap, lcn_bitmap_byte_size); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_Bitmap, FILE_Bitmap), + (lcn_bitmap_byte_size + vol->cluster_size - 1) & + ~(vol->cluster_size - 1), lcn_bitmap_byte_size, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$Bitmap", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_Bitmap, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $Bitmap: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $Boot (mft record 7)\n"); + m = (MFT_RECORD*)(buf + 7 * vol->mft_record_size); + buf2 = calloc(1, 8192); + if (!buf2) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + memcpy(buf2, boot_array, sizeof(boot_array)); + /* + * Create the boot sector into buf2. Note, that buf2 already is zeroed + * in the boot sector section and that it has the NTFS OEM id/magic + * already inserted, so no need to worry about these things. + */ + bs = (NTFS_BOOT_SECTOR*)buf2; + bs->bpb.bytes_per_sector = cpu_to_le16(opt.sector_size); + bs->bpb.sectors_per_cluster = (u8)(vol->cluster_size / + opt.sector_size); + bs->bpb.media_type = 0xf8; /* hard disk */ + /* + * If there are problems go back to bs->unused[0-3] and set them. See + * ../include/bootsect.h for details. Other fields to also consider + * setting are: bs->bpb.sectors_per_track, .heads, and .hidden_sectors. + */ + bs->number_of_sectors = scpu_to_le64(opt.nr_sectors); + bs->mft_lcn = scpu_to_le64(opt.mft_lcn); + bs->mftmirr_lcn = scpu_to_le64(opt.mftmirr_lcn); + if (vol->mft_record_size >= vol->cluster_size) + bs->clusters_per_mft_record = vol->mft_record_size / + vol->cluster_size; + else { + bs->clusters_per_mft_record = -(ffs(vol->mft_record_size) - 1); + if ((1 << -bs->clusters_per_mft_record) != vol->mft_record_size) + err_exit("BUG: calculated clusters_per_mft_record " + "is wrong (= 0x%x)\n", + bs->clusters_per_mft_record); + } + Dprintf("Clusters per mft record = %i (0x%x)\n", + bs->clusters_per_mft_record, + bs->clusters_per_mft_record); + if (opt.index_block_size >= vol->cluster_size) + bs->clusters_per_index_record = opt.index_block_size / + vol->cluster_size; + else { + bs->clusters_per_index_record = -(ffs(opt.index_block_size) - 1); + if ((1 << -bs->clusters_per_index_record) != + opt.index_block_size) + err_exit("BUG: calculated clusters_per_index_record " + "is wrong (= 0x%x)\n", + bs->clusters_per_index_record); + } + Dprintf("Clusters per index block = %i (0x%x)\n", + bs->clusters_per_index_record, + bs->clusters_per_index_record); + /* Generate a 64-bit random number for the serial number. */ + bs->volume_serial_number = scpu_to_le64(((s64)random() << 32) | + ((s64)random() & 0xffffffff)); + /* + * Leave zero for now as NT4 leaves it zero, too. If want it later, see + * ../libntfs/bootsect.c for how to calculate it. + */ + bs->checksum = cpu_to_le32(0); + /* Make sure the bootsector is ok. */ + if (!is_boot_sector_ntfs(bs, opt.verbose > 0 ? 0 : 1)) + err_exit("FATAL: Generated boot sector is invalid!\n"); + err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_boot, buf2, 8192); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_Boot, FILE_Boot), + (8192 + vol->cluster_size - 1) & + ~(vol->cluster_size - 1), 8192, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$Boot", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_Boot, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $Boot: %s\n", strerror(-err)); + Vprintf("Creating backup boot sector.\n"); + /* + * Write the first max(512, opt.sector_size) bytes from buf2 to the + * last sector. + */ + if (lseek(vol->fd, (opt.nr_sectors + 1) * opt.sector_size - i, + SEEK_SET) == (off_t)-1) + goto bb_err; + bw = mkntfs_write(vol->fd, buf2, i); + free(buf2); + buf2 = NULL; + if (bw != i) { + int _e = errno; + char *_s; + + if (bw == -1LL) + _s = strerror(_e); + else + _s = "unknown error"; + if (bw != -1LL || (bw == -1LL && _e != ENOSPC)) { + err_exit("Couldn't write backup boot sector: %s\n", _s); +bb_err: + Eprintf("Seek failed: %s\n", strerror(errno)); + } + Eprintf("Couldn't write backup boot sector. This is due to a " + "limitation in the\nLinux kernel. This is not " + "a major problem as Windows check disk will " + "create the\nbackup boot sector when it " + "is run on your next boot into Windows.\n"); + } + //dump_mft_record(m); + Vprintf("Creating $BadClus (mft record 8)\n"); + m = (MFT_RECORD*)(buf + 8 * vol->mft_record_size); + // FIXME: This should be IGNORE_CASE + /* Create a sparse named stream of size equal to the volume size. */ + err = add_attr_data_positioned(m, "$Bad", 4, 0, 0, rl_bad, NULL, + opt.nr_clusters * vol->cluster_size); + if (!err) { + err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); + } + if (!err) { + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_BadClus, FILE_BadClus), + 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, + 0, 0, "$BadClus", FILE_NAME_WIN32_AND_DOS); + } + if (!err) { + init_system_file_sd(FILE_BadClus, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $BadClus: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $Quota (mft record 9)\n"); + m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); + err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(9, 9), 0LL, 0LL, FILE_ATTR_HIDDEN + | FILE_ATTR_SYSTEM, 0, 0, "$Quota", + FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_Secure, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $Quota: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $UpCase (mft record 0xa)\n"); + m = (MFT_RECORD*)(buf + 0xa * vol->mft_record_size); + err = add_attr_data(m, NULL, 0, 0, 0, (char*)vol->upcase, + vol->upcase_len << 1); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_UpCase, FILE_UpCase), + ((vol->upcase_len << 1) + vol->cluster_size - 1) & + ~(vol->cluster_size - 1), vol->upcase_len << 1, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$UpCase", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_UpCase, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $UpCase: %s\n", strerror(-err)); + //dump_mft_record(m); + /* NTFS 1.2 reserved system files (mft records 0xb-0xf) */ + for (i = 0xb; i < 0x10; i++) { + Vprintf("Creating system file (mft record 0x%x)\n", i, i); + m = (MFT_RECORD*)(buf + i * vol->mft_record_size); + err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); + if (!err) { + init_system_file_sd(i, &sd, &j); + err = add_attr_sd(m, sd, j); + } + if (err < 0) + err_exit("Couldn't create system file %i (0x%x): %s\n", + i, i, strerror(-err)); + //dump_mft_record(m); + } +// - Do not step onto bad blocks!!! +// - If any bad blocks were specified or found, modify $BadClus, allocating the +// bad clusters in $Bitmap. +// - C&w bootsector backup bootsector (backup in last sector of the +// partition). +// - If NTFS 3.0+, c&w $Secure file and $Extend directory with the +// corresponding special files in it, i.e. $ObjId, $Quota, $Reparse, and +// $UsnJrnl. And others? Or not all necessary? +// - RE: Populate $root with the system files (and $Extend directory if +// applicable). Possibly should move this as far to the top as possible and +// update during each subsequent c&w of each system file. + Vprintf("Syncing root directory index record.\n"); + m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); + i = 5 * sizeof(uchar_t); + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) + err_exit("Failed to allocate attribute search context: %s\n", + strerror(errno)); + // FIXME: This should be IGNORE_CASE! + if (ntfs_lookup_attr(AT_INDEX_ALLOCATION, I30, 4, 0, 0, + NULL, 0, ctx)) { + ntfs_put_attr_search_ctx(ctx); + err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n"); + } + a = ctx->attr; + rl_index = ntfs_decompress_mapping_pairs(vol, a, NULL); + if (!rl_index) { + ntfs_put_attr_search_ctx(ctx); + err_exit("Failed to decompress run list of $INDEX_ALLOCATION " + "attribute.\n"); + } + if (sle64_to_cpu(a->initialized_size) < i) { + ntfs_put_attr_search_ctx(ctx); + err_exit("BUG: $INDEX_ALLOCATION attribute too short.\n"); + } + ntfs_put_attr_search_ctx(ctx); + i = sizeof(INDEX_BLOCK) - sizeof(INDEX_HEADER) + + le32_to_cpu(index_block->index.allocated_size); + err = ntfs_pre_write_mst_fixup((NTFS_RECORD*)index_block, i); + if (err) + err_exit("ntfs_pre_write_mst_fixup() failed while syncing " + "root directory index block.\n"); + lw = ntfs_rlwrite(vol->fd, rl_index, (char*)index_block, i, NULL); + if (lw != i) + err_exit("Error writing $INDEX_ALLOCATION.\n"); + /* No more changes to @index_block below here so no need for fixup: */ + // ntfs_post_write_mst_fixup((NTFS_RECORD*)index_block); + Vprintf("Syncing $Bitmap.\n"); + m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) + err_exit("Failed to allocate attribute search context: %s\n", + strerror(errno)); + if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + ntfs_put_attr_search_ctx(ctx); + err_exit("BUG: $DATA attribute not found.\n"); + } + a = ctx->attr; + if (a->non_resident) { + rl = ntfs_decompress_mapping_pairs(vol, a, NULL); + ntfs_put_attr_search_ctx(ctx); + if (!rl) + err_exit("ntfs_decompress_mapping_pairs() failed\n"); + lw = ntfs_rlwrite(vol->fd, rl, lcn_bitmap, + lcn_bitmap_byte_size, NULL); + if (lw != lcn_bitmap_byte_size) + err_exit("%s\n", lw == -1 ? strerror(errno) : + "unknown error"); + } else { + memcpy((char*)a + le16_to_cpu(a->value_offset), lcn_bitmap, + le32_to_cpu(a->value_length)); + ntfs_put_attr_search_ctx(ctx); + } + /* + * No need to sync $MFT/$BITMAP as that has never been modified since + * its creation. + */ + Vprintf("Syncing $MFT.\n"); + pos = opt.mft_lcn * vol->cluster_size; + lw = 1; + for (i = 0; i < opt.mft_size / vol->mft_record_size; i++) { + if (!opt.no_action) + lw = ntfs_mst_pwrite(vol->fd, pos, 1, + vol->mft_record_size, + buf + i * vol->mft_record_size); + if (lw != 1) + err_exit("%s\n", lw == -1 ? strerror(errno) : + "unknown error"); + pos += vol->mft_record_size; + } + Vprintf("Updating $MFTMirr.\n"); + pos = opt.mftmirr_lcn * vol->cluster_size; + lw = 1; + for (i = 0; i < rl_mftmirr[0].length * vol->cluster_size / + vol->mft_record_size; i++) { + u16 usn, *usnp; + m = (MFT_RECORD*)(buf + i * vol->mft_record_size); + /* + * Decrement the usn by one, so it becomes the same as the one + * in $MFT once it is mst protected. - This is as we need the + * $MFTMirr to have the exact same byte by byte content as + * $MFT, rather than just equivalent meaning content. + */ + usnp = (u16*)((char*)m + le16_to_cpu(m->usa_ofs)); + usn = le16_to_cpup(usnp); + if (usn-- <= 1) + usn = 0xfffe; + *usnp = cpu_to_le16(usn); + if (!opt.no_action) + lw = ntfs_mst_pwrite(vol->fd, pos, 1, + vol->mft_record_size, + buf + i * vol->mft_record_size); + if (lw != 1) + err_exit("%s\n", lw == -1 ? strerror(errno) : + "unknown error"); + pos += vol->mft_record_size; + } + Vprintf("Syncing device.\n"); + if (fdatasync(vol->fd) == -1) + err_exit("Syncing device. FAILED: %s", strerror(errno)); + Qprintf("mkntfs completed successfully. Have a nice day.\n"); + /* + * Device is unlocked and closed by the registered exit function + * mkntfs_exit(). + */ + return 0; +} + From 856a1afb3035c6cc114e74f63d8ecfbf54d9dd78 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0017/2994] Cleanup the build process a bit. 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/05 20:38:11-00:00 !antona update 2002/06/02 14:11:08-00:00 !antona . 2002/06/02 13:57:59-00:00 !antona Fix detection of read-only mounts in volume.c::ntfs_check_mnteent(). 2002/04/29 13:00:31-00:00 !antona Add check for mbsrtowcs 2002/04/24 23:47:40-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/04/18 18:15:45-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2002/04/14 14:15:47-00:00 !antona Cleanups and updates. 2002/01/26 04:32:35-00:00 !antona RedHat 7.2 - updates 2002/01/10 10:54:27-00:00 !antona Updates 2001/12/15 05:13:08-00:00 !antona Remove atomic ops and add compiler version check. 2001/12/06 01:14:52-00:00 !antona Added mount flags to ntfs_mount and adapted utilities to new mount syntax. 2001/11/17 01:57:53-00:00 !antona Update build system with new document. 2001/11/10 14:22:15-00:00 !antona Remove obsoleted disklabel.h stuff. 2001/11/10 14:17:39-00:00 !antona Enhance mkntfs' device size determination. 2001/11/09 23:36:16-00:00 !antona Bug fixes 2001/11/09 19:24:23-00:00 !antona With lots of luck this is going to be 1.2.3. 2001/08/27 16:58:07-00:00 !antona Updates. 2001/06/11 04:02:08-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/05 10:33:02-00:00 !antona Update automatic config/make process and mkntfs to use the cvs release tag for version reporting. 2001/06/01 02:07:23-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/03 02:03:35-00:00 !antona More files. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- config.h.in | 191 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) diff --git a/config.h.in b/config.h.in index e69de29b..f9e8946e 100644 --- a/config.h.in +++ b/config.h.in @@ -0,0 +1,191 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define to empty if the keyword does not work. */ +#undef const + +/* Define if the `long double' type works. */ +#undef HAVE_LONG_DOUBLE + +/* Define as __inline if that's what the C compiler calls it. */ +#undef inline + +/* Define to `long' if doesn't define. */ +#undef off_t + +/* Define to `unsigned' if doesn't define. */ +#undef size_t + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you have the atexit function. */ +#undef HAVE_ATEXIT + +/* Define if you have the calloc function. */ +#undef HAVE_CALLOC + +/* Define if you have the close function. */ +#undef HAVE_CLOSE + +/* Define if you have the endmntent function. */ +#undef HAVE_ENDMNTENT + +/* Define if you have the exit function. */ +#undef HAVE_EXIT + +/* Define if you have the fdatasync function. */ +#undef HAVE_FDATASYNC + +/* Define if you have the fflush function. */ +#undef HAVE_FFLUSH + +/* Define if you have the fprintf function. */ +#undef HAVE_FPRINTF + +/* Define if you have the free function. */ +#undef HAVE_FREE + +/* Define if you have the getmntent function. */ +#undef HAVE_GETMNTENT + +/* Define if you have the hasmntopt function. */ +#undef HAVE_HASMNTOPT + +/* Define if you have the ioctl function. */ +#undef HAVE_IOCTL + +/* Define if you have the lseek function. */ +#undef HAVE_LSEEK + +/* Define if you have the malloc function. */ +#undef HAVE_MALLOC + +/* Define if you have the mbrtowc function. */ +#undef HAVE_MBRTOWC + +/* Define if you have the mbsrtowcs function. */ +#undef HAVE_MBSRTOWCS + +/* Define if you have the memset function. */ +#undef HAVE_MEMSET + +/* Define if you have the open function. */ +#undef HAVE_OPEN + +/* Define if you have the perror function. */ +#undef HAVE_PERROR + +/* Define if you have the printf function. */ +#undef HAVE_PRINTF + +/* Define if you have the puts function. */ +#undef HAVE_PUTS + +/* Define if you have the random function. */ +#undef HAVE_RANDOM + +/* Define if you have the read function. */ +#undef HAVE_READ + +/* Define if you have the realloc function. */ +#undef HAVE_REALLOC + +/* Define if you have the setmntent function. */ +#undef HAVE_SETMNTENT + +/* Define if you have the srandom function. */ +#undef HAVE_SRANDOM + +/* Define if you have the strdup function. */ +#undef HAVE_STRDUP + +/* Define if you have the strerror function. */ +#undef HAVE_STRERROR + +/* Define if you have the time function. */ +#undef HAVE_TIME + +/* Define if you have the vfprintf function. */ +#undef HAVE_VFPRINTF + +/* Define if you have the vprintf function. */ +#undef HAVE_VPRINTF + +/* Define if you have the wcrtomb function. */ +#undef HAVE_WCRTOMB + +/* Define if you have the write function. */ +#undef HAVE_WRITE + +/* Define if you have the header file. */ +#undef HAVE_ASM_BYTEORDER_H + +/* Define if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define if you have the header file. */ +#undef HAVE_ERRNO_H + +/* Define if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define if you have the header file. */ +#undef HAVE_GETOPT_H + +/* Define if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define if you have the header file. */ +#undef HAVE_LINUX_FD_H + +/* Define if you have the header file. */ +#undef HAVE_LINUX_MAJOR_H + +/* Define if you have the header file. */ +#undef HAVE_LINUX_TYPES_H + +/* Define if you have the header file. */ +#undef HAVE_MNTENT_H + +/* Define if you have the header file. */ +#undef HAVE_STDARG_H + +/* Define if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_MOUNT_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define if you have the header file. */ +#undef HAVE_TIME_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the header file. */ +#undef HAVE_WCHAR_H + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + From 97b30713bf78ed2c54496f2bc958530ece1d9de9 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0018/2994] Concolidate TODO files 2001/03/26 03:39:59-00:00 !antona Updates 2001/01/30 12:29:03-00:00 !antona And the last move into CVS. The make files. (Note: compilation is untested and all changes have been done without testing so if it doesn't compile at the moment don't be too surprised.) 2001/01/24 02:10:41-00:00 !antona Checkin my current todo files. (Logical change 1.5) --- TODO.include | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TODO.include b/TODO.include index e69de29b..86012265 100644 --- a/TODO.include +++ b/TODO.include @@ -0,0 +1,4 @@ +Finish layout.h: in particular, add: + +- more about EFS and the EFS attribute. + From 79d44e2d95c9dea22ba237e83cf19ffcf27607de Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0019/2994] Forgot that one. 2001/06/10 18:30:16-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. 2001/02/02 01:15:17-00:00 !antona Updated documentation and other text files. Preparing for initial release. 2001/02/02 00:30:25-00:00 !antona Had to change symbolic links to files to get cvs to accept them. (Logical change 1.5) --- INSTALL | 197 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) diff --git a/INSTALL b/INSTALL index e69de29b..28d8614f 100644 --- a/INSTALL +++ b/INSTALL @@ -0,0 +1,197 @@ +Quick installation +================== + + In most cases it should be sufficient to do: + + ./configure + make + make install + + The above will compile and install the NTFS library and utility +programs into /usr/local/lib and /usr/local/bin respectively. The man +pages will be installed by default in /usr/local/man. + +Basic Installation +================== + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + The `--enable-debug' option to `configure' will enable additional debugging +checks in the code as well as debugging information output which will be +emitted to stdout. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. From cb99e98c6995c1e1bf152b6f1291c8f012aed6d9 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0020/2994] Had to change symbolic links to files to get cvs to accept them. (Logical change 1.5) --- install-sh | 251 ++++ ltconfig | 3114 +++++++++++++++++++++++++++++++++++++++++++++++++ missing | 190 +++ mkinstalldirs | 40 + 4 files changed, 3595 insertions(+) diff --git a/install-sh b/install-sh index e69de29b..e9de2384 100755 --- a/install-sh +++ b/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/ltconfig b/ltconfig index e69de29b..c14d83c1 100755 --- a/ltconfig +++ b/ltconfig @@ -0,0 +1,3114 @@ +#! /bin/sh + +# ltconfig - Create a system-specific libtool. +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This file 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 of the License, 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A lot of this script is taken from autoconf-2.10. + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} +echo=echo +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec "$SHELL" "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null`} + case X$UNAME in + *-DOS) PATH_SEPARATOR=';' ;; + *) PATH_SEPARATOR=':' ;; + esac +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || + test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running ltconfig again with it. + ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf "%s\n"' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # Cool, printf works + : + elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# The name of this program. +progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` + +# Constants: +PROGRAM=ltconfig +PACKAGE=libtool +VERSION=1.3.5 +TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)" +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +rm="rm -f" + +help="Try \`$progname --help' for more information." + +# Global variables: +default_ofile=libtool +can_build_shared=yes +enable_shared=yes +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +enable_static=yes +enable_fast_install=yes +enable_dlopen=unknown +enable_win32_dll=no +ltmain= +silent= +srcdir= +ac_config_guess= +ac_config_sub= +host= +nonopt= +ofile="$default_ofile" +verify_host=yes +with_gcc=no +with_gnu_ld=no +need_locks=yes +ac_ext=c +objext=o +libext=a +exeext= +cache_file= + +old_AR="$AR" +old_CC="$CC" +old_CFLAGS="$CFLAGS" +old_CPPFLAGS="$CPPFLAGS" +old_LDFLAGS="$LDFLAGS" +old_LD="$LD" +old_LN_S="$LN_S" +old_LIBS="$LIBS" +old_NM="$NM" +old_RANLIB="$RANLIB" +old_DLLTOOL="$DLLTOOL" +old_OBJDUMP="$OBJDUMP" +old_AS="$AS" + +# Parse the command line options. +args= +prev= +for option +do + case "$option" in + -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + eval "$prev=\$option" + prev= + continue + fi + + case "$option" in + --help) cat <&2 + echo "$help" 1>&2 + exit 1 + ;; + + *) + if test -z "$ltmain"; then + ltmain="$option" + elif test -z "$host"; then +# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 +# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then +# echo "$progname: warning \`$option' is not a valid host type" 1>&2 +# fi + host="$option" + else + echo "$progname: too many arguments" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac +done + +if test -z "$ltmain"; then + echo "$progname: you must specify a LTMAIN file" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +if test ! -f "$ltmain"; then + echo "$progname: \`$ltmain' does not exist" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +# Quote any args containing shell metacharacters. +ltconfig_args= +for arg +do + case "$arg" in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ltconfig_args="$ltconfig_args '$arg'" ;; + *) ltconfig_args="$ltconfig_args $arg" ;; + esac +done + +# A relevant subset of AC_INIT. + +# 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 +# 5 compiler messages saved in config.log +# 6 checking for... messages and results +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>>./config.log + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi +if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi + +if test -n "$cache_file" && test -r "$cache_file"; then + echo "loading cache $cache_file within ltconfig" + . $cache_file +fi + +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 + +if test -z "$srcdir"; then + # Assume the source directory is the same one as the path to LTMAIN. + srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` + test "$srcdir" = "$ltmain" && srcdir=. +fi + +trap "$rm conftest*; exit 1" 1 2 15 +if test "$verify_host" = yes; then + # Check for config.guess and config.sub. + ac_aux_dir= + for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/config.guess; then + ac_aux_dir=$ac_dir + break + fi + done + if test -z "$ac_aux_dir"; then + echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 + echo "$help" 1>&2 + exit 1 + fi + ac_config_guess=$ac_aux_dir/config.guess + ac_config_sub=$ac_aux_dir/config.sub + + # Make sure we can run config.sub. + if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : + else + echo "$progname: cannot run $ac_config_sub" 1>&2 + echo "$help" 1>&2 + exit 1 + fi + + echo $ac_n "checking host system type""... $ac_c" 1>&6 + + host_alias=$host + case "$host_alias" in + "") + if host_alias=`$SHELL $ac_config_guess`; then : + else + echo "$progname: cannot guess host type; you must specify one" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac + host=`$SHELL $ac_config_sub $host_alias` + echo "$ac_t$host" 1>&6 + + # Make sure the host verified. + test -z "$host" && exit 1 + +elif test -z "$host"; then + echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 + echo "$help" 1>&2 + exit 1 +else + host_alias=$host +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case "$host_os" in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +case "$host_os" in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR cru $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +# Set a sane default for `AR'. +test -z "$AR" && AR=ar + +# Set a sane default for `OBJDUMP'. +test -z "$OBJDUMP" && OBJDUMP=objdump + +# If RANLIB is not set, then run the test. +if test "${RANLIB+set}" != "set"; then + result=no + + echo $ac_n "checking for ranlib... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then + RANLIB="ranlib" + result="ranlib" + break + fi + done + IFS="$save_ifs" + + echo "$ac_t$result" 1>&6 +fi + +if test -n "$RANLIB"; then + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" +fi + +# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$AS" && AS=as + +# Check to see if we are using GCC. +if test "$with_gcc" != yes || test -z "$CC"; then + # If CC is not set, then try to find GCC or a usable CC. + if test -z "$CC"; then + echo $ac_n "checking for gcc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then + CC="gcc" + break + fi + done + IFS="$save_ifs" + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + fi + + # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". + if test -z "$CC"; then + echo $ac_n "checking for cc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + cc_rejected=no + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/cc || test -f $dir/cc$ac_exeext; then + if test "$dir/cc" = "/usr/ucb/cc"; then + cc_rejected=yes + continue + fi + CC="cc" + break + fi + done + IFS="$save_ifs" + if test $cc_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same name, so the bogon will be chosen + # first if we set CC to just the name; use the full file name. + shift + set dummy "$dir/cc" "$@" + shift + CC="$@" + fi + fi + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$CC"; then + echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 + exit 1 + fi + fi + + # Now see if the compiler is really GCC. + with_gcc=no + echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 + echo "$progname:581: checking whether we are using GNU C" >&5 + + $rm conftest.c + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + with_gcc=yes + fi + $rm conftest.c + echo "$ac_t$with_gcc" 1>&6 +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo $ac_n "checking for object suffix... $ac_c" 1>&6 +$rm conftest* +echo 'int i = 1;' > conftest.c +echo "$progname:603: checking for object suffix" >& 5 +if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 +fi +$rm conftest* +echo "$ac_t$objext" 1>&6 + +echo $ac_n "checking for executable suffix... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_exeext="no" + $rm conftest* + echo 'main () { return 0; }' > conftest.c + echo "$progname:629: checking for executable suffix" >& 5 + if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c | *.err | *.$objext ) ;; + *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; + esac + done + else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* +fi +if test "X$ac_cv_exeext" = Xno; then + exeext="" +else + exeext="$ac_cv_exeext" +fi +echo "$ac_t$ac_cv_exeext" 1>&6 + +echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 +pic_flag= +special_shlib_compile_flags= +wl= +link_static_flag= +no_builtin_flag= + +if test "$with_gcc" = yes; then + wl='-Wl,' + link_static_flag='-static' + + case "$host_os" in + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # we not sure about C++ programs. + link_static_flag="$link_static_flag ${wl}-lC" + ;; + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + pic_flag='-m68020 -resident32 -malways-restore-a4' + ;; + sysv4*MP*) + if test -d /usr/nec; then + pic_flag=-Kconform_pic + fi + ;; + *) + pic_flag='-fPIC' + ;; + esac +else + # PORTME Check for PIC flags for the system compiler. + case "$host_os" in + aix3* | aix4*) + # All AIX code is PIC. + link_static_flag='-bnso -bI:/lib/syscalls.exp' + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better link_static_flag that works with the bundled CC? + wl='-Wl,' + link_static_flag="${wl}-a ${wl}archive" + pic_flag='+Z' + ;; + + irix5* | irix6*) + wl='-Wl,' + link_static_flag='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + wl='-Wl,' + link_static_flag='-non_shared' + ;; + + sco3.2v5*) + pic_flag='-Kpic' + link_static_flag='-dn' + special_shlib_compile_flags='-belf' + ;; + + solaris*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + sunos4*) + pic_flag='-PIC' + link_static_flag='-Bstatic' + wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + uts4*) + pic_flag='-pic' + link_static_flag='-Bstatic' + ;; + sysv4*MP*) + if test -d /usr/nec ;then + pic_flag='-Kconform_pic' + link_static_flag='-Bstatic' + fi + ;; + *) + can_build_shared=no + ;; + esac +fi + +if test -n "$pic_flag"; then + echo "$ac_t$pic_flag" 1>&6 + + # Check to make sure the pic_flag actually works. + echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $pic_flag -DPIC" + echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 + if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + case "$host_os" in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then they + # create non-PIC objects. So, if there were any warnings, we assume that + # PIC is not supported. + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + can_build_shared=no + pic_flag= + else + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + fi + ;; + *) + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + ;; + esac + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + can_build_shared=no + pic_flag= + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + echo "$ac_t"none 1>&6 +fi + +# Check to see if options -o and -c are simultaneously supported by compiler +echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +$rm conftest* +echo "int some_variable = 0;" > conftest.c +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.o" +echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 +if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + echo "$ac_t"no 1>&6 + compiler_c_o=no + else + echo "$ac_t"yes 1>&6 + compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + compiler_c_o=no + echo "$ac_t"no 1>&6 +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 +if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_o_lo=no + else + echo "$ac_t"yes 1>&6 + compiler_o_lo=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_o_lo=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$ac_t$hard_links" 1>&6 + $rm conftest* + if test "$hard_links" = no; then + echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 + need_locks=warn + fi +else + need_locks=no +fi + +if test "$with_gcc" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" + echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_rtti_exceptions=no + else + echo "$ac_t"yes 1>&6 + compiler_rtti_exceptions=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_rtti_exceptions=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi + +fi + +# Check for any special shared library compilation flags. +if test -n "$special_shlib_compile_flags"; then + echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : + else + echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 + can_build_shared=no + fi +fi + +echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 +$rm conftest* +echo 'main(){return(0);}' > conftest.c +save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $link_static_flag" +echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 +if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + echo "$ac_t$link_static_flag" 1>&6 +else + echo "$ac_t"none 1>&6 + link_static_flag= +fi +LDFLAGS="$save_LDFLAGS" +$rm conftest* + +if test -z "$LN_S"; then + # Check to see if we can use ln -s, or we need hard links. + echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 + $rm conftest.dat + if ln -s X conftest.dat 2>/dev/null; then + $rm conftest.dat + LN_S="ln -s" + else + LN_S=ln + fi + if test "$LN_S" = "ln -s"; then + echo "$ac_t"yes 1>&6 + else + echo "$ac_t"no 1>&6 + fi +fi + +# Make sure LD is an absolute path. +if test -z "$LD"; then + ac_prog=ld + if test "$with_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 + echo "$progname:991: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + 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 are not 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 $ac_n "checking for GNU ld... $ac_c" 1>&6 + echo "$progname:1015: checking for GNU ld" >&5 + else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 + echo "$progname:1018: checking for non-GNU ld" >&5 + fi + + 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 + 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 "$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" + fi + + if test -n "$LD"; then + echo "$ac_t$LD" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$LD"; then + echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 + exit 1 + fi +fi + +# Check to see if it really is or is not GNU ld. +echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 +# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + with_gnu_ld=yes +else + with_gnu_ld=no +fi +echo "$ac_t$with_gnu_ld" 1>&6 + +# See if the linker supports building shared libraries. +echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. + +case "$host_os" in +cygwin* | mingw*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$with_gcc" != yes; then + with_gnu_ld=no + fi + ;; + +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case "$host_os" in + aix3* | aix4*) + # On AIX, the GNU linker is very broken + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left by newer dlltools. + export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols' + + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done~ + test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' + + old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' + # can we support soname and/or expsyms with a.out? -oliva + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case "$host_os" in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$with_gcc" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4*) + hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' + hardcode_libdir_separator=':' + if test "$with_gcc" = yes; then + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + shared_flag='-shared' + else + shared_flag='${wl}-bM:SRE' + hardcode_direct=yes + fi + allow_undefined_flag=' ${wl}-berok' + archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' + archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' + case "$host_os" in aix4.[01]|aix4.[01].*) + # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on + always_export_symbols=yes ;; + esac + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs' + fix_srcfile_path='`cygpath -w $srcfile`' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case "$host_os" in + hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$with_gcc" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF + fi + hardcode_libdir_flag_spec='${wl}-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + openbsd*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' + ;; + + osf3*) + if test "$with_gcc" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # As osf3* with the addition of the -msym flag + if test "$with_gcc" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + rhapsody*) + archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flags_spec='-L$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case "$host_os" in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts' + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + unixware7*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$ac_t$ld_shlibs" 1>&6 +test "$ld_shlibs" = no && can_build_shared=no + +if test -z "$NM"; then + echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 + case "$NM" in + [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/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 + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -p" + break + else + NM=${NM="$ac_dir/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 "$NM" && NM=nm + ;; + esac + echo "$ac_t$NM" 1>&6 +fi + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Define system-specific variables. +case "$host_os" in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" + ;; +irix*) + symcode='[BCDEGRST]' + ;; +solaris*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + $rm conftest* + cat > conftest.c <&5 + if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then + # Now try to grab the symbols. + nlist=conftest.nm + if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then + + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.c +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' + + cat <> conftest.c +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c + cat <<\EOF >> conftest.c + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$objext conftstm.$objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + pipe_works=yes + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + LIBS="$save_LIBS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + global_symbol_pipe= + fi +done +if test "$pipe_works" = yes; then + echo "${ac_t}ok" 1>&6 +else + echo "${ac_t}failed" 1>&6 +fi + +if test -z "$global_symbol_pipe"; then + global_symbol_to_cdecl= +fi + +# Check hardcoding attributes. +echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$ac_t$hardcode_action" 1>&6 + + +reload_flag= +reload_cmds='$LD$reload_flag -o $output$reload_objs' +echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 +# PORTME Some linkers may need a different reload flag. +reload_flag='-r' +echo "$ac_t$reload_flag" 1>&6 +test -n "$reload_flag" && reload_flag=" $reload_flag" + +# PORTME Fill in your ld.so characteristics +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +file_magic_cmd= +file_magic_test_file= +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. +echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 +case "$host_os" in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4*) + version_type=linux + # AIX has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + # We preserve .a as extension for shared libraries though AIX4.2 + # and later linker supports .so + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' + shlibpath_var=LIBPATH + deplibs_check_method=pass_all + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + deplibs_check_method=pass_all + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw*) + version_type=windows + need_version=no + need_lib_prefix=no + if test "$with_gcc" = yes; then + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' + else + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + fi + dynamic_linker='Win32 ld.exe' + deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + file_magic_cmd='${OBJDUMP} -f' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case "$version_type" in + freebsd-elf*) + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + deplibs_check_method=unknown + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case "$host_os" in + freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + case "$host_os" in + hpux10.20*) + # TODO: Does this work for hpux-11 too? + deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so.$major' + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' + case "$host_os" in + irix5*) + libsuff= shlibsuff= + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case "$LD" in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /lib${libsuff}/libc.so*` + deplibs_check_method='pass_all' + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + deplibs_check_method=pass_all + + if test -f /lib/ld.so.1; then + dynamic_linker='GNU ld.so' + else + # Only the GNU ld.so supports shared libraries on MkLinux. + case "$host_cpu" in + powerpc*) dynamic_linker=no ;; + *) dynamic_linker='Linux ld.so' ;; + esac + fi + ;; + +netbsd*) + version_type=sunos + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + ;; + +openbsd*) + version_type=sunos + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + need_version=no + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method='file_magic COFF format alpha shared library' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + deplibs_check_method='pass_all' + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rhapsody*) + version_type=sunos + library_names_spec='${libname}.so' + soname_spec='${libname}.so' + shlibpath_var=DYLD_LIBRARY_PATH + deplibs_check_method=pass_all + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" + file_magic_cmd=/usr/bin/file + file_magic_test_file=/lib/libc.so + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case "$host_vendor" in + sequent) + file_magic_cmd='/bin/file' + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + ncr) + deplibs_check_method='pass_all' + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + 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]' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$ac_t$dynamic_linker" 1>&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 + +# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in +# configure.in, otherwise build static only libraries. +case "$host_os" in +cygwin* | mingw* | os2*) + if test x$can_build_shared = xyes; then + test x$enable_win32_dll = xno && can_build_shared=no + echo "checking if package supports dlls... $can_build_shared" 1>&6 + fi +;; +esac + +if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then + case "$deplibs_check_method" in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&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 + +echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac + +echo "$ac_t$enable_shared" 1>&6 + +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes + +echo "checking whether to build static libraries... $enable_static" 1>&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +echo $ac_n "checking for objdir... $ac_c" 1>&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$ac_t$objdir" 1>&6 + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else +if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then + lt_cv_dlopen=no lt_cv_dlopen_libs= +echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +echo "$progname:2248: checking for dlopen in -ldl" >&5 +ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldl $LIBS" +cat > conftest.$ac_ext <&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 "$progname: 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 + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dlopen""... $ac_c" 1>&6 +echo "$progname:2288: checking for dlopen" >&5 +if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen(); + +int main() { + +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +dlopen(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_dlopen=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_dlopen=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 +echo "$progname:2335: checking for dld_link in -ldld" >&5 +ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&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 "$progname: 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 + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load""... $ac_c" 1>&6 +echo "$progname:2375: checking for shl_load" >&5 +if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load(); + +int main() { + +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +shl_load(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_shl_load=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_shl_load=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 +echo "$progname:2423: checking for shl_load in -ldld" >&5 +ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&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 "$progname: 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 + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +fi + + +fi + + +fi + + +fi + + +fi + +fi + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + fi + + case "$lt_cv_dlopen" in + dlopen) +for ac_hdr in dlfcn.h; do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "$progname:2488: 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 < +int fnord = 0; +EOF +ac_try="$ac_compile >/dev/null 2>conftest.out" +{ (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +done + + if test "x$ac_cv_header_dlfcn_h" = xyes; then + CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + fi + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2526: checking whether a program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self" 1>&6 + + if test "$lt_cv_dlopen_self" = yes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self_static=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self_static=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self_static=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 +fi + ;; + esac + + case "$lt_cv_dlopen_self" in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case "$lt_cv_dlopen_self_static" in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + +# Copy echo and quote the copy, instead of the original, because it is +# used later. +ltecho="$echo" +if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ltecho="$CONFIG_SHELL \$0 --fallback-echo" +fi +LTSHELL="$SHELL" + +LTCONFIG_VERSION="$VERSION" + +# Only quote variables if we're using ltmain.sh. +case "$ltmain" in +*.sh) + # Now quote all the things that may contain metacharacters. + for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ + AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ + file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case "$var" in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case "$ltecho" in + *'\$0 --fallback-echo"') + ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + + trap "$rm \"$ofile\"; exit 1" 1 2 15 + echo "creating $ofile" + $rm "$ofile" + cat < "$ofile" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# 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 of the License, 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +### BEGIN LIBTOOL CONFIG +EOF + cfgfile="$ofile" + ;; + +*) + # Double-quote the variables that need it (for aesthetics). + for var in old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do + eval "$var=\\\"\$var\\\"" + done + + # Just create a config file. + cfgfile="$ofile.cfg" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + echo "creating $cfgfile" + $rm "$cfgfile" + cat < "$cfgfile" +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +EOF + ;; +esac + +cat <> "$cfgfile" +# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ +# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ +# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ +# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ +# $0$ltconfig_args +# +# Compiler and other test output produced by $progname, useful for +# debugging $progname, is in ./config.log if it exists. + +# The version of $progname that generated this script. +LTCONFIG_VERSION=$LTCONFIG_VERSION + +# Shell to use when invoking shell scripts. +SHELL=$LTSHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$ltecho + +# The archiver. +AR=$AR + +# The default C compiler. +CC=$CC + +# The linker used to build libraries. +LD=$LD + +# Whether we need hard or soft links. +LN_S=$LN_S + +# A BSD-compatible nm program. +NM=$NM + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$reload_flag +reload_cmds=$reload_cmds + +# How to pass a linker flag through the compiler. +wl=$wl + +# Object file suffix (normally "o"). +objext="$objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$pic_flag + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$RANLIB +old_archive_cmds=$old_archive_cmds +old_postinstall_cmds=$old_postinstall_cmds +old_postuninstall_cmds=$old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$old_archive_from_new_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$archive_cmds +archive_expsym_cmds=$archive_expsym_cmds +postinstall_cmds=$postinstall_cmds +postuninstall_cmds=$postuninstall_cmds + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$global_symbol_to_cdecl + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$include_expsyms + +EOF + +case "$ltmain" in +*.sh) + echo '### END LIBTOOL CONFIG' >> "$ofile" + echo >> "$ofile" + case "$host_os" in + aix3*) + cat <<\EOF >> "$ofile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # Append the ltmain.sh script. + sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + + chmod +x "$ofile" + ;; + +*) + # Compile the libtool program. + echo "FIXME: would compile $ltmain" + ;; +esac + +test -n "$cache_file" || exit 0 + +# AC_CACHE_SAVE +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. +# +# 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. +# +EOF +# 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 + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/missing b/missing index e69de29b..7789652e 100755 --- a/missing +++ b/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# 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. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs index e69de29b..6b3b5fc5 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id$ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here From ca715933a04f7acafefc4513a2a4c8c407f781aa Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0021/2994] It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. (Logical change 1.5) --- doc/system_files.txt | 43 ++++++ doc/system_security_descriptors.txt | 33 +++++ ntfstools/attrdef.c | 153 +++++++++++++++++++ ntfstools/boot.c | 218 ++++++++++++++++++++++++++++ 4 files changed, 447 insertions(+) diff --git a/doc/system_files.txt b/doc/system_files.txt index e69de29b..a5581d2a 100644 --- a/doc/system_files.txt +++ b/doc/system_files.txt @@ -0,0 +1,43 @@ +$Id$ + +System files mft record numbers. All these files are always marked as used +in the bitmap attribute of the mft; presumably in order to avoid accidental +allocation for random other mft records. Also, the sequence number for each +of the system files is always equal to their mft record number and it is +never modified. (Only $MFT has a sequence number of 1, rather than 0.) + +FILE_$MFT = 0, /* Master file table (mft). Data attribute + contains the entries and bitmap attribute + records which ones are in use (bit==1). */ +FILE_$MFTMirr = 1, /* Mft mirror (copy of first four mft records) + in data attribute. */ +FILE_$LogFile = 2, /* Journalling log in data attribute. */ +FILE_$Volume = 3, /* Volume name attribute and volume information + attribute (flags and ntfs version). Windows + refers to this file as volume DASD (Direct + Access Storage Device). */ +FILE_$AttrDef = 4, /* Array of attribute definitions in data + attribute. */ +FILE_$root = 5, /* Root directory. */ +FILE_$Bitmap = 6, /* Allocation bitmap of all clusters (lcns) in + data attribute. */ +FILE_$Boot = 7, /* Boot sector (always at cluster 0) in data + attribute. */ +FILE_$BadClus = 8, /* Contains all bad clusters in the non-resident + data attribute. */ +FILE_$Secure = 9, /* Shared security descriptors in data attribute + and two indexes into the descriptors. + Appeared in Windows 2000. Before that, this + file was named $Quota but was unused. */ +FILE_$UpCase = 10, /* Uppercase equivalents of all 65536 Unicode + characters in data attribute. */ +FILE_$Extend = 11, /* Directory containing other system files (eg. + $ObjId, $Quota, $Reparse and $UsnJrnl). This + is new to NTFS3.0. */ +FILE_reserved12 = 12, /* Reserved for future use (records 12-15). */ +FILE_reserved13 = 13, +FILE_reserved14 = 14, +FILE_reserved15 = 15, +FILE_first_user = 16, /* First user file, used as test limit for + whether to allow opening a file or not. */ + diff --git a/doc/system_security_descriptors.txt b/doc/system_security_descriptors.txt index e69de29b..f8f4aef7 100644 --- a/doc/system_security_descriptors.txt +++ b/doc/system_security_descriptors.txt @@ -0,0 +1,33 @@ +$SD attribute value for the system files: + +$MFT, $MFTMirr, $LogFile, $AttrDef, $Bitmap, $Boot, $BadClus, and $UpCase: + +sd: 1, 0, 0x8004, 0x00000048, 0x00000058, 0x00000000, 0x00000014; +sd.dacl.acl: 2, 0, 0x0034, 0x0002, 0x0000; +sd.dacl.acl.ace1: 0, 0, 0x0014, 0x00120089; +sd.dacl.acl.ace1.sid: 1, 1, 0, 0, 0, 0, 0, 5, 0x00000012; +sd.dacl.acl.ace2: 0, 0, 0x0018, 0x00120089; +sd.dacl.acl.ace2.sid: 1, 2, 0, 0, 0, 0, 0, 5, 0x00000020, 0x00000220; +sd.owner.sid: 1, 2, 0, 0, 0, 0, 0, 5, 0x00000020, 0x00000220; +sd.group.sid: 1, 2, 0, 0, 0, 0, 0, 5, 0x00000020, 0x00000220; + +$Volume, $Quota, and system files 0xb-0xf: + +sd: 1, 0, 0x8004, 0x00000048, 0x00000058, 0x00000000, 0x00000014; +sd.dacl.acl: 2, 0, 0x0034, 0x0002, 0x0000; +sd.dacl.acl.ace1: 0, 0, 0x0014, 0x0012019f; +sd.dacl.acl.ace1.sid: 1, 1, 0, 0, 0, 0, 0, 5, 0x00000012; +sd.dacl.acl.ace2: 0, 0, 0x0018, 0x0012019f; +sd.dacl.acl.ace2.sid: 1, 2, 0, 0, 0, 0, 0, 5, 0x00000020, 0x00000220; +sd.owner.sid: 1, 2, 0, 0, 0, 0, 0, 5, 0x00000020, 0x00000220; +sd.group.sid: 1, 2, 0, 0, 0, 0, 0, 5, 0x00000020, 0x00000220; + +. (root directory) + +sd: 1, 0, 0x8004, 0x00000030, 0x00000040, 0x00000000, 0x00000014; +sd.dacl.acl: 2, 0, 0x001c, 0x0001, 0x0000; +sd.dacl.acl.ace1: 0, 3, 0x0014, 0x001f01ff; +sd.dacl.acl.ace1.sid: 1, 1, 0, 0, 0, 0, 0, 1, 0x00000000; +sd.owner.sid: 1, 2, 0, 0, 0, 0, 0, 5, 0x00000020, 0x00000220; +sd.group.sid: 1, 2, 0, 0, 0, 0, 0, 5, 0x00000020, 0x00000220; + diff --git a/ntfstools/attrdef.c b/ntfstools/attrdef.c index e69de29b..c9bb82c6 100644 --- a/ntfstools/attrdef.c +++ b/ntfstools/attrdef.c @@ -0,0 +1,153 @@ +const unsigned char attrdef_ntfs12_array[2400] = { + 36, 0, 83, 0, 84, 0, 65, 0, 78, 0, 68, 0, 65, 0, 82, 0, + 68, 0, 95, 0, 73, 0, 78, 0, 70, 0, 79, 0, 82, 0, 77, 0, + 65, 0, 84, 0, 73, 0, 79, 0, 78, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, + 48, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 65, 0, 84, 0, 84, 0, 82, 0, 73, 0, 66, 0, 85, 0, + 84, 0, 69, 0, 95, 0, 76, 0, 73, 0, 83, 0, 84, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 70, 0, 73, 0, 76, 0, 69, 0, 95, 0, 78, 0, 65, 0, + 77, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, + 68, 0, 0, 0, 0, 0, 0, 0, 66, 2, 0, 0, 0, 0, 0, 0, + 36, 0, 86, 0, 79, 0, 76, 0, 85, 0, 77, 0, 69, 0, 95, 0, + 86, 0, 69, 0, 82, 0, 83, 0, 73, 0, 79, 0, 78, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, + 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 83, 0, 69, 0, 67, 0, 85, 0, 82, 0, 73, 0, 84, 0, + 89, 0, 95, 0, 68, 0, 69, 0, 83, 0, 67, 0, 82, 0, 73, 0, + 80, 0, 84, 0, 79, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 86, 0, 79, 0, 76, 0, 85, 0, 77, 0, 69, 0, 95, 0, + 78, 0, 65, 0, 77, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, + 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 36, 0, 86, 0, 79, 0, 76, 0, 85, 0, 77, 0, 69, 0, 95, 0, + 73, 0, 78, 0, 70, 0, 79, 0, 82, 0, 77, 0, 65, 0, 84, 0, + 73, 0, 79, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 68, 0, 65, 0, 84, 0, 65, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 73, 0, 78, 0, 68, 0, 69, 0, 88, 0, 95, 0, 82, 0, + 79, 0, 79, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 73, 0, 78, 0, 68, 0, 69, 0, 88, 0, 95, 0, 65, 0, + 76, 0, 76, 0, 79, 0, 67, 0, 65, 0, 84, 0, 73, 0, 79, 0, + 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 66, 0, 73, 0, 84, 0, 77, 0, 65, 0, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 83, 0, 89, 0, 77, 0, 66, 0, 79, 0, 76, 0, 73, 0, + 67, 0, 95, 0, 76, 0, 73, 0, 78, 0, 75, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 69, 0, 65, 0, 95, 0, 73, 0, 78, 0, 70, 0, 79, 0, + 82, 0, 77, 0, 65, 0, 84, 0, 73, 0, 79, 0, 78, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, + 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 69, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + diff --git a/ntfstools/boot.c b/ntfstools/boot.c index e69de29b..b47ded9c 100644 --- a/ntfstools/boot.c +++ b/ntfstools/boot.c @@ -0,0 +1,218 @@ +/* The first 3429 bytes of $Boot. The rest is just zero. Total 8192 bytes. */ +const unsigned char boot_array[3429] = { +235, 91, 144, 78, 84, 70, 83, 32, 32, 32, 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 51, 192, +142, 208, 188, 0, 124, 251, 184, 192, 7, 142, 216, 199, 6, 84, 0, 0, + 0, 199, 6, 86, 0, 0, 0, 199, 6, 91, 0, 16, 0, 184, 0, 13, +142, 192, 43, 219, 232, 7, 0, 104, 0, 13, 104, 102, 2, 203, 80, 83, + 81, 82, 6, 102, 161, 84, 0, 102, 3, 6, 28, 0, 102, 51, 210, 102, + 15, 183, 14, 24, 0, 102, 247, 241, 254, 194, 136, 22, 90, 0, 102, 139, +208, 102, 193, 234, 16, 247, 54, 26, 0, 136, 22, 37, 0, 163, 88, 0, +161, 24, 0, 42, 6, 90, 0, 64, 59, 6, 91, 0, 118, 3, 161, 91, + 0, 80, 180, 2, 139, 22, 88, 0, 177, 6, 210, 230, 10, 54, 90, 0, +139, 202, 134, 233, 138, 54, 37, 0, 178, 128, 205, 19, 88, 114, 42, 1, + 6, 84, 0, 131, 22, 86, 0, 0, 41, 6, 91, 0, 118, 11, 193, 224, + 5, 140, 194, 3, 208, 142, 194, 235, 138, 7, 90, 89, 91, 88, 195, 190, + 89, 1, 235, 8, 190, 227, 1, 235, 3, 190, 57, 1, 232, 9, 0, 190, +173, 1, 232, 3, 0, 251, 235, 254, 172, 60, 0, 116, 9, 180, 14, 187, + 7, 0, 205, 16, 235, 242, 195, 29, 0, 65, 32, 100, 105, 115, 107, 32, +114, 101, 97, 100, 32, 101, 114, 114, 111, 114, 32, 111, 99, 99, 117, 114, +114, 101, 100, 46, 13, 10, 0, 41, 0, 65, 32, 107, 101, 114, 110, 101, +108, 32, 102, 105, 108, 101, 32, 105, 115, 32, 109, 105, 115, 115, 105, 110, +103, 32, 102, 114, 111, 109, 32, 116, 104, 101, 32, 100, 105, 115, 107, 46, + 13, 10, 0, 37, 0, 65, 32, 107, 101, 114, 110, 101, 108, 32, 102, 105, +108, 101, 32, 105, 115, 32, 116, 111, 111, 32, 100, 105, 115, 99, 111, 110, +116, 105, 103, 117, 111, 117, 115, 46, 13, 10, 0, 51, 0, 73, 110, 115, +101, 114, 116, 32, 97, 32, 115, 121, 115, 116, 101, 109, 32, 100, 105, 115, +107, 101, 116, 116, 101, 32, 97, 110, 100, 32, 114, 101, 115, 116, 97, 114, +116, 13, 10, 116, 104, 101, 32, 115, 121, 115, 116, 101, 109, 46, 13, 10, + 0, 23, 0, 92, 78, 84, 76, 68, 82, 32, 105, 115, 32, 99, 111, 109, +112, 114, 101, 115, 115, 101, 100, 46, 13, 10, 0, 0, 0, 0, 85, 170, + 5, 0, 78, 0, 84, 0, 76, 0, 68, 0, 82, 0, 4, 0, 36, 0, + 73, 0, 51, 0, 48, 0, 0, 224, 0, 0, 0, 48, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 140, 200, 142, 216, 193, 224, 4, 250, 139, 224, +251, 102, 15, 183, 6, 11, 0, 102, 15, 182, 30, 13, 0, 102, 247, 227, +102, 163, 78, 2, 102, 139, 14, 64, 0, 128, 249, 0, 15, 143, 14, 0, +246, 217, 102, 184, 1, 0, 0, 0, 102, 211, 224, 235, 8, 144, 102, 161, + 78, 2, 102, 247, 225, 102, 163, 82, 2, 102, 15, 183, 30, 11, 0, 102, + 51, 210, 102, 247, 243, 102, 163, 86, 2, 232, 44, 4, 102, 139, 14, 74, + 2, 102, 137, 14, 34, 2, 102, 3, 14, 82, 2, 102, 137, 14, 38, 2, +102, 3, 14, 82, 2, 102, 137, 14, 42, 2, 102, 3, 14, 82, 2, 102, +137, 14, 58, 2, 102, 3, 14, 82, 2, 102, 137, 14, 66, 2, 102, 184, +144, 0, 0, 0, 102, 139, 14, 34, 2, 232, 65, 9, 102, 11, 192, 15, +132, 22, 254, 102, 163, 46, 2, 102, 184, 160, 0, 0, 0, 102, 139, 14, + 38, 2, 232, 40, 9, 102, 163, 50, 2, 102, 184, 176, 0, 0, 0, 102, +139, 14, 42, 2, 232, 22, 9, 102, 163, 54, 2, 102, 161, 46, 2, 102, + 11, 192, 15, 132, 227, 253, 103, 128, 120, 8, 0, 15, 133, 218, 253, 103, +102, 141, 80, 16, 103, 3, 66, 4, 103, 102, 15, 182, 72, 12, 102, 137, + 14, 94, 2, 103, 102, 139, 72, 8, 102, 137, 14, 90, 2, 102, 161, 90, + 2, 102, 15, 183, 14, 11, 0, 102, 51, 210, 102, 247, 241, 102, 163, 98, + 2, 102, 161, 66, 2, 102, 3, 6, 90, 2, 102, 163, 70, 2, 102, 131, + 62, 50, 2, 0, 15, 132, 25, 0, 102, 131, 62, 54, 2, 0, 15, 132, +135, 253, 102, 139, 30, 54, 2, 30, 7, 102, 139, 62, 70, 2, 232, 177, + 1, 102, 15, 183, 14, 0, 2, 102, 184, 2, 2, 0, 0, 232, 153, 6, +102, 11, 192, 15, 132, 88, 253, 103, 102, 139, 0, 30, 7, 102, 139, 62, + 58, 2, 232, 209, 4, 102, 161, 58, 2, 102, 187, 128, 0, 0, 0, 102, +185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, 203, 0, 102, 11, +192, 15, 132, 42, 253, 103, 102, 15, 183, 88, 12, 102, 129, 227, 255, 0, + 0, 0, 15, 133, 30, 253, 102, 139, 216, 104, 0, 32, 7, 102, 43, 255, +232, 79, 1, 138, 22, 36, 0, 184, 232, 3, 142, 192, 141, 54, 11, 0, + 43, 192, 104, 0, 32, 80, 203, 80, 83, 81, 82, 6, 255, 54, 91, 0, +255, 54, 84, 0, 255, 54, 86, 0, 139, 195, 193, 232, 4, 140, 193, 3, +193, 37, 255, 15, 45, 0, 16, 247, 216, 139, 14, 91, 0, 193, 225, 5, + 81, 59, 193, 118, 2, 139, 193, 80, 193, 232, 5, 163, 91, 0, 232, 61, +252, 88, 89, 43, 200, 118, 11, 140, 194, 3, 208, 142, 194, 184, 0, 16, +235, 222, 143, 6, 86, 0, 143, 6, 84, 0, 143, 6, 91, 0, 7, 90, + 89, 91, 88, 195, 6, 30, 102, 96, 102, 139, 218, 102, 15, 182, 14, 13, + 0, 102, 247, 225, 102, 163, 84, 0, 102, 139, 195, 102, 247, 225, 163, 91, + 0, 139, 223, 131, 227, 15, 140, 192, 102, 193, 239, 4, 3, 199, 80, 7, +232, 116, 255, 102, 97, 144, 31, 7, 195, 103, 3, 64, 20, 103, 102, 131, + 56, 255, 15, 132, 76, 0, 103, 102, 57, 24, 15, 133, 51, 0, 102, 11, +201, 15, 133, 10, 0, 103, 128, 120, 9, 0, 15, 133, 35, 0, 195, 103, + 58, 72, 9, 15, 133, 26, 0, 102, 139, 240, 103, 3, 112, 10, 232, 61, + 5, 102, 81, 30, 7, 102, 139, 250, 243, 167, 102, 89, 15, 133, 1, 0, +195, 103, 102, 131, 120, 4, 0, 15, 132, 7, 0, 103, 102, 3, 64, 4, +235, 171, 102, 43, 192, 195, 102, 139, 243, 232, 18, 5, 103, 102, 3, 0, +103, 247, 64, 12, 2, 0, 15, 133, 52, 0, 103, 102, 141, 80, 16, 103, + 58, 74, 64, 15, 133, 24, 0, 103, 102, 141, 114, 66, 232, 239, 4, 102, + 81, 30, 7, 102, 139, 251, 243, 167, 102, 89, 15, 133, 1, 0, 195, 103, +131, 120, 8, 0, 15, 132, 6, 0, 103, 3, 64, 8, 235, 194, 102, 51, +192, 195, 103, 128, 123, 8, 0, 15, 133, 28, 0, 6, 30, 102, 96, 103, +102, 141, 83, 16, 103, 102, 139, 10, 102, 139, 243, 103, 3, 114, 4, 243, +164, 102, 97, 144, 31, 7, 195, 103, 102, 141, 83, 16, 103, 102, 139, 74, + 8, 102, 65, 102, 43, 192, 232, 1, 0, 195, 6, 30, 102, 96, 103, 128, +123, 8, 1, 15, 132, 3, 0, 233, 127, 251, 102, 131, 249, 0, 15, 133, + 6, 0, 102, 97, 144, 31, 7, 195, 102, 83, 102, 80, 102, 81, 102, 87, + 6, 232, 87, 3, 102, 139, 209, 7, 102, 95, 102, 89, 102, 59, 202, 15, +141, 3, 0, 102, 139, 209, 232, 171, 254, 102, 43, 202, 102, 139, 218, 102, +139, 194, 102, 15, 182, 22, 13, 0, 102, 247, 226, 102, 15, 183, 22, 11, + 0, 102, 247, 226, 102, 3, 248, 102, 88, 102, 3, 195, 102, 91, 235, 170, + 6, 30, 102, 96, 103, 128, 123, 8, 1, 15, 132, 3, 0, 233, 25, 251, +102, 131, 249, 0, 15, 133, 6, 0, 102, 97, 144, 31, 7, 195, 102, 83, +102, 80, 102, 81, 102, 87, 6, 102, 81, 102, 51, 210, 102, 15, 182, 14, + 13, 0, 102, 247, 241, 102, 82, 232, 225, 2, 102, 15, 182, 30, 13, 0, +102, 247, 227, 102, 90, 102, 3, 194, 102, 80, 102, 15, 182, 6, 13, 0, +102, 247, 225, 102, 139, 208, 102, 88, 102, 89, 7, 102, 95, 102, 89, 102, + 59, 202, 15, 141, 3, 0, 102, 139, 209, 102, 163, 84, 0, 137, 22, 91, + 0, 6, 30, 102, 96, 139, 223, 131, 227, 15, 140, 192, 102, 193, 239, 4, + 3, 199, 80, 7, 232, 160, 253, 102, 97, 144, 31, 7, 102, 43, 202, 102, +139, 218, 102, 139, 194, 102, 15, 183, 22, 11, 0, 102, 247, 226, 102, 3, +248, 102, 88, 102, 3, 195, 102, 91, 233, 101, 255, 6, 30, 102, 96, 38, +103, 102, 15, 183, 95, 4, 38, 103, 102, 15, 183, 79, 6, 102, 11, 201, + 15, 132, 101, 250, 102, 3, 223, 102, 131, 195, 2, 102, 129, 199, 254, 1, + 0, 0, 102, 73, 102, 11, 201, 15, 132, 23, 0, 38, 103, 139, 3, 38, +103, 137, 7, 102, 131, 195, 2, 102, 129, 199, 0, 2, 0, 0, 102, 73, +235, 226, 102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 184, 1, 0, + 0, 0, 102, 163, 30, 2, 102, 161, 26, 2, 102, 3, 6, 82, 2, 102, +163, 74, 2, 102, 161, 48, 0, 102, 15, 182, 30, 13, 0, 102, 247, 227, +102, 163, 84, 0, 102, 161, 86, 2, 163, 91, 0, 102, 139, 30, 26, 2, + 30, 7, 232, 242, 252, 102, 15, 183, 251, 232, 111, 255, 102, 161, 26, 2, +102, 187, 32, 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, + 0, 0, 232, 100, 253, 102, 11, 192, 15, 132, 87, 0, 102, 139, 216, 30, + 7, 102, 139, 62, 22, 2, 232, 249, 253, 102, 139, 30, 22, 2, 103, 102, +129, 59, 128, 0, 0, 0, 15, 132, 6, 0, 103, 3, 91, 4, 235, 238, +103, 102, 129, 59, 128, 0, 0, 0, 15, 133, 39, 0, 102, 83, 103, 102, +139, 67, 16, 102, 139, 62, 74, 2, 30, 7, 232, 9, 1, 102, 91, 102, +161, 82, 2, 102, 1, 6, 74, 2, 102, 255, 6, 30, 2, 103, 3, 91, + 4, 235, 205, 102, 97, 144, 31, 7, 195, 102, 139, 208, 102, 139, 14, 30, + 2, 102, 161, 26, 2, 102, 82, 102, 80, 102, 81, 102, 82, 102, 187, 128, + 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, +215, 252, 102, 11, 192, 15, 132, 64, 249, 102, 139, 216, 102, 88, 232, 42, + 1, 102, 11, 192, 15, 132, 7, 0, 102, 91, 102, 91, 102, 91, 195, 102, + 89, 102, 88, 102, 90, 102, 3, 6, 82, 2, 226, 185, 102, 51, 192, 195, + 6, 30, 102, 96, 102, 80, 102, 81, 102, 51, 210, 102, 15, 182, 30, 13, + 0, 102, 247, 243, 102, 82, 232, 144, 255, 102, 11, 192, 15, 132, 249, 248, +102, 15, 182, 30, 13, 0, 102, 247, 227, 102, 90, 102, 3, 194, 102, 163, + 84, 0, 102, 89, 102, 15, 182, 30, 13, 0, 102, 59, 203, 15, 142, 19, + 0, 137, 30, 91, 0, 102, 43, 203, 102, 88, 102, 3, 195, 102, 80, 102, + 81, 235, 20, 144, 102, 88, 102, 3, 193, 102, 80, 137, 14, 91, 0, 102, +185, 0, 0, 0, 0, 102, 81, 6, 102, 87, 139, 223, 131, 227, 15, 140, +192, 102, 193, 239, 4, 3, 199, 80, 7, 232, 155, 251, 102, 95, 7, 102, + 3, 62, 78, 2, 102, 89, 102, 88, 102, 131, 249, 0, 15, 143, 116, 255, +102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 247, 38, 86, 2, 102, +139, 14, 86, 2, 232, 89, 255, 232, 241, 253, 102, 97, 144, 31, 7, 195, + 6, 30, 102, 96, 102, 247, 38, 98, 2, 102, 139, 30, 50, 2, 102, 139, + 14, 98, 2, 30, 7, 102, 139, 62, 66, 2, 232, 35, 253, 232, 203, 253, +102, 97, 144, 31, 7, 195, 102, 80, 102, 83, 102, 81, 102, 139, 30, 70, + 2, 102, 139, 200, 102, 193, 232, 3, 102, 131, 225, 7, 102, 3, 216, 102, +184, 1, 0, 0, 0, 102, 211, 224, 103, 132, 3, 15, 132, 4, 0, 248, +235, 2, 144, 249, 102, 89, 102, 91, 102, 88, 195, 103, 128, 123, 8, 1, + 15, 132, 4, 0, 102, 43, 192, 195, 103, 102, 141, 115, 16, 103, 102, 139, + 86, 8, 102, 59, 194, 15, 135, 11, 0, 103, 102, 139, 22, 102, 59, 194, + 15, 131, 4, 0, 102, 43, 192, 195, 103, 3, 94, 16, 102, 43, 246, 103, +128, 59, 0, 15, 132, 62, 0, 232, 129, 0, 102, 3, 241, 232, 57, 0, +102, 3, 202, 102, 59, 193, 15, 140, 33, 0, 102, 139, 209, 102, 80, 103, +102, 15, 182, 11, 102, 139, 193, 102, 131, 224, 15, 102, 193, 233, 4, 102, + 3, 217, 102, 3, 216, 102, 67, 102, 88, 235, 196, 102, 43, 200, 102, 43, +194, 102, 3, 198, 195, 102, 43, 192, 195, 102, 43, 201, 103, 138, 11, 128, +225, 15, 102, 131, 249, 0, 15, 133, 4, 0, 102, 43, 201, 195, 102, 83, +102, 82, 102, 3, 217, 103, 102, 15, 190, 19, 102, 73, 102, 75, 102, 131, +249, 0, 15, 132, 13, 0, 102, 193, 226, 8, 103, 138, 19, 102, 75, 102, + 73, 235, 235, 102, 139, 202, 102, 90, 102, 91, 195, 102, 83, 102, 82, 102, + 43, 210, 103, 138, 19, 102, 131, 226, 15, 102, 43, 201, 103, 138, 11, 192, +233, 4, 102, 131, 249, 0, 15, 133, 8, 0, 102, 43, 201, 102, 90, 102, + 91, 195, 102, 3, 218, 102, 3, 217, 103, 102, 15, 190, 19, 102, 73, 102, + 75, 102, 131, 249, 0, 15, 132, 13, 0, 102, 193, 226, 8, 103, 138, 19, +102, 75, 102, 73, 235, 235, 102, 139, 202, 102, 90, 102, 91, 195, 102, 11, +201, 15, 133, 1, 0, 195, 102, 81, 102, 86, 103, 131, 62, 97, 15, 140, + 12, 0, 103, 131, 62, 122, 15, 143, 4, 0, 103, 131, 46, 32, 102, 131, +198, 2, 226, 230, 102, 94, 102, 89, 195, 102, 80, 102, 81, 102, 139, 208, +102, 161, 46, 2, 103, 102, 141, 88, 16, 103, 3, 67, 4, 103, 102, 141, + 64, 16, 102, 139, 218, 232, 158, 250, 102, 11, 192, 15, 132, 5, 0, 102, + 89, 102, 89, 195, 102, 161, 50, 2, 102, 11, 192, 15, 133, 8, 0, 102, + 89, 102, 89, 102, 51, 192, 195, 102, 139, 22, 50, 2, 103, 102, 141, 82, + 16, 103, 102, 139, 66, 8, 102, 64, 102, 139, 30, 78, 2, 102, 247, 227, +102, 51, 210, 102, 247, 54, 90, 2, 102, 80, 102, 88, 102, 11, 192, 15, +132, 48, 0, 102, 72, 102, 80, 232, 28, 254, 114, 238, 232, 241, 253, 102, + 90, 102, 89, 102, 91, 102, 83, 102, 81, 102, 82, 102, 161, 66, 2, 103, +102, 141, 64, 24, 232, 47, 250, 102, 11, 192, 116, 206, 102, 89, 102, 89, +102, 89, 195, 102, 89, 102, 89, 102, 51, 192, 195, 6, 30, 102, 96, 102, +139, 54, 66, 2, 102, 185, 32, 0, 0, 0, 102, 247, 193, 3, 0, 0, + 0, 15, 133, 3, 0, 232, 13, 0, 102, 173, 232, 105, 0, 226, 235, 102, + 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 51, 192, 102, 51, 219, 176, + 13, 180, 14, 187, 7, 0, 205, 16, 176, 10, 180, 14, 187, 7, 0, 205, + 16, 102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 11, 201, 15, 133, + 9, 0, 232, 208, 255, 102, 97, 144, 31, 7, 195, 102, 51, 192, 102, 51, +219, 173, 180, 14, 187, 7, 0, 205, 16, 226, 240, 232, 183, 255, 102, 97, +144, 31, 7, 195, 96, 172, 60, 0, 116, 9, 180, 14, 187, 7, 0, 205, + 16, 235, 242, 97, 144, 195, 6, 30, 102, 96, 102, 185, 8, 0, 0, 0, +102, 139, 208, 102, 131, 226, 15, 102, 82, 102, 193, 232, 4, 226, 241, 102, +185, 8, 0, 0, 0, 102, 88, 102, 131, 248, 9, 15, 143, 7, 0, 102, +131, 192, 48, 235, 9, 144, 102, 131, 232, 10, 102, 131, 192, 65, 102, 51, +219, 180, 14, 187, 7, 0, 205, 16, 226, 219, 176, 32, 180, 14, 187, 7, + 0, 205, 16, 102, 97, 144, 31, 7, 232, 96, 0, 195, 6, 30, 102, 96, +102, 190, 22, 13, 0, 0, 232, 79, 245, 102, 97, 144, 31, 7, 195, 6, + 30, 102, 96, 102, 190, 38, 13, 0, 0, 232, 60, 245, 102, 97, 144, 31, + 7, 195, 6, 30, 102, 96, 102, 190, 54, 13, 0, 0, 232, 41, 245, 102, + 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 190, 70, 13, 0, 0, 232, + 22, 245, 102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 190, 86, 13, + 0, 0, 232, 3, 245, 102, 97, 144, 31, 7, 195, 102, 80, 102, 184, 0, + 0, 245, 255, 102, 64, 102, 11, 192, 117, 249, 102, 88, 195, 102, 81, 102, + 80, 102, 184, 5, 0, 0, 0, 30, 7, 102, 139, 249, 232, 71, 252, 102, +139, 193, 102, 91, 102, 83, 102, 15, 183, 14, 12, 2, 102, 186, 14, 2, + 0, 0, 232, 68, 248, 102, 91, 102, 89, 102, 11, 192, 15, 133, 47, 0, +102, 139, 193, 102, 139, 203, 102, 80, 102, 83, 232, 35, 0, 102, 91, 102, + 95, 102, 11, 192, 15, 132, 23, 0, 30, 7, 232, 9, 252, 102, 139, 199, +102, 15, 183, 14, 12, 2, 102, 186, 14, 2, 0, 0, 232, 10, 248, 195, +102, 81, 102, 187, 32, 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, + 0, 0, 0, 0, 232, 242, 247, 102, 11, 192, 15, 132, 82, 0, 102, 139, +216, 30, 7, 102, 139, 62, 22, 2, 232, 135, 248, 30, 7, 102, 139, 30, + 22, 2, 102, 89, 38, 102, 57, 15, 15, 132, 46, 0, 38, 102, 131, 63, +255, 15, 132, 45, 0, 38, 131, 127, 4, 0, 15, 132, 36, 0, 38, 102, + 15, 183, 71, 4, 3, 216, 139, 195, 37, 0, 128, 116, 215, 140, 192, 5, + 0, 8, 142, 192, 129, 227, 255, 127, 235, 202, 38, 102, 139, 71, 16, 195, +102, 89, 102, 51, 192, 195, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, +116, 32, 48, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, +116, 32, 49, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, +116, 32, 50, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, +116, 32, 51, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, +116, 32, 52, 13, 10 }; + From 1c83be791ed75e468c9ffd812647ff506425f710 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0022/2994] It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/02 00:30:25-00:00 !antona Had to change symbolic links to files to get cvs to accept them. (Logical change 1.5) --- config.guess | 1371 ++++++++++++++++++++++++++++++++++++++++++++++++++ config.sub | 1362 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2733 insertions(+) diff --git a/config.guess b/config.guess index e69de29b..ba661651 100755 --- a/config.guess +++ b/config.guess @@ -0,0 +1,1371 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-04-20' + +# This file 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 of the License, 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break + fi + done + rm -f $dummy.c $dummy.o $dummy.rel + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + cat >$dummy.c < /* for printf() prototype */ +int main (int argc, char *argv[]) { +#else +int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __MIPSEB__ + printf ("%s-unknown-linux-gnu\n", argv[1]); +#endif +#ifdef __MIPSEL__ + printf ("%sel-unknown-linux-gnu\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + ;; + ppc:Linux:*:*) + # Determine Lib Version + cat >$dummy.c < +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif +main(argc, argv) + int argc; + char *argv[]; +{ +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unknown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then LIBC="libc1" ; fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 ;; + alpha:Linux:*:*) + cat <$dummy.s + .data + \$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + .text + .globl main + .align 4 + .ent main + main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + LIBC="" + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) UNAME_MACHINE="alpha" ;; + 1-0) UNAME_MACHINE="alphaev5" ;; + 1-1) UNAME_MACHINE="alphaev56" ;; + 1-101) UNAME_MACHINE="alphapca56" ;; + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) UNAME_MACHINE="alphaev67" ;; + esac + objdump --private-headers $dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_emulations=`cd /; ld --help 2>&1 \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + i*86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 + ;; + elf_i*86) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + i*86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 + ;; + esac + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + case "${UNAME_MACHINE}" in + i*86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i*86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:7*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +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` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.sub b/config.sub index e69de29b..a06a480a 100755 --- a/config.sub +++ b/config.sub @@ -0,0 +1,1362 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-04-20' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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 of the License, 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ + | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ + | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | sh[34] \ + | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp10 | pdp11 \ + | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \ + | v850 | c4x \ + | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ + | pj | pjl | h8500) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ + | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ + | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ + | [cjt]90-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ + | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [cjt]90) + basic_machine=${basic_machine}-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4) + basic_machine=sh-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: From 44151c5f55938f4b171297f4467221e2ac92e47f Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0023/2994] It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/03 02:03:35-00:00 !antona More files. (Logical change 1.5) --- acconfig.h | 1 + 1 file changed, 1 insertion(+) diff --git a/acconfig.h b/acconfig.h index e69de29b..8b137891 100644 --- a/acconfig.h +++ b/acconfig.h @@ -0,0 +1 @@ + From 000cb71a759452c7511019a9b1e48e7720004588 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0024/2994] Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/01 02:07:23-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/02 00:30:25-00:00 !antona Had to change symbolic links to files to get cvs to accept them. (Logical change 1.5) --- ltmain.sh | 4946 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 4946 insertions(+) diff --git a/ltmain.sh b/ltmain.sh index e69de29b..2393e14d 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -0,0 +1,4946 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# 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 of the License, 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case $nonopt in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + prev= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + + case $arg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + # Accept any command-line options. + case $arg in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + case $user_target in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case $user_target in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + else + # Don't build PIC code + command="$base_compile $srcfile" + fi + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if (test -z "$pic_flag" || test "$pic_mode" != default) && + test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $srcfile" + else + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link | relink) + modename="$modename: link" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args="$nonopt" + compile_command="$nonopt" + finalize_command="$nonopt" + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -all-static | -static) + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n $prev + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + libs="$libs $deplib" + done + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit 1 + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode" = prog; then + # Determine which files to process + case $pass in + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -l*) + if test "$linkmode" = oldlib && test "$linkmode" = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + continue + fi + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + if test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: This library needs some functionality provided by $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + else + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test $found = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then + # Add dl[pre]opened files of deplib + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit 1 + fi + continue + fi # $pass = conv + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. + dlprefiles="$dlprefiles $lib" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" + fi + continue + fi + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test $linkalldeplibs = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + + if test "$linkmode,$pass" = "prog,link" || + { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + if test "$linkmode" = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`echo $soroot | sed -e 's/^.*\///'` + newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n $old_archive_from_expsyms_cmds + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + # Try to link the static library + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + echo "*** Warning: This library needs some functionality provided by $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** Therefore, libtool will create a static module, that should work " + echo "*** as long as the dlopening application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || test $build_old_libs = yes || + test $link_static = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="-L$absdir/$objdir" + else + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="-L$absdir" + fi + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + test "$pass" != scan && dependency_libs="$newdependency_libs" + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + *) + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit 1 + else + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case $current in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $revision in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $age in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test $age -gt $current; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix) + major=`expr $current - $age + 1` + verstring="sgi$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="sgi$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs. + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` + deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test $hardcode_into_libs != yes || test $build_old_libs = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + if eval echo \"$potent_lib\" 2>/dev/null \ + | sed 10q \ + | egrep "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test $allow_undefined = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + test -z "$dlname" && dlname=$soname + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit 0 + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + prog) + case $host in + *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{\ +" + + sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ + -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ + < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr_t) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test $need_relink = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit 0 + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="cd `pwd`; $relink_command" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case $0 in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) exeext=.exe ;; + *) exeext= ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if (eval \$relink_command); then : + else + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test $need_relink = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test $# -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + continue + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test $# -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + case $install_prog,$host in + /usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`echo $destfile | sed -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec $SHELL $0 --finish$current_libdirs + exit 1 + fi + + exit 0 + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = ":" && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now actually exec the command. + eval "exec \$cmd$args" + + $echo "$modename: cannot exec \$cmd$args" + exit 1 + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + rmdirs= + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$objdir" + else + objdir="$dir/$objdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test $mode = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test $mode = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test $mode = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test $? != 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test $? != 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + fi + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + ;; + + *) + # Do a test to see if this is a libtool program. + if test $mode = clean && + (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file + + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 +fi # test -z "$show_help" + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: From 57bffbc373023766cdbf880a2c6248e7b3c17aef Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0025/2994] More files. (Logical change 1.5) --- autogen.sh | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/autogen.sh b/autogen.sh index e69de29b..a0e59514 100755 --- a/autogen.sh +++ b/autogen.sh @@ -0,0 +1,117 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +DIE=0 + +if test x$srcdir = x; then + srcdir=. +fi + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`autoconf' installed to compile Linux-NTFS." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && { + (libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`libtool' installed to compile Linux-NTFS." + echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`automake' installed to compile Linux-NTFS." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + NO_AUTOMAKE=yes +} + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing \`aclocal'. The version of \`automake'" + echo "installed doesn't appear recent enough." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +if test -z "$*"; then + echo "**Warning**: I am going to run \`configure' with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo \`$0\'" command line." + echo +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + +for coin in `find $srcdir -name configure.in -print` +do + dr=`dirname $coin` + if test -f $dr/NO-AUTO-GEN; then + echo skipping $dr -- flagged as no auto-gen + else + echo processing $dr + macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin` + ( cd $dr + macrosdir=`find . -name macros -print` + aclocalinclude="$ACLOCAL_FLAGS" + for k in $macrodirs; do + if test -d $k; then + aclocalinclude="$aclocalinclude -I $k" + fi + done + if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then + if test -z "$NO_LIBTOOLIZE" ; then + echo "Running libtoolize..." + libtoolize --force --copy + fi + fi + echo "Running aclocal $aclocalinclude ..." + aclocal $aclocalinclude || { + echo + echo "**Error**: aclocal failed. This may mean that you have not" + echo "installed all of the packages you need, or you may need to" + echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" + echo "for the prefix where you installed the packages whose" + echo "macros were not found" + exit 1 + } + + if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then + echo "Running autoheader..." + autoheader || { echo "**Error**: autoheader failed."; exit 1; } + fi + echo "Running automake --gnu $am_opt ..." + automake --add-missing --gnu $am_opt || + { echo "**Error**: automake failed."; exit 1; } + echo "Running autoconf ..." + autoconf || { echo "**Error**: autoconf failed."; exit 1; } + ) || exit 1 + fi +done + +conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c + +if test x$NOCONFIGURE = x; then + echo Running $srcdir/configure $conf_flags "$@" ... + $srcdir/configure $conf_flags "$@" \ + && echo Now type \`make\' to compile $PKG_NAME || exit 1 +else + echo Skipping configure process. +fi From b4f400cb6eef4accddf81fb735d2663399a1a07c Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0026/2994] More files. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- stamp-h.in | 1 + 1 file changed, 1 insertion(+) diff --git a/stamp-h.in b/stamp-h.in index e69de29b..9788f702 100644 --- a/stamp-h.in +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp From 603cbf0b79c477cf45bb94c3af4c82b6530ddad8 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0027/2994] More header development. AttrDef description. (Logical change 1.5) --- doc/attribute_definitions | 129 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) diff --git a/doc/attribute_definitions b/doc/attribute_definitions index e69de29b..5cad62a9 100644 --- a/doc/attribute_definitions +++ b/doc/attribute_definitions @@ -0,0 +1,129 @@ +/* All values are as in Windows NT4 SP6a. */ + +__u16 name[64] = "$STANDARD_INFORMATION" +__u32 type = 0x10 +__u32 unknown[2] = 0, 0 +__u32 flags = 0x40 +__u64 min_size = 0x30 +__u64 max_size = 0x30, in Win2k: 0x48 + +__u16 name[64] = "$ATTRIBUTE_LIST" +__u32 type = 0x20 +__u32 unknown[2] = 0, 0 +__u32 flags = 0x80 +__u64 min_size = 0 +__u64 max_size = -1 + +__u16 name[64] = "$FILE_NAME" +__u32 type = 0x30 +__u32 unknown[2] = 0, 0 +__u32 flags = 0x42 +__u64 min_size = 0x44 +__u64 max_size = 0x242 + +/* The $volume_version attribute has never been observed in the field. It + * probably never was used and was hence replaced by the $object_id in + * Windows 2000. */ +__u16 name[64] = "$VOLUME_VERSION" in Win2k: "$OBJECT_ID" +__u32 type = 0x40 +__u32 unknown[2] = 0, 0 +__u32 flags = 0x40 +__u64 min_size = 0x8 in Win2k: 0 +__u64 max_size = 0x8 in Win2k: 0x100 + +__u16 name[64] = "$SECURITY_DESCRIPTOR" +__u32 type = 0x50 +__u32 unknown[2] = 0, 0 +__u32 flags = 0x80 +__u64 min_size = 0 +__u64 max_size = -1 + +__u16 name[64] = "$VOLUME_NAME" +__u32 type = 0x60 +__u32 unknown[2] = 0,0 +__u32 flags = 0x40 +__u64 min_size = 0x2 +__u64 max_size = 0x100 + +__u16 name[64] = "$VOLUME_INFORMATION" +__u32 type = 0x70 +__u32 unknown[2] = 0, 0 +__u32 flags = 0x40 +__u64 min_size = 0xc +__u64 max_size = 0xc + +__u16 name[64] = "$DATA" +__u32 type = 0x80 +__u32 unknown[2] = 0, 0 +__u32 flags = 0 +__u64 min_size = 0 +__u64 max_size = -1 + +__u16 name[64] = "$INDEX_ROOT" +__u32 type = 0x90 +__u32 unknown[2] = 0, 0 +__u32 flags = 0x40 +__u64 min_size = 0 +__u64 max_size = -1 + +__u16 name[64] = "$INDEX_ALLOCATION" +__u32 type = 0xa0 +__u32 unknown[2] = 0,0 +__u32 flags = 0x80 +__u64 min_size = 0 +__u64 max_size = -1 + +__u16 name[64] = "$BITMAP" +__u32 type = 0xb0 +__u32 unknown[2] = 0, 0 +__u32 flags = 0x80 +__u64 min_size = 0 +__u64 max_size = -1 + +/* The $symbolic_link attribute has never been observed in the field. It + * probably never was used and was hence replaced by the $reparse_point in + * Windows 2000. */ +__u16 name[64] = "$SYMBOLIC_LINK" in Win2k: "$REPARSE_POINT" +__u32 type = 0xc0 +__u32 unknown[2] = 0, 0 +__u32 flags = 0x80 +__u64 min_size = 0 +__u64 max_size = -1 in Win2k: 0x4000 + +__u16 name[64] = "$EA_INFORMATION" +__u32 type = 0xd0 +__u32 unknown[2] = 0, 0 +__u32 flags = 0x40 +__u64 min_size = 0x8 +__u64 max_size = 0x8 + +__u16 name[64] = "$EA" +__u32 type = 0xe0 +__u32 unknown[2] = 0, 0 +__u32 flags = 0 +__u64 min_size = 0 +__u64 max_size = 0x10000 + +/* + * Sequence terminates here with a record all of whose fields are zero, even + * though the size of the $AttrDef data attribute is much larger (36000 bytes, + * i.e. in theory 225 attribute definitions of 160 bytes each but in practice + * only until we reach an all zero record). + * + * The following only applies to Windows 2000 and replaces the above comment. + */ + +__u16 name[64] = "$LOGGED_UTILITY_STREAM" +__u32 type = 0x100 +__u32 unknown[2] = 0, 0 +__u32 flags = 0x80 +__u64 min_size = 0 +__u64 max_size = 0x10000 + +/* + * This is terminated by a single record all of whose fields are zero. This + * also finishes the $AttrDef data attribute. I.e. the attribute size is the + * correct size of the sequence of attribute definitions (2560 bytes, i.e. + * 16 attribute definitions of 160 bytes each). + */ + From 06f77e49caa39d7691033dbe980085163320d5dc Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0028/2994] Update 2002/05/08 06:03:45-00:00 !mattjf added ntfsinfo man page (Logical change 1.5) --- ntfstools/ntfsinfo.8.in | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ntfstools/ntfsinfo.8.in b/ntfstools/ntfsinfo.8.in index e69de29b..edec6976 100644 --- a/ntfstools/ntfsinfo.8.in +++ b/ntfstools/ntfsinfo.8.in @@ -0,0 +1,25 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSINFO 8 "May 2002" "Linux-NTFS version @VERSION@" +.SH NAME +ntfsinfo \- dump a file's attributes +.SH SYNOPSIS +.B ntfsinfo +.I device +.I inode-number +.SH DESCRIPTION +.B ntfsinfo +will dump the attributes of inode +.IR inode-number . +.PP +.SH AUTHOR +.B ntfsinfo +was written by Matthew J. Fanto (fanto1mj@cmich.edu). +.SH AVAILABILITY +.B ntfsinfo +is part of the linux-ntfs package and is available from +http://linux-ntfs.sourceforge.net/. + + From 98d7cd1cd35d22009d43deb65ddebcbdca1db205 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0029/2994] Update build system with new document. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/02 01:28:46-00:00 !antona make dist fixes using more Makefiles. (Logical change 1.5) --- doc/Makefile.am | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/Makefile.am b/doc/Makefile.am index e69de29b..e7f51f0d 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -0,0 +1,11 @@ +EXTRA_DIST = \ + CodingStyle \ + attribute_definitions \ + attributes.txt \ + compression.txt \ + template.c \ + template.h \ + tunable_settings \ + system_files.txt \ + system_security_descriptors.txt + From 1521ab799fc32387aa4866418dc7c5e10d6762cd Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0030/2994] Update todo file. 2002/07/06 20:22:57-00:00 !antona Typo fix 2002/06/08 14:33:09-00:00 !antona Few odds and ends. 2002/06/07 01:16:20-00:00 !antona Updates 2002/06/05 20:32:53-00:00 !antona Mft mirror now updated from ntfs_write_mft_record, yey! Fixup ntfstools accordingly. 2002/06/01 00:41:45-00:00 !antona huge update! 2002/05/19 18:37:27-00:00 !antona Commit the change log and current todo file so people have a glimpse of what I am upto... 2002/05/08 22:30:29-00:00 !antona Config file updates, add missing TODO.ntfsinfo 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/19 21:48:31-00:00 !antona Add a TODO list for the library in form of my personal roadmap. People can use that to pick things to work on if they want... (Logical change 1.5) --- TODO.libntfs | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/TODO.libntfs b/TODO.libntfs index e69de29b..908218d1 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -0,0 +1,63 @@ +***************** +* HIGH priority * +***************** + +- add read of compressed attributes + +******************* +* MEDIUM priority * +******************* + +- create API reference book template (cf. linux kernel) +- enable automatic creation of API reference + +- add write of compressed attributes + +- write attribute resize function (see mkntfs) and implement ntfs_truncate* + +- write ntfs_{allocate,free}_cluster(s) (see ntfs 2.4 driver in CVS) + +- extend ntfs_attr_pwrite to cope with extending the attribute size and with + instantiating holes + +- write ntfs_{allocate,free}_mft_record (see ntfs 2.4 driver in CVS) + +- write ntfs_{rm,create,add}_attr() + +- write ntfs_{rm_from,add_to,create,rm}_index() + +- write ntfs_file_name_{add,rm}_from_mft_record() or _from_ntfs_inode(?) + +- write ntfs_unlink_file() + +- write ntfs_create_file() + +- write API for conventional high level file access. + +- implement loads of utilities a-la ntcp, ntrm, ntcreat, ntdir, etc... + +- implement a ntfs shell where can use the above much faster with caching, + probably extending the library in the process + +- extend attrib API with ntfs_rl_pread() + +**************** +* LOW priority * +**************** + +- Do we attach attributes (ntfs_attr) to the corresponding ntfs_inode? Now we + just atach the inode to the attribute and expect the user to not shoot + themselves in the foot. + +- add read/set of various file attributes/flags to library + +- add ACL read/write support to library + +- add MS BackupAPI to library + +- add volume resizing support to library + +- add defrag API to library + +- write utilities for all of the above + From ce790756140b7d24f44d9f8ddd088daa093c2124 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0031/2994] Updates 2001/01/23 15:07:31-00:00 !antona Initial revision (Logical change 1.5) --- COPYING | 351 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 351 insertions(+) diff --git a/COPYING b/COPYING index e69de29b..49089056 100644 --- a/COPYING +++ b/COPYING @@ -0,0 +1,351 @@ + + NOTE: The GPL below is copyrighted by the Free Software Foundation, + but the instances of code that it refers to (the Linux-NTFS project, + including the NTFS library "libntfs", the NTFS utilities "ntfstools" + and the Linux kernel NTFS driver) are copyrighted by me and others + who actually wrote them. + + Anton Altaparmakov + +-------------------------------------------------------------------- + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 of the License, 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 + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. From e7450aab8af08adb8ee2a57d05cad3b2d715fae3 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0032/2994] Updates 2002/03/12 21:48:27-00:00 !antona Change version numbers of mkntfs and ntfsfix to match linux-ntfs release and add options to mkntfs to disable content indexing on the volume and to enable compression on the volume. 2001/11/09 21:30:52-00:00 !antona Considering added functionality change version number to 1.3.0, update docs and mkntfs man page. 2001/08/27 16:58:07-00:00 !antona Updates. 2001/07/25 13:43:10-00:00 !antona 1.0.2 release. Mkntfs now in sbin and minor bugfix to mkntfs man page. 2001/06/13 19:00:56-00:00 !antona More cleanups and man page final updates/polishing. 2001/06/11 04:02:09-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/10 18:30:17-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. (Logical change 1.5) --- ntfstools/mkntfs.8.in | 215 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) diff --git a/ntfstools/mkntfs.8.in b/ntfstools/mkntfs.8.in index e69de29b..1638fc4d 100644 --- a/ntfstools/mkntfs.8.in +++ b/ntfstools/mkntfs.8.in @@ -0,0 +1,215 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2001,2002 Anton Altaparmakov. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" Adapted from e2fsprogs-1.19/misc/mke2fs.8.in by Theodore Ts'o. +.\" +.TH MKNTFS 8 "March 2002" "Linux-NTFS version @VERSION@" +.SH NAME +mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system +.SH SYNOPSIS +.B mkntfs +[ +.B \-s +.I sector-size +] +[ +.B \-c +.I cluster-size +] +[ +.B \-L +.I volume-label +] +[ +.B \-z +.I mft-zone-multiplier +] +[ +.B \-f +| +.B \-Q +] +[ +.B -n +] +[ +.B \-q +] +[ +.B \-v +] +[ +.B \-vv +] +[ +.B \-C +] +[ +.B \-F +] +[ +.B \-I +] +[ +.B \-V +] +.I device +[ +.I number-of-sectors +] +.SH DESCRIPTION +.B mkntfs +is used to create a NTFS 1.2 (Windows NT 4.0) file system on a device (usually +a disk partition). +.I device +is the special file corresponding to the device (e.g +.IR /dev/hdXX ). +.I number-of-sectors +is the number of blocks on the device. If omitted, +.B mkntfs +automagically figures the file system size. +.SH OPTIONS +.TP +.BI \-s " sector-size" +Specify the size of sectors in bytes. Valid sector size values are 256, 512, +1024, 2048 and 4096 bytes per sector. If omitted, +.B mkntfs +.I sector-size +is determined automatically and if that fails a default of 512 +bytes per sector is used. +.TP +.BI \-c " cluster-size" +Specify the size of clusters in bytes. Valid cluster size values are powers of +two, with at least 256, and at most 65536 bytes per cluster. If omitted, +.B mkntfs +.I cluster-size +is determined by the volume size. The value is determined as +follows: +.br +.B \tVolume size\tDefault cluster size (in bytes) +.br + \<= 512MB 512 +.br + \]512MB-1GB\] 1024 +.br + \]1GB-2GB\] 2048 +.br + \> 2GB 4096 +.br +Note that the default cluster size is set to be at least equal to the sector +size as a cluster cannot be smaller than a sector. Also, note that values +greater than 4096 have the side effect that compression is disabled on the +volume (due to limitations in the NTFS compression algorithm currently in use +by Windows). +.TP +.BI \-L " volume-label" +Set the volume label for the filesystem. +.TP +.BI \-z " mft-zone-multiplier" +Set the MFT zone multiplier, which determines the size of the MFT zone to use +on the volume. The MFT zone is the area at the beginning of the volume reserved +for the master file table (MFT), which stores the on disk inodes (MFT records). +It is noteworthy that small files are stored entirely within the inode; +thus, if you expect to use the volume for storing large numbers of very small +files, it is useful to set the zone multiplier to a higher value. Note, that +the MFT zone is resized on the fly as required during operation of the NTFS +driver but choosing a good value will reduce fragmentation. Valid values +are 1, 2, 3 and 4. The values have the following meaning: +.br +.B \tMFT zone\t\tMFT zone size +.br +.B \tmultiplier\t(in % of volume size) +.br + 1 12.5% (default) +.br + 2 25% +.br + 3 37.5% +.br + 4 50% +.TP +.B \-f +Same as +.BR \-Q . +.TP +.B \-Q +Perform quick format. This will skip both zeroing of the volume and bad sector +checking. +.TP +.B \-n +Causes +.B mkntfs +to not actually create a filesystem, but display what it would do if it were +to create a filesystem. All steps of the format are carried out except the +actual writing to the device. +.TP +.B \-q +Quiet execution; only errors are written to stderr, no output to stdout +occurs at all. Useful if +.B mkntfs +is run in a script. +.TP +.B \-v +Verbose execution. +.TP +.B \-vv +Really verbose execution; includes the verbose output from the +.B \-v +option as well as additional output useful for debugging +.B mkntfs. +.TP +.B \-C +Enable compression on the volume. +.TP +.B \-F +Force +.B mkntfs +to run, even if the specified +.I device +is not a block special device, or appears to be mounted. +.TP +.B \-I +Disable content indexing on the volume. (This is only meaningful on +Windows 2000 and later. Windows NT 4.0 and earlier ignore this as they do +not implement content indexing at all.) +.TP +.B \-V +Print the version number of +.B mkntfs +and exit. +.SH AUTHOR +This version of +.B mkntfs +has been written by Anton Altaparmakov (if that fails, use +). +.SH BUGS +.B mkntfs +writes the backup boot sector to the last sector of the block +.I device +being formatted. However, current versions of the Linux kernel (all versions +up to and including todays 2.4.18) either only report an even number of sectors +when the sector size is below 1024 bytes, which is the case for most hard +drives today (512 bytes sector size) or they return the correct number but +accessing the last sector fails. Either way, this means that when a partition +has an odd number of 512-byte sectors, the last sector is either not reported +to us at all or it is not writable by us and hence the created NTFS volume +will either have the backup boot sector placed one sector ahead of where it +should be or it cannot be written at all. For this reason, +.B mkntfs +marks the NTFS volume dirty, so that when you reboot into Windows, check disk +runs automatically and creates a copy of the backup boot sector in the correct +location. This also has the benefit of catching any bugs in +.B mkntfs +as check disk would find any corrupt structures and repair them, as well as +report them. - If you do see any problems reported, please report the messages +to the author. +.br +There may be other bugs. Please, report them to the author. +.SH AVAILABILITY +.B mkntfs +is part of the Linux-NTFS project and is available for download from +http://sf.net/project/showfiles.php?group_id=13956 in source (tar ball and +rpm) and pre-compiled binary (i386 rpm and deb) form. +.SH SEE ALSO +.BR badblocks (8) + From 72a796dcc5f82e67c33740b53cb2abb16f6c6d00 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0033/2994] Updates 2002/05/06 14:14:07-00:00 !antona Update ntfslabel manpage 2002/04/12 15:25:04-00:00 !antona Add the manpage. (Logical change 1.5) --- ntfstools/ntfslabel.8.in | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/ntfstools/ntfslabel.8.in b/ntfstools/ntfslabel.8.in index e69de29b..4b9a05bb 100644 --- a/ntfstools/ntfslabel.8.in +++ b/ntfstools/ntfslabel.8.in @@ -0,0 +1,54 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" Adapted from e2fsprogs-1.26/misc/e2label.8.in by Theodore Ts'o. +.\" +.TH NTFSLABEL 8 "April 2002" "Linux-NTFS version @VERSION@" +.SH NAME +ntfslabel \- display/change the label on an ntfs file system +.SH SYNOPSIS +.B ntfslabel +.I device +[ +.I new-label +] +.SH DESCRIPTION +.B ntfslabel +will display or change the file system label on the ntfs file system located on +.IR device . +.PP +If the optional argument +.I new-label +is not present, +.B ntfslabel +will simply display the current file system label. +.PP +If the optional argument +.I new-label +is present, then +.B ntfslabel +will set the file system label to be +.IR new-label . +NTFS file system labels can be at most 128 Unicode characters long; if +.I new-label +is longer than 128 Unicode characters, +.B ntfslabel +will truncate it and print a warning message. +.PP +It is also possible to set the file system label using the +.B \-L +option of +.BR mkntfs (8) +during creation of the file system. +.PP +.SH AUTHOR +.B ntfslabel +was written by Matthew J. Fanto (fanto1mj@cmich.edu). This man page was written +by Anton Altaparmakov (aia21@cantab.net). +.SH AVAILABILITY +.B ntfslabel +is part of the linux-ntfs package and is available from +http://linux-ntfs.sourceforge.net/. +.SH SEE ALSO +.BR mkntfs (8) + From 6f714bdafe14d84f864a84729150ccbb04ef6356 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0034/2994] Updates 2002/07/02 23:47:11-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/04/15 20:04:31-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2001/06/10 02:25:38-00:00 !antona mkntfs alpha 3 ============== - Several bugfixes (root dir link count wasn't incremented, mftmirror usns weren't correct [off by one too high], etc). - Implement new $UpCase generation using flatcap (Richard Russon)'s algorithm for generating it. This dropped the stripped mkntfs executable from 204kb down to 78kb in size. A whopping 62% size decrease! Yey! And the source code dropped ny over 600kb in size as well. And compilation got quicker, too. 2001/06/01 02:07:26-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. (Logical change 1.5) --- ntfstools/upcase.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/ntfstools/upcase.c b/ntfstools/upcase.c index e69de29b..a184379a 100644 --- a/ntfstools/upcase.c +++ b/ntfstools/upcase.c @@ -0,0 +1,82 @@ +/* + * $Id$ + * + * Copyright (c) 2001 Richard Russon + * Copyright (c) 2001-2002 Anton Altaparmakov + * + * Modified for mkntfs inclusion 9 June 2001 by Anton Altaparmakov. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS source + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "types.h" + +void init_upcase_table(uchar_t *uc, u32 uc_len) +{ + static int uc_run_table[][3] = { /* Start, End, Add */ + {0x0061, 0x007B, -32}, {0x0451, 0x045D, -80}, {0x1F70, 0x1F72, 74}, + {0x00E0, 0x00F7, -32}, {0x045E, 0x0460, -80}, {0x1F72, 0x1F76, 86}, + {0x00F8, 0x00FF, -32}, {0x0561, 0x0587, -48}, {0x1F76, 0x1F78, 100}, + {0x0256, 0x0258, -205}, {0x1F00, 0x1F08, 8}, {0x1F78, 0x1F7A, 128}, + {0x028A, 0x028C, -217}, {0x1F10, 0x1F16, 8}, {0x1F7A, 0x1F7C, 112}, + {0x03AC, 0x03AD, -38}, {0x1F20, 0x1F28, 8}, {0x1F7C, 0x1F7E, 126}, + {0x03AD, 0x03B0, -37}, {0x1F30, 0x1F38, 8}, {0x1FB0, 0x1FB2, 8}, + {0x03B1, 0x03C2, -32}, {0x1F40, 0x1F46, 8}, {0x1FD0, 0x1FD2, 8}, + {0x03C2, 0x03C3, -31}, {0x1F51, 0x1F52, 8}, {0x1FE0, 0x1FE2, 8}, + {0x03C3, 0x03CC, -32}, {0x1F53, 0x1F54, 8}, {0x1FE5, 0x1FE6, 7}, + {0x03CC, 0x03CD, -64}, {0x1F55, 0x1F56, 8}, {0x2170, 0x2180, -16}, + {0x03CD, 0x03CF, -63}, {0x1F57, 0x1F58, 8}, {0x24D0, 0x24EA, -26}, + {0x0430, 0x0450, -32}, {0x1F60, 0x1F68, 8}, {0xFF41, 0xFF5B, -32}, + {0} + }; + static int uc_dup_table[][2] = { /* Start, End */ + {0x0100, 0x012F}, {0x01A0, 0x01A6}, {0x03E2, 0x03EF}, {0x04CB, 0x04CC}, + {0x0132, 0x0137}, {0x01B3, 0x01B7}, {0x0460, 0x0481}, {0x04D0, 0x04EB}, + {0x0139, 0x0149}, {0x01CD, 0x01DD}, {0x0490, 0x04BF}, {0x04EE, 0x04F5}, + {0x014A, 0x0178}, {0x01DE, 0x01EF}, {0x04BF, 0x04BF}, {0x04F8, 0x04F9}, + {0x0179, 0x017E}, {0x01F4, 0x01F5}, {0x04C1, 0x04C4}, {0x1E00, 0x1E95}, + {0x018B, 0x018B}, {0x01FA, 0x0218}, {0x04C7, 0x04C8}, {0x1EA0, 0x1EF9}, + {0} + }; + static int uc_byte_table[][2] = { /* Offset, Value */ + {0x00FF, 0x0178}, {0x01AD, 0x01AC}, {0x01F3, 0x01F1}, {0x0269, 0x0196}, + {0x0183, 0x0182}, {0x01B0, 0x01AF}, {0x0253, 0x0181}, {0x026F, 0x019C}, + {0x0185, 0x0184}, {0x01B9, 0x01B8}, {0x0254, 0x0186}, {0x0272, 0x019D}, + {0x0188, 0x0187}, {0x01BD, 0x01BC}, {0x0259, 0x018F}, {0x0275, 0x019F}, + {0x018C, 0x018B}, {0x01C6, 0x01C4}, {0x025B, 0x0190}, {0x0283, 0x01A9}, + {0x0192, 0x0191}, {0x01C9, 0x01C7}, {0x0260, 0x0193}, {0x0288, 0x01AE}, + {0x0199, 0x0198}, {0x01CC, 0x01CA}, {0x0263, 0x0194}, {0x0292, 0x01B7}, + {0x01A8, 0x01A7}, {0x01DD, 0x018E}, {0x0268, 0x0197}, + {0} + }; + int i, r; + + memset((char*)uc, 0, uc_len); + uc_len >>= 1; + for (i = 0; i < uc_len; i++) + uc[i] = i; + for (r = 0; uc_run_table[r][0]; r++) + for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) + uc[i] += uc_run_table[r][2]; + for (r = 0; uc_dup_table[r][0]; r++) + for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) + uc[i + 1]--; + for (r = 0; uc_byte_table[r][0]; r++) + uc[uc_byte_table[r][0]] = uc_byte_table[r][1]; +} + From c6a6056715488ef3660f6a9ab34aab50cddf929d Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0035/2994] and a final revert i forgot 2002/07/11 23:44:13-00:00 !flatcap new function headers and a few function moves 2002/07/11 16:20:32-00:00 !flatcap whitespace and include guards 2002/07/11 13:18:11-00:00 !flatcap start to break up the dependency loops in the header files 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/06 20:47:31-00:00 !antona The beginning of the directory operations! Introduce dir.[hc] and ntfs_lookup_inode_by_name(). 2002/06/01 00:41:45-00:00 !antona huge update! 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/19 21:21:46-00:00 !antona Remove compile time warning... 2002/04/19 21:09:55-00:00 !antona Finished provisional inode.c::ntfs_{open,close}_inode() functions. Also, started defining API provided by attrib.[ch], so far only done search context related stuff. 2002/04/19 18:27:45-00:00 !antona Bah. Typo fix. 2002/04/19 18:23:56-00:00 !antona Add foundation of new inode API. 2002/04/15 22:35:07-00:00 !antona Preliminary ntfs_inode structure. We shall see if that is all we need. (-; 2002/04/14 13:58:54-00:00 !antona Tidyup last cleanups (Logical change 1.5) --- include/inode.h | 111 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/include/inode.h b/include/inode.h index e69de29b..7f6f00c4 100644 --- a/include/inode.h +++ b/include/inode.h @@ -0,0 +1,111 @@ +/* + * $Id$ + * + * inode.h - Defines for NTFS inode handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2001,2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_INODE_H +#define _NTFS_INODE_H + +/* Forward declaration */ +typedef struct _ntfs_inode ntfs_inode; + +#include "types.h" +#include "support.h" +#include "runlist.h" + +/* + * Defined bits for the state field in the ntfs_inode structure. + * (f) = files only, (d) = directories only + */ +typedef enum { + NI_Dirty, /* 1: Mft record needs to be written to disk. */ + NI_AttrList, /* 1: Mft record contains an attribute list. */ + NI_AttrListNonResident, /* 1: Attribute list is non-resident. Implies + NI_AttrList is set. */ + NI_AttrListDirty, /* 1: Attribute list needs to be written to the + mft record and then to disk. */ +} ntfs_inode_state_bits; + +#define test_nino_flag(ni, flag) test_bit(NI_##flag, (ni)->state) +#define set_nino_flag(ni, flag) set_bit(NI_##flag, (ni)->state) +#define clear_nino_flag(ni, flag) clear_bit(NI_##flag, (ni)->state) + +#define NInoDirty(ni) test_nino_flag(ni, Dirty) +#define NInoSetDirty(ni) set_nino_flag(ni, Dirty) +#define NInoClearDirty(ni) clear_nino_flag(ni, Dirty) + +#define NInoAttrList(ni) test_nino_flag(ni, AttrList) +#define NInoSetAttrList(ni) set_nino_flag(ni, AttrList) +#define NInoClearAttrList(ni) clear_nino_flag(ni, AttrList) + +#define test_nino_al_flag(ni, flag) test_nino_flag(ni, AttrList##flag) +#define set_nino_al_flag(ni, flag) set_nino_flag(ni, AttrList##flag) +#define clear_nino_al_flag(ni, flag) clear_nino_flag(ni, AttrList##flag) + +#define NInoAttrListNonResident(ni) test_nino_al_flag(ni, NonResident) +#define NInoSetAttrListNonResident(ni) set_nino_al_flag(ni, NonResident) +#define NInoClearAttrListNonResident(ni) clear_nino_al_flag(ni, NonResident) + +#define NInoAttrListDirty(ni) test_nino_al_flag(ni, Dirty) +#define NInoAttrListSetDirty(ni) set_nino_al_flag(ni, Dirty) +#define NInoAttrListClearDirty(ni) clear_nino_al_flag(ni, Dirty) + +/* + * The NTFS in-memory inode structure. It is just used as an extension to the + * fields already provided in the VFS inode. + */ +struct _ntfs_inode { + u64 mft_no; /* Inode / mft record number. */ + MFT_RECORD *mrec; /* The actual mft record of the inode. */ + ntfs_volume *vol; /* Pointer to the ntfs volume of this inode. */ + unsigned long state; /* NTFS specific flags describing this inode. + See ntfs_inode_state_bits above. */ + /* + * Attribute list support (for use by the attribute lookup functions). + * Setup during ntfs_open_inode() for all inodes with attribute lists. + * Only valid if NI_AttrList is set in state, further attr_list_rl is + * only valid if NI_AttrListNonResident is set. + */ + u32 attr_list_size; /* Length of attribute list value in bytes. */ + u8 *attr_list; /* Attribute list value itself. */ + run_list *attr_list_rl; /* Run list for the attribute list value. */ + s32 nr_extents; /* For a base mft record, the number of + attached extent inodes (0 if none), for + extent records this is -1. */ + union { /* This union is only used if nr_extents != 0. */ + ntfs_inode **extent_nis;/* For nr_extents > 0, array of the + ntfs inodes of the extent mft + records belonging to this base + inode which have been loaded. */ + ntfs_inode *base_ni; /* For nr_extents == -1, the ntfs + inode of the base mft record. */ + }; +}; + +extern ntfs_inode *ntfs_open_inode(ntfs_volume *vol, const MFT_REF mref); + +extern int ntfs_close_inode(ntfs_inode *ni); + +extern ntfs_inode *ntfs_open_extent_inode(ntfs_inode *base_ni, + const MFT_REF mref); + +#endif /* defined _NTFS_INODE_H */ + From bc2abe3c3fc78219fe1758b43fc1e7220d945c53 Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0036/2994] grr. MDK8.1 modified loads of stuff. Put it back with RH7.2 2002/04/24 23:47:41-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/01/26 04:32:35-00:00 !antona RedHat 7.2 - updates 2001/11/17 01:57:53-00:00 !antona Update build system with new document. 2001/11/09 23:36:17-00:00 !antona Bug fixes 2001/11/09 19:24:23-00:00 !antona With lots of luck this is going to be 1.2.3. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/11 04:02:08-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/03 02:03:35-00:00 !antona More files. (Logical change 1.5) --- doc/Makefile.in | 208 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) diff --git a/doc/Makefile.in b/doc/Makefile.in index e69de29b..f403a2cf 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -0,0 +1,208 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +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 = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AS = @AS@ +AUTODIRS = @AUTODIRS@ +CC = @CC@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ + +EXTRA_DIST = \ + CodingStyle \ + attribute_definitions \ + attributes.txt \ + compression.txt \ + template.c \ + template.h \ + tunable_settings \ + system_files.txt \ + system_security_descriptors.txt + +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = doc + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu doc/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags distdir info-am info dvi-am dvi check check-am \ +installcheck-am installcheck 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 + + +# 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: From 06c55716fc184a34d8df26ee199a2acec3cc058a Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0037/2994] huge update! 2002/04/25 07:50:33-00:00 !antona grr. MDK8.1 modified loads of stuff. Put it back with RH7.2 2002/04/24 23:47:40-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/01/26 04:32:35-00:00 !antona RedHat 7.2 - updates 2001/11/17 01:57:53-00:00 !antona Update build system with new document. 2001/11/09 23:36:16-00:00 !antona Bug fixes 2001/11/09 19:24:23-00:00 !antona With lots of luck this is going to be 1.2.3. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/11 04:02:08-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/01 02:07:23-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- aclocal.m4 | 3652 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 3652 insertions(+) diff --git a/aclocal.m4 b/aclocal.m4 index e69de29b..e3c1a7db 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -0,0 +1,3652 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4-p5 + +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. + +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. + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN([AM_MISSING_PROG], +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +# Define a conditional. + +AC_DEFUN([AM_CONDITIONAL], +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN([AM_CONFIG_HEADER], +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- + +# serial 46 AC_PROG_LIBTOOL + +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +]) + +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 +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +_LT_AC_PROG_ECHO_BACKSLASH +# 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, :) + +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# 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 + +_LT_AC_LTCONFIG_HACK + +]) + +# AC_LIBTOOL_HEADER_ASSERT +# ------------------------ +AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], +[AC_CACHE_CHECK([whether $CC supports assert without backlinking], + [lt_cv_func_assert_works], + [case $host in + *-*-solaris*) + if test "$GCC" = yes && test "$with_gnu_ld" != yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) lt_cv_func_assert_works=no ;; + *) lt_cv_func_assert_works=yes ;; + esac + fi + ;; + esac]) + +if test "x$lt_cv_func_assert_works" = xyes; then + AC_CHECK_HEADERS(assert.h) +fi +])# AC_LIBTOOL_HEADER_ASSERT + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h) +])# _LT_AC_CHECK_DLFCN + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix*) + symcode='[[BCDEGRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[[ABCDGISTW]]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if AC_TRY_EVAL(ac_link) && test -s conftest; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AC_FD_CC + fi + else + echo "cannot find nm_test_var in $nlist" >&AC_FD_CC + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC + fi + else + echo "$progname: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + +# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +# --------------------------------- +AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], +[# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi +])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +AC_DIVERT_POP +])# _LT_AC_PROG_ECHO_BACKSLASH + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[if test "$cross_compiling" = yes; then : + [$4] +else + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + +AC_DEFUN([_LT_AC_LTCONFIG_HACK], +[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" + +AC_MSG_CHECKING([for objdir]) +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +AC_MSG_RESULT($objdir) + + +AC_ARG_WITH(pic, +[ --with-pic try to use only PIC/non-PIC objects [default=use both]], +pic_mode="$withval", pic_mode=default) +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +AC_MSG_CHECKING([for $compiler option to produce PIC]) +AC_CACHE_VAL(lt_cv_prog_cc_pic, +[ lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + if test "x$host_vendor" = xsni; then + lt_cv_prog_cc_wl='-LD' + else + lt_cv_prog_cc_wl='-Wl,' + fi + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi +]) +if test -z "$lt_cv_prog_cc_pic"; then + AC_MSG_RESULT([none]) +else + AC_MSG_RESULT([$lt_cv_prog_cc_pic]) + + # Check to make sure the pic_flag actually works. + AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) + AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + AC_TRY_COMPILE([], [], [dnl + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + ], [dnl + lt_cv_prog_cc_pic_works=no + ]) + CFLAGS="$save_CFLAGS" + ]) + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) + lt_cv_prog_cc_can_build_shared=no + fi +fi + +AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) +AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) + LDFLAGS="$save_LDFLAGS" +]) + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler +AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) +AC_CACHE_VAL([lt_cv_compiler_c_o], [ +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&AC_FD_CC + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null +]) +compiler_c_o=$lt_cv_compiler_c_o +AC_MSG_RESULT([$compiler_c_o]) + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) + AC_CACHE_VAL([lt_cv_compiler_o_lo], [ + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + ]) + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + ]) + compiler_o_lo=$lt_cv_compiler_o_lo + AC_MSG_RESULT([$compiler_o_lo]) +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi + +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT([$compiler_rtti_exceptions]) + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \[$]# in + 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsno; then + archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +AC_MSG_RESULT([$ld_shlibs]) +test "$ld_shlibs" = no && can_build_shared=no + +# Check hardcoding attributes. +AC_MSG_CHECKING([how to hardcode library paths into programs]) +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +AC_MSG_RESULT([$hardcode_action]) + +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +# PORTME Fill in your ld.so characteristics +AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case "$host_os" in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +AC_LIBTOOL_DLOPEN_SELF + +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + AC_CACHE_VAL([lt_cv_archive_cmds_need_lc], + [$rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile); then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi]) + AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case $var in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# 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 of the License, 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# 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 of the License, 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. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + +])# _LT_AC_LTCONFIG_HACK + +# 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 <&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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])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=$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_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 &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 +aix4* | aix5*) + 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # 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* | s390* ) + 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 + ;; + +newos6*) + 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 + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +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 + 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*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +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=$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 +]) + +# 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]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + From 769d28a55037dab2596ee4677ed5ff661551669a Mon Sep 17 00:00:00 2001 From: !antona Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0038/2994] little mod to ntfsfix manpage 2001/08/02 01:44:57-00:00 !antona Add ntfsfix man page and spell fixes. Update to 1.2.1 version and update all text files to go with it and the rpm spec file. (Logical change 1.5) --- ntfstools/ntfsfix.8.in | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/ntfstools/ntfsfix.8.in b/ntfstools/ntfsfix.8.in index e69de29b..eed93b8a 100644 --- a/ntfstools/ntfsfix.8.in +++ b/ntfstools/ntfsfix.8.in @@ -0,0 +1,56 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH NTFSFIX 8 "July 2001" "Linux-NTFS version @VERSION@" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +ntfsfix \- tool for fixing NTFS partitions altered by the Linux kernel NTFS driver. +.SH SYNOPSIS +.B ntfsfix +.I device +.SH DESCRIPTION +This manual page documents briefly the +.B ntfsfix +command. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBntfsfix\fP is a program that fixes NTFS partitions altered in any +manner with the Linux NTFS driver. \fBntfsfix\fP is \fBNOT\fP a Linux +version of chkdsk. It only tries to leave the NTFS partition in a +not-so-inconsistent state after the NTFS driver has written to it. +.sp +\fBntfsfix\fP appeared because MS chkdsk is well known for its +stupidity when fixing altered partitions. Because the main problems +are journal files, \fBntfsfix\fP aims to fix those issues. +.sp +Running ntfsfix after mounting NTFS partitions read-write is recommended +for reducing the chance of severe data loss when NT/W2K tries to remount +the affected partition(s). +.sp +In order to use \fBntfsfix\fP you must unmount the NTFS partition, and run +ntfsfix device, where device is the NTFS partition. After this, you can +safely reboot into NT/W2K. Please note that \fBntfsfix\fP is not a +chkdsk-like tool, and so is not guaranteed that it could fix all the +alterations provoked by the NTFS driver. + +.SH SEE ALSO +.BR mkntfs (8). +.br +.SH AUTHOR +This manual page was written by David Martínez Moreno +, for the Debian GNU/Linux +system (but may be used by others). From aaf8f8e036514534827cef8c9170901c16b0fbc4 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0039/2994] Initial revision --- AUTHORS | 0 ChangeLog | 0 Makefile.am | 0 Makefile.in | 0 NEWS | 0 README | 0 TODO.ntfstools | 0 configure | 0 configure.in | 0 doc/template.c | 0 doc/template.h | 0 include/Makefile.am | 0 include/Makefile.in | 0 include/attrib.h | 0 include/bitmap.h | 0 include/bootsect.h | 0 include/debug.h | 0 include/dir.h | 0 include/disk_io.h | 0 include/endians.h | 0 include/layout.h | 0 include/list.h | 0 include/logfile.h | 0 include/mft.h | 0 include/mst.h | 0 include/runlist.h | 0 include/support.h | 0 include/types.h | 0 include/unistr.h | 0 libntfs/Makefile.am | 0 libntfs/Makefile.in | 0 libntfs/attrib.c | 0 libntfs/attrib_RE.c | 0 libntfs/bootsect.c | 0 libntfs/debug.c | 0 libntfs/dir.c | 0 libntfs/disk_io.c | 0 libntfs/inode.c | 0 libntfs/mft.c | 0 libntfs/mst.c | 0 libntfs/runlist.c | 0 libntfs/unistr.c | 0 libntfs/volume.c | 0 linux-ntfs.spec.in | 0 ntfstools/Makefile.am | 0 ntfstools/Makefile.in | 0 ntfstools/dumplog.c | 0 ntfstools/ntfsdump_logfile.c | 0 ntfstools/ntfsinfo.c | 0 ntfstools/ntfslabel.c | 0 ntfstools/ntfsundelete.8.in | 0 ntfstools/ntfsundelete.c | 0 ntfstools/ntfsundelete.h | 0 ntfstools/ntfswipe.c | 0 ntfstools/ntfswipe.h | 0 ntfstools/sd.c | 0 56 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 AUTHORS create mode 100644 ChangeLog create mode 100644 Makefile.am create mode 100644 Makefile.in create mode 100644 NEWS create mode 100644 README create mode 100644 TODO.ntfstools create mode 100755 configure create mode 100644 configure.in create mode 100644 doc/template.c create mode 100644 doc/template.h create mode 100644 include/Makefile.am create mode 100644 include/Makefile.in create mode 100644 include/attrib.h create mode 100644 include/bitmap.h create mode 100644 include/bootsect.h create mode 100644 include/debug.h create mode 100644 include/dir.h create mode 100644 include/disk_io.h create mode 100644 include/endians.h create mode 100644 include/layout.h create mode 100644 include/list.h create mode 100644 include/logfile.h create mode 100644 include/mft.h create mode 100644 include/mst.h create mode 100644 include/runlist.h create mode 100644 include/support.h create mode 100644 include/types.h create mode 100644 include/unistr.h create mode 100644 libntfs/Makefile.am create mode 100644 libntfs/Makefile.in create mode 100644 libntfs/attrib.c create mode 100644 libntfs/attrib_RE.c create mode 100644 libntfs/bootsect.c create mode 100644 libntfs/debug.c create mode 100644 libntfs/dir.c create mode 100644 libntfs/disk_io.c create mode 100644 libntfs/inode.c create mode 100644 libntfs/mft.c create mode 100644 libntfs/mst.c create mode 100644 libntfs/runlist.c create mode 100644 libntfs/unistr.c create mode 100644 libntfs/volume.c create mode 100644 linux-ntfs.spec.in create mode 100644 ntfstools/Makefile.am create mode 100644 ntfstools/Makefile.in create mode 100644 ntfstools/dumplog.c create mode 100644 ntfstools/ntfsdump_logfile.c create mode 100644 ntfstools/ntfsinfo.c create mode 100644 ntfstools/ntfslabel.c create mode 100644 ntfstools/ntfsundelete.8.in create mode 100644 ntfstools/ntfsundelete.c create mode 100644 ntfstools/ntfsundelete.h create mode 100644 ntfstools/ntfswipe.c create mode 100644 ntfstools/ntfswipe.h create mode 100644 ntfstools/sd.c diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..e69de29b diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..e69de29b diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..e69de29b diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 00000000..e69de29b diff --git a/NEWS b/NEWS new file mode 100644 index 00000000..e69de29b diff --git a/README b/README new file mode 100644 index 00000000..e69de29b diff --git a/TODO.ntfstools b/TODO.ntfstools new file mode 100644 index 00000000..e69de29b diff --git a/configure b/configure new file mode 100755 index 00000000..e69de29b diff --git a/configure.in b/configure.in new file mode 100644 index 00000000..e69de29b diff --git a/doc/template.c b/doc/template.c new file mode 100644 index 00000000..e69de29b diff --git a/doc/template.h b/doc/template.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 00000000..e69de29b diff --git a/include/Makefile.in b/include/Makefile.in new file mode 100644 index 00000000..e69de29b diff --git a/include/attrib.h b/include/attrib.h new file mode 100644 index 00000000..e69de29b diff --git a/include/bitmap.h b/include/bitmap.h new file mode 100644 index 00000000..e69de29b diff --git a/include/bootsect.h b/include/bootsect.h new file mode 100644 index 00000000..e69de29b diff --git a/include/debug.h b/include/debug.h new file mode 100644 index 00000000..e69de29b diff --git a/include/dir.h b/include/dir.h new file mode 100644 index 00000000..e69de29b diff --git a/include/disk_io.h b/include/disk_io.h new file mode 100644 index 00000000..e69de29b diff --git a/include/endians.h b/include/endians.h new file mode 100644 index 00000000..e69de29b diff --git a/include/layout.h b/include/layout.h new file mode 100644 index 00000000..e69de29b diff --git a/include/list.h b/include/list.h new file mode 100644 index 00000000..e69de29b diff --git a/include/logfile.h b/include/logfile.h new file mode 100644 index 00000000..e69de29b diff --git a/include/mft.h b/include/mft.h new file mode 100644 index 00000000..e69de29b diff --git a/include/mst.h b/include/mst.h new file mode 100644 index 00000000..e69de29b diff --git a/include/runlist.h b/include/runlist.h new file mode 100644 index 00000000..e69de29b diff --git a/include/support.h b/include/support.h new file mode 100644 index 00000000..e69de29b diff --git a/include/types.h b/include/types.h new file mode 100644 index 00000000..e69de29b diff --git a/include/unistr.h b/include/unistr.h new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/attrib.c b/libntfs/attrib.c new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/attrib_RE.c b/libntfs/attrib_RE.c new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/debug.c b/libntfs/debug.c new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/dir.c b/libntfs/dir.c new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/inode.c b/libntfs/inode.c new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/mft.c b/libntfs/mft.c new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/mst.c b/libntfs/mst.c new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/runlist.c b/libntfs/runlist.c new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/unistr.c b/libntfs/unistr.c new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/volume.c b/libntfs/volume.c new file mode 100644 index 00000000..e69de29b diff --git a/linux-ntfs.spec.in b/linux-ntfs.spec.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/Makefile.am b/ntfstools/Makefile.am new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/Makefile.in b/ntfstools/Makefile.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/dumplog.c b/ntfstools/dumplog.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfsdump_logfile.c b/ntfstools/ntfsdump_logfile.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfsinfo.c b/ntfstools/ntfsinfo.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfslabel.c b/ntfstools/ntfslabel.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfsundelete.8.in b/ntfstools/ntfsundelete.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfsundelete.c b/ntfstools/ntfsundelete.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfsundelete.h b/ntfstools/ntfsundelete.h new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfswipe.c b/ntfstools/ntfswipe.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfswipe.h b/ntfstools/ntfswipe.h new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/sd.c b/ntfstools/sd.c new file mode 100644 index 00000000..e69de29b From e3d2bc7ca5f552a24f88b96b15792c68f97bb03d Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0040/2994] "configure --enable-really-static" and "make strip" very little has changed, but configure has lots of line numbers that have shift slightly 2002/07/05 17:07:48-00:00 !antona Better gcc detection in 'configure.in'. (Szakacsits Szabolcs) 2002/07/03 14:38:40-00:00 !antona Cleanup the build process a bit. 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/05 20:38:11-00:00 !antona update 2002/06/02 14:11:08-00:00 !antona . 2002/06/02 13:57:59-00:00 !antona Fix detection of read-only mounts in volume.c::ntfs_check_mnteent(). 2002/06/01 00:41:45-00:00 !antona huge update! 2002/05/08 05:49:35-00:00 !mattjf Started work on ntfsinfo 2002/04/29 13:00:32-00:00 !antona Add check for mbsrtowcs 2002/04/25 07:50:33-00:00 !antona grr. MDK8.1 modified loads of stuff. Put it back with RH7.2 2002/04/24 23:47:40-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/04/18 18:15:45-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2002/04/16 15:34:32-00:00 !antona Fix the library... 2002/04/14 14:15:47-00:00 !antona Cleanups and updates. 2002/04/12 15:23:47-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2002/03/12 22:02:29-00:00 !antona Forgot to bump the version number. 2002/01/26 04:32:35-00:00 !antona RedHat 7.2 - updates 2002/01/26 03:21:07-00:00 !antona Preparations for 1.5.1 release. 2001/12/15 05:13:08-00:00 !antona Remove atomic ops and add compiler version check. 2001/12/06 01:14:52-00:00 !antona Added mount flags to ntfs_mount and adapted utilities to new mount syntax. 2001/11/17 01:57:53-00:00 !antona Update build system with new document. 2001/11/10 14:22:15-00:00 !antona Remove obsoleted disklabel.h stuff. 2001/11/10 14:17:39-00:00 !antona Enhance mkntfs' device size determination. 2001/11/09 23:38:38-00:00 !antona Change version to 1.4.0 (keep odd ones for development releases). 2001/11/09 23:36:16-00:00 !antona Bug fixes 2001/11/09 21:30:51-00:00 !antona Considering added functionality change version number to 1.3.0, update docs and mkntfs man page. 2001/11/09 19:24:23-00:00 !antona With lots of luck this is going to be 1.2.3. 2001/08/27 16:58:07-00:00 !antona Updates. 2001/08/02 01:44:56-00:00 !antona Add ntfsfix man page and spell fixes. Update to 1.2.1 version and update all text files to go with it and the rpm spec file. 2001/07/25 23:11:49-00:00 !antona Update text files 2001/07/25 13:43:10-00:00 !antona 1.0.2 release. Mkntfs now in sbin and minor bugfix to mkntfs man page. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/11 19:11:37-00:00 !antona Fix rpm generation. Circumvent configure bug by cheating in configure.in moving around nonopt to host and setting nonopt to NONE. 2001/06/11 04:02:08-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/10 18:30:16-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. 2001/06/05 10:33:02-00:00 !antona Update automatic config/make process and mkntfs to use the cvs release tag for version reporting. 2001/06/01 02:07:23-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/03 02:03:35-00:00 !antona More files. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- configure | 6646 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 6646 insertions(+) diff --git a/configure b/configure index e69de29b..5254b03b 100755 --- a/configure +++ b/configure @@ -0,0 +1,6646 @@ +#! /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. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_default_prefix=/usr/local +ac_help="$ac_help + --enable-debug enable debugging" +ac_help="$ac_help + --enable-really-static completely static binaries" +ac_help="$ac_help + --enable-shared[=PKGS] build shared libraries [default=yes]" +ac_help="$ac_help + --enable-static[=PKGS] build static libraries [default=yes]" +ac_help="$ac_help + --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" +ac_help="$ac_help + --with-gnu-ld assume the C compiler uses GNU ld [default=no]" + +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + +ac_help="$ac_help + --disable-libtool-lock avoid locking (might break parallel builds)" +ac_help="$ac_help + --with-pic try to use only PIC/non-PIC objects [default=use both]" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +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" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$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" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*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" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # 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 + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + 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 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$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" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + 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" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + 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_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + 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-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-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + 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" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$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 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # 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'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*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" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + 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-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" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + 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" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; 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 + +# 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 +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" ;; + 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 + +# 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 + +# 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=aclocal.m4 + +# 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=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +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; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +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 + + + +if test "x$nonopt" != "xNONE"; then + host="$nonopt" + nonopt="NONE" +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:757: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:778: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:796: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:831: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:884: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:941: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=linux-ntfs + +VERSION=1.6.99 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <> confdefs.h <&6 +echo "configure:987: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:1000: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:1013: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:1026: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:1039: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:1054: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # 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 "$ac_t""$USE_MAINTAINER_MODE" 1>&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 + + + + + + + + +if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix $prefix" +fi + +# Check whether --enable-debug or --disable-debug was given. +if test "${enable_debug+set}" = set; then + enableval="$enable_debug" + : +else + enable_debug=no + +fi + + +# Check whether --enable-really-static or --disable-really-static was given. +if test "${enable_really_static+set}" = set; then + enableval="$enable_really_static" + : +else + enable_really_static=no + +fi + + + + +if test "$enable_debug" = yes; then + DEBUG_TRUE= + DEBUG_FALSE='#' +else + DEBUG_TRUE='#' + DEBUG_FALSE= +fi + + +if test "$enable_really_static" = yes; then + REALLYSTATIC_TRUE= + REALLYSTATIC_FALSE='#' +else + REALLYSTATIC_TRUE='#' + REALLYSTATIC_FALSE= +fi + +for ac_prog in $CCC c++ g++ gcc CC cxx cc++ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1131: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1163: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +cat > conftest.$ac_ext << EOF + +#line 1174 "configure" +#include "confdefs.h" + +int main(){return(0);} +EOF +if { (eval echo configure:1179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cxx_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_cxx_cross=no + else + ac_cv_prog_cxx_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cxx_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_cxx_works" 1>&6 +if test $ac_cv_prog_cxx_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 ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1205: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 +cross_compiling=$ac_cv_prog_cxx_cross + +echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 +echo "configure:1210: checking whether we are using GNU C++" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 + +if test $ac_cv_prog_gxx = yes; then + GXX=yes +else + GXX= +fi + +ac_test_CXXFLAGS="${CXXFLAGS+set}" +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS= +echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 +echo "configure:1238: checking whether ${CXX-g++} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi + +for ac_declaration in \ + ''\ + '#include ' \ + '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 < +$ac_declaration +int main() { +exit (42); +; return 0; } +EOF +if { (eval echo configure:1287: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + continue +fi +rm -f conftest* + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1323: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +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:1353: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_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" +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 + # 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="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + 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:1404: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1436: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 1447 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:1452: \"$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 + else + ac_cv_prog_cc_cross=yes + 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:1478: 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:1483: 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 <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1511: 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 + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +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 +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1554: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:1607: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:1628: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +if test -z "$LIBTOOL"; then + + 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 + + # Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:1676: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:1709: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1738: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1759: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1776: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1793: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +# 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 + +# 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 $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 +echo "configure:1898: checking for ld used by GCC" >&5 + 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 $ac_n "checking for GNU ld""... $ac_c" 1>&6 +echo "configure:1928: checking for GNU ld" >&5 +else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 +echo "configure:1931: checking for non-GNU ld" >&5 +fi +if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_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 "$ac_t""$LD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } +echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 +echo "configure:1966: checking if the linker ($LD) is GNU ld" >&5 +if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi +fi + +echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6 +echo "configure:1983: checking for $LD option to reload object files" >&5 +if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + lt_cv_ld_reload_flag='-r' +fi + +echo "$ac_t""$lt_cv_ld_reload_flag" 1>&6 +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" + +echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 +echo "configure:1995: checking for BSD-compatible nm" >&5 +if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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=$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 "$ac_t""$NM" 1>&6 + +echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 +echo "configure:2033: checking how to recognise dependant libraries" >&5 +if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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 +aix4* | aix5*) + 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # 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* | s390* ) + 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 + ;; + +newos6*) + 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 + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +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 + 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*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + esac + ;; +esac + +fi + +echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method + +echo $ac_n "checking for object suffix""... $ac_c" 1>&6 +echo "configure:2216: checking for object suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftest* +echo 'int i = 1;' > conftest.$ac_ext +if { (eval echo configure:2222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_objext" 1>&6 +OBJEXT=$ac_cv_objext +ac_objext=$ac_cv_objext + + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:2242: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:2252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6 +echo "configure:2283: checking command to parse $NM output" >&5 +if eval "test \"`echo '$''{'lt_cv_sys_global_symbol_pipe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix*) + symcode='[BCDEGRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo configure:2366: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo configure:2417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + echo "$ac_t""failed" 1>&6 +else + echo "$ac_t""ok" 1>&6 +fi + +for ac_hdr in dlfcn.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2466: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2476: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + + + + +# 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 $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 +echo "configure:2511: checking for ${ac_tool_prefix}file" >&5 +if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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 <&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 "$ac_t""$MAGIC_CMD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo $ac_n "checking for file""... $ac_c" 1>&6 +echo "configure:2573: checking for file" >&5 +if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&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 <&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 "$ac_t""$MAGIC_CMD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2644: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # 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_RANLIB="${ac_tool_prefix}ranlib" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_RANLIB"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2676: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # 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_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + RANLIB=":" +fi +fi + +# 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2711: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # 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_STRIP="${ac_tool_prefix}strip" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_STRIP"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2743: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # 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_STRIP="strip" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" +fi +fi +STRIP="$ac_cv_prog_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + STRIP=":" +fi +fi + + +enable_dlopen=no +enable_win32_dll=no + +# 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 && enable_libtool_lock=yes + +# 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 2792 "configure"' > conftest.$ac_ext + if { (eval echo configure:2793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; 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 $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 +echo "configure:2814: checking whether the C compiler needs -belf" >&5 +if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + 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 + + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_cc_needs_belf=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_cc_needs_belf=no +fi +rm -f 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 + +fi + +echo "$ac_t""$lt_cv_cc_needs_belf" 1>&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 + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo $ac_n "checking for objdir""... $ac_c" 1>&6 +echo "configure:2954: checking for objdir" >&5 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$ac_t""$objdir" 1>&6 + + +# 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 -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +echo $ac_n "checking for $compiler option to produce PIC""... $ac_c" 1>&6 +echo "configure:2981: checking for $compiler option to produce PIC" >&5 +if eval "test \"`echo '$''{'lt_cv_prog_cc_pic'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + if test "x$host_vendor" = xsni; then + lt_cv_prog_cc_wl='-LD' + else + lt_cv_prog_cc_wl='-Wl,' + fi + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi + +fi + +if test -z "$lt_cv_prog_cc_pic"; then + echo "$ac_t""none" 1>&6 +else + echo "$ac_t""$lt_cv_prog_cc_pic" 1>&6 + + # Check to make sure the pic_flag actually works. + echo $ac_n "checking if $compiler PIC flag $lt_cv_prog_cc_pic works""... $ac_c" 1>&6 +echo "configure:3133: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 + if eval "test \"`echo '$''{'lt_cv_prog_cc_pic_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + lt_cv_prog_cc_pic_works=no + +fi +rm -f conftest* + CFLAGS="$save_CFLAGS" + +fi + + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + echo "$ac_t""$lt_cv_prog_cc_pic_works" 1>&6 +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + echo "configure: warning: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" 1>&2 + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : + else + echo "configure: warning: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" 1>&2 + lt_cv_prog_cc_can_build_shared=no + fi +fi + +echo $ac_n "checking if $compiler static flag $lt_cv_prog_cc_static works""... $ac_c" 1>&6 +echo "configure:3199: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +if eval "test \"`echo '$''{'lt_cv_prog_cc_static_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + lt_cv_prog_cc_static_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + LDFLAGS="$save_LDFLAGS" + +fi + + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +echo "$ac_t""$lt_cv_prog_cc_static_works" 1>&6 + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler +echo $ac_n "checking if $compiler supports -c -o file.$ac_objext""... $ac_c" 1>&6 +echo "configure:3241: checking if $compiler supports -c -o file.$ac_objext" >&5 +if eval "test \"`echo '$''{'lt_cv_compiler_c_o'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:3260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +fi + +compiler_c_o=$lt_cv_compiler_c_o +echo "$ac_t""$compiler_c_o" 1>&6 + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo $ac_n "checking if $compiler supports -c -o file.lo""... $ac_c" 1>&6 +echo "configure:3289: checking if $compiler supports -c -o file.lo" >&5 + if eval "test \"`echo '$''{'lt_cv_compiler_o_lo'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + +fi + + compiler_o_lo=$lt_cv_compiler_o_lo + echo "$ac_t""$compiler_o_lo" 1>&6 +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo $ac_n "checking if we can lock with hard links""... $ac_c" 1>&6 +echo "configure:3338: checking if we can lock with hard links" >&5 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$ac_t""$hard_links" 1>&6 + if test "$hard_links" = no; then + echo "configure: warning: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" 1>&2 + need_locks=warn + fi +else + need_locks=no +fi + +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions""... $ac_c" 1>&6 +echo "configure:3357: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + CFLAGS="$save_CFLAGS" + echo "$ac_t""$compiler_rtti_exceptions" 1>&6 + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +echo $ac_n "checking whether the linker ($LD) supports shared libraries""... $ac_c" 1>&6 +echo "configure:3397: checking whether the linker ($LD) supports shared libraries" >&5 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [12].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsno; then + archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$ac_t""$ld_shlibs" 1>&6 +test "$ld_shlibs" = no && can_build_shared=no + +# Check hardcoding attributes. +echo $ac_n "checking how to hardcode library paths into programs""... $ac_c" 1>&6 +echo "configure:4081: checking how to hardcode library paths into programs" >&5 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$ac_t""$hardcode_action" 1>&6 + +striplib= +old_striplib= +echo $ac_n "checking whether stripping libraries is possible""... $ac_c" 1>&6 +echo "configure:4109: checking whether stripping libraries is possible" >&5 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +# PORTME Fill in your ld.so characteristics +echo $ac_n "checking dynamic linker characteristics""... $ac_c" 1>&6 +echo "configure:4123: checking dynamic linker characteristics" >&5 +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + case $GCC,$host_os in + yes,cygwin*) + library_names_spec='$libname.dll.a' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + ;; + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' + ;; + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + *) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case "$host_os" in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$ac_t""$dynamic_linker" 1>&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo $ac_n "checking if libtool supports shared libraries""... $ac_c" 1>&6 +echo "configure:4520: checking if libtool supports shared libraries" >&5 +echo "$ac_t""$can_build_shared" 1>&6 + +echo $ac_n "checking whether to build shared libraries""... $ac_c" 1>&6 +echo "configure:4524: checking whether to build shared libraries" >&5 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$ac_t""$enable_shared" 1>&6 + +echo $ac_n "checking whether to build static libraries""... $ac_c" 1>&6 +echo "configure:4547: checking whether to build static libraries" >&5 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$ac_t""$enable_static" 1>&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + cygwin* | mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + *) + echo $ac_n "checking for shl_load""... $ac_c" 1>&6 +echo "configure:4588: checking for shl_load" >&5 +if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load(); + +int main() { + +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +shl_load(); +#endif + +; return 0; } +EOF +if { (eval echo configure:4616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_shl_load=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_shl_load=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 +echo "configure:4634: checking for shl_load in -ldld" >&5 +ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&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 + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dlopen""... $ac_c" 1>&6 +echo "configure:4672: checking for dlopen" >&5 +if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen(); + +int main() { + +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +dlopen(); +#endif + +; return 0; } +EOF +if { (eval echo configure:4700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_dlopen=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_dlopen=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +echo "configure:4718: checking for dlopen in -ldl" >&5 +ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldl $LIBS" +cat > conftest.$ac_ext <&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 + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6 +echo "configure:4756: checking for dlopen in -lsvld" >&5 +ac_lib_var=`echo svld'_'dlopen | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsvld $LIBS" +cat > conftest.$ac_ext <&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 + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 +echo "configure:4794: checking for dld_link in -ldld" >&5 +ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&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 + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +else + echo "$ac_t""no" 1>&6 +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 +echo "configure:4869: checking whether a program can dlopen itself" >&5 +if eval "test \"`echo '$''{'lt_cv_dlopen_self'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo configure:4940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi + +echo "$ac_t""$lt_cv_dlopen_self" 1>&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 +echo "configure:4963: checking whether a statically linked program can dlopen itself" >&5 +if eval "test \"`echo '$''{'lt_cv_dlopen_self_static'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + if { (eval echo configure:5034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi + +echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo $ac_n "checking whether -lc should be explicitly linked in""... $ac_c" 1>&6 +echo "configure:5083: checking whether -lc should be explicitly linked in" >&5 + if eval "test \"`echo '$''{'lt_cv_archive_cmds_need_lc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext + + if { (eval echo configure:5090: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo configure:5103: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi +fi + + echo "$ac_t""$lt_cv_archive_cmds_need_lc" 1>&6 + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case $var in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + cat <<__EOF__ > "${ofile}T" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# 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 of the License, 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$need_lc + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# The default C compiler. +CC=$lt_CC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_pic_flag +pic_mode=$pic_mode + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + case $host_os in + aix3*) + cat <<\EOF >> "${ofile}T" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# 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 of the License, 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. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + + 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 + + + LIBTOOL_SHELL='/bin/sh ./libtool' +else + LIBTOOL_SHELL=$LIBTOOL +fi + +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" + + + + + + + + + +if test ! -z "$CC"; then + _cc="$CC" +else + _cc="gcc" +fi + +echo $ac_n "checking version of $_cc""... $ac_c" 1>&6 +echo "configure:5715: checking version of $_cc" >&5 +cc_version=`$_cc --version 2>&1` +cc_major=`echo $cc_version | sed 's/egcs-//' | cut -d'.' -f1` +cc_minor=`echo $cc_version | sed 's/egcs-//' | cut -d'.' -f2` +if test -z $cc_version; then + cc_version="v. ?.??" + cc_major=1 +fi +if test $cc_major -lt 2 -o \( $cc_major -eq 2 -a $cc_minor -lt 96 \) ; then +cc_version="$cc_version, bad" +echo "$ac_t""$cc_version" 1>&6 +{ echo "configure: error: Please upgrade your gcc compiler to gcc-2.96+ or gcc-3+ version!\ + Earlier compiler versions will NOT work as these do not support \ +unnamed/annonymous structures and unions which are used heavily in linux-ntfs." 1>&2; exit 1; } +fi +cc_version="$cc_version, ok" +echo "$ac_t""$cc_version" 1>&6 + + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:5735: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:5748: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:5815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +for ac_hdr in stdint.h stdlib.h fcntl.h unistd.h errno.h sys/stat.h \ + sys/ioctl.h sys/types.h linux/types.h asm/byteorder.h sys/mount.h \ + time.h mntent.h stdio.h stdarg.h string.h getopt.h linux/major.h \ + limits.h linux/fd.h wchar.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:5845: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:5855: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:5883: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:5937: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + 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 +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for inline""... $ac_c" 1>&6 +echo "configure:5958: checking for inline" >&5 +if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done + +fi + +echo "$ac_t""$ac_cv_c_inline" 1>&6 +case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >> confdefs.h <&6 +echo "configure:5998: checking for long double" >&5 +if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$GCC" = yes; then + ac_cv_c_long_double=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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_long_double=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_long_double=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_c_long_double" 1>&6 +if test $ac_cv_c_long_double = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LONG_DOUBLE 1 +EOF + +fi + +echo $ac_n "checking for off_t""... $ac_c" 1>&6 +echo "configure:6041: checking for off_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes +else + rm -rf conftest* + ac_cv_type_off_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_off_t" 1>&6 +if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF +#define off_t long +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:6074: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + + +echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 +echo "configure:6108: checking for 8-bit clean memcmp" >&5 +if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_memcmp_clean=no +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_memcmp_clean=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_memcmp_clean=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 +test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" + +for ac_func in memset strdup puts printf fprintf vprintf vfprintf \ + perror strerror malloc calloc free realloc open close read write \ + lseek fdatasync ioctl fflush atexit exit time srandom random wcrtomb \ + mbrtowc mbsrtowcs setmntent getmntent endmntent hasmntopt +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:6149: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* 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(); +#endif + +; return 0; } +EOF +if { (eval echo configure:6177: \"$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 + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. +# +# 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. +# +EOF +# 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 + if test -w $cache_file; then + 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. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +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} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +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 +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo " + Makefile + doc/Makefile + include/Makefile + libntfs/Makefile + ntfstools/Makefile + ntfstools/mkntfs.8 + ntfstools/ntfsfix.8 + ntfstools/ntfslabel.8 + ntfstools/ntfsinfo.8 + ntfstools/ntfsundelete.8 + linux-ntfs.spec + config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < 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%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%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%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g +s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g +s%@MAINT@%$MAINT%g +s%@DEBUG_TRUE@%$DEBUG_TRUE%g +s%@DEBUG_FALSE@%$DEBUG_FALSE%g +s%@REALLYSTATIC_TRUE@%$REALLYSTATIC_TRUE%g +s%@REALLYSTATIC_FALSE@%$REALLYSTATIC_FALSE%g +s%@CXX@%$CXX%g +s%@CC@%$CC%g +s%@LN_S@%$LN_S%g +s%@OBJEXT@%$OBJEXT%g +s%@EXEEXT@%$EXEEXT%g +s%@ECHO@%$ECHO%g +s%@RANLIB@%$RANLIB%g +s%@STRIP@%$STRIP%g +s%@CPP@%$CPP%g +s%@LIBTOOL@%$LIBTOOL%g +s%@LIBTOOL_DEPS@%$LIBTOOL_DEPS%g +s%@all_includes@%$all_includes%g +s%@all_libraries@%$all_libraries%g +s%@AUTODIRS@%$AUTODIRS%g +s%@LIBOBJS@%$LIBOBJS%g + +CEOF +EOF + +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 + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + 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` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $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" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # 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= + fi + + 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" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_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 + + 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* + +# 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_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 <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; 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" ;; + 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 + +# 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. + +rm -f conftest.tail +while : +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 <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $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 + 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" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + From e8f062025840b6efbe025f0e1e5d1856e7ff2d1c Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0041/2994] "configure --enable-really-static" and "make strip" very little has changed, but configure has lots of line numbers that have shift slightly 2002/07/05 17:07:48-00:00 !antona Better gcc detection in 'configure.in'. (Szakacsits Szabolcs) 2002/07/03 14:38:40-00:00 !antona Cleanup the build process a bit. 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/05 20:38:11-00:00 !antona update 2002/06/02 14:11:09-00:00 !antona . 2002/06/02 13:57:59-00:00 !antona Fix detection of read-only mounts in volume.c::ntfs_check_mnteent(). 2002/05/08 05:49:35-00:00 !mattjf Started work on ntfsinfo 2002/04/29 13:00:39-00:00 !antona Add check for mbsrtowcs 2002/04/24 23:47:40-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/04/18 18:15:45-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2002/04/16 15:34:32-00:00 !antona Fix the library... 2002/04/14 14:15:47-00:00 !antona Cleanups and updates. 2002/04/12 15:23:47-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2002/03/12 22:02:29-00:00 !antona Forgot to bump the version number. 2002/01/26 03:21:07-00:00 !antona Preparations for 1.5.1 release. 2001/12/15 05:13:08-00:00 !antona Remove atomic ops and add compiler version check. 2001/12/06 01:14:52-00:00 !antona Added mount flags to ntfs_mount and adapted utilities to new mount syntax. 2001/11/10 14:22:15-00:00 !antona Remove obsoleted disklabel.h stuff. 2001/11/10 14:17:39-00:00 !antona Enhance mkntfs' device size determination. 2001/11/09 23:38:38-00:00 !antona Change version to 1.4.0 (keep odd ones for development releases). 2001/11/09 21:30:51-00:00 !antona Considering added functionality change version number to 1.3.0, update docs and mkntfs man page. 2001/11/09 19:24:23-00:00 !antona With lots of luck this is going to be 1.2.3. 2001/11/09 18:24:32-00:00 !antona Updates to docs, layout.h and ntfsfix to support Windows XP NTFS 2001/08/27 16:58:07-00:00 !antona Updates. 2001/08/02 01:44:56-00:00 !antona Add ntfsfix man page and spell fixes. Update to 1.2.1 version and update all text files to go with it and the rpm spec file. 2001/07/25 23:11:49-00:00 !antona Update text files 2001/07/25 13:43:10-00:00 !antona 1.0.2 release. Mkntfs now in sbin and minor bugfix to mkntfs man page. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/11 19:11:37-00:00 !antona Fix rpm generation. Circumvent configure bug by cheating in configure.in moving around nonopt to host and setting nonopt to NONE. 2001/06/11 04:02:08-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/10 18:30:16-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. 2001/06/05 10:33:02-00:00 !antona Update automatic config/make process and mkntfs to use the cvs release tag for version reporting. 2001/06/01 02:07:23-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/03 02:03:35-00:00 !antona More files. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- configure.in | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/configure.in b/configure.in index e69de29b..0aeca72a 100644 --- a/configure.in +++ b/configure.in @@ -0,0 +1,139 @@ +AC_INIT(aclocal.m4) + +dnl This is required to get past a stupid configure bug when making the rpm. +dnl Basically it is broken to specify the host as a command line argument to +dnl configure on its own, i.e. without giving --host=. It is supposed to work +dnl but doesn't. So this sets host and erases nonopt effectively moving the +dnl standalone command line option into the --host= form. +if test "x$nonopt" != "xNONE"; then + host="$nonopt" + nonopt="NONE" +fi + +AC_CANONICAL_SYSTEM + +AM_INIT_AUTOMAKE(linux-ntfs,1.6.99) + +AM_MAINTAINER_MODE + +AM_CONFIG_HEADER(config.h) + +AC_PREFIX_DEFAULT(/usr/local) +if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix $prefix" +fi + +dnl Command-line options. +AC_ARG_ENABLE(debug, + [ --enable-debug enable debugging], , + enable_debug=no +) + +AC_ARG_ENABLE(really-static, + [ --enable-really-static completely static binaries], , + enable_really_static=no +) + +AM_CONDITIONAL(DEBUG, test "$enable_debug" = yes) +AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes) + +dnl Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET + +dnl create a working libtool-script +if test -z "$LIBTOOL"; then + AC_LANG_SAVE + AC_LANG_C + AM_PROG_LIBTOOL + dnl LIBTOOL="$LIBTOOL --silent" + AC_LANG_RESTORE + AC_SUBST(LIBTOOL_DEPS) + LIBTOOL_SHELL='/bin/sh ./libtool' +else + LIBTOOL_SHELL=$LIBTOOL +fi + +dnl add --with-extra-includes and --with-extra-libs switch to ./configure +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +AC_SUBST(AUTODIRS) + +AC_SUBST(CFLAGS) +AC_SUBST(CPPFLAGS) +AC_SUBST(LDFLAGS) + +dnl Get compiler name +if test ! -z "$CC"; then + _cc="$CC" +else + _cc="gcc" +fi + +dnl Check for gcc version being >= 2.96. +AC_MSG_CHECKING(version of $_cc) +cc_version=`$_cc --version 2>&1` +cc_major=`echo $cc_version | sed 's/egcs-//' | cut -d'.' -f1` +cc_minor=`echo $cc_version | sed 's/egcs-//' | cut -d'.' -f2` +if test -z $cc_version; then + cc_version="v. ?.??" + cc_major=1 +fi +if test $cc_major -lt 2 -o \( $cc_major -eq 2 -a $cc_minor -lt 96 \) ; then +cc_version="$cc_version, bad" +AC_MSG_RESULT($cc_version) +AC_MSG_ERROR(Please upgrade your gcc compiler to gcc-2.96+ or gcc-3+ version!\ + Earlier compiler versions will NOT work as these do not support \ +unnamed/annonymous structures and unions which are used heavily in linux-ntfs.) +fi +cc_version="$cc_version, ok" +AC_MSG_RESULT($cc_version) + +dnl Checks for libraries. + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(stdint.h stdlib.h fcntl.h unistd.h errno.h sys/stat.h \ + sys/ioctl.h sys/types.h linux/types.h asm/byteorder.h sys/mount.h \ + time.h mntent.h stdio.h stdarg.h string.h getopt.h linux/major.h \ + limits.h linux/fd.h wchar.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_C_LONG_DOUBLE +AC_TYPE_OFF_T +AC_TYPE_SIZE_T + +dnl Checks for library functions. +AC_FUNC_MEMCMP +AC_CHECK_FUNCS(memset strdup puts printf fprintf vprintf vfprintf \ + perror strerror malloc calloc free realloc open close read write \ + lseek fdatasync ioctl fflush atexit exit time srandom random wcrtomb \ + mbrtowc mbsrtowcs setmntent getmntent endmntent hasmntopt) + +dnl Perform program name transformation. +AC_ARG_PROGRAM + +dnl Makefiles to be created by configure. +AC_OUTPUT([ + Makefile + doc/Makefile + include/Makefile + libntfs/Makefile + ntfstools/Makefile + ntfstools/mkntfs.8 + ntfstools/ntfsfix.8 + ntfstools/ntfslabel.8 + ntfstools/ntfsinfo.8 + ntfstools/ntfsundelete.8 + linux-ntfs.spec +]) + From 908e9c8f40079a46bcdd4b710fcc03669c068caa Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0042/2994] "configure --enable-really-static" and "make strip" very little has changed, but configure has lots of line numbers that have shift slightly 2002/07/11 16:45:07-00:00 !antona fix make dist 2002/06/05 20:32:52-00:00 !antona Mft mirror now updated from ntfs_write_mft_record, yey! Fixup ntfstools accordingly. 2002/06/02 23:18:56-00:00 !antona Updates to spec file and make files. 2002/06/01 00:41:45-00:00 !antona huge update! 2002/05/08 05:49:35-00:00 !mattjf Started work on ntfsinfo 2002/04/15 20:04:22-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/14 14:15:47-00:00 !antona Cleanups and updates. 2001/06/11 19:11:37-00:00 !antona Fix rpm generation. Circumvent configure bug by cheating in configure.in moving around nonopt to host and setting nonopt to NONE. 2001/06/01 02:07:23-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/03 02:03:35-00:00 !antona More files. 2001/02/02 01:28:46-00:00 !antona make dist fixes using more Makefiles. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- Makefile.am | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Makefile.am b/Makefile.am index e69de29b..e2f2117c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -0,0 +1,25 @@ + +# Need this to enable 64-bit (device) file access functions and parameters. +if DEBUG +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall +else +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 +endif + +SUBDIRS = doc include libntfs ntfstools + +EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ + INSTALL NEWS README autogen.sh linux-ntfs.spec.in \ + TODO.ntfstools + +AUTOMAKE_OPTIONS = gnu + +dist-hook: linux-ntfs.spec + cp linux-ntfs.spec $(distdir) + +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck + +strip: + $(MAKE) -C ntfstools strip + From d1a9dc7c7b50a7f1cf6b3720cef44ff6a569d976 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0043/2994] "configure --enable-really-static" and "make strip" very little has changed, but configure has lots of line numbers that have shift slightly 2002/07/11 16:45:07-00:00 !antona fix make dist 2002/06/05 20:32:52-00:00 !antona Mft mirror now updated from ntfs_write_mft_record, yey! Fixup ntfstools accordingly. 2002/06/02 23:18:56-00:00 !antona Updates to spec file and make files. 2002/06/01 00:41:45-00:00 !antona huge update! 2002/05/08 05:49:35-00:00 !mattjf Started work on ntfsinfo 2002/04/25 07:50:33-00:00 !antona grr. MDK8.1 modified loads of stuff. Put it back with RH7.2 2002/04/24 23:47:40-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/04/15 20:04:22-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/14 14:15:47-00:00 !antona Cleanups and updates. 2002/01/26 04:32:35-00:00 !antona RedHat 7.2 - updates 2001/11/17 01:57:53-00:00 !antona Update build system with new document. 2001/11/09 23:36:16-00:00 !antona Bug fixes 2001/11/09 19:24:23-00:00 !antona With lots of luck this is going to be 1.2.3. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/11 19:11:37-00:00 !antona Fix rpm generation. Circumvent configure bug by cheating in configure.in moving around nonopt to host and setting nonopt to NONE. 2001/06/11 04:02:08-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/01 02:07:23-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/03 02:03:35-00:00 !antona More files. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- Makefile.in | 402 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 402 insertions(+) diff --git a/Makefile.in b/Makefile.in index e69de29b..a4c45313 100644 --- a/Makefile.in +++ b/Makefile.in @@ -0,0 +1,402 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Need this to enable 64-bit (device) file access functions and parameters. + + +SHELL = @SHELL@ + +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 = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AS = @AS@ +AUTODIRS = @AUTODIRS@ +CC = @CC@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall +@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 + +SUBDIRS = doc include libntfs ntfstools + +EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ + INSTALL NEWS README autogen.sh linux-ntfs.spec.in \ + TODO.ntfstools + + +AUTOMAKE_OPTIONS = gnu +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = linux-ntfs.spec +DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ +Makefile.am Makefile.in NEWS acconfig.h aclocal.m4 config.guess \ +config.h.in config.sub configure configure.in install-sh \ +linux-ntfs.spec.in ltconfig ltmain.sh missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(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: @MAINTAINER_MODE_TRUE@$(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: +linux-ntfs.spec: $(top_builddir)/config.status linux-ntfs.spec.in + cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" != "." || dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +all-recursive-am: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: +uninstall: uninstall-recursive +all-am: Makefile config.h +all-redirect: all-recursive-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-hdr clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-hdr distclean-tags distclean-generic clean-am + -rm -f libtool + +distclean: distclean-recursive + -rm -f config.status + +maintainer-clean-am: maintainer-clean-hdr 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." + +maintainer-clean: maintainer-clean-recursive + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +install-data-recursive uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive 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-am \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +dist-hook: linux-ntfs.spec + cp linux-ntfs.spec $(distdir) + +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck + +strip: + $(MAKE) -C ntfstools strip + +# 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: From 65a618c05309b31f69c5086feacea4f6540d73c1 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0044/2994] "configure --enable-really-static" and "make strip" very little has changed, but configure has lots of line numbers that have shift slightly 2002/07/19 14:53:27-00:00 !flatcap created a template for ntfswipe 2002/07/18 02:57:56-00:00 !flatcap add ntfsundelete to the build. fix rpm build. trawl for typos. 2002/07/08 15:59:34-00:00 !flatcap Added Szaka's ntfsresize to the build 2002/07/03 14:38:40-00:00 !antona Cleanup the build process a bit. 2002/07/03 12:55:52-00:00 !flatcap added CLEANFILES to delete all the build products 2002/07/03 11:30:06-00:00 !flatcap moved undelete,logprogs to EXTRA_PROGRAMS 2002/07/02 23:47:11-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/07/01 13:30:28-00:00 !flatcap lots of comments 2002/06/30 22:46:50-00:00 !flatcap undelete -> ntfsundelete 2002/06/30 21:22:51-00:00 !flatcap a working undelete program, still very alpha 2002/06/01 00:41:45-00:00 !antona huge update! 2002/05/08 22:32:22-00:00 !antona Update 2002/05/08 05:49:35-00:00 !mattjf Started work on ntfsinfo 2002/04/15 20:04:29-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/12 15:23:48-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2001/08/02 01:44:57-00:00 !antona Add ntfsfix man page and spell fixes. Update to 1.2.1 version and update all text files to go with it and the rpm spec file. 2001/07/25 13:43:10-00:00 !antona 1.0.2 release. Mkntfs now in sbin and minor bugfix to mkntfs man page. 2001/07/24 17:56:21-00:00 !antona OOps . forgot soemthing. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/16 19:22:45-00:00 !antona Get rid of logfile stuff for mkntfs as it is clearly not needed. 2001/06/15 16:47:47-00:00 !antona Integrate logfile.c into mkntfs 2001/06/11 19:11:37-00:00 !antona Fix rpm generation. Circumvent configure bug by cheating in configure.in moving around nonopt to host and setting nonopt to NONE. 2001/06/10 18:30:17-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. 2001/06/04 23:38:55-00:00 !antona Integrate ldm.c into automatic build process. A bit more on mkntfs and make it compile (do _not_ run as it is - am working on directory creation so chances are it will hang if you run it or something). 2001/06/01 02:07:26-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/03/02 15:06:37-00:00 !antona Full commit of my current dircetory. New files not yet added. 2001/02/03 02:03:36-00:00 !antona More files. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- ntfstools/Makefile.am | 73 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/ntfstools/Makefile.am b/ntfstools/Makefile.am index e69de29b..122967a7 100644 --- a/ntfstools/Makefile.am +++ b/ntfstools/Makefile.am @@ -0,0 +1,73 @@ +# Need this to enable 64-bit (device) file access functions and parameters. +if DEBUG +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall +else +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 +endif + +if REALLYSTATIC +AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a +AM_LFLAGS = -static +LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +else +AM_LIBS = $(top_srcdir)/libntfs/libntfs.la +AM_LFLAGS = $(all_libraries) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +endif + +bin_PROGRAMS = ntfsfix ntfsinfo +sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete +EXTRA_PROGRAMS = ntfsresize ntfsdump_logfile dumplog ntfswipe + +man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 +EXTRA_MANS = + +CLEANFILES = $(EXTRA_PROGRAMS) + +linux_ntfsincludedir = -I$(top_srcdir)/include + +# Set the include path. +INCLUDES = -I$(top_srcdir)/include $(all_includes) + +ntfsfix_SOURCES = ntfsfix.c +ntfsfix_LDADD = $(AM_LIBS) +ntfsfix_LDFLAGS = $(AM_LFLAGS) + +mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c +mkntfs_LDADD = $(AM_LIBS) +mkntfs_LDFLAGS = $(AM_LFLAGS) + +ntfslabel_SOURCES = ntfslabel.c +ntfslabel_LDADD = $(AM_LIBS) +ntfslabel_LDFLAGS = $(AM_LFLAGS) + +ntfsinfo_SOURCES = ntfsinfo.c +ntfsinfo_LDADD = $(AM_LIBS) +ntfsinfo_LDFLAGS = $(AM_LFLAGS) + +ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h +ntfsundelete_LDADD = $(AM_LIBS) +ntfsundelete_LDFLAGS = $(AM_LFLAGS) + +# We don't distribute these + +ntfswipe_SOURCES = ntfswipe.c ntfswipe.h +ntfswipe_LDADD = $(AM_LIBS) +ntfswipe_LDFLAGS = $(AM_LFLAGS) + +ntfsresize_SOURCES = ntfsresize.c +ntfsresize_LDADD = $(AM_LIBS) +ntfsresize_LDFLAGS = $(AM_LFLAGS) + +ntfsdump_logfile_SOURCES= ntfsdump_logfile.c +ntfsdump_logfile_LDADD = $(AM_LIBS) +ntfsdump_logfile_LDFLAGS= $(AM_LFLAGS) + +dumplog_SOURCES = dumplog.c +dumplog_LDADD = $(AM_LIBS) +dumplog_LDFLAGS = $(AM_LFLAGS) + +# Extra targets + +strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) + $(STRIP) $^ From 6ce1d4bfedc0bf0a2724e75567cdfa1157e6f61d Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0045/2994] "configure --enable-really-static" and "make strip" very little has changed, but configure has lots of line numbers that have shift slightly 2002/07/19 14:53:27-00:00 !flatcap created a template for ntfswipe 2002/07/18 02:57:56-00:00 !flatcap add ntfsundelete to the build. fix rpm build. trawl for typos. 2002/07/08 15:59:34-00:00 !flatcap Added Szaka's ntfsresize to the build 2002/07/03 14:38:40-00:00 !antona Cleanup the build process a bit. 2002/07/03 12:55:52-00:00 !flatcap added CLEANFILES to delete all the build products 2002/07/03 11:30:06-00:00 !flatcap moved undelete,logprogs to EXTRA_PROGRAMS 2002/07/02 23:47:11-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/07/01 13:30:28-00:00 !flatcap lots of comments 2002/06/30 22:46:51-00:00 !flatcap undelete -> ntfsundelete 2002/06/30 21:22:52-00:00 !flatcap a working undelete program, still very alpha 2002/06/01 00:41:45-00:00 !antona huge update! 2002/05/08 22:32:22-00:00 !antona Update 2002/05/08 05:49:35-00:00 !mattjf Started work on ntfsinfo 2002/04/25 07:50:34-00:00 !antona grr. MDK8.1 modified loads of stuff. Put it back with RH7.2 2002/04/24 23:47:42-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/04/15 20:04:29-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/12 15:23:48-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2002/01/26 04:32:35-00:00 !antona RedHat 7.2 - updates 2001/11/17 01:57:53-00:00 !antona Update build system with new document. 2001/11/09 23:36:17-00:00 !antona Bug fixes 2001/11/09 19:21:09-00:00 !antona Fix directories on large clusters and allow 4MB volumes. 2001/08/02 01:44:57-00:00 !antona Add ntfsfix man page and spell fixes. Update to 1.2.1 version and update all text files to go with it and the rpm spec file. 2001/07/25 13:43:10-00:00 !antona 1.0.2 release. Mkntfs now in sbin and minor bugfix to mkntfs man page. 2001/07/24 17:56:21-00:00 !antona OOps . forgot soemthing. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/16 19:22:45-00:00 !antona Get rid of logfile stuff for mkntfs as it is clearly not needed. 2001/06/15 16:47:47-00:00 !antona Integrate logfile.c into mkntfs 2001/06/11 19:11:37-00:00 !antona Fix rpm generation. Circumvent configure bug by cheating in configure.in moving around nonopt to host and setting nonopt to NONE. 2001/06/11 04:02:09-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/10 18:30:17-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. 2001/06/04 23:38:55-00:00 !antona Integrate ldm.c into automatic build process. A bit more on mkntfs and make it compile (do _not_ run as it is - am working on directory creation so chances are it will hang if you run it or something). 2001/06/01 02:07:26-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/02/03 02:03:36-00:00 !antona More files. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- ntfstools/Makefile.in | 588 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 588 insertions(+) diff --git a/ntfstools/Makefile.in b/ntfstools/Makefile.in index e69de29b..2d63031c 100644 --- a/ntfstools/Makefile.in +++ b/ntfstools/Makefile.in @@ -0,0 +1,588 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Need this to enable 64-bit (device) file access functions and parameters. + + +SHELL = @SHELL@ + +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 = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AS = @AS@ +AUTODIRS = @AUTODIRS@ +CC = @CC@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall +@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 +@REALLYSTATIC_TRUE@AM_LIBS = @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@AM_LIBS = @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@AM_LFLAGS = @REALLYSTATIC_TRUE@-static +@REALLYSTATIC_FALSE@AM_LFLAGS = @REALLYSTATIC_FALSE@$(all_libraries) +@REALLYSTATIC_TRUE@LINK = @REALLYSTATIC_TRUE@$(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +@REALLYSTATIC_FALSE@LINK = @REALLYSTATIC_FALSE@$(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ + +bin_PROGRAMS = ntfsfix ntfsinfo +sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete +EXTRA_PROGRAMS = ntfsresize ntfsdump_logfile dumplog ntfswipe + +man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 +EXTRA_MANS = + +CLEANFILES = $(EXTRA_PROGRAMS) + +linux_ntfsincludedir = -I$(top_srcdir)/include + +# Set the include path. +INCLUDES = -I$(top_srcdir)/include $(all_includes) + +ntfsfix_SOURCES = ntfsfix.c +ntfsfix_LDADD = $(AM_LIBS) +ntfsfix_LDFLAGS = $(AM_LFLAGS) + +mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c +mkntfs_LDADD = $(AM_LIBS) +mkntfs_LDFLAGS = $(AM_LFLAGS) + +ntfslabel_SOURCES = ntfslabel.c +ntfslabel_LDADD = $(AM_LIBS) +ntfslabel_LDFLAGS = $(AM_LFLAGS) + +ntfsinfo_SOURCES = ntfsinfo.c +ntfsinfo_LDADD = $(AM_LIBS) +ntfsinfo_LDFLAGS = $(AM_LFLAGS) + +ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h +ntfsundelete_LDADD = $(AM_LIBS) +ntfsundelete_LDFLAGS = $(AM_LFLAGS) + +# We don't distribute these + +ntfswipe_SOURCES = ntfswipe.c ntfswipe.h +ntfswipe_LDADD = $(AM_LIBS) +ntfswipe_LDFLAGS = $(AM_LFLAGS) + +ntfsresize_SOURCES = ntfsresize.c +ntfsresize_LDADD = $(AM_LIBS) +ntfsresize_LDFLAGS = $(AM_LFLAGS) + +ntfsdump_logfile_SOURCES = ntfsdump_logfile.c +ntfsdump_logfile_LDADD = $(AM_LIBS) +ntfsdump_logfile_LDFLAGS = $(AM_LFLAGS) + +dumplog_SOURCES = dumplog.c +dumplog_LDADD = $(AM_LIBS) +dumplog_LDFLAGS = $(AM_LFLAGS) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ +ntfsundelete.8 +bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) +sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ +ntfsundelete$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +LIBS = @LIBS@ +ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsdump_logfile_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +dumplog_OBJECTS = dumplog.$(OBJEXT) +@REALLYSTATIC_FALSE@dumplog_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@dumplog_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsfix_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ +sd.$(OBJEXT) mkntfs.$(OBJEXT) +@REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfslabel_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +man8dir = $(mandir)/man8 +MANS = $(man_MANS) + +NROFF = nroff +DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsfix.8.in \ +ntfsinfo.8.in ntfslabel.8.in ntfsundelete.8.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +DEP_FILES = .deps/attrdef.P .deps/boot.P .deps/dumplog.P .deps/mkntfs.P \ +.deps/ntfsdump_logfile.P .deps/ntfsfix.P .deps/ntfsinfo.P \ +.deps/ntfslabel.P .deps/ntfsresize.P .deps/ntfsundelete.P \ +.deps/ntfswipe.P .deps/sd.P .deps/upcase.P +SOURCES = $(ntfsresize_SOURCES) $(ntfsdump_logfile_SOURCES) $(dumplog_SOURCES) $(ntfswipe_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(ntfsundelete_SOURCES) +OBJECTS = $(ntfsresize_OBJECTS) $(ntfsdump_logfile_OBJECTS) $(dumplog_OBJECTS) $(ntfswipe_OBJECTS) $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(ntfsundelete_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu ntfstools/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +mkntfs.8: $(top_builddir)/config.status mkntfs.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +ntfsfix.8: $(top_builddir)/config.status ntfsfix.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +ntfslabel.8: $(top_builddir)/config.status ntfslabel.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +ntfsinfo.8: $(top_builddir)/config.status ntfsinfo.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +ntfsundelete.8: $(top_builddir)/config.status ntfsundelete.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +mostlyclean-sbinPROGRAMS: + +clean-sbinPROGRAMS: + -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) + +distclean-sbinPROGRAMS: + +maintainer-clean-sbinPROGRAMS: + +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(sbindir) + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(sbin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +ntfsresize$(EXEEXT): $(ntfsresize_OBJECTS) $(ntfsresize_DEPENDENCIES) + @rm -f ntfsresize$(EXEEXT) + $(LINK) $(ntfsresize_LDFLAGS) $(ntfsresize_OBJECTS) $(ntfsresize_LDADD) $(LIBS) + +ntfsdump_logfile$(EXEEXT): $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_DEPENDENCIES) + @rm -f ntfsdump_logfile$(EXEEXT) + $(LINK) $(ntfsdump_logfile_LDFLAGS) $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_LDADD) $(LIBS) + +dumplog$(EXEEXT): $(dumplog_OBJECTS) $(dumplog_DEPENDENCIES) + @rm -f dumplog$(EXEEXT) + $(LINK) $(dumplog_LDFLAGS) $(dumplog_OBJECTS) $(dumplog_LDADD) $(LIBS) + +ntfswipe$(EXEEXT): $(ntfswipe_OBJECTS) $(ntfswipe_DEPENDENCIES) + @rm -f ntfswipe$(EXEEXT) + $(LINK) $(ntfswipe_LDFLAGS) $(ntfswipe_OBJECTS) $(ntfswipe_LDADD) $(LIBS) + +ntfsfix$(EXEEXT): $(ntfsfix_OBJECTS) $(ntfsfix_DEPENDENCIES) + @rm -f ntfsfix$(EXEEXT) + $(LINK) $(ntfsfix_LDFLAGS) $(ntfsfix_OBJECTS) $(ntfsfix_LDADD) $(LIBS) + +ntfsinfo$(EXEEXT): $(ntfsinfo_OBJECTS) $(ntfsinfo_DEPENDENCIES) + @rm -f ntfsinfo$(EXEEXT) + $(LINK) $(ntfsinfo_LDFLAGS) $(ntfsinfo_OBJECTS) $(ntfsinfo_LDADD) $(LIBS) + +mkntfs$(EXEEXT): $(mkntfs_OBJECTS) $(mkntfs_DEPENDENCIES) + @rm -f mkntfs$(EXEEXT) + $(LINK) $(mkntfs_LDFLAGS) $(mkntfs_OBJECTS) $(mkntfs_LDADD) $(LIBS) + +ntfslabel$(EXEEXT): $(ntfslabel_OBJECTS) $(ntfslabel_DEPENDENCIES) + @rm -f ntfslabel$(EXEEXT) + $(LINK) $(ntfslabel_LDFLAGS) $(ntfslabel_OBJECTS) $(ntfslabel_LDADD) $(LIBS) + +ntfsundelete$(EXEEXT): $(ntfsundelete_OBJECTS) $(ntfsundelete_DEPENDENCIES) + @rm -f ntfsundelete$(EXEEXT) + $(LINK) $(ntfsundelete_LDFLAGS) $(ntfsundelete_OBJECTS) $(ntfsundelete_LDADD) $(LIBS) + +install-man8: + $(mkinstalldirs) $(DESTDIR)$(man8dir) + @list='$(man8_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.8*) 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)$(man8dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ + done + +uninstall-man8: + @list='$(man8_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.8*) 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)$(man8dir)/$$inst"; \ + rm -f $(DESTDIR)$(man8dir)/$$inst; \ + done +install-man: $(MANS) + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-man8 +uninstall-man: + @$(NORMAL_UNINSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-man8 + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(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)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = ntfstools + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu ntfstools/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: install-binPROGRAMS install-sbinPROGRAMS +install-exec: install-exec-am + +install-data-am: install-man +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-binPROGRAMS uninstall-sbinPROGRAMS uninstall-man +uninstall: uninstall-am +all-am: Makefile $(PROGRAMS) $(MANS) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) \ + $(DESTDIR)$(mandir)/man8 + + +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-sbinPROGRAMS \ + mostlyclean-compile mostlyclean-libtool \ + mostlyclean-tags mostlyclean-depend mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-binPROGRAMS clean-sbinPROGRAMS clean-compile \ + clean-libtool clean-tags clean-depend clean-generic \ + mostlyclean-am + +clean: clean-am + +distclean-am: distclean-binPROGRAMS distclean-sbinPROGRAMS \ + distclean-compile distclean-libtool distclean-tags \ + distclean-depend distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-binPROGRAMS \ + maintainer-clean-sbinPROGRAMS maintainer-clean-compile \ + maintainer-clean-libtool maintainer-clean-tags \ + maintainer-clean-depend maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS clean-sbinPROGRAMS \ +maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \ +install-sbinPROGRAMS mostlyclean-compile distclean-compile \ +clean-compile maintainer-clean-compile mostlyclean-libtool \ +distclean-libtool clean-libtool maintainer-clean-libtool install-man8 \ +uninstall-man8 install-man uninstall-man tags mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir \ +mostlyclean-depend distclean-depend clean-depend \ +maintainer-clean-depend info-am info dvi-am dvi check check-am \ +installcheck-am installcheck 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 + + +# Extra targets + +strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) + $(STRIP) $^ + +# 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: From 39a5dcc1e46798420edf2acd770f22010f3d9620 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0046/2994] AT_NONAME -> AT_UNNAMED 2002/07/11 16:20:34-00:00 !flatcap whitespace and include guards 2002/07/08 23:27:17-00:00 !flatcap added AT_NONAME so we can search for a (un)named attribute or just iterate through all attributes 2002/07/07 19:44:57-00:00 !antona Change ntfs_read_file_record() not to abort if the inode is not in use. Adapt callers which care to check this themselves. 2002/07/02 23:47:11-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/04/29 01:53:55-00:00 !antona Loads of stuff. Improvements, start on attr pread and attr mst_pread. Write to follow. ntfslabel cleanup and extensions. libntfs cleanups, fixes, etc. 2002/04/28 21:20:27-00:00 !mattjf ntfslabel - Coverted stoucs to ntfs_mbstoucs() - code cleanup - better error checking unistr.c - removed size_t casts from ntfs_mbstoucs() 2002/04/27 19:49:10-00:00 !antona Update library, new APIs ntfs_attr_find_vcn(), misc fixes and cleanups, make all the utilities compile, fix bugs I noticed in ntfslabel and it now works properly. 2002/04/25 18:31:20-00:00 !mattjf Code changes - still broke 2002/04/25 18:07:06-00:00 !mattjf Changes to ntfslabel - still doesn't work yet 2002/04/23 23:27:33-00:00 !antona Fixup the force option in mkntfs.c. Change the ntfs_check_if_mounted so it works on system not implementing {set,get,end}mntent, too. Also make it more powerful in telling us not only if something is mounted but also if it is the fs root and if it is read-only. 2002/04/23 19:37:18-00:00 !mattjf Removed the check_mount() function and added ntfs_check_if_mounted() to mkntfs 2002/04/23 08:25:41-00:00 !mattjf Code cleanup. Removed check_mount() and added a generic ntfs_check_if_mounted() function to the library Better error checking 2002/04/21 10:11:36-00:00 !antona Fix a buglet in the library and same in ntfslabel.c 2002/04/21 09:55:18-00:00 !mattjf Changes to change_label() 2002/04/16 20:56:01-00:00 !antona Add new API unistr.[ch]: ntfs_ucstombs() and make ntfslabel use it 2002/04/12 15:23:48-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2002/04/11 23:11:00-00:00 !flatcap Matt Fanto's changes to retrieve the volume name and a utility to print it (Logical change 1.5) --- ntfstools/ntfslabel.c | 247 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 247 insertions(+) diff --git a/ntfstools/ntfslabel.c b/ntfstools/ntfslabel.c index e69de29b..5d07c0d0 100644 --- a/ntfstools/ntfslabel.c +++ b/ntfstools/ntfslabel.c @@ -0,0 +1,247 @@ +/* + * $Id$ + * + * ntfslabel - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Matthew J. Fanto + * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002 Richard Russon + * + * This utility will display/change the label on an NTFS partition. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "debug.h" +#include "mft.h" + +/* + * print_label - display the current label of a mounted ntfs partition. + * @dev: device to read the label from + * @mnt_flags: mount flags of the device or 0 if not mounted + * @mnt_point: mount point of the device or NULL + * + * Print the label of the device @dev to stdout. + */ +void print_label(const char *dev, const unsigned long mnt_flags, + const char *mnt_point) +{ + ntfs_volume *vol; + + if (mnt_point) { + // Try ioctl and finish if present. + // goto finished; + } + if ((mnt_flags & (NTFS_MF_MOUNTED | NTFS_MF_READONLY)) == + NTFS_MF_MOUNTED) { + fprintf(stderr, "%s is mounted read-write, results may be " + "unreliable.\n", dev); + } + vol = ntfs_mount(dev, MS_RDONLY); + if (!vol) { + fprintf(stderr, "ntfs_mount() on device %s failed: %s\n", dev, + strerror(errno)); + exit(1); + } +//finished: + printf("%s\n", vol->vol_name); + if (ntfs_umount(vol, 0)) + ntfs_umount(vol, 1); +} + +/* + * resize_resident_attribute_value - resize a resident attribute + * @m: mft record containing attribute to resize + * @a: attribute record (inside @m) which to resize + * @new_vsize: the new attribute value size to resize the attribute to + * + * Return 0 on success and -1 with errno = ENOSPC if not enough space in the + * mft record. + */ +int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, + const u32 new_vsize) +{ + int new_alen, new_muse; + + /* New attribute length and mft record bytes used. */ + new_alen = (le16_to_cpu(a->value_offset) + new_vsize + 7) & ~7; + new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + + new_alen; + /* Check for sufficient space. */ + if (new_muse > le32_to_cpu(m->bytes_allocated)) { + errno = ENOSPC; + return -1; + } + /* Move attributes behind @a to their new location. */ + memmove((char*)a + new_alen, (char*)a + le32_to_cpu(a->length), + le32_to_cpu(m->bytes_in_use) - ((char*)a - (char*)m) - + le32_to_cpu(a->length)); + /* Adjust @m to reflect change in used space. */ + m->bytes_in_use = cpu_to_le32(new_muse); + /* Adjust @a to reflect new value size. */ + a->length = cpu_to_le32(new_alen); + a->value_length = cpu_to_le32(new_vsize); + return 0; +} + +/* + * change_label - change the current label on a device + * @dev: device to change the label on + * @mnt_flags: mount flags of the device or 0 if not mounted + * @mnt_point: mount point of the device or NULL + * @label: the new label + * + * Change the label on the device @dev to @label. + */ +void change_label(const char *dev, const unsigned long mnt_flags, + const char *mnt_point, char *label, BOOL force) +{ + ntfs_attr_search_ctx *ctx = NULL; + uchar_t *new_label = NULL; + MFT_RECORD *mrec = NULL; + ATTR_RECORD *a; + ntfs_volume *vol; + int label_len, err = 1; + + if (mnt_point) { + // Try ioctl and return if present. + // return; + } + if (mnt_flags & NTFS_MF_MOUNTED) { + /* If not the root fs or mounted read/write, refuse change. */ + if (!(mnt_flags & NTFS_MF_ISROOT) || + !(mnt_flags & NTFS_MF_READONLY)) { + if (!force) { + fprintf(stderr, "Refusing to change label on " + "read-%s mounted device %s.\n", + mnt_flags & NTFS_MF_READONLY ? + "only" : "write", dev); + return; + } + } + } + vol = ntfs_mount(dev, 0); + if (!vol) { + fprintf(stderr, "ntfs_mount() on device %s failed: %s\n", dev, + strerror(errno)); + exit(1); + } + if (ntfs_read_file_record(vol, (MFT_REF)FILE_Volume, &mrec, NULL)) { + perror("Error reading file record"); + goto err_out; + } + if (!(mrec->flags & MFT_RECORD_IN_USE)) { + fprintf(stderr, "Error: $Volume has been deleted. Run " + "chkdsk to fix this.\n"); + goto err_out; + } + ctx = ntfs_get_attr_search_ctx(NULL, mrec); + if (!ctx) { + perror("Failed to get attribute search context"); + goto err_out; + } + if (ntfs_lookup_attr(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + perror("Lookup of $VOLUME_NAME attribute failed"); + goto err_out; + } + a = ctx->attr; + if (a->non_resident) { + fprintf(stderr, "Error: Attribute $VOLUME_NAME must be " + "resident.\n"); + goto err_out; + } + label_len = ntfs_mbstoucs(label, &new_label, 0); + if (label_len == -1) { + perror("Unable to convert label string to Unicode"); + goto err_out; + } + label_len *= sizeof(uchar_t); + if (label_len > 0x100) { + fprintf(stderr, "New label is too long. Maximum %i characters " + "allowed. Truncating excess characters.\n", + 0x100 / sizeof(uchar_t)); + label_len = 0x100; + new_label[label_len / sizeof(uchar_t)] = cpu_to_le16(L'\0'); + } + if (resize_resident_attribute_value(mrec, a, label_len)) { + perror("Error resizing resident attribute"); + goto err_out; + } + memcpy((char*)a + le16_to_cpu(a->value_offset), new_label, label_len); + if (ntfs_write_mft_record(vol, (MFT_REF)FILE_Volume, mrec)) { + perror("Error writing MFT Record to disk"); + goto err_out; + } + err = 0; +err_out: + if (new_label) + free(new_label); + if (mrec) + free(mrec); + if (ntfs_umount(vol, 0)) + ntfs_umount(vol, 1); + if (err) + exit(1); +} + +int main(int argc, char **argv) +{ + const char *AUTHOR = "Matthew Fanto"; + char *EXEC_NAME = "ntfslabel"; + char *locale, *mnt_point = NULL; + unsigned long mnt_flags; + int err; + // FIXME:Implement option -F meaning force the change. + BOOL force = 0; + + locale = setlocale(LC_ALL, ""); + if (!locale) { + char *locale; + + locale = setlocale(LC_ALL, NULL); + Dprintf("Failed to set locale, using default (%s).\n", locale); + } else + Dprintf("Using locale %s.\n", locale); + if (argc && *argv) + EXEC_NAME = *argv; + if (argc < 2 || argc > 3) { + fprintf(stderr, "%s v%s - %s\n", EXEC_NAME, VERSION, AUTHOR); + fprintf(stderr, "Usage: ntfslabel device [newlabel]\n"); + exit(1); + } + err = ntfs_check_if_mounted(argv[1], &mnt_flags); + if (err) + fprintf(stderr, "Failed to determine whether %s is mounted: " + "%s\n", argv[1], strerror(errno)); + else if (mnt_flags & NTFS_MF_MOUNTED) { + // Not implemented yet. Will be used for ioctl interface to driver. + // mnt_point = ntfs_get_mount_point(argv[1]); + } + if (argc == 2) + print_label(argv[1], mnt_flags, mnt_point); + else + change_label(argv[1], mnt_flags, mnt_point, argv[2], force); + return 0; +} + From 87e81f17081bdf9d69895fcbe1dc6bb51b90b668 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0047/2994] AT_NONAME -> AT_UNNAMED 2002/07/11 16:20:34-00:00 !flatcap whitespace and include guards 2002/07/08 23:27:17-00:00 !flatcap added AT_NONAME so we can search for a (un)named attribute or just iterate through all attributes 2002/07/07 19:44:57-00:00 !antona Change ntfs_read_file_record() not to abort if the inode is not in use. Adapt callers which care to check this themselves. 2002/07/03 21:56:01-00:00 !antona Updates 2002/07/03 14:38:40-00:00 !antona Cleanup the build process a bit. 2002/07/03 11:30:07-00:00 !flatcap moved undelete,logprogs to EXTRA_PROGRAMS 2002/07/02 23:47:11-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/04/29 01:53:55-00:00 !antona Loads of stuff. Improvements, start on attr pread and attr mst_pread. Write to follow. ntfslabel cleanup and extensions. libntfs cleanups, fixes, etc. 2002/04/21 01:26:39-00:00 !antona Cleanup/streamline include file dependencies. 2002/04/20 23:09:43-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/20 01:53:03-00:00 !antona Rename mft code adding ntfs_ prefix. Change all return values to zero on success. Thanks to mattjf for pointing out the inconsistencies. 2002/04/19 21:09:55-00:00 !antona Finished provisional inode.c::ntfs_{open,close}_inode() functions. Also, started defining API provided by attrib.[ch], so far only done search context related stuff. 2002/04/18 18:15:46-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2002/04/16 12:13:53-00:00 !antona New API function mft.[ch]::read_file_record(). Also some cleanups. 2002/04/14 15:26:24-00:00 !antona Remove find_first_attr and make all users use get_attr_search_ctx + find_attr instead. 2001/12/06 01:14:52-00:00 !antona Added mount flags to ntfs_mount and adapted utilities to new mount syntax. 2001/06/16 19:59:51-00:00 !antona Update ntfsdump_logfile and dumplog and the relevant textfiles. 2001/06/16 00:06:17-00:00 !antona dumplog now decodes the first 0x5000 bytes of the logfile given on the command line as fully as possible with the current knowledge of the logfile structures. 2001/06/10 18:30:17-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. 2001/06/10 15:54:20-00:00 !antona Linux-NTFS 0.1.0-pre1 ===================== -fixed up ntfsfix and ntfsdump_logfile -corrected stuff -several bug fixes -fixed (hopefully) final bug with mkntfs (sd generator was wrong due to brain'o) -mkntfs now completed, only need to add a few command line options before first public release. -rpm generation file updated and autostrip modified to make use of install-stip make target instead of stripping manually -made bootsector check verbosity during mount dependent on --enable-debug configure option. 2001/06/01 02:07:26-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 15:36:54-00:00 !flatcap fixed typo 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/03/02 15:06:37-00:00 !antona Full commit of my current dircetory. New files not yet added. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... 2001/01/27 14:22:02-00:00 !antona Added a logfile dumper as a new utility. Almost finished the first ntfsfix release. (Still missingin CVS are attrib.c for ntfslib and the makefiles to build everything.) Fixes for nested packed structure/union typedefs as gcc doesn't automatically nest the __attribute__ ((__packed__)), even though according to the gcc info page it does. (Thanks to Yuri Per for pointing this out.) (Logical change 1.5) --- ntfstools/ntfsdump_logfile.c | 371 +++++++++++++++++++++++++++++++++++ 1 file changed, 371 insertions(+) diff --git a/ntfstools/ntfsdump_logfile.c b/ntfstools/ntfsdump_logfile.c index e69de29b..e785ea96 100644 --- a/ntfstools/ntfsdump_logfile.c +++ b/ntfstools/ntfsdump_logfile.c @@ -0,0 +1,371 @@ +const char *EXEC_NAME = "NtfsDump_LogFile"; +const char *EXEC_VERSION = "1.0"; +/* + * $Id$ + * + * NtfsDump_LogFile - Part of the Linux-NTFS project. + * + * Copyright (c) 2000,2001 Anton Altaparmakov. + * + * This utility will interpret the contents of the journal ($LogFile) of an + * NTFS partition and display the results on stdout. Errors will be output to + * stderr. + * + * Anton Altaparmakov + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS source + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * WARNING: This program might not work on architectures which do not allow + * unaligned access. For those, the program would need to start using + * get/put_unaligned macros (#include ), but not doing it yet, + * since NTFS really mostly applies to ia32 only, which does allow unaligned + * accesses. We might not actually have a problem though, since the structs are + * defined as being packed so that might be enough for gcc to insert the + * correct code. + * + * If anyone using a non-little endian and/or an aligned access only CPU tries + * this program please let me know whether it works or not! + * + * Anton Altaparmakov + */ + +#include +#include +#include +#include +#include +#include + +#include "types.h" +#include "attrib.h" +#include "mft.h" +#include "disk_io.h" +#include "logfile.h" +#include "mst.h" + +int main(int argc, char **argv) +{ + MFT_RECORD *m = NULL; + ATTR_RECORD *a; + s64 l; + unsigned char *lfd = NULL; + ntfs_volume *vol = NULL; + ntfs_attr_search_ctx *ctx = NULL; + RESTART_PAGE_HEADER *rph; + RESTART_AREA *rr; + RESTART_CLIENT *cr; + RECORD_PAGE_HEADER *rcrd_ph; + LOG_RECORD *lr; + int pass = 1; + int i, lps, client; + char zero[4096]; + + memset(zero, 0, sizeof(zero)); + printf("\n"); + if (argc != 2) { + printf("%s v%s - Interpret and display information about the " + "journal\n($LogFile) of an NTFS volume.\n\n" + /* Generic copyright / disclaimer. */ + "Copyright (c) 2000, 2001 Anton Altaparmakov.\n\n" + "%s is free software, released under the GNU " + "General Public License\nand you are welcome to " + "redistribute it under certain conditions.\n" + "%s comes with ABSOLUTELY NO WARRANTY; for details " + "read the GNU\nGeneral Public License to be found " + "in the file COPYING in the main Linux-NTFS\n" + "distribution directory.\n\n" + /* Generic part ends here. */ + "Syntax: ntfsdump_logfile partition_or_file_name\n" + " e.g. ntfsdump_logfile /dev/hda6\n\n", + EXEC_NAME, EXEC_VERSION, EXEC_NAME, EXEC_NAME); + fprintf(stderr, "Error: incorrect syntax\n"); + exit(1); + } + vol = ntfs_mount(argv[1], MS_RDONLY); + if (!vol) { + perror("ntfs_mount(MS_RDONLY) failed"); + exit(1); + } + /* Check NTFS version is ok for us. */ + printf("\nNTFS volume version is %i.%i.\n", vol->major_ver, + vol->minor_ver); + switch (vol->major_ver) { + case 1: + if (vol->minor_ver == 1 || vol->minor_ver == 2) + break; + else + goto version_error; + case 2: case 3: + if (vol->minor_ver == 0) + break; + /* Fall through on error. */ + default: +version_error: + fprintf(stderr, "Error: Unknown NTFS version.\n"); + goto error_exit; + } + /* Read in $LogFile. */ + if (ntfs_read_file_record(vol, FILE_LogFile, &m, NULL)) { + fprintf(stderr, "Error reading mft record for $LogFile.\n"); + goto error_exit; + } + if (!(m->flags & MFT_RECORD_IN_USE)) { + fprintf(stderr, "Error: $LogFile has been deleted. Run chkdsk " + "to fix this.\n"); + goto error_exit; + } + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + perror("Failed to allocate attribute search context"); + goto error_exit; + } + /* Find the $DATA attribute of the $LogFile. */ + if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + fprintf(stderr, "Error: Attribute $DATA was not found in" \ + "$LogFile!\n"); + goto log_file_error; + } + a = ctx->attr; + /* Get length of $LogFile contents. */ + l = get_attribute_value_length(a); + if (!l) { + puts("$LogFile has zero length, no need to write to disk."); + goto log_file_error; + } + /* Allocate a buffer to hold all of the $LogFile contents. */ + lfd = (unsigned char*)malloc(l); + if (!lfd) { + puts("Not enough memory to load $LogFile."); + goto log_file_error; + } + /* Read in the $LogFile into the buffer. */ + if (l != get_attribute_value(vol, m, a, lfd)) { + puts("Amount of data read does not correspond to expected " + "length!"); + free(lfd); + goto log_file_error; + } + /* Check restart area. */ + if (!is_rstr_recordp(lfd)) { + s64 _l; + + for (_l = 0LL; _l < l; _l++) + if (lfd[_l] != (unsigned char)-1) + break; + if (_l < l) + puts("$LogFile contents are corrupt (magic RSTR " + "missing)!"); + else + puts("$LogFile is empty."); + goto log_file_error; + } + /* Do the interpretation and display now. */ + rph = (RESTART_PAGE_HEADER*)lfd; + lps = le32_to_cpu(rph->log_page_size); +pass_loc: + if (ntfs_post_read_mst_fixup((NTFS_RECORD*)rph, lps) || + is_baad_record(rph->magic)) { + puts("$LogFile incomplete multi sector transfer detected! " + "Cannot handle this yet!"); + goto log_file_error; + } + if ((pass == 2) && !memcmp(lfd, rph, lps)) { + printf("2nd restart area fully matches the 1st one. Skipping " + "display.\n"); + goto skip_rstr_pass; + } + if (le16_to_cpu(rph->major_ver != 1) || + le16_to_cpu(rph->minor_ver != 1)) { + fprintf(stderr, "$LogFile version %i.%i! Error: Unknown " + "$LogFile version!\n", + le16_to_cpu(rph->major_ver), + le16_to_cpu(rph->minor_ver)); + goto log_file_error; + } + rr = (RESTART_AREA*)((char*)rph + le16_to_cpu(rph->restart_offset)); + cr = (RESTART_CLIENT*)((char*)rr + + le16_to_cpu(rr->client_array_offset)); + /* Dump of the interpreted $LogFile restart area. */ + if (pass == 1) + printf("\n$LogFile version %i.%i.\n", + le16_to_cpu(rph->major_ver), + le16_to_cpu(rph->minor_ver)); + printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); + printf("magic = RSTR\n"); + printf("ChkDskLsn = 0x%Lx\n", sle64_to_cpu(rph->chkdsk_lsn)); + printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); + printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); + printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); + printf("\n(1st) restart record:\n"); + printf("CurrentLsn = %Lx\n", sle64_to_cpu(rr->current_lsn)); + printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); + printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); + printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); + printf("Flags = 0x%x\n", le16_to_cpu(rr->flags)); + printf("SeqNumberBits = %u (0x%x)\n", le32_to_cpu(rr->seq_number_bits), + le32_to_cpu(rr->seq_number_bits)); + printf("RestartAreaLength = 0x%x\n", + le16_to_cpu(rr->restart_area_length)); + printf("ClientArrayOffset = 0x%x\n", + le16_to_cpu(rr->client_array_offset)); + printf("FileSize = %Lu (0x%Lx)\n", le64_to_cpu(rr->file_size), + le64_to_cpu(rr->file_size)); + if (le64_to_cpu(rr->file_size) != l) + puts("$LogFile restart area indicates a log file size" + "different from the actual size!"); + printf("LastLsnDataLength = 0x%x\n", + le32_to_cpu(rr->last_lsn_data_length)); + printf("RecordLength = 0x%x\n", le16_to_cpu(rr->record_length)); + printf("LogPageDataOffset = 0x%x\n", + le16_to_cpu(rr->log_page_data_offset)); + for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { + printf("\nRestart client record number %i:\n", client); + printf("OldestLsn = 0x%Lx\n", sle64_to_cpu(cr->oldest_lsn)); + printf("ClientRestartLsn = 0x%Lx\n", + sle64_to_cpu(cr->client_restart_lsn)); + printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); + printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); + printf("SeqNumber = 0x%Lx\n", le64_to_cpu(cr->seq_number)); + printf("ClientNameLength = 0x%x\n", + le32_to_cpu(cr->client_name_length)); + if (le32_to_cpu(cr->client_name_length)) { + // convert to ascii and print out. + // printf("ClientName = %u\n", le16_to_cpu(cr->client_name)); + } + /* Size of a restart client record is fixed at 0xa0 bytes. */ + cr = (RESTART_CLIENT*)((char*)cr + 0xa0); + } +skip_rstr_pass: + if (pass == 1) { + rph = (RESTART_PAGE_HEADER*)((char*)rph + lps); + ++pass; + goto pass_loc; + } + rcrd_ph = (RECORD_PAGE_HEADER*)rph; + /* Reuse pass for log record clienter. */ + pass = 0; + printf("\nFinished with restart area. Beginning with log area.\n"); +rcrd_pass_loc: + rcrd_ph = (RECORD_PAGE_HEADER*)((char*)rcrd_ph + lps); + if ((char*)rcrd_ph + lps > (char*)lfd + l) + goto end_of_rcrd_passes; + printf("\nLog record page number %i", pass); + if (!is_rcrd_record(rcrd_ph->magic)) { + for (i = 0; i < lps; i++) + if (((char*)rcrd_ph)[i] != (char)-1) + break; + if (i < lps) + puts(" is corrupt (magic RCRD is missing)."); + else + puts(" is empty."); + pass++; + goto rcrd_pass_loc; + } else + printf(":"); + /* Dump log record page */ + printf("\nmagic = RCRD\n"); + printf("copy.last_lsn/file_offset = 0x%Lx\n", + le64_to_cpu(rcrd_ph->copy.last_lsn)); + printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); + printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); + printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); + printf("header.next_record_offset = 0x%Lx\n", + le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); + printf("header.last_end_lsn = 0x%Lx\n", + le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); + /* + * Where does the 0x40 come from? Is it just usa_offset + + * usa_client * 2 + 7 & ~7 or is it derived from somewhere? + */ + lr = (LOG_RECORD*)((char*)rcrd_ph + 0x40); + client = 0; +log_record_pass: + printf("\nLog record %i:\n", client); + printf("this lsn = 0x%Lx\n", le64_to_cpu(lr->this_lsn)); + printf("client previous lsn = 0x%Lx\n", + le64_to_cpu(lr->client_previous_lsn)); + printf("client undo next lsn = 0x%Lx\n", + le64_to_cpu(lr->client_undo_next_lsn)); + printf("client data length = 0x%x\n", + le32_to_cpu(lr->client_data_length)); + printf("client_id.seq_number = 0x%x\n", + le16_to_cpu(lr->client_id.seq_number)); + printf("client_id.client_index = 0x%x\n", + le16_to_cpu(lr->client_id.client_index)); + printf("record type = 0x%x\n", le32_to_cpu(lr->record_type)); + printf("transaction_id = 0x%x\n", le32_to_cpu(lr->transaction_id)); + printf("flags = 0x%x:", lr->flags); + if (!lr->flags) + printf(" NONE\n"); + else { + int _b = 0; + + if (lr->flags & LOG_RECORD_MULTI_PAGE) { + printf(" LOG_RECORD_MULTI_PAGE"); + _b = 1; + } + if (lr->flags & ~LOG_RECORD_MULTI_PAGE) { + if (_b) + printf(" |"); + printf(" Unknown flags"); + } + printf("\n"); + } + printf("redo_operation = 0x%x\n", le16_to_cpu(lr->redo_operation)); + printf("undo_operation = 0x%x\n", le16_to_cpu(lr->undo_operation)); + printf("redo_offset = 0x%x\n", le16_to_cpu(lr->redo_offset)); + printf("redo_length = 0x%x\n", le16_to_cpu(lr->redo_length)); + printf("undo_offset = 0x%x\n", le16_to_cpu(lr->undo_offset)); + printf("undo_length = 0x%x\n", le16_to_cpu(lr->undo_length)); + printf("target_attribute = 0x%x\n", le16_to_cpu(lr->target_attribute)); + printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); + printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); + printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); + printf("target_vcn = 0x%Lx\n", sle64_to_cpu(lr->target_vcn)); + if (le16_to_cpu(lr->lcns_to_follow) > 0) + printf("Array of lcns:\n"); + for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) + printf("lcn_list[%i].lcn = 0x%Lx\n", i, + sle64_to_cpu(lr->lcn_list[i].lcn)); + client++; + lr = (LOG_RECORD*)((char*)lr + 0x70); + if (((char*)lr + 0x70 <= (char*)rcrd_ph + + le64_to_cpu(rcrd_ph->header.packed.next_record_offset))) + goto log_record_pass; + pass++; + goto rcrd_pass_loc; +end_of_rcrd_passes: +log_file_error: + printf("\n"); + /* Set return code to 0. */ + i = 0; +final_exit: + if (lfd) + free(lfd); + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (m) + free(m); + if (vol && ntfs_umount(vol, 0)) + ntfs_umount(vol, 1); + return i; +error_exit: + i = 1; + goto final_exit; +} + From 94ac119fb43f5885c947d51a55486b12afbde1d7 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0048/2994] AT_NONAME -> AT_UNNAMED 2002/07/11 23:44:14-00:00 !flatcap new function headers and a few function moves 2002/07/11 16:20:34-00:00 !flatcap whitespace and include guards 2002/07/08 23:27:17-00:00 !flatcap added AT_NONAME so we can search for a (un)named attribute or just iterate through all attributes 2002/07/08 00:09:41-00:00 !antona Implement attrib.[hc]::ntfs_rl_pwrite(). Fix a dumb bug in ntfs_attr_pwrite(). 2002/07/02 23:47:11-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/07/01 23:18:37-00:00 !mattjf ntfsinfo update 2002/06/30 21:22:52-00:00 !flatcap a working undelete program, still very alpha 2002/06/25 23:35:49-00:00 !flatcap put back locale line, accidentally deleted put in extra check for inode 2002/06/25 15:17:13-00:00 !flatcap minor bugfix, free used vars, remove duplicated code 2002/06/02 13:57:59-00:00 !antona Fix detection of read-only mounts in volume.c::ntfs_check_mnteent(). 2002/05/14 01:02:04-00:00 !mattjf Bugfix and code cleanup. ntfsinfo now returns the filename 2002/05/13 03:44:10-00:00 !mattjf Update code 2002/05/11 21:43:56-00:00 !mattjf Added new code to ntfsinfo 2002/05/08 05:55:15-00:00 !mattjf started work on ntfsinfo (Logical change 1.5) --- ntfstools/ntfsinfo.c | 195 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) diff --git a/ntfstools/ntfsinfo.c b/ntfstools/ntfsinfo.c index e69de29b..45b6d1bb 100644 --- a/ntfstools/ntfsinfo.c +++ b/ntfstools/ntfsinfo.c @@ -0,0 +1,195 @@ +/*z + * $Id$ + * + * ntfsinfo - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Matthew J. Fanto + * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002 Richard Russon + * + * This utility will dump a file's attributes. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include "mft.h" +#include "attrib.h" +#include "layout.h" +#include "inode.h" + +void get_file_attribute_value(const char *dev, long int i); +void print_standard_information_attr(ntfs_attr_search_ctx * ctx); +void print_file_name_attr(ntfs_attr_search_ctx * ctx); + + +#define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000) + +int main(int argc, char **argv) +{ + const char *AUTHOR = "Matthew J. Fanto"; + const char *EXEC_NAME = "ntfsinfo"; + const char *locale; + long i; + + locale = setlocale(LC_ALL, ""); + if (!locale) { + char *locale; + + locale = setlocale(LC_ALL, NULL); + printf("Failed to set locale, using default (%s).\n", locale); + } else + printf("Using locale %s.\n", locale); + + if (argc < 3 || argc > 4) { + fprintf(stderr, "%s v%s - %s\n", EXEC_NAME, VERSION, AUTHOR); + fprintf(stderr, "Usage: ntfsinfo device inode\n"); + exit(1); + } + + else { + i = atoll(argv[2]); + get_file_attribute_value(argv[1], i); + } + + return 0; +} + +void get_file_attribute_value(const char *dev, long int i) +{ + + MFT_REF mref; + MFT_RECORD *mrec = NULL; + //ATTR_RECORD *attr = NULL; + //FILE_NAME_ATTR *file_name_attr = NULL; + //STANDARD_INFORMATION *standard_information = NULL; + //SECURITY_DESCRIPTOR_RELATIVE *security_descriptor = NULL; + ntfs_attr_search_ctx *ctx = NULL; + ntfs_volume *vol = NULL; + //char *file_name; + ntfs_inode *inode = NULL; + + vol = ntfs_mount(dev, 0); + + mref = (MFT_REF) i; + inode = ntfs_open_inode(vol, mref); + + if (ntfs_read_file_record(vol, mref, &mrec, NULL)) { + perror("Error reading file record!\n"); + exit(1); + } + + ctx = ntfs_get_attr_search_ctx(inode, mrec); + +// print_file_name_attr(ctx); + +// ctx = ntfs_get_attr_search_ctx(inode, mrec); //need to fix this + + print_standard_information_attr(ctx); +} + + +s64 ntfs2time(s64 time) +{ + s64 t; + printf("Original Time: %Li\n",time); + t = time - NTFS_TIME_OFFSET; + t = t / 10000000; + return t; + + +} + +void print_standard_information_attr(ntfs_attr_search_ctx *ctx) +{ + ATTR_RECORD *attr = NULL; + STANDARD_INFORMATION *standard_information_attr = NULL; + + if (ntfs_lookup_attr + (AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + perror("Error looking up $STANDARD_INFORMATION!\n"); + exit(1); + } + + attr = ctx->attr; + + standard_information_attr = + (STANDARD_INFORMATION *) ((char *) attr + + le16_to_cpu(attr->value_offset)); + + printf("Creation time: %Li\n", + ntfs2time(standard_information_attr->creation_time)); +/* printf("Last Data Change Time: %Li\n", + ntfs2time(standard_information_attr->last_data_change_time)); + printf("Last MFT Change Time: %Li\n", + ntfs2time(standard_information_attr->last_mft_change_time)); + printf("Last Access Time: %Li\n", + ntfs2time(standard_information_attr->last_access_time)); + printf("Maxium Versions: %d\n", + standard_information_attr->maximum_versions); + printf("Version Number: %d\n", + standard_information_attr->version_number); + printf("Class ID: %d\n", + standard_information_attr->class_id); + printf("Owner ID: %d\n", + standard_information_attr->owner_id); + printf("Security ID: %d\n", + standard_information_attr->security_id); + +*/ +} + +void print_file_name_attr(ntfs_attr_search_ctx *ctx) +{ + ATTR_RECORD *attr = NULL; + ntfs_attr_search_ctx *c = ctx; + FILE_NAME_ATTR *file_name_attr = NULL; + char *file_name; + + if (ntfs_lookup_attr(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + perror("Error looking up $FILE_NAME_ATTR!\n"); + exit(1); + } + + attr = ctx->attr; + ctx = c; + + file_name_attr = + (FILE_NAME_ATTR *) ((char *) attr + + le16_to_cpu(attr->value_offset)); + + file_name = malloc(file_name_attr->file_name_length * sizeof (char)); + + ntfs_ucstombs(file_name_attr->file_name, + file_name_attr->file_name_length, &file_name, + file_name_attr->file_name_length); + + printf("File Name: %s\n", file_name); + printf("File Name Length: %d\n", file_name_attr->file_name_length); + printf("Allocated Size: %Li\n",sle64_to_cpu(file_name_attr->allocated_size)); + printf("Data Size: %Li\n",sle64_to_cpu(file_name_attr->data_size)); +} + +/*void print_security_descriptor_attr(SECURITY_DESCRIPTOR_RELATIVE *security_descriptor) +{ + +}*/ From fd8f109ed2c2b30fdc5f578f13423960b2e3aa2d Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0049/2994] AT_NONAME -> AT_UNNAMED 2002/07/12 08:18:15-00:00 !antona sorry flatcap. - remove a lot of reorganization which rips the code into incomprehensible order. - all functions were and are again now placed together by logicnot by sheer randomness. - functions which call each other are placed together for example... 2002/07/11 23:44:13-00:00 !flatcap new function headers and a few function moves 2002/07/11 16:20:33-00:00 !flatcap whitespace and include guards 2002/07/08 23:27:16-00:00 !flatcap added AT_NONAME so we can search for a (un)named attribute or just iterate through all attributes 2002/07/08 06:23:22-00:00 !antona Don't use string concatenation with __FUNCTION__ as gcc-3.x don't like it. 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/08 14:12:01-00:00 !antona ntfs_readdir() has arrived. 2002/06/06 20:47:33-00:00 !antona The beginning of the directory operations! Introduce dir.[hc] and ntfs_lookup_inode_by_name(). 2002/06/06 15:41:30-00:00 !antona Add template files for directory handling code. (Logical change 1.5) --- libntfs/dir.c | 925 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 925 insertions(+) diff --git a/libntfs/dir.c b/libntfs/dir.c index e69de29b..dd156fba 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -0,0 +1,925 @@ +/* + * $Id$ + * + * dir.c - Directory handling code. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include + +#include "types.h" +#include "debug.h" +#include "attrib.h" +#include "inode.h" +#include "dir.h" +#include "volume.h" + +/* + * The little endian Unicode string "$I30" as a global constant. + */ +uchar_t I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'), + const_cpu_to_le16('3'), const_cpu_to_le16('0'), + const_cpu_to_le16('\0') }; + +/** + * ntfs_lookup_inode_by_name - find an inode in a directory given its name + * @dir_ni: ntfs inode of the directory in which to search for the name + * @uname: Unicode name for which to search in the directory + * @uname_len: length of the name @uname in Unicode characters + * + * Look for an inode with name @uname in the directory with inode @dir_ni. + * ntfs_lookup_inode_by_name() walks the contents of the directory looking for + * the Unicode name. If the name is found in the directory, the corresponding + * inode number (>= 0) is returned as a mft reference in cpu format, i.e. it + * is a 64-bit number containing the sequence number. + * + * On error, return -1 with errno set to the error code. If the inode is is not + * found errno is ENOENT. + * + * Note, @uname_len does not include the (optional) terminating NULL character. + * + * Note, we look for a case sensitive match first but we also look for a case + * insensitive match at the same time. If we find a case insensitive match, we + * save that for the case that we don't find an exact match, where we return + * the mft reference of the case insensitive match. + * + * If the volume is mounted with the case sensitive flag set, then we only + * allow exact matches. + */ +u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, + const int uname_len) +{ + VCN vcn; + u64 mref = 0; + s64 br; + ntfs_volume *vol = dir_ni->vol; + ntfs_attr_search_ctx *ctx; + INDEX_ROOT *ir; + INDEX_ENTRY *ie; + INDEX_ALLOCATION *ia; + u8 *index_end; + ntfs_attr *ia_na; + int eo, rc; + u32 index_block_size, index_vcn_size; + u8 index_vcn_size_bits; + + if (!dir_ni || !dir_ni->mrec || !uname || uname_len <= 0) { + errno = EINVAL; + return -1; + } + + ctx = ntfs_get_attr_search_ctx(dir_ni, NULL); + if (!ctx) + return -1; + + /* Find the index root attribute in the mft record. */ + if (!ntfs_lookup_attr(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, + 0, ctx)) { + Dprintf("Index root attribute missing in directory inode " + "0x%Lx: %s\n", + (unsigned long long)dir_ni->mft_no, + strerror(errno)); + goto put_err_out; + } + /* Get to the index root value. */ + ir = (INDEX_ROOT*)((u8*)ctx->attr + + le16_to_cpu(ctx->attr->value_offset)); + index_block_size = le32_to_cpu(ir->index_block_size); + if (index_block_size < NTFS_SECTOR_SIZE || + index_block_size & (index_block_size - 1)) { + Dprintf("Index block size %u is invalid.\n", index_block_size); + goto put_err_out; + } + index_end = (u8*)&ir->index + le32_to_cpu(ir->index.index_length); + /* The first index entry. */ + ie = (INDEX_ENTRY*)((u8*)&ir->index + + le32_to_cpu(ir->index.entries_offset)); + /* + * Loop until we exceed valid memory (corruption case) or until we + * reach the last entry. + */ + for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { + /* Bounds checks. */ + if ((u8*)ie < (u8*)ctx->mrec || (u8*)ie + + sizeof(INDEX_ENTRY_HEADER) > index_end || + (u8*)ie + le16_to_cpu(ie->key_length) > + index_end) + goto put_err_out; + /* + * The last entry cannot contain a name. It can however contain + * a pointer to a child node in the B+tree so we just break out. + */ + if (ie->flags & INDEX_ENTRY_END) + break; + /* + * We perform a case sensitive comparison and if that matches + * we are done and return the mft reference of the inode (i.e. + * the inode number together with the sequence number for + * consistency checking). We convert it to cpu format before + * returning. + */ + if (ntfs_are_names_equal(uname, uname_len, + (uchar_t*)&ie->key.file_name.file_name, + ie->key.file_name.file_name_length, + CASE_SENSITIVE, vol->upcase, vol->upcase_len)) { +found_it: + /* + * We have a perfect match, so we don't need to care + * about having matched imperfectly before. + */ + mref = le64_to_cpu(ie->indexed_file); + ntfs_put_attr_search_ctx(ctx); + return mref; + } + /* + * For a case insensitive mount, we also perform a case + * insensitive comparison (provided the file name is not in the + * POSIX namespace). If the comparison matches, we cache the + * mft reference in mref. + */ + if (!NVolCaseSensitive(vol) && + ie->key.file_name.file_name_type && + ntfs_are_names_equal(uname, uname_len, + (uchar_t*)&ie->key.file_name.file_name, + ie->key.file_name.file_name_length, + IGNORE_CASE, vol->upcase, vol->upcase_len)) { + /* Only one case insensitive matching name allowed. */ + if (mref) { + Dputs("Found already cached mft reference in " + "phase 1. Please run chkdsk " + "and if that doesn't find any " + "errors please report you saw " + "this message to " + "linux-ntfs-dev@lists.sf.net."); + goto put_err_out; + } + mref = le64_to_cpu(ie->indexed_file); + } + /* + * Not a perfect match, need to do full blown collation so we + * know which way in the B+tree we have to go. + */ + rc = ntfs_collate_names(uname, uname_len, + (uchar_t*)&ie->key.file_name.file_name, + ie->key.file_name.file_name_length, 1, + IGNORE_CASE, vol->upcase, vol->upcase_len); + /* + * If uname collates before the name of the current entry, there + * is definitely no such name in this index but we might need to + * descend into the B+tree so we just break out of the loop. + */ + if (rc == -1) + break; + /* The names are not equal, continue the search. */ + if (rc) + continue; + /* + * Names match with case insensitive comparison, now try the + * case sensitive comparison, which is required for proper + * collation. + */ + rc = ntfs_collate_names(uname, uname_len, + (uchar_t*)&ie->key.file_name.file_name, + ie->key.file_name.file_name_length, 1, + CASE_SENSITIVE, vol->upcase, vol->upcase_len); + if (rc == -1) + break; + if (rc) + continue; + /* + * Perfect match, this will never happen as the + * ntfs_are_names_equal() call will have gotten a match but we + * still treat it correctly. + */ + goto found_it; + } + /* + * We have finished with this index without success. Check for the + * presence of a child node and if not present return error code + * ENOENT, unless we have got the mft reference of a matching name + * cached in mref in which case return mref. + */ + if (!(ie->flags & INDEX_ENTRY_NODE)) { + ntfs_put_attr_search_ctx(ctx); + if (mref) + return mref; + Dputs("Entry not found."); + errno = ENOENT; + return -1; + } /* Child node present, descend into it. */ + + /* Open the index allocation attribute. */ + ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, I30, 4); + if (!ia_na) { + Dprintf("Failed to open index allocation attribute. Directory " + "inode 0x%Lx is corrupt or driver bug: %s\n", + (unsigned long long)dir_ni->mft_no, + strerror(errno)); + goto put_err_out; + } + + /* Allocate a buffer for the current index block. */ + ia = (INDEX_ALLOCATION*)malloc(index_block_size); + if (!ia) { + Dperror("Failed to allocate buffer for index block"); + goto put_err_out; + } + + /* Determine the size of a vcn in the directory index. */ + if (vol->cluster_size <= index_block_size) { + index_vcn_size = vol->cluster_size; + index_vcn_size_bits = vol->cluster_size_bits; + } else { + index_vcn_size = vol->sector_size; + index_vcn_size_bits = vol->sector_size_bits; + } + + /* Get the starting vcn of the index_block holding the child node. */ + vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8); + +descend_into_child_node: + + /* Read the index block starting at vcn. */ + br = ntfs_attr_mst_pread(ia_na, vcn << index_vcn_size_bits, 1, + index_block_size, ia); + if (br != 1) { + if (br != -1) + errno = EIO; + Dprintf("Failed to read vcn 0x%Lx: %s\n", vcn, strerror(errno)); + goto close_err_out; + } + + if (sle64_to_cpu(ia->index_block_vcn) != vcn) { + Dprintf("Actual VCN (0x%Lx) of index buffer is different from " + "expected VCN (0x%Lx).\n", + (long long)sle64_to_cpu(ia->index_block_vcn), + (long long)vcn); + errno = EIO; + goto close_err_out; + } + if (le32_to_cpu(ia->index.allocated_size) + 0x18 != index_block_size) { + Dprintf("Index buffer (VCN 0x%Lx) of directory inode 0x%Lx " + "has a size (%u) differing from the directory " + "specified size (%u).\n", (long long)vcn, + (unsigned long long)dir_ni->mft_no, + le32_to_cpu(ia->index.allocated_size) + 0x18, + index_block_size); + errno = EIO; + goto close_err_out; + } + index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); + if (index_end > (u8*)ia + index_block_size) { + Dprintf("Size of index buffer (VCN 0x%Lx) of directory inode " + "0x%Lx exceeds maximum size.\n", (long long)vcn, + (unsigned long long)dir_ni->mft_no); + errno = EIO; + goto close_err_out; + } + + /* The first index entry. */ + ie = (INDEX_ENTRY*)((u8*)&ia->index + + le32_to_cpu(ia->index.entries_offset)); + /* + * Iterate similar to above big loop but applied to index buffer, thus + * loop until we exceed valid memory (corruption case) or until we + * reach the last entry. + */ + for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { + /* Bounds check. */ + if ((u8*)ie < (u8*)ia || (u8*)ie + + sizeof(INDEX_ENTRY_HEADER) > index_end || + (u8*)ie + le16_to_cpu(ie->key_length) > + index_end) { + Dprintf("Index entry out of bounds in directory inode " + "0x%Lx.\n", + (unsigned long long)dir_ni->mft_no); + errno = EIO; + goto close_err_out; + } + /* + * The last entry cannot contain a name. It can however contain + * a pointer to a child node in the B+tree so we just break out. + */ + if (ie->flags & INDEX_ENTRY_END) + break; + /* + * We perform a case sensitive comparison and if that matches + * we are done and return the mft reference of the inode (i.e. + * the inode number together with the sequence number for + * consistency checking). We convert it to cpu format before + * returning. + */ + if (ntfs_are_names_equal(uname, uname_len, + (uchar_t*)&ie->key.file_name.file_name, + ie->key.file_name.file_name_length, + CASE_SENSITIVE, vol->upcase, vol->upcase_len)) { +found_it2: + /* + * We have a perfect match, so we don't need to care + * about having matched imperfectly before. + */ + mref = le64_to_cpu(ie->indexed_file); + ntfs_attr_close(ia_na); + ntfs_put_attr_search_ctx(ctx); + return mref; + } + /* + * For a case insensitive mount, we also perform a case + * insensitive comparison (provided the file name is not in the + * POSIX namespace). If the comparison matches, we cache the + * mft reference in mref. + */ + if (!NVolCaseSensitive(vol) && + ie->key.file_name.file_name_type && + ntfs_are_names_equal(uname, uname_len, + (uchar_t*)&ie->key.file_name.file_name, + ie->key.file_name.file_name_length, + IGNORE_CASE, vol->upcase, vol->upcase_len)) { + /* Only one case insensitive matching name allowed. */ + if (mref) { + Dputs("Found already cached mft reference in " + "phase 2. Please run chkdsk " + "and if that doesn't find any " + "errors please report you saw " + "this message to " + "linux-ntfs-dev@lists.sf.net."); + goto close_err_out; + } + mref = le64_to_cpu(ie->indexed_file); + } + /* + * Not a perfect match, need to do full blown collation so we + * know which way in the B+tree we have to go. + */ + rc = ntfs_collate_names(uname, uname_len, + (uchar_t*)&ie->key.file_name.file_name, + ie->key.file_name.file_name_length, 1, + IGNORE_CASE, vol->upcase, vol->upcase_len); + /* + * If uname collates before the name of the current entry, there + * is definitely no such name in this index but we might need to + * descend into the B+tree so we just break out of the loop. + */ + if (rc == -1) + break; + /* The names are not equal, continue the search. */ + if (rc) + continue; + /* + * Names match with case insensitive comparison, now try the + * case sensitive comparison, which is required for proper + * collation. + */ + rc = ntfs_collate_names(uname, uname_len, + (uchar_t*)&ie->key.file_name.file_name, + ie->key.file_name.file_name_length, 1, + CASE_SENSITIVE, vol->upcase, vol->upcase_len); + if (rc == -1) + break; + if (rc) + continue; + /* + * Perfect match, this will never happen as the + * ntfs_are_names_equal() call will have gotten a match but we + * still treat it correctly. + */ + goto found_it2; + } + /* + * We have finished with this index buffer without success. Check for + * the presence of a child node. + */ + if (ie->flags & INDEX_ENTRY_NODE) { + if ((ia->index.flags & NODE_MASK) == LEAF_NODE) { + Dprintf("Index entry with child node found in a leaf " + "node in directory inode 0x%Lx.\n", + (unsigned long long)dir_ni->mft_no); + errno = EIO; + goto close_err_out; + } + /* Child node present, descend into it. */ + vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8); + if (vcn >= 0) + goto descend_into_child_node; + Dprintf("Negative child node vcn in directory inode 0x%Lx.\n", + (unsigned long long)dir_ni->mft_no); + errno = EIO; + goto close_err_out; + } + ntfs_attr_close(ia_na); + ntfs_put_attr_search_ctx(ctx); + /* + * No child node present, return error code ENOENT, unless we have got + * the mft reference of a matching name cached in mref in which case + * return mref. + */ + if (mref) + return mref; + Dputs("Entry not found."); + errno = ENOENT; + return -1; +put_err_out: + eo = EIO; + Dputs("Corrupt directory. Aborting lookup."); +eo_put_err_out: + ntfs_put_attr_search_ctx(ctx); + errno = eo; + return -1; +close_err_out: + eo = errno; + free(ia); + ntfs_attr_close(ia_na); + goto eo_put_err_out; +} + +/* + * The little endian Unicode string ".." for ntfs_readdir(). + */ +static const uchar_t dotdot[3] = { const_cpu_to_le16('.'), + const_cpu_to_le16('.'), + const_cpu_to_le16('\0') }; + +/* + * More helpers for ntfs_readdir(). + */ +typedef union { + INDEX_ROOT *ir; + INDEX_ALLOCATION *ia; +} index_union __attribute__ ((__transparent_union__)); + +typedef enum { + INDEX_TYPE_ROOT, /* index root */ + INDEX_TYPE_ALLOCATION, /* index allocation */ +} INDEX_TYPE; + +/** + * Internal: + * + * ntfs_filldir - ntfs specific filldir method + * @dir_ni: ntfs inode of current directory + * @pos: current position in directory + * @ivcn_bits: log(2) of index vcn size + * @index_type: specifies whether @iu is an index root or an index allocation + * @iu: index root or index block to which @ie belongs + * @ie: current index entry + * @dirent: context for filldir callback supplied by the caller + * @filldir: filldir callback supplied by the caller + * + * Pass information specifying the current directory entry @ie to the @filldir + * callback. + */ +static inline int ntfs_filldir(ntfs_inode *dir_ni, s64 *pos, u8 ivcn_bits, + const INDEX_TYPE index_type, index_union iu, INDEX_ENTRY *ie, + void *dirent, ntfs_filldir_t filldir) +{ + FILE_NAME_ATTR *fn = &ie->key.file_name; + unsigned dt_type; + + /* Advance the position even if going to skip the entry. */ + if (index_type == INDEX_TYPE_ALLOCATION) + *pos = (u8*)ie - (u8*)iu.ia + (sle64_to_cpu( + iu.ia->index_block_vcn) << ivcn_bits) + + dir_ni->vol->mft_record_size; + else /* if (index_type == INDEX_TYPE_ROOT) */ + *pos = (u8*)ie - (u8*)iu.ir; + /* Skip root directory self reference entry. */ + if (MREF_LE(ie->indexed_file) == FILE_root) + return 0; + if (ie->key.file_name.file_attributes & + FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) + dt_type = NTFS_DT_DIR; + else + dt_type = NTFS_DT_REG; + return filldir(dirent, fn->file_name, fn->file_name_length, + fn->file_name_type, *pos, + le64_to_cpu(ie->indexed_file), dt_type); +} + +/** + * Internal: + * + * ntfs_get_parent_mft_ref - find mft reference of parent directory of an inode + * @ni: ntfs inode whose parent directory to find + * + * Find the parent directory of the ntfs inode @ni. To do this, find the first + * file name attribute in the mft record of @ni and return the parent mft + * reference from that. + * + * Note this only makes sense for directories, since files can be hard linked + * from multiple directories and there is no way for us to tell which one is + * being looked for. + * + * Technically directories can have hard links, too, but we consider that as + * illegal as Linux/UNIX do not support directory hard links. + * + * Return the mft reference of the parent directory on success or -1 on error + * with errno set to the error code. + */ +static MFT_REF ntfs_get_parent_mft_ref(ntfs_inode *ni) +{ + MFT_REF mref; + ntfs_attr_search_ctx *ctx; + FILE_NAME_ATTR *fn; + int eo; + + if (!ni) { + errno = EINVAL; + return -1; + } + + ctx = ntfs_get_attr_search_ctx(ni, NULL); + if (!ctx) + return -1; + if (ntfs_lookup_attr(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + Dprintf("No file name found in inode 0x%Lx. Corrupt inode.\n", + (unsigned long long)ni->mft_no); + goto err_out; + } + if (ctx->attr->non_resident) { + Dprintf("File name attribute must be resident. Corrupt inode " + "0x%Lx.\n", (unsigned long long)ni->mft_no); + goto io_err_out; + } + fn = (FILE_NAME_ATTR*)((u8*)ctx->attr + + le16_to_cpu(ctx->attr->value_offset)); + if ((u8*)fn + le32_to_cpu(ctx->attr->value_length) > + (u8*)ctx->attr + le32_to_cpu(ctx->attr->length)) { + Dprintf("Corrupt file name attribute in inode 0x%Lx.\n", + (unsigned long long)ni->mft_no); + goto io_err_out; + } + mref = le64_to_cpu(fn->parent_directory); + ntfs_put_attr_search_ctx(ctx); + return mref; +io_err_out: + errno = EIO; +err_out: + eo = errno; + ntfs_put_attr_search_ctx(ctx); + errno = eo; + return -1; +} + +/** + * ntfs_readdir - read the contents of an ntfs directory + * @dir_ni: ntfs inode of current directory + * @pos: current position in directory + * @dirent: context for filldir callback supplied by the caller + * @filldir: filldir callback supplied by the caller + * + * Parse the index root and the index blocks that are marked in use in the + * index bitmap and hand each found directory entry to the @filldir callback + * supplied by the caller. + * + * Return 0 on success or -1 on error with errno set to the error code. + * + * Note: Index blocks are parsed in ascending vcn order, from which follows + * that the directory entries are not returned sorted. + */ +int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, + void *dirent, ntfs_filldir_t filldir) +{ + s64 i_size, br, ia_pos, bmp_pos, ia_start; + ntfs_volume *vol; + ntfs_attr *ia_na, *bmp_na = NULL; + ntfs_attr_search_ctx *ctx = NULL; + u8 *index_end, *bmp; + INDEX_ROOT *ir; + INDEX_ENTRY *ie; + INDEX_ALLOCATION *ia; + int rc, ir_pos, bmp_buf_size, bmp_buf_pos, eo; + u32 index_block_size, index_vcn_size; + u8 index_block_size_bits, index_vcn_size_bits; + + if (!dir_ni || !pos || !filldir) { + errno = EINVAL; + return -1; + } + + vol = dir_ni->vol; + + Dprintf("Entering for inode 0x%Lx, *pos 0x%Lx.\n", + (unsigned long long)dir_ni->mft_no, (long long)*pos); + + /* Open the index allocation attribute. */ + ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, I30, 4); + if (!ia_na) { + if (errno != ENOENT) { + Dprintf("Failed to open index allocation attribute. " + "Directory inode 0x%Lx is corrupt or " + "bug: %s\n", + (unsigned long long)dir_ni->mft_no, + strerror(errno)); + return -1; + } + i_size = 0; + } else + i_size = ia_na->data_size; + + rc = 0; + + /* Are we at end of dir yet? */ + if (*pos >= i_size + vol->mft_record_size) + goto done; + + /* Emulate . and .. for all directories. */ + if (!*pos) { + rc = filldir(dirent, dotdot, 1, FILE_NAME_POSIX, *pos, + MK_MREF(dir_ni->mft_no, + le16_to_cpu(dir_ni->mrec->sequence_number)), + NTFS_DT_DIR); + if (rc) + goto done; + ++*pos; + } + if (*pos == 1) { + MFT_REF parent_mref; + + parent_mref = ntfs_get_parent_mft_ref(dir_ni); + if (parent_mref == -1) { + Dprintf("Parent directory not found: %s\n", errno); + goto dir_err_out; + } + + rc = filldir(dirent, dotdot, 2, FILE_NAME_POSIX, *pos, + parent_mref, NTFS_DT_DIR); + if (rc) + goto done; + ++*pos; + } + + ctx = ntfs_get_attr_search_ctx(dir_ni, NULL); + if (!ctx) + goto err_out; + + /* Get the offset into the index root attribute. */ + ir_pos = (int)*pos; + /* Find the index root attribute in the mft record. */ + if (!ntfs_lookup_attr(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, + 0, ctx)) { + Dprintf("Index root attribute missing in directory inode " + "0x%Lx.\n", (unsigned long long)dir_ni->mft_no); + goto dir_err_out; + } + /* Get to the index root value. */ + ir = (INDEX_ROOT*)((u8*)ctx->attr + + le16_to_cpu(ctx->attr->value_offset)); + + /* Determine the size of a vcn in the directory index. */ + index_block_size = le32_to_cpu(ir->index_block_size); + if (index_block_size < NTFS_SECTOR_SIZE || + index_block_size & (index_block_size - 1)) { + Dprintf("Index block size %u is invalid.\n", index_block_size); + goto dir_err_out; + } + index_block_size_bits = ffs(index_block_size) - 1; + if (vol->cluster_size <= index_block_size) { + index_vcn_size = vol->cluster_size; + index_vcn_size_bits = vol->cluster_size_bits; + } else { + index_vcn_size = vol->sector_size; + index_vcn_size_bits = vol->sector_size_bits; + } + + /* Are we jumping straight into the index allocation attribute? */ + if (*pos >= vol->mft_record_size) { + ntfs_put_attr_search_ctx(ctx); + ctx = NULL; + goto skip_index_root; + } + + index_end = (u8*)&ir->index + le32_to_cpu(ir->index.index_length); + /* The first index entry. */ + ie = (INDEX_ENTRY*)((u8*)&ir->index + + le32_to_cpu(ir->index.entries_offset)); + /* + * Loop until we exceed valid memory (corruption case) or until we + * reach the last entry or until filldir tells us it has had enough + * or signals an error (both covered by the rc test). + */ + for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { + Dprintf("In index root, offset 0x%x.\n", (u8*)ie - (u8*)ir); + /* Bounds checks. */ + if ((u8*)ie < (u8*)ctx->mrec || (u8*)ie + + sizeof(INDEX_ENTRY_HEADER) > index_end || + (u8*)ie + le16_to_cpu(ie->key_length) > + index_end) + goto dir_err_out; + /* The last entry cannot contain a name. */ + if (ie->flags & INDEX_ENTRY_END) + break; + /* Skip index root entry if continuing previous readdir. */ + if (ir_pos > (u8*)ie - (u8*)ir) + continue; + /* + * Submit the directory entry to ntfs_filldir(), which will + * invoke the filldir() callback as appropriate. + */ + rc = ntfs_filldir(dir_ni, pos, index_vcn_size_bits, + INDEX_TYPE_ROOT, ir, ie, dirent, filldir); + if (rc) { + ntfs_put_attr_search_ctx(ctx); + ctx = NULL; + goto done; + } + } + ntfs_put_attr_search_ctx(ctx); + ctx = NULL; + + /* If there is no index allocation attribute we are finished. */ + if (!ia_na) + goto EOD; + + /* Advance *pos to the beginning of the index allocation. */ + *pos = vol->mft_record_size; + +skip_index_root: + + if (!ia_na) + goto done; + + /* Allocate a buffer for the current index block. */ + ia = (INDEX_ALLOCATION*)malloc(index_block_size); + if (!ia) { + Dperror("Failed to allocate buffer for index block"); + goto err_out; + } + + bmp_na = ntfs_attr_open(dir_ni, AT_BITMAP, I30, 4); + if (!bmp_na) { + Dperror("Failed to open index bitmap attribute"); + goto dir_err_out; + } + + /* Get the offset into the index allocation attribute. */ + ia_pos = *pos - vol->mft_record_size; + + bmp_pos = ia_pos >> index_block_size_bits; + if (bmp_pos >> 3 >= bmp_na->data_size) { + Dputs("Current index position exceeds index bitmap size."); + goto dir_err_out; + } + + bmp_buf_size = min(bmp_na->data_size - (bmp_pos >> 3), 4096); + bmp = (u8*)malloc(bmp_buf_size); + if (!bmp) { + Dperror("Failed to allocate bitmap buffer"); + goto err_out; + } + + br = ntfs_attr_pread(bmp_na, bmp_pos >> 3, bmp_buf_size, bmp); + if (br != bmp_buf_size) { + if (br != -1) + errno = EIO; + Dperror("Failed to read from inde bitmap attribute"); + goto err_out; + } + + bmp_buf_pos = 0; + /* If the index block is not in use find the next one that is. */ + while (!(bmp[bmp_buf_pos >> 3] & (1 << (bmp_buf_pos & 7)))) { +find_next_index_buffer: + bmp_pos++; + bmp_buf_pos++; + /* If we have reached the end of the bitmap, we are done. */ + if (bmp_pos >> 3 >= bmp_na->data_size) + goto EOD; + ia_pos = bmp_pos << index_block_size_bits; + if (bmp_buf_pos >> 3 < bmp_buf_size) + continue; + /* Read next chunk from the index bitmap. */ + if ((bmp_pos >> 3) + bmp_buf_size > bmp_na->data_size) + bmp_buf_size = bmp_na->data_size - (bmp_pos >> 3); + br = ntfs_attr_pread(bmp_na, bmp_pos >> 3, bmp_buf_size, bmp); + if (br != bmp_buf_size) { + if (br != -1) + errno = EIO; + Dperror("Failed to read from inde bitmap attribute"); + goto err_out; + } + } + + Dprintf("Handling index block 0x%Lx.", (long long)bmp_pos); + + /* Read the index block starting at bmp_pos. */ + br = ntfs_attr_mst_pread(ia_na, bmp_pos << index_block_size_bits, 1, + index_block_size, ia); + if (br != 1) { + if (br != -1) + errno = EIO; + Dperror("Failed to read index block"); + goto err_out; + } + + ia_start = ia_pos & ~(s64)(index_block_size - 1); + if (sle64_to_cpu(ia->index_block_vcn) != ia_start >> + index_vcn_size_bits) { + Dprintf("Actual VCN (0x%Lx) of index buffer is different from " + "expected VCN (0x%Lx) in inode 0x%Lx.\n", + (long long)sle64_to_cpu(ia->index_block_vcn), + (long long)ia_start >> index_vcn_size_bits, + (unsigned long long)dir_ni->mft_no); + goto dir_err_out; + } + if (le32_to_cpu(ia->index.allocated_size) + 0x18 != index_block_size) { + Dprintf("Index buffer (VCN 0x%Lx) of directory inode 0x%Lx " + "has a size (%u) differing from the directory " + "specified size (%u).\n", + (long long)ia_start >> index_vcn_size_bits, + (unsigned long long)dir_ni->mft_no, + le32_to_cpu(ia->index.allocated_size) + 0x18, + index_block_size); + goto dir_err_out; + } + index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); + if (index_end > (u8*)ia + index_block_size) { + Dprintf("Size of index buffer (VCN 0x%Lx) of directory inode " + "0x%Lx exceeds maximum size.\n", + (long long)ia_start >> index_vcn_size_bits, + (unsigned long long)dir_ni->mft_no); + goto dir_err_out; + } + /* The first index entry. */ + ie = (INDEX_ENTRY*)((u8*)&ia->index + + le32_to_cpu(ia->index.entries_offset)); + /* + * Loop until we exceed valid memory (corruption case) or until we + * reach the last entry or until ntfs_filldir tells us it has had + * enough or signals an error (both covered by the rc test). + */ + for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { + Dprintf("In index allocation, offset 0x%Lx.\n", + (long long)ia_start + ((u8*)ie - (u8*)ia)); + /* Bounds checks. */ + if ((u8*)ie < (u8*)ia || (u8*)ie + + sizeof(INDEX_ENTRY_HEADER) > index_end || + (u8*)ie + le16_to_cpu(ie->key_length) > + index_end) { + Dprintf("Index entry out of bounds in directory inode " + "0x%Lx.\n", + (unsigned long long)dir_ni->mft_no); + goto dir_err_out; + } + /* The last entry cannot contain a name. */ + if (ie->flags & INDEX_ENTRY_END) + break; + /* Skip index entry if continuing previous readdir. */ + if (ia_pos - ia_start > (u8*)ie - (u8*)ia) + continue; + /* + * Submit the directory entry to ntfs_filldir(), which will + * invoke the filldir() callback as appropriate. + */ + rc = ntfs_filldir(dir_ni, pos, index_vcn_size_bits, + INDEX_TYPE_ALLOCATION, ia, ie, dirent, filldir); + if (rc) + goto done; + } + goto find_next_index_buffer; +EOD: + /* We are finished, set *pos to EOD. */ + *pos = i_size + vol->mft_record_size; +done: + if (bmp_na) + ntfs_attr_close(bmp_na); + ntfs_attr_close(ia_na); +#ifdef DEBUG + if (!rc) + Dprintf("EOD, *pos 0x%Lx, returning 0.\n", (long long)*pos); + else + Dprintf("filldir returned %i, *pos 0x%Lx, returning 0.\n", + rc, (long long)*pos); +#endif + return 0; +dir_err_out: + errno = EIO; +err_out: + eo = errno; + Dprintf("%s() failed.\n", __FUNCTION__); + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (bmp_na) + ntfs_attr_close(bmp_na); + ntfs_attr_close(ia_na); + errno = eo; + return -1; +} + From 1acb46ffebfc11f28622e713a314e7c4b94a9f51 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0050/2994] AT_NONAME -> AT_UNNAMED 2002/07/12 08:18:15-00:00 !antona sorry flatcap. - remove a lot of reorganization which rips the code into incomprehensible order. - all functions were and are again now placed together by logicnot by sheer randomness. - functions which call each other are placed together for example... 2002/07/11 23:44:13-00:00 !flatcap new function headers and a few function moves 2002/07/11 16:20:33-00:00 !flatcap whitespace and include guards 2002/07/09 19:17:49-00:00 !flatcap move the runlist functions from attrib.c to runlist.c 2002/07/08 23:27:16-00:00 !flatcap added AT_NONAME so we can search for a (un)named attribute or just iterate through all attributes 2002/07/08 06:23:22-00:00 !antona Don't use string concatenation with __FUNCTION__ as gcc-3.x don't like it. 2002/07/07 19:44:57-00:00 !antona Change ntfs_read_file_record() not to abort if the inode is not in use. Adapt callers which care to check this themselves. 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/01 00:41:45-00:00 !antona huge update! 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/21 01:13:50-00:00 !antona Remove commented out include 2002/04/21 01:12:55-00:00 !antona Fix mkntfs again. 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/20 01:53:02-00:00 !antona Rename mft code adding ntfs_ prefix. Change all return values to zero on success. Thanks to mattjf for pointing out the inconsistencies. 2002/04/19 21:21:46-00:00 !antona Remove compile time warning... 2002/04/19 21:09:55-00:00 !antona Finished provisional inode.c::ntfs_{open,close}_inode() functions. Also, started defining API provided by attrib.[ch], so far only done search context related stuff. 2002/04/19 18:23:56-00:00 !antona Add foundation of new inode API. (Logical change 1.5) --- libntfs/inode.c | 311 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 311 insertions(+) diff --git a/libntfs/inode.c b/libntfs/inode.c index e69de29b..f4485cbd 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -0,0 +1,311 @@ +/* + * $Id$ + * + * inode.c - Inode handling code. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include + +#include "types.h" +#include "inode.h" +#include "debug.h" +#include "mft.h" +#include "attrib.h" +#include "runlist.h" + +/** + * Internal: + * + * __allocate_ntfs_inode - desc + */ +static __inline__ ntfs_inode *__allocate_ntfs_inode(ntfs_volume *vol) +{ + ntfs_inode *ni; + + ni = (ntfs_inode*)calloc(1, sizeof(ntfs_inode)); + if (ni) + ni->vol = vol; + return ni; +} + +/** + * Internal: + * + * allocate_ntfs_inode - desc + */ +ntfs_inode *allocate_ntfs_inode(ntfs_volume *vol) +{ + return __allocate_ntfs_inode(vol); +} + +/** + * Internal: + * + * __release_ntfs_inode - desc + */ +static __inline__ int __release_ntfs_inode(ntfs_inode *ni) +{ + if (NInoDirty(ni)) + Dputs("Eeek. Discarding dirty inode!"); + if (NInoAttrList(ni) && ni->attr_list) + free(ni->attr_list); + if (NInoAttrListNonResident(ni) && ni->attr_list_rl) + free(ni->attr_list_rl); + if (ni->mrec) + free(ni->mrec); + free(ni); + return 0; +} + +/** + * ntfs_open_inode - open an inode ready for access + * @vol: volume to get the inode from + * @mref: inode number / mft record number to open + * + * Allocate an ntfs_inode structure and initialize it for the given inode + * specified by @mref. @mref specifies the inode number / mft record to read, + * including the sequence number, which can be 0 if no sequence number checking + * is to be performed. + * + * Then, allocate a buffer for the mft record, read the mft record from the + * volume @vol, and attach it to the ntfs_inode structure (->mrec). The + * mft record is mst deprotected and sanity checked for validity and we abort + * if deprotection or checks fail. + * + * Finally, search for an attribute list attribute in the mft record and if one + * is found, load the attribute list attribute value and attach it to the + * ntfs_inode structure (->attr_list). Also set the NI_AttrList bit to indicate + * this as well as the NI_AttrListNonResident bit if the the attribute list is + * non-resident. In that case, also attach the decompressed run list to the + * ntfs_inode structure (->attr_list_rl). + * + * Return a pointer to the ntfs_inode structure on success or NULL on error, + * with errno set to the error code. + */ +ntfs_inode *ntfs_open_inode(ntfs_volume *vol, const MFT_REF mref) +{ + s64 l; + ntfs_inode *ni; + ntfs_attr_search_ctx *ctx; + int err = 0; + + Dprintf("%s(): Entering for inode 0x%Lx.\n", __FUNCTION__, MREF(mref)); + if (!vol) { + errno = EINVAL; + return NULL; + } + ni = __allocate_ntfs_inode(vol); + if (!ni) + return NULL; + if (ntfs_read_file_record(vol, mref, &ni->mrec, NULL)) + goto err_out; + if (!(ni->mrec->flags & MFT_RECORD_IN_USE)) + goto err_out; + ni->mft_no = MREF(mref); + ctx = ntfs_get_attr_search_ctx(ni, NULL); + if (!ctx) + goto err_out; + if (ntfs_lookup_attr(AT_ATTRIBUTE_LIST, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (errno != ENOENT) + goto put_err_out; + /* Attribute list attribute not present so we are done. */ + ntfs_put_attr_search_ctx(ctx); + return ni; + } + NInoSetAttrList(ni); + l = get_attribute_value_length(ctx->attr); + if (!l) + goto put_err_out; + if (l > 0x40000) { + err = EIO; + goto put_err_out; + } + ni->attr_list_size = l; + ni->attr_list = malloc(ni->attr_list_size); + if (!ni->attr_list) + goto put_err_out; + l = get_attribute_value(vol, ni->mrec, ctx->attr, ni->attr_list); + if (!l) + goto put_err_out; + if (l != ni->attr_list_size) { + err = EIO; + goto put_err_out; + } + if (!ctx->attr->non_resident) { + /* Attribute list attribute is resident so we are done. */ + ntfs_put_attr_search_ctx(ctx); + return ni; + } + NInoSetAttrListNonResident(ni); + // FIXME: We are duplicating work here! (AIA) + ni->attr_list_rl = ntfs_decompress_mapping_pairs(vol, ctx->attr, NULL); + if (ni->attr_list_rl) { + /* We got the run list, so we are done. */ + ntfs_put_attr_search_ctx(ctx); + return ni; + } + err = EIO; +put_err_out: + if (!err) + err = errno; + ntfs_put_attr_search_ctx(ctx); +err_out: + if (!err) + err = errno; + __release_ntfs_inode(ni); + errno = err; + return NULL; +} + +/** + * ntfs_close_inode - close an ntfs inode and free all associated memory + * @ni: ntfs inode to close + * + * Make sure the ntfs inode @ni is clean. + * + * If the ntfs inode @ni is a base inode, close all associated extent inodes, + * then deallocate all memory attached to it, and finally free the ntfs inode + * structure itself. + * + * If it is an extent inode, we postpone to when the base inode is being closed + * with ntfs_close_inode() to tear down all structures and free all allocated + * memory. That way we keep the extent records cached in memory so we get an + * efficient ntfs_lookup_attr(). + * + * Return 0 on success or -1 on error with errno set to the error code. On + * error, @ni has not been freed. The user should attempt to handle the error + * and call ntfs_close_inode() again. The following error codes are defined: + * + * EBUSY @ni is dirty and/or the attribute list run list is dirty. + */ +int ntfs_close_inode(ntfs_inode *ni) +{ + // TODO: This needs to be replaced with a flush to disk attempt. (AIA) + if (NInoDirty(ni) || NInoAttrListDirty(ni)) { + errno = EBUSY; + return -1; + } + /* Is this a base inode with mapped extent inodes? */ + if (ni->nr_extents > 0) { + int i; + + // FIXME: Handle dirty case for each extent inode! (AIA) + for (i = 0; i < ni->nr_extents; i++) + __release_ntfs_inode(ni->extent_nis[i]); + free(ni->extent_nis); + } + return __release_ntfs_inode(ni); +} + +/** + * ntfs_open_extent_inode - load an extent inode and attach it to its base + * @base_ni: base ntfs inode + * @mref: mft reference of the extent inode to load (in little endian) + * + * First check if the extent inode @mref is already attached to the base ntfs + * inode @base_ni, and if so, return a pointer to the attached extent inode. + * + * If the extent inode is not already attached to the base inode, allocate an + * ntfs_inode structure and initialize it for the given inode @mref. @mref + * specifies the inode number / mft record to read, including the sequence + * number, which can be 0 if no sequence number checking is to be performed. + * + * Then, allocate a buffer for the mft record, read the mft record from the + * volume @base_ni->vol, and attach it to the ntfs_inode structure (->mrec). + * The mft record is mst deprotected and sanity checked for validity and we + * abort if deprotection or checks fail. + * + * Finally attach the ntfs inode to its base inode @base_ni and return a + * pointer to the ntfs_inode structure on success or NULL on error, with errno + * set to the error code. + */ +ntfs_inode *ntfs_open_extent_inode(ntfs_inode *base_ni, const MFT_REF mref) +{ + u64 mft_no = MREF_LE(mref); + ntfs_inode *ni; + ntfs_inode **extent_nis; + int i; + + if (!base_ni) { + errno = EINVAL; + return NULL; + } + Dprintf("Opening extent inode %Lu (base mft record 0x%Lu).\n", + (unsigned long long)mft_no, + (unsigned long long)base_ni->mft_no); + /* Is the extent inode already open and attached to the base inode? */ + if (base_ni->nr_extents > 0) { + extent_nis = base_ni->extent_nis; + for (i = 0; i < base_ni->nr_extents; i++) { + u16 seq_no; + + ni = extent_nis[i]; + if (mft_no != ni->mft_no) + continue; + /* Verify the sequence number if given. */ + seq_no = MSEQNO_LE(mref); + if (seq_no && seq_no != le16_to_cpu( + ni->mrec->sequence_number)) { + Dputs("Found stale extent mft reference! " + "Corrupt file system. Run " + "chkdsk."); + errno = EIO; + return NULL; + } + /* We are done, return the extent inode. */ + return ni; + } + } + /* Wasn't there, we need to load the extent inode. */ + ni = __allocate_ntfs_inode(base_ni->vol); + if (!ni) + return NULL; + if (ntfs_read_file_record(base_ni->vol, le64_to_cpu(mref), &ni->mrec, + NULL)) + goto err_out; + ni->mft_no = mft_no; + ni->nr_extents = -1; + ni->base_ni = base_ni; + /* Attach extent inode to base inode, reallocating memory if needed. */ + if (!(base_ni->nr_extents & ~3)) { + i = (base_ni->nr_extents + 4) * sizeof(ntfs_inode *); + + extent_nis = (ntfs_inode**)malloc(i); + if (!extent_nis) + goto err_out; + if (base_ni->extent_nis) { + memcpy(extent_nis, base_ni->extent_nis, + i - 4 * sizeof(ntfs_inode *)); + free(base_ni->extent_nis); + } + base_ni->extent_nis = extent_nis; + } + base_ni->extent_nis[base_ni->nr_extents++] = ni; + return ni; +err_out: + i = errno; + __release_ntfs_inode(ni); + errno = i; + Dperror("Failed to open extent inode"); + return NULL; +} + From b47fe4d7adfe05ef006283669dc6f4111bd917c5 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0051/2994] AT_NONAME -> AT_UNNAMED 2002/07/14 17:21:32-00:00 !szaka Move ntfs_set_volume_flags() from attrib[ch] to volume.[ch] 2002/07/14 13:18:01-00:00 !szaka ntfs_reset_logfile(): delete a NOOP 2002/07/14 12:34:44-00:00 !szaka ntfs_reset_logfile(): free resources in error, handle partial I/O 2002/07/12 12:38:54-00:00 !szaka Rewrote $LogFile reset using new inode API and moved it from ntfsfix to libntfs as ntfs_reset_logfile(). ntfsresize also resets log file. 2002/07/12 08:18:15-00:00 !antona sorry flatcap. - remove a lot of reorganization which rips the code into incomprehensible order. - all functions were and are again now placed together by logicnot by sheer randomness. - functions which call each other are placed together for example... 2002/07/12 07:10:44-00:00 !szaka NTFS_V* version macros and ntfs_is_version_supported() added. Modified ntfsfix and ntfsresize to use them. 2002/07/11 23:44:13-00:00 !flatcap new function headers and a few function moves 2002/07/11 16:20:34-00:00 !flatcap whitespace and include guards 2002/07/09 19:17:49-00:00 !flatcap move the runlist functions from attrib.c to runlist.c 2002/07/09 01:01:40-00:00 !flatcap more noname changes 2002/07/08 23:27:16-00:00 !flatcap added AT_NONAME so we can search for a (un)named attribute or just iterate through all attributes 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/07 01:16:20-00:00 !antona Updates 2002/06/02 23:02:20-00:00 !antona More fixes and updates. 2002/06/02 13:57:59-00:00 !antona Fix detection of read-only mounts in volume.c::ntfs_check_mnteent(). 2002/06/01 00:41:45-00:00 !antona huge update! 2002/04/29 01:53:55-00:00 !antona Loads of stuff. Improvements, start on attr pread and attr mst_pread. Write to follow. ntfslabel cleanup and extensions. libntfs cleanups, fixes, etc. 2002/04/27 19:49:09-00:00 !antona Update library, new APIs ntfs_attr_find_vcn(), misc fixes and cleanups, make all the utilities compile, fix bugs I noticed in ntfslabel and it now works properly. 2002/04/25 08:22:14-00:00 !antona Can't type.. 2002/04/25 08:19:32-00:00 !antona Improve function description. 2002/04/23 23:27:33-00:00 !antona Fixup the force option in mkntfs.c. Change the ntfs_check_if_mounted so it works on system not implementing {set,get,end}mntent, too. Also make it more powerful in telling us not only if something is mounted but also if it is the fs root and if it is read-only. 2002/04/23 08:37:07-00:00 !antona Fix minor buglet in volume.c and tidy up white space. 2002/04/23 08:29:13-00:00 !mattjf Minor change to ntfs_check_if_mounted() description. 2002/04/23 08:25:41-00:00 !mattjf Code cleanup. Removed check_mount() and added a generic ntfs_check_if_mounted() function to the library Better error checking 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/20 23:09:43-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/20 01:53:02-00:00 !antona Rename mft code adding ntfs_ prefix. Change all return values to zero on success. Thanks to mattjf for pointing out the inconsistencies. 2002/04/19 21:09:55-00:00 !antona Finished provisional inode.c::ntfs_{open,close}_inode() functions. Also, started defining API provided by attrib.[ch], so far only done search context related stuff. 2002/04/16 20:56:01-00:00 !antona Add new API unistr.[ch]: ntfs_ucstombs() and make ntfslabel use it 2002/04/16 15:34:32-00:00 !antona Fix the library... 2002/04/16 12:13:53-00:00 !antona New API function mft.[ch]::read_file_record(). Also some cleanups. 2002/04/15 20:04:28-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/15 19:02:41-00:00 !antona Really fix the library and mkntfs while at it. 2002/04/15 18:54:07-00:00 !antona Update library for the new API. 2002/04/15 00:42:08-00:00 !antona Big rewrite of disk_io.c. Now should have stable API for low level disk access. Move all mft record related stuff from disk_io.c to mft.c. 2002/04/14 14:08:30-00:00 !antona Cleanup library code. Throw away unused stuff. 2002/04/12 15:23:47-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2002/04/11 23:10:59-00:00 !flatcap Matt Fanto's changes to retrieve the volume name and a utility to print it 2001/12/06 01:14:52-00:00 !antona Added mount flags to ntfs_mount and adapted utilities to new mount syntax. 2001/06/10 15:54:20-00:00 !antona Linux-NTFS 0.1.0-pre1 ===================== -fixed up ntfsfix and ntfsdump_logfile -corrected stuff -several bug fixes -fixed (hopefully) final bug with mkntfs (sd generator was wrong due to brain'o) -mkntfs now completed, only need to add a few command line options before first public release. -rpm generation file updated and autostrip modified to make use of install-stip make target instead of stripping manually -made bootsector check verbosity during mount dependent on --enable-debug configure option. 2001/06/01 02:07:26-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 14:29:12-00:00 !antona Almost fixed compilaton. Remember to declare a struct type with struct NAME { declaration }; rather than the bogus struct { declaration NAME }; then can use typedef NAME othername; on a forward declaration of NAME (struct NAME;) and all is fine... 2001/04/11 11:49:16-00:00 !antona Header file reorganisation so that it compiles. 2001/04/10 23:37:19-00:00 !antona Ok, ntfsd was a mistake for userspace. It increases complexity no end while not giving us much functionality. Lets get it working and then worry about the kernel. - As it was the idea originally anyway, so this is just a return on the right track. (-8 We keep the timer and signal handler but the only thing we do is to set a bool flag (ntfs_need_sync) and we will just check this in appropriate places and if it is true we call ntfs_sync_volumes() which sets it back to false. This means no more locking at all of any description and no need to worry about the signal handler interrupting things in bad ways and/or at bad times in the main code. 2001/04/09 00:05:37-00:00 !antona More or less finished file handling. (Probably some useful functions are still missing but they will be implemented as need arises.) One thing that is stupid at the moment is we don't limit the amount of cached mft_records so if you were to load loads the machine would eventually run out of memory... Can't happen with files as they are limited to 1000, unless you are short of memory. (Hard limit at the moment, set in ntfs_mount(). Maybe ntfsd should be monitoring memory usage and be throwing out unused cache entries and closed_files? That would mean to have locking everywhere, though.) Still missing: - Convert old code to use new stuff. - Add non-resident attributes somewhere. Either into the mft_entry structure or into the ntfs_file structure, but which? At the moment I tend to mft_entry so they can be synced together with the entries by ntfsd. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/04/08 01:58:29-00:00 !antona User space conversion of locking complete. I settled for using simple spinlocks and atomic variables and instead of deadlocking/livelocking when using spin_lock(), use spin_trylock() in a while letting go of the cpu between each call and making a maximum of 100 iterations (or we return EDEADLK error code). This is not the most efficient way, especially as can't have multiple readers but it is the simplest way to go about things. Should now have (almost) all required helper functions for dealing with mft entries implemented. Now need the file handling and then convert the whole project to use the new code and then can finally get back to work on attribute searching... 2001/04/05 20:14:45-00:00 !antona Commit of current state of development including locking a la kernel. This doesn't work on user space (semaphores don't work). Just want to have it committed. Will take out locking / modify it where necessary to use pthreads ASAP. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/03/31 15:27:34-00:00 !antona Added new name comparison function. 2001/03/06 02:10:55-00:00 !antona Allow variable length upcase table. Progressing on find_next_attr(). 2001/03/05 03:04:40-00:00 !antona Corresponding changes to the library. 2001/03/02 15:05:54-00:00 !antona Commit latest library state. !!!NOTE!!! This breaks everything!!! I'm in the middle of rewritting the find_attribute stuff in attrib.c at the moment. 2001/01/30 12:55:21-00:00 !antona Fixed the compilation issues. 2001/01/25 22:25:43-00:00 !antona More files added to ntfs lib. Fixed some consistency problems. 2001/01/25 14:00:43-00:00 !antona Added volume.c code and fixed some typos and inconsistencies. (Logical change 1.5) --- libntfs/volume.c | 1102 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1102 insertions(+) diff --git a/libntfs/volume.c b/libntfs/volume.c index e69de29b..07f68f4e 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -0,0 +1,1102 @@ +/* + * $Id$ + * + * volume.c - NTFS volume handling code. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "volume.h" +#include "attrib.h" +#include "mft.h" +#include "bootsect.h" +#include "disk_io.h" +#include "debug.h" +#include "inode.h" +#include "runlist.h" + +/** + * Internal: + * + * __allocate_ntfs_volume - + * + */ +static ntfs_volume *__allocate_ntfs_volume(void) +{ + return (ntfs_volume*)calloc(1, sizeof(ntfs_volume)); +} + +/** + * Internal: + * + * __release_ntfs_volume - + * + */ +static void __release_ntfs_volume(ntfs_volume *v) +{ + if (v->fd) + close(v->fd); + if (v->dev_name) + free(v->dev_name); + if (v->vol_name) + free(v->vol_name); + if (v->lcnbmp_na) + ntfs_attr_close(v->lcnbmp_na); + if (v->lcnbmp_ni) + ntfs_close_inode(v->lcnbmp_ni); + if (v->mftbmp_na) + ntfs_attr_close(v->mftbmp_na); + if (v->mft_na) + ntfs_attr_close(v->mft_na); + if (v->mft_ni) + ntfs_close_inode(v->mft_ni); + if (v->mftmirr_na) + ntfs_attr_close(v->mftmirr_na); + if (v->mftmirr_ni) + ntfs_close_inode(v->mftmirr_ni); + if (v->upcase) + free(v->upcase); + free(v); +} + +/* External declaration for internal function. */ +extern ntfs_inode *allocate_ntfs_inode(ntfs_volume *); + +/** + * Internal: + * + * ntfs_load_mft - load the $MFT and setup the ntfs volume with it + * @vol: ntfs volume whose $MFT to load + * + * Load $MFT from @vol and setup @vol with it. After calling this function the + * volume @vol is ready for use by all read access functions provided by the + * ntfs library. + * + * Return 0 on success and -1 on error with errno set to the error code. + */ +static int ntfs_load_mft(ntfs_volume *vol) +{ + VCN next_vcn, last_vcn, highest_vcn; + s64 l; + MFT_RECORD *mb = NULL; + ntfs_attr_search_ctx *ctx = NULL; + ATTR_RECORD *a; + int eo; + + /* Manually setup an ntfs_inode. */ + vol->mft_ni = allocate_ntfs_inode(vol); + mb = (MFT_RECORD*)malloc(vol->mft_record_size); + if (!vol->mft_ni || !mb) { + Dperror("Error allocating memory for $MFT"); + goto error_exit; + } + vol->mft_ni->mft_no = 0; + vol->mft_ni->mrec = mb; + /* Can't use any of the higher level functions yet! */ + l = ntfs_mst_pread(vol->fd, vol->mft_lcn << vol->cluster_size_bits, 1, + vol->mft_record_size, mb); + if (l != 1) { + if (l != -1) + errno = EIO; + Dperror("Error reading $MFT"); + goto error_exit; + } + if (is_baad_record(mb->magic)) { + Dputs("Error: Incomplete multi sector transfer detected in " + "$MFT."); + goto io_error_exit; + } + if (!is_mft_record(mb->magic)) { + Dputs("Error: $MFT has invalid magic."); + goto io_error_exit; + } + ctx = ntfs_get_attr_search_ctx(vol->mft_ni, mb); + if (!ctx) { + Dperror("Failed to allocate attribute search context"); + goto error_exit; + } + if (p2n(ctx->attr) < p2n(mb) || + (char*)ctx->attr > (char*)mb + vol->mft_record_size) { + Dputs("Error: $MFT is corrupt."); + goto io_error_exit; + } + /* Find the $ATTRIBUTE_LIST attribute in $MFT if present. */ + if (ntfs_lookup_attr(AT_ATTRIBUTE_LIST, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (errno != ENOENT) { + Dputs("Error: $MFT has corrupt attribute list."); + goto io_error_exit; + } + goto mft_has_no_attr_list; + } + NInoSetAttrList(vol->mft_ni); + l = get_attribute_value_length(ctx->attr); + if (l <= 0 || l > 0x40000) { + Dputs("Error: $MFT/$ATTRIBUTE_LIST has invalid length."); + goto io_error_exit; + } + vol->mft_ni->attr_list_size = l; + vol->mft_ni->attr_list = malloc(l); + if (!vol->mft_ni->attr_list) { + Dputs("Error: failed to allocate buffer for attribute list."); + goto error_exit; + } + l = get_attribute_value(vol, vol->mft_ni->mrec, ctx->attr, + vol->mft_ni->attr_list); + if (!l) { + Dputs("Error: failed to get value of $MFT/$ATTRIBUTE_LIST."); + goto io_error_exit; + } + if (l != vol->mft_ni->attr_list_size) { + Dputs("Error: got unexepected amount of data when reading " + "$MFT/$ATTRIBUTE_LIST."); + goto io_error_exit; + } + if (ctx->attr->non_resident) { + NInoSetAttrListNonResident(vol->mft_ni); + // FIXME: We are duplicating work here! (AIA) + vol->mft_ni->attr_list_rl = ntfs_decompress_mapping_pairs(vol, + ctx->attr, NULL); + if (!vol->mft_ni->attr_list_rl) { + Dperror("Error: failed to get run list for " + "$MFT/$ATTRIBUTE_LIST"); + goto error_exit; + } + } +mft_has_no_attr_list: + /* We now have a fully setup ntfs inode for $MFT in vol->mft_ni. */ + + /* Get an ntfs attribute for $MFT/$DATA and set it up, too. */ + vol->mft_na = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0); + if (!vol->mft_na) { + Dperror("Failed to open ntfs attribute"); + goto error_exit; + } + /* Set the number of mft records. */ + vol->nr_mft_records = vol->mft_na->data_size >> + vol->mft_record_size_bits; + /* Read all extents from the $DATA attribute in $MFT. */ + ntfs_reinit_attr_search_ctx(ctx); + last_vcn = vol->mft_na->allocated_size >> vol->cluster_size_bits; + highest_vcn = next_vcn = 0; + a = NULL; + while (!ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, next_vcn, NULL, 0, ctx)) { + run_list_element *nrl; + + a = ctx->attr; + /* $MFT must be non-resident. */ + if (!a->non_resident) { + Dputs("$MFT must be non-resident but a resident " + "extent was found. $MFT is corrupt. " + "Run chkdsk."); + goto io_error_exit; + } + /* $MFT must be uncompressed and unencrypted. */ + if (a->flags & ATTR_COMPRESSION_MASK || + a->flags & ATTR_IS_ENCRYPTED) { + Dputs("$MFT must be uncompressed and unencrypted but " + "a compressed/encrypted extent was " + "found. $MFT is corrupt. Run chkdsk."); + goto io_error_exit; + } + /* + * Decompress the mapping pairs array of this extent and merge + * the result into the existing run list. No need for locking + * as we have exclusive access to the inode at this time and we + * are a mount in progress task, too. + */ + nrl = ntfs_decompress_mapping_pairs(vol, a, vol->mft_na->rl); + if (!nrl) { + Dperror("decompress_mapping_pairs() failed"); + goto error_exit; + } + vol->mft_na->rl = nrl; + + /* Get the lowest vcn for the next extent. */ + highest_vcn = sle64_to_cpu(a->highest_vcn); + next_vcn = highest_vcn + 1; + + /* Only one extent or error, which we catch below. */ + if (next_vcn <= 0) + break; + + /* Avoid endless loops due to corruption. */ + if (next_vcn < sle64_to_cpu(a->lowest_vcn)) { + Dputs("$MFT has corrupt attribute list attribute. " + "Run chkdsk."); + goto io_error_exit; + } + } + if (!a) { + Dputs("$MFT/$DATA attribute not found. $MFT is corrupt. " + "Run chkdsk."); + goto io_error_exit; + } + if (highest_vcn && highest_vcn != last_vcn - 1) { + Dputs("Failed to load the complete run list for $MFT/$DATA. " + "Bug or corrupt $MFT. Run chkdsk."); + Dprintf("highest_vcn = 0x%Lx, last_vcn - 1 = 0x%Lx\n", + (long long)highest_vcn, + (long long)last_vcn - 1); + goto io_error_exit; + } + /* Done with the $Mft mft record. */ + ntfs_put_attr_search_ctx(ctx); + ctx = NULL; + /* + * The volume is now setup so we can use all read access functions. + */ + vol->mftbmp_na = ntfs_attr_open(vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0); + if (!vol->mftbmp_na) { + Dperror("Failed to open $MFT/$BITMAP"); + goto error_exit; + } + return 0; +io_error_exit: + errno = EIO; +error_exit: + eo = errno; + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (vol->mft_na) { + ntfs_attr_close(vol->mft_na); + vol->mft_na = NULL; + } + if (vol->mft_ni) { + ntfs_close_inode(vol->mft_ni); + vol->mft_ni = NULL; + } + errno = eo; + return -1; +} + +/** + * Internal: + * + * ntfs_load_mftmirr - load the $MFTMirr and setup the ntfs volume with it + * @vol: ntfs volume whose $MFTMirr to load + * + * Load $MFTMirr from @vol and setup @vol with it. After calling this function + * the volume @vol is ready for use by all write access functions provided by + * the ntfs library (assuming ntfs_load_mft() has been called successfully + * beforehand). + * + * Return 0 on success and -1 on error with errno set to the error code. + */ +static int ntfs_load_mftmirr(ntfs_volume *vol) +{ + int i; + run_list_element rl[2]; + + vol->mftmirr_ni = ntfs_open_inode(vol, FILE_MFTMirr); + if (!vol->mftmirr_ni) { + Dperror("Failed to open inode $MFTMirr"); + return -1; + } + /* Get an ntfs attribute for $MFTMirr/$DATA, too. */ + vol->mftmirr_na = ntfs_attr_open(vol->mftmirr_ni, AT_DATA, AT_UNNAMED, 0); + if (!vol->mftmirr_na) { + Dperror("Failed to open $MFTMirr/$DATA"); + goto error_exit; + } + if (ntfs_attr_map_run_list(vol->mftmirr_na, 0) < 0) { + Dperror("Failed to map run list of $MFTMirr/$DATA"); + goto error_exit; + } + /* Construct the mft mirror run list. */ + rl[0].vcn = 0; + rl[0].lcn = vol->mftmirr_lcn; + rl[0].length = (vol->mftmirr_size * vol->mft_record_size + + vol->cluster_size - 1) / vol->cluster_size; + rl[1].vcn = rl[0].length; + rl[1].lcn = LCN_ENOENT; + rl[1].length = 0; + /* Compare the two run lists. They must be identical. */ + i = 0; + do { + if (rl[i].vcn != vol->mftmirr_na->rl[i].vcn || + rl[i].lcn != vol->mftmirr_na->rl[i].lcn || + rl[i].length != vol->mftmirr_na->rl[i].length) { + Dputs("Error: $MFTMirr location mismatch! Run chkdsk."); + errno = EIO; + goto error_exit; + } + } while (rl[i++].length); + return 0; +error_exit: + i = errno; + if (vol->mftmirr_na) { + ntfs_attr_close(vol->mftmirr_na); + vol->mftmirr_na = NULL; + } + ntfs_close_inode(vol->mftmirr_ni); + vol->mftmirr_ni = NULL; + errno = i; + return -1; +} + +/** + * ntfs_startup_volume - allocate and setup an ntfs volume + * @name: name of device/file to open + * @rwflag: optional mount flags + * + * Load, verify and parse bootsector; load and setup $MFT and $MFTMirr. After + * calling this function, the volume is setup sufficiently to call all read + * and write access functions provided by the library. + * + * Return the allocated volume structure on success and NULL on error with + * errno set to the error code. + */ +ntfs_volume *ntfs_startup_volume(const char *name, unsigned long rwflag) +{ + s64 br; + const char *OK = "OK"; + const char *FAILED = "FAILED"; + ntfs_volume *vol; + NTFS_BOOT_SECTOR *bs = NULL; + int eo; +#ifdef DEBUG + BOOL debug = 1; +#else + BOOL debug = 0; +#endif + + /* Allocate the volume structure. */ + vol = __allocate_ntfs_volume(); + if (!vol) + return NULL; + /* Make a copy of the partition name. */ + if (!(vol->dev_name = strdup(name))) + goto error_exit; + /* Allocate the boot sector structure. */ + if (!(bs = (NTFS_BOOT_SECTOR *)malloc(sizeof(NTFS_BOOT_SECTOR)))) + goto error_exit; + if (rwflag & MS_RDONLY) + NVolSetReadOnly(vol); + Dprintf("Reading bootsector... "); + if ((vol->fd = open(name, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) < 0) { + Dputs(FAILED); + Dperror("Error opening partition file"); + goto error_exit; + } + /* Now read the bootsector. */ + br = ntfs_pread(vol->fd, 0, sizeof(NTFS_BOOT_SECTOR), bs); + if (br != sizeof(NTFS_BOOT_SECTOR)) { + Dputs(FAILED); + if (br != -1) + errno = EINVAL; + if (!br) + Dputs("Error: partition is smaller than bootsector " + "size. Weird!"); + else + Dperror("Error reading bootsector"); + goto error_exit; + } + Dputs(OK); + if (!is_boot_sector_ntfs(bs, !debug)) { + Dprintf("Error: %s is not a valid NTFS partition!\n", name); + errno = EINVAL; + goto error_exit; + } + if (parse_ntfs_boot_sector(vol, bs) < 0) { + Dperror("Failed to parse ntfs bootsector"); + goto error_exit; + } + free(bs); + bs = NULL; + + /* Need to setup $MFT so we can use the library read functions. */ + Dprintf("Loading $MFT... "); + if (ntfs_load_mft(vol) < 0) { + Dputs(FAILED); + Dperror("Failed to load $MFT"); + goto error_exit; + } + Dputs(OK); + + /* Need to setup $MFTMirr so we can use the write functions, too. */ + Dprintf("Loading $MFTMirr... "); + if (ntfs_load_mftmirr(vol) < 0) { + Dputs(FAILED); + Dperror("Failed to load $MFTMirr"); + goto error_exit; + } + Dputs(OK); + return vol; +error_exit: + eo = errno; + if (bs) + free(bs); + if (vol) + __release_ntfs_volume(vol); + errno = eo; + return NULL; +} + +/** + * ntfs_mount - open ntfs volume + * @name: name of device/file to open + * @rwflag: optional mount flags + * + * This function mounts an ntfs volume. @name should contain the name of the + * device/file to mount as the ntfs volume. + * + * @rwflags is an optional second parameter. The same flags are used as for + * the mount system call (man 2 mount). Currently only the following flag + * is implemented: + * MS_RDONLY - mount volume read-only + * + * The function opens the device or file @name and verifies that it contains a + * valid bootsector. Then, it allocates an ntfs_volume structure and initializes + * some of the values inside the structure from the information stored in the + * bootsector. It proceeds to load the necessary system files and completes + * setting up the structure. + * + * Return the allocated volume structure on success and NULL on error with + * errno set to the error code. + * + * Note, that a copy is made of @name, and hence it can be discarded as + * soon as the function returns. + */ +ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) +{ + s64 l; + const char *OK = "OK"; + const char *FAILED = "FAILED"; + ntfs_volume *vol; + u8 *m = NULL, *m2 = NULL; + ntfs_attr_search_ctx *ctx = NULL; + ntfs_inode *ni; + ntfs_attr *na; + ATTR_RECORD *a; + VOLUME_INFORMATION *vinf; + uchar_t *vname; + int i, j, eo; + u32 u; + + if (!name) { + errno = EINVAL; + return NULL; + } + + vol = ntfs_startup_volume(name, rwflag); + if (!vol) { + Dperror("Failed to startup volume"); + return NULL; + } + + /* Load data from $MFT and $MFTMirr and compare the contents. */ + m = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); + m2 = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); + if (!m || !m2) { + Dperror("Failed to allocate memory"); + goto error_exit; + } + + l = ntfs_attr_mst_pread(vol->mft_na, 0, vol->mftmirr_size, + vol->mft_record_size, m); + if (l != vol->mftmirr_size) { + if (l == -1) + Dperror("Failed to read $MFT"); + else { + Dputs("Length of data not equal expected length."); + errno = EIO; + } + goto error_exit; + } + l = ntfs_attr_mst_pread(vol->mftmirr_na, 0, vol->mftmirr_size, + vol->mft_record_size, m2); + if (l != vol->mftmirr_size) { + if (l == -1) + Dperror("Failed to read $MFTMirr"); + else { + Dputs("Length of data not equal expected length."); + errno = EIO; + } + goto error_exit; + } + Dprintf("Comparing $MFTMirr to $MFT... "); + for (i = 0; i < vol->mftmirr_size; ++i) { + const char *ESTR[12] = { "$MFT", "$MFTMirr", "$LogFile", + "$Volume", "$AttrDef", "root directory", "$Bitmap", + "$Boot", "$BadClus", "$Secure", "$UpCase", "$Extend" }; + const char *s; + + if (i < 12) + s = ESTR[i]; + else if (i < 16) + s = "system file"; + else + s = "mft record"; + + if (is_baad_recordp(m + i * vol->mft_record_size)) { + Dputs("FAILED"); + Dprintf("$MFT error: Incomplete multi sector transfer " + "detected in %s.\n", s); + goto io_error_exit; + } + if (!is_mft_recordp(m + i * vol->mft_record_size)) { + Dputs("FAILED"); + Dprintf("$MFT error: Invalid mft record for %s.\n", s); + goto io_error_exit; + } + if (is_baad_recordp(m2 + i * vol->mft_record_size)) { + Dputs("FAILED"); + Dprintf("$MFTMirr error: Incomplete multi sector " + "transfer detected in %s.\n", s); + goto io_error_exit; + } + if (!is_mft_recordp(m2 + i * vol->mft_record_size)) { + Dputs("FAILED"); + Dprintf("$MFTMirr error: Invalid mft record for %s.\n", + s); + goto io_error_exit; + } + if (memcmp((u8*)m + i * vol->mft_record_size, (u8*)m2 + + i * vol->mft_record_size, + ntfs_get_mft_record_data_size((MFT_RECORD*)( + (u8*)m + i * vol->mft_record_size)))) { + Dputs(FAILED); + Dputs("$MFTMirr does not match $MFT. Run chkdsk."); + goto io_error_exit; + } + } + Dputs(OK); + + free(m2); + free(m); + m = m2 = NULL; + + /* Now load the bitmap from $Bitmap. */ + Dprintf("Loading $Bitmap... "); + vol->lcnbmp_ni = ntfs_open_inode(vol, FILE_Bitmap); + if (!vol->lcnbmp_ni) { + Dputs(FAILED); + Dperror("Failed to open inode"); + goto error_exit; + } + /* Get an ntfs attribute for $Bitmap/$DATA. */ + vol->lcnbmp_na = ntfs_attr_open(vol->lcnbmp_ni, AT_DATA, AT_UNNAMED, 0); + if (!vol->lcnbmp_na) { + Dputs(FAILED); + Dperror("Failed to open ntfs attribute"); + goto error_exit; + } + /* Done with the $BitMap mft record. */ + Dputs(OK); + + /* Now load the upcase table from $UpCase. */ + Dprintf("Loading $UpCase... "); + ni = ntfs_open_inode(vol, FILE_UpCase); + if (!ni) { + Dputs(FAILED); + Dperror("Failed to open inode"); + goto error_exit; + } + /* Get an ntfs attribute for $UpCase/$DATA. */ + na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); + if (!na) { + Dputs(FAILED); + Dperror("Failed to open ntfs attribute"); + goto error_exit; + } + /* + * Note: Normally, the upcase table has a length equal to 65536 + * 2-byte Unicode characters but allow for different cases, so no + * checks done. Just check we don't overflow 32-bits worth of Unicode + * characters. + */ + if (na->data_size & ~0x1ffffffffULL) { + Dputs(FAILED); + Dputs("Error: Upcase table is too big (max 32-bit allowed)."); + errno = EINVAL; + goto error_exit; + } + vol->upcase_len = na->data_size >> 1; + vol->upcase = (uchar_t*)malloc(na->data_size); + if (!vol->upcase) { + Dputs(FAILED); + Dputs("Not enough memory to load $UpCase."); + goto error_exit; + } + /* Read in the $DATA attribute value into the buffer. */ + l = ntfs_attr_pread(na, 0, na->data_size, vol->upcase); + if (l != na->data_size) { + Dputs(FAILED); + Dputs("Amount of data read does not correspond to expected " + "length!"); + errno = EIO; + goto error_exit; + } + /* Done with the $UpCase mft record. */ + Dputs(OK); + ntfs_attr_close(na); + if (ntfs_close_inode(ni)) + Dperror("Failed to close inode, leaking memory"); + + /* + * Now load $Volume and set the version information and flags in the + * vol structure accordingly. + */ + Dprintf("Loading $Volume... "); + ni = ntfs_open_inode(vol, FILE_Volume); + if (!ni) { + Dputs(FAILED); + Dperror("Failed to open inode"); + goto error_exit; + } + /* Get an ntfs attribute for $UpCase/$DATA. */ + ctx = ntfs_get_attr_search_ctx(ni, NULL); + if (!ctx) { + Dputs(FAILED); + Dperror("Failed to allocate attribute search context"); + goto error_exit; + } + /* Find the $VOLUME_INFORMATION attribute. */ + if (ntfs_lookup_attr(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, + ctx)) { + Dputs(FAILED); + Dputs("$VOLUME_INFORMATION attribute not found in " + "$Volume?!?"); + goto error_exit; + } + a = ctx->attr; + /* Has to be resident. */ + if (a->non_resident) { + Dputs(FAILED); + Dputs("Error: Attribute $VOLUME_INFORMATION must be resident " + "(and it isn't)!"); + errno = EIO; + goto error_exit; + } + /* Get a pointer to the value of the attribute. */ + vinf = (VOLUME_INFORMATION*)(le16_to_cpu(a->value_offset) + (char*)a); + /* Sanity checks. */ + if ((char*)vinf + le32_to_cpu(a->value_length) > (char*)ctx->mrec + + le16_to_cpu(ctx->mrec->bytes_in_use) || + le16_to_cpu(a->value_offset) + le32_to_cpu( + a->value_length) > le32_to_cpu(a->length)) { + Dputs(FAILED); + Dputs("Error: Attribute $VOLUME_INFORMATION in $Volume is " + "corrupt!"); + errno = EIO; + goto error_exit; + } + /* Setup vol from the volume information attribute value. */ + vol->major_ver = vinf->major_ver; + vol->minor_ver = vinf->minor_ver; + /* Do not use le16_to_cpu() macro here as our VOLUME_FLAGS are + defined using cpu_to_le16() macro and hence are consistent. */ + vol->flags = vinf->flags; + /* Find the $VOLUME_NAME attribute. */ + ntfs_reinit_attr_search_ctx(ctx); + if (ntfs_lookup_attr(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + Dputs(FAILED); + Dputs("$VOLUME_NAME attribute not found in $Volume?!?"); + goto error_exit; + } + a = ctx->attr; + /* Has to be resident. */ + if (a->non_resident) { + Dputs(FAILED); + Dputs("Error: Attribute $VOLUME_NAME must be resident!"); + errno = EIO; + goto error_exit; + } + /* Get a pointer to the value of the attribute. */ + vname = (uchar_t*)(le16_to_cpu(a->value_offset) + (char*)a); + u = le32_to_cpu(a->value_length) / 2; + /* Convert Unicode volume name to current locale multibyte format. */ + vol->vol_name = NULL; + if (ntfs_ucstombs(vname, u, &vol->vol_name, 0) == -1) { + Dperror("Error: Volume name could not be converted to " + "current locale"); + Dputs("Forcing name into ASCII by replacing non-ASCII " + "characters with underscores."); + vol->vol_name = malloc(u + 1); + if (!vol->vol_name) { + Dputs(FAILED); + Dputs("Error: Unable to allocate memory for volume " + "name!"); + goto error_exit; + } + for (j = 0; j < u; j++) { + uchar_t uc = le16_to_cpu(vname[j]); + if (uc > 0xff) + uc = (uchar_t)'_'; + vol->vol_name[j] = (char)uc; + } + vol->vol_name[u] = '\0'; + } + Dputs(OK); + ntfs_put_attr_search_ctx(ctx); + ctx = NULL; + if (ntfs_close_inode(ni)) + Dperror("Failed to close inode, leaking memory"); + + /* FIXME: Need to deal with FILE_AttrDef. (AIA) */ + + return vol; +io_error_exit: + errno = EIO; +error_exit: + eo = errno; + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (m) + free(m); + if (m2) + free(m2); + if (vol) + __release_ntfs_volume(vol); + errno = eo; + return NULL; +} + +/** + * ntfs_umount - close ntfs volume + * @vol: address of ntfs_volume structure of volume to close + * @force: if true force close the volume even if it is busy + * + * Deallocate all structures (including @vol itself) associated with the ntfs + * volume @vol. + * + * Return 0 on success. On error return -1 with errno set appropriately + * (most likely to one of EAGAIN, EBUSY or EINVAL). The EAGAIN error means that + * an operation is in progress and if you try the close later the operation + * might be completed and the close succeed. + * + * If @force is true (i.e. not zero) this function will close the volume even + * if this means that data might be lost. + * + * @vol must have previously been returned by a call to ntfs_mount(). + * + * @vol itself is deallocated and should no longer be dereferenced after this + * function returns success. If it returns an error then nothing has been done + * so it is safe to continue using @vol. + */ +int ntfs_umount(ntfs_volume *vol, const BOOL force) +{ + if (!vol) { + errno = EINVAL; + return -1; + } + __release_ntfs_volume(vol); + return 0; +} + +#ifdef HAVE_MNTENT_H +/** + * Internal: + * + * ntfs_check_mntent - desc + * + * If you are wanting to use this, you actually wanted to use + * ntfs_check_if_mounted(), you just didn't realize. (-: + * + * See description of ntfs_check_if_mounted(), below. + */ +static int ntfs_check_mntent(const char *file, unsigned long *mnt_flags) +{ + struct mntent *mnt; + FILE *f; + + if (!(f = setmntent(MOUNTED, "r"))) + return -1; + while ((mnt = getmntent(f))) + if (!strcmp(file, mnt->mnt_fsname)) + break; + endmntent(f); + if (!mnt) + return 0; + *mnt_flags = NTFS_MF_MOUNTED; + if (!strcmp(mnt->mnt_dir, "/")) + *mnt_flags |= NTFS_MF_ISROOT; + if (hasmntopt(mnt, "ro") && !hasmntopt(mnt, "rw")) + *mnt_flags |= NTFS_MF_READONLY; + return 0; +} + +#endif + +/** + * ntfs_check_if_mounted - check if an ntfs volume is currently mounted + * @file: device file to check + * @mnt_flags: pointer into which to return the ntfs mount flags (see volume.h) + * + * If the running system does not support the {set,get,end}mntent() calls, + * just return 0 and set *@mnt_flags to zero. + * + * When the system does support the calls, ntfs_check_if_mounted() first tries + * to find the device @file in /etc/mtab (or wherever this is kept on the + * running system). If it is not found, assume the device is not mounted and + * return 0 and set *@mnt_flags to zero. + * + * If the device @file is found, set the NTFS_MF_MOUNTED flags in *@mnt_flags. + * + * Further if @file is mounted as the file system root ("/"), set the flag + * NTFS_MF_ISROOT in *@mnt_flags. + * + * Finally, check if the file system is mounted read-only, and if so set the + * NTFS_MF_READONLY flag in *@mnt_flags. + * + * On sucess, return 0 with *@mnt_flags set to the ntfs mount flags. + * + * On error, return -1 with errno set to the error code. + */ +int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags) +{ + *mnt_flags = 0; +#ifdef HAVE_MNTENT_H + return ntfs_check_mntent(file, mnt_flags); +#else + return 0; +#endif +} + +/** + * ntfs_version_supported - check if NTFS version is supported. + * @vol: ntfs volume whose version we're interested in. + * + * The function checks if the NTFS volume version is known or not. + * Version 1.1 and 1.2 are used by Windows NT4. + * Version 2.x is used by Windows 2000 Beta's + * Version 3.0 is used by Windows 2000. + * Version 3.1 is used by Windows XP and .NET. + * + * Return 0 if NTFS version is supported otherwise -1 with errno set. + * + * The following error codes are defined: + * ENOTSUP Unknown NTFS versions + * EINVAL Invalid argument + */ +int ntfs_is_version_supported(ntfs_volume *vol) +{ + u8 major, minor; + + if (!vol) { + errno = EINVAL; + return -1; + } + + major = vol->major_ver; + minor = vol->minor_ver; + + if (NTFS_V1_1(major, minor) || NTFS_V1_2(major, minor)) + return 0; + + if (NTFS_V2_X(major, minor)) + return 0; + + if (NTFS_V3_0(major, minor) || NTFS_V3_1(major, minor)) + return 0; + + errno = ENOTSUP; + return -1; +} + +/** + * ntfs_reset_logfile - "empty" $LogFile data attribute value + * @vol: ntfs volume whose $LogFile we intend to reset. + * + * Fill the value of the $LogFile data attribute, i.e. the contents of + * the file, with 0xff's, thus marking the journal as empty. + * FIXME(?): We might need to zero the LSN field of every single mft + * record as well. (But, first try without doing that and see what + * happens, since chkdsk might pickup the pieces and do it for us...) + * + * On success return 0. + * + * On error, return -1 with errno set to the error code. + */ +int ntfs_reset_logfile(ntfs_volume *vol) +{ + ntfs_inode *ni; + ntfs_attr *na; + s64 len, pos, count; + char buf[NTFS_BUF_SIZE]; + int eo; + + if (!vol) { + errno = EINVAL; + return -1; + } + + if ((ni = ntfs_open_inode(vol, FILE_LogFile)) == NULL) { + Dperror("Failed to open inode FILE_LogFile.\n"); + return -1; + } + + if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) { + Dperror("Failed to open $FILE_LogFile/$DATA\n"); + goto error_exit; + } + + /* The $DATA attribute of the $LogFile has to be non-resident. */ + if (!NAttrNonResident(na)) { + Dprintf("$LogFile $DATA attribute is resident!?!\n"); + errno = EIO; + goto io_error_exit; + } + + /* Get length of $LogFile contents. */ + len = na->data_size; + if (!len) { + Dprintf("$LogFile has zero length, no disk write needed.\n"); + return 0; + } + + /* Read $LogFile until its end. We do this as a check for correct + length thus making sure we are decompressing the mapping pairs + array correctly and hence writing below is safe as well. */ + pos = 0; + while ((count = ntfs_attr_pread(na, pos, NTFS_BUF_SIZE, buf)) > 0) + pos += count; + + if (count == -1 || pos != len) { + Dprintf("Amount of $LogFile data read does not " + "correspond to expected length!"); + if (count != -1) + errno = EIO; + goto io_error_exit; + } + + /* Fill the buffer with 0xff's. */ + memset(buf, -1, NTFS_BUF_SIZE); + + /* Set the $DATA attribute. */ + pos = 0; + while ((count = len - pos) > 0) { + if (count > NTFS_BUF_SIZE) + count = NTFS_BUF_SIZE; + + if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { + Dprintf("Failed to set the $LogFile attribute value."); + if (count != -1) + errno = EIO; + goto io_error_exit; + } + pos += count; + } + + ntfs_attr_close(na); + return ntfs_close_inode(ni); + +io_error_exit: + eo = errno; + ntfs_attr_close(na); + errno = eo; +error_exit: + eo = errno; + ntfs_close_inode(ni); + errno = eo; + return -1; +} + +/** + * ntfs_set_volume_flags - set the flags of an ntfs volume + * @vol: ntfs volume where we set the volume flags + * @flags: new flags + * + * Set the on-disk volume flags in the mft record of $Volume and + * on volume @vol to @flags. + * + * Return 0 on successful and -1 if not, with errno set to the error code. + */ +int ntfs_set_volume_flags(ntfs_volume *vol, const u16 flags) +{ + MFT_RECORD *m = NULL; + ATTR_RECORD *r; + VOLUME_INFORMATION *c; + ntfs_attr_search_ctx *ctx; + int ret = -1; /* failure */ + + if (!vol) { + errno = EINVAL; + return -1; + } + + if (ntfs_read_file_record(vol, FILE_Volume, &m, NULL)) { + Dperror("Failed to read $Volume"); + return -1; + } + + /* Sanity check */ + if (!(m->flags & MFT_RECORD_IN_USE)) { + Dprintf("Error: $Volume has been deleted. Cannot " + "handle this yet. Run chkdsk to fix this.\n"); + errno = EIO; + goto err_exit; + } + + /* Get a pointer to the volume information attribute. */ + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + Dperror("Failed to allocate attribute search context"); + goto err_exit; + } + if (ntfs_lookup_attr(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, + ctx)) { + Dputs("Error: Attribute $VOLUME_INFORMATION was not found in " + "$Volume!"); + goto err_out; + } + r = ctx->attr; + /* Sanity check. */ + if (r->non_resident) { + Dputs("Error: Attribute $VOLUME_INFORMATION must be resident " + "(and it isn't)!"); + errno = EIO; + goto err_out; + } + /* Get a pointer to the value of the attribute. */ + c = (VOLUME_INFORMATION*)(le16_to_cpu(r->value_offset) + (char*)r); + /* Sanity checks. */ + if ((char*)c + le32_to_cpu(r->value_length) > + le16_to_cpu(m->bytes_in_use) + (char*)m || + le16_to_cpu(r->value_offset) + + le32_to_cpu(r->value_length) > le32_to_cpu(r->length)) { + Dputs("Error: Attribute $VOLUME_INFORMATION in $Volume is " + "corrupt!"); + errno = EIO; + goto err_out; + } + /* Set the volume flags. */ + vol->flags = c->flags = cpu_to_le16(flags); + + if (ntfs_write_mft_record(vol, FILE_Volume, m)) { + Dperror("Error writing $Volume"); + goto err_out; + } + + ret = 0; /* success */ +err_out: + ntfs_put_attr_search_ctx(ctx); +err_exit: + if (m) + free(m); + return ret; +} + From b30305bf0152a6cfb9c1915f8479016a7956f362 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0052/2994] AT_NONAME -> AT_UNNAMED 2002/07/14 17:24:58-00:00 !szaka Remove obsolote/unused set_attribute_value() 2002/07/14 17:21:32-00:00 !szaka Move ntfs_set_volume_flags() from attrib[ch] to volume.[ch] 2002/07/14 17:16:52-00:00 !szaka Merge set_ntfs_volume_flags() and code from ntfsfix as a new library function: ntfs_set_volume_flags(). Note, ntfs_set_volume_flags() is moving to volume.[ch] 2002/07/11 16:20:32-00:00 !flatcap whitespace and include guards 2002/07/11 13:18:11-00:00 !flatcap start to break up the dependency loops in the header files 2002/07/09 19:17:48-00:00 !flatcap move the runlist functions from attrib.c to runlist.c 2002/07/08 23:27:15-00:00 !flatcap added AT_NONAME so we can search for a (un)named attribute or just iterate through all attributes 2002/07/08 00:09:41-00:00 !antona Implement attrib.[hc]::ntfs_rl_pwrite(). Fix a dumb bug in ntfs_attr_pwrite(). 2002/07/06 20:07:59-00:00 !antona New API for compressing run lists into mapping pairs arrays and adapt mkntfs to that API. Addition of ntfs_walk_attrs(). 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/30 12:52:25-00:00 !antona Little something or other... 2002/06/05 20:32:53-00:00 !antona Mft mirror now updated from ntfs_write_mft_record, yey! Fixup ntfstools accordingly. 2002/06/05 00:29:18-00:00 !antona Make ntfs_attr_pread work with resident attributes and start on ntfs_attr_pwrite (incomplete!). 2002/06/01 00:41:45-00:00 !antona huge update! 2002/04/29 12:58:34-00:00 !antona Finish ntfs_attr_pread and ntfs_attr_mst_pread. 2002/04/27 19:49:09-00:00 !antona Update library, new APIs ntfs_attr_find_vcn(), misc fixes and cleanups, make all the utilities compile, fix bugs I noticed in ntfslabel and it now works properly. 2002/04/24 23:47:42-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/04/24 19:02:07-00:00 !antona Add new API ntfs_attr_{get,put}. 2002/04/23 11:02:59-00:00 !antona Initial proposal for ntfs attribute ntfs_attr structure typedef. 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/19 21:09:54-00:00 !antona Finished provisional inode.c::ntfs_{open,close}_inode() functions. Also, started defining API provided by attrib.[ch], so far only done search context related stuff. 2002/04/15 17:51:26-00:00 !antona read/write_mft_record(s) are here 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2001/12/15 05:13:08-00:00 !antona Remove atomic ops and add compiler version check. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 11:49:16-00:00 !antona Header file reorganisation so that it compiles. 2001/04/08 01:58:29-00:00 !antona User space conversion of locking complete. I settled for using simple spinlocks and atomic variables and instead of deadlocking/livelocking when using spin_lock(), use spin_trylock() in a while letting go of the cpu between each call and making a maximum of 100 iterations (or we return EDEADLK error code). This is not the most efficient way, especially as can't have multiple readers but it is the simplest way to go about things. Should now have (almost) all required helper functions for dealing with mft entries implemented. Now need the file handling and then convert the whole project to use the new code and then can finally get back to work on attribute searching... 2001/04/05 20:14:45-00:00 !antona Commit of current state of development including locking a la kernel. This doesn't work on user space (semaphores don't work). Just want to have it committed. Will take out locking / modify it where necessary to use pthreads ASAP. 2001/04/02 22:28:39-00:00 !antona Added cvs Id header and removed some outofdate stuff. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/03/31 15:25:19-00:00 !antona Added a name comparison function. 2001/03/26 14:50:58-00:00 !antona Fix a few typos. 2001/03/26 03:35:35-00:00 !antona New attribute searching API header part complete. This shouldn't change any more, except for the search context structure, which might be simplified at some point. 2001/03/22 13:16:32-00:00 !antona Clarified the reparse point tag flags. 2001/03/15 23:12:45-00:00 !antona About time to do a new commit... 2001/03/05 03:15:08-00:00 !antona Forgot a few... 2001/03/05 02:45:35-00:00 !antona Renamed things, broke everything. Should be stabilized now in the headers. Still reworking find attribute stuff but at least I have an idea of how I want to do it now. 2001/03/04 14:28:13-00:00 !antona Fixes. 2001/03/03 06:52:39-00:00 !antona Finished entering security related headers. 2001/03/03 00:11:17-00:00 !antona Mostly finished adding the $Secure information. 2001/03/02 15:03:56-00:00 !antona Update to latest include files. 2001/02/03 02:03:35-00:00 !antona More files. 2001/01/30 12:55:21-00:00 !antona Fixed the compilation issues. 2001/01/30 12:29:03-00:00 !antona And the last move into CVS. The make files. (Note: compilation is untested and all changes have been done without testing so if it doesn't compile at the moment don't be too surprised.) 2001/01/30 00:13:11-00:00 !antona Added in the current state of attribute handling to libntfs. Now just missing the make files to make a first public release of ntfsfix! 2001/01/28 05:49:57-00:00 !antona More header development. AttrDef description. 2001/01/27 14:22:02-00:00 !antona Added a logfile dumper as a new utility. Almost finished the first ntfsfix release. (Still missingin CVS are attrib.c for ntfslib and the makefiles to build everything.) Fixes for nested packed structure/union typedefs as gcc doesn't automatically nest the __attribute__ ((__packed__)), even though according to the gcc info page it does. (Thanks to Yuri Per for pointing this out.) 2001/01/26 02:36:10-00:00 !antona More work on attrib.h. 2001/01/24 02:13:24-00:00 !antona Add a bunch of headers (attrib.h is work in progress). (Logical change 1.5) --- include/attrib.h | 299 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 299 insertions(+) diff --git a/include/attrib.h b/include/attrib.h index e69de29b..97d7d1a7 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -0,0 +1,299 @@ +/* + * $Id$ + * + * attrib.h - Exports for attribute handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_ATTRIB_H +#define _NTFS_ATTRIB_H + +/* Forward declarations */ +typedef struct _ntfs_attr ntfs_attr; +typedef struct _ntfs_attr_search_ctx ntfs_attr_search_ctx; + +#include "types.h" +#include "unistr.h" +#include "runlist.h" +#include "volume.h" + +extern uchar_t AT_UNNAMED[]; + +/** + * ntfs_lcn_special_values - special return values for ntfs_*_vcn_to_lcn() + * + * Special return values for ntfs_rl_vcn_to_lcn() and ntfs_attr_vcn_to_lcn(). + * + * TODO: Describe them. + */ +typedef enum { + LCN_HOLE = -1, /* Keep this as highest value or die! */ + LCN_RL_NOT_MAPPED = -2, + LCN_ENOENT = -3, + LCN_EINVAL = -4, + LCN_EIO = -5, +} ntfs_lcn_special_values; + +/** + * ntfs_attr_search_ctx - search context used in attribute search functions + * @mrec: buffer containing mft record to search + * @attr: attribute record in @mrec where to begin/continue search + * @is_first: if true lookup_attr() begins search with @attr, else after @attr + * + * Structure must be initialized to zero before the first call to one of the + * attribute search functions. Initialize @mrec to point to the mft record to + * search, and @attr to point to the first attribute within @mrec (not necessary + * if calling the _first() functions), and set @is_first to TRUE (not necessary + * if calling the _first() functions). + * + * If @is_first is TRUE, the search begins with @attr. If @is_first is FALSE, + * the search begins after @attr. This is so that, after the first call to one + * of the search attribute functions, we can call the function again, without + * any modification of the search context, to automagically get the next + * matching attribute. + */ +struct _ntfs_attr_search_ctx { + MFT_RECORD *mrec; + ATTR_RECORD *attr; + BOOL is_first; + ntfs_inode *ntfs_ino; + ATTR_LIST_ENTRY *al_entry; + ntfs_inode *base_ntfs_ino; + MFT_RECORD *base_mrec; + ATTR_RECORD *base_attr; +}; + +extern void ntfs_reinit_attr_search_ctx(ntfs_attr_search_ctx *ctx); +extern ntfs_attr_search_ctx *ntfs_get_attr_search_ctx(ntfs_inode *ni, + MFT_RECORD *mrec); +extern void ntfs_put_attr_search_ctx(ntfs_attr_search_ctx *ctx); + +extern int ntfs_lookup_attr(const ATTR_TYPES type, const uchar_t *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const VCN lowest_vcn, const u8 *val, const u32 val_len, + ntfs_attr_search_ctx *ctx); + +/** + * ntfs_walk_attrs - syntactic sugar for walking all attributes in an inode + * @ctx: initialised attribute search context + * + * Syntactic sugar for walking attributes in an inode. + * + * Return 0 on success and -1 on error with errno set to the error code from + * ntfs_lookup_attr(). + * + * Example: When you want to enumerate all attributes in an open ntfs inode + * @ni, you can simply do: + * + * int err; + * ntfs_attr_search_ctx *ctx = ntfs_get_attr_search_ctx(ni, NULL); + * if (!ctx) + * // Error code is in errno. Handle this case. + * while (!(err = ntfs_walk_attrs(ctx))) { + * ATTR_RECORD *attr = ctx->attr; + * // attr now contains the next attribute. Do whatever you want + * // with it and then just continue with the while loop. + * } + * if (err && errno != ENOENT) + * // Ooops. An error occured! You should handle this case. + * // Now finished with all attributes in the inode. + */ +static __inline__ int ntfs_walk_attrs(ntfs_attr_search_ctx *ctx) +{ + return ntfs_lookup_attr(0, NULL, 0, 0, 0, NULL, 0, ctx); +} + +/** + * ntfs_attr_state_bits - bits for the state field in the ntfs_attr structure + */ +typedef enum { + NA_Initialized, /* 1: structure is initialized. */ + NA_NonResident, /* 1: Attribute is not resident. */ + NA_Compressed, /* 1: Attribute is compressed. */ + NA_Encrypted, /* 1: Attribute is encrypted. */ + NA_Sparse, /* 1: Attribute is sparse. */ +} ntfs_attr_state_bits; + +#define test_nattr_flag(na, flag) test_bit(NA_##flag, (na)->state) +#define set_nattr_flag(na, flag) set_bit(NA_##flag, (na)->state) +#define clear_nattr_flag(na, flag) clear_bit(NA_##flag, (na)->state) + +#define NAttrInitialized(na) test_nattr_flag(na, Initialized) +#define NAttrSetInitialized(na) set_nattr_flag(na, Initialized) +#define NAttrClearInitialized(na) clear_nattr_flag(na, Initialized) + +#define NAttrNonResident(na) test_nattr_flag(na, NonResident) +#define NAttrSetNonResident(na) set_nattr_flag(na, NonResident) +#define NAttrClearNonResident(na) clear_nattr_flag(na, NonResident) + +#define NAttrCompressed(na) test_nattr_flag(na, Compressed) +#define NAttrSetCompressed(na) set_nattr_flag(na, Compressed) +#define NAttrClearCompressed(na) clear_nattr_flag(na, Compressed) + +#define NAttrEncrypted(na) test_nattr_flag(na, Encrypted) +#define NAttrSetEncrypted(na) set_nattr_flag(na, Encrypted) +#define NAttrClearEncrypted(na) clear_nattr_flag(na, Encrypted) + +#define NAttrSparse(na) test_nattr_flag(na, Sparse) +#define NAttrSetSparse(na) set_nattr_flag(na, Sparse) +#define NAttrClearSparse(na) clear_nattr_flag(na, Sparse) + +/** + * ntfs_attr - ntfs in memory non-resident attribute structure + * @rl: if not NULL, the decompressed run list + * @ni: base ntfs inode to which this attribute belongs + * @type: attribute type + * @name: Unicode name of the attribute + * @name_len: length of @name in Unicode characters + * @state: NTFS attribute specific flags descibing this attribute + * + * This structure exists purely to provide a mechanism of caching the run list + * of an attribute. If you want to operate on a particular attribute extent, + * you should not be using this structure at all. If you want to work with a + * resident attribute, you should not be using this structure at all. As a + * fail-safe check make sure to test NAttrNonResident() and if it is false, you + * know you shouldn't be using this structure. + * + * If you want to work on a resident attribute or on a specific attribute + * extent, you should use ntfs_lookup_attr() to retrieve the attribute (extent) + * record, edit that, and then write back the mft record (or set the + * corresponding ntfs inode dirty for delayed write back). + * + * @rl is the decompressed run list of the attribute described by this + * structure. Obviously this only makes sense if the attribute is not resident, + * i.e. NAttrNonResident() is true. If the run list hasn't been decomressed yet + * @rl is NULL, so be prepared to cope with @rl == NULL. + * + * @ni is the base ntfs inode of the attribute described by this structure. + * + * @type is the attribute type (see layout.h for the definition of ATTR_TYPES), + * @name and @name_len are the little endian Unicode name and the name length + * in Unicode characters of the attribute, respecitvely. + * + * @state contains NTFS attribute specific flags descibing this attribute + * structure. See ntfs_attr_state_bits above. + */ +struct _ntfs_attr { + run_list_element *rl; + ntfs_inode *ni; + ATTR_TYPES type; + uchar_t *name; + u32 name_len; + unsigned long state; + s64 allocated_size; + s64 data_size; + s64 initialized_size; + s64 compressed_size; + u32 compression_block_size; + u8 compression_block_size_bits; + u8 compression_block_clusters; +}; + +/* + * Union of all known attribute values. For convenience. Used in the attr + * structure. + */ +typedef union { + u8; /* Unnamed u8 to serve as default when just using + a_val without specifying any of the below. */ + STANDARD_INFORMATION std_inf; + ATTR_LIST_ENTRY al_entry; + FILE_NAME_ATTR filename; + OBJECT_ID_ATTR obj_id; + SECURITY_DESCRIPTOR_ATTR sec_desc; + VOLUME_NAME vol_name; + VOLUME_INFORMATION vol_inf; + DATA_ATTR data; + INDEX_ROOT index_root; + INDEX_BLOCK index_blk; + BITMAP_ATTR bmp; + REPARSE_POINT reparse; + EA_INFORMATION ea_inf; + EA_ATTR ea; + PROPERTY_SET property_set; + LOGGED_UTILITY_STREAM logged_util_stream; + EFS_ATTR efs; +} attr_val; + +extern void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident, + const BOOL compressed, const BOOL encrypted, const BOOL sparse, + const s64 allocated_size, const s64 data_size, + const s64 initialized_size, const s64 compressed_size, + const u8 compression_unit); + +extern ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, + uchar_t *name, const u32 name_len); +extern void ntfs_attr_close(ntfs_attr *na); + +extern s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, + void *b); +extern s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, + void *b); + +extern s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, + const s64 bk_cnt, const u32 bk_size, void *dst); +extern s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, + s64 bk_cnt, const u32 bk_size, void *src); + +extern int ntfs_attr_map_run_list(ntfs_attr *na, VCN vcn); + +extern LCN ntfs_attr_vcn_to_lcn(ntfs_attr *na, const VCN vcn); +extern run_list_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn); + +extern int ntfs_get_nr_significant_bytes(const s64 n); +extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, + const run_list_element *rl); + +extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, + const s64 n); + + +// FIXME / TODO: Above here the file is cleaned up. (AIA) +/** + * get_attribute_value_length - return the length of the value of an attribute + * @a: pointer to a buffer containing the attribute record + * + * Return the byte size of the attribute value of the attribute @a (as it + * would be after eventual decompression and filling in of holes if sparse). + * If we return 0, check errno. If errno is 0 the actual length was 0, + * otherwise errno describes the error. + * + * FIXME: Describe possible errnos. + */ +s64 get_attribute_value_length(const ATTR_RECORD *a); + +/** + * get_attribute_value - return the attribute value of an attribute + * @vol: volume on which the attribute is present + * @a: attribute to get the value of + * @b: destination buffer for the attribute value + * + * Make a copy of the attribute value of the attribute @a into the destination + * buffer @b. Note, that the size of @b has to be at least equal to the value + * returned by get_attribute_value_length(@a). + * + * Return number of bytes copied. If this is zero check errno. If errno is 0 + * then nothing was read due to a zero-length attribute value, otherwise + * errno describes the error. + */ +s64 get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, + const ATTR_RECORD *a, u8 *b); + +#endif /* defined _NTFS_ATTRIB_H */ + From c90602cacc77af47184dd4ba844668c4e83cf0a8 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0053/2994] AT_NONAME -> AT_UNNAMED 2002/07/14 17:24:58-00:00 !szaka Remove obsolote/unused set_attribute_value() 2002/07/14 17:21:32-00:00 !szaka Move ntfs_set_volume_flags() from attrib[ch] to volume.[ch] 2002/07/14 17:16:52-00:00 !szaka Merge set_ntfs_volume_flags() and code from ntfsfix as a new library function: ntfs_set_volume_flags(). Note, ntfs_set_volume_flags() is moving to volume.[ch] 2002/07/12 08:18:15-00:00 !antona sorry flatcap. - remove a lot of reorganization which rips the code into incomprehensible order. - all functions were and are again now placed together by logicnot by sheer randomness. - functions which call each other are placed together for example... 2002/07/11 23:44:13-00:00 !flatcap new function headers and a few function moves 2002/07/11 16:20:33-00:00 !flatcap whitespace and include guards 2002/07/09 19:17:49-00:00 !flatcap move the runlist functions from attrib.c to runlist.c 2002/07/09 00:06:49-00:00 !antona fix the cleanup... 2002/07/09 00:02:31-00:00 !antona A little (potential) fix or better call it bug prevention and some cleanup. 2002/07/08 23:27:15-00:00 !flatcap added AT_NONAME so we can search for a (un)named attribute or just iterate through all attributes 2002/07/08 06:23:22-00:00 !antona Don't use string concatenation with __FUNCTION__ as gcc-3.x don't like it. 2002/07/08 00:09:41-00:00 !antona Implement attrib.[hc]::ntfs_rl_pwrite(). Fix a dumb bug in ntfs_attr_pwrite(). 2002/07/06 20:07:59-00:00 !antona New API for compressing run lists into mapping pairs arrays and adapt mkntfs to that API. Addition of ntfs_walk_attrs(). 2002/07/05 21:15:31-00:00 !uid28698 - Enable enumeration of attributes using ntfs_lookup_attr() which is requested by passing a type of AT_UNUSED (or simply zero) to ntfs_lookup_attr(). (Based on initial patch by Szakacsits Szabolcs.) - Fix two minor buglets in ntfs_find_external_attr() where we would continue the search when we detect a mismatched type and/or name instead of aborting and returning error EIO to flag the corruption. 2002/07/03 21:56:00-00:00 !antona Updates 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/07/01 23:43:53-00:00 !flatcap damn, the wrong name_offset 2002/07/01 23:22:35-00:00 !flatcap endian fix 2002/06/08 14:12:01-00:00 !antona ntfs_readdir() has arrived. 2002/06/07 01:16:20-00:00 !antona Updates 2002/06/05 20:32:53-00:00 !antona Mft mirror now updated from ntfs_write_mft_record, yey! Fixup ntfstools accordingly. 2002/06/05 09:19:44-00:00 !antona ntfs_attr_pread() fixes and finished 1st draft of ntfs_attr_pwrite(). 2002/06/05 00:29:18-00:00 !antona Make ntfs_attr_pread work with resident attributes and start on ntfs_attr_pwrite (incomplete!). 2002/06/02 23:02:20-00:00 !antona More fixes and updates. 2002/06/01 00:41:45-00:00 !antona huge update! 2002/04/29 12:58:34-00:00 !antona Finish ntfs_attr_pread and ntfs_attr_mst_pread. 2002/04/29 01:53:55-00:00 !antona Loads of stuff. Improvements, start on attr pread and attr mst_pread. Write to follow. ntfslabel cleanup and extensions. libntfs cleanups, fixes, etc. 2002/04/27 19:49:09-00:00 !antona Update library, new APIs ntfs_attr_find_vcn(), misc fixes and cleanups, make all the utilities compile, fix bugs I noticed in ntfslabel and it now works properly. 2002/04/24 23:47:42-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/04/24 19:02:07-00:00 !antona Add new API ntfs_attr_{get,put}. 2002/04/24 01:37:37-00:00 !antona New api call is_boot_sector_ntfs. A few folding help cleanups. 2002/04/24 00:47:56-00:00 !flatcap the phantom asterisk eater strikes 2002/04/23 17:00:03-00:00 !flatcap off by one error in realloc 2002/04/23 16:10:48-00:00 !flatcap bugfix for the transplanted runlist functions a few bits to help folding 2002/04/23 11:11:36-00:00 !flatcap *ahem* 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/21 10:11:36-00:00 !antona Fix a buglet in the library and same in ntfslabel.c 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/19 21:21:46-00:00 !antona Remove compile time warning... 2002/04/19 21:09:55-00:00 !antona Finished provisional inode.c::ntfs_{open,close}_inode() functions. Also, started defining API provided by attrib.[ch], so far only done search context related stuff. 2002/04/16 15:34:32-00:00 !antona Fix the library... 2002/04/16 12:13:53-00:00 !antona New API function mft.[ch]::read_file_record(). Also some cleanups. 2002/04/15 18:54:06-00:00 !antona Update library for the new API. 2002/04/15 17:51:26-00:00 !antona read/write_mft_record(s) are here 2002/04/15 00:42:07-00:00 !antona Big rewrite of disk_io.c. Now should have stable API for low level disk access. Move all mft record related stuff from disk_io.c to mft.c. 2002/04/14 15:26:23-00:00 !antona Remove find_first_attr and make all users use get_attr_search_ctx + find_attr instead. 2002/04/14 14:08:29-00:00 !antona Cleanup library code. Throw away unused stuff. 2001/06/13 00:40:49-00:00 !antona No more bugs (known) except issue with last sector not being writable when it is an odd number. 2001/06/09 00:25:55-00:00 !antona mkntfs delayed. more reverse engineering required to determine exact method of index entry collation. first few helper functions are already done and entered into ntfslib in unistr.c 2001/06/01 02:07:25-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/12 22:37:21-00:00 !antona Add a description and structure for holding attributes in memory. No code to use it yet but it's a start. The design is geared with the ideas of making searching for attributes and using/implementing the search context as easy as possible, integrating the attributes into their mft_entries and maintining a fast sync volume path. Comments welcome. 2001/04/11 11:49:16-00:00 !antona Header file reorganisation so that it compiles. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/04/08 01:58:29-00:00 !antona User space conversion of locking complete. I settled for using simple spinlocks and atomic variables and instead of deadlocking/livelocking when using spin_lock(), use spin_trylock() in a while letting go of the cpu between each call and making a maximum of 100 iterations (or we return EDEADLK error code). This is not the most efficient way, especially as can't have multiple readers but it is the simplest way to go about things. Should now have (almost) all required helper functions for dealing with mft entries implemented. Now need the file handling and then convert the whole project to use the new code and then can finally get back to work on attribute searching... 2001/04/05 20:14:45-00:00 !antona Commit of current state of development including locking a la kernel. This doesn't work on user space (semaphores don't work). Just want to have it committed. Will take out locking / modify it where necessary to use pthreads ASAP. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/03/15 23:13:45-00:00 !antona Current status of library. (Still not working.) 2001/03/07 01:17:33-00:00 !antona Renamed the unicode files and introduced more code. Finished the new find_first/next_attr() interface functions. Next on my list are functions supporting attribute lists... 2001/03/06 02:10:55-00:00 !antona Allow variable length upcase table. Progressing on find_next_attr(). 2001/03/05 03:04:40-00:00 !antona Corresponding changes to the library. 2001/03/02 15:05:53-00:00 !antona Commit latest library state. !!!NOTE!!! This breaks everything!!! I'm in the middle of rewritting the find_attribute stuff in attrib.c at the moment. 2001/01/30 12:55:21-00:00 !antona Fixed the compilation issues. 2001/01/30 00:13:11-00:00 !antona Added in the current state of attribute handling to libntfs. Now just missing the make files to make a first public release of ntfsfix! (Logical change 1.5) --- libntfs/attrib.c | 1984 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1984 insertions(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e69de29b..bc359707 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -0,0 +1,1984 @@ +/* + * $Id$ + * + * attrib.c - Attribute handling code. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (C) 2002 Richard Russon. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include + +#include "attrib.h" +#include "disk_io.h" +#include "mft.h" +#include "debug.h" +#include "mst.h" +#include "volume.h" +#include "types.h" +#include "layout.h" +#include "inode.h" +#include "runlist.h" + +uchar_t AT_UNNAMED[] = { const_cpu_to_le16('\0') }; + +/** + * get_attribute_value_length + */ +s64 get_attribute_value_length(const ATTR_RECORD *a) +{ + if (!a) { + errno = EINVAL; + return 0; + } + errno = 0; + if (a->non_resident) + return sle64_to_cpu(a->data_size); + else + return (s64)le32_to_cpu(a->value_length); + errno = EINVAL; + return 0; +} + +/** + * get_attribute_value + */ +s64 get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, + const ATTR_RECORD *a, u8 *b) +{ + /* Sanity checks. */ + if (!vol || !m || !a || !b) { + errno = EINVAL; + return 0; + } + /* Complex attribute? */ + if (a->flags) { + puts("Enountered non-zero attribute flags. Cannot handle this " + "yet."); + errno = ENOTSUP; + return 0; + } + if (!a->non_resident) { /* Attribute is resident. */ + /* Sanity check. */ + if (le32_to_cpu(a->value_length) + + le16_to_cpu(a->value_offset) > le32_to_cpu(a->length)) { + return 0; + } + memcpy(b, (char*)a + le16_to_cpu(a->value_offset), + le32_to_cpu(a->value_length)); + errno = 0; + return (s64)le32_to_cpu(a->value_length); + } else { /* Attribute is not resident. */ + run_list *rl; + s64 total, r; + int i; + + /* If no data, return 0. */ + if (!(a->data_size)) { + errno = 0; + return 0; + } + /* + * FIXME: What about attribute lists?!? (AIA) + */ + /* Decompress the mapping pairs array into a run list. */ + rl = ntfs_decompress_mapping_pairs(vol, a, NULL); + if (!rl) { + errno = EINVAL; + return 0; + } + /* + * FIXED: We were overflowing here in a nasty fashion when we + * reach the last cluster in the run list as the buffer will + * only be big enough to hold data_size bytes while we are + * reading in allocated_size bytes which is usually larger + * than data_size, since the actual data is unlikely to have a + * size equal to a multiple of the cluster size! + */ + /* Now load all clusters in the run list into b. */ + for (i = 0, total = 0; rl[i].length; i++) { + if (!rl[i+1].length) { + unsigned char *intbuf = NULL; + /* + * We have reached the last run so we were + * going to overflow when executing the + * ntfs_pread() which is BAAAAAAAD! + * Temporary fix: + * Allocate a new buffer with size: + * rl[i].length << vol->cluster_size_bits, + * do the read into our buffer, then + * memcpy the correct amount of data into + * the caller supplied buffer, free our + * buffer, and continue. + */ + intbuf = malloc(rl[i].length << + vol->cluster_size_bits); + if (!intbuf) { + int eo = errno; + perror("Couldn't allocate memory for " + "internal buffer.\n"); + free(rl); + errno = eo; + return 0; + } + /* + * FIXME: If compressed file: Only read if + * lcn != -1. Otherwise, we are dealing with a + * sparse run and we just memset the user buffer + * to 0 for the length of the run, which should + * be 16 (= compression unit size). + * FIXME: Really only when file is compressed, + * or can we have sparse runs in uncompressed + * files as well? + */ + r = ntfs_pread(vol->fd, rl[i].lcn << + vol->cluster_size_bits, + rl[i].length << + vol->cluster_size_bits, intbuf); + if (r != rl[i].length << + vol->cluster_size_bits) { +#define ESTR "Error reading attribute value" + if (r == -1) { + int eo = errno; + perror(ESTR); + errno = eo; + } else if (r < rl[i].length << + vol->cluster_size_bits + ) { + fprintf(stderr, ESTR ": Ran " + "out of input data.\n"); + errno = EIO; + } else { + fprintf(stderr, ESTR ": " + "unknown error\n"); + errno = EIO; + } +#undef ESTR + free(rl); + return 0; + } + memcpy(b + total, intbuf, + sle64_to_cpu(a->data_size) - total); + free(intbuf); + total = sle64_to_cpu(a->data_size); + } else { + /* + * FIXME: If compressed file: Only read if + * lcn != -1. Otherwise, we are dealing with a + * sparse run and we just memset the user buffer + * to 0 for the length of the run, which should + * be 16 (= compression unit size). + */ + r = ntfs_pread(vol->fd, rl[i].lcn << + vol->cluster_size_bits, + rl[i].length << + vol->cluster_size_bits, + b + total); + if (r != rl[i].length << + vol->cluster_size_bits) { +#define ESTR "Error reading attribute value" + if (r == -1) { + int eo = errno; + perror(ESTR); + errno = eo; + } else if (r < rl[i].length << + vol->cluster_size_bits + ) { + fprintf(stderr, ESTR ": Ran " + "out of input data.\n"); + errno = EIO; + } else { + fprintf(stderr, ESTR ": " + "unknown error\n"); + errno = EIO; + } +#undef ESTR + return 0; + } + total += r; + } + } + free(rl); + return total; + } + errno = EINVAL; + return 0; +} + +/* Already cleaned up code below, but still look for FIXME:... */ + +/** + * Internal: + * + * __ntfs_attr_init - primary initialization of an ntfs attribute structure + * @na: ntfs attribute to initialize + * @ni: ntfs inode with which to initialize the ntfs attribute + * @type: attribute type + * @name: attribute name in little endian Unicode or NULL + * @name_len: length of attribute @name in Unicode characters (if @name given) + * + * Initialize the ntfs attribute @na with @ni, @type, @name, and @name_len. + */ +static __inline__ void __ntfs_attr_init(ntfs_attr *na, ntfs_inode *ni, + const ATTR_TYPES type, uchar_t *name, const u32 name_len) +{ + na->rl = NULL; + na->ni = ni; + na->type = type; + if (name) { + na->name = name; + na->name_len = name_len; + } else { + na->name = AT_UNNAMED; + na->name_len = 0; + } +} + +/** + * ntfs_attr_init - initialize an ntfs_attr with data sizes and status + * @na: + * @non_resident: + * @compressed: + * @ecnrypted: + * @sparse: + * @allocated_size: + * @data_size: + * @initialized_size: + * @compressed_size: + * @compression_unit: + * + * Final initialization for an ntfs attribute. + */ +void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident, + const BOOL compressed, const BOOL encrypted, const BOOL sparse, + const s64 allocated_size, const s64 data_size, + const s64 initialized_size, const s64 compressed_size, + const u8 compression_unit) +{ + if (!NAttrInitialized(na)) { + if (non_resident) + NAttrSetNonResident(na); + if (compressed) + NAttrSetCompressed(na); + if (encrypted) + NAttrSetEncrypted(na); + if (sparse) + NAttrSetSparse(na); + na->allocated_size = allocated_size; + na->data_size = data_size; + na->initialized_size = initialized_size; + if (compressed || sparse) { + ntfs_volume *vol = na->ni->vol; + + na->compressed_size = compressed_size; + na->compression_block_clusters = 1 << compression_unit; + na->compression_block_size = 1 << (compression_unit + + vol->cluster_size_bits); + na->compression_block_size_bits = ffs( + na->compression_block_size) - 1; + } + NAttrSetInitialized(na); + } +} + +/** + * ntfs_attr_open - open an ntfs attribute for access + * @ni: open ntfs inode in which the ntfs attribute resides + * @type: attribute type + * @name: attribute name in little endian Unicode or NULL + * @name_len: length of attribute @name in Unicode characters (if @name given) + * + * Allocate a new ntfs attribute structure, initialize it with @ni, @type, + * @name, and @name_len, then return it. Return NULL on error with + * errno set to the error code. + * + * If looking for an unnamed attribute set @name to NULL. @name_len is not used + * at all in that case. + */ +ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, + uchar_t *name, const u32 name_len) +{ + ntfs_attr_search_ctx *ctx; + ntfs_attr *na; + ATTR_RECORD *a; + int err; + + Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x.\n", __FUNCTION__, + (unsigned long long)ni->mft_no, type); + if (!ni || !ni->vol || !ni->mrec) { + errno = EINVAL; + return NULL; + } + na = calloc(sizeof(ntfs_attr), 1); + if (!na) + return NULL; + __ntfs_attr_init(na, ni, type, name, name_len); + + ctx = ntfs_get_attr_search_ctx(ni, NULL); + if (!ctx) { + err = errno; + goto err_out; + } + + if (ntfs_lookup_attr(type, name, name_len, 0, 0, NULL, 0, ctx)) { + err = errno; + goto put_err_out; + } + a = ctx->attr; + if (a->non_resident) { + BOOL cs = a->flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE); + ntfs_attr_init(na, TRUE, a->flags & ATTR_IS_COMPRESSED, + a->flags & ATTR_IS_ENCRYPTED, + a->flags & ATTR_IS_SPARSE, + sle64_to_cpu(a->allocated_size), + sle64_to_cpu(a->data_size), + sle64_to_cpu(a->initialized_size), + cs ? sle64_to_cpu(a->compressed_size) : 0, + cs ? a->compression_unit : 0); + } else { + s64 l = le32_to_cpu(a->value_length); + if (a->flags & (ATTR_COMPRESSION_MASK | ATTR_IS_ENCRYPTED | + ATTR_IS_SPARSE)) { + err = EIO; + goto put_err_out; + } + ntfs_attr_init(na, FALSE, FALSE, FALSE, FALSE, l, l, l, 0, 0); + } + ntfs_put_attr_search_ctx(ctx); + return na; +put_err_out: + ntfs_put_attr_search_ctx(ctx); +err_out: + errno = err; + return NULL; +} + +/** + * ntfs_attr_close - free an ntfs attribute structure + * @na: ntfs attribute structure to free + * + * Release all memory associated with the ntfs attribute @na and then release + * @na itself. + */ +void ntfs_attr_close(ntfs_attr *na) +{ + if (NAttrNonResident(na) && na->rl) + free(na->rl); + if (na->name != AT_UNNAMED) + free(na->name); + free(na); + return; +} + +/** + * ntfs_attr_map_run_list - map (a part of) a run list of an ntfs attribute + * @na: ntfs attribute for which to map (part of) a run list + * @vcn: map run list part containing this vcn + * + * Map the part of a run list containing the @vcn of an the ntfs attribute @na. + * + * Return 0 on success and -1 on error with errno set to the error code. + */ +int ntfs_attr_map_run_list(ntfs_attr *na, VCN vcn) +{ + ntfs_attr_search_ctx *ctx; + int err; + + Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x, vcn 0x%Lx.\n", + __FUNCTION__, (unsigned long long)na->ni->mft_no, + na->type, (long long)vcn); + + ctx = ntfs_get_attr_search_ctx(na->ni, NULL); + if (!ctx) + return -1; + + /* Find the attribute in the mft record. */ + if (!ntfs_lookup_attr(na->type, na->name, na->name_len, CASE_SENSITIVE, + vcn, NULL, 0, ctx)) { + run_list_element *rl; + + /* Decode the run list. */ + rl = ntfs_decompress_mapping_pairs(na->ni->vol, ctx->attr, + na->rl); + if (rl) { + na->rl = rl; + + ntfs_put_attr_search_ctx(ctx); + return 0; + } + } + err = errno; + ntfs_put_attr_search_ctx(ctx); + errno = err; + return -1; +} + +/** + * ntfs_attr_vcn_to_lcn - convert a vcn into a lcn given an ntfs attribute + * @na: ntfs attribute whose run list to use for conversion + * @vcn: vcn to convert + * + * Convert the virtual cluster number @vcn of an attribute into a logical + * cluster number (lcn) of a device using the run list @na->rl to map vcns to + * their corresponding lcns. + * + * If the @vcn is not mapped yet, attempt to map the attribute extent + * containing the @vcn and retry the vcn to lcn conversion. + * + * Since lcns must be >= 0, we use negative return values with special meaning: + * + * Return value Meaning / Description + * ========================================== + * -1 = LCN_HOLE Hole / not allocated on disk. + * -3 = LCN_ENOENT There is no such vcn in the attribute. + * -4 = LCN_EINVAL Input parameter error. + * -5 = LCN_EIO Corrupt fs, disk i/o error, or not enough memory. + */ +LCN ntfs_attr_vcn_to_lcn(ntfs_attr *na, const VCN vcn) +{ + LCN lcn; + BOOL is_retry = FALSE; + + if (!na || !NAttrNonResident(na) || vcn < 0) + return (LCN)LCN_EINVAL; +retry: + /* Convert vcn to lcn. If that fails map the run list and retry once. */ + lcn = ntfs_rl_vcn_to_lcn(na->rl, vcn); + if (lcn >= 0) + return lcn; + if (!is_retry && !ntfs_attr_map_run_list(na, vcn)) { + is_retry = TRUE; + goto retry; + } + /* + * If the attempt to map the run list failed, or we are getting + * LCN_RL_NOT_MAPPED despite having mapped the attribute extent + * successfully, something is really badly wrong... + */ + if (!is_retry || lcn == (LCN)LCN_RL_NOT_MAPPED) + return (LCN)LCN_EIO; + /* lcn contains the appropriate error code. */ + return lcn; +} + +/** + * ntfs_attr_find_vcn - find a vcn in the run list of an ntfs attribute + * @na: ntfs attribute whose run list to search + * @vcn: vcn to find + * + * Find the virtual cluster number @vcn in the run list of the ntfs attribute + * @na and return the the address of the run list element containing the @vcn. + * + * Note you need to distinguish between the lcn of the returned run list + * element being >= 0 and LCN_HOLE. In the later case you have to return zeroes + * on read and allocate clusters on write. You need to update the run list, the + * attribute itself as well as write the modified mft record to disk. + * + * If there is an error return NULL with errno set to the error code. The + * following error codes are defined: + * EINVAL Input parameter error. + * ENOENT There is no such vcn in the run list. + * ENOMEM Not enough memory. + * EIO I/O error or corrupt metadata. + */ +run_list_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn) +{ + run_list_element *rl; + BOOL is_retry = FALSE; + + if (!na || !NAttrNonResident(na) || vcn < 0) { + errno = EINVAL; + return NULL; + } +retry: + rl = na->rl; + if (!rl) + goto map_rl; + if (vcn < rl[0].vcn) + goto map_rl; + while (rl->length) { + if (vcn < rl[1].vcn) { + if (rl->lcn >= (LCN)LCN_HOLE) + return rl; + break; + } + rl++; + } + switch (rl->lcn) { + case (LCN)LCN_RL_NOT_MAPPED: + goto map_rl; + case (LCN)LCN_ENOENT: + errno = ENOENT; + break; + case (LCN)LCN_EINVAL: + errno = EINVAL; + break; + default: + errno = EIO; + break; + } + return NULL; +map_rl: + /* The @vcn is in an unmapped region, map the run list and retry. */ + if (!is_retry && !ntfs_attr_map_run_list(na, vcn)) { + is_retry = TRUE; + goto retry; + } + /* + * If we already retried or the mapping attempt failed something has + * gone badly wrong. EINVAL and ENOENT coming from a failed mapping + * attempt are equivalent to errors for us as they should not happen + * in our code paths. + */ + if (is_retry || errno == EINVAL || errno == ENOENT) + errno = EIO; + return NULL; +} + +/** + * ntfs_attr_pread - read from an attribute specified by an ntfs_attr structure + * @na: ntfs attribute to read from + * @pos: byte position in the attribute to begin reading from + * @count: number of bytes to read + * @b: output data buffer + * + * This function will read @count bytes starting at offset @pos from the ntfs + * attribute @na into the data buffer @b. + * + * On success, return the number of successfully read bytes. If this number is + * lower than @count this means that the read reached end of file or thet an + * error was encountered during the read so that the read is partial. 0 means + * end of file or nothing was read (also return 0 when @count is 0). + * + * On error and nothing has been read, return -1 with errno set appropriately + * to the return code of ntfs_pread(), or to EINVAL in case of invalid + * arguments. + */ +s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) +{ + s64 br, to_read, ofs, total, total2; + ntfs_volume *vol; + run_list_element *rl; + int f; + + Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x, pos 0x%Lx, " + "count 0x%Lx.\n", __FUNCTION__, + (unsigned long long)na->ni->mft_no, na->type, + (long long)pos, (long long)count); + if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) { + errno = EINVAL; + return -1; + } + vol = na->ni->vol; + f = vol->fd; + if (!f) { + errno = EBADF; + return -1; + } + /* + * Encrypted attributes are not supported. We return access denied, + * which is what Windows NT4 does, too. + */ + if (NAttrEncrypted(na)) { + errno = EACCES; + return -1; + } + /* If this is a compressed attribute it needs special treatment. */ + if (NAttrCompressed(na)) { + // TODO: Implement reading compressed attributes! (AIA) + // return ntfs_attr_pread_compressed(ntfs_attr *na, + // const s64 pos, s64 count, void *b); + errno = ENOTSUP; + return -1; + } + if (!count) + return 0; + /* Truncate reads beyond end of attribute. */ + if (pos + count > na->data_size) { + if (pos >= na->data_size) + return 0; + count = na->data_size - pos; + } + /* If it is a resident attribute, get the value from the mft record. */ + if (!NAttrNonResident(na)) { + ntfs_attr_search_ctx *ctx; + char *val; + + ctx = ntfs_get_attr_search_ctx(na->ni, NULL); + if (!ctx) + return -1; + if (ntfs_lookup_attr(na->type, na->name, na->name_len, 0, + 0, NULL, 0, ctx)) { + int eo; +res_err_out: + eo = errno; + ntfs_put_attr_search_ctx(ctx); + errno = eo; + return -1; + } + val = (char*)ctx->attr + le16_to_cpu(ctx->attr->value_offset); + if (val < (char*)ctx->attr || val + + le32_to_cpu(ctx->attr->value_length) > + (char*)ctx->mrec + vol->mft_record_size) { + errno = EIO; + goto res_err_out; + } + memcpy(b, val + pos, count); + ntfs_put_attr_search_ctx(ctx); + return count; + } + total = total2 = 0; + /* Zero out reads beyond initialized size. */ + if (pos + count > na->initialized_size) { + if (pos >= na->initialized_size) { + memset(b, 0, count); + return count; + } + total2 = pos + count - na->initialized_size; + count -= total2; + memset(b + count, 0, total2); + } + /* Find the run list element containing the vcn. */ + rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits); + if (!rl) { + /* + * If the vcn is not present it is an out of bounds read. + * However, we already truncated the read to the data_size, + * so getting this here is an error. + */ + if (errno == ENOENT) + errno = EIO; + return -1; + } + /* + * Gather the requested data into the linear destination buffer. Note, + * a partial final vcn is taken care of by the @count capping of read + * length. + */ + ofs = pos - (rl->vcn << vol->cluster_size_bits); + for (; count; rl++, ofs = 0) { + if (!rl->length) + goto rl_err_out; + if (rl->lcn < (LCN)0) { + if (rl->lcn != (LCN)LCN_HOLE) + goto rl_err_out; + /* It is a hole, just zero the matching @b range. */ + to_read = min(count, (rl->length << + vol->cluster_size_bits) - ofs); + memset(b, 0, to_read); + /* Update progress counters. */ + total += to_read; + count -= to_read; + b += to_read; + continue; + } + /* It is a real lcn, read it into @dst. */ + to_read = min(count, (rl->length << vol->cluster_size_bits) - + ofs); +retry: + Dprintf("%s(): Reading 0x%Lx bytes from vcn 0x%Lx, lcn 0x%Lx, " + "ofs 0x%Lx.\n", __FUNCTION__, to_read, + rl->vcn, rl->lcn, ofs); + br = ntfs_pread(f, (rl->lcn << vol->cluster_size_bits) + ofs, + to_read, b); + /* If everything ok, update progress counters and continue. */ + if (br > 0) { + total += br; + count -= br; + b += br; + continue; + } + /* If the syscall was interrupted, try again. */ + if (br == (s64)-1 && errno == EINTR) + goto retry; + if (total) + return total; + if (!br) + errno = EIO; + return -1; + } + /* Finally, return the number of bytes read. */ + return total + total2; +rl_err_out: + if (total) + return total; + errno = EIO; + return -1; +} + +/** + * ntfs_attr_pwrite - positioned write to an ntfs attribute + * @na: ntfs attribute to write to + * @pos: position in the attribute to write to + * @count: number of bytes to write + * @b: data buffer to write to disk + * + * This function will write @count bytes from data buffer @b to ntfs attribute + * @na at position @pos. + * + * On success, return the number of successfully written bytes. If this number + * is lower than @count this means that an error was encountered during the + * write so that the write is partial. 0 means nothing was written (also return + * 0 when @count is 0). + * + * On error and nothing has been written, return -1 with errno set + * appropriately to the return code of ntfs_pwrite(), or to EINVAL in case of + * invalid arguments. + * + * NOTE: Currently changes in length of the attribute @na are not implemented. + * Thus if such a change is requested we return -1 with errno set to ENOTSUP. + */ +s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) +{ + s64 written, to_write, ofs, total, old_initialized_size; + ntfs_volume *vol; + ntfs_attr_search_ctx *ctx = NULL; + run_list_element *rl; + int f, eo; + struct { + unsigned int initialized_size : 1; + } need_to_undo = { 0 }; + + Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x, pos 0x%Lx, " + "count 0x%Lx.\n", __FUNCTION__, na->ni->mft_no, + na->type, (long long)pos, (long long)count); + if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) { + errno = EINVAL; + return -1; + } + vol = na->ni->vol; + f = vol->fd; + if (!f) { + errno = EBADF; + return -1; + } + /* + * Encrypted attributes are not supported. We return access denied, + * which is what Windows NT4 does, too. + */ + if (NAttrEncrypted(na)) { + errno = EACCES; + return -1; + } + /* If this is a compressed attribute it needs special treatment. */ + if (NAttrCompressed(na)) { + // TODO: Implement writing compressed attributes! (AIA) + // return ntfs_attr_pwrite_compressed(ntfs_attr *na, + // const s64 pos, s64 count, void *b); + errno = ENOTSUP; + return -1; + } + if (!count) + return 0; + /* If the write reaches beyond the end, extend the attribute. */ + if (pos + count > na->data_size) { + // TODO: Need to extend the attribute. For now, just do a + // partial write or abort if completely out of bounds. (AIA) + if (pos >= na->data_size) { + errno = ENOTSUP; + return -1; + } + count = na->data_size - pos; + } + old_initialized_size = na->initialized_size; + /* If it is a resident attribute, write the data to the mft record. */ + if (!NAttrNonResident(na)) { + char *val; + + ctx = ntfs_get_attr_search_ctx(na->ni, NULL); + if (!ctx) + goto err_out; + if (ntfs_lookup_attr(na->type, na->name, na->name_len, 0, + 0, NULL, 0, ctx)) + goto err_out; + val = (char*)ctx->attr + le16_to_cpu(ctx->attr->value_offset); + if (val < (char*)ctx->attr || val + + le32_to_cpu(ctx->attr->value_length) > + (char*)ctx->mrec + vol->mft_record_size) { + errno = EIO; + goto err_out; + } + memcpy(val + pos, b, count); + if (ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no, + ctx->mrec)) { + /* + * NOTE: We are in a bad state at this moment. We have + * dirtied the mft record but we failed to commit it to + * disk. Since we have read the mft record ok before, + * it is unlikely to fail writing it, so is ok to just + * return error here... (AIA) + */ + goto err_out; + } + ntfs_put_attr_search_ctx(ctx); + return count; + } + total = 0; + /* Find the run list element containing the vcn. */ + rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits); + if (!rl) { + /* + * If the vcn is not present it is an out of bounds write. + * However, we already extended the size of the attribute, + * so getting this here must be an error of some kind. + */ + if (errno == ENOENT) + errno = EIO; + goto err_out; + } + /* Handle writes beyond initialized_size. */ + if (pos + count > na->initialized_size) { + /* Set initialized_size to @pos + @count. */ + ctx = ntfs_get_attr_search_ctx(na->ni, NULL); + if (!ctx) + goto err_out; + if (ntfs_lookup_attr(na->type, na->name, na->name_len, 0, + 0, NULL, 0, ctx)) + goto err_out; + /* If write starts beyond initialized_size, zero the gap. */ + if (pos > na->initialized_size) { + // TODO: Need to write zeroes in the region from + // na->initialized_size to @pos, then update the + // initialized size to equal @pos. If any sparse runs + // are encountered while filling the gap, need to + // honour them, i.e. do not instantiate them. Then can + // continue as if pos <= na->initialized_size, i.e. can + // just fall through and continue. (AIA) + errno = ENOTSUP; + goto err_out; + } + ctx->attr->initialized_size = scpu_to_le64(pos + count); + if (ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no, + ctx->mrec)) { + /* + * Undo the change in the in-memory copy and send it + * back for writing. + */ + ctx->attr->initialized_size = + scpu_to_le64(old_initialized_size); + ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no, + ctx->mrec); + goto err_out; + } + na->initialized_size = pos + count; + ntfs_put_attr_search_ctx(ctx); + ctx = NULL; + /* + * NOTE: At this point the initialized_size in the mft record + * has been updated BUT there is random data on disk thus if + * we decide to abort, we MUST change the initialized_size + * again. + */ + need_to_undo.initialized_size = 1; + } + /* + * Scatter the data from the linear data buffer to the volume. Note, a + * partial final vcn is taken care of by the @count capping of write + * length. + */ + ofs = pos - (rl->vcn << vol->cluster_size_bits); + for (; count; rl++, ofs = 0) { + if (!rl->length) { + errno = EIO; + goto rl_err_out; + } + if (rl->lcn < (LCN)0) { + s64 t; + int cnt; + + if (rl->lcn != (LCN)LCN_HOLE) { + errno = EIO; + goto rl_err_out; + } + /* + * It is a hole. Check if the data buffer is zero in + * this region and if not instantiate the hole. + */ + to_write = min(count, (rl->length << + vol->cluster_size_bits) - ofs); + written = to_write / sizeof(unsigned long); + eo = 0; + for (t = 0; t < written; t++) { + if (((unsigned long*)b)[t]) { + eo = 1; + break; + } + } + cnt = to_write & (sizeof(unsigned long) - 1); + if (cnt && !eo) { + int i; + u8 *b2; + + b2 = b + (to_write & + ~(sizeof(unsigned long) - 1)); + for (i = 0; i < cnt; i++) { + if (b2[i]) { + eo = 1; + break; + } + } + } + if (eo) { + // TODO: Need to instantiate the hole. Then get + // the run list element again checking if it is + // ok and fall through to do the writing. (AIA) + errno = ENOTSUP; + goto rl_err_out; + } + /* + * The buffer region is zero, update progress counters + * and proceed with next run. + */ + total += to_write; + count -= to_write; + b += to_write; + continue; + } + /* It is a real lcn, write it to the volume. */ + to_write = min(count, (rl->length << vol->cluster_size_bits) - + ofs); +retry: + Dprintf("%s(): Writing 0x%Lx bytes to vcn 0x%Lx, lcn 0x%Lx, " + "ofs 0x%Lx.\n", __FUNCTION__, to_write, + rl->vcn, rl->lcn, ofs); + written = ntfs_pwrite(f, (rl->lcn << vol->cluster_size_bits) + + ofs, to_write, b); + /* If everything ok, update progress counters and continue. */ + if (written > 0) { + total += written; + count -= written; + b += written; + continue; + } + /* If the syscall was interrupted, try again. */ + if (written == (s64)-1 && errno == EINTR) + goto retry; + if (!written) + errno = EIO; + goto rl_err_out; + } +done: + if (ctx) + ntfs_put_attr_search_ctx(ctx); + /* Finally, return the number of bytes written. */ + return total; +rl_err_out: + eo = errno; + if (total) { + if (need_to_undo.initialized_size) { + if (pos + total > na->initialized_size) + goto done; + // TODO: Need to try to change initialized_size. If it + // succeeds goto done, otherwise goto err_out. (AIA) + errno = ENOTSUP; + goto err_out; + } + goto done; + } + errno = eo; +err_out: + eo = errno; + if (need_to_undo.initialized_size) { + int err; + + err = 0; + if (!ctx) { + ctx = ntfs_get_attr_search_ctx(na->ni, NULL); + if (!ctx) + err = 1; + } else + ntfs_reinit_attr_search_ctx(ctx); + if (!err) { + err = ntfs_lookup_attr(na->type, na->name, + na->name_len, 0, 0, NULL, 0, ctx); + if (!err) { + na->initialized_size = old_initialized_size; + ctx->attr->initialized_size = scpu_to_le64( + old_initialized_size); + err = ntfs_write_mft_record(vol, + ctx->ntfs_ino->mft_no, + ctx->mrec); + } + } + if (err) { + Dputs("Eeek! Failed to recover from error. Leaving " + "metadata in inconsistent state! Run " + "chkdsk!"); + // FIXME: At this stage could try to recover by filling + // old_initialized_size -> new_initialized_size with + // data or at least zeroes. (AIA) + } + } + if (ctx) + ntfs_put_attr_search_ctx(ctx); + errno = eo; + return -1; +} + +/** + * ntfs_attr_mst_pread - multi sector transfer protected ntfs attribute read + * @na: multi sector transfer protected ntfs attribute to read from + * @pos: byte position in the attribute to begin reading from + * @bk_cnt: number of mst protected blocks to read + * @bk_size: size of each mst protected block in bytes + * @b: output data buffer + * + * This function will read @bk_cnt blocks of size @bk_size bytes each starting + * at offset @pos from the ntfs attribute @na into the data buffer @b. + * + * On success, the multi sector transfer fixups are applied and the number of + * read blocks is returned. If this number is lower than @bk_cnt this means + * that the read has either reached end of attribute or that an error was + * encountered during the read so that the read is partial. 0 means end of + * attribute or nothing to read (also return 0 when @bk_cnt or @bk_size are 0). + * + * On error and nothing has been read, return -1 with errno set appropriately + * to the return code of ntfs_attr_pread() or to EINVAL in case of invalid + * arguments. + * + * NOTE: If an incomplete multi sector transfer is detected the magic is + * changed to BAAD but no error is returned, i.e. it is possible that any of + * the returned blocks have multi sector transfer errors. This should be + * detected by the caller by checking each block with is_baad_recordp(&block). + * The reasoning is that we want to fixup as many blocks as possible and we + * want to return even bad ones to the caller so, e.g. in case of ntfsck, the + * errors can be repaired. + */ +s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, + const u32 bk_size, void *b) +{ + s64 br; + void *end; + + Dprintf("%s(): Entering for inode 0x%Lx, attr type 0x%x, pos 0x%Lx.\n", + __FUNCTION__, (unsigned long long)na->ni->mft_no, + na->type, (long long)pos); + if (bk_cnt < 0 || bk_size % NTFS_SECTOR_SIZE) { + errno = EINVAL; + return -1; + } + br = ntfs_attr_pread(na, pos, bk_cnt * bk_size, b); + if (br <= 0) + return br; + br /= bk_size; + for (end = b + br * bk_size; b < end; b += bk_size) + ntfs_post_read_mst_fixup((NTFS_RECORD*)b, bk_size); + /* Finally, return the number of blocks read. */ + return br; +} + +/** + * ntfs_attr_mst_pwrite - multi sector transfer protected ntfs attribute write + * @na: multi sector transfer protected ntfs attribute to write to + * @pos: position in the attribute to write to + * @bk_cnt: number of mst protected blocks to write + * @bk_size: size of each mst protected block in bytes + * @b: data buffer to write to disk + * + * This function will write @bk_cnt blocks of size @bk_size bytes each from + * data buffer @b to multi sector transfer (mst) protected ntfs attribute @na + * at position @pos. + * + * On success, return the number of successfully written blocks. If this number + * is lower than @bk_cnt this means that an error was encountered during the + * write so that the write is partial. 0 means nothing was written (also + * return 0 when @bk_cnt or @bk_size are 0). + * + * On error and nothing has been written, return -1 with errno set + * appropriately to the return code of ntfs_attr_pwrite(), or to EINVAL in case + * of invalid arguments. + * + * NOTE: We mst protect the data, write it, then mst deprotect it using a quick + * deprotect algorithm (no checking). This saves us from making a copy before + * the write and at the same time causes the usn to be incremented in the + * buffer. This conceptually fits in better with the idea that cached data is + * always deprotected and protection is performed when the data is actually + * going to hit the disk and the cache is immediately deprotected again + * simulating an mst read on the written data. This way cache coherency is + * achieved. + */ +s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, + const u32 bk_size, void *b) +{ + s64 written, i; + + Dprintf("%s(): Entering for inode 0x%Lx, attr type 0x%x, pos 0x%Lx.\n", + __FUNCTION__, (unsigned long long)na->ni->mft_no, + na->type, (long long)pos); + if (bk_cnt < 0 || bk_size % NTFS_SECTOR_SIZE) { + errno = EINVAL; + return -1; + } + if (!bk_cnt) + return 0; + /* Prepare data for writing. */ + for (i = 0; i < bk_cnt; ++i) { + int err; + + err = ntfs_pre_write_mst_fixup((NTFS_RECORD*)(b + i * bk_size), + bk_size); + if (err < 0) { + /* Abort write at this position. */ + if (!i) + return err; + bk_cnt = i; + break; + } + } + /* Write the prepared data. */ + written = ntfs_attr_pwrite(na, pos, bk_cnt * bk_size, b); + /* Quickly deprotect the data again. */ + for (i = 0; i < bk_cnt; ++i) + ntfs_post_write_mst_fixup((NTFS_RECORD*)(b + i * bk_size)); + if (written <= 0) + return written; + /* Finally, return the number of complete blocks written. */ + return written / bk_size; +} + +/** + * Internal: + * + * ntfs_find_attr - find (next) attribute in mft record + * @type: attribute type to find + * @name: attribute name to find (optional, i.e. NULL means don't care) + * @name_len: attribute name length (only needed if @name present) + * @ic: IGNORE_CASE or CASE_SENSITIVE (ignored if @name not present) + * @val: attribute value to find (optional, resident attributes only) + * @val_len: attribute value length + * @ctx: search context with mft record and attribute to search from + * + * You shouldn't need to call this function directly. Use lookup_attr() instead. + * + * ntfs_find_attr() takes a search context @ctx as parameter and searches the + * mft record specified by @ctx->mrec, beginning at @ctx->attr, for an + * attribute of @type, optionally @name and @val. If found, ntfs_find_attr() + * returns 0 and @ctx->attr will point to the found attribute. If not found, + * ntfs_find_attr() returns -1, with errno set to the error code and @ctx->attr + * is undefined (i.e. do not rely on it not changing). + * + * If @ctx->is_first is TRUE, the search begins with @ctx->attr itself. If it + * is FALSE, the search begins after @ctx->attr. + * + * If @type is zero (i.e. AT_UNUSED), return the first found attribute, i.e. + * one can enumerate all attributes by setting @type to zero and then calling + * ntfs_find_attr() repeatedly until it returns -1 with errno set to ENOENT to + * indicate that there are no more entries. During the enumeration, each + * successful call of ntfs_find_attr() will return the next attribute in the + * mft record @ctx->mrec. + * + * If @type is AT_END, seek to the end and return -1 with errno set to ENOENT. + * AT_END is not a valid attribute, its length is zero for example, thus it is + * safer to return error instead of success in this case. This also allows us + * to interoperate cleanly with ntfs_find_external_attr(). + * + * If @name is AT_UNNAMED search for an unnamed attribute. If @name is present + * but not AT_UNNAMED search for a named attribute matching @name. Otherwise, + * match both named and unnamed attributes. + * + * If @ic is IGNORE_CASE, the @name comparisson is not case sensitive and + * @ctx->ntfs_ino must be set to the ntfs inode to which the mft record + * @ctx->mrec belongs. This is so we can get at the ntfs volume and hence at + * the upcase table. If @ic is CASE_SENSITIVE, the comparison is case + * sensitive. When @name is present, @name_len is the @name length in Unicode + * characters. + * + * If @name is not present (NULL), we assume that the unnamed attribute is + * being searched for. + * + * Finally, the resident attribute value @val is looked for, if present. + * If @val is not present (NULL), @val_len is ignored. + * + * ntfs_find_attr() only searches the specified mft record and it ignores the + * presence of an attribute list attribute (unless it is the one being searched + * for, obviously). If you need to take attribute lists into consideration, use + * ntfs_lookup_attr() instead (see below). This also means that you cannot use + * ntfs_find_attr() to search for extent records of non-resident attributes, as + * extents with lowest_vcn != 0 are usually described by the attribute list + * attribute only. - Note that it is possible that the first extent is only in + * the attribute list while the last extent is in the base mft record, so don't + * rely on being able to find the first extent in the base mft record. + * + * Warning: Never use @val when looking for attribute types which can be + * non-resident as this most likely will result in a crash! + */ +static int ntfs_find_attr(const ATTR_TYPES type, const uchar_t *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) +{ + ATTR_RECORD *a; + ntfs_volume *vol; + uchar_t *upcase; + u32 upcase_len; + + if (!ctx || !ctx->mrec || !ctx->attr) { + errno = EINVAL; + return -1; + } + if (ic == IGNORE_CASE) { + vol = ctx->ntfs_ino->vol; + upcase = vol->upcase; + upcase_len = vol->upcase_len; + } else { + vol = NULL; + upcase = NULL; + upcase_len = 0; + } + /* + * Iterate over attributes in mft record starting at @ctx->attr, or the + * attribute following that, if @ctx->is_first is TRUE. + */ + if (ctx->is_first) { + a = ctx->attr; + ctx->is_first = FALSE; + } else + a = (ATTR_RECORD*)((char*)ctx->attr + + le32_to_cpu(ctx->attr->length)); + for (;; a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length))) { + if (p2n(a) < p2n(ctx->mrec) || (char*)a > (char*)ctx->mrec + + le32_to_cpu(ctx->mrec->bytes_allocated)) + break; + ctx->attr = a; + /* We catch $END with this more general check, too... */ + if ((type && (le32_to_cpu(a->type) > le32_to_cpu(type))) || + (a->type == AT_END)) { + errno = ENOENT; + return -1; + } + if (!a->length) + break; + /* If this is an enumeration return this attribute. */ + if (!type) + return 0; + if (a->type != type) + continue; + /* + * If @name is AT_UNNAMED we want an unnamed attribute. + * If @name is present, compare the two names. + * Otherwise, match any attribute. + */ + if (name == AT_UNNAMED) { + /* The search failed if the found attribute is named. */ + if (a->name_length) { + errno = ENOENT; + return -1; + } + } else if (name && !ntfs_are_names_equal(name, name_len, + (uchar_t*)((char*)a + le16_to_cpu(a->name_offset)), + a->name_length, ic, upcase, upcase_len)) { + register int rc; + + rc = ntfs_collate_names(name, name_len, + (uchar_t*)((char*)a + + le16_to_cpu(a->name_offset)), + a->name_length, 1, IGNORE_CASE, + upcase, upcase_len); + /* + * If @name collates before a->name, there is no + * matching attribute. + */ + if (rc == -1) { + errno = ENOENT; + return -1; + } + /* If the strings are not equal, continue search. */ + if (rc) + continue; + rc = ntfs_collate_names(name, name_len, + (uchar_t*)((char*)a + + le16_to_cpu(a->name_offset)), + a->name_length, 1, CASE_SENSITIVE, + upcase, upcase_len); + if (rc == -1) { + errno = ENOENT; + return -1; + } + if (rc) + continue; + } + /* + * The names match or @name not present and attribute is + * unnamed. If no @val specified, we have found the attribute + * and are done. + */ + if (!val) + return 0; + /* @val is present; compare values. */ + else { + register int rc; + + rc = memcmp(val, (char*)a +le16_to_cpu(a->value_offset), + min(val_len, + le32_to_cpu(a->value_length))); + /* + * If @val collates before the current attribute's + * value, there is no matching attribute. + */ + if (!rc) { + register u32 avl; + avl = le32_to_cpu(a->value_length); + if (val_len == avl) + return 0; + if (val_len < avl) { + errno = ENOENT; + return -1; + } + } else if (rc < 0) { + errno = ENOENT; + return -1; + } + } + } + Dputs("ntfs_find_attr(): File is corrupt. Run chkdsk."); + errno = EIO; + return -1; +} + +/** + * Internal: + * + * ntfs_find_external_attr - find an attribute in the attribute list of an inode + * @type: attribute type to find + * @name: attribute name to find (optional, i.e. NULL means don't care) + * @name_len: attribute name length (only needed if @name present) + * @ic: IGNORE_CASE or CASE_SENSITIVE (ignored if @name not present) + * @lowest_vcn: lowest vcn to find (optional, non-resident attributes only) + * @val: attribute value to find (optional, resident attributes only) + * @val_len: attribute value length + * @ctx: search context with mft record and attribute to search from + * + * You shouldn't need to call this function directly. Use ntfs_lookup_attr() + * instead. + * + * Find an attribute by searching the attribute list for the corresponding + * attribute list entry. Having found the entry, map the mft record for read + * if the attribute is in a different mft record/inode, find the attribute in + * there and return it. + * + * If @type is zero (i.e. AT_UNUSED), return the first found attribute, i.e. + * one can enumerate all attributes by setting @type to zero and then calling + * ntfs_find_external_attr() repeatedly until it returns -1 with errno set to + * ENOENT to indicate that there are no more entries. During the enumeration, + * each successful call of ntfs_find_external_attr() will return the next + * attribute described by the attribute list of the base mft record described + * by the search context @ctx. + * + * If @type is AT_END, seek to the end and return -1 with errno set to ENOENT. + * AT_END is not a valid attribute, its length is zero for example, thus it is + * safer to return error instead of success in this case. + * + * If @name is AT_UNNAMED search for an unnamed attribute. If @name is present + * but not AT_UNNAMED search for a named attribute matching @name. Otherwise, + * match both named and unnamed attributes. + * + * On first search @ctx->ntfs_ino must be the inode of the base mft record and + * @ctx must have been obtained from a call to ntfs_get_attr_search_ctx(). + * On subsequent calls, @ctx->ntfs_ino can be any extent inode, too + * (@ctx->base_ntfs_ino is then the base inode). + * + * After finishing with the attribute/mft record you need to call + * ntfs_put_attr_search_ctx() to cleanup the search context (unmapping any + * mapped extent inodes, etc). + * + * Return 0 if the search was successful and -1 if not, with errno set to the + * error code. + * + * On success, @ctx->attr is the found attribute and it is in mft record + * @ctx->mrec. + * + * On error, @ctx->attr is the attribute which collates just after the attribute + * being searched for in the base ntfs inode, i.e. if one wants to add the + * attribute to the mft record this is the correct place to insert it into, + * and if there is not enough space, the attribute should be placed in an + * extent mft record. @ctx->al_entry points to the position within + * @ctx->base_ntfs_ino->attr_list at which the new attribute's attribute list + * entry should be inserted. + * + * The following error codes are defined: + * ENOENT Attribute not found, not an error as such. + * EINVAL Invalid arguments. + * EIO I/O error or corrupt data structures found. + * ENOMEM Not enough memory to allocate necessary buffers. + */ +static int ntfs_find_external_attr(ATTR_TYPES type, const uchar_t *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const VCN lowest_vcn, const u8 *val, const u32 val_len, + ntfs_attr_search_ctx *ctx) +{ + ntfs_inode *base_ni, *ni; + ntfs_volume *vol; + ATTR_LIST_ENTRY *al_entry, *next_al_entry; + char *al_start, *al_end; + ATTR_RECORD *a; + uchar_t *al_name; + u32 al_name_len; + + ni = ctx->ntfs_ino; + base_ni = ctx->base_ntfs_ino; + Dprintf("Entering for inode %Lu, attribute type 0x%x.\n", + (unsigned long long)ni->mft_no, type); + if (!base_ni) { + /* First call happens with the base mft record. */ + base_ni = ctx->base_ntfs_ino = ctx->ntfs_ino; + ctx->base_mrec = ctx->mrec; + } + if (type == AT_END) + goto not_found; + if (ni == base_ni) + ctx->base_attr = ctx->attr; + vol = base_ni->vol; + al_start = base_ni->attr_list; + al_end = al_start + base_ni->attr_list_size; + if (!ctx->al_entry) + ctx->al_entry = (ATTR_LIST_ENTRY*)al_start; + /* + * Iterate over entries in attribute list starting at @ctx->al_entry, + * or the entry following that, if @ctx->is_first is TRUE. + */ + if (ctx->is_first) { + al_entry = ctx->al_entry; + ctx->is_first = FALSE; + } else + al_entry = (ATTR_LIST_ENTRY*)((char*)ctx->al_entry + + le16_to_cpu(ctx->al_entry->length)); + for (;; al_entry = next_al_entry) { + /* Out of bounds check. */ + if ((u8*)al_entry < base_ni->attr_list || + (char*)al_entry > al_end) + break; /* Inode is corrupt. */ + ctx->al_entry = al_entry; + /* Catch the end of the attribute list. */ + if ((char*)al_entry == al_end) + goto not_found; + if (!al_entry->length) + break; + if ((char*)al_entry + 6 > al_end || (char*)al_entry + + le16_to_cpu(al_entry->length) > al_end) + break; + next_al_entry = (ATTR_LIST_ENTRY*)((char*)al_entry + + le16_to_cpu(al_entry->length)); + if (type) { + if (le32_to_cpu(al_entry->type) > le32_to_cpu(type)) + goto not_found; + if (type != al_entry->type) + continue; + } + al_name_len = al_entry->name_length; + al_name = (uchar_t*)((char*)al_entry + al_entry->name_offset); + /* + * If !@type we want the attribute represented by this + * attribute list entry. + */ + if (!type) + goto is_enumeration; + /* + * If @name is AT_UNNAMED we want an unnamed attribute. + * If @name is present, compare the two names. + * Otherwise, match any attribute. + */ + if (name == AT_UNNAMED) { + if (al_name_len) + goto not_found; + } else if (name && !ntfs_are_names_equal(al_name, al_name_len, + name, name_len, ic, vol->upcase, + vol->upcase_len)) { + register int rc; + + rc = ntfs_collate_names(name, name_len, al_name, + al_name_len, 1, IGNORE_CASE, + vol->upcase, vol->upcase_len); + /* + * If @name collates before al_name, there is no + * matching attribute. + */ + if (rc == -1) + goto not_found; + /* If the strings are not equal, continue search. */ + if (rc) + continue; + /* + * FIXME: Reverse engineering showed 0, IGNORE_CASE but + * that is inconsistent with ntfs_find_attr(). The + * subsequent rc checks were also different. Perhaps I + * made a mistake in one of the two. Need to recheck + * which is correct or at least see what is going + * on... (AIA) + */ + rc = ntfs_collate_names(name, name_len, al_name, + al_name_len, 1, CASE_SENSITIVE, + vol->upcase, vol->upcase_len); + if (rc == -1) + goto not_found; + if (rc) + continue; + } + /* + * The names match or @name not present and attribute is + * unnamed. Now check @lowest_vcn. Continue search if the + * next attribute list entry still fits @lowest_vcn. Otherwise + * we have reached the right one or the search has failed. + */ + if (lowest_vcn && (char*)next_al_entry >= al_start && + (char*)next_al_entry + 6 < al_end && + (char*)next_al_entry + le16_to_cpu( + next_al_entry->length) <= al_end && + sle64_to_cpu(next_al_entry->lowest_vcn) <= + sle64_to_cpu(lowest_vcn) && + next_al_entry->type == al_entry->type && + next_al_entry->name_length == al_name_len && + ntfs_are_names_equal((uchar_t*)((char*) + next_al_entry + + next_al_entry->name_offset), + next_al_entry->name_length, + al_name, al_name_len, CASE_SENSITIVE, + vol->upcase, vol->upcase_len)) + continue; +is_enumeration: + if (MREF_LE(al_entry->mft_reference) == ni->mft_no) { + if (MSEQNO_LE(al_entry->mft_reference) != + le16_to_cpu( + ni->mrec->sequence_number)) { + Dputs("Found stale mft reference in attribute " + "list!"); + break; + } + } else { /* Mft references do not match. */ + /* If there is a mapped extent inode unmap it first. */ + if (ni != base_ni) + ntfs_close_inode(ni); + /* Do we want the base record back? */ + if (MREF_LE(al_entry->mft_reference) == + base_ni->mft_no) { + ni = ctx->ntfs_ino = base_ni; + ctx->mrec = ctx->base_mrec; + } else { + /* We want an extent record. */ + ni = ntfs_open_extent_inode(base_ni, + al_entry->mft_reference); + if (!ni) { + Dperror("Failed to map extent inode"); + break; + } + ctx->ntfs_ino = ni; + ctx->mrec = ni->mrec; + } + ctx->attr = (ATTR_RECORD*)((char*)ctx->mrec + + le16_to_cpu(ctx->mrec->attrs_offset)); + } + /* + * ctx->ntfs_ino, ctx->mrec, and ctx->attr now point to the + * mft record containing the attribute represented by the + * current al_entry. + */ + /* + * We could call into ntfs_find_attr() to find the right + * attribute in this mft record but this would be less + * efficient and not quite accurate as ntfs_find_attr() ignores + * the attribute instance numbers for example which become + * important when one plays with attribute lists. Also, because + * a proper match has been found in the attribute list entry + * above, the comparison can now be optimized. So it is worth + * re-implementing a simplified ntfs_find_attr() here. + */ + a = ctx->attr; + /* + * Use a manual loop so we can still use break and continue + * with the same meanings as above. + */ +do_next_attr_loop: + if ((char*)a < (char*)ctx->mrec || (char*)a > (char*)ctx->mrec + + le32_to_cpu(ctx->mrec->bytes_allocated)) + break; + if (a->type == AT_END) + continue; + if (!a->length) + break; + if (al_entry->instance != a->instance) + goto do_next_attr; + /* + * If the type and/or the name are/is mismatched between the + * attribute list entry and the attribute record, there is + * corruption so we break and return error EIO. + */ + if (al_entry->type != a->type) + break; + if (!ntfs_are_names_equal((uchar_t*)((char*)a + + le16_to_cpu(a->name_offset)), + a->name_length, al_name, + al_name_len, CASE_SENSITIVE, + vol->upcase, vol->upcase_len)) + break; + ctx->attr = a; + /* + * If no @val specified or @val specified and it matches, we + * have found it! Also, if !@type, it is an enumeration, so we + * want the current attribute. + */ + if (!type || !val || (!a->non_resident && + le32_to_cpu(a->value_length) == val_len && + !memcmp((char*)a + le16_to_cpu(a->value_offset), + val, val_len))) { + return 0; + } +do_next_attr: + /* Proceed to the next attribute in the current mft record. */ + a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); + goto do_next_attr_loop; + } + if (ni != base_ni) { + if (ni) + ntfs_close_inode(ni); + ctx->ntfs_ino = base_ni; + ctx->mrec = ctx->base_mrec; + ctx->attr = ctx->base_attr; + } + Dputs("Inode is corrupt."); + errno = EIO; + return -1; +not_found: + /* + * Seek to the end of the base mft record, i.e. when we return false, + * ctx->mrec and ctx->attr indicate where the attribute should be + * inserted into the attribute record. + * And of course ctx->al_entry points to the end of the attribute + * list inside ctx->base_ntfs_ino->attr_list. + * + * FIXME: Do we really want to do this here? Think about it... (AIA) + */ + ntfs_reinit_attr_search_ctx(ctx); + /* + * If we were enumerating and reached the end, we can't just use !@type + * because that would return the first attribute instead of the last + * one. Thus we just change @type to AT_END which causes + * ntfs_find_attr() to seek to the end. + */ + if (!type) + type = AT_END; + return ntfs_find_attr(type, name, name_len, ic, val, val_len, ctx); +} + +/** + * ntfs_lookup_attr - find an attribute in an ntfs inode + * @type: attribute type to find + * @name: attribute name to find (optional, i.e. NULL means don't care) + * @name_len: attribute name length (only needed if @name present) + * @ic: IGNORE_CASE or CASE_SENSITIVE (ignored if @name not present) + * @lowest_vcn: lowest vcn to find (optional, non-resident attributes only) + * @val: attribute value to find (optional, resident attributes only) + * @val_len: attribute value length + * @ctx: search context with mft record and attribute to search from + * + * Find an attribute in an ntfs inode. On first search @ctx->ntfs_ino must + * be the base mft record and @ctx must have been obtained from a call to + * ntfs_get_attr_search_ctx(). + * + * This function transparently handles attribute lists and @ctx is used to + * continue searches where they were left off at. + * + * If @type is zero (i.e. AT_UNUSED), return the first found attribute, i.e. + * one can enumerate all attributes by setting @type to zero and then calling + * ntfs_lookup_attr() repeatedly until it returns -1 with errno set to ENOENT + * to indicate that there are no more entries. During the enumeration, each + * successful call of ntfs_lookup_attr() will return the next attribute, with + * the current attribute being described by the search context @ctx. + * + * If @type is AT_END, seek to the end of the attribute and return -1 with + * errno set to ENOENT. AT_END is not a valid attribute, its length is zero for + * example, thus it is safer to return error instead of success in this case. + * It should never ne needed to do this, but we implement the functionality + * because it allows for simpler code inside ntfs_find_external_attr(). + * + * If @name is AT_UNNAMED search for an unnamed attribute. If @name is present + * but not AT_UNNAMED search for a named attribute matching @name. Otherwise, + * match both named and unnamed attributes. + * + * After finishing with the attribute/mft record you need to call + * ntfs_put_attr_search_ctx() to cleanup the search context (unmapping any + * mapped extent inodes, etc). + * + * Return 0 if the search was successful and -1 if not, with errno set to the + * error code. + * + * On success, @ctx->attr is the found attribute and it is in mft record + * @ctx->mrec. + * + * On error, @ctx->attr is the attribute which collates just after the attribute + * being searched for, i.e. if one wants to add the attribute to the mft + * record this is the correct place to insert it into. @ctx->al_entry points to + * the position within @ctx->base_ntfs_ino->attr_list at which the new + * attribute's attribute list entry should be inserted. + * + * The following error codes are defined: + * ENOENT Attribute not found, not an error as such. + * EINVAL Invalid arguments. + * EIO I/O error or corrupt data structures found. + * ENOMEM Not enough memory to allocate necessary buffers. + */ +int ntfs_lookup_attr(const ATTR_TYPES type, const uchar_t *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const VCN lowest_vcn, const u8 *val, const u32 val_len, + ntfs_attr_search_ctx *ctx) +{ + ntfs_inode *base_ni; + + if (!ctx || !ctx->mrec || !ctx->attr) { + errno = EINVAL; + return -1; + } + if (ctx->base_ntfs_ino) + base_ni = ctx->base_ntfs_ino; + else + base_ni = ctx->ntfs_ino; + if (!base_ni || !NInoAttrList(base_ni) || type == AT_ATTRIBUTE_LIST) + return ntfs_find_attr(type, name, name_len, ic, val, val_len, + ctx); + return ntfs_find_external_attr(type, name, name_len, ic, lowest_vcn, + val, val_len, ctx); +} + +/** + * Internal: + * + * ntfs_init_attr_search_ctx - initialize an attribute search context + * @ctx: attribute search context to initialize + * @ni: ntfs inode with which to initialize the search context + * @mrec: mft record with which to initialize the search context + * + * Initialize the attribute search context @ctx with @ni and @mrec. + */ +static __inline__ void ntfs_init_attr_search_ctx(ntfs_attr_search_ctx *ctx, + ntfs_inode *ni, MFT_RECORD *mrec) +{ + if (ni && !mrec) + mrec = ni->mrec; + ctx->mrec = mrec; + /* Sanity checks are performed elsewhere. */ + ctx->attr = (ATTR_RECORD*)((char*)mrec + + le16_to_cpu(mrec->attrs_offset)); + ctx->is_first = TRUE; + ctx->ntfs_ino = ni; + ctx->al_entry = NULL; + ctx->base_ntfs_ino = NULL; + ctx->base_mrec = NULL; + ctx->base_attr = NULL; +} + +/** + * ntfs_reinit_attr_search_ctx - reinitialize an attribute search context + * @ctx: attribute search context to reinitialize + * + * Reinitialize the attribute search context @ctx, unmapping an associated + * extent mft record if present, and initialize the search context again. + * + * This is used when a search for a new attribute is being started to reset + * the search context to the beginning. + */ +void ntfs_reinit_attr_search_ctx(ntfs_attr_search_ctx *ctx) +{ + if (!ctx->base_ntfs_ino) { + /* No attribute list. */ + ctx->is_first = TRUE; + /* Sanity checks are performed elsewhere. */ + ctx->attr = (ATTR_RECORD*)((char*)ctx->mrec + + le16_to_cpu(ctx->mrec->attrs_offset)); + return; + } /* Attribute list. */ + if (ctx->ntfs_ino != ctx->base_ntfs_ino) + ntfs_close_inode(ctx->ntfs_ino); + ntfs_init_attr_search_ctx(ctx, ctx->base_ntfs_ino, ctx->base_mrec); + return; +} + +/** + * ntfs_get_attr_search_ctx - allocate/initialize a new attribute search context + * @ctx: address of pointer in which to return the new search context + * @ni: ntfs inode with which to initialize the search context + * @mrec: mft record with which to initialize the search context + * + * Allocate a new attribute search context, initialize it with @ni and @mrec, + * and return it. Return NULL on error with errno set to ENOMEM. + * + * @ni can be NULL if the search context is only going to be used for searching + * for the attribute list attribute and for searches ignoring the contents of + * the attribute list attribute. + * + * If @ni is specified, @mrec can be NULL, in which case the mft record is + * taken from @ni. + * + * If both @ni and @mrec are specified, the mft record is taken from @mrec and + * the value of @ni->mrec is ignored. + */ +ntfs_attr_search_ctx *ntfs_get_attr_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) +{ + ntfs_attr_search_ctx *ctx = malloc(sizeof(ntfs_attr_search_ctx)); + if (ctx) + ntfs_init_attr_search_ctx(ctx, ni, mrec); + return ctx; +} + +/** + * ntfs_put_attr_search_ctx - release an attribute search context + * @ctx: attribute search context to free + * + * Release the attribute search context @ctx, unmapping an associated extent + * mft record if present. + */ +void ntfs_put_attr_search_ctx(ntfs_attr_search_ctx *ctx) +{ + if (ctx->base_ntfs_ino && ctx->ntfs_ino != ctx->base_ntfs_ino) + ntfs_close_inode(ctx->ntfs_ino); + free(ctx); + return; +} + +/** + * ntfs_get_nr_significant_bytes - get number of bytes needed to store a number + * @n: number for which to get the number of bytes for + * + * Return the number of bytes required to store @n unambiguously as + * a signed number. + * + * This is used in the context of the mapping pairs array to determine how + * many bytes will be needed in the array to store a given logical cluster + * number (lcn) or a specific run length. + * + * Return the number of bytes written. This function cannot fail. + */ +__inline__ int ntfs_get_nr_significant_bytes(const s64 n) +{ + s64 l = n; + int i; + s8 j; + + i = 0; + do { + l >>= 8; + i++; + } while (l != 0LL && l != -1LL); + j = (n >> 8 * (i - 1)) & 0xff; + /* If the sign bit is wrong, we need an extra byte. */ + if ((n < 0LL && j >= 0) || (n > 0LL && j < 0)) + i++; + return i; +} + +/** + * ntfs_get_size_for_mapping_pairs - get bytes needed for mapping pairs array + * @vol: ntfs volume (needed for the ntfs version) + * @rl: run list for which to determine the size of the mapping pairs + * + * Walk the run list @rl and calculate the size in bytes of the mapping pairs + * array corresponding to the run list @rl. This for example allows us to + * allocate a buffer of the right size when building the mapping pairs array. + * + * Return the calculated size in bytes on success. If @rl is NULL return 0. + * On error, return -1 with errno set to the error code. The following error + * codes are defined: + * EINVAL - Run list contains unmapped elements. Make sure to only pass + * fully mapped run lists to this function. + * EIO - The run list is corrupt. + */ +int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, + const run_list_element *rl) +{ + LCN prev_lcn; + int i, rls; + + if (!rl) + return 0; + /* Always need the termining zero byte. */ + rls = 1; + for (prev_lcn = i = 0; rl[i].length; prev_lcn = rl[++i].lcn) { + if (rl[i].length < 0 || rl[i].lcn < LCN_HOLE) + goto err_out; + /* Header byte + length. */ + rls += 1 + ntfs_get_nr_significant_bytes(rl[i].length); + /* + * If the logical cluster number (lcn) denotes a hole and we + * are on NTFS 3.0+, we don't store it at all, i.e. we need + * zero space. On earlier NTFS versions we just store the lcn. + */ + if (rl[i].lcn == LCN_HOLE && vol->major_ver >= 3) + continue; + /* Change in lcn. */ + rls += ntfs_get_nr_significant_bytes(rl[i].lcn - prev_lcn); + } + return rls; +err_out: + if (rl[i].lcn == LCN_RL_NOT_MAPPED) + errno = EINVAL; + else + errno = EIO; + return -1; +} + +/** + * ntfs_write_significant_bytes - write the significant bytes of a number + * @dst: destination buffer to write to + * @dst_max: pointer to last byte of destination buffer for bounds checking + * @n: number whose significant bytes to write + * + * Store in @dst, the minimum bytes of the number @n which are required to + * identify @n unambiguously as a signed number, taking care not to exceed + * @dest_max, the maximum position within @dst to which we are allowed to + * write. + * + * This is used when building the mapping pairs array of a run list to compress + * a given logical cluster number (lcn) or a specific run length to the minumum + * size possible. + * + * Return the number of bytes written on success. On error, i.e. the + * destination buffer @dst is too small, return -1 with errno set ENOSPC. + */ +__inline__ int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, + const s64 n) +{ + s64 l = n; + int i; + s8 j; + + i = 0; + do { + if (dst > dst_max) + goto err_out; + *dst++ = l & 0xffLL; + l >>= 8; + i++; + } while (l != 0LL && l != -1LL); + j = (n >> 8 * (i - 1)) & 0xff; + /* If the sign bit is wrong, we need an extra byte. */ + if (n < 0LL && j >= 0) { + if (dst > dst_max) + goto err_out; + i++; + *dst = (s8)-1; + } else if (n > 0LL && j < 0) { + if (dst > dst_max) + goto err_out; + i++; + *dst = (s8)0; + } + return i; +err_out: + errno = ENOSPC; + return -1; +} + From 290baa4af25562829a3501889fb1b04b88703286 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0054/2994] a couple of new bits, nothing original 2002/07/16 23:41:43-00:00 !flatcap sort out the output and some of the return values 2002/07/15 16:30:41-00:00 !flatcap more tidying, more comments 2002/07/14 15:53:03-00:00 !flatcap perform some checks on the device we're opening 2002/07/14 14:49:22-00:00 !flatcap open vol read-only, filter by last mod time 2002/07/14 11:20:20-00:00 !flatcap filename regex matching works, default to case insensitive matching 2002/07/13 16:33:00-00:00 !flatcap start to fill in the options 2002/07/11 13:18:12-00:00 !flatcap start to break up the dependency loops in the header files 2002/07/01 13:30:28-00:00 !flatcap lots of comments 2002/06/30 22:46:51-00:00 !flatcap undelete -> ntfsundelete (Logical change 1.5) --- ntfstools/ntfsundelete.h | 104 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/ntfstools/ntfsundelete.h b/ntfstools/ntfsundelete.h index e69de29b..21a63d8b 100644 --- a/ntfstools/ntfsundelete.h +++ b/ntfstools/ntfsundelete.h @@ -0,0 +1,104 @@ +/* + * ntfsundelete - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Richard Russon + * + * This utility will recover deleted files from an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFSUNDELETE_H_ +#define _NTFSUNDELETE_H_ + +#include "types.h" +#include "list.h" +#include "runlist.h" + +enum optmode { + MODE_NONE = 0, + MODE_SCAN, + MODE_UNDELETE, + MODE_COPY, + MODE_ERROR +}; + +struct options { + char *device; /* Device/File to work with */ + enum optmode mode; /* Scan / Undelete / Copy */ + int percent; /* Minimum recoverability */ + int uinode; /* Undelete this inode */ + char *dest; /* Save file to this directory */ + char *output; /* With this filename */ + char fillbyte; /* Use for unrecoverable sections */ + char *match; /* Pattern for filename matching */ + int match_case; /* Case sensitive matching */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int force; /* Override common sense */ + time_t since; /* Since this time */ + long long size_begin; /* Range for file size */ + long long size_end; + long long mft_begin; /* Range for mft copy */ + long long mft_end; +}; + +struct filename { + struct list_head list; /* Previous/Next links */ + char *name; /* Filename in current locale */ + FILE_NAME_TYPE_FLAGS name_space; + uchar_t *uname; /* Filename in unicode */ + int uname_len; /* and its length */ + long long size_alloc; /* Allocated size (multiple of cluster size) */ + long long size_data; /* Actual size of data */ + FILE_ATTR_FLAGS flags; + time_t date_c; + time_t date_a; + time_t date_m; + time_t date_r; +}; + +struct data { + struct list_head list; /* Previous/Next links */ + char *name; /* Stream name in current locale */ + uchar_t *uname; /* Unicode stream name */ + int uname_len; /* and its length */ + int resident; /* Stream is resident */ + int compressed; /* Stream is compressed */ + int encrypted; /* Stream is encrypted */ + long long size_alloc; /* Allocated size (multiple of cluster size) */ + long long size_data; /* Actual size of data */ + long long size_init; /* Initialised size, may be less than data size */ + long long size_vcn; /* Highest VCN in the data runs */ + run_list_element*run_list; /* Decoded data runs */ + int percent; /* Amont potentially recoverable */ + void *data; /* If resident, a pointer to the data */ +}; + +struct ufile { + long long inode; /* MFT record number */ + time_t date; /* Last modification date/time */ + struct list_head name; /* A list of filenames */ + struct list_head data; /* A list of data streams */ + char *pref_name; /* Preferred filename */ + long long max_size; /* Largest size we find */ + int attr_list; /* MFT record may be one of many */ + int directory; /* MFT record represents a directory */ + MFT_RECORD *mft; /* Raw MFT record */ +}; + +#endif /* _NTFSUNDELETE_H_ */ + From 35e8097a0d015790926dec0573668191d4c3ab9a Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0055/2994] add ntfsundelete to the build. fix rpm build. trawl for typos. 2002/04/12 15:23:47-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2002/03/12 21:55:30-00:00 !antona Update docs and bump version to 1.6.0. 2002/01/26 02:28:29-00:00 !antona Update docs. 2002/01/10 10:54:27-00:00 !antona Updates 2002/01/10 10:19:29-00:00 !antona Update changelog. 2001/12/06 01:16:32-00:00 !antona Update version number for ntfsfix 2001/11/10 16:24:11-00:00 !antona More logfile size updates so we are more sane with floppies. 2001/11/10 14:47:39-00:00 !antona Debug display bug fixes. 2001/11/10 14:27:38-00:00 !antona And more typos. 2001/11/10 14:25:33-00:00 !antona Oops. Didn't compile. Typo 2001/11/10 14:22:15-00:00 !antona Remove obsoleted disklabel.h stuff. 2001/11/10 14:17:39-00:00 !antona Enhance mkntfs' device size determination. 2001/11/10 03:06:05-00:00 !antona Bug fixes and debug output enhancements. 2001/11/09 23:36:16-00:00 !antona Bug fixes 2001/11/09 21:30:51-00:00 !antona Considering added functionality change version number to 1.3.0, update docs and mkntfs man page. 2001/11/09 18:24:32-00:00 !antona Updates to docs, layout.h and ntfsfix to support Windows XP NTFS 2001/08/27 16:58:07-00:00 !antona Updates. 2001/08/02 01:44:56-00:00 !antona Add ntfsfix man page and spell fixes. Update to 1.2.1 version and update all text files to go with it and the rpm spec file. 2001/07/25 23:11:49-00:00 !antona Update text files 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/16 19:59:51-00:00 !antona Update ntfsdump_logfile and dumplog and the relevant textfiles. 2001/06/16 19:23:39-00:00 !antona Version number update 2001/06/16 19:22:45-00:00 !antona Get rid of logfile stuff for mkntfs as it is clearly not needed. 2001/06/13 19:04:20-00:00 !antona Final prerelease. Updated version numbers of mkntfs in readme and rpm spec files. 2001/06/11 19:11:37-00:00 !antona Fix rpm generation. Circumvent configure bug by cheating in configure.in moving around nonopt to host and setting nonopt to NONE. 2001/06/10 18:30:16-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. 2001/02/02 01:15:17-00:00 !antona Updated documentation and other text files. Preparing for initial release. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- README | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/README b/README index e69de29b..e1b238a7 100644 --- a/README +++ b/README @@ -0,0 +1,69 @@ + +Linux-NTFS +========== + +The Linux-NTFS project aims to bring full support for the NTFS filesystem to +the Linux operating system. + +Linux-NTFS is copyright (c) 2000-2002 Anton Altaparmakov. + +All of the contents of the Linux-NTFS project are free software, released under +the GNU General Public License and you are welcome to redistribute them under +certain conditions. +All the libraries and utilities come with ABSOLUTELY NO WARRANTY; for details +read the GNU General Public License to be found in the file COPYING in the main +Linux-NTFS distribution directory. + +Linux-NTFS currently consists of the NTFS library (libntfs) and utilities +(ntfstools). In the future it will also contain a new NTFS driver for the +Linux kernel. + +The Linux-NTFS project is registered on Sourceforge.net. The home page for +Linux-NTFS is http://linux-ntfs.sf.net/ and the project page is: +http://sf.net/projects/linux-ntfs/ + +If you would like to take part in the development of Linux-NTFS, you are +invited to subscribe to the development mailing list, +linux-ntfs-dev@lists.sourceforge.net. The easiest way to do this is to visit +the list page on sourceforge at: + http://lists.sourceforge.net/lists/listinfo/linux-ntfs-dev + +If you would like to be kept up to date about new releases and other Linux-NTFS +announcements, subscribe to the linux-ntfs-announce mailing list (very low +volume). The easiest way to do this is to visit the list page on sourceforge at: + http://lists.sourceforge.net/lists/listinfo/linux-ntfs-announce + +NTFS library +============ + +Provides common NTFS access functions to the ntfstools and other foreign +open source applications. Note, that the library is still under heavy +development and doesn't include the majority of functionality yet. It only +is capable of just about supporting the current ntfstools, so I wouldn't +recommend using it for your own applications at this stage. + +NTFS utilities +============== + +The ntfstools will eventually include utilities for doing all required tasks +to NTFS partitions. In general, just run a utility without any command line +options to display the version number and usage syntax. + +The following utilities are so far implemented: + +NtfsFix - Attempt to fix an NTFS partition that has been damaged by the Linux +NTFS driver. Note that you should run it every time after you have used the +Linux NTFS driver to write to an NTFS partition to prevent massive data +corruption from happening when Windows mounts the partition. +IMPORTANT: Run this only *after* unmounting the partition in Linux but *before* +rebooting into Windows NT/2000 or you *will* suffer! - You have been warned! +See man 8 ntfsfix for details. + +mkntfs - Format a partition with the NTFS filesystem. See man 8 mkntfs for +command line options. + +ntfslabel - Display/change the label of an NTFS partition. See man 8 ntfslabel +for details. + +ntfsundelete - Recover deleted files from an NTFS volume. See man 8 +ntfsundelete for more details. From 48266260265be6db2c4f45f363687c39e52f82a2 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0056/2994] add ntfsundelete to the build. fix rpm build. trawl for typos. 2002/04/12 15:23:47-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2002/03/12 21:55:30-00:00 !antona Update docs and bump version to 1.6.0. 2002/01/26 03:21:07-00:00 !antona Preparations for 1.5.1 release. 2002/01/26 02:28:29-00:00 !antona Update docs. 2002/01/10 10:54:27-00:00 !antona Updates 2001/11/09 21:30:51-00:00 !antona Considering added functionality change version number to 1.3.0, update docs and mkntfs man page. 2001/11/09 19:24:23-00:00 !antona With lots of luck this is going to be 1.2.3. 2001/11/09 18:24:32-00:00 !antona Updates to docs, layout.h and ntfsfix to support Windows XP NTFS 2001/08/27 16:58:07-00:00 !antona Updates. 2001/08/02 01:44:56-00:00 !antona Add ntfsfix man page and spell fixes. Update to 1.2.1 version and update all text files to go with it and the rpm spec file. 2001/07/25 23:11:49-00:00 !antona Update text files 2001/07/25 13:43:10-00:00 !antona 1.0.2 release. Mkntfs now in sbin and minor bugfix to mkntfs man page. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/16 19:59:51-00:00 !antona Update ntfsdump_logfile and dumplog and the relevant textfiles. 2001/06/11 04:02:08-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/10 19:09:45-00:00 !antona news update 2001/06/10 18:30:16-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. 2001/02/02 01:15:17-00:00 !antona Updated documentation and other text files. Preparing for initial release. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- NEWS | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/NEWS b/NEWS index e69de29b..84826058 100644 --- a/NEWS +++ b/NEWS @@ -0,0 +1,63 @@ +Current news +============ + +Added new utility ntfslabel by Matthew Fanto. See man 8 ntfslabel for details. + +Added new utility ntfsundelete by Richard Russon. See man 8 ntfsundelete for +more details. + + +Older news +========== + +linux-ntfs should now compile and work on all architectures. + +Added two options to mkntfs. One to enable compression on the volume and one +to disable content indexing. See man 8 mkntfs for details. + +Changed version numbers of mkntfs and ntfsfix to match linux-ntfs release. + +ntfsfix had two minor bugs fixed. This also should remove the compilation +warnings in ntfsfix.c on 64-bit-pointer-size architectures. + +mkntfs now should be truly bug free. + +ntfs_mount syntax changed to accept a read-only flag. + +mkntfs now allows creation of small NTFS volumes (current minimum size is one +mega byte). This allows placing NTFS on a floppy disk for example. + +mkntfs now correctly handles directories on volumes with large clusters. + +ntfsfix now works on Windows XP NTFS volumes (NTFS 3.1). + +Reenabled shared library generation and use. + +ntfsfix now has a man page, too. Donated by David Martínez Moreno. + +mkntfs now uses correct defaults for small partitions on devices with +non-standard sector sizes. + +mkntfs now in sbin not bin and it got some bugs fixed. + +Gcc 2.96 or above is required to compile. + +Dropped ldm, ntfsdump_logfile and dumplog from linux-ntfs distribution. ldm will +reappear in a different package as ldminfo (probably linux-ldm) while the dump +tools are only useful to us developers to play with they don't actually do +anything useful (and these remain in CVS for developer (ab)use). + +We now have mkntfs. Yey! And it even has a man page. So go read it. (-8 + +Disable shared library building by default as it breaks on some systems. (No +idea why. If any one can figure it out and tell me what the problem/fix is I +would be thankful.) + +libntfs and hence ntfsfix still don't support attribute lists. + +Updated ntfsdump_logfile to really dump the whole logfile with all the current +knowledge about the structures. Also added dumplog which does the same but +operates on a file rather than a partition, i.e. it can operate on a live +mounted NTFS partition under linux when the -o show_sys_files was used on mount. +(Note this mount option first appeared in Linux kernel 2.4.4-ac18.) + From 0266d85b791a066cb7192e0d38d4b438eed49850 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0057/2994] add ntfsundelete to the build. fix rpm build. trawl for typos. 2002/07/03 14:38:40-00:00 !antona Cleanup the build process a bit. 2002/06/05 20:32:53-00:00 !antona Mft mirror now updated from ntfs_write_mft_record, yey! Fixup ntfstools accordingly. 2002/06/02 23:18:56-00:00 !antona Updates to spec file and make files. 2002/04/12 15:28:09-00:00 !antona Fix typo. 2002/04/12 15:23:47-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2002/03/12 21:55:30-00:00 !antona Update docs and bump version to 1.6.0. 2002/01/26 03:21:07-00:00 !antona Preparations for 1.5.1 release. 2002/01/26 03:08:57-00:00 !flatcap typo 2002/01/26 02:28:29-00:00 !antona Update docs. 2002/01/10 11:25:16-00:00 !antona ... 2002/01/10 11:24:19-00:00 !antona grrr 2002/01/10 11:20:31-00:00 !antona Now did it right 2002/01/10 11:04:44-00:00 !antona Updates to spec file for dependencies. 2002/01/10 10:54:27-00:00 !antona Updates 2002/01/10 10:19:29-00:00 !antona Update changelog. 2001/12/06 01:16:32-00:00 !antona Update version number for ntfsfix 2001/11/17 01:57:53-00:00 !antona Update build system with new document. 2001/11/10 16:24:12-00:00 !antona More logfile size updates so we are more sane with floppies. 2001/11/10 14:47:39-00:00 !antona Debug display bug fixes. 2001/11/10 14:27:38-00:00 !antona And more typos. 2001/11/10 14:25:33-00:00 !antona Oops. Didn't compile. Typo 2001/11/10 14:22:15-00:00 !antona Remove obsoleted disklabel.h stuff. 2001/11/10 14:17:39-00:00 !antona Enhance mkntfs' device size determination. 2001/11/10 03:06:05-00:00 !antona Bug fixes and debug output enhancements. 2001/11/09 23:36:16-00:00 !antona Bug fixes 2001/11/09 21:30:51-00:00 !antona Considering added functionality change version number to 1.3.0, update docs and mkntfs man page. 2001/11/09 19:24:23-00:00 !antona With lots of luck this is going to be 1.2.3. 2001/11/09 18:24:32-00:00 !antona Updates to docs, layout.h and ntfsfix to support Windows XP NTFS 2001/08/27 16:58:07-00:00 !antona Updates. 2001/08/02 01:44:56-00:00 !antona Add ntfsfix man page and spell fixes. Update to 1.2.1 version and update all text files to go with it and the rpm spec file. 2001/07/25 23:11:49-00:00 !antona Update text files 2001/07/25 13:44:57-00:00 !antona Forgot to update spec.in 2001/07/25 13:43:10-00:00 !antona 1.0.2 release. Mkntfs now in sbin and minor bugfix to mkntfs man page. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/16 19:59:51-00:00 !antona Update ntfsdump_logfile and dumplog and the relevant textfiles. 2001/06/16 19:23:39-00:00 !antona Version number update 2001/06/16 19:22:45-00:00 !antona Get rid of logfile stuff for mkntfs as it is clearly not needed. 2001/06/13 19:04:20-00:00 !antona Final prerelease. Updated version numbers of mkntfs in readme and rpm spec files. 2001/06/11 19:11:37-00:00 !antona Fix rpm generation. Circumvent configure bug by cheating in configure.in moving around nonopt to host and setting nonopt to NONE. 2001/06/10 18:30:16-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. 2001/06/10 15:54:20-00:00 !antona Linux-NTFS 0.1.0-pre1 ===================== -fixed up ntfsfix and ntfsdump_logfile -corrected stuff -several bug fixes -fixed (hopefully) final bug with mkntfs (sd generator was wrong due to brain'o) -mkntfs now completed, only need to add a few command line options before first public release. -rpm generation file updated and autostrip modified to make use of install-stip make target instead of stripping manually -made bootsector check verbosity during mount dependent on --enable-debug configure option. 2001/06/01 02:07:23-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/02/03 02:03:35-00:00 !antona More files. (Logical change 1.5) --- linux-ntfs.spec.in | 135 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) diff --git a/linux-ntfs.spec.in b/linux-ntfs.spec.in index e69de29b..4a28250c 100644 --- a/linux-ntfs.spec.in +++ b/linux-ntfs.spec.in @@ -0,0 +1,135 @@ +%define name @PACKAGE@ +%define ver @VERSION@ +%define rel 1 +%define prefix /usr +%define bindir /usr/bin +%define sbindir /usr/sbin +%define mandir /usr/share/man + + +Summary : NTFS filesystem libraries and utilities +Name : %{name} +Version : %{ver} +Release : %{rel} +Source : http://prdownloads.sf.net/linux-ntfs/linux-ntfs-%{ver}.tar.gz +Buildroot : %{_tmppath}/%{name}-root +Packager : Anton Altaparmakov +License : GPL +Group : Applications/System +%description +The Linux-NTFS project (http://linux-ntfs.sf.net/) aims to bring full support +for the NTFS filesystem to the Linux operating system. Linux-NTFS currently +consists of a static library and utilities. This package contains the following +utilities: + NtfsFix - Attempt to fix an NTFS partition that has been damaged by the +Linux NTFS driver. It should be run every time after you have used the Linux +NTFS driver to write to an NTFS partition to prevent massive data corruption +from happening when Windows mounts the partition. +IMPORTANT: Run this only *after* unmounting the partition in Linux but *before* +rebooting into Windows NT/2000! See man 8 ntfsfix for details. + mkntfs - Format a partition with the NTFS filesystem. See man 8 mkntfs +for command line options. + ntfslabel - Display/change the label of an NTFS partition. See man 8 +ntfslabel for details. + ntfsundelete - Recover deleted files from an NTFS volume. See man 8 +ntfsundelete for details. + +%package devel +Summary : files required to compile software that uses libntfs +Group : Development/System +Requires : linux-ntfs = %{ver}-%{rel} +%description devel +This package includes the header files and libraries needed to link software +with libntfs. + + +%prep +%setup + +%build +if [ -n "$LINGUAS" ]; then unset LINGUAS; fi +%configure +make + + +%install +rm -rf "$RPM_BUILD_ROOT" +make DESTDIR="$RPM_BUILD_ROOT" install-strip + + +%clean +rm -rf "$RPM_BUILD_ROOT" + + +%files +%defattr(-,root,root) +%doc AUTHORS COPYING CREDITS ChangeLog INSTALL NEWS README TODO.include TODO.libntfs TODO.ntfstools doc/CodingStyle doc/attribute_definitions doc/attributes.txt doc/compression.txt doc/tunable_settings doc/template.c doc/template.h doc/system_files.txt doc/system_security_descriptors.txt +%{bindir}/* +%{sbindir}/* +%{mandir}/*/* +%{prefix}/lib/*.so* + + +%files devel +%defattr(-,root,root) +%{prefix}/include/* +%{prefix}/lib/*.a* +%{prefix}/lib/*.la* + +%changelog +* Wed Jul 18 2002 Richard Russon +- added ntfsundelete +- change TODO names + +* Wed Jul 3 2002 Anton Altaparmakov +- update my email address + +* Mon Jun 3 2002 Anton Altaparmakov +- update %doc with new TODO files + +* Tue Apr 12 2002 Anton Altaparmakov +- update %description text for ntfslabel + +* Tue Mar 12 2002 Anton Altaparmakov +- update %description text + +* Sat Jan 26 2002 Anton Altaparmakov +- update %description text +- make dependencies pick the right version automatically + +* Thu Jan 10 2002 Anton Altaparmakov +- add dependency on linux-ntfs to linux-ntfs-devel +- update %description text + +* Fri Nov 09 2001 Anton Altaparmakov +- update %description text +- (re)enable installation of shared libraries + +* Wed Aug 22 2001 Anton Altaparmakov +- update %description text + +* Thu Aug 2 2001 Anton Altaparmakov +- update %description text + +* Wed Jul 25 2001 Anton Altaparmakov +- include sbin install path (mkntfs now is in sbin) + +* Tue Jul 24 2001 Anton Altaparmakov +- update %description text + +* Mon Jun 11 2001 Anton Altaparmakov +- remove duplicate %configure options +- remove shared library installation as shared libraries are disabled by +default + +* Sun Jun 10 2001 Anton Altaparmakov +- add man pages stuff +- update info text +- add new doc/ stuff +- modify installation to do install-strip instead of install followed by manual +stripping +- update download URL to be the fast sourceforge http download server + +* Fri Feb 2 2001 Anton Altaparmakov +- started changelog + From b81549f25c4c7e6e78d7df848a8e8e9d182d35d9 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0058/2994] add ntfsundelete to the build. fix rpm build. trawl for typos. 2002/07/06 20:07:58-00:00 !antona New API for compressing run lists into mapping pairs arrays and adapt mkntfs to that API. Addition of ntfs_walk_attrs(). 2002/07/03 21:56:00-00:00 !antona Updates 2002/04/12 15:23:47-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2001/01/30 12:29:03-00:00 !antona And the last move into CVS. The make files. (Note: compilation is untested and all changes have been done without testing so if it doesn't compile at the moment don't be too surprised.) (Logical change 1.5) --- AUTHORS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/AUTHORS b/AUTHORS index e69de29b..47e36427 100644 --- a/AUTHORS +++ b/AUTHORS @@ -0,0 +1,10 @@ + +Linux-NTFS is written and maintained by Anton Altaparmakov . + +Current active developers on the project are (in alphabetical order): + + Anton Altaparmakov + Matthew J. Fanto + Richard Russon + Szakacsits Szabolcs + From 87b71bf318260629da3f582cff4a643187c5a0fe Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0059/2994] add ntfsundelete to the build. fix rpm build. trawl for typos. 2002/07/15 18:12:51-00:00 !antona Update change log. 2002/07/15 18:10:23-00:00 !antona update changelog 2002/07/14 17:41:48-00:00 !antona Update changelog 2002/07/12 08:23:42-00:00 !antona update changelog 2002/07/08 06:23:22-00:00 !antona Don't use string concatenation with __FUNCTION__ as gcc-3.x don't like it. 2002/07/08 00:09:41-00:00 !antona Implement attrib.[hc]::ntfs_rl_pwrite(). Fix a dumb bug in ntfs_attr_pwrite(). 2002/07/06 20:22:56-00:00 !antona Typo fix 2002/07/06 20:07:58-00:00 !antona New API for compressing run lists into mapping pairs arrays and adapt mkntfs to that API. Addition of ntfs_walk_attrs(). 2002/07/05 21:15:31-00:00 !uid28698 - Enable enumeration of attributes using ntfs_lookup_attr() which is requested by passing a type of AT_UNUSED (or simply zero) to ntfs_lookup_attr(). (Based on initial patch by Szakacsits Szabolcs.) - Fix two minor buglets in ntfs_find_external_attr() where we would continue the search when we detect a mismatched type and/or name instead of aborting and returning error EIO to flag the corruption. 2002/07/05 17:07:48-00:00 !antona Better gcc detection in 'configure.in'. (Szakacsits Szabolcs) 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/08 14:12:00-00:00 !antona ntfs_readdir() has arrived. 2002/06/06 20:47:28-00:00 !antona The beginning of the directory operations! Introduce dir.[hc] and ntfs_lookup_inode_by_name(). 2002/06/05 20:32:52-00:00 !antona Mft mirror now updated from ntfs_write_mft_record, yey! Fixup ntfstools accordingly. 2002/06/04 12:12:41-00:00 !antona Final POSIXification of disk_io functions. (famous last words) 2002/06/02 23:09:43-00:00 !antona Update changelog and my todo 2002/06/02 23:02:20-00:00 !antona More fixes and updates. 2002/06/02 13:57:58-00:00 !antona Fix detection of read-only mounts in volume.c::ntfs_check_mnteent(). 2002/06/01 00:41:44-00:00 !antona huge update! 2002/05/19 18:37:27-00:00 !antona Commit the change log and current todo file so people have a glimpse of what I am upto... 2002/04/29 12:58:34-00:00 !antona Finish ntfs_attr_pread and ntfs_attr_mst_pread. 2002/04/29 01:53:55-00:00 !antona Loads of stuff. Improvements, start on attr pread and attr mst_pread. Write to follow. ntfslabel cleanup and extensions. libntfs cleanups, fixes, etc. 2002/04/27 19:49:09-00:00 !antona Update library, new APIs ntfs_attr_find_vcn(), misc fixes and cleanups, make all the utilities compile, fix bugs I noticed in ntfslabel and it now works properly. 2002/04/24 23:47:40-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/04/24 19:02:07-00:00 !antona Add new API ntfs_attr_{get,put}. 2002/04/24 01:37:36-00:00 !antona New api call is_boot_sector_ntfs. A few folding help cleanups. 2002/04/23 23:27:32-00:00 !antona Fixup the force option in mkntfs.c. Change the ntfs_check_if_mounted so it works on system not implementing {set,get,end}mntent, too. Also make it more powerful in telling us not only if something is mounted but also if it is the fs root and if it is read-only. 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/21 01:26:39-00:00 !antona Cleanup/streamline include file dependencies. 2002/04/20 23:10:18-00:00 !antona Forgot something 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/20 01:53:02-00:00 !antona Rename mft code adding ntfs_ prefix. Change all return values to zero on success. Thanks to mattjf for pointing out the inconsistencies. 2002/04/19 21:48:31-00:00 !antona Add a TODO list for the library in form of my personal roadmap. People can use that to pick things to work on if they want... 2002/04/19 21:09:54-00:00 !antona Finished provisional inode.c::ntfs_{open,close}_inode() functions. Also, started defining API provided by attrib.[ch], so far only done search context related stuff. 2002/04/19 18:23:55-00:00 !antona Add foundation of new inode API. 2002/04/18 18:15:45-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2002/04/18 17:20:05-00:00 !antona New API function provided by unistr.[ch]: ntfs_mbstoucs() 2002/04/16 20:56:01-00:00 !antona Add new API unistr.[ch]: ntfs_ucstombs() and make ntfslabel use it 2002/04/16 12:13:52-00:00 !antona New API function mft.[ch]::read_file_record(). Also some cleanups. 2002/04/15 20:07:58-00:00 !antona Update 2002/04/15 17:51:26-00:00 !antona read/write_mft_record(s) are here 2002/04/14 15:26:23-00:00 !antona Remove find_first_attr and make all users use get_attr_search_ctx + find_attr instead. 2002/04/14 14:20:10-00:00 !antona Prepare changelog to accept a long list of changes. (-; 2002/04/12 15:35:27-00:00 !antona Fix hopefully last typo. (-: 2002/04/12 15:23:47-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2002/03/12 21:55:30-00:00 !antona Update docs and bump version to 1.6.0. 2002/03/12 21:48:27-00:00 !antona Change version numbers of mkntfs and ntfsfix to match linux-ntfs release and add options to mkntfs to disable content indexing on the volume and to enable compression on the volume. 2002/03/12 00:34:35-00:00 !antona Fix typo in mkntfs usage information. 2002/02/01 02:46:16-00:00 !antona Attempt to fix compile warnings on powerpc. 2002/01/26 03:21:07-00:00 !antona Preparations for 1.5.1 release. 2002/01/26 02:28:29-00:00 !antona Update docs. 2002/01/10 11:04:44-00:00 !antona Updates to spec file for dependencies. 2002/01/10 10:54:27-00:00 !antona Updates 2002/01/10 10:43:04-00:00 !antona Update changelog. 2002/01/10 10:19:29-00:00 !antona Update changelog. 2001/12/15 05:28:50-00:00 !antona Fix abortion in mkntfs due to weird error code EINVAL in seek. 2001/12/15 05:13:08-00:00 !antona Remove atomic ops and add compiler version check. 2001/12/06 01:14:52-00:00 !antona Added mount flags to ntfs_mount and adapted utilities to new mount syntax. 2001/11/17 01:57:53-00:00 !antona Update build system with new document. 2001/11/10 19:02:37-00:00 !antona Update changelog with release version numbers. 2001/11/10 14:17:39-00:00 !antona Enhance mkntfs' device size determination. 2001/11/09 23:36:16-00:00 !antona Bug fixes 2001/11/09 21:30:51-00:00 !antona Considering added functionality change version number to 1.3.0, update docs and mkntfs man page. 2001/11/09 19:24:23-00:00 !antona With lots of luck this is going to be 1.2.3. 2001/11/09 18:24:32-00:00 !antona Updates to docs, layout.h and ntfsfix to support Windows XP NTFS 2001/08/27 16:58:07-00:00 !antona Updates. 2001/08/02 01:44:56-00:00 !antona Add ntfsfix man page and spell fixes. Update to 1.2.1 version and update all text files to go with it and the rpm spec file. 2001/07/25 23:11:49-00:00 !antona Update text files 2001/07/25 13:43:10-00:00 !antona 1.0.2 release. Mkntfs now in sbin and minor bugfix to mkntfs man page. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/11 04:02:08-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/10 18:30:16-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. 2001/02/02 01:15:17-00:00 !antona Updated documentation and other text files. Preparing for initial release. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- ChangeLog | 243 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 243 insertions(+) diff --git a/ChangeLog b/ChangeLog index e69de29b..40046066 100644 --- a/ChangeLog +++ b/ChangeLog @@ -0,0 +1,243 @@ +04/06/2002 - 1.6.99 - Work in progress. + - New tool ntfslabel written by Matthew Fanto with a few cleanups from + me to make it fit in with e2label better. + - Extend ntfs_mount() to also read in the volume label. + - Add man page for ntfslabel. + - Silence verbosity of output from ntfs_mount(). It is now only output + if ./configure was run with --enable-debug. + - Remove a LOT of dead code. Massive cleanup. + - Add full attribute search context and allocation/init/deallocation + functions (see attrib.c). + - Remove find_first_attr(). Just use get_attr_search_ctx() + + find_attr() which has the same effect. + - Rewrite disk_io.[ch] and mft.[ch] defining new access API: + disk_io.[ch] provide: ntfs_p{read,write}(), + ntfs_mst_p{read,write}(), and + ntfs_{read,write}_clusters(). + mft.[ch] provide: ntfs_{read,write}_mft_record(), + ntfs_{read,write}_mft_records(), and + ntfs_get_mft_record_data_size(). + - When writing mft records using the mft.c::ntfs_write_mft_record{s,}() + interface, the mft mirror is now updated automatically. + - Add -Wall to compiler options when ./configure is run with + --enable-debug. + - Fix minor error code path bugs in mkntfs.c that showed up with -Wall. + - Fix all compiler warnings that showed up with -Wall. + - Add new API function, provided by mft.[ch]: ntfs_read_file_record(). + - Add new API calls provided by unistr.[ch]: + ntfs_ucstombs() and ntfs_mbstoucs(). + - Define API for mst.[ch] providing: + ntfs_post_read_mst_fixup(), + ntfs_pre_write_mst_fixup(), and + ntfs_post_write_mst_fixup(). + - Define API for bootsect.[ch] providing: + is_boot_sector_ntfs(). + - Add beginning of new API with new files inode.[ch] providing: + ntfs_{open,close)_inode(), and + ntfs_open_extent_inode(). + - Note the inode related API is subject to change. + - Start defining API provided by attrib.[ch]: + ntfs_attr_search_ctx typedef, + ntfs_{get,put,reinit}_attr_search_ctx(), and + ntfs_lookup_attr(). + - Add a TODO.libntfs laying down my personal roadmap for the library. + - Remove find_attr() from API, everyone must use ntfs_lookup_attr() + instead. + - Rename all attribute name constants from $blah to AT_blah. + - Rename all system file constants from FILE_$blah to FILE_blah. + - Port lookup_attr() stuff from ntfs tng driver. + - Implement loading of extent inodes. They are attached on open to the + base inode and are cached there until the base inode is closed. + - Cleanup/streamline include file dependencies. + - Port attribute list merging code from ntfs tng driver. API to follow. + - Allocate a ntfs_volume in mkntfs and start initializing it instead + of using the opt global structure. Necessary so can call the + modified ntfs_decompress_mapping_pairs() from mkntfs.c. + - Add libntfs/debug.c providing: + ntfs_debug_dump_run_list(). + - Add new API call ntfs_check_if_mounted() to volume.[ch]. (Matthew + Fanto, me) + - Do folding assisting cleanups. (Richard Russon, me) + - Add new API call is_boot_sector_ntfs() provided by bootsect.[hc]. + - Define and write more API calls provided by attrib.[ch]: + ntfs_merge_run_lists(), + ntfs_decompress_mapping_pairs(), + ntfs_attr_map_run_list(), + ntfs_{rl,attr}_vcn_to_lcn(), + ntfs_attr_find_vcn(), + ntfs_attr_init(), + ntfs_attr_{open,close}(). + - Add new field mftmirr_size to ntfs_volume structure and initialize + it to the number of mft records stored in the mft mirror in + ntfs_mount(). + - Add new fields mftmirr_ni and mftmirr_na to ntfs_volume structure and + initialize them in ntfs_mount to the $MFTMirr inode and $DATA + attribute. Ditto for mft_ni ($MFT inode), mft_na ($MFT/$DATA), + mftbmp_na ($MFT/$BITMAP), lcnbmp_ni ($Bitmap inode), and + lcnbmp_na ($Bitmap/$DATA). Remove previous fields replaced by these. + - Rename a few fields in ntfs_volume structure to make them shorter, + e.g. now have nr_mft_records and nr_clusters. + - Add new API for doing I/O on both normal and multi sector transfer + protected ntfs attributes described by the ntfs_attr structure, + provided by attrib.[hc] (note writing is still restricted to + overwrite only): + ntfs_attr_p{read,write}(), and + ntfs_attr_mst_p{read,write}(). + - Fix detection of read-only mounts in volume.c::ntfs_check_mntent(). + - Start modularising ntfs_mount(): + - Split off the boot sector parsing code and move it to + bootsect.c::parse_ntfs_boot_sector(). + - Move $MFT loading and parsing code to separate function + volume.c::ntfs_load_mft(). + - Move $MFTMirr loading and parsing code to + volume.c::ntfs_load_mftmirr(). + - Move all startup code (loading and parsing of bootsector, + $MFT, and $MFTMirr) to volume.c::ntfs_startup_volume(). + - Update ntfsfix to above modularisation. + - Add detection of read-write mounted devices to ntfsfix and refuse to + operate on them. + - POSIXify libntfs/disk_io.c. All functions now return partial reads + and writes and deal with end of file properly. Affected functions: + ntfs_p{read,write}(), + ntfs_mst_p{read,write}(), and + ntfs_{read,write}_clusters(). + - Change ntfsfix to take into account the automatic mft mirror updates. + - Add new API provided by new files dir.[ch]: + ntfs_lookup_inode_by_name(), and + ntfs_readdir(). + - We now use u8, u16, u32, u64, s8, s16, s32, and s64 types and we + typedef them ourselves from the C99 standard uint8_t, etc types which + IMO are braindamaged. + - Better gcc detection in 'configure.in'. (Szakacsits Szabolcs) + Tested with: egcs-1.0.3 (egcs-2.90.29), egcs-1.1.2 (egcs-2.91.66), + gcc 2.95.3, 2.96 (from RH 7.1 and 7.3), and 3.0.4. + - Enable enumeration of attributes using ntfs_lookup_attr() which is + requested by passing a type of AT_UNUSED (or simply zero) to + ntfs_lookup_attr(). (Based on initial patch by Szakacsits Szabolcs.) + - Fix two minor buglets in ntfs_find_external_attr() where we would + continue the search when we detect a mismatched type and/or name + instead of aborting and returning error EIO to flag the corruption. + - Add new syntactic sugar API provided by attrib.h: + ntfs_walk_attrs(). (Szakacsits Szabolcs) + - Add new API for compressing run lists into mapping pairs arrays + provided by attrib.[ch] (adapted from mkntfs.c): + ntfs_get_nr_significant_bytes(), + ntfs_get_size_for_mapping_pairs(), + ntfs_write_significant_bytes(), and + ntfs_build_mapping_pairs(). + - Convert mkntfs.c to the above API. + - Implement attrib.[hc]::ntfs_rl_pwrite() as a low level scatter write + function analogous in functionality to mkntfs.c::ntfs_rlwrite() but + with arguments more like ntfs_attr_pwrite() to allow for more + flexible use. + - Don't use string concatenation with __FUNCTION__ as gcc-3.x don't + like it. + - Move run list functions to runlist.[hc]. (Richard Russon) + - Add new API to volume.[hc] and use it (Szakacsits Szabolcs): + ntfs_is_version_supported(), + NTFS_V{1_[12],2_x,3_[01]}() macros, + ntfs_reset_logfile(), and + ntfs_set_volume_flags(). + - Change size autodetection of non-block device files in mkntfs to use + the stat returned file size rather than the block allocation count to + cope with precreated sparse files. + - Remove GPL message text from usage information in mkntfs. + - New tool, ntfsundelete, written by Richard Russon. + +12/03/2002 - 1.6.0 - More mkntfs options and cleanups. + Fix typo in usage information of mkntfs. Thanks to Richard Russon for + spotting it. + Change version number in mkntfs and ntfsfix to match the linux-ntfs + release version number. + Added two new options to mkntfs; -I, which disables content indexing + on the volume and -C, which enables compression on the volume. + +01/02/2002 - Attempt to fix compile warnings on powerpc. + Attempt to fix compile warnings on powerpc. It seems powerpc uses + char == unsigned char which was breaking some signed comparisons. + +26/01/2002 - 1.5.1 - Fix two buglets in ntfsfix and more compilation fixes. + Fix two silly buglets in ntfsfix, where we were calling is_baad_record + instead of is_baad_recordp. Silly me... Thanks to David Martinez Moreno + for reporting the compilation warnings on ia64 which led me to find the + bug. + Fix compilation problems in logfile.h on big endian arches. Hopefully, + now will really compile on all arches. + +10/01/2002 - 1.5.0 - Fix bug in $LogFile size calculation. + Fix bug in $LogFile size calculation where we would take the size to + be zero on partitions between 200 and 400MiB in size. + Add requirement for linux-ntfs to linux-ntfs-devel. + +15/12/2001 - Remove atomic ops and add compiler version check. + Hopefully this will preempt "it doesn't compile for me" messages from + people with gcc < 2.96. + Change bail out error check for seek to backup boot sector to a warning + since SuSE 7.2 + loads of stuff and 2.5.1-pre11 returns EINVAL instead + of ENOSPC. + Remove atomic code as it isn't defined on non-i386 arches. + +06/12/2001 - Change ntfs_mount to accept second argument for mount flags. + ntfs_mount() now supports mount flags as per "man 2 mount". Currently + only the MS_RDONLY flag is supported/implemented. This breaks + compatibility with older libntfs versions and hence the major version + number of the library has been increased. + Adapt utilities to make use of new ntfs_mount syntax. + +17/11/2001 - Add description of compression algorithm. + +09/11/2001 - 1.4.0 - Major fix in mkntfs, small update to ntfsfix and others. + Update ntfsfix to support Windows XP NTFS volumes (NTFS 3.1). + Update layout.h with more information. + (Re)enable shared libraries. + Changes to mkntfs: + - Correct handling of directories on volumes with cluster sizes + above 4096 bytes. + - Lower minimum size of NTFS partitions to 1MiB, scaling down the + logfile size as necessary. + - Support a wider range of input parameters. Now should have all + valid combinations covered. + - Update man page. + - Implement better determination of device size. + - Various bug fixes. + +22/08/2001 - 1.2.2 - Small fix in mkntfs and minor updates. + Small fix in mkntfs for small volumes with non-standard sector sizes, + where the default values would result in a sector size smaller than the + sector size and mkntfs would refuse to run because of this. The man + page was updated accordingly. + Minor updates/clarifications to include/layout.h. + +02/08/2001 - 1.2.1 - Added ntfsfix man page and minor cleanup. + David Martínez Moreno donated a man page + for ntfsfix as well as spelling mistake fixes all over the place. + +26/07/2001 - 1.2.0 - Important bug fixes to mkntfs. + Bug fixes for cluster sizes > 4kb involving corrections to mft mirror + size and contents, mft data attribute position and mft bitmap size. + Some of those were nasty so this is a major improvement. Hopefully these + were the last bugs. + +25/07/2001 - 1.0.2 - Small cleanup of the distribution. + Move mkntfs to sbin (was put in bin before). + Small bugfix to mkntfs man page. + +24/07/2001 - 1.0.1 - Small cleanup of the distribution. + Confirmed that at least gcc-2.96 is needed to compile linux-ntfs. + Removed ldm.c from linux-ntfs. It will reappear as ldminfo.c in a new + package, probably linux-ldm. + Taken out some file from the distribution, but they are still present + in CVS. This is because they are not really useful except if you are + a developer wanting to play about. + +10/06/2001 - 1.0.0 - mkntfs release and bugfixes to ntfslib and the others. + Also, released ldm which dumps the ldm database on Win2k/XP dynamic + disks. + A man page for mkntfs is also installed by make install so man 8 mkntfs + can be used to show the recognised command line options. + Building of shared libraries is disabled by default as it breaks on + some systems. + Probably need at least gcc-2.95 or something like that from now on. + +02/02/2001 - Started ChangeLog. + From 226a32f43c5299825d9834e87962d7b49b377610 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0060/2994] add ntfsundelete to the build. fix rpm build. trawl for typos. 2002/07/17 05:07:01-00:00 !szaka ntfsresize update 2002/07/10 10:56:26-00:00 !szaka ntfsresize: cosmetic cleanup, progress bar added 2002/07/08 16:55:43-00:00 !antona Concolidate TODO files (Logical change 1.5) --- TODO.ntfstools | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/TODO.ntfstools b/TODO.ntfstools index e69de29b..c0c7892b 100644 --- a/TODO.ntfstools +++ b/TODO.ntfstools @@ -0,0 +1,75 @@ +Please keep in alphabetical order so utilities are easier to find. + +Thanks, + Anton + + + +********** +* mkntfs * +********** + +- mkntfs should be hard linked with mkfs.ntfs for the mkfs utility. +- We don't know what the real last sector is, thus we mark the volume dirty + and the subsequent chkdsk (which will happen on reboot into Windows + automatically) recreates the backup boot sector if the Linux kernel lied to + us about the number of sectors. + + + +*********** +* ntfsfix * +*********** + +- Cleanup to use ntfs_attr_* API for editing $MFTMirr, $Volume, and $LogFile. + This has the immediate benefit of enabling attribute list support and making + the code simpler. +- On ntfs 3.0+ volumes need to disable the usn journal if it is active. This + means deleting file $UsnJrnl from /$Extend directory. +- On ntfs 3.0+ volumes need to mark the quota out of date? - Probably, but + it shouldn't cause any corruption not doing so for the moment so this is + not a showstopper bug for the first release. (AIA) + + + +************* +* ntfslabel * +************* + +- Support ioctls for ntfs tng driver 2.0.? for reading/changing the label. + + + +************** +* ntfsresize * +************** + +High priority + - support fragmented volumes + - recovery support, journaling + - test suite + - man page + +Medium priority + - easy usage by partitioning tools + - move useful things to libntfs + - meaningful error codes at exit() + - cleanup at exit() + - quiet operation + +Low priority + - volume enlargement + - move volume start + - support disks having bad blocks + + + +**************** +* ntfsundelete * +**************** + +- support for compressed files +- support for internationalisation +- recover by type? + + From e237cdbaeadb81829378f27375eba1a475a59eba Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0061/2994] created a template for ntfswipe (Logical change 1.5) --- ntfstools/ntfswipe.c | 732 +++++++++++++++++++++++++++++++++++++++++++ ntfstools/ntfswipe.h | 47 +++ 2 files changed, 779 insertions(+) diff --git a/ntfstools/ntfswipe.c b/ntfstools/ntfswipe.c index e69de29b..120e6e52 100644 --- a/ntfstools/ntfswipe.c +++ b/ntfstools/ntfswipe.c @@ -0,0 +1,732 @@ +/** + * ntfswipe - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Richard Russon + * + * This utility will overwrite usused space on an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ntfswipe.h" +#include "types.h" +#include "volume.h" + +static const char *AUTHOR = "Richard Russon (FlatCap)"; +static const char *EXEC_NAME = "ntfswipe"; +static struct options opts; + +/** + * Eprintf - Print error messages + */ +void Eprintf (const char *format, ...) +{ + va_list va; + va_start (va, format); + vfprintf (stderr, format, va); + va_end (va); +} + +/** + * Iprintf - Print informative messages + */ +void Iprintf (const char *format, ...) +{ + va_list va; +#ifndef DEBUG + if (opts.quiet) + return; +#endif + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +} + +/** + * Vprintf - Print verbose messages + */ +void Vprintf (const char *format, ...) +{ + va_list va; +#ifndef DEBUG + if (!opts.verbose) + return; +#endif + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +} + +/** + * Dprintf - Print debug messages + */ +#ifndef DEBUG +#define Dprintf(...) +#else +void Dprintf (const char *format, ...) +{ + va_list va; + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +} +#endif + +/** + * wipe_unused - Wipe unused clusters + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * Read $Bitmap and wipe any clusters that are marked as not in use. + * + * Return: 1 Success, the clusters were wiped + * 0 Error, something went wrong + */ +int wipe_unused (ntfs_volume *vol, int byte) +{ + if (!vol || (byte < 0)) + return 0; + + Iprintf ("wipe_unused 0x%02x\n", byte); + return 1; +} + +/** + * wipe_tails - Wipe the file tails + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * Disk space is allocated in clusters. If a file isn't an exact multiple of + * the cluster size, there is some slack space at the end. Wipe this space. + * + * Return: 1 Success, the clusters were wiped + * 0 Error, something went wrong + */ +int wipe_tails (ntfs_volume *vol, int byte) +{ + if (!vol || (byte < 0)) + return 0; + + Iprintf ("wipe_tails 0x%02x\n", byte); + return 1; +} + +/** + * wipe_mft - Wipe the MFT slack space + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * MFT Records are 1024 bytes long, but some of this space isn't used. Wipe any + * unused space at the end of the record and wipe any unused records. + * + * Return: 1 Success, the clusters were wiped + * 0 Error, something went wrong + */ +int wipe_mft (ntfs_volume *vol, int byte) +{ + if (!vol || (byte < 0)) + return 0; + + Iprintf ("wipe_mft 0x%02x\n", byte); + return 1; +} + +/** + * wipe_directory - Wipe the directiry indexes + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * Directories are kept in sorted B+ Trees. Index blocks may not be full. Wipe + * the unused space at the ends of these blocks. + * + * Return: 1 Success, the clusters were wiped + * 0 Error, something went wrong + */ +int wipe_directory (ntfs_volume *vol, int byte) +{ + if (!vol || (byte < 0)) + return 0; + + Iprintf ("wipe_directory 0x%02x\n", byte); + return 1; +} + +/** + * wipe_logfile - Wipe the logfile (journal) + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * The logfile journals the metadata to give the volume fault-tolerance. If the + * volume is in a consistant state, then this information can be erased. + * + * Return: 1 Success, the clusters were wiped + * 0 Error, something went wrong + */ +int wipe_logfile (ntfs_volume *vol, int byte) +{ + if (!vol || (byte < 0)) + return 0; + + Iprintf ("wipe_logfile 0x%02x\n", byte); + return 1; +} + +/** + * wipe_pagefile - Wipe the pagefile (swap space) + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * pagefile.sys is used by Windows as extra virtual memory (swap space). + * Windows recreates the file at bootup, so it can be wiped without harm. + * + * Return: 1 Success, the clusters were wiped + * 0 Error, something went wrong + */ +int wipe_pagefile (ntfs_volume *vol, int byte) +{ + if (!vol || (byte < 0)) + return 0; + + Iprintf ("wipe_pagefile 0x%02x\n", byte); + return 1; +} + +/** + * ntfs_info - Display information about the NTFS Volume + * @vol: An ntfs volume obtained from ntfs_mount + * + * Tell the user how much could be cleaned up. List the number of free + * clusters, MFT records, etc. + * + * Return: 1 Success, displayed some info + * 0 Error, something went wrong + */ +int ntfs_info (ntfs_volume *vol) +{ + if (!vol) + return 0; + + Iprintf ("ntfs_info\n"); + return 1; +} + + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + Iprintf ("%s v%s Copyright (C) 2002 %s\nOverwrite the unused space on " + "an NTFS Volume\n\n%s is free software, released under the GNU " + "General Public License\nand you are welcome to redistribute " + "it under certain conditions.\n%s comes with ABSOLUTELY NO " + "WARRANTY; for details read the GNU\nGeneral Public License " + "to be found in the file COPYING in the main\nLinux-NTFS " + "distribution directory.\n\n", + EXEC_NAME, VERSION, AUTHOR, EXEC_NAME, EXEC_NAME); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + Iprintf ("Usage: %s [options] device\n" + " -i --info Show volume information (default)\n" + "\n" + " -d --directory Wipe directory indexes\n" + " -l --logfile Wipe the logfile (journal)\n" + " -m --mft Wipe mft space\n" + " -p --pagefile Wipe pagefile (swap space)\n" + " -t --tails Wipe file tails\n" + " -u --unused Wipe unused clusters\n" + "\n" + " -a --all Wipe all unused space\n" + "\n" + " -c num --count num Number of times to write (default = 1)\n" + " -b list --bytes list List of values to write (default = 0)\n" + "\n" + " -n --no-action Do not write to disk\n" + " -f --force Use less caution\n" + " -q --quiet Less output\n" + " -v --verbose More output\n" + " -V --version Version information\n" + " -h --help Print this help\n\n", + EXEC_NAME); + Iprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); +} + +/** + * parse_list - Read a comma-separated list of numbers + * @list: The comma-separated list of numbers + * @result: Store the parsed list here (must be freed by caller) + * + * Read a comma-separated list of numbers and allocate an array of ints to store + * them in. The numbers can be in decimal, octal or hex. + * + * N.B. The caller must free the memory returned in @result. + * N.B. If the function fails, @result is not changed. + * + * Return: 0 Error, invalid string + * n Success, the count of numbers parsed + */ +int parse_list (const char *list, int **result) +{ + const char *ptr; + char *end; + int i; + int count; + int *mem = NULL; + + if (!list || !result) + return 0; + + for (count = 0, ptr = list; ptr; ptr = strchr (ptr+1, ',')) + count++; + + mem = malloc ((count+1) * sizeof (int)); + if (!mem) { + Eprintf ("Couldn't allocate memory in parse_list().\n"); + return 0; + } + + memset (mem, 0xFF, (count+1) * sizeof (int)); + + for (ptr = list, i = 0; i < count; i++) { + + end = NULL; + mem[i] = strtol (ptr, &end, 0); + + if (!end || (end == ptr) || ((*end != ',') && (*end != 0))) { + Eprintf ("Invalid list '%s'\n", list); + free (mem); + return 0; + } + + if ((mem[i] < 0) || (mem[i] > 255)) { + Eprintf ("Bytes must be in range 0-255.\n"); + free (mem); + return 0; + } + + ptr = end + 1; + } + + Dprintf ("Parsing list '%s' - ", list); + for (i = 0; i <= count; i++) + Dprintf ("0x%02x ", mem[i]); + Dprintf ("\n"); + + *result = mem; + return count; +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char *argv[]) +{ + static const char *sopt = "-ab:c:dfhilmnpqtuvV"; + static const struct option lopt[] = { + { "all", no_argument, NULL, 'a' }, + { "bytes", required_argument, NULL, 'b' }, + { "count", required_argument, NULL, 'c' }, + { "directory", no_argument, NULL, 'd' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "info", no_argument, NULL, 'i' }, + { "logfile", no_argument, NULL, 'l' }, + { "mft", no_argument, NULL, 'm' }, + { "no-action", no_argument, NULL, 'n' }, + { "pagefile", no_argument, NULL, 'p' }, + { "quiet", no_argument, NULL, 'q' }, + { "tails", no_argument, NULL, 't' }, + { "unused", no_argument, NULL, 'u' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + char *end; + int err = 0; + int ver = 0; + int help = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + opts.count = 1; + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else { + opts.device = NULL; + err++; + } + break; + + case 'a': + opts.directory++; + opts.logfile++; + opts.mft++; + opts.pagefile++; + opts.tails++; + opts.unused++; + break; + case 'b': + if (!opts.bytes) { + if (!parse_list (argv[optind-1], &opts.bytes)) + err++; + } else { + err++; + } + break; + case 'c': + if (opts.count == 1) { + end = NULL; + opts.count = strtol (optarg, &end, 0); + if (end && *end) + err++; + } else { + err++; + } + break; + case 'd': + opts.directory++; + break; + case 'f': + opts.force++; + break; + case 'h': + help++; + break; + case 'i': + opts.info++; + break; + case 'l': + opts.logfile++; + break; + case 'm': + opts.mft++; + break; + case 'n': + opts.noaction++; + break; + case 'p': + opts.pagefile++; + break; + case 'q': + opts.quiet++; + break; + case 't': + opts.tails++; + break; + case 'u': + opts.unused++; + break; + case 'v': + opts.verbose++; + break; + case 'V': + ver++; + break; + default: + if ((optopt == 'b') || (optopt == 'c')) { + Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); + } else { + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + } + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if (opts.device == NULL) { + Eprintf ("You must specify exactly one device.\n"); + err++; + } + + if ((opts.quiet) && (opts.verbose)) { + Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + err++; + } + + if (opts.info && (opts.unused || opts.tails || opts.mft || opts.directory)) { + Eprintf ("You may not use any other options with --info.\n"); + err++; + } + + if ((opts.count < 1) || (opts.count > 100)) { + Eprintf ("The iteration count must be between 1 and 100.\n"); + err++; + } + + /*if (opts.bytes && (opts.count > 0)) { + Eprintf ("You may not use both --bytes and --count.\n"); + err++; + }*/ + + /* Create a default list */ + if (!opts.bytes) { + opts.bytes = malloc (2 * sizeof (int)); + if (opts.bytes) { + opts.bytes[0] = 0; + opts.bytes[1] = -1; + } + } + + if (!opts.directory && !opts.logfile && !opts.mft && + !opts.pagefile && !opts.tails && !opts.unused) { + opts.info = 1; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + +/** + * valid_device - Perform some safety checks on the device, before we start + * @name: Full pathname of the device/file to work with + * @force: Continue regardless of problems + * + * Check that the name refers to a device and that is isn't already mounted. + * These checks can be overridden by using the force option. + * + * Return: 1 Success, we can continue + * 0 Error, we cannot use this device + */ +int valid_device (const char *name, int force) +{ + unsigned long mnt_flags = 0; + struct stat st; + + if (stat (name, &st) == -1) { + if (errno == ENOENT) { + Eprintf ("The device %s doesn't exist\n", name); + } else { + Eprintf ("Error getting information about %s: %s\n", name, strerror (errno)); + } + return 0; + } + + if (!S_ISBLK (st.st_mode)) { + Vprintf ("%s is not a block device.\n", name); + if (!force) { + Eprintf ("Use the force option to work with files.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + /* Make sure the file system is not mounted. */ + if (ntfs_check_if_mounted (name, &mnt_flags)) { + Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); + if (!force) { + Eprintf ("Use the force option to ignore this error.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } else if (mnt_flags & NTFS_MF_MOUNTED) { + Vprintf ("The device %s, is mounted.\n", name); + if (!force) { + Eprintf ("Use the force option to work a mounted filesystem.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + Dprintf ("Device %s, will be used\n", name); + return 1; +} + + +/** + * print_summary - Tell the use what we are about to do + * + * List the operations about to be performed. The output will be silenced by + * the --quiet option. + * + * Return: none + */ +void print_summary (void) +{ + int i; + + if (opts.noaction) + Iprintf ("%s is in 'no-action' mode, it will NOT write to disk." + "\n\n", EXEC_NAME); + + Iprintf ("%s is about to wipe:\n", EXEC_NAME); + if (opts.unused) + Iprintf ("\tunused disk space\n"); + if (opts.tails) + Iprintf ("\tfile tails\n"); + if (opts.mft) + Iprintf ("\tunused mft areas\n"); + if (opts.directory) + Iprintf ("\tunused directory index space\n"); + if (opts.logfile) + Iprintf ("\tthe logfile (journal)\n"); + if (opts.pagefile) + Iprintf ("\tthe pagefile (swap space)\n"); + + Iprintf ("\n%s will overwrite these areas with: ", EXEC_NAME); + if (opts.bytes) { + for (i = 0; opts.bytes[i] >= 0; i++) + Iprintf ("0x%02x ", opts.bytes[i]); + } + Iprintf ("\n"); + + if (opts.count > 1) + Iprintf ("%s will repeat these operations %d times.\n", EXEC_NAME, opts.count); + Iprintf ("\n"); +} + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main (int argc, char *argv[]) +{ + const char *locale; + ntfs_volume *vol; + int result = 1; + int flags = 0; + int i, j; + + locale = setlocale (LC_ALL, ""); + if (!locale) { + locale = setlocale (LC_ALL, NULL); + Vprintf ("Failed to set locale, using default '%s'.\n", locale); + } else { + Vprintf ("Using locale '%s'.\n", locale); + } + + if (!parse_options (argc, argv)) + return 1; + + if (!valid_device (opts.device, opts.force)) { + goto free; + } + + if (!opts.info) + print_summary(); + + if (opts.info || opts.noaction) + flags = MS_RDONLY; + vol = ntfs_mount (opts.device, flags); + if (!vol) { + Eprintf ("Couldn't mount device '%s': %s\n", opts.device, strerror (errno)); + goto free; + } + + if (vol->flags & VOLUME_IS_DIRTY) { + Iprintf ("Volume is dirty.\n"); + if (!opts.force) { + Eprintf ("Run chkdsk and try again, or use the --force option.\n"); + goto umount; + } + Iprintf ("Forced to continue.\n"); + } + + if (opts.info) { + ntfs_info (vol); + result = 0; + goto umount; + } + + /* Even if the output it quieted, you still get 5 seconds to abort. */ + if (!opts.force) { + Iprintf ("\n%s will begin in 5 seconds, press CTRL-C to abort.\n", EXEC_NAME); + sleep (5); + } + + if (!opts.bytes) { + Eprintf ("Internal error, byte list is empty\n"); + goto umount; + } + + for (i = 0; i < opts.count; i++) { + int byte; + for (j = 0; byte = opts.bytes[j], byte >= 0; j++) { + if (opts.unused && !wipe_unused (vol, byte)) + goto umount; + if (opts.tails && !wipe_tails (vol, byte)) + goto umount; + if (opts.mft && !wipe_mft (vol, byte)) + goto umount; + if (opts.directory && !wipe_directory (vol, byte)) + goto umount; + if (opts.logfile && !wipe_logfile (vol, byte)) + goto umount; + if (opts.pagefile && !wipe_pagefile (vol, byte)) + goto umount; + } + } + + result = 0; +umount: + ntfs_umount (vol, FALSE); +free: + if (opts.bytes) + free (opts.bytes); + return result; +} + + diff --git a/ntfstools/ntfswipe.h b/ntfstools/ntfswipe.h index e69de29b..f06358c2 100644 --- a/ntfstools/ntfswipe.h +++ b/ntfstools/ntfswipe.h @@ -0,0 +1,47 @@ +/* + * ntfswipe - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Richard Russon + * + * This utility will overwrite usused space on an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFSWIPE_H_ +#define _NTFSWIPE_H_ + +#include "types.h" + +struct options { + char *device; /* Device/File to work with */ + int info; /* Show volume info */ + int force; /* Override common sense */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int noaction; /* Do not write to disk */ + int count; /* Number of iterations */ + int *bytes; /* List of overwrite characters */ + int directory; /* Wipe directory indexes */ + int logfile; /* Wipe the logfile (journal) */ + int mft; /* Wipe mft slack space */ + int pagefile; /* Wipe pagefile (swap space) */ + int tails; /* Wipe file tails */ + int unused; /* Wipe unused clusters */ +}; + +#endif /* _NTFSWIPE_H_ */ + From bb8bf25e3207252184a238f7f78f2a5640bdb573 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0062/2994] docs updated. mem leak fixed. 2002/07/17 10:51:15-00:00 !flatcap a couple of new bits, nothing original 2002/07/16 23:41:43-00:00 !flatcap sort out the output and some of the return values 2002/07/15 22:45:45-00:00 !flatcap enough! 2002/07/15 16:30:41-00:00 !flatcap more tidying, more comments 2002/07/15 02:57:21-00:00 !flatcap start tidying up and documenting 2002/06/30 22:46:51-00:00 !flatcap undelete -> ntfsundelete (Logical change 1.5) --- ntfstools/ntfsundelete.8.in | 349 ++++++++++++++++++++++++++++++++++++ 1 file changed, 349 insertions(+) diff --git a/ntfstools/ntfsundelete.8.in b/ntfstools/ntfsundelete.8.in index e69de29b..5473407b 100644 --- a/ntfstools/ntfsundelete.8.in +++ b/ntfstools/ntfsundelete.8.in @@ -0,0 +1,349 @@ +.\" Copyright (c) 2002 Richard Russon. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSUNDELETE 8 "June 2002" "Linux\-NTFS version @VERSION@" +.SH NAME +ntfsundelete \- recover a deleted file from an NTFS volume. +.SH SYNOPSIS +.B ntfsundelete +[ +.I options +] +.B device +.SH DESCRIPTION +.B ntfsundelete +has three modes of operation: +.IR scan , +.I undelete +and +.IR copy . +.SS Scan +.PP +The default mode, +.I scan +simply reads an NTFS Volume and looks for files that have been deleted. Then it +will print a list giving the inode number, name and size. +.SS Undelete +.PP +The +.I undelete +mode takes the inode and recovers as much of the data as possible. It save the +result to another location. Partly for safety, but mostly because NTFS write +support isn't finished. +.SS Copy +.PP +This is a wizard's option. It will save a portion of the MFT to a file. This +probably only be useful when debugging +.I ntfsundelete +.SS Notes +.B ntfsundelete +only ever +.B reads +from the NTFS Volume. +.B ntfsundelete +will never change the volume. +.SH CAVEATS +.SS Miracles +.B ntfsundelete +cannot perform the impossible. +.PP +When a file is deleted the MFT Record is marked as not in use and the bitmap +representing the disk usage is updated. If the power isn't turned off +immediately, the free space, where the file used to live, may become +overwritten. Worse, the MFT Record may be reused for another file. If this +happens it is impossible to tell where the file was on disk. +.PP +Even if all the clusters of a file are not in use, there is no guarantee that +they haven't been overwritten by some short\-lived file. +.SS Locale +In NTFS all the filenames are stored as Unicode. They will be converted into +the current locale for display by +.BR ntfsundelete . +The utility has successfully displayed some Chinese pictogram filenames and then +correctly recovered them. +.SS Extended MFT Records +In rare circumstances, a single MFT Record will not be large enough to hold the +metadata describing a file (a file would have to be in hundreds of fragments +for this to happen). In these cases one MFT record may hold the filename, but +another will hold the information about the data. +.B ntfsundelete +will not try and piece together such records. It will simply show unnamed files +with data. +.SS Compressed and Encrypted Files +.B ntfsundelete +cannot recover compressed or encrypted files. When scanning for them, it will +display as being 0% recoverable. +.SH OPTIONS +Below is a summary of all the options that +.B ntfsundelete +accepts. All options have two equivalent names. The short name is preceded by +.BR \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.BR \-fv +is equivalent to +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. +.TP +.BI "\-b " num +.br +.ns +.TP +.BI "\-\-byte " num +If any clusters of the file cannot be recovered, the missing parts will be +filled with this byte. The default is zeros. +.TP +.B \-C +.br +.ns +.TP +.B \-\-case +When scanning an NTFS volume, any filename matching (using the +.B \-\-match +option) is case\-insensitive. This option makes the maching case\-sensitive. +.TP +.BI "\-c " range +.br +.ns +.TP +.BI "\-\-copy " range +This wizard's option will write a block of MFT FILE records to a file. The +default file is +.I mft +which will be created in the current directory. This option can be combined +with the +.B \-\-output +and +.B \-\-destination +options. +.TP +.BI "\-d " dir +.br +.ns +.TP +.BI "\-\-destination " dir +This option controls where to put the output file of the +.B \-\-undelete +and +.B \-\-copy +options. +.TP +.B \-f +.br +.ns +.TP +.B \-\-force +This will override some sensible defaults, such as not overwriting an existing +file. Use this option with caution. +.TP +.B \-h +.br +.ns +.TP +.B \-\-help +Show a list of options with a brief description of each one. +.TP +.BI "\-m " pattern +.br +.ns +.TP +.BI "\-\-match " pattern +Filter the output of the +.B \-\-scan +option, by only looking for matching filenames. The pattern can include the +wildcards '?', match exactly one character or '*', match zero or more +characters. By default the matching is case\-insensitive. To make the search +case sensitive, use the +.B \-\-case +option. +.TP +.BI "\-o " file +.br +.ns +.TP +.BI "\-\-output " file +Use this option to set name of output file that +.B \-\-undelete +or +.B \-\-copy +will create. +.TP +.BI "\-p " num +.br +.ns +.TP +.BI "\-\-percentage " num +Filter the output of the +.B \-\-scan +option, by only matching files with a certain amount of recoverable content. +.B Please read the caveats section for more details. +.TP +.BI \-q +.br +.ns +.TP +.BI \-\-quiet +Reduce the amount of output to a minimum. Naturally, it doesn't make sense to +combine this option with +.BR \-\-scan . +.TP +.B \-s +.br +.ns +.TP +.B \-\-scan +Search through an NTFS volume and print a list of files that could be recovered. +This is the default action of +.BR ntfsundelete . +This list can be filtered by filename, size, percentage recoverable or last +modification time, using the +.BR \-\-match , +.BR \-\-size , +.B \-\-percent +and +.B \-\-time +options, respectively. +.sp +The output to scan will be: +.sp +.br +Inode Flags %age Date Size Filename +.br +---------------------------------------------- +.br +6038 FN.. 93% 2002-07-17 26629 thesis.doc +.br +.RS +.TP +The flags field can display: +F/D \- File/Directory +.br +N/R \- (Non-)Resident data stream +.br +C/E \- Compressed/Encrypted data stream +.br +! \- Missing attributes +.sp +.RE +.RS +The percentage field shows how much of the file can potentially be recovered. +.sp +.br +.RE +.RE +.BI "\-S " range +.br +.ns +.TP +.BI "\-\-size " range +Filter the output of the +.B \-\-scan +option, by looking for a particular range of file sizes. The range may be +specified as two numbers separated by a '\-'. The sizes may be abbreviated +using the suffixes k, m, g, t, for kilobytes, megabytes, gigabytes and terabytes +respectively. +.TP +.BI "\-t " since +.br +.ns +.TP +.BI "\-\-time " since +Filter the output of the +.B \-\-scan +option. Only match files that have been altered since this time. The time must +be given as number using a suffix of d, w, m, y for days, weeks, months or years +ago. +.TP +.BI "\-u " num +.br +.ns +.TP +.BI "\-\-undelete " num +Recover the file with this inode number. This option can be combined with +.BR \-\-output , +.BR \-\-destination , +and +.BR \-\-byte . +.TP +.B \-v +.br +.ns +.TP +.B \-\-verbose +Increase the amount of output that +.B ntfsundelete +prints. +.TP +.B \-V +.br +.ns +.TP +.B \-\-version +Show the version number, copyright and license +.BR ntfsundelete . +.SH EXAMPLES +Look for deleted files on /dev/hda1. +.RS +.sp +.B ntfsundelete /dev/hda1 +.sp +.RE +Look for deleted documents on /dev/hda1. +.RS +.sp +.B ntfsundelete /dev/hda1 -s \-m '*.doc' +.sp +.RE +Look for deleted files between 5000 and 6000000 bytes, with at least 90% of the +data recoverable, on /dev/hda1. +.RS +.sp +.B ntfsundelete /dev/hda1 \-S 5k\-6m \-p 90 +.sp +.RE +Look for deleted files altered in the last two days +.RS +.sp +.B ntfsundelete /dev/hda1 \-t 2d +.sp +.RE +Undelete inode number 3689, call the file 'work.doc' and put it in the user's +home directory. +.RS +.sp +.B ntfsundelete /dev/hda1 \-u 3689 \-o work.doc \-d ~ +.sp +.RE +Save MFT Records 3689 to 3690 to a file 'debug' +.RS +.sp +.B ntfsundelete /dev/hda1 \-c 3689\-3690 \-o debug +.RE +.SH BUGS +There are some small limitations to this program, but currently no known bugs. +If you find one, please send an email to +.nh + +.hy +.SH AUTHOR +.B ntfsundelete +was written by Richard Russon (FlatCap) +.br +If you find this tool useful, make FlatCap happy and send him an email. +.SH AVAILABILITY +.B ntfsundelete +is part of the linux\-ntfs package and is available from +.br +.nh +http://linux\-ntfs.sourceforge.net/downloads.html +.hy +This manual page is available online at: +.br +.nh +http://linux\-ntfs.sourceforge.net/tools/ntfsundelete.html +.hy +.SH SEE ALSO +.BR ntfsinfo(8) +.br From 3c202b8a4e74f16bf9a95065a43ebc05187fe714 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0063/2994] minor build fixes 2002/07/18 02:44:32-00:00 !flatcap should now be endian-safe 2002/07/17 23:41:19-00:00 !flatcap remove dmalloc 2002/07/17 23:36:31-00:00 !flatcap docs updated. mem leak fixed. 2002/07/17 12:27:27-00:00 !flatcap it was missing the very end of the mft, misplaced ) was losing stream names 2002/07/17 10:54:53-00:00 !flatcap cut'n'paste classic 2002/07/17 10:51:15-00:00 !flatcap a couple of new bits, nothing original 2002/07/16 23:41:43-00:00 !flatcap sort out the output and some of the return values 2002/07/15 16:41:48-00:00 !flatcap AT_NONAME -> AT_UNNAMED 2002/07/15 16:30:41-00:00 !flatcap more tidying, more comments 2002/07/15 02:57:21-00:00 !flatcap start tidying up and documenting 2002/07/14 15:53:03-00:00 !flatcap perform some checks on the device we're opening 2002/07/14 14:49:22-00:00 !flatcap open vol read-only, filter by last mod time 2002/07/14 11:20:20-00:00 !flatcap filename regex matching works, default to case insensitive matching 2002/07/13 16:33:00-00:00 !flatcap start to fill in the options 2002/07/11 13:18:11-00:00 !flatcap start to break up the dependency loops in the header files 2002/07/09 19:17:49-00:00 !flatcap move the runlist functions from attrib.c to runlist.c 2002/07/09 01:01:41-00:00 !flatcap more noname changes 2002/07/03 11:03:12-00:00 !flatcap another reminder 2002/07/01 13:30:28-00:00 !flatcap lots of comments 2002/06/30 22:46:51-00:00 !flatcap undelete -> ntfsundelete (Logical change 1.5) --- ntfstools/ntfsundelete.c | 2018 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 2018 insertions(+) diff --git a/ntfstools/ntfsundelete.c b/ntfstools/ntfsundelete.c index e69de29b..c37457ca 100644 --- a/ntfstools/ntfsundelete.c +++ b/ntfstools/ntfsundelete.c @@ -0,0 +1,2018 @@ +/** + * ntfsundelete - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Richard Russon + * + * This utility will recover deleted files from an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ntfsundelete.h" +#include "bootsect.h" +#include "mft.h" +#include "attrib.h" +#include "layout.h" +#include "inode.h" +#include "disk_io.h" + +static const char *AUTHOR = "Richard Russon (FlatCap)"; +static const char *EXEC_NAME = "ntfsundelete"; +static const char *MFTFILE = "mft"; +static const char *UNNAMED = ""; +static char *NONE = ""; +static char *UNKNOWN = "unknown"; +static struct options opts; + +#define _(S) gettext(S) + +/** + * Eprintf - Print error messages + */ +void Eprintf (const char *format, ...) +{ + va_list va; + va_start (va, format); + vfprintf (stderr, format, va); + va_end (va); +} + +/** + * Iprintf - Print informative messages + */ +void Iprintf (const char *format, ...) +{ + va_list va; +#ifndef DEBUG + if (opts.quiet) + return; +#endif + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +} + +/** + * Vprintf - Print verbose messages + */ +void Vprintf (const char *format, ...) +{ + va_list va; +#ifndef DEBUG + if (!opts.verbose) + return; +#endif + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +} + +/** + * Dprintf - Print debug messages + */ +void Dprintf (const char *format, ...) +{ +#ifdef DEBUG + va_list va; + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +#endif +} + + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + Iprintf ("%s v%s Copyright (C) 2002 %s\nRecover deleted files from an " + "NTFS Volume\n\n%s is free software, released under the GNU " + "General Public License\nand you are welcome to redistribute " + "it under certain conditions.\n%s comes with ABSOLUTELY NO " + "WARRANTY; for details read the GNU\nGeneral Public License " + "to be found in the file COPYING in the main\nLinux-NTFS " + "distribution directory.\n\n", + EXEC_NAME, VERSION, AUTHOR, EXEC_NAME, EXEC_NAME); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + Iprintf ("Usage: %s [options] device\n" + " -s --scan Scan for files (default)\n" + " -p num --percentage num Minimum percentage recoverable\n" + " -m pattern --match pattern Only work on files with matching names\n" + " -C --case Case sensitive matching\n" + " -S range --size range Match files of this size\n" + " -t since --time since Last referenced since this time\n" + "\n" + " -u num --undelete num Undelete inode\n" + " -o file --output file Save with this filename\n" + " -d dir --destination dir Destination directory\n" + " -b num --byte num Fill missing parts with this byte\n" + "\n" + " -c range --copy range Write a range of MFT records to a file\n" + "\n" + " -f --force Use less caution\n" + " -q --quiet Less output\n" + " -v --verbose More output\n" + " -V --version Version information\n" + " -h --help Print this help\n\n", + EXEC_NAME); + Iprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); +} + +/** + * transform - Convert a shell style pattern to a regex + * @pattern: String to be converted + * @regex: Resulting regular expression is put here + * + * This will transform patterns, such as "*.doc" to true regular expressions. + * The function will also place '^' and '$' around the expression to make it + * behave as the user would expect + * + * Before After + * . \. + * * .* + * ? . + * + * Notes: + * The returned string must be freed by the caller. + * If transform fails, @regex will not be changed. + * + * Return: 1, Success, the string was transformed + * 0, An error occurred + */ +int transform (const char *pattern, char **regex) +{ + char *result; + int length, i, j; + + if (!pattern || !regex) + return 0; + + length = strlen (pattern); + if (length < 1) { + Eprintf ("Pattern to transform is empty\n"); + return 0; + } + + for (i = 0; pattern[i]; i++) { + if ((pattern[i] == '*') || (pattern[i] == '.')) + length++; + } + + result = malloc (length + 3); + if (!result) { + Eprintf ("Couldn't allocate memory in transform()\n"); + return 0; + } + + result[0] = '^'; + + for (i = 0, j = 1; pattern[i]; i++, j++) { + if (pattern[i] == '*') { + result[j] = '.'; + j++; + result[j] = '*'; + } else if (pattern[i] == '.') { + result[j] = '\\'; + j++; + result[j] = '.'; + } else if (pattern[i] == '?') { + result[j] = '.'; + } else { + result[j] = pattern[i]; + } + } + + result[j] = '$'; + result[j+1] = 0; + Dprintf ("Pattern '%s' replaced with regex '%s'\n", pattern, result); + + *regex = result; + return 1; +} + +/** + * parse_time - Convert a time abbreviation to seconds + * @string: The string to be converted + * @since: The absolute time referred to + * + * Strings representing times will be converted into a time_t. The numbers will + * be regarded as seconds unless suffixed. + * + * Suffix Description + * [yY] Year + * [mM] Month + * [wW] Week + * [dD] Day + * [sS] Second + * + * Therefore, passing "1W" will return the time_t representing 1 week ago. + * + * Notes: + * Only the first character of the suffix is read. + * If parse_time fails, @since will not be changed + * + * Return: 1 Success + * 0 Error, the string was malformed + */ +int parse_time (const char *value, time_t *since) +{ + time_t result, now; + char *suffix = NULL; + + if (!value || !since) + return -1; + + Dprintf ("parsing time '%s' ago\n", value); + + result = strtoll (value, &suffix, 10); + if (result < 0 || errno == ERANGE) { + Eprintf ("Invalid time '%s'.\n", value); + return 0; + } + + if (!suffix) { + Eprintf ("Internal error, strtoll didn't return a suffix.\n"); + return 0; + } + + if (strlen (suffix) > 1) { + Eprintf ("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); + return 0; + } + + switch (suffix[0]) { + case 'y': case 'Y': result *= 12; + case 'm': case 'M': result *= 4; + case 'w': case 'W': result *= 7; + case 'd': case 'D': result *= 24; + case 'h': case 'H': result *= 3600; + case 0: + break; + + default: + Eprintf ("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); + return 0; + } + + now = time (NULL); + + Dprintf ("Time now = %lld, Time then = %lld.\n", (long long) now, (long long) result); + *since = now - result; + return 1; +} + +/** + * parse_size - Convert a string representing a size + * @value: String to be parsed + * @size: Parsed size + * + * Read a string and convert it to a number. Strings may be suffixed to scale + * them. Any number without a suffix is assumed to be in bytes. + * + * Suffix Description Multiple + * [tT] Terabytes 10^12 + * [gG] Gigabytes 10^9 + * [mM] Megabytes 10^6 + * [kK] Kilobytes 10^3 + * + * Notes: + * Only the first character of the suffix is read. + * The multipliers are decimal thousands, not binary: 1000, not 1024. + * If parse_size fails, @size will not be changed + * + * Return: 1 Success + * 0 Error, the string was malformed + */ +int parse_size (const char *value, long long *size) +{ + long long result; + char *suffix = NULL; + + if (!value || !size) + return 0; + + Dprintf ("Parsing size '%s'.\n", value); + + result = strtoll (value, &suffix, 10); + if (result < 0 || errno == ERANGE) { + Eprintf ("Invalid size '%s'.\n", value); + return 0; + } + + if (!suffix) { + Eprintf ("Internal error, strtoll didn't return a suffix.\n"); + return 0; + } + + + /*if (strlen (suffix) > 1) { + Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); + return 0; + } Can't do this because of ranges*/ + + switch (suffix[0]) { + case 't': case 'T': result *= 1000; + case 'g': case 'G': result *= 1000; + case 'm': case 'M': result *= 1000; + case 'k': case 'K': result *= 1000; + case '-': case 0: + break; + default: + Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); + return 0; + } + + Dprintf ("Parsed size = %lld.\n", result); + *size = result; + return 1; +} + +/** + * parse_range - Convert a string representing a range of numbers + * @string: The string to be parsed + * @start: The beginning of the range will be stored here + * @finish: The end of the range will be stored here + * + * Read a string of the form n-m. If the lower end is missing, zero will be + * substituted. If the upper end is missing LONG_MAX will be used. If the + * string cannot be parsed correctly, @start and @finish will not be changed. + * + * Return: 1 Success, a valid string was found + * 0 Error, the string was not a valid range + */ +int parse_range (const char *string, long long *start, long long *finish) +{ + long long a, b; + char *middle; + + if (!string || !start || !finish) + return 0; + + middle = strchr (string, '-'); + if (string == middle) { + Dprintf ("Range has no beginning, defaulting to 0.\n"); + a = 0; + } else { + if (!parse_size (string, &a)) + return 0; + } + + if (middle) { + if (middle[1] == 0) { + b = LONG_MAX; + Dprintf ("Range has no end, defaulting to %lld.\n", b); + } else { + if (!parse_size (middle+1, &b)) + return 0; + } + } else { + b = a; + } + + Dprintf ("Range '%s' = %lld - %lld\n", string, a, b); + + *start = a; + *finish = b; + return 1; +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char *argv[]) +{ + static const char *sopt = "-b:Cc:d:fhm:o:p:sS:t:u:qvV"; + static const struct option lopt[] = { + { "byte", required_argument, NULL, 'b' }, + { "case", no_argument, NULL, 'C' }, + { "copy", required_argument, NULL, 'c' }, + { "destination", required_argument, NULL, 'd' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "match", required_argument, NULL, 'm' }, + { "output", required_argument, NULL, 'o' }, + { "percentage", required_argument, NULL, 'p' }, + { "scan", no_argument, NULL, 's' }, + { "size", required_argument, NULL, 'S' }, + { "time", required_argument, NULL, 't' }, + { "undelete", required_argument, NULL, 'u' }, + { "quiet", no_argument, NULL, 'q' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + char *end = NULL; + int err = 0; + int ver = 0; + int help = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + opts.mode = MODE_NONE; + opts.uinode = -1; + opts.percent = -1; + opts.fillbyte = -1; + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else { + opts.device = NULL; + err++; + } + break; + case 'b': + if (opts.fillbyte == -1) { + end = NULL; + opts.fillbyte = strtol (optarg, &end, 0); + if (end && *end) + err++; + } else { + err++; + } + break; + case 'C': + opts.match_case++; + break; + case 'c': + if (opts.mode == MODE_NONE) { + if (!parse_range (argv[optind-1], &opts.mft_begin, &opts.mft_end)) + err++; + opts.mode = MODE_COPY; + } else { + opts.mode = MODE_ERROR; + } + break; + case 'd': + if (!opts.dest) + opts.dest = argv[optind-1]; + else + err++; + break; + case 'f': + opts.force++; + break; + case 'h': + help++; + break; + case 'm': + if (!opts.match) { + if (!transform (argv[optind-1], &opts.match)) + err++; + } else { + err++; + } + break; + case 'o': + if (!opts.output) { + opts.output = argv[optind-1]; + } else { + err++; + } + break; + case 'p': + if (opts.percent == -1) { + end = NULL; + opts.percent = strtol (optarg, &end, 0); + if (end && ((*end != '%') && (*end != 0))) + err++; + } else { + err++; + } + break; + case 'q': + opts.quiet++; + break; + case 's': + if (opts.mode == MODE_NONE) + opts.mode = MODE_SCAN; + else + opts.mode = MODE_ERROR; + break; + case 'S': + if ((opts.size_begin > 0) || (opts.size_end > 0) || + !parse_range (argv[optind-1], &opts.size_begin, + &opts.size_end)) { + err++; + } + break; + case 't': + if (opts.since == 0) { + if (!parse_time (argv[optind-1], &opts.since)) + err++; + } else { + err++; + } + break; + case 'u': + if (opts.mode == MODE_NONE) { + end = NULL; + opts.mode = MODE_UNDELETE; + opts.uinode = strtol (optarg, &end, 0); + if (end && *end) + err++; + } else { + opts.mode = MODE_ERROR; + } + break; + case 'v': + opts.verbose++; + break; + case 'V': + ver++; + break; + default: + if (((optopt == 'b') || (optopt == 'c') || + (optopt == 'd') || (optopt == 'm') || + (optopt == 'o') || (optopt == 'p') || + (optopt == 'S') || (optopt == 't') || + (optopt == 'u')) && (!optarg)) { + Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); + } else { + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + } + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if (opts.device == NULL) { + Eprintf ("You must specify exactly one device.\n"); + err++; + } + + if (opts.mode == MODE_NONE) { + opts.mode = MODE_SCAN; + } + + switch (opts.mode) { + case MODE_SCAN: + if (opts.output || opts.dest || (opts.fillbyte != -1)) { + Eprintf ("Scan can only be used with --percent, " + "--match, --ignore-case, --size and --time.\n"); + err++; + } + if (opts.match_case && !opts.match) { + Eprintf ("The --case option doesn't make sense without the --match option\n"); + err++; + } + break; + case MODE_UNDELETE: + if ((opts.percent != -1) || opts.match || opts.match_case || + (opts.size_begin > 0) || (opts.size_end > 0)) { + Eprintf ("Undelete can only be used with " + "--output, --destination and --byte.\n"); + err++; + } + break; + case MODE_COPY: + if ((opts.fillbyte != -1) || (opts.percent != -1) || + opts.match || opts.match_case || + (opts.size_begin > 0) || (opts.size_end > 0)) { + Eprintf ("Copy can only be used with --output and --destination.\n"); + err++; + } + break; + default: + Eprintf ("You can only select one of Scan, Undelete or Copy.\n"); + err++; + } + + if ((opts.percent < -1) || (opts.percent > 100)) { + Eprintf ("Percentage value must be in the range 0 - 100.\n"); + err++; + } + + if (opts.quiet) { + if (opts.verbose) { + Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + err++; + } else if (opts.mode == MODE_SCAN) { + Eprintf ("You may not use --quiet when scanning a volume.\n"); + err++; + } + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + + +/** + * free_file - Release the resources used by a file object + * @file: The unwanted file object + * + * This will free up the memory used by a file object and iterate through the + * object's children, freeing their resources too. + * + * Return: none + */ +void free_file (struct ufile *file) +{ + struct list_head *item, *tmp; + + if (!file) + return; + + list_for_each_safe (item, tmp, &file->name) { /* List of filenames */ + struct filename *f = list_entry (item, struct filename, list); + Dprintf ("freeing filename '%s'\n", f->name ? f->name : NONE); + if (f->name) + free (f->name); + free (f); + } + + list_for_each_safe (item, tmp, &file->data) { /* List of data streams */ + struct data *d = list_entry (item, struct data, list); + Dprintf ("freeing data stream '%s'\n", d->name ? d->name : UNNAMED); + if (d->name) + free (d->name); + if (d->run_list) + free (d->run_list); + free (d); + } + + free (file->mft); + free (file); +} + +/** + * ntfs2utc - Convert an NTFS time to Unix time + * @time: An NTFS time in 100ns units since 1601 + * + * NTFS stores times as the number of 100ns intervals since January 1st 1601 at + * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. + * + * Return: n A Unix time (number of seconds since 1970) + */ +time_t ntfs2utc (long long time) +{ + return (time - ((long long) (369 * 365 + 89) * 24 * 3600 * 10000000)) / 10000000; +} + +/** + * find_attribute - Find an attribute of the given type + * @type: An attribute type, e.g. AT_FILE_NAME + * @ctx: A search context, created using ntfs_get_attr_search_ctx + * + * Using the search context to keep track, find the first/next occurrence of a + * given attribute type. + * + * N.B. This will return a pointer into @mft. As long as the search context + * has been created without an inode, it won't overflow the buffer. + * + * Return: Pointer Success, an attribute was found + * NULL Error, no matching attributes were found + */ +ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) +{ + if (!ctx) + return NULL; + + if (ntfs_lookup_attr (type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { + Dprintf ("find_attribute didn't find an attribute of type: 0x%02x.\n", type); + return NULL; /* None / no more of that type */ + } + + Dprintf ("find_attribute found an attribute of type: 0x%02x.\n", type); + return ctx->attr; +} + +/** + * find_first_attribute - Find the first attribute of a given type + * @type: An attribute type, e.g. AT_FILE_NAME + * @mft: A buffer containing a raw MFT record + * + * Search through a raw MFT record for an attribute of a given type. + * The return value is a pointer into the MFT record that was supplied. + * + * N.B. This will return a pointer into @mft. The pointer won't stray outside + * the buffer, since we created the search context without an inode. + * + * Return: Pointer Success, an attribute was found + * NULL Error, no matching attributes were found + */ +ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) +{ + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *rec; + + if (!mft) + return NULL; + + ctx = ntfs_get_attr_search_ctx (NULL, mft); + if (!ctx) { + Eprintf ("Couldn't create a search context.\n"); + return NULL; + } + + rec = find_attribute (type, ctx); + ntfs_put_attr_search_ctx (ctx); + if (rec) + Dprintf ("find_first_attribute: found attr of type 0x%02x.\n", type); + else + Dprintf ("find_first_attribute: didn't find attr of type 0x%02x.\n", type); + return rec; +} + +/** + * get_filenames - Read an MFT Record's $FILENAME attributes + * @file: The file object to work with + * + * A single file may have more than one filename. This is quite common. + * Windows creates a short DOS name for each long name, e.g. LONGFI~1.XYZ, + * LongFiLeName.xyZ. + * + * The filenames that are found are put in filename objects and added to a + * linked list of filenames in the file object. For convenience, the unicode + * filename is converted into the current locale and stored in the filename + * object. + * + * One of the filenames is picked (the one with the lowest numbered namespace) + * and its locale friendly name is put in pref_name. + * + * Return: n The number of $FILENAME attributes found + * -1 Error + */ +int get_filenames (struct ufile *file) +{ + ATTR_RECORD *rec; + FILE_NAME_ATTR *attr; + ntfs_attr_search_ctx *ctx; + struct filename *name; + int count = 0; + int space = 4; + + if (!file) + return -1; + + ctx = ntfs_get_attr_search_ctx (NULL, file->mft); + if (!ctx) + return -1; + + while ((rec = find_attribute (AT_FILE_NAME, ctx))) { + /* We know this will always be resident. */ + attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); + + name = calloc (1, sizeof (*name)); + if (!name) { + Eprintf ("Couldn't allocate memory in get_filenames().\n"); + count = -1; + break; + } + + name->uname = attr->file_name; + name->uname_len = attr->file_name_length; + name->name_space = attr->file_name_type; + name->size_alloc = sle64_to_cpu (attr->allocated_size); + name->size_data = sle64_to_cpu (attr->data_size); + name->flags = attr->file_attributes; + + name->date_c = ntfs2utc (sle64_to_cpu (attr->creation_time)); + name->date_a = ntfs2utc (sle64_to_cpu (attr->last_data_change_time)); + name->date_m = ntfs2utc (sle64_to_cpu (attr->last_mft_change_time)); + name->date_r = ntfs2utc (sle64_to_cpu (attr->last_access_time)); + + file->date = max (file->date, name->date_c); + file->date = max (file->date, name->date_a); + file->date = max (file->date, name->date_m); + file->date = max (file->date, name->date_r); + + if (ntfs_ucstombs (name->uname, name->uname_len, &name->name, + name->uname_len) < 0) { + Dprintf ("Couldn't translate filename to current locale.\n"); + } + + if (name->name_space < space) { + file->pref_name = name->name; + space = name->name_space; + } + + file->max_size = max (file->max_size, name->size_alloc); + file->max_size = max (file->max_size, name->size_data); + + list_add_tail (&name->list, &file->name); + count++; + } + + ntfs_put_attr_search_ctx (ctx); + Dprintf ("File has %d names.\n", count); + return count; +} + +/** + * get_data - Read an MFT Record's $DATA attributes + * @file: The file object to work with + * @vol: An ntfs volume obtained from ntfs_mount + * + * A file may have more than one data stream. All files will have an unnamed + * data stream which contains the file's data. Some Windows applications store + * extra information in a separate stream. + * + * The streams that are found are put in data objects and added to a linked + * list of data streams in the file object. + * + * Return: n The number of $FILENAME attributes found + * -1 Error + */ +int get_data (struct ufile *file, ntfs_volume *vol) +{ + ATTR_RECORD *rec; + ntfs_attr_search_ctx *ctx; + int count = 0; + struct data *data; + + if (!file) + return -1; + + ctx = ntfs_get_attr_search_ctx (NULL, file->mft); + if (!ctx) + return -1; + + while ((rec = find_attribute (AT_DATA, ctx))) { + data = calloc (1, sizeof (*data)); + if (!data) { + Eprintf ("Couldn't allocate memory in get_data().\n"); + count = -1; + break; + } + + data->resident = !rec->non_resident; + data->compressed = rec->flags & ATTR_IS_COMPRESSED; + data->encrypted = rec->flags & ATTR_IS_ENCRYPTED; + + if (rec->name_length) { + data->uname = (uchar_t *) ((char *) rec + le16_to_cpu (rec->name_offset)); + data->uname_len = rec->name_length; + + if (ntfs_ucstombs (data->uname, data->uname_len, &data->name, + data->uname_len) < 0) { + Eprintf ("Cannot translate name into current locale.\n"); + } + } + + if (data->resident) { + data->size_data = le32_to_cpu (rec->value_length); + data->data = ((char*) (rec)) + le16_to_cpu (rec->value_offset); + } else { + data->size_alloc = sle64_to_cpu (rec->allocated_size); + data->size_data = sle64_to_cpu (rec->data_size); + data->size_init = sle64_to_cpu (rec->initialized_size); + data->size_vcn = sle64_to_cpu (rec->highest_vcn) + 1; + } + + data->run_list = ntfs_decompress_mapping_pairs (vol, rec, NULL); + if (!data->run_list) { + Dprintf ("Couldn't decompress the data runs\n"); + } + + file->max_size = max (file->max_size, data->size_data); + file->max_size = max (file->max_size, data->size_init); + + list_add_tail (&data->list, &file->data); + count++; + } + + ntfs_put_attr_search_ctx (ctx); + Dprintf ("File has %d data streams.\n", count); + return count; +} + +/** + * read_record - Read an MFT record into memory + * @vol: An ntfs volume obtained from ntfs_mount + * @record: The record number to read + * + * Read the specified MFT record and gather as much information about it as + * possible. + * + * Return: Pointer A ufile object containing the results + * NULL Error + */ +struct ufile * read_record (ntfs_volume *vol, long long record) +{ + ATTR_RECORD *attr10, *attr20, *attr90; + struct ufile *file; + ntfs_attr *mft; + + if (!vol) + return NULL; + + file = calloc (1, sizeof (*file)); + if (!file) { + Eprintf ("Couldn't allocate memory in read_record()\n"); + return NULL; + } + + INIT_LIST_HEAD (&file->name); + INIT_LIST_HEAD (&file->data); + file->inode = record; + + file->mft = malloc (vol->mft_record_size); + if (!file->mft) { + Eprintf ("Couldn't allocate memory in read_record()\n"); + free_file (file); + return NULL; + } + + mft = ntfs_attr_open (vol->mft_ni, AT_DATA, NULL, 0); + if (!mft) { + Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); + free_file (file); + return NULL; + } + + if (ntfs_attr_mst_pread (mft, vol->mft_record_size * record, 1, vol->mft_record_size, file->mft) < 1) { + Eprintf ("Couldn't read MFT Record %lld.\n", record); + ntfs_attr_close (mft); + free_file (file); + return NULL; + } + + ntfs_attr_close (mft); + mft = NULL; + + attr10 = find_first_attribute (AT_STANDARD_INFORMATION, file->mft); + attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, file->mft); + attr90 = find_first_attribute (AT_INDEX_ROOT, file->mft); + + Dprintf ("Attributes present: %s %s %s\n", attr10?"0x10":"", attr20?"0x20":"", attr90?"0x90":""); + + if (attr10) + { + STANDARD_INFORMATION *si; + si = (STANDARD_INFORMATION *) ((char *) attr10 + le16_to_cpu (attr10->value_offset)); + file->date = max (file->date, ntfs2utc (sle64_to_cpu (si->last_data_change_time))); + } + + if (attr20 || !attr10) + file->attr_list = 1; + if (attr90) + file->directory = 1; + + if (get_filenames (file) < 0) { + Eprintf ("Couldn't get filenames.\n"); + } + if (get_data (file, vol) < 0) { + Eprintf ("Couldn't get data streams.\n"); + } + + return file; +} + + +/** + * cluster_in_use - Determine if a cluster is in use + * @vol: An ntfs volume obtained from ntfs_mount + * @lcn: The Logical Cluster Number to test + * + * The metadata file $Bitmap has one binary bit representing each cluster on + * disk. The bit will be set of each cluster that is in use. The function + * reads the relevant part of $Bitmap into a buffer and tests the bit. + * + * This function has a static buffer in which it caches a section of $Bitmap. + * If the lcn, being tested, lies outside the range, the buffer will be + * refreshed. + * + * Return: 1 Cluster is in use + * 0 Cluster is free space + * -1 Error occurred + */ +int cluster_in_use (ntfs_volume *vol, long long lcn) +{ + static unsigned char buffer[512]; + static long long bmplcn = -sizeof (buffer) - 1; /* Which bit of $Bitmap is in the buffer */ + + int byte, bit; + ntfs_attr *attr; + + if (!vol) + return -1; + + /* Does lcn lie in the section of $Bitmap we already have cached? */ + if ((lcn < bmplcn) || (lcn >= (bmplcn + (sizeof (buffer) << 3)))) { + Dprintf ("Bit lies outside cache.\n"); + attr = ntfs_attr_open (vol->lcnbmp_ni, AT_DATA, NULL, 0); + if (!attr) { + Eprintf ("Couldn't open $MFT/$BITMAP: %s\n", strerror (errno)); + return -1; + } + + /* Mark the buffer as in use, in case the read is shorter. */ + memset (buffer, 0xFF, sizeof (buffer)); + bmplcn = lcn & (~((sizeof (buffer) << 3) - 1)); + + if (ntfs_attr_pread (attr, (bmplcn>>3), sizeof (buffer), buffer) < 0) { + Eprintf ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno)); + ntfs_attr_close (attr); + return -1; + } + + Dprintf ("Reloaded bitmap buffer.\n"); + ntfs_attr_close (attr); + } + + bit = 1 << (lcn & 7); + byte = (lcn >> 3) & (sizeof (buffer) - 1); + Dprintf ("cluster = %lld, bmplcn = %lld, byte = %d, bit = %d, in use %d\n", + lcn, bmplcn, byte, bit, buffer[byte] & bit); + + return (buffer[byte] & bit); +} + +/** + * calc_percentage - Calculate how much of the file is recoverable + * @file: The file object to work with + * @vol: An ntfs volume obtained from ntfs_mount + * + * Read through all the $DATA streams and determine if each cluster in each + * stream is still free disk space. This is just measuring the potential for + * recovery. The data may have still been overwritten by a another file which + * was then deleted. + * + * Files with a resident $DATA stream will have a 100% potential. + * + * N.B. If $DATA attribute spans more than one MFT record (i.e. badly + * fragmented) then only the data in this segment will be used for the + * calculation. + * + * N.B. Currently, compressed and encrypted files cannot be recovered, so they + * will return 0%. + * + * Return: n The percentage of the file that _could_ be recovered + * -1 Error + */ +int calc_percentage (struct ufile *file, ntfs_volume *vol) +{ + run_list_element *rl = NULL; + struct list_head *pos; + struct data *data; + long long i, j; + long long start, end; + int inuse, free; + int percent = 0; + + if (!file || !vol) + return -1; + + if (file->directory) { + Dprintf ("Found a directory: not recoverable.\n"); + return 0; + } + + if (list_empty (&file->data)) { + Vprintf ("File has no data streams.\n"); + return 0; + } + + list_for_each (pos, &file->data) { + data = list_entry (pos, struct data, list); + inuse = 0; + free = 0; + + if (data->encrypted) { + Vprintf ("File is encrypted, recovery is impossible.\n"); + continue; + } + + if (data->compressed) { + Vprintf ("File is compressed, recovery not yet implemented.\n"); + continue; + } + + if (data->resident) { + Vprintf ("File is resident, therefore recoverable.\n"); + percent = 100; + data->percent = 100; + continue; + } + + rl = data->run_list; + if (!rl) { + Vprintf ("File has no run list, hence no data.\n"); + continue; + } + + if (rl[0].length <= 0) { + Vprintf ("File has an empty run list, hence no data.\n"); + continue; + } + + if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ + Vprintf ("Missing segment at beginning, %lld clusters\n", rl[0].length); + inuse += rl[0].length; + rl++; + } + + for (i = 0; rl[i].length > 0; i++) { + if (rl[i].lcn == LCN_RL_NOT_MAPPED) { + Vprintf ("Missing segment at end, %lld clusters\n", rl[i].length); + inuse += rl[i].length; + continue; + } + + if (rl[i].lcn == LCN_HOLE) { + free += rl[i].length; + continue; + } + + start = rl[i].lcn; + end = rl[i].lcn + rl[i].length; + + for (j = start; j < end; j++) { + if (cluster_in_use (vol, j)) + inuse++; + else + free++; + } + } + + if ((inuse + free) == 0) { + Eprintf ("Unexpected error whilst calculating percentage for inode %lld\n", file->inode); + continue; + } + + data->percent = (free * 100) / (inuse + free); + + percent = max (percent, data->percent); + } + + Vprintf ("File is %d%% recoverable\n", percent); + return percent; +} + +/** + * dump_record - Print everything we know about an MFT record + * @file: The file to work with + * + * Output the contents of the file object. This will print everything that has + * been read from the MFT record, or implied by various means. + * + * Because of the redundant nature of NTFS, there will be some duplication of + * information, though it will have been read from different sources. + * + * N.B. If the filename is missing, or couldn't be converted to the current + * locale, "" will be displayed. + * + * Return: none + */ +void dump_record (struct ufile *file) +{ + char buffer[20]; + char *name; + struct list_head *item; + int i; + + if (!file) + return; + + Iprintf ("MFT Record %lld\n", file->inode); + Iprintf ("Type: %s\n", (file->directory) ? "Directory" : "File"); + strftime (buffer, sizeof (buffer), "%F %R", localtime (&file->date)); + Iprintf ("Date: %s\n", buffer); + + if (file->attr_list) + Iprintf ("Metadata may span more than one MFT record\n"); + + list_for_each (item, &file->name) { + struct filename *f = list_entry (item, struct filename, list); + + if (f->name) + name = f->name; + else + name = NONE; + + Iprintf ("Filename: (%d) %s\n", f->name_space, f->name); + Iprintf ("File Flags: "); + if (f->flags & FILE_ATTR_SYSTEM) Iprintf ("System "); + if (f->flags & FILE_ATTR_DIRECTORY) Iprintf ("Directory "); + if (f->flags & FILE_ATTR_SPARSE_FILE) Iprintf ("Sparse "); + if (f->flags & FILE_ATTR_REPARSE_POINT) Iprintf ("Reparse "); + if (f->flags & FILE_ATTR_COMPRESSED) Iprintf ("Compressed "); + if (f->flags & FILE_ATTR_ENCRYPTED) Iprintf ("Encrypted "); + if (!(f->flags & (FILE_ATTR_SYSTEM || FILE_ATTR_DIRECTORY || + FILE_ATTR_SPARSE_FILE || FILE_ATTR_REPARSE_POINT || + FILE_ATTR_COMPRESSED || FILE_ATTR_ENCRYPTED))) { + Iprintf (NONE); + } + Iprintf ("\n"); + Iprintf ("Size alloc: %lld\n", f->size_alloc); + Iprintf ("Size data: %lld\n", f->size_data); + + strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_c)); + Iprintf ("Date C: %s\n", buffer); + strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_a)); + Iprintf ("Date A: %s\n", buffer); + strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_m)); + Iprintf ("Date M: %s\n", buffer); + strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_r)); + Iprintf ("Date R: %s\n", buffer); + } + + Iprintf ("Data Streams:\n"); + list_for_each (item, &file->data) { + struct data *d = list_entry (item, struct data, list); + Iprintf ("Name: %s\n", (d->name) ? d->name : ""); + Iprintf ("Flags: "); + if (d->resident) Iprintf ("Resident\n"); + if (d->compressed) Iprintf ("Compressed\n"); + if (d->encrypted) Iprintf ("Encrypted\n"); + if (!d->resident && !d->compressed && !d->encrypted) + Iprintf ("None\n"); + else + Iprintf ("\n"); + + Iprintf ("Size alloc: %lld\n", d->size_alloc); + Iprintf ("Size data: %lld\n", d->size_data); + Iprintf ("Size init: %lld\n", d->size_init); + Iprintf ("Size vcn: %lld\n", d->size_vcn); + + Iprintf ("Data runs:\n"); + if ((!d->run_list) || (d->run_list[0].length <= 0)) { + Iprintf (" None\n"); + } else { + for (i = 0; d->run_list[i].length > 0; i++) { + Iprintf (" %lld @ %lld\n", d->run_list[i].length, d->run_list[i].lcn); + } + } + + Iprintf ("Amount potentially recoverable %d%%\n", d->percent); + } + + Iprintf ("________________________________________\n\n"); +} + +/** + * list_record - Print a one line summary of the file + * @file: The file to work with + * + * Print a one line description of a file. + * + * Inode Flags %age Date Size Filename + * + * The output will contain the file's inode number (MFT Record), some flags, + * the percentage of the file that is recoverable, the last modification date, + * the size and the filename. + * + * The flags are F/D = File/Directory, N/R = Data is (Non-)Resident, + * C = Compressed, E = Encrypted, ! = Metadata may span multiple records. + * + * N.B. The file size is stored in many forms in several attributes. This + * display the largest it finds. + * + * N.B. If the filename is missing, or couldn't be converted to the current + * locale, "" will be displayed. + * + * Return: none + */ +void list_record (struct ufile *file) +{ + char buffer[20]; + struct list_head *item; + char *name = NULL; + long long size = 0; + int percent = 0; + + char flagd = '.', flagr = '.', flagc = '.', flagx = '.'; + + strftime (buffer, sizeof (buffer), "%F", localtime (&file->date)); + + if (file->attr_list) + flagx = '!'; + + if (file->directory) + flagd = 'D'; + else + flagd = 'F'; + + list_for_each (item, &file->data) { + struct data *d = list_entry (item, struct data, list); + + if (!d->name) { + if (d->resident) flagr = 'R'; + else flagr = 'N'; + if (d->compressed) flagc = 'C'; /* These two are mutually exclusive */ + if (d->encrypted) flagc = 'E'; + + percent = max (percent, d->percent); + } + + size = max (size, d->size_data); + size = max (size, d->size_init); + } + + if (file->pref_name) + name = file->pref_name; + else + name = NONE; + + Iprintf ("%-8lld %c%c%c%c %3d%% %s %9lld %s\n", + file->inode, flagd, flagr, flagc, flagx, + percent, buffer, size, name); +} + +/** + * name_match - Does a file have a name matching a regex + * @re: The regular expression object + * @file: The file to be tested + * + * Iterate through the file's $FILENAME attributes and compare them against the + * regular expression, created with regcomp. + * + * Return: 1 There is a matching filename. + * 0 There is no match. + */ +int name_match (regex_t *re, struct ufile *file) +{ + struct list_head *item; + int result; + + if (!re || !file) + return 0; + + list_for_each (item, &file->name) { + struct filename *f = list_entry (item, struct filename, list); + + if (!f->name) + continue; + result = regexec (re, f->name, 0, NULL, 0); + if (result < 0) { + Eprintf ("Couldn't compare filename with regex: %s\n", strerror (errno)); + return 0; + } else if (result == REG_NOERROR) { + Dprintf ("Found a matching filename.\n"); + return 1; + } + } + + Dprintf ("Filename '%s' doesn't match regex.\n", file->pref_name); + return 0; +} + +/** + * write_data - Write out a block of data + * @fd: File descriptor to write to + * @buffer: Data to write + * @bufsize: Amount of data to write + * + * Write a block of data to a file descriptor. + * + * Return: -1 Error, something went wrong + * 0 Success, all the data was written + */ +unsigned int write_data (int fd, const char *buffer, unsigned int bufsize) +{ + ssize_t result1, result2; + + if (!buffer) { + errno = EINVAL; + return -1; + } + + result1 = write (fd, buffer, bufsize); + if ((result1 == (ssize_t) bufsize) || (result1 < 0)) + return result1; + + /* Try again with the rest of the buffer */ + buffer += result1; + bufsize -= result1; + + result2 = write (fd, buffer, bufsize); + if (result2 < 0) + return result1; + + return result1 + result2; +} + +/** + * open_file - Create a file based on the dir, name and stream supplied + * @dir: Directory in which to create the file (optional) + * @name: Filename to give the file (optional) + * @stream: Name of the stream (optional) + * + * Create a file and return the file descriptor. All the components are + * optional. If the name is missing, "unknown" will be used. If the directory + * is missing the file will be created in the current directory. If the stream + * name is present it will be appended to the filename, delimited by a colon. + * + * Return: -1 Error, failed to create the file + * n Success, this is the file descriptor + */ +int open_file (const char *dir, const char *name, const char *stream) +{ + char buf[256]; + int flags; + + if (!name) + name = UNKNOWN; + + if (dir) + if (stream) + snprintf (buf, sizeof (buf), "%s/%s:%s", dir, name, stream); + else + snprintf (buf, sizeof (buf), "%s/%s", dir, name); + else + if (stream) + snprintf (buf, sizeof (buf), "%s:%s", name, stream); + else + snprintf (buf, sizeof (buf), "%s", name); + + Vprintf ("Creating file: %s\n", buf); + + if (opts.force) + flags = O_RDWR | O_CREAT | O_TRUNC; + else + flags = O_RDWR | O_CREAT | O_EXCL; + + return open (buf, flags, S_IRUSR | S_IWUSR); +} + + +/** + * scan_disk - Search an NTFS volume for files that could be undeleted + * @vol: An ntfs volume obtained from ntfs_mount + * + * Read through all the MFT entries looking for deleted files. For each one + * determine how much of the data lies in unused disk space. + * + * The list can be filtered by name, size and date, using command line options. + * + * Return: -1 Error, something went wrong + * n Success, the number of recoverable files + */ +int scan_disk (ntfs_volume *vol) +{ + const int BUFSIZE = 8192; + char *buffer = NULL; + int results = 0; + ntfs_attr *attr; + long long size; + long long read; + long long bmpsize; + int i, j, k, b; + int percent; + struct ufile *file; + regex_t re; + + if (!vol) + return -1; + + attr = ntfs_attr_open (vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0); + if (!attr) { + Eprintf ("Couldn't open $MFT/$BITMAP: %s\n", strerror (errno)); + return -1; + } + bmpsize = attr->initialized_size; + + buffer = malloc (BUFSIZE); + if (!buffer) { + Eprintf ("Couldn't allocate memory in scan_disk()\n"); + results = -1; + goto out; + } + + if (opts.match) { + int flags = REG_NOSUB; + + if (!opts.match_case) + flags |= REG_ICASE; + if (regcomp (&re, opts.match, flags)) { + Eprintf ("Couldn't create a regex.\n"); + goto out; + } + } + + Iprintf ("Inode Flags %%age Date Size Filename\n"); + Iprintf ("---------------------------------------------------------------\n"); + for (i = 0; i < bmpsize; i += BUFSIZE) { + read = min ((bmpsize - i), BUFSIZE); + size = ntfs_attr_pread (attr, i, read, buffer); + if (size < 0) + break; + + for (j = 0; j < size; j++) { + b = buffer[j]; + for (k = 0; k < 8; k++, b>>=1) { + if (((i+j)*8+k) >= vol->nr_mft_records) + goto done; + if (b & 1) + continue; + file = read_record (vol, (i+j)*8+k); + if (!file) { + Eprintf ("Couldn't read MFT Record %d.\n", (i+j)*8+k); + continue; + } + + if ((opts.since > 0) && (file->date <= opts.since)) + goto skip; + if (opts.match && !name_match (&re, file)) + goto skip; + if (opts.size_begin && (opts.size_begin > file->max_size)) + goto skip; + if (opts.size_end && (opts.size_end < file->max_size)) + goto skip; + + percent = calc_percentage (file, vol); + + if ((opts.percent == -1) || (percent >= opts.percent)) { + if (opts.verbose) + dump_record (file); + else + list_record (file); + } + + if (((opts.percent == -1) && (percent > 0)) || + ((opts.percent > 0) && (percent >= opts.percent))) { + results++; + } +skip: + free_file (file); + } + } + } +done: + Iprintf ("\nFiles with potentially recoverable content: %d\n", results); +out: + if (opts.match) + regfree (&re); + free (buffer); + if (attr) + ntfs_attr_close (attr); + return results; +} + +/** + * undelete_file - Recover a deleted file from an NTFS volume + * @vol: An ntfs volume obtained from ntfs_mount + * @inode: MFT Record number to be recovered + * + * Read an MFT Record and try an recover any data associated with it. Some of + * the clusters may be in use; these will be filled with zeros or the fill byte + * supplied in the options. + * + * Each data stream will be recovered and saved to a file. The file's name will + * be the original filename and it will be written to the current directory. + * Any named data stream will be saved as filename:streamname. + * + * The output file's name and location can be altered by using the command line + * options. + * + * N.B. We cannot tell if someone has overwritten some of the data since the + * file was deleted. + * + * Return: 0 Error, something went wrong + * 1 Success, the data was recovered + */ +int undelete_file (ntfs_volume *vol, long long inode) +{ + char *buffer = NULL; + struct ufile *file; + int i, j; + long long start, end; + run_list_element *rl; + struct list_head *item; + int fd = -1; + long long k; + int result = 0; + + if (!vol) + return 0; + + file = read_record (vol, inode); + if (!file || !file->mft) { + Eprintf ("Can't read info from mft record %lld.\n", inode); + return 0; + } + + buffer = malloc (vol->mft_record_size); + if (!buffer) + goto free; + + if (opts.verbose) { + dump_record (file); + } else { + Iprintf ("Inode Flags %%age Date Size Filename\n"); + Iprintf ("---------------------------------------------------------------\n"); + list_record (file); + Iprintf ("\n"); + } + + if (file->mft->flags & MFT_RECORD_IN_USE) { + Eprintf ("Record is in use by the mft\n"); + if (!opts.force) { + free_file (file); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + if (calc_percentage (file, vol) == 0) { + Iprintf ("File has no recoverable data.\n"); + goto free; + } + + if (list_empty (&file->data)) { + Iprintf ("File has no data. There is nothing to recover.\n"); + goto free; + } + + list_for_each (item, &file->data) { + struct data *d = list_entry (item, struct data, list); + + if (d->resident) { + fd = open_file (opts.dest, file->pref_name, d->name); + if (fd < 0) { + Eprintf ("Couldn't create file: %s\n", strerror (errno)); + goto free; + } + + Vprintf ("File has resident data.\n"); + if (write_data (fd, d->data, d->size_data) < d->size_data) { + Eprintf ("Write failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + + if (close (fd) < 0) { + Eprintf ("Close failed: %s\n", strerror (errno)); + } + fd = -1; + } else { + rl = d->run_list; + if (!rl) { + Vprintf ("File has no run list, hence no data.\n"); + continue; + } + + if (rl[0].length <= 0) { + Vprintf ("File has an empty run list, hence no data.\n"); + continue; + } + + fd = open_file (opts.dest, file->pref_name, d->name); + if (fd < 0) { + Eprintf ("Couldn't create output file: %s\n", strerror (errno)); + goto free; + } + + if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ + Vprintf ("Missing segment at beginning, %lld clusters.\n", rl[0].length); + memset (buffer, opts.fillbyte, sizeof (buffer)); + for (k = 0; k < rl[0].length * vol->cluster_size; k += sizeof (buffer)) { + if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + Eprintf ("Write failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + } + } + + for (i = 0; rl[i].length > 0; i++) { + + if (rl[i].lcn == LCN_RL_NOT_MAPPED) { + Vprintf ("Missing segment at end, %lld clusters.\n", rl[i].length); + memset (buffer, opts.fillbyte, sizeof (buffer)); + for (k = 0; k < rl[k].length * vol->cluster_size; k += sizeof (buffer)) { + if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + Eprintf ("Write failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + } + continue; + } + + if (rl[i].lcn == LCN_HOLE) { + Vprintf ("File has a sparse section.\n"); + memset (buffer, 0, sizeof (buffer)); + for (k = 0; k < rl[k].length * vol->cluster_size; k += sizeof (buffer)) { + if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + Eprintf ("Write failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + } + continue; + } + + start = rl[i].lcn; + end = rl[i].lcn + rl[i].length; + + for (j = start; j < end; j++) { + if (cluster_in_use (vol, j)) { + memset (buffer, opts.fillbyte, sizeof (buffer)); + if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + Eprintf ("Write failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + } else { + if (ntfs_read_clusters (vol, j, 1, buffer) < 1) { + Eprintf ("Read failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + Eprintf ("Write failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + } + } + } + Iprintf ("\n"); + if (close (fd) < 0) { + Eprintf ("Close failed: %s\n", strerror (errno)); + } + fd = -1; + + } + if (d->name) + Iprintf ("Undeleted '%s:%s' successfully.\n", file->pref_name, d->name); + else + Iprintf ("Undeleted '%s' successfully.\n", file->pref_name); + } + result = 1; +free: + if (buffer) + free (buffer); + free_file (file); + return result; +} + +/** + * copy_mft - Write a range of MFT Records to a file + * @vol: An ntfs volume obtained from ntfs_mount + * @mft_begin: First MFT Record to save + * @mft_end: Last MFT Record to save + * + * Read a number of MFT Records and write them to a file. + * + * Return: 0 Success, all the records were written + * 1 Error, something went wrong + */ +int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) +{ + ntfs_attr *mft; + char *buffer; + const char *name; + long long i; + int result = 1; + int fd; + + if (!vol) + return 1; + + if (mft_end < mft_begin) { + Eprintf ("Range to copy is backwards.\n"); + return 1; + } + + buffer = malloc (vol->mft_record_size); + if (!buffer) { + Eprintf ("Couldn't allocate memory in copy_mft()\n"); + return 1; + } + + mft = ntfs_attr_open (vol->mft_ni, AT_DATA, NULL, 0); + if (!mft) { + Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); + goto free; + } + + name = opts.output; + if (!name) { + name = MFTFILE; + Dprintf ("No output filename, defaulting to '%s'.\n", name); + } + + fd = open_file (opts.dest, name, NULL); + if (fd < 0) { + Eprintf ("Couldn't open output file '%s': %s\n", name, strerror (errno)); + goto attr; + } + + mft_end = min (mft_end, vol->nr_mft_records - 1); + + Dprintf ("MFT records\n"); + Dprintf (" Total: %8lld\n", vol->nr_mft_records); + Dprintf (" Begin: %8lld\n", mft_begin); + Dprintf (" End: %8lld\n", mft_end); + + for (i = mft_begin; i <= mft_end; i++) { + if (ntfs_attr_pread (mft, vol->mft_record_size * i, vol->mft_record_size, buffer) < vol->mft_record_size) { + Eprintf ("Couldn't read MFT Record %d: %s.\n", i, strerror (errno)); + goto close; + } + + if (write_data (fd, buffer, vol->mft_record_size) < vol->mft_record_size) { + Eprintf ("Write failed: %s\n", strerror (errno)); + goto close; + } + } + + Vprintf ("Read %d MFT Records\n", mft_end - mft_begin + 1); + result = 0; +close: + close (fd); +attr: + ntfs_attr_close (mft); +free: + free (buffer); + return result; +} + +/** + * valid_device - Perform some safety checks on the device, before we start + * @name: Full pathname of the device/file to work with + * @force: Continue regardless of problems + * + * Check that the name refers to a device and that is isn't already mounted. + * These checks can be overridden by using the force option. + * + * Return: 1 Success, we can continue + * 0 Error, we cannot use this device + */ +int valid_device (const char *name, int force) +{ + unsigned long mnt_flags = 0; + struct stat st; + + if (stat (name, &st) == -1) { + if (errno == ENOENT) { + Eprintf ("The device %s doesn't exist\n", name); + } else { + Eprintf ("Error getting information about %s: %s\n", name, strerror (errno)); + } + return 0; + } + + if (!S_ISBLK (st.st_mode)) { + Vprintf ("%s is not a block device.\n", name); + if (!force) { + Eprintf ("Use the force option to work with files.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + /* Make sure the file system is not mounted. */ + if (ntfs_check_if_mounted (name, &mnt_flags)) { + Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); + if (!force) { + Eprintf ("Use the force option to ignore this error.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } else if (mnt_flags & NTFS_MF_MOUNTED) { + Vprintf ("The device %s, is mounted.\n", name); + if (!force) { + Eprintf ("Use the force option to work a mounted filesystem.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + Dprintf ("Device %s, will be used\n", name); + return 1; +} + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main (int argc, char *argv[]) +{ + const char *locale; + ntfs_volume *vol; + int result = 1; + + locale = setlocale (LC_ALL, ""); + if (!locale) { + locale = setlocale (LC_ALL, NULL); + Vprintf ("Failed to set locale, using default '%s'.\n", locale); + } else { + Vprintf ("Using locale '%s'.\n", locale); + } + + if (!parse_options (argc, argv)) + goto free; + + if (!valid_device (opts.device, opts.force)) + goto free; + + vol = ntfs_mount (opts.device, MS_RDONLY); + if (!vol) { + Eprintf ("Couldn't mount device '%s': %s\n", opts.device, strerror (errno)); + goto free; + } + + if (vol->flags & VOLUME_IS_DIRTY) { + Iprintf ("Volume is dirty.\n"); + if (!opts.force) { + Eprintf ("Run chkdsk and try again, or use the --force option.\n"); + goto umount; + } + Iprintf ("Forced to continue.\n"); + } + + switch (opts.mode) { + case MODE_SCAN: + result = !scan_disk (vol); + if (result) + Vprintf ("Failed to scan device '%s'.\n", opts.device); + break; + case MODE_UNDELETE: + result = !undelete_file (vol, opts.uinode); + if (result) + Vprintf ("Failed to undelete inode %d.\n", opts.uinode); + break; + case MODE_COPY: + result = !copy_mft (vol, opts.mft_begin, opts.mft_end); + if (result) + Vprintf ("Failed to read MFT blocks %lld-%lld.\n", + opts.mft_begin, min (vol->nr_mft_records, opts.mft_end)); + break; + default: + /* Cannot happen */ + } + +umount: + ntfs_umount (vol, FALSE); +free: + if (opts.match) + free (opts.match); + + return result; +} + From bd23a01967663ce33d82d4540bdf1386c2e6b2cd Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0064/2994] move the runlist functions from attrib.c to runlist.c 2002/06/06 15:43:58-00:00 !antona Add dir template to make files 2002/06/01 00:41:45-00:00 !antona huge update! 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/19 18:23:56-00:00 !antona Add foundation of new inode API. 2002/04/15 20:04:26-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/14 14:08:29-00:00 !antona Cleanup library code. Throw away unused stuff. 2001/12/06 01:14:52-00:00 !antona Added mount flags to ntfs_mount and adapted utilities to new mount syntax. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/10 18:30:17-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. 2001/06/01 02:07:25-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/07 00:53:37-00:00 !antona Makefile updates. 2001/03/26 03:46:56-00:00 !antona Makefile fix. 2001/02/03 02:03:36-00:00 !antona More files. 2001/02/02 01:15:17-00:00 !antona Updated documentation and other text files. Preparing for initial release. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- libntfs/Makefile.am | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index e69de29b..9b6ed8bd 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -0,0 +1,54 @@ +# +# Before making a release, the LTVERSION string should be modified. +# The string is of the form CURRENT:REVISION:AGE. +# +# CURRENT (C) +# The most recent interface number that this library implements. +# +# REVISION (R) +# The implementation number that this library implements. +# +# AGE (A) +# The difference between the newest and oldest interfaces that this +# library implements. In other works, the library implements all the +# interface numbers in the range from number 'CURRENT - AGE' to +# 'CURRENT'. +# +# This means that: +# +# - If interfaces have been changed or added, but binary compatibility has +# been preserved, change to C+1:0:A+1 +# +# - If binary compatibility has been broken (eg removed or changed +# interfaces) change to C+1:0:0 +# +# - If the interface is the same as the previous version, change to C:R+1:A +# + +LTVERSION = 4:0:0 + +# Need this to enable 64-bit (device) file access functions and parameters. +if DEBUG +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall +else +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 +endif + +linux_ntfsincludedir = -I$(top_srcdir)/include +lib_LTLIBRARIES = libntfs.la +libntfs_la_LDFLAGS = -version-info $(LTVERSION) +libntfs_la_SOURCES = \ + attrib.c \ + bootsect.c \ + debug.c \ + dir.c \ + disk_io.c \ + inode.c \ + mft.c \ + mst.c \ + runlist.c \ + unistr.c \ + volume.c + +INCLUDES = $(linux_ntfsincludedir) $(all_includes) + From 1483abd26c314635768b72ee73c29503ff74138a Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0065/2994] move the runlist functions from attrib.c to runlist.c 2002/06/06 15:43:59-00:00 !antona Add dir template to make files 2002/06/01 00:41:45-00:00 !antona huge update! 2002/04/25 07:50:34-00:00 !antona grr. MDK8.1 modified loads of stuff. Put it back with RH7.2 2002/04/24 23:47:42-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/19 18:23:56-00:00 !antona Add foundation of new inode API. 2002/04/15 20:04:26-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/14 14:08:29-00:00 !antona Cleanup library code. Throw away unused stuff. 2002/01/26 04:32:35-00:00 !antona RedHat 7.2 - updates 2001/12/06 01:14:52-00:00 !antona Added mount flags to ntfs_mount and adapted utilities to new mount syntax. 2001/11/17 01:57:53-00:00 !antona Update build system with new document. 2001/11/09 23:36:17-00:00 !antona Bug fixes 2001/11/09 19:24:23-00:00 !antona With lots of luck this is going to be 1.2.3. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/11 04:02:08-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/10 18:30:17-00:00 !antona Preparations for the 0.1.0 release. Updating documentation and information. Updating rpm generation and added mkntfs man page which currently is not accurate as it shows all the mke2fs options in it while mkntfs doesn't actually accept any options except for device at all but it is a good starting point. 2001/06/01 02:07:25-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/07 00:53:37-00:00 !antona Makefile updates. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/02/03 02:03:36-00:00 !antona More files. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... (Logical change 1.5) --- libntfs/Makefile.in | 405 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 405 insertions(+) diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index e69de29b..a9531dc5 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -0,0 +1,405 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# +# Before making a release, the LTVERSION string should be modified. +# The string is of the form CURRENT:REVISION:AGE. +# +# CURRENT (C) +# The most recent interface number that this library implements. +# +# REVISION (R) +# The implementation number that this library implements. +# +# AGE (A) +# The difference between the newest and oldest interfaces that this +# library implements. In other works, the library implements all the +# interface numbers in the range from number 'CURRENT - AGE' to +# 'CURRENT'. +# +# This means that: +# +# - If interfaces have been changed or added, but binary compatibility has +# been preserved, change to C+1:0:A+1 +# +# - If binary compatibility has been broken (eg removed or changed +# interfaces) change to C+1:0:0 +# +# - If the interface is the same as the previous version, change to C:R+1:A +# + + +SHELL = @SHELL@ + +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 = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AS = @AS@ +AUTODIRS = @AUTODIRS@ +CC = @CC@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ + +LTVERSION = 4:0:0 +@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall +@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 + +linux_ntfsincludedir = -I$(top_srcdir)/include +lib_LTLIBRARIES = libntfs.la +libntfs_la_LDFLAGS = -version-info $(LTVERSION) +libntfs_la_SOURCES = \ + attrib.c \ + bootsect.c \ + debug.c \ + dir.c \ + disk_io.c \ + inode.c \ + mft.c \ + mst.c \ + runlist.c \ + unistr.c \ + volume.c + + +INCLUDES = $(linux_ntfsincludedir) $(all_includes) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +LIBS = @LIBS@ +libntfs_la_LIBADD = +libntfs_la_OBJECTS = attrib.lo bootsect.lo debug.lo dir.lo disk_io.lo \ +inode.lo mft.lo mst.lo runlist.lo unistr.lo volume.lo +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +DEP_FILES = .deps/attrib.P .deps/bootsect.P .deps/debug.P .deps/dir.P \ +.deps/disk_io.P .deps/inode.P .deps/mft.P .deps/mst.P .deps/runlist.P \ +.deps/unistr.P .deps/volume.P +SOURCES = $(libntfs_la_SOURCES) +OBJECTS = $(libntfs_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu libntfs/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-libLTLIBRARIES: + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + +distclean-libLTLIBRARIES: + +maintainer-clean-libLTLIBRARIES: + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +libntfs.la: $(libntfs_la_OBJECTS) $(libntfs_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libntfs_la_LDFLAGS) $(libntfs_la_OBJECTS) $(libntfs_la_LIBADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(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)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = libntfs + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu libntfs/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: install-libLTLIBRARIES +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-libLTLIBRARIES +uninstall: uninstall-am +all-am: Makefile $(LTLIBRARIES) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \ + clean-depend clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-libLTLIBRARIES distclean-compile \ + distclean-libtool distclean-tags distclean-depend \ + distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-libLTLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-tags maintainer-clean-depend \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \ +clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \ +uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \ +distclean-compile clean-compile maintainer-clean-compile \ +mostlyclean-libtool distclean-libtool clean-libtool \ +maintainer-clean-libtool tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir mostlyclean-depend \ +distclean-depend clean-depend maintainer-clean-depend info-am info \ +dvi-am dvi check check-am installcheck-am installcheck 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 + + +# 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: From cea30149a6746d0b94e7ed371f343657417bc0e9 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0066/2994] move the runlist functions from attrib.c to runlist.c 2002/06/06 15:45:06-00:00 !antona And the headerfile too 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/19 18:23:56-00:00 !antona Add foundation of new inode API. 2002/04/14 13:56:44-00:00 !antona cleanup header files. 2002/04/12 15:23:47-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 11:49:15-00:00 !antona Header file reorganisation so that it compiles. 2001/04/07 00:53:37-00:00 !antona Makefile updates. 2001/03/26 03:42:13-00:00 !antona Forgot to add the new support.h 2001/02/03 02:03:35-00:00 !antona More files. 2001/02/02 01:28:46-00:00 !antona make dist fixes using more Makefiles. (Logical change 1.5) --- include/Makefile.am | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/include/Makefile.am b/include/Makefile.am index e69de29b..f6682510 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -0,0 +1,29 @@ + +# Need this to enable 64-bit (device) file access functions and parameters. +if DEBUG +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG +else +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 +endif + +linux_ntfsincludedir = $(includedir)/ntfs +linux_ntfsinclude_HEADERS = \ + attrib.h \ + bitmap.h \ + bootsect.h \ + debug.h \ + dir.h \ + disk_io.h \ + endians.h \ + inode.h \ + layout.h \ + list.h \ + logfile.h \ + mft.h \ + mst.h \ + runlist.h \ + support.h \ + types.h \ + unistr.h \ + volume.h + From 4f4c955da791ffad05609fdf287c20d2115997cf Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0067/2994] move the runlist functions from attrib.c to runlist.c 2002/06/06 15:45:06-00:00 !antona And the headerfile too 2002/04/25 07:50:34-00:00 !antona grr. MDK8.1 modified loads of stuff. Put it back with RH7.2 2002/04/24 23:47:42-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/19 18:23:56-00:00 !antona Add foundation of new inode API. 2002/04/14 13:58:54-00:00 !antona Tidyup last cleanups 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2002/04/12 15:23:47-00:00 !antona Cleanup ntfslabel, write a man page for it, integrate it all in the distribution properly, silence output from ntfs_mount() (conditional on running configure with --enable-debug), update all docs accordingly. Add Rich and Matt to AUTHORS. 2002/01/26 04:32:35-00:00 !antona RedHat 7.2 - updates 2001/11/17 01:57:53-00:00 !antona Update build system with new document. 2001/11/09 23:36:17-00:00 !antona Bug fixes 2001/11/09 19:24:23-00:00 !antona With lots of luck this is going to be 1.2.3. 2001/07/24 17:41:01-00:00 !antona Minor updates and restructuring the distribution. See NEWS and ChangeLog for details. 2001/06/11 04:02:08-00:00 !antona Linux-NTFS 1.0.0-pre-1 - FEATURE FREEZE ======================================= mkntfs complete with option parsing and more cool things. mkntfs man page complete. info files updated. TODO Before 1.0.0 final: - Test mkntfs options & mkntfs itself. - Test tar ball generation. - Test rpm generation. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 11:49:15-00:00 !antona Header file reorganisation so that it compiles. 2001/04/07 00:53:37-00:00 !antona Makefile updates. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/02/03 02:03:35-00:00 !antona More files. (Logical change 1.5) --- include/Makefile.in | 269 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 269 insertions(+) diff --git a/include/Makefile.in b/include/Makefile.in index e69de29b..eeb7104d 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -0,0 +1,269 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Need this to enable 64-bit (device) file access functions and parameters. + + +SHELL = @SHELL@ + +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 = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AS = @AS@ +AUTODIRS = @AUTODIRS@ +CC = @CC@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG +@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 + +linux_ntfsincludedir = $(includedir)/ntfs +linux_ntfsinclude_HEADERS = \ + attrib.h \ + bitmap.h \ + bootsect.h \ + debug.h \ + dir.h \ + disk_io.h \ + endians.h \ + inode.h \ + layout.h \ + list.h \ + logfile.h \ + mft.h \ + mst.h \ + runlist.h \ + support.h \ + types.h \ + unistr.h \ + volume.h + +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = +HEADERS = $(linux_ntfsinclude_HEADERS) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(linux_ntfsincludedir) + @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(linux_ntfsincludedir)/$$p"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(linux_ntfsincludedir)/$$p; \ + done + +uninstall-linux_ntfsincludeHEADERS: + @$(NORMAL_UNINSTALL) + list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(linux_ntfsincludedir)/$$p; \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(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)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = include + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu include/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: install-linux_ntfsincludeHEADERS +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-linux_ntfsincludeHEADERS +uninstall: uninstall-am +all-am: Makefile $(HEADERS) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(linux_ntfsincludedir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-tags clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-tags distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: 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." + +maintainer-clean: maintainer-clean-am + +.PHONY: uninstall-linux_ntfsincludeHEADERS \ +install-linux_ntfsincludeHEADERS tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ +check-am installcheck-am installcheck 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 + + +# 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: From 5b6a80f9a504c1eb79bef3bd41c5333479840c24 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0068/2994] new function headers and a few function moves 2002/07/11 16:20:33-00:00 !flatcap whitespace and include guards 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... (Logical change 1.5) --- libntfs/debug.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/libntfs/debug.c b/libntfs/debug.c index e69de29b..67166755 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -0,0 +1,62 @@ +/* + * $Id$ + * + * debug.c - Debugging output functions. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "debug.h" + +#ifdef DEBUG +/** + * ntfs_debug_dump_run_list - Dump a run list. + */ +void ntfs_debug_dump_run_list(const run_list_element *rl) +{ + int i = 0; + const char *lcn_str[5] = { "LCN_HOLE ", "LCN_RL_NOT_MAPPED", + "LCN_ENOENT ", "LCN_EINVAL ", + "LCN_unknown " }; + + Dputs("NTFS-fs DEBUG: Dumping run list (values in hex):"); + if (!rl) { + Dputs("Run list not present."); + return; + } + Dputs("VCN LCN Run length"); + do { + LCN lcn = (rl + i)->lcn; + + if (lcn < (LCN)0) { + int index = -lcn - 1; + + if (index > -LCN_EINVAL - 1) + index = 4; + Dprintf("%-16Lx %s %-16Lx%s\n", rl[i].vcn, + lcn_str[index], rl[i].length, + rl[i].length ? "" : " (run list end)"); + } else + Dprintf("%-16Lx %-16Lx %-16Lx%s\n", rl[i].vcn, + rl[i].lcn, rl[i].length, + rl[i].length ? "" : " (run list end)"); + } while (rl[i++].length); +} + +#endif + From 0bb969090c97b4fb60ad60a86e0d3e68046c6920 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0069/2994] new function headers and a few function moves 2002/07/11 16:20:33-00:00 !flatcap whitespace and include guards 2002/07/11 13:18:11-00:00 !flatcap start to break up the dependency loops in the header files 2002/07/09 19:17:48-00:00 !flatcap move the runlist functions from attrib.c to runlist.c (Logical change 1.5) --- include/runlist.h | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/include/runlist.h b/include/runlist.h index e69de29b..903b81d8 100644 --- a/include/runlist.h +++ b/include/runlist.h @@ -0,0 +1,69 @@ +/* + * $Id$ + * + * runlist.h - Exports for runlist handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov. + * Copyright (c) 2002 Richard Russon. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_RUNLIST_H +#define _NTFS_RUNLIST_H + +#include "types.h" + +/* Forward declarations */ +typedef struct _run_list_element run_list_element; +typedef run_list_element run_list; + +#include "attrib.h" +#include "volume.h" + +/* + * run_list_element - in memory vcn to lcn mapping array element + * @vcn: starting vcn of the current array element + * @lcn: starting lcn of the current array element + * @length: length in clusters of the current array element + * + * The last vcn (in fact the last vcn + 1) is reached when length == 0. + * + * When lcn == -1 this means that the count vcns starting at vcn are not + * physically allocated (i.e. this is a hole / data is sparse). + */ +struct _run_list_element {/* In memory vcn to lcn mapping structure element. */ + VCN vcn; /* vcn = Starting virtual cluster number. */ + LCN lcn; /* lcn = Starting logical cluster number. */ + s64 length; /* Run length in clusters. */ +}; + +extern LCN ntfs_rl_vcn_to_lcn(const run_list_element *rl, const VCN vcn); + +extern s64 ntfs_rl_pwrite(const ntfs_volume *vol, const run_list_element *rl, + const s64 pos, s64 count, void *b); + +extern run_list_element *ntfs_merge_run_lists(run_list_element *drl, + run_list_element *srl); + +extern run_list_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, + const ATTR_RECORD *attr, run_list_element *old_rl); + +extern int ntfs_build_mapping_pairs(const ntfs_volume *vol, s8 *dst, + const int dst_len, const run_list_element *rl); + +#endif /* defined _NTFS_RUNLIST_H */ + From 67b85b0e53e7fa685b5a3c5d399aa16747a8200a Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0070/2994] new function headers and a few function moves 2002/07/11 16:20:34-00:00 !flatcap whitespace and include guards 2002/07/11 13:18:11-00:00 !flatcap start to break up the dependency loops in the header files 2002/07/09 19:17:49-00:00 !flatcap move the runlist functions from attrib.c to runlist.c (Logical change 1.5) --- libntfs/runlist.c | 1180 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1180 insertions(+) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index e69de29b..c117f336 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -0,0 +1,1180 @@ +/* + * $Id$ + * + * runlist.c - Run list handling code. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov. + * Copyright (c) 2002 Richard Russon. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include + +#include "types.h" +#include "attrib.h" +#include "volume.h" +#include "layout.h" +#include "debug.h" +#include "disk_io.h" + +/** + * Internal: + * + * ntfs_rl_mm - run_list memmove + */ +static __inline__ void ntfs_rl_mm(run_list_element *base, int dst, int src, + int size) +{ + if ((dst != src) && (size > 0)) + memmove(base + dst, base + src, size * sizeof(*base)); +} + +/** + * Internal: + * + * rl_mc - run_list memory copy + */ +static __inline__ void ntfs_rl_mc(run_list_element *dstbase, int dst, + run_list_element *srcbase, int src, int size) +{ + if (size > 0) + memcpy(dstbase + dst, srcbase + src, size * sizeof(*dstbase)); +} + +/** + * Internal: + * + * ntfs_rl_realloc - Reallocate memory for run_lists* + * @rl: original run list + * @old_size: number of run list elements in the original run list @rl + * @new_size: number of run list elements we need space for + * + * As the run lists grow, more memory will be required. To prevent large + * numbers of small reallocations of memory, this function returns a 4kiB block + * of memory. + * + * N.B. If the new allocation doesn't require a different number of 4kiB + * blocks in memory, the function will return the original pointer. + * + * On success, return a pointer to the newly allocated, or recycled, memory. + * On error, return NULL with errno set to the error code. + */ +static __inline__ run_list_element *ntfs_rl_realloc(run_list_element *rl, + int old_size, int new_size) +{ + old_size = (old_size * sizeof(run_list_element) + 0xfff) & ~0xfff; + new_size = (new_size * sizeof(run_list_element) + 0xfff) & ~0xfff; + if (old_size == new_size) + return rl; + return realloc(rl, new_size); +} + +/** + * Internal: + * + * ntfs_are_rl_mergeable - test if two run lists can be joined together + * @dst: original run list + * @src: new run list to test for mergeability with @dst + * + * Test if two run lists can be joined together. For this, their VCNs and LCNs + * must be adjacent. + * + * Return: TRUE Success, the run lists can be merged. + * FALSE Failure, the run lists cannot be merged. + */ +static __inline__ BOOL ntfs_are_rl_mergeable(run_list_element *dst, + run_list_element *src) +{ + if (!dst || !src) { + Dputs("Eeek. ntfs_are_rl_mergeable() invoked with NULL " + "pointer!"); + return FALSE; + } + + if ((dst->lcn < 0) || (src->lcn < 0)) /* Are we merging holes? */ + return FALSE; + if ((dst->lcn + dst->length) != src->lcn) /* Are the runs contiguous? */ + return FALSE; + if ((dst->vcn + dst->length) != src->vcn) /* Are the runs misaligned? */ + return FALSE; + + return TRUE; +} + +/** + * Internal: + * + * __ntfs_rl_merge - merge two run lists without testing if they can be merged + * @dst: original, destination run list + * @src: new run list to merge with @dst + * + * Merge the two run lists, writing into the destination run list @dst. The + * caller must make sure the run lists can be merged or this will corrupt the + * destination run list. + */ +static __inline__ void __ntfs_rl_merge(run_list_element *dst, + run_list_element *src) +{ + dst->length += src->length; +} + +/** + * Internal: + * + * ntfs_rl_merge - test if two run lists can be joined together and merge them + * @dst: original, destination run list + * @src: new run list to merge with @dst + * + * Test if two run lists can be joined together. For this, their VCNs and LCNs + * must be adjacent. If they can be merged, perform the merge, writing into + * the destination run list @dst. + * + * Return: TRUE Success, the run lists have been merged. + * FALSE Failure, the run lists cannot be merged and have not been + * modified. + */ +static __inline__ BOOL ntfs_rl_merge(run_list_element *dst, + run_list_element *src) +{ + BOOL merge = ntfs_are_rl_mergeable(dst, src); + + if (merge) + __ntfs_rl_merge(dst, src); + return merge; +} + +/** + * Internal: + * + * ntfs_rl_append - append a run list after a given element + * @dst: original run list to be worked on + * @dsize: number of elements in @dst (including end marker) + * @src: run list to be inserted into @dst + * @ssize: number of elements in @src (excluding end marker) + * @loc: append the new run list @src after this element in @dst + * + * Append the run list @src after element @loc in @dst. Merge the right end of + * the new run list, if necessary. Adjust the size of the hole before the + * appended run list. + * + * On success, return a pointer to the new, combined, run list. Note, both + * run lists @dst and @src are deallocated before returning so you cannot use + * the pointers for anything any more. (Strictly speaking the returned run list + * may be the same as @dst but this is irrelevant.) + * + * On error, return NULL, with errno set to the error code. Both run lists are + * left unmodified. + */ +static __inline__ run_list_element *ntfs_rl_append(run_list_element *dst, + int dsize, run_list_element *src, int ssize, int loc) +{ + BOOL right; + int magic; + + if (!dst || !src) { + Dputs("Eeek. ntfs_rl_append() invoked with NULL pointer!"); + errno = EINVAL; + return NULL; + } + + /* First, check if the right hand end needs merging. */ + right = ntfs_are_rl_mergeable(src + ssize - 1, dst + loc + 1); + + /* Space required: @dst size + @src size, less one if we merged. */ + dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - right); + if (!dst) + return dst; + /* + * We are guaranteed to succeed from here so can start modifying the + * original run lists. + */ + + /* First, merge the right hand end, if necessary. */ + if (right) + __ntfs_rl_merge(src + ssize - 1, dst + loc + 1); + + /* FIXME: What does this mean? (AIA) */ + magic = loc + ssize; + + /* Move the tail of @dst out of the way, then copy in @src. */ + ntfs_rl_mm(dst, magic + 1, loc + 1 + right, dsize - loc - 1 - right); + ntfs_rl_mc(dst, loc + 1, src, 0, ssize); + + /* Adjust the size of the preceding hole. */ + dst[loc].length = dst[loc + 1].vcn - dst[loc].vcn; + + /* We may have changed the length of the file, so fix the end marker */ + if (dst[magic + 1].lcn == LCN_ENOENT) + dst[magic + 1].vcn = dst[magic].vcn + dst[magic].length; + + return dst; +} + +/** + * Internal: + * + * ntfs_rl_insert - insert a run list into another + * @dst: original run list to be worked on + * @dsize: number of elements in @dst (including end marker) + * @src: new run list to be inserted + * @ssize: number of elements in @src (excluding end marker) + * @loc: insert the new run list @src before this element in @dst + * + * Insert the run list @src before element @loc in the run list @dst. Merge the + * left end of the new run list, if necessary. Adjust the size of the hole + * after the inserted run list. + * + * On success, return a pointer to the new, combined, run list. Note, both + * run lists @dst and @src are deallocated before returning so you cannot use + * the pointers for anything any more. (Strictly speaking the returned run list + * may be the same as @dst but this is irrelevant.) + * + * On error, return NULL, with errno set to the error code. Both run lists are + * left unmodified. + */ +static __inline__ run_list_element *ntfs_rl_insert(run_list_element *dst, + int dsize, run_list_element *src, int ssize, int loc) +{ + BOOL left = FALSE; + BOOL disc = FALSE; /* Discontinuity */ + BOOL hole = FALSE; /* Following a hole */ + int magic; + + if (!dst || !src) { + Dputs("Eeek. ntfs_rl_insert() invoked with NULL pointer!"); + errno = EINVAL; + return NULL; + } + + /* disc => Discontinuity between the end of @dst and the start of @src. + * This means we might need to insert a hole. + * hole => @dst ends with a hole or an unmapped region which we can + * extend to match the discontinuity. */ + if (loc == 0) + disc = (src[0].vcn > 0); + else { + s64 merged_length; + + left = ntfs_are_rl_mergeable(dst + loc - 1, src); + + merged_length = dst[loc - 1].length; + if (left) + merged_length += src->length; + + disc = (src[0].vcn > dst[loc - 1].vcn + merged_length); + if (disc) + hole = (dst[loc - 1].lcn == LCN_HOLE); + } + + /* Space required: @dst size + @src size, less one if we merged, plus + * one if there was a discontinuity, less one for a trailing hole. */ + dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - left + disc - hole); + if (!dst) + return dst; + /* + * We are guaranteed to succeed from here so can start modifying the + * original run list. + */ + + if (left) + __ntfs_rl_merge(dst + loc - 1, src); + + /* FIXME: What does this mean? (AIA) */ + magic = loc + ssize - left + disc - hole; + + /* Move the tail of @dst out of the way, then copy in @src. */ + ntfs_rl_mm(dst, magic, loc, dsize - loc); + ntfs_rl_mc(dst, loc + disc - hole, src, left, ssize - left); + + /* Adjust the VCN of the last run ... */ + if (dst[magic].lcn <= LCN_HOLE) + dst[magic].vcn = dst[magic - 1].vcn + dst[magic - 1].length; + /* ... and the length. */ + if (dst[magic].lcn == LCN_HOLE || dst[magic].lcn == LCN_RL_NOT_MAPPED) + dst[magic].length = dst[magic + 1].vcn - dst[magic].vcn; + + /* Writing beyond the end of the file and there's a discontinuity. */ + if (disc) { + if (hole) + dst[loc - 1].length = dst[loc].vcn - dst[loc - 1].vcn; + else { + if (loc > 0) { + dst[loc].vcn = dst[loc - 1].vcn + + dst[loc - 1].length; + dst[loc].length = dst[loc + 1].vcn - + dst[loc].vcn; + } else { + dst[loc].vcn = 0; + dst[loc].length = dst[loc + 1].vcn; + } + dst[loc].lcn = LCN_RL_NOT_MAPPED; + } + + magic += hole; + + if (dst[magic].lcn == LCN_ENOENT) + dst[magic].vcn = dst[magic - 1].vcn + + dst[magic - 1].length; + } + return dst; +} + +/** + * Internal: + * + * ntfs_rl_replace - overwrite a run_list element with another run list + * @dst: original run list to be worked on + * @dsize: number of elements in @dst (including end marker) + * @src: new run list to be inserted + * @ssize: number of elements in @src (excluding end marker) + * @loc: index in run list @dst to overwrite with @src + * + * Replace the run list element @dst at @loc with @src. Merge the left and + * right ends of the inserted run list, if necessary. + * + * On success, return a pointer to the new, combined, run list. Note, both + * run lists @dst and @src are deallocated before returning so you cannot use + * the pointers for anything any more. (Strictly speaking the returned run list + * may be the same as @dst but this is irrelevant.) + * + * On error, return NULL, with errno set to the error code. Both run lists are + * left unmodified. + */ +static __inline__ run_list_element *ntfs_rl_replace(run_list_element *dst, + int dsize, run_list_element *src, int ssize, int loc) +{ + BOOL left = FALSE; + BOOL right; + int magic; + + if (!dst || !src) { + Dputs("Eeek. ntfs_rl_replace() invoked with NULL pointer!"); + errno = EINVAL; + return NULL; + } + + /* First, merge the left and right ends, if necessary. */ + right = ntfs_are_rl_mergeable(src + ssize - 1, dst + loc + 1); + if (loc > 0) + left = ntfs_are_rl_mergeable(dst + loc - 1, src); + + /* Allocate some space. We'll need less if the left, right, or both + * ends were merged. */ + dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - left - right); + if (!dst) + return dst; + /* + * We are guaranteed to succeed from here so can start modifying the + * original run lists. + */ + if (right) + __ntfs_rl_merge(src + ssize - 1, dst + loc + 1); + if (left) + __ntfs_rl_merge(dst + loc - 1, src); + + /* FIXME: What does this mean? (AIA) */ + magic = loc + ssize - left; + + /* Move the tail of @dst out of the way, then copy in @src. */ + ntfs_rl_mm(dst, magic, loc + right + 1, dsize - loc - right - 1); + ntfs_rl_mc(dst, loc, src, left, ssize - left); + + /* We may have changed the length of the file, so fix the end marker */ + if (dst[magic].lcn == LCN_ENOENT) + dst[magic].vcn = dst[magic - 1].vcn + dst[magic - 1].length; + return dst; +} + +/** + * Internal: + * + * ntfs_rl_split - insert a run list into the centre of a hole + * @dst: original run list to be worked on + * @dsize: number of elements in @dst (including end marker) + * @src: new run list to be inserted + * @ssize: number of elements in @src (excluding end marker) + * @loc: index in run list @dst at which to split and insert @src + * + * Split the run list @dst at @loc into two and insert @new in between the two + * fragments. No merging of run lists is necessary. Adjust the size of the + * holes either side. + * + * On success, return a pointer to the new, combined, run list. Note, both + * run lists @dst and @src are deallocated before returning so you cannot use + * the pointers for anything any more. (Strictly speaking the returned run list + * may be the same as @dst but this is irrelevant.) + * + * On error, return NULL, with errno set to the error code. Both run lists are + * left unmodified. + */ +static __inline__ run_list_element *ntfs_rl_split(run_list_element *dst, + int dsize, run_list_element *src, int ssize, int loc) +{ + if (!dst || !src) { + Dputs("Eeek. ntfs_rl_split() invoked with NULL pointer!"); + errno = EINVAL; + return NULL; + } + + /* Space required: @dst size + @src size + one new hole. */ + dst = ntfs_rl_realloc(dst, dsize, dsize + ssize + 1); + if (!dst) + return dst; + /* + * We are guaranteed to succeed from here so can start modifying the + * original run lists. + */ + + /* Move the tail of @dst out of the way, then copy in @src. */ + ntfs_rl_mm(dst, loc + 1 + ssize, loc, dsize - loc); + ntfs_rl_mc(dst, loc + 1, src, 0, ssize); + + /* Adjust the size of the holes either size of @src. */ + dst[loc].length = dst[loc+1].vcn - dst[loc].vcn; + dst[loc+ssize+1].vcn = dst[loc+ssize].vcn + dst[loc+ssize].length; + dst[loc+ssize+1].length = dst[loc+ssize+2].vcn - dst[loc+ssize+1].vcn; + + return dst; +} + + +/** + * ntfs_merge_run_lists - merge two run lists into one + * @drl: original run list to be worked on + * @srl: new run list to be merged into @drl + * + * First we sanity check the two run lists @srl and @drl to make sure that they + * are sensible and can be merged. The run list @srl must be either after the + * run list @drl or completely within a hole (or unmapped region) in @drl. + * + * Merging of run lists is necessary in two cases: + * 1. When attribute lists are used and a further extent is being mapped. + * 2. When new clusters are allocated to fill a hole or extend a file. + * + * There are four possible ways @srl can be merged. It can: + * - be inserted at the beginning of a hole, + * - split the hole in two and be inserted between the two fragments, + * - be appended at the end of a hole, or it can + * - replace the whole hole. + * It can also be appended to the end of the run list, which is just a variant + * of the insert case. + * + * On success, return a pointer to the new, combined, run list. Note, both + * run lists @drl and @srl are deallocated before returning so you cannot use + * the pointers for anything any more. (Strictly speaking the returned run list + * may be the same as @dst but this is irrelevant.) + * + * On error, return NULL, with errno set to the error code. Both run lists are + * left unmodified. The following error codes are defined: + * ENOMEM Not enough memory to allocate run list array. + * EINVAL Invalid parameters were passed in. + * ERANGE The run lists overlap and cannot be merged. + */ +run_list_element *ntfs_merge_run_lists(run_list_element *drl, + run_list_element *srl) +{ + int di, si; /* Current index into @[ds]rl. */ + int sstart; /* First index with lcn > LCN_RL_NOT_MAPPED. */ + int dins; /* Index into @drl at which to insert @srl. */ + int dend, send; /* Last index into @[ds]rl. */ + int dfinal, sfinal; /* The last index into @[ds]rl with + lcn >= LCN_HOLE. */ + int marker = 0; + VCN marker_vcn = 0; + + Dputs("dst:"); + ntfs_debug_dump_run_list(drl); + Dputs("src:"); + ntfs_debug_dump_run_list(srl); + + /* Check for silly calling... */ + if (!srl) + return drl; + + /* Check for the case where the first mapping is being done now. */ + if (!drl) { + drl = srl; + /* Complete the source run list if necessary. */ + if (drl[0].vcn) { + /* Scan to the end of the source run list. */ + for (dend = 0; drl[dend].length; dend++) + ; + drl = ntfs_rl_realloc(drl, dend, dend + 1); + if (!drl) + return drl; + /* Insert start element at the front of the run list. */ + ntfs_rl_mm(drl, 1, 0, dend); + drl[0].vcn = 0; + drl[0].lcn = LCN_RL_NOT_MAPPED; + drl[0].length = drl[1].vcn; + } + goto finished; + } + + si = di = 0; + + /* Skip any unmapped start element(s) in the source run list. */ + while (srl[si].length && srl[si].lcn < (LCN)LCN_HOLE) + si++; + + /* Can't have an entirely unmapped source run list. */ + if (!srl[si].length) { + Dputs("Eeek! ntfs_merge_run_lists() received entirely " + "unmapped source run list."); + errno = EINVAL; + return NULL; + } + + /* Record the starting points. */ + sstart = si; + + /* + * Skip forward in @drl until we reach the position where @srl needs to + * be inserted. If we reach the end of @drl, @srl just needs to be + * appended to @drl. + */ + for (; drl[di].length; di++) { + if (drl[di].vcn + drl[di].length > srl[sstart].vcn) + break; + } + dins = di; + + /* Sanity check for illegal overlaps. */ + if ((drl[di].vcn == srl[si].vcn) && (drl[di].lcn >= 0) && + (srl[si].lcn >= 0)) { + Dputs("Run lists overlap. Cannot merge!"); + errno = ERANGE; + return NULL; + } + + /* Scan to the end of both run lists in order to know their sizes. */ + for (send = si; srl[send].length; send++) + ; + for (dend = di; drl[dend].length; dend++) + ; + + if (srl[send].lcn == (LCN)LCN_ENOENT) + marker_vcn = srl[marker = send].vcn; + + /* Scan to the last element with lcn >= LCN_HOLE. */ + for (sfinal = send; sfinal >= 0 && srl[sfinal].lcn < LCN_HOLE; sfinal--) + ; + for (dfinal = dend; dfinal >= 0 && drl[dfinal].lcn < LCN_HOLE; dfinal--) + ; + + { + BOOL start; + BOOL finish; + int ds = dend + 1; /* Number of elements in drl & srl */ + int ss = sfinal - sstart + 1; + + start = ((drl[dins].lcn < LCN_RL_NOT_MAPPED) || /* End of file */ + (drl[dins].vcn == srl[sstart].vcn)); /* Start of hole */ + finish = ((drl[dins].lcn >= LCN_RL_NOT_MAPPED) && /* End of file */ + ((drl[dins].vcn + drl[dins].length) <= /* End of hole */ + (srl[send - 1].vcn + srl[send - 1].length))); + + /* Or we'll lose an end marker */ + if (start && finish && (drl[dins].length == 0)) + ss++; + if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn)) + finish = FALSE; +#ifdef DEBUG + Dprintf("dfinal = %i, dend = %i\n", dfinal, dend); + Dprintf("sstart = %i, sfinal = %i, send = %i\n", sstart, sfinal, send); + Dprintf("start = %i, finish = %i\n", start, finish); + Dprintf("ds = %i, ss = %i, dins = %i\n", ds, ss, dins); +#endif + if (start) { + if (finish) + drl = ntfs_rl_replace(drl, ds, srl + sstart, ss, dins); + else + drl = ntfs_rl_insert(drl, ds, srl + sstart, ss, dins); + } else { + if (finish) + drl = ntfs_rl_append(drl, ds, srl + sstart, ss, dins); + else + drl = ntfs_rl_split(drl, ds, srl + sstart, ss, dins); + } + if (!drl) { + Dprintf("%s(): Merge failed: %s\n", __FUNCTION__, + strerror(errno)); + return drl; + } + free(srl); + if (marker) { + Dputs("Triggering marker code."); + for (ds = dend; drl[ds].length; ds++) + ; + /* We only need to care if @srl ended after @drl. */ + if (drl[ds].vcn <= marker_vcn) { + int slots = 0; + + if (drl[ds].vcn == marker_vcn) { + Dprintf("Old marker = %Li, replacing with " + "LCN_ENOENT.\n", + (long long)drl[ds].lcn); + drl[ds].lcn = (LCN)LCN_ENOENT; + goto finished; + } + /* + * We need to create an unmapped run list element in + * @drl or extend an existing one before adding the + * ENOENT terminator. + */ + if (drl[ds].lcn == (LCN)LCN_ENOENT) { + ds--; + slots = 1; + } + if (drl[ds].lcn != (LCN)LCN_RL_NOT_MAPPED) { + /* Add an unmapped run list element. */ + if (!slots) { + /* FIXME/TODO: We need to have the + * extra memory already! (AIA) */ + drl = ntfs_rl_realloc(drl, ds, ds + 2); + if (!drl) + goto critical_error; + slots = 2; + } + ds++; + /* Need to set vcn if it isn't set already. */ + if (slots != 1) + drl[ds].vcn = drl[ds - 1].vcn + + drl[ds - 1].length; + drl[ds].lcn = (LCN)LCN_RL_NOT_MAPPED; + /* We now used up a slot. */ + slots--; + } + drl[ds].length = marker_vcn - drl[ds].vcn; + /* Finally add the ENOENT terminator. */ + ds++; + if (!slots) { + /* FIXME/TODO: We need to have the extra + * memory already! (AIA) */ + drl = ntfs_rl_realloc(drl, ds, ds + 1); + if (!drl) + goto critical_error; + } + drl[ds].vcn = marker_vcn; + drl[ds].lcn = (LCN)LCN_ENOENT; + drl[ds].length = (s64)0; + } + } + } + +finished: + /* The merge was completed successfully. */ + Dputs("Merged run list:"); + ntfs_debug_dump_run_list(drl); + return drl; + +critical_error: + /* Critical error! We cannot afford to fail here. */ + Dperror("libntfs: Critical error"); + Dputs("Forcing segmentation fault!"); + marker_vcn = ((run_list*)NULL)->lcn; + return drl; +} + +/** + * ntfs_decompress_mapping_pairs - convert mapping pairs array to run list + * @vol: ntfs volume on which the attribute resides + * @attr: attribute record whose mapping pairs array to decompress + * @old_rl: optional run list in which to insert @attr's run list + * + * Decompress the attribute @attr's mapping pairs array into a run list. On + * success, return the decompressed run list. + * + * If @old_rl is not NULL, decompressed run list is inserted into the + * appropriate place in @old_rl and the resultant, combined run list is + * returned. The original @old_rl is deallocated. + * + * On error, return NULL with errno set to the error code. @old_rl is left + * unmodified in that case. + * + * The following error codes are defined: + * ENOMEM Not enough memory to allocate run list array. + * EIO Corrupt run list. + * EINVAL Invalid parameters were passed in. + * ERANGE The two run lists overlap. + * + * FIXME: For now we take the conceptionally simplest approach of creating the + * new run list disregarding the already existing one and then splicing the + * two into one, if that is possible (we check for overlap and discard the new + * run list if overlap present before returning NULL, with errno = ERANGE). + */ +run_list_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, + const ATTR_RECORD *attr, run_list_element *old_rl) +{ + VCN vcn; /* Current vcn. */ + LCN lcn; /* Current lcn. */ + s64 deltaxcn; /* Change in [vl]cn. */ + run_list_element *rl; /* The output run list. */ + u8 *buf; /* Current position in mapping pairs array. */ + u8 *attr_end; /* End of attribute. */ + int rlsize; /* Size of run list buffer. */ + u16 rlpos; /* Current run list position in units of + run_list_elements. */ + u8 b; /* Current byte offset in buf. */ + + Dprintf("%s(): Entering for attr 0x%x.\n", __FUNCTION__, + le32_to_cpu(attr->type)); + /* Make sure attr exists and is non-resident. */ + if (!attr || !attr->non_resident || + sle64_to_cpu(attr->lowest_vcn) < (VCN)0) { + errno = EINVAL; + return NULL; + } + /* Start at vcn = lowest_vcn and lcn 0. */ + vcn = sle64_to_cpu(attr->lowest_vcn); + lcn = 0; + /* Get start of the mapping pairs array. */ + buf = (u8*)attr + le16_to_cpu(attr->mapping_pairs_offset); + attr_end = (u8*)attr + le32_to_cpu(attr->length); + if (buf < (u8*)attr || buf > attr_end) { + Dputs("Corrupt attribute."); + errno = EIO; + return NULL; + } + /* Current position in run list array. */ + rlpos = 0; + /* Allocate first 4kiB block and set current run list size to 4kiB. */ + rl = malloc(rlsize = 0x1000); + if (!rl) + return NULL; + /* Insert unmapped starting element if necessary. */ + if (vcn) { + rl->vcn = (VCN)0; + rl->lcn = (LCN)LCN_RL_NOT_MAPPED; + rl->length = vcn; + rlpos++; + } + while (buf < attr_end && *buf) { + /* + * Allocate more memory if needed, including space for the + * not-mapped and terminator elements. + */ + if (((rlpos + 3) * sizeof(*old_rl)) > rlsize) { + run_list_element *rl2; + + rlsize += 0x1000; + rl2 = realloc(rl, rlsize); + if (!rl2) { + int eo = errno; + free(rl); + errno = eo; + return NULL; + } + rl = rl2; + } + /* Enter the current vcn into the current run_list element. */ + rl[rlpos].vcn = vcn; + /* + * Get the change in vcn, i.e. the run length in clusters. + * Doing it this way ensures that we signextend negative values. + * A negative run length doesn't make any sense, but hey, I + * didn't make up the NTFS specs and Windows NT4 treats the run + * length as a signed value so that's how it is... + */ + b = *buf & 0xf; + if (b) { + if (buf + b > attr_end) + goto io_error; + for (deltaxcn = (s8)buf[b--]; b; b--) + deltaxcn = (deltaxcn << 8) + buf[b]; + } else { /* The length entry is compulsory. */ + Dputs("Missing length entry in mapping pairs array."); + deltaxcn = (s64)-1; + } + /* + * Assume a negative length to indicate data corruption and + * hence clean-up and return NULL. + */ + if (deltaxcn < 0) { + Dputs("Invalid length in mapping pairs array."); + goto err_out; + } + /* + * Enter the current run length into the current run list + * element. + */ + rl[rlpos].length = deltaxcn; + /* Increment the current vcn by the current run length. */ + vcn += deltaxcn; + /* + * There might be no lcn change at all, as is the case for + * sparse clusters on NTFS 3.0+, in which case we set the lcn + * to LCN_HOLE. + */ + if (!(*buf & 0xf0)) + rl[rlpos].lcn = (LCN)LCN_HOLE; + else { + /* Get the lcn change which really can be negative. */ + u8 b2 = *buf & 0xf; + b = b2 + ((*buf >> 4) & 0xf); + if (buf + b > attr_end) + goto io_error; + for (deltaxcn = (s8)buf[b--]; b > b2; b--) + deltaxcn = (deltaxcn << 8) + buf[b]; + /* Change the current lcn to it's new value. */ + lcn += deltaxcn; +#ifdef DEBUG + /* + * On NTFS 1.2-, apparently can have lcn == -1 to + * indicate a hole. But we haven't verified ourselves + * whether it is really the lcn or the deltaxcn that is + * -1. So if either is found give us a message so we + * can investigate it further! + */ + if (vol->major_ver < 3) { + if (deltaxcn == (LCN)-1) + Dputs("lcn delta == -1"); + if (lcn == (LCN)-1) + Dputs("lcn == -1"); + } +#endif + /* Check lcn is not below -1. */ + if (lcn < (LCN)-1) { + Dputs("Invalid LCN < -1 in mapping pairs " + "array."); + goto err_out; + } + /* Enter the current lcn into the run list element. */ + rl[rlpos].lcn = lcn; + } + /* Get to the next run list element. */ + rlpos++; + /* Increment the buffer position to the next mapping pair. */ + buf += (*buf & 0xf) + ((*buf >> 4) & 0xf) + 1; + } + if (buf >= attr_end) + goto io_error; + /* + * If there is a highest_vcn specified, it must be equal to the final + * vcn in the run list - 1, or something has gone badly wrong. + */ + deltaxcn = sle64_to_cpu(attr->highest_vcn); + if (deltaxcn && vcn - 1 != deltaxcn) { +mpa_err: + Dputs("Corrupt mapping pairs array in non-resident attribute."); + goto err_out; + } + /* Setup not mapped run list element if this is the base extent. */ + if (!attr->lowest_vcn) { + VCN max_cluster; + + max_cluster = (sle64_to_cpu(attr->allocated_size) + + vol->cluster_size - 1) >> + vol->cluster_size_bits; + /* + * If there is a difference between the highest_vcn and the + * highest cluster, the run list is either corrupt or, more + * likely, there are more extents following this one. + */ + if (deltaxcn < --max_cluster) { + Dprintf("More extents to follow; deltaxcn = 0x%Lx, " + "max_cluster = 0x%Lx\n", + (long long)deltaxcn, + (long long)max_cluster); + rl[rlpos].vcn = vcn; + vcn += rl[rlpos].length = max_cluster - deltaxcn; + rl[rlpos].lcn = (LCN)LCN_RL_NOT_MAPPED; + rlpos++; + } else if (deltaxcn > max_cluster) { + Dprintf("Corrupt attribute. deltaxcn = 0x%Lx, " + "max_cluster = 0x%Lx", + (long long)deltaxcn, + (long long)max_cluster); + goto mpa_err; + } + rl[rlpos].lcn = (LCN)LCN_ENOENT; + } else /* Not the base extent. There may be more extents to follow. */ + rl[rlpos].lcn = (LCN)LCN_RL_NOT_MAPPED; + + /* Setup terminating run_list element. */ + rl[rlpos].vcn = vcn; + rl[rlpos].length = (s64)0; + /* If no existing run list was specified, we are done. */ + if (!old_rl) { + Dputs("Mapping pairs array successfully decompressed:"); + ntfs_debug_dump_run_list(rl); + return rl; + } + /* Now combine the new and old run lists checking for overlaps. */ + old_rl = ntfs_merge_run_lists(old_rl, rl); + if (old_rl) + return old_rl; + free(rl); + Dputs("Failed to merge run lists."); + return NULL; +io_error: + Dputs("Corrupt attribute."); +err_out: + free(rl); + errno = EIO; + return NULL; +} + +/** + * ntfs_rl_vcn_to_lcn - convert a vcn into a lcn given a run list + * @rl: run list to use for conversion + * @vcn: vcn to convert + * + * Convert the virtual cluster number @vcn of an attribute into a logical + * cluster number (lcn) of a device using the run list @rl to map vcns to their + * corresponding lcns. + * + * Since lcns must be >= 0, we use negative return values with special meaning: + * + * Return value Meaning / Description + * ================================================== + * -1 = LCN_HOLE Hole / not allocated on disk. + * -2 = LCN_RL_NOT_MAPPED This is part of the run list which has not been + * inserted into the run list yet. + * -3 = LCN_ENOENT There is no such vcn in the attribute. + * -4 = LCN_EINVAL Input parameter error. + */ +LCN ntfs_rl_vcn_to_lcn(const run_list_element *rl, const VCN vcn) +{ + int i; + + if (vcn < (VCN)0) + return (LCN)LCN_EINVAL; + /* + * If rl is NULL, assume that we have found an unmapped run list. The + * caller can then attempt to map it and fail appropriately if + * necessary. + */ + if (!rl) + return (LCN)LCN_RL_NOT_MAPPED; + + /* Catch out of lower bounds vcn. */ + if (vcn < rl[0].vcn) + return (LCN)LCN_ENOENT; + + for (i = 0; rl[i].length; i++) { + if (vcn < rl[i+1].vcn) { + if (rl[i].lcn >= (LCN)0) + return rl[i].lcn + (vcn - rl[i].vcn); + return rl[i].lcn; + } + } + /* + * The terminator element is setup to the correct value, i.e. one of + * LCN_HOLE, LCN_RL_NOT_MAPPED, or LCN_ENOENT. + */ + if (rl[i].lcn < (LCN)0) + return rl[i].lcn; + /* Just in case... We could replace this with BUG() some day. */ + return (LCN)LCN_ENOENT; +} + +/** + * ntfs_rl_pwrite - scatter write to disk + * @vol: ntfs volume to write to + * @rl: run list specifying where to write the data to + * @pos: byte position within run list @rl at which to begin the write + * @count: number of bytes to write + * @b: data buffer to write to disk + * + * This function will write @count bytes from data buffer @b to the volume @vol + * scattering the data as specified by the run list @rl. The write begins at + * offset @pos into the run list @rl. + * + * On success, return the number of successfully written bytes. If this number + * is lower than @count this means that the write has been interrupted in + * flight or that an error was encountered during the write so that the write + * is partial. 0 means nothing was written (also return 0 when @count is 0). + * + * On error and nothing has been written, return -1 with errno set + * appropriately to the return code of either lseek, write, fdatasync, or set + * to EINVAL in case of invalid arguments. + */ +s64 ntfs_rl_pwrite(const ntfs_volume *vol, const run_list_element *rl, + const s64 pos, s64 count, void *b) +{ + s64 written, to_write, ofs, total; + int f, err = EIO; + + if (!vol || !rl || pos < 0 || count < 0) { + errno = EINVAL; + return -1; + } + f = vol->fd; + if (!f) { + errno = EBADF; + return -1; + } + if (!count) + return count; + /* Seek in @rl to the run containing @pos. */ + for (ofs = 0; rl->length && (ofs + rl->length <= pos); rl++) + ofs += rl->length; + /* Offset in the run at which to begin writing. */ + ofs = pos - ofs; + for (total = 0LL; count; rl++, ofs = 0) { + if (!rl->length) + goto rl_err_out; + if (rl->lcn < (LCN) 0) { + s64 t; + int cnt; + + if (rl->lcn != (LCN)LCN_HOLE) + goto rl_err_out; + /* + * It is a hole. Check if the buffer is zero in this + * region and if not abort with error. + */ + to_write = min(count, (rl->length << + vol->cluster_size_bits) - ofs); + written = to_write / sizeof(unsigned long); + for (t = 0; t < written; t++) { + if (((unsigned long*)b)[t]) + goto rl_err_out; + } + cnt = to_write & (sizeof(unsigned long) - 1); + if (cnt) { + int i; + u8 *b2; + + b2 = b + (to_write & + ~(sizeof(unsigned long) - 1)); + for (i = 0; i < cnt; i++) { + if (b2[i]) + goto rl_err_out; + } + } + /* + * The buffer region is zero, update progress counters + * and proceed with next run. + */ + total += to_write; + count -= to_write; + b += to_write; + continue; + } + /* It is a real lcn, write it to the volume. */ + to_write = min(count, (rl->length << vol->cluster_size_bits) - + ofs); +retry: + written = ntfs_pwrite(f, (rl->lcn << vol->cluster_size_bits) + + ofs, to_write, b); + /* If everything ok, update progress counters and continue. */ + if (written > 0) { + total += written; + count -= written; + b += written; + continue; + } + /* If the syscall was interrupted, try again. */ + if (written == (s64)-1 && errno == EINTR) + goto retry; + if (written == -1) + err = errno; + goto rl_err_out; + } + /* Finally, return the number of bytes written. */ + return total; +rl_err_out: + if (total) + return total; + errno = err; + return -1; +} + +/** + * ntfs_build_mapping_pairs - build the mapping pairs array from a run list + * @vol: ntfs volume (needed for the ntfs version) + * @dst: destination buffer to which to write the mapping pairs array + * @dst_len: size of destination buffer @dst in bytes + * @rl: run list for which to build the mapping pairs array + * + * Create the mapping pairs array from the run list @rl and save the array in + * @dst. @dst_len is the size of @dst in bytes and it should be at least equal + * to the value obtained by calling ntfs_get_size_for_mapping_pairs(@rl). + * + * Return 0 on success or when @rl is NULL. On error, return -1 with errno set + * to the error code. The following error codes are defined: + * EINVAL - Run list contains unmapped elements. Make sure to only pass + * fully mapped run lists to this function. + * EIO - The run list is corrupt. + * ENOSPC - The destination buffer is too small. + */ +int ntfs_build_mapping_pairs(const ntfs_volume *vol, s8 *dst, + const int dst_len, const run_list_element *rl) +{ + LCN prev_lcn; + s8 *dst_max; + int i; + s8 len_len, lcn_len; + + if (!rl) + return 0; + /* + * @dst_max is used for bounds checking in + * ntfs_write_significant_bytes(). + */ + dst_max = dst + dst_len - 1; + for (prev_lcn = i = 0; rl[i].length; prev_lcn = rl[++i].lcn) { + if (rl[i].length < 0 || rl[i].lcn < LCN_HOLE) + goto err_out; + /* Write length. */ + len_len = ntfs_write_significant_bytes(dst + 1, dst_max, + rl[i].length); + if (len_len < 0) + goto size_err; + /* + * If the logical cluster number (lcn) denotes a hole and we + * are on NTFS 3.0+, we don't store it at all, i.e. we need + * zero space. On earlier NTFS versions we just write the lcn + * change. FIXME: Do we need to write the lcn change or just + * the lcn in that case? Not sure as I have never seen this + * case on NT4. (AIA) + */ + if (rl[i].lcn != LCN_HOLE || vol->major_ver < 3) { + lcn_len = ntfs_write_significant_bytes(dst + 1 + + len_len, dst_max, rl[i].lcn - prev_lcn); + if (lcn_len < 0) + goto size_err; + } else + lcn_len = 0; + /* Update header byte. */ + *dst = lcn_len << 4 | len_len; + /* Position ourselves at next mapping pairs array element. */ + dst += 1 + len_len + lcn_len; + } + if (dst <= dst_max) { + /* Terminator byte. */ + *dst = 0; + return 0; + } +size_err: + errno = ENOSPC; + return -1; +err_out: + if (rl[i].lcn == LCN_RL_NOT_MAPPED) + errno = EINVAL; + else + errno = EIO; + return -1; +} + + + From 8c7233a354142f108a21164bb4d78580d40b6ffd Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0071/2994] whitespace and include guards 2001/01/23 16:35:04-00:00 !antona Added my templates for new source and include files. (Logical change 1.5) --- doc/template.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/doc/template.h b/doc/template.h index e69de29b..286dc1d2 100644 --- a/doc/template.h +++ b/doc/template.h @@ -0,0 +1,26 @@ +/* + * NAME.h - Description. Part of the Linux-NTFS project. + * + * Copyright (c) 2000,2001 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef NTFS_NAME_H +#define NTFS_NAME_H + +#endif /* defined NTFS_NAME_H */ + From c23679552d08e385e20cc70d7077ae4d2cf04b98 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0072/2994] whitespace and include guards 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2001/12/15 05:13:08-00:00 !antona Remove atomic ops and add compiler version check. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/03/26 03:42:13-00:00 !antona Forgot to add the new support.h (Logical change 1.5) --- include/support.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/include/support.h b/include/support.h index e69de29b..728b4b58 100644 --- a/include/support.h +++ b/include/support.h @@ -0,0 +1,57 @@ +/* + * $Id$ + * + * support.h - Useful definitions and macros. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_SUPPORT_H +#define _NTFS_SUPPORT_H + +#include + +/* + * Generic macro to convert pointers to values for comparison purposes. + */ +#ifndef p2n +#define p2n(p) ((ptrdiff_t)((ptrdiff_t*)(p))) +#endif + +/* + * The classical min and max macros. + */ +#ifndef min +#define min(a,b) ((a) <= (b) ? (a) : (b)) +#endif + +#ifndef max +#define max(a,b) ((a) >= (b) ? (a) : (b)) +#endif + +/* + * Simple bit operation macros. + */ +#define test_bit(bit, var) ((var) & (1 << (bit))) +#define set_bit(bit, var) (var) |= 1 << (bit) +#define clear_bit(bit, var) (var) &= ~(1 << (bit)) +#define test_and_set_bit(bit, var) (test_bit(bit, var), set_bit(bit, var)) +#define test_and_clear_bit(bit, var) (test_bit(bit, var), clear_bit(bit, var)) + +#endif /* defined _NTFS_SUPPORT_H */ + From 5308ab00ab57f948fd1e748cd0a1fb48f5b1e1dc Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0073/2994] whitespace and include guards 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/15 20:04:25-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2002/04/12 15:24:30-00:00 !antona Forgot to add the debug header file! (Logical change 1.5) --- include/debug.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/include/debug.h b/include/debug.h index e69de29b..592771cb 100644 --- a/include/debug.h +++ b/include/debug.h @@ -0,0 +1,80 @@ +/* + * $Id$ + * + * debug.h - Debugging output functions. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_DEBUG_H +#define _NTFS_DEBUG_H + +#include "attrib.h" + +#ifdef DEBUG + +#include "config.h" + +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDARG_H +# include +#endif +#include + +/* Debug output to stderr. To get it run ./configure --enable-debug. */ + +static __inline__ void Dprintf(const char *fmt, ...) +{ + int eo = errno; + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + errno = eo; +} + +static __inline__ void Dputs(const char *s) +{ + int eo = errno; + fprintf(stderr, "%s\n", s); + errno = eo; +} + +static __inline__ void Dperror(const char *s) +{ + int eo = errno; + perror(s); + errno = eo; +} + +extern void ntfs_debug_dump_run_list(const run_list_element *rl); + +#else + +static __inline__ void Dprintf(const char *fmt, ...) {} +static __inline__ void Dputs(const char *s) {} +static __inline__ void Dperror(const char *s) {} +static __inline__ void ntfs_debug_dump_run_list(const run_list_element *rl) {} + +#endif + +#endif /* defined _NTFS_DEBUG_H */ + From fb83c257dfa6d1d4f3d41456a99ae4163bdff9c6 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0074/2994] whitespace and include guards 2002/06/30 17:01:53-00:00 !flatcap added list_for_each_safe removed pos->next (a prefetch), was confusing compiler 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 15:48:20-00:00 !antona Fixed headers 2001/04/10 23:43:10-00:00 !antona forgot list.h (Logical change 1.5) --- include/list.h | 186 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+) diff --git a/include/list.h b/include/list.h index e69de29b..ef1d1cc4 100644 --- a/include/list.h +++ b/include/list.h @@ -0,0 +1,186 @@ +/* + * $Id$ + * + * list.h - Linked list implementation. Part of the Linux-NTFS project. + * + * Copyright (c) + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_LIST_H +#define _NTFS_LIST_H + +/* + * Simple doubly linked list implementation. - Copied from Linux kernel + * 2.4.2-ac18 into Linux-NTFS (with minor modifications). - AIA + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know the prev/next + * entries already! + */ +static __inline__ void __list_add(struct list_head * new, + struct list_head * prev, struct list_head * next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static __inline__ void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static __inline__ void list_add_tail(struct list_head *new, struct list_head *head) +{ + __list_add(new, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries point to each other. + * + * This is only for internal list manipulation where we know the prev/next + * entries already! + */ +static __inline__ void __list_del(struct list_head * prev, + struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * + * Note: list_empty on entry does not return true after this, the entry is in + * an undefined state. + */ +static __inline__ void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static __inline__ void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static __inline__ int list_empty(struct list_head *head) +{ + return head->next == head; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static __inline__ void list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + + if (first != list) { + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +#endif /* defined _NTFS_LIST_H */ + From 6e16c5a1ad342a623d8702267ae4319c9ef8d0a3 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0075/2994] whitespace and include guards 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/04/14 15:26:23-00:00 !antona Remove find_first_attr and make all users use get_attr_search_ctx + find_attr instead. 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/10 22:20:19-00:00 !antona Ok, ntfsd was a mistake for userspace. It increases complexity no end while not giving us much functionality. Lets get it working and then worry about the kernel. - As it was the idea originally anyway, so this is just a return on the right track. (-8 We keep the timer and signal handler but the only thing we do is to set a bool flag (ntfs_need_sync) and we will just check this in appropriate places and if it is true we call ntfs_sync_volumes() which sets it back to false. This means no more locking at all of any description and no need to worry about the signal handler interrupting things in bad ways and/or at bad times in the main code. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/04/05 20:14:45-00:00 !antona Commit of current state of development including locking a la kernel. This doesn't work on user space (semaphores don't work). Just want to have it committed. Will take out locking / modify it where necessary to use pthreads ASAP. 2001/04/03 22:41:30-00:00 !antona We now have files and keep track of them on a per volume basis and same for inodes (mft_records). At least conceptually anyway. 2001/01/25 22:25:43-00:00 !antona More files added to ntfs lib. Fixed some consistency problems. 2001/01/24 15:01:18-00:00 !antona Added bitmap header. (Logical change 1.5) --- include/bitmap.h | 105 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/include/bitmap.h b/include/bitmap.h index e69de29b..0da0c107 100644 --- a/include/bitmap.h +++ b/include/bitmap.h @@ -0,0 +1,105 @@ +/* + * $Id$ + * + * bitmap.h - Exports for bitmap handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_BITMAP_H +#define _NTFS_BITMAP_H + +#include "types.h" + +/* + * NOTES: + * + * - Operations are 8-bit only to ensure the functions work both on little + * and big endian machines! So don't make them 32-bit ops! + * - bitmap starts at bit = 0 and ends at bit = bitmap size - 1. + * - _Caller_ has to make sure that the bit to operate on is less than the + * size of the bitmap. + */ + +/** + * ntfs_set_bit - set a bit in a field of bits + * @bitmap: field of bits + * @bit: bit to set + * @new_value: value to set bit to (0 or 1) + * + * Set the bit @bit in the @bitmap to @new_value. Ignore all errors. + */ +static __inline__ void ntfs_set_bit(u8 *bitmap, const u64 bit, + const u8 new_value) +{ +// Dprintf("bitmap %p, bit 0x%Lx, new_value %i\n", bitmap, bit, new_value); + if (!bitmap || new_value > 1) + return; + if (!new_value) + bitmap[bit >> 3] &= ~(1 << (bit & 7)); + else + bitmap[bit >> 3] |= (1 << (bit & 7)); +} + +/** + * ntfs_get_bit - get value of a bit in a field of bits + * @bitmap: field of bits + * @bit: bit to get + * + * Get and return the value of the bit @bit in @bitmap (0 or 1). + * Return -1 on error. + */ +static __inline__ char ntfs_get_bit(const u8 *bitmap, const u64 bit) +{ + if (!bitmap) + return -1; + return (bitmap[bit >> 3] >> (bit & 7)) & 1; +} + +static __inline__ void ntfs_change_bit(u8 *bitmap, const u64 bit) +{ + if (!bitmap) + return; + bitmap[bit >> 3] ^= 1 << (bit & 7); +} + +/** + * ntfs_get_and_set_bit - get value of a bit in a field of bits and set it + * @bitmap: field of bits + * @bit: bit to get/set + * @new_value: value to set bit to (0 or 1) + * + * Return the value of the bit @bit and set it to @new_value (0 or 1). + * Return -1 on error. + */ +static __inline__ char ntfs_get_and_set_bit(u8 *bitmap, const u64 bit, + const u8 new_value) +{ + register u8 old_bit, shift; + + if (!bitmap || new_value > 1) + return -1; + shift = bit & 7; + old_bit = (bitmap[bit >> 3] >> shift) & 1; + if (new_value != old_bit) + bitmap[bit >> 3] ^= 1 << shift; + return old_bit; +} + +#endif /* defined _NTFS_BITMAP_H */ + From 04ca1e570c8d118c5580addba432f7202ad542f9 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0076/2994] whitespace and include guards 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2001/11/09 19:24:23-00:00 !antona With lots of luck this is going to be 1.2.3. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/01/24 02:13:24-00:00 !antona Add a bunch of headers (attrib.h is work in progress). (Logical change 1.5) --- include/endians.h | 92 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/include/endians.h b/include/endians.h index e69de29b..a749e7cc 100644 --- a/include/endians.h +++ b/include/endians.h @@ -0,0 +1,92 @@ +/* + * $Id$ + * + * endians.h - Definitions related to handling of byte ordering. Part of the + * Linux-NTFS project. + * + * Copyright (c) 2000,2001 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_ENDIANS_H +#define _NTFS_ENDIANS_H + +/* + * Notes: + * + * We define the conversion functions including typecasts since the + * defaults don't necessarily perform appropriate typecasts. + * Also, using our own functions means that we can change them if it + * turns out that we do need to use the unaligned access macros on + * architectures requirering aligned memory accesses... + */ + +#include + +/* Unsigned from LE to CPU conversion. */ + +#define le16_to_cpu(x) (u16)__le16_to_cpu((u16)(x)) +#define le32_to_cpu(x) (u32)__le32_to_cpu((u32)(x)) +#define le64_to_cpu(x) (u64)__le64_to_cpu((u64)(x)) + +#define le16_to_cpup(x) (u16)__le16_to_cpu(*(u16*)(x)) +#define le32_to_cpup(x) (u32)__le32_to_cpu(*(u32*)(x)) +#define le64_to_cpup(x) (u64)__le64_to_cpu(*(u64*)(x)) + +/* Signed from LE to CPU conversion. */ + +#define sle16_to_cpu(x) (s16)__le16_to_cpu((s16)(x)) +#define sle32_to_cpu(x) (s32)__le32_to_cpu((s32)(x)) +#define sle64_to_cpu(x) (s64)__le64_to_cpu((s64)(x)) + +#define sle16_to_cpup(x) (s16)__le16_to_cpu(*(s16*)(x)) +#define sle32_to_cpup(x) (s32)__le32_to_cpu(*(s32*)(x)) +#define sle64_to_cpup(x) (s64)__le64_to_cpu(*(s64*)(x)) + +/* Unsigned from CPU to LE conversion. */ + +#define cpu_to_le16(x) (u16)__cpu_to_le16((u16)(x)) +#define cpu_to_le32(x) (u32)__cpu_to_le32((u32)(x)) +#define cpu_to_le64(x) (u64)__cpu_to_le64((u64)(x)) + +#define cpu_to_le16p(x) (u16)__cpu_to_le16(*(u16*)(x)) +#define cpu_to_le32p(x) (u32)__cpu_to_le32(*(u32*)(x)) +#define cpu_to_le64p(x) (u64)__cpu_to_le64(*(u64*)(x)) + +/* Signed from CPU to LE conversion. */ + +#define scpu_to_le16(x) (s16)__cpu_to_le16((s16)(x)) +#define scpu_to_le32(x) (s32)__cpu_to_le32((s32)(x)) +#define scpu_to_le64(x) (s64)__cpu_to_le64((s64)(x)) + +#define scpu_to_le16p(x) (s16)__cpu_to_le16(*(s16*)(x)) +#define scpu_to_le32p(x) (s32)__cpu_to_le32(*(s32*)(x)) +#define scpu_to_le64p(x) (s64)__cpu_to_le64(*(s64*)(x)) + +/* + * Constant endianness conversion defines. + */ +#define const_le16_to_cpu(x) __constant_le16_to_cpu(x) +#define const_le32_to_cpu(x) __constant_le32_to_cpu(x) +#define const_le64_to_cpu(x) __constant_le64_to_cpu(x) + +#define const_cpu_to_le16(x) __constant_cpu_to_le16(x) +#define const_cpu_to_le32(x) __constant_cpu_to_le32(x) +#define const_cpu_to_le64(x) __constant_cpu_to_le64(x) + +#endif /* defined _NTFS_ENDIANS_H */ + From c9180f848e9c2d81d487c4cad82288255a143a0c Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0077/2994] whitespace and include guards 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/01/26 03:21:07-00:00 !antona Preparations for 1.5.1 release. 2002/01/26 02:42:13-00:00 !antona Compilation fixes for odd architectures. Had forgotten logfile.h. Damn... 2001/06/16 00:06:17-00:00 !antona dumplog now decodes the first 0x5000 bytes of the logfile given on the command line as fully as possible with the current knowledge of the logfile structures. 2001/06/15 16:47:46-00:00 !antona Integrate logfile.c into mkntfs 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 11:49:16-00:00 !antona Header file reorganisation so that it compiles. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/03/05 03:15:08-00:00 !antona Forgot a few... 2001/03/02 15:03:56-00:00 !antona Update to latest include files. 2001/01/27 14:22:02-00:00 !antona Added a logfile dumper as a new utility. Almost finished the first ntfsfix release. (Still missingin CVS are attrib.c for ntfslib and the makefiles to build everything.) Fixes for nested packed structure/union typedefs as gcc doesn't automatically nest the __attribute__ ((__packed__)), even though according to the gcc info page it does. (Thanks to Yuri Per for pointing this out.) 2001/01/24 21:02:37-00:00 !antona Added ntfsfix program. 2001/01/24 10:30:49-00:00 !antona The initial log file on disk structures (work in progress). (Logical change 1.5) --- include/logfile.h | 243 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 243 insertions(+) diff --git a/include/logfile.h b/include/logfile.h index e69de29b..587a5979 100644 --- a/include/logfile.h +++ b/include/logfile.h @@ -0,0 +1,243 @@ +/* + * $Id$ + * + * logfile.h - Exports for $LogFile handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2000,2001 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_LOGFILE_H +#define _NTFS_LOGFILE_H + +#include "types.h" + +typedef enum { + magic_RSTR = const_cpu_to_le32(0x52545352), /* "RSTR", restart area */ + magic_RCRD = const_cpu_to_le32(0x44524352), /* "RCRD", log record */ +} LOG_FILE_RECORD_TYPES; + +/* + * Specialised magic comparison macros. + */ +#define is_rstr_record(x) ( is_magic (x, RSTR) ) +#define is_rstr_recordp(p) ( is_magicp(p, RSTR) ) +#define is_rcrd_record(x) ( is_magic (x, RCRD) ) +#define is_rcrd_recordp(p) ( is_magicp(p, RCRD) ) + +/* + * Log file organization: + * Two restart areas present in the first two pages (restart pages). When + * the volume is unmounted they should be identical. + * These are followed by log records organized in pages headed by a record + * header going up to log file size. Not all pages contain log records when a + * volume is first formatted, but as the volume ages, all records will be used. + * When the log file fills up, the records at the beginning are purged (by + * modifying the oldest_lsn to a higher value presumably) and writing begins + * at the beginning of the file. Effectively, the log file is viewed as a + * circular entity. + */ + +/* + * Log file restart page header (begins the restart area). + */ +typedef struct { + NTFS_RECORD; /* The magic is "RSTR". */ + u64 chkdsk_lsn; /* The check disk log file sequence number for + this restart page. Only used when the + magic is changed to "CHKD". = 0 */ + u32 system_page_size; /* Byte size of system pages, has to be >= 512 + and a power of 2. Use this to calculate the + required size of the usa and add this to the + ntfs.usa_offset value. Then verify that the + result is less than the value of the + restart_offset. = 0x1000 */ + u32 log_page_size; /* Byte size of log file records, has to be + >= 512 and a power of 2. = 0x1000 */ + u16 restart_offset; /* Byte offset from the start of the record to + the restart record. Value has to be aligned + to 8-byte boundary. = 0x30 */ + s16 minor_ver; /* Log file minor version. Only check if major + version is 1. (=1 but >=1 is treated the + same and <=0 is also ok) */ + u16 major_ver; /* Log file major version (=1 but =0 is ok) */ +} __attribute__ ((__packed__)) RESTART_PAGE_HEADER; + +/* + * Log file restart area record. The offset of this record is found by adding + * the offset of the RESTART_PAGE_HEADER to the restart_offset value found in + * it. + */ +typedef struct { + u64 current_lsn; /* Log file record. = 0x700000, 0x700808 */ + u16 log_clients; /* Number of log client records following + the restart_area. = 1 */ + s16 client_free_list; /* How many clients are free(?). If != 0xffff, + check that log_clients > client_free_list. + = 0xffff */ + s16 client_in_use_list;/* How many clients are in use(?). If != 0xffff + check that log_clients > client_in_use_list. + = 0 */ + u16 flags; /* ??? = 0 */ + u32 seq_number_bits; /* ??? = 0x2c or 0x2d */ + u16 restart_area_length;/* Length of the restart area. Following + checks required if version matches. + Otherwise, skip them. restart_offset + + restart_area_length has to be <= + system_page_size. Also, restart_area_length + has to be >= client_array_offset + + (log_clients * 0xa0). = 0xd0 */ + u16 client_array_offset;/* Offset from the start of this record to + the first client record if versions are + matched. The offset is otherwise assumed to + be (sizeof(RESTART_AREA) + 7) & ~7, i.e. + rounded up to first 8-byte boundary. Either + way, the offset to the client array has to be + aligned to an 8-byte boundary. Also, + restart_offset + offset to the client array + have to be <= 510. Also, the offset to the + client array + (log_clients * 0xa0) have to + be <= SystemPageSize. = 0x30 */ + u64 file_size; /* Byte size of the log file. If the + restart_offset + the offset of the file_size + are > 510 then corruption has occured. This + is the very first check when starting with + the restart_area as if it fails it means + that some of the above values will be + corrupted by the multi sector transfer + protection! If the structure is deprotected + then these checks are futile of course. + Calculate the file_size bits and check that + seq_number_bits == 0x43 - file_size bits. + = 0x400000 */ + u32 last_lsn_data_length;/* ??? = 0, 0x40 */ + u16 record_length; /* Byte size of this record. If the version + matches then check that the value of + record_length is a multiple of 8, i.e. + (record_length + 7) & ~7 == record_length. + = 0x30 */ + u16 log_page_data_offset;/* ??? = 0x40 */ + /* + * There are eight bytes here at offset 0x58, which contain a value, + * which we don't know what it means. It looks like it could be a + * 64-bit number or a 32-bit plus something else (the second 32-bits + * are zero so can't tell). Have to try to zero it and see if Windows + * copes with this. + */ +} __attribute__ ((__packed__)) RESTART_AREA; + +/* + * Log file restart client. The offset of this record is found by adding + * the offset of the RESTART_AREA to the client_array_offset value found in it. + */ +typedef struct { + u64 oldest_lsn; /* Oldest log file sequence number for this + client record. */ + u64 client_restart_lsn; /* Log file sequence number at which to + restart the volume, i.e. the current + position within the logfile. */ + s16 prev_client; /* ??? = 0xffff */ + s16 next_client; /* ??? = 0xffff */ + u64 seq_number; /* ??? = 1, size uncertain, Regis calls this + "volume clear flag" and gives a size of one + byte. */ + u32 client_name_length; /* ??? length of client name in bytes. = 8, + size uncertain, offset uncertain */ + uchar_t client_name[0]; /* ??? Name of the client in unicode. = NTFS */ + /* + * Or it could be the client name is fixed size like in attr def struct + * and the 8 means something else. Favouring this is that the + * RESTART_CLIENT struct is assumed to be fixed size of 0xa0 bytes, + * just like the attr def struct! There might be parallels to be drawn + * between the two. + */ +} __attribute__ ((__packed__)) RESTART_CLIENT; + +/* + * Log page record page header. Each log page begins with this header and is + * followed by several LOG_RECORD structures, starting at offset 0x40 (the + * size of this structure and the following update sequence array and then + * aligned to 8 byte boundary, but is this specified anywhere?). + */ +typedef struct { + NTFS_RECORD; /* The magic is "RCRD". */ + union { + u64 last_lsn; + u32 file_offset; + } __attribute__ ((__packed__)) copy; + u32 flags; + u16 page_count; + u16 page_position; + union { + struct { + u64 next_record_offset; + u64 last_end_lsn; + } __attribute__ ((__packed__)) packed; + } __attribute__ ((__packed__)) header; +} __attribute__ ((__packed__)) RECORD_PAGE_HEADER; + +/* + * Possible flags for log records. + */ +typedef enum { + LOG_RECORD_MULTI_PAGE = const_cpu_to_le16(0x0001), /* ??? */ + LOG_RECORD_SIZE_PLACE_HOLDER = 0xffff, + /* This has nothing to do with the log record. It is only so + gcc knows to make the flags 16-bit. */ +} __attribute__ ((__packed__)) LOG_RECORD_FLAGS; + +/* + * Log record header. Each log record seems to have a constant size of 0x70 + * bytes. + */ +typedef struct { + u64 this_lsn; + u64 client_previous_lsn; + u64 client_undo_next_lsn; + u32 client_data_length; + struct { + u16 seq_number; + u16 client_index; + } __attribute__ ((__packed__)) client_id; + u32 record_type; + u32 transaction_id; + LOG_RECORD_FLAGS flags; + u16 reserved_or_alignment[3]; +/* Now are at ofs 0x30 into struct. */ + u16 redo_operation; + u16 undo_operation; + u16 redo_offset; + u16 redo_length; + u16 undo_offset; + u16 undo_length; + u16 target_attribute; + u16 lcns_to_follow; /* Number of lcn_list entries + following this entry. */ +/* Now at ofs 0x40. */ + u16 record_offset; + u16 attribute_offset; + u32 alignment_or_reserved; + s64 target_vcn; +/* Now at ofs 0x50. */ + struct { /* Only present if lcns_to_follow + is not 0. */ + s64 lcn; + } __attribute__((__packed__)) lcn_list[0]; +} __attribute__ ((__packed__)) LOG_RECORD; + +#endif /* defined _NTFS_LOGFILE_H */ + From 10a361fafa5e499c06f433bc6b0e88f47086e950 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0078/2994] whitespace and include guards 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/20 01:53:02-00:00 !antona Rename mft code adding ntfs_ prefix. Change all return values to zero on success. Thanks to mattjf for pointing out the inconsistencies. 2002/04/19 21:09:55-00:00 !antona Finished provisional inode.c::ntfs_{open,close}_inode() functions. Also, started defining API provided by attrib.[ch], so far only done search context related stuff. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; (Logical change 1.5) --- libntfs/attrib_RE.c | 449 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 449 insertions(+) diff --git a/libntfs/attrib_RE.c b/libntfs/attrib_RE.c index e69de29b..af74290a 100644 --- a/libntfs/attrib_RE.c +++ b/libntfs/attrib_RE.c @@ -0,0 +1,449 @@ +/* Reverse engineered functions in more or less modified form. find_attr() + * is quite heavily modified but should be functionally equivalent to original. + * lookup and lookup_external are less modified. Both should be functionally + * equivalent to originals. */ + +/* + * attr_search_context - used in attribute search functions + * @mrec: buffer containing mft record to search + * @attr: attribute record in @mrec where to begin/continue search + * @alist_mrec: mft record containing attribute list (i.e. base mft record) + * @alist_attr: attribute list attribute record + * @alist_val: attribute list value (if alist is resident in @alist_mrec) + * @alist_val_end: end of attribute list value + 1 + * @alist_val_len: length of attribute list in bytes + * @is_first: if true lookup_attr() begins search with @attr, else after @attr + * + * Structure must be initialized to zero before the first call to one of the + * attribute search functions. If the mft record in which to search has already + * been loaded into memory, then initialize @base and @mrec to point to it, + * @attr to point to the first attribute within @mrec, and set @is_first to + * TRUE. + * + * @is_first is only honoured in lookup_attr() and only when called with @mrec + * not NULL. Then, if @is_first is TRUE, lookup_attr() begins the search with + * @attr. If @is_first is FALSE, lookup_attr() begins the search after @attr. + * This is so that, after the first call to lookup_attr(), we can call + * lookup_attr() again, without any modification of the search context, to + * automagically get the next matching attribute. + * + * In contrast, find_attr() ignores @is_first and always begins the search with + * @attr. find_attr() shouldn't really be called directly; it is just for + * internal use. FIXME: Might want to change this behaviour later, but not + * before I am finished with lookup_external_attr(). (AIA) + */ +typedef struct { + u8 *base; + MFT_RECORD *mrec; + ATTR_RECORD *attr; + + u8 *alist_val_base; + MFT_RECORD *alist_mrec; + ATTR_RECORD *alist_attr; + ATTR_LIST_ENTRY *alist_val; + ATTR_LIST_ENTRY *alist_val_end; + u32 alist_val_len; + IS_FIRST_BOOL is_first; + u8 *alist_old_base; +} attr_search_context; + +BOOL find_attr(const ntfs_volume *vol, const ATTR_TYPES type, + const wchar_t *name, const u32 name_len, + const IGNORE_CASE_BOOL ic, const u8 *val, const u32 val_len, + ntfs_attr_search_ctx *ctx) +{ + ATTR_RECORD *a; + +#ifdef DEBUG + if (!vol || !ctx || !ctx->mrec || !ctx->attr) { + printf(stderr, "find_attr() received NULL pointer!\n"); + return FALSE; + } +#endif + a = ctx->attr; + /* + * Iterate over attributes in mft record starting at @ctx->attr. + * Note: Not using while/do/for loops so the comparison code + * does not get indented out of the 80 characters wide screen... (AIA) + */ + goto search_loop; +do_next: + a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); + if (a < ctx->mrec || a > (char*)ctx->mrec + vol->mft_record_size) + goto file_corrupt; + ctx->attr = a; +search_loop: + /* We catch $END with this more general check, too... */ + if (le32_to_cpu(a->type) > le32_to_cpu(type)) + goto not_found; + if (!a->length) + goto file_corrupt; + if (a->type != type) + goto do_next; + /* If no @name is specified, check for @val. */ + if (!name) { + register int rv; + /* If no @val specified, we are done. */ + if (!val) { +found_it: + return TRUE; + } + rv = memcmp(val, (char*)a + le16_to_cpu(a->value_offset), + min(val_len, le32_to_cpu(a->value_length))); + /* If @val collates after the current attribute's value, + continue searching as a matching attribute might follow. */ + if (!rv) { + register u32 avl = le32_to_cpu(a->value_length); + if (val_len == avl) + goto found_it; + if (val_len > avl) + goto do_next; + } else if (rv > 0) + goto do_next; + goto not_found; + } + if (ntfs_are_names_equal(name, name_len, + (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), + a->name_length, ic, vol->upcase, vol->upcase_len)) + goto found_it; + { register int rc = ntfs_collate_names(vol->upcase, + vol->upcase_len, name, name_len, + (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), + a->name_length, IGNORE_CASE, 1); + /* If case insensitive collation of names collates @name + before a->name, there is no matching attribute. */ + if (rc == -1) + goto not_found; + /* If the strings are not equal, continue search. */ + if (rc) + goto do_next; + } + /* If case sensitive collation of names doesn't collate @name before + a->name, we continue the search. Otherwise we haven't found it. */ + if (ntfs_collate_names(vol->upcase, vol->upcase_len, name, name_len, + (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), + a->name_length, CASE_SENSITIVE, 1) != -1) + goto do_next; +not_found: + return FALSE; +file_corrupt: +#ifdef DEBUG + printf(stderr, "find_attr(): File is corrupt. Run chkdsk.\n"); +#endif + goto not_found; +} + +BOOL lookup_external_attr(const ntfs_volume *vol, const MFT_REFERENCE mref, + const ATTR_TYPES type, const wchar_t *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const s64 lowest_vcn, const u8 *val, + const u32 val_len, ntfs_attr_search_ctx *ctx) +{ + ATTR_LIST_ENTRY *al_pos, **al_val, *al_val_start, *al_next_pos; + ATTR_RECORD *attr_pos; + MFT_RECORD *mrec, *m; + u8 var1 = 0; + u8 var2 = 0; + u8 var3; + int rc; + wchar_t *al_name; + u32 al_name_len; + + al_val = &ctx->alist_val; + if (ctx->alist_val_end <= *al_val && !ctx->is_first) + goto file_corrupt; + al_val_start = 0; + if (ctx->base) { + if (ctx->is_first) + goto already_have_the_base_and_is_first; + al_val_start = *al_val; + al_pos = (char*)*al_val + le16_to_cpu((*al_val)->length); + } else + al_pos = *al_val; +do_next: + if (al_pos < ctx->alist_val_end) + goto al_pos_below_alist_val_end; + var1 = var2 = 1; + al_pos = *al_val; +do_next_2: + *al_val = al_pos; + if (!type || var1 || type == al_pos->type) + goto compare_names; + if (le32_to_cpu(al_pos->type) > le32_to_cpu(type)) + goto gone_too_far; + al_pos = al_next_pos; + goto do_next; +already_have_the_base_and_is_first: + ctx->is_first = FALSE; + if (*al_val < ctx->alist_val_end) + goto do_next; + if (ctx->base) { + // FIXME: CcUnpinData(ctx->base); + ctx->base = NULL; + } + if (!type) + return FALSE; + if (ntfs_read_file_record(vol, mref, &ctx->mrec, &ctx->attr) < 0) + return FALSE; + ctx->base = ctx->mrec; + find_attr(vol, type, name, name_len, ic, val, val_len, ctx); + return FALSE; +al_pos_below_alist_val_end: + if (al_pos < ctx->alist_val) + goto file_corrupt; + if (al_pos >= ctx->alist_val_end) + goto file_corrupt; + if (!al_pos->length) + goto file_corrupt; + al_next_pos = (ATTR_LIST_ENTRY*)((char*)al_pos + + le16_to_cpu(al_pos->length)); + goto do_next_2; +gone_too_far: + var1 = 1; +compare_names: + al_name_len = al_pos->name_length; + al_name = (wchar_t*)((char*)al_pos + al_pos->name_offset); + if (!name || var1) + goto compare_lowest_vcn; + if (ic == CASE_SENSITIVE) { + if (name_len == al_name_len && + !memcmp(al_name, name, al_name_len << 1)) + rc = TRUE; + else + rc = FALSE; + } else /* IGNORE_CASE */ + rc = ntfs_are_names_equal(al_name, al_name_len, name, name_len, + ic, vol->upcase, vol->upcase_len); + if (rc) + goto compare_lowest_vcn; + rc = ntfs_collate_names(vol->upcase, vol->upcase_len, name, name_len, + al_name, al_name_len, IGNORE_CASE, 1); + if (rc == -1) + goto name_collates_before_al_name; + if (!rc && ntfs_collate_names(vol->upcase, vol->upcase_len, name, + name_len, al_name, al_name_len, + IGNORE_CASE, 0) == -1) + goto name_collates_before_al_name; + al_pos = al_next_pos; + goto do_next; +name_collates_before_al_name: + var1 = 1; +compare_lowest_vcn: + if (lowest_vcn && !var1 && al_next_pos < ctx->alist_val_end && + sle64_to_cpu(al_next_pos->lowest_vcn) <= sle64_to_cpu(lowest_vcn) && + al_next_pos->type == al_pos->type && + al_next_pos->name_length == al_name_len && + !memcmp((char*)al_next_pos + al_next_pos->name_offset, al_name, + al_name_len << 1)) { + al_pos = al_next_pos; + goto do_next; + } + /* Don't mask the sequence number. If it isn't equal, the ref is stale. + */ + if (al_val_start && + al_pos->mft_reference == al_val_start->mft_reference) { + mrec = ctx->mrec; + attr_pos = (ATTR_RECORD*)((char*)mrec + + le16_to_cpu(mrec->attrs_offset)); + } else { + if (ctx->base) { + // FIXME: CcUnpinData(ctx->base); + ctx->base = 0; + } + if (ntfs_read_file_record(vol, + le64_to_cpu(al_pos->mft_reference), + &m, &attr_pos) < 0) + return FALSE; + mrec = ctx->mrec; + ctx->base = ctx->mrec = m; + } + var3 = 0; +do_next_attr_loop_start: + if (attr_pos < mrec || attr_pos > (char*)mrec + vol->mft_record_size) + goto file_corrupt; + if (attr_pos->type == AT_END) + goto do_next_al_entry; + if (!attr_pos->length) + goto file_corrupt; + if (al_pos->instance != attr_pos->instance) + goto do_next_attr; + if (al_pos->type != attr_pos->type) + goto do_next_al_entry; + if (!name) + goto skip_name_comparison; + if (attr_pos->name_length != al_name_len) + goto do_next_al_entry; + if (memcmp((wchar_t*)((char*)attr_pos + + le16_to_cpu(attr_pos->name_offset)), al_name, + attr_pos->name_length << 1)) + goto do_next_al_entry; +skip_name_comparison: + var3 = 1; + ctx->attr = attr_pos; + if (var1) + goto loc_5217c; + if (!val) + return TRUE; + if (attr_pos->non_resident) + goto do_next_attr; + if (le32_to_cpu(attr_pos->value_length) != val_len) + goto do_next_attr; + if (!memcmp((char*)attr_pos + le16_to_cpu(attr_pos->value_offset), + val, val_len)) + return TRUE; +do_next_attr: + attr_pos = (ATTR_RECORD*)((char*)attr_pos + + le32_to_cpu(attr_pos->length)); + goto do_next_attr_loop_start; +do_next_al_entry: + if (!var3) + goto file_corrupt; + al_pos = (ATTR_RECORD*)((char*)al_pos + le16_to_cpu(al_pos->length)); + goto do_next; +loc_5217c: + if (var2) + *al_val = (ATTR_RECORD*)((char*)al_pos + + le16_to_cpu(al_pos->length)); + if (ctx->base) { + // FIXME: CcUnpinData(ctx->base); + ctx->base = 0; + } + if (!type) + return FALSE; + if (ntfs_read_file_record(vol, mref, &mrec, &ctx->attr) < 0) + return FALSE; + ctx->base = mrec; + find_attr(vol, type, name, name_len, ic, val, val_len, ctx); + return FALSE; +file_corrupt: +#ifdef DEBUG + fprintf(stderr, "lookup_attr() encountered corrupt file record.\n"); +#endif + return FALSE; +} + +BOOL lookup_attr(const ntfs_volume *vol, const MFT_REFERENCE *mref, + const ATTR_TYPES type, const wchar_t *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const s64 lowest_vcn, const u8 *val, const u32 val_len, + ntfs_attr_search_ctx *ctx) +{ + MFT_RECORD *m; + ATTR_RECORD *a; + s64 len; + + if (!vol || !ctx) { +#ifdef DEBUG + printf(stderr, "lookup_attr() received NULL pointer!\n"); +#endif + return FALSE; + } + if (ctx->base) + goto already_have_the_base; + if (ntfs_read_file_record(vol, mref, &m, &a) < 0) + return FALSE; + ctx->base = ctx->mrec = m; + ctx->attr = a; + ctx->alist_mrec = ctx->alist_attr = ctx->alist_val = NULL; + /* + * Look for an attribute list and at the same time check for attributes + * which collate before the attribute list (i.e. $STANDARD_INFORMATION). + */ + if (le32_to_cpu(a->type) > le32_to_cpu(AT_ATTRIBUTE_LIST)) + goto no_attr_list; +do_next: + if (!a->length) + goto file_corrupt; + if (a->type == AT_ATTRIBUTE_LIST) + goto attr_list_present; + a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); + if (a < m || a > (char*)m + vol->mft_record_size) + goto file_corrupt; + if (le32_to_cpu(a->type) <= le32_to_cpu(AT_ATTRIBUTE_LIST)) + goto do_next; +no_attr_list: + if (!type || type == AT_STANDARD_INFORMATION && + a->type == AT_STANDARD_INFORMATION) + goto found_it; +call_find_attr: + return find_attr(vol, type, name, name_len, ic, val, val_len, ctx); +found_it: + ctx->attr = a; + return TRUE; +already_have_the_base: + /* + * If ctx->is_first, search starting with ctx->attr. Otherwise + * continue search after ctx->attr. + */ + if (ctx->is_first) { + a = ctx->attr; + ctx->is_first = 0; + } else + a = (ATTR_RECORD*)((char*)ctx->attr + + le32_to_cpu(ctx->attr->length)); + if (a < m || a > (char*)m + vol->mft_record_size) + goto file_corrupt; + if (a->type == AT_END) + return FALSE; + if (!a->length) + goto file_corrupt; + if (type) + goto call_find_attr; + goto found_it; +attr_list_present: + /* + * Looking for zero means we return the first attribute, which will + * be the first one listed in the attribute list. + */ + ctx->attr = a; + if (!type) + goto search_attr_list; + if (type == AT_ATTRIBUTE_LIST) + return TRUE; +search_attr_list: + /* + * "a" contains the attribute list attribute at this stage. + */ + ctx->alist_attr = a; + len = get_attribute_value_length(a); +#ifdef DEBUG + if (len > 0x40000LL) { + printf(stderr, "lookup_attr() found corrupt attribute list.\n"); + return FALSE; + } +#endif + ctx->alist_val_len = len; + if (!(ctx->alist_val = malloc(ctx->alist_val_len))) { +#ifdef DEBUG + printf(stderr, "lookup_attr() failed to allocate memory for " + "attribute list value.\n"); +#endif + return FALSE; + } + if (get_attribute_value(vol, ctx->mrec, a, ctx->alist_val) != + ctx->alist_val_len) { +#ifdef DEBUG + printf(stderr, "lookup_attr() failed to read attribute list " + "value.\n"); +#endif + return FALSE; + } + ctx->alist_val_end = (char*)ctx->alist_val + ctx->alist_val_len; + if (a->non_resident) { + ctx->alist_old_base = ctx->alist_val_base; + ctx->alist_val_base = ctx->base; + ctx->base = NULL; + } else if (ctx->base) { + // FIXME: CcUnpinData(ctx->base); + ctx->base = NULL; + } +lookup_external: + return lookup_external_attr(vol, mref, type, name, name_len, ic, + lowest_vcn, val, val_len, ctx); +file_corrupt: +#ifdef DEBUG + fprintf(stderr, "lookup_attr() encountered corrupt file record.\n"); +#endif + return FALSE; +} + From c5d4f9c9bc440213a146afed8ebf468758351107 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0079/2994] whitespace and include guards 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/04 12:12:42-00:00 !antona Final POSIXification of disk_io functions. (famous last words) 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/18 18:15:46-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2002/04/15 18:39:36-00:00 !antona Cleanup some mistakes. 2002/04/15 17:51:26-00:00 !antona read/write_mft_record(s) are here 2002/04/15 00:45:28-00:00 !antona Update headers to reflect changes in libntfs. 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 14:29:11-00:00 !antona Almost fixed compilaton. Remember to declare a struct type with struct NAME { declaration }; rather than the bogus struct { declaration NAME }; then can use typedef NAME othername; on a forward declaration of NAME (struct NAME;) and all is fine... 2001/04/11 11:49:16-00:00 !antona Header file reorganisation so that it compiles. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/03/26 04:30:27-00:00 !antona Cleanup and fixes. 2001/01/26 00:34:35-00:00 !antona Inconsisteny fixes. 2001/01/25 22:25:43-00:00 !antona More files added to ntfs lib. Fixed some consistency problems. 2001/01/24 20:37:36-00:00 !antona Added for now last header file for boot sector handling. 2001/01/24 18:44:31-00:00 !antona Added disk_io.h header file. (Logical change 1.5) --- include/disk_io.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/include/disk_io.h b/include/disk_io.h index e69de29b..3c1ccc6e 100644 --- a/include/disk_io.h +++ b/include/disk_io.h @@ -0,0 +1,43 @@ +/* + * $Id$ + * + * disk_io.h - Exports for disk io. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_DISK_IO_H +#define _NTFS_DISK_IO_H + +#include "volume.h" + +extern s64 ntfs_pread(const int fd, const s64 pos, s64 count, const void *b); +extern s64 ntfs_pwrite(const int fd, const s64 pos, s64 count, const void *b); + +extern s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, + const u32 bksize, const void *b); +extern s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, + const u32 bksize, const void *b); + +extern s64 ntfs_read_clusters(const ntfs_volume *vol, const s64 lcn, + const s64 count, const void *b); +extern s64 ntfs_write_clusters(const ntfs_volume *vol, const s64 lcn, + const s64 count, const void *b); + +#endif /* defined _NTFS_DISK_IO_H */ + From 4c4d606dcb75ecdc24756a727663e3181c913a51 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0080/2994] whitespace and include guards 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/06 20:47:33-00:00 !antona The beginning of the directory operations! Introduce dir.[hc] and ntfs_lookup_inode_by_name(). 2002/06/02 23:02:20-00:00 !antona More fixes and updates. 2002/04/24 01:37:37-00:00 !antona New api call is_boot_sector_ntfs. A few folding help cleanups. 2002/04/21 01:26:39-00:00 !antona Cleanup/streamline include file dependencies. 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/18 18:15:46-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2001/06/01 02:07:26-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/03/05 03:04:40-00:00 !antona Corresponding changes to the library. 2001/01/30 12:29:03-00:00 !antona And the last move into CVS. The make files. (Note: compilation is untested and all changes have been done without testing so if it doesn't compile at the moment don't be too surprised.) 2001/01/25 22:25:43-00:00 !antona More files added to ntfs lib. Fixed some consistency problems. (Logical change 1.5) --- libntfs/bootsect.c | 270 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index e69de29b..5e9f5082 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -0,0 +1,270 @@ +/* + * $Id$ + * + * bootsect.c - Boot sector handling code. Part of the Linux-NTFS project. + * + * Copyright (c) 2000,2001 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include + +#include "bootsect.h" +#include "debug.h" + +/** + * is_boot_sector_ntfs - check if a buffer contains a valid ntfs boot sector + * @b: buffer containing putative boot sector to analyze + * @silent: if zero, output progress messages to stdout + * + * Check if the buffer @b contains a valid ntfs boot sector. The buffer @b + * must be at least 512 bytes in size. + * + * If @silent is zero, output progress messages to stdout. Otherwise, do not + * output any messages (except when configured with --enable-debug in which + * case warning/debug messages may be displayed). + * + * Return TRUE if @b contains a valid ntfs boot sector and FALSE if not. + */ +BOOL is_boot_sector_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent) +{ + u32 i; + + if (!silent) + printf("\nBeginning bootsector check...\n"); + + /* Calculate the checksum. Note, this is just a simple addition of + all u32 values in the bootsector starting at the beginning and + finishing at the offset of the checksum itself (i.e. not including + the checksum...). */ + if ((void*)b < (void*)&b->checksum) { + u32 *u = (u32 *)b; + u32 *bi = (u32 *)(&b->checksum); + + if (!silent) + printf("Calculating bootsector checksum... "); + + for (i = 0; u < bi; ++u) + i += le32_to_cpup(u); + + if (le32_to_cpu(b->checksum) && le32_to_cpu(b->checksum) != i) + goto not_ntfs; + if (!silent) + puts("OK"); + } + + /* Check OEMidentifier is "NTFS " */ + if (!silent) + printf("Checking OEMid... "); + if (b->oem_id != cpu_to_le64(0x202020205346544e)) /* "NTFS " */ + goto not_ntfs; + if (!silent) + puts("OK"); + + /* Check bytes per sector value is between 256 and 4096. */ + if (!silent) + printf("Checking bytes per sector... "); + if (le16_to_cpu(b->bpb.bytes_per_sector) < 0x100 || + le16_to_cpu(b->bpb.bytes_per_sector) > 0x1000) + goto not_ntfs; + if (!silent) + puts("OK"); + + /* Check sectors per cluster value is valid. */ + if (!silent) + printf("Checking sectors per cluster... "); + switch (b->bpb.sectors_per_cluster) { + case 1: case 2: case 4: case 8: case 16: + case 32: case 64: case 128: + break; + default: + goto not_ntfs; + } + if (!silent) + puts("OK"); + + /* Check the cluster size is not above 65536 bytes. */ + if (!silent) + printf("Checking cluster size... "); + if ((u32)le16_to_cpu(b->bpb.bytes_per_sector) * + b->bpb.sectors_per_cluster > 0x10000) + goto not_ntfs; + if (!silent) + puts("OK"); + + /* Check reserved/unused fields are really zero. */ + if (!silent) + printf("Checking reserved fields are zero... "); + if (le16_to_cpu(b->bpb.reserved_sectors) || + le16_to_cpu(b->bpb.root_entries) || + le16_to_cpu(b->bpb.sectors) || + le16_to_cpu(b->bpb.sectors_per_fat) || + le32_to_cpu(b->bpb.large_sectors) || + b->bpb.fats) + goto not_ntfs; + if (!silent) + puts("OK"); + + /* Check clusters per file mft record value is valid. */ + if (!silent) + printf("Checking clusters per mft record... "); + if ((u8)b->clusters_per_mft_record < 0xe1 || + (u8)b->clusters_per_mft_record > 0xf7) { + switch (b->clusters_per_mft_record) { + case 1: case 2: case 4: case 8: case 0x10: case 0x20: case 0x40: + break; + default: + goto not_ntfs; + } + } + if (!silent) + puts("OK"); + + /* Check clusters per index block value is valid. */ + if (!silent) + printf("Checking clusters per index block... "); + if ((u8)b->clusters_per_index_record < 0xe1 || + (u8)b->clusters_per_index_record > 0xf7) { + switch (b->clusters_per_index_record) { + case 1: case 2: case 4: case 8: case 0x10: case 0x20: case 0x40: + break; + default: + goto not_ntfs; + } + } + if (!silent) + puts("OK"); + + if (b->end_of_sector_marker != cpu_to_le16(0xaa55)) + Dputs("Warning: Bootsector has invalid end of sector marker."); + + if (!silent) + puts("Bootsector check completed successfully."); + + return TRUE; +not_ntfs: + if (!silent) { + puts("FAILED"); + puts("Bootsector check failed. Aborting..."); + } + return FALSE; +} + +/** + * parse_ntfs_boot_sector - setup an ntfs volume from an ntfs boot sector + * @vol: ntfs_volume to setup + * @bs: buffer containing ntfs boot sector to parse + * + * Parse the ntfs bootsector @bs and setup the ntfs volume @vol with the + * obtained values. + * + * Return 0 on success or -1 on error with errno set to the error code EINVAL. + */ +int parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) +{ + u8 sectors_per_cluster; + s8 c; + + /* We return -1 with errno = EINVAL on error. */ + errno = EINVAL; + + vol->sector_size = le16_to_cpu(bs->bpb.bytes_per_sector); + vol->sector_size_bits = ffs(vol->sector_size) - 1; + Dprintf("SectorSize = 0x%x\n", vol->sector_size); + Dprintf("SectorSizeBits = %u\n", vol->sector_size_bits); + /* + * The bounds checks on mft_lcn and mft_mirr_lcn (i.e. them being + * below or equal the number_of_clusters) really belong in the + * is_boot_sector_ntfs but in this way we can just do this once. + */ + sectors_per_cluster = bs->bpb.sectors_per_cluster; + Dprintf("NumberOfSectors = %Li\n", sle64_to_cpu(bs->number_of_sectors)); + Dprintf("SectorsPerCluster = 0x%x\n", sectors_per_cluster); + if (sectors_per_cluster & (sectors_per_cluster - 1)) { + Dprintf("Error: %s is not a valid NTFS partition! " + "sectors_per_cluster is not a power of 2.\n", + vol->dev_name); + return -1; + } + vol->nr_clusters = sle64_to_cpu(bs->number_of_sectors) >> + (ffs(sectors_per_cluster) - 1); + + vol->mft_lcn = sle64_to_cpu(bs->mft_lcn); + vol->mftmirr_lcn = sle64_to_cpu(bs->mftmirr_lcn); + Dprintf("MFT LCN = 0x%Lx\n", vol->mft_lcn); + Dprintf("MFTMirr LCN = 0x%Lx\n", vol->mftmirr_lcn); + if (vol->mft_lcn > vol->nr_clusters || + vol->mftmirr_lcn > vol->nr_clusters) { + Dprintf("Error: %s is not a valid NTFS partition! ($Mft LCN " + "or\n$MftMirr LCN is greater than the number " + "of clusters!\n", vol->dev_name); + return -1; + } + vol->cluster_size = sectors_per_cluster * vol->sector_size; + if (vol->cluster_size & (vol->cluster_size - 1)) { + Dprintf("Error: %s is not a valid NTFS partition! " + "cluster_size is not a power of 2.\n", + vol->dev_name); + return -1; + } + vol->cluster_size_bits = ffs(vol->cluster_size) - 1; + /* + * Need to get the clusters per mft record and handle it if it is + * negative. Then calculate the mft_record_size. A value of 0x80 is + * illegal, thus signed char is actually ok! + */ + c = bs->clusters_per_mft_record; + Dprintf("ClusterSize = 0x%x\n", vol->cluster_size); + Dprintf("ClusterSizeBits = %u\n", vol->cluster_size_bits); + Dprintf("ClustersPerMftRecord = 0x%x\n", c); + /* + * When clusters_per_mft_record is negative, it means that it is to + * be taken to be the negative base 2 logarithm of the mft_record_size + * min bytes. Then: + * mft_record_size = 2^(-clusters_per_mft_record) bytes. + */ + if (c < 0) + vol->mft_record_size = 1 << -c; + else + vol->mft_record_size = vol->cluster_size * c; + if (vol->mft_record_size & (vol->mft_record_size - 1)) { + Dprintf("Error: %s is not a valid NTFS partition! " + "mft_record_size is not a power of 2.\n", + vol->dev_name); + return -1; + } + vol->mft_record_size_bits = ffs(vol->mft_record_size) - 1; + Dprintf("MftRecordSize = 0x%x\n", vol->mft_record_size); + Dprintf("MftRecordSizeBits = %u\n", vol->mft_record_size_bits); + /* + * Work out the size of the MFT mirror in number of mft records. If the + * cluster size is less than or equal to the size taken by four mft + * records, the mft mirror stores the first four mft records. If the + * cluster size is bigger than the size taken by four mft records, the + * mft mirror contains as many mft records as will fit into one + * cluster. + */ + if (vol->cluster_size <= 4 * vol->mft_record_size) + vol->mftmirr_size = 4; + else + vol->mftmirr_size = vol->cluster_size / vol->mft_record_size; + return 0; +} + From c2cb8c022345e71445728f0271498390383b88df Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0081/2994] whitespace and include guards 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/08 14:12:01-00:00 !antona ntfs_readdir() has arrived. 2002/06/06 20:47:29-00:00 !antona The beginning of the directory operations! Introduce dir.[hc] and ntfs_lookup_inode_by_name(). 2002/06/06 15:41:29-00:00 !antona Add template files for directory handling code. (Logical change 1.5) --- include/dir.h | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/include/dir.h b/include/dir.h index e69de29b..b0939689 100644 --- a/include/dir.h +++ b/include/dir.h @@ -0,0 +1,62 @@ +/* + * $Id$ + * + * dir.h - Exports for directory handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_DIR_H +#define _NTFS_DIR_H + +#include "types.h" + +/* The little endian Unicode string $I30 as a global constant. */ +extern uchar_t I30[5]; + +extern u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, + const uchar_t *uname, const int uname_len); + +/* + * File types (adapted from include ) + */ +#define NTFS_DT_UNKNOWN 0 +#define NTFS_DT_FIFO 1 +#define NTFS_DT_CHR 2 +#define NTFS_DT_DIR 4 +#define NTFS_DT_BLK 6 +#define NTFS_DT_REG 8 +#define NTFS_DT_LNK 10 +#define NTFS_DT_SOCK 12 +#define NTFS_DT_WHT 14 + +/* + * This is the "ntfs_filldir" function type, used by ntfs_readdir() to let + * the caller specify what kind of dirent layout it wants to have. + * This allows the caller to read directories into their application or + * to have different dirent layouts depending on the binary type. + */ +typedef int (*ntfs_filldir_t)(void *dirent, const uchar_t *name, + const int name_len, const int name_type, const s64 pos, + const MFT_REF mref, const unsigned dt_type); + +extern int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, + void *dirent, ntfs_filldir_t filldir); + +#endif /* defined _NTFS_DIR_H */ + From 55763f61fa600d7317be8f4ad4348bff151d4774 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0082/2994] whitespace and include guards 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/30 17:02:41-00:00 !flatcap typos 2002/04/18 18:15:46-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2002/04/14 14:08:30-00:00 !antona Cleanup library code. Throw away unused stuff. 2002/04/14 13:28:19-00:00 !antona Cleanup mst fixup handling bringing it inline with kernel driver and rename the file to mst rather than ntfs_rec. (Logical change 1.5) --- libntfs/mst.c | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) diff --git a/libntfs/mst.c b/libntfs/mst.c index e69de29b..32e3c874 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -0,0 +1,207 @@ +/* + * $Id$ + * + * mst.c - Multi sector fixup handling code. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "mst.h" +#include + +/** + * ntfs_post_read_mst_fixup - deprotect multi sector transfer protected data + * @b: pointer to the data to deprotect + * @size: size in bytes of @b + * + * Perform the necessary post read multi sector transfer fixups and detect the + * presence of incomplete multi sector transfers. - In that case, overwrite the + * magic of the ntfs record header being processed with "BAAD" (in memory only!) * and abort processing. + * + * Return 0 on success and -1 on error, with errno set to the error code. The + * following error codes are defined: + * EINVAL Invalid arguments or invalid NTFS record in buffer @b. + * EIO Mulit sector transfer error was detected. Magic of the NTFS + * record in @b will have been set to "BAAD". + */ +int ntfs_post_read_mst_fixup(NTFS_RECORD *b, const u32 size) +{ + u16 usa_ofs, usa_count, usn; + u16 *usa_pos, *data_pos; + + /* Setup the variables. */ + usa_ofs = le16_to_cpu(b->usa_ofs); + /* Decrement usa_count to get number of fixups. */ + usa_count = le16_to_cpu(b->usa_count) - 1; + /* Size and alignment checks. */ + if (size & (NTFS_SECTOR_SIZE - 1) || usa_ofs & 1 || + usa_ofs + (usa_count * 2) > size || + (size >> NTFS_SECTOR_SIZE_BITS) != usa_count) { + errno = EINVAL; + return -1; + } + /* Position of usn in update sequence array. */ + usa_pos = (u16*)b + usa_ofs/sizeof(u16); + /* + * The update sequence number which has to be equal to each of the + * u16 values before they are fixed up. Note no need to care for + * endianness since we are comparing and moving data for on disk + * structures which means the data is consistent. - If it is + * consistenty the wrong endianness it doesn't make any difference. + */ + usn = *usa_pos; + /* + * Position in protected data of first u16 that needs fixing up. + */ + data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1; + /* + * Check for incomplete multi sector transfer(s). + */ + while (usa_count--) { + if (*data_pos != usn) { + /* + * Incomplete multi sector transfer detected! )-: + * Set the magic to "BAAD" and return failure. + * Note that magic_BAAD is already converted to le32. + */ + b->magic = magic_BAAD; + errno = EIO; + return -1; + } + data_pos += NTFS_SECTOR_SIZE/sizeof(u16); + } + /* Re-setup the variables. */ + usa_count = le16_to_cpu(b->usa_count) - 1; + data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1; + /* Fixup all sectors. */ + while (usa_count--) { + /* + * Increment position in usa and restore original data from + * the usa into the data buffer. + */ + *data_pos = *(++usa_pos); + /* Increment position in data as well. */ + data_pos += NTFS_SECTOR_SIZE/sizeof(u16); + } + return 0; +} + +/** + * ntfs_pre_write_mst_fixup - apply multi sector transfer protection + * @b: pointer to the data to protect + * @size: size in bytes of @b + * + * Perform the necessary pre write multi sector transfer fixup on the data + * pointer to by @b of @size. + * + * Return 0 if fixups applied successfully or -1 if no fixups were performed + * due to errors. In that case errno i set to the error code (EINVAL). + * + * NOTE: We consider the absence / invalidity of an update sequence array to + * mean error. This means that you have to create a valid update sequence + * array header in the ntfs record before calling this function, otherwise it + * will fail (the header needs to contain the position of the update seqeuence + * array together with the number of elements in the array). You also need to + * initialise the update sequence number before calling this function + * otherwise a random word will be used (whatever was in the record at that + * position at that time). + */ +int ntfs_pre_write_mst_fixup(NTFS_RECORD *b, const u32 size) +{ + u16 usa_ofs, usa_count, usn; + u16 *usa_pos, *data_pos; + + /* Sanity check + only fixup if it makes sense. */ + if (!b || is_baad_record(b->magic) || is_hole_record(b->magic)) { + errno = EINVAL; + return -1; + } + /* Setup the variables. */ + usa_ofs = le16_to_cpu(b->usa_ofs); + /* Decrement usa_count to get number of fixups. */ + usa_count = le16_to_cpu(b->usa_count) - 1; + /* Size and alignment checks. */ + if (size & (NTFS_SECTOR_SIZE - 1) || usa_ofs & 1 || + usa_ofs + (usa_count * 2) > size || + (size >> NTFS_SECTOR_SIZE_BITS) != usa_count) { + errno = EINVAL; + return -1; + } + /* Position of usn in update sequence array. */ + usa_pos = (u16*)((u8*)b + usa_ofs); + /* + * Cyclically increment the update sequence number + * (skipping 0 and -1, i.e. 0xffff). + */ + usn = le16_to_cpup(usa_pos) + 1; + if (usn == 0xffff || !usn) + usn = 1; + usn = cpu_to_le16(usn); + *usa_pos = usn; + /* Position in data of first u16 that needs fixing up. */ + data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1; + /* Fixup all sectors. */ + while (usa_count--) { + /* + * Increment the position in the usa and save the + * original data from the data buffer into the usa. + */ + *(++usa_pos) = *data_pos; + /* Apply fixup to data. */ + *data_pos = usn; + /* Increment position in data as well. */ + data_pos += NTFS_SECTOR_SIZE/sizeof(u16); + } + return 0; +} + +/** + * ntfs_post_write_mst_fixup - deprotect multi sector transfer protected data + * @b: pointer to the data to deprotect + * + * Perform the necessary post write multi sector transfer fixup, not checking + * for any errors, because we assume we have just used + * ntfs_pre_write_mst_fixup(), thus the data will be fine or we would never + * have gotten here. + */ +void ntfs_post_write_mst_fixup(NTFS_RECORD *b) +{ + u16 *usa_pos, *data_pos; + + u16 usa_ofs = le16_to_cpu(b->usa_ofs); + u16 usa_count = le16_to_cpu(b->usa_count) - 1; + + /* Position of usn in update sequence array. */ + usa_pos = (u16*)b + usa_ofs/sizeof(u16); + + /* Position in protected data of first u16 that needs fixing up. */ + data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1; + + /* Fixup all sectors. */ + while (usa_count--) { + /* + * Increment position in usa and restore original data from + * the usa into the data buffer. + */ + *data_pos = *(++usa_pos); + + /* Increment position in data as well. */ + data_pos += NTFS_SECTOR_SIZE/sizeof(u16); + } +} + From 78374b2c2c9e32cc4808775fbfd1d12d66e55c95 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0083/2994] whitespace and include guards 2002/07/03 21:56:00-00:00 !antona Updates 2001/01/23 16:35:04-00:00 !antona Added my templates for new source and include files. (Logical change 1.5) --- doc/template.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/doc/template.c b/doc/template.c index e69de29b..6bb6e7dc 100644 --- a/doc/template.c +++ b/doc/template.c @@ -0,0 +1,47 @@ +const char *EXEC_NAME = ""; +const char *EXEC_VERSION= "0.0.1"; +/* + * EXEC_NAME - Part of the Linux-NTFS project. + * + * Copyright (c) 2000,2001 Anton Altaparmakov. + * + * Short description here. + * + * Anton Altaparmakov + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS distribution + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * WARNING: This program might not work on architectures which do not allow + * unaligned access. For those, the program would need to start using + * get/put_unaligned macros (#include ), but not doing it yet, + * since NTFS really mostly applies to ia32 only, which does allow unaligned + * accesses. We might not actually have a problem though, since the structs are + * defined as being packed so that might be enough for gcc to insert the + * correct code. + * + * If anyone using a non-little endian and/or an aligned access only CPU tries + * this program please let me know whether it works or not! + * + * Anton Altaparmakov + */ + +int main(int argc, char **argv) +{ + return 0; +} + From 24f3018dfcc3cf0825c22f6730b5c719f21fcd9b Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0084/2994] whitespace and include guards 2002/07/03 21:56:01-00:00 !antona Updates 2002/07/03 14:38:40-00:00 !antona Cleanup the build process a bit. 2002/07/02 23:47:11-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/04/21 01:26:39-00:00 !antona Cleanup/streamline include file dependencies. 2002/04/18 18:15:46-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2002/04/16 12:13:53-00:00 !antona New API function mft.[ch]::read_file_record(). Also some cleanups. 2001/06/16 19:59:51-00:00 !antona Update ntfsdump_logfile and dumplog and the relevant textfiles. 2001/06/16 00:06:17-00:00 !antona dumplog now decodes the first 0x5000 bytes of the logfile given on the command line as fully as possible with the current knowledge of the logfile structures. 2001/06/15 16:45:12-00:00 !antona New log dumper to operate on a file rather than a partition and it is more advanced and corrected compared to ntfsdump_logfile. Also add a file that will do the creation of the logfile structures for mkntfs. (Logical change 1.5) --- ntfstools/dumplog.c | 310 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 310 insertions(+) diff --git a/ntfstools/dumplog.c b/ntfstools/dumplog.c index e69de29b..1a730c97 100644 --- a/ntfstools/dumplog.c +++ b/ntfstools/dumplog.c @@ -0,0 +1,310 @@ +const char *EXEC_NAME = "dumplog"; +const char *EXEC_VERSION = "1.0"; +/* + * $Id$ + * + * DumpLog - Part of the Linux-NTFS project. + * + * Copyright (c) 2000,2001 Anton Altaparmakov. + * + * This utility will interpret the contents of the journal ($LogFile) specified + * on the command line and display the results on stdout. Errors will be output + * to stderr. + * + * Anton Altaparmakov + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS source + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "types.h" +#include "mst.h" +#include "logfile.h" + +int main(int argc, char **argv) +{ + s64 l, br; + unsigned char *lfd = NULL; + RESTART_PAGE_HEADER *rph; + RESTART_AREA *rr; + RESTART_CLIENT *cr; + RECORD_PAGE_HEADER *rcrd_ph; + LOG_RECORD *lr; + int pass = 1; + int i, lps, client; + int f = 0; + char zero[4096]; + struct stat sbuf; + + memset(zero, 0, sizeof(zero)); + printf("\n"); + if (argc != 2) { + printf("%s v%s - Interpret and display information about the " + "journal\ngiven on the command line.\n\n" + /* Generic copyright / disclaimer. */ + "Copyright (c) 2001 Anton Altaparmakov.\n\n" + "%s is free software, released under the GNU " + "General Public License\nand you are welcome to " + "redistribute it under certain conditions.\n" + "%s comes with ABSOLUTELY NO WARRANTY; for details " + "read the GNU\nGeneral Public License to be found " + "in the file COPYING in the main Linux-NTFS\n" + "distribution directory.\n\n" + /* Generic part ends here. */ + "Syntax: dumplog log_file_name\n" + " e.g. dumplog /mnt/ntfstest/\\$LogFile\n\n", + EXEC_NAME, EXEC_VERSION, EXEC_NAME, EXEC_NAME); + fprintf(stderr, "Error: incorrect syntax\n"); + exit(1); + } + if (stat(argv[1], &sbuf) == -1) { + if (errno == ENOENT) + fprintf(stderr, "The file doesn't exist; did you " + "specify it correctly?\n"); + else + fprintf(stderr, "Error getting information about %s: " + "%s\n", argv[1], strerror(errno)); + exit(1); + } + f = open(argv[1], O_RDONLY); + if (f == -1) { + perror("Couldn't open file"); + exit(1); + } + l = sbuf.st_size; + if (l > 0x400000LL) { + printf("Only analysing the first four megabytes of the " + "logfile (real size = 0x%Lx).\n", + (unsigned long long)l); + l = 0x400000LL; + } + lfd = (unsigned char*)calloc(1, l); + if (!lfd) { + perror("Couldn't allocate internal buffer"); + goto log_file_error; + } + /* Read in the $LogFile into the buffer. */ + if ((br = read(f, lfd, l)) == -1) { + perror("Couldn't read file"); + goto log_file_error; + } + /* Valid data length in buffer. */ + l = min(br, l); + /* Check restart area. */ + if (!is_rstr_recordp(lfd)) { + s64 _l; + + for (_l = 0LL; _l < l; _l++) + if (lfd[_l] != (unsigned char)-1) + break; + if (_l < l) + puts("Logfile contents are corrupt (magic RSTR " + "missing)!"); + else + puts("Logfile is empty."); + goto log_file_error; + } + /* Do the interpretation and display now. */ + rph = (RESTART_PAGE_HEADER*)lfd; + lps = le32_to_cpu(rph->log_page_size); +pass_loc: + if (ntfs_post_read_mst_fixup((NTFS_RECORD*)rph, lps) || + is_baad_record(rph->magic)) { + puts("Logfile incomplete multi sector transfer detected! " + "Cannot handle this yet!"); + goto log_file_error; + } + if ((pass == 2) && !memcmp(lfd, rph, lps)) { + printf("2nd restart area fully matches the 1st one. Skipping " + "display.\n"); + goto skip_rstr_pass; + } + if (le16_to_cpu(rph->major_ver != 1) || + le16_to_cpu(rph->minor_ver != 1)) { + fprintf(stderr, "$LogFile version %i.%i! Error: Unknown " + "$LogFile version!\n", + le16_to_cpu(rph->major_ver), + le16_to_cpu(rph->minor_ver)); + goto log_file_error; + } + rr = (RESTART_AREA*)((char*)rph + le16_to_cpu(rph->restart_offset)); + cr = (RESTART_CLIENT*)((char*)rr + + le16_to_cpu(rr->client_array_offset)); + /* Dump of the interpreted $LogFile restart area. */ + if (pass == 1) + printf("\n$LogFile version %i.%i.\n", + le16_to_cpu(rph->major_ver), + le16_to_cpu(rph->minor_ver)); + printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); + printf("magic = RSTR\n"); + printf("ChkDskLsn = 0x%Lx\n", sle64_to_cpu(rph->chkdsk_lsn)); + printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); + printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); + printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); + printf("\n(1st) restart record:\n"); + printf("CurrentLsn = %Lx\n", sle64_to_cpu(rr->current_lsn)); + printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); + printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); + printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); + printf("Flags = 0x%x\n", le16_to_cpu(rr->flags)); + printf("SeqNumberBits = %u (0x%x)\n", le32_to_cpu(rr->seq_number_bits), + le32_to_cpu(rr->seq_number_bits)); + printf("RestartAreaLength = 0x%x\n", + le16_to_cpu(rr->restart_area_length)); + printf("ClientArrayOffset = 0x%x\n", + le16_to_cpu(rr->client_array_offset)); + printf("FileSize = %Lu (0x%Lx)\n", le64_to_cpu(rr->file_size), + le64_to_cpu(rr->file_size)); + printf("LastLsnDataLength = 0x%x\n", + le32_to_cpu(rr->last_lsn_data_length)); + printf("RecordLength = 0x%x\n", le16_to_cpu(rr->record_length)); + printf("LogPageDataOffset = 0x%x\n", + le16_to_cpu(rr->log_page_data_offset)); + for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { + printf("\nRestart client record number %i:\n", client); + printf("OldestLsn = 0x%Lx\n", sle64_to_cpu(cr->oldest_lsn)); + printf("ClientRestartLsn = 0x%Lx\n", + sle64_to_cpu(cr->client_restart_lsn)); + printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); + printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); + printf("SeqNumber = 0x%Lx\n", le64_to_cpu(cr->seq_number)); + printf("ClientNameLength = 0x%x\n", + le32_to_cpu(cr->client_name_length)); + if (le32_to_cpu(cr->client_name_length)) { + // convert to ascii and print out. + // printf("ClientName = %u\n", le16_to_cpu(cr->client_name)); + } + /* Size of a restart client record is fixed at 0xa0 bytes. */ + cr = (RESTART_CLIENT*)((char*)cr + 0xa0); + } +skip_rstr_pass: + if (pass == 1) { + rph = (RESTART_PAGE_HEADER*)((char*)rph + lps); + ++pass; + goto pass_loc; + } + rcrd_ph = (RECORD_PAGE_HEADER*)rph; + /* Reuse pass for log record clienter. */ + pass = 0; + printf("\nFinished with restart area. Beginning with log area.\n"); +rcrd_pass_loc: + rcrd_ph = (RECORD_PAGE_HEADER*)((char*)rcrd_ph + lps); + if ((char*)rcrd_ph + lps > (char*)lfd + l) + goto end_of_rcrd_passes; + printf("\nLog record page number %i", pass); + if (!is_rcrd_record(rcrd_ph->magic)) { + for (i = 0; i < lps; i++) + if (((char*)rcrd_ph)[i] != (char)-1) + break; + if (i < lps) + puts(" is corrupt (magic RCRD is missing)."); + else + puts(" is empty."); + pass++; + goto rcrd_pass_loc; + } else + printf(":"); + /* Dump log record page */ + printf("\nmagic = RCRD\n"); + printf("copy.last_lsn/file_offset = 0x%Lx\n", + le64_to_cpu(rcrd_ph->copy.last_lsn)); + printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); + printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); + printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); + printf("header.next_record_offset = 0x%Lx\n", + le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); + printf("header.last_end_lsn = 0x%Lx\n", + le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); + /* + * Where does the 0x40 come from? Is it just usa_offset + + * usa_client * 2 + 7 & ~7 or is it derived from somewhere? + */ + lr = (LOG_RECORD*)((char*)rcrd_ph + 0x40); + client = 0; +log_record_pass: + printf("\nLog record %i:\n", client); + printf("this lsn = 0x%Lx\n", le64_to_cpu(lr->this_lsn)); + printf("client previous lsn = 0x%Lx\n", + le64_to_cpu(lr->client_previous_lsn)); + printf("client undo next lsn = 0x%Lx\n", + le64_to_cpu(lr->client_undo_next_lsn)); + printf("client data length = 0x%x\n", + le32_to_cpu(lr->client_data_length)); + printf("client_id.seq_number = 0x%x\n", + le16_to_cpu(lr->client_id.seq_number)); + printf("client_id.client_index = 0x%x\n", + le16_to_cpu(lr->client_id.client_index)); + printf("record type = 0x%x\n", le32_to_cpu(lr->record_type)); + printf("transaction_id = 0x%x\n", le32_to_cpu(lr->transaction_id)); + printf("flags = 0x%x:", lr->flags); + if (!lr->flags) + printf(" NONE\n"); + else { + int _b = 0; + + if (lr->flags & LOG_RECORD_MULTI_PAGE) { + printf(" LOG_RECORD_MULTI_PAGE"); + _b = 1; + } + if (lr->flags & ~LOG_RECORD_MULTI_PAGE) { + if (_b) + printf(" |"); + printf(" Unknown flags"); + } + printf("\n"); + } + printf("redo_operation = 0x%x\n", le16_to_cpu(lr->redo_operation)); + printf("undo_operation = 0x%x\n", le16_to_cpu(lr->undo_operation)); + printf("redo_offset = 0x%x\n", le16_to_cpu(lr->redo_offset)); + printf("redo_length = 0x%x\n", le16_to_cpu(lr->redo_length)); + printf("undo_offset = 0x%x\n", le16_to_cpu(lr->undo_offset)); + printf("undo_length = 0x%x\n", le16_to_cpu(lr->undo_length)); + printf("target_attribute = 0x%x\n", le16_to_cpu(lr->target_attribute)); + printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); + printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); + printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); + printf("target_vcn = 0x%Lx\n", sle64_to_cpu(lr->target_vcn)); + if (le16_to_cpu(lr->lcns_to_follow) > 0) + printf("Array of lcns:\n"); + for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) + printf("lcn_list[%i].lcn = 0x%Lx\n", i, + sle64_to_cpu(lr->lcn_list[i].lcn)); + client++; + lr = (LOG_RECORD*)((char*)lr + 0x70); + if (((char*)lr + 0x70 <= (char*)rcrd_ph + + le64_to_cpu(rcrd_ph->header.packed.next_record_offset))) + goto log_record_pass; + pass++; + goto rcrd_pass_loc; +end_of_rcrd_passes: +log_file_error: + printf("\n"); + /* Set return code to 0. */ + i = 0; + if (lfd) + free(lfd); + if (f) + close(f); + return i; +} + From 4593a8d3ca6b57e660aab6e4479ba4e2fa6bdadb Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0085/2994] whitespace and include guards 2002/07/08 06:23:22-00:00 !antona Don't use string concatenation with __FUNCTION__ as gcc-3.x don't like it. 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/05 20:32:53-00:00 !antona Mft mirror now updated from ntfs_write_mft_record, yey! Fixup ntfstools accordingly. 2002/06/05 00:29:19-00:00 !antona Make ntfs_attr_pread work with resident attributes and start on ntfs_attr_pwrite (incomplete!). 2002/06/04 12:12:42-00:00 !antona Final POSIXification of disk_io functions. (famous last words) 2002/06/01 00:41:45-00:00 !antona huge update! 2002/04/29 01:53:55-00:00 !antona Loads of stuff. Improvements, start on attr pread and attr mst_pread. Write to follow. ntfslabel cleanup and extensions. libntfs cleanups, fixes, etc. 2002/04/18 18:15:46-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2002/04/16 15:34:32-00:00 !antona Fix the library... 2002/04/15 20:04:27-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/15 18:39:37-00:00 !antona Cleanup some mistakes. 2002/04/15 17:51:26-00:00 !antona read/write_mft_record(s) are here 2002/04/15 00:42:07-00:00 !antona Big rewrite of disk_io.c. Now should have stable API for low level disk access. Move all mft record related stuff from disk_io.c to mft.c. 2002/04/14 15:26:23-00:00 !antona Remove find_first_attr and make all users use get_attr_search_ctx + find_attr instead. 2002/04/14 14:08:30-00:00 !antona Cleanup library code. Throw away unused stuff. 2001/06/01 02:07:26-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 15:29:39-00:00 !flatcap minor build fixes 2001/04/11 14:29:12-00:00 !antona Almost fixed compilaton. Remember to declare a struct type with struct NAME { declaration }; rather than the bogus struct { declaration NAME }; then can use typedef NAME othername; on a forward declaration of NAME (struct NAME;) and all is fine... 2001/04/11 11:49:16-00:00 !antona Header file reorganisation so that it compiles. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/04/05 20:14:45-00:00 !antona Commit of current state of development including locking a la kernel. This doesn't work on user space (semaphores don't work). Just want to have it committed. Will take out locking / modify it where necessary to use pthreads ASAP. 2001/04/03 22:42:42-00:00 !antona See last commit message. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/03/26 04:34:20-00:00 !antona typo fix 2001/03/26 04:28:07-00:00 !antona Cleanup and fixes. 2001/03/26 03:39:59-00:00 !antona Updates 2001/03/05 03:04:40-00:00 !antona Corresponding changes to the library. 2001/03/02 15:05:53-00:00 !antona Commit latest library state. !!!NOTE!!! This breaks everything!!! I'm in the middle of rewritting the find_attribute stuff in attrib.c at the moment. 2001/01/26 00:34:10-00:00 !antona Added disk io functions file. (Logical change 1.5) --- libntfs/disk_io.c | 333 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 333 insertions(+) diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index e69de29b..6be9e54c 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -0,0 +1,333 @@ +/* + * $Id$ + * + * disk_io.c - Disk io functions. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include + +#include "types.h" +#include "disk_io.h" +#include "mst.h" +#include "debug.h" + +/** + * ntfs_pread - positioned read from disk + * @fd: file descriptor to read from + * @pos: position in file descriptor to read from + * @count: number of bytes to read + * @b: output data buffer + * + * This function will read @count bytes from file descriptor @fd at position + * @pos into the data buffer @b. + * + * On success, return the number of successfully read bytes. If this number is + * lower than @count this means that we have either reached end of file or + * encountered an error during the read so that the read is partial. 0 means + * end of file or nothing to read (@count is 0). + * + * On error and nothing has been read, return -1 with errno set appropriately + * to the return code of either lseek, read, or set to EINVAL in case of + * invalid arguments. + */ +s64 ntfs_pread(const int fd, const s64 pos, s64 count, const void *b) +{ + s64 br, total; + + Dprintf("%s(): Entering for pos 0x%Lx, count 0x%Lx.\n", __FUNCTION__, + pos, count); + if (!b || count < 0 || pos < 0) { + errno = EINVAL; + return -1; + } + if (!count) + return 0; + /* Locate to position. */ + if (lseek(fd, pos, SEEK_SET) == (off_t)-1) { + Dprintf("ntfs_pread: lseek to 0x%Lx returned error: %s\n", pos, + strerror(errno)); + return -1; + } + /* Read the data. */ + for (total = 0; count; count -= br, total += br) { + br = read(fd, (char*)b + total, count); + /* If everything ok, continue. */ + if (br > 0) + continue; + /* If EOF or error return number of bytes read. */ + if (!br || total) + return total; + /* Nothing read and error, return error status. */ + return br; + } + /* Finally, return the number of bytes read. */ + return total; +} + +/** + * ntfs_pwrite - positioned write to disk + * @fd: file descriptor to write to + * @pos: position in file descriptor to write to + * @count: number of bytes to write + * @b: data buffer to write to disk + * + * This function will write @count bytes from data buffer @b to file descriptor + * @fd at position @pos. + * + * On success, return the number of successfully written bytes. If this number + * is lower than @count this means that the write has been interrupted in + * flight or that an error was encountered during the write so that the write + * is partial. 0 means nothing was written (also return 0 when @count is 0). + * + * On error and nothing has been written, return -1 with errno set + * appropriately to the return code of either lseek, write, fdatasync, or set + * to EINVAL in case of invalid arguments. + */ +s64 ntfs_pwrite(const int fd, const s64 pos, s64 count, const void *b) +{ + s64 written, total; + + Dprintf("%s(): Entering for pos 0x%Lx, count 0x%Lx.\n", __FUNCTION__, + pos, count); + if (!b || count < 0 || pos < 0) { + errno = EINVAL; + return -1; + } + if (!count) + return 0; + /* Locate to position. */ + if (lseek(fd, pos, SEEK_SET) == (off_t)-1) { + Dprintf("ntfs_pwrite: lseek to 0x%Lx returned error: %s\n", + pos, strerror(errno)); + return -1; + } + /* Write the data. */ + for (total = 0; count; count -= written, total += written) { + written = write(fd, (char*)b + total, count); + /* If everything ok, continue. */ + if (written > 0) + continue; + /* + * If nothing written or error return number of bytes written. + */ + if (!written || total) + break; + /* Nothing written and error, return error status. */ + return written; + } + /* Sync write to disk. */ + if (fdatasync(fd) == -1) + return -1; + /* Finally, return the number of bytes written. */ + return total; +} + +/** + * ntfs_mst_pread - multi sector transfer (mst) positioned read + * @fd: file descriptor to read from + * @pos: position in file descriptor to read from + * @count: number of blocks to read + * @bksize: size of each block that needs mst deprotecting + * @b: output data buffer + * + * Multi sector transfer (mst) positioned read. This function will read @count + * blocks of size @bksize bytes each from file descriptor @fd at position @pos + * into the data buffer @b. + * + * On success, return the number of successfully read blocks. If this number is + * lower than @count this means that we have reached end of file, that the read + * was interrupted, or that an error was encountered during the read so that + * the read is partial. 0 means end of file or nothing was read (also return 0 + * when @count or @bksize are 0). + * + * On error and nothing was read, return -1 with errno set appropriately to the + * return code of either lseek, read, or set to EINVAL in case of invalid + * arguments. + * + * NOTE: If an incomplete multi sector transfer has been detected the magic + * will have been changed to magic_BAAD but no error will be returned. Thus it + * is possible that we return count blocks as being read but that any number + * (between zero and count!) of these blocks is actually subject to a multi + * sector transfer error. This should be detected by the caller by checking for + * the magic being "BAAD". + */ +s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, + const u32 bksize, const void *b) +{ + s64 br, i; + + if (bksize & (bksize - 1) || bksize % NTFS_SECTOR_SIZE) { + errno = EINVAL; + return -1; + } + /* Do the read. */ + br = ntfs_pread(fd, pos, count * bksize, b); + if (br < 0) + return br; + /* + * Apply fixups to successfully read data, disregarding any errors + * returned from the MST fixup function. This is because we want to + * fixup everything possible and we rely on the fact that the "BAAD" + * magic will be detected later on. + */ + count = br / bksize; + for (i = 0; i < count; ++i) + ntfs_post_read_mst_fixup((NTFS_RECORD*)(b + i * bksize), + bksize); + /* Finally, return the number of complete blocks read. */ + return count; +} + +/** + * ntfs_mst_pwrite - multi sector transfer (mst) positioned write + * @fd: file descriptor to write to + * @pos: position in file descriptor to write to + * @count: number of blocks to write + * @bksize: size of each block that needs mst protecting + * @b: data buffer to write to disk + * + * Multi sector transfer (mst) positioned write. This function will write + * @count blocks of size @bksize bytes each from data buffer @b to file + * descriptor @fd at position @pos. + * + * On success, return the number of successfully written blocks. If this number + * is lower than @count this means that the write has been interrutped or that + * an error was encountered during the write so that the write is partial. 0 + * means nothing was written (also return 0 when @count or @bksize are 0). + * + * On error and nothing has been written, return -1 with errno set + * appropriately to the return code of either lseek, write, fdatasync, or set + * to EINVAL in case of invalid arguments. + * + * NOTE: We mst protect the data, write it, then mst deprotect it using a quick + * deprotect algorithm (no checking). This saves us from making a copy before + * the write and at the same time causes the usn to be incremented in the + * buffer. This conceptually fits in better with the idea that cached data is + * always deprotected and protection is performed when the data is actually + * going to hit the disk and the cache is immediately deprotected again + * simulating an mst read on the written data. This way cache coherency is + * achieved. + */ +s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, + const u32 bksize, const void *b) +{ + s64 written, i; + + if (count < 0 || bksize % NTFS_SECTOR_SIZE) { + errno = EINVAL; + return -1; + } + if (!count) + return 0; + /* Prepare data for writing. */ + for (i = 0; i < count; ++i) { + int err; + + err = ntfs_pre_write_mst_fixup((NTFS_RECORD*)(b + i * bksize), + bksize); + if (err < 0) { + /* Abort write at this position. */ + if (!i) + return err; + count = i; + break; + } + } + /* Write the prepared data. */ + written = ntfs_pwrite(fd, pos, count * bksize, b); + /* Quickly deprotect the data again. */ + for (i = 0; i < count; ++i) + ntfs_post_write_mst_fixup((NTFS_RECORD*)(b + i * bksize)); + if (written <= 0) + return written; + /* Finally, return the number of complete blocks written. */ + return written / bksize; +} + +/** + * ntfs_read_clusters - read ntfs clusters + * @vol: volume to read from + * @lcn: starting logical cluster number + * @count: number of clusters to read + * @b: output data buffer + * + * Read @count ntfs clusters starting at logical cluster number @lcn from + * volume @vol into buffer @b. Return number of clusters read or -1 on error, + * with errno set to the error code. + */ +s64 ntfs_read_clusters(const ntfs_volume *vol, const s64 lcn, + const s64 count, const void *b) +{ + s64 br; + + if (!vol || lcn < 0 || count < 0) { + errno = EINVAL; + return -1; + } + if (vol->nr_clusters <= lcn + count) { + errno = ESPIPE; + return -1; + } + br = ntfs_pread(vol->fd, lcn << vol->cluster_size_bits, + count << vol->cluster_size_bits, b); + if (br < 0) { + Dperror("Error reading cluster(s)"); + return br; + } + return br >> vol->cluster_size_bits; +} + +/** + * ntfs_write_clusters - write ntfs clusters + * @vol: volume to write to + * @lcn: starting logical cluster number + * @count: number of clusters to write + * @b: data buffer to write to disk + * + * Write @count ntfs clusters starting at logical cluster number @lcn from + * buffer @b to volume @vol. Return the number of clusters written or -1 on + * error, with errno set to the error code. + */ +s64 ntfs_write_clusters(const ntfs_volume *vol, const s64 lcn, + const s64 count, const void *b) +{ + s64 bw; + + if (!vol || lcn < 0 || count < 0) { + errno = EINVAL; + return -1; + } + if (vol->nr_clusters <= lcn + count) { + errno = ESPIPE; + return -1; + } + bw = ntfs_pwrite(vol->fd, lcn << vol->cluster_size_bits, + count << vol->cluster_size_bits, b); + if (bw < 0) { + Dperror("Error writing cluster(s)"); + return bw; + } + return bw >> vol->cluster_size_bits; +} + From 6593450759f1ad1171c7f040a26f29ebcaa0b7f7 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0086/2994] whitespace and include guards 2002/07/08 06:23:22-00:00 !antona Don't use string concatenation with __FUNCTION__ as gcc-3.x don't like it. 2002/07/07 19:44:57-00:00 !antona Change ntfs_read_file_record() not to abort if the inode is not in use. Adapt callers which care to check this themselves. 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/08 14:12:01-00:00 !antona ntfs_readdir() has arrived. 2002/06/05 20:32:53-00:00 !antona Mft mirror now updated from ntfs_write_mft_record, yey! Fixup ntfstools accordingly. 2002/06/01 00:41:45-00:00 !antona huge update! 2002/04/27 19:49:09-00:00 !antona Update library, new APIs ntfs_attr_find_vcn(), misc fixes and cleanups, make all the utilities compile, fix bugs I noticed in ntfslabel and it now works properly. 2002/04/24 23:47:42-00:00 !antona Hammer out the API for run list merging. Add calls for low level (using raw run lists and ATTR_RECORDs as parameters) run list merging, mappaing pairs decompression, and vcn to lcn conversion as well as high level (using ntfs_attr as parameter) calls for run list mapping and vcn to lcn conversion. 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/20 01:53:02-00:00 !antona Rename mft code adding ntfs_ prefix. Change all return values to zero on success. Thanks to mattjf for pointing out the inconsistencies. 2002/04/16 12:13:53-00:00 !antona New API function mft.[ch]::read_file_record(). Also some cleanups. 2002/04/15 20:04:27-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/15 19:02:40-00:00 !antona Really fix the library and mkntfs while at it. 2002/04/15 18:54:07-00:00 !antona Update library for the new API. 2002/04/15 18:39:37-00:00 !antona Cleanup some mistakes. 2002/04/15 17:51:26-00:00 !antona read/write_mft_record(s) are here 2002/04/15 00:42:07-00:00 !antona Big rewrite of disk_io.c. Now should have stable API for low level disk access. Move all mft record related stuff from disk_io.c to mft.c. 2002/04/14 14:08:30-00:00 !antona Cleanup library code. Throw away unused stuff. 2002/04/14 13:34:49-00:00 !antona Throw away all unnecessary crap. 2001/12/15 05:13:08-00:00 !antona Remove atomic ops and add compiler version check. 2001/06/01 02:07:26-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 14:29:12-00:00 !antona Almost fixed compilaton. Remember to declare a struct type with struct NAME { declaration }; rather than the bogus struct { declaration NAME }; then can use typedef NAME othername; on a forward declaration of NAME (struct NAME;) and all is fine... 2001/04/11 11:49:16-00:00 !antona Header file reorganisation so that it compiles. 2001/04/10 23:37:19-00:00 !antona Ok, ntfsd was a mistake for userspace. It increases complexity no end while not giving us much functionality. Lets get it working and then worry about the kernel. - As it was the idea originally anyway, so this is just a return on the right track. (-8 We keep the timer and signal handler but the only thing we do is to set a bool flag (ntfs_need_sync) and we will just check this in appropriate places and if it is true we call ntfs_sync_volumes() which sets it back to false. This means no more locking at all of any description and no need to worry about the signal handler interrupting things in bad ways and/or at bad times in the main code. 2001/04/09 00:05:37-00:00 !antona More or less finished file handling. (Probably some useful functions are still missing but they will be implemented as need arises.) One thing that is stupid at the moment is we don't limit the amount of cached mft_records so if you were to load loads the machine would eventually run out of memory... Can't happen with files as they are limited to 1000, unless you are short of memory. (Hard limit at the moment, set in ntfs_mount(). Maybe ntfsd should be monitoring memory usage and be throwing out unused cache entries and closed_files? That would mean to have locking everywhere, though.) Still missing: - Convert old code to use new stuff. - Add non-resident attributes somewhere. Either into the mft_entry structure or into the ntfs_file structure, but which? At the moment I tend to mft_entry so they can be synced together with the entries by ntfsd. 2001/04/08 01:58:29-00:00 !antona User space conversion of locking complete. I settled for using simple spinlocks and atomic variables and instead of deadlocking/livelocking when using spin_lock(), use spin_trylock() in a while letting go of the cpu between each call and making a maximum of 100 iterations (or we return EDEADLK error code). This is not the most efficient way, especially as can't have multiple readers but it is the simplest way to go about things. Should now have (almost) all required helper functions for dealing with mft entries implemented. Now need the file handling and then convert the whole project to use the new code and then can finally get back to work on attribute searching... 2001/04/05 20:14:45-00:00 !antona Commit of current state of development including locking a la kernel. This doesn't work on user space (semaphores don't work). Just want to have it committed. Will take out locking / modify it where necessary to use pthreads ASAP. 2001/04/03 23:38:34-00:00 !antona Mark mft entry dirty function complete 2001/03/05 03:04:40-00:00 !antona Corresponding changes to the library. 2001/01/25 22:25:43-00:00 !antona More files added to ntfs lib. Fixed some consistency problems. (Logical change 1.5) --- libntfs/mft.c | 235 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 235 insertions(+) diff --git a/libntfs/mft.c b/libntfs/mft.c index e69de29b..16d66ca7 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -0,0 +1,235 @@ +/* + * $Id$ + * + * mft.c - Mft record handling code. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include + +#include "mft.h" +#include "disk_io.h" +#include "debug.h" +#include "bitmap.h" +#include "attrib.h" + +/** + * ntfs_read_mft_records - read records from the mft from disk + * @vol: volume to read from + * @mref: starting mft record number to read + * @count: number of mft records to read + * @b: output data buffer + * + * Read @count mft records starting at @mref from volume @vol into buffer + * @b. Return 0 on success or -1 on error, with errno set to the error + * code. + * + * The read mft records are mst deprotected and are hence ready to use. The + * caller should check each record with is_baad_record() in case mst + * deprotection failed. + * + * NOTE: @b has to be at least of size @count * vol->mft_record_size. + */ +int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref, + const s64 count, MFT_RECORD *b) +{ + s64 br; + VCN m; + + Dprintf("%s(): Entering for inode 0x%Lx.\n", __FUNCTION__, MREF(mref)); + if (!vol || !vol->mft_na || !b || count < 0) { + errno = EINVAL; + return -1; + } + m = MREF(mref); + if (m + count > vol->nr_mft_records) { + errno = ESPIPE; + return -1; + } + br = ntfs_attr_mst_pread(vol->mft_na, m << vol->mft_record_size_bits, + count, vol->mft_record_size, b); + if (br != count) { + if (br != -1) + errno = EIO; + if (br >= 0) + Dputs("Error: partition is smaller than it should be!"); + else + Dperror("Error reading $Mft record(s)"); + return -1; + } + return 0; +} + +/** + * ntfs_write_mft_records - write mft records to disk + * @vol: volume to write to + * @mref: starting mft record number to write + * @count: number of mft records to write + * @b: data buffer containing the mft records to write + * + * Write @count mft records starting at @mref from data buffer @b to volume + * @vol. Return 0 on success or -1 on error, with errno set to the error code. + * + * Before the mft records are written, they are mst protected. After the write, + * they are deprotected again, thus resulting in an increase in the update + * sequence number inside the data buffer @b. + * + * If any mft records are written which are also represented in the mft mirror + * $MFTMirr, we make a copy of the relevant parts of the data buffer @b into a + * temporary buffer before we do the actual write. Then if at least one mft + * record was successfully written, we write the appropriate mft records from + * the copied buffer to the mft mirror, too. + */ +int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref, + const s64 count, MFT_RECORD *b) +{ + s64 bw; + VCN m; + void *bmirr = NULL; + int cnt = 0, res = 0; + + Dprintf("%s(): Entering for inode 0x%Lx.\n", __FUNCTION__, MREF(mref)); + if (!vol || !vol->mft_na || !b || count < 0) { + errno = EINVAL; + return -1; + } + m = MREF(mref); + if (m < vol->mftmirr_size) { + cnt = vol->mftmirr_size - m; + bmirr = malloc(cnt * vol->mft_record_size); + if (!bmirr) + return -1; + memcpy(bmirr, b, cnt * vol->mft_record_size); + } + if (m + count > vol->nr_mft_records) { + // TODO: Need to extend $MFT. This is not just normal attribute + // extension as many rules need to be observed. (AIA) + if (bmirr); + free(bmirr); + errno = ENOTSUP; + return -1; + } + bw = ntfs_attr_mst_pwrite(vol->mft_na, m << vol->mft_record_size_bits, + count, vol->mft_record_size, b); + if (bw != count) { + if (bw != -1) + errno = EIO; + if (bw >= 0) + Dputs("Error: partial write while writing $Mft " + "record(s)!\n"); + else + Dperror("Error writing $Mft record(s)"); + res = errno; + } + if (bmirr && bw > 0) { + if (bw < cnt) + cnt = bw; + bw = ntfs_attr_mst_pwrite(vol->mftmirr_na, + m << vol->mft_record_size_bits, cnt, + vol->mft_record_size, bmirr); + if (bw != cnt) { + if (bw != -1) + errno = EIO; + Dputs("Error: failed to sync $MFTMirr! Run chkdsk."); + res = errno; + } + } + if (bmirr) + free(bmirr); + if (!res) + return res; + errno = res; + return -1; +} + +/** + * ntfs_read_file_record - read a FILE record from the mft from disk + * @vol: volume to read from + * @mref: mft reference specifying mft record to read + * @mrec: address of pointer in which to return the mft record + * @attr: address of pointer in which to return the first attribute + * + * Read a FILE record from the mft of @vol from the storage medium. @mref + * specifies the mft record to read, including the sequence number, which can + * be 0 if no sequence number checking is to be performed. + * + * The function allocates a buffer large enough to hold the mft record and + * reads the record into the buffer (mst deprotecting it in the process). + * *@mrec is then set to point to the buffer. + * + * If @attr is not NULL, *@attr is set to point to the first attribute in the + * mft record, i.e. *@attr is a pointer into *@mrec. + * + * Return 0 on success, or -1 on error, with errno set to the error code. + * + * The read mft record is checked for having the magic FILE, + * and for having a matching sequence number (if MSEQNO(*@mref) != 0). + * If either of these fails, -1 is returned and errno is set to EIO. If you get + * this, but you still want to read the mft record (e.g. in order to correct + * it), use ntfs_read_mft_record() directly. + * + * Note: Caller has to free *@mrec when finished. + * + * Note: We do not check if the mft record is flagged in use. The caller can + * check if desired. + */ +int ntfs_read_file_record(const ntfs_volume *vol, const MFT_REF mref, + MFT_RECORD **mrec, ATTR_RECORD **attr) +{ + MFT_RECORD *m; + ATTR_RECORD *a; + int err; + + if (!vol || !mrec) { + errno = EINVAL; + return -1; + } + m = *mrec; + if (!m) { + m = (MFT_RECORD*)malloc(vol->mft_record_size); + if (!m) + return -1; + } + if (ntfs_read_mft_record(vol, mref, m)) { + err = errno; + goto read_failed; + } + if (!is_file_record(m->magic)) + goto file_corrupt; + if (MSEQNO(mref) && MSEQNO(mref) != le16_to_cpu(m->sequence_number)) + goto file_corrupt; + a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); + if (p2n(a) < p2n(m) || (char*)a > (char*)m + vol->mft_record_size) + goto file_corrupt; + *mrec = m; + if (attr) + *attr = a; + return 0; +file_corrupt: + Dputs("ntfs_read_file_record(): file is corrupt."); + err = EIO; +read_failed: + if (m != *mrec) + free(m); + errno = err; + return -1; +} + From e1032c4b861a8b26140fbb6044c01a2388c9b70b Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0087/2994] whitespace and include guards 2002/07/08 23:27:16-00:00 !flatcap added AT_NONAME so we can search for a (un)named attribute or just iterate through all attributes 2002/07/08 06:23:22-00:00 !antona Don't use string concatenation with __FUNCTION__ as gcc-3.x don't like it. 2002/07/05 21:15:31-00:00 !uid28698 - Enable enumeration of attributes using ntfs_lookup_attr() which is requested by passing a type of AT_UNUSED (or simply zero) to ntfs_lookup_attr(). (Based on initial patch by Szakacsits Szabolcs.) - Fix two minor buglets in ntfs_find_external_attr() where we would continue the search when we detect a mismatched type and/or name instead of aborting and returning error EIO to flag the corruption. 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/04/29 01:53:55-00:00 !antona Loads of stuff. Improvements, start on attr pread and attr mst_pread. Write to follow. ntfslabel cleanup and extensions. libntfs cleanups, fixes, etc. 2002/04/28 21:59:11-00:00 !antona Cleanup. 2002/04/28 21:20:27-00:00 !mattjf ntfslabel - Coverted stoucs to ntfs_mbstoucs() - code cleanup - better error checking unistr.c - removed size_t casts from ntfs_mbstoucs() 2002/04/18 17:20:05-00:00 !antona New API function provided by unistr.[ch]: ntfs_mbstoucs() 2002/04/16 20:56:01-00:00 !antona Add new API unistr.[ch]: ntfs_ucstombs() and make ntfslabel use it 2002/04/16 15:34:32-00:00 !antona Fix the library... 2002/04/15 20:04:27-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/14 14:08:30-00:00 !antona Cleanup library code. Throw away unused stuff. 2001/06/09 16:31:13-00:00 !antona mkntfs alpha release is here! Yey! The only thing I am worried about is the fact that the system call to get the number of sectors on the device returns a value rounded to the nearest 1024 bytes (converted to 512 byte blocks) thus we might be writting the backup boot sector too early instead of on the real last sector but there is nothing I can do apart from starting to play games like accessing the main device for hds instead of the partition device which wouldn't help in the case of the last partition though... Alternatively have to place the backup boot sector in the middle of the disk like WinNT3.51 and earlier did but I need an image to see exactly how they did it and even then we have the problem of not knowing where the middle of the disk is as we don't really know how many sectors there are for real with Linux kernel lying to us. 2001/06/09 00:25:55-00:00 !antona mkntfs delayed. more reverse engineering required to determine exact method of index entry collation. first few helper functions are already done and entered into ntfslib in unistr.c 2001/06/01 02:07:26-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/03/31 15:27:34-00:00 !antona Added new name comparison function. 2001/03/07 01:17:33-00:00 !antona Renamed the unicode files and introduced more code. Finished the new find_first/next_attr() interface functions. Next on my list are functions supporting attribute lists... (Logical change 1.5) --- libntfs/unistr.c | 493 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 493 insertions(+) diff --git a/libntfs/unistr.c b/libntfs/unistr.c index e69de29b..f19a77fa 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -0,0 +1,493 @@ +/* + * $Id$ + * + * unistr.c - Unicode string handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include + +#include "types.h" +#include "unistr.h" +#include "debug.h" + +/* + * IMPORTANT + * ========= + * + * All these routines assume that the Unicode characters are in little endian + * encoding inside the strings!!! + */ + +/* + * This is used by the name collation functions to quickly determine what + * characters are (in)valid. + */ +const u8 legal_ansi_char_array[0x40] = { + 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + + 0x17, 0x07, 0x18, 0x17, 0x17, 0x17, 0x17, 0x17, + 0x17, 0x17, 0x18, 0x16, 0x16, 0x17, 0x07, 0x00, + + 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, + 0x17, 0x17, 0x04, 0x16, 0x18, 0x16, 0x18, 0x18, +}; + +/** + * ntfs_are_names_equal - compare two Unicode names for equality + * @s1: name to compare to @s2 + * @s1_len: length in Unicode characters of @s1 + * @s2: name to compare to @s1 + * @s2_len: length in Unicode characters of @s2 + * @ic: ignore case bool + * @upcase: upcase table (only if @ic == IGNORE_CASE) + * @upcase_size: length in Unicode characters of @upcase (if present) + * + * Compare the names @s1 and @s2 and return TRUE (1) if the names are + * identical, or FALSE (0) if they are not identical. If @ic is IGNORE_CASE, + * the @upcase table is used to performa a case insensitive comparison. + */ +BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len, + const uchar_t *s2, size_t s2_len, + const IGNORE_CASE_BOOL ic, + const uchar_t *upcase, const u32 upcase_size) +{ + if (s1_len != s2_len) + return FALSE; + if (!s1_len) + return 0; + if (ic == CASE_SENSITIVE) + return ntfs_ucsncmp(s1, s2, s1_len << 1) ? FALSE: TRUE; + return ntfs_ucsncasecmp(s1, s2, s1_len, upcase, upcase_size) ? FALSE: + TRUE; +} + +/** + * ntfs_collate_names - collate two Unicode names + * @upcase: upcase table (ignored if @ic is CASE_SENSITIVE) + * @upcase_len: upcase table size (ignored if @ic is CASE_SENSITIVE) + * @name1: first Unicode name to compare + * @name2: second Unicode name to compare + * @ic: either CASE_SENSITIVE or IGNORE_CASE + * @err_val: if @name1 contains an invalid character return this value + * + * ntfs_collate_names collates two Unicode names and returns: + * + * -1 if the first name collates before the second one, + * 0 if the names match, + * 1 if the second name collates before the first one, or + * @err_val if an invalid character is found in @name1 during the comparison. + * + * The following characters are considered invalid: '"', '*', '<', '>' and '?'. + */ +int ntfs_collate_names(const uchar_t *name1, const u32 name1_len, + const uchar_t *name2, const u32 name2_len, + const int err_val, const IGNORE_CASE_BOOL ic, + const uchar_t *upcase, const u32 upcase_len) +{ + u32 cnt; + uchar_t c1, c2; + +#ifdef DEBUG + if (!name1 || !name2 || (ic && !upcase && upcase_len)) { + Dputs("ntfs_collate_names received NULL pointer!"); + exit(1); + } +#endif + for (cnt = 0; cnt < min(name1_len, name2_len); ++cnt) + { + c1 = le16_to_cpu(*name1++); + c2 = le16_to_cpu(*name2++); + if (ic) { + if (c1 < upcase_len) + c1 = le16_to_cpu(upcase[c1]); + if (c2 < upcase_len) + c2 = le16_to_cpu(upcase[c2]); + } + if (c1 < 64 && legal_ansi_char_array[c1] & 8) + return err_val; + if (c1 < c2) + return -1; + if (c1 > c2) + return 1; + } + if (name1_len < name2_len) + return -1; + if (name1_len == name2_len) + return 0; + /* name1_len > name2_len */ + c1 = le16_to_cpu(*name1); + if (c1 < 64 && legal_ansi_char_array[c1] & 8) + return err_val; + return 1; +} + +/** + * ntfs_ucsncmp - compare two little endian Unicode strings + * @s1: first string + * @s2: second string + * @n: maximum unicode characters to compare + * + * Compare the first @n characters of the Unicode strings @s1 and @s2, + * The strings in little endian format and appropriate le16_to_cpu() + * conversion is performed on non-little endian machines. + * + * The function returns an integer less than, equal to, or greater than zero + * if @s1 (or the first @n Unicode characters thereof) is found, respectively, + * to be less than, to match, or be greater than @s2. + */ +int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n) +{ + uchar_t c1, c2; + size_t i; + +#ifdef DEBUG + if (!s1 || !s2) { + Dputs("ntfs_wcsncmp() received NULL pointer!"); + exit(1); + } +#endif + for (i = 0; i < n; ++i) { + c1 = le16_to_cpu(s1[i]); + c2 = le16_to_cpu(s2[i]); + if (c1 < c2) + return -1; + if (c1 > c2) + return 1; + if (!c1) + break; + } + return 0; +} + +/** + * ntfs_ucsncasecmp - compare two little endian Unicode strings, ignoring case + * @s1: first string + * @s2: second string + * @n: maximum unicode characters to compare + * @upcase: upcase table + * @upcase_size: upcase table size in Unicode characters + * + * Compare the first @n characters of the Unicode strings @s1 and @s2, + * ignoring case. The strings in little endian format and appropriate + * le16_to_cpu() conversion is performed on non-little endian machines. + * + * Each character is uppercased using the @upcase table before the comparison. + * + * The function returns an integer less than, equal to, or greater than zero + * if @s1 (or the first @n Unicode characters thereof) is found, respectively, + * to be less than, to match, or be greater than @s2. + */ +int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, + const uchar_t *upcase, const u32 upcase_size) +{ + uchar_t c1, c2; + size_t i; + +#ifdef DEBUG + if (!s1 || !s2 || !upcase) { + Dputs("ntfs_wcsncasecmp() received NULL pointer!"); + exit(1); + } +#endif + for (i = 0; i < n; ++i) { + if ((c1 = le16_to_cpu(s1[i])) < upcase_size) + c1 = le16_to_cpu(upcase[c1]); + if ((c2 = le16_to_cpu(s2[i])) < upcase_size) + c2 = le16_to_cpu(upcase[c2]); + if (c1 < c2) + return -1; + if (c1 > c2) + return 1; + if (!c1) + break; + } + return 0; +} + +/** + * ntfs_upcase_name + */ +void ntfs_upcase_name(uchar_t *name, u32 name_len, const uchar_t *upcase, + const u32 upcase_len) +{ + u32 i; + uchar_t u; + + for (i = 0; i < name_len; i++) + if ((u = le16_to_cpu(name[i])) < upcase_len) + name[i] = upcase[u]; +} + +/** + * ntfs_file_upcase_value + */ +void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr, + const uchar_t *upcase, const u32 upcase_len) +{ + ntfs_upcase_name((uchar_t*)&file_name_attr->file_name, + file_name_attr->file_name_length, upcase, upcase_len); +} + +/** + * ntfs_file_compare_values + */ +int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1, + FILE_NAME_ATTR *file_name_attr2, + const int err_val, const IGNORE_CASE_BOOL ic, + const uchar_t *upcase, const u32 upcase_len) +{ + return ntfs_collate_names((uchar_t*)&file_name_attr1->file_name, + file_name_attr1->file_name_length, + (uchar_t*)&file_name_attr2->file_name, + file_name_attr2->file_name_length, + err_val, ic, upcase, upcase_len); +} + +/** + * ntfs_ucstombs - convert a little endian Unicode string to a multibyte string + * @ins: input Unicode string buffer + * @ins_len: length of input string in Unicode characters + * @outs: on return contains the (allocated) output multibyte string + * @outs_len: length of output buffer in bytes + * + * Convert the input little endian, 2-byte Unicode string @ins, of length + * @ins_len into the multibyte string format dictated by the current locale. + * + * If *@outs is NULL, the function allocates the string and the caller is + * responsible for calling free(*@outs); when finished with it. + * + * On success the function returns the number of bytes written to the output + * string *@outs (>= 0), not counting the terminating NULL byte. If the output + * string buffer was allocated, *@outs is set to it. + * + * On error, -1 is returned, and errno is set to the error code. The following + * error codes can be expected: + * EINVAL Invalid arguments (e.g. @ins or @outs is NULL). + * EILSEQ The input string cannot be represented as a multibyte + * sequence according to the current locale. + * ENAMETOOLONG Destination buffer is too small for input string. + * ENOMEM Not enough memory to allocate destination buffer. + */ +int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, + int outs_len) +{ + char *mbs; + wchar_t wc; + int i, o, mbs_len; + int cnt = 0; + mbstate_t mbstate; + + if (!ins || !outs) { + errno = EINVAL; + return -1; + } + mbs = *outs; + mbs_len = outs_len; + if (mbs && !mbs_len) { + errno = ENAMETOOLONG; + return -1; + } + if (!mbs) { + mbs_len = (ins_len + 1) * MB_CUR_MAX; + mbs = (char*)malloc(mbs_len); + if (!mbs) + return -1; + } + memset(&mbstate, 0, sizeof(mbstate)); + for (i = o = 0; i < ins_len; i++) { + /* Reallocate memory if necessary or abort. */ + if (o + MB_CUR_MAX > mbs_len) { + char *tc; + if (mbs == *outs) { + errno = ENAMETOOLONG; + return -1; + } + tc = (char*)malloc((mbs_len + 64) & ~63); + if (!tc) + goto err_out; + memcpy(tc, mbs, mbs_len); + mbs_len = (mbs_len + 64) & ~63; + free(mbs); + mbs = tc; + } + /* Convert the LE Unicode character to a CPU wide character. */ + wc = (wchar_t)le16_to_cpu(ins[i]); + if (!wc) + break; + /* Convert the CPU endian wide character to multibyte. */ + cnt = wcrtomb(mbs + o, wc, &mbstate); + if (cnt == -1) + goto err_out; + if (cnt <= 0) { + Dprintf("Eeek. cnt <= 0, cnt = %i\n", cnt); + errno = EINVAL; + goto err_out; + } + o += cnt; + } + /* Make sure we are back in the initial state. */ + if (!mbsinit(&mbstate)) { + Dputs("Eeek. mbstate not in initial state!"); + errno = EILSEQ; + goto err_out; + } + /* Now write the NULL character. */ + mbs[o] = '\0'; + if (*outs != mbs) + *outs = mbs; + return o; +err_out: + if (mbs != *outs) { + int eo = errno; + free(mbs); + errno = eo; + } + return -1; +} + +/** + * ntfs_mbstoucs - convert a multibyte string to a little endian Unicode string + * @ins: input multibyte string buffer + * @outs: on return contains the (allocated) output Unicode string + * @outs_len: length of output buffer in Unicode characters + * + * Convert the input multibyte string @ins, from the current locale into the + * corresponding little endian, 2-byte Unicode string. + * + * If *@outs is NULL, the function allocates the string and the caller is + * responsible for calling free(*@outs); when finished with it. + * + * On success the function returns the number of Unicode characters written to + * the output string *@outs (>= 0), not counting the terminating Unicode NULL + * character. If the output string buffer was allocated, *@outs is set to it. + * + * On error, -1 is returned, and errno is set to the error code. The following + * error codes can be expected: + * EINVAL Invalid arguments (e.g. @ins or @outs is NULL). + * EILSEQ The input string cannot be represented as a Unicode + * string according to the current locale. + * ENAMETOOLONG Destination buffer is too small for input string. + * ENOMEM Not enough memory to allocate destination buffer. + */ +int ntfs_mbstoucs(char *ins, uchar_t **outs, int outs_len) +{ + uchar_t *ucs; + char *s; + wchar_t wc; + int i, o, cnt, ins_len, ucs_len; + mbstate_t mbstate; + + if (!ins || !outs) { + errno = EINVAL; + return -1; + } + ucs = *outs; + ucs_len = outs_len; + if (ucs && !ucs_len) { + errno = ENAMETOOLONG; + return -1; + } + /* Determine the length of the multi-byte string. */ + s = ins; + memset(&mbstate, 0, sizeof(mbstate)); + ins_len = mbsrtowcs(NULL, (const char **)&s, 0, &mbstate); + if (ins_len == -1) + return ins_len; + if ((s != ins) || !mbsinit(&mbstate)) { + errno = EILSEQ; + return -1; + } + /* Add the NULL terminator. */ + ins_len++; + if (!ucs) { + ucs_len = ins_len; + ucs = (uchar_t*)malloc(ucs_len * sizeof(uchar_t)); + if (!ucs) + return -1; + } + memset(&mbstate, 0, sizeof(mbstate)); + for (i = o = cnt = 0; o < ins_len; i += cnt, o++) { + /* Reallocate memory if necessary or abort. */ + if (o >= ucs_len) { + uchar_t *tc; + if (ucs == *outs) { + errno = ENAMETOOLONG; + return -1; + } + /* + * We will never get here but hey, it's only a bit of + * extra code... + */ + ucs_len = (ucs_len * sizeof(uchar_t) + 64) & ~63; + tc = (uchar_t*)realloc(ucs, ucs_len); + if (!tc) + goto err_out; + ucs = tc; + ucs_len /= sizeof(uchar_t); + } + /* Convert the multibyte character to a wide character. */ + cnt = mbrtowc(&wc, ins + i, ins_len - i, &mbstate); + if (!cnt) + break; + if (cnt == -1) + goto err_out; + if (cnt < -1) { + Dprintf("%s(): Eeek. cnt = %i\n", __FUNCTION__, cnt); + errno = EINVAL; + goto err_out; + } + /* Make sure we are not overflowing the NTFS Unicode set. */ + if ((unsigned long)wc >= (unsigned long)(1 << + (8 * sizeof(uchar_t)))) { + errno = EILSEQ; + goto err_out; + } + /* Convert the CPU wide character to a LE Unicode character. */ + ucs[o] = cpu_to_le16(wc); + } + /* Make sure we are back in the initial state. */ + if (!mbsinit(&mbstate)) { + Dprintf("%s(): Eeek. mbstate not in initial state!\n", + __FUNCTION__); + errno = EILSEQ; + goto err_out; + } + /* Now write the NULL character. */ + ucs[o] = cpu_to_le16(L'\0'); + if (*outs != ucs) + *outs = ucs; + return o; +err_out: + if (ucs != *outs) { + int eo = errno; + free(ucs); + errno = eo; + } + return -1; +} + From 91b6d82cbc4ed25caf9e9b76ccb53b0df04b2862 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0088/2994] whitespace and include guards 2002/07/11 13:18:11-00:00 !flatcap start to break up the dependency loops in the header files 2002/06/02 23:02:20-00:00 !antona More fixes and updates. 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/18 18:15:46-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 11:49:16-00:00 !antona Header file reorganisation so that it compiles. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/03/02 15:03:56-00:00 !antona Update to latest include files. 2001/01/30 12:29:03-00:00 !antona And the last move into CVS. The make files. (Note: compilation is untested and all changes have been done without testing so if it doesn't compile at the moment don't be too surprised.) 2001/01/25 22:25:43-00:00 !antona More files added to ntfs lib. Fixed some consistency problems. 2001/01/24 20:37:36-00:00 !antona Added for now last header file for boot sector handling. (Logical change 1.5) --- include/bootsect.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/include/bootsect.h b/include/bootsect.h index e69de29b..ce8b33f7 100644 --- a/include/bootsect.h +++ b/include/bootsect.h @@ -0,0 +1,48 @@ +/* + * $Id$ + * + * bootsect.h - Exports for bootsector record handling. Part of the Linux-NTFS + * project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_BOOTSECT_H +#define _NTFS_BOOTSECT_H + +#include "types.h" +#include "volume.h" +#include "layout.h" + +/** + * is_boot_sector_ntfs - check a boot sector for describing an ntfs volume + * @b: buffer containing the boot sector + * @silent: if 1 don't display progress information + * + * This function checks the boot sector in @b for describing a valid ntfs + * volume. Return TRUE if @b is a valid NTFS boot sector or FALSE otherwise. + * If silent is FALSE, progress output will be output to stdout. If silent is + * TRUE no output to stdout will occur. Errors/warnings to stderr will occur + * disregarding the value of silent (but only if configure was run with + * --enable-debug). + */ +extern BOOL is_boot_sector_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent); +extern int parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b); + +#endif /* defined _NTFS_BOOTSECT_H */ + From 8fd22f5f119bde182b1ef89463a1b8e3c3c3c931 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0089/2994] whitespace and include guards 2002/07/11 13:18:11-00:00 !flatcap start to break up the dependency loops in the header files 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/18 18:15:46-00:00 !antona Define API for bootsect.[ch]: is_boot_sector_ntfs(). 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2002/04/14 13:29:42-00:00 !antona rename ntfs_rec to mst (Logical change 1.5) --- include/mst.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/include/mst.h b/include/mst.h index e69de29b..aae84003 100644 --- a/include/mst.h +++ b/include/mst.h @@ -0,0 +1,36 @@ +/* + * $Id$ + * + * mst.h - Exports for multi sector transfer fixup functions. Part of the + * Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_MST_H +#define _NTFS_MST_H + +#include "types.h" +#include "layout.h" + +extern int ntfs_post_read_mst_fixup(NTFS_RECORD *b, const u32 size); +extern int ntfs_pre_write_mst_fixup(NTFS_RECORD *b, const u32 size); +extern void ntfs_post_write_mst_fixup(NTFS_RECORD *b); + +#endif /* defined _NTFS_MST_H */ + From a877f59d6f33d782c3b84db4b4df2fffd3a4e3e8 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0090/2994] whitespace and include guards 2002/07/11 13:18:11-00:00 !flatcap start to break up the dependency loops in the header files 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/04/29 01:53:55-00:00 !antona Loads of stuff. Improvements, start on attr pread and attr mst_pread. Write to follow. ntfslabel cleanup and extensions. libntfs cleanups, fixes, etc. 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/19 18:23:56-00:00 !antona Add foundation of new inode API. 2002/04/18 17:20:05-00:00 !antona New API function provided by unistr.[ch]: ntfs_mbstoucs() 2002/04/16 20:56:01-00:00 !antona Add new API unistr.[ch]: ntfs_ucstombs() and make ntfslabel use it 2002/04/16 15:34:32-00:00 !antona Fix the library... 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2001/06/09 00:25:55-00:00 !antona mkntfs delayed. more reverse engineering required to determine exact method of index entry collation. first few helper functions are already done and entered into ntfslib in unistr.c 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 11:49:16-00:00 !antona Header file reorganisation so that it compiles. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/03/31 15:25:19-00:00 !antona Added a name comparison function. 2001/03/07 01:17:33-00:00 !antona Renamed the unicode files and introduced more code. Finished the new find_first/next_attr() interface functions. Next on my list are functions supporting attribute lists... (Logical change 1.5) --- include/unistr.h | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/include/unistr.h b/include/unistr.h index e69de29b..2f3690cc 100644 --- a/include/unistr.h +++ b/include/unistr.h @@ -0,0 +1,63 @@ +/* + * $Id$ + * + * unistr.h - Exports for unicode string handling. Part of the Linux-NTFS + * project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_UNISTR_H +#define _NTFS_UNISTR_H + +#include "types.h" +#include "layout.h" + +extern const u8 legal_ansi_char_array[0x40]; + +extern BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len, + const uchar_t *s2, size_t s2_len, const IGNORE_CASE_BOOL ic, + const uchar_t *upcase, const u32 upcase_size); + +extern int ntfs_collate_names(const uchar_t *name1, const u32 name1_len, + const uchar_t *name2, const u32 name2_len, + const int err_val, const IGNORE_CASE_BOOL ic, + const uchar_t *upcase, const u32 upcase_len); + +extern int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n); + +extern int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, + const uchar_t *upcase, const u32 upcase_size); + +extern void ntfs_upcase_name(uchar_t *name, u32 name_len, + const uchar_t *upcase, const u32 upcase_len); + +extern void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr, + const uchar_t *upcase, const u32 upcase_len); + +extern int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1, + FILE_NAME_ATTR *file_name_attr2, + const int err_val, const IGNORE_CASE_BOOL ic, + const uchar_t *upcase, const u32 upcase_len); + +extern int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, + int outs_len); +extern int ntfs_mbstoucs(char *ins, uchar_t **outs, int outs_len); + +#endif /* defined _NTFS_UNISTR_H */ + From 481eac5ebf41d03a50761dbec00388330cd8330a Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0091/2994] whitespace and include guards 2002/07/11 13:18:11-00:00 !flatcap start to break up the dependency loops in the header files 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/01 00:41:45-00:00 !antona huge update! 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2001/12/15 05:13:08-00:00 !antona Remove atomic ops and add compiler version check. 2001/08/02 01:44:56-00:00 !antona Add ntfsfix man page and spell fixes. Update to 1.2.1 version and update all text files to go with it and the rpm spec file. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/12 22:37:20-00:00 !antona Add a description and structure for holding attributes in memory. No code to use it yet but it's a start. The design is geared with the ideas of making searching for attributes and using/implementing the search context as easy as possible, integrating the attributes into their mft_entries and maintining a fast sync volume path. Comments welcome. 2001/04/11 14:29:11-00:00 !antona Almost fixed compilaton. Remember to declare a struct type with struct NAME { declaration }; rather than the bogus struct { declaration NAME }; then can use typedef NAME othername; on a forward declaration of NAME (struct NAME;) and all is fine... 2001/04/11 11:50:24-00:00 !antona Forgot to cvs add ... (Logical change 1.5) --- include/types.h | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/include/types.h b/include/types.h index e69de29b..81352e3b 100644 --- a/include/types.h +++ b/include/types.h @@ -0,0 +1,70 @@ +/* + * $Id$ + * + * types.h - Misc type definitions not related to on-disk structure. Part of + * the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_TYPES_H +#define _NTFS_TYPES_H + +#include +#include +#include + +typedef uint8_t u8; /* Unsigned types of an exact size */ +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; + +typedef int8_t s8; /* Signed types of an exact size */ +typedef int16_t s16; +typedef int32_t s32; +typedef int64_t s64; + +typedef u16 uchar_t; /* 2-byte Unicode character type. */ +#define UCHAR_T_SIZE_BITS 1 + +/* + * Clusters are signed 64-bit values on NTFS volumes. We define two types, LCN + * and VCN, to allow for type checking and better code readability. + */ +typedef s64 VCN; +typedef s64 LCN; + +/* + * These are just to make the code more readable... + */ +typedef enum { + FALSE = 0, + NO = 0, + ZERO = 0, + TRUE = 1, + YES = 1, + ONE = 1, +} BOOL; + +typedef enum { + CASE_SENSITIVE = 0, + IGNORE_CASE = 1, +} IGNORE_CASE_BOOL; + +#endif /* defined _NTFS_TYPES_H */ + From 92b27033b01ac3910fe22e69c305d6bd0ac96ef8 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0092/2994] whitespace and include guards 2002/07/11 13:18:11-00:00 !flatcap start to break up the dependency loops in the header files 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/01 00:41:45-00:00 !antona huge update! 2002/04/27 19:49:09-00:00 !antona Update library, new APIs ntfs_attr_find_vcn(), misc fixes and cleanups, make all the utilities compile, fix bugs I noticed in ntfslabel and it now works properly. 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/20 01:53:02-00:00 !antona Rename mft code adding ntfs_ prefix. Change all return values to zero on success. Thanks to mattjf for pointing out the inconsistencies. 2002/04/16 12:13:53-00:00 !antona New API function mft.[ch]::read_file_record(). Also some cleanups. 2002/04/15 20:04:25-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2002/04/15 17:51:26-00:00 !antona read/write_mft_record(s) are here 2002/04/15 00:45:28-00:00 !antona Update headers to reflect changes in libntfs. 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2002/04/14 13:34:50-00:00 !antona Throw away all unnecessary crap. 2001/12/15 05:13:08-00:00 !antona Remove atomic ops and add compiler version check. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 14:29:11-00:00 !antona Almost fixed compilaton. Remember to declare a struct type with struct NAME { declaration }; rather than the bogus struct { declaration NAME }; then can use typedef NAME othername; on a forward declaration of NAME (struct NAME;) and all is fine... 2001/04/11 11:49:16-00:00 !antona Header file reorganisation so that it compiles. 2001/04/10 23:54:25-00:00 !antona Fixed somethings... 2001/04/10 23:37:19-00:00 !antona Ok, ntfsd was a mistake for userspace. It increases complexity no end while not giving us much functionality. Lets get it working and then worry about the kernel. - As it was the idea originally anyway, so this is just a return on the right track. (-8 We keep the timer and signal handler but the only thing we do is to set a bool flag (ntfs_need_sync) and we will just check this in appropriate places and if it is true we call ntfs_sync_volumes() which sets it back to false. This means no more locking at all of any description and no need to worry about the signal handler interrupting things in bad ways and/or at bad times in the main code. 2001/04/10 22:20:19-00:00 !antona Ok, ntfsd was a mistake for userspace. It increases complexity no end while not giving us much functionality. Lets get it working and then worry about the kernel. - As it was the idea originally anyway, so this is just a return on the right track. (-8 We keep the timer and signal handler but the only thing we do is to set a bool flag (ntfs_need_sync) and we will just check this in appropriate places and if it is true we call ntfs_sync_volumes() which sets it back to false. This means no more locking at all of any description and no need to worry about the signal handler interrupting things in bad ways and/or at bad times in the main code. 2001/04/09 00:05:37-00:00 !antona More or less finished file handling. (Probably some useful functions are still missing but they will be implemented as need arises.) One thing that is stupid at the moment is we don't limit the amount of cached mft_records so if you were to load loads the machine would eventually run out of memory... Can't happen with files as they are limited to 1000, unless you are short of memory. (Hard limit at the moment, set in ntfs_mount(). Maybe ntfsd should be monitoring memory usage and be throwing out unused cache entries and closed_files? That would mean to have locking everywhere, though.) Still missing: - Convert old code to use new stuff. - Add non-resident attributes somewhere. Either into the mft_entry structure or into the ntfs_file structure, but which? At the moment I tend to mft_entry so they can be synced together with the entries by ntfsd. 2001/04/08 01:58:29-00:00 !antona User space conversion of locking complete. I settled for using simple spinlocks and atomic variables and instead of deadlocking/livelocking when using spin_lock(), use spin_trylock() in a while letting go of the cpu between each call and making a maximum of 100 iterations (or we return EDEADLK error code). This is not the most efficient way, especially as can't have multiple readers but it is the simplest way to go about things. Should now have (almost) all required helper functions for dealing with mft entries implemented. Now need the file handling and then convert the whole project to use the new code and then can finally get back to work on attribute searching... 2001/04/05 20:14:45-00:00 !antona Commit of current state of development including locking a la kernel. This doesn't work on user space (semaphores don't work). Just want to have it committed. Will take out locking / modify it where necessary to use pthreads ASAP. 2001/04/03 23:38:54-00:00 !antona Minor fix 2001/04/03 23:35:52-00:00 !antona Few updates. 2001/04/03 22:41:30-00:00 !antona We now have files and keep track of them on a per volume basis and same for inodes (mft_records). At least conceptually anyway. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/03/31 15:25:19-00:00 !antona Added a name comparison function. 2001/03/15 23:13:11-00:00 !antona And this one... 2001/03/05 03:15:08-00:00 !antona Forgot a few... 2001/03/05 02:45:35-00:00 !antona Renamed things, broke everything. Should be stabilized now in the headers. Still reworking find attribute stuff but at least I have an idea of how I want to do it now. 2001/03/02 15:03:56-00:00 !antona Update to latest include files. 2001/01/30 12:55:21-00:00 !antona Fixed the compilation issues. 2001/01/30 12:29:03-00:00 !antona And the last move into CVS. The make files. (Note: compilation is untested and all changes have been done without testing so if it doesn't compile at the moment don't be too surprised.) 2001/01/28 05:49:57-00:00 !antona More header development. AttrDef description. 2001/01/27 14:22:02-00:00 !antona Added a logfile dumper as a new utility. Almost finished the first ntfsfix release. (Still missingin CVS are attrib.c for ntfslib and the makefiles to build everything.) Fixes for nested packed structure/union typedefs as gcc doesn't automatically nest the __attribute__ ((__packed__)), even though according to the gcc info page it does. (Thanks to Yuri Per for pointing this out.) 2001/01/24 02:13:24-00:00 !antona Add a bunch of headers (attrib.h is work in progress). (Logical change 1.5) --- include/mft.h | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/include/mft.h b/include/mft.h index e69de29b..5f8fa21b 100644 --- a/include/mft.h +++ b/include/mft.h @@ -0,0 +1,106 @@ +/* + * $Id$ + * + * mft.h - Exports for MFT record handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_MFT_H +#define _NTFS_MFT_H + +#include "volume.h" +#include "layout.h" + +extern int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref, + const s64 count, MFT_RECORD *b); + +/** + * ntfs_read_mft_record - read a record from the mft + * @vol: volume to read from + * @mref: mft record number to read + * @b: output data buffer + * + * Read the mft record specified by @mref from volume @vol into buffer @b. + * Return 0 on success or -1 on error, with errno set to the error code. + * + * The read mft record is mst deprotected and is hence ready to use. The caller + * should check the record with is_baad_record() in case mst deprotection + * failed. + * + * NOTE: @b has to be at least of size vol->mft_record_size. + */ +static __inline__ int ntfs_read_mft_record(const ntfs_volume *vol, + const MFT_REF mref, MFT_RECORD *b) +{ + return ntfs_read_mft_records(vol, mref, 1, b); +} + +extern int ntfs_read_file_record(const ntfs_volume *vol, const MFT_REF mref, + MFT_RECORD **mrec, ATTR_RECORD **attr); + +extern int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref, + const s64 count, MFT_RECORD *b); + +/** + * ntfs_write_mft_record - write an mft record to disk + * @vol: volume to write to + * @mref: mft record number to write + * @b: data buffer containing the mft record to write + * + * Write the mft record specified by @mref from buffer @b to volume @vol. + * Return 0 on success or -1 on error, with errno set to the error code. + * + * Before the mft record is written, it is mst protected. After the write, it + * is deprotected again, thus resulting in an increase in the update sequence + * number inside the buffer @b. + * + * NOTE: @b has to be at least of size vol->mft_record_size. + */ +static __inline__ int ntfs_write_mft_record(const ntfs_volume *vol, + const MFT_REF mref, MFT_RECORD *b) +{ + return ntfs_write_mft_records(vol, mref, 1, b); +} + +/** + * ntfs_get_mft_record_data_size - return number of bytes used in mft record @b + * @m: mft record to get the data size of + * + * Takes the mft record @m and returns the number of bytes used in the record + * or 0 on error (i.e. @m is not a valid mft record). Zero is not a valid size + * for an mft record as it at least has to have the MFT_RECORD, thus making the + * minimum size: + * (sizeof(MFT_RECORD) + 7) & ~7 + sizeof(ATTR_TYPES) = 52 bytes + * Aside: The 8-byte alignment and the 4 bytes for the attribute type are needed + * as each mft record has to have a list of attributes even if it only contains + * the attribute $END which doesn't contain anything else apart from its type. + * Also, you would expect every mft record to contain an update sequence array + * as well but that could in theory be non-existent (don't know if Windows' + * NTFS driver/chkdsk wouldn't view this as corruption in itself though). + */ +static __inline__ u32 ntfs_get_mft_record_data_size(const MFT_RECORD *m) +{ + if (!m || !is_mft_record(m->magic)) + return 0; + /* Get the number of used bytes and return it. */ + return le32_to_cpu(m->bytes_in_use); +} + +#endif /* defined _NTFS_MFT_H */ + From 258d79f07aec1b371d9802fe502737bc35816062 Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0093/2994] whitespace and include guards 2002/07/11 13:18:11-00:00 !flatcap start to break up the dependency loops in the header files 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/30 17:02:41-00:00 !flatcap typos 2002/06/08 14:12:01-00:00 !antona ntfs_readdir() has arrived. 2002/06/05 00:29:18-00:00 !antona Make ntfs_attr_pread work with resident attributes and start on ntfs_attr_pwrite (incomplete!). 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/16 12:13:52-00:00 !antona New API function mft.[ch]::read_file_record(). Also some cleanups. 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2001/12/15 05:13:08-00:00 !antona Remove atomic ops and add compiler version check. 2001/11/17 02:03:14-00:00 !antona Update layout.h attribute compression description. 2001/11/09 18:24:32-00:00 !antona Updates to docs, layout.h and ntfsfix to support Windows XP NTFS 2001/09/03 22:01:08-00:00 !antona Small clarifications to file attribute flags. 2001/08/27 16:58:07-00:00 !antona Updates. 2001/07/13 13:55:30-00:00 !antona Updates to layout.h. 2001/06/14 15:41:41-00:00 !antona Add comments for Windows XP ntfs changes in mft record header structure. 2001/06/09 00:25:55-00:00 !antona mkntfs delayed. more reverse engineering required to determine exact method of index entry collation. first few helper functions are already done and entered into ntfslib in unistr.c 2001/06/08 19:58:24-00:00 !antona getting closer to mkntfs alpha. 2001/06/06 22:55:49-00:00 !antona And some more mkntfs + some updates to layout.h concerning directories and alignment requirements. 2001/06/04 14:04:30-00:00 !antona More work on mkntfs dir stuff. 2001/06/04 11:29:45-00:00 !antona *** empty log message *** 2001/06/03 02:09:08-00:00 !antona Fix/expand dircetory info in layout.h and add creation of index root attribute to mkntfs.c. 2001/06/01 19:04:08-00:00 !antona Updates & fixes. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 11:50:24-00:00 !antona Forgot to cvs add ... (Logical change 1.5) --- include/layout.h | 2196 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2196 insertions(+) diff --git a/include/layout.h b/include/layout.h index e69de29b..8a3602a6 100644 --- a/include/layout.h +++ b/include/layout.h @@ -0,0 +1,2196 @@ +/* + * $Id$ + * + * layout.h - Ntfs on-disk layout structures. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_LAYOUT_H +#define _NTFS_LAYOUT_H + +#include "types.h" +#include "endians.h" +#include "support.h" + +/* The NTFS oem_id */ +#define magicNTFS const_cpu_to_le64(0x202020205346544e) /* "NTFS " */ + +/* + * Location of bootsector on partition: + * The standard NTFS_BOOT_SECTOR is on sector 0 of the partition. + * On NT4 and above there is one backup copy of the boot sector to + * be found on the last sector of the partition (not normally accessible + * from within Windows as the bootsector contained number of sectors + * value is one less than the actual value!). + * On versions of NT 3.51 and earlier, the backup copy was located at + * number of sectors/2 (integer divide), i.e. in the middle of the volume. + */ + +/* + * BIOS parameter block (bpb) structure. + */ +typedef struct { + u16 bytes_per_sector; /* Size of a sector in bytes. */ + u8 sectors_per_cluster; /* Size of a cluster in sectors. */ + u16 reserved_sectors; /* zero */ + u8 fats; /* zero */ + u16 root_entries; /* zero */ + u16 sectors; /* zero */ + u8 media_type; /* 0xf8 = hard disk */ + u16 sectors_per_fat; /* zero */ + u16 sectors_per_track; /* irrelevant */ + u16 heads; /* irrelevant */ + u32 hidden_sectors; /* zero */ + u32 large_sectors; /* zero */ +/* sizeof() = 25 (0x19) bytes */ +} __attribute__ ((__packed__)) BIOS_PARAMETER_BLOCK; + +/* + * NTFS boot sector structure. + */ +typedef struct { + u8 jump[3]; /* Irrelevant (jump to boot up code).*/ + u64 oem_id; /* Magic "NTFS ". */ + BIOS_PARAMETER_BLOCK bpb; /* See BIOS_PARAMETER_BLOCK. */ + u8 unused[4]; /* zero, NTFS diskedit.exe states that + this is actually: + u8 physical_drive; // 0x80 + u8 current_head; // zero + u8 extended_boot_signature; // 0x80 + u8 unused; // zero + */ +/*0x28*/s64 number_of_sectors; /* Number of sectors in volume. Gives + maximum volume size of 2^63 sectors. + Assuming standard sector size of 512 + bytes, the maximum byte size is + approx. 4.7x10^21 bytes. (-; */ + s64 mft_lcn; /* Cluster location of mft data. */ + s64 mftmirr_lcn; /* Cluster location of copy of mft. */ + s8 clusters_per_mft_record; /* Mft record size in clusters. */ + u8 reserved0[3]; /* zero */ + s8 clusters_per_index_record; /* Index block size in clusters. */ + u8 reserved1[3]; /* zero */ + u64 volume_serial_number; /* Irrelevant (serial number). */ + u32 checksum; /* Boot sector checksum. */ +/*0x54*/u8 bootstrap[426]; /* Irrelevant (boot up code). */ + u16 end_of_sector_marker; /* End of bootsector magic. Always is + 0xaa55 in little endian. */ +/* sizeof() = 512 (0x200) bytes */ +} __attribute__ ((__packed__)) NTFS_BOOT_SECTOR; + +/* + * Magic identifiers present at the beginning of all ntfs record containing + * records (like mft records for example). + */ +typedef enum { + magic_BAAD = const_cpu_to_le32(0x44414142), /* BAAD == corrupt record */ + magic_CHKD = const_cpu_to_le32(0x424b4843), /* CHKD == chkdsk ??? */ + magic_FILE = const_cpu_to_le32(0x454c4946), /* FILE == mft entry */ + magic_HOLE = const_cpu_to_le32(0x454c4f48), /* HOLE == ? (NTFS 3.0+?) */ + magic_INDX = const_cpu_to_le32(0x58444e49), /* INDX == index buffer */ +} NTFS_RECORD_TYPES; + +/* + * Generic magic comparison macros. Finally found a use for the ## preprocessor + * operator! (-8 + */ +#define is_magic(x, m) ( (u32)(x) == (u32)magic_##m ) +#define is_magicp(p, m) ( *(u32*)(p) == (u32)magic_##m ) + +/* + * Specialised magic comparison macros. + */ +#define is_baad_record(x) ( is_magic (x, BAAD) ) +#define is_baad_recordp(p) ( is_magicp(p, BAAD) ) +#define is_chkd_record(x) ( is_magic (x, CHKD) ) +#define is_chkd_recordp(p) ( is_magicp(p, CHKD) ) +#define is_file_record(x) ( is_magic (x, FILE) ) +#define is_file_recordp(p) ( is_magicp(p, FILE) ) +#define is_hole_record(x) ( is_magic (x, HOLE) ) +#define is_hole_recordp(p) ( is_magicp(p, HOLE) ) +#define is_indx_record(x) ( is_magic (x, INDX) ) +#define is_indx_recordp(p) ( is_magicp(p, INDX) ) + +#define is_mft_record(x) ( is_file_record(x) ) +#define is_mft_recordp(p) ( is_file_recordp(p) ) + +/* + * Defines for the NTFS filesystem. Don't want to use BLOCK_SIZE and + * BLOCK_SIZE_BITS from the kernel as that is 1024 and hence too high for us. + */ +#define NTFS_SECTOR_SIZE 512 +#define NTFS_SECTOR_SIZE_BITS 9 + +/* + * The Update Sequence Array (usa) is an array of the u16 values which belong + * to the end of each sector protected by the update sequence record in which + * this array is contained. Note that the first entry is the Update Sequence + * Number (usn), a cyclic counter of how many times the protected record has + * been written to disk. The values 0 and -1 (ie. 0xffff) are not used. All + * last u16's of each sector have to be equal to the usn (during reading) or + * are set to it (during writing). If they are not, an incomplete multi sector + * transfer has occured when the data was written. + * The maximum size for the update sequence array is fixed to: + * maximum size = usa_ofs + (usa_count * 2) = 510 bytes + * The 510 bytes comes from the fact that the last u16 in the array has to + * (obviously) finish before the last u16 of the first 512-byte sector. + * This formula can be used as a consistency check in that usa_ofs + + * (usa_count * 2) has to be less than or equal to 510. + */ +typedef struct { + NTFS_RECORD_TYPES magic;/* A four-byte magic identifying the + record type and/or status. */ + u16 usa_ofs; /* Offset to the Update Sequence Array (usa) + from the start of the ntfs record. */ + u16 usa_count; /* Number of u16 sized entries in the usa + including the Update Sequence Number (usn), + thus the number of fixups is the usa_count + minus 1. */ +} __attribute__ ((__packed__)) NTFS_RECORD; + +/* + * System files mft record numbers. All these files are always marked as used + * in the bitmap attribute of the mft; presumably in order to avoid accidental + * allocation for random other mft records. Also, the sequence number for each + * of the system files is always equal to their mft record number and it is + * never modified. + */ +typedef enum { + FILE_MFT = 0, /* Master file table (mft). Data attribute + contains the entries and bitmap attribute + records which ones are in use (bit==1). */ + FILE_MFTMirr = 1, /* Mft mirror: copy of first four mft records + in data attribute. If cluster size > 4kiB, + copy of first N mft records, with + N = cluster_size / mft_record_size. */ + FILE_LogFile = 2, /* Journalling log in data attribute. */ + FILE_Volume = 3, /* Volume name attribute and volume information + attribute (flags and ntfs version). Windows + refers to this file as volume DASD (Direct + Access Storage Device). */ + FILE_AttrDef = 4, /* Array of attribute definitions in data + attribute. */ + FILE_root = 5, /* Root directory. */ + FILE_Bitmap = 6, /* Allocation bitmap of all clusters (lcns) in + data attribute. */ + FILE_Boot = 7, /* Boot sector (always at cluster 0) in data + attribute. */ + FILE_BadClus = 8, /* Contains all bad clusters in the non-resident + data attribute. */ + FILE_Secure = 9, /* Shared security descriptors in data attribute + and two indexes into the descriptors. + Appeared in Windows 2000. Before that, this + file was named $Quota but was unused. */ + FILE_UpCase = 10, /* Uppercase equivalents of all 65536 Unicode + characters in data attribute. */ + FILE_Extend = 11, /* Directory containing other system files (eg. + $ObjId, $Quota, $Reparse and $UsnJrnl). This + is new to NTFS3.0. */ + FILE_reserved12 = 12, /* Reserved for future use (records 12-15). */ + FILE_reserved13 = 13, + FILE_reserved14 = 14, + FILE_reserved15 = 15, + FILE_first_user = 16, /* First user file, used as test limit for + whether to allow opening a file or not. */ +} NTFS_SYSTEM_FILES; + +/* + * These are the so far known MFT_RECORD_* flags (16-bit) which contain + * information about the mft record in which they are present. + */ +typedef enum { + MFT_RECORD_IN_USE = const_cpu_to_le16(0x0001), + MFT_RECORD_IS_DIRECTORY = const_cpu_to_le16(0x0002), + MFT_REC_SPACE_FILLER = 0xffff /* Just to make flags 16-bit. */ +} __attribute__ ((__packed__)) MFT_RECORD_FLAGS; + +/* + * mft references (aka file references or file record segment references) are + * used whenever a structure needs to refer to a record in the mft. + * + * A reference consists of a 48-bit index into the mft and a 16-bit sequence + * number used to detect stale references. + * + * For error reporting purposes we treat the 48-bit index as a signed quantity. + * + * The sequence number is a circular counter (skipping 0) describing how many + * times the referenced mft record has been (re)used. This has to match the + * sequence number of the mft record being referenced, otherwise the reference + * is considered stale and removed (FIXME: only ntfsck or the driver itself?). + * + * If the sequence number is zero it is assumed that no sequence number + * consistency checking should be performed. + * + * FIXME: Since inodes are 32-bit as of now, the driver needs to always check + * for high_part being 0 and if not either BUG(), cause a panic() or handle + * the situation in some other way. This shouldn't be a problem as a volume has + * to become HUGE in order to need more than 32-bits worth of mft records. + * Assuming the standard mft record size of 1kb only the records (never mind + * the non-resident attributes, etc.) would require 4Tb of space on their own + * for the first 32 bits worth of records. This is only if some strange person + * doesn't decide to foul play and make the mft sparse which would be a really + * horrible thing to do as it would trash our current driver implementation. )-: + * Do I hear screams "we want 64-bit inodes!" ?!? (-; + * + * FIXME: The mft zone is defined as the first 12% of the volume. This space is + * reserved so that the mft can grow contiguously and hence doesn't become + * fragmented. Volume free space includes the empty part of the mft zone and + * when the volume's free 88% are used up, the mft zone is shrunk by a factor + * of 2, thus making more space available for more files/data. This process is + * repeated everytime there is no more free space except for the mft zone until + * there really is no more free space. + */ + +/* + * Typedef the MFT_REF as a 64-bit value for easier handling. + * Also define two unpacking macros to get to the reference (MREF) and + * sequence number (MSEQNO) respectively. + * The _LE versions are to be applied on little endian MFT_REFs. + * Note: The _LE versions will return a CPU endian formatted value! + */ +typedef enum { + MFT_REF_MASK_CPU = 0x0000ffffffffffffULL, + MFT_REF_MASK_LE = const_cpu_to_le64(0x0000ffffffffffffULL), +} MFT_REF_CONSTS; + +typedef u64 MFT_REF; + +#define MK_MREF(m, s) ((MFT_REF)(((MFT_REF)(s) << 48) | \ + ((MFT_REF)(m) & MFT_REF_MASK_CPU))) + +#define MREF(x) ((u64)((x) & MFT_REF_MASK_CPU)) +#define MSEQNO(x) ((u16)(((x) >> 48) & 0xffff)) +#define MREF_LE(x) ((u64)(const_le64_to_cpu(x) & MFT_REF_MASK_CPU)) +#define MSEQNO_LE(x) ((u16)((const_le64_to_cpu(x) >> 48) & 0xffff)) + +#define IS_ERR_MREF(x) (((x) & 0x0000800000000000ULL) ? 1 : 0) +#define ERR_MREF(x) ((u64)((s64)(x))) +#define MREF_ERR(x) ((int)((s64)(x))) + +/* + * The mft record header present at the beginning of every record in the mft. + * This is followed by a sequence of variable length attribute records which + * is terminated by an attribute of type AT_END which is a truncated attribute + * in that it only consists of the attribute type code AT_END and none of the + * other members of the attribute structure are present. + */ +typedef struct { +/*Ofs*/ +/* 0*/ NTFS_RECORD; /* Usually the magic is "FILE". */ +/* 8*/ u64 lsn; /* $LogFile sequence number for this record. + Changed every time the record is modified. */ +/* 16*/ u16 sequence_number; /* Number of times this mft record has been + reused. (See description for MFT_REF + above.) NOTE: The increment (skipping zero) + is done when the file is deleted. NOTE: If + this is zero it is left zero. */ +/* 18*/ u16 link_count; /* Number of hard links, i.e. the number of + directory entries referencing this record. + NOTE: Only used in mft base records. + NOTE: When deleting a directory entry we + check the link_count and if it is 1 we + delete the file. Otherwise we delete the + FILE_NAME_ATTR being referenced by the + directory entry from the mft record and + decrement the link_count. + FIXME: Careful with Win32 + DOS names! */ +/* 20*/ u16 attrs_offset; /* Byte offset to the first attribute in this + mft record from the start of the mft record. + NOTE: Must be aligned to 8-byte boundary. */ +/* 22*/ MFT_RECORD_FLAGS flags; /* Bit array of MFT_RECORD_FLAGS. When a file + is deleted, the MFT_RECORD_IN_USE flag is + set to zero. */ +/* 24*/ u32 bytes_in_use; /* Number of bytes used in this mft record. + NOTE: Must be aligned to 8-byte boundary. */ +/* 28*/ u32 bytes_allocated; /* Number of bytes allocated for this mft + record. This should be equal to the mft + record size. */ +/* 32*/ MFT_REF base_mft_record; /* This is zero for base mft records. + When it is not zero it is a mft reference + pointing to the base mft record to which + this record belongs (this is then used to + locate the attribute list attribute present + in the base record which describes this + extension record and hence might need + modification when the extension record + itself is modified, also locating the + attribute list also means finding the other + potential extents, belonging to the non-base + mft record). */ +/* 40*/ u16 next_attr_instance; /* The instance number that will be + assigned to the next attribute added to this + mft record. NOTE: Incremented each time + after it is used. NOTE: Every time the mft + record is reused this number is set to zero. + NOTE: The first instance number is always 0. + */ +/* sizeof() = 42 bytes */ +/* NTFS 3.1+ (Windows XP and above) introduce the following additions. */ +/* 42*/ //u16 reserved; /* Reserved/alignment. */ +/* 44*/ //u32 mft_record_number; /* Number of this mft record. */ +/* sizeof() = 48 bytes */ +/* + * When (re)using the mft record, we place the update sequence array at this + * offset, i.e. before we start with the attributes. This also makes sense, + * otherwise we could run into problems with the update sequence array + * containing in itself the last two bytes of a sector which would mean that + * multi sector transfer protection wouldn't work. As you can't protect data + * by overwriting it since you then can't get it back... + * When reading we obviously use the data from the ntfs record header. + */ +} __attribute__ ((__packed__)) MFT_RECORD; + +/* + * System defined attributes (32-bit). Each attribute type has a corresponding + * attribute name (Unicode string of maximum 64 character length) as described + * by the attribute definitions present in the data attribute of the $AttrDef + * system file. On NTFS 3.0 volumes the names are just as the types are named + * in the below enum exchanging AT_ for the dollar sign ($). If that isn't a + * revealing choice of symbol... (-; + */ +typedef enum { + AT_UNUSED = const_cpu_to_le32( 0), + AT_STANDARD_INFORMATION = const_cpu_to_le32( 0x10), + AT_ATTRIBUTE_LIST = const_cpu_to_le32( 0x20), + AT_FILE_NAME = const_cpu_to_le32( 0x30), + AT_OBJECT_ID = const_cpu_to_le32( 0x40), + AT_SECURITY_DESCRIPTOR = const_cpu_to_le32( 0x50), + AT_VOLUME_NAME = const_cpu_to_le32( 0x60), + AT_VOLUME_INFORMATION = const_cpu_to_le32( 0x70), + AT_DATA = const_cpu_to_le32( 0x80), + AT_INDEX_ROOT = const_cpu_to_le32( 0x90), + AT_INDEX_ALLOCATION = const_cpu_to_le32( 0xa0), + AT_BITMAP = const_cpu_to_le32( 0xb0), + AT_REPARSE_POINT = const_cpu_to_le32( 0xc0), + AT_EA_INFORMATION = const_cpu_to_le32( 0xd0), + AT_EA = const_cpu_to_le32( 0xe0), + AT_PROPERTY_SET = const_cpu_to_le32( 0xf0), + AT_LOGGED_UTILITY_STREAM = const_cpu_to_le32( 0x100), + AT_FIRST_USER_DEFINED_ATTRIBUTE = const_cpu_to_le32( 0x1000), + AT_END = const_cpu_to_le32(0xffffffff), +} ATTR_TYPES; + +/* + * The collation rules for sorting views/indexes/etc (32-bit). + * + * COLLATION_UNICODE_STRING - Collate Unicode strings by comparing their binary + * Unicode values, except that when a character can be uppercased, the + * upper case value collates before the lower case one. + * COLLATION_FILE_NAME - Collate file names as Unicode strings. The collation + * is done very much like COLLATION_UNICODE_STRING. In fact I have no idea + * what the difference is. Perhaps the difference is that file names + * would treat some special characters in an odd way (see + * unistr.c::ntfs_collate_names() and unistr.c::legal_ansi_char_array[] + * for what I mean but COLLATION_UNICODE_STRING would not give any special + * treatment to any characters at all, but this is speculation. + * COLLATION_NTOFS_ULONG - Sorting is done according to ascending u32 key + * values. E.g. used for $SII index in FILE_Secure, which sorts by + * security_id (u32). + * COLLATION_NTOFS_SID - Sorting is done according to ascending SID values. + * E.g. used for $O index in FILE_Extend/$Quota. + * COLLATION_NTOFS_SECURITY_HASH - Sorting is done first by ascending hash + * values and second by ascending security_id values. E.g. used for $SDH + * index in FILE_Secure. + * COLLATION_NTOFS_ULONGS - Sorting is done according to a sequence of ascending + * u32 key values. E.g. used for $O index in FILE_Extend/$ObjId, which + * sorts by object_id (16-byte), by splitting up the object_id in four + * u32 values and using them as individual keys. E.g. take the following + * two security_ids, stored as follows on disk: + * 1st: a1 61 65 b7 65 7b d4 11 9e 3d 00 e0 81 10 42 59 + * 2nd: 38 14 37 d2 d2 f3 d4 11 a5 21 c8 6b 79 b1 97 45 + * To compare them, they are split into four u32 values each, like so: + * 1st: 0xb76561a1 0x11d47b65 0xe0003d9e 0x59421081 + * 2nd: 0xd2371438 0x11d4f3d2 0x6bc821a5 0x4597b179 + * Now, it is apparent why the 2nd object_id collates after the 1st: the + * first u32 value of the 1st object_id is less than the first u32 of + * the 2nd object_id. If the first u32 values of both object_ids were + * equal then the second u32 values would be compared, etc. + */ +typedef enum { + COLLATION_BINARY = const_cpu_to_le32(0), /* Collate by binary + compare where the first byte is most + significant. */ + COLLATION_FILE_NAME = const_cpu_to_le32(1), /* Collate file names + as Unicode strings. */ + COLLATION_UNICODE_STRING = const_cpu_to_le32(2), /* Collate Unicode + strings by comparing their binary + Unicode values, except that when a + character can be uppercased, the upper + case value collates before the lower + case one. */ + COLLATION_NTOFS_ULONG = const_cpu_to_le32(16), + COLLATION_NTOFS_SID = const_cpu_to_le32(17), + COLLATION_NTOFS_SECURITY_HASH = const_cpu_to_le32(18), + COLLATION_NTOFS_ULONGS = const_cpu_to_le32(19), +} COLLATION_RULES; + +/* + * The flags (32-bit) describing attribute properties in the attribute + * definition structure. FIXME: This information is from Regis's information + * and, according to him, it is not certain and probably incomplete. + * The INDEXABLE flag is fairly certainly correct as only the file name + * attribute has this flag set and this is the only attribute indexed in NT4. + */ +typedef enum { + INDEXABLE = const_cpu_to_le32(0x02), /* Attribute can be + indexed. */ + NEED_TO_REGENERATE = const_cpu_to_le32(0x40), /* Need to regenerate + during regeneration + phase. */ + CAN_BE_NON_RESIDENT = const_cpu_to_le32(0x80), /* Attribute can be + non-resident. */ +} ATTR_DEF_FLAGS; + +/* + * The data attribute of FILE_AttrDef contains a sequence of attribute + * definitions for the NTFS volume. With this, it is supposed to be safe for an + * older NTFS driver to mount a volume containing a newer NTFS version without + * damaging it (that's the theory. In practice it's: not damaging it too much). + * Entries are sorted by attribute type. The flags describe whether the + * attribute can be resident/non-resident and possibly other things, but the + * actual bits are unknown. + */ +typedef struct { +/*hex ofs*/ +/* 0*/ uchar_t name[0x40]; /* Unicode name of the attribute. Zero + terminated. */ +/* 80*/ ATTR_TYPES type; /* Type of the attribute. */ +/* 84*/ u32 display_rule; /* Default display rule. + FIXME: What does it mean? (AIA) */ +/* 88*/ COLLATION_RULES collation_rule; /* Default collation rule. */ +/* 8c*/ ATTR_DEF_FLAGS flags; /* Flags describing the attribute. */ +/* 90*/ u64 min_size; /* Optional minimum attribute size. */ +/* 98*/ u64 max_size; /* Maximum size of attribute. */ +/* sizeof() = 0xa0 or 160 bytes */ +} __attribute__ ((__packed__)) ATTR_DEF; + +/* + * Attribute flags (16-bit). + */ +typedef enum { + ATTR_IS_COMPRESSED = const_cpu_to_le16(0x0001), + ATTR_COMPRESSION_MASK = const_cpu_to_le16(0x00ff), /* Compression + method mask. Also, first + illegal value. */ + ATTR_IS_ENCRYPTED = const_cpu_to_le16(0x4000), + ATTR_IS_SPARSE = const_cpu_to_le16(0x8000), +} __attribute__ ((__packed__)) ATTR_FLAGS; + +/* + * Attribute compression. + * + * Only the data attribute is ever compressed in the current ntfs driver in + * Windows. Further, compression is only applied when the data attribute is + * non-resident. Finally, to use compression, the maximum allowed cluster size + * on a volume is 4kib. + * + * The compression method is based on independently compressing blocks of X + * clusters, where X is determined from the compression_unit value found in the + * non-resident attribute record header (more precisely: X = 2^compression_unit + * clusters). On Windows NT/2k, X always is 16 clusters (compression_unit = 4). + * + * There are three different cases of how a compression block of X clusters + * can be stored: + * + * 1) The data in the block is all zero (a sparse block): + * This is stored as a sparse block in the run list, i.e. the run list + * entry has length = X and lcn = -1. The mapping pairs array actually + * uses a delta_lcn value length of 0, i.e. delta_lcn is not present at + * all, which is then interpreted by the driver as lcn = -1. + * NOTE: Even uncompressed files can be sparse on NTFS 3.0 volumes, then + * the same principles apply as above, except that the length is not + * restricted to being any particular value. + * + * 2) The data in the block is not compressed: + * This happens when compression doesn't reduce the size of the block + * in clusters. I.e. if compression has a small effect so that the + * compressed data still occupies X clusters, then the uncompressed data + * is stored in the block. + * This case is recognised by the fact that the run list entry has + * length = X and lcn >= 0. The mapping pairs array stores this as + * normal with a run length of X and some specific delta_lcn, i.e. + * delta_lcn has to be present. + * + * 3) The data in the block is compressed: + * The common case. This case is recognised by the fact that the run + * list entry has length L < X and lcn >= 0. The mapping pairs array + * stores this as normal with a run length of X and some specific + * delta_lcn, i.e. delta_lcn has to be present. This run list entry is + * immediately followed by a sparse entry with length = X - L and + * lcn = -1. The latter entry is to make up the vcn counting to the + * full compression block size X. + * + * In fact, life is more complicated because adjacent entries of the same type + * can be coalesced. This means that one has to keep track of the number of + * clusters handled and work on a basis of X clusters at a time being one + * block. An example: if length L > X this means that this particular run list + * entry contains a block of length X and part of one or more blocks of length + * L - X. Another example: if length L < X, this does not necessarily mean that + * the block is compressed as it might be that the lcn changes inside the block + * and hence the following run list entry describes the continuation of the + * potentially compressed block. The block would be compressed if the + * following run list entry describes at least X - L sparse clusters, thus + * making up the compression block length as described in point 3 above. (Of + * course, there can be several run list entries with small lengths so that the + * sparse entry does not follow the first data containing entry with + * length < X.) + * + * NOTE: At the end of the compressed attribute value, there most likely is not + * just the right amount of data to make up a compression block, thus this data + * is not even attempted to be compressed. It is just stored as is, unless + * the number of clusters it occupies is reduced when compressed in which case + * it is stored as a compressed compression block, complete with sparse + * clusters at the end. + */ + +/* + * Flags of resident attributes (8-bit). + */ +typedef enum { + RESIDENT_ATTR_IS_INDEXED = 0x01, /* Attribute is referenced in an index + (has implications for deleting and + modifying the attribute). */ +} __attribute__ ((__packed__)) RESIDENT_ATTR_FLAGS; + +/* + * Attribute record header. Always aligned to 8-byte boundary. + */ +typedef struct { +/*Ofs*/ +/* 0*/ ATTR_TYPES type; /* The (32-bit) type of the attribute. */ +/* 4*/ u32 length; /* Byte size of the resident part of the + attribute (aligned to 8-byte boundary). + Used to get to the next attribute. */ +/* 8*/ u8 non_resident; /* If 0, attribute is resident. + If 1, attribute is non-resident. */ +/* 9*/ u8 name_length; /* Unicode character size of name of attribute. + 0 if unnamed. */ +/* 10*/ u16 name_offset; /* If name_length != 0, the byte offset to the + beginning of the name from the attribute + record. Note that the name is stored as a + Unicode string. When creating, place offset + just at the end of the record header. Then, + follow with attribute value or mapping pairs + array, resident and non-resident attributes + respectively, aligning to an 8-byte + boundary. */ +/* 12*/ ATTR_FLAGS flags; /* Flags describing the attribute. */ +/* 14*/ u16 instance; /* The instance of this attribute record. This + number is unique within this mft record (see + MFT_RECORD/next_attribute_instance notes in + in mft.h for more details). */ +/* 16*/ union { + /* Resident attributes. */ + struct { +/* 16 */ u32 value_length; /* Byte size of attribute value. */ +/* 20 */ u16 value_offset; /* Byte offset of the attribute + value from the start of the + attribute record. When creating, + align to 8-byte boundary if we + have a name present as this might + not have a length of a multiple + of 8-bytes. */ +/* 22 */ RESIDENT_ATTR_FLAGS resident_flags; /* See above. */ +/* 23 */ s8 reservedR; /* Reserved/alignment to 8-byte + boundary. */ + } __attribute__ ((__packed__)); + /* Non-resident attributes. */ + struct { +/* 16*/ VCN lowest_vcn; /* Lowest valid virtual cluster number + for this portion of the attribute value or + 0 if this is the only extent (usually the + case). - Only when an attribute list is used + does lowest_vcn != 0 ever occur. */ +/* 24*/ VCN highest_vcn; /* Highest valid vcn of this extent of + the attribute value. - Usually there is only one + portion, so this usually equals the attribute + value size in clusters minus 1. Can be -1 for + zero length files. Can be 0 for "single extent" + attributes. */ +/* 32*/ u16 mapping_pairs_offset; /* Byte offset from the + beginning of the structure to the mapping pairs + array which contains the mappings between the + vcns and the logical cluster numbers (lcns). + When creating, place this at the end of this + record header aligned to 8-byte boundary. */ +/* 34*/ u8 compression_unit; /* The compression unit expressed + as the log to the base 2 of the number of + clusters in a compression unit. 0 means not + compressed. (This effectively limits the + compression unit size to be a power of two + clusters.) WinNT4 only uses a value of 4. */ +/* 35*/ u8 reserved1[5]; /* Align to 8-byte boundary. */ +/* The sizes below are only used when lowest_vcn is zero, as otherwise it would + be difficult to keep them up-to-date.*/ +/* 40*/ s64 allocated_size; /* Byte size of disk space + allocated to hold the attribute value. Always + is a multiple of the cluster size. When a file + is compressed, this field is a multiple of the + compression block size (2^compression_unit) and + it represents the logically allocated space + rather than the actual on disk usage. For this + use the compressed_size (see below). */ +/* 48*/ s64 data_size; /* Byte size of the attribute + value. Can be larger than allocated_size if + attribute value is compressed or sparse. */ +/* 56*/ s64 initialized_size; /* Byte size of initialized + portion of the attribute value. Usually equals + data_size. */ +/* sizeof(uncompressed attr) = 64*/ +/* 64*/ s64 compressed_size; /* Byte size of the attribute + value after compression. Only present when + compressed. Always is a multiple of the + cluster size. Represents the actual amount of + disk space being used on the disk. */ +/* sizeof(compressed attr) = 72*/ + } __attribute__ ((__packed__)); + } __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) ATTR_RECORD; + +typedef ATTR_RECORD ATTR_REC; + +/* + * File attribute flags (32-bit). + */ +typedef enum { + /* + * These flags are only present in the STANDARD_INFORMATION attribute + * (in the field file_attributes). + */ + FILE_ATTR_READONLY = const_cpu_to_le32(0x00000001), + FILE_ATTR_HIDDEN = const_cpu_to_le32(0x00000002), + FILE_ATTR_SYSTEM = const_cpu_to_le32(0x00000004), + /* Old DOS volid. Unused in NT. = cpu_to_le32(0x00000008), */ + + FILE_ATTR_DIRECTORY = const_cpu_to_le32(0x00000010), + /* FILE_ATTR_DIRECTORY is not considered valid in NT. It is reserved + for the DOS SUBDIRECTORY flag. */ + FILE_ATTR_ARCHIVE = const_cpu_to_le32(0x00000020), + FILE_ATTR_DEVICE = const_cpu_to_le32(0x00000040), + FILE_ATTR_NORMAL = const_cpu_to_le32(0x00000080), + + FILE_ATTR_TEMPORARY = const_cpu_to_le32(0x00000100), + FILE_ATTR_SPARSE_FILE = const_cpu_to_le32(0x00000200), + FILE_ATTR_REPARSE_POINT = const_cpu_to_le32(0x00000400), + FILE_ATTR_COMPRESSED = const_cpu_to_le32(0x00000800), + + FILE_ATTR_OFFLINE = const_cpu_to_le32(0x00001000), + FILE_ATTR_NOT_CONTENT_INDEXED = const_cpu_to_le32(0x00002000), + FILE_ATTR_ENCRYPTED = const_cpu_to_le32(0x00004000), + + FILE_ATTR_VALID_FLAGS = const_cpu_to_le32(0x00007fb7), + /* FILE_ATTR_VALID_FLAGS masks out the old DOS VolId and the + FILE_ATTR_DEVICE and preserves everything else. This mask + is used to obtain all flags that are valid for reading. */ + FILE_ATTR_VALID_SET_FLAGS = const_cpu_to_le32(0x000031a7), + /* FILE_ATTR_VALID_SET_FLAGS masks out the old DOS VolId, the + F_A_DEVICE, F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT, + F_A_COMPRESSED and F_A_ENCRYPTED and preserves the rest. This mask + is used to to obtain all flags that are valid for setting. */ + + /* + * These flags are only present in the FILE_NAME attribute (in the + * field file_attributes). + */ + FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT = const_cpu_to_le32(0x10000000), + /* This is a copy of the corresponding bit from the mft record, telling + us whether this is a directory or not, i.e. whether it has an + index root attribute or not. */ + FILE_ATTR_DUP_VIEW_INDEX_PRESENT = const_cpu_to_le32(0x20000000), + /* This is a copy of the corresponding bit from the mft record, telling + us whether this file has a view index present (eg. object id index, + quota index, one of the security indexes or the encrypting file + system related indexes). */ +} FILE_ATTR_FLAGS; + +/* + * NOTE on times in NTFS: All times are in MS standard time format, i.e. they + * are the number of 100-nanosecond intervals since 1st January 1601, 00:00:00 + * universal coordinated time (UTC). (In Linux time starts 1st January 1970, + * 00:00:00 UTC and is stored as the number of 1-second intervals since then.) + */ + +/* + * Attribute: Standard information (0x10). + * + * NOTE: Always resident. + * NOTE: Present in all base file records on a volume. + * NOTE: There is conflicting information about the meaning of each of the time + * fields but the meaning as defined below has been verified to be + * correct by practical experimentation on Windows NT4 SP6a and is hence + * assumed to be the one and only correct interpretation. + */ +typedef struct { +/*Ofs*/ +/* 0*/ s64 creation_time; /* Time file was created. Updated when + a filename is changed(?). */ +/* 8*/ s64 last_data_change_time; /* Time the data attribute was last + modified. */ +/* 16*/ s64 last_mft_change_time; /* Time this mft record was last + modified. */ +/* 24*/ s64 last_access_time; /* Approximate time when the file was + last accessed (obviously this is not + updated on read-only volumes). In + Windows this is only updated when + accessed if some time delta has + passed since the last update. Also, + last access times updates can be + disabled altogether for speed. */ +/* 32*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */ +/* 36*/ union { + /* NTFS 1.2 (and previous, presumably) */ +/* 36 */ u8 reserved12[12]; /* Reserved/alignment to 8-byte + boundary. */ +/* sizeof() = 48 bytes */ + /* NTFS 3.0 */ + struct { +/* + * If a volume has been upgraded from a previous NTFS version, then these + * fields are present only if the file has been accessed since the upgrade. + * Recognize the difference by comparing the length of the resident attribute + * value. If it is 48, then the following fields are missing. If it is 72 then + * the fields are present. Maybe just check like this: + * if (resident.ValueLength < sizeof(STANDARD_INFORMATION)) { + * Assume NTFS 1.2- format. + * If (volume version is 3.0+) + * Upgrade attribute to NTFS 3.0 format. + * else + * Use NTFS 1.2- format for access. + * } else + * Use NTFS 3.0 format for access. + * Only problem is that it might be legal to set the length of the value to + * arbitrarily large values thus spoiling this check. - But chkdsk probably + * views that as a corruption, assuming that it behaves like this for all + * attributes. + */ + /* 36*/ u32 maximum_versions; /* Maximum allowed versions for + file. Zero if version numbering is disabled. */ + /* 40*/ u32 version_number; /* This file's version (if any). + Set to zero if maximum_versions is zero. */ + /* 44*/ u32 class_id; /* Class id from bidirectional + class id index (?). */ + /* 48*/ u32 owner_id; /* Owner_id of the user owning + the file. Translate via $Q index in FILE_Extend + /$Quota to the quota control entry for the user + owning the file. Zero if quotas are disabled. */ + /* 52*/ u32 security_id; /* Security_id for the file. + Translate via $SII index and $SDS data stream + in FILE_Secure to the security descriptor. */ + /* 56*/ u64 quota_charged; /* Byte size of the charge to + the quota for all streams of the file. Note: Is + zero if quotas are disabled. */ + /* 64*/ u64 usn; /* Last update sequence number + of the file. This is a direct index into the + change (aka usn) journal file. It is zero if + the usn journal is disabled. + NOTE: To disable the journal need to delete + the journal file itself and to then walk the + whole mft and set all Usn entries in all mft + records to zero! (This can take a while!) + The journal is FILE_Extend/$UsnJrnl. Win2k + will recreate the journal and initiate + logging if necessary when mounting the + partition. This, in contrast to disabling the + journal is a very fast process, so the user + won't even notice it. */ + }; + }; +/* sizeof() = 72 bytes (NTFS 3.0) */ +} __attribute__ ((__packed__)) STANDARD_INFORMATION; + +/* + * Attribute: Attribute list (0x20). + * + * - Can be either resident or non-resident. + * - Value consists of a sequence of variable length, 8-byte aligned, + * ATTR_LIST_ENTRY records. + * - The attribute list attribute contains one entry for each attribute of + * the file in which the list is located, except for the list attribute + * itself. The list is sorted: first by attribute type, second by attribute + * name (if present), third by instance number. The extents of one + * non-resident attribute (if present) immediately follow after the initial + * extent. They are ordered by lowest_vcn and have their instace set to zero. + * It is not allowed to have two attributes with all sorting keys equal. + * - Further restrictions: + * - If not resident, the vcn to lcn mapping array has to fit inside the + * base mft record. + * - The attribute list attribute value has a maximum size of 256kb. This + * is imposed by the Windows cache manager. + * - Attribute lists are only used when the attributes of mft record do not + * fit inside the mft record despite all attributes (that can be made + * non-resident) having been made non-resident. This can happen e.g. when: + * - File has a large number of hard links (lots of file name + * attributes present). + * - The mapping pairs array of some non-resident attribute becomes so + * large due to fragmentation that it overflows the mft record. + * - The security descriptor is very complex (not applicable to + * NTFS 3.0 volumes). + * - There are many named streams. + */ +typedef struct { +/*Ofs*/ +/* 0*/ ATTR_TYPES type; /* Type of referenced attribute. */ +/* 4*/ u16 length; /* Byte size of this entry. */ +/* 6*/ u8 name_length; /* Size in Unicode chars of the name of the + attribute or 0 if unnamed. */ +/* 7*/ u8 name_offset; /* Byte offset to beginning of attribute name + (always set this to where the name would + start even if unnamed). */ +/* 8*/ VCN lowest_vcn; /* Lowest virtual cluster number of this portion + of the attribute value. This is usually 0. It + is non-zero for the case where one attribute + does not fit into one mft record and thus + several mft records are allocated to hold + this attribute. In the latter case, each mft + record holds one extent of the attribute and + there is one attribute list entry for each + extent. NOTE: This is DEFINITELY a signed + value! The windows driver uses cmp, followed + by jg when comparing this, thus it treats it + as signed. */ +/* 16*/ MFT_REF mft_reference; /* The reference of the mft record holding + the ATTR_RECORD for this portion of the + attribute value. */ +/* 24*/ u16 instance; /* If lowest_vcn = 0, the instance of the + attribute being referenced; otherwise 0. */ +/* 26*/ uchar_t name[0]; /* Use when creating only. When reading use + name_offset to determine the location of the + name. */ +/* sizeof() = 26 + (attribute_name_length * 2) bytes */ +} __attribute__ ((__packed__)) ATTR_LIST_ENTRY; + +/* + * The maximum allowed length for a file name. + */ +#define MAXIMUM_FILE_NAME_LENGTH 255 + +/* + * Possible namespaces for filenames in ntfs (8-bit). + */ +typedef enum { + FILE_NAME_POSIX = 0x00, + /* This is the largest namespace. It is case sensitive and + allows all Unicode characters except for: '\0' and '/'. + Beware that in WinNT/2k files which eg have the same name + except for their case will not be distinguished by the + standard utilities and thus a "del filename" will delete + both "filename" and "fileName" without warning. */ + FILE_NAME_WIN32 = 0x01, + /* The standard WinNT/2k NTFS long filenames. Case insensitive. + All Unicode chars except: '\0', '"', '*', '/', ':', '<', + '>', '?', '\' and '|'. Further, names cannot end with a '.' + or a space. */ + FILE_NAME_DOS = 0x02, + /* The standard DOS filenames (8.3 format). Uppercase only. + All 8-bit characters greater space, except: '"', '*', '+', + ',', '/', ':', ';', '<', '=', '>', '?' and '\'. */ + FILE_NAME_WIN32_AND_DOS = 0x03, + /* 3 means that both the Win32 and the DOS filenames are + identical and hence have been saved in this single filename + record. */ +} __attribute__ ((__packed__)) FILE_NAME_TYPE_FLAGS; + +/* + * Attribute: Filename (0x30). + * + * NOTE: Always resident. + * NOTE: All fields, except the parent_directory, are only updated when the + * filename is changed. Until then, they just become out of sync with + * reality and the more up to date values are present in the standard + * information attribute. + * NOTE: There is conflicting information about the meaning of each of the time + * fields but the meaning as defined below has been verified to be + * correct by practical experimentation on Windows NT4 SP6a and is hence + * assumed to be the one and only correct interpretation. + */ +typedef struct { +/*hex ofs*/ +/* 0*/ MFT_REF parent_directory; /* Directory this filename is + referenced from. */ +/* 8*/ s64 creation_time; /* Time file was created. */ +/* 10*/ s64 last_data_change_time; /* Time the data attribute was last + modified. */ +/* 18*/ s64 last_mft_change_time; /* Time this mft record was last + modified. */ +/* 20*/ s64 last_access_time; /* Last time this mft record was + accessed. */ +/* 28*/ s64 allocated_size; /* Byte size of allocated space for the + data attribute. NOTE: Is a multiple + of the cluster size. */ +/* 30*/ s64 data_size; /* Byte size of actual data in data + attribute. */ +/* 38*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */ +/* 3c*/ union { + /* 3c*/ struct { + /* 3c*/ u16 packed_ea_size; /* Size of the buffer needed to + pack the extended attributes + (EAs), if such are present.*/ + /* 3e*/ u16 reserved; /* Reserved for alignment. */ + } __attribute__ ((__packed__)); + /* 3c*/ u32 reparse_point_tag; /* Type of reparse point, + present only in reparse + points and only if there are + no EAs. */ + } __attribute__ ((__packed__)); +/* 40*/ u8 file_name_length; /* Length of file name in + (Unicode) characters. */ +/* 41*/ FILE_NAME_TYPE_FLAGS file_name_type; /* Namespace of the file name.*/ +/* 42*/ uchar_t file_name[0]; /* File name in Unicode. */ +} __attribute__ ((__packed__)) FILE_NAME_ATTR; + +/* + * GUID structures store globally unique identifiers (GUID). A GUID is a + * 128-bit value consisting of one group of eight hexadecimal digits, followed + * by three groups of four hexadecimal digits each, followed by one group of + * twelve hexadecimal digits. GUIDs are Microsoft's implementation of the + * distributed computing environment (DCE) universally unique identifier (UUID). + * Example of a GUID: + * 1F010768-5A73-BC91-0010A52216A7 + */ +typedef struct { + u32 data1; /* The first eight hexadecimal digits of the GUID. */ + u16 data2; /* The first group of four hexadecimal digits. */ + u16 data3; /* The second group of four hexadecimal digits. */ + u8 data4[8]; /* The first two bytes are the third group of four + hexadecimal digits. The remaining six bytes are the + final 12 hexadecimal digits. */ +} __attribute__ ((__packed__)) GUID; + +/* + * FILE_Extend/$ObjId contains an index named $O. This index contains all + * object_ids present on the volume as the index keys and the corresponding + * mft_record numbers as the index entry data parts. The data part (defined + * below) also contains three other object_ids: + * birth_volume_id - object_id of FILE_Volume on which the file was first + * created. Optional (i.e. can be zero). + * birth_object_id - object_id of file when it was first created. Usually + * equals the object_id. Optional (i.e. can be zero). + * domain_id - Reserved (always zero). + */ +typedef struct { + MFT_REF mft_reference; /* Mft record containing the object_id in + the index entry key. */ + union { + struct { + GUID birth_volume_id; + GUID birth_object_id; + GUID domain_id; + } __attribute__ ((__packed__)); + u8 extended_info[48]; + } __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) OBJ_ID_INDEX_DATA; + +/* + * Attribute: Object id (NTFS 3.0+) (0x40). + * + * NOTE: Always resident. + */ +typedef struct { + GUID object_id; /* Unique id assigned to the + file.*/ + /* The following fields are optional. The attribute value size is 16 + bytes, i.e. sizeof(GUID), if these are not present at all. Note, + the entries can be present but one or more (or all) can be zero + meaning that that particular value(s) is(are) not defined. Note, + when the fields are missing here, it is well possible that they are + to be found within the $Extend/$ObjId system file indexed under the + above object_id. */ + union { + struct { + GUID birth_volume_id; /* Unique id of volume on which + the file was first created.*/ + GUID birth_object_id; /* Unique id of file when it was + first created. */ + GUID domain_id; /* Reserved, zero. */ + } __attribute__ ((__packed__)); + u8 extended_info[48]; + } __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) OBJECT_ID_ATTR; + +/* + * The pre-defined IDENTIFIER_AUTHORITIES used as SID_IDENTIFIER_AUTHORITY in + * the SID structure (see below). + */ +//typedef enum { /* SID string prefix. */ +// SECURITY_NULL_SID_AUTHORITY = {0, 0, 0, 0, 0, 0}, /* S-1-0 */ +// SECURITY_WORLD_SID_AUTHORITY = {0, 0, 0, 0, 0, 1}, /* S-1-1 */ +// SECURITY_LOCAL_SID_AUTHORITY = {0, 0, 0, 0, 0, 2}, /* S-1-2 */ +// SECURITY_CREATOR_SID_AUTHORITY = {0, 0, 0, 0, 0, 3}, /* S-1-3 */ +// SECURITY_NON_UNIQUE_AUTHORITY = {0, 0, 0, 0, 0, 4}, /* S-1-4 */ +// SECURITY_NT_SID_AUTHORITY = {0, 0, 0, 0, 0, 5}, /* S-1-5 */ +//} IDENTIFIER_AUTHORITIES; + +/* + * These relative identifiers (RIDs) are used with the above identifier + * authorities to make up universal well-known SIDs. + * + * Note: The relative identifier (RID) refers to the portion of a SID, which + * identifies a user or group in relation to the authority that issued the SID. + * For example, the universal well-known SID Creator Owner ID (S-1-3-0) is + * made up of the identifier authority SECURITY_CREATOR_SID_AUTHORITY (3) and + * the relative identifier SECURITY_CREATOR_OWNER_RID (0). + */ +typedef enum { /* Identifier authority. */ + SECURITY_NULL_RID = 0, /* S-1-0 */ + SECURITY_WORLD_RID = 0, /* S-1-1 */ + SECURITY_LOCAL_RID = 0, /* S-1-2 */ + + SECURITY_CREATOR_OWNER_RID = 0, /* S-1-3 */ + SECURITY_CREATOR_GROUP_RID = 1, /* S-1-3 */ + + SECURITY_CREATOR_OWNER_SERVER_RID = 2, /* S-1-3 */ + SECURITY_CREATOR_GROUP_SERVER_RID = 3, /* S-1-3 */ + + SECURITY_DIALUP_RID = 1, + SECURITY_NETWORK_RID = 2, + SECURITY_BATCH_RID = 3, + SECURITY_INTERACTIVE_RID = 4, + SECURITY_SERVICE_RID = 6, + SECURITY_ANONYMOUS_LOGON_RID = 7, + SECURITY_PROXY_RID = 8, + SECURITY_ENTERPRISE_CONTROLLERS_RID=9, + SECURITY_SERVER_LOGON_RID = 9, + SECURITY_PRINCIPAL_SELF_RID = 0xa, + SECURITY_AUTHENTICATED_USER_RID = 0xb, + SECURITY_RESTRICTED_CODE_RID = 0xc, + SECURITY_TERMINAL_SERVER_RID = 0xd, + + SECURITY_LOGON_IDS_RID = 5, + SECURITY_LOGON_IDS_RID_COUNT = 3, + + SECURITY_LOCAL_SYSTEM_RID = 0x12, + + SECURITY_NT_NON_UNIQUE = 0x15, + + SECURITY_BUILTIN_DOMAIN_RID = 0x20, + + /* + * Well-known domain relative sub-authority values (RIDs). + */ + + /* Users. */ + DOMAIN_USER_RID_ADMIN = 0x1f4, + DOMAIN_USER_RID_GUEST = 0x1f5, + DOMAIN_USER_RID_KRBTGT = 0x1f6, + + /* Groups. */ + DOMAIN_GROUP_RID_ADMINS = 0x200, + DOMAIN_GROUP_RID_USERS = 0x201, + DOMAIN_GROUP_RID_GUESTS = 0x202, + DOMAIN_GROUP_RID_COMPUTERS = 0x203, + DOMAIN_GROUP_RID_CONTROLLERS = 0x204, + DOMAIN_GROUP_RID_CERT_ADMINS = 0x205, + DOMAIN_GROUP_RID_SCHEMA_ADMINS = 0x206, + DOMAIN_GROUP_RID_ENTERPRISE_ADMINS= 0x207, + DOMAIN_GROUP_RID_POLICY_ADMINS = 0x208, + + /* Aliases. */ + DOMAIN_ALIAS_RID_ADMINS = 0x220, + DOMAIN_ALIAS_RID_USERS = 0x221, + DOMAIN_ALIAS_RID_GUESTS = 0x222, + DOMAIN_ALIAS_RID_POWER_USERS = 0x223, + + DOMAIN_ALIAS_RID_ACCOUNT_OPS = 0x224, + DOMAIN_ALIAS_RID_SYSTEM_OPS = 0x225, + DOMAIN_ALIAS_RID_PRINT_OPS = 0x226, + DOMAIN_ALIAS_RID_BACKUP_OPS = 0x227, + + DOMAIN_ALIAS_RID_REPLICATOR = 0x228, + DOMAIN_ALIAS_RID_RAS_SERVERS = 0x229, + DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = 0x22a, +} RELATIVE_IDENTIFIERS; + +/* + * The universal well-known SIDs: + * + * NULL_SID S-1-0-0 + * WORLD_SID S-1-1-0 + * LOCAL_SID S-1-2-0 + * CREATOR_OWNER_SID S-1-3-0 + * CREATOR_GROUP_SID S-1-3-1 + * CREATOR_OWNER_SERVER_SID S-1-3-2 + * CREATOR_GROUP_SERVER_SID S-1-3-3 + * + * (Non-unique IDs) S-1-4 + * + * NT well-known SIDs: + * + * NT_AUTHORITY_SID S-1-5 + * DIALUP_SID S-1-5-1 + * + * NETWORD_SID S-1-5-2 + * BATCH_SID S-1-5-3 + * INTERACTIVE_SID S-1-5-4 + * SERVICE_SID S-1-5-6 + * ANONYMOUS_LOGON_SID S-1-5-7 (aka null logon session) + * PROXY_SID S-1-5-8 + * SERVER_LOGON_SID S-1-5-9 (aka domain controller account) + * SELF_SID S-1-5-10 (self RID) + * AUTHENTICATED_USER_SID S-1-5-11 + * RESTRICTED_CODE_SID S-1-5-12 (running restricted code) + * TERMINAL_SERVER_SID S-1-5-13 (running on terminal server) + * + * (Logon IDs) S-1-5-5-X-Y + * + * (NT non-unique IDs) S-1-5-0x15-... + * + * (Built-in domain) S-1-5-0x20 + */ + +/* + * The SID_IDENTIFIER_AUTHORITY is a 48-bit value used in the SID structure. + */ +typedef union { + struct { + u32 low_part; /* Low 32-bits. */ + u16 high_part; /* High 16-bits. */ + } __attribute__ ((__packed__)); + u8 value[6]; /* Value as individual bytes. */ +} __attribute__ ((__packed__)) SID_IDENTIFIER_AUTHORITY; + +/* + * The SID structure is a variable-length structure used to uniquely identify + * users or groups. SID stands for security identifier. + * + * The standard textual representation of the SID is of the form: + * S-R-I-S-S... + * Where: + * - The first "S" is the literal character 'S' identifying the following + * digits as a SID. + * - R is the revision level of the SID expressed as a sequence of digits + * either in decimal or hexadecimal (if the later, prefixed by "0x"). + * - I is the 48-bit identifier_authority, expressed as digits as R above. + * - S... is one or more sub_authority values, expressed as digits as above. + * + * Example SID; the domain-relative SID of the local Administrators group on + * Windows NT/2k: + * S-1-5-32-544 + * This translates to a SID with: + * revision = 1, + * sub_authority_count = 2, + * identifier_authority = {0,0,0,0,0,5}, // SECURITY_NT_AUTHORITY + * sub_authority[0] = 32, // SECURITY_BUILTIN_DOMAIN_RID + * sub_authority[1] = 544 // DOMAIN_ALIAS_RID_ADMINS + */ +typedef struct { + u8 revision; + u8 sub_authority_count; + SID_IDENTIFIER_AUTHORITY identifier_authority; + u32 sub_authority[1]; /* At least one sub_authority. */ +} __attribute__ ((__packed__)) SID; + +/* + * Current constants for SIDs. + */ +typedef enum { + SID_REVISION = 1, /* Current revision level. */ + SID_MAX_SUB_AUTHORITIES = 15, /* Maximum number of those. */ + SID_RECOMMENDED_SUB_AUTHORITIES = 1, /* Will change to around 6 in + a future revision. */ +} SID_CONSTANTS; + +/* + * The predefined ACE types (8-bit, see below). + */ +typedef enum { + ACCESS_MIN_MS_ACE_TYPE = 0, + ACCESS_ALLOWED_ACE_TYPE = 0, + ACCESS_DENIED_ACE_TYPE = 1, + SYSTEM_AUDIT_ACE_TYPE = 2, + SYSTEM_ALARM_ACE_TYPE = 3, /* Not implemented as of Win2k. */ + ACCESS_MAX_MS_V2_ACE_TYPE = 3, + + ACCESS_ALLOWED_COMPOUND_ACE_TYPE= 4, + ACCESS_MAX_MS_V3_ACE_TYPE = 4, + + /* The following are Win2k only. */ + ACCESS_MIN_MS_OBJECT_ACE_TYPE = 5, + ACCESS_ALLOWED_OBJECT_ACE_TYPE = 5, + ACCESS_DENIED_OBJECT_ACE_TYPE = 6, + SYSTEM_AUDIT_OBJECT_ACE_TYPE = 7, + SYSTEM_ALARM_OBJECT_ACE_TYPE = 8, + ACCESS_MAX_MS_OBJECT_ACE_TYPE = 8, + + ACCESS_MAX_MS_V4_ACE_TYPE = 8, + + /* This one is for WinNT&2k. */ + ACCESS_MAX_MS_ACE_TYPE = 8, +} __attribute__ ((__packed__)) ACE_TYPES; + +/* + * The ACE flags (8-bit) for audit and inheritance (see below). + * + * SUCCESSFUL_ACCESS_ACE_FLAG is only used with system audit and alarm ACE + * types to indicate that a message is generated (in Windows!) for successful + * accesses. + * + * FAILED_ACCESS_ACE_FLAG is only used with system audit and alarm ACE types + * to indicate that a message is generated (in Windows!) for failed accesses. + */ +typedef enum { + /* The inheritance flags. */ + OBJECT_INHERIT_ACE = 0x01, + CONTAINER_INHERIT_ACE = 0x02, + NO_PROPAGATE_INHERIT_ACE = 0x04, + INHERIT_ONLY_ACE = 0x08, + INHERITED_ACE = 0x10, /* Win2k only. */ + VALID_INHERIT_FLAGS = 0x1f, + + /* The audit flags. */ + SUCCESSFUL_ACCESS_ACE_FLAG = 0x40, + FAILED_ACCESS_ACE_FLAG = 0x80, +} __attribute__ ((__packed__)) ACE_FLAGS; + +/* + * An ACE is an access-control entry in an access-control list (ACL). + * An ACE defines access to an object for a specific user or group or defines + * the types of access that generate system-administration messages or alarms + * for a specific user or group. The user or group is identified by a security + * identifier (SID). + * + * Each ACE starts with an ACE_HEADER structure (aligned on 4-byte boundary), + * which specifies the type and size of the ACE. The format of the subsequent + * data depends on the ACE type. + */ +typedef struct { + ACE_TYPES type; /* Type of the ACE. */ + ACE_FLAGS flags; /* Flags describing the ACE. */ + u16 size; /* Size in bytes of the ACE. */ +} __attribute__ ((__packed__)) ACE_HEADER; + +/* + * The access mask (32-bit). Defines the access rights. + */ +typedef enum { + /* + * The specific rights (bits 0 to 15). Depend on the type of the + * object being secured by the ACE. + */ + + /* Specific rights for files and directories are as follows: */ + + /* Right to read data from the file. (FILE) */ + FILE_READ_DATA = const_cpu_to_le32(0x00000001), + /* Right to list contents of a directory. (DIRECTORY) */ + FILE_LIST_DIRECTORY = const_cpu_to_le32(0x00000001), + + /* Right to write data to the file. (FILE) */ + FILE_WRITE_DATA = const_cpu_to_le32(0x00000002), + /* Right to create a file in the directory. (DIRECTORY) */ + FILE_ADD_FILE = const_cpu_to_le32(0x00000002), + + /* Right to append data to the file. (FILE) */ + FILE_APPEND_DATA = const_cpu_to_le32(0x00000004), + /* Right to create a subdirectory. (DIRECTORY) */ + FILE_ADD_SUBDIRECTORY = const_cpu_to_le32(0x00000004), + + /* Right to read extended attributes. (FILE/DIRECTORY) */ + FILE_READ_EA = const_cpu_to_le32(0x00000008), + + /* Right to write extended attributes. (FILE/DIRECTORY) */ + FILE_WRITE_EA = const_cpu_to_le32(0x00000010), + + /* Right to execute a file. (FILE) */ + FILE_EXECUTE = const_cpu_to_le32(0x00000020), + /* Right to traverse the directory. (DIRECTORY) */ + FILE_TRAVERSE = const_cpu_to_le32(0x00000020), + + /* + * Right to delete a directory and all the files it contains (its + * children), even if the files are read-only. (DIRECTORY) + */ + FILE_DELETE_CHILD = const_cpu_to_le32(0x00000040), + + /* Right to read file attributes. (FILE/DIRECTORY) */ + FILE_READ_ATTRIBUTES = const_cpu_to_le32(0x00000080), + + /* Right to change file attributes. (FILE/DIRECTORY) */ + FILE_WRITE_ATTRIBUTES = const_cpu_to_le32(0x00000100), + + /* + * The standard rights (bits 16 to 23). Are independent of the type of + * object being secured. + */ + + /* Right to delete the object. */ + DELETE = const_cpu_to_le32(0x00010000), + + /* + * Right to read the information in the object's security descriptor, + * not including the information in the SACL. I.e. right to read the + * security descriptor and owner. + */ + READ_CONTROL = const_cpu_to_le32(0x00020000), + + /* Right to modify the DACL in the object's security descriptor. */ + WRITE_DAC = const_cpu_to_le32(0x00040000), + + /* Right to change the owner in the object's security descriptor. */ + WRITE_OWNER = const_cpu_to_le32(0x00080000), + + /* + * Right to use the object for synchronization. Enables a process to + * wait until the object is in the signalled state. Some object types + * do not support this access right. + */ + SYNCHRONIZE = const_cpu_to_le32(0x00100000), + + /* + * The following STANDARD_RIGHTS_* are combinations of the above for + * convenience and are defined by the Win32 API. + */ + + /* These are currently defined to READ_CONTROL. */ + STANDARD_RIGHTS_READ = const_cpu_to_le32(0x00020000), + STANDARD_RIGHTS_WRITE = const_cpu_to_le32(0x00020000), + STANDARD_RIGHTS_EXECUTE = const_cpu_to_le32(0x00020000), + + /* Combines DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER access. */ + STANDARD_RIGHTS_REQUIRED = const_cpu_to_le32(0x000f0000), + + /* + * Combines DELETE, READ_CONTROL, WRITE_DAC, WRITE_OWNER, and + * SYNCHRONIZE access. + */ + STANDARD_RIGHTS_ALL = const_cpu_to_le32(0x001f0000), + + /* + * The access system ACL and maximum allowed access types (bits 24 to + * 25, bits 26 to 27 are reserved). + */ + ACCESS_SYSTEM_SECURITY = const_cpu_to_le32(0x01000000), + MAXIMUM_ALLOWED = const_cpu_to_le32(0x02000000), + + /* + * The generic rights (bits 28 to 31). These map onto the standard and + * specific rights. + */ + + /* Read, write, and execute access. */ + GENERIC_ALL = const_cpu_to_le32(0x10000000), + + /* Execute access. */ + GENERIC_EXECUTE = const_cpu_to_le32(0x20000000), + + /* + * Write access. For files, this maps onto: + * FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_DATA | + * FILE_WRITE_EA | STANDARD_RIGHTS_WRITE | SYNCHRONIZE + * For directories, the mapping has the same numberical value. See + * above for the descriptions of the rights granted. + */ + GENERIC_WRITE = const_cpu_to_le32(0x40000000), + + /* + * Read access. For files, this maps onto: + * FILE_READ_ATTRIBUTES | FILE_READ_DATA | FILE_READ_EA | + * STANDARD_RIGHTS_READ | SYNCHRONIZE + * For directories, the mapping has the same numberical value. See + * above for the descriptions of the rights granted. + */ + GENERIC_READ = const_cpu_to_le32(0x80000000), +} ACCESS_MASK; + +/* + * The generic mapping array. Used to denote the mapping of each generic + * access right to a specific access mask. + * + * FIXME: What exactly is this and what is it for? (AIA) + */ +typedef struct { + ACCESS_MASK generic_read; + ACCESS_MASK generic_write; + ACCESS_MASK generic_execute; + ACCESS_MASK generic_all; +} __attribute__ ((__packed__)) GENERIC_MAPPING; + +/* + * The predefined ACE type structures are as defined below. + */ + +/* + * ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE + */ +typedef struct { + ACE_HEADER; /* The ACE header. */ + ACCESS_MASK mask; /* Access mask associated with the ACE. */ + SID sid; /* The SID associated with the ACE. */ +} __attribute__ ((__packed__)) ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, + SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE; + +/* + * The object ACE flags (32-bit). + */ +typedef enum { + ACE_OBJECT_TYPE_PRESENT = const_cpu_to_le32(1), + ACE_INHERITED_OBJECT_TYPE_PRESENT = const_cpu_to_le32(2), +} OBJECT_ACE_FLAGS; + +typedef struct { + ACE_HEADER; /* The ACE_HEADER. */ + ACCESS_MASK mask; /* Access mask associated with the ACE. */ + OBJECT_ACE_FLAGS flags; /* Flags describing the object ACE. */ + GUID object_type; + GUID inherited_object_type; + SID sid; /* The SID associated with the ACE. */ +} __attribute__ ((__packed__)) ACCESS_ALLOWED_OBJECT_ACE, + ACCESS_DENIED_OBJECT_ACE, + SYSTEM_AUDIT_OBJECT_ACE, + SYSTEM_ALARM_OBJECT_ACE; + +/* + * An ACL is an access-control list (ACL). + * An ACL starts with an ACL header structure, which specifies the size of + * the ACL and the number of ACEs it contains. The ACL header is followed by + * zero or more access control entries (ACEs). The ACL as well as each ACE + * are aligned on 4-byte boundaries. + */ +typedef struct { + u8 revision; /* Revision of this ACL. */ + u8 alignment1; + u16 size; /* Allocated space in bytes for ACL. Includes this + header, the ACEs and the remaining free space. */ + u16 ace_count;/* Number of ACEs in the ACL. */ + u16 alignment2; +/* sizeof() = 8 bytes */ +} __attribute__ ((__packed__)) ACL; + +/* + * Current constants for ACLs. + */ +typedef enum { + /* Current revision. */ + ACL_REVISION = 2, + ACL_REVISION_DS = 4, + + /* History of revisions. */ + ACL_REVISION1 = 1, + MIN_ACL_REVISION = 2, + ACL_REVISION2 = 2, + ACL_REVISION3 = 3, + ACL_REVISION4 = 4, + MAX_ACL_REVISION = 4, +} ACL_CONSTANTS; + +/* + * The security descriptor control flags (16-bit). + * + * SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the + * SID pointed to by the Owner field was provided by a + * defaulting mechanism rather than explicitly provided by the + * original provider of the security descriptor. This may + * affect the treatment of the SID with respect to inheritence + * of an owner. + * + * SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the + * SID in the Group field was provided by a defaulting mechanism + * rather than explicitly provided by the original provider of + * the security descriptor. This may affect the treatment of + * the SID with respect to inheritence of a primary group. + * + * SE_DACL_PRESENT - This boolean flag, when set, indicates that the + * security descriptor contains a discretionary ACL. If this + * flag is set and the Dacl field of the SECURITY_DESCRIPTOR is + * null, then a null ACL is explicitly being specified. + * + * SE_DACL_DEFAULTED - This boolean flag, when set, indicates that the + * ACL pointed to by the Dacl field was provided by a defaulting + * mechanism rather than explicitly provided by the original + * provider of the security descriptor. This may affect the + * treatment of the ACL with respect to inheritence of an ACL. + * This flag is ignored if the DaclPresent flag is not set. + * + * SE_SACL_PRESENT - This boolean flag, when set, indicates that the + * security descriptor contains a system ACL pointed to by the + * Sacl field. If this flag is set and the Sacl field of the + * SECURITY_DESCRIPTOR is null, then an empty (but present) + * ACL is being specified. + * + * SE_SACL_DEFAULTED - This boolean flag, when set, indicates that the + * ACL pointed to by the Sacl field was provided by a defaulting + * mechanism rather than explicitly provided by the original + * provider of the security descriptor. This may affect the + * treatment of the ACL with respect to inheritence of an ACL. + * This flag is ignored if the SaclPresent flag is not set. + * + * SE_SELF_RELATIVE - This boolean flag, when set, indicates that the + * security descriptor is in self-relative form. In this form, + * all fields of the security descriptor are contiguous in memory + * and all pointer fields are expressed as offsets from the + * beginning of the security descriptor. + */ +typedef enum { + SE_OWNER_DEFAULTED = const_cpu_to_le16(0x0001), + SE_GROUP_DEFAULTED = const_cpu_to_le16(0x0002), + SE_DACL_PRESENT = const_cpu_to_le16(0x0004), + SE_DACL_DEFAULTED = const_cpu_to_le16(0x0008), + SE_SACL_PRESENT = const_cpu_to_le16(0x0010), + SE_SACL_DEFAULTED = const_cpu_to_le16(0x0020), + SE_DACL_AUTO_INHERIT_REQ = const_cpu_to_le16(0x0100), + SE_SACL_AUTO_INHERIT_REQ = const_cpu_to_le16(0x0200), + SE_DACL_AUTO_INHERITED = const_cpu_to_le16(0x0400), + SE_SACL_AUTO_INHERITED = const_cpu_to_le16(0x0800), + SE_DACL_PROTECTED = const_cpu_to_le16(0x1000), + SE_SACL_PROTECTED = const_cpu_to_le16(0x2000), + SE_RM_CONTROL_VALID = const_cpu_to_le16(0x4000), + SE_SELF_RELATIVE = const_cpu_to_le16(0x8000), +} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_CONTROL; + +/* + * Self-relative security descriptor. Contains the owner and group SIDs as well + * as the sacl and dacl ACLs inside the security descriptor itself. + */ +typedef struct { + u8 revision; /* Revision level of the security descriptor. */ + u8 alignment; + SECURITY_DESCRIPTOR_CONTROL control; /* Flags qualifying the type of + the descriptor as well as the following fields. */ + u32 owner; /* Byte offset to a SID representing an object's + owner. If this is NULL, no owner SID is present in + the descriptor. */ + u32 group; /* Byte offset to a SID representing an object's + primary group. If this is NULL, no primary group + SID is present in the descriptor. */ + u32 sacl; /* Byte offset to a system ACL. Only valid, if + SE_SACL_PRESENT is set in the control field. If + SE_SACL_PRESENT is set but sacl is NULL, a NULL ACL + is specified. */ + u32 dacl; /* Byte offset to a discretionary ACL. Only valid, if + SE_DACL_PRESENT is set in the control field. If + SE_DACL_PRESENT is set but dacl is NULL, a NULL ACL + (unconditionally granting access) is specified. */ +/* sizeof() = 0x14 bytes */ +} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_RELATIVE; + +/* + * Absolute security descriptor. Does not contain the owner and group SIDs, nor + * the sacl and dacl ACLs inside the security descriptor. Instead, it contains + * pointers to these structures in memory. Obviously, absolute security + * descriptors are only useful for in memory representations of security + * descriptors. On disk, a self-relative security descriptor is used. + */ +typedef struct { + u8 revision; /* Revision level of the security descriptor. */ + u8 alignment; + SECURITY_DESCRIPTOR_CONTROL control; /* Flags qualifying the type of + the descriptor as well as the following fields. */ + SID *owner; /* Points to a SID representing an object's owner. If + this is NULL, no owner SID is present in the + descriptor. */ + SID *group; /* Points to a SID representing an object's primary + group. If this is NULL, no primary group SID is + present in the descriptor. */ + ACL *sacl; /* Points to a system ACL. Only valid, if + SE_SACL_PRESENT is set in the control field. If + SE_SACL_PRESENT is set but sacl is NULL, a NULL ACL + is specified. */ + ACL *dacl; /* Points to a discretionary ACL. Only valid, if + SE_DACL_PRESENT is set in the control field. If + SE_DACL_PRESENT is set but dacl is NULL, a NULL ACL + (unconditionally granting access) is specified. */ +} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR; + +/* + * Current constants for security descriptors. + */ +typedef enum { + /* Current revision. */ + SECURITY_DESCRIPTOR_REVISION = 1, + SECURITY_DESCRIPTOR_REVISION1 = 1, + + /* The sizes of both the absolute and relative security descriptors is + the same as pointers, at least on ia32 architecture are 32-bit. */ + SECURITY_DESCRIPTOR_MIN_LENGTH = sizeof(SECURITY_DESCRIPTOR), +} SECURITY_DESCRIPTOR_CONSTANTS; + +/* + * Attribute: Security descriptor (0x50). A standard self-relative security + * descriptor. + * + * NOTE: Can be resident or non-resident. + * NOTE: Not used in NTFS 3.0+, as security descriptors are stored centrally + * in FILE_Secure and the correct descriptor is found using the security_id + * from the standard information attribute. + */ +typedef SECURITY_DESCRIPTOR_RELATIVE SECURITY_DESCRIPTOR_ATTR; + +/* + * On NTFS 3.0+, all security descriptors are stored in FILE_Secure. Only one + * referenced instance of each unique security descriptor is stored. + * + * FILE_Secure contains no unnamed data attribute, i.e. it has zero length. It + * does, however, contain two indexes ($SDH and $SII) as well as a named data + * stream ($SDS). + * + * Every unique security descriptor is assigned a unique security identifier + * (security_id, not to be confused with a SID). The security_id is unique for + * the NTFS volume and is used as an index into the $SII index, which maps + * security_ids to the security descriptor's storage location within the $SDS + * data attribute. The $SII index is sorted by ascending security_id. + * + * A simple hash is computed from each security descriptor. This hash is used + * as an index into the $SDH index, which maps security descriptor hashes to + * the security descriptor's storage location within the $SDS data attribute. + * The $SDH index is sorted by security descriptor hash and is stored in a B+ + * tree. When searching $SDH (with the intent of determining whether or not a + * new security descriptor is already present in the $SDS data stream), if a + * matching hash is found, but the security descriptors do not match, the + * search in the $SDH index is continued, searching for a next matching hash. + * + * When a precise match is found, the security_id coresponding to the security + * descriptor in the $SDS attribute is read from the found $SDH index entry and + * is stored in the $STANDARD_INFORMATION attribute of the file/directory to + * which the security descriptor is being applied. The $STANDARD_INFORMATION + * attribute is present in all base mft records (i.e. in all files and + * directories). + * + * If a match is not found, the security descriptor is assigned a new unique + * security_id and is added to the $SDS data attribute. Then, entries + * referencing the this security descriptor in the $SDS data attribute are + * added to the $SDH and $SII indexes. + * + * Note: Entries are never deleted from FILE_Secure, even if nothing + * references an entry any more. + */ + +/* + * This header precedes each security descriptor in the $SDS data stream. + * This is also the index entry data part of both the $SII and $SDH indexes. + */ +typedef struct { + u32 hash; /* Hash of the security descriptor. */ + u32 security_id; /* The security_id assigned to the descriptor. */ + u64 offset; /* Byte offset of this entry in the $SDS stream. */ + u32 length; /* Size in bytes of this entry in $SDS stream. */ +} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_HEADER; + +/* + * The $SDS data stream contains the security descriptors, aligned on 16-byte + * boundaries, sorted by security_id in a B+ tree. Security descriptors cannot + * cross 256kib boundaries (this restriction is imposed by the Windows cache + * manager). Each security descriptor is contained in a SDS_ENTRY structure. + * Also, each security descriptor is stored twice in the $SDS stream with a + * fixed offset of 0x40000 bytes (256kib, the Windows cache manager's max size) + * between them; i.e. if a SDS_ENTRY specifies an offset of 0x51d0, then the + * the first copy of the security descriptor will be at offset 0x51d0 in the + * $SDS data stream and the second copy will be at offset 0x451d0. + */ +typedef struct { + SECURITY_DESCRIPTOR_HEADER; /* The security descriptor header. */ + SECURITY_DESCRIPTOR_RELATIVE sid; /* The self-relative security + descriptor. */ +} __attribute__ ((__packed__)) SDS_ENTRY; + +/* + * The index entry key used in the $SII index. The collation type is + * COLLATION_NTOFS_ULONG. + */ +typedef struct { + u32 security_id; /* The security_id assigned to the descriptor. */ +} __attribute__ ((__packed__)) SII_INDEX_KEY; + +/* + * The index entry key used in the $SDH index. The keys are sorted first by + * hash and then by security_id. The collation rule is + * COLLATION_NTOFS_SECURITY_HASH. + */ +typedef struct { + u32 hash; /* Hash of the security descriptor. */ + u32 security_id; /* The security_id assigned to the descriptor. */ +} __attribute__ ((__packed__)) SDH_INDEX_KEY; + +/* + * Attribute: Volume name (0x60). + * + * NOTE: Always resident. + * NOTE: Present only in FILE_Volume. + */ +typedef struct { + uchar_t name[0]; /* The name of the volume in Unicode. */ +} __attribute__ ((__packed__)) VOLUME_NAME; + +/* + * Possible flags for the volume (16-bit). + */ +typedef enum { + VOLUME_IS_DIRTY = const_cpu_to_le16(0x0001), + VOLUME_RESIZE_LOG_FILE = const_cpu_to_le16(0x0002), + VOLUME_UPGRADE_ON_MOUNT = const_cpu_to_le16(0x0004), + VOLUME_MOUNTED_ON_NT4 = const_cpu_to_le16(0x0008), + VOLUME_DELETE_USN_UNDERWAY = const_cpu_to_le16(0x0010), + VOLUME_REPAIR_OBJECT_ID = const_cpu_to_le16(0x0020), + VOLUME_MODIFIED_BY_CHKDSK = const_cpu_to_le16(0x8000), + VOLUME_FLAGS_MASK = const_cpu_to_le16(0x803f), +} __attribute__ ((__packed__)) VOLUME_FLAGS; + +/* + * Attribute: Volume information (0x70). + * + * NOTE: Always resident. + * NOTE: Present only in FILE_Volume. + * NOTE: Windows 2000 uses NTFS 3.0 while Windows NT4 service pack 6a uses + * NTFS 1.2. I haven't personally seen other values yet. + */ +typedef struct { + u64 reserved; /* Not used (yet?). */ + u8 major_ver; /* Major version of the ntfs format. */ + u8 minor_ver; /* Minor version of the ntfs format. */ + VOLUME_FLAGS flags; /* Bit array of VOLUME_* flags. */ +} __attribute__ ((__packed__)) VOLUME_INFORMATION; + +/* + * Attribute: Data attribute (0x80). + * + * NOTE: Can be resident or non-resident. + * + * Data contents of a file (i.e. the unnamed stream) or of a named stream. + */ +typedef struct { + u8 data[0]; /* The file's data contents. */ +} __attribute__ ((__packed__)) DATA_ATTR; + +/* + * Index header flags (8-bit). + */ +typedef enum { + /* When index header is in an index root attribute: */ + SMALL_INDEX = 0, /* The index is small enough to fit inside the + index root attribute and there is no index + allocation attribute present. */ + LARGE_INDEX = 1, /* The index is too large to fit in the index + root attribute and/or an index allocation + attribute is present. */ + /* + * When index header is in an index block, i.e. is part of index + * allocation attribute: + */ + LEAF_NODE = 0, /* This is a leaf node, i.e. there are no more + nodes branching off it. */ + INDEX_NODE = 1, /* This node indexes other nodes, i.e. is not a + leaf node. */ + NODE_MASK = 1, /* Mask for accessing the *_NODE bits. */ +} __attribute__ ((__packed__)) INDEX_HEADER_FLAGS; + +/* + * This is the header for indexes, describing the INDEX_ENTRY records, which + * follow the INDEX_HEADER. Together the index header and the index entries + * make up a complete index. + * + * IMPORTANT NOTE: The offset, length and size structure members are counted + * relative to the start of the index header structure and not relative to the + * start of the index root or index allocation structures themselves. + */ +typedef struct { + u32 entries_offset; /* Byte offset to first INDEX_ENTRY + aligned to 8-byte boundary. */ + u32 index_length; /* Data size of the index in bytes, + i.e. bytes used from allocated + size, aligned to 8-byte boundary. */ + u32 allocated_size; /* Byte size of this index (block), + multiple of 8 bytes. */ + /* NOTE: For the index root attribute, the above two numbers are always + equal, as the attribute is resident and it is resized as needed. In + the case of the index allocation attribute the attribute is not + resident and hence the allocated_size is a fixed value and must + equal the index_block_size specified by the INDEX_ROOT attribute + corresponding to the INDEX_ALLOCATION attribute this INDEX_BLOCK + belongs to. */ + INDEX_HEADER_FLAGS flags; /* Bit field of INDEX_HEADER_FLAGS. */ + u8 reserved[3]; /* Reserved/align to 8-byte boundary. */ +} __attribute__ ((__packed__)) INDEX_HEADER; + +/* + * Attribute: Index root (0x90). + * + * NOTE: Always resident. + * + * This is followed by a sequence of index entries (INDEX_ENTRY structures) + * as described by the index header. + * + * When a directory is small enough to fit inside the index root then this + * is the only attribute describing the directory. When the directory is too + * large to fit in the index root, on the other hand, two aditional attributes + * are present: an index allocation attribute, containing sub-nodes of the B+ + * directory tree (see below), and a bitmap attribute, describing which virtual + * cluster numbers (vcns) in the index allocation attribute are in use by an + * index block. + * + * NOTE: The root directory (FILE_root) contains an entry for itself. Other + * dircetories do not contain entries for themselves, though. + */ +typedef struct { + ATTR_TYPES type; /* Type of the indexed attribute. Is + $FILE_NAME for directories, zero + for view indexes. No other values + allowed. */ + COLLATION_RULES collation_rule; /* Collation rule used to sort the + index entries. If type is $FILE_NAME, + this must be COLLATION_FILE_NAME. */ + u32 index_block_size; /* Size of each index block in bytes (in + the index allocation attribute). */ + u8 clusters_per_index_block; /* Cluster size of each index block (in + the index allocation attribute), when + an index block is >= than a cluster, + otherwise this will be the log of + the size (like how the encoding of + the mft record size and the index + record size found in the boot sector + work). Has to be a power of 2. */ + u8 reserved[3]; /* Reserved/align to 8-byte boundary. */ + INDEX_HEADER index; /* Index header describing the + following index entries. */ +} __attribute__ ((__packed__)) INDEX_ROOT; + +/* + * Attribute: Index allocation (0xa0). + * + * NOTE: Always non-resident (doesn't make sense to be resident anyway!). + * + * This is an array of index blocks. Each index block starts with an + * INDEX_BLOCK structure containing an index header, followed by a sequence of + * index entries (INDEX_ENTRY structures), as described by the INDEX_HEADER. + */ +typedef struct { +/* 0*/ NTFS_RECORD; /* Magic is "INDX". */ +/* 8*/ s64 lsn; /* $LogFile sequence number of the last + modification of this index block. */ +/* 16*/ VCN index_block_vcn; /* Virtual cluster number of the index block. */ +/* 24*/ INDEX_HEADER index; /* Describes the following index entries. */ +/* sizeof()= 40 (0x28) bytes */ +/* + * When creating the index block, we place the update sequence array at this + * offset, i.e. before we start with the index entries. This also makes sense, + * otherwise we could run into problems with the update sequence array + * containing in itself the last two bytes of a sector which would mean that + * multi sector transfer protection wouldn't work. As you can't protect data + * by overwriting it since you then can't get it back... + * When reading use the data from the ntfs record header. + */ +} __attribute__ ((__packed__)) INDEX_BLOCK; + +typedef INDEX_BLOCK INDEX_ALLOCATION; + +/* + * The system file FILE_Extend/$Reparse contains an index named $R listing + * all reparse points on the volume. The index entry keys are as defined + * below. Note, that there is no index data associated with the index entries. + * + * The index entries are sorted by the index key file_id. The collation rule is + * COLLATION_NTOFS_ULONGS. FIXME: Verify whether the reparse_tag is not the + * primary key / is not a key at all. (AIA) + */ +typedef struct { + u32 reparse_tag; /* Reparse point type (inc. flags). */ + MFT_REF file_id; /* Mft record of the file containing the + reparse point attribute. */ +} __attribute__ ((__packed__)) REPARSE_INDEX_KEY; + +/* + * Quota flags (32-bit). + */ +typedef enum { + /* The user quota flags. Names explain meaning. */ + QUOTA_FLAG_DEFAULT_LIMITS = const_cpu_to_le32(0x00000001), + QUOTA_FLAG_LIMIT_REACHED = const_cpu_to_le32(0x00000002), + QUOTA_FLAG_ID_DELETED = const_cpu_to_le32(0x00000004), + + QUOTA_FLAG_USER_MASK = const_cpu_to_le32(0x00000007), + /* Bit mask for user quota flags. */ + + /* These flags are only present in the quota defaults index entry, + i.e. in the entry where owner_id = QUOTA_DEFAULTS_ID. */ + QUOTA_FLAG_TRACKING_ENABLED = const_cpu_to_le32(0x00000010), + QUOTA_FLAG_ENFORCEMENT_ENABLED = const_cpu_to_le32(0x00000020), + QUOTA_FLAG_TRACKING_REQUESTED = const_cpu_to_le32(0x00000040), + QUOTA_FLAG_LOG_THRESHOLD = const_cpu_to_le32(0x00000080), + QUOTA_FLAG_LOG_LIMIT = const_cpu_to_le32(0x00000100), + QUOTA_FLAG_OUT_OF_DATE = const_cpu_to_le32(0x00000200), + QUOTA_FLAG_CORRUPT = const_cpu_to_le32(0x00000400), + QUOTA_FLAG_PENDING_DELETES = const_cpu_to_le32(0x00000800), +} QUOTA_FLAGS; + +/* + * The system file FILE_Extend/$Quota contains two indexes $O and $Q. Quotas + * are on a per volume and per user basis. + * + * The $Q index contains one entry for each existing user_id on the volume. The + * index key is the user_id of the user/group owning this quota control entry, + * i.e. the key is the owner_id. The user_id of the owner of a file, i.e. the + * owner_id, is found in the standard information attribute. The collation rule + * for $Q is COLLATION_NTOFS_ULONG. + * + * The $O index contains one entry for each user/group who has been assigned + * a quota on that volume. The index key holds the SID of the user_id the + * entry belongs to, i.e. the owner_id. The collation rule for $O is + * COLLATION_NTOFS_SID. + * + * The $O index entry data is the user_id of the user corresponding to the SID. + * This user_id is used as an index into $Q to find the quota control entry + * associated with the SID. + * + * The $Q index entry data is the quota control entry and is defined below. + */ +typedef struct { + u32 version; /* Currently equals 2. */ + QUOTA_FLAGS flags; /* Flags describing this quota entry. */ + u64 bytes_used; /* How many bytes of the quota are in use. */ + s64 change_time; /* Last time this quota entry was changed. */ + s64 threshold; /* Soft quota (-1 if not limited). */ + s64 limit; /* Hard quota (-1 if not limited). */ + s64 exceeded_time; /* How long the soft quota has been exceeded. */ + SID sid; /* The SID of the user/object associated with + this quota entry. Equals zero for the quota + defaults entry. */ +} __attribute__ ((__packed__)) QUOTA_CONTROL_ENTRY; + +/* + * Predefined owner_id values (32-bit). + */ +typedef enum { + QUOTA_INVALID_ID = const_cpu_to_le32(0x00000000), + QUOTA_DEFAULTS_ID = const_cpu_to_le32(0x00000001), + QUOTA_FIRST_USER_ID = const_cpu_to_le32(0x00000100), +} PREDEFINED_OWNER_IDS; + +/* + * Index entry flags (16-bit). + */ +typedef enum { + INDEX_ENTRY_NODE = const_cpu_to_le16(1), /* This entry contains a + sub-node, i.e. a reference to an index + block in form of a virtual cluster + number (see below). */ + INDEX_ENTRY_END = const_cpu_to_le16(2), /* This signifies the last + entry in an index block. The index + entry does not represent a file but it + can point to a sub-node. */ + INDEX_ENTRY_SPACE_FILLER = 0xffff, /* Just to force 16-bit width. */ +} __attribute__ ((__packed__)) INDEX_ENTRY_FLAGS; + +/* + * This the index entry header (see below). + */ +typedef struct { +/* 0*/ union { /* Only valid when INDEX_ENTRY_END is not set. */ + MFT_REF indexed_file; /* The mft reference of the file + described by this index + entry. Used for directory + indexes. */ + struct { /* Used for views/indexes to find the entry's data. */ + u16 data_offset; /* Data byte offset from this + INDEX_ENTRY. Follows the + index key. */ + u16 data_length; /* Data length in bytes. */ + u32 reservedV; /* Reserved (zero). */ + } __attribute__ ((__packed__)); + } __attribute__ ((__packed__)); +/* 8*/ u16 length; /* Byte size of this index entry, multiple of + 8-bytes. */ +/* 10*/ u16 key_length; /* Byte size of the key value, which is in the + index entry. It follows field reserved. Not + multiple of 8-bytes. */ +/* 12*/ INDEX_ENTRY_FLAGS flags; /* Bit field of INDEX_ENTRY_* flags. */ +/* 14*/ u16 reserved; /* Reserved/align to 8-byte boundary. */ +/* sizeof() = 16 bytes */ +} __attribute__ ((__packed__)) INDEX_ENTRY_HEADER; + +/* + * This is an index entry. A sequence of such entries follows each INDEX_HEADER + * structure. Together they make up a complete index. The index follows either + * an index root attribute or an index allocation attribute. + * + * NOTE: Before NTFS 3.0 only filename attributes were indexed. + */ +typedef struct { +/* 0*/ INDEX_ENTRY_HEADER; /* The index entry header (see above). */ +/* 16*/ union { /* The key of the indexed attribute. NOTE: Only present + if INDEX_ENTRY_END bit in flags is not set. NOTE: On + NTFS versions before 3.0 the only valid key is the + FILE_NAME_ATTR. On NTFS 3.0+ the following + additional index keys are defined: */ + FILE_NAME_ATTR file_name;/* $I30 index in directories. */ + SII_INDEX_KEY sii; /* $SII index in $Secure. */ + SDH_INDEX_KEY sdh; /* $SDH index in $Secure. */ + GUID object_id; /* $O index in FILE_Extend/$ObjId: The + object_id of the mft record found in + the data part of the index. */ + REPARSE_INDEX_KEY; /* $R index in FILE_Extend/$Reparse. */ + SID sid; /* $O index in FILE_Extend/$Quota: + SID of the owner of the user_id. */ + u32 owner_id; /* $Q index in FILE_Extend/$Quota: + user_id of the owner of the quota + control entry in the data part of + the index. */ + } __attribute__ ((__packed__)) key; + /* The (optional) index data is inserted here when creating. */ + // VCN vcn; /* If INDEX_ENTRY_NODE bit in flags is set, the last + // eight bytes of this index entry contain the virtual + // cluster number of the index block that holds the + // entries immediately preceding the current entry (the + // vcn references the corresponding cluster in the data + // of the non-resident index allocation attribute). If + // the key_length is zero, then the vcn immediately + // follows the INDEX_ENTRY_HEADER. Regardless of + // key_length, the address of the 8-byte boundary + // alligned vcn of INDEX_ENTRY{_HEADER} *ie is given by + // (char*)ie + le16_to_cpu(ie*)->length) - sizeof(VCN), + // where sizeof(VCN) can be hardcoded as 8 if wanted. */ +} __attribute__ ((__packed__)) INDEX_ENTRY; + +/* + * Attribute: Bitmap (0xb0). + * + * Contains an array of bits (aka a bitfield). + * + * When used in conjunction with the index allocation attribute, each bit + * corresponds to one index block within the index allocation attribute. Thus + * the number of bits in the bitmap * index block size / cluster size is the + * number of clusters in the index allocation attribute. + */ +typedef struct { + u8 bitmap[0]; /* Array of bits. */ +} __attribute__ ((__packed__)) BITMAP_ATTR; + +/* + * The reparse point tag defines the type of the reparse point. It also + * includes several flags, which further describe the reparse point. + * + * The reparse point tag is an unsigned 32-bit value divided in three parts: + * + * 1. The least significant 16 bits (i.e. bits 0 to 15) specifiy the type of + * the reparse point. + * 2. The 13 bits after this (i.e. bits 16 to 28) are reserved for future use. + * 3. The most significant three bits are flags describing the reparse point. + * They are defined as follows: + * bit 29: Name surrogate bit. If set, the filename is an alias for + * another object in the system. + * bit 30: High-latency bit. If set, accessing the first byte of data will + * be slow. (E.g. the data is stored on a tape drive.) + * bit 31: Microsoft bit. If set, the tag is owned by Microsoft. User + * defined tags have to use zero here. + */ +typedef enum { + IO_REPARSE_TAG_IS_ALIAS = const_cpu_to_le32(0x20000000), + IO_REPARSE_TAG_IS_HIGH_LATENCY = const_cpu_to_le32(0x40000000), + IO_REPARSE_TAG_IS_MICROSOFT = const_cpu_to_le32(0x80000000), + + IO_REPARSE_TAG_RESERVED_ZERO = const_cpu_to_le32(0x00000000), + IO_REPARSE_TAG_RESERVED_ONE = const_cpu_to_le32(0x00000001), + IO_REPARSE_TAG_RESERVED_RANGE = const_cpu_to_le32(0x00000001), + + IO_REPARSE_TAG_NSS = const_cpu_to_le32(0x68000005), + IO_REPARSE_TAG_NSS_RECOVER = const_cpu_to_le32(0x68000006), + IO_REPARSE_TAG_SIS = const_cpu_to_le32(0x68000007), + IO_REPARSE_TAG_DFS = const_cpu_to_le32(0x68000008), + + IO_REPARSE_TAG_MOUNT_POINT = const_cpu_to_le32(0x88000003), + + IO_REPARSE_TAG_HSM = const_cpu_to_le32(0xa8000004), + + IO_REPARSE_TAG_SYMBOLIC_LINK = const_cpu_to_le32(0xe8000000), + + IO_REPARSE_TAG_VALID_VALUES = const_cpu_to_le32(0xe000ffff), +} PREDEFINED_REPARSE_TAGS; + +/* + * Attribute: Reparse point (0xc0). + * + * NOTE: Can be resident or non-resident. + */ +typedef struct { + u32 reparse_tag; /* Reparse point type (inc. flags). */ + u16 reparse_data_length; /* Byte size of reparse data. */ + u16 reserved; /* Align to 8-byte boundary. */ + u8 reparse_data[0]; /* Meaning depends on reparse_tag. */ +} __attribute__ ((__packed__)) REPARSE_POINT; + +/* + * Attribute: Extended attribute (EA) information (0xd0). + * + * NOTE: Always resident. (Is this true???) + */ +typedef struct { + u16 ea_length; /* Byte size of the packed extended + attributes. */ + u16 need_ea_count; /* The number of extended attributes which have + the NEED_EA bit set. */ + u32 ea_query_length; /* Byte size of the buffer required to query + the extended attributes when calling + ZwQueryEaFile() in Windows NT/2k. I.e. the + byte size of the unpacked extended + attributes. */ +} __attribute__ ((__packed__)) EA_INFORMATION; + +/* + * Extended attribute flags (8-bit). + */ +typedef enum { + NEED_EA = 0x80, +} __attribute__ ((__packed__)) EA_FLAGS; + +/* + * Attribute: Extended attribute (EA) (0xe0). + * + * NOTE: Always non-resident. (Is this true?) + * + * Like the attribute list and the index buffer list, the EA attribute value is + * a sequence of EA_ATTR variable length records. + * + * FIXME: It appears weird that the EA name is not unicode. Is it true? + */ +typedef struct { + u32 next_entry_offset; /* Offset to the next EA_ATTR. */ + EA_FLAGS flags; /* Flags describing the EA. */ + u8 ea_name_length; /* Length of the name of the extended + attribute in bytes. */ + u16 ea_value_length; /* Byte size of the EA's value. */ + u8 ea_name[0]; /* Name of the EA. */ + u8 ea_value[0]; /* The value of the EA. Immediately + follows the name. */ +} __attribute__ ((__packed__)) EA_ATTR; + +/* + * Attribute: Property set (0xf0). + * + * Intended to support Native Structure Storage (NSS) - a feature removed from + * NTFS 3.0 during beta testing. + */ +typedef struct { + /* Irrelevant as feature unused. */ +} __attribute__ ((__packed__)) PROPERTY_SET; + +/* + * Attribute: Logged utility stream (0x100). + * + * NOTE: Can be resident or non-resident. + * + * Operations on this attribute are logged to the journal ($LogFile) like + * normal metadata changes. + * + * Used by the Encrypting File System (EFS). All encrypted files have this + * attribute with the name $EFS. + */ +typedef struct { + /* Can be anything the creator chooses. */ + /* EFS uses it as follows: */ + // FIXME: Type this info, verifying it along the way. (AIA) +} __attribute__ ((__packed__)) LOGGED_UTILITY_STREAM, EFS_ATTR; + +#endif /* defined _NTFS_LAYOUT_H */ + From 6e161b5f3e18f4864b0e1cb6f487edb3d92bc90a Mon Sep 17 00:00:00 2001 From: !flatcap Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0094/2994] whitespace and include guards 2002/07/11 13:18:12-00:00 !flatcap start to break up the dependency loops in the header files 2002/04/20 23:09:43-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/15 20:04:30-00:00 !antona Fix all compiler warnings that came up with -Wall. Enabled -Wall for ./configure --enable-debug everywhere. Fix a few bugs in mkntfs that came up in the warnings (just error code paths, nothing major). 2001/06/10 15:54:20-00:00 !antona Linux-NTFS 0.1.0-pre1 ===================== -fixed up ntfsfix and ntfsdump_logfile -corrected stuff -several bug fixes -fixed (hopefully) final bug with mkntfs (sd generator was wrong due to brain'o) -mkntfs now completed, only need to add a few command line options before first public release. -rpm generation file updated and autostrip modified to make use of install-stip make target instead of stripping manually -made bootsector check verbosity during mount dependent on --enable-debug configure option. 2001/06/01 02:07:26-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. (Logical change 1.5) --- ntfstools/sd.c | 200 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) diff --git a/ntfstools/sd.c b/ntfstools/sd.c index e69de29b..0e0f0863 100644 --- a/ntfstools/sd.c +++ b/ntfstools/sd.c @@ -0,0 +1,200 @@ +#include "types.h" +#include "layout.h" + +/* + * NTFS 1.2 - System files security decriptors + * =========================================== + * + * Create the security descriptor for system file number @sys_file_no and + * return a pointer to the descriptor. + * + * $MFT, $MFTMirr, $LogFile, $AttrDef, $Bitmap, $Boot, $BadClus, and $UpCase + * are the same. + * + * $Volume, $Quota, and system files 0xb-0xf are the same. They are almost the + * same as the above, the only difference being that the two SIDs present in + * the DACL grant GENERIC_WRITE and GENERIC_READ equivalent priviledges while + * the above only grant GENERIC_READ equivalent priviledges. (For some reason + * the flags for GENERIC_READ/GENERIC_WRITE are not set by NT4, even though + * the permissions are equivalent, so we comply. + * + * Root directory system file (".") is different altogether. + * + * The sd is recturned in *@sd_val and has length *@sd_val_len. + * + * Do NOT free *@sd_val as it is static memory. This also means that you can + * only use *@sd_val until the next call to this function. + * + */ +void init_system_file_sd(int sys_file_no, char **sd_val, int *sd_val_len) +{ + static char sd_array[0x68]; + SECURITY_DESCRIPTOR_RELATIVE *sd; + ACL *acl; + ACCESS_ALLOWED_ACE *aa_ace; + SID *sid; + + if (sys_file_no < 0 || sys_file_no > 0xf) { + *sd_val = NULL; + *sd_val_len = 0; + return; + } + *sd_val = (char*)&sd_array; + sd = (SECURITY_DESCRIPTOR_RELATIVE*)&sd_array; + sd->revision = 1; + sd->alignment = 0; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + if (sys_file_no == FILE_root) { + *sd_val_len = 0x50; + sd->owner = cpu_to_le32(0x30); + sd->group = cpu_to_le32(0x40); + } else { + *sd_val_len = 0x68; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + } + sd->sacl = cpu_to_le32(0); + sd->dacl = cpu_to_le32(0x14); + /* + * Now at offset 0x14, as specified in the security descriptor, we have + * the DACL. + */ + acl = (ACL*)((char*)sd + le32_to_cpu(sd->dacl)); + acl->revision = 2; + acl->alignment1 = 0; + if (sys_file_no == FILE_root) { + acl->size = cpu_to_le16(0x1c); + acl->ace_count = cpu_to_le16(1); + } else { + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(2); + } + acl->alignment2 = cpu_to_le16(0); + /* + * Now at offset 0x1c, just after the DACL's ACL, we have the first + * ACE of the DACL. The type of the ACE is access allowed. + */ + aa_ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + aa_ace->type = ACCESS_ALLOWED_ACE_TYPE; + if (sys_file_no == FILE_root) + aa_ace->flags = CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE; + else + aa_ace->flags = 0; + aa_ace->size = cpu_to_le16(0x14); + switch (sys_file_no) { + case FILE_MFT: case FILE_MFTMirr: case FILE_LogFile: + case FILE_AttrDef: case FILE_Bitmap: case FILE_Boot: + case FILE_BadClus: case FILE_UpCase: + aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ | + FILE_READ_ATTRIBUTES | FILE_READ_EA | FILE_READ_DATA; + break; + case FILE_Volume: case FILE_Secure: case 0xb ... 0xf: + aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_WRITE | + FILE_WRITE_ATTRIBUTES | FILE_READ_ATTRIBUTES | + FILE_WRITE_EA | FILE_READ_EA | FILE_APPEND_DATA | + FILE_WRITE_DATA | FILE_READ_DATA; + break; + case FILE_root: + aa_ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_READ_ATTRIBUTES | FILE_DELETE_CHILD | + FILE_TRAVERSE | FILE_WRITE_EA | FILE_READ_EA | + FILE_ADD_SUBDIRECTORY | FILE_ADD_FILE | + FILE_LIST_DIRECTORY; + break; + } + aa_ace->sid.revision = 1; + aa_ace->sid.sub_authority_count = 1; + aa_ace->sid.identifier_authority.value[0] = 0; + aa_ace->sid.identifier_authority.value[1] = 0; + aa_ace->sid.identifier_authority.value[2] = 0; + aa_ace->sid.identifier_authority.value[3] = 0; + aa_ace->sid.identifier_authority.value[4] = 0; + if (sys_file_no == FILE_root) { + /* SECURITY_WORLD_SID_AUTHORITY (S-1-1) */ + aa_ace->sid.identifier_authority.value[5] = 1; + aa_ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_WORLD_RID); + /* This is S-1-1-0, the WORLD_SID. */ + } else { + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + aa_ace->sid.identifier_authority.value[5] = 5; + aa_ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + } + /* + * Now at offset 0x30 within security descriptor, just after the first + * ACE of the DACL. All system files, except the root directory, have + * a second ACE. + */ + if (sys_file_no != FILE_root) { + /* The second ACE of the DACL. Type is access allowed. */ + aa_ace = (ACCESS_ALLOWED_ACE*)((char*)aa_ace + + le16_to_cpu(aa_ace->size)); + aa_ace->type = ACCESS_ALLOWED_ACE_TYPE; + aa_ace->flags = 0; + aa_ace->size = cpu_to_le16(0x18); + switch (sys_file_no) { + case FILE_MFT: case FILE_MFTMirr: + case FILE_LogFile: case FILE_AttrDef: + case FILE_Bitmap: case FILE_Boot: + case FILE_BadClus: case FILE_UpCase: + aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ | + FILE_READ_ATTRIBUTES | FILE_READ_EA | + FILE_READ_DATA; + break; + case FILE_Volume: case FILE_Secure: + case 0xb ... 0xf: + aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ | + FILE_WRITE_ATTRIBUTES | + FILE_READ_ATTRIBUTES | FILE_WRITE_EA | + FILE_READ_EA | FILE_APPEND_DATA | + FILE_WRITE_DATA | FILE_READ_DATA; + break; + } + aa_ace->sid.revision = 1; + aa_ace->sid.sub_authority_count = 2; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + aa_ace->sid.identifier_authority.value[0] = 0; + aa_ace->sid.identifier_authority.value[1] = 0; + aa_ace->sid.identifier_authority.value[2] = 0; + aa_ace->sid.identifier_authority.value[3] = 0; + aa_ace->sid.identifier_authority.value[4] = 0; + aa_ace->sid.identifier_authority.value[5] = 5; + aa_ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + aa_ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + /* Now at offset 0x48 into the security descriptor. */ + } + /* As specified in the security descriptor, we now have the owner SID.*/ + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 1; + sid->sub_authority_count = 2; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + /* + * Now at offset 0x40 or 0x58 (root directory and the other system + * files, respectively) into the security descriptor, as specified in + * the security descriptor, we have the group SID. + */ + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 1; + sid->sub_authority_count = 2; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); +} + From fb6ff5a091483f1c234b0d39dc94676922a8b8d4 Mon Sep 17 00:00:00 2001 From: !szaka Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0095/2994] Initial revision --- include/volume.h | 0 ntfstools/ntfsfix.c | 0 ntfstools/ntfsresize.c | 0 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 include/volume.h create mode 100644 ntfstools/ntfsfix.c create mode 100644 ntfstools/ntfsresize.c diff --git a/include/volume.h b/include/volume.h new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfsfix.c b/ntfstools/ntfsfix.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfstools/ntfsresize.c b/ntfstools/ntfsresize.c new file mode 100644 index 00000000..e69de29b From 2ba0affba629d1d100951ada4d7206ca4bc9b09e Mon Sep 17 00:00:00 2001 From: !szaka Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0096/2994] Fix incorrect message if new volume size was given in [KMG]Byte 2002/07/17 04:37:48-00:00 !szaka Shrink volume to size given in byte[K|M|G] 2002/07/16 13:26:42-00:00 !szaka "Calculate the smallest shrinked volume size supported" option added 2002/07/16 10:17:05-00:00 !szaka Minor code refactoring 2002/07/15 16:41:48-00:00 !flatcap AT_NONAME -> AT_UNNAMED 2002/07/14 18:13:04-00:00 !szaka Mark the NTFS volume dirty. No need for ntfsfix anymore after ntfsresize. 2002/07/14 15:43:35-00:00 !szaka Reserve space for backup boot sector at the end of device 2002/07/14 14:48:51-00:00 !szaka Check if device mounted. Progress only if it's not or both ntfsresize operation is read-only and device mounted read-only 2002/07/12 12:38:54-00:00 !szaka Rewrote $LogFile reset using new inode API and moved it from ntfsfix to libntfs as ntfs_reset_logfile(). ntfsresize also resets log file. 2002/07/12 07:10:44-00:00 !szaka NTFS_V* version macros and ntfs_is_version_supported() added. Modified ntfsfix and ntfsresize to use them. 2002/07/11 16:20:34-00:00 !flatcap whitespace and include guards 2002/07/11 12:49:48-00:00 !szaka Quit if mounted volume is dirty unless -f (force) option was given 2002/07/11 09:02:26-00:00 !szaka Bail out if $Bitmap/$BadClust has attribite list attribute, this condition is stronger what we need now but better to be on the safer side. Other minor updates. 2002/07/10 10:56:26-00:00 !szaka ntfsresize: cosmetic cleanup, progress bar added 2002/07/09 19:17:49-00:00 !flatcap move the runlist functions from attrib.c to runlist.c 2002/07/09 09:07:10-00:00 !szaka Don't give up inode walking on EIO: temporary fix for not being able to distinguish corrupt and not FILE records easily) 2002/07/09 00:00:19-00:00 !antona Little fix to ntfsresize. 2002/07/08 23:27:17-00:00 !flatcap added AT_NONAME so we can search for a (un)named attribute or just iterate through all attributes 2002/07/08 15:59:35-00:00 !flatcap Added Szaka's ntfsresize to the build (Logical change 1.5) --- ntfstools/ntfsresize.c | 809 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 809 insertions(+) diff --git a/ntfstools/ntfsresize.c b/ntfstools/ntfsresize.c index e69de29b..be59de90 100644 --- a/ntfstools/ntfsresize.c +++ b/ntfstools/ntfsresize.c @@ -0,0 +1,809 @@ +/** + * ntfsresize - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Szabolcs Szakacsits + * + * This utility will resize an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "debug.h" +#include "types.h" +#include "support.h" +#include "endians.h" +#include "bootsect.h" +#include "disk_io.h" +#include "attrib.h" +#include "volume.h" +#include "mft.h" +#include "bitmap.h" +#include "inode.h" +#include "runlist.h" + +struct { + int verbose; + int debug; + int ro_flag; + int force; + int info; + s64 size; + s64 bytes; + char *volume; +} opt; + +struct bitmap { + u8 *bm; + s64 size; +}; + +struct progress_bar { + u64 start; + u64 stop; + int resolution; + float unit; +}; + +ntfs_volume *vol = NULL; +struct bitmap lcn_bitmap; + + +#define ERR_PREFIX "==> ERROR" +#define PERR_PREFIX ERR_PREFIX "(%d): " +#define NERR_PREFIX ERR_PREFIX ": " + +#define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) + + +int err_exit(const char *fmt, ...) +{ + va_list ap; + + fprintf(stdout, NERR_PREFIX); + va_start(ap, fmt); + vfprintf(stdout, fmt, ap); + va_end(ap); + fflush(stdout); + fflush(stderr); + exit(1); +} + + +int perr_exit(const char *fmt, ...) +{ + va_list ap; + int eo = errno; + + fprintf(stdout, PERR_PREFIX, eo); + va_start(ap, fmt); + vfprintf(stdout, fmt, ap); + va_end(ap); + printf(": %s\n", strerror(eo)); + fflush(stdout); + fflush(stderr); + exit(1); +} + + +void usage(char *s) +{ + printf ("Usage: %s [-fhin] [-c clusters] [-s byte[K|M|G]] device\n", s); + printf (" -c clusters Shrink volume to size given in NTFS clusters\n"); + Dprintf(" -d Show debug information\n"); + printf (" -f Force to progress (DANGEROUS)\n"); + printf (" -h This help text\n"); + printf (" -i Calculate the smallest shrinked volume size supported\n"); + printf (" -n No write operations (mount volume read-only)\n"); + printf (" -s byte[K|M|G] Shrink volume to size given in byte[K|M|G]\n"); +/* printf (" -v Verbose operation\n"); */ + exit(1); +} + + +s64 get_new_volume_size(char *s, char **argv) +{ + s64 size; + char *suffix; + + size = strtoll(s, &suffix, 10); + if (size <= 0 || errno == ERANGE) + err_exit("Illegal new volume size\n"); + + if (!*suffix) + return size; + + if (strlen(suffix) > 1) + usage(argv[0]); + + /* FIXME: check for overflow */ + switch (*suffix) { + case 'G': + case 'g': + size *= 1024; + case 'M': + case 'm': + size *= 1024; + case 'K': + case 'k': + size *= 1024; + break; + default: + usage(argv[0]); + } + + return size; +} + + +void parse_options(int argc, char **argv) +{ + char *s; + int i; + + memset(&opt, 0, sizeof(opt)); + + while ((i = getopt(argc, argv, "c:dfhins:")) != EOF) + switch (i) { + case 'c': + opt.size = strtoll(optarg, &s, 0); + if (*s || opt.size <= 0 || errno == ERANGE) + err_exit("Illegal number of clusters!\n"); + break; + case 'd': + opt.debug = 1; + break; + case 'f': + opt.force++; + break; + case 'h': + usage(argv[0]); + case 'i': + opt.info = 1; + break; + case 'n': + opt.ro_flag = MS_RDONLY; + break; + case 's': + opt.bytes = get_new_volume_size(optarg, argv); + break; + case 'v': + opt.verbose++; + break; + default: + usage(argv[0]); + } + if (optind == argc) + usage(argv[0]); + opt.volume = argv[optind++]; + if (optind < argc) + usage(argv[0]); + + stderr = stdout; + if (!opt.debug) + if (!(stderr = fopen("/dev/null", "rw"))) + perr_exit("Couldn't open /dev/null"); + + + if (opt.size && opt.bytes) { + printf(NERR_PREFIX "It makes no sense to use " + "-c and -s together.\n"); + usage(argv[0]); + } + + /* If no '-c clusters' then estimate smallest shrinked volume size */ + if (!opt.size && !opt.bytes) + opt.info = 1; + + if (opt.info) { + if (opt.size || opt.bytes) { + printf(NERR_PREFIX "It makes no sense to use -i and " + "-%c together.\n", opt.size ? 'c' : 's'); + usage(argv[0]); + } + opt.ro_flag = MS_RDONLY; + } +} + + +s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) +{ + s64 bm_bsize; + + bm_bsize = rounded_up_division(nr_clusters, 8); + + /* Needs to be multiple of 8 bytes */ + bm_bsize = (bm_bsize + 7) & ~7; + Dprintf("Bitmap byte size : %lld (%lld clusters)\n", + bm_bsize, rounded_up_division(bm_bsize, vol->cluster_size)); + + return bm_bsize; +} + + +void build_lcn_usage_bitmap(ATTR_RECORD *a) +{ + run_list *rl; + int i, j; + + if (!a->non_resident) + return; + + if (!(rl = ntfs_decompress_mapping_pairs(vol, a, NULL))) + perr_exit("ntfs_decompress_mapping_pairs"); + + for (i = 0; rl[i].length; i++) { + if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) + continue; + for (j = 0; j < rl[i].length; j++) { + u64 k = (u64)rl[i].lcn + j; + if (ntfs_get_and_set_bit(lcn_bitmap.bm, k, 1)) + err_exit("Cluster %lu " + "referenced multiply times!\n", k); + } + } + free(rl); +} + + +void walk_attributes(MFT_RECORD *mr) +{ + ntfs_attr_search_ctx *ctx; + + if (!(ctx = ntfs_get_attr_search_ctx(NULL, mr))) + perr_exit("ntfs_get_attr_search_ctx"); + + while (!ntfs_walk_attrs(ctx)) { + if (ctx->attr->type == AT_END) + break; + build_lcn_usage_bitmap(ctx->attr); + } + + ntfs_put_attr_search_ctx(ctx); +} + + +void get_bitmap_data(ntfs_volume *vol, struct bitmap *bm) +{ + ntfs_inode *ni; + ntfs_attr_search_ctx *ctx; + + if (!(ni = ntfs_open_inode(vol, (MFT_REF)FILE_Bitmap))) + perr_exit("ntfs_open_inode"); + + if (!(ctx = ntfs_get_attr_search_ctx(ni, NULL))) + perr_exit("ntfs_get_attr_search_ctx"); + + if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) + perr_exit("ntfs_lookup_attr"); + + /* FIXME: get_attribute_value_length() can't handle extents */ + bm->size = get_attribute_value_length(ctx->attr); + + if (!(bm->bm = (u8 *)malloc(bm->size))) + perr_exit("get_bitmap_data"); + + if (get_attribute_value(vol, ni->mrec, ctx->attr, bm->bm) != bm->size) + perr_exit("Couldn't get $Bitmap $DATA\n"); + + ntfs_put_attr_search_ctx(ctx); + ntfs_close_inode(ni); +} + + +void compare_bitmaps(struct bitmap *a, struct bitmap *b) +{ + int i; + + if (a->size != b->size) + err_exit("$Bitmap file size doesn't match " + "calculated size ((%d != %d)\n", a->size, b->size); + + for (i = 0; i < a->size; i++) + if (a->bm[i] != b->bm[i]) + err_exit("Cluster bitmaps differ at %d (%d != %d)\n", + i, a->bm[i], b->bm[i]); +} + + +void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) +{ + p->start = start; + p->stop = stop; + p->unit = 100.0 / (stop - start); + p->resolution = res; +} + + +void progress_update(struct progress_bar *p, u64 current) +{ + float percent = p->unit * current; + + if (current != p->stop) { + if ((current - p->start) % p->resolution) + return; + printf("%6.2f percent completed\r", percent); + } else + printf("100.00 percent completed\n"); + fflush(stdout); +} + +void walk_inodes() +{ + s32 inode = 0; + s64 last_mft_rec; + MFT_REF mref; + MFT_RECORD *mrec = NULL; + struct progress_bar progress; + + printf("Scanning volume ...\n"); + + last_mft_rec = vol->nr_mft_records - 1; + progress_init(&progress, inode, last_mft_rec, 100); + + for (; inode <= last_mft_rec; inode++) { + progress_update(&progress, inode); + + mref = (MFT_REF)inode; + if (ntfs_read_file_record(vol, mref, &mrec, NULL)) { + /* FIXME: continue only if it make sense, e.g. + MFT record not in use based on $MFT bitmap */ + if (errno == EIO) + continue; + perr_exit("Reading inode %ld failed", inode); + } + if (!(mrec->flags & MFT_RECORD_IN_USE)) + continue; + + walk_attributes(mrec); + } + if (mrec) + free(mrec); +} + + +void advise_on_resize() +{ + u64 i; + + for (i = vol->nr_clusters - 1; i > 0; i--) + if (ntfs_get_bit(lcn_bitmap.bm, i)) + break; + + i += 2; /* first free + we reserve one for the backup boot sector */ + if (i >= vol->nr_clusters) { + if (opt.info) + printf("The volume end is fragmented. " + "This case is not yet supported.\n"); + exit(1); + } + + if (!opt.info) + printf(NERR_PREFIX "However, "); + + printf("You could resize at cluster %lld gaining %lld MB.\n", + i, ((vol->nr_clusters - i) * vol->cluster_size) >> 20); + exit(1); +} + + +void look_for_bad_sector(ATTR_RECORD *a) +{ + run_list *rl; + int i; + + rl = ntfs_decompress_mapping_pairs(vol, a, NULL); + if (!rl) + perr_exit("ntfs_decompress_mapping_pairs"); + + for (i = 0; rl[i].length; i++) + if (rl[i].lcn != LCN_HOLE) + err_exit("Device has bad sectors, not supported\n"); + + free(rl); +} + + +void rl_set(run_list *rl, VCN vcn, LCN lcn, s64 len) +{ + rl->vcn = vcn; + rl->lcn = lcn; + rl->length = len; +} + + +/* + * $Bitmap can overlap the end of the volume. Any bits in this region + * must be set. This region also encompasses the backup boot sector. + */ +void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) +{ + for (; cluster < bm->size << 3; cluster++) + ntfs_set_bit(bm->bm, (u64)cluster, 1); +} + + +/* + * FIXME: this function should go away and instead using a generalized + * "truncate_bitmap_unnamed_attr()" + */ +void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) +{ + run_list *rl_bad; + int mp_size; + char *mp; + + if (!a->non_resident) + /* FIXME: handle resident attribute value */ + perr_exit("Resident attribute in $BadClust not supported!"); + + if (!(rl_bad = (run_list *)malloc(2 * sizeof(run_list)))) + perr_exit("Couldn't get memory"); + + rl_set(rl_bad, 0LL, (LCN)LCN_HOLE, nr_clusters); + rl_set(rl_bad + 1, nr_clusters, -1LL, 0LL); + + mp_size = ntfs_get_size_for_mapping_pairs(vol, rl_bad); + + if (!(mp = (char *)calloc(1, mp_size))) + perr_exit("Couldn't get memory"); + + if (ntfs_build_mapping_pairs(vol, mp, mp_size, rl_bad)) + exit(1); + + memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); + a->highest_vcn = cpu_to_le64(nr_clusters - 1LL); + a->allocated_size = cpu_to_le64(nr_clusters * vol->cluster_size); + a->data_size = cpu_to_le64(nr_clusters * vol->cluster_size); + + free(rl_bad); + free(mp); +} + + +void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) +{ + run_list *rl; + s64 bm_bsize, size; + s64 nr_bm_clusters; + int i, j, mp_size; + int trunc_at = -1; /* FIXME: -1 means unset */ + char *mp; + + + if (!a->non_resident) + /* FIXME: handle resident attribute value */ + perr_exit("Resident data attribute in $Bitmap not supported!"); + + bm_bsize = nr_clusters_to_bitmap_byte_size(nr_clusters); + nr_bm_clusters = rounded_up_division(bm_bsize, vol->cluster_size); + + if (!(rl = ntfs_decompress_mapping_pairs(vol, a, NULL))) + perr_exit("ntfs_decompress_mapping_pairs"); + + /* Unallocate truncated clusters in $Bitmap */ + for (i = 0; rl[i].length; i++) { + if (rl[i].vcn + rl[i].length <= nr_bm_clusters) + continue; + if (trunc_at == -1) + trunc_at = i; + if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) + continue; + for (j = 0; j < rl[i].length; j++) + if (rl[i].vcn + j >= nr_bm_clusters) { + u64 k = (u64)rl[i].lcn + j; + ntfs_set_bit(lcn_bitmap.bm, k, 0); + Dprintf("Unallocate cluster: " + "%llu (%llx)\n", k, k); + } + } + + /* FIXME: realloc lcn_bitmap.bm (if it's worth the risk) */ + lcn_bitmap.size = bm_bsize; + bitmap_file_data_fixup(nr_clusters, &lcn_bitmap); + + if (trunc_at != -1) { + /* NOTE: 'i' always > 0 */ + i = nr_bm_clusters - rl[trunc_at].vcn; + rl[trunc_at].length = i; + rl_set(rl + trunc_at + 1, nr_bm_clusters, -1LL, 0LL); + + Dprintf("Runlist truncated at index %d, " + "new cluster length %d\n", trunc_at, i); + } + + if (!opt.ro_flag) { + size = ntfs_rl_pwrite(vol, rl, 0, bm_bsize, lcn_bitmap.bm); + if (bm_bsize != size) { + if (size == -1) + perr_exit("Couldn't write $Bitmap"); + printf("Couldn't write full $Bitmap file " + "(%lld from %lld)\n", size, bm_bsize); + exit(1); + } + } + + mp_size = ntfs_get_size_for_mapping_pairs(vol, rl); + + if (!(mp = (char *)calloc(1, mp_size))) + perr_exit("Couldn't get memory"); + + if (ntfs_build_mapping_pairs(vol, mp, mp_size, rl)) + exit(1); + + memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); + a->highest_vcn = cpu_to_le64(nr_bm_clusters - 1LL); + a->allocated_size = cpu_to_le64(nr_bm_clusters * vol->cluster_size); + a->data_size = cpu_to_le64(bm_bsize); + a->initialized_size = cpu_to_le64(bm_bsize); + + free(rl); + free(mp); +} + + +void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) +{ + ntfs_inode *ni; + uchar_t *ustr = NULL; + int len = 0; + + if (!(ni = ntfs_open_inode(vol, mref))) + perr_exit("ntfs_open_inode"); + + if (NInoAttrList(ni)) + perr_exit("Attribute list attribute not yet supported"); + + if (!(*ctx = ntfs_get_attr_search_ctx(ni, NULL))) + perr_exit("ntfs_get_attr_search_ctx"); + + if (aname && ((len = ntfs_mbstoucs(aname, &ustr, 0)) == -1)) + perr_exit("Unable to convert string to Unicode"); + + if (!ustr || !len) { + ustr = AT_UNNAMED; + len = 0; + } + + if (ntfs_lookup_attr(AT_DATA, ustr, len, 0, 0, NULL, 0, *ctx)) + perr_exit("ntfs_lookup_attr"); + + if (ustr != AT_UNNAMED) + free(ustr); +} + + +int write_mft_record(ntfs_attr_search_ctx *ctx) +{ + if (opt.ro_flag) + return 0; + + return ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no, ctx->mrec); +} + + +void truncate_badclust_file(s64 nr_clusters) +{ + ntfs_attr_search_ctx *ctx = NULL; + + printf("Updating $BadClust file ...\n"); + + lookup_data_attr((MFT_REF)FILE_BadClus, "$Bad", &ctx); + look_for_bad_sector(ctx->attr); + /* FIXME: sanity_check_attr(ctx->attr); */ + /* FIXME: should use an "extended" truncate_bitmap_unnamed_attr() */ + truncate_badclust_bad_attr(ctx->attr, nr_clusters); + + if (write_mft_record(ctx)) + perr_exit("Couldn't update $BadClust"); + + /* FIXME: clean up API => ntfs_put_attr_search_ctx() also closes ni */ + ntfs_put_attr_search_ctx(ctx); +} + + +void truncate_bitmap_file(s64 nr_clusters) +{ + ntfs_attr_search_ctx *ctx = NULL; + + printf("Updating $Bitmap file ...\n"); + + lookup_data_attr((MFT_REF)FILE_Bitmap, NULL, &ctx); + /* FIXME: sanity_check_attr(ctx->attr); */ + truncate_bitmap_unnamed_attr(ctx->attr, nr_clusters); + + if (write_mft_record(ctx)) + perr_exit("Couldn't update $Bitmap"); + + ntfs_put_attr_search_ctx(ctx); +} + + +void setup_lcn_bitmap() +{ + /* Determine lcn bitmap byte size and allocate it. */ + lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); + + if (!(lcn_bitmap.bm = (unsigned char *)calloc(1, lcn_bitmap.size))) + perr_exit("Failed to allocate internal buffer"); + + bitmap_file_data_fixup(vol->nr_clusters, &lcn_bitmap); +} + + +/* FIXME: should be done using ntfs_* functions */ +void update_bootsector(s64 nr_clusters) +{ + NTFS_BOOT_SECTOR bs; + + printf("Updating Boot record ...\n"); + + if (lseek(vol->fd, 0, SEEK_SET) == (off_t)-1) + perr_exit("lseek"); + + if (read(vol->fd, &bs, sizeof(NTFS_BOOT_SECTOR)) == -1) + perr_exit("read() error"); + + bs.number_of_sectors = nr_clusters * bs.bpb.sectors_per_cluster; + bs.number_of_sectors = cpu_to_le64(bs.number_of_sectors); + + if (lseek(vol->fd, 0, SEEK_SET) == (off_t)-1) + perr_exit("lseek"); + + if (!opt.ro_flag) + if (write(vol->fd, &bs, sizeof(NTFS_BOOT_SECTOR)) == -1) + perr_exit("write() error"); +} + + +void print_volume_size(char *str, ntfs_volume *v, s64 nr_clusters) +{ + printf("%s: %lld clusters (%lld MB)\n", + str, nr_clusters, (nr_clusters * v->cluster_size) >> 20); +} + + +void mount_volume() +{ + unsigned long mntflag; + + if (ntfs_check_if_mounted(opt.volume, &mntflag)) + perr_exit("Failed to check '%s' mount state", opt.volume); + + if (mntflag & NTFS_MF_MOUNTED) { + if (!(mntflag & NTFS_MF_READONLY)) + err_exit("Device %s is mounted read-write. " + "You must umount it first.\n", opt.volume); + if (!opt.ro_flag) + err_exit("Device %s is mounted. " + "You must umount it first.\n", opt.volume); + } + + if (!(vol = ntfs_mount(opt.volume, opt.ro_flag))) + perr_exit("ntfs_mount failed"); + + if (vol->flags & VOLUME_IS_DIRTY) + if (!opt.force--) + err_exit("Volume is dirty. Run chkdsk and " + "please try again (or see -f option).\n"); + + printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); + if (ntfs_is_version_supported(vol)) + perr_exit("Unknown NTFS version"); + + printf("Cluster size : %u\n", vol->cluster_size); + print_volume_size("Current volume size", vol, vol->nr_clusters); +} + + +void prepare_volume_fixup() +{ + if (!opt.ro_flag) { + u16 flags; + + flags = vol->flags | VOLUME_IS_DIRTY; + if (vol->major_ver >= 2) + flags |= VOLUME_MOUNTED_ON_NT4; + + printf("Setting NTFS $Volume flag dirty ...\n"); + if (ntfs_set_volume_flags(vol, flags)) + perr_exit("Failed to set $Volume dirty"); + + printf("Resetting $LogFile ...\n"); + if (ntfs_reset_logfile(vol)) + perr_exit("Failed to reset $LogFile"); + } +} + + +int main(int argc, char **argv) +{ + struct bitmap on_disk_lcn_bitmap; + s64 new_volume_size = 0; /* in clusters */ + int i; + + parse_options(argc, argv); + + mount_volume(); + + if (opt.size || opt.bytes) { + new_volume_size = opt.bytes / vol->cluster_size; + if (opt.size) + new_volume_size = opt.size; + print_volume_size("New volume size ", vol, new_volume_size); + } + + setup_lcn_bitmap(); + + walk_inodes(); + + get_bitmap_data(vol, &on_disk_lcn_bitmap); + compare_bitmaps(&on_disk_lcn_bitmap, &lcn_bitmap); + free(on_disk_lcn_bitmap.bm); + + if (opt.info) + advise_on_resize(); + + /* FIXME: check new_volume_size validity */ + + /* Backup boot sector at the end of device isn't counted in NTFS + volume size thus we have to reserve space for. We don't trust + the user does this for us: better to be on the safe side ;) */ + if (new_volume_size) + --new_volume_size; + + if (new_volume_size > vol->nr_clusters) + err_exit("Volume enlargement not yet supported\n"); + else if (new_volume_size == vol->nr_clusters) { + printf("==> Nothing to do: NTFS volume size is already OK.\n"); + exit(0); + } + + for (i = new_volume_size; i < vol->nr_clusters; i++) + if (ntfs_get_bit(lcn_bitmap.bm, (u64)i)) { + /* FIXME: relocate cluster */ + printf(NERR_PREFIX "Fragmented volume not yet " + "supported. Defragment it before resize.\n"); + advise_on_resize(); + } + + /* FIXME: first do all checks before any write attempt */ + + prepare_volume_fixup(); + + truncate_badclust_file(new_volume_size); + truncate_bitmap_file(new_volume_size); + update_bootsector(new_volume_size); + + /* We don't create backup boot sector because we don't know where the + partition will be split. The scheduled chkdsk will fix it anyway */ + + printf("==> NTFS had been successfully resized on device %s.\n" + "==> Now you can go on to resize/split the partition.\n", + vol->dev_name); + + return 0; +} + From e80befbfb5c83975bab7e65bb1519f63a63a7b5b Mon Sep 17 00:00:00 2001 From: !szaka Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0097/2994] Merge set_ntfs_volume_flags() and code from ntfsfix as a new library function: ntfs_set_volume_flags(). Note, ntfs_set_volume_flags() is moving to volume.[ch] 2002/07/12 12:38:54-00:00 !szaka Rewrote $LogFile reset using new inode API and moved it from ntfsfix to libntfs as ntfs_reset_logfile(). ntfsresize also resets log file. 2002/07/12 07:10:44-00:00 !szaka NTFS_V* version macros and ntfs_is_version_supported() added. Modified ntfsfix and ntfsresize to use them. 2002/07/11 16:20:34-00:00 !flatcap whitespace and include guards 2002/07/08 23:27:17-00:00 !flatcap added AT_NONAME so we can search for a (un)named attribute or just iterate through all attributes 2002/07/07 19:44:57-00:00 !antona Change ntfs_read_file_record() not to abort if the inode is not in use. Adapt callers which care to check this themselves. 2002/07/03 21:56:01-00:00 !antona Updates 2002/07/02 23:47:11-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/05 20:32:53-00:00 !antona Mft mirror now updated from ntfs_write_mft_record, yey! Fixup ntfstools accordingly. 2002/06/02 23:02:20-00:00 !antona More fixes and updates. 2002/04/29 01:53:55-00:00 !antona Loads of stuff. Improvements, start on attr pread and attr mst_pread. Write to follow. ntfslabel cleanup and extensions. libntfs cleanups, fixes, etc. 2002/04/27 19:49:10-00:00 !antona Update library, new APIs ntfs_attr_find_vcn(), misc fixes and cleanups, make all the utilities compile, fix bugs I noticed in ntfslabel and it now works properly. 2002/04/21 01:26:39-00:00 !antona Cleanup/streamline include file dependencies. 2002/04/20 23:09:43-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/20 01:53:03-00:00 !antona Rename mft code adding ntfs_ prefix. Change all return values to zero on success. Thanks to mattjf for pointing out the inconsistencies. 2002/04/19 21:09:55-00:00 !antona Finished provisional inode.c::ntfs_{open,close}_inode() functions. Also, started defining API provided by attrib.[ch], so far only done search context related stuff. 2002/04/16 15:34:32-00:00 !antona Fix the library... 2002/04/15 19:17:24-00:00 !antona Fix ntfsfix as well. This completes all changes and everything should be just as functional as before. 2002/04/14 14:15:47-00:00 !antona Cleanups and updates. 2002/03/12 22:11:02-00:00 !antona Final tidyups. 2002/03/12 22:00:44-00:00 !antona Fix a few small mistakes 2002/03/12 21:48:27-00:00 !antona Change version numbers of mkntfs and ntfsfix to match linux-ntfs release and add options to mkntfs to disable content indexing on the volume and to enable compression on the volume. 2002/01/26 02:22:05-00:00 !antona Fix two bugs (we called is_baad_record instead of is_baad_recordp...). Thanks to David Martinez Moreno for reporting the compile time warnings on ia64 which led me to find the bugs. 2001/12/06 01:14:52-00:00 !antona Added mount flags to ntfs_mount and adapted utilities to new mount syntax. 2001/11/09 18:24:32-00:00 !antona Updates to docs, layout.h and ntfsfix to support Windows XP NTFS 2001/08/02 01:44:57-00:00 !antona Add ntfsfix man page and spell fixes. Update to 1.2.1 version and update all text files to go with it and the rpm spec file. 2001/06/01 02:07:26-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 15:47:36-00:00 !antona Fix 2001/04/11 15:29:39-00:00 !flatcap minor build fixes 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/04/02 23:02:41-00:00 !antona Fixed a braino the compiler didn't catch... 2001/04/02 02:38:39-00:00 !antona I think version reporting is now fixed. 2001/04/02 02:20:53-00:00 !antona Fixed up the automatic version numbering (I hope). 2001/04/02 02:13:57-00:00 !antona Make the ntfsfix version be equal to the Revision in CVS. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/03/02 15:06:37-00:00 !antona Full commit of my current dircetory. New files not yet added. 2001/02/03 04:21:49-00:00 !antona Finished first public release. This is the final commit to make sure everything is in cvs. 2001/02/02 00:16:18-00:00 !antona Changed make process to using autoconf/automake/libtool. Added necessary files for this and for the gnu standard. Inititial checkin. Probably still stuff missing. Will know soon... 2001/01/30 12:55:21-00:00 !antona Fixed the compilation issues. 2001/01/27 14:22:02-00:00 !antona Added a logfile dumper as a new utility. Almost finished the first ntfsfix release. (Still missingin CVS are attrib.c for ntfslib and the makefiles to build everything.) Fixes for nested packed structure/union typedefs as gcc doesn't automatically nest the __attribute__ ((__packed__)), even though according to the gcc info page it does. (Thanks to Yuri Per for pointing this out.) 2001/01/24 21:02:37-00:00 !antona Added ntfsfix program. (Logical change 1.5) --- ntfstools/ntfsfix.c | 317 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 317 insertions(+) diff --git a/ntfstools/ntfsfix.c b/ntfstools/ntfsfix.c index e69de29b..e852061b 100644 --- a/ntfstools/ntfsfix.c +++ b/ntfstools/ntfsfix.c @@ -0,0 +1,317 @@ +/* + * $Id$ + * + * NtfsFix - Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This utility will attempt to fix a partition that has been damaged by the + * current Linux-NTFS driver. It should be run after dismounting a NTFS + * partition that has been mounted read-write under Linux and before rebooting + * into Windows NT/2000. NtfsFix can be run even after Windows has had mounted + * the partition, but it might be too late and irreversible damage to the data + * might have been done already. + * + * Anton Altaparmakov + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS source + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * WARNING: This program might not work on architectures which do not allow + * unaligned access. For those, the program would need to start using + * get/put_unaligned macros (#include ), but not doing it yet, + * since NTFS really mostly applies to ia32 only, which does allow unaligned + * accesses. We might not actually have a problem though, since the structs are + * defined as being packed so that might be enough for gcc to insert the + * correct code. + * + * If anyone using a non-little endian and/or an aligned access only CPU tries + * this program please let me know whether it works or not! + * + * Anton Altaparmakov + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include + +#include "types.h" +#include "attrib.h" +#include "mft.h" +#include "disk_io.h" +#include "logfile.h" + +int main(int argc, char **argv) +{ + s64 l, br; + const char *EXEC_NAME = "NtfsFix"; + const char *OK = "OK"; + const char *FAILED = "FAILED"; + unsigned char *m = NULL, *m2 = NULL; + ntfs_volume *vol; + unsigned long mnt_flags; + int i; + u16 flags; + BOOL done, force = FALSE; + + printf("\n"); + if (argc != 2 || !argv[1]) { + printf("%s v%s - Attempt to fix an NTFS partition that " + "has been damaged by the\nLinux NTFS driver. Note that " + "you should run it every time after you have used\nthe " + "Linux NTFS driver to write to an NTFS partition to " + "prevent massive data\ncorruption from happening when " + "Windows mounts the partition.\nIMPORTANT: Run this " + "only *after* unmounting the partition in Linux but " + "*before*\nrebooting into Windows NT/2000/XP or you " + "*will* suffer! - You have been warned!\n\n" + /* Generic copyright / disclaimer. */ + "Copyright (c) 2000-2002 Anton Altaparmakov.\n\n" + "%s is free software, released under the GNU " + "General Public License and you\nare welcome to " + "redistribute it under certain conditions.\n" + "%s comes with ABSOLUTELY NO WARRANTY; for details " + "read the file GNU\nGeneral Public License to be found " + "in the file COPYING in the main Linux-NTFS\n" + "distribution directory.\n\n" + /* Generic part ends here. */ + "Syntax: ntfsfix partition_or_file_name\n" + " e.g. ntfsfix /dev/hda6\n\n", EXEC_NAME, + VERSION, EXEC_NAME, EXEC_NAME); + fprintf(stderr, "Error: incorrect syntax\n"); + exit(1); + } + if (!ntfs_check_if_mounted(argv[1], &mnt_flags)) { + if ((mnt_flags & NTFS_MF_MOUNTED) && + !(mnt_flags & NTFS_MF_READONLY) && !force) { + fprintf(stderr, "Refusing to operate on read-write " + "mounted device %s.\n", argv[1]); + exit(1); + } + } else + fprintf(stderr, "Failed to determine whether %s is mounted: " + "%s\n", argv[1], strerror(errno)); + /* Attempt a full mount first. */ + printf("Mounting volume... "); + vol = ntfs_mount(argv[1], 0); + if (vol) { + puts(OK); + printf("\nProcessing of $MFT and $MFTMirr completed " + "successfully.\n\n"); + goto mount_ok; + } + puts(FAILED); + + puts("Attempting to correct errors."); + + vol = ntfs_startup_volume(argv[1], 0); + if (!vol) { + puts(FAILED); + perror("Failed to startup volume"); + fprintf(stderr, "Volume is corrupt. You should run chkdsk."); + goto error_exit; + } + + puts("Processing $MFT and $MFTMirr."); + + /* Load data from $MFT and $MFTMirr and compare the contents. */ + m = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); + m2 = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); + if (!m || !m2) { + perror("Failed to allocate memory"); + goto error_exit; + } + + printf("Reading $MFT... "); + l = ntfs_attr_mst_pread(vol->mft_na, 0, vol->mftmirr_size, + vol->mft_record_size, m); + if (l != vol->mftmirr_size) { + puts(FAILED); + if (l != -1) + errno = EIO; + perror("Failed to read $MFT"); + goto error_exit; + } + puts(OK); + + printf("Reading $MFTMirr... "); + l = ntfs_attr_mst_pread(vol->mftmirr_na, 0, vol->mftmirr_size, + vol->mft_record_size, m2); + if (l != vol->mftmirr_size) { + puts(FAILED); + if (l != -1) + errno = EIO; + perror("Failed to read $MFTMirr"); + goto error_exit; + } + puts(OK); + + /* + * FIXME: Need to actually check the $MFTMirr for being real. Otherwise + * we might corrupt the partition if someone is experimenting with + * software RAID and the $MFTMirr is not actually in the position we + * expect it to be... )-: + * FIXME: We should emit a warning it $MFTMirr is damaged and ask + * user whether to recreate it from $MFT or whether to abort. - The + * warning needs to include the danger of software RAID arrays. + * Maybe we should go as far as to detect whether we are running on a + * MD disk and if yes then bomb out right at the start of the program? + */ + + printf("Comparing $MFTMirr to $MFT... "); + done = FALSE; + for (i = 0; i < vol->mftmirr_size; ++i) { + const char *ESTR[12] = { "$MFT", "$MFTMirr", "$LogFile", + "$Volume", "$AttrDef", "root directory", "$Bitmap", + "$Boot", "$BadClus", "$Secure", "$UpCase", "$Extend" }; + const char *s; + + if (i < 12) + s = ESTR[i]; + else if (i < 16) + s = "system file"; + else + s = "mft record"; + + if (is_baad_recordp(m + i * vol->mft_record_size)) { + puts("FAILED"); + fprintf(stderr, "$MFT error: Incomplete multi sector " + "transfer detected in %s.\nCannot " + "handle this yet. )-:\n", s); + goto error_exit; + } + if (!is_mft_recordp(m + i * vol->mft_record_size)) { + puts("FAILED"); + fprintf(stderr, "$MFT error: Invalid mft record for " + "%s.\nCannot handle this yet. )-:\n", + s); + goto error_exit; + } + if (is_baad_recordp(m2 + i * vol->mft_record_size)) { + puts("FAILED"); + fprintf(stderr, "$MFTMirr error: Incomplete multi " + "sector transfer detected in %s.\n", s); + goto error_exit; + } + if (!is_mft_recordp(m2 + i * vol->mft_record_size)) { + puts("FAILED"); + fprintf(stderr, "$MFTMirr error: Invalid mft record " + "for %s.\n", s); + goto error_exit; + } + if (memcmp((u8*)m + i * vol->mft_record_size, (u8*)m2 + + i * vol->mft_record_size, + ntfs_get_mft_record_data_size((MFT_RECORD*)( + (u8*)m + i * vol->mft_record_size)))) { + if (!done) { + done = TRUE; + puts(FAILED); + printf("Correcting differences in " + "$MFTMirr... "); + } + br = ntfs_write_mft_record(vol, i, (MFT_RECORD*)(m + + i * vol->mft_record_size)); + if (br) { + puts(FAILED); + perror("Error correcting $MFTMirr"); + goto error_exit; + } + } + } + puts(OK); + + free(m); + free(m2); + m = m2 = NULL; + + printf("Processing of $MFT and $MFTMirr completed successfully.\n\n"); + if (ntfs_umount(vol, 0)) + ntfs_umount(vol, 1); + vol = ntfs_mount(argv[1], 0); + if (!vol) { + perror("Remount failed"); + goto error_exit; + } +mount_ok: + m = NULL; + + /* Check NTFS version is ok for us (in $Volume) */ + printf("NTFS volume version is %i.%i.\n\n", vol->major_ver, + vol->minor_ver); + if (ntfs_is_version_supported(vol)) { + fprintf(stderr, "Error: Unknown NTFS version.\n"); + goto error_exit; + } + + printf("Setting required flags on partition... "); + /* + * Set chkdsk flag, i.e. mark the partition dirty so chkdsk will run + * and fix it for us. + */ + flags = vol->flags | VOLUME_IS_DIRTY; + /* If NTFS volume version >= 2.0 then set mounted on NT4 flag. */ + if (vol->major_ver >= 2) + flags |= VOLUME_MOUNTED_ON_NT4; + if (ntfs_set_volume_flags(vol, flags)) { + puts(FAILED); + fprintf(stderr, "Error setting volume flags.\n"); + goto error_exit; + } + puts(OK); + printf("\n"); + + printf("Going to empty the journal ($LogFile)... "); + if (ntfs_reset_logfile(vol)) { + puts(FAILED); + perror("Failed to reset $LogFile"); + goto error_exit; + } + puts(OK); + printf("\n"); + + if (vol->major_ver >= 3) { + /* FIXME: If on NTFS 3.0+, check for presence of the usn journal and + disable it (if present) as Win2k might be unhappy otherwise and Bad + Things(TM) could happen depending on what applications are actually + using it for. */ + } + + /* FIXME: Should we be marking the quota out of date, too? */ + + /* That's all for now! */ + printf("NTFS partition %s was processed successfully.\n", + vol->dev_name); + /* Set return code to 0. */ + i = 0; +final_exit: + if (m) + free(m); + if (m2) + free(m2); + if (vol && ntfs_umount(vol, 0)) + ntfs_umount(vol, 1); + return i; +error_exit: + i = 1; + goto final_exit; +} + From 1935ac9421c8cd0004d148872d67827ab4622a91 Mon Sep 17 00:00:00 2001 From: !szaka Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0098/2994] Move ntfs_set_volume_flags() from attrib[ch] to volume.[ch] 2002/07/14 12:36:04-00:00 !szaka Increase NTFS_BUF_SIZE to 8192 (better average performance) 2002/07/12 12:38:54-00:00 !szaka Rewrote $LogFile reset using new inode API and moved it from ntfsfix to libntfs as ntfs_reset_logfile(). ntfsresize also resets log file. 2002/07/12 07:10:44-00:00 !szaka NTFS_V* version macros and ntfs_is_version_supported() added. Modified ntfsfix and ntfsresize to use them. 2002/07/11 16:20:33-00:00 !flatcap whitespace and include guards 2002/07/11 13:18:11-00:00 !flatcap start to break up the dependency loops in the header files 2002/07/02 23:47:10-00:00 !antona Global replacement of __[su]{8,16,32,64} with [su]{8,16,32,64} and layout.h define it. 2002/06/06 20:47:32-00:00 !antona The beginning of the directory operations! Introduce dir.[hc] and ntfs_lookup_inode_by_name(). 2002/06/02 23:02:20-00:00 !antona More fixes and updates. 2002/06/01 00:41:45-00:00 !antona huge update! 2002/04/29 01:53:55-00:00 !antona Loads of stuff. Improvements, start on attr pread and attr mst_pread. Write to follow. ntfslabel cleanup and extensions. libntfs cleanups, fixes, etc. 2002/04/27 19:49:09-00:00 !antona Update library, new APIs ntfs_attr_find_vcn(), misc fixes and cleanups, make all the utilities compile, fix bugs I noticed in ntfslabel and it now works properly. 2002/04/23 23:27:33-00:00 !antona Fixup the force option in mkntfs.c. Change the ntfs_check_if_mounted so it works on system not implementing {set,get,end}mntent, too. Also make it more powerful in telling us not only if something is mounted but also if it is the fs root and if it is read-only. 2002/04/22 10:34:31-00:00 !antona Attribute list support (merging done, part 2, some stuff still incomplete). mkntfs ntfs volume creation. See the changelog... 2002/04/20 23:09:42-00:00 !antona Port attribute lookup functions with attribute list support from ntfs tng driver. Port/reimplement extent mft record handling code as well. Rename out all dollar signs from type names and constants. Adapt all callers to new API. Note mkntfs is currently broken due to some needed work. 2002/04/14 13:56:45-00:00 !antona cleanup header files. 2001/12/06 01:14:52-00:00 !antona Added mount flags to ntfs_mount and adapted utilities to new mount syntax. 2001/06/01 02:07:24-00:00 !antona It has been a long time since last commit. At moment have done a lot of work on mkntfs but also at the moment ntfsfix and ntfsdump_logfile and libntfs are broken. Basically only mkntfs works and that is not complete either. 2001/04/11 11:49:16-00:00 !antona Header file reorganisation so that it compiles. 2001/04/10 23:37:19-00:00 !antona Ok, ntfsd was a mistake for userspace. It increases complexity no end while not giving us much functionality. Lets get it working and then worry about the kernel. - As it was the idea originally anyway, so this is just a return on the right track. (-8 We keep the timer and signal handler but the only thing we do is to set a bool flag (ntfs_need_sync) and we will just check this in appropriate places and if it is true we call ntfs_sync_volumes() which sets it back to false. This means no more locking at all of any description and no need to worry about the signal handler interrupting things in bad ways and/or at bad times in the main code. 2001/04/10 22:20:19-00:00 !antona Ok, ntfsd was a mistake for userspace. It increases complexity no end while not giving us much functionality. Lets get it working and then worry about the kernel. - As it was the idea originally anyway, so this is just a return on the right track. (-8 We keep the timer and signal handler but the only thing we do is to set a bool flag (ntfs_need_sync) and we will just check this in appropriate places and if it is true we call ntfs_sync_volumes() which sets it back to false. This means no more locking at all of any description and no need to worry about the signal handler interrupting things in bad ways and/or at bad times in the main code. 2001/04/09 00:05:37-00:00 !antona More or less finished file handling. (Probably some useful functions are still missing but they will be implemented as need arises.) One thing that is stupid at the moment is we don't limit the amount of cached mft_records so if you were to load loads the machine would eventually run out of memory... Can't happen with files as they are limited to 1000, unless you are short of memory. (Hard limit at the moment, set in ntfs_mount(). Maybe ntfsd should be monitoring memory usage and be throwing out unused cache entries and closed_files? That would mean to have locking everywhere, though.) Still missing: - Convert old code to use new stuff. - Add non-resident attributes somewhere. Either into the mft_entry structure or into the ntfs_file structure, but which? At the moment I tend to mft_entry so they can be synced together with the entries by ntfsd. 2001/04/08 03:02:55-00:00 !antona Added cvs Id header. 2001/04/08 01:58:29-00:00 !antona User space conversion of locking complete. I settled for using simple spinlocks and atomic variables and instead of deadlocking/livelocking when using spin_lock(), use spin_trylock() in a while letting go of the cpu between each call and making a maximum of 100 iterations (or we return EDEADLK error code). This is not the most efficient way, especially as can't have multiple readers but it is the simplest way to go about things. Should now have (almost) all required helper functions for dealing with mft entries implemented. Now need the file handling and then convert the whole project to use the new code and then can finally get back to work on attribute searching... 2001/04/07 17:30:10-00:00 !antona ntfsd should be finished now 2001/04/03 22:41:30-00:00 !antona We now have files and keep track of them on a per volume basis and same for inodes (mft_records). At least conceptually anyway. 2001/04/02 02:04:37-00:00 !antona Everything compiles again! Yey! (Don't know about working though, haven't tried it... So be careful...) The definitely final find_{first_}attr() functions are in place. Currently still no support for attribute lists. The two new _RE files contain the C-fied and more or less (more less than more actually) cleaned up functions from the ntfs driver. Once they are cleaned up (find_attr() is already completed but I left it in the _RE files for future reference/educational value) and modified to suit my ideas of how they should work, which are not quite the same as the driver way, they will make it into attrib.[ch]. If anyone gives the new code a try, I would be interested in whether it worked or not... (-; 2001/03/06 02:10:55-00:00 !antona Allow variable length upcase table. Progressing on find_next_attr(). 2001/01/30 12:55:21-00:00 !antona Fixed the compilation issues. 2001/01/25 14:00:43-00:00 !antona Added volume.c code and fixed some typos and inconsistencies. 2001/01/24 02:13:24-00:00 !antona Add a bunch of headers (attrib.h is work in progress). (Logical change 1.5) --- include/volume.h | 155 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) diff --git a/include/volume.h b/include/volume.h index e69de29b..0b419494 100644 --- a/include/volume.h +++ b/include/volume.h @@ -0,0 +1,155 @@ +/* + * $Id$ + * + * volume.h - Exports for NTFS volume handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_VOLUME_H +#define _NTFS_VOLUME_H + +#include "config.h" + +#include +#ifdef HAVE_MNTENT_H +# include +#endif + +/* Forward declaration */ +typedef struct _ntfs_volume ntfs_volume; + +#include "types.h" +#include "support.h" +#include "inode.h" + +/* + * Flags returned by the ntfs_check_if_mounted() function. + */ +typedef enum { + NTFS_MF_MOUNTED = 1, /* Device is mounted. */ + NTFS_MF_ISROOT = 2, /* Device is mounted as system root. */ + NTFS_MF_READONLY = 4, /* Device is mounted read-only. */ +} ntfs_mount_flags; + +extern int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags); + +/* + * Defined bits for the state field in the ntfs_volume structure. + */ +typedef enum { + NV_ReadOnly, /* 1: Volume is read-only. */ + NV_CaseSensitive, /* 1: Volume is mounted case-sensitive. */ +} ntfs_volume_state_bits; + +#define test_nvol_flag(nv, flag) test_bit(NV_##flag, (nv)->state) +#define set_nvol_flag(nv, flag) set_bit(NV_##flag, (nv)->state) +#define clear_nvol_flag(nv, flag) clear_bit(NV_##flag, (nv)->state) + +#define NVolReadOnly(nv) test_nvol_flag(nv, ReadOnly) +#define NVolSetReadOnly(nv) set_nvol_flag(nv, ReadOnly) +#define NVolClearReadOnly(nv) clear_nvol_flag(nv, ReadOnly) + +#define NVolCaseSensitive(nv) test_nvol_flag(nv, CaseSensitive) +#define NVolSetCaseSensitive(nv) set_nvol_flag(nv, CaseSensitive) +#define NVolClearCaseSensitive(nv) clear_nvol_flag(nv, CaseSensitive) + +/* + * NTFS version 1.1 and 1.2 are used by Windows NT4. + * NTFS version 2.x is used by Windows 2000 Beta + * NTFS version 3.0 is used by Windows 2000. + * NTFS version 3.1 is used by Windows XP and .NET. + */ + +#define NTFS_V1_1(major, minor) ((major) == 1 && (minor) == 1) +#define NTFS_V1_2(major, minor) ((major) == 1 && (minor) == 2) +#define NTFS_V2_X(major, minor) ((major) == 2) +#define NTFS_V3_0(major, minor) ((major) == 3 && (minor) == 0) +#define NTFS_V3_1(major, minor) ((major) == 3 && (minor) == 1) + +#define NTFS_BUF_SIZE 8192 + +/* + * ntfs_volume - structure describing an open volume in memory + */ +struct _ntfs_volume { + int fd; /* File descriptor associated with volume. */ + char *dev_name; /* Name of the device/file the volume is in. */ + char *vol_name; /* Name of the volume. */ + unsigned long state; /* NTFS specific flags describing this volume. + See ntfs_volume_state_bits above. */ + u8 major_ver; /* Ntfs major version of volume. */ + u8 minor_ver; /* Ntfs minor version of volume. */ + u16 flags; /* Bit array of VOLUME_* flags. */ + + u16 sector_size; /* Byte size of a sector. */ + u8 sector_size_bits; /* Log(2) of the byte size of a sector. */ + u32 cluster_size; /* Byte size of a cluster. */ + u32 mft_record_size; /* Byte size of a mft record. */ + u8 cluster_size_bits; /* Log(2) of the byte size of a cluster. */ + u8 mft_record_size_bits;/* Log(2) of the byte size of a mft record. */ + + s64 nr_clusters; /* Volume size in clusters, hence also the + number of bits in lcn_bitmap. */ + ntfs_inode *lcnbmp_ni; /* ntfs_inode structure for FILE_Bitmap. */ + ntfs_attr *lcnbmp_na; /* ntfs_attr structure for the data attribute + of FILE_Bitmap. Each bit represents a + cluster on the volume, bit 0 representing + lcn 0 and so on. A set bit means that the + cluster and vice versa. */ + + s64 nr_mft_records; /* Number of records in the mft, equals the + number of bits in mft_bitmap. */ + s64 mft_lcn; /* Logical cluster number of the data attribute + for FILE_MFT. */ + ntfs_inode *mft_ni; /* ntfs_inode structure for FILE_MFT. */ + ntfs_attr *mft_na; /* ntfs_attr structure for the data attribute + of FILE_MFT. */ + ntfs_attr *mftbmp_na; /* ntfs_attr structure for the bitmap attribute + of FILE_MFT. Each bit represents an mft + record in the $DATA attribute, bit 0 + representing mft record 0 and so on. A set + bit means that the mft record is in use and + vice versa. */ + + int mftmirr_size; /* Size of the FILE_MFTMirr in mft records. */ + s64 mftmirr_lcn; /* Logical cluster number of the data attribute + for FILE_MFTMirr. */ + ntfs_inode *mftmirr_ni; /* ntfs_inode structure for FILE_MFTMirr. */ + ntfs_attr *mftmirr_na; /* ntfs_attr structure for the data attribute + of FILE_MFTMirr. */ + + uchar_t *upcase; /* Upper case equivalents of all 65536 2-byte + Unicode characters. Obtained from + FILE_UpCase. */ + u32 upcase_len; /* Length in Unicode characters of the upcase + table. */ +}; + +extern ntfs_volume *ntfs_startup_volume(const char *name, unsigned long rwflag); +extern ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag); + +extern int ntfs_umount(ntfs_volume *vol, const BOOL force); + +extern int ntfs_is_version_supported(ntfs_volume *vol); +extern int ntfs_reset_logfile(ntfs_volume *vol); +extern int ntfs_set_volume_flags(ntfs_volume *v, const u16 flags); + +#endif /* defined _NTFS_VOLUME_H */ + + From c84faef72809160628da06bc3f436daf9b2ef7c4 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 22 Aug 2002 18:09:47 +0000 Subject: [PATCH 0099/2994] Import changeset BKrev: 3d6528eb_pWCFUFghG5TvvR1VYtCfQ From ce412deb275aaabcffed7ce0f207cd5c4c44b96e Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 22 Aug 2002 18:44:56 +0000 Subject: [PATCH 0100/2994] linux-ntfs.spec.in: updated rpm group BKrev: 3d653128Dm91CbrBeji9nmja7mEcuQ From f2508179fcc2a619e8a20b7277aad77163274844 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 22 Aug 2002 18:44:56 +0000 Subject: [PATCH 0101/2994] updated rpm group (Logical change 1.6) --- linux-ntfs.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-ntfs.spec.in b/linux-ntfs.spec.in index 4a28250c..b3ef7994 100644 --- a/linux-ntfs.spec.in +++ b/linux-ntfs.spec.in @@ -15,7 +15,7 @@ Source : http://prdownloads.sf.net/linux-ntfs/linux-ntfs-%{ver}.tar.gz Buildroot : %{_tmppath}/%{name}-root Packager : Anton Altaparmakov License : GPL -Group : Applications/System +Group : System Environment/Base %description The Linux-NTFS project (http://linux-ntfs.sf.net/) aims to bring full support for the NTFS filesystem to the Linux operating system. Linux-NTFS currently From 46d1b0d9405421bcb040249296444c1d34ed7c41 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 22 Aug 2002 22:58:59 +0000 Subject: [PATCH 0102/2994] Teach BK to ignore configure output, general build products and specific programs (Logical change 1.7) --- BitKeeper/etc/ignore | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index f9513232..5a26598b 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -1,2 +1,32 @@ +# Bitkeeper BitKeeper/*/* PENDING/* + +# configure +Makefile +*/Makefile +ntfstools/*.8 +config.log +config.h +config.cache +config.status +stamp-h +libtool +linux-ntfs.spec + +# general build products +*/.deps/* +*/.libs/* +*/*.o +libntfs/*.l? + +# specific programs +ntfstools/dumplog +ntfstools/mkntfs +ntfstools/ntfsdump_logfile +ntfstools/ntfsfix +ntfstools/ntfsinfo +ntfstools/ntfslabel +ntfstools/ntfsresize +ntfstools/ntfsundelete +ntfstools/ntfswipe From f698d25e8c12f57704ae7ebd9ce3551a3ff7750a Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 22 Aug 2002 22:58:59 +0000 Subject: [PATCH 0103/2994] ignore: Teach BK to ignore configure output, general build products and specific programs BKrev: 3d656cb3sIgrTr3fmfMsKzc3XRx0uw From 89dcef0bf9bcb82cb9dfc90e5e42230c41008cda Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 14 Oct 2002 09:57:49 +0000 Subject: [PATCH 0104/2994] Fix compilation with gcc-3.2. (Logical change 1.8) --- include/attrib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/attrib.h b/include/attrib.h index 97d7d1a7..130810fe 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -210,8 +210,8 @@ struct _ntfs_attr { * structure. */ typedef union { - u8; /* Unnamed u8 to serve as default when just using - a_val without specifying any of the below. */ + u8 _default; /* Unnamed u8 to serve as default when just using + a_val without specifying any of the below. */ STANDARD_INFORMATION std_inf; ATTR_LIST_ENTRY al_entry; FILE_NAME_ATTR filename; From 714144e59140400f24120b1f0e8979baf9c2bb50 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 14 Oct 2002 09:57:49 +0000 Subject: [PATCH 0105/2994] Fix compilation with gcc-3.2. BKrev: 3daa951deXVPl6hQLeGynOL_A58xqg From f4bd1eae9e34ba1c7c69c8e5568f94134ff9d1d0 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 22 Oct 2002 20:31:14 +0000 Subject: [PATCH 0106/2994] minor build fix for gcc 3.2 (Logical change 1.9) --- ntfstools/ntfsundelete.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfstools/ntfsundelete.c b/ntfstools/ntfsundelete.c index c37457ca..f738f3bf 100644 --- a/ntfstools/ntfsundelete.c +++ b/ntfstools/ntfsundelete.c @@ -2004,7 +2004,7 @@ int main (int argc, char *argv[]) opts.mft_begin, min (vol->nr_mft_records, opts.mft_end)); break; default: - /* Cannot happen */ + ; /* Cannot happen */ } umount: From a918e028e79d295e59b3a882bfa406f8dc360caa Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 22 Oct 2002 20:31:14 +0000 Subject: [PATCH 0107/2994] minor build fix for gcc 3.2 BKrev: 3db5b592n3GVhX-gYQO51KSNW9QfGA From ef2a978b93ba433025f161f5f26bd15f0853596e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:09:33 +0000 Subject: [PATCH 0108/2994] Hi, (Logical change 1.10) --- ntfstools/ntfsresize.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/ntfstools/ntfsresize.c b/ntfstools/ntfsresize.c index be59de90..fb20f697 100644 --- a/ntfstools/ntfsresize.c +++ b/ntfstools/ntfsresize.c @@ -44,6 +44,11 @@ #include "inode.h" #include "runlist.h" +const char *EXEC_NAME = "ntfsresize"; + +#define NTFS_REPORT_BANNER "\nReport bugs to linux-ntfs-dev@lists.sf.net. " \ + "Homepage: http://linux-ntfs.sf.net\n" + struct { int verbose; int debug; @@ -108,9 +113,12 @@ int perr_exit(const char *fmt, ...) } -void usage(char *s) +void usage() { - printf ("Usage: %s [-fhin] [-c clusters] [-s byte[K|M|G]] device\n", s); + printf("\n"); + printf ("Usage: %s [-fhin] [-c clusters] [-s byte[K|M|G]] device\n", EXEC_NAME); + printf("Shrink a defragmented NTFS volume.\n"); + printf("\n"); printf (" -c clusters Shrink volume to size given in NTFS clusters\n"); Dprintf(" -d Show debug information\n"); printf (" -f Force to progress (DANGEROUS)\n"); @@ -119,11 +127,12 @@ void usage(char *s) printf (" -n No write operations (mount volume read-only)\n"); printf (" -s byte[K|M|G] Shrink volume to size given in byte[K|M|G]\n"); /* printf (" -v Verbose operation\n"); */ + printf("%s", NTFS_REPORT_BANNER); exit(1); } -s64 get_new_volume_size(char *s, char **argv) +s64 get_new_volume_size(char *s) { s64 size; char *suffix; @@ -134,10 +143,10 @@ s64 get_new_volume_size(char *s, char **argv) if (!*suffix) return size; - + if (strlen(suffix) > 1) - usage(argv[0]); - + usage(); + /* FIXME: check for overflow */ switch (*suffix) { case 'G': @@ -151,7 +160,7 @@ s64 get_new_volume_size(char *s, char **argv) size *= 1024; break; default: - usage(argv[0]); + usage(); } return size; @@ -163,6 +172,8 @@ void parse_options(int argc, char **argv) char *s; int i; + printf("%s v%s\n", EXEC_NAME, VERSION); + memset(&opt, 0, sizeof(opt)); while ((i = getopt(argc, argv, "c:dfhins:")) != EOF) @@ -179,7 +190,7 @@ void parse_options(int argc, char **argv) opt.force++; break; case 'h': - usage(argv[0]); + usage(); case 'i': opt.info = 1; break; @@ -187,19 +198,19 @@ void parse_options(int argc, char **argv) opt.ro_flag = MS_RDONLY; break; case 's': - opt.bytes = get_new_volume_size(optarg, argv); + opt.bytes = get_new_volume_size(optarg); break; case 'v': opt.verbose++; break; default: - usage(argv[0]); + usage(); } if (optind == argc) - usage(argv[0]); + usage(); opt.volume = argv[optind++]; if (optind < argc) - usage(argv[0]); + usage(); stderr = stdout; if (!opt.debug) @@ -210,7 +221,7 @@ void parse_options(int argc, char **argv) if (opt.size && opt.bytes) { printf(NERR_PREFIX "It makes no sense to use " "-c and -s together.\n"); - usage(argv[0]); + usage(); } /* If no '-c clusters' then estimate smallest shrinked volume size */ @@ -221,7 +232,7 @@ void parse_options(int argc, char **argv) if (opt.size || opt.bytes) { printf(NERR_PREFIX "It makes no sense to use -i and " "-%c together.\n", opt.size ? 'c' : 's'); - usage(argv[0]); + usage(); } opt.ro_flag = MS_RDONLY; } From adc40695769e9d201e26c535c9d9be15161ebeb3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:09:33 +0000 Subject: [PATCH 0109/2994] ntfsresize.c: Hi, This patch adds version info, description and "Report bugs ... Homepage ..." info to Usage screen. Szaka BKrev: 3dd7bf3dJM3_Fmw46nwDMxoY8NnpgQ From 54e91a485a7ed04282e05544844ea36f8b732094 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:12:16 +0000 Subject: [PATCH 0110/2994] Hi, This patch adds the warning Anton requested, -=------------------------=-------------------------------> WARNING: Every sanity checks passed and only the DANGEROUS operations left. Please make sure all your important data had been backed up in case of an unexpected failure! Are you sure you want to proceed (y/[n])? OK quitting. NO CHANGES has been made to your NTFS volume. <----------------------------------------------------------The question will be skipped if the -f (force) used [e.g. for automatic testing]. This patch needs the earlier sent ntfsresize-usage-cleanup.diff patch. Szaka (Logical change 1.11) --- ntfstools/ntfsresize.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/ntfstools/ntfsresize.c b/ntfstools/ntfsresize.c index fb20f697..23e74c0b 100644 --- a/ntfstools/ntfsresize.c +++ b/ntfstools/ntfsresize.c @@ -49,6 +49,11 @@ const char *EXEC_NAME = "ntfsresize"; #define NTFS_REPORT_BANNER "\nReport bugs to linux-ntfs-dev@lists.sf.net. " \ "Homepage: http://linux-ntfs.sf.net\n" +#define NTFS_RESIZE_WARNING \ +"WARNING: Every sanity checks passed and only the DANGEROUS \n" \ +"operations left. Please make sure all your important data \n" \ +"had been backed up in case of an unexpected failure!\n" + struct { int verbose; int debug; @@ -132,6 +137,24 @@ void usage() } +/* Copy-paste from e2fsprogs */ +void proceed_question(void) +{ + char buf[256]; + const char *short_yes = "yY"; + + fflush(stdout); + fflush(stderr); + printf("Are you sure you want to proceed (y/[n])? "); + buf[0] = 0; + fgets(buf, sizeof(buf), stdin); + if (strchr(short_yes, buf[0]) == 0) { + printf("OK quitting. NO CHANGES has been made to your NTFS volume.\n"); + exit(1); + } +} + + s64 get_new_volume_size(char *s) { s64 size; @@ -716,7 +739,7 @@ void mount_volume() perr_exit("ntfs_mount failed"); if (vol->flags & VOLUME_IS_DIRTY) - if (!opt.force--) + if (opt.force-- <= 0) err_exit("Volume is dirty. Run chkdsk and " "please try again (or see -f option).\n"); @@ -800,7 +823,10 @@ int main(int argc, char **argv) advise_on_resize(); } - /* FIXME: first do all checks before any write attempt */ + if (opt.force-- <= 0) { + printf(NTFS_RESIZE_WARNING); + proceed_question(); + } prepare_volume_fixup(); From 2bf15702e6292a6d1b4f05b72350e0f894c4d0d7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:12:16 +0000 Subject: [PATCH 0111/2994] ntfsresize.c: Hi, This patch adds the warning Anton requested, ----------------------------------------------------------> WARNING: Every sanity checks passed and only the DANGEROUS operations left. Please make sure all your important data had been backed up in case of an unexpected failure! Are you sure you want to proceed (y/[n])? OK quitting. NO CHANGES has been made to your NTFS volume. <---------------------------------------------------------- The question will be skipped if the -f (force) used [e.g. for automatic testing]. This patch needs the earlier sent ntfsresize-usage-cleanup.diff patch. Szaka BKrev: 3dd7bfe0ZRpIzFdMtWEQJhzZVnbwxQ From f0711d1211dc1f9ff825dc428277fa5211869db5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:18:45 +0000 Subject: [PATCH 0112/2994] Hi, The below patch makes ntfsresize build also at default. Szaka (Logical change 1.12) --- ntfstools/Makefile.am | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ntfstools/Makefile.am b/ntfstools/Makefile.am index 122967a7..c6eed998 100644 --- a/ntfstools/Makefile.am +++ b/ntfstools/Makefile.am @@ -16,8 +16,8 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ endif bin_PROGRAMS = ntfsfix ntfsinfo -sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete -EXTRA_PROGRAMS = ntfsresize ntfsdump_logfile dumplog ntfswipe +sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 EXTRA_MANS = @@ -49,16 +49,16 @@ ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h ntfsundelete_LDADD = $(AM_LIBS) ntfsundelete_LDFLAGS = $(AM_LFLAGS) +ntfsresize_SOURCES = ntfsresize.c +ntfsresize_LDADD = $(AM_LIBS) +ntfsresize_LDFLAGS = $(AM_LFLAGS) + # We don't distribute these ntfswipe_SOURCES = ntfswipe.c ntfswipe.h ntfswipe_LDADD = $(AM_LIBS) ntfswipe_LDFLAGS = $(AM_LFLAGS) -ntfsresize_SOURCES = ntfsresize.c -ntfsresize_LDADD = $(AM_LIBS) -ntfsresize_LDFLAGS = $(AM_LFLAGS) - ntfsdump_logfile_SOURCES= ntfsdump_logfile.c ntfsdump_logfile_LDADD = $(AM_LIBS) ntfsdump_logfile_LDFLAGS= $(AM_LFLAGS) From efca76f37861ec2ff56b099e701dfe17ecb28bd6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:18:45 +0000 Subject: [PATCH 0113/2994] Makefile.am: Hi, The below patch makes ntfsresize build also at default. Szaka BKrev: 3dd7c165w-DfUx8Zyr1hcPcrEOc2lQ From b3c45be3128a1ff957c33f4ad9f7afda0db096e4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:27:15 +0000 Subject: [PATCH 0114/2994] (Logical change 1.13) --- ntfstools/ntfsresize.8.in | 103 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 ntfstools/ntfsresize.8.in diff --git a/ntfstools/ntfsresize.8.in b/ntfstools/ntfsresize.8.in new file mode 100644 index 00000000..127ef845 --- /dev/null +++ b/ntfstools/ntfsresize.8.in @@ -0,0 +1,103 @@ +.\" -*- nroff -*- +.\" Copyright 2002 by Szabolcs Szakacsits All Rights Reserved. +.\" +.TH NTFSRESIZE 8 "November 2002" "Linux\-NTFS @VERSION@" +.SH NAME +ntfsresize \- resize an NTFS filesystem +.SH SYNOPSIS +.B ntfsresize +[\fB\-fhin\fR] +[\fB\-c +.I clusters\fR] +[\fB\-s \fIsize\fR[\fBK\fR|\fBM\fR|\fBG\fR]] +.I device +.SH DESCRIPTION +The +.B ntfsresize +program non-destructively resizes Windows NT4, 2000, XP or .NET +NTFS filesystems. At present it can be used to shrink a +defragmented NTFS filesystem located on an unmounted +.I device +(usually a disk partition). The new volume will have +.I size +bytes. +The +.I size +parameter may have one of the optional modifiers +\fBK\fR, \fBM\fR, \fBG\fR, which means the +.I size +parameter is given in kilo-, mega- or gigabytes respectively. +.PP +The +.B ntfsresize +program does not manipulate the size of partitions. +If you wish to shrink an NTFS partition, first use +.B ntfsresize +to shrink the size of the filesystem. Then you may use +.BR fdisk (8) +to shrink the size of the partition by deleting the +partition and recreating it with the smaller size. When +recreating the partition, make sure you create it with the same starting +disk cylinder as before and you do not make it smaller than the new size +of the NTFS filesystem! Otherwise you may lose your entire filesystem. +.SH OPTIONS +.TP +.B -f +Forces ntfsresize to proceed with the filesystem resize operation, overriding +some safety checks which +.B ntfsresize +normally enforces. You can use this +parameter multiply times if you want to overcome every single safety checks. +.TP +.B -h +Display help and exit. +.TP +.B -i +Using this option you can calculate the smallest shrinked volume size supported. +This option will not make any changes to the filesystem. +.TP +.B -n +You can use this option to make a test run before doing the real resize operation. +Volume will be opened read-only and +.B ntfsresize +displays what it would do if it were to resize the filesystem. +.TP +.B -c \fIclusters +Shrink volume to size given in NTFS +.I clusters\fR. +.TP +.B -s \fIsize\fR[\fBK\fR|\fBM\fR|\fBG\fR] +Shrink volume to \fIsize\fR[\fBK\fR|\fBM\fR|\fBG\fR] bytes. +The optional modifiers \fBK\fR, \fBM\fR, \fBG\fR mean the +.I size +parameter is given in kilo-, mega- or gigabytes respectively. +.SH BUGS +No bugs are known or has been reported in the supported functionality. +If you find otherwise, please report it to +(no subscription needed). It's also strongly adviced you +.B MAKE SURE YOU HAVE BACKUP +of your important data in case of an unexpected failure. +.PP +Future work is planned to include support for volume enlargement +and resizing fragmented NTFS volumes. +Please note, Windows 2000 and XP have built in NTFS defragmenter. +.SH AVAILABILITY +.B ntfsresize +is part of the linux-ntfs package and is available from +http://linux-ntfs.sf.net/ as source and pre-compiled binary. +.SH AUTHOR +.B ntfsresize +has been written by +Szabolcs Szakacsits . +.SH ACKNOWLEDGEMENT +Many thanks to Anton Altaparmakov and Richard Russon (FlatCap) +for libntfs, excellent documentation, comments, testing and fixes, +moreover to Theodore Ts'o whose +.BR resize2fs (8) +man page formed the basis of this page. +.SH SEE ALSO +.BR fdisk (8), +.BR cfdisk (8), +.BR sfdisk (8), +.BR parted (8), +.BR mkntfs (8) From 34e41fded75c4a696e8c768aa09419fd73135a82 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:27:15 +0000 Subject: [PATCH 0115/2994] Hi, Below patch includes: - ntfsresize man page - ntfsresize TODO update - some spelling correction - more usage() cleanup - corrected misleading message after successful test-run - syncing device after resize - more verbose/correct hints after resize I have some more testers but no feedback yet due to lack of their time. Cheers, Szaka BKrev: 3dd7c363eC7EpqUab5qjpcbq1eWfyw From 2c3d6ec8e63fe44ee74b8f7a675b428a0a65dcf4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:27:15 +0000 Subject: [PATCH 0116/2994] Initial revision --- ntfstools/ntfsresize.8.in | 103 -------------------------------------- 1 file changed, 103 deletions(-) diff --git a/ntfstools/ntfsresize.8.in b/ntfstools/ntfsresize.8.in index 127ef845..e69de29b 100644 --- a/ntfstools/ntfsresize.8.in +++ b/ntfstools/ntfsresize.8.in @@ -1,103 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright 2002 by Szabolcs Szakacsits All Rights Reserved. -.\" -.TH NTFSRESIZE 8 "November 2002" "Linux\-NTFS @VERSION@" -.SH NAME -ntfsresize \- resize an NTFS filesystem -.SH SYNOPSIS -.B ntfsresize -[\fB\-fhin\fR] -[\fB\-c -.I clusters\fR] -[\fB\-s \fIsize\fR[\fBK\fR|\fBM\fR|\fBG\fR]] -.I device -.SH DESCRIPTION -The -.B ntfsresize -program non-destructively resizes Windows NT4, 2000, XP or .NET -NTFS filesystems. At present it can be used to shrink a -defragmented NTFS filesystem located on an unmounted -.I device -(usually a disk partition). The new volume will have -.I size -bytes. -The -.I size -parameter may have one of the optional modifiers -\fBK\fR, \fBM\fR, \fBG\fR, which means the -.I size -parameter is given in kilo-, mega- or gigabytes respectively. -.PP -The -.B ntfsresize -program does not manipulate the size of partitions. -If you wish to shrink an NTFS partition, first use -.B ntfsresize -to shrink the size of the filesystem. Then you may use -.BR fdisk (8) -to shrink the size of the partition by deleting the -partition and recreating it with the smaller size. When -recreating the partition, make sure you create it with the same starting -disk cylinder as before and you do not make it smaller than the new size -of the NTFS filesystem! Otherwise you may lose your entire filesystem. -.SH OPTIONS -.TP -.B -f -Forces ntfsresize to proceed with the filesystem resize operation, overriding -some safety checks which -.B ntfsresize -normally enforces. You can use this -parameter multiply times if you want to overcome every single safety checks. -.TP -.B -h -Display help and exit. -.TP -.B -i -Using this option you can calculate the smallest shrinked volume size supported. -This option will not make any changes to the filesystem. -.TP -.B -n -You can use this option to make a test run before doing the real resize operation. -Volume will be opened read-only and -.B ntfsresize -displays what it would do if it were to resize the filesystem. -.TP -.B -c \fIclusters -Shrink volume to size given in NTFS -.I clusters\fR. -.TP -.B -s \fIsize\fR[\fBK\fR|\fBM\fR|\fBG\fR] -Shrink volume to \fIsize\fR[\fBK\fR|\fBM\fR|\fBG\fR] bytes. -The optional modifiers \fBK\fR, \fBM\fR, \fBG\fR mean the -.I size -parameter is given in kilo-, mega- or gigabytes respectively. -.SH BUGS -No bugs are known or has been reported in the supported functionality. -If you find otherwise, please report it to -(no subscription needed). It's also strongly adviced you -.B MAKE SURE YOU HAVE BACKUP -of your important data in case of an unexpected failure. -.PP -Future work is planned to include support for volume enlargement -and resizing fragmented NTFS volumes. -Please note, Windows 2000 and XP have built in NTFS defragmenter. -.SH AVAILABILITY -.B ntfsresize -is part of the linux-ntfs package and is available from -http://linux-ntfs.sf.net/ as source and pre-compiled binary. -.SH AUTHOR -.B ntfsresize -has been written by -Szabolcs Szakacsits . -.SH ACKNOWLEDGEMENT -Many thanks to Anton Altaparmakov and Richard Russon (FlatCap) -for libntfs, excellent documentation, comments, testing and fixes, -moreover to Theodore Ts'o whose -.BR resize2fs (8) -man page formed the basis of this page. -.SH SEE ALSO -.BR fdisk (8), -.BR cfdisk (8), -.BR sfdisk (8), -.BR parted (8), -.BR mkntfs (8) From d6d4202da48840ca7b142015ab14d11a9b70ea5d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:27:15 +0000 Subject: [PATCH 0117/2994] build ntfsresize (Logical change 1.13) --- configure.in | 1 + ntfstools/Makefile.am | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 0aeca72a..49387ccb 100644 --- a/configure.in +++ b/configure.in @@ -134,6 +134,7 @@ AC_OUTPUT([ ntfstools/ntfslabel.8 ntfstools/ntfsinfo.8 ntfstools/ntfsundelete.8 + ntfstools/ntfsresize.8 linux-ntfs.spec ]) diff --git a/ntfstools/Makefile.am b/ntfstools/Makefile.am index c6eed998..6f365809 100644 --- a/ntfstools/Makefile.am +++ b/ntfstools/Makefile.am @@ -19,7 +19,8 @@ bin_PROGRAMS = ntfsfix ntfsinfo sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe -man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 +man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 \ + ntfsresize.8 EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) From 008844bfd5d6b3dea6a2b499452a6cc32dbddacc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:27:15 +0000 Subject: [PATCH 0118/2994] stuff (Logical change 1.13) --- ntfstools/ntfsresize.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/ntfstools/ntfsresize.c b/ntfstools/ntfsresize.c index 23e74c0b..7d0f274f 100644 --- a/ntfstools/ntfsresize.c +++ b/ntfstools/ntfsresize.c @@ -50,7 +50,7 @@ const char *EXEC_NAME = "ntfsresize"; "Homepage: http://linux-ntfs.sf.net\n" #define NTFS_RESIZE_WARNING \ -"WARNING: Every sanity checks passed and only the DANGEROUS \n" \ +"WARNING: Every sanity check passed and only the DANGEROUS \n" \ "operations left. Please make sure all your important data \n" \ "had been backed up in case of an unexpected failure!\n" @@ -121,16 +121,16 @@ int perr_exit(const char *fmt, ...) void usage() { printf("\n"); - printf ("Usage: %s [-fhin] [-c clusters] [-s byte[K|M|G]] device\n", EXEC_NAME); + printf ("Usage: %s [-fhin] [-c clusters] [-s size[K|M|G]] device\n", EXEC_NAME); printf("Shrink a defragmented NTFS volume.\n"); printf("\n"); printf (" -c clusters Shrink volume to size given in NTFS clusters\n"); Dprintf(" -d Show debug information\n"); printf (" -f Force to progress (DANGEROUS)\n"); printf (" -h This help text\n"); - printf (" -i Calculate the smallest shrinked volume size supported\n"); - printf (" -n No write operations (mount volume read-only)\n"); - printf (" -s byte[K|M|G] Shrink volume to size given in byte[K|M|G]\n"); + printf (" -i Calculate the smallest shrinked size supported (read-only)\n"); + printf (" -n Make a test run without write operations (read-only)\n"); + printf (" -s size[K|M|G] Shrink volume to size[K|M|G] bytes\n"); /* printf (" -v Verbose operation\n"); */ printf("%s", NTFS_REPORT_BANNER); exit(1); @@ -837,8 +837,19 @@ int main(int argc, char **argv) /* We don't create backup boot sector because we don't know where the partition will be split. The scheduled chkdsk will fix it anyway */ - printf("==> NTFS had been successfully resized on device %s.\n" - "==> Now you can go on to resize/split the partition.\n", + if (opt.ro_flag) { + printf("==> The read-only test run ended successfully.\n"); + exit(0); + } + + printf("Syncing device ...\n"); + if (fsync(vol->fd) == -1) + perr_exit("fsync"); + + printf("==> NTFS had been successfully resized on device '%s'.\n" + "==> You can go on to resize the device e.g. with 'fdisk'.\n" + "==> Make sure the device will not be smaller than the\n" + "==> already resized NTFS filesystem!\n", vol->dev_name); return 0; From 611cba7fec581425355c6cb1cfc345b97414b607 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:27:15 +0000 Subject: [PATCH 0119/2994] update (Logical change 1.13) --- TODO.ntfstools | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/TODO.ntfstools b/TODO.ntfstools index c0c7892b..cc60befa 100644 --- a/TODO.ntfstools +++ b/TODO.ntfstools @@ -48,13 +48,12 @@ High priority - support fragmented volumes - recovery support, journaling - test suite - - man page Medium priority - - easy usage by partitioning tools - - move useful things to libntfs - - meaningful error codes at exit() - - cleanup at exit() + - easy usage by partitioning tools: + - move useful things to libntfs + - extended error codes at exit() + - cleanup at exit() - quiet operation Low priority From 8ac1a443932314d0ea2496a6508e2aaf1516c545 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:31:17 +0000 Subject: [PATCH 0120/2994] Makefile.in, configure: update BKrev: 3dd7c455pIzaW327Jc5NUrRByLwD7Q From 52ec1250061e518b5edc01a76ff92175b03fbcbb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 17 Nov 2002 16:31:17 +0000 Subject: [PATCH 0121/2994] update (Logical change 1.14) --- configure | 2 ++ ntfstools/Makefile.in | 46 +++++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/configure b/configure index 5254b03b..179f0e86 100755 --- a/configure +++ b/configure @@ -6330,6 +6330,7 @@ trap 'rm -fr `echo " ntfstools/ntfslabel.8 ntfstools/ntfsinfo.8 ntfstools/ntfsundelete.8 + ntfstools/ntfsresize.8 linux-ntfs.spec config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF @@ -6462,6 +6463,7 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile ntfstools/ntfslabel.8 ntfstools/ntfsinfo.8 ntfstools/ntfsundelete.8 + ntfstools/ntfsresize.8 linux-ntfs.spec "} EOF diff --git a/ntfstools/Makefile.in b/ntfstools/Makefile.in index 2d63031c..15eefd6a 100644 --- a/ntfstools/Makefile.in +++ b/ntfstools/Makefile.in @@ -98,10 +98,12 @@ all_libraries = @all_libraries@ @REALLYSTATIC_FALSE@LINK = @REALLYSTATIC_FALSE@$(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ bin_PROGRAMS = ntfsfix ntfsinfo -sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete -EXTRA_PROGRAMS = ntfsresize ntfsdump_logfile dumplog ntfswipe +sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe + +man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 \ + ntfsresize.8 -man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) @@ -131,16 +133,16 @@ ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h ntfsundelete_LDADD = $(AM_LIBS) ntfsundelete_LDFLAGS = $(AM_LFLAGS) +ntfsresize_SOURCES = ntfsresize.c +ntfsresize_LDADD = $(AM_LIBS) +ntfsresize_LDFLAGS = $(AM_LFLAGS) + # We don't distribute these ntfswipe_SOURCES = ntfswipe.c ntfswipe.h ntfswipe_LDADD = $(AM_LIBS) ntfswipe_LDFLAGS = $(AM_LFLAGS) -ntfsresize_SOURCES = ntfsresize.c -ntfsresize_LDADD = $(AM_LIBS) -ntfsresize_LDFLAGS = $(AM_LFLAGS) - ntfsdump_logfile_SOURCES = ntfsdump_logfile.c ntfsdump_logfile_LDADD = $(AM_LIBS) ntfsdump_logfile_LDFLAGS = $(AM_LFLAGS) @@ -151,20 +153,15 @@ dumplog_LDFLAGS = $(AM_LFLAGS) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ -ntfsundelete.8 +ntfsundelete.8 ntfsresize.8 bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ -ntfsundelete$(EXEEXT) +ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) -I.. LIBS = @LIBS@ -ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) @REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la @@ -206,6 +203,11 @@ ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -214,7 +216,7 @@ MANS = $(man_MANS) NROFF = nroff DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsfix.8.in \ -ntfsinfo.8.in ntfslabel.8.in ntfsundelete.8.in +ntfsinfo.8.in ntfslabel.8.in ntfsresize.8.in ntfsundelete.8.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) @@ -225,8 +227,8 @@ DEP_FILES = .deps/attrdef.P .deps/boot.P .deps/dumplog.P .deps/mkntfs.P \ .deps/ntfsdump_logfile.P .deps/ntfsfix.P .deps/ntfsinfo.P \ .deps/ntfslabel.P .deps/ntfsresize.P .deps/ntfsundelete.P \ .deps/ntfswipe.P .deps/sd.P .deps/upcase.P -SOURCES = $(ntfsresize_SOURCES) $(ntfsdump_logfile_SOURCES) $(dumplog_SOURCES) $(ntfswipe_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(ntfsundelete_SOURCES) -OBJECTS = $(ntfsresize_OBJECTS) $(ntfsdump_logfile_OBJECTS) $(dumplog_OBJECTS) $(ntfswipe_OBJECTS) $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(ntfsundelete_OBJECTS) +SOURCES = $(ntfsdump_logfile_SOURCES) $(dumplog_SOURCES) $(ntfswipe_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(ntfsundelete_SOURCES) $(ntfsresize_SOURCES) +OBJECTS = $(ntfsdump_logfile_OBJECTS) $(dumplog_OBJECTS) $(ntfswipe_OBJECTS) $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(ntfsundelete_OBJECTS) $(ntfsresize_OBJECTS) all: all-redirect .SUFFIXES: @@ -248,6 +250,8 @@ ntfsinfo.8: $(top_builddir)/config.status ntfsinfo.8.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ntfsundelete.8: $(top_builddir)/config.status ntfsundelete.8.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +ntfsresize.8: $(top_builddir)/config.status ntfsresize.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status mostlyclean-binPROGRAMS: @@ -337,10 +341,6 @@ distclean-libtool: maintainer-clean-libtool: -ntfsresize$(EXEEXT): $(ntfsresize_OBJECTS) $(ntfsresize_DEPENDENCIES) - @rm -f ntfsresize$(EXEEXT) - $(LINK) $(ntfsresize_LDFLAGS) $(ntfsresize_OBJECTS) $(ntfsresize_LDADD) $(LIBS) - ntfsdump_logfile$(EXEEXT): $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_DEPENDENCIES) @rm -f ntfsdump_logfile$(EXEEXT) $(LINK) $(ntfsdump_logfile_LDFLAGS) $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_LDADD) $(LIBS) @@ -373,6 +373,10 @@ ntfsundelete$(EXEEXT): $(ntfsundelete_OBJECTS) $(ntfsundelete_DEPENDENCIES) @rm -f ntfsundelete$(EXEEXT) $(LINK) $(ntfsundelete_LDFLAGS) $(ntfsundelete_OBJECTS) $(ntfsundelete_LDADD) $(LIBS) +ntfsresize$(EXEEXT): $(ntfsresize_OBJECTS) $(ntfsresize_DEPENDENCIES) + @rm -f ntfsresize$(EXEEXT) + $(LINK) $(ntfsresize_LDFLAGS) $(ntfsresize_OBJECTS) $(ntfsresize_LDADD) $(LIBS) + install-man8: $(mkinstalldirs) $(DESTDIR)$(man8dir) @list='$(man8_MANS)'; \ From 99045ef992163a46d486d033e48b864c0bde8fa3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 18 Nov 2002 16:27:23 +0000 Subject: [PATCH 0122/2994] Merge ssh://linux-ntfs@bkbits.net/ntfs-progs into cantab.net:/usr/src/ntfs-progs 2002/11/18 16:16:35+00:00 cantab.net!aia21 Makefile.am: autogen.sh doesn't work with automake 1.5 -- fix by Szaka BKrev: 3dd914ebS77iNi1Z5xJQKqmZYV0AIA From 34b4126bec4b74ff3c1ec2593fb8bbde3c77d6d1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 18 Nov 2002 16:27:23 +0000 Subject: [PATCH 0123/2994] autogen.sh doesn't work with automake 1.5 -- fix by Szaka (Logical change 1.15) --- ntfstools/Makefile.am | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ntfstools/Makefile.am b/ntfstools/Makefile.am index 6f365809..81600372 100644 --- a/ntfstools/Makefile.am +++ b/ntfstools/Makefile.am @@ -8,13 +8,16 @@ endif if REALLYSTATIC AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a AM_LFLAGS = -static -LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ else AM_LIBS = $(top_srcdir)/libntfs/libntfs.la AM_LFLAGS = $(all_libraries) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ endif +# Workaround to make REALLYSTATIC work with automake 1.5. +LINK=$(STATIC_LINK) $(LIBTOOL_LINK) + bin_PROGRAMS = ntfsfix ntfsinfo sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe From 67b6ffec64ea1b9951cdca883a4796320e9d9cdf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 19 Nov 2002 14:53:54 +0000 Subject: [PATCH 0124/2994] Initial revision --- libntfs/attrib_RE.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 libntfs/attrib_RE.txt diff --git a/libntfs/attrib_RE.txt b/libntfs/attrib_RE.txt new file mode 100644 index 00000000..e69de29b From 752f7f202684a6d77ed192f2f0745dd58987f5fa Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 19 Nov 2002 14:53:54 +0000 Subject: [PATCH 0125/2994] Rename: libntfs/attrib_RE.c -> libntfs/attrib_RE.txt (Logical change 1.16) --- libntfs/attrib_RE.txt | 449 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 449 insertions(+) diff --git a/libntfs/attrib_RE.txt b/libntfs/attrib_RE.txt index e69de29b..af74290a 100644 --- a/libntfs/attrib_RE.txt +++ b/libntfs/attrib_RE.txt @@ -0,0 +1,449 @@ +/* Reverse engineered functions in more or less modified form. find_attr() + * is quite heavily modified but should be functionally equivalent to original. + * lookup and lookup_external are less modified. Both should be functionally + * equivalent to originals. */ + +/* + * attr_search_context - used in attribute search functions + * @mrec: buffer containing mft record to search + * @attr: attribute record in @mrec where to begin/continue search + * @alist_mrec: mft record containing attribute list (i.e. base mft record) + * @alist_attr: attribute list attribute record + * @alist_val: attribute list value (if alist is resident in @alist_mrec) + * @alist_val_end: end of attribute list value + 1 + * @alist_val_len: length of attribute list in bytes + * @is_first: if true lookup_attr() begins search with @attr, else after @attr + * + * Structure must be initialized to zero before the first call to one of the + * attribute search functions. If the mft record in which to search has already + * been loaded into memory, then initialize @base and @mrec to point to it, + * @attr to point to the first attribute within @mrec, and set @is_first to + * TRUE. + * + * @is_first is only honoured in lookup_attr() and only when called with @mrec + * not NULL. Then, if @is_first is TRUE, lookup_attr() begins the search with + * @attr. If @is_first is FALSE, lookup_attr() begins the search after @attr. + * This is so that, after the first call to lookup_attr(), we can call + * lookup_attr() again, without any modification of the search context, to + * automagically get the next matching attribute. + * + * In contrast, find_attr() ignores @is_first and always begins the search with + * @attr. find_attr() shouldn't really be called directly; it is just for + * internal use. FIXME: Might want to change this behaviour later, but not + * before I am finished with lookup_external_attr(). (AIA) + */ +typedef struct { + u8 *base; + MFT_RECORD *mrec; + ATTR_RECORD *attr; + + u8 *alist_val_base; + MFT_RECORD *alist_mrec; + ATTR_RECORD *alist_attr; + ATTR_LIST_ENTRY *alist_val; + ATTR_LIST_ENTRY *alist_val_end; + u32 alist_val_len; + IS_FIRST_BOOL is_first; + u8 *alist_old_base; +} attr_search_context; + +BOOL find_attr(const ntfs_volume *vol, const ATTR_TYPES type, + const wchar_t *name, const u32 name_len, + const IGNORE_CASE_BOOL ic, const u8 *val, const u32 val_len, + ntfs_attr_search_ctx *ctx) +{ + ATTR_RECORD *a; + +#ifdef DEBUG + if (!vol || !ctx || !ctx->mrec || !ctx->attr) { + printf(stderr, "find_attr() received NULL pointer!\n"); + return FALSE; + } +#endif + a = ctx->attr; + /* + * Iterate over attributes in mft record starting at @ctx->attr. + * Note: Not using while/do/for loops so the comparison code + * does not get indented out of the 80 characters wide screen... (AIA) + */ + goto search_loop; +do_next: + a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); + if (a < ctx->mrec || a > (char*)ctx->mrec + vol->mft_record_size) + goto file_corrupt; + ctx->attr = a; +search_loop: + /* We catch $END with this more general check, too... */ + if (le32_to_cpu(a->type) > le32_to_cpu(type)) + goto not_found; + if (!a->length) + goto file_corrupt; + if (a->type != type) + goto do_next; + /* If no @name is specified, check for @val. */ + if (!name) { + register int rv; + /* If no @val specified, we are done. */ + if (!val) { +found_it: + return TRUE; + } + rv = memcmp(val, (char*)a + le16_to_cpu(a->value_offset), + min(val_len, le32_to_cpu(a->value_length))); + /* If @val collates after the current attribute's value, + continue searching as a matching attribute might follow. */ + if (!rv) { + register u32 avl = le32_to_cpu(a->value_length); + if (val_len == avl) + goto found_it; + if (val_len > avl) + goto do_next; + } else if (rv > 0) + goto do_next; + goto not_found; + } + if (ntfs_are_names_equal(name, name_len, + (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), + a->name_length, ic, vol->upcase, vol->upcase_len)) + goto found_it; + { register int rc = ntfs_collate_names(vol->upcase, + vol->upcase_len, name, name_len, + (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), + a->name_length, IGNORE_CASE, 1); + /* If case insensitive collation of names collates @name + before a->name, there is no matching attribute. */ + if (rc == -1) + goto not_found; + /* If the strings are not equal, continue search. */ + if (rc) + goto do_next; + } + /* If case sensitive collation of names doesn't collate @name before + a->name, we continue the search. Otherwise we haven't found it. */ + if (ntfs_collate_names(vol->upcase, vol->upcase_len, name, name_len, + (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), + a->name_length, CASE_SENSITIVE, 1) != -1) + goto do_next; +not_found: + return FALSE; +file_corrupt: +#ifdef DEBUG + printf(stderr, "find_attr(): File is corrupt. Run chkdsk.\n"); +#endif + goto not_found; +} + +BOOL lookup_external_attr(const ntfs_volume *vol, const MFT_REFERENCE mref, + const ATTR_TYPES type, const wchar_t *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const s64 lowest_vcn, const u8 *val, + const u32 val_len, ntfs_attr_search_ctx *ctx) +{ + ATTR_LIST_ENTRY *al_pos, **al_val, *al_val_start, *al_next_pos; + ATTR_RECORD *attr_pos; + MFT_RECORD *mrec, *m; + u8 var1 = 0; + u8 var2 = 0; + u8 var3; + int rc; + wchar_t *al_name; + u32 al_name_len; + + al_val = &ctx->alist_val; + if (ctx->alist_val_end <= *al_val && !ctx->is_first) + goto file_corrupt; + al_val_start = 0; + if (ctx->base) { + if (ctx->is_first) + goto already_have_the_base_and_is_first; + al_val_start = *al_val; + al_pos = (char*)*al_val + le16_to_cpu((*al_val)->length); + } else + al_pos = *al_val; +do_next: + if (al_pos < ctx->alist_val_end) + goto al_pos_below_alist_val_end; + var1 = var2 = 1; + al_pos = *al_val; +do_next_2: + *al_val = al_pos; + if (!type || var1 || type == al_pos->type) + goto compare_names; + if (le32_to_cpu(al_pos->type) > le32_to_cpu(type)) + goto gone_too_far; + al_pos = al_next_pos; + goto do_next; +already_have_the_base_and_is_first: + ctx->is_first = FALSE; + if (*al_val < ctx->alist_val_end) + goto do_next; + if (ctx->base) { + // FIXME: CcUnpinData(ctx->base); + ctx->base = NULL; + } + if (!type) + return FALSE; + if (ntfs_read_file_record(vol, mref, &ctx->mrec, &ctx->attr) < 0) + return FALSE; + ctx->base = ctx->mrec; + find_attr(vol, type, name, name_len, ic, val, val_len, ctx); + return FALSE; +al_pos_below_alist_val_end: + if (al_pos < ctx->alist_val) + goto file_corrupt; + if (al_pos >= ctx->alist_val_end) + goto file_corrupt; + if (!al_pos->length) + goto file_corrupt; + al_next_pos = (ATTR_LIST_ENTRY*)((char*)al_pos + + le16_to_cpu(al_pos->length)); + goto do_next_2; +gone_too_far: + var1 = 1; +compare_names: + al_name_len = al_pos->name_length; + al_name = (wchar_t*)((char*)al_pos + al_pos->name_offset); + if (!name || var1) + goto compare_lowest_vcn; + if (ic == CASE_SENSITIVE) { + if (name_len == al_name_len && + !memcmp(al_name, name, al_name_len << 1)) + rc = TRUE; + else + rc = FALSE; + } else /* IGNORE_CASE */ + rc = ntfs_are_names_equal(al_name, al_name_len, name, name_len, + ic, vol->upcase, vol->upcase_len); + if (rc) + goto compare_lowest_vcn; + rc = ntfs_collate_names(vol->upcase, vol->upcase_len, name, name_len, + al_name, al_name_len, IGNORE_CASE, 1); + if (rc == -1) + goto name_collates_before_al_name; + if (!rc && ntfs_collate_names(vol->upcase, vol->upcase_len, name, + name_len, al_name, al_name_len, + IGNORE_CASE, 0) == -1) + goto name_collates_before_al_name; + al_pos = al_next_pos; + goto do_next; +name_collates_before_al_name: + var1 = 1; +compare_lowest_vcn: + if (lowest_vcn && !var1 && al_next_pos < ctx->alist_val_end && + sle64_to_cpu(al_next_pos->lowest_vcn) <= sle64_to_cpu(lowest_vcn) && + al_next_pos->type == al_pos->type && + al_next_pos->name_length == al_name_len && + !memcmp((char*)al_next_pos + al_next_pos->name_offset, al_name, + al_name_len << 1)) { + al_pos = al_next_pos; + goto do_next; + } + /* Don't mask the sequence number. If it isn't equal, the ref is stale. + */ + if (al_val_start && + al_pos->mft_reference == al_val_start->mft_reference) { + mrec = ctx->mrec; + attr_pos = (ATTR_RECORD*)((char*)mrec + + le16_to_cpu(mrec->attrs_offset)); + } else { + if (ctx->base) { + // FIXME: CcUnpinData(ctx->base); + ctx->base = 0; + } + if (ntfs_read_file_record(vol, + le64_to_cpu(al_pos->mft_reference), + &m, &attr_pos) < 0) + return FALSE; + mrec = ctx->mrec; + ctx->base = ctx->mrec = m; + } + var3 = 0; +do_next_attr_loop_start: + if (attr_pos < mrec || attr_pos > (char*)mrec + vol->mft_record_size) + goto file_corrupt; + if (attr_pos->type == AT_END) + goto do_next_al_entry; + if (!attr_pos->length) + goto file_corrupt; + if (al_pos->instance != attr_pos->instance) + goto do_next_attr; + if (al_pos->type != attr_pos->type) + goto do_next_al_entry; + if (!name) + goto skip_name_comparison; + if (attr_pos->name_length != al_name_len) + goto do_next_al_entry; + if (memcmp((wchar_t*)((char*)attr_pos + + le16_to_cpu(attr_pos->name_offset)), al_name, + attr_pos->name_length << 1)) + goto do_next_al_entry; +skip_name_comparison: + var3 = 1; + ctx->attr = attr_pos; + if (var1) + goto loc_5217c; + if (!val) + return TRUE; + if (attr_pos->non_resident) + goto do_next_attr; + if (le32_to_cpu(attr_pos->value_length) != val_len) + goto do_next_attr; + if (!memcmp((char*)attr_pos + le16_to_cpu(attr_pos->value_offset), + val, val_len)) + return TRUE; +do_next_attr: + attr_pos = (ATTR_RECORD*)((char*)attr_pos + + le32_to_cpu(attr_pos->length)); + goto do_next_attr_loop_start; +do_next_al_entry: + if (!var3) + goto file_corrupt; + al_pos = (ATTR_RECORD*)((char*)al_pos + le16_to_cpu(al_pos->length)); + goto do_next; +loc_5217c: + if (var2) + *al_val = (ATTR_RECORD*)((char*)al_pos + + le16_to_cpu(al_pos->length)); + if (ctx->base) { + // FIXME: CcUnpinData(ctx->base); + ctx->base = 0; + } + if (!type) + return FALSE; + if (ntfs_read_file_record(vol, mref, &mrec, &ctx->attr) < 0) + return FALSE; + ctx->base = mrec; + find_attr(vol, type, name, name_len, ic, val, val_len, ctx); + return FALSE; +file_corrupt: +#ifdef DEBUG + fprintf(stderr, "lookup_attr() encountered corrupt file record.\n"); +#endif + return FALSE; +} + +BOOL lookup_attr(const ntfs_volume *vol, const MFT_REFERENCE *mref, + const ATTR_TYPES type, const wchar_t *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const s64 lowest_vcn, const u8 *val, const u32 val_len, + ntfs_attr_search_ctx *ctx) +{ + MFT_RECORD *m; + ATTR_RECORD *a; + s64 len; + + if (!vol || !ctx) { +#ifdef DEBUG + printf(stderr, "lookup_attr() received NULL pointer!\n"); +#endif + return FALSE; + } + if (ctx->base) + goto already_have_the_base; + if (ntfs_read_file_record(vol, mref, &m, &a) < 0) + return FALSE; + ctx->base = ctx->mrec = m; + ctx->attr = a; + ctx->alist_mrec = ctx->alist_attr = ctx->alist_val = NULL; + /* + * Look for an attribute list and at the same time check for attributes + * which collate before the attribute list (i.e. $STANDARD_INFORMATION). + */ + if (le32_to_cpu(a->type) > le32_to_cpu(AT_ATTRIBUTE_LIST)) + goto no_attr_list; +do_next: + if (!a->length) + goto file_corrupt; + if (a->type == AT_ATTRIBUTE_LIST) + goto attr_list_present; + a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); + if (a < m || a > (char*)m + vol->mft_record_size) + goto file_corrupt; + if (le32_to_cpu(a->type) <= le32_to_cpu(AT_ATTRIBUTE_LIST)) + goto do_next; +no_attr_list: + if (!type || type == AT_STANDARD_INFORMATION && + a->type == AT_STANDARD_INFORMATION) + goto found_it; +call_find_attr: + return find_attr(vol, type, name, name_len, ic, val, val_len, ctx); +found_it: + ctx->attr = a; + return TRUE; +already_have_the_base: + /* + * If ctx->is_first, search starting with ctx->attr. Otherwise + * continue search after ctx->attr. + */ + if (ctx->is_first) { + a = ctx->attr; + ctx->is_first = 0; + } else + a = (ATTR_RECORD*)((char*)ctx->attr + + le32_to_cpu(ctx->attr->length)); + if (a < m || a > (char*)m + vol->mft_record_size) + goto file_corrupt; + if (a->type == AT_END) + return FALSE; + if (!a->length) + goto file_corrupt; + if (type) + goto call_find_attr; + goto found_it; +attr_list_present: + /* + * Looking for zero means we return the first attribute, which will + * be the first one listed in the attribute list. + */ + ctx->attr = a; + if (!type) + goto search_attr_list; + if (type == AT_ATTRIBUTE_LIST) + return TRUE; +search_attr_list: + /* + * "a" contains the attribute list attribute at this stage. + */ + ctx->alist_attr = a; + len = get_attribute_value_length(a); +#ifdef DEBUG + if (len > 0x40000LL) { + printf(stderr, "lookup_attr() found corrupt attribute list.\n"); + return FALSE; + } +#endif + ctx->alist_val_len = len; + if (!(ctx->alist_val = malloc(ctx->alist_val_len))) { +#ifdef DEBUG + printf(stderr, "lookup_attr() failed to allocate memory for " + "attribute list value.\n"); +#endif + return FALSE; + } + if (get_attribute_value(vol, ctx->mrec, a, ctx->alist_val) != + ctx->alist_val_len) { +#ifdef DEBUG + printf(stderr, "lookup_attr() failed to read attribute list " + "value.\n"); +#endif + return FALSE; + } + ctx->alist_val_end = (char*)ctx->alist_val + ctx->alist_val_len; + if (a->non_resident) { + ctx->alist_old_base = ctx->alist_val_base; + ctx->alist_val_base = ctx->base; + ctx->base = NULL; + } else if (ctx->base) { + // FIXME: CcUnpinData(ctx->base); + ctx->base = NULL; + } +lookup_external: + return lookup_external_attr(vol, mref, type, name, name_len, ic, + lowest_vcn, val, val_len, ctx); +file_corrupt: +#ifdef DEBUG + fprintf(stderr, "lookup_attr() encountered corrupt file record.\n"); +#endif + return FALSE; +} + From 117764a1fb8fe1ecb9f7a6a068e07fb8f565554f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 19 Nov 2002 14:53:54 +0000 Subject: [PATCH 0126/2994] Rename: libntfs/attrib_RE.c -> libntfs/attrib_RE.txt }(Logical change 1.16) --- libntfs/attrib_RE.c | 449 -------------------------------------------- 1 file changed, 449 deletions(-) delete mode 100644 libntfs/attrib_RE.c diff --git a/libntfs/attrib_RE.c b/libntfs/attrib_RE.c deleted file mode 100644 index af74290a..00000000 --- a/libntfs/attrib_RE.c +++ /dev/null @@ -1,449 +0,0 @@ -/* Reverse engineered functions in more or less modified form. find_attr() - * is quite heavily modified but should be functionally equivalent to original. - * lookup and lookup_external are less modified. Both should be functionally - * equivalent to originals. */ - -/* - * attr_search_context - used in attribute search functions - * @mrec: buffer containing mft record to search - * @attr: attribute record in @mrec where to begin/continue search - * @alist_mrec: mft record containing attribute list (i.e. base mft record) - * @alist_attr: attribute list attribute record - * @alist_val: attribute list value (if alist is resident in @alist_mrec) - * @alist_val_end: end of attribute list value + 1 - * @alist_val_len: length of attribute list in bytes - * @is_first: if true lookup_attr() begins search with @attr, else after @attr - * - * Structure must be initialized to zero before the first call to one of the - * attribute search functions. If the mft record in which to search has already - * been loaded into memory, then initialize @base and @mrec to point to it, - * @attr to point to the first attribute within @mrec, and set @is_first to - * TRUE. - * - * @is_first is only honoured in lookup_attr() and only when called with @mrec - * not NULL. Then, if @is_first is TRUE, lookup_attr() begins the search with - * @attr. If @is_first is FALSE, lookup_attr() begins the search after @attr. - * This is so that, after the first call to lookup_attr(), we can call - * lookup_attr() again, without any modification of the search context, to - * automagically get the next matching attribute. - * - * In contrast, find_attr() ignores @is_first and always begins the search with - * @attr. find_attr() shouldn't really be called directly; it is just for - * internal use. FIXME: Might want to change this behaviour later, but not - * before I am finished with lookup_external_attr(). (AIA) - */ -typedef struct { - u8 *base; - MFT_RECORD *mrec; - ATTR_RECORD *attr; - - u8 *alist_val_base; - MFT_RECORD *alist_mrec; - ATTR_RECORD *alist_attr; - ATTR_LIST_ENTRY *alist_val; - ATTR_LIST_ENTRY *alist_val_end; - u32 alist_val_len; - IS_FIRST_BOOL is_first; - u8 *alist_old_base; -} attr_search_context; - -BOOL find_attr(const ntfs_volume *vol, const ATTR_TYPES type, - const wchar_t *name, const u32 name_len, - const IGNORE_CASE_BOOL ic, const u8 *val, const u32 val_len, - ntfs_attr_search_ctx *ctx) -{ - ATTR_RECORD *a; - -#ifdef DEBUG - if (!vol || !ctx || !ctx->mrec || !ctx->attr) { - printf(stderr, "find_attr() received NULL pointer!\n"); - return FALSE; - } -#endif - a = ctx->attr; - /* - * Iterate over attributes in mft record starting at @ctx->attr. - * Note: Not using while/do/for loops so the comparison code - * does not get indented out of the 80 characters wide screen... (AIA) - */ - goto search_loop; -do_next: - a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); - if (a < ctx->mrec || a > (char*)ctx->mrec + vol->mft_record_size) - goto file_corrupt; - ctx->attr = a; -search_loop: - /* We catch $END with this more general check, too... */ - if (le32_to_cpu(a->type) > le32_to_cpu(type)) - goto not_found; - if (!a->length) - goto file_corrupt; - if (a->type != type) - goto do_next; - /* If no @name is specified, check for @val. */ - if (!name) { - register int rv; - /* If no @val specified, we are done. */ - if (!val) { -found_it: - return TRUE; - } - rv = memcmp(val, (char*)a + le16_to_cpu(a->value_offset), - min(val_len, le32_to_cpu(a->value_length))); - /* If @val collates after the current attribute's value, - continue searching as a matching attribute might follow. */ - if (!rv) { - register u32 avl = le32_to_cpu(a->value_length); - if (val_len == avl) - goto found_it; - if (val_len > avl) - goto do_next; - } else if (rv > 0) - goto do_next; - goto not_found; - } - if (ntfs_are_names_equal(name, name_len, - (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), - a->name_length, ic, vol->upcase, vol->upcase_len)) - goto found_it; - { register int rc = ntfs_collate_names(vol->upcase, - vol->upcase_len, name, name_len, - (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), - a->name_length, IGNORE_CASE, 1); - /* If case insensitive collation of names collates @name - before a->name, there is no matching attribute. */ - if (rc == -1) - goto not_found; - /* If the strings are not equal, continue search. */ - if (rc) - goto do_next; - } - /* If case sensitive collation of names doesn't collate @name before - a->name, we continue the search. Otherwise we haven't found it. */ - if (ntfs_collate_names(vol->upcase, vol->upcase_len, name, name_len, - (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), - a->name_length, CASE_SENSITIVE, 1) != -1) - goto do_next; -not_found: - return FALSE; -file_corrupt: -#ifdef DEBUG - printf(stderr, "find_attr(): File is corrupt. Run chkdsk.\n"); -#endif - goto not_found; -} - -BOOL lookup_external_attr(const ntfs_volume *vol, const MFT_REFERENCE mref, - const ATTR_TYPES type, const wchar_t *name, - const u32 name_len, const IGNORE_CASE_BOOL ic, - const s64 lowest_vcn, const u8 *val, - const u32 val_len, ntfs_attr_search_ctx *ctx) -{ - ATTR_LIST_ENTRY *al_pos, **al_val, *al_val_start, *al_next_pos; - ATTR_RECORD *attr_pos; - MFT_RECORD *mrec, *m; - u8 var1 = 0; - u8 var2 = 0; - u8 var3; - int rc; - wchar_t *al_name; - u32 al_name_len; - - al_val = &ctx->alist_val; - if (ctx->alist_val_end <= *al_val && !ctx->is_first) - goto file_corrupt; - al_val_start = 0; - if (ctx->base) { - if (ctx->is_first) - goto already_have_the_base_and_is_first; - al_val_start = *al_val; - al_pos = (char*)*al_val + le16_to_cpu((*al_val)->length); - } else - al_pos = *al_val; -do_next: - if (al_pos < ctx->alist_val_end) - goto al_pos_below_alist_val_end; - var1 = var2 = 1; - al_pos = *al_val; -do_next_2: - *al_val = al_pos; - if (!type || var1 || type == al_pos->type) - goto compare_names; - if (le32_to_cpu(al_pos->type) > le32_to_cpu(type)) - goto gone_too_far; - al_pos = al_next_pos; - goto do_next; -already_have_the_base_and_is_first: - ctx->is_first = FALSE; - if (*al_val < ctx->alist_val_end) - goto do_next; - if (ctx->base) { - // FIXME: CcUnpinData(ctx->base); - ctx->base = NULL; - } - if (!type) - return FALSE; - if (ntfs_read_file_record(vol, mref, &ctx->mrec, &ctx->attr) < 0) - return FALSE; - ctx->base = ctx->mrec; - find_attr(vol, type, name, name_len, ic, val, val_len, ctx); - return FALSE; -al_pos_below_alist_val_end: - if (al_pos < ctx->alist_val) - goto file_corrupt; - if (al_pos >= ctx->alist_val_end) - goto file_corrupt; - if (!al_pos->length) - goto file_corrupt; - al_next_pos = (ATTR_LIST_ENTRY*)((char*)al_pos + - le16_to_cpu(al_pos->length)); - goto do_next_2; -gone_too_far: - var1 = 1; -compare_names: - al_name_len = al_pos->name_length; - al_name = (wchar_t*)((char*)al_pos + al_pos->name_offset); - if (!name || var1) - goto compare_lowest_vcn; - if (ic == CASE_SENSITIVE) { - if (name_len == al_name_len && - !memcmp(al_name, name, al_name_len << 1)) - rc = TRUE; - else - rc = FALSE; - } else /* IGNORE_CASE */ - rc = ntfs_are_names_equal(al_name, al_name_len, name, name_len, - ic, vol->upcase, vol->upcase_len); - if (rc) - goto compare_lowest_vcn; - rc = ntfs_collate_names(vol->upcase, vol->upcase_len, name, name_len, - al_name, al_name_len, IGNORE_CASE, 1); - if (rc == -1) - goto name_collates_before_al_name; - if (!rc && ntfs_collate_names(vol->upcase, vol->upcase_len, name, - name_len, al_name, al_name_len, - IGNORE_CASE, 0) == -1) - goto name_collates_before_al_name; - al_pos = al_next_pos; - goto do_next; -name_collates_before_al_name: - var1 = 1; -compare_lowest_vcn: - if (lowest_vcn && !var1 && al_next_pos < ctx->alist_val_end && - sle64_to_cpu(al_next_pos->lowest_vcn) <= sle64_to_cpu(lowest_vcn) && - al_next_pos->type == al_pos->type && - al_next_pos->name_length == al_name_len && - !memcmp((char*)al_next_pos + al_next_pos->name_offset, al_name, - al_name_len << 1)) { - al_pos = al_next_pos; - goto do_next; - } - /* Don't mask the sequence number. If it isn't equal, the ref is stale. - */ - if (al_val_start && - al_pos->mft_reference == al_val_start->mft_reference) { - mrec = ctx->mrec; - attr_pos = (ATTR_RECORD*)((char*)mrec + - le16_to_cpu(mrec->attrs_offset)); - } else { - if (ctx->base) { - // FIXME: CcUnpinData(ctx->base); - ctx->base = 0; - } - if (ntfs_read_file_record(vol, - le64_to_cpu(al_pos->mft_reference), - &m, &attr_pos) < 0) - return FALSE; - mrec = ctx->mrec; - ctx->base = ctx->mrec = m; - } - var3 = 0; -do_next_attr_loop_start: - if (attr_pos < mrec || attr_pos > (char*)mrec + vol->mft_record_size) - goto file_corrupt; - if (attr_pos->type == AT_END) - goto do_next_al_entry; - if (!attr_pos->length) - goto file_corrupt; - if (al_pos->instance != attr_pos->instance) - goto do_next_attr; - if (al_pos->type != attr_pos->type) - goto do_next_al_entry; - if (!name) - goto skip_name_comparison; - if (attr_pos->name_length != al_name_len) - goto do_next_al_entry; - if (memcmp((wchar_t*)((char*)attr_pos + - le16_to_cpu(attr_pos->name_offset)), al_name, - attr_pos->name_length << 1)) - goto do_next_al_entry; -skip_name_comparison: - var3 = 1; - ctx->attr = attr_pos; - if (var1) - goto loc_5217c; - if (!val) - return TRUE; - if (attr_pos->non_resident) - goto do_next_attr; - if (le32_to_cpu(attr_pos->value_length) != val_len) - goto do_next_attr; - if (!memcmp((char*)attr_pos + le16_to_cpu(attr_pos->value_offset), - val, val_len)) - return TRUE; -do_next_attr: - attr_pos = (ATTR_RECORD*)((char*)attr_pos + - le32_to_cpu(attr_pos->length)); - goto do_next_attr_loop_start; -do_next_al_entry: - if (!var3) - goto file_corrupt; - al_pos = (ATTR_RECORD*)((char*)al_pos + le16_to_cpu(al_pos->length)); - goto do_next; -loc_5217c: - if (var2) - *al_val = (ATTR_RECORD*)((char*)al_pos + - le16_to_cpu(al_pos->length)); - if (ctx->base) { - // FIXME: CcUnpinData(ctx->base); - ctx->base = 0; - } - if (!type) - return FALSE; - if (ntfs_read_file_record(vol, mref, &mrec, &ctx->attr) < 0) - return FALSE; - ctx->base = mrec; - find_attr(vol, type, name, name_len, ic, val, val_len, ctx); - return FALSE; -file_corrupt: -#ifdef DEBUG - fprintf(stderr, "lookup_attr() encountered corrupt file record.\n"); -#endif - return FALSE; -} - -BOOL lookup_attr(const ntfs_volume *vol, const MFT_REFERENCE *mref, - const ATTR_TYPES type, const wchar_t *name, - const u32 name_len, const IGNORE_CASE_BOOL ic, - const s64 lowest_vcn, const u8 *val, const u32 val_len, - ntfs_attr_search_ctx *ctx) -{ - MFT_RECORD *m; - ATTR_RECORD *a; - s64 len; - - if (!vol || !ctx) { -#ifdef DEBUG - printf(stderr, "lookup_attr() received NULL pointer!\n"); -#endif - return FALSE; - } - if (ctx->base) - goto already_have_the_base; - if (ntfs_read_file_record(vol, mref, &m, &a) < 0) - return FALSE; - ctx->base = ctx->mrec = m; - ctx->attr = a; - ctx->alist_mrec = ctx->alist_attr = ctx->alist_val = NULL; - /* - * Look for an attribute list and at the same time check for attributes - * which collate before the attribute list (i.e. $STANDARD_INFORMATION). - */ - if (le32_to_cpu(a->type) > le32_to_cpu(AT_ATTRIBUTE_LIST)) - goto no_attr_list; -do_next: - if (!a->length) - goto file_corrupt; - if (a->type == AT_ATTRIBUTE_LIST) - goto attr_list_present; - a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); - if (a < m || a > (char*)m + vol->mft_record_size) - goto file_corrupt; - if (le32_to_cpu(a->type) <= le32_to_cpu(AT_ATTRIBUTE_LIST)) - goto do_next; -no_attr_list: - if (!type || type == AT_STANDARD_INFORMATION && - a->type == AT_STANDARD_INFORMATION) - goto found_it; -call_find_attr: - return find_attr(vol, type, name, name_len, ic, val, val_len, ctx); -found_it: - ctx->attr = a; - return TRUE; -already_have_the_base: - /* - * If ctx->is_first, search starting with ctx->attr. Otherwise - * continue search after ctx->attr. - */ - if (ctx->is_first) { - a = ctx->attr; - ctx->is_first = 0; - } else - a = (ATTR_RECORD*)((char*)ctx->attr + - le32_to_cpu(ctx->attr->length)); - if (a < m || a > (char*)m + vol->mft_record_size) - goto file_corrupt; - if (a->type == AT_END) - return FALSE; - if (!a->length) - goto file_corrupt; - if (type) - goto call_find_attr; - goto found_it; -attr_list_present: - /* - * Looking for zero means we return the first attribute, which will - * be the first one listed in the attribute list. - */ - ctx->attr = a; - if (!type) - goto search_attr_list; - if (type == AT_ATTRIBUTE_LIST) - return TRUE; -search_attr_list: - /* - * "a" contains the attribute list attribute at this stage. - */ - ctx->alist_attr = a; - len = get_attribute_value_length(a); -#ifdef DEBUG - if (len > 0x40000LL) { - printf(stderr, "lookup_attr() found corrupt attribute list.\n"); - return FALSE; - } -#endif - ctx->alist_val_len = len; - if (!(ctx->alist_val = malloc(ctx->alist_val_len))) { -#ifdef DEBUG - printf(stderr, "lookup_attr() failed to allocate memory for " - "attribute list value.\n"); -#endif - return FALSE; - } - if (get_attribute_value(vol, ctx->mrec, a, ctx->alist_val) != - ctx->alist_val_len) { -#ifdef DEBUG - printf(stderr, "lookup_attr() failed to read attribute list " - "value.\n"); -#endif - return FALSE; - } - ctx->alist_val_end = (char*)ctx->alist_val + ctx->alist_val_len; - if (a->non_resident) { - ctx->alist_old_base = ctx->alist_val_base; - ctx->alist_val_base = ctx->base; - ctx->base = NULL; - } else if (ctx->base) { - // FIXME: CcUnpinData(ctx->base); - ctx->base = NULL; - } -lookup_external: - return lookup_external_attr(vol, mref, type, name, name_len, ic, - lowest_vcn, val, val_len, ctx); -file_corrupt: -#ifdef DEBUG - fprintf(stderr, "lookup_attr() encountered corrupt file record.\n"); -#endif - return FALSE; -} - From 7b28349903a12ad1b5e666eb143a10cb53ef9304 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 19 Nov 2002 14:53:54 +0000 Subject: [PATCH 0127/2994] attrib_RE.txt: Rename: libntfs/attrib_RE.c -> libntfs/attrib_RE.txt BKrev: 3dda5082r3Lfc2FwKCoSowS43rztZw From 4afc98d6d82443d829c3a1c86f80717f3b3b7dd1 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 22 Nov 2002 12:44:17 +0000 Subject: [PATCH 0128/2994] [Szaka] More warnings (Logical change 1.17) --- ntfstools/ntfsresize.c | 78 ++++++++++++++++++++++++++++++------------ 1 file changed, 56 insertions(+), 22 deletions(-) diff --git a/ntfstools/ntfsresize.c b/ntfstools/ntfsresize.c index 7d0f274f..d6c67084 100644 --- a/ntfstools/ntfsresize.c +++ b/ntfstools/ntfsresize.c @@ -50,9 +50,19 @@ const char *EXEC_NAME = "ntfsresize"; "Homepage: http://linux-ntfs.sf.net\n" #define NTFS_RESIZE_WARNING \ -"WARNING: Every sanity check passed and only the DANGEROUS \n" \ -"operations left. Please make sure all your important data \n" \ -"had been backed up in case of an unexpected failure!\n" +"WARNING: Every sanity check passed and only the DANGEROUS operations left.\n" \ +"Please make sure all your important data had been backed up in case of an\n" \ +"unexpected failure!\n" + +#define NTFS_RESIZE_IMPORTANT \ +"NTFS had been successfully resized on device '%s'.\n" \ +"You can go on to resize the device e.g. with 'fdisk'.\n" \ +"IMPORTANT: When recreating the partition, make sure you\n" \ +" 1) create it with the same starting disk cylinder\n" \ +" 2) create it with the same partition type (usually 7, HPFS/NTFS)\n" \ +" 3) do not make it smaller than the new NTFS filesystem size\n" \ +" 4) set the bootable flag for the partition if it existed before\n" \ +"Otherwise you may lose your data or can't boot your computer from the disk!\n" struct { int verbose; @@ -81,13 +91,28 @@ ntfs_volume *vol = NULL; struct bitmap lcn_bitmap; -#define ERR_PREFIX "==> ERROR" +#define ERR_PREFIX "ERROR" #define PERR_PREFIX ERR_PREFIX "(%d): " #define NERR_PREFIX ERR_PREFIX ": " #define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) +void perr_printf(const char *fmt, ...) +{ + va_list ap; + int eo = errno; + + fprintf(stdout, PERR_PREFIX, eo); + va_start(ap, fmt); + vfprintf(stdout, fmt, ap); + va_end(ap); + printf(": %s\n", strerror(eo)); + fflush(stdout); + fflush(stderr); +} + + int err_exit(const char *fmt, ...) { va_list ap; @@ -128,7 +153,7 @@ void usage() Dprintf(" -d Show debug information\n"); printf (" -f Force to progress (DANGEROUS)\n"); printf (" -h This help text\n"); - printf (" -i Calculate the smallest shrinked size supported (read-only)\n"); + printf (" -i Calculate the smallest shrunken size supported (read-only)\n"); printf (" -n Make a test run without write operations (read-only)\n"); printf (" -s size[K|M|G] Shrink volume to size[K|M|G] bytes\n"); /* printf (" -v Verbose operation\n"); */ @@ -247,7 +272,7 @@ void parse_options(int argc, char **argv) usage(); } - /* If no '-c clusters' then estimate smallest shrinked volume size */ + /* If no '-c clusters' then estimate smallest shrunken volume size */ if (!opt.size && !opt.bytes) opt.info = 1; @@ -294,8 +319,9 @@ void build_lcn_usage_bitmap(ATTR_RECORD *a) for (j = 0; j < rl[i].length; j++) { u64 k = (u64)rl[i].lcn + j; if (ntfs_get_and_set_bit(lcn_bitmap.bm, k, 1)) - err_exit("Cluster %lu " - "referenced multiply times!\n", k); + err_exit("Cluster %lu referenced twice!\n" + "You didn't shutdown your Windows" + "properly?", k); } } free(rl); @@ -357,7 +383,8 @@ void compare_bitmaps(struct bitmap *a, struct bitmap *b) for (i = 0; i < a->size; i++) if (a->bm[i] != b->bm[i]) - err_exit("Cluster bitmaps differ at %d (%d != %d)\n", + err_exit("Cluster bitmaps differ at %d (%d != %d)\n" + "You didn't shutdown your Windows properly?", i, a->bm[i], b->bm[i]); } @@ -735,8 +762,19 @@ void mount_volume() "You must umount it first.\n", opt.volume); } - if (!(vol = ntfs_mount(opt.volume, opt.ro_flag))) - perr_exit("ntfs_mount failed"); + if (!(vol = ntfs_mount(opt.volume, opt.ro_flag))) { + + int err = errno; + + perr_printf("ntfs_mount failed"); + if (errno == EINVAL) { + printf("Apparently device '%s' doesn't have a " + "valid NTFS. Maybe you selected\nthe whole " + "disk instead of a partition (e.g. /dev/hda, " + "not /dev/hda8)?\n", opt.volume); + } + exit(1); + } if (vol->flags & VOLUME_IS_DIRTY) if (opt.force-- <= 0) @@ -761,11 +799,12 @@ void prepare_volume_fixup() if (vol->major_ver >= 2) flags |= VOLUME_MOUNTED_ON_NT4; - printf("Setting NTFS $Volume flag dirty ...\n"); + printf("Schedule chkdsk NTFS consistency check at Windows boot time ...\n"); if (ntfs_set_volume_flags(vol, flags)) perr_exit("Failed to set $Volume dirty"); - printf("Resetting $LogFile ...\n"); + printf("Resetting $LogFile ... " + "(this might take a while)\n"); if (ntfs_reset_logfile(vol)) perr_exit("Failed to reset $LogFile"); } @@ -811,7 +850,7 @@ int main(int argc, char **argv) if (new_volume_size > vol->nr_clusters) err_exit("Volume enlargement not yet supported\n"); else if (new_volume_size == vol->nr_clusters) { - printf("==> Nothing to do: NTFS volume size is already OK.\n"); + printf("Nothing to do: NTFS volume size is already OK.\n"); exit(0); } @@ -823,7 +862,7 @@ int main(int argc, char **argv) advise_on_resize(); } - if (opt.force-- <= 0) { + if (opt.force-- <= 0 && !opt.ro_flag) { printf(NTFS_RESIZE_WARNING); proceed_question(); } @@ -838,7 +877,7 @@ int main(int argc, char **argv) partition will be split. The scheduled chkdsk will fix it anyway */ if (opt.ro_flag) { - printf("==> The read-only test run ended successfully.\n"); + printf("The read-only test run ended successfully.\n"); exit(0); } @@ -846,12 +885,7 @@ int main(int argc, char **argv) if (fsync(vol->fd) == -1) perr_exit("fsync"); - printf("==> NTFS had been successfully resized on device '%s'.\n" - "==> You can go on to resize the device e.g. with 'fdisk'.\n" - "==> Make sure the device will not be smaller than the\n" - "==> already resized NTFS filesystem!\n", - vol->dev_name); - + printf(NTFS_RESIZE_IMPORTANT, vol->dev_name); return 0; } From 214c3ffc49ce5d0224211a7c5c4566230463bfff Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 22 Nov 2002 12:44:17 +0000 Subject: [PATCH 0129/2994] [Szaka] More warnings BKrev: 3dde26a1jucIG8mPzp0iAtQMZVl6Gw From 51d2a5d007995cf7634cf75daaf3e98927ba846b Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 22 Nov 2002 12:44:17 +0000 Subject: [PATCH 0130/2994] [Szaka] More warnings and some corrections (Logical change 1.17) --- ntfstools/ntfsresize.8.in | 120 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/ntfstools/ntfsresize.8.in b/ntfstools/ntfsresize.8.in index e69de29b..ef2d6512 100644 --- a/ntfstools/ntfsresize.8.in +++ b/ntfstools/ntfsresize.8.in @@ -0,0 +1,120 @@ +.\" -*- nroff -*- +.\" Copyright 2002 by Szabolcs Szakacsits All Rights Reserved. +.\" +.TH NTFSRESIZE 8 "November 2002" "Linux\-NTFS @VERSION@" +.SH NAME +ntfsresize \- resize an NTFS filesystem +.SH SYNOPSIS +.B ntfsresize +[\fB\-fhin\fR] +[\fB\-c +.I clusters\fR] +[\fB\-s \fIsize\fR[\fBK\fR|\fBM\fR|\fBG\fR]] +.I device +.SH DESCRIPTION +The +.B ntfsresize +program non-destructively resizes Windows NT4, 2000, XP or .NET +NTFS filesystems. At present it can be used to shrink a +defragmented NTFS filesystem located on an unmounted +.I device +(usually a disk partition). The new volume will have +.I size +bytes. +The +.I size +parameter may have one of the optional modifiers +\fBK\fR, \fBM\fR, \fBG\fR, which means the +.I size +parameter is given in kilo-, mega- or gigabytes respectively. +.PP +The +.B ntfsresize +program does not manipulate the size of partitions. +If you wish to shrink an NTFS partition, first use +.B ntfsresize +to shrink the size of the filesystem. Then you may use +.BR fdisk (8) +to shrink the size of the partition by deleting the +partition and recreating it with the smaller size. +.PP +.B IMPORTANT! +When recreating the partition with +.BR fdisk (8) +make sure you create it with the same starting +disk cylinder and partition type +as before and you do not make it smaller than the new size +of the NTFS filesystem! Otherwise you may lose your entire filesystem. +Also make sure you set the bootable flag for the partition if it +existed before. Failing to do so you might not be able to boot your +computer from the disk! +.PP +Note, +.B ntfsresize +schedules 'chkdsk' to make an NTFS consistency check +when you will boot Windows. If your partition was a +system partition than Windows may intentionally reboot after +the successful consistency check. + +.SH OPTIONS +.TP +.B -f +Forces ntfsresize to proceed with the filesystem resize operation, overriding +some safety checks which +.B ntfsresize +normally enforces. You can use this +parameter multiply times if you want to overcome every single safety checks. +.TP +.B -h +Display help and exit. +.TP +.B -i +Using this option you can calculate the smallest shrunken volume size supported. +This option will not make any changes to the filesystem. +.TP +.B -n +You can use this option to make a test run before doing the real resize operation. +Volume will be opened read-only and +.B ntfsresize +displays what it would do if it were to resize the filesystem. +.TP +.B -c \fIclusters +Shrink volume to size given in NTFS +.I clusters\fR. +.TP +.B -s \fIsize\fR[\fBK\fR|\fBM\fR|\fBG\fR] +Shrink volume to \fIsize\fR[\fBK\fR|\fBM\fR|\fBG\fR] bytes. +The optional modifiers \fBK\fR, \fBM\fR, \fBG\fR mean the +.I size +parameter is given in kilo-, mega- or gigabytes respectively. +The corresponding lowercase letters are also accepted. +.SH BUGS +No bugs are known or has been reported so far in the current version. +If you find otherwise, please report it to +(no subscription needed). It's also strongly advised you +.B MAKE SURE YOU HAVE A BACKUP +of your important data in case of an unexpected failure. +.PP +Future work is planned to include support for volume enlargement +and resizing fragmented NTFS volumes. +Please note, Windows 2000, XP and .NET have built in NTFS defragmenter. +.SH AVAILABILITY +.B ntfsresize +is part of the linux-ntfs package and is available from +http://linux-ntfs.sf.net/ as source and pre-compiled binary. +.SH AUTHOR +.B ntfsresize +has been written by +Szabolcs Szakacsits . +.SH ACKNOWLEDGEMENT +Many thanks to Anton Altaparmakov and Richard Russon (FlatCap) +for libntfs, excellent documentation, comments, testing and fixes, +moreover to Theodore Ts'o whose +.BR resize2fs (8) +man page formed the basis of this page. +.SH SEE ALSO +.BR fdisk (8), +.BR cfdisk (8), +.BR sfdisk (8), +.BR parted (8), +.BR mkntfs (8) From 1cdf00a8948da3d633b91a2eee8b73a24a69f85c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 24 Nov 2002 17:52:26 +0000 Subject: [PATCH 0131/2994] Hi, This is important. kilo-, mega- or gigabytes prefixes use decimal, not binary units according to biggest standards (SI, ATA, IEEE, disk manufacturers, etc). Also only [kMG] accepted and [Kmg] not anymore. Manual updated according to this. "Side-effect" of the patch: user can't destroy his fs if uses the same or slightly bigger decimal unit for disk partitioning (e.g. by cfdisk or recent fdisk) as he did for ntfsresize [used binary units before]. From now on new/old volume sizes are printed in bytes and MB's, not in clusters and MB's. Cheers, Szaka (Logical change 1.18) --- ntfstools/ntfsresize.8.in | 15 +++++++++------ ntfstools/ntfsresize.c | 39 ++++++++++++++++++++++++++++----------- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/ntfstools/ntfsresize.8.in b/ntfstools/ntfsresize.8.in index ef2d6512..e52302a6 100644 --- a/ntfstools/ntfsresize.8.in +++ b/ntfstools/ntfsresize.8.in @@ -9,7 +9,7 @@ ntfsresize \- resize an NTFS filesystem [\fB\-fhin\fR] [\fB\-c .I clusters\fR] -[\fB\-s \fIsize\fR[\fBK\fR|\fBM\fR|\fBG\fR]] +[\fB\-s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR]] .I device .SH DESCRIPTION The @@ -24,9 +24,12 @@ bytes. The .I size parameter may have one of the optional modifiers -\fBK\fR, \fBM\fR, \fBG\fR, which means the +\fBk\fR, \fBM\fR, \fBG\fR, which means the .I size parameter is given in kilo-, mega- or gigabytes respectively. +.B ntfsresize +conforms to the SI, ATA, IEEE standards and the disk manufacturers +by using k=10^3, M=10^6 and G=10^9. .PP The .B ntfsresize @@ -82,12 +85,12 @@ displays what it would do if it were to resize the filesystem. Shrink volume to size given in NTFS .I clusters\fR. .TP -.B -s \fIsize\fR[\fBK\fR|\fBM\fR|\fBG\fR] -Shrink volume to \fIsize\fR[\fBK\fR|\fBM\fR|\fBG\fR] bytes. -The optional modifiers \fBK\fR, \fBM\fR, \fBG\fR mean the +.B -s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] +Shrink volume to \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes. +The optional modifiers \fBk\fR, \fBM\fR, \fBG\fR mean the .I size parameter is given in kilo-, mega- or gigabytes respectively. -The corresponding lowercase letters are also accepted. +Conforming to standards, k=10^3, M=10^6 and G=10^9. .SH BUGS No bugs are known or has been reported so far in the current version. If you find otherwise, please report it to diff --git a/ntfstools/ntfsresize.c b/ntfstools/ntfsresize.c index d6c67084..dad25944 100644 --- a/ntfstools/ntfsresize.c +++ b/ntfstools/ntfsresize.c @@ -90,6 +90,7 @@ struct progress_bar { ntfs_volume *vol = NULL; struct bitmap lcn_bitmap; +#define NTFS_MBYTE (1000 * 1000) #define ERR_PREFIX "ERROR" #define PERR_PREFIX ERR_PREFIX "(%d): " @@ -146,7 +147,7 @@ int perr_exit(const char *fmt, ...) void usage() { printf("\n"); - printf ("Usage: %s [-fhin] [-c clusters] [-s size[K|M|G]] device\n", EXEC_NAME); + printf ("Usage: %s [-fhin] [-c clusters] [-s size[k|M|G]] device\n", EXEC_NAME); printf("Shrink a defragmented NTFS volume.\n"); printf("\n"); printf (" -c clusters Shrink volume to size given in NTFS clusters\n"); @@ -155,7 +156,7 @@ void usage() printf (" -h This help text\n"); printf (" -i Calculate the smallest shrunken size supported (read-only)\n"); printf (" -n Make a test run without write operations (read-only)\n"); - printf (" -s size[K|M|G] Shrink volume to size[K|M|G] bytes\n"); + printf (" -s size[k|M|G] Shrink volume to size[k|M|G] bytes (k=10^3, M=10^6, G=10^9)\n"); /* printf (" -v Verbose operation\n"); */ printf("%s", NTFS_REPORT_BANNER); exit(1); @@ -195,17 +196,26 @@ s64 get_new_volume_size(char *s) if (strlen(suffix) > 1) usage(); + /* We follow the SI prefixes: + http://physics.nist.gov/cuu/Units/prefixes.html + http://physics.nist.gov/cuu/Units/binary.html + Disk partitioning tools use prefixes as, + k M G + old fdisk 2^10 2^20 10^3*2^20 + recent fdisk 10^3 10^6 10^9 + cfdisk 10^3 10^6 10^9 + sfdisk 2^10 2^20 + parted 2^10 2^20 (may change) + fdisk (DOS) 2^10 2^20 + */ /* FIXME: check for overflow */ switch (*suffix) { case 'G': - case 'g': - size *= 1024; + size *= 1000; case 'M': - case 'm': - size *= 1024; - case 'K': + size *= 1000; case 'k': - size *= 1024; + size *= 1000; break; default: usage(); @@ -465,7 +475,7 @@ void advise_on_resize() printf(NERR_PREFIX "However, "); printf("You could resize at cluster %lld gaining %lld MB.\n", - i, ((vol->nr_clusters - i) * vol->cluster_size) >> 20); + i, ((vol->nr_clusters - i) * vol->cluster_size) / NTFS_MBYTE); exit(1); } @@ -741,8 +751,11 @@ void update_bootsector(s64 nr_clusters) void print_volume_size(char *str, ntfs_volume *v, s64 nr_clusters) { - printf("%s: %lld clusters (%lld MB)\n", - str, nr_clusters, (nr_clusters * v->cluster_size) >> 20); + s64 b; /* volume size in bytes */ + + b = nr_clusters * v->cluster_size; + printf("%s: %lld bytes (%lld MB)\n", + str, b, rounded_up_division(b, NTFS_MBYTE)); } @@ -822,6 +835,10 @@ int main(int argc, char **argv) mount_volume(); if (opt.size || opt.bytes) { + /* Take the integer part: when shrinking we don't want + to make the volume to be bigger than requested. + Later on we will also decrease this value to save + room for the backup boot sector */ new_volume_size = opt.bytes / vol->cluster_size; if (opt.size) new_volume_size = opt.size; From 94ebdbc34873fa910da3ce8eb1f41bfd56840e5b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 24 Nov 2002 17:52:26 +0000 Subject: [PATCH 0132/2994] ntfsresize.8.in, ntfsresize.c: Hi, This is important. kilo-, mega- or gigabytes prefixes use decimal, not binary units according to biggest standards (SI, ATA, IEEE, disk manufacturers, etc). Also only [kMG] accepted and [Kmg] not anymore. Manual updated according to this. "Side-effect" of the patch: user can't destroy his fs if uses the same or slightly bigger decimal unit for disk partitioning (e.g. by cfdisk or recent fdisk) as he did for ntfsresize [used binary units before]. From now on new/old volume sizes are printed in bytes and MB's, not in clusters and MB's. Cheers, Szaka BKrev: 3de111daUryDdizzKIb25cpern36zg From c78a451b9aa0ab16a5dc8782c3f0675d7d444054 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 25 Nov 2002 12:07:43 +0000 Subject: [PATCH 0133/2994] Simplicity rulez, this patch eliminates the "resize by number of clusters" feature. It was only used as a temporary helper for development and on the long term it would be just an unneeded baggage. advise_on_resize() reworked accordingly. (Logical change 1.19) --- ntfstools/ntfsresize.8.in | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ntfstools/ntfsresize.8.in b/ntfstools/ntfsresize.8.in index e52302a6..7ad37ada 100644 --- a/ntfstools/ntfsresize.8.in +++ b/ntfstools/ntfsresize.8.in @@ -7,8 +7,6 @@ ntfsresize \- resize an NTFS filesystem .SH SYNOPSIS .B ntfsresize [\fB\-fhin\fR] -[\fB\-c -.I clusters\fR] [\fB\-s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR]] .I device .SH DESCRIPTION @@ -81,10 +79,6 @@ Volume will be opened read-only and .B ntfsresize displays what it would do if it were to resize the filesystem. .TP -.B -c \fIclusters -Shrink volume to size given in NTFS -.I clusters\fR. -.TP .B -s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] Shrink volume to \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes. The optional modifiers \fBk\fR, \fBM\fR, \fBG\fR mean the From 885ae1eda802b8f9d85b73c2040980dfb4dee19e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 25 Nov 2002 12:07:43 +0000 Subject: [PATCH 0134/2994] [Szaka] Simplicity rulez, this patch eliminates the "resize by number of clusters" feature. It was only used as a temporary helper for development and on the long term it would be just an unneeded baggage. advise_on_resize() reworked accordingly. (Logical change 1.19) --- ntfstools/ntfsresize.c | 55 ++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/ntfstools/ntfsresize.c b/ntfstools/ntfsresize.c index dad25944..bdf84de4 100644 --- a/ntfstools/ntfsresize.c +++ b/ntfstools/ntfsresize.c @@ -70,7 +70,6 @@ struct { int ro_flag; int force; int info; - s64 size; s64 bytes; char *volume; } opt; @@ -147,10 +146,9 @@ int perr_exit(const char *fmt, ...) void usage() { printf("\n"); - printf ("Usage: %s [-fhin] [-c clusters] [-s size[k|M|G]] device\n", EXEC_NAME); + printf ("Usage: %s [-fhin] [-s size[k|M|G]] device\n", EXEC_NAME); printf("Shrink a defragmented NTFS volume.\n"); printf("\n"); - printf (" -c clusters Shrink volume to size given in NTFS clusters\n"); Dprintf(" -d Show debug information\n"); printf (" -f Force to progress (DANGEROUS)\n"); printf (" -h This help text\n"); @@ -234,13 +232,8 @@ void parse_options(int argc, char **argv) memset(&opt, 0, sizeof(opt)); - while ((i = getopt(argc, argv, "c:dfhins:")) != EOF) + while ((i = getopt(argc, argv, "dfhins:")) != EOF) switch (i) { - case 'c': - opt.size = strtoll(optarg, &s, 0); - if (*s || opt.size <= 0 || errno == ERANGE) - err_exit("Illegal number of clusters!\n"); - break; case 'd': opt.debug = 1; break; @@ -276,20 +269,14 @@ void parse_options(int argc, char **argv) perr_exit("Couldn't open /dev/null"); - if (opt.size && opt.bytes) { - printf(NERR_PREFIX "It makes no sense to use " - "-c and -s together.\n"); - usage(); - } - - /* If no '-c clusters' then estimate smallest shrunken volume size */ - if (!opt.size && !opt.bytes) + /* If no '-s size' then estimate smallest shrunken volume size */ + if (!opt.bytes) opt.info = 1; if (opt.info) { - if (opt.size || opt.bytes) { + if (opt.bytes) { printf(NERR_PREFIX "It makes no sense to use -i and " - "-%c together.\n", opt.size ? 'c' : 's'); + "-s together.\n"); usage(); } opt.ro_flag = MS_RDONLY; @@ -457,7 +444,7 @@ void walk_inodes() void advise_on_resize() { - u64 i; + u64 i, old_b, new_b, g_b, old_mb, new_mb, g_mb; for (i = vol->nr_clusters - 1; i > 0; i--) if (ntfs_get_bit(lcn_bitmap.bm, i)) @@ -474,8 +461,26 @@ void advise_on_resize() if (!opt.info) printf(NERR_PREFIX "However, "); - printf("You could resize at cluster %lld gaining %lld MB.\n", - i, ((vol->nr_clusters - i) * vol->cluster_size) / NTFS_MBYTE); + old_b = vol->nr_clusters * vol->cluster_size; + old_mb = rounded_up_division(old_b, NTFS_MBYTE); + new_b = i * vol->cluster_size; + new_mb = rounded_up_division(new_b, NTFS_MBYTE); + g_b = (vol->nr_clusters - i) * vol->cluster_size; + g_mb = g_b / NTFS_MBYTE; + + printf("You could resize at %lld bytes ", new_b); + + if ((new_mb * NTFS_MBYTE) < old_b) + printf("or %lld MB ", new_mb); + + printf("(gaining "); + + if (g_mb && (old_mb - new_mb)) + printf("%lld MB", old_mb - new_mb); + else + printf("%lld bytes", g_b); + + printf(").\n"); exit(1); } @@ -798,7 +803,7 @@ void mount_volume() if (ntfs_is_version_supported(vol)) perr_exit("Unknown NTFS version"); - printf("Cluster size : %u\n", vol->cluster_size); + Dprintf("Cluster size : %u\n", vol->cluster_size); print_volume_size("Current volume size", vol, vol->nr_clusters); } @@ -834,14 +839,12 @@ int main(int argc, char **argv) mount_volume(); - if (opt.size || opt.bytes) { + if (opt.bytes) { /* Take the integer part: when shrinking we don't want to make the volume to be bigger than requested. Later on we will also decrease this value to save room for the backup boot sector */ new_volume_size = opt.bytes / vol->cluster_size; - if (opt.size) - new_volume_size = opt.size; print_volume_size("New volume size ", vol, new_volume_size); } From 204ef2c7ed9263ad3d9b0258bcf70bd47032835f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 25 Nov 2002 12:07:43 +0000 Subject: [PATCH 0135/2994] ntfsresize.8.in: Simplicity rulez, this patch eliminates the "resize by number of clusters" feature. It was only used as a temporary helper for development and on the long term it would be just an unneeded baggage. advise_on_resize() reworked accordingly. ntfsresize.c: [Szaka] Simplicity rulez, this patch eliminates the "resize by number of clusters" feature. It was only used as a temporary helper for development and on the long term it would be just an unneeded baggage. advise_on_resize() reworked accordingly. BKrev: 3de2128fY-mA-GfH497dipyVBkcFbg From 9ff1d2d0a378e8ac139370c8d07d124dc37665fa Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Wed, 27 Nov 2002 16:32:58 +0000 Subject: [PATCH 0136/2994] [Szaka] use const char * for message strings instead of #define advise Windows built in defrag if resize needs defragmentation (Logical change 1.20) --- ntfstools/ntfsresize.c | 65 ++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/ntfstools/ntfsresize.c b/ntfstools/ntfsresize.c index bdf84de4..d7d2ab65 100644 --- a/ntfstools/ntfsresize.c +++ b/ntfstools/ntfsresize.c @@ -46,23 +46,28 @@ const char *EXEC_NAME = "ntfsresize"; -#define NTFS_REPORT_BANNER "\nReport bugs to linux-ntfs-dev@lists.sf.net. " \ - "Homepage: http://linux-ntfs.sf.net\n" +static const char *ntfs_report_banner = +"\nReport bugs to linux-ntfs-dev@lists.sf.net. " +"Homepage: http://linux-ntfs.sf.net\n"; -#define NTFS_RESIZE_WARNING \ -"WARNING: Every sanity check passed and only the DANGEROUS operations left.\n" \ -"Please make sure all your important data had been backed up in case of an\n" \ -"unexpected failure!\n" +static const char *resize_warning_msg = +"WARNING: Every sanity check passed and only the DANGEROUS operations left.\n" +"Please make sure all your important data had been backed up in case of an\n" +"unexpected failure!\n"; -#define NTFS_RESIZE_IMPORTANT \ -"NTFS had been successfully resized on device '%s'.\n" \ -"You can go on to resize the device e.g. with 'fdisk'.\n" \ -"IMPORTANT: When recreating the partition, make sure you\n" \ -" 1) create it with the same starting disk cylinder\n" \ -" 2) create it with the same partition type (usually 7, HPFS/NTFS)\n" \ -" 3) do not make it smaller than the new NTFS filesystem size\n" \ -" 4) set the bootable flag for the partition if it existed before\n" \ -"Otherwise you may lose your data or can't boot your computer from the disk!\n" +static const char *resize_important_msg = +"NTFS had been successfully resized on device '%s'.\n" +"You can go on to resize the device e.g. with 'fdisk'.\n" +"IMPORTANT: When recreating the partition, make sure you\n" +" 1) create it with the same starting disk cylinder\n" +" 2) create it with the same partition type (usually 7, HPFS/NTFS)\n" +" 3) do not make it smaller than the new NTFS filesystem size\n" +" 4) set the bootable flag for the partition if it existed before\n" +"Otherwise you may lose your data or can't boot your computer from the disk!\n"; + +static const char *fragmented_volume_msg = +"The volume end is fragmented, this case is not yet supported. Defragment it\n" +"(Windows 2000, XP and .NET have built in defragmentation tool) and try again.\n"; struct { int verbose; @@ -156,7 +161,7 @@ void usage() printf (" -n Make a test run without write operations (read-only)\n"); printf (" -s size[k|M|G] Shrink volume to size[k|M|G] bytes (k=10^3, M=10^6, G=10^9)\n"); /* printf (" -v Verbose operation\n"); */ - printf("%s", NTFS_REPORT_BANNER); + printf(ntfs_report_banner); exit(1); } @@ -445,22 +450,22 @@ void walk_inodes() void advise_on_resize() { u64 i, old_b, new_b, g_b, old_mb, new_mb, g_mb; + int fragmanted_end; for (i = vol->nr_clusters - 1; i > 0; i--) if (ntfs_get_bit(lcn_bitmap.bm, i)) break; i += 2; /* first free + we reserve one for the backup boot sector */ - if (i >= vol->nr_clusters) { - if (opt.info) - printf("The volume end is fragmented. " - "This case is not yet supported.\n"); - exit(1); + fragmanted_end = (i >= vol->nr_clusters) ? 1 : 0; + + if (fragmanted_end || !opt.info) { + printf(fragmented_volume_msg); + if (fragmanted_end) + exit(1); + printf("Now "); } - if (!opt.info) - printf(NERR_PREFIX "However, "); - old_b = vol->nr_clusters * vol->cluster_size; old_mb = rounded_up_division(old_b, NTFS_MBYTE); new_b = i * vol->cluster_size; @@ -473,7 +478,7 @@ void advise_on_resize() if ((new_mb * NTFS_MBYTE) < old_b) printf("or %lld MB ", new_mb); - printf("(gaining "); + printf("(freeing "); if (g_mb && (old_mb - new_mb)) printf("%lld MB", old_mb - new_mb); @@ -774,10 +779,10 @@ void mount_volume() if (mntflag & NTFS_MF_MOUNTED) { if (!(mntflag & NTFS_MF_READONLY)) err_exit("Device %s is mounted read-write. " - "You must umount it first.\n", opt.volume); + "You must 'umount' it first.\n", opt.volume); if (!opt.ro_flag) err_exit("Device %s is mounted. " - "You must umount it first.\n", opt.volume); + "You must 'umount' it first.\n", opt.volume); } if (!(vol = ntfs_mount(opt.volume, opt.ro_flag))) { @@ -877,13 +882,11 @@ int main(int argc, char **argv) for (i = new_volume_size; i < vol->nr_clusters; i++) if (ntfs_get_bit(lcn_bitmap.bm, (u64)i)) { /* FIXME: relocate cluster */ - printf(NERR_PREFIX "Fragmented volume not yet " - "supported. Defragment it before resize.\n"); advise_on_resize(); } if (opt.force-- <= 0 && !opt.ro_flag) { - printf(NTFS_RESIZE_WARNING); + printf(resize_warning_msg); proceed_question(); } @@ -905,7 +908,7 @@ int main(int argc, char **argv) if (fsync(vol->fd) == -1) perr_exit("fsync"); - printf(NTFS_RESIZE_IMPORTANT, vol->dev_name); + printf(resize_important_msg, vol->dev_name); return 0; } From a2c8cf2ee0f925afff429a196df900cbd928a026 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Wed, 27 Nov 2002 16:32:58 +0000 Subject: [PATCH 0137/2994] [Szaka] fixed tab/space in ntfsresize man page that messed man2html output (Logical change 1.20) --- ntfstools/ntfsresize.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfstools/ntfsresize.8.in b/ntfstools/ntfsresize.8.in index 7ad37ada..b2be7c28 100644 --- a/ntfstools/ntfsresize.8.in +++ b/ntfstools/ntfsresize.8.in @@ -7,7 +7,7 @@ ntfsresize \- resize an NTFS filesystem .SH SYNOPSIS .B ntfsresize [\fB\-fhin\fR] -[\fB\-s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR]] +[\fB\-s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR]] .I device .SH DESCRIPTION The From 9ef788b993ac1d0d8c6cc1537fb856bef330cd5a Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Wed, 27 Nov 2002 16:32:58 +0000 Subject: [PATCH 0138/2994] [Szaka] minor ntfsresize cleanup BKrev: 3de4f3bab-BZBFycCGhKWO1YY8i2yQ From c7c18995b1d979d3a75347aed9a31385be5c1d9a Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Wed, 27 Nov 2002 16:32:58 +0000 Subject: [PATCH 0139/2994] [Szaka] ntfsresize added to ChangeLog as new tool (Logical change 1.20) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 40046066..ce67e4ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -143,6 +143,7 @@ cope with precreated sparse files. - Remove GPL message text from usage information in mkntfs. - New tool, ntfsundelete, written by Richard Russon. + - New tool, ntfsresize, written by Szabolcs Szakacsits. 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for From 41167410fb96307820340c041dc4c7c06958ef68 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 28 Nov 2002 17:27:09 +0000 Subject: [PATCH 0140/2994] (Logical change 1.21) --- ntfstools/ntfstools.8.in | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 ntfstools/ntfstools.8.in diff --git a/ntfstools/ntfstools.8.in b/ntfstools/ntfstools.8.in new file mode 100644 index 00000000..981fd17d --- /dev/null +++ b/ntfstools/ntfstools.8.in @@ -0,0 +1,43 @@ +.\" Copyright (c) 2002 Richard Russon. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSTOOLS 8 "May 2002" "Linux-NTFS version @VERSION@" + +.SH OVERVIEW +.B ntfstools +is a suite of NTFS utilities based around a shared library. The tools are +available for free and come with full source code. + +.SH TOOLS +.SS mkntfs(8) +.PP +Format a partition using NTFS. +.SS ntfsfix(8) +.PP +Clear the LogFile of a partition to make Windows perform a thorough check next +time it boots. +.SS ntfsinfo(8) +.PP +Show some information about an NTFS partition or one of the files or directories +within it. +.SS ntfslabel(8) +.PP +Show, or set, an NTFS partition's volume label. +.SS ntfsresize(8) +.PP +Resize an NTFS partition without losing data. +.SS ntfsundelete(8) +.PP +Recover deleted files from an NTFS partition. + +.SH AUTHORS +.PP +The tools have been written by Anton Altaparmakov, Richard Russon, Matthew Fanto +and Szabolcs Szakacsits. + +.SH AVAILABILITY +The +.B ntfstools +can be downloaded from http://linux-ntfs.sf.net/downloads.html + + From 3bdc3ed6338f61f8b8919f3bdfcf13326aca14f4 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 28 Nov 2002 17:27:09 +0000 Subject: [PATCH 0141/2994] Changed formatted text into a proper table (Logical change 1.21) --- ntfstools/mkntfs.8.in | 44 ++++++++++++++++++------------------- ntfstools/ntfsundelete.8.in | 37 ++++++++++++++----------------- 2 files changed, 37 insertions(+), 44 deletions(-) diff --git a/ntfstools/mkntfs.8.in b/ntfstools/mkntfs.8.in index 1638fc4d..6916396d 100644 --- a/ntfstools/mkntfs.8.in +++ b/ntfstools/mkntfs.8.in @@ -85,17 +85,16 @@ two, with at least 256, and at most 65536 bytes per cluster. If omitted, .I cluster-size is determined by the volume size. The value is determined as follows: -.br -.B \tVolume size\tDefault cluster size (in bytes) -.br - \<= 512MB 512 -.br - \]512MB-1GB\] 1024 -.br - \]1GB-2GB\] 2048 -.br - \> 2GB 4096 -.br +.TS +lB lB lB +l l r. +Volume size Default cluster +0 - 512MB 512 bytes +512MB - 1GB 1024 bytes +1GB - 2GB 2048 bytes +2GB + 4096 bytes +.TE + Note that the default cluster size is set to be at least equal to the sector size as a cluster cannot be smaller than a sector. Also, note that values greater than 4096 have the side effect that compression is disabled on the @@ -115,18 +114,17 @@ files, it is useful to set the zone multiplier to a higher value. Note, that the MFT zone is resized on the fly as required during operation of the NTFS driver but choosing a good value will reduce fragmentation. Valid values are 1, 2, 3 and 4. The values have the following meaning: -.br -.B \tMFT zone\t\tMFT zone size -.br -.B \tmultiplier\t(in % of volume size) -.br - 1 12.5% (default) -.br - 2 25% -.br - 3 37.5% -.br - 4 50% +.TS +lB lB +lB lB +c l. +MFT zone MFT zone size +multiplier (% of volume size) +1 12.5% (default) +2 25.0% +3 37.5% +4 50.0% +.TE .TP .B \-f Same as diff --git a/ntfstools/ntfsundelete.8.in b/ntfstools/ntfsundelete.8.in index 5473407b..f28f4a05 100644 --- a/ntfstools/ntfsundelete.8.in +++ b/ntfstools/ntfsundelete.8.in @@ -206,33 +206,28 @@ and .B \-\-time options, respectively. .sp -The output to scan will be: +The output of scan will be: +.sp +.nf +Inode Flags %age Date Size Filename + 6038 FN.. 93% 2002-07-17 26629 thesis.doc +.fi +.TS +lB lB +l l. +Flag Description +F/D File/Directory +N/R (Non-)Resident data stream +C/E Compressed/Encrypted data stream +! Missing attributes +.TE +.RS .sp .br -Inode Flags %age Date Size Filename -.br ----------------------------------------------- -.br -6038 FN.. 93% 2002-07-17 26629 thesis.doc -.br -.RS -.TP -The flags field can display: -F/D \- File/Directory -.br -N/R \- (Non-)Resident data stream -.br -C/E \- Compressed/Encrypted data stream -.br -! \- Missing attributes -.sp -.RE -.RS The percentage field shows how much of the file can potentially be recovered. .sp .br .RE -.RE .BI "\-S " range .br .ns From a3e0c862c0347e84046b04e0577500bb627acb73 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 28 Nov 2002 17:27:09 +0000 Subject: [PATCH 0142/2994] Initial revision --- ntfstools/ntfstools.8.in | 43 ---------------------------------------- 1 file changed, 43 deletions(-) diff --git a/ntfstools/ntfstools.8.in b/ntfstools/ntfstools.8.in index 981fd17d..e69de29b 100644 --- a/ntfstools/ntfstools.8.in +++ b/ntfstools/ntfstools.8.in @@ -1,43 +0,0 @@ -.\" Copyright (c) 2002 Richard Russon. All Rights Reserved. -.\" This file may be copied under the terms of the GNU Public License. -.\" -.TH NTFSTOOLS 8 "May 2002" "Linux-NTFS version @VERSION@" - -.SH OVERVIEW -.B ntfstools -is a suite of NTFS utilities based around a shared library. The tools are -available for free and come with full source code. - -.SH TOOLS -.SS mkntfs(8) -.PP -Format a partition using NTFS. -.SS ntfsfix(8) -.PP -Clear the LogFile of a partition to make Windows perform a thorough check next -time it boots. -.SS ntfsinfo(8) -.PP -Show some information about an NTFS partition or one of the files or directories -within it. -.SS ntfslabel(8) -.PP -Show, or set, an NTFS partition's volume label. -.SS ntfsresize(8) -.PP -Resize an NTFS partition without losing data. -.SS ntfsundelete(8) -.PP -Recover deleted files from an NTFS partition. - -.SH AUTHORS -.PP -The tools have been written by Anton Altaparmakov, Richard Russon, Matthew Fanto -and Szabolcs Szakacsits. - -.SH AVAILABILITY -The -.B ntfstools -can be downloaded from http://linux-ntfs.sf.net/downloads.html - - From 9b185bdd6240af6fb2c6336e340aa8505da3a6f6 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 28 Nov 2002 17:27:09 +0000 Subject: [PATCH 0143/2994] man page tidyups BKrev: 3de651edU6FecRqcMjjfZCUDVBbHFQ From e412c067624659a8a797ebd1c042cbac6d53d70f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 11:38:09 +0000 Subject: [PATCH 0144/2994] Rename url to new name (Logical change 1.22) --- BitKeeper/etc/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config index 9fce5dd4..8554b936 100644 --- a/BitKeeper/etc/config +++ b/BitKeeper/etc/config @@ -1,7 +1,7 @@ description: Linux NTFS userspace library and utilities category: System Environment/Base homepage: http://linux-ntfs.sf.net/ -bkweb: http://linux-ntfs.bkbits.net:8080/ntfs-progs +bkweb: http://linux-ntfs.bkbits.net:8080/ntfsprogs contact: Anton Altaparmakov email: aia21@cantab.net logging: logging@openlogging.org From f9037f4025a3351115717b9443df22e9885e4e94 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 11:38:09 +0000 Subject: [PATCH 0145/2994] config: Rename url to new name BKrev: 3de751a1RJl5sPQfPFnmjYJLbsnVeg From c282c53742fdcea6fd8f6e981f7e9d3b72c060ff Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0146/2994] ntfstools->ntfsprogs (Logical change 1.23) --- Makefile.am | 6 +++--- README | 8 ++++---- configure.in | 14 +++++++------- linux-ntfs.spec.in | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Makefile.am b/Makefile.am index e2f2117c..56ecce06 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,11 +6,11 @@ else AM_CFLAGS = -D_FILE_OFFSET_BITS=64 endif -SUBDIRS = doc include libntfs ntfstools +SUBDIRS = doc include libntfs ntfsprogs EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ INSTALL NEWS README autogen.sh linux-ntfs.spec.in \ - TODO.ntfstools + TODO.ntfsprogs AUTOMAKE_OPTIONS = gnu @@ -21,5 +21,5 @@ libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status --recheck strip: - $(MAKE) -C ntfstools strip + $(MAKE) -C ntfsprogs strip diff --git a/README b/README index e1b238a7..4df0739e 100644 --- a/README +++ b/README @@ -15,7 +15,7 @@ read the GNU General Public License to be found in the file COPYING in the main Linux-NTFS distribution directory. Linux-NTFS currently consists of the NTFS library (libntfs) and utilities -(ntfstools). In the future it will also contain a new NTFS driver for the +(ntfsprogs). In the future it will also contain a new NTFS driver for the Linux kernel. The Linux-NTFS project is registered on Sourceforge.net. The home page for @@ -36,16 +36,16 @@ volume). The easiest way to do this is to visit the list page on sourceforge at: NTFS library ============ -Provides common NTFS access functions to the ntfstools and other foreign +Provides common NTFS access functions to the ntfsprogs and other foreign open source applications. Note, that the library is still under heavy development and doesn't include the majority of functionality yet. It only -is capable of just about supporting the current ntfstools, so I wouldn't +is capable of just about supporting the current ntfsprogs, so I wouldn't recommend using it for your own applications at this stage. NTFS utilities ============== -The ntfstools will eventually include utilities for doing all required tasks +The ntfsprogs will eventually include utilities for doing all required tasks to NTFS partitions. In general, just run a utility without any command line options to display the version number and usage syntax. diff --git a/configure.in b/configure.in index 49387ccb..13b50afb 100644 --- a/configure.in +++ b/configure.in @@ -128,13 +128,13 @@ AC_OUTPUT([ doc/Makefile include/Makefile libntfs/Makefile - ntfstools/Makefile - ntfstools/mkntfs.8 - ntfstools/ntfsfix.8 - ntfstools/ntfslabel.8 - ntfstools/ntfsinfo.8 - ntfstools/ntfsundelete.8 - ntfstools/ntfsresize.8 + ntfsprogs/Makefile + ntfsprogs/mkntfs.8 + ntfsprogs/ntfsfix.8 + ntfsprogs/ntfslabel.8 + ntfsprogs/ntfsinfo.8 + ntfsprogs/ntfsundelete.8 + ntfsprogs/ntfsresize.8 linux-ntfs.spec ]) diff --git a/linux-ntfs.spec.in b/linux-ntfs.spec.in index b3ef7994..c19b9ce7 100644 --- a/linux-ntfs.spec.in +++ b/linux-ntfs.spec.in @@ -63,7 +63,7 @@ rm -rf "$RPM_BUILD_ROOT" %files %defattr(-,root,root) -%doc AUTHORS COPYING CREDITS ChangeLog INSTALL NEWS README TODO.include TODO.libntfs TODO.ntfstools doc/CodingStyle doc/attribute_definitions doc/attributes.txt doc/compression.txt doc/tunable_settings doc/template.c doc/template.h doc/system_files.txt doc/system_security_descriptors.txt +%doc AUTHORS COPYING CREDITS ChangeLog INSTALL NEWS README TODO.include TODO.libntfs TODO.ntfsprogs doc/CodingStyle doc/attribute_definitions doc/attributes.txt doc/compression.txt doc/tunable_settings doc/template.c doc/template.h doc/system_files.txt doc/system_security_descriptors.txt %{bindir}/* %{sbindir}/* %{mandir}/*/* From df7cae02e774bf7e7dcde43da3f118bab8f604e9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0147/2994] Initial revision --- TODO.ntfsprogs | 0 ntfsprogs/Makefile.am | 0 ntfsprogs/Makefile.in | 0 ntfsprogs/attrdef.c | 0 ntfsprogs/boot.c | 0 ntfsprogs/dumplog.c | 0 ntfsprogs/mkntfs.8.in | 0 ntfsprogs/mkntfs.c | 0 ntfsprogs/ntfsdump_logfile.c | 0 ntfsprogs/ntfsfix.8.in | 0 ntfsprogs/ntfsfix.c | 0 ntfsprogs/ntfsinfo.8.in | 0 ntfsprogs/ntfsinfo.c | 0 ntfsprogs/ntfslabel.8.in | 0 ntfsprogs/ntfslabel.c | 0 ntfsprogs/ntfsresize.8.in | 0 ntfsprogs/ntfsresize.c | 0 ntfsprogs/ntfstools.8.in | 0 ntfsprogs/ntfsundelete.8.in | 0 ntfsprogs/ntfsundelete.c | 0 ntfsprogs/ntfsundelete.h | 0 ntfsprogs/ntfswipe.c | 0 ntfsprogs/ntfswipe.h | 0 ntfsprogs/sd.c | 0 ntfsprogs/upcase.c | 0 25 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 TODO.ntfsprogs create mode 100644 ntfsprogs/Makefile.am create mode 100644 ntfsprogs/Makefile.in create mode 100644 ntfsprogs/attrdef.c create mode 100644 ntfsprogs/boot.c create mode 100644 ntfsprogs/dumplog.c create mode 100644 ntfsprogs/mkntfs.8.in create mode 100644 ntfsprogs/mkntfs.c create mode 100644 ntfsprogs/ntfsdump_logfile.c create mode 100644 ntfsprogs/ntfsfix.8.in create mode 100644 ntfsprogs/ntfsfix.c create mode 100644 ntfsprogs/ntfsinfo.8.in create mode 100644 ntfsprogs/ntfsinfo.c create mode 100644 ntfsprogs/ntfslabel.8.in create mode 100644 ntfsprogs/ntfslabel.c create mode 100644 ntfsprogs/ntfsresize.8.in create mode 100644 ntfsprogs/ntfsresize.c create mode 100644 ntfsprogs/ntfstools.8.in create mode 100644 ntfsprogs/ntfsundelete.8.in create mode 100644 ntfsprogs/ntfsundelete.c create mode 100644 ntfsprogs/ntfsundelete.h create mode 100644 ntfsprogs/ntfswipe.c create mode 100644 ntfsprogs/ntfswipe.h create mode 100644 ntfsprogs/sd.c create mode 100644 ntfsprogs/upcase.c diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/attrdef.c b/ntfsprogs/attrdef.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/boot.c b/ntfsprogs/boot.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/dumplog.c b/ntfsprogs/dumplog.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfslabel.8.in b/ntfsprogs/ntfslabel.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfstools.8.in b/ntfsprogs/ntfstools.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfswipe.h b/ntfsprogs/ntfswipe.h new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c new file mode 100644 index 00000000..e69de29b From a40fef9bf90b5729b1d12fcf8270b68a0abeb5d5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0148/2994] ntfstools->ntfsprogs 2002/11/29 12:07:08+00:00 cantab.net!aia21 mvdir (Logical change 1.23) --- ntfsprogs/ntfstools.8.in | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/ntfsprogs/ntfstools.8.in b/ntfsprogs/ntfstools.8.in index e69de29b..bde61e22 100644 --- a/ntfsprogs/ntfstools.8.in +++ b/ntfsprogs/ntfstools.8.in @@ -0,0 +1,44 @@ +.\" Copyright (c) 2002 Richard Russon. All Rights Reserved. +.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSPROGS 8 "May 2002" "Linux-NTFS version @VERSION@" + +.SH OVERVIEW +.B ntfsprogs +is a suite of NTFS utilities based around a shared library. The tools are +available for free and come with full source code. + +.SH TOOLS +.SS mkntfs(8) +.PP +Format a partition using NTFS. +.SS ntfsfix(8) +.PP +Clear the LogFile of a partition to make Windows perform a thorough check next +time it boots. +.SS ntfsinfo(8) +.PP +Show some information about an NTFS partition or one of the files or directories +within it. +.SS ntfslabel(8) +.PP +Show, or set, an NTFS partition's volume label. +.SS ntfsresize(8) +.PP +Resize an NTFS partition without losing data. +.SS ntfsundelete(8) +.PP +Recover deleted files from an NTFS partition. + +.SH AUTHORS +.PP +The tools have been written by Anton Altaparmakov, Richard Russon, Matthew Fanto +and Szabolcs Szakacsits. + +.SH AVAILABILITY +The +.B ntfsprogs +can be downloaded from http://linux-ntfs.sf.net/downloads.html + + From ad913491edfb574622052cfbad2ddf1b3c550e14 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0149/2994] ntfstools->ntfsprogs }(Logical change 1.23) --- ntfstools/ntfstools.8.in | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 ntfstools/ntfstools.8.in diff --git a/ntfstools/ntfstools.8.in b/ntfstools/ntfstools.8.in deleted file mode 100644 index e69de29b..00000000 From 8ef654619feaa16817556edb7e41b2ce4fbbd3d7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0150/2994] Rename: TODO.ntfstools -> TODO.ntfsprogs (Logical change 1.23) --- TODO.ntfsprogs | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index e69de29b..cc60befa 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -0,0 +1,74 @@ +Please keep in alphabetical order so utilities are easier to find. + +Thanks, + Anton + + + +********** +* mkntfs * +********** + +- mkntfs should be hard linked with mkfs.ntfs for the mkfs utility. +- We don't know what the real last sector is, thus we mark the volume dirty + and the subsequent chkdsk (which will happen on reboot into Windows + automatically) recreates the backup boot sector if the Linux kernel lied to + us about the number of sectors. + + + +*********** +* ntfsfix * +*********** + +- Cleanup to use ntfs_attr_* API for editing $MFTMirr, $Volume, and $LogFile. + This has the immediate benefit of enabling attribute list support and making + the code simpler. +- On ntfs 3.0+ volumes need to disable the usn journal if it is active. This + means deleting file $UsnJrnl from /$Extend directory. +- On ntfs 3.0+ volumes need to mark the quota out of date? - Probably, but + it shouldn't cause any corruption not doing so for the moment so this is + not a showstopper bug for the first release. (AIA) + + + +************* +* ntfslabel * +************* + +- Support ioctls for ntfs tng driver 2.0.? for reading/changing the label. + + + +************** +* ntfsresize * +************** + +High priority + - support fragmented volumes + - recovery support, journaling + - test suite + +Medium priority + - easy usage by partitioning tools: + - move useful things to libntfs + - extended error codes at exit() + - cleanup at exit() + - quiet operation + +Low priority + - volume enlargement + - move volume start + - support disks having bad blocks + + + +**************** +* ntfsundelete * +**************** + +- support for compressed files +- support for internationalisation +- recover by type? + + From 37676411cb5b934173bf855c817ec14bf05676d4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0151/2994] Rename: TODO.ntfstools -> TODO.ntfsprogs }(Logical change 1.23) --- TODO.ntfstools | 74 -------------------------------------------------- 1 file changed, 74 deletions(-) delete mode 100644 TODO.ntfstools diff --git a/TODO.ntfstools b/TODO.ntfstools deleted file mode 100644 index cc60befa..00000000 --- a/TODO.ntfstools +++ /dev/null @@ -1,74 +0,0 @@ -Please keep in alphabetical order so utilities are easier to find. - -Thanks, - Anton - - - -********** -* mkntfs * -********** - -- mkntfs should be hard linked with mkfs.ntfs for the mkfs utility. -- We don't know what the real last sector is, thus we mark the volume dirty - and the subsequent chkdsk (which will happen on reboot into Windows - automatically) recreates the backup boot sector if the Linux kernel lied to - us about the number of sectors. - - - -*********** -* ntfsfix * -*********** - -- Cleanup to use ntfs_attr_* API for editing $MFTMirr, $Volume, and $LogFile. - This has the immediate benefit of enabling attribute list support and making - the code simpler. -- On ntfs 3.0+ volumes need to disable the usn journal if it is active. This - means deleting file $UsnJrnl from /$Extend directory. -- On ntfs 3.0+ volumes need to mark the quota out of date? - Probably, but - it shouldn't cause any corruption not doing so for the moment so this is - not a showstopper bug for the first release. (AIA) - - - -************* -* ntfslabel * -************* - -- Support ioctls for ntfs tng driver 2.0.? for reading/changing the label. - - - -************** -* ntfsresize * -************** - -High priority - - support fragmented volumes - - recovery support, journaling - - test suite - -Medium priority - - easy usage by partitioning tools: - - move useful things to libntfs - - extended error codes at exit() - - cleanup at exit() - - quiet operation - -Low priority - - volume enlargement - - move volume start - - support disks having bad blocks - - - -**************** -* ntfsundelete * -**************** - -- support for compressed files -- support for internationalisation -- recover by type? - - From cd29ef7745a67764a1ebb413ccda496732cf14e8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0152/2994] mvdir (Logical change 1.23) --- ntfsprogs/Makefile.am | 77 + ntfsprogs/attrdef.c | 153 ++ ntfsprogs/boot.c | 218 +++ ntfsprogs/dumplog.c | 310 +++ ntfsprogs/mkntfs.8.in | 213 ++ ntfsprogs/mkntfs.c | 3554 ++++++++++++++++++++++++++++++++++ ntfsprogs/ntfsdump_logfile.c | 371 ++++ ntfsprogs/ntfsfix.8.in | 56 + ntfsprogs/ntfsfix.c | 317 +++ ntfsprogs/ntfsinfo.8.in | 25 + ntfsprogs/ntfsinfo.c | 195 ++ ntfsprogs/ntfslabel.8.in | 54 + ntfsprogs/ntfslabel.c | 247 +++ ntfsprogs/ntfsresize.8.in | 117 ++ ntfsprogs/ntfsresize.c | 914 +++++++++ ntfsprogs/ntfsundelete.8.in | 344 ++++ ntfsprogs/ntfsundelete.c | 2018 +++++++++++++++++++ ntfsprogs/ntfsundelete.h | 104 + ntfsprogs/ntfswipe.c | 732 +++++++ ntfsprogs/ntfswipe.h | 47 + ntfsprogs/sd.c | 200 ++ ntfsprogs/upcase.c | 82 + 22 files changed, 10348 insertions(+) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index e69de29b..81600372 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -0,0 +1,77 @@ +# Need this to enable 64-bit (device) file access functions and parameters. +if DEBUG +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall +else +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 +endif + +if REALLYSTATIC +AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a +AM_LFLAGS = -static +STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +else +AM_LIBS = $(top_srcdir)/libntfs/libntfs.la +AM_LFLAGS = $(all_libraries) +LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +endif + +# Workaround to make REALLYSTATIC work with automake 1.5. +LINK=$(STATIC_LINK) $(LIBTOOL_LINK) + +bin_PROGRAMS = ntfsfix ntfsinfo +sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe + +man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 \ + ntfsresize.8 +EXTRA_MANS = + +CLEANFILES = $(EXTRA_PROGRAMS) + +linux_ntfsincludedir = -I$(top_srcdir)/include + +# Set the include path. +INCLUDES = -I$(top_srcdir)/include $(all_includes) + +ntfsfix_SOURCES = ntfsfix.c +ntfsfix_LDADD = $(AM_LIBS) +ntfsfix_LDFLAGS = $(AM_LFLAGS) + +mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c +mkntfs_LDADD = $(AM_LIBS) +mkntfs_LDFLAGS = $(AM_LFLAGS) + +ntfslabel_SOURCES = ntfslabel.c +ntfslabel_LDADD = $(AM_LIBS) +ntfslabel_LDFLAGS = $(AM_LFLAGS) + +ntfsinfo_SOURCES = ntfsinfo.c +ntfsinfo_LDADD = $(AM_LIBS) +ntfsinfo_LDFLAGS = $(AM_LFLAGS) + +ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h +ntfsundelete_LDADD = $(AM_LIBS) +ntfsundelete_LDFLAGS = $(AM_LFLAGS) + +ntfsresize_SOURCES = ntfsresize.c +ntfsresize_LDADD = $(AM_LIBS) +ntfsresize_LDFLAGS = $(AM_LFLAGS) + +# We don't distribute these + +ntfswipe_SOURCES = ntfswipe.c ntfswipe.h +ntfswipe_LDADD = $(AM_LIBS) +ntfswipe_LDFLAGS = $(AM_LFLAGS) + +ntfsdump_logfile_SOURCES= ntfsdump_logfile.c +ntfsdump_logfile_LDADD = $(AM_LIBS) +ntfsdump_logfile_LDFLAGS= $(AM_LFLAGS) + +dumplog_SOURCES = dumplog.c +dumplog_LDADD = $(AM_LIBS) +dumplog_LDFLAGS = $(AM_LFLAGS) + +# Extra targets + +strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) + $(STRIP) $^ diff --git a/ntfsprogs/attrdef.c b/ntfsprogs/attrdef.c index e69de29b..c9bb82c6 100644 --- a/ntfsprogs/attrdef.c +++ b/ntfsprogs/attrdef.c @@ -0,0 +1,153 @@ +const unsigned char attrdef_ntfs12_array[2400] = { + 36, 0, 83, 0, 84, 0, 65, 0, 78, 0, 68, 0, 65, 0, 82, 0, + 68, 0, 95, 0, 73, 0, 78, 0, 70, 0, 79, 0, 82, 0, 77, 0, + 65, 0, 84, 0, 73, 0, 79, 0, 78, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, + 48, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 65, 0, 84, 0, 84, 0, 82, 0, 73, 0, 66, 0, 85, 0, + 84, 0, 69, 0, 95, 0, 76, 0, 73, 0, 83, 0, 84, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 70, 0, 73, 0, 76, 0, 69, 0, 95, 0, 78, 0, 65, 0, + 77, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, + 68, 0, 0, 0, 0, 0, 0, 0, 66, 2, 0, 0, 0, 0, 0, 0, + 36, 0, 86, 0, 79, 0, 76, 0, 85, 0, 77, 0, 69, 0, 95, 0, + 86, 0, 69, 0, 82, 0, 83, 0, 73, 0, 79, 0, 78, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, + 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 83, 0, 69, 0, 67, 0, 85, 0, 82, 0, 73, 0, 84, 0, + 89, 0, 95, 0, 68, 0, 69, 0, 83, 0, 67, 0, 82, 0, 73, 0, + 80, 0, 84, 0, 79, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 86, 0, 79, 0, 76, 0, 85, 0, 77, 0, 69, 0, 95, 0, + 78, 0, 65, 0, 77, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, + 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, + 36, 0, 86, 0, 79, 0, 76, 0, 85, 0, 77, 0, 69, 0, 95, 0, + 73, 0, 78, 0, 70, 0, 79, 0, 82, 0, 77, 0, 65, 0, 84, 0, + 73, 0, 79, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 68, 0, 65, 0, 84, 0, 65, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 73, 0, 78, 0, 68, 0, 69, 0, 88, 0, 95, 0, 82, 0, + 79, 0, 79, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 73, 0, 78, 0, 68, 0, 69, 0, 88, 0, 95, 0, 65, 0, + 76, 0, 76, 0, 79, 0, 67, 0, 65, 0, 84, 0, 73, 0, 79, 0, + 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 66, 0, 73, 0, 84, 0, 77, 0, 65, 0, 80, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 83, 0, 89, 0, 77, 0, 66, 0, 79, 0, 76, 0, 73, 0, + 67, 0, 95, 0, 76, 0, 73, 0, 78, 0, 75, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, + 36, 0, 69, 0, 65, 0, 95, 0, 73, 0, 78, 0, 70, 0, 79, 0, + 82, 0, 77, 0, 65, 0, 84, 0, 73, 0, 79, 0, 78, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, + 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 69, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + diff --git a/ntfsprogs/boot.c b/ntfsprogs/boot.c index e69de29b..b47ded9c 100644 --- a/ntfsprogs/boot.c +++ b/ntfsprogs/boot.c @@ -0,0 +1,218 @@ +/* The first 3429 bytes of $Boot. The rest is just zero. Total 8192 bytes. */ +const unsigned char boot_array[3429] = { +235, 91, 144, 78, 84, 70, 83, 32, 32, 32, 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 51, 192, +142, 208, 188, 0, 124, 251, 184, 192, 7, 142, 216, 199, 6, 84, 0, 0, + 0, 199, 6, 86, 0, 0, 0, 199, 6, 91, 0, 16, 0, 184, 0, 13, +142, 192, 43, 219, 232, 7, 0, 104, 0, 13, 104, 102, 2, 203, 80, 83, + 81, 82, 6, 102, 161, 84, 0, 102, 3, 6, 28, 0, 102, 51, 210, 102, + 15, 183, 14, 24, 0, 102, 247, 241, 254, 194, 136, 22, 90, 0, 102, 139, +208, 102, 193, 234, 16, 247, 54, 26, 0, 136, 22, 37, 0, 163, 88, 0, +161, 24, 0, 42, 6, 90, 0, 64, 59, 6, 91, 0, 118, 3, 161, 91, + 0, 80, 180, 2, 139, 22, 88, 0, 177, 6, 210, 230, 10, 54, 90, 0, +139, 202, 134, 233, 138, 54, 37, 0, 178, 128, 205, 19, 88, 114, 42, 1, + 6, 84, 0, 131, 22, 86, 0, 0, 41, 6, 91, 0, 118, 11, 193, 224, + 5, 140, 194, 3, 208, 142, 194, 235, 138, 7, 90, 89, 91, 88, 195, 190, + 89, 1, 235, 8, 190, 227, 1, 235, 3, 190, 57, 1, 232, 9, 0, 190, +173, 1, 232, 3, 0, 251, 235, 254, 172, 60, 0, 116, 9, 180, 14, 187, + 7, 0, 205, 16, 235, 242, 195, 29, 0, 65, 32, 100, 105, 115, 107, 32, +114, 101, 97, 100, 32, 101, 114, 114, 111, 114, 32, 111, 99, 99, 117, 114, +114, 101, 100, 46, 13, 10, 0, 41, 0, 65, 32, 107, 101, 114, 110, 101, +108, 32, 102, 105, 108, 101, 32, 105, 115, 32, 109, 105, 115, 115, 105, 110, +103, 32, 102, 114, 111, 109, 32, 116, 104, 101, 32, 100, 105, 115, 107, 46, + 13, 10, 0, 37, 0, 65, 32, 107, 101, 114, 110, 101, 108, 32, 102, 105, +108, 101, 32, 105, 115, 32, 116, 111, 111, 32, 100, 105, 115, 99, 111, 110, +116, 105, 103, 117, 111, 117, 115, 46, 13, 10, 0, 51, 0, 73, 110, 115, +101, 114, 116, 32, 97, 32, 115, 121, 115, 116, 101, 109, 32, 100, 105, 115, +107, 101, 116, 116, 101, 32, 97, 110, 100, 32, 114, 101, 115, 116, 97, 114, +116, 13, 10, 116, 104, 101, 32, 115, 121, 115, 116, 101, 109, 46, 13, 10, + 0, 23, 0, 92, 78, 84, 76, 68, 82, 32, 105, 115, 32, 99, 111, 109, +112, 114, 101, 115, 115, 101, 100, 46, 13, 10, 0, 0, 0, 0, 85, 170, + 5, 0, 78, 0, 84, 0, 76, 0, 68, 0, 82, 0, 4, 0, 36, 0, + 73, 0, 51, 0, 48, 0, 0, 224, 0, 0, 0, 48, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 140, 200, 142, 216, 193, 224, 4, 250, 139, 224, +251, 102, 15, 183, 6, 11, 0, 102, 15, 182, 30, 13, 0, 102, 247, 227, +102, 163, 78, 2, 102, 139, 14, 64, 0, 128, 249, 0, 15, 143, 14, 0, +246, 217, 102, 184, 1, 0, 0, 0, 102, 211, 224, 235, 8, 144, 102, 161, + 78, 2, 102, 247, 225, 102, 163, 82, 2, 102, 15, 183, 30, 11, 0, 102, + 51, 210, 102, 247, 243, 102, 163, 86, 2, 232, 44, 4, 102, 139, 14, 74, + 2, 102, 137, 14, 34, 2, 102, 3, 14, 82, 2, 102, 137, 14, 38, 2, +102, 3, 14, 82, 2, 102, 137, 14, 42, 2, 102, 3, 14, 82, 2, 102, +137, 14, 58, 2, 102, 3, 14, 82, 2, 102, 137, 14, 66, 2, 102, 184, +144, 0, 0, 0, 102, 139, 14, 34, 2, 232, 65, 9, 102, 11, 192, 15, +132, 22, 254, 102, 163, 46, 2, 102, 184, 160, 0, 0, 0, 102, 139, 14, + 38, 2, 232, 40, 9, 102, 163, 50, 2, 102, 184, 176, 0, 0, 0, 102, +139, 14, 42, 2, 232, 22, 9, 102, 163, 54, 2, 102, 161, 46, 2, 102, + 11, 192, 15, 132, 227, 253, 103, 128, 120, 8, 0, 15, 133, 218, 253, 103, +102, 141, 80, 16, 103, 3, 66, 4, 103, 102, 15, 182, 72, 12, 102, 137, + 14, 94, 2, 103, 102, 139, 72, 8, 102, 137, 14, 90, 2, 102, 161, 90, + 2, 102, 15, 183, 14, 11, 0, 102, 51, 210, 102, 247, 241, 102, 163, 98, + 2, 102, 161, 66, 2, 102, 3, 6, 90, 2, 102, 163, 70, 2, 102, 131, + 62, 50, 2, 0, 15, 132, 25, 0, 102, 131, 62, 54, 2, 0, 15, 132, +135, 253, 102, 139, 30, 54, 2, 30, 7, 102, 139, 62, 70, 2, 232, 177, + 1, 102, 15, 183, 14, 0, 2, 102, 184, 2, 2, 0, 0, 232, 153, 6, +102, 11, 192, 15, 132, 88, 253, 103, 102, 139, 0, 30, 7, 102, 139, 62, + 58, 2, 232, 209, 4, 102, 161, 58, 2, 102, 187, 128, 0, 0, 0, 102, +185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, 203, 0, 102, 11, +192, 15, 132, 42, 253, 103, 102, 15, 183, 88, 12, 102, 129, 227, 255, 0, + 0, 0, 15, 133, 30, 253, 102, 139, 216, 104, 0, 32, 7, 102, 43, 255, +232, 79, 1, 138, 22, 36, 0, 184, 232, 3, 142, 192, 141, 54, 11, 0, + 43, 192, 104, 0, 32, 80, 203, 80, 83, 81, 82, 6, 255, 54, 91, 0, +255, 54, 84, 0, 255, 54, 86, 0, 139, 195, 193, 232, 4, 140, 193, 3, +193, 37, 255, 15, 45, 0, 16, 247, 216, 139, 14, 91, 0, 193, 225, 5, + 81, 59, 193, 118, 2, 139, 193, 80, 193, 232, 5, 163, 91, 0, 232, 61, +252, 88, 89, 43, 200, 118, 11, 140, 194, 3, 208, 142, 194, 184, 0, 16, +235, 222, 143, 6, 86, 0, 143, 6, 84, 0, 143, 6, 91, 0, 7, 90, + 89, 91, 88, 195, 6, 30, 102, 96, 102, 139, 218, 102, 15, 182, 14, 13, + 0, 102, 247, 225, 102, 163, 84, 0, 102, 139, 195, 102, 247, 225, 163, 91, + 0, 139, 223, 131, 227, 15, 140, 192, 102, 193, 239, 4, 3, 199, 80, 7, +232, 116, 255, 102, 97, 144, 31, 7, 195, 103, 3, 64, 20, 103, 102, 131, + 56, 255, 15, 132, 76, 0, 103, 102, 57, 24, 15, 133, 51, 0, 102, 11, +201, 15, 133, 10, 0, 103, 128, 120, 9, 0, 15, 133, 35, 0, 195, 103, + 58, 72, 9, 15, 133, 26, 0, 102, 139, 240, 103, 3, 112, 10, 232, 61, + 5, 102, 81, 30, 7, 102, 139, 250, 243, 167, 102, 89, 15, 133, 1, 0, +195, 103, 102, 131, 120, 4, 0, 15, 132, 7, 0, 103, 102, 3, 64, 4, +235, 171, 102, 43, 192, 195, 102, 139, 243, 232, 18, 5, 103, 102, 3, 0, +103, 247, 64, 12, 2, 0, 15, 133, 52, 0, 103, 102, 141, 80, 16, 103, + 58, 74, 64, 15, 133, 24, 0, 103, 102, 141, 114, 66, 232, 239, 4, 102, + 81, 30, 7, 102, 139, 251, 243, 167, 102, 89, 15, 133, 1, 0, 195, 103, +131, 120, 8, 0, 15, 132, 6, 0, 103, 3, 64, 8, 235, 194, 102, 51, +192, 195, 103, 128, 123, 8, 0, 15, 133, 28, 0, 6, 30, 102, 96, 103, +102, 141, 83, 16, 103, 102, 139, 10, 102, 139, 243, 103, 3, 114, 4, 243, +164, 102, 97, 144, 31, 7, 195, 103, 102, 141, 83, 16, 103, 102, 139, 74, + 8, 102, 65, 102, 43, 192, 232, 1, 0, 195, 6, 30, 102, 96, 103, 128, +123, 8, 1, 15, 132, 3, 0, 233, 127, 251, 102, 131, 249, 0, 15, 133, + 6, 0, 102, 97, 144, 31, 7, 195, 102, 83, 102, 80, 102, 81, 102, 87, + 6, 232, 87, 3, 102, 139, 209, 7, 102, 95, 102, 89, 102, 59, 202, 15, +141, 3, 0, 102, 139, 209, 232, 171, 254, 102, 43, 202, 102, 139, 218, 102, +139, 194, 102, 15, 182, 22, 13, 0, 102, 247, 226, 102, 15, 183, 22, 11, + 0, 102, 247, 226, 102, 3, 248, 102, 88, 102, 3, 195, 102, 91, 235, 170, + 6, 30, 102, 96, 103, 128, 123, 8, 1, 15, 132, 3, 0, 233, 25, 251, +102, 131, 249, 0, 15, 133, 6, 0, 102, 97, 144, 31, 7, 195, 102, 83, +102, 80, 102, 81, 102, 87, 6, 102, 81, 102, 51, 210, 102, 15, 182, 14, + 13, 0, 102, 247, 241, 102, 82, 232, 225, 2, 102, 15, 182, 30, 13, 0, +102, 247, 227, 102, 90, 102, 3, 194, 102, 80, 102, 15, 182, 6, 13, 0, +102, 247, 225, 102, 139, 208, 102, 88, 102, 89, 7, 102, 95, 102, 89, 102, + 59, 202, 15, 141, 3, 0, 102, 139, 209, 102, 163, 84, 0, 137, 22, 91, + 0, 6, 30, 102, 96, 139, 223, 131, 227, 15, 140, 192, 102, 193, 239, 4, + 3, 199, 80, 7, 232, 160, 253, 102, 97, 144, 31, 7, 102, 43, 202, 102, +139, 218, 102, 139, 194, 102, 15, 183, 22, 11, 0, 102, 247, 226, 102, 3, +248, 102, 88, 102, 3, 195, 102, 91, 233, 101, 255, 6, 30, 102, 96, 38, +103, 102, 15, 183, 95, 4, 38, 103, 102, 15, 183, 79, 6, 102, 11, 201, + 15, 132, 101, 250, 102, 3, 223, 102, 131, 195, 2, 102, 129, 199, 254, 1, + 0, 0, 102, 73, 102, 11, 201, 15, 132, 23, 0, 38, 103, 139, 3, 38, +103, 137, 7, 102, 131, 195, 2, 102, 129, 199, 0, 2, 0, 0, 102, 73, +235, 226, 102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 184, 1, 0, + 0, 0, 102, 163, 30, 2, 102, 161, 26, 2, 102, 3, 6, 82, 2, 102, +163, 74, 2, 102, 161, 48, 0, 102, 15, 182, 30, 13, 0, 102, 247, 227, +102, 163, 84, 0, 102, 161, 86, 2, 163, 91, 0, 102, 139, 30, 26, 2, + 30, 7, 232, 242, 252, 102, 15, 183, 251, 232, 111, 255, 102, 161, 26, 2, +102, 187, 32, 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, + 0, 0, 232, 100, 253, 102, 11, 192, 15, 132, 87, 0, 102, 139, 216, 30, + 7, 102, 139, 62, 22, 2, 232, 249, 253, 102, 139, 30, 22, 2, 103, 102, +129, 59, 128, 0, 0, 0, 15, 132, 6, 0, 103, 3, 91, 4, 235, 238, +103, 102, 129, 59, 128, 0, 0, 0, 15, 133, 39, 0, 102, 83, 103, 102, +139, 67, 16, 102, 139, 62, 74, 2, 30, 7, 232, 9, 1, 102, 91, 102, +161, 82, 2, 102, 1, 6, 74, 2, 102, 255, 6, 30, 2, 103, 3, 91, + 4, 235, 205, 102, 97, 144, 31, 7, 195, 102, 139, 208, 102, 139, 14, 30, + 2, 102, 161, 26, 2, 102, 82, 102, 80, 102, 81, 102, 82, 102, 187, 128, + 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, +215, 252, 102, 11, 192, 15, 132, 64, 249, 102, 139, 216, 102, 88, 232, 42, + 1, 102, 11, 192, 15, 132, 7, 0, 102, 91, 102, 91, 102, 91, 195, 102, + 89, 102, 88, 102, 90, 102, 3, 6, 82, 2, 226, 185, 102, 51, 192, 195, + 6, 30, 102, 96, 102, 80, 102, 81, 102, 51, 210, 102, 15, 182, 30, 13, + 0, 102, 247, 243, 102, 82, 232, 144, 255, 102, 11, 192, 15, 132, 249, 248, +102, 15, 182, 30, 13, 0, 102, 247, 227, 102, 90, 102, 3, 194, 102, 163, + 84, 0, 102, 89, 102, 15, 182, 30, 13, 0, 102, 59, 203, 15, 142, 19, + 0, 137, 30, 91, 0, 102, 43, 203, 102, 88, 102, 3, 195, 102, 80, 102, + 81, 235, 20, 144, 102, 88, 102, 3, 193, 102, 80, 137, 14, 91, 0, 102, +185, 0, 0, 0, 0, 102, 81, 6, 102, 87, 139, 223, 131, 227, 15, 140, +192, 102, 193, 239, 4, 3, 199, 80, 7, 232, 155, 251, 102, 95, 7, 102, + 3, 62, 78, 2, 102, 89, 102, 88, 102, 131, 249, 0, 15, 143, 116, 255, +102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 247, 38, 86, 2, 102, +139, 14, 86, 2, 232, 89, 255, 232, 241, 253, 102, 97, 144, 31, 7, 195, + 6, 30, 102, 96, 102, 247, 38, 98, 2, 102, 139, 30, 50, 2, 102, 139, + 14, 98, 2, 30, 7, 102, 139, 62, 66, 2, 232, 35, 253, 232, 203, 253, +102, 97, 144, 31, 7, 195, 102, 80, 102, 83, 102, 81, 102, 139, 30, 70, + 2, 102, 139, 200, 102, 193, 232, 3, 102, 131, 225, 7, 102, 3, 216, 102, +184, 1, 0, 0, 0, 102, 211, 224, 103, 132, 3, 15, 132, 4, 0, 248, +235, 2, 144, 249, 102, 89, 102, 91, 102, 88, 195, 103, 128, 123, 8, 1, + 15, 132, 4, 0, 102, 43, 192, 195, 103, 102, 141, 115, 16, 103, 102, 139, + 86, 8, 102, 59, 194, 15, 135, 11, 0, 103, 102, 139, 22, 102, 59, 194, + 15, 131, 4, 0, 102, 43, 192, 195, 103, 3, 94, 16, 102, 43, 246, 103, +128, 59, 0, 15, 132, 62, 0, 232, 129, 0, 102, 3, 241, 232, 57, 0, +102, 3, 202, 102, 59, 193, 15, 140, 33, 0, 102, 139, 209, 102, 80, 103, +102, 15, 182, 11, 102, 139, 193, 102, 131, 224, 15, 102, 193, 233, 4, 102, + 3, 217, 102, 3, 216, 102, 67, 102, 88, 235, 196, 102, 43, 200, 102, 43, +194, 102, 3, 198, 195, 102, 43, 192, 195, 102, 43, 201, 103, 138, 11, 128, +225, 15, 102, 131, 249, 0, 15, 133, 4, 0, 102, 43, 201, 195, 102, 83, +102, 82, 102, 3, 217, 103, 102, 15, 190, 19, 102, 73, 102, 75, 102, 131, +249, 0, 15, 132, 13, 0, 102, 193, 226, 8, 103, 138, 19, 102, 75, 102, + 73, 235, 235, 102, 139, 202, 102, 90, 102, 91, 195, 102, 83, 102, 82, 102, + 43, 210, 103, 138, 19, 102, 131, 226, 15, 102, 43, 201, 103, 138, 11, 192, +233, 4, 102, 131, 249, 0, 15, 133, 8, 0, 102, 43, 201, 102, 90, 102, + 91, 195, 102, 3, 218, 102, 3, 217, 103, 102, 15, 190, 19, 102, 73, 102, + 75, 102, 131, 249, 0, 15, 132, 13, 0, 102, 193, 226, 8, 103, 138, 19, +102, 75, 102, 73, 235, 235, 102, 139, 202, 102, 90, 102, 91, 195, 102, 11, +201, 15, 133, 1, 0, 195, 102, 81, 102, 86, 103, 131, 62, 97, 15, 140, + 12, 0, 103, 131, 62, 122, 15, 143, 4, 0, 103, 131, 46, 32, 102, 131, +198, 2, 226, 230, 102, 94, 102, 89, 195, 102, 80, 102, 81, 102, 139, 208, +102, 161, 46, 2, 103, 102, 141, 88, 16, 103, 3, 67, 4, 103, 102, 141, + 64, 16, 102, 139, 218, 232, 158, 250, 102, 11, 192, 15, 132, 5, 0, 102, + 89, 102, 89, 195, 102, 161, 50, 2, 102, 11, 192, 15, 133, 8, 0, 102, + 89, 102, 89, 102, 51, 192, 195, 102, 139, 22, 50, 2, 103, 102, 141, 82, + 16, 103, 102, 139, 66, 8, 102, 64, 102, 139, 30, 78, 2, 102, 247, 227, +102, 51, 210, 102, 247, 54, 90, 2, 102, 80, 102, 88, 102, 11, 192, 15, +132, 48, 0, 102, 72, 102, 80, 232, 28, 254, 114, 238, 232, 241, 253, 102, + 90, 102, 89, 102, 91, 102, 83, 102, 81, 102, 82, 102, 161, 66, 2, 103, +102, 141, 64, 24, 232, 47, 250, 102, 11, 192, 116, 206, 102, 89, 102, 89, +102, 89, 195, 102, 89, 102, 89, 102, 51, 192, 195, 6, 30, 102, 96, 102, +139, 54, 66, 2, 102, 185, 32, 0, 0, 0, 102, 247, 193, 3, 0, 0, + 0, 15, 133, 3, 0, 232, 13, 0, 102, 173, 232, 105, 0, 226, 235, 102, + 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 51, 192, 102, 51, 219, 176, + 13, 180, 14, 187, 7, 0, 205, 16, 176, 10, 180, 14, 187, 7, 0, 205, + 16, 102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 11, 201, 15, 133, + 9, 0, 232, 208, 255, 102, 97, 144, 31, 7, 195, 102, 51, 192, 102, 51, +219, 173, 180, 14, 187, 7, 0, 205, 16, 226, 240, 232, 183, 255, 102, 97, +144, 31, 7, 195, 96, 172, 60, 0, 116, 9, 180, 14, 187, 7, 0, 205, + 16, 235, 242, 97, 144, 195, 6, 30, 102, 96, 102, 185, 8, 0, 0, 0, +102, 139, 208, 102, 131, 226, 15, 102, 82, 102, 193, 232, 4, 226, 241, 102, +185, 8, 0, 0, 0, 102, 88, 102, 131, 248, 9, 15, 143, 7, 0, 102, +131, 192, 48, 235, 9, 144, 102, 131, 232, 10, 102, 131, 192, 65, 102, 51, +219, 180, 14, 187, 7, 0, 205, 16, 226, 219, 176, 32, 180, 14, 187, 7, + 0, 205, 16, 102, 97, 144, 31, 7, 232, 96, 0, 195, 6, 30, 102, 96, +102, 190, 22, 13, 0, 0, 232, 79, 245, 102, 97, 144, 31, 7, 195, 6, + 30, 102, 96, 102, 190, 38, 13, 0, 0, 232, 60, 245, 102, 97, 144, 31, + 7, 195, 6, 30, 102, 96, 102, 190, 54, 13, 0, 0, 232, 41, 245, 102, + 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 190, 70, 13, 0, 0, 232, + 22, 245, 102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 190, 86, 13, + 0, 0, 232, 3, 245, 102, 97, 144, 31, 7, 195, 102, 80, 102, 184, 0, + 0, 245, 255, 102, 64, 102, 11, 192, 117, 249, 102, 88, 195, 102, 81, 102, + 80, 102, 184, 5, 0, 0, 0, 30, 7, 102, 139, 249, 232, 71, 252, 102, +139, 193, 102, 91, 102, 83, 102, 15, 183, 14, 12, 2, 102, 186, 14, 2, + 0, 0, 232, 68, 248, 102, 91, 102, 89, 102, 11, 192, 15, 133, 47, 0, +102, 139, 193, 102, 139, 203, 102, 80, 102, 83, 232, 35, 0, 102, 91, 102, + 95, 102, 11, 192, 15, 132, 23, 0, 30, 7, 232, 9, 252, 102, 139, 199, +102, 15, 183, 14, 12, 2, 102, 186, 14, 2, 0, 0, 232, 10, 248, 195, +102, 81, 102, 187, 32, 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, + 0, 0, 0, 0, 232, 242, 247, 102, 11, 192, 15, 132, 82, 0, 102, 139, +216, 30, 7, 102, 139, 62, 22, 2, 232, 135, 248, 30, 7, 102, 139, 30, + 22, 2, 102, 89, 38, 102, 57, 15, 15, 132, 46, 0, 38, 102, 131, 63, +255, 15, 132, 45, 0, 38, 131, 127, 4, 0, 15, 132, 36, 0, 38, 102, + 15, 183, 71, 4, 3, 216, 139, 195, 37, 0, 128, 116, 215, 140, 192, 5, + 0, 8, 142, 192, 129, 227, 255, 127, 235, 202, 38, 102, 139, 71, 16, 195, +102, 89, 102, 51, 192, 195, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, +116, 32, 48, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, +116, 32, 49, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, +116, 32, 50, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, +116, 32, 51, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, +116, 32, 52, 13, 10 }; + diff --git a/ntfsprogs/dumplog.c b/ntfsprogs/dumplog.c index e69de29b..1a730c97 100644 --- a/ntfsprogs/dumplog.c +++ b/ntfsprogs/dumplog.c @@ -0,0 +1,310 @@ +const char *EXEC_NAME = "dumplog"; +const char *EXEC_VERSION = "1.0"; +/* + * $Id$ + * + * DumpLog - Part of the Linux-NTFS project. + * + * Copyright (c) 2000,2001 Anton Altaparmakov. + * + * This utility will interpret the contents of the journal ($LogFile) specified + * on the command line and display the results on stdout. Errors will be output + * to stderr. + * + * Anton Altaparmakov + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS source + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "types.h" +#include "mst.h" +#include "logfile.h" + +int main(int argc, char **argv) +{ + s64 l, br; + unsigned char *lfd = NULL; + RESTART_PAGE_HEADER *rph; + RESTART_AREA *rr; + RESTART_CLIENT *cr; + RECORD_PAGE_HEADER *rcrd_ph; + LOG_RECORD *lr; + int pass = 1; + int i, lps, client; + int f = 0; + char zero[4096]; + struct stat sbuf; + + memset(zero, 0, sizeof(zero)); + printf("\n"); + if (argc != 2) { + printf("%s v%s - Interpret and display information about the " + "journal\ngiven on the command line.\n\n" + /* Generic copyright / disclaimer. */ + "Copyright (c) 2001 Anton Altaparmakov.\n\n" + "%s is free software, released under the GNU " + "General Public License\nand you are welcome to " + "redistribute it under certain conditions.\n" + "%s comes with ABSOLUTELY NO WARRANTY; for details " + "read the GNU\nGeneral Public License to be found " + "in the file COPYING in the main Linux-NTFS\n" + "distribution directory.\n\n" + /* Generic part ends here. */ + "Syntax: dumplog log_file_name\n" + " e.g. dumplog /mnt/ntfstest/\\$LogFile\n\n", + EXEC_NAME, EXEC_VERSION, EXEC_NAME, EXEC_NAME); + fprintf(stderr, "Error: incorrect syntax\n"); + exit(1); + } + if (stat(argv[1], &sbuf) == -1) { + if (errno == ENOENT) + fprintf(stderr, "The file doesn't exist; did you " + "specify it correctly?\n"); + else + fprintf(stderr, "Error getting information about %s: " + "%s\n", argv[1], strerror(errno)); + exit(1); + } + f = open(argv[1], O_RDONLY); + if (f == -1) { + perror("Couldn't open file"); + exit(1); + } + l = sbuf.st_size; + if (l > 0x400000LL) { + printf("Only analysing the first four megabytes of the " + "logfile (real size = 0x%Lx).\n", + (unsigned long long)l); + l = 0x400000LL; + } + lfd = (unsigned char*)calloc(1, l); + if (!lfd) { + perror("Couldn't allocate internal buffer"); + goto log_file_error; + } + /* Read in the $LogFile into the buffer. */ + if ((br = read(f, lfd, l)) == -1) { + perror("Couldn't read file"); + goto log_file_error; + } + /* Valid data length in buffer. */ + l = min(br, l); + /* Check restart area. */ + if (!is_rstr_recordp(lfd)) { + s64 _l; + + for (_l = 0LL; _l < l; _l++) + if (lfd[_l] != (unsigned char)-1) + break; + if (_l < l) + puts("Logfile contents are corrupt (magic RSTR " + "missing)!"); + else + puts("Logfile is empty."); + goto log_file_error; + } + /* Do the interpretation and display now. */ + rph = (RESTART_PAGE_HEADER*)lfd; + lps = le32_to_cpu(rph->log_page_size); +pass_loc: + if (ntfs_post_read_mst_fixup((NTFS_RECORD*)rph, lps) || + is_baad_record(rph->magic)) { + puts("Logfile incomplete multi sector transfer detected! " + "Cannot handle this yet!"); + goto log_file_error; + } + if ((pass == 2) && !memcmp(lfd, rph, lps)) { + printf("2nd restart area fully matches the 1st one. Skipping " + "display.\n"); + goto skip_rstr_pass; + } + if (le16_to_cpu(rph->major_ver != 1) || + le16_to_cpu(rph->minor_ver != 1)) { + fprintf(stderr, "$LogFile version %i.%i! Error: Unknown " + "$LogFile version!\n", + le16_to_cpu(rph->major_ver), + le16_to_cpu(rph->minor_ver)); + goto log_file_error; + } + rr = (RESTART_AREA*)((char*)rph + le16_to_cpu(rph->restart_offset)); + cr = (RESTART_CLIENT*)((char*)rr + + le16_to_cpu(rr->client_array_offset)); + /* Dump of the interpreted $LogFile restart area. */ + if (pass == 1) + printf("\n$LogFile version %i.%i.\n", + le16_to_cpu(rph->major_ver), + le16_to_cpu(rph->minor_ver)); + printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); + printf("magic = RSTR\n"); + printf("ChkDskLsn = 0x%Lx\n", sle64_to_cpu(rph->chkdsk_lsn)); + printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); + printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); + printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); + printf("\n(1st) restart record:\n"); + printf("CurrentLsn = %Lx\n", sle64_to_cpu(rr->current_lsn)); + printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); + printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); + printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); + printf("Flags = 0x%x\n", le16_to_cpu(rr->flags)); + printf("SeqNumberBits = %u (0x%x)\n", le32_to_cpu(rr->seq_number_bits), + le32_to_cpu(rr->seq_number_bits)); + printf("RestartAreaLength = 0x%x\n", + le16_to_cpu(rr->restart_area_length)); + printf("ClientArrayOffset = 0x%x\n", + le16_to_cpu(rr->client_array_offset)); + printf("FileSize = %Lu (0x%Lx)\n", le64_to_cpu(rr->file_size), + le64_to_cpu(rr->file_size)); + printf("LastLsnDataLength = 0x%x\n", + le32_to_cpu(rr->last_lsn_data_length)); + printf("RecordLength = 0x%x\n", le16_to_cpu(rr->record_length)); + printf("LogPageDataOffset = 0x%x\n", + le16_to_cpu(rr->log_page_data_offset)); + for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { + printf("\nRestart client record number %i:\n", client); + printf("OldestLsn = 0x%Lx\n", sle64_to_cpu(cr->oldest_lsn)); + printf("ClientRestartLsn = 0x%Lx\n", + sle64_to_cpu(cr->client_restart_lsn)); + printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); + printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); + printf("SeqNumber = 0x%Lx\n", le64_to_cpu(cr->seq_number)); + printf("ClientNameLength = 0x%x\n", + le32_to_cpu(cr->client_name_length)); + if (le32_to_cpu(cr->client_name_length)) { + // convert to ascii and print out. + // printf("ClientName = %u\n", le16_to_cpu(cr->client_name)); + } + /* Size of a restart client record is fixed at 0xa0 bytes. */ + cr = (RESTART_CLIENT*)((char*)cr + 0xa0); + } +skip_rstr_pass: + if (pass == 1) { + rph = (RESTART_PAGE_HEADER*)((char*)rph + lps); + ++pass; + goto pass_loc; + } + rcrd_ph = (RECORD_PAGE_HEADER*)rph; + /* Reuse pass for log record clienter. */ + pass = 0; + printf("\nFinished with restart area. Beginning with log area.\n"); +rcrd_pass_loc: + rcrd_ph = (RECORD_PAGE_HEADER*)((char*)rcrd_ph + lps); + if ((char*)rcrd_ph + lps > (char*)lfd + l) + goto end_of_rcrd_passes; + printf("\nLog record page number %i", pass); + if (!is_rcrd_record(rcrd_ph->magic)) { + for (i = 0; i < lps; i++) + if (((char*)rcrd_ph)[i] != (char)-1) + break; + if (i < lps) + puts(" is corrupt (magic RCRD is missing)."); + else + puts(" is empty."); + pass++; + goto rcrd_pass_loc; + } else + printf(":"); + /* Dump log record page */ + printf("\nmagic = RCRD\n"); + printf("copy.last_lsn/file_offset = 0x%Lx\n", + le64_to_cpu(rcrd_ph->copy.last_lsn)); + printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); + printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); + printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); + printf("header.next_record_offset = 0x%Lx\n", + le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); + printf("header.last_end_lsn = 0x%Lx\n", + le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); + /* + * Where does the 0x40 come from? Is it just usa_offset + + * usa_client * 2 + 7 & ~7 or is it derived from somewhere? + */ + lr = (LOG_RECORD*)((char*)rcrd_ph + 0x40); + client = 0; +log_record_pass: + printf("\nLog record %i:\n", client); + printf("this lsn = 0x%Lx\n", le64_to_cpu(lr->this_lsn)); + printf("client previous lsn = 0x%Lx\n", + le64_to_cpu(lr->client_previous_lsn)); + printf("client undo next lsn = 0x%Lx\n", + le64_to_cpu(lr->client_undo_next_lsn)); + printf("client data length = 0x%x\n", + le32_to_cpu(lr->client_data_length)); + printf("client_id.seq_number = 0x%x\n", + le16_to_cpu(lr->client_id.seq_number)); + printf("client_id.client_index = 0x%x\n", + le16_to_cpu(lr->client_id.client_index)); + printf("record type = 0x%x\n", le32_to_cpu(lr->record_type)); + printf("transaction_id = 0x%x\n", le32_to_cpu(lr->transaction_id)); + printf("flags = 0x%x:", lr->flags); + if (!lr->flags) + printf(" NONE\n"); + else { + int _b = 0; + + if (lr->flags & LOG_RECORD_MULTI_PAGE) { + printf(" LOG_RECORD_MULTI_PAGE"); + _b = 1; + } + if (lr->flags & ~LOG_RECORD_MULTI_PAGE) { + if (_b) + printf(" |"); + printf(" Unknown flags"); + } + printf("\n"); + } + printf("redo_operation = 0x%x\n", le16_to_cpu(lr->redo_operation)); + printf("undo_operation = 0x%x\n", le16_to_cpu(lr->undo_operation)); + printf("redo_offset = 0x%x\n", le16_to_cpu(lr->redo_offset)); + printf("redo_length = 0x%x\n", le16_to_cpu(lr->redo_length)); + printf("undo_offset = 0x%x\n", le16_to_cpu(lr->undo_offset)); + printf("undo_length = 0x%x\n", le16_to_cpu(lr->undo_length)); + printf("target_attribute = 0x%x\n", le16_to_cpu(lr->target_attribute)); + printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); + printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); + printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); + printf("target_vcn = 0x%Lx\n", sle64_to_cpu(lr->target_vcn)); + if (le16_to_cpu(lr->lcns_to_follow) > 0) + printf("Array of lcns:\n"); + for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) + printf("lcn_list[%i].lcn = 0x%Lx\n", i, + sle64_to_cpu(lr->lcn_list[i].lcn)); + client++; + lr = (LOG_RECORD*)((char*)lr + 0x70); + if (((char*)lr + 0x70 <= (char*)rcrd_ph + + le64_to_cpu(rcrd_ph->header.packed.next_record_offset))) + goto log_record_pass; + pass++; + goto rcrd_pass_loc; +end_of_rcrd_passes: +log_file_error: + printf("\n"); + /* Set return code to 0. */ + i = 0; + if (lfd) + free(lfd); + if (f) + close(f); + return i; +} + diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index e69de29b..6916396d 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -0,0 +1,213 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2001,2002 Anton Altaparmakov. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" Adapted from e2fsprogs-1.19/misc/mke2fs.8.in by Theodore Ts'o. +.\" +.TH MKNTFS 8 "March 2002" "Linux-NTFS version @VERSION@" +.SH NAME +mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system +.SH SYNOPSIS +.B mkntfs +[ +.B \-s +.I sector-size +] +[ +.B \-c +.I cluster-size +] +[ +.B \-L +.I volume-label +] +[ +.B \-z +.I mft-zone-multiplier +] +[ +.B \-f +| +.B \-Q +] +[ +.B -n +] +[ +.B \-q +] +[ +.B \-v +] +[ +.B \-vv +] +[ +.B \-C +] +[ +.B \-F +] +[ +.B \-I +] +[ +.B \-V +] +.I device +[ +.I number-of-sectors +] +.SH DESCRIPTION +.B mkntfs +is used to create a NTFS 1.2 (Windows NT 4.0) file system on a device (usually +a disk partition). +.I device +is the special file corresponding to the device (e.g +.IR /dev/hdXX ). +.I number-of-sectors +is the number of blocks on the device. If omitted, +.B mkntfs +automagically figures the file system size. +.SH OPTIONS +.TP +.BI \-s " sector-size" +Specify the size of sectors in bytes. Valid sector size values are 256, 512, +1024, 2048 and 4096 bytes per sector. If omitted, +.B mkntfs +.I sector-size +is determined automatically and if that fails a default of 512 +bytes per sector is used. +.TP +.BI \-c " cluster-size" +Specify the size of clusters in bytes. Valid cluster size values are powers of +two, with at least 256, and at most 65536 bytes per cluster. If omitted, +.B mkntfs +.I cluster-size +is determined by the volume size. The value is determined as +follows: +.TS +lB lB lB +l l r. +Volume size Default cluster +0 - 512MB 512 bytes +512MB - 1GB 1024 bytes +1GB - 2GB 2048 bytes +2GB + 4096 bytes +.TE + +Note that the default cluster size is set to be at least equal to the sector +size as a cluster cannot be smaller than a sector. Also, note that values +greater than 4096 have the side effect that compression is disabled on the +volume (due to limitations in the NTFS compression algorithm currently in use +by Windows). +.TP +.BI \-L " volume-label" +Set the volume label for the filesystem. +.TP +.BI \-z " mft-zone-multiplier" +Set the MFT zone multiplier, which determines the size of the MFT zone to use +on the volume. The MFT zone is the area at the beginning of the volume reserved +for the master file table (MFT), which stores the on disk inodes (MFT records). +It is noteworthy that small files are stored entirely within the inode; +thus, if you expect to use the volume for storing large numbers of very small +files, it is useful to set the zone multiplier to a higher value. Note, that +the MFT zone is resized on the fly as required during operation of the NTFS +driver but choosing a good value will reduce fragmentation. Valid values +are 1, 2, 3 and 4. The values have the following meaning: +.TS +lB lB +lB lB +c l. +MFT zone MFT zone size +multiplier (% of volume size) +1 12.5% (default) +2 25.0% +3 37.5% +4 50.0% +.TE +.TP +.B \-f +Same as +.BR \-Q . +.TP +.B \-Q +Perform quick format. This will skip both zeroing of the volume and bad sector +checking. +.TP +.B \-n +Causes +.B mkntfs +to not actually create a filesystem, but display what it would do if it were +to create a filesystem. All steps of the format are carried out except the +actual writing to the device. +.TP +.B \-q +Quiet execution; only errors are written to stderr, no output to stdout +occurs at all. Useful if +.B mkntfs +is run in a script. +.TP +.B \-v +Verbose execution. +.TP +.B \-vv +Really verbose execution; includes the verbose output from the +.B \-v +option as well as additional output useful for debugging +.B mkntfs. +.TP +.B \-C +Enable compression on the volume. +.TP +.B \-F +Force +.B mkntfs +to run, even if the specified +.I device +is not a block special device, or appears to be mounted. +.TP +.B \-I +Disable content indexing on the volume. (This is only meaningful on +Windows 2000 and later. Windows NT 4.0 and earlier ignore this as they do +not implement content indexing at all.) +.TP +.B \-V +Print the version number of +.B mkntfs +and exit. +.SH AUTHOR +This version of +.B mkntfs +has been written by Anton Altaparmakov (if that fails, use +). +.SH BUGS +.B mkntfs +writes the backup boot sector to the last sector of the block +.I device +being formatted. However, current versions of the Linux kernel (all versions +up to and including todays 2.4.18) either only report an even number of sectors +when the sector size is below 1024 bytes, which is the case for most hard +drives today (512 bytes sector size) or they return the correct number but +accessing the last sector fails. Either way, this means that when a partition +has an odd number of 512-byte sectors, the last sector is either not reported +to us at all or it is not writable by us and hence the created NTFS volume +will either have the backup boot sector placed one sector ahead of where it +should be or it cannot be written at all. For this reason, +.B mkntfs +marks the NTFS volume dirty, so that when you reboot into Windows, check disk +runs automatically and creates a copy of the backup boot sector in the correct +location. This also has the benefit of catching any bugs in +.B mkntfs +as check disk would find any corrupt structures and repair them, as well as +report them. - If you do see any problems reported, please report the messages +to the author. +.br +There may be other bugs. Please, report them to the author. +.SH AVAILABILITY +.B mkntfs +is part of the Linux-NTFS project and is available for download from +http://sf.net/project/showfiles.php?group_id=13956 in source (tar ball and +rpm) and pre-compiled binary (i386 rpm and deb) form. +.SH SEE ALSO +.BR badblocks (8) + diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index e69de29b..47357c76 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -0,0 +1,3554 @@ +/* + * $Id$ + * + * mkntfs - Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (C) 2001-2002 Richard Russon. + * + * This utility will create an NTFS 1.2 (Windows NT 4.0) volume on a user + * specified (block) device. + * + * Some things (option handling and determination of mount status) have been + * adapted from e2fsprogs-1.19 and lib/ext2fs/ismounted.c and misc/mke2fs.c in + * particular. + * + * Anton Altaparmakov + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS source + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * WARNING: This program might not work on architectures which do not allow + * unaligned access. For those, the program would need to start using + * get/put_unaligned macros (#include ), but not doing it yet, + * since NTFS really mostly applies to ia32 only, which does allow unaligned + * accesses. We might not actually have a problem though, since the structs are + * defined as being packed so that might be enough for gcc to insert the + * correct code. + * + * If anyone using a non-little endian and/or an aligned access only CPU tries + * this program please let me know whether it works or not! + * + * Anton Altaparmakov + */ + +#include "config.h" + +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDARG_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_ERRNO_H +# include +#endif +#include +#ifdef HAVE_LINUX_FD_H +# include +# include +#endif +#include +#ifdef HAVE_GETOPT_H +# include +#else + extern char *optarg; + extern int optind; +#endif +#include +#ifdef HAVE_LINUX_MAJOR_H +# include +#endif +#ifndef MAJOR +# define MAJOR(dev) ((dev) >> 8) +# define MINOR(dev) ((dev) & 0xff) +#endif +#ifndef SCSI_BLK_MAJOR +# define SCSI_BLK_MAJOR(m) ((m) == SCSI_DISK_MAJOR || \ + (m) == SCSI_CDROM_MAJOR) +#endif +#include + +#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE) +# define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ +#endif + +#if defined(__linux__) && defined(_IO) && !defined(BLKSSZGET) +# define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytse. */ +#endif + +#include "types.h" +#include "bootsect.h" +#include "disk_io.h" +#include "attrib.h" +#include "bitmap.h" +#include "mst.h" +#include "dir.h" +#include "runlist.h" + +extern const unsigned char attrdef_ntfs12_array[2400]; +extern const unsigned char boot_array[3429]; +extern void init_system_file_sd(int sys_file_no, char **sd_val, + int *sd_val_len); +extern void init_upcase_table(uchar_t *uc, u32 uc_len); + +/* Page size on ia32. Can change to 8192 on Alpha. */ +#define NTFS_PAGE_SIZE 4096 + +const char *EXEC_NAME = "mkntfs"; + +/* Need these global so mkntfs_exit can access them. */ +struct flock flk; +char *buf = NULL; +char *buf2 = NULL; +int buf2_size = 0; +int mft_bitmap_size, mft_bitmap_byte_size; +unsigned char *mft_bitmap = NULL; +int lcn_bitmap_byte_size; +unsigned char *lcn_bitmap = NULL; +run_list *rl = NULL, *rl_mft = NULL, *rl_mft_bmp = NULL, *rl_mftmirr = NULL; +run_list *rl_logfile = NULL, *rl_boot = NULL, *rl_bad = NULL, *rl_index; +INDEX_ALLOCATION *index_block = NULL; +ntfs_volume *vol; + +struct { + int sector_size; /* -s, in bytes, power of 2, default is + 512 bytes. */ + long long nr_sectors; /* size of device in sectors */ + long long nr_clusters; /* Note: Win2k treats clusters as + 32-bit entities! */ + long long volume_size; /* in bytes, or suffixed + with k for kB, m or M for MB, or + g or G for GB, or t or T for TB */ + int index_block_size; /* in bytes. */ + int mft_size; /* The bigger of 16kB & one cluster. */ + long long mft_lcn; /* lcn of $MFT, $DATA attribute. */ + long long mftmirr_lcn; /* lcn of $MFTMirr, $DATA. */ + long long logfile_lcn; /* lcn of $LogFile, $DATA. */ + int logfile_size; /* in bytes, determined from + volume_size. */ + char mft_zone_multiplier; /* -z, value from 1 to 4. Default is + 1. */ + long long mft_zone_end; /* Determined from volume_size and + mft_zone_multiplier, in clusters. */ + char no_action; /* -n, do not write to device, only + display what would be done. */ + char check_bad_blocks; /* read-only test for bad + clusters. */ + long long *bad_blocks; /* Array of bad clusters. */ + long long nr_bad_blocks; /* Number of bad clusters. */ + char *bad_blocks_filename; /* filename, file to read list of + bad clusters from. */ + ATTR_DEF *attr_defs; /* filename, attribute defs. */ + int attr_defs_len; /* in bytes */ + uchar_t *upcase; /* filename, upcase table. */ + u32 upcase_len; /* Determined automatically. */ + char quiet; /* -q, quiet execution. */ + char verbose; /* -v, verbose execution, given twice, + * really verbose execution (debug + * mode). */ + char force; /* -F, force fs creation. */ + char quick_format; /* -f or -Q, fast format, don't zero + the volume first. */ + char enable_compression; /* -C, enables compression of all files + on the volume by default. */ + char disable_indexing; /* -I, disables indexing of file + contents on the volume by default. */ + /* -V, print version and exit. */ +} opt; + +/* Error output. Ignores quiet (-q). */ +void Eprintf(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); +} + +void err_exit(const char *fmt, ...) __attribute__ ((noreturn)); + +/* Error output and terminate. Ignores quiet (-q). */ +void err_exit(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "Aborting...\n"); + exit(1); +} + +/* Debugging output (-vv). Overriden by quiet (-q). */ +void Dprintf(const char *fmt, ...) +{ + va_list ap; + + if (!opt.quiet && opt.verbose > 1) { + printf("DEBUG: "); + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } +} + +/* Verbose output (-v). */ +void Vprintf(const char *fmt, ...) +{ + va_list ap; + + if (!opt.quiet && opt.verbose > 0) { + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } +} + +/* Quietable output (if not -q). */ +void Qprintf(const char *fmt, ...) +{ + va_list ap; + + if (!opt.quiet) { + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } +} + +void append_to_bad_blocks(unsigned long block) +{ + long long *new_buf; + + if (!(opt.nr_bad_blocks & 15)) { + new_buf = realloc(opt.bad_blocks, (opt.nr_bad_blocks + 16) * + sizeof(long long)); + if (!new_buf) + err_exit("Reallocating memory for bad blocks list " + "failed: %s\n", strerror(errno)); + if (opt.bad_blocks != new_buf) + free(opt.bad_blocks); + opt.bad_blocks = new_buf; + } + opt.bad_blocks[opt.nr_bad_blocks++] = block; +} + +__inline__ long long mkntfs_write(int fd, const void *buf, long long count) +{ + long long bytes_written, total; + int retry; + + if (opt.no_action) + return count; + total = 0LL; + retry = 0; + do { + bytes_written = write(fd, buf, count); + if (bytes_written == -1LL) { + retry = errno; + Eprintf("Error writing to %s: %s\n", vol->dev_name, + strerror(errno)); + errno = retry; + return bytes_written; + } else if (!bytes_written) + ++retry; + else { + count -= bytes_written; + total += bytes_written; + } + } while (count && retry < 3); + if (count) + Eprintf("Failed to complete writing to %s after three retries." + "\n", vol->dev_name); + return total; +} + +/* + * Write to disk the clusters contained in the run list @rl taking the data + * from @val. Take @val_len bytes from @val and pad the rest with zeroes. + * + * If the @rl specifies a completely sparse file, @val is allowed to be NULL. + * + * @inited_size if not NULL points to an output variable which will contain + * the actual number of bytes written to disk. I.e. this will not include + * sparse bytes for example. + * + * Return the number of bytes written (minus padding) or -1 on error. Errno + * will be set to the error code. + */ +s64 ntfs_rlwrite(int fd, const run_list *rl, const char *val, + const s64 val_len, s64 *inited_size) +{ + s64 bytes_written, total, length, delta; + int retry, i; + + if (inited_size) + *inited_size = 0LL; + if (opt.no_action) + return val_len; + total = delta = 0LL; + for (i = 0; rl[i].length; i++) { + length = rl[i].length * vol->cluster_size; + /* Don't write sparse runs. */ + if (rl[i].lcn == -1) { + total += length; + if (!val) + continue; + // TODO: Check that *val is really zero at pos and len. + continue; + } + if (lseek(fd, rl[i].lcn * vol->cluster_size, SEEK_SET) == + (off_t)-1) + return -1LL; + retry = 0; + do { + if (total + length > val_len) { + delta = length; + length = val_len - total; + delta -= length; + } + bytes_written = write(fd, val + total, length); + if (bytes_written == -1LL) { + retry = errno; + Eprintf("Error writing to %s: %s\n", + vol->dev_name, strerror(errno)); + errno = retry; + return bytes_written; + } + if (bytes_written) { + length -= bytes_written; + total += bytes_written; + if (inited_size) + *inited_size += bytes_written; + } else + ++retry; + } while (length && retry < 3); + if (length) { + Eprintf("Failed to complete writing to %s after three " + "retries.\n", vol->dev_name); + return total; + } + } + if (delta) { + char *buf = (char*)calloc(1, delta); + if (!buf) + err_exit("Error allocating internal buffer: " + "%s\n", strerror(errno)); + bytes_written = mkntfs_write(fd, buf, delta); + free(buf); + if (bytes_written == -1LL) + return bytes_written; + } + return total; +} + +/** + * ucslen - determine the length of a fixed-size unicode-character string + * @s: pointer to unicode-character string + * + * Return the number of unicode-characters in @s up to a maximum of maxlen + * unicode-characters, not including the terminating (uchar_t)'\0'. If there + * is no (uchar_t)'\0' between s and s+maxlen, maxlen is returned. + * + * This function never looks beyond s+maxlen. + */ +int ucsnlen(const uchar_t *s, int maxlen) +{ + int i; + + for (i = 0; i < maxlen; i++) + if (!s[i]) + break; + return i; +} + +/** + * ucstos - convert unicode-character string to ASCII + * @dest: points to buffer to receive the converted string + * @src: points to string to convert + * @maxlen: size of @dest buffer in bytes + * + * Return the number of characters written to @dest, not including the + * terminating null byte. If a unicode character was encountered which could + * not be converted -1 is returned. + */ +int ucstos(char *dest, const uchar_t *src, int maxlen) +{ + uchar_t u; + int i; + + /* Need one byte for null terminator. */ + maxlen--; + for (i = 0; i < maxlen; i++) { + u = le16_to_cpu(src[i]); + if (!u) + break; + if (u & 0xff00) + return -1; + dest[i] = u & 0xff; + } + dest[i] = 0; + return i; +} + +/** + * stoucs - convert ASCII string to unicode-character string + * @dest: points to buffer to receive the converted string + * @src: points to string to convert + * @maxlen: size of @dest buffer in bytes + * + * Return the number of characters written to @dest, not including the + * terminating null unicode character. + */ +int stoucs(uchar_t *dest, const char *src, int maxlen) +{ + char c; + int i; + + /* Need two bytes for null terminator. */ + maxlen -= 2; + for (i = 0; i < maxlen; i++) { + c = src[i]; + if (!c) + break; + dest[i] = cpu_to_le16(c); + } + dest[i] = cpu_to_le16('\0'); + return i; +} + +void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) +{ + const char *don_t_know = "Don't know what to do with this attribute " + "type yet."; + const char *skip = "Skipping display of $%s attribute value.\n"; + const char *todo = "This is still work in progress."; + char *buf; + int i, j; + + switch (type) { + case AT_STANDARD_INFORMATION: + // TODO + printf("%s\n", todo); + return; + case AT_ATTRIBUTE_LIST: + // TODO + printf("%s\n", todo); + return; + case AT_FILE_NAME: + // TODO + printf("%s\n", todo); + return; + case AT_OBJECT_ID: + // TODO + printf("%s\n", todo); + return; + case AT_SECURITY_DESCRIPTOR: + // TODO + printf("%s\n", todo); + return; + case AT_VOLUME_NAME: + printf("Volume name length = %i\n", val_len); + if (val_len) { + buf = calloc(1, val_len); + if (!buf) + err_exit("Failed to allocate internal buffer: " + "%s\n", strerror(errno)); + i = ucstos(buf, (uchar_t*)val, val_len); + if (i == -1) + printf("Volume name contains non-displayable " + "Unicode characters.\n"); + printf("Volume name = %s\n", buf); + free(buf); + } + return; + case AT_VOLUME_INFORMATION: +#define VOL_INF(x) ((VOLUME_INFORMATION *)(x)) + printf("NTFS version %i.%i\n", VOL_INF(val)->major_ver, + VOL_INF(val)->minor_ver); + i = VOL_INF(val)->flags; +#undef VOL_INF + printf("Volume flags = 0x%x: ", i); + if (!i) { + printf("NONE\n"); + return; + } + j = 0; + if (i & VOLUME_MODIFIED_BY_CHKDSK) { + j = 1; + printf("VOLUME_MODIFIED_BY_CHKDSK"); + } + if (i & VOLUME_REPAIR_OBJECT_ID) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_REPAIR_OBJECT_ID"); + } + if (i & VOLUME_DELETE_USN_UNDERWAY) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_DELETE_USN_UNDERWAY"); + } + if (i & VOLUME_MOUNTED_ON_NT4) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_MOUNTED_ON_NT4"); + } + if (i & VOLUME_UPGRADE_ON_MOUNT) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_UPGRADE_ON_MOUNT"); + } + if (i & VOLUME_RESIZE_LOG_FILE) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_RESIZE_LOG_FILE"); + } + if (i & VOLUME_IS_DIRTY) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_IS_DIRTY"); + } + printf("\n"); + return; + case AT_DATA: + printf(skip, "DATA"); + return; + case AT_INDEX_ROOT: + // TODO + printf("%s\n", todo); + return; + case AT_INDEX_ALLOCATION: + // TODO + printf("%s\n", todo); + return; + case AT_BITMAP: + printf(skip, "BITMAP"); + return; + case AT_REPARSE_POINT: + // TODO + printf("%s\n", todo); + return; + case AT_EA_INFORMATION: + // TODO + printf("%s\n", don_t_know); + return; + case AT_EA: + // TODO + printf("%s\n", don_t_know); + return; + case AT_LOGGED_UTILITY_STREAM: + // TODO + printf("%s\n", don_t_know); + return; + default: + i = le32_to_cpu(type); + printf("Cannot display unknown %s defined attribute type 0x%x" + ".\n", i >= + le32_to_cpu(AT_FIRST_USER_DEFINED_ATTRIBUTE) ? + "user" : "system", i); + } +} + +void dump_resident_attr(ATTR_RECORD *a) +{ + int i; + + i = le32_to_cpu(a->value_length); + printf("Attribute value length = %u (0x%x)\n", i, i); + i = le16_to_cpu(a->value_offset); + printf("Attribute value offset = %u (0x%x)\n", i, i); + i = a->resident_flags; + printf("Resident flags = 0x%x: ", i); + if (!i) + printf("NONE\n"); + else if (i & ~RESIDENT_ATTR_IS_INDEXED) + printf("UNKNOWN FLAG(S)\n"); + else + printf("RESIDENT_ATTR_IS_INDEXED\n"); + dump_resident_attr_val(a->type, (char*)a + le16_to_cpu(a->value_offset), + le32_to_cpu(a->value_length)); +} + +void dump_mapping_pairs_array(char *b, unsigned int max_len) +{ + // TODO + return; +} + +void dump_non_resident_attr(ATTR_RECORD *a) +{ + s64 l; + int i; + + l = sle64_to_cpu(a->lowest_vcn); + printf("Lowest VCN = %Li (0x%Lx)\n", l, l); + l = sle64_to_cpu(a->highest_vcn); + printf("Highest VCN = %Li (0x%Lx)\n", l, l); + printf("Mapping pairs array offset = 0x%x\n", + le16_to_cpu(a->mapping_pairs_offset)); + printf("Compression unit = 0x%x: %sCOMPRESSED\n", a->compression_unit, + a->compression_unit ? "" : "NOT "); + if (sle64_to_cpu(a->lowest_vcn)) + printf("Attribute is not the first extent. The following " + "sizes are meaningless:\n"); + l = sle64_to_cpu(a->allocated_size); + printf("Allocated size = %Li (0x%Lx)\n", l, l); + l = sle64_to_cpu(a->data_size); + printf("Data size = %Li (0x%Lx)\n", l, l); + l = sle64_to_cpu(a->initialized_size); + printf("Initialized size = %Li (0x%Lx)\n", l, l); + if (a->flags & ATTR_COMPRESSION_MASK) { + l = sle64_to_cpu(a->compressed_size); + printf("Compressed size = %Li (0x%Lx)\n", l, l); + } + i = le16_to_cpu(a->mapping_pairs_offset); + dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); +} + +void dump_attr_record(ATTR_RECORD *a) +{ + unsigned int u; + char s[0x200]; + int i; + + printf("-- Beginning dump of attribute record. --\n"); + if (a->type == AT_END) { + printf("Attribute type = 0x%x ($END)\n", le32_to_cpu(AT_END)); + u = le32_to_cpu(a->length); + printf("Length of resident part = %u (0x%x)\n", u, u); + return; + } + u = le32_to_cpu(a->type); + for (i = 0; opt.attr_defs[i].type; i++) + if (le32_to_cpu(opt.attr_defs[i].type) >= u) + break; + if (opt.attr_defs[i].type) { +// printf("type = 0x%x\n", le32_to_cpu(opt.attr_defs[i].type)); +// { char *p = (char*)opt.attr_defs[i].name; +// printf("name = %c%c%c%c%c\n", *p, p[1], p[2], p[3], p[4]); +// } + if (ucstos(s, opt.attr_defs[i].name, sizeof(s)) == -1) { + Eprintf("Could not convert Unicode string to single " + "byte string in current locale.\n"); + strncpy(s, "Error converting Unicode string", + sizeof(s)); + } + } else + strncpy(s, "UNKNOWN_TYPE", sizeof(s)); + printf("Attribute type = 0x%x (%s)\n", u, s); + u = le32_to_cpu(a->length); + printf("Length of resident part = %u (0x%x)\n", u, u); + printf("Attribute is %sresident\n", a->non_resident ? "non-" : ""); + printf("Name length = %u unicode characters\n", a->name_length); + printf("Name offset = %u (0x%x)\n", cpu_to_le16(a->name_offset), + cpu_to_le16(a->name_offset)); + u = a->flags; + if (a->name_length) { + if (ucstos(s, (uchar_t*)((char*)a + + cpu_to_le16(a->name_offset)), + min(sizeof(s), a->name_length + 1)) == -1) { + Eprintf("Could not convert Unicode string to single " + "byte string in current locale.\n"); + strncpy(s, "Error converting Unicode string", + sizeof(s)); + + } + printf("Name = %s\n", s); + } + printf("Attribute flags = 0x%x: ", le16_to_cpu(u)); + if (!u) + printf("NONE"); + else { + int first = TRUE; + if (u & ATTR_COMPRESSION_MASK) { + if (u & ATTR_IS_COMPRESSED) { + printf("ATTR_IS_COMPRESSED"); + first = FALSE; + } + if ((u & ATTR_COMPRESSION_MASK) & ~ATTR_IS_COMPRESSED) { + if (!first) + printf(" | "); + else + first = FALSE; + printf("ATTR_UNKNOWN_COMPRESSION"); + } + } + if (u & ATTR_IS_ENCRYPTED) { + if (!first) + printf(" | "); + else + first = FALSE; + printf("ATTR_IS_ENCRYPTED"); + } + if (u & ATTR_IS_SPARSE) { + if (!first) + printf(" | "); + else + first = FALSE; + printf("ATTR_IS_SPARSE"); + } + } + printf("\n"); + printf("Attribute instance = %u\n", le16_to_cpu(a->instance)); + if (a->non_resident) { + dump_non_resident_attr(a); + } else { + dump_resident_attr(a); + } +} + +void dump_mft_record(MFT_RECORD *m) +{ + ATTR_RECORD *a; + unsigned int u; + MFT_REF r; + + printf("-- Beginning dump of mft record. --\n"); + u = le32_to_cpu(m->magic); + printf("Mft record signature (magic) = %c%c%c%c\n", u & 0xff, + u >> 8 & 0xff, u >> 16 & 0xff, u >> 24 & 0xff); + u = le16_to_cpu(m->usa_ofs); + printf("Update sequence array offset = %u (0x%x)\n", u, u); + printf("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); + printf("$LogFile sequence number (lsn) = %Lu\n", le64_to_cpu(m->lsn)); + printf("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); + printf("Reference (hard link) count = %u\n", + le16_to_cpu(m->link_count)); + u = le16_to_cpu(m->attrs_offset); + printf("First attribute offset = %u (0x%x)\n", u, u); + printf("Flags = %u: ", le16_to_cpu(m->flags)); + if (m->flags & MFT_RECORD_IN_USE) + printf("MFT_RECORD_IN_USE"); + else + printf("MFT_RECORD_NOT_IN_USE"); + if (m->flags & MFT_RECORD_IS_DIRECTORY) + printf(" | MFT_RECORD_IS_DIRECTORY"); + printf("\n"); + u = le32_to_cpu(m->bytes_in_use); + printf("Bytes in use = %u (0x%x)\n", u, u); + u = le32_to_cpu(m->bytes_allocated); + printf("Bytes allocated = %u (0x%x)\n", u, u); + r = le64_to_cpu(m->base_mft_record); + printf("Base mft record reference:\n\tMft record number = %Lu\n\t" + "Sequence number = %u\n", MREF(r), MSEQNO(r)); + printf("Next attribute instance = %u\n", + le16_to_cpu(m->next_attr_instance)); + a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); + printf("-- Beginning dump of attributes within mft record. --\n"); + while ((char*)a < (char*)m + le32_to_cpu(m->bytes_in_use)) { + dump_attr_record(a); + if (a->type == AT_END) + break; + a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); + }; + printf("-- End of attributes. --\n"); +} + +void format_mft_record(MFT_RECORD *m) +{ + ATTR_RECORD *a; + + memset(m, 0, vol->mft_record_size); + m->magic = magic_FILE; + /* Aligned to 2-byte boundary. */ + m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD) + 1) & ~1); + if (vol->mft_record_size >= NTFS_SECTOR_SIZE) + m->usa_count = cpu_to_le16(vol->mft_record_size / + NTFS_SECTOR_SIZE + 1); + else { + m->usa_count = cpu_to_le16(1); + Qprintf("Sector size is bigger than MFT record size. Setting " + "usa_count to 1. If Windows\nchkdsk reports this as " + "corruption, please email linux-ntfs-dev@lists.sf.net\n" + "stating that you saw this message and that the file " + "system created was corrupt.\nThank you."); + } + /* Set the update sequence number to 1. */ + *(u16*)((char*)m + ((sizeof(MFT_RECORD) + 1) & ~1)) = cpu_to_le16(1); + m->lsn = cpu_to_le64(0LL); + m->sequence_number = cpu_to_le16(1); + m->link_count = cpu_to_le16(0); + /* Aligned to 8-byte boundary. */ + m->attrs_offset = cpu_to_le16((le16_to_cpu(m->usa_ofs) + + (le16_to_cpu(m->usa_count) << 1) + 7) & ~7); + m->flags = cpu_to_le16(0); + /* + * Using attrs_offset plus eight bytes (for the termination attribute), + * aligned to 8-byte boundary. + */ + m->bytes_in_use = cpu_to_le32((le16_to_cpu(m->attrs_offset) + 8 + 7) & + ~7); + m->bytes_allocated = cpu_to_le32(vol->mft_record_size); + m->base_mft_record = cpu_to_le64((MFT_REF)0); + m->next_attr_instance = cpu_to_le16(0); + a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); + a->type = AT_END; + a->length = cpu_to_le32(0); +#if 0 + if (!opt.quiet && opt.verbose > 1) + dump_mft_record(m); +#endif +} + +/** + * make_room_for_attribute - make room for an attribute inside an mft record + * @m: mft record + * @pos: position at which to make space + * @size: byte size to make available at this position + * + * @pos points to the attribute in front of which we want to make space. + * + * Return 0 on success or -errno on error. Possible error codes are: + * + * -ENOSPC There is not enough space available to complete + * operation. The caller has to make space before calling + * this. + * -EINVAL Can only occur if mkntfs was compiled with -DEBUG. Means + * the input parameters were faulty. + */ +int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) +{ + u32 biu; + + if (!size) + return 0; +#ifdef DEBUG + /* + * Rigorous consistency checks. Always return -EINVAL even if more + * appropriate codes exist for simplicity of parsing the return value. + */ + if (size != ((size + 7) & ~7)) { + Eprintf("make_room_for_attribute() received non 8-byte aligned" + "size.\n"); + return -EINVAL; + } + if (!m || !pos) + return -EINVAL; + if (pos < (char*)m || pos + size < (char*)m || + pos > (char*)m + le32_to_cpu(m->bytes_allocated) || + pos + size > (char*)m + le32_to_cpu(m->bytes_allocated)) + return -EINVAL; + /* The -8 is for the attribute terminator. */ + if (pos - (char*)m > le32_to_cpu(m->bytes_in_use) - 8) + return -EINVAL; +#endif + biu = le32_to_cpu(m->bytes_in_use); + /* Do we have enough space? */ + if (biu + size > le32_to_cpu(m->bytes_allocated)) + return -ENOSPC; + /* Move everything after pos to pos + size. */ + memmove(pos + size, pos, biu - (pos - (char*)m)); + /* Update mft record. */ + m->bytes_in_use = cpu_to_le32(biu + size); + return 0; +} + +/* Return 0 on success and -errno on error. */ +int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, + const u32 new_vsize) +{ + int new_alen, new_muse; + + /* New attribute length and mft record bytes used. */ + new_alen = (le32_to_cpu(a->length) - le32_to_cpu(a->value_length) + + new_vsize + 7) & ~7; + new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + + new_alen; + /* Check for sufficient space. */ + if (new_muse > le32_to_cpu(m->bytes_allocated) ) { + // Aarrgghh! Need to make space. Probably want generic function + // for this as we need to call it from other places, too. + return -ENOTSUP; + } + /* Move attributes behind @a to their new location. */ + memmove((char*)a + new_alen, (char*)a + le32_to_cpu(a->length), + le32_to_cpu(m->bytes_in_use) - ((char*)a - (char*)m) - + le32_to_cpu(a->length)); + /* Adjust @m to reflect change in used space. */ + m->bytes_in_use = cpu_to_le32(new_muse); + /* Adjust @a to reflect new value size. */ + a->length = cpu_to_le32(new_alen); + a->value_length = cpu_to_le32(new_vsize); + return 0; +} + +void deallocate_scattered_clusters(const run_list *rl) +{ + LCN j; + int i; + + if (!rl) + return; + /* Iterate over all runs in the run list @rl. */ + for (i = 0; rl[i].length; i++) { + /* Skip sparse runs. */ + if (rl[i].lcn == -1LL) + continue; + /* Deallocate the current run. */ + for (j = rl[i].lcn; j < rl[i].lcn + rl[i].length; j++) + ntfs_set_bit(lcn_bitmap, j, 0); + } +} + +/* + * Allocate @clusters and create a run list of the allocated clusters. + * + * Return the allocated run list. Caller has to free the run list when finished + * with it. + * + * On error return NULL and errno is set to the error code. + * + * TODO: We should be returning the size as well, but for mkntfs this is not + * necessary. + */ +run_list *allocate_scattered_clusters(s64 clusters) +{ + run_list *rl = NULL, *rlt; + VCN vcn = 0LL; + LCN lcn, end, prev_lcn = 0LL; + int rlpos = 0; + int rlsize = 0; + s64 prev_run_len = 0LL; + char bit; + + end = opt.nr_clusters; + /* Loop until all clusters are allocated. */ + while (clusters) { + /* Loop in current zone until we run out of free clusters. */ + for (lcn = opt.mft_zone_end; lcn < end; lcn++) { + bit = ntfs_get_and_set_bit(lcn_bitmap, lcn, 1); + if (bit) + continue; + /* + * Reallocate memory if necessary. Make sure we have + * enough for the terminator entry as well. + */ + if ((rlpos + 2) * sizeof(run_list) >= rlsize) { + rlsize += 4096; /* PAGE_SIZE */ + rlt = realloc(rl, rlsize); + if (!rlt) + goto err_end; + rl = rlt; + } + /* Coalesce with previous run if adjacent LCNs. */ + if (prev_lcn == lcn - prev_run_len) { + rl[rlpos - 1].length = ++prev_run_len; + vcn++; + } else { + rl[rlpos].vcn = vcn++; + rl[rlpos].lcn = prev_lcn = lcn; + rl[rlpos].length = prev_run_len = 1LL; + rlpos++; + } + /* Done? */ + if (!--clusters) { + /* Add terminator element and return. */ + rl[rlpos].vcn = vcn; + rl[rlpos].lcn = rl[rlpos].length = 0LL; + return rl; + } + + } + /* Switch to next zone, decreasing mft zone by factor 2. */ + end = opt.mft_zone_end; + opt.mft_zone_end >>= 1; + /* Have we run out of space on the volume? */ + if (opt.mft_zone_end <= 0) + goto err_end; + } + return rl; +err_end: + if (rl) { + /* Add terminator element. */ + rl[rlpos].vcn = vcn; + rl[rlpos].lcn = -1LL; + rl[rlpos].length = 0LL; + /* Deallocate all allocated clusters. */ + deallocate_scattered_clusters(rl); + /* Free the run list. */ + free(rl); + } + return NULL; +} + +/* + * Create a non-resident attribute with a predefined on disk location + * specified by the run_list @rl. The clusters specified by @rl are assumed to + * be allocated already. + * + * Return 0 on success and -errno on error. + */ +int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, + const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, + const ATTR_FLAGS flags, const run_list *rl, + const char *val, const s64 val_len) +{ + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + u16 hdr_size; + int asize, mpa_size, err, i; + s64 bw = 0, inited_size; + VCN highest_vcn; + uchar_t *uname; +/* + if (base record) + lookup_attr(); + else +*/ + if (name_len) { + i = (name_len + 1) * sizeof(uchar_t); + uname = (uchar_t*)calloc(1, i); + if (!uname) + return -errno; + name_len = stoucs(uname, name, i); + if (name_len > 0xff) { + free(uname); + return -ENAMETOOLONG; + } + } else + uname = NULL; + /* Check if the attribute is already there. */ + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + Eprintf("Failed to allocate attribute search context.\n"); + err = -ENOMEM; + goto err_out; + } + if (ic == IGNORE_CASE) { + Eprintf("FIXME: Hit unimplemented code path #1.\n"); + err = -ENOTSUP; + goto err_out; + } + if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, NULL, 0, ctx)) { + err = -EEXIST; + goto err_out; + } + if (errno != ENOENT) { + Eprintf("Corrupt inode.\n"); + err = -errno; + goto err_out; + } + a = ctx->attr; + if (flags & ATTR_COMPRESSION_MASK) { + Eprintf("Compressed attributes not supported yet.\n"); + // FIXME: Compress attribute into a temporary buffer, set + // val accordingly and save the compressed size. + err = -ENOTSUP; + goto err_out; + } + if (flags & (ATTR_IS_ENCRYPTED || ATTR_IS_SPARSE)) { + Eprintf("Encrypted/sparse attributes not supported yet.\n"); + err = -ENOTSUP; + goto err_out; + } + if (flags & ATTR_COMPRESSION_MASK) { + hdr_size = 72; + // FIXME: This compression stuff is all wrong. Never mind for + // now. (AIA) + if (val_len) + mpa_size = 0; //get_size_for_compressed_mapping_pairs(rl); + else + mpa_size = 0; + } else { + hdr_size = 64; + if (val_len) { + mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl); + if (mpa_size < 0) { + err = -errno; + Eprintf("Failed to get size for mapping " + "pairs.\n"); + goto err_out; + } + } else + mpa_size = 0; + } + /* Mapping pairs array and next attribute must be 8-byte aligned. */ + asize = (((int)hdr_size + ((name_len + 7) & ~7) + mpa_size) + 7) & ~7; + /* Get the highest vcn. */ + for (i = 0, highest_vcn = 0LL; rl[i].length; i++) + highest_vcn += rl[i].length; + /* Does the value fit inside the allocated size? */ + if (highest_vcn * vol->cluster_size < val_len) { + Eprintf("BUG: Allocated size is smaller than data size!\n"); + err = -EINVAL; + goto err_out; + } + err = make_room_for_attribute(m, (char*)a, asize); + if (err == -ENOSPC) { + // FIXME: Make space! (AIA) + // can we make it non-resident? if yes, do that. + // does it fit now? yes -> do it. + // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? + // yes -> make non-resident + // does it fit now? yes -> do it. + // make all attributes non-resident + // does it fit now? yes -> do it. + // m is a base record? yes -> allocate extension record + // does the new attribute fit in there? yes -> do it. + // split up run_list into extents and place each in an extension + // record. + // FIXME: the check for needing extension records should be + // earlier on as it is very quick: asize > m->bytes_allocated? + err = -ENOTSUP; + goto err_out; + } +#ifdef DEBUG + else if (err == -EINVAL) { + fprintf(stderr, "BUG(): in insert_positioned_attribute_in_mft_" + "record(): make_room_for_attribute() returned " + "error: EINVAL!\n"); + goto err_out; + } +#endif + a->type = type; + a->length = cpu_to_le32(asize); + a->non_resident = 1; + a->name_length = name_len; + a->name_offset = cpu_to_le16(hdr_size); + a->flags = flags; + a->instance = m->next_attr_instance; + m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance) + + 1) & 0xffff); + a->lowest_vcn = cpu_to_le64(0); + a->highest_vcn = cpu_to_le64(highest_vcn - 1LL); + a->mapping_pairs_offset = cpu_to_le16(hdr_size + ((name_len + 7) & ~7)); + memset(a->reserved1, 0, sizeof(a->reserved1)); + // FIXME: Allocated size depends on compression. + a->allocated_size = cpu_to_le64(highest_vcn * vol->cluster_size); + a->data_size = cpu_to_le64(val_len); + if (name_len) + memcpy((char*)a + hdr_size, uname, name_len << 1); + if (flags & ATTR_COMPRESSION_MASK) { + if (flags & ATTR_COMPRESSION_MASK & ~ATTR_IS_COMPRESSED) { + Eprintf("Unknown compression format. Reverting to " + "standard compression.\n"); + a->flags &= ~ATTR_COMPRESSION_MASK; + a->flags |= ATTR_IS_COMPRESSED; + } + a->compression_unit = 4; + inited_size = val_len; + // FIXME: Set the compressed size. + a->compressed_size = cpu_to_le64(0); + // FIXME: Write out the compressed data. + // FIXME: err = build_mapping_pairs_compressed(); + err = -ENOTSUP; + } else { + a->compression_unit = 0; + bw = ntfs_rlwrite(vol->fd, rl, val, val_len, &inited_size); + if (bw != val_len) + Eprintf("Error writing non-resident attribute value." + "\n"); + err = ntfs_build_mapping_pairs(vol, (s8*)a + hdr_size + + ((name_len + 7) & ~7), mpa_size, rl); + } + a->initialized_size = cpu_to_le64(inited_size); + if (err < 0 || bw != val_len) { + // FIXME: Handle error. + // deallocate clusters + // remove attribute + if (err >= 0) + err = -EIO; + Eprintf("insert_positioned_attr_in_mft_record failed with " + "error %i.\n", err < 0 ? err : bw); + } +err_out: + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (uname) + free(uname); + return err; +} + +/* Return 0 on success and -errno on error. */ +int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, + const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, + const ATTR_FLAGS flags, const char *val, const s64 val_len) +{ + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + u16 hdr_size; + int asize, mpa_size, err, i; + run_list *rl = NULL; + s64 bw = 0; + uchar_t *uname; +/* + if (base record) + lookup_attr(); + else +*/ + if (name_len) { + i = (name_len + 1) * sizeof(uchar_t); + uname = (uchar_t*)calloc(1, i); + if (!uname) + return -errno; + name_len = stoucs(uname, name, i); + if (name_len > 0xff) { + free(uname); + return -ENAMETOOLONG; + } + } else + uname = AT_UNNAMED; + /* Check if the attribute is already there. */ + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + Eprintf("Failed to allocate attribute search context.\n"); + err = -ENOMEM; + goto err_out; + } + if (ic == IGNORE_CASE) { + Eprintf("FIXME: Hit unimplemented code path #2.\n"); + err = -ENOTSUP; + goto err_out; + } + if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, NULL, 0, ctx)) { + err = -EEXIST; + goto err_out; + } + if (errno != ENOENT) { + Eprintf("Corrupt inode.\n"); + err = -errno; + goto err_out; + } + a = ctx->attr; + if (flags & ATTR_COMPRESSION_MASK) { + Eprintf("Compressed attributes not supported yet.\n"); + // FIXME: Compress attribute into a temporary buffer, set + // val accordingly and save the compressed size. + err = -ENOTSUP; + goto err_out; + } + if (flags & (ATTR_IS_ENCRYPTED || ATTR_IS_SPARSE)) { + Eprintf("Encrypted/sparse attributes not supported yet.\n"); + err = -ENOTSUP; + goto err_out; + } + if (val_len) { + rl = allocate_scattered_clusters((val_len + + vol->cluster_size - 1) / vol->cluster_size); + if (!rl) { + err = -errno; + Eprintf("Failed to allocate scattered clusters: %s\n", + strerror(-err)); + goto err_out; + } + } else + rl = NULL; + if (flags & ATTR_COMPRESSION_MASK) { + hdr_size = 72; + // FIXME: This compression stuff is all wrong. Never mind for + // now. (AIA) + if (val_len) + mpa_size = 0; //get_size_for_compressed_mapping_pairs(rl); + else + mpa_size = 0; + } else { + hdr_size = 64; + if (val_len) { + mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl); + if (mpa_size < 0) { + err = -errno; + Eprintf("Failed to get size for mapping " + "pairs.\n"); + goto err_out; + } + } else + mpa_size = 0; + } + /* Mapping pairs array and next attribute must be 8-byte aligned. */ + asize = (((int)hdr_size + ((name_len + 7) & ~7) + mpa_size) + 7) & ~7; + err = make_room_for_attribute(m, (char*)a, asize); + if (err == -ENOSPC) { + // FIXME: Make space! (AIA) + // can we make it non-resident? if yes, do that. + // does it fit now? yes -> do it. + // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? + // yes -> make non-resident + // does it fit now? yes -> do it. + // make all attributes non-resident + // does it fit now? yes -> do it. + // m is a base record? yes -> allocate extension record + // does the new attribute fit in there? yes -> do it. + // split up run_list into extents and place each in an extension + // record. + // FIXME: the check for needing extension records should be + // earlier on as it is very quick: asize > m->bytes_allocated? + err = -ENOTSUP; + goto err_out; + } +#ifdef DEBUG + else if (err == -EINVAL) { + fprintf(stderr, "BUG(): in insert_non_resident_attribute_in_" + "mft_record(): make_room_for_attribute() " + "returned error: EINVAL!\n"); + goto err_out; + } +#endif + a->type = type; + a->length = cpu_to_le32(asize); + a->non_resident = 1; + a->name_length = name_len; + a->name_offset = cpu_to_le16(hdr_size); + a->flags = flags; + a->instance = m->next_attr_instance; + m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance) + + 1) & 0xffff); + a->lowest_vcn = cpu_to_le64(0); + for (i = 0; rl[i].length; i++) + ; + a->highest_vcn = cpu_to_le64(rl[i].vcn - 1); + a->mapping_pairs_offset = cpu_to_le16(hdr_size + ((name_len + 7) & ~7)); + memset(a->reserved1, 0, sizeof(a->reserved1)); + // FIXME: Allocated size depends on compression. + a->allocated_size = cpu_to_le64((val_len + (vol->cluster_size - 1)) & + ~(vol->cluster_size - 1)); + a->data_size = cpu_to_le64(val_len); + a->initialized_size = cpu_to_le64(val_len); + if (name_len) + memcpy((char*)a + hdr_size, uname, name_len << 1); + if (flags & ATTR_COMPRESSION_MASK) { + if (flags & ATTR_COMPRESSION_MASK & ~ATTR_IS_COMPRESSED) { + Eprintf("Unknown compression format. Reverting to " + "standard compression.\n"); + a->flags &= ~ATTR_COMPRESSION_MASK; + a->flags |= ATTR_IS_COMPRESSED; + } + a->compression_unit = 4; + // FIXME: Set the compressed size. + a->compressed_size = cpu_to_le64(0); + // FIXME: Write out the compressed data. + // FIXME: err = build_mapping_pairs_compressed(); + err = -ENOTSUP; + } else { + a->compression_unit = 0; + bw = ntfs_rlwrite(vol->fd, rl, val, val_len, NULL); + if (bw != val_len) + Eprintf("Error writing non-resident attribute value." + "\n"); + err = ntfs_build_mapping_pairs(vol, (s8*)a + hdr_size + + ((name_len + 7) & ~7), mpa_size, rl); + } + if (err < 0 || bw != val_len) { + // FIXME: Handle error. + // deallocate clusters + // remove attribute + if (err >= 0) + err = -EIO; + Eprintf("insert_non_resident_attr_in_mft_record failed with " + "error %i.\n", err < 0 ? err : bw); + } +err_out: + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (uname && (uname != AT_UNNAMED)) + free(uname); + if (rl) + free(rl); + return err; +} + +/* Return 0 on success and -errno on error. */ +int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, + const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, + const ATTR_FLAGS flags, const RESIDENT_ATTR_FLAGS res_flags, + const char *val, const u32 val_len) +{ + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + int asize, err, i; + uchar_t *uname; +/* + if (base record) + lookup_attr(); + else +*/ + if (name_len) { + i = (name_len + 1) * sizeof(uchar_t); + uname = (uchar_t*)calloc(1, i); + name_len = stoucs(uname, name, i); + if (name_len > 0xff) + return -ENAMETOOLONG; + } else + uname = AT_UNNAMED; + /* Check if the attribute is already there. */ + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + Eprintf("Failed to allocate attribute search context.\n"); + err = -ENOMEM; + goto err_out; + } + if (ic == IGNORE_CASE) { + Eprintf("FIXME: Hit unimplemented code path #3.\n"); + err = -ENOTSUP; + goto err_out; + } + if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, val, val_len, + ctx)) { + err = -EEXIST; + goto err_out; + } + if (errno != ENOENT) { + Eprintf("Corrupt inode.\n"); + err = -errno; + goto err_out; + } + a = ctx->attr; + /* sizeof(resident attribute record header) == 24 */ + asize = ((24 + ((name_len + 7) & ~7) + val_len) + 7) & ~7; + err = make_room_for_attribute(m, (char*)a, asize); + if (err == -ENOSPC) { + // FIXME: Make space! (AIA) + // can we make it non-resident? if yes, do that. + // does it fit now? yes -> do it. + // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? + // yes -> make non-resident + // does it fit now? yes -> do it. + // make all attributes non-resident + // does it fit now? yes -> do it. + // m is a base record? yes -> allocate extension record + // does the new attribute fit in there? yes -> do it. + // split up run_list into extents and place each in an extension + // record. + // FIXME: the check for needing extension records should be + // earlier on as it is very quick: asize > m->bytes_allocated? + err = -ENOTSUP; + goto err_out; + } +#ifdef DEBUG + if (err == -EINVAL) { + fprintf(stderr, "BUG(): in insert_resident_attribute_in_mft_" + "record(): make_room_for_attribute() returned " + "error: EINVAL!\n"); + goto err_out; + } +#endif + a->type = type; + a->length = cpu_to_le32(asize); + a->non_resident = 0; + a->name_length = name_len; + a->name_offset = cpu_to_le16(24); + a->flags = cpu_to_le16(flags); + a->instance = m->next_attr_instance; + m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance) + + 1) & 0xffff); + a->value_length = cpu_to_le32(val_len); + a->value_offset = cpu_to_le16(24 + ((name_len + 7) & ~7)); + a->resident_flags = res_flags; + a->reservedR = 0; + if (name_len) + memcpy((char*)a + 24, uname, name_len << 1); + if (val_len) + memcpy((char*)a + le16_to_cpu(a->value_offset), val, val_len); +err_out: + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (uname && (uname != AT_UNNAMED)) + free(uname); + return err; +} + +s64 time2ntfs(s64 time) +{ + return cpu_to_le64((time + (s64)(369 * 365 + 89) * 24 * 3600) + * 10000000); +} + +/* Return 0 on success or -errno on error. */ +int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) +{ + STANDARD_INFORMATION si; + int err; + + si.creation_time = time2ntfs(time(NULL)); + si.last_data_change_time = si.creation_time; + si.last_mft_change_time = si.creation_time; + si.last_access_time = si.creation_time; + si.file_attributes = flags; /* already LE */ + if (vol->major_ver < 3) + memset(&si.reserved12, 0, sizeof(si.reserved12)); + else { + si.maximum_versions = cpu_to_le32(0); + si.version_number = cpu_to_le32(0); + si.class_id = cpu_to_le32(0); + /* FIXME: $Secure support... */ + si.security_id = cpu_to_le32(0); + /* FIXME: $Quota support... */ + si.owner_id = cpu_to_le32(0); + si.quota_charged = cpu_to_le64(0ULL); + /* FIXME: $UsnJrnl support... */ + si.usn = cpu_to_le64(0ULL); + } + /* NTFS 1.2: size of si = 48, NTFS 3.0: size of si = 72 */ + err = insert_resident_attr_in_mft_record(m, AT_STANDARD_INFORMATION, + NULL, 0, 0, 0, 0, (char*)&si, + vol->major_ver < 3 ? 48 : 72); + if (err < 0) + Eprintf("add_attr_std_info failed: %s\n", strerror(-err)); + return err; +} + +/* Return 0 on success or -errno on error. */ +int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, + const s64 allocated_size, const s64 data_size, + const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, + const u32 reparse_point_tag, const char *file_name, + const FILE_NAME_TYPE_FLAGS file_name_type) +{ + ntfs_attr_search_ctx *ctx; + STANDARD_INFORMATION *si; + FILE_NAME_ATTR *fn; + int i, fn_size; + + /* Check if the attribute is already there. */ + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + Eprintf("Failed to allocate attribute search context.\n"); + return -ENOMEM; + } + if (ntfs_lookup_attr(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, + ctx)) { + int eo = errno; + Eprintf("BUG: Standard information attribute not present in " + "file record\n"); + ntfs_put_attr_search_ctx(ctx); + return -eo; + } + si = (STANDARD_INFORMATION*)((char*)ctx->attr + + le16_to_cpu(ctx->attr->value_offset)); + i = (strlen(file_name) + 1) * sizeof(uchar_t); + fn_size = sizeof(FILE_NAME_ATTR) + i; + fn = (FILE_NAME_ATTR*)malloc(fn_size); + if (!fn) { + ntfs_put_attr_search_ctx(ctx); + return -errno; + } + fn->parent_directory = parent_dir; + + fn->creation_time = si->creation_time; + fn->last_data_change_time = si->last_data_change_time; + fn->last_mft_change_time = si->last_mft_change_time; + fn->last_access_time = si->last_access_time; + ntfs_put_attr_search_ctx(ctx); + + fn->allocated_size = cpu_to_le64(allocated_size); + fn->data_size = cpu_to_le64(data_size); + fn->file_attributes = flags; + /* These are in a union so can't have both. */ + if (packed_ea_size && reparse_point_tag) { + free(fn); + return -EINVAL; + } + if (packed_ea_size) { + fn->packed_ea_size = cpu_to_le16(packed_ea_size); + fn->reserved = cpu_to_le16(0); + } else + fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); + fn->file_name_type = file_name_type; + i = stoucs(fn->file_name, file_name, i); + if (i < 1) { + free(fn); + return -EINVAL; + } + if (i > 0xff) { + free(fn); + return -ENAMETOOLONG; + } + /* No terminating null in file names. */ + fn->file_name_length = i; + fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(uchar_t); + i = insert_resident_attr_in_mft_record(m, AT_FILE_NAME, NULL, 0, 0, + 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size); + free(fn); + if (i < 0) + Eprintf("add_attr_file_name failed: %s\n", strerror(-i)); + return i; +} + +/* + * Create the security descriptor attribute adding the security descriptor @sd + * of length @sd_len to the mft record @m. + * + * Return 0 on success or -errno on error. + */ +int add_attr_sd(MFT_RECORD *m, const char *sd, const s64 sd_len) +{ + int err; + + /* Does it fit? NO: create non-resident. YES: create resident. */ + if (le32_to_cpu(m->bytes_in_use) + 24 + sd_len > + le32_to_cpu(m->bytes_allocated)) + err = insert_non_resident_attr_in_mft_record(m, + AT_SECURITY_DESCRIPTOR, NULL, 0, 0, 0, sd, + sd_len); + else + err = insert_resident_attr_in_mft_record(m, + AT_SECURITY_DESCRIPTOR, NULL, 0, 0, 0, 0, sd, + sd_len); + if (err < 0) + Eprintf("add_attr_sd failed: %s\n", strerror(-err)); + return err; +} + +/* Return 0 on success or -errno on error. */ +int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, + const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, + const char *val, const s64 val_len) +{ + int err; + + /* + * Does it fit? NO: create non-resident. YES: create resident. + * + * FIXME: Introduced arbitrary limit of mft record allocated size - 512. + * This is to get around the problem that if $Bitmap/$DATA becomes too + * big, but is just small enough to be resident, we would make it + * resident, and later run out of space when creating the other + * attributes and this would cause us to abort as making resident + * attributes non-resident is not supported yet. + * The proper fix is to support making resident attribute non-resident. + */ + if (le32_to_cpu(m->bytes_in_use) + 24 + val_len > + min(le32_to_cpu(m->bytes_allocated), + le32_to_cpu(m->bytes_allocated) - 512)) + err = insert_non_resident_attr_in_mft_record(m, AT_DATA, name, + name_len, ic, flags, val, val_len); + else + err = insert_resident_attr_in_mft_record(m, AT_DATA, name, + name_len, ic, flags, 0, val, val_len); + + if (err < 0) + Eprintf("add_attr_data failed: %s\n", strerror(-err)); + return err; +} + +/* + * Create a non-resident data attribute with a predefined on disk location + * specified by the run_list @rl. The clusters specified by @rl are assumed to + * be allocated already. + * + * Return 0 on success or -errno on error. + */ +int add_attr_data_positioned(MFT_RECORD *m, const char *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const ATTR_FLAGS flags, const run_list *rl, + const char *val, const s64 val_len) +{ + int err; + + err = insert_positioned_attr_in_mft_record(m, AT_DATA, name, name_len, + ic, flags, rl, val, val_len); + if (err < 0) + Eprintf("add_attr_data_positioned failed: %s\n", + strerror(-err)); + return err; +} + +/* + * Create volume name attribute specifying the volume name @vol_name as a null + * terminated char string of length @vol_name_len (number of characters not + * including the terminating null), which is converted internally to a little + * endian uchar_t string. The name is at least 1 character long and at most + * 0xff characters long (not counting the terminating null). + * + * Return 0 on success or -errno on error. + */ +int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, + const int vol_name_len) +{ + uchar_t *uname; + int i, len; + + if (vol_name_len) { + len = (vol_name_len + 1) * sizeof(uchar_t); + uname = calloc(1, len); + if (!uname) + return -errno; + i = (stoucs(uname, vol_name, len) + 1) * sizeof(uchar_t); + if (!i) { + free(uname); + return -EINVAL; + } + if (i > 0xff) { + free(uname); + return -ENAMETOOLONG; + } + } else { + uname = NULL; + len = 0; + } + i = insert_resident_attr_in_mft_record(m, AT_VOLUME_NAME, NULL, 0, 0, + 0, 0, (char*)uname, len); + if (uname) + free(uname); + if (i < 0) + Eprintf("add_attr_vol_name failed: %s\n", strerror(-i)); + return i; +} + +/* Return 0 on success or -errno on error. */ +int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags, + const u8 major_ver, const u8 minor_ver) +{ + VOLUME_INFORMATION vi; + int err; + + memset(&vi, 0, sizeof(vi)); + vi.major_ver = major_ver; + vi.minor_ver = minor_ver; + vi.flags = flags & VOLUME_FLAGS_MASK; + err = insert_resident_attr_in_mft_record(m, AT_VOLUME_INFORMATION, NULL, + 0, 0, 0, 0, (char*)&vi, sizeof(vi)); + if (err < 0) + Eprintf("add_attr_vol_info failed: %s\n", strerror(-err)); + return err; +} + +/* Return 0 on success or -errno on error. */ +int add_attr_index_root(MFT_RECORD *m, const char *name, const u32 name_len, + const IGNORE_CASE_BOOL ic, const ATTR_TYPES indexed_attr_type, + const COLLATION_RULES collation_rule, + const u32 index_block_size) +{ + INDEX_ROOT *r; + INDEX_ENTRY_HEADER *e; + int err, val_len; + + val_len = sizeof(INDEX_ROOT) + sizeof(INDEX_ENTRY_HEADER); + r = (INDEX_ROOT*)malloc(val_len); + if (!r) + return -errno; + r->type = indexed_attr_type == AT_FILE_NAME ? AT_FILE_NAME : 0; + if (indexed_attr_type == AT_FILE_NAME && + collation_rule != COLLATION_FILE_NAME) { + free(r); + Eprintf("add_attr_index_root: indexed attribute is $FILE_NAME " + "but collation rule is not COLLATION_FILE_NAME.\n"); + return -EINVAL; + } + r->collation_rule = collation_rule; + r->index_block_size = cpu_to_le32(index_block_size); + if (index_block_size >= vol->cluster_size) { + if (index_block_size % vol->cluster_size) { + Eprintf("add_attr_index_root: index block size is not " + "a multiple of the cluster size.\n"); + free(r); + return -EINVAL; + } + r->clusters_per_index_block = index_block_size / + vol->cluster_size; + } else /* if (vol->cluster_size > index_block_size) */ { + if (index_block_size & (index_block_size - 1)) { + Eprintf("add_attr_index_root: index block size is not " + "a power of 2.\n"); + free(r); + return -EINVAL; + } + if (index_block_size < opt.sector_size) { + Eprintf("add_attr_index_root: index block size is " + "smaller than the sector size.\n"); + free(r); + return -EINVAL; + } + r->clusters_per_index_block = index_block_size / + opt.sector_size; + } + memset(&r->reserved, 0, sizeof(r->reserved)); + r->index.entries_offset = cpu_to_le32(sizeof(INDEX_HEADER)); + r->index.index_length = cpu_to_le32(sizeof(INDEX_HEADER) + + sizeof(INDEX_ENTRY_HEADER)); + r->index.allocated_size = r->index.index_length; + r->index.flags = SMALL_INDEX; + memset(&r->index.reserved, 0, sizeof(r->index.reserved)); + e = (INDEX_ENTRY_HEADER*)((char*)&r->index + + le32_to_cpu(r->index.entries_offset)); + /* + * No matter whether this is a file index or a view as this is a + * termination entry, hence no key value / data is associated with it + * at all. Thus, we just need the union to be all zero. + */ + e->indexed_file = cpu_to_le64(0LL); + e->length = cpu_to_le16(sizeof(INDEX_ENTRY_HEADER)); + e->key_length = cpu_to_le16(0); + e->flags = INDEX_ENTRY_END; + e->reserved = cpu_to_le16(0); + err = insert_resident_attr_in_mft_record(m, AT_INDEX_ROOT, name, + name_len, ic, 0, 0, (char*)r, val_len); + free(r); + if (err < 0) + Eprintf("add_attr_index_root failed: %s\n", strerror(-err)); + return err; +} + +/* Return 0 on success or -errno on error. */ +int add_attr_index_alloc(MFT_RECORD *m, const char *name, const u32 name_len, + const IGNORE_CASE_BOOL ic, const char *index_alloc_val, + const u32 index_alloc_val_len) +{ + int err; + + err = insert_non_resident_attr_in_mft_record(m, AT_INDEX_ALLOCATION, + name, name_len, ic, 0, index_alloc_val, + index_alloc_val_len); + if (err < 0) + Eprintf("add_attr_index_alloc failed: %s\n", strerror(-err)); + return err; +} + +/* Return 0 on success or -errno on error. */ +int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, + const IGNORE_CASE_BOOL ic, const char *bitmap, + const u32 bitmap_len) +{ + int err; + + /* Does it fit? NO: create non-resident. YES: create resident. */ + if (le32_to_cpu(m->bytes_in_use) + 24 + bitmap_len > + le32_to_cpu(m->bytes_allocated)) + err = insert_non_resident_attr_in_mft_record(m, AT_BITMAP, name, + name_len, ic, 0, bitmap, bitmap_len); + else + err = insert_resident_attr_in_mft_record(m, AT_BITMAP, name, + name_len, ic, 0, 0, bitmap, bitmap_len); + + if (err < 0) + Eprintf("add_attr_bitmap failed: %s\n", strerror(-err)); + return err; +} + +/* + * Create a non-resident bitmap attribute with a predefined on disk location + * specified by the run_list @rl. The clusters specified by @rl are assumed to + * be allocated already. + * + * Return 0 on success or -errno on error. + */ +int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const run_list *rl, const char *bitmap, const u32 bitmap_len) +{ + int err; + + err = insert_positioned_attr_in_mft_record(m, AT_BITMAP, name, name_len, + ic, 0, rl, bitmap, bitmap_len); + if (err < 0) + Eprintf("add_attr_bitmap_positioned failed: %s\n", + strerror(-err)); + return err; +} + +/* + * Create bitmap and index allocation attributes, modify index root + * attribute accordingly and move all of the index entries from the index root + * into the index allocation. + * + * Return 0 on success or -errno on error. + */ +int upgrade_to_large_index(MFT_RECORD *m, const char *name, + u32 name_len, const IGNORE_CASE_BOOL ic, + INDEX_ALLOCATION **index) +{ + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + INDEX_ROOT *r; + INDEX_ENTRY *re; + INDEX_ALLOCATION *ia_val = NULL; + uchar_t *uname; + char bmp[8]; + char *re_start, *re_end; + int i, err, index_block_size; + + if (name_len) { + i = (name_len + 1) * sizeof(uchar_t); + uname = (uchar_t*)calloc(1, i); + if (!uname) + return -errno; + name_len = stoucs(uname, name, i); + if (name_len > 0xff) { + free(uname); + return -ENAMETOOLONG; + } + } else + uname = NULL; + /* Find the index root attribute. */ + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + Eprintf("Failed to allocate attribute search context.\n"); + return -ENOMEM; + } + if (ic == IGNORE_CASE) { + Eprintf("FIXME: Hit unimplemented code path #4.\n"); + err = -ENOTSUP; + goto err_out; + } + err = ntfs_lookup_attr(AT_INDEX_ROOT, uname, name_len, ic, 0, NULL, 0, + ctx); + if (uname) + free(uname); + if (err) { + err = -ENOTDIR; + goto err_out; + } + a = ctx->attr; + if (a->non_resident || a->flags) { + err = -EINVAL; + goto err_out; + } + r = (INDEX_ROOT*)((char*)a + le16_to_cpu(a->value_offset)); + re_end = (char*)r + le32_to_cpu(a->value_length); + re_start = (char*)&r->index + le32_to_cpu(r->index.entries_offset); + re = (INDEX_ENTRY*)re_start; + index_block_size = le32_to_cpu(r->index_block_size); + memset(bmp, 0, sizeof(bmp)); + ntfs_set_bit(bmp, 0ULL, 1); + /* Bitmap has to be at least 8 bytes in size. */ + err = add_attr_bitmap(m, name, name_len, ic, (char*)&bmp, sizeof(bmp)); + if (err) + goto err_out; + ia_val = calloc(1, index_block_size); + if (!ia_val) { + err = -errno; + goto err_out; + } + /* Setup header. */ + ia_val->magic = magic_INDX; + ia_val->usa_ofs = cpu_to_le16(sizeof(INDEX_ALLOCATION)); + if (index_block_size >= NTFS_SECTOR_SIZE) + ia_val->usa_count = cpu_to_le16(index_block_size / + NTFS_SECTOR_SIZE + 1); + else { + ia_val->usa_count = cpu_to_le16(1); + Qprintf("Sector size is bigger than index block size. Setting " + "usa_count to 1. If Windows\nchkdsk reports this as " + "corruption, please email linux-ntfs-dev@lists.sf.net\n" + "stating that you saw this message and that the file " + "system created was corrupt.\nThank you."); + } + /* Set USN to 1. */ + *(u16*)((char*)ia_val + le16_to_cpu(ia_val->usa_ofs)) = + cpu_to_le16(1); + ia_val->lsn = cpu_to_le64(0); + ia_val->index_block_vcn = cpu_to_le64(0); + ia_val->index.flags = LEAF_NODE; + /* Align to 8-byte boundary. */ + ia_val->index.entries_offset = cpu_to_le32((sizeof(INDEX_HEADER) + + le16_to_cpu(ia_val->usa_count) * 2 + 7) & ~7); + ia_val->index.allocated_size = cpu_to_le32(index_block_size - + (sizeof(INDEX_ALLOCATION) - sizeof(INDEX_HEADER))); + /* Find the last entry in the index root and save it in re. */ + while ((char*)re < re_end && !(re->flags & INDEX_ENTRY_END)) { + /* Next entry in index root. */ + re = (INDEX_ENTRY*)((char*)re + le16_to_cpu(re->length)); + } + /* Copy all the entries including the termination entry. */ + i = (char*)re - re_start + le16_to_cpu(re->length); + memcpy((char*)&ia_val->index + + le32_to_cpu(ia_val->index.entries_offset), re_start, i); + /* Finish setting up index allocation. */ + ia_val->index.index_length = cpu_to_le32(i + + le32_to_cpu(ia_val->index.entries_offset)); + /* Move the termination entry forward to the beginning if necessary. */ + if ((char*)re > re_start) { + memmove(re_start, (char*)re, le16_to_cpu(re->length)); + re = (INDEX_ENTRY*)re_start; + } + /* Now fixup empty index root with pointer to index allocation VCN 0. */ + r->index.flags = LARGE_INDEX; + re->flags |= INDEX_ENTRY_NODE; + if (le16_to_cpu(re->length) < sizeof(INDEX_ENTRY_HEADER) + sizeof(VCN)) + re->length = cpu_to_le16(le16_to_cpu(re->length) + sizeof(VCN)); + r->index.index_length = cpu_to_le32(le32_to_cpu(r->index.entries_offset) + + le16_to_cpu(re->length)); + r->index.allocated_size = r->index.index_length; + /* Resize index root attribute. */ + err = resize_resident_attribute_value(m, a, sizeof(INDEX_ROOT) - + sizeof(INDEX_HEADER) + + le32_to_cpu(r->index.allocated_size)); + if (err) { + // TODO: Remove the added bitmap! + // Revert index root from index allocation. + goto err_out; + } + /* Set VCN pointer to 0LL. */ + *(VCN*)((char*)re + cpu_to_le16(re->length) - sizeof(VCN)) = + cpu_to_le64(0); + err = ntfs_pre_write_mst_fixup((NTFS_RECORD*)ia_val, index_block_size); + if (err) { + err = -errno; + Eprintf("ntfs_pre_write_mst_fixup() failed in " + "upgrade_to_large_index.\n"); + goto err_out; + } + err = add_attr_index_alloc(m, name, name_len, ic, (char*)ia_val, + index_block_size); + ntfs_post_write_mst_fixup((NTFS_RECORD*)ia_val); + if (err) { + // TODO: Remove the added bitmap! + // Revert index root from index allocation. + goto err_out; + } + *index = ia_val; + return 0; +err_out: + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (ia_val) + free(ia_val); + return err; +} + +/* + * Create space of @size bytes at position @pos inside the index block @index. + * + * Return 0 on success or -errno on error. + */ +int make_room_for_index_entry_in_index_block(INDEX_BLOCK *index, + INDEX_ENTRY *pos, u32 size) +{ + u32 biu; + + if (!size) + return 0; +#ifdef DEBUG + /* + * Rigorous consistency checks. Always return -EINVAL even if more + * appropriate codes exist for simplicity of parsing the return value. + */ + if (size != ((size + 7) & ~7)) { + Eprintf("make_room_for_index_entry_in_index_block() received " + "non 8-byte aligned size.\n"); + return -EINVAL; + } + if (!index || !pos) + return -EINVAL; + if ((char*)pos < (char*)index || (char*)pos + size < (char*)index || + (char*)pos > (char*)index + sizeof(INDEX_BLOCK) - + sizeof(INDEX_HEADER) + + le32_to_cpu(index->index.allocated_size) || + (char*)pos + size > (char*)index + sizeof(INDEX_BLOCK) - + sizeof(INDEX_HEADER) + + le32_to_cpu(index->index.allocated_size)) + return -EINVAL; + /* The - sizeof(INDEX_ENTRY_HEADER) is for the index terminator. */ + if ((char*)pos - (char*)&index->index > + le32_to_cpu(index->index.index_length) + - sizeof(INDEX_ENTRY_HEADER)) + return -EINVAL; +#endif + biu = le32_to_cpu(index->index.index_length); + /* Do we have enough space? */ + if (biu + size > le32_to_cpu(index->index.allocated_size)) + return -ENOSPC; + /* Move everything after pos to pos + size. */ + memmove((char*)pos + size, (char*)pos, biu - ((char*)pos - + (char*)&index->index)); + /* Update index block. */ + index->index.index_length = cpu_to_le32(biu + size); + return 0; +} + +/* + * Insert the fully completed FILE_NAME_ATTR @file_name which is inside + * the file with mft reference @file_ref into the index (allocation) block + * @index (which belongs to @file_ref's parent directory). + * + * Return 0 on success or -errno on error. + */ +int insert_file_link_in_dir_index(INDEX_BLOCK *index, MFT_REF file_ref, + FILE_NAME_ATTR *file_name, u32 file_name_size) +{ + int err, i; + INDEX_ENTRY *ie; + char *index_end; + + /* + * Lookup dir entry @file_name in dir @index to determine correct + * insertion location. FIXME: Using a very oversimplified lookup + * method which is sufficient for mkntfs but no good whatsoever in + * real world scenario. (AIA) + */ + index_end = (char*)&index->index + + le32_to_cpu(index->index.index_length); + ie = (INDEX_ENTRY*)((char*)&index->index + + le32_to_cpu(index->index.entries_offset)); + /* + * Loop until we exceed valid memory (corruption case) or until we + * reach the last entry. + */ + while ((char*)ie < index_end && !(ie->flags & INDEX_ENTRY_END)) { +/* +#ifdef DEBUG + Dprintf("file_name_attr1->file_name_length = %i\n", + file_name->file_name_length); + if (file_name->file_name_length) { + char *__buf; + __buf = (char*)calloc(1, file_name->file_name_length + + 1); + if (!__buf) + err_exit("Failed to allocate internal buffer: " + "%s\n", strerror(errno)); + i = ucstos(__buf, (uchar_t*)&file_name->file_name, + file_name->file_name_length + 1); + if (i == -1) + Dprintf("Name contains non-displayable " + "Unicode characters.\n"); + Dprintf("file_name_attr1->file_name = %s\n", __buf); + free(__buf); + } + Dprintf("file_name_attr2->file_name_length = %i\n", + ie->key.file_name.file_name_length); + if (ie->key.file_name.file_name_length) { + char *__buf; + __buf = (char*)calloc(1, + ie->key.file_name.file_name_length + 1); + if (!__buf) + err_exit("Failed to allocate internal buffer: " + "%s\n", strerror(errno)); + i = ucstos(__buf, ie->key.file_name.file_name, + ie->key.file_name.file_name_length + 1); + if (i == -1) + Dprintf("Name contains non-displayable " + "Unicode characters.\n"); + Dprintf("file_name_attr2->file_name = %s\n", __buf); + free(__buf); + } +#endif +*/ + i = ntfs_file_compare_values(file_name, + (FILE_NAME_ATTR*)&ie->key.file_name, 1, + IGNORE_CASE, vol->upcase, vol->upcase_len); + /* + * If @file_name collates before ie->key.file_name, there is no + * matching index entry. + */ + if (i == -1) + break; + /* If file names are not equal, continue search. */ + if (i) + goto do_next; + /* File names are equal when compared ignoring case. */ + /* + * If BOTH file names are in the POSIX namespace, do a case + * sensitive comparison as well. Otherwise the names match so + * we return -EEXIST. FIXME: There are problems with this in a + * real world scenario, when one is POSIX and one isn't, but + * fine for mkntfs where we don't use POSIX namespace at all + * and hence this following code is luxury. (AIA) + */ + if (file_name->file_name_type != FILE_NAME_POSIX || + ie->key.file_name.file_name_type != FILE_NAME_POSIX) + return -EEXIST; + i = ntfs_file_compare_values(file_name, + (FILE_NAME_ATTR*)&ie->key.file_name, 1, + CASE_SENSITIVE, vol->upcase, vol->upcase_len); + if (i == -1) + break; + /* Complete match. Bugger. Can't insert. */ + if (!i) + return -EEXIST; +do_next: +#ifdef DEBUG + /* Next entry. */ + if (!ie->length) { + Dprintf("BUG: ie->length is zero, breaking out of " + "loop.\n"); + break; + } +#endif + ie = (INDEX_ENTRY*)((char*)ie + le16_to_cpu(ie->length)); + }; + i = (sizeof(INDEX_ENTRY_HEADER) + file_name_size + 7) & ~7; + err = make_room_for_index_entry_in_index_block(index, ie, i); + if (err) { + Eprintf("make_room_for_index_entry_in_index_block failed: " + "%s\n", strerror(-err)); + return err; + } + /* Create entry in place and copy file name attribute value. */ + ie->indexed_file = file_ref; + ie->length = cpu_to_le16(i); + ie->key_length = cpu_to_le16(file_name_size); + ie->flags = cpu_to_le16(0); + ie->reserved = cpu_to_le16(0); + memcpy((char*)&ie->key.file_name, (char*)file_name, file_name_size); + return 0; +} + +/* + * Create a file_name_attribute in the mft record @m_file which points to the + * parent directory with mft reference @ref_parent. + * + * Then, insert an index entry with this file_name_attribute in the index + * block @index of the index allocation attribute of the parent directory. + * + * @ref_file is the mft reference of @m_file. + * + * Return 0 on success or -errno on error. + */ +int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, + MFT_RECORD *m_file, const MFT_REF ref_file, + const s64 allocated_size, const s64 data_size, + const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, + const u32 reparse_point_tag, const char *file_name, + const FILE_NAME_TYPE_FLAGS file_name_type) +{ + FILE_NAME_ATTR *fn; + int i, fn_size; + + /* Create the file_name attribute. */ + i = (strlen(file_name) + 1) * sizeof(uchar_t); + fn_size = sizeof(FILE_NAME_ATTR) + i; + fn = (FILE_NAME_ATTR*)malloc(fn_size); + if (!fn) + return -errno; + fn->parent_directory = ref_parent; + // FIXME: Is this correct? Or do we have to copy the creation_time + // from the std info? + fn->creation_time = time2ntfs(time(NULL)); + fn->last_data_change_time = fn->creation_time; + fn->last_mft_change_time = fn->creation_time; + fn->last_access_time = fn->creation_time; + fn->allocated_size = cpu_to_le64(allocated_size); + fn->data_size = cpu_to_le64(data_size); + fn->file_attributes = flags; + /* These are in a union so can't have both. */ + if (packed_ea_size && reparse_point_tag) { + free(fn); + return -EINVAL; + } + if (packed_ea_size) { + fn->packed_ea_size = cpu_to_le16(packed_ea_size); + fn->reserved = cpu_to_le16(0); + } else + fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); + fn->file_name_type = file_name_type; + i = stoucs(fn->file_name, file_name, i); + if (i < 1) { + free(fn); + return -EINVAL; + } + if (i > 0xff) { + free(fn); + return -ENAMETOOLONG; + } + /* No terminating null in file names. */ + fn->file_name_length = i; + fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(uchar_t); + /* Increment the link count of @m_file. */ + i = le16_to_cpu(m_file->link_count); + if (i == 0xffff) { + Eprintf("Too many hardlinks present already.\n"); + free(fn); + return -EINVAL; + } + m_file->link_count = cpu_to_le16(i + 1); + /* Add the file_name to @m_file. */ + i = insert_resident_attr_in_mft_record(m_file, AT_FILE_NAME, NULL, 0, 0, + 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size); + if (i < 0) { + Eprintf("create_hardlink failed adding file name attribute: " + "%s\n", strerror(-i)); + free(fn); + /* Undo link count increment. */ + m_file->link_count = cpu_to_le16( + le16_to_cpu(m_file->link_count) - 1); + return i; + } + /* Insert the index entry for file_name in @index. */ + i = insert_file_link_in_dir_index(index, ref_file, fn, fn_size); + if (i < 0) { + Eprintf("create_hardlink failed inserting index entry: %s\n", + strerror(-i)); + /* FIXME: Remove the file name attribute from @m_file. */ + free(fn); + /* Undo link count increment. */ + m_file->link_count = cpu_to_le16( + le16_to_cpu(m_file->link_count) - 1); + return i; + } + free(fn); + return 0; +} + +void init_options() +{ + memset(&opt, 0, sizeof(opt)); + opt.index_block_size = 4096; + opt.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; + opt.attr_defs_len = sizeof(attrdef_ntfs12_array); + //Dprintf("Attr_defs table length = %u\n", opt.attr_defs_len); +} + +void usage(void) __attribute__ ((noreturn)); + +void usage(void) +{ + fprintf(stderr, "Copyright (c) 2001,2002 Anton Altaparmakov.\n" + "Create an NTFS volume on a user specified (block) device.\n" + "Usage: %s [-s sector-size] [-c cluster-size] " + "[-L volume-label]\n\t[-z mft-zone-multiplier] " + "[-fnqvvCFIQV] device [number-of-sectors]\n", + EXEC_NAME); + exit(1); +} + +void parse_options(int argc, char *argv[]) +{ + int c; + long l; + unsigned long u; + char *s; + +// Need to have: mft record size, index record size, ntfs version, mft size, +// logfile size, list of bad blocks, check for bad blocks, ... + if (argc && *argv) + EXEC_NAME = *argv; + fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); + while ((c = getopt(argc, argv, "c:fnqs:vz:CFIL:QV")) != EOF) + switch (c) { + case 'n': + opt.no_action = 1; + break; + case 'c': + l = strtol(optarg, &s, 0); + if (!l || l > INT_MAX || *s) + err_exit("Invalid cluster size.\n"); + vol->cluster_size = l; + break; + case 'f': + case 'Q': + opt.quick_format = 1; + break; + case 'q': + opt.quiet = 1; + break; + case 's': + l = strtol(optarg, &s, 0); + if (!l || l > INT_MAX || *s) + err_exit("Invalid sector size.\n"); + opt.sector_size = l; + break; + case 'v': + opt.verbose++; + break; + case 'z': + l = strtol(optarg, &s, 0); + if (l < 1 || l > 4 || *s) + err_exit("Invalid MFT zone multiplier.\n"); + opt.mft_zone_multiplier = l; + break; + case 'C': + opt.enable_compression = 1; + break; + case 'F': + opt.force = 1; + break; + case 'I': + opt.disable_indexing = 1; + break; + case 'L': + vol->vol_name = optarg; + break; + case 'V': + /* Version number already printed, so just exit. */ + exit(0); + default: + usage(); + } + if (optind == argc) + usage(); + vol->dev_name = argv[optind++]; + if (optind < argc) { + u = strtoul(argv[optind++], &s, 0); + if (*s || !u || (u >= ULONG_MAX && errno == ERANGE)) + err_exit("Invalid number of sectors: %s\n", + argv[optind - 1]); + opt.nr_sectors = u; + } + if (optind < argc) + usage(); +} + +void mkntfs_exit(void) +{ + int err; + + if (index_block) + free(index_block); + if (buf) + free(buf); + if (buf2) + free(buf2); + if (lcn_bitmap) + free(lcn_bitmap); + if (mft_bitmap) + free(mft_bitmap); + if (rl) + free(rl); + if (rl_mft) + free(rl_mft); + if (rl_mft_bmp) + free(rl_mft_bmp); + if (rl_mftmirr) + free(rl_mftmirr); + if (rl_logfile) + free(rl_logfile); + if (rl_boot) + free(rl_boot); + if (rl_bad) + free(rl_bad); + if (rl_index) + free(rl_index); + if (opt.bad_blocks) + free(opt.bad_blocks); + if (opt.attr_defs != (ATTR_DEF*)attrdef_ntfs12_array) + free(opt.attr_defs); + if (vol->upcase) + free(vol->upcase); + flk.l_type = F_UNLCK; + err = fcntl(vol->fd, F_SETLK, &flk); + if (err == -1) + Eprintf("Warning: Could not unlock %s: %s\n", vol->dev_name, + strerror(errno)); + err = close(vol->fd); + if (err == -1) + Eprintf("Warning: Could not close %s: %s\n", vol->dev_name, + strerror(errno)); + if (vol) + free(vol); +} + +#define MAKE_MFT_REF(_ref, _seqno) cpu_to_le64((((u64)(_seqno)) << 48) \ + | ((u64)(_ref))) + +static inline int valid_offset(int f, long long ofs) +{ + char ch; + + if (lseek(f, ofs, SEEK_SET) >= 0 && read(f, &ch, 1) == 1) + return 1; + return 0; +} + +/* + * Returns the number of bs sized blocks in a partition. Adapted from + * e2fsutils-1.19, Copyright (C) 1995 Theodore Ts'o. + */ +long long get_device_size(int f, int bs) +{ + long long high, low; +#ifdef BLKGETSIZE + long size; + + if (ioctl(f, BLKGETSIZE, &size) >= 0) { + Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, + size); + return (long long)size * 512 / bs; + } +#endif +#ifdef FDGETPRM + { struct floppy_struct this_floppy; + + if (ioctl(f, FDGETPRM, &this_floppy) >= 0) { + Dprintf("FDGETPRM nr 512 byte blocks = %ld (0x%ld)\n", + this_floppy.size, this_floppy.size); + return (long long)this_floppy.size * 512 / bs; + } + } +#endif + /* + * We couldn't figure it out by using a specialized ioctl, + * so do binary search to find the size of the partition. + */ + low = 0LL; + for (high = 1024LL; valid_offset(f, high); high <<= 1) + low = high; + while (low < high - 1LL) { + const long long mid = (low + high) / 2; + + if (valid_offset(f, mid)) + low = mid; + else + high = mid; + } + lseek(f, 0LL, SEEK_SET); + return (low + 1LL) / bs; +} + +int main(int argc, char **argv) +{ + int i, j, err; + ssize_t bw; + struct stat sbuf; + long long lw, pos; + MFT_RECORD *m; + ATTR_RECORD *a; + MFT_REF root_ref; + ntfs_attr_search_ctx *ctx; + char *sd; + NTFS_BOOT_SECTOR *bs; + unsigned long mnt_flags; + + /* Initialize the random number generator with the current time. */ + srandom(time(NULL)); + /* Initialize ntfs_volume structure vol. */ + vol = (ntfs_volume*)calloc(1, sizeof(*vol)); + if (!vol) + err_exit("Could not allocate memory for internal buffer.\n"); + vol->major_ver = 1; + vol->minor_ver = 2; + vol->mft_record_size = 1024; + vol->mft_record_size_bits = 10; + /* Length is in unicode characters. */ + vol->upcase_len = 65536; + vol->upcase = (uchar_t*)malloc(vol->upcase_len * sizeof(uchar_t)); + if (!vol->upcase) + err_exit("Could not allocate memory for internal buffer.\n"); + init_upcase_table(vol->upcase, vol->upcase_len * sizeof(uchar_t)); + /* Initialize opt to zero / required values. */ + init_options(); + /* Parse command line options. */ + parse_options(argc, argv); + /* Verify we are dealing with a block device. */ + if (stat(vol->dev_name, &sbuf) == -1) { + if (errno == ENOENT) + err_exit("The device doesn't exist; did you specify " + "it correctly?\n"); + err_exit("Error getting information about %s: %s\n", + vol->dev_name, strerror(errno)); + } + if (!S_ISBLK(sbuf.st_mode)) { + Eprintf("%s is not a block device.\n", vol->dev_name); + if (!opt.force) + err_exit("Refusing to make a filesystem here!\n"); + if (!opt.nr_sectors) { + if (!sbuf.st_size && !sbuf.st_blocks) + err_exit("You must specify the number of " + "sectors.\n"); + if (opt.sector_size) { + if (sbuf.st_size) + opt.nr_sectors = sbuf.st_size / + opt.sector_size; + else + opt.nr_sectors = ((s64)sbuf.st_blocks + << 9) / opt.sector_size; + } else { + if (sbuf.st_size) + opt.nr_sectors = sbuf.st_size / 512; + else + opt.nr_sectors = sbuf.st_blocks; + opt.sector_size = 512; + } + } + fprintf(stderr, "mkntfs forced anyway.\n"); + } +#ifdef HAVE_LINUX_MAJOR_H + else if ((MAJOR(sbuf.st_rdev) == HD_MAJOR && + MINOR(sbuf.st_rdev) % 64 == 0) || + (SCSI_BLK_MAJOR(MAJOR(sbuf.st_rdev)) && + MINOR(sbuf.st_rdev) % 16 == 0)) { + err_exit("%s is entire device, not just one partition!\n", + vol->dev_name); + } +#endif + /* Make sure the file system is not mounted. */ + if (ntfs_check_if_mounted(vol->dev_name, &mnt_flags)) + Eprintf("Failed to determine whether %s is mounted: %s\n", + vol->dev_name, strerror(errno)); + else if (mnt_flags & NTFS_MF_MOUNTED) { + Eprintf("%s is mounted.\n", vol->dev_name); + if (!opt.force) + err_exit("Refusing to make a filesystem here!\n"); + fprintf(stderr, "mkntfs forced anyway. Hope /etc/mtab is " + "incorrect.\n"); + } + + /* Open the device for reading or reading and writing. */ + if (opt.no_action) { + Qprintf("Running in READ-ONLY mode!\n"); + i = O_RDONLY; + } else + i = O_RDWR; + vol->fd = open(vol->dev_name, i); + if (vol->fd == -1) + err_exit("Could not open %s: %s\n", vol->dev_name, + strerror(errno)); + /* Acquire exlusive (mandatory) write lock on the whole device. */ + memset(&flk, 0, sizeof(flk)); + if (opt.no_action) + flk.l_type = F_RDLCK; + else + flk.l_type = F_WRLCK; + flk.l_whence = SEEK_SET; + flk.l_start = flk.l_len = 0LL; + err = fcntl(vol->fd, F_SETLK, &flk); + if (err == -1) { + Eprintf("Could not lock %s for %s: %s\n", vol->dev_name, + opt.no_action ? "reading" : "writing", + strerror(errno)); + err = close(vol->fd); + if (err == -1) + Eprintf("Warning: Could not close %s: %s\n", + vol->dev_name, strerror(errno)); + exit(1); + } + /* Register our exit function which will unlock and close the device. */ + err = atexit(&mkntfs_exit); + if (err == -1) { + Eprintf("Could not set up exit() function because atexit() " + "failed. Aborting...\n"); + mkntfs_exit(); + exit(1); + } + /* If user didn't specify the sector size, determine it now. */ + if (!opt.sector_size) { +#ifdef BLKSSZGET + int _sect_size = 0; + + if (ioctl(vol->fd, BLKSSZGET, &_sect_size) >= 0) + opt.sector_size = _sect_size; + else +#endif + { + Eprintf("No sector size specified for %s and it could " + "not be obtained automatically.\n" + "Assuming sector size is 512 bytes.\n", + vol->dev_name); + opt.sector_size = 512; + } + } + /* Validate sector size. */ + if ((opt.sector_size - 1) & opt.sector_size || + opt.sector_size < 256 || opt.sector_size > 4096) + err_exit("Error: sector_size is invalid. It must be a power " + "of two, and it must be\n greater or equal 256 and " + "less than or equal 4096 bytes.\n"); + Dprintf("sector size = %i bytes\n", opt.sector_size); + /* If user didn't specify the number of sectors, determine it now. */ + if (!opt.nr_sectors) { + opt.nr_sectors = get_device_size(vol->fd, opt.sector_size); + if (opt.nr_sectors <= 0) + err_exit("get_device_size(%s) failed. Please specify " + "it manually.\n", vol->dev_name); + } + Dprintf("number of sectors = %Ld (0x%Lx)\n", opt.nr_sectors, + opt.nr_sectors); + /* Reserve the last sector for the backup boot sector. */ + opt.nr_sectors--; + /* If user didn't specify the volume size, determine it now. */ + if (!opt.volume_size) + opt.volume_size = opt.nr_sectors * opt.sector_size; + else if (opt.volume_size & (opt.sector_size - 1)) + err_exit("Error: volume_size is not a multiple of " + "sector_size.\n"); + /* Validate volume size. */ + if (opt.volume_size < 1 << 20 /* 1MiB */) + err_exit("Error: device is too small (%ikiB). Minimum NTFS " + "volume size is 1MiB.\n", opt.volume_size / 1024); + Dprintf("volume size = %LikiB\n", opt.volume_size / 1024); + /* If user didn't specify the cluster size, determine it now. */ + if (!vol->cluster_size) { + if (opt.volume_size <= 512LL << 20) /* <= 512MB */ + vol->cluster_size = 512; + else if (opt.volume_size <= 1LL << 30) /* ]512MB-1GB] */ + vol->cluster_size = 1024; + else if (opt.volume_size <= 2LL << 30) /* ]1GB-2GB] */ + vol->cluster_size = 2048; + else + vol->cluster_size = 4096; + /* For small volumes on devices with large sector sizes. */ + if (vol->cluster_size < opt.sector_size) + vol->cluster_size = opt.sector_size; + } + /* Validate cluster size. */ + if (vol->cluster_size & (vol->cluster_size - 1) || + vol->cluster_size < opt.sector_size || + vol->cluster_size > 128 * opt.sector_size || + vol->cluster_size > 65536) + err_exit("Error: cluster_size is invalid. It must be a power " + "of two, be at least\nthe same as sector_size, be " + "maximum 64kB, and the sectors per cluster value " + "has\nto fit inside eight bits. (We do not support " + "larger cluster sizes yet.)\n"); + vol->cluster_size_bits = ffs(vol->cluster_size) - 1; + Dprintf("cluster size = %i bytes\n", vol->cluster_size); + if (vol->cluster_size > 4096) { + if (opt.enable_compression) { + if (!opt.force) + err_exit("Error: cluster_size is above 4096 " + "bytes and compression is " + "requested.\nThis is not " + "possible due to limitations " + "in the compression algorithm " + "used by\nWindows.\n"); + opt.enable_compression = 0; + } + Qprintf("Warning: compression will be disabled on this volume " + "because it is not\nsupported when the cluster " + "size is above 4096 bytes. This is due to \n" + "limitations in the compression algorithm used " + "by Windows.\n"); + } + /* If user didn't specify the number of clusters, determine it now. */ + if (!opt.nr_clusters) + opt.nr_clusters = opt.volume_size / vol->cluster_size; + /* + * Check the cluster_size and nr_sectors for consistency with + * sector_size and nr_sectors. And check both of these for consistency + * with volume_size. + */ + if (opt.nr_clusters != (opt.nr_sectors * opt.sector_size) / + vol->cluster_size || + opt.volume_size / opt.sector_size != opt.nr_sectors || + opt.volume_size / vol->cluster_size != opt.nr_clusters) + err_exit("Illegal combination of volume/cluster/sector size " + "and/or cluster/sector number.\n"); + Dprintf("number of clusters = %Lu (0x%Lx)\n", opt.nr_clusters, + opt.nr_clusters); + /* Determine lcn bitmap byte size and allocate it. */ + lcn_bitmap_byte_size = (opt.nr_clusters + 7) >> 3; + /* Needs to be multiple of 8 bytes. */ + lcn_bitmap_byte_size = (lcn_bitmap_byte_size + 7) & ~7; + i = (lcn_bitmap_byte_size + vol->cluster_size - 1) & + ~(vol->cluster_size - 1); + Dprintf("lcn_bitmap_byte_size = %i, allocated = %i\n", + lcn_bitmap_byte_size, i); + lcn_bitmap = (unsigned char *)calloc(1, lcn_bitmap_byte_size); + if (!lcn_bitmap) + err_exit("Failed to allocate internal buffer: %s", + strerror(errno)); + /* + * $Bitmap can overlap the end of the volume. Any bits in this region + * must be set. This region also encompasses the backup boot sector. + */ + for (i = opt.nr_clusters; i < lcn_bitmap_byte_size << 3; i++) + ntfs_set_bit(lcn_bitmap, (u64)i, 1); + /* + * Determine mft_size: 16 mft records or 1 cluster, which ever is + * bigger, rounded to multiples of cluster size. + */ + opt.mft_size = (16 * vol->mft_record_size + vol->cluster_size - 1) + & ~(vol->cluster_size - 1); + Dprintf("MFT size = %i (0x%x) bytes\n", opt.mft_size, opt.mft_size); + /* Determine mft bitmap size and allocate it. */ + mft_bitmap_size = opt.mft_size / vol->mft_record_size; + /* Convert to bytes, at least one. */ + mft_bitmap_byte_size = (mft_bitmap_size + 7) >> 3; + /* Mft bitmap is allocated in multiples of 8 bytes. */ + mft_bitmap_byte_size = (mft_bitmap_byte_size + 7) & ~7; + Dprintf("mft_bitmap_size = %i, mft_bitmap_byte_size = %i\n", + mft_bitmap_size, mft_bitmap_byte_size); + mft_bitmap = (unsigned char *)calloc(1, mft_bitmap_byte_size); + if (!mft_bitmap) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + /* Create run list for mft bitmap. */ + rl_mft_bmp = (run_list *)malloc(2 * sizeof(run_list)); + if (!rl_mft_bmp) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + rl_mft_bmp[0].vcn = 0LL; + /* Mft bitmap is right after $Boot's data. */ + j = (8192 + vol->cluster_size - 1) / vol->cluster_size; + rl_mft_bmp[0].lcn = j; + /* + * Size is always one cluster, even though valid data size and + * initialized data size are only 8 bytes. + */ + rl_mft_bmp[1].vcn = rl_mft_bmp[0].length = 1LL; + rl_mft_bmp[1].lcn = -1LL; + rl_mft_bmp[1].length = 0LL; + /* Allocate cluster for mft bitmap. */ + ntfs_set_bit(lcn_bitmap, (s64)j, 1); + /* If user didn't specify the mft lcn, determine it now. */ + if (!opt.mft_lcn) { + /* + * We start at the higher value out of 16kiB and just after the + * mft bitmap. + */ + opt.mft_lcn = rl_mft_bmp[0].lcn + rl_mft_bmp[0].length; + if (opt.mft_lcn * vol->cluster_size < 16 * 1024) + opt.mft_lcn = (16 * 1024 + vol->cluster_size - 1) / + vol->cluster_size; + } + Dprintf("$MFT logical cluster number = 0x%x\n", opt.mft_lcn); + /* Determine MFT zone size. */ + opt.mft_zone_end = opt.nr_clusters; + switch (opt.mft_zone_multiplier) { /* % of volume size in clusters */ + case 4: + opt.mft_zone_end = opt.mft_zone_end >> 1; /* 50% */ + break; + case 3: + opt.mft_zone_end = opt.mft_zone_end * 3 >> 3; /* 37.5% */ + break; + case 2: + opt.mft_zone_end = opt.mft_zone_end >> 2; /* 25% */ + break; + /* case 1: */ + default: + opt.mft_zone_end = opt.mft_zone_end >> 3; /* 12.5% */ + break; + } + Dprintf("MFT zone size = %lukiB\n", opt.mft_zone_end / 1024); + /* + * The mft zone begins with the mft data attribute, not at the beginning + * of the device. + */ + opt.mft_zone_end += opt.mft_lcn; + /* Create run list for mft. */ + rl_mft = (run_list *)malloc(2 * sizeof(run_list)); + if (!rl_mft) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + rl_mft[0].vcn = 0LL; + rl_mft[0].lcn = opt.mft_lcn; + /* We already rounded mft size up to a cluster. */ + j = opt.mft_size / vol->cluster_size; + rl_mft[1].vcn = rl_mft[0].length = j; + rl_mft[1].lcn = -1LL; + rl_mft[1].length = 0LL; + /* Allocate clusters for mft. */ + for (i = 0; i < j; i++) + ntfs_set_bit(lcn_bitmap, opt.mft_lcn + i, 1); + /* Determine mftmirr_lcn (middle of volume). */ + opt.mftmirr_lcn = (opt.nr_sectors * opt.sector_size >> 1) + / vol->cluster_size; + Dprintf("$MFTMirr logical cluster number = 0x%x\n", opt.mftmirr_lcn); + /* Create run list for mft mirror. */ + rl_mftmirr = (run_list *)malloc(2 * sizeof(run_list)); + if (!rl_mftmirr) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + rl_mftmirr[0].vcn = 0LL; + rl_mftmirr[0].lcn = opt.mftmirr_lcn; + /* + * The mft mirror is either 4kb (the first four records) or one cluster + * in size, which ever is bigger. In either case, it contains a + * byte-for-byte identical copy of the beginning of the mft (i.e. either + * ther first four records (4kb) or the first cluster worth of records, + * whichever is bigger). + */ + j = (4 * vol->mft_record_size + vol->cluster_size - 1) / vol->cluster_size; + rl_mftmirr[1].vcn = rl_mftmirr[0].length = j; + rl_mftmirr[1].lcn = -1LL; + rl_mftmirr[1].length = 0LL; + /* Allocate clusters for mft mirror. */ + for (i = 0; i < j; i++) + ntfs_set_bit(lcn_bitmap, opt.mftmirr_lcn + i, 1); + opt.logfile_lcn = opt.mftmirr_lcn + j; + Dprintf("$LogFile logical cluster number = 0x%x\n", opt.logfile_lcn); + /* Create run list for log file. */ + rl_logfile = (run_list *)malloc(2 * sizeof(run_list)); + if (!rl_logfile) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + rl_logfile[0].vcn = 0LL; + rl_logfile[0].lcn = opt.logfile_lcn; + /* + * Determine logfile_size from volume_size (rounded up to a cluster), + * making sure it does not overflow the end of the volume. + */ + if (opt.volume_size < 2048LL * 1024) /* < 2MiB */ + opt.logfile_size = 256LL * 1024; /* -> 256kiB */ + else if (opt.volume_size < 4000000LL) /* < 4MB */ + opt.logfile_size = 512LL * 1024; /* -> 512kiB */ + else if (opt.volume_size <= 200LL * 1024 * 1024)/* < 200MiB */ + opt.logfile_size = 2048LL * 1024; /* -> 2MiB */ + else if (opt.volume_size >= 400LL << 20) /* > 400MiB */ + opt.logfile_size = 4 << 20; /* -> 4MiB */ + else + opt.logfile_size = (opt.volume_size / 100) & + ~(vol->cluster_size - 1); + j = opt.logfile_size / vol->cluster_size; + while (rl_logfile[0].lcn + j >= opt.nr_clusters) { + /* + * $Logfile would overflow volume. Need to make it smaller than + * the standard size. It's ok as we are creating a non-standard + * volume anyway if it is that small. + */ + opt.logfile_size >>= 1; + j = opt.logfile_size / vol->cluster_size; + } + opt.logfile_size = (opt.logfile_size + vol->cluster_size - 1) & + ~(vol->cluster_size - 1); + Dprintf("$LogFile (journal) size = %ikiB\n", opt.logfile_size / 1024); + /* + * FIXME: The 256kiB limit is arbitrary. Should find out what the real + * minimum requirement for Windows is so it doesn't blue screen. + */ + if (opt.logfile_size < 256 << 10) + err_exit("$LogFile would be created with invalid size. This " + "is not allowed as it would cause Windows to " + "blue screen and during boot.\n"); + rl_logfile[1].vcn = rl_logfile[0].length = j; + rl_logfile[1].lcn = -1LL; + rl_logfile[1].length = 0LL; + /* Allocate clusters for log file. */ + for (i = 0; i < j; i++) + ntfs_set_bit(lcn_bitmap, opt.logfile_lcn + i, 1); + /* Create run list for $Boot. */ + rl_boot = (run_list *)malloc(2 * sizeof(run_list)); + if (!rl_boot) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + rl_boot[0].vcn = 0LL; + rl_boot[0].lcn = 0LL; + /* + * $Boot is always 8192 (0x2000) bytes or 1 cluster, whichever is + * bigger. + */ + j = (8192 + vol->cluster_size - 1) / vol->cluster_size; + rl_boot[1].vcn = rl_boot[0].length = j; + rl_boot[1].lcn = -1LL; + rl_boot[1].length = 0LL; + /* Allocate clusters for $Boot. */ + for (i = 0; i < j; i++) + ntfs_set_bit(lcn_bitmap, 0LL + i, 1); + /* Allocate a buffer large enough to hold the mft. */ + buf = calloc(1, opt.mft_size); + if (!buf) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + /* Create run list for $BadClus, $DATA named stream $Bad. */ + rl_bad = (run_list *)malloc(2 * sizeof(run_list)); + if (!rl_bad) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + rl_bad[0].vcn = 0LL; + rl_bad[0].lcn = -1LL; + /* + * $BadClus named stream $Bad contains the whole volume as a single + * sparse run list entry. + */ + rl_bad[1].vcn = rl_bad[0].length = opt.nr_clusters; + rl_bad[1].lcn = -1LL; + rl_bad[1].length = 0LL; + + // TODO: Mark bad blocks as such. + + /* + * If not quick format, fill the device with 0s. + * FIXME: Except bad blocks! (AIA) + */ + if (!opt.quick_format) { + unsigned long position; + unsigned long mid_clust; + float progress_inc = (float)opt.nr_clusters / 100; + + Qprintf("Initialising device with zeroes: 0%%"); + fflush(stdout); + mid_clust = (opt.volume_size >> 1) / vol->cluster_size; + for (position = 0; position < opt.nr_clusters; position++) { + if (!(position % (int)(progress_inc+1))) { + Qprintf("\b\b\b\b%3.0f%%", position / + progress_inc); + fflush(stdout); + } + bw = mkntfs_write(vol->fd, buf, vol->cluster_size); + if (bw != vol->cluster_size) { + if (bw != -1 || errno != EIO) + err_exit("This should not happen.\n"); + if (!position) + err_exit("Error: Cluster zero is bad. " + "Cannot create NTFS file " + "system.\n"); + if (position == mid_clust && + (vol->major_ver < 1 || + (vol->major_ver == 1 && + vol->minor_ver < 2))) + err_exit("Error: Bad cluster found in " + "location reserved for system " + "file $Boot.\n"); + /* Add the baddie to our bad blocks list. */ + append_to_bad_blocks(position); + Qprintf("\nFound bad cluster (%ld). Adding to " + "list of bad blocks.\nInitialising " + "device with zeroes: %3.0i%%", position, + position / progress_inc); + /* Seek to next cluster. */ + lseek(vol->fd, ((off_t)position + 1) * + vol->cluster_size, SEEK_SET); + } + } + Qprintf("\b\b\b\b100%%"); + position = (opt.volume_size & (vol->cluster_size - 1)) / + opt.sector_size; + for (i = 0; i < position; i++) { + bw = mkntfs_write(vol->fd, buf, opt.sector_size); + if (bw != opt.sector_size) { + if (bw != -1 || errno != EIO) + err_exit("This should not happen.\n"); + else if (i + 1 == position && + (vol->major_ver >= 2 || + (vol->major_ver == 1 && + vol->minor_ver >= 2))) + err_exit("Error: Bad cluster found in " + "location reserved for system " + "file $Boot.\n"); + /* Seek to next sector. */ + lseek(vol->fd, opt.sector_size, SEEK_CUR); + } + } + Qprintf(" - Done.\n"); + } + Qprintf("Creating NTFS volume structures.\n"); + /* Setup an empty mft record. */ + format_mft_record((MFT_RECORD*)buf); + /* + * Copy the mft record onto all 16 records in the buffer and setup the + * sequence numbers of each system file to equal the mft record number + * of that file (only for $MFT is the sequence number 1 rather than 0). + */ + for (i = 1; i < 16; i++) { + m = (MFT_RECORD*)(buf + i * vol->mft_record_size); + memcpy(m, buf, vol->mft_record_size); + m->sequence_number = cpu_to_le16(i); + } + /* + * If a cluster contains more than the 16 system files, fill the rest + * with empty, formatted records. + */ + if (vol->cluster_size > 16 * vol->mft_record_size) { + for (i = 16; i * vol->mft_record_size < vol->cluster_size; i++) + memcpy(buf + i * vol->mft_record_size, buf, + vol->mft_record_size); + } + /* + * Create the 16 system files, adding the system information attribute + * to each as well as marking them in use in the mft bitmap. + */ + for (i = 0; i < 16; i++) { + u32 file_attrs; + + m = (MFT_RECORD*)(buf + i * vol->mft_record_size); + m->flags |= MFT_RECORD_IN_USE; + ntfs_set_bit(mft_bitmap, 0LL + i, 1); + file_attrs = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM; + if (i == FILE_root) { + if (opt.disable_indexing) + file_attrs |= FILE_ATTR_NOT_CONTENT_INDEXED; + if (opt.enable_compression) + file_attrs |= FILE_ATTR_COMPRESSED; + } + add_attr_std_info(m, file_attrs); + // dump_mft_record(m); + } + /* The root directory mft reference. */ + root_ref = MAKE_MFT_REF(FILE_root, FILE_root); + Vprintf("Creating root directory (mft record 5)\n"); + m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_DIRECTORY; + m->link_count = cpu_to_le16(le16_to_cpu(m->link_count) + 1); + err = add_attr_file_name(m, root_ref, 0LL, 0LL, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | + FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, + ".", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_root, &sd, &i); + err = add_attr_sd(m, sd, i); + } + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, + COLLATION_FILE_NAME, opt.index_block_size); + // FIXME: This should be IGNORE_CASE + if (!err) + err = upgrade_to_large_index(m, "$I30", 4, 0, &index_block); + if (!err) { + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) + err_exit("Failed to allocate attribute search " + "context: %s\n", strerror(errno)); + /* There is exactly one file name so this is ok. */ + if (ntfs_lookup_attr(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, + ctx)) { + ntfs_put_attr_search_ctx(ctx); + err_exit("BUG: $FILE_NAME attribute not found.\n"); + } + a = ctx->attr; + err = insert_file_link_in_dir_index(index_block, root_ref, + (FILE_NAME_ATTR*)((char*)a + + le16_to_cpu(a->value_offset)), + le32_to_cpu(a->value_length)); + ntfs_put_attr_search_ctx(ctx); + } + if (err) + err_exit("Couldn't create root directory: %s\n", + strerror(-err)); + // dump_mft_record(m); + /* Add all other attributes, on a per-file basis for clarity. */ + Vprintf("Creating $MFT (mft record 0)\n"); + m = (MFT_RECORD*)buf; + err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mft, buf, + opt.mft_size); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_MFT, 1), opt.mft_size, + opt.mft_size, FILE_ATTR_HIDDEN | + FILE_ATTR_SYSTEM, 0, 0, "$MFT", + FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_MFT, &sd, &i); + err = add_attr_sd(m, sd, i); + } + /* mft_bitmap is not modified in mkntfs; no need to sync it later. */ + if (!err) + err = add_attr_bitmap_positioned(m, NULL, 0, 0, rl_mft_bmp, + mft_bitmap, mft_bitmap_byte_size); + if (err < 0) + err_exit("Couldn't create $MFT: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $MFTMirr (mft record 1)\n"); + m = (MFT_RECORD*)(buf + 1 * vol->mft_record_size); + err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mftmirr, buf, + rl_mftmirr[0].length * vol->cluster_size); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_MFTMirr, FILE_MFTMirr), + rl_mftmirr[0].length * vol->cluster_size, + rl_mftmirr[0].length * vol->cluster_size, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$MFTMirr", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_MFTMirr, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $MFTMirr: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $LogFile (mft record 2)\n"); + m = (MFT_RECORD*)(buf + 2 * vol->mft_record_size); + buf2 = malloc(opt.logfile_size); + if (!buf2) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + memset(buf2, -1, opt.logfile_size); + err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_logfile, buf2, + opt.logfile_size); + free(buf2); + buf2 = NULL; + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_LogFile, FILE_LogFile), + opt.logfile_size, opt.logfile_size, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$LogFile", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_LogFile, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $LogFile: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $Volume (mft record 3)\n"); + m = (MFT_RECORD*)(buf + 3 * vol->mft_record_size); + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_Volume, FILE_Volume), 0LL, 0LL, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$Volume", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_Volume, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (!err) + err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); + if (!err) + err = add_attr_vol_name(m, vol->vol_name, vol->vol_name ? + strlen(vol->vol_name) : 0); + if (!err) { + Qprintf("Setting the volume dirty so check disk runs on next " + "reboot into Windows.\n"); + err = add_attr_vol_info(m, VOLUME_IS_DIRTY, vol->major_ver, + vol->minor_ver); + } + if (err < 0) + err_exit("Couldn't create $Volume: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $AttrDef (mft record 4)\n"); + m = (MFT_RECORD*)(buf + 4 * vol->mft_record_size); + if (vol->major_ver < 3) + buf2_size = 36000; + else + buf2_size = opt.attr_defs_len; + buf2 = (char*)calloc(1, buf2_size); + if (!buf2) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + memcpy(buf2, opt.attr_defs, opt.attr_defs_len); + err = add_attr_data(m, NULL, 0, 0, 0, buf2, buf2_size); + free(buf2); + buf2 = NULL; + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_AttrDef, FILE_AttrDef), + (buf2_size + vol->cluster_size - 1) & + ~(vol->cluster_size - 1), buf2_size, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$AttrDef", FILE_NAME_WIN32_AND_DOS); + buf2_size = 0; + if (!err) { + init_system_file_sd(FILE_AttrDef, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $AttrDef: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $Bitmap (mft record 6)\n"); + m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); + err = add_attr_data(m, NULL, 0, 0, 0, lcn_bitmap, lcn_bitmap_byte_size); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_Bitmap, FILE_Bitmap), + (lcn_bitmap_byte_size + vol->cluster_size - 1) & + ~(vol->cluster_size - 1), lcn_bitmap_byte_size, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$Bitmap", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_Bitmap, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $Bitmap: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $Boot (mft record 7)\n"); + m = (MFT_RECORD*)(buf + 7 * vol->mft_record_size); + buf2 = calloc(1, 8192); + if (!buf2) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + memcpy(buf2, boot_array, sizeof(boot_array)); + /* + * Create the boot sector into buf2. Note, that buf2 already is zeroed + * in the boot sector section and that it has the NTFS OEM id/magic + * already inserted, so no need to worry about these things. + */ + bs = (NTFS_BOOT_SECTOR*)buf2; + bs->bpb.bytes_per_sector = cpu_to_le16(opt.sector_size); + bs->bpb.sectors_per_cluster = (u8)(vol->cluster_size / + opt.sector_size); + bs->bpb.media_type = 0xf8; /* hard disk */ + /* + * If there are problems go back to bs->unused[0-3] and set them. See + * ../include/bootsect.h for details. Other fields to also consider + * setting are: bs->bpb.sectors_per_track, .heads, and .hidden_sectors. + */ + bs->number_of_sectors = scpu_to_le64(opt.nr_sectors); + bs->mft_lcn = scpu_to_le64(opt.mft_lcn); + bs->mftmirr_lcn = scpu_to_le64(opt.mftmirr_lcn); + if (vol->mft_record_size >= vol->cluster_size) + bs->clusters_per_mft_record = vol->mft_record_size / + vol->cluster_size; + else { + bs->clusters_per_mft_record = -(ffs(vol->mft_record_size) - 1); + if ((1 << -bs->clusters_per_mft_record) != vol->mft_record_size) + err_exit("BUG: calculated clusters_per_mft_record " + "is wrong (= 0x%x)\n", + bs->clusters_per_mft_record); + } + Dprintf("Clusters per mft record = %i (0x%x)\n", + bs->clusters_per_mft_record, + bs->clusters_per_mft_record); + if (opt.index_block_size >= vol->cluster_size) + bs->clusters_per_index_record = opt.index_block_size / + vol->cluster_size; + else { + bs->clusters_per_index_record = -(ffs(opt.index_block_size) - 1); + if ((1 << -bs->clusters_per_index_record) != + opt.index_block_size) + err_exit("BUG: calculated clusters_per_index_record " + "is wrong (= 0x%x)\n", + bs->clusters_per_index_record); + } + Dprintf("Clusters per index block = %i (0x%x)\n", + bs->clusters_per_index_record, + bs->clusters_per_index_record); + /* Generate a 64-bit random number for the serial number. */ + bs->volume_serial_number = scpu_to_le64(((s64)random() << 32) | + ((s64)random() & 0xffffffff)); + /* + * Leave zero for now as NT4 leaves it zero, too. If want it later, see + * ../libntfs/bootsect.c for how to calculate it. + */ + bs->checksum = cpu_to_le32(0); + /* Make sure the bootsector is ok. */ + if (!is_boot_sector_ntfs(bs, opt.verbose > 0 ? 0 : 1)) + err_exit("FATAL: Generated boot sector is invalid!\n"); + err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_boot, buf2, 8192); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_Boot, FILE_Boot), + (8192 + vol->cluster_size - 1) & + ~(vol->cluster_size - 1), 8192, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$Boot", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_Boot, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $Boot: %s\n", strerror(-err)); + Vprintf("Creating backup boot sector.\n"); + /* + * Write the first max(512, opt.sector_size) bytes from buf2 to the + * last sector. + */ + if (lseek(vol->fd, (opt.nr_sectors + 1) * opt.sector_size - i, + SEEK_SET) == (off_t)-1) + goto bb_err; + bw = mkntfs_write(vol->fd, buf2, i); + free(buf2); + buf2 = NULL; + if (bw != i) { + int _e = errno; + char *_s; + + if (bw == -1LL) + _s = strerror(_e); + else + _s = "unknown error"; + if (bw != -1LL || (bw == -1LL && _e != ENOSPC)) { + err_exit("Couldn't write backup boot sector: %s\n", _s); +bb_err: + Eprintf("Seek failed: %s\n", strerror(errno)); + } + Eprintf("Couldn't write backup boot sector. This is due to a " + "limitation in the\nLinux kernel. This is not " + "a major problem as Windows check disk will " + "create the\nbackup boot sector when it " + "is run on your next boot into Windows.\n"); + } + //dump_mft_record(m); + Vprintf("Creating $BadClus (mft record 8)\n"); + m = (MFT_RECORD*)(buf + 8 * vol->mft_record_size); + // FIXME: This should be IGNORE_CASE + /* Create a sparse named stream of size equal to the volume size. */ + err = add_attr_data_positioned(m, "$Bad", 4, 0, 0, rl_bad, NULL, + opt.nr_clusters * vol->cluster_size); + if (!err) { + err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); + } + if (!err) { + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_BadClus, FILE_BadClus), + 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, + 0, 0, "$BadClus", FILE_NAME_WIN32_AND_DOS); + } + if (!err) { + init_system_file_sd(FILE_BadClus, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $BadClus: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $Quota (mft record 9)\n"); + m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); + err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(9, 9), 0LL, 0LL, FILE_ATTR_HIDDEN + | FILE_ATTR_SYSTEM, 0, 0, "$Quota", + FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_Secure, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $Quota: %s\n", strerror(-err)); + //dump_mft_record(m); + Vprintf("Creating $UpCase (mft record 0xa)\n"); + m = (MFT_RECORD*)(buf + 0xa * vol->mft_record_size); + err = add_attr_data(m, NULL, 0, 0, 0, (char*)vol->upcase, + vol->upcase_len << 1); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MAKE_MFT_REF(FILE_UpCase, FILE_UpCase), + ((vol->upcase_len << 1) + vol->cluster_size - 1) & + ~(vol->cluster_size - 1), vol->upcase_len << 1, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$UpCase", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_UpCase, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $UpCase: %s\n", strerror(-err)); + //dump_mft_record(m); + /* NTFS 1.2 reserved system files (mft records 0xb-0xf) */ + for (i = 0xb; i < 0x10; i++) { + Vprintf("Creating system file (mft record 0x%x)\n", i, i); + m = (MFT_RECORD*)(buf + i * vol->mft_record_size); + err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); + if (!err) { + init_system_file_sd(i, &sd, &j); + err = add_attr_sd(m, sd, j); + } + if (err < 0) + err_exit("Couldn't create system file %i (0x%x): %s\n", + i, i, strerror(-err)); + //dump_mft_record(m); + } +// - Do not step onto bad blocks!!! +// - If any bad blocks were specified or found, modify $BadClus, allocating the +// bad clusters in $Bitmap. +// - C&w bootsector backup bootsector (backup in last sector of the +// partition). +// - If NTFS 3.0+, c&w $Secure file and $Extend directory with the +// corresponding special files in it, i.e. $ObjId, $Quota, $Reparse, and +// $UsnJrnl. And others? Or not all necessary? +// - RE: Populate $root with the system files (and $Extend directory if +// applicable). Possibly should move this as far to the top as possible and +// update during each subsequent c&w of each system file. + Vprintf("Syncing root directory index record.\n"); + m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); + i = 5 * sizeof(uchar_t); + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) + err_exit("Failed to allocate attribute search context: %s\n", + strerror(errno)); + // FIXME: This should be IGNORE_CASE! + if (ntfs_lookup_attr(AT_INDEX_ALLOCATION, I30, 4, 0, 0, + NULL, 0, ctx)) { + ntfs_put_attr_search_ctx(ctx); + err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n"); + } + a = ctx->attr; + rl_index = ntfs_decompress_mapping_pairs(vol, a, NULL); + if (!rl_index) { + ntfs_put_attr_search_ctx(ctx); + err_exit("Failed to decompress run list of $INDEX_ALLOCATION " + "attribute.\n"); + } + if (sle64_to_cpu(a->initialized_size) < i) { + ntfs_put_attr_search_ctx(ctx); + err_exit("BUG: $INDEX_ALLOCATION attribute too short.\n"); + } + ntfs_put_attr_search_ctx(ctx); + i = sizeof(INDEX_BLOCK) - sizeof(INDEX_HEADER) + + le32_to_cpu(index_block->index.allocated_size); + err = ntfs_pre_write_mst_fixup((NTFS_RECORD*)index_block, i); + if (err) + err_exit("ntfs_pre_write_mst_fixup() failed while syncing " + "root directory index block.\n"); + lw = ntfs_rlwrite(vol->fd, rl_index, (char*)index_block, i, NULL); + if (lw != i) + err_exit("Error writing $INDEX_ALLOCATION.\n"); + /* No more changes to @index_block below here so no need for fixup: */ + // ntfs_post_write_mst_fixup((NTFS_RECORD*)index_block); + Vprintf("Syncing $Bitmap.\n"); + m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) + err_exit("Failed to allocate attribute search context: %s\n", + strerror(errno)); + if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + ntfs_put_attr_search_ctx(ctx); + err_exit("BUG: $DATA attribute not found.\n"); + } + a = ctx->attr; + if (a->non_resident) { + rl = ntfs_decompress_mapping_pairs(vol, a, NULL); + ntfs_put_attr_search_ctx(ctx); + if (!rl) + err_exit("ntfs_decompress_mapping_pairs() failed\n"); + lw = ntfs_rlwrite(vol->fd, rl, lcn_bitmap, + lcn_bitmap_byte_size, NULL); + if (lw != lcn_bitmap_byte_size) + err_exit("%s\n", lw == -1 ? strerror(errno) : + "unknown error"); + } else { + memcpy((char*)a + le16_to_cpu(a->value_offset), lcn_bitmap, + le32_to_cpu(a->value_length)); + ntfs_put_attr_search_ctx(ctx); + } + /* + * No need to sync $MFT/$BITMAP as that has never been modified since + * its creation. + */ + Vprintf("Syncing $MFT.\n"); + pos = opt.mft_lcn * vol->cluster_size; + lw = 1; + for (i = 0; i < opt.mft_size / vol->mft_record_size; i++) { + if (!opt.no_action) + lw = ntfs_mst_pwrite(vol->fd, pos, 1, + vol->mft_record_size, + buf + i * vol->mft_record_size); + if (lw != 1) + err_exit("%s\n", lw == -1 ? strerror(errno) : + "unknown error"); + pos += vol->mft_record_size; + } + Vprintf("Updating $MFTMirr.\n"); + pos = opt.mftmirr_lcn * vol->cluster_size; + lw = 1; + for (i = 0; i < rl_mftmirr[0].length * vol->cluster_size / + vol->mft_record_size; i++) { + u16 usn, *usnp; + m = (MFT_RECORD*)(buf + i * vol->mft_record_size); + /* + * Decrement the usn by one, so it becomes the same as the one + * in $MFT once it is mst protected. - This is as we need the + * $MFTMirr to have the exact same byte by byte content as + * $MFT, rather than just equivalent meaning content. + */ + usnp = (u16*)((char*)m + le16_to_cpu(m->usa_ofs)); + usn = le16_to_cpup(usnp); + if (usn-- <= 1) + usn = 0xfffe; + *usnp = cpu_to_le16(usn); + if (!opt.no_action) + lw = ntfs_mst_pwrite(vol->fd, pos, 1, + vol->mft_record_size, + buf + i * vol->mft_record_size); + if (lw != 1) + err_exit("%s\n", lw == -1 ? strerror(errno) : + "unknown error"); + pos += vol->mft_record_size; + } + Vprintf("Syncing device.\n"); + if (fdatasync(vol->fd) == -1) + err_exit("Syncing device. FAILED: %s", strerror(errno)); + Qprintf("mkntfs completed successfully. Have a nice day.\n"); + /* + * Device is unlocked and closed by the registered exit function + * mkntfs_exit(). + */ + return 0; +} + diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index e69de29b..e785ea96 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -0,0 +1,371 @@ +const char *EXEC_NAME = "NtfsDump_LogFile"; +const char *EXEC_VERSION = "1.0"; +/* + * $Id$ + * + * NtfsDump_LogFile - Part of the Linux-NTFS project. + * + * Copyright (c) 2000,2001 Anton Altaparmakov. + * + * This utility will interpret the contents of the journal ($LogFile) of an + * NTFS partition and display the results on stdout. Errors will be output to + * stderr. + * + * Anton Altaparmakov + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS source + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * WARNING: This program might not work on architectures which do not allow + * unaligned access. For those, the program would need to start using + * get/put_unaligned macros (#include ), but not doing it yet, + * since NTFS really mostly applies to ia32 only, which does allow unaligned + * accesses. We might not actually have a problem though, since the structs are + * defined as being packed so that might be enough for gcc to insert the + * correct code. + * + * If anyone using a non-little endian and/or an aligned access only CPU tries + * this program please let me know whether it works or not! + * + * Anton Altaparmakov + */ + +#include +#include +#include +#include +#include +#include + +#include "types.h" +#include "attrib.h" +#include "mft.h" +#include "disk_io.h" +#include "logfile.h" +#include "mst.h" + +int main(int argc, char **argv) +{ + MFT_RECORD *m = NULL; + ATTR_RECORD *a; + s64 l; + unsigned char *lfd = NULL; + ntfs_volume *vol = NULL; + ntfs_attr_search_ctx *ctx = NULL; + RESTART_PAGE_HEADER *rph; + RESTART_AREA *rr; + RESTART_CLIENT *cr; + RECORD_PAGE_HEADER *rcrd_ph; + LOG_RECORD *lr; + int pass = 1; + int i, lps, client; + char zero[4096]; + + memset(zero, 0, sizeof(zero)); + printf("\n"); + if (argc != 2) { + printf("%s v%s - Interpret and display information about the " + "journal\n($LogFile) of an NTFS volume.\n\n" + /* Generic copyright / disclaimer. */ + "Copyright (c) 2000, 2001 Anton Altaparmakov.\n\n" + "%s is free software, released under the GNU " + "General Public License\nand you are welcome to " + "redistribute it under certain conditions.\n" + "%s comes with ABSOLUTELY NO WARRANTY; for details " + "read the GNU\nGeneral Public License to be found " + "in the file COPYING in the main Linux-NTFS\n" + "distribution directory.\n\n" + /* Generic part ends here. */ + "Syntax: ntfsdump_logfile partition_or_file_name\n" + " e.g. ntfsdump_logfile /dev/hda6\n\n", + EXEC_NAME, EXEC_VERSION, EXEC_NAME, EXEC_NAME); + fprintf(stderr, "Error: incorrect syntax\n"); + exit(1); + } + vol = ntfs_mount(argv[1], MS_RDONLY); + if (!vol) { + perror("ntfs_mount(MS_RDONLY) failed"); + exit(1); + } + /* Check NTFS version is ok for us. */ + printf("\nNTFS volume version is %i.%i.\n", vol->major_ver, + vol->minor_ver); + switch (vol->major_ver) { + case 1: + if (vol->minor_ver == 1 || vol->minor_ver == 2) + break; + else + goto version_error; + case 2: case 3: + if (vol->minor_ver == 0) + break; + /* Fall through on error. */ + default: +version_error: + fprintf(stderr, "Error: Unknown NTFS version.\n"); + goto error_exit; + } + /* Read in $LogFile. */ + if (ntfs_read_file_record(vol, FILE_LogFile, &m, NULL)) { + fprintf(stderr, "Error reading mft record for $LogFile.\n"); + goto error_exit; + } + if (!(m->flags & MFT_RECORD_IN_USE)) { + fprintf(stderr, "Error: $LogFile has been deleted. Run chkdsk " + "to fix this.\n"); + goto error_exit; + } + ctx = ntfs_get_attr_search_ctx(NULL, m); + if (!ctx) { + perror("Failed to allocate attribute search context"); + goto error_exit; + } + /* Find the $DATA attribute of the $LogFile. */ + if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + fprintf(stderr, "Error: Attribute $DATA was not found in" \ + "$LogFile!\n"); + goto log_file_error; + } + a = ctx->attr; + /* Get length of $LogFile contents. */ + l = get_attribute_value_length(a); + if (!l) { + puts("$LogFile has zero length, no need to write to disk."); + goto log_file_error; + } + /* Allocate a buffer to hold all of the $LogFile contents. */ + lfd = (unsigned char*)malloc(l); + if (!lfd) { + puts("Not enough memory to load $LogFile."); + goto log_file_error; + } + /* Read in the $LogFile into the buffer. */ + if (l != get_attribute_value(vol, m, a, lfd)) { + puts("Amount of data read does not correspond to expected " + "length!"); + free(lfd); + goto log_file_error; + } + /* Check restart area. */ + if (!is_rstr_recordp(lfd)) { + s64 _l; + + for (_l = 0LL; _l < l; _l++) + if (lfd[_l] != (unsigned char)-1) + break; + if (_l < l) + puts("$LogFile contents are corrupt (magic RSTR " + "missing)!"); + else + puts("$LogFile is empty."); + goto log_file_error; + } + /* Do the interpretation and display now. */ + rph = (RESTART_PAGE_HEADER*)lfd; + lps = le32_to_cpu(rph->log_page_size); +pass_loc: + if (ntfs_post_read_mst_fixup((NTFS_RECORD*)rph, lps) || + is_baad_record(rph->magic)) { + puts("$LogFile incomplete multi sector transfer detected! " + "Cannot handle this yet!"); + goto log_file_error; + } + if ((pass == 2) && !memcmp(lfd, rph, lps)) { + printf("2nd restart area fully matches the 1st one. Skipping " + "display.\n"); + goto skip_rstr_pass; + } + if (le16_to_cpu(rph->major_ver != 1) || + le16_to_cpu(rph->minor_ver != 1)) { + fprintf(stderr, "$LogFile version %i.%i! Error: Unknown " + "$LogFile version!\n", + le16_to_cpu(rph->major_ver), + le16_to_cpu(rph->minor_ver)); + goto log_file_error; + } + rr = (RESTART_AREA*)((char*)rph + le16_to_cpu(rph->restart_offset)); + cr = (RESTART_CLIENT*)((char*)rr + + le16_to_cpu(rr->client_array_offset)); + /* Dump of the interpreted $LogFile restart area. */ + if (pass == 1) + printf("\n$LogFile version %i.%i.\n", + le16_to_cpu(rph->major_ver), + le16_to_cpu(rph->minor_ver)); + printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); + printf("magic = RSTR\n"); + printf("ChkDskLsn = 0x%Lx\n", sle64_to_cpu(rph->chkdsk_lsn)); + printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); + printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); + printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); + printf("\n(1st) restart record:\n"); + printf("CurrentLsn = %Lx\n", sle64_to_cpu(rr->current_lsn)); + printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); + printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); + printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); + printf("Flags = 0x%x\n", le16_to_cpu(rr->flags)); + printf("SeqNumberBits = %u (0x%x)\n", le32_to_cpu(rr->seq_number_bits), + le32_to_cpu(rr->seq_number_bits)); + printf("RestartAreaLength = 0x%x\n", + le16_to_cpu(rr->restart_area_length)); + printf("ClientArrayOffset = 0x%x\n", + le16_to_cpu(rr->client_array_offset)); + printf("FileSize = %Lu (0x%Lx)\n", le64_to_cpu(rr->file_size), + le64_to_cpu(rr->file_size)); + if (le64_to_cpu(rr->file_size) != l) + puts("$LogFile restart area indicates a log file size" + "different from the actual size!"); + printf("LastLsnDataLength = 0x%x\n", + le32_to_cpu(rr->last_lsn_data_length)); + printf("RecordLength = 0x%x\n", le16_to_cpu(rr->record_length)); + printf("LogPageDataOffset = 0x%x\n", + le16_to_cpu(rr->log_page_data_offset)); + for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { + printf("\nRestart client record number %i:\n", client); + printf("OldestLsn = 0x%Lx\n", sle64_to_cpu(cr->oldest_lsn)); + printf("ClientRestartLsn = 0x%Lx\n", + sle64_to_cpu(cr->client_restart_lsn)); + printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); + printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); + printf("SeqNumber = 0x%Lx\n", le64_to_cpu(cr->seq_number)); + printf("ClientNameLength = 0x%x\n", + le32_to_cpu(cr->client_name_length)); + if (le32_to_cpu(cr->client_name_length)) { + // convert to ascii and print out. + // printf("ClientName = %u\n", le16_to_cpu(cr->client_name)); + } + /* Size of a restart client record is fixed at 0xa0 bytes. */ + cr = (RESTART_CLIENT*)((char*)cr + 0xa0); + } +skip_rstr_pass: + if (pass == 1) { + rph = (RESTART_PAGE_HEADER*)((char*)rph + lps); + ++pass; + goto pass_loc; + } + rcrd_ph = (RECORD_PAGE_HEADER*)rph; + /* Reuse pass for log record clienter. */ + pass = 0; + printf("\nFinished with restart area. Beginning with log area.\n"); +rcrd_pass_loc: + rcrd_ph = (RECORD_PAGE_HEADER*)((char*)rcrd_ph + lps); + if ((char*)rcrd_ph + lps > (char*)lfd + l) + goto end_of_rcrd_passes; + printf("\nLog record page number %i", pass); + if (!is_rcrd_record(rcrd_ph->magic)) { + for (i = 0; i < lps; i++) + if (((char*)rcrd_ph)[i] != (char)-1) + break; + if (i < lps) + puts(" is corrupt (magic RCRD is missing)."); + else + puts(" is empty."); + pass++; + goto rcrd_pass_loc; + } else + printf(":"); + /* Dump log record page */ + printf("\nmagic = RCRD\n"); + printf("copy.last_lsn/file_offset = 0x%Lx\n", + le64_to_cpu(rcrd_ph->copy.last_lsn)); + printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); + printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); + printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); + printf("header.next_record_offset = 0x%Lx\n", + le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); + printf("header.last_end_lsn = 0x%Lx\n", + le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); + /* + * Where does the 0x40 come from? Is it just usa_offset + + * usa_client * 2 + 7 & ~7 or is it derived from somewhere? + */ + lr = (LOG_RECORD*)((char*)rcrd_ph + 0x40); + client = 0; +log_record_pass: + printf("\nLog record %i:\n", client); + printf("this lsn = 0x%Lx\n", le64_to_cpu(lr->this_lsn)); + printf("client previous lsn = 0x%Lx\n", + le64_to_cpu(lr->client_previous_lsn)); + printf("client undo next lsn = 0x%Lx\n", + le64_to_cpu(lr->client_undo_next_lsn)); + printf("client data length = 0x%x\n", + le32_to_cpu(lr->client_data_length)); + printf("client_id.seq_number = 0x%x\n", + le16_to_cpu(lr->client_id.seq_number)); + printf("client_id.client_index = 0x%x\n", + le16_to_cpu(lr->client_id.client_index)); + printf("record type = 0x%x\n", le32_to_cpu(lr->record_type)); + printf("transaction_id = 0x%x\n", le32_to_cpu(lr->transaction_id)); + printf("flags = 0x%x:", lr->flags); + if (!lr->flags) + printf(" NONE\n"); + else { + int _b = 0; + + if (lr->flags & LOG_RECORD_MULTI_PAGE) { + printf(" LOG_RECORD_MULTI_PAGE"); + _b = 1; + } + if (lr->flags & ~LOG_RECORD_MULTI_PAGE) { + if (_b) + printf(" |"); + printf(" Unknown flags"); + } + printf("\n"); + } + printf("redo_operation = 0x%x\n", le16_to_cpu(lr->redo_operation)); + printf("undo_operation = 0x%x\n", le16_to_cpu(lr->undo_operation)); + printf("redo_offset = 0x%x\n", le16_to_cpu(lr->redo_offset)); + printf("redo_length = 0x%x\n", le16_to_cpu(lr->redo_length)); + printf("undo_offset = 0x%x\n", le16_to_cpu(lr->undo_offset)); + printf("undo_length = 0x%x\n", le16_to_cpu(lr->undo_length)); + printf("target_attribute = 0x%x\n", le16_to_cpu(lr->target_attribute)); + printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); + printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); + printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); + printf("target_vcn = 0x%Lx\n", sle64_to_cpu(lr->target_vcn)); + if (le16_to_cpu(lr->lcns_to_follow) > 0) + printf("Array of lcns:\n"); + for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) + printf("lcn_list[%i].lcn = 0x%Lx\n", i, + sle64_to_cpu(lr->lcn_list[i].lcn)); + client++; + lr = (LOG_RECORD*)((char*)lr + 0x70); + if (((char*)lr + 0x70 <= (char*)rcrd_ph + + le64_to_cpu(rcrd_ph->header.packed.next_record_offset))) + goto log_record_pass; + pass++; + goto rcrd_pass_loc; +end_of_rcrd_passes: +log_file_error: + printf("\n"); + /* Set return code to 0. */ + i = 0; +final_exit: + if (lfd) + free(lfd); + if (ctx) + ntfs_put_attr_search_ctx(ctx); + if (m) + free(m); + if (vol && ntfs_umount(vol, 0)) + ntfs_umount(vol, 1); + return i; +error_exit: + i = 1; + goto final_exit; +} + diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index e69de29b..eed93b8a 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -0,0 +1,56 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH NTFSFIX 8 "July 2001" "Linux-NTFS version @VERSION@" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +ntfsfix \- tool for fixing NTFS partitions altered by the Linux kernel NTFS driver. +.SH SYNOPSIS +.B ntfsfix +.I device +.SH DESCRIPTION +This manual page documents briefly the +.B ntfsfix +command. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBntfsfix\fP is a program that fixes NTFS partitions altered in any +manner with the Linux NTFS driver. \fBntfsfix\fP is \fBNOT\fP a Linux +version of chkdsk. It only tries to leave the NTFS partition in a +not-so-inconsistent state after the NTFS driver has written to it. +.sp +\fBntfsfix\fP appeared because MS chkdsk is well known for its +stupidity when fixing altered partitions. Because the main problems +are journal files, \fBntfsfix\fP aims to fix those issues. +.sp +Running ntfsfix after mounting NTFS partitions read-write is recommended +for reducing the chance of severe data loss when NT/W2K tries to remount +the affected partition(s). +.sp +In order to use \fBntfsfix\fP you must unmount the NTFS partition, and run +ntfsfix device, where device is the NTFS partition. After this, you can +safely reboot into NT/W2K. Please note that \fBntfsfix\fP is not a +chkdsk-like tool, and so is not guaranteed that it could fix all the +alterations provoked by the NTFS driver. + +.SH SEE ALSO +.BR mkntfs (8). +.br +.SH AUTHOR +This manual page was written by David Martínez Moreno +, for the Debian GNU/Linux +system (but may be used by others). diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index e69de29b..e852061b 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -0,0 +1,317 @@ +/* + * $Id$ + * + * NtfsFix - Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov. + * + * This utility will attempt to fix a partition that has been damaged by the + * current Linux-NTFS driver. It should be run after dismounting a NTFS + * partition that has been mounted read-write under Linux and before rebooting + * into Windows NT/2000. NtfsFix can be run even after Windows has had mounted + * the partition, but it might be too late and irreversible damage to the data + * might have been done already. + * + * Anton Altaparmakov + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS source + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * WARNING: This program might not work on architectures which do not allow + * unaligned access. For those, the program would need to start using + * get/put_unaligned macros (#include ), but not doing it yet, + * since NTFS really mostly applies to ia32 only, which does allow unaligned + * accesses. We might not actually have a problem though, since the structs are + * defined as being packed so that might be enough for gcc to insert the + * correct code. + * + * If anyone using a non-little endian and/or an aligned access only CPU tries + * this program please let me know whether it works or not! + * + * Anton Altaparmakov + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include + +#include "types.h" +#include "attrib.h" +#include "mft.h" +#include "disk_io.h" +#include "logfile.h" + +int main(int argc, char **argv) +{ + s64 l, br; + const char *EXEC_NAME = "NtfsFix"; + const char *OK = "OK"; + const char *FAILED = "FAILED"; + unsigned char *m = NULL, *m2 = NULL; + ntfs_volume *vol; + unsigned long mnt_flags; + int i; + u16 flags; + BOOL done, force = FALSE; + + printf("\n"); + if (argc != 2 || !argv[1]) { + printf("%s v%s - Attempt to fix an NTFS partition that " + "has been damaged by the\nLinux NTFS driver. Note that " + "you should run it every time after you have used\nthe " + "Linux NTFS driver to write to an NTFS partition to " + "prevent massive data\ncorruption from happening when " + "Windows mounts the partition.\nIMPORTANT: Run this " + "only *after* unmounting the partition in Linux but " + "*before*\nrebooting into Windows NT/2000/XP or you " + "*will* suffer! - You have been warned!\n\n" + /* Generic copyright / disclaimer. */ + "Copyright (c) 2000-2002 Anton Altaparmakov.\n\n" + "%s is free software, released under the GNU " + "General Public License and you\nare welcome to " + "redistribute it under certain conditions.\n" + "%s comes with ABSOLUTELY NO WARRANTY; for details " + "read the file GNU\nGeneral Public License to be found " + "in the file COPYING in the main Linux-NTFS\n" + "distribution directory.\n\n" + /* Generic part ends here. */ + "Syntax: ntfsfix partition_or_file_name\n" + " e.g. ntfsfix /dev/hda6\n\n", EXEC_NAME, + VERSION, EXEC_NAME, EXEC_NAME); + fprintf(stderr, "Error: incorrect syntax\n"); + exit(1); + } + if (!ntfs_check_if_mounted(argv[1], &mnt_flags)) { + if ((mnt_flags & NTFS_MF_MOUNTED) && + !(mnt_flags & NTFS_MF_READONLY) && !force) { + fprintf(stderr, "Refusing to operate on read-write " + "mounted device %s.\n", argv[1]); + exit(1); + } + } else + fprintf(stderr, "Failed to determine whether %s is mounted: " + "%s\n", argv[1], strerror(errno)); + /* Attempt a full mount first. */ + printf("Mounting volume... "); + vol = ntfs_mount(argv[1], 0); + if (vol) { + puts(OK); + printf("\nProcessing of $MFT and $MFTMirr completed " + "successfully.\n\n"); + goto mount_ok; + } + puts(FAILED); + + puts("Attempting to correct errors."); + + vol = ntfs_startup_volume(argv[1], 0); + if (!vol) { + puts(FAILED); + perror("Failed to startup volume"); + fprintf(stderr, "Volume is corrupt. You should run chkdsk."); + goto error_exit; + } + + puts("Processing $MFT and $MFTMirr."); + + /* Load data from $MFT and $MFTMirr and compare the contents. */ + m = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); + m2 = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); + if (!m || !m2) { + perror("Failed to allocate memory"); + goto error_exit; + } + + printf("Reading $MFT... "); + l = ntfs_attr_mst_pread(vol->mft_na, 0, vol->mftmirr_size, + vol->mft_record_size, m); + if (l != vol->mftmirr_size) { + puts(FAILED); + if (l != -1) + errno = EIO; + perror("Failed to read $MFT"); + goto error_exit; + } + puts(OK); + + printf("Reading $MFTMirr... "); + l = ntfs_attr_mst_pread(vol->mftmirr_na, 0, vol->mftmirr_size, + vol->mft_record_size, m2); + if (l != vol->mftmirr_size) { + puts(FAILED); + if (l != -1) + errno = EIO; + perror("Failed to read $MFTMirr"); + goto error_exit; + } + puts(OK); + + /* + * FIXME: Need to actually check the $MFTMirr for being real. Otherwise + * we might corrupt the partition if someone is experimenting with + * software RAID and the $MFTMirr is not actually in the position we + * expect it to be... )-: + * FIXME: We should emit a warning it $MFTMirr is damaged and ask + * user whether to recreate it from $MFT or whether to abort. - The + * warning needs to include the danger of software RAID arrays. + * Maybe we should go as far as to detect whether we are running on a + * MD disk and if yes then bomb out right at the start of the program? + */ + + printf("Comparing $MFTMirr to $MFT... "); + done = FALSE; + for (i = 0; i < vol->mftmirr_size; ++i) { + const char *ESTR[12] = { "$MFT", "$MFTMirr", "$LogFile", + "$Volume", "$AttrDef", "root directory", "$Bitmap", + "$Boot", "$BadClus", "$Secure", "$UpCase", "$Extend" }; + const char *s; + + if (i < 12) + s = ESTR[i]; + else if (i < 16) + s = "system file"; + else + s = "mft record"; + + if (is_baad_recordp(m + i * vol->mft_record_size)) { + puts("FAILED"); + fprintf(stderr, "$MFT error: Incomplete multi sector " + "transfer detected in %s.\nCannot " + "handle this yet. )-:\n", s); + goto error_exit; + } + if (!is_mft_recordp(m + i * vol->mft_record_size)) { + puts("FAILED"); + fprintf(stderr, "$MFT error: Invalid mft record for " + "%s.\nCannot handle this yet. )-:\n", + s); + goto error_exit; + } + if (is_baad_recordp(m2 + i * vol->mft_record_size)) { + puts("FAILED"); + fprintf(stderr, "$MFTMirr error: Incomplete multi " + "sector transfer detected in %s.\n", s); + goto error_exit; + } + if (!is_mft_recordp(m2 + i * vol->mft_record_size)) { + puts("FAILED"); + fprintf(stderr, "$MFTMirr error: Invalid mft record " + "for %s.\n", s); + goto error_exit; + } + if (memcmp((u8*)m + i * vol->mft_record_size, (u8*)m2 + + i * vol->mft_record_size, + ntfs_get_mft_record_data_size((MFT_RECORD*)( + (u8*)m + i * vol->mft_record_size)))) { + if (!done) { + done = TRUE; + puts(FAILED); + printf("Correcting differences in " + "$MFTMirr... "); + } + br = ntfs_write_mft_record(vol, i, (MFT_RECORD*)(m + + i * vol->mft_record_size)); + if (br) { + puts(FAILED); + perror("Error correcting $MFTMirr"); + goto error_exit; + } + } + } + puts(OK); + + free(m); + free(m2); + m = m2 = NULL; + + printf("Processing of $MFT and $MFTMirr completed successfully.\n\n"); + if (ntfs_umount(vol, 0)) + ntfs_umount(vol, 1); + vol = ntfs_mount(argv[1], 0); + if (!vol) { + perror("Remount failed"); + goto error_exit; + } +mount_ok: + m = NULL; + + /* Check NTFS version is ok for us (in $Volume) */ + printf("NTFS volume version is %i.%i.\n\n", vol->major_ver, + vol->minor_ver); + if (ntfs_is_version_supported(vol)) { + fprintf(stderr, "Error: Unknown NTFS version.\n"); + goto error_exit; + } + + printf("Setting required flags on partition... "); + /* + * Set chkdsk flag, i.e. mark the partition dirty so chkdsk will run + * and fix it for us. + */ + flags = vol->flags | VOLUME_IS_DIRTY; + /* If NTFS volume version >= 2.0 then set mounted on NT4 flag. */ + if (vol->major_ver >= 2) + flags |= VOLUME_MOUNTED_ON_NT4; + if (ntfs_set_volume_flags(vol, flags)) { + puts(FAILED); + fprintf(stderr, "Error setting volume flags.\n"); + goto error_exit; + } + puts(OK); + printf("\n"); + + printf("Going to empty the journal ($LogFile)... "); + if (ntfs_reset_logfile(vol)) { + puts(FAILED); + perror("Failed to reset $LogFile"); + goto error_exit; + } + puts(OK); + printf("\n"); + + if (vol->major_ver >= 3) { + /* FIXME: If on NTFS 3.0+, check for presence of the usn journal and + disable it (if present) as Win2k might be unhappy otherwise and Bad + Things(TM) could happen depending on what applications are actually + using it for. */ + } + + /* FIXME: Should we be marking the quota out of date, too? */ + + /* That's all for now! */ + printf("NTFS partition %s was processed successfully.\n", + vol->dev_name); + /* Set return code to 0. */ + i = 0; +final_exit: + if (m) + free(m); + if (m2) + free(m2); + if (vol && ntfs_umount(vol, 0)) + ntfs_umount(vol, 1); + return i; +error_exit: + i = 1; + goto final_exit; +} + diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index e69de29b..edec6976 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -0,0 +1,25 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSINFO 8 "May 2002" "Linux-NTFS version @VERSION@" +.SH NAME +ntfsinfo \- dump a file's attributes +.SH SYNOPSIS +.B ntfsinfo +.I device +.I inode-number +.SH DESCRIPTION +.B ntfsinfo +will dump the attributes of inode +.IR inode-number . +.PP +.SH AUTHOR +.B ntfsinfo +was written by Matthew J. Fanto (fanto1mj@cmich.edu). +.SH AVAILABILITY +.B ntfsinfo +is part of the linux-ntfs package and is available from +http://linux-ntfs.sourceforge.net/. + + diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index e69de29b..45b6d1bb 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -0,0 +1,195 @@ +/*z + * $Id$ + * + * ntfsinfo - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Matthew J. Fanto + * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002 Richard Russon + * + * This utility will dump a file's attributes. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include "mft.h" +#include "attrib.h" +#include "layout.h" +#include "inode.h" + +void get_file_attribute_value(const char *dev, long int i); +void print_standard_information_attr(ntfs_attr_search_ctx * ctx); +void print_file_name_attr(ntfs_attr_search_ctx * ctx); + + +#define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000) + +int main(int argc, char **argv) +{ + const char *AUTHOR = "Matthew J. Fanto"; + const char *EXEC_NAME = "ntfsinfo"; + const char *locale; + long i; + + locale = setlocale(LC_ALL, ""); + if (!locale) { + char *locale; + + locale = setlocale(LC_ALL, NULL); + printf("Failed to set locale, using default (%s).\n", locale); + } else + printf("Using locale %s.\n", locale); + + if (argc < 3 || argc > 4) { + fprintf(stderr, "%s v%s - %s\n", EXEC_NAME, VERSION, AUTHOR); + fprintf(stderr, "Usage: ntfsinfo device inode\n"); + exit(1); + } + + else { + i = atoll(argv[2]); + get_file_attribute_value(argv[1], i); + } + + return 0; +} + +void get_file_attribute_value(const char *dev, long int i) +{ + + MFT_REF mref; + MFT_RECORD *mrec = NULL; + //ATTR_RECORD *attr = NULL; + //FILE_NAME_ATTR *file_name_attr = NULL; + //STANDARD_INFORMATION *standard_information = NULL; + //SECURITY_DESCRIPTOR_RELATIVE *security_descriptor = NULL; + ntfs_attr_search_ctx *ctx = NULL; + ntfs_volume *vol = NULL; + //char *file_name; + ntfs_inode *inode = NULL; + + vol = ntfs_mount(dev, 0); + + mref = (MFT_REF) i; + inode = ntfs_open_inode(vol, mref); + + if (ntfs_read_file_record(vol, mref, &mrec, NULL)) { + perror("Error reading file record!\n"); + exit(1); + } + + ctx = ntfs_get_attr_search_ctx(inode, mrec); + +// print_file_name_attr(ctx); + +// ctx = ntfs_get_attr_search_ctx(inode, mrec); //need to fix this + + print_standard_information_attr(ctx); +} + + +s64 ntfs2time(s64 time) +{ + s64 t; + printf("Original Time: %Li\n",time); + t = time - NTFS_TIME_OFFSET; + t = t / 10000000; + return t; + + +} + +void print_standard_information_attr(ntfs_attr_search_ctx *ctx) +{ + ATTR_RECORD *attr = NULL; + STANDARD_INFORMATION *standard_information_attr = NULL; + + if (ntfs_lookup_attr + (AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + perror("Error looking up $STANDARD_INFORMATION!\n"); + exit(1); + } + + attr = ctx->attr; + + standard_information_attr = + (STANDARD_INFORMATION *) ((char *) attr + + le16_to_cpu(attr->value_offset)); + + printf("Creation time: %Li\n", + ntfs2time(standard_information_attr->creation_time)); +/* printf("Last Data Change Time: %Li\n", + ntfs2time(standard_information_attr->last_data_change_time)); + printf("Last MFT Change Time: %Li\n", + ntfs2time(standard_information_attr->last_mft_change_time)); + printf("Last Access Time: %Li\n", + ntfs2time(standard_information_attr->last_access_time)); + printf("Maxium Versions: %d\n", + standard_information_attr->maximum_versions); + printf("Version Number: %d\n", + standard_information_attr->version_number); + printf("Class ID: %d\n", + standard_information_attr->class_id); + printf("Owner ID: %d\n", + standard_information_attr->owner_id); + printf("Security ID: %d\n", + standard_information_attr->security_id); + +*/ +} + +void print_file_name_attr(ntfs_attr_search_ctx *ctx) +{ + ATTR_RECORD *attr = NULL; + ntfs_attr_search_ctx *c = ctx; + FILE_NAME_ATTR *file_name_attr = NULL; + char *file_name; + + if (ntfs_lookup_attr(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + perror("Error looking up $FILE_NAME_ATTR!\n"); + exit(1); + } + + attr = ctx->attr; + ctx = c; + + file_name_attr = + (FILE_NAME_ATTR *) ((char *) attr + + le16_to_cpu(attr->value_offset)); + + file_name = malloc(file_name_attr->file_name_length * sizeof (char)); + + ntfs_ucstombs(file_name_attr->file_name, + file_name_attr->file_name_length, &file_name, + file_name_attr->file_name_length); + + printf("File Name: %s\n", file_name); + printf("File Name Length: %d\n", file_name_attr->file_name_length); + printf("Allocated Size: %Li\n",sle64_to_cpu(file_name_attr->allocated_size)); + printf("Data Size: %Li\n",sle64_to_cpu(file_name_attr->data_size)); +} + +/*void print_security_descriptor_attr(SECURITY_DESCRIPTOR_RELATIVE *security_descriptor) +{ + +}*/ diff --git a/ntfsprogs/ntfslabel.8.in b/ntfsprogs/ntfslabel.8.in index e69de29b..4b9a05bb 100644 --- a/ntfsprogs/ntfslabel.8.in +++ b/ntfsprogs/ntfslabel.8.in @@ -0,0 +1,54 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" Adapted from e2fsprogs-1.26/misc/e2label.8.in by Theodore Ts'o. +.\" +.TH NTFSLABEL 8 "April 2002" "Linux-NTFS version @VERSION@" +.SH NAME +ntfslabel \- display/change the label on an ntfs file system +.SH SYNOPSIS +.B ntfslabel +.I device +[ +.I new-label +] +.SH DESCRIPTION +.B ntfslabel +will display or change the file system label on the ntfs file system located on +.IR device . +.PP +If the optional argument +.I new-label +is not present, +.B ntfslabel +will simply display the current file system label. +.PP +If the optional argument +.I new-label +is present, then +.B ntfslabel +will set the file system label to be +.IR new-label . +NTFS file system labels can be at most 128 Unicode characters long; if +.I new-label +is longer than 128 Unicode characters, +.B ntfslabel +will truncate it and print a warning message. +.PP +It is also possible to set the file system label using the +.B \-L +option of +.BR mkntfs (8) +during creation of the file system. +.PP +.SH AUTHOR +.B ntfslabel +was written by Matthew J. Fanto (fanto1mj@cmich.edu). This man page was written +by Anton Altaparmakov (aia21@cantab.net). +.SH AVAILABILITY +.B ntfslabel +is part of the linux-ntfs package and is available from +http://linux-ntfs.sourceforge.net/. +.SH SEE ALSO +.BR mkntfs (8) + diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index e69de29b..5d07c0d0 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -0,0 +1,247 @@ +/* + * $Id$ + * + * ntfslabel - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Matthew J. Fanto + * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002 Richard Russon + * + * This utility will display/change the label on an NTFS partition. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "debug.h" +#include "mft.h" + +/* + * print_label - display the current label of a mounted ntfs partition. + * @dev: device to read the label from + * @mnt_flags: mount flags of the device or 0 if not mounted + * @mnt_point: mount point of the device or NULL + * + * Print the label of the device @dev to stdout. + */ +void print_label(const char *dev, const unsigned long mnt_flags, + const char *mnt_point) +{ + ntfs_volume *vol; + + if (mnt_point) { + // Try ioctl and finish if present. + // goto finished; + } + if ((mnt_flags & (NTFS_MF_MOUNTED | NTFS_MF_READONLY)) == + NTFS_MF_MOUNTED) { + fprintf(stderr, "%s is mounted read-write, results may be " + "unreliable.\n", dev); + } + vol = ntfs_mount(dev, MS_RDONLY); + if (!vol) { + fprintf(stderr, "ntfs_mount() on device %s failed: %s\n", dev, + strerror(errno)); + exit(1); + } +//finished: + printf("%s\n", vol->vol_name); + if (ntfs_umount(vol, 0)) + ntfs_umount(vol, 1); +} + +/* + * resize_resident_attribute_value - resize a resident attribute + * @m: mft record containing attribute to resize + * @a: attribute record (inside @m) which to resize + * @new_vsize: the new attribute value size to resize the attribute to + * + * Return 0 on success and -1 with errno = ENOSPC if not enough space in the + * mft record. + */ +int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, + const u32 new_vsize) +{ + int new_alen, new_muse; + + /* New attribute length and mft record bytes used. */ + new_alen = (le16_to_cpu(a->value_offset) + new_vsize + 7) & ~7; + new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + + new_alen; + /* Check for sufficient space. */ + if (new_muse > le32_to_cpu(m->bytes_allocated)) { + errno = ENOSPC; + return -1; + } + /* Move attributes behind @a to their new location. */ + memmove((char*)a + new_alen, (char*)a + le32_to_cpu(a->length), + le32_to_cpu(m->bytes_in_use) - ((char*)a - (char*)m) - + le32_to_cpu(a->length)); + /* Adjust @m to reflect change in used space. */ + m->bytes_in_use = cpu_to_le32(new_muse); + /* Adjust @a to reflect new value size. */ + a->length = cpu_to_le32(new_alen); + a->value_length = cpu_to_le32(new_vsize); + return 0; +} + +/* + * change_label - change the current label on a device + * @dev: device to change the label on + * @mnt_flags: mount flags of the device or 0 if not mounted + * @mnt_point: mount point of the device or NULL + * @label: the new label + * + * Change the label on the device @dev to @label. + */ +void change_label(const char *dev, const unsigned long mnt_flags, + const char *mnt_point, char *label, BOOL force) +{ + ntfs_attr_search_ctx *ctx = NULL; + uchar_t *new_label = NULL; + MFT_RECORD *mrec = NULL; + ATTR_RECORD *a; + ntfs_volume *vol; + int label_len, err = 1; + + if (mnt_point) { + // Try ioctl and return if present. + // return; + } + if (mnt_flags & NTFS_MF_MOUNTED) { + /* If not the root fs or mounted read/write, refuse change. */ + if (!(mnt_flags & NTFS_MF_ISROOT) || + !(mnt_flags & NTFS_MF_READONLY)) { + if (!force) { + fprintf(stderr, "Refusing to change label on " + "read-%s mounted device %s.\n", + mnt_flags & NTFS_MF_READONLY ? + "only" : "write", dev); + return; + } + } + } + vol = ntfs_mount(dev, 0); + if (!vol) { + fprintf(stderr, "ntfs_mount() on device %s failed: %s\n", dev, + strerror(errno)); + exit(1); + } + if (ntfs_read_file_record(vol, (MFT_REF)FILE_Volume, &mrec, NULL)) { + perror("Error reading file record"); + goto err_out; + } + if (!(mrec->flags & MFT_RECORD_IN_USE)) { + fprintf(stderr, "Error: $Volume has been deleted. Run " + "chkdsk to fix this.\n"); + goto err_out; + } + ctx = ntfs_get_attr_search_ctx(NULL, mrec); + if (!ctx) { + perror("Failed to get attribute search context"); + goto err_out; + } + if (ntfs_lookup_attr(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + perror("Lookup of $VOLUME_NAME attribute failed"); + goto err_out; + } + a = ctx->attr; + if (a->non_resident) { + fprintf(stderr, "Error: Attribute $VOLUME_NAME must be " + "resident.\n"); + goto err_out; + } + label_len = ntfs_mbstoucs(label, &new_label, 0); + if (label_len == -1) { + perror("Unable to convert label string to Unicode"); + goto err_out; + } + label_len *= sizeof(uchar_t); + if (label_len > 0x100) { + fprintf(stderr, "New label is too long. Maximum %i characters " + "allowed. Truncating excess characters.\n", + 0x100 / sizeof(uchar_t)); + label_len = 0x100; + new_label[label_len / sizeof(uchar_t)] = cpu_to_le16(L'\0'); + } + if (resize_resident_attribute_value(mrec, a, label_len)) { + perror("Error resizing resident attribute"); + goto err_out; + } + memcpy((char*)a + le16_to_cpu(a->value_offset), new_label, label_len); + if (ntfs_write_mft_record(vol, (MFT_REF)FILE_Volume, mrec)) { + perror("Error writing MFT Record to disk"); + goto err_out; + } + err = 0; +err_out: + if (new_label) + free(new_label); + if (mrec) + free(mrec); + if (ntfs_umount(vol, 0)) + ntfs_umount(vol, 1); + if (err) + exit(1); +} + +int main(int argc, char **argv) +{ + const char *AUTHOR = "Matthew Fanto"; + char *EXEC_NAME = "ntfslabel"; + char *locale, *mnt_point = NULL; + unsigned long mnt_flags; + int err; + // FIXME:Implement option -F meaning force the change. + BOOL force = 0; + + locale = setlocale(LC_ALL, ""); + if (!locale) { + char *locale; + + locale = setlocale(LC_ALL, NULL); + Dprintf("Failed to set locale, using default (%s).\n", locale); + } else + Dprintf("Using locale %s.\n", locale); + if (argc && *argv) + EXEC_NAME = *argv; + if (argc < 2 || argc > 3) { + fprintf(stderr, "%s v%s - %s\n", EXEC_NAME, VERSION, AUTHOR); + fprintf(stderr, "Usage: ntfslabel device [newlabel]\n"); + exit(1); + } + err = ntfs_check_if_mounted(argv[1], &mnt_flags); + if (err) + fprintf(stderr, "Failed to determine whether %s is mounted: " + "%s\n", argv[1], strerror(errno)); + else if (mnt_flags & NTFS_MF_MOUNTED) { + // Not implemented yet. Will be used for ioctl interface to driver. + // mnt_point = ntfs_get_mount_point(argv[1]); + } + if (argc == 2) + print_label(argv[1], mnt_flags, mnt_point); + else + change_label(argv[1], mnt_flags, mnt_point, argv[2], force); + return 0; +} + diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index e69de29b..b2be7c28 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -0,0 +1,117 @@ +.\" -*- nroff -*- +.\" Copyright 2002 by Szabolcs Szakacsits All Rights Reserved. +.\" +.TH NTFSRESIZE 8 "November 2002" "Linux\-NTFS @VERSION@" +.SH NAME +ntfsresize \- resize an NTFS filesystem +.SH SYNOPSIS +.B ntfsresize +[\fB\-fhin\fR] +[\fB\-s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR]] +.I device +.SH DESCRIPTION +The +.B ntfsresize +program non-destructively resizes Windows NT4, 2000, XP or .NET +NTFS filesystems. At present it can be used to shrink a +defragmented NTFS filesystem located on an unmounted +.I device +(usually a disk partition). The new volume will have +.I size +bytes. +The +.I size +parameter may have one of the optional modifiers +\fBk\fR, \fBM\fR, \fBG\fR, which means the +.I size +parameter is given in kilo-, mega- or gigabytes respectively. +.B ntfsresize +conforms to the SI, ATA, IEEE standards and the disk manufacturers +by using k=10^3, M=10^6 and G=10^9. +.PP +The +.B ntfsresize +program does not manipulate the size of partitions. +If you wish to shrink an NTFS partition, first use +.B ntfsresize +to shrink the size of the filesystem. Then you may use +.BR fdisk (8) +to shrink the size of the partition by deleting the +partition and recreating it with the smaller size. +.PP +.B IMPORTANT! +When recreating the partition with +.BR fdisk (8) +make sure you create it with the same starting +disk cylinder and partition type +as before and you do not make it smaller than the new size +of the NTFS filesystem! Otherwise you may lose your entire filesystem. +Also make sure you set the bootable flag for the partition if it +existed before. Failing to do so you might not be able to boot your +computer from the disk! +.PP +Note, +.B ntfsresize +schedules 'chkdsk' to make an NTFS consistency check +when you will boot Windows. If your partition was a +system partition than Windows may intentionally reboot after +the successful consistency check. + +.SH OPTIONS +.TP +.B -f +Forces ntfsresize to proceed with the filesystem resize operation, overriding +some safety checks which +.B ntfsresize +normally enforces. You can use this +parameter multiply times if you want to overcome every single safety checks. +.TP +.B -h +Display help and exit. +.TP +.B -i +Using this option you can calculate the smallest shrunken volume size supported. +This option will not make any changes to the filesystem. +.TP +.B -n +You can use this option to make a test run before doing the real resize operation. +Volume will be opened read-only and +.B ntfsresize +displays what it would do if it were to resize the filesystem. +.TP +.B -s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] +Shrink volume to \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes. +The optional modifiers \fBk\fR, \fBM\fR, \fBG\fR mean the +.I size +parameter is given in kilo-, mega- or gigabytes respectively. +Conforming to standards, k=10^3, M=10^6 and G=10^9. +.SH BUGS +No bugs are known or has been reported so far in the current version. +If you find otherwise, please report it to +(no subscription needed). It's also strongly advised you +.B MAKE SURE YOU HAVE A BACKUP +of your important data in case of an unexpected failure. +.PP +Future work is planned to include support for volume enlargement +and resizing fragmented NTFS volumes. +Please note, Windows 2000, XP and .NET have built in NTFS defragmenter. +.SH AVAILABILITY +.B ntfsresize +is part of the linux-ntfs package and is available from +http://linux-ntfs.sf.net/ as source and pre-compiled binary. +.SH AUTHOR +.B ntfsresize +has been written by +Szabolcs Szakacsits . +.SH ACKNOWLEDGEMENT +Many thanks to Anton Altaparmakov and Richard Russon (FlatCap) +for libntfs, excellent documentation, comments, testing and fixes, +moreover to Theodore Ts'o whose +.BR resize2fs (8) +man page formed the basis of this page. +.SH SEE ALSO +.BR fdisk (8), +.BR cfdisk (8), +.BR sfdisk (8), +.BR parted (8), +.BR mkntfs (8) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index e69de29b..d7d2ab65 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -0,0 +1,914 @@ +/** + * ntfsresize - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Szabolcs Szakacsits + * + * This utility will resize an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "debug.h" +#include "types.h" +#include "support.h" +#include "endians.h" +#include "bootsect.h" +#include "disk_io.h" +#include "attrib.h" +#include "volume.h" +#include "mft.h" +#include "bitmap.h" +#include "inode.h" +#include "runlist.h" + +const char *EXEC_NAME = "ntfsresize"; + +static const char *ntfs_report_banner = +"\nReport bugs to linux-ntfs-dev@lists.sf.net. " +"Homepage: http://linux-ntfs.sf.net\n"; + +static const char *resize_warning_msg = +"WARNING: Every sanity check passed and only the DANGEROUS operations left.\n" +"Please make sure all your important data had been backed up in case of an\n" +"unexpected failure!\n"; + +static const char *resize_important_msg = +"NTFS had been successfully resized on device '%s'.\n" +"You can go on to resize the device e.g. with 'fdisk'.\n" +"IMPORTANT: When recreating the partition, make sure you\n" +" 1) create it with the same starting disk cylinder\n" +" 2) create it with the same partition type (usually 7, HPFS/NTFS)\n" +" 3) do not make it smaller than the new NTFS filesystem size\n" +" 4) set the bootable flag for the partition if it existed before\n" +"Otherwise you may lose your data or can't boot your computer from the disk!\n"; + +static const char *fragmented_volume_msg = +"The volume end is fragmented, this case is not yet supported. Defragment it\n" +"(Windows 2000, XP and .NET have built in defragmentation tool) and try again.\n"; + +struct { + int verbose; + int debug; + int ro_flag; + int force; + int info; + s64 bytes; + char *volume; +} opt; + +struct bitmap { + u8 *bm; + s64 size; +}; + +struct progress_bar { + u64 start; + u64 stop; + int resolution; + float unit; +}; + +ntfs_volume *vol = NULL; +struct bitmap lcn_bitmap; + +#define NTFS_MBYTE (1000 * 1000) + +#define ERR_PREFIX "ERROR" +#define PERR_PREFIX ERR_PREFIX "(%d): " +#define NERR_PREFIX ERR_PREFIX ": " + +#define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) + + +void perr_printf(const char *fmt, ...) +{ + va_list ap; + int eo = errno; + + fprintf(stdout, PERR_PREFIX, eo); + va_start(ap, fmt); + vfprintf(stdout, fmt, ap); + va_end(ap); + printf(": %s\n", strerror(eo)); + fflush(stdout); + fflush(stderr); +} + + +int err_exit(const char *fmt, ...) +{ + va_list ap; + + fprintf(stdout, NERR_PREFIX); + va_start(ap, fmt); + vfprintf(stdout, fmt, ap); + va_end(ap); + fflush(stdout); + fflush(stderr); + exit(1); +} + + +int perr_exit(const char *fmt, ...) +{ + va_list ap; + int eo = errno; + + fprintf(stdout, PERR_PREFIX, eo); + va_start(ap, fmt); + vfprintf(stdout, fmt, ap); + va_end(ap); + printf(": %s\n", strerror(eo)); + fflush(stdout); + fflush(stderr); + exit(1); +} + + +void usage() +{ + printf("\n"); + printf ("Usage: %s [-fhin] [-s size[k|M|G]] device\n", EXEC_NAME); + printf("Shrink a defragmented NTFS volume.\n"); + printf("\n"); + Dprintf(" -d Show debug information\n"); + printf (" -f Force to progress (DANGEROUS)\n"); + printf (" -h This help text\n"); + printf (" -i Calculate the smallest shrunken size supported (read-only)\n"); + printf (" -n Make a test run without write operations (read-only)\n"); + printf (" -s size[k|M|G] Shrink volume to size[k|M|G] bytes (k=10^3, M=10^6, G=10^9)\n"); +/* printf (" -v Verbose operation\n"); */ + printf(ntfs_report_banner); + exit(1); +} + + +/* Copy-paste from e2fsprogs */ +void proceed_question(void) +{ + char buf[256]; + const char *short_yes = "yY"; + + fflush(stdout); + fflush(stderr); + printf("Are you sure you want to proceed (y/[n])? "); + buf[0] = 0; + fgets(buf, sizeof(buf), stdin); + if (strchr(short_yes, buf[0]) == 0) { + printf("OK quitting. NO CHANGES has been made to your NTFS volume.\n"); + exit(1); + } +} + + +s64 get_new_volume_size(char *s) +{ + s64 size; + char *suffix; + + size = strtoll(s, &suffix, 10); + if (size <= 0 || errno == ERANGE) + err_exit("Illegal new volume size\n"); + + if (!*suffix) + return size; + + if (strlen(suffix) > 1) + usage(); + + /* We follow the SI prefixes: + http://physics.nist.gov/cuu/Units/prefixes.html + http://physics.nist.gov/cuu/Units/binary.html + Disk partitioning tools use prefixes as, + k M G + old fdisk 2^10 2^20 10^3*2^20 + recent fdisk 10^3 10^6 10^9 + cfdisk 10^3 10^6 10^9 + sfdisk 2^10 2^20 + parted 2^10 2^20 (may change) + fdisk (DOS) 2^10 2^20 + */ + /* FIXME: check for overflow */ + switch (*suffix) { + case 'G': + size *= 1000; + case 'M': + size *= 1000; + case 'k': + size *= 1000; + break; + default: + usage(); + } + + return size; +} + + +void parse_options(int argc, char **argv) +{ + char *s; + int i; + + printf("%s v%s\n", EXEC_NAME, VERSION); + + memset(&opt, 0, sizeof(opt)); + + while ((i = getopt(argc, argv, "dfhins:")) != EOF) + switch (i) { + case 'd': + opt.debug = 1; + break; + case 'f': + opt.force++; + break; + case 'h': + usage(); + case 'i': + opt.info = 1; + break; + case 'n': + opt.ro_flag = MS_RDONLY; + break; + case 's': + opt.bytes = get_new_volume_size(optarg); + break; + case 'v': + opt.verbose++; + break; + default: + usage(); + } + if (optind == argc) + usage(); + opt.volume = argv[optind++]; + if (optind < argc) + usage(); + + stderr = stdout; + if (!opt.debug) + if (!(stderr = fopen("/dev/null", "rw"))) + perr_exit("Couldn't open /dev/null"); + + + /* If no '-s size' then estimate smallest shrunken volume size */ + if (!opt.bytes) + opt.info = 1; + + if (opt.info) { + if (opt.bytes) { + printf(NERR_PREFIX "It makes no sense to use -i and " + "-s together.\n"); + usage(); + } + opt.ro_flag = MS_RDONLY; + } +} + + +s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) +{ + s64 bm_bsize; + + bm_bsize = rounded_up_division(nr_clusters, 8); + + /* Needs to be multiple of 8 bytes */ + bm_bsize = (bm_bsize + 7) & ~7; + Dprintf("Bitmap byte size : %lld (%lld clusters)\n", + bm_bsize, rounded_up_division(bm_bsize, vol->cluster_size)); + + return bm_bsize; +} + + +void build_lcn_usage_bitmap(ATTR_RECORD *a) +{ + run_list *rl; + int i, j; + + if (!a->non_resident) + return; + + if (!(rl = ntfs_decompress_mapping_pairs(vol, a, NULL))) + perr_exit("ntfs_decompress_mapping_pairs"); + + for (i = 0; rl[i].length; i++) { + if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) + continue; + for (j = 0; j < rl[i].length; j++) { + u64 k = (u64)rl[i].lcn + j; + if (ntfs_get_and_set_bit(lcn_bitmap.bm, k, 1)) + err_exit("Cluster %lu referenced twice!\n" + "You didn't shutdown your Windows" + "properly?", k); + } + } + free(rl); +} + + +void walk_attributes(MFT_RECORD *mr) +{ + ntfs_attr_search_ctx *ctx; + + if (!(ctx = ntfs_get_attr_search_ctx(NULL, mr))) + perr_exit("ntfs_get_attr_search_ctx"); + + while (!ntfs_walk_attrs(ctx)) { + if (ctx->attr->type == AT_END) + break; + build_lcn_usage_bitmap(ctx->attr); + } + + ntfs_put_attr_search_ctx(ctx); +} + + +void get_bitmap_data(ntfs_volume *vol, struct bitmap *bm) +{ + ntfs_inode *ni; + ntfs_attr_search_ctx *ctx; + + if (!(ni = ntfs_open_inode(vol, (MFT_REF)FILE_Bitmap))) + perr_exit("ntfs_open_inode"); + + if (!(ctx = ntfs_get_attr_search_ctx(ni, NULL))) + perr_exit("ntfs_get_attr_search_ctx"); + + if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) + perr_exit("ntfs_lookup_attr"); + + /* FIXME: get_attribute_value_length() can't handle extents */ + bm->size = get_attribute_value_length(ctx->attr); + + if (!(bm->bm = (u8 *)malloc(bm->size))) + perr_exit("get_bitmap_data"); + + if (get_attribute_value(vol, ni->mrec, ctx->attr, bm->bm) != bm->size) + perr_exit("Couldn't get $Bitmap $DATA\n"); + + ntfs_put_attr_search_ctx(ctx); + ntfs_close_inode(ni); +} + + +void compare_bitmaps(struct bitmap *a, struct bitmap *b) +{ + int i; + + if (a->size != b->size) + err_exit("$Bitmap file size doesn't match " + "calculated size ((%d != %d)\n", a->size, b->size); + + for (i = 0; i < a->size; i++) + if (a->bm[i] != b->bm[i]) + err_exit("Cluster bitmaps differ at %d (%d != %d)\n" + "You didn't shutdown your Windows properly?", + i, a->bm[i], b->bm[i]); +} + + +void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) +{ + p->start = start; + p->stop = stop; + p->unit = 100.0 / (stop - start); + p->resolution = res; +} + + +void progress_update(struct progress_bar *p, u64 current) +{ + float percent = p->unit * current; + + if (current != p->stop) { + if ((current - p->start) % p->resolution) + return; + printf("%6.2f percent completed\r", percent); + } else + printf("100.00 percent completed\n"); + fflush(stdout); +} + +void walk_inodes() +{ + s32 inode = 0; + s64 last_mft_rec; + MFT_REF mref; + MFT_RECORD *mrec = NULL; + struct progress_bar progress; + + printf("Scanning volume ...\n"); + + last_mft_rec = vol->nr_mft_records - 1; + progress_init(&progress, inode, last_mft_rec, 100); + + for (; inode <= last_mft_rec; inode++) { + progress_update(&progress, inode); + + mref = (MFT_REF)inode; + if (ntfs_read_file_record(vol, mref, &mrec, NULL)) { + /* FIXME: continue only if it make sense, e.g. + MFT record not in use based on $MFT bitmap */ + if (errno == EIO) + continue; + perr_exit("Reading inode %ld failed", inode); + } + if (!(mrec->flags & MFT_RECORD_IN_USE)) + continue; + + walk_attributes(mrec); + } + if (mrec) + free(mrec); +} + + +void advise_on_resize() +{ + u64 i, old_b, new_b, g_b, old_mb, new_mb, g_mb; + int fragmanted_end; + + for (i = vol->nr_clusters - 1; i > 0; i--) + if (ntfs_get_bit(lcn_bitmap.bm, i)) + break; + + i += 2; /* first free + we reserve one for the backup boot sector */ + fragmanted_end = (i >= vol->nr_clusters) ? 1 : 0; + + if (fragmanted_end || !opt.info) { + printf(fragmented_volume_msg); + if (fragmanted_end) + exit(1); + printf("Now "); + } + + old_b = vol->nr_clusters * vol->cluster_size; + old_mb = rounded_up_division(old_b, NTFS_MBYTE); + new_b = i * vol->cluster_size; + new_mb = rounded_up_division(new_b, NTFS_MBYTE); + g_b = (vol->nr_clusters - i) * vol->cluster_size; + g_mb = g_b / NTFS_MBYTE; + + printf("You could resize at %lld bytes ", new_b); + + if ((new_mb * NTFS_MBYTE) < old_b) + printf("or %lld MB ", new_mb); + + printf("(freeing "); + + if (g_mb && (old_mb - new_mb)) + printf("%lld MB", old_mb - new_mb); + else + printf("%lld bytes", g_b); + + printf(").\n"); + exit(1); +} + + +void look_for_bad_sector(ATTR_RECORD *a) +{ + run_list *rl; + int i; + + rl = ntfs_decompress_mapping_pairs(vol, a, NULL); + if (!rl) + perr_exit("ntfs_decompress_mapping_pairs"); + + for (i = 0; rl[i].length; i++) + if (rl[i].lcn != LCN_HOLE) + err_exit("Device has bad sectors, not supported\n"); + + free(rl); +} + + +void rl_set(run_list *rl, VCN vcn, LCN lcn, s64 len) +{ + rl->vcn = vcn; + rl->lcn = lcn; + rl->length = len; +} + + +/* + * $Bitmap can overlap the end of the volume. Any bits in this region + * must be set. This region also encompasses the backup boot sector. + */ +void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) +{ + for (; cluster < bm->size << 3; cluster++) + ntfs_set_bit(bm->bm, (u64)cluster, 1); +} + + +/* + * FIXME: this function should go away and instead using a generalized + * "truncate_bitmap_unnamed_attr()" + */ +void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) +{ + run_list *rl_bad; + int mp_size; + char *mp; + + if (!a->non_resident) + /* FIXME: handle resident attribute value */ + perr_exit("Resident attribute in $BadClust not supported!"); + + if (!(rl_bad = (run_list *)malloc(2 * sizeof(run_list)))) + perr_exit("Couldn't get memory"); + + rl_set(rl_bad, 0LL, (LCN)LCN_HOLE, nr_clusters); + rl_set(rl_bad + 1, nr_clusters, -1LL, 0LL); + + mp_size = ntfs_get_size_for_mapping_pairs(vol, rl_bad); + + if (!(mp = (char *)calloc(1, mp_size))) + perr_exit("Couldn't get memory"); + + if (ntfs_build_mapping_pairs(vol, mp, mp_size, rl_bad)) + exit(1); + + memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); + a->highest_vcn = cpu_to_le64(nr_clusters - 1LL); + a->allocated_size = cpu_to_le64(nr_clusters * vol->cluster_size); + a->data_size = cpu_to_le64(nr_clusters * vol->cluster_size); + + free(rl_bad); + free(mp); +} + + +void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) +{ + run_list *rl; + s64 bm_bsize, size; + s64 nr_bm_clusters; + int i, j, mp_size; + int trunc_at = -1; /* FIXME: -1 means unset */ + char *mp; + + + if (!a->non_resident) + /* FIXME: handle resident attribute value */ + perr_exit("Resident data attribute in $Bitmap not supported!"); + + bm_bsize = nr_clusters_to_bitmap_byte_size(nr_clusters); + nr_bm_clusters = rounded_up_division(bm_bsize, vol->cluster_size); + + if (!(rl = ntfs_decompress_mapping_pairs(vol, a, NULL))) + perr_exit("ntfs_decompress_mapping_pairs"); + + /* Unallocate truncated clusters in $Bitmap */ + for (i = 0; rl[i].length; i++) { + if (rl[i].vcn + rl[i].length <= nr_bm_clusters) + continue; + if (trunc_at == -1) + trunc_at = i; + if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) + continue; + for (j = 0; j < rl[i].length; j++) + if (rl[i].vcn + j >= nr_bm_clusters) { + u64 k = (u64)rl[i].lcn + j; + ntfs_set_bit(lcn_bitmap.bm, k, 0); + Dprintf("Unallocate cluster: " + "%llu (%llx)\n", k, k); + } + } + + /* FIXME: realloc lcn_bitmap.bm (if it's worth the risk) */ + lcn_bitmap.size = bm_bsize; + bitmap_file_data_fixup(nr_clusters, &lcn_bitmap); + + if (trunc_at != -1) { + /* NOTE: 'i' always > 0 */ + i = nr_bm_clusters - rl[trunc_at].vcn; + rl[trunc_at].length = i; + rl_set(rl + trunc_at + 1, nr_bm_clusters, -1LL, 0LL); + + Dprintf("Runlist truncated at index %d, " + "new cluster length %d\n", trunc_at, i); + } + + if (!opt.ro_flag) { + size = ntfs_rl_pwrite(vol, rl, 0, bm_bsize, lcn_bitmap.bm); + if (bm_bsize != size) { + if (size == -1) + perr_exit("Couldn't write $Bitmap"); + printf("Couldn't write full $Bitmap file " + "(%lld from %lld)\n", size, bm_bsize); + exit(1); + } + } + + mp_size = ntfs_get_size_for_mapping_pairs(vol, rl); + + if (!(mp = (char *)calloc(1, mp_size))) + perr_exit("Couldn't get memory"); + + if (ntfs_build_mapping_pairs(vol, mp, mp_size, rl)) + exit(1); + + memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); + a->highest_vcn = cpu_to_le64(nr_bm_clusters - 1LL); + a->allocated_size = cpu_to_le64(nr_bm_clusters * vol->cluster_size); + a->data_size = cpu_to_le64(bm_bsize); + a->initialized_size = cpu_to_le64(bm_bsize); + + free(rl); + free(mp); +} + + +void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) +{ + ntfs_inode *ni; + uchar_t *ustr = NULL; + int len = 0; + + if (!(ni = ntfs_open_inode(vol, mref))) + perr_exit("ntfs_open_inode"); + + if (NInoAttrList(ni)) + perr_exit("Attribute list attribute not yet supported"); + + if (!(*ctx = ntfs_get_attr_search_ctx(ni, NULL))) + perr_exit("ntfs_get_attr_search_ctx"); + + if (aname && ((len = ntfs_mbstoucs(aname, &ustr, 0)) == -1)) + perr_exit("Unable to convert string to Unicode"); + + if (!ustr || !len) { + ustr = AT_UNNAMED; + len = 0; + } + + if (ntfs_lookup_attr(AT_DATA, ustr, len, 0, 0, NULL, 0, *ctx)) + perr_exit("ntfs_lookup_attr"); + + if (ustr != AT_UNNAMED) + free(ustr); +} + + +int write_mft_record(ntfs_attr_search_ctx *ctx) +{ + if (opt.ro_flag) + return 0; + + return ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no, ctx->mrec); +} + + +void truncate_badclust_file(s64 nr_clusters) +{ + ntfs_attr_search_ctx *ctx = NULL; + + printf("Updating $BadClust file ...\n"); + + lookup_data_attr((MFT_REF)FILE_BadClus, "$Bad", &ctx); + look_for_bad_sector(ctx->attr); + /* FIXME: sanity_check_attr(ctx->attr); */ + /* FIXME: should use an "extended" truncate_bitmap_unnamed_attr() */ + truncate_badclust_bad_attr(ctx->attr, nr_clusters); + + if (write_mft_record(ctx)) + perr_exit("Couldn't update $BadClust"); + + /* FIXME: clean up API => ntfs_put_attr_search_ctx() also closes ni */ + ntfs_put_attr_search_ctx(ctx); +} + + +void truncate_bitmap_file(s64 nr_clusters) +{ + ntfs_attr_search_ctx *ctx = NULL; + + printf("Updating $Bitmap file ...\n"); + + lookup_data_attr((MFT_REF)FILE_Bitmap, NULL, &ctx); + /* FIXME: sanity_check_attr(ctx->attr); */ + truncate_bitmap_unnamed_attr(ctx->attr, nr_clusters); + + if (write_mft_record(ctx)) + perr_exit("Couldn't update $Bitmap"); + + ntfs_put_attr_search_ctx(ctx); +} + + +void setup_lcn_bitmap() +{ + /* Determine lcn bitmap byte size and allocate it. */ + lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); + + if (!(lcn_bitmap.bm = (unsigned char *)calloc(1, lcn_bitmap.size))) + perr_exit("Failed to allocate internal buffer"); + + bitmap_file_data_fixup(vol->nr_clusters, &lcn_bitmap); +} + + +/* FIXME: should be done using ntfs_* functions */ +void update_bootsector(s64 nr_clusters) +{ + NTFS_BOOT_SECTOR bs; + + printf("Updating Boot record ...\n"); + + if (lseek(vol->fd, 0, SEEK_SET) == (off_t)-1) + perr_exit("lseek"); + + if (read(vol->fd, &bs, sizeof(NTFS_BOOT_SECTOR)) == -1) + perr_exit("read() error"); + + bs.number_of_sectors = nr_clusters * bs.bpb.sectors_per_cluster; + bs.number_of_sectors = cpu_to_le64(bs.number_of_sectors); + + if (lseek(vol->fd, 0, SEEK_SET) == (off_t)-1) + perr_exit("lseek"); + + if (!opt.ro_flag) + if (write(vol->fd, &bs, sizeof(NTFS_BOOT_SECTOR)) == -1) + perr_exit("write() error"); +} + + +void print_volume_size(char *str, ntfs_volume *v, s64 nr_clusters) +{ + s64 b; /* volume size in bytes */ + + b = nr_clusters * v->cluster_size; + printf("%s: %lld bytes (%lld MB)\n", + str, b, rounded_up_division(b, NTFS_MBYTE)); +} + + +void mount_volume() +{ + unsigned long mntflag; + + if (ntfs_check_if_mounted(opt.volume, &mntflag)) + perr_exit("Failed to check '%s' mount state", opt.volume); + + if (mntflag & NTFS_MF_MOUNTED) { + if (!(mntflag & NTFS_MF_READONLY)) + err_exit("Device %s is mounted read-write. " + "You must 'umount' it first.\n", opt.volume); + if (!opt.ro_flag) + err_exit("Device %s is mounted. " + "You must 'umount' it first.\n", opt.volume); + } + + if (!(vol = ntfs_mount(opt.volume, opt.ro_flag))) { + + int err = errno; + + perr_printf("ntfs_mount failed"); + if (errno == EINVAL) { + printf("Apparently device '%s' doesn't have a " + "valid NTFS. Maybe you selected\nthe whole " + "disk instead of a partition (e.g. /dev/hda, " + "not /dev/hda8)?\n", opt.volume); + } + exit(1); + } + + if (vol->flags & VOLUME_IS_DIRTY) + if (opt.force-- <= 0) + err_exit("Volume is dirty. Run chkdsk and " + "please try again (or see -f option).\n"); + + printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); + if (ntfs_is_version_supported(vol)) + perr_exit("Unknown NTFS version"); + + Dprintf("Cluster size : %u\n", vol->cluster_size); + print_volume_size("Current volume size", vol, vol->nr_clusters); +} + + +void prepare_volume_fixup() +{ + if (!opt.ro_flag) { + u16 flags; + + flags = vol->flags | VOLUME_IS_DIRTY; + if (vol->major_ver >= 2) + flags |= VOLUME_MOUNTED_ON_NT4; + + printf("Schedule chkdsk NTFS consistency check at Windows boot time ...\n"); + if (ntfs_set_volume_flags(vol, flags)) + perr_exit("Failed to set $Volume dirty"); + + printf("Resetting $LogFile ... " + "(this might take a while)\n"); + if (ntfs_reset_logfile(vol)) + perr_exit("Failed to reset $LogFile"); + } +} + + +int main(int argc, char **argv) +{ + struct bitmap on_disk_lcn_bitmap; + s64 new_volume_size = 0; /* in clusters */ + int i; + + parse_options(argc, argv); + + mount_volume(); + + if (opt.bytes) { + /* Take the integer part: when shrinking we don't want + to make the volume to be bigger than requested. + Later on we will also decrease this value to save + room for the backup boot sector */ + new_volume_size = opt.bytes / vol->cluster_size; + print_volume_size("New volume size ", vol, new_volume_size); + } + + setup_lcn_bitmap(); + + walk_inodes(); + + get_bitmap_data(vol, &on_disk_lcn_bitmap); + compare_bitmaps(&on_disk_lcn_bitmap, &lcn_bitmap); + free(on_disk_lcn_bitmap.bm); + + if (opt.info) + advise_on_resize(); + + /* FIXME: check new_volume_size validity */ + + /* Backup boot sector at the end of device isn't counted in NTFS + volume size thus we have to reserve space for. We don't trust + the user does this for us: better to be on the safe side ;) */ + if (new_volume_size) + --new_volume_size; + + if (new_volume_size > vol->nr_clusters) + err_exit("Volume enlargement not yet supported\n"); + else if (new_volume_size == vol->nr_clusters) { + printf("Nothing to do: NTFS volume size is already OK.\n"); + exit(0); + } + + for (i = new_volume_size; i < vol->nr_clusters; i++) + if (ntfs_get_bit(lcn_bitmap.bm, (u64)i)) { + /* FIXME: relocate cluster */ + advise_on_resize(); + } + + if (opt.force-- <= 0 && !opt.ro_flag) { + printf(resize_warning_msg); + proceed_question(); + } + + prepare_volume_fixup(); + + truncate_badclust_file(new_volume_size); + truncate_bitmap_file(new_volume_size); + update_bootsector(new_volume_size); + + /* We don't create backup boot sector because we don't know where the + partition will be split. The scheduled chkdsk will fix it anyway */ + + if (opt.ro_flag) { + printf("The read-only test run ended successfully.\n"); + exit(0); + } + + printf("Syncing device ...\n"); + if (fsync(vol->fd) == -1) + perr_exit("fsync"); + + printf(resize_important_msg, vol->dev_name); + return 0; +} + diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index e69de29b..f28f4a05 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -0,0 +1,344 @@ +.\" Copyright (c) 2002 Richard Russon. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSUNDELETE 8 "June 2002" "Linux\-NTFS version @VERSION@" +.SH NAME +ntfsundelete \- recover a deleted file from an NTFS volume. +.SH SYNOPSIS +.B ntfsundelete +[ +.I options +] +.B device +.SH DESCRIPTION +.B ntfsundelete +has three modes of operation: +.IR scan , +.I undelete +and +.IR copy . +.SS Scan +.PP +The default mode, +.I scan +simply reads an NTFS Volume and looks for files that have been deleted. Then it +will print a list giving the inode number, name and size. +.SS Undelete +.PP +The +.I undelete +mode takes the inode and recovers as much of the data as possible. It save the +result to another location. Partly for safety, but mostly because NTFS write +support isn't finished. +.SS Copy +.PP +This is a wizard's option. It will save a portion of the MFT to a file. This +probably only be useful when debugging +.I ntfsundelete +.SS Notes +.B ntfsundelete +only ever +.B reads +from the NTFS Volume. +.B ntfsundelete +will never change the volume. +.SH CAVEATS +.SS Miracles +.B ntfsundelete +cannot perform the impossible. +.PP +When a file is deleted the MFT Record is marked as not in use and the bitmap +representing the disk usage is updated. If the power isn't turned off +immediately, the free space, where the file used to live, may become +overwritten. Worse, the MFT Record may be reused for another file. If this +happens it is impossible to tell where the file was on disk. +.PP +Even if all the clusters of a file are not in use, there is no guarantee that +they haven't been overwritten by some short\-lived file. +.SS Locale +In NTFS all the filenames are stored as Unicode. They will be converted into +the current locale for display by +.BR ntfsundelete . +The utility has successfully displayed some Chinese pictogram filenames and then +correctly recovered them. +.SS Extended MFT Records +In rare circumstances, a single MFT Record will not be large enough to hold the +metadata describing a file (a file would have to be in hundreds of fragments +for this to happen). In these cases one MFT record may hold the filename, but +another will hold the information about the data. +.B ntfsundelete +will not try and piece together such records. It will simply show unnamed files +with data. +.SS Compressed and Encrypted Files +.B ntfsundelete +cannot recover compressed or encrypted files. When scanning for them, it will +display as being 0% recoverable. +.SH OPTIONS +Below is a summary of all the options that +.B ntfsundelete +accepts. All options have two equivalent names. The short name is preceded by +.BR \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.BR \-fv +is equivalent to +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. +.TP +.BI "\-b " num +.br +.ns +.TP +.BI "\-\-byte " num +If any clusters of the file cannot be recovered, the missing parts will be +filled with this byte. The default is zeros. +.TP +.B \-C +.br +.ns +.TP +.B \-\-case +When scanning an NTFS volume, any filename matching (using the +.B \-\-match +option) is case\-insensitive. This option makes the maching case\-sensitive. +.TP +.BI "\-c " range +.br +.ns +.TP +.BI "\-\-copy " range +This wizard's option will write a block of MFT FILE records to a file. The +default file is +.I mft +which will be created in the current directory. This option can be combined +with the +.B \-\-output +and +.B \-\-destination +options. +.TP +.BI "\-d " dir +.br +.ns +.TP +.BI "\-\-destination " dir +This option controls where to put the output file of the +.B \-\-undelete +and +.B \-\-copy +options. +.TP +.B \-f +.br +.ns +.TP +.B \-\-force +This will override some sensible defaults, such as not overwriting an existing +file. Use this option with caution. +.TP +.B \-h +.br +.ns +.TP +.B \-\-help +Show a list of options with a brief description of each one. +.TP +.BI "\-m " pattern +.br +.ns +.TP +.BI "\-\-match " pattern +Filter the output of the +.B \-\-scan +option, by only looking for matching filenames. The pattern can include the +wildcards '?', match exactly one character or '*', match zero or more +characters. By default the matching is case\-insensitive. To make the search +case sensitive, use the +.B \-\-case +option. +.TP +.BI "\-o " file +.br +.ns +.TP +.BI "\-\-output " file +Use this option to set name of output file that +.B \-\-undelete +or +.B \-\-copy +will create. +.TP +.BI "\-p " num +.br +.ns +.TP +.BI "\-\-percentage " num +Filter the output of the +.B \-\-scan +option, by only matching files with a certain amount of recoverable content. +.B Please read the caveats section for more details. +.TP +.BI \-q +.br +.ns +.TP +.BI \-\-quiet +Reduce the amount of output to a minimum. Naturally, it doesn't make sense to +combine this option with +.BR \-\-scan . +.TP +.B \-s +.br +.ns +.TP +.B \-\-scan +Search through an NTFS volume and print a list of files that could be recovered. +This is the default action of +.BR ntfsundelete . +This list can be filtered by filename, size, percentage recoverable or last +modification time, using the +.BR \-\-match , +.BR \-\-size , +.B \-\-percent +and +.B \-\-time +options, respectively. +.sp +The output of scan will be: +.sp +.nf +Inode Flags %age Date Size Filename + 6038 FN.. 93% 2002-07-17 26629 thesis.doc +.fi +.TS +lB lB +l l. +Flag Description +F/D File/Directory +N/R (Non-)Resident data stream +C/E Compressed/Encrypted data stream +! Missing attributes +.TE +.RS +.sp +.br +The percentage field shows how much of the file can potentially be recovered. +.sp +.br +.RE +.BI "\-S " range +.br +.ns +.TP +.BI "\-\-size " range +Filter the output of the +.B \-\-scan +option, by looking for a particular range of file sizes. The range may be +specified as two numbers separated by a '\-'. The sizes may be abbreviated +using the suffixes k, m, g, t, for kilobytes, megabytes, gigabytes and terabytes +respectively. +.TP +.BI "\-t " since +.br +.ns +.TP +.BI "\-\-time " since +Filter the output of the +.B \-\-scan +option. Only match files that have been altered since this time. The time must +be given as number using a suffix of d, w, m, y for days, weeks, months or years +ago. +.TP +.BI "\-u " num +.br +.ns +.TP +.BI "\-\-undelete " num +Recover the file with this inode number. This option can be combined with +.BR \-\-output , +.BR \-\-destination , +and +.BR \-\-byte . +.TP +.B \-v +.br +.ns +.TP +.B \-\-verbose +Increase the amount of output that +.B ntfsundelete +prints. +.TP +.B \-V +.br +.ns +.TP +.B \-\-version +Show the version number, copyright and license +.BR ntfsundelete . +.SH EXAMPLES +Look for deleted files on /dev/hda1. +.RS +.sp +.B ntfsundelete /dev/hda1 +.sp +.RE +Look for deleted documents on /dev/hda1. +.RS +.sp +.B ntfsundelete /dev/hda1 -s \-m '*.doc' +.sp +.RE +Look for deleted files between 5000 and 6000000 bytes, with at least 90% of the +data recoverable, on /dev/hda1. +.RS +.sp +.B ntfsundelete /dev/hda1 \-S 5k\-6m \-p 90 +.sp +.RE +Look for deleted files altered in the last two days +.RS +.sp +.B ntfsundelete /dev/hda1 \-t 2d +.sp +.RE +Undelete inode number 3689, call the file 'work.doc' and put it in the user's +home directory. +.RS +.sp +.B ntfsundelete /dev/hda1 \-u 3689 \-o work.doc \-d ~ +.sp +.RE +Save MFT Records 3689 to 3690 to a file 'debug' +.RS +.sp +.B ntfsundelete /dev/hda1 \-c 3689\-3690 \-o debug +.RE +.SH BUGS +There are some small limitations to this program, but currently no known bugs. +If you find one, please send an email to +.nh + +.hy +.SH AUTHOR +.B ntfsundelete +was written by Richard Russon (FlatCap) +.br +If you find this tool useful, make FlatCap happy and send him an email. +.SH AVAILABILITY +.B ntfsundelete +is part of the linux\-ntfs package and is available from +.br +.nh +http://linux\-ntfs.sourceforge.net/downloads.html +.hy +This manual page is available online at: +.br +.nh +http://linux\-ntfs.sourceforge.net/tools/ntfsundelete.html +.hy +.SH SEE ALSO +.BR ntfsinfo(8) +.br diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index e69de29b..f738f3bf 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -0,0 +1,2018 @@ +/** + * ntfsundelete - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Richard Russon + * + * This utility will recover deleted files from an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ntfsundelete.h" +#include "bootsect.h" +#include "mft.h" +#include "attrib.h" +#include "layout.h" +#include "inode.h" +#include "disk_io.h" + +static const char *AUTHOR = "Richard Russon (FlatCap)"; +static const char *EXEC_NAME = "ntfsundelete"; +static const char *MFTFILE = "mft"; +static const char *UNNAMED = ""; +static char *NONE = ""; +static char *UNKNOWN = "unknown"; +static struct options opts; + +#define _(S) gettext(S) + +/** + * Eprintf - Print error messages + */ +void Eprintf (const char *format, ...) +{ + va_list va; + va_start (va, format); + vfprintf (stderr, format, va); + va_end (va); +} + +/** + * Iprintf - Print informative messages + */ +void Iprintf (const char *format, ...) +{ + va_list va; +#ifndef DEBUG + if (opts.quiet) + return; +#endif + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +} + +/** + * Vprintf - Print verbose messages + */ +void Vprintf (const char *format, ...) +{ + va_list va; +#ifndef DEBUG + if (!opts.verbose) + return; +#endif + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +} + +/** + * Dprintf - Print debug messages + */ +void Dprintf (const char *format, ...) +{ +#ifdef DEBUG + va_list va; + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +#endif +} + + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + Iprintf ("%s v%s Copyright (C) 2002 %s\nRecover deleted files from an " + "NTFS Volume\n\n%s is free software, released under the GNU " + "General Public License\nand you are welcome to redistribute " + "it under certain conditions.\n%s comes with ABSOLUTELY NO " + "WARRANTY; for details read the GNU\nGeneral Public License " + "to be found in the file COPYING in the main\nLinux-NTFS " + "distribution directory.\n\n", + EXEC_NAME, VERSION, AUTHOR, EXEC_NAME, EXEC_NAME); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + Iprintf ("Usage: %s [options] device\n" + " -s --scan Scan for files (default)\n" + " -p num --percentage num Minimum percentage recoverable\n" + " -m pattern --match pattern Only work on files with matching names\n" + " -C --case Case sensitive matching\n" + " -S range --size range Match files of this size\n" + " -t since --time since Last referenced since this time\n" + "\n" + " -u num --undelete num Undelete inode\n" + " -o file --output file Save with this filename\n" + " -d dir --destination dir Destination directory\n" + " -b num --byte num Fill missing parts with this byte\n" + "\n" + " -c range --copy range Write a range of MFT records to a file\n" + "\n" + " -f --force Use less caution\n" + " -q --quiet Less output\n" + " -v --verbose More output\n" + " -V --version Version information\n" + " -h --help Print this help\n\n", + EXEC_NAME); + Iprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); +} + +/** + * transform - Convert a shell style pattern to a regex + * @pattern: String to be converted + * @regex: Resulting regular expression is put here + * + * This will transform patterns, such as "*.doc" to true regular expressions. + * The function will also place '^' and '$' around the expression to make it + * behave as the user would expect + * + * Before After + * . \. + * * .* + * ? . + * + * Notes: + * The returned string must be freed by the caller. + * If transform fails, @regex will not be changed. + * + * Return: 1, Success, the string was transformed + * 0, An error occurred + */ +int transform (const char *pattern, char **regex) +{ + char *result; + int length, i, j; + + if (!pattern || !regex) + return 0; + + length = strlen (pattern); + if (length < 1) { + Eprintf ("Pattern to transform is empty\n"); + return 0; + } + + for (i = 0; pattern[i]; i++) { + if ((pattern[i] == '*') || (pattern[i] == '.')) + length++; + } + + result = malloc (length + 3); + if (!result) { + Eprintf ("Couldn't allocate memory in transform()\n"); + return 0; + } + + result[0] = '^'; + + for (i = 0, j = 1; pattern[i]; i++, j++) { + if (pattern[i] == '*') { + result[j] = '.'; + j++; + result[j] = '*'; + } else if (pattern[i] == '.') { + result[j] = '\\'; + j++; + result[j] = '.'; + } else if (pattern[i] == '?') { + result[j] = '.'; + } else { + result[j] = pattern[i]; + } + } + + result[j] = '$'; + result[j+1] = 0; + Dprintf ("Pattern '%s' replaced with regex '%s'\n", pattern, result); + + *regex = result; + return 1; +} + +/** + * parse_time - Convert a time abbreviation to seconds + * @string: The string to be converted + * @since: The absolute time referred to + * + * Strings representing times will be converted into a time_t. The numbers will + * be regarded as seconds unless suffixed. + * + * Suffix Description + * [yY] Year + * [mM] Month + * [wW] Week + * [dD] Day + * [sS] Second + * + * Therefore, passing "1W" will return the time_t representing 1 week ago. + * + * Notes: + * Only the first character of the suffix is read. + * If parse_time fails, @since will not be changed + * + * Return: 1 Success + * 0 Error, the string was malformed + */ +int parse_time (const char *value, time_t *since) +{ + time_t result, now; + char *suffix = NULL; + + if (!value || !since) + return -1; + + Dprintf ("parsing time '%s' ago\n", value); + + result = strtoll (value, &suffix, 10); + if (result < 0 || errno == ERANGE) { + Eprintf ("Invalid time '%s'.\n", value); + return 0; + } + + if (!suffix) { + Eprintf ("Internal error, strtoll didn't return a suffix.\n"); + return 0; + } + + if (strlen (suffix) > 1) { + Eprintf ("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); + return 0; + } + + switch (suffix[0]) { + case 'y': case 'Y': result *= 12; + case 'm': case 'M': result *= 4; + case 'w': case 'W': result *= 7; + case 'd': case 'D': result *= 24; + case 'h': case 'H': result *= 3600; + case 0: + break; + + default: + Eprintf ("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); + return 0; + } + + now = time (NULL); + + Dprintf ("Time now = %lld, Time then = %lld.\n", (long long) now, (long long) result); + *since = now - result; + return 1; +} + +/** + * parse_size - Convert a string representing a size + * @value: String to be parsed + * @size: Parsed size + * + * Read a string and convert it to a number. Strings may be suffixed to scale + * them. Any number without a suffix is assumed to be in bytes. + * + * Suffix Description Multiple + * [tT] Terabytes 10^12 + * [gG] Gigabytes 10^9 + * [mM] Megabytes 10^6 + * [kK] Kilobytes 10^3 + * + * Notes: + * Only the first character of the suffix is read. + * The multipliers are decimal thousands, not binary: 1000, not 1024. + * If parse_size fails, @size will not be changed + * + * Return: 1 Success + * 0 Error, the string was malformed + */ +int parse_size (const char *value, long long *size) +{ + long long result; + char *suffix = NULL; + + if (!value || !size) + return 0; + + Dprintf ("Parsing size '%s'.\n", value); + + result = strtoll (value, &suffix, 10); + if (result < 0 || errno == ERANGE) { + Eprintf ("Invalid size '%s'.\n", value); + return 0; + } + + if (!suffix) { + Eprintf ("Internal error, strtoll didn't return a suffix.\n"); + return 0; + } + + + /*if (strlen (suffix) > 1) { + Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); + return 0; + } Can't do this because of ranges*/ + + switch (suffix[0]) { + case 't': case 'T': result *= 1000; + case 'g': case 'G': result *= 1000; + case 'm': case 'M': result *= 1000; + case 'k': case 'K': result *= 1000; + case '-': case 0: + break; + default: + Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); + return 0; + } + + Dprintf ("Parsed size = %lld.\n", result); + *size = result; + return 1; +} + +/** + * parse_range - Convert a string representing a range of numbers + * @string: The string to be parsed + * @start: The beginning of the range will be stored here + * @finish: The end of the range will be stored here + * + * Read a string of the form n-m. If the lower end is missing, zero will be + * substituted. If the upper end is missing LONG_MAX will be used. If the + * string cannot be parsed correctly, @start and @finish will not be changed. + * + * Return: 1 Success, a valid string was found + * 0 Error, the string was not a valid range + */ +int parse_range (const char *string, long long *start, long long *finish) +{ + long long a, b; + char *middle; + + if (!string || !start || !finish) + return 0; + + middle = strchr (string, '-'); + if (string == middle) { + Dprintf ("Range has no beginning, defaulting to 0.\n"); + a = 0; + } else { + if (!parse_size (string, &a)) + return 0; + } + + if (middle) { + if (middle[1] == 0) { + b = LONG_MAX; + Dprintf ("Range has no end, defaulting to %lld.\n", b); + } else { + if (!parse_size (middle+1, &b)) + return 0; + } + } else { + b = a; + } + + Dprintf ("Range '%s' = %lld - %lld\n", string, a, b); + + *start = a; + *finish = b; + return 1; +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char *argv[]) +{ + static const char *sopt = "-b:Cc:d:fhm:o:p:sS:t:u:qvV"; + static const struct option lopt[] = { + { "byte", required_argument, NULL, 'b' }, + { "case", no_argument, NULL, 'C' }, + { "copy", required_argument, NULL, 'c' }, + { "destination", required_argument, NULL, 'd' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "match", required_argument, NULL, 'm' }, + { "output", required_argument, NULL, 'o' }, + { "percentage", required_argument, NULL, 'p' }, + { "scan", no_argument, NULL, 's' }, + { "size", required_argument, NULL, 'S' }, + { "time", required_argument, NULL, 't' }, + { "undelete", required_argument, NULL, 'u' }, + { "quiet", no_argument, NULL, 'q' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + char *end = NULL; + int err = 0; + int ver = 0; + int help = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + opts.mode = MODE_NONE; + opts.uinode = -1; + opts.percent = -1; + opts.fillbyte = -1; + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else { + opts.device = NULL; + err++; + } + break; + case 'b': + if (opts.fillbyte == -1) { + end = NULL; + opts.fillbyte = strtol (optarg, &end, 0); + if (end && *end) + err++; + } else { + err++; + } + break; + case 'C': + opts.match_case++; + break; + case 'c': + if (opts.mode == MODE_NONE) { + if (!parse_range (argv[optind-1], &opts.mft_begin, &opts.mft_end)) + err++; + opts.mode = MODE_COPY; + } else { + opts.mode = MODE_ERROR; + } + break; + case 'd': + if (!opts.dest) + opts.dest = argv[optind-1]; + else + err++; + break; + case 'f': + opts.force++; + break; + case 'h': + help++; + break; + case 'm': + if (!opts.match) { + if (!transform (argv[optind-1], &opts.match)) + err++; + } else { + err++; + } + break; + case 'o': + if (!opts.output) { + opts.output = argv[optind-1]; + } else { + err++; + } + break; + case 'p': + if (opts.percent == -1) { + end = NULL; + opts.percent = strtol (optarg, &end, 0); + if (end && ((*end != '%') && (*end != 0))) + err++; + } else { + err++; + } + break; + case 'q': + opts.quiet++; + break; + case 's': + if (opts.mode == MODE_NONE) + opts.mode = MODE_SCAN; + else + opts.mode = MODE_ERROR; + break; + case 'S': + if ((opts.size_begin > 0) || (opts.size_end > 0) || + !parse_range (argv[optind-1], &opts.size_begin, + &opts.size_end)) { + err++; + } + break; + case 't': + if (opts.since == 0) { + if (!parse_time (argv[optind-1], &opts.since)) + err++; + } else { + err++; + } + break; + case 'u': + if (opts.mode == MODE_NONE) { + end = NULL; + opts.mode = MODE_UNDELETE; + opts.uinode = strtol (optarg, &end, 0); + if (end && *end) + err++; + } else { + opts.mode = MODE_ERROR; + } + break; + case 'v': + opts.verbose++; + break; + case 'V': + ver++; + break; + default: + if (((optopt == 'b') || (optopt == 'c') || + (optopt == 'd') || (optopt == 'm') || + (optopt == 'o') || (optopt == 'p') || + (optopt == 'S') || (optopt == 't') || + (optopt == 'u')) && (!optarg)) { + Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); + } else { + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + } + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if (opts.device == NULL) { + Eprintf ("You must specify exactly one device.\n"); + err++; + } + + if (opts.mode == MODE_NONE) { + opts.mode = MODE_SCAN; + } + + switch (opts.mode) { + case MODE_SCAN: + if (opts.output || opts.dest || (opts.fillbyte != -1)) { + Eprintf ("Scan can only be used with --percent, " + "--match, --ignore-case, --size and --time.\n"); + err++; + } + if (opts.match_case && !opts.match) { + Eprintf ("The --case option doesn't make sense without the --match option\n"); + err++; + } + break; + case MODE_UNDELETE: + if ((opts.percent != -1) || opts.match || opts.match_case || + (opts.size_begin > 0) || (opts.size_end > 0)) { + Eprintf ("Undelete can only be used with " + "--output, --destination and --byte.\n"); + err++; + } + break; + case MODE_COPY: + if ((opts.fillbyte != -1) || (opts.percent != -1) || + opts.match || opts.match_case || + (opts.size_begin > 0) || (opts.size_end > 0)) { + Eprintf ("Copy can only be used with --output and --destination.\n"); + err++; + } + break; + default: + Eprintf ("You can only select one of Scan, Undelete or Copy.\n"); + err++; + } + + if ((opts.percent < -1) || (opts.percent > 100)) { + Eprintf ("Percentage value must be in the range 0 - 100.\n"); + err++; + } + + if (opts.quiet) { + if (opts.verbose) { + Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + err++; + } else if (opts.mode == MODE_SCAN) { + Eprintf ("You may not use --quiet when scanning a volume.\n"); + err++; + } + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + + +/** + * free_file - Release the resources used by a file object + * @file: The unwanted file object + * + * This will free up the memory used by a file object and iterate through the + * object's children, freeing their resources too. + * + * Return: none + */ +void free_file (struct ufile *file) +{ + struct list_head *item, *tmp; + + if (!file) + return; + + list_for_each_safe (item, tmp, &file->name) { /* List of filenames */ + struct filename *f = list_entry (item, struct filename, list); + Dprintf ("freeing filename '%s'\n", f->name ? f->name : NONE); + if (f->name) + free (f->name); + free (f); + } + + list_for_each_safe (item, tmp, &file->data) { /* List of data streams */ + struct data *d = list_entry (item, struct data, list); + Dprintf ("freeing data stream '%s'\n", d->name ? d->name : UNNAMED); + if (d->name) + free (d->name); + if (d->run_list) + free (d->run_list); + free (d); + } + + free (file->mft); + free (file); +} + +/** + * ntfs2utc - Convert an NTFS time to Unix time + * @time: An NTFS time in 100ns units since 1601 + * + * NTFS stores times as the number of 100ns intervals since January 1st 1601 at + * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. + * + * Return: n A Unix time (number of seconds since 1970) + */ +time_t ntfs2utc (long long time) +{ + return (time - ((long long) (369 * 365 + 89) * 24 * 3600 * 10000000)) / 10000000; +} + +/** + * find_attribute - Find an attribute of the given type + * @type: An attribute type, e.g. AT_FILE_NAME + * @ctx: A search context, created using ntfs_get_attr_search_ctx + * + * Using the search context to keep track, find the first/next occurrence of a + * given attribute type. + * + * N.B. This will return a pointer into @mft. As long as the search context + * has been created without an inode, it won't overflow the buffer. + * + * Return: Pointer Success, an attribute was found + * NULL Error, no matching attributes were found + */ +ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) +{ + if (!ctx) + return NULL; + + if (ntfs_lookup_attr (type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { + Dprintf ("find_attribute didn't find an attribute of type: 0x%02x.\n", type); + return NULL; /* None / no more of that type */ + } + + Dprintf ("find_attribute found an attribute of type: 0x%02x.\n", type); + return ctx->attr; +} + +/** + * find_first_attribute - Find the first attribute of a given type + * @type: An attribute type, e.g. AT_FILE_NAME + * @mft: A buffer containing a raw MFT record + * + * Search through a raw MFT record for an attribute of a given type. + * The return value is a pointer into the MFT record that was supplied. + * + * N.B. This will return a pointer into @mft. The pointer won't stray outside + * the buffer, since we created the search context without an inode. + * + * Return: Pointer Success, an attribute was found + * NULL Error, no matching attributes were found + */ +ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) +{ + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *rec; + + if (!mft) + return NULL; + + ctx = ntfs_get_attr_search_ctx (NULL, mft); + if (!ctx) { + Eprintf ("Couldn't create a search context.\n"); + return NULL; + } + + rec = find_attribute (type, ctx); + ntfs_put_attr_search_ctx (ctx); + if (rec) + Dprintf ("find_first_attribute: found attr of type 0x%02x.\n", type); + else + Dprintf ("find_first_attribute: didn't find attr of type 0x%02x.\n", type); + return rec; +} + +/** + * get_filenames - Read an MFT Record's $FILENAME attributes + * @file: The file object to work with + * + * A single file may have more than one filename. This is quite common. + * Windows creates a short DOS name for each long name, e.g. LONGFI~1.XYZ, + * LongFiLeName.xyZ. + * + * The filenames that are found are put in filename objects and added to a + * linked list of filenames in the file object. For convenience, the unicode + * filename is converted into the current locale and stored in the filename + * object. + * + * One of the filenames is picked (the one with the lowest numbered namespace) + * and its locale friendly name is put in pref_name. + * + * Return: n The number of $FILENAME attributes found + * -1 Error + */ +int get_filenames (struct ufile *file) +{ + ATTR_RECORD *rec; + FILE_NAME_ATTR *attr; + ntfs_attr_search_ctx *ctx; + struct filename *name; + int count = 0; + int space = 4; + + if (!file) + return -1; + + ctx = ntfs_get_attr_search_ctx (NULL, file->mft); + if (!ctx) + return -1; + + while ((rec = find_attribute (AT_FILE_NAME, ctx))) { + /* We know this will always be resident. */ + attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); + + name = calloc (1, sizeof (*name)); + if (!name) { + Eprintf ("Couldn't allocate memory in get_filenames().\n"); + count = -1; + break; + } + + name->uname = attr->file_name; + name->uname_len = attr->file_name_length; + name->name_space = attr->file_name_type; + name->size_alloc = sle64_to_cpu (attr->allocated_size); + name->size_data = sle64_to_cpu (attr->data_size); + name->flags = attr->file_attributes; + + name->date_c = ntfs2utc (sle64_to_cpu (attr->creation_time)); + name->date_a = ntfs2utc (sle64_to_cpu (attr->last_data_change_time)); + name->date_m = ntfs2utc (sle64_to_cpu (attr->last_mft_change_time)); + name->date_r = ntfs2utc (sle64_to_cpu (attr->last_access_time)); + + file->date = max (file->date, name->date_c); + file->date = max (file->date, name->date_a); + file->date = max (file->date, name->date_m); + file->date = max (file->date, name->date_r); + + if (ntfs_ucstombs (name->uname, name->uname_len, &name->name, + name->uname_len) < 0) { + Dprintf ("Couldn't translate filename to current locale.\n"); + } + + if (name->name_space < space) { + file->pref_name = name->name; + space = name->name_space; + } + + file->max_size = max (file->max_size, name->size_alloc); + file->max_size = max (file->max_size, name->size_data); + + list_add_tail (&name->list, &file->name); + count++; + } + + ntfs_put_attr_search_ctx (ctx); + Dprintf ("File has %d names.\n", count); + return count; +} + +/** + * get_data - Read an MFT Record's $DATA attributes + * @file: The file object to work with + * @vol: An ntfs volume obtained from ntfs_mount + * + * A file may have more than one data stream. All files will have an unnamed + * data stream which contains the file's data. Some Windows applications store + * extra information in a separate stream. + * + * The streams that are found are put in data objects and added to a linked + * list of data streams in the file object. + * + * Return: n The number of $FILENAME attributes found + * -1 Error + */ +int get_data (struct ufile *file, ntfs_volume *vol) +{ + ATTR_RECORD *rec; + ntfs_attr_search_ctx *ctx; + int count = 0; + struct data *data; + + if (!file) + return -1; + + ctx = ntfs_get_attr_search_ctx (NULL, file->mft); + if (!ctx) + return -1; + + while ((rec = find_attribute (AT_DATA, ctx))) { + data = calloc (1, sizeof (*data)); + if (!data) { + Eprintf ("Couldn't allocate memory in get_data().\n"); + count = -1; + break; + } + + data->resident = !rec->non_resident; + data->compressed = rec->flags & ATTR_IS_COMPRESSED; + data->encrypted = rec->flags & ATTR_IS_ENCRYPTED; + + if (rec->name_length) { + data->uname = (uchar_t *) ((char *) rec + le16_to_cpu (rec->name_offset)); + data->uname_len = rec->name_length; + + if (ntfs_ucstombs (data->uname, data->uname_len, &data->name, + data->uname_len) < 0) { + Eprintf ("Cannot translate name into current locale.\n"); + } + } + + if (data->resident) { + data->size_data = le32_to_cpu (rec->value_length); + data->data = ((char*) (rec)) + le16_to_cpu (rec->value_offset); + } else { + data->size_alloc = sle64_to_cpu (rec->allocated_size); + data->size_data = sle64_to_cpu (rec->data_size); + data->size_init = sle64_to_cpu (rec->initialized_size); + data->size_vcn = sle64_to_cpu (rec->highest_vcn) + 1; + } + + data->run_list = ntfs_decompress_mapping_pairs (vol, rec, NULL); + if (!data->run_list) { + Dprintf ("Couldn't decompress the data runs\n"); + } + + file->max_size = max (file->max_size, data->size_data); + file->max_size = max (file->max_size, data->size_init); + + list_add_tail (&data->list, &file->data); + count++; + } + + ntfs_put_attr_search_ctx (ctx); + Dprintf ("File has %d data streams.\n", count); + return count; +} + +/** + * read_record - Read an MFT record into memory + * @vol: An ntfs volume obtained from ntfs_mount + * @record: The record number to read + * + * Read the specified MFT record and gather as much information about it as + * possible. + * + * Return: Pointer A ufile object containing the results + * NULL Error + */ +struct ufile * read_record (ntfs_volume *vol, long long record) +{ + ATTR_RECORD *attr10, *attr20, *attr90; + struct ufile *file; + ntfs_attr *mft; + + if (!vol) + return NULL; + + file = calloc (1, sizeof (*file)); + if (!file) { + Eprintf ("Couldn't allocate memory in read_record()\n"); + return NULL; + } + + INIT_LIST_HEAD (&file->name); + INIT_LIST_HEAD (&file->data); + file->inode = record; + + file->mft = malloc (vol->mft_record_size); + if (!file->mft) { + Eprintf ("Couldn't allocate memory in read_record()\n"); + free_file (file); + return NULL; + } + + mft = ntfs_attr_open (vol->mft_ni, AT_DATA, NULL, 0); + if (!mft) { + Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); + free_file (file); + return NULL; + } + + if (ntfs_attr_mst_pread (mft, vol->mft_record_size * record, 1, vol->mft_record_size, file->mft) < 1) { + Eprintf ("Couldn't read MFT Record %lld.\n", record); + ntfs_attr_close (mft); + free_file (file); + return NULL; + } + + ntfs_attr_close (mft); + mft = NULL; + + attr10 = find_first_attribute (AT_STANDARD_INFORMATION, file->mft); + attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, file->mft); + attr90 = find_first_attribute (AT_INDEX_ROOT, file->mft); + + Dprintf ("Attributes present: %s %s %s\n", attr10?"0x10":"", attr20?"0x20":"", attr90?"0x90":""); + + if (attr10) + { + STANDARD_INFORMATION *si; + si = (STANDARD_INFORMATION *) ((char *) attr10 + le16_to_cpu (attr10->value_offset)); + file->date = max (file->date, ntfs2utc (sle64_to_cpu (si->last_data_change_time))); + } + + if (attr20 || !attr10) + file->attr_list = 1; + if (attr90) + file->directory = 1; + + if (get_filenames (file) < 0) { + Eprintf ("Couldn't get filenames.\n"); + } + if (get_data (file, vol) < 0) { + Eprintf ("Couldn't get data streams.\n"); + } + + return file; +} + + +/** + * cluster_in_use - Determine if a cluster is in use + * @vol: An ntfs volume obtained from ntfs_mount + * @lcn: The Logical Cluster Number to test + * + * The metadata file $Bitmap has one binary bit representing each cluster on + * disk. The bit will be set of each cluster that is in use. The function + * reads the relevant part of $Bitmap into a buffer and tests the bit. + * + * This function has a static buffer in which it caches a section of $Bitmap. + * If the lcn, being tested, lies outside the range, the buffer will be + * refreshed. + * + * Return: 1 Cluster is in use + * 0 Cluster is free space + * -1 Error occurred + */ +int cluster_in_use (ntfs_volume *vol, long long lcn) +{ + static unsigned char buffer[512]; + static long long bmplcn = -sizeof (buffer) - 1; /* Which bit of $Bitmap is in the buffer */ + + int byte, bit; + ntfs_attr *attr; + + if (!vol) + return -1; + + /* Does lcn lie in the section of $Bitmap we already have cached? */ + if ((lcn < bmplcn) || (lcn >= (bmplcn + (sizeof (buffer) << 3)))) { + Dprintf ("Bit lies outside cache.\n"); + attr = ntfs_attr_open (vol->lcnbmp_ni, AT_DATA, NULL, 0); + if (!attr) { + Eprintf ("Couldn't open $MFT/$BITMAP: %s\n", strerror (errno)); + return -1; + } + + /* Mark the buffer as in use, in case the read is shorter. */ + memset (buffer, 0xFF, sizeof (buffer)); + bmplcn = lcn & (~((sizeof (buffer) << 3) - 1)); + + if (ntfs_attr_pread (attr, (bmplcn>>3), sizeof (buffer), buffer) < 0) { + Eprintf ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno)); + ntfs_attr_close (attr); + return -1; + } + + Dprintf ("Reloaded bitmap buffer.\n"); + ntfs_attr_close (attr); + } + + bit = 1 << (lcn & 7); + byte = (lcn >> 3) & (sizeof (buffer) - 1); + Dprintf ("cluster = %lld, bmplcn = %lld, byte = %d, bit = %d, in use %d\n", + lcn, bmplcn, byte, bit, buffer[byte] & bit); + + return (buffer[byte] & bit); +} + +/** + * calc_percentage - Calculate how much of the file is recoverable + * @file: The file object to work with + * @vol: An ntfs volume obtained from ntfs_mount + * + * Read through all the $DATA streams and determine if each cluster in each + * stream is still free disk space. This is just measuring the potential for + * recovery. The data may have still been overwritten by a another file which + * was then deleted. + * + * Files with a resident $DATA stream will have a 100% potential. + * + * N.B. If $DATA attribute spans more than one MFT record (i.e. badly + * fragmented) then only the data in this segment will be used for the + * calculation. + * + * N.B. Currently, compressed and encrypted files cannot be recovered, so they + * will return 0%. + * + * Return: n The percentage of the file that _could_ be recovered + * -1 Error + */ +int calc_percentage (struct ufile *file, ntfs_volume *vol) +{ + run_list_element *rl = NULL; + struct list_head *pos; + struct data *data; + long long i, j; + long long start, end; + int inuse, free; + int percent = 0; + + if (!file || !vol) + return -1; + + if (file->directory) { + Dprintf ("Found a directory: not recoverable.\n"); + return 0; + } + + if (list_empty (&file->data)) { + Vprintf ("File has no data streams.\n"); + return 0; + } + + list_for_each (pos, &file->data) { + data = list_entry (pos, struct data, list); + inuse = 0; + free = 0; + + if (data->encrypted) { + Vprintf ("File is encrypted, recovery is impossible.\n"); + continue; + } + + if (data->compressed) { + Vprintf ("File is compressed, recovery not yet implemented.\n"); + continue; + } + + if (data->resident) { + Vprintf ("File is resident, therefore recoverable.\n"); + percent = 100; + data->percent = 100; + continue; + } + + rl = data->run_list; + if (!rl) { + Vprintf ("File has no run list, hence no data.\n"); + continue; + } + + if (rl[0].length <= 0) { + Vprintf ("File has an empty run list, hence no data.\n"); + continue; + } + + if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ + Vprintf ("Missing segment at beginning, %lld clusters\n", rl[0].length); + inuse += rl[0].length; + rl++; + } + + for (i = 0; rl[i].length > 0; i++) { + if (rl[i].lcn == LCN_RL_NOT_MAPPED) { + Vprintf ("Missing segment at end, %lld clusters\n", rl[i].length); + inuse += rl[i].length; + continue; + } + + if (rl[i].lcn == LCN_HOLE) { + free += rl[i].length; + continue; + } + + start = rl[i].lcn; + end = rl[i].lcn + rl[i].length; + + for (j = start; j < end; j++) { + if (cluster_in_use (vol, j)) + inuse++; + else + free++; + } + } + + if ((inuse + free) == 0) { + Eprintf ("Unexpected error whilst calculating percentage for inode %lld\n", file->inode); + continue; + } + + data->percent = (free * 100) / (inuse + free); + + percent = max (percent, data->percent); + } + + Vprintf ("File is %d%% recoverable\n", percent); + return percent; +} + +/** + * dump_record - Print everything we know about an MFT record + * @file: The file to work with + * + * Output the contents of the file object. This will print everything that has + * been read from the MFT record, or implied by various means. + * + * Because of the redundant nature of NTFS, there will be some duplication of + * information, though it will have been read from different sources. + * + * N.B. If the filename is missing, or couldn't be converted to the current + * locale, "" will be displayed. + * + * Return: none + */ +void dump_record (struct ufile *file) +{ + char buffer[20]; + char *name; + struct list_head *item; + int i; + + if (!file) + return; + + Iprintf ("MFT Record %lld\n", file->inode); + Iprintf ("Type: %s\n", (file->directory) ? "Directory" : "File"); + strftime (buffer, sizeof (buffer), "%F %R", localtime (&file->date)); + Iprintf ("Date: %s\n", buffer); + + if (file->attr_list) + Iprintf ("Metadata may span more than one MFT record\n"); + + list_for_each (item, &file->name) { + struct filename *f = list_entry (item, struct filename, list); + + if (f->name) + name = f->name; + else + name = NONE; + + Iprintf ("Filename: (%d) %s\n", f->name_space, f->name); + Iprintf ("File Flags: "); + if (f->flags & FILE_ATTR_SYSTEM) Iprintf ("System "); + if (f->flags & FILE_ATTR_DIRECTORY) Iprintf ("Directory "); + if (f->flags & FILE_ATTR_SPARSE_FILE) Iprintf ("Sparse "); + if (f->flags & FILE_ATTR_REPARSE_POINT) Iprintf ("Reparse "); + if (f->flags & FILE_ATTR_COMPRESSED) Iprintf ("Compressed "); + if (f->flags & FILE_ATTR_ENCRYPTED) Iprintf ("Encrypted "); + if (!(f->flags & (FILE_ATTR_SYSTEM || FILE_ATTR_DIRECTORY || + FILE_ATTR_SPARSE_FILE || FILE_ATTR_REPARSE_POINT || + FILE_ATTR_COMPRESSED || FILE_ATTR_ENCRYPTED))) { + Iprintf (NONE); + } + Iprintf ("\n"); + Iprintf ("Size alloc: %lld\n", f->size_alloc); + Iprintf ("Size data: %lld\n", f->size_data); + + strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_c)); + Iprintf ("Date C: %s\n", buffer); + strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_a)); + Iprintf ("Date A: %s\n", buffer); + strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_m)); + Iprintf ("Date M: %s\n", buffer); + strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_r)); + Iprintf ("Date R: %s\n", buffer); + } + + Iprintf ("Data Streams:\n"); + list_for_each (item, &file->data) { + struct data *d = list_entry (item, struct data, list); + Iprintf ("Name: %s\n", (d->name) ? d->name : ""); + Iprintf ("Flags: "); + if (d->resident) Iprintf ("Resident\n"); + if (d->compressed) Iprintf ("Compressed\n"); + if (d->encrypted) Iprintf ("Encrypted\n"); + if (!d->resident && !d->compressed && !d->encrypted) + Iprintf ("None\n"); + else + Iprintf ("\n"); + + Iprintf ("Size alloc: %lld\n", d->size_alloc); + Iprintf ("Size data: %lld\n", d->size_data); + Iprintf ("Size init: %lld\n", d->size_init); + Iprintf ("Size vcn: %lld\n", d->size_vcn); + + Iprintf ("Data runs:\n"); + if ((!d->run_list) || (d->run_list[0].length <= 0)) { + Iprintf (" None\n"); + } else { + for (i = 0; d->run_list[i].length > 0; i++) { + Iprintf (" %lld @ %lld\n", d->run_list[i].length, d->run_list[i].lcn); + } + } + + Iprintf ("Amount potentially recoverable %d%%\n", d->percent); + } + + Iprintf ("________________________________________\n\n"); +} + +/** + * list_record - Print a one line summary of the file + * @file: The file to work with + * + * Print a one line description of a file. + * + * Inode Flags %age Date Size Filename + * + * The output will contain the file's inode number (MFT Record), some flags, + * the percentage of the file that is recoverable, the last modification date, + * the size and the filename. + * + * The flags are F/D = File/Directory, N/R = Data is (Non-)Resident, + * C = Compressed, E = Encrypted, ! = Metadata may span multiple records. + * + * N.B. The file size is stored in many forms in several attributes. This + * display the largest it finds. + * + * N.B. If the filename is missing, or couldn't be converted to the current + * locale, "" will be displayed. + * + * Return: none + */ +void list_record (struct ufile *file) +{ + char buffer[20]; + struct list_head *item; + char *name = NULL; + long long size = 0; + int percent = 0; + + char flagd = '.', flagr = '.', flagc = '.', flagx = '.'; + + strftime (buffer, sizeof (buffer), "%F", localtime (&file->date)); + + if (file->attr_list) + flagx = '!'; + + if (file->directory) + flagd = 'D'; + else + flagd = 'F'; + + list_for_each (item, &file->data) { + struct data *d = list_entry (item, struct data, list); + + if (!d->name) { + if (d->resident) flagr = 'R'; + else flagr = 'N'; + if (d->compressed) flagc = 'C'; /* These two are mutually exclusive */ + if (d->encrypted) flagc = 'E'; + + percent = max (percent, d->percent); + } + + size = max (size, d->size_data); + size = max (size, d->size_init); + } + + if (file->pref_name) + name = file->pref_name; + else + name = NONE; + + Iprintf ("%-8lld %c%c%c%c %3d%% %s %9lld %s\n", + file->inode, flagd, flagr, flagc, flagx, + percent, buffer, size, name); +} + +/** + * name_match - Does a file have a name matching a regex + * @re: The regular expression object + * @file: The file to be tested + * + * Iterate through the file's $FILENAME attributes and compare them against the + * regular expression, created with regcomp. + * + * Return: 1 There is a matching filename. + * 0 There is no match. + */ +int name_match (regex_t *re, struct ufile *file) +{ + struct list_head *item; + int result; + + if (!re || !file) + return 0; + + list_for_each (item, &file->name) { + struct filename *f = list_entry (item, struct filename, list); + + if (!f->name) + continue; + result = regexec (re, f->name, 0, NULL, 0); + if (result < 0) { + Eprintf ("Couldn't compare filename with regex: %s\n", strerror (errno)); + return 0; + } else if (result == REG_NOERROR) { + Dprintf ("Found a matching filename.\n"); + return 1; + } + } + + Dprintf ("Filename '%s' doesn't match regex.\n", file->pref_name); + return 0; +} + +/** + * write_data - Write out a block of data + * @fd: File descriptor to write to + * @buffer: Data to write + * @bufsize: Amount of data to write + * + * Write a block of data to a file descriptor. + * + * Return: -1 Error, something went wrong + * 0 Success, all the data was written + */ +unsigned int write_data (int fd, const char *buffer, unsigned int bufsize) +{ + ssize_t result1, result2; + + if (!buffer) { + errno = EINVAL; + return -1; + } + + result1 = write (fd, buffer, bufsize); + if ((result1 == (ssize_t) bufsize) || (result1 < 0)) + return result1; + + /* Try again with the rest of the buffer */ + buffer += result1; + bufsize -= result1; + + result2 = write (fd, buffer, bufsize); + if (result2 < 0) + return result1; + + return result1 + result2; +} + +/** + * open_file - Create a file based on the dir, name and stream supplied + * @dir: Directory in which to create the file (optional) + * @name: Filename to give the file (optional) + * @stream: Name of the stream (optional) + * + * Create a file and return the file descriptor. All the components are + * optional. If the name is missing, "unknown" will be used. If the directory + * is missing the file will be created in the current directory. If the stream + * name is present it will be appended to the filename, delimited by a colon. + * + * Return: -1 Error, failed to create the file + * n Success, this is the file descriptor + */ +int open_file (const char *dir, const char *name, const char *stream) +{ + char buf[256]; + int flags; + + if (!name) + name = UNKNOWN; + + if (dir) + if (stream) + snprintf (buf, sizeof (buf), "%s/%s:%s", dir, name, stream); + else + snprintf (buf, sizeof (buf), "%s/%s", dir, name); + else + if (stream) + snprintf (buf, sizeof (buf), "%s:%s", name, stream); + else + snprintf (buf, sizeof (buf), "%s", name); + + Vprintf ("Creating file: %s\n", buf); + + if (opts.force) + flags = O_RDWR | O_CREAT | O_TRUNC; + else + flags = O_RDWR | O_CREAT | O_EXCL; + + return open (buf, flags, S_IRUSR | S_IWUSR); +} + + +/** + * scan_disk - Search an NTFS volume for files that could be undeleted + * @vol: An ntfs volume obtained from ntfs_mount + * + * Read through all the MFT entries looking for deleted files. For each one + * determine how much of the data lies in unused disk space. + * + * The list can be filtered by name, size and date, using command line options. + * + * Return: -1 Error, something went wrong + * n Success, the number of recoverable files + */ +int scan_disk (ntfs_volume *vol) +{ + const int BUFSIZE = 8192; + char *buffer = NULL; + int results = 0; + ntfs_attr *attr; + long long size; + long long read; + long long bmpsize; + int i, j, k, b; + int percent; + struct ufile *file; + regex_t re; + + if (!vol) + return -1; + + attr = ntfs_attr_open (vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0); + if (!attr) { + Eprintf ("Couldn't open $MFT/$BITMAP: %s\n", strerror (errno)); + return -1; + } + bmpsize = attr->initialized_size; + + buffer = malloc (BUFSIZE); + if (!buffer) { + Eprintf ("Couldn't allocate memory in scan_disk()\n"); + results = -1; + goto out; + } + + if (opts.match) { + int flags = REG_NOSUB; + + if (!opts.match_case) + flags |= REG_ICASE; + if (regcomp (&re, opts.match, flags)) { + Eprintf ("Couldn't create a regex.\n"); + goto out; + } + } + + Iprintf ("Inode Flags %%age Date Size Filename\n"); + Iprintf ("---------------------------------------------------------------\n"); + for (i = 0; i < bmpsize; i += BUFSIZE) { + read = min ((bmpsize - i), BUFSIZE); + size = ntfs_attr_pread (attr, i, read, buffer); + if (size < 0) + break; + + for (j = 0; j < size; j++) { + b = buffer[j]; + for (k = 0; k < 8; k++, b>>=1) { + if (((i+j)*8+k) >= vol->nr_mft_records) + goto done; + if (b & 1) + continue; + file = read_record (vol, (i+j)*8+k); + if (!file) { + Eprintf ("Couldn't read MFT Record %d.\n", (i+j)*8+k); + continue; + } + + if ((opts.since > 0) && (file->date <= opts.since)) + goto skip; + if (opts.match && !name_match (&re, file)) + goto skip; + if (opts.size_begin && (opts.size_begin > file->max_size)) + goto skip; + if (opts.size_end && (opts.size_end < file->max_size)) + goto skip; + + percent = calc_percentage (file, vol); + + if ((opts.percent == -1) || (percent >= opts.percent)) { + if (opts.verbose) + dump_record (file); + else + list_record (file); + } + + if (((opts.percent == -1) && (percent > 0)) || + ((opts.percent > 0) && (percent >= opts.percent))) { + results++; + } +skip: + free_file (file); + } + } + } +done: + Iprintf ("\nFiles with potentially recoverable content: %d\n", results); +out: + if (opts.match) + regfree (&re); + free (buffer); + if (attr) + ntfs_attr_close (attr); + return results; +} + +/** + * undelete_file - Recover a deleted file from an NTFS volume + * @vol: An ntfs volume obtained from ntfs_mount + * @inode: MFT Record number to be recovered + * + * Read an MFT Record and try an recover any data associated with it. Some of + * the clusters may be in use; these will be filled with zeros or the fill byte + * supplied in the options. + * + * Each data stream will be recovered and saved to a file. The file's name will + * be the original filename and it will be written to the current directory. + * Any named data stream will be saved as filename:streamname. + * + * The output file's name and location can be altered by using the command line + * options. + * + * N.B. We cannot tell if someone has overwritten some of the data since the + * file was deleted. + * + * Return: 0 Error, something went wrong + * 1 Success, the data was recovered + */ +int undelete_file (ntfs_volume *vol, long long inode) +{ + char *buffer = NULL; + struct ufile *file; + int i, j; + long long start, end; + run_list_element *rl; + struct list_head *item; + int fd = -1; + long long k; + int result = 0; + + if (!vol) + return 0; + + file = read_record (vol, inode); + if (!file || !file->mft) { + Eprintf ("Can't read info from mft record %lld.\n", inode); + return 0; + } + + buffer = malloc (vol->mft_record_size); + if (!buffer) + goto free; + + if (opts.verbose) { + dump_record (file); + } else { + Iprintf ("Inode Flags %%age Date Size Filename\n"); + Iprintf ("---------------------------------------------------------------\n"); + list_record (file); + Iprintf ("\n"); + } + + if (file->mft->flags & MFT_RECORD_IN_USE) { + Eprintf ("Record is in use by the mft\n"); + if (!opts.force) { + free_file (file); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + if (calc_percentage (file, vol) == 0) { + Iprintf ("File has no recoverable data.\n"); + goto free; + } + + if (list_empty (&file->data)) { + Iprintf ("File has no data. There is nothing to recover.\n"); + goto free; + } + + list_for_each (item, &file->data) { + struct data *d = list_entry (item, struct data, list); + + if (d->resident) { + fd = open_file (opts.dest, file->pref_name, d->name); + if (fd < 0) { + Eprintf ("Couldn't create file: %s\n", strerror (errno)); + goto free; + } + + Vprintf ("File has resident data.\n"); + if (write_data (fd, d->data, d->size_data) < d->size_data) { + Eprintf ("Write failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + + if (close (fd) < 0) { + Eprintf ("Close failed: %s\n", strerror (errno)); + } + fd = -1; + } else { + rl = d->run_list; + if (!rl) { + Vprintf ("File has no run list, hence no data.\n"); + continue; + } + + if (rl[0].length <= 0) { + Vprintf ("File has an empty run list, hence no data.\n"); + continue; + } + + fd = open_file (opts.dest, file->pref_name, d->name); + if (fd < 0) { + Eprintf ("Couldn't create output file: %s\n", strerror (errno)); + goto free; + } + + if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ + Vprintf ("Missing segment at beginning, %lld clusters.\n", rl[0].length); + memset (buffer, opts.fillbyte, sizeof (buffer)); + for (k = 0; k < rl[0].length * vol->cluster_size; k += sizeof (buffer)) { + if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + Eprintf ("Write failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + } + } + + for (i = 0; rl[i].length > 0; i++) { + + if (rl[i].lcn == LCN_RL_NOT_MAPPED) { + Vprintf ("Missing segment at end, %lld clusters.\n", rl[i].length); + memset (buffer, opts.fillbyte, sizeof (buffer)); + for (k = 0; k < rl[k].length * vol->cluster_size; k += sizeof (buffer)) { + if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + Eprintf ("Write failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + } + continue; + } + + if (rl[i].lcn == LCN_HOLE) { + Vprintf ("File has a sparse section.\n"); + memset (buffer, 0, sizeof (buffer)); + for (k = 0; k < rl[k].length * vol->cluster_size; k += sizeof (buffer)) { + if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + Eprintf ("Write failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + } + continue; + } + + start = rl[i].lcn; + end = rl[i].lcn + rl[i].length; + + for (j = start; j < end; j++) { + if (cluster_in_use (vol, j)) { + memset (buffer, opts.fillbyte, sizeof (buffer)); + if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + Eprintf ("Write failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + } else { + if (ntfs_read_clusters (vol, j, 1, buffer) < 1) { + Eprintf ("Read failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + Eprintf ("Write failed: %s\n", strerror (errno)); + close (fd); + goto free; + } + } + } + } + Iprintf ("\n"); + if (close (fd) < 0) { + Eprintf ("Close failed: %s\n", strerror (errno)); + } + fd = -1; + + } + if (d->name) + Iprintf ("Undeleted '%s:%s' successfully.\n", file->pref_name, d->name); + else + Iprintf ("Undeleted '%s' successfully.\n", file->pref_name); + } + result = 1; +free: + if (buffer) + free (buffer); + free_file (file); + return result; +} + +/** + * copy_mft - Write a range of MFT Records to a file + * @vol: An ntfs volume obtained from ntfs_mount + * @mft_begin: First MFT Record to save + * @mft_end: Last MFT Record to save + * + * Read a number of MFT Records and write them to a file. + * + * Return: 0 Success, all the records were written + * 1 Error, something went wrong + */ +int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) +{ + ntfs_attr *mft; + char *buffer; + const char *name; + long long i; + int result = 1; + int fd; + + if (!vol) + return 1; + + if (mft_end < mft_begin) { + Eprintf ("Range to copy is backwards.\n"); + return 1; + } + + buffer = malloc (vol->mft_record_size); + if (!buffer) { + Eprintf ("Couldn't allocate memory in copy_mft()\n"); + return 1; + } + + mft = ntfs_attr_open (vol->mft_ni, AT_DATA, NULL, 0); + if (!mft) { + Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); + goto free; + } + + name = opts.output; + if (!name) { + name = MFTFILE; + Dprintf ("No output filename, defaulting to '%s'.\n", name); + } + + fd = open_file (opts.dest, name, NULL); + if (fd < 0) { + Eprintf ("Couldn't open output file '%s': %s\n", name, strerror (errno)); + goto attr; + } + + mft_end = min (mft_end, vol->nr_mft_records - 1); + + Dprintf ("MFT records\n"); + Dprintf (" Total: %8lld\n", vol->nr_mft_records); + Dprintf (" Begin: %8lld\n", mft_begin); + Dprintf (" End: %8lld\n", mft_end); + + for (i = mft_begin; i <= mft_end; i++) { + if (ntfs_attr_pread (mft, vol->mft_record_size * i, vol->mft_record_size, buffer) < vol->mft_record_size) { + Eprintf ("Couldn't read MFT Record %d: %s.\n", i, strerror (errno)); + goto close; + } + + if (write_data (fd, buffer, vol->mft_record_size) < vol->mft_record_size) { + Eprintf ("Write failed: %s\n", strerror (errno)); + goto close; + } + } + + Vprintf ("Read %d MFT Records\n", mft_end - mft_begin + 1); + result = 0; +close: + close (fd); +attr: + ntfs_attr_close (mft); +free: + free (buffer); + return result; +} + +/** + * valid_device - Perform some safety checks on the device, before we start + * @name: Full pathname of the device/file to work with + * @force: Continue regardless of problems + * + * Check that the name refers to a device and that is isn't already mounted. + * These checks can be overridden by using the force option. + * + * Return: 1 Success, we can continue + * 0 Error, we cannot use this device + */ +int valid_device (const char *name, int force) +{ + unsigned long mnt_flags = 0; + struct stat st; + + if (stat (name, &st) == -1) { + if (errno == ENOENT) { + Eprintf ("The device %s doesn't exist\n", name); + } else { + Eprintf ("Error getting information about %s: %s\n", name, strerror (errno)); + } + return 0; + } + + if (!S_ISBLK (st.st_mode)) { + Vprintf ("%s is not a block device.\n", name); + if (!force) { + Eprintf ("Use the force option to work with files.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + /* Make sure the file system is not mounted. */ + if (ntfs_check_if_mounted (name, &mnt_flags)) { + Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); + if (!force) { + Eprintf ("Use the force option to ignore this error.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } else if (mnt_flags & NTFS_MF_MOUNTED) { + Vprintf ("The device %s, is mounted.\n", name); + if (!force) { + Eprintf ("Use the force option to work a mounted filesystem.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + Dprintf ("Device %s, will be used\n", name); + return 1; +} + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main (int argc, char *argv[]) +{ + const char *locale; + ntfs_volume *vol; + int result = 1; + + locale = setlocale (LC_ALL, ""); + if (!locale) { + locale = setlocale (LC_ALL, NULL); + Vprintf ("Failed to set locale, using default '%s'.\n", locale); + } else { + Vprintf ("Using locale '%s'.\n", locale); + } + + if (!parse_options (argc, argv)) + goto free; + + if (!valid_device (opts.device, opts.force)) + goto free; + + vol = ntfs_mount (opts.device, MS_RDONLY); + if (!vol) { + Eprintf ("Couldn't mount device '%s': %s\n", opts.device, strerror (errno)); + goto free; + } + + if (vol->flags & VOLUME_IS_DIRTY) { + Iprintf ("Volume is dirty.\n"); + if (!opts.force) { + Eprintf ("Run chkdsk and try again, or use the --force option.\n"); + goto umount; + } + Iprintf ("Forced to continue.\n"); + } + + switch (opts.mode) { + case MODE_SCAN: + result = !scan_disk (vol); + if (result) + Vprintf ("Failed to scan device '%s'.\n", opts.device); + break; + case MODE_UNDELETE: + result = !undelete_file (vol, opts.uinode); + if (result) + Vprintf ("Failed to undelete inode %d.\n", opts.uinode); + break; + case MODE_COPY: + result = !copy_mft (vol, opts.mft_begin, opts.mft_end); + if (result) + Vprintf ("Failed to read MFT blocks %lld-%lld.\n", + opts.mft_begin, min (vol->nr_mft_records, opts.mft_end)); + break; + default: + ; /* Cannot happen */ + } + +umount: + ntfs_umount (vol, FALSE); +free: + if (opts.match) + free (opts.match); + + return result; +} + diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index e69de29b..21a63d8b 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -0,0 +1,104 @@ +/* + * ntfsundelete - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Richard Russon + * + * This utility will recover deleted files from an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFSUNDELETE_H_ +#define _NTFSUNDELETE_H_ + +#include "types.h" +#include "list.h" +#include "runlist.h" + +enum optmode { + MODE_NONE = 0, + MODE_SCAN, + MODE_UNDELETE, + MODE_COPY, + MODE_ERROR +}; + +struct options { + char *device; /* Device/File to work with */ + enum optmode mode; /* Scan / Undelete / Copy */ + int percent; /* Minimum recoverability */ + int uinode; /* Undelete this inode */ + char *dest; /* Save file to this directory */ + char *output; /* With this filename */ + char fillbyte; /* Use for unrecoverable sections */ + char *match; /* Pattern for filename matching */ + int match_case; /* Case sensitive matching */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int force; /* Override common sense */ + time_t since; /* Since this time */ + long long size_begin; /* Range for file size */ + long long size_end; + long long mft_begin; /* Range for mft copy */ + long long mft_end; +}; + +struct filename { + struct list_head list; /* Previous/Next links */ + char *name; /* Filename in current locale */ + FILE_NAME_TYPE_FLAGS name_space; + uchar_t *uname; /* Filename in unicode */ + int uname_len; /* and its length */ + long long size_alloc; /* Allocated size (multiple of cluster size) */ + long long size_data; /* Actual size of data */ + FILE_ATTR_FLAGS flags; + time_t date_c; + time_t date_a; + time_t date_m; + time_t date_r; +}; + +struct data { + struct list_head list; /* Previous/Next links */ + char *name; /* Stream name in current locale */ + uchar_t *uname; /* Unicode stream name */ + int uname_len; /* and its length */ + int resident; /* Stream is resident */ + int compressed; /* Stream is compressed */ + int encrypted; /* Stream is encrypted */ + long long size_alloc; /* Allocated size (multiple of cluster size) */ + long long size_data; /* Actual size of data */ + long long size_init; /* Initialised size, may be less than data size */ + long long size_vcn; /* Highest VCN in the data runs */ + run_list_element*run_list; /* Decoded data runs */ + int percent; /* Amont potentially recoverable */ + void *data; /* If resident, a pointer to the data */ +}; + +struct ufile { + long long inode; /* MFT record number */ + time_t date; /* Last modification date/time */ + struct list_head name; /* A list of filenames */ + struct list_head data; /* A list of data streams */ + char *pref_name; /* Preferred filename */ + long long max_size; /* Largest size we find */ + int attr_list; /* MFT record may be one of many */ + int directory; /* MFT record represents a directory */ + MFT_RECORD *mft; /* Raw MFT record */ +}; + +#endif /* _NTFSUNDELETE_H_ */ + diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index e69de29b..120e6e52 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -0,0 +1,732 @@ +/** + * ntfswipe - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Richard Russon + * + * This utility will overwrite usused space on an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ntfswipe.h" +#include "types.h" +#include "volume.h" + +static const char *AUTHOR = "Richard Russon (FlatCap)"; +static const char *EXEC_NAME = "ntfswipe"; +static struct options opts; + +/** + * Eprintf - Print error messages + */ +void Eprintf (const char *format, ...) +{ + va_list va; + va_start (va, format); + vfprintf (stderr, format, va); + va_end (va); +} + +/** + * Iprintf - Print informative messages + */ +void Iprintf (const char *format, ...) +{ + va_list va; +#ifndef DEBUG + if (opts.quiet) + return; +#endif + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +} + +/** + * Vprintf - Print verbose messages + */ +void Vprintf (const char *format, ...) +{ + va_list va; +#ifndef DEBUG + if (!opts.verbose) + return; +#endif + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +} + +/** + * Dprintf - Print debug messages + */ +#ifndef DEBUG +#define Dprintf(...) +#else +void Dprintf (const char *format, ...) +{ + va_list va; + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +} +#endif + +/** + * wipe_unused - Wipe unused clusters + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * Read $Bitmap and wipe any clusters that are marked as not in use. + * + * Return: 1 Success, the clusters were wiped + * 0 Error, something went wrong + */ +int wipe_unused (ntfs_volume *vol, int byte) +{ + if (!vol || (byte < 0)) + return 0; + + Iprintf ("wipe_unused 0x%02x\n", byte); + return 1; +} + +/** + * wipe_tails - Wipe the file tails + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * Disk space is allocated in clusters. If a file isn't an exact multiple of + * the cluster size, there is some slack space at the end. Wipe this space. + * + * Return: 1 Success, the clusters were wiped + * 0 Error, something went wrong + */ +int wipe_tails (ntfs_volume *vol, int byte) +{ + if (!vol || (byte < 0)) + return 0; + + Iprintf ("wipe_tails 0x%02x\n", byte); + return 1; +} + +/** + * wipe_mft - Wipe the MFT slack space + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * MFT Records are 1024 bytes long, but some of this space isn't used. Wipe any + * unused space at the end of the record and wipe any unused records. + * + * Return: 1 Success, the clusters were wiped + * 0 Error, something went wrong + */ +int wipe_mft (ntfs_volume *vol, int byte) +{ + if (!vol || (byte < 0)) + return 0; + + Iprintf ("wipe_mft 0x%02x\n", byte); + return 1; +} + +/** + * wipe_directory - Wipe the directiry indexes + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * Directories are kept in sorted B+ Trees. Index blocks may not be full. Wipe + * the unused space at the ends of these blocks. + * + * Return: 1 Success, the clusters were wiped + * 0 Error, something went wrong + */ +int wipe_directory (ntfs_volume *vol, int byte) +{ + if (!vol || (byte < 0)) + return 0; + + Iprintf ("wipe_directory 0x%02x\n", byte); + return 1; +} + +/** + * wipe_logfile - Wipe the logfile (journal) + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * The logfile journals the metadata to give the volume fault-tolerance. If the + * volume is in a consistant state, then this information can be erased. + * + * Return: 1 Success, the clusters were wiped + * 0 Error, something went wrong + */ +int wipe_logfile (ntfs_volume *vol, int byte) +{ + if (!vol || (byte < 0)) + return 0; + + Iprintf ("wipe_logfile 0x%02x\n", byte); + return 1; +} + +/** + * wipe_pagefile - Wipe the pagefile (swap space) + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * pagefile.sys is used by Windows as extra virtual memory (swap space). + * Windows recreates the file at bootup, so it can be wiped without harm. + * + * Return: 1 Success, the clusters were wiped + * 0 Error, something went wrong + */ +int wipe_pagefile (ntfs_volume *vol, int byte) +{ + if (!vol || (byte < 0)) + return 0; + + Iprintf ("wipe_pagefile 0x%02x\n", byte); + return 1; +} + +/** + * ntfs_info - Display information about the NTFS Volume + * @vol: An ntfs volume obtained from ntfs_mount + * + * Tell the user how much could be cleaned up. List the number of free + * clusters, MFT records, etc. + * + * Return: 1 Success, displayed some info + * 0 Error, something went wrong + */ +int ntfs_info (ntfs_volume *vol) +{ + if (!vol) + return 0; + + Iprintf ("ntfs_info\n"); + return 1; +} + + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + Iprintf ("%s v%s Copyright (C) 2002 %s\nOverwrite the unused space on " + "an NTFS Volume\n\n%s is free software, released under the GNU " + "General Public License\nand you are welcome to redistribute " + "it under certain conditions.\n%s comes with ABSOLUTELY NO " + "WARRANTY; for details read the GNU\nGeneral Public License " + "to be found in the file COPYING in the main\nLinux-NTFS " + "distribution directory.\n\n", + EXEC_NAME, VERSION, AUTHOR, EXEC_NAME, EXEC_NAME); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + Iprintf ("Usage: %s [options] device\n" + " -i --info Show volume information (default)\n" + "\n" + " -d --directory Wipe directory indexes\n" + " -l --logfile Wipe the logfile (journal)\n" + " -m --mft Wipe mft space\n" + " -p --pagefile Wipe pagefile (swap space)\n" + " -t --tails Wipe file tails\n" + " -u --unused Wipe unused clusters\n" + "\n" + " -a --all Wipe all unused space\n" + "\n" + " -c num --count num Number of times to write (default = 1)\n" + " -b list --bytes list List of values to write (default = 0)\n" + "\n" + " -n --no-action Do not write to disk\n" + " -f --force Use less caution\n" + " -q --quiet Less output\n" + " -v --verbose More output\n" + " -V --version Version information\n" + " -h --help Print this help\n\n", + EXEC_NAME); + Iprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); +} + +/** + * parse_list - Read a comma-separated list of numbers + * @list: The comma-separated list of numbers + * @result: Store the parsed list here (must be freed by caller) + * + * Read a comma-separated list of numbers and allocate an array of ints to store + * them in. The numbers can be in decimal, octal or hex. + * + * N.B. The caller must free the memory returned in @result. + * N.B. If the function fails, @result is not changed. + * + * Return: 0 Error, invalid string + * n Success, the count of numbers parsed + */ +int parse_list (const char *list, int **result) +{ + const char *ptr; + char *end; + int i; + int count; + int *mem = NULL; + + if (!list || !result) + return 0; + + for (count = 0, ptr = list; ptr; ptr = strchr (ptr+1, ',')) + count++; + + mem = malloc ((count+1) * sizeof (int)); + if (!mem) { + Eprintf ("Couldn't allocate memory in parse_list().\n"); + return 0; + } + + memset (mem, 0xFF, (count+1) * sizeof (int)); + + for (ptr = list, i = 0; i < count; i++) { + + end = NULL; + mem[i] = strtol (ptr, &end, 0); + + if (!end || (end == ptr) || ((*end != ',') && (*end != 0))) { + Eprintf ("Invalid list '%s'\n", list); + free (mem); + return 0; + } + + if ((mem[i] < 0) || (mem[i] > 255)) { + Eprintf ("Bytes must be in range 0-255.\n"); + free (mem); + return 0; + } + + ptr = end + 1; + } + + Dprintf ("Parsing list '%s' - ", list); + for (i = 0; i <= count; i++) + Dprintf ("0x%02x ", mem[i]); + Dprintf ("\n"); + + *result = mem; + return count; +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char *argv[]) +{ + static const char *sopt = "-ab:c:dfhilmnpqtuvV"; + static const struct option lopt[] = { + { "all", no_argument, NULL, 'a' }, + { "bytes", required_argument, NULL, 'b' }, + { "count", required_argument, NULL, 'c' }, + { "directory", no_argument, NULL, 'd' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "info", no_argument, NULL, 'i' }, + { "logfile", no_argument, NULL, 'l' }, + { "mft", no_argument, NULL, 'm' }, + { "no-action", no_argument, NULL, 'n' }, + { "pagefile", no_argument, NULL, 'p' }, + { "quiet", no_argument, NULL, 'q' }, + { "tails", no_argument, NULL, 't' }, + { "unused", no_argument, NULL, 'u' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + char *end; + int err = 0; + int ver = 0; + int help = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + opts.count = 1; + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else { + opts.device = NULL; + err++; + } + break; + + case 'a': + opts.directory++; + opts.logfile++; + opts.mft++; + opts.pagefile++; + opts.tails++; + opts.unused++; + break; + case 'b': + if (!opts.bytes) { + if (!parse_list (argv[optind-1], &opts.bytes)) + err++; + } else { + err++; + } + break; + case 'c': + if (opts.count == 1) { + end = NULL; + opts.count = strtol (optarg, &end, 0); + if (end && *end) + err++; + } else { + err++; + } + break; + case 'd': + opts.directory++; + break; + case 'f': + opts.force++; + break; + case 'h': + help++; + break; + case 'i': + opts.info++; + break; + case 'l': + opts.logfile++; + break; + case 'm': + opts.mft++; + break; + case 'n': + opts.noaction++; + break; + case 'p': + opts.pagefile++; + break; + case 'q': + opts.quiet++; + break; + case 't': + opts.tails++; + break; + case 'u': + opts.unused++; + break; + case 'v': + opts.verbose++; + break; + case 'V': + ver++; + break; + default: + if ((optopt == 'b') || (optopt == 'c')) { + Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); + } else { + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + } + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if (opts.device == NULL) { + Eprintf ("You must specify exactly one device.\n"); + err++; + } + + if ((opts.quiet) && (opts.verbose)) { + Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + err++; + } + + if (opts.info && (opts.unused || opts.tails || opts.mft || opts.directory)) { + Eprintf ("You may not use any other options with --info.\n"); + err++; + } + + if ((opts.count < 1) || (opts.count > 100)) { + Eprintf ("The iteration count must be between 1 and 100.\n"); + err++; + } + + /*if (opts.bytes && (opts.count > 0)) { + Eprintf ("You may not use both --bytes and --count.\n"); + err++; + }*/ + + /* Create a default list */ + if (!opts.bytes) { + opts.bytes = malloc (2 * sizeof (int)); + if (opts.bytes) { + opts.bytes[0] = 0; + opts.bytes[1] = -1; + } + } + + if (!opts.directory && !opts.logfile && !opts.mft && + !opts.pagefile && !opts.tails && !opts.unused) { + opts.info = 1; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + +/** + * valid_device - Perform some safety checks on the device, before we start + * @name: Full pathname of the device/file to work with + * @force: Continue regardless of problems + * + * Check that the name refers to a device and that is isn't already mounted. + * These checks can be overridden by using the force option. + * + * Return: 1 Success, we can continue + * 0 Error, we cannot use this device + */ +int valid_device (const char *name, int force) +{ + unsigned long mnt_flags = 0; + struct stat st; + + if (stat (name, &st) == -1) { + if (errno == ENOENT) { + Eprintf ("The device %s doesn't exist\n", name); + } else { + Eprintf ("Error getting information about %s: %s\n", name, strerror (errno)); + } + return 0; + } + + if (!S_ISBLK (st.st_mode)) { + Vprintf ("%s is not a block device.\n", name); + if (!force) { + Eprintf ("Use the force option to work with files.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + /* Make sure the file system is not mounted. */ + if (ntfs_check_if_mounted (name, &mnt_flags)) { + Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); + if (!force) { + Eprintf ("Use the force option to ignore this error.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } else if (mnt_flags & NTFS_MF_MOUNTED) { + Vprintf ("The device %s, is mounted.\n", name); + if (!force) { + Eprintf ("Use the force option to work a mounted filesystem.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + Dprintf ("Device %s, will be used\n", name); + return 1; +} + + +/** + * print_summary - Tell the use what we are about to do + * + * List the operations about to be performed. The output will be silenced by + * the --quiet option. + * + * Return: none + */ +void print_summary (void) +{ + int i; + + if (opts.noaction) + Iprintf ("%s is in 'no-action' mode, it will NOT write to disk." + "\n\n", EXEC_NAME); + + Iprintf ("%s is about to wipe:\n", EXEC_NAME); + if (opts.unused) + Iprintf ("\tunused disk space\n"); + if (opts.tails) + Iprintf ("\tfile tails\n"); + if (opts.mft) + Iprintf ("\tunused mft areas\n"); + if (opts.directory) + Iprintf ("\tunused directory index space\n"); + if (opts.logfile) + Iprintf ("\tthe logfile (journal)\n"); + if (opts.pagefile) + Iprintf ("\tthe pagefile (swap space)\n"); + + Iprintf ("\n%s will overwrite these areas with: ", EXEC_NAME); + if (opts.bytes) { + for (i = 0; opts.bytes[i] >= 0; i++) + Iprintf ("0x%02x ", opts.bytes[i]); + } + Iprintf ("\n"); + + if (opts.count > 1) + Iprintf ("%s will repeat these operations %d times.\n", EXEC_NAME, opts.count); + Iprintf ("\n"); +} + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main (int argc, char *argv[]) +{ + const char *locale; + ntfs_volume *vol; + int result = 1; + int flags = 0; + int i, j; + + locale = setlocale (LC_ALL, ""); + if (!locale) { + locale = setlocale (LC_ALL, NULL); + Vprintf ("Failed to set locale, using default '%s'.\n", locale); + } else { + Vprintf ("Using locale '%s'.\n", locale); + } + + if (!parse_options (argc, argv)) + return 1; + + if (!valid_device (opts.device, opts.force)) { + goto free; + } + + if (!opts.info) + print_summary(); + + if (opts.info || opts.noaction) + flags = MS_RDONLY; + vol = ntfs_mount (opts.device, flags); + if (!vol) { + Eprintf ("Couldn't mount device '%s': %s\n", opts.device, strerror (errno)); + goto free; + } + + if (vol->flags & VOLUME_IS_DIRTY) { + Iprintf ("Volume is dirty.\n"); + if (!opts.force) { + Eprintf ("Run chkdsk and try again, or use the --force option.\n"); + goto umount; + } + Iprintf ("Forced to continue.\n"); + } + + if (opts.info) { + ntfs_info (vol); + result = 0; + goto umount; + } + + /* Even if the output it quieted, you still get 5 seconds to abort. */ + if (!opts.force) { + Iprintf ("\n%s will begin in 5 seconds, press CTRL-C to abort.\n", EXEC_NAME); + sleep (5); + } + + if (!opts.bytes) { + Eprintf ("Internal error, byte list is empty\n"); + goto umount; + } + + for (i = 0; i < opts.count; i++) { + int byte; + for (j = 0; byte = opts.bytes[j], byte >= 0; j++) { + if (opts.unused && !wipe_unused (vol, byte)) + goto umount; + if (opts.tails && !wipe_tails (vol, byte)) + goto umount; + if (opts.mft && !wipe_mft (vol, byte)) + goto umount; + if (opts.directory && !wipe_directory (vol, byte)) + goto umount; + if (opts.logfile && !wipe_logfile (vol, byte)) + goto umount; + if (opts.pagefile && !wipe_pagefile (vol, byte)) + goto umount; + } + } + + result = 0; +umount: + ntfs_umount (vol, FALSE); +free: + if (opts.bytes) + free (opts.bytes); + return result; +} + + diff --git a/ntfsprogs/ntfswipe.h b/ntfsprogs/ntfswipe.h index e69de29b..f06358c2 100644 --- a/ntfsprogs/ntfswipe.h +++ b/ntfsprogs/ntfswipe.h @@ -0,0 +1,47 @@ +/* + * ntfswipe - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Richard Russon + * + * This utility will overwrite usused space on an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFSWIPE_H_ +#define _NTFSWIPE_H_ + +#include "types.h" + +struct options { + char *device; /* Device/File to work with */ + int info; /* Show volume info */ + int force; /* Override common sense */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int noaction; /* Do not write to disk */ + int count; /* Number of iterations */ + int *bytes; /* List of overwrite characters */ + int directory; /* Wipe directory indexes */ + int logfile; /* Wipe the logfile (journal) */ + int mft; /* Wipe mft slack space */ + int pagefile; /* Wipe pagefile (swap space) */ + int tails; /* Wipe file tails */ + int unused; /* Wipe unused clusters */ +}; + +#endif /* _NTFSWIPE_H_ */ + diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c index e69de29b..0e0f0863 100644 --- a/ntfsprogs/sd.c +++ b/ntfsprogs/sd.c @@ -0,0 +1,200 @@ +#include "types.h" +#include "layout.h" + +/* + * NTFS 1.2 - System files security decriptors + * =========================================== + * + * Create the security descriptor for system file number @sys_file_no and + * return a pointer to the descriptor. + * + * $MFT, $MFTMirr, $LogFile, $AttrDef, $Bitmap, $Boot, $BadClus, and $UpCase + * are the same. + * + * $Volume, $Quota, and system files 0xb-0xf are the same. They are almost the + * same as the above, the only difference being that the two SIDs present in + * the DACL grant GENERIC_WRITE and GENERIC_READ equivalent priviledges while + * the above only grant GENERIC_READ equivalent priviledges. (For some reason + * the flags for GENERIC_READ/GENERIC_WRITE are not set by NT4, even though + * the permissions are equivalent, so we comply. + * + * Root directory system file (".") is different altogether. + * + * The sd is recturned in *@sd_val and has length *@sd_val_len. + * + * Do NOT free *@sd_val as it is static memory. This also means that you can + * only use *@sd_val until the next call to this function. + * + */ +void init_system_file_sd(int sys_file_no, char **sd_val, int *sd_val_len) +{ + static char sd_array[0x68]; + SECURITY_DESCRIPTOR_RELATIVE *sd; + ACL *acl; + ACCESS_ALLOWED_ACE *aa_ace; + SID *sid; + + if (sys_file_no < 0 || sys_file_no > 0xf) { + *sd_val = NULL; + *sd_val_len = 0; + return; + } + *sd_val = (char*)&sd_array; + sd = (SECURITY_DESCRIPTOR_RELATIVE*)&sd_array; + sd->revision = 1; + sd->alignment = 0; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + if (sys_file_no == FILE_root) { + *sd_val_len = 0x50; + sd->owner = cpu_to_le32(0x30); + sd->group = cpu_to_le32(0x40); + } else { + *sd_val_len = 0x68; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + } + sd->sacl = cpu_to_le32(0); + sd->dacl = cpu_to_le32(0x14); + /* + * Now at offset 0x14, as specified in the security descriptor, we have + * the DACL. + */ + acl = (ACL*)((char*)sd + le32_to_cpu(sd->dacl)); + acl->revision = 2; + acl->alignment1 = 0; + if (sys_file_no == FILE_root) { + acl->size = cpu_to_le16(0x1c); + acl->ace_count = cpu_to_le16(1); + } else { + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(2); + } + acl->alignment2 = cpu_to_le16(0); + /* + * Now at offset 0x1c, just after the DACL's ACL, we have the first + * ACE of the DACL. The type of the ACE is access allowed. + */ + aa_ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + aa_ace->type = ACCESS_ALLOWED_ACE_TYPE; + if (sys_file_no == FILE_root) + aa_ace->flags = CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE; + else + aa_ace->flags = 0; + aa_ace->size = cpu_to_le16(0x14); + switch (sys_file_no) { + case FILE_MFT: case FILE_MFTMirr: case FILE_LogFile: + case FILE_AttrDef: case FILE_Bitmap: case FILE_Boot: + case FILE_BadClus: case FILE_UpCase: + aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ | + FILE_READ_ATTRIBUTES | FILE_READ_EA | FILE_READ_DATA; + break; + case FILE_Volume: case FILE_Secure: case 0xb ... 0xf: + aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_WRITE | + FILE_WRITE_ATTRIBUTES | FILE_READ_ATTRIBUTES | + FILE_WRITE_EA | FILE_READ_EA | FILE_APPEND_DATA | + FILE_WRITE_DATA | FILE_READ_DATA; + break; + case FILE_root: + aa_ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_READ_ATTRIBUTES | FILE_DELETE_CHILD | + FILE_TRAVERSE | FILE_WRITE_EA | FILE_READ_EA | + FILE_ADD_SUBDIRECTORY | FILE_ADD_FILE | + FILE_LIST_DIRECTORY; + break; + } + aa_ace->sid.revision = 1; + aa_ace->sid.sub_authority_count = 1; + aa_ace->sid.identifier_authority.value[0] = 0; + aa_ace->sid.identifier_authority.value[1] = 0; + aa_ace->sid.identifier_authority.value[2] = 0; + aa_ace->sid.identifier_authority.value[3] = 0; + aa_ace->sid.identifier_authority.value[4] = 0; + if (sys_file_no == FILE_root) { + /* SECURITY_WORLD_SID_AUTHORITY (S-1-1) */ + aa_ace->sid.identifier_authority.value[5] = 1; + aa_ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_WORLD_RID); + /* This is S-1-1-0, the WORLD_SID. */ + } else { + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + aa_ace->sid.identifier_authority.value[5] = 5; + aa_ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + } + /* + * Now at offset 0x30 within security descriptor, just after the first + * ACE of the DACL. All system files, except the root directory, have + * a second ACE. + */ + if (sys_file_no != FILE_root) { + /* The second ACE of the DACL. Type is access allowed. */ + aa_ace = (ACCESS_ALLOWED_ACE*)((char*)aa_ace + + le16_to_cpu(aa_ace->size)); + aa_ace->type = ACCESS_ALLOWED_ACE_TYPE; + aa_ace->flags = 0; + aa_ace->size = cpu_to_le16(0x18); + switch (sys_file_no) { + case FILE_MFT: case FILE_MFTMirr: + case FILE_LogFile: case FILE_AttrDef: + case FILE_Bitmap: case FILE_Boot: + case FILE_BadClus: case FILE_UpCase: + aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ | + FILE_READ_ATTRIBUTES | FILE_READ_EA | + FILE_READ_DATA; + break; + case FILE_Volume: case FILE_Secure: + case 0xb ... 0xf: + aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ | + FILE_WRITE_ATTRIBUTES | + FILE_READ_ATTRIBUTES | FILE_WRITE_EA | + FILE_READ_EA | FILE_APPEND_DATA | + FILE_WRITE_DATA | FILE_READ_DATA; + break; + } + aa_ace->sid.revision = 1; + aa_ace->sid.sub_authority_count = 2; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + aa_ace->sid.identifier_authority.value[0] = 0; + aa_ace->sid.identifier_authority.value[1] = 0; + aa_ace->sid.identifier_authority.value[2] = 0; + aa_ace->sid.identifier_authority.value[3] = 0; + aa_ace->sid.identifier_authority.value[4] = 0; + aa_ace->sid.identifier_authority.value[5] = 5; + aa_ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + aa_ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + /* Now at offset 0x48 into the security descriptor. */ + } + /* As specified in the security descriptor, we now have the owner SID.*/ + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 1; + sid->sub_authority_count = 2; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + /* + * Now at offset 0x40 or 0x58 (root directory and the other system + * files, respectively) into the security descriptor, as specified in + * the security descriptor, we have the group SID. + */ + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 1; + sid->sub_authority_count = 2; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); +} + diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c index e69de29b..a184379a 100644 --- a/ntfsprogs/upcase.c +++ b/ntfsprogs/upcase.c @@ -0,0 +1,82 @@ +/* + * $Id$ + * + * Copyright (c) 2001 Richard Russon + * Copyright (c) 2001-2002 Anton Altaparmakov + * + * Modified for mkntfs inclusion 9 June 2001 by Anton Altaparmakov. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS source + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "types.h" + +void init_upcase_table(uchar_t *uc, u32 uc_len) +{ + static int uc_run_table[][3] = { /* Start, End, Add */ + {0x0061, 0x007B, -32}, {0x0451, 0x045D, -80}, {0x1F70, 0x1F72, 74}, + {0x00E0, 0x00F7, -32}, {0x045E, 0x0460, -80}, {0x1F72, 0x1F76, 86}, + {0x00F8, 0x00FF, -32}, {0x0561, 0x0587, -48}, {0x1F76, 0x1F78, 100}, + {0x0256, 0x0258, -205}, {0x1F00, 0x1F08, 8}, {0x1F78, 0x1F7A, 128}, + {0x028A, 0x028C, -217}, {0x1F10, 0x1F16, 8}, {0x1F7A, 0x1F7C, 112}, + {0x03AC, 0x03AD, -38}, {0x1F20, 0x1F28, 8}, {0x1F7C, 0x1F7E, 126}, + {0x03AD, 0x03B0, -37}, {0x1F30, 0x1F38, 8}, {0x1FB0, 0x1FB2, 8}, + {0x03B1, 0x03C2, -32}, {0x1F40, 0x1F46, 8}, {0x1FD0, 0x1FD2, 8}, + {0x03C2, 0x03C3, -31}, {0x1F51, 0x1F52, 8}, {0x1FE0, 0x1FE2, 8}, + {0x03C3, 0x03CC, -32}, {0x1F53, 0x1F54, 8}, {0x1FE5, 0x1FE6, 7}, + {0x03CC, 0x03CD, -64}, {0x1F55, 0x1F56, 8}, {0x2170, 0x2180, -16}, + {0x03CD, 0x03CF, -63}, {0x1F57, 0x1F58, 8}, {0x24D0, 0x24EA, -26}, + {0x0430, 0x0450, -32}, {0x1F60, 0x1F68, 8}, {0xFF41, 0xFF5B, -32}, + {0} + }; + static int uc_dup_table[][2] = { /* Start, End */ + {0x0100, 0x012F}, {0x01A0, 0x01A6}, {0x03E2, 0x03EF}, {0x04CB, 0x04CC}, + {0x0132, 0x0137}, {0x01B3, 0x01B7}, {0x0460, 0x0481}, {0x04D0, 0x04EB}, + {0x0139, 0x0149}, {0x01CD, 0x01DD}, {0x0490, 0x04BF}, {0x04EE, 0x04F5}, + {0x014A, 0x0178}, {0x01DE, 0x01EF}, {0x04BF, 0x04BF}, {0x04F8, 0x04F9}, + {0x0179, 0x017E}, {0x01F4, 0x01F5}, {0x04C1, 0x04C4}, {0x1E00, 0x1E95}, + {0x018B, 0x018B}, {0x01FA, 0x0218}, {0x04C7, 0x04C8}, {0x1EA0, 0x1EF9}, + {0} + }; + static int uc_byte_table[][2] = { /* Offset, Value */ + {0x00FF, 0x0178}, {0x01AD, 0x01AC}, {0x01F3, 0x01F1}, {0x0269, 0x0196}, + {0x0183, 0x0182}, {0x01B0, 0x01AF}, {0x0253, 0x0181}, {0x026F, 0x019C}, + {0x0185, 0x0184}, {0x01B9, 0x01B8}, {0x0254, 0x0186}, {0x0272, 0x019D}, + {0x0188, 0x0187}, {0x01BD, 0x01BC}, {0x0259, 0x018F}, {0x0275, 0x019F}, + {0x018C, 0x018B}, {0x01C6, 0x01C4}, {0x025B, 0x0190}, {0x0283, 0x01A9}, + {0x0192, 0x0191}, {0x01C9, 0x01C7}, {0x0260, 0x0193}, {0x0288, 0x01AE}, + {0x0199, 0x0198}, {0x01CC, 0x01CA}, {0x0263, 0x0194}, {0x0292, 0x01B7}, + {0x01A8, 0x01A7}, {0x01DD, 0x018E}, {0x0268, 0x0197}, + {0} + }; + int i, r; + + memset((char*)uc, 0, uc_len); + uc_len >>= 1; + for (i = 0; i < uc_len; i++) + uc[i] = i; + for (r = 0; uc_run_table[r][0]; r++) + for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) + uc[i] += uc_run_table[r][2]; + for (r = 0; uc_dup_table[r][0]; r++) + for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) + uc[i + 1]--; + for (r = 0; uc_byte_table[r][0]; r++) + uc[uc_byte_table[r][0]] = uc_byte_table[r][1]; +} + From 87ad00d142b762e74d0bb65f73bfd84409cf283c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0153/2994] mvdir }(Logical change 1.23) --- ntfstools/Makefile.am | 77 - ntfstools/attrdef.c | 153 -- ntfstools/boot.c | 218 --- ntfstools/dumplog.c | 310 --- ntfstools/mkntfs.8.in | 213 -- ntfstools/mkntfs.c | 3554 ---------------------------------- ntfstools/ntfsdump_logfile.c | 371 ---- ntfstools/ntfsfix.8.in | 56 - ntfstools/ntfsfix.c | 317 --- ntfstools/ntfsinfo.8.in | 25 - ntfstools/ntfsinfo.c | 195 -- ntfstools/ntfslabel.8.in | 54 - ntfstools/ntfslabel.c | 247 --- ntfstools/ntfsresize.8.in | 117 -- ntfstools/ntfsresize.c | 914 --------- ntfstools/ntfsundelete.8.in | 344 ---- ntfstools/ntfsundelete.c | 2018 ------------------- ntfstools/ntfsundelete.h | 104 - ntfstools/ntfswipe.c | 732 ------- ntfstools/ntfswipe.h | 47 - ntfstools/sd.c | 200 -- ntfstools/upcase.c | 82 - 22 files changed, 10348 deletions(-) delete mode 100644 ntfstools/Makefile.am delete mode 100644 ntfstools/attrdef.c delete mode 100644 ntfstools/boot.c delete mode 100644 ntfstools/dumplog.c delete mode 100644 ntfstools/mkntfs.8.in delete mode 100644 ntfstools/mkntfs.c delete mode 100644 ntfstools/ntfsdump_logfile.c delete mode 100644 ntfstools/ntfsfix.8.in delete mode 100644 ntfstools/ntfsfix.c delete mode 100644 ntfstools/ntfsinfo.8.in delete mode 100644 ntfstools/ntfsinfo.c delete mode 100644 ntfstools/ntfslabel.8.in delete mode 100644 ntfstools/ntfslabel.c delete mode 100644 ntfstools/ntfsresize.8.in delete mode 100644 ntfstools/ntfsresize.c delete mode 100644 ntfstools/ntfsundelete.8.in delete mode 100644 ntfstools/ntfsundelete.c delete mode 100644 ntfstools/ntfsundelete.h delete mode 100644 ntfstools/ntfswipe.c delete mode 100644 ntfstools/ntfswipe.h delete mode 100644 ntfstools/sd.c delete mode 100644 ntfstools/upcase.c diff --git a/ntfstools/Makefile.am b/ntfstools/Makefile.am deleted file mode 100644 index 81600372..00000000 --- a/ntfstools/Makefile.am +++ /dev/null @@ -1,77 +0,0 @@ -# Need this to enable 64-bit (device) file access functions and parameters. -if DEBUG -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall -else -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -endif - -if REALLYSTATIC -AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a -AM_LFLAGS = -static -STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -else -AM_LIBS = $(top_srcdir)/libntfs/libntfs.la -AM_LFLAGS = $(all_libraries) -LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -endif - -# Workaround to make REALLYSTATIC work with automake 1.5. -LINK=$(STATIC_LINK) $(LIBTOOL_LINK) - -bin_PROGRAMS = ntfsfix ntfsinfo -sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe - -man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 \ - ntfsresize.8 -EXTRA_MANS = - -CLEANFILES = $(EXTRA_PROGRAMS) - -linux_ntfsincludedir = -I$(top_srcdir)/include - -# Set the include path. -INCLUDES = -I$(top_srcdir)/include $(all_includes) - -ntfsfix_SOURCES = ntfsfix.c -ntfsfix_LDADD = $(AM_LIBS) -ntfsfix_LDFLAGS = $(AM_LFLAGS) - -mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c -mkntfs_LDADD = $(AM_LIBS) -mkntfs_LDFLAGS = $(AM_LFLAGS) - -ntfslabel_SOURCES = ntfslabel.c -ntfslabel_LDADD = $(AM_LIBS) -ntfslabel_LDFLAGS = $(AM_LFLAGS) - -ntfsinfo_SOURCES = ntfsinfo.c -ntfsinfo_LDADD = $(AM_LIBS) -ntfsinfo_LDFLAGS = $(AM_LFLAGS) - -ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h -ntfsundelete_LDADD = $(AM_LIBS) -ntfsundelete_LDFLAGS = $(AM_LFLAGS) - -ntfsresize_SOURCES = ntfsresize.c -ntfsresize_LDADD = $(AM_LIBS) -ntfsresize_LDFLAGS = $(AM_LFLAGS) - -# We don't distribute these - -ntfswipe_SOURCES = ntfswipe.c ntfswipe.h -ntfswipe_LDADD = $(AM_LIBS) -ntfswipe_LDFLAGS = $(AM_LFLAGS) - -ntfsdump_logfile_SOURCES= ntfsdump_logfile.c -ntfsdump_logfile_LDADD = $(AM_LIBS) -ntfsdump_logfile_LDFLAGS= $(AM_LFLAGS) - -dumplog_SOURCES = dumplog.c -dumplog_LDADD = $(AM_LIBS) -dumplog_LDFLAGS = $(AM_LFLAGS) - -# Extra targets - -strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) - $(STRIP) $^ diff --git a/ntfstools/attrdef.c b/ntfstools/attrdef.c deleted file mode 100644 index c9bb82c6..00000000 --- a/ntfstools/attrdef.c +++ /dev/null @@ -1,153 +0,0 @@ -const unsigned char attrdef_ntfs12_array[2400] = { - 36, 0, 83, 0, 84, 0, 65, 0, 78, 0, 68, 0, 65, 0, 82, 0, - 68, 0, 95, 0, 73, 0, 78, 0, 70, 0, 79, 0, 82, 0, 77, 0, - 65, 0, 84, 0, 73, 0, 79, 0, 78, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, - 48, 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, - 36, 0, 65, 0, 84, 0, 84, 0, 82, 0, 73, 0, 66, 0, 85, 0, - 84, 0, 69, 0, 95, 0, 76, 0, 73, 0, 83, 0, 84, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, - 36, 0, 70, 0, 73, 0, 76, 0, 69, 0, 95, 0, 78, 0, 65, 0, - 77, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, - 68, 0, 0, 0, 0, 0, 0, 0, 66, 2, 0, 0, 0, 0, 0, 0, - 36, 0, 86, 0, 79, 0, 76, 0, 85, 0, 77, 0, 69, 0, 95, 0, - 86, 0, 69, 0, 82, 0, 83, 0, 73, 0, 79, 0, 78, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, - 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, - 36, 0, 83, 0, 69, 0, 67, 0, 85, 0, 82, 0, 73, 0, 84, 0, - 89, 0, 95, 0, 68, 0, 69, 0, 83, 0, 67, 0, 82, 0, 73, 0, - 80, 0, 84, 0, 79, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, - 36, 0, 86, 0, 79, 0, 76, 0, 85, 0, 77, 0, 69, 0, 95, 0, - 78, 0, 65, 0, 77, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, - 36, 0, 86, 0, 79, 0, 76, 0, 85, 0, 77, 0, 69, 0, 95, 0, - 73, 0, 78, 0, 70, 0, 79, 0, 82, 0, 77, 0, 65, 0, 84, 0, - 73, 0, 79, 0, 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, - 12, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, - 36, 0, 68, 0, 65, 0, 84, 0, 65, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, - 36, 0, 73, 0, 78, 0, 68, 0, 69, 0, 88, 0, 95, 0, 82, 0, - 79, 0, 79, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, - 36, 0, 73, 0, 78, 0, 68, 0, 69, 0, 88, 0, 95, 0, 65, 0, - 76, 0, 76, 0, 79, 0, 67, 0, 65, 0, 84, 0, 73, 0, 79, 0, - 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, - 36, 0, 66, 0, 73, 0, 84, 0, 77, 0, 65, 0, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, - 36, 0, 83, 0, 89, 0, 77, 0, 66, 0, 79, 0, 76, 0, 73, 0, - 67, 0, 95, 0, 76, 0, 73, 0, 78, 0, 75, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, - 36, 0, 69, 0, 65, 0, 95, 0, 73, 0, 78, 0, 70, 0, 79, 0, - 82, 0, 77, 0, 65, 0, 84, 0, 73, 0, 79, 0, 78, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -208, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, - 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, - 36, 0, 69, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - diff --git a/ntfstools/boot.c b/ntfstools/boot.c deleted file mode 100644 index b47ded9c..00000000 --- a/ntfstools/boot.c +++ /dev/null @@ -1,218 +0,0 @@ -/* The first 3429 bytes of $Boot. The rest is just zero. Total 8192 bytes. */ -const unsigned char boot_array[3429] = { -235, 91, 144, 78, 84, 70, 83, 32, 32, 32, 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 250, 51, 192, -142, 208, 188, 0, 124, 251, 184, 192, 7, 142, 216, 199, 6, 84, 0, 0, - 0, 199, 6, 86, 0, 0, 0, 199, 6, 91, 0, 16, 0, 184, 0, 13, -142, 192, 43, 219, 232, 7, 0, 104, 0, 13, 104, 102, 2, 203, 80, 83, - 81, 82, 6, 102, 161, 84, 0, 102, 3, 6, 28, 0, 102, 51, 210, 102, - 15, 183, 14, 24, 0, 102, 247, 241, 254, 194, 136, 22, 90, 0, 102, 139, -208, 102, 193, 234, 16, 247, 54, 26, 0, 136, 22, 37, 0, 163, 88, 0, -161, 24, 0, 42, 6, 90, 0, 64, 59, 6, 91, 0, 118, 3, 161, 91, - 0, 80, 180, 2, 139, 22, 88, 0, 177, 6, 210, 230, 10, 54, 90, 0, -139, 202, 134, 233, 138, 54, 37, 0, 178, 128, 205, 19, 88, 114, 42, 1, - 6, 84, 0, 131, 22, 86, 0, 0, 41, 6, 91, 0, 118, 11, 193, 224, - 5, 140, 194, 3, 208, 142, 194, 235, 138, 7, 90, 89, 91, 88, 195, 190, - 89, 1, 235, 8, 190, 227, 1, 235, 3, 190, 57, 1, 232, 9, 0, 190, -173, 1, 232, 3, 0, 251, 235, 254, 172, 60, 0, 116, 9, 180, 14, 187, - 7, 0, 205, 16, 235, 242, 195, 29, 0, 65, 32, 100, 105, 115, 107, 32, -114, 101, 97, 100, 32, 101, 114, 114, 111, 114, 32, 111, 99, 99, 117, 114, -114, 101, 100, 46, 13, 10, 0, 41, 0, 65, 32, 107, 101, 114, 110, 101, -108, 32, 102, 105, 108, 101, 32, 105, 115, 32, 109, 105, 115, 115, 105, 110, -103, 32, 102, 114, 111, 109, 32, 116, 104, 101, 32, 100, 105, 115, 107, 46, - 13, 10, 0, 37, 0, 65, 32, 107, 101, 114, 110, 101, 108, 32, 102, 105, -108, 101, 32, 105, 115, 32, 116, 111, 111, 32, 100, 105, 115, 99, 111, 110, -116, 105, 103, 117, 111, 117, 115, 46, 13, 10, 0, 51, 0, 73, 110, 115, -101, 114, 116, 32, 97, 32, 115, 121, 115, 116, 101, 109, 32, 100, 105, 115, -107, 101, 116, 116, 101, 32, 97, 110, 100, 32, 114, 101, 115, 116, 97, 114, -116, 13, 10, 116, 104, 101, 32, 115, 121, 115, 116, 101, 109, 46, 13, 10, - 0, 23, 0, 92, 78, 84, 76, 68, 82, 32, 105, 115, 32, 99, 111, 109, -112, 114, 101, 115, 115, 101, 100, 46, 13, 10, 0, 0, 0, 0, 85, 170, - 5, 0, 78, 0, 84, 0, 76, 0, 68, 0, 82, 0, 4, 0, 36, 0, - 73, 0, 51, 0, 48, 0, 0, 224, 0, 0, 0, 48, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 140, 200, 142, 216, 193, 224, 4, 250, 139, 224, -251, 102, 15, 183, 6, 11, 0, 102, 15, 182, 30, 13, 0, 102, 247, 227, -102, 163, 78, 2, 102, 139, 14, 64, 0, 128, 249, 0, 15, 143, 14, 0, -246, 217, 102, 184, 1, 0, 0, 0, 102, 211, 224, 235, 8, 144, 102, 161, - 78, 2, 102, 247, 225, 102, 163, 82, 2, 102, 15, 183, 30, 11, 0, 102, - 51, 210, 102, 247, 243, 102, 163, 86, 2, 232, 44, 4, 102, 139, 14, 74, - 2, 102, 137, 14, 34, 2, 102, 3, 14, 82, 2, 102, 137, 14, 38, 2, -102, 3, 14, 82, 2, 102, 137, 14, 42, 2, 102, 3, 14, 82, 2, 102, -137, 14, 58, 2, 102, 3, 14, 82, 2, 102, 137, 14, 66, 2, 102, 184, -144, 0, 0, 0, 102, 139, 14, 34, 2, 232, 65, 9, 102, 11, 192, 15, -132, 22, 254, 102, 163, 46, 2, 102, 184, 160, 0, 0, 0, 102, 139, 14, - 38, 2, 232, 40, 9, 102, 163, 50, 2, 102, 184, 176, 0, 0, 0, 102, -139, 14, 42, 2, 232, 22, 9, 102, 163, 54, 2, 102, 161, 46, 2, 102, - 11, 192, 15, 132, 227, 253, 103, 128, 120, 8, 0, 15, 133, 218, 253, 103, -102, 141, 80, 16, 103, 3, 66, 4, 103, 102, 15, 182, 72, 12, 102, 137, - 14, 94, 2, 103, 102, 139, 72, 8, 102, 137, 14, 90, 2, 102, 161, 90, - 2, 102, 15, 183, 14, 11, 0, 102, 51, 210, 102, 247, 241, 102, 163, 98, - 2, 102, 161, 66, 2, 102, 3, 6, 90, 2, 102, 163, 70, 2, 102, 131, - 62, 50, 2, 0, 15, 132, 25, 0, 102, 131, 62, 54, 2, 0, 15, 132, -135, 253, 102, 139, 30, 54, 2, 30, 7, 102, 139, 62, 70, 2, 232, 177, - 1, 102, 15, 183, 14, 0, 2, 102, 184, 2, 2, 0, 0, 232, 153, 6, -102, 11, 192, 15, 132, 88, 253, 103, 102, 139, 0, 30, 7, 102, 139, 62, - 58, 2, 232, 209, 4, 102, 161, 58, 2, 102, 187, 128, 0, 0, 0, 102, -185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, 203, 0, 102, 11, -192, 15, 132, 42, 253, 103, 102, 15, 183, 88, 12, 102, 129, 227, 255, 0, - 0, 0, 15, 133, 30, 253, 102, 139, 216, 104, 0, 32, 7, 102, 43, 255, -232, 79, 1, 138, 22, 36, 0, 184, 232, 3, 142, 192, 141, 54, 11, 0, - 43, 192, 104, 0, 32, 80, 203, 80, 83, 81, 82, 6, 255, 54, 91, 0, -255, 54, 84, 0, 255, 54, 86, 0, 139, 195, 193, 232, 4, 140, 193, 3, -193, 37, 255, 15, 45, 0, 16, 247, 216, 139, 14, 91, 0, 193, 225, 5, - 81, 59, 193, 118, 2, 139, 193, 80, 193, 232, 5, 163, 91, 0, 232, 61, -252, 88, 89, 43, 200, 118, 11, 140, 194, 3, 208, 142, 194, 184, 0, 16, -235, 222, 143, 6, 86, 0, 143, 6, 84, 0, 143, 6, 91, 0, 7, 90, - 89, 91, 88, 195, 6, 30, 102, 96, 102, 139, 218, 102, 15, 182, 14, 13, - 0, 102, 247, 225, 102, 163, 84, 0, 102, 139, 195, 102, 247, 225, 163, 91, - 0, 139, 223, 131, 227, 15, 140, 192, 102, 193, 239, 4, 3, 199, 80, 7, -232, 116, 255, 102, 97, 144, 31, 7, 195, 103, 3, 64, 20, 103, 102, 131, - 56, 255, 15, 132, 76, 0, 103, 102, 57, 24, 15, 133, 51, 0, 102, 11, -201, 15, 133, 10, 0, 103, 128, 120, 9, 0, 15, 133, 35, 0, 195, 103, - 58, 72, 9, 15, 133, 26, 0, 102, 139, 240, 103, 3, 112, 10, 232, 61, - 5, 102, 81, 30, 7, 102, 139, 250, 243, 167, 102, 89, 15, 133, 1, 0, -195, 103, 102, 131, 120, 4, 0, 15, 132, 7, 0, 103, 102, 3, 64, 4, -235, 171, 102, 43, 192, 195, 102, 139, 243, 232, 18, 5, 103, 102, 3, 0, -103, 247, 64, 12, 2, 0, 15, 133, 52, 0, 103, 102, 141, 80, 16, 103, - 58, 74, 64, 15, 133, 24, 0, 103, 102, 141, 114, 66, 232, 239, 4, 102, - 81, 30, 7, 102, 139, 251, 243, 167, 102, 89, 15, 133, 1, 0, 195, 103, -131, 120, 8, 0, 15, 132, 6, 0, 103, 3, 64, 8, 235, 194, 102, 51, -192, 195, 103, 128, 123, 8, 0, 15, 133, 28, 0, 6, 30, 102, 96, 103, -102, 141, 83, 16, 103, 102, 139, 10, 102, 139, 243, 103, 3, 114, 4, 243, -164, 102, 97, 144, 31, 7, 195, 103, 102, 141, 83, 16, 103, 102, 139, 74, - 8, 102, 65, 102, 43, 192, 232, 1, 0, 195, 6, 30, 102, 96, 103, 128, -123, 8, 1, 15, 132, 3, 0, 233, 127, 251, 102, 131, 249, 0, 15, 133, - 6, 0, 102, 97, 144, 31, 7, 195, 102, 83, 102, 80, 102, 81, 102, 87, - 6, 232, 87, 3, 102, 139, 209, 7, 102, 95, 102, 89, 102, 59, 202, 15, -141, 3, 0, 102, 139, 209, 232, 171, 254, 102, 43, 202, 102, 139, 218, 102, -139, 194, 102, 15, 182, 22, 13, 0, 102, 247, 226, 102, 15, 183, 22, 11, - 0, 102, 247, 226, 102, 3, 248, 102, 88, 102, 3, 195, 102, 91, 235, 170, - 6, 30, 102, 96, 103, 128, 123, 8, 1, 15, 132, 3, 0, 233, 25, 251, -102, 131, 249, 0, 15, 133, 6, 0, 102, 97, 144, 31, 7, 195, 102, 83, -102, 80, 102, 81, 102, 87, 6, 102, 81, 102, 51, 210, 102, 15, 182, 14, - 13, 0, 102, 247, 241, 102, 82, 232, 225, 2, 102, 15, 182, 30, 13, 0, -102, 247, 227, 102, 90, 102, 3, 194, 102, 80, 102, 15, 182, 6, 13, 0, -102, 247, 225, 102, 139, 208, 102, 88, 102, 89, 7, 102, 95, 102, 89, 102, - 59, 202, 15, 141, 3, 0, 102, 139, 209, 102, 163, 84, 0, 137, 22, 91, - 0, 6, 30, 102, 96, 139, 223, 131, 227, 15, 140, 192, 102, 193, 239, 4, - 3, 199, 80, 7, 232, 160, 253, 102, 97, 144, 31, 7, 102, 43, 202, 102, -139, 218, 102, 139, 194, 102, 15, 183, 22, 11, 0, 102, 247, 226, 102, 3, -248, 102, 88, 102, 3, 195, 102, 91, 233, 101, 255, 6, 30, 102, 96, 38, -103, 102, 15, 183, 95, 4, 38, 103, 102, 15, 183, 79, 6, 102, 11, 201, - 15, 132, 101, 250, 102, 3, 223, 102, 131, 195, 2, 102, 129, 199, 254, 1, - 0, 0, 102, 73, 102, 11, 201, 15, 132, 23, 0, 38, 103, 139, 3, 38, -103, 137, 7, 102, 131, 195, 2, 102, 129, 199, 0, 2, 0, 0, 102, 73, -235, 226, 102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 184, 1, 0, - 0, 0, 102, 163, 30, 2, 102, 161, 26, 2, 102, 3, 6, 82, 2, 102, -163, 74, 2, 102, 161, 48, 0, 102, 15, 182, 30, 13, 0, 102, 247, 227, -102, 163, 84, 0, 102, 161, 86, 2, 163, 91, 0, 102, 139, 30, 26, 2, - 30, 7, 232, 242, 252, 102, 15, 183, 251, 232, 111, 255, 102, 161, 26, 2, -102, 187, 32, 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, - 0, 0, 232, 100, 253, 102, 11, 192, 15, 132, 87, 0, 102, 139, 216, 30, - 7, 102, 139, 62, 22, 2, 232, 249, 253, 102, 139, 30, 22, 2, 103, 102, -129, 59, 128, 0, 0, 0, 15, 132, 6, 0, 103, 3, 91, 4, 235, 238, -103, 102, 129, 59, 128, 0, 0, 0, 15, 133, 39, 0, 102, 83, 103, 102, -139, 67, 16, 102, 139, 62, 74, 2, 30, 7, 232, 9, 1, 102, 91, 102, -161, 82, 2, 102, 1, 6, 74, 2, 102, 255, 6, 30, 2, 103, 3, 91, - 4, 235, 205, 102, 97, 144, 31, 7, 195, 102, 139, 208, 102, 139, 14, 30, - 2, 102, 161, 26, 2, 102, 82, 102, 80, 102, 81, 102, 82, 102, 187, 128, - 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, -215, 252, 102, 11, 192, 15, 132, 64, 249, 102, 139, 216, 102, 88, 232, 42, - 1, 102, 11, 192, 15, 132, 7, 0, 102, 91, 102, 91, 102, 91, 195, 102, - 89, 102, 88, 102, 90, 102, 3, 6, 82, 2, 226, 185, 102, 51, 192, 195, - 6, 30, 102, 96, 102, 80, 102, 81, 102, 51, 210, 102, 15, 182, 30, 13, - 0, 102, 247, 243, 102, 82, 232, 144, 255, 102, 11, 192, 15, 132, 249, 248, -102, 15, 182, 30, 13, 0, 102, 247, 227, 102, 90, 102, 3, 194, 102, 163, - 84, 0, 102, 89, 102, 15, 182, 30, 13, 0, 102, 59, 203, 15, 142, 19, - 0, 137, 30, 91, 0, 102, 43, 203, 102, 88, 102, 3, 195, 102, 80, 102, - 81, 235, 20, 144, 102, 88, 102, 3, 193, 102, 80, 137, 14, 91, 0, 102, -185, 0, 0, 0, 0, 102, 81, 6, 102, 87, 139, 223, 131, 227, 15, 140, -192, 102, 193, 239, 4, 3, 199, 80, 7, 232, 155, 251, 102, 95, 7, 102, - 3, 62, 78, 2, 102, 89, 102, 88, 102, 131, 249, 0, 15, 143, 116, 255, -102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 247, 38, 86, 2, 102, -139, 14, 86, 2, 232, 89, 255, 232, 241, 253, 102, 97, 144, 31, 7, 195, - 6, 30, 102, 96, 102, 247, 38, 98, 2, 102, 139, 30, 50, 2, 102, 139, - 14, 98, 2, 30, 7, 102, 139, 62, 66, 2, 232, 35, 253, 232, 203, 253, -102, 97, 144, 31, 7, 195, 102, 80, 102, 83, 102, 81, 102, 139, 30, 70, - 2, 102, 139, 200, 102, 193, 232, 3, 102, 131, 225, 7, 102, 3, 216, 102, -184, 1, 0, 0, 0, 102, 211, 224, 103, 132, 3, 15, 132, 4, 0, 248, -235, 2, 144, 249, 102, 89, 102, 91, 102, 88, 195, 103, 128, 123, 8, 1, - 15, 132, 4, 0, 102, 43, 192, 195, 103, 102, 141, 115, 16, 103, 102, 139, - 86, 8, 102, 59, 194, 15, 135, 11, 0, 103, 102, 139, 22, 102, 59, 194, - 15, 131, 4, 0, 102, 43, 192, 195, 103, 3, 94, 16, 102, 43, 246, 103, -128, 59, 0, 15, 132, 62, 0, 232, 129, 0, 102, 3, 241, 232, 57, 0, -102, 3, 202, 102, 59, 193, 15, 140, 33, 0, 102, 139, 209, 102, 80, 103, -102, 15, 182, 11, 102, 139, 193, 102, 131, 224, 15, 102, 193, 233, 4, 102, - 3, 217, 102, 3, 216, 102, 67, 102, 88, 235, 196, 102, 43, 200, 102, 43, -194, 102, 3, 198, 195, 102, 43, 192, 195, 102, 43, 201, 103, 138, 11, 128, -225, 15, 102, 131, 249, 0, 15, 133, 4, 0, 102, 43, 201, 195, 102, 83, -102, 82, 102, 3, 217, 103, 102, 15, 190, 19, 102, 73, 102, 75, 102, 131, -249, 0, 15, 132, 13, 0, 102, 193, 226, 8, 103, 138, 19, 102, 75, 102, - 73, 235, 235, 102, 139, 202, 102, 90, 102, 91, 195, 102, 83, 102, 82, 102, - 43, 210, 103, 138, 19, 102, 131, 226, 15, 102, 43, 201, 103, 138, 11, 192, -233, 4, 102, 131, 249, 0, 15, 133, 8, 0, 102, 43, 201, 102, 90, 102, - 91, 195, 102, 3, 218, 102, 3, 217, 103, 102, 15, 190, 19, 102, 73, 102, - 75, 102, 131, 249, 0, 15, 132, 13, 0, 102, 193, 226, 8, 103, 138, 19, -102, 75, 102, 73, 235, 235, 102, 139, 202, 102, 90, 102, 91, 195, 102, 11, -201, 15, 133, 1, 0, 195, 102, 81, 102, 86, 103, 131, 62, 97, 15, 140, - 12, 0, 103, 131, 62, 122, 15, 143, 4, 0, 103, 131, 46, 32, 102, 131, -198, 2, 226, 230, 102, 94, 102, 89, 195, 102, 80, 102, 81, 102, 139, 208, -102, 161, 46, 2, 103, 102, 141, 88, 16, 103, 3, 67, 4, 103, 102, 141, - 64, 16, 102, 139, 218, 232, 158, 250, 102, 11, 192, 15, 132, 5, 0, 102, - 89, 102, 89, 195, 102, 161, 50, 2, 102, 11, 192, 15, 133, 8, 0, 102, - 89, 102, 89, 102, 51, 192, 195, 102, 139, 22, 50, 2, 103, 102, 141, 82, - 16, 103, 102, 139, 66, 8, 102, 64, 102, 139, 30, 78, 2, 102, 247, 227, -102, 51, 210, 102, 247, 54, 90, 2, 102, 80, 102, 88, 102, 11, 192, 15, -132, 48, 0, 102, 72, 102, 80, 232, 28, 254, 114, 238, 232, 241, 253, 102, - 90, 102, 89, 102, 91, 102, 83, 102, 81, 102, 82, 102, 161, 66, 2, 103, -102, 141, 64, 24, 232, 47, 250, 102, 11, 192, 116, 206, 102, 89, 102, 89, -102, 89, 195, 102, 89, 102, 89, 102, 51, 192, 195, 6, 30, 102, 96, 102, -139, 54, 66, 2, 102, 185, 32, 0, 0, 0, 102, 247, 193, 3, 0, 0, - 0, 15, 133, 3, 0, 232, 13, 0, 102, 173, 232, 105, 0, 226, 235, 102, - 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 51, 192, 102, 51, 219, 176, - 13, 180, 14, 187, 7, 0, 205, 16, 176, 10, 180, 14, 187, 7, 0, 205, - 16, 102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 11, 201, 15, 133, - 9, 0, 232, 208, 255, 102, 97, 144, 31, 7, 195, 102, 51, 192, 102, 51, -219, 173, 180, 14, 187, 7, 0, 205, 16, 226, 240, 232, 183, 255, 102, 97, -144, 31, 7, 195, 96, 172, 60, 0, 116, 9, 180, 14, 187, 7, 0, 205, - 16, 235, 242, 97, 144, 195, 6, 30, 102, 96, 102, 185, 8, 0, 0, 0, -102, 139, 208, 102, 131, 226, 15, 102, 82, 102, 193, 232, 4, 226, 241, 102, -185, 8, 0, 0, 0, 102, 88, 102, 131, 248, 9, 15, 143, 7, 0, 102, -131, 192, 48, 235, 9, 144, 102, 131, 232, 10, 102, 131, 192, 65, 102, 51, -219, 180, 14, 187, 7, 0, 205, 16, 226, 219, 176, 32, 180, 14, 187, 7, - 0, 205, 16, 102, 97, 144, 31, 7, 232, 96, 0, 195, 6, 30, 102, 96, -102, 190, 22, 13, 0, 0, 232, 79, 245, 102, 97, 144, 31, 7, 195, 6, - 30, 102, 96, 102, 190, 38, 13, 0, 0, 232, 60, 245, 102, 97, 144, 31, - 7, 195, 6, 30, 102, 96, 102, 190, 54, 13, 0, 0, 232, 41, 245, 102, - 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 190, 70, 13, 0, 0, 232, - 22, 245, 102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 190, 86, 13, - 0, 0, 232, 3, 245, 102, 97, 144, 31, 7, 195, 102, 80, 102, 184, 0, - 0, 245, 255, 102, 64, 102, 11, 192, 117, 249, 102, 88, 195, 102, 81, 102, - 80, 102, 184, 5, 0, 0, 0, 30, 7, 102, 139, 249, 232, 71, 252, 102, -139, 193, 102, 91, 102, 83, 102, 15, 183, 14, 12, 2, 102, 186, 14, 2, - 0, 0, 232, 68, 248, 102, 91, 102, 89, 102, 11, 192, 15, 133, 47, 0, -102, 139, 193, 102, 139, 203, 102, 80, 102, 83, 232, 35, 0, 102, 91, 102, - 95, 102, 11, 192, 15, 132, 23, 0, 30, 7, 232, 9, 252, 102, 139, 199, -102, 15, 183, 14, 12, 2, 102, 186, 14, 2, 0, 0, 232, 10, 248, 195, -102, 81, 102, 187, 32, 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, - 0, 0, 0, 0, 232, 242, 247, 102, 11, 192, 15, 132, 82, 0, 102, 139, -216, 30, 7, 102, 139, 62, 22, 2, 232, 135, 248, 30, 7, 102, 139, 30, - 22, 2, 102, 89, 38, 102, 57, 15, 15, 132, 46, 0, 38, 102, 131, 63, -255, 15, 132, 45, 0, 38, 131, 127, 4, 0, 15, 132, 36, 0, 38, 102, - 15, 183, 71, 4, 3, 216, 139, 195, 37, 0, 128, 116, 215, 140, 192, 5, - 0, 8, 142, 192, 129, 227, 255, 127, 235, 202, 38, 102, 139, 71, 16, 195, -102, 89, 102, 51, 192, 195, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, -116, 32, 48, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, -116, 32, 49, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, -116, 32, 50, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, -116, 32, 51, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, -116, 32, 52, 13, 10 }; - diff --git a/ntfstools/dumplog.c b/ntfstools/dumplog.c deleted file mode 100644 index 1a730c97..00000000 --- a/ntfstools/dumplog.c +++ /dev/null @@ -1,310 +0,0 @@ -const char *EXEC_NAME = "dumplog"; -const char *EXEC_VERSION = "1.0"; -/* - * $Id$ - * - * DumpLog - Part of the Linux-NTFS project. - * - * Copyright (c) 2000,2001 Anton Altaparmakov. - * - * This utility will interpret the contents of the journal ($LogFile) specified - * on the command line and display the results on stdout. Errors will be output - * to stderr. - * - * Anton Altaparmakov - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS source - * in the file COPYING); if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "types.h" -#include "mst.h" -#include "logfile.h" - -int main(int argc, char **argv) -{ - s64 l, br; - unsigned char *lfd = NULL; - RESTART_PAGE_HEADER *rph; - RESTART_AREA *rr; - RESTART_CLIENT *cr; - RECORD_PAGE_HEADER *rcrd_ph; - LOG_RECORD *lr; - int pass = 1; - int i, lps, client; - int f = 0; - char zero[4096]; - struct stat sbuf; - - memset(zero, 0, sizeof(zero)); - printf("\n"); - if (argc != 2) { - printf("%s v%s - Interpret and display information about the " - "journal\ngiven on the command line.\n\n" - /* Generic copyright / disclaimer. */ - "Copyright (c) 2001 Anton Altaparmakov.\n\n" - "%s is free software, released under the GNU " - "General Public License\nand you are welcome to " - "redistribute it under certain conditions.\n" - "%s comes with ABSOLUTELY NO WARRANTY; for details " - "read the GNU\nGeneral Public License to be found " - "in the file COPYING in the main Linux-NTFS\n" - "distribution directory.\n\n" - /* Generic part ends here. */ - "Syntax: dumplog log_file_name\n" - " e.g. dumplog /mnt/ntfstest/\\$LogFile\n\n", - EXEC_NAME, EXEC_VERSION, EXEC_NAME, EXEC_NAME); - fprintf(stderr, "Error: incorrect syntax\n"); - exit(1); - } - if (stat(argv[1], &sbuf) == -1) { - if (errno == ENOENT) - fprintf(stderr, "The file doesn't exist; did you " - "specify it correctly?\n"); - else - fprintf(stderr, "Error getting information about %s: " - "%s\n", argv[1], strerror(errno)); - exit(1); - } - f = open(argv[1], O_RDONLY); - if (f == -1) { - perror("Couldn't open file"); - exit(1); - } - l = sbuf.st_size; - if (l > 0x400000LL) { - printf("Only analysing the first four megabytes of the " - "logfile (real size = 0x%Lx).\n", - (unsigned long long)l); - l = 0x400000LL; - } - lfd = (unsigned char*)calloc(1, l); - if (!lfd) { - perror("Couldn't allocate internal buffer"); - goto log_file_error; - } - /* Read in the $LogFile into the buffer. */ - if ((br = read(f, lfd, l)) == -1) { - perror("Couldn't read file"); - goto log_file_error; - } - /* Valid data length in buffer. */ - l = min(br, l); - /* Check restart area. */ - if (!is_rstr_recordp(lfd)) { - s64 _l; - - for (_l = 0LL; _l < l; _l++) - if (lfd[_l] != (unsigned char)-1) - break; - if (_l < l) - puts("Logfile contents are corrupt (magic RSTR " - "missing)!"); - else - puts("Logfile is empty."); - goto log_file_error; - } - /* Do the interpretation and display now. */ - rph = (RESTART_PAGE_HEADER*)lfd; - lps = le32_to_cpu(rph->log_page_size); -pass_loc: - if (ntfs_post_read_mst_fixup((NTFS_RECORD*)rph, lps) || - is_baad_record(rph->magic)) { - puts("Logfile incomplete multi sector transfer detected! " - "Cannot handle this yet!"); - goto log_file_error; - } - if ((pass == 2) && !memcmp(lfd, rph, lps)) { - printf("2nd restart area fully matches the 1st one. Skipping " - "display.\n"); - goto skip_rstr_pass; - } - if (le16_to_cpu(rph->major_ver != 1) || - le16_to_cpu(rph->minor_ver != 1)) { - fprintf(stderr, "$LogFile version %i.%i! Error: Unknown " - "$LogFile version!\n", - le16_to_cpu(rph->major_ver), - le16_to_cpu(rph->minor_ver)); - goto log_file_error; - } - rr = (RESTART_AREA*)((char*)rph + le16_to_cpu(rph->restart_offset)); - cr = (RESTART_CLIENT*)((char*)rr + - le16_to_cpu(rr->client_array_offset)); - /* Dump of the interpreted $LogFile restart area. */ - if (pass == 1) - printf("\n$LogFile version %i.%i.\n", - le16_to_cpu(rph->major_ver), - le16_to_cpu(rph->minor_ver)); - printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); - printf("magic = RSTR\n"); - printf("ChkDskLsn = 0x%Lx\n", sle64_to_cpu(rph->chkdsk_lsn)); - printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); - printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); - printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); - printf("\n(1st) restart record:\n"); - printf("CurrentLsn = %Lx\n", sle64_to_cpu(rr->current_lsn)); - printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); - printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); - printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); - printf("Flags = 0x%x\n", le16_to_cpu(rr->flags)); - printf("SeqNumberBits = %u (0x%x)\n", le32_to_cpu(rr->seq_number_bits), - le32_to_cpu(rr->seq_number_bits)); - printf("RestartAreaLength = 0x%x\n", - le16_to_cpu(rr->restart_area_length)); - printf("ClientArrayOffset = 0x%x\n", - le16_to_cpu(rr->client_array_offset)); - printf("FileSize = %Lu (0x%Lx)\n", le64_to_cpu(rr->file_size), - le64_to_cpu(rr->file_size)); - printf("LastLsnDataLength = 0x%x\n", - le32_to_cpu(rr->last_lsn_data_length)); - printf("RecordLength = 0x%x\n", le16_to_cpu(rr->record_length)); - printf("LogPageDataOffset = 0x%x\n", - le16_to_cpu(rr->log_page_data_offset)); - for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { - printf("\nRestart client record number %i:\n", client); - printf("OldestLsn = 0x%Lx\n", sle64_to_cpu(cr->oldest_lsn)); - printf("ClientRestartLsn = 0x%Lx\n", - sle64_to_cpu(cr->client_restart_lsn)); - printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); - printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); - printf("SeqNumber = 0x%Lx\n", le64_to_cpu(cr->seq_number)); - printf("ClientNameLength = 0x%x\n", - le32_to_cpu(cr->client_name_length)); - if (le32_to_cpu(cr->client_name_length)) { - // convert to ascii and print out. - // printf("ClientName = %u\n", le16_to_cpu(cr->client_name)); - } - /* Size of a restart client record is fixed at 0xa0 bytes. */ - cr = (RESTART_CLIENT*)((char*)cr + 0xa0); - } -skip_rstr_pass: - if (pass == 1) { - rph = (RESTART_PAGE_HEADER*)((char*)rph + lps); - ++pass; - goto pass_loc; - } - rcrd_ph = (RECORD_PAGE_HEADER*)rph; - /* Reuse pass for log record clienter. */ - pass = 0; - printf("\nFinished with restart area. Beginning with log area.\n"); -rcrd_pass_loc: - rcrd_ph = (RECORD_PAGE_HEADER*)((char*)rcrd_ph + lps); - if ((char*)rcrd_ph + lps > (char*)lfd + l) - goto end_of_rcrd_passes; - printf("\nLog record page number %i", pass); - if (!is_rcrd_record(rcrd_ph->magic)) { - for (i = 0; i < lps; i++) - if (((char*)rcrd_ph)[i] != (char)-1) - break; - if (i < lps) - puts(" is corrupt (magic RCRD is missing)."); - else - puts(" is empty."); - pass++; - goto rcrd_pass_loc; - } else - printf(":"); - /* Dump log record page */ - printf("\nmagic = RCRD\n"); - printf("copy.last_lsn/file_offset = 0x%Lx\n", - le64_to_cpu(rcrd_ph->copy.last_lsn)); - printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); - printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); - printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); - printf("header.next_record_offset = 0x%Lx\n", - le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); - printf("header.last_end_lsn = 0x%Lx\n", - le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); - /* - * Where does the 0x40 come from? Is it just usa_offset + - * usa_client * 2 + 7 & ~7 or is it derived from somewhere? - */ - lr = (LOG_RECORD*)((char*)rcrd_ph + 0x40); - client = 0; -log_record_pass: - printf("\nLog record %i:\n", client); - printf("this lsn = 0x%Lx\n", le64_to_cpu(lr->this_lsn)); - printf("client previous lsn = 0x%Lx\n", - le64_to_cpu(lr->client_previous_lsn)); - printf("client undo next lsn = 0x%Lx\n", - le64_to_cpu(lr->client_undo_next_lsn)); - printf("client data length = 0x%x\n", - le32_to_cpu(lr->client_data_length)); - printf("client_id.seq_number = 0x%x\n", - le16_to_cpu(lr->client_id.seq_number)); - printf("client_id.client_index = 0x%x\n", - le16_to_cpu(lr->client_id.client_index)); - printf("record type = 0x%x\n", le32_to_cpu(lr->record_type)); - printf("transaction_id = 0x%x\n", le32_to_cpu(lr->transaction_id)); - printf("flags = 0x%x:", lr->flags); - if (!lr->flags) - printf(" NONE\n"); - else { - int _b = 0; - - if (lr->flags & LOG_RECORD_MULTI_PAGE) { - printf(" LOG_RECORD_MULTI_PAGE"); - _b = 1; - } - if (lr->flags & ~LOG_RECORD_MULTI_PAGE) { - if (_b) - printf(" |"); - printf(" Unknown flags"); - } - printf("\n"); - } - printf("redo_operation = 0x%x\n", le16_to_cpu(lr->redo_operation)); - printf("undo_operation = 0x%x\n", le16_to_cpu(lr->undo_operation)); - printf("redo_offset = 0x%x\n", le16_to_cpu(lr->redo_offset)); - printf("redo_length = 0x%x\n", le16_to_cpu(lr->redo_length)); - printf("undo_offset = 0x%x\n", le16_to_cpu(lr->undo_offset)); - printf("undo_length = 0x%x\n", le16_to_cpu(lr->undo_length)); - printf("target_attribute = 0x%x\n", le16_to_cpu(lr->target_attribute)); - printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); - printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); - printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); - printf("target_vcn = 0x%Lx\n", sle64_to_cpu(lr->target_vcn)); - if (le16_to_cpu(lr->lcns_to_follow) > 0) - printf("Array of lcns:\n"); - for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) - printf("lcn_list[%i].lcn = 0x%Lx\n", i, - sle64_to_cpu(lr->lcn_list[i].lcn)); - client++; - lr = (LOG_RECORD*)((char*)lr + 0x70); - if (((char*)lr + 0x70 <= (char*)rcrd_ph + - le64_to_cpu(rcrd_ph->header.packed.next_record_offset))) - goto log_record_pass; - pass++; - goto rcrd_pass_loc; -end_of_rcrd_passes: -log_file_error: - printf("\n"); - /* Set return code to 0. */ - i = 0; - if (lfd) - free(lfd); - if (f) - close(f); - return i; -} - diff --git a/ntfstools/mkntfs.8.in b/ntfstools/mkntfs.8.in deleted file mode 100644 index 6916396d..00000000 --- a/ntfstools/mkntfs.8.in +++ /dev/null @@ -1,213 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2001,2002 Anton Altaparmakov. All Rights Reserved. -.\" This file may be copied under the terms of the GNU Public License. -.\" Adapted from e2fsprogs-1.19/misc/mke2fs.8.in by Theodore Ts'o. -.\" -.TH MKNTFS 8 "March 2002" "Linux-NTFS version @VERSION@" -.SH NAME -mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system -.SH SYNOPSIS -.B mkntfs -[ -.B \-s -.I sector-size -] -[ -.B \-c -.I cluster-size -] -[ -.B \-L -.I volume-label -] -[ -.B \-z -.I mft-zone-multiplier -] -[ -.B \-f -| -.B \-Q -] -[ -.B -n -] -[ -.B \-q -] -[ -.B \-v -] -[ -.B \-vv -] -[ -.B \-C -] -[ -.B \-F -] -[ -.B \-I -] -[ -.B \-V -] -.I device -[ -.I number-of-sectors -] -.SH DESCRIPTION -.B mkntfs -is used to create a NTFS 1.2 (Windows NT 4.0) file system on a device (usually -a disk partition). -.I device -is the special file corresponding to the device (e.g -.IR /dev/hdXX ). -.I number-of-sectors -is the number of blocks on the device. If omitted, -.B mkntfs -automagically figures the file system size. -.SH OPTIONS -.TP -.BI \-s " sector-size" -Specify the size of sectors in bytes. Valid sector size values are 256, 512, -1024, 2048 and 4096 bytes per sector. If omitted, -.B mkntfs -.I sector-size -is determined automatically and if that fails a default of 512 -bytes per sector is used. -.TP -.BI \-c " cluster-size" -Specify the size of clusters in bytes. Valid cluster size values are powers of -two, with at least 256, and at most 65536 bytes per cluster. If omitted, -.B mkntfs -.I cluster-size -is determined by the volume size. The value is determined as -follows: -.TS -lB lB lB -l l r. -Volume size Default cluster -0 - 512MB 512 bytes -512MB - 1GB 1024 bytes -1GB - 2GB 2048 bytes -2GB + 4096 bytes -.TE - -Note that the default cluster size is set to be at least equal to the sector -size as a cluster cannot be smaller than a sector. Also, note that values -greater than 4096 have the side effect that compression is disabled on the -volume (due to limitations in the NTFS compression algorithm currently in use -by Windows). -.TP -.BI \-L " volume-label" -Set the volume label for the filesystem. -.TP -.BI \-z " mft-zone-multiplier" -Set the MFT zone multiplier, which determines the size of the MFT zone to use -on the volume. The MFT zone is the area at the beginning of the volume reserved -for the master file table (MFT), which stores the on disk inodes (MFT records). -It is noteworthy that small files are stored entirely within the inode; -thus, if you expect to use the volume for storing large numbers of very small -files, it is useful to set the zone multiplier to a higher value. Note, that -the MFT zone is resized on the fly as required during operation of the NTFS -driver but choosing a good value will reduce fragmentation. Valid values -are 1, 2, 3 and 4. The values have the following meaning: -.TS -lB lB -lB lB -c l. -MFT zone MFT zone size -multiplier (% of volume size) -1 12.5% (default) -2 25.0% -3 37.5% -4 50.0% -.TE -.TP -.B \-f -Same as -.BR \-Q . -.TP -.B \-Q -Perform quick format. This will skip both zeroing of the volume and bad sector -checking. -.TP -.B \-n -Causes -.B mkntfs -to not actually create a filesystem, but display what it would do if it were -to create a filesystem. All steps of the format are carried out except the -actual writing to the device. -.TP -.B \-q -Quiet execution; only errors are written to stderr, no output to stdout -occurs at all. Useful if -.B mkntfs -is run in a script. -.TP -.B \-v -Verbose execution. -.TP -.B \-vv -Really verbose execution; includes the verbose output from the -.B \-v -option as well as additional output useful for debugging -.B mkntfs. -.TP -.B \-C -Enable compression on the volume. -.TP -.B \-F -Force -.B mkntfs -to run, even if the specified -.I device -is not a block special device, or appears to be mounted. -.TP -.B \-I -Disable content indexing on the volume. (This is only meaningful on -Windows 2000 and later. Windows NT 4.0 and earlier ignore this as they do -not implement content indexing at all.) -.TP -.B \-V -Print the version number of -.B mkntfs -and exit. -.SH AUTHOR -This version of -.B mkntfs -has been written by Anton Altaparmakov (if that fails, use -). -.SH BUGS -.B mkntfs -writes the backup boot sector to the last sector of the block -.I device -being formatted. However, current versions of the Linux kernel (all versions -up to and including todays 2.4.18) either only report an even number of sectors -when the sector size is below 1024 bytes, which is the case for most hard -drives today (512 bytes sector size) or they return the correct number but -accessing the last sector fails. Either way, this means that when a partition -has an odd number of 512-byte sectors, the last sector is either not reported -to us at all or it is not writable by us and hence the created NTFS volume -will either have the backup boot sector placed one sector ahead of where it -should be or it cannot be written at all. For this reason, -.B mkntfs -marks the NTFS volume dirty, so that when you reboot into Windows, check disk -runs automatically and creates a copy of the backup boot sector in the correct -location. This also has the benefit of catching any bugs in -.B mkntfs -as check disk would find any corrupt structures and repair them, as well as -report them. - If you do see any problems reported, please report the messages -to the author. -.br -There may be other bugs. Please, report them to the author. -.SH AVAILABILITY -.B mkntfs -is part of the Linux-NTFS project and is available for download from -http://sf.net/project/showfiles.php?group_id=13956 in source (tar ball and -rpm) and pre-compiled binary (i386 rpm and deb) form. -.SH SEE ALSO -.BR badblocks (8) - diff --git a/ntfstools/mkntfs.c b/ntfstools/mkntfs.c deleted file mode 100644 index 47357c76..00000000 --- a/ntfstools/mkntfs.c +++ /dev/null @@ -1,3554 +0,0 @@ -/* - * $Id$ - * - * mkntfs - Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2002 Anton Altaparmakov. - * Copyright (C) 2001-2002 Richard Russon. - * - * This utility will create an NTFS 1.2 (Windows NT 4.0) volume on a user - * specified (block) device. - * - * Some things (option handling and determination of mount status) have been - * adapted from e2fsprogs-1.19 and lib/ext2fs/ismounted.c and misc/mke2fs.c in - * particular. - * - * Anton Altaparmakov - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS source - * in the file COPYING); if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * WARNING: This program might not work on architectures which do not allow - * unaligned access. For those, the program would need to start using - * get/put_unaligned macros (#include ), but not doing it yet, - * since NTFS really mostly applies to ia32 only, which does allow unaligned - * accesses. We might not actually have a problem though, since the structs are - * defined as being packed so that might be enough for gcc to insert the - * correct code. - * - * If anyone using a non-little endian and/or an aligned access only CPU tries - * this program please let me know whether it works or not! - * - * Anton Altaparmakov - */ - -#include "config.h" - -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_STDLIB_H -# include -#endif -#ifdef HAVE_STDIO_H -# include -#endif -#ifdef HAVE_STDARG_H -# include -#endif -#ifdef HAVE_STRING_H -# include -#endif -#ifdef HAVE_ERRNO_H -# include -#endif -#include -#ifdef HAVE_LINUX_FD_H -# include -# include -#endif -#include -#ifdef HAVE_GETOPT_H -# include -#else - extern char *optarg; - extern int optind; -#endif -#include -#ifdef HAVE_LINUX_MAJOR_H -# include -#endif -#ifndef MAJOR -# define MAJOR(dev) ((dev) >> 8) -# define MINOR(dev) ((dev) & 0xff) -#endif -#ifndef SCSI_BLK_MAJOR -# define SCSI_BLK_MAJOR(m) ((m) == SCSI_DISK_MAJOR || \ - (m) == SCSI_CDROM_MAJOR) -#endif -#include - -#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE) -# define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ -#endif - -#if defined(__linux__) && defined(_IO) && !defined(BLKSSZGET) -# define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytse. */ -#endif - -#include "types.h" -#include "bootsect.h" -#include "disk_io.h" -#include "attrib.h" -#include "bitmap.h" -#include "mst.h" -#include "dir.h" -#include "runlist.h" - -extern const unsigned char attrdef_ntfs12_array[2400]; -extern const unsigned char boot_array[3429]; -extern void init_system_file_sd(int sys_file_no, char **sd_val, - int *sd_val_len); -extern void init_upcase_table(uchar_t *uc, u32 uc_len); - -/* Page size on ia32. Can change to 8192 on Alpha. */ -#define NTFS_PAGE_SIZE 4096 - -const char *EXEC_NAME = "mkntfs"; - -/* Need these global so mkntfs_exit can access them. */ -struct flock flk; -char *buf = NULL; -char *buf2 = NULL; -int buf2_size = 0; -int mft_bitmap_size, mft_bitmap_byte_size; -unsigned char *mft_bitmap = NULL; -int lcn_bitmap_byte_size; -unsigned char *lcn_bitmap = NULL; -run_list *rl = NULL, *rl_mft = NULL, *rl_mft_bmp = NULL, *rl_mftmirr = NULL; -run_list *rl_logfile = NULL, *rl_boot = NULL, *rl_bad = NULL, *rl_index; -INDEX_ALLOCATION *index_block = NULL; -ntfs_volume *vol; - -struct { - int sector_size; /* -s, in bytes, power of 2, default is - 512 bytes. */ - long long nr_sectors; /* size of device in sectors */ - long long nr_clusters; /* Note: Win2k treats clusters as - 32-bit entities! */ - long long volume_size; /* in bytes, or suffixed - with k for kB, m or M for MB, or - g or G for GB, or t or T for TB */ - int index_block_size; /* in bytes. */ - int mft_size; /* The bigger of 16kB & one cluster. */ - long long mft_lcn; /* lcn of $MFT, $DATA attribute. */ - long long mftmirr_lcn; /* lcn of $MFTMirr, $DATA. */ - long long logfile_lcn; /* lcn of $LogFile, $DATA. */ - int logfile_size; /* in bytes, determined from - volume_size. */ - char mft_zone_multiplier; /* -z, value from 1 to 4. Default is - 1. */ - long long mft_zone_end; /* Determined from volume_size and - mft_zone_multiplier, in clusters. */ - char no_action; /* -n, do not write to device, only - display what would be done. */ - char check_bad_blocks; /* read-only test for bad - clusters. */ - long long *bad_blocks; /* Array of bad clusters. */ - long long nr_bad_blocks; /* Number of bad clusters. */ - char *bad_blocks_filename; /* filename, file to read list of - bad clusters from. */ - ATTR_DEF *attr_defs; /* filename, attribute defs. */ - int attr_defs_len; /* in bytes */ - uchar_t *upcase; /* filename, upcase table. */ - u32 upcase_len; /* Determined automatically. */ - char quiet; /* -q, quiet execution. */ - char verbose; /* -v, verbose execution, given twice, - * really verbose execution (debug - * mode). */ - char force; /* -F, force fs creation. */ - char quick_format; /* -f or -Q, fast format, don't zero - the volume first. */ - char enable_compression; /* -C, enables compression of all files - on the volume by default. */ - char disable_indexing; /* -I, disables indexing of file - contents on the volume by default. */ - /* -V, print version and exit. */ -} opt; - -/* Error output. Ignores quiet (-q). */ -void Eprintf(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "ERROR: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); -} - -void err_exit(const char *fmt, ...) __attribute__ ((noreturn)); - -/* Error output and terminate. Ignores quiet (-q). */ -void err_exit(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "ERROR: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "Aborting...\n"); - exit(1); -} - -/* Debugging output (-vv). Overriden by quiet (-q). */ -void Dprintf(const char *fmt, ...) -{ - va_list ap; - - if (!opt.quiet && opt.verbose > 1) { - printf("DEBUG: "); - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); - } -} - -/* Verbose output (-v). */ -void Vprintf(const char *fmt, ...) -{ - va_list ap; - - if (!opt.quiet && opt.verbose > 0) { - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); - } -} - -/* Quietable output (if not -q). */ -void Qprintf(const char *fmt, ...) -{ - va_list ap; - - if (!opt.quiet) { - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); - } -} - -void append_to_bad_blocks(unsigned long block) -{ - long long *new_buf; - - if (!(opt.nr_bad_blocks & 15)) { - new_buf = realloc(opt.bad_blocks, (opt.nr_bad_blocks + 16) * - sizeof(long long)); - if (!new_buf) - err_exit("Reallocating memory for bad blocks list " - "failed: %s\n", strerror(errno)); - if (opt.bad_blocks != new_buf) - free(opt.bad_blocks); - opt.bad_blocks = new_buf; - } - opt.bad_blocks[opt.nr_bad_blocks++] = block; -} - -__inline__ long long mkntfs_write(int fd, const void *buf, long long count) -{ - long long bytes_written, total; - int retry; - - if (opt.no_action) - return count; - total = 0LL; - retry = 0; - do { - bytes_written = write(fd, buf, count); - if (bytes_written == -1LL) { - retry = errno; - Eprintf("Error writing to %s: %s\n", vol->dev_name, - strerror(errno)); - errno = retry; - return bytes_written; - } else if (!bytes_written) - ++retry; - else { - count -= bytes_written; - total += bytes_written; - } - } while (count && retry < 3); - if (count) - Eprintf("Failed to complete writing to %s after three retries." - "\n", vol->dev_name); - return total; -} - -/* - * Write to disk the clusters contained in the run list @rl taking the data - * from @val. Take @val_len bytes from @val and pad the rest with zeroes. - * - * If the @rl specifies a completely sparse file, @val is allowed to be NULL. - * - * @inited_size if not NULL points to an output variable which will contain - * the actual number of bytes written to disk. I.e. this will not include - * sparse bytes for example. - * - * Return the number of bytes written (minus padding) or -1 on error. Errno - * will be set to the error code. - */ -s64 ntfs_rlwrite(int fd, const run_list *rl, const char *val, - const s64 val_len, s64 *inited_size) -{ - s64 bytes_written, total, length, delta; - int retry, i; - - if (inited_size) - *inited_size = 0LL; - if (opt.no_action) - return val_len; - total = delta = 0LL; - for (i = 0; rl[i].length; i++) { - length = rl[i].length * vol->cluster_size; - /* Don't write sparse runs. */ - if (rl[i].lcn == -1) { - total += length; - if (!val) - continue; - // TODO: Check that *val is really zero at pos and len. - continue; - } - if (lseek(fd, rl[i].lcn * vol->cluster_size, SEEK_SET) == - (off_t)-1) - return -1LL; - retry = 0; - do { - if (total + length > val_len) { - delta = length; - length = val_len - total; - delta -= length; - } - bytes_written = write(fd, val + total, length); - if (bytes_written == -1LL) { - retry = errno; - Eprintf("Error writing to %s: %s\n", - vol->dev_name, strerror(errno)); - errno = retry; - return bytes_written; - } - if (bytes_written) { - length -= bytes_written; - total += bytes_written; - if (inited_size) - *inited_size += bytes_written; - } else - ++retry; - } while (length && retry < 3); - if (length) { - Eprintf("Failed to complete writing to %s after three " - "retries.\n", vol->dev_name); - return total; - } - } - if (delta) { - char *buf = (char*)calloc(1, delta); - if (!buf) - err_exit("Error allocating internal buffer: " - "%s\n", strerror(errno)); - bytes_written = mkntfs_write(fd, buf, delta); - free(buf); - if (bytes_written == -1LL) - return bytes_written; - } - return total; -} - -/** - * ucslen - determine the length of a fixed-size unicode-character string - * @s: pointer to unicode-character string - * - * Return the number of unicode-characters in @s up to a maximum of maxlen - * unicode-characters, not including the terminating (uchar_t)'\0'. If there - * is no (uchar_t)'\0' between s and s+maxlen, maxlen is returned. - * - * This function never looks beyond s+maxlen. - */ -int ucsnlen(const uchar_t *s, int maxlen) -{ - int i; - - for (i = 0; i < maxlen; i++) - if (!s[i]) - break; - return i; -} - -/** - * ucstos - convert unicode-character string to ASCII - * @dest: points to buffer to receive the converted string - * @src: points to string to convert - * @maxlen: size of @dest buffer in bytes - * - * Return the number of characters written to @dest, not including the - * terminating null byte. If a unicode character was encountered which could - * not be converted -1 is returned. - */ -int ucstos(char *dest, const uchar_t *src, int maxlen) -{ - uchar_t u; - int i; - - /* Need one byte for null terminator. */ - maxlen--; - for (i = 0; i < maxlen; i++) { - u = le16_to_cpu(src[i]); - if (!u) - break; - if (u & 0xff00) - return -1; - dest[i] = u & 0xff; - } - dest[i] = 0; - return i; -} - -/** - * stoucs - convert ASCII string to unicode-character string - * @dest: points to buffer to receive the converted string - * @src: points to string to convert - * @maxlen: size of @dest buffer in bytes - * - * Return the number of characters written to @dest, not including the - * terminating null unicode character. - */ -int stoucs(uchar_t *dest, const char *src, int maxlen) -{ - char c; - int i; - - /* Need two bytes for null terminator. */ - maxlen -= 2; - for (i = 0; i < maxlen; i++) { - c = src[i]; - if (!c) - break; - dest[i] = cpu_to_le16(c); - } - dest[i] = cpu_to_le16('\0'); - return i; -} - -void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) -{ - const char *don_t_know = "Don't know what to do with this attribute " - "type yet."; - const char *skip = "Skipping display of $%s attribute value.\n"; - const char *todo = "This is still work in progress."; - char *buf; - int i, j; - - switch (type) { - case AT_STANDARD_INFORMATION: - // TODO - printf("%s\n", todo); - return; - case AT_ATTRIBUTE_LIST: - // TODO - printf("%s\n", todo); - return; - case AT_FILE_NAME: - // TODO - printf("%s\n", todo); - return; - case AT_OBJECT_ID: - // TODO - printf("%s\n", todo); - return; - case AT_SECURITY_DESCRIPTOR: - // TODO - printf("%s\n", todo); - return; - case AT_VOLUME_NAME: - printf("Volume name length = %i\n", val_len); - if (val_len) { - buf = calloc(1, val_len); - if (!buf) - err_exit("Failed to allocate internal buffer: " - "%s\n", strerror(errno)); - i = ucstos(buf, (uchar_t*)val, val_len); - if (i == -1) - printf("Volume name contains non-displayable " - "Unicode characters.\n"); - printf("Volume name = %s\n", buf); - free(buf); - } - return; - case AT_VOLUME_INFORMATION: -#define VOL_INF(x) ((VOLUME_INFORMATION *)(x)) - printf("NTFS version %i.%i\n", VOL_INF(val)->major_ver, - VOL_INF(val)->minor_ver); - i = VOL_INF(val)->flags; -#undef VOL_INF - printf("Volume flags = 0x%x: ", i); - if (!i) { - printf("NONE\n"); - return; - } - j = 0; - if (i & VOLUME_MODIFIED_BY_CHKDSK) { - j = 1; - printf("VOLUME_MODIFIED_BY_CHKDSK"); - } - if (i & VOLUME_REPAIR_OBJECT_ID) { - if (j) - printf(" | "); - else - j = 0; - printf("VOLUME_REPAIR_OBJECT_ID"); - } - if (i & VOLUME_DELETE_USN_UNDERWAY) { - if (j) - printf(" | "); - else - j = 0; - printf("VOLUME_DELETE_USN_UNDERWAY"); - } - if (i & VOLUME_MOUNTED_ON_NT4) { - if (j) - printf(" | "); - else - j = 0; - printf("VOLUME_MOUNTED_ON_NT4"); - } - if (i & VOLUME_UPGRADE_ON_MOUNT) { - if (j) - printf(" | "); - else - j = 0; - printf("VOLUME_UPGRADE_ON_MOUNT"); - } - if (i & VOLUME_RESIZE_LOG_FILE) { - if (j) - printf(" | "); - else - j = 0; - printf("VOLUME_RESIZE_LOG_FILE"); - } - if (i & VOLUME_IS_DIRTY) { - if (j) - printf(" | "); - else - j = 0; - printf("VOLUME_IS_DIRTY"); - } - printf("\n"); - return; - case AT_DATA: - printf(skip, "DATA"); - return; - case AT_INDEX_ROOT: - // TODO - printf("%s\n", todo); - return; - case AT_INDEX_ALLOCATION: - // TODO - printf("%s\n", todo); - return; - case AT_BITMAP: - printf(skip, "BITMAP"); - return; - case AT_REPARSE_POINT: - // TODO - printf("%s\n", todo); - return; - case AT_EA_INFORMATION: - // TODO - printf("%s\n", don_t_know); - return; - case AT_EA: - // TODO - printf("%s\n", don_t_know); - return; - case AT_LOGGED_UTILITY_STREAM: - // TODO - printf("%s\n", don_t_know); - return; - default: - i = le32_to_cpu(type); - printf("Cannot display unknown %s defined attribute type 0x%x" - ".\n", i >= - le32_to_cpu(AT_FIRST_USER_DEFINED_ATTRIBUTE) ? - "user" : "system", i); - } -} - -void dump_resident_attr(ATTR_RECORD *a) -{ - int i; - - i = le32_to_cpu(a->value_length); - printf("Attribute value length = %u (0x%x)\n", i, i); - i = le16_to_cpu(a->value_offset); - printf("Attribute value offset = %u (0x%x)\n", i, i); - i = a->resident_flags; - printf("Resident flags = 0x%x: ", i); - if (!i) - printf("NONE\n"); - else if (i & ~RESIDENT_ATTR_IS_INDEXED) - printf("UNKNOWN FLAG(S)\n"); - else - printf("RESIDENT_ATTR_IS_INDEXED\n"); - dump_resident_attr_val(a->type, (char*)a + le16_to_cpu(a->value_offset), - le32_to_cpu(a->value_length)); -} - -void dump_mapping_pairs_array(char *b, unsigned int max_len) -{ - // TODO - return; -} - -void dump_non_resident_attr(ATTR_RECORD *a) -{ - s64 l; - int i; - - l = sle64_to_cpu(a->lowest_vcn); - printf("Lowest VCN = %Li (0x%Lx)\n", l, l); - l = sle64_to_cpu(a->highest_vcn); - printf("Highest VCN = %Li (0x%Lx)\n", l, l); - printf("Mapping pairs array offset = 0x%x\n", - le16_to_cpu(a->mapping_pairs_offset)); - printf("Compression unit = 0x%x: %sCOMPRESSED\n", a->compression_unit, - a->compression_unit ? "" : "NOT "); - if (sle64_to_cpu(a->lowest_vcn)) - printf("Attribute is not the first extent. The following " - "sizes are meaningless:\n"); - l = sle64_to_cpu(a->allocated_size); - printf("Allocated size = %Li (0x%Lx)\n", l, l); - l = sle64_to_cpu(a->data_size); - printf("Data size = %Li (0x%Lx)\n", l, l); - l = sle64_to_cpu(a->initialized_size); - printf("Initialized size = %Li (0x%Lx)\n", l, l); - if (a->flags & ATTR_COMPRESSION_MASK) { - l = sle64_to_cpu(a->compressed_size); - printf("Compressed size = %Li (0x%Lx)\n", l, l); - } - i = le16_to_cpu(a->mapping_pairs_offset); - dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); -} - -void dump_attr_record(ATTR_RECORD *a) -{ - unsigned int u; - char s[0x200]; - int i; - - printf("-- Beginning dump of attribute record. --\n"); - if (a->type == AT_END) { - printf("Attribute type = 0x%x ($END)\n", le32_to_cpu(AT_END)); - u = le32_to_cpu(a->length); - printf("Length of resident part = %u (0x%x)\n", u, u); - return; - } - u = le32_to_cpu(a->type); - for (i = 0; opt.attr_defs[i].type; i++) - if (le32_to_cpu(opt.attr_defs[i].type) >= u) - break; - if (opt.attr_defs[i].type) { -// printf("type = 0x%x\n", le32_to_cpu(opt.attr_defs[i].type)); -// { char *p = (char*)opt.attr_defs[i].name; -// printf("name = %c%c%c%c%c\n", *p, p[1], p[2], p[3], p[4]); -// } - if (ucstos(s, opt.attr_defs[i].name, sizeof(s)) == -1) { - Eprintf("Could not convert Unicode string to single " - "byte string in current locale.\n"); - strncpy(s, "Error converting Unicode string", - sizeof(s)); - } - } else - strncpy(s, "UNKNOWN_TYPE", sizeof(s)); - printf("Attribute type = 0x%x (%s)\n", u, s); - u = le32_to_cpu(a->length); - printf("Length of resident part = %u (0x%x)\n", u, u); - printf("Attribute is %sresident\n", a->non_resident ? "non-" : ""); - printf("Name length = %u unicode characters\n", a->name_length); - printf("Name offset = %u (0x%x)\n", cpu_to_le16(a->name_offset), - cpu_to_le16(a->name_offset)); - u = a->flags; - if (a->name_length) { - if (ucstos(s, (uchar_t*)((char*)a + - cpu_to_le16(a->name_offset)), - min(sizeof(s), a->name_length + 1)) == -1) { - Eprintf("Could not convert Unicode string to single " - "byte string in current locale.\n"); - strncpy(s, "Error converting Unicode string", - sizeof(s)); - - } - printf("Name = %s\n", s); - } - printf("Attribute flags = 0x%x: ", le16_to_cpu(u)); - if (!u) - printf("NONE"); - else { - int first = TRUE; - if (u & ATTR_COMPRESSION_MASK) { - if (u & ATTR_IS_COMPRESSED) { - printf("ATTR_IS_COMPRESSED"); - first = FALSE; - } - if ((u & ATTR_COMPRESSION_MASK) & ~ATTR_IS_COMPRESSED) { - if (!first) - printf(" | "); - else - first = FALSE; - printf("ATTR_UNKNOWN_COMPRESSION"); - } - } - if (u & ATTR_IS_ENCRYPTED) { - if (!first) - printf(" | "); - else - first = FALSE; - printf("ATTR_IS_ENCRYPTED"); - } - if (u & ATTR_IS_SPARSE) { - if (!first) - printf(" | "); - else - first = FALSE; - printf("ATTR_IS_SPARSE"); - } - } - printf("\n"); - printf("Attribute instance = %u\n", le16_to_cpu(a->instance)); - if (a->non_resident) { - dump_non_resident_attr(a); - } else { - dump_resident_attr(a); - } -} - -void dump_mft_record(MFT_RECORD *m) -{ - ATTR_RECORD *a; - unsigned int u; - MFT_REF r; - - printf("-- Beginning dump of mft record. --\n"); - u = le32_to_cpu(m->magic); - printf("Mft record signature (magic) = %c%c%c%c\n", u & 0xff, - u >> 8 & 0xff, u >> 16 & 0xff, u >> 24 & 0xff); - u = le16_to_cpu(m->usa_ofs); - printf("Update sequence array offset = %u (0x%x)\n", u, u); - printf("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); - printf("$LogFile sequence number (lsn) = %Lu\n", le64_to_cpu(m->lsn)); - printf("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); - printf("Reference (hard link) count = %u\n", - le16_to_cpu(m->link_count)); - u = le16_to_cpu(m->attrs_offset); - printf("First attribute offset = %u (0x%x)\n", u, u); - printf("Flags = %u: ", le16_to_cpu(m->flags)); - if (m->flags & MFT_RECORD_IN_USE) - printf("MFT_RECORD_IN_USE"); - else - printf("MFT_RECORD_NOT_IN_USE"); - if (m->flags & MFT_RECORD_IS_DIRECTORY) - printf(" | MFT_RECORD_IS_DIRECTORY"); - printf("\n"); - u = le32_to_cpu(m->bytes_in_use); - printf("Bytes in use = %u (0x%x)\n", u, u); - u = le32_to_cpu(m->bytes_allocated); - printf("Bytes allocated = %u (0x%x)\n", u, u); - r = le64_to_cpu(m->base_mft_record); - printf("Base mft record reference:\n\tMft record number = %Lu\n\t" - "Sequence number = %u\n", MREF(r), MSEQNO(r)); - printf("Next attribute instance = %u\n", - le16_to_cpu(m->next_attr_instance)); - a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); - printf("-- Beginning dump of attributes within mft record. --\n"); - while ((char*)a < (char*)m + le32_to_cpu(m->bytes_in_use)) { - dump_attr_record(a); - if (a->type == AT_END) - break; - a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); - }; - printf("-- End of attributes. --\n"); -} - -void format_mft_record(MFT_RECORD *m) -{ - ATTR_RECORD *a; - - memset(m, 0, vol->mft_record_size); - m->magic = magic_FILE; - /* Aligned to 2-byte boundary. */ - m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD) + 1) & ~1); - if (vol->mft_record_size >= NTFS_SECTOR_SIZE) - m->usa_count = cpu_to_le16(vol->mft_record_size / - NTFS_SECTOR_SIZE + 1); - else { - m->usa_count = cpu_to_le16(1); - Qprintf("Sector size is bigger than MFT record size. Setting " - "usa_count to 1. If Windows\nchkdsk reports this as " - "corruption, please email linux-ntfs-dev@lists.sf.net\n" - "stating that you saw this message and that the file " - "system created was corrupt.\nThank you."); - } - /* Set the update sequence number to 1. */ - *(u16*)((char*)m + ((sizeof(MFT_RECORD) + 1) & ~1)) = cpu_to_le16(1); - m->lsn = cpu_to_le64(0LL); - m->sequence_number = cpu_to_le16(1); - m->link_count = cpu_to_le16(0); - /* Aligned to 8-byte boundary. */ - m->attrs_offset = cpu_to_le16((le16_to_cpu(m->usa_ofs) + - (le16_to_cpu(m->usa_count) << 1) + 7) & ~7); - m->flags = cpu_to_le16(0); - /* - * Using attrs_offset plus eight bytes (for the termination attribute), - * aligned to 8-byte boundary. - */ - m->bytes_in_use = cpu_to_le32((le16_to_cpu(m->attrs_offset) + 8 + 7) & - ~7); - m->bytes_allocated = cpu_to_le32(vol->mft_record_size); - m->base_mft_record = cpu_to_le64((MFT_REF)0); - m->next_attr_instance = cpu_to_le16(0); - a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); - a->type = AT_END; - a->length = cpu_to_le32(0); -#if 0 - if (!opt.quiet && opt.verbose > 1) - dump_mft_record(m); -#endif -} - -/** - * make_room_for_attribute - make room for an attribute inside an mft record - * @m: mft record - * @pos: position at which to make space - * @size: byte size to make available at this position - * - * @pos points to the attribute in front of which we want to make space. - * - * Return 0 on success or -errno on error. Possible error codes are: - * - * -ENOSPC There is not enough space available to complete - * operation. The caller has to make space before calling - * this. - * -EINVAL Can only occur if mkntfs was compiled with -DEBUG. Means - * the input parameters were faulty. - */ -int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) -{ - u32 biu; - - if (!size) - return 0; -#ifdef DEBUG - /* - * Rigorous consistency checks. Always return -EINVAL even if more - * appropriate codes exist for simplicity of parsing the return value. - */ - if (size != ((size + 7) & ~7)) { - Eprintf("make_room_for_attribute() received non 8-byte aligned" - "size.\n"); - return -EINVAL; - } - if (!m || !pos) - return -EINVAL; - if (pos < (char*)m || pos + size < (char*)m || - pos > (char*)m + le32_to_cpu(m->bytes_allocated) || - pos + size > (char*)m + le32_to_cpu(m->bytes_allocated)) - return -EINVAL; - /* The -8 is for the attribute terminator. */ - if (pos - (char*)m > le32_to_cpu(m->bytes_in_use) - 8) - return -EINVAL; -#endif - biu = le32_to_cpu(m->bytes_in_use); - /* Do we have enough space? */ - if (biu + size > le32_to_cpu(m->bytes_allocated)) - return -ENOSPC; - /* Move everything after pos to pos + size. */ - memmove(pos + size, pos, biu - (pos - (char*)m)); - /* Update mft record. */ - m->bytes_in_use = cpu_to_le32(biu + size); - return 0; -} - -/* Return 0 on success and -errno on error. */ -int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, - const u32 new_vsize) -{ - int new_alen, new_muse; - - /* New attribute length and mft record bytes used. */ - new_alen = (le32_to_cpu(a->length) - le32_to_cpu(a->value_length) + - new_vsize + 7) & ~7; - new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + - new_alen; - /* Check for sufficient space. */ - if (new_muse > le32_to_cpu(m->bytes_allocated) ) { - // Aarrgghh! Need to make space. Probably want generic function - // for this as we need to call it from other places, too. - return -ENOTSUP; - } - /* Move attributes behind @a to their new location. */ - memmove((char*)a + new_alen, (char*)a + le32_to_cpu(a->length), - le32_to_cpu(m->bytes_in_use) - ((char*)a - (char*)m) - - le32_to_cpu(a->length)); - /* Adjust @m to reflect change in used space. */ - m->bytes_in_use = cpu_to_le32(new_muse); - /* Adjust @a to reflect new value size. */ - a->length = cpu_to_le32(new_alen); - a->value_length = cpu_to_le32(new_vsize); - return 0; -} - -void deallocate_scattered_clusters(const run_list *rl) -{ - LCN j; - int i; - - if (!rl) - return; - /* Iterate over all runs in the run list @rl. */ - for (i = 0; rl[i].length; i++) { - /* Skip sparse runs. */ - if (rl[i].lcn == -1LL) - continue; - /* Deallocate the current run. */ - for (j = rl[i].lcn; j < rl[i].lcn + rl[i].length; j++) - ntfs_set_bit(lcn_bitmap, j, 0); - } -} - -/* - * Allocate @clusters and create a run list of the allocated clusters. - * - * Return the allocated run list. Caller has to free the run list when finished - * with it. - * - * On error return NULL and errno is set to the error code. - * - * TODO: We should be returning the size as well, but for mkntfs this is not - * necessary. - */ -run_list *allocate_scattered_clusters(s64 clusters) -{ - run_list *rl = NULL, *rlt; - VCN vcn = 0LL; - LCN lcn, end, prev_lcn = 0LL; - int rlpos = 0; - int rlsize = 0; - s64 prev_run_len = 0LL; - char bit; - - end = opt.nr_clusters; - /* Loop until all clusters are allocated. */ - while (clusters) { - /* Loop in current zone until we run out of free clusters. */ - for (lcn = opt.mft_zone_end; lcn < end; lcn++) { - bit = ntfs_get_and_set_bit(lcn_bitmap, lcn, 1); - if (bit) - continue; - /* - * Reallocate memory if necessary. Make sure we have - * enough for the terminator entry as well. - */ - if ((rlpos + 2) * sizeof(run_list) >= rlsize) { - rlsize += 4096; /* PAGE_SIZE */ - rlt = realloc(rl, rlsize); - if (!rlt) - goto err_end; - rl = rlt; - } - /* Coalesce with previous run if adjacent LCNs. */ - if (prev_lcn == lcn - prev_run_len) { - rl[rlpos - 1].length = ++prev_run_len; - vcn++; - } else { - rl[rlpos].vcn = vcn++; - rl[rlpos].lcn = prev_lcn = lcn; - rl[rlpos].length = prev_run_len = 1LL; - rlpos++; - } - /* Done? */ - if (!--clusters) { - /* Add terminator element and return. */ - rl[rlpos].vcn = vcn; - rl[rlpos].lcn = rl[rlpos].length = 0LL; - return rl; - } - - } - /* Switch to next zone, decreasing mft zone by factor 2. */ - end = opt.mft_zone_end; - opt.mft_zone_end >>= 1; - /* Have we run out of space on the volume? */ - if (opt.mft_zone_end <= 0) - goto err_end; - } - return rl; -err_end: - if (rl) { - /* Add terminator element. */ - rl[rlpos].vcn = vcn; - rl[rlpos].lcn = -1LL; - rl[rlpos].length = 0LL; - /* Deallocate all allocated clusters. */ - deallocate_scattered_clusters(rl); - /* Free the run list. */ - free(rl); - } - return NULL; -} - -/* - * Create a non-resident attribute with a predefined on disk location - * specified by the run_list @rl. The clusters specified by @rl are assumed to - * be allocated already. - * - * Return 0 on success and -errno on error. - */ -int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, - const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, - const ATTR_FLAGS flags, const run_list *rl, - const char *val, const s64 val_len) -{ - ntfs_attr_search_ctx *ctx; - ATTR_RECORD *a; - u16 hdr_size; - int asize, mpa_size, err, i; - s64 bw = 0, inited_size; - VCN highest_vcn; - uchar_t *uname; -/* - if (base record) - lookup_attr(); - else -*/ - if (name_len) { - i = (name_len + 1) * sizeof(uchar_t); - uname = (uchar_t*)calloc(1, i); - if (!uname) - return -errno; - name_len = stoucs(uname, name, i); - if (name_len > 0xff) { - free(uname); - return -ENAMETOOLONG; - } - } else - uname = NULL; - /* Check if the attribute is already there. */ - ctx = ntfs_get_attr_search_ctx(NULL, m); - if (!ctx) { - Eprintf("Failed to allocate attribute search context.\n"); - err = -ENOMEM; - goto err_out; - } - if (ic == IGNORE_CASE) { - Eprintf("FIXME: Hit unimplemented code path #1.\n"); - err = -ENOTSUP; - goto err_out; - } - if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, NULL, 0, ctx)) { - err = -EEXIST; - goto err_out; - } - if (errno != ENOENT) { - Eprintf("Corrupt inode.\n"); - err = -errno; - goto err_out; - } - a = ctx->attr; - if (flags & ATTR_COMPRESSION_MASK) { - Eprintf("Compressed attributes not supported yet.\n"); - // FIXME: Compress attribute into a temporary buffer, set - // val accordingly and save the compressed size. - err = -ENOTSUP; - goto err_out; - } - if (flags & (ATTR_IS_ENCRYPTED || ATTR_IS_SPARSE)) { - Eprintf("Encrypted/sparse attributes not supported yet.\n"); - err = -ENOTSUP; - goto err_out; - } - if (flags & ATTR_COMPRESSION_MASK) { - hdr_size = 72; - // FIXME: This compression stuff is all wrong. Never mind for - // now. (AIA) - if (val_len) - mpa_size = 0; //get_size_for_compressed_mapping_pairs(rl); - else - mpa_size = 0; - } else { - hdr_size = 64; - if (val_len) { - mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl); - if (mpa_size < 0) { - err = -errno; - Eprintf("Failed to get size for mapping " - "pairs.\n"); - goto err_out; - } - } else - mpa_size = 0; - } - /* Mapping pairs array and next attribute must be 8-byte aligned. */ - asize = (((int)hdr_size + ((name_len + 7) & ~7) + mpa_size) + 7) & ~7; - /* Get the highest vcn. */ - for (i = 0, highest_vcn = 0LL; rl[i].length; i++) - highest_vcn += rl[i].length; - /* Does the value fit inside the allocated size? */ - if (highest_vcn * vol->cluster_size < val_len) { - Eprintf("BUG: Allocated size is smaller than data size!\n"); - err = -EINVAL; - goto err_out; - } - err = make_room_for_attribute(m, (char*)a, asize); - if (err == -ENOSPC) { - // FIXME: Make space! (AIA) - // can we make it non-resident? if yes, do that. - // does it fit now? yes -> do it. - // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? - // yes -> make non-resident - // does it fit now? yes -> do it. - // make all attributes non-resident - // does it fit now? yes -> do it. - // m is a base record? yes -> allocate extension record - // does the new attribute fit in there? yes -> do it. - // split up run_list into extents and place each in an extension - // record. - // FIXME: the check for needing extension records should be - // earlier on as it is very quick: asize > m->bytes_allocated? - err = -ENOTSUP; - goto err_out; - } -#ifdef DEBUG - else if (err == -EINVAL) { - fprintf(stderr, "BUG(): in insert_positioned_attribute_in_mft_" - "record(): make_room_for_attribute() returned " - "error: EINVAL!\n"); - goto err_out; - } -#endif - a->type = type; - a->length = cpu_to_le32(asize); - a->non_resident = 1; - a->name_length = name_len; - a->name_offset = cpu_to_le16(hdr_size); - a->flags = flags; - a->instance = m->next_attr_instance; - m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance) - + 1) & 0xffff); - a->lowest_vcn = cpu_to_le64(0); - a->highest_vcn = cpu_to_le64(highest_vcn - 1LL); - a->mapping_pairs_offset = cpu_to_le16(hdr_size + ((name_len + 7) & ~7)); - memset(a->reserved1, 0, sizeof(a->reserved1)); - // FIXME: Allocated size depends on compression. - a->allocated_size = cpu_to_le64(highest_vcn * vol->cluster_size); - a->data_size = cpu_to_le64(val_len); - if (name_len) - memcpy((char*)a + hdr_size, uname, name_len << 1); - if (flags & ATTR_COMPRESSION_MASK) { - if (flags & ATTR_COMPRESSION_MASK & ~ATTR_IS_COMPRESSED) { - Eprintf("Unknown compression format. Reverting to " - "standard compression.\n"); - a->flags &= ~ATTR_COMPRESSION_MASK; - a->flags |= ATTR_IS_COMPRESSED; - } - a->compression_unit = 4; - inited_size = val_len; - // FIXME: Set the compressed size. - a->compressed_size = cpu_to_le64(0); - // FIXME: Write out the compressed data. - // FIXME: err = build_mapping_pairs_compressed(); - err = -ENOTSUP; - } else { - a->compression_unit = 0; - bw = ntfs_rlwrite(vol->fd, rl, val, val_len, &inited_size); - if (bw != val_len) - Eprintf("Error writing non-resident attribute value." - "\n"); - err = ntfs_build_mapping_pairs(vol, (s8*)a + hdr_size + - ((name_len + 7) & ~7), mpa_size, rl); - } - a->initialized_size = cpu_to_le64(inited_size); - if (err < 0 || bw != val_len) { - // FIXME: Handle error. - // deallocate clusters - // remove attribute - if (err >= 0) - err = -EIO; - Eprintf("insert_positioned_attr_in_mft_record failed with " - "error %i.\n", err < 0 ? err : bw); - } -err_out: - if (ctx) - ntfs_put_attr_search_ctx(ctx); - if (uname) - free(uname); - return err; -} - -/* Return 0 on success and -errno on error. */ -int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, - const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, - const ATTR_FLAGS flags, const char *val, const s64 val_len) -{ - ntfs_attr_search_ctx *ctx; - ATTR_RECORD *a; - u16 hdr_size; - int asize, mpa_size, err, i; - run_list *rl = NULL; - s64 bw = 0; - uchar_t *uname; -/* - if (base record) - lookup_attr(); - else -*/ - if (name_len) { - i = (name_len + 1) * sizeof(uchar_t); - uname = (uchar_t*)calloc(1, i); - if (!uname) - return -errno; - name_len = stoucs(uname, name, i); - if (name_len > 0xff) { - free(uname); - return -ENAMETOOLONG; - } - } else - uname = AT_UNNAMED; - /* Check if the attribute is already there. */ - ctx = ntfs_get_attr_search_ctx(NULL, m); - if (!ctx) { - Eprintf("Failed to allocate attribute search context.\n"); - err = -ENOMEM; - goto err_out; - } - if (ic == IGNORE_CASE) { - Eprintf("FIXME: Hit unimplemented code path #2.\n"); - err = -ENOTSUP; - goto err_out; - } - if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, NULL, 0, ctx)) { - err = -EEXIST; - goto err_out; - } - if (errno != ENOENT) { - Eprintf("Corrupt inode.\n"); - err = -errno; - goto err_out; - } - a = ctx->attr; - if (flags & ATTR_COMPRESSION_MASK) { - Eprintf("Compressed attributes not supported yet.\n"); - // FIXME: Compress attribute into a temporary buffer, set - // val accordingly and save the compressed size. - err = -ENOTSUP; - goto err_out; - } - if (flags & (ATTR_IS_ENCRYPTED || ATTR_IS_SPARSE)) { - Eprintf("Encrypted/sparse attributes not supported yet.\n"); - err = -ENOTSUP; - goto err_out; - } - if (val_len) { - rl = allocate_scattered_clusters((val_len + - vol->cluster_size - 1) / vol->cluster_size); - if (!rl) { - err = -errno; - Eprintf("Failed to allocate scattered clusters: %s\n", - strerror(-err)); - goto err_out; - } - } else - rl = NULL; - if (flags & ATTR_COMPRESSION_MASK) { - hdr_size = 72; - // FIXME: This compression stuff is all wrong. Never mind for - // now. (AIA) - if (val_len) - mpa_size = 0; //get_size_for_compressed_mapping_pairs(rl); - else - mpa_size = 0; - } else { - hdr_size = 64; - if (val_len) { - mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl); - if (mpa_size < 0) { - err = -errno; - Eprintf("Failed to get size for mapping " - "pairs.\n"); - goto err_out; - } - } else - mpa_size = 0; - } - /* Mapping pairs array and next attribute must be 8-byte aligned. */ - asize = (((int)hdr_size + ((name_len + 7) & ~7) + mpa_size) + 7) & ~7; - err = make_room_for_attribute(m, (char*)a, asize); - if (err == -ENOSPC) { - // FIXME: Make space! (AIA) - // can we make it non-resident? if yes, do that. - // does it fit now? yes -> do it. - // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? - // yes -> make non-resident - // does it fit now? yes -> do it. - // make all attributes non-resident - // does it fit now? yes -> do it. - // m is a base record? yes -> allocate extension record - // does the new attribute fit in there? yes -> do it. - // split up run_list into extents and place each in an extension - // record. - // FIXME: the check for needing extension records should be - // earlier on as it is very quick: asize > m->bytes_allocated? - err = -ENOTSUP; - goto err_out; - } -#ifdef DEBUG - else if (err == -EINVAL) { - fprintf(stderr, "BUG(): in insert_non_resident_attribute_in_" - "mft_record(): make_room_for_attribute() " - "returned error: EINVAL!\n"); - goto err_out; - } -#endif - a->type = type; - a->length = cpu_to_le32(asize); - a->non_resident = 1; - a->name_length = name_len; - a->name_offset = cpu_to_le16(hdr_size); - a->flags = flags; - a->instance = m->next_attr_instance; - m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance) - + 1) & 0xffff); - a->lowest_vcn = cpu_to_le64(0); - for (i = 0; rl[i].length; i++) - ; - a->highest_vcn = cpu_to_le64(rl[i].vcn - 1); - a->mapping_pairs_offset = cpu_to_le16(hdr_size + ((name_len + 7) & ~7)); - memset(a->reserved1, 0, sizeof(a->reserved1)); - // FIXME: Allocated size depends on compression. - a->allocated_size = cpu_to_le64((val_len + (vol->cluster_size - 1)) & - ~(vol->cluster_size - 1)); - a->data_size = cpu_to_le64(val_len); - a->initialized_size = cpu_to_le64(val_len); - if (name_len) - memcpy((char*)a + hdr_size, uname, name_len << 1); - if (flags & ATTR_COMPRESSION_MASK) { - if (flags & ATTR_COMPRESSION_MASK & ~ATTR_IS_COMPRESSED) { - Eprintf("Unknown compression format. Reverting to " - "standard compression.\n"); - a->flags &= ~ATTR_COMPRESSION_MASK; - a->flags |= ATTR_IS_COMPRESSED; - } - a->compression_unit = 4; - // FIXME: Set the compressed size. - a->compressed_size = cpu_to_le64(0); - // FIXME: Write out the compressed data. - // FIXME: err = build_mapping_pairs_compressed(); - err = -ENOTSUP; - } else { - a->compression_unit = 0; - bw = ntfs_rlwrite(vol->fd, rl, val, val_len, NULL); - if (bw != val_len) - Eprintf("Error writing non-resident attribute value." - "\n"); - err = ntfs_build_mapping_pairs(vol, (s8*)a + hdr_size + - ((name_len + 7) & ~7), mpa_size, rl); - } - if (err < 0 || bw != val_len) { - // FIXME: Handle error. - // deallocate clusters - // remove attribute - if (err >= 0) - err = -EIO; - Eprintf("insert_non_resident_attr_in_mft_record failed with " - "error %i.\n", err < 0 ? err : bw); - } -err_out: - if (ctx) - ntfs_put_attr_search_ctx(ctx); - if (uname && (uname != AT_UNNAMED)) - free(uname); - if (rl) - free(rl); - return err; -} - -/* Return 0 on success and -errno on error. */ -int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, - const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, - const ATTR_FLAGS flags, const RESIDENT_ATTR_FLAGS res_flags, - const char *val, const u32 val_len) -{ - ntfs_attr_search_ctx *ctx; - ATTR_RECORD *a; - int asize, err, i; - uchar_t *uname; -/* - if (base record) - lookup_attr(); - else -*/ - if (name_len) { - i = (name_len + 1) * sizeof(uchar_t); - uname = (uchar_t*)calloc(1, i); - name_len = stoucs(uname, name, i); - if (name_len > 0xff) - return -ENAMETOOLONG; - } else - uname = AT_UNNAMED; - /* Check if the attribute is already there. */ - ctx = ntfs_get_attr_search_ctx(NULL, m); - if (!ctx) { - Eprintf("Failed to allocate attribute search context.\n"); - err = -ENOMEM; - goto err_out; - } - if (ic == IGNORE_CASE) { - Eprintf("FIXME: Hit unimplemented code path #3.\n"); - err = -ENOTSUP; - goto err_out; - } - if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, val, val_len, - ctx)) { - err = -EEXIST; - goto err_out; - } - if (errno != ENOENT) { - Eprintf("Corrupt inode.\n"); - err = -errno; - goto err_out; - } - a = ctx->attr; - /* sizeof(resident attribute record header) == 24 */ - asize = ((24 + ((name_len + 7) & ~7) + val_len) + 7) & ~7; - err = make_room_for_attribute(m, (char*)a, asize); - if (err == -ENOSPC) { - // FIXME: Make space! (AIA) - // can we make it non-resident? if yes, do that. - // does it fit now? yes -> do it. - // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? - // yes -> make non-resident - // does it fit now? yes -> do it. - // make all attributes non-resident - // does it fit now? yes -> do it. - // m is a base record? yes -> allocate extension record - // does the new attribute fit in there? yes -> do it. - // split up run_list into extents and place each in an extension - // record. - // FIXME: the check for needing extension records should be - // earlier on as it is very quick: asize > m->bytes_allocated? - err = -ENOTSUP; - goto err_out; - } -#ifdef DEBUG - if (err == -EINVAL) { - fprintf(stderr, "BUG(): in insert_resident_attribute_in_mft_" - "record(): make_room_for_attribute() returned " - "error: EINVAL!\n"); - goto err_out; - } -#endif - a->type = type; - a->length = cpu_to_le32(asize); - a->non_resident = 0; - a->name_length = name_len; - a->name_offset = cpu_to_le16(24); - a->flags = cpu_to_le16(flags); - a->instance = m->next_attr_instance; - m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance) - + 1) & 0xffff); - a->value_length = cpu_to_le32(val_len); - a->value_offset = cpu_to_le16(24 + ((name_len + 7) & ~7)); - a->resident_flags = res_flags; - a->reservedR = 0; - if (name_len) - memcpy((char*)a + 24, uname, name_len << 1); - if (val_len) - memcpy((char*)a + le16_to_cpu(a->value_offset), val, val_len); -err_out: - if (ctx) - ntfs_put_attr_search_ctx(ctx); - if (uname && (uname != AT_UNNAMED)) - free(uname); - return err; -} - -s64 time2ntfs(s64 time) -{ - return cpu_to_le64((time + (s64)(369 * 365 + 89) * 24 * 3600) - * 10000000); -} - -/* Return 0 on success or -errno on error. */ -int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) -{ - STANDARD_INFORMATION si; - int err; - - si.creation_time = time2ntfs(time(NULL)); - si.last_data_change_time = si.creation_time; - si.last_mft_change_time = si.creation_time; - si.last_access_time = si.creation_time; - si.file_attributes = flags; /* already LE */ - if (vol->major_ver < 3) - memset(&si.reserved12, 0, sizeof(si.reserved12)); - else { - si.maximum_versions = cpu_to_le32(0); - si.version_number = cpu_to_le32(0); - si.class_id = cpu_to_le32(0); - /* FIXME: $Secure support... */ - si.security_id = cpu_to_le32(0); - /* FIXME: $Quota support... */ - si.owner_id = cpu_to_le32(0); - si.quota_charged = cpu_to_le64(0ULL); - /* FIXME: $UsnJrnl support... */ - si.usn = cpu_to_le64(0ULL); - } - /* NTFS 1.2: size of si = 48, NTFS 3.0: size of si = 72 */ - err = insert_resident_attr_in_mft_record(m, AT_STANDARD_INFORMATION, - NULL, 0, 0, 0, 0, (char*)&si, - vol->major_ver < 3 ? 48 : 72); - if (err < 0) - Eprintf("add_attr_std_info failed: %s\n", strerror(-err)); - return err; -} - -/* Return 0 on success or -errno on error. */ -int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, - const s64 allocated_size, const s64 data_size, - const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, - const u32 reparse_point_tag, const char *file_name, - const FILE_NAME_TYPE_FLAGS file_name_type) -{ - ntfs_attr_search_ctx *ctx; - STANDARD_INFORMATION *si; - FILE_NAME_ATTR *fn; - int i, fn_size; - - /* Check if the attribute is already there. */ - ctx = ntfs_get_attr_search_ctx(NULL, m); - if (!ctx) { - Eprintf("Failed to allocate attribute search context.\n"); - return -ENOMEM; - } - if (ntfs_lookup_attr(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, - ctx)) { - int eo = errno; - Eprintf("BUG: Standard information attribute not present in " - "file record\n"); - ntfs_put_attr_search_ctx(ctx); - return -eo; - } - si = (STANDARD_INFORMATION*)((char*)ctx->attr + - le16_to_cpu(ctx->attr->value_offset)); - i = (strlen(file_name) + 1) * sizeof(uchar_t); - fn_size = sizeof(FILE_NAME_ATTR) + i; - fn = (FILE_NAME_ATTR*)malloc(fn_size); - if (!fn) { - ntfs_put_attr_search_ctx(ctx); - return -errno; - } - fn->parent_directory = parent_dir; - - fn->creation_time = si->creation_time; - fn->last_data_change_time = si->last_data_change_time; - fn->last_mft_change_time = si->last_mft_change_time; - fn->last_access_time = si->last_access_time; - ntfs_put_attr_search_ctx(ctx); - - fn->allocated_size = cpu_to_le64(allocated_size); - fn->data_size = cpu_to_le64(data_size); - fn->file_attributes = flags; - /* These are in a union so can't have both. */ - if (packed_ea_size && reparse_point_tag) { - free(fn); - return -EINVAL; - } - if (packed_ea_size) { - fn->packed_ea_size = cpu_to_le16(packed_ea_size); - fn->reserved = cpu_to_le16(0); - } else - fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); - fn->file_name_type = file_name_type; - i = stoucs(fn->file_name, file_name, i); - if (i < 1) { - free(fn); - return -EINVAL; - } - if (i > 0xff) { - free(fn); - return -ENAMETOOLONG; - } - /* No terminating null in file names. */ - fn->file_name_length = i; - fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(uchar_t); - i = insert_resident_attr_in_mft_record(m, AT_FILE_NAME, NULL, 0, 0, - 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size); - free(fn); - if (i < 0) - Eprintf("add_attr_file_name failed: %s\n", strerror(-i)); - return i; -} - -/* - * Create the security descriptor attribute adding the security descriptor @sd - * of length @sd_len to the mft record @m. - * - * Return 0 on success or -errno on error. - */ -int add_attr_sd(MFT_RECORD *m, const char *sd, const s64 sd_len) -{ - int err; - - /* Does it fit? NO: create non-resident. YES: create resident. */ - if (le32_to_cpu(m->bytes_in_use) + 24 + sd_len > - le32_to_cpu(m->bytes_allocated)) - err = insert_non_resident_attr_in_mft_record(m, - AT_SECURITY_DESCRIPTOR, NULL, 0, 0, 0, sd, - sd_len); - else - err = insert_resident_attr_in_mft_record(m, - AT_SECURITY_DESCRIPTOR, NULL, 0, 0, 0, 0, sd, - sd_len); - if (err < 0) - Eprintf("add_attr_sd failed: %s\n", strerror(-err)); - return err; -} - -/* Return 0 on success or -errno on error. */ -int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, - const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, - const char *val, const s64 val_len) -{ - int err; - - /* - * Does it fit? NO: create non-resident. YES: create resident. - * - * FIXME: Introduced arbitrary limit of mft record allocated size - 512. - * This is to get around the problem that if $Bitmap/$DATA becomes too - * big, but is just small enough to be resident, we would make it - * resident, and later run out of space when creating the other - * attributes and this would cause us to abort as making resident - * attributes non-resident is not supported yet. - * The proper fix is to support making resident attribute non-resident. - */ - if (le32_to_cpu(m->bytes_in_use) + 24 + val_len > - min(le32_to_cpu(m->bytes_allocated), - le32_to_cpu(m->bytes_allocated) - 512)) - err = insert_non_resident_attr_in_mft_record(m, AT_DATA, name, - name_len, ic, flags, val, val_len); - else - err = insert_resident_attr_in_mft_record(m, AT_DATA, name, - name_len, ic, flags, 0, val, val_len); - - if (err < 0) - Eprintf("add_attr_data failed: %s\n", strerror(-err)); - return err; -} - -/* - * Create a non-resident data attribute with a predefined on disk location - * specified by the run_list @rl. The clusters specified by @rl are assumed to - * be allocated already. - * - * Return 0 on success or -errno on error. - */ -int add_attr_data_positioned(MFT_RECORD *m, const char *name, - const u32 name_len, const IGNORE_CASE_BOOL ic, - const ATTR_FLAGS flags, const run_list *rl, - const char *val, const s64 val_len) -{ - int err; - - err = insert_positioned_attr_in_mft_record(m, AT_DATA, name, name_len, - ic, flags, rl, val, val_len); - if (err < 0) - Eprintf("add_attr_data_positioned failed: %s\n", - strerror(-err)); - return err; -} - -/* - * Create volume name attribute specifying the volume name @vol_name as a null - * terminated char string of length @vol_name_len (number of characters not - * including the terminating null), which is converted internally to a little - * endian uchar_t string. The name is at least 1 character long and at most - * 0xff characters long (not counting the terminating null). - * - * Return 0 on success or -errno on error. - */ -int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, - const int vol_name_len) -{ - uchar_t *uname; - int i, len; - - if (vol_name_len) { - len = (vol_name_len + 1) * sizeof(uchar_t); - uname = calloc(1, len); - if (!uname) - return -errno; - i = (stoucs(uname, vol_name, len) + 1) * sizeof(uchar_t); - if (!i) { - free(uname); - return -EINVAL; - } - if (i > 0xff) { - free(uname); - return -ENAMETOOLONG; - } - } else { - uname = NULL; - len = 0; - } - i = insert_resident_attr_in_mft_record(m, AT_VOLUME_NAME, NULL, 0, 0, - 0, 0, (char*)uname, len); - if (uname) - free(uname); - if (i < 0) - Eprintf("add_attr_vol_name failed: %s\n", strerror(-i)); - return i; -} - -/* Return 0 on success or -errno on error. */ -int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags, - const u8 major_ver, const u8 minor_ver) -{ - VOLUME_INFORMATION vi; - int err; - - memset(&vi, 0, sizeof(vi)); - vi.major_ver = major_ver; - vi.minor_ver = minor_ver; - vi.flags = flags & VOLUME_FLAGS_MASK; - err = insert_resident_attr_in_mft_record(m, AT_VOLUME_INFORMATION, NULL, - 0, 0, 0, 0, (char*)&vi, sizeof(vi)); - if (err < 0) - Eprintf("add_attr_vol_info failed: %s\n", strerror(-err)); - return err; -} - -/* Return 0 on success or -errno on error. */ -int add_attr_index_root(MFT_RECORD *m, const char *name, const u32 name_len, - const IGNORE_CASE_BOOL ic, const ATTR_TYPES indexed_attr_type, - const COLLATION_RULES collation_rule, - const u32 index_block_size) -{ - INDEX_ROOT *r; - INDEX_ENTRY_HEADER *e; - int err, val_len; - - val_len = sizeof(INDEX_ROOT) + sizeof(INDEX_ENTRY_HEADER); - r = (INDEX_ROOT*)malloc(val_len); - if (!r) - return -errno; - r->type = indexed_attr_type == AT_FILE_NAME ? AT_FILE_NAME : 0; - if (indexed_attr_type == AT_FILE_NAME && - collation_rule != COLLATION_FILE_NAME) { - free(r); - Eprintf("add_attr_index_root: indexed attribute is $FILE_NAME " - "but collation rule is not COLLATION_FILE_NAME.\n"); - return -EINVAL; - } - r->collation_rule = collation_rule; - r->index_block_size = cpu_to_le32(index_block_size); - if (index_block_size >= vol->cluster_size) { - if (index_block_size % vol->cluster_size) { - Eprintf("add_attr_index_root: index block size is not " - "a multiple of the cluster size.\n"); - free(r); - return -EINVAL; - } - r->clusters_per_index_block = index_block_size / - vol->cluster_size; - } else /* if (vol->cluster_size > index_block_size) */ { - if (index_block_size & (index_block_size - 1)) { - Eprintf("add_attr_index_root: index block size is not " - "a power of 2.\n"); - free(r); - return -EINVAL; - } - if (index_block_size < opt.sector_size) { - Eprintf("add_attr_index_root: index block size is " - "smaller than the sector size.\n"); - free(r); - return -EINVAL; - } - r->clusters_per_index_block = index_block_size / - opt.sector_size; - } - memset(&r->reserved, 0, sizeof(r->reserved)); - r->index.entries_offset = cpu_to_le32(sizeof(INDEX_HEADER)); - r->index.index_length = cpu_to_le32(sizeof(INDEX_HEADER) + - sizeof(INDEX_ENTRY_HEADER)); - r->index.allocated_size = r->index.index_length; - r->index.flags = SMALL_INDEX; - memset(&r->index.reserved, 0, sizeof(r->index.reserved)); - e = (INDEX_ENTRY_HEADER*)((char*)&r->index + - le32_to_cpu(r->index.entries_offset)); - /* - * No matter whether this is a file index or a view as this is a - * termination entry, hence no key value / data is associated with it - * at all. Thus, we just need the union to be all zero. - */ - e->indexed_file = cpu_to_le64(0LL); - e->length = cpu_to_le16(sizeof(INDEX_ENTRY_HEADER)); - e->key_length = cpu_to_le16(0); - e->flags = INDEX_ENTRY_END; - e->reserved = cpu_to_le16(0); - err = insert_resident_attr_in_mft_record(m, AT_INDEX_ROOT, name, - name_len, ic, 0, 0, (char*)r, val_len); - free(r); - if (err < 0) - Eprintf("add_attr_index_root failed: %s\n", strerror(-err)); - return err; -} - -/* Return 0 on success or -errno on error. */ -int add_attr_index_alloc(MFT_RECORD *m, const char *name, const u32 name_len, - const IGNORE_CASE_BOOL ic, const char *index_alloc_val, - const u32 index_alloc_val_len) -{ - int err; - - err = insert_non_resident_attr_in_mft_record(m, AT_INDEX_ALLOCATION, - name, name_len, ic, 0, index_alloc_val, - index_alloc_val_len); - if (err < 0) - Eprintf("add_attr_index_alloc failed: %s\n", strerror(-err)); - return err; -} - -/* Return 0 on success or -errno on error. */ -int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, - const IGNORE_CASE_BOOL ic, const char *bitmap, - const u32 bitmap_len) -{ - int err; - - /* Does it fit? NO: create non-resident. YES: create resident. */ - if (le32_to_cpu(m->bytes_in_use) + 24 + bitmap_len > - le32_to_cpu(m->bytes_allocated)) - err = insert_non_resident_attr_in_mft_record(m, AT_BITMAP, name, - name_len, ic, 0, bitmap, bitmap_len); - else - err = insert_resident_attr_in_mft_record(m, AT_BITMAP, name, - name_len, ic, 0, 0, bitmap, bitmap_len); - - if (err < 0) - Eprintf("add_attr_bitmap failed: %s\n", strerror(-err)); - return err; -} - -/* - * Create a non-resident bitmap attribute with a predefined on disk location - * specified by the run_list @rl. The clusters specified by @rl are assumed to - * be allocated already. - * - * Return 0 on success or -errno on error. - */ -int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, - const u32 name_len, const IGNORE_CASE_BOOL ic, - const run_list *rl, const char *bitmap, const u32 bitmap_len) -{ - int err; - - err = insert_positioned_attr_in_mft_record(m, AT_BITMAP, name, name_len, - ic, 0, rl, bitmap, bitmap_len); - if (err < 0) - Eprintf("add_attr_bitmap_positioned failed: %s\n", - strerror(-err)); - return err; -} - -/* - * Create bitmap and index allocation attributes, modify index root - * attribute accordingly and move all of the index entries from the index root - * into the index allocation. - * - * Return 0 on success or -errno on error. - */ -int upgrade_to_large_index(MFT_RECORD *m, const char *name, - u32 name_len, const IGNORE_CASE_BOOL ic, - INDEX_ALLOCATION **index) -{ - ntfs_attr_search_ctx *ctx; - ATTR_RECORD *a; - INDEX_ROOT *r; - INDEX_ENTRY *re; - INDEX_ALLOCATION *ia_val = NULL; - uchar_t *uname; - char bmp[8]; - char *re_start, *re_end; - int i, err, index_block_size; - - if (name_len) { - i = (name_len + 1) * sizeof(uchar_t); - uname = (uchar_t*)calloc(1, i); - if (!uname) - return -errno; - name_len = stoucs(uname, name, i); - if (name_len > 0xff) { - free(uname); - return -ENAMETOOLONG; - } - } else - uname = NULL; - /* Find the index root attribute. */ - ctx = ntfs_get_attr_search_ctx(NULL, m); - if (!ctx) { - Eprintf("Failed to allocate attribute search context.\n"); - return -ENOMEM; - } - if (ic == IGNORE_CASE) { - Eprintf("FIXME: Hit unimplemented code path #4.\n"); - err = -ENOTSUP; - goto err_out; - } - err = ntfs_lookup_attr(AT_INDEX_ROOT, uname, name_len, ic, 0, NULL, 0, - ctx); - if (uname) - free(uname); - if (err) { - err = -ENOTDIR; - goto err_out; - } - a = ctx->attr; - if (a->non_resident || a->flags) { - err = -EINVAL; - goto err_out; - } - r = (INDEX_ROOT*)((char*)a + le16_to_cpu(a->value_offset)); - re_end = (char*)r + le32_to_cpu(a->value_length); - re_start = (char*)&r->index + le32_to_cpu(r->index.entries_offset); - re = (INDEX_ENTRY*)re_start; - index_block_size = le32_to_cpu(r->index_block_size); - memset(bmp, 0, sizeof(bmp)); - ntfs_set_bit(bmp, 0ULL, 1); - /* Bitmap has to be at least 8 bytes in size. */ - err = add_attr_bitmap(m, name, name_len, ic, (char*)&bmp, sizeof(bmp)); - if (err) - goto err_out; - ia_val = calloc(1, index_block_size); - if (!ia_val) { - err = -errno; - goto err_out; - } - /* Setup header. */ - ia_val->magic = magic_INDX; - ia_val->usa_ofs = cpu_to_le16(sizeof(INDEX_ALLOCATION)); - if (index_block_size >= NTFS_SECTOR_SIZE) - ia_val->usa_count = cpu_to_le16(index_block_size / - NTFS_SECTOR_SIZE + 1); - else { - ia_val->usa_count = cpu_to_le16(1); - Qprintf("Sector size is bigger than index block size. Setting " - "usa_count to 1. If Windows\nchkdsk reports this as " - "corruption, please email linux-ntfs-dev@lists.sf.net\n" - "stating that you saw this message and that the file " - "system created was corrupt.\nThank you."); - } - /* Set USN to 1. */ - *(u16*)((char*)ia_val + le16_to_cpu(ia_val->usa_ofs)) = - cpu_to_le16(1); - ia_val->lsn = cpu_to_le64(0); - ia_val->index_block_vcn = cpu_to_le64(0); - ia_val->index.flags = LEAF_NODE; - /* Align to 8-byte boundary. */ - ia_val->index.entries_offset = cpu_to_le32((sizeof(INDEX_HEADER) + - le16_to_cpu(ia_val->usa_count) * 2 + 7) & ~7); - ia_val->index.allocated_size = cpu_to_le32(index_block_size - - (sizeof(INDEX_ALLOCATION) - sizeof(INDEX_HEADER))); - /* Find the last entry in the index root and save it in re. */ - while ((char*)re < re_end && !(re->flags & INDEX_ENTRY_END)) { - /* Next entry in index root. */ - re = (INDEX_ENTRY*)((char*)re + le16_to_cpu(re->length)); - } - /* Copy all the entries including the termination entry. */ - i = (char*)re - re_start + le16_to_cpu(re->length); - memcpy((char*)&ia_val->index + - le32_to_cpu(ia_val->index.entries_offset), re_start, i); - /* Finish setting up index allocation. */ - ia_val->index.index_length = cpu_to_le32(i + - le32_to_cpu(ia_val->index.entries_offset)); - /* Move the termination entry forward to the beginning if necessary. */ - if ((char*)re > re_start) { - memmove(re_start, (char*)re, le16_to_cpu(re->length)); - re = (INDEX_ENTRY*)re_start; - } - /* Now fixup empty index root with pointer to index allocation VCN 0. */ - r->index.flags = LARGE_INDEX; - re->flags |= INDEX_ENTRY_NODE; - if (le16_to_cpu(re->length) < sizeof(INDEX_ENTRY_HEADER) + sizeof(VCN)) - re->length = cpu_to_le16(le16_to_cpu(re->length) + sizeof(VCN)); - r->index.index_length = cpu_to_le32(le32_to_cpu(r->index.entries_offset) - + le16_to_cpu(re->length)); - r->index.allocated_size = r->index.index_length; - /* Resize index root attribute. */ - err = resize_resident_attribute_value(m, a, sizeof(INDEX_ROOT) - - sizeof(INDEX_HEADER) + - le32_to_cpu(r->index.allocated_size)); - if (err) { - // TODO: Remove the added bitmap! - // Revert index root from index allocation. - goto err_out; - } - /* Set VCN pointer to 0LL. */ - *(VCN*)((char*)re + cpu_to_le16(re->length) - sizeof(VCN)) = - cpu_to_le64(0); - err = ntfs_pre_write_mst_fixup((NTFS_RECORD*)ia_val, index_block_size); - if (err) { - err = -errno; - Eprintf("ntfs_pre_write_mst_fixup() failed in " - "upgrade_to_large_index.\n"); - goto err_out; - } - err = add_attr_index_alloc(m, name, name_len, ic, (char*)ia_val, - index_block_size); - ntfs_post_write_mst_fixup((NTFS_RECORD*)ia_val); - if (err) { - // TODO: Remove the added bitmap! - // Revert index root from index allocation. - goto err_out; - } - *index = ia_val; - return 0; -err_out: - if (ctx) - ntfs_put_attr_search_ctx(ctx); - if (ia_val) - free(ia_val); - return err; -} - -/* - * Create space of @size bytes at position @pos inside the index block @index. - * - * Return 0 on success or -errno on error. - */ -int make_room_for_index_entry_in_index_block(INDEX_BLOCK *index, - INDEX_ENTRY *pos, u32 size) -{ - u32 biu; - - if (!size) - return 0; -#ifdef DEBUG - /* - * Rigorous consistency checks. Always return -EINVAL even if more - * appropriate codes exist for simplicity of parsing the return value. - */ - if (size != ((size + 7) & ~7)) { - Eprintf("make_room_for_index_entry_in_index_block() received " - "non 8-byte aligned size.\n"); - return -EINVAL; - } - if (!index || !pos) - return -EINVAL; - if ((char*)pos < (char*)index || (char*)pos + size < (char*)index || - (char*)pos > (char*)index + sizeof(INDEX_BLOCK) - - sizeof(INDEX_HEADER) + - le32_to_cpu(index->index.allocated_size) || - (char*)pos + size > (char*)index + sizeof(INDEX_BLOCK) - - sizeof(INDEX_HEADER) + - le32_to_cpu(index->index.allocated_size)) - return -EINVAL; - /* The - sizeof(INDEX_ENTRY_HEADER) is for the index terminator. */ - if ((char*)pos - (char*)&index->index > - le32_to_cpu(index->index.index_length) - - sizeof(INDEX_ENTRY_HEADER)) - return -EINVAL; -#endif - biu = le32_to_cpu(index->index.index_length); - /* Do we have enough space? */ - if (biu + size > le32_to_cpu(index->index.allocated_size)) - return -ENOSPC; - /* Move everything after pos to pos + size. */ - memmove((char*)pos + size, (char*)pos, biu - ((char*)pos - - (char*)&index->index)); - /* Update index block. */ - index->index.index_length = cpu_to_le32(biu + size); - return 0; -} - -/* - * Insert the fully completed FILE_NAME_ATTR @file_name which is inside - * the file with mft reference @file_ref into the index (allocation) block - * @index (which belongs to @file_ref's parent directory). - * - * Return 0 on success or -errno on error. - */ -int insert_file_link_in_dir_index(INDEX_BLOCK *index, MFT_REF file_ref, - FILE_NAME_ATTR *file_name, u32 file_name_size) -{ - int err, i; - INDEX_ENTRY *ie; - char *index_end; - - /* - * Lookup dir entry @file_name in dir @index to determine correct - * insertion location. FIXME: Using a very oversimplified lookup - * method which is sufficient for mkntfs but no good whatsoever in - * real world scenario. (AIA) - */ - index_end = (char*)&index->index + - le32_to_cpu(index->index.index_length); - ie = (INDEX_ENTRY*)((char*)&index->index + - le32_to_cpu(index->index.entries_offset)); - /* - * Loop until we exceed valid memory (corruption case) or until we - * reach the last entry. - */ - while ((char*)ie < index_end && !(ie->flags & INDEX_ENTRY_END)) { -/* -#ifdef DEBUG - Dprintf("file_name_attr1->file_name_length = %i\n", - file_name->file_name_length); - if (file_name->file_name_length) { - char *__buf; - __buf = (char*)calloc(1, file_name->file_name_length + - 1); - if (!__buf) - err_exit("Failed to allocate internal buffer: " - "%s\n", strerror(errno)); - i = ucstos(__buf, (uchar_t*)&file_name->file_name, - file_name->file_name_length + 1); - if (i == -1) - Dprintf("Name contains non-displayable " - "Unicode characters.\n"); - Dprintf("file_name_attr1->file_name = %s\n", __buf); - free(__buf); - } - Dprintf("file_name_attr2->file_name_length = %i\n", - ie->key.file_name.file_name_length); - if (ie->key.file_name.file_name_length) { - char *__buf; - __buf = (char*)calloc(1, - ie->key.file_name.file_name_length + 1); - if (!__buf) - err_exit("Failed to allocate internal buffer: " - "%s\n", strerror(errno)); - i = ucstos(__buf, ie->key.file_name.file_name, - ie->key.file_name.file_name_length + 1); - if (i == -1) - Dprintf("Name contains non-displayable " - "Unicode characters.\n"); - Dprintf("file_name_attr2->file_name = %s\n", __buf); - free(__buf); - } -#endif -*/ - i = ntfs_file_compare_values(file_name, - (FILE_NAME_ATTR*)&ie->key.file_name, 1, - IGNORE_CASE, vol->upcase, vol->upcase_len); - /* - * If @file_name collates before ie->key.file_name, there is no - * matching index entry. - */ - if (i == -1) - break; - /* If file names are not equal, continue search. */ - if (i) - goto do_next; - /* File names are equal when compared ignoring case. */ - /* - * If BOTH file names are in the POSIX namespace, do a case - * sensitive comparison as well. Otherwise the names match so - * we return -EEXIST. FIXME: There are problems with this in a - * real world scenario, when one is POSIX and one isn't, but - * fine for mkntfs where we don't use POSIX namespace at all - * and hence this following code is luxury. (AIA) - */ - if (file_name->file_name_type != FILE_NAME_POSIX || - ie->key.file_name.file_name_type != FILE_NAME_POSIX) - return -EEXIST; - i = ntfs_file_compare_values(file_name, - (FILE_NAME_ATTR*)&ie->key.file_name, 1, - CASE_SENSITIVE, vol->upcase, vol->upcase_len); - if (i == -1) - break; - /* Complete match. Bugger. Can't insert. */ - if (!i) - return -EEXIST; -do_next: -#ifdef DEBUG - /* Next entry. */ - if (!ie->length) { - Dprintf("BUG: ie->length is zero, breaking out of " - "loop.\n"); - break; - } -#endif - ie = (INDEX_ENTRY*)((char*)ie + le16_to_cpu(ie->length)); - }; - i = (sizeof(INDEX_ENTRY_HEADER) + file_name_size + 7) & ~7; - err = make_room_for_index_entry_in_index_block(index, ie, i); - if (err) { - Eprintf("make_room_for_index_entry_in_index_block failed: " - "%s\n", strerror(-err)); - return err; - } - /* Create entry in place and copy file name attribute value. */ - ie->indexed_file = file_ref; - ie->length = cpu_to_le16(i); - ie->key_length = cpu_to_le16(file_name_size); - ie->flags = cpu_to_le16(0); - ie->reserved = cpu_to_le16(0); - memcpy((char*)&ie->key.file_name, (char*)file_name, file_name_size); - return 0; -} - -/* - * Create a file_name_attribute in the mft record @m_file which points to the - * parent directory with mft reference @ref_parent. - * - * Then, insert an index entry with this file_name_attribute in the index - * block @index of the index allocation attribute of the parent directory. - * - * @ref_file is the mft reference of @m_file. - * - * Return 0 on success or -errno on error. - */ -int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, - MFT_RECORD *m_file, const MFT_REF ref_file, - const s64 allocated_size, const s64 data_size, - const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, - const u32 reparse_point_tag, const char *file_name, - const FILE_NAME_TYPE_FLAGS file_name_type) -{ - FILE_NAME_ATTR *fn; - int i, fn_size; - - /* Create the file_name attribute. */ - i = (strlen(file_name) + 1) * sizeof(uchar_t); - fn_size = sizeof(FILE_NAME_ATTR) + i; - fn = (FILE_NAME_ATTR*)malloc(fn_size); - if (!fn) - return -errno; - fn->parent_directory = ref_parent; - // FIXME: Is this correct? Or do we have to copy the creation_time - // from the std info? - fn->creation_time = time2ntfs(time(NULL)); - fn->last_data_change_time = fn->creation_time; - fn->last_mft_change_time = fn->creation_time; - fn->last_access_time = fn->creation_time; - fn->allocated_size = cpu_to_le64(allocated_size); - fn->data_size = cpu_to_le64(data_size); - fn->file_attributes = flags; - /* These are in a union so can't have both. */ - if (packed_ea_size && reparse_point_tag) { - free(fn); - return -EINVAL; - } - if (packed_ea_size) { - fn->packed_ea_size = cpu_to_le16(packed_ea_size); - fn->reserved = cpu_to_le16(0); - } else - fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); - fn->file_name_type = file_name_type; - i = stoucs(fn->file_name, file_name, i); - if (i < 1) { - free(fn); - return -EINVAL; - } - if (i > 0xff) { - free(fn); - return -ENAMETOOLONG; - } - /* No terminating null in file names. */ - fn->file_name_length = i; - fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(uchar_t); - /* Increment the link count of @m_file. */ - i = le16_to_cpu(m_file->link_count); - if (i == 0xffff) { - Eprintf("Too many hardlinks present already.\n"); - free(fn); - return -EINVAL; - } - m_file->link_count = cpu_to_le16(i + 1); - /* Add the file_name to @m_file. */ - i = insert_resident_attr_in_mft_record(m_file, AT_FILE_NAME, NULL, 0, 0, - 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size); - if (i < 0) { - Eprintf("create_hardlink failed adding file name attribute: " - "%s\n", strerror(-i)); - free(fn); - /* Undo link count increment. */ - m_file->link_count = cpu_to_le16( - le16_to_cpu(m_file->link_count) - 1); - return i; - } - /* Insert the index entry for file_name in @index. */ - i = insert_file_link_in_dir_index(index, ref_file, fn, fn_size); - if (i < 0) { - Eprintf("create_hardlink failed inserting index entry: %s\n", - strerror(-i)); - /* FIXME: Remove the file name attribute from @m_file. */ - free(fn); - /* Undo link count increment. */ - m_file->link_count = cpu_to_le16( - le16_to_cpu(m_file->link_count) - 1); - return i; - } - free(fn); - return 0; -} - -void init_options() -{ - memset(&opt, 0, sizeof(opt)); - opt.index_block_size = 4096; - opt.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; - opt.attr_defs_len = sizeof(attrdef_ntfs12_array); - //Dprintf("Attr_defs table length = %u\n", opt.attr_defs_len); -} - -void usage(void) __attribute__ ((noreturn)); - -void usage(void) -{ - fprintf(stderr, "Copyright (c) 2001,2002 Anton Altaparmakov.\n" - "Create an NTFS volume on a user specified (block) device.\n" - "Usage: %s [-s sector-size] [-c cluster-size] " - "[-L volume-label]\n\t[-z mft-zone-multiplier] " - "[-fnqvvCFIQV] device [number-of-sectors]\n", - EXEC_NAME); - exit(1); -} - -void parse_options(int argc, char *argv[]) -{ - int c; - long l; - unsigned long u; - char *s; - -// Need to have: mft record size, index record size, ntfs version, mft size, -// logfile size, list of bad blocks, check for bad blocks, ... - if (argc && *argv) - EXEC_NAME = *argv; - fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); - while ((c = getopt(argc, argv, "c:fnqs:vz:CFIL:QV")) != EOF) - switch (c) { - case 'n': - opt.no_action = 1; - break; - case 'c': - l = strtol(optarg, &s, 0); - if (!l || l > INT_MAX || *s) - err_exit("Invalid cluster size.\n"); - vol->cluster_size = l; - break; - case 'f': - case 'Q': - opt.quick_format = 1; - break; - case 'q': - opt.quiet = 1; - break; - case 's': - l = strtol(optarg, &s, 0); - if (!l || l > INT_MAX || *s) - err_exit("Invalid sector size.\n"); - opt.sector_size = l; - break; - case 'v': - opt.verbose++; - break; - case 'z': - l = strtol(optarg, &s, 0); - if (l < 1 || l > 4 || *s) - err_exit("Invalid MFT zone multiplier.\n"); - opt.mft_zone_multiplier = l; - break; - case 'C': - opt.enable_compression = 1; - break; - case 'F': - opt.force = 1; - break; - case 'I': - opt.disable_indexing = 1; - break; - case 'L': - vol->vol_name = optarg; - break; - case 'V': - /* Version number already printed, so just exit. */ - exit(0); - default: - usage(); - } - if (optind == argc) - usage(); - vol->dev_name = argv[optind++]; - if (optind < argc) { - u = strtoul(argv[optind++], &s, 0); - if (*s || !u || (u >= ULONG_MAX && errno == ERANGE)) - err_exit("Invalid number of sectors: %s\n", - argv[optind - 1]); - opt.nr_sectors = u; - } - if (optind < argc) - usage(); -} - -void mkntfs_exit(void) -{ - int err; - - if (index_block) - free(index_block); - if (buf) - free(buf); - if (buf2) - free(buf2); - if (lcn_bitmap) - free(lcn_bitmap); - if (mft_bitmap) - free(mft_bitmap); - if (rl) - free(rl); - if (rl_mft) - free(rl_mft); - if (rl_mft_bmp) - free(rl_mft_bmp); - if (rl_mftmirr) - free(rl_mftmirr); - if (rl_logfile) - free(rl_logfile); - if (rl_boot) - free(rl_boot); - if (rl_bad) - free(rl_bad); - if (rl_index) - free(rl_index); - if (opt.bad_blocks) - free(opt.bad_blocks); - if (opt.attr_defs != (ATTR_DEF*)attrdef_ntfs12_array) - free(opt.attr_defs); - if (vol->upcase) - free(vol->upcase); - flk.l_type = F_UNLCK; - err = fcntl(vol->fd, F_SETLK, &flk); - if (err == -1) - Eprintf("Warning: Could not unlock %s: %s\n", vol->dev_name, - strerror(errno)); - err = close(vol->fd); - if (err == -1) - Eprintf("Warning: Could not close %s: %s\n", vol->dev_name, - strerror(errno)); - if (vol) - free(vol); -} - -#define MAKE_MFT_REF(_ref, _seqno) cpu_to_le64((((u64)(_seqno)) << 48) \ - | ((u64)(_ref))) - -static inline int valid_offset(int f, long long ofs) -{ - char ch; - - if (lseek(f, ofs, SEEK_SET) >= 0 && read(f, &ch, 1) == 1) - return 1; - return 0; -} - -/* - * Returns the number of bs sized blocks in a partition. Adapted from - * e2fsutils-1.19, Copyright (C) 1995 Theodore Ts'o. - */ -long long get_device_size(int f, int bs) -{ - long long high, low; -#ifdef BLKGETSIZE - long size; - - if (ioctl(f, BLKGETSIZE, &size) >= 0) { - Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, - size); - return (long long)size * 512 / bs; - } -#endif -#ifdef FDGETPRM - { struct floppy_struct this_floppy; - - if (ioctl(f, FDGETPRM, &this_floppy) >= 0) { - Dprintf("FDGETPRM nr 512 byte blocks = %ld (0x%ld)\n", - this_floppy.size, this_floppy.size); - return (long long)this_floppy.size * 512 / bs; - } - } -#endif - /* - * We couldn't figure it out by using a specialized ioctl, - * so do binary search to find the size of the partition. - */ - low = 0LL; - for (high = 1024LL; valid_offset(f, high); high <<= 1) - low = high; - while (low < high - 1LL) { - const long long mid = (low + high) / 2; - - if (valid_offset(f, mid)) - low = mid; - else - high = mid; - } - lseek(f, 0LL, SEEK_SET); - return (low + 1LL) / bs; -} - -int main(int argc, char **argv) -{ - int i, j, err; - ssize_t bw; - struct stat sbuf; - long long lw, pos; - MFT_RECORD *m; - ATTR_RECORD *a; - MFT_REF root_ref; - ntfs_attr_search_ctx *ctx; - char *sd; - NTFS_BOOT_SECTOR *bs; - unsigned long mnt_flags; - - /* Initialize the random number generator with the current time. */ - srandom(time(NULL)); - /* Initialize ntfs_volume structure vol. */ - vol = (ntfs_volume*)calloc(1, sizeof(*vol)); - if (!vol) - err_exit("Could not allocate memory for internal buffer.\n"); - vol->major_ver = 1; - vol->minor_ver = 2; - vol->mft_record_size = 1024; - vol->mft_record_size_bits = 10; - /* Length is in unicode characters. */ - vol->upcase_len = 65536; - vol->upcase = (uchar_t*)malloc(vol->upcase_len * sizeof(uchar_t)); - if (!vol->upcase) - err_exit("Could not allocate memory for internal buffer.\n"); - init_upcase_table(vol->upcase, vol->upcase_len * sizeof(uchar_t)); - /* Initialize opt to zero / required values. */ - init_options(); - /* Parse command line options. */ - parse_options(argc, argv); - /* Verify we are dealing with a block device. */ - if (stat(vol->dev_name, &sbuf) == -1) { - if (errno == ENOENT) - err_exit("The device doesn't exist; did you specify " - "it correctly?\n"); - err_exit("Error getting information about %s: %s\n", - vol->dev_name, strerror(errno)); - } - if (!S_ISBLK(sbuf.st_mode)) { - Eprintf("%s is not a block device.\n", vol->dev_name); - if (!opt.force) - err_exit("Refusing to make a filesystem here!\n"); - if (!opt.nr_sectors) { - if (!sbuf.st_size && !sbuf.st_blocks) - err_exit("You must specify the number of " - "sectors.\n"); - if (opt.sector_size) { - if (sbuf.st_size) - opt.nr_sectors = sbuf.st_size / - opt.sector_size; - else - opt.nr_sectors = ((s64)sbuf.st_blocks - << 9) / opt.sector_size; - } else { - if (sbuf.st_size) - opt.nr_sectors = sbuf.st_size / 512; - else - opt.nr_sectors = sbuf.st_blocks; - opt.sector_size = 512; - } - } - fprintf(stderr, "mkntfs forced anyway.\n"); - } -#ifdef HAVE_LINUX_MAJOR_H - else if ((MAJOR(sbuf.st_rdev) == HD_MAJOR && - MINOR(sbuf.st_rdev) % 64 == 0) || - (SCSI_BLK_MAJOR(MAJOR(sbuf.st_rdev)) && - MINOR(sbuf.st_rdev) % 16 == 0)) { - err_exit("%s is entire device, not just one partition!\n", - vol->dev_name); - } -#endif - /* Make sure the file system is not mounted. */ - if (ntfs_check_if_mounted(vol->dev_name, &mnt_flags)) - Eprintf("Failed to determine whether %s is mounted: %s\n", - vol->dev_name, strerror(errno)); - else if (mnt_flags & NTFS_MF_MOUNTED) { - Eprintf("%s is mounted.\n", vol->dev_name); - if (!opt.force) - err_exit("Refusing to make a filesystem here!\n"); - fprintf(stderr, "mkntfs forced anyway. Hope /etc/mtab is " - "incorrect.\n"); - } - - /* Open the device for reading or reading and writing. */ - if (opt.no_action) { - Qprintf("Running in READ-ONLY mode!\n"); - i = O_RDONLY; - } else - i = O_RDWR; - vol->fd = open(vol->dev_name, i); - if (vol->fd == -1) - err_exit("Could not open %s: %s\n", vol->dev_name, - strerror(errno)); - /* Acquire exlusive (mandatory) write lock on the whole device. */ - memset(&flk, 0, sizeof(flk)); - if (opt.no_action) - flk.l_type = F_RDLCK; - else - flk.l_type = F_WRLCK; - flk.l_whence = SEEK_SET; - flk.l_start = flk.l_len = 0LL; - err = fcntl(vol->fd, F_SETLK, &flk); - if (err == -1) { - Eprintf("Could not lock %s for %s: %s\n", vol->dev_name, - opt.no_action ? "reading" : "writing", - strerror(errno)); - err = close(vol->fd); - if (err == -1) - Eprintf("Warning: Could not close %s: %s\n", - vol->dev_name, strerror(errno)); - exit(1); - } - /* Register our exit function which will unlock and close the device. */ - err = atexit(&mkntfs_exit); - if (err == -1) { - Eprintf("Could not set up exit() function because atexit() " - "failed. Aborting...\n"); - mkntfs_exit(); - exit(1); - } - /* If user didn't specify the sector size, determine it now. */ - if (!opt.sector_size) { -#ifdef BLKSSZGET - int _sect_size = 0; - - if (ioctl(vol->fd, BLKSSZGET, &_sect_size) >= 0) - opt.sector_size = _sect_size; - else -#endif - { - Eprintf("No sector size specified for %s and it could " - "not be obtained automatically.\n" - "Assuming sector size is 512 bytes.\n", - vol->dev_name); - opt.sector_size = 512; - } - } - /* Validate sector size. */ - if ((opt.sector_size - 1) & opt.sector_size || - opt.sector_size < 256 || opt.sector_size > 4096) - err_exit("Error: sector_size is invalid. It must be a power " - "of two, and it must be\n greater or equal 256 and " - "less than or equal 4096 bytes.\n"); - Dprintf("sector size = %i bytes\n", opt.sector_size); - /* If user didn't specify the number of sectors, determine it now. */ - if (!opt.nr_sectors) { - opt.nr_sectors = get_device_size(vol->fd, opt.sector_size); - if (opt.nr_sectors <= 0) - err_exit("get_device_size(%s) failed. Please specify " - "it manually.\n", vol->dev_name); - } - Dprintf("number of sectors = %Ld (0x%Lx)\n", opt.nr_sectors, - opt.nr_sectors); - /* Reserve the last sector for the backup boot sector. */ - opt.nr_sectors--; - /* If user didn't specify the volume size, determine it now. */ - if (!opt.volume_size) - opt.volume_size = opt.nr_sectors * opt.sector_size; - else if (opt.volume_size & (opt.sector_size - 1)) - err_exit("Error: volume_size is not a multiple of " - "sector_size.\n"); - /* Validate volume size. */ - if (opt.volume_size < 1 << 20 /* 1MiB */) - err_exit("Error: device is too small (%ikiB). Minimum NTFS " - "volume size is 1MiB.\n", opt.volume_size / 1024); - Dprintf("volume size = %LikiB\n", opt.volume_size / 1024); - /* If user didn't specify the cluster size, determine it now. */ - if (!vol->cluster_size) { - if (opt.volume_size <= 512LL << 20) /* <= 512MB */ - vol->cluster_size = 512; - else if (opt.volume_size <= 1LL << 30) /* ]512MB-1GB] */ - vol->cluster_size = 1024; - else if (opt.volume_size <= 2LL << 30) /* ]1GB-2GB] */ - vol->cluster_size = 2048; - else - vol->cluster_size = 4096; - /* For small volumes on devices with large sector sizes. */ - if (vol->cluster_size < opt.sector_size) - vol->cluster_size = opt.sector_size; - } - /* Validate cluster size. */ - if (vol->cluster_size & (vol->cluster_size - 1) || - vol->cluster_size < opt.sector_size || - vol->cluster_size > 128 * opt.sector_size || - vol->cluster_size > 65536) - err_exit("Error: cluster_size is invalid. It must be a power " - "of two, be at least\nthe same as sector_size, be " - "maximum 64kB, and the sectors per cluster value " - "has\nto fit inside eight bits. (We do not support " - "larger cluster sizes yet.)\n"); - vol->cluster_size_bits = ffs(vol->cluster_size) - 1; - Dprintf("cluster size = %i bytes\n", vol->cluster_size); - if (vol->cluster_size > 4096) { - if (opt.enable_compression) { - if (!opt.force) - err_exit("Error: cluster_size is above 4096 " - "bytes and compression is " - "requested.\nThis is not " - "possible due to limitations " - "in the compression algorithm " - "used by\nWindows.\n"); - opt.enable_compression = 0; - } - Qprintf("Warning: compression will be disabled on this volume " - "because it is not\nsupported when the cluster " - "size is above 4096 bytes. This is due to \n" - "limitations in the compression algorithm used " - "by Windows.\n"); - } - /* If user didn't specify the number of clusters, determine it now. */ - if (!opt.nr_clusters) - opt.nr_clusters = opt.volume_size / vol->cluster_size; - /* - * Check the cluster_size and nr_sectors for consistency with - * sector_size and nr_sectors. And check both of these for consistency - * with volume_size. - */ - if (opt.nr_clusters != (opt.nr_sectors * opt.sector_size) / - vol->cluster_size || - opt.volume_size / opt.sector_size != opt.nr_sectors || - opt.volume_size / vol->cluster_size != opt.nr_clusters) - err_exit("Illegal combination of volume/cluster/sector size " - "and/or cluster/sector number.\n"); - Dprintf("number of clusters = %Lu (0x%Lx)\n", opt.nr_clusters, - opt.nr_clusters); - /* Determine lcn bitmap byte size and allocate it. */ - lcn_bitmap_byte_size = (opt.nr_clusters + 7) >> 3; - /* Needs to be multiple of 8 bytes. */ - lcn_bitmap_byte_size = (lcn_bitmap_byte_size + 7) & ~7; - i = (lcn_bitmap_byte_size + vol->cluster_size - 1) & - ~(vol->cluster_size - 1); - Dprintf("lcn_bitmap_byte_size = %i, allocated = %i\n", - lcn_bitmap_byte_size, i); - lcn_bitmap = (unsigned char *)calloc(1, lcn_bitmap_byte_size); - if (!lcn_bitmap) - err_exit("Failed to allocate internal buffer: %s", - strerror(errno)); - /* - * $Bitmap can overlap the end of the volume. Any bits in this region - * must be set. This region also encompasses the backup boot sector. - */ - for (i = opt.nr_clusters; i < lcn_bitmap_byte_size << 3; i++) - ntfs_set_bit(lcn_bitmap, (u64)i, 1); - /* - * Determine mft_size: 16 mft records or 1 cluster, which ever is - * bigger, rounded to multiples of cluster size. - */ - opt.mft_size = (16 * vol->mft_record_size + vol->cluster_size - 1) - & ~(vol->cluster_size - 1); - Dprintf("MFT size = %i (0x%x) bytes\n", opt.mft_size, opt.mft_size); - /* Determine mft bitmap size and allocate it. */ - mft_bitmap_size = opt.mft_size / vol->mft_record_size; - /* Convert to bytes, at least one. */ - mft_bitmap_byte_size = (mft_bitmap_size + 7) >> 3; - /* Mft bitmap is allocated in multiples of 8 bytes. */ - mft_bitmap_byte_size = (mft_bitmap_byte_size + 7) & ~7; - Dprintf("mft_bitmap_size = %i, mft_bitmap_byte_size = %i\n", - mft_bitmap_size, mft_bitmap_byte_size); - mft_bitmap = (unsigned char *)calloc(1, mft_bitmap_byte_size); - if (!mft_bitmap) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - /* Create run list for mft bitmap. */ - rl_mft_bmp = (run_list *)malloc(2 * sizeof(run_list)); - if (!rl_mft_bmp) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - rl_mft_bmp[0].vcn = 0LL; - /* Mft bitmap is right after $Boot's data. */ - j = (8192 + vol->cluster_size - 1) / vol->cluster_size; - rl_mft_bmp[0].lcn = j; - /* - * Size is always one cluster, even though valid data size and - * initialized data size are only 8 bytes. - */ - rl_mft_bmp[1].vcn = rl_mft_bmp[0].length = 1LL; - rl_mft_bmp[1].lcn = -1LL; - rl_mft_bmp[1].length = 0LL; - /* Allocate cluster for mft bitmap. */ - ntfs_set_bit(lcn_bitmap, (s64)j, 1); - /* If user didn't specify the mft lcn, determine it now. */ - if (!opt.mft_lcn) { - /* - * We start at the higher value out of 16kiB and just after the - * mft bitmap. - */ - opt.mft_lcn = rl_mft_bmp[0].lcn + rl_mft_bmp[0].length; - if (opt.mft_lcn * vol->cluster_size < 16 * 1024) - opt.mft_lcn = (16 * 1024 + vol->cluster_size - 1) / - vol->cluster_size; - } - Dprintf("$MFT logical cluster number = 0x%x\n", opt.mft_lcn); - /* Determine MFT zone size. */ - opt.mft_zone_end = opt.nr_clusters; - switch (opt.mft_zone_multiplier) { /* % of volume size in clusters */ - case 4: - opt.mft_zone_end = opt.mft_zone_end >> 1; /* 50% */ - break; - case 3: - opt.mft_zone_end = opt.mft_zone_end * 3 >> 3; /* 37.5% */ - break; - case 2: - opt.mft_zone_end = opt.mft_zone_end >> 2; /* 25% */ - break; - /* case 1: */ - default: - opt.mft_zone_end = opt.mft_zone_end >> 3; /* 12.5% */ - break; - } - Dprintf("MFT zone size = %lukiB\n", opt.mft_zone_end / 1024); - /* - * The mft zone begins with the mft data attribute, not at the beginning - * of the device. - */ - opt.mft_zone_end += opt.mft_lcn; - /* Create run list for mft. */ - rl_mft = (run_list *)malloc(2 * sizeof(run_list)); - if (!rl_mft) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - rl_mft[0].vcn = 0LL; - rl_mft[0].lcn = opt.mft_lcn; - /* We already rounded mft size up to a cluster. */ - j = opt.mft_size / vol->cluster_size; - rl_mft[1].vcn = rl_mft[0].length = j; - rl_mft[1].lcn = -1LL; - rl_mft[1].length = 0LL; - /* Allocate clusters for mft. */ - for (i = 0; i < j; i++) - ntfs_set_bit(lcn_bitmap, opt.mft_lcn + i, 1); - /* Determine mftmirr_lcn (middle of volume). */ - opt.mftmirr_lcn = (opt.nr_sectors * opt.sector_size >> 1) - / vol->cluster_size; - Dprintf("$MFTMirr logical cluster number = 0x%x\n", opt.mftmirr_lcn); - /* Create run list for mft mirror. */ - rl_mftmirr = (run_list *)malloc(2 * sizeof(run_list)); - if (!rl_mftmirr) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - rl_mftmirr[0].vcn = 0LL; - rl_mftmirr[0].lcn = opt.mftmirr_lcn; - /* - * The mft mirror is either 4kb (the first four records) or one cluster - * in size, which ever is bigger. In either case, it contains a - * byte-for-byte identical copy of the beginning of the mft (i.e. either - * ther first four records (4kb) or the first cluster worth of records, - * whichever is bigger). - */ - j = (4 * vol->mft_record_size + vol->cluster_size - 1) / vol->cluster_size; - rl_mftmirr[1].vcn = rl_mftmirr[0].length = j; - rl_mftmirr[1].lcn = -1LL; - rl_mftmirr[1].length = 0LL; - /* Allocate clusters for mft mirror. */ - for (i = 0; i < j; i++) - ntfs_set_bit(lcn_bitmap, opt.mftmirr_lcn + i, 1); - opt.logfile_lcn = opt.mftmirr_lcn + j; - Dprintf("$LogFile logical cluster number = 0x%x\n", opt.logfile_lcn); - /* Create run list for log file. */ - rl_logfile = (run_list *)malloc(2 * sizeof(run_list)); - if (!rl_logfile) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - rl_logfile[0].vcn = 0LL; - rl_logfile[0].lcn = opt.logfile_lcn; - /* - * Determine logfile_size from volume_size (rounded up to a cluster), - * making sure it does not overflow the end of the volume. - */ - if (opt.volume_size < 2048LL * 1024) /* < 2MiB */ - opt.logfile_size = 256LL * 1024; /* -> 256kiB */ - else if (opt.volume_size < 4000000LL) /* < 4MB */ - opt.logfile_size = 512LL * 1024; /* -> 512kiB */ - else if (opt.volume_size <= 200LL * 1024 * 1024)/* < 200MiB */ - opt.logfile_size = 2048LL * 1024; /* -> 2MiB */ - else if (opt.volume_size >= 400LL << 20) /* > 400MiB */ - opt.logfile_size = 4 << 20; /* -> 4MiB */ - else - opt.logfile_size = (opt.volume_size / 100) & - ~(vol->cluster_size - 1); - j = opt.logfile_size / vol->cluster_size; - while (rl_logfile[0].lcn + j >= opt.nr_clusters) { - /* - * $Logfile would overflow volume. Need to make it smaller than - * the standard size. It's ok as we are creating a non-standard - * volume anyway if it is that small. - */ - opt.logfile_size >>= 1; - j = opt.logfile_size / vol->cluster_size; - } - opt.logfile_size = (opt.logfile_size + vol->cluster_size - 1) & - ~(vol->cluster_size - 1); - Dprintf("$LogFile (journal) size = %ikiB\n", opt.logfile_size / 1024); - /* - * FIXME: The 256kiB limit is arbitrary. Should find out what the real - * minimum requirement for Windows is so it doesn't blue screen. - */ - if (opt.logfile_size < 256 << 10) - err_exit("$LogFile would be created with invalid size. This " - "is not allowed as it would cause Windows to " - "blue screen and during boot.\n"); - rl_logfile[1].vcn = rl_logfile[0].length = j; - rl_logfile[1].lcn = -1LL; - rl_logfile[1].length = 0LL; - /* Allocate clusters for log file. */ - for (i = 0; i < j; i++) - ntfs_set_bit(lcn_bitmap, opt.logfile_lcn + i, 1); - /* Create run list for $Boot. */ - rl_boot = (run_list *)malloc(2 * sizeof(run_list)); - if (!rl_boot) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - rl_boot[0].vcn = 0LL; - rl_boot[0].lcn = 0LL; - /* - * $Boot is always 8192 (0x2000) bytes or 1 cluster, whichever is - * bigger. - */ - j = (8192 + vol->cluster_size - 1) / vol->cluster_size; - rl_boot[1].vcn = rl_boot[0].length = j; - rl_boot[1].lcn = -1LL; - rl_boot[1].length = 0LL; - /* Allocate clusters for $Boot. */ - for (i = 0; i < j; i++) - ntfs_set_bit(lcn_bitmap, 0LL + i, 1); - /* Allocate a buffer large enough to hold the mft. */ - buf = calloc(1, opt.mft_size); - if (!buf) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - /* Create run list for $BadClus, $DATA named stream $Bad. */ - rl_bad = (run_list *)malloc(2 * sizeof(run_list)); - if (!rl_bad) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - rl_bad[0].vcn = 0LL; - rl_bad[0].lcn = -1LL; - /* - * $BadClus named stream $Bad contains the whole volume as a single - * sparse run list entry. - */ - rl_bad[1].vcn = rl_bad[0].length = opt.nr_clusters; - rl_bad[1].lcn = -1LL; - rl_bad[1].length = 0LL; - - // TODO: Mark bad blocks as such. - - /* - * If not quick format, fill the device with 0s. - * FIXME: Except bad blocks! (AIA) - */ - if (!opt.quick_format) { - unsigned long position; - unsigned long mid_clust; - float progress_inc = (float)opt.nr_clusters / 100; - - Qprintf("Initialising device with zeroes: 0%%"); - fflush(stdout); - mid_clust = (opt.volume_size >> 1) / vol->cluster_size; - for (position = 0; position < opt.nr_clusters; position++) { - if (!(position % (int)(progress_inc+1))) { - Qprintf("\b\b\b\b%3.0f%%", position / - progress_inc); - fflush(stdout); - } - bw = mkntfs_write(vol->fd, buf, vol->cluster_size); - if (bw != vol->cluster_size) { - if (bw != -1 || errno != EIO) - err_exit("This should not happen.\n"); - if (!position) - err_exit("Error: Cluster zero is bad. " - "Cannot create NTFS file " - "system.\n"); - if (position == mid_clust && - (vol->major_ver < 1 || - (vol->major_ver == 1 && - vol->minor_ver < 2))) - err_exit("Error: Bad cluster found in " - "location reserved for system " - "file $Boot.\n"); - /* Add the baddie to our bad blocks list. */ - append_to_bad_blocks(position); - Qprintf("\nFound bad cluster (%ld). Adding to " - "list of bad blocks.\nInitialising " - "device with zeroes: %3.0i%%", position, - position / progress_inc); - /* Seek to next cluster. */ - lseek(vol->fd, ((off_t)position + 1) * - vol->cluster_size, SEEK_SET); - } - } - Qprintf("\b\b\b\b100%%"); - position = (opt.volume_size & (vol->cluster_size - 1)) / - opt.sector_size; - for (i = 0; i < position; i++) { - bw = mkntfs_write(vol->fd, buf, opt.sector_size); - if (bw != opt.sector_size) { - if (bw != -1 || errno != EIO) - err_exit("This should not happen.\n"); - else if (i + 1 == position && - (vol->major_ver >= 2 || - (vol->major_ver == 1 && - vol->minor_ver >= 2))) - err_exit("Error: Bad cluster found in " - "location reserved for system " - "file $Boot.\n"); - /* Seek to next sector. */ - lseek(vol->fd, opt.sector_size, SEEK_CUR); - } - } - Qprintf(" - Done.\n"); - } - Qprintf("Creating NTFS volume structures.\n"); - /* Setup an empty mft record. */ - format_mft_record((MFT_RECORD*)buf); - /* - * Copy the mft record onto all 16 records in the buffer and setup the - * sequence numbers of each system file to equal the mft record number - * of that file (only for $MFT is the sequence number 1 rather than 0). - */ - for (i = 1; i < 16; i++) { - m = (MFT_RECORD*)(buf + i * vol->mft_record_size); - memcpy(m, buf, vol->mft_record_size); - m->sequence_number = cpu_to_le16(i); - } - /* - * If a cluster contains more than the 16 system files, fill the rest - * with empty, formatted records. - */ - if (vol->cluster_size > 16 * vol->mft_record_size) { - for (i = 16; i * vol->mft_record_size < vol->cluster_size; i++) - memcpy(buf + i * vol->mft_record_size, buf, - vol->mft_record_size); - } - /* - * Create the 16 system files, adding the system information attribute - * to each as well as marking them in use in the mft bitmap. - */ - for (i = 0; i < 16; i++) { - u32 file_attrs; - - m = (MFT_RECORD*)(buf + i * vol->mft_record_size); - m->flags |= MFT_RECORD_IN_USE; - ntfs_set_bit(mft_bitmap, 0LL + i, 1); - file_attrs = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM; - if (i == FILE_root) { - if (opt.disable_indexing) - file_attrs |= FILE_ATTR_NOT_CONTENT_INDEXED; - if (opt.enable_compression) - file_attrs |= FILE_ATTR_COMPRESSED; - } - add_attr_std_info(m, file_attrs); - // dump_mft_record(m); - } - /* The root directory mft reference. */ - root_ref = MAKE_MFT_REF(FILE_root, FILE_root); - Vprintf("Creating root directory (mft record 5)\n"); - m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); - m->flags |= MFT_RECORD_IS_DIRECTORY; - m->link_count = cpu_to_le16(le16_to_cpu(m->link_count) + 1); - err = add_attr_file_name(m, root_ref, 0LL, 0LL, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | - FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, - ".", FILE_NAME_WIN32_AND_DOS); - if (!err) { - init_system_file_sd(FILE_root, &sd, &i); - err = add_attr_sd(m, sd, i); - } - // FIXME: This should be IGNORE_CASE - if (!err) - err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, - COLLATION_FILE_NAME, opt.index_block_size); - // FIXME: This should be IGNORE_CASE - if (!err) - err = upgrade_to_large_index(m, "$I30", 4, 0, &index_block); - if (!err) { - ctx = ntfs_get_attr_search_ctx(NULL, m); - if (!ctx) - err_exit("Failed to allocate attribute search " - "context: %s\n", strerror(errno)); - /* There is exactly one file name so this is ok. */ - if (ntfs_lookup_attr(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, - ctx)) { - ntfs_put_attr_search_ctx(ctx); - err_exit("BUG: $FILE_NAME attribute not found.\n"); - } - a = ctx->attr; - err = insert_file_link_in_dir_index(index_block, root_ref, - (FILE_NAME_ATTR*)((char*)a + - le16_to_cpu(a->value_offset)), - le32_to_cpu(a->value_length)); - ntfs_put_attr_search_ctx(ctx); - } - if (err) - err_exit("Couldn't create root directory: %s\n", - strerror(-err)); - // dump_mft_record(m); - /* Add all other attributes, on a per-file basis for clarity. */ - Vprintf("Creating $MFT (mft record 0)\n"); - m = (MFT_RECORD*)buf; - err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mft, buf, - opt.mft_size); - if (!err) - err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_MFT, 1), opt.mft_size, - opt.mft_size, FILE_ATTR_HIDDEN | - FILE_ATTR_SYSTEM, 0, 0, "$MFT", - FILE_NAME_WIN32_AND_DOS); - if (!err) { - init_system_file_sd(FILE_MFT, &sd, &i); - err = add_attr_sd(m, sd, i); - } - /* mft_bitmap is not modified in mkntfs; no need to sync it later. */ - if (!err) - err = add_attr_bitmap_positioned(m, NULL, 0, 0, rl_mft_bmp, - mft_bitmap, mft_bitmap_byte_size); - if (err < 0) - err_exit("Couldn't create $MFT: %s\n", strerror(-err)); - //dump_mft_record(m); - Vprintf("Creating $MFTMirr (mft record 1)\n"); - m = (MFT_RECORD*)(buf + 1 * vol->mft_record_size); - err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mftmirr, buf, - rl_mftmirr[0].length * vol->cluster_size); - if (!err) - err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_MFTMirr, FILE_MFTMirr), - rl_mftmirr[0].length * vol->cluster_size, - rl_mftmirr[0].length * vol->cluster_size, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, - "$MFTMirr", FILE_NAME_WIN32_AND_DOS); - if (!err) { - init_system_file_sd(FILE_MFTMirr, &sd, &i); - err = add_attr_sd(m, sd, i); - } - if (err < 0) - err_exit("Couldn't create $MFTMirr: %s\n", strerror(-err)); - //dump_mft_record(m); - Vprintf("Creating $LogFile (mft record 2)\n"); - m = (MFT_RECORD*)(buf + 2 * vol->mft_record_size); - buf2 = malloc(opt.logfile_size); - if (!buf2) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - memset(buf2, -1, opt.logfile_size); - err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_logfile, buf2, - opt.logfile_size); - free(buf2); - buf2 = NULL; - if (!err) - err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_LogFile, FILE_LogFile), - opt.logfile_size, opt.logfile_size, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, - "$LogFile", FILE_NAME_WIN32_AND_DOS); - if (!err) { - init_system_file_sd(FILE_LogFile, &sd, &i); - err = add_attr_sd(m, sd, i); - } - if (err < 0) - err_exit("Couldn't create $LogFile: %s\n", strerror(-err)); - //dump_mft_record(m); - Vprintf("Creating $Volume (mft record 3)\n"); - m = (MFT_RECORD*)(buf + 3 * vol->mft_record_size); - err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_Volume, FILE_Volume), 0LL, 0LL, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, - "$Volume", FILE_NAME_WIN32_AND_DOS); - if (!err) { - init_system_file_sd(FILE_Volume, &sd, &i); - err = add_attr_sd(m, sd, i); - } - if (!err) - err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); - if (!err) - err = add_attr_vol_name(m, vol->vol_name, vol->vol_name ? - strlen(vol->vol_name) : 0); - if (!err) { - Qprintf("Setting the volume dirty so check disk runs on next " - "reboot into Windows.\n"); - err = add_attr_vol_info(m, VOLUME_IS_DIRTY, vol->major_ver, - vol->minor_ver); - } - if (err < 0) - err_exit("Couldn't create $Volume: %s\n", strerror(-err)); - //dump_mft_record(m); - Vprintf("Creating $AttrDef (mft record 4)\n"); - m = (MFT_RECORD*)(buf + 4 * vol->mft_record_size); - if (vol->major_ver < 3) - buf2_size = 36000; - else - buf2_size = opt.attr_defs_len; - buf2 = (char*)calloc(1, buf2_size); - if (!buf2) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - memcpy(buf2, opt.attr_defs, opt.attr_defs_len); - err = add_attr_data(m, NULL, 0, 0, 0, buf2, buf2_size); - free(buf2); - buf2 = NULL; - if (!err) - err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_AttrDef, FILE_AttrDef), - (buf2_size + vol->cluster_size - 1) & - ~(vol->cluster_size - 1), buf2_size, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, - "$AttrDef", FILE_NAME_WIN32_AND_DOS); - buf2_size = 0; - if (!err) { - init_system_file_sd(FILE_AttrDef, &sd, &i); - err = add_attr_sd(m, sd, i); - } - if (err < 0) - err_exit("Couldn't create $AttrDef: %s\n", strerror(-err)); - //dump_mft_record(m); - Vprintf("Creating $Bitmap (mft record 6)\n"); - m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); - err = add_attr_data(m, NULL, 0, 0, 0, lcn_bitmap, lcn_bitmap_byte_size); - if (!err) - err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_Bitmap, FILE_Bitmap), - (lcn_bitmap_byte_size + vol->cluster_size - 1) & - ~(vol->cluster_size - 1), lcn_bitmap_byte_size, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, - "$Bitmap", FILE_NAME_WIN32_AND_DOS); - if (!err) { - init_system_file_sd(FILE_Bitmap, &sd, &i); - err = add_attr_sd(m, sd, i); - } - if (err < 0) - err_exit("Couldn't create $Bitmap: %s\n", strerror(-err)); - //dump_mft_record(m); - Vprintf("Creating $Boot (mft record 7)\n"); - m = (MFT_RECORD*)(buf + 7 * vol->mft_record_size); - buf2 = calloc(1, 8192); - if (!buf2) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - memcpy(buf2, boot_array, sizeof(boot_array)); - /* - * Create the boot sector into buf2. Note, that buf2 already is zeroed - * in the boot sector section and that it has the NTFS OEM id/magic - * already inserted, so no need to worry about these things. - */ - bs = (NTFS_BOOT_SECTOR*)buf2; - bs->bpb.bytes_per_sector = cpu_to_le16(opt.sector_size); - bs->bpb.sectors_per_cluster = (u8)(vol->cluster_size / - opt.sector_size); - bs->bpb.media_type = 0xf8; /* hard disk */ - /* - * If there are problems go back to bs->unused[0-3] and set them. See - * ../include/bootsect.h for details. Other fields to also consider - * setting are: bs->bpb.sectors_per_track, .heads, and .hidden_sectors. - */ - bs->number_of_sectors = scpu_to_le64(opt.nr_sectors); - bs->mft_lcn = scpu_to_le64(opt.mft_lcn); - bs->mftmirr_lcn = scpu_to_le64(opt.mftmirr_lcn); - if (vol->mft_record_size >= vol->cluster_size) - bs->clusters_per_mft_record = vol->mft_record_size / - vol->cluster_size; - else { - bs->clusters_per_mft_record = -(ffs(vol->mft_record_size) - 1); - if ((1 << -bs->clusters_per_mft_record) != vol->mft_record_size) - err_exit("BUG: calculated clusters_per_mft_record " - "is wrong (= 0x%x)\n", - bs->clusters_per_mft_record); - } - Dprintf("Clusters per mft record = %i (0x%x)\n", - bs->clusters_per_mft_record, - bs->clusters_per_mft_record); - if (opt.index_block_size >= vol->cluster_size) - bs->clusters_per_index_record = opt.index_block_size / - vol->cluster_size; - else { - bs->clusters_per_index_record = -(ffs(opt.index_block_size) - 1); - if ((1 << -bs->clusters_per_index_record) != - opt.index_block_size) - err_exit("BUG: calculated clusters_per_index_record " - "is wrong (= 0x%x)\n", - bs->clusters_per_index_record); - } - Dprintf("Clusters per index block = %i (0x%x)\n", - bs->clusters_per_index_record, - bs->clusters_per_index_record); - /* Generate a 64-bit random number for the serial number. */ - bs->volume_serial_number = scpu_to_le64(((s64)random() << 32) | - ((s64)random() & 0xffffffff)); - /* - * Leave zero for now as NT4 leaves it zero, too. If want it later, see - * ../libntfs/bootsect.c for how to calculate it. - */ - bs->checksum = cpu_to_le32(0); - /* Make sure the bootsector is ok. */ - if (!is_boot_sector_ntfs(bs, opt.verbose > 0 ? 0 : 1)) - err_exit("FATAL: Generated boot sector is invalid!\n"); - err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_boot, buf2, 8192); - if (!err) - err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_Boot, FILE_Boot), - (8192 + vol->cluster_size - 1) & - ~(vol->cluster_size - 1), 8192, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, - "$Boot", FILE_NAME_WIN32_AND_DOS); - if (!err) { - init_system_file_sd(FILE_Boot, &sd, &i); - err = add_attr_sd(m, sd, i); - } - if (err < 0) - err_exit("Couldn't create $Boot: %s\n", strerror(-err)); - Vprintf("Creating backup boot sector.\n"); - /* - * Write the first max(512, opt.sector_size) bytes from buf2 to the - * last sector. - */ - if (lseek(vol->fd, (opt.nr_sectors + 1) * opt.sector_size - i, - SEEK_SET) == (off_t)-1) - goto bb_err; - bw = mkntfs_write(vol->fd, buf2, i); - free(buf2); - buf2 = NULL; - if (bw != i) { - int _e = errno; - char *_s; - - if (bw == -1LL) - _s = strerror(_e); - else - _s = "unknown error"; - if (bw != -1LL || (bw == -1LL && _e != ENOSPC)) { - err_exit("Couldn't write backup boot sector: %s\n", _s); -bb_err: - Eprintf("Seek failed: %s\n", strerror(errno)); - } - Eprintf("Couldn't write backup boot sector. This is due to a " - "limitation in the\nLinux kernel. This is not " - "a major problem as Windows check disk will " - "create the\nbackup boot sector when it " - "is run on your next boot into Windows.\n"); - } - //dump_mft_record(m); - Vprintf("Creating $BadClus (mft record 8)\n"); - m = (MFT_RECORD*)(buf + 8 * vol->mft_record_size); - // FIXME: This should be IGNORE_CASE - /* Create a sparse named stream of size equal to the volume size. */ - err = add_attr_data_positioned(m, "$Bad", 4, 0, 0, rl_bad, NULL, - opt.nr_clusters * vol->cluster_size); - if (!err) { - err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); - } - if (!err) { - err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_BadClus, FILE_BadClus), - 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, - 0, 0, "$BadClus", FILE_NAME_WIN32_AND_DOS); - } - if (!err) { - init_system_file_sd(FILE_BadClus, &sd, &i); - err = add_attr_sd(m, sd, i); - } - if (err < 0) - err_exit("Couldn't create $BadClus: %s\n", strerror(-err)); - //dump_mft_record(m); - Vprintf("Creating $Quota (mft record 9)\n"); - m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); - err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); - if (!err) - err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(9, 9), 0LL, 0LL, FILE_ATTR_HIDDEN - | FILE_ATTR_SYSTEM, 0, 0, "$Quota", - FILE_NAME_WIN32_AND_DOS); - if (!err) { - init_system_file_sd(FILE_Secure, &sd, &i); - err = add_attr_sd(m, sd, i); - } - if (err < 0) - err_exit("Couldn't create $Quota: %s\n", strerror(-err)); - //dump_mft_record(m); - Vprintf("Creating $UpCase (mft record 0xa)\n"); - m = (MFT_RECORD*)(buf + 0xa * vol->mft_record_size); - err = add_attr_data(m, NULL, 0, 0, 0, (char*)vol->upcase, - vol->upcase_len << 1); - if (!err) - err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_UpCase, FILE_UpCase), - ((vol->upcase_len << 1) + vol->cluster_size - 1) & - ~(vol->cluster_size - 1), vol->upcase_len << 1, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, - "$UpCase", FILE_NAME_WIN32_AND_DOS); - if (!err) { - init_system_file_sd(FILE_UpCase, &sd, &i); - err = add_attr_sd(m, sd, i); - } - if (err < 0) - err_exit("Couldn't create $UpCase: %s\n", strerror(-err)); - //dump_mft_record(m); - /* NTFS 1.2 reserved system files (mft records 0xb-0xf) */ - for (i = 0xb; i < 0x10; i++) { - Vprintf("Creating system file (mft record 0x%x)\n", i, i); - m = (MFT_RECORD*)(buf + i * vol->mft_record_size); - err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); - if (!err) { - init_system_file_sd(i, &sd, &j); - err = add_attr_sd(m, sd, j); - } - if (err < 0) - err_exit("Couldn't create system file %i (0x%x): %s\n", - i, i, strerror(-err)); - //dump_mft_record(m); - } -// - Do not step onto bad blocks!!! -// - If any bad blocks were specified or found, modify $BadClus, allocating the -// bad clusters in $Bitmap. -// - C&w bootsector backup bootsector (backup in last sector of the -// partition). -// - If NTFS 3.0+, c&w $Secure file and $Extend directory with the -// corresponding special files in it, i.e. $ObjId, $Quota, $Reparse, and -// $UsnJrnl. And others? Or not all necessary? -// - RE: Populate $root with the system files (and $Extend directory if -// applicable). Possibly should move this as far to the top as possible and -// update during each subsequent c&w of each system file. - Vprintf("Syncing root directory index record.\n"); - m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); - i = 5 * sizeof(uchar_t); - ctx = ntfs_get_attr_search_ctx(NULL, m); - if (!ctx) - err_exit("Failed to allocate attribute search context: %s\n", - strerror(errno)); - // FIXME: This should be IGNORE_CASE! - if (ntfs_lookup_attr(AT_INDEX_ALLOCATION, I30, 4, 0, 0, - NULL, 0, ctx)) { - ntfs_put_attr_search_ctx(ctx); - err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n"); - } - a = ctx->attr; - rl_index = ntfs_decompress_mapping_pairs(vol, a, NULL); - if (!rl_index) { - ntfs_put_attr_search_ctx(ctx); - err_exit("Failed to decompress run list of $INDEX_ALLOCATION " - "attribute.\n"); - } - if (sle64_to_cpu(a->initialized_size) < i) { - ntfs_put_attr_search_ctx(ctx); - err_exit("BUG: $INDEX_ALLOCATION attribute too short.\n"); - } - ntfs_put_attr_search_ctx(ctx); - i = sizeof(INDEX_BLOCK) - sizeof(INDEX_HEADER) + - le32_to_cpu(index_block->index.allocated_size); - err = ntfs_pre_write_mst_fixup((NTFS_RECORD*)index_block, i); - if (err) - err_exit("ntfs_pre_write_mst_fixup() failed while syncing " - "root directory index block.\n"); - lw = ntfs_rlwrite(vol->fd, rl_index, (char*)index_block, i, NULL); - if (lw != i) - err_exit("Error writing $INDEX_ALLOCATION.\n"); - /* No more changes to @index_block below here so no need for fixup: */ - // ntfs_post_write_mst_fixup((NTFS_RECORD*)index_block); - Vprintf("Syncing $Bitmap.\n"); - m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); - ctx = ntfs_get_attr_search_ctx(NULL, m); - if (!ctx) - err_exit("Failed to allocate attribute search context: %s\n", - strerror(errno)); - if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - ntfs_put_attr_search_ctx(ctx); - err_exit("BUG: $DATA attribute not found.\n"); - } - a = ctx->attr; - if (a->non_resident) { - rl = ntfs_decompress_mapping_pairs(vol, a, NULL); - ntfs_put_attr_search_ctx(ctx); - if (!rl) - err_exit("ntfs_decompress_mapping_pairs() failed\n"); - lw = ntfs_rlwrite(vol->fd, rl, lcn_bitmap, - lcn_bitmap_byte_size, NULL); - if (lw != lcn_bitmap_byte_size) - err_exit("%s\n", lw == -1 ? strerror(errno) : - "unknown error"); - } else { - memcpy((char*)a + le16_to_cpu(a->value_offset), lcn_bitmap, - le32_to_cpu(a->value_length)); - ntfs_put_attr_search_ctx(ctx); - } - /* - * No need to sync $MFT/$BITMAP as that has never been modified since - * its creation. - */ - Vprintf("Syncing $MFT.\n"); - pos = opt.mft_lcn * vol->cluster_size; - lw = 1; - for (i = 0; i < opt.mft_size / vol->mft_record_size; i++) { - if (!opt.no_action) - lw = ntfs_mst_pwrite(vol->fd, pos, 1, - vol->mft_record_size, - buf + i * vol->mft_record_size); - if (lw != 1) - err_exit("%s\n", lw == -1 ? strerror(errno) : - "unknown error"); - pos += vol->mft_record_size; - } - Vprintf("Updating $MFTMirr.\n"); - pos = opt.mftmirr_lcn * vol->cluster_size; - lw = 1; - for (i = 0; i < rl_mftmirr[0].length * vol->cluster_size / - vol->mft_record_size; i++) { - u16 usn, *usnp; - m = (MFT_RECORD*)(buf + i * vol->mft_record_size); - /* - * Decrement the usn by one, so it becomes the same as the one - * in $MFT once it is mst protected. - This is as we need the - * $MFTMirr to have the exact same byte by byte content as - * $MFT, rather than just equivalent meaning content. - */ - usnp = (u16*)((char*)m + le16_to_cpu(m->usa_ofs)); - usn = le16_to_cpup(usnp); - if (usn-- <= 1) - usn = 0xfffe; - *usnp = cpu_to_le16(usn); - if (!opt.no_action) - lw = ntfs_mst_pwrite(vol->fd, pos, 1, - vol->mft_record_size, - buf + i * vol->mft_record_size); - if (lw != 1) - err_exit("%s\n", lw == -1 ? strerror(errno) : - "unknown error"); - pos += vol->mft_record_size; - } - Vprintf("Syncing device.\n"); - if (fdatasync(vol->fd) == -1) - err_exit("Syncing device. FAILED: %s", strerror(errno)); - Qprintf("mkntfs completed successfully. Have a nice day.\n"); - /* - * Device is unlocked and closed by the registered exit function - * mkntfs_exit(). - */ - return 0; -} - diff --git a/ntfstools/ntfsdump_logfile.c b/ntfstools/ntfsdump_logfile.c deleted file mode 100644 index e785ea96..00000000 --- a/ntfstools/ntfsdump_logfile.c +++ /dev/null @@ -1,371 +0,0 @@ -const char *EXEC_NAME = "NtfsDump_LogFile"; -const char *EXEC_VERSION = "1.0"; -/* - * $Id$ - * - * NtfsDump_LogFile - Part of the Linux-NTFS project. - * - * Copyright (c) 2000,2001 Anton Altaparmakov. - * - * This utility will interpret the contents of the journal ($LogFile) of an - * NTFS partition and display the results on stdout. Errors will be output to - * stderr. - * - * Anton Altaparmakov - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS source - * in the file COPYING); if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * WARNING: This program might not work on architectures which do not allow - * unaligned access. For those, the program would need to start using - * get/put_unaligned macros (#include ), but not doing it yet, - * since NTFS really mostly applies to ia32 only, which does allow unaligned - * accesses. We might not actually have a problem though, since the structs are - * defined as being packed so that might be enough for gcc to insert the - * correct code. - * - * If anyone using a non-little endian and/or an aligned access only CPU tries - * this program please let me know whether it works or not! - * - * Anton Altaparmakov - */ - -#include -#include -#include -#include -#include -#include - -#include "types.h" -#include "attrib.h" -#include "mft.h" -#include "disk_io.h" -#include "logfile.h" -#include "mst.h" - -int main(int argc, char **argv) -{ - MFT_RECORD *m = NULL; - ATTR_RECORD *a; - s64 l; - unsigned char *lfd = NULL; - ntfs_volume *vol = NULL; - ntfs_attr_search_ctx *ctx = NULL; - RESTART_PAGE_HEADER *rph; - RESTART_AREA *rr; - RESTART_CLIENT *cr; - RECORD_PAGE_HEADER *rcrd_ph; - LOG_RECORD *lr; - int pass = 1; - int i, lps, client; - char zero[4096]; - - memset(zero, 0, sizeof(zero)); - printf("\n"); - if (argc != 2) { - printf("%s v%s - Interpret and display information about the " - "journal\n($LogFile) of an NTFS volume.\n\n" - /* Generic copyright / disclaimer. */ - "Copyright (c) 2000, 2001 Anton Altaparmakov.\n\n" - "%s is free software, released under the GNU " - "General Public License\nand you are welcome to " - "redistribute it under certain conditions.\n" - "%s comes with ABSOLUTELY NO WARRANTY; for details " - "read the GNU\nGeneral Public License to be found " - "in the file COPYING in the main Linux-NTFS\n" - "distribution directory.\n\n" - /* Generic part ends here. */ - "Syntax: ntfsdump_logfile partition_or_file_name\n" - " e.g. ntfsdump_logfile /dev/hda6\n\n", - EXEC_NAME, EXEC_VERSION, EXEC_NAME, EXEC_NAME); - fprintf(stderr, "Error: incorrect syntax\n"); - exit(1); - } - vol = ntfs_mount(argv[1], MS_RDONLY); - if (!vol) { - perror("ntfs_mount(MS_RDONLY) failed"); - exit(1); - } - /* Check NTFS version is ok for us. */ - printf("\nNTFS volume version is %i.%i.\n", vol->major_ver, - vol->minor_ver); - switch (vol->major_ver) { - case 1: - if (vol->minor_ver == 1 || vol->minor_ver == 2) - break; - else - goto version_error; - case 2: case 3: - if (vol->minor_ver == 0) - break; - /* Fall through on error. */ - default: -version_error: - fprintf(stderr, "Error: Unknown NTFS version.\n"); - goto error_exit; - } - /* Read in $LogFile. */ - if (ntfs_read_file_record(vol, FILE_LogFile, &m, NULL)) { - fprintf(stderr, "Error reading mft record for $LogFile.\n"); - goto error_exit; - } - if (!(m->flags & MFT_RECORD_IN_USE)) { - fprintf(stderr, "Error: $LogFile has been deleted. Run chkdsk " - "to fix this.\n"); - goto error_exit; - } - ctx = ntfs_get_attr_search_ctx(NULL, m); - if (!ctx) { - perror("Failed to allocate attribute search context"); - goto error_exit; - } - /* Find the $DATA attribute of the $LogFile. */ - if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - fprintf(stderr, "Error: Attribute $DATA was not found in" \ - "$LogFile!\n"); - goto log_file_error; - } - a = ctx->attr; - /* Get length of $LogFile contents. */ - l = get_attribute_value_length(a); - if (!l) { - puts("$LogFile has zero length, no need to write to disk."); - goto log_file_error; - } - /* Allocate a buffer to hold all of the $LogFile contents. */ - lfd = (unsigned char*)malloc(l); - if (!lfd) { - puts("Not enough memory to load $LogFile."); - goto log_file_error; - } - /* Read in the $LogFile into the buffer. */ - if (l != get_attribute_value(vol, m, a, lfd)) { - puts("Amount of data read does not correspond to expected " - "length!"); - free(lfd); - goto log_file_error; - } - /* Check restart area. */ - if (!is_rstr_recordp(lfd)) { - s64 _l; - - for (_l = 0LL; _l < l; _l++) - if (lfd[_l] != (unsigned char)-1) - break; - if (_l < l) - puts("$LogFile contents are corrupt (magic RSTR " - "missing)!"); - else - puts("$LogFile is empty."); - goto log_file_error; - } - /* Do the interpretation and display now. */ - rph = (RESTART_PAGE_HEADER*)lfd; - lps = le32_to_cpu(rph->log_page_size); -pass_loc: - if (ntfs_post_read_mst_fixup((NTFS_RECORD*)rph, lps) || - is_baad_record(rph->magic)) { - puts("$LogFile incomplete multi sector transfer detected! " - "Cannot handle this yet!"); - goto log_file_error; - } - if ((pass == 2) && !memcmp(lfd, rph, lps)) { - printf("2nd restart area fully matches the 1st one. Skipping " - "display.\n"); - goto skip_rstr_pass; - } - if (le16_to_cpu(rph->major_ver != 1) || - le16_to_cpu(rph->minor_ver != 1)) { - fprintf(stderr, "$LogFile version %i.%i! Error: Unknown " - "$LogFile version!\n", - le16_to_cpu(rph->major_ver), - le16_to_cpu(rph->minor_ver)); - goto log_file_error; - } - rr = (RESTART_AREA*)((char*)rph + le16_to_cpu(rph->restart_offset)); - cr = (RESTART_CLIENT*)((char*)rr + - le16_to_cpu(rr->client_array_offset)); - /* Dump of the interpreted $LogFile restart area. */ - if (pass == 1) - printf("\n$LogFile version %i.%i.\n", - le16_to_cpu(rph->major_ver), - le16_to_cpu(rph->minor_ver)); - printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); - printf("magic = RSTR\n"); - printf("ChkDskLsn = 0x%Lx\n", sle64_to_cpu(rph->chkdsk_lsn)); - printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); - printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); - printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); - printf("\n(1st) restart record:\n"); - printf("CurrentLsn = %Lx\n", sle64_to_cpu(rr->current_lsn)); - printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); - printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); - printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); - printf("Flags = 0x%x\n", le16_to_cpu(rr->flags)); - printf("SeqNumberBits = %u (0x%x)\n", le32_to_cpu(rr->seq_number_bits), - le32_to_cpu(rr->seq_number_bits)); - printf("RestartAreaLength = 0x%x\n", - le16_to_cpu(rr->restart_area_length)); - printf("ClientArrayOffset = 0x%x\n", - le16_to_cpu(rr->client_array_offset)); - printf("FileSize = %Lu (0x%Lx)\n", le64_to_cpu(rr->file_size), - le64_to_cpu(rr->file_size)); - if (le64_to_cpu(rr->file_size) != l) - puts("$LogFile restart area indicates a log file size" - "different from the actual size!"); - printf("LastLsnDataLength = 0x%x\n", - le32_to_cpu(rr->last_lsn_data_length)); - printf("RecordLength = 0x%x\n", le16_to_cpu(rr->record_length)); - printf("LogPageDataOffset = 0x%x\n", - le16_to_cpu(rr->log_page_data_offset)); - for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { - printf("\nRestart client record number %i:\n", client); - printf("OldestLsn = 0x%Lx\n", sle64_to_cpu(cr->oldest_lsn)); - printf("ClientRestartLsn = 0x%Lx\n", - sle64_to_cpu(cr->client_restart_lsn)); - printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); - printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); - printf("SeqNumber = 0x%Lx\n", le64_to_cpu(cr->seq_number)); - printf("ClientNameLength = 0x%x\n", - le32_to_cpu(cr->client_name_length)); - if (le32_to_cpu(cr->client_name_length)) { - // convert to ascii and print out. - // printf("ClientName = %u\n", le16_to_cpu(cr->client_name)); - } - /* Size of a restart client record is fixed at 0xa0 bytes. */ - cr = (RESTART_CLIENT*)((char*)cr + 0xa0); - } -skip_rstr_pass: - if (pass == 1) { - rph = (RESTART_PAGE_HEADER*)((char*)rph + lps); - ++pass; - goto pass_loc; - } - rcrd_ph = (RECORD_PAGE_HEADER*)rph; - /* Reuse pass for log record clienter. */ - pass = 0; - printf("\nFinished with restart area. Beginning with log area.\n"); -rcrd_pass_loc: - rcrd_ph = (RECORD_PAGE_HEADER*)((char*)rcrd_ph + lps); - if ((char*)rcrd_ph + lps > (char*)lfd + l) - goto end_of_rcrd_passes; - printf("\nLog record page number %i", pass); - if (!is_rcrd_record(rcrd_ph->magic)) { - for (i = 0; i < lps; i++) - if (((char*)rcrd_ph)[i] != (char)-1) - break; - if (i < lps) - puts(" is corrupt (magic RCRD is missing)."); - else - puts(" is empty."); - pass++; - goto rcrd_pass_loc; - } else - printf(":"); - /* Dump log record page */ - printf("\nmagic = RCRD\n"); - printf("copy.last_lsn/file_offset = 0x%Lx\n", - le64_to_cpu(rcrd_ph->copy.last_lsn)); - printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); - printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); - printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); - printf("header.next_record_offset = 0x%Lx\n", - le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); - printf("header.last_end_lsn = 0x%Lx\n", - le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); - /* - * Where does the 0x40 come from? Is it just usa_offset + - * usa_client * 2 + 7 & ~7 or is it derived from somewhere? - */ - lr = (LOG_RECORD*)((char*)rcrd_ph + 0x40); - client = 0; -log_record_pass: - printf("\nLog record %i:\n", client); - printf("this lsn = 0x%Lx\n", le64_to_cpu(lr->this_lsn)); - printf("client previous lsn = 0x%Lx\n", - le64_to_cpu(lr->client_previous_lsn)); - printf("client undo next lsn = 0x%Lx\n", - le64_to_cpu(lr->client_undo_next_lsn)); - printf("client data length = 0x%x\n", - le32_to_cpu(lr->client_data_length)); - printf("client_id.seq_number = 0x%x\n", - le16_to_cpu(lr->client_id.seq_number)); - printf("client_id.client_index = 0x%x\n", - le16_to_cpu(lr->client_id.client_index)); - printf("record type = 0x%x\n", le32_to_cpu(lr->record_type)); - printf("transaction_id = 0x%x\n", le32_to_cpu(lr->transaction_id)); - printf("flags = 0x%x:", lr->flags); - if (!lr->flags) - printf(" NONE\n"); - else { - int _b = 0; - - if (lr->flags & LOG_RECORD_MULTI_PAGE) { - printf(" LOG_RECORD_MULTI_PAGE"); - _b = 1; - } - if (lr->flags & ~LOG_RECORD_MULTI_PAGE) { - if (_b) - printf(" |"); - printf(" Unknown flags"); - } - printf("\n"); - } - printf("redo_operation = 0x%x\n", le16_to_cpu(lr->redo_operation)); - printf("undo_operation = 0x%x\n", le16_to_cpu(lr->undo_operation)); - printf("redo_offset = 0x%x\n", le16_to_cpu(lr->redo_offset)); - printf("redo_length = 0x%x\n", le16_to_cpu(lr->redo_length)); - printf("undo_offset = 0x%x\n", le16_to_cpu(lr->undo_offset)); - printf("undo_length = 0x%x\n", le16_to_cpu(lr->undo_length)); - printf("target_attribute = 0x%x\n", le16_to_cpu(lr->target_attribute)); - printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); - printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); - printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); - printf("target_vcn = 0x%Lx\n", sle64_to_cpu(lr->target_vcn)); - if (le16_to_cpu(lr->lcns_to_follow) > 0) - printf("Array of lcns:\n"); - for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) - printf("lcn_list[%i].lcn = 0x%Lx\n", i, - sle64_to_cpu(lr->lcn_list[i].lcn)); - client++; - lr = (LOG_RECORD*)((char*)lr + 0x70); - if (((char*)lr + 0x70 <= (char*)rcrd_ph + - le64_to_cpu(rcrd_ph->header.packed.next_record_offset))) - goto log_record_pass; - pass++; - goto rcrd_pass_loc; -end_of_rcrd_passes: -log_file_error: - printf("\n"); - /* Set return code to 0. */ - i = 0; -final_exit: - if (lfd) - free(lfd); - if (ctx) - ntfs_put_attr_search_ctx(ctx); - if (m) - free(m); - if (vol && ntfs_umount(vol, 0)) - ntfs_umount(vol, 1); - return i; -error_exit: - i = 1; - goto final_exit; -} - diff --git a/ntfstools/ntfsfix.8.in b/ntfstools/ntfsfix.8.in deleted file mode 100644 index eed93b8a..00000000 --- a/ntfstools/ntfsfix.8.in +++ /dev/null @@ -1,56 +0,0 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" First parameter, NAME, should be all caps -.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection -.\" other parameters are allowed: see man(7), man(1) -.TH NTFSFIX 8 "July 2001" "Linux-NTFS version @VERSION@" -.\" Please adjust this date whenever revising the manpage. -.\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -ntfsfix \- tool for fixing NTFS partitions altered by the Linux kernel NTFS driver. -.SH SYNOPSIS -.B ntfsfix -.I device -.SH DESCRIPTION -This manual page documents briefly the -.B ntfsfix -command. -.PP -.\" TeX users may be more comfortable with the \fB\fP and -.\" \fI\fP escape sequences to invode bold face and italics, -.\" respectively. -\fBntfsfix\fP is a program that fixes NTFS partitions altered in any -manner with the Linux NTFS driver. \fBntfsfix\fP is \fBNOT\fP a Linux -version of chkdsk. It only tries to leave the NTFS partition in a -not-so-inconsistent state after the NTFS driver has written to it. -.sp -\fBntfsfix\fP appeared because MS chkdsk is well known for its -stupidity when fixing altered partitions. Because the main problems -are journal files, \fBntfsfix\fP aims to fix those issues. -.sp -Running ntfsfix after mounting NTFS partitions read-write is recommended -for reducing the chance of severe data loss when NT/W2K tries to remount -the affected partition(s). -.sp -In order to use \fBntfsfix\fP you must unmount the NTFS partition, and run -ntfsfix device, where device is the NTFS partition. After this, you can -safely reboot into NT/W2K. Please note that \fBntfsfix\fP is not a -chkdsk-like tool, and so is not guaranteed that it could fix all the -alterations provoked by the NTFS driver. - -.SH SEE ALSO -.BR mkntfs (8). -.br -.SH AUTHOR -This manual page was written by David Martínez Moreno -, for the Debian GNU/Linux -system (but may be used by others). diff --git a/ntfstools/ntfsfix.c b/ntfstools/ntfsfix.c deleted file mode 100644 index e852061b..00000000 --- a/ntfstools/ntfsfix.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - * $Id$ - * - * NtfsFix - Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2002 Anton Altaparmakov. - * - * This utility will attempt to fix a partition that has been damaged by the - * current Linux-NTFS driver. It should be run after dismounting a NTFS - * partition that has been mounted read-write under Linux and before rebooting - * into Windows NT/2000. NtfsFix can be run even after Windows has had mounted - * the partition, but it might be too late and irreversible damage to the data - * might have been done already. - * - * Anton Altaparmakov - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS source - * in the file COPYING); if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * WARNING: This program might not work on architectures which do not allow - * unaligned access. For those, the program would need to start using - * get/put_unaligned macros (#include ), but not doing it yet, - * since NTFS really mostly applies to ia32 only, which does allow unaligned - * accesses. We might not actually have a problem though, since the structs are - * defined as being packed so that might be enough for gcc to insert the - * correct code. - * - * If anyone using a non-little endian and/or an aligned access only CPU tries - * this program please let me know whether it works or not! - * - * Anton Altaparmakov - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include - -#include "types.h" -#include "attrib.h" -#include "mft.h" -#include "disk_io.h" -#include "logfile.h" - -int main(int argc, char **argv) -{ - s64 l, br; - const char *EXEC_NAME = "NtfsFix"; - const char *OK = "OK"; - const char *FAILED = "FAILED"; - unsigned char *m = NULL, *m2 = NULL; - ntfs_volume *vol; - unsigned long mnt_flags; - int i; - u16 flags; - BOOL done, force = FALSE; - - printf("\n"); - if (argc != 2 || !argv[1]) { - printf("%s v%s - Attempt to fix an NTFS partition that " - "has been damaged by the\nLinux NTFS driver. Note that " - "you should run it every time after you have used\nthe " - "Linux NTFS driver to write to an NTFS partition to " - "prevent massive data\ncorruption from happening when " - "Windows mounts the partition.\nIMPORTANT: Run this " - "only *after* unmounting the partition in Linux but " - "*before*\nrebooting into Windows NT/2000/XP or you " - "*will* suffer! - You have been warned!\n\n" - /* Generic copyright / disclaimer. */ - "Copyright (c) 2000-2002 Anton Altaparmakov.\n\n" - "%s is free software, released under the GNU " - "General Public License and you\nare welcome to " - "redistribute it under certain conditions.\n" - "%s comes with ABSOLUTELY NO WARRANTY; for details " - "read the file GNU\nGeneral Public License to be found " - "in the file COPYING in the main Linux-NTFS\n" - "distribution directory.\n\n" - /* Generic part ends here. */ - "Syntax: ntfsfix partition_or_file_name\n" - " e.g. ntfsfix /dev/hda6\n\n", EXEC_NAME, - VERSION, EXEC_NAME, EXEC_NAME); - fprintf(stderr, "Error: incorrect syntax\n"); - exit(1); - } - if (!ntfs_check_if_mounted(argv[1], &mnt_flags)) { - if ((mnt_flags & NTFS_MF_MOUNTED) && - !(mnt_flags & NTFS_MF_READONLY) && !force) { - fprintf(stderr, "Refusing to operate on read-write " - "mounted device %s.\n", argv[1]); - exit(1); - } - } else - fprintf(stderr, "Failed to determine whether %s is mounted: " - "%s\n", argv[1], strerror(errno)); - /* Attempt a full mount first. */ - printf("Mounting volume... "); - vol = ntfs_mount(argv[1], 0); - if (vol) { - puts(OK); - printf("\nProcessing of $MFT and $MFTMirr completed " - "successfully.\n\n"); - goto mount_ok; - } - puts(FAILED); - - puts("Attempting to correct errors."); - - vol = ntfs_startup_volume(argv[1], 0); - if (!vol) { - puts(FAILED); - perror("Failed to startup volume"); - fprintf(stderr, "Volume is corrupt. You should run chkdsk."); - goto error_exit; - } - - puts("Processing $MFT and $MFTMirr."); - - /* Load data from $MFT and $MFTMirr and compare the contents. */ - m = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); - m2 = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); - if (!m || !m2) { - perror("Failed to allocate memory"); - goto error_exit; - } - - printf("Reading $MFT... "); - l = ntfs_attr_mst_pread(vol->mft_na, 0, vol->mftmirr_size, - vol->mft_record_size, m); - if (l != vol->mftmirr_size) { - puts(FAILED); - if (l != -1) - errno = EIO; - perror("Failed to read $MFT"); - goto error_exit; - } - puts(OK); - - printf("Reading $MFTMirr... "); - l = ntfs_attr_mst_pread(vol->mftmirr_na, 0, vol->mftmirr_size, - vol->mft_record_size, m2); - if (l != vol->mftmirr_size) { - puts(FAILED); - if (l != -1) - errno = EIO; - perror("Failed to read $MFTMirr"); - goto error_exit; - } - puts(OK); - - /* - * FIXME: Need to actually check the $MFTMirr for being real. Otherwise - * we might corrupt the partition if someone is experimenting with - * software RAID and the $MFTMirr is not actually in the position we - * expect it to be... )-: - * FIXME: We should emit a warning it $MFTMirr is damaged and ask - * user whether to recreate it from $MFT or whether to abort. - The - * warning needs to include the danger of software RAID arrays. - * Maybe we should go as far as to detect whether we are running on a - * MD disk and if yes then bomb out right at the start of the program? - */ - - printf("Comparing $MFTMirr to $MFT... "); - done = FALSE; - for (i = 0; i < vol->mftmirr_size; ++i) { - const char *ESTR[12] = { "$MFT", "$MFTMirr", "$LogFile", - "$Volume", "$AttrDef", "root directory", "$Bitmap", - "$Boot", "$BadClus", "$Secure", "$UpCase", "$Extend" }; - const char *s; - - if (i < 12) - s = ESTR[i]; - else if (i < 16) - s = "system file"; - else - s = "mft record"; - - if (is_baad_recordp(m + i * vol->mft_record_size)) { - puts("FAILED"); - fprintf(stderr, "$MFT error: Incomplete multi sector " - "transfer detected in %s.\nCannot " - "handle this yet. )-:\n", s); - goto error_exit; - } - if (!is_mft_recordp(m + i * vol->mft_record_size)) { - puts("FAILED"); - fprintf(stderr, "$MFT error: Invalid mft record for " - "%s.\nCannot handle this yet. )-:\n", - s); - goto error_exit; - } - if (is_baad_recordp(m2 + i * vol->mft_record_size)) { - puts("FAILED"); - fprintf(stderr, "$MFTMirr error: Incomplete multi " - "sector transfer detected in %s.\n", s); - goto error_exit; - } - if (!is_mft_recordp(m2 + i * vol->mft_record_size)) { - puts("FAILED"); - fprintf(stderr, "$MFTMirr error: Invalid mft record " - "for %s.\n", s); - goto error_exit; - } - if (memcmp((u8*)m + i * vol->mft_record_size, (u8*)m2 + - i * vol->mft_record_size, - ntfs_get_mft_record_data_size((MFT_RECORD*)( - (u8*)m + i * vol->mft_record_size)))) { - if (!done) { - done = TRUE; - puts(FAILED); - printf("Correcting differences in " - "$MFTMirr... "); - } - br = ntfs_write_mft_record(vol, i, (MFT_RECORD*)(m + - i * vol->mft_record_size)); - if (br) { - puts(FAILED); - perror("Error correcting $MFTMirr"); - goto error_exit; - } - } - } - puts(OK); - - free(m); - free(m2); - m = m2 = NULL; - - printf("Processing of $MFT and $MFTMirr completed successfully.\n\n"); - if (ntfs_umount(vol, 0)) - ntfs_umount(vol, 1); - vol = ntfs_mount(argv[1], 0); - if (!vol) { - perror("Remount failed"); - goto error_exit; - } -mount_ok: - m = NULL; - - /* Check NTFS version is ok for us (in $Volume) */ - printf("NTFS volume version is %i.%i.\n\n", vol->major_ver, - vol->minor_ver); - if (ntfs_is_version_supported(vol)) { - fprintf(stderr, "Error: Unknown NTFS version.\n"); - goto error_exit; - } - - printf("Setting required flags on partition... "); - /* - * Set chkdsk flag, i.e. mark the partition dirty so chkdsk will run - * and fix it for us. - */ - flags = vol->flags | VOLUME_IS_DIRTY; - /* If NTFS volume version >= 2.0 then set mounted on NT4 flag. */ - if (vol->major_ver >= 2) - flags |= VOLUME_MOUNTED_ON_NT4; - if (ntfs_set_volume_flags(vol, flags)) { - puts(FAILED); - fprintf(stderr, "Error setting volume flags.\n"); - goto error_exit; - } - puts(OK); - printf("\n"); - - printf("Going to empty the journal ($LogFile)... "); - if (ntfs_reset_logfile(vol)) { - puts(FAILED); - perror("Failed to reset $LogFile"); - goto error_exit; - } - puts(OK); - printf("\n"); - - if (vol->major_ver >= 3) { - /* FIXME: If on NTFS 3.0+, check for presence of the usn journal and - disable it (if present) as Win2k might be unhappy otherwise and Bad - Things(TM) could happen depending on what applications are actually - using it for. */ - } - - /* FIXME: Should we be marking the quota out of date, too? */ - - /* That's all for now! */ - printf("NTFS partition %s was processed successfully.\n", - vol->dev_name); - /* Set return code to 0. */ - i = 0; -final_exit: - if (m) - free(m); - if (m2) - free(m2); - if (vol && ntfs_umount(vol, 0)) - ntfs_umount(vol, 1); - return i; -error_exit: - i = 1; - goto final_exit; -} - diff --git a/ntfstools/ntfsinfo.8.in b/ntfstools/ntfsinfo.8.in deleted file mode 100644 index edec6976..00000000 --- a/ntfstools/ntfsinfo.8.in +++ /dev/null @@ -1,25 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. -.\" This file may be copied under the terms of the GNU Public License. -.\" -.TH NTFSINFO 8 "May 2002" "Linux-NTFS version @VERSION@" -.SH NAME -ntfsinfo \- dump a file's attributes -.SH SYNOPSIS -.B ntfsinfo -.I device -.I inode-number -.SH DESCRIPTION -.B ntfsinfo -will dump the attributes of inode -.IR inode-number . -.PP -.SH AUTHOR -.B ntfsinfo -was written by Matthew J. Fanto (fanto1mj@cmich.edu). -.SH AVAILABILITY -.B ntfsinfo -is part of the linux-ntfs package and is available from -http://linux-ntfs.sourceforge.net/. - - diff --git a/ntfstools/ntfsinfo.c b/ntfstools/ntfsinfo.c deleted file mode 100644 index 45b6d1bb..00000000 --- a/ntfstools/ntfsinfo.c +++ /dev/null @@ -1,195 +0,0 @@ -/*z - * $Id$ - * - * ntfsinfo - Part of the Linux-NTFS project. - * - * Copyright (c) 2002 Matthew J. Fanto - * Copyright (c) 2002 Anton Altaparmakov - * Copyright (c) 2002 Richard Russon - * - * This utility will dump a file's attributes. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include "mft.h" -#include "attrib.h" -#include "layout.h" -#include "inode.h" - -void get_file_attribute_value(const char *dev, long int i); -void print_standard_information_attr(ntfs_attr_search_ctx * ctx); -void print_file_name_attr(ntfs_attr_search_ctx * ctx); - - -#define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000) - -int main(int argc, char **argv) -{ - const char *AUTHOR = "Matthew J. Fanto"; - const char *EXEC_NAME = "ntfsinfo"; - const char *locale; - long i; - - locale = setlocale(LC_ALL, ""); - if (!locale) { - char *locale; - - locale = setlocale(LC_ALL, NULL); - printf("Failed to set locale, using default (%s).\n", locale); - } else - printf("Using locale %s.\n", locale); - - if (argc < 3 || argc > 4) { - fprintf(stderr, "%s v%s - %s\n", EXEC_NAME, VERSION, AUTHOR); - fprintf(stderr, "Usage: ntfsinfo device inode\n"); - exit(1); - } - - else { - i = atoll(argv[2]); - get_file_attribute_value(argv[1], i); - } - - return 0; -} - -void get_file_attribute_value(const char *dev, long int i) -{ - - MFT_REF mref; - MFT_RECORD *mrec = NULL; - //ATTR_RECORD *attr = NULL; - //FILE_NAME_ATTR *file_name_attr = NULL; - //STANDARD_INFORMATION *standard_information = NULL; - //SECURITY_DESCRIPTOR_RELATIVE *security_descriptor = NULL; - ntfs_attr_search_ctx *ctx = NULL; - ntfs_volume *vol = NULL; - //char *file_name; - ntfs_inode *inode = NULL; - - vol = ntfs_mount(dev, 0); - - mref = (MFT_REF) i; - inode = ntfs_open_inode(vol, mref); - - if (ntfs_read_file_record(vol, mref, &mrec, NULL)) { - perror("Error reading file record!\n"); - exit(1); - } - - ctx = ntfs_get_attr_search_ctx(inode, mrec); - -// print_file_name_attr(ctx); - -// ctx = ntfs_get_attr_search_ctx(inode, mrec); //need to fix this - - print_standard_information_attr(ctx); -} - - -s64 ntfs2time(s64 time) -{ - s64 t; - printf("Original Time: %Li\n",time); - t = time - NTFS_TIME_OFFSET; - t = t / 10000000; - return t; - - -} - -void print_standard_information_attr(ntfs_attr_search_ctx *ctx) -{ - ATTR_RECORD *attr = NULL; - STANDARD_INFORMATION *standard_information_attr = NULL; - - if (ntfs_lookup_attr - (AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - perror("Error looking up $STANDARD_INFORMATION!\n"); - exit(1); - } - - attr = ctx->attr; - - standard_information_attr = - (STANDARD_INFORMATION *) ((char *) attr + - le16_to_cpu(attr->value_offset)); - - printf("Creation time: %Li\n", - ntfs2time(standard_information_attr->creation_time)); -/* printf("Last Data Change Time: %Li\n", - ntfs2time(standard_information_attr->last_data_change_time)); - printf("Last MFT Change Time: %Li\n", - ntfs2time(standard_information_attr->last_mft_change_time)); - printf("Last Access Time: %Li\n", - ntfs2time(standard_information_attr->last_access_time)); - printf("Maxium Versions: %d\n", - standard_information_attr->maximum_versions); - printf("Version Number: %d\n", - standard_information_attr->version_number); - printf("Class ID: %d\n", - standard_information_attr->class_id); - printf("Owner ID: %d\n", - standard_information_attr->owner_id); - printf("Security ID: %d\n", - standard_information_attr->security_id); - -*/ -} - -void print_file_name_attr(ntfs_attr_search_ctx *ctx) -{ - ATTR_RECORD *attr = NULL; - ntfs_attr_search_ctx *c = ctx; - FILE_NAME_ATTR *file_name_attr = NULL; - char *file_name; - - if (ntfs_lookup_attr(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - perror("Error looking up $FILE_NAME_ATTR!\n"); - exit(1); - } - - attr = ctx->attr; - ctx = c; - - file_name_attr = - (FILE_NAME_ATTR *) ((char *) attr + - le16_to_cpu(attr->value_offset)); - - file_name = malloc(file_name_attr->file_name_length * sizeof (char)); - - ntfs_ucstombs(file_name_attr->file_name, - file_name_attr->file_name_length, &file_name, - file_name_attr->file_name_length); - - printf("File Name: %s\n", file_name); - printf("File Name Length: %d\n", file_name_attr->file_name_length); - printf("Allocated Size: %Li\n",sle64_to_cpu(file_name_attr->allocated_size)); - printf("Data Size: %Li\n",sle64_to_cpu(file_name_attr->data_size)); -} - -/*void print_security_descriptor_attr(SECURITY_DESCRIPTOR_RELATIVE *security_descriptor) -{ - -}*/ diff --git a/ntfstools/ntfslabel.8.in b/ntfstools/ntfslabel.8.in deleted file mode 100644 index 4b9a05bb..00000000 --- a/ntfstools/ntfslabel.8.in +++ /dev/null @@ -1,54 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. -.\" This file may be copied under the terms of the GNU Public License. -.\" Adapted from e2fsprogs-1.26/misc/e2label.8.in by Theodore Ts'o. -.\" -.TH NTFSLABEL 8 "April 2002" "Linux-NTFS version @VERSION@" -.SH NAME -ntfslabel \- display/change the label on an ntfs file system -.SH SYNOPSIS -.B ntfslabel -.I device -[ -.I new-label -] -.SH DESCRIPTION -.B ntfslabel -will display or change the file system label on the ntfs file system located on -.IR device . -.PP -If the optional argument -.I new-label -is not present, -.B ntfslabel -will simply display the current file system label. -.PP -If the optional argument -.I new-label -is present, then -.B ntfslabel -will set the file system label to be -.IR new-label . -NTFS file system labels can be at most 128 Unicode characters long; if -.I new-label -is longer than 128 Unicode characters, -.B ntfslabel -will truncate it and print a warning message. -.PP -It is also possible to set the file system label using the -.B \-L -option of -.BR mkntfs (8) -during creation of the file system. -.PP -.SH AUTHOR -.B ntfslabel -was written by Matthew J. Fanto (fanto1mj@cmich.edu). This man page was written -by Anton Altaparmakov (aia21@cantab.net). -.SH AVAILABILITY -.B ntfslabel -is part of the linux-ntfs package and is available from -http://linux-ntfs.sourceforge.net/. -.SH SEE ALSO -.BR mkntfs (8) - diff --git a/ntfstools/ntfslabel.c b/ntfstools/ntfslabel.c deleted file mode 100644 index 5d07c0d0..00000000 --- a/ntfstools/ntfslabel.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * $Id$ - * - * ntfslabel - Part of the Linux-NTFS project. - * - * Copyright (c) 2002 Matthew J. Fanto - * Copyright (c) 2002 Anton Altaparmakov - * Copyright (c) 2002 Richard Russon - * - * This utility will display/change the label on an NTFS partition. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include -#include -#include -#include -#include - -#include "debug.h" -#include "mft.h" - -/* - * print_label - display the current label of a mounted ntfs partition. - * @dev: device to read the label from - * @mnt_flags: mount flags of the device or 0 if not mounted - * @mnt_point: mount point of the device or NULL - * - * Print the label of the device @dev to stdout. - */ -void print_label(const char *dev, const unsigned long mnt_flags, - const char *mnt_point) -{ - ntfs_volume *vol; - - if (mnt_point) { - // Try ioctl and finish if present. - // goto finished; - } - if ((mnt_flags & (NTFS_MF_MOUNTED | NTFS_MF_READONLY)) == - NTFS_MF_MOUNTED) { - fprintf(stderr, "%s is mounted read-write, results may be " - "unreliable.\n", dev); - } - vol = ntfs_mount(dev, MS_RDONLY); - if (!vol) { - fprintf(stderr, "ntfs_mount() on device %s failed: %s\n", dev, - strerror(errno)); - exit(1); - } -//finished: - printf("%s\n", vol->vol_name); - if (ntfs_umount(vol, 0)) - ntfs_umount(vol, 1); -} - -/* - * resize_resident_attribute_value - resize a resident attribute - * @m: mft record containing attribute to resize - * @a: attribute record (inside @m) which to resize - * @new_vsize: the new attribute value size to resize the attribute to - * - * Return 0 on success and -1 with errno = ENOSPC if not enough space in the - * mft record. - */ -int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, - const u32 new_vsize) -{ - int new_alen, new_muse; - - /* New attribute length and mft record bytes used. */ - new_alen = (le16_to_cpu(a->value_offset) + new_vsize + 7) & ~7; - new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + - new_alen; - /* Check for sufficient space. */ - if (new_muse > le32_to_cpu(m->bytes_allocated)) { - errno = ENOSPC; - return -1; - } - /* Move attributes behind @a to their new location. */ - memmove((char*)a + new_alen, (char*)a + le32_to_cpu(a->length), - le32_to_cpu(m->bytes_in_use) - ((char*)a - (char*)m) - - le32_to_cpu(a->length)); - /* Adjust @m to reflect change in used space. */ - m->bytes_in_use = cpu_to_le32(new_muse); - /* Adjust @a to reflect new value size. */ - a->length = cpu_to_le32(new_alen); - a->value_length = cpu_to_le32(new_vsize); - return 0; -} - -/* - * change_label - change the current label on a device - * @dev: device to change the label on - * @mnt_flags: mount flags of the device or 0 if not mounted - * @mnt_point: mount point of the device or NULL - * @label: the new label - * - * Change the label on the device @dev to @label. - */ -void change_label(const char *dev, const unsigned long mnt_flags, - const char *mnt_point, char *label, BOOL force) -{ - ntfs_attr_search_ctx *ctx = NULL; - uchar_t *new_label = NULL; - MFT_RECORD *mrec = NULL; - ATTR_RECORD *a; - ntfs_volume *vol; - int label_len, err = 1; - - if (mnt_point) { - // Try ioctl and return if present. - // return; - } - if (mnt_flags & NTFS_MF_MOUNTED) { - /* If not the root fs or mounted read/write, refuse change. */ - if (!(mnt_flags & NTFS_MF_ISROOT) || - !(mnt_flags & NTFS_MF_READONLY)) { - if (!force) { - fprintf(stderr, "Refusing to change label on " - "read-%s mounted device %s.\n", - mnt_flags & NTFS_MF_READONLY ? - "only" : "write", dev); - return; - } - } - } - vol = ntfs_mount(dev, 0); - if (!vol) { - fprintf(stderr, "ntfs_mount() on device %s failed: %s\n", dev, - strerror(errno)); - exit(1); - } - if (ntfs_read_file_record(vol, (MFT_REF)FILE_Volume, &mrec, NULL)) { - perror("Error reading file record"); - goto err_out; - } - if (!(mrec->flags & MFT_RECORD_IN_USE)) { - fprintf(stderr, "Error: $Volume has been deleted. Run " - "chkdsk to fix this.\n"); - goto err_out; - } - ctx = ntfs_get_attr_search_ctx(NULL, mrec); - if (!ctx) { - perror("Failed to get attribute search context"); - goto err_out; - } - if (ntfs_lookup_attr(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - perror("Lookup of $VOLUME_NAME attribute failed"); - goto err_out; - } - a = ctx->attr; - if (a->non_resident) { - fprintf(stderr, "Error: Attribute $VOLUME_NAME must be " - "resident.\n"); - goto err_out; - } - label_len = ntfs_mbstoucs(label, &new_label, 0); - if (label_len == -1) { - perror("Unable to convert label string to Unicode"); - goto err_out; - } - label_len *= sizeof(uchar_t); - if (label_len > 0x100) { - fprintf(stderr, "New label is too long. Maximum %i characters " - "allowed. Truncating excess characters.\n", - 0x100 / sizeof(uchar_t)); - label_len = 0x100; - new_label[label_len / sizeof(uchar_t)] = cpu_to_le16(L'\0'); - } - if (resize_resident_attribute_value(mrec, a, label_len)) { - perror("Error resizing resident attribute"); - goto err_out; - } - memcpy((char*)a + le16_to_cpu(a->value_offset), new_label, label_len); - if (ntfs_write_mft_record(vol, (MFT_REF)FILE_Volume, mrec)) { - perror("Error writing MFT Record to disk"); - goto err_out; - } - err = 0; -err_out: - if (new_label) - free(new_label); - if (mrec) - free(mrec); - if (ntfs_umount(vol, 0)) - ntfs_umount(vol, 1); - if (err) - exit(1); -} - -int main(int argc, char **argv) -{ - const char *AUTHOR = "Matthew Fanto"; - char *EXEC_NAME = "ntfslabel"; - char *locale, *mnt_point = NULL; - unsigned long mnt_flags; - int err; - // FIXME:Implement option -F meaning force the change. - BOOL force = 0; - - locale = setlocale(LC_ALL, ""); - if (!locale) { - char *locale; - - locale = setlocale(LC_ALL, NULL); - Dprintf("Failed to set locale, using default (%s).\n", locale); - } else - Dprintf("Using locale %s.\n", locale); - if (argc && *argv) - EXEC_NAME = *argv; - if (argc < 2 || argc > 3) { - fprintf(stderr, "%s v%s - %s\n", EXEC_NAME, VERSION, AUTHOR); - fprintf(stderr, "Usage: ntfslabel device [newlabel]\n"); - exit(1); - } - err = ntfs_check_if_mounted(argv[1], &mnt_flags); - if (err) - fprintf(stderr, "Failed to determine whether %s is mounted: " - "%s\n", argv[1], strerror(errno)); - else if (mnt_flags & NTFS_MF_MOUNTED) { - // Not implemented yet. Will be used for ioctl interface to driver. - // mnt_point = ntfs_get_mount_point(argv[1]); - } - if (argc == 2) - print_label(argv[1], mnt_flags, mnt_point); - else - change_label(argv[1], mnt_flags, mnt_point, argv[2], force); - return 0; -} - diff --git a/ntfstools/ntfsresize.8.in b/ntfstools/ntfsresize.8.in deleted file mode 100644 index b2be7c28..00000000 --- a/ntfstools/ntfsresize.8.in +++ /dev/null @@ -1,117 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright 2002 by Szabolcs Szakacsits All Rights Reserved. -.\" -.TH NTFSRESIZE 8 "November 2002" "Linux\-NTFS @VERSION@" -.SH NAME -ntfsresize \- resize an NTFS filesystem -.SH SYNOPSIS -.B ntfsresize -[\fB\-fhin\fR] -[\fB\-s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR]] -.I device -.SH DESCRIPTION -The -.B ntfsresize -program non-destructively resizes Windows NT4, 2000, XP or .NET -NTFS filesystems. At present it can be used to shrink a -defragmented NTFS filesystem located on an unmounted -.I device -(usually a disk partition). The new volume will have -.I size -bytes. -The -.I size -parameter may have one of the optional modifiers -\fBk\fR, \fBM\fR, \fBG\fR, which means the -.I size -parameter is given in kilo-, mega- or gigabytes respectively. -.B ntfsresize -conforms to the SI, ATA, IEEE standards and the disk manufacturers -by using k=10^3, M=10^6 and G=10^9. -.PP -The -.B ntfsresize -program does not manipulate the size of partitions. -If you wish to shrink an NTFS partition, first use -.B ntfsresize -to shrink the size of the filesystem. Then you may use -.BR fdisk (8) -to shrink the size of the partition by deleting the -partition and recreating it with the smaller size. -.PP -.B IMPORTANT! -When recreating the partition with -.BR fdisk (8) -make sure you create it with the same starting -disk cylinder and partition type -as before and you do not make it smaller than the new size -of the NTFS filesystem! Otherwise you may lose your entire filesystem. -Also make sure you set the bootable flag for the partition if it -existed before. Failing to do so you might not be able to boot your -computer from the disk! -.PP -Note, -.B ntfsresize -schedules 'chkdsk' to make an NTFS consistency check -when you will boot Windows. If your partition was a -system partition than Windows may intentionally reboot after -the successful consistency check. - -.SH OPTIONS -.TP -.B -f -Forces ntfsresize to proceed with the filesystem resize operation, overriding -some safety checks which -.B ntfsresize -normally enforces. You can use this -parameter multiply times if you want to overcome every single safety checks. -.TP -.B -h -Display help and exit. -.TP -.B -i -Using this option you can calculate the smallest shrunken volume size supported. -This option will not make any changes to the filesystem. -.TP -.B -n -You can use this option to make a test run before doing the real resize operation. -Volume will be opened read-only and -.B ntfsresize -displays what it would do if it were to resize the filesystem. -.TP -.B -s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] -Shrink volume to \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes. -The optional modifiers \fBk\fR, \fBM\fR, \fBG\fR mean the -.I size -parameter is given in kilo-, mega- or gigabytes respectively. -Conforming to standards, k=10^3, M=10^6 and G=10^9. -.SH BUGS -No bugs are known or has been reported so far in the current version. -If you find otherwise, please report it to -(no subscription needed). It's also strongly advised you -.B MAKE SURE YOU HAVE A BACKUP -of your important data in case of an unexpected failure. -.PP -Future work is planned to include support for volume enlargement -and resizing fragmented NTFS volumes. -Please note, Windows 2000, XP and .NET have built in NTFS defragmenter. -.SH AVAILABILITY -.B ntfsresize -is part of the linux-ntfs package and is available from -http://linux-ntfs.sf.net/ as source and pre-compiled binary. -.SH AUTHOR -.B ntfsresize -has been written by -Szabolcs Szakacsits . -.SH ACKNOWLEDGEMENT -Many thanks to Anton Altaparmakov and Richard Russon (FlatCap) -for libntfs, excellent documentation, comments, testing and fixes, -moreover to Theodore Ts'o whose -.BR resize2fs (8) -man page formed the basis of this page. -.SH SEE ALSO -.BR fdisk (8), -.BR cfdisk (8), -.BR sfdisk (8), -.BR parted (8), -.BR mkntfs (8) diff --git a/ntfstools/ntfsresize.c b/ntfstools/ntfsresize.c deleted file mode 100644 index d7d2ab65..00000000 --- a/ntfstools/ntfsresize.c +++ /dev/null @@ -1,914 +0,0 @@ -/** - * ntfsresize - Part of the Linux-NTFS project. - * - * Copyright (c) 2002 Szabolcs Szakacsits - * - * This utility will resize an NTFS volume. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include - -#include "debug.h" -#include "types.h" -#include "support.h" -#include "endians.h" -#include "bootsect.h" -#include "disk_io.h" -#include "attrib.h" -#include "volume.h" -#include "mft.h" -#include "bitmap.h" -#include "inode.h" -#include "runlist.h" - -const char *EXEC_NAME = "ntfsresize"; - -static const char *ntfs_report_banner = -"\nReport bugs to linux-ntfs-dev@lists.sf.net. " -"Homepage: http://linux-ntfs.sf.net\n"; - -static const char *resize_warning_msg = -"WARNING: Every sanity check passed and only the DANGEROUS operations left.\n" -"Please make sure all your important data had been backed up in case of an\n" -"unexpected failure!\n"; - -static const char *resize_important_msg = -"NTFS had been successfully resized on device '%s'.\n" -"You can go on to resize the device e.g. with 'fdisk'.\n" -"IMPORTANT: When recreating the partition, make sure you\n" -" 1) create it with the same starting disk cylinder\n" -" 2) create it with the same partition type (usually 7, HPFS/NTFS)\n" -" 3) do not make it smaller than the new NTFS filesystem size\n" -" 4) set the bootable flag for the partition if it existed before\n" -"Otherwise you may lose your data or can't boot your computer from the disk!\n"; - -static const char *fragmented_volume_msg = -"The volume end is fragmented, this case is not yet supported. Defragment it\n" -"(Windows 2000, XP and .NET have built in defragmentation tool) and try again.\n"; - -struct { - int verbose; - int debug; - int ro_flag; - int force; - int info; - s64 bytes; - char *volume; -} opt; - -struct bitmap { - u8 *bm; - s64 size; -}; - -struct progress_bar { - u64 start; - u64 stop; - int resolution; - float unit; -}; - -ntfs_volume *vol = NULL; -struct bitmap lcn_bitmap; - -#define NTFS_MBYTE (1000 * 1000) - -#define ERR_PREFIX "ERROR" -#define PERR_PREFIX ERR_PREFIX "(%d): " -#define NERR_PREFIX ERR_PREFIX ": " - -#define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) - - -void perr_printf(const char *fmt, ...) -{ - va_list ap; - int eo = errno; - - fprintf(stdout, PERR_PREFIX, eo); - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); - va_end(ap); - printf(": %s\n", strerror(eo)); - fflush(stdout); - fflush(stderr); -} - - -int err_exit(const char *fmt, ...) -{ - va_list ap; - - fprintf(stdout, NERR_PREFIX); - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); - va_end(ap); - fflush(stdout); - fflush(stderr); - exit(1); -} - - -int perr_exit(const char *fmt, ...) -{ - va_list ap; - int eo = errno; - - fprintf(stdout, PERR_PREFIX, eo); - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); - va_end(ap); - printf(": %s\n", strerror(eo)); - fflush(stdout); - fflush(stderr); - exit(1); -} - - -void usage() -{ - printf("\n"); - printf ("Usage: %s [-fhin] [-s size[k|M|G]] device\n", EXEC_NAME); - printf("Shrink a defragmented NTFS volume.\n"); - printf("\n"); - Dprintf(" -d Show debug information\n"); - printf (" -f Force to progress (DANGEROUS)\n"); - printf (" -h This help text\n"); - printf (" -i Calculate the smallest shrunken size supported (read-only)\n"); - printf (" -n Make a test run without write operations (read-only)\n"); - printf (" -s size[k|M|G] Shrink volume to size[k|M|G] bytes (k=10^3, M=10^6, G=10^9)\n"); -/* printf (" -v Verbose operation\n"); */ - printf(ntfs_report_banner); - exit(1); -} - - -/* Copy-paste from e2fsprogs */ -void proceed_question(void) -{ - char buf[256]; - const char *short_yes = "yY"; - - fflush(stdout); - fflush(stderr); - printf("Are you sure you want to proceed (y/[n])? "); - buf[0] = 0; - fgets(buf, sizeof(buf), stdin); - if (strchr(short_yes, buf[0]) == 0) { - printf("OK quitting. NO CHANGES has been made to your NTFS volume.\n"); - exit(1); - } -} - - -s64 get_new_volume_size(char *s) -{ - s64 size; - char *suffix; - - size = strtoll(s, &suffix, 10); - if (size <= 0 || errno == ERANGE) - err_exit("Illegal new volume size\n"); - - if (!*suffix) - return size; - - if (strlen(suffix) > 1) - usage(); - - /* We follow the SI prefixes: - http://physics.nist.gov/cuu/Units/prefixes.html - http://physics.nist.gov/cuu/Units/binary.html - Disk partitioning tools use prefixes as, - k M G - old fdisk 2^10 2^20 10^3*2^20 - recent fdisk 10^3 10^6 10^9 - cfdisk 10^3 10^6 10^9 - sfdisk 2^10 2^20 - parted 2^10 2^20 (may change) - fdisk (DOS) 2^10 2^20 - */ - /* FIXME: check for overflow */ - switch (*suffix) { - case 'G': - size *= 1000; - case 'M': - size *= 1000; - case 'k': - size *= 1000; - break; - default: - usage(); - } - - return size; -} - - -void parse_options(int argc, char **argv) -{ - char *s; - int i; - - printf("%s v%s\n", EXEC_NAME, VERSION); - - memset(&opt, 0, sizeof(opt)); - - while ((i = getopt(argc, argv, "dfhins:")) != EOF) - switch (i) { - case 'd': - opt.debug = 1; - break; - case 'f': - opt.force++; - break; - case 'h': - usage(); - case 'i': - opt.info = 1; - break; - case 'n': - opt.ro_flag = MS_RDONLY; - break; - case 's': - opt.bytes = get_new_volume_size(optarg); - break; - case 'v': - opt.verbose++; - break; - default: - usage(); - } - if (optind == argc) - usage(); - opt.volume = argv[optind++]; - if (optind < argc) - usage(); - - stderr = stdout; - if (!opt.debug) - if (!(stderr = fopen("/dev/null", "rw"))) - perr_exit("Couldn't open /dev/null"); - - - /* If no '-s size' then estimate smallest shrunken volume size */ - if (!opt.bytes) - opt.info = 1; - - if (opt.info) { - if (opt.bytes) { - printf(NERR_PREFIX "It makes no sense to use -i and " - "-s together.\n"); - usage(); - } - opt.ro_flag = MS_RDONLY; - } -} - - -s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) -{ - s64 bm_bsize; - - bm_bsize = rounded_up_division(nr_clusters, 8); - - /* Needs to be multiple of 8 bytes */ - bm_bsize = (bm_bsize + 7) & ~7; - Dprintf("Bitmap byte size : %lld (%lld clusters)\n", - bm_bsize, rounded_up_division(bm_bsize, vol->cluster_size)); - - return bm_bsize; -} - - -void build_lcn_usage_bitmap(ATTR_RECORD *a) -{ - run_list *rl; - int i, j; - - if (!a->non_resident) - return; - - if (!(rl = ntfs_decompress_mapping_pairs(vol, a, NULL))) - perr_exit("ntfs_decompress_mapping_pairs"); - - for (i = 0; rl[i].length; i++) { - if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) - continue; - for (j = 0; j < rl[i].length; j++) { - u64 k = (u64)rl[i].lcn + j; - if (ntfs_get_and_set_bit(lcn_bitmap.bm, k, 1)) - err_exit("Cluster %lu referenced twice!\n" - "You didn't shutdown your Windows" - "properly?", k); - } - } - free(rl); -} - - -void walk_attributes(MFT_RECORD *mr) -{ - ntfs_attr_search_ctx *ctx; - - if (!(ctx = ntfs_get_attr_search_ctx(NULL, mr))) - perr_exit("ntfs_get_attr_search_ctx"); - - while (!ntfs_walk_attrs(ctx)) { - if (ctx->attr->type == AT_END) - break; - build_lcn_usage_bitmap(ctx->attr); - } - - ntfs_put_attr_search_ctx(ctx); -} - - -void get_bitmap_data(ntfs_volume *vol, struct bitmap *bm) -{ - ntfs_inode *ni; - ntfs_attr_search_ctx *ctx; - - if (!(ni = ntfs_open_inode(vol, (MFT_REF)FILE_Bitmap))) - perr_exit("ntfs_open_inode"); - - if (!(ctx = ntfs_get_attr_search_ctx(ni, NULL))) - perr_exit("ntfs_get_attr_search_ctx"); - - if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) - perr_exit("ntfs_lookup_attr"); - - /* FIXME: get_attribute_value_length() can't handle extents */ - bm->size = get_attribute_value_length(ctx->attr); - - if (!(bm->bm = (u8 *)malloc(bm->size))) - perr_exit("get_bitmap_data"); - - if (get_attribute_value(vol, ni->mrec, ctx->attr, bm->bm) != bm->size) - perr_exit("Couldn't get $Bitmap $DATA\n"); - - ntfs_put_attr_search_ctx(ctx); - ntfs_close_inode(ni); -} - - -void compare_bitmaps(struct bitmap *a, struct bitmap *b) -{ - int i; - - if (a->size != b->size) - err_exit("$Bitmap file size doesn't match " - "calculated size ((%d != %d)\n", a->size, b->size); - - for (i = 0; i < a->size; i++) - if (a->bm[i] != b->bm[i]) - err_exit("Cluster bitmaps differ at %d (%d != %d)\n" - "You didn't shutdown your Windows properly?", - i, a->bm[i], b->bm[i]); -} - - -void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) -{ - p->start = start; - p->stop = stop; - p->unit = 100.0 / (stop - start); - p->resolution = res; -} - - -void progress_update(struct progress_bar *p, u64 current) -{ - float percent = p->unit * current; - - if (current != p->stop) { - if ((current - p->start) % p->resolution) - return; - printf("%6.2f percent completed\r", percent); - } else - printf("100.00 percent completed\n"); - fflush(stdout); -} - -void walk_inodes() -{ - s32 inode = 0; - s64 last_mft_rec; - MFT_REF mref; - MFT_RECORD *mrec = NULL; - struct progress_bar progress; - - printf("Scanning volume ...\n"); - - last_mft_rec = vol->nr_mft_records - 1; - progress_init(&progress, inode, last_mft_rec, 100); - - for (; inode <= last_mft_rec; inode++) { - progress_update(&progress, inode); - - mref = (MFT_REF)inode; - if (ntfs_read_file_record(vol, mref, &mrec, NULL)) { - /* FIXME: continue only if it make sense, e.g. - MFT record not in use based on $MFT bitmap */ - if (errno == EIO) - continue; - perr_exit("Reading inode %ld failed", inode); - } - if (!(mrec->flags & MFT_RECORD_IN_USE)) - continue; - - walk_attributes(mrec); - } - if (mrec) - free(mrec); -} - - -void advise_on_resize() -{ - u64 i, old_b, new_b, g_b, old_mb, new_mb, g_mb; - int fragmanted_end; - - for (i = vol->nr_clusters - 1; i > 0; i--) - if (ntfs_get_bit(lcn_bitmap.bm, i)) - break; - - i += 2; /* first free + we reserve one for the backup boot sector */ - fragmanted_end = (i >= vol->nr_clusters) ? 1 : 0; - - if (fragmanted_end || !opt.info) { - printf(fragmented_volume_msg); - if (fragmanted_end) - exit(1); - printf("Now "); - } - - old_b = vol->nr_clusters * vol->cluster_size; - old_mb = rounded_up_division(old_b, NTFS_MBYTE); - new_b = i * vol->cluster_size; - new_mb = rounded_up_division(new_b, NTFS_MBYTE); - g_b = (vol->nr_clusters - i) * vol->cluster_size; - g_mb = g_b / NTFS_MBYTE; - - printf("You could resize at %lld bytes ", new_b); - - if ((new_mb * NTFS_MBYTE) < old_b) - printf("or %lld MB ", new_mb); - - printf("(freeing "); - - if (g_mb && (old_mb - new_mb)) - printf("%lld MB", old_mb - new_mb); - else - printf("%lld bytes", g_b); - - printf(").\n"); - exit(1); -} - - -void look_for_bad_sector(ATTR_RECORD *a) -{ - run_list *rl; - int i; - - rl = ntfs_decompress_mapping_pairs(vol, a, NULL); - if (!rl) - perr_exit("ntfs_decompress_mapping_pairs"); - - for (i = 0; rl[i].length; i++) - if (rl[i].lcn != LCN_HOLE) - err_exit("Device has bad sectors, not supported\n"); - - free(rl); -} - - -void rl_set(run_list *rl, VCN vcn, LCN lcn, s64 len) -{ - rl->vcn = vcn; - rl->lcn = lcn; - rl->length = len; -} - - -/* - * $Bitmap can overlap the end of the volume. Any bits in this region - * must be set. This region also encompasses the backup boot sector. - */ -void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) -{ - for (; cluster < bm->size << 3; cluster++) - ntfs_set_bit(bm->bm, (u64)cluster, 1); -} - - -/* - * FIXME: this function should go away and instead using a generalized - * "truncate_bitmap_unnamed_attr()" - */ -void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) -{ - run_list *rl_bad; - int mp_size; - char *mp; - - if (!a->non_resident) - /* FIXME: handle resident attribute value */ - perr_exit("Resident attribute in $BadClust not supported!"); - - if (!(rl_bad = (run_list *)malloc(2 * sizeof(run_list)))) - perr_exit("Couldn't get memory"); - - rl_set(rl_bad, 0LL, (LCN)LCN_HOLE, nr_clusters); - rl_set(rl_bad + 1, nr_clusters, -1LL, 0LL); - - mp_size = ntfs_get_size_for_mapping_pairs(vol, rl_bad); - - if (!(mp = (char *)calloc(1, mp_size))) - perr_exit("Couldn't get memory"); - - if (ntfs_build_mapping_pairs(vol, mp, mp_size, rl_bad)) - exit(1); - - memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); - a->highest_vcn = cpu_to_le64(nr_clusters - 1LL); - a->allocated_size = cpu_to_le64(nr_clusters * vol->cluster_size); - a->data_size = cpu_to_le64(nr_clusters * vol->cluster_size); - - free(rl_bad); - free(mp); -} - - -void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) -{ - run_list *rl; - s64 bm_bsize, size; - s64 nr_bm_clusters; - int i, j, mp_size; - int trunc_at = -1; /* FIXME: -1 means unset */ - char *mp; - - - if (!a->non_resident) - /* FIXME: handle resident attribute value */ - perr_exit("Resident data attribute in $Bitmap not supported!"); - - bm_bsize = nr_clusters_to_bitmap_byte_size(nr_clusters); - nr_bm_clusters = rounded_up_division(bm_bsize, vol->cluster_size); - - if (!(rl = ntfs_decompress_mapping_pairs(vol, a, NULL))) - perr_exit("ntfs_decompress_mapping_pairs"); - - /* Unallocate truncated clusters in $Bitmap */ - for (i = 0; rl[i].length; i++) { - if (rl[i].vcn + rl[i].length <= nr_bm_clusters) - continue; - if (trunc_at == -1) - trunc_at = i; - if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) - continue; - for (j = 0; j < rl[i].length; j++) - if (rl[i].vcn + j >= nr_bm_clusters) { - u64 k = (u64)rl[i].lcn + j; - ntfs_set_bit(lcn_bitmap.bm, k, 0); - Dprintf("Unallocate cluster: " - "%llu (%llx)\n", k, k); - } - } - - /* FIXME: realloc lcn_bitmap.bm (if it's worth the risk) */ - lcn_bitmap.size = bm_bsize; - bitmap_file_data_fixup(nr_clusters, &lcn_bitmap); - - if (trunc_at != -1) { - /* NOTE: 'i' always > 0 */ - i = nr_bm_clusters - rl[trunc_at].vcn; - rl[trunc_at].length = i; - rl_set(rl + trunc_at + 1, nr_bm_clusters, -1LL, 0LL); - - Dprintf("Runlist truncated at index %d, " - "new cluster length %d\n", trunc_at, i); - } - - if (!opt.ro_flag) { - size = ntfs_rl_pwrite(vol, rl, 0, bm_bsize, lcn_bitmap.bm); - if (bm_bsize != size) { - if (size == -1) - perr_exit("Couldn't write $Bitmap"); - printf("Couldn't write full $Bitmap file " - "(%lld from %lld)\n", size, bm_bsize); - exit(1); - } - } - - mp_size = ntfs_get_size_for_mapping_pairs(vol, rl); - - if (!(mp = (char *)calloc(1, mp_size))) - perr_exit("Couldn't get memory"); - - if (ntfs_build_mapping_pairs(vol, mp, mp_size, rl)) - exit(1); - - memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); - a->highest_vcn = cpu_to_le64(nr_bm_clusters - 1LL); - a->allocated_size = cpu_to_le64(nr_bm_clusters * vol->cluster_size); - a->data_size = cpu_to_le64(bm_bsize); - a->initialized_size = cpu_to_le64(bm_bsize); - - free(rl); - free(mp); -} - - -void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) -{ - ntfs_inode *ni; - uchar_t *ustr = NULL; - int len = 0; - - if (!(ni = ntfs_open_inode(vol, mref))) - perr_exit("ntfs_open_inode"); - - if (NInoAttrList(ni)) - perr_exit("Attribute list attribute not yet supported"); - - if (!(*ctx = ntfs_get_attr_search_ctx(ni, NULL))) - perr_exit("ntfs_get_attr_search_ctx"); - - if (aname && ((len = ntfs_mbstoucs(aname, &ustr, 0)) == -1)) - perr_exit("Unable to convert string to Unicode"); - - if (!ustr || !len) { - ustr = AT_UNNAMED; - len = 0; - } - - if (ntfs_lookup_attr(AT_DATA, ustr, len, 0, 0, NULL, 0, *ctx)) - perr_exit("ntfs_lookup_attr"); - - if (ustr != AT_UNNAMED) - free(ustr); -} - - -int write_mft_record(ntfs_attr_search_ctx *ctx) -{ - if (opt.ro_flag) - return 0; - - return ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no, ctx->mrec); -} - - -void truncate_badclust_file(s64 nr_clusters) -{ - ntfs_attr_search_ctx *ctx = NULL; - - printf("Updating $BadClust file ...\n"); - - lookup_data_attr((MFT_REF)FILE_BadClus, "$Bad", &ctx); - look_for_bad_sector(ctx->attr); - /* FIXME: sanity_check_attr(ctx->attr); */ - /* FIXME: should use an "extended" truncate_bitmap_unnamed_attr() */ - truncate_badclust_bad_attr(ctx->attr, nr_clusters); - - if (write_mft_record(ctx)) - perr_exit("Couldn't update $BadClust"); - - /* FIXME: clean up API => ntfs_put_attr_search_ctx() also closes ni */ - ntfs_put_attr_search_ctx(ctx); -} - - -void truncate_bitmap_file(s64 nr_clusters) -{ - ntfs_attr_search_ctx *ctx = NULL; - - printf("Updating $Bitmap file ...\n"); - - lookup_data_attr((MFT_REF)FILE_Bitmap, NULL, &ctx); - /* FIXME: sanity_check_attr(ctx->attr); */ - truncate_bitmap_unnamed_attr(ctx->attr, nr_clusters); - - if (write_mft_record(ctx)) - perr_exit("Couldn't update $Bitmap"); - - ntfs_put_attr_search_ctx(ctx); -} - - -void setup_lcn_bitmap() -{ - /* Determine lcn bitmap byte size and allocate it. */ - lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); - - if (!(lcn_bitmap.bm = (unsigned char *)calloc(1, lcn_bitmap.size))) - perr_exit("Failed to allocate internal buffer"); - - bitmap_file_data_fixup(vol->nr_clusters, &lcn_bitmap); -} - - -/* FIXME: should be done using ntfs_* functions */ -void update_bootsector(s64 nr_clusters) -{ - NTFS_BOOT_SECTOR bs; - - printf("Updating Boot record ...\n"); - - if (lseek(vol->fd, 0, SEEK_SET) == (off_t)-1) - perr_exit("lseek"); - - if (read(vol->fd, &bs, sizeof(NTFS_BOOT_SECTOR)) == -1) - perr_exit("read() error"); - - bs.number_of_sectors = nr_clusters * bs.bpb.sectors_per_cluster; - bs.number_of_sectors = cpu_to_le64(bs.number_of_sectors); - - if (lseek(vol->fd, 0, SEEK_SET) == (off_t)-1) - perr_exit("lseek"); - - if (!opt.ro_flag) - if (write(vol->fd, &bs, sizeof(NTFS_BOOT_SECTOR)) == -1) - perr_exit("write() error"); -} - - -void print_volume_size(char *str, ntfs_volume *v, s64 nr_clusters) -{ - s64 b; /* volume size in bytes */ - - b = nr_clusters * v->cluster_size; - printf("%s: %lld bytes (%lld MB)\n", - str, b, rounded_up_division(b, NTFS_MBYTE)); -} - - -void mount_volume() -{ - unsigned long mntflag; - - if (ntfs_check_if_mounted(opt.volume, &mntflag)) - perr_exit("Failed to check '%s' mount state", opt.volume); - - if (mntflag & NTFS_MF_MOUNTED) { - if (!(mntflag & NTFS_MF_READONLY)) - err_exit("Device %s is mounted read-write. " - "You must 'umount' it first.\n", opt.volume); - if (!opt.ro_flag) - err_exit("Device %s is mounted. " - "You must 'umount' it first.\n", opt.volume); - } - - if (!(vol = ntfs_mount(opt.volume, opt.ro_flag))) { - - int err = errno; - - perr_printf("ntfs_mount failed"); - if (errno == EINVAL) { - printf("Apparently device '%s' doesn't have a " - "valid NTFS. Maybe you selected\nthe whole " - "disk instead of a partition (e.g. /dev/hda, " - "not /dev/hda8)?\n", opt.volume); - } - exit(1); - } - - if (vol->flags & VOLUME_IS_DIRTY) - if (opt.force-- <= 0) - err_exit("Volume is dirty. Run chkdsk and " - "please try again (or see -f option).\n"); - - printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); - if (ntfs_is_version_supported(vol)) - perr_exit("Unknown NTFS version"); - - Dprintf("Cluster size : %u\n", vol->cluster_size); - print_volume_size("Current volume size", vol, vol->nr_clusters); -} - - -void prepare_volume_fixup() -{ - if (!opt.ro_flag) { - u16 flags; - - flags = vol->flags | VOLUME_IS_DIRTY; - if (vol->major_ver >= 2) - flags |= VOLUME_MOUNTED_ON_NT4; - - printf("Schedule chkdsk NTFS consistency check at Windows boot time ...\n"); - if (ntfs_set_volume_flags(vol, flags)) - perr_exit("Failed to set $Volume dirty"); - - printf("Resetting $LogFile ... " - "(this might take a while)\n"); - if (ntfs_reset_logfile(vol)) - perr_exit("Failed to reset $LogFile"); - } -} - - -int main(int argc, char **argv) -{ - struct bitmap on_disk_lcn_bitmap; - s64 new_volume_size = 0; /* in clusters */ - int i; - - parse_options(argc, argv); - - mount_volume(); - - if (opt.bytes) { - /* Take the integer part: when shrinking we don't want - to make the volume to be bigger than requested. - Later on we will also decrease this value to save - room for the backup boot sector */ - new_volume_size = opt.bytes / vol->cluster_size; - print_volume_size("New volume size ", vol, new_volume_size); - } - - setup_lcn_bitmap(); - - walk_inodes(); - - get_bitmap_data(vol, &on_disk_lcn_bitmap); - compare_bitmaps(&on_disk_lcn_bitmap, &lcn_bitmap); - free(on_disk_lcn_bitmap.bm); - - if (opt.info) - advise_on_resize(); - - /* FIXME: check new_volume_size validity */ - - /* Backup boot sector at the end of device isn't counted in NTFS - volume size thus we have to reserve space for. We don't trust - the user does this for us: better to be on the safe side ;) */ - if (new_volume_size) - --new_volume_size; - - if (new_volume_size > vol->nr_clusters) - err_exit("Volume enlargement not yet supported\n"); - else if (new_volume_size == vol->nr_clusters) { - printf("Nothing to do: NTFS volume size is already OK.\n"); - exit(0); - } - - for (i = new_volume_size; i < vol->nr_clusters; i++) - if (ntfs_get_bit(lcn_bitmap.bm, (u64)i)) { - /* FIXME: relocate cluster */ - advise_on_resize(); - } - - if (opt.force-- <= 0 && !opt.ro_flag) { - printf(resize_warning_msg); - proceed_question(); - } - - prepare_volume_fixup(); - - truncate_badclust_file(new_volume_size); - truncate_bitmap_file(new_volume_size); - update_bootsector(new_volume_size); - - /* We don't create backup boot sector because we don't know where the - partition will be split. The scheduled chkdsk will fix it anyway */ - - if (opt.ro_flag) { - printf("The read-only test run ended successfully.\n"); - exit(0); - } - - printf("Syncing device ...\n"); - if (fsync(vol->fd) == -1) - perr_exit("fsync"); - - printf(resize_important_msg, vol->dev_name); - return 0; -} - diff --git a/ntfstools/ntfsundelete.8.in b/ntfstools/ntfsundelete.8.in deleted file mode 100644 index f28f4a05..00000000 --- a/ntfstools/ntfsundelete.8.in +++ /dev/null @@ -1,344 +0,0 @@ -.\" Copyright (c) 2002 Richard Russon. All Rights Reserved. -.\" This file may be copied under the terms of the GNU Public License. -.\" -.TH NTFSUNDELETE 8 "June 2002" "Linux\-NTFS version @VERSION@" -.SH NAME -ntfsundelete \- recover a deleted file from an NTFS volume. -.SH SYNOPSIS -.B ntfsundelete -[ -.I options -] -.B device -.SH DESCRIPTION -.B ntfsundelete -has three modes of operation: -.IR scan , -.I undelete -and -.IR copy . -.SS Scan -.PP -The default mode, -.I scan -simply reads an NTFS Volume and looks for files that have been deleted. Then it -will print a list giving the inode number, name and size. -.SS Undelete -.PP -The -.I undelete -mode takes the inode and recovers as much of the data as possible. It save the -result to another location. Partly for safety, but mostly because NTFS write -support isn't finished. -.SS Copy -.PP -This is a wizard's option. It will save a portion of the MFT to a file. This -probably only be useful when debugging -.I ntfsundelete -.SS Notes -.B ntfsundelete -only ever -.B reads -from the NTFS Volume. -.B ntfsundelete -will never change the volume. -.SH CAVEATS -.SS Miracles -.B ntfsundelete -cannot perform the impossible. -.PP -When a file is deleted the MFT Record is marked as not in use and the bitmap -representing the disk usage is updated. If the power isn't turned off -immediately, the free space, where the file used to live, may become -overwritten. Worse, the MFT Record may be reused for another file. If this -happens it is impossible to tell where the file was on disk. -.PP -Even if all the clusters of a file are not in use, there is no guarantee that -they haven't been overwritten by some short\-lived file. -.SS Locale -In NTFS all the filenames are stored as Unicode. They will be converted into -the current locale for display by -.BR ntfsundelete . -The utility has successfully displayed some Chinese pictogram filenames and then -correctly recovered them. -.SS Extended MFT Records -In rare circumstances, a single MFT Record will not be large enough to hold the -metadata describing a file (a file would have to be in hundreds of fragments -for this to happen). In these cases one MFT record may hold the filename, but -another will hold the information about the data. -.B ntfsundelete -will not try and piece together such records. It will simply show unnamed files -with data. -.SS Compressed and Encrypted Files -.B ntfsundelete -cannot recover compressed or encrypted files. When scanning for them, it will -display as being 0% recoverable. -.SH OPTIONS -Below is a summary of all the options that -.B ntfsundelete -accepts. All options have two equivalent names. The short name is preceded by -.BR \- -and the long name is preceded by -.BR \-\- . -Any single letter options, that don't take an argument, can be combined into a -single command, e.g. -.BR \-fv -is equivalent to -.BR "\-f \-v" . -Long named options can be abbreviated to any unique prefix of their name. -.TP -.BI "\-b " num -.br -.ns -.TP -.BI "\-\-byte " num -If any clusters of the file cannot be recovered, the missing parts will be -filled with this byte. The default is zeros. -.TP -.B \-C -.br -.ns -.TP -.B \-\-case -When scanning an NTFS volume, any filename matching (using the -.B \-\-match -option) is case\-insensitive. This option makes the maching case\-sensitive. -.TP -.BI "\-c " range -.br -.ns -.TP -.BI "\-\-copy " range -This wizard's option will write a block of MFT FILE records to a file. The -default file is -.I mft -which will be created in the current directory. This option can be combined -with the -.B \-\-output -and -.B \-\-destination -options. -.TP -.BI "\-d " dir -.br -.ns -.TP -.BI "\-\-destination " dir -This option controls where to put the output file of the -.B \-\-undelete -and -.B \-\-copy -options. -.TP -.B \-f -.br -.ns -.TP -.B \-\-force -This will override some sensible defaults, such as not overwriting an existing -file. Use this option with caution. -.TP -.B \-h -.br -.ns -.TP -.B \-\-help -Show a list of options with a brief description of each one. -.TP -.BI "\-m " pattern -.br -.ns -.TP -.BI "\-\-match " pattern -Filter the output of the -.B \-\-scan -option, by only looking for matching filenames. The pattern can include the -wildcards '?', match exactly one character or '*', match zero or more -characters. By default the matching is case\-insensitive. To make the search -case sensitive, use the -.B \-\-case -option. -.TP -.BI "\-o " file -.br -.ns -.TP -.BI "\-\-output " file -Use this option to set name of output file that -.B \-\-undelete -or -.B \-\-copy -will create. -.TP -.BI "\-p " num -.br -.ns -.TP -.BI "\-\-percentage " num -Filter the output of the -.B \-\-scan -option, by only matching files with a certain amount of recoverable content. -.B Please read the caveats section for more details. -.TP -.BI \-q -.br -.ns -.TP -.BI \-\-quiet -Reduce the amount of output to a minimum. Naturally, it doesn't make sense to -combine this option with -.BR \-\-scan . -.TP -.B \-s -.br -.ns -.TP -.B \-\-scan -Search through an NTFS volume and print a list of files that could be recovered. -This is the default action of -.BR ntfsundelete . -This list can be filtered by filename, size, percentage recoverable or last -modification time, using the -.BR \-\-match , -.BR \-\-size , -.B \-\-percent -and -.B \-\-time -options, respectively. -.sp -The output of scan will be: -.sp -.nf -Inode Flags %age Date Size Filename - 6038 FN.. 93% 2002-07-17 26629 thesis.doc -.fi -.TS -lB lB -l l. -Flag Description -F/D File/Directory -N/R (Non-)Resident data stream -C/E Compressed/Encrypted data stream -! Missing attributes -.TE -.RS -.sp -.br -The percentage field shows how much of the file can potentially be recovered. -.sp -.br -.RE -.BI "\-S " range -.br -.ns -.TP -.BI "\-\-size " range -Filter the output of the -.B \-\-scan -option, by looking for a particular range of file sizes. The range may be -specified as two numbers separated by a '\-'. The sizes may be abbreviated -using the suffixes k, m, g, t, for kilobytes, megabytes, gigabytes and terabytes -respectively. -.TP -.BI "\-t " since -.br -.ns -.TP -.BI "\-\-time " since -Filter the output of the -.B \-\-scan -option. Only match files that have been altered since this time. The time must -be given as number using a suffix of d, w, m, y for days, weeks, months or years -ago. -.TP -.BI "\-u " num -.br -.ns -.TP -.BI "\-\-undelete " num -Recover the file with this inode number. This option can be combined with -.BR \-\-output , -.BR \-\-destination , -and -.BR \-\-byte . -.TP -.B \-v -.br -.ns -.TP -.B \-\-verbose -Increase the amount of output that -.B ntfsundelete -prints. -.TP -.B \-V -.br -.ns -.TP -.B \-\-version -Show the version number, copyright and license -.BR ntfsundelete . -.SH EXAMPLES -Look for deleted files on /dev/hda1. -.RS -.sp -.B ntfsundelete /dev/hda1 -.sp -.RE -Look for deleted documents on /dev/hda1. -.RS -.sp -.B ntfsundelete /dev/hda1 -s \-m '*.doc' -.sp -.RE -Look for deleted files between 5000 and 6000000 bytes, with at least 90% of the -data recoverable, on /dev/hda1. -.RS -.sp -.B ntfsundelete /dev/hda1 \-S 5k\-6m \-p 90 -.sp -.RE -Look for deleted files altered in the last two days -.RS -.sp -.B ntfsundelete /dev/hda1 \-t 2d -.sp -.RE -Undelete inode number 3689, call the file 'work.doc' and put it in the user's -home directory. -.RS -.sp -.B ntfsundelete /dev/hda1 \-u 3689 \-o work.doc \-d ~ -.sp -.RE -Save MFT Records 3689 to 3690 to a file 'debug' -.RS -.sp -.B ntfsundelete /dev/hda1 \-c 3689\-3690 \-o debug -.RE -.SH BUGS -There are some small limitations to this program, but currently no known bugs. -If you find one, please send an email to -.nh - -.hy -.SH AUTHOR -.B ntfsundelete -was written by Richard Russon (FlatCap) -.br -If you find this tool useful, make FlatCap happy and send him an email. -.SH AVAILABILITY -.B ntfsundelete -is part of the linux\-ntfs package and is available from -.br -.nh -http://linux\-ntfs.sourceforge.net/downloads.html -.hy -This manual page is available online at: -.br -.nh -http://linux\-ntfs.sourceforge.net/tools/ntfsundelete.html -.hy -.SH SEE ALSO -.BR ntfsinfo(8) -.br diff --git a/ntfstools/ntfsundelete.c b/ntfstools/ntfsundelete.c deleted file mode 100644 index f738f3bf..00000000 --- a/ntfstools/ntfsundelete.c +++ /dev/null @@ -1,2018 +0,0 @@ -/** - * ntfsundelete - Part of the Linux-NTFS project. - * - * Copyright (c) 2002 Richard Russon - * - * This utility will recover deleted files from an NTFS volume. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ntfsundelete.h" -#include "bootsect.h" -#include "mft.h" -#include "attrib.h" -#include "layout.h" -#include "inode.h" -#include "disk_io.h" - -static const char *AUTHOR = "Richard Russon (FlatCap)"; -static const char *EXEC_NAME = "ntfsundelete"; -static const char *MFTFILE = "mft"; -static const char *UNNAMED = ""; -static char *NONE = ""; -static char *UNKNOWN = "unknown"; -static struct options opts; - -#define _(S) gettext(S) - -/** - * Eprintf - Print error messages - */ -void Eprintf (const char *format, ...) -{ - va_list va; - va_start (va, format); - vfprintf (stderr, format, va); - va_end (va); -} - -/** - * Iprintf - Print informative messages - */ -void Iprintf (const char *format, ...) -{ - va_list va; -#ifndef DEBUG - if (opts.quiet) - return; -#endif - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -} - -/** - * Vprintf - Print verbose messages - */ -void Vprintf (const char *format, ...) -{ - va_list va; -#ifndef DEBUG - if (!opts.verbose) - return; -#endif - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -} - -/** - * Dprintf - Print debug messages - */ -void Dprintf (const char *format, ...) -{ -#ifdef DEBUG - va_list va; - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -#endif -} - - -/** - * version - Print version information about the program - * - * Print a copyright statement and a brief description of the program. - * - * Return: none - */ -void version (void) -{ - Iprintf ("%s v%s Copyright (C) 2002 %s\nRecover deleted files from an " - "NTFS Volume\n\n%s is free software, released under the GNU " - "General Public License\nand you are welcome to redistribute " - "it under certain conditions.\n%s comes with ABSOLUTELY NO " - "WARRANTY; for details read the GNU\nGeneral Public License " - "to be found in the file COPYING in the main\nLinux-NTFS " - "distribution directory.\n\n", - EXEC_NAME, VERSION, AUTHOR, EXEC_NAME, EXEC_NAME); -} - -/** - * usage - Print a list of the parameters to the program - * - * Print a list of the parameters and options for the program. - * - * Return: none - */ -void usage (void) -{ - Iprintf ("Usage: %s [options] device\n" - " -s --scan Scan for files (default)\n" - " -p num --percentage num Minimum percentage recoverable\n" - " -m pattern --match pattern Only work on files with matching names\n" - " -C --case Case sensitive matching\n" - " -S range --size range Match files of this size\n" - " -t since --time since Last referenced since this time\n" - "\n" - " -u num --undelete num Undelete inode\n" - " -o file --output file Save with this filename\n" - " -d dir --destination dir Destination directory\n" - " -b num --byte num Fill missing parts with this byte\n" - "\n" - " -c range --copy range Write a range of MFT records to a file\n" - "\n" - " -f --force Use less caution\n" - " -q --quiet Less output\n" - " -v --verbose More output\n" - " -V --version Version information\n" - " -h --help Print this help\n\n", - EXEC_NAME); - Iprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); -} - -/** - * transform - Convert a shell style pattern to a regex - * @pattern: String to be converted - * @regex: Resulting regular expression is put here - * - * This will transform patterns, such as "*.doc" to true regular expressions. - * The function will also place '^' and '$' around the expression to make it - * behave as the user would expect - * - * Before After - * . \. - * * .* - * ? . - * - * Notes: - * The returned string must be freed by the caller. - * If transform fails, @regex will not be changed. - * - * Return: 1, Success, the string was transformed - * 0, An error occurred - */ -int transform (const char *pattern, char **regex) -{ - char *result; - int length, i, j; - - if (!pattern || !regex) - return 0; - - length = strlen (pattern); - if (length < 1) { - Eprintf ("Pattern to transform is empty\n"); - return 0; - } - - for (i = 0; pattern[i]; i++) { - if ((pattern[i] == '*') || (pattern[i] == '.')) - length++; - } - - result = malloc (length + 3); - if (!result) { - Eprintf ("Couldn't allocate memory in transform()\n"); - return 0; - } - - result[0] = '^'; - - for (i = 0, j = 1; pattern[i]; i++, j++) { - if (pattern[i] == '*') { - result[j] = '.'; - j++; - result[j] = '*'; - } else if (pattern[i] == '.') { - result[j] = '\\'; - j++; - result[j] = '.'; - } else if (pattern[i] == '?') { - result[j] = '.'; - } else { - result[j] = pattern[i]; - } - } - - result[j] = '$'; - result[j+1] = 0; - Dprintf ("Pattern '%s' replaced with regex '%s'\n", pattern, result); - - *regex = result; - return 1; -} - -/** - * parse_time - Convert a time abbreviation to seconds - * @string: The string to be converted - * @since: The absolute time referred to - * - * Strings representing times will be converted into a time_t. The numbers will - * be regarded as seconds unless suffixed. - * - * Suffix Description - * [yY] Year - * [mM] Month - * [wW] Week - * [dD] Day - * [sS] Second - * - * Therefore, passing "1W" will return the time_t representing 1 week ago. - * - * Notes: - * Only the first character of the suffix is read. - * If parse_time fails, @since will not be changed - * - * Return: 1 Success - * 0 Error, the string was malformed - */ -int parse_time (const char *value, time_t *since) -{ - time_t result, now; - char *suffix = NULL; - - if (!value || !since) - return -1; - - Dprintf ("parsing time '%s' ago\n", value); - - result = strtoll (value, &suffix, 10); - if (result < 0 || errno == ERANGE) { - Eprintf ("Invalid time '%s'.\n", value); - return 0; - } - - if (!suffix) { - Eprintf ("Internal error, strtoll didn't return a suffix.\n"); - return 0; - } - - if (strlen (suffix) > 1) { - Eprintf ("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); - return 0; - } - - switch (suffix[0]) { - case 'y': case 'Y': result *= 12; - case 'm': case 'M': result *= 4; - case 'w': case 'W': result *= 7; - case 'd': case 'D': result *= 24; - case 'h': case 'H': result *= 3600; - case 0: - break; - - default: - Eprintf ("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); - return 0; - } - - now = time (NULL); - - Dprintf ("Time now = %lld, Time then = %lld.\n", (long long) now, (long long) result); - *since = now - result; - return 1; -} - -/** - * parse_size - Convert a string representing a size - * @value: String to be parsed - * @size: Parsed size - * - * Read a string and convert it to a number. Strings may be suffixed to scale - * them. Any number without a suffix is assumed to be in bytes. - * - * Suffix Description Multiple - * [tT] Terabytes 10^12 - * [gG] Gigabytes 10^9 - * [mM] Megabytes 10^6 - * [kK] Kilobytes 10^3 - * - * Notes: - * Only the first character of the suffix is read. - * The multipliers are decimal thousands, not binary: 1000, not 1024. - * If parse_size fails, @size will not be changed - * - * Return: 1 Success - * 0 Error, the string was malformed - */ -int parse_size (const char *value, long long *size) -{ - long long result; - char *suffix = NULL; - - if (!value || !size) - return 0; - - Dprintf ("Parsing size '%s'.\n", value); - - result = strtoll (value, &suffix, 10); - if (result < 0 || errno == ERANGE) { - Eprintf ("Invalid size '%s'.\n", value); - return 0; - } - - if (!suffix) { - Eprintf ("Internal error, strtoll didn't return a suffix.\n"); - return 0; - } - - - /*if (strlen (suffix) > 1) { - Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); - return 0; - } Can't do this because of ranges*/ - - switch (suffix[0]) { - case 't': case 'T': result *= 1000; - case 'g': case 'G': result *= 1000; - case 'm': case 'M': result *= 1000; - case 'k': case 'K': result *= 1000; - case '-': case 0: - break; - default: - Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); - return 0; - } - - Dprintf ("Parsed size = %lld.\n", result); - *size = result; - return 1; -} - -/** - * parse_range - Convert a string representing a range of numbers - * @string: The string to be parsed - * @start: The beginning of the range will be stored here - * @finish: The end of the range will be stored here - * - * Read a string of the form n-m. If the lower end is missing, zero will be - * substituted. If the upper end is missing LONG_MAX will be used. If the - * string cannot be parsed correctly, @start and @finish will not be changed. - * - * Return: 1 Success, a valid string was found - * 0 Error, the string was not a valid range - */ -int parse_range (const char *string, long long *start, long long *finish) -{ - long long a, b; - char *middle; - - if (!string || !start || !finish) - return 0; - - middle = strchr (string, '-'); - if (string == middle) { - Dprintf ("Range has no beginning, defaulting to 0.\n"); - a = 0; - } else { - if (!parse_size (string, &a)) - return 0; - } - - if (middle) { - if (middle[1] == 0) { - b = LONG_MAX; - Dprintf ("Range has no end, defaulting to %lld.\n", b); - } else { - if (!parse_size (middle+1, &b)) - return 0; - } - } else { - b = a; - } - - Dprintf ("Range '%s' = %lld - %lld\n", string, a, b); - - *start = a; - *finish = b; - return 1; -} - -/** - * parse_options - Read and validate the programs command line - * - * Read the command line, verify the syntax and parse the options. - * This function is very long, but quite simple. - * - * Return: 1 Success - * 0 Error, one or more problems - */ -int parse_options (int argc, char *argv[]) -{ - static const char *sopt = "-b:Cc:d:fhm:o:p:sS:t:u:qvV"; - static const struct option lopt[] = { - { "byte", required_argument, NULL, 'b' }, - { "case", no_argument, NULL, 'C' }, - { "copy", required_argument, NULL, 'c' }, - { "destination", required_argument, NULL, 'd' }, - { "force", no_argument, NULL, 'f' }, - { "help", no_argument, NULL, 'h' }, - { "match", required_argument, NULL, 'm' }, - { "output", required_argument, NULL, 'o' }, - { "percentage", required_argument, NULL, 'p' }, - { "scan", no_argument, NULL, 's' }, - { "size", required_argument, NULL, 'S' }, - { "time", required_argument, NULL, 't' }, - { "undelete", required_argument, NULL, 'u' }, - { "quiet", no_argument, NULL, 'q' }, - { "verbose", no_argument, NULL, 'v' }, - { "version", no_argument, NULL, 'V' }, - { NULL, 0, NULL, 0 } - }; - - char c = -1; - char *end = NULL; - int err = 0; - int ver = 0; - int help = 0; - - opterr = 0; /* We'll handle the errors, thank you. */ - - opts.mode = MODE_NONE; - opts.uinode = -1; - opts.percent = -1; - opts.fillbyte = -1; - - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { - switch (c) { - case 1: /* A non-option argument */ - if (!opts.device) { - opts.device = argv[optind-1]; - } else { - opts.device = NULL; - err++; - } - break; - case 'b': - if (opts.fillbyte == -1) { - end = NULL; - opts.fillbyte = strtol (optarg, &end, 0); - if (end && *end) - err++; - } else { - err++; - } - break; - case 'C': - opts.match_case++; - break; - case 'c': - if (opts.mode == MODE_NONE) { - if (!parse_range (argv[optind-1], &opts.mft_begin, &opts.mft_end)) - err++; - opts.mode = MODE_COPY; - } else { - opts.mode = MODE_ERROR; - } - break; - case 'd': - if (!opts.dest) - opts.dest = argv[optind-1]; - else - err++; - break; - case 'f': - opts.force++; - break; - case 'h': - help++; - break; - case 'm': - if (!opts.match) { - if (!transform (argv[optind-1], &opts.match)) - err++; - } else { - err++; - } - break; - case 'o': - if (!opts.output) { - opts.output = argv[optind-1]; - } else { - err++; - } - break; - case 'p': - if (opts.percent == -1) { - end = NULL; - opts.percent = strtol (optarg, &end, 0); - if (end && ((*end != '%') && (*end != 0))) - err++; - } else { - err++; - } - break; - case 'q': - opts.quiet++; - break; - case 's': - if (opts.mode == MODE_NONE) - opts.mode = MODE_SCAN; - else - opts.mode = MODE_ERROR; - break; - case 'S': - if ((opts.size_begin > 0) || (opts.size_end > 0) || - !parse_range (argv[optind-1], &opts.size_begin, - &opts.size_end)) { - err++; - } - break; - case 't': - if (opts.since == 0) { - if (!parse_time (argv[optind-1], &opts.since)) - err++; - } else { - err++; - } - break; - case 'u': - if (opts.mode == MODE_NONE) { - end = NULL; - opts.mode = MODE_UNDELETE; - opts.uinode = strtol (optarg, &end, 0); - if (end && *end) - err++; - } else { - opts.mode = MODE_ERROR; - } - break; - case 'v': - opts.verbose++; - break; - case 'V': - ver++; - break; - default: - if (((optopt == 'b') || (optopt == 'c') || - (optopt == 'd') || (optopt == 'm') || - (optopt == 'o') || (optopt == 'p') || - (optopt == 'S') || (optopt == 't') || - (optopt == 'u')) && (!optarg)) { - Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); - } else { - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); - } - err++; - break; - } - } - - if (help || ver) { - opts.quiet = 0; - } else { - if (opts.device == NULL) { - Eprintf ("You must specify exactly one device.\n"); - err++; - } - - if (opts.mode == MODE_NONE) { - opts.mode = MODE_SCAN; - } - - switch (opts.mode) { - case MODE_SCAN: - if (opts.output || opts.dest || (opts.fillbyte != -1)) { - Eprintf ("Scan can only be used with --percent, " - "--match, --ignore-case, --size and --time.\n"); - err++; - } - if (opts.match_case && !opts.match) { - Eprintf ("The --case option doesn't make sense without the --match option\n"); - err++; - } - break; - case MODE_UNDELETE: - if ((opts.percent != -1) || opts.match || opts.match_case || - (opts.size_begin > 0) || (opts.size_end > 0)) { - Eprintf ("Undelete can only be used with " - "--output, --destination and --byte.\n"); - err++; - } - break; - case MODE_COPY: - if ((opts.fillbyte != -1) || (opts.percent != -1) || - opts.match || opts.match_case || - (opts.size_begin > 0) || (opts.size_end > 0)) { - Eprintf ("Copy can only be used with --output and --destination.\n"); - err++; - } - break; - default: - Eprintf ("You can only select one of Scan, Undelete or Copy.\n"); - err++; - } - - if ((opts.percent < -1) || (opts.percent > 100)) { - Eprintf ("Percentage value must be in the range 0 - 100.\n"); - err++; - } - - if (opts.quiet) { - if (opts.verbose) { - Eprintf ("You may not use --quiet and --verbose at the same time.\n"); - err++; - } else if (opts.mode == MODE_SCAN) { - Eprintf ("You may not use --quiet when scanning a volume.\n"); - err++; - } - } - } - - if (ver) - version(); - if (help || err) - usage(); - - return (!err && !help && !ver); -} - - -/** - * free_file - Release the resources used by a file object - * @file: The unwanted file object - * - * This will free up the memory used by a file object and iterate through the - * object's children, freeing their resources too. - * - * Return: none - */ -void free_file (struct ufile *file) -{ - struct list_head *item, *tmp; - - if (!file) - return; - - list_for_each_safe (item, tmp, &file->name) { /* List of filenames */ - struct filename *f = list_entry (item, struct filename, list); - Dprintf ("freeing filename '%s'\n", f->name ? f->name : NONE); - if (f->name) - free (f->name); - free (f); - } - - list_for_each_safe (item, tmp, &file->data) { /* List of data streams */ - struct data *d = list_entry (item, struct data, list); - Dprintf ("freeing data stream '%s'\n", d->name ? d->name : UNNAMED); - if (d->name) - free (d->name); - if (d->run_list) - free (d->run_list); - free (d); - } - - free (file->mft); - free (file); -} - -/** - * ntfs2utc - Convert an NTFS time to Unix time - * @time: An NTFS time in 100ns units since 1601 - * - * NTFS stores times as the number of 100ns intervals since January 1st 1601 at - * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. - * - * Return: n A Unix time (number of seconds since 1970) - */ -time_t ntfs2utc (long long time) -{ - return (time - ((long long) (369 * 365 + 89) * 24 * 3600 * 10000000)) / 10000000; -} - -/** - * find_attribute - Find an attribute of the given type - * @type: An attribute type, e.g. AT_FILE_NAME - * @ctx: A search context, created using ntfs_get_attr_search_ctx - * - * Using the search context to keep track, find the first/next occurrence of a - * given attribute type. - * - * N.B. This will return a pointer into @mft. As long as the search context - * has been created without an inode, it won't overflow the buffer. - * - * Return: Pointer Success, an attribute was found - * NULL Error, no matching attributes were found - */ -ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) -{ - if (!ctx) - return NULL; - - if (ntfs_lookup_attr (type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { - Dprintf ("find_attribute didn't find an attribute of type: 0x%02x.\n", type); - return NULL; /* None / no more of that type */ - } - - Dprintf ("find_attribute found an attribute of type: 0x%02x.\n", type); - return ctx->attr; -} - -/** - * find_first_attribute - Find the first attribute of a given type - * @type: An attribute type, e.g. AT_FILE_NAME - * @mft: A buffer containing a raw MFT record - * - * Search through a raw MFT record for an attribute of a given type. - * The return value is a pointer into the MFT record that was supplied. - * - * N.B. This will return a pointer into @mft. The pointer won't stray outside - * the buffer, since we created the search context without an inode. - * - * Return: Pointer Success, an attribute was found - * NULL Error, no matching attributes were found - */ -ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) -{ - ntfs_attr_search_ctx *ctx; - ATTR_RECORD *rec; - - if (!mft) - return NULL; - - ctx = ntfs_get_attr_search_ctx (NULL, mft); - if (!ctx) { - Eprintf ("Couldn't create a search context.\n"); - return NULL; - } - - rec = find_attribute (type, ctx); - ntfs_put_attr_search_ctx (ctx); - if (rec) - Dprintf ("find_first_attribute: found attr of type 0x%02x.\n", type); - else - Dprintf ("find_first_attribute: didn't find attr of type 0x%02x.\n", type); - return rec; -} - -/** - * get_filenames - Read an MFT Record's $FILENAME attributes - * @file: The file object to work with - * - * A single file may have more than one filename. This is quite common. - * Windows creates a short DOS name for each long name, e.g. LONGFI~1.XYZ, - * LongFiLeName.xyZ. - * - * The filenames that are found are put in filename objects and added to a - * linked list of filenames in the file object. For convenience, the unicode - * filename is converted into the current locale and stored in the filename - * object. - * - * One of the filenames is picked (the one with the lowest numbered namespace) - * and its locale friendly name is put in pref_name. - * - * Return: n The number of $FILENAME attributes found - * -1 Error - */ -int get_filenames (struct ufile *file) -{ - ATTR_RECORD *rec; - FILE_NAME_ATTR *attr; - ntfs_attr_search_ctx *ctx; - struct filename *name; - int count = 0; - int space = 4; - - if (!file) - return -1; - - ctx = ntfs_get_attr_search_ctx (NULL, file->mft); - if (!ctx) - return -1; - - while ((rec = find_attribute (AT_FILE_NAME, ctx))) { - /* We know this will always be resident. */ - attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); - - name = calloc (1, sizeof (*name)); - if (!name) { - Eprintf ("Couldn't allocate memory in get_filenames().\n"); - count = -1; - break; - } - - name->uname = attr->file_name; - name->uname_len = attr->file_name_length; - name->name_space = attr->file_name_type; - name->size_alloc = sle64_to_cpu (attr->allocated_size); - name->size_data = sle64_to_cpu (attr->data_size); - name->flags = attr->file_attributes; - - name->date_c = ntfs2utc (sle64_to_cpu (attr->creation_time)); - name->date_a = ntfs2utc (sle64_to_cpu (attr->last_data_change_time)); - name->date_m = ntfs2utc (sle64_to_cpu (attr->last_mft_change_time)); - name->date_r = ntfs2utc (sle64_to_cpu (attr->last_access_time)); - - file->date = max (file->date, name->date_c); - file->date = max (file->date, name->date_a); - file->date = max (file->date, name->date_m); - file->date = max (file->date, name->date_r); - - if (ntfs_ucstombs (name->uname, name->uname_len, &name->name, - name->uname_len) < 0) { - Dprintf ("Couldn't translate filename to current locale.\n"); - } - - if (name->name_space < space) { - file->pref_name = name->name; - space = name->name_space; - } - - file->max_size = max (file->max_size, name->size_alloc); - file->max_size = max (file->max_size, name->size_data); - - list_add_tail (&name->list, &file->name); - count++; - } - - ntfs_put_attr_search_ctx (ctx); - Dprintf ("File has %d names.\n", count); - return count; -} - -/** - * get_data - Read an MFT Record's $DATA attributes - * @file: The file object to work with - * @vol: An ntfs volume obtained from ntfs_mount - * - * A file may have more than one data stream. All files will have an unnamed - * data stream which contains the file's data. Some Windows applications store - * extra information in a separate stream. - * - * The streams that are found are put in data objects and added to a linked - * list of data streams in the file object. - * - * Return: n The number of $FILENAME attributes found - * -1 Error - */ -int get_data (struct ufile *file, ntfs_volume *vol) -{ - ATTR_RECORD *rec; - ntfs_attr_search_ctx *ctx; - int count = 0; - struct data *data; - - if (!file) - return -1; - - ctx = ntfs_get_attr_search_ctx (NULL, file->mft); - if (!ctx) - return -1; - - while ((rec = find_attribute (AT_DATA, ctx))) { - data = calloc (1, sizeof (*data)); - if (!data) { - Eprintf ("Couldn't allocate memory in get_data().\n"); - count = -1; - break; - } - - data->resident = !rec->non_resident; - data->compressed = rec->flags & ATTR_IS_COMPRESSED; - data->encrypted = rec->flags & ATTR_IS_ENCRYPTED; - - if (rec->name_length) { - data->uname = (uchar_t *) ((char *) rec + le16_to_cpu (rec->name_offset)); - data->uname_len = rec->name_length; - - if (ntfs_ucstombs (data->uname, data->uname_len, &data->name, - data->uname_len) < 0) { - Eprintf ("Cannot translate name into current locale.\n"); - } - } - - if (data->resident) { - data->size_data = le32_to_cpu (rec->value_length); - data->data = ((char*) (rec)) + le16_to_cpu (rec->value_offset); - } else { - data->size_alloc = sle64_to_cpu (rec->allocated_size); - data->size_data = sle64_to_cpu (rec->data_size); - data->size_init = sle64_to_cpu (rec->initialized_size); - data->size_vcn = sle64_to_cpu (rec->highest_vcn) + 1; - } - - data->run_list = ntfs_decompress_mapping_pairs (vol, rec, NULL); - if (!data->run_list) { - Dprintf ("Couldn't decompress the data runs\n"); - } - - file->max_size = max (file->max_size, data->size_data); - file->max_size = max (file->max_size, data->size_init); - - list_add_tail (&data->list, &file->data); - count++; - } - - ntfs_put_attr_search_ctx (ctx); - Dprintf ("File has %d data streams.\n", count); - return count; -} - -/** - * read_record - Read an MFT record into memory - * @vol: An ntfs volume obtained from ntfs_mount - * @record: The record number to read - * - * Read the specified MFT record and gather as much information about it as - * possible. - * - * Return: Pointer A ufile object containing the results - * NULL Error - */ -struct ufile * read_record (ntfs_volume *vol, long long record) -{ - ATTR_RECORD *attr10, *attr20, *attr90; - struct ufile *file; - ntfs_attr *mft; - - if (!vol) - return NULL; - - file = calloc (1, sizeof (*file)); - if (!file) { - Eprintf ("Couldn't allocate memory in read_record()\n"); - return NULL; - } - - INIT_LIST_HEAD (&file->name); - INIT_LIST_HEAD (&file->data); - file->inode = record; - - file->mft = malloc (vol->mft_record_size); - if (!file->mft) { - Eprintf ("Couldn't allocate memory in read_record()\n"); - free_file (file); - return NULL; - } - - mft = ntfs_attr_open (vol->mft_ni, AT_DATA, NULL, 0); - if (!mft) { - Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); - free_file (file); - return NULL; - } - - if (ntfs_attr_mst_pread (mft, vol->mft_record_size * record, 1, vol->mft_record_size, file->mft) < 1) { - Eprintf ("Couldn't read MFT Record %lld.\n", record); - ntfs_attr_close (mft); - free_file (file); - return NULL; - } - - ntfs_attr_close (mft); - mft = NULL; - - attr10 = find_first_attribute (AT_STANDARD_INFORMATION, file->mft); - attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, file->mft); - attr90 = find_first_attribute (AT_INDEX_ROOT, file->mft); - - Dprintf ("Attributes present: %s %s %s\n", attr10?"0x10":"", attr20?"0x20":"", attr90?"0x90":""); - - if (attr10) - { - STANDARD_INFORMATION *si; - si = (STANDARD_INFORMATION *) ((char *) attr10 + le16_to_cpu (attr10->value_offset)); - file->date = max (file->date, ntfs2utc (sle64_to_cpu (si->last_data_change_time))); - } - - if (attr20 || !attr10) - file->attr_list = 1; - if (attr90) - file->directory = 1; - - if (get_filenames (file) < 0) { - Eprintf ("Couldn't get filenames.\n"); - } - if (get_data (file, vol) < 0) { - Eprintf ("Couldn't get data streams.\n"); - } - - return file; -} - - -/** - * cluster_in_use - Determine if a cluster is in use - * @vol: An ntfs volume obtained from ntfs_mount - * @lcn: The Logical Cluster Number to test - * - * The metadata file $Bitmap has one binary bit representing each cluster on - * disk. The bit will be set of each cluster that is in use. The function - * reads the relevant part of $Bitmap into a buffer and tests the bit. - * - * This function has a static buffer in which it caches a section of $Bitmap. - * If the lcn, being tested, lies outside the range, the buffer will be - * refreshed. - * - * Return: 1 Cluster is in use - * 0 Cluster is free space - * -1 Error occurred - */ -int cluster_in_use (ntfs_volume *vol, long long lcn) -{ - static unsigned char buffer[512]; - static long long bmplcn = -sizeof (buffer) - 1; /* Which bit of $Bitmap is in the buffer */ - - int byte, bit; - ntfs_attr *attr; - - if (!vol) - return -1; - - /* Does lcn lie in the section of $Bitmap we already have cached? */ - if ((lcn < bmplcn) || (lcn >= (bmplcn + (sizeof (buffer) << 3)))) { - Dprintf ("Bit lies outside cache.\n"); - attr = ntfs_attr_open (vol->lcnbmp_ni, AT_DATA, NULL, 0); - if (!attr) { - Eprintf ("Couldn't open $MFT/$BITMAP: %s\n", strerror (errno)); - return -1; - } - - /* Mark the buffer as in use, in case the read is shorter. */ - memset (buffer, 0xFF, sizeof (buffer)); - bmplcn = lcn & (~((sizeof (buffer) << 3) - 1)); - - if (ntfs_attr_pread (attr, (bmplcn>>3), sizeof (buffer), buffer) < 0) { - Eprintf ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno)); - ntfs_attr_close (attr); - return -1; - } - - Dprintf ("Reloaded bitmap buffer.\n"); - ntfs_attr_close (attr); - } - - bit = 1 << (lcn & 7); - byte = (lcn >> 3) & (sizeof (buffer) - 1); - Dprintf ("cluster = %lld, bmplcn = %lld, byte = %d, bit = %d, in use %d\n", - lcn, bmplcn, byte, bit, buffer[byte] & bit); - - return (buffer[byte] & bit); -} - -/** - * calc_percentage - Calculate how much of the file is recoverable - * @file: The file object to work with - * @vol: An ntfs volume obtained from ntfs_mount - * - * Read through all the $DATA streams and determine if each cluster in each - * stream is still free disk space. This is just measuring the potential for - * recovery. The data may have still been overwritten by a another file which - * was then deleted. - * - * Files with a resident $DATA stream will have a 100% potential. - * - * N.B. If $DATA attribute spans more than one MFT record (i.e. badly - * fragmented) then only the data in this segment will be used for the - * calculation. - * - * N.B. Currently, compressed and encrypted files cannot be recovered, so they - * will return 0%. - * - * Return: n The percentage of the file that _could_ be recovered - * -1 Error - */ -int calc_percentage (struct ufile *file, ntfs_volume *vol) -{ - run_list_element *rl = NULL; - struct list_head *pos; - struct data *data; - long long i, j; - long long start, end; - int inuse, free; - int percent = 0; - - if (!file || !vol) - return -1; - - if (file->directory) { - Dprintf ("Found a directory: not recoverable.\n"); - return 0; - } - - if (list_empty (&file->data)) { - Vprintf ("File has no data streams.\n"); - return 0; - } - - list_for_each (pos, &file->data) { - data = list_entry (pos, struct data, list); - inuse = 0; - free = 0; - - if (data->encrypted) { - Vprintf ("File is encrypted, recovery is impossible.\n"); - continue; - } - - if (data->compressed) { - Vprintf ("File is compressed, recovery not yet implemented.\n"); - continue; - } - - if (data->resident) { - Vprintf ("File is resident, therefore recoverable.\n"); - percent = 100; - data->percent = 100; - continue; - } - - rl = data->run_list; - if (!rl) { - Vprintf ("File has no run list, hence no data.\n"); - continue; - } - - if (rl[0].length <= 0) { - Vprintf ("File has an empty run list, hence no data.\n"); - continue; - } - - if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ - Vprintf ("Missing segment at beginning, %lld clusters\n", rl[0].length); - inuse += rl[0].length; - rl++; - } - - for (i = 0; rl[i].length > 0; i++) { - if (rl[i].lcn == LCN_RL_NOT_MAPPED) { - Vprintf ("Missing segment at end, %lld clusters\n", rl[i].length); - inuse += rl[i].length; - continue; - } - - if (rl[i].lcn == LCN_HOLE) { - free += rl[i].length; - continue; - } - - start = rl[i].lcn; - end = rl[i].lcn + rl[i].length; - - for (j = start; j < end; j++) { - if (cluster_in_use (vol, j)) - inuse++; - else - free++; - } - } - - if ((inuse + free) == 0) { - Eprintf ("Unexpected error whilst calculating percentage for inode %lld\n", file->inode); - continue; - } - - data->percent = (free * 100) / (inuse + free); - - percent = max (percent, data->percent); - } - - Vprintf ("File is %d%% recoverable\n", percent); - return percent; -} - -/** - * dump_record - Print everything we know about an MFT record - * @file: The file to work with - * - * Output the contents of the file object. This will print everything that has - * been read from the MFT record, or implied by various means. - * - * Because of the redundant nature of NTFS, there will be some duplication of - * information, though it will have been read from different sources. - * - * N.B. If the filename is missing, or couldn't be converted to the current - * locale, "" will be displayed. - * - * Return: none - */ -void dump_record (struct ufile *file) -{ - char buffer[20]; - char *name; - struct list_head *item; - int i; - - if (!file) - return; - - Iprintf ("MFT Record %lld\n", file->inode); - Iprintf ("Type: %s\n", (file->directory) ? "Directory" : "File"); - strftime (buffer, sizeof (buffer), "%F %R", localtime (&file->date)); - Iprintf ("Date: %s\n", buffer); - - if (file->attr_list) - Iprintf ("Metadata may span more than one MFT record\n"); - - list_for_each (item, &file->name) { - struct filename *f = list_entry (item, struct filename, list); - - if (f->name) - name = f->name; - else - name = NONE; - - Iprintf ("Filename: (%d) %s\n", f->name_space, f->name); - Iprintf ("File Flags: "); - if (f->flags & FILE_ATTR_SYSTEM) Iprintf ("System "); - if (f->flags & FILE_ATTR_DIRECTORY) Iprintf ("Directory "); - if (f->flags & FILE_ATTR_SPARSE_FILE) Iprintf ("Sparse "); - if (f->flags & FILE_ATTR_REPARSE_POINT) Iprintf ("Reparse "); - if (f->flags & FILE_ATTR_COMPRESSED) Iprintf ("Compressed "); - if (f->flags & FILE_ATTR_ENCRYPTED) Iprintf ("Encrypted "); - if (!(f->flags & (FILE_ATTR_SYSTEM || FILE_ATTR_DIRECTORY || - FILE_ATTR_SPARSE_FILE || FILE_ATTR_REPARSE_POINT || - FILE_ATTR_COMPRESSED || FILE_ATTR_ENCRYPTED))) { - Iprintf (NONE); - } - Iprintf ("\n"); - Iprintf ("Size alloc: %lld\n", f->size_alloc); - Iprintf ("Size data: %lld\n", f->size_data); - - strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_c)); - Iprintf ("Date C: %s\n", buffer); - strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_a)); - Iprintf ("Date A: %s\n", buffer); - strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_m)); - Iprintf ("Date M: %s\n", buffer); - strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_r)); - Iprintf ("Date R: %s\n", buffer); - } - - Iprintf ("Data Streams:\n"); - list_for_each (item, &file->data) { - struct data *d = list_entry (item, struct data, list); - Iprintf ("Name: %s\n", (d->name) ? d->name : ""); - Iprintf ("Flags: "); - if (d->resident) Iprintf ("Resident\n"); - if (d->compressed) Iprintf ("Compressed\n"); - if (d->encrypted) Iprintf ("Encrypted\n"); - if (!d->resident && !d->compressed && !d->encrypted) - Iprintf ("None\n"); - else - Iprintf ("\n"); - - Iprintf ("Size alloc: %lld\n", d->size_alloc); - Iprintf ("Size data: %lld\n", d->size_data); - Iprintf ("Size init: %lld\n", d->size_init); - Iprintf ("Size vcn: %lld\n", d->size_vcn); - - Iprintf ("Data runs:\n"); - if ((!d->run_list) || (d->run_list[0].length <= 0)) { - Iprintf (" None\n"); - } else { - for (i = 0; d->run_list[i].length > 0; i++) { - Iprintf (" %lld @ %lld\n", d->run_list[i].length, d->run_list[i].lcn); - } - } - - Iprintf ("Amount potentially recoverable %d%%\n", d->percent); - } - - Iprintf ("________________________________________\n\n"); -} - -/** - * list_record - Print a one line summary of the file - * @file: The file to work with - * - * Print a one line description of a file. - * - * Inode Flags %age Date Size Filename - * - * The output will contain the file's inode number (MFT Record), some flags, - * the percentage of the file that is recoverable, the last modification date, - * the size and the filename. - * - * The flags are F/D = File/Directory, N/R = Data is (Non-)Resident, - * C = Compressed, E = Encrypted, ! = Metadata may span multiple records. - * - * N.B. The file size is stored in many forms in several attributes. This - * display the largest it finds. - * - * N.B. If the filename is missing, or couldn't be converted to the current - * locale, "" will be displayed. - * - * Return: none - */ -void list_record (struct ufile *file) -{ - char buffer[20]; - struct list_head *item; - char *name = NULL; - long long size = 0; - int percent = 0; - - char flagd = '.', flagr = '.', flagc = '.', flagx = '.'; - - strftime (buffer, sizeof (buffer), "%F", localtime (&file->date)); - - if (file->attr_list) - flagx = '!'; - - if (file->directory) - flagd = 'D'; - else - flagd = 'F'; - - list_for_each (item, &file->data) { - struct data *d = list_entry (item, struct data, list); - - if (!d->name) { - if (d->resident) flagr = 'R'; - else flagr = 'N'; - if (d->compressed) flagc = 'C'; /* These two are mutually exclusive */ - if (d->encrypted) flagc = 'E'; - - percent = max (percent, d->percent); - } - - size = max (size, d->size_data); - size = max (size, d->size_init); - } - - if (file->pref_name) - name = file->pref_name; - else - name = NONE; - - Iprintf ("%-8lld %c%c%c%c %3d%% %s %9lld %s\n", - file->inode, flagd, flagr, flagc, flagx, - percent, buffer, size, name); -} - -/** - * name_match - Does a file have a name matching a regex - * @re: The regular expression object - * @file: The file to be tested - * - * Iterate through the file's $FILENAME attributes and compare them against the - * regular expression, created with regcomp. - * - * Return: 1 There is a matching filename. - * 0 There is no match. - */ -int name_match (regex_t *re, struct ufile *file) -{ - struct list_head *item; - int result; - - if (!re || !file) - return 0; - - list_for_each (item, &file->name) { - struct filename *f = list_entry (item, struct filename, list); - - if (!f->name) - continue; - result = regexec (re, f->name, 0, NULL, 0); - if (result < 0) { - Eprintf ("Couldn't compare filename with regex: %s\n", strerror (errno)); - return 0; - } else if (result == REG_NOERROR) { - Dprintf ("Found a matching filename.\n"); - return 1; - } - } - - Dprintf ("Filename '%s' doesn't match regex.\n", file->pref_name); - return 0; -} - -/** - * write_data - Write out a block of data - * @fd: File descriptor to write to - * @buffer: Data to write - * @bufsize: Amount of data to write - * - * Write a block of data to a file descriptor. - * - * Return: -1 Error, something went wrong - * 0 Success, all the data was written - */ -unsigned int write_data (int fd, const char *buffer, unsigned int bufsize) -{ - ssize_t result1, result2; - - if (!buffer) { - errno = EINVAL; - return -1; - } - - result1 = write (fd, buffer, bufsize); - if ((result1 == (ssize_t) bufsize) || (result1 < 0)) - return result1; - - /* Try again with the rest of the buffer */ - buffer += result1; - bufsize -= result1; - - result2 = write (fd, buffer, bufsize); - if (result2 < 0) - return result1; - - return result1 + result2; -} - -/** - * open_file - Create a file based on the dir, name and stream supplied - * @dir: Directory in which to create the file (optional) - * @name: Filename to give the file (optional) - * @stream: Name of the stream (optional) - * - * Create a file and return the file descriptor. All the components are - * optional. If the name is missing, "unknown" will be used. If the directory - * is missing the file will be created in the current directory. If the stream - * name is present it will be appended to the filename, delimited by a colon. - * - * Return: -1 Error, failed to create the file - * n Success, this is the file descriptor - */ -int open_file (const char *dir, const char *name, const char *stream) -{ - char buf[256]; - int flags; - - if (!name) - name = UNKNOWN; - - if (dir) - if (stream) - snprintf (buf, sizeof (buf), "%s/%s:%s", dir, name, stream); - else - snprintf (buf, sizeof (buf), "%s/%s", dir, name); - else - if (stream) - snprintf (buf, sizeof (buf), "%s:%s", name, stream); - else - snprintf (buf, sizeof (buf), "%s", name); - - Vprintf ("Creating file: %s\n", buf); - - if (opts.force) - flags = O_RDWR | O_CREAT | O_TRUNC; - else - flags = O_RDWR | O_CREAT | O_EXCL; - - return open (buf, flags, S_IRUSR | S_IWUSR); -} - - -/** - * scan_disk - Search an NTFS volume for files that could be undeleted - * @vol: An ntfs volume obtained from ntfs_mount - * - * Read through all the MFT entries looking for deleted files. For each one - * determine how much of the data lies in unused disk space. - * - * The list can be filtered by name, size and date, using command line options. - * - * Return: -1 Error, something went wrong - * n Success, the number of recoverable files - */ -int scan_disk (ntfs_volume *vol) -{ - const int BUFSIZE = 8192; - char *buffer = NULL; - int results = 0; - ntfs_attr *attr; - long long size; - long long read; - long long bmpsize; - int i, j, k, b; - int percent; - struct ufile *file; - regex_t re; - - if (!vol) - return -1; - - attr = ntfs_attr_open (vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0); - if (!attr) { - Eprintf ("Couldn't open $MFT/$BITMAP: %s\n", strerror (errno)); - return -1; - } - bmpsize = attr->initialized_size; - - buffer = malloc (BUFSIZE); - if (!buffer) { - Eprintf ("Couldn't allocate memory in scan_disk()\n"); - results = -1; - goto out; - } - - if (opts.match) { - int flags = REG_NOSUB; - - if (!opts.match_case) - flags |= REG_ICASE; - if (regcomp (&re, opts.match, flags)) { - Eprintf ("Couldn't create a regex.\n"); - goto out; - } - } - - Iprintf ("Inode Flags %%age Date Size Filename\n"); - Iprintf ("---------------------------------------------------------------\n"); - for (i = 0; i < bmpsize; i += BUFSIZE) { - read = min ((bmpsize - i), BUFSIZE); - size = ntfs_attr_pread (attr, i, read, buffer); - if (size < 0) - break; - - for (j = 0; j < size; j++) { - b = buffer[j]; - for (k = 0; k < 8; k++, b>>=1) { - if (((i+j)*8+k) >= vol->nr_mft_records) - goto done; - if (b & 1) - continue; - file = read_record (vol, (i+j)*8+k); - if (!file) { - Eprintf ("Couldn't read MFT Record %d.\n", (i+j)*8+k); - continue; - } - - if ((opts.since > 0) && (file->date <= opts.since)) - goto skip; - if (opts.match && !name_match (&re, file)) - goto skip; - if (opts.size_begin && (opts.size_begin > file->max_size)) - goto skip; - if (opts.size_end && (opts.size_end < file->max_size)) - goto skip; - - percent = calc_percentage (file, vol); - - if ((opts.percent == -1) || (percent >= opts.percent)) { - if (opts.verbose) - dump_record (file); - else - list_record (file); - } - - if (((opts.percent == -1) && (percent > 0)) || - ((opts.percent > 0) && (percent >= opts.percent))) { - results++; - } -skip: - free_file (file); - } - } - } -done: - Iprintf ("\nFiles with potentially recoverable content: %d\n", results); -out: - if (opts.match) - regfree (&re); - free (buffer); - if (attr) - ntfs_attr_close (attr); - return results; -} - -/** - * undelete_file - Recover a deleted file from an NTFS volume - * @vol: An ntfs volume obtained from ntfs_mount - * @inode: MFT Record number to be recovered - * - * Read an MFT Record and try an recover any data associated with it. Some of - * the clusters may be in use; these will be filled with zeros or the fill byte - * supplied in the options. - * - * Each data stream will be recovered and saved to a file. The file's name will - * be the original filename and it will be written to the current directory. - * Any named data stream will be saved as filename:streamname. - * - * The output file's name and location can be altered by using the command line - * options. - * - * N.B. We cannot tell if someone has overwritten some of the data since the - * file was deleted. - * - * Return: 0 Error, something went wrong - * 1 Success, the data was recovered - */ -int undelete_file (ntfs_volume *vol, long long inode) -{ - char *buffer = NULL; - struct ufile *file; - int i, j; - long long start, end; - run_list_element *rl; - struct list_head *item; - int fd = -1; - long long k; - int result = 0; - - if (!vol) - return 0; - - file = read_record (vol, inode); - if (!file || !file->mft) { - Eprintf ("Can't read info from mft record %lld.\n", inode); - return 0; - } - - buffer = malloc (vol->mft_record_size); - if (!buffer) - goto free; - - if (opts.verbose) { - dump_record (file); - } else { - Iprintf ("Inode Flags %%age Date Size Filename\n"); - Iprintf ("---------------------------------------------------------------\n"); - list_record (file); - Iprintf ("\n"); - } - - if (file->mft->flags & MFT_RECORD_IN_USE) { - Eprintf ("Record is in use by the mft\n"); - if (!opts.force) { - free_file (file); - return 0; - } - Vprintf ("Forced to continue.\n"); - } - - if (calc_percentage (file, vol) == 0) { - Iprintf ("File has no recoverable data.\n"); - goto free; - } - - if (list_empty (&file->data)) { - Iprintf ("File has no data. There is nothing to recover.\n"); - goto free; - } - - list_for_each (item, &file->data) { - struct data *d = list_entry (item, struct data, list); - - if (d->resident) { - fd = open_file (opts.dest, file->pref_name, d->name); - if (fd < 0) { - Eprintf ("Couldn't create file: %s\n", strerror (errno)); - goto free; - } - - Vprintf ("File has resident data.\n"); - if (write_data (fd, d->data, d->size_data) < d->size_data) { - Eprintf ("Write failed: %s\n", strerror (errno)); - close (fd); - goto free; - } - - if (close (fd) < 0) { - Eprintf ("Close failed: %s\n", strerror (errno)); - } - fd = -1; - } else { - rl = d->run_list; - if (!rl) { - Vprintf ("File has no run list, hence no data.\n"); - continue; - } - - if (rl[0].length <= 0) { - Vprintf ("File has an empty run list, hence no data.\n"); - continue; - } - - fd = open_file (opts.dest, file->pref_name, d->name); - if (fd < 0) { - Eprintf ("Couldn't create output file: %s\n", strerror (errno)); - goto free; - } - - if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ - Vprintf ("Missing segment at beginning, %lld clusters.\n", rl[0].length); - memset (buffer, opts.fillbyte, sizeof (buffer)); - for (k = 0; k < rl[0].length * vol->cluster_size; k += sizeof (buffer)) { - if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { - Eprintf ("Write failed: %s\n", strerror (errno)); - close (fd); - goto free; - } - } - } - - for (i = 0; rl[i].length > 0; i++) { - - if (rl[i].lcn == LCN_RL_NOT_MAPPED) { - Vprintf ("Missing segment at end, %lld clusters.\n", rl[i].length); - memset (buffer, opts.fillbyte, sizeof (buffer)); - for (k = 0; k < rl[k].length * vol->cluster_size; k += sizeof (buffer)) { - if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { - Eprintf ("Write failed: %s\n", strerror (errno)); - close (fd); - goto free; - } - } - continue; - } - - if (rl[i].lcn == LCN_HOLE) { - Vprintf ("File has a sparse section.\n"); - memset (buffer, 0, sizeof (buffer)); - for (k = 0; k < rl[k].length * vol->cluster_size; k += sizeof (buffer)) { - if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { - Eprintf ("Write failed: %s\n", strerror (errno)); - close (fd); - goto free; - } - } - continue; - } - - start = rl[i].lcn; - end = rl[i].lcn + rl[i].length; - - for (j = start; j < end; j++) { - if (cluster_in_use (vol, j)) { - memset (buffer, opts.fillbyte, sizeof (buffer)); - if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { - Eprintf ("Write failed: %s\n", strerror (errno)); - close (fd); - goto free; - } - } else { - if (ntfs_read_clusters (vol, j, 1, buffer) < 1) { - Eprintf ("Read failed: %s\n", strerror (errno)); - close (fd); - goto free; - } - if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { - Eprintf ("Write failed: %s\n", strerror (errno)); - close (fd); - goto free; - } - } - } - } - Iprintf ("\n"); - if (close (fd) < 0) { - Eprintf ("Close failed: %s\n", strerror (errno)); - } - fd = -1; - - } - if (d->name) - Iprintf ("Undeleted '%s:%s' successfully.\n", file->pref_name, d->name); - else - Iprintf ("Undeleted '%s' successfully.\n", file->pref_name); - } - result = 1; -free: - if (buffer) - free (buffer); - free_file (file); - return result; -} - -/** - * copy_mft - Write a range of MFT Records to a file - * @vol: An ntfs volume obtained from ntfs_mount - * @mft_begin: First MFT Record to save - * @mft_end: Last MFT Record to save - * - * Read a number of MFT Records and write them to a file. - * - * Return: 0 Success, all the records were written - * 1 Error, something went wrong - */ -int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) -{ - ntfs_attr *mft; - char *buffer; - const char *name; - long long i; - int result = 1; - int fd; - - if (!vol) - return 1; - - if (mft_end < mft_begin) { - Eprintf ("Range to copy is backwards.\n"); - return 1; - } - - buffer = malloc (vol->mft_record_size); - if (!buffer) { - Eprintf ("Couldn't allocate memory in copy_mft()\n"); - return 1; - } - - mft = ntfs_attr_open (vol->mft_ni, AT_DATA, NULL, 0); - if (!mft) { - Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); - goto free; - } - - name = opts.output; - if (!name) { - name = MFTFILE; - Dprintf ("No output filename, defaulting to '%s'.\n", name); - } - - fd = open_file (opts.dest, name, NULL); - if (fd < 0) { - Eprintf ("Couldn't open output file '%s': %s\n", name, strerror (errno)); - goto attr; - } - - mft_end = min (mft_end, vol->nr_mft_records - 1); - - Dprintf ("MFT records\n"); - Dprintf (" Total: %8lld\n", vol->nr_mft_records); - Dprintf (" Begin: %8lld\n", mft_begin); - Dprintf (" End: %8lld\n", mft_end); - - for (i = mft_begin; i <= mft_end; i++) { - if (ntfs_attr_pread (mft, vol->mft_record_size * i, vol->mft_record_size, buffer) < vol->mft_record_size) { - Eprintf ("Couldn't read MFT Record %d: %s.\n", i, strerror (errno)); - goto close; - } - - if (write_data (fd, buffer, vol->mft_record_size) < vol->mft_record_size) { - Eprintf ("Write failed: %s\n", strerror (errno)); - goto close; - } - } - - Vprintf ("Read %d MFT Records\n", mft_end - mft_begin + 1); - result = 0; -close: - close (fd); -attr: - ntfs_attr_close (mft); -free: - free (buffer); - return result; -} - -/** - * valid_device - Perform some safety checks on the device, before we start - * @name: Full pathname of the device/file to work with - * @force: Continue regardless of problems - * - * Check that the name refers to a device and that is isn't already mounted. - * These checks can be overridden by using the force option. - * - * Return: 1 Success, we can continue - * 0 Error, we cannot use this device - */ -int valid_device (const char *name, int force) -{ - unsigned long mnt_flags = 0; - struct stat st; - - if (stat (name, &st) == -1) { - if (errno == ENOENT) { - Eprintf ("The device %s doesn't exist\n", name); - } else { - Eprintf ("Error getting information about %s: %s\n", name, strerror (errno)); - } - return 0; - } - - if (!S_ISBLK (st.st_mode)) { - Vprintf ("%s is not a block device.\n", name); - if (!force) { - Eprintf ("Use the force option to work with files.\n"); - return 0; - } - Vprintf ("Forced to continue.\n"); - } - - /* Make sure the file system is not mounted. */ - if (ntfs_check_if_mounted (name, &mnt_flags)) { - Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); - if (!force) { - Eprintf ("Use the force option to ignore this error.\n"); - return 0; - } - Vprintf ("Forced to continue.\n"); - } else if (mnt_flags & NTFS_MF_MOUNTED) { - Vprintf ("The device %s, is mounted.\n", name); - if (!force) { - Eprintf ("Use the force option to work a mounted filesystem.\n"); - return 0; - } - Vprintf ("Forced to continue.\n"); - } - - Dprintf ("Device %s, will be used\n", name); - return 1; -} - -/** - * main - Begin here - * - * Start from here. - * - * Return: 0 Success, the program worked - * 1 Error, something went wrong - */ -int main (int argc, char *argv[]) -{ - const char *locale; - ntfs_volume *vol; - int result = 1; - - locale = setlocale (LC_ALL, ""); - if (!locale) { - locale = setlocale (LC_ALL, NULL); - Vprintf ("Failed to set locale, using default '%s'.\n", locale); - } else { - Vprintf ("Using locale '%s'.\n", locale); - } - - if (!parse_options (argc, argv)) - goto free; - - if (!valid_device (opts.device, opts.force)) - goto free; - - vol = ntfs_mount (opts.device, MS_RDONLY); - if (!vol) { - Eprintf ("Couldn't mount device '%s': %s\n", opts.device, strerror (errno)); - goto free; - } - - if (vol->flags & VOLUME_IS_DIRTY) { - Iprintf ("Volume is dirty.\n"); - if (!opts.force) { - Eprintf ("Run chkdsk and try again, or use the --force option.\n"); - goto umount; - } - Iprintf ("Forced to continue.\n"); - } - - switch (opts.mode) { - case MODE_SCAN: - result = !scan_disk (vol); - if (result) - Vprintf ("Failed to scan device '%s'.\n", opts.device); - break; - case MODE_UNDELETE: - result = !undelete_file (vol, opts.uinode); - if (result) - Vprintf ("Failed to undelete inode %d.\n", opts.uinode); - break; - case MODE_COPY: - result = !copy_mft (vol, opts.mft_begin, opts.mft_end); - if (result) - Vprintf ("Failed to read MFT blocks %lld-%lld.\n", - opts.mft_begin, min (vol->nr_mft_records, opts.mft_end)); - break; - default: - ; /* Cannot happen */ - } - -umount: - ntfs_umount (vol, FALSE); -free: - if (opts.match) - free (opts.match); - - return result; -} - diff --git a/ntfstools/ntfsundelete.h b/ntfstools/ntfsundelete.h deleted file mode 100644 index 21a63d8b..00000000 --- a/ntfstools/ntfsundelete.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * ntfsundelete - Part of the Linux-NTFS project. - * - * Copyright (c) 2002 Richard Russon - * - * This utility will recover deleted files from an NTFS volume. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFSUNDELETE_H_ -#define _NTFSUNDELETE_H_ - -#include "types.h" -#include "list.h" -#include "runlist.h" - -enum optmode { - MODE_NONE = 0, - MODE_SCAN, - MODE_UNDELETE, - MODE_COPY, - MODE_ERROR -}; - -struct options { - char *device; /* Device/File to work with */ - enum optmode mode; /* Scan / Undelete / Copy */ - int percent; /* Minimum recoverability */ - int uinode; /* Undelete this inode */ - char *dest; /* Save file to this directory */ - char *output; /* With this filename */ - char fillbyte; /* Use for unrecoverable sections */ - char *match; /* Pattern for filename matching */ - int match_case; /* Case sensitive matching */ - int quiet; /* Less output */ - int verbose; /* Extra output */ - int force; /* Override common sense */ - time_t since; /* Since this time */ - long long size_begin; /* Range for file size */ - long long size_end; - long long mft_begin; /* Range for mft copy */ - long long mft_end; -}; - -struct filename { - struct list_head list; /* Previous/Next links */ - char *name; /* Filename in current locale */ - FILE_NAME_TYPE_FLAGS name_space; - uchar_t *uname; /* Filename in unicode */ - int uname_len; /* and its length */ - long long size_alloc; /* Allocated size (multiple of cluster size) */ - long long size_data; /* Actual size of data */ - FILE_ATTR_FLAGS flags; - time_t date_c; - time_t date_a; - time_t date_m; - time_t date_r; -}; - -struct data { - struct list_head list; /* Previous/Next links */ - char *name; /* Stream name in current locale */ - uchar_t *uname; /* Unicode stream name */ - int uname_len; /* and its length */ - int resident; /* Stream is resident */ - int compressed; /* Stream is compressed */ - int encrypted; /* Stream is encrypted */ - long long size_alloc; /* Allocated size (multiple of cluster size) */ - long long size_data; /* Actual size of data */ - long long size_init; /* Initialised size, may be less than data size */ - long long size_vcn; /* Highest VCN in the data runs */ - run_list_element*run_list; /* Decoded data runs */ - int percent; /* Amont potentially recoverable */ - void *data; /* If resident, a pointer to the data */ -}; - -struct ufile { - long long inode; /* MFT record number */ - time_t date; /* Last modification date/time */ - struct list_head name; /* A list of filenames */ - struct list_head data; /* A list of data streams */ - char *pref_name; /* Preferred filename */ - long long max_size; /* Largest size we find */ - int attr_list; /* MFT record may be one of many */ - int directory; /* MFT record represents a directory */ - MFT_RECORD *mft; /* Raw MFT record */ -}; - -#endif /* _NTFSUNDELETE_H_ */ - diff --git a/ntfstools/ntfswipe.c b/ntfstools/ntfswipe.c deleted file mode 100644 index 120e6e52..00000000 --- a/ntfstools/ntfswipe.c +++ /dev/null @@ -1,732 +0,0 @@ -/** - * ntfswipe - Part of the Linux-NTFS project. - * - * Copyright (c) 2002 Richard Russon - * - * This utility will overwrite usused space on an NTFS volume. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ntfswipe.h" -#include "types.h" -#include "volume.h" - -static const char *AUTHOR = "Richard Russon (FlatCap)"; -static const char *EXEC_NAME = "ntfswipe"; -static struct options opts; - -/** - * Eprintf - Print error messages - */ -void Eprintf (const char *format, ...) -{ - va_list va; - va_start (va, format); - vfprintf (stderr, format, va); - va_end (va); -} - -/** - * Iprintf - Print informative messages - */ -void Iprintf (const char *format, ...) -{ - va_list va; -#ifndef DEBUG - if (opts.quiet) - return; -#endif - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -} - -/** - * Vprintf - Print verbose messages - */ -void Vprintf (const char *format, ...) -{ - va_list va; -#ifndef DEBUG - if (!opts.verbose) - return; -#endif - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -} - -/** - * Dprintf - Print debug messages - */ -#ifndef DEBUG -#define Dprintf(...) -#else -void Dprintf (const char *format, ...) -{ - va_list va; - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -} -#endif - -/** - * wipe_unused - Wipe unused clusters - * @vol: An ntfs volume obtained from ntfs_mount - * @byte: Overwrite with this value - * - * Read $Bitmap and wipe any clusters that are marked as not in use. - * - * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong - */ -int wipe_unused (ntfs_volume *vol, int byte) -{ - if (!vol || (byte < 0)) - return 0; - - Iprintf ("wipe_unused 0x%02x\n", byte); - return 1; -} - -/** - * wipe_tails - Wipe the file tails - * @vol: An ntfs volume obtained from ntfs_mount - * @byte: Overwrite with this value - * - * Disk space is allocated in clusters. If a file isn't an exact multiple of - * the cluster size, there is some slack space at the end. Wipe this space. - * - * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong - */ -int wipe_tails (ntfs_volume *vol, int byte) -{ - if (!vol || (byte < 0)) - return 0; - - Iprintf ("wipe_tails 0x%02x\n", byte); - return 1; -} - -/** - * wipe_mft - Wipe the MFT slack space - * @vol: An ntfs volume obtained from ntfs_mount - * @byte: Overwrite with this value - * - * MFT Records are 1024 bytes long, but some of this space isn't used. Wipe any - * unused space at the end of the record and wipe any unused records. - * - * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong - */ -int wipe_mft (ntfs_volume *vol, int byte) -{ - if (!vol || (byte < 0)) - return 0; - - Iprintf ("wipe_mft 0x%02x\n", byte); - return 1; -} - -/** - * wipe_directory - Wipe the directiry indexes - * @vol: An ntfs volume obtained from ntfs_mount - * @byte: Overwrite with this value - * - * Directories are kept in sorted B+ Trees. Index blocks may not be full. Wipe - * the unused space at the ends of these blocks. - * - * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong - */ -int wipe_directory (ntfs_volume *vol, int byte) -{ - if (!vol || (byte < 0)) - return 0; - - Iprintf ("wipe_directory 0x%02x\n", byte); - return 1; -} - -/** - * wipe_logfile - Wipe the logfile (journal) - * @vol: An ntfs volume obtained from ntfs_mount - * @byte: Overwrite with this value - * - * The logfile journals the metadata to give the volume fault-tolerance. If the - * volume is in a consistant state, then this information can be erased. - * - * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong - */ -int wipe_logfile (ntfs_volume *vol, int byte) -{ - if (!vol || (byte < 0)) - return 0; - - Iprintf ("wipe_logfile 0x%02x\n", byte); - return 1; -} - -/** - * wipe_pagefile - Wipe the pagefile (swap space) - * @vol: An ntfs volume obtained from ntfs_mount - * @byte: Overwrite with this value - * - * pagefile.sys is used by Windows as extra virtual memory (swap space). - * Windows recreates the file at bootup, so it can be wiped without harm. - * - * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong - */ -int wipe_pagefile (ntfs_volume *vol, int byte) -{ - if (!vol || (byte < 0)) - return 0; - - Iprintf ("wipe_pagefile 0x%02x\n", byte); - return 1; -} - -/** - * ntfs_info - Display information about the NTFS Volume - * @vol: An ntfs volume obtained from ntfs_mount - * - * Tell the user how much could be cleaned up. List the number of free - * clusters, MFT records, etc. - * - * Return: 1 Success, displayed some info - * 0 Error, something went wrong - */ -int ntfs_info (ntfs_volume *vol) -{ - if (!vol) - return 0; - - Iprintf ("ntfs_info\n"); - return 1; -} - - -/** - * version - Print version information about the program - * - * Print a copyright statement and a brief description of the program. - * - * Return: none - */ -void version (void) -{ - Iprintf ("%s v%s Copyright (C) 2002 %s\nOverwrite the unused space on " - "an NTFS Volume\n\n%s is free software, released under the GNU " - "General Public License\nand you are welcome to redistribute " - "it under certain conditions.\n%s comes with ABSOLUTELY NO " - "WARRANTY; for details read the GNU\nGeneral Public License " - "to be found in the file COPYING in the main\nLinux-NTFS " - "distribution directory.\n\n", - EXEC_NAME, VERSION, AUTHOR, EXEC_NAME, EXEC_NAME); -} - -/** - * usage - Print a list of the parameters to the program - * - * Print a list of the parameters and options for the program. - * - * Return: none - */ -void usage (void) -{ - Iprintf ("Usage: %s [options] device\n" - " -i --info Show volume information (default)\n" - "\n" - " -d --directory Wipe directory indexes\n" - " -l --logfile Wipe the logfile (journal)\n" - " -m --mft Wipe mft space\n" - " -p --pagefile Wipe pagefile (swap space)\n" - " -t --tails Wipe file tails\n" - " -u --unused Wipe unused clusters\n" - "\n" - " -a --all Wipe all unused space\n" - "\n" - " -c num --count num Number of times to write (default = 1)\n" - " -b list --bytes list List of values to write (default = 0)\n" - "\n" - " -n --no-action Do not write to disk\n" - " -f --force Use less caution\n" - " -q --quiet Less output\n" - " -v --verbose More output\n" - " -V --version Version information\n" - " -h --help Print this help\n\n", - EXEC_NAME); - Iprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); -} - -/** - * parse_list - Read a comma-separated list of numbers - * @list: The comma-separated list of numbers - * @result: Store the parsed list here (must be freed by caller) - * - * Read a comma-separated list of numbers and allocate an array of ints to store - * them in. The numbers can be in decimal, octal or hex. - * - * N.B. The caller must free the memory returned in @result. - * N.B. If the function fails, @result is not changed. - * - * Return: 0 Error, invalid string - * n Success, the count of numbers parsed - */ -int parse_list (const char *list, int **result) -{ - const char *ptr; - char *end; - int i; - int count; - int *mem = NULL; - - if (!list || !result) - return 0; - - for (count = 0, ptr = list; ptr; ptr = strchr (ptr+1, ',')) - count++; - - mem = malloc ((count+1) * sizeof (int)); - if (!mem) { - Eprintf ("Couldn't allocate memory in parse_list().\n"); - return 0; - } - - memset (mem, 0xFF, (count+1) * sizeof (int)); - - for (ptr = list, i = 0; i < count; i++) { - - end = NULL; - mem[i] = strtol (ptr, &end, 0); - - if (!end || (end == ptr) || ((*end != ',') && (*end != 0))) { - Eprintf ("Invalid list '%s'\n", list); - free (mem); - return 0; - } - - if ((mem[i] < 0) || (mem[i] > 255)) { - Eprintf ("Bytes must be in range 0-255.\n"); - free (mem); - return 0; - } - - ptr = end + 1; - } - - Dprintf ("Parsing list '%s' - ", list); - for (i = 0; i <= count; i++) - Dprintf ("0x%02x ", mem[i]); - Dprintf ("\n"); - - *result = mem; - return count; -} - -/** - * parse_options - Read and validate the programs command line - * - * Read the command line, verify the syntax and parse the options. - * This function is very long, but quite simple. - * - * Return: 1 Success - * 0 Error, one or more problems - */ -int parse_options (int argc, char *argv[]) -{ - static const char *sopt = "-ab:c:dfhilmnpqtuvV"; - static const struct option lopt[] = { - { "all", no_argument, NULL, 'a' }, - { "bytes", required_argument, NULL, 'b' }, - { "count", required_argument, NULL, 'c' }, - { "directory", no_argument, NULL, 'd' }, - { "force", no_argument, NULL, 'f' }, - { "help", no_argument, NULL, 'h' }, - { "info", no_argument, NULL, 'i' }, - { "logfile", no_argument, NULL, 'l' }, - { "mft", no_argument, NULL, 'm' }, - { "no-action", no_argument, NULL, 'n' }, - { "pagefile", no_argument, NULL, 'p' }, - { "quiet", no_argument, NULL, 'q' }, - { "tails", no_argument, NULL, 't' }, - { "unused", no_argument, NULL, 'u' }, - { "verbose", no_argument, NULL, 'v' }, - { "version", no_argument, NULL, 'V' }, - { NULL, 0, NULL, 0 } - }; - - char c = -1; - char *end; - int err = 0; - int ver = 0; - int help = 0; - - opterr = 0; /* We'll handle the errors, thank you. */ - - opts.count = 1; - - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { - switch (c) { - case 1: /* A non-option argument */ - if (!opts.device) { - opts.device = argv[optind-1]; - } else { - opts.device = NULL; - err++; - } - break; - - case 'a': - opts.directory++; - opts.logfile++; - opts.mft++; - opts.pagefile++; - opts.tails++; - opts.unused++; - break; - case 'b': - if (!opts.bytes) { - if (!parse_list (argv[optind-1], &opts.bytes)) - err++; - } else { - err++; - } - break; - case 'c': - if (opts.count == 1) { - end = NULL; - opts.count = strtol (optarg, &end, 0); - if (end && *end) - err++; - } else { - err++; - } - break; - case 'd': - opts.directory++; - break; - case 'f': - opts.force++; - break; - case 'h': - help++; - break; - case 'i': - opts.info++; - break; - case 'l': - opts.logfile++; - break; - case 'm': - opts.mft++; - break; - case 'n': - opts.noaction++; - break; - case 'p': - opts.pagefile++; - break; - case 'q': - opts.quiet++; - break; - case 't': - opts.tails++; - break; - case 'u': - opts.unused++; - break; - case 'v': - opts.verbose++; - break; - case 'V': - ver++; - break; - default: - if ((optopt == 'b') || (optopt == 'c')) { - Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); - } else { - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); - } - err++; - break; - } - } - - if (help || ver) { - opts.quiet = 0; - } else { - if (opts.device == NULL) { - Eprintf ("You must specify exactly one device.\n"); - err++; - } - - if ((opts.quiet) && (opts.verbose)) { - Eprintf ("You may not use --quiet and --verbose at the same time.\n"); - err++; - } - - if (opts.info && (opts.unused || opts.tails || opts.mft || opts.directory)) { - Eprintf ("You may not use any other options with --info.\n"); - err++; - } - - if ((opts.count < 1) || (opts.count > 100)) { - Eprintf ("The iteration count must be between 1 and 100.\n"); - err++; - } - - /*if (opts.bytes && (opts.count > 0)) { - Eprintf ("You may not use both --bytes and --count.\n"); - err++; - }*/ - - /* Create a default list */ - if (!opts.bytes) { - opts.bytes = malloc (2 * sizeof (int)); - if (opts.bytes) { - opts.bytes[0] = 0; - opts.bytes[1] = -1; - } - } - - if (!opts.directory && !opts.logfile && !opts.mft && - !opts.pagefile && !opts.tails && !opts.unused) { - opts.info = 1; - } - } - - if (ver) - version(); - if (help || err) - usage(); - - return (!err && !help && !ver); -} - -/** - * valid_device - Perform some safety checks on the device, before we start - * @name: Full pathname of the device/file to work with - * @force: Continue regardless of problems - * - * Check that the name refers to a device and that is isn't already mounted. - * These checks can be overridden by using the force option. - * - * Return: 1 Success, we can continue - * 0 Error, we cannot use this device - */ -int valid_device (const char *name, int force) -{ - unsigned long mnt_flags = 0; - struct stat st; - - if (stat (name, &st) == -1) { - if (errno == ENOENT) { - Eprintf ("The device %s doesn't exist\n", name); - } else { - Eprintf ("Error getting information about %s: %s\n", name, strerror (errno)); - } - return 0; - } - - if (!S_ISBLK (st.st_mode)) { - Vprintf ("%s is not a block device.\n", name); - if (!force) { - Eprintf ("Use the force option to work with files.\n"); - return 0; - } - Vprintf ("Forced to continue.\n"); - } - - /* Make sure the file system is not mounted. */ - if (ntfs_check_if_mounted (name, &mnt_flags)) { - Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); - if (!force) { - Eprintf ("Use the force option to ignore this error.\n"); - return 0; - } - Vprintf ("Forced to continue.\n"); - } else if (mnt_flags & NTFS_MF_MOUNTED) { - Vprintf ("The device %s, is mounted.\n", name); - if (!force) { - Eprintf ("Use the force option to work a mounted filesystem.\n"); - return 0; - } - Vprintf ("Forced to continue.\n"); - } - - Dprintf ("Device %s, will be used\n", name); - return 1; -} - - -/** - * print_summary - Tell the use what we are about to do - * - * List the operations about to be performed. The output will be silenced by - * the --quiet option. - * - * Return: none - */ -void print_summary (void) -{ - int i; - - if (opts.noaction) - Iprintf ("%s is in 'no-action' mode, it will NOT write to disk." - "\n\n", EXEC_NAME); - - Iprintf ("%s is about to wipe:\n", EXEC_NAME); - if (opts.unused) - Iprintf ("\tunused disk space\n"); - if (opts.tails) - Iprintf ("\tfile tails\n"); - if (opts.mft) - Iprintf ("\tunused mft areas\n"); - if (opts.directory) - Iprintf ("\tunused directory index space\n"); - if (opts.logfile) - Iprintf ("\tthe logfile (journal)\n"); - if (opts.pagefile) - Iprintf ("\tthe pagefile (swap space)\n"); - - Iprintf ("\n%s will overwrite these areas with: ", EXEC_NAME); - if (opts.bytes) { - for (i = 0; opts.bytes[i] >= 0; i++) - Iprintf ("0x%02x ", opts.bytes[i]); - } - Iprintf ("\n"); - - if (opts.count > 1) - Iprintf ("%s will repeat these operations %d times.\n", EXEC_NAME, opts.count); - Iprintf ("\n"); -} - -/** - * main - Begin here - * - * Start from here. - * - * Return: 0 Success, the program worked - * 1 Error, something went wrong - */ -int main (int argc, char *argv[]) -{ - const char *locale; - ntfs_volume *vol; - int result = 1; - int flags = 0; - int i, j; - - locale = setlocale (LC_ALL, ""); - if (!locale) { - locale = setlocale (LC_ALL, NULL); - Vprintf ("Failed to set locale, using default '%s'.\n", locale); - } else { - Vprintf ("Using locale '%s'.\n", locale); - } - - if (!parse_options (argc, argv)) - return 1; - - if (!valid_device (opts.device, opts.force)) { - goto free; - } - - if (!opts.info) - print_summary(); - - if (opts.info || opts.noaction) - flags = MS_RDONLY; - vol = ntfs_mount (opts.device, flags); - if (!vol) { - Eprintf ("Couldn't mount device '%s': %s\n", opts.device, strerror (errno)); - goto free; - } - - if (vol->flags & VOLUME_IS_DIRTY) { - Iprintf ("Volume is dirty.\n"); - if (!opts.force) { - Eprintf ("Run chkdsk and try again, or use the --force option.\n"); - goto umount; - } - Iprintf ("Forced to continue.\n"); - } - - if (opts.info) { - ntfs_info (vol); - result = 0; - goto umount; - } - - /* Even if the output it quieted, you still get 5 seconds to abort. */ - if (!opts.force) { - Iprintf ("\n%s will begin in 5 seconds, press CTRL-C to abort.\n", EXEC_NAME); - sleep (5); - } - - if (!opts.bytes) { - Eprintf ("Internal error, byte list is empty\n"); - goto umount; - } - - for (i = 0; i < opts.count; i++) { - int byte; - for (j = 0; byte = opts.bytes[j], byte >= 0; j++) { - if (opts.unused && !wipe_unused (vol, byte)) - goto umount; - if (opts.tails && !wipe_tails (vol, byte)) - goto umount; - if (opts.mft && !wipe_mft (vol, byte)) - goto umount; - if (opts.directory && !wipe_directory (vol, byte)) - goto umount; - if (opts.logfile && !wipe_logfile (vol, byte)) - goto umount; - if (opts.pagefile && !wipe_pagefile (vol, byte)) - goto umount; - } - } - - result = 0; -umount: - ntfs_umount (vol, FALSE); -free: - if (opts.bytes) - free (opts.bytes); - return result; -} - - diff --git a/ntfstools/ntfswipe.h b/ntfstools/ntfswipe.h deleted file mode 100644 index f06358c2..00000000 --- a/ntfstools/ntfswipe.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * ntfswipe - Part of the Linux-NTFS project. - * - * Copyright (c) 2002 Richard Russon - * - * This utility will overwrite usused space on an NTFS volume. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFSWIPE_H_ -#define _NTFSWIPE_H_ - -#include "types.h" - -struct options { - char *device; /* Device/File to work with */ - int info; /* Show volume info */ - int force; /* Override common sense */ - int quiet; /* Less output */ - int verbose; /* Extra output */ - int noaction; /* Do not write to disk */ - int count; /* Number of iterations */ - int *bytes; /* List of overwrite characters */ - int directory; /* Wipe directory indexes */ - int logfile; /* Wipe the logfile (journal) */ - int mft; /* Wipe mft slack space */ - int pagefile; /* Wipe pagefile (swap space) */ - int tails; /* Wipe file tails */ - int unused; /* Wipe unused clusters */ -}; - -#endif /* _NTFSWIPE_H_ */ - diff --git a/ntfstools/sd.c b/ntfstools/sd.c deleted file mode 100644 index 0e0f0863..00000000 --- a/ntfstools/sd.c +++ /dev/null @@ -1,200 +0,0 @@ -#include "types.h" -#include "layout.h" - -/* - * NTFS 1.2 - System files security decriptors - * =========================================== - * - * Create the security descriptor for system file number @sys_file_no and - * return a pointer to the descriptor. - * - * $MFT, $MFTMirr, $LogFile, $AttrDef, $Bitmap, $Boot, $BadClus, and $UpCase - * are the same. - * - * $Volume, $Quota, and system files 0xb-0xf are the same. They are almost the - * same as the above, the only difference being that the two SIDs present in - * the DACL grant GENERIC_WRITE and GENERIC_READ equivalent priviledges while - * the above only grant GENERIC_READ equivalent priviledges. (For some reason - * the flags for GENERIC_READ/GENERIC_WRITE are not set by NT4, even though - * the permissions are equivalent, so we comply. - * - * Root directory system file (".") is different altogether. - * - * The sd is recturned in *@sd_val and has length *@sd_val_len. - * - * Do NOT free *@sd_val as it is static memory. This also means that you can - * only use *@sd_val until the next call to this function. - * - */ -void init_system_file_sd(int sys_file_no, char **sd_val, int *sd_val_len) -{ - static char sd_array[0x68]; - SECURITY_DESCRIPTOR_RELATIVE *sd; - ACL *acl; - ACCESS_ALLOWED_ACE *aa_ace; - SID *sid; - - if (sys_file_no < 0 || sys_file_no > 0xf) { - *sd_val = NULL; - *sd_val_len = 0; - return; - } - *sd_val = (char*)&sd_array; - sd = (SECURITY_DESCRIPTOR_RELATIVE*)&sd_array; - sd->revision = 1; - sd->alignment = 0; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - if (sys_file_no == FILE_root) { - *sd_val_len = 0x50; - sd->owner = cpu_to_le32(0x30); - sd->group = cpu_to_le32(0x40); - } else { - *sd_val_len = 0x68; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); - } - sd->sacl = cpu_to_le32(0); - sd->dacl = cpu_to_le32(0x14); - /* - * Now at offset 0x14, as specified in the security descriptor, we have - * the DACL. - */ - acl = (ACL*)((char*)sd + le32_to_cpu(sd->dacl)); - acl->revision = 2; - acl->alignment1 = 0; - if (sys_file_no == FILE_root) { - acl->size = cpu_to_le16(0x1c); - acl->ace_count = cpu_to_le16(1); - } else { - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(2); - } - acl->alignment2 = cpu_to_le16(0); - /* - * Now at offset 0x1c, just after the DACL's ACL, we have the first - * ACE of the DACL. The type of the ACE is access allowed. - */ - aa_ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - aa_ace->type = ACCESS_ALLOWED_ACE_TYPE; - if (sys_file_no == FILE_root) - aa_ace->flags = CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE; - else - aa_ace->flags = 0; - aa_ace->size = cpu_to_le16(0x14); - switch (sys_file_no) { - case FILE_MFT: case FILE_MFTMirr: case FILE_LogFile: - case FILE_AttrDef: case FILE_Bitmap: case FILE_Boot: - case FILE_BadClus: case FILE_UpCase: - aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ | - FILE_READ_ATTRIBUTES | FILE_READ_EA | FILE_READ_DATA; - break; - case FILE_Volume: case FILE_Secure: case 0xb ... 0xf: - aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_WRITE | - FILE_WRITE_ATTRIBUTES | FILE_READ_ATTRIBUTES | - FILE_WRITE_EA | FILE_READ_EA | FILE_APPEND_DATA | - FILE_WRITE_DATA | FILE_READ_DATA; - break; - case FILE_root: - aa_ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_READ_ATTRIBUTES | FILE_DELETE_CHILD | - FILE_TRAVERSE | FILE_WRITE_EA | FILE_READ_EA | - FILE_ADD_SUBDIRECTORY | FILE_ADD_FILE | - FILE_LIST_DIRECTORY; - break; - } - aa_ace->sid.revision = 1; - aa_ace->sid.sub_authority_count = 1; - aa_ace->sid.identifier_authority.value[0] = 0; - aa_ace->sid.identifier_authority.value[1] = 0; - aa_ace->sid.identifier_authority.value[2] = 0; - aa_ace->sid.identifier_authority.value[3] = 0; - aa_ace->sid.identifier_authority.value[4] = 0; - if (sys_file_no == FILE_root) { - /* SECURITY_WORLD_SID_AUTHORITY (S-1-1) */ - aa_ace->sid.identifier_authority.value[5] = 1; - aa_ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_WORLD_RID); - /* This is S-1-1-0, the WORLD_SID. */ - } else { - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - aa_ace->sid.identifier_authority.value[5] = 5; - aa_ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - } - /* - * Now at offset 0x30 within security descriptor, just after the first - * ACE of the DACL. All system files, except the root directory, have - * a second ACE. - */ - if (sys_file_no != FILE_root) { - /* The second ACE of the DACL. Type is access allowed. */ - aa_ace = (ACCESS_ALLOWED_ACE*)((char*)aa_ace + - le16_to_cpu(aa_ace->size)); - aa_ace->type = ACCESS_ALLOWED_ACE_TYPE; - aa_ace->flags = 0; - aa_ace->size = cpu_to_le16(0x18); - switch (sys_file_no) { - case FILE_MFT: case FILE_MFTMirr: - case FILE_LogFile: case FILE_AttrDef: - case FILE_Bitmap: case FILE_Boot: - case FILE_BadClus: case FILE_UpCase: - aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ | - FILE_READ_ATTRIBUTES | FILE_READ_EA | - FILE_READ_DATA; - break; - case FILE_Volume: case FILE_Secure: - case 0xb ... 0xf: - aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ | - FILE_WRITE_ATTRIBUTES | - FILE_READ_ATTRIBUTES | FILE_WRITE_EA | - FILE_READ_EA | FILE_APPEND_DATA | - FILE_WRITE_DATA | FILE_READ_DATA; - break; - } - aa_ace->sid.revision = 1; - aa_ace->sid.sub_authority_count = 2; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - aa_ace->sid.identifier_authority.value[0] = 0; - aa_ace->sid.identifier_authority.value[1] = 0; - aa_ace->sid.identifier_authority.value[2] = 0; - aa_ace->sid.identifier_authority.value[3] = 0; - aa_ace->sid.identifier_authority.value[4] = 0; - aa_ace->sid.identifier_authority.value[5] = 5; - aa_ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - aa_ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - /* Now at offset 0x48 into the security descriptor. */ - } - /* As specified in the security descriptor, we now have the owner SID.*/ - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 1; - sid->sub_authority_count = 2; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - /* - * Now at offset 0x40 or 0x58 (root directory and the other system - * files, respectively) into the security descriptor, as specified in - * the security descriptor, we have the group SID. - */ - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 1; - sid->sub_authority_count = 2; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); -} - diff --git a/ntfstools/upcase.c b/ntfstools/upcase.c deleted file mode 100644 index a184379a..00000000 --- a/ntfstools/upcase.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * $Id$ - * - * Copyright (c) 2001 Richard Russon - * Copyright (c) 2001-2002 Anton Altaparmakov - * - * Modified for mkntfs inclusion 9 June 2001 by Anton Altaparmakov. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS source - * in the file COPYING); if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "types.h" - -void init_upcase_table(uchar_t *uc, u32 uc_len) -{ - static int uc_run_table[][3] = { /* Start, End, Add */ - {0x0061, 0x007B, -32}, {0x0451, 0x045D, -80}, {0x1F70, 0x1F72, 74}, - {0x00E0, 0x00F7, -32}, {0x045E, 0x0460, -80}, {0x1F72, 0x1F76, 86}, - {0x00F8, 0x00FF, -32}, {0x0561, 0x0587, -48}, {0x1F76, 0x1F78, 100}, - {0x0256, 0x0258, -205}, {0x1F00, 0x1F08, 8}, {0x1F78, 0x1F7A, 128}, - {0x028A, 0x028C, -217}, {0x1F10, 0x1F16, 8}, {0x1F7A, 0x1F7C, 112}, - {0x03AC, 0x03AD, -38}, {0x1F20, 0x1F28, 8}, {0x1F7C, 0x1F7E, 126}, - {0x03AD, 0x03B0, -37}, {0x1F30, 0x1F38, 8}, {0x1FB0, 0x1FB2, 8}, - {0x03B1, 0x03C2, -32}, {0x1F40, 0x1F46, 8}, {0x1FD0, 0x1FD2, 8}, - {0x03C2, 0x03C3, -31}, {0x1F51, 0x1F52, 8}, {0x1FE0, 0x1FE2, 8}, - {0x03C3, 0x03CC, -32}, {0x1F53, 0x1F54, 8}, {0x1FE5, 0x1FE6, 7}, - {0x03CC, 0x03CD, -64}, {0x1F55, 0x1F56, 8}, {0x2170, 0x2180, -16}, - {0x03CD, 0x03CF, -63}, {0x1F57, 0x1F58, 8}, {0x24D0, 0x24EA, -26}, - {0x0430, 0x0450, -32}, {0x1F60, 0x1F68, 8}, {0xFF41, 0xFF5B, -32}, - {0} - }; - static int uc_dup_table[][2] = { /* Start, End */ - {0x0100, 0x012F}, {0x01A0, 0x01A6}, {0x03E2, 0x03EF}, {0x04CB, 0x04CC}, - {0x0132, 0x0137}, {0x01B3, 0x01B7}, {0x0460, 0x0481}, {0x04D0, 0x04EB}, - {0x0139, 0x0149}, {0x01CD, 0x01DD}, {0x0490, 0x04BF}, {0x04EE, 0x04F5}, - {0x014A, 0x0178}, {0x01DE, 0x01EF}, {0x04BF, 0x04BF}, {0x04F8, 0x04F9}, - {0x0179, 0x017E}, {0x01F4, 0x01F5}, {0x04C1, 0x04C4}, {0x1E00, 0x1E95}, - {0x018B, 0x018B}, {0x01FA, 0x0218}, {0x04C7, 0x04C8}, {0x1EA0, 0x1EF9}, - {0} - }; - static int uc_byte_table[][2] = { /* Offset, Value */ - {0x00FF, 0x0178}, {0x01AD, 0x01AC}, {0x01F3, 0x01F1}, {0x0269, 0x0196}, - {0x0183, 0x0182}, {0x01B0, 0x01AF}, {0x0253, 0x0181}, {0x026F, 0x019C}, - {0x0185, 0x0184}, {0x01B9, 0x01B8}, {0x0254, 0x0186}, {0x0272, 0x019D}, - {0x0188, 0x0187}, {0x01BD, 0x01BC}, {0x0259, 0x018F}, {0x0275, 0x019F}, - {0x018C, 0x018B}, {0x01C6, 0x01C4}, {0x025B, 0x0190}, {0x0283, 0x01A9}, - {0x0192, 0x0191}, {0x01C9, 0x01C7}, {0x0260, 0x0193}, {0x0288, 0x01AE}, - {0x0199, 0x0198}, {0x01CC, 0x01CA}, {0x0263, 0x0194}, {0x0292, 0x01B7}, - {0x01A8, 0x01A7}, {0x01DD, 0x018E}, {0x0268, 0x0197}, - {0} - }; - int i, r; - - memset((char*)uc, 0, uc_len); - uc_len >>= 1; - for (i = 0; i < uc_len; i++) - uc[i] = i; - for (r = 0; uc_run_table[r][0]; r++) - for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) - uc[i] += uc_run_table[r][2]; - for (r = 0; uc_dup_table[r][0]; r++) - for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) - uc[i + 1]--; - for (r = 0; uc_byte_table[r][0]; r++) - uc[uc_byte_table[r][0]] = uc_byte_table[r][1]; -} - From 7bd958a423ec9ad3b10931bfe8c257d08dcb4f32 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0154/2994] ntfstools->ntfsprogs (Logical change 1.23) --- COPYING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COPYING b/COPYING index 49089056..6b2ef060 100644 --- a/COPYING +++ b/COPYING @@ -1,7 +1,7 @@ NOTE: The GPL below is copyrighted by the Free Software Foundation, but the instances of code that it refers to (the Linux-NTFS project, - including the NTFS library "libntfs", the NTFS utilities "ntfstools" + including the NTFS library "libntfs", the NTFS utilities "ntfsprogs" and the Linux kernel NTFS driver) are copyrighted by me and others who actually wrote them. From 6ee7d748cf61e4a5174cd19be60b7c8ab04bc8c4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0155/2994] ntfstools->ntfsprogs and update build system BKrev: 3de75aa3a5HJh_zGVUUxc55JRXYW8g From 6b57405c1bcf0f382b6541be98d7e81413f83a4a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0156/2994] update build system (Logical change 1.23) --- Makefile.in | 6 +++--- configure | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Makefile.in b/Makefile.in index a4c45313..015b894c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -91,11 +91,11 @@ all_libraries = @all_libraries@ @DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall @DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 -SUBDIRS = doc include libntfs ntfstools +SUBDIRS = doc include libntfs ntfsprogs EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ INSTALL NEWS README autogen.sh linux-ntfs.spec.in \ - TODO.ntfstools + TODO.ntfsprogs AUTOMAKE_OPTIONS = gnu @@ -395,7 +395,7 @@ libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status --recheck strip: - $(MAKE) -C ntfstools strip + $(MAKE) -C ntfsprogs strip # 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. diff --git a/configure b/configure index 179f0e86..8a271fde 100755 --- a/configure +++ b/configure @@ -6324,13 +6324,13 @@ trap 'rm -fr `echo " doc/Makefile include/Makefile libntfs/Makefile - ntfstools/Makefile - ntfstools/mkntfs.8 - ntfstools/ntfsfix.8 - ntfstools/ntfslabel.8 - ntfstools/ntfsinfo.8 - ntfstools/ntfsundelete.8 - ntfstools/ntfsresize.8 + ntfsprogs/Makefile + ntfsprogs/mkntfs.8 + ntfsprogs/ntfsfix.8 + ntfsprogs/ntfslabel.8 + ntfsprogs/ntfsinfo.8 + ntfsprogs/ntfsundelete.8 + ntfsprogs/ntfsresize.8 linux-ntfs.spec config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF @@ -6457,13 +6457,13 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile include/Makefile libntfs/Makefile - ntfstools/Makefile - ntfstools/mkntfs.8 - ntfstools/ntfsfix.8 - ntfstools/ntfslabel.8 - ntfstools/ntfsinfo.8 - ntfstools/ntfsundelete.8 - ntfstools/ntfsresize.8 + ntfsprogs/Makefile + ntfsprogs/mkntfs.8 + ntfsprogs/ntfsfix.8 + ntfsprogs/ntfslabel.8 + ntfsprogs/ntfsinfo.8 + ntfsprogs/ntfsundelete.8 + ntfsprogs/ntfsresize.8 linux-ntfs.spec "} EOF From f3c4b8d8ac9842eb2a546abc29fb7391c08c6a5b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0157/2994] update build system 2002/11/29 12:07:08+00:00 cantab.net!aia21 mvdir (Logical change 1.23) --- ntfsprogs/Makefile.in | 595 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 595 insertions(+) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index e69de29b..ffbc01e6 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -0,0 +1,595 @@ +# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Need this to enable 64-bit (device) file access functions and parameters. + + +SHELL = @SHELL@ + +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 = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +AS = @AS@ +AUTODIRS = @AUTODIRS@ +CC = @CC@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +EXEEXT = @EXEEXT@ +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall +@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 +@REALLYSTATIC_TRUE@AM_LIBS = @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@AM_LIBS = @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@AM_LFLAGS = @REALLYSTATIC_TRUE@-static +@REALLYSTATIC_FALSE@AM_LFLAGS = @REALLYSTATIC_FALSE@$(all_libraries) +@REALLYSTATIC_TRUE@STATIC_LINK = @REALLYSTATIC_TRUE@$(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +@REALLYSTATIC_FALSE@LIBTOOL_LINK = @REALLYSTATIC_FALSE@$(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ + +# Workaround to make REALLYSTATIC work with automake 1.5. +LINK = $(STATIC_LINK) $(LIBTOOL_LINK) + +bin_PROGRAMS = ntfsfix ntfsinfo +sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe + +man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 \ + ntfsresize.8 + +EXTRA_MANS = + +CLEANFILES = $(EXTRA_PROGRAMS) + +linux_ntfsincludedir = -I$(top_srcdir)/include + +# Set the include path. +INCLUDES = -I$(top_srcdir)/include $(all_includes) + +ntfsfix_SOURCES = ntfsfix.c +ntfsfix_LDADD = $(AM_LIBS) +ntfsfix_LDFLAGS = $(AM_LFLAGS) + +mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c +mkntfs_LDADD = $(AM_LIBS) +mkntfs_LDFLAGS = $(AM_LFLAGS) + +ntfslabel_SOURCES = ntfslabel.c +ntfslabel_LDADD = $(AM_LIBS) +ntfslabel_LDFLAGS = $(AM_LFLAGS) + +ntfsinfo_SOURCES = ntfsinfo.c +ntfsinfo_LDADD = $(AM_LIBS) +ntfsinfo_LDFLAGS = $(AM_LFLAGS) + +ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h +ntfsundelete_LDADD = $(AM_LIBS) +ntfsundelete_LDFLAGS = $(AM_LFLAGS) + +ntfsresize_SOURCES = ntfsresize.c +ntfsresize_LDADD = $(AM_LIBS) +ntfsresize_LDFLAGS = $(AM_LFLAGS) + +# We don't distribute these + +ntfswipe_SOURCES = ntfswipe.c ntfswipe.h +ntfswipe_LDADD = $(AM_LIBS) +ntfswipe_LDFLAGS = $(AM_LFLAGS) + +ntfsdump_logfile_SOURCES = ntfsdump_logfile.c +ntfsdump_logfile_LDADD = $(AM_LIBS) +ntfsdump_logfile_LDFLAGS = $(AM_LFLAGS) + +dumplog_SOURCES = dumplog.c +dumplog_LDADD = $(AM_LIBS) +dumplog_LDFLAGS = $(AM_LFLAGS) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../config.h +CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ +ntfsundelete.8 ntfsresize.8 +bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) +sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ +ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I.. +LIBS = @LIBS@ +ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsdump_logfile_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +dumplog_OBJECTS = dumplog.$(OBJEXT) +@REALLYSTATIC_FALSE@dumplog_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@dumplog_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsfix_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ +sd.$(OBJEXT) mkntfs.$(OBJEXT) +@REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfslabel_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +man8dir = $(mandir)/man8 +MANS = $(man_MANS) + +NROFF = nroff +DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsfix.8.in \ +ntfsinfo.8.in ntfslabel.8.in ntfsresize.8.in ntfsundelete.8.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +DEP_FILES = .deps/attrdef.P .deps/boot.P .deps/dumplog.P .deps/mkntfs.P \ +.deps/ntfsdump_logfile.P .deps/ntfsfix.P .deps/ntfsinfo.P \ +.deps/ntfslabel.P .deps/ntfsresize.P .deps/ntfsundelete.P \ +.deps/ntfswipe.P .deps/sd.P .deps/upcase.P +SOURCES = $(ntfsdump_logfile_SOURCES) $(dumplog_SOURCES) $(ntfswipe_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(ntfsundelete_SOURCES) $(ntfsresize_SOURCES) +OBJECTS = $(ntfsdump_logfile_OBJECTS) $(dumplog_OBJECTS) $(ntfswipe_OBJECTS) $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(ntfsundelete_OBJECTS) $(ntfsresize_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .obj .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu ntfsprogs/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +mkntfs.8: $(top_builddir)/config.status mkntfs.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +ntfsfix.8: $(top_builddir)/config.status ntfsfix.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +ntfslabel.8: $(top_builddir)/config.status ntfslabel.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +ntfsinfo.8: $(top_builddir)/config.status ntfsinfo.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +ntfsundelete.8: $(top_builddir)/config.status ntfsundelete.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +ntfsresize.8: $(top_builddir)/config.status ntfsresize.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +mostlyclean-sbinPROGRAMS: + +clean-sbinPROGRAMS: + -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) + +distclean-sbinPROGRAMS: + +maintainer-clean-sbinPROGRAMS: + +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(sbindir) + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(sbin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +ntfsdump_logfile$(EXEEXT): $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_DEPENDENCIES) + @rm -f ntfsdump_logfile$(EXEEXT) + $(LINK) $(ntfsdump_logfile_LDFLAGS) $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_LDADD) $(LIBS) + +dumplog$(EXEEXT): $(dumplog_OBJECTS) $(dumplog_DEPENDENCIES) + @rm -f dumplog$(EXEEXT) + $(LINK) $(dumplog_LDFLAGS) $(dumplog_OBJECTS) $(dumplog_LDADD) $(LIBS) + +ntfswipe$(EXEEXT): $(ntfswipe_OBJECTS) $(ntfswipe_DEPENDENCIES) + @rm -f ntfswipe$(EXEEXT) + $(LINK) $(ntfswipe_LDFLAGS) $(ntfswipe_OBJECTS) $(ntfswipe_LDADD) $(LIBS) + +ntfsfix$(EXEEXT): $(ntfsfix_OBJECTS) $(ntfsfix_DEPENDENCIES) + @rm -f ntfsfix$(EXEEXT) + $(LINK) $(ntfsfix_LDFLAGS) $(ntfsfix_OBJECTS) $(ntfsfix_LDADD) $(LIBS) + +ntfsinfo$(EXEEXT): $(ntfsinfo_OBJECTS) $(ntfsinfo_DEPENDENCIES) + @rm -f ntfsinfo$(EXEEXT) + $(LINK) $(ntfsinfo_LDFLAGS) $(ntfsinfo_OBJECTS) $(ntfsinfo_LDADD) $(LIBS) + +mkntfs$(EXEEXT): $(mkntfs_OBJECTS) $(mkntfs_DEPENDENCIES) + @rm -f mkntfs$(EXEEXT) + $(LINK) $(mkntfs_LDFLAGS) $(mkntfs_OBJECTS) $(mkntfs_LDADD) $(LIBS) + +ntfslabel$(EXEEXT): $(ntfslabel_OBJECTS) $(ntfslabel_DEPENDENCIES) + @rm -f ntfslabel$(EXEEXT) + $(LINK) $(ntfslabel_LDFLAGS) $(ntfslabel_OBJECTS) $(ntfslabel_LDADD) $(LIBS) + +ntfsundelete$(EXEEXT): $(ntfsundelete_OBJECTS) $(ntfsundelete_DEPENDENCIES) + @rm -f ntfsundelete$(EXEEXT) + $(LINK) $(ntfsundelete_LDFLAGS) $(ntfsundelete_OBJECTS) $(ntfsundelete_LDADD) $(LIBS) + +ntfsresize$(EXEEXT): $(ntfsresize_OBJECTS) $(ntfsresize_DEPENDENCIES) + @rm -f ntfsresize$(EXEEXT) + $(LINK) $(ntfsresize_LDFLAGS) $(ntfsresize_OBJECTS) $(ntfsresize_LDADD) $(LIBS) + +install-man8: + $(mkinstalldirs) $(DESTDIR)$(man8dir) + @list='$(man8_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.8*) 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)$(man8dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ + done + +uninstall-man8: + @list='$(man8_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.8*) 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)$(man8dir)/$$inst"; \ + rm -f $(DESTDIR)$(man8dir)/$$inst; \ + done +install-man: $(MANS) + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-man8 +uninstall-man: + @$(NORMAL_UNINSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-man8 + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(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)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = ntfsprogs + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu ntfsprogs/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: install-binPROGRAMS install-sbinPROGRAMS +install-exec: install-exec-am + +install-data-am: install-man +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-binPROGRAMS uninstall-sbinPROGRAMS uninstall-man +uninstall: uninstall-am +all-am: Makefile $(PROGRAMS) $(MANS) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) \ + $(DESTDIR)$(mandir)/man8 + + +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-sbinPROGRAMS \ + mostlyclean-compile mostlyclean-libtool \ + mostlyclean-tags mostlyclean-depend mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-binPROGRAMS clean-sbinPROGRAMS clean-compile \ + clean-libtool clean-tags clean-depend clean-generic \ + mostlyclean-am + +clean: clean-am + +distclean-am: distclean-binPROGRAMS distclean-sbinPROGRAMS \ + distclean-compile distclean-libtool distclean-tags \ + distclean-depend distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-binPROGRAMS \ + maintainer-clean-sbinPROGRAMS maintainer-clean-compile \ + maintainer-clean-libtool maintainer-clean-tags \ + maintainer-clean-depend maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS clean-sbinPROGRAMS \ +maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \ +install-sbinPROGRAMS mostlyclean-compile distclean-compile \ +clean-compile maintainer-clean-compile mostlyclean-libtool \ +distclean-libtool clean-libtool maintainer-clean-libtool install-man8 \ +uninstall-man8 install-man uninstall-man tags mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir \ +mostlyclean-depend distclean-depend clean-depend \ +maintainer-clean-depend info-am info dvi-am dvi check check-am \ +installcheck-am installcheck 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 + + +# Extra targets + +strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) + $(STRIP) $^ + +# 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: From 8b286d22c044d54e19f45c9c35a77cf1a9fc43b5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0158/2994] update build system }(Logical change 1.23) --- ntfstools/Makefile.in | 592 ------------------------------------------ 1 file changed, 592 deletions(-) delete mode 100644 ntfstools/Makefile.in diff --git a/ntfstools/Makefile.in b/ntfstools/Makefile.in deleted file mode 100644 index 15eefd6a..00000000 --- a/ntfstools/Makefile.in +++ /dev/null @@ -1,592 +0,0 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Need this to enable 64-bit (device) file access functions and parameters. - - -SHELL = @SHELL@ - -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 = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ -host_alias = @host_alias@ -host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ -AS = @AS@ -AUTODIRS = @AUTODIRS@ -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -EXEEXT = @EXEEXT@ -LDFLAGS = @LDFLAGS@ -LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ -LN_S = @LN_S@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -VERSION = @VERSION@ -all_includes = @all_includes@ -all_libraries = @all_libraries@ -@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall -@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 -@REALLYSTATIC_TRUE@AM_LIBS = @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@AM_LIBS = @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LFLAGS = @REALLYSTATIC_TRUE@-static -@REALLYSTATIC_FALSE@AM_LFLAGS = @REALLYSTATIC_FALSE@$(all_libraries) -@REALLYSTATIC_TRUE@LINK = @REALLYSTATIC_TRUE@$(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -@REALLYSTATIC_FALSE@LINK = @REALLYSTATIC_FALSE@$(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ - -bin_PROGRAMS = ntfsfix ntfsinfo -sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe - -man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 \ - ntfsresize.8 - -EXTRA_MANS = - -CLEANFILES = $(EXTRA_PROGRAMS) - -linux_ntfsincludedir = -I$(top_srcdir)/include - -# Set the include path. -INCLUDES = -I$(top_srcdir)/include $(all_includes) - -ntfsfix_SOURCES = ntfsfix.c -ntfsfix_LDADD = $(AM_LIBS) -ntfsfix_LDFLAGS = $(AM_LFLAGS) - -mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c -mkntfs_LDADD = $(AM_LIBS) -mkntfs_LDFLAGS = $(AM_LFLAGS) - -ntfslabel_SOURCES = ntfslabel.c -ntfslabel_LDADD = $(AM_LIBS) -ntfslabel_LDFLAGS = $(AM_LFLAGS) - -ntfsinfo_SOURCES = ntfsinfo.c -ntfsinfo_LDADD = $(AM_LIBS) -ntfsinfo_LDFLAGS = $(AM_LFLAGS) - -ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h -ntfsundelete_LDADD = $(AM_LIBS) -ntfsundelete_LDFLAGS = $(AM_LFLAGS) - -ntfsresize_SOURCES = ntfsresize.c -ntfsresize_LDADD = $(AM_LIBS) -ntfsresize_LDFLAGS = $(AM_LFLAGS) - -# We don't distribute these - -ntfswipe_SOURCES = ntfswipe.c ntfswipe.h -ntfswipe_LDADD = $(AM_LIBS) -ntfswipe_LDFLAGS = $(AM_LFLAGS) - -ntfsdump_logfile_SOURCES = ntfsdump_logfile.c -ntfsdump_logfile_LDADD = $(AM_LIBS) -ntfsdump_logfile_LDFLAGS = $(AM_LFLAGS) - -dumplog_SOURCES = dumplog.c -dumplog_LDADD = $(AM_LIBS) -dumplog_LDFLAGS = $(AM_LFLAGS) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ -ntfsundelete.8 ntfsresize.8 -bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) -sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ -ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) - - -DEFS = @DEFS@ -I. -I$(srcdir) -I.. -LIBS = @LIBS@ -ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfsdump_logfile_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -dumplog_OBJECTS = dumplog.$(OBJEXT) -@REALLYSTATIC_FALSE@dumplog_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@dumplog_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfsfix_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfsinfo_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ -sd.$(OBJEXT) mkntfs.$(OBJEXT) -@REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfslabel_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -man8dir = $(mandir)/man8 -MANS = $(man_MANS) - -NROFF = nroff -DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsfix.8.in \ -ntfsinfo.8.in ntfslabel.8.in ntfsresize.8.in ntfsundelete.8.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -DEP_FILES = .deps/attrdef.P .deps/boot.P .deps/dumplog.P .deps/mkntfs.P \ -.deps/ntfsdump_logfile.P .deps/ntfsfix.P .deps/ntfsinfo.P \ -.deps/ntfslabel.P .deps/ntfsresize.P .deps/ntfsundelete.P \ -.deps/ntfswipe.P .deps/sd.P .deps/upcase.P -SOURCES = $(ntfsdump_logfile_SOURCES) $(dumplog_SOURCES) $(ntfswipe_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(ntfsundelete_SOURCES) $(ntfsresize_SOURCES) -OBJECTS = $(ntfsdump_logfile_OBJECTS) $(dumplog_OBJECTS) $(ntfswipe_OBJECTS) $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(ntfsundelete_OBJECTS) $(ntfsresize_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .lo .o .obj .s -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu ntfstools/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - -mkntfs.8: $(top_builddir)/config.status mkntfs.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -ntfsfix.8: $(top_builddir)/config.status ntfsfix.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -ntfslabel.8: $(top_builddir)/config.status ntfslabel.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -ntfsinfo.8: $(top_builddir)/config.status ntfsinfo.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -ntfsundelete.8: $(top_builddir)/config.status ntfsundelete.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -ntfsresize.8: $(top_builddir)/config.status ntfsresize.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - -mostlyclean-binPROGRAMS: - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) - -distclean-binPROGRAMS: - -maintainer-clean-binPROGRAMS: - -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - list='$(bin_PROGRAMS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ - done - -mostlyclean-sbinPROGRAMS: - -clean-sbinPROGRAMS: - -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) - -distclean-sbinPROGRAMS: - -maintainer-clean-sbinPROGRAMS: - -install-sbinPROGRAMS: $(sbin_PROGRAMS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(sbindir) - @list='$(sbin_PROGRAMS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ - else :; fi; \ - done - -uninstall-sbinPROGRAMS: - @$(NORMAL_UNINSTALL) - list='$(sbin_PROGRAMS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ - done - -# FIXME: We should only use cygpath when building on Windows, -# and only if it is available. -.c.obj: - $(COMPILE) -c `cygpath -w $<` - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -rm -f *.$(OBJEXT) - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -maintainer-clean-libtool: - -ntfsdump_logfile$(EXEEXT): $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_DEPENDENCIES) - @rm -f ntfsdump_logfile$(EXEEXT) - $(LINK) $(ntfsdump_logfile_LDFLAGS) $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_LDADD) $(LIBS) - -dumplog$(EXEEXT): $(dumplog_OBJECTS) $(dumplog_DEPENDENCIES) - @rm -f dumplog$(EXEEXT) - $(LINK) $(dumplog_LDFLAGS) $(dumplog_OBJECTS) $(dumplog_LDADD) $(LIBS) - -ntfswipe$(EXEEXT): $(ntfswipe_OBJECTS) $(ntfswipe_DEPENDENCIES) - @rm -f ntfswipe$(EXEEXT) - $(LINK) $(ntfswipe_LDFLAGS) $(ntfswipe_OBJECTS) $(ntfswipe_LDADD) $(LIBS) - -ntfsfix$(EXEEXT): $(ntfsfix_OBJECTS) $(ntfsfix_DEPENDENCIES) - @rm -f ntfsfix$(EXEEXT) - $(LINK) $(ntfsfix_LDFLAGS) $(ntfsfix_OBJECTS) $(ntfsfix_LDADD) $(LIBS) - -ntfsinfo$(EXEEXT): $(ntfsinfo_OBJECTS) $(ntfsinfo_DEPENDENCIES) - @rm -f ntfsinfo$(EXEEXT) - $(LINK) $(ntfsinfo_LDFLAGS) $(ntfsinfo_OBJECTS) $(ntfsinfo_LDADD) $(LIBS) - -mkntfs$(EXEEXT): $(mkntfs_OBJECTS) $(mkntfs_DEPENDENCIES) - @rm -f mkntfs$(EXEEXT) - $(LINK) $(mkntfs_LDFLAGS) $(mkntfs_OBJECTS) $(mkntfs_LDADD) $(LIBS) - -ntfslabel$(EXEEXT): $(ntfslabel_OBJECTS) $(ntfslabel_DEPENDENCIES) - @rm -f ntfslabel$(EXEEXT) - $(LINK) $(ntfslabel_LDFLAGS) $(ntfslabel_OBJECTS) $(ntfslabel_LDADD) $(LIBS) - -ntfsundelete$(EXEEXT): $(ntfsundelete_OBJECTS) $(ntfsundelete_DEPENDENCIES) - @rm -f ntfsundelete$(EXEEXT) - $(LINK) $(ntfsundelete_LDFLAGS) $(ntfsundelete_OBJECTS) $(ntfsundelete_LDADD) $(LIBS) - -ntfsresize$(EXEEXT): $(ntfsresize_OBJECTS) $(ntfsresize_DEPENDENCIES) - @rm -f ntfsresize$(EXEEXT) - $(LINK) $(ntfsresize_LDFLAGS) $(ntfsresize_OBJECTS) $(ntfsresize_LDADD) $(LIBS) - -install-man8: - $(mkinstalldirs) $(DESTDIR)$(man8dir) - @list='$(man8_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ - case "$$i" in \ - *.8*) 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)$(man8dir)/$$inst"; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ - done - -uninstall-man8: - @list='$(man8_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ - case "$$i" in \ - *.8*) 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)$(man8dir)/$$inst"; \ - rm -f $(DESTDIR)$(man8dir)/$$inst; \ - done -install-man: $(MANS) - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-man8 -uninstall-man: - @$(NORMAL_UNINSTALL) - $(MAKE) $(AM_MAKEFLAGS) uninstall-man8 - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(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)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = ntfstools - -distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu ntfstools/Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) - --include $(DEP_FILES) - -mostlyclean-depend: - -clean-depend: - -distclean-depend: - -rm -rf .deps - -maintainer-clean-depend: - -%.o: %.c - @echo '$(COMPILE) -c $<'; \ - $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp - -%.lo: %.c - @echo '$(LTCOMPILE) -c $<'; \ - $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ - < .deps/$(*F).pp > .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm -f .deps/$(*F).pp -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-binPROGRAMS install-sbinPROGRAMS -install-exec: install-exec-am - -install-data-am: install-man -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-binPROGRAMS uninstall-sbinPROGRAMS uninstall-man -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) $(MANS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) \ - $(DESTDIR)$(mandir)/man8 - - -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-sbinPROGRAMS \ - mostlyclean-compile mostlyclean-libtool \ - mostlyclean-tags mostlyclean-depend mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-binPROGRAMS clean-sbinPROGRAMS clean-compile \ - clean-libtool clean-tags clean-depend clean-generic \ - mostlyclean-am - -clean: clean-am - -distclean-am: distclean-binPROGRAMS distclean-sbinPROGRAMS \ - distclean-compile distclean-libtool distclean-tags \ - distclean-depend distclean-generic clean-am - -rm -f libtool - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-binPROGRAMS \ - maintainer-clean-sbinPROGRAMS maintainer-clean-compile \ - maintainer-clean-libtool maintainer-clean-tags \ - maintainer-clean-depend maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS clean-sbinPROGRAMS \ -maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \ -install-sbinPROGRAMS mostlyclean-compile distclean-compile \ -clean-compile maintainer-clean-compile mostlyclean-libtool \ -distclean-libtool clean-libtool maintainer-clean-libtool install-man8 \ -uninstall-man8 install-man uninstall-man tags mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir \ -mostlyclean-depend distclean-depend clean-depend \ -maintainer-clean-depend info-am info dvi-am dvi check check-am \ -installcheck-am installcheck 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 - - -# Extra targets - -strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) - $(STRIP) $^ - -# 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: From 9ae02efb9ab674eeb885de3f7e50e77ca6783120 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Nov 2002 12:16:35 +0000 Subject: [PATCH 0159/2994] update news (Logical change 1.23) --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 84826058..9923651f 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ Current news ============ +Renamed ntfstools to ntfsprogs everywhere. + Added new utility ntfslabel by Matthew Fanto. See man 8 ntfslabel for details. Added new utility ntfsundelete by Richard Russon. See man 8 ntfsundelete for From bbabd73007aa5368cafe9546451c36e8b7958cce Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 29 Nov 2002 15:26:49 +0000 Subject: [PATCH 0160/2994] Initial revision --- ntfsprogs/ntfsprogs.8.in | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ntfsprogs/ntfsprogs.8.in diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in new file mode 100644 index 00000000..e69de29b From f61c96cab6a01a574e4a2647136097bc5238394e Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 29 Nov 2002 15:26:49 +0000 Subject: [PATCH 0161/2994] add new man page (Logical change 1.24) --- configure | 10 ++++++---- configure.in | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 8a271fde..e8bc5212 100755 --- a/configure +++ b/configure @@ -6327,10 +6327,11 @@ trap 'rm -fr `echo " ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfsfix.8 - ntfsprogs/ntfslabel.8 ntfsprogs/ntfsinfo.8 - ntfsprogs/ntfsundelete.8 + ntfsprogs/ntfslabel.8 + ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 + ntfsprogs/ntfsundelete.8 linux-ntfs.spec config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF @@ -6460,10 +6461,11 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfsfix.8 - ntfsprogs/ntfslabel.8 ntfsprogs/ntfsinfo.8 - ntfsprogs/ntfsundelete.8 + ntfsprogs/ntfslabel.8 + ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 + ntfsprogs/ntfsundelete.8 linux-ntfs.spec "} EOF diff --git a/configure.in b/configure.in index 13b50afb..8a893c21 100644 --- a/configure.in +++ b/configure.in @@ -131,10 +131,11 @@ AC_OUTPUT([ ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfsfix.8 - ntfsprogs/ntfslabel.8 ntfsprogs/ntfsinfo.8 - ntfsprogs/ntfsundelete.8 + ntfsprogs/ntfslabel.8 + ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 + ntfsprogs/ntfsundelete.8 linux-ntfs.spec ]) From f4ed5849e262584faa70d97af1b67a32eb3b7c20 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 29 Nov 2002 15:26:49 +0000 Subject: [PATCH 0162/2994] more man page tidying BKrev: 3de78739qKxO0YXe_kDj5Xp6XYFAiA From 4d8a0de29004bc0e3ccdedf054518f6e3bd0f321 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 29 Nov 2002 15:26:49 +0000 Subject: [PATCH 0163/2994] tidy up (Logical change 1.24) --- ntfsprogs/mkntfs.8.in | 13 +++++++------ ntfsprogs/ntfsfix.8.in | 10 +++++++--- ntfsprogs/ntfsinfo.8.in | 2 ++ ntfsprogs/ntfslabel.8.in | 3 ++- ntfsprogs/ntfsresize.8.in | 12 +++++++----- ntfsprogs/ntfsundelete.8.in | 10 +++------- 6 files changed, 28 insertions(+), 22 deletions(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 6916396d..55b892fa 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -175,11 +175,6 @@ not implement content indexing at all.) Print the version number of .B mkntfs and exit. -.SH AUTHOR -This version of -.B mkntfs -has been written by Anton Altaparmakov (if that fails, use -). .SH BUGS .B mkntfs writes the backup boot sector to the last sector of the block @@ -203,11 +198,17 @@ report them. - If you do see any problems reported, please report the messages to the author. .br There may be other bugs. Please, report them to the author. +.SH AUTHOR +This version of +.B mkntfs +has been written by Anton Altaparmakov (if that fails, use +). .SH AVAILABILITY .B mkntfs is part of the Linux-NTFS project and is available for download from http://sf.net/project/showfiles.php?group_id=13956 in source (tar ball and rpm) and pre-compiled binary (i386 rpm and deb) form. .SH SEE ALSO -.BR badblocks (8) +.BR badblocks(8), +.BR ntfsprogs (8) diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index eed93b8a..6d4eaecd 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -47,10 +47,14 @@ safely reboot into NT/W2K. Please note that \fBntfsfix\fP is not a chkdsk-like tool, and so is not guaranteed that it could fix all the alterations provoked by the NTFS driver. -.SH SEE ALSO -.BR mkntfs (8). -.br .SH AUTHOR This manual page was written by David Martínez Moreno , for the Debian GNU/Linux system (but may be used by others). +.SH AVAILABILITY +.B ntfsfix +is part of the linux-ntfs package and is available from +http://linux-ntfs.sourceforge.net/. +.SH SEE ALSO +.BR mkntfs (8), +.BR ntfsprogs (8) diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index edec6976..f7bdc14f 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -21,5 +21,7 @@ was written by Matthew J. Fanto (fanto1mj@cmich.edu). .B ntfsinfo is part of the linux-ntfs package and is available from http://linux-ntfs.sourceforge.net/. +.SH SEE ALSO +.BR ntfsprogs (8) diff --git a/ntfsprogs/ntfslabel.8.in b/ntfsprogs/ntfslabel.8.in index 4b9a05bb..cbaa51ed 100644 --- a/ntfsprogs/ntfslabel.8.in +++ b/ntfsprogs/ntfslabel.8.in @@ -50,5 +50,6 @@ by Anton Altaparmakov (aia21@cantab.net). is part of the linux-ntfs package and is available from http://linux-ntfs.sourceforge.net/. .SH SEE ALSO -.BR mkntfs (8) +.BR mkntfs (8), +.BR ntfsprogs (8) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index b2be7c28..c3c6c770 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -95,10 +95,6 @@ of your important data in case of an unexpected failure. Future work is planned to include support for volume enlargement and resizing fragmented NTFS volumes. Please note, Windows 2000, XP and .NET have built in NTFS defragmenter. -.SH AVAILABILITY -.B ntfsresize -is part of the linux-ntfs package and is available from -http://linux-ntfs.sf.net/ as source and pre-compiled binary. .SH AUTHOR .B ntfsresize has been written by @@ -109,9 +105,15 @@ for libntfs, excellent documentation, comments, testing and fixes, moreover to Theodore Ts'o whose .BR resize2fs (8) man page formed the basis of this page. +.SH AVAILABILITY +.B ntfsresize +is part of the linux-ntfs package and is available from +http://linux-ntfs.sf.net/ as source and pre-compiled binary. .SH SEE ALSO .BR fdisk (8), .BR cfdisk (8), .BR sfdisk (8), .BR parted (8), -.BR mkntfs (8) +.BR mkntfs (8), +.BR ntfsprogs (8) + diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index f28f4a05..84c4c96f 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -334,11 +334,7 @@ is part of the linux\-ntfs package and is available from .nh http://linux\-ntfs.sourceforge.net/downloads.html .hy -This manual page is available online at: -.br -.nh -http://linux\-ntfs.sourceforge.net/tools/ntfsundelete.html -.hy .SH SEE ALSO -.BR ntfsinfo(8) -.br +.BR ntfsinfo (8), +.BR ntfsprogs (8) + From 7e3a966ce8ef29d766bb3b72afdd4acdb72b65fe Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 29 Nov 2002 15:26:49 +0000 Subject: [PATCH 0164/2994] tidy up 2002/11/29 15:24:42+00:00 flatcap.org!flatcap Rename: ntfsprogs/ntfstools.8.in -> ntfsprogs/ntfsprogs.8.in (Logical change 1.24) --- ntfsprogs/ntfsprogs.8.in | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index e69de29b..30696de2 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -0,0 +1,52 @@ +.\" Copyright (c) 2002 Richard Russon. All Rights Reserved. +.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSPROGS 8 "May 2002" "Linux-NTFS version @VERSION@" + +.SH OVERVIEW +.B ntfsprogs +is a suite of NTFS utilities based around a shared library. The tools are +available for free and come with full source code. + +.SH TOOLS +.SS mkntfs +.PP +.BR mkntfs (8) +: Format a partition using NTFS. +.SS ntfsfix +.PP +.BR ntfsfix (8) +: Clear the LogFile of a partition to make Windows perform a thorough +check next time it boots. +.SS ntfsinfo +.PP +.BR ntfsinfo (8) +: Show some information about an NTFS partition or one of the files +or directories within it. +.SS ntfslabel +.PP +.BR ntfslabel (8) +: Show, or set, an NTFS partition's volume label. +.SS ntfsresize +.PP +.BR ntfsresize (8) +: Resize an NTFS partition without losing data. +.SS ntfsundelete +.PP +.BR ntfsundelete (8) +: Recover deleted files from an NTFS partition. + +.SH AUTHORS +.PP +The tools have been written by Anton Altaparmakov, Richard Russon, Matthew Fanto +and Szabolcs Szakacsits. + +.SH AVAILABILITY +The +.B ntfsprogs +can be downloaded from http://linux-ntfs.sourceforge.net/downloads.html +.br +These manual pages can be viewed online at http://linux-ntfs.sourceforge.net/man/ntfsprogs.html + + From cdff4edf112ae3d25cb4e993782ca6f7fd491636 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 29 Nov 2002 15:26:49 +0000 Subject: [PATCH 0165/2994] tidy up }(Logical change 1.24) --- ntfsprogs/ntfstools.8.in | 44 ---------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 ntfsprogs/ntfstools.8.in diff --git a/ntfsprogs/ntfstools.8.in b/ntfsprogs/ntfstools.8.in deleted file mode 100644 index bde61e22..00000000 --- a/ntfsprogs/ntfstools.8.in +++ /dev/null @@ -1,44 +0,0 @@ -.\" Copyright (c) 2002 Richard Russon. All Rights Reserved. -.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. -.\" This file may be copied under the terms of the GNU Public License. -.\" -.TH NTFSPROGS 8 "May 2002" "Linux-NTFS version @VERSION@" - -.SH OVERVIEW -.B ntfsprogs -is a suite of NTFS utilities based around a shared library. The tools are -available for free and come with full source code. - -.SH TOOLS -.SS mkntfs(8) -.PP -Format a partition using NTFS. -.SS ntfsfix(8) -.PP -Clear the LogFile of a partition to make Windows perform a thorough check next -time it boots. -.SS ntfsinfo(8) -.PP -Show some information about an NTFS partition or one of the files or directories -within it. -.SS ntfslabel(8) -.PP -Show, or set, an NTFS partition's volume label. -.SS ntfsresize(8) -.PP -Resize an NTFS partition without losing data. -.SS ntfsundelete(8) -.PP -Recover deleted files from an NTFS partition. - -.SH AUTHORS -.PP -The tools have been written by Anton Altaparmakov, Richard Russon, Matthew Fanto -and Szabolcs Szakacsits. - -.SH AVAILABILITY -The -.B ntfsprogs -can be downloaded from http://linux-ntfs.sf.net/downloads.html - - From d0526f58d7bbd1aa12887afda877313721f94e8f Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 29 Nov 2002 15:35:43 +0000 Subject: [PATCH 0166/2994] new man page (Logical change 1.25) --- ntfsprogs/Makefile.am | 2 +- ntfsprogs/Makefile.in | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 81600372..49c61847 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -23,7 +23,7 @@ sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 \ - ntfsresize.8 + ntfsresize.8 ntfsprogs.8 EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index ffbc01e6..3873269d 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -105,7 +105,7 @@ sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 \ - ntfsresize.8 + ntfsresize.8 ntfsprogs.8 EXTRA_MANS = @@ -156,7 +156,7 @@ dumplog_LDFLAGS = $(AM_LFLAGS) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ -ntfsundelete.8 ntfsresize.8 +ntfsundelete.8 ntfsresize.8 ntfsprogs.8 bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) @@ -219,7 +219,7 @@ MANS = $(man_MANS) NROFF = nroff DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsfix.8.in \ -ntfsinfo.8.in ntfslabel.8.in ntfsresize.8.in ntfsundelete.8.in +ntfsinfo.8.in ntfslabel.8.in ntfsresize.8.in ntfsundelete.8.in ntfsprogs.8.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) @@ -253,6 +253,8 @@ ntfsinfo.8: $(top_builddir)/config.status ntfsinfo.8.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ntfsundelete.8: $(top_builddir)/config.status ntfsundelete.8.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +ntfsprogs.8: $(top_builddir)/config.status ntfsprogs.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ntfsresize.8: $(top_builddir)/config.status ntfsresize.8.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status From 26f337eaec1e7cc20e6e1809eb32ad832b02fc6c Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 29 Nov 2002 15:35:43 +0000 Subject: [PATCH 0167/2994] new man page BKrev: 3de7894f2-986MzYL0eASjnv5icALw From 778d31d09ec7bf0535b90a826767ed0de5abfbb9 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 1 Dec 2002 18:13:20 +0000 Subject: [PATCH 0168/2994] A few minor portability issues BKrev: 3dea514016kZ9vOngpuna8d6vBJlKw From 86126fa972349463ca1890688df8c7f26e395269 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 1 Dec 2002 18:13:20 +0000 Subject: [PATCH 0169/2994] portability (Logical change 1.26) --- libntfs/bootsect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index 5e9f5082..dfb083aa 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include "bootsect.h" From 3e1b7a91658bdca967c05b740070d4f8e88ace2a Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 1 Dec 2002 18:13:20 +0000 Subject: [PATCH 0170/2994] portability: void * arithmetic is a GNU extension (Logical change 1.26) --- libntfs/attrib.c | 18 +++++++++--------- libntfs/disk_io.c | 10 +++++----- libntfs/runlist.c | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index bc359707..ef7ff266 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -687,7 +687,7 @@ res_err_out: /* Update progress counters. */ total += to_read; count -= to_read; - b += to_read; + (u8*)b += to_read; continue; } /* It is a real lcn, read it into @dst. */ @@ -703,7 +703,7 @@ retry: if (br > 0) { total += br; count -= br; - b += br; + (u8*)b += br; continue; } /* If the syscall was interrupted, try again. */ @@ -927,7 +927,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) int i; u8 *b2; - b2 = b + (to_write & + b2 = (u8*)b + (to_write & ~(sizeof(unsigned long) - 1)); for (i = 0; i < cnt; i++) { if (b2[i]) { @@ -949,7 +949,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) */ total += to_write; count -= to_write; - b += to_write; + (u8*)b += to_write; continue; } /* It is a real lcn, write it to the volume. */ @@ -965,7 +965,7 @@ retry: if (written > 0) { total += written; count -= written; - b += written; + (u8*)b += written; continue; } /* If the syscall was interrupted, try again. */ @@ -1079,7 +1079,7 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, if (br <= 0) return br; br /= bk_size; - for (end = b + br * bk_size; b < end; b += bk_size) + for (end = (u8*)b + br * bk_size; b < end; (u8*)b += bk_size) ntfs_post_read_mst_fixup((NTFS_RECORD*)b, bk_size); /* Finally, return the number of blocks read. */ return br; @@ -1133,8 +1133,8 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, for (i = 0; i < bk_cnt; ++i) { int err; - err = ntfs_pre_write_mst_fixup((NTFS_RECORD*)(b + i * bk_size), - bk_size); + err = ntfs_pre_write_mst_fixup((NTFS_RECORD*) + ((u8*)b + i * bk_size), bk_size); if (err < 0) { /* Abort write at this position. */ if (!i) @@ -1147,7 +1147,7 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, written = ntfs_attr_pwrite(na, pos, bk_cnt * bk_size, b); /* Quickly deprotect the data again. */ for (i = 0; i < bk_cnt; ++i) - ntfs_post_write_mst_fixup((NTFS_RECORD*)(b + i * bk_size)); + ntfs_post_write_mst_fixup((NTFS_RECORD*)((u8*)b + i * bk_size)); if (written <= 0) return written; /* Finally, return the number of complete blocks written. */ diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index 6be9e54c..2d812aec 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -193,8 +193,8 @@ s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, */ count = br / bksize; for (i = 0; i < count; ++i) - ntfs_post_read_mst_fixup((NTFS_RECORD*)(b + i * bksize), - bksize); + ntfs_post_read_mst_fixup((NTFS_RECORD*) + ((u8*)b + i * bksize), bksize); /* Finally, return the number of complete blocks read. */ return count; } @@ -244,8 +244,8 @@ s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, for (i = 0; i < count; ++i) { int err; - err = ntfs_pre_write_mst_fixup((NTFS_RECORD*)(b + i * bksize), - bksize); + err = ntfs_pre_write_mst_fixup((NTFS_RECORD*) + ((u8*)b + i * bksize), bksize); if (err < 0) { /* Abort write at this position. */ if (!i) @@ -258,7 +258,7 @@ s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, written = ntfs_pwrite(fd, pos, count * bksize, b); /* Quickly deprotect the data again. */ for (i = 0; i < count; ++i) - ntfs_post_write_mst_fixup((NTFS_RECORD*)(b + i * bksize)); + ntfs_post_write_mst_fixup((NTFS_RECORD*)((u8*)b + i * bksize)); if (written <= 0) return written; /* Finally, return the number of complete blocks written. */ diff --git a/libntfs/runlist.c b/libntfs/runlist.c index c117f336..98672354 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1054,7 +1054,7 @@ s64 ntfs_rl_pwrite(const ntfs_volume *vol, const run_list_element *rl, int i; u8 *b2; - b2 = b + (to_write & + b2 = (u8*)b + (to_write & ~(sizeof(unsigned long) - 1)); for (i = 0; i < cnt; i++) { if (b2[i]) @@ -1067,7 +1067,7 @@ s64 ntfs_rl_pwrite(const ntfs_volume *vol, const run_list_element *rl, */ total += to_write; count -= to_write; - b += to_write; + (u8*)b += to_write; continue; } /* It is a real lcn, write it to the volume. */ @@ -1080,7 +1080,7 @@ retry: if (written > 0) { total += written; count -= written; - b += written; + (u8*)b += written; continue; } /* If the syscall was interrupted, try again. */ From d789fd83858996730d2742f055f07cafaa11c781 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 1 Dec 2002 18:54:13 +0000 Subject: [PATCH 0171/2994] tidy whitespace (Logical change 1.27) --- doc/template.c | 4 +- include/endians.h | 6 +- include/layout.h | 270 +++++++++++++++++------------------ include/logfile.h | 4 +- include/mft.h | 2 +- include/mst.h | 2 +- include/support.h | 6 +- libntfs/attrib.c | 24 ++-- libntfs/attrib_RE.txt | 4 +- libntfs/bootsect.c | 2 +- libntfs/mst.c | 32 ++--- libntfs/runlist.c | 28 ++-- libntfs/unistr.c | 2 +- libntfs/volume.c | 30 ++-- ntfsprogs/dumplog.c | 4 +- ntfsprogs/mkntfs.8.in | 14 +- ntfsprogs/mkntfs.c | 42 +++--- ntfsprogs/ntfsdump_logfile.c | 8 +- ntfsprogs/ntfsfix.8.in | 4 +- ntfsprogs/ntfsfix.c | 6 +- ntfsprogs/ntfsinfo.8.in | 4 +- ntfsprogs/ntfsinfo.c | 8 +- ntfsprogs/ntfslabel.8.in | 6 +- ntfsprogs/ntfsprogs.8.in | 2 +- ntfsprogs/ntfsresize.8.in | 8 +- ntfsprogs/ntfsresize.c | 66 ++++----- ntfsprogs/ntfsundelete.8.in | 8 +- ntfsprogs/ntfsundelete.c | 74 +++++----- ntfsprogs/ntfswipe.c | 28 ++-- 29 files changed, 349 insertions(+), 349 deletions(-) diff --git a/doc/template.c b/doc/template.c index 6bb6e7dc..ae87ae0d 100644 --- a/doc/template.c +++ b/doc/template.c @@ -7,7 +7,7 @@ const char *EXEC_VERSION= "0.0.1"; * * Short description here. * - * Anton Altaparmakov + * Anton Altaparmakov * * 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 @@ -37,7 +37,7 @@ const char *EXEC_VERSION= "0.0.1"; * If anyone using a non-little endian and/or an aligned access only CPU tries * this program please let me know whether it works or not! * - * Anton Altaparmakov + * Anton Altaparmakov */ int main(int argc, char **argv) diff --git a/include/endians.h b/include/endians.h index a749e7cc..adad2ae8 100644 --- a/include/endians.h +++ b/include/endians.h @@ -2,7 +2,7 @@ * $Id$ * * endians.h - Definitions related to handling of byte ordering. Part of the - * Linux-NTFS project. + * Linux-NTFS project. * * Copyright (c) 2000,2001 Anton Altaparmakov. * @@ -28,9 +28,9 @@ /* * Notes: * - * We define the conversion functions including typecasts since the + * We define the conversion functions including typecasts since the * defaults don't necessarily perform appropriate typecasts. - * Also, using our own functions means that we can change them if it + * Also, using our own functions means that we can change them if it * turns out that we do need to use the unaligned access macros on * architectures requirering aligned memory accesses... */ diff --git a/include/layout.h b/include/layout.h index 8a3602a6..55592807 100644 --- a/include/layout.h +++ b/include/layout.h @@ -33,13 +33,13 @@ /* * Location of bootsector on partition: - * The standard NTFS_BOOT_SECTOR is on sector 0 of the partition. - * On NT4 and above there is one backup copy of the boot sector to - * be found on the last sector of the partition (not normally accessible - * from within Windows as the bootsector contained number of sectors + * The standard NTFS_BOOT_SECTOR is on sector 0 of the partition. + * On NT4 and above there is one backup copy of the boot sector to + * be found on the last sector of the partition (not normally accessible + * from within Windows as the bootsector contained number of sectors * value is one less than the actual value!). - * On versions of NT 3.51 and earlier, the backup copy was located at - * number of sectors/2 (integer divide), i.e. in the middle of the volume. + * On versions of NT 3.51 and earlier, the backup copy was located at + * number of sectors/2 (integer divide), i.e. in the middle of the volume. */ /* @@ -111,21 +111,21 @@ typedef enum { * operator! (-8 */ #define is_magic(x, m) ( (u32)(x) == (u32)magic_##m ) -#define is_magicp(p, m) ( *(u32*)(p) == (u32)magic_##m ) +#define is_magicp(p, m) ( *(u32*)(p) == (u32)magic_##m ) /* * Specialised magic comparison macros. */ #define is_baad_record(x) ( is_magic (x, BAAD) ) #define is_baad_recordp(p) ( is_magicp(p, BAAD) ) -#define is_chkd_record(x) ( is_magic (x, CHKD) ) -#define is_chkd_recordp(p) ( is_magicp(p, CHKD) ) +#define is_chkd_record(x) ( is_magic (x, CHKD) ) +#define is_chkd_recordp(p) ( is_magicp(p, CHKD) ) #define is_file_record(x) ( is_magic (x, FILE) ) #define is_file_recordp(p) ( is_magicp(p, FILE) ) -#define is_hole_record(x) ( is_magic (x, HOLE) ) -#define is_hole_recordp(p) ( is_magicp(p, HOLE) ) -#define is_indx_record(x) ( is_magic (x, INDX) ) -#define is_indx_recordp(p) ( is_magicp(p, INDX) ) +#define is_hole_record(x) ( is_magic (x, HOLE) ) +#define is_hole_recordp(p) ( is_magicp(p, HOLE) ) +#define is_indx_record(x) ( is_magic (x, INDX) ) +#define is_indx_recordp(p) ( is_magicp(p, INDX) ) #define is_mft_record(x) ( is_file_record(x) ) #define is_mft_recordp(p) ( is_file_recordp(p) ) @@ -134,7 +134,7 @@ typedef enum { * Defines for the NTFS filesystem. Don't want to use BLOCK_SIZE and * BLOCK_SIZE_BITS from the kernel as that is 1024 and hence too high for us. */ -#define NTFS_SECTOR_SIZE 512 +#define NTFS_SECTOR_SIZE 512 #define NTFS_SECTOR_SIZE_BITS 9 /* @@ -147,7 +147,7 @@ typedef enum { * are set to it (during writing). If they are not, an incomplete multi sector * transfer has occured when the data was written. * The maximum size for the update sequence array is fixed to: - * maximum size = usa_ofs + (usa_count * 2) = 510 bytes + * maximum size = usa_ofs + (usa_count * 2) = 510 bytes * The 510 bytes comes from the fact that the last u16 in the array has to * (obviously) finish before the last u16 of the first 512-byte sector. * This formula can be used as a consistency check in that usa_ofs + @@ -172,41 +172,41 @@ typedef struct { * never modified. */ typedef enum { - FILE_MFT = 0, /* Master file table (mft). Data attribute + FILE_MFT = 0, /* Master file table (mft). Data attribute contains the entries and bitmap attribute records which ones are in use (bit==1). */ - FILE_MFTMirr = 1, /* Mft mirror: copy of first four mft records + FILE_MFTMirr = 1, /* Mft mirror: copy of first four mft records in data attribute. If cluster size > 4kiB, copy of first N mft records, with N = cluster_size / mft_record_size. */ - FILE_LogFile = 2, /* Journalling log in data attribute. */ - FILE_Volume = 3, /* Volume name attribute and volume information + FILE_LogFile = 2, /* Journalling log in data attribute. */ + FILE_Volume = 3, /* Volume name attribute and volume information attribute (flags and ntfs version). Windows refers to this file as volume DASD (Direct Access Storage Device). */ - FILE_AttrDef = 4, /* Array of attribute definitions in data + FILE_AttrDef = 4, /* Array of attribute definitions in data attribute. */ - FILE_root = 5, /* Root directory. */ - FILE_Bitmap = 6, /* Allocation bitmap of all clusters (lcns) in + FILE_root = 5, /* Root directory. */ + FILE_Bitmap = 6, /* Allocation bitmap of all clusters (lcns) in data attribute. */ - FILE_Boot = 7, /* Boot sector (always at cluster 0) in data + FILE_Boot = 7, /* Boot sector (always at cluster 0) in data attribute. */ - FILE_BadClus = 8, /* Contains all bad clusters in the non-resident + FILE_BadClus = 8, /* Contains all bad clusters in the non-resident data attribute. */ - FILE_Secure = 9, /* Shared security descriptors in data attribute + FILE_Secure = 9, /* Shared security descriptors in data attribute and two indexes into the descriptors. Appeared in Windows 2000. Before that, this file was named $Quota but was unused. */ - FILE_UpCase = 10, /* Uppercase equivalents of all 65536 Unicode + FILE_UpCase = 10, /* Uppercase equivalents of all 65536 Unicode characters in data attribute. */ - FILE_Extend = 11, /* Directory containing other system files (eg. + FILE_Extend = 11, /* Directory containing other system files (eg. $ObjId, $Quota, $Reparse and $UsnJrnl). This is new to NTFS3.0. */ - FILE_reserved12 = 12, /* Reserved for future use (records 12-15). */ - FILE_reserved13 = 13, - FILE_reserved14 = 14, - FILE_reserved15 = 15, - FILE_first_user = 16, /* First user file, used as test limit for + FILE_reserved12 = 12, /* Reserved for future use (records 12-15). */ + FILE_reserved13 = 13, + FILE_reserved14 = 14, + FILE_reserved15 = 15, + FILE_first_user = 16, /* First user file, used as test limit for whether to allow opening a file or not. */ } NTFS_SYSTEM_FILES; @@ -296,11 +296,11 @@ typedef struct { /* 8*/ u64 lsn; /* $LogFile sequence number for this record. Changed every time the record is modified. */ /* 16*/ u16 sequence_number; /* Number of times this mft record has been - reused. (See description for MFT_REF + reused. (See description for MFT_REF above.) NOTE: The increment (skipping zero) is done when the file is deleted. NOTE: If this is zero it is left zero. */ -/* 18*/ u16 link_count; /* Number of hard links, i.e. the number of +/* 18*/ u16 link_count; /* Number of hard links, i.e. the number of directory entries referencing this record. NOTE: Only used in mft base records. NOTE: When deleting a directory entry we @@ -400,13 +400,13 @@ typedef enum { * for what I mean but COLLATION_UNICODE_STRING would not give any special * treatment to any characters at all, but this is speculation. * COLLATION_NTOFS_ULONG - Sorting is done according to ascending u32 key - * values. E.g. used for $SII index in FILE_Secure, which sorts by - * security_id (u32). + * values. E.g. used for $SII index in FILE_Secure, which sorts by + * security_id (u32). * COLLATION_NTOFS_SID - Sorting is done according to ascending SID values. - * E.g. used for $O index in FILE_Extend/$Quota. + * E.g. used for $O index in FILE_Extend/$Quota. * COLLATION_NTOFS_SECURITY_HASH - Sorting is done first by ascending hash - * values and second by ascending security_id values. E.g. used for $SDH - * index in FILE_Secure. + * values and second by ascending security_id values. E.g. used for $SDH + * index in FILE_Secure. * COLLATION_NTOFS_ULONGS - Sorting is done according to a sequence of ascending * u32 key values. E.g. used for $O index in FILE_Extend/$ObjId, which * sorts by object_id (16-byte), by splitting up the object_id in four @@ -732,9 +732,9 @@ typedef enum { * NOTE: Always resident. * NOTE: Present in all base file records on a volume. * NOTE: There is conflicting information about the meaning of each of the time - * fields but the meaning as defined below has been verified to be - * correct by practical experimentation on Windows NT4 SP6a and is hence - * assumed to be the one and only correct interpretation. + * fields but the meaning as defined below has been verified to be + * correct by practical experimentation on Windows NT4 SP6a and is hence + * assumed to be the one and only correct interpretation. */ typedef struct { /*Ofs*/ @@ -766,14 +766,14 @@ typedef struct { * Recognize the difference by comparing the length of the resident attribute * value. If it is 48, then the following fields are missing. If it is 72 then * the fields are present. Maybe just check like this: - * if (resident.ValueLength < sizeof(STANDARD_INFORMATION)) { - * Assume NTFS 1.2- format. - * If (volume version is 3.0+) - * Upgrade attribute to NTFS 3.0 format. - * else - * Use NTFS 1.2- format for access. - * } else - * Use NTFS 3.0 format for access. + * if (resident.ValueLength < sizeof(STANDARD_INFORMATION)) { + * Assume NTFS 1.2- format. + * If (volume version is 3.0+) + * Upgrade attribute to NTFS 3.0 format. + * else + * Use NTFS 1.2- format for access. + * } else + * Use NTFS 3.0 format for access. * Only problem is that it might be legal to set the length of the value to * arbitrarily large values thus spoiling this check. - But chkdsk probably * views that as a corruption, assuming that it behaves like this for all @@ -828,20 +828,20 @@ typedef struct { * extent. They are ordered by lowest_vcn and have their instace set to zero. * It is not allowed to have two attributes with all sorting keys equal. * - Further restrictions: - * - If not resident, the vcn to lcn mapping array has to fit inside the - * base mft record. - * - The attribute list attribute value has a maximum size of 256kb. This - * is imposed by the Windows cache manager. + * - If not resident, the vcn to lcn mapping array has to fit inside the + * base mft record. + * - The attribute list attribute value has a maximum size of 256kb. This + * is imposed by the Windows cache manager. * - Attribute lists are only used when the attributes of mft record do not * fit inside the mft record despite all attributes (that can be made * non-resident) having been made non-resident. This can happen e.g. when: - * - File has a large number of hard links (lots of file name - * attributes present). - * - The mapping pairs array of some non-resident attribute becomes so + * - File has a large number of hard links (lots of file name + * attributes present). + * - The mapping pairs array of some non-resident attribute becomes so * large due to fragmentation that it overflows the mft record. - * - The security descriptor is very complex (not applicable to - * NTFS 3.0 volumes). - * - There are many named streams. + * - The security descriptor is very complex (not applicable to + * NTFS 3.0 volumes). + * - There are many named streams. */ typedef struct { /*Ofs*/ @@ -915,9 +915,9 @@ typedef enum { * reality and the more up to date values are present in the standard * information attribute. * NOTE: There is conflicting information about the meaning of each of the time - * fields but the meaning as defined below has been verified to be - * correct by practical experimentation on Windows NT4 SP6a and is hence - * assumed to be the one and only correct interpretation. + * fields but the meaning as defined below has been verified to be + * correct by practical experimentation on Windows NT4 SP6a and is hence + * assumed to be the one and only correct interpretation. */ typedef struct { /*hex ofs*/ @@ -961,7 +961,7 @@ typedef struct { * twelve hexadecimal digits. GUIDs are Microsoft's implementation of the * distributed computing environment (DCE) universally unique identifier (UUID). * Example of a GUID: - * 1F010768-5A73-BC91-0010A52216A7 + * 1F010768-5A73-BC91-0010A52216A7 */ typedef struct { u32 data1; /* The first eight hexadecimal digits of the GUID. */ @@ -1030,7 +1030,7 @@ typedef struct { //typedef enum { /* SID string prefix. */ // SECURITY_NULL_SID_AUTHORITY = {0, 0, 0, 0, 0, 0}, /* S-1-0 */ // SECURITY_WORLD_SID_AUTHORITY = {0, 0, 0, 0, 0, 1}, /* S-1-1 */ -// SECURITY_LOCAL_SID_AUTHORITY = {0, 0, 0, 0, 0, 2}, /* S-1-2 */ +// SECURITY_LOCAL_SID_AUTHORITY = {0, 0, 0, 0, 0, 2}, /* S-1-2 */ // SECURITY_CREATOR_SID_AUTHORITY = {0, 0, 0, 0, 0, 3}, /* S-1-3 */ // SECURITY_NON_UNIQUE_AUTHORITY = {0, 0, 0, 0, 0, 4}, /* S-1-4 */ // SECURITY_NT_SID_AUTHORITY = {0, 0, 0, 0, 0, 5}, /* S-1-5 */ @@ -1119,38 +1119,38 @@ typedef enum { /* Identifier authority. */ /* * The universal well-known SIDs: * - * NULL_SID S-1-0-0 - * WORLD_SID S-1-1-0 - * LOCAL_SID S-1-2-0 - * CREATOR_OWNER_SID S-1-3-0 - * CREATOR_GROUP_SID S-1-3-1 - * CREATOR_OWNER_SERVER_SID S-1-3-2 - * CREATOR_GROUP_SERVER_SID S-1-3-3 + * NULL_SID S-1-0-0 + * WORLD_SID S-1-1-0 + * LOCAL_SID S-1-2-0 + * CREATOR_OWNER_SID S-1-3-0 + * CREATOR_GROUP_SID S-1-3-1 + * CREATOR_OWNER_SERVER_SID S-1-3-2 + * CREATOR_GROUP_SERVER_SID S-1-3-3 * - * (Non-unique IDs) S-1-4 + * (Non-unique IDs) S-1-4 * * NT well-known SIDs: * - * NT_AUTHORITY_SID S-1-5 - * DIALUP_SID S-1-5-1 + * NT_AUTHORITY_SID S-1-5 + * DIALUP_SID S-1-5-1 * - * NETWORD_SID S-1-5-2 - * BATCH_SID S-1-5-3 - * INTERACTIVE_SID S-1-5-4 - * SERVICE_SID S-1-5-6 - * ANONYMOUS_LOGON_SID S-1-5-7 (aka null logon session) - * PROXY_SID S-1-5-8 - * SERVER_LOGON_SID S-1-5-9 (aka domain controller account) - * SELF_SID S-1-5-10 (self RID) - * AUTHENTICATED_USER_SID S-1-5-11 - * RESTRICTED_CODE_SID S-1-5-12 (running restricted code) - * TERMINAL_SERVER_SID S-1-5-13 (running on terminal server) + * NETWORD_SID S-1-5-2 + * BATCH_SID S-1-5-3 + * INTERACTIVE_SID S-1-5-4 + * SERVICE_SID S-1-5-6 + * ANONYMOUS_LOGON_SID S-1-5-7 (aka null logon session) + * PROXY_SID S-1-5-8 + * SERVER_LOGON_SID S-1-5-9 (aka domain controller account) + * SELF_SID S-1-5-10 (self RID) + * AUTHENTICATED_USER_SID S-1-5-11 + * RESTRICTED_CODE_SID S-1-5-12 (running restricted code) + * TERMINAL_SERVER_SID S-1-5-13 (running on terminal server) * - * (Logon IDs) S-1-5-5-X-Y + * (Logon IDs) S-1-5-5-X-Y * - * (NT non-unique IDs) S-1-5-0x15-... + * (NT non-unique IDs) S-1-5-0x15-... * - * (Built-in domain) S-1-5-0x20 + * (Built-in domain) S-1-5-0x20 */ /* @@ -1158,8 +1158,8 @@ typedef enum { /* Identifier authority. */ */ typedef union { struct { - u32 low_part; /* Low 32-bits. */ - u16 high_part; /* High 16-bits. */ + u32 low_part; /* Low 32-bits. */ + u16 high_part; /* High 16-bits. */ } __attribute__ ((__packed__)); u8 value[6]; /* Value as individual bytes. */ } __attribute__ ((__packed__)) SID_IDENTIFIER_AUTHORITY; @@ -1169,10 +1169,10 @@ typedef union { * users or groups. SID stands for security identifier. * * The standard textual representation of the SID is of the form: - * S-R-I-S-S... + * S-R-I-S-S... * Where: * - The first "S" is the literal character 'S' identifying the following - * digits as a SID. + * digits as a SID. * - R is the revision level of the SID expressed as a sequence of digits * either in decimal or hexadecimal (if the later, prefixed by "0x"). * - I is the 48-bit identifier_authority, expressed as digits as R above. @@ -1180,13 +1180,13 @@ typedef union { * * Example SID; the domain-relative SID of the local Administrators group on * Windows NT/2k: - * S-1-5-32-544 + * S-1-5-32-544 * This translates to a SID with: - * revision = 1, - * sub_authority_count = 2, - * identifier_authority = {0,0,0,0,0,5}, // SECURITY_NT_AUTHORITY - * sub_authority[0] = 32, // SECURITY_BUILTIN_DOMAIN_RID - * sub_authority[1] = 544 // DOMAIN_ALIAS_RID_ADMINS + * revision = 1, + * sub_authority_count = 2, + * identifier_authority = {0,0,0,0,0,5}, // SECURITY_NT_AUTHORITY + * sub_authority[0] = 32, // SECURITY_BUILTIN_DOMAIN_RID + * sub_authority[1] = 544 // DOMAIN_ALIAS_RID_ADMINS */ typedef struct { u8 revision; @@ -1492,48 +1492,48 @@ typedef enum { * The security descriptor control flags (16-bit). * * SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the - * SID pointed to by the Owner field was provided by a - * defaulting mechanism rather than explicitly provided by the - * original provider of the security descriptor. This may - * affect the treatment of the SID with respect to inheritence - * of an owner. + * SID pointed to by the Owner field was provided by a + * defaulting mechanism rather than explicitly provided by the + * original provider of the security descriptor. This may + * affect the treatment of the SID with respect to inheritence + * of an owner. * * SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the - * SID in the Group field was provided by a defaulting mechanism - * rather than explicitly provided by the original provider of - * the security descriptor. This may affect the treatment of - * the SID with respect to inheritence of a primary group. + * SID in the Group field was provided by a defaulting mechanism + * rather than explicitly provided by the original provider of + * the security descriptor. This may affect the treatment of + * the SID with respect to inheritence of a primary group. * * SE_DACL_PRESENT - This boolean flag, when set, indicates that the - * security descriptor contains a discretionary ACL. If this - * flag is set and the Dacl field of the SECURITY_DESCRIPTOR is - * null, then a null ACL is explicitly being specified. + * security descriptor contains a discretionary ACL. If this + * flag is set and the Dacl field of the SECURITY_DESCRIPTOR is + * null, then a null ACL is explicitly being specified. * * SE_DACL_DEFAULTED - This boolean flag, when set, indicates that the - * ACL pointed to by the Dacl field was provided by a defaulting - * mechanism rather than explicitly provided by the original - * provider of the security descriptor. This may affect the - * treatment of the ACL with respect to inheritence of an ACL. - * This flag is ignored if the DaclPresent flag is not set. + * ACL pointed to by the Dacl field was provided by a defaulting + * mechanism rather than explicitly provided by the original + * provider of the security descriptor. This may affect the + * treatment of the ACL with respect to inheritence of an ACL. + * This flag is ignored if the DaclPresent flag is not set. * * SE_SACL_PRESENT - This boolean flag, when set, indicates that the - * security descriptor contains a system ACL pointed to by the - * Sacl field. If this flag is set and the Sacl field of the - * SECURITY_DESCRIPTOR is null, then an empty (but present) - * ACL is being specified. + * security descriptor contains a system ACL pointed to by the + * Sacl field. If this flag is set and the Sacl field of the + * SECURITY_DESCRIPTOR is null, then an empty (but present) + * ACL is being specified. * * SE_SACL_DEFAULTED - This boolean flag, when set, indicates that the - * ACL pointed to by the Sacl field was provided by a defaulting - * mechanism rather than explicitly provided by the original - * provider of the security descriptor. This may affect the - * treatment of the ACL with respect to inheritence of an ACL. - * This flag is ignored if the SaclPresent flag is not set. + * ACL pointed to by the Sacl field was provided by a defaulting + * mechanism rather than explicitly provided by the original + * provider of the security descriptor. This may affect the + * treatment of the ACL with respect to inheritence of an ACL. + * This flag is ignored if the SaclPresent flag is not set. * * SE_SELF_RELATIVE - This boolean flag, when set, indicates that the - * security descriptor is in self-relative form. In this form, - * all fields of the security descriptor are contiguous in memory - * and all pointer fields are expressed as offsets from the - * beginning of the security descriptor. + * security descriptor is in self-relative form. In this form, + * all fields of the security descriptor are contiguous in memory + * and all pointer fields are expressed as offsets from the + * beginning of the security descriptor. */ typedef enum { SE_OWNER_DEFAULTED = const_cpu_to_le16(0x0001), @@ -1731,7 +1731,7 @@ typedef struct { typedef enum { VOLUME_IS_DIRTY = const_cpu_to_le16(0x0001), VOLUME_RESIZE_LOG_FILE = const_cpu_to_le16(0x0002), - VOLUME_UPGRADE_ON_MOUNT = const_cpu_to_le16(0x0004), + VOLUME_UPGRADE_ON_MOUNT = const_cpu_to_le16(0x0004), VOLUME_MOUNTED_ON_NT4 = const_cpu_to_le16(0x0008), VOLUME_DELETE_USN_UNDERWAY = const_cpu_to_le16(0x0010), VOLUME_REPAIR_OBJECT_ID = const_cpu_to_le16(0x0020), @@ -1745,7 +1745,7 @@ typedef enum { * NOTE: Always resident. * NOTE: Present only in FILE_Volume. * NOTE: Windows 2000 uses NTFS 3.0 while Windows NT4 service pack 6a uses - * NTFS 1.2. I haven't personally seen other values yet. + * NTFS 1.2. I haven't personally seen other values yet. */ typedef struct { u64 reserved; /* Not used (yet?). */ @@ -1781,7 +1781,7 @@ typedef enum { * allocation attribute: */ LEAF_NODE = 0, /* This is a leaf node, i.e. there are no more - nodes branching off it. */ + nodes branching off it. */ INDEX_NODE = 1, /* This node indexes other nodes, i.e. is not a leaf node. */ NODE_MASK = 1, /* Mask for accessing the *_NODE bits. */ @@ -2002,7 +2002,7 @@ typedef struct { } __attribute__ ((__packed__)); /* 8*/ u16 length; /* Byte size of this index entry, multiple of 8-bytes. */ -/* 10*/ u16 key_length; /* Byte size of the key value, which is in the +/* 10*/ u16 key_length; /* Byte size of the key value, which is in the index entry. It follows field reserved. Not multiple of 8-bytes. */ /* 12*/ INDEX_ENTRY_FLAGS flags; /* Bit field of INDEX_ENTRY_* flags. */ @@ -2080,9 +2080,9 @@ typedef struct { * They are defined as follows: * bit 29: Name surrogate bit. If set, the filename is an alias for * another object in the system. - * bit 30: High-latency bit. If set, accessing the first byte of data will + * bit 30: High-latency bit. If set, accessing the first byte of data will * be slow. (E.g. the data is stored on a tape drive.) - * bit 31: Microsoft bit. If set, the tag is owned by Microsoft. User + * bit 31: Microsoft bit. If set, the tag is owned by Microsoft. User * defined tags have to use zero here. */ typedef enum { diff --git a/include/logfile.h b/include/logfile.h index 587a5979..c083fa58 100644 --- a/include/logfile.h +++ b/include/logfile.h @@ -41,9 +41,9 @@ typedef enum { /* * Log file organization: - * Two restart areas present in the first two pages (restart pages). When + * Two restart areas present in the first two pages (restart pages). When * the volume is unmounted they should be identical. - * These are followed by log records organized in pages headed by a record + * These are followed by log records organized in pages headed by a record * header going up to log file size. Not all pages contain log records when a * volume is first formatted, but as the volume ages, all records will be used. * When the log file fills up, the records at the beginning are purged (by diff --git a/include/mft.h b/include/mft.h index 5f8fa21b..486d070c 100644 --- a/include/mft.h +++ b/include/mft.h @@ -86,7 +86,7 @@ static __inline__ int ntfs_write_mft_record(const ntfs_volume *vol, * or 0 on error (i.e. @m is not a valid mft record). Zero is not a valid size * for an mft record as it at least has to have the MFT_RECORD, thus making the * minimum size: - * (sizeof(MFT_RECORD) + 7) & ~7 + sizeof(ATTR_TYPES) = 52 bytes + * (sizeof(MFT_RECORD) + 7) & ~7 + sizeof(ATTR_TYPES) = 52 bytes * Aside: The 8-byte alignment and the 4 bytes for the attribute type are needed * as each mft record has to have a list of attributes even if it only contains * the attribute $END which doesn't contain anything else apart from its type. diff --git a/include/mst.h b/include/mst.h index aae84003..860c070c 100644 --- a/include/mst.h +++ b/include/mst.h @@ -2,7 +2,7 @@ * $Id$ * * mst.h - Exports for multi sector transfer fixup functions. Part of the - * Linux-NTFS project. + * Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov. * diff --git a/include/support.h b/include/support.h index 728b4b58..c5af6ad3 100644 --- a/include/support.h +++ b/include/support.h @@ -30,18 +30,18 @@ * Generic macro to convert pointers to values for comparison purposes. */ #ifndef p2n -#define p2n(p) ((ptrdiff_t)((ptrdiff_t*)(p))) +#define p2n(p) ((ptrdiff_t)((ptrdiff_t*)(p))) #endif /* * The classical min and max macros. */ #ifndef min -#define min(a,b) ((a) <= (b) ? (a) : (b)) +#define min(a,b) ((a) <= (b) ? (a) : (b)) #endif #ifndef max -#define max(a,b) ((a) >= (b) ? (a) : (b)) +#define max(a,b) ((a) >= (b) ? (a) : (b)) #endif /* diff --git a/libntfs/attrib.c b/libntfs/attrib.c index ef7ff266..3007738d 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -83,7 +83,7 @@ s64 get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, return 0; } memcpy(b, (char*)a + le16_to_cpu(a->value_offset), - le32_to_cpu(a->value_length)); + le32_to_cpu(a->value_length)); errno = 0; return (s64)le32_to_cpu(a->value_length); } else { /* Attribute is not resident. */ @@ -122,12 +122,12 @@ s64 get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, * going to overflow when executing the * ntfs_pread() which is BAAAAAAAD! * Temporary fix: - * Allocate a new buffer with size: - * rl[i].length << vol->cluster_size_bits, - * do the read into our buffer, then - * memcpy the correct amount of data into - * the caller supplied buffer, free our - * buffer, and continue. + * Allocate a new buffer with size: + * rl[i].length << vol->cluster_size_bits, + * do the read into our buffer, then + * memcpy the correct amount of data into + * the caller supplied buffer, free our + * buffer, and continue. */ intbuf = malloc(rl[i].length << vol->cluster_size_bits); @@ -167,7 +167,7 @@ s64 get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, "out of input data.\n"); errno = EIO; } else { - fprintf(stderr, ESTR ": " + fprintf(stderr, ESTR ": " "unknown error\n"); errno = EIO; } @@ -206,7 +206,7 @@ s64 get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, "out of input data.\n"); errno = EIO; } else { - fprintf(stderr, ESTR ": " + fprintf(stderr, ESTR ": " "unknown error\n"); errno = EIO; } @@ -605,7 +605,7 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) if (NAttrCompressed(na)) { // TODO: Implement reading compressed attributes! (AIA) // return ntfs_attr_pread_compressed(ntfs_attr *na, - // const s64 pos, s64 count, void *b); + // const s64 pos, s64 count, void *b); errno = ENOTSUP; return -1; } @@ -782,7 +782,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) if (NAttrCompressed(na)) { // TODO: Implement writing compressed attributes! (AIA) // return ntfs_attr_pwrite_compressed(ntfs_attr *na, - // const s64 pos, s64 count, void *b); + // const s64 pos, s64 count, void *b); errno = ENOTSUP; return -1; } @@ -1301,7 +1301,7 @@ static int ntfs_find_attr(const ATTR_TYPES type, const uchar_t *name, } /* If the strings are not equal, continue search. */ if (rc) - continue; + continue; rc = ntfs_collate_names(name, name_len, (uchar_t*)((char*)a + le16_to_cpu(a->name_offset)), diff --git a/libntfs/attrib_RE.txt b/libntfs/attrib_RE.txt index af74290a..d3db334d 100644 --- a/libntfs/attrib_RE.txt +++ b/libntfs/attrib_RE.txt @@ -116,14 +116,14 @@ found_it: goto not_found; /* If the strings are not equal, continue search. */ if (rc) - goto do_next; + goto do_next; } /* If case sensitive collation of names doesn't collate @name before a->name, we continue the search. Otherwise we haven't found it. */ if (ntfs_collate_names(vol->upcase, vol->upcase_len, name, name_len, (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, CASE_SENSITIVE, 1) != -1) - goto do_next; + goto do_next; not_found: return FALSE; file_corrupt: diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index dfb083aa..dee15a17 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -238,7 +238,7 @@ int parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) * When clusters_per_mft_record is negative, it means that it is to * be taken to be the negative base 2 logarithm of the mft_record_size * min bytes. Then: - * mft_record_size = 2^(-clusters_per_mft_record) bytes. + * mft_record_size = 2^(-clusters_per_mft_record) bytes. */ if (c < 0) vol->mft_record_size = 1 << -c; diff --git a/libntfs/mst.c b/libntfs/mst.c index 32e3c874..e4ece6dc 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -26,8 +26,8 @@ /** * ntfs_post_read_mst_fixup - deprotect multi sector transfer protected data - * @b: pointer to the data to deprotect - * @size: size in bytes of @b + * @b: pointer to the data to deprotect + * @size: size in bytes of @b * * Perform the necessary post read multi sector transfer fixups and detect the * presence of incomplete multi sector transfers. - In that case, overwrite the @@ -69,11 +69,11 @@ int ntfs_post_read_mst_fixup(NTFS_RECORD *b, const u32 size) * Position in protected data of first u16 that needs fixing up. */ data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1; - /* + /* * Check for incomplete multi sector transfer(s). */ while (usa_count--) { - if (*data_pos != usn) { + if (*data_pos != usn) { /* * Incomplete multi sector transfer detected! )-: * Set the magic to "BAAD" and return failure. @@ -81,7 +81,7 @@ int ntfs_post_read_mst_fixup(NTFS_RECORD *b, const u32 size) */ b->magic = magic_BAAD; errno = EIO; - return -1; + return -1; } data_pos += NTFS_SECTOR_SIZE/sizeof(u16); } @@ -95,16 +95,16 @@ int ntfs_post_read_mst_fixup(NTFS_RECORD *b, const u32 size) * the usa into the data buffer. */ *data_pos = *(++usa_pos); - /* Increment position in data as well. */ + /* Increment position in data as well. */ data_pos += NTFS_SECTOR_SIZE/sizeof(u16); - } + } return 0; } /** * ntfs_pre_write_mst_fixup - apply multi sector transfer protection - * @b: pointer to the data to protect - * @size: size in bytes of @b + * @b: pointer to the data to protect + * @size: size in bytes of @b * * Perform the necessary pre write multi sector transfer fixup on the data * pointer to by @b of @size. @@ -155,8 +155,8 @@ int ntfs_pre_write_mst_fixup(NTFS_RECORD *b, const u32 size) *usa_pos = usn; /* Position in data of first u16 that needs fixing up. */ data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1; - /* Fixup all sectors. */ - while (usa_count--) { + /* Fixup all sectors. */ + while (usa_count--) { /* * Increment the position in the usa and save the * original data from the data buffer into the usa. @@ -166,13 +166,13 @@ int ntfs_pre_write_mst_fixup(NTFS_RECORD *b, const u32 size) *data_pos = usn; /* Increment position in data as well. */ data_pos += NTFS_SECTOR_SIZE/sizeof(u16); - } + } return 0; } /** * ntfs_post_write_mst_fixup - deprotect multi sector transfer protected data - * @b: pointer to the data to deprotect + * @b: pointer to the data to deprotect * * Perform the necessary post write multi sector transfer fixup, not checking * for any errors, because we assume we have just used @@ -192,7 +192,7 @@ void ntfs_post_write_mst_fixup(NTFS_RECORD *b) /* Position in protected data of first u16 that needs fixing up. */ data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1; - /* Fixup all sectors. */ + /* Fixup all sectors. */ while (usa_count--) { /* * Increment position in usa and restore original data from @@ -200,8 +200,8 @@ void ntfs_post_write_mst_fixup(NTFS_RECORD *b) */ *data_pos = *(++usa_pos); - /* Increment position in data as well. */ + /* Increment position in data as well. */ data_pos += NTFS_SECTOR_SIZE/sizeof(u16); - } + } } diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 98672354..22975e3b 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -71,7 +71,7 @@ static __inline__ void ntfs_rl_mc(run_list_element *dstbase, int dst, * of memory. * * N.B. If the new allocation doesn't require a different number of 4kiB - * blocks in memory, the function will return the original pointer. + * blocks in memory, the function will return the original pointer. * * On success, return a pointer to the newly allocated, or recycled, memory. * On error, return NULL with errno set to the error code. @@ -97,7 +97,7 @@ static __inline__ run_list_element *ntfs_rl_realloc(run_list_element *rl, * must be adjacent. * * Return: TRUE Success, the run lists can be merged. - * FALSE Failure, the run lists cannot be merged. + * FALSE Failure, the run lists cannot be merged. */ static __inline__ BOOL ntfs_are_rl_mergeable(run_list_element *dst, run_list_element *src) @@ -147,7 +147,7 @@ static __inline__ void __ntfs_rl_merge(run_list_element *dst, * the destination run list @dst. * * Return: TRUE Success, the run lists have been merged. - * FALSE Failure, the run lists cannot be merged and have not been + * FALSE Failure, the run lists cannot be merged and have not been * modified. */ static __inline__ BOOL ntfs_rl_merge(run_list_element *dst, @@ -264,9 +264,9 @@ static __inline__ run_list_element *ntfs_rl_insert(run_list_element *dst, } /* disc => Discontinuity between the end of @dst and the start of @src. - * This means we might need to insert a hole. + * This means we might need to insert a hole. * hole => @dst ends with a hole or an unmapped region which we can - * extend to match the discontinuity. */ + * extend to match the discontinuity. */ if (loc == 0) disc = (src[0].vcn > 0); else { @@ -447,9 +447,9 @@ static __inline__ run_list_element *ntfs_rl_split(run_list_element *dst, ntfs_rl_mc(dst, loc + 1, src, 0, ssize); /* Adjust the size of the holes either size of @src. */ - dst[loc].length = dst[loc+1].vcn - dst[loc].vcn; - dst[loc+ssize+1].vcn = dst[loc+ssize].vcn + dst[loc+ssize].length; - dst[loc+ssize+1].length = dst[loc+ssize+2].vcn - dst[loc+ssize+1].vcn; + dst[loc].length = dst[loc+1].vcn - dst[loc].vcn; + dst[loc+ssize+1].vcn = dst[loc+ssize].vcn + dst[loc+ssize].length; + dst[loc+ssize+1].length = dst[loc+ssize+2].vcn - dst[loc+ssize+1].vcn; return dst; } @@ -504,7 +504,7 @@ run_list_element *ntfs_merge_run_lists(run_list_element *drl, Dputs("src:"); ntfs_debug_dump_run_list(srl); - /* Check for silly calling... */ + /* Check for silly calling... */ if (!srl) return drl; @@ -710,10 +710,10 @@ critical_error: * unmodified in that case. * * The following error codes are defined: - * ENOMEM Not enough memory to allocate run list array. - * EIO Corrupt run list. - * EINVAL Invalid parameters were passed in. - * ERANGE The two run lists overlap. + * ENOMEM Not enough memory to allocate run list array. + * EIO Corrupt run list. + * EINVAL Invalid parameters were passed in. + * ERANGE The two run lists overlap. * * FIXME: For now we take the conceptionally simplest approach of creating the * new run list disregarding the already existing one and then splicing the @@ -724,7 +724,7 @@ run_list_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, const ATTR_RECORD *attr, run_list_element *old_rl) { VCN vcn; /* Current vcn. */ - LCN lcn; /* Current lcn. */ + LCN lcn; /* Current lcn. */ s64 deltaxcn; /* Change in [vl]cn. */ run_list_element *rl; /* The output run list. */ u8 *buf; /* Current position in mapping pairs array. */ diff --git a/libntfs/unistr.c b/libntfs/unistr.c index f19a77fa..ec749c43 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -92,7 +92,7 @@ BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len, * @upcase_len: upcase table size (ignored if @ic is CASE_SENSITIVE) * @name1: first Unicode name to compare * @name2: second Unicode name to compare - * @ic: either CASE_SENSITIVE or IGNORE_CASE + * @ic: either CASE_SENSITIVE or IGNORE_CASE * @err_val: if @name1 contains an invalid character return this value * * ntfs_collate_names collates two Unicode names and returns: diff --git a/libntfs/volume.c b/libntfs/volume.c index 07f68f4e..85da29b0 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -900,16 +900,16 @@ int ntfs_is_version_supported(ntfs_volume *vol) errno = EINVAL; return -1; } - + major = vol->major_ver; minor = vol->minor_ver; if (NTFS_V1_1(major, minor) || NTFS_V1_2(major, minor)) return 0; - + if (NTFS_V2_X(major, minor)) return 0; - + if (NTFS_V3_0(major, minor) || NTFS_V3_1(major, minor)) return 0; @@ -943,7 +943,7 @@ int ntfs_reset_logfile(ntfs_volume *vol) errno = EINVAL; return -1; } - + if ((ni = ntfs_open_inode(vol, FILE_LogFile)) == NULL) { Dperror("Failed to open inode FILE_LogFile.\n"); return -1; @@ -953,7 +953,7 @@ int ntfs_reset_logfile(ntfs_volume *vol) Dperror("Failed to open $FILE_LogFile/$DATA\n"); goto error_exit; } - + /* The $DATA attribute of the $LogFile has to be non-resident. */ if (!NAttrNonResident(na)) { Dprintf("$LogFile $DATA attribute is resident!?!\n"); @@ -967,9 +967,9 @@ int ntfs_reset_logfile(ntfs_volume *vol) Dprintf("$LogFile has zero length, no disk write needed.\n"); return 0; } - - /* Read $LogFile until its end. We do this as a check for correct - length thus making sure we are decompressing the mapping pairs + + /* Read $LogFile until its end. We do this as a check for correct + length thus making sure we are decompressing the mapping pairs array correctly and hence writing below is safe as well. */ pos = 0; while ((count = ntfs_attr_pread(na, pos, NTFS_BUF_SIZE, buf)) > 0) @@ -991,7 +991,7 @@ int ntfs_reset_logfile(ntfs_volume *vol) while ((count = len - pos) > 0) { if (count > NTFS_BUF_SIZE) count = NTFS_BUF_SIZE; - + if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { Dprintf("Failed to set the $LogFile attribute value."); if (count != -1) @@ -1000,7 +1000,7 @@ int ntfs_reset_logfile(ntfs_volume *vol) } pos += count; } - + ntfs_attr_close(na); return ntfs_close_inode(ni); @@ -1020,8 +1020,8 @@ error_exit: * @vol: ntfs volume where we set the volume flags * @flags: new flags * - * Set the on-disk volume flags in the mft record of $Volume and - * on volume @vol to @flags. + * Set the on-disk volume flags in the mft record of $Volume and + * on volume @vol to @flags. * * Return 0 on successful and -1 if not, with errno set to the error code. */ @@ -1076,7 +1076,7 @@ int ntfs_set_volume_flags(ntfs_volume *vol, const u16 flags) /* Sanity checks. */ if ((char*)c + le32_to_cpu(r->value_length) > le16_to_cpu(m->bytes_in_use) + (char*)m || - le16_to_cpu(r->value_offset) + + le16_to_cpu(r->value_offset) + le32_to_cpu(r->value_length) > le32_to_cpu(r->length)) { Dputs("Error: Attribute $VOLUME_INFORMATION in $Volume is " "corrupt!"); @@ -1090,11 +1090,11 @@ int ntfs_set_volume_flags(ntfs_volume *vol, const u16 flags) Dperror("Error writing $Volume"); goto err_out; } - + ret = 0; /* success */ err_out: ntfs_put_attr_search_ctx(ctx); -err_exit: +err_exit: if (m) free(m); return ret; diff --git a/ntfsprogs/dumplog.c b/ntfsprogs/dumplog.c index 1a730c97..1eef361c 100644 --- a/ntfsprogs/dumplog.c +++ b/ntfsprogs/dumplog.c @@ -11,7 +11,7 @@ const char *EXEC_VERSION = "1.0"; * on the command line and display the results on stdout. Errors will be output * to stderr. * - * Anton Altaparmakov + * Anton Altaparmakov * * 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 @@ -77,7 +77,7 @@ int main(int argc, char **argv) fprintf(stderr, "Error: incorrect syntax\n"); exit(1); } - if (stat(argv[1], &sbuf) == -1) { + if (stat(argv[1], &sbuf) == -1) { if (errno == ENOENT) fprintf(stderr, "The file doesn't exist; did you " "specify it correctly?\n"); diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 55b892fa..f84abeb5 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2001,2002 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" Adapted from e2fsprogs-1.19/misc/mke2fs.8.in by Theodore Ts'o. -.\" +.\" .TH MKNTFS 8 "March 2002" "Linux-NTFS version @VERSION@" .SH NAME mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system @@ -26,7 +26,7 @@ mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system ] [ .B \-f -| +| .B \-Q ] [ @@ -62,7 +62,7 @@ mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system is used to create a NTFS 1.2 (Windows NT 4.0) file system on a device (usually a disk partition). .I device -is the special file corresponding to the device (e.g +is the special file corresponding to the device (e.g .IR /dev/hdXX ). .I number-of-sectors is the number of blocks on the device. If omitted, @@ -143,7 +143,7 @@ actual writing to the device. .TP .B \-q Quiet execution; only errors are written to stderr, no output to stdout -occurs at all. Useful if +occurs at all. Useful if .B mkntfs is run in a script. .TP @@ -160,7 +160,7 @@ option as well as additional output useful for debugging Enable compression on the volume. .TP .B \-F -Force +Force .B mkntfs to run, even if the specified .I device @@ -172,7 +172,7 @@ Windows 2000 and later. Windows NT 4.0 and earlier ignore this as they do not implement content indexing at all.) .TP .B \-V -Print the version number of +Print the version number of .B mkntfs and exit. .SH BUGS @@ -205,7 +205,7 @@ has been written by Anton Altaparmakov (if that fails, use ). .SH AVAILABILITY .B mkntfs -is part of the Linux-NTFS project and is available for download from +is part of the Linux-NTFS project and is available for download from http://sf.net/project/showfiles.php?group_id=13956 in source (tar ball and rpm) and pre-compiled binary (i386 rpm and deb) form. .SH SEE ALSO diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 47357c76..5a8fd7b1 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -13,7 +13,7 @@ * adapted from e2fsprogs-1.19 and lib/ext2fs/ismounted.c and misc/mke2fs.c in * particular. * - * Anton Altaparmakov + * Anton Altaparmakov * * 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 @@ -43,7 +43,7 @@ * If anyone using a non-little endian and/or an aligned access only CPU tries * this program please let me know whether it works or not! * - * Anton Altaparmakov + * Anton Altaparmakov */ #include "config.h" @@ -839,11 +839,11 @@ void format_mft_record(MFT_RECORD *m) * * Return 0 on success or -errno on error. Possible error codes are: * - * -ENOSPC There is not enough space available to complete - * operation. The caller has to make space before calling - * this. - * -EINVAL Can only occur if mkntfs was compiled with -DEBUG. Means - * the input parameters were faulty. + * -ENOSPC There is not enough space available to complete + * operation. The caller has to make space before calling + * this. + * -EINVAL Can only occur if mkntfs was compiled with -DEBUG. Means + * the input parameters were faulty. */ int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) { @@ -1116,14 +1116,14 @@ int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, if (err == -ENOSPC) { // FIXME: Make space! (AIA) // can we make it non-resident? if yes, do that. - // does it fit now? yes -> do it. + // does it fit now? yes -> do it. // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? // yes -> make non-resident - // does it fit now? yes -> do it. + // does it fit now? yes -> do it. // make all attributes non-resident - // does it fit now? yes -> do it. + // does it fit now? yes -> do it. // m is a base record? yes -> allocate extension record - // does the new attribute fit in there? yes -> do it. + // does the new attribute fit in there? yes -> do it. // split up run_list into extents and place each in an extension // record. // FIXME: the check for needing extension records should be @@ -1299,14 +1299,14 @@ int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, if (err == -ENOSPC) { // FIXME: Make space! (AIA) // can we make it non-resident? if yes, do that. - // does it fit now? yes -> do it. + // does it fit now? yes -> do it. // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? // yes -> make non-resident - // does it fit now? yes -> do it. + // does it fit now? yes -> do it. // make all attributes non-resident - // does it fit now? yes -> do it. + // does it fit now? yes -> do it. // m is a base record? yes -> allocate extension record - // does the new attribute fit in there? yes -> do it. + // does the new attribute fit in there? yes -> do it. // split up run_list into extents and place each in an extension // record. // FIXME: the check for needing extension records should be @@ -1437,14 +1437,14 @@ int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, if (err == -ENOSPC) { // FIXME: Make space! (AIA) // can we make it non-resident? if yes, do that. - // does it fit now? yes -> do it. + // does it fit now? yes -> do it. // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? // yes -> make non-resident - // does it fit now? yes -> do it. + // does it fit now? yes -> do it. // make all attributes non-resident - // does it fit now? yes -> do it. + // does it fit now? yes -> do it. // m is a base record? yes -> allocate extension record - // does the new attribute fit in there? yes -> do it. + // does the new attribute fit in there? yes -> do it. // split up run_list into extents and place each in an extension // record. // FIXME: the check for needing extension records should be @@ -2547,14 +2547,14 @@ int main(int argc, char **argv) /* Parse command line options. */ parse_options(argc, argv); /* Verify we are dealing with a block device. */ - if (stat(vol->dev_name, &sbuf) == -1) { + if (stat(vol->dev_name, &sbuf) == -1) { if (errno == ENOENT) err_exit("The device doesn't exist; did you specify " "it correctly?\n"); err_exit("Error getting information about %s: %s\n", vol->dev_name, strerror(errno)); } - if (!S_ISBLK(sbuf.st_mode)) { + if (!S_ISBLK(sbuf.st_mode)) { Eprintf("%s is not a block device.\n", vol->dev_name); if (!opt.force) err_exit("Refusing to make a filesystem here!\n"); diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index e785ea96..e4bf33f6 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -11,7 +11,7 @@ const char *EXEC_VERSION = "1.0"; * NTFS partition and display the results on stdout. Errors will be output to * stderr. * - * Anton Altaparmakov + * Anton Altaparmakov * * 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 @@ -41,7 +41,7 @@ const char *EXEC_VERSION = "1.0"; * If anyone using a non-little endian and/or an aligned access only CPU tries * this program please let me know whether it works or not! * - * Anton Altaparmakov + * Anton Altaparmakov */ #include @@ -116,7 +116,7 @@ int main(int argc, char **argv) /* Fall through on error. */ default: version_error: - fprintf(stderr, "Error: Unknown NTFS version.\n"); + fprintf(stderr, "Error: Unknown NTFS version.\n"); goto error_exit; } /* Read in $LogFile. */ @@ -137,7 +137,7 @@ version_error: /* Find the $DATA attribute of the $LogFile. */ if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { fprintf(stderr, "Error: Attribute $DATA was not found in" \ - "$LogFile!\n"); + "$LogFile!\n"); goto log_file_error; } a = ctx->attr; diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index 6d4eaecd..2cbe98dd 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -26,7 +26,7 @@ This manual page documents briefly the command. .PP .\" TeX users may be more comfortable with the \fB\fP and -.\" \fI\fP escape sequences to invode bold face and italics, +.\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. \fBntfsfix\fP is a program that fixes NTFS partitions altered in any manner with the Linux NTFS driver. \fBntfsfix\fP is \fBNOT\fP a Linux @@ -53,7 +53,7 @@ This manual page was written by David Mart system (but may be used by others). .SH AVAILABILITY .B ntfsfix -is part of the linux-ntfs package and is available from +is part of the linux-ntfs package and is available from http://linux-ntfs.sourceforge.net/. .SH SEE ALSO .BR mkntfs (8), diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index e852061b..4ec021b2 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -12,7 +12,7 @@ * the partition, but it might be too late and irreversible damage to the data * might have been done already. * - * Anton Altaparmakov + * Anton Altaparmakov * * 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 @@ -42,7 +42,7 @@ * If anyone using a non-little endian and/or an aligned access only CPU tries * this program please let me know whether it works or not! * - * Anton Altaparmakov + * Anton Altaparmakov */ #include "config.h" @@ -258,7 +258,7 @@ mount_ok: printf("NTFS volume version is %i.%i.\n\n", vol->major_ver, vol->minor_ver); if (ntfs_is_version_supported(vol)) { - fprintf(stderr, "Error: Unknown NTFS version.\n"); + fprintf(stderr, "Error: Unknown NTFS version.\n"); goto error_exit; } diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index f7bdc14f..96401269 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -1,7 +1,7 @@ .\" -*- nroff -*- .\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. -.\" +.\" .TH NTFSINFO 8 "May 2002" "Linux-NTFS version @VERSION@" .SH NAME ntfsinfo \- dump a file's attributes @@ -19,7 +19,7 @@ will dump the attributes of inode was written by Matthew J. Fanto (fanto1mj@cmich.edu). .SH AVAILABILITY .B ntfsinfo -is part of the linux-ntfs package and is available from +is part of the linux-ntfs package and is available from http://linux-ntfs.sourceforge.net/. .SH SEE ALSO .BR ntfsprogs (8) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 45b6d1bb..cf82eacf 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -150,10 +150,10 @@ void print_standard_information_attr(ntfs_attr_search_ctx *ctx) standard_information_attr->version_number); printf("Class ID: %d\n", standard_information_attr->class_id); - printf("Owner ID: %d\n", - standard_information_attr->owner_id); - printf("Security ID: %d\n", - standard_information_attr->security_id); + printf("Owner ID: %d\n", + standard_information_attr->owner_id); + printf("Security ID: %d\n", + standard_information_attr->security_id); */ } diff --git a/ntfsprogs/ntfslabel.8.in b/ntfsprogs/ntfslabel.8.in index cbaa51ed..c9189ed8 100644 --- a/ntfsprogs/ntfslabel.8.in +++ b/ntfsprogs/ntfslabel.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" Adapted from e2fsprogs-1.26/misc/e2label.8.in by Theodore Ts'o. -.\" +.\" .TH NTFSLABEL 8 "April 2002" "Linux-NTFS version @VERSION@" .SH NAME ntfslabel \- display/change the label on an ntfs file system @@ -42,12 +42,12 @@ option of during creation of the file system. .PP .SH AUTHOR -.B ntfslabel +.B ntfslabel was written by Matthew J. Fanto (fanto1mj@cmich.edu). This man page was written by Anton Altaparmakov (aia21@cantab.net). .SH AVAILABILITY .B ntfslabel -is part of the linux-ntfs package and is available from +is part of the linux-ntfs package and is available from http://linux-ntfs.sourceforge.net/. .SH SEE ALSO .BR mkntfs (8), diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index 30696de2..d819a987 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -1,7 +1,7 @@ .\" Copyright (c) 2002 Richard Russon. All Rights Reserved. .\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. -.\" +.\" .TH NTFSPROGS 8 "May 2002" "Linux-NTFS version @VERSION@" .SH OVERVIEW diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index c3c6c770..19cb1025 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -26,7 +26,7 @@ parameter may have one of the optional modifiers .I size parameter is given in kilo-, mega- or gigabytes respectively. .B ntfsresize -conforms to the SI, ATA, IEEE standards and the disk manufacturers +conforms to the SI, ATA, IEEE standards and the disk manufacturers by using k=10^3, M=10^6 and G=10^9. .PP The @@ -37,13 +37,13 @@ If you wish to shrink an NTFS partition, first use to shrink the size of the filesystem. Then you may use .BR fdisk (8) to shrink the size of the partition by deleting the -partition and recreating it with the smaller size. +partition and recreating it with the smaller size. .PP .B IMPORTANT! When recreating the partition with .BR fdisk (8) make sure you create it with the same starting -disk cylinder and partition type +disk cylinder and partition type as before and you do not make it smaller than the new size of the NTFS filesystem! Otherwise you may lose your entire filesystem. Also make sure you set the bootable flag for the partition if it @@ -54,7 +54,7 @@ Note, .B ntfsresize schedules 'chkdsk' to make an NTFS consistency check when you will boot Windows. If your partition was a -system partition than Windows may intentionally reboot after +system partition than Windows may intentionally reboot after the successful consistency check. .SH OPTIONS diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index d7d2ab65..6bd84fc4 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -50,12 +50,12 @@ static const char *ntfs_report_banner = "\nReport bugs to linux-ntfs-dev@lists.sf.net. " "Homepage: http://linux-ntfs.sf.net\n"; -static const char *resize_warning_msg = +static const char *resize_warning_msg = "WARNING: Every sanity check passed and only the DANGEROUS operations left.\n" "Please make sure all your important data had been backed up in case of an\n" "unexpected failure!\n"; -static const char *resize_important_msg = +static const char *resize_important_msg = "NTFS had been successfully resized on device '%s'.\n" "You can go on to resize the device e.g. with 'fdisk'.\n" "IMPORTANT: When recreating the partition, make sure you\n" @@ -65,7 +65,7 @@ static const char *resize_important_msg = " 4) set the bootable flag for the partition if it existed before\n" "Otherwise you may lose your data or can't boot your computer from the disk!\n"; -static const char *fragmented_volume_msg = +static const char *fragmented_volume_msg = "The volume end is fragmented, this case is not yet supported. Defragment it\n" "(Windows 2000, XP and .NET have built in defragmentation tool) and try again.\n"; @@ -188,11 +188,11 @@ s64 get_new_volume_size(char *s) { s64 size; char *suffix; - + size = strtoll(s, &suffix, 10); if (size <= 0 || errno == ERANGE) err_exit("Illegal new volume size\n"); - + if (!*suffix) return size; @@ -209,7 +209,7 @@ s64 get_new_volume_size(char *s) cfdisk 10^3 10^6 10^9 sfdisk 2^10 2^20 parted 2^10 2^20 (may change) - fdisk (DOS) 2^10 2^20 + fdisk (DOS) 2^10 2^20 */ /* FIXME: check for overflow */ switch (*suffix) { @@ -223,7 +223,7 @@ s64 get_new_volume_size(char *s) default: usage(); } - + return size; } @@ -285,7 +285,7 @@ void parse_options(int argc, char **argv) usage(); } opt.ro_flag = MS_RDONLY; - } + } } @@ -335,7 +335,7 @@ void walk_attributes(MFT_RECORD *mr) ntfs_attr_search_ctx *ctx; if (!(ctx = ntfs_get_attr_search_ctx(NULL, mr))) - perr_exit("ntfs_get_attr_search_ctx"); + perr_exit("ntfs_get_attr_search_ctx"); while (!ntfs_walk_attrs(ctx)) { if (ctx->attr->type == AT_END) @@ -356,7 +356,7 @@ void get_bitmap_data(ntfs_volume *vol, struct bitmap *bm) perr_exit("ntfs_open_inode"); if (!(ctx = ntfs_get_attr_search_ctx(ni, NULL))) - perr_exit("ntfs_get_attr_search_ctx"); + perr_exit("ntfs_get_attr_search_ctx"); if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) perr_exit("ntfs_lookup_attr"); @@ -418,7 +418,7 @@ void walk_inodes() s32 inode = 0; s64 last_mft_rec; MFT_REF mref; - MFT_RECORD *mrec = NULL; + MFT_RECORD *mrec = NULL; struct progress_bar progress; printf("Scanning volume ...\n"); @@ -426,7 +426,7 @@ void walk_inodes() last_mft_rec = vol->nr_mft_records - 1; progress_init(&progress, inode, last_mft_rec, 100); - for (; inode <= last_mft_rec; inode++) { + for (; inode <= last_mft_rec; inode++) { progress_update(&progress, inode); mref = (MFT_REF)inode; @@ -435,7 +435,7 @@ void walk_inodes() MFT record not in use based on $MFT bitmap */ if (errno == EIO) continue; - perr_exit("Reading inode %ld failed", inode); + perr_exit("Reading inode %ld failed", inode); } if (!(mrec->flags & MFT_RECORD_IN_USE)) continue; @@ -455,31 +455,31 @@ void advise_on_resize() for (i = vol->nr_clusters - 1; i > 0; i--) if (ntfs_get_bit(lcn_bitmap.bm, i)) break; - + i += 2; /* first free + we reserve one for the backup boot sector */ fragmanted_end = (i >= vol->nr_clusters) ? 1 : 0; - + if (fragmanted_end || !opt.info) { printf(fragmented_volume_msg); if (fragmanted_end) exit(1); printf("Now "); } - + old_b = vol->nr_clusters * vol->cluster_size; old_mb = rounded_up_division(old_b, NTFS_MBYTE); new_b = i * vol->cluster_size; new_mb = rounded_up_division(new_b, NTFS_MBYTE); g_b = (vol->nr_clusters - i) * vol->cluster_size; g_mb = g_b / NTFS_MBYTE; - + printf("You could resize at %lld bytes ", new_b); - + if ((new_mb * NTFS_MBYTE) < old_b) printf("or %lld MB ", new_mb); - + printf("(freeing "); - + if (g_mb && (old_mb - new_mb)) printf("%lld MB", old_mb - new_mb); else @@ -658,7 +658,7 @@ void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) perr_exit("Attribute list attribute not yet supported"); if (!(*ctx = ntfs_get_attr_search_ctx(ni, NULL))) - perr_exit("ntfs_get_attr_search_ctx"); + perr_exit("ntfs_get_attr_search_ctx"); if (aname && ((len = ntfs_mbstoucs(aname, &ustr, 0)) == -1)) perr_exit("Unable to convert string to Unicode"); @@ -745,7 +745,7 @@ void update_bootsector(s64 nr_clusters) perr_exit("lseek"); if (read(vol->fd, &bs, sizeof(NTFS_BOOT_SECTOR)) == -1) - perr_exit("read() error"); + perr_exit("read() error"); bs.number_of_sectors = nr_clusters * bs.bpb.sectors_per_cluster; bs.number_of_sectors = cpu_to_le64(bs.number_of_sectors); @@ -762,9 +762,9 @@ void update_bootsector(s64 nr_clusters) void print_volume_size(char *str, ntfs_volume *v, s64 nr_clusters) { s64 b; /* volume size in bytes */ - + b = nr_clusters * v->cluster_size; - printf("%s: %lld bytes (%lld MB)\n", + printf("%s: %lld bytes (%lld MB)\n", str, b, rounded_up_division(b, NTFS_MBYTE)); } @@ -806,7 +806,7 @@ void mount_volume() printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); if (ntfs_is_version_supported(vol)) - perr_exit("Unknown NTFS version"); + perr_exit("Unknown NTFS version"); Dprintf("Cluster size : %u\n", vol->cluster_size); print_volume_size("Current volume size", vol, vol->nr_clusters); @@ -817,11 +817,11 @@ void prepare_volume_fixup() { if (!opt.ro_flag) { u16 flags; - + flags = vol->flags | VOLUME_IS_DIRTY; if (vol->major_ver >= 2) flags |= VOLUME_MOUNTED_ON_NT4; - + printf("Schedule chkdsk NTFS consistency check at Windows boot time ...\n"); if (ntfs_set_volume_flags(vol, flags)) perr_exit("Failed to set $Volume dirty"); @@ -841,11 +841,11 @@ int main(int argc, char **argv) int i; parse_options(argc, argv); - + mount_volume(); if (opt.bytes) { - /* Take the integer part: when shrinking we don't want + /* Take the integer part: when shrinking we don't want to make the volume to be bigger than requested. Later on we will also decrease this value to save room for the backup boot sector */ @@ -865,9 +865,9 @@ int main(int argc, char **argv) advise_on_resize(); /* FIXME: check new_volume_size validity */ - - /* Backup boot sector at the end of device isn't counted in NTFS - volume size thus we have to reserve space for. We don't trust + + /* Backup boot sector at the end of device isn't counted in NTFS + volume size thus we have to reserve space for. We don't trust the user does this for us: better to be on the safe side ;) */ if (new_volume_size) --new_volume_size; @@ -896,7 +896,7 @@ int main(int argc, char **argv) truncate_bitmap_file(new_volume_size); update_bootsector(new_volume_size); - /* We don't create backup boot sector because we don't know where the + /* We don't create backup boot sector because we don't know where the partition will be split. The scheduled chkdsk will fix it anyway */ if (opt.ro_flag) { diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index 84c4c96f..c6a0aee2 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -1,6 +1,6 @@ .\" Copyright (c) 2002 Richard Russon. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. -.\" +.\" .TH NTFSUNDELETE 8 "June 2002" "Linux\-NTFS version @VERSION@" .SH NAME ntfsundelete \- recover a deleted file from an NTFS volume. @@ -52,7 +52,7 @@ representing the disk usage is updated. If the power isn't turned off immediately, the free space, where the file used to live, may become overwritten. Worse, the MFT Record may be reused for another file. If this happens it is impossible to tell where the file was on disk. -.PP +.PP Even if all the clusters of a file are not in use, there is no guarantee that they haven't been overwritten by some short\-lived file. .SS Locale @@ -128,7 +128,7 @@ This option controls where to put the output file of the .B \-\-undelete and .B \-\-copy -options. +options. .TP .B \-f .br @@ -329,7 +329,7 @@ was written by Richard Russon (FlatCap) If you find this tool useful, make FlatCap happy and send him an email. .SH AVAILABILITY .B ntfsundelete -is part of the linux\-ntfs package and is available from +is part of the linux\-ntfs package and is available from .br .nh http://linux\-ntfs.sourceforge.net/downloads.html diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index f738f3bf..dda6b12f 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -185,7 +185,7 @@ void usage (void) * If transform fails, @regex will not be changed. * * Return: 1, Success, the string was transformed - * 0, An error occurred + * 0, An error occurred */ int transform (const char *pattern, char **regex) { @@ -260,7 +260,7 @@ int transform (const char *pattern, char **regex) * If parse_time fails, @since will not be changed * * Return: 1 Success - * 0 Error, the string was malformed + * 0 Error, the string was malformed */ int parse_time (const char *value, time_t *since) { @@ -329,7 +329,7 @@ int parse_time (const char *value, time_t *since) * If parse_size fails, @size will not be changed * * Return: 1 Success - * 0 Error, the string was malformed + * 0 Error, the string was malformed */ int parse_size (const char *value, long long *size) { @@ -352,7 +352,7 @@ int parse_size (const char *value, long long *size) return 0; } - + /*if (strlen (suffix) > 1) { Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); return 0; @@ -386,7 +386,7 @@ int parse_size (const char *value, long long *size) * string cannot be parsed correctly, @start and @finish will not be changed. * * Return: 1 Success, a valid string was found - * 0 Error, the string was not a valid range + * 0 Error, the string was not a valid range */ int parse_range (const char *string, long long *start, long long *finish) { @@ -431,7 +431,7 @@ int parse_range (const char *string, long long *start, long long *finish) * This function is very long, but quite simple. * * Return: 1 Success - * 0 Error, one or more problems + * 0 Error, one or more problems */ int parse_options (int argc, char *argv[]) { @@ -728,7 +728,7 @@ time_t ntfs2utc (long long time) * has been created without an inode, it won't overflow the buffer. * * Return: Pointer Success, an attribute was found - * NULL Error, no matching attributes were found + * NULL Error, no matching attributes were found */ ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) { @@ -756,7 +756,7 @@ ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) * the buffer, since we created the search context without an inode. * * Return: Pointer Success, an attribute was found - * NULL Error, no matching attributes were found + * NULL Error, no matching attributes were found */ ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) { @@ -798,7 +798,7 @@ ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) * and its locale friendly name is put in pref_name. * * Return: n The number of $FILENAME attributes found - * -1 Error + * -1 Error */ int get_filenames (struct ufile *file) { @@ -879,7 +879,7 @@ int get_filenames (struct ufile *file) * list of data streams in the file object. * * Return: n The number of $FILENAME attributes found - * -1 Error + * -1 Error */ int get_data (struct ufile *file, ntfs_volume *vol) { @@ -953,7 +953,7 @@ int get_data (struct ufile *file, ntfs_volume *vol) * possible. * * Return: Pointer A ufile object containing the results - * NULL Error + * NULL Error */ struct ufile * read_record (ntfs_volume *vol, long long record) { @@ -998,9 +998,9 @@ struct ufile * read_record (ntfs_volume *vol, long long record) ntfs_attr_close (mft); mft = NULL; - attr10 = find_first_attribute (AT_STANDARD_INFORMATION, file->mft); - attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, file->mft); - attr90 = find_first_attribute (AT_INDEX_ROOT, file->mft); + attr10 = find_first_attribute (AT_STANDARD_INFORMATION, file->mft); + attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, file->mft); + attr90 = find_first_attribute (AT_INDEX_ROOT, file->mft); Dprintf ("Attributes present: %s %s %s\n", attr10?"0x10":"", attr20?"0x20":"", attr90?"0x90":""); @@ -1041,8 +1041,8 @@ struct ufile * read_record (ntfs_volume *vol, long long record) * refreshed. * * Return: 1 Cluster is in use - * 0 Cluster is free space - * -1 Error occurred + * 0 Cluster is free space + * -1 Error occurred */ int cluster_in_use (ntfs_volume *vol, long long lcn) { @@ -1106,7 +1106,7 @@ int cluster_in_use (ntfs_volume *vol, long long lcn) * will return 0%. * * Return: n The percentage of the file that _could_ be recovered - * -1 Error + * -1 Error */ int calc_percentage (struct ufile *file, ntfs_volume *vol) { @@ -1250,12 +1250,12 @@ void dump_record (struct ufile *file) Iprintf ("Filename: (%d) %s\n", f->name_space, f->name); Iprintf ("File Flags: "); - if (f->flags & FILE_ATTR_SYSTEM) Iprintf ("System "); - if (f->flags & FILE_ATTR_DIRECTORY) Iprintf ("Directory "); - if (f->flags & FILE_ATTR_SPARSE_FILE) Iprintf ("Sparse "); - if (f->flags & FILE_ATTR_REPARSE_POINT) Iprintf ("Reparse "); - if (f->flags & FILE_ATTR_COMPRESSED) Iprintf ("Compressed "); - if (f->flags & FILE_ATTR_ENCRYPTED) Iprintf ("Encrypted "); + if (f->flags & FILE_ATTR_SYSTEM) Iprintf ("System "); + if (f->flags & FILE_ATTR_DIRECTORY) Iprintf ("Directory "); + if (f->flags & FILE_ATTR_SPARSE_FILE) Iprintf ("Sparse "); + if (f->flags & FILE_ATTR_REPARSE_POINT) Iprintf ("Reparse "); + if (f->flags & FILE_ATTR_COMPRESSED) Iprintf ("Compressed "); + if (f->flags & FILE_ATTR_ENCRYPTED) Iprintf ("Encrypted "); if (!(f->flags & (FILE_ATTR_SYSTEM || FILE_ATTR_DIRECTORY || FILE_ATTR_SPARSE_FILE || FILE_ATTR_REPARSE_POINT || FILE_ATTR_COMPRESSED || FILE_ATTR_ENCRYPTED))) { @@ -1356,7 +1356,7 @@ void list_record (struct ufile *file) if (!d->name) { if (d->resident) flagr = 'R'; - else flagr = 'N'; + else flagr = 'N'; if (d->compressed) flagc = 'C'; /* These two are mutually exclusive */ if (d->encrypted) flagc = 'E'; @@ -1386,7 +1386,7 @@ void list_record (struct ufile *file) * regular expression, created with regcomp. * * Return: 1 There is a matching filename. - * 0 There is no match. + * 0 There is no match. */ int name_match (regex_t *re, struct ufile *file) { @@ -1424,7 +1424,7 @@ int name_match (regex_t *re, struct ufile *file) * Write a block of data to a file descriptor. * * Return: -1 Error, something went wrong - * 0 Success, all the data was written + * 0 Success, all the data was written */ unsigned int write_data (int fd, const char *buffer, unsigned int bufsize) { @@ -1462,7 +1462,7 @@ unsigned int write_data (int fd, const char *buffer, unsigned int bufsize) * name is present it will be appended to the filename, delimited by a colon. * * Return: -1 Error, failed to create the file - * n Success, this is the file descriptor + * n Success, this is the file descriptor */ int open_file (const char *dir, const char *name, const char *stream) { @@ -1504,7 +1504,7 @@ int open_file (const char *dir, const char *name, const char *stream) * The list can be filtered by name, size and date, using command line options. * * Return: -1 Error, something went wrong - * n Success, the number of recoverable files + * n Success, the number of recoverable files */ int scan_disk (ntfs_volume *vol) { @@ -1627,7 +1627,7 @@ out: * file was deleted. * * Return: 0 Error, something went wrong - * 1 Success, the data was recovered + * 1 Success, the data was recovered */ int undelete_file (ntfs_volume *vol, long long inode) { @@ -1808,14 +1808,14 @@ free: /** * copy_mft - Write a range of MFT Records to a file - * @vol: An ntfs volume obtained from ntfs_mount - * @mft_begin: First MFT Record to save - * @mft_end: Last MFT Record to save + * @vol: An ntfs volume obtained from ntfs_mount + * @mft_begin: First MFT Record to save + * @mft_end: Last MFT Record to save * * Read a number of MFT Records and write them to a file. * * Return: 0 Success, all the records were written - * 1 Error, something went wrong + * 1 Error, something went wrong */ int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) { @@ -1897,14 +1897,14 @@ free: * These checks can be overridden by using the force option. * * Return: 1 Success, we can continue - * 0 Error, we cannot use this device + * 0 Error, we cannot use this device */ int valid_device (const char *name, int force) { unsigned long mnt_flags = 0; struct stat st; - if (stat (name, &st) == -1) { + if (stat (name, &st) == -1) { if (errno == ENOENT) { Eprintf ("The device %s doesn't exist\n", name); } else { @@ -1913,7 +1913,7 @@ int valid_device (const char *name, int force) return 0; } - if (!S_ISBLK (st.st_mode)) { + if (!S_ISBLK (st.st_mode)) { Vprintf ("%s is not a block device.\n", name); if (!force) { Eprintf ("Use the force option to work with files.\n"); @@ -1949,7 +1949,7 @@ int valid_device (const char *name, int force) * Start from here. * * Return: 0 Success, the program worked - * 1 Error, something went wrong + * 1 Error, something went wrong */ int main (int argc, char *argv[]) { diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 120e6e52..f35decdc 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -107,7 +107,7 @@ void Dprintf (const char *format, ...) * Read $Bitmap and wipe any clusters that are marked as not in use. * * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong + * 0 Error, something went wrong */ int wipe_unused (ntfs_volume *vol, int byte) { @@ -127,7 +127,7 @@ int wipe_unused (ntfs_volume *vol, int byte) * the cluster size, there is some slack space at the end. Wipe this space. * * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong + * 0 Error, something went wrong */ int wipe_tails (ntfs_volume *vol, int byte) { @@ -147,7 +147,7 @@ int wipe_tails (ntfs_volume *vol, int byte) * unused space at the end of the record and wipe any unused records. * * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong + * 0 Error, something went wrong */ int wipe_mft (ntfs_volume *vol, int byte) { @@ -167,7 +167,7 @@ int wipe_mft (ntfs_volume *vol, int byte) * the unused space at the ends of these blocks. * * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong + * 0 Error, something went wrong */ int wipe_directory (ntfs_volume *vol, int byte) { @@ -187,7 +187,7 @@ int wipe_directory (ntfs_volume *vol, int byte) * volume is in a consistant state, then this information can be erased. * * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong + * 0 Error, something went wrong */ int wipe_logfile (ntfs_volume *vol, int byte) { @@ -207,7 +207,7 @@ int wipe_logfile (ntfs_volume *vol, int byte) * Windows recreates the file at bootup, so it can be wiped without harm. * * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong + * 0 Error, something went wrong */ int wipe_pagefile (ntfs_volume *vol, int byte) { @@ -224,9 +224,9 @@ int wipe_pagefile (ntfs_volume *vol, int byte) * * Tell the user how much could be cleaned up. List the number of free * clusters, MFT records, etc. - * + * * Return: 1 Success, displayed some info - * 0 Error, something went wrong + * 0 Error, something went wrong */ int ntfs_info (ntfs_volume *vol) { @@ -303,7 +303,7 @@ void usage (void) * N.B. If the function fails, @result is not changed. * * Return: 0 Error, invalid string - * n Success, the count of numbers parsed + * n Success, the count of numbers parsed */ int parse_list (const char *list, int **result) { @@ -363,7 +363,7 @@ int parse_list (const char *list, int **result) * This function is very long, but quite simple. * * Return: 1 Success - * 0 Error, one or more problems + * 0 Error, one or more problems */ int parse_options (int argc, char *argv[]) { @@ -545,14 +545,14 @@ int parse_options (int argc, char *argv[]) * These checks can be overridden by using the force option. * * Return: 1 Success, we can continue - * 0 Error, we cannot use this device + * 0 Error, we cannot use this device */ int valid_device (const char *name, int force) { unsigned long mnt_flags = 0; struct stat st; - if (stat (name, &st) == -1) { + if (stat (name, &st) == -1) { if (errno == ENOENT) { Eprintf ("The device %s doesn't exist\n", name); } else { @@ -561,7 +561,7 @@ int valid_device (const char *name, int force) return 0; } - if (!S_ISBLK (st.st_mode)) { + if (!S_ISBLK (st.st_mode)) { Vprintf ("%s is not a block device.\n", name); if (!force) { Eprintf ("Use the force option to work with files.\n"); @@ -640,7 +640,7 @@ void print_summary (void) * Start from here. * * Return: 0 Success, the program worked - * 1 Error, something went wrong + * 1 Error, something went wrong */ int main (int argc, char *argv[]) { From 69d651cec8a6af5f49d016d4cb988bec4b9169df Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 1 Dec 2002 18:54:13 +0000 Subject: [PATCH 0172/2994] tidy whitespace space tab trailing whitespace lots of spaces BKrev: 3dea5ad5CkWvmkJwAGKVQGYNhTxR0Q From cb5b25e58bfc69b6f20f1f26485ebdbeeed2f709 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 2 Dec 2002 01:57:17 +0000 Subject: [PATCH 0173/2994] (Logical change 1.28) --- include/compat.h | 48 +++++++++++++++++++++++++++++++++++++++ libntfs/compat.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 include/compat.h create mode 100644 libntfs/compat.c diff --git a/include/compat.h b/include/compat.h new file mode 100644 index 00000000..69498954 --- /dev/null +++ b/include/compat.h @@ -0,0 +1,48 @@ +/* + * $Id:$ + * + * compat.h - Tweaks for Windows compatability + * + * Copyright (c) 2002 Richard Russon. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_COMPAT_H +#define _NTFS_COMPAT_H + +#ifdef WINDOWS + +extern int ffs (int i); + +#define HAVE_STDIO_H /* mimic config.h */ +#define HAVE_STDARG_H + +#define atoll _atoi64 +#define fdatasync commit +#define __inline__ inline +#define __attribute__(X) /*nothing*/ + +#else /* !defined WINDOWS */ + +#ifndef O_BINARY +#define O_BINARY 0 /* unix is binary by default */ +#endif + +#endif /* defined WINDOWS */ + +#endif /* defined _NTFS_COMPAT_H */ + diff --git a/libntfs/compat.c b/libntfs/compat.c new file mode 100644 index 00000000..c4d7ae94 --- /dev/null +++ b/libntfs/compat.c @@ -0,0 +1,58 @@ +/* + * $Id$ + * + * compat.c - Tweaks for Windows compatability + * + * Copyright (c) 2002 Richard Russon. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef WINDOWS + +#include "compat.h" + +int ffs (int x) +{ + int r = 1; + + if (!x) + return 0; + if (!(x & 0xffff)) { + x >>= 16; + r += 16; + } + if (!(x & 0xff)) { + x >>= 8; + r += 8; + } + if (!(x & 0xf)) { + x >>= 4; + r += 4; + } + if (!(x & 3)) { + x >>= 2; + r += 2; + } + if (!(x & 1)) { + x >>= 1; + r += 1; + } + return r; +} + +#endif /* WINDOWS */ + From fe0c48299433e52e845e3905f333d433d7c392a6 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 2 Dec 2002 01:57:17 +0000 Subject: [PATCH 0174/2994] A couple more void * arithmetic issues (Logical change 1.28) --- libntfs/attrib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 3007738d..be5c70af 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -654,7 +654,7 @@ res_err_out: } total2 = pos + count - na->initialized_size; count -= total2; - memset(b + count, 0, total2); + memset((u8*)b + count, 0, total2); } /* Find the run list element containing the vcn. */ rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits); @@ -1079,7 +1079,7 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, if (br <= 0) return br; br /= bk_size; - for (end = (u8*)b + br * bk_size; b < end; (u8*)b += bk_size) + for (end = (u8*)b + br * bk_size; (u8*)b < end; (u8*)b += bk_size) ntfs_post_read_mst_fixup((NTFS_RECORD*)b, bk_size); /* Finally, return the number of blocks read. */ return br; From 5fa15e2d7e6b1c980c1ad4f2b79030b35e4835bf Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 2 Dec 2002 01:57:17 +0000 Subject: [PATCH 0175/2994] Added compat.c to the build (Logical change 1.28) --- libntfs/Makefile.am | 11 ++++++----- libntfs/Makefile.in | 15 ++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 9b6ed8bd..4e868109 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -38,17 +38,18 @@ linux_ntfsincludedir = -I$(top_srcdir)/include lib_LTLIBRARIES = libntfs.la libntfs_la_LDFLAGS = -version-info $(LTVERSION) libntfs_la_SOURCES = \ - attrib.c \ - bootsect.c \ + attrib.c \ + bootsect.c \ + compat.c \ debug.c \ dir.c \ - disk_io.c \ + disk_io.c \ inode.c \ - mft.c \ + mft.c \ mst.c \ runlist.c \ unistr.c \ - volume.c + volume.c INCLUDES = $(linux_ntfsincludedir) $(all_includes) diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index a9531dc5..f8886f16 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -122,17 +122,18 @@ linux_ntfsincludedir = -I$(top_srcdir)/include lib_LTLIBRARIES = libntfs.la libntfs_la_LDFLAGS = -version-info $(LTVERSION) libntfs_la_SOURCES = \ - attrib.c \ - bootsect.c \ + attrib.c \ + bootsect.c \ + compat.c \ debug.c \ dir.c \ - disk_io.c \ + disk_io.c \ inode.c \ - mft.c \ + mft.c \ mst.c \ runlist.c \ unistr.c \ - volume.c + volume.c INCLUDES = $(linux_ntfsincludedir) $(all_includes) @@ -145,7 +146,7 @@ LTLIBRARIES = $(lib_LTLIBRARIES) DEFS = @DEFS@ -I. -I$(srcdir) -I.. LIBS = @LIBS@ libntfs_la_LIBADD = -libntfs_la_OBJECTS = attrib.lo bootsect.lo debug.lo dir.lo disk_io.lo \ +libntfs_la_OBJECTS = attrib.lo bootsect.lo compat.lo debug.lo dir.lo disk_io.lo \ inode.lo mft.lo mst.lo runlist.lo unistr.lo volume.lo COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -158,7 +159,7 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = gtar GZIP_ENV = --best -DEP_FILES = .deps/attrib.P .deps/bootsect.P .deps/debug.P .deps/dir.P \ +DEP_FILES = .deps/attrib.P .deps/bootsect.P .deps/compat.P .deps/debug.P .deps/dir.P \ .deps/disk_io.P .deps/inode.P .deps/mft.P .deps/mst.P .deps/runlist.P \ .deps/unistr.P .deps/volume.P SOURCES = $(libntfs_la_SOURCES) From a7b325ee4605a9d9f61838ba264937c875155df6 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 2 Dec 2002 01:57:17 +0000 Subject: [PATCH 0176/2994] Initial revision --- include/compat.h | 48 --------------------------------------- libntfs/compat.c | 58 ------------------------------------------------ 2 files changed, 106 deletions(-) diff --git a/include/compat.h b/include/compat.h index 69498954..e69de29b 100644 --- a/include/compat.h +++ b/include/compat.h @@ -1,48 +0,0 @@ -/* - * $Id:$ - * - * compat.h - Tweaks for Windows compatability - * - * Copyright (c) 2002 Richard Russon. - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_COMPAT_H -#define _NTFS_COMPAT_H - -#ifdef WINDOWS - -extern int ffs (int i); - -#define HAVE_STDIO_H /* mimic config.h */ -#define HAVE_STDARG_H - -#define atoll _atoi64 -#define fdatasync commit -#define __inline__ inline -#define __attribute__(X) /*nothing*/ - -#else /* !defined WINDOWS */ - -#ifndef O_BINARY -#define O_BINARY 0 /* unix is binary by default */ -#endif - -#endif /* defined WINDOWS */ - -#endif /* defined _NTFS_COMPAT_H */ - diff --git a/libntfs/compat.c b/libntfs/compat.c index c4d7ae94..e69de29b 100644 --- a/libntfs/compat.c +++ b/libntfs/compat.c @@ -1,58 +0,0 @@ -/* - * $Id$ - * - * compat.c - Tweaks for Windows compatability - * - * Copyright (c) 2002 Richard Russon. - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef WINDOWS - -#include "compat.h" - -int ffs (int x) -{ - int r = 1; - - if (!x) - return 0; - if (!(x & 0xffff)) { - x >>= 16; - r += 16; - } - if (!(x & 0xff)) { - x >>= 8; - r += 8; - } - if (!(x & 0xf)) { - x >>= 4; - r += 4; - } - if (!(x & 3)) { - x >>= 2; - r += 2; - } - if (!(x & 1)) { - x >>= 1; - r += 1; - } - return r; -} - -#endif /* WINDOWS */ - From 589c9b867817c916d4627bd5515577f6e0841e6c Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 2 Dec 2002 01:57:17 +0000 Subject: [PATCH 0177/2994] minor build fix (Logical change 1.28) --- ntfsprogs/ntfsinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index cf82eacf..723c3722 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1,4 +1,4 @@ -/*z +/* * $Id$ * * ntfsinfo - Part of the Linux-NTFS project. @@ -31,7 +31,7 @@ #include #include #include -#include +#include "types.h" #include "mft.h" #include "attrib.h" #include "layout.h" From 338989eb4d93ec70d49923ddf021bde39c4a1879 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 2 Dec 2002 01:57:17 +0000 Subject: [PATCH 0178/2994] prepared the ground for the windows port BKrev: 3deabdfdznknZ-dKrAIhRhXz9lXC0A From e6d4f5ea4543c772b20cc51f2b79970c859f6fc4 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 5 Dec 2002 14:22:26 +0000 Subject: [PATCH 0179/2994] a few extra comments (Logical change 1.29) --- ntfsprogs/ntfsundelete.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index 21a63d8b..59bd0f34 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -65,10 +65,10 @@ struct filename { long long size_alloc; /* Allocated size (multiple of cluster size) */ long long size_data; /* Actual size of data */ FILE_ATTR_FLAGS flags; - time_t date_c; - time_t date_a; - time_t date_m; - time_t date_r; + time_t date_c; /* Time created */ + time_t date_a; /* altered */ + time_t date_m; /* mft record changed */ + time_t date_r; /* read */ }; struct data { From e6eec7354123ff726720208d06308509862a9677 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 5 Dec 2002 14:22:26 +0000 Subject: [PATCH 0180/2994] caveat: the filesize and date/time might not be what you expected (Logical change 1.29) --- ntfsprogs/ntfsundelete.8.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index c6a0aee2..160afe19 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -73,6 +73,19 @@ with data. .B ntfsundelete cannot recover compressed or encrypted files. When scanning for them, it will display as being 0% recoverable. +.SS The Recovered File's Size and Date +To recover a file +.B ntfsundelete +has to read the file's metadata. Unfortunately, this isn't always intact. +When a file is deleted, the metadata can be left in an inconsistant state. e.g. +the file size may be zero; the dates of the file may be set to the time it was +deleted, or random. +.br +To be safe +.B ntfsundelete +will pick the largest file size it finds and write that to disk. It will also +try and set the file's date to the last modified date. This date may be the +correct last modified date, or something unexpected. .SH OPTIONS Below is a summary of all the options that .B ntfsundelete From 1f7c409ca53d0eeb8acca5a86e394d001f8336f8 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 5 Dec 2002 14:22:26 +0000 Subject: [PATCH 0181/2994] minor undelete updates BKrev: 3def6122IEqtQWR7vReEDrB0yZTkiA From ad73902af11e044f3686c0b50bbffcd78a210867 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 5 Dec 2002 14:22:26 +0000 Subject: [PATCH 0182/2994] set the recover file's date/time 2002/12/05 13:19:04+00:00 flatcap.org!flatcap fixed a very silly buffer error thanks to Martin Pirker (Logical change 1.29) --- ntfsprogs/ntfsundelete.c | 137 +++++++++++++++++++++++++++------------ 1 file changed, 95 insertions(+), 42 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index dda6b12f..d26afc65 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "ntfsundelete.h" #include "bootsect.h" @@ -839,11 +840,6 @@ int get_filenames (struct ufile *file) name->date_m = ntfs2utc (sle64_to_cpu (attr->last_mft_change_time)); name->date_r = ntfs2utc (sle64_to_cpu (attr->last_access_time)); - file->date = max (file->date, name->date_c); - file->date = max (file->date, name->date_a); - file->date = max (file->date, name->date_m); - file->date = max (file->date, name->date_r); - if (ntfs_ucstombs (name->uname, name->uname_len, &name->name, name->uname_len) < 0) { Dprintf ("Couldn't translate filename to current locale.\n"); @@ -1008,7 +1004,7 @@ struct ufile * read_record (ntfs_volume *vol, long long record) { STANDARD_INFORMATION *si; si = (STANDARD_INFORMATION *) ((char *) attr10 + le16_to_cpu (attr10->value_offset)); - file->date = max (file->date, ntfs2utc (sle64_to_cpu (si->last_data_change_time))); + file->date = ntfs2utc (sle64_to_cpu (si->last_data_change_time)); } if (attr20 || !attr10) @@ -1451,48 +1447,98 @@ unsigned int write_data (int fd, const char *buffer, unsigned int bufsize) } /** - * open_file - Create a file based on the dir, name and stream supplied - * @dir: Directory in which to create the file (optional) - * @name: Filename to give the file (optional) - * @stream: Name of the stream (optional) + * create_pathname - Create a path/file from some components + * @dir: Directory in which to create the file (optional) + * @name: Filename to give the file (optional) + * @stream: Name of the stream (optional) + * @buffer: Store the result here + * @bufsize: Size of buffer * - * Create a file and return the file descriptor. All the components are - * optional. If the name is missing, "unknown" will be used. If the directory - * is missing the file will be created in the current directory. If the stream - * name is present it will be appended to the filename, delimited by a colon. + * Create a filename from various pieces. The output will be of the form: + * dir/file + * dir/file:stream + * file + * file:stream * - * Return: -1 Error, failed to create the file - * n Success, this is the file descriptor + * All the components are optional. If the name is missing, "unknown" will be + * used. If the directory is missing the file will be created in the current + * directory. If the stream name is present it will be appended to the + * filename, delimited by a colon. + * + * N.B. If the buffer isn't large enough the name will be truncated. + * + * Return: n Length of the allocated name */ -int open_file (const char *dir, const char *name, const char *stream) +int create_pathname (const char *dir, const char *name, const char *stream, + char *buffer, int bufsize) { - char buf[256]; - int flags; - if (!name) name = UNKNOWN; if (dir) if (stream) - snprintf (buf, sizeof (buf), "%s/%s:%s", dir, name, stream); + snprintf (buffer, bufsize, "%s/%s:%s", dir, name, stream); else - snprintf (buf, sizeof (buf), "%s/%s", dir, name); + snprintf (buffer, bufsize, "%s/%s", dir, name); else if (stream) - snprintf (buf, sizeof (buf), "%s:%s", name, stream); + snprintf (buffer, bufsize, "%s:%s", name, stream); else - snprintf (buf, sizeof (buf), "%s", name); + snprintf (buffer, bufsize, "%s", name); - Vprintf ("Creating file: %s\n", buf); + return strlen (buffer); +} + +/** + * open_file - Open a file to write to + * @pathname: Path, name and stream of the file to open + * + * Create a file and return the file descriptor. + * + * N.B. If option force is given and existing file will be overwritten. + * + * Return: -1 Error, failed to create the file + * n Success, this is the file descriptor + */ +int open_file (const char *pathname) +{ + int flags; + + Vprintf ("Creating file: %s\n", pathname); if (opts.force) flags = O_RDWR | O_CREAT | O_TRUNC; else flags = O_RDWR | O_CREAT | O_EXCL; - return open (buf, flags, S_IRUSR | S_IWUSR); + return open (pathname, flags, S_IRUSR | S_IWUSR); } +/** + * set_date - Set the file's date and time + * @pathname: Path and name of the file to alter + * @date: Date and time to set + * + * Give a file a particular date and time. + * + * Return: 1 Success, set the file's date and time + * 0 Error, failed to change the file's date and time + */ +int set_date (const char *pathname, time_t date) +{ + struct utimbuf ut; + + if (!pathname) + return 0; + + ut.actime = date; + ut.modtime = date; + if (utime (pathname, &ut)) { + Eprintf ("Couldn't set the file's date and time\n"); + return 0; + } + return 1; +} /** * scan_disk - Search an NTFS volume for files that could be undeleted @@ -1631,7 +1677,9 @@ out: */ int undelete_file (ntfs_volume *vol, long long inode) { + char pathname[256]; char *buffer = NULL; + unsigned int bufsize; struct ufile *file; int i, j; long long start, end; @@ -1650,7 +1698,8 @@ int undelete_file (ntfs_volume *vol, long long inode) return 0; } - buffer = malloc (vol->mft_record_size); + bufsize = vol->cluster_size; + buffer = malloc (bufsize); if (!buffer) goto free; @@ -1685,8 +1734,9 @@ int undelete_file (ntfs_volume *vol, long long inode) list_for_each (item, &file->data) { struct data *d = list_entry (item, struct data, list); + create_pathname (opts.dest, file->pref_name, d->name, pathname, sizeof (pathname)); if (d->resident) { - fd = open_file (opts.dest, file->pref_name, d->name); + fd = open_file (pathname); if (fd < 0) { Eprintf ("Couldn't create file: %s\n", strerror (errno)); goto free; @@ -1715,7 +1765,7 @@ int undelete_file (ntfs_volume *vol, long long inode) continue; } - fd = open_file (opts.dest, file->pref_name, d->name); + fd = open_file (pathname); if (fd < 0) { Eprintf ("Couldn't create output file: %s\n", strerror (errno)); goto free; @@ -1723,9 +1773,9 @@ int undelete_file (ntfs_volume *vol, long long inode) if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ Vprintf ("Missing segment at beginning, %lld clusters.\n", rl[0].length); - memset (buffer, opts.fillbyte, sizeof (buffer)); - for (k = 0; k < rl[0].length * vol->cluster_size; k += sizeof (buffer)) { - if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + memset (buffer, opts.fillbyte, bufsize); + for (k = 0; k < rl[0].length * vol->cluster_size; k += bufsize) { + if (write_data (fd, buffer, bufsize) < bufsize) { Eprintf ("Write failed: %s\n", strerror (errno)); close (fd); goto free; @@ -1737,9 +1787,9 @@ int undelete_file (ntfs_volume *vol, long long inode) if (rl[i].lcn == LCN_RL_NOT_MAPPED) { Vprintf ("Missing segment at end, %lld clusters.\n", rl[i].length); - memset (buffer, opts.fillbyte, sizeof (buffer)); - for (k = 0; k < rl[k].length * vol->cluster_size; k += sizeof (buffer)) { - if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + memset (buffer, opts.fillbyte, bufsize); + for (k = 0; k < rl[k].length * vol->cluster_size; k += bufsize) { + if (write_data (fd, buffer, bufsize) < bufsize) { Eprintf ("Write failed: %s\n", strerror (errno)); close (fd); goto free; @@ -1750,9 +1800,9 @@ int undelete_file (ntfs_volume *vol, long long inode) if (rl[i].lcn == LCN_HOLE) { Vprintf ("File has a sparse section.\n"); - memset (buffer, 0, sizeof (buffer)); - for (k = 0; k < rl[k].length * vol->cluster_size; k += sizeof (buffer)) { - if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + memset (buffer, 0, bufsize); + for (k = 0; k < rl[k].length * vol->cluster_size; k += bufsize) { + if (write_data (fd, buffer, bufsize) < bufsize) { Eprintf ("Write failed: %s\n", strerror (errno)); close (fd); goto free; @@ -1766,8 +1816,8 @@ int undelete_file (ntfs_volume *vol, long long inode) for (j = start; j < end; j++) { if (cluster_in_use (vol, j)) { - memset (buffer, opts.fillbyte, sizeof (buffer)); - if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + memset (buffer, opts.fillbyte, bufsize); + if (write_data (fd, buffer, bufsize) < bufsize) { Eprintf ("Write failed: %s\n", strerror (errno)); close (fd); goto free; @@ -1778,7 +1828,7 @@ int undelete_file (ntfs_volume *vol, long long inode) close (fd); goto free; } - if (write_data (fd, buffer, sizeof (buffer)) < sizeof (buffer)) { + if (write_data (fd, buffer, bufsize) < bufsize) { Eprintf ("Write failed: %s\n", strerror (errno)); close (fd); goto free; @@ -1793,6 +1843,7 @@ int undelete_file (ntfs_volume *vol, long long inode) fd = -1; } + set_date (pathname, file->date); if (d->name) Iprintf ("Undeleted '%s:%s' successfully.\n", file->pref_name, d->name); else @@ -1819,6 +1870,7 @@ free: */ int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) { + char pathname[256]; ntfs_attr *mft; char *buffer; const char *name; @@ -1852,7 +1904,8 @@ int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) Dprintf ("No output filename, defaulting to '%s'.\n", name); } - fd = open_file (opts.dest, name, NULL); + create_pathname (opts.dest, name, NULL, pathname, sizeof (pathname)); + fd = open_file (pathname); if (fd < 0) { Eprintf ("Couldn't open output file '%s': %s\n", name, strerror (errno)); goto attr; From 1dc06ead4495be4c3cad50ba1077deaa64d3f20e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 8 Dec 2002 20:33:08 +0000 Subject: [PATCH 0183/2994] rename run{ ,_,-}list to runlist (Logical change 1.30) --- libntfs/runlist.c | 348 +++++++++++++++++++++++----------------------- 1 file changed, 174 insertions(+), 174 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 22975e3b..dd2bd15b 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -37,9 +37,9 @@ /** * Internal: * - * ntfs_rl_mm - run_list memmove + * ntfs_rl_mm - runlist memmove */ -static __inline__ void ntfs_rl_mm(run_list_element *base, int dst, int src, +static __inline__ void ntfs_rl_mm(runlist_element *base, int dst, int src, int size) { if ((dst != src) && (size > 0)) @@ -49,10 +49,10 @@ static __inline__ void ntfs_rl_mm(run_list_element *base, int dst, int src, /** * Internal: * - * rl_mc - run_list memory copy + * rl_mc - runlist memory copy */ -static __inline__ void ntfs_rl_mc(run_list_element *dstbase, int dst, - run_list_element *srcbase, int src, int size) +static __inline__ void ntfs_rl_mc(runlist_element *dstbase, int dst, + runlist_element *srcbase, int src, int size) { if (size > 0) memcpy(dstbase + dst, srcbase + src, size * sizeof(*dstbase)); @@ -61,12 +61,12 @@ static __inline__ void ntfs_rl_mc(run_list_element *dstbase, int dst, /** * Internal: * - * ntfs_rl_realloc - Reallocate memory for run_lists* - * @rl: original run list - * @old_size: number of run list elements in the original run list @rl - * @new_size: number of run list elements we need space for + * ntfs_rl_realloc - Reallocate memory for runlists* + * @rl: original runlist + * @old_size: number of runlist elements in the original runlist @rl + * @new_size: number of runlist elements we need space for * - * As the run lists grow, more memory will be required. To prevent large + * As the runlists grow, more memory will be required. To prevent large * numbers of small reallocations of memory, this function returns a 4kiB block * of memory. * @@ -76,11 +76,11 @@ static __inline__ void ntfs_rl_mc(run_list_element *dstbase, int dst, * On success, return a pointer to the newly allocated, or recycled, memory. * On error, return NULL with errno set to the error code. */ -static __inline__ run_list_element *ntfs_rl_realloc(run_list_element *rl, +static __inline__ runlist_element *ntfs_rl_realloc(runlist_element *rl, int old_size, int new_size) { - old_size = (old_size * sizeof(run_list_element) + 0xfff) & ~0xfff; - new_size = (new_size * sizeof(run_list_element) + 0xfff) & ~0xfff; + old_size = (old_size * sizeof(runlist_element) + 0xfff) & ~0xfff; + new_size = (new_size * sizeof(runlist_element) + 0xfff) & ~0xfff; if (old_size == new_size) return rl; return realloc(rl, new_size); @@ -89,18 +89,18 @@ static __inline__ run_list_element *ntfs_rl_realloc(run_list_element *rl, /** * Internal: * - * ntfs_are_rl_mergeable - test if two run lists can be joined together - * @dst: original run list - * @src: new run list to test for mergeability with @dst + * ntfs_are_rl_mergeable - test if two runlists can be joined together + * @dst: original runlist + * @src: new runlist to test for mergeability with @dst * - * Test if two run lists can be joined together. For this, their VCNs and LCNs + * Test if two runlists can be joined together. For this, their VCNs and LCNs * must be adjacent. * - * Return: TRUE Success, the run lists can be merged. - * FALSE Failure, the run lists cannot be merged. + * Return: TRUE Success, the runlists can be merged. + * FALSE Failure, the runlists cannot be merged. */ -static __inline__ BOOL ntfs_are_rl_mergeable(run_list_element *dst, - run_list_element *src) +static __inline__ BOOL ntfs_are_rl_mergeable(runlist_element *dst, + runlist_element *src) { if (!dst || !src) { Dputs("Eeek. ntfs_are_rl_mergeable() invoked with NULL " @@ -121,16 +121,16 @@ static __inline__ BOOL ntfs_are_rl_mergeable(run_list_element *dst, /** * Internal: * - * __ntfs_rl_merge - merge two run lists without testing if they can be merged - * @dst: original, destination run list - * @src: new run list to merge with @dst + * __ntfs_rl_merge - merge two runlists without testing if they can be merged + * @dst: original, destination runlist + * @src: new runlist to merge with @dst * - * Merge the two run lists, writing into the destination run list @dst. The - * caller must make sure the run lists can be merged or this will corrupt the - * destination run list. + * Merge the two runlists, writing into the destination runlist @dst. The + * caller must make sure the runlists can be merged or this will corrupt the + * destination runlist. */ -static __inline__ void __ntfs_rl_merge(run_list_element *dst, - run_list_element *src) +static __inline__ void __ntfs_rl_merge(runlist_element *dst, + runlist_element *src) { dst->length += src->length; } @@ -138,20 +138,20 @@ static __inline__ void __ntfs_rl_merge(run_list_element *dst, /** * Internal: * - * ntfs_rl_merge - test if two run lists can be joined together and merge them - * @dst: original, destination run list - * @src: new run list to merge with @dst + * ntfs_rl_merge - test if two runlists can be joined together and merge them + * @dst: original, destination runlist + * @src: new runlist to merge with @dst * - * Test if two run lists can be joined together. For this, their VCNs and LCNs + * Test if two runlists can be joined together. For this, their VCNs and LCNs * must be adjacent. If they can be merged, perform the merge, writing into - * the destination run list @dst. + * the destination runlist @dst. * - * Return: TRUE Success, the run lists have been merged. - * FALSE Failure, the run lists cannot be merged and have not been + * Return: TRUE Success, the runlists have been merged. + * FALSE Failure, the runlists cannot be merged and have not been * modified. */ -static __inline__ BOOL ntfs_rl_merge(run_list_element *dst, - run_list_element *src) +static __inline__ BOOL ntfs_rl_merge(runlist_element *dst, + runlist_element *src) { BOOL merge = ntfs_are_rl_mergeable(dst, src); @@ -163,27 +163,27 @@ static __inline__ BOOL ntfs_rl_merge(run_list_element *dst, /** * Internal: * - * ntfs_rl_append - append a run list after a given element - * @dst: original run list to be worked on + * ntfs_rl_append - append a runlist after a given element + * @dst: original runlist to be worked on * @dsize: number of elements in @dst (including end marker) - * @src: run list to be inserted into @dst + * @src: runlist to be inserted into @dst * @ssize: number of elements in @src (excluding end marker) - * @loc: append the new run list @src after this element in @dst + * @loc: append the new runlist @src after this element in @dst * - * Append the run list @src after element @loc in @dst. Merge the right end of - * the new run list, if necessary. Adjust the size of the hole before the - * appended run list. + * Append the runlist @src after element @loc in @dst. Merge the right end of + * the new runlist, if necessary. Adjust the size of the hole before the + * appended runlist. * - * On success, return a pointer to the new, combined, run list. Note, both - * run lists @dst and @src are deallocated before returning so you cannot use - * the pointers for anything any more. (Strictly speaking the returned run list + * On success, return a pointer to the new, combined, runlist. Note, both + * runlists @dst and @src are deallocated before returning so you cannot use + * the pointers for anything any more. (Strictly speaking the returned runlist * may be the same as @dst but this is irrelevant.) * - * On error, return NULL, with errno set to the error code. Both run lists are + * On error, return NULL, with errno set to the error code. Both runlists are * left unmodified. */ -static __inline__ run_list_element *ntfs_rl_append(run_list_element *dst, - int dsize, run_list_element *src, int ssize, int loc) +static __inline__ runlist_element *ntfs_rl_append(runlist_element *dst, + int dsize, runlist_element *src, int ssize, int loc) { BOOL right; int magic; @@ -203,7 +203,7 @@ static __inline__ run_list_element *ntfs_rl_append(run_list_element *dst, return dst; /* * We are guaranteed to succeed from here so can start modifying the - * original run lists. + * original runlists. */ /* First, merge the right hand end, if necessary. */ @@ -230,27 +230,27 @@ static __inline__ run_list_element *ntfs_rl_append(run_list_element *dst, /** * Internal: * - * ntfs_rl_insert - insert a run list into another - * @dst: original run list to be worked on + * ntfs_rl_insert - insert a runlist into another + * @dst: original runlist to be worked on * @dsize: number of elements in @dst (including end marker) - * @src: new run list to be inserted + * @src: new runlist to be inserted * @ssize: number of elements in @src (excluding end marker) - * @loc: insert the new run list @src before this element in @dst + * @loc: insert the new runlist @src before this element in @dst * - * Insert the run list @src before element @loc in the run list @dst. Merge the - * left end of the new run list, if necessary. Adjust the size of the hole - * after the inserted run list. + * Insert the runlist @src before element @loc in the runlist @dst. Merge the + * left end of the new runlist, if necessary. Adjust the size of the hole + * after the inserted runlist. * - * On success, return a pointer to the new, combined, run list. Note, both - * run lists @dst and @src are deallocated before returning so you cannot use - * the pointers for anything any more. (Strictly speaking the returned run list + * On success, return a pointer to the new, combined, runlist. Note, both + * runlists @dst and @src are deallocated before returning so you cannot use + * the pointers for anything any more. (Strictly speaking the returned runlist * may be the same as @dst but this is irrelevant.) * - * On error, return NULL, with errno set to the error code. Both run lists are + * On error, return NULL, with errno set to the error code. Both runlists are * left unmodified. */ -static __inline__ run_list_element *ntfs_rl_insert(run_list_element *dst, - int dsize, run_list_element *src, int ssize, int loc) +static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, + int dsize, runlist_element *src, int ssize, int loc) { BOOL left = FALSE; BOOL disc = FALSE; /* Discontinuity */ @@ -290,7 +290,7 @@ static __inline__ run_list_element *ntfs_rl_insert(run_list_element *dst, return dst; /* * We are guaranteed to succeed from here so can start modifying the - * original run list. + * original runlist. */ if (left) @@ -339,26 +339,26 @@ static __inline__ run_list_element *ntfs_rl_insert(run_list_element *dst, /** * Internal: * - * ntfs_rl_replace - overwrite a run_list element with another run list - * @dst: original run list to be worked on + * ntfs_rl_replace - overwrite a runlist element with another runlist + * @dst: original runlist to be worked on * @dsize: number of elements in @dst (including end marker) - * @src: new run list to be inserted + * @src: new runlist to be inserted * @ssize: number of elements in @src (excluding end marker) - * @loc: index in run list @dst to overwrite with @src + * @loc: index in runlist @dst to overwrite with @src * - * Replace the run list element @dst at @loc with @src. Merge the left and - * right ends of the inserted run list, if necessary. + * Replace the runlist element @dst at @loc with @src. Merge the left and + * right ends of the inserted runlist, if necessary. * - * On success, return a pointer to the new, combined, run list. Note, both - * run lists @dst and @src are deallocated before returning so you cannot use - * the pointers for anything any more. (Strictly speaking the returned run list + * On success, return a pointer to the new, combined, runlist. Note, both + * runlists @dst and @src are deallocated before returning so you cannot use + * the pointers for anything any more. (Strictly speaking the returned runlist * may be the same as @dst but this is irrelevant.) * - * On error, return NULL, with errno set to the error code. Both run lists are + * On error, return NULL, with errno set to the error code. Both runlists are * left unmodified. */ -static __inline__ run_list_element *ntfs_rl_replace(run_list_element *dst, - int dsize, run_list_element *src, int ssize, int loc) +static __inline__ runlist_element *ntfs_rl_replace(runlist_element *dst, + int dsize, runlist_element *src, int ssize, int loc) { BOOL left = FALSE; BOOL right; @@ -382,7 +382,7 @@ static __inline__ run_list_element *ntfs_rl_replace(run_list_element *dst, return dst; /* * We are guaranteed to succeed from here so can start modifying the - * original run lists. + * original runlists. */ if (right) __ntfs_rl_merge(src + ssize - 1, dst + loc + 1); @@ -405,27 +405,27 @@ static __inline__ run_list_element *ntfs_rl_replace(run_list_element *dst, /** * Internal: * - * ntfs_rl_split - insert a run list into the centre of a hole - * @dst: original run list to be worked on + * ntfs_rl_split - insert a runlist into the centre of a hole + * @dst: original runlist to be worked on * @dsize: number of elements in @dst (including end marker) - * @src: new run list to be inserted + * @src: new runlist to be inserted * @ssize: number of elements in @src (excluding end marker) - * @loc: index in run list @dst at which to split and insert @src + * @loc: index in runlist @dst at which to split and insert @src * - * Split the run list @dst at @loc into two and insert @new in between the two - * fragments. No merging of run lists is necessary. Adjust the size of the + * Split the runlist @dst at @loc into two and insert @new in between the two + * fragments. No merging of runlists is necessary. Adjust the size of the * holes either side. * - * On success, return a pointer to the new, combined, run list. Note, both - * run lists @dst and @src are deallocated before returning so you cannot use - * the pointers for anything any more. (Strictly speaking the returned run list + * On success, return a pointer to the new, combined, runlist. Note, both + * runlists @dst and @src are deallocated before returning so you cannot use + * the pointers for anything any more. (Strictly speaking the returned runlist * may be the same as @dst but this is irrelevant.) * - * On error, return NULL, with errno set to the error code. Both run lists are + * On error, return NULL, with errno set to the error code. Both runlists are * left unmodified. */ -static __inline__ run_list_element *ntfs_rl_split(run_list_element *dst, - int dsize, run_list_element *src, int ssize, int loc) +static __inline__ runlist_element *ntfs_rl_split(runlist_element *dst, + int dsize, runlist_element *src, int ssize, int loc) { if (!dst || !src) { Dputs("Eeek. ntfs_rl_split() invoked with NULL pointer!"); @@ -439,7 +439,7 @@ static __inline__ run_list_element *ntfs_rl_split(run_list_element *dst, return dst; /* * We are guaranteed to succeed from here so can start modifying the - * original run lists. + * original runlists. */ /* Move the tail of @dst out of the way, then copy in @src. */ @@ -456,15 +456,15 @@ static __inline__ run_list_element *ntfs_rl_split(run_list_element *dst, /** - * ntfs_merge_run_lists - merge two run lists into one - * @drl: original run list to be worked on - * @srl: new run list to be merged into @drl + * ntfs_merge_runlists - merge two runlists into one + * @drl: original runlist to be worked on + * @srl: new runlist to be merged into @drl * - * First we sanity check the two run lists @srl and @drl to make sure that they - * are sensible and can be merged. The run list @srl must be either after the - * run list @drl or completely within a hole (or unmapped region) in @drl. + * First we sanity check the two runlists @srl and @drl to make sure that they + * are sensible and can be merged. The runlist @srl must be either after the + * runlist @drl or completely within a hole (or unmapped region) in @drl. * - * Merging of run lists is necessary in two cases: + * Merging of runlists is necessary in two cases: * 1. When attribute lists are used and a further extent is being mapped. * 2. When new clusters are allocated to fill a hole or extend a file. * @@ -473,22 +473,22 @@ static __inline__ run_list_element *ntfs_rl_split(run_list_element *dst, * - split the hole in two and be inserted between the two fragments, * - be appended at the end of a hole, or it can * - replace the whole hole. - * It can also be appended to the end of the run list, which is just a variant + * It can also be appended to the end of the runlist, which is just a variant * of the insert case. * - * On success, return a pointer to the new, combined, run list. Note, both - * run lists @drl and @srl are deallocated before returning so you cannot use - * the pointers for anything any more. (Strictly speaking the returned run list + * On success, return a pointer to the new, combined, runlist. Note, both + * runlists @drl and @srl are deallocated before returning so you cannot use + * the pointers for anything any more. (Strictly speaking the returned runlist * may be the same as @dst but this is irrelevant.) * - * On error, return NULL, with errno set to the error code. Both run lists are + * On error, return NULL, with errno set to the error code. Both runlists are * left unmodified. The following error codes are defined: - * ENOMEM Not enough memory to allocate run list array. + * ENOMEM Not enough memory to allocate runlist array. * EINVAL Invalid parameters were passed in. - * ERANGE The run lists overlap and cannot be merged. + * ERANGE The runlists overlap and cannot be merged. */ -run_list_element *ntfs_merge_run_lists(run_list_element *drl, - run_list_element *srl) +runlist_element *ntfs_merge_runlists(runlist_element *drl, + runlist_element *srl) { int di, si; /* Current index into @[ds]rl. */ int sstart; /* First index with lcn > LCN_RL_NOT_MAPPED. */ @@ -500,9 +500,9 @@ run_list_element *ntfs_merge_run_lists(run_list_element *drl, VCN marker_vcn = 0; Dputs("dst:"); - ntfs_debug_dump_run_list(drl); + ntfs_debug_dump_runlist(drl); Dputs("src:"); - ntfs_debug_dump_run_list(srl); + ntfs_debug_dump_runlist(srl); /* Check for silly calling... */ if (!srl) @@ -511,15 +511,15 @@ run_list_element *ntfs_merge_run_lists(run_list_element *drl, /* Check for the case where the first mapping is being done now. */ if (!drl) { drl = srl; - /* Complete the source run list if necessary. */ + /* Complete the source runlist if necessary. */ if (drl[0].vcn) { - /* Scan to the end of the source run list. */ + /* Scan to the end of the source runlist. */ for (dend = 0; drl[dend].length; dend++) ; drl = ntfs_rl_realloc(drl, dend, dend + 1); if (!drl) return drl; - /* Insert start element at the front of the run list. */ + /* Insert start element at the front of the runlist. */ ntfs_rl_mm(drl, 1, 0, dend); drl[0].vcn = 0; drl[0].lcn = LCN_RL_NOT_MAPPED; @@ -530,14 +530,14 @@ run_list_element *ntfs_merge_run_lists(run_list_element *drl, si = di = 0; - /* Skip any unmapped start element(s) in the source run list. */ + /* Skip any unmapped start element(s) in the source runlist. */ while (srl[si].length && srl[si].lcn < (LCN)LCN_HOLE) si++; - /* Can't have an entirely unmapped source run list. */ + /* Can't have an entirely unmapped source runlist. */ if (!srl[si].length) { - Dputs("Eeek! ntfs_merge_run_lists() received entirely " - "unmapped source run list."); + Dputs("Eeek! ntfs_merge_runlists() received entirely " + "unmapped source runlist."); errno = EINVAL; return NULL; } @@ -564,7 +564,7 @@ run_list_element *ntfs_merge_run_lists(run_list_element *drl, return NULL; } - /* Scan to the end of both run lists in order to know their sizes. */ + /* Scan to the end of both runlists in order to know their sizes. */ for (send = si; srl[send].length; send++) ; for (dend = di; drl[dend].length; dend++) @@ -635,7 +635,7 @@ run_list_element *ntfs_merge_run_lists(run_list_element *drl, goto finished; } /* - * We need to create an unmapped run list element in + * We need to create an unmapped runlist element in * @drl or extend an existing one before adding the * ENOENT terminator. */ @@ -644,7 +644,7 @@ run_list_element *ntfs_merge_run_lists(run_list_element *drl, slots = 1; } if (drl[ds].lcn != (LCN)LCN_RL_NOT_MAPPED) { - /* Add an unmapped run list element. */ + /* Add an unmapped runlist element. */ if (!slots) { /* FIXME/TODO: We need to have the * extra memory already! (AIA) */ @@ -681,57 +681,57 @@ run_list_element *ntfs_merge_run_lists(run_list_element *drl, finished: /* The merge was completed successfully. */ - Dputs("Merged run list:"); - ntfs_debug_dump_run_list(drl); + Dputs("Merged runlist:"); + ntfs_debug_dump_runlist(drl); return drl; critical_error: /* Critical error! We cannot afford to fail here. */ Dperror("libntfs: Critical error"); Dputs("Forcing segmentation fault!"); - marker_vcn = ((run_list*)NULL)->lcn; + marker_vcn = ((runlist*)NULL)->lcn; return drl; } /** - * ntfs_decompress_mapping_pairs - convert mapping pairs array to run list + * ntfs_decompress_mapping_pairs - convert mapping pairs array to runlist * @vol: ntfs volume on which the attribute resides * @attr: attribute record whose mapping pairs array to decompress - * @old_rl: optional run list in which to insert @attr's run list + * @old_rl: optional runlist in which to insert @attr's runlist * - * Decompress the attribute @attr's mapping pairs array into a run list. On - * success, return the decompressed run list. + * Decompress the attribute @attr's mapping pairs array into a runlist. On + * success, return the decompressed runlist. * - * If @old_rl is not NULL, decompressed run list is inserted into the - * appropriate place in @old_rl and the resultant, combined run list is + * If @old_rl is not NULL, decompressed runlist is inserted into the + * appropriate place in @old_rl and the resultant, combined runlist is * returned. The original @old_rl is deallocated. * * On error, return NULL with errno set to the error code. @old_rl is left * unmodified in that case. * * The following error codes are defined: - * ENOMEM Not enough memory to allocate run list array. - * EIO Corrupt run list. + * ENOMEM Not enough memory to allocate runlist array. + * EIO Corrupt runlist. * EINVAL Invalid parameters were passed in. - * ERANGE The two run lists overlap. + * ERANGE The two runlists overlap. * * FIXME: For now we take the conceptionally simplest approach of creating the - * new run list disregarding the already existing one and then splicing the + * new runlist disregarding the already existing one and then splicing the * two into one, if that is possible (we check for overlap and discard the new - * run list if overlap present before returning NULL, with errno = ERANGE). + * runlist if overlap present before returning NULL, with errno = ERANGE). */ -run_list_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, - const ATTR_RECORD *attr, run_list_element *old_rl) +runlist_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, + const ATTR_RECORD *attr, runlist_element *old_rl) { VCN vcn; /* Current vcn. */ LCN lcn; /* Current lcn. */ s64 deltaxcn; /* Change in [vl]cn. */ - run_list_element *rl; /* The output run list. */ + runlist_element *rl; /* The output runlist. */ u8 *buf; /* Current position in mapping pairs array. */ u8 *attr_end; /* End of attribute. */ - int rlsize; /* Size of run list buffer. */ - u16 rlpos; /* Current run list position in units of - run_list_elements. */ + int rlsize; /* Size of runlist buffer. */ + u16 rlpos; /* Current runlist position in units of + runlist_elements. */ u8 b; /* Current byte offset in buf. */ Dprintf("%s(): Entering for attr 0x%x.\n", __FUNCTION__, @@ -753,9 +753,9 @@ run_list_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, errno = EIO; return NULL; } - /* Current position in run list array. */ + /* Current position in runlist array. */ rlpos = 0; - /* Allocate first 4kiB block and set current run list size to 4kiB. */ + /* Allocate first 4kiB block and set current runlist size to 4kiB. */ rl = malloc(rlsize = 0x1000); if (!rl) return NULL; @@ -772,7 +772,7 @@ run_list_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, * not-mapped and terminator elements. */ if (((rlpos + 3) * sizeof(*old_rl)) > rlsize) { - run_list_element *rl2; + runlist_element *rl2; rlsize += 0x1000; rl2 = realloc(rl, rlsize); @@ -784,7 +784,7 @@ run_list_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, } rl = rl2; } - /* Enter the current vcn into the current run_list element. */ + /* Enter the current vcn into the current runlist element. */ rl[rlpos].vcn = vcn; /* * Get the change in vcn, i.e. the run length in clusters. @@ -812,7 +812,7 @@ run_list_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, goto err_out; } /* - * Enter the current run length into the current run list + * Enter the current run length into the current runlist * element. */ rl[rlpos].length = deltaxcn; @@ -856,10 +856,10 @@ run_list_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, "array."); goto err_out; } - /* Enter the current lcn into the run list element. */ + /* Enter the current lcn into the runlist element. */ rl[rlpos].lcn = lcn; } - /* Get to the next run list element. */ + /* Get to the next runlist element. */ rlpos++; /* Increment the buffer position to the next mapping pair. */ buf += (*buf & 0xf) + ((*buf >> 4) & 0xf) + 1; @@ -868,7 +868,7 @@ run_list_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, goto io_error; /* * If there is a highest_vcn specified, it must be equal to the final - * vcn in the run list - 1, or something has gone badly wrong. + * vcn in the runlist - 1, or something has gone badly wrong. */ deltaxcn = sle64_to_cpu(attr->highest_vcn); if (deltaxcn && vcn - 1 != deltaxcn) { @@ -876,7 +876,7 @@ mpa_err: Dputs("Corrupt mapping pairs array in non-resident attribute."); goto err_out; } - /* Setup not mapped run list element if this is the base extent. */ + /* Setup not mapped runlist element if this is the base extent. */ if (!attr->lowest_vcn) { VCN max_cluster; @@ -885,7 +885,7 @@ mpa_err: vol->cluster_size_bits; /* * If there is a difference between the highest_vcn and the - * highest cluster, the run list is either corrupt or, more + * highest cluster, the runlist is either corrupt or, more * likely, there are more extents following this one. */ if (deltaxcn < --max_cluster) { @@ -908,21 +908,21 @@ mpa_err: } else /* Not the base extent. There may be more extents to follow. */ rl[rlpos].lcn = (LCN)LCN_RL_NOT_MAPPED; - /* Setup terminating run_list element. */ + /* Setup terminating runlist element. */ rl[rlpos].vcn = vcn; rl[rlpos].length = (s64)0; - /* If no existing run list was specified, we are done. */ + /* If no existing runlist was specified, we are done. */ if (!old_rl) { Dputs("Mapping pairs array successfully decompressed:"); - ntfs_debug_dump_run_list(rl); + ntfs_debug_dump_runlist(rl); return rl; } - /* Now combine the new and old run lists checking for overlaps. */ - old_rl = ntfs_merge_run_lists(old_rl, rl); + /* Now combine the new and old runlists checking for overlaps. */ + old_rl = ntfs_merge_runlists(old_rl, rl); if (old_rl) return old_rl; free(rl); - Dputs("Failed to merge run lists."); + Dputs("Failed to merge runlists."); return NULL; io_error: Dputs("Corrupt attribute."); @@ -933,12 +933,12 @@ err_out: } /** - * ntfs_rl_vcn_to_lcn - convert a vcn into a lcn given a run list - * @rl: run list to use for conversion + * ntfs_rl_vcn_to_lcn - convert a vcn into a lcn given a runlist + * @rl: runlist to use for conversion * @vcn: vcn to convert * * Convert the virtual cluster number @vcn of an attribute into a logical - * cluster number (lcn) of a device using the run list @rl to map vcns to their + * cluster number (lcn) of a device using the runlist @rl to map vcns to their * corresponding lcns. * * Since lcns must be >= 0, we use negative return values with special meaning: @@ -946,19 +946,19 @@ err_out: * Return value Meaning / Description * ================================================== * -1 = LCN_HOLE Hole / not allocated on disk. - * -2 = LCN_RL_NOT_MAPPED This is part of the run list which has not been - * inserted into the run list yet. + * -2 = LCN_RL_NOT_MAPPED This is part of the runlist which has not been + * inserted into the runlist yet. * -3 = LCN_ENOENT There is no such vcn in the attribute. * -4 = LCN_EINVAL Input parameter error. */ -LCN ntfs_rl_vcn_to_lcn(const run_list_element *rl, const VCN vcn) +LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn) { int i; if (vcn < (VCN)0) return (LCN)LCN_EINVAL; /* - * If rl is NULL, assume that we have found an unmapped run list. The + * If rl is NULL, assume that we have found an unmapped runlist. The * caller can then attempt to map it and fail appropriately if * necessary. */ @@ -989,14 +989,14 @@ LCN ntfs_rl_vcn_to_lcn(const run_list_element *rl, const VCN vcn) /** * ntfs_rl_pwrite - scatter write to disk * @vol: ntfs volume to write to - * @rl: run list specifying where to write the data to - * @pos: byte position within run list @rl at which to begin the write + * @rl: runlist specifying where to write the data to + * @pos: byte position within runlist @rl at which to begin the write * @count: number of bytes to write * @b: data buffer to write to disk * * This function will write @count bytes from data buffer @b to the volume @vol - * scattering the data as specified by the run list @rl. The write begins at - * offset @pos into the run list @rl. + * scattering the data as specified by the runlist @rl. The write begins at + * offset @pos into the runlist @rl. * * On success, return the number of successfully written bytes. If this number * is lower than @count this means that the write has been interrupted in @@ -1007,7 +1007,7 @@ LCN ntfs_rl_vcn_to_lcn(const run_list_element *rl, const VCN vcn) * appropriately to the return code of either lseek, write, fdatasync, or set * to EINVAL in case of invalid arguments. */ -s64 ntfs_rl_pwrite(const ntfs_volume *vol, const run_list_element *rl, +s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, const s64 pos, s64 count, void *b) { s64 written, to_write, ofs, total; @@ -1100,25 +1100,25 @@ rl_err_out: } /** - * ntfs_build_mapping_pairs - build the mapping pairs array from a run list + * ntfs_build_mapping_pairs - build the mapping pairs array from a runlist * @vol: ntfs volume (needed for the ntfs version) * @dst: destination buffer to which to write the mapping pairs array * @dst_len: size of destination buffer @dst in bytes - * @rl: run list for which to build the mapping pairs array + * @rl: runlist for which to build the mapping pairs array * - * Create the mapping pairs array from the run list @rl and save the array in + * Create the mapping pairs array from the runlist @rl and save the array in * @dst. @dst_len is the size of @dst in bytes and it should be at least equal * to the value obtained by calling ntfs_get_size_for_mapping_pairs(@rl). * * Return 0 on success or when @rl is NULL. On error, return -1 with errno set * to the error code. The following error codes are defined: * EINVAL - Run list contains unmapped elements. Make sure to only pass - * fully mapped run lists to this function. - * EIO - The run list is corrupt. + * fully mapped runlists to this function. + * EIO - The runlist is corrupt. * ENOSPC - The destination buffer is too small. */ int ntfs_build_mapping_pairs(const ntfs_volume *vol, s8 *dst, - const int dst_len, const run_list_element *rl) + const int dst_len, const runlist_element *rl) { LCN prev_lcn; s8 *dst_max; From bd25eebb4a64d026f783c131cc2d7939d26e254b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 8 Dec 2002 20:33:08 +0000 Subject: [PATCH 0184/2994] runlist.c: rename run{ ,_,-}list to runlist BKrev: 3df3ac84seyQltiCW_ijSpt0xjveyQ From c4eb64a73071e4eae7422ce2a92bb995942a0ddc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 8 Dec 2002 20:36:02 +0000 Subject: [PATCH 0185/2994] Auto merged 2002/12/08 20:15:29+00:00 cantab.net!aia21 rename run{ ,_,-}list to runlist (Logical change 1.31) --- ntfsprogs/mkntfs.c | 72 ++++++++++++++++++++-------------------- ntfsprogs/ntfsresize.c | 12 +++---- ntfsprogs/ntfsundelete.c | 30 ++++++++--------- ntfsprogs/ntfsundelete.h | 2 +- 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 5a8fd7b1..9e31870e 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -129,8 +129,8 @@ int mft_bitmap_size, mft_bitmap_byte_size; unsigned char *mft_bitmap = NULL; int lcn_bitmap_byte_size; unsigned char *lcn_bitmap = NULL; -run_list *rl = NULL, *rl_mft = NULL, *rl_mft_bmp = NULL, *rl_mftmirr = NULL; -run_list *rl_logfile = NULL, *rl_boot = NULL, *rl_bad = NULL, *rl_index; +runlist *rl = NULL, *rl_mft = NULL, *rl_mft_bmp = NULL, *rl_mftmirr = NULL; +runlist *rl_logfile = NULL, *rl_boot = NULL, *rl_bad = NULL, *rl_index; INDEX_ALLOCATION *index_block = NULL; ntfs_volume *vol; @@ -291,7 +291,7 @@ __inline__ long long mkntfs_write(int fd, const void *buf, long long count) } /* - * Write to disk the clusters contained in the run list @rl taking the data + * Write to disk the clusters contained in the runlist @rl taking the data * from @val. Take @val_len bytes from @val and pad the rest with zeroes. * * If the @rl specifies a completely sparse file, @val is allowed to be NULL. @@ -303,7 +303,7 @@ __inline__ long long mkntfs_write(int fd, const void *buf, long long count) * Return the number of bytes written (minus padding) or -1 on error. Errno * will be set to the error code. */ -s64 ntfs_rlwrite(int fd, const run_list *rl, const char *val, +s64 ntfs_rlwrite(int fd, const runlist *rl, const char *val, const s64 val_len, s64 *inited_size) { s64 bytes_written, total, length, delta; @@ -911,14 +911,14 @@ int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, return 0; } -void deallocate_scattered_clusters(const run_list *rl) +void deallocate_scattered_clusters(const runlist *rl) { LCN j; int i; if (!rl) return; - /* Iterate over all runs in the run list @rl. */ + /* Iterate over all runs in the runlist @rl. */ for (i = 0; rl[i].length; i++) { /* Skip sparse runs. */ if (rl[i].lcn == -1LL) @@ -930,9 +930,9 @@ void deallocate_scattered_clusters(const run_list *rl) } /* - * Allocate @clusters and create a run list of the allocated clusters. + * Allocate @clusters and create a runlist of the allocated clusters. * - * Return the allocated run list. Caller has to free the run list when finished + * Return the allocated runlist. Caller has to free the runlist when finished * with it. * * On error return NULL and errno is set to the error code. @@ -940,9 +940,9 @@ void deallocate_scattered_clusters(const run_list *rl) * TODO: We should be returning the size as well, but for mkntfs this is not * necessary. */ -run_list *allocate_scattered_clusters(s64 clusters) +runlist *allocate_scattered_clusters(s64 clusters) { - run_list *rl = NULL, *rlt; + runlist *rl = NULL, *rlt; VCN vcn = 0LL; LCN lcn, end, prev_lcn = 0LL; int rlpos = 0; @@ -962,7 +962,7 @@ run_list *allocate_scattered_clusters(s64 clusters) * Reallocate memory if necessary. Make sure we have * enough for the terminator entry as well. */ - if ((rlpos + 2) * sizeof(run_list) >= rlsize) { + if ((rlpos + 2) * sizeof(runlist) >= rlsize) { rlsize += 4096; /* PAGE_SIZE */ rlt = realloc(rl, rlsize); if (!rlt) @@ -1004,7 +1004,7 @@ err_end: rl[rlpos].length = 0LL; /* Deallocate all allocated clusters. */ deallocate_scattered_clusters(rl); - /* Free the run list. */ + /* Free the runlist. */ free(rl); } return NULL; @@ -1012,14 +1012,14 @@ err_end: /* * Create a non-resident attribute with a predefined on disk location - * specified by the run_list @rl. The clusters specified by @rl are assumed to + * specified by the runlist @rl. The clusters specified by @rl are assumed to * be allocated already. * * Return 0 on success and -errno on error. */ int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, - const ATTR_FLAGS flags, const run_list *rl, + const ATTR_FLAGS flags, const runlist *rl, const char *val, const s64 val_len) { ntfs_attr_search_ctx *ctx; @@ -1124,7 +1124,7 @@ int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, // does it fit now? yes -> do it. // m is a base record? yes -> allocate extension record // does the new attribute fit in there? yes -> do it. - // split up run_list into extents and place each in an extension + // split up runlist into extents and place each in an extension // record. // FIXME: the check for needing extension records should be // earlier on as it is very quick: asize > m->bytes_allocated? @@ -1207,7 +1207,7 @@ int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, ATTR_RECORD *a; u16 hdr_size; int asize, mpa_size, err, i; - run_list *rl = NULL; + runlist *rl = NULL; s64 bw = 0; uchar_t *uname; /* @@ -1307,7 +1307,7 @@ int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, // does it fit now? yes -> do it. // m is a base record? yes -> allocate extension record // does the new attribute fit in there? yes -> do it. - // split up run_list into extents and place each in an extension + // split up runlist into extents and place each in an extension // record. // FIXME: the check for needing extension records should be // earlier on as it is very quick: asize > m->bytes_allocated? @@ -1445,7 +1445,7 @@ int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, // does it fit now? yes -> do it. // m is a base record? yes -> allocate extension record // does the new attribute fit in there? yes -> do it. - // split up run_list into extents and place each in an extension + // split up runlist into extents and place each in an extension // record. // FIXME: the check for needing extension records should be // earlier on as it is very quick: asize > m->bytes_allocated? @@ -1661,14 +1661,14 @@ int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, /* * Create a non-resident data attribute with a predefined on disk location - * specified by the run_list @rl. The clusters specified by @rl are assumed to + * specified by the runlist @rl. The clusters specified by @rl are assumed to * be allocated already. * * Return 0 on success or -errno on error. */ int add_attr_data_positioned(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, - const ATTR_FLAGS flags, const run_list *rl, + const ATTR_FLAGS flags, const runlist *rl, const char *val, const s64 val_len) { int err; @@ -1855,14 +1855,14 @@ int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, /* * Create a non-resident bitmap attribute with a predefined on disk location - * specified by the run_list @rl. The clusters specified by @rl are assumed to + * specified by the runlist @rl. The clusters specified by @rl are assumed to * be allocated already. * * Return 0 on success or -errno on error. */ int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, - const run_list *rl, const char *bitmap, const u32 bitmap_len) + const runlist *rl, const char *bitmap, const u32 bitmap_len) { int err; @@ -2779,8 +2779,8 @@ int main(int argc, char **argv) if (!mft_bitmap) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - /* Create run list for mft bitmap. */ - rl_mft_bmp = (run_list *)malloc(2 * sizeof(run_list)); + /* Create runlist for mft bitmap. */ + rl_mft_bmp = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_mft_bmp) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -2832,8 +2832,8 @@ int main(int argc, char **argv) * of the device. */ opt.mft_zone_end += opt.mft_lcn; - /* Create run list for mft. */ - rl_mft = (run_list *)malloc(2 * sizeof(run_list)); + /* Create runlist for mft. */ + rl_mft = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_mft) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -2851,8 +2851,8 @@ int main(int argc, char **argv) opt.mftmirr_lcn = (opt.nr_sectors * opt.sector_size >> 1) / vol->cluster_size; Dprintf("$MFTMirr logical cluster number = 0x%x\n", opt.mftmirr_lcn); - /* Create run list for mft mirror. */ - rl_mftmirr = (run_list *)malloc(2 * sizeof(run_list)); + /* Create runlist for mft mirror. */ + rl_mftmirr = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_mftmirr) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -2874,8 +2874,8 @@ int main(int argc, char **argv) ntfs_set_bit(lcn_bitmap, opt.mftmirr_lcn + i, 1); opt.logfile_lcn = opt.mftmirr_lcn + j; Dprintf("$LogFile logical cluster number = 0x%x\n", opt.logfile_lcn); - /* Create run list for log file. */ - rl_logfile = (run_list *)malloc(2 * sizeof(run_list)); + /* Create runlist for log file. */ + rl_logfile = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_logfile) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -2923,8 +2923,8 @@ int main(int argc, char **argv) /* Allocate clusters for log file. */ for (i = 0; i < j; i++) ntfs_set_bit(lcn_bitmap, opt.logfile_lcn + i, 1); - /* Create run list for $Boot. */ - rl_boot = (run_list *)malloc(2 * sizeof(run_list)); + /* Create runlist for $Boot. */ + rl_boot = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_boot) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -2946,8 +2946,8 @@ int main(int argc, char **argv) if (!buf) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - /* Create run list for $BadClus, $DATA named stream $Bad. */ - rl_bad = (run_list *)malloc(2 * sizeof(run_list)); + /* Create runlist for $BadClus, $DATA named stream $Bad. */ + rl_bad = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_bad) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -2955,7 +2955,7 @@ int main(int argc, char **argv) rl_bad[0].lcn = -1LL; /* * $BadClus named stream $Bad contains the whole volume as a single - * sparse run list entry. + * sparse runlist entry. */ rl_bad[1].vcn = rl_bad[0].length = opt.nr_clusters; rl_bad[1].lcn = -1LL; @@ -3452,7 +3452,7 @@ bb_err: rl_index = ntfs_decompress_mapping_pairs(vol, a, NULL); if (!rl_index) { ntfs_put_attr_search_ctx(ctx); - err_exit("Failed to decompress run list of $INDEX_ALLOCATION " + err_exit("Failed to decompress runlist of $INDEX_ALLOCATION " "attribute.\n"); } if (sle64_to_cpu(a->initialized_size) < i) { diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 6bd84fc4..5a73de1e 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -306,7 +306,7 @@ s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) void build_lcn_usage_bitmap(ATTR_RECORD *a) { - run_list *rl; + runlist *rl; int i, j; if (!a->non_resident) @@ -492,7 +492,7 @@ void advise_on_resize() void look_for_bad_sector(ATTR_RECORD *a) { - run_list *rl; + runlist *rl; int i; rl = ntfs_decompress_mapping_pairs(vol, a, NULL); @@ -507,7 +507,7 @@ void look_for_bad_sector(ATTR_RECORD *a) } -void rl_set(run_list *rl, VCN vcn, LCN lcn, s64 len) +void rl_set(runlist *rl, VCN vcn, LCN lcn, s64 len) { rl->vcn = vcn; rl->lcn = lcn; @@ -532,7 +532,7 @@ void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) */ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) { - run_list *rl_bad; + runlist *rl_bad; int mp_size; char *mp; @@ -540,7 +540,7 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) /* FIXME: handle resident attribute value */ perr_exit("Resident attribute in $BadClust not supported!"); - if (!(rl_bad = (run_list *)malloc(2 * sizeof(run_list)))) + if (!(rl_bad = (runlist *)malloc(2 * sizeof(runlist)))) perr_exit("Couldn't get memory"); rl_set(rl_bad, 0LL, (LCN)LCN_HOLE, nr_clusters); @@ -566,7 +566,7 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) { - run_list *rl; + runlist *rl; s64 bm_bsize, size; s64 nr_bm_clusters; int i, j, mp_size; diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index d26afc65..a860bca2 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -694,8 +694,8 @@ void free_file (struct ufile *file) Dprintf ("freeing data stream '%s'\n", d->name ? d->name : UNNAMED); if (d->name) free (d->name); - if (d->run_list) - free (d->run_list); + if (d->runlist) + free (d->runlist); free (d); } @@ -923,8 +923,8 @@ int get_data (struct ufile *file, ntfs_volume *vol) data->size_vcn = sle64_to_cpu (rec->highest_vcn) + 1; } - data->run_list = ntfs_decompress_mapping_pairs (vol, rec, NULL); - if (!data->run_list) { + data->runlist = ntfs_decompress_mapping_pairs (vol, rec, NULL); + if (!data->runlist) { Dprintf ("Couldn't decompress the data runs\n"); } @@ -1106,7 +1106,7 @@ int cluster_in_use (ntfs_volume *vol, long long lcn) */ int calc_percentage (struct ufile *file, ntfs_volume *vol) { - run_list_element *rl = NULL; + runlist_element *rl = NULL; struct list_head *pos; struct data *data; long long i, j; @@ -1149,14 +1149,14 @@ int calc_percentage (struct ufile *file, ntfs_volume *vol) continue; } - rl = data->run_list; + rl = data->runlist; if (!rl) { - Vprintf ("File has no run list, hence no data.\n"); + Vprintf ("File has no runlist, hence no data.\n"); continue; } if (rl[0].length <= 0) { - Vprintf ("File has an empty run list, hence no data.\n"); + Vprintf ("File has an empty runlist, hence no data.\n"); continue; } @@ -1290,11 +1290,11 @@ void dump_record (struct ufile *file) Iprintf ("Size vcn: %lld\n", d->size_vcn); Iprintf ("Data runs:\n"); - if ((!d->run_list) || (d->run_list[0].length <= 0)) { + if ((!d->runlist) || (d->runlist[0].length <= 0)) { Iprintf (" None\n"); } else { - for (i = 0; d->run_list[i].length > 0; i++) { - Iprintf (" %lld @ %lld\n", d->run_list[i].length, d->run_list[i].lcn); + for (i = 0; d->runlist[i].length > 0; i++) { + Iprintf (" %lld @ %lld\n", d->runlist[i].length, d->runlist[i].lcn); } } @@ -1683,7 +1683,7 @@ int undelete_file (ntfs_volume *vol, long long inode) struct ufile *file; int i, j; long long start, end; - run_list_element *rl; + runlist_element *rl; struct list_head *item; int fd = -1; long long k; @@ -1754,14 +1754,14 @@ int undelete_file (ntfs_volume *vol, long long inode) } fd = -1; } else { - rl = d->run_list; + rl = d->runlist; if (!rl) { - Vprintf ("File has no run list, hence no data.\n"); + Vprintf ("File has no runlist, hence no data.\n"); continue; } if (rl[0].length <= 0) { - Vprintf ("File has an empty run list, hence no data.\n"); + Vprintf ("File has an empty runlist, hence no data.\n"); continue; } diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index 59bd0f34..a7c76be3 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -83,7 +83,7 @@ struct data { long long size_data; /* Actual size of data */ long long size_init; /* Initialised size, may be less than data size */ long long size_vcn; /* Highest VCN in the data runs */ - run_list_element*run_list; /* Decoded data runs */ + runlist_element *runlist; /* Decoded data runs */ int percent; /* Amont potentially recoverable */ void *data; /* If resident, a pointer to the data */ }; From cd61c86aa218e51e9620949771af2d1c5e7638d2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 8 Dec 2002 20:36:02 +0000 Subject: [PATCH 0186/2994] Auto merged 2002/12/08 20:15:41+00:00 cantab.net!aia21 rename run{ ,_,-}list to runlist (Logical change 1.31) --- libntfs/attrib.c | 78 ++++++++++++++++++++++++------------------------ libntfs/volume.c | 18 +++++------ 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index be5c70af..d600943b 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -87,7 +87,7 @@ s64 get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, errno = 0; return (s64)le32_to_cpu(a->value_length); } else { /* Attribute is not resident. */ - run_list *rl; + runlist *rl; s64 total, r; int i; @@ -99,7 +99,7 @@ s64 get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, /* * FIXME: What about attribute lists?!? (AIA) */ - /* Decompress the mapping pairs array into a run list. */ + /* Decompress the mapping pairs array into a runlist. */ rl = ntfs_decompress_mapping_pairs(vol, a, NULL); if (!rl) { errno = EINVAL; @@ -107,13 +107,13 @@ s64 get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, } /* * FIXED: We were overflowing here in a nasty fashion when we - * reach the last cluster in the run list as the buffer will + * reach the last cluster in the runlist as the buffer will * only be big enough to hold data_size bytes while we are * reading in allocated_size bytes which is usually larger * than data_size, since the actual data is unlikely to have a * size equal to a multiple of the cluster size! */ - /* Now load all clusters in the run list into b. */ + /* Now load all clusters in the runlist into b. */ for (i = 0, total = 0; rl[i].length; i++) { if (!rl[i+1].length) { unsigned char *intbuf = NULL; @@ -389,15 +389,15 @@ void ntfs_attr_close(ntfs_attr *na) } /** - * ntfs_attr_map_run_list - map (a part of) a run list of an ntfs attribute - * @na: ntfs attribute for which to map (part of) a run list - * @vcn: map run list part containing this vcn + * ntfs_attr_map_runlist - map (a part of) a runlist of an ntfs attribute + * @na: ntfs attribute for which to map (part of) a runlist + * @vcn: map runlist part containing this vcn * - * Map the part of a run list containing the @vcn of an the ntfs attribute @na. + * Map the part of a runlist containing the @vcn of an the ntfs attribute @na. * * Return 0 on success and -1 on error with errno set to the error code. */ -int ntfs_attr_map_run_list(ntfs_attr *na, VCN vcn) +int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn) { ntfs_attr_search_ctx *ctx; int err; @@ -413,9 +413,9 @@ int ntfs_attr_map_run_list(ntfs_attr *na, VCN vcn) /* Find the attribute in the mft record. */ if (!ntfs_lookup_attr(na->type, na->name, na->name_len, CASE_SENSITIVE, vcn, NULL, 0, ctx)) { - run_list_element *rl; + runlist_element *rl; - /* Decode the run list. */ + /* Decode the runlist. */ rl = ntfs_decompress_mapping_pairs(na->ni->vol, ctx->attr, na->rl); if (rl) { @@ -433,11 +433,11 @@ int ntfs_attr_map_run_list(ntfs_attr *na, VCN vcn) /** * ntfs_attr_vcn_to_lcn - convert a vcn into a lcn given an ntfs attribute - * @na: ntfs attribute whose run list to use for conversion + * @na: ntfs attribute whose runlist to use for conversion * @vcn: vcn to convert * * Convert the virtual cluster number @vcn of an attribute into a logical - * cluster number (lcn) of a device using the run list @na->rl to map vcns to + * cluster number (lcn) of a device using the runlist @na->rl to map vcns to * their corresponding lcns. * * If the @vcn is not mapped yet, attempt to map the attribute extent @@ -460,16 +460,16 @@ LCN ntfs_attr_vcn_to_lcn(ntfs_attr *na, const VCN vcn) if (!na || !NAttrNonResident(na) || vcn < 0) return (LCN)LCN_EINVAL; retry: - /* Convert vcn to lcn. If that fails map the run list and retry once. */ + /* Convert vcn to lcn. If that fails map the runlist and retry once. */ lcn = ntfs_rl_vcn_to_lcn(na->rl, vcn); if (lcn >= 0) return lcn; - if (!is_retry && !ntfs_attr_map_run_list(na, vcn)) { + if (!is_retry && !ntfs_attr_map_runlist(na, vcn)) { is_retry = TRUE; goto retry; } /* - * If the attempt to map the run list failed, or we are getting + * If the attempt to map the runlist failed, or we are getting * LCN_RL_NOT_MAPPED despite having mapped the attribute extent * successfully, something is really badly wrong... */ @@ -480,28 +480,28 @@ retry: } /** - * ntfs_attr_find_vcn - find a vcn in the run list of an ntfs attribute - * @na: ntfs attribute whose run list to search + * ntfs_attr_find_vcn - find a vcn in the runlist of an ntfs attribute + * @na: ntfs attribute whose runlist to search * @vcn: vcn to find * - * Find the virtual cluster number @vcn in the run list of the ntfs attribute - * @na and return the the address of the run list element containing the @vcn. + * Find the virtual cluster number @vcn in the runlist of the ntfs attribute + * @na and return the the address of the runlist element containing the @vcn. * - * Note you need to distinguish between the lcn of the returned run list + * Note you need to distinguish between the lcn of the returned runlist * element being >= 0 and LCN_HOLE. In the later case you have to return zeroes - * on read and allocate clusters on write. You need to update the run list, the + * on read and allocate clusters on write. You need to update the runlist, the * attribute itself as well as write the modified mft record to disk. * * If there is an error return NULL with errno set to the error code. The * following error codes are defined: * EINVAL Input parameter error. - * ENOENT There is no such vcn in the run list. + * ENOENT There is no such vcn in the runlist. * ENOMEM Not enough memory. * EIO I/O error or corrupt metadata. */ -run_list_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn) +runlist_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn) { - run_list_element *rl; + runlist_element *rl; BOOL is_retry = FALSE; if (!na || !NAttrNonResident(na) || vcn < 0) { @@ -537,8 +537,8 @@ retry: } return NULL; map_rl: - /* The @vcn is in an unmapped region, map the run list and retry. */ - if (!is_retry && !ntfs_attr_map_run_list(na, vcn)) { + /* The @vcn is in an unmapped region, map the runlist and retry. */ + if (!is_retry && !ntfs_attr_map_runlist(na, vcn)) { is_retry = TRUE; goto retry; } @@ -576,7 +576,7 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) { s64 br, to_read, ofs, total, total2; ntfs_volume *vol; - run_list_element *rl; + runlist_element *rl; int f; Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x, pos 0x%Lx, " @@ -656,7 +656,7 @@ res_err_out: count -= total2; memset((u8*)b + count, 0, total2); } - /* Find the run list element containing the vcn. */ + /* Find the runlist element containing the vcn. */ rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits); if (!rl) { /* @@ -751,7 +751,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) s64 written, to_write, ofs, total, old_initialized_size; ntfs_volume *vol; ntfs_attr_search_ctx *ctx = NULL; - run_list_element *rl; + runlist_element *rl; int f, eo; struct { unsigned int initialized_size : 1; @@ -832,7 +832,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) return count; } total = 0; - /* Find the run list element containing the vcn. */ + /* Find the runlist element containing the vcn. */ rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits); if (!rl) { /* @@ -938,7 +938,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) } if (eo) { // TODO: Need to instantiate the hole. Then get - // the run list element again checking if it is + // the runlist element again checking if it is // ok and fall through to do the writing. (AIA) errno = ENOTSUP; goto rl_err_out; @@ -1883,21 +1883,21 @@ __inline__ int ntfs_get_nr_significant_bytes(const s64 n) /** * ntfs_get_size_for_mapping_pairs - get bytes needed for mapping pairs array * @vol: ntfs volume (needed for the ntfs version) - * @rl: run list for which to determine the size of the mapping pairs + * @rl: runlist for which to determine the size of the mapping pairs * - * Walk the run list @rl and calculate the size in bytes of the mapping pairs - * array corresponding to the run list @rl. This for example allows us to + * Walk the runlist @rl and calculate the size in bytes of the mapping pairs + * array corresponding to the runlist @rl. This for example allows us to * allocate a buffer of the right size when building the mapping pairs array. * * Return the calculated size in bytes on success. If @rl is NULL return 0. * On error, return -1 with errno set to the error code. The following error * codes are defined: * EINVAL - Run list contains unmapped elements. Make sure to only pass - * fully mapped run lists to this function. - * EIO - The run list is corrupt. + * fully mapped runlists to this function. + * EIO - The runlist is corrupt. */ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, - const run_list_element *rl) + const runlist_element *rl) { LCN prev_lcn; int i, rls; @@ -1941,7 +1941,7 @@ err_out: * @dest_max, the maximum position within @dst to which we are allowed to * write. * - * This is used when building the mapping pairs array of a run list to compress + * This is used when building the mapping pairs array of a runlist to compress * a given logical cluster number (lcn) or a specific run length to the minumum * size possible. * diff --git a/libntfs/volume.c b/libntfs/volume.c index 85da29b0..692d8dd2 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -180,7 +180,7 @@ static int ntfs_load_mft(ntfs_volume *vol) vol->mft_ni->attr_list_rl = ntfs_decompress_mapping_pairs(vol, ctx->attr, NULL); if (!vol->mft_ni->attr_list_rl) { - Dperror("Error: failed to get run list for " + Dperror("Error: failed to get runlist for " "$MFT/$ATTRIBUTE_LIST"); goto error_exit; } @@ -203,7 +203,7 @@ mft_has_no_attr_list: highest_vcn = next_vcn = 0; a = NULL; while (!ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, next_vcn, NULL, 0, ctx)) { - run_list_element *nrl; + runlist_element *nrl; a = ctx->attr; /* $MFT must be non-resident. */ @@ -223,7 +223,7 @@ mft_has_no_attr_list: } /* * Decompress the mapping pairs array of this extent and merge - * the result into the existing run list. No need for locking + * the result into the existing runlist. No need for locking * as we have exclusive access to the inode at this time and we * are a mount in progress task, too. */ @@ -255,7 +255,7 @@ mft_has_no_attr_list: goto io_error_exit; } if (highest_vcn && highest_vcn != last_vcn - 1) { - Dputs("Failed to load the complete run list for $MFT/$DATA. " + Dputs("Failed to load the complete runlist for $MFT/$DATA. " "Bug or corrupt $MFT. Run chkdsk."); Dprintf("highest_vcn = 0x%Lx, last_vcn - 1 = 0x%Lx\n", (long long)highest_vcn, @@ -308,7 +308,7 @@ error_exit: static int ntfs_load_mftmirr(ntfs_volume *vol) { int i; - run_list_element rl[2]; + runlist_element rl[2]; vol->mftmirr_ni = ntfs_open_inode(vol, FILE_MFTMirr); if (!vol->mftmirr_ni) { @@ -321,11 +321,11 @@ static int ntfs_load_mftmirr(ntfs_volume *vol) Dperror("Failed to open $MFTMirr/$DATA"); goto error_exit; } - if (ntfs_attr_map_run_list(vol->mftmirr_na, 0) < 0) { - Dperror("Failed to map run list of $MFTMirr/$DATA"); + if (ntfs_attr_map_runlist(vol->mftmirr_na, 0) < 0) { + Dperror("Failed to map runlist of $MFTMirr/$DATA"); goto error_exit; } - /* Construct the mft mirror run list. */ + /* Construct the mft mirror runlist. */ rl[0].vcn = 0; rl[0].lcn = vol->mftmirr_lcn; rl[0].length = (vol->mftmirr_size * vol->mft_record_size + @@ -333,7 +333,7 @@ static int ntfs_load_mftmirr(ntfs_volume *vol) rl[1].vcn = rl[0].length; rl[1].lcn = LCN_ENOENT; rl[1].length = 0; - /* Compare the two run lists. They must be identical. */ + /* Compare the two runlists. They must be identical. */ i = 0; do { if (rl[i].vcn != vol->mftmirr_na->rl[i].vcn || From 2550af241a10dc461af3378320ae330a858ccf2d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 8 Dec 2002 20:36:02 +0000 Subject: [PATCH 0187/2994] Auto merged 2002/12/08 20:15:50+00:00 cantab.net!aia21 rename run{ ,_,-}list to runlist (Logical change 1.31) --- include/layout.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/layout.h b/include/layout.h index 55592807..3a21b6e5 100644 --- a/include/layout.h +++ b/include/layout.h @@ -509,7 +509,7 @@ typedef enum { * can be stored: * * 1) The data in the block is all zero (a sparse block): - * This is stored as a sparse block in the run list, i.e. the run list + * This is stored as a sparse block in the runlist, i.e. the runlist * entry has length = X and lcn = -1. The mapping pairs array actually * uses a delta_lcn value length of 0, i.e. delta_lcn is not present at * all, which is then interpreted by the driver as lcn = -1. @@ -522,7 +522,7 @@ typedef enum { * in clusters. I.e. if compression has a small effect so that the * compressed data still occupies X clusters, then the uncompressed data * is stored in the block. - * This case is recognised by the fact that the run list entry has + * This case is recognised by the fact that the runlist entry has * length = X and lcn >= 0. The mapping pairs array stores this as * normal with a run length of X and some specific delta_lcn, i.e. * delta_lcn has to be present. @@ -531,7 +531,7 @@ typedef enum { * The common case. This case is recognised by the fact that the run * list entry has length L < X and lcn >= 0. The mapping pairs array * stores this as normal with a run length of X and some specific - * delta_lcn, i.e. delta_lcn has to be present. This run list entry is + * delta_lcn, i.e. delta_lcn has to be present. This runlist entry is * immediately followed by a sparse entry with length = X - L and * lcn = -1. The latter entry is to make up the vcn counting to the * full compression block size X. @@ -539,15 +539,15 @@ typedef enum { * In fact, life is more complicated because adjacent entries of the same type * can be coalesced. This means that one has to keep track of the number of * clusters handled and work on a basis of X clusters at a time being one - * block. An example: if length L > X this means that this particular run list + * block. An example: if length L > X this means that this particular runlist * entry contains a block of length X and part of one or more blocks of length * L - X. Another example: if length L < X, this does not necessarily mean that * the block is compressed as it might be that the lcn changes inside the block - * and hence the following run list entry describes the continuation of the + * and hence the following runlist entry describes the continuation of the * potentially compressed block. The block would be compressed if the - * following run list entry describes at least X - L sparse clusters, thus + * following runlist entry describes at least X - L sparse clusters, thus * making up the compression block length as described in point 3 above. (Of - * course, there can be several run list entries with small lengths so that the + * course, there can be several runlist entries with small lengths so that the * sparse entry does not follow the first data containing entry with * length < X.) * From 149c17ceced49e6d3251b6677fdc71b7fb9879bd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 8 Dec 2002 20:36:02 +0000 Subject: [PATCH 0188/2994] Merge 2002/12/08 20:17:12+00:00 cantab.net!aia21 Many files: rename run{ ,_,-}list to runlist BKrev: 3df3ad32oBVI2X8PuiNaDGDXAQcQMw From f7ffcf6445746683148790deb5a723fabf7f67f0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 8 Dec 2002 20:36:02 +0000 Subject: [PATCH 0189/2994] merge 2002/12/08 20:15:41+00:00 cantab.net!aia21 rename run{ ,_,-}list to runlist (Logical change 1.31) From c7bcb144b2a9ea8c10fb1c1e050c5fbe5ec2eb8a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 8 Dec 2002 20:36:02 +0000 Subject: [PATCH 0190/2994] rename run{ ,_,-}list to runlist (Logical change 1.31) --- ChangeLog | 10 +++++----- doc/compression.txt | 8 ++++---- include/attrib.h | 16 ++++++++-------- include/debug.h | 4 ++-- include/inode.h | 2 +- include/runlist.h | 22 +++++++++++----------- libntfs/debug.c | 10 +++++----- libntfs/inode.c | 6 +++--- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce67e4ef..1fb88867 100644 --- a/ChangeLog +++ b/ChangeLog @@ -54,15 +54,15 @@ of using the opt global structure. Necessary so can call the modified ntfs_decompress_mapping_pairs() from mkntfs.c. - Add libntfs/debug.c providing: - ntfs_debug_dump_run_list(). + ntfs_debug_dump_runlist(). - Add new API call ntfs_check_if_mounted() to volume.[ch]. (Matthew Fanto, me) - Do folding assisting cleanups. (Richard Russon, me) - Add new API call is_boot_sector_ntfs() provided by bootsect.[hc]. - Define and write more API calls provided by attrib.[ch]: - ntfs_merge_run_lists(), + ntfs_merge_runlists(), ntfs_decompress_mapping_pairs(), - ntfs_attr_map_run_list(), + ntfs_attr_map_runlist(), ntfs_{rl,attr}_vcn_to_lcn(), ntfs_attr_find_vcn(), ntfs_attr_init(), @@ -119,7 +119,7 @@ instead of aborting and returning error EIO to flag the corruption. - Add new syntactic sugar API provided by attrib.h: ntfs_walk_attrs(). (Szakacsits Szabolcs) - - Add new API for compressing run lists into mapping pairs arrays + - Add new API for compressing runlists into mapping pairs arrays provided by attrib.[ch] (adapted from mkntfs.c): ntfs_get_nr_significant_bytes(), ntfs_get_size_for_mapping_pairs(), @@ -132,7 +132,7 @@ flexible use. - Don't use string concatenation with __FUNCTION__ as gcc-3.x don't like it. - - Move run list functions to runlist.[hc]. (Richard Russon) + - Move runlist functions to runlist.[hc]. (Richard Russon) - Add new API to volume.[hc] and use it (Szakacsits Szabolcs): ntfs_is_version_supported(), NTFS_V{1_[12],2_x,3_[01]}() macros, diff --git a/doc/compression.txt b/doc/compression.txt index 90d2f0c1..41dce6fc 100644 --- a/doc/compression.txt +++ b/doc/compression.txt @@ -11,7 +11,7 @@ Regis Duchesne's NTFS documentation and from various LZ77 descriptions) and further refined by looking at a few compressed streams to figure out some uncertainties. -Note: You should also read the run list description with regards to compression +Note: You should also read the runlist description with regards to compression in linux-ntfs/include/layout.h. Just search for "Attribute compression". FIXME: Should merge the info from there into this document some time. @@ -30,14 +30,14 @@ Each cb is independent of the other cbs and is thus the minimal unit we have to parse even if we wanted to decompress only one byte. Also, a cb can be totally uncompressed and this would be indicated as a sparse -cb in the run list. +cb in the runlist. -Thus, we need to look at the run list of the compressed data stream, starting +Thus, we need to look at the runlist of the compressed data stream, starting at the beginning of the first cb overlapping @page. So we convert the page offset into units of clusters (vcn), and round the vcn down to a mutliple of cb_size clusters. -We then scan the run list for the appropriate position. Based on what we find +We then scan the runlist for the appropriate position. Based on what we find there, we decide how to proceed. If the cb is not compressed at all, and covers the whole of @page, we pretend diff --git a/include/attrib.h b/include/attrib.h index 130810fe..b4f4be9e 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -156,14 +156,14 @@ typedef enum { /** * ntfs_attr - ntfs in memory non-resident attribute structure - * @rl: if not NULL, the decompressed run list + * @rl: if not NULL, the decompressed runlist * @ni: base ntfs inode to which this attribute belongs * @type: attribute type * @name: Unicode name of the attribute * @name_len: length of @name in Unicode characters * @state: NTFS attribute specific flags descibing this attribute * - * This structure exists purely to provide a mechanism of caching the run list + * This structure exists purely to provide a mechanism of caching the runlist * of an attribute. If you want to operate on a particular attribute extent, * you should not be using this structure at all. If you want to work with a * resident attribute, you should not be using this structure at all. As a @@ -175,9 +175,9 @@ typedef enum { * record, edit that, and then write back the mft record (or set the * corresponding ntfs inode dirty for delayed write back). * - * @rl is the decompressed run list of the attribute described by this + * @rl is the decompressed runlist of the attribute described by this * structure. Obviously this only makes sense if the attribute is not resident, - * i.e. NAttrNonResident() is true. If the run list hasn't been decomressed yet + * i.e. NAttrNonResident() is true. If the runlist hasn't been decomressed yet * @rl is NULL, so be prepared to cope with @rl == NULL. * * @ni is the base ntfs inode of the attribute described by this structure. @@ -190,7 +190,7 @@ typedef enum { * structure. See ntfs_attr_state_bits above. */ struct _ntfs_attr { - run_list_element *rl; + runlist_element *rl; ntfs_inode *ni; ATTR_TYPES type; uchar_t *name; @@ -251,14 +251,14 @@ extern s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, extern s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, const u32 bk_size, void *src); -extern int ntfs_attr_map_run_list(ntfs_attr *na, VCN vcn); +extern int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn); extern LCN ntfs_attr_vcn_to_lcn(ntfs_attr *na, const VCN vcn); -extern run_list_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn); +extern runlist_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn); extern int ntfs_get_nr_significant_bytes(const s64 n); extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, - const run_list_element *rl); + const runlist_element *rl); extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, const s64 n); diff --git a/include/debug.h b/include/debug.h index 592771cb..b3b2c72a 100644 --- a/include/debug.h +++ b/include/debug.h @@ -65,14 +65,14 @@ static __inline__ void Dperror(const char *s) errno = eo; } -extern void ntfs_debug_dump_run_list(const run_list_element *rl); +extern void ntfs_debug_dump_runlist(const runlist_element *rl); #else static __inline__ void Dprintf(const char *fmt, ...) {} static __inline__ void Dputs(const char *s) {} static __inline__ void Dperror(const char *s) {} -static __inline__ void ntfs_debug_dump_run_list(const run_list_element *rl) {} +static __inline__ void ntfs_debug_dump_runlist(const runlist_element *rl) {} #endif diff --git a/include/inode.h b/include/inode.h index 7f6f00c4..19516394 100644 --- a/include/inode.h +++ b/include/inode.h @@ -86,7 +86,7 @@ struct _ntfs_inode { */ u32 attr_list_size; /* Length of attribute list value in bytes. */ u8 *attr_list; /* Attribute list value itself. */ - run_list *attr_list_rl; /* Run list for the attribute list value. */ + runlist *attr_list_rl; /* Run list for the attribute list value. */ s32 nr_extents; /* For a base mft record, the number of attached extent inodes (0 if none), for extent records this is -1. */ diff --git a/include/runlist.h b/include/runlist.h index 903b81d8..8eb071e7 100644 --- a/include/runlist.h +++ b/include/runlist.h @@ -28,14 +28,14 @@ #include "types.h" /* Forward declarations */ -typedef struct _run_list_element run_list_element; -typedef run_list_element run_list; +typedef struct _runlist_element runlist_element; +typedef runlist_element runlist; #include "attrib.h" #include "volume.h" /* - * run_list_element - in memory vcn to lcn mapping array element + * runlist_element - in memory vcn to lcn mapping array element * @vcn: starting vcn of the current array element * @lcn: starting lcn of the current array element * @length: length in clusters of the current array element @@ -45,25 +45,25 @@ typedef run_list_element run_list; * When lcn == -1 this means that the count vcns starting at vcn are not * physically allocated (i.e. this is a hole / data is sparse). */ -struct _run_list_element {/* In memory vcn to lcn mapping structure element. */ +struct _runlist_element {/* In memory vcn to lcn mapping structure element. */ VCN vcn; /* vcn = Starting virtual cluster number. */ LCN lcn; /* lcn = Starting logical cluster number. */ s64 length; /* Run length in clusters. */ }; -extern LCN ntfs_rl_vcn_to_lcn(const run_list_element *rl, const VCN vcn); +extern LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn); -extern s64 ntfs_rl_pwrite(const ntfs_volume *vol, const run_list_element *rl, +extern s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, const s64 pos, s64 count, void *b); -extern run_list_element *ntfs_merge_run_lists(run_list_element *drl, - run_list_element *srl); +extern runlist_element *ntfs_merge_runlists(runlist_element *drl, + runlist_element *srl); -extern run_list_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, - const ATTR_RECORD *attr, run_list_element *old_rl); +extern runlist_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, + const ATTR_RECORD *attr, runlist_element *old_rl); extern int ntfs_build_mapping_pairs(const ntfs_volume *vol, s8 *dst, - const int dst_len, const run_list_element *rl); + const int dst_len, const runlist_element *rl); #endif /* defined _NTFS_RUNLIST_H */ diff --git a/libntfs/debug.c b/libntfs/debug.c index 67166755..01328ec0 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -25,16 +25,16 @@ #ifdef DEBUG /** - * ntfs_debug_dump_run_list - Dump a run list. + * ntfs_debug_dump_runlist - Dump a runlist. */ -void ntfs_debug_dump_run_list(const run_list_element *rl) +void ntfs_debug_dump_runlist(const runlist_element *rl) { int i = 0; const char *lcn_str[5] = { "LCN_HOLE ", "LCN_RL_NOT_MAPPED", "LCN_ENOENT ", "LCN_EINVAL ", "LCN_unknown " }; - Dputs("NTFS-fs DEBUG: Dumping run list (values in hex):"); + Dputs("NTFS-fs DEBUG: Dumping runlist (values in hex):"); if (!rl) { Dputs("Run list not present."); return; @@ -50,11 +50,11 @@ void ntfs_debug_dump_run_list(const run_list_element *rl) index = 4; Dprintf("%-16Lx %s %-16Lx%s\n", rl[i].vcn, lcn_str[index], rl[i].length, - rl[i].length ? "" : " (run list end)"); + rl[i].length ? "" : " (runlist end)"); } else Dprintf("%-16Lx %-16Lx %-16Lx%s\n", rl[i].vcn, rl[i].lcn, rl[i].length, - rl[i].length ? "" : " (run list end)"); + rl[i].length ? "" : " (runlist end)"); } while (rl[i++].length); } diff --git a/libntfs/inode.c b/libntfs/inode.c index f4485cbd..133be5f8 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -95,7 +95,7 @@ static __inline__ int __release_ntfs_inode(ntfs_inode *ni) * is found, load the attribute list attribute value and attach it to the * ntfs_inode structure (->attr_list). Also set the NI_AttrList bit to indicate * this as well as the NI_AttrListNonResident bit if the the attribute list is - * non-resident. In that case, also attach the decompressed run list to the + * non-resident. In that case, also attach the decompressed runlist to the * ntfs_inode structure (->attr_list_rl). * * Return a pointer to the ntfs_inode structure on success or NULL on error, @@ -159,7 +159,7 @@ ntfs_inode *ntfs_open_inode(ntfs_volume *vol, const MFT_REF mref) // FIXME: We are duplicating work here! (AIA) ni->attr_list_rl = ntfs_decompress_mapping_pairs(vol, ctx->attr, NULL); if (ni->attr_list_rl) { - /* We got the run list, so we are done. */ + /* We got the runlist, so we are done. */ ntfs_put_attr_search_ctx(ctx); return ni; } @@ -195,7 +195,7 @@ err_out: * error, @ni has not been freed. The user should attempt to handle the error * and call ntfs_close_inode() again. The following error codes are defined: * - * EBUSY @ni is dirty and/or the attribute list run list is dirty. + * EBUSY @ni is dirty and/or the attribute list runlist is dirty. */ int ntfs_close_inode(ntfs_inode *ni) { From 8c213b3aefde5593c1726ef2a84497b1e72cd677 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 8 Dec 2002 20:47:47 +0000 Subject: [PATCH 0191/2994] ChangeLog: update changelog for renames BKrev: 3df3aff3S8sk6CEcrT2M4L9p5EfLkQ From 82529814be75e952e36190d7c4a771c0a1acfe2b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 8 Dec 2002 20:47:47 +0000 Subject: [PATCH 0192/2994] update changelog for renames (Logical change 1.32) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 1fb88867..02493d7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -144,6 +144,7 @@ - Remove GPL message text from usage information in mkntfs. - New tool, ntfsundelete, written by Richard Russon. - New tool, ntfsresize, written by Szabolcs Szakacsits. + - The word is "runlist", not "run_list", "run list", or "run-list". 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for From fbfa8d138b6e35985012b3a6dee90ab7a3c9c79a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Dec 2002 09:23:21 +0000 Subject: [PATCH 0193/2994] fix warning from compiler (Logical change 1.33) --- libntfs/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index d600943b..f17b7c35 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1066,7 +1066,7 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, const u32 bk_size, void *b) { s64 br; - void *end; + u8 *end; Dprintf("%s(): Entering for inode 0x%Lx, attr type 0x%x, pos 0x%Lx.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, From 8ad0c0f6b680081aa89cb6770b3fee15193bc9b1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Dec 2002 09:23:21 +0000 Subject: [PATCH 0194/2994] ntfsresize.c: remove unused variables Makefile.in: update build attrib.c: fix warning from compiler TODO.libntfs: update TODO. BKrev: 3df46109dhqNfiuzQqSY2pMIaxZIBw From 9ff24501b2134b5b2412f871a7d35385f4eab3d3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Dec 2002 09:23:21 +0000 Subject: [PATCH 0195/2994] remove unused variables (Logical change 1.33) --- ntfsprogs/ntfsresize.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 5a73de1e..33e27ff9 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -230,7 +230,6 @@ s64 get_new_volume_size(char *s) void parse_options(int argc, char **argv) { - char *s; int i; printf("%s v%s\n", EXEC_NAME, VERSION); @@ -786,9 +785,6 @@ void mount_volume() } if (!(vol = ntfs_mount(opt.volume, opt.ro_flag))) { - - int err = errno; - perr_printf("ntfs_mount failed"); if (errno == EINVAL) { printf("Apparently device '%s' doesn't have a " From 1dcedb04f100e3235d66b015ebe2730a8597f1e0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Dec 2002 09:23:21 +0000 Subject: [PATCH 0196/2994] update TODO. (Logical change 1.33) --- TODO.libntfs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/TODO.libntfs b/TODO.libntfs index 908218d1..7941cdea 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -15,22 +15,22 @@ - write attribute resize function (see mkntfs) and implement ntfs_truncate* -- write ntfs_{allocate,free}_cluster(s) (see ntfs 2.4 driver in CVS) +- write ntfs_cluster(s)_{allocate,free} (see ntfs 2.4 driver in CVS) - extend ntfs_attr_pwrite to cope with extending the attribute size and with instantiating holes -- write ntfs_{allocate,free}_mft_record (see ntfs 2.4 driver in CVS) +- write ntfs_mft_record_{allocate,free} (see ntfs 2.4 driver in CVS) -- write ntfs_{rm,create,add}_attr() +- write ntfs_attr_{rm,create,add}() -- write ntfs_{rm_from,add_to,create,rm}_index() +- write ntfs_index_{rm_from,add_to,create,rm}() - write ntfs_file_name_{add,rm}_from_mft_record() or _from_ntfs_inode(?) -- write ntfs_unlink_file() +- write ntfs_file_unlink() -- write ntfs_create_file() +- write ntfs_file_create() - write API for conventional high level file access. From 030078ba24af44b39b5a75d262713584ada62402 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Dec 2002 09:23:21 +0000 Subject: [PATCH 0197/2994] update build (Logical change 1.33) --- libntfs/Makefile.in | 10 +++++----- ntfsprogs/Makefile.in | 13 +++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index f8886f16..e7a81983 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -146,8 +146,8 @@ LTLIBRARIES = $(lib_LTLIBRARIES) DEFS = @DEFS@ -I. -I$(srcdir) -I.. LIBS = @LIBS@ libntfs_la_LIBADD = -libntfs_la_OBJECTS = attrib.lo bootsect.lo compat.lo debug.lo dir.lo disk_io.lo \ -inode.lo mft.lo mst.lo runlist.lo unistr.lo volume.lo +libntfs_la_OBJECTS = attrib.lo bootsect.lo compat.lo debug.lo dir.lo \ +disk_io.lo inode.lo mft.lo mst.lo runlist.lo unistr.lo volume.lo COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -159,9 +159,9 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = gtar GZIP_ENV = --best -DEP_FILES = .deps/attrib.P .deps/bootsect.P .deps/compat.P .deps/debug.P .deps/dir.P \ -.deps/disk_io.P .deps/inode.P .deps/mft.P .deps/mst.P .deps/runlist.P \ -.deps/unistr.P .deps/volume.P +DEP_FILES = .deps/attrib.P .deps/bootsect.P .deps/compat.P \ +.deps/debug.P .deps/dir.P .deps/disk_io.P .deps/inode.P .deps/mft.P \ +.deps/mst.P .deps/runlist.P .deps/unistr.P .deps/volume.P SOURCES = $(libntfs_la_SOURCES) OBJECTS = $(libntfs_la_OBJECTS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 3873269d..911d5a25 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -155,8 +155,8 @@ dumplog_LDADD = $(AM_LIBS) dumplog_LDFLAGS = $(AM_LFLAGS) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ -ntfsundelete.8 ntfsresize.8 ntfsprogs.8 +CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 \ +ntfsprogs.8 ntfsresize.8 ntfsundelete.8 bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) @@ -219,7 +219,8 @@ MANS = $(man_MANS) NROFF = nroff DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsfix.8.in \ -ntfsinfo.8.in ntfslabel.8.in ntfsresize.8.in ntfsundelete.8.in ntfsprogs.8.in +ntfsinfo.8.in ntfslabel.8.in ntfsprogs.8.in ntfsresize.8.in \ +ntfsundelete.8.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) @@ -247,16 +248,16 @@ mkntfs.8: $(top_builddir)/config.status mkntfs.8.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ntfsfix.8: $(top_builddir)/config.status ntfsfix.8.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -ntfslabel.8: $(top_builddir)/config.status ntfslabel.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ntfsinfo.8: $(top_builddir)/config.status ntfsinfo.8.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -ntfsundelete.8: $(top_builddir)/config.status ntfsundelete.8.in +ntfslabel.8: $(top_builddir)/config.status ntfslabel.8.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ntfsprogs.8: $(top_builddir)/config.status ntfsprogs.8.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ntfsresize.8: $(top_builddir)/config.status ntfsresize.8.in cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +ntfsundelete.8: $(top_builddir)/config.status ntfsundelete.8.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status mostlyclean-binPROGRAMS: From e15920920d93d33c245d2ca4dfdf0a90b2d4da90 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Dec 2002 09:42:12 +0000 Subject: [PATCH 0198/2994] Many files: start of renames to ntfs_object_action() format BKrev: 3df46574XA1Dgsn_YfOlWkpKiHjxsA From 9e79b614375b6e75adff3ee815b9a63fc1ac91e1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Dec 2002 09:42:12 +0000 Subject: [PATCH 0199/2994] start of renames to ntfs_object_action() format (Logical change 1.34) --- ChangeLog | 4 ++-- include/mft.h | 20 +++++++++----------- libntfs/attrib.c | 10 ++++------ libntfs/attrib_RE.txt | 8 ++++---- libntfs/inode.c | 6 ++---- libntfs/mft.c | 20 +++++++++----------- libntfs/volume.c | 4 ++-- ntfsprogs/ntfsdump_logfile.c | 6 ++---- ntfsprogs/ntfsfix.c | 4 +--- ntfsprogs/ntfsinfo.c | 4 +--- ntfsprogs/ntfslabel.c | 6 ++---- ntfsprogs/ntfsresize.c | 5 +++-- 12 files changed, 41 insertions(+), 56 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02493d7b..c7146cb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,13 +17,13 @@ mft.[ch] provide: ntfs_{read,write}_mft_record(), ntfs_{read,write}_mft_records(), and ntfs_get_mft_record_data_size(). - - When writing mft records using the mft.c::ntfs_write_mft_record{s,}() + - When writing mft records using the mft.c::ntfs_mft_record{s,}_write() interface, the mft mirror is now updated automatically. - Add -Wall to compiler options when ./configure is run with --enable-debug. - Fix minor error code path bugs in mkntfs.c that showed up with -Wall. - Fix all compiler warnings that showed up with -Wall. - - Add new API function, provided by mft.[ch]: ntfs_read_file_record(). + - Add new API function, provided by mft.[ch]: ntfs_file_record_read(). - Add new API calls provided by unistr.[ch]: ntfs_ucstombs() and ntfs_mbstoucs(). - Define API for mst.[ch] providing: diff --git a/include/mft.h b/include/mft.h index 486d070c..49509804 100644 --- a/include/mft.h +++ b/include/mft.h @@ -1,6 +1,4 @@ /* - * $Id$ - * * mft.h - Exports for MFT record handling. Part of the Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov. @@ -27,11 +25,11 @@ #include "volume.h" #include "layout.h" -extern int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref, +extern int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref, const s64 count, MFT_RECORD *b); /** - * ntfs_read_mft_record - read a record from the mft + * ntfs_mft_record_read - read a record from the mft * @vol: volume to read from * @mref: mft record number to read * @b: output data buffer @@ -45,20 +43,20 @@ extern int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref, * * NOTE: @b has to be at least of size vol->mft_record_size. */ -static __inline__ int ntfs_read_mft_record(const ntfs_volume *vol, +static __inline__ int ntfs_mft_record_read(const ntfs_volume *vol, const MFT_REF mref, MFT_RECORD *b) { - return ntfs_read_mft_records(vol, mref, 1, b); + return ntfs_mft_records_read(vol, mref, 1, b); } -extern int ntfs_read_file_record(const ntfs_volume *vol, const MFT_REF mref, +extern int ntfs_file_record_read(const ntfs_volume *vol, const MFT_REF mref, MFT_RECORD **mrec, ATTR_RECORD **attr); -extern int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref, +extern int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, const s64 count, MFT_RECORD *b); /** - * ntfs_write_mft_record - write an mft record to disk + * ntfs_mft_record_write - write an mft record to disk * @vol: volume to write to * @mref: mft record number to write * @b: data buffer containing the mft record to write @@ -72,10 +70,10 @@ extern int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref, * * NOTE: @b has to be at least of size vol->mft_record_size. */ -static __inline__ int ntfs_write_mft_record(const ntfs_volume *vol, +static __inline__ int ntfs_mft_record_write(const ntfs_volume *vol, const MFT_REF mref, MFT_RECORD *b) { - return ntfs_write_mft_records(vol, mref, 1, b); + return ntfs_mft_records_write(vol, mref, 1, b); } /** diff --git a/libntfs/attrib.c b/libntfs/attrib.c index f17b7c35..fe2a20bb 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * attrib.c - Attribute handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov. @@ -817,7 +815,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) goto err_out; } memcpy(val + pos, b, count); - if (ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no, + if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec)) { /* * NOTE: We are in a bad state at this moment. We have @@ -866,7 +864,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) goto err_out; } ctx->attr->initialized_size = scpu_to_le64(pos + count); - if (ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no, + if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec)) { /* * Undo the change in the in-memory copy and send it @@ -874,7 +872,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) */ ctx->attr->initialized_size = scpu_to_le64(old_initialized_size); - ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no, + ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec); goto err_out; } @@ -1013,7 +1011,7 @@ err_out: na->initialized_size = old_initialized_size; ctx->attr->initialized_size = scpu_to_le64( old_initialized_size); - err = ntfs_write_mft_record(vol, + err = ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec); } diff --git a/libntfs/attrib_RE.txt b/libntfs/attrib_RE.txt index d3db334d..70caeea5 100644 --- a/libntfs/attrib_RE.txt +++ b/libntfs/attrib_RE.txt @@ -183,7 +183,7 @@ already_have_the_base_and_is_first: } if (!type) return FALSE; - if (ntfs_read_file_record(vol, mref, &ctx->mrec, &ctx->attr) < 0) + if (ntfs_file_record_read(vol, mref, &ctx->mrec, &ctx->attr) < 0) return FALSE; ctx->base = ctx->mrec; find_attr(vol, type, name, name_len, ic, val, val_len, ctx); @@ -250,7 +250,7 @@ compare_lowest_vcn: // FIXME: CcUnpinData(ctx->base); ctx->base = 0; } - if (ntfs_read_file_record(vol, + if (ntfs_file_record_read(vol, le64_to_cpu(al_pos->mft_reference), &m, &attr_pos) < 0) return FALSE; @@ -310,7 +310,7 @@ loc_5217c: } if (!type) return FALSE; - if (ntfs_read_file_record(vol, mref, &mrec, &ctx->attr) < 0) + if (ntfs_file_record_read(vol, mref, &mrec, &ctx->attr) < 0) return FALSE; ctx->base = mrec; find_attr(vol, type, name, name_len, ic, val, val_len, ctx); @@ -340,7 +340,7 @@ BOOL lookup_attr(const ntfs_volume *vol, const MFT_REFERENCE *mref, } if (ctx->base) goto already_have_the_base; - if (ntfs_read_file_record(vol, mref, &m, &a) < 0) + if (ntfs_file_record_read(vol, mref, &m, &a) < 0) return FALSE; ctx->base = ctx->mrec = m; ctx->attr = a; diff --git a/libntfs/inode.c b/libntfs/inode.c index 133be5f8..fa28c875 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * inode.c - Inode handling code. Part of the Linux-NTFS project. * * Copyright (c) 2002 Anton Altaparmakov. @@ -116,7 +114,7 @@ ntfs_inode *ntfs_open_inode(ntfs_volume *vol, const MFT_REF mref) ni = __allocate_ntfs_inode(vol); if (!ni) return NULL; - if (ntfs_read_file_record(vol, mref, &ni->mrec, NULL)) + if (ntfs_file_record_read(vol, mref, &ni->mrec, NULL)) goto err_out; if (!(ni->mrec->flags & MFT_RECORD_IN_USE)) goto err_out; @@ -279,7 +277,7 @@ ntfs_inode *ntfs_open_extent_inode(ntfs_inode *base_ni, const MFT_REF mref) ni = __allocate_ntfs_inode(base_ni->vol); if (!ni) return NULL; - if (ntfs_read_file_record(base_ni->vol, le64_to_cpu(mref), &ni->mrec, + if (ntfs_file_record_read(base_ni->vol, le64_to_cpu(mref), &ni->mrec, NULL)) goto err_out; ni->mft_no = mft_no; diff --git a/libntfs/mft.c b/libntfs/mft.c index 16d66ca7..572b837b 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * mft.c - Mft record handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov. @@ -32,7 +30,7 @@ #include "attrib.h" /** - * ntfs_read_mft_records - read records from the mft from disk + * ntfs_mft_records_read - read records from the mft from disk * @vol: volume to read from * @mref: starting mft record number to read * @count: number of mft records to read @@ -48,7 +46,7 @@ * * NOTE: @b has to be at least of size @count * vol->mft_record_size. */ -int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref, +int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref, const s64 count, MFT_RECORD *b) { s64 br; @@ -79,7 +77,7 @@ int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref, } /** - * ntfs_write_mft_records - write mft records to disk + * ntfs_mft_records_write - write mft records to disk * @vol: volume to write to * @mref: starting mft record number to write * @count: number of mft records to write @@ -98,7 +96,7 @@ int ntfs_read_mft_records(const ntfs_volume *vol, const MFT_REF mref, * record was successfully written, we write the appropriate mft records from * the copied buffer to the mft mirror, too. */ -int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref, +int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, const s64 count, MFT_RECORD *b) { s64 bw; @@ -161,7 +159,7 @@ int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref, } /** - * ntfs_read_file_record - read a FILE record from the mft from disk + * ntfs_file_record_read - read a FILE record from the mft from disk * @vol: volume to read from * @mref: mft reference specifying mft record to read * @mrec: address of pointer in which to return the mft record @@ -184,14 +182,14 @@ int ntfs_write_mft_records(const ntfs_volume *vol, const MFT_REF mref, * and for having a matching sequence number (if MSEQNO(*@mref) != 0). * If either of these fails, -1 is returned and errno is set to EIO. If you get * this, but you still want to read the mft record (e.g. in order to correct - * it), use ntfs_read_mft_record() directly. + * it), use ntfs_mft_record_read() directly. * * Note: Caller has to free *@mrec when finished. * * Note: We do not check if the mft record is flagged in use. The caller can * check if desired. */ -int ntfs_read_file_record(const ntfs_volume *vol, const MFT_REF mref, +int ntfs_file_record_read(const ntfs_volume *vol, const MFT_REF mref, MFT_RECORD **mrec, ATTR_RECORD **attr) { MFT_RECORD *m; @@ -208,7 +206,7 @@ int ntfs_read_file_record(const ntfs_volume *vol, const MFT_REF mref, if (!m) return -1; } - if (ntfs_read_mft_record(vol, mref, m)) { + if (ntfs_mft_record_read(vol, mref, m)) { err = errno; goto read_failed; } @@ -224,7 +222,7 @@ int ntfs_read_file_record(const ntfs_volume *vol, const MFT_REF mref, *attr = a; return 0; file_corrupt: - Dputs("ntfs_read_file_record(): file is corrupt."); + Dputs("ntfs_file_record_read(): file is corrupt."); err = EIO; read_failed: if (m != *mrec) diff --git a/libntfs/volume.c b/libntfs/volume.c index 692d8dd2..c23f0bcc 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1038,7 +1038,7 @@ int ntfs_set_volume_flags(ntfs_volume *vol, const u16 flags) return -1; } - if (ntfs_read_file_record(vol, FILE_Volume, &m, NULL)) { + if (ntfs_file_record_read(vol, FILE_Volume, &m, NULL)) { Dperror("Failed to read $Volume"); return -1; } @@ -1086,7 +1086,7 @@ int ntfs_set_volume_flags(ntfs_volume *vol, const u16 flags) /* Set the volume flags. */ vol->flags = c->flags = cpu_to_le16(flags); - if (ntfs_write_mft_record(vol, FILE_Volume, m)) { + if (ntfs_mft_record_write(vol, FILE_Volume, m)) { Dperror("Error writing $Volume"); goto err_out; } diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index e4bf33f6..4b1997d3 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -1,11 +1,9 @@ const char *EXEC_NAME = "NtfsDump_LogFile"; const char *EXEC_VERSION = "1.0"; /* - * $Id$ - * * NtfsDump_LogFile - Part of the Linux-NTFS project. * - * Copyright (c) 2000,2001 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This utility will interpret the contents of the journal ($LogFile) of an * NTFS partition and display the results on stdout. Errors will be output to @@ -120,7 +118,7 @@ version_error: goto error_exit; } /* Read in $LogFile. */ - if (ntfs_read_file_record(vol, FILE_LogFile, &m, NULL)) { + if (ntfs_file_record_read(vol, FILE_LogFile, &m, NULL)) { fprintf(stderr, "Error reading mft record for $LogFile.\n"); goto error_exit; } diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 4ec021b2..8d5d3111 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * NtfsFix - Part of the Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov. @@ -228,7 +226,7 @@ int main(int argc, char **argv) printf("Correcting differences in " "$MFTMirr... "); } - br = ntfs_write_mft_record(vol, i, (MFT_RECORD*)(m + + br = ntfs_mft_record_write(vol, i, (MFT_RECORD*)(m + i * vol->mft_record_size)); if (br) { puts(FAILED); diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 723c3722..4340a0ec 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ntfsinfo - Part of the Linux-NTFS project. * * Copyright (c) 2002 Matthew J. Fanto @@ -93,7 +91,7 @@ void get_file_attribute_value(const char *dev, long int i) mref = (MFT_REF) i; inode = ntfs_open_inode(vol, mref); - if (ntfs_read_file_record(vol, mref, &mrec, NULL)) { + if (ntfs_file_record_read(vol, mref, &mrec, NULL)) { perror("Error reading file record!\n"); exit(1); } diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 5d07c0d0..60df2afe 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ntfslabel - Part of the Linux-NTFS project. * * Copyright (c) 2002 Matthew J. Fanto @@ -147,7 +145,7 @@ void change_label(const char *dev, const unsigned long mnt_flags, strerror(errno)); exit(1); } - if (ntfs_read_file_record(vol, (MFT_REF)FILE_Volume, &mrec, NULL)) { + if (ntfs_file_record_read(vol, (MFT_REF)FILE_Volume, &mrec, NULL)) { perror("Error reading file record"); goto err_out; } @@ -189,7 +187,7 @@ void change_label(const char *dev, const unsigned long mnt_flags, goto err_out; } memcpy((char*)a + le16_to_cpu(a->value_offset), new_label, label_len); - if (ntfs_write_mft_record(vol, (MFT_REF)FILE_Volume, mrec)) { + if (ntfs_mft_record_write(vol, (MFT_REF)FILE_Volume, mrec)) { perror("Error writing MFT Record to disk"); goto err_out; } diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 33e27ff9..d2fe671e 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2,6 +2,7 @@ * ntfsresize - Part of the Linux-NTFS project. * * Copyright (c) 2002 Szabolcs Szakacsits + * Copyright (c) 2002 Anton Altaparmakov * * This utility will resize an NTFS volume. * @@ -429,7 +430,7 @@ void walk_inodes() progress_update(&progress, inode); mref = (MFT_REF)inode; - if (ntfs_read_file_record(vol, mref, &mrec, NULL)) { + if (ntfs_file_record_read(vol, mref, &mrec, NULL)) { /* FIXME: continue only if it make sense, e.g. MFT record not in use based on $MFT bitmap */ if (errno == EIO) @@ -680,7 +681,7 @@ int write_mft_record(ntfs_attr_search_ctx *ctx) if (opt.ro_flag) return 0; - return ntfs_write_mft_record(vol, ctx->ntfs_ino->mft_no, ctx->mrec); + return ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec); } From 65b72f98e141cd9530ade6117256690a89ab12c4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Dec 2002 16:09:32 +0000 Subject: [PATCH 0200/2994] bug fix by Szaka (Logical change 1.35) --- ntfsprogs/ntfsresize.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index d2fe671e..c812bd75 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -786,8 +786,11 @@ void mount_volume() } if (!(vol = ntfs_mount(opt.volume, opt.ro_flag))) { + + int err = errno; + perr_printf("ntfs_mount failed"); - if (errno == EINVAL) { + if (err == EINVAL) { printf("Apparently device '%s' doesn't have a " "valid NTFS. Maybe you selected\nthe whole " "disk instead of a partition (e.g. /dev/hda, " From 3c45c30f5c88639542030e275b4eff8a75b5040a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Dec 2002 16:09:32 +0000 Subject: [PATCH 0201/2994] ntfsresize.c: bug fix by Szaka Many files: remove cvs id tags BKrev: 3df4c03cmaBfo2NpWGkbqdZNacoU8A From 900c3e987b12b2b94ddd0e73516e61d1b9a80cf9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Dec 2002 16:09:32 +0000 Subject: [PATCH 0202/2994] remove cvs id tags (Logical change 1.35) --- libntfs/bootsect.c | 2 -- libntfs/compat.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ libntfs/debug.c | 2 -- libntfs/dir.c | 2 -- libntfs/disk_io.c | 2 -- libntfs/mst.c | 2 -- libntfs/runlist.c | 2 -- libntfs/unistr.c | 2 -- libntfs/volume.c | 2 -- 9 files changed, 56 insertions(+), 16 deletions(-) diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index dee15a17..0d9f8125 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * bootsect.c - Boot sector handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000,2001 Anton Altaparmakov. diff --git a/libntfs/compat.c b/libntfs/compat.c index e69de29b..894f9b95 100644 --- a/libntfs/compat.c +++ b/libntfs/compat.c @@ -0,0 +1,56 @@ +/* + * compat.c - Tweaks for Windows compatability + * + * Copyright (c) 2002 Richard Russon. + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef WINDOWS + +#include "compat.h" + +int ffs (int x) +{ + int r = 1; + + if (!x) + return 0; + if (!(x & 0xffff)) { + x >>= 16; + r += 16; + } + if (!(x & 0xff)) { + x >>= 8; + r += 8; + } + if (!(x & 0xf)) { + x >>= 4; + r += 4; + } + if (!(x & 3)) { + x >>= 2; + r += 2; + } + if (!(x & 1)) { + x >>= 1; + r += 1; + } + return r; +} + +#endif /* WINDOWS */ + diff --git a/libntfs/debug.c b/libntfs/debug.c index 01328ec0..34e1cb7c 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * debug.c - Debugging output functions. Part of the Linux-NTFS project. * * Copyright (c) 2002 Anton Altaparmakov. diff --git a/libntfs/dir.c b/libntfs/dir.c index dd156fba..e9bd2178 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * dir.c - Directory handling code. Part of the Linux-NTFS project. * * Copyright (c) 2002 Anton Altaparmakov. diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index 2d812aec..806db398 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * disk_io.c - Disk io functions. Part of the Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov. diff --git a/libntfs/mst.c b/libntfs/mst.c index e4ece6dc..834fa8a4 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * mst.c - Multi sector fixup handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov. diff --git a/libntfs/runlist.c b/libntfs/runlist.c index dd2bd15b..95669a00 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * runlist.c - Run list handling code. Part of the Linux-NTFS project. * * Copyright (c) 2002 Anton Altaparmakov. diff --git a/libntfs/unistr.c b/libntfs/unistr.c index ec749c43..b0321402 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * unistr.c - Unicode string handling. Part of the Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov. diff --git a/libntfs/volume.c b/libntfs/volume.c index c23f0bcc..d81cb034 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * volume.c - NTFS volume handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov. From 7b451e170433a8c0bced365eb27371ed5ec4ab2f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 10 Dec 2002 11:53:41 +0000 Subject: [PATCH 0203/2994] Update changelog for renames (Logical change 1.36) --- ChangeLog | 74 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index c7146cb3..e4d6d47d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,15 +8,15 @@ - Remove a LOT of dead code. Massive cleanup. - Add full attribute search context and allocation/init/deallocation functions (see attrib.c). - - Remove find_first_attr(). Just use get_attr_search_ctx() + - find_attr() which has the same effect. + - Remove find_first_attr(). Just use ntfs_attr_get_search_ctx() + + ntfs_attr_find() which has the same effect. - Rewrite disk_io.[ch] and mft.[ch] defining new access API: disk_io.[ch] provide: ntfs_p{read,write}(), ntfs_mst_p{read,write}(), and - ntfs_{read,write}_clusters(). - mft.[ch] provide: ntfs_{read,write}_mft_record(), - ntfs_{read,write}_mft_records(), and - ntfs_get_mft_record_data_size(). + ntfs_clusters_{read,write}(). + mft.[ch] provide: ntfs_mft_record_{read,write}(), + ntfs_mft_records_{read,write}(), and + ntfs_mft_record_get_data_size(). - When writing mft records using the mft.c::ntfs_mft_record{s,}_write() interface, the mft mirror is now updated automatically. - Add -Wall to compiler options when ./configure is run with @@ -27,41 +27,41 @@ - Add new API calls provided by unistr.[ch]: ntfs_ucstombs() and ntfs_mbstoucs(). - Define API for mst.[ch] providing: - ntfs_post_read_mst_fixup(), - ntfs_pre_write_mst_fixup(), and - ntfs_post_write_mst_fixup(). + ntfs_mst_post_read_fixup(), + ntfs_mst_pre_write_fixup(), and + ntfs_mst_post_write_fixup(). - Define API for bootsect.[ch] providing: - is_boot_sector_ntfs(). + ntfs_boot_sector_is_ntfs(). - Add beginning of new API with new files inode.[ch] providing: - ntfs_{open,close)_inode(), and - ntfs_open_extent_inode(). + ntfs_inode_{open,close)(), and + ntfs_extent_inode_open(). - Note the inode related API is subject to change. - Start defining API provided by attrib.[ch]: ntfs_attr_search_ctx typedef, - ntfs_{get,put,reinit}_attr_search_ctx(), and - ntfs_lookup_attr(). + ntfs_attr_{get,put,reinit}_search_ctx(), and + ntfs_attr_lookup(). - Add a TODO.libntfs laying down my personal roadmap for the library. - - Remove find_attr() from API, everyone must use ntfs_lookup_attr() + - Remove ntfs_attr_find() from API, everyone must use ntfs_lookup_attr() instead. - Rename all attribute name constants from $blah to AT_blah. - Rename all system file constants from FILE_$blah to FILE_blah. - - Port lookup_attr() stuff from ntfs tng driver. + - Port ntfS_attr_lookup() stuff from ntfs tng driver. - Implement loading of extent inodes. They are attached on open to the base inode and are cached there until the base inode is closed. - Cleanup/streamline include file dependencies. - Port attribute list merging code from ntfs tng driver. API to follow. - Allocate a ntfs_volume in mkntfs and start initializing it instead of using the opt global structure. Necessary so can call the - modified ntfs_decompress_mapping_pairs() from mkntfs.c. + modified ntfs_mapping_pairs_decompress() from mkntfs.c. - Add libntfs/debug.c providing: - ntfs_debug_dump_runlist(). + ntfs_debug_runlist_dump(). - Add new API call ntfs_check_if_mounted() to volume.[ch]. (Matthew Fanto, me) - Do folding assisting cleanups. (Richard Russon, me) - - Add new API call is_boot_sector_ntfs() provided by bootsect.[hc]. + - Add new API call ntfs_boot_sector_is_ntfs() provided by bootsect.[hc]. - Define and write more API calls provided by attrib.[ch]: - ntfs_merge_runlists(), - ntfs_decompress_mapping_pairs(), + ntfs_runlists_merge(), + ntfs_mapping_pairs_decompress(), ntfs_attr_map_runlist(), ntfs_{rl,attr}_vcn_to_lcn(), ntfs_attr_find_vcn(), @@ -83,16 +83,16 @@ overwrite only): ntfs_attr_p{read,write}(), and ntfs_attr_mst_p{read,write}(). - - Fix detection of read-only mounts in volume.c::ntfs_check_mntent(). + - Fix detection of read-only mounts in volume.c::ntfs_mntent_check(). - Start modularising ntfs_mount(): - Split off the boot sector parsing code and move it to - bootsect.c::parse_ntfs_boot_sector(). + bootsect.c::ntfs_boot_sector_parse(). - Move $MFT loading and parsing code to separate function - volume.c::ntfs_load_mft(). + volume.c::ntfs_mft_load(). - Move $MFTMirr loading and parsing code to - volume.c::ntfs_load_mftmirr(). + volume.c::ntfs_mftmirr_load(). - Move all startup code (loading and parsing of bootsector, - $MFT, and $MFTMirr) to volume.c::ntfs_startup_volume(). + $MFT, and $MFTMirr) to volume.c::ntfs_volume_startup(). - Update ntfsfix to above modularisation. - Add detection of read-write mounted devices to ntfsfix and refuse to operate on them. @@ -100,10 +100,10 @@ and writes and deal with end of file properly. Affected functions: ntfs_p{read,write}(), ntfs_mst_p{read,write}(), and - ntfs_{read,write}_clusters(). + ntfs_clusters_{read,write}(). - Change ntfsfix to take into account the automatic mft mirror updates. - Add new API provided by new files dir.[ch]: - ntfs_lookup_inode_by_name(), and + ntfs_inode_lookup_by_name(), and ntfs_readdir(). - We now use u8, u16, u32, u64, s8, s16, s32, and s64 types and we typedef them ourselves from the C99 standard uint8_t, etc types which @@ -111,20 +111,20 @@ - Better gcc detection in 'configure.in'. (Szakacsits Szabolcs) Tested with: egcs-1.0.3 (egcs-2.90.29), egcs-1.1.2 (egcs-2.91.66), gcc 2.95.3, 2.96 (from RH 7.1 and 7.3), and 3.0.4. - - Enable enumeration of attributes using ntfs_lookup_attr() which is + - Enable enumeration of attributes using ntfs_attr_lookup() which is requested by passing a type of AT_UNUSED (or simply zero) to - ntfs_lookup_attr(). (Based on initial patch by Szakacsits Szabolcs.) - - Fix two minor buglets in ntfs_find_external_attr() where we would + ntfs_attr_lookup(). (Based on initial patch by Szakacsits Szabolcs.) + - Fix two minor buglets in ntfs_external_attr_find() where we would continue the search when we detect a mismatched type and/or name instead of aborting and returning error EIO to flag the corruption. - Add new syntactic sugar API provided by attrib.h: - ntfs_walk_attrs(). (Szakacsits Szabolcs) + ntfs_attrs_walk(). (Szakacsits Szabolcs) - Add new API for compressing runlists into mapping pairs arrays provided by attrib.[ch] (adapted from mkntfs.c): ntfs_get_nr_significant_bytes(), ntfs_get_size_for_mapping_pairs(), ntfs_write_significant_bytes(), and - ntfs_build_mapping_pairs(). + ntfs_mapping_pairs_build(). - Convert mkntfs.c to the above API. - Implement attrib.[hc]::ntfs_rl_pwrite() as a low level scatter write function analogous in functionality to mkntfs.c::ntfs_rlwrite() but @@ -134,10 +134,10 @@ like it. - Move runlist functions to runlist.[hc]. (Richard Russon) - Add new API to volume.[hc] and use it (Szakacsits Szabolcs): - ntfs_is_version_supported(), + ntfs_version_is_supported(), NTFS_V{1_[12],2_x,3_[01]}() macros, - ntfs_reset_logfile(), and - ntfs_set_volume_flags(). + ntfs_logfile_reset(), and + ntfs_volume_set_flags(). - Change size autodetection of non-block device files in mkntfs to use the stat returned file size rather than the block allocation count to cope with precreated sparse files. @@ -145,6 +145,8 @@ - New tool, ntfsundelete, written by Richard Russon. - New tool, ntfsresize, written by Szabolcs Szakacsits. - The word is "runlist", not "run_list", "run list", or "run-list". + - Prefix all functions with "ntfs_" and make the names of the form + "ntfs_object_action()". Keep this for all future functions! 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for From f6171df97b7cfb01b833d4b640b3f5184fa1504e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 10 Dec 2002 11:53:41 +0000 Subject: [PATCH 0204/2994] add ntfsresize (Logical change 1.36) --- README | 5 ++++- linux-ntfs.spec.in | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README b/README index 4df0739e..024d59f0 100644 --- a/README +++ b/README @@ -65,5 +65,8 @@ command line options. ntfslabel - Display/change the label of an NTFS partition. See man 8 ntfslabel for details. -ntfsundelete - Recover deleted files from an NTFS volume. See man 8 +ntfsundelete - Recover deleted files from an NTFS volume. See man 8 ntfsundelete for more details. + +ntfsresize - Resize NTFS volumes. See man 8 ntfsresize for details. + diff --git a/linux-ntfs.spec.in b/linux-ntfs.spec.in index c19b9ce7..cbe16a4a 100644 --- a/linux-ntfs.spec.in +++ b/linux-ntfs.spec.in @@ -33,6 +33,7 @@ for command line options. ntfslabel for details. ntfsundelete - Recover deleted files from an NTFS volume. See man 8 ntfsundelete for details. + ntfsresize - Resize an NTFS volume. See man 8 ntfsresize for details. %package devel Summary : files required to compile software that uses libntfs @@ -77,6 +78,9 @@ rm -rf "$RPM_BUILD_ROOT" %{prefix}/lib/*.la* %changelog +* Tue Dec 10 2002 Anton Altaparmakov +- added ntfsresize + * Wed Jul 18 2002 Richard Russon - added ntfsundelete - change TODO names From 69306cc4938807e5f41fcc91aaa8edf83ef94317 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 10 Dec 2002 11:53:41 +0000 Subject: [PATCH 0205/2994] new api renames to ntfs_object_action (Logical change 1.36) --- include/attrib.h | 28 +++--- include/bitmap.h | 18 ++-- include/bootsect.h | 9 +- include/compat.h | 50 ++++++++++ include/debug.h | 8 +- include/dir.h | 6 +- include/disk_io.h | 8 +- include/endians.h | 4 +- include/inode.h | 10 +- include/layout.h | 32 +++--- include/list.h | 4 +- include/logfile.h | 12 +-- include/mft.h | 8 +- include/mst.h | 10 +- include/runlist.h | 12 +-- include/support.h | 4 +- include/types.h | 4 +- include/unistr.h | 10 +- include/volume.h | 12 +-- libntfs/attrib.c | 184 +++++++++++++++++------------------ libntfs/attrib_RE.txt | 34 +++---- libntfs/bootsect.c | 10 +- libntfs/compat.c | 8 +- libntfs/debug.c | 6 +- libntfs/dir.c | 64 ++++++------ libntfs/disk_io.c | 16 +-- libntfs/inode.c | 62 ++++++------ libntfs/mft.c | 4 +- libntfs/mst.c | 17 ++-- libntfs/runlist.c | 44 ++++----- libntfs/unistr.c | 24 ++--- libntfs/volume.c | 153 +++++++++++++++-------------- ntfsprogs/dumplog.c | 12 +-- ntfsprogs/mkntfs.c | 120 +++++++++++------------ ntfsprogs/ntfsdump_logfile.c | 18 ++-- ntfsprogs/ntfsfix.c | 18 ++-- ntfsprogs/ntfsinfo.c | 8 +- ntfsprogs/ntfslabel.c | 4 +- ntfsprogs/ntfsresize.c | 62 ++++++------ ntfsprogs/ntfsundelete.c | 18 ++-- 40 files changed, 577 insertions(+), 558 deletions(-) diff --git a/include/attrib.h b/include/attrib.h index b4f4be9e..f62dc52f 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -1,9 +1,7 @@ /* - * $Id$ - * * attrib.h - Exports for attribute handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -79,33 +77,33 @@ struct _ntfs_attr_search_ctx { ATTR_RECORD *base_attr; }; -extern void ntfs_reinit_attr_search_ctx(ntfs_attr_search_ctx *ctx); -extern ntfs_attr_search_ctx *ntfs_get_attr_search_ctx(ntfs_inode *ni, +extern void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx); +extern ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec); -extern void ntfs_put_attr_search_ctx(ntfs_attr_search_ctx *ctx); +extern void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx); -extern int ntfs_lookup_attr(const ATTR_TYPES type, const uchar_t *name, +extern int ntfs_attr_lookup(const ATTR_TYPES type, const uchar_t *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx); /** - * ntfs_walk_attrs - syntactic sugar for walking all attributes in an inode + * ntfs_attrs_walk - syntactic sugar for walking all attributes in an inode * @ctx: initialised attribute search context * * Syntactic sugar for walking attributes in an inode. * * Return 0 on success and -1 on error with errno set to the error code from - * ntfs_lookup_attr(). + * ntfs_attr_lookup(). * * Example: When you want to enumerate all attributes in an open ntfs inode * @ni, you can simply do: * * int err; - * ntfs_attr_search_ctx *ctx = ntfs_get_attr_search_ctx(ni, NULL); + * ntfs_attr_search_ctx *ctx = ntfs_attr_get_search_ctx(ni, NULL); * if (!ctx) * // Error code is in errno. Handle this case. - * while (!(err = ntfs_walk_attrs(ctx))) { + * while (!(err = ntfs_attrs_walk(ctx))) { * ATTR_RECORD *attr = ctx->attr; * // attr now contains the next attribute. Do whatever you want * // with it and then just continue with the while loop. @@ -114,9 +112,9 @@ extern int ntfs_lookup_attr(const ATTR_TYPES type, const uchar_t *name, * // Ooops. An error occured! You should handle this case. * // Now finished with all attributes in the inode. */ -static __inline__ int ntfs_walk_attrs(ntfs_attr_search_ctx *ctx) +static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx) { - return ntfs_lookup_attr(0, NULL, 0, 0, 0, NULL, 0, ctx); + return ntfs_attr_lookup(0, NULL, 0, 0, 0, NULL, 0, ctx); } /** @@ -276,7 +274,7 @@ extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, * * FIXME: Describe possible errnos. */ -s64 get_attribute_value_length(const ATTR_RECORD *a); +s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a); /** * get_attribute_value - return the attribute value of an attribute @@ -292,7 +290,7 @@ s64 get_attribute_value_length(const ATTR_RECORD *a); * then nothing was read due to a zero-length attribute value, otherwise * errno describes the error. */ -s64 get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, +s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, const ATTR_RECORD *a, u8 *b); #endif /* defined _NTFS_ATTRIB_H */ diff --git a/include/bitmap.h b/include/bitmap.h index 0da0c107..8ab67671 100644 --- a/include/bitmap.h +++ b/include/bitmap.h @@ -1,9 +1,7 @@ /* - * $Id$ - * * bitmap.h - Exports for bitmap handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -37,14 +35,14 @@ */ /** - * ntfs_set_bit - set a bit in a field of bits + * ntfs_bit_set - set a bit in a field of bits * @bitmap: field of bits * @bit: bit to set * @new_value: value to set bit to (0 or 1) * * Set the bit @bit in the @bitmap to @new_value. Ignore all errors. */ -static __inline__ void ntfs_set_bit(u8 *bitmap, const u64 bit, +static __inline__ void ntfs_bit_set(u8 *bitmap, const u64 bit, const u8 new_value) { // Dprintf("bitmap %p, bit 0x%Lx, new_value %i\n", bitmap, bit, new_value); @@ -57,21 +55,21 @@ static __inline__ void ntfs_set_bit(u8 *bitmap, const u64 bit, } /** - * ntfs_get_bit - get value of a bit in a field of bits + * ntfs_bit_get - get value of a bit in a field of bits * @bitmap: field of bits * @bit: bit to get * * Get and return the value of the bit @bit in @bitmap (0 or 1). * Return -1 on error. */ -static __inline__ char ntfs_get_bit(const u8 *bitmap, const u64 bit) +static __inline__ char ntfs_bit_get(const u8 *bitmap, const u64 bit) { if (!bitmap) return -1; return (bitmap[bit >> 3] >> (bit & 7)) & 1; } -static __inline__ void ntfs_change_bit(u8 *bitmap, const u64 bit) +static __inline__ void ntfs_bit_change(u8 *bitmap, const u64 bit) { if (!bitmap) return; @@ -79,7 +77,7 @@ static __inline__ void ntfs_change_bit(u8 *bitmap, const u64 bit) } /** - * ntfs_get_and_set_bit - get value of a bit in a field of bits and set it + * ntfs_bit_get_and_set - get value of a bit in a field of bits and set it * @bitmap: field of bits * @bit: bit to get/set * @new_value: value to set bit to (0 or 1) @@ -87,7 +85,7 @@ static __inline__ void ntfs_change_bit(u8 *bitmap, const u64 bit) * Return the value of the bit @bit and set it to @new_value (0 or 1). * Return -1 on error. */ -static __inline__ char ntfs_get_and_set_bit(u8 *bitmap, const u64 bit, +static __inline__ char ntfs_bit_get_and_set(u8 *bitmap, const u64 bit, const u8 new_value) { register u8 old_bit, shift; diff --git a/include/bootsect.h b/include/bootsect.h index ce8b33f7..d2ad2e57 100644 --- a/include/bootsect.h +++ b/include/bootsect.h @@ -1,10 +1,8 @@ /* - * $Id$ - * * bootsect.h - Exports for bootsector record handling. Part of the Linux-NTFS * project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -41,8 +39,9 @@ * disregarding the value of silent (but only if configure was run with * --enable-debug). */ -extern BOOL is_boot_sector_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent); -extern int parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b); +extern BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, + const BOOL silent); +extern int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b); #endif /* defined _NTFS_BOOTSECT_H */ diff --git a/include/compat.h b/include/compat.h index e69de29b..81be6ef0 100644 --- a/include/compat.h +++ b/include/compat.h @@ -0,0 +1,50 @@ +/* + * compat.h - Tweaks for Windows compatability. + * + * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_COMPAT_H +#define _NTFS_COMPAT_H + +#ifdef WINDOWS + +#ifndef HAVE_FFS +#define HAVE_FFS +extern int ffs(int i); +#endif /* HAVE_FFS */ + +#define HAVE_STDIO_H /* mimic config.h */ +#define HAVE_STDARG_H + +#define atoll _atoi64 +#define fdatasync commit +#define __inline__ inline +#define __attribute__(X) /*nothing*/ + +#else /* !defined WINDOWS */ + +#ifndef O_BINARY +#define O_BINARY 0 /* unix is binary by default */ +#endif + +#endif /* defined WINDOWS */ + +#endif /* defined _NTFS_COMPAT_H */ + diff --git a/include/debug.h b/include/debug.h index b3b2c72a..a5716196 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,9 +1,7 @@ /* - * $Id$ - * * debug.h - Debugging output functions. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov. + * Copyright (c) 2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -65,14 +63,14 @@ static __inline__ void Dperror(const char *s) errno = eo; } -extern void ntfs_debug_dump_runlist(const runlist_element *rl); +extern void ntfs_debug_runlist_dump(const runlist_element *rl); #else static __inline__ void Dprintf(const char *fmt, ...) {} static __inline__ void Dputs(const char *s) {} static __inline__ void Dperror(const char *s) {} -static __inline__ void ntfs_debug_dump_runlist(const runlist_element *rl) {} +static __inline__ void ntfs_debug_runlist_dump(const runlist_element *rl) {} #endif diff --git a/include/dir.h b/include/dir.h index b0939689..e13e3753 100644 --- a/include/dir.h +++ b/include/dir.h @@ -1,9 +1,7 @@ /* - * $Id$ - * * dir.h - Exports for directory handling. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov. + * Copyright (c) 2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -29,7 +27,7 @@ /* The little endian Unicode string $I30 as a global constant. */ extern uchar_t I30[5]; -extern u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, +extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const uchar_t *uname, const int uname_len); /* diff --git a/include/disk_io.h b/include/disk_io.h index 3c1ccc6e..deb34272 100644 --- a/include/disk_io.h +++ b/include/disk_io.h @@ -1,9 +1,7 @@ /* - * $Id$ - * * disk_io.h - Exports for disk io. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -34,9 +32,9 @@ extern s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, extern s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, const u32 bksize, const void *b); -extern s64 ntfs_read_clusters(const ntfs_volume *vol, const s64 lcn, +extern s64 ntfs_clusters_read(const ntfs_volume *vol, const s64 lcn, const s64 count, const void *b); -extern s64 ntfs_write_clusters(const ntfs_volume *vol, const s64 lcn, +extern s64 ntfs_clusters_write(const ntfs_volume *vol, const s64 lcn, const s64 count, const void *b); #endif /* defined _NTFS_DISK_IO_H */ diff --git a/include/endians.h b/include/endians.h index adad2ae8..a3bf6790 100644 --- a/include/endians.h +++ b/include/endians.h @@ -1,10 +1,8 @@ /* - * $Id$ - * * endians.h - Definitions related to handling of byte ordering. Part of the * Linux-NTFS project. * - * Copyright (c) 2000,2001 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published diff --git a/include/inode.h b/include/inode.h index 19516394..f3a1e9f0 100644 --- a/include/inode.h +++ b/include/inode.h @@ -1,9 +1,7 @@ /* - * $Id$ - * * inode.h - Defines for NTFS inode handling. Part of the Linux-NTFS project. * - * Copyright (c) 2001,2002 Anton Altaparmakov. + * Copyright (c) 2001,2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -100,11 +98,11 @@ struct _ntfs_inode { }; }; -extern ntfs_inode *ntfs_open_inode(ntfs_volume *vol, const MFT_REF mref); +extern ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref); -extern int ntfs_close_inode(ntfs_inode *ni); +extern int ntfs_inode_close(ntfs_inode *ni); -extern ntfs_inode *ntfs_open_extent_inode(ntfs_inode *base_ni, +extern ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref); #endif /* defined _NTFS_INODE_H */ diff --git a/include/layout.h b/include/layout.h index 3a21b6e5..1d5009ab 100644 --- a/include/layout.h +++ b/include/layout.h @@ -1,9 +1,7 @@ /* - * $Id$ - * * layout.h - Ntfs on-disk layout structures. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -110,25 +108,25 @@ typedef enum { * Generic magic comparison macros. Finally found a use for the ## preprocessor * operator! (-8 */ -#define is_magic(x, m) ( (u32)(x) == (u32)magic_##m ) -#define is_magicp(p, m) ( *(u32*)(p) == (u32)magic_##m ) +#define ntfs_is_magic(x, m) ( (u32)(x) == (u32)magic_##m ) +#define ntfs_is_magicp(p, m) ( *(u32*)(p) == (u32)magic_##m ) /* * Specialised magic comparison macros. */ -#define is_baad_record(x) ( is_magic (x, BAAD) ) -#define is_baad_recordp(p) ( is_magicp(p, BAAD) ) -#define is_chkd_record(x) ( is_magic (x, CHKD) ) -#define is_chkd_recordp(p) ( is_magicp(p, CHKD) ) -#define is_file_record(x) ( is_magic (x, FILE) ) -#define is_file_recordp(p) ( is_magicp(p, FILE) ) -#define is_hole_record(x) ( is_magic (x, HOLE) ) -#define is_hole_recordp(p) ( is_magicp(p, HOLE) ) -#define is_indx_record(x) ( is_magic (x, INDX) ) -#define is_indx_recordp(p) ( is_magicp(p, INDX) ) +#define ntfs_is_baad_record(x) ( ntfs_is_magic (x, BAAD) ) +#define ntfs_is_baad_recordp(p) ( ntfs_is_magicp(p, BAAD) ) +#define ntfs_is_chkd_record(x) ( ntfs_is_magic (x, CHKD) ) +#define ntfs_is_chkd_recordp(p) ( ntfs_is_magicp(p, CHKD) ) +#define ntfs_is_file_record(x) ( ntfs_is_magic (x, FILE) ) +#define ntfs_is_file_recordp(p) ( ntfs_is_magicp(p, FILE) ) +#define ntfs_is_hole_record(x) ( ntfs_is_magic (x, HOLE) ) +#define ntfs_is_hole_recordp(p) ( ntfs_is_magicp(p, HOLE) ) +#define ntfs_is_indx_record(x) ( ntfs_is_magic (x, INDX) ) +#define ntfs_is_indx_recordp(p) ( ntfs_is_magicp(p, INDX) ) -#define is_mft_record(x) ( is_file_record(x) ) -#define is_mft_recordp(p) ( is_file_recordp(p) ) +#define ntfs_is_mft_record(x) ( ntfs_is_file_record(x) ) +#define ntfs_is_mft_recordp(p) ( ntfs_is_file_recordp(p) ) /* * Defines for the NTFS filesystem. Don't want to use BLOCK_SIZE and diff --git a/include/list.h b/include/list.h index ef1d1cc4..73041234 100644 --- a/include/list.h +++ b/include/list.h @@ -1,9 +1,7 @@ /* - * $Id$ - * * list.h - Linked list implementation. Part of the Linux-NTFS project. * - * Copyright (c) + * Copyright (c) 2000-2002 Anton Altaparmakov and others * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published diff --git a/include/logfile.h b/include/logfile.h index c083fa58..34a62fd8 100644 --- a/include/logfile.h +++ b/include/logfile.h @@ -1,9 +1,7 @@ /* - * $Id$ - * * logfile.h - Exports for $LogFile handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000,2001 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -34,10 +32,10 @@ typedef enum { /* * Specialised magic comparison macros. */ -#define is_rstr_record(x) ( is_magic (x, RSTR) ) -#define is_rstr_recordp(p) ( is_magicp(p, RSTR) ) -#define is_rcrd_record(x) ( is_magic (x, RCRD) ) -#define is_rcrd_recordp(p) ( is_magicp(p, RCRD) ) +#define ntfs_is_rstr_record(x) ( ntfs_is_magic (x, RSTR) ) +#define ntfs_is_rstr_recordp(p) ( ntfs_is_magicp(p, RSTR) ) +#define ntfs_is_rcrd_record(x) ( ntfs_is_magic (x, RCRD) ) +#define ntfs_is_rcrd_recordp(p) ( ntfs_is_magicp(p, RCRD) ) /* * Log file organization: diff --git a/include/mft.h b/include/mft.h index 49509804..96ec291b 100644 --- a/include/mft.h +++ b/include/mft.h @@ -1,7 +1,7 @@ /* * mft.h - Exports for MFT record handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -77,7 +77,7 @@ static __inline__ int ntfs_mft_record_write(const ntfs_volume *vol, } /** - * ntfs_get_mft_record_data_size - return number of bytes used in mft record @b + * ntfs_mft_record_get_data_size - return number of bytes used in mft record @b * @m: mft record to get the data size of * * Takes the mft record @m and returns the number of bytes used in the record @@ -92,9 +92,9 @@ static __inline__ int ntfs_mft_record_write(const ntfs_volume *vol, * as well but that could in theory be non-existent (don't know if Windows' * NTFS driver/chkdsk wouldn't view this as corruption in itself though). */ -static __inline__ u32 ntfs_get_mft_record_data_size(const MFT_RECORD *m) +static __inline__ u32 ntfs_mft_record_get_data_size(const MFT_RECORD *m) { - if (!m || !is_mft_record(m->magic)) + if (!m || !ntfs_is_mft_record(m->magic)) return 0; /* Get the number of used bytes and return it. */ return le32_to_cpu(m->bytes_in_use); diff --git a/include/mst.h b/include/mst.h index 860c070c..0808b3c1 100644 --- a/include/mst.h +++ b/include/mst.h @@ -1,10 +1,8 @@ /* - * $Id$ - * * mst.h - Exports for multi sector transfer fixup functions. Part of the * Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -28,9 +26,9 @@ #include "types.h" #include "layout.h" -extern int ntfs_post_read_mst_fixup(NTFS_RECORD *b, const u32 size); -extern int ntfs_pre_write_mst_fixup(NTFS_RECORD *b, const u32 size); -extern void ntfs_post_write_mst_fixup(NTFS_RECORD *b); +extern int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size); +extern int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size); +extern void ntfs_mst_post_write_fixup(NTFS_RECORD *b); #endif /* defined _NTFS_MST_H */ diff --git a/include/runlist.h b/include/runlist.h index 8eb071e7..62ad9431 100644 --- a/include/runlist.h +++ b/include/runlist.h @@ -1,10 +1,8 @@ /* - * $Id$ - * * runlist.h - Exports for runlist handling. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov. - * Copyright (c) 2002 Richard Russon. + * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -56,13 +54,13 @@ extern LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn); extern s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, const s64 pos, s64 count, void *b); -extern runlist_element *ntfs_merge_runlists(runlist_element *drl, +extern runlist_element *ntfs_runlists_merge(runlist_element *drl, runlist_element *srl); -extern runlist_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, +extern runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, const ATTR_RECORD *attr, runlist_element *old_rl); -extern int ntfs_build_mapping_pairs(const ntfs_volume *vol, s8 *dst, +extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, const int dst_len, const runlist_element *rl); #endif /* defined _NTFS_RUNLIST_H */ diff --git a/include/support.h b/include/support.h index c5af6ad3..22c6af2d 100644 --- a/include/support.h +++ b/include/support.h @@ -1,9 +1,7 @@ /* - * $Id$ - * * support.h - Useful definitions and macros. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published diff --git a/include/types.h b/include/types.h index 81352e3b..58e3d91e 100644 --- a/include/types.h +++ b/include/types.h @@ -1,10 +1,8 @@ /* - * $Id$ - * * types.h - Misc type definitions not related to on-disk structure. Part of * the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published diff --git a/include/unistr.h b/include/unistr.h index 2f3690cc..73c99f2c 100644 --- a/include/unistr.h +++ b/include/unistr.h @@ -1,10 +1,8 @@ /* - * $Id$ - * * unistr.h - Exports for unicode string handling. Part of the Linux-NTFS * project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -30,11 +28,11 @@ extern const u8 legal_ansi_char_array[0x40]; -extern BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len, +extern BOOL ntfs_names_are_equal(const uchar_t *s1, size_t s1_len, const uchar_t *s2, size_t s2_len, const IGNORE_CASE_BOOL ic, const uchar_t *upcase, const u32 upcase_size); -extern int ntfs_collate_names(const uchar_t *name1, const u32 name1_len, +extern int ntfs_names_collate(const uchar_t *name1, const u32 name1_len, const uchar_t *name2, const u32 name2_len, const int err_val, const IGNORE_CASE_BOOL ic, const uchar_t *upcase, const u32 upcase_len); @@ -44,7 +42,7 @@ extern int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n); extern int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, const uchar_t *upcase, const u32 upcase_size); -extern void ntfs_upcase_name(uchar_t *name, u32 name_len, +extern void ntfs_name_upcase(uchar_t *name, u32 name_len, const uchar_t *upcase, const u32 upcase_len); extern void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr, diff --git a/include/volume.h b/include/volume.h index 0b419494..c9d3c4aa 100644 --- a/include/volume.h +++ b/include/volume.h @@ -1,9 +1,7 @@ /* - * $Id$ - * * volume.h - Exports for NTFS volume handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -141,14 +139,14 @@ struct _ntfs_volume { table. */ }; -extern ntfs_volume *ntfs_startup_volume(const char *name, unsigned long rwflag); +extern ntfs_volume *ntfs_volume_startup(const char *name, unsigned long rwflag); extern ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag); extern int ntfs_umount(ntfs_volume *vol, const BOOL force); -extern int ntfs_is_version_supported(ntfs_volume *vol); -extern int ntfs_reset_logfile(ntfs_volume *vol); -extern int ntfs_set_volume_flags(ntfs_volume *v, const u16 flags); +extern int ntfs_version_is_supported(ntfs_volume *vol); +extern int ntfs_logfile_reset(ntfs_volume *vol); +extern int ntfs_volume_set_flags(ntfs_volume *v, const u16 flags); #endif /* defined _NTFS_VOLUME_H */ diff --git a/libntfs/attrib.c b/libntfs/attrib.c index fe2a20bb..1abd25b3 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1,8 +1,8 @@ /* * attrib.c - Attribute handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. - * Copyright (C) 2002 Richard Russon. + * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2002 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -39,9 +39,9 @@ uchar_t AT_UNNAMED[] = { const_cpu_to_le16('\0') }; /** - * get_attribute_value_length + * ntfs_get_attribute_value_length */ -s64 get_attribute_value_length(const ATTR_RECORD *a) +s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a) { if (!a) { errno = EINVAL; @@ -57,9 +57,9 @@ s64 get_attribute_value_length(const ATTR_RECORD *a) } /** - * get_attribute_value + * ntfs_get_attribute_value */ -s64 get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, +s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, const ATTR_RECORD *a, u8 *b) { /* Sanity checks. */ @@ -98,7 +98,7 @@ s64 get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, * FIXME: What about attribute lists?!? (AIA) */ /* Decompress the mapping pairs array into a runlist. */ - rl = ntfs_decompress_mapping_pairs(vol, a, NULL); + rl = ntfs_mapping_pairs_decompress(vol, a, NULL); if (!rl) { errno = EINVAL; return 0; @@ -330,13 +330,13 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, return NULL; __ntfs_attr_init(na, ni, type, name, name_len); - ctx = ntfs_get_attr_search_ctx(ni, NULL); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { err = errno; goto err_out; } - if (ntfs_lookup_attr(type, name, name_len, 0, 0, NULL, 0, ctx)) { + if (ntfs_attr_lookup(type, name, name_len, 0, 0, NULL, 0, ctx)) { err = errno; goto put_err_out; } @@ -360,10 +360,10 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, } ntfs_attr_init(na, FALSE, FALSE, FALSE, FALSE, l, l, l, 0, 0); } - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); return na; put_err_out: - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); err_out: errno = err; return NULL; @@ -404,27 +404,27 @@ int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn) __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type, (long long)vcn); - ctx = ntfs_get_attr_search_ctx(na->ni, NULL); + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) return -1; /* Find the attribute in the mft record. */ - if (!ntfs_lookup_attr(na->type, na->name, na->name_len, CASE_SENSITIVE, + if (!ntfs_attr_lookup(na->type, na->name, na->name_len, CASE_SENSITIVE, vcn, NULL, 0, ctx)) { runlist_element *rl; /* Decode the runlist. */ - rl = ntfs_decompress_mapping_pairs(na->ni->vol, ctx->attr, + rl = ntfs_mapping_pairs_decompress(na->ni->vol, ctx->attr, na->rl); if (rl) { na->rl = rl; - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); return 0; } } err = errno; - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); errno = err; return -1; } @@ -620,15 +620,15 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) ntfs_attr_search_ctx *ctx; char *val; - ctx = ntfs_get_attr_search_ctx(na->ni, NULL); + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) return -1; - if (ntfs_lookup_attr(na->type, na->name, na->name_len, 0, + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, ctx)) { int eo; res_err_out: eo = errno; - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); errno = eo; return -1; } @@ -640,7 +640,7 @@ res_err_out: goto res_err_out; } memcpy(b, val + pos, count); - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); return count; } total = total2 = 0; @@ -801,10 +801,10 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) if (!NAttrNonResident(na)) { char *val; - ctx = ntfs_get_attr_search_ctx(na->ni, NULL); + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) goto err_out; - if (ntfs_lookup_attr(na->type, na->name, na->name_len, 0, + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, ctx)) goto err_out; val = (char*)ctx->attr + le16_to_cpu(ctx->attr->value_offset); @@ -826,7 +826,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) */ goto err_out; } - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); return count; } total = 0; @@ -845,10 +845,10 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) /* Handle writes beyond initialized_size. */ if (pos + count > na->initialized_size) { /* Set initialized_size to @pos + @count. */ - ctx = ntfs_get_attr_search_ctx(na->ni, NULL); + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) goto err_out; - if (ntfs_lookup_attr(na->type, na->name, na->name_len, 0, + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, ctx)) goto err_out; /* If write starts beyond initialized_size, zero the gap. */ @@ -877,7 +877,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) goto err_out; } na->initialized_size = pos + count; - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); ctx = NULL; /* * NOTE: At this point the initialized_size in the mft record @@ -975,7 +975,7 @@ retry: } done: if (ctx) - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); /* Finally, return the number of bytes written. */ return total; rl_err_out: @@ -999,13 +999,13 @@ err_out: err = 0; if (!ctx) { - ctx = ntfs_get_attr_search_ctx(na->ni, NULL); + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) err = 1; } else - ntfs_reinit_attr_search_ctx(ctx); + ntfs_attr_reinit_search_ctx(ctx); if (!err) { - err = ntfs_lookup_attr(na->type, na->name, + err = ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, ctx); if (!err) { na->initialized_size = old_initialized_size; @@ -1026,7 +1026,7 @@ err_out: } } if (ctx) - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); errno = eo; return -1; } @@ -1078,7 +1078,7 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, return br; br /= bk_size; for (end = (u8*)b + br * bk_size; (u8*)b < end; (u8*)b += bk_size) - ntfs_post_read_mst_fixup((NTFS_RECORD*)b, bk_size); + ntfs_mst_post_read_fixup((NTFS_RECORD*)b, bk_size); /* Finally, return the number of blocks read. */ return br; } @@ -1131,7 +1131,7 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, for (i = 0; i < bk_cnt; ++i) { int err; - err = ntfs_pre_write_mst_fixup((NTFS_RECORD*) + err = ntfs_mst_pre_write_fixup((NTFS_RECORD*) ((u8*)b + i * bk_size), bk_size); if (err < 0) { /* Abort write at this position. */ @@ -1145,7 +1145,7 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, written = ntfs_attr_pwrite(na, pos, bk_cnt * bk_size, b); /* Quickly deprotect the data again. */ for (i = 0; i < bk_cnt; ++i) - ntfs_post_write_mst_fixup((NTFS_RECORD*)((u8*)b + i * bk_size)); + ntfs_mst_post_write_fixup((NTFS_RECORD*)((u8*)b + i * bk_size)); if (written <= 0) return written; /* Finally, return the number of complete blocks written. */ @@ -1155,7 +1155,7 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, /** * Internal: * - * ntfs_find_attr - find (next) attribute in mft record + * ntfs_attr_find - find (next) attribute in mft record * @type: attribute type to find * @name: attribute name to find (optional, i.e. NULL means don't care) * @name_len: attribute name length (only needed if @name present) @@ -1166,11 +1166,11 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, * * You shouldn't need to call this function directly. Use lookup_attr() instead. * - * ntfs_find_attr() takes a search context @ctx as parameter and searches the + * ntfs_attr_find() takes a search context @ctx as parameter and searches the * mft record specified by @ctx->mrec, beginning at @ctx->attr, for an - * attribute of @type, optionally @name and @val. If found, ntfs_find_attr() + * attribute of @type, optionally @name and @val. If found, ntfs_attr_find() * returns 0 and @ctx->attr will point to the found attribute. If not found, - * ntfs_find_attr() returns -1, with errno set to the error code and @ctx->attr + * ntfs_attr_find() returns -1, with errno set to the error code and @ctx->attr * is undefined (i.e. do not rely on it not changing). * * If @ctx->is_first is TRUE, the search begins with @ctx->attr itself. If it @@ -1178,15 +1178,15 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, * * If @type is zero (i.e. AT_UNUSED), return the first found attribute, i.e. * one can enumerate all attributes by setting @type to zero and then calling - * ntfs_find_attr() repeatedly until it returns -1 with errno set to ENOENT to + * ntfs_attr_find() repeatedly until it returns -1 with errno set to ENOENT to * indicate that there are no more entries. During the enumeration, each - * successful call of ntfs_find_attr() will return the next attribute in the + * successful call of ntfs_attr_find() will return the next attribute in the * mft record @ctx->mrec. * * If @type is AT_END, seek to the end and return -1 with errno set to ENOENT. * AT_END is not a valid attribute, its length is zero for example, thus it is * safer to return error instead of success in this case. This also allows us - * to interoperate cleanly with ntfs_find_external_attr(). + * to interoperate cleanly with ntfs_external_attr_find(). * * If @name is AT_UNNAMED search for an unnamed attribute. If @name is present * but not AT_UNNAMED search for a named attribute matching @name. Otherwise, @@ -1205,11 +1205,11 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, * Finally, the resident attribute value @val is looked for, if present. * If @val is not present (NULL), @val_len is ignored. * - * ntfs_find_attr() only searches the specified mft record and it ignores the + * ntfs_attr_find() only searches the specified mft record and it ignores the * presence of an attribute list attribute (unless it is the one being searched * for, obviously). If you need to take attribute lists into consideration, use - * ntfs_lookup_attr() instead (see below). This also means that you cannot use - * ntfs_find_attr() to search for extent records of non-resident attributes, as + * ntfs_attr_lookup() instead (see below). This also means that you cannot use + * ntfs_attr_find() to search for extent records of non-resident attributes, as * extents with lowest_vcn != 0 are usually described by the attribute list * attribute only. - Note that it is possible that the first extent is only in * the attribute list while the last extent is in the base mft record, so don't @@ -1218,7 +1218,7 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, * Warning: Never use @val when looking for attribute types which can be * non-resident as this most likely will result in a crash! */ -static int ntfs_find_attr(const ATTR_TYPES type, const uchar_t *name, +static int ntfs_attr_find(const ATTR_TYPES type, const uchar_t *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) { @@ -1279,12 +1279,12 @@ static int ntfs_find_attr(const ATTR_TYPES type, const uchar_t *name, errno = ENOENT; return -1; } - } else if (name && !ntfs_are_names_equal(name, name_len, + } else if (name && !ntfs_names_are_equal(name, name_len, (uchar_t*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, ic, upcase, upcase_len)) { register int rc; - rc = ntfs_collate_names(name, name_len, + rc = ntfs_names_collate(name, name_len, (uchar_t*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, 1, IGNORE_CASE, @@ -1300,7 +1300,7 @@ static int ntfs_find_attr(const ATTR_TYPES type, const uchar_t *name, /* If the strings are not equal, continue search. */ if (rc) continue; - rc = ntfs_collate_names(name, name_len, + rc = ntfs_names_collate(name, name_len, (uchar_t*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, 1, CASE_SENSITIVE, @@ -1345,7 +1345,7 @@ static int ntfs_find_attr(const ATTR_TYPES type, const uchar_t *name, } } } - Dputs("ntfs_find_attr(): File is corrupt. Run chkdsk."); + Dputs("ntfs_attr_find(): File is corrupt. Run chkdsk."); errno = EIO; return -1; } @@ -1353,7 +1353,7 @@ static int ntfs_find_attr(const ATTR_TYPES type, const uchar_t *name, /** * Internal: * - * ntfs_find_external_attr - find an attribute in the attribute list of an inode + * ntfs_external_attr_find - find an attribute in the attribute list of an inode * @type: attribute type to find * @name: attribute name to find (optional, i.e. NULL means don't care) * @name_len: attribute name length (only needed if @name present) @@ -1363,7 +1363,7 @@ static int ntfs_find_attr(const ATTR_TYPES type, const uchar_t *name, * @val_len: attribute value length * @ctx: search context with mft record and attribute to search from * - * You shouldn't need to call this function directly. Use ntfs_lookup_attr() + * You shouldn't need to call this function directly. Use ntfs_attr_lookup() * instead. * * Find an attribute by searching the attribute list for the corresponding @@ -1373,9 +1373,9 @@ static int ntfs_find_attr(const ATTR_TYPES type, const uchar_t *name, * * If @type is zero (i.e. AT_UNUSED), return the first found attribute, i.e. * one can enumerate all attributes by setting @type to zero and then calling - * ntfs_find_external_attr() repeatedly until it returns -1 with errno set to + * ntfs_external_attr_find() repeatedly until it returns -1 with errno set to * ENOENT to indicate that there are no more entries. During the enumeration, - * each successful call of ntfs_find_external_attr() will return the next + * each successful call of ntfs_external_attr_find() will return the next * attribute described by the attribute list of the base mft record described * by the search context @ctx. * @@ -1388,12 +1388,12 @@ static int ntfs_find_attr(const ATTR_TYPES type, const uchar_t *name, * match both named and unnamed attributes. * * On first search @ctx->ntfs_ino must be the inode of the base mft record and - * @ctx must have been obtained from a call to ntfs_get_attr_search_ctx(). + * @ctx must have been obtained from a call to ntfs_attr_get_search_ctx(). * On subsequent calls, @ctx->ntfs_ino can be any extent inode, too * (@ctx->base_ntfs_ino is then the base inode). * * After finishing with the attribute/mft record you need to call - * ntfs_put_attr_search_ctx() to cleanup the search context (unmapping any + * ntfs_attr_put_search_ctx() to cleanup the search context (unmapping any * mapped extent inodes, etc). * * Return 0 if the search was successful and -1 if not, with errno set to the @@ -1416,7 +1416,7 @@ static int ntfs_find_attr(const ATTR_TYPES type, const uchar_t *name, * EIO I/O error or corrupt data structures found. * ENOMEM Not enough memory to allocate necessary buffers. */ -static int ntfs_find_external_attr(ATTR_TYPES type, const uchar_t *name, +static int ntfs_external_attr_find(ATTR_TYPES type, const uchar_t *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) @@ -1495,12 +1495,12 @@ static int ntfs_find_external_attr(ATTR_TYPES type, const uchar_t *name, if (name == AT_UNNAMED) { if (al_name_len) goto not_found; - } else if (name && !ntfs_are_names_equal(al_name, al_name_len, + } else if (name && !ntfs_names_are_equal(al_name, al_name_len, name, name_len, ic, vol->upcase, vol->upcase_len)) { register int rc; - rc = ntfs_collate_names(name, name_len, al_name, + rc = ntfs_names_collate(name, name_len, al_name, al_name_len, 1, IGNORE_CASE, vol->upcase, vol->upcase_len); /* @@ -1514,13 +1514,13 @@ static int ntfs_find_external_attr(ATTR_TYPES type, const uchar_t *name, continue; /* * FIXME: Reverse engineering showed 0, IGNORE_CASE but - * that is inconsistent with ntfs_find_attr(). The + * that is inconsistent with ntfs_attr_find(). The * subsequent rc checks were also different. Perhaps I * made a mistake in one of the two. Need to recheck * which is correct or at least see what is going * on... (AIA) */ - rc = ntfs_collate_names(name, name_len, al_name, + rc = ntfs_names_collate(name, name_len, al_name, al_name_len, 1, CASE_SENSITIVE, vol->upcase, vol->upcase_len); if (rc == -1) @@ -1542,7 +1542,7 @@ static int ntfs_find_external_attr(ATTR_TYPES type, const uchar_t *name, sle64_to_cpu(lowest_vcn) && next_al_entry->type == al_entry->type && next_al_entry->name_length == al_name_len && - ntfs_are_names_equal((uchar_t*)((char*) + ntfs_names_are_equal((uchar_t*)((char*) next_al_entry + next_al_entry->name_offset), next_al_entry->name_length, @@ -1561,7 +1561,7 @@ is_enumeration: } else { /* Mft references do not match. */ /* If there is a mapped extent inode unmap it first. */ if (ni != base_ni) - ntfs_close_inode(ni); + ntfs_inode_close(ni); /* Do we want the base record back? */ if (MREF_LE(al_entry->mft_reference) == base_ni->mft_no) { @@ -1569,7 +1569,7 @@ is_enumeration: ctx->mrec = ctx->base_mrec; } else { /* We want an extent record. */ - ni = ntfs_open_extent_inode(base_ni, + ni = ntfs_extent_inode_open(base_ni, al_entry->mft_reference); if (!ni) { Dperror("Failed to map extent inode"); @@ -1587,14 +1587,14 @@ is_enumeration: * current al_entry. */ /* - * We could call into ntfs_find_attr() to find the right + * We could call into ntfs_attr_find() to find the right * attribute in this mft record but this would be less - * efficient and not quite accurate as ntfs_find_attr() ignores + * efficient and not quite accurate as ntfs_attr_find() ignores * the attribute instance numbers for example which become * important when one plays with attribute lists. Also, because * a proper match has been found in the attribute list entry * above, the comparison can now be optimized. So it is worth - * re-implementing a simplified ntfs_find_attr() here. + * re-implementing a simplified ntfs_attr_find() here. */ a = ctx->attr; /* @@ -1618,7 +1618,7 @@ do_next_attr_loop: */ if (al_entry->type != a->type) break; - if (!ntfs_are_names_equal((uchar_t*)((char*)a + + if (!ntfs_names_are_equal((uchar_t*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, al_name, al_name_len, CASE_SENSITIVE, @@ -1643,7 +1643,7 @@ do_next_attr: } if (ni != base_ni) { if (ni) - ntfs_close_inode(ni); + ntfs_inode_close(ni); ctx->ntfs_ino = base_ni; ctx->mrec = ctx->base_mrec; ctx->attr = ctx->base_attr; @@ -1661,20 +1661,20 @@ not_found: * * FIXME: Do we really want to do this here? Think about it... (AIA) */ - ntfs_reinit_attr_search_ctx(ctx); + ntfs_attr_reinit_search_ctx(ctx); /* * If we were enumerating and reached the end, we can't just use !@type * because that would return the first attribute instead of the last * one. Thus we just change @type to AT_END which causes - * ntfs_find_attr() to seek to the end. + * ntfs_attr_find() to seek to the end. */ if (!type) type = AT_END; - return ntfs_find_attr(type, name, name_len, ic, val, val_len, ctx); + return ntfs_attr_find(type, name, name_len, ic, val, val_len, ctx); } /** - * ntfs_lookup_attr - find an attribute in an ntfs inode + * ntfs_attr_lookup - find an attribute in an ntfs inode * @type: attribute type to find * @name: attribute name to find (optional, i.e. NULL means don't care) * @name_len: attribute name length (only needed if @name present) @@ -1686,30 +1686,30 @@ not_found: * * Find an attribute in an ntfs inode. On first search @ctx->ntfs_ino must * be the base mft record and @ctx must have been obtained from a call to - * ntfs_get_attr_search_ctx(). + * ntfs_attr_get_search_ctx(). * * This function transparently handles attribute lists and @ctx is used to * continue searches where they were left off at. * * If @type is zero (i.e. AT_UNUSED), return the first found attribute, i.e. * one can enumerate all attributes by setting @type to zero and then calling - * ntfs_lookup_attr() repeatedly until it returns -1 with errno set to ENOENT + * ntfs_attr_lookup() repeatedly until it returns -1 with errno set to ENOENT * to indicate that there are no more entries. During the enumeration, each - * successful call of ntfs_lookup_attr() will return the next attribute, with + * successful call of ntfs_attr_lookup() will return the next attribute, with * the current attribute being described by the search context @ctx. * * If @type is AT_END, seek to the end of the attribute and return -1 with * errno set to ENOENT. AT_END is not a valid attribute, its length is zero for * example, thus it is safer to return error instead of success in this case. * It should never ne needed to do this, but we implement the functionality - * because it allows for simpler code inside ntfs_find_external_attr(). + * because it allows for simpler code inside ntfs_external_attr_find(). * * If @name is AT_UNNAMED search for an unnamed attribute. If @name is present * but not AT_UNNAMED search for a named attribute matching @name. Otherwise, * match both named and unnamed attributes. * * After finishing with the attribute/mft record you need to call - * ntfs_put_attr_search_ctx() to cleanup the search context (unmapping any + * ntfs_attr_put_search_ctx() to cleanup the search context (unmapping any * mapped extent inodes, etc). * * Return 0 if the search was successful and -1 if not, with errno set to the @@ -1730,7 +1730,7 @@ not_found: * EIO I/O error or corrupt data structures found. * ENOMEM Not enough memory to allocate necessary buffers. */ -int ntfs_lookup_attr(const ATTR_TYPES type, const uchar_t *name, +int ntfs_attr_lookup(const ATTR_TYPES type, const uchar_t *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) @@ -1746,23 +1746,23 @@ int ntfs_lookup_attr(const ATTR_TYPES type, const uchar_t *name, else base_ni = ctx->ntfs_ino; if (!base_ni || !NInoAttrList(base_ni) || type == AT_ATTRIBUTE_LIST) - return ntfs_find_attr(type, name, name_len, ic, val, val_len, + return ntfs_attr_find(type, name, name_len, ic, val, val_len, ctx); - return ntfs_find_external_attr(type, name, name_len, ic, lowest_vcn, + return ntfs_external_attr_find(type, name, name_len, ic, lowest_vcn, val, val_len, ctx); } /** * Internal: * - * ntfs_init_attr_search_ctx - initialize an attribute search context + * ntfs_attr_init_search_ctx - initialize an attribute search context * @ctx: attribute search context to initialize * @ni: ntfs inode with which to initialize the search context * @mrec: mft record with which to initialize the search context * * Initialize the attribute search context @ctx with @ni and @mrec. */ -static __inline__ void ntfs_init_attr_search_ctx(ntfs_attr_search_ctx *ctx, +static __inline__ void ntfs_attr_init_search_ctx(ntfs_attr_search_ctx *ctx, ntfs_inode *ni, MFT_RECORD *mrec) { if (ni && !mrec) @@ -1780,7 +1780,7 @@ static __inline__ void ntfs_init_attr_search_ctx(ntfs_attr_search_ctx *ctx, } /** - * ntfs_reinit_attr_search_ctx - reinitialize an attribute search context + * ntfs_attr_reinit_search_ctx - reinitialize an attribute search context * @ctx: attribute search context to reinitialize * * Reinitialize the attribute search context @ctx, unmapping an associated @@ -1789,7 +1789,7 @@ static __inline__ void ntfs_init_attr_search_ctx(ntfs_attr_search_ctx *ctx, * This is used when a search for a new attribute is being started to reset * the search context to the beginning. */ -void ntfs_reinit_attr_search_ctx(ntfs_attr_search_ctx *ctx) +void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx) { if (!ctx->base_ntfs_ino) { /* No attribute list. */ @@ -1800,13 +1800,13 @@ void ntfs_reinit_attr_search_ctx(ntfs_attr_search_ctx *ctx) return; } /* Attribute list. */ if (ctx->ntfs_ino != ctx->base_ntfs_ino) - ntfs_close_inode(ctx->ntfs_ino); - ntfs_init_attr_search_ctx(ctx, ctx->base_ntfs_ino, ctx->base_mrec); + ntfs_inode_close(ctx->ntfs_ino); + ntfs_attr_init_search_ctx(ctx, ctx->base_ntfs_ino, ctx->base_mrec); return; } /** - * ntfs_get_attr_search_ctx - allocate/initialize a new attribute search context + * ntfs_attr_get_search_ctx - allocate/initialize a new attribute search context * @ctx: address of pointer in which to return the new search context * @ni: ntfs inode with which to initialize the search context * @mrec: mft record with which to initialize the search context @@ -1824,25 +1824,25 @@ void ntfs_reinit_attr_search_ctx(ntfs_attr_search_ctx *ctx) * If both @ni and @mrec are specified, the mft record is taken from @mrec and * the value of @ni->mrec is ignored. */ -ntfs_attr_search_ctx *ntfs_get_attr_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) +ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) { ntfs_attr_search_ctx *ctx = malloc(sizeof(ntfs_attr_search_ctx)); if (ctx) - ntfs_init_attr_search_ctx(ctx, ni, mrec); + ntfs_attr_init_search_ctx(ctx, ni, mrec); return ctx; } /** - * ntfs_put_attr_search_ctx - release an attribute search context + * ntfs_attr_put_search_ctx - release an attribute search context * @ctx: attribute search context to free * * Release the attribute search context @ctx, unmapping an associated extent * mft record if present. */ -void ntfs_put_attr_search_ctx(ntfs_attr_search_ctx *ctx) +void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) { if (ctx->base_ntfs_ino && ctx->ntfs_ino != ctx->base_ntfs_ino) - ntfs_close_inode(ctx->ntfs_ino); + ntfs_inode_close(ctx->ntfs_ino); free(ctx); return; } diff --git a/libntfs/attrib_RE.txt b/libntfs/attrib_RE.txt index 70caeea5..7df610a2 100644 --- a/libntfs/attrib_RE.txt +++ b/libntfs/attrib_RE.txt @@ -47,7 +47,7 @@ typedef struct { u8 *alist_old_base; } attr_search_context; -BOOL find_attr(const ntfs_volume *vol, const ATTR_TYPES type, +BOOL attr_find(const ntfs_volume *vol, const ATTR_TYPES type, const wchar_t *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) @@ -56,7 +56,7 @@ BOOL find_attr(const ntfs_volume *vol, const ATTR_TYPES type, #ifdef DEBUG if (!vol || !ctx || !ctx->mrec || !ctx->attr) { - printf(stderr, "find_attr() received NULL pointer!\n"); + printf(stderr, "attr_find() received NULL pointer!\n"); return FALSE; } #endif @@ -102,11 +102,11 @@ found_it: goto do_next; goto not_found; } - if (ntfs_are_names_equal(name, name_len, + if (ntfs_names_are_equal(name, name_len, (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, ic, vol->upcase, vol->upcase_len)) goto found_it; - { register int rc = ntfs_collate_names(vol->upcase, + { register int rc = ntfs_names_collate(vol->upcase, vol->upcase_len, name, name_len, (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, IGNORE_CASE, 1); @@ -120,7 +120,7 @@ found_it: } /* If case sensitive collation of names doesn't collate @name before a->name, we continue the search. Otherwise we haven't found it. */ - if (ntfs_collate_names(vol->upcase, vol->upcase_len, name, name_len, + if (ntfs_names_collate(vol->upcase, vol->upcase_len, name, name_len, (wchar_t*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, CASE_SENSITIVE, 1) != -1) goto do_next; @@ -133,7 +133,7 @@ file_corrupt: goto not_found; } -BOOL lookup_external_attr(const ntfs_volume *vol, const MFT_REFERENCE mref, +BOOL external_attr_lookup(const ntfs_volume *vol, const MFT_REFERENCE mref, const ATTR_TYPES type, const wchar_t *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const s64 lowest_vcn, const u8 *val, @@ -186,7 +186,7 @@ already_have_the_base_and_is_first: if (ntfs_file_record_read(vol, mref, &ctx->mrec, &ctx->attr) < 0) return FALSE; ctx->base = ctx->mrec; - find_attr(vol, type, name, name_len, ic, val, val_len, ctx); + attr_find(vol, type, name, name_len, ic, val, val_len, ctx); return FALSE; al_pos_below_alist_val_end: if (al_pos < ctx->alist_val) @@ -212,15 +212,15 @@ compare_names: else rc = FALSE; } else /* IGNORE_CASE */ - rc = ntfs_are_names_equal(al_name, al_name_len, name, name_len, + rc = ntfs_names_are_equal(al_name, al_name_len, name, name_len, ic, vol->upcase, vol->upcase_len); if (rc) goto compare_lowest_vcn; - rc = ntfs_collate_names(vol->upcase, vol->upcase_len, name, name_len, + rc = ntfs_names_collate(vol->upcase, vol->upcase_len, name, name_len, al_name, al_name_len, IGNORE_CASE, 1); if (rc == -1) goto name_collates_before_al_name; - if (!rc && ntfs_collate_names(vol->upcase, vol->upcase_len, name, + if (!rc && ntfs_names_collate(vol->upcase, vol->upcase_len, name, name_len, al_name, al_name_len, IGNORE_CASE, 0) == -1) goto name_collates_before_al_name; @@ -313,7 +313,7 @@ loc_5217c: if (ntfs_file_record_read(vol, mref, &mrec, &ctx->attr) < 0) return FALSE; ctx->base = mrec; - find_attr(vol, type, name, name_len, ic, val, val_len, ctx); + attr_find(vol, type, name, name_len, ic, val, val_len, ctx); return FALSE; file_corrupt: #ifdef DEBUG @@ -322,7 +322,7 @@ file_corrupt: return FALSE; } -BOOL lookup_attr(const ntfs_volume *vol, const MFT_REFERENCE *mref, +BOOL attr_lookup(const ntfs_volume *vol, const MFT_REFERENCE *mref, const ATTR_TYPES type, const wchar_t *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const s64 lowest_vcn, const u8 *val, const u32 val_len, @@ -366,7 +366,7 @@ no_attr_list: a->type == AT_STANDARD_INFORMATION) goto found_it; call_find_attr: - return find_attr(vol, type, name, name_len, ic, val, val_len, ctx); + return attr_find(vol, type, name, name_len, ic, val, val_len, ctx); found_it: ctx->attr = a; return TRUE; @@ -405,7 +405,7 @@ search_attr_list: * "a" contains the attribute list attribute at this stage. */ ctx->alist_attr = a; - len = get_attribute_value_length(a); + len = ntfs_get_attribute_value_length(a); #ifdef DEBUG if (len > 0x40000LL) { printf(stderr, "lookup_attr() found corrupt attribute list.\n"); @@ -420,7 +420,7 @@ search_attr_list: #endif return FALSE; } - if (get_attribute_value(vol, ctx->mrec, a, ctx->alist_val) != + if (ntfs_get_attribute_value(vol, ctx->mrec, a, ctx->alist_val) != ctx->alist_val_len) { #ifdef DEBUG printf(stderr, "lookup_attr() failed to read attribute list " @@ -438,11 +438,11 @@ search_attr_list: ctx->base = NULL; } lookup_external: - return lookup_external_attr(vol, mref, type, name, name_len, ic, + return external_attr_lookup(vol, mref, type, name, name_len, ic, lowest_vcn, val, val_len, ctx); file_corrupt: #ifdef DEBUG - fprintf(stderr, "lookup_attr() encountered corrupt file record.\n"); + fprintf(stderr, "attr_lookup() encountered corrupt file record.\n"); #endif return FALSE; } diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index 0d9f8125..900c4615 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -1,7 +1,7 @@ /* * bootsect.c - Boot sector handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000,2001 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -28,7 +28,7 @@ #include "debug.h" /** - * is_boot_sector_ntfs - check if a buffer contains a valid ntfs boot sector + * ntfs_boot_sector_is_ntfs - check if buffer contains a valid ntfs boot sector * @b: buffer containing putative boot sector to analyze * @silent: if zero, output progress messages to stdout * @@ -41,7 +41,7 @@ * * Return TRUE if @b contains a valid ntfs boot sector and FALSE if not. */ -BOOL is_boot_sector_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent) +BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent) { u32 i; @@ -166,7 +166,7 @@ not_ntfs: } /** - * parse_ntfs_boot_sector - setup an ntfs volume from an ntfs boot sector + * ntfs_boot_sector_parse - setup an ntfs volume from an ntfs boot sector * @vol: ntfs_volume to setup * @bs: buffer containing ntfs boot sector to parse * @@ -175,7 +175,7 @@ not_ntfs: * * Return 0 on success or -1 on error with errno set to the error code EINVAL. */ -int parse_ntfs_boot_sector(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) +int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) { u8 sectors_per_cluster; s8 c; diff --git a/libntfs/compat.c b/libntfs/compat.c index 894f9b95..c23616ff 100644 --- a/libntfs/compat.c +++ b/libntfs/compat.c @@ -1,7 +1,8 @@ /* * compat.c - Tweaks for Windows compatability * - * Copyright (c) 2002 Richard Russon. + * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -23,7 +24,9 @@ #include "compat.h" -int ffs (int x) +// TODO: Add check for FFS in the configure script... (AIA) +#ifndef HAVE_FFS +int ffs(int x) { int r = 1; @@ -51,6 +54,7 @@ int ffs (int x) } return r; } +#endif /* HAVE_FFS */ #endif /* WINDOWS */ diff --git a/libntfs/debug.c b/libntfs/debug.c index 34e1cb7c..efe309af 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -1,7 +1,7 @@ /* * debug.c - Debugging output functions. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov. + * Copyright (c) 2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -23,9 +23,9 @@ #ifdef DEBUG /** - * ntfs_debug_dump_runlist - Dump a runlist. + * ntfs_debug_runlist_dump - Dump a runlist. */ -void ntfs_debug_dump_runlist(const runlist_element *rl) +void ntfs_debug_runlist_dump(const runlist_element *rl) { int i = 0; const char *lcn_str[5] = { "LCN_HOLE ", "LCN_RL_NOT_MAPPED", diff --git a/libntfs/dir.c b/libntfs/dir.c index e9bd2178..b7d94263 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1,7 +1,7 @@ /* * dir.c - Directory handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov. + * Copyright (c) 2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -38,13 +38,13 @@ uchar_t I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'), const_cpu_to_le16('\0') }; /** - * ntfs_lookup_inode_by_name - find an inode in a directory given its name + * ntfs_inode_lookup_by_name - find an inode in a directory given its name * @dir_ni: ntfs inode of the directory in which to search for the name * @uname: Unicode name for which to search in the directory * @uname_len: length of the name @uname in Unicode characters * * Look for an inode with name @uname in the directory with inode @dir_ni. - * ntfs_lookup_inode_by_name() walks the contents of the directory looking for + * ntfs_inode_lookup_by_name() walks the contents of the directory looking for * the Unicode name. If the name is found in the directory, the corresponding * inode number (>= 0) is returned as a mft reference in cpu format, i.e. it * is a 64-bit number containing the sequence number. @@ -62,7 +62,7 @@ uchar_t I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'), * If the volume is mounted with the case sensitive flag set, then we only * allow exact matches. */ -u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, +u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const uchar_t *uname, const int uname_len) { VCN vcn; @@ -84,12 +84,12 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, return -1; } - ctx = ntfs_get_attr_search_ctx(dir_ni, NULL); + ctx = ntfs_attr_get_search_ctx(dir_ni, NULL); if (!ctx) return -1; /* Find the index root attribute in the mft record. */ - if (!ntfs_lookup_attr(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, + if (!ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 0, ctx)) { Dprintf("Index root attribute missing in directory inode " "0x%Lx: %s\n", @@ -134,7 +134,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const uchar_t *uname, * consistency checking). We convert it to cpu format before * returning. */ - if (ntfs_are_names_equal(uname, uname_len, + if (ntfs_names_are_equal(uname, uname_len, (uchar_t*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, CASE_SENSITIVE, vol->upcase, vol->upcase_len)) { @@ -144,7 +144,7 @@ found_it: * about having matched imperfectly before. */ mref = le64_to_cpu(ie->indexed_file); - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); return mref; } /* @@ -155,7 +155,7 @@ found_it: */ if (!NVolCaseSensitive(vol) && ie->key.file_name.file_name_type && - ntfs_are_names_equal(uname, uname_len, + ntfs_names_are_equal(uname, uname_len, (uchar_t*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, IGNORE_CASE, vol->upcase, vol->upcase_len)) { @@ -175,7 +175,7 @@ found_it: * Not a perfect match, need to do full blown collation so we * know which way in the B+tree we have to go. */ - rc = ntfs_collate_names(uname, uname_len, + rc = ntfs_names_collate(uname, uname_len, (uchar_t*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, 1, IGNORE_CASE, vol->upcase, vol->upcase_len); @@ -194,7 +194,7 @@ found_it: * case sensitive comparison, which is required for proper * collation. */ - rc = ntfs_collate_names(uname, uname_len, + rc = ntfs_names_collate(uname, uname_len, (uchar_t*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, 1, CASE_SENSITIVE, vol->upcase, vol->upcase_len); @@ -216,7 +216,7 @@ found_it: * cached in mref in which case return mref. */ if (!(ie->flags & INDEX_ENTRY_NODE)) { - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (mref) return mref; Dputs("Entry not found."); @@ -325,7 +325,7 @@ descend_into_child_node: * consistency checking). We convert it to cpu format before * returning. */ - if (ntfs_are_names_equal(uname, uname_len, + if (ntfs_names_are_equal(uname, uname_len, (uchar_t*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, CASE_SENSITIVE, vol->upcase, vol->upcase_len)) { @@ -336,7 +336,7 @@ found_it2: */ mref = le64_to_cpu(ie->indexed_file); ntfs_attr_close(ia_na); - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); return mref; } /* @@ -347,7 +347,7 @@ found_it2: */ if (!NVolCaseSensitive(vol) && ie->key.file_name.file_name_type && - ntfs_are_names_equal(uname, uname_len, + ntfs_names_are_equal(uname, uname_len, (uchar_t*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, IGNORE_CASE, vol->upcase, vol->upcase_len)) { @@ -367,7 +367,7 @@ found_it2: * Not a perfect match, need to do full blown collation so we * know which way in the B+tree we have to go. */ - rc = ntfs_collate_names(uname, uname_len, + rc = ntfs_names_collate(uname, uname_len, (uchar_t*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, 1, IGNORE_CASE, vol->upcase, vol->upcase_len); @@ -386,7 +386,7 @@ found_it2: * case sensitive comparison, which is required for proper * collation. */ - rc = ntfs_collate_names(uname, uname_len, + rc = ntfs_names_collate(uname, uname_len, (uchar_t*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, 1, CASE_SENSITIVE, vol->upcase, vol->upcase_len); @@ -423,7 +423,7 @@ found_it2: goto close_err_out; } ntfs_attr_close(ia_na); - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); /* * No child node present, return error code ENOENT, unless we have got * the mft reference of a matching name cached in mref in which case @@ -438,7 +438,7 @@ put_err_out: eo = EIO; Dputs("Corrupt directory. Aborting lookup."); eo_put_err_out: - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); errno = eo; return -1; close_err_out: @@ -514,7 +514,7 @@ static inline int ntfs_filldir(ntfs_inode *dir_ni, s64 *pos, u8 ivcn_bits, /** * Internal: * - * ntfs_get_parent_mft_ref - find mft reference of parent directory of an inode + * ntfs_mft_get_parent_ref - find mft reference of parent directory of an inode * @ni: ntfs inode whose parent directory to find * * Find the parent directory of the ntfs inode @ni. To do this, find the first @@ -531,7 +531,7 @@ static inline int ntfs_filldir(ntfs_inode *dir_ni, s64 *pos, u8 ivcn_bits, * Return the mft reference of the parent directory on success or -1 on error * with errno set to the error code. */ -static MFT_REF ntfs_get_parent_mft_ref(ntfs_inode *ni) +static MFT_REF ntfs_mft_get_parent_ref(ntfs_inode *ni) { MFT_REF mref; ntfs_attr_search_ctx *ctx; @@ -543,10 +543,10 @@ static MFT_REF ntfs_get_parent_mft_ref(ntfs_inode *ni) return -1; } - ctx = ntfs_get_attr_search_ctx(ni, NULL); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) return -1; - if (ntfs_lookup_attr(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { Dprintf("No file name found in inode 0x%Lx. Corrupt inode.\n", (unsigned long long)ni->mft_no); goto err_out; @@ -565,13 +565,13 @@ static MFT_REF ntfs_get_parent_mft_ref(ntfs_inode *ni) goto io_err_out; } mref = le64_to_cpu(fn->parent_directory); - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); return mref; io_err_out: errno = EIO; err_out: eo = errno; - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); errno = eo; return -1; } @@ -651,7 +651,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, if (*pos == 1) { MFT_REF parent_mref; - parent_mref = ntfs_get_parent_mft_ref(dir_ni); + parent_mref = ntfs_mft_get_parent_ref(dir_ni); if (parent_mref == -1) { Dprintf("Parent directory not found: %s\n", errno); goto dir_err_out; @@ -664,14 +664,14 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, ++*pos; } - ctx = ntfs_get_attr_search_ctx(dir_ni, NULL); + ctx = ntfs_attr_get_search_ctx(dir_ni, NULL); if (!ctx) goto err_out; /* Get the offset into the index root attribute. */ ir_pos = (int)*pos; /* Find the index root attribute in the mft record. */ - if (!ntfs_lookup_attr(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, + if (!ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 0, ctx)) { Dprintf("Index root attribute missing in directory inode " "0x%Lx.\n", (unsigned long long)dir_ni->mft_no); @@ -699,7 +699,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, /* Are we jumping straight into the index allocation attribute? */ if (*pos >= vol->mft_record_size) { - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); ctx = NULL; goto skip_index_root; } @@ -734,12 +734,12 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, rc = ntfs_filldir(dir_ni, pos, index_vcn_size_bits, INDEX_TYPE_ROOT, ir, ie, dirent, filldir); if (rc) { - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); ctx = NULL; goto done; } } - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); ctx = NULL; /* If there is no index allocation attribute we are finished. */ @@ -913,7 +913,7 @@ err_out: eo = errno; Dprintf("%s() failed.\n", __FUNCTION__); if (ctx) - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (bmp_na) ntfs_attr_close(bmp_na); ntfs_attr_close(ia_na); diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index 806db398..28ba6453 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -1,7 +1,7 @@ /* * disk_io.c - Disk io functions. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -191,7 +191,7 @@ s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, */ count = br / bksize; for (i = 0; i < count; ++i) - ntfs_post_read_mst_fixup((NTFS_RECORD*) + ntfs_mst_post_read_fixup((NTFS_RECORD*) ((u8*)b + i * bksize), bksize); /* Finally, return the number of complete blocks read. */ return count; @@ -242,7 +242,7 @@ s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, for (i = 0; i < count; ++i) { int err; - err = ntfs_pre_write_mst_fixup((NTFS_RECORD*) + err = ntfs_mst_pre_write_fixup((NTFS_RECORD*) ((u8*)b + i * bksize), bksize); if (err < 0) { /* Abort write at this position. */ @@ -256,7 +256,7 @@ s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, written = ntfs_pwrite(fd, pos, count * bksize, b); /* Quickly deprotect the data again. */ for (i = 0; i < count; ++i) - ntfs_post_write_mst_fixup((NTFS_RECORD*)((u8*)b + i * bksize)); + ntfs_mst_post_write_fixup((NTFS_RECORD*)((u8*)b + i * bksize)); if (written <= 0) return written; /* Finally, return the number of complete blocks written. */ @@ -264,7 +264,7 @@ s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, } /** - * ntfs_read_clusters - read ntfs clusters + * ntfs_clusters_read - read ntfs clusters * @vol: volume to read from * @lcn: starting logical cluster number * @count: number of clusters to read @@ -274,7 +274,7 @@ s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, * volume @vol into buffer @b. Return number of clusters read or -1 on error, * with errno set to the error code. */ -s64 ntfs_read_clusters(const ntfs_volume *vol, const s64 lcn, +s64 ntfs_clusters_read(const ntfs_volume *vol, const s64 lcn, const s64 count, const void *b) { s64 br; @@ -297,7 +297,7 @@ s64 ntfs_read_clusters(const ntfs_volume *vol, const s64 lcn, } /** - * ntfs_write_clusters - write ntfs clusters + * ntfs_clusters_write - write ntfs clusters * @vol: volume to write to * @lcn: starting logical cluster number * @count: number of clusters to write @@ -307,7 +307,7 @@ s64 ntfs_read_clusters(const ntfs_volume *vol, const s64 lcn, * buffer @b to volume @vol. Return the number of clusters written or -1 on * error, with errno set to the error code. */ -s64 ntfs_write_clusters(const ntfs_volume *vol, const s64 lcn, +s64 ntfs_clusters_write(const ntfs_volume *vol, const s64 lcn, const s64 count, const void *b) { s64 bw; diff --git a/libntfs/inode.c b/libntfs/inode.c index fa28c875..7ad85b9c 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -1,7 +1,7 @@ /* * inode.c - Inode handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov. + * Copyright (c) 2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -33,9 +33,9 @@ /** * Internal: * - * __allocate_ntfs_inode - desc + * __ntfs_inode_allocate - desc */ -static __inline__ ntfs_inode *__allocate_ntfs_inode(ntfs_volume *vol) +static __inline__ ntfs_inode *__ntfs_inode_allocate(ntfs_volume *vol) { ntfs_inode *ni; @@ -48,19 +48,19 @@ static __inline__ ntfs_inode *__allocate_ntfs_inode(ntfs_volume *vol) /** * Internal: * - * allocate_ntfs_inode - desc + * ntfs_inode_allocate - desc */ -ntfs_inode *allocate_ntfs_inode(ntfs_volume *vol) +ntfs_inode *ntfs_inode_allocate(ntfs_volume *vol) { - return __allocate_ntfs_inode(vol); + return __ntfs_inode_allocate(vol); } /** * Internal: * - * __release_ntfs_inode - desc + * __ntfs_inode_release - desc */ -static __inline__ int __release_ntfs_inode(ntfs_inode *ni) +static __inline__ int __ntfs_inode_release(ntfs_inode *ni) { if (NInoDirty(ni)) Dputs("Eeek. Discarding dirty inode!"); @@ -75,7 +75,7 @@ static __inline__ int __release_ntfs_inode(ntfs_inode *ni) } /** - * ntfs_open_inode - open an inode ready for access + * ntfs_inode_open - open an inode ready for access * @vol: volume to get the inode from * @mref: inode number / mft record number to open * @@ -99,7 +99,7 @@ static __inline__ int __release_ntfs_inode(ntfs_inode *ni) * Return a pointer to the ntfs_inode structure on success or NULL on error, * with errno set to the error code. */ -ntfs_inode *ntfs_open_inode(ntfs_volume *vol, const MFT_REF mref) +ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) { s64 l; ntfs_inode *ni; @@ -111,7 +111,7 @@ ntfs_inode *ntfs_open_inode(ntfs_volume *vol, const MFT_REF mref) errno = EINVAL; return NULL; } - ni = __allocate_ntfs_inode(vol); + ni = __ntfs_inode_allocate(vol); if (!ni) return NULL; if (ntfs_file_record_read(vol, mref, &ni->mrec, NULL)) @@ -119,18 +119,18 @@ ntfs_inode *ntfs_open_inode(ntfs_volume *vol, const MFT_REF mref) if (!(ni->mrec->flags & MFT_RECORD_IN_USE)) goto err_out; ni->mft_no = MREF(mref); - ctx = ntfs_get_attr_search_ctx(ni, NULL); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) goto err_out; - if (ntfs_lookup_attr(AT_ATTRIBUTE_LIST, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { if (errno != ENOENT) goto put_err_out; /* Attribute list attribute not present so we are done. */ - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); return ni; } NInoSetAttrList(ni); - l = get_attribute_value_length(ctx->attr); + l = ntfs_get_attribute_value_length(ctx->attr); if (!l) goto put_err_out; if (l > 0x40000) { @@ -141,7 +141,7 @@ ntfs_inode *ntfs_open_inode(ntfs_volume *vol, const MFT_REF mref) ni->attr_list = malloc(ni->attr_list_size); if (!ni->attr_list) goto put_err_out; - l = get_attribute_value(vol, ni->mrec, ctx->attr, ni->attr_list); + l = ntfs_get_attribute_value(vol, ni->mrec, ctx->attr, ni->attr_list); if (!l) goto put_err_out; if (l != ni->attr_list_size) { @@ -150,32 +150,32 @@ ntfs_inode *ntfs_open_inode(ntfs_volume *vol, const MFT_REF mref) } if (!ctx->attr->non_resident) { /* Attribute list attribute is resident so we are done. */ - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); return ni; } NInoSetAttrListNonResident(ni); // FIXME: We are duplicating work here! (AIA) - ni->attr_list_rl = ntfs_decompress_mapping_pairs(vol, ctx->attr, NULL); + ni->attr_list_rl = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL); if (ni->attr_list_rl) { /* We got the runlist, so we are done. */ - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); return ni; } err = EIO; put_err_out: if (!err) err = errno; - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); err_out: if (!err) err = errno; - __release_ntfs_inode(ni); + __ntfs_inode_release(ni); errno = err; return NULL; } /** - * ntfs_close_inode - close an ntfs inode and free all associated memory + * ntfs_inode_close - close an ntfs inode and free all associated memory * @ni: ntfs inode to close * * Make sure the ntfs inode @ni is clean. @@ -185,17 +185,17 @@ err_out: * structure itself. * * If it is an extent inode, we postpone to when the base inode is being closed - * with ntfs_close_inode() to tear down all structures and free all allocated + * with ntfs_inode_close() to tear down all structures and free all allocated * memory. That way we keep the extent records cached in memory so we get an * efficient ntfs_lookup_attr(). * * Return 0 on success or -1 on error with errno set to the error code. On * error, @ni has not been freed. The user should attempt to handle the error - * and call ntfs_close_inode() again. The following error codes are defined: + * and call ntfs_inode_close() again. The following error codes are defined: * * EBUSY @ni is dirty and/or the attribute list runlist is dirty. */ -int ntfs_close_inode(ntfs_inode *ni) +int ntfs_inode_close(ntfs_inode *ni) { // TODO: This needs to be replaced with a flush to disk attempt. (AIA) if (NInoDirty(ni) || NInoAttrListDirty(ni)) { @@ -208,14 +208,14 @@ int ntfs_close_inode(ntfs_inode *ni) // FIXME: Handle dirty case for each extent inode! (AIA) for (i = 0; i < ni->nr_extents; i++) - __release_ntfs_inode(ni->extent_nis[i]); + __ntfs_inode_release(ni->extent_nis[i]); free(ni->extent_nis); } - return __release_ntfs_inode(ni); + return __ntfs_inode_release(ni); } /** - * ntfs_open_extent_inode - load an extent inode and attach it to its base + * ntfs_extent_inode_open - load an extent inode and attach it to its base * @base_ni: base ntfs inode * @mref: mft reference of the extent inode to load (in little endian) * @@ -236,7 +236,7 @@ int ntfs_close_inode(ntfs_inode *ni) * pointer to the ntfs_inode structure on success or NULL on error, with errno * set to the error code. */ -ntfs_inode *ntfs_open_extent_inode(ntfs_inode *base_ni, const MFT_REF mref) +ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref) { u64 mft_no = MREF_LE(mref); ntfs_inode *ni; @@ -274,7 +274,7 @@ ntfs_inode *ntfs_open_extent_inode(ntfs_inode *base_ni, const MFT_REF mref) } } /* Wasn't there, we need to load the extent inode. */ - ni = __allocate_ntfs_inode(base_ni->vol); + ni = __ntfs_inode_allocate(base_ni->vol); if (!ni) return NULL; if (ntfs_file_record_read(base_ni->vol, le64_to_cpu(mref), &ni->mrec, @@ -301,7 +301,7 @@ ntfs_inode *ntfs_open_extent_inode(ntfs_inode *base_ni, const MFT_REF mref) return ni; err_out: i = errno; - __release_ntfs_inode(ni); + __ntfs_inode_release(ni); errno = i; Dperror("Failed to open extent inode"); return NULL; diff --git a/libntfs/mft.c b/libntfs/mft.c index 572b837b..695647c8 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -1,7 +1,7 @@ /* * mft.c - Mft record handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -210,7 +210,7 @@ int ntfs_file_record_read(const ntfs_volume *vol, const MFT_REF mref, err = errno; goto read_failed; } - if (!is_file_record(m->magic)) + if (!ntfs_is_file_record(m->magic)) goto file_corrupt; if (MSEQNO(mref) && MSEQNO(mref) != le16_to_cpu(m->sequence_number)) goto file_corrupt; diff --git a/libntfs/mst.c b/libntfs/mst.c index 834fa8a4..d6e0f34e 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -1,7 +1,7 @@ /* * mst.c - Multi sector fixup handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -23,7 +23,7 @@ #include /** - * ntfs_post_read_mst_fixup - deprotect multi sector transfer protected data + * ntfs_mst_post_read_fixup - deprotect multi sector transfer protected data * @b: pointer to the data to deprotect * @size: size in bytes of @b * @@ -37,7 +37,7 @@ * EIO Mulit sector transfer error was detected. Magic of the NTFS * record in @b will have been set to "BAAD". */ -int ntfs_post_read_mst_fixup(NTFS_RECORD *b, const u32 size) +int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size) { u16 usa_ofs, usa_count, usn; u16 *usa_pos, *data_pos; @@ -100,7 +100,7 @@ int ntfs_post_read_mst_fixup(NTFS_RECORD *b, const u32 size) } /** - * ntfs_pre_write_mst_fixup - apply multi sector transfer protection + * ntfs_mst_pre_write_fixup - apply multi sector transfer protection * @b: pointer to the data to protect * @size: size in bytes of @b * @@ -119,13 +119,14 @@ int ntfs_post_read_mst_fixup(NTFS_RECORD *b, const u32 size) * otherwise a random word will be used (whatever was in the record at that * position at that time). */ -int ntfs_pre_write_mst_fixup(NTFS_RECORD *b, const u32 size) +int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size) { u16 usa_ofs, usa_count, usn; u16 *usa_pos, *data_pos; /* Sanity check + only fixup if it makes sense. */ - if (!b || is_baad_record(b->magic) || is_hole_record(b->magic)) { + if (!b || ntfs_is_baad_record(b->magic) || + ntfs_is_hole_record(b->magic)) { errno = EINVAL; return -1; } @@ -169,7 +170,7 @@ int ntfs_pre_write_mst_fixup(NTFS_RECORD *b, const u32 size) } /** - * ntfs_post_write_mst_fixup - deprotect multi sector transfer protected data + * ntfs_mst_post_write_fixup - deprotect multi sector transfer protected data * @b: pointer to the data to deprotect * * Perform the necessary post write multi sector transfer fixup, not checking @@ -177,7 +178,7 @@ int ntfs_pre_write_mst_fixup(NTFS_RECORD *b, const u32 size) * ntfs_pre_write_mst_fixup(), thus the data will be fine or we would never * have gotten here. */ -void ntfs_post_write_mst_fixup(NTFS_RECORD *b) +void ntfs_mst_post_write_fixup(NTFS_RECORD *b) { u16 *usa_pos, *data_pos; diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 95669a00..0fbf2ced 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1,8 +1,8 @@ /* * runlist.c - Run list handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov. - * Copyright (c) 2002 Richard Russon. + * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -87,7 +87,7 @@ static __inline__ runlist_element *ntfs_rl_realloc(runlist_element *rl, /** * Internal: * - * ntfs_are_rl_mergeable - test if two runlists can be joined together + * ntfs_rl_are_mergeable - test if two runlists can be joined together * @dst: original runlist * @src: new runlist to test for mergeability with @dst * @@ -97,11 +97,11 @@ static __inline__ runlist_element *ntfs_rl_realloc(runlist_element *rl, * Return: TRUE Success, the runlists can be merged. * FALSE Failure, the runlists cannot be merged. */ -static __inline__ BOOL ntfs_are_rl_mergeable(runlist_element *dst, +static __inline__ BOOL ntfs_rl_are_mergeable(runlist_element *dst, runlist_element *src) { if (!dst || !src) { - Dputs("Eeek. ntfs_are_rl_mergeable() invoked with NULL " + Dputs("Eeek. ntfs_rl_are_mergeable() invoked with NULL " "pointer!"); return FALSE; } @@ -151,7 +151,7 @@ static __inline__ void __ntfs_rl_merge(runlist_element *dst, static __inline__ BOOL ntfs_rl_merge(runlist_element *dst, runlist_element *src) { - BOOL merge = ntfs_are_rl_mergeable(dst, src); + BOOL merge = ntfs_rl_are_mergeable(dst, src); if (merge) __ntfs_rl_merge(dst, src); @@ -193,7 +193,7 @@ static __inline__ runlist_element *ntfs_rl_append(runlist_element *dst, } /* First, check if the right hand end needs merging. */ - right = ntfs_are_rl_mergeable(src + ssize - 1, dst + loc + 1); + right = ntfs_rl_are_mergeable(src + ssize - 1, dst + loc + 1); /* Space required: @dst size + @src size, less one if we merged. */ dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - right); @@ -270,7 +270,7 @@ static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, else { s64 merged_length; - left = ntfs_are_rl_mergeable(dst + loc - 1, src); + left = ntfs_rl_are_mergeable(dst + loc - 1, src); merged_length = dst[loc - 1].length; if (left) @@ -369,9 +369,9 @@ static __inline__ runlist_element *ntfs_rl_replace(runlist_element *dst, } /* First, merge the left and right ends, if necessary. */ - right = ntfs_are_rl_mergeable(src + ssize - 1, dst + loc + 1); + right = ntfs_rl_are_mergeable(src + ssize - 1, dst + loc + 1); if (loc > 0) - left = ntfs_are_rl_mergeable(dst + loc - 1, src); + left = ntfs_rl_are_mergeable(dst + loc - 1, src); /* Allocate some space. We'll need less if the left, right, or both * ends were merged. */ @@ -454,7 +454,7 @@ static __inline__ runlist_element *ntfs_rl_split(runlist_element *dst, /** - * ntfs_merge_runlists - merge two runlists into one + * ntfs_runlists_merge - merge two runlists into one * @drl: original runlist to be worked on * @srl: new runlist to be merged into @drl * @@ -485,7 +485,7 @@ static __inline__ runlist_element *ntfs_rl_split(runlist_element *dst, * EINVAL Invalid parameters were passed in. * ERANGE The runlists overlap and cannot be merged. */ -runlist_element *ntfs_merge_runlists(runlist_element *drl, +runlist_element *ntfs_runlists_merge(runlist_element *drl, runlist_element *srl) { int di, si; /* Current index into @[ds]rl. */ @@ -498,9 +498,9 @@ runlist_element *ntfs_merge_runlists(runlist_element *drl, VCN marker_vcn = 0; Dputs("dst:"); - ntfs_debug_dump_runlist(drl); + ntfs_debug_runlist_dump(drl); Dputs("src:"); - ntfs_debug_dump_runlist(srl); + ntfs_debug_runlist_dump(srl); /* Check for silly calling... */ if (!srl) @@ -680,7 +680,7 @@ runlist_element *ntfs_merge_runlists(runlist_element *drl, finished: /* The merge was completed successfully. */ Dputs("Merged runlist:"); - ntfs_debug_dump_runlist(drl); + ntfs_debug_runlist_dump(drl); return drl; critical_error: @@ -692,7 +692,7 @@ critical_error: } /** - * ntfs_decompress_mapping_pairs - convert mapping pairs array to runlist + * ntfs_mapping_pairs_decompress - convert mapping pairs array to runlist * @vol: ntfs volume on which the attribute resides * @attr: attribute record whose mapping pairs array to decompress * @old_rl: optional runlist in which to insert @attr's runlist @@ -718,7 +718,7 @@ critical_error: * two into one, if that is possible (we check for overlap and discard the new * runlist if overlap present before returning NULL, with errno = ERANGE). */ -runlist_element *ntfs_decompress_mapping_pairs(const ntfs_volume *vol, +runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, const ATTR_RECORD *attr, runlist_element *old_rl) { VCN vcn; /* Current vcn. */ @@ -912,11 +912,11 @@ mpa_err: /* If no existing runlist was specified, we are done. */ if (!old_rl) { Dputs("Mapping pairs array successfully decompressed:"); - ntfs_debug_dump_runlist(rl); + ntfs_debug_runlist_dump(rl); return rl; } /* Now combine the new and old runlists checking for overlaps. */ - old_rl = ntfs_merge_runlists(old_rl, rl); + old_rl = ntfs_runlists_merge(old_rl, rl); if (old_rl) return old_rl; free(rl); @@ -1098,7 +1098,7 @@ rl_err_out: } /** - * ntfs_build_mapping_pairs - build the mapping pairs array from a runlist + * ntfs_mapping_pairs_build - build the mapping pairs array from a runlist * @vol: ntfs volume (needed for the ntfs version) * @dst: destination buffer to which to write the mapping pairs array * @dst_len: size of destination buffer @dst in bytes @@ -1115,7 +1115,7 @@ rl_err_out: * EIO - The runlist is corrupt. * ENOSPC - The destination buffer is too small. */ -int ntfs_build_mapping_pairs(const ntfs_volume *vol, s8 *dst, +int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, const int dst_len, const runlist_element *rl) { LCN prev_lcn; @@ -1174,5 +1174,3 @@ err_out: return -1; } - - diff --git a/libntfs/unistr.c b/libntfs/unistr.c index b0321402..459321e6 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -1,7 +1,7 @@ /* * unistr.c - Unicode string handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -56,7 +56,7 @@ const u8 legal_ansi_char_array[0x40] = { }; /** - * ntfs_are_names_equal - compare two Unicode names for equality + * ntfs_names_are_equal - compare two Unicode names for equality * @s1: name to compare to @s2 * @s1_len: length in Unicode characters of @s1 * @s2: name to compare to @s1 @@ -69,7 +69,7 @@ const u8 legal_ansi_char_array[0x40] = { * identical, or FALSE (0) if they are not identical. If @ic is IGNORE_CASE, * the @upcase table is used to performa a case insensitive comparison. */ -BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len, +BOOL ntfs_names_are_equal(const uchar_t *s1, size_t s1_len, const uchar_t *s2, size_t s2_len, const IGNORE_CASE_BOOL ic, const uchar_t *upcase, const u32 upcase_size) @@ -85,7 +85,7 @@ BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len, } /** - * ntfs_collate_names - collate two Unicode names + * ntfs_names_collate - collate two Unicode names * @upcase: upcase table (ignored if @ic is CASE_SENSITIVE) * @upcase_len: upcase table size (ignored if @ic is CASE_SENSITIVE) * @name1: first Unicode name to compare @@ -93,7 +93,7 @@ BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len, * @ic: either CASE_SENSITIVE or IGNORE_CASE * @err_val: if @name1 contains an invalid character return this value * - * ntfs_collate_names collates two Unicode names and returns: + * ntfs_names_collate() collates two Unicode names and returns: * * -1 if the first name collates before the second one, * 0 if the names match, @@ -102,7 +102,7 @@ BOOL ntfs_are_names_equal(const uchar_t *s1, size_t s1_len, * * The following characters are considered invalid: '"', '*', '<', '>' and '?'. */ -int ntfs_collate_names(const uchar_t *name1, const u32 name1_len, +int ntfs_names_collate(const uchar_t *name1, const u32 name1_len, const uchar_t *name2, const u32 name2_len, const int err_val, const IGNORE_CASE_BOOL ic, const uchar_t *upcase, const u32 upcase_len) @@ -228,9 +228,9 @@ int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, } /** - * ntfs_upcase_name + * ntfs_name_upcase */ -void ntfs_upcase_name(uchar_t *name, u32 name_len, const uchar_t *upcase, +void ntfs_name_upcase(uchar_t *name, u32 name_len, const uchar_t *upcase, const u32 upcase_len) { u32 i; @@ -242,24 +242,24 @@ void ntfs_upcase_name(uchar_t *name, u32 name_len, const uchar_t *upcase, } /** - * ntfs_file_upcase_value + * ntfs_file_value_upcase */ void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr, const uchar_t *upcase, const u32 upcase_len) { - ntfs_upcase_name((uchar_t*)&file_name_attr->file_name, + ntfs_name_upcase((uchar_t*)&file_name_attr->file_name, file_name_attr->file_name_length, upcase, upcase_len); } /** - * ntfs_file_compare_values + * ntfs_file_values_compare */ int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1, FILE_NAME_ATTR *file_name_attr2, const int err_val, const IGNORE_CASE_BOOL ic, const uchar_t *upcase, const u32 upcase_len) { - return ntfs_collate_names((uchar_t*)&file_name_attr1->file_name, + return ntfs_names_collate((uchar_t*)&file_name_attr1->file_name, file_name_attr1->file_name_length, (uchar_t*)&file_name_attr2->file_name, file_name_attr2->file_name_length, diff --git a/libntfs/volume.c b/libntfs/volume.c index d81cb034..e9e2831d 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1,7 +1,7 @@ /* * volume.c - NTFS volume handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -39,10 +39,10 @@ /** * Internal: * - * __allocate_ntfs_volume - + * __ntfs_volume_allocate - * */ -static ntfs_volume *__allocate_ntfs_volume(void) +static ntfs_volume *__ntfs_volume_allocate(void) { return (ntfs_volume*)calloc(1, sizeof(ntfs_volume)); } @@ -50,10 +50,10 @@ static ntfs_volume *__allocate_ntfs_volume(void) /** * Internal: * - * __release_ntfs_volume - + * __ntfs_volume_release - * */ -static void __release_ntfs_volume(ntfs_volume *v) +static void __ntfs_volume_release(ntfs_volume *v) { if (v->fd) close(v->fd); @@ -64,29 +64,29 @@ static void __release_ntfs_volume(ntfs_volume *v) if (v->lcnbmp_na) ntfs_attr_close(v->lcnbmp_na); if (v->lcnbmp_ni) - ntfs_close_inode(v->lcnbmp_ni); + ntfs_inode_close(v->lcnbmp_ni); if (v->mftbmp_na) ntfs_attr_close(v->mftbmp_na); if (v->mft_na) ntfs_attr_close(v->mft_na); if (v->mft_ni) - ntfs_close_inode(v->mft_ni); + ntfs_inode_close(v->mft_ni); if (v->mftmirr_na) ntfs_attr_close(v->mftmirr_na); if (v->mftmirr_ni) - ntfs_close_inode(v->mftmirr_ni); + ntfs_inode_close(v->mftmirr_ni); if (v->upcase) free(v->upcase); free(v); } /* External declaration for internal function. */ -extern ntfs_inode *allocate_ntfs_inode(ntfs_volume *); +extern ntfs_inode *ntfs_inode_allocate(ntfs_volume *); /** * Internal: * - * ntfs_load_mft - load the $MFT and setup the ntfs volume with it + * ntfs_mft_load - load the $MFT and setup the ntfs volume with it * @vol: ntfs volume whose $MFT to load * * Load $MFT from @vol and setup @vol with it. After calling this function the @@ -95,7 +95,7 @@ extern ntfs_inode *allocate_ntfs_inode(ntfs_volume *); * * Return 0 on success and -1 on error with errno set to the error code. */ -static int ntfs_load_mft(ntfs_volume *vol) +static int ntfs_mft_load(ntfs_volume *vol) { VCN next_vcn, last_vcn, highest_vcn; s64 l; @@ -105,7 +105,7 @@ static int ntfs_load_mft(ntfs_volume *vol) int eo; /* Manually setup an ntfs_inode. */ - vol->mft_ni = allocate_ntfs_inode(vol); + vol->mft_ni = ntfs_inode_allocate(vol); mb = (MFT_RECORD*)malloc(vol->mft_record_size); if (!vol->mft_ni || !mb) { Dperror("Error allocating memory for $MFT"); @@ -122,16 +122,16 @@ static int ntfs_load_mft(ntfs_volume *vol) Dperror("Error reading $MFT"); goto error_exit; } - if (is_baad_record(mb->magic)) { + if (ntfs_is_baad_record(mb->magic)) { Dputs("Error: Incomplete multi sector transfer detected in " "$MFT."); goto io_error_exit; } - if (!is_mft_record(mb->magic)) { + if (!ntfs_is_mft_record(mb->magic)) { Dputs("Error: $MFT has invalid magic."); goto io_error_exit; } - ctx = ntfs_get_attr_search_ctx(vol->mft_ni, mb); + ctx = ntfs_attr_get_search_ctx(vol->mft_ni, mb); if (!ctx) { Dperror("Failed to allocate attribute search context"); goto error_exit; @@ -142,7 +142,8 @@ static int ntfs_load_mft(ntfs_volume *vol) goto io_error_exit; } /* Find the $ATTRIBUTE_LIST attribute in $MFT if present. */ - if (ntfs_lookup_attr(AT_ATTRIBUTE_LIST, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, AT_UNNAMED, 0, 0, 0, NULL, 0, + ctx)) { if (errno != ENOENT) { Dputs("Error: $MFT has corrupt attribute list."); goto io_error_exit; @@ -150,7 +151,7 @@ static int ntfs_load_mft(ntfs_volume *vol) goto mft_has_no_attr_list; } NInoSetAttrList(vol->mft_ni); - l = get_attribute_value_length(ctx->attr); + l = ntfs_get_attribute_value_length(ctx->attr); if (l <= 0 || l > 0x40000) { Dputs("Error: $MFT/$ATTRIBUTE_LIST has invalid length."); goto io_error_exit; @@ -161,7 +162,7 @@ static int ntfs_load_mft(ntfs_volume *vol) Dputs("Error: failed to allocate buffer for attribute list."); goto error_exit; } - l = get_attribute_value(vol, vol->mft_ni->mrec, ctx->attr, + l = ntfs_get_attribute_value(vol, vol->mft_ni->mrec, ctx->attr, vol->mft_ni->attr_list); if (!l) { Dputs("Error: failed to get value of $MFT/$ATTRIBUTE_LIST."); @@ -175,7 +176,7 @@ static int ntfs_load_mft(ntfs_volume *vol) if (ctx->attr->non_resident) { NInoSetAttrListNonResident(vol->mft_ni); // FIXME: We are duplicating work here! (AIA) - vol->mft_ni->attr_list_rl = ntfs_decompress_mapping_pairs(vol, + vol->mft_ni->attr_list_rl = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL); if (!vol->mft_ni->attr_list_rl) { Dperror("Error: failed to get runlist for " @@ -196,11 +197,12 @@ mft_has_no_attr_list: vol->nr_mft_records = vol->mft_na->data_size >> vol->mft_record_size_bits; /* Read all extents from the $DATA attribute in $MFT. */ - ntfs_reinit_attr_search_ctx(ctx); + ntfs_attr_reinit_search_ctx(ctx); last_vcn = vol->mft_na->allocated_size >> vol->cluster_size_bits; highest_vcn = next_vcn = 0; a = NULL; - while (!ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, next_vcn, NULL, 0, ctx)) { + while (!ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, next_vcn, NULL, 0, + ctx)) { runlist_element *nrl; a = ctx->attr; @@ -225,9 +227,9 @@ mft_has_no_attr_list: * as we have exclusive access to the inode at this time and we * are a mount in progress task, too. */ - nrl = ntfs_decompress_mapping_pairs(vol, a, vol->mft_na->rl); + nrl = ntfs_mapping_pairs_decompress(vol, a, vol->mft_na->rl); if (!nrl) { - Dperror("decompress_mapping_pairs() failed"); + Dperror("ntfs_mapping_pairs_decompress() failed"); goto error_exit; } vol->mft_na->rl = nrl; @@ -261,7 +263,7 @@ mft_has_no_attr_list: goto io_error_exit; } /* Done with the $Mft mft record. */ - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); ctx = NULL; /* * The volume is now setup so we can use all read access functions. @@ -277,13 +279,13 @@ io_error_exit: error_exit: eo = errno; if (ctx) - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (vol->mft_na) { ntfs_attr_close(vol->mft_na); vol->mft_na = NULL; } if (vol->mft_ni) { - ntfs_close_inode(vol->mft_ni); + ntfs_inode_close(vol->mft_ni); vol->mft_ni = NULL; } errno = eo; @@ -293,22 +295,22 @@ error_exit: /** * Internal: * - * ntfs_load_mftmirr - load the $MFTMirr and setup the ntfs volume with it + * ntfs_mftmirr_load - load the $MFTMirr and setup the ntfs volume with it * @vol: ntfs volume whose $MFTMirr to load * * Load $MFTMirr from @vol and setup @vol with it. After calling this function * the volume @vol is ready for use by all write access functions provided by - * the ntfs library (assuming ntfs_load_mft() has been called successfully + * the ntfs library (assuming ntfs_mft_load() has been called successfully * beforehand). * * Return 0 on success and -1 on error with errno set to the error code. */ -static int ntfs_load_mftmirr(ntfs_volume *vol) +static int ntfs_mftmirr_load(ntfs_volume *vol) { int i; runlist_element rl[2]; - vol->mftmirr_ni = ntfs_open_inode(vol, FILE_MFTMirr); + vol->mftmirr_ni = ntfs_inode_open(vol, FILE_MFTMirr); if (!vol->mftmirr_ni) { Dperror("Failed to open inode $MFTMirr"); return -1; @@ -349,14 +351,14 @@ error_exit: ntfs_attr_close(vol->mftmirr_na); vol->mftmirr_na = NULL; } - ntfs_close_inode(vol->mftmirr_ni); + ntfs_inode_close(vol->mftmirr_ni); vol->mftmirr_ni = NULL; errno = i; return -1; } /** - * ntfs_startup_volume - allocate and setup an ntfs volume + * ntfs_volume_startup - allocate and setup an ntfs volume * @name: name of device/file to open * @rwflag: optional mount flags * @@ -367,7 +369,7 @@ error_exit: * Return the allocated volume structure on success and NULL on error with * errno set to the error code. */ -ntfs_volume *ntfs_startup_volume(const char *name, unsigned long rwflag) +ntfs_volume *ntfs_volume_startup(const char *name, unsigned long rwflag) { s64 br; const char *OK = "OK"; @@ -382,7 +384,7 @@ ntfs_volume *ntfs_startup_volume(const char *name, unsigned long rwflag) #endif /* Allocate the volume structure. */ - vol = __allocate_ntfs_volume(); + vol = __ntfs_volume_allocate(); if (!vol) return NULL; /* Make a copy of the partition name. */ @@ -413,12 +415,12 @@ ntfs_volume *ntfs_startup_volume(const char *name, unsigned long rwflag) goto error_exit; } Dputs(OK); - if (!is_boot_sector_ntfs(bs, !debug)) { + if (!ntfs_boot_sector_is_ntfs(bs, !debug)) { Dprintf("Error: %s is not a valid NTFS partition!\n", name); errno = EINVAL; goto error_exit; } - if (parse_ntfs_boot_sector(vol, bs) < 0) { + if (ntfs_boot_sector_parse(vol, bs) < 0) { Dperror("Failed to parse ntfs bootsector"); goto error_exit; } @@ -427,7 +429,7 @@ ntfs_volume *ntfs_startup_volume(const char *name, unsigned long rwflag) /* Need to setup $MFT so we can use the library read functions. */ Dprintf("Loading $MFT... "); - if (ntfs_load_mft(vol) < 0) { + if (ntfs_mft_load(vol) < 0) { Dputs(FAILED); Dperror("Failed to load $MFT"); goto error_exit; @@ -436,7 +438,7 @@ ntfs_volume *ntfs_startup_volume(const char *name, unsigned long rwflag) /* Need to setup $MFTMirr so we can use the write functions, too. */ Dprintf("Loading $MFTMirr... "); - if (ntfs_load_mftmirr(vol) < 0) { + if (ntfs_mftmirr_load(vol) < 0) { Dputs(FAILED); Dperror("Failed to load $MFTMirr"); goto error_exit; @@ -448,7 +450,7 @@ error_exit: if (bs) free(bs); if (vol) - __release_ntfs_volume(vol); + __ntfs_volume_release(vol); errno = eo; return NULL; } @@ -499,7 +501,7 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) return NULL; } - vol = ntfs_startup_volume(name, rwflag); + vol = ntfs_volume_startup(name, rwflag); if (!vol) { Dperror("Failed to startup volume"); return NULL; @@ -549,24 +551,24 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) else s = "mft record"; - if (is_baad_recordp(m + i * vol->mft_record_size)) { + if (ntfs_is_baad_recordp(m + i * vol->mft_record_size)) { Dputs("FAILED"); Dprintf("$MFT error: Incomplete multi sector transfer " "detected in %s.\n", s); goto io_error_exit; } - if (!is_mft_recordp(m + i * vol->mft_record_size)) { + if (!ntfs_is_mft_recordp(m + i * vol->mft_record_size)) { Dputs("FAILED"); Dprintf("$MFT error: Invalid mft record for %s.\n", s); goto io_error_exit; } - if (is_baad_recordp(m2 + i * vol->mft_record_size)) { + if (ntfs_is_baad_recordp(m2 + i * vol->mft_record_size)) { Dputs("FAILED"); Dprintf("$MFTMirr error: Incomplete multi sector " "transfer detected in %s.\n", s); goto io_error_exit; } - if (!is_mft_recordp(m2 + i * vol->mft_record_size)) { + if (!ntfs_is_mft_recordp(m2 + i * vol->mft_record_size)) { Dputs("FAILED"); Dprintf("$MFTMirr error: Invalid mft record for %s.\n", s); @@ -574,7 +576,7 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) } if (memcmp((u8*)m + i * vol->mft_record_size, (u8*)m2 + i * vol->mft_record_size, - ntfs_get_mft_record_data_size((MFT_RECORD*)( + ntfs_mft_record_get_data_size((MFT_RECORD*)( (u8*)m + i * vol->mft_record_size)))) { Dputs(FAILED); Dputs("$MFTMirr does not match $MFT. Run chkdsk."); @@ -589,7 +591,7 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) /* Now load the bitmap from $Bitmap. */ Dprintf("Loading $Bitmap... "); - vol->lcnbmp_ni = ntfs_open_inode(vol, FILE_Bitmap); + vol->lcnbmp_ni = ntfs_inode_open(vol, FILE_Bitmap); if (!vol->lcnbmp_ni) { Dputs(FAILED); Dperror("Failed to open inode"); @@ -607,7 +609,7 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) /* Now load the upcase table from $UpCase. */ Dprintf("Loading $UpCase... "); - ni = ntfs_open_inode(vol, FILE_UpCase); + ni = ntfs_inode_open(vol, FILE_UpCase); if (!ni) { Dputs(FAILED); Dperror("Failed to open inode"); @@ -651,7 +653,7 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) /* Done with the $UpCase mft record. */ Dputs(OK); ntfs_attr_close(na); - if (ntfs_close_inode(ni)) + if (ntfs_inode_close(ni)) Dperror("Failed to close inode, leaking memory"); /* @@ -659,22 +661,22 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) * vol structure accordingly. */ Dprintf("Loading $Volume... "); - ni = ntfs_open_inode(vol, FILE_Volume); + ni = ntfs_inode_open(vol, FILE_Volume); if (!ni) { Dputs(FAILED); Dperror("Failed to open inode"); goto error_exit; } /* Get an ntfs attribute for $UpCase/$DATA. */ - ctx = ntfs_get_attr_search_ctx(ni, NULL); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { Dputs(FAILED); Dperror("Failed to allocate attribute search context"); goto error_exit; } /* Find the $VOLUME_INFORMATION attribute. */ - if (ntfs_lookup_attr(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, - ctx)) { + if (ntfs_attr_lookup(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, + 0, ctx)) { Dputs(FAILED); Dputs("$VOLUME_INFORMATION attribute not found in " "$Volume?!?"); @@ -709,8 +711,9 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) defined using cpu_to_le16() macro and hence are consistent. */ vol->flags = vinf->flags; /* Find the $VOLUME_NAME attribute. */ - ntfs_reinit_attr_search_ctx(ctx); - if (ntfs_lookup_attr(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + ntfs_attr_reinit_search_ctx(ctx); + if (ntfs_attr_lookup(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, + ctx)) { Dputs(FAILED); Dputs("$VOLUME_NAME attribute not found in $Volume?!?"); goto error_exit; @@ -749,9 +752,9 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) vol->vol_name[u] = '\0'; } Dputs(OK); - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); ctx = NULL; - if (ntfs_close_inode(ni)) + if (ntfs_inode_close(ni)) Dperror("Failed to close inode, leaking memory"); /* FIXME: Need to deal with FILE_AttrDef. (AIA) */ @@ -762,13 +765,13 @@ io_error_exit: error_exit: eo = errno; if (ctx) - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (m) free(m); if (m2) free(m2); if (vol) - __release_ntfs_volume(vol); + __ntfs_volume_release(vol); errno = eo; return NULL; } @@ -801,7 +804,7 @@ int ntfs_umount(ntfs_volume *vol, const BOOL force) errno = EINVAL; return -1; } - __release_ntfs_volume(vol); + __ntfs_volume_release(vol); return 0; } @@ -809,14 +812,14 @@ int ntfs_umount(ntfs_volume *vol, const BOOL force) /** * Internal: * - * ntfs_check_mntent - desc + * ntfs_mntent_check - desc * * If you are wanting to use this, you actually wanted to use * ntfs_check_if_mounted(), you just didn't realize. (-: * * See description of ntfs_check_if_mounted(), below. */ -static int ntfs_check_mntent(const char *file, unsigned long *mnt_flags) +static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) { struct mntent *mnt; FILE *f; @@ -868,14 +871,14 @@ int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags) { *mnt_flags = 0; #ifdef HAVE_MNTENT_H - return ntfs_check_mntent(file, mnt_flags); + return ntfs_mntent_check(file, mnt_flags); #else return 0; #endif } /** - * ntfs_version_supported - check if NTFS version is supported. + * ntfs_version_is_supported - check if NTFS version is supported. * @vol: ntfs volume whose version we're interested in. * * The function checks if the NTFS volume version is known or not. @@ -890,7 +893,7 @@ int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags) * ENOTSUP Unknown NTFS versions * EINVAL Invalid argument */ -int ntfs_is_version_supported(ntfs_volume *vol) +int ntfs_version_is_supported(ntfs_volume *vol) { u8 major, minor; @@ -916,7 +919,7 @@ int ntfs_is_version_supported(ntfs_volume *vol) } /** - * ntfs_reset_logfile - "empty" $LogFile data attribute value + * ntfs_logfile_reset - "empty" $LogFile data attribute value * @vol: ntfs volume whose $LogFile we intend to reset. * * Fill the value of the $LogFile data attribute, i.e. the contents of @@ -929,7 +932,7 @@ int ntfs_is_version_supported(ntfs_volume *vol) * * On error, return -1 with errno set to the error code. */ -int ntfs_reset_logfile(ntfs_volume *vol) +int ntfs_logfile_reset(ntfs_volume *vol) { ntfs_inode *ni; ntfs_attr *na; @@ -942,7 +945,7 @@ int ntfs_reset_logfile(ntfs_volume *vol) return -1; } - if ((ni = ntfs_open_inode(vol, FILE_LogFile)) == NULL) { + if ((ni = ntfs_inode_open(vol, FILE_LogFile)) == NULL) { Dperror("Failed to open inode FILE_LogFile.\n"); return -1; } @@ -1000,7 +1003,7 @@ int ntfs_reset_logfile(ntfs_volume *vol) } ntfs_attr_close(na); - return ntfs_close_inode(ni); + return ntfs_inode_close(ni); io_error_exit: eo = errno; @@ -1008,13 +1011,13 @@ io_error_exit: errno = eo; error_exit: eo = errno; - ntfs_close_inode(ni); + ntfs_inode_close(ni); errno = eo; return -1; } /** - * ntfs_set_volume_flags - set the flags of an ntfs volume + * ntfs_volume_set_flags - set the flags of an ntfs volume * @vol: ntfs volume where we set the volume flags * @flags: new flags * @@ -1023,7 +1026,7 @@ error_exit: * * Return 0 on successful and -1 if not, with errno set to the error code. */ -int ntfs_set_volume_flags(ntfs_volume *vol, const u16 flags) +int ntfs_volume_set_flags(ntfs_volume *vol, const u16 flags) { MFT_RECORD *m = NULL; ATTR_RECORD *r; @@ -1050,13 +1053,13 @@ int ntfs_set_volume_flags(ntfs_volume *vol, const u16 flags) } /* Get a pointer to the volume information attribute. */ - ctx = ntfs_get_attr_search_ctx(NULL, m); + ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { Dperror("Failed to allocate attribute search context"); goto err_exit; } - if (ntfs_lookup_attr(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, - ctx)) { + if (ntfs_attr_lookup(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, + 0, ctx)) { Dputs("Error: Attribute $VOLUME_INFORMATION was not found in " "$Volume!"); goto err_out; @@ -1091,7 +1094,7 @@ int ntfs_set_volume_flags(ntfs_volume *vol, const u16 flags) ret = 0; /* success */ err_out: - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); err_exit: if (m) free(m); diff --git a/ntfsprogs/dumplog.c b/ntfsprogs/dumplog.c index 1eef361c..861f3a03 100644 --- a/ntfsprogs/dumplog.c +++ b/ntfsprogs/dumplog.c @@ -1,11 +1,9 @@ const char *EXEC_NAME = "dumplog"; const char *EXEC_VERSION = "1.0"; /* - * $Id$ - * * DumpLog - Part of the Linux-NTFS project. * - * Copyright (c) 2000,2001 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This utility will interpret the contents of the journal ($LogFile) specified * on the command line and display the results on stdout. Errors will be output @@ -111,7 +109,7 @@ int main(int argc, char **argv) /* Valid data length in buffer. */ l = min(br, l); /* Check restart area. */ - if (!is_rstr_recordp(lfd)) { + if (!ntfs_is_rstr_recordp(lfd)) { s64 _l; for (_l = 0LL; _l < l; _l++) @@ -128,8 +126,8 @@ int main(int argc, char **argv) rph = (RESTART_PAGE_HEADER*)lfd; lps = le32_to_cpu(rph->log_page_size); pass_loc: - if (ntfs_post_read_mst_fixup((NTFS_RECORD*)rph, lps) || - is_baad_record(rph->magic)) { + if (ntfs_mst_post_read_fixup((NTFS_RECORD*)rph, lps) || + ntfs_is_baad_record(rph->magic)) { puts("Logfile incomplete multi sector transfer detected! " "Cannot handle this yet!"); goto log_file_error; @@ -212,7 +210,7 @@ rcrd_pass_loc: if ((char*)rcrd_ph + lps > (char*)lfd + l) goto end_of_rcrd_passes; printf("\nLog record page number %i", pass); - if (!is_rcrd_record(rcrd_ph->magic)) { + if (!ntfs_is_rcrd_record(rcrd_ph->magic)) { for (i = 0; i < lps; i++) if (((char*)rcrd_ph)[i] != (char)-1) break; diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 9e31870e..ea08154c 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1,10 +1,8 @@ /* - * $Id$ - * * mkntfs - Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. - * Copyright (C) 2001-2002 Richard Russon. + * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (C) 2001-2002 Richard Russon * * This utility will create an NTFS 1.2 (Windows NT 4.0) volume on a user * specified (block) device. @@ -925,7 +923,7 @@ void deallocate_scattered_clusters(const runlist *rl) continue; /* Deallocate the current run. */ for (j = rl[i].lcn; j < rl[i].lcn + rl[i].length; j++) - ntfs_set_bit(lcn_bitmap, j, 0); + ntfs_bit_set(lcn_bitmap, j, 0); } } @@ -955,7 +953,7 @@ runlist *allocate_scattered_clusters(s64 clusters) while (clusters) { /* Loop in current zone until we run out of free clusters. */ for (lcn = opt.mft_zone_end; lcn < end; lcn++) { - bit = ntfs_get_and_set_bit(lcn_bitmap, lcn, 1); + bit = ntfs_bit_get_and_set(lcn_bitmap, lcn, 1); if (bit) continue; /* @@ -1031,7 +1029,7 @@ int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, uchar_t *uname; /* if (base record) - lookup_attr(); + attr_lookup(); else */ if (name_len) { @@ -1047,7 +1045,7 @@ int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, } else uname = NULL; /* Check if the attribute is already there. */ - ctx = ntfs_get_attr_search_ctx(NULL, m); + ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { Eprintf("Failed to allocate attribute search context.\n"); err = -ENOMEM; @@ -1058,7 +1056,7 @@ int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, err = -ENOTSUP; goto err_out; } - if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, NULL, 0, ctx)) { + if (!ntfs_attr_lookup(type, uname, name_len, ic, 0, NULL, 0, ctx)) { err = -EEXIST; goto err_out; } @@ -1177,7 +1175,7 @@ int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, if (bw != val_len) Eprintf("Error writing non-resident attribute value." "\n"); - err = ntfs_build_mapping_pairs(vol, (s8*)a + hdr_size + + err = ntfs_mapping_pairs_build(vol, (s8*)a + hdr_size + ((name_len + 7) & ~7), mpa_size, rl); } a->initialized_size = cpu_to_le64(inited_size); @@ -1192,7 +1190,7 @@ int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, } err_out: if (ctx) - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (uname) free(uname); return err; @@ -1212,7 +1210,7 @@ int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, uchar_t *uname; /* if (base record) - lookup_attr(); + attr_lookup(); else */ if (name_len) { @@ -1228,7 +1226,7 @@ int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, } else uname = AT_UNNAMED; /* Check if the attribute is already there. */ - ctx = ntfs_get_attr_search_ctx(NULL, m); + ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { Eprintf("Failed to allocate attribute search context.\n"); err = -ENOMEM; @@ -1239,7 +1237,7 @@ int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, err = -ENOTSUP; goto err_out; } - if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, NULL, 0, ctx)) { + if (!ntfs_attr_lookup(type, uname, name_len, ic, 0, NULL, 0, ctx)) { err = -EEXIST; goto err_out; } @@ -1363,7 +1361,7 @@ int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, if (bw != val_len) Eprintf("Error writing non-resident attribute value." "\n"); - err = ntfs_build_mapping_pairs(vol, (s8*)a + hdr_size + + err = ntfs_mapping_pairs_build(vol, (s8*)a + hdr_size + ((name_len + 7) & ~7), mpa_size, rl); } if (err < 0 || bw != val_len) { @@ -1377,7 +1375,7 @@ int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, } err_out: if (ctx) - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (uname && (uname != AT_UNNAMED)) free(uname); if (rl) @@ -1397,7 +1395,7 @@ int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, uchar_t *uname; /* if (base record) - lookup_attr(); + ntfs_attr_lookup(); else */ if (name_len) { @@ -1409,7 +1407,7 @@ int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, } else uname = AT_UNNAMED; /* Check if the attribute is already there. */ - ctx = ntfs_get_attr_search_ctx(NULL, m); + ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { Eprintf("Failed to allocate attribute search context.\n"); err = -ENOMEM; @@ -1420,7 +1418,7 @@ int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, err = -ENOTSUP; goto err_out; } - if (!ntfs_lookup_attr(type, uname, name_len, ic, 0, val, val_len, + if (!ntfs_attr_lookup(type, uname, name_len, ic, 0, val, val_len, ctx)) { err = -EEXIST; goto err_out; @@ -1479,7 +1477,7 @@ int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, memcpy((char*)a + le16_to_cpu(a->value_offset), val, val_len); err_out: if (ctx) - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (uname && (uname != AT_UNNAMED)) free(uname); return err; @@ -1538,17 +1536,17 @@ int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, int i, fn_size; /* Check if the attribute is already there. */ - ctx = ntfs_get_attr_search_ctx(NULL, m); + ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { Eprintf("Failed to allocate attribute search context.\n"); return -ENOMEM; } - if (ntfs_lookup_attr(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, + if (ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { int eo = errno; Eprintf("BUG: Standard information attribute not present in " "file record\n"); - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); return -eo; } si = (STANDARD_INFORMATION*)((char*)ctx->attr + @@ -1557,7 +1555,7 @@ int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, fn_size = sizeof(FILE_NAME_ATTR) + i; fn = (FILE_NAME_ATTR*)malloc(fn_size); if (!fn) { - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); return -errno; } fn->parent_directory = parent_dir; @@ -1566,7 +1564,7 @@ int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, fn->last_data_change_time = si->last_data_change_time; fn->last_mft_change_time = si->last_mft_change_time; fn->last_access_time = si->last_access_time; - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); fn->allocated_size = cpu_to_le64(allocated_size); fn->data_size = cpu_to_le64(data_size); @@ -1908,7 +1906,7 @@ int upgrade_to_large_index(MFT_RECORD *m, const char *name, } else uname = NULL; /* Find the index root attribute. */ - ctx = ntfs_get_attr_search_ctx(NULL, m); + ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { Eprintf("Failed to allocate attribute search context.\n"); return -ENOMEM; @@ -1918,7 +1916,7 @@ int upgrade_to_large_index(MFT_RECORD *m, const char *name, err = -ENOTSUP; goto err_out; } - err = ntfs_lookup_attr(AT_INDEX_ROOT, uname, name_len, ic, 0, NULL, 0, + err = ntfs_attr_lookup(AT_INDEX_ROOT, uname, name_len, ic, 0, NULL, 0, ctx); if (uname) free(uname); @@ -1937,7 +1935,7 @@ int upgrade_to_large_index(MFT_RECORD *m, const char *name, re = (INDEX_ENTRY*)re_start; index_block_size = le32_to_cpu(r->index_block_size); memset(bmp, 0, sizeof(bmp)); - ntfs_set_bit(bmp, 0ULL, 1); + ntfs_bit_set(bmp, 0ULL, 1); /* Bitmap has to be at least 8 bytes in size. */ err = add_attr_bitmap(m, name, name_len, ic, (char*)&bmp, sizeof(bmp)); if (err) @@ -2009,16 +2007,16 @@ int upgrade_to_large_index(MFT_RECORD *m, const char *name, /* Set VCN pointer to 0LL. */ *(VCN*)((char*)re + cpu_to_le16(re->length) - sizeof(VCN)) = cpu_to_le64(0); - err = ntfs_pre_write_mst_fixup((NTFS_RECORD*)ia_val, index_block_size); + err = ntfs_mst_pre_write_fixup((NTFS_RECORD*)ia_val, index_block_size); if (err) { err = -errno; - Eprintf("ntfs_pre_write_mst_fixup() failed in " + Eprintf("ntfs_mst_pre_write_fixup() failed in " "upgrade_to_large_index.\n"); goto err_out; } err = add_attr_index_alloc(m, name, name_len, ic, (char*)ia_val, index_block_size); - ntfs_post_write_mst_fixup((NTFS_RECORD*)ia_val); + ntfs_mst_post_write_fixup((NTFS_RECORD*)ia_val); if (err) { // TODO: Remove the added bitmap! // Revert index root from index allocation. @@ -2028,7 +2026,7 @@ int upgrade_to_large_index(MFT_RECORD *m, const char *name, return 0; err_out: if (ctx) - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (ia_val) free(ia_val); return err; @@ -2759,7 +2757,7 @@ int main(int argc, char **argv) * must be set. This region also encompasses the backup boot sector. */ for (i = opt.nr_clusters; i < lcn_bitmap_byte_size << 3; i++) - ntfs_set_bit(lcn_bitmap, (u64)i, 1); + ntfs_bit_set(lcn_bitmap, (u64)i, 1); /* * Determine mft_size: 16 mft records or 1 cluster, which ever is * bigger, rounded to multiples of cluster size. @@ -2796,7 +2794,7 @@ int main(int argc, char **argv) rl_mft_bmp[1].lcn = -1LL; rl_mft_bmp[1].length = 0LL; /* Allocate cluster for mft bitmap. */ - ntfs_set_bit(lcn_bitmap, (s64)j, 1); + ntfs_bit_set(lcn_bitmap, (s64)j, 1); /* If user didn't specify the mft lcn, determine it now. */ if (!opt.mft_lcn) { /* @@ -2846,7 +2844,7 @@ int main(int argc, char **argv) rl_mft[1].length = 0LL; /* Allocate clusters for mft. */ for (i = 0; i < j; i++) - ntfs_set_bit(lcn_bitmap, opt.mft_lcn + i, 1); + ntfs_bit_set(lcn_bitmap, opt.mft_lcn + i, 1); /* Determine mftmirr_lcn (middle of volume). */ opt.mftmirr_lcn = (opt.nr_sectors * opt.sector_size >> 1) / vol->cluster_size; @@ -2871,7 +2869,7 @@ int main(int argc, char **argv) rl_mftmirr[1].length = 0LL; /* Allocate clusters for mft mirror. */ for (i = 0; i < j; i++) - ntfs_set_bit(lcn_bitmap, opt.mftmirr_lcn + i, 1); + ntfs_bit_set(lcn_bitmap, opt.mftmirr_lcn + i, 1); opt.logfile_lcn = opt.mftmirr_lcn + j; Dprintf("$LogFile logical cluster number = 0x%x\n", opt.logfile_lcn); /* Create runlist for log file. */ @@ -2922,7 +2920,7 @@ int main(int argc, char **argv) rl_logfile[1].length = 0LL; /* Allocate clusters for log file. */ for (i = 0; i < j; i++) - ntfs_set_bit(lcn_bitmap, opt.logfile_lcn + i, 1); + ntfs_bit_set(lcn_bitmap, opt.logfile_lcn + i, 1); /* Create runlist for $Boot. */ rl_boot = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_boot) @@ -2940,7 +2938,7 @@ int main(int argc, char **argv) rl_boot[1].length = 0LL; /* Allocate clusters for $Boot. */ for (i = 0; i < j; i++) - ntfs_set_bit(lcn_bitmap, 0LL + i, 1); + ntfs_bit_set(lcn_bitmap, 0LL + i, 1); /* Allocate a buffer large enough to hold the mft. */ buf = calloc(1, opt.mft_size); if (!buf) @@ -3059,7 +3057,7 @@ int main(int argc, char **argv) m = (MFT_RECORD*)(buf + i * vol->mft_record_size); m->flags |= MFT_RECORD_IN_USE; - ntfs_set_bit(mft_bitmap, 0LL + i, 1); + ntfs_bit_set(mft_bitmap, 0LL + i, 1); file_attrs = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM; if (i == FILE_root) { if (opt.disable_indexing) @@ -3092,14 +3090,14 @@ int main(int argc, char **argv) if (!err) err = upgrade_to_large_index(m, "$I30", 4, 0, &index_block); if (!err) { - ctx = ntfs_get_attr_search_ctx(NULL, m); + ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) err_exit("Failed to allocate attribute search " "context: %s\n", strerror(errno)); /* There is exactly one file name so this is ok. */ - if (ntfs_lookup_attr(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, + if (ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); err_exit("BUG: $FILE_NAME attribute not found.\n"); } a = ctx->attr; @@ -3107,7 +3105,7 @@ int main(int argc, char **argv) (FILE_NAME_ATTR*)((char*)a + le16_to_cpu(a->value_offset)), le32_to_cpu(a->value_length)); - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); } if (err) err_exit("Couldn't create root directory: %s\n", @@ -3308,7 +3306,7 @@ int main(int argc, char **argv) */ bs->checksum = cpu_to_le32(0); /* Make sure the bootsector is ok. */ - if (!is_boot_sector_ntfs(bs, opt.verbose > 0 ? 0 : 1)) + if (!ntfs_boot_sector_is_ntfs(bs, opt.verbose > 0 ? 0 : 1)) err_exit("FATAL: Generated boot sector is invalid!\n"); err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_boot, buf2, 8192); if (!err) @@ -3438,55 +3436,55 @@ bb_err: Vprintf("Syncing root directory index record.\n"); m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); i = 5 * sizeof(uchar_t); - ctx = ntfs_get_attr_search_ctx(NULL, m); + ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) err_exit("Failed to allocate attribute search context: %s\n", strerror(errno)); // FIXME: This should be IGNORE_CASE! - if (ntfs_lookup_attr(AT_INDEX_ALLOCATION, I30, 4, 0, 0, + if (ntfs_attr_lookup(AT_INDEX_ALLOCATION, I30, 4, 0, 0, NULL, 0, ctx)) { - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n"); } a = ctx->attr; - rl_index = ntfs_decompress_mapping_pairs(vol, a, NULL); + rl_index = ntfs_mapping_pairs_decompress(vol, a, NULL); if (!rl_index) { - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); err_exit("Failed to decompress runlist of $INDEX_ALLOCATION " "attribute.\n"); } if (sle64_to_cpu(a->initialized_size) < i) { - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); err_exit("BUG: $INDEX_ALLOCATION attribute too short.\n"); } - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); i = sizeof(INDEX_BLOCK) - sizeof(INDEX_HEADER) + le32_to_cpu(index_block->index.allocated_size); - err = ntfs_pre_write_mst_fixup((NTFS_RECORD*)index_block, i); + err = ntfs_mst_pre_write_fixup((NTFS_RECORD*)index_block, i); if (err) - err_exit("ntfs_pre_write_mst_fixup() failed while syncing " + err_exit("ntfs_mst_pre_write_fixup() failed while syncing " "root directory index block.\n"); lw = ntfs_rlwrite(vol->fd, rl_index, (char*)index_block, i, NULL); if (lw != i) err_exit("Error writing $INDEX_ALLOCATION.\n"); /* No more changes to @index_block below here so no need for fixup: */ - // ntfs_post_write_mst_fixup((NTFS_RECORD*)index_block); + // ntfs_mst_post_write_fixup((NTFS_RECORD*)index_block); Vprintf("Syncing $Bitmap.\n"); m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); - ctx = ntfs_get_attr_search_ctx(NULL, m); + ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) err_exit("Failed to allocate attribute search context: %s\n", strerror(errno)); - if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - ntfs_put_attr_search_ctx(ctx); + if (ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + ntfs_attr_put_search_ctx(ctx); err_exit("BUG: $DATA attribute not found.\n"); } a = ctx->attr; if (a->non_resident) { - rl = ntfs_decompress_mapping_pairs(vol, a, NULL); - ntfs_put_attr_search_ctx(ctx); + rl = ntfs_mapping_pairs_decompress(vol, a, NULL); + ntfs_attr_put_search_ctx(ctx); if (!rl) - err_exit("ntfs_decompress_mapping_pairs() failed\n"); + err_exit("ntfs_mapping_pairs_decompress() failed\n"); lw = ntfs_rlwrite(vol->fd, rl, lcn_bitmap, lcn_bitmap_byte_size, NULL); if (lw != lcn_bitmap_byte_size) @@ -3495,7 +3493,7 @@ bb_err: } else { memcpy((char*)a + le16_to_cpu(a->value_offset), lcn_bitmap, le32_to_cpu(a->value_length)); - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); } /* * No need to sync $MFT/$BITMAP as that has never been modified since diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 4b1997d3..0a9c5f8f 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -127,20 +127,20 @@ version_error: "to fix this.\n"); goto error_exit; } - ctx = ntfs_get_attr_search_ctx(NULL, m); + ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { perror("Failed to allocate attribute search context"); goto error_exit; } /* Find the $DATA attribute of the $LogFile. */ - if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { fprintf(stderr, "Error: Attribute $DATA was not found in" \ "$LogFile!\n"); goto log_file_error; } a = ctx->attr; /* Get length of $LogFile contents. */ - l = get_attribute_value_length(a); + l = ntfs_get_attribute_value_length(a); if (!l) { puts("$LogFile has zero length, no need to write to disk."); goto log_file_error; @@ -152,14 +152,14 @@ version_error: goto log_file_error; } /* Read in the $LogFile into the buffer. */ - if (l != get_attribute_value(vol, m, a, lfd)) { + if (l != ntfs_get_attribute_value(vol, m, a, lfd)) { puts("Amount of data read does not correspond to expected " "length!"); free(lfd); goto log_file_error; } /* Check restart area. */ - if (!is_rstr_recordp(lfd)) { + if (!ntfs_is_rstr_recordp(lfd)) { s64 _l; for (_l = 0LL; _l < l; _l++) @@ -176,8 +176,8 @@ version_error: rph = (RESTART_PAGE_HEADER*)lfd; lps = le32_to_cpu(rph->log_page_size); pass_loc: - if (ntfs_post_read_mst_fixup((NTFS_RECORD*)rph, lps) || - is_baad_record(rph->magic)) { + if (ntfs_mst_post_read_fixup((NTFS_RECORD*)rph, lps) || + ntfs_is_baad_record(rph->magic)) { puts("$LogFile incomplete multi sector transfer detected! " "Cannot handle this yet!"); goto log_file_error; @@ -263,7 +263,7 @@ rcrd_pass_loc: if ((char*)rcrd_ph + lps > (char*)lfd + l) goto end_of_rcrd_passes; printf("\nLog record page number %i", pass); - if (!is_rcrd_record(rcrd_ph->magic)) { + if (!ntfs_is_rcrd_record(rcrd_ph->magic)) { for (i = 0; i < lps; i++) if (((char*)rcrd_ph)[i] != (char)-1) break; @@ -356,7 +356,7 @@ final_exit: if (lfd) free(lfd); if (ctx) - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (m) free(m); if (vol && ntfs_umount(vol, 0)) diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 8d5d3111..d7b427d9 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -121,7 +121,7 @@ int main(int argc, char **argv) puts("Attempting to correct errors."); - vol = ntfs_startup_volume(argv[1], 0); + vol = ntfs_volume_startup(argv[1], 0); if (!vol) { puts(FAILED); perror("Failed to startup volume"); @@ -190,27 +190,27 @@ int main(int argc, char **argv) else s = "mft record"; - if (is_baad_recordp(m + i * vol->mft_record_size)) { + if (ntfs_is_baad_recordp(m + i * vol->mft_record_size)) { puts("FAILED"); fprintf(stderr, "$MFT error: Incomplete multi sector " "transfer detected in %s.\nCannot " "handle this yet. )-:\n", s); goto error_exit; } - if (!is_mft_recordp(m + i * vol->mft_record_size)) { + if (!ntfs_is_mft_recordp(m + i * vol->mft_record_size)) { puts("FAILED"); fprintf(stderr, "$MFT error: Invalid mft record for " "%s.\nCannot handle this yet. )-:\n", s); goto error_exit; } - if (is_baad_recordp(m2 + i * vol->mft_record_size)) { + if (ntfs_is_baad_recordp(m2 + i * vol->mft_record_size)) { puts("FAILED"); fprintf(stderr, "$MFTMirr error: Incomplete multi " "sector transfer detected in %s.\n", s); goto error_exit; } - if (!is_mft_recordp(m2 + i * vol->mft_record_size)) { + if (!ntfs_is_mft_recordp(m2 + i * vol->mft_record_size)) { puts("FAILED"); fprintf(stderr, "$MFTMirr error: Invalid mft record " "for %s.\n", s); @@ -218,7 +218,7 @@ int main(int argc, char **argv) } if (memcmp((u8*)m + i * vol->mft_record_size, (u8*)m2 + i * vol->mft_record_size, - ntfs_get_mft_record_data_size((MFT_RECORD*)( + ntfs_mft_record_get_data_size((MFT_RECORD*)( (u8*)m + i * vol->mft_record_size)))) { if (!done) { done = TRUE; @@ -255,7 +255,7 @@ mount_ok: /* Check NTFS version is ok for us (in $Volume) */ printf("NTFS volume version is %i.%i.\n\n", vol->major_ver, vol->minor_ver); - if (ntfs_is_version_supported(vol)) { + if (ntfs_version_is_supported(vol)) { fprintf(stderr, "Error: Unknown NTFS version.\n"); goto error_exit; } @@ -269,7 +269,7 @@ mount_ok: /* If NTFS volume version >= 2.0 then set mounted on NT4 flag. */ if (vol->major_ver >= 2) flags |= VOLUME_MOUNTED_ON_NT4; - if (ntfs_set_volume_flags(vol, flags)) { + if (ntfs_volume_set_flags(vol, flags)) { puts(FAILED); fprintf(stderr, "Error setting volume flags.\n"); goto error_exit; @@ -278,7 +278,7 @@ mount_ok: printf("\n"); printf("Going to empty the journal ($LogFile)... "); - if (ntfs_reset_logfile(vol)) { + if (ntfs_logfile_reset(vol)) { puts(FAILED); perror("Failed to reset $LogFile"); goto error_exit; diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 4340a0ec..3843842d 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -89,14 +89,14 @@ void get_file_attribute_value(const char *dev, long int i) vol = ntfs_mount(dev, 0); mref = (MFT_REF) i; - inode = ntfs_open_inode(vol, mref); + inode = ntfs_inode_open(vol, mref); if (ntfs_file_record_read(vol, mref, &mrec, NULL)) { perror("Error reading file record!\n"); exit(1); } - ctx = ntfs_get_attr_search_ctx(inode, mrec); + ctx = ntfs_attr_get_search_ctx(inode, mrec); // print_file_name_attr(ctx); @@ -122,7 +122,7 @@ void print_standard_information_attr(ntfs_attr_search_ctx *ctx) ATTR_RECORD *attr = NULL; STANDARD_INFORMATION *standard_information_attr = NULL; - if (ntfs_lookup_attr + if (ntfs_attr_lookup (AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { perror("Error looking up $STANDARD_INFORMATION!\n"); exit(1); @@ -163,7 +163,7 @@ void print_file_name_attr(ntfs_attr_search_ctx *ctx) FILE_NAME_ATTR *file_name_attr = NULL; char *file_name; - if (ntfs_lookup_attr(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { perror("Error looking up $FILE_NAME_ATTR!\n"); exit(1); } diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 60df2afe..8a70f3b2 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -154,12 +154,12 @@ void change_label(const char *dev, const unsigned long mnt_flags, "chkdsk to fix this.\n"); goto err_out; } - ctx = ntfs_get_attr_search_ctx(NULL, mrec); + ctx = ntfs_attr_get_search_ctx(NULL, mrec); if (!ctx) { perror("Failed to get attribute search context"); goto err_out; } - if (ntfs_lookup_attr(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (ntfs_attr_lookup(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { perror("Lookup of $VOLUME_NAME attribute failed"); goto err_out; } diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index c812bd75..72ec8448 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1,4 +1,4 @@ -/** +/* * ntfsresize - Part of the Linux-NTFS project. * * Copyright (c) 2002 Szabolcs Szakacsits @@ -312,7 +312,7 @@ void build_lcn_usage_bitmap(ATTR_RECORD *a) if (!a->non_resident) return; - if (!(rl = ntfs_decompress_mapping_pairs(vol, a, NULL))) + if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) perr_exit("ntfs_decompress_mapping_pairs"); for (i = 0; rl[i].length; i++) { @@ -320,7 +320,7 @@ void build_lcn_usage_bitmap(ATTR_RECORD *a) continue; for (j = 0; j < rl[i].length; j++) { u64 k = (u64)rl[i].lcn + j; - if (ntfs_get_and_set_bit(lcn_bitmap.bm, k, 1)) + if (ntfs_bit_get_and_set(lcn_bitmap.bm, k, 1)) err_exit("Cluster %lu referenced twice!\n" "You didn't shutdown your Windows" "properly?", k); @@ -334,16 +334,16 @@ void walk_attributes(MFT_RECORD *mr) { ntfs_attr_search_ctx *ctx; - if (!(ctx = ntfs_get_attr_search_ctx(NULL, mr))) + if (!(ctx = ntfs_attr_get_search_ctx(NULL, mr))) perr_exit("ntfs_get_attr_search_ctx"); - while (!ntfs_walk_attrs(ctx)) { + while (!ntfs_attrs_walk(ctx)) { if (ctx->attr->type == AT_END) break; build_lcn_usage_bitmap(ctx->attr); } - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); } @@ -352,26 +352,26 @@ void get_bitmap_data(ntfs_volume *vol, struct bitmap *bm) ntfs_inode *ni; ntfs_attr_search_ctx *ctx; - if (!(ni = ntfs_open_inode(vol, (MFT_REF)FILE_Bitmap))) + if (!(ni = ntfs_inode_open(vol, (MFT_REF)FILE_Bitmap))) perr_exit("ntfs_open_inode"); - if (!(ctx = ntfs_get_attr_search_ctx(ni, NULL))) + if (!(ctx = ntfs_attr_get_search_ctx(ni, NULL))) perr_exit("ntfs_get_attr_search_ctx"); - if (ntfs_lookup_attr(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) + if (ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) perr_exit("ntfs_lookup_attr"); /* FIXME: get_attribute_value_length() can't handle extents */ - bm->size = get_attribute_value_length(ctx->attr); + bm->size = ntfs_get_attribute_value_length(ctx->attr); if (!(bm->bm = (u8 *)malloc(bm->size))) perr_exit("get_bitmap_data"); - if (get_attribute_value(vol, ni->mrec, ctx->attr, bm->bm) != bm->size) + if (ntfs_get_attribute_value(vol, ni->mrec, ctx->attr, bm->bm) != bm->size) perr_exit("Couldn't get $Bitmap $DATA\n"); - ntfs_put_attr_search_ctx(ctx); - ntfs_close_inode(ni); + ntfs_attr_put_search_ctx(ctx); + ntfs_inode_close(ni); } @@ -453,7 +453,7 @@ void advise_on_resize() int fragmanted_end; for (i = vol->nr_clusters - 1; i > 0; i--) - if (ntfs_get_bit(lcn_bitmap.bm, i)) + if (ntfs_bit_get(lcn_bitmap.bm, i)) break; i += 2; /* first free + we reserve one for the backup boot sector */ @@ -495,9 +495,9 @@ void look_for_bad_sector(ATTR_RECORD *a) runlist *rl; int i; - rl = ntfs_decompress_mapping_pairs(vol, a, NULL); + rl = ntfs_mapping_pairs_decompress(vol, a, NULL); if (!rl) - perr_exit("ntfs_decompress_mapping_pairs"); + perr_exit("ntfs_mapping_pairs_decompress"); for (i = 0; rl[i].length; i++) if (rl[i].lcn != LCN_HOLE) @@ -522,7 +522,7 @@ void rl_set(runlist *rl, VCN vcn, LCN lcn, s64 len) void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) { for (; cluster < bm->size << 3; cluster++) - ntfs_set_bit(bm->bm, (u64)cluster, 1); + ntfs_bit_set(bm->bm, (u64)cluster, 1); } @@ -551,7 +551,7 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) if (!(mp = (char *)calloc(1, mp_size))) perr_exit("Couldn't get memory"); - if (ntfs_build_mapping_pairs(vol, mp, mp_size, rl_bad)) + if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl_bad)) exit(1); memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); @@ -581,8 +581,8 @@ void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) bm_bsize = nr_clusters_to_bitmap_byte_size(nr_clusters); nr_bm_clusters = rounded_up_division(bm_bsize, vol->cluster_size); - if (!(rl = ntfs_decompress_mapping_pairs(vol, a, NULL))) - perr_exit("ntfs_decompress_mapping_pairs"); + if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) + perr_exit("ntfs_mapping_pairs_decompress"); /* Unallocate truncated clusters in $Bitmap */ for (i = 0; rl[i].length; i++) { @@ -595,7 +595,7 @@ void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) for (j = 0; j < rl[i].length; j++) if (rl[i].vcn + j >= nr_bm_clusters) { u64 k = (u64)rl[i].lcn + j; - ntfs_set_bit(lcn_bitmap.bm, k, 0); + ntfs_bit_set(lcn_bitmap.bm, k, 0); Dprintf("Unallocate cluster: " "%llu (%llx)\n", k, k); } @@ -631,7 +631,7 @@ void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) if (!(mp = (char *)calloc(1, mp_size))) perr_exit("Couldn't get memory"); - if (ntfs_build_mapping_pairs(vol, mp, mp_size, rl)) + if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl)) exit(1); memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); @@ -651,13 +651,13 @@ void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) uchar_t *ustr = NULL; int len = 0; - if (!(ni = ntfs_open_inode(vol, mref))) + if (!(ni = ntfs_inode_open(vol, mref))) perr_exit("ntfs_open_inode"); if (NInoAttrList(ni)) perr_exit("Attribute list attribute not yet supported"); - if (!(*ctx = ntfs_get_attr_search_ctx(ni, NULL))) + if (!(*ctx = ntfs_attr_get_search_ctx(ni, NULL))) perr_exit("ntfs_get_attr_search_ctx"); if (aname && ((len = ntfs_mbstoucs(aname, &ustr, 0)) == -1)) @@ -668,7 +668,7 @@ void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) len = 0; } - if (ntfs_lookup_attr(AT_DATA, ustr, len, 0, 0, NULL, 0, *ctx)) + if (ntfs_attr_lookup(AT_DATA, ustr, len, 0, 0, NULL, 0, *ctx)) perr_exit("ntfs_lookup_attr"); if (ustr != AT_UNNAMED) @@ -701,7 +701,7 @@ void truncate_badclust_file(s64 nr_clusters) perr_exit("Couldn't update $BadClust"); /* FIXME: clean up API => ntfs_put_attr_search_ctx() also closes ni */ - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); } @@ -718,7 +718,7 @@ void truncate_bitmap_file(s64 nr_clusters) if (write_mft_record(ctx)) perr_exit("Couldn't update $Bitmap"); - ntfs_put_attr_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); } @@ -805,7 +805,7 @@ void mount_volume() "please try again (or see -f option).\n"); printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); - if (ntfs_is_version_supported(vol)) + if (ntfs_version_is_supported(vol)) perr_exit("Unknown NTFS version"); Dprintf("Cluster size : %u\n", vol->cluster_size); @@ -823,12 +823,12 @@ void prepare_volume_fixup() flags |= VOLUME_MOUNTED_ON_NT4; printf("Schedule chkdsk NTFS consistency check at Windows boot time ...\n"); - if (ntfs_set_volume_flags(vol, flags)) + if (ntfs_volume_set_flags(vol, flags)) perr_exit("Failed to set $Volume dirty"); printf("Resetting $LogFile ... " "(this might take a while)\n"); - if (ntfs_reset_logfile(vol)) + if (ntfs_logfile_reset(vol)) perr_exit("Failed to reset $LogFile"); } } @@ -880,7 +880,7 @@ int main(int argc, char **argv) } for (i = new_volume_size; i < vol->nr_clusters; i++) - if (ntfs_get_bit(lcn_bitmap.bm, (u64)i)) { + if (ntfs_bit_get(lcn_bitmap.bm, (u64)i)) { /* FIXME: relocate cluster */ advise_on_resize(); } diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index a860bca2..37d2e4ec 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -736,7 +736,7 @@ ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) if (!ctx) return NULL; - if (ntfs_lookup_attr (type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { + if (ntfs_attr_lookup(type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { Dprintf ("find_attribute didn't find an attribute of type: 0x%02x.\n", type); return NULL; /* None / no more of that type */ } @@ -767,14 +767,14 @@ ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) if (!mft) return NULL; - ctx = ntfs_get_attr_search_ctx (NULL, mft); + ctx = ntfs_attr_get_search_ctx(NULL, mft); if (!ctx) { Eprintf ("Couldn't create a search context.\n"); return NULL; } rec = find_attribute (type, ctx); - ntfs_put_attr_search_ctx (ctx); + ntfs_attr_put_search_ctx(ctx); if (rec) Dprintf ("find_first_attribute: found attr of type 0x%02x.\n", type); else @@ -813,7 +813,7 @@ int get_filenames (struct ufile *file) if (!file) return -1; - ctx = ntfs_get_attr_search_ctx (NULL, file->mft); + ctx = ntfs_attr_get_search_ctx (NULL, file->mft); if (!ctx) return -1; @@ -857,7 +857,7 @@ int get_filenames (struct ufile *file) count++; } - ntfs_put_attr_search_ctx (ctx); + ntfs_attr_put_search_ctx(ctx); Dprintf ("File has %d names.\n", count); return count; } @@ -887,7 +887,7 @@ int get_data (struct ufile *file, ntfs_volume *vol) if (!file) return -1; - ctx = ntfs_get_attr_search_ctx (NULL, file->mft); + ctx = ntfs_attr_get_search_ctx (NULL, file->mft); if (!ctx) return -1; @@ -923,7 +923,7 @@ int get_data (struct ufile *file, ntfs_volume *vol) data->size_vcn = sle64_to_cpu (rec->highest_vcn) + 1; } - data->runlist = ntfs_decompress_mapping_pairs (vol, rec, NULL); + data->runlist = ntfs_mapping_pairs_decompress(vol, rec, NULL); if (!data->runlist) { Dprintf ("Couldn't decompress the data runs\n"); } @@ -935,7 +935,7 @@ int get_data (struct ufile *file, ntfs_volume *vol) count++; } - ntfs_put_attr_search_ctx (ctx); + ntfs_attr_put_search_ctx(ctx); Dprintf ("File has %d data streams.\n", count); return count; } @@ -1823,7 +1823,7 @@ int undelete_file (ntfs_volume *vol, long long inode) goto free; } } else { - if (ntfs_read_clusters (vol, j, 1, buffer) < 1) { + if (ntfs_clusters_read(vol, j, 1, buffer) < 1) { Eprintf ("Read failed: %s\n", strerror (errno)); close (fd); goto free; From 14ac4ee8c833eea5f244e3b1e19fded2c2f51cbe Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 10 Dec 2002 11:53:41 +0000 Subject: [PATCH 0206/2994] new api renames to ntfs_object_action and other misc updates BKrev: 3df5d5c5HZ8tN4P990Iqb_TJQ3ljLw From e4e1caa9f0b500f3832093c225742984d79a745c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 10 Dec 2002 11:53:41 +0000 Subject: [PATCH 0207/2994] remove cvs id tag (Logical change 1.36) --- doc/attributes.txt | 2 -- doc/system_files.txt | 2 -- 2 files changed, 4 deletions(-) diff --git a/doc/attributes.txt b/doc/attributes.txt index 7469dd7e..a7436db1 100644 --- a/doc/attributes.txt +++ b/doc/attributes.txt @@ -1,5 +1,3 @@ -$Id$ - Notes on the storage of attributes. =================================== diff --git a/doc/system_files.txt b/doc/system_files.txt index a5581d2a..9ed13365 100644 --- a/doc/system_files.txt +++ b/doc/system_files.txt @@ -1,5 +1,3 @@ -$Id$ - System files mft record numbers. All these files are always marked as used in the bitmap attribute of the mft; presumably in order to avoid accidental allocation for random other mft records. Also, the sequence number for each From faad618110376c904b85d41e4ca33d918eea5eda Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 10 Dec 2002 11:53:41 +0000 Subject: [PATCH 0208/2994] update (Logical change 1.36) --- TODO.ntfsprogs | 2 +- doc/compression.txt | 2 +- doc/template.c | 2 +- doc/template.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index cc60befa..38a8cd60 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -36,7 +36,7 @@ Thanks, * ntfslabel * ************* -- Support ioctls for ntfs tng driver 2.0.? for reading/changing the label. +- Support ioctls for ntfs tng driver 2.?.? for reading/changing the label. diff --git a/doc/compression.txt b/doc/compression.txt index 41dce6fc..368f16f2 100644 --- a/doc/compression.txt +++ b/doc/compression.txt @@ -2,7 +2,7 @@ Description of the NTFS (de)compression algorithm (based on a modified LZ77 algorithm) -Copyright (c) 2001 Anton Altaparmakov. +Copyright (c) 2001 Anton Altaparmakov This document is published under the GNU General Public License. diff --git a/doc/template.c b/doc/template.c index ae87ae0d..89f9bd85 100644 --- a/doc/template.c +++ b/doc/template.c @@ -3,7 +3,7 @@ const char *EXEC_VERSION= "0.0.1"; /* * EXEC_NAME - Part of the Linux-NTFS project. * - * Copyright (c) 2000,2001 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * Short description here. * diff --git a/doc/template.h b/doc/template.h index 286dc1d2..e7d34d88 100644 --- a/doc/template.h +++ b/doc/template.h @@ -1,7 +1,7 @@ /* * NAME.h - Description. Part of the Linux-NTFS project. * - * Copyright (c) 2000,2001 Anton Altaparmakov. + * Copyright (c) 2000-2002 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published From bed62087c7885dbdbfcbf4eaca20804538928991 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 10 Dec 2002 11:53:41 +0000 Subject: [PATCH 0209/2994] update for ntfsresize and new api (Logical change 1.36) --- NEWS | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 9923651f..e45d44e8 100644 --- a/NEWS +++ b/NEWS @@ -5,9 +5,17 @@ Renamed ntfstools to ntfsprogs everywhere. Added new utility ntfslabel by Matthew Fanto. See man 8 ntfslabel for details. -Added new utility ntfsundelete by Richard Russon. See man 8 ntfsundelete for +Added new utility ntfsundelete by Richard Russon. See man 8 ntfsundelete for more details. +Added new utility ntfsresize by Szakacsits Szabolcs. See man 8 ntfsresize for +details. + +The API has been fully reworked and the library mostly rewritten since the +last release (1.6.0). It should now offer a much more solid and stable basis +for development of software accessing NTFS volumes. All utilities have been +ported to the new API. + Older news ========== From 89c6f610e249d8496e8599ec0f476a8e3334d212 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 10 Dec 2002 16:46:10 +0000 Subject: [PATCH 0210/2994] =?UTF-8?q?bugfix:=20make=20ntfs=5Fnames=5Fare?= =?UTF-8?q?=5Fequal=20return=20true=20if=20both=20names=20are=20zero=20len?= =?UTF-8?q?gth=20thanks=20to=20Leonard=20Norrg=E5rd=20for=20the=20fix.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (Logical change 1.37) --- ChangeLog | 2 ++ libntfs/unistr.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e4d6d47d..19fec798 100644 --- a/ChangeLog +++ b/ChangeLog @@ -147,6 +147,8 @@ - The word is "runlist", not "run_list", "run list", or "run-list". - Prefix all functions with "ntfs_" and make the names of the form "ntfs_object_action()". Keep this for all future functions! + - Change unistr.c::ntfs_names_are_equal() to return TRUE when both + names have zero length. Thanks to Leonard Norrgard for spotting this. 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 459321e6..51c00015 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -77,7 +77,7 @@ BOOL ntfs_names_are_equal(const uchar_t *s1, size_t s1_len, if (s1_len != s2_len) return FALSE; if (!s1_len) - return 0; + return TRUE; if (ic == CASE_SENSITIVE) return ntfs_ucsncmp(s1, s2, s1_len << 1) ? FALSE: TRUE; return ntfs_ucsncasecmp(s1, s2, s1_len, upcase, upcase_size) ? FALSE: From bb6105b82b6919418488ce474b8a59f09347b56e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 10 Dec 2002 16:46:10 +0000 Subject: [PATCH 0211/2994] =?UTF-8?q?bugfix:=20make=20ntfs=5Fnames=5Fare?= =?UTF-8?q?=5Fequal=20return=20true=20if=20both=20names=20are=20zero=20len?= =?UTF-8?q?gth=20thanks=20to=20Leonard=20Norrg=E5rd=20for=20the=20fix.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BKrev: 3df61a52SaOAsdld1Wtl5VlDPAT7iQ From acc1dbc0b7293c4334d0b65bccecb85c129de6e2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Dec 2002 12:53:46 +0000 Subject: [PATCH 0212/2994] Update changelog (typos). (Logical change 1.38) --- ChangeLog | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19fec798..d4ae72c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,11 +41,11 @@ ntfs_attr_{get,put,reinit}_search_ctx(), and ntfs_attr_lookup(). - Add a TODO.libntfs laying down my personal roadmap for the library. - - Remove ntfs_attr_find() from API, everyone must use ntfs_lookup_attr() + - Remove ntfs_attr_find() from API, everyone must use ntfs_attr_lookup() instead. - Rename all attribute name constants from $blah to AT_blah. - Rename all system file constants from FILE_$blah to FILE_blah. - - Port ntfS_attr_lookup() stuff from ntfs tng driver. + - Port ntfs_attr_lookup() stuff from ntfs tng driver. - Implement loading of extent inodes. They are attached on open to the base inode and are cached there until the base inode is closed. - Cleanup/streamline include file dependencies. @@ -140,7 +140,7 @@ ntfs_volume_set_flags(). - Change size autodetection of non-block device files in mkntfs to use the stat returned file size rather than the block allocation count to - cope with precreated sparse files. + cope with pre-created sparse files. - Remove GPL message text from usage information in mkntfs. - New tool, ntfsundelete, written by Richard Russon. - New tool, ntfsresize, written by Szabolcs Szakacsits. From 3da4b5c0889f671f118cd32d33bb0f5f1f37e1b7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Dec 2002 12:53:46 +0000 Subject: [PATCH 0213/2994] Update changelog (typos). BKrev: 3df886dacchgzbpnwnqJskhq497-1g From e1e3e56c54581bf6b020d7b56cef155865b61089 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Dec 2002 15:02:11 +0000 Subject: [PATCH 0214/2994] Fix bug in ntfs_external_attr_find(). Spotted and fixed by Szaka. (Logical change 1.39) --- libntfs/attrib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 1abd25b3..33c48c8e 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1666,9 +1666,12 @@ not_found: * If we were enumerating and reached the end, we can't just use !@type * because that would return the first attribute instead of the last * one. Thus we just change @type to AT_END which causes - * ntfs_attr_find() to seek to the end. + * ntfs_attr_find() to seek to the end. We also do the same when an + * attribute extent was searched for (i.e. lowest_vcn != 0), as we + * otherwise rewind the search back to the first extent and we get + * that extent returned twice during a search for all extents. */ - if (!type) + if (!type || lowest_vcn) type = AT_END; return ntfs_attr_find(type, name, name_len, ic, val, val_len, ctx); } From f34b2fa185c3fa877d424bc840f8b217af252fc7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Dec 2002 15:02:11 +0000 Subject: [PATCH 0215/2994] Fix logic inversion bug in ntfs_extent_inode_open(). Spotted and fixed by Szaka. This one was particularly dumb as it has been fixed in the NTFS kernel driver for over half a year but the fix was never propagated into the library. )-: (Logical change 1.39) --- libntfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 7ad85b9c..7ab0d634 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -284,7 +284,7 @@ ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref) ni->nr_extents = -1; ni->base_ni = base_ni; /* Attach extent inode to base inode, reallocating memory if needed. */ - if (!(base_ni->nr_extents & ~3)) { + if (!(base_ni->nr_extents & 3)) { i = (base_ni->nr_extents + 4) * sizeof(ntfs_inode *); extent_nis = (ntfs_inode**)malloc(i); From 5bd85af04191949255bdb379ed2423284b206dfc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Dec 2002 15:02:11 +0000 Subject: [PATCH 0216/2994] libntfs/attrib.c Fix bug in ntfs_external_attr_find(). Spotted and fixed by Szaka. libntfs/inode.c Fix logic inversion bug in ntfs_extent_inode_open(). Spotted and fixed by Szaka. This one was particularly dumb as it has been fixed in the NTFS kernel driver for over half a year but the fix was never propagated into the library. )-: BKrev: 3df8a4f3VwxdoIiRFOqkKn5jHd5oQQ From 159fc872299646b192f0ec142de2e47c4c131505 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Dec 2002 15:19:35 +0000 Subject: [PATCH 0217/2994] update changelog (Logical change 1.40) --- ChangeLog | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d4ae72c2..904bd2dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -143,12 +143,16 @@ cope with pre-created sparse files. - Remove GPL message text from usage information in mkntfs. - New tool, ntfsundelete, written by Richard Russon. - - New tool, ntfsresize, written by Szabolcs Szakacsits. + - New tool, ntfsresize, written by Szakacsits Szabolcs. - The word is "runlist", not "run_list", "run list", or "run-list". - Prefix all functions with "ntfs_" and make the names of the form "ntfs_object_action()". Keep this for all future functions! - Change unistr.c::ntfs_names_are_equal() to return TRUE when both names have zero length. Thanks to Leonard Norrgard for spotting this. + - Fix bug in ntfs_external_attr_find(). (Szakacsits Szabolcs) + - Fix stupid logic inversion bug in ntfs_extent_inode_open(). Same bug + was fixed in the NTFS kernel driver over six months ago but the fix + was never taken over to libntfs. (Szakacsits Szabolcs) 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for From 237cb68266b7802aa5097b1bcae79b420bd624d1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Dec 2002 15:19:35 +0000 Subject: [PATCH 0218/2994] update changelog BKrev: 3df8a9072h-2Cmr6SsDA1R7396FPog From e5d3b5bd3d0319d1a4243da5748de632fbf57cde Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Dec 2002 20:12:16 +0000 Subject: [PATCH 0219/2994] =?UTF-8?q?Fix=20stupid=20bug=20in=20ntfs=5Fucsn?= =?UTF-8?q?cmp().=20Thanks=20to=20Leonard=20Norrg=E5rd.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BKrev: 3df8eda0OFdTkdYX2EEcfboRw5NHuA From b643de455a841e6bec3cd667fa751e445f39f9df Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Dec 2002 20:12:16 +0000 Subject: [PATCH 0220/2994] add Leonard to the credits (Logical change 1.41) --- CREDITS | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS b/CREDITS index 23ebcc41..26028977 100644 --- a/CREDITS +++ b/CREDITS @@ -11,6 +11,7 @@ Anton Altaparmakov Albert D. Cahalan Matthew J. Fanto David Martínez Moreno +Leonard Norrgĺrd Yuri Per Richard Russon Szakacsits Szabolcs From 095881f26d8205c580aca9e79da61897561187b8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Dec 2002 20:12:16 +0000 Subject: [PATCH 0221/2994] update (Logical change 1.41) --- libntfs/unistr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 51c00015..9376cc34 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -79,7 +79,7 @@ BOOL ntfs_names_are_equal(const uchar_t *s1, size_t s1_len, if (!s1_len) return TRUE; if (ic == CASE_SENSITIVE) - return ntfs_ucsncmp(s1, s2, s1_len << 1) ? FALSE: TRUE; + return ntfs_ucsncmp(s1, s2, s1_len) ? FALSE: TRUE; return ntfs_ucsncasecmp(s1, s2, s1_len, upcase, upcase_size) ? FALSE: TRUE; } From ae5d581a3e3862b41ad79d919227012c656da5bd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Dec 2002 20:12:16 +0000 Subject: [PATCH 0222/2994] updateFix stupid bug in ntfs_ucsncmp(). (Logical change 1.41) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 904bd2dc..69d2c8a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -153,6 +153,7 @@ - Fix stupid logic inversion bug in ntfs_extent_inode_open(). Same bug was fixed in the NTFS kernel driver over six months ago but the fix was never taken over to libntfs. (Szakacsits Szabolcs) + - Fix stupid bug in ntfs_ucsncmp(). Spotted by Leonard Norrgard. 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for From 9f426c46e5deb8fbca6ecd86cb1f6b527583d9d6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 13 Dec 2002 14:44:50 +0000 Subject: [PATCH 0223/2994] Fix bug where the call to ntfs_attr_{put,reinit}_search_ctx() would free the extent inode attached to the search context but leave it attached to the base inode, so this would lead to memory corruption and worse problems. Thanks to Szakacsits Szabolcs for spotting this. We now don't close extent inodes any more at all and just leave it to the closing of the base inode to dispose of all the extent inodes. (Logical change 1.42) --- ChangeLog | 6 ++++++ libntfs/attrib.c | 10 ++-------- libntfs/inode.c | 3 +++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 69d2c8a1..555187b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -154,6 +154,12 @@ was fixed in the NTFS kernel driver over six months ago but the fix was never taken over to libntfs. (Szakacsits Szabolcs) - Fix stupid bug in ntfs_ucsncmp(). Spotted by Leonard Norrgard. + - Fix bug where the call to ntfs_attr_{put,reinit}_search_ctx() would + free the extent inode attached to the search context but leave it + attached to the base inode, so this would lead to memory corruption + and worse problems. Thanks to Szakacsits Szabolcs for spotting this. + We now don't close extent inodes any more at all and just leave it + to the closing of the base inode to dispose of all the extent inodes. 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 33c48c8e..865acfd5 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1786,8 +1786,7 @@ static __inline__ void ntfs_attr_init_search_ctx(ntfs_attr_search_ctx *ctx, * ntfs_attr_reinit_search_ctx - reinitialize an attribute search context * @ctx: attribute search context to reinitialize * - * Reinitialize the attribute search context @ctx, unmapping an associated - * extent mft record if present, and initialize the search context again. + * Reinitialize the attribute search context @ctx. * * This is used when a search for a new attribute is being started to reset * the search context to the beginning. @@ -1802,8 +1801,6 @@ void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx) le16_to_cpu(ctx->mrec->attrs_offset)); return; } /* Attribute list. */ - if (ctx->ntfs_ino != ctx->base_ntfs_ino) - ntfs_inode_close(ctx->ntfs_ino); ntfs_attr_init_search_ctx(ctx, ctx->base_ntfs_ino, ctx->base_mrec); return; } @@ -1839,13 +1836,10 @@ ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) * ntfs_attr_put_search_ctx - release an attribute search context * @ctx: attribute search context to free * - * Release the attribute search context @ctx, unmapping an associated extent - * mft record if present. + * Release the attribute search context @ctx. */ void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) { - if (ctx->base_ntfs_ino && ctx->ntfs_ino != ctx->base_ntfs_ino) - ntfs_inode_close(ctx->ntfs_ino); free(ctx); return; } diff --git a/libntfs/inode.c b/libntfs/inode.c index 7ab0d634..ceb3e22b 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -235,6 +235,9 @@ int ntfs_inode_close(ntfs_inode *ni) * Finally attach the ntfs inode to its base inode @base_ni and return a * pointer to the ntfs_inode structure on success or NULL on error, with errno * set to the error code. + * + * Note, extent inodes are never closed directly. They are automatically + * disposed off by the closing of the base inode. */ ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref) { From 0ae3f129fcdd8f565c5b812021e0584452559689 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 13 Dec 2002 14:44:50 +0000 Subject: [PATCH 0224/2994] Fix bug where the call to ntfs_attr_{put,reinit}_search_ctx() would free the extent inode attached to the search context but leave it attached to the base inode, so this would lead to memory corruption and worse problems. Thanks to Szakacsits Szabolcs for spotting this. We now don't close extent inodes any more at all and just leave it to the closing of the base inode to dispose of all the extent inodes. BKrev: 3df9f2624EmJyDVR86KJ_OccL998Ug From ce025a34eab5521586a6853669019d8002dbe8d0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 13 Dec 2002 15:06:29 +0000 Subject: [PATCH 0225/2994] Add sanity check to ntfs_inode_close() to detect attempts at closing extent inodes. (Logical change 1.43) --- libntfs/inode.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libntfs/inode.c b/libntfs/inode.c index ceb3e22b..f40ae1ea 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -194,9 +194,17 @@ err_out: * and call ntfs_inode_close() again. The following error codes are defined: * * EBUSY @ni is dirty and/or the attribute list runlist is dirty. + * EINVAL @ni is invalid (probably it is an extent inode!) */ int ntfs_inode_close(ntfs_inode *ni) { + /* If the inode is an extent inode, comply rudely! */ + if (ni->nr_extents == -1) { + Dprintf("%s(): BUG: Tried to close extent inode!\n", + __FUNCTION__); + errno = EINVAL; + return -1; + } // TODO: This needs to be replaced with a flush to disk attempt. (AIA) if (NInoDirty(ni) || NInoAttrListDirty(ni)) { errno = EBUSY; From 08673255654c5a9d73d25025daaa2254cf2f3936 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 13 Dec 2002 15:06:29 +0000 Subject: [PATCH 0226/2994] Add sanity check to ntfs_inode_close() to detect attempts at closing extent inodes. BKrev: 3df9f775oyXk9BpYQQDCAm3TEjiIdA From cd89d41f0622d11f0e1dff9b825c656ba1fc1639 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 13 Dec 2002 15:07:09 +0000 Subject: [PATCH 0227/2994] update changelog (Logical change 1.44) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 555187b0..f40f0138 100644 --- a/ChangeLog +++ b/ChangeLog @@ -160,6 +160,8 @@ and worse problems. Thanks to Szakacsits Szabolcs for spotting this. We now don't close extent inodes any more at all and just leave it to the closing of the base inode to dispose of all the extent inodes. + - Add sanity check to ntfs_inode_close() to detect attempts at closing + extent inodes. 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for From 301b3734afb91a217270dea54a8f6fd145c43587 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 13 Dec 2002 15:07:09 +0000 Subject: [PATCH 0228/2994] update changelog BKrev: 3df9f79dwrkAluD-D61QdoJWMdwwHg From 151fa56ec6f83ad5f1475a79bdecb05f233cf95c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 13 Dec 2002 15:54:44 +0000 Subject: [PATCH 0229/2994] Don't free extent inodes in attrib.c! (Szakacsits Szabolcs) (Logical change 1.45) --- ChangeLog | 1 + libntfs/attrib.c | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f40f0138..19e4de73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -162,6 +162,7 @@ to the closing of the base inode to dispose of all the extent inodes. - Add sanity check to ntfs_inode_close() to detect attempts at closing extent inodes. + - Don't free extent inodes in attrib.c! (Szakacsits Szabolcs) 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 865acfd5..22290f52 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1559,9 +1559,6 @@ is_enumeration: break; } } else { /* Mft references do not match. */ - /* If there is a mapped extent inode unmap it first. */ - if (ni != base_ni) - ntfs_inode_close(ni); /* Do we want the base record back? */ if (MREF_LE(al_entry->mft_reference) == base_ni->mft_no) { @@ -1642,8 +1639,6 @@ do_next_attr: goto do_next_attr_loop; } if (ni != base_ni) { - if (ni) - ntfs_inode_close(ni); ctx->ntfs_ino = base_ni; ctx->mrec = ctx->base_mrec; ctx->attr = ctx->base_attr; From e39b3a634de6bed519071653b7f33ce86bc69f55 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 13 Dec 2002 15:54:44 +0000 Subject: [PATCH 0230/2994] Don't free extent inodes in attrib.c! (Szakacsits Szabolcs) BKrev: 3dfa02c4NTpCL31WQu1SgXCWz-ub9A From eb9ed096e2510c06ccc1b1b3103ffbccf3b387fd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 13 Dec 2002 16:06:07 +0000 Subject: [PATCH 0231/2994] remove comment as requested by Szaka (Logical change 1.46) --- ntfsprogs/ntfsresize.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 72ec8448..93fec8dc 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -700,7 +700,6 @@ void truncate_badclust_file(s64 nr_clusters) if (write_mft_record(ctx)) perr_exit("Couldn't update $BadClust"); - /* FIXME: clean up API => ntfs_put_attr_search_ctx() also closes ni */ ntfs_attr_put_search_ctx(ctx); } From 0c4dc57cd3107508fc9dbdf5067e4748a2bd5a1b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 13 Dec 2002 16:06:07 +0000 Subject: [PATCH 0232/2994] remove comment as requested by Szaka BKrev: 3dfa056ff5w7KPHa7jeGFHZl6IMmag From dfbfb115b7b657ac851a3a46486f9f4a9ec504bf Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 13 Dec 2002 16:31:41 +0000 Subject: [PATCH 0233/2994] Change mode to -rw-rw-r-- (Logical change 1.47) From e84130845fdbbf3235729ed0b325694b793d5e10 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 13 Dec 2002 16:31:41 +0000 Subject: [PATCH 0234/2994] Change mode to -rw-rw-r-- 2002/12/13 16:18:18+00:00 flatcap.org!flatcap Change mode to -rw-r--r-- (Logical change 1.47) From 8ba6c67a1a384a9337ea3028a032cccf50b09614 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 13 Dec 2002 16:31:41 +0000 Subject: [PATCH 0235/2994] set the perms on a few new files BKrev: 3dfa0b6ds5piZEFr7fMcT4aju_mVjQ From 471c5423f5b6127de2da3c45e31b70e4a12d9d6c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 18 Dec 2002 11:22:14 +0000 Subject: [PATCH 0236/2994] Return the attribute list attribute when enumerating attributes, too. Thanks to Szakacsits Szabolcs for pointing this problem out. (Logical change 1.48) --- ChangeLog | 2 ++ libntfs/attrib.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19e4de73..8c100e32 100644 --- a/ChangeLog +++ b/ChangeLog @@ -163,6 +163,8 @@ - Add sanity check to ntfs_inode_close() to detect attempts at closing extent inodes. - Don't free extent inodes in attrib.c! (Szakacsits Szabolcs) + - Return the attribute list attribute when enumerating attributes, too. + Thanks to Szakacsits Szabolcs for pointing this problem out. 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 22290f52..44805948 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1428,6 +1428,7 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const uchar_t *name, ATTR_RECORD *a; uchar_t *al_name; u32 al_name_len; + BOOL is_first_search = FALSE; ni = ctx->ntfs_ino; base_ni = ctx->base_ntfs_ino; @@ -1445,8 +1446,10 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const uchar_t *name, vol = base_ni->vol; al_start = base_ni->attr_list; al_end = al_start + base_ni->attr_list_size; - if (!ctx->al_entry) + if (!ctx->al_entry) { ctx->al_entry = (ATTR_LIST_ENTRY*)al_start; + is_first_search = TRUE; + } /* * Iterate over entries in attribute list starting at @ctx->al_entry, * or the entry following that, if @ctx->is_first is TRUE. @@ -1454,9 +1457,71 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const uchar_t *name, if (ctx->is_first) { al_entry = ctx->al_entry; ctx->is_first = FALSE; - } else + /* + * If an enumeration and the first attribute is higher than + * the attribute list itself, need to return the attribute list + * attribute. + */ + if (!type && is_first_search && le16_to_cpu(al_entry->type) > + le16_to_cpu(AT_ATTRIBUTE_LIST)) + goto find_attr_list_attr; + } else { al_entry = (ATTR_LIST_ENTRY*)((char*)ctx->al_entry + le16_to_cpu(ctx->al_entry->length)); + /* + * If this is an enumeration and the attribute list attribute + * is the next one in the enumeration sequence, just return the + * attribute list attribute from the base mft record as it is + * not listed in the attribute list itself. + */ + if (!type && le16_to_cpu(ctx->al_entry->type) < + le16_to_cpu(AT_ATTRIBUTE_LIST) && + le16_to_cpu(al_entry->type) > + le16_to_cpu(AT_ATTRIBUTE_LIST)) { + int rc; +find_attr_list_attr: + + /* Check for bogus calls. */ + if (name || name_len || val || val_len || lowest_vcn) { + errno = EINVAL; + return -1; + } + + /* We want the base record. */ + ctx->ntfs_ino = base_ni; + ctx->mrec = ctx->base_mrec; + ctx->is_first = TRUE; + /* Sanity checks are performed elsewhere. */ + ctx->attr = (ATTR_RECORD*)((u8*)ctx->mrec + + le16_to_cpu(ctx->mrec->attrs_offset)); + + /* Find the attribute list attribute. */ + rc = ntfs_attr_find(AT_ATTRIBUTE_LIST, NULL, 0, + IGNORE_CASE, NULL, 0, ctx); + + /* + * Setup the search context so the correct + * attribute is returned next time round. + */ + ctx->al_entry = al_entry; + ctx->is_first = TRUE; + + /* Got it. Done. */ + if (!rc) + return 0; + + /* Error! If other than not found return it. */ + if (errno != EINVAL) + return rc; + + /* Not found?!? Absurd! Must be a bug... )-: */ + Dprintf("%s(): BUG! Attribute list attribute not found " + "but it exists! Returning error " + "(EINVAL).", __FUNCTION__); + errno = EINVAL; + return -1; + } + } for (;; al_entry = next_al_entry) { /* Out of bounds check. */ if ((u8*)al_entry < base_ni->attr_list || From 5f944c510753fe98b7d76a286d6317cdd2de2598 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 18 Dec 2002 11:22:14 +0000 Subject: [PATCH 0237/2994] Return the attribute list attribute when enumerating attributes, too. Thanks to Szakacsits Szabolcs for pointing this problem out. BKrev: 3e005a66e72YZ4loCumJL-oxl1FkJA From 06584bb95097947b2451baf12e34b9d223258a43 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 23 Dec 2002 04:40:25 +0000 Subject: [PATCH 0238/2994] minor tweaks to man pages BKrev: 3e0693b9RzF3qZa5zSkARYha8FZ5pQ From 363b1bc4dfc6a7aa2090345c249f860fc526a6c0 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 23 Dec 2002 04:40:25 +0000 Subject: [PATCH 0239/2994] qualify sf's name (Logical change 1.49) --- ntfsprogs/ntfsresize.8.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 19cb1025..85c6a1db 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -87,7 +87,7 @@ parameter is given in kilo-, mega- or gigabytes respectively. Conforming to standards, k=10^3, M=10^6 and G=10^9. .SH BUGS No bugs are known or has been reported so far in the current version. -If you find otherwise, please report it to +If you find otherwise, please report it to (no subscription needed). It's also strongly advised you .B MAKE SURE YOU HAVE A BACKUP of your important data in case of an unexpected failure. @@ -108,7 +108,7 @@ man page formed the basis of this page. .SH AVAILABILITY .B ntfsresize is part of the linux-ntfs package and is available from -http://linux-ntfs.sf.net/ as source and pre-compiled binary. +http://linux-ntfs.sourceforge.net/ as source and pre-compiled binary. .SH SEE ALSO .BR fdisk (8), .BR cfdisk (8), From e37809b5a919a3f2d6d4330b455390efc016f081 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 23 Dec 2002 04:40:25 +0000 Subject: [PATCH 0240/2994] typo (Logical change 1.49) --- ntfsprogs/ntfsundelete.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index 160afe19..8a533654 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -27,7 +27,7 @@ will print a list giving the inode number, name and size. .PP The .I undelete -mode takes the inode and recovers as much of the data as possible. It save the +mode takes the inode and recovers as much of the data as possible. It saves the result to another location. Partly for safety, but mostly because NTFS write support isn't finished. .SS Copy From 787420defebd0cc0efacd43dae895bcc58f33916 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 23 Dec 2002 04:42:18 +0000 Subject: [PATCH 0241/2994] [matt] new code (Logical change 1.50) --- ntfsprogs/ntfsinfo.c | 179 ++++++++++++++++++++++--------------------- 1 file changed, 90 insertions(+), 89 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 3843842d..932f9095 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -29,16 +29,30 @@ #include #include #include +#include #include "types.h" #include "mft.h" #include "attrib.h" #include "layout.h" #include "inode.h" -void get_file_attribute_value(const char *dev, long int i); -void print_standard_information_attr(ntfs_attr_search_ctx * ctx); -void print_file_name_attr(ntfs_attr_search_ctx * ctx); +void ntfs_get_file_attributes(const char *dev, long int i); +void ntfs_dump_file_name_attribute(ntfs_inode *inode, MFT_RECORD *mrec); +void ntfs_dump_standard_information(ntfs_inode *inode, MFT_RECORD *mrec); +/** + * ntfs2utc - Convert an NTFS time to Unix time + * @time: An NTFS time in 100ns units since 1601 + * + * NTFS stores times as the number of 100ns intervals since January 1st 1601 at + * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. + * + * Return: n A Unix time (number of seconds since 1970) + */ +time_t ntfs2utc (long long time) +{ + return (time - ((long long) (369 * 365 + 89) * 24 * 3600 * 10000000)) / 10000000; +} #define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000) @@ -55,8 +69,7 @@ int main(int argc, char **argv) locale = setlocale(LC_ALL, NULL); printf("Failed to set locale, using default (%s).\n", locale); - } else - printf("Using locale %s.\n", locale); + } if (argc < 3 || argc > 4) { fprintf(stderr, "%s v%s - %s\n", EXEC_NAME, VERSION, AUTHOR); @@ -66,128 +79,116 @@ int main(int argc, char **argv) else { i = atoll(argv[2]); - get_file_attribute_value(argv[1], i); + ntfs_get_file_attributes(argv[1], i); } return 0; } -void get_file_attribute_value(const char *dev, long int i) +void ntfs_get_file_attributes(const char *dev, long int i) { MFT_REF mref; MFT_RECORD *mrec = NULL; - //ATTR_RECORD *attr = NULL; - //FILE_NAME_ATTR *file_name_attr = NULL; - //STANDARD_INFORMATION *standard_information = NULL; - //SECURITY_DESCRIPTOR_RELATIVE *security_descriptor = NULL; - ntfs_attr_search_ctx *ctx = NULL; + //ntfs_attr_search_ctx *ctx = NULL; ntfs_volume *vol = NULL; - //char *file_name; ntfs_inode *inode = NULL; + //int error; - vol = ntfs_mount(dev, 0); + if(!(vol = ntfs_mount(dev, 0))) { + fprintf(stderr, "ntfsinfo error: cannot mount device %s\n",dev); + exit(1); + } mref = (MFT_REF) i; inode = ntfs_inode_open(vol, mref); if (ntfs_file_record_read(vol, mref, &mrec, NULL)) { - perror("Error reading file record!\n"); + fprintf(stderr, "ntfsinfo error: error reading file record!\n"); exit(1); } + //see flatcap.org/ntfs/info for what formatting should look like + //ntfs_dump_boot_sector_information(inode, mrec); + ntfs_dump_file_name_attribute(inode, mrec); + ntfs_dump_standard_information(inode, mrec); +} + +void ntfs_dump_file_name_attribute(ntfs_inode *inode, MFT_RECORD *mrec) +{ + FILE_NAME_ATTR *file_name_attr = NULL; + ATTR_RECORD *attr = NULL; + ntfs_attr_search_ctx *ctx = NULL; + char *file_name; + time_t ntfs_time; + ctx = ntfs_attr_get_search_ctx(inode, mrec); -// print_file_name_attr(ctx); - -// ctx = ntfs_get_attr_search_ctx(inode, mrec); //need to fix this - - print_standard_information_attr(ctx); -} - - -s64 ntfs2time(s64 time) -{ - s64 t; - printf("Original Time: %Li\n",time); - t = time - NTFS_TIME_OFFSET; - t = t / 10000000; - return t; - - -} - -void print_standard_information_attr(ntfs_attr_search_ctx *ctx) -{ - ATTR_RECORD *attr = NULL; - STANDARD_INFORMATION *standard_information_attr = NULL; - - if (ntfs_attr_lookup - (AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - perror("Error looking up $STANDARD_INFORMATION!\n"); - exit(1); + if(ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + fprintf(stderr, "ntfsinfo error: cannot lookup attribute AT_FILE_NAME!\n"); + return; } attr = ctx->attr; - standard_information_attr = - (STANDARD_INFORMATION *) ((char *) attr + - le16_to_cpu(attr->value_offset)); + file_name_attr = (FILE_NAME_ATTR*)((char *)attr + le16_to_cpu(attr->value_offset)); - printf("Creation time: %Li\n", - ntfs2time(standard_information_attr->creation_time)); -/* printf("Last Data Change Time: %Li\n", - ntfs2time(standard_information_attr->last_data_change_time)); - printf("Last MFT Change Time: %Li\n", - ntfs2time(standard_information_attr->last_mft_change_time)); - printf("Last Access Time: %Li\n", - ntfs2time(standard_information_attr->last_access_time)); - printf("Maxium Versions: %d\n", - standard_information_attr->maximum_versions); - printf("Version Number: %d\n", - standard_information_attr->version_number); - printf("Class ID: %d\n", - standard_information_attr->class_id); - printf("Owner ID: %d\n", - standard_information_attr->owner_id); - printf("Security ID: %d\n", - standard_information_attr->security_id); + file_name = malloc(file_name_attr->file_name_length * sizeof(char)); + + //need to convert the little endian unicode string to a multibyte string + ntfs_ucstombs(file_name_attr->file_name, file_name_attr->file_name_length, + &file_name, file_name_attr->file_name_length); + + printf("Dumping $FILE_NAME (0x30)\n"); + + //basic stuff about the file + printf("File Name: \t\t %s\n",file_name); + printf("File Name Length: \t %d\n",file_name_attr->file_name_length); + printf("Allocated File Size: \t %lld\n", sle64_to_cpu(file_name_attr->allocated_size)); + printf("Real File Size: \t %lld\n", sle64_to_cpu(file_name_attr->data_size)); + + //time conversion stuff + ntfs_time = ntfs2utc(file_name_attr->creation_time); + printf("File Creation Time: \t %s",ctime(&ntfs_time)); + + ntfs_time = ntfs2utc(file_name_attr->last_data_change_time); + printf("File Altered Time: \t %s",ctime(&ntfs_time)); + + ntfs_time = ntfs2utc(file_name_attr->last_mft_change_time); + printf("MFT Changed Time: \t %s",ctime(&ntfs_time)); + + ntfs_time = ntfs2utc(file_name_attr->last_access_time); + printf("Last Acced Time: \t %s",ctime(&ntfs_time)); + + free(file_name); -*/ } -void print_file_name_attr(ntfs_attr_search_ctx *ctx) +void ntfs_dump_standard_information(ntfs_inode *inode, MFT_RECORD *mrec) { - ATTR_RECORD *attr = NULL; - ntfs_attr_search_ctx *c = ctx; - FILE_NAME_ATTR *file_name_attr = NULL; - char *file_name; - if (ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - perror("Error looking up $FILE_NAME_ATTR!\n"); - exit(1); + STANDARD_INFORMATION *standard_attr = NULL; + ATTR_RECORD *attr = NULL; + ntfs_attr_search_ctx *ctx = NULL; + + ctx = ntfs_attr_get_search_ctx(inode, mrec); + + if(ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_STANDARD_INFORMATION!\n"); + return; } attr = ctx->attr; - ctx = c; - file_name_attr = - (FILE_NAME_ATTR *) ((char *) attr + - le16_to_cpu(attr->value_offset)); + standard_attr = (STANDARD_INFORMATION*)((char *)attr + le16_to_cpu(attr->value_offset)); - file_name = malloc(file_name_attr->file_name_length * sizeof (char)); + printf("Dumping $STANDARD_INFORMATION (0x10)\n"); - ntfs_ucstombs(file_name_attr->file_name, - file_name_attr->file_name_length, &file_name, - file_name_attr->file_name_length); + printf("Maximum Number of Versions: \t %d \n",standard_attr->maximum_versions); + printf("Version Number: \t\t %d \n",standard_attr->version_number); + printf("Class ID: \t\t\t %d \n",standard_attr->class_id); + printf("User ID: \t\t\t %d \n", standard_attr->owner_id); + printf("Security ID: \t\t\t %d \n", standard_attr->security_id); - printf("File Name: %s\n", file_name); - printf("File Name Length: %d\n", file_name_attr->file_name_length); - printf("Allocated Size: %Li\n",sle64_to_cpu(file_name_attr->allocated_size)); - printf("Data Size: %Li\n",sle64_to_cpu(file_name_attr->data_size)); } -/*void print_security_descriptor_attr(SECURITY_DESCRIPTOR_RELATIVE *security_descriptor) -{ - -}*/ From e6c73a5203ee17f0fcee890f4e95200e5910298c Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 23 Dec 2002 04:42:18 +0000 Subject: [PATCH 0242/2994] [matt] new code BKrev: 3e06942aA1nErJck4cMQP7gvrGaIbw From 4a70578e206d9d9c94f9120f9517b1bc81c562f1 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 23 Dec 2002 04:45:08 +0000 Subject: [PATCH 0243/2994] ignore generated files (Logical change 1.51) --- BitKeeper/etc/ignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 5a26598b..c8aa7bc8 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -5,7 +5,7 @@ PENDING/* # configure Makefile */Makefile -ntfstools/*.8 +ntfsprogs/*.8 config.log config.h config.cache From 83cf4263606b4d26531615f17bf22f1f074b2e88 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 23 Dec 2002 04:45:08 +0000 Subject: [PATCH 0244/2994] ignore generated files BKrev: 3e0694d4J8oRmm_Dms3icfk0zSJl-g From 16e4e8717ad6407bb3f5164d7f26e331164d04df Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Dec 2002 19:17:56 +0000 Subject: [PATCH 0245/2994] New API function ntfs_ucsnlen() and removal of mkntfs.c/ucsnlen(). (Logical change 1.52) --- ntfsprogs/mkntfs.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index ea08154c..3ff2ca8f 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -367,26 +367,6 @@ s64 ntfs_rlwrite(int fd, const runlist *rl, const char *val, return total; } -/** - * ucslen - determine the length of a fixed-size unicode-character string - * @s: pointer to unicode-character string - * - * Return the number of unicode-characters in @s up to a maximum of maxlen - * unicode-characters, not including the terminating (uchar_t)'\0'. If there - * is no (uchar_t)'\0' between s and s+maxlen, maxlen is returned. - * - * This function never looks beyond s+maxlen. - */ -int ucsnlen(const uchar_t *s, int maxlen) -{ - int i; - - for (i = 0; i < maxlen; i++) - if (!s[i]) - break; - return i; -} - /** * ucstos - convert unicode-character string to ASCII * @dest: points to buffer to receive the converted string From a8d091270fd366d1a33f4499480c9c58487e5264 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Dec 2002 19:17:56 +0000 Subject: [PATCH 0246/2994] New API function ntfs_ucsnlen() and removal of mkntfs.c/ucsnlen(). BKrev: 3e0a0464CMIXENqB2zG4SHAW3CjEuw From 0e871e83b2f44dc0abea6691ae7c56735159e6b1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Dec 2002 19:17:56 +0000 Subject: [PATCH 0247/2994] New API function ntfs_ucsnlen(). (Logical change 1.52) --- ChangeLog | 2 ++ include/unistr.h | 2 ++ libntfs/unistr.c | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8c100e32..18afbdae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -165,6 +165,8 @@ - Don't free extent inodes in attrib.c! (Szakacsits Szabolcs) - Return the attribute list attribute when enumerating attributes, too. Thanks to Szakacsits Szabolcs for pointing this problem out. + - New API function provided by unistr.[hc] and use it in mkntfs: + ntfs_ucsnlen(). 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for diff --git a/include/unistr.h b/include/unistr.h index 73c99f2c..7b1c45a6 100644 --- a/include/unistr.h +++ b/include/unistr.h @@ -42,6 +42,8 @@ extern int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n); extern int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, const uchar_t *upcase, const u32 upcase_size); +extern u32 ntfs_ucsnlen(const uchar_t *s, u32 maxlen); + extern void ntfs_name_upcase(uchar_t *name, u32 name_len, const uchar_t *upcase, const u32 upcase_len); diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 9376cc34..b7f0d014 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -227,6 +227,29 @@ int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, return 0; } +/** + * ntfs_ucsnlen - determine the length of a little endian Unicode string + * @s: pointer to Unicode string + * @maxlen: maximum length of string @s + * + * Return the number of Unicode characters in the little endian Unicode + * string @s up to a maximum of maxlen Unicode characters, not including + * the terminating (uchar_t)'\0'. If there is no (uchar_t)'\0' between @s + * and @s + @maxlen, @maxlen is returned. + * + * This function never looks beyond @s + @maxlen. + */ +u32 ntfs_ucsnlen(const uchar_t *s, u32 maxlen) +{ + u32 i; + + for (i = 0; i < maxlen; i++) { + if (!le16_to_cpu(s[i])) + break; + } + return i; +} + /** * ntfs_name_upcase */ From 36635b8fdcb9b08b31403c6466f0b5ac6848ba47 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Dec 2002 19:25:39 +0000 Subject: [PATCH 0248/2994] Typos. (Logical change 1.53) --- libntfs/volume.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index e9e2831d..21516fa9 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -362,7 +362,7 @@ error_exit: * @name: name of device/file to open * @rwflag: optional mount flags * - * Load, verify and parse bootsector; load and setup $MFT and $MFTMirr. After + * Load, verify, and parse bootsector; load and setup $MFT and $MFTMirr. After * calling this function, the volume is setup sufficiently to call all read * and write access functions provided by the library. * @@ -436,7 +436,7 @@ ntfs_volume *ntfs_volume_startup(const char *name, unsigned long rwflag) } Dputs(OK); - /* Need to setup $MFTMirr so we can use the write functions, too. */ + /* Need to setup $MFTMirr so we can use the write functions, too. */ Dprintf("Loading $MFTMirr... "); if (ntfs_mftmirr_load(vol) < 0) { Dputs(FAILED); @@ -863,9 +863,9 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) * Finally, check if the file system is mounted read-only, and if so set the * NTFS_MF_READONLY flag in *@mnt_flags. * - * On sucess, return 0 with *@mnt_flags set to the ntfs mount flags. + * On sucess return 0 with *@mnt_flags set to the ntfs mount flags. * - * On error, return -1 with errno set to the error code. + * On error return -1 with errno set to the error code. */ int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags) { @@ -924,13 +924,14 @@ int ntfs_version_is_supported(ntfs_volume *vol) * * Fill the value of the $LogFile data attribute, i.e. the contents of * the file, with 0xff's, thus marking the journal as empty. + * * FIXME(?): We might need to zero the LSN field of every single mft * record as well. (But, first try without doing that and see what * happens, since chkdsk might pickup the pieces and do it for us...) * * On success return 0. * - * On error, return -1 with errno set to the error code. + * On error return -1 with errno set to the error code. */ int ntfs_logfile_reset(ntfs_volume *vol) { @@ -1024,7 +1025,7 @@ error_exit: * Set the on-disk volume flags in the mft record of $Volume and * on volume @vol to @flags. * - * Return 0 on successful and -1 if not, with errno set to the error code. + * Return 0 if successful and -1 if not with errno set to the error code. */ int ntfs_volume_set_flags(ntfs_volume *vol, const u16 flags) { From 54a71639263a3cd58d8b455296405421244e0dc2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Dec 2002 19:25:39 +0000 Subject: [PATCH 0249/2994] Typos. BKrev: 3e0a0633wbqgRrbftLwhIcW9SkayDA From b7857b472b81272c5b282adb922170aa418d9a29 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Dec 2002 20:18:29 +0000 Subject: [PATCH 0250/2994] Add lcnalloc to build process. (Logical change 1.54) --- include/Makefile.am | 1 + include/Makefile.in | 1 + libntfs/Makefile.am | 1 + libntfs/Makefile.in | 9 ++++++--- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/Makefile.am b/include/Makefile.am index f6682510..2e75b379 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -17,6 +17,7 @@ linux_ntfsinclude_HEADERS = \ endians.h \ inode.h \ layout.h \ + lcnalloc.h \ list.h \ logfile.h \ mft.h \ diff --git a/include/Makefile.in b/include/Makefile.in index eeb7104d..c38442bb 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -102,6 +102,7 @@ linux_ntfsinclude_HEADERS = \ endians.h \ inode.h \ layout.h \ + lcnalloc.h \ list.h \ logfile.h \ mft.h \ diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 4e868109..26967fee 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -45,6 +45,7 @@ libntfs_la_SOURCES = \ dir.c \ disk_io.c \ inode.c \ + lcnalloc.c \ mft.c \ mst.c \ runlist.c \ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index e7a81983..c77051d2 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -129,6 +129,7 @@ libntfs_la_SOURCES = \ dir.c \ disk_io.c \ inode.c \ + lcnalloc.c \ mft.c \ mst.c \ runlist.c \ @@ -147,7 +148,8 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I.. LIBS = @LIBS@ libntfs_la_LIBADD = libntfs_la_OBJECTS = attrib.lo bootsect.lo compat.lo debug.lo dir.lo \ -disk_io.lo inode.lo mft.lo mst.lo runlist.lo unistr.lo volume.lo +disk_io.lo inode.lo lcnalloc.lo mft.lo mst.lo runlist.lo unistr.lo \ +volume.lo COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -160,8 +162,9 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = gtar GZIP_ENV = --best DEP_FILES = .deps/attrib.P .deps/bootsect.P .deps/compat.P \ -.deps/debug.P .deps/dir.P .deps/disk_io.P .deps/inode.P .deps/mft.P \ -.deps/mst.P .deps/runlist.P .deps/unistr.P .deps/volume.P +.deps/debug.P .deps/dir.P .deps/disk_io.P .deps/inode.P \ +.deps/lcnalloc.P .deps/mft.P .deps/mst.P .deps/runlist.P .deps/unistr.P \ +.deps/volume.P SOURCES = $(libntfs_la_SOURCES) OBJECTS = $(libntfs_la_OBJECTS) From 6d3d453c53d4decf2d7625442a065c51c23975b8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Dec 2002 20:18:29 +0000 Subject: [PATCH 0251/2994] Initial revision --- include/lcnalloc.h | 0 libntfs/lcnalloc.c | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 include/lcnalloc.h create mode 100644 libntfs/lcnalloc.c diff --git a/include/lcnalloc.h b/include/lcnalloc.h new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c new file mode 100644 index 00000000..e69de29b From 4cccbda4fc0157bd7ddb92a08c9254ee0c438c2b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Dec 2002 20:18:29 +0000 Subject: [PATCH 0252/2994] New files lcnalloc.[ch] to contain the cluster (de)allocator API. BKrev: 3e0a1295kAoeE-qht6uwYfrV44Z1Yg From 624000557c187b682d5ca511a5b10f657c11cfdc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Dec 2002 20:18:29 +0000 Subject: [PATCH 0253/2994] Sort out compilation. 2002/12/25 19:48:37+00:00 cantab.net!aia21 (Logical change 1.54) --- libntfs/lcnalloc.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index e69de29b..043dea09 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -0,0 +1,82 @@ +/* + * lcnalloc.c - Cluster (de)allocation code. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +//#include +//#include +//#include + +#include + +#include "types.h" +#include "attrib.h" +#include "runlist.h" +#include "volume.h" +#include "lcnalloc.h" + +//#include "debug.h" + +/** + * ntfs_cluster_alloc - allocate clusters on an ntfs volume + * @vol: mounted ntfs volume on which to allocate the clusters + * @count: number of clusters to allocate + * @start_lcn: starting lcn at which to allocate the clusters (or -1 if none) + * + * Allocate @count clusters starting at cluster @start_lcn or at the current + * allocator position if @start_lcn is -1, from the mounted ntfs volume @vol. + * + * On success return a runlist describing the allocated cluster(s). + * + * On error return NULL with errno set to the error code. + */ +runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn) +{ + if (!vol || count < 0 || start_lcn < 0 || !vol->lcnbmp_na) { + errno = EINVAL; + return NULL; + } + + errno = ENOTSUP; + return NULL; +} + +/** + * ntfs_cluster_free - free clusters on an ntfs volume + * @vol: mounted ntfs volume on which to free the clusters + * @rl: runlist describing the clusters to free + * @start_vcn: starting relative vcn into @rl at which to free the clusters + * @count: number of clusters to free + * + * Allocate @count clusters starting at cluster @start_lcn or at the current + * allocator position if @start_lcn is -1, from the mounted ntfs volume @vol. + * + * On success return 0 and -1 on error with errno set to the error code. + */ +int ntfs_cluster_free(ntfs_volume *vol, runlist *rl, VCN start_vcn, s64 count) +{ + if (!vol || !rl || start_vcn < 0 || count < 0 || !vol->lcnbmp_na) { + errno = EINVAL; + return -1; + } + + errno = ENOTSUP; + return -1; +} + From 185a33e2141afa20c59d3549c894062cee43d067 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Dec 2002 20:18:29 +0000 Subject: [PATCH 0254/2994] Sort out compilation. 2002/12/25 19:51:31+00:00 cantab.net!aia21 (Logical change 1.54) --- include/lcnalloc.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/include/lcnalloc.h b/include/lcnalloc.h index e69de29b..d59cf89b 100644 --- a/include/lcnalloc.h +++ b/include/lcnalloc.h @@ -0,0 +1,36 @@ +/* + * lcnalloc.h - Exports for cluster (de)allocation. Part of the Linux-NTFS + * project. + * + * Copyright (c) 2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_LCNALLOC_H +#define _NTFS_LCNALLOC_H + +#include "types.h" +#include "runlist.h" +#include "volume.h" + +extern runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn); + +extern int ntfs_cluster_free(ntfs_volume *vol, runlist *rl, VCN start_vcn, + s64 count); + +#endif /* defined _NTFS_LCNALLOC_H */ + From cd92a29ccb898bfba9737c9fdcbb0fc20ab5dfcc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Dec 2002 20:18:29 +0000 Subject: [PATCH 0255/2994] Typo. (Logical change 1.54) --- libntfs/volume.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index 21516fa9..a7b63630 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -604,7 +604,7 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) Dperror("Failed to open ntfs attribute"); goto error_exit; } - /* Done with the $BitMap mft record. */ + /* Done with the $Bitmap mft record. */ Dputs(OK); /* Now load the upcase table from $UpCase. */ From 6b5c3e9079eaf8baa3b439aaed8c8ebe4aa7d58f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 00:44:57 +0000 Subject: [PATCH 0256/2994] - New API functions (mostly still WIP): attrib.[hc]: ntfs_resident_attr_value_resize(), ntfs_attr_truncate() inode.[hc]: ntfs_inode_mark_dirty(), ntfs_inode_sync() lcnalloc.[hc]: ntfs_cluster_{alloc,free}() - Renamed ntfs_clusters_{read,write}() to ntfs_cluster_{read,write}(). - Adapt mkntfs to use library implementation of ntfs_resident_attr_value_resize() instead of its own. - Minor typo fixes and comment improvements. BKrev: 3e0a51091Ko5HHKjzCPC-hGmU3mhvQ From 9fd51dde62ccf4817989dafe85827148853fcca8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 00:44:57 +0000 Subject: [PATCH 0257/2994] New API functions (mostly still WIP): attrib.[hc]: ntfs_resident_attr_value_resize(), ntfs_attr_truncate() inode.[hc]: ntfs_inode_mark_dirty(), ntfs_inode_sync() lcnalloc.[hc]: ntfs_cluster_{alloc,free}() Renamed ntfs_clusters_{read,write}() to ntfs_cluster_{read,write}(). (Logical change 1.55) --- ChangeLog | 13 +++- include/attrib.h | 4 + include/disk_io.h | 4 +- include/inode.h | 19 +++++ libntfs/attrib.c | 153 +++++++++++++++++++++++++++++++++++++++ libntfs/disk_io.c | 8 +- libntfs/inode.c | 33 +++++++-- ntfsprogs/mkntfs.c | 35 +-------- ntfsprogs/ntfsundelete.c | 2 +- 9 files changed, 225 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18afbdae..d1de3448 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,7 +13,7 @@ - Rewrite disk_io.[ch] and mft.[ch] defining new access API: disk_io.[ch] provide: ntfs_p{read,write}(), ntfs_mst_p{read,write}(), and - ntfs_clusters_{read,write}(). + ntfs_cluster_{read,write}(). mft.[ch] provide: ntfs_mft_record_{read,write}(), ntfs_mft_records_{read,write}(), and ntfs_mft_record_get_data_size(). @@ -100,7 +100,7 @@ and writes and deal with end of file properly. Affected functions: ntfs_p{read,write}(), ntfs_mst_p{read,write}(), and - ntfs_clusters_{read,write}(). + ntfs_cluster_{read,write}(). - Change ntfsfix to take into account the automatic mft mirror updates. - Add new API provided by new files dir.[ch]: ntfs_inode_lookup_by_name(), and @@ -167,6 +167,15 @@ Thanks to Szakacsits Szabolcs for pointing this problem out. - New API function provided by unistr.[hc] and use it in mkntfs: ntfs_ucsnlen(). + - New API function provided by attrib.[hc] and use it in mkntfs: + ntfs_resident_attr_value_resize(), + ntfs_attr_truncate(). -- WIP + - New API functions provided by inode.[hc]: + ntfs_inode_mark_dirty(), + ntfs_inode_sync(). -- WIP + - Change ntfs_inode_close() to write out dirty inodes and inode extents. + - New API functions provided by lcnalloc.[hc]: + ntfs_cluster_{alloc,free}(). 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for diff --git a/include/attrib.h b/include/attrib.h index f62dc52f..e97f1c07 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -261,6 +261,10 @@ extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, const s64 n); +extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, + const u32 newsize); + +extern int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize); // FIXME / TODO: Above here the file is cleaned up. (AIA) /** diff --git a/include/disk_io.h b/include/disk_io.h index deb34272..266b9eb1 100644 --- a/include/disk_io.h +++ b/include/disk_io.h @@ -32,9 +32,9 @@ extern s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, extern s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, const u32 bksize, const void *b); -extern s64 ntfs_clusters_read(const ntfs_volume *vol, const s64 lcn, +extern s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, const s64 count, const void *b); -extern s64 ntfs_clusters_write(const ntfs_volume *vol, const s64 lcn, +extern s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, const s64 count, const void *b); #endif /* defined _NTFS_DISK_IO_H */ diff --git a/include/inode.h b/include/inode.h index f3a1e9f0..7f93730f 100644 --- a/include/inode.h +++ b/include/inode.h @@ -85,6 +85,7 @@ struct _ntfs_inode { u32 attr_list_size; /* Length of attribute list value in bytes. */ u8 *attr_list; /* Attribute list value itself. */ runlist *attr_list_rl; /* Run list for the attribute list value. */ + /* Below fields are always valid. */ s32 nr_extents; /* For a base mft record, the number of attached extent inodes (0 if none), for extent records this is -1. */ @@ -105,5 +106,23 @@ extern int ntfs_inode_close(ntfs_inode *ni); extern ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref); +/** + * ntfs_inode_mark_dirty - set the inode (and its base inode if it exists) dirty + * @ni: ntfs inode to set dirty + * + * Set the inode @ni dirty so it is written out later (at the latest at + * ntfs_inode_close() time). If @ni is an extent inode, set the base inode + * dirty, too. + * + * This function cannot fail. + */ +static __inline__ void ntfs_inode_mark_dirty(ntfs_inode *ni) { + NInoSetDirty(ni); + if (ni->nr_extents == -1) + NInoSetDirty(ni->base_ni); +} + +extern int ntfs_inode_sync(ntfs_inode *ni); + #endif /* defined _NTFS_INODE_H */ diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 44805948..c06cd269 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2037,3 +2037,156 @@ err_out: return -1; } +/** + * ntfs_non_resident_attr_shrink - shrink a non-resident, open ntfs attribute + * @na: non-resident ntfs attribute to shrink + * @newsize: new size (in bytes) to which to shrink the attribute + * + * Reduce the size of a non-resident, open ntfs attribute @na to @newsize bytes. + * + * On success return 0 and on error return -1 with errno set to the error code. + * The following error codes are defined: + * ENOTSUP - The desired resize is not implemented yet. + */ +static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) { + errno = ENOTSUP; + return -1; +} + +/** + * ntfs_resident_attr_value_resize - resize the value of a resident attribute + * @m: mft record containing attribute record + * @a: attribute record whose value to resize + * @newsize: new size in bytes to which to resize the attribute value of @a + * + * Resize the value of the attribute @a in the mft record @m to @newsize bytes. + * + * Return 0 on success and -1 on error with errno set to the error code. + * The following error codes are defined: + * ENOSPC - Not enough space in mft record to perform the resize. + * Note that on error no modifications have been performed whatsoever. + */ +int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, + const u32 newsize) +{ + u32 new_alen, new_muse; + + /* Calculate the new attribute length and mft record bytes used. */ + new_alen = (le32_to_cpu(a->length) - le32_to_cpu(a->value_length) + + newsize + 7) & ~7; + new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + + new_alen; + /* Not enough space in this mft record. */ + if (new_muse > le32_to_cpu(m->bytes_allocated)) { + errno = ENOSPC; + return -1; + } + /* Move attributes following @a to their new location. */ + memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu(a->length), + le32_to_cpu(m->bytes_in_use) - ((u8*)a - (u8*)m) - + le32_to_cpu(a->length)); + /* Adjust @a to reflect the new value size. */ + a->length = cpu_to_le32(new_alen); + a->value_length = cpu_to_le32(newsize); + /* Adjust @m to reflect the change in used space. */ + m->bytes_in_use = cpu_to_le32(new_muse); + return 0; +} + +/** + * ntfs_resident_attr_shrink - shrink a resident, open ntfs attribute + * @na: resident ntfs attribute to shrink + * @newsize: new size (in bytes) to which to shrink the attribute + * + * Reduce the size of a resident, open ntfs attribute @na to @newsize bytes. + * + * On success return 0 and on error return -1 with errno set to the error code. + * The following error codes are defined: + * ENOTSUP - The desired resize is not implemented yet. + */ +static int ntfs_resident_attr_shrink(ntfs_attr *na, const u32 newsize) { + ntfs_attr_search_ctx *ctx; + int err; + + Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x.\n", __FUNCTION__, + (unsigned long long)na->ni->mft_no, na->type); + /* Get the attribute record that needs modification. */ + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); + if (!ctx) + return -1; + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, + ctx)) { + err = errno; + goto put_err_out; + } + + // TODO: Check the attribute type and the corresponding minimum size + // against @newsize and fail if @newsize is too small! (AIA) + + /* Perform the resize of the attribute record. */ + if (ntfs_resident_attr_value_resize(ctx->mrec, ctx->attr, newsize)) { + err = errno; + goto put_err_out; + } + /* Update the ntfs attribute structure, too. */ + na->allocated_size = na->data_size = na->initialized_size = newsize; + if (NAttrCompressed(na) || NAttrSparse(na)) + na->compressed_size = newsize; + + /* + * Set the inode (and its base inode if it exists) dirty so it is + * written out later. + */ + ntfs_inode_mark_dirty(ctx->ntfs_ino); + + ntfs_attr_put_search_ctx(ctx); + return 0; +put_err_out: + ntfs_attr_put_search_ctx(ctx); + errno = err; + return -1; +} + +/** + * ntfs_attr_truncate - resize an ntfs attribute + * @na: open ntfs attribute to resize + * @newsize: new size (in bytes) to which to resize the attribute + * + * Change the size of an open ntfs attribute @na to @newsize bytes. + * + * On success return 0 and on error return -1 with errno set to the error code. + * The following error codes are defined: + * EINVAL - Invalid arguments were passed to the function. + * ENOTSUP - The desired resize is not implemented yet. + * + * NOTE: At present attributes can only be made smaller using this function, + * never bigger. + */ +int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) +{ + if (!na || newsize < 0) { + errno = EINVAL; + return -1; + } + /* + * Encrypted attributes are not supported. We return access denied, + * which is what Windows NT4 does, too. + */ + if (NAttrEncrypted(na)) { + errno = EACCES; + return -1; + } + /* + * TODO: Implement making attributes bigger/filling in of uninitialized + * holes as well as handling of compressed attributes. (AIA) + */ + if (newsize > na->initialized_size || NAttrCompressed(na)) { + errno = ENOTSUP; + return -1; + } + + if (NAttrNonResident(na)) + return ntfs_non_resident_attr_shrink(na, newsize); + return ntfs_resident_attr_shrink(na, newsize); +} + diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index 28ba6453..eb38b1d0 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -264,7 +264,7 @@ s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, } /** - * ntfs_clusters_read - read ntfs clusters + * ntfs_cluster_read - read ntfs clusters * @vol: volume to read from * @lcn: starting logical cluster number * @count: number of clusters to read @@ -274,7 +274,7 @@ s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, * volume @vol into buffer @b. Return number of clusters read or -1 on error, * with errno set to the error code. */ -s64 ntfs_clusters_read(const ntfs_volume *vol, const s64 lcn, +s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, const s64 count, const void *b) { s64 br; @@ -297,7 +297,7 @@ s64 ntfs_clusters_read(const ntfs_volume *vol, const s64 lcn, } /** - * ntfs_clusters_write - write ntfs clusters + * ntfs_cluster_write - write ntfs clusters * @vol: volume to write to * @lcn: starting logical cluster number * @count: number of clusters to write @@ -307,7 +307,7 @@ s64 ntfs_clusters_read(const ntfs_volume *vol, const s64 lcn, * buffer @b to volume @vol. Return the number of clusters written or -1 on * error, with errno set to the error code. */ -s64 ntfs_clusters_write(const ntfs_volume *vol, const s64 lcn, +s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, const s64 count, const void *b) { s64 bw; diff --git a/libntfs/inode.c b/libntfs/inode.c index f40ae1ea..62be3ea9 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -193,22 +193,25 @@ err_out: * error, @ni has not been freed. The user should attempt to handle the error * and call ntfs_inode_close() again. The following error codes are defined: * - * EBUSY @ni is dirty and/or the attribute list runlist is dirty. + * EBUSY @ni and/or its attribute list runlist is/are dirty and the + * attempt to write it/them to disk failed. * EINVAL @ni is invalid (probably it is an extent inode!) */ int ntfs_inode_close(ntfs_inode *ni) { - /* If the inode is an extent inode, comply rudely! */ + /* If the inode is an extent inode, complain rudely! */ if (ni->nr_extents == -1) { Dprintf("%s(): BUG: Tried to close extent inode!\n", __FUNCTION__); errno = EINVAL; return -1; } - // TODO: This needs to be replaced with a flush to disk attempt. (AIA) + /* If we have dirty metadata, write it out. */ if (NInoDirty(ni) || NInoAttrListDirty(ni)) { - errno = EBUSY; - return -1; + if (ntfs_inode_sync(ni)) { + errno = EBUSY; + return -1; + } } /* Is this a base inode with mapped extent inodes? */ if (ni->nr_extents > 0) { @@ -318,3 +321,23 @@ err_out: return NULL; } +/** + * ntfs_inode_sync - write the inode (and its dirty extents) to disk + * @ni: ntfs inode to write + * + * Write the inode @ni to disk as well as its dirty extent inodes if such + * exist. + * + * Return 0 on success or -1 on error with errno set to the error code. + */ +int ntfs_inode_sync(ntfs_inode *ni) +{ + if (!ni) { + errno = EINVAL; + return -1; + } + + errno = ENOTSUP; + return -1; +} + diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 3ff2ca8f..a016bde9 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -860,35 +860,6 @@ int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) return 0; } -/* Return 0 on success and -errno on error. */ -int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, - const u32 new_vsize) -{ - int new_alen, new_muse; - - /* New attribute length and mft record bytes used. */ - new_alen = (le32_to_cpu(a->length) - le32_to_cpu(a->value_length) + - new_vsize + 7) & ~7; - new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + - new_alen; - /* Check for sufficient space. */ - if (new_muse > le32_to_cpu(m->bytes_allocated) ) { - // Aarrgghh! Need to make space. Probably want generic function - // for this as we need to call it from other places, too. - return -ENOTSUP; - } - /* Move attributes behind @a to their new location. */ - memmove((char*)a + new_alen, (char*)a + le32_to_cpu(a->length), - le32_to_cpu(m->bytes_in_use) - ((char*)a - (char*)m) - - le32_to_cpu(a->length)); - /* Adjust @m to reflect change in used space. */ - m->bytes_in_use = cpu_to_le32(new_muse); - /* Adjust @a to reflect new value size. */ - a->length = cpu_to_le32(new_alen); - a->value_length = cpu_to_le32(new_vsize); - return 0; -} - void deallocate_scattered_clusters(const runlist *rl) { LCN j; @@ -1976,12 +1947,12 @@ int upgrade_to_large_index(MFT_RECORD *m, const char *name, + le16_to_cpu(re->length)); r->index.allocated_size = r->index.index_length; /* Resize index root attribute. */ - err = resize_resident_attribute_value(m, a, sizeof(INDEX_ROOT) - + if (ntfs_resident_attr_value_resize(m, a, sizeof(INDEX_ROOT) - sizeof(INDEX_HEADER) + - le32_to_cpu(r->index.allocated_size)); - if (err) { + le32_to_cpu(r->index.allocated_size))) { // TODO: Remove the added bitmap! // Revert index root from index allocation. + err = -errno; goto err_out; } /* Set VCN pointer to 0LL. */ diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 37d2e4ec..3042db90 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -1823,7 +1823,7 @@ int undelete_file (ntfs_volume *vol, long long inode) goto free; } } else { - if (ntfs_clusters_read(vol, j, 1, buffer) < 1) { + if (ntfs_cluster_read(vol, j, 1, buffer) < 1) { Eprintf ("Read failed: %s\n", strerror (errno)); close (fd); goto free; From de1ed338e66164426d8946eedba465efd0302915 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 14:00:31 +0000 Subject: [PATCH 0258/2994] - Implement ntfs_inode_sync(). - New bit operations NInoTestAndSetDirty() and NInoTestAndClearDirty(). - Fix test_and_set_bit() as well as test_and_clear_bit(). BKrev: 3e0b0b7fSCNq47YYpxs3AtmQdIl8yg From 7781c8f5df8eeaf04ee7c7759b594ce1335831b5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 14:00:31 +0000 Subject: [PATCH 0259/2994] Fix test_and_set_bit() as well as test_and_clear_bit(). (Logical change 1.56) --- include/support.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/include/support.h b/include/support.h index 22c6af2d..a6cd8913 100644 --- a/include/support.h +++ b/include/support.h @@ -43,13 +43,25 @@ #endif /* - * Simple bit operation macros. + * Simple bit operation macros. NOTE: These are NOT atomic. */ -#define test_bit(bit, var) ((var) & (1 << (bit))) -#define set_bit(bit, var) (var) |= 1 << (bit) -#define clear_bit(bit, var) (var) &= ~(1 << (bit)) -#define test_and_set_bit(bit, var) (test_bit(bit, var), set_bit(bit, var)) -#define test_and_clear_bit(bit, var) (test_bit(bit, var), clear_bit(bit, var)) +#define test_bit(bit, var) ((var) & (1 << (bit))) +#define set_bit(bit, var) (var) |= 1 << (bit) +#define clear_bit(bit, var) (var) &= ~(1 << (bit)) + +#define test_and_set_bit(bit, var) \ +({ \ + const BOOL old_state = test_bit(bit, var); \ + set_bit(bit, var); \ + old_state; \ +}) + +#define test_and_clear_bit(bit, var) \ +({ \ + const BOOL old_state = test_bit(bit, var); \ + clear_bit(bit, var); \ + old_state; \ +}) #endif /* defined _NTFS_SUPPORT_H */ From 4ad9d937a6c8b572a0e69980210e69d61123f1e3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 14:00:31 +0000 Subject: [PATCH 0260/2994] Implement ntfs_inode_sync(). (Logical change 1.56) --- ChangeLog | 2 +- libntfs/inode.c | 63 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d1de3448..d58d5e39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -172,7 +172,7 @@ ntfs_attr_truncate(). -- WIP - New API functions provided by inode.[hc]: ntfs_inode_mark_dirty(), - ntfs_inode_sync(). -- WIP + ntfs_inode_sync(). - Change ntfs_inode_close() to write out dirty inodes and inode extents. - New API functions provided by lcnalloc.[hc]: ntfs_cluster_{alloc,free}(). diff --git a/libntfs/inode.c b/libntfs/inode.c index 62be3ea9..5108a556 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -195,7 +195,8 @@ err_out: * * EBUSY @ni and/or its attribute list runlist is/are dirty and the * attempt to write it/them to disk failed. - * EINVAL @ni is invalid (probably it is an extent inode!) + * EINVAL @ni is invalid (probably it is an extent inode). + * EIO I/O error while trying to write inode to disk. */ int ntfs_inode_close(ntfs_inode *ni) { @@ -209,7 +210,8 @@ int ntfs_inode_close(ntfs_inode *ni) /* If we have dirty metadata, write it out. */ if (NInoDirty(ni) || NInoAttrListDirty(ni)) { if (ntfs_inode_sync(ni)) { - errno = EBUSY; + if (errno != EIO) + errno = EBUSY; return -1; } } @@ -326,18 +328,71 @@ err_out: * @ni: ntfs inode to write * * Write the inode @ni to disk as well as its dirty extent inodes if such - * exist. + * exist and @ni is a base inode. If @ni is an extent inode, only @ni is + * written completely disregarding its base inode and any other extent inodes. + * + * For a base inode with dirty extent inodes if any writes fail for whatever + * reason, the failing inode is skipped and the sync process is continued. At + * the end the error condition that brought about the failure is returned. Thus + * the smallest amount of data loss possible occurs. * * Return 0 on success or -1 on error with errno set to the error code. + * The following error codes are defined: + * EINVAL - Invalid arguments were passed to the function. + * ENOTSUP - Syncing requires code that has not been imlemented yet. + * EBUSY - Inode and/or one of its extents is busy, try again later. + * EIO - I/O error while writing the inode (or one of its extents). */ int ntfs_inode_sync(ntfs_inode *ni) { + int err = 0; + if (!ni) { errno = EINVAL; return -1; } - errno = ENOTSUP; + // TODO: Implement writing out of attribute list attribute. (AIA) + if (NInoAttrListDirty(ni)) { + errno = ENOTSUP; + return -1; + } + + /* Write this inode out to the $MFT (and $MFTMirr if applicable). */ + if (NInoTestAndClearDirty(ni)) { + if (ntfs_mft_record_write(ni->vol, ni->mft_no, ni->mrec)) { + if (!err || errno == EIO) { + err = errno; + if (err != EIO) + err = EBUSY; + } + } + } + + /* If this is a base inode with extents write all dirty extents, too. */ + if (ni->nr_extents > 0) { + s32 i; + + for (i = 0; i < ni->nr_extents; ++i) { + ntfs_inode *eni; + + eni = ni->extent_nis[i]; + if (NInoTestAndClearDirty(eni)) { + if (ntfs_mft_record_write(eni->vol, eni->mft_no, + eni->mrec)) { + if (!err || errno == EIO) { + err = errno; + if (err != EIO) + err = EBUSY; + } + } + } + } + } + + if (!err) + return err; + errno = err; return -1; } From 2eddb7228e7db3e6805561850a32a6fe75969723 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 14:00:31 +0000 Subject: [PATCH 0261/2994] New bit operations NInoTestAndSetDirty() and NInoTestAndClearDirty(). (Logical change 1.56) --- include/inode.h | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/include/inode.h b/include/inode.h index 7f93730f..24fc7bc4 100644 --- a/include/inode.h +++ b/include/inode.h @@ -35,6 +35,8 @@ typedef struct _ntfs_inode ntfs_inode; */ typedef enum { NI_Dirty, /* 1: Mft record needs to be written to disk. */ + + /* The NI_AttrList* tests only make sense for base inodes. */ NI_AttrList, /* 1: Mft record contains an attribute list. */ NI_AttrListNonResident, /* 1: Attribute list is non-resident. Implies NI_AttrList is set. */ @@ -42,17 +44,25 @@ typedef enum { mft record and then to disk. */ } ntfs_inode_state_bits; -#define test_nino_flag(ni, flag) test_bit(NI_##flag, (ni)->state) -#define set_nino_flag(ni, flag) set_bit(NI_##flag, (ni)->state) -#define clear_nino_flag(ni, flag) clear_bit(NI_##flag, (ni)->state) +#define test_nino_flag(ni, flag) test_bit(NI_##flag, (ni)->state) +#define set_nino_flag(ni, flag) set_bit(NI_##flag, (ni)->state) +#define clear_nino_flag(ni, flag) clear_bit(NI_##flag, (ni)->state) -#define NInoDirty(ni) test_nino_flag(ni, Dirty) -#define NInoSetDirty(ni) set_nino_flag(ni, Dirty) -#define NInoClearDirty(ni) clear_nino_flag(ni, Dirty) +#define test_and_set_nino_flag(ni, flag) \ + test_and_set_bit(NI_##flag, (ni)->state) +#define test_and_clear_nino_flag(ni, flag) \ + test_and_clear_bit(NI_##flag, (ni)->state) + +#define NInoDirty(ni) test_nino_flag(ni, Dirty) +#define NInoSetDirty(ni) set_nino_flag(ni, Dirty) +#define NInoClearDirty(ni) clear_nino_flag(ni, Dirty) +#define NInoTestAndSetDirty(ni) test_and_set_nino_flag(ni, Dirty) +#define NInoTestAndClearDirty(ni) test_and_clear_nino_flag(ni, Dirty) + +#define NInoAttrList(ni) test_nino_flag(ni, AttrList) +#define NInoSetAttrList(ni) set_nino_flag(ni, AttrList) +#define NInoClearAttrList(ni) clear_nino_flag(ni, AttrList) -#define NInoAttrList(ni) test_nino_flag(ni, AttrList) -#define NInoSetAttrList(ni) set_nino_flag(ni, AttrList) -#define NInoClearAttrList(ni) clear_nino_flag(ni, AttrList) #define test_nino_al_flag(ni, flag) test_nino_flag(ni, AttrList##flag) #define set_nino_al_flag(ni, flag) set_nino_flag(ni, AttrList##flag) From 9920ebfb22270ed600a3ba7e77d55133b89ecc96 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 14:00:31 +0000 Subject: [PATCH 0262/2994] Update TODO.libntfs. (Logical change 1.56) --- TODO.libntfs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/TODO.libntfs b/TODO.libntfs index 7941cdea..9f0fe4af 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -2,6 +2,12 @@ * HIGH priority * ***************** +- write attribute resize function (see mkntfs) and implement ntfs_truncate* + +- write ntfs_cluster_{allocate,free} (see ntfs 2.4 driver in CVS) + +- write ntfs_mft_record_{allocate,free} (see ntfs 2.4 driver in CVS) + - add read of compressed attributes ******************* @@ -13,15 +19,9 @@ - add write of compressed attributes -- write attribute resize function (see mkntfs) and implement ntfs_truncate* - -- write ntfs_cluster(s)_{allocate,free} (see ntfs 2.4 driver in CVS) - - extend ntfs_attr_pwrite to cope with extending the attribute size and with instantiating holes -- write ntfs_mft_record_{allocate,free} (see ntfs 2.4 driver in CVS) - - write ntfs_attr_{rm,create,add}() - write ntfs_index_{rm_from,add_to,create,rm}() From 6c8e401c532e156be21041a6ca1058a715db29a3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 14:03:28 +0000 Subject: [PATCH 0263/2994] Correct Bitkeeper/etc/ignore with the renamed ntfstools directory to ntfsprogs. (Logical change 1.57) --- BitKeeper/etc/ignore | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index c8aa7bc8..766bfa5d 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -21,12 +21,12 @@ linux-ntfs.spec libntfs/*.l? # specific programs -ntfstools/dumplog -ntfstools/mkntfs -ntfstools/ntfsdump_logfile -ntfstools/ntfsfix -ntfstools/ntfsinfo -ntfstools/ntfslabel -ntfstools/ntfsresize -ntfstools/ntfsundelete -ntfstools/ntfswipe +ntfsprogs/dumplog +ntfsprogs/mkntfs +ntfsprogs/ntfsdump_logfile +ntfsprogs/ntfsfix +ntfsprogs/ntfsinfo +ntfsprogs/ntfslabel +ntfsprogs/ntfsresize +ntfsprogs/ntfsundelete +ntfsprogs/ntfswipe From d67cb08072bafa62f61dadf13384f6cbfea8a599 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 14:03:28 +0000 Subject: [PATCH 0264/2994] Correct Bitkeeper/etc/ignore with the renamed ntfstools directory to ntfsprogs. BKrev: 3e0b0c30hCnFLU5zDAjMi1eexzbjuQ From 90623ee1a88dfae33e53c98bd3b9bd039a6f0389 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 20:36:52 +0000 Subject: [PATCH 0265/2994] - New API: ntfs_rl_truncate(). - lowest_vcn is cpu endian not little endian in ntfs_external_attr_find(). - Implement ntfs_non_resident_attr_shrink() for inodes without extents. BKrev: 3e0b6864kIQCHxlS8aBwkJRuaMCQfA From c9ca9fd9b7cef67f6258664cac71f7d4cb5bbbf0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 20:36:52 +0000 Subject: [PATCH 0266/2994] - lowest_vcn is cpu endian not little endian in ntfs_external_attr_find(). - Implement ntfs_non_resident_attr_shrink() for inodes without extents. (Logical change 1.58) --- libntfs/attrib.c | 244 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 225 insertions(+), 19 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index c06cd269..ec14f39b 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -35,6 +35,7 @@ #include "layout.h" #include "inode.h" #include "runlist.h" +#include "lcnalloc.h" uchar_t AT_UNNAMED[] = { const_cpu_to_le16('\0') }; @@ -1604,7 +1605,7 @@ find_attr_list_attr: (char*)next_al_entry + le16_to_cpu( next_al_entry->length) <= al_end && sle64_to_cpu(next_al_entry->lowest_vcn) <= - sle64_to_cpu(lowest_vcn) && + lowest_vcn && next_al_entry->type == al_entry->type && next_al_entry->name_length == al_name_len && ntfs_names_are_equal((uchar_t*)((char*) @@ -1727,7 +1728,7 @@ not_found: * because that would return the first attribute instead of the last * one. Thus we just change @type to AT_END which causes * ntfs_attr_find() to seek to the end. We also do the same when an - * attribute extent was searched for (i.e. lowest_vcn != 0), as we + * attribute extent was searched for (i.e. @lowest_vcn != 0), as we * otherwise rewind the search back to the first extent and we get * that extent returned twice during a search for all extents. */ @@ -2037,22 +2038,6 @@ err_out: return -1; } -/** - * ntfs_non_resident_attr_shrink - shrink a non-resident, open ntfs attribute - * @na: non-resident ntfs attribute to shrink - * @newsize: new size (in bytes) to which to shrink the attribute - * - * Reduce the size of a non-resident, open ntfs attribute @na to @newsize bytes. - * - * On success return 0 and on error return -1 with errno set to the error code. - * The following error codes are defined: - * ENOTSUP - The desired resize is not implemented yet. - */ -static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) { - errno = ENOTSUP; - return -1; -} - /** * ntfs_resident_attr_value_resize - resize the value of a resident attribute * @m: mft record containing attribute record @@ -2071,6 +2056,10 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, { u32 new_alen, new_muse; + // FIXME: Should verify that the attribute name hasn't been placed + // after the attribute value and if it is, we need to move the + // name, too. (AIA) + /* Calculate the new attribute length and mft record bytes used. */ new_alen = (le32_to_cpu(a->length) - le32_to_cpu(a->value_length) + newsize + 7) & ~7; @@ -2104,7 +2093,8 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, * The following error codes are defined: * ENOTSUP - The desired resize is not implemented yet. */ -static int ntfs_resident_attr_shrink(ntfs_attr *na, const u32 newsize) { +static int ntfs_resident_attr_shrink(ntfs_attr *na, const u32 newsize) +{ ntfs_attr_search_ctx *ctx; int err; @@ -2147,6 +2137,222 @@ put_err_out: return -1; } +/** + * ntfs_non_resident_attr_shrink - shrink a non-resident, open ntfs attribute + * @na: non-resident ntfs attribute to shrink + * @newsize: new size (in bytes) to which to shrink the attribute + * + * Reduce the size of a non-resident, open ntfs attribute @na to @newsize bytes. + * + * On success return 0 and on error return -1 with errno set to the error code. + * The following error codes are defined: + * ENOTSUP - The desired resize is not implemented yet. + * ENOMEM - Not enough memory to complete operation. + */ +static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) +{ + ntfs_volume *vol; + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + MFT_RECORD *m; + VCN first_free_vcn; + s64 nr_freed_clusters; + u32 new_alen, new_muse; + int err, mp_size; + + Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x.\n", __FUNCTION__, + (unsigned long long)na->ni->mft_no, na->type); + + vol = na->ni->vol; + + /* Get the first attribute record that needs modification. */ + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); + if (!ctx) + return -1; + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, newsize >> + vol->cluster_size_bits, NULL, 0, ctx)) { + err = errno; + if (err == ENOENT) + err = EIO; + goto put_err_out; + } + a = ctx->attr; + m = ctx->mrec; + + // TODO: Check the attribute type and the corresponding minimum size + // against @newsize and fail if @newsize is too small! (AIA) + + // When extents/an attribute list is/are present it is very complicated: + // TODO: For the current extent: + // TODO: free the required clusters + // FIXME: how do we deal with extents that haven't been loaded yet? + // do we just fault them in first so that the runlist is + // complete and we are done with deallocations in one go? + // TODO: update the run list in na->rl + // TODO: update the sizes, etc in the ntfs attribute structure na + // TODO: update the mapping pairs array + // TODO: mark the inode dirty + // TODO: For all subsequent extents: + // TODO: free all clusters specified by the extent (FIXME: unless + // already done above!) + // TODO: completely delete each extent attribute record from its + // mft record + // TODO: free the mft record if there are no attributes left in it + // (to do so update the $MFT/$Bitmap as well as the mft + // record header in use flag, etc) + // TODO: write the updated mft record to disk + // TODO: remove the extent inode from the list of loaded extent + // inodes in the base inode + // TODO: free all memory associated with the extent inode + // TODO: update the attribute list attribute in ni->attr_list, removing + // all entries corresponding to deleted attributes + // TODO: if the attribute list attribute is resident: + // TODO: update the actual attribute in the base mft + // record from ni->attr_list + // if the attribute list attribute is not resident: + // TODO: update the attribute list attribute run list in + // ni->attr_list_rl, freeing any no longer used + // clusters + // TODO: mark the inode attribute list as containing + // dirty data + // TODO: update the mapping pairs array from + // ni->attr_list_rl + // TODO: mark the base inode dirty + + // TODO: Implement attribute list support as desribed above. (AIA) + if (NInoAttrList(na)) { + err = ENOTSUP; + goto put_err_out; + } + // FIXME: We now know that we don't have an attribute list. Thus we + // are in the base inode only and hence it is all easier, even + // if we are cheating for now... (AIA) + + // FIXME: When @newsize is zero, should convert the attribute to a + // resident attribute. + + /* The first cluster outside the new allocation. */ + first_free_vcn = (newsize + vol->cluster_size - 1) >> + vol->cluster_size_bits; + + /* Deallocate all clusters starting with the first free one. */ + nr_freed_clusters = ntfs_cluster_free(vol, na->rl, first_free_vcn, -1); + if (nr_freed_clusters < 0) { + err = errno; + goto put_err_out; + } + + /* Truncate the runlist itself. */ + if (ntfs_rl_truncate(na->rl, first_free_vcn)) { + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! Run list truncation failed. " + "Leaving inconsistent metadata!\n", + __FUNCTION__); + err = errno; + goto put_err_out; + } + + /* Update the attribute record and the ntfs attribute structure. */ + + na->allocated_size = first_free_vcn << vol->cluster_size_bits; + a->allocated_size = scpu_to_le64(na->allocated_size); + + na->data_size = newsize; + a->data_size = scpu_to_le64(newsize); + + if (newsize < na->initialized_size) { + na->initialized_size = newsize; + a->initialized_size = scpu_to_le64(newsize); + } + + if (NAttrSparse(na)) { + na->compressed_size -= nr_freed_clusters << + vol->cluster_size_bits; + a->compressed_size = scpu_to_le64(na->compressed_size); + + if (na->compressed_size < 0) { + // FIXME: Eeek! BUG! + fprintf(stderr, "%s(): Eeek! Compressed size is " + "negative. Leaving inconsistent " + "metadata!\n", __FUNCTION__); + err = EIO; + goto put_err_out; + } + } + + /* + * Reminder: It is ok for a->highest_vcn to be -1 for zero length + * files. + */ + if (a->highest_vcn) + a->highest_vcn = scpu_to_le64(first_free_vcn - 1); + + /* Get the size for the new mapping pairs array. */ + mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); + if (mp_size <= 0) { + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! Get size for mapping pairs " + "failed. Leaving inconsistent metadata!\n", + __FUNCTION__); + err = errno; + goto put_err_out; + } + + /* + * Generate the new mapping pairs array directly into the correct + * destination, i.e. the attribute record itself. + */ + if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( + a->mapping_pairs_offset), mp_size, na->rl)) { + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! Mapping pairs build failed. " + "Leaving inconsistent metadata!\n", + __FUNCTION__); + err = errno; + goto put_err_out; + } + + // FIXME: Should verify that the attribute name hasn't been placed + // after the attribute value and if it is, we need to move the + // name, too. (AIA) + + /* Calculate the new attribute length and mft record bytes used. */ + new_alen = (le16_to_cpu(a->mapping_pairs_offset) + mp_size + 7) & ~7; + new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + + new_alen; + + if (new_muse > le32_to_cpu(m->bytes_allocated)) { + // FIXME: Eeek! BUG() + fprintf(stderr, "%s(): Eeek! Ran out of space in mft record. " + "Leaving inconsistent metadata!\n", + __FUNCTION__); + err = EIO; + goto put_err_out; + } + + /* Move the following attributes forward. */ + memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu(a->length), + le32_to_cpu(m->bytes_in_use) - ((u8*)a - (u8*)m) - + le32_to_cpu(a->length)); + + /* Update the size of the attribute record and the mft record. */ + a->length = cpu_to_le32(new_alen); + m->bytes_in_use = cpu_to_le32(new_muse); + + /* + * Set the inode (and its base inode if it exists) dirty so it is + * written out later. + */ + ntfs_inode_mark_dirty(ctx->ntfs_ino); + + ntfs_attr_put_search_ctx(ctx); + return 0; +put_err_out: + ntfs_attr_put_search_ctx(ctx); + errno = err; + return -1; +} + /** * ntfs_attr_truncate - resize an ntfs attribute * @na: open ntfs attribute to resize From 1dd01bf3c7db0de3c8a311dc9f33125f4408f091 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 20:36:52 +0000 Subject: [PATCH 0267/2994] New API: ntfs_rl_truncate(). (Logical change 1.58) --- include/runlist.h | 2 ++ libntfs/runlist.c | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/runlist.h b/include/runlist.h index 62ad9431..8a369fbd 100644 --- a/include/runlist.h +++ b/include/runlist.h @@ -63,5 +63,7 @@ extern runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, const int dst_len, const runlist_element *rl); +extern int ntfs_rl_truncate(runlist_element *rl, const VCN start_vcn); + #endif /* defined _NTFS_RUNLIST_H */ diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 0fbf2ced..3e3d70cc 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1106,7 +1106,7 @@ rl_err_out: * * Create the mapping pairs array from the runlist @rl and save the array in * @dst. @dst_len is the size of @dst in bytes and it should be at least equal - * to the value obtained by calling ntfs_get_size_for_mapping_pairs(@rl). + * to the value obtained by calling ntfs_get_size_for_mapping_pairs(). * * Return 0 on success or when @rl is NULL. On error, return -1 with errno set * to the error code. The following error codes are defined: @@ -1174,3 +1174,19 @@ err_out: return -1; } +/** + * ntfs_rl_truncate - truncate a runlist starting at a specified vcn + * @rl: runlist to truncate + * @start_vcn: first vcn which should be cut off + * + * Truncate the runlist @rl starting at vcn @start_vcn as well as the memory + * buffer holding the runlist. + * + * Return 0 on success and -1 on error with errno set to the error code. + */ +int ntfs_rl_truncate(runlist_element *rl, const VCN start_vcn) +{ + errno = ENOTSUP; + return -1; +} + From 833db0bc4bb69c344a409d98016981bcccf04fc3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 20:36:52 +0000 Subject: [PATCH 0268/2994] Typo (Logical change 1.58) --- include/attrib.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/attrib.h b/include/attrib.h index e97f1c07..2d644e45 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -255,6 +255,7 @@ extern LCN ntfs_attr_vcn_to_lcn(ntfs_attr *na, const VCN vcn); extern runlist_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn); extern int ntfs_get_nr_significant_bytes(const s64 n); + extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, const runlist_element *rl); From f8a7ee4a7ecf8d9ab6a94a62ceac9fef966d9cb6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 20:36:52 +0000 Subject: [PATCH 0269/2994] Typos. (Logical change 1.58) --- ntfsprogs/mkntfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index a016bde9..f7fa7a14 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2,7 +2,7 @@ * mkntfs - Part of the Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov - * Copyright (C) 2001-2002 Richard Russon + * Copyright (c) 2001-2002 Richard Russon * * This utility will create an NTFS 1.2 (Windows NT 4.0) volume on a user * specified (block) device. @@ -163,7 +163,7 @@ struct { ATTR_DEF *attr_defs; /* filename, attribute defs. */ int attr_defs_len; /* in bytes */ uchar_t *upcase; /* filename, upcase table. */ - u32 upcase_len; /* Determined automatically. */ + u32 upcase_len; /* Determined automatically. */ char quiet; /* -q, quiet execution. */ char verbose; /* -v, verbose execution, given twice, * really verbose execution (debug @@ -175,7 +175,7 @@ struct { on the volume by default. */ char disable_indexing; /* -I, disables indexing of file contents on the volume by default. */ - /* -V, print version and exit. */ + /* -V, print version and exit. */ } opt; /* Error output. Ignores quiet (-q). */ From 57e13d7537daade199981cbdbd90123526274dc9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 20:36:52 +0000 Subject: [PATCH 0270/2994] Update changelog. (Logical change 1.58) --- ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d58d5e39..68a44548 100644 --- a/ChangeLog +++ b/ChangeLog @@ -175,7 +175,9 @@ ntfs_inode_sync(). - Change ntfs_inode_close() to write out dirty inodes and inode extents. - New API functions provided by lcnalloc.[hc]: - ntfs_cluster_{alloc,free}(). + ntfs_cluster_{alloc,free}(). -- WIP + - New API functions provided by runlist.[hc]: + ntfs_rl_truncate(). -- WIP 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for From 67ae4b965170696845a5f6ff85abc4784b89d4ee Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Dec 2002 20:36:52 +0000 Subject: [PATCH 0271/2994] Update comments for ntfs_cluster_free(). (Logical change 1.58) --- libntfs/lcnalloc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 043dea09..5bea444f 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -62,12 +62,16 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn) * @vol: mounted ntfs volume on which to free the clusters * @rl: runlist describing the clusters to free * @start_vcn: starting relative vcn into @rl at which to free the clusters - * @count: number of clusters to free + * @count: number of clusters to free or -1 for all clusters * - * Allocate @count clusters starting at cluster @start_lcn or at the current - * allocator position if @start_lcn is -1, from the mounted ntfs volume @vol. + * Free @count clusters starting at the cluster @start_vcn in the runlist @rl + * from the mounted ntfs volume @vol. * - * On success return 0 and -1 on error with errno set to the error code. + * If @count is -1, all clusters from @start_vcn to the end of the runlist + * are deallocated. + * + * On success return the number of deallocated clusters (not counting sparse + * clusters) and on error return -1 with errno set to the error code. */ int ntfs_cluster_free(ntfs_volume *vol, runlist *rl, VCN start_vcn, s64 count) { From f070801f381ab236f8bbbe4e6eb12f5ebc301887 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:18:10 +0000 Subject: [PATCH 0272/2994] - Implement ntfs_cluster_free(). - New API function provided by bitmap.[hc]: ntfs_bitmap_clear_run(). BKrev: 3e0c7d42HRZG_tWdMiPBwVY6SfiePg From bccfbfbff4c4f38ca51405277c4dbe7e8afeff23 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:18:10 +0000 Subject: [PATCH 0273/2994] Add export for ntfs_bitmap_clear_run(). (Logical change 1.59) --- include/bitmap.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/bitmap.h b/include/bitmap.h index 8ab67671..20a91313 100644 --- a/include/bitmap.h +++ b/include/bitmap.h @@ -23,6 +23,7 @@ #define _NTFS_BITMAP_H #include "types.h" +#include "attrib.h" /* * NOTES: @@ -99,5 +100,7 @@ static __inline__ char ntfs_bit_get_and_set(u8 *bitmap, const u64 bit, return old_bit; } +extern int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count); + #endif /* defined _NTFS_BITMAP_H */ From d761ee8105e5b58de5d2f74d89e267575f54655b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:18:10 +0000 Subject: [PATCH 0274/2994] Fix compilation. 2002/12/27 16:03:18+00:00 cantab.net!aia21 Implement ntfs_cluster_free(). (Logical change 1.59) --- libntfs/lcnalloc.c | 113 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 100 insertions(+), 13 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 5bea444f..346c5681 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -19,19 +19,16 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -//#include -//#include -//#include - +#include #include #include "types.h" #include "attrib.h" +#include "bitmap.h" #include "runlist.h" #include "volume.h" #include "lcnalloc.h" -//#include "debug.h" /** * ntfs_cluster_alloc - allocate clusters on an ntfs volume @@ -60,12 +57,12 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn) /** * ntfs_cluster_free - free clusters on an ntfs volume * @vol: mounted ntfs volume on which to free the clusters - * @rl: runlist describing the clusters to free - * @start_vcn: starting relative vcn into @rl at which to free the clusters + * @na: attribute whose runlist describes the clusters to free + * @start_vcn: vcn in @rl at which to start freeing clusters * @count: number of clusters to free or -1 for all clusters * - * Free @count clusters starting at the cluster @start_vcn in the runlist @rl - * from the mounted ntfs volume @vol. + * Free @count clusters starting at the cluster @start_vcn in the runlist + * described by the attribute @na from the mounted ntfs volume @vol. * * If @count is -1, all clusters from @start_vcn to the end of the runlist * are deallocated. @@ -73,14 +70,104 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn) * On success return the number of deallocated clusters (not counting sparse * clusters) and on error return -1 with errno set to the error code. */ -int ntfs_cluster_free(ntfs_volume *vol, runlist *rl, VCN start_vcn, s64 count) +int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) { - if (!vol || !rl || start_vcn < 0 || count < 0 || !vol->lcnbmp_na) { + runlist *rl; + s64 nr_freed, delta, to_free; + + if (!vol || !vol->lcnbmp_na || !na || !na->rl || start_vcn < 0 || + (count < 0 && count != -1)) { errno = EINVAL; return -1; } - errno = ENOTSUP; - return -1; + rl = ntfs_attr_find_vcn(na, start_vcn); + if (!rl) + return -1; + + if (rl->lcn < 0 && rl->lcn != LCN_HOLE) { + errno = EIO; + return -1; + } + + /* Find the starting cluster inside the run that needs freeing. */ + delta = start_vcn - rl->vcn; + + /* The number of clusters in this run that need freeing. */ + to_free = rl->length - delta; + if (count >= 0 && to_free > count) + to_free = count; + + if (rl->lcn != LCN_HOLE) { + /* Do the actual freeing of the clusters in this run. */ + if (ntfs_bitmap_clear_run(vol->lcnbmp_na, rl->lcn + delta, + to_free)) + return -1; + /* We have freed @to_free real clusters. */ + nr_freed = to_free; + } else { + /* No real clusters were freed. */ + nr_freed = 0; + } + + /* Go to the next run and adjust the number of clusters left to free. */ + ++rl; + if (count >= 0) + count -= to_free; + + /* + * Loop over the remaining runs, using @count as a capping value, and + * free them. + */ + for (; rl->length && count != 0; ++rl) { + // FIXME: Need to try ntfs_attr_map_runlist() for attribute + // list support! (AIA) + if (rl->lcn < 0 && rl->lcn != LCN_HOLE) { + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! invalid lcn (= %Li). " + "Should attempt to map runlist! " + "Leaving inconsistent metadata!\n", + __FUNCTION__, (long long)rl->lcn); + errno = EIO; + return -1; + } + + /* The number of clusters in this run that need freeing. */ + to_free = rl->length; + if (count >= 0 && to_free > count) + to_free = count; + + if (rl->lcn != LCN_HOLE) { + /* Do the actual freeing of the clusters in the run. */ + if (ntfs_bitmap_clear_run(vol->lcnbmp_na, rl->lcn, + to_free)) { + int eo = errno; + + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! bitmap clear run " + "failed. Leaving inconsistent " + "metadata!\n", __FUNCTION__); + errno = eo; + return -1; + } + /* We have freed @to_free real clusters. */ + nr_freed += to_free; + } + + if (count >= 0) + count -= to_free; + } + + if (count != -1 && count != 0) { + // FIXME: Eeek! BUG() + fprintf(stderr, "%s(): Eeek! count still not zero (= %Li). " + "Leaving inconsistent metadata!\n", + __FUNCTION__, (long long)count); + errno = EIO; + return -1; + } + + /* Done. Return the number of actual clusters that were freed. */ + return nr_freed; } From 5fe5494e4cd8d3f6a8d4eef7f3cbc7d1e7a30302 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:18:10 +0000 Subject: [PATCH 0275/2994] Fix prototype. (Logical change 1.59) --- include/lcnalloc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/lcnalloc.h b/include/lcnalloc.h index d59cf89b..cc5728a9 100644 --- a/include/lcnalloc.h +++ b/include/lcnalloc.h @@ -29,7 +29,7 @@ extern runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn); -extern int ntfs_cluster_free(ntfs_volume *vol, runlist *rl, VCN start_vcn, +extern int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count); #endif /* defined _NTFS_LCNALLOC_H */ From 26a99e4db3d5eb9d64aa5ccf8686dc10dc1e0c72 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:18:10 +0000 Subject: [PATCH 0276/2994] Initial revision --- libntfs/bitmap.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 libntfs/bitmap.c diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c new file mode 100644 index 00000000..e69de29b From 54cde7ab8e7591b0a6d27fc2a25afa8f29e960d5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:18:10 +0000 Subject: [PATCH 0277/2994] (Logical change 1.59) --- libntfs/bitmap.c | 167 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index e69de29b..fec478c4 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -0,0 +1,167 @@ +/* + * bitmap.c - Bitmap handling code. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +#include "types.h" +#include "attrib.h" +#include "bitmap.h" + + +/** + * ntfs_bitmap_clear_run - clear a run of bits in a bitmap + * @na: attribute containing the bitmap + * @start_bit: first bit to clear + * @count: number of bits to clear + * + * Clear @count bits starting at bit @start_bit in the bitmap described by the + * attribute @na. + * + * On success return 0 and on error return -1 with errno set to the error code. + */ +int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) +{ + u8 *buf, *lastbyte_buf; + s64 bufsize, br; + int bit, firstbyte, lastbyte, lastbyte_pos, tmp, err; + + if (!na || start_bit < 0 || count < 0) { + errno = EINVAL; + return -1; + } + + bit = start_bit & 7; + if (bit) + firstbyte = 1; + else + firstbyte = 0; + + /* Calculate the required buffer size in bytes, capping it at 8kiB. */ + bufsize = ((count - (bit ? 8 - bit : 0) + 7) >> 3) + firstbyte; + if (bufsize > 8192) + bufsize = 8192; + + /* Allocate already zeroed memory. */ + buf = (u8*)calloc(1, bufsize); + if (!buf) + return -1; + + /* If there is a first partial byte... */ + if (bit) { + /* read it in... */ + br = ntfs_attr_pread(na, start_bit >> 3, 1, buf); + if (br != 1) { + free(buf); + errno = EIO; + return -1; + } + /* and clear the appropriate bits in it. */ + while ((bit & 7) && count--) + *buf &= ~(1 << bit++); + /* Update @start_bit to the new position. */ + start_bit = (start_bit + 7) & ~7; + } + + /* Loop until @count reaches zero. */ + lastbyte = 0; + lastbyte_buf = NULL; + bit = count & 7; + do { + /* If there is a last partial byte... */ + if (bit) { + lastbyte_pos = ((count + 7) >> 3) + firstbyte; + if (!lastbyte_pos) { + // FIXME: Eeek! BUG! + fprintf(stderr, "%s(): Eeek! lastbyte is zero. " + "Leaving inconsistent " + "metadata.\n", __FUNCTION__); + err = EIO; + goto free_err_out; + } + /* and it is in the currently loaded bitmap window... */ + if (lastbyte_pos <= bufsize) { + lastbyte_buf = buf + lastbyte_pos - 1; + + /* read the byte in... */ + br = ntfs_attr_pread(na, (start_bit + count) >> + 3, 1, lastbyte_buf); + if (br != 1) { + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! Read of " + "last byte failed. " + "Leaving inconsistent " + "metadata.\n", + __FUNCTION__); + err = EIO; + goto free_err_out; + } + /* and clear the appropriate bits in it. */ + while (bit && count--) + *lastbyte_buf &= ~(1 << --bit); + /* We don't want to come back here... */ + bit = 0; + /* We have a last byte that we have handled. */ + lastbyte = 1; + } + } + + /* Write the prepared buffer to disk. */ + tmp = (start_bit >> 3) - firstbyte; + br = ntfs_attr_pwrite(na, tmp, bufsize, buf); + if (br != tmp) { + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! Failed to write buffer " + "to bitmap. Leaving inconsistent " + "metadata.\n", __FUNCTION__); + err = EIO; + goto free_err_out; + } + + /* Update counters. */ + tmp = (bufsize - firstbyte - lastbyte) << 3; + firstbyte = 0; + start_bit += tmp; + count -= tmp; + if (bufsize > (count + 7) >> 3) + bufsize = (count + 7) >> 3; + + if (lastbyte && count != 0) { + // FIXME: Eeek! BUG! + fprintf(stderr, "%s(): Eeek! Last buffer but count is " + "not zero (= %Li). Leaving " + "inconsistent metadata.\n", + __FUNCTION__, count); + err = EIO; + goto free_err_out; + } + } while (count > 0); + + /* Done! */ + free(buf); + return 0; + +free_err_out: + free(buf); + errno = err; + return -1; +} + From 42338a8beee1602e2b54485019c3b092a6c6959d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:18:10 +0000 Subject: [PATCH 0278/2994] Typo fix. (Logical change 1.59) --- libntfs/attrib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index ec14f39b..82879a76 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -563,7 +563,7 @@ map_rl: * attribute @na into the data buffer @b. * * On success, return the number of successfully read bytes. If this number is - * lower than @count this means that the read reached end of file or thet an + * lower than @count this means that the read reached end of file or that an * error was encountered during the read so that the read is partial. 0 means * end of file or nothing was read (also return 0 when @count is 0). * @@ -2236,7 +2236,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) vol->cluster_size_bits; /* Deallocate all clusters starting with the first free one. */ - nr_freed_clusters = ntfs_cluster_free(vol, na->rl, first_free_vcn, -1); + nr_freed_clusters = ntfs_cluster_free(vol, na, first_free_vcn, -1); if (nr_freed_clusters < 0) { err = errno; goto put_err_out; From ccf8a369a2873483cd9d2ab3a7ca6361ab749100 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:18:10 +0000 Subject: [PATCH 0279/2994] Update build process for bitmap.c. (Logical change 1.59) --- libntfs/Makefile.am | 1 + libntfs/Makefile.in | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 26967fee..bd5c41c4 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -39,6 +39,7 @@ lib_LTLIBRARIES = libntfs.la libntfs_la_LDFLAGS = -version-info $(LTVERSION) libntfs_la_SOURCES = \ attrib.c \ + bitmap.c \ bootsect.c \ compat.c \ debug.c \ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index c77051d2..49ff17f0 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -123,6 +123,7 @@ lib_LTLIBRARIES = libntfs.la libntfs_la_LDFLAGS = -version-info $(LTVERSION) libntfs_la_SOURCES = \ attrib.c \ + bitmap.c \ bootsect.c \ compat.c \ debug.c \ @@ -147,9 +148,9 @@ LTLIBRARIES = $(lib_LTLIBRARIES) DEFS = @DEFS@ -I. -I$(srcdir) -I.. LIBS = @LIBS@ libntfs_la_LIBADD = -libntfs_la_OBJECTS = attrib.lo bootsect.lo compat.lo debug.lo dir.lo \ -disk_io.lo inode.lo lcnalloc.lo mft.lo mst.lo runlist.lo unistr.lo \ -volume.lo +libntfs_la_OBJECTS = attrib.lo bitmap.lo bootsect.lo compat.lo debug.lo \ +dir.lo disk_io.lo inode.lo lcnalloc.lo mft.lo mst.lo runlist.lo \ +unistr.lo volume.lo COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -161,8 +162,8 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = gtar GZIP_ENV = --best -DEP_FILES = .deps/attrib.P .deps/bootsect.P .deps/compat.P \ -.deps/debug.P .deps/dir.P .deps/disk_io.P .deps/inode.P \ +DEP_FILES = .deps/attrib.P .deps/bitmap.P .deps/bootsect.P \ +.deps/compat.P .deps/debug.P .deps/dir.P .deps/disk_io.P .deps/inode.P \ .deps/lcnalloc.P .deps/mft.P .deps/mst.P .deps/runlist.P .deps/unistr.P \ .deps/volume.P SOURCES = $(libntfs_la_SOURCES) From f89206c78412bd2cb208d2e69a56efd384931121 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:18:10 +0000 Subject: [PATCH 0280/2994] update changelog (Logical change 1.59) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 68a44548..961031ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -178,6 +178,8 @@ ntfs_cluster_{alloc,free}(). -- WIP - New API functions provided by runlist.[hc]: ntfs_rl_truncate(). -- WIP + - New API function provided by bitmap.[hc]: + ntfs_bitmap_clear_run(). -- WIP 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for From 5fe6d01c9260c8b0f9bdb4cde6b85f007031f3b8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:35:17 +0000 Subject: [PATCH 0281/2994] - Move some run list related functions out of attrib.[hc] into runlist.[hc]. - Fix compile of bitmap.c. BKrev: 3e0c8145BykcQw0WKZvJrJSaZyfmiQ From e5d59f00f1e4873df4d9b3d6695872122e67bfff Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:35:17 +0000 Subject: [PATCH 0282/2994] Fix compile. (Logical change 1.60) --- libntfs/bitmap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index fec478c4..42209e49 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -20,6 +20,7 @@ */ #include +#include #include #include "types.h" From 928eff2891040a2cc37bc5f19148c134f422ef6f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:35:17 +0000 Subject: [PATCH 0283/2994] Move some run list related functions out of attrib.[hc] into runlist.[hc]. (Logical change 1.60) --- include/attrib.h | 8 --- include/runlist.h | 8 +++ libntfs/attrib.c | 133 ---------------------------------------------- libntfs/runlist.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+), 141 deletions(-) diff --git a/include/attrib.h b/include/attrib.h index 2d644e45..906b3e2f 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -254,14 +254,6 @@ extern int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn); extern LCN ntfs_attr_vcn_to_lcn(ntfs_attr *na, const VCN vcn); extern runlist_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn); -extern int ntfs_get_nr_significant_bytes(const s64 n); - -extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, - const runlist_element *rl); - -extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, - const s64 n); - extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, const u32 newsize); diff --git a/include/runlist.h b/include/runlist.h index 8a369fbd..e6e1a3ed 100644 --- a/include/runlist.h +++ b/include/runlist.h @@ -60,6 +60,14 @@ extern runlist_element *ntfs_runlists_merge(runlist_element *drl, extern runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, const ATTR_RECORD *attr, runlist_element *old_rl); +extern int ntfs_get_nr_significant_bytes(const s64 n); + +extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, + const runlist_element *rl); + +extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, + const s64 n); + extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, const int dst_len, const runlist_element *rl); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 82879a76..63b5d864 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1905,139 +1905,6 @@ void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) return; } -/** - * ntfs_get_nr_significant_bytes - get number of bytes needed to store a number - * @n: number for which to get the number of bytes for - * - * Return the number of bytes required to store @n unambiguously as - * a signed number. - * - * This is used in the context of the mapping pairs array to determine how - * many bytes will be needed in the array to store a given logical cluster - * number (lcn) or a specific run length. - * - * Return the number of bytes written. This function cannot fail. - */ -__inline__ int ntfs_get_nr_significant_bytes(const s64 n) -{ - s64 l = n; - int i; - s8 j; - - i = 0; - do { - l >>= 8; - i++; - } while (l != 0LL && l != -1LL); - j = (n >> 8 * (i - 1)) & 0xff; - /* If the sign bit is wrong, we need an extra byte. */ - if ((n < 0LL && j >= 0) || (n > 0LL && j < 0)) - i++; - return i; -} - -/** - * ntfs_get_size_for_mapping_pairs - get bytes needed for mapping pairs array - * @vol: ntfs volume (needed for the ntfs version) - * @rl: runlist for which to determine the size of the mapping pairs - * - * Walk the runlist @rl and calculate the size in bytes of the mapping pairs - * array corresponding to the runlist @rl. This for example allows us to - * allocate a buffer of the right size when building the mapping pairs array. - * - * Return the calculated size in bytes on success. If @rl is NULL return 0. - * On error, return -1 with errno set to the error code. The following error - * codes are defined: - * EINVAL - Run list contains unmapped elements. Make sure to only pass - * fully mapped runlists to this function. - * EIO - The runlist is corrupt. - */ -int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, - const runlist_element *rl) -{ - LCN prev_lcn; - int i, rls; - - if (!rl) - return 0; - /* Always need the termining zero byte. */ - rls = 1; - for (prev_lcn = i = 0; rl[i].length; prev_lcn = rl[++i].lcn) { - if (rl[i].length < 0 || rl[i].lcn < LCN_HOLE) - goto err_out; - /* Header byte + length. */ - rls += 1 + ntfs_get_nr_significant_bytes(rl[i].length); - /* - * If the logical cluster number (lcn) denotes a hole and we - * are on NTFS 3.0+, we don't store it at all, i.e. we need - * zero space. On earlier NTFS versions we just store the lcn. - */ - if (rl[i].lcn == LCN_HOLE && vol->major_ver >= 3) - continue; - /* Change in lcn. */ - rls += ntfs_get_nr_significant_bytes(rl[i].lcn - prev_lcn); - } - return rls; -err_out: - if (rl[i].lcn == LCN_RL_NOT_MAPPED) - errno = EINVAL; - else - errno = EIO; - return -1; -} - -/** - * ntfs_write_significant_bytes - write the significant bytes of a number - * @dst: destination buffer to write to - * @dst_max: pointer to last byte of destination buffer for bounds checking - * @n: number whose significant bytes to write - * - * Store in @dst, the minimum bytes of the number @n which are required to - * identify @n unambiguously as a signed number, taking care not to exceed - * @dest_max, the maximum position within @dst to which we are allowed to - * write. - * - * This is used when building the mapping pairs array of a runlist to compress - * a given logical cluster number (lcn) or a specific run length to the minumum - * size possible. - * - * Return the number of bytes written on success. On error, i.e. the - * destination buffer @dst is too small, return -1 with errno set ENOSPC. - */ -__inline__ int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, - const s64 n) -{ - s64 l = n; - int i; - s8 j; - - i = 0; - do { - if (dst > dst_max) - goto err_out; - *dst++ = l & 0xffLL; - l >>= 8; - i++; - } while (l != 0LL && l != -1LL); - j = (n >> 8 * (i - 1)) & 0xff; - /* If the sign bit is wrong, we need an extra byte. */ - if (n < 0LL && j >= 0) { - if (dst > dst_max) - goto err_out; - i++; - *dst = (s8)-1; - } else if (n > 0LL && j < 0) { - if (dst > dst_max) - goto err_out; - i++; - *dst = (s8)0; - } - return i; -err_out: - errno = ENOSPC; - return -1; -} - /** * ntfs_resident_attr_value_resize - resize the value of a resident attribute * @m: mft record containing attribute record diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 3e3d70cc..e0c5a21d 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1097,6 +1097,139 @@ rl_err_out: return -1; } +/** + * ntfs_get_nr_significant_bytes - get number of bytes needed to store a number + * @n: number for which to get the number of bytes for + * + * Return the number of bytes required to store @n unambiguously as + * a signed number. + * + * This is used in the context of the mapping pairs array to determine how + * many bytes will be needed in the array to store a given logical cluster + * number (lcn) or a specific run length. + * + * Return the number of bytes written. This function cannot fail. + */ +__inline__ int ntfs_get_nr_significant_bytes(const s64 n) +{ + s64 l = n; + int i; + s8 j; + + i = 0; + do { + l >>= 8; + i++; + } while (l != 0LL && l != -1LL); + j = (n >> 8 * (i - 1)) & 0xff; + /* If the sign bit is wrong, we need an extra byte. */ + if ((n < 0LL && j >= 0) || (n > 0LL && j < 0)) + i++; + return i; +} + +/** + * ntfs_get_size_for_mapping_pairs - get bytes needed for mapping pairs array + * @vol: ntfs volume (needed for the ntfs version) + * @rl: runlist for which to determine the size of the mapping pairs + * + * Walk the runlist @rl and calculate the size in bytes of the mapping pairs + * array corresponding to the runlist @rl. This for example allows us to + * allocate a buffer of the right size when building the mapping pairs array. + * + * Return the calculated size in bytes on success. If @rl is NULL return 0. + * On error, return -1 with errno set to the error code. The following error + * codes are defined: + * EINVAL - Run list contains unmapped elements. Make sure to only pass + * fully mapped runlists to this function. + * EIO - The runlist is corrupt. + */ +int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, + const runlist_element *rl) +{ + LCN prev_lcn; + int i, rls; + + if (!rl) + return 0; + /* Always need the termining zero byte. */ + rls = 1; + for (prev_lcn = i = 0; rl[i].length; prev_lcn = rl[++i].lcn) { + if (rl[i].length < 0 || rl[i].lcn < LCN_HOLE) + goto err_out; + /* Header byte + length. */ + rls += 1 + ntfs_get_nr_significant_bytes(rl[i].length); + /* + * If the logical cluster number (lcn) denotes a hole and we + * are on NTFS 3.0+, we don't store it at all, i.e. we need + * zero space. On earlier NTFS versions we just store the lcn. + */ + if (rl[i].lcn == LCN_HOLE && vol->major_ver >= 3) + continue; + /* Change in lcn. */ + rls += ntfs_get_nr_significant_bytes(rl[i].lcn - prev_lcn); + } + return rls; +err_out: + if (rl[i].lcn == LCN_RL_NOT_MAPPED) + errno = EINVAL; + else + errno = EIO; + return -1; +} + +/** + * ntfs_write_significant_bytes - write the significant bytes of a number + * @dst: destination buffer to write to + * @dst_max: pointer to last byte of destination buffer for bounds checking + * @n: number whose significant bytes to write + * + * Store in @dst, the minimum bytes of the number @n which are required to + * identify @n unambiguously as a signed number, taking care not to exceed + * @dest_max, the maximum position within @dst to which we are allowed to + * write. + * + * This is used when building the mapping pairs array of a runlist to compress + * a given logical cluster number (lcn) or a specific run length to the minumum + * size possible. + * + * Return the number of bytes written on success. On error, i.e. the + * destination buffer @dst is too small, return -1 with errno set ENOSPC. + */ +__inline__ int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, + const s64 n) +{ + s64 l = n; + int i; + s8 j; + + i = 0; + do { + if (dst > dst_max) + goto err_out; + *dst++ = l & 0xffLL; + l >>= 8; + i++; + } while (l != 0LL && l != -1LL); + j = (n >> 8 * (i - 1)) & 0xff; + /* If the sign bit is wrong, we need an extra byte. */ + if (n < 0LL && j >= 0) { + if (dst > dst_max) + goto err_out; + i++; + *dst = (s8)-1; + } else if (n > 0LL && j < 0) { + if (dst > dst_max) + goto err_out; + i++; + *dst = (s8)0; + } + return i; +err_out: + errno = ENOSPC; + return -1; +} + /** * ntfs_mapping_pairs_build - build the mapping pairs array from a runlist * @vol: ntfs volume (needed for the ntfs version) From 754a34b8699f7dd3d73aea7e5f7c6e72e96d35c6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:35:17 +0000 Subject: [PATCH 0284/2994] Update changelog. (Logical change 1.60) --- ChangeLog | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 961031ff..01b85629 100644 --- a/ChangeLog +++ b/ChangeLog @@ -60,10 +60,8 @@ - Do folding assisting cleanups. (Richard Russon, me) - Add new API call ntfs_boot_sector_is_ntfs() provided by bootsect.[hc]. - Define and write more API calls provided by attrib.[ch]: - ntfs_runlists_merge(), - ntfs_mapping_pairs_decompress(), ntfs_attr_map_runlist(), - ntfs_{rl,attr}_vcn_to_lcn(), + ntfs_attr_vcn_to_lcn(), ntfs_attr_find_vcn(), ntfs_attr_init(), ntfs_attr_{open,close}(). @@ -120,11 +118,16 @@ - Add new syntactic sugar API provided by attrib.h: ntfs_attrs_walk(). (Szakacsits Szabolcs) - Add new API for compressing runlists into mapping pairs arrays - provided by attrib.[ch] (adapted from mkntfs.c): + provided by runlist.[hc] (some adapted from mkntfs.c): + ntfs_rl_vcn_to_lcn(), + ntfs_rl_pwrite(), + ntfs_runlists_merge(), + ntfs_mapping_pairs_decompress(), ntfs_get_nr_significant_bytes(), ntfs_get_size_for_mapping_pairs(), - ntfs_write_significant_bytes(), and - ntfs_mapping_pairs_build(). + ntfs_write_significant_bytes(), + ntfs_mapping_pairs_build(), and + ntfs_rl_truncate(). -- WIP - Convert mkntfs.c to the above API. - Implement attrib.[hc]::ntfs_rl_pwrite() as a low level scatter write function analogous in functionality to mkntfs.c::ntfs_rlwrite() but @@ -176,8 +179,6 @@ - Change ntfs_inode_close() to write out dirty inodes and inode extents. - New API functions provided by lcnalloc.[hc]: ntfs_cluster_{alloc,free}(). -- WIP - - New API functions provided by runlist.[hc]: - ntfs_rl_truncate(). -- WIP - New API function provided by bitmap.[hc]: ntfs_bitmap_clear_run(). -- WIP From 66fb584c1aff48a6d589c07bd5861b195efe7fd5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:35:17 +0000 Subject: [PATCH 0285/2994] Update todo. (Logical change 1.60) --- TODO.libntfs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TODO.libntfs b/TODO.libntfs index 9f0fe4af..4351692b 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -4,9 +4,9 @@ - write attribute resize function (see mkntfs) and implement ntfs_truncate* -- write ntfs_cluster_{allocate,free} (see ntfs 2.4 driver in CVS) +- write ntfs_cluster_allocate() (see ntfs 2.4 driver in CVS) -- write ntfs_mft_record_{allocate,free} (see ntfs 2.4 driver in CVS) +- write ntfs_mft_record_{allocate,free}() (see ntfs 2.4 driver in CVS) - add read of compressed attributes From eb98ae1dca2219e059c52416ecb2397884def46a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:48:52 +0000 Subject: [PATCH 0286/2994] Change ntfs_rl_truncate() to take address of the runlist rather than the runlist to allow reallocation of the runlist buffer. (Logical change 1.61) --- include/runlist.h | 2 +- libntfs/attrib.c | 2 +- libntfs/runlist.c | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/runlist.h b/include/runlist.h index e6e1a3ed..61069bce 100644 --- a/include/runlist.h +++ b/include/runlist.h @@ -71,7 +71,7 @@ extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, const int dst_len, const runlist_element *rl); -extern int ntfs_rl_truncate(runlist_element *rl, const VCN start_vcn); +extern int ntfs_rl_truncate(runlist **rl, const VCN start_vcn); #endif /* defined _NTFS_RUNLIST_H */ diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 63b5d864..250efa18 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2110,7 +2110,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) } /* Truncate the runlist itself. */ - if (ntfs_rl_truncate(na->rl, first_free_vcn)) { + if (ntfs_rl_truncate(&na->rl, first_free_vcn)) { // FIXME: Eeek! We need rollback! (AIA) fprintf(stderr, "%s(): Eeek! Run list truncation failed. " "Leaving inconsistent metadata!\n", diff --git a/libntfs/runlist.c b/libntfs/runlist.c index e0c5a21d..85d1ec3f 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1309,15 +1309,18 @@ err_out: /** * ntfs_rl_truncate - truncate a runlist starting at a specified vcn - * @rl: runlist to truncate + * @rl: address of runlist to truncate * @start_vcn: first vcn which should be cut off * - * Truncate the runlist @rl starting at vcn @start_vcn as well as the memory + * Truncate the runlist *@rl starting at vcn @start_vcn as well as the memory * buffer holding the runlist. * * Return 0 on success and -1 on error with errno set to the error code. + * + * NOTE: @rl is the address of the runlist. We need the address so we can + * modify the pointer to the runlist with the new, reallocated memory buffer. */ -int ntfs_rl_truncate(runlist_element *rl, const VCN start_vcn) +int ntfs_rl_truncate(runlist **rl, const VCN start_vcn) { errno = ENOTSUP; return -1; From 78e207b2f90c44ff779994f6abfef82843104efb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:48:52 +0000 Subject: [PATCH 0287/2994] Change ntfs_rl_truncate() to take address of the runlist rather than the runlist to allow reallocation of the runlist buffer. BKrev: 3e0c8474LNHF-sHxrKW2PvR56flIAw From 3bc805714ede2bb46e5e403424d962d2f3881e62 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 16:48:52 +0000 Subject: [PATCH 0288/2994] update todo (Logical change 1.61) --- TODO.libntfs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/TODO.libntfs b/TODO.libntfs index 4351692b..34ba58aa 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -2,7 +2,10 @@ * HIGH priority * ***************** -- write attribute resize function (see mkntfs) and implement ntfs_truncate* +- implement ntfs_rl_truncate(). + +- write attribute resize function (see mkntfs) and implement + ntfs_attr_truncate() - write ntfs_cluster_allocate() (see ntfs 2.4 driver in CVS) From 02a141c9c0423d36045968d300f3b768b95c9d58 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 17:25:45 +0000 Subject: [PATCH 0289/2994] - Add variables used bu the cluster and mft allocators to the ntfs_volume structure. - Setup the cluster and mft allocators. BKrev: 3e0c8d19gy-d4BTZdoMOn6CjRiL11w From 91597fe05051f019b7d236d17cb12ddcdea5aaaf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 17:25:45 +0000 Subject: [PATCH 0290/2994] Add variables used by the cluster and mft allocators. (Logical change 1.62) --- include/volume.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/volume.h b/include/volume.h index c9d3c4aa..8155686b 100644 --- a/include/volume.h +++ b/include/volume.h @@ -102,6 +102,16 @@ struct _ntfs_volume { u8 cluster_size_bits; /* Log(2) of the byte size of a cluster. */ u8 mft_record_size_bits;/* Log(2) of the byte size of a mft record. */ + /* Variables used by the cluster and mft allocators. */ + u8 mft_zone_multiplier; /* Initial mft zone multiplier. */ + s64 mft_data_pos; /* Mft record number at which to allocate the + next mft record. */ + LCN mft_zone_start; /* First cluster of the mft zone. */ + LCN mft_zone_end; /* First cluster beyond the mft zone. */ + LCN mft_zone_pos; /* Current position in the mft zone. */ + LCN data1_zone_pos; /* Current position in the first data zone. */ + LCN data2_zone_pos; /* Current position in the second data zone. */ + s64 nr_clusters; /* Volume size in clusters, hence also the number of bits in lcn_bitmap. */ ntfs_inode *lcnbmp_ni; /* ntfs_inode structure for FILE_Bitmap. */ From ac10aa770974432318c0440fbb21fe425fde607c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 17:25:45 +0000 Subject: [PATCH 0291/2994] Setup the cluster and mft allocators. (Logical change 1.62) --- libntfs/volume.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/libntfs/volume.c b/libntfs/volume.c index a7b63630..eabc6f5a 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -371,6 +371,7 @@ error_exit: */ ntfs_volume *ntfs_volume_startup(const char *name, unsigned long rwflag) { + LCN mft_zone_size, mft_lcn; s64 br; const char *OK = "OK"; const char *FAILED = "FAILED"; @@ -427,6 +428,82 @@ ntfs_volume *ntfs_volume_startup(const char *name, unsigned long rwflag) free(bs); bs = NULL; + /* + * We now initialize the cluster allocator. + * + * FIXME: Move this to its own function? (AIA) + */ + + // TODO: Make this tunable at mount time. (AIA) + vol->mft_zone_multiplier = 1; + + /* Determine the size of the MFT zone. */ + mft_zone_size = vol->nr_clusters; + switch (vol->mft_zone_multiplier) { /* % of volume size in clusters */ + case 4: + mft_zone_size >>= 1; /* 50% */ + break; + case 3: + mft_zone_size = mft_zone_size * 3 >> 3; /* 37.5% */ + break; + case 2: + mft_zone_size >>= 2; /* 25% */ + break; + /* case 1: */ + default: + mft_zone_size >>= 3; /* 12.5% */ + break; + } + + /* Setup the mft zone. */ + vol->mft_zone_start = vol->mft_zone_pos = vol->mft_lcn; + Dprintf("mft_zone_pos = 0x%Lx\n", (long long)vol->mft_zone_pos); + + /* + * Calculate the mft_lcn for an unmodified NTFS volume (see mkntfs + * source) and if the actual mft_lcn is in the expected place or even + * further to the front of the volume, extend the mft_zone to cover the + * beginning of the volume as well. This is in order to protect the + * area reserved for the mft bitmap as well within the mft_zone itself. + * On non-standard volumes we don't protect it as the overhead would be + * higher than the speed increase we would get by doing it. + */ + mft_lcn = (8192 + 2 * vol->cluster_size - 1) / vol->cluster_size; + if (mft_lcn * vol->cluster_size < 16 * 1024) + mft_lcn = (16 * 1024 + vol->cluster_size - 1) / + vol->cluster_size; + if (vol->mft_zone_start <= mft_lcn) + vol->mft_zone_start = 0; + Dprintf("mft_zone_start = 0x%Lx\n", (long long)vol->mft_zone_start); + + /* + * Need to cap the mft zone on non-standard volumes so that it does + * not point outside the boundaries of the volume. We do this by + * halving the zone size until we are inside the volume. + */ + vol->mft_zone_end = vol->mft_lcn + mft_zone_size; + while (vol->mft_zone_end >= vol->nr_clusters) { + mft_zone_size >>= 1; + vol->mft_zone_end = vol->mft_lcn + mft_zone_size; + } + Dprintf("mft_zone_end = 0x%Lx\n", (long long)vol->mft_zone_end); + + /* + * Set the current position within each data zone to the start of the + * respective zone. + */ + vol->data1_zone_pos = vol->mft_zone_end; + Dprintf("data1_zone_pos = 0x%Lx\n", vol->data1_zone_pos); + vol->data2_zone_pos = 0; + Dprintf("data2_zone_pos = 0x%Lx\n", vol->data2_zone_pos); + + /* Set the mft data allocation position to mft record 24. */ + vol->mft_data_pos = 24; + + /* + * The cluster allocator is now fully operational. + */ + /* Need to setup $MFT so we can use the library read functions. */ Dprintf("Loading $MFT... "); if (ntfs_mft_load(vol) < 0) { From a50496eca80dec7b2e0ccd44a86ecd4cecfac982 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 17:25:45 +0000 Subject: [PATCH 0292/2994] update (Logical change 1.62) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 01b85629..d2319675 100644 --- a/ChangeLog +++ b/ChangeLog @@ -181,6 +181,9 @@ ntfs_cluster_{alloc,free}(). -- WIP - New API function provided by bitmap.[hc]: ntfs_bitmap_clear_run(). -- WIP + - Extend the volume.h::ntfs_volume structure with variables required by + the cluster and mft allocators and set them up in + volume.c::ntfs_volume_startup(). 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for From ebe9aa33f39a06720f615af3eb9820461c622e57 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 18:53:56 +0000 Subject: [PATCH 0293/2994] Implement ntfs_rl_truncate(). (Logical change 1.63) --- libntfs/runlist.c | 87 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 81 insertions(+), 6 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 85d1ec3f..1ef50097 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1309,20 +1309,95 @@ err_out: /** * ntfs_rl_truncate - truncate a runlist starting at a specified vcn - * @rl: address of runlist to truncate + * @arl: address of runlist to truncate * @start_vcn: first vcn which should be cut off * - * Truncate the runlist *@rl starting at vcn @start_vcn as well as the memory + * Truncate the runlist *@arl starting at vcn @start_vcn as well as the memory * buffer holding the runlist. * * Return 0 on success and -1 on error with errno set to the error code. * - * NOTE: @rl is the address of the runlist. We need the address so we can + * NOTE: @arl is the address of the runlist. We need the address so we can * modify the pointer to the runlist with the new, reallocated memory buffer. */ -int ntfs_rl_truncate(runlist **rl, const VCN start_vcn) +int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) { - errno = ENOTSUP; - return -1; + runlist *rl; + BOOL is_end; + + if (!arl || !*arl) { + errno = EINVAL; + return -1; + } + + rl = *arl; + + if (start_vcn < rl->vcn) { + // FIXME: Eeek! BUG() + fprintf(stderr, "%s(): Eeek! start_vcn lies outside front of " + "runlist! Aborting.\n", __FUNCTION__); + errno = EIO; + return -1; + } + + /* Find the starting vcn in the run list. */ + while (rl->length) { + if (start_vcn < rl[1].vcn) + break; + } + if (!rl->length) { + // FIXME: Weird, probably a BUG()! + fprintf(stderr, "%s(): Weird! Asking to truncate already " + "truncated runlist?!? Abort.\n", __FUNCTION__); + errno = EIO; + return -1; + } + if (start_vcn < rl->vcn) { + // FIXME: Eeek! BUG() + fprintf(stderr, "%s(): Eeek! start_vcn < rl->vcn! Aborting.\n", + __FUNCTION__); + errno = EIO; + return -1; + } + + if (rl->length) { + is_end = FALSE; + + /* Truncate the run. */ + rl->length = start_vcn - rl->vcn; + + /* + * If a run was partially truncated, make the following runlist + * element a terminator instead of the truncated runlist + * element itself. + */ + if (rl->length) { + ++rl; + if (!rl->length) + is_end = TRUE; + rl->vcn = start_vcn; + rl->length = 0; + } + } else + is_end = TRUE; + + rl->lcn = (LCN)LCN_ENOENT; + + /* Reallocate memory if necessary. */ + if (!is_end) { + rl = realloc(*arl, (rl - *arl + 1) * sizeof(runlist_element)); + if (rl) + *arl = rl; + else { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Failed to reallocate " + "runlist buffer! Continuing " + "regardless and returning success.\n", + __FUNCTION__); + } + } + + /* Done! */ + return 0; } From 66db0a4f86674d00fdf74ab5e8c84529eb157362 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 18:53:56 +0000 Subject: [PATCH 0294/2994] Implement ntfs_rl_truncate(). BKrev: 3e0ca1c4sg6ib1Q-gDWoTlzCiv1k0A From dd92ef9b61ab7c2cc7356c8e8ef4323413473c3b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 18:53:56 +0000 Subject: [PATCH 0295/2994] update (Logical change 1.63) --- TODO.libntfs | 2 -- 1 file changed, 2 deletions(-) diff --git a/TODO.libntfs b/TODO.libntfs index 34ba58aa..1b3380ae 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -2,8 +2,6 @@ * HIGH priority * ***************** -- implement ntfs_rl_truncate(). - - write attribute resize function (see mkntfs) and implement ntfs_attr_truncate() From 216ca068fd35fb61980e68f10b0f8abd8a542aa6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 23:14:11 +0000 Subject: [PATCH 0296/2994] - Added new utility ntfstruncate, primarily to be able to test the new ntfs_attr_truncate() function, it is not compiled by default. Note, the library can currently only make attributes smaller and it only works on uncompressed, unencrypted inodes which do not contain attribute lists, i.e. on simple files, but that was quite a lot of new code in itself which needs a lot of testing! - ntfs_umount() now also does an fdatasync() on the device before closing it. BKrev: 3e0cdec31tkln57-NXAcN4eNov_nBA From 43c7dfa6af260e3463e5cacc5a060c45e67364a5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 23:14:11 +0000 Subject: [PATCH 0297/2994] Add ntfstruncate to manual build process. (Logical change 1.64) --- ntfsprogs/Makefile.am | 10 +++++++--- ntfsprogs/Makefile.in | 27 ++++++++++++++++++++------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 49c61847..547be2b2 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -20,10 +20,10 @@ LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate -man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 \ - ntfsresize.8 ntfsprogs.8 +man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ + ntfsundelete.8 ntfsresize.8 ntfsprogs.8 EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) @@ -59,6 +59,10 @@ ntfsresize_LDFLAGS = $(AM_LFLAGS) # We don't distribute these +ntfstruncate_SOURCES = attrdef.c ntfstruncate.c +ntfstruncate_LDADD = $(AM_LIBS) +ntfstruncate_LDFLAGS = $(AM_LFLAGS) + ntfswipe_SOURCES = ntfswipe.c ntfswipe.h ntfswipe_LDADD = $(AM_LIBS) ntfswipe_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 911d5a25..fd754d5b 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -102,10 +102,10 @@ LINK = $(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate -man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 ntfsundelete.8 \ - ntfsresize.8 ntfsprogs.8 +man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ + ntfsundelete.8 ntfsresize.8 ntfsprogs.8 EXTRA_MANS = @@ -142,6 +142,10 @@ ntfsresize_LDFLAGS = $(AM_LFLAGS) # We don't distribute these +ntfstruncate_SOURCES = attrdef.c ntfstruncate.c +ntfstruncate_LDADD = $(AM_LIBS) +ntfstruncate_LDFLAGS = $(AM_LFLAGS) + ntfswipe_SOURCES = ntfswipe.c ntfswipe.h ntfswipe_LDADD = $(AM_LIBS) ntfswipe_LDFLAGS = $(AM_LFLAGS) @@ -180,6 +184,11 @@ ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfstruncate_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfstruncate_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) @REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la @@ -229,10 +238,10 @@ TAR = gtar GZIP_ENV = --best DEP_FILES = .deps/attrdef.P .deps/boot.P .deps/dumplog.P .deps/mkntfs.P \ .deps/ntfsdump_logfile.P .deps/ntfsfix.P .deps/ntfsinfo.P \ -.deps/ntfslabel.P .deps/ntfsresize.P .deps/ntfsundelete.P \ -.deps/ntfswipe.P .deps/sd.P .deps/upcase.P -SOURCES = $(ntfsdump_logfile_SOURCES) $(dumplog_SOURCES) $(ntfswipe_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(ntfsundelete_SOURCES) $(ntfsresize_SOURCES) -OBJECTS = $(ntfsdump_logfile_OBJECTS) $(dumplog_OBJECTS) $(ntfswipe_OBJECTS) $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(ntfsundelete_OBJECTS) $(ntfsresize_OBJECTS) +.deps/ntfslabel.P .deps/ntfsresize.P .deps/ntfstruncate.P \ +.deps/ntfsundelete.P .deps/ntfswipe.P .deps/sd.P .deps/upcase.P +SOURCES = $(ntfsdump_logfile_SOURCES) $(dumplog_SOURCES) $(ntfswipe_SOURCES) $(ntfstruncate_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(ntfsundelete_SOURCES) $(ntfsresize_SOURCES) +OBJECTS = $(ntfsdump_logfile_OBJECTS) $(dumplog_OBJECTS) $(ntfswipe_OBJECTS) $(ntfstruncate_OBJECTS) $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(ntfsundelete_OBJECTS) $(ntfsresize_OBJECTS) all: all-redirect .SUFFIXES: @@ -359,6 +368,10 @@ ntfswipe$(EXEEXT): $(ntfswipe_OBJECTS) $(ntfswipe_DEPENDENCIES) @rm -f ntfswipe$(EXEEXT) $(LINK) $(ntfswipe_LDFLAGS) $(ntfswipe_OBJECTS) $(ntfswipe_LDADD) $(LIBS) +ntfstruncate$(EXEEXT): $(ntfstruncate_OBJECTS) $(ntfstruncate_DEPENDENCIES) + @rm -f ntfstruncate$(EXEEXT) + $(LINK) $(ntfstruncate_LDFLAGS) $(ntfstruncate_OBJECTS) $(ntfstruncate_LDADD) $(LIBS) + ntfsfix$(EXEEXT): $(ntfsfix_OBJECTS) $(ntfsfix_DEPENDENCIES) @rm -f ntfsfix$(EXEEXT) $(LINK) $(ntfsfix_LDFLAGS) $(ntfsfix_OBJECTS) $(ntfsfix_LDADD) $(LIBS) From dafd0eefe343266bc37672d1031637feb06406a2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 23:14:11 +0000 Subject: [PATCH 0298/2994] Initial revision --- ntfsprogs/ntfstruncate.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ntfsprogs/ntfstruncate.c diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c new file mode 100644 index 00000000..e69de29b From a6c464ca4d5ac0b034830463409be2b0e5cf23ff Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 23:14:11 +0000 Subject: [PATCH 0299/2994] (Logical change 1.64) --- ntfsprogs/ntfstruncate.c | 771 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 771 insertions(+) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index e69de29b..af324f8a 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -0,0 +1,771 @@ +/* + * ntfstruncate - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov + * + * This utility will truncate a specified attribute belonging to a + * specified inode, i.e. file or directory, to a specified length. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS source + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDARG_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_ERRNO_H +# include +#endif +#include +#include +#ifdef HAVE_GETOPT_H +# include +#else + extern char *optarg; + extern int optind; +#endif +#include +#ifndef LLONG_MAX +# define LLONG_MAX 9223372036854775807LL +#endif + +#include "types.h" +#include "attrib.h" +#include "inode.h" +#include "layout.h" +#include "volume.h" + +extern const unsigned char attrdef_ntfs12_array[2400]; + +const char *EXEC_NAME = "ntfstruncate"; + +/* Need these global so ntfstruncate_exit can access them. */ +BOOL success = FALSE; + +char *dev_name; +s64 inode; +u32 attr_type; +s64 new_len; + +ntfs_volume *vol; +ntfs_inode *ni; +ntfs_attr *na = NULL; + +struct flock flk; + +ATTR_DEF *attr_defs; + +struct { + /* -h, print usage and exit. */ + char no_action; /* -n, do not write to device, only display + what would be done. */ + char quiet; /* -q, quiet execution. */ + char verbose; /* -v, verbose execution, given twice, really + verbose execution (debug mode). */ + char force; /* -F, force truncation. */ + /* -V, print version and exit. */ +} opt; + +/* Error output. Ignores quiet (-q). */ +void Eprintf(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); +} + +void err_exit(const char *fmt, ...) __attribute__ ((noreturn)); + +/* Error output and terminate. Ignores quiet (-q). */ +void err_exit(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "Aborting...\n"); + exit(1); +} + +/* Debugging output (-vv). Overriden by quiet (-q). */ +void Dprintf(const char *fmt, ...) +{ + va_list ap; + + if (!opt.quiet && opt.verbose > 1) { + printf("DEBUG: "); + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } +} + +/* Verbose output (-v). Overriden by quite (-q). */ +void Vprintf(const char *fmt, ...) +{ + va_list ap; + + if (!opt.quiet && opt.verbose > 0) { + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } +} + +/* Quietable output (if not -q). */ +void Qprintf(const char *fmt, ...) +{ + va_list ap; + + if (!opt.quiet) { + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } +} + +/** + * ucstos - convert unicode-character string to ASCII + * @dest: points to buffer to receive the converted string + * @src: points to string to convert + * @maxlen: size of @dest buffer in bytes + * + * Return the number of characters written to @dest, not including the + * terminating null byte. If a unicode character was encountered which could + * not be converted -1 is returned. + */ +int ucstos(char *dest, const uchar_t *src, int maxlen) +{ + uchar_t u; + int i; + + /* Need one byte for null terminator. */ + maxlen--; + for (i = 0; i < maxlen; i++) { + u = le16_to_cpu(src[i]); + if (!u) + break; + if (u & 0xff00) + return -1; + dest[i] = u & 0xff; + } + dest[i] = 0; + return i; +} + +void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) +{ + const char *don_t_know = "Don't know what to do with this attribute " + "type yet."; + const char *skip = "Skipping display of $%s attribute value.\n"; + const char *todo = "This is still work in progress."; + char *buf; + int i, j; + + switch (type) { + case AT_STANDARD_INFORMATION: + // TODO + printf("%s\n", todo); + return; + case AT_ATTRIBUTE_LIST: + // TODO + printf("%s\n", todo); + return; + case AT_FILE_NAME: + // TODO + printf("%s\n", todo); + return; + case AT_OBJECT_ID: + // TODO + printf("%s\n", todo); + return; + case AT_SECURITY_DESCRIPTOR: + // TODO + printf("%s\n", todo); + return; + case AT_VOLUME_NAME: + printf("Volume name length = %i\n", val_len); + if (val_len) { + buf = calloc(1, val_len); + if (!buf) + err_exit("Failed to allocate internal buffer: " + "%s\n", strerror(errno)); + i = ucstos(buf, (uchar_t*)val, val_len); + if (i == -1) + printf("Volume name contains non-displayable " + "Unicode characters.\n"); + printf("Volume name = %s\n", buf); + free(buf); + } + return; + case AT_VOLUME_INFORMATION: +#define VOL_INF(x) ((VOLUME_INFORMATION *)(x)) + printf("NTFS version %i.%i\n", VOL_INF(val)->major_ver, + VOL_INF(val)->minor_ver); + i = VOL_INF(val)->flags; +#undef VOL_INF + printf("Volume flags = 0x%x: ", i); + if (!i) { + printf("NONE\n"); + return; + } + j = 0; + if (i & VOLUME_MODIFIED_BY_CHKDSK) { + j = 1; + printf("VOLUME_MODIFIED_BY_CHKDSK"); + } + if (i & VOLUME_REPAIR_OBJECT_ID) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_REPAIR_OBJECT_ID"); + } + if (i & VOLUME_DELETE_USN_UNDERWAY) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_DELETE_USN_UNDERWAY"); + } + if (i & VOLUME_MOUNTED_ON_NT4) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_MOUNTED_ON_NT4"); + } + if (i & VOLUME_UPGRADE_ON_MOUNT) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_UPGRADE_ON_MOUNT"); + } + if (i & VOLUME_RESIZE_LOG_FILE) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_RESIZE_LOG_FILE"); + } + if (i & VOLUME_IS_DIRTY) { + if (j) + printf(" | "); + else + j = 0; + printf("VOLUME_IS_DIRTY"); + } + printf("\n"); + return; + case AT_DATA: + printf(skip, "DATA"); + return; + case AT_INDEX_ROOT: + // TODO + printf("%s\n", todo); + return; + case AT_INDEX_ALLOCATION: + // TODO + printf("%s\n", todo); + return; + case AT_BITMAP: + printf(skip, "BITMAP"); + return; + case AT_REPARSE_POINT: + // TODO + printf("%s\n", todo); + return; + case AT_EA_INFORMATION: + // TODO + printf("%s\n", don_t_know); + return; + case AT_EA: + // TODO + printf("%s\n", don_t_know); + return; + case AT_LOGGED_UTILITY_STREAM: + // TODO + printf("%s\n", don_t_know); + return; + default: + i = le32_to_cpu(type); + printf("Cannot display unknown %s defined attribute type 0x%x" + ".\n", i >= + le32_to_cpu(AT_FIRST_USER_DEFINED_ATTRIBUTE) ? + "user" : "system", i); + } +} + +void dump_resident_attr(ATTR_RECORD *a) +{ + int i; + + i = le32_to_cpu(a->value_length); + printf("Attribute value length = %u (0x%x)\n", i, i); + i = le16_to_cpu(a->value_offset); + printf("Attribute value offset = %u (0x%x)\n", i, i); + i = a->resident_flags; + printf("Resident flags = 0x%x: ", i); + if (!i) + printf("NONE\n"); + else if (i & ~RESIDENT_ATTR_IS_INDEXED) + printf("UNKNOWN FLAG(S)\n"); + else + printf("RESIDENT_ATTR_IS_INDEXED\n"); + dump_resident_attr_val(a->type, (char*)a + le16_to_cpu(a->value_offset), + le32_to_cpu(a->value_length)); +} + +void dump_mapping_pairs_array(char *b, unsigned int max_len) +{ + // TODO + return; +} + +void dump_non_resident_attr(ATTR_RECORD *a) +{ + s64 l; + int i; + + l = sle64_to_cpu(a->lowest_vcn); + printf("Lowest VCN = %Li (0x%Lx)\n", l, l); + l = sle64_to_cpu(a->highest_vcn); + printf("Highest VCN = %Li (0x%Lx)\n", l, l); + printf("Mapping pairs array offset = 0x%x\n", + le16_to_cpu(a->mapping_pairs_offset)); + printf("Compression unit = 0x%x: %sCOMPRESSED\n", a->compression_unit, + a->compression_unit ? "" : "NOT "); + if (sle64_to_cpu(a->lowest_vcn)) + printf("Attribute is not the first extent. The following " + "sizes are meaningless:\n"); + l = sle64_to_cpu(a->allocated_size); + printf("Allocated size = %Li (0x%Lx)\n", l, l); + l = sle64_to_cpu(a->data_size); + printf("Data size = %Li (0x%Lx)\n", l, l); + l = sle64_to_cpu(a->initialized_size); + printf("Initialized size = %Li (0x%Lx)\n", l, l); + if (a->flags & ATTR_COMPRESSION_MASK) { + l = sle64_to_cpu(a->compressed_size); + printf("Compressed size = %Li (0x%Lx)\n", l, l); + } + i = le16_to_cpu(a->mapping_pairs_offset); + dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); +} + +void dump_attr_record(ATTR_RECORD *a) +{ + unsigned int u; + char s[0x200]; + int i; + + printf("-- Beginning dump of attribute record. --\n"); + if (a->type == AT_END) { + printf("Attribute type = 0x%x ($END)\n", le32_to_cpu(AT_END)); + u = le32_to_cpu(a->length); + printf("Length of resident part = %u (0x%x)\n", u, u); + return; + } + u = le32_to_cpu(a->type); + for (i = 0; attr_defs[i].type; i++) + if (le32_to_cpu(attr_defs[i].type) >= u) + break; + if (attr_defs[i].type) { +// printf("type = 0x%x\n", le32_to_cpu(attr_defs[i].type)); +// { char *p = (char*)attr_defs[i].name; +// printf("name = %c%c%c%c%c\n", *p, p[1], p[2], p[3], p[4]); +// } + if (ucstos(s, attr_defs[i].name, sizeof(s)) == -1) { + Eprintf("Could not convert Unicode string to single " + "byte string in current locale.\n"); + strncpy(s, "Error converting Unicode string", + sizeof(s)); + } + } else + strncpy(s, "UNKNOWN_TYPE", sizeof(s)); + printf("Attribute type = 0x%x (%s)\n", u, s); + u = le32_to_cpu(a->length); + printf("Length of resident part = %u (0x%x)\n", u, u); + printf("Attribute is %sresident\n", a->non_resident ? "non-" : ""); + printf("Name length = %u unicode characters\n", a->name_length); + printf("Name offset = %u (0x%x)\n", cpu_to_le16(a->name_offset), + cpu_to_le16(a->name_offset)); + u = a->flags; + if (a->name_length) { + if (ucstos(s, (uchar_t*)((char*)a + + cpu_to_le16(a->name_offset)), + min(sizeof(s), a->name_length + 1)) == -1) { + Eprintf("Could not convert Unicode string to single " + "byte string in current locale.\n"); + strncpy(s, "Error converting Unicode string", + sizeof(s)); + + } + printf("Name = %s\n", s); + } + printf("Attribute flags = 0x%x: ", le16_to_cpu(u)); + if (!u) + printf("NONE"); + else { + int first = TRUE; + if (u & ATTR_COMPRESSION_MASK) { + if (u & ATTR_IS_COMPRESSED) { + printf("ATTR_IS_COMPRESSED"); + first = FALSE; + } + if ((u & ATTR_COMPRESSION_MASK) & ~ATTR_IS_COMPRESSED) { + if (!first) + printf(" | "); + else + first = FALSE; + printf("ATTR_UNKNOWN_COMPRESSION"); + } + } + if (u & ATTR_IS_ENCRYPTED) { + if (!first) + printf(" | "); + else + first = FALSE; + printf("ATTR_IS_ENCRYPTED"); + } + if (u & ATTR_IS_SPARSE) { + if (!first) + printf(" | "); + else + first = FALSE; + printf("ATTR_IS_SPARSE"); + } + } + printf("\n"); + printf("Attribute instance = %u\n", le16_to_cpu(a->instance)); + if (a->non_resident) { + dump_non_resident_attr(a); + } else { + dump_resident_attr(a); + } +} + +void dump_mft_record(MFT_RECORD *m) +{ + ATTR_RECORD *a; + unsigned int u; + MFT_REF r; + + printf("-- Beginning dump of mft record. --\n"); + u = le32_to_cpu(m->magic); + printf("Mft record signature (magic) = %c%c%c%c\n", u & 0xff, + u >> 8 & 0xff, u >> 16 & 0xff, u >> 24 & 0xff); + u = le16_to_cpu(m->usa_ofs); + printf("Update sequence array offset = %u (0x%x)\n", u, u); + printf("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); + printf("$LogFile sequence number (lsn) = %Lu\n", le64_to_cpu(m->lsn)); + printf("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); + printf("Reference (hard link) count = %u\n", + le16_to_cpu(m->link_count)); + u = le16_to_cpu(m->attrs_offset); + printf("First attribute offset = %u (0x%x)\n", u, u); + printf("Flags = %u: ", le16_to_cpu(m->flags)); + if (m->flags & MFT_RECORD_IN_USE) + printf("MFT_RECORD_IN_USE"); + else + printf("MFT_RECORD_NOT_IN_USE"); + if (m->flags & MFT_RECORD_IS_DIRECTORY) + printf(" | MFT_RECORD_IS_DIRECTORY"); + printf("\n"); + u = le32_to_cpu(m->bytes_in_use); + printf("Bytes in use = %u (0x%x)\n", u, u); + u = le32_to_cpu(m->bytes_allocated); + printf("Bytes allocated = %u (0x%x)\n", u, u); + r = le64_to_cpu(m->base_mft_record); + printf("Base mft record reference:\n\tMft record number = %Lu\n\t" + "Sequence number = %u\n", MREF(r), MSEQNO(r)); + printf("Next attribute instance = %u\n", + le16_to_cpu(m->next_attr_instance)); + a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); + printf("-- Beginning dump of attributes within mft record. --\n"); + while ((char*)a < (char*)m + le32_to_cpu(m->bytes_in_use)) { + dump_attr_record(a); + if (a->type == AT_END) + break; + a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); + }; + printf("-- End of attributes. --\n"); +} + +void usage(void) __attribute__ ((noreturn)); + +void usage(void) +{ + fprintf(stderr, "\nThis utility will truncate a specified attribute " + "belonging to a specified\ninode, i.e. file or " + "directory to a specified length.\n\n" + "Usage: %s [-hnqvFV] device inode [attribute-type] " + "new-length\n\nIf attribute-type is not specified, " + "0x80 (i.e. $DATA) is assumed.\n", EXEC_NAME); + exit(1); +} + +void parse_options(int argc, char *argv[]) +{ + long long ll; + char *s, *s2; + int c; + + if (argc && *argv) + EXEC_NAME = *argv; + fprintf(stderr, "%s v%s -- Copyright (c) 2002 Anton Altaparmakov\n", + EXEC_NAME, VERSION); + while ((c = getopt(argc, argv, "hnqvFV")) != EOF) + switch (c) { + case 'n': + opt.no_action = 1; + break; + case 'q': + opt.quiet = 1; + break; + case 'v': + opt.verbose++; + break; + case 'F': + opt.force = 1; + break; + case 'V': + /* Version number already printed, so just exit. */ + exit(0); + case 'h': + default: + usage(); + } + if (optind == argc) + usage(); + + /* Get the device. */ + dev_name = argv[optind++]; + Dprintf("device name = %s\n", dev_name); + + if (optind == argc) + usage(); + + /* Get the inode. */ + ll = strtoll(argv[optind++], &s, 0); + if (*s || !ll || (ll >= LLONG_MAX && errno == ERANGE)) + err_exit("Invalid inode number: %s\n", argv[optind - 1]); + inode = ll; + Dprintf("inode = %Li\n", (long long)inode); + + if (optind == argc) + usage(); + + /* Get the attribute type, if specified. */ + s = argv[optind++]; + if (optind == argc) + attr_type = AT_DATA; + else { + unsigned long ul; + + ul = strtoul(s, &s2, 0); + if (*s2 || !ul || (ul >= ULONG_MAX && errno == ERANGE)) + err_exit("Invalid attribute type: %s\n", s); + attr_type = ul; + + s = argv[optind++]; + + if (optind != argc) + usage(); + } + Dprintf("attribute type = 0x%x\n", attr_type); + + /* Get the new length. */ + ll = strtoll(s, &s2, 0); + if (*s2 || !ll || (ll >= LLONG_MAX && errno == ERANGE)) + err_exit("Invalid new length: %s\n", s); + new_len = ll; + Dprintf("new length = %Li\n", new_len); +} + +void ntfstruncate_exit(void) +{ + int err; + + if (success) + return; + /* Close the attribute. */ + if (na) + ntfs_attr_close(na); + /* Close the inode. */ + if (ni && ntfs_inode_close(ni)) { + fprintf(stderr, "Warning: Failed to close inode %Li: %s\n", + (long long)inode, strerror(errno)); + } + /* Unlock the device. */ + flk.l_type = F_UNLCK; + err = fcntl(vol->fd, F_SETLK, &flk); + if (err == -1) + fprintf(stderr, "Warning: Could not unlock %s: %s\n", dev_name, + strerror(errno)); + /* Unmount the volume. */ + err = ntfs_umount(vol, 0); + if (err == -1) + fprintf(stderr, "Warning: Could not umount %s: %s\n", dev_name, + strerror(errno)); +} + +int main(int argc, char **argv) +{ + unsigned long mnt_flags, ul; + int err; + + /* Initialize opt to zero / required values. */ + memset(&opt, 0, sizeof(opt)); + + /* + * Setup a default $AttrDef. FIXME: Should be reading this from the + * volume itself, at ntfs_mount() time. + */ + attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; + + /* Parse command line options. */ + parse_options(argc, argv); + + /* Make sure the file system is not mounted. */ + if (ntfs_check_if_mounted(dev_name, &mnt_flags)) + Eprintf("Failed to determine whether %s is mounted: %s\n", + dev_name, strerror(errno)); + else if (mnt_flags & NTFS_MF_MOUNTED) { + Eprintf("%s is mounted.\n", dev_name); + if (!opt.force) + err_exit("Refusing to run!\n"); + fprintf(stderr, "ntfstruncate forced anyway. Hope /etc/mtab " + "is incorrect.\n"); + } + + /* Mount the device. */ + if (opt.no_action) { + Qprintf("Running in READ-ONLY mode!\n"); + ul = MS_RDONLY; + } else + ul = 0; + vol = ntfs_mount(dev_name, ul); + if (!vol) + err_exit("Failed to mount %s: %s\n", dev_name, strerror(errno)); + + /* Acquire exlusive (mandatory) lock on the whole device. */ + memset(&flk, 0, sizeof(flk)); + if (opt.no_action) + flk.l_type = F_RDLCK; + else + flk.l_type = F_WRLCK; + flk.l_whence = SEEK_SET; + flk.l_start = flk.l_len = 0LL; + err = fcntl(vol->fd, F_SETLK, &flk); + if (err == -1) { + Eprintf("Could not lock %s for %s: %s\n", dev_name, + opt.no_action ? "reading" : "writing", + strerror(errno)); + err = ntfs_umount(vol, 0); + if (err == -1) + Eprintf("Warning: Could not umount %s: %s\n", + dev_name, strerror(errno)); + exit(1); + } + + /* Register our exit function which will unlock and close the device. */ + err = atexit(&ntfstruncate_exit); + if (err == -1) { + Eprintf("Could not set up exit() function because atexit() " + "failed: %s Aborting...\n", strerror(errno)); + ntfstruncate_exit(); + exit(1); + } + + /* Open the specified inode. */ + ni = ntfs_inode_open(vol, inode); + if (!ni) + err_exit("Failed to open inode %Li: %s\n", (long long)inode, + strerror(errno)); + + /* Open the specified attribute. */ + na = ntfs_attr_open(ni, attr_type, NULL, 0); + if (!na) + err_exit("Failed to open attribute 0x%x: %s\n", attr_type, + strerror(errno)); + + if (!opt.quiet && opt.verbose > 1) { + Dprintf("Dumping mft record before calling " + "ntfs_attr_truncate():\n"); + dump_mft_record(ni->mrec); + } + + /* Truncate the attribute. */ + err = ntfs_attr_truncate(na, new_len); + if (err) + err_exit("Failed to truncate attribute 0x%x: %s\n", attr_type, + strerror(errno)); + + if (!opt.quiet && opt.verbose > 1) { + Dprintf("Dumping mft record after calling " + "ntfs_attr_truncate():\n"); + dump_mft_record(ni->mrec); + } + + /* Close the attribute. */ + ntfs_attr_close(na); + na = NULL; + + /* Close the inode. */ + err = ntfs_inode_close(ni); + if (err) + err_exit("Failed to close inode %Li: %s\n", (long long)inode, + strerror(errno)); + + /* Unlock the device. */ + flk.l_type = F_UNLCK; + err = fcntl(vol->fd, F_SETLK, &flk); + if (err == -1) + fprintf(stderr, "Warning: Failed to unlock %s: %s\n", dev_name, + strerror(errno)); + + /* Unmount the volume. */ + err = ntfs_umount(vol, 0); + if (err == -1) + fprintf(stderr, "Warning: Failed to umount %s: %s\n", dev_name, + strerror(errno)); + + /* Finally, disable our ntfstruncate_exit() handler. */ + success = TRUE; + + Qprintf("ntfstruncate completed successfully. Have a nice day.\n"); + return 0; +} + From 19c9c5dff3277e06508a017f0abb6c31d2d87a58 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 23:14:11 +0000 Subject: [PATCH 0300/2994] ntfs_umount() now also does an fdatasync() on the device before closing it. (Logical change 1.64) --- libntfs/volume.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index eabc6f5a..77cca83c 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -55,12 +55,6 @@ static ntfs_volume *__ntfs_volume_allocate(void) */ static void __ntfs_volume_release(ntfs_volume *v) { - if (v->fd) - close(v->fd); - if (v->dev_name) - free(v->dev_name); - if (v->vol_name) - free(v->vol_name); if (v->lcnbmp_na) ntfs_attr_close(v->lcnbmp_na); if (v->lcnbmp_ni) @@ -75,6 +69,14 @@ static void __ntfs_volume_release(ntfs_volume *v) ntfs_attr_close(v->mftmirr_na); if (v->mftmirr_ni) ntfs_inode_close(v->mftmirr_ni); + if (v->fd) { + fdatasync(v->fd); + close(v->fd); + } + if (v->dev_name) + free(v->dev_name); + if (v->vol_name) + free(v->vol_name); if (v->upcase) free(v->upcase); free(v); From 8f80ecb2ba8cfa5bc5547f25b9df4c398838045a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 23:14:11 +0000 Subject: [PATCH 0301/2994] update (Logical change 1.64) --- ChangeLog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index d2319675..da0e83c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -184,6 +184,14 @@ - Extend the volume.h::ntfs_volume structure with variables required by the cluster and mft allocators and set them up in volume.c::ntfs_volume_startup(). + - ntfs_umount() now also does an fdatasync() on the device before + closing it. + - Added new utility ntfstruncate, primarily to be able to test the + new ntfs_attr_truncate() function, it is not compiled by default. + Note, the library can currently only make attributes smaller and it + only works on uncompressed, unencrypted inodes which do not contain + attribute lists, i.e. on simple files, but that was quite a lot of + new code in itself which needs a lot of testing! 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for From 98d1f0f5b3b3d2fad647a763fb47cc7283aa743d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 23:15:23 +0000 Subject: [PATCH 0302/2994] Add ntfstruncate to the BitKeeper ignore list. (Logical change 1.65) --- BitKeeper/etc/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 766bfa5d..9cd72d96 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -28,5 +28,6 @@ ntfsprogs/ntfsfix ntfsprogs/ntfsinfo ntfsprogs/ntfslabel ntfsprogs/ntfsresize +ntfsprogs/ntfstruncate ntfsprogs/ntfsundelete ntfsprogs/ntfswipe From a447c173379944504be3ea831c04141032009505 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 23:15:23 +0000 Subject: [PATCH 0303/2994] Add ntfstruncate to the BitKeeper ignore list. BKrev: 3e0cdf0btJHp8R--GQgaRIqMlrvdaA From b7270466fec7b471bcb3629507ab05fd6f2e5888 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 23:44:01 +0000 Subject: [PATCH 0304/2994] - libntfs: Do not perform the actual write on a read-only volume! - ntfstruncate: Force is -f not -F. BKrev: 3e0ce5c1pvIVBQfRxu0k7Sv-iooPOQ From 9fd4cc17e3d40cf2ceafc1c469059643177c692b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 23:44:01 +0000 Subject: [PATCH 0305/2994] Do not perform the actual write on a read-only volume! (Logical change 1.66) --- libntfs/attrib.c | 8 ++++++-- libntfs/disk_io.c | 7 +++++-- libntfs/runlist.c | 8 ++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 250efa18..e3d514cd 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -958,8 +958,12 @@ retry: Dprintf("%s(): Writing 0x%Lx bytes to vcn 0x%Lx, lcn 0x%Lx, " "ofs 0x%Lx.\n", __FUNCTION__, to_write, rl->vcn, rl->lcn, ofs); - written = ntfs_pwrite(f, (rl->lcn << vol->cluster_size_bits) + - ofs, to_write, b); + if (!NVolReadOnly(vol)) + written = ntfs_pwrite(f, (rl->lcn << + vol->cluster_size_bits) + ofs, + to_write, b); + else + written = to_write; /* If everything ok, update progress counters and continue. */ if (written > 0) { total += written; diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index eb38b1d0..c6dc7235 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -320,8 +320,11 @@ s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, errno = ESPIPE; return -1; } - bw = ntfs_pwrite(vol->fd, lcn << vol->cluster_size_bits, - count << vol->cluster_size_bits, b); + if (!NVolReadOnly(vol)) + bw = ntfs_pwrite(vol->fd, lcn << vol->cluster_size_bits, + count << vol->cluster_size_bits, b); + else + bw = count << vol->cluster_size_bits; if (bw < 0) { Dperror("Error writing cluster(s)"); return bw; diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 1ef50097..98012dee 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1072,8 +1072,12 @@ s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, to_write = min(count, (rl->length << vol->cluster_size_bits) - ofs); retry: - written = ntfs_pwrite(f, (rl->lcn << vol->cluster_size_bits) + - ofs, to_write, b); + if (!NVolReadOnly(vol)) + written = ntfs_pwrite(f, (rl->lcn << + vol->cluster_size_bits) + ofs, + to_write, b); + else + written = to_write; /* If everything ok, update progress counters and continue. */ if (written > 0) { total += written; From 27f6b2df8dd4492e8ed69d6b9d5178e40af12d82 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 23:44:01 +0000 Subject: [PATCH 0306/2994] Force is -f not -F. (Logical change 1.66) --- ntfsprogs/ntfstruncate.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index af324f8a..1445b5c7 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -88,7 +88,7 @@ struct { char quiet; /* -q, quiet execution. */ char verbose; /* -v, verbose execution, given twice, really verbose execution (debug mode). */ - char force; /* -F, force truncation. */ + char force; /* -f, force truncation. */ /* -V, print version and exit. */ } opt; @@ -527,12 +527,13 @@ void usage(void) __attribute__ ((noreturn)); void usage(void) { - fprintf(stderr, "\nThis utility will truncate a specified attribute " + fprintf(stderr, "This utility will truncate a specified attribute " "belonging to a specified\ninode, i.e. file or " - "directory to a specified length.\n\n" + "directory, to a specified length.\n\n" "Usage: %s [-hnqvFV] device inode [attribute-type] " - "new-length\n\nIf attribute-type is not specified, " - "0x80 (i.e. $DATA) is assumed.\n", EXEC_NAME); + "new-length\n If attribute-type is not " + "specified, 0x80 (i.e. $DATA) is assumed.\n", + EXEC_NAME); exit(1); } @@ -546,8 +547,11 @@ void parse_options(int argc, char *argv[]) EXEC_NAME = *argv; fprintf(stderr, "%s v%s -- Copyright (c) 2002 Anton Altaparmakov\n", EXEC_NAME, VERSION); - while ((c = getopt(argc, argv, "hnqvFV")) != EOF) + while ((c = getopt(argc, argv, "fhnqvV")) != EOF) switch (c) { + case 'f': + opt.force = 1; + break; case 'n': opt.no_action = 1; break; @@ -557,9 +561,6 @@ void parse_options(int argc, char *argv[]) case 'v': opt.verbose++; break; - case 'F': - opt.force = 1; - break; case 'V': /* Version number already printed, so just exit. */ exit(0); From 42c62cc1201440509e2a00e1ede9b1c4c19b8aab Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Dec 2002 23:44:01 +0000 Subject: [PATCH 0307/2994] update (Logical change 1.66) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index da0e83c1..e8cdcdfa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -192,6 +192,8 @@ only works on uncompressed, unencrypted inodes which do not contain attribute lists, i.e. on simple files, but that was quite a lot of new code in itself which needs a lot of testing! + - Fix library to never issue writes on volumes that have been mounted + read-only. 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for From cf827730eb88845c49b14133ae6c690e85786f8b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 12:04:07 +0000 Subject: [PATCH 0308/2994] - Only resize resident attribute records if there is a sufficiently large change in the length of the attribute value. - Only deallocate clusters, truncate the runlist, and regenerate the mapping pairs array if the change in the non-resident attribute value is sufficiently large. (Logical change 1.67) --- libntfs/attrib.c | 234 +++++++++++++++++++++++------------------------ 1 file changed, 116 insertions(+), 118 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e3d514cd..04826916 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1934,22 +1934,25 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, /* Calculate the new attribute length and mft record bytes used. */ new_alen = (le32_to_cpu(a->length) - le32_to_cpu(a->value_length) + newsize + 7) & ~7; - new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + - new_alen; - /* Not enough space in this mft record. */ - if (new_muse > le32_to_cpu(m->bytes_allocated)) { - errno = ENOSPC; - return -1; + /* If the actual attribute length has changed, move tihings around. */ + if (new_alen != le32_to_cpu(a->length)) { + new_muse = le32_to_cpu(m->bytes_in_use) - + le32_to_cpu(a->length) + new_alen; + /* Not enough space in this mft record. */ + if (new_muse > le32_to_cpu(m->bytes_allocated)) { + errno = ENOSPC; + return -1; + } + /* Move attributes following @a to their new location. */ + memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu(a->length), + le32_to_cpu(m->bytes_in_use) - ((u8*)a - + (u8*)m) - le32_to_cpu(a->length)); + /* Adjust @m to reflect the change in used space. */ + m->bytes_in_use = cpu_to_le32(new_muse); + /* Adjust @a to reflect the new value size. */ + a->length = cpu_to_le32(new_alen); } - /* Move attributes following @a to their new location. */ - memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu(a->length), - le32_to_cpu(m->bytes_in_use) - ((u8*)a - (u8*)m) - - le32_to_cpu(a->length)); - /* Adjust @a to reflect the new value size. */ - a->length = cpu_to_le32(new_alen); a->value_length = cpu_to_le32(newsize); - /* Adjust @m to reflect the change in used space. */ - m->bytes_in_use = cpu_to_le32(new_muse); return 0; } @@ -1993,13 +1996,12 @@ static int ntfs_resident_attr_shrink(ntfs_attr *na, const u32 newsize) na->allocated_size = na->data_size = na->initialized_size = newsize; if (NAttrCompressed(na) || NAttrSparse(na)) na->compressed_size = newsize; - /* * Set the inode (and its base inode if it exists) dirty so it is * written out later. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); - + /* Done! */ ntfs_attr_put_search_ctx(ctx); return 0; put_err_out: @@ -2105,117 +2107,113 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) /* The first cluster outside the new allocation. */ first_free_vcn = (newsize + vol->cluster_size - 1) >> vol->cluster_size_bits; + /* + * Compare the new allocation with the old one and only deallocate + * clusters if there is a change. + */ + if (na->allocated_size >> vol->cluster_size_bits != first_free_vcn) { + /* Deallocate all clusters starting with the first free one. */ + nr_freed_clusters = ntfs_cluster_free(vol, na, first_free_vcn, + -1); + if (nr_freed_clusters < 0) { + err = errno; + goto put_err_out; + } + /* Truncate the runlist itself. */ + if (ntfs_rl_truncate(&na->rl, first_free_vcn)) { + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! Run list truncation " + "failed. Leaving inconsistent " + "metadata!\n", __FUNCTION__); + err = errno; + goto put_err_out; + } + /* Update the attribute record and the ntfs_attr structure. */ + na->allocated_size = first_free_vcn << vol->cluster_size_bits; + a->allocated_size = scpu_to_le64(na->allocated_size); + if (NAttrSparse(na)) { + na->compressed_size -= nr_freed_clusters << + vol->cluster_size_bits; + a->compressed_size = scpu_to_le64(na->compressed_size); - /* Deallocate all clusters starting with the first free one. */ - nr_freed_clusters = ntfs_cluster_free(vol, na, first_free_vcn, -1); - if (nr_freed_clusters < 0) { - err = errno; - goto put_err_out; - } + if (na->compressed_size < 0) { + // FIXME: Eeek! BUG! + fprintf(stderr, "%s(): Eeek! Compressed size " + "is negative. Leaving " + "inconsistent metadata!\n", + __FUNCTION__); + err = EIO; + goto put_err_out; + } + } + /* + * Reminder: It is ok for a->highest_vcn to be -1 for zero + * length files. + */ + if (a->highest_vcn) + a->highest_vcn = scpu_to_le64(first_free_vcn - 1); + /* Get the size for the new mapping pairs array. */ + mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); + if (mp_size <= 0) { + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! Get size for mapping " + "pairs failed. Leaving inconsistent " + "metadata!\n", __FUNCTION__); + err = errno; + goto put_err_out; + } + /* + * Generate the new mapping pairs array directly into the + * correct destination, i.e. the attribute record itself. + */ + if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( + a->mapping_pairs_offset), mp_size, na->rl)) { + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! Mapping pairs build " + "failed. Leaving inconsistent " + "metadata!\n", __FUNCTION__); + err = errno; + goto put_err_out; + } - /* Truncate the runlist itself. */ - if (ntfs_rl_truncate(&na->rl, first_free_vcn)) { - // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! Run list truncation failed. " - "Leaving inconsistent metadata!\n", - __FUNCTION__); - err = errno; - goto put_err_out; - } + // FIXME: Should verify that the attribute name hasn't been + // placed after the attribute value and if it is, we + // need to move the name, too. (AIA) - /* Update the attribute record and the ntfs attribute structure. */ - - na->allocated_size = first_free_vcn << vol->cluster_size_bits; - a->allocated_size = scpu_to_le64(na->allocated_size); - - na->data_size = newsize; - a->data_size = scpu_to_le64(newsize); - - if (newsize < na->initialized_size) { - na->initialized_size = newsize; - a->initialized_size = scpu_to_le64(newsize); - } - - if (NAttrSparse(na)) { - na->compressed_size -= nr_freed_clusters << - vol->cluster_size_bits; - a->compressed_size = scpu_to_le64(na->compressed_size); - - if (na->compressed_size < 0) { - // FIXME: Eeek! BUG! - fprintf(stderr, "%s(): Eeek! Compressed size is " - "negative. Leaving inconsistent " + /* + * Calculate the new attribute length and mft record bytes + * used. + */ + new_alen = (le16_to_cpu(a->mapping_pairs_offset) + mp_size + + 7) & ~7; + new_muse = le32_to_cpu(m->bytes_in_use) - + le32_to_cpu(a->length) + new_alen; + if (new_muse > le32_to_cpu(m->bytes_allocated)) { + // FIXME: Eeek! BUG() + fprintf(stderr, "%s(): Eeek! Ran out of space in mft " + "record. Leaving inconsistent " "metadata!\n", __FUNCTION__); err = EIO; goto put_err_out; } + /* Move the following attributes forward. */ + memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu(a->length), + le32_to_cpu(m->bytes_in_use) - ((u8*)a - + (u8*)m) - le32_to_cpu(a->length)); + /* Update the sizes of the attribute and mft records. */ + a->length = cpu_to_le32(new_alen); + m->bytes_in_use = cpu_to_le32(new_muse); } - - /* - * Reminder: It is ok for a->highest_vcn to be -1 for zero length - * files. - */ - if (a->highest_vcn) - a->highest_vcn = scpu_to_le64(first_free_vcn - 1); - - /* Get the size for the new mapping pairs array. */ - mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); - if (mp_size <= 0) { - // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! Get size for mapping pairs " - "failed. Leaving inconsistent metadata!\n", - __FUNCTION__); - err = errno; - goto put_err_out; + /* Update the attribute record and the ntfs attribute structure. */ + na->data_size = newsize; + a->data_size = scpu_to_le64(newsize); + if (newsize < na->initialized_size) { + na->initialized_size = newsize; + a->initialized_size = scpu_to_le64(newsize); } - - /* - * Generate the new mapping pairs array directly into the correct - * destination, i.e. the attribute record itself. - */ - if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( - a->mapping_pairs_offset), mp_size, na->rl)) { - // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! Mapping pairs build failed. " - "Leaving inconsistent metadata!\n", - __FUNCTION__); - err = errno; - goto put_err_out; - } - - // FIXME: Should verify that the attribute name hasn't been placed - // after the attribute value and if it is, we need to move the - // name, too. (AIA) - - /* Calculate the new attribute length and mft record bytes used. */ - new_alen = (le16_to_cpu(a->mapping_pairs_offset) + mp_size + 7) & ~7; - new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + - new_alen; - - if (new_muse > le32_to_cpu(m->bytes_allocated)) { - // FIXME: Eeek! BUG() - fprintf(stderr, "%s(): Eeek! Ran out of space in mft record. " - "Leaving inconsistent metadata!\n", - __FUNCTION__); - err = EIO; - goto put_err_out; - } - - /* Move the following attributes forward. */ - memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu(a->length), - le32_to_cpu(m->bytes_in_use) - ((u8*)a - (u8*)m) - - le32_to_cpu(a->length)); - - /* Update the size of the attribute record and the mft record. */ - a->length = cpu_to_le32(new_alen); - m->bytes_in_use = cpu_to_le32(new_muse); - - /* - * Set the inode (and its base inode if it exists) dirty so it is - * written out later. - */ + /* Set the inode dirty so it is written out later. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); - + /* Done! */ ntfs_attr_put_search_ctx(ctx); return 0; put_err_out: @@ -2264,6 +2262,6 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) if (NAttrNonResident(na)) return ntfs_non_resident_attr_shrink(na, newsize); - return ntfs_resident_attr_shrink(na, newsize); + return ntfs_resident_attr_shrink(na, (u32)newsize); } From ab04f3489a75af78f39efabaec7758ec9c20e8b5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 12:04:07 +0000 Subject: [PATCH 0309/2994] - Only resize resident attribute records if there is a sufficiently large change in the length of the attribute value. - Only deallocate clusters, truncate the runlist, and regenerate the mapping pairs array if the change in the non-resident attribute value is sufficiently large. BKrev: 3e0d9337b6ZofcTwHmT1nchXDT5Tkg From 65f89be3217588f0b021ffe2e4bc36d50af8afde Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 19:19:05 +0000 Subject: [PATCH 0310/2994] Fix truncation of resident attributes (new attribute length calculation was incorrect). (Logical change 1.68) --- libntfs/attrib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 04826916..7b111fb7 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1932,8 +1932,7 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, // name, too. (AIA) /* Calculate the new attribute length and mft record bytes used. */ - new_alen = (le32_to_cpu(a->length) - le32_to_cpu(a->value_length) + - newsize + 7) & ~7; + new_alen = (le16_to_cpu(a->value_offset) + newsize + 7) & ~7; /* If the actual attribute length has changed, move tihings around. */ if (new_alen != le32_to_cpu(a->length)) { new_muse = le32_to_cpu(m->bytes_in_use) - From 844432eeca4d236fc1867e75ee2a2a5876f9839f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 19:19:05 +0000 Subject: [PATCH 0311/2994] Fix typos and correct a wrong sanity check which prevented truncation to zero size. (Logical change 1.68) --- ntfsprogs/ntfstruncate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 1445b5c7..809a4256 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -390,7 +390,8 @@ void dump_attr_record(ATTR_RECORD *a) char s[0x200]; int i; - printf("-- Beginning dump of attribute record. --\n"); + printf("-- Beginning dump of attribute record at offset 0x%x. --\n", + ((ptrdiff_t)(u8*)a) & 0x3ff); if (a->type == AT_END) { printf("Attribute type = 0x%x ($END)\n", le32_to_cpu(AT_END)); u = le32_to_cpu(a->length); @@ -530,7 +531,7 @@ void usage(void) fprintf(stderr, "This utility will truncate a specified attribute " "belonging to a specified\ninode, i.e. file or " "directory, to a specified length.\n\n" - "Usage: %s [-hnqvFV] device inode [attribute-type] " + "Usage: %s [-fhnqvV] device inode [attribute-type] " "new-length\n If attribute-type is not " "specified, 0x80 (i.e. $DATA) is assumed.\n", EXEC_NAME); @@ -609,7 +610,7 @@ void parse_options(int argc, char *argv[]) /* Get the new length. */ ll = strtoll(s, &s2, 0); - if (*s2 || !ll || (ll >= LLONG_MAX && errno == ERANGE)) + if (*s2 || ll < 0 || (ll >= LLONG_MAX && errno == ERANGE)) err_exit("Invalid new length: %s\n", s); new_len = ll; Dprintf("new length = %Li\n", new_len); From f8c9d4a61d78c92ae9fc63f5a8ee90267fc17878 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 19:19:05 +0000 Subject: [PATCH 0312/2994] libntfs/attrib.c Fix truncation of resident attributes (new attribute length calculation was incorrect). ntfsprogs/ntfstruncate.c Fix typos and correct a wrong sanity check which prevented truncation to zero size. BKrev: 3e0df92901GVJpef7R3f7Aya7w0XSg From ab8ae59c528dea00bd661bc95f8c59553d3aac5b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 20:10:50 +0000 Subject: [PATCH 0313/2994] Fix debug output for offset. Only dump attribute records for attribute being resized. (Logical change 1.69) --- ntfsprogs/ntfstruncate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 809a4256..6f73ed9d 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -384,14 +384,14 @@ void dump_non_resident_attr(ATTR_RECORD *a) dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); } -void dump_attr_record(ATTR_RECORD *a) +void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) { unsigned int u; char s[0x200]; int i; printf("-- Beginning dump of attribute record at offset 0x%x. --\n", - ((ptrdiff_t)(u8*)a) & 0x3ff); + (u8*)a - (u8*)m); if (a->type == AT_END) { printf("Attribute type = 0x%x ($END)\n", le32_to_cpu(AT_END)); u = le32_to_cpu(a->length); @@ -516,7 +516,8 @@ void dump_mft_record(MFT_RECORD *m) a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); printf("-- Beginning dump of attributes within mft record. --\n"); while ((char*)a < (char*)m + le32_to_cpu(m->bytes_in_use)) { - dump_attr_record(a); + if (a->type == cpu_to_le32(attr_type)) + dump_attr_record(m, a); if (a->type == AT_END) break; a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); From 722a3eb12fe005da90daeaff29fb3563a0431235 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 20:10:50 +0000 Subject: [PATCH 0314/2994] Fix stupid typo bug. (Logical change 1.69) --- libntfs/attrib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 7b111fb7..aaed3d00 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2092,7 +2092,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) // TODO: mark the base inode dirty // TODO: Implement attribute list support as desribed above. (AIA) - if (NInoAttrList(na)) { + if (NInoAttrList(na->ni)) { err = ENOTSUP; goto put_err_out; } @@ -2110,11 +2110,14 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) * Compare the new allocation with the old one and only deallocate * clusters if there is a change. */ - if (na->allocated_size >> vol->cluster_size_bits != first_free_vcn) { + if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { /* Deallocate all clusters starting with the first free one. */ nr_freed_clusters = ntfs_cluster_free(vol, na, first_free_vcn, -1); if (nr_freed_clusters < 0) { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Freeing of clusters " + "failed. Aborting...\n", __FUNCTION__); err = errno; goto put_err_out; } From 3d5d045fe4223674f027381a497b7401309b1d0f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 20:10:50 +0000 Subject: [PATCH 0315/2994] Fix stupid typo bugs. (Logical change 1.69) --- libntfs/bitmap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index 42209e49..f3636863 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -88,7 +88,7 @@ int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) bit = count & 7; do { /* If there is a last partial byte... */ - if (bit) { + if (count > 0 && bit) { lastbyte_pos = ((count + 7) >> 3) + firstbyte; if (!lastbyte_pos) { // FIXME: Eeek! BUG! @@ -128,7 +128,7 @@ int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) /* Write the prepared buffer to disk. */ tmp = (start_bit >> 3) - firstbyte; br = ntfs_attr_pwrite(na, tmp, bufsize, buf); - if (br != tmp) { + if (br != bufsize) { // FIXME: Eeek! We need rollback! (AIA) fprintf(stderr, "%s(): Eeek! Failed to write buffer " "to bitmap. Leaving inconsistent " @@ -142,8 +142,8 @@ int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) firstbyte = 0; start_bit += tmp; count -= tmp; - if (bufsize > (count + 7) >> 3) - bufsize = (count + 7) >> 3; + if (bufsize > (tmp = (count + 7) >> 3)) + bufsize = tmp; if (lastbyte && count != 0) { // FIXME: Eeek! BUG! From 4084c90c939717c81347187c7ac137075a8c2b86 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 20:10:50 +0000 Subject: [PATCH 0316/2994] Remove silly and wrong sanity check. (Logical change 1.69) --- libntfs/lcnalloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 346c5681..82e31900 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -75,8 +75,9 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) runlist *rl; s64 nr_freed, delta, to_free; - if (!vol || !vol->lcnbmp_na || !na || !na->rl || start_vcn < 0 || + if (!vol || !vol->lcnbmp_na || !na || start_vcn < 0 || (count < 0 && count != -1)) { + fprintf(stderr, "%s(): Invalid arguments!\n", __FUNCTION__); errno = EINVAL; return -1; } From ff5a0d104da585b9360c8d41769d797d4c35c43b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 20:10:50 +0000 Subject: [PATCH 0317/2994] libntfs/attrib.c Fix stupid typo bug. libntfs/bitmap.c Fix stupid typo bugs. libntfs/lcnalloc.c Remove silly and wrong sanity check. ntfsprogs/ntfstruncate.c Fix debug output for offset. Only dump attribute records for attribute being resized. BKrev: 3e0e054aZ_gETxMSUP_8y3be4ppXRg From 7b2cb8211f99b565581c4051127b994c9e3d7af6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 22:13:06 +0000 Subject: [PATCH 0318/2994] Add test and comments for truncation of non-resident attributes to zero size. We should be converting such an attribute to a resident one instead of leaving a zero size non-resident attribute. (Logical change 1.70) --- libntfs/attrib.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index aaed3d00..33f50686 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2121,6 +2121,25 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) err = errno; goto put_err_out; } + /* + * If the attribute now has zero size, need to convert it to a + * resident attribute. + */ + if (!newsize) { + // TODO: Perform the conversion! (AIA) + + /* Update the ntfs attribute structure accordingly. */ +/* + na->allocated_size = na->data_size = + na->initialized_size = newsize; + if (NAttrCompressed(na) || NAttrSparse(na)) + na->compressed_size = newsize; + NAttrClearNonResident(na); + free(na->rl); + na->rl = NULL; + goto done; +*/ + } /* Truncate the runlist itself. */ if (ntfs_rl_truncate(&na->rl, first_free_vcn)) { // FIXME: Eeek! We need rollback! (AIA) @@ -2213,6 +2232,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) na->initialized_size = newsize; a->initialized_size = scpu_to_le64(newsize); } +done: /* Set the inode dirty so it is written out later. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); /* Done! */ From ed19c0cf08293bb1fb1cd923112d0d7620028880 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 22:13:06 +0000 Subject: [PATCH 0319/2994] Add test and comments for truncation of non-resident attributes to zero size. We should be converting such an attribute to a resident one instead of leaving a zero size non-resident attribute. BKrev: 3e0e21f2-EOnVjpgx9hG0y9AKl047A From 998104321ba1d57b6baf81e84f2470a26654dbc5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 22:28:02 +0000 Subject: [PATCH 0320/2994] Forgot the increment in the while loop. Thanks to Szaka for spotting this. (Logical change 1.71) --- libntfs/runlist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 98012dee..b5c02faa 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1348,6 +1348,7 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) while (rl->length) { if (start_vcn < rl[1].vcn) break; + rl++; } if (!rl->length) { // FIXME: Weird, probably a BUG()! From 0d45f0a690278f58a9821f8761ffca3bf33f3d0d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Dec 2002 22:28:02 +0000 Subject: [PATCH 0321/2994] Forgot the increment in the while loop. Thanks to Szaka for spotting this. BKrev: 3e0e2572M2bMOll496m961dIX7EGlQ From 6258afc6dd30b8d265c6573329633b75971b308f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 12:17:35 +0000 Subject: [PATCH 0322/2994] Add attribute definition table to ntfs volume structure. (Logical change 1.72) --- include/volume.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/volume.h b/include/volume.h index 8155686b..94074ec0 100644 --- a/include/volume.h +++ b/include/volume.h @@ -147,6 +147,11 @@ struct _ntfs_volume { FILE_UpCase. */ u32 upcase_len; /* Length in Unicode characters of the upcase table. */ + + ATTR_DEF *attrdef; /* Attribute definitions. Obtained from + FILE_AttrDef. */ + u32 attrdef_len; /* Size of the attribute definition table in + bytes. */ }; extern ntfs_volume *ntfs_volume_startup(const char *name, unsigned long rwflag); From a86ad90a974c5791ca88078356a993fbaabbd05e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 12:17:35 +0000 Subject: [PATCH 0323/2994] Finish off / fix ability to specify an attribute name. 2002/12/29 12:03:45+00:00 cantab.net!aia21 Add ability to specify an attribute name in addition to the attribute type. (Logical change 1.72) --- ntfsprogs/ntfstruncate.c | 52 +++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 6f73ed9d..ee0ca82c 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -71,6 +71,8 @@ BOOL success = FALSE; char *dev_name; s64 inode; u32 attr_type; +uchar_t *attr_name = NULL; +u32 attr_name_len; s64 new_len; ntfs_volume *vol; @@ -532,9 +534,11 @@ void usage(void) fprintf(stderr, "This utility will truncate a specified attribute " "belonging to a specified\ninode, i.e. file or " "directory, to a specified length.\n\n" - "Usage: %s [-fhnqvV] device inode [attribute-type] " - "new-length\n If attribute-type is not " - "specified, 0x80 (i.e. $DATA) is assumed.\n", + "Usage: %s [-fhnqvV] device inode [attr-type " + "[attr-name]] new-length\n If " + "attr-type is not specified, 0x80 (i.e. $DATA) " + "is assumed.\n If attr-name is not " + "specified, an unnamed attribute is assumed.\n", EXEC_NAME); exit(1); } @@ -592,22 +596,45 @@ void parse_options(int argc, char *argv[]) /* Get the attribute type, if specified. */ s = argv[optind++]; - if (optind == argc) + if (optind == argc) { attr_type = AT_DATA; - else { + attr_name = AT_UNNAMED; + attr_name_len = 0; + } else { unsigned long ul; ul = strtoul(s, &s2, 0); if (*s2 || !ul || (ul >= ULONG_MAX && errno == ERANGE)) - err_exit("Invalid attribute type: %s\n", s); + err_exit("Invalid attribute type %s: %s\n", s, + strerror(errno)); attr_type = ul; + /* Get the attribute name, if specified. */ s = argv[optind++]; + if (optind != argc) { + /* Convert the string to little endian Unicode. */ + attr_name_len = ntfs_mbstoucs(s, &attr_name, 0); + if (attr_name_len < 0) + err_exit("Invalid attribute name \"%s\": %s\n", + s, strerror(errno)); - if (optind != argc) - usage(); + /* Keep hold of the original string. */ + s2 = s; + + s = argv[optind++]; + if (optind != argc) + usage(); + } else { + attr_name = AT_UNNAMED; + attr_name_len = 0; + } } Dprintf("attribute type = 0x%x\n", attr_type); + if (attr_name == AT_UNNAMED) + Dprintf("attribute name = \"\" (UNNAMED)\n"); + else + Dprintf("attribute name = \"%s\" (length %i Unicode " + "characters)\n", s2, attr_name_len); /* Get the new length. */ ll = strtoll(s, &s2, 0); @@ -642,6 +669,9 @@ void ntfstruncate_exit(void) if (err == -1) fprintf(stderr, "Warning: Could not umount %s: %s\n", dev_name, strerror(errno)); + /* Free the attribute name if it exists. */ + if (attr_name && attr_name != AT_UNNAMED) + free(attr_name); } int main(int argc, char **argv) @@ -719,7 +749,7 @@ int main(int argc, char **argv) strerror(errno)); /* Open the specified attribute. */ - na = ntfs_attr_open(ni, attr_type, NULL, 0); + na = ntfs_attr_open(ni, attr_type, attr_name, attr_name_len); if (!na) err_exit("Failed to open attribute 0x%x: %s\n", attr_type, strerror(errno)); @@ -765,6 +795,10 @@ int main(int argc, char **argv) fprintf(stderr, "Warning: Failed to umount %s: %s\n", dev_name, strerror(errno)); + /* Free the attribute name if it exists. */ + if (attr_name && attr_name != AT_UNNAMED) + free(attr_name); + /* Finally, disable our ntfstruncate_exit() handler. */ success = TRUE; From f75d0c5be5d35f5dd5299fa484ced6f842ff66dd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 12:17:35 +0000 Subject: [PATCH 0324/2994] Load the attribute definition table at mount time and free it at umount time. (Logical change 1.72) --- libntfs/volume.c | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index 77cca83c..0ba13f39 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -79,6 +79,8 @@ static void __ntfs_volume_release(ntfs_volume *v) free(v->vol_name); if (v->upcase) free(v->upcase); + if (v->attrdef) + free(v->attrdef); free(v); } @@ -836,7 +838,50 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) if (ntfs_inode_close(ni)) Dperror("Failed to close inode, leaking memory"); - /* FIXME: Need to deal with FILE_AttrDef. (AIA) */ + /* Now load the attribute definitions from $AttrDef. */ + Dprintf("Loading $AttrDef... "); + ni = ntfs_inode_open(vol, FILE_AttrDef); + if (!ni) { + Dputs(FAILED); + Dperror("Failed to open inode"); + goto error_exit; + } + /* Get an ntfs attribute for $AttrDef/$DATA. */ + na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); + if (!na) { + Dputs(FAILED); + Dperror("Failed to open ntfs attribute"); + goto error_exit; + } + /* Check we don't overflow 32-bits. */ + if (na->data_size > 0xffffffffLL) { + Dputs(FAILED); + Dputs("Error: Attribute definition table is too big " + "(max 32-bit allowed)."); + errno = EINVAL; + goto error_exit; + } + vol->attrdef_len = na->data_size; + vol->attrdef = (ATTR_DEF*)malloc(na->data_size); + if (!vol->attrdef) { + Dputs(FAILED); + Dputs("Not enough memory to load $AttrDef."); + goto error_exit; + } + /* Read in the $DATA attribute value into the buffer. */ + l = ntfs_attr_pread(na, 0, na->data_size, vol->attrdef); + if (l != na->data_size) { + Dputs(FAILED); + Dputs("Amount of data read does not correspond to expected " + "length!"); + errno = EIO; + goto error_exit; + } + /* Done with the $AttrDef mft record. */ + Dputs(OK); + ntfs_attr_close(na); + if (ntfs_inode_close(ni)) + Dperror("Failed to close inode, leaking memory"); return vol; io_error_exit: From 7bd63f4186b6515502a64cc86c2730fb914692f9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 12:17:35 +0000 Subject: [PATCH 0325/2994] Uncomment still unused label. (Logical change 1.72) --- libntfs/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 33f50686..98266b80 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2232,7 +2232,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) na->initialized_size = newsize; a->initialized_size = scpu_to_le64(newsize); } -done: +//done: /* Set the inode dirty so it is written out later. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); /* Done! */ From d24d73e13c8943012b4e1bd4e61a1949ff2489c4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 12:17:35 +0000 Subject: [PATCH 0326/2994] libntfs/attrib.c Uncomment still unused label. ntfsprogs/ntfstruncate.c Add ability to specify an attribute name in addition to the attribute type. include/volume.h Add attribute definition table to ntfs volume structure. libntfs/volume.c Load the attribute definition table at mount time and free it at umount time. BKrev: 3e0ee7df1MNHgnJmH-0-5nWouWa6nQ From cfa2dc3960fde7d962fb61559de475999dd7214f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 17:54:10 +0000 Subject: [PATCH 0327/2994] Add new API attrib.[hc]::ntfs_attr_size_bounds_check() to verify a size against an attribute type for validity. We check the volume's attribute definitions table to do so. BKrev: 3e0f36c20ltAQdArVytoyFjeFUgbKA From 36ee87eab402174fc3667ea2fb0d66607b56b14b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 17:54:10 +0000 Subject: [PATCH 0328/2994] Add new API ntfs_attr_size_bounds_check(). (Logical change 1.73) --- libntfs/attrib.c | 84 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 77 insertions(+), 7 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 98266b80..f04c8de4 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1909,6 +1909,53 @@ void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) return; } +/** + * ntfs_attr_size_bounds_check - check a size of an attribute type for validity + * @vol: ntfs volume to which the attribute belongs + * @type: attribute type which to check + * @size: size which to check + * + * Check whether the @size in bytes is valid for an attribute of @type on the + * ntfs volume @vol. + * + * Return 0 if valid and -1 if not valid or an error occured. On error the + * error code is stored in errno. The following error codes are defined: + * ERANGE - @size is not valid for the attribute @type. + * ENOENT - The attribute @type is not specified in $AttrDef. + * EINVAL - Invalid parameters (e.g. @size is < 0 or @vol is not valid) + */ +int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type, + const s64 size) +{ + ATTR_DEF *ad; + + if (!vol || !vol->attrdef || size < 0) { + errno = EINVAL; + return -1; + } + + for (ad = vol->attrdef; (u8*)ad - (u8*)vol->attrdef < + vol->attrdef_len && ad->type; ++ad) { + /* We haven't found it yet, carry on searching. */ + if (ad->type < type) + continue; + /* We have gone too far already. No point in continuing. */ + if (ad->type > type) + break; + /* We found the attribute. - Do the bounds check. */ + if (size >= le64_to_cpu(ad->min_size) && + size <= le64_to_cpu(ad->max_size)) + return 0; + /* @size is out of range! */ + errno = ERANGE; + return -1; + } + + /* Attribute not found?!? */ + errno = ENOENT; + return -1; +} + /** * ntfs_resident_attr_value_resize - resize the value of a resident attribute * @m: mft record containing attribute record @@ -1965,6 +2012,7 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: * ENOTSUP - The desired resize is not implemented yet. + * ERANGE - @newsize is not valid for the attribute type of @na. */ static int ntfs_resident_attr_shrink(ntfs_attr *na, const u32 newsize) { @@ -1982,10 +2030,20 @@ static int ntfs_resident_attr_shrink(ntfs_attr *na, const u32 newsize) err = errno; goto put_err_out; } - - // TODO: Check the attribute type and the corresponding minimum size - // against @newsize and fail if @newsize is too small! (AIA) - + /* + * Check the attribute type and the corresponding minimum size + * against @newsize and fail if @newsize is too small. + */ + if (ntfs_attr_size_bounds_check(na->ni->vol, na->type, newsize) < 0) { + err = errno; + if (err == ERANGE) { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Size bounds check " + "failed. Aborting...\n", __FUNCTION__); + } else if (err == ENOENT) + err = EIO; + goto put_err_out; + } /* Perform the resize of the attribute record. */ if (ntfs_resident_attr_value_resize(ctx->mrec, ctx->attr, newsize)) { err = errno; @@ -2020,6 +2078,7 @@ put_err_out: * The following error codes are defined: * ENOTSUP - The desired resize is not implemented yet. * ENOMEM - Not enough memory to complete operation. + * ERANGE - @newsize is not valid for the attribute type of @na. */ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) { @@ -2050,9 +2109,20 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) } a = ctx->attr; m = ctx->mrec; - - // TODO: Check the attribute type and the corresponding minimum size - // against @newsize and fail if @newsize is too small! (AIA) + /* + * Check the attribute type and the corresponding minimum size + * against @newsize and fail if @newsize is too small. + */ + if (ntfs_attr_size_bounds_check(vol, na->type, newsize) < 0) { + err = errno; + if (err == ERANGE) { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Size bounds check " + "failed. Aborting...\n", __FUNCTION__); + } else if (err == ENOENT) + err = EIO; + goto put_err_out; + } // When extents/an attribute list is/are present it is very complicated: // TODO: For the current extent: From 84b007cf9cd1f5111daa7bee52a19cb7b705e974 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 17:54:10 +0000 Subject: [PATCH 0329/2994] add export for ntfs_attr_size_bounds_check(). (Logical change 1.73) --- include/attrib.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/attrib.h b/include/attrib.h index 906b3e2f..cc56cef7 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -254,6 +254,9 @@ extern int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn); extern LCN ntfs_attr_vcn_to_lcn(ntfs_attr *na, const VCN vcn); extern runlist_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn); +extern int ntfs_attr_size_bounds_check(const ntfs_volume *vol, + const ATTR_TYPES type, const s64 size); + extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, const u32 newsize); From a9f6279e55bf6933025e49b184e2db4e4fd43bae Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 17:54:10 +0000 Subject: [PATCH 0330/2994] update (Logical change 1.73) --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e8cdcdfa..96b195cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,7 +64,8 @@ ntfs_attr_vcn_to_lcn(), ntfs_attr_find_vcn(), ntfs_attr_init(), - ntfs_attr_{open,close}(). + ntfs_attr_{open,close}(), + ntfs_attr_size_bounds_check(). - Add new field mftmirr_size to ntfs_volume structure and initialize it to the number of mft records stored in the mft mirror in ntfs_mount(). From efe2271a3006a382809fe202e52f986123502228 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 21:37:21 +0000 Subject: [PATCH 0331/2994] - Change ntfs_inode_close() to disconnect extent inodes from their base inode when an extent inode is closed. This is needed byt ntfs_mft_record_free() in order to be able to free extent mft records. - New API provided by mft.[hc]: ntfs_mft_record_alloc(), -- WIP ntfs_mft_record_free(). (Logical change 1.74) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 96b195cc..8ae20c0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -195,6 +195,8 @@ new code in itself which needs a lot of testing! - Fix library to never issue writes on volumes that have been mounted read-only. + - New API provided by mft.[hc]: + ntfs_mft_record_{alloc,free}(). -- WIP 12/03/2002 - 1.6.0 - More mkntfs options and cleanups. Fix typo in usage information of mkntfs. Thanks to Richard Russon for From 58f750c28948698a82ce7986a52201d2ca78c657 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 21:37:21 +0000 Subject: [PATCH 0332/2994] - Change ntfs_inode_close() to disconnect extent inodes from their base inode when an extent inode is closed. This is needed byt ntfs_mft_record_free() in order to be able to free extent mft records. - New API provided by mft.[hc]: ntfs_mft_record_alloc(), -- WIP ntfs_mft_record_free(). BKrev: 3e0f6b11PfOsUTFzT98-K2SKWj_qpg From 3bcc223bfddbb3873d317a21548dc452a3caf8a9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 21:37:21 +0000 Subject: [PATCH 0333/2994] Change ntfs_inode_close() to disconnect extent inodes from their base inode when an extent inode is closed. This is needed byt ntfs_mft_record_free() in order to be able to free extent mft records. (Logical change 1.74) --- libntfs/inode.c | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 5108a556..056279f0 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -122,7 +122,8 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) goto err_out; - if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, AT_UNNAMED, 0, 0, 0, NULL, 0, + ctx)) { if (errno != ENOENT) goto put_err_out; /* Attribute list attribute not present so we are done. */ @@ -184,10 +185,8 @@ err_out: * then deallocate all memory attached to it, and finally free the ntfs inode * structure itself. * - * If it is an extent inode, we postpone to when the base inode is being closed - * with ntfs_inode_close() to tear down all structures and free all allocated - * memory. That way we keep the extent records cached in memory so we get an - * efficient ntfs_lookup_attr(). + * If it is an extent inode, we disconnect it from its base inode before we + * destroy it. * * Return 0 on success or -1 on error with errno set to the error code. On * error, @ni has not been freed. The user should attempt to handle the error @@ -200,13 +199,6 @@ err_out: */ int ntfs_inode_close(ntfs_inode *ni) { - /* If the inode is an extent inode, complain rudely! */ - if (ni->nr_extents == -1) { - Dprintf("%s(): BUG: Tried to close extent inode!\n", - __FUNCTION__); - errno = EINVAL; - return -1; - } /* If we have dirty metadata, write it out. */ if (NInoDirty(ni) || NInoAttrListDirty(ni)) { if (ntfs_inode_sync(ni)) { @@ -223,6 +215,37 @@ int ntfs_inode_close(ntfs_inode *ni) for (i = 0; i < ni->nr_extents; i++) __ntfs_inode_release(ni->extent_nis[i]); free(ni->extent_nis); + } else if (ni->nr_extents == -1) { + ntfs_inode **tmp_nis; + ntfs_inode *base_ni; + s32 i; + + /* + * If the inode is an extent inode, disconnect it from the + * base inode before destroying it. + */ + base_ni = ni->base_ni; + for (i = 0; i < base_ni->nr_extents; ++i) { + tmp_nis = base_ni->extent_nis; + if (tmp_nis[i] != ni) + continue; + /* Found it. Disconnect. */ + memmove(tmp_nis + i, tmp_nis + i + 1, + (base_ni->nr_extents - i - 1) * + sizeof(ntfs_inode *)); + base_ni->nr_extents--; + /* Resize the memory buffer. */ + tmp_nis = realloc(tmp_nis, base_ni->nr_extents * + sizeof(ntfs_inode *)); + /* Ignore errors, they don't really matter. */ + if (tmp_nis) + base_ni->extent_nis = tmp_nis; + /* Allow for error checking. */ + i = -1; + } + if (i != -1) + Dputs("Extent inode was not attached to base inode! " + "Weird! Continuing regardless."); } return __ntfs_inode_release(ni); } From 2dbb7c23a574743af14a81f8985f67757a6db3fa Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 21:37:21 +0000 Subject: [PATCH 0334/2994] Fix erroneusly placed err = errno. (Logical change 1.74) --- libntfs/attrib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index f04c8de4..a4e62185 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2185,10 +2185,10 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) nr_freed_clusters = ntfs_cluster_free(vol, na, first_free_vcn, -1); if (nr_freed_clusters < 0) { + err = errno; // FIXME: Eeek! fprintf(stderr, "%s(): Eeek! Freeing of clusters " "failed. Aborting...\n", __FUNCTION__); - err = errno; goto put_err_out; } /* @@ -2212,11 +2212,11 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) } /* Truncate the runlist itself. */ if (ntfs_rl_truncate(&na->rl, first_free_vcn)) { + err = errno; // FIXME: Eeek! We need rollback! (AIA) fprintf(stderr, "%s(): Eeek! Run list truncation " "failed. Leaving inconsistent " "metadata!\n", __FUNCTION__); - err = errno; goto put_err_out; } /* Update the attribute record and the ntfs_attr structure. */ @@ -2246,11 +2246,11 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) /* Get the size for the new mapping pairs array. */ mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); if (mp_size <= 0) { + err = errno; // FIXME: Eeek! We need rollback! (AIA) fprintf(stderr, "%s(): Eeek! Get size for mapping " "pairs failed. Leaving inconsistent " "metadata!\n", __FUNCTION__); - err = errno; goto put_err_out; } /* @@ -2259,11 +2259,11 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) */ if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( a->mapping_pairs_offset), mp_size, na->rl)) { + err = errno; // FIXME: Eeek! We need rollback! (AIA) fprintf(stderr, "%s(): Eeek! Mapping pairs build " "failed. Leaving inconsistent " "metadata!\n", __FUNCTION__); - err = errno; goto put_err_out; } From be6376f85e9594c94736ac1c6f0cd9c72cd0ad98 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 21:37:21 +0000 Subject: [PATCH 0335/2994] New API provided by mft.[hc]: ntfs_mft_record_alloc(), -- WIP ntfs_mft_record_free(). (Logical change 1.74) --- include/mft.h | 5 +++ libntfs/mft.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 1 deletion(-) diff --git a/include/mft.h b/include/mft.h index 96ec291b..ff423fe7 100644 --- a/include/mft.h +++ b/include/mft.h @@ -23,6 +23,7 @@ #define _NTFS_MFT_H #include "volume.h" +#include "inode.h" #include "layout.h" extern int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref, @@ -100,5 +101,9 @@ static __inline__ u32 ntfs_mft_record_get_data_size(const MFT_RECORD *m) return le32_to_cpu(m->bytes_in_use); } +extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, u64 start); + +extern int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni); + #endif /* defined _NTFS_MFT_H */ diff --git a/libntfs/mft.c b/libntfs/mft.c index 695647c8..80ae3adc 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -23,11 +23,15 @@ #include #include -#include "mft.h" +#include "types.h" #include "disk_io.h" #include "debug.h" #include "bitmap.h" #include "attrib.h" +#include "inode.h" +#include "volume.h" +#include "layout.h" +#include "mft.h" /** * ntfs_mft_records_read - read records from the mft from disk @@ -231,3 +235,86 @@ read_failed: return -1; } +/** + * ntfs_mft_record_alloc - allocate an mft record on an ntfs volume + * @vol: mounted ntfs volume on which to allocate the mft record + * @start: starting mft record at which to allocate (or -1 if none) + * + * Allocate an mft record in $MFT/$DATA starting to search for a free record + * at mft record number @start or at the current allocator position if + * @start_mref is -1, on the mounted ntfs volume @vol. + * + * On success return the now opened ntfs inode of the mft record. + * + * On error return NULL with errno set to the error code. + */ +ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, u64 start) +{ + if (!vol || !vol->mftbmp_na) { + errno = EINVAL; + return NULL; + } + + errno = ENOTSUP; + return NULL; +} + +/** + * ntfs_mft_record_free - free an mft record on an ntfs volume + * @vol: mounted ntfs volume on which to free the mft record + * @ni: open ntfs inode of the mft record to free + * + * Free the mft record of the open inode @ni on the mounted ntfs volume @vol. + * Note that this function calls ntfs_inode_close() internally and hence you + * cannot use the pointer @ni any more after this function returns success. + * + * On success return 0 and on error return -1 with errno set to the error code. + */ +int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni) +{ + u64 mft_no; + u16 seq_no; + + if (!vol || !vol->mftbmp_na || !ni) { + errno = EINVAL; + return -1; + } + + /* Cache the mft reference for later. */ + mft_no = ni->mft_no; + + /* Mark the mft record as not in use. */ + ni->mrec->flags &= ~MFT_RECORD_IN_USE; + + /* Increment the sequence number, skipping zero, if it is not zero. */ + seq_no = le16_to_cpu(ni->mrec->sequence_number); + if (seq_no == 0xffff) + seq_no = 1; + else if (seq_no) + seq_no++; + ni->mrec->sequence_number = cpu_to_le16(seq_no); + + /* Set the inode dirty and close it so it is written out. */ + ntfs_inode_mark_dirty(ni); + if (ntfs_inode_close(ni)) { + int eo = errno; + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! Failed to close the inode." + "Leaving inconsistent metadata!\n", + __FUNCTION__); + errno = eo; + return -1; + } + + /* Clear the bit in the $MFT/$BITMAP corresponding to this record. */ + if (ntfs_bitmap_clear_run(vol->mftbmp_na, mft_no, 1)) { + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! Failed to clear the allocation " + "in the mft bitmap. Leaving deleted mft record " + "marked as in use in the mft bitmap and " + "pretending we succeeded. Error: %s\n", + __FUNCTION__, strerror(errno)); + } + return 0; +} + From f7e003fd49944e71243a6bbe10d678d52641b6b4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Dec 2002 21:37:21 +0000 Subject: [PATCH 0336/2994] update (Logical change 1.74) --- TODO.libntfs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TODO.libntfs b/TODO.libntfs index 1b3380ae..e327a531 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -2,8 +2,9 @@ * HIGH priority * ***************** -- write attribute resize function (see mkntfs) and implement - ntfs_attr_truncate() +- write attribute resize function (see mkntfs) + +- complete the implementation of ntfs_attr_truncate() - write ntfs_cluster_allocate() (see ntfs 2.4 driver in CVS) From 08ef32703ab6ed8ae21d6d9885809d109c1ce856 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 30 Dec 2002 12:23:10 +0000 Subject: [PATCH 0337/2994] - Clear newly allocated space in ntfs_resident_attr_value_resize(). - Rename ntfs_resident_attr_shrink() to ntfs_resident_attr_resize() and make it resize upwards as well as downwards. - Change ntfs_attr_truncate() to allow resizing upwards of resident attributes. (Logical change 1.75) --- libntfs/attrib.c | 98 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 77 insertions(+), 21 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index a4e62185..77ff65dc 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1963,10 +1963,11 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type, * @newsize: new size in bytes to which to resize the attribute value of @a * * Resize the value of the attribute @a in the mft record @m to @newsize bytes. + * If the value is made bigger, the newly "allocated" space is cleared. * * Return 0 on success and -1 on error with errno set to the error code. * The following error codes are defined: - * ENOSPC - Not enough space in mft record to perform the resize. + * ENOSPC - Not enough space in the mft record @m to perform the resize. * Note that on error no modifications have been performed whatsoever. */ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, @@ -1980,7 +1981,7 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, /* Calculate the new attribute length and mft record bytes used. */ new_alen = (le16_to_cpu(a->value_offset) + newsize + 7) & ~7; - /* If the actual attribute length has changed, move tihings around. */ + /* If the actual attribute length has changed, move things around. */ if (new_alen != le32_to_cpu(a->length)) { new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + new_alen; @@ -1998,23 +1999,32 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, /* Adjust @a to reflect the new value size. */ a->length = cpu_to_le32(new_alen); } + /* + * If we made the attribute value bigger, clear the area between the + * old size and @newsize. + */ + if (newsize > le32_to_cpu(a->value_length)) + memset((u8*)a + le16_to_cpu(a->value_offset) + + le32_to_cpu(a->value_length), 0, newsize - + le32_to_cpu(a->value_length)); a->value_length = cpu_to_le32(newsize); return 0; } /** - * ntfs_resident_attr_shrink - shrink a resident, open ntfs attribute - * @na: resident ntfs attribute to shrink + * ntfs_resident_attr_resize - resize a resident, open ntfs attribute + * @na: resident ntfs attribute to resize * @newsize: new size (in bytes) to which to shrink the attribute * - * Reduce the size of a resident, open ntfs attribute @na to @newsize bytes. + * Change the size of a resident, open ntfs attribute @na to @newsize bytes. * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: * ENOTSUP - The desired resize is not implemented yet. + * ENOMEM - Not enough memory to complete operation. * ERANGE - @newsize is not valid for the attribute type of @na. */ -static int ntfs_resident_attr_shrink(ntfs_attr *na, const u32 newsize) +static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) { ntfs_attr_search_ctx *ctx; int err; @@ -2031,8 +2041,8 @@ static int ntfs_resident_attr_shrink(ntfs_attr *na, const u32 newsize) goto put_err_out; } /* - * Check the attribute type and the corresponding minimum size - * against @newsize and fail if @newsize is too small. + * Check the attribute type and the corresponding minimum and maximum + * sizes against @newsize and fail if @newsize is out of bounds. */ if (ntfs_attr_size_bounds_check(na->ni->vol, na->type, newsize) < 0) { err = errno; @@ -2044,15 +2054,43 @@ static int ntfs_resident_attr_shrink(ntfs_attr *na, const u32 newsize) err = EIO; goto put_err_out; } - /* Perform the resize of the attribute record. */ - if (ntfs_resident_attr_value_resize(ctx->mrec, ctx->attr, newsize)) { - err = errno; - goto put_err_out; + /* + * If @newsize is bigger than the mft record we need to make the + * attribute non-resident if the attribute type supports it. If it is + * smaller we can go ahead and attempt the resize. + */ + if (newsize < na->ni->vol->mft_record_size) { + /* Perform the resize of the attribute record. */ + if (ntfs_resident_attr_value_resize(ctx->mrec, ctx->attr, + newsize)) { + err = errno; + if (err != ENOSPC) + goto put_err_out; + } else { + /* Update the ntfs attribute structure, too. */ + na->allocated_size = na->data_size = + na->initialized_size = newsize; + if (NAttrCompressed(na) || NAttrSparse(na)) + na->compressed_size = newsize; + goto resize_done; + } } - /* Update the ntfs attribute structure, too. */ - na->allocated_size = na->data_size = na->initialized_size = newsize; - if (NAttrCompressed(na) || NAttrSparse(na)) - na->compressed_size = newsize; + /* There is not enough space in the mft record to perform the resize. */ + + // FIXME: Need to try to: + // - make the attribute non-resident if the attribute type allows + // - make other attributes non-resident to free up enough space + // - move the attribute to a new mft record + // Note that some of the above changes also require changes in the + // attribute list attribute (or even creation thereof) hence take + // care!!! Probably want to try to do things in the same order as + // above. Also take care that $MFT/$BITMAP _must_ be non-resident or + // windows ntfs driver causes a blue screen of death on mount attempt, + // i.e. usually at boot time which renders the machine not bootable. + err = ENOTSUP; + goto put_err_out; + +resize_done: /* * Set the inode (and its base inode if it exists) dirty so it is * written out later. @@ -2319,7 +2357,24 @@ put_err_out: * @na: open ntfs attribute to resize * @newsize: new size (in bytes) to which to resize the attribute * - * Change the size of an open ntfs attribute @na to @newsize bytes. + * Change the size of an open ntfs attribute @na to @newsize bytes. If the + * attribute is made bigger and the attribute is resident the newly + * "allocated" space is cleared and if the attribute is non-resident the + * newly allocated space is marked as not initialised and no real allocation + * on disk is performed. FIXME: Do we have to create sparse runs or can we just + * leave the reunlist to finish below data_size, i.e. can we have + * allocated_size < data_size? I guess that what we can't and thus we will have + * to set the sparse bit of the attribute and create sparse runs to ensure that + * allocated_size is >= data_size. We don't need to clear the partial run at + * the end of the real allocation because we leave initialized_size low enough. + * FIXME: Do we want that? Alternatively, we leave initialized_size = data_size + * and do clear the partial run. The latter approach would be more inline with + * what windows would do, even though windows wouldn't even make the attribute + * sparse, it would just allocate clusters instead. TODO: Check what happens on + * WinXP and .NET. FIXME: Make sure to check what NT4 does with an NTFS1.2 + * volume that has sparse files. I suspect it will blow up so we will need to + * perform allocations of clusters, like NT4 would do for NTFS1.2 while we can + * use sparse attributes on NTFS3.x. * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: @@ -2344,16 +2399,17 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) return -1; } /* - * TODO: Implement making attributes bigger/filling in of uninitialized - * holes as well as handling of compressed attributes. (AIA) + * TODO: Implement making non-resident attributes bigger/filling in of + * uninitialized holes as well as handling of compressed attributes. */ - if (newsize > na->initialized_size || NAttrCompressed(na)) { + if ((NAttrNonResident(na) && newsize > na->initialized_size) || + NAttrCompressed(na)) { errno = ENOTSUP; return -1; } if (NAttrNonResident(na)) return ntfs_non_resident_attr_shrink(na, newsize); - return ntfs_resident_attr_shrink(na, (u32)newsize); + return ntfs_resident_attr_resize(na, newsize); } From 09b1e1c2dc8b6ac2381cb372d9a5a6af6c3b2195 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 30 Dec 2002 12:23:10 +0000 Subject: [PATCH 0338/2994] - Clear newly allocated space in ntfs_resident_attr_value_resize(). - Rename ntfs_resident_attr_shrink() to ntfs_resident_attr_resize() and make it resize upwards as well as downwards. - Change ntfs_attr_truncate() to allow resizing upwards of resident attributes. BKrev: 3e103aaelA-DbuSxAZOuXF-SqZHIaA From 75c2ef39f096582bd899fc122e0431b569121f1f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Jan 2003 22:08:00 +0000 Subject: [PATCH 0339/2994] (Logical change 1.76) --- libntfs/lcnalloc.c | 52 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 82e31900..80a9621a 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -35,17 +35,61 @@ * @vol: mounted ntfs volume on which to allocate the clusters * @count: number of clusters to allocate * @start_lcn: starting lcn at which to allocate the clusters (or -1 if none) + * @zone: zone from which to allocate the clusters * - * Allocate @count clusters starting at cluster @start_lcn or at the current - * allocator position if @start_lcn is -1, from the mounted ntfs volume @vol. + * Allocate @count clusters preferably starting at cluster @start_lcn or at the + * current allocator position if @start_lcn is -1, on the mounted ntfs volume + * @vol. @zone is either DATA_ZONE for allocation of normal clusters and + * MFT_ZONE for allocation of clusters for the master file table, i.e. the + * $MFT/$DATA attribute. * * On success return a runlist describing the allocated cluster(s). * * On error return NULL with errno set to the error code. + * + * Notes on the allocation algorithm + * ================================= + * + * There are two data zones. First is the area between the end of the mft zone + * and the end of the volume, and second is the area between the start of the + * volume and the start of the mft zone. On unmodified/standard volumes, the + * second mft zone doesn't exist due to the mft zone being expanded to cover + * the start of the volume in order to reserve space for the mft bitmap + * attribute. + * + * This is not the prettiest function but the complexity stems from the need of + * implementing the mft vs data zoned approach and from the fact that we have + * access to the lcn bitmap in portions of up to 8192 bytes at a time, so we + * need to cope with crossing over boundaries of two buffers. Further, the fact + * that the allocator allows for caller supplied hints as to the location of + * where allocation should begin and the fact that the allocator keeps track of + * where in the data zones the next natural allocation should occur, contribute + * to the complexity of the function. But it should all be worthwhile, because + * this allocator should: 1) be a full implementation of the MFT zone approach + * used by Windows, 2) cause reduction in fragmentation as much as possible, + * and 3) be speedy in allocations (the code is not optimized for speed, but + * the algorithm is, so further speed improvements are probably possible). + * + * FIXME: We should be monitoring cluster allocation and increment the MFT zone + * size dynamically but this is something for the future. We will just cause + * heavier fragmentation by not doing it and I am not even sure Windows would + * grow the MFT zone dynamically, so it might even be correct not to do this. + * The overhead in doing dynamic MFT zone expansion would be very large and + * unlikely worth the effort. (AIA) + * + * TODO: I have added in double the required zone position pointer wrap around + * logic which can be optimized to having only one of the two logic sets. + * However, having the double logic will work fine, but if we have only one of + * the sets and we get it wrong somewhere, then we get into trouble, so + * removing the duplicate logic requires _very_ careful consideration of _all_ + * possible code paths. So at least for now, I am leaving the double logic - + * better safe than sorry... (AIA) */ -runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn) +runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, + const NTFS_CLUSTER_ALLOCATION_ZONES zone) { - if (!vol || count < 0 || start_lcn < 0 || !vol->lcnbmp_na) { + if (!vol || count < 0 || start_lcn < 0 || !vol->lcnbmp_na || + zone < FIRST_ZONE || zone > LAST_ZONE) { errno = EINVAL; return NULL; } From 8a3f5f4c008de08a465066ed15705bc9500c43cd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Jan 2003 22:08:00 +0000 Subject: [PATCH 0340/2994] fix compile (thanks to Szaka) (Logical change 1.76) --- libntfs/mft.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/mft.c b/libntfs/mft.c index 80ae3adc..a8aba64b 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -20,6 +20,7 @@ */ #include +#include #include #include From cdcc968ac257ddae03c5710c469ff15f776e8a4e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Jan 2003 22:08:00 +0000 Subject: [PATCH 0341/2994] mft.c: fix compile (thanks to Szaka) BKrev: 3e19fe408ezU1nHbgzxf9oBHR5PcUA From cb8fc1b9e944f4c99a992c6a5be1aff2837a37b2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Jan 2003 22:09:46 +0000 Subject: [PATCH 0342/2994] (Logical change 1.77) --- include/lcnalloc.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/lcnalloc.h b/include/lcnalloc.h index cc5728a9..d4853dd7 100644 --- a/include/lcnalloc.h +++ b/include/lcnalloc.h @@ -27,7 +27,15 @@ #include "runlist.h" #include "volume.h" -extern runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn); +typedef enum { + FIRST_ZONE = 0, /* For sanity checking. */ + MFT_ZONE = 0, /* Allocate from $MFT zone. */ + DATA_ZONE = 1, /* Allocate from $DATA zone. */ + LAST_ZONE = 1, /* For sanity checking. */ +} NTFS_CLUSTER_ALLOCATION_ZONES; + +extern runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, + const NTFS_CLUSTER_ALLOCATION_ZONES zone); extern int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count); From 7ee9338075c7767732afa0fb5cb8286cbab1f956 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Jan 2003 22:09:46 +0000 Subject: [PATCH 0343/2994] BKrev: 3e19feaavPbEuJqUb_dQmLe--jFPdg From ea773ce760bee12eaa90875f8773b82b4a8ae5c0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 8 Jan 2003 10:48:09 +0000 Subject: [PATCH 0344/2994] - New API function: ntfs_attr_can_be_non_resident(). - Check whether the attribute name needs moving when resizing the resident part of an attribute record. - Create internal function ntfs_attr_find_in_attrdef(). (Logical change 1.78) --- libntfs/attrib.c | 185 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 151 insertions(+), 34 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 77ff65dc..14534052 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1,7 +1,7 @@ /* * attrib.c - Attribute handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * Copyright (c) 2002 Richard Russon * * This program/include file is free software; you can redistribute it and/or @@ -1909,6 +1909,45 @@ void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) return; } +/** + * ntfs_attr_find_in_attrdef - find an attribute in the $AttrDef system file + * @vol: ntfs volume to which the attribute belongs + * @type: attribute type which to find + * + * Search for the attribute definition record corresponding to the attribute + * @type in the $AttrDef system file. + * + * Return the attribute type definition record if found and NULL if not found + * or an error occured. On error the error code is stored in errno. The + * following error codes are defined: + * ENOENT - The attribute @type is not specified in $AttrDef. + * EINVAL - Invalid parameters (e.g. @vol is not valid). + */ +static ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol, + const ATTR_TYPES type) +{ + ATTR_DEF *ad; + + if (!vol || !vol->attrdef || !type) { + errno = EINVAL; + return NULL; + } + for (ad = vol->attrdef; (u8*)ad - (u8*)vol->attrdef < + vol->attrdef_len && ad->type; ++ad) { + /* We haven't found it yet, carry on searching. */ + if (ad->type < type) + continue; + /* We found the attribute; return it. */ + if (ad->type == type) + return ad; + /* We have gone too far already. No point in continuing. */ + break; + } + /* Attribute not found?!? */ + errno = ENOENT; + return NULL; +} + /** * ntfs_attr_size_bounds_check - check a size of an attribute type for validity * @vol: ntfs volume to which the attribute belongs @@ -1916,43 +1955,60 @@ void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) * @size: size which to check * * Check whether the @size in bytes is valid for an attribute of @type on the - * ntfs volume @vol. + * ntfs volume @vol. This information is obtained from $AttrDef system file. * * Return 0 if valid and -1 if not valid or an error occured. On error the * error code is stored in errno. The following error codes are defined: * ERANGE - @size is not valid for the attribute @type. * ENOENT - The attribute @type is not specified in $AttrDef. - * EINVAL - Invalid parameters (e.g. @size is < 0 or @vol is not valid) + * EINVAL - Invalid parameters (e.g. @size is < 0 or @vol is not valid). */ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type, const s64 size) { ATTR_DEF *ad; - if (!vol || !vol->attrdef || size < 0) { + if (size < 0) { errno = EINVAL; return -1; } - - for (ad = vol->attrdef; (u8*)ad - (u8*)vol->attrdef < - vol->attrdef_len && ad->type; ++ad) { - /* We haven't found it yet, carry on searching. */ - if (ad->type < type) - continue; - /* We have gone too far already. No point in continuing. */ - if (ad->type > type) - break; - /* We found the attribute. - Do the bounds check. */ - if (size >= le64_to_cpu(ad->min_size) && - size <= le64_to_cpu(ad->max_size)) - return 0; - /* @size is out of range! */ - errno = ERANGE; + ad = ntfs_attr_find_in_attrdef(vol, type); + if (!ad) return -1; - } + /* We found the attribute. - Do the bounds check. */ + if (size >= le64_to_cpu(ad->min_size) && + size <= le64_to_cpu(ad->max_size)) + return 0; + /* @size is out of range! */ + errno = ERANGE; + return -1; +} - /* Attribute not found?!? */ - errno = ENOENT; +/** + * ntfs_attr_can_be_non_resident - check if an attribute can be non-resident + * @vol: ntfs volume to which the attribute belongs + * @type: attribute type which to check + * + * Check whether the attribute of @type on the ntfs volume @vol is allowed to + * be non-resident. This information is obtained from $AttrDef system file. + * + * Return 0 if the attribute is allowed to be non-resident and -1 if not or an + * error occured. On error the error code is stored in errno. The following + * error codes are defined: + * EPERM - The attribute is not allowed to be non-resident. + * ENOENT - The attribute @type is not specified in $AttrDef. + * EINVAL - Invalid parameters (e.g. @vol is not valid). + */ +int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type) +{ + ATTR_DEF *ad; + + ad = ntfs_attr_find_in_attrdef(vol, type); + if (!ad) + return -1; + if (ad->flags & CAN_BE_NON_RESIDENT) + return 0; + errno = EPERM; return -1; } @@ -1975,10 +2031,33 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, { u32 new_alen, new_muse; - // FIXME: Should verify that the attribute name hasn't been placed - // after the attribute value and if it is, we need to move the - // name, too. (AIA) - + /* + * Check that the attribute name hasn't been placed after the + * attribute value/mapping pairs array. If it has we need to move it. + * TODO: Implement the move. For now just abort. (AIA) + */ + if (a->name_length) { + BOOL move_name = FALSE; + if (a->non_resident) { + if (le16_to_cpu(a->name_offset) >= + le16_to_cpu(a->mapping_pairs_offset)) + move_name = TRUE; + } else { + if (le16_to_cpu(a->name_offset) >= + le16_to_cpu(a->value_offset)) + move_name = TRUE; + + } + if (move_name) { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Name is placed after the " + "%s. Aborting...\n", __FUNCTION__, + a->non_resident ? "mapping pairs array": + "attribute value"); + errno = ENOTSUP; + return -1; + } + } /* Calculate the new attribute length and mft record bytes used. */ new_alen = (le16_to_cpu(a->value_offset) + newsize + 7) & ~7; /* If the actual attribute length has changed, move things around. */ @@ -2027,6 +2106,7 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) { ntfs_attr_search_ctx *ctx; + ntfs_volume *vol; int err; Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x.\n", __FUNCTION__, @@ -2040,11 +2120,12 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) err = errno; goto put_err_out; } + vol = na->ni->vol; /* * Check the attribute type and the corresponding minimum and maximum * sizes against @newsize and fail if @newsize is out of bounds. */ - if (ntfs_attr_size_bounds_check(na->ni->vol, na->type, newsize) < 0) { + if (ntfs_attr_size_bounds_check(vol, na->type, newsize) < 0) { err = errno; if (err == ERANGE) { // FIXME: Eeek! @@ -2059,7 +2140,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) * attribute non-resident if the attribute type supports it. If it is * smaller we can go ahead and attempt the resize. */ - if (newsize < na->ni->vol->mft_record_size) { + if (newsize < vol->mft_record_size) { /* Perform the resize of the attribute record. */ if (ntfs_resident_attr_value_resize(ctx->mrec, ctx->attr, newsize)) { @@ -2078,7 +2159,20 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) /* There is not enough space in the mft record to perform the resize. */ // FIXME: Need to try to: - // - make the attribute non-resident if the attribute type allows + + /* Check if the attribute is allowed to be non-resident. */ + if (ntfs_attr_can_be_non_resident(vol, na->type) < 0) { + /* If an error occured, abort. */ + if (errno != EPERM) { + err = errno; + goto put_err_out; + } + /* Attribute is not allowed to be non-resident. */ + } else { + /* Make the attribute non-resident. */ + // TODO: do it! + } + // - make other attributes non-resident to free up enough space // - move the attribute to a new mft record // Note that some of the above changes also require changes in the @@ -2304,11 +2398,34 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) "metadata!\n", __FUNCTION__); goto put_err_out; } - - // FIXME: Should verify that the attribute name hasn't been - // placed after the attribute value and if it is, we - // need to move the name, too. (AIA) - + /* + * Check that the attribute name hasn't been placed after the + * attribute value/mapping pairs array. If it has we need to + * move it. TODO: Implement the move. For now just abort. (AIA) + */ + if (a->name_length) { + BOOL move_name = FALSE; + if (a->non_resident) { + if (le16_to_cpu(a->name_offset) >= le16_to_cpu( + a->mapping_pairs_offset)) + move_name = TRUE; + } else { + if (le16_to_cpu(a->name_offset) >= + le16_to_cpu(a->value_offset)) + move_name = TRUE; + + } + if (move_name) { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Name is placed " + "after the %s. Aborting...\n", + __FUNCTION__, a->non_resident ? + "mapping pairs array": + "attribute value"); + err = ENOTSUP; + goto put_err_out; + } + } /* * Calculate the new attribute length and mft record bytes * used. From 44ed67cfdeb6a8c9e765eff539a3991472a2f135 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 8 Jan 2003 10:48:09 +0000 Subject: [PATCH 0345/2994] - New API function: ntfs_attr_can_be_non_resident(). - Check whether the attribute name needs moving when resizing the resident part of an attribute record. - Create internal function ntfs_attr_find_in_attrdef(). BKrev: 3e1c01e9HmWONmXWbv5b3zbLAYdl1g From 312e98fd24078dcd650c0bdbb3b0345333160e2b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 8 Jan 2003 10:48:09 +0000 Subject: [PATCH 0346/2994] New API function: ntfs_attr_can_be_non_resident(). (Logical change 1.78) --- include/attrib.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/attrib.h b/include/attrib.h index cc56cef7..b48783db 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -1,7 +1,7 @@ /* * attrib.h - Exports for attribute handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -256,6 +256,8 @@ extern runlist_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn); extern int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type, const s64 size); +extern int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, + const ATTR_TYPES type); extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, const u32 newsize); From dc9c8b61e164081241ec087b3d012ba2457a1061 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 8 Jan 2003 10:48:09 +0000 Subject: [PATCH 0347/2994] update (Logical change 1.78) --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8ae20c0e..311dd531 100644 --- a/ChangeLog +++ b/ChangeLog @@ -65,7 +65,8 @@ ntfs_attr_find_vcn(), ntfs_attr_init(), ntfs_attr_{open,close}(), - ntfs_attr_size_bounds_check(). + ntfs_attr_size_bounds_check(), + ntfs_attr_can_be_non_resident(). - Add new field mftmirr_size to ntfs_volume structure and initialize it to the number of mft records stored in the mft mirror in ntfs_mount(). From 57f0b7300e2df6184963445920d338f5bd31040b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 8 Jan 2003 10:48:09 +0000 Subject: [PATCH 0348/2994] update copyright (Logical change 1.78) --- libntfs/lcnalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 80a9621a..88cd7c40 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -1,7 +1,7 @@ /* * lcnalloc.c - Cluster (de)allocation code. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published From 60ac38315c36be3e25546cf5159da71be6da448b Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 01:24:28 +0000 Subject: [PATCH 0349/2994] A bit of minor tidying and lots of comments for resize BKrev: 3e1ccf4cXHiCD11ZN0ZRJZfdlJb-Dg From ed1149f0a062f2993caeff8d0aa92543ef9ad250 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 01:24:28 +0000 Subject: [PATCH 0350/2994] added a version option simplified get_bitmap_data added comment blocks (Logical change 1.79) --- ntfsprogs/ntfsresize.c | 279 ++++++++++++++++++++++++++++++++--------- 1 file changed, 219 insertions(+), 60 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 93fec8dc..f97b3201 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1,4 +1,4 @@ -/* +/** * ntfsresize - Part of the Linux-NTFS project. * * Copyright (c) 2002 Szabolcs Szakacsits @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include "debug.h" #include "types.h" @@ -45,7 +47,7 @@ #include "inode.h" #include "runlist.h" -const char *EXEC_NAME = "ntfsresize"; +static const char *EXEC_NAME = "ntfsresize"; static const char *ntfs_report_banner = "\nReport bugs to linux-ntfs-dev@lists.sf.net. " @@ -103,7 +105,11 @@ struct bitmap lcn_bitmap; #define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) - +/** + * perr_printf + * + * Print an error message. + */ void perr_printf(const char *fmt, ...) { va_list ap; @@ -118,7 +124,11 @@ void perr_printf(const char *fmt, ...) fflush(stderr); } - +/** + * err_exit + * + * Print and error message and exit the program. + */ int err_exit(const char *fmt, ...) { va_list ap; @@ -132,7 +142,11 @@ int err_exit(const char *fmt, ...) exit(1); } - +/** + * perr_exit + * + * Print and error message and exit the program + */ int perr_exit(const char *fmt, ...) { va_list ap; @@ -148,7 +162,11 @@ int perr_exit(const char *fmt, ...) exit(1); } - +/** + * usage + * + * Print a brief list of program options. + */ void usage() { printf("\n"); @@ -162,12 +180,17 @@ void usage() printf (" -n Make a test run without write operations (read-only)\n"); printf (" -s size[k|M|G] Shrink volume to size[k|M|G] bytes (k=10^3, M=10^6, G=10^9)\n"); /* printf (" -v Verbose operation\n"); */ + printf (" -V Version information\n"); printf(ntfs_report_banner); exit(1); } - -/* Copy-paste from e2fsprogs */ +/** + * proceed_question + * + * Force the user to confirm an action before performing it. + * Copy-paste from e2fsprogs + */ void proceed_question(void) { char buf[256]; @@ -179,12 +202,38 @@ void proceed_question(void) buf[0] = 0; fgets(buf, sizeof(buf), stdin); if (strchr(short_yes, buf[0]) == 0) { - printf("OK quitting. NO CHANGES has been made to your NTFS volume.\n"); + printf("OK quitting. NO CHANGES have been made to your NTFS volume.\n"); exit(1); } } +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + printf ("Resize an NTFS Volume, without data loss.\n\n" + "%s is free software, released under the GNU " + "General Public License\nand you are welcome to redistribute " + "it under certain conditions.\n%s comes with ABSOLUTELY NO " + "WARRANTY; for details read the GNU\nGeneral Public License " + "to be found in the file COPYING in the main\nLinux-NTFS " + "distribution directory.\n\n", + EXEC_NAME, EXEC_NAME); + exit(1); +} +/** + * get_new_volume_size + * + * Convert a user-supplied string into a size. Without any suffix the number + * will be assumed to be in bytes. If the number has a suffix of k, M or G it + * will be scaled up by 1000, 1000000, or 1000000000. + */ s64 get_new_volume_size(char *s) { s64 size; @@ -228,7 +277,11 @@ s64 get_new_volume_size(char *s) return size; } - +/** + * parse_options + * + * Parse the command line options + */ void parse_options(int argc, char **argv) { int i; @@ -237,7 +290,7 @@ void parse_options(int argc, char **argv) memset(&opt, 0, sizeof(opt)); - while ((i = getopt(argc, argv, "dfhins:")) != EOF) + while ((i = getopt(argc, argv, "dfhins:V")) != EOF) switch (i) { case 'd': opt.debug = 1; @@ -259,6 +312,8 @@ void parse_options(int argc, char **argv) case 'v': opt.verbose++; break; + case 'V': + version(); default: usage(); } @@ -273,7 +328,6 @@ void parse_options(int argc, char **argv) if (!(stderr = fopen("/dev/null", "rw"))) perr_exit("Couldn't open /dev/null"); - /* If no '-s size' then estimate smallest shrunken volume size */ if (!opt.bytes) opt.info = 1; @@ -288,14 +342,18 @@ void parse_options(int argc, char **argv) } } - +/** + * nr_clusters_to_bitmap_byte_size + * + * Take the number of clusters in the volume and calculate the size of $Bitmap. + * The size will always be a multiple of 8 bytes. + */ s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) { s64 bm_bsize; bm_bsize = rounded_up_division(nr_clusters, 8); - /* Needs to be multiple of 8 bytes */ bm_bsize = (bm_bsize + 7) & ~7; Dprintf("Bitmap byte size : %lld (%lld clusters)\n", bm_bsize, rounded_up_division(bm_bsize, vol->cluster_size)); @@ -303,7 +361,15 @@ s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) return bm_bsize; } - +/** + * build_lcn_usage_bitmap + * + * lcn_bitmap has one bit for each cluster on the disk. Initially, lcn_bitmap + * has no bits set. As each attribute record is read the bits in lcn_bitmap are + * checked to ensure that no other file already references that cluster. + * + * This serves as a rudimentary "chkdsk" operation. + */ void build_lcn_usage_bitmap(ATTR_RECORD *a) { runlist *rl; @@ -329,7 +395,12 @@ void build_lcn_usage_bitmap(ATTR_RECORD *a) free(rl); } - +/** + * walk_attributes + * + * For a given MFT Record, iterate through all its attributes. Any non-resident + * data runs will be marked in lcn_bitmap. + */ void walk_attributes(MFT_RECORD *mr) { ntfs_attr_search_ctx *ctx; @@ -346,35 +417,34 @@ void walk_attributes(MFT_RECORD *mr) ntfs_attr_put_search_ctx(ctx); } - +/** + * get_bitmap_data + * + * Read the metadata file $Bitmap into a bitmap struct. + * Each cluster on disk is represented by a bit in this file. + */ void get_bitmap_data(ntfs_volume *vol, struct bitmap *bm) { - ntfs_inode *ni; - ntfs_attr_search_ctx *ctx; + ntfs_attr *attr; - if (!(ni = ntfs_inode_open(vol, (MFT_REF)FILE_Bitmap))) - perr_exit("ntfs_open_inode"); + attr = vol->lcnbmp_na; - if (!(ctx = ntfs_attr_get_search_ctx(ni, NULL))) - perr_exit("ntfs_get_attr_search_ctx"); + bm->size = attr->initialized_size; - if (ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) - perr_exit("ntfs_lookup_attr"); + bm->bm = malloc (bm->size); + if (!bm->bm) + perr_exit ("get_bitmap_data"); - /* FIXME: get_attribute_value_length() can't handle extents */ - bm->size = ntfs_get_attribute_value_length(ctx->attr); - - if (!(bm->bm = (u8 *)malloc(bm->size))) - perr_exit("get_bitmap_data"); - - if (ntfs_get_attribute_value(vol, ni->mrec, ctx->attr, bm->bm) != bm->size) + if (ntfs_attr_pread (attr, 0, bm->size, bm->bm) < 0) perr_exit("Couldn't get $Bitmap $DATA\n"); - - ntfs_attr_put_search_ctx(ctx); - ntfs_inode_close(ni); } - +/** + * compare_bitmaps + * + * Compare two bitmaps. In this case, $Bitmap as read from the disk and + * lcn_bitmap which we built from the MFT Records. + */ void compare_bitmaps(struct bitmap *a, struct bitmap *b) { int i; @@ -390,7 +460,11 @@ void compare_bitmaps(struct bitmap *a, struct bitmap *b) i, a->bm[i], b->bm[i]); } - +/** + * progress_init + * + * Create and scale our progress bar. + */ void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) { p->start = start; @@ -399,7 +473,11 @@ void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) p->resolution = res; } - +/** + * progress_update + * + * Update the progress bar and tell the user. + */ void progress_update(struct progress_bar *p, u64 current) { float percent = p->unit * current; @@ -413,6 +491,12 @@ void progress_update(struct progress_bar *p, u64 current) fflush(stdout); } +/** + * walk_inodes + * + * Read each record in the MFT, skipping the unused ones, and build up a bitmap + * from all the non-resident attributes. + */ void walk_inodes() { s32 inode = 0; @@ -446,7 +530,13 @@ void walk_inodes() free(mrec); } - +/** + * advise_on_resize + * + * The metadata file $Bitmap has one bit for each cluster on disk. This has + * already been read into lcn_bitmap. By looking for the last used cluster on + * the disk, we can work out by how much we can shrink the volume. + */ void advise_on_resize() { u64 i, old_b, new_b, g_b, old_mb, new_mb, g_mb; @@ -489,7 +579,11 @@ void advise_on_resize() exit(1); } - +/** + * look_for_bad_sector + * + * Read through the metadata file $BadClus looking for bad sectors on the disk. + */ void look_for_bad_sector(ATTR_RECORD *a) { runlist *rl; @@ -506,7 +600,11 @@ void look_for_bad_sector(ATTR_RECORD *a) free(rl); } - +/** + * rl_set + * + * Helper to set up a runlist object + */ void rl_set(runlist *rl, VCN vcn, LCN lcn, s64 len) { rl->vcn = vcn; @@ -514,8 +612,9 @@ void rl_set(runlist *rl, VCN vcn, LCN lcn, s64 len) rl->length = len; } - -/* +/** + * bitmap_file_data_fixup + * * $Bitmap can overlap the end of the volume. Any bits in this region * must be set. This region also encompasses the backup boot sector. */ @@ -525,8 +624,11 @@ void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) ntfs_bit_set(bm->bm, (u64)cluster, 1); } - -/* +/** + * truncate_badclust_bad_attr + * + * The metadata file $BadClus needs to be shrunk. + * * FIXME: this function should go away and instead using a generalized * "truncate_bitmap_unnamed_attr()" */ @@ -563,7 +665,12 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) free(mp); } - +/** + * truncate_bitmap_unnamed_attr + * + * Shrink the metadata file $Bitmap. It must be large enough for one bit per + * cluster of the shrunken volume. Also it must be a of 8 bytes in size. + */ void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) { runlist *rl; @@ -573,7 +680,6 @@ void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) int trunc_at = -1; /* FIXME: -1 means unset */ char *mp; - if (!a->non_resident) /* FIXME: handle resident attribute value */ perr_exit("Resident data attribute in $Bitmap not supported!"); @@ -644,7 +750,12 @@ void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) free(mp); } - +/** + * lookup_data_attr + * + * Find the $DATA attribute (with or without a name) for the given MFT reference + * (inode number). + */ void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) { ntfs_inode *ni; @@ -675,7 +786,12 @@ void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) free(ustr); } - +/** + * write_mft_record + * + * Write an MFT Record back to the disk. If the read-only command line option + * was given, this function will do nothing. + */ int write_mft_record(ntfs_attr_search_ctx *ctx) { if (opt.ro_flag) @@ -684,7 +800,11 @@ int write_mft_record(ntfs_attr_search_ctx *ctx) return ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec); } - +/** + * truncate_badclust_file + * + * Shrink the $BadClus file to match the new volume size. + */ void truncate_badclust_file(s64 nr_clusters) { ntfs_attr_search_ctx *ctx = NULL; @@ -703,7 +823,11 @@ void truncate_badclust_file(s64 nr_clusters) ntfs_attr_put_search_ctx(ctx); } - +/** + * truncate_bitmap_file + * + * Shrink the $Bitmap file to match the new volume size. + */ void truncate_bitmap_file(s64 nr_clusters) { ntfs_attr_search_ctx *ctx = NULL; @@ -720,7 +844,13 @@ void truncate_bitmap_file(s64 nr_clusters) ntfs_attr_put_search_ctx(ctx); } - +/** + * setup_lcn_bitmap + * + * Allocate a block of memory with one bit for each cluster of the disk. + * All the bits are set to 0, except those representing the region beyond the + * end of the disk. + */ void setup_lcn_bitmap() { /* Determine lcn bitmap byte size and allocate it. */ @@ -732,8 +862,11 @@ void setup_lcn_bitmap() bitmap_file_data_fixup(vol->nr_clusters, &lcn_bitmap); } - -/* FIXME: should be done using ntfs_* functions */ +/** + * update_bootsector + * + * FIXME: should be done using ntfs_* functions + */ void update_bootsector(s64 nr_clusters) { NTFS_BOOT_SECTOR bs; @@ -757,7 +890,11 @@ void update_bootsector(s64 nr_clusters) perr_exit("write() error"); } - +/** + * print_volume_size + * + * Print the volume size in bytes and decimal megabytes. + */ void print_volume_size(char *str, ntfs_volume *v, s64 nr_clusters) { s64 b; /* volume size in bytes */ @@ -767,7 +904,13 @@ void print_volume_size(char *str, ntfs_volume *v, s64 nr_clusters) str, b, rounded_up_division(b, NTFS_MBYTE)); } - +/** + * mount_volume + * + * First perform some checks to determine if the volume is already mounted, or + * is dirty (Windows wasn't shutdown properly). If everything is OK, then mount + * the volume (load the metadata into memory). + */ void mount_volume() { unsigned long mntflag; @@ -811,7 +954,13 @@ void mount_volume() print_volume_size("Current volume size", vol, vol->nr_clusters); } - +/** + * prepare_volume_fixup + * + * Set the volume's dirty flag and wipe the filesystem journal. When Windows + * boots it will automatically run chkdsk to check for any problems. If the + * read-only command line option was given, this function will do nothing. + */ void prepare_volume_fixup() { if (!opt.ro_flag) { @@ -825,19 +974,29 @@ void prepare_volume_fixup() if (ntfs_volume_set_flags(vol, flags)) perr_exit("Failed to set $Volume dirty"); - printf("Resetting $LogFile ... " - "(this might take a while)\n"); + printf("Resetting $LogFile ... (this might take a while)\n"); if (ntfs_logfile_reset(vol)) perr_exit("Failed to reset $LogFile"); } } - +/** + * main + * + * Start here + */ int main(int argc, char **argv) { struct bitmap on_disk_lcn_bitmap; s64 new_volume_size = 0; /* in clusters */ int i; + const char *locale; + + locale = setlocale (LC_ALL, ""); + if (!locale) { + locale = setlocale (LC_ALL, NULL); + printf ("Failed to set locale, using default (%s).\n", locale); + } parse_options(argc, argv); From fde565d5040a1c794583d3d6a27d66e4eea934e9 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 01:42:21 +0000 Subject: [PATCH 0351/2994] Initial revision --- ntfsprogs/ntfscluster.c | 0 ntfsprogs/ntfscluster.h | 0 ntfsprogs/utils.c | 0 ntfsprogs/utils.h | 0 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 ntfsprogs/ntfscluster.c create mode 100644 ntfsprogs/ntfscluster.h create mode 100644 ntfsprogs/utils.c create mode 100644 ntfsprogs/utils.h diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfscluster.h b/ntfsprogs/ntfscluster.h new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h new file mode 100644 index 00000000..e69de29b From 9227c23f73bbd521437ed8fd29cdde01f3ec3a0c Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 01:42:21 +0000 Subject: [PATCH 0352/2994] (Logical change 1.80) --- ntfsprogs/ntfscluster.c | 583 ++++++++++++++++++++++++++++++++++++++++ ntfsprogs/ntfscluster.h | 43 +++ ntfsprogs/utils.c | 257 ++++++++++++++++++ ntfsprogs/utils.h | 63 +++++ 4 files changed, 946 insertions(+) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index e69de29b..45c3c3d5 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -0,0 +1,583 @@ +/** + * ntfscluster - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Richard Russon + * + * This utility will locate the owner of any given sector or cluster. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ntfscluster.h" +#include "types.h" +#include "attrib.h" +#include "utils.h" +#include "volume.h" + +static const char *AUTHOR = "Richard Russon (FlatCap)"; +static const char *EXEC_NAME = "ntfscluster"; +static struct options opts; + +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF (Iprintf, stdout, &opts.quiet, FALSE) + +/** + * Dprintf - Print debug messages + */ +#ifndef DEBUG +#define Dprintf(...) +#else +void Dprintf (const char *format, ...) +{ + va_list va; + va_start (va, format); + vfprintf (stdout, format, va); + va_end (va); +} +#endif +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + Iprintf ("%s v%s Copyright (C) 2002 %s\n***XXX***on " + "an NTFS Volume\n\n%s is free software, released under the GNU " + "General Public License\nand you are welcome to redistribute " + "it under certain conditions.\n%s comes with ABSOLUTELY NO " + "WARRANTY; for details read the GNU\nGeneral Public License " + "to be found in the file COPYING in the main\nLinux-NTFS " + "distribution directory.\n\n", + EXEC_NAME, VERSION, AUTHOR, EXEC_NAME, EXEC_NAME); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + Iprintf ("Usage: %s [options] device\n" + " -i --info Print information about the volume\n" + " -s range --sector range Look for objects in this range of sectors\n" + " -c range --cluster range Look for objects in this range of clusters\n" + "\n" + " -f --force Use less caution\n" + " -q --quiet Less output\n" + " -v --verbose More output\n" + " -V --version Version information\n" + " -h --help Print this help\n\n", + EXEC_NAME); + Iprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); +} + +/** + * parse_size - Convert a string representing a size + * @value: String to be parsed + * @size: Parsed size + * + * Read a string and convert it to a number. Strings may be suffixed to scale + * them. Any number without a suffix is assumed to be in bytes. + * + * Suffix Description Multiple + * [tT] Terabytes 10^12 + * [gG] Gigabytes 10^9 + * [mM] Megabytes 10^6 + * [kK] Kilobytes 10^3 + * + * Notes: + * Only the first character of the suffix is read. + * The multipliers are decimal thousands, not binary: 1000, not 1024. + * If parse_size fails, @size will not be changed + * + * Return: 1 Success + * 0 Error, the string was malformed + */ +int parse_size (const char *value, s64 *size) +{ + long long result; + char *suffix = NULL; + + if (!value || !size) + return 0; + + Dprintf ("Parsing size '%s'.\n", value); + + result = strtoll (value, &suffix, 10); + if (result < 0 || errno == ERANGE) { + Eprintf ("Invalid size '%s'.\n", value); + return 0; + } + + if (!suffix) { + Eprintf ("Internal error, strtoll didn't return a suffix.\n"); + return 0; + } + + + /*if (strlen (suffix) > 1) { + Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); + return 0; + } Can't do this because of ranges*/ + + switch (suffix[0]) { + case 't': case 'T': result *= 1000; + case 'g': case 'G': result *= 1000; + case 'm': case 'M': result *= 1000; + case 'k': case 'K': result *= 1000; + case '-': case 0: + break; + default: + Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); + return 0; + } + + Dprintf ("Parsed size = %lld.\n", result); + *size = result; + return 1; +} + +/** + * parse_range - Convert a string representing a range of numbers + * @string: The string to be parsed + * @start: The beginning of the range will be stored here + * @finish: The end of the range will be stored here + * + * Read a string of the form n-m. If the lower end is missing, zero will be + * substituted. If the upper end is missing LONG_MAX will be used. If the + * string cannot be parsed correctly, @start and @finish will not be changed. + * + * Return: 1 Success, a valid string was found + * 0 Error, the string was not a valid range + */ +int parse_range (const char *string, s64 *start, s64 *finish) +{ + s64 a, b; + char *middle; + + if (!string || !start || !finish) + return 0; + + middle = strchr (string, '-'); + if (string == middle) { + Dprintf ("Range has no beginning, defaulting to 0.\n"); + a = 0; + } else { + if (!parse_size (string, &a)) + return 0; + } + + if (middle) { + if (middle[1] == 0) { + b = LONG_MAX; // XXX ULLONG_MAX + Dprintf ("Range has no end, defaulting to %lld.\n", b); + } else { + if (!parse_size (middle+1, &b)) + return 0; + } + } else { + b = a; + } + + Dprintf ("Range '%s' = %lld - %lld\n", string, a, b); + + *start = a; + *finish = b; + return 1; +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char **argv) +{ + static const char *sopt = "-c:fhiqs:vV"; + static const struct option lopt[] = { + { "cluster", required_argument, NULL, 'c' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "info", no_argument, NULL, 'i' }, + { "quiet", no_argument, NULL, 'q' }, + { "sector", required_argument, NULL, 's' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + int err = 0; + int ver = 0; + int help = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else { + opts.device = NULL; + err++; + } + break; + + case 'c': + if ((opts.cluster_begin > 0) || (opts.cluster_end > 0) || + !parse_range (optarg, &opts.cluster_begin, &opts.cluster_end)) { + err++; + } + break; + case 'f': + opts.force++; + break; + case 'h': + help++; + break; + case 'i': + opts.info++; + break; + case 'q': + opts.quiet++; + break; + case 's': + if ((opts.sector_begin > 0) || (opts.sector_end > 0) || + !parse_range (optarg, &opts.sector_begin, &opts.sector_end)) { + err++; + } + break; + case 'v': + opts.verbose++; + break; + case 'V': + ver++; + break; + default: + if ((optopt == 'c') || (optopt == 's')) { + Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); + } else { + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + } + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if (opts.device == NULL) { + Eprintf ("You must specify exactly one device.\n"); + err++; + } + + if (opts.quiet && opts.verbose) { + Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + err++; + } + + if (opts.sector_end && opts.cluster_end) { + Eprintf ("You must specify either a sector or a cluster.\n"); + err++; + } + if (opts.cluster_begin > opts.cluster_end) { + Eprintf ("The cluster range must be in ascending order.\n"); + err++; + } + if (opts.sector_begin > opts.sector_end) { + Eprintf ("The sector range must be in ascending order.\n"); + err++; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + +/** + * mftrec_in_use - Determine if a MFT Record is in use + * @vol: An ntfs volume obtained from ntfs_mount + * @mref: MFT Reference (inode number) + * + * The metadata file $BITMAP has one binary bit representing each record in the + * MFT. The bit will be set for each record that is in use. The function + * reads the relevant part of $BITMAP into a buffer and tests the bit. + * + * This function has a static buffer in which it caches a section of $BITMAP. + * If the mref, being tested, lies outside the range, the buffer will be + * refreshed. + * + * Return: 1 MFT Record is in use + * 0 MFT Record is unused + * -1 Error occurred + */ +int mftrec_in_use (ntfs_volume *vol, MFT_REF mref) +{ + static u8 buffer[512]; + static s64 bmpmref = -sizeof (buffer) - 1; /* Which bit of $BITMAP is in the buffer */ + + int byte, bit; + + if (!vol) + return -1; + + /* Does mref lie in the section of $Bitmap we already have cached? */ + if ((mref < bmpmref) || (mref >= (bmpmref + (sizeof (buffer) << 3)))) { + Dprintf ("Bit lies outside cache.\n"); + + /* Mark the buffer as not in use, in case the read is shorter. */ + memset (buffer, 0, sizeof (buffer)); + bmpmref = mref & (~((sizeof (buffer) << 3) - 1)); + + if (ntfs_attr_pread (vol->mftbmp_na, (bmpmref>>3), sizeof (buffer), buffer) < 0) { + Eprintf ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno)); + return -1; + } + + Dprintf ("Reloaded bitmap buffer.\n"); + } + + bit = 1 << (mref & 7); + byte = (mref >> 3) & (sizeof (buffer) - 1); + Dprintf ("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", + mref, bmpmref, byte, bit, buffer[byte] & bit); + + return (buffer[byte] & bit); +} + +/** + * cluster_find + */ +int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) +{ + int i; + int result = 1; + u8 *buffer; + + if (!vol) + return 1; + + buffer = malloc (vol->mft_record_size); + if (!buffer) { + Eprintf ("Couldn't allocate memory.\n"); + return 1; + } + + for (i = 0; i < vol->nr_mft_records; i++) { + //for (i = 0; i < 30; i++) { + //for (i = 162; i < 175; i++) { + ntfs_inode *inode; + ntfs_attr_search_ctx *ctx; + + if (!mftrec_in_use (vol, i)) { + //printf ("%d skipped\n", i); + continue; + } + + inode = ntfs_inode_open (vol, i); + if (!inode) { + Eprintf ("Can't read inode %d\n", i); + goto free; + } + + if (inode->nr_extents == -1) { + printf ("inode %d is an extent record\n", i); + goto close; + } + + Vprintf ("Inode: %d\n", i); + ctx = ntfs_attr_get_search_ctx (inode, NULL); + + if (ntfs_attr_lookup (AT_STANDARD_INFORMATION, NULL, 0, IGNORE_CASE, 0, NULL, 0, ctx) < 0) { + //printf ("extent inode\n"); + continue; + } + ntfs_attr_reinit_search_ctx (ctx); + + //printf ("Searching for cluster range %lld-%lld\n", s_begin, s_end); + while (ntfs_attr_lookup (AT_UNUSED, NULL, 0, IGNORE_CASE, 0, NULL, 0, ctx) >= 0) { + runlist_element *runs; + int j; + + if (!ctx->attr->non_resident) { + //printf ("0x%02X ", ctx->attr->type); + continue; + } + + runs = ntfs_mapping_pairs_decompress (vol, ctx->attr, NULL); + if (!runs) { + Eprintf ("Couldn't read the data runs.\n"); + ntfs_inode_close (inode); + goto free; + } + + Vprintf ("\t[0x%02X]\n", ctx->attr->type); + + Vprintf ("\t\tVCN\tLCN\tLength\n"); + for (j = 0; runs[j].length > 0; j++) { + LCN a_begin = runs[j].lcn; + LCN a_end = a_begin + runs[j].length - 1; + + if (a_begin < 0) + continue; // sparse, discontiguous, etc + + Vprintf ("\t\t%lld\t%lld-%lld (%lld)\n", runs[j].vcn, runs[j].lcn, runs[j].lcn + runs[j].length - 1, runs[j].length); + //Vprintf ("\t\t%lld\t%lld\t%lld\n", runs[j].vcn, runs[j].lcn, runs[j].length); + //dprint list + + if (a_begin > s_end) { + continue; // after search range (5) + } + if (a_end < s_begin) { + continue; // before search range (1) + } + printf ("inode %d matches\n", i); + break; + } + } + + ntfs_attr_put_search_ctx (ctx); + ctx = NULL; +close: + //printf ("\n"); + ntfs_inode_close (inode); + } +free: + free (buffer); + result = 0; + return result; +} + +/** + * my_locale + */ +int my_locale (void) +{ + const char *locale; + + locale = setlocale (LC_ALL, ""); + if (!locale) { + locale = setlocale (LC_ALL, NULL); + Vprintf ("Failed to set locale, using default '%s'.\n", locale); + return 1; + } else { + Vprintf ("Using locale '%s'.\n", locale); + return 0; + } +} + +/** + * get_vol + */ +ntfs_volume * get_vol (const char *device, unsigned long flags, BOOL force) +{ + ntfs_volume *vol; + + if (!device) + return NULL; + + if (!valid_device (device, force)) + return NULL; + + vol = ntfs_mount (device, MS_RDONLY); + if (!vol) { + Eprintf ("Couldn't mount device '%s': %s\n", device, strerror (errno)); + return NULL; + } + + if (vol->flags & VOLUME_IS_DIRTY) { + Iprintf ("Volume is dirty.\n"); + if (!force) { + Eprintf ("Run chkdsk and try again, or use the --force option.\n"); + ntfs_umount (vol, FALSE); + return NULL; + } + Iprintf ("Forced to continue.\n"); + } + + return vol; +} + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main (int argc, char *argv[]) +{ + ntfs_volume *vol; + int result; + + if (!parse_options (argc, argv)) + return 1; + + my_locale(); + + vol = get_vol (opts.device, MS_RDONLY, opts.force); + if (!vol) + return 1; + +#if 0 + if (opts.info) { + //result = get_info (vol); + } else if (opts.cluster) { + result = cluster_find (vol, opts.cluster); + } else if (opts.sector) { + //result = + } else { + //result = + } +#endif + //opts.cluster_end = LONG_MAX; + printf ("Searching for cluster range %lld-%lld\n", opts.cluster_begin, opts.cluster_end); + result = cluster_find (vol, opts.cluster_begin, opts.cluster_end); + + ntfs_umount (vol, FALSE); + return result; +} + diff --git a/ntfsprogs/ntfscluster.h b/ntfsprogs/ntfscluster.h index e69de29b..f760dfe8 100644 --- a/ntfsprogs/ntfscluster.h +++ b/ntfsprogs/ntfscluster.h @@ -0,0 +1,43 @@ +/* + * ntfscluster - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Richard Russon + * + * This utility will XXX + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFSCLUSTER_H_ +#define _NTFSCLUSTER_H_ + +#include "types.h" + +struct options { + char *device; /* Device/File to work with */ + int info; /* Show volume info */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int force; /* Override common sense */ + u64 sector_begin; /* Look for objects in this range of sectors */ + u64 sector_end; + u64 cluster_begin; /* Look for objects in this range of clusters */ + u64 cluster_end; +}; + +#endif /* _NTFSCLUSTER_H_ */ + + diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index e69de29b..199f2bbc 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -0,0 +1,257 @@ +/** + * utils.c - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Richard Russon + * + * This utility will recover deleted files from an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "config.h" +#include "types.h" +#include "volume.h" +#include "debug.h" + +#define NTFS_TIME_OFFSET ((s64)(369 * 365 + 89) * 24 * 3600 * 10000000) + +/** + * ntfs2utc - Convert an NTFS time to Unix time + * @time: An NTFS time in 100ns units since 1601 + * + * NTFS stores times as the number of 100ns intervals since January 1st 1601 at + * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. + * + * Return: n A Unix time (number of seconds since 1970) + */ +time_t ntfs2utc (s64 time) +{ + return (time - (NTFS_TIME_OFFSET)) / 10000000; +} + +/** + * utc2ntfs - convert Linux time to NTFS time + * @time: Linux time to convert to NTFS + * + * Convert the Linux time @time to its corresponding NTFS time. + * + * Linux stores time in a long at present and measures it as the number of + * 1-second intervals since 1st January 1970, 00:00:00 UTC. + * + * NTFS uses Microsoft's standard time format which is stored in a s64 and is + * measured as the number of 100 nano-second intervals since 1st January 1601, + * 00:00:00 UTC. + * + * Return: n An NTFS time (100ns units since Jan 1601) + */ +s64 utc2ntfs (time_t time) +{ + /* Convert to 100ns intervals and then add the NTFS time offset. */ + return (s64)time * 10000000 + NTFS_TIME_OFFSET; +} + + +/* valid_device requires the following */ +extern int Eprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); +extern int Vprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); + +/** + * valid_device - Perform some safety checks on the device, before we start + * @name: Full pathname of the device/file to work with + * @force: Continue regardless of problems + * + * Check that the name refers to a device and that is isn't already mounted. + * These checks can be overridden by using the force option. + * + * Return: 1 Success, we can continue + * 0 Error, we cannot use this device + */ +int valid_device (const char *name, int force) +{ + unsigned long mnt_flags = 0; + struct stat st; + + if (stat (name, &st) == -1) { + if (errno == ENOENT) { + Eprintf ("The device %s doesn't exist\n", name); + } else { + Eprintf ("Error getting information about %s: %s\n", name, strerror (errno)); + } + return 0; + } + + if (!S_ISBLK (st.st_mode)) { + Vprintf ("%s is not a block device.\n", name); + if (!force) { + Eprintf ("Use the force option to work with files.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + /* Make sure the file system is not mounted. */ + if (ntfs_check_if_mounted (name, &mnt_flags)) { + Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); + if (!force) { + Eprintf ("Use the force option to ignore this error.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } else if (mnt_flags & NTFS_MF_MOUNTED) { + Vprintf ("The device %s, is mounted.\n", name); + if (!force) { + Eprintf ("Use the force option to work a mounted filesystem.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + return 1; +} + +/** + * find_attribute - Find an attribute of the given type + * @type: An attribute type, e.g. AT_FILE_NAME + * @ctx: A search context, created using ntfs_get_attr_search_ctx + * + * Using the search context to keep track, find the first/next occurrence of a + * given attribute type. + * + * N.B. This will return a pointer into @mft. As long as the search context + * has been created without an inode, it won't overflow the buffer. + * + * Return: Pointer Success, an attribute was found + * NULL Error, no matching attributes were found + */ +ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) +{ + if (!ctx) + return NULL; + + if (ntfs_attr_lookup(type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { + Dprintf ("find_attribute didn't find an attribute of type: 0x%02x.\n", type); + return NULL; /* None / no more of that type */ + } + + Dprintf ("find_attribute found an attribute of type: 0x%02x.\n", type); + return ctx->attr; +} + +/** + * find_first_attribute - Find the first attribute of a given type + * @type: An attribute type, e.g. AT_FILE_NAME + * @mft: A buffer containing a raw MFT record + * + * Search through a raw MFT record for an attribute of a given type. + * The return value is a pointer into the MFT record that was supplied. + * + * N.B. This will return a pointer into @mft. The pointer won't stray outside + * the buffer, since we created the search context without an inode. + * + * Return: Pointer Success, an attribute was found + * NULL Error, no matching attributes were found + */ +ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) +{ + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *rec; + + if (!mft) + return NULL; + + ctx = ntfs_attr_get_search_ctx(NULL, mft); + if (!ctx) { + Eprintf ("Couldn't create a search context.\n"); + return NULL; + } + + rec = find_attribute (type, ctx); + ntfs_attr_put_search_ctx(ctx); + if (rec) + Dprintf ("find_first_attribute: found attr of type 0x%02x.\n", type); + else + Dprintf ("find_first_attribute: didn't find attr of type 0x%02x.\n", type); + return rec; +} + + +#if 0 +hamming weight +inline unsigned int hweight32(unsigned int w) +{ + unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); + res = (res & 0x33333333) + ((res >> 2) & 0x33333333); + res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F); + res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF); + return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF); +} + +inline unsigned int hweight16(unsigned int w) +{ + unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555); + res = (res & 0x3333) + ((res >> 2) & 0x3333); + res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F); + return (res & 0x00FF) + ((res >> 8) & 0x00FF); +} + +inline unsigned int hweight8(unsigned int w) +{ + unsigned int res = (w & 0x55) + ((w >> 1) & 0x55); + res = (res & 0x33) + ((res >> 2) & 0x33); + return (res & 0x0F) + ((res >> 4) & 0x0F); +} + +inline int set_bit(int nr,long * addr) +{ + int mask, retval; + + addr += nr >> 5; + mask = 1 << (nr & 0x1f); + retval = (mask & *addr) != 0; + *addr |= mask; + return retval; +} + +inline int clear_bit(int nr, long * addr) +{ + int mask, retval; + + addr += nr >> 5; + mask = 1 << (nr & 0x1f); + retval = (mask & *addr) != 0; + *addr &= ~mask; + return retval; +} + +inline int test_bit(int nr, long * addr) +{ + int mask; + + addr += nr >> 5; + mask = 1 << (nr & 0x1f); + return ((mask & *addr) != 0); +} + +#endif + diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index e69de29b..9b051fc6 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -0,0 +1,63 @@ +/* + * utils.c - Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Richard Russon + * + * This utility will recover deleted files from an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_UTILS_H_ +#define _NTFS_UTILS_H_ + +#include "types.h" +#include "layout.h" + +#define GEN_PRINTF(NAME, STREAM, CONTROL, TRIGGER) \ + __attribute__ ((format (printf, 1, 2))) \ + int NAME (const char *format, ...) \ + { \ + int ret, olderr = errno, *control = (CONTROL); \ + va_list args; \ + \ + if (!(STREAM)) \ + return -1; \ + if (control && \ + ((*control && !(TRIGGER)) || (!*control && (TRIGGER)))) \ + return -1; \ + \ + va_start (args, format); \ + ret = vfprintf ((STREAM), format, args); \ + va_end (args); \ + errno = olderr; \ + return ret; \ + } + +struct _IO_FILE; + +int ntfs_printf (struct _IO_FILE *stream, int *control, BOOL trigger, + const char *format, ...) __attribute__ ((format (printf, 4, 5))); + +int valid_device (const char *name, int force); + +time_t ntfs2utc (s64 time); +s64 utc2ntfs (time_t time); + +ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); +ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft); + +#endif /* _NTFS_UTILS_H_ */ From 9597186a6b923bd36d7cb87e114f234aaab2dd20 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 01:42:21 +0000 Subject: [PATCH 0353/2994] a bit of code added, some moved out into utils (Logical change 1.80) --- ntfsprogs/ntfswipe.c | 388 ++++++++++++++++++++++++++++--------------- 1 file changed, 252 insertions(+), 136 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index f35decdc..f98a51e2 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -25,64 +25,26 @@ #include #include -#include -#include -#include #include #include #include #include #include #include +#include #include "ntfswipe.h" #include "types.h" #include "volume.h" +#include "utils.h" static const char *AUTHOR = "Richard Russon (FlatCap)"; static const char *EXEC_NAME = "ntfswipe"; static struct options opts; -/** - * Eprintf - Print error messages - */ -void Eprintf (const char *format, ...) -{ - va_list va; - va_start (va, format); - vfprintf (stderr, format, va); - va_end (va); -} - -/** - * Iprintf - Print informative messages - */ -void Iprintf (const char *format, ...) -{ - va_list va; -#ifndef DEBUG - if (opts.quiet) - return; -#endif - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -} - -/** - * Vprintf - Print verbose messages - */ -void Vprintf (const char *format, ...) -{ - va_list va; -#ifndef DEBUG - if (!opts.verbose) - return; -#endif - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -} +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF (Iprintf, stdout, &opts.quiet, FALSE) /** * Dprintf - Print debug messages @@ -109,7 +71,7 @@ void Dprintf (const char *format, ...) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -int wipe_unused (ntfs_volume *vol, int byte) +int wipe_unused (ntfs_volume *vol, int byte, enum action act) { if (!vol || (byte < 0)) return 0; @@ -129,7 +91,7 @@ int wipe_unused (ntfs_volume *vol, int byte) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -int wipe_tails (ntfs_volume *vol, int byte) +int wipe_tails (ntfs_volume *vol, int byte, enum action act) { if (!vol || (byte < 0)) return 0; @@ -149,7 +111,7 @@ int wipe_tails (ntfs_volume *vol, int byte) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -int wipe_mft (ntfs_volume *vol, int byte) +int wipe_mft (ntfs_volume *vol, int byte, enum action act) { if (!vol || (byte < 0)) return 0; @@ -159,7 +121,7 @@ int wipe_mft (ntfs_volume *vol, int byte) } /** - * wipe_directory - Wipe the directiry indexes + * wipe_directory - Wipe the directory indexes * @vol: An ntfs volume obtained from ntfs_mount * @byte: Overwrite with this value * @@ -169,7 +131,7 @@ int wipe_mft (ntfs_volume *vol, int byte) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -int wipe_directory (ntfs_volume *vol, int byte) +int wipe_directory (ntfs_volume *vol, int byte, enum action act) { if (!vol || (byte < 0)) return 0; @@ -189,7 +151,7 @@ int wipe_directory (ntfs_volume *vol, int byte) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -int wipe_logfile (ntfs_volume *vol, int byte) +int wipe_logfile (ntfs_volume *vol, int byte, enum action act) { if (!vol || (byte < 0)) return 0; @@ -209,7 +171,7 @@ int wipe_logfile (ntfs_volume *vol, int byte) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -int wipe_pagefile (ntfs_volume *vol, int byte) +int wipe_pagefile (ntfs_volume *vol, int byte, enum action act) { if (!vol || (byte < 0)) return 0; @@ -218,6 +180,7 @@ int wipe_pagefile (ntfs_volume *vol, int byte) return 1; } + /** * ntfs_info - Display information about the NTFS Volume * @vol: An ntfs volume obtained from ntfs_mount @@ -230,10 +193,166 @@ int wipe_pagefile (ntfs_volume *vol, int byte) */ int ntfs_info (ntfs_volume *vol) { + u8 *buffer; + if (!vol) return 0; Iprintf ("ntfs_info\n"); + + Iprintf ("\n"); + + Iprintf ("Cluster size = %u\n", vol->cluster_size); + Iprintf ("Volume size = %lld clusters\n", vol->nr_clusters); + Iprintf ("Volume size = %lld bytes\n", vol->nr_clusters * vol->cluster_size); + Iprintf ("Volume size = %lld MiB\n", vol->nr_clusters * vol->cluster_size / (1024*1024)); /* round up? */ + + Iprintf ("\n"); + + // move back bufsize + buffer = malloc (vol->mft_record_size); + if (!buffer) + return 0; + + Iprintf ("cluster\n"); + //Iprintf ("allocated_size = %lld\n", vol->lcnbmp_na->allocated_size); + Iprintf ("data_size = %lld\n", vol->lcnbmp_na->data_size); + //Iprintf ("initialized_size = %lld\n", vol->lcnbmp_na->initialized_size); + + { + u64 offset; + u64 size = vol->lcnbmp_na->allocated_size; + int bufsize = vol->mft_record_size; + u64 use = 0; + u64 not = 0; + int i, j; + + for (offset = 0; offset < size; offset += bufsize) { + + if ((offset + bufsize) > size) + bufsize = size - offset; + + if (ntfs_attr_pread (vol->lcnbmp_na, offset, bufsize, buffer) < bufsize) { + Eprintf ("error\n"); + return 0; + } + + for (i = 0; i < bufsize; i++) { + for (j = 0; j < 8; j++) { + if ((((offset+i)*8) + j) >= vol->nr_clusters) + goto done; + if (buffer[i] & (1 << j)) { + //printf ("*"); + use++; + } else { + //printf ("."); + not++; + } + } + } + } +done: + + Iprintf ("cluster use %lld, not %lld, total %lld\n", use, not, use+not); + Iprintf ("\n"); + + } + + { + u8 *bitmap; + u64 bmpoff; + u64 bmpsize = vol->mftbmp_na->data_size; + int bmpbufsize = 512; + int i, j; + u64 use = 0, not = 0; + + bitmap = malloc (bmpbufsize); + if (!bitmap) + return 0; + + printf ("mft has %lld records\n", vol->nr_mft_records); + + //Iprintf ("allocated_size = %lld\n", vol->mftbmp_na->allocated_size); + Iprintf ("data_size = %lld\n", vol->mftbmp_na->data_size); + //Iprintf ("initialized_size = %lld\n", vol->mftbmp_na->initialized_size); + + printf ("bmpsize = %lld\n", bmpsize); + for (bmpoff = 0; bmpoff < bmpsize; bmpoff += bmpbufsize) { + if ((bmpoff + bmpbufsize) > bmpsize) + bmpbufsize = bmpsize - bmpoff; + + //printf ("bmpbufsize = %d\n", bmpbufsize); + + if (ntfs_attr_pread (vol->mftbmp_na, bmpoff, bmpbufsize, bitmap) < bmpbufsize) { + Eprintf ("error\n"); + return 0; + } + + for (i = 0; i < bmpbufsize; i++) { + for (j = 0; j < 8; j++) { + if ((((bmpoff+i)*8) + j) >= vol->nr_mft_records) + goto bmpdone; + if (bitmap[i] & (1 << j)) { + //printf ("*"); + use++; + } else { + //printf ("."); + not++; + } + } + } + } + +bmpdone: + printf ("mft\n"); + printf ("use %lld, not %lld, total %lld\n", use, not, use+not); + + free (bitmap); + } + + + /* + * wipe_unused - volume = n clusters, u unused (%age & MB) + * $Bitmap + * vol->lcnbmp_na + * + * wipe_tails - volume = n files, total tail slack space + * $MFT, $DATA + * vol->mft_na + * + * wipe_mft - volume = n mft records, u unused, s total slack space + * $MFT, $BITMAP + * vol->mftbmp_na + * + * wipe_directory - volume has d dirs, t total slack space + * $MFT, $INDEX_ROOT, $INDEX_ALLOC, $BITMAP + * + * wipe_logfile - logfile is + * $MFT, $DATA + * + * wipe_pagefile - pagefile is + * $MFT, $DATA + */ + + free (buffer); +#if 0 + ntfs_inode *inode; + ntfs_attr *attr; + + inode = ntfs_inode_open (vol, 6); /* $Bitmap */ + if (!inode) + return 0; + + attr = ntfs_attr_open (inode, AT_DATA, NULL, 0); + if (!attr) + return 0; + + ntfs_attr_pread + + ntfs_attr_close (attr); + ntfs_inode_close (inode); +#endif + return 1; } @@ -409,6 +528,8 @@ int parse_options (int argc, char *argv[]) } break; + case 'i': + opts.info++; /* and fall through */ case 'a': opts.directory++; opts.logfile++; @@ -444,9 +565,6 @@ int parse_options (int argc, char *argv[]) case 'h': help++; break; - case 'i': - opts.info++; - break; case 'l': opts.logfile++; break; @@ -493,32 +611,32 @@ int parse_options (int argc, char *argv[]) err++; } - if ((opts.quiet) && (opts.verbose)) { + if (opts.quiet && opts.verbose) { Eprintf ("You may not use --quiet and --verbose at the same time.\n"); err++; } + /* if (opts.info && (opts.unused || opts.tails || opts.mft || opts.directory)) { Eprintf ("You may not use any other options with --info.\n"); err++; } + */ if ((opts.count < 1) || (opts.count > 100)) { Eprintf ("The iteration count must be between 1 and 100.\n"); err++; } - /*if (opts.bytes && (opts.count > 0)) { - Eprintf ("You may not use both --bytes and --count.\n"); - err++; - }*/ - /* Create a default list */ if (!opts.bytes) { opts.bytes = malloc (2 * sizeof (int)); if (opts.bytes) { opts.bytes[0] = 0; opts.bytes[1] = -1; + } else { + Eprintf ("Couldn't allocate memory for byte list.\n"); + err++; } } @@ -536,64 +654,9 @@ int parse_options (int argc, char *argv[]) return (!err && !help && !ver); } -/** - * valid_device - Perform some safety checks on the device, before we start - * @name: Full pathname of the device/file to work with - * @force: Continue regardless of problems - * - * Check that the name refers to a device and that is isn't already mounted. - * These checks can be overridden by using the force option. - * - * Return: 1 Success, we can continue - * 0 Error, we cannot use this device - */ -int valid_device (const char *name, int force) -{ - unsigned long mnt_flags = 0; - struct stat st; - - if (stat (name, &st) == -1) { - if (errno == ENOENT) { - Eprintf ("The device %s doesn't exist\n", name); - } else { - Eprintf ("Error getting information about %s: %s\n", name, strerror (errno)); - } - return 0; - } - - if (!S_ISBLK (st.st_mode)) { - Vprintf ("%s is not a block device.\n", name); - if (!force) { - Eprintf ("Use the force option to work with files.\n"); - return 0; - } - Vprintf ("Forced to continue.\n"); - } - - /* Make sure the file system is not mounted. */ - if (ntfs_check_if_mounted (name, &mnt_flags)) { - Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); - if (!force) { - Eprintf ("Use the force option to ignore this error.\n"); - return 0; - } - Vprintf ("Forced to continue.\n"); - } else if (mnt_flags & NTFS_MF_MOUNTED) { - Vprintf ("The device %s, is mounted.\n", name); - if (!force) { - Eprintf ("Use the force option to work a mounted filesystem.\n"); - return 0; - } - Vprintf ("Forced to continue.\n"); - } - - Dprintf ("Device %s, will be used\n", name); - return 1; -} - /** - * print_summary - Tell the use what we are about to do + * print_summary - Tell the user what we are about to do * * List the operations about to be performed. The output will be silenced by * the --quiet option. @@ -649,6 +712,7 @@ int main (int argc, char *argv[]) int result = 1; int flags = 0; int i, j; + enum action act = act_info; locale = setlocale (LC_ALL, ""); if (!locale) { @@ -661,9 +725,8 @@ int main (int argc, char *argv[]) if (!parse_options (argc, argv)) return 1; - if (!valid_device (opts.device, opts.force)) { + if (!valid_device (opts.device, opts.force)) goto free; - } if (!opts.info) print_summary(); @@ -686,37 +749,90 @@ int main (int argc, char *argv[]) } if (opts.info) { - ntfs_info (vol); - result = 0; - goto umount; + act = act_info; + opts.count = 1; + } else if (opts.noaction) { + act = act_test; + } else { + act = act_wipe; } /* Even if the output it quieted, you still get 5 seconds to abort. */ - if (!opts.force) { + if ((act == act_wipe) && !opts.force) { Iprintf ("\n%s will begin in 5 seconds, press CTRL-C to abort.\n", EXEC_NAME); sleep (5); } - if (!opts.bytes) { - Eprintf ("Internal error, byte list is empty\n"); - goto umount; + if (0) + { + printf ("________________________________________________________________________________\n\n"); + int i = 0; + runlist_element *rl = vol->mft_na->rl; + for (; rl->length > 0; rl++, i++) { + printf ("%4d %lld,%lld,%lld\n", i, rl->vcn, rl->lcn, rl->length); + } + printf ("%4d %lld,%lld,%lld\n", i, rl->vcn, rl->lcn, rl->length); + return 0; } + printf ("\n"); for (i = 0; i < opts.count; i++) { int byte; + s64 total = 0; + s64 wiped = 0; + for (j = 0; byte = opts.bytes[j], byte >= 0; j++) { - if (opts.unused && !wipe_unused (vol, byte)) - goto umount; - if (opts.tails && !wipe_tails (vol, byte)) - goto umount; - if (opts.mft && !wipe_mft (vol, byte)) - goto umount; - if (opts.directory && !wipe_directory (vol, byte)) - goto umount; - if (opts.logfile && !wipe_logfile (vol, byte)) - goto umount; - if (opts.pagefile && !wipe_pagefile (vol, byte)) - goto umount; + + if (opts.directory) { + wiped = wipe_directory (vol, byte, act); + if (wiped < 0) + goto umount; + else + total += wiped; + } + + if (opts.tails) { + wiped = wipe_tails (vol, byte, act); + if (wiped < 0) + goto umount; + else + total += wiped; + } + + if (opts.logfile) { + wiped = wipe_logfile (vol, byte, act); + if (wiped < 0) + goto umount; + else + total += wiped; + } + + if (opts.mft) { + wiped = wipe_mft (vol, byte, act); + if (wiped < 0) + goto umount; + else + total += wiped; + } + + if (opts.pagefile) { + wiped = wipe_pagefile (vol, byte, act); + if (wiped < 0) + goto umount; + else + total += wiped; + } + + if (opts.unused) { + wiped = wipe_unused (vol, byte, act); + if (wiped < 0) + goto umount; + else + total += wiped; + } + + if (act == act_info) + break; } } From 679206550b365c44f43976ff11c1380fdbd3c742 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 01:42:21 +0000 Subject: [PATCH 0354/2994] add -Wall to normal build (not just debug) (Logical change 1.80) --- libntfs/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index bd5c41c4..dac13aec 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -29,9 +29,9 @@ LTVERSION = 4:0:0 # Need this to enable 64-bit (device) file access functions and parameters. if DEBUG -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG else -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall endif linux_ntfsincludedir = -I$(top_srcdir)/include From e7dd03f9a4dac4215da31e59b9af7a59b5623e78 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 01:42:21 +0000 Subject: [PATCH 0355/2994] add -Wall to normal build (not just debug) add new files to build (Logical change 1.80) --- ntfsprogs/Makefile.am | 13 +++++--- ntfsprogs/Makefile.in | 72 ++++++++++++++++++++++++++----------------- 2 files changed, 52 insertions(+), 33 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 547be2b2..5d750aab 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -1,8 +1,8 @@ # Need this to enable 64-bit (device) file access functions and parameters. if DEBUG -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG else -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall endif if REALLYSTATIC @@ -20,7 +20,7 @@ LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfscluster man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 @@ -59,11 +59,15 @@ ntfsresize_LDFLAGS = $(AM_LFLAGS) # We don't distribute these +ntfscluster_SOURCES = ntfscluster.c ntfscluster.h utils.c utils.h +ntfscluster_LDADD = $(AM_LIBS) +ntfscluster_LDFLAGS = $(AM_LFLAGS) + ntfstruncate_SOURCES = attrdef.c ntfstruncate.c ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) -ntfswipe_SOURCES = ntfswipe.c ntfswipe.h +ntfswipe_SOURCES = ntfswipe.c ntfswipe.h utils.c utils.h ntfswipe_LDADD = $(AM_LIBS) ntfswipe_LDFLAGS = $(AM_LFLAGS) @@ -79,3 +83,4 @@ dumplog_LDFLAGS = $(AM_LFLAGS) strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) $(STRIP) $^ + diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index fd754d5b..a442f7e7 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -88,8 +88,8 @@ STRIP = @STRIP@ VERSION = @VERSION@ all_includes = @all_includes@ all_libraries = @all_libraries@ -@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall -@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 +@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG +@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 -Wall @REALLYSTATIC_TRUE@AM_LIBS = @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LFLAGS = @REALLYSTATIC_TRUE@-static @@ -102,7 +102,7 @@ LINK = $(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfscluster man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 @@ -142,11 +142,15 @@ ntfsresize_LDFLAGS = $(AM_LFLAGS) # We don't distribute these +ntfscluster_SOURCES = ntfscluster.c ntfscluster.h utils.c utils.h +ntfscluster_LDADD = $(AM_LIBS) +ntfscluster_LDFLAGS = $(AM_LFLAGS) + ntfstruncate_SOURCES = attrdef.c ntfstruncate.c ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) -ntfswipe_SOURCES = ntfswipe.c ntfswipe.h +ntfswipe_SOURCES = ntfswipe.c ntfswipe.h utils.c utils.h ntfswipe_LDADD = $(AM_LIBS) ntfswipe_LDFLAGS = $(AM_LFLAGS) @@ -170,56 +174,61 @@ PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) -I.. LIBS = @LIBS@ ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@ntfsdump_logfile_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -dumplog_OBJECTS = dumplog.$(OBJEXT) -@REALLYSTATIC_FALSE@dumplog_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +dumplog_OBJECTS = dumplog.$(OBJEXT) @REALLYSTATIC_TRUE@dumplog_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@dumplog_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfstruncate_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) @REALLYSTATIC_TRUE@ntfstruncate_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfstruncate_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) utils.$(OBJEXT) +@REALLYSTATIC_TRUE@ntfscluster_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfscluster_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) @REALLYSTATIC_TRUE@ntfsfix_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) @REALLYSTATIC_TRUE@ntfsinfo_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ sd.$(OBJEXT) mkntfs.$(OBJEXT) -@REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) @REALLYSTATIC_TRUE@ntfslabel_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) @REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) @REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -237,11 +246,12 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = gtar GZIP_ENV = --best DEP_FILES = .deps/attrdef.P .deps/boot.P .deps/dumplog.P .deps/mkntfs.P \ -.deps/ntfsdump_logfile.P .deps/ntfsfix.P .deps/ntfsinfo.P \ -.deps/ntfslabel.P .deps/ntfsresize.P .deps/ntfstruncate.P \ -.deps/ntfsundelete.P .deps/ntfswipe.P .deps/sd.P .deps/upcase.P -SOURCES = $(ntfsdump_logfile_SOURCES) $(dumplog_SOURCES) $(ntfswipe_SOURCES) $(ntfstruncate_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(ntfsundelete_SOURCES) $(ntfsresize_SOURCES) -OBJECTS = $(ntfsdump_logfile_OBJECTS) $(dumplog_OBJECTS) $(ntfswipe_OBJECTS) $(ntfstruncate_OBJECTS) $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(ntfsundelete_OBJECTS) $(ntfsresize_OBJECTS) +.deps/ntfscluster.P .deps/ntfsdump_logfile.P .deps/ntfsfix.P \ +.deps/ntfsinfo.P .deps/ntfslabel.P .deps/ntfsresize.P \ +.deps/ntfstruncate.P .deps/ntfsundelete.P .deps/ntfswipe.P .deps/sd.P \ +.deps/upcase.P .deps/utils.P +SOURCES = $(ntfsdump_logfile_SOURCES) $(dumplog_SOURCES) $(ntfswipe_SOURCES) $(ntfstruncate_SOURCES) $(ntfscluster_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(ntfsundelete_SOURCES) $(ntfsresize_SOURCES) +OBJECTS = $(ntfsdump_logfile_OBJECTS) $(dumplog_OBJECTS) $(ntfswipe_OBJECTS) $(ntfstruncate_OBJECTS) $(ntfscluster_OBJECTS) $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(ntfsundelete_OBJECTS) $(ntfsresize_OBJECTS) all: all-redirect .SUFFIXES: @@ -372,6 +382,10 @@ ntfstruncate$(EXEEXT): $(ntfstruncate_OBJECTS) $(ntfstruncate_DEPENDENCIES) @rm -f ntfstruncate$(EXEEXT) $(LINK) $(ntfstruncate_LDFLAGS) $(ntfstruncate_OBJECTS) $(ntfstruncate_LDADD) $(LIBS) +ntfscluster$(EXEEXT): $(ntfscluster_OBJECTS) $(ntfscluster_DEPENDENCIES) + @rm -f ntfscluster$(EXEEXT) + $(LINK) $(ntfscluster_LDFLAGS) $(ntfscluster_OBJECTS) $(ntfscluster_LDADD) $(LIBS) + ntfsfix$(EXEEXT): $(ntfsfix_OBJECTS) $(ntfsfix_DEPENDENCIES) @rm -f ntfsfix$(EXEEXT) $(LINK) $(ntfsfix_LDFLAGS) $(ntfsfix_OBJECTS) $(ntfsfix_LDADD) $(LIBS) From 064da66ee45ca225867035637ca3364cc36d36a0 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 01:42:21 +0000 Subject: [PATCH 0356/2994] ideas for undelete (Logical change 1.80) --- TODO.ntfsprogs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 38a8cd60..857dbe87 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -67,8 +67,10 @@ Low priority * ntfsundelete * **************** +- undelete by name rather than inode number - support for compressed files - support for internationalisation - recover by type? - +- display parent directory +- name "" to MFTn From 6862599a670b930a1908fa9c646a52d78a4b9158 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 01:42:21 +0000 Subject: [PATCH 0357/2994] minor typos (Logical change 1.80) --- ntfsprogs/ntfsundelete.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 3042db90..fdd32975 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -161,8 +161,8 @@ void usage (void) " -f --force Use less caution\n" " -q --quiet Less output\n" " -v --verbose More output\n" - " -V --version Version information\n" - " -h --help Print this help\n\n", + " -V --version Display version information\n" + " -h --help Display this help\n\n", EXEC_NAME); Iprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); } @@ -1029,7 +1029,7 @@ struct ufile * read_record (ntfs_volume *vol, long long record) * @lcn: The Logical Cluster Number to test * * The metadata file $Bitmap has one binary bit representing each cluster on - * disk. The bit will be set of each cluster that is in use. The function + * disk. The bit will be set for each cluster that is in use. The function * reads the relevant part of $Bitmap into a buffer and tests the bit. * * This function has a static buffer in which it caches a section of $Bitmap. @@ -1056,7 +1056,7 @@ int cluster_in_use (ntfs_volume *vol, long long lcn) Dprintf ("Bit lies outside cache.\n"); attr = ntfs_attr_open (vol->lcnbmp_ni, AT_DATA, NULL, 0); if (!attr) { - Eprintf ("Couldn't open $MFT/$BITMAP: %s\n", strerror (errno)); + Eprintf ("Couldn't open $Bitmap: %s\n", strerror (errno)); return -1; } @@ -1065,7 +1065,7 @@ int cluster_in_use (ntfs_volume *vol, long long lcn) bmplcn = lcn & (~((sizeof (buffer) << 3) - 1)); if (ntfs_attr_pread (attr, (bmplcn>>3), sizeof (buffer), buffer) < 0) { - Eprintf ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno)); + Eprintf ("Couldn't read $Bitmap: %s\n", strerror (errno)); ntfs_attr_close (attr); return -1; } From 87213d0c1ce8f8aa13267a50d12100ad42b7735e Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 01:42:21 +0000 Subject: [PATCH 0358/2994] new: ntfscluster.[ch] locate the owner of a given cluster this is just a quick hack, but quite a few bits should be reusable new: utils.[ch] a first attempt to move some common routines into a shared place some should end up in the lib, others shouldn't build updated with the above code added to wipe a few typos here and there BKrev: 3e1cd37dx5Kmw9Eu-qzPoQIf9i1XuQ From e860ea0ed4a393cf18fceb52117b19ac09174185 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 01:42:21 +0000 Subject: [PATCH 0359/2994] three modes (Logical change 1.80) --- ntfsprogs/ntfswipe.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ntfsprogs/ntfswipe.h b/ntfsprogs/ntfswipe.h index f06358c2..2546c7fb 100644 --- a/ntfsprogs/ntfswipe.h +++ b/ntfsprogs/ntfswipe.h @@ -26,6 +26,12 @@ #include "types.h" +enum action { + act_info, + act_test, + act_wipe, +}; + struct options { char *device; /* Device/File to work with */ int info; /* Show volume info */ From 13e52bbfbf093802ada3dbff2d60d9b20d157be3 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 02:22:03 +0000 Subject: [PATCH 0360/2994] horrendous regex to identify gcc 3.* (Logical change 1.81) --- configure | 6 +++--- configure.in | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configure b/configure index e8bc5212..618d133a 100755 --- a/configure +++ b/configure @@ -5712,9 +5712,9 @@ fi echo $ac_n "checking version of $_cc""... $ac_c" 1>&6 echo "configure:5715: checking version of $_cc" >&5 -cc_version=`$_cc --version 2>&1` -cc_major=`echo $cc_version | sed 's/egcs-//' | cut -d'.' -f1` -cc_minor=`echo $cc_version | sed 's/egcs-//' | cut -d'.' -f2` +cc_version=`$_cc --version 2>&1 | head -1 | sed 's/egcs-//' | sed 's/gcc (GCC) \([0-9]\.[0-9]\).*/\1/'` +cc_major=`echo $cc_version | cut -d'.' -f1` +cc_minor=`echo $cc_version | cut -d'.' -f2` if test -z $cc_version; then cc_version="v. ?.??" cc_major=1 diff --git a/configure.in b/configure.in index 8a893c21..fd5b1371 100644 --- a/configure.in +++ b/configure.in @@ -79,9 +79,9 @@ fi dnl Check for gcc version being >= 2.96. AC_MSG_CHECKING(version of $_cc) -cc_version=`$_cc --version 2>&1` -cc_major=`echo $cc_version | sed 's/egcs-//' | cut -d'.' -f1` -cc_minor=`echo $cc_version | sed 's/egcs-//' | cut -d'.' -f2` +cc_version=`$_cc --version 2>&1 | head -1 | sed 's/egcs-//' | sed 's/gcc (GCC) \([0-9]\.[0-9]\).*/\1/'` +cc_major=`echo $cc_version | cut -d'.' -f1` +cc_minor=`echo $cc_version | cut -d'.' -f2` if test -z $cc_version; then cc_version="v. ?.??" cc_major=1 From b1548158c803ee577324d4a600ca3454c4b7d27a Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 02:22:03 +0000 Subject: [PATCH 0361/2994] update configure script so it doesn't baulk at gcc 3.* BKrev: 3e1cdccbPDPWhHlsndqJup2fKlyaEQ From 4a763bc970bc59757268195c17364fe463fa55f8 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 16:30:59 +0000 Subject: [PATCH 0362/2994] a typos left over from the big rename (Logical change 1.82) --- libntfs/mst.c | 2 +- libntfs/unistr.c | 6 +++--- ntfsprogs/mkntfs.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libntfs/mst.c b/libntfs/mst.c index d6e0f34e..c63a3fad 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -175,7 +175,7 @@ int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size) * * Perform the necessary post write multi sector transfer fixup, not checking * for any errors, because we assume we have just used - * ntfs_pre_write_mst_fixup(), thus the data will be fine or we would never + * ntfs_mst_pre_write_fixup(), thus the data will be fine or we would never * have gotten here. */ void ntfs_mst_post_write_fixup(NTFS_RECORD *b) diff --git a/libntfs/unistr.c b/libntfs/unistr.c index b7f0d014..848d9f9d 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -112,7 +112,7 @@ int ntfs_names_collate(const uchar_t *name1, const u32 name1_len, #ifdef DEBUG if (!name1 || !name2 || (ic && !upcase && upcase_len)) { - Dputs("ntfs_collate_names received NULL pointer!"); + Dputs("ntfs_names_collate received NULL pointer!"); exit(1); } #endif @@ -267,7 +267,7 @@ void ntfs_name_upcase(uchar_t *name, u32 name_len, const uchar_t *upcase, /** * ntfs_file_value_upcase */ -void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr, +void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, const uchar_t *upcase, const u32 upcase_len) { ntfs_name_upcase((uchar_t*)&file_name_attr->file_name, @@ -277,7 +277,7 @@ void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr, /** * ntfs_file_values_compare */ -int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1, +int ntfs_file_values_compare(FILE_NAME_ATTR *file_name_attr1, FILE_NAME_ATTR *file_name_attr2, const int err_val, const IGNORE_CASE_BOOL ic, const uchar_t *upcase, const u32 upcase_len) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index f7fa7a14..fa8363fa 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2100,7 +2100,7 @@ int insert_file_link_in_dir_index(INDEX_BLOCK *index, MFT_REF file_ref, } #endif */ - i = ntfs_file_compare_values(file_name, + i = ntfs_file_values_compare(file_name, (FILE_NAME_ATTR*)&ie->key.file_name, 1, IGNORE_CASE, vol->upcase, vol->upcase_len); /* @@ -2124,7 +2124,7 @@ int insert_file_link_in_dir_index(INDEX_BLOCK *index, MFT_REF file_ref, if (file_name->file_name_type != FILE_NAME_POSIX || ie->key.file_name.file_name_type != FILE_NAME_POSIX) return -EEXIST; - i = ntfs_file_compare_values(file_name, + i = ntfs_file_values_compare(file_name, (FILE_NAME_ATTR*)&ie->key.file_name, 1, CASE_SENSITIVE, vol->upcase, vol->upcase_len); if (i == -1) From 953ac4ff8673009739596f30094209faf2892e1f Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 16:30:59 +0000 Subject: [PATCH 0363/2994] sync with Paul (Logical change 1.82) --- libntfs/attrib.c | 2 ++ libntfs/inode.c | 2 ++ libntfs/mft.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 14534052..35e9a8a1 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -25,6 +25,8 @@ #include #include +#include "compat.h" + #include "attrib.h" #include "disk_io.h" #include "mft.h" diff --git a/libntfs/inode.c b/libntfs/inode.c index 056279f0..c74268e5 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -23,6 +23,8 @@ #include #include +#include "compat.h" + #include "types.h" #include "inode.h" #include "debug.h" diff --git a/libntfs/mft.c b/libntfs/mft.c index a8aba64b..28f2646e 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -24,6 +24,8 @@ #include #include +#include "compat.h" + #include "types.h" #include "disk_io.h" #include "debug.h" From 3d4f80ae165bd3e18680b7f7e2a1945ecb361171 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 16:30:59 +0000 Subject: [PATCH 0364/2994] sync with Paul a typos left over from the big rename (Logical change 1.82) --- libntfs/bootsect.c | 4 +++- libntfs/runlist.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index 900c4615..e8b76cdb 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -24,6 +24,8 @@ #include #include +#include "compat.h" + #include "bootsect.h" #include "debug.h" @@ -190,7 +192,7 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) /* * The bounds checks on mft_lcn and mft_mirr_lcn (i.e. them being * below or equal the number_of_clusters) really belong in the - * is_boot_sector_ntfs but in this way we can just do this once. + * ntfs_boot_sector_is_ntfs but in this way we can just do this once. */ sectors_per_cluster = bs->bpb.sectors_per_cluster; Dprintf("NumberOfSectors = %Li\n", sle64_to_cpu(bs->number_of_sectors)); diff --git a/libntfs/runlist.c b/libntfs/runlist.c index b5c02faa..bfd01a5a 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -25,6 +25,8 @@ #include #include +#include "compat.h" + #include "types.h" #include "attrib.h" #include "volume.h" @@ -534,7 +536,7 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, /* Can't have an entirely unmapped source runlist. */ if (!srl[si].length) { - Dputs("Eeek! ntfs_merge_runlists() received entirely " + Dputs("Eeek! ntfs_runlists_merge() received entirely " "unmapped source runlist."); errno = EINVAL; return NULL; From 46d927b4ecafebef5c3bec65a6cc782fc02c38a9 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 16:30:59 +0000 Subject: [PATCH 0365/2994] sync with Paul a typos left over from the big rename BKrev: 3e1da3c3wikzRxWjs9S3xGqil8JTeg From 96f8b84e55f26af962492ae116371c985d83ebf2 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 16:30:59 +0000 Subject: [PATCH 0366/2994] tidy (Logical change 1.82) --- ntfsprogs/upcase.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c index a184379a..c18a2bd3 100644 --- a/ntfsprogs/upcase.c +++ b/ntfsprogs/upcase.c @@ -1,5 +1,5 @@ -/* - * $Id$ +/** + * upcase - Part of the Linux-NTFS project. * * Copyright (c) 2001 Richard Russon * Copyright (c) 2001-2002 Anton Altaparmakov From 4e5b613d9c866d96a6780d0021b048e646e4fdcc Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 16:39:56 +0000 Subject: [PATCH 0367/2994] missed two (Logical change 1.83) --- include/unistr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/unistr.h b/include/unistr.h index 7b1c45a6..7b7a5ea8 100644 --- a/include/unistr.h +++ b/include/unistr.h @@ -47,10 +47,10 @@ extern u32 ntfs_ucsnlen(const uchar_t *s, u32 maxlen); extern void ntfs_name_upcase(uchar_t *name, u32 name_len, const uchar_t *upcase, const u32 upcase_len); -extern void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr, +extern void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, const uchar_t *upcase, const u32 upcase_len); -extern int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1, +extern int ntfs_file_values_compare(FILE_NAME_ATTR *file_name_attr1, FILE_NAME_ATTR *file_name_attr2, const int err_val, const IGNORE_CASE_BOOL ic, const uchar_t *upcase, const u32 upcase_len); From f1b764576ccc43fad8c16c34838d15b2e33b064e Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 9 Jan 2003 16:39:56 +0000 Subject: [PATCH 0368/2994] missed two BKrev: 3e1da5dco-a9nzmDWlhX5zcAHwR2Mg From 7f2d90a353051d88a1de93e0e05257cebc796360 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 10 Jan 2003 01:04:24 +0000 Subject: [PATCH 0369/2994] ignore ntfscluster ignore tag files (Logical change 1.84) --- BitKeeper/etc/ignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 9cd72d96..5cc2a661 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -19,10 +19,15 @@ linux-ntfs.spec */.libs/* */*.o libntfs/*.l? +tags +TAGS +*/tags +*/TAGS # specific programs ntfsprogs/dumplog ntfsprogs/mkntfs +ntfsprogs/ntfscluster ntfsprogs/ntfsdump_logfile ntfsprogs/ntfsfix ntfsprogs/ntfsinfo From 03b74b6a01426e63d8d906646fd32068aaeef7e9 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 10 Jan 2003 01:04:24 +0000 Subject: [PATCH 0370/2994] ignore ntfscluster ignore tag files BKrev: 3e1e1c18EopU12fiYa5fLNGVXCU1Ag From 9a1bb807215a23e9d1fc68ebcd09347e5c999400 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 10 Jan 2003 01:06:19 +0000 Subject: [PATCH 0371/2994] a bit of code some shuffling of code BKrev: 3e1e1c8bpIzJngp3Ne3F39aUyYuISg From bf6cff53f5466e938090b9fea39156d9037e76a9 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 10 Jan 2003 01:06:19 +0000 Subject: [PATCH 0372/2994] more general purpose functions (Logical change 1.85) --- ntfsprogs/utils.c | 249 ++++++++++++++++++++++++++++++++++++++-------- ntfsprogs/utils.h | 6 +- 2 files changed, 215 insertions(+), 40 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 199f2bbc..c0b10abe 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -28,6 +28,10 @@ #include #include #include +#include +#include +#include +#include #include "config.h" #include "types.h" @@ -36,48 +40,31 @@ #define NTFS_TIME_OFFSET ((s64)(369 * 365 + 89) * 24 * 3600 * 10000000) -/** - * ntfs2utc - Convert an NTFS time to Unix time - * @time: An NTFS time in 100ns units since 1601 - * - * NTFS stores times as the number of 100ns intervals since January 1st 1601 at - * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. - * - * Return: n A Unix time (number of seconds since 1970) - */ -time_t ntfs2utc (s64 time) -{ - return (time - (NTFS_TIME_OFFSET)) / 10000000; -} - -/** - * utc2ntfs - convert Linux time to NTFS time - * @time: Linux time to convert to NTFS - * - * Convert the Linux time @time to its corresponding NTFS time. - * - * Linux stores time in a long at present and measures it as the number of - * 1-second intervals since 1st January 1970, 00:00:00 UTC. - * - * NTFS uses Microsoft's standard time format which is stored in a s64 and is - * measured as the number of 100 nano-second intervals since 1st January 1601, - * 00:00:00 UTC. - * - * Return: n An NTFS time (100ns units since Jan 1601) - */ -s64 utc2ntfs (time_t time) -{ - /* Convert to 100ns intervals and then add the NTFS time offset. */ - return (s64)time * 10000000 + NTFS_TIME_OFFSET; -} - - -/* valid_device requires the following */ +/* These utilities require the following functions */ extern int Eprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); extern int Vprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); +extern int Iprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); /** - * valid_device - Perform some safety checks on the device, before we start + * utils_set_locale + */ +int utils_set_locale (void) +{ + const char *locale; + + locale = setlocale (LC_ALL, ""); + if (!locale) { + locale = setlocale (LC_ALL, NULL); + Eprintf ("Failed to set locale, using default '%s'.\n", locale); + return 1; + } else { + Vprintf ("Using locale '%s'.\n", locale); + return 0; + } +} + +/** + * utils_valid_device - Perform some safety checks on the device, before we start * @name: Full pathname of the device/file to work with * @force: Continue regardless of problems * @@ -87,7 +74,7 @@ extern int Vprintf (const char *format, ...) __attribute__ ((format (printf, 1, * Return: 1 Success, we can continue * 0 Error, we cannot use this device */ -int valid_device (const char *name, int force) +int utils_valid_device (const char *name, int force) { unsigned long mnt_flags = 0; struct stat st; @@ -130,6 +117,190 @@ int valid_device (const char *name, int force) return 1; } +/** + * utils_mount_volume + */ +ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force) +{ + ntfs_volume *vol; + + if (!device) + return NULL; + + if (!utils_valid_device (device, force)) + return NULL; + + vol = ntfs_mount (device, MS_RDONLY); + if (!vol) { + Eprintf ("Couldn't mount device '%s': %s\n", device, strerror (errno)); + return NULL; + } + + if (vol->flags & VOLUME_IS_DIRTY) { + Iprintf ("Volume is dirty.\n"); + if (!force) { + Eprintf ("Run chkdsk and try again, or use the --force option.\n"); + ntfs_umount (vol, FALSE); + return NULL; + } + Iprintf ("Forced to continue.\n"); + } + + return vol; +} + +/** + * utils_parse_size - Convert a string representing a size + * @value: String to be parsed + * @size: Parsed size + * @scale: XXX FIXME + * + * Read a string and convert it to a number. Strings may be suffixed to scale + * them. Any number without a suffix is assumed to be in bytes. + * + * Suffix Description Multiple + * [tT] Terabytes 10^12 + * [gG] Gigabytes 10^9 + * [mM] Megabytes 10^6 + * [kK] Kilobytes 10^3 + * + * Notes: + * Only the first character of the suffix is read. + * The multipliers are decimal thousands, not binary: 1000, not 1024. + * If parse_size fails, @size will not be changed + * + * Return: 1 Success + * 0 Error, the string was malformed + */ +int utils_parse_size (const char *value, s64 *size, BOOL scale) +{ + long long result; + char *suffix = NULL; + + if (!value || !size) + return 0; + + Dprintf ("Parsing size '%s'.\n", value); + + result = strtoll (value, &suffix, 10); + if (result < 0 || errno == ERANGE) { + Eprintf ("Invalid size '%s'.\n", value); + return 0; + } + + if (!suffix) { + Eprintf ("Internal error, strtoll didn't return a suffix.\n"); + return 0; + } + + if (scale) { + switch (suffix[0]) { + case 't': case 'T': result *= 1000; + case 'g': case 'G': result *= 1000; + case 'm': case 'M': result *= 1000; + case 'k': case 'K': result *= 1000; + case '-': case 0: + break; + default: + Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); + return 0; + } + } else { + if ((suffix[0] != '-') && (suffix[0] != 0)) { + Eprintf ("Invalid number '%.*s'.\n", (suffix - value + 1), value); + return 0; + } + } + + Dprintf ("Parsed size = %lld.\n", result); + *size = result; + return 1; +} + +/** + * utils_parse_range - Convert a string representing a range of numbers + * @string: The string to be parsed + * @start: The beginning of the range will be stored here + * @finish: The end of the range will be stored here + * + * Read a string of the form n-m. If the lower end is missing, zero will be + * substituted. If the upper end is missing LONG_MAX will be used. If the + * string cannot be parsed correctly, @start and @finish will not be changed. + * + * Return: 1 Success, a valid string was found + * 0 Error, the string was not a valid range + */ +int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale) +{ + s64 a, b; + char *middle; + + if (!string || !start || !finish) + return 0; + + middle = strchr (string, '-'); + if (string == middle) { + Dprintf ("Range has no beginning, defaulting to 0.\n"); + a = 0; + } else { + if (!utils_parse_size (string, &a, scale)) + return 0; + } + + if (middle) { + if (middle[1] == 0) { + b = LONG_MAX; // XXX ULLONG_MAX + Dprintf ("Range has no end, defaulting to %lld.\n", b); + } else { + if (!utils_parse_size (middle+1, &b, scale)) + return 0; + } + } else { + b = a; + } + + Dprintf ("Range '%s' = %lld - %lld\n", string, a, b); + + *start = a; + *finish = b; + return 1; +} + +/** + * ntfs2utc - Convert an NTFS time to Unix time + * @time: An NTFS time in 100ns units since 1601 + * + * NTFS stores times as the number of 100ns intervals since January 1st 1601 at + * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. + * + * Return: n A Unix time (number of seconds since 1970) + */ +time_t ntfs2utc (s64 time) +{ + return (time - (NTFS_TIME_OFFSET)) / 10000000; +} + +/** + * utc2ntfs - convert Linux time to NTFS time + * @time: Linux time to convert to NTFS + * + * Convert the Linux time @time to its corresponding NTFS time. + * + * Linux stores time in a long at present and measures it as the number of + * 1-second intervals since 1st January 1970, 00:00:00 UTC. + * + * NTFS uses Microsoft's standard time format which is stored in a s64 and is + * measured as the number of 100 nano-second intervals since 1st January 1601, + * 00:00:00 UTC. + * + * Return: n An NTFS time (100ns units since Jan 1601) + */ +s64 utc2ntfs (time_t time) +{ + /* Convert to 100ns intervals and then add the NTFS time offset. */ + return (s64)time * 10000000 + NTFS_TIME_OFFSET; +} + /** * find_attribute - Find an attribute of the given type * @type: An attribute type, e.g. AT_FILE_NAME diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 9b051fc6..2183459d 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -52,7 +52,11 @@ struct _IO_FILE; int ntfs_printf (struct _IO_FILE *stream, int *control, BOOL trigger, const char *format, ...) __attribute__ ((format (printf, 4, 5))); -int valid_device (const char *name, int force); +int utils_valid_device (const char *name, int force); +int utils_set_locale (void); +ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force); +int utils_parse_size (const char *value, s64 *size, BOOL scale); +int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale); time_t ntfs2utc (s64 time); s64 utc2ntfs (time_t time); From 6d5ba60378dbadcbf973793aa39f74aafef38f2a Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 10 Jan 2003 01:06:19 +0000 Subject: [PATCH 0373/2994] some functions moved to utils (Logical change 1.85) --- ntfsprogs/ntfswipe.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index f98a51e2..dfa9f7f0 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -707,37 +707,26 @@ void print_summary (void) */ int main (int argc, char *argv[]) { - const char *locale; ntfs_volume *vol; int result = 1; int flags = 0; int i, j; enum action act = act_info; - locale = setlocale (LC_ALL, ""); - if (!locale) { - locale = setlocale (LC_ALL, NULL); - Vprintf ("Failed to set locale, using default '%s'.\n", locale); - } else { - Vprintf ("Using locale '%s'.\n", locale); - } + utils_set_locale(); if (!parse_options (argc, argv)) return 1; - if (!valid_device (opts.device, opts.force)) - goto free; - if (!opts.info) print_summary(); if (opts.info || opts.noaction) flags = MS_RDONLY; - vol = ntfs_mount (opts.device, flags); - if (!vol) { - Eprintf ("Couldn't mount device '%s': %s\n", opts.device, strerror (errno)); + + vol = utils_mount_volume (opts.device, flags, opts.force); + if (!vol) goto free; - } if (vol->flags & VOLUME_IS_DIRTY) { Iprintf ("Volume is dirty.\n"); From 7d20cb53767d6ca9d28b958e424589b4279811dd Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 10 Jan 2003 01:06:19 +0000 Subject: [PATCH 0374/2994] start to work on the program's behaviour (Logical change 1.85) --- ntfsprogs/ntfscluster.c | 278 ++++++++++------------------------------ ntfsprogs/ntfscluster.h | 25 ++-- 2 files changed, 83 insertions(+), 220 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 45c3c3d5..df6db7de 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -25,13 +25,10 @@ #include #include -#include -#include #include #include -#include -#include #include +#include #include "ntfscluster.h" #include "types.h" @@ -91,8 +88,9 @@ void usage (void) { Iprintf ("Usage: %s [options] device\n" " -i --info Print information about the volume\n" - " -s range --sector range Look for objects in this range of sectors\n" " -c range --cluster range Look for objects in this range of clusters\n" + " -s range --sector range Look for objects in this range of sectors\n" + " -l --last Find the last file on the volume\n" "\n" " -f --force Use less caution\n" " -q --quiet Less output\n" @@ -103,121 +101,6 @@ void usage (void) Iprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); } -/** - * parse_size - Convert a string representing a size - * @value: String to be parsed - * @size: Parsed size - * - * Read a string and convert it to a number. Strings may be suffixed to scale - * them. Any number without a suffix is assumed to be in bytes. - * - * Suffix Description Multiple - * [tT] Terabytes 10^12 - * [gG] Gigabytes 10^9 - * [mM] Megabytes 10^6 - * [kK] Kilobytes 10^3 - * - * Notes: - * Only the first character of the suffix is read. - * The multipliers are decimal thousands, not binary: 1000, not 1024. - * If parse_size fails, @size will not be changed - * - * Return: 1 Success - * 0 Error, the string was malformed - */ -int parse_size (const char *value, s64 *size) -{ - long long result; - char *suffix = NULL; - - if (!value || !size) - return 0; - - Dprintf ("Parsing size '%s'.\n", value); - - result = strtoll (value, &suffix, 10); - if (result < 0 || errno == ERANGE) { - Eprintf ("Invalid size '%s'.\n", value); - return 0; - } - - if (!suffix) { - Eprintf ("Internal error, strtoll didn't return a suffix.\n"); - return 0; - } - - - /*if (strlen (suffix) > 1) { - Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); - return 0; - } Can't do this because of ranges*/ - - switch (suffix[0]) { - case 't': case 'T': result *= 1000; - case 'g': case 'G': result *= 1000; - case 'm': case 'M': result *= 1000; - case 'k': case 'K': result *= 1000; - case '-': case 0: - break; - default: - Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); - return 0; - } - - Dprintf ("Parsed size = %lld.\n", result); - *size = result; - return 1; -} - -/** - * parse_range - Convert a string representing a range of numbers - * @string: The string to be parsed - * @start: The beginning of the range will be stored here - * @finish: The end of the range will be stored here - * - * Read a string of the form n-m. If the lower end is missing, zero will be - * substituted. If the upper end is missing LONG_MAX will be used. If the - * string cannot be parsed correctly, @start and @finish will not be changed. - * - * Return: 1 Success, a valid string was found - * 0 Error, the string was not a valid range - */ -int parse_range (const char *string, s64 *start, s64 *finish) -{ - s64 a, b; - char *middle; - - if (!string || !start || !finish) - return 0; - - middle = strchr (string, '-'); - if (string == middle) { - Dprintf ("Range has no beginning, defaulting to 0.\n"); - a = 0; - } else { - if (!parse_size (string, &a)) - return 0; - } - - if (middle) { - if (middle[1] == 0) { - b = LONG_MAX; // XXX ULLONG_MAX - Dprintf ("Range has no end, defaulting to %lld.\n", b); - } else { - if (!parse_size (middle+1, &b)) - return 0; - } - } else { - b = a; - } - - Dprintf ("Range '%s' = %lld - %lld\n", string, a, b); - - *start = a; - *finish = b; - return 1; -} - /** * parse_options - Read and validate the programs command line * @@ -229,12 +112,13 @@ int parse_range (const char *string, s64 *start, s64 *finish) */ int parse_options (int argc, char **argv) { - static const char *sopt = "-c:fhiqs:vV"; + static const char *sopt = "-c:fhilqs:vV"; static const struct option lopt[] = { { "cluster", required_argument, NULL, 'c' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "info", no_argument, NULL, 'i' }, + { "last", no_argument, NULL, 'l' }, { "quiet", no_argument, NULL, 'q' }, { "sector", required_argument, NULL, 's' }, { "verbose", no_argument, NULL, 'v' }, @@ -249,6 +133,10 @@ int parse_options (int argc, char **argv) opterr = 0; /* We'll handle the errors, thank you. */ + opts.action = act_none; + opts.range_begin = -1; + opts.range_end = -1; + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { case 1: /* A non-option argument */ @@ -261,10 +149,11 @@ int parse_options (int argc, char **argv) break; case 'c': - if ((opts.cluster_begin > 0) || (opts.cluster_end > 0) || - !parse_range (optarg, &opts.cluster_begin, &opts.cluster_end)) { - err++; - } + if ((opts.action == act_none) && + (utils_parse_range (optarg, &opts.range_begin, &opts.range_end, FALSE))) + opts.action = act_cluster; + else + opts.action = act_error; break; case 'f': opts.force++; @@ -273,16 +162,28 @@ int parse_options (int argc, char **argv) help++; break; case 'i': - opts.info++; + if (opts.action == act_none) { + opts.action = act_info; + } else { + opts.action = act_error; + err++; + } + break; + case 'l': + if (opts.action == act_none) + opts.action = act_last; + else + opts.action = act_error; break; case 'q': opts.quiet++; break; case 's': - if ((opts.sector_begin > 0) || (opts.sector_end > 0) || - !parse_range (optarg, &opts.sector_begin, &opts.sector_end)) { - err++; - } + if ((opts.action == act_none) && + (utils_parse_range (optarg, &opts.range_begin, &opts.range_end, FALSE))) + opts.action = act_sector; + else + opts.action = act_error; break; case 'v': opts.verbose++; @@ -291,11 +192,10 @@ int parse_options (int argc, char **argv) ver++; break; default: - if ((optopt == 'c') || (optopt == 's')) { + if ((optopt == 'c') || (optopt == 's')) Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); - } else { + else Eprintf ("Unknown option '%s'.\n", argv[optind-1]); - } err++; break; } @@ -304,6 +204,11 @@ int parse_options (int argc, char **argv) if (help || ver) { opts.quiet = 0; } else { + if (opts.action == act_none) + opts.action = act_info; + if (opts.action == act_info) + opts.quiet = 0; + if (opts.device == NULL) { Eprintf ("You must specify exactly one device.\n"); err++; @@ -314,18 +219,13 @@ int parse_options (int argc, char **argv) err++; } - if (opts.sector_end && opts.cluster_end) { - Eprintf ("You must specify either a sector or a cluster.\n"); + if (opts.action == act_error) { + Eprintf ("You may only specify one action: --info, --cluster, --sector or --last.\n"); err++; - } - if (opts.cluster_begin > opts.cluster_end) { - Eprintf ("The cluster range must be in ascending order.\n"); + } else if (opts.range_begin > opts.range_end) { + Eprintf ("The range must be in ascending order.\n"); err++; - } - if (opts.sector_begin > opts.sector_end) { - Eprintf ("The sector range must be in ascending order.\n"); - err++; - } + } } if (ver) @@ -405,9 +305,9 @@ int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) return 1; } + // first, is the cluster in use in $Bitmap? + for (i = 0; i < vol->nr_mft_records; i++) { - //for (i = 0; i < 30; i++) { - //for (i = 162; i < 175; i++) { ntfs_inode *inode; ntfs_attr_search_ctx *ctx; @@ -490,56 +390,6 @@ free: return result; } -/** - * my_locale - */ -int my_locale (void) -{ - const char *locale; - - locale = setlocale (LC_ALL, ""); - if (!locale) { - locale = setlocale (LC_ALL, NULL); - Vprintf ("Failed to set locale, using default '%s'.\n", locale); - return 1; - } else { - Vprintf ("Using locale '%s'.\n", locale); - return 0; - } -} - -/** - * get_vol - */ -ntfs_volume * get_vol (const char *device, unsigned long flags, BOOL force) -{ - ntfs_volume *vol; - - if (!device) - return NULL; - - if (!valid_device (device, force)) - return NULL; - - vol = ntfs_mount (device, MS_RDONLY); - if (!vol) { - Eprintf ("Couldn't mount device '%s': %s\n", device, strerror (errno)); - return NULL; - } - - if (vol->flags & VOLUME_IS_DIRTY) { - Iprintf ("Volume is dirty.\n"); - if (!force) { - Eprintf ("Run chkdsk and try again, or use the --force option.\n"); - ntfs_umount (vol, FALSE); - return NULL; - } - Iprintf ("Forced to continue.\n"); - } - - return vol; -} - /** * main - Begin here * @@ -551,31 +401,37 @@ ntfs_volume * get_vol (const char *device, unsigned long flags, BOOL force) int main (int argc, char *argv[]) { ntfs_volume *vol; - int result; + int result = 1; if (!parse_options (argc, argv)) return 1; - my_locale(); + utils_set_locale(); - vol = get_vol (opts.device, MS_RDONLY, opts.force); + vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); if (!vol) return 1; -#if 0 - if (opts.info) { - //result = get_info (vol); - } else if (opts.cluster) { - result = cluster_find (vol, opts.cluster); - } else if (opts.sector) { - //result = - } else { - //result = + switch (opts.action) { + case act_sector: + Iprintf ("Searching for sector range %lld-%lld\n", opts.range_begin, opts.range_end); + /* Convert to clusters */ + opts.range_begin <<= (vol->cluster_size_bits - vol->sector_size_bits); + opts.range_end <<= (vol->cluster_size_bits - vol->sector_size_bits); + result = cluster_find (vol, opts.range_begin, opts.range_end); + break; + case act_cluster: + Iprintf ("Searching for cluster range %lld-%lld\n", opts.range_begin, opts.range_end); + result = cluster_find (vol, opts.range_begin, opts.range_end); + break; + case act_last: + printf ("Last\n"); + break; + case act_info: + default: + printf ("Info\n"); + break; } -#endif - //opts.cluster_end = LONG_MAX; - printf ("Searching for cluster range %lld-%lld\n", opts.cluster_begin, opts.cluster_end); - result = cluster_find (vol, opts.cluster_begin, opts.cluster_end); ntfs_umount (vol, FALSE); return result; diff --git a/ntfsprogs/ntfscluster.h b/ntfsprogs/ntfscluster.h index f760dfe8..fec1fb75 100644 --- a/ntfsprogs/ntfscluster.h +++ b/ntfsprogs/ntfscluster.h @@ -26,16 +26,23 @@ #include "types.h" +enum action { + act_none = 1, + act_info = 2, + act_cluster = 3, + act_sector = 4, + act_last = 5, + act_error = 6, +}; + struct options { - char *device; /* Device/File to work with */ - int info; /* Show volume info */ - int quiet; /* Less output */ - int verbose; /* Extra output */ - int force; /* Override common sense */ - u64 sector_begin; /* Look for objects in this range of sectors */ - u64 sector_end; - u64 cluster_begin; /* Look for objects in this range of clusters */ - u64 cluster_end; + char *device; /* Device/File to work with */ + enum action action; /* What to do */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int force; /* Override common sense */ + u64 range_begin; /* Look for objects in this range */ + u64 range_end; }; #endif /* _NTFSCLUSTER_H_ */ From de757075f43694084380dd255ee2d5acf7071472 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 10 Jan 2003 17:00:47 +0000 Subject: [PATCH 0375/2994] mount read-only (Szaka) (Logical change 1.86) --- ntfsprogs/ntfsinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 932f9095..5418bd99 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -95,7 +95,7 @@ void ntfs_get_file_attributes(const char *dev, long int i) ntfs_inode *inode = NULL; //int error; - if(!(vol = ntfs_mount(dev, 0))) { + if(!(vol = ntfs_mount(dev, MS_RDONLY))) { fprintf(stderr, "ntfsinfo error: cannot mount device %s\n",dev); exit(1); } From aa568dccc08821b8249bbc73e8a5e287924d2950 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 10 Jan 2003 17:00:47 +0000 Subject: [PATCH 0376/2994] update from Szaka (Logical change 1.86) --- TODO.ntfsprogs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 857dbe87..f40f94aa 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -45,19 +45,17 @@ Thanks, ************** High priority - - support fragmented volumes + - support fragmented volumes -- WIP - recovery support, journaling - - test suite Medium priority - - easy usage by partitioning tools: + - easy usage by partitioning tools -- WIP - move useful things to libntfs - extended error codes at exit() - cleanup at exit() - quiet operation Low priority - - volume enlargement - move volume start - support disks having bad blocks From ce45772a9c28d932cff646c363ba8eb8834074ea Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 10 Jan 2003 17:00:47 +0000 Subject: [PATCH 0377/2994] update from Szaka hand applied by me (Logical change 1.86) --- ntfsprogs/ntfsresize.8.in | 36 ++- ntfsprogs/ntfsresize.c | 446 +++++++++++++++++++++++++++----------- 2 files changed, 350 insertions(+), 132 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 85c6a1db..8bfff30c 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -13,7 +13,7 @@ ntfsresize \- resize an NTFS filesystem The .B ntfsresize program non-destructively resizes Windows NT4, 2000, XP or .NET -NTFS filesystems. At present it can be used to shrink a +NTFS filesystems. At present it can be used to enlarge or shrink a defragmented NTFS filesystem located on an unmounted .I device (usually a disk partition). The new volume will have @@ -28,10 +28,28 @@ parameter is given in kilo-, mega- or gigabytes respectively. .B ntfsresize conforms to the SI, ATA, IEEE standards and the disk manufacturers by using k=10^3, M=10^6 and G=10^9. +The options +.B -i +and +.B -s +are mutually exclusive. If both of them is omitted then the +NTFS filesystem will be enlarged to the device size. .PP The .B ntfsresize -program does not manipulate the size of partitions. +program doesn't manipulate the size of partitions. +To do that you have to use a disk partitioning tool, for example +.BR fdisk (8). +.PP +If you wish to enlarge an NTFS filesystem, +you must first make sure you can expand the size of the +underlying partition first. This can be done using +.BR fdisk (8) +by deleting the partition and recreating it with a larger size. +Then you may use +.B ntfsresize +to shrink the size of the filesystem. +.PP If you wish to shrink an NTFS partition, first use .B ntfsresize to shrink the size of the filesystem. Then you may use @@ -44,7 +62,8 @@ When recreating the partition with .BR fdisk (8) make sure you create it with the same starting disk cylinder and partition type -as before and you do not make it smaller than the new size +as before. If you shrink a partition also make sure you do not make +it smaller than the new size of the NTFS filesystem! Otherwise you may lose your entire filesystem. Also make sure you set the bootable flag for the partition if it existed before. Failing to do so you might not be able to boot your @@ -53,8 +72,7 @@ computer from the disk! Note, .B ntfsresize schedules 'chkdsk' to make an NTFS consistency check -when you will boot Windows. If your partition was a -system partition than Windows may intentionally reboot after +when you will boot Windows. Windows may force a reboot after the successful consistency check. .SH OPTIONS @@ -80,7 +98,7 @@ Volume will be opened read-only and displays what it would do if it were to resize the filesystem. .TP .B -s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] -Shrink volume to \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes. +Resize volume to \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes. The optional modifiers \fBk\fR, \fBM\fR, \fBG\fR mean the .I size parameter is given in kilo-, mega- or gigabytes respectively. @@ -92,8 +110,7 @@ If you find otherwise, please report it to ctx->attr; + new_volume_size = resize->new_volume_size; + inode = resize->ni->mft_no; if (!a->non_resident) return; @@ -381,15 +406,45 @@ void build_lcn_usage_bitmap(ATTR_RECORD *a) if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) perr_exit("ntfs_decompress_mapping_pairs"); + runs = runlist_extent_number(rl); + for (i = 0; rl[i].length; i++) { - if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) + s64 lcn = rl[i].lcn; + s64 lcn_length = rl[i].length; + + if (lcn == LCN_HOLE || lcn == LCN_RL_NOT_MAPPED) continue; - for (j = 0; j < rl[i].length; j++) { - u64 k = (u64)rl[i].lcn + j; + + /* FIXME: ntfs_mapping_pairs_decompress should return error */ + if (lcn < 0 || lcn_length <= 0) + err_exit("Corrupt runlist in inode %lld attr %x LCN " + "%llx length %llx\n", inode, a->type, lcn, + lcn_length); + + for (j = 0; j < lcn_length; j++) { + u64 k = (u64)lcn + j; if (ntfs_bit_get_and_set(lcn_bitmap.bm, k, 1)) err_exit("Cluster %lu referenced twice!\n" "You didn't shutdown your Windows" - "properly?", k); + "properly?\n", k); + } + + resize->inuse += lcn_length; + + if (opt.info) + continue; + + if (lcn + (lcn_length - 1) > new_volume_size) { + + s64 start = lcn; + s64 len = lcn_length; + + if (start <= new_volume_size) { + start = new_volume_size + 1; + len = lcn_length - (start - lcn); + } + + resize->relocations += len; } } free(rl); @@ -401,17 +456,18 @@ void build_lcn_usage_bitmap(ATTR_RECORD *a) * For a given MFT Record, iterate through all its attributes. Any non-resident * data runs will be marked in lcn_bitmap. */ -void walk_attributes(MFT_RECORD *mr) +void walk_attributes(ntfs_resize_t *resize) { ntfs_attr_search_ctx *ctx; - if (!(ctx = ntfs_attr_get_search_ctx(NULL, mr))) + if (!(ctx = ntfs_attr_get_search_ctx(resize->ni, NULL))) perr_exit("ntfs_get_attr_search_ctx"); while (!ntfs_attrs_walk(ctx)) { if (ctx->attr->type == AT_END) break; - build_lcn_usage_bitmap(ctx->attr); + resize->ctx = ctx; + build_lcn_usage_bitmap(resize); } ntfs_attr_put_search_ctx(ctx); @@ -436,7 +492,7 @@ void get_bitmap_data(ntfs_volume *vol, struct bitmap *bm) perr_exit ("get_bitmap_data"); if (ntfs_attr_pread (attr, 0, bm->size, bm->bm) < 0) - perr_exit("Couldn't get $Bitmap $DATA\n"); + perr_exit("Couldn't get $Bitmap $DATA"); } /** @@ -447,17 +503,37 @@ void get_bitmap_data(ntfs_volume *vol, struct bitmap *bm) */ void compare_bitmaps(struct bitmap *a, struct bitmap *b) { - int i; + u64 i, j, mismatch = 0; + char bit; if (a->size != b->size) err_exit("$Bitmap file size doesn't match " "calculated size ((%d != %d)\n", a->size, b->size); - for (i = 0; i < a->size; i++) - if (a->bm[i] != b->bm[i]) - err_exit("Cluster bitmaps differ at %d (%d != %d)\n" - "You didn't shutdown your Windows properly?", - i, a->bm[i], b->bm[i]); + for (i = 0; i < a->size; i++) { + + if (a->bm[i] == b->bm[i]) + continue; + + for (j = i * 8; j < i * 8 + 8; j++) { + + bit = ntfs_bit_get(a->bm, j); + if (bit != ntfs_bit_get(b->bm, j)) { + if (++mismatch > 10) + continue; + + printf("Cluster accounting failed at %llu " + "(0x%Lx): %s cluster in $Bitmap\n", + j, j, bit ? "extra" : "miss"); + } + } + } + + if (mismatch) { + printf("Totally %Lu cluster accounting mismatches.\n" + "You didn't shutdown Windows properly?\n", mismatch); + exit(1); + } } /** @@ -497,12 +573,11 @@ void progress_update(struct progress_bar *p, u64 current) * Read each record in the MFT, skipping the unused ones, and build up a bitmap * from all the non-resident attributes. */ -void walk_inodes() +void walk_inodes(ntfs_resize_t *resize) { - s32 inode = 0; + s64 inode = 0; s64 last_mft_rec; - MFT_REF mref; - MFT_RECORD *mrec = NULL; + ntfs_inode *ni; struct progress_bar progress; printf("Scanning volume ...\n"); @@ -513,21 +588,27 @@ void walk_inodes() for (; inode <= last_mft_rec; inode++) { progress_update(&progress, inode); - mref = (MFT_REF)inode; - if (ntfs_file_record_read(vol, mref, &mrec, NULL)) { + if ((ni = ntfs_inode_open(vol, (MFT_REF)inode)) == NULL) { /* FIXME: continue only if it make sense, e.g. MFT record not in use based on $MFT bitmap */ - if (errno == EIO) + if (errno == EIO || errno == ENOENT) continue; - perr_exit("Reading inode %ld failed", inode); + perr_exit("Reading inode %lld failed", inode); } - if (!(mrec->flags & MFT_RECORD_IN_USE)) + + if (!(ni->mrec->flags & MFT_RECORD_IN_USE)) continue; - walk_attributes(mrec); + if ((ni->mrec->base_mft_record) != 0) + continue; + + resize->ni = ni; + resize->mrec = ni->mrec; + walk_attributes(resize); + + if (ntfs_inode_close(ni)) + perr_exit("ntfs_inode_close for inode %lld", inode); } - if (mrec) - free(mrec); } /** @@ -552,7 +633,7 @@ void advise_on_resize() if (fragmanted_end || !opt.info) { printf(fragmented_volume_msg); if (fragmanted_end) - exit(1); + return; printf("Now "); } @@ -576,7 +657,6 @@ void advise_on_resize() printf("%lld bytes", g_b); printf(").\n"); - exit(1); } /** @@ -630,7 +710,7 @@ void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) * The metadata file $BadClus needs to be shrunk. * * FIXME: this function should go away and instead using a generalized - * "truncate_bitmap_unnamed_attr()" + * "truncate_bitmap_data_attr()" */ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) { @@ -656,6 +736,10 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl_bad)) exit(1); + /* We must have at least 8 bytes free to hold the runlist */ + if (mp_size > 8) + perr_exit("ntfs_mapping_pairs_build"); + memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); a->highest_vcn = cpu_to_le64(nr_clusters - 1LL); a->allocated_size = cpu_to_le64(nr_clusters * vol->cluster_size); @@ -666,29 +750,17 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) } /** - * truncate_bitmap_unnamed_attr + * shrink_bitmap_data_attr * * Shrink the metadata file $Bitmap. It must be large enough for one bit per * cluster of the shrunken volume. Also it must be a of 8 bytes in size. */ -void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) +void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) { - runlist *rl; - s64 bm_bsize, size; - s64 nr_bm_clusters; - int i, j, mp_size; + runlist *rl = *rlist; + int i, j; + u64 k; int trunc_at = -1; /* FIXME: -1 means unset */ - char *mp; - - if (!a->non_resident) - /* FIXME: handle resident attribute value */ - perr_exit("Resident data attribute in $Bitmap not supported!"); - - bm_bsize = nr_clusters_to_bitmap_byte_size(nr_clusters); - nr_bm_clusters = rounded_up_division(bm_bsize, vol->cluster_size); - - if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) - perr_exit("ntfs_mapping_pairs_decompress"); /* Unallocate truncated clusters in $Bitmap */ for (i = 0; rl[i].length; i++) { @@ -698,19 +770,19 @@ void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) trunc_at = i; if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) continue; - for (j = 0; j < rl[i].length; j++) - if (rl[i].vcn + j >= nr_bm_clusters) { - u64 k = (u64)rl[i].lcn + j; + for (j = 0; j < rl[i].length; j++) { + if (rl[i].vcn + j < nr_bm_clusters) + continue; + + k = (u64)rl[i].lcn + j; + if (k < new_size) { ntfs_bit_set(lcn_bitmap.bm, k, 0); Dprintf("Unallocate cluster: " "%llu (%llx)\n", k, k); } + } } - /* FIXME: realloc lcn_bitmap.bm (if it's worth the risk) */ - lcn_bitmap.size = bm_bsize; - bitmap_file_data_fixup(nr_clusters, &lcn_bitmap); - if (trunc_at != -1) { /* NOTE: 'i' always > 0 */ i = nr_bm_clusters - rl[trunc_at].vcn; @@ -718,9 +790,101 @@ void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) rl_set(rl + trunc_at + 1, nr_bm_clusters, -1LL, 0LL); Dprintf("Runlist truncated at index %d, " - "new cluster length %d\n", trunc_at, i); + "new cluster length %d\n", trunc_at, i); + } +} + +void enlarge_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) +{ + runlist *rl = *rlist; + s64 i, free_zone = 0; + + for (i = 0; i < rl->length; i++) + ntfs_bit_set(lcn_bitmap.bm, rl->lcn + i, 0); + free(rl); + + if (!(rl = *rlist = (runlist *)malloc(2 * sizeof(runlist)))) + perr_exit("Couldn't get memory"); + + for (i = vol->nr_clusters; i < new_size; i++) + ntfs_bit_set(lcn_bitmap.bm, i, 0); + + for (i = 0; i < new_size; i++) { + if (!ntfs_bit_get(lcn_bitmap.bm, i)) { + if (++free_zone == nr_bm_clusters) + break; + } else + free_zone = 0; } + if (free_zone != nr_bm_clusters) + err_exit("Couldn't allocate $Bitmap clusters.\n"); + + for (; free_zone; free_zone--, i--) + ntfs_bit_set(lcn_bitmap.bm, i, 1); + + rl_set(rl, 0LL, i + 1, nr_bm_clusters); + rl_set(rl + 1, nr_bm_clusters, -1LL, 0LL); +} + + +void truncate_bitmap_data_attr(ATTR_RECORD *a, s64 nr_clusters) +{ + runlist *rl; + s64 bm_bsize, size; + s64 nr_bm_clusters; + int mp_size; + char *mp; + u8 *tmp; + + if (!a->non_resident) + /* FIXME: handle resident attribute value */ + perr_exit("Resident data attribute in $Bitmap not supported!"); + + bm_bsize = nr_clusters_to_bitmap_byte_size(nr_clusters); + nr_bm_clusters = rounded_up_division(bm_bsize, vol->cluster_size); + + if (!(tmp = (u8 *)realloc(lcn_bitmap.bm, bm_bsize))) + perr_exit("realloc"); + lcn_bitmap.bm = tmp; + lcn_bitmap.size = bm_bsize; + bitmap_file_data_fixup(nr_clusters, &lcn_bitmap); + + if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) + perr_exit("ntfs_mapping_pairs_decompress"); + + if (runlist_extent_number(rl) != 1) + err_exit("$Bitmap data has more than one extent, unusual.\n" + "Please report it to linux-ntfs-dev@lists.sf.net"); + + if (nr_clusters < vol->nr_clusters) + shrink_bitmap_data_attr(&rl, nr_bm_clusters, nr_clusters); + else + enlarge_bitmap_data_attr(&rl, nr_bm_clusters, nr_clusters); + + mp_size = ntfs_get_size_for_mapping_pairs(vol, rl); + + /* We must have at least 8 bytes free to hold the runlist */ + if (mp_size > 8) + err_exit("Resizing attribute header isn't supported yet.\n"); + + if (!(mp = (char *)calloc(1, mp_size))) + perr_exit("Couldn't get memory"); + + if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl)) + perr_exit("ntfs_mapping_pairs_build"); + + memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); + a->highest_vcn = cpu_to_le64(nr_bm_clusters - 1LL); + a->allocated_size = cpu_to_le64(nr_bm_clusters * vol->cluster_size); + a->data_size = cpu_to_le64(bm_bsize); + a->initialized_size = cpu_to_le64(bm_bsize); + + /* + * FIXME: update allocated/data sizes and timestamps in $FILE_NAME + * attribute too, for now chkdsk will do this for us. + */ + if (!opt.ro_flag) { size = ntfs_rl_pwrite(vol, rl, 0, bm_bsize, lcn_bitmap.bm); if (bm_bsize != size) { @@ -732,20 +896,6 @@ void truncate_bitmap_unnamed_attr(ATTR_RECORD *a, s64 nr_clusters) } } - mp_size = ntfs_get_size_for_mapping_pairs(vol, rl); - - if (!(mp = (char *)calloc(1, mp_size))) - perr_exit("Couldn't get memory"); - - if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl)) - exit(1); - - memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); - a->highest_vcn = cpu_to_le64(nr_bm_clusters - 1LL); - a->allocated_size = cpu_to_le64(nr_bm_clusters * vol->cluster_size); - a->data_size = cpu_to_le64(bm_bsize); - a->initialized_size = cpu_to_le64(bm_bsize); - free(rl); free(mp); } @@ -814,7 +964,6 @@ void truncate_badclust_file(s64 nr_clusters) lookup_data_attr((MFT_REF)FILE_BadClus, "$Bad", &ctx); look_for_bad_sector(ctx->attr); /* FIXME: sanity_check_attr(ctx->attr); */ - /* FIXME: should use an "extended" truncate_bitmap_unnamed_attr() */ truncate_badclust_bad_attr(ctx->attr, nr_clusters); if (write_mft_record(ctx)) @@ -836,7 +985,7 @@ void truncate_bitmap_file(s64 nr_clusters) lookup_data_attr((MFT_REF)FILE_Bitmap, NULL, &ctx); /* FIXME: sanity_check_attr(ctx->attr); */ - truncate_bitmap_unnamed_attr(ctx->attr, nr_clusters); + truncate_bitmap_data_attr(ctx->attr, nr_clusters); if (write_mft_record(ctx)) perr_exit("Couldn't update $Bitmap"); @@ -904,6 +1053,22 @@ void print_volume_size(char *str, ntfs_volume *v, s64 nr_clusters) str, b, rounded_up_division(b, NTFS_MBYTE)); } +void print_disk_usage(ntfs_resize_t *resize) +{ + s64 total, used, free, relocations; + + total = vol->nr_clusters * vol->cluster_size; + used = resize->inuse * vol->cluster_size; + free = total - used; + relocations = resize->relocations * vol->cluster_size; + + printf("Space in use: %lld MB (%.1f%%) ", + rounded_up_division(used, NTFS_MBYTE), + 100.0 * ((float)used / total)); + + printf("\n"); +} + /** * mount_volume * @@ -936,7 +1101,7 @@ void mount_volume() printf("Apparently device '%s' doesn't have a " "valid NTFS. Maybe you selected\nthe whole " "disk instead of a partition (e.g. /dev/hda, " - "not /dev/hda8)?\n", opt.volume); + "not /dev/hda1)?\n", opt.volume); } exit(1); } @@ -963,21 +1128,25 @@ void mount_volume() */ void prepare_volume_fixup() { - if (!opt.ro_flag) { - u16 flags; + u16 flags; - flags = vol->flags | VOLUME_IS_DIRTY; - if (vol->major_ver >= 2) - flags |= VOLUME_MOUNTED_ON_NT4; + if (opt.ro_flag) + return; - printf("Schedule chkdsk NTFS consistency check at Windows boot time ...\n"); - if (ntfs_volume_set_flags(vol, flags)) - perr_exit("Failed to set $Volume dirty"); + flags = vol->flags | VOLUME_IS_DIRTY; + if (vol->major_ver >= 2) + flags |= VOLUME_MOUNTED_ON_NT4; - printf("Resetting $LogFile ... (this might take a while)\n"); - if (ntfs_logfile_reset(vol)) - perr_exit("Failed to reset $LogFile"); - } + printf("Schedule chkdsk for NTFS consistency check at Windows " + "boot time ...\n"); + + if (ntfs_volume_set_flags(vol, flags)) + perr_exit("Failed to set $Volume dirty"); + + printf("Resetting $LogFile ... (this might take a while)\n"); + + if (ntfs_logfile_reset(vol)) + perr_exit("Failed to reset $LogFile"); } /** @@ -988,7 +1157,9 @@ void prepare_volume_fixup() int main(int argc, char **argv) { struct bitmap on_disk_lcn_bitmap; - s64 new_volume_size = 0; /* in clusters */ + ntfs_resize_t resize; + s64 new_size = 0; /* in clusters */ + s64 device_size; /* in bytes */ int i; const char *locale; @@ -1002,45 +1173,69 @@ int main(int argc, char **argv) mount_volume(); + device_size = ntfs_device_size_get(vol->fd, vol->sector_size); + device_size *= vol->sector_size; + if (device_size <= 0) + err_exit("Couldn't get device size (%Ld)!\n", device_size); + + if (device_size < vol->nr_clusters * vol->cluster_size) + err_exit("Current NTFS volume size is bigger than the device " + "size (%Ld)!\nCorrupt partition table or incorrect " + "device partitioning?\n", device_size); + if (opt.bytes) { - /* Take the integer part: when shrinking we don't want - to make the volume to be bigger than requested. - Later on we will also decrease this value to save - room for the backup boot sector */ - new_volume_size = opt.bytes / vol->cluster_size; - print_volume_size("New volume size ", vol, new_volume_size); + if (device_size < opt.bytes) + err_exit("New size can't be bigger than the " + "device size (%Ld bytes).\n", device_size); + } else + opt.bytes = device_size; + + /* + * Take the integer part: we don't want to make the volume bigger + * than requested. Later on we will also decrease this value to save + * room for the backup boot sector. + */ + new_size = opt.bytes / vol->cluster_size; + + if (!opt.info) + print_volume_size("New volume size ", vol, new_size); + + /* Backup boot sector at the end of device isn't counted in NTFS + volume size thus we have to reserve space for. We don't trust + the user does this for us: better to be on the safe side ;) */ + if (new_size) + --new_size; + + if (!opt.info && (new_size == vol->nr_clusters || + (opt.bytes == device_size && + new_size == vol->nr_clusters - 1))) { + printf("Nothing to do: NTFS volume size is already OK.\n"); + exit(0); } setup_lcn_bitmap(); - walk_inodes(); + memset(&resize, 0, sizeof(resize)); + resize.new_volume_size = new_size; + + walk_inodes(&resize); + + print_disk_usage(&resize); get_bitmap_data(vol, &on_disk_lcn_bitmap); compare_bitmaps(&on_disk_lcn_bitmap, &lcn_bitmap); free(on_disk_lcn_bitmap.bm); - if (opt.info) + if (opt.info) { advise_on_resize(); - - /* FIXME: check new_volume_size validity */ - - /* Backup boot sector at the end of device isn't counted in NTFS - volume size thus we have to reserve space for. We don't trust - the user does this for us: better to be on the safe side ;) */ - if (new_volume_size) - --new_volume_size; - - if (new_volume_size > vol->nr_clusters) - err_exit("Volume enlargement not yet supported\n"); - else if (new_volume_size == vol->nr_clusters) { - printf("Nothing to do: NTFS volume size is already OK.\n"); exit(0); } - for (i = new_volume_size; i < vol->nr_clusters; i++) + for (i = new_size; i < vol->nr_clusters; i++) if (ntfs_bit_get(lcn_bitmap.bm, (u64)i)) { /* FIXME: relocate cluster */ advise_on_resize(); + exit(1); } if (opt.force-- <= 0 && !opt.ro_flag) { @@ -1050,9 +1245,9 @@ int main(int argc, char **argv) prepare_volume_fixup(); - truncate_badclust_file(new_volume_size); - truncate_bitmap_file(new_volume_size); - update_bootsector(new_volume_size); + truncate_badclust_file(new_size); + truncate_bitmap_file(new_size); + update_bootsector(new_size); /* We don't create backup boot sector because we don't know where the partition will be split. The scheduled chkdsk will fix it anyway */ @@ -1066,7 +1261,10 @@ int main(int argc, char **argv) if (fsync(vol->fd) == -1) perr_exit("fsync"); - printf(resize_important_msg, vol->dev_name); + printf("Successfully resized NTFS on device '%s'.\n", vol->dev_name); + if (new_size < vol->nr_clusters) + printf(resize_important_msg); + return 0; } From a3e3e66651df4b2544ceb29d375a7c513c0f78c4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 10 Jan 2003 17:00:47 +0000 Subject: [PATCH 0378/2994] update from Szaka modified by me: new API disk_io.[hc]: ntfs_device_size_get() ported from mkntfs.c (Logical change 1.86) --- include/disk_io.h | 4 ++- libntfs/disk_io.c | 82 +++++++++++++++++++++++++++++++++++++++++++++- ntfsprogs/mkntfs.c | 70 +++------------------------------------ 3 files changed, 89 insertions(+), 67 deletions(-) diff --git a/include/disk_io.h b/include/disk_io.h index 266b9eb1..749e7c9b 100644 --- a/include/disk_io.h +++ b/include/disk_io.h @@ -1,7 +1,7 @@ /* * disk_io.h - Exports for disk io. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -37,5 +37,7 @@ extern s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, extern s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, const s64 count, const void *b); +extern s64 ntfs_device_size_get(int f, int block_size); + #endif /* defined _NTFS_DISK_IO_H */ diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index c6dc7235..63cd7933 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -1,7 +1,7 @@ /* * disk_io.c - Disk io functions. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -19,17 +19,27 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include #include #include +#ifdef HAVE_LINUX_FD_H +# include +# include +#endif #include "types.h" #include "disk_io.h" #include "mst.h" #include "debug.h" +#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE) +# define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ +#endif + /** * ntfs_pread - positioned read from disk * @fd: file descriptor to read from @@ -332,3 +342,73 @@ s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, return bw >> vol->cluster_size_bits; } +/** + * ntfs_device_offset_valid - test if a device offset is valid + * @f: open file descriptor of device + * @ofs: offset to test for validity + * + * Test if the offset @ofs is an existing location on the device described + * by the open file descriptor @f. + * + * Return 0 if it is valid and -1 if it is not valid. + */ +static inline int ntfs_device_offset_valid(int f, s64 ofs) +{ + char ch; + + if (lseek(f, ofs, SEEK_SET) >= 0 && read(f, &ch, 1) == 1) + return 0; + return -1; +} + +/** + * ntfs_device_size_get - return the size of a device in blocks + * @f: open file descriptor of device + * @block_size: block size in bytes in which to return the result + * + * Return the number of @block_size sized blocks in the device described by the + * open file descriptor @f. + * + * Adapted from e2fsutils-1.19, Copyright (C) 1995 Theodore Ts'o. + */ +s64 ntfs_device_size_get(int f, int block_size) +{ + s64 high, low; +#ifdef BLKGETSIZE + long size; + + if (ioctl(f, BLKGETSIZE, &size) >= 0) { + Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, + size); + return (s64)size * 512 / block_size; + } +#endif +#ifdef FDGETPRM + { struct floppy_struct this_floppy; + + if (ioctl(f, FDGETPRM, &this_floppy) >= 0) { + Dprintf("FDGETPRM nr 512 byte blocks = %ld (0x%ld)\n", + this_floppy.size, this_floppy.size); + return (s64)this_floppy.size * 512 / block_size; + } + } +#endif + /* + * We couldn't figure it out by using a specialized ioctl, + * so do binary search to find the size of the device. + */ + low = 0LL; + for (high = 1024LL; ntfs_device_offset_valid(f, high); high <<= 1) + low = high; + while (low < high - 1LL) { + const s64 mid = (low + high) / 2; + + if (ntfs_device_offset_valid(f, mid)) + low = mid; + else + high = mid; + } + lseek(f, 0LL, SEEK_SET); + return (low + 1LL) / block_size; +} + diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index fa8363fa..f723bbef 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -64,12 +64,8 @@ #ifdef HAVE_ERRNO_H # include #endif -#include -#ifdef HAVE_LINUX_FD_H -# include -# include -#endif #include +#include #ifdef HAVE_GETOPT_H # include #else @@ -90,10 +86,6 @@ #endif #include -#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE) -# define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ -#endif - #if defined(__linux__) && defined(_IO) && !defined(BLKSSZGET) # define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytse. */ #endif @@ -2407,59 +2399,6 @@ void mkntfs_exit(void) #define MAKE_MFT_REF(_ref, _seqno) cpu_to_le64((((u64)(_seqno)) << 48) \ | ((u64)(_ref))) -static inline int valid_offset(int f, long long ofs) -{ - char ch; - - if (lseek(f, ofs, SEEK_SET) >= 0 && read(f, &ch, 1) == 1) - return 1; - return 0; -} - -/* - * Returns the number of bs sized blocks in a partition. Adapted from - * e2fsutils-1.19, Copyright (C) 1995 Theodore Ts'o. - */ -long long get_device_size(int f, int bs) -{ - long long high, low; -#ifdef BLKGETSIZE - long size; - - if (ioctl(f, BLKGETSIZE, &size) >= 0) { - Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, - size); - return (long long)size * 512 / bs; - } -#endif -#ifdef FDGETPRM - { struct floppy_struct this_floppy; - - if (ioctl(f, FDGETPRM, &this_floppy) >= 0) { - Dprintf("FDGETPRM nr 512 byte blocks = %ld (0x%ld)\n", - this_floppy.size, this_floppy.size); - return (long long)this_floppy.size * 512 / bs; - } - } -#endif - /* - * We couldn't figure it out by using a specialized ioctl, - * so do binary search to find the size of the partition. - */ - low = 0LL; - for (high = 1024LL; valid_offset(f, high); high <<= 1) - low = high; - while (low < high - 1LL) { - const long long mid = (low + high) / 2; - - if (valid_offset(f, mid)) - low = mid; - else - high = mid; - } - lseek(f, 0LL, SEEK_SET); - return (low + 1LL) / bs; -} int main(int argc, char **argv) { @@ -2612,10 +2551,11 @@ int main(int argc, char **argv) Dprintf("sector size = %i bytes\n", opt.sector_size); /* If user didn't specify the number of sectors, determine it now. */ if (!opt.nr_sectors) { - opt.nr_sectors = get_device_size(vol->fd, opt.sector_size); + opt.nr_sectors = ntfs_device_size_get(vol->fd, opt.sector_size); if (opt.nr_sectors <= 0) - err_exit("get_device_size(%s) failed. Please specify " - "it manually.\n", vol->dev_name); + err_exit("ntfs_device_size_get(%s) failed. Please " + "specify it manually.\n", + vol->dev_name); } Dprintf("number of sectors = %Ld (0x%Lx)\n", opt.nr_sectors, opt.nr_sectors); From 4fa72f72f12b8e54c496a9e4e6134ae0dfc64fe5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 10 Jan 2003 17:00:47 +0000 Subject: [PATCH 0379/2994] update from Szaka modified by me: new API disk_io.[hc]: ntfs_device_size_get() ported from mkntfs.c ntfsinfo.c: mount read-only (Szaka) ntfsresize.8.in and ntfsresize.c: updates from Szaka hand applied by me BKrev: 3e1efc3fD5iR261bB7ryDGqmn20AqQ From 930cf0f7127013b05acfa7d529388eb15c4dcb2f Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sat, 11 Jan 2003 00:26:41 +0000 Subject: [PATCH 0380/2994] two new helpers, one to generate pathnames, the other for attribute names (Logical change 1.87) --- ntfsprogs/ntfscluster.c | 206 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 197 insertions(+), 9 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index df6db7de..389d9a3a 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -90,7 +90,7 @@ void usage (void) " -i --info Print information about the volume\n" " -c range --cluster range Look for objects in this range of clusters\n" " -s range --sector range Look for objects in this range of sectors\n" - " -l --last Find the last file on the volume\n" + /* " -l --last Find the last file on the volume\n" */ "\n" " -f --force Use less caution\n" " -q --quiet Less output\n" @@ -112,13 +112,13 @@ void usage (void) */ int parse_options (int argc, char **argv) { - static const char *sopt = "-c:fhilqs:vV"; + static const char *sopt = "-c:fhiqs:vV"; // l static const struct option lopt[] = { { "cluster", required_argument, NULL, 'c' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "info", no_argument, NULL, 'i' }, - { "last", no_argument, NULL, 'l' }, + //{ "last", no_argument, NULL, 'l' }, { "quiet", no_argument, NULL, 'q' }, { "sector", required_argument, NULL, 's' }, { "verbose", no_argument, NULL, 'v' }, @@ -169,12 +169,14 @@ int parse_options (int argc, char **argv) err++; } break; + /* case 'l': if (opts.action == act_none) opts.action = act_last; else opts.action = act_error; break; + */ case 'q': opts.quiet++; break; @@ -287,6 +289,185 @@ int mftrec_in_use (ntfs_volume *vol, MFT_REF mref) return (buffer[byte] & bit); } + +/** + * get_inode_name + * + * using inode + * get filename + * add name to list + * get parent + * if parent is 5 (/) stop + * get inode of parent + */ +int get_inode_name (ntfs_inode *inode, char *buffer, int bufsize) +{ + // XXX option: names = posix/win32 or dos + // flags: path, filename, or both + const int max_path = 20; + + ntfs_volume *vol; + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *rec; + FILE_NAME_ATTR *attr; + int name_space; + MFT_REF parent = FILE_root; + char *names[max_path + 1]; + int i, len, offset = 0; + + if (!inode || !buffer) + return 0; + + vol = inode->vol; + + //printf ("sizeof (char*) = %d, sizeof (names) = %d\n", sizeof (char*), sizeof (names)); + memset (names, 0, sizeof (names)); + memset (buffer, 0, bufsize); //XXX remove + + for (i = 0; i < max_path; i++) { + + ctx = ntfs_attr_get_search_ctx (inode, NULL); + if (!ctx) { + Eprintf ("Couldn't create a search context.\n"); + return 0; + } + + //printf ("i = %d, inode = %p (%lld)\n", i, inode, inode->mft_no); + + name_space = 4; + while ((rec = find_attribute (AT_FILE_NAME, ctx))) { + /* We know this will always be resident. */ + attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); + + if (attr->file_name_type >= name_space) { //XXX find the ... + continue; + } + + name_space = attr->file_name_type; + parent = attr->parent_directory; + + if (names[i]) { + free (names[i]); + names[i] = NULL; + } + + if (ntfs_ucstombs (attr->file_name, attr->file_name_length, + &names[i], attr->file_name_length) < 0) { + Eprintf ("Couldn't translate filename to current locale.\n"); + // ? + } + + //printf ("names[%d] %s\n", i, names[i]); + //printf ("parent = %lld\n", MREF (parent)); + } + + ntfs_attr_put_search_ctx(ctx); + if (MREF (parent) == FILE_root) { + //printf ("inode 5\n"); + break; + } + + if (i > 0) { /* Don't close the original inode */ + ntfs_inode_close (inode); + } + + inode = ntfs_inode_open (vol, parent); + if (!inode) { + //Eprintf () + } + } + + if (i >= max_path) { + // trouble + } + + for (i = max_path; i >= 0; i--) { + if (!names[i]) + continue; + + len = snprintf (buffer + offset, bufsize - offset, "/%s", names[i]); + //printf ("len = %d, offset = %d\n", len, offset); + if (len >= (bufsize - offset)) { + Eprintf ("Pathname was truncated.\n"); + break; + } + + offset += len; + free (names[i]); + } + + //printf ("Pathname: %s\n", buffer); + + return 0; +} + +/** + * get_attr_name + */ +int get_attr_name (ATTR_RECORD *attr, char *buffer, int bufsize) +{ + static const char *attrs[] = { + NULL, + "$STANDARD_INFORMATION", + "$ATTRIBUTE_LIST", + "$FILE_NAME", + "$OBJECT_ID", + "$SECURITY_DESCRIPTOR", + "$VOLUME_NAME", + "$VOLUME_INFORMATION", + "$DATA", + "$INDEX_ROOT", + "$INDEX_ALLOCATION", + "$BITMAP", + "$REPARSE_POINT", + "$EA_INFORMATION", + "$EA", + "$PROPERTY_SET", + "$LOGGED_UTILITY_STREAM", + }; + int len, offset = 0; + const char *name; + char *attr_name = NULL; + + // flags: attr, name, or both + if (!attr || !buffer) + return 0; + + memset (buffer, 0, bufsize); // XXX remove + + if ((attr->type < 0x10) || (attr->type > 0x100) || (attr->type & 0x0F)) { + Eprintf ("Unknown attribute type 0x%02x\n", attr->type); + name = ""; + } else { + name = attrs[attr->type >> 4]; + } + + len = snprintf (buffer, bufsize, "%s", name); + if (len >= bufsize) { + Eprintf ("Attribute type was truncated.\n"); + return 0; + } + + offset += len; + + if (!attr->name_length) { + return 0; + } + + if (ntfs_ucstombs ((uchar_t *)((char *)attr + attr->name_offset), + attr->name_length, &attr_name, attr->name_length) < 0) { + Eprintf ("Couldn't translate attribute name to current locale.\n"); + // ? + return 0; + } + + snprintf (buffer + offset, bufsize - offset, "(%s)", attr_name); + free (attr_name); + + return 0; +} + + /** * cluster_find */ @@ -367,13 +548,18 @@ int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) //Vprintf ("\t\t%lld\t%lld\t%lld\n", runs[j].vcn, runs[j].lcn, runs[j].length); //dprint list - if (a_begin > s_end) { - continue; // after search range (5) + if ((a_begin > s_end) || (a_end < s_begin)) + continue; // before or after search range + + { + char buffer[256]; + get_inode_name (inode, buffer, sizeof (buffer)); + //XXX distinguish between file/dir + printf ("inode %d %s", i, buffer); + get_attr_name (ctx->attr, buffer, sizeof (buffer)); + printf ("/%s\n", buffer); + //printf ("\n"); } - if (a_end < s_begin) { - continue; // before search range (1) - } - printf ("inode %d matches\n", i); break; } } @@ -424,9 +610,11 @@ int main (int argc, char *argv[]) Iprintf ("Searching for cluster range %lld-%lld\n", opts.range_begin, opts.range_end); result = cluster_find (vol, opts.range_begin, opts.range_end); break; + /* case act_last: printf ("Last\n"); break; + */ case act_info: default: printf ("Info\n"); From a82c2638b5b11e32bc7ccbba37025135bb921b57 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sat, 11 Jan 2003 00:26:41 +0000 Subject: [PATCH 0381/2994] two new helpers, one to generate pathnames, the other for attribute names BKrev: 3e1f64c1bOMCI8Bh7nKfiL-SBtEMjQ From fd4f5e41ca75925d35bf9bfbf17a9b369e6b54e0 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sat, 11 Jan 2003 02:09:53 +0000 Subject: [PATCH 0382/2994] convert undelete to use the shared utils BKrev: 3e1f7cf1jhLnYtonoEJ4h2wiCn1Qjw From 986c523c3352d9bfe79db1485a6e9e21ee429090 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sat, 11 Jan 2003 02:09:53 +0000 Subject: [PATCH 0383/2994] make undelete use the utils (Logical change 1.88) --- ntfsprogs/Makefile.am | 2 +- ntfsprogs/Makefile.in | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 5d750aab..dbef2436 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -49,7 +49,7 @@ ntfsinfo_SOURCES = ntfsinfo.c ntfsinfo_LDADD = $(AM_LIBS) ntfsinfo_LDFLAGS = $(AM_LFLAGS) -ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h +ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h utils.c utils.h ntfsundelete_LDADD = $(AM_LIBS) ntfsundelete_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index a442f7e7..a9970ae5 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -132,7 +132,7 @@ ntfsinfo_SOURCES = ntfsinfo.c ntfsinfo_LDADD = $(AM_LIBS) ntfsinfo_LDFLAGS = $(AM_LFLAGS) -ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h +ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h utils.c utils.h ntfsundelete_LDADD = $(AM_LIBS) ntfsundelete_LDFLAGS = $(AM_LFLAGS) @@ -219,7 +219,7 @@ ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) +ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ From 4633bcf2dec355e9d8dc7176ac94646595a79c57 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sat, 11 Jan 2003 02:09:53 +0000 Subject: [PATCH 0384/2994] one include and 256 lines shed (Logical change 1.88) --- ntfsprogs/ntfsundelete.c | 271 +++------------------------------------ 1 file changed, 15 insertions(+), 256 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index fdd32975..b01eed08 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -49,6 +49,7 @@ #include "layout.h" #include "inode.h" #include "disk_io.h" +#include "utils.h" static const char *AUTHOR = "Richard Russon (FlatCap)"; static const char *EXEC_NAME = "ntfsundelete"; @@ -58,49 +59,12 @@ static char *NONE = ""; static char *UNKNOWN = "unknown"; static struct options opts; +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF (Iprintf, stdout, &opts.quiet, FALSE) + #define _(S) gettext(S) -/** - * Eprintf - Print error messages - */ -void Eprintf (const char *format, ...) -{ - va_list va; - va_start (va, format); - vfprintf (stderr, format, va); - va_end (va); -} - -/** - * Iprintf - Print informative messages - */ -void Iprintf (const char *format, ...) -{ - va_list va; -#ifndef DEBUG - if (opts.quiet) - return; -#endif - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -} - -/** - * Vprintf - Print verbose messages - */ -void Vprintf (const char *format, ...) -{ - va_list va; -#ifndef DEBUG - if (!opts.verbose) - return; -#endif - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -} - /** * Dprintf - Print debug messages */ @@ -310,121 +274,6 @@ int parse_time (const char *value, time_t *since) return 1; } -/** - * parse_size - Convert a string representing a size - * @value: String to be parsed - * @size: Parsed size - * - * Read a string and convert it to a number. Strings may be suffixed to scale - * them. Any number without a suffix is assumed to be in bytes. - * - * Suffix Description Multiple - * [tT] Terabytes 10^12 - * [gG] Gigabytes 10^9 - * [mM] Megabytes 10^6 - * [kK] Kilobytes 10^3 - * - * Notes: - * Only the first character of the suffix is read. - * The multipliers are decimal thousands, not binary: 1000, not 1024. - * If parse_size fails, @size will not be changed - * - * Return: 1 Success - * 0 Error, the string was malformed - */ -int parse_size (const char *value, long long *size) -{ - long long result; - char *suffix = NULL; - - if (!value || !size) - return 0; - - Dprintf ("Parsing size '%s'.\n", value); - - result = strtoll (value, &suffix, 10); - if (result < 0 || errno == ERANGE) { - Eprintf ("Invalid size '%s'.\n", value); - return 0; - } - - if (!suffix) { - Eprintf ("Internal error, strtoll didn't return a suffix.\n"); - return 0; - } - - - /*if (strlen (suffix) > 1) { - Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); - return 0; - } Can't do this because of ranges*/ - - switch (suffix[0]) { - case 't': case 'T': result *= 1000; - case 'g': case 'G': result *= 1000; - case 'm': case 'M': result *= 1000; - case 'k': case 'K': result *= 1000; - case '-': case 0: - break; - default: - Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); - return 0; - } - - Dprintf ("Parsed size = %lld.\n", result); - *size = result; - return 1; -} - -/** - * parse_range - Convert a string representing a range of numbers - * @string: The string to be parsed - * @start: The beginning of the range will be stored here - * @finish: The end of the range will be stored here - * - * Read a string of the form n-m. If the lower end is missing, zero will be - * substituted. If the upper end is missing LONG_MAX will be used. If the - * string cannot be parsed correctly, @start and @finish will not be changed. - * - * Return: 1 Success, a valid string was found - * 0 Error, the string was not a valid range - */ -int parse_range (const char *string, long long *start, long long *finish) -{ - long long a, b; - char *middle; - - if (!string || !start || !finish) - return 0; - - middle = strchr (string, '-'); - if (string == middle) { - Dprintf ("Range has no beginning, defaulting to 0.\n"); - a = 0; - } else { - if (!parse_size (string, &a)) - return 0; - } - - if (middle) { - if (middle[1] == 0) { - b = LONG_MAX; - Dprintf ("Range has no end, defaulting to %lld.\n", b); - } else { - if (!parse_size (middle+1, &b)) - return 0; - } - } else { - b = a; - } - - Dprintf ("Range '%s' = %lld - %lld\n", string, a, b); - - *start = a; - *finish = b; - return 1; -} - /** * parse_options - Read and validate the programs command line * @@ -495,7 +344,8 @@ int parse_options (int argc, char *argv[]) break; case 'c': if (opts.mode == MODE_NONE) { - if (!parse_range (argv[optind-1], &opts.mft_begin, &opts.mft_end)) + if (!utils_parse_range (argv[optind-1], + &opts.mft_begin, &opts.mft_end, TRUE)) err++; opts.mode = MODE_COPY; } else { @@ -550,8 +400,8 @@ int parse_options (int argc, char *argv[]) break; case 'S': if ((opts.size_begin > 0) || (opts.size_end > 0) || - !parse_range (argv[optind-1], &opts.size_begin, - &opts.size_end)) { + !utils_parse_range (argv[optind-1], &opts.size_begin, + &opts.size_end, TRUE)) { err++; } break; @@ -703,85 +553,6 @@ void free_file (struct ufile *file) free (file); } -/** - * ntfs2utc - Convert an NTFS time to Unix time - * @time: An NTFS time in 100ns units since 1601 - * - * NTFS stores times as the number of 100ns intervals since January 1st 1601 at - * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. - * - * Return: n A Unix time (number of seconds since 1970) - */ -time_t ntfs2utc (long long time) -{ - return (time - ((long long) (369 * 365 + 89) * 24 * 3600 * 10000000)) / 10000000; -} - -/** - * find_attribute - Find an attribute of the given type - * @type: An attribute type, e.g. AT_FILE_NAME - * @ctx: A search context, created using ntfs_get_attr_search_ctx - * - * Using the search context to keep track, find the first/next occurrence of a - * given attribute type. - * - * N.B. This will return a pointer into @mft. As long as the search context - * has been created without an inode, it won't overflow the buffer. - * - * Return: Pointer Success, an attribute was found - * NULL Error, no matching attributes were found - */ -ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) -{ - if (!ctx) - return NULL; - - if (ntfs_attr_lookup(type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { - Dprintf ("find_attribute didn't find an attribute of type: 0x%02x.\n", type); - return NULL; /* None / no more of that type */ - } - - Dprintf ("find_attribute found an attribute of type: 0x%02x.\n", type); - return ctx->attr; -} - -/** - * find_first_attribute - Find the first attribute of a given type - * @type: An attribute type, e.g. AT_FILE_NAME - * @mft: A buffer containing a raw MFT record - * - * Search through a raw MFT record for an attribute of a given type. - * The return value is a pointer into the MFT record that was supplied. - * - * N.B. This will return a pointer into @mft. The pointer won't stray outside - * the buffer, since we created the search context without an inode. - * - * Return: Pointer Success, an attribute was found - * NULL Error, no matching attributes were found - */ -ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) -{ - ntfs_attr_search_ctx *ctx; - ATTR_RECORD *rec; - - if (!mft) - return NULL; - - ctx = ntfs_attr_get_search_ctx(NULL, mft); - if (!ctx) { - Eprintf ("Couldn't create a search context.\n"); - return NULL; - } - - rec = find_attribute (type, ctx); - ntfs_attr_put_search_ctx(ctx); - if (rec) - Dprintf ("find_first_attribute: found attr of type 0x%02x.\n", type); - else - Dprintf ("find_first_attribute: didn't find attr of type 0x%02x.\n", type); - return rec; -} - /** * get_filenames - Read an MFT Record's $FILENAME attributes * @file: The file object to work with @@ -1920,7 +1691,7 @@ int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) for (i = mft_begin; i <= mft_end; i++) { if (ntfs_attr_pread (mft, vol->mft_record_size * i, vol->mft_record_size, buffer) < vol->mft_record_size) { - Eprintf ("Couldn't read MFT Record %d: %s.\n", i, strerror (errno)); + Eprintf ("Couldn't read MFT Record %lld: %s.\n", i, strerror (errno)); goto close; } @@ -1930,7 +1701,7 @@ int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) } } - Vprintf ("Read %d MFT Records\n", mft_end - mft_begin + 1); + Vprintf ("Read %lld MFT Records\n", mft_end - mft_begin + 1); result = 0; close: close (fd); @@ -2006,29 +1777,17 @@ int valid_device (const char *name, int force) */ int main (int argc, char *argv[]) { - const char *locale; ntfs_volume *vol; int result = 1; - locale = setlocale (LC_ALL, ""); - if (!locale) { - locale = setlocale (LC_ALL, NULL); - Vprintf ("Failed to set locale, using default '%s'.\n", locale); - } else { - Vprintf ("Using locale '%s'.\n", locale); - } + utils_set_locale(); if (!parse_options (argc, argv)) goto free; - if (!valid_device (opts.device, opts.force)) - goto free; - - vol = ntfs_mount (opts.device, MS_RDONLY); - if (!vol) { - Eprintf ("Couldn't mount device '%s': %s\n", opts.device, strerror (errno)); - goto free; - } + vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); + if (!vol) + return 1; if (vol->flags & VOLUME_IS_DIRTY) { Iprintf ("Volume is dirty.\n"); From 3580d984fb6021314b5821aac6bcb2c0860b16b1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 11 Jan 2003 11:25:17 +0000 Subject: [PATCH 0385/2994] man page update from Szaka (Logical change 1.89) --- ntfsprogs/ntfsresize.8.in | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 8bfff30c..6e5c744b 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -48,7 +48,7 @@ underlying partition first. This can be done using by deleting the partition and recreating it with a larger size. Then you may use .B ntfsresize -to shrink the size of the filesystem. +to enlarge the size of the filesystem. .PP If you wish to shrink an NTFS partition, first use .B ntfsresize @@ -62,9 +62,12 @@ When recreating the partition with .BR fdisk (8) make sure you create it with the same starting disk cylinder and partition type -as before. If you shrink a partition also make sure you do not make -it smaller than the new size -of the NTFS filesystem! Otherwise you may lose your entire filesystem. +as before. +If you enlarge a partition make sure it will not overlap with +an other existing partition! +If you shrink a partition, do not make +it smaller than the new size of the NTFS filesystem! +Otherwise you may lose your entire filesystem. Also make sure you set the bootable flag for the partition if it existed before. Failing to do so you might not be able to boot your computer from the disk! From 264d6af6d86e8f86a42e5bdfea5fa9c79a6e6278 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 11 Jan 2003 11:25:17 +0000 Subject: [PATCH 0386/2994] man page update from Szaka BKrev: 3e1fff1dfArknG2t6lZwqS9LTvzZ7A From d5c401416857c5c035987247748c73a1cb69c132 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 12 Jan 2003 19:03:20 +0000 Subject: [PATCH 0387/2994] (Logical change 1.90) --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index fd5b1371..06bd352f 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ fi AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(linux-ntfs,1.6.99) +AM_INIT_AUTOMAKE(ntfsprogs,1.6.99) AM_MAINTAINER_MODE From b57e04f615f265b137f62218aea532026e087f1c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 12 Jan 2003 19:03:20 +0000 Subject: [PATCH 0388/2994] change source package name in configure.in to ntfsprogs. (Szaka) (Logical change 1.90) --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 618d133a..f89bfdd2 100755 --- a/configure +++ b/configure @@ -964,7 +964,7 @@ else fi -PACKAGE=linux-ntfs +PACKAGE=ntfsprogs VERSION=1.6.99 @@ -5712,7 +5712,7 @@ fi echo $ac_n "checking version of $_cc""... $ac_c" 1>&6 echo "configure:5715: checking version of $_cc" >&5 -cc_version=`$_cc --version 2>&1 | head -1 | sed 's/egcs-//' | sed 's/gcc (GCC) \([0-9]\.[0-9]\).*/\1/'` +cc_version=`$_cc --version 2>&1 | head -1 | sed 's/egcs-//' | sed 's/gcc (GCC) \(0-9\.0-9\).*/\1/'` cc_major=`echo $cc_version | cut -d'.' -f1` cc_minor=`echo $cc_version | cut -d'.' -f2` if test -z $cc_version; then From 84ea1fab57fb79d887c836d59975b97d7695236e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 12 Jan 2003 19:03:20 +0000 Subject: [PATCH 0389/2994] configure: change source package name in configure.in to ntfsprogs. (Szaka) BKrev: 3e21bbf89mLxzjr5Yc9B7EvHFjMdKg From dbd2bc132e23d96810df1e1df1809bc72996826c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 12 Jan 2003 19:21:06 +0000 Subject: [PATCH 0390/2994] (Logical change 1.91) --- ntfsprogs/Makefile.in | 44 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index a9970ae5..ae1e8107 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -174,61 +174,61 @@ PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) -I.. LIBS = @LIBS@ ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfsdump_logfile_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -dumplog_OBJECTS = dumplog.$(OBJEXT) -@REALLYSTATIC_TRUE@dumplog_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfsdump_logfile_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +dumplog_OBJECTS = dumplog.$(OBJEXT) @REALLYSTATIC_FALSE@dumplog_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@dumplog_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfstruncate_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) @REALLYSTATIC_FALSE@ntfstruncate_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfscluster_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfstruncate_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_FALSE@ntfscluster_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfsfix_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfscluster_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) @REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfsfix_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) @REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ sd.$(OBJEXT) mkntfs.$(OBJEXT) -@REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfslabel_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) @REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfslabel_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) @REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) From b17135422348c7845ef7f0926af277fc3f21c26b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 12 Jan 2003 19:21:06 +0000 Subject: [PATCH 0391/2994] Szaka: - more manual update - read-only checks are pushed down to the library - checking ntfs_get_size_for_mapping_pairs return values - relaxing/fixing mapping_pairs overflow conditions (Logical change 1.91) --- ntfsprogs/ntfsresize.c | 46 +++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index a4410a97..24590d88 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1,8 +1,8 @@ /** * ntfsresize - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Szabolcs Szakacsits - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2003 Szabolcs Szakacsits + * Copyright (c) 2002-2003 Anton Altaparmakov * * This utility will resize an NTFS volume. * @@ -728,7 +728,11 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) rl_set(rl_bad, 0LL, (LCN)LCN_HOLE, nr_clusters); rl_set(rl_bad + 1, nr_clusters, -1LL, 0LL); - mp_size = ntfs_get_size_for_mapping_pairs(vol, rl_bad); + if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl_bad)) == -1) + perr_exit("ntfs_get_size_for_mapping_pairs"); + + if (mp_size > a->length - a->mapping_pairs_offset) + err_exit("Enlarging attribute header isn't supported yet.\n"); if (!(mp = (char *)calloc(1, mp_size))) perr_exit("Couldn't get memory"); @@ -736,10 +740,6 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl_bad)) exit(1); - /* We must have at least 8 bytes free to hold the runlist */ - if (mp_size > 8) - perr_exit("ntfs_mapping_pairs_build"); - memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); a->highest_vcn = cpu_to_le64(nr_clusters - 1LL); a->allocated_size = cpu_to_le64(nr_clusters * vol->cluster_size); @@ -862,11 +862,11 @@ void truncate_bitmap_data_attr(ATTR_RECORD *a, s64 nr_clusters) else enlarge_bitmap_data_attr(&rl, nr_bm_clusters, nr_clusters); - mp_size = ntfs_get_size_for_mapping_pairs(vol, rl); - - /* We must have at least 8 bytes free to hold the runlist */ - if (mp_size > 8) - err_exit("Resizing attribute header isn't supported yet.\n"); + if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl)) == -1) + perr_exit("ntfs_get_size_for_mapping_pairs"); + + if (mp_size > a->length - a->mapping_pairs_offset) + err_exit("Enlarging attribute header isn't supported yet.\n"); if (!(mp = (char *)calloc(1, mp_size))) perr_exit("Couldn't get memory"); @@ -885,15 +885,13 @@ void truncate_bitmap_data_attr(ATTR_RECORD *a, s64 nr_clusters) * attribute too, for now chkdsk will do this for us. */ - if (!opt.ro_flag) { - size = ntfs_rl_pwrite(vol, rl, 0, bm_bsize, lcn_bitmap.bm); - if (bm_bsize != size) { - if (size == -1) - perr_exit("Couldn't write $Bitmap"); - printf("Couldn't write full $Bitmap file " - "(%lld from %lld)\n", size, bm_bsize); - exit(1); - } + size = ntfs_rl_pwrite(vol, rl, 0, bm_bsize, lcn_bitmap.bm); + if (bm_bsize != size) { + if (size == -1) + perr_exit("Couldn't write $Bitmap"); + printf("Couldn't write full $Bitmap file " + "(%lld from %lld)\n", size, bm_bsize); + exit(1); } free(rl); @@ -944,9 +942,6 @@ void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) */ int write_mft_record(ntfs_attr_search_ctx *ctx) { - if (opt.ro_flag) - return 0; - return ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec); } @@ -1130,9 +1125,6 @@ void prepare_volume_fixup() { u16 flags; - if (opt.ro_flag) - return; - flags = vol->flags | VOLUME_IS_DIRTY; if (vol->major_ver >= 2) flags |= VOLUME_MOUNTED_ON_NT4; From a188fd67d7f21c2ee709ea74c102ae48cc6a39f8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 12 Jan 2003 19:21:06 +0000 Subject: [PATCH 0392/2994] Szaka: - more manual update - read-only checks are pushed down to the library - checking ntfs_get_size_for_mapping_pairs return values - relaxing/fixing mapping_pairs overflow conditions BKrev: 3e21c022pbtkHeY0dqKb8l2YoNLuMQ From 416ce477d3bd55f5c1bb0336f7bf06de6d4f581d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 12 Jan 2003 19:21:06 +0000 Subject: [PATCH 0393/2994] Szaka: - more manual update - read-only checks are pushed down to the library - checking ntfs_get_size_for_mapping_pairs return values - relaxing/fixing mapping_pairs overflow conditions Szaka: - more manual update - read-only checks are pushed down to the library - checking ntfs_get_size_for_mapping_pairs return values - relaxing/fixing mapping_pairs overflow conditions (Logical change 1.91) --- ntfsprogs/ntfsresize.8.in | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 6e5c744b..1d4a3b3f 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -1,7 +1,7 @@ .\" -*- nroff -*- -.\" Copyright 2002 by Szabolcs Szakacsits All Rights Reserved. +.\" Copyright 2002-2003 by Szabolcs Szakacsits All Rights Reserved. .\" -.TH NTFSRESIZE 8 "November 2002" "Linux\-NTFS @VERSION@" +.TH NTFSRESIZE 8 "Jan 2003" "ntfsprogs @VERSION@" .SH NAME ntfsresize \- resize an NTFS filesystem .SH SYNOPSIS @@ -34,6 +34,10 @@ and .B -s are mutually exclusive. If both of them is omitted then the NTFS filesystem will be enlarged to the device size. +Before a real resize operation, always make a read-only +test run using the +.B -n +option. .PP The .B ntfsresize @@ -95,7 +99,7 @@ Using this option you can calculate the smallest shrunken volume size supported. This option will not make any changes to the filesystem. .TP .B -n -You can use this option to make a test run before doing the real resize operation. +Use this option to make a test run before doing the real resize operation. Volume will be opened read-only and .B ntfsresize displays what it would do if it were to resize the filesystem. @@ -130,7 +134,8 @@ man page formed the basis of this page. is part of the linux-ntfs package and is available from http://linux-ntfs.sourceforge.net/ as source and pre-compiled binary. .B ntfsresize -related news and FAQ (frequently asked questions) is maintained at +related news, example of usage and FAQ (frequently asked questions) +is maintained at http://mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html .SH SEE ALSO .BR fdisk (8), From f84e1e7a1c6e47c596ec11fb78532f6ec023caaf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Jan 2003 17:17:52 +0000 Subject: [PATCH 0394/2994] fix by Szaka (logic inversion in ntfs_device_size_get()) (Logical change 1.92) --- libntfs/disk_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index 63cd7933..8170475c 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -398,12 +398,12 @@ s64 ntfs_device_size_get(int f, int block_size) * so do binary search to find the size of the device. */ low = 0LL; - for (high = 1024LL; ntfs_device_offset_valid(f, high); high <<= 1) + for (high = 1024LL; !ntfs_device_offset_valid(f, high); high <<= 1) low = high; while (low < high - 1LL) { const s64 mid = (low + high) / 2; - if (ntfs_device_offset_valid(f, mid)) + if (!ntfs_device_offset_valid(f, mid)) low = mid; else high = mid; From f90a3b85ca6c1038d82217b903003b831450fce8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Jan 2003 17:17:52 +0000 Subject: [PATCH 0395/2994] fix by Szaka (logic inversion in ntfs_device_size_get()) BKrev: 3e22f4c0uR2kAGrz6-z9NbZqByPahw From 6087f46b6720abc8785f3bd2efaa63d286a616d4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Jan 2003 17:17:52 +0000 Subject: [PATCH 0396/2994] update (Logical change 1.92) --- libntfs/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 49ff17f0..9fee3776 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -115,8 +115,8 @@ all_includes = @all_includes@ all_libraries = @all_libraries@ LTVERSION = 4:0:0 -@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall -@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 +@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG +@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 -Wall linux_ntfsincludedir = -I$(top_srcdir)/include lib_LTLIBRARIES = libntfs.la From f00076764a92dfcf1d342dc3a78f81f0545356b2 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 13 Jan 2003 20:05:15 +0000 Subject: [PATCH 0397/2994] Added ntfsprogs/extra/printf.c ntfsprogs/extra/spinner.c ntfsprogs/extra/time.c ntfsprogs/extra/todo ntfsprogs/s ntfsprogs/todo to the ignore list (Logical change 1.93) --- BitKeeper/etc/ignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 5cc2a661..e2cf6f68 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -36,3 +36,9 @@ ntfsprogs/ntfsresize ntfsprogs/ntfstruncate ntfsprogs/ntfsundelete ntfsprogs/ntfswipe +ntfsprogs/extra/printf.c +ntfsprogs/extra/spinner.c +ntfsprogs/extra/time.c +ntfsprogs/extra/todo +ntfsprogs/s +ntfsprogs/todo From d159396b8ec63875204052d2265fa4653a903703 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 13 Jan 2003 20:05:15 +0000 Subject: [PATCH 0398/2994] a few minor tweaks moved two more functions to utils BKrev: 3e231bfbPEVpy-dHpyt9cnO9HCMvrw From f387921c31f178b91e4d750de3bf6195d13f294e Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 13 Jan 2003 20:05:15 +0000 Subject: [PATCH 0399/2994] export find_in_attrdef (Logical change 1.93) --- include/attrib.h | 3 +++ libntfs/attrib.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/attrib.h b/include/attrib.h index b48783db..cf9cd2ac 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -87,6 +87,9 @@ extern int ntfs_attr_lookup(const ATTR_TYPES type, const uchar_t *name, const VCN lowest_vcn, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx); +extern ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol, + const ATTR_TYPES type); + /** * ntfs_attrs_walk - syntactic sugar for walking all attributes in an inode * @ctx: initialised attribute search context diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 35e9a8a1..54da6e39 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1925,7 +1925,7 @@ void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) * ENOENT - The attribute @type is not specified in $AttrDef. * EINVAL - Invalid parameters (e.g. @vol is not valid). */ -static ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol, +ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol, const ATTR_TYPES type) { ATTR_DEF *ad; From 379692221b5b0f7ba0b23e1492862c6acda621e4 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 13 Jan 2003 20:05:15 +0000 Subject: [PATCH 0400/2994] get_inode_name & get_attr_name moved from ntfscluster (Logical change 1.93) --- ntfsprogs/utils.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++ ntfsprogs/utils.h | 5 ++ 2 files changed, 185 insertions(+) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index c0b10abe..15bcfa0f 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -34,6 +34,7 @@ #include #include "config.h" +#include "utils.h" #include "types.h" #include "volume.h" #include "debug.h" @@ -366,6 +367,185 @@ ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) return rec; } +/** + * utils_inode_get_name + * + * using inode + * get filename + * add name to list + * get parent + * if parent is 5 (/) stop + * get inode of parent + */ +int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) +{ + // XXX endian + // XXX option: names = posix/win32 or dos + // flags: path, filename, or both + const int max_path = 20; + + ntfs_volume *vol; + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *rec; + FILE_NAME_ATTR *attr; + int name_space; + MFT_REF parent = FILE_root; + char *names[max_path + 1];// XXX malloc? and make max bigger? + int i, len, offset = 0; + + if (!inode || !buffer) + return 0; + + vol = inode->vol; + + //printf ("sizeof (char*) = %d, sizeof (names) = %d\n", sizeof (char*), sizeof (names)); + memset (names, 0, sizeof (names)); + + for (i = 0; i < max_path; i++) { + + ctx = ntfs_attr_get_search_ctx (inode, NULL); + if (!ctx) { + Eprintf ("Couldn't create a search context.\n"); + return 0; + } + + //printf ("i = %d, inode = %p (%lld)\n", i, inode, inode->mft_no); + + name_space = 4; + while ((rec = find_attribute (AT_FILE_NAME, ctx))) { + /* We know this will always be resident. */ + attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); + + if (attr->file_name_type >= name_space) { //XXX find the ... + continue; + } + + name_space = attr->file_name_type; + parent = attr->parent_directory; + + if (names[i]) { + free (names[i]); + names[i] = NULL; + } + + if (ntfs_ucstombs (attr->file_name, attr->file_name_length, + &names[i], attr->file_name_length) < 0) { + char *temp; + Eprintf ("Couldn't translate filename to current locale.\n"); + temp = malloc (30); + if (!temp) + return 0; + snprintf (temp, 30, "", inode->mft_no); + names[i] = temp; + } + + //printf ("names[%d] %s\n", i, names[i]); + //printf ("parent = %lld\n", MREF (parent)); + } + + ntfs_attr_put_search_ctx(ctx); + + if (i > 0) /* Don't close the original inode */ + ntfs_inode_close (inode); + + if (MREF (parent) == FILE_root) { /* The root directory, stop. */ + //printf ("inode 5\n"); + break; + } + + inode = ntfs_inode_open (vol, parent); + if (!inode) { + Eprintf ("Couldn't open inode %lld.\n", MREF (parent)); + break; + } + } + + if (i >= max_path) { + /* If we get into an infinite loop, we'll end up here. */ + Eprintf ("The directory structure is too deep (over %d) nested directories.\n", max_path); + return 0; + } + + /* Assemble the names in the correct order. */ + for (i = max_path; i >= 0; i--) { + if (!names[i]) + continue; + + len = snprintf (buffer + offset, bufsize - offset, "%c%s", PATH_SEP, names[i]); + if (len >= (bufsize - offset)) { + Eprintf ("Pathname was truncated.\n"); + break; + } + + offset += len; + } + + /* Free all the allocated memory */ + for (i = 0; i < max_path; i++) + free (names[i]); + + Dprintf ("Pathname: %s\n", buffer); + + return 0; +} + +/** + * utils_attr_get_name + */ +int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int bufsize) +{ + int len, namelen, offset = 0; + char *name = NULL; + ATTR_DEF *attrdef; + + // flags: attr, name, or both + if (!attr || !buffer) + return 0; + + attrdef = ntfs_attr_find_in_attrdef (vol, attr->type); + if (attrdef) { + namelen = ntfs_ucsnlen (attrdef->name, sizeof (attrdef->name)); + if (ntfs_ucstombs (attrdef->name, namelen, &name, namelen) < 0) { + Eprintf ("Couldn't translate attribute type to current locale.\n"); + // ? + return 0; + } + len = snprintf (buffer, bufsize, "%s", name); + } else { + Eprintf ("Unknown attribute type 0x%02x\n", attr->type); + len = snprintf (buffer, bufsize, ""); + } + + if (len >= bufsize) { + Eprintf ("Attribute type was truncated.\n"); + return 0; + } + + offset += len; + + if (!attr->name_length) { + return 0; + } + + namelen = attr->name_length; + if (ntfs_ucstombs ((uchar_t *)((char *)attr + attr->name_offset), + namelen, &name, namelen) < 0) { + Eprintf ("Couldn't translate attribute name to current locale.\n"); + // ? + return 0; + } + + len = snprintf (buffer + offset, bufsize - offset, "(%s)", name); + free (name); + + if ((len + offset) >= bufsize) { + Eprintf ("Attribute name was truncated.\n"); + return 0; + } + + return 0; +} + #if 0 hamming weight diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 2183459d..8c6662b4 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -26,6 +26,9 @@ #include "types.h" #include "layout.h" +#include "volume.h" + +#define PATH_SEP '/' #define GEN_PRINTF(NAME, STREAM, CONTROL, TRIGGER) \ __attribute__ ((format (printf, 1, 2))) \ @@ -57,6 +60,8 @@ int utils_set_locale (void); ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force); int utils_parse_size (const char *value, s64 *size, BOOL scale); int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale); +int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize); +int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int bufsize); time_t ntfs2utc (s64 time); s64 utc2ntfs (time_t time); From c6dcb0afeec8340ce0f0344c16bf0fa26fc25a8b Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 13 Jan 2003 20:05:15 +0000 Subject: [PATCH 0401/2994] moved get_inode_name and get_attr_name to utils (Logical change 1.93) --- ntfsprogs/ntfscluster.c | 195 +++------------------------------------- 1 file changed, 11 insertions(+), 184 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 389d9a3a..1eedd022 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -289,185 +289,6 @@ int mftrec_in_use (ntfs_volume *vol, MFT_REF mref) return (buffer[byte] & bit); } - -/** - * get_inode_name - * - * using inode - * get filename - * add name to list - * get parent - * if parent is 5 (/) stop - * get inode of parent - */ -int get_inode_name (ntfs_inode *inode, char *buffer, int bufsize) -{ - // XXX option: names = posix/win32 or dos - // flags: path, filename, or both - const int max_path = 20; - - ntfs_volume *vol; - ntfs_attr_search_ctx *ctx; - ATTR_RECORD *rec; - FILE_NAME_ATTR *attr; - int name_space; - MFT_REF parent = FILE_root; - char *names[max_path + 1]; - int i, len, offset = 0; - - if (!inode || !buffer) - return 0; - - vol = inode->vol; - - //printf ("sizeof (char*) = %d, sizeof (names) = %d\n", sizeof (char*), sizeof (names)); - memset (names, 0, sizeof (names)); - memset (buffer, 0, bufsize); //XXX remove - - for (i = 0; i < max_path; i++) { - - ctx = ntfs_attr_get_search_ctx (inode, NULL); - if (!ctx) { - Eprintf ("Couldn't create a search context.\n"); - return 0; - } - - //printf ("i = %d, inode = %p (%lld)\n", i, inode, inode->mft_no); - - name_space = 4; - while ((rec = find_attribute (AT_FILE_NAME, ctx))) { - /* We know this will always be resident. */ - attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); - - if (attr->file_name_type >= name_space) { //XXX find the ... - continue; - } - - name_space = attr->file_name_type; - parent = attr->parent_directory; - - if (names[i]) { - free (names[i]); - names[i] = NULL; - } - - if (ntfs_ucstombs (attr->file_name, attr->file_name_length, - &names[i], attr->file_name_length) < 0) { - Eprintf ("Couldn't translate filename to current locale.\n"); - // ? - } - - //printf ("names[%d] %s\n", i, names[i]); - //printf ("parent = %lld\n", MREF (parent)); - } - - ntfs_attr_put_search_ctx(ctx); - if (MREF (parent) == FILE_root) { - //printf ("inode 5\n"); - break; - } - - if (i > 0) { /* Don't close the original inode */ - ntfs_inode_close (inode); - } - - inode = ntfs_inode_open (vol, parent); - if (!inode) { - //Eprintf () - } - } - - if (i >= max_path) { - // trouble - } - - for (i = max_path; i >= 0; i--) { - if (!names[i]) - continue; - - len = snprintf (buffer + offset, bufsize - offset, "/%s", names[i]); - //printf ("len = %d, offset = %d\n", len, offset); - if (len >= (bufsize - offset)) { - Eprintf ("Pathname was truncated.\n"); - break; - } - - offset += len; - free (names[i]); - } - - //printf ("Pathname: %s\n", buffer); - - return 0; -} - -/** - * get_attr_name - */ -int get_attr_name (ATTR_RECORD *attr, char *buffer, int bufsize) -{ - static const char *attrs[] = { - NULL, - "$STANDARD_INFORMATION", - "$ATTRIBUTE_LIST", - "$FILE_NAME", - "$OBJECT_ID", - "$SECURITY_DESCRIPTOR", - "$VOLUME_NAME", - "$VOLUME_INFORMATION", - "$DATA", - "$INDEX_ROOT", - "$INDEX_ALLOCATION", - "$BITMAP", - "$REPARSE_POINT", - "$EA_INFORMATION", - "$EA", - "$PROPERTY_SET", - "$LOGGED_UTILITY_STREAM", - }; - int len, offset = 0; - const char *name; - char *attr_name = NULL; - - // flags: attr, name, or both - if (!attr || !buffer) - return 0; - - memset (buffer, 0, bufsize); // XXX remove - - if ((attr->type < 0x10) || (attr->type > 0x100) || (attr->type & 0x0F)) { - Eprintf ("Unknown attribute type 0x%02x\n", attr->type); - name = ""; - } else { - name = attrs[attr->type >> 4]; - } - - len = snprintf (buffer, bufsize, "%s", name); - if (len >= bufsize) { - Eprintf ("Attribute type was truncated.\n"); - return 0; - } - - offset += len; - - if (!attr->name_length) { - return 0; - } - - if (ntfs_ucstombs ((uchar_t *)((char *)attr + attr->name_offset), - attr->name_length, &attr_name, attr->name_length) < 0) { - Eprintf ("Couldn't translate attribute name to current locale.\n"); - // ? - return 0; - } - - snprintf (buffer + offset, bufsize - offset, "(%s)", attr_name); - free (attr_name); - - return 0; -} - - /** * cluster_find */ @@ -553,11 +374,11 @@ int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) { char buffer[256]; - get_inode_name (inode, buffer, sizeof (buffer)); + utils_inode_get_name (inode, buffer, sizeof (buffer)); //XXX distinguish between file/dir printf ("inode %d %s", i, buffer); - get_attr_name (ctx->attr, buffer, sizeof (buffer)); - printf ("/%s\n", buffer); + utils_attr_get_name (vol, ctx->attr, buffer, sizeof (buffer)); + printf ("%c%s\n", PATH_SEP, buffer); //printf ("\n"); } break; @@ -600,14 +421,20 @@ int main (int argc, char *argv[]) switch (opts.action) { case act_sector: - Iprintf ("Searching for sector range %lld-%lld\n", opts.range_begin, opts.range_end); + if (opts.range_begin == opts.range_end) + Iprintf ("Searching for sector %lld\n", opts.range_begin); + else + Iprintf ("Searching for sector range %lld-%lld\n", opts.range_begin, opts.range_end); /* Convert to clusters */ opts.range_begin <<= (vol->cluster_size_bits - vol->sector_size_bits); opts.range_end <<= (vol->cluster_size_bits - vol->sector_size_bits); result = cluster_find (vol, opts.range_begin, opts.range_end); break; case act_cluster: - Iprintf ("Searching for cluster range %lld-%lld\n", opts.range_begin, opts.range_end); + if (opts.range_begin == opts.range_end) + Iprintf ("Searching for cluster %lld\n", opts.range_begin); + else + Iprintf ("Searching for cluster range %lld-%lld\n", opts.range_begin, opts.range_end); result = cluster_find (vol, opts.range_begin, opts.range_end); break; /* From 4a444739484c2a9e362de6909884b67b1badb6a0 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 14 Jan 2003 20:13:19 +0000 Subject: [PATCH 0402/2994] hmm, so _that's_ what the ignore button does :-) (Logical change 1.94) --- BitKeeper/etc/ignore | 6 ------ 1 file changed, 6 deletions(-) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index e2cf6f68..5cc2a661 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -36,9 +36,3 @@ ntfsprogs/ntfsresize ntfsprogs/ntfstruncate ntfsprogs/ntfsundelete ntfsprogs/ntfswipe -ntfsprogs/extra/printf.c -ntfsprogs/extra/spinner.c -ntfsprogs/extra/time.c -ntfsprogs/extra/todo -ntfsprogs/s -ntfsprogs/todo From 68150c114e53eb6c3e161747749d34e7ad441f71 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 14 Jan 2003 20:13:19 +0000 Subject: [PATCH 0403/2994] hmm, so _that's_ what the ignore button does :-) BKrev: 3e246f5fL-04BF-5tl2MbShUXjezLA From be92ff1b40862310e3ed64fbdf8d3e123efebace Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 14 Jan 2003 20:48:15 +0000 Subject: [PATCH 0404/2994] ignore vim temp files (Logical change 1.95) --- BitKeeper/etc/ignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 5cc2a661..6144f4bb 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -23,6 +23,8 @@ tags TAGS */tags */TAGS +.*swp +*/.*swp # specific programs ntfsprogs/dumplog From 54d3f226c678346da539b01f4f576c3fda29de10 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 14 Jan 2003 20:48:15 +0000 Subject: [PATCH 0405/2994] more migrated code (Logical change 1.95) --- ntfsprogs/utils.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++ ntfsprogs/utils.h | 2 + 2 files changed, 112 insertions(+) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 15bcfa0f..3124da61 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -546,6 +546,116 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int return 0; } +/** + * utils_cluster_in_use - Determine if a cluster is in use + * @vol: An ntfs volume obtained from ntfs_mount + * @lcn: The Logical Cluster Number to test + * + * The metadata file $Bitmap has one binary bit representing each cluster on + * disk. The bit will be set for each cluster that is in use. The function + * reads the relevant part of $Bitmap into a buffer and tests the bit. + * + * This function has a static buffer in which it caches a section of $Bitmap. + * If the lcn, being tested, lies outside the range, the buffer will be + * refreshed. + * + * Return: 1 Cluster is in use + * 0 Cluster is free space + * -1 Error occurred + */ +int utils_cluster_in_use (ntfs_volume *vol, long long lcn) +{ + static unsigned char buffer[512]; + static long long bmplcn = -sizeof (buffer) - 1; /* Which bit of $Bitmap is in the buffer */ + + int byte, bit; + ntfs_attr *attr; + + if (!vol) + return -1; + + /* Does lcn lie in the section of $Bitmap we already have cached? */ + if ((lcn < bmplcn) || (lcn >= (bmplcn + (sizeof (buffer) << 3)))) { + Dprintf ("Bit lies outside cache.\n"); + attr = ntfs_attr_open (vol->lcnbmp_ni, AT_DATA, NULL, 0); + if (!attr) { + Eprintf ("Couldn't open $Bitmap: %s\n", strerror (errno)); + return -1; + } + + /* Mark the buffer as in use, in case the read is shorter. */ + memset (buffer, 0xFF, sizeof (buffer)); + bmplcn = lcn & (~((sizeof (buffer) << 3) - 1)); + + if (ntfs_attr_pread (attr, (bmplcn>>3), sizeof (buffer), buffer) < 0) { + Eprintf ("Couldn't read $Bitmap: %s\n", strerror (errno)); + ntfs_attr_close (attr); + return -1; + } + + Dprintf ("Reloaded bitmap buffer.\n"); + ntfs_attr_close (attr); + } + + bit = 1 << (lcn & 7); + byte = (lcn >> 3) & (sizeof (buffer) - 1); + Dprintf ("cluster = %lld, bmplcn = %lld, byte = %d, bit = %d, in use %d\n", + lcn, bmplcn, byte, bit, buffer[byte] & bit); + + return (buffer[byte] & bit); +} + +/** + * utils_mftrec_in_use - Determine if a MFT Record is in use + * @vol: An ntfs volume obtained from ntfs_mount + * @mref: MFT Reference (inode number) + * + * The metadata file $BITMAP has one binary bit representing each record in the + * MFT. The bit will be set for each record that is in use. The function + * reads the relevant part of $BITMAP into a buffer and tests the bit. + * + * This function has a static buffer in which it caches a section of $BITMAP. + * If the mref, being tested, lies outside the range, the buffer will be + * refreshed. + * + * Return: 1 MFT Record is in use + * 0 MFT Record is unused + * -1 Error occurred + */ +int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref) +{ + static u8 buffer[512]; + static s64 bmpmref = -sizeof (buffer) - 1; /* Which bit of $BITMAP is in the buffer */ + + int byte, bit; + + if (!vol) + return -1; + + /* Does mref lie in the section of $Bitmap we already have cached? */ + if ((mref < bmpmref) || (mref >= (bmpmref + (sizeof (buffer) << 3)))) { + Dprintf ("Bit lies outside cache.\n"); + + /* Mark the buffer as not in use, in case the read is shorter. */ + memset (buffer, 0, sizeof (buffer)); + bmpmref = mref & (~((sizeof (buffer) << 3) - 1)); + + if (ntfs_attr_pread (vol->mftbmp_na, (bmpmref>>3), sizeof (buffer), buffer) < 0) { + Eprintf ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno)); + return -1; + } + + Dprintf ("Reloaded bitmap buffer.\n"); + } + + bit = 1 << (mref & 7); + byte = (mref >> 3) & (sizeof (buffer) - 1); + Dprintf ("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", + mref, bmpmref, byte, bit, buffer[byte] & bit); + + return (buffer[byte] & bit); +} + #if 0 hamming weight diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 8c6662b4..92d98ac6 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -62,6 +62,8 @@ int utils_parse_size (const char *value, s64 *size, BOOL scale); int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale); int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize); int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int bufsize); +int utils_cluster_in_use (ntfs_volume *vol, long long lcn); +int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref); time_t ntfs2utc (s64 time); s64 utc2ntfs (time_t time); From ec9bc05735f74f01a6dcb43b087d51f9b75ae782 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 14 Jan 2003 20:48:15 +0000 Subject: [PATCH 0406/2994] more rearranging BKrev: 3e24778fqzgBiAzn9glOBihpYPVlEQ From fa39b3f421422d08ac876bd8f6a5ce642301a00f Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 14 Jan 2003 20:48:15 +0000 Subject: [PATCH 0407/2994] more stuff moved to utils (Logical change 1.95) --- ntfsprogs/ntfsundelete.c | 128 +-------------------------------------- 1 file changed, 2 insertions(+), 126 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index b01eed08..b7c8ee24 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -794,65 +794,6 @@ struct ufile * read_record (ntfs_volume *vol, long long record) } -/** - * cluster_in_use - Determine if a cluster is in use - * @vol: An ntfs volume obtained from ntfs_mount - * @lcn: The Logical Cluster Number to test - * - * The metadata file $Bitmap has one binary bit representing each cluster on - * disk. The bit will be set for each cluster that is in use. The function - * reads the relevant part of $Bitmap into a buffer and tests the bit. - * - * This function has a static buffer in which it caches a section of $Bitmap. - * If the lcn, being tested, lies outside the range, the buffer will be - * refreshed. - * - * Return: 1 Cluster is in use - * 0 Cluster is free space - * -1 Error occurred - */ -int cluster_in_use (ntfs_volume *vol, long long lcn) -{ - static unsigned char buffer[512]; - static long long bmplcn = -sizeof (buffer) - 1; /* Which bit of $Bitmap is in the buffer */ - - int byte, bit; - ntfs_attr *attr; - - if (!vol) - return -1; - - /* Does lcn lie in the section of $Bitmap we already have cached? */ - if ((lcn < bmplcn) || (lcn >= (bmplcn + (sizeof (buffer) << 3)))) { - Dprintf ("Bit lies outside cache.\n"); - attr = ntfs_attr_open (vol->lcnbmp_ni, AT_DATA, NULL, 0); - if (!attr) { - Eprintf ("Couldn't open $Bitmap: %s\n", strerror (errno)); - return -1; - } - - /* Mark the buffer as in use, in case the read is shorter. */ - memset (buffer, 0xFF, sizeof (buffer)); - bmplcn = lcn & (~((sizeof (buffer) << 3) - 1)); - - if (ntfs_attr_pread (attr, (bmplcn>>3), sizeof (buffer), buffer) < 0) { - Eprintf ("Couldn't read $Bitmap: %s\n", strerror (errno)); - ntfs_attr_close (attr); - return -1; - } - - Dprintf ("Reloaded bitmap buffer.\n"); - ntfs_attr_close (attr); - } - - bit = 1 << (lcn & 7); - byte = (lcn >> 3) & (sizeof (buffer) - 1); - Dprintf ("cluster = %lld, bmplcn = %lld, byte = %d, bit = %d, in use %d\n", - lcn, bmplcn, byte, bit, buffer[byte] & bit); - - return (buffer[byte] & bit); -} - /** * calc_percentage - Calculate how much of the file is recoverable * @file: The file object to work with @@ -953,7 +894,7 @@ int calc_percentage (struct ufile *file, ntfs_volume *vol) end = rl[i].lcn + rl[i].length; for (j = start; j < end; j++) { - if (cluster_in_use (vol, j)) + if (utils_cluster_in_use (vol, j)) inuse++; else free++; @@ -1586,7 +1527,7 @@ int undelete_file (ntfs_volume *vol, long long inode) end = rl[i].lcn + rl[i].length; for (j = start; j < end; j++) { - if (cluster_in_use (vol, j)) { + if (utils_cluster_in_use (vol, j)) { memset (buffer, opts.fillbyte, bufsize); if (write_data (fd, buffer, bufsize) < bufsize) { Eprintf ("Write failed: %s\n", strerror (errno)); @@ -1712,61 +1653,6 @@ free: return result; } -/** - * valid_device - Perform some safety checks on the device, before we start - * @name: Full pathname of the device/file to work with - * @force: Continue regardless of problems - * - * Check that the name refers to a device and that is isn't already mounted. - * These checks can be overridden by using the force option. - * - * Return: 1 Success, we can continue - * 0 Error, we cannot use this device - */ -int valid_device (const char *name, int force) -{ - unsigned long mnt_flags = 0; - struct stat st; - - if (stat (name, &st) == -1) { - if (errno == ENOENT) { - Eprintf ("The device %s doesn't exist\n", name); - } else { - Eprintf ("Error getting information about %s: %s\n", name, strerror (errno)); - } - return 0; - } - - if (!S_ISBLK (st.st_mode)) { - Vprintf ("%s is not a block device.\n", name); - if (!force) { - Eprintf ("Use the force option to work with files.\n"); - return 0; - } - Vprintf ("Forced to continue.\n"); - } - - /* Make sure the file system is not mounted. */ - if (ntfs_check_if_mounted (name, &mnt_flags)) { - Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); - if (!force) { - Eprintf ("Use the force option to ignore this error.\n"); - return 0; - } - Vprintf ("Forced to continue.\n"); - } else if (mnt_flags & NTFS_MF_MOUNTED) { - Vprintf ("The device %s, is mounted.\n", name); - if (!force) { - Eprintf ("Use the force option to work a mounted filesystem.\n"); - return 0; - } - Vprintf ("Forced to continue.\n"); - } - - Dprintf ("Device %s, will be used\n", name); - return 1; -} - /** * main - Begin here * @@ -1789,15 +1675,6 @@ int main (int argc, char *argv[]) if (!vol) return 1; - if (vol->flags & VOLUME_IS_DIRTY) { - Iprintf ("Volume is dirty.\n"); - if (!opts.force) { - Eprintf ("Run chkdsk and try again, or use the --force option.\n"); - goto umount; - } - Iprintf ("Forced to continue.\n"); - } - switch (opts.mode) { case MODE_SCAN: result = !scan_disk (vol); @@ -1819,7 +1696,6 @@ int main (int argc, char *argv[]) ; /* Cannot happen */ } -umount: ntfs_umount (vol, FALSE); free: if (opts.match) From fe038bd2dcdd1e8240a43be9ecebb91ce6336ad2 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 14 Jan 2003 20:48:15 +0000 Subject: [PATCH 0408/2994] move code to utils check that at least one cluster is in use, before starting (Logical change 1.95) --- ntfsprogs/ntfscluster.c | 80 ++++++++++++----------------------------- 1 file changed, 22 insertions(+), 58 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 1eedd022..e93acb10 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -238,64 +238,13 @@ int parse_options (int argc, char **argv) return (!err && !help && !ver); } -/** - * mftrec_in_use - Determine if a MFT Record is in use - * @vol: An ntfs volume obtained from ntfs_mount - * @mref: MFT Reference (inode number) - * - * The metadata file $BITMAP has one binary bit representing each record in the - * MFT. The bit will be set for each record that is in use. The function - * reads the relevant part of $BITMAP into a buffer and tests the bit. - * - * This function has a static buffer in which it caches a section of $BITMAP. - * If the mref, being tested, lies outside the range, the buffer will be - * refreshed. - * - * Return: 1 MFT Record is in use - * 0 MFT Record is unused - * -1 Error occurred - */ -int mftrec_in_use (ntfs_volume *vol, MFT_REF mref) -{ - static u8 buffer[512]; - static s64 bmpmref = -sizeof (buffer) - 1; /* Which bit of $BITMAP is in the buffer */ - - int byte, bit; - - if (!vol) - return -1; - - /* Does mref lie in the section of $Bitmap we already have cached? */ - if ((mref < bmpmref) || (mref >= (bmpmref + (sizeof (buffer) << 3)))) { - Dprintf ("Bit lies outside cache.\n"); - - /* Mark the buffer as not in use, in case the read is shorter. */ - memset (buffer, 0, sizeof (buffer)); - bmpmref = mref & (~((sizeof (buffer) << 3) - 1)); - - if (ntfs_attr_pread (vol->mftbmp_na, (bmpmref>>3), sizeof (buffer), buffer) < 0) { - Eprintf ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno)); - return -1; - } - - Dprintf ("Reloaded bitmap buffer.\n"); - } - - bit = 1 << (mref & 7); - byte = (mref >> 3) & (sizeof (buffer) - 1); - Dprintf ("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", - mref, bmpmref, byte, bit, buffer[byte] & bit); - - return (buffer[byte] & bit); -} - /** * cluster_find */ int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) { - int i; - int result = 1; + u64 i; + int in_use = 0, result = 1; u8 *buffer; if (!vol) @@ -307,29 +256,44 @@ int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) return 1; } + for (i = s_begin; i < s_end; i++) { + if (utils_cluster_in_use (vol, i) == 1) { + in_use = 1; + break; + } + } + + if (!in_use) { + if (s_begin == s_end) + printf ("clusters isn't in use\n"); + else + printf ("clusters aren't in use\n"); + return 0; + } + // first, is the cluster in use in $Bitmap? for (i = 0; i < vol->nr_mft_records; i++) { ntfs_inode *inode; ntfs_attr_search_ctx *ctx; - if (!mftrec_in_use (vol, i)) { + if (!utils_mftrec_in_use (vol, i)) { //printf ("%d skipped\n", i); continue; } inode = ntfs_inode_open (vol, i); if (!inode) { - Eprintf ("Can't read inode %d\n", i); + Eprintf ("Can't read inode %lld\n", i); goto free; } if (inode->nr_extents == -1) { - printf ("inode %d is an extent record\n", i); + printf ("inode %lld is an extent record\n", i); goto close; } - Vprintf ("Inode: %d\n", i); + Vprintf ("Inode: %lld\n", i); ctx = ntfs_attr_get_search_ctx (inode, NULL); if (ntfs_attr_lookup (AT_STANDARD_INFORMATION, NULL, 0, IGNORE_CASE, 0, NULL, 0, ctx) < 0) { @@ -376,7 +340,7 @@ int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) char buffer[256]; utils_inode_get_name (inode, buffer, sizeof (buffer)); //XXX distinguish between file/dir - printf ("inode %d %s", i, buffer); + printf ("inode %lld %s", i, buffer); utils_attr_get_name (vol, ctx->attr, buffer, sizeof (buffer)); printf ("%c%s\n", PATH_SEP, buffer); //printf ("\n"); From 5fb3e94ccb8794fb5198ada7c97ddc2c941cc205 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Jan 2003 17:20:46 +0000 Subject: [PATCH 0409/2994] - eliminated get_bitmap_data () - eliminated struct bitmap on_disk_lcn_bitmap - speeded up compare_bitmaps() - speeded up advise_on_resize() - ntfs_mapping_pairs_build() prints reason if error happens - print cluster size, device size and more onging operations (Logical change 1.96) --- ntfsprogs/ntfsresize.c | 129 +++++++++++++++++++++++------------------ 1 file changed, 73 insertions(+), 56 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 24590d88..827cdb6e 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -473,64 +473,61 @@ void walk_attributes(ntfs_resize_t *resize) ntfs_attr_put_search_ctx(ctx); } -/** - * get_bitmap_data - * - * Read the metadata file $Bitmap into a bitmap struct. - * Each cluster on disk is represented by a bit in this file. - */ -void get_bitmap_data(ntfs_volume *vol, struct bitmap *bm) -{ - ntfs_attr *attr; - - attr = vol->lcnbmp_na; - - bm->size = attr->initialized_size; - - bm->bm = malloc (bm->size); - if (!bm->bm) - perr_exit ("get_bitmap_data"); - - if (ntfs_attr_pread (attr, 0, bm->size, bm->bm) < 0) - perr_exit("Couldn't get $Bitmap $DATA"); -} - /** * compare_bitmaps * * Compare two bitmaps. In this case, $Bitmap as read from the disk and * lcn_bitmap which we built from the MFT Records. */ -void compare_bitmaps(struct bitmap *a, struct bitmap *b) +void compare_bitmaps(struct bitmap *a) { - u64 i, j, mismatch = 0; + s64 i,count; + int k, mismatch = 0; char bit; - - if (a->size != b->size) - err_exit("$Bitmap file size doesn't match " - "calculated size ((%d != %d)\n", a->size, b->size); - - for (i = 0; i < a->size; i++) { + u8 bm[NTFS_BUF_SIZE]; + + printf("Accounting clusters ...\n"); + + i = 0; + while (1) { + count = ntfs_attr_pread(vol->lcnbmp_na, i, NTFS_BUF_SIZE, bm); + if (count == -1) + perr_exit("Couldn't get $Bitmap $DATA"); - if (a->bm[i] == b->bm[i]) - continue; - - for (j = i * 8; j < i * 8 + 8; j++) { + if (count == 0) { + if (a->size != i) + err_exit("$Bitmap file size doesn't match " + "calculated size ((%Ld != %Ld)\n", + a->size, i); + break; + } - bit = ntfs_bit_get(a->bm, j); - if (bit != ntfs_bit_get(b->bm, j)) { + for (k = 0; k < count; k++) { + u64 j; + + if (a->bm[i + k] == bm[k]) + continue; + + for (j = i * 8; j < i * 8 + 8; j++) { + + bit = ntfs_bit_get(a->bm, j); + if (bit != ntfs_bit_get(bm, k + j % 8)) + continue; + if (++mismatch > 10) continue; printf("Cluster accounting failed at %llu " "(0x%Lx): %s cluster in $Bitmap\n", - j, j, bit ? "extra" : "miss"); + j, j, bit ? "missing" : "extra"); } } + + i += count; } if (mismatch) { - printf("Totally %Lu cluster accounting mismatches.\n" + printf("Totally %d cluster accounting mismatches.\n" "You didn't shutdown Windows properly?\n", mismatch); exit(1); } @@ -620,13 +617,30 @@ void walk_inodes(ntfs_resize_t *resize) */ void advise_on_resize() { - u64 i, old_b, new_b, g_b, old_mb, new_mb, g_mb; + s64 i, old_b, new_b, g_b, old_mb, new_mb, g_mb; int fragmanted_end; - for (i = vol->nr_clusters - 1; i > 0; i--) + printf("Calculating smallest shrunken size supported ...\n"); + + for (i = vol->nr_clusters - 1; i > 0 && (i % 8); i--) + if (ntfs_bit_get(lcn_bitmap.bm, i)) + goto found_used_cluster; + + if (i > 0) { + if (ntfs_bit_get(lcn_bitmap.bm, i)) + goto found_used_cluster; + } else + goto found_used_cluster; + + for (i -= 8; i >= 0; i -= 8) + if (lcn_bitmap.bm[i / 8]) + break; + + for (i += 7; i > 0; i--) if (ntfs_bit_get(lcn_bitmap.bm, i)) break; - + +found_used_cluster: i += 2; /* first free + we reserve one for the backup boot sector */ fragmanted_end = (i >= vol->nr_clusters) ? 1 : 0; @@ -738,7 +752,7 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) perr_exit("Couldn't get memory"); if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl_bad)) - exit(1); + perr_exit("ntfs_mapping_pairs_build"); memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); a->highest_vcn = cpu_to_le64(nr_clusters - 1LL); @@ -1034,18 +1048,21 @@ void update_bootsector(s64 nr_clusters) perr_exit("write() error"); } + +s64 volume_size(ntfs_volume *vol, s64 nr_clusters) +{ + return nr_clusters * vol->cluster_size; +} + /** * print_volume_size * * Print the volume size in bytes and decimal megabytes. */ -void print_volume_size(char *str, ntfs_volume *v, s64 nr_clusters) +void print_volume_size(char *str, s64 bytes) { - s64 b; /* volume size in bytes */ - - b = nr_clusters * v->cluster_size; printf("%s: %lld bytes (%lld MB)\n", - str, b, rounded_up_division(b, NTFS_MBYTE)); + str, bytes, rounded_up_division(bytes, NTFS_MBYTE)); } void print_disk_usage(ntfs_resize_t *resize) @@ -1057,7 +1074,7 @@ void print_disk_usage(ntfs_resize_t *resize) free = total - used; relocations = resize->relocations * vol->cluster_size; - printf("Space in use: %lld MB (%.1f%%) ", + printf("Space in use : %lld MB (%.1f%%) ", rounded_up_division(used, NTFS_MBYTE), 100.0 * ((float)used / total)); @@ -1110,8 +1127,9 @@ void mount_volume() if (ntfs_version_is_supported(vol)) perr_exit("Unknown NTFS version"); - Dprintf("Cluster size : %u\n", vol->cluster_size); - print_volume_size("Current volume size", vol, vol->nr_clusters); + printf("Cluster size : %u bytes\n", vol->cluster_size); + print_volume_size("Current volume size", + volume_size(vol, vol->nr_clusters)); } /** @@ -1148,7 +1166,6 @@ void prepare_volume_fixup() */ int main(int argc, char **argv) { - struct bitmap on_disk_lcn_bitmap; ntfs_resize_t resize; s64 new_size = 0; /* in clusters */ s64 device_size; /* in bytes */ @@ -1170,6 +1187,8 @@ int main(int argc, char **argv) if (device_size <= 0) err_exit("Couldn't get device size (%Ld)!\n", device_size); + print_volume_size("Current device size", device_size); + if (device_size < vol->nr_clusters * vol->cluster_size) err_exit("Current NTFS volume size is bigger than the device " "size (%Ld)!\nCorrupt partition table or incorrect " @@ -1190,7 +1209,8 @@ int main(int argc, char **argv) new_size = opt.bytes / vol->cluster_size; if (!opt.info) - print_volume_size("New volume size ", vol, new_size); + print_volume_size("New volume size ", + volume_size(vol, new_size)); /* Backup boot sector at the end of device isn't counted in NTFS volume size thus we have to reserve space for. We don't trust @@ -1211,13 +1231,10 @@ int main(int argc, char **argv) resize.new_volume_size = new_size; walk_inodes(&resize); + compare_bitmaps(&lcn_bitmap); print_disk_usage(&resize); - get_bitmap_data(vol, &on_disk_lcn_bitmap); - compare_bitmaps(&on_disk_lcn_bitmap, &lcn_bitmap); - free(on_disk_lcn_bitmap.bm); - if (opt.info) { advise_on_resize(); exit(0); From 857b27e6b5dfe20f767660464c3dadd0676a1fed Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Jan 2003 17:20:46 +0000 Subject: [PATCH 0410/2994] ntfsresize update by Szaka: - eliminated get_bitmap_data () - eliminated struct bitmap on_disk_lcn_bitmap - speeded up compare_bitmaps() - speeded up advise_on_resize() - ntfs_mapping_pairs_build() prints reason if error happens - print cluster size, device size and more onging operations - spelling fix in ntfsresize man page BKrev: 3e26e9eeZhUDNhOmmm7S7l0hnFTw7g From 47f8702fdda0b54a46c2e47557632086e2c5dfca Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Jan 2003 17:20:46 +0000 Subject: [PATCH 0411/2994] typo fix (Logical change 1.96) --- ntfsprogs/ntfsresize.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 1d4a3b3f..23fe0a7b 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -32,7 +32,7 @@ The options .B -i and .B -s -are mutually exclusive. If both of them is omitted then the +are mutually exclusive. If both of them are omitted then the NTFS filesystem will be enlarged to the device size. Before a real resize operation, always make a read-only test run using the From e8430e5dea9ab8dd356ad83b4624ffc273fb7a62 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Jan 2003 17:28:04 +0000 Subject: [PATCH 0412/2994] Remove fdatasync() calls from ntfs_pwrite(). We purely rely on ntfs_umount() to do the syncing and this results in a massive speed up when running io intensive libntfs based applications. (Logical change 1.97) --- libntfs/disk_io.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index 8170475c..037fe9ac 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -109,7 +109,7 @@ s64 ntfs_pread(const int fd, const s64 pos, s64 count, const void *b) * is partial. 0 means nothing was written (also return 0 when @count is 0). * * On error and nothing has been written, return -1 with errno set - * appropriately to the return code of either lseek, write, fdatasync, or set + * appropriately to the return code of either lseek, write, or set * to EINVAL in case of invalid arguments. */ s64 ntfs_pwrite(const int fd, const s64 pos, s64 count, const void *b) @@ -144,9 +144,6 @@ s64 ntfs_pwrite(const int fd, const s64 pos, s64 count, const void *b) /* Nothing written and error, return error status. */ return written; } - /* Sync write to disk. */ - if (fdatasync(fd) == -1) - return -1; /* Finally, return the number of bytes written. */ return total; } @@ -225,7 +222,7 @@ s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, * means nothing was written (also return 0 when @count or @bksize are 0). * * On error and nothing has been written, return -1 with errno set - * appropriately to the return code of either lseek, write, fdatasync, or set + * appropriately to the return code of either lseek, write, or set * to EINVAL in case of invalid arguments. * * NOTE: We mst protect the data, write it, then mst deprotect it using a quick From f82a3dcd5d6e732ebb6d05ef7ec1e1389cfcd1f1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Jan 2003 17:28:04 +0000 Subject: [PATCH 0413/2994] Remove fdatasync() calls from ntfs_pwrite(). We purely rely on ntfs_umount() to do the syncing and this results in a massive speed up when running io intensive libntfs based applications. BKrev: 3e26eba4jHgdICWsUeKIpYMf84bVgA From e56f73d5ed04dcca3e93c64eb719fdc0bb78221c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Jan 2003 17:28:20 +0000 Subject: [PATCH 0414/2994] fix compilation of ntfswipe (Logical change 1.98) --- ntfsprogs/ntfswipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index dfa9f7f0..ef116af7 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -754,9 +754,9 @@ int main (int argc, char *argv[]) if (0) { - printf ("________________________________________________________________________________\n\n"); int i = 0; runlist_element *rl = vol->mft_na->rl; + printf ("________________________________________________________________________________\n\n"); for (; rl->length > 0; rl++, i++) { printf ("%4d %lld,%lld,%lld\n", i, rl->vcn, rl->lcn, rl->length); } From eb2140a9daed2f2c2b5d396ab4538f8daac3fcc9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Jan 2003 17:28:20 +0000 Subject: [PATCH 0415/2994] fix compilation of ntfswipe BKrev: 3e26ebb4779L2CwMjU0wwIk3rc1Org From 63dcac1575a525429cff5262888cd43ea8cb18c9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 18 Jan 2003 15:26:15 +0000 Subject: [PATCH 0416/2994] update for 1.7.0beta release (Logical change 1.99) --- ChangeLog | 15 +++++++++------ README | 10 ++++------ configure | 2 +- configure.in | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 311dd531..fdf2d9e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,14 @@ -04/06/2002 - 1.6.99 - Work in progress. +18/01/2003 - 1.7.0beta - Library rewrite and many new tools. + - Highlights of this release are the now hopefully stable API sported + by an almost completely rewritten library and the new utilities; + ntfsresize, ntfsundelete, and ntfslabel. + Note this is a beta release so it may not be free of bugs. - New tool ntfslabel written by Matthew Fanto with a few cleanups from me to make it fit in with e2label better. - - Extend ntfs_mount() to also read in the volume label. - Add man page for ntfslabel. + - New tool, ntfsundelete, written by Richard Russon. + - New tool, ntfsresize, written by Szakacsits Szabolcs. + - Extend ntfs_mount() to also read in the volume label. - Silence verbosity of output from ntfs_mount(). It is now only output if ./configure was run with --enable-debug. - Remove a LOT of dead code. Massive cleanup. @@ -19,8 +25,7 @@ ntfs_mft_record_get_data_size(). - When writing mft records using the mft.c::ntfs_mft_record{s,}_write() interface, the mft mirror is now updated automatically. - - Add -Wall to compiler options when ./configure is run with - --enable-debug. + - Add -Wall to compiler options. - Fix minor error code path bugs in mkntfs.c that showed up with -Wall. - Fix all compiler warnings that showed up with -Wall. - Add new API function, provided by mft.[ch]: ntfs_file_record_read(). @@ -147,8 +152,6 @@ the stat returned file size rather than the block allocation count to cope with pre-created sparse files. - Remove GPL message text from usage information in mkntfs. - - New tool, ntfsundelete, written by Richard Russon. - - New tool, ntfsresize, written by Szakacsits Szabolcs. - The word is "runlist", not "run_list", "run list", or "run-list". - Prefix all functions with "ntfs_" and make the names of the form "ntfs_object_action()". Keep this for all future functions! diff --git a/README b/README index 024d59f0..17b90874 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ Linux-NTFS The Linux-NTFS project aims to bring full support for the NTFS filesystem to the Linux operating system. -Linux-NTFS is copyright (c) 2000-2002 Anton Altaparmakov. +Linux-NTFS is copyright (c) 2000-2003 Anton Altaparmakov. All of the contents of the Linux-NTFS project are free software, released under the GNU General Public License and you are welcome to redistribute them under @@ -37,10 +37,8 @@ NTFS library ============ Provides common NTFS access functions to the ntfsprogs and other foreign -open source applications. Note, that the library is still under heavy -development and doesn't include the majority of functionality yet. It only -is capable of just about supporting the current ntfsprogs, so I wouldn't -recommend using it for your own applications at this stage. +open source applications. Note, that the library is still under development and +a lot of functionality is not yet included. NTFS utilities ============== @@ -52,7 +50,7 @@ options to display the version number and usage syntax. The following utilities are so far implemented: NtfsFix - Attempt to fix an NTFS partition that has been damaged by the Linux -NTFS driver. Note that you should run it every time after you have used the +NTFS driver. Note that you should run it every time after you have used the old Linux NTFS driver to write to an NTFS partition to prevent massive data corruption from happening when Windows mounts the partition. IMPORTANT: Run this only *after* unmounting the partition in Linux but *before* diff --git a/configure b/configure index f89bfdd2..9d8ae696 100755 --- a/configure +++ b/configure @@ -966,7 +966,7 @@ fi PACKAGE=ntfsprogs -VERSION=1.6.99 +VERSION=1.7.0beta 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; } diff --git a/configure.in b/configure.in index 06bd352f..7a51b20c 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ fi AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(ntfsprogs,1.6.99) +AM_INIT_AUTOMAKE(ntfsprogs,1.7.0beta) AM_MAINTAINER_MODE From 82c7120af401fe8bf14bb3d218376988c1a1f94f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 18 Jan 2003 15:26:15 +0000 Subject: [PATCH 0417/2994] update for 1.7.0beta release BKrev: 3e297217NYCW9PC-7lPTb5troL147w From 7bf411786e02ba82db11657b7286125175ba02fa Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 18 Jan 2003 15:29:33 +0000 Subject: [PATCH 0418/2994] add compat.h to distribution (Logical change 1.100) --- include/Makefile.am | 1 + include/Makefile.in | 1 + 2 files changed, 2 insertions(+) diff --git a/include/Makefile.am b/include/Makefile.am index 2e75b379..c931a13f 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -11,6 +11,7 @@ linux_ntfsinclude_HEADERS = \ attrib.h \ bitmap.h \ bootsect.h \ + compat.h \ debug.h \ dir.h \ disk_io.h \ diff --git a/include/Makefile.in b/include/Makefile.in index c38442bb..b3a02cbd 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -96,6 +96,7 @@ linux_ntfsinclude_HEADERS = \ attrib.h \ bitmap.h \ bootsect.h \ + compat.h \ debug.h \ dir.h \ disk_io.h \ From 9045e8fa4c462879848910b89cde119216528e22 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 18 Jan 2003 15:29:33 +0000 Subject: [PATCH 0419/2994] add compat.h to distribution BKrev: 3e2972ddaw-XEWtrubl--32MGpY0QQ From 2845e1a538bc453d8750bbb60aa216accbc715a3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 18 Jan 2003 15:54:32 +0000 Subject: [PATCH 0420/2994] Initial revision --- ntfsprogs.spec.in | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ntfsprogs.spec.in diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in new file mode 100644 index 00000000..e69de29b From 2208c7cc62a5921197a2c5f44fb2885adfa1a4c8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 18 Jan 2003 15:54:32 +0000 Subject: [PATCH 0421/2994] final tidyings (Logical change 1.101) --- Makefile.am | 6 +++--- Makefile.in | 14 +++++++------- configure | 4 ++-- configure.in | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Makefile.am b/Makefile.am index 56ecce06..b5fb130c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,13 +9,13 @@ endif SUBDIRS = doc include libntfs ntfsprogs EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ - INSTALL NEWS README autogen.sh linux-ntfs.spec.in \ + INSTALL NEWS README autogen.sh ntfsprogs.spec.in \ TODO.ntfsprogs AUTOMAKE_OPTIONS = gnu -dist-hook: linux-ntfs.spec - cp linux-ntfs.spec $(distdir) +dist-hook: ntfsprogs.spec + cp ntfsprogs.spec $(distdir) libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status --recheck diff --git a/Makefile.in b/Makefile.in index 015b894c..4cf5b085 100644 --- a/Makefile.in +++ b/Makefile.in @@ -94,7 +94,7 @@ all_libraries = @all_libraries@ SUBDIRS = doc include libntfs ntfsprogs EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ - INSTALL NEWS README autogen.sh linux-ntfs.spec.in \ + INSTALL NEWS README autogen.sh ntfsprogs.spec.in \ TODO.ntfsprogs @@ -102,11 +102,11 @@ AUTOMAKE_OPTIONS = gnu ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = linux-ntfs.spec +CONFIG_CLEAN_FILES = ntfsprogs.spec DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ Makefile.am Makefile.in NEWS acconfig.h aclocal.m4 config.guess \ -config.h.in config.sub configure configure.in install-sh \ -linux-ntfs.spec.in ltconfig ltmain.sh missing mkinstalldirs +config.h.in config.sub configure configure.in install-sh ltconfig \ +ltmain.sh missing mkinstalldirs ntfsprogs.spec.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) @@ -157,7 +157,7 @@ distclean-hdr: -rm -f config.h maintainer-clean-hdr: -linux-ntfs.spec: $(top_builddir)/config.status linux-ntfs.spec.in +ntfsprogs.spec: $(top_builddir)/config.status ntfsprogs.spec.in cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status # This directory's subdirectories are mostly independent; you can cd @@ -388,8 +388,8 @@ installdirs mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean -dist-hook: linux-ntfs.spec - cp linux-ntfs.spec $(distdir) +dist-hook: ntfsprogs.spec + cp ntfsprogs.spec $(distdir) libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status --recheck diff --git a/configure b/configure index 9d8ae696..60fe1ffa 100755 --- a/configure +++ b/configure @@ -6332,7 +6332,7 @@ trap 'rm -fr `echo " ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 - linux-ntfs.spec + ntfsprogs.spec config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF diff --git a/configure.in b/configure.in index 7a51b20c..39ee66ea 100644 --- a/configure.in +++ b/configure.in @@ -136,6 +136,6 @@ AC_OUTPUT([ ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 - linux-ntfs.spec + ntfsprogs.spec ]) From eba5d05c2b58e6b6335acd1ee485ee8d3d50f07d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 18 Jan 2003 15:54:32 +0000 Subject: [PATCH 0422/2994] final tidyings 2003/01/18 15:35:40+00:00 cantab.net!aia21 Rename: linux-ntfs.spec.in -> ntfsprogs.spec.in (Logical change 1.101) --- ntfsprogs.spec.in | 143 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index e69de29b..f9223e3c 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -0,0 +1,143 @@ +%define name @PACKAGE@ +%define ver @VERSION@ +%define rel 1 +%define prefix /usr +%define bindir /usr/bin +%define sbindir /usr/sbin +%define mandir /usr/share/man + + +Summary : NTFS filesystem libraries and utilities +Name : %{name} +Version : %{ver} +Release : %{rel} +Source : http://prdownloads.sf.net/linux-ntfs/ntfsprogs-%{ver}.tar.gz +Buildroot : %{_tmppath}/%{name}-root +Packager : Anton Altaparmakov +License : GPL +Group : System Environment/Base +%description +The Linux-NTFS project (http://linux-ntfs.sf.net/) aims to bring full support +for the NTFS filesystem to the Linux operating system. Linux-NTFS currently +consists of a static library and utilities. This package contains the following +utilities: + NtfsFix - Attempt to fix an NTFS partition that has been damaged by the +Linux NTFS driver. It should be run every time after you have used the Linux +NTFS driver to write to an NTFS partition to prevent massive data corruption +from happening when Windows mounts the partition. +IMPORTANT: Run this only *after* unmounting the partition in Linux but *before* +rebooting into Windows NT/2000! See man 8 ntfsfix for details. + mkntfs - Format a partition with the NTFS filesystem. See man 8 mkntfs +for command line options. + ntfslabel - Display/change the label of an NTFS partition. See man 8 +ntfslabel for details. + ntfsundelete - Recover deleted files from an NTFS volume. See man 8 +ntfsundelete for details. + ntfsresize - Resize an NTFS volume. See man 8 ntfsresize for details. + +%package devel +Summary : files required to compile software that uses libntfs +Group : Development/System +Requires : ntfsprogs = %{ver}-%{rel} +%description devel +This package includes the header files and libraries needed to link software +with libntfs. + + +%prep +%setup + +%build +if [ -n "$LINGUAS" ]; then unset LINGUAS; fi +%configure +make + + +%install +rm -rf "$RPM_BUILD_ROOT" +make DESTDIR="$RPM_BUILD_ROOT" install-strip + + +%clean +rm -rf "$RPM_BUILD_ROOT" + + +%files +%defattr(-,root,root) +%doc AUTHORS COPYING CREDITS ChangeLog INSTALL NEWS README TODO.include TODO.libntfs TODO.ntfsprogs doc/CodingStyle doc/attribute_definitions doc/attributes.txt doc/compression.txt doc/tunable_settings doc/template.c doc/template.h doc/system_files.txt doc/system_security_descriptors.txt +%{bindir}/* +%{sbindir}/* +%{mandir}/*/* +%{prefix}/lib/*.so* + + +%files devel +%defattr(-,root,root) +%{prefix}/include/* +%{prefix}/lib/*.a* +%{prefix}/lib/*.la* + +%changelog +* Sat Jan 18 2003 Anton Altaparmakov +- renamed to ntfsprogs.spec.in +- change source tar ball name to ntfsprogs + +* Tue Dec 10 2002 Anton Altaparmakov +- added ntfsresize + +* Wed Jul 18 2002 Richard Russon +- added ntfsundelete +- change TODO names + +* Wed Jul 3 2002 Anton Altaparmakov +- update my email address + +* Mon Jun 3 2002 Anton Altaparmakov +- update %doc with new TODO files + +* Tue Apr 12 2002 Anton Altaparmakov +- update %description text for ntfslabel + +* Tue Mar 12 2002 Anton Altaparmakov +- update %description text + +* Sat Jan 26 2002 Anton Altaparmakov +- update %description text +- make dependencies pick the right version automatically + +* Thu Jan 10 2002 Anton Altaparmakov +- add dependency on linux-ntfs to linux-ntfs-devel +- update %description text + +* Fri Nov 09 2001 Anton Altaparmakov +- update %description text +- (re)enable installation of shared libraries + +* Wed Aug 22 2001 Anton Altaparmakov +- update %description text + +* Thu Aug 2 2001 Anton Altaparmakov +- update %description text + +* Wed Jul 25 2001 Anton Altaparmakov +- include sbin install path (mkntfs now is in sbin) + +* Tue Jul 24 2001 Anton Altaparmakov +- update %description text + +* Mon Jun 11 2001 Anton Altaparmakov +- remove duplicate %configure options +- remove shared library installation as shared libraries are disabled by +default + +* Sun Jun 10 2001 Anton Altaparmakov +- add man pages stuff +- update info text +- add new doc/ stuff +- modify installation to do install-strip instead of install followed by manual +stripping +- update download URL to be the fast sourceforge http download server + +* Fri Feb 2 2001 Anton Altaparmakov +- started changelog + From 8c6978e90925484dec89c49264034575519ecb36 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 18 Jan 2003 15:54:32 +0000 Subject: [PATCH 0423/2994] final tidyings BKrev: 3e2978b8m3LMR4961MAQMv9dDXeXMg From 4071c5767178d1c1859a3a59d3be6325fc2074ab Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 18 Jan 2003 15:54:32 +0000 Subject: [PATCH 0424/2994] final tidyings }(Logical change 1.101) --- linux-ntfs.spec.in | 139 --------------------------------------------- 1 file changed, 139 deletions(-) delete mode 100644 linux-ntfs.spec.in diff --git a/linux-ntfs.spec.in b/linux-ntfs.spec.in deleted file mode 100644 index cbe16a4a..00000000 --- a/linux-ntfs.spec.in +++ /dev/null @@ -1,139 +0,0 @@ -%define name @PACKAGE@ -%define ver @VERSION@ -%define rel 1 -%define prefix /usr -%define bindir /usr/bin -%define sbindir /usr/sbin -%define mandir /usr/share/man - - -Summary : NTFS filesystem libraries and utilities -Name : %{name} -Version : %{ver} -Release : %{rel} -Source : http://prdownloads.sf.net/linux-ntfs/linux-ntfs-%{ver}.tar.gz -Buildroot : %{_tmppath}/%{name}-root -Packager : Anton Altaparmakov -License : GPL -Group : System Environment/Base -%description -The Linux-NTFS project (http://linux-ntfs.sf.net/) aims to bring full support -for the NTFS filesystem to the Linux operating system. Linux-NTFS currently -consists of a static library and utilities. This package contains the following -utilities: - NtfsFix - Attempt to fix an NTFS partition that has been damaged by the -Linux NTFS driver. It should be run every time after you have used the Linux -NTFS driver to write to an NTFS partition to prevent massive data corruption -from happening when Windows mounts the partition. -IMPORTANT: Run this only *after* unmounting the partition in Linux but *before* -rebooting into Windows NT/2000! See man 8 ntfsfix for details. - mkntfs - Format a partition with the NTFS filesystem. See man 8 mkntfs -for command line options. - ntfslabel - Display/change the label of an NTFS partition. See man 8 -ntfslabel for details. - ntfsundelete - Recover deleted files from an NTFS volume. See man 8 -ntfsundelete for details. - ntfsresize - Resize an NTFS volume. See man 8 ntfsresize for details. - -%package devel -Summary : files required to compile software that uses libntfs -Group : Development/System -Requires : linux-ntfs = %{ver}-%{rel} -%description devel -This package includes the header files and libraries needed to link software -with libntfs. - - -%prep -%setup - -%build -if [ -n "$LINGUAS" ]; then unset LINGUAS; fi -%configure -make - - -%install -rm -rf "$RPM_BUILD_ROOT" -make DESTDIR="$RPM_BUILD_ROOT" install-strip - - -%clean -rm -rf "$RPM_BUILD_ROOT" - - -%files -%defattr(-,root,root) -%doc AUTHORS COPYING CREDITS ChangeLog INSTALL NEWS README TODO.include TODO.libntfs TODO.ntfsprogs doc/CodingStyle doc/attribute_definitions doc/attributes.txt doc/compression.txt doc/tunable_settings doc/template.c doc/template.h doc/system_files.txt doc/system_security_descriptors.txt -%{bindir}/* -%{sbindir}/* -%{mandir}/*/* -%{prefix}/lib/*.so* - - -%files devel -%defattr(-,root,root) -%{prefix}/include/* -%{prefix}/lib/*.a* -%{prefix}/lib/*.la* - -%changelog -* Tue Dec 10 2002 Anton Altaparmakov -- added ntfsresize - -* Wed Jul 18 2002 Richard Russon -- added ntfsundelete -- change TODO names - -* Wed Jul 3 2002 Anton Altaparmakov -- update my email address - -* Mon Jun 3 2002 Anton Altaparmakov -- update %doc with new TODO files - -* Tue Apr 12 2002 Anton Altaparmakov -- update %description text for ntfslabel - -* Tue Mar 12 2002 Anton Altaparmakov -- update %description text - -* Sat Jan 26 2002 Anton Altaparmakov -- update %description text -- make dependencies pick the right version automatically - -* Thu Jan 10 2002 Anton Altaparmakov -- add dependency on linux-ntfs to linux-ntfs-devel -- update %description text - -* Fri Nov 09 2001 Anton Altaparmakov -- update %description text -- (re)enable installation of shared libraries - -* Wed Aug 22 2001 Anton Altaparmakov -- update %description text - -* Thu Aug 2 2001 Anton Altaparmakov -- update %description text - -* Wed Jul 25 2001 Anton Altaparmakov -- include sbin install path (mkntfs now is in sbin) - -* Tue Jul 24 2001 Anton Altaparmakov -- update %description text - -* Mon Jun 11 2001 Anton Altaparmakov -- remove duplicate %configure options -- remove shared library installation as shared libraries are disabled by -default - -* Sun Jun 10 2001 Anton Altaparmakov -- add man pages stuff -- update info text -- add new doc/ stuff -- modify installation to do install-strip instead of install followed by manual -stripping -- update download URL to be the fast sourceforge http download server - -* Fri Feb 2 2001 Anton Altaparmakov -- started changelog - From ef273e8804e3cdd3b6494ef05bea8fb15b6bd86d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 18 Jan 2003 16:02:37 +0000 Subject: [PATCH 0425/2994] really final tidyings (Logical change 1.102) --- ntfsprogs/mkntfs.c | 4 ++-- ntfsprogs/ntfsfix.c | 4 ++-- ntfsprogs/ntfstruncate.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index f723bbef..9160d54d 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1,7 +1,7 @@ /* * mkntfs - Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * Copyright (c) 2001-2002 Richard Russon * * This utility will create an NTFS 1.2 (Windows NT 4.0) volume on a user @@ -2261,7 +2261,7 @@ void usage(void) __attribute__ ((noreturn)); void usage(void) { - fprintf(stderr, "Copyright (c) 2001,2002 Anton Altaparmakov.\n" + fprintf(stderr, "Copyright (c) 2001-2003 Anton Altaparmakov.\n" "Create an NTFS volume on a user specified (block) device.\n" "Usage: %s [-s sector-size] [-c cluster-size] " "[-L volume-label]\n\t[-z mft-zone-multiplier] " diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index d7b427d9..a5752450 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -1,7 +1,7 @@ /* * NtfsFix - Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov. + * Copyright (c) 2000-2003 Anton Altaparmakov. * * This utility will attempt to fix a partition that has been damaged by the * current Linux-NTFS driver. It should be run after dismounting a NTFS @@ -83,7 +83,7 @@ int main(int argc, char **argv) "*before*\nrebooting into Windows NT/2000/XP or you " "*will* suffer! - You have been warned!\n\n" /* Generic copyright / disclaimer. */ - "Copyright (c) 2000-2002 Anton Altaparmakov.\n\n" + "Copyright (c) 2000-2003 Anton Altaparmakov.\n\n" "%s is free software, released under the GNU " "General Public License and you\nare welcome to " "redistribute it under certain conditions.\n" diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index ee0ca82c..a2062d90 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -1,7 +1,7 @@ /* * ntfstruncate - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2003 Anton Altaparmakov * * This utility will truncate a specified attribute belonging to a * specified inode, i.e. file or directory, to a specified length. @@ -551,8 +551,8 @@ void parse_options(int argc, char *argv[]) if (argc && *argv) EXEC_NAME = *argv; - fprintf(stderr, "%s v%s -- Copyright (c) 2002 Anton Altaparmakov\n", - EXEC_NAME, VERSION); + fprintf(stderr, "%s v%s -- Copyright (c) 2002-2003 Anton " + "Altaparmakov\n", EXEC_NAME, VERSION); while ((c = getopt(argc, argv, "fhnqvV")) != EOF) switch (c) { case 'f': From 057114848bd63e557a91e00cbc87f3c1339e228f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 18 Jan 2003 16:02:37 +0000 Subject: [PATCH 0426/2994] really final tidyings BKrev: 3e297a9dTB9XQsIOmBc1F6xBqB2C_Q From be23ca327d177b67b50d4aed11af7d9b819290a7 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:32:24 +0000 Subject: [PATCH 0427/2994] Auto merged 2003/01/14 23:41:16+00:00 flatcap.org!flatcap fix a few endian problems add a few comment blocks (Logical change 1.103) --- ntfsprogs/ntfsresize.c | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 827cdb6e..24795178 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -3,6 +3,7 @@ * * Copyright (c) 2002-2003 Szabolcs Szakacsits * Copyright (c) 2002-2003 Anton Altaparmakov + * Copyright (c) 2002-2003 Richard Russon * * This utility will resize an NTFS volume. * @@ -351,6 +352,11 @@ void parse_options(int argc, char **argv) } } +/** + * runlist_extent_number + * + * Count the runs in a runlist. + */ int runlist_extent_number(runlist *rl) { int i; @@ -394,7 +400,7 @@ void build_lcn_usage_bitmap(ntfs_resize_t *resize) s64 new_volume_size, inode; ATTR_RECORD *a; runlist *rl; - int i, j, runs; + int i, j;//, runs; a = resize->ctx->attr; new_volume_size = resize->new_volume_size; @@ -406,7 +412,7 @@ void build_lcn_usage_bitmap(ntfs_resize_t *resize) if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) perr_exit("ntfs_decompress_mapping_pairs"); - runs = runlist_extent_number(rl); + //runs = runlist_extent_number(rl); for (i = 0; rl[i].length; i++) { s64 lcn = rl[i].lcn; @@ -418,8 +424,8 @@ void build_lcn_usage_bitmap(ntfs_resize_t *resize) /* FIXME: ntfs_mapping_pairs_decompress should return error */ if (lcn < 0 || lcn_length <= 0) err_exit("Corrupt runlist in inode %lld attr %x LCN " - "%llx length %llx\n", inode, a->type, lcn, - lcn_length); + "%llx length %llx\n", inode, + le32_to_cpu (a->type), lcn, lcn_length); for (j = 0; j < lcn_length; j++) { u64 k = (u64)lcn + j; @@ -745,7 +751,8 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl_bad)) == -1) perr_exit("ntfs_get_size_for_mapping_pairs"); - if (mp_size > a->length - a->mapping_pairs_offset) + if (mp_size > le32_to_cpu (a->length) - + le16_to_cpu (a->mapping_pairs_offset)) err_exit("Enlarging attribute header isn't supported yet.\n"); if (!(mp = (char *)calloc(1, mp_size))) @@ -754,7 +761,7 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl_bad)) perr_exit("ntfs_mapping_pairs_build"); - memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); + memcpy((char *)a + le16_to_cpu (a->mapping_pairs_offset), mp, mp_size); a->highest_vcn = cpu_to_le64(nr_clusters - 1LL); a->allocated_size = cpu_to_le64(nr_clusters * vol->cluster_size); a->data_size = cpu_to_le64(nr_clusters * vol->cluster_size); @@ -808,6 +815,12 @@ void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) } } +/** + * enlarge_bitmap_data_attr + * + * Enlarge the metadata file $Bitmap. It must be large enough for one bit per + * cluster of the shrunken volume. Also it must be a of 8 bytes in size. + */ void enlarge_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) { runlist *rl = *rlist; @@ -841,7 +854,9 @@ void enlarge_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) rl_set(rl + 1, nr_bm_clusters, -1LL, 0LL); } - +/** + * truncate_bitmap_data_attr + */ void truncate_bitmap_data_attr(ATTR_RECORD *a, s64 nr_clusters) { runlist *rl; @@ -879,7 +894,8 @@ void truncate_bitmap_data_attr(ATTR_RECORD *a, s64 nr_clusters) if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl)) == -1) perr_exit("ntfs_get_size_for_mapping_pairs"); - if (mp_size > a->length - a->mapping_pairs_offset) + if (mp_size > le32_to_cpu (a->length) - + le16_to_cpu (a->mapping_pairs_offset)) err_exit("Enlarging attribute header isn't supported yet.\n"); if (!(mp = (char *)calloc(1, mp_size))) @@ -888,7 +904,7 @@ void truncate_bitmap_data_attr(ATTR_RECORD *a, s64 nr_clusters) if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl)) perr_exit("ntfs_mapping_pairs_build"); - memcpy((char *)a + a->mapping_pairs_offset, mp, mp_size); + memcpy((char *)a + le16_to_cpu (a->mapping_pairs_offset), mp, mp_size); a->highest_vcn = cpu_to_le64(nr_bm_clusters - 1LL); a->allocated_size = cpu_to_le64(nr_bm_clusters * vol->cluster_size); a->data_size = cpu_to_le64(bm_bsize); @@ -1065,6 +1081,11 @@ void print_volume_size(char *str, s64 bytes) str, bytes, rounded_up_division(bytes, NTFS_MBYTE)); } +/** + * print_disk_usage + * + * Display the amount of disk space in use. + */ void print_disk_usage(ntfs_resize_t *resize) { s64 total, used, free, relocations; From bbca55075cfc4762e3d22be12e0b110529bef3d5 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:32:24 +0000 Subject: [PATCH 0428/2994] Change mode to -rw-rw-r-- (Logical change 1.103) From 24e2109296ce815c7be8101d7ae9a2d59535800a Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:32:24 +0000 Subject: [PATCH 0429/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into flatcap.org:/mnt/work/bk/ntfsprogs 2003/01/18 11:11:03+00:00 flatcap.org!flatcap Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into flatcap.org:/mnt/work/bk/ntfsprogs 2003/01/14 23:41:17+00:00 flatcap.org!flatcap more tidying a few bug fixes BKrev: 3e2a8cc8V_hscGaMokgyIuZ-nHOU3A From 41854fb250dd60f47c593827c5b1126d3644a96c Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:32:24 +0000 Subject: [PATCH 0430/2994] include our dependencies (Logical change 1.103) --- ntfsprogs/utils.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 92d98ac6..21ab80d1 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -28,6 +28,9 @@ #include "layout.h" #include "volume.h" +#include +#include + #define PATH_SEP '/' #define GEN_PRINTF(NAME, STREAM, CONTROL, TRIGGER) \ From 1d72ba4c998f8714874f447de669fce9507fc7d3 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:32:24 +0000 Subject: [PATCH 0431/2994] use global Dprintf (Logical change 1.103) --- ntfsprogs/ntfscluster.c | 18 +----------------- ntfsprogs/ntfsundelete.c | 15 +-------------- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index e93acb10..aff02c53 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -24,10 +24,7 @@ #include "config.h" #include -#include -#include #include -#include #include #include "ntfscluster.h" @@ -35,6 +32,7 @@ #include "attrib.h" #include "utils.h" #include "volume.h" +#include "debug.h" static const char *AUTHOR = "Richard Russon (FlatCap)"; static const char *EXEC_NAME = "ntfscluster"; @@ -44,20 +42,6 @@ GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Iprintf, stdout, &opts.quiet, FALSE) -/** - * Dprintf - Print debug messages - */ -#ifndef DEBUG -#define Dprintf(...) -#else -void Dprintf (const char *format, ...) -{ - va_list va; - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -} -#endif /** * version - Print version information about the program * diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index b7c8ee24..fc359bb7 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -50,6 +50,7 @@ #include "inode.h" #include "disk_io.h" #include "utils.h" +#include "debug.h" static const char *AUTHOR = "Richard Russon (FlatCap)"; static const char *EXEC_NAME = "ntfsundelete"; @@ -65,20 +66,6 @@ GEN_PRINTF (Iprintf, stdout, &opts.quiet, FALSE) #define _(S) gettext(S) -/** - * Dprintf - Print debug messages - */ -void Dprintf (const char *format, ...) -{ -#ifdef DEBUG - va_list va; - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -#endif -} - - /** * version - Print version information about the program * From 84947d2fa0d4e570b7845fef508f21dfccb14691 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:48:06 +0000 Subject: [PATCH 0432/2994] added a few standard command line options used the utils (Logical change 1.104) --- ntfsprogs/ntfslabel.c | 269 ++++++++++++++++++++++++++++++------------ 1 file changed, 191 insertions(+), 78 deletions(-) diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 8a70f3b2..18f11945 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -1,9 +1,9 @@ -/* +/** * ntfslabel - Part of the Linux-NTFS project. * * Copyright (c) 2002 Matthew J. Fanto * Copyright (c) 2002 Anton Altaparmakov - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002-2003 Richard Russon * * This utility will display/change the label on an NTFS partition. * @@ -30,11 +30,154 @@ #include #include #include +#include #include "debug.h" #include "mft.h" +#include "utils.h" -/* +static const char *EXEC_NAME = "ntfslabel"; + +static struct options { + char *device; /* Device/File to work with */ + char *label; /* Set the label to this */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int force; /* Override common sense */ + int noaction; /* Do not write to disk */ +} opts; + +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + printf ("\n%s v%s - Display, or set, the label for an NTFS Volume\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c)\n"); + printf ("\tMatthew J. Fanto\n"); + printf ("\tAnton Altaparmakov\n"); + printf ("\tRichard Russon\n"); + printf ("\n%s\n\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + printf ("\nUsage: %s [options] device [label]\n" + " -n --no-action Do not write to disk\n" + " -f --force Use less caution\n" + " -q --quiet Less output\n" + " -v --verbose More output\n" + " -V --version Display version information\n" + " -h --help Display this help\n\n", + EXEC_NAME); + printf ("%s%s\n", ntfs_bugs, ntfs_home); +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char *argv[]) +{ + static const char *sopt = "-fhnqvV"; + static const struct option lopt[] = { + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "no-action", no_argument, NULL, 'n' }, + { "quiet", no_argument, NULL, 'q' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 }, + }; + + char c = -1; + int err = 0; + int ver = 0; + int help = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!err && !opts.device) + opts.device = argv[optind-1]; + else if (!err && !opts.label) + opts.label = argv[optind-1]; + else + err++; + break; + case 'f': + opts.force++; + break; + case 'h': + help++; + break; + case 'n': + opts.noaction++; + break; + case 'q': + opts.quiet++; + break; + case 'v': + opts.verbose++; + break; + case 'V': + ver++; + break; + default: + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if (opts.device == NULL) { + if (argc > 1) + Eprintf ("You must specify a device.\n"); + err++; + } + + if (opts.quiet && opts.verbose) { + Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + err++; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + + +/** * print_label - display the current label of a mounted ntfs partition. * @dev: device to read the label from * @mnt_flags: mount flags of the device or 0 if not mounted @@ -42,33 +185,22 @@ * * Print the label of the device @dev to stdout. */ -void print_label(const char *dev, const unsigned long mnt_flags, - const char *mnt_point) +int print_label (ntfs_volume *vol, unsigned long mnt_flags) { - ntfs_volume *vol; - - if (mnt_point) { - // Try ioctl and finish if present. - // goto finished; - } + int result = 0; + //XXX significant? if ((mnt_flags & (NTFS_MF_MOUNTED | NTFS_MF_READONLY)) == NTFS_MF_MOUNTED) { - fprintf(stderr, "%s is mounted read-write, results may be " - "unreliable.\n", dev); + Eprintf ("%s is mounted read-write, results may be " + "unreliable.\n", opts.device); + result = 1; } - vol = ntfs_mount(dev, MS_RDONLY); - if (!vol) { - fprintf(stderr, "ntfs_mount() on device %s failed: %s\n", dev, - strerror(errno)); - exit(1); - } -//finished: + printf("%s\n", vol->vol_name); - if (ntfs_umount(vol, 0)) - ntfs_umount(vol, 1); + return result; } -/* +/** * resize_resident_attribute_value - resize a resident attribute * @m: mft record containing attribute to resize * @a: attribute record (inside @m) which to resize @@ -103,7 +235,7 @@ int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, return 0; } -/* +/** * change_label - change the current label on a device * @dev: device to change the label on * @mnt_flags: mount flags of the device or 0 if not mounted @@ -112,20 +244,16 @@ int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, * * Change the label on the device @dev to @label. */ -void change_label(const char *dev, const unsigned long mnt_flags, - const char *mnt_point, char *label, BOOL force) +int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, BOOL force) { ntfs_attr_search_ctx *ctx = NULL; uchar_t *new_label = NULL; MFT_RECORD *mrec = NULL; ATTR_RECORD *a; - ntfs_volume *vol; - int label_len, err = 1; + int label_len; + int result = 0; - if (mnt_point) { - // Try ioctl and return if present. - // return; - } + //XXX significant? if (mnt_flags & NTFS_MF_MOUNTED) { /* If not the root fs or mounted read/write, refuse change. */ if (!(mnt_flags & NTFS_MF_ISROOT) || @@ -134,17 +262,12 @@ void change_label(const char *dev, const unsigned long mnt_flags, fprintf(stderr, "Refusing to change label on " "read-%s mounted device %s.\n", mnt_flags & NTFS_MF_READONLY ? - "only" : "write", dev); - return; + "only" : "write", opts.device); + return 1; } } } - vol = ntfs_mount(dev, 0); - if (!vol) { - fprintf(stderr, "ntfs_mount() on device %s failed: %s\n", dev, - strerror(errno)); - exit(1); - } + if (ntfs_file_record_read(vol, (MFT_REF)FILE_Volume, &mrec, NULL)) { perror("Error reading file record"); goto err_out; @@ -191,55 +314,45 @@ void change_label(const char *dev, const unsigned long mnt_flags, perror("Error writing MFT Record to disk"); goto err_out; } - err = 0; + result = 0; err_out: if (new_label) free(new_label); if (mrec) free(mrec); - if (ntfs_umount(vol, 0)) - ntfs_umount(vol, 1); - if (err) - exit(1); + return result; } +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ int main(int argc, char **argv) { - const char *AUTHOR = "Matthew Fanto"; - char *EXEC_NAME = "ntfslabel"; - char *locale, *mnt_point = NULL; - unsigned long mnt_flags; - int err; - // FIXME:Implement option -F meaning force the change. - BOOL force = 0; + unsigned long mnt_flags = 0; + int result = 0; + ntfs_volume *vol; - locale = setlocale(LC_ALL, ""); - if (!locale) { - char *locale; + utils_set_locale(); - locale = setlocale(LC_ALL, NULL); - Dprintf("Failed to set locale, using default (%s).\n", locale); - } else - Dprintf("Using locale %s.\n", locale); - if (argc && *argv) - EXEC_NAME = *argv; - if (argc < 2 || argc > 3) { - fprintf(stderr, "%s v%s - %s\n", EXEC_NAME, VERSION, AUTHOR); - fprintf(stderr, "Usage: ntfslabel device [newlabel]\n"); - exit(1); - } - err = ntfs_check_if_mounted(argv[1], &mnt_flags); - if (err) - fprintf(stderr, "Failed to determine whether %s is mounted: " - "%s\n", argv[1], strerror(errno)); - else if (mnt_flags & NTFS_MF_MOUNTED) { - // Not implemented yet. Will be used for ioctl interface to driver. - // mnt_point = ntfs_get_mount_point(argv[1]); - } - if (argc == 2) - print_label(argv[1], mnt_flags, mnt_point); + if (!parse_options (argc, argv)) + return 1; + + //XXX need to set and get mount flags + vol = utils_mount_volume (opts.device, 0, opts.force); + if (!vol) + return 1; + + if (opts.label) + result = change_label (vol, mnt_flags, opts.label, opts.force); else - change_label(argv[1], mnt_flags, mnt_point, argv[2], force); - return 0; + result = print_label (vol, mnt_flags); + + ntfs_umount (vol, FALSE); + return result; } From 1cf51ca7fbe7a0f7d9fcb65d6424b6d16df7628e Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:48:06 +0000 Subject: [PATCH 0433/2994] ntfslabel now uses the utils (Logical change 1.104) --- ntfsprogs/Makefile.am | 4 ++-- ntfsprogs/Makefile.in | 48 +++++++++++++++++++++---------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index dbef2436..049c97be 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -41,11 +41,11 @@ mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c mkntfs_LDADD = $(AM_LIBS) mkntfs_LDFLAGS = $(AM_LFLAGS) -ntfslabel_SOURCES = ntfslabel.c +ntfslabel_SOURCES = ntfslabel.c utils.c utils.h ntfslabel_LDADD = $(AM_LIBS) ntfslabel_LDFLAGS = $(AM_LFLAGS) -ntfsinfo_SOURCES = ntfsinfo.c +ntfsinfo_SOURCES = ntfsinfo.c utils.c utils.h ntfsinfo_LDADD = $(AM_LIBS) ntfsinfo_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index ae1e8107..f041de90 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -124,11 +124,11 @@ mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c mkntfs_LDADD = $(AM_LIBS) mkntfs_LDFLAGS = $(AM_LFLAGS) -ntfslabel_SOURCES = ntfslabel.c +ntfslabel_SOURCES = ntfslabel.c utils.c utils.h ntfslabel_LDADD = $(AM_LIBS) ntfslabel_LDFLAGS = $(AM_LFLAGS) -ntfsinfo_SOURCES = ntfsinfo.c +ntfsinfo_SOURCES = ntfsinfo.c utils.c utils.h ntfsinfo_LDADD = $(AM_LIBS) ntfsinfo_LDFLAGS = $(AM_LFLAGS) @@ -174,61 +174,61 @@ PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) -I.. LIBS = @LIBS@ ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@ntfsdump_logfile_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -dumplog_OBJECTS = dumplog.$(OBJEXT) -@REALLYSTATIC_FALSE@dumplog_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +dumplog_OBJECTS = dumplog.$(OBJEXT) @REALLYSTATIC_TRUE@dumplog_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@dumplog_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfstruncate_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) @REALLYSTATIC_TRUE@ntfstruncate_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfscluster_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfstruncate_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_TRUE@ntfscluster_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfscluster_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) @REALLYSTATIC_TRUE@ntfsfix_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_TRUE@ntfsinfo_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ sd.$(OBJEXT) mkntfs.$(OBJEXT) -@REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_TRUE@ntfslabel_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) @REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) From 9b249315039dfd4e3c41579dd53b1a3db6c372f8 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:48:06 +0000 Subject: [PATCH 0434/2994] standardise on Qprintf for Quietable output (Logical change 1.104) --- ntfsprogs/ntfsundelete.c | 106 +++++++++++++++++++-------------------- ntfsprogs/ntfswipe.c | 100 ++++++++++++++++-------------------- 2 files changed, 96 insertions(+), 110 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index fc359bb7..a3fe0c2a 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -62,7 +62,7 @@ static struct options opts; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Iprintf, stdout, &opts.quiet, FALSE) +GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) #define _(S) gettext(S) @@ -75,7 +75,7 @@ GEN_PRINTF (Iprintf, stdout, &opts.quiet, FALSE) */ void version (void) { - Iprintf ("%s v%s Copyright (C) 2002 %s\nRecover deleted files from an " + Qprintf ("%s v%s Copyright (C) 2002 %s\nRecover deleted files from an " "NTFS Volume\n\n%s is free software, released under the GNU " "General Public License\nand you are welcome to redistribute " "it under certain conditions.\n%s comes with ABSOLUTELY NO " @@ -94,7 +94,7 @@ void version (void) */ void usage (void) { - Iprintf ("Usage: %s [options] device\n" + Qprintf ("Usage: %s [options] device\n" " -s --scan Scan for files (default)\n" " -p num --percentage num Minimum percentage recoverable\n" " -m pattern --match pattern Only work on files with matching names\n" @@ -115,7 +115,7 @@ void usage (void) " -V --version Display version information\n" " -h --help Display this help\n\n", EXEC_NAME); - Iprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); + Qprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); } /** @@ -927,13 +927,13 @@ void dump_record (struct ufile *file) if (!file) return; - Iprintf ("MFT Record %lld\n", file->inode); - Iprintf ("Type: %s\n", (file->directory) ? "Directory" : "File"); + Qprintf ("MFT Record %lld\n", file->inode); + Qprintf ("Type: %s\n", (file->directory) ? "Directory" : "File"); strftime (buffer, sizeof (buffer), "%F %R", localtime (&file->date)); - Iprintf ("Date: %s\n", buffer); + Qprintf ("Date: %s\n", buffer); if (file->attr_list) - Iprintf ("Metadata may span more than one MFT record\n"); + Qprintf ("Metadata may span more than one MFT record\n"); list_for_each (item, &file->name) { struct filename *f = list_entry (item, struct filename, list); @@ -943,64 +943,64 @@ void dump_record (struct ufile *file) else name = NONE; - Iprintf ("Filename: (%d) %s\n", f->name_space, f->name); - Iprintf ("File Flags: "); - if (f->flags & FILE_ATTR_SYSTEM) Iprintf ("System "); - if (f->flags & FILE_ATTR_DIRECTORY) Iprintf ("Directory "); - if (f->flags & FILE_ATTR_SPARSE_FILE) Iprintf ("Sparse "); - if (f->flags & FILE_ATTR_REPARSE_POINT) Iprintf ("Reparse "); - if (f->flags & FILE_ATTR_COMPRESSED) Iprintf ("Compressed "); - if (f->flags & FILE_ATTR_ENCRYPTED) Iprintf ("Encrypted "); + Qprintf ("Filename: (%d) %s\n", f->name_space, f->name); + Qprintf ("File Flags: "); + if (f->flags & FILE_ATTR_SYSTEM) Qprintf ("System "); + if (f->flags & FILE_ATTR_DIRECTORY) Qprintf ("Directory "); + if (f->flags & FILE_ATTR_SPARSE_FILE) Qprintf ("Sparse "); + if (f->flags & FILE_ATTR_REPARSE_POINT) Qprintf ("Reparse "); + if (f->flags & FILE_ATTR_COMPRESSED) Qprintf ("Compressed "); + if (f->flags & FILE_ATTR_ENCRYPTED) Qprintf ("Encrypted "); if (!(f->flags & (FILE_ATTR_SYSTEM || FILE_ATTR_DIRECTORY || FILE_ATTR_SPARSE_FILE || FILE_ATTR_REPARSE_POINT || FILE_ATTR_COMPRESSED || FILE_ATTR_ENCRYPTED))) { - Iprintf (NONE); + Qprintf (NONE); } - Iprintf ("\n"); - Iprintf ("Size alloc: %lld\n", f->size_alloc); - Iprintf ("Size data: %lld\n", f->size_data); + Qprintf ("\n"); + Qprintf ("Size alloc: %lld\n", f->size_alloc); + Qprintf ("Size data: %lld\n", f->size_data); strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_c)); - Iprintf ("Date C: %s\n", buffer); + Qprintf ("Date C: %s\n", buffer); strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_a)); - Iprintf ("Date A: %s\n", buffer); + Qprintf ("Date A: %s\n", buffer); strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_m)); - Iprintf ("Date M: %s\n", buffer); + Qprintf ("Date M: %s\n", buffer); strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_r)); - Iprintf ("Date R: %s\n", buffer); + Qprintf ("Date R: %s\n", buffer); } - Iprintf ("Data Streams:\n"); + Qprintf ("Data Streams:\n"); list_for_each (item, &file->data) { struct data *d = list_entry (item, struct data, list); - Iprintf ("Name: %s\n", (d->name) ? d->name : ""); - Iprintf ("Flags: "); - if (d->resident) Iprintf ("Resident\n"); - if (d->compressed) Iprintf ("Compressed\n"); - if (d->encrypted) Iprintf ("Encrypted\n"); + Qprintf ("Name: %s\n", (d->name) ? d->name : ""); + Qprintf ("Flags: "); + if (d->resident) Qprintf ("Resident\n"); + if (d->compressed) Qprintf ("Compressed\n"); + if (d->encrypted) Qprintf ("Encrypted\n"); if (!d->resident && !d->compressed && !d->encrypted) - Iprintf ("None\n"); + Qprintf ("None\n"); else - Iprintf ("\n"); + Qprintf ("\n"); - Iprintf ("Size alloc: %lld\n", d->size_alloc); - Iprintf ("Size data: %lld\n", d->size_data); - Iprintf ("Size init: %lld\n", d->size_init); - Iprintf ("Size vcn: %lld\n", d->size_vcn); + Qprintf ("Size alloc: %lld\n", d->size_alloc); + Qprintf ("Size data: %lld\n", d->size_data); + Qprintf ("Size init: %lld\n", d->size_init); + Qprintf ("Size vcn: %lld\n", d->size_vcn); - Iprintf ("Data runs:\n"); + Qprintf ("Data runs:\n"); if ((!d->runlist) || (d->runlist[0].length <= 0)) { - Iprintf (" None\n"); + Qprintf (" None\n"); } else { for (i = 0; d->runlist[i].length > 0; i++) { - Iprintf (" %lld @ %lld\n", d->runlist[i].length, d->runlist[i].lcn); + Qprintf (" %lld @ %lld\n", d->runlist[i].length, d->runlist[i].lcn); } } - Iprintf ("Amount potentially recoverable %d%%\n", d->percent); + Qprintf ("Amount potentially recoverable %d%%\n", d->percent); } - Iprintf ("________________________________________\n\n"); + Qprintf ("________________________________________\n\n"); } /** @@ -1067,7 +1067,7 @@ void list_record (struct ufile *file) else name = NONE; - Iprintf ("%-8lld %c%c%c%c %3d%% %s %9lld %s\n", + Qprintf ("%-8lld %c%c%c%c %3d%% %s %9lld %s\n", file->inode, flagd, flagr, flagc, flagx, percent, buffer, size, name); } @@ -1293,8 +1293,8 @@ int scan_disk (ntfs_volume *vol) } } - Iprintf ("Inode Flags %%age Date Size Filename\n"); - Iprintf ("---------------------------------------------------------------\n"); + Qprintf ("Inode Flags %%age Date Size Filename\n"); + Qprintf ("---------------------------------------------------------------\n"); for (i = 0; i < bmpsize; i += BUFSIZE) { read = min ((bmpsize - i), BUFSIZE); size = ntfs_attr_pread (attr, i, read, buffer); @@ -1342,7 +1342,7 @@ skip: } } done: - Iprintf ("\nFiles with potentially recoverable content: %d\n", results); + Qprintf ("\nFiles with potentially recoverable content: %d\n", results); out: if (opts.match) regfree (&re); @@ -1405,10 +1405,10 @@ int undelete_file (ntfs_volume *vol, long long inode) if (opts.verbose) { dump_record (file); } else { - Iprintf ("Inode Flags %%age Date Size Filename\n"); - Iprintf ("---------------------------------------------------------------\n"); + Qprintf ("Inode Flags %%age Date Size Filename\n"); + Qprintf ("---------------------------------------------------------------\n"); list_record (file); - Iprintf ("\n"); + Qprintf ("\n"); } if (file->mft->flags & MFT_RECORD_IN_USE) { @@ -1421,12 +1421,12 @@ int undelete_file (ntfs_volume *vol, long long inode) } if (calc_percentage (file, vol) == 0) { - Iprintf ("File has no recoverable data.\n"); + Qprintf ("File has no recoverable data.\n"); goto free; } if (list_empty (&file->data)) { - Iprintf ("File has no data. There is nothing to recover.\n"); + Qprintf ("File has no data. There is nothing to recover.\n"); goto free; } @@ -1535,7 +1535,7 @@ int undelete_file (ntfs_volume *vol, long long inode) } } } - Iprintf ("\n"); + Qprintf ("\n"); if (close (fd) < 0) { Eprintf ("Close failed: %s\n", strerror (errno)); } @@ -1544,9 +1544,9 @@ int undelete_file (ntfs_volume *vol, long long inode) } set_date (pathname, file->date); if (d->name) - Iprintf ("Undeleted '%s:%s' successfully.\n", file->pref_name, d->name); + Qprintf ("Undeleted '%s:%s' successfully.\n", file->pref_name, d->name); else - Iprintf ("Undeleted '%s' successfully.\n", file->pref_name); + Qprintf ("Undeleted '%s' successfully.\n", file->pref_name); } result = 1; free: diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index ef116af7..8f4c4f42 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -37,6 +37,7 @@ #include "types.h" #include "volume.h" #include "utils.h" +#include "debug.h" static const char *AUTHOR = "Richard Russon (FlatCap)"; static const char *EXEC_NAME = "ntfswipe"; @@ -44,22 +45,7 @@ static struct options opts; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Iprintf, stdout, &opts.quiet, FALSE) - -/** - * Dprintf - Print debug messages - */ -#ifndef DEBUG -#define Dprintf(...) -#else -void Dprintf (const char *format, ...) -{ - va_list va; - va_start (va, format); - vfprintf (stdout, format, va); - va_end (va); -} -#endif +GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) /** * wipe_unused - Wipe unused clusters @@ -76,7 +62,7 @@ int wipe_unused (ntfs_volume *vol, int byte, enum action act) if (!vol || (byte < 0)) return 0; - Iprintf ("wipe_unused 0x%02x\n", byte); + Qprintf ("wipe_unused 0x%02x\n", byte); return 1; } @@ -96,7 +82,7 @@ int wipe_tails (ntfs_volume *vol, int byte, enum action act) if (!vol || (byte < 0)) return 0; - Iprintf ("wipe_tails 0x%02x\n", byte); + Qprintf ("wipe_tails 0x%02x\n", byte); return 1; } @@ -116,7 +102,7 @@ int wipe_mft (ntfs_volume *vol, int byte, enum action act) if (!vol || (byte < 0)) return 0; - Iprintf ("wipe_mft 0x%02x\n", byte); + Qprintf ("wipe_mft 0x%02x\n", byte); return 1; } @@ -136,7 +122,7 @@ int wipe_directory (ntfs_volume *vol, int byte, enum action act) if (!vol || (byte < 0)) return 0; - Iprintf ("wipe_directory 0x%02x\n", byte); + Qprintf ("wipe_directory 0x%02x\n", byte); return 1; } @@ -156,7 +142,7 @@ int wipe_logfile (ntfs_volume *vol, int byte, enum action act) if (!vol || (byte < 0)) return 0; - Iprintf ("wipe_logfile 0x%02x\n", byte); + Qprintf ("wipe_logfile 0x%02x\n", byte); return 1; } @@ -176,7 +162,7 @@ int wipe_pagefile (ntfs_volume *vol, int byte, enum action act) if (!vol || (byte < 0)) return 0; - Iprintf ("wipe_pagefile 0x%02x\n", byte); + Qprintf ("wipe_pagefile 0x%02x\n", byte); return 1; } @@ -198,26 +184,26 @@ int ntfs_info (ntfs_volume *vol) if (!vol) return 0; - Iprintf ("ntfs_info\n"); + Qprintf ("ntfs_info\n"); - Iprintf ("\n"); + Qprintf ("\n"); - Iprintf ("Cluster size = %u\n", vol->cluster_size); - Iprintf ("Volume size = %lld clusters\n", vol->nr_clusters); - Iprintf ("Volume size = %lld bytes\n", vol->nr_clusters * vol->cluster_size); - Iprintf ("Volume size = %lld MiB\n", vol->nr_clusters * vol->cluster_size / (1024*1024)); /* round up? */ + Qprintf ("Cluster size = %u\n", vol->cluster_size); + Qprintf ("Volume size = %lld clusters\n", vol->nr_clusters); + Qprintf ("Volume size = %lld bytes\n", vol->nr_clusters * vol->cluster_size); + Qprintf ("Volume size = %lld MiB\n", vol->nr_clusters * vol->cluster_size / (1024*1024)); /* round up? */ - Iprintf ("\n"); + Qprintf ("\n"); // move back bufsize buffer = malloc (vol->mft_record_size); if (!buffer) return 0; - Iprintf ("cluster\n"); - //Iprintf ("allocated_size = %lld\n", vol->lcnbmp_na->allocated_size); - Iprintf ("data_size = %lld\n", vol->lcnbmp_na->data_size); - //Iprintf ("initialized_size = %lld\n", vol->lcnbmp_na->initialized_size); + Qprintf ("cluster\n"); + //Qprintf ("allocated_size = %lld\n", vol->lcnbmp_na->allocated_size); + Qprintf ("data_size = %lld\n", vol->lcnbmp_na->data_size); + //Qprintf ("initialized_size = %lld\n", vol->lcnbmp_na->initialized_size); { u64 offset; @@ -253,8 +239,8 @@ int ntfs_info (ntfs_volume *vol) } done: - Iprintf ("cluster use %lld, not %lld, total %lld\n", use, not, use+not); - Iprintf ("\n"); + Qprintf ("cluster use %lld, not %lld, total %lld\n", use, not, use+not); + Qprintf ("\n"); } @@ -272,9 +258,9 @@ done: printf ("mft has %lld records\n", vol->nr_mft_records); - //Iprintf ("allocated_size = %lld\n", vol->mftbmp_na->allocated_size); - Iprintf ("data_size = %lld\n", vol->mftbmp_na->data_size); - //Iprintf ("initialized_size = %lld\n", vol->mftbmp_na->initialized_size); + //Qprintf ("allocated_size = %lld\n", vol->mftbmp_na->allocated_size); + Qprintf ("data_size = %lld\n", vol->mftbmp_na->data_size); + //Qprintf ("initialized_size = %lld\n", vol->mftbmp_na->initialized_size); printf ("bmpsize = %lld\n", bmpsize); for (bmpoff = 0; bmpoff < bmpsize; bmpoff += bmpbufsize) { @@ -366,7 +352,7 @@ bmpdone: */ void version (void) { - Iprintf ("%s v%s Copyright (C) 2002 %s\nOverwrite the unused space on " + Qprintf ("%s v%s Copyright (C) 2002 %s\nOverwrite the unused space on " "an NTFS Volume\n\n%s is free software, released under the GNU " "General Public License\nand you are welcome to redistribute " "it under certain conditions.\n%s comes with ABSOLUTELY NO " @@ -385,7 +371,7 @@ void version (void) */ void usage (void) { - Iprintf ("Usage: %s [options] device\n" + Qprintf ("Usage: %s [options] device\n" " -i --info Show volume information (default)\n" "\n" " -d --directory Wipe directory indexes\n" @@ -407,7 +393,7 @@ void usage (void) " -V --version Version information\n" " -h --help Print this help\n\n", EXEC_NAME); - Iprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); + Qprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); } /** @@ -668,33 +654,33 @@ void print_summary (void) int i; if (opts.noaction) - Iprintf ("%s is in 'no-action' mode, it will NOT write to disk." + Qprintf ("%s is in 'no-action' mode, it will NOT write to disk." "\n\n", EXEC_NAME); - Iprintf ("%s is about to wipe:\n", EXEC_NAME); + Qprintf ("%s is about to wipe:\n", EXEC_NAME); if (opts.unused) - Iprintf ("\tunused disk space\n"); + Qprintf ("\tunused disk space\n"); if (opts.tails) - Iprintf ("\tfile tails\n"); + Qprintf ("\tfile tails\n"); if (opts.mft) - Iprintf ("\tunused mft areas\n"); + Qprintf ("\tunused mft areas\n"); if (opts.directory) - Iprintf ("\tunused directory index space\n"); + Qprintf ("\tunused directory index space\n"); if (opts.logfile) - Iprintf ("\tthe logfile (journal)\n"); + Qprintf ("\tthe logfile (journal)\n"); if (opts.pagefile) - Iprintf ("\tthe pagefile (swap space)\n"); + Qprintf ("\tthe pagefile (swap space)\n"); - Iprintf ("\n%s will overwrite these areas with: ", EXEC_NAME); + Qprintf ("\n%s will overwrite these areas with: ", EXEC_NAME); if (opts.bytes) { for (i = 0; opts.bytes[i] >= 0; i++) - Iprintf ("0x%02x ", opts.bytes[i]); + Qprintf ("0x%02x ", opts.bytes[i]); } - Iprintf ("\n"); + Qprintf ("\n"); if (opts.count > 1) - Iprintf ("%s will repeat these operations %d times.\n", EXEC_NAME, opts.count); - Iprintf ("\n"); + Qprintf ("%s will repeat these operations %d times.\n", EXEC_NAME, opts.count); + Qprintf ("\n"); } /** @@ -729,12 +715,12 @@ int main (int argc, char *argv[]) goto free; if (vol->flags & VOLUME_IS_DIRTY) { - Iprintf ("Volume is dirty.\n"); + Qprintf ("Volume is dirty.\n"); if (!opts.force) { Eprintf ("Run chkdsk and try again, or use the --force option.\n"); goto umount; } - Iprintf ("Forced to continue.\n"); + Qprintf ("Forced to continue.\n"); } if (opts.info) { @@ -748,7 +734,7 @@ int main (int argc, char *argv[]) /* Even if the output it quieted, you still get 5 seconds to abort. */ if ((act == act_wipe) && !opts.force) { - Iprintf ("\n%s will begin in 5 seconds, press CTRL-C to abort.\n", EXEC_NAME); + Qprintf ("\n%s will begin in 5 seconds, press CTRL-C to abort.\n", EXEC_NAME); sleep (5); } From 070c787a27774171d9dec691370db8c721325ed7 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:48:06 +0000 Subject: [PATCH 0435/2994] standardise on Qprintf for Quietable output 2003/01/14 23:44:46+00:00 flatcap.org!flatcap Change mode to -rw-rw-r-- (Logical change 1.104) --- ntfsprogs/ntfscluster.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index aff02c53..703a3e14 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -40,7 +40,7 @@ static struct options opts; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Iprintf, stdout, &opts.quiet, FALSE) +GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) /** * version - Print version information about the program @@ -51,7 +51,7 @@ GEN_PRINTF (Iprintf, stdout, &opts.quiet, FALSE) */ void version (void) { - Iprintf ("%s v%s Copyright (C) 2002 %s\n***XXX***on " + Qprintf ("%s v%s Copyright (C) 2002 %s\n***XXX***on " "an NTFS Volume\n\n%s is free software, released under the GNU " "General Public License\nand you are welcome to redistribute " "it under certain conditions.\n%s comes with ABSOLUTELY NO " @@ -70,7 +70,7 @@ void version (void) */ void usage (void) { - Iprintf ("Usage: %s [options] device\n" + Qprintf ("Usage: %s [options] device\n" " -i --info Print information about the volume\n" " -c range --cluster range Look for objects in this range of clusters\n" " -s range --sector range Look for objects in this range of sectors\n" @@ -82,7 +82,7 @@ void usage (void) " -V --version Version information\n" " -h --help Print this help\n\n", EXEC_NAME); - Iprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); + Qprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); } /** @@ -370,9 +370,9 @@ int main (int argc, char *argv[]) switch (opts.action) { case act_sector: if (opts.range_begin == opts.range_end) - Iprintf ("Searching for sector %lld\n", opts.range_begin); + Qprintf ("Searching for sector %lld\n", opts.range_begin); else - Iprintf ("Searching for sector range %lld-%lld\n", opts.range_begin, opts.range_end); + Qprintf ("Searching for sector range %lld-%lld\n", opts.range_begin, opts.range_end); /* Convert to clusters */ opts.range_begin <<= (vol->cluster_size_bits - vol->sector_size_bits); opts.range_end <<= (vol->cluster_size_bits - vol->sector_size_bits); @@ -380,9 +380,9 @@ int main (int argc, char *argv[]) break; case act_cluster: if (opts.range_begin == opts.range_end) - Iprintf ("Searching for cluster %lld\n", opts.range_begin); + Qprintf ("Searching for cluster %lld\n", opts.range_begin); else - Iprintf ("Searching for cluster range %lld-%lld\n", opts.range_begin, opts.range_end); + Qprintf ("Searching for cluster range %lld-%lld\n", opts.range_begin, opts.range_end); result = cluster_find (vol, opts.range_begin, opts.range_end); break; /* From ee6765096d4e32ba0de2580033178c194bc50e22 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:48:06 +0000 Subject: [PATCH 0436/2994] standardise the tools a bit BKrev: 3e2a9076I8wI_d597pYW-D11x93_lA From bfb9a428eb2b326f64471819a18f53534709edaa Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:48:06 +0000 Subject: [PATCH 0437/2994] start using the utils (Logical change 1.104) --- ntfsprogs/ntfstruncate.c | 74 ++++++++++++---------------------------- 1 file changed, 22 insertions(+), 52 deletions(-) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index a2062d90..b817ab1d 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -60,6 +60,7 @@ #include "inode.h" #include "layout.h" #include "volume.h" +#include "utils.h" extern const unsigned char attrdef_ntfs12_array[2400]; @@ -85,25 +86,18 @@ ATTR_DEF *attr_defs; struct { /* -h, print usage and exit. */ - char no_action; /* -n, do not write to device, only display + int no_action; /* -n, do not write to device, only display what would be done. */ - char quiet; /* -q, quiet execution. */ - char verbose; /* -v, verbose execution, given twice, really + int quiet; /* -q, quiet execution. */ + int verbose; /* -v, verbose execution, given twice, really verbose execution (debug mode). */ - char force; /* -f, force truncation. */ + int force; /* -f, force truncation. */ /* -V, print version and exit. */ -} opt; +} opts; -/* Error output. Ignores quiet (-q). */ -void Eprintf(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "ERROR: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); -} +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) void err_exit(const char *fmt, ...) __attribute__ ((noreturn)); @@ -125,7 +119,7 @@ void Dprintf(const char *fmt, ...) { va_list ap; - if (!opt.quiet && opt.verbose > 1) { + if (!opts.quiet && opts.verbose > 1) { printf("DEBUG: "); va_start(ap, fmt); vprintf(fmt, ap); @@ -133,30 +127,6 @@ void Dprintf(const char *fmt, ...) } } -/* Verbose output (-v). Overriden by quite (-q). */ -void Vprintf(const char *fmt, ...) -{ - va_list ap; - - if (!opt.quiet && opt.verbose > 0) { - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); - } -} - -/* Quietable output (if not -q). */ -void Qprintf(const char *fmt, ...) -{ - va_list ap; - - if (!opt.quiet) { - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); - } -} - /** * ucstos - convert unicode-character string to ASCII * @dest: points to buffer to receive the converted string @@ -556,16 +526,16 @@ void parse_options(int argc, char *argv[]) while ((c = getopt(argc, argv, "fhnqvV")) != EOF) switch (c) { case 'f': - opt.force = 1; + opts.force = 1; break; case 'n': - opt.no_action = 1; + opts.no_action = 1; break; case 'q': - opt.quiet = 1; + opts.quiet = 1; break; case 'v': - opt.verbose++; + opts.verbose++; break; case 'V': /* Version number already printed, so just exit. */ @@ -679,8 +649,8 @@ int main(int argc, char **argv) unsigned long mnt_flags, ul; int err; - /* Initialize opt to zero / required values. */ - memset(&opt, 0, sizeof(opt)); + /* Initialize opts to zero / required values. */ + memset(&opts, 0, sizeof(opts)); /* * Setup a default $AttrDef. FIXME: Should be reading this from the @@ -697,14 +667,14 @@ int main(int argc, char **argv) dev_name, strerror(errno)); else if (mnt_flags & NTFS_MF_MOUNTED) { Eprintf("%s is mounted.\n", dev_name); - if (!opt.force) + if (!opts.force) err_exit("Refusing to run!\n"); fprintf(stderr, "ntfstruncate forced anyway. Hope /etc/mtab " "is incorrect.\n"); } /* Mount the device. */ - if (opt.no_action) { + if (opts.no_action) { Qprintf("Running in READ-ONLY mode!\n"); ul = MS_RDONLY; } else @@ -715,7 +685,7 @@ int main(int argc, char **argv) /* Acquire exlusive (mandatory) lock on the whole device. */ memset(&flk, 0, sizeof(flk)); - if (opt.no_action) + if (opts.no_action) flk.l_type = F_RDLCK; else flk.l_type = F_WRLCK; @@ -724,7 +694,7 @@ int main(int argc, char **argv) err = fcntl(vol->fd, F_SETLK, &flk); if (err == -1) { Eprintf("Could not lock %s for %s: %s\n", dev_name, - opt.no_action ? "reading" : "writing", + opts.no_action ? "reading" : "writing", strerror(errno)); err = ntfs_umount(vol, 0); if (err == -1) @@ -754,7 +724,7 @@ int main(int argc, char **argv) err_exit("Failed to open attribute 0x%x: %s\n", attr_type, strerror(errno)); - if (!opt.quiet && opt.verbose > 1) { + if (!opts.quiet && opts.verbose > 1) { Dprintf("Dumping mft record before calling " "ntfs_attr_truncate():\n"); dump_mft_record(ni->mrec); @@ -766,7 +736,7 @@ int main(int argc, char **argv) err_exit("Failed to truncate attribute 0x%x: %s\n", attr_type, strerror(errno)); - if (!opt.quiet && opt.verbose > 1) { + if (!opts.quiet && opts.verbose > 1) { Dprintf("Dumping mft record after calling " "ntfs_attr_truncate():\n"); dump_mft_record(ni->mrec); From 563fc1711832f1b6add4c14e3e48981111269520 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:48:06 +0000 Subject: [PATCH 0438/2994] start using utils (Logical change 1.104) --- ntfsprogs/mkntfs.c | 413 +++++++++++++++++++++------------------------ 1 file changed, 192 insertions(+), 221 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 9160d54d..23171552 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -98,6 +98,8 @@ #include "mst.h" #include "dir.h" #include "runlist.h" +//#include "debug.h" +#include "utils.h" extern const unsigned char attrdef_ntfs12_array[2400]; extern const unsigned char boot_array[3429]; @@ -156,11 +158,11 @@ struct { int attr_defs_len; /* in bytes */ uchar_t *upcase; /* filename, upcase table. */ u32 upcase_len; /* Determined automatically. */ - char quiet; /* -q, quiet execution. */ - char verbose; /* -v, verbose execution, given twice, + int quiet; /* -q, quiet execution. */ + int verbose; /* -v, verbose execution, given twice, * really verbose execution (debug * mode). */ - char force; /* -F, force fs creation. */ + int force; /* -F, force fs creation. */ char quick_format; /* -f or -Q, fast format, don't zero the volume first. */ char enable_compression; /* -C, enables compression of all files @@ -168,18 +170,11 @@ struct { char disable_indexing; /* -I, disables indexing of file contents on the volume by default. */ /* -V, print version and exit. */ -} opt; +} opts; -/* Error output. Ignores quiet (-q). */ -void Eprintf(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "ERROR: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); -} +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) void err_exit(const char *fmt, ...) __attribute__ ((noreturn)); @@ -201,7 +196,7 @@ void Dprintf(const char *fmt, ...) { va_list ap; - if (!opt.quiet && opt.verbose > 1) { + if (!opts.quiet && opts.verbose > 1) { printf("DEBUG: "); va_start(ap, fmt); vprintf(fmt, ap); @@ -209,45 +204,21 @@ void Dprintf(const char *fmt, ...) } } -/* Verbose output (-v). */ -void Vprintf(const char *fmt, ...) -{ - va_list ap; - - if (!opt.quiet && opt.verbose > 0) { - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); - } -} - -/* Quietable output (if not -q). */ -void Qprintf(const char *fmt, ...) -{ - va_list ap; - - if (!opt.quiet) { - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); - } -} - void append_to_bad_blocks(unsigned long block) { long long *new_buf; - if (!(opt.nr_bad_blocks & 15)) { - new_buf = realloc(opt.bad_blocks, (opt.nr_bad_blocks + 16) * + if (!(opts.nr_bad_blocks & 15)) { + new_buf = realloc(opts.bad_blocks, (opts.nr_bad_blocks + 16) * sizeof(long long)); if (!new_buf) err_exit("Reallocating memory for bad blocks list " "failed: %s\n", strerror(errno)); - if (opt.bad_blocks != new_buf) - free(opt.bad_blocks); - opt.bad_blocks = new_buf; + if (opts.bad_blocks != new_buf) + free(opts.bad_blocks); + opts.bad_blocks = new_buf; } - opt.bad_blocks[opt.nr_bad_blocks++] = block; + opts.bad_blocks[opts.nr_bad_blocks++] = block; } __inline__ long long mkntfs_write(int fd, const void *buf, long long count) @@ -255,7 +226,7 @@ __inline__ long long mkntfs_write(int fd, const void *buf, long long count) long long bytes_written, total; int retry; - if (opt.no_action) + if (opts.no_action) return count; total = 0LL; retry = 0; @@ -301,7 +272,7 @@ s64 ntfs_rlwrite(int fd, const runlist *rl, const char *val, if (inited_size) *inited_size = 0LL; - if (opt.no_action) + if (opts.no_action) return val_len; total = delta = 0LL; for (i = 0; rl[i].length; i++) { @@ -628,15 +599,15 @@ void dump_attr_record(ATTR_RECORD *a) return; } u = le32_to_cpu(a->type); - for (i = 0; opt.attr_defs[i].type; i++) - if (le32_to_cpu(opt.attr_defs[i].type) >= u) + for (i = 0; opts.attr_defs[i].type; i++) + if (le32_to_cpu(opts.attr_defs[i].type) >= u) break; - if (opt.attr_defs[i].type) { -// printf("type = 0x%x\n", le32_to_cpu(opt.attr_defs[i].type)); -// { char *p = (char*)opt.attr_defs[i].name; + if (opts.attr_defs[i].type) { +// printf("type = 0x%x\n", le32_to_cpu(opts.attr_defs[i].type)); +// { char *p = (char*)opts.attr_defs[i].name; // printf("name = %c%c%c%c%c\n", *p, p[1], p[2], p[3], p[4]); // } - if (ucstos(s, opt.attr_defs[i].name, sizeof(s)) == -1) { + if (ucstos(s, opts.attr_defs[i].name, sizeof(s)) == -1) { Eprintf("Could not convert Unicode string to single " "byte string in current locale.\n"); strncpy(s, "Error converting Unicode string", @@ -794,7 +765,7 @@ void format_mft_record(MFT_RECORD *m) a->type = AT_END; a->length = cpu_to_le32(0); #if 0 - if (!opt.quiet && opt.verbose > 1) + if (!opts.quiet && opts.verbose > 1) dump_mft_record(m); #endif } @@ -891,11 +862,11 @@ runlist *allocate_scattered_clusters(s64 clusters) s64 prev_run_len = 0LL; char bit; - end = opt.nr_clusters; + end = opts.nr_clusters; /* Loop until all clusters are allocated. */ while (clusters) { /* Loop in current zone until we run out of free clusters. */ - for (lcn = opt.mft_zone_end; lcn < end; lcn++) { + for (lcn = opts.mft_zone_end; lcn < end; lcn++) { bit = ntfs_bit_get_and_set(lcn_bitmap, lcn, 1); if (bit) continue; @@ -930,10 +901,10 @@ runlist *allocate_scattered_clusters(s64 clusters) } /* Switch to next zone, decreasing mft zone by factor 2. */ - end = opt.mft_zone_end; - opt.mft_zone_end >>= 1; + end = opts.mft_zone_end; + opts.mft_zone_end >>= 1; /* Have we run out of space on the volume? */ - if (opt.mft_zone_end <= 0) + if (opts.mft_zone_end <= 0) goto err_end; } return rl; @@ -1129,7 +1100,7 @@ int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, if (err >= 0) err = -EIO; Eprintf("insert_positioned_attr_in_mft_record failed with " - "error %i.\n", err < 0 ? err : bw); + "error %lld.\n", err < 0 ? err : bw); } err_out: if (ctx) @@ -1314,7 +1285,7 @@ int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, if (err >= 0) err = -EIO; Eprintf("insert_non_resident_attr_in_mft_record failed with " - "error %i.\n", err < 0 ? err : bw); + "error %lld.\n", (long long) (err < 0 ? err : bw)); } err_out: if (ctx) @@ -1722,14 +1693,14 @@ int add_attr_index_root(MFT_RECORD *m, const char *name, const u32 name_len, free(r); return -EINVAL; } - if (index_block_size < opt.sector_size) { + if (index_block_size < opts.sector_size) { Eprintf("add_attr_index_root: index block size is " "smaller than the sector size.\n"); free(r); return -EINVAL; } r->clusters_per_index_block = index_block_size / - opt.sector_size; + opts.sector_size; } memset(&r->reserved, 0, sizeof(r->reserved)); r->index.entries_offset = cpu_to_le32(sizeof(INDEX_HEADER)); @@ -2250,11 +2221,11 @@ int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, void init_options() { - memset(&opt, 0, sizeof(opt)); - opt.index_block_size = 4096; - opt.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; - opt.attr_defs_len = sizeof(attrdef_ntfs12_array); - //Dprintf("Attr_defs table length = %u\n", opt.attr_defs_len); + memset(&opts, 0, sizeof(opts)); + opts.index_block_size = 4096; + opts.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; + opts.attr_defs_len = sizeof(attrdef_ntfs12_array); + //Dprintf("Attr_defs table length = %u\n", opts.attr_defs_len); } void usage(void) __attribute__ ((noreturn)); @@ -2285,7 +2256,7 @@ void parse_options(int argc, char *argv[]) while ((c = getopt(argc, argv, "c:fnqs:vz:CFIL:QV")) != EOF) switch (c) { case 'n': - opt.no_action = 1; + opts.no_action = 1; break; case 'c': l = strtol(optarg, &s, 0); @@ -2295,34 +2266,34 @@ void parse_options(int argc, char *argv[]) break; case 'f': case 'Q': - opt.quick_format = 1; + opts.quick_format = 1; break; case 'q': - opt.quiet = 1; + opts.quiet = 1; break; case 's': l = strtol(optarg, &s, 0); if (!l || l > INT_MAX || *s) err_exit("Invalid sector size.\n"); - opt.sector_size = l; + opts.sector_size = l; break; case 'v': - opt.verbose++; + opts.verbose++; break; case 'z': l = strtol(optarg, &s, 0); if (l < 1 || l > 4 || *s) err_exit("Invalid MFT zone multiplier.\n"); - opt.mft_zone_multiplier = l; + opts.mft_zone_multiplier = l; break; case 'C': - opt.enable_compression = 1; + opts.enable_compression = 1; break; case 'F': - opt.force = 1; + opts.force = 1; break; case 'I': - opt.disable_indexing = 1; + opts.disable_indexing = 1; break; case 'L': vol->vol_name = optarg; @@ -2341,7 +2312,7 @@ void parse_options(int argc, char *argv[]) if (*s || !u || (u >= ULONG_MAX && errno == ERANGE)) err_exit("Invalid number of sectors: %s\n", argv[optind - 1]); - opt.nr_sectors = u; + opts.nr_sectors = u; } if (optind < argc) usage(); @@ -2377,10 +2348,10 @@ void mkntfs_exit(void) free(rl_bad); if (rl_index) free(rl_index); - if (opt.bad_blocks) - free(opt.bad_blocks); - if (opt.attr_defs != (ATTR_DEF*)attrdef_ntfs12_array) - free(opt.attr_defs); + if (opts.bad_blocks) + free(opts.bad_blocks); + if (opts.attr_defs != (ATTR_DEF*)attrdef_ntfs12_array) + free(opts.attr_defs); if (vol->upcase) free(vol->upcase); flk.l_type = F_UNLCK; @@ -2396,10 +2367,10 @@ void mkntfs_exit(void) free(vol); } +// What's wrong with MK_MREF? #define MAKE_MFT_REF(_ref, _seqno) cpu_to_le64((((u64)(_seqno)) << 48) \ | ((u64)(_ref))) - int main(int argc, char **argv) { int i, j, err; @@ -2430,7 +2401,7 @@ int main(int argc, char **argv) if (!vol->upcase) err_exit("Could not allocate memory for internal buffer.\n"); init_upcase_table(vol->upcase, vol->upcase_len * sizeof(uchar_t)); - /* Initialize opt to zero / required values. */ + /* Initialize opts to zero / required values. */ init_options(); /* Parse command line options. */ parse_options(argc, argv); @@ -2444,25 +2415,25 @@ int main(int argc, char **argv) } if (!S_ISBLK(sbuf.st_mode)) { Eprintf("%s is not a block device.\n", vol->dev_name); - if (!opt.force) + if (!opts.force) err_exit("Refusing to make a filesystem here!\n"); - if (!opt.nr_sectors) { + if (!opts.nr_sectors) { if (!sbuf.st_size && !sbuf.st_blocks) err_exit("You must specify the number of " "sectors.\n"); - if (opt.sector_size) { + if (opts.sector_size) { if (sbuf.st_size) - opt.nr_sectors = sbuf.st_size / - opt.sector_size; + opts.nr_sectors = sbuf.st_size / + opts.sector_size; else - opt.nr_sectors = ((s64)sbuf.st_blocks - << 9) / opt.sector_size; + opts.nr_sectors = ((s64)sbuf.st_blocks + << 9) / opts.sector_size; } else { if (sbuf.st_size) - opt.nr_sectors = sbuf.st_size / 512; + opts.nr_sectors = sbuf.st_size / 512; else - opt.nr_sectors = sbuf.st_blocks; - opt.sector_size = 512; + opts.nr_sectors = sbuf.st_blocks; + opts.sector_size = 512; } } fprintf(stderr, "mkntfs forced anyway.\n"); @@ -2482,14 +2453,14 @@ int main(int argc, char **argv) vol->dev_name, strerror(errno)); else if (mnt_flags & NTFS_MF_MOUNTED) { Eprintf("%s is mounted.\n", vol->dev_name); - if (!opt.force) + if (!opts.force) err_exit("Refusing to make a filesystem here!\n"); fprintf(stderr, "mkntfs forced anyway. Hope /etc/mtab is " "incorrect.\n"); } /* Open the device for reading or reading and writing. */ - if (opt.no_action) { + if (opts.no_action) { Qprintf("Running in READ-ONLY mode!\n"); i = O_RDONLY; } else @@ -2500,7 +2471,7 @@ int main(int argc, char **argv) strerror(errno)); /* Acquire exlusive (mandatory) write lock on the whole device. */ memset(&flk, 0, sizeof(flk)); - if (opt.no_action) + if (opts.no_action) flk.l_type = F_RDLCK; else flk.l_type = F_WRLCK; @@ -2509,7 +2480,7 @@ int main(int argc, char **argv) err = fcntl(vol->fd, F_SETLK, &flk); if (err == -1) { Eprintf("Could not lock %s for %s: %s\n", vol->dev_name, - opt.no_action ? "reading" : "writing", + opts.no_action ? "reading" : "writing", strerror(errno)); err = close(vol->fd); if (err == -1) @@ -2526,12 +2497,12 @@ int main(int argc, char **argv) exit(1); } /* If user didn't specify the sector size, determine it now. */ - if (!opt.sector_size) { + if (!opts.sector_size) { #ifdef BLKSSZGET int _sect_size = 0; if (ioctl(vol->fd, BLKSSZGET, &_sect_size) >= 0) - opt.sector_size = _sect_size; + opts.sector_size = _sect_size; else #endif { @@ -2539,57 +2510,57 @@ int main(int argc, char **argv) "not be obtained automatically.\n" "Assuming sector size is 512 bytes.\n", vol->dev_name); - opt.sector_size = 512; + opts.sector_size = 512; } } /* Validate sector size. */ - if ((opt.sector_size - 1) & opt.sector_size || - opt.sector_size < 256 || opt.sector_size > 4096) + if ((opts.sector_size - 1) & opts.sector_size || + opts.sector_size < 256 || opts.sector_size > 4096) err_exit("Error: sector_size is invalid. It must be a power " "of two, and it must be\n greater or equal 256 and " "less than or equal 4096 bytes.\n"); - Dprintf("sector size = %i bytes\n", opt.sector_size); + Dprintf("sector size = %i bytes\n", opts.sector_size); /* If user didn't specify the number of sectors, determine it now. */ - if (!opt.nr_sectors) { - opt.nr_sectors = ntfs_device_size_get(vol->fd, opt.sector_size); - if (opt.nr_sectors <= 0) + if (!opts.nr_sectors) { + opts.nr_sectors = ntfs_device_size_get(vol->fd, opts.sector_size); + if (opts.nr_sectors <= 0) err_exit("ntfs_device_size_get(%s) failed. Please " "specify it manually.\n", vol->dev_name); } - Dprintf("number of sectors = %Ld (0x%Lx)\n", opt.nr_sectors, - opt.nr_sectors); + Dprintf("number of sectors = %Ld (0x%Lx)\n", opts.nr_sectors, + opts.nr_sectors); /* Reserve the last sector for the backup boot sector. */ - opt.nr_sectors--; + opts.nr_sectors--; /* If user didn't specify the volume size, determine it now. */ - if (!opt.volume_size) - opt.volume_size = opt.nr_sectors * opt.sector_size; - else if (opt.volume_size & (opt.sector_size - 1)) + if (!opts.volume_size) + opts.volume_size = opts.nr_sectors * opts.sector_size; + else if (opts.volume_size & (opts.sector_size - 1)) err_exit("Error: volume_size is not a multiple of " "sector_size.\n"); /* Validate volume size. */ - if (opt.volume_size < 1 << 20 /* 1MiB */) + if (opts.volume_size < 1 << 20 /* 1MiB */) err_exit("Error: device is too small (%ikiB). Minimum NTFS " - "volume size is 1MiB.\n", opt.volume_size / 1024); - Dprintf("volume size = %LikiB\n", opt.volume_size / 1024); + "volume size is 1MiB.\n", opts.volume_size / 1024); + Dprintf("volume size = %LikiB\n", opts.volume_size / 1024); /* If user didn't specify the cluster size, determine it now. */ if (!vol->cluster_size) { - if (opt.volume_size <= 512LL << 20) /* <= 512MB */ + if (opts.volume_size <= 512LL << 20) /* <= 512MB */ vol->cluster_size = 512; - else if (opt.volume_size <= 1LL << 30) /* ]512MB-1GB] */ + else if (opts.volume_size <= 1LL << 30) /* ]512MB-1GB] */ vol->cluster_size = 1024; - else if (opt.volume_size <= 2LL << 30) /* ]1GB-2GB] */ + else if (opts.volume_size <= 2LL << 30) /* ]1GB-2GB] */ vol->cluster_size = 2048; else vol->cluster_size = 4096; /* For small volumes on devices with large sector sizes. */ - if (vol->cluster_size < opt.sector_size) - vol->cluster_size = opt.sector_size; + if (vol->cluster_size < opts.sector_size) + vol->cluster_size = opts.sector_size; } /* Validate cluster size. */ if (vol->cluster_size & (vol->cluster_size - 1) || - vol->cluster_size < opt.sector_size || - vol->cluster_size > 128 * opt.sector_size || + vol->cluster_size < opts.sector_size || + vol->cluster_size > 128 * opts.sector_size || vol->cluster_size > 65536) err_exit("Error: cluster_size is invalid. It must be a power " "of two, be at least\nthe same as sector_size, be " @@ -2599,15 +2570,15 @@ int main(int argc, char **argv) vol->cluster_size_bits = ffs(vol->cluster_size) - 1; Dprintf("cluster size = %i bytes\n", vol->cluster_size); if (vol->cluster_size > 4096) { - if (opt.enable_compression) { - if (!opt.force) + if (opts.enable_compression) { + if (!opts.force) err_exit("Error: cluster_size is above 4096 " "bytes and compression is " "requested.\nThis is not " "possible due to limitations " "in the compression algorithm " "used by\nWindows.\n"); - opt.enable_compression = 0; + opts.enable_compression = 0; } Qprintf("Warning: compression will be disabled on this volume " "because it is not\nsupported when the cluster " @@ -2616,23 +2587,23 @@ int main(int argc, char **argv) "by Windows.\n"); } /* If user didn't specify the number of clusters, determine it now. */ - if (!opt.nr_clusters) - opt.nr_clusters = opt.volume_size / vol->cluster_size; + if (!opts.nr_clusters) + opts.nr_clusters = opts.volume_size / vol->cluster_size; /* * Check the cluster_size and nr_sectors for consistency with * sector_size and nr_sectors. And check both of these for consistency * with volume_size. */ - if (opt.nr_clusters != (opt.nr_sectors * opt.sector_size) / + if (opts.nr_clusters != (opts.nr_sectors * opts.sector_size) / vol->cluster_size || - opt.volume_size / opt.sector_size != opt.nr_sectors || - opt.volume_size / vol->cluster_size != opt.nr_clusters) + opts.volume_size / opts.sector_size != opts.nr_sectors || + opts.volume_size / vol->cluster_size != opts.nr_clusters) err_exit("Illegal combination of volume/cluster/sector size " "and/or cluster/sector number.\n"); - Dprintf("number of clusters = %Lu (0x%Lx)\n", opt.nr_clusters, - opt.nr_clusters); + Dprintf("number of clusters = %Lu (0x%Lx)\n", opts.nr_clusters, + opts.nr_clusters); /* Determine lcn bitmap byte size and allocate it. */ - lcn_bitmap_byte_size = (opt.nr_clusters + 7) >> 3; + lcn_bitmap_byte_size = (opts.nr_clusters + 7) >> 3; /* Needs to be multiple of 8 bytes. */ lcn_bitmap_byte_size = (lcn_bitmap_byte_size + 7) & ~7; i = (lcn_bitmap_byte_size + vol->cluster_size - 1) & @@ -2647,17 +2618,17 @@ int main(int argc, char **argv) * $Bitmap can overlap the end of the volume. Any bits in this region * must be set. This region also encompasses the backup boot sector. */ - for (i = opt.nr_clusters; i < lcn_bitmap_byte_size << 3; i++) + for (i = opts.nr_clusters; i < lcn_bitmap_byte_size << 3; i++) ntfs_bit_set(lcn_bitmap, (u64)i, 1); /* * Determine mft_size: 16 mft records or 1 cluster, which ever is * bigger, rounded to multiples of cluster size. */ - opt.mft_size = (16 * vol->mft_record_size + vol->cluster_size - 1) + opts.mft_size = (16 * vol->mft_record_size + vol->cluster_size - 1) & ~(vol->cluster_size - 1); - Dprintf("MFT size = %i (0x%x) bytes\n", opt.mft_size, opt.mft_size); + Dprintf("MFT size = %i (0x%x) bytes\n", opts.mft_size, opts.mft_size); /* Determine mft bitmap size and allocate it. */ - mft_bitmap_size = opt.mft_size / vol->mft_record_size; + mft_bitmap_size = opts.mft_size / vol->mft_record_size; /* Convert to bytes, at least one. */ mft_bitmap_byte_size = (mft_bitmap_size + 7) >> 3; /* Mft bitmap is allocated in multiples of 8 bytes. */ @@ -2687,66 +2658,66 @@ int main(int argc, char **argv) /* Allocate cluster for mft bitmap. */ ntfs_bit_set(lcn_bitmap, (s64)j, 1); /* If user didn't specify the mft lcn, determine it now. */ - if (!opt.mft_lcn) { + if (!opts.mft_lcn) { /* * We start at the higher value out of 16kiB and just after the * mft bitmap. */ - opt.mft_lcn = rl_mft_bmp[0].lcn + rl_mft_bmp[0].length; - if (opt.mft_lcn * vol->cluster_size < 16 * 1024) - opt.mft_lcn = (16 * 1024 + vol->cluster_size - 1) / + opts.mft_lcn = rl_mft_bmp[0].lcn + rl_mft_bmp[0].length; + if (opts.mft_lcn * vol->cluster_size < 16 * 1024) + opts.mft_lcn = (16 * 1024 + vol->cluster_size - 1) / vol->cluster_size; } - Dprintf("$MFT logical cluster number = 0x%x\n", opt.mft_lcn); + Dprintf("$MFT logical cluster number = 0x%x\n", opts.mft_lcn); /* Determine MFT zone size. */ - opt.mft_zone_end = opt.nr_clusters; - switch (opt.mft_zone_multiplier) { /* % of volume size in clusters */ + opts.mft_zone_end = opts.nr_clusters; + switch (opts.mft_zone_multiplier) { /* % of volume size in clusters */ case 4: - opt.mft_zone_end = opt.mft_zone_end >> 1; /* 50% */ + opts.mft_zone_end = opts.mft_zone_end >> 1; /* 50% */ break; case 3: - opt.mft_zone_end = opt.mft_zone_end * 3 >> 3; /* 37.5% */ + opts.mft_zone_end = opts.mft_zone_end * 3 >> 3; /* 37.5% */ break; case 2: - opt.mft_zone_end = opt.mft_zone_end >> 2; /* 25% */ + opts.mft_zone_end = opts.mft_zone_end >> 2; /* 25% */ break; /* case 1: */ default: - opt.mft_zone_end = opt.mft_zone_end >> 3; /* 12.5% */ + opts.mft_zone_end = opts.mft_zone_end >> 3; /* 12.5% */ break; } - Dprintf("MFT zone size = %lukiB\n", opt.mft_zone_end / 1024); + Dprintf("MFT zone size = %lukiB\n", opts.mft_zone_end / 1024); /* * The mft zone begins with the mft data attribute, not at the beginning * of the device. */ - opt.mft_zone_end += opt.mft_lcn; + opts.mft_zone_end += opts.mft_lcn; /* Create runlist for mft. */ rl_mft = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_mft) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); rl_mft[0].vcn = 0LL; - rl_mft[0].lcn = opt.mft_lcn; + rl_mft[0].lcn = opts.mft_lcn; /* We already rounded mft size up to a cluster. */ - j = opt.mft_size / vol->cluster_size; + j = opts.mft_size / vol->cluster_size; rl_mft[1].vcn = rl_mft[0].length = j; rl_mft[1].lcn = -1LL; rl_mft[1].length = 0LL; /* Allocate clusters for mft. */ for (i = 0; i < j; i++) - ntfs_bit_set(lcn_bitmap, opt.mft_lcn + i, 1); + ntfs_bit_set(lcn_bitmap, opts.mft_lcn + i, 1); /* Determine mftmirr_lcn (middle of volume). */ - opt.mftmirr_lcn = (opt.nr_sectors * opt.sector_size >> 1) + opts.mftmirr_lcn = (opts.nr_sectors * opts.sector_size >> 1) / vol->cluster_size; - Dprintf("$MFTMirr logical cluster number = 0x%x\n", opt.mftmirr_lcn); + Dprintf("$MFTMirr logical cluster number = 0x%x\n", opts.mftmirr_lcn); /* Create runlist for mft mirror. */ rl_mftmirr = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_mftmirr) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); rl_mftmirr[0].vcn = 0LL; - rl_mftmirr[0].lcn = opt.mftmirr_lcn; + rl_mftmirr[0].lcn = opts.mftmirr_lcn; /* * The mft mirror is either 4kb (the first four records) or one cluster * in size, which ever is bigger. In either case, it contains a @@ -2760,49 +2731,49 @@ int main(int argc, char **argv) rl_mftmirr[1].length = 0LL; /* Allocate clusters for mft mirror. */ for (i = 0; i < j; i++) - ntfs_bit_set(lcn_bitmap, opt.mftmirr_lcn + i, 1); - opt.logfile_lcn = opt.mftmirr_lcn + j; - Dprintf("$LogFile logical cluster number = 0x%x\n", opt.logfile_lcn); + ntfs_bit_set(lcn_bitmap, opts.mftmirr_lcn + i, 1); + opts.logfile_lcn = opts.mftmirr_lcn + j; + Dprintf("$LogFile logical cluster number = 0x%x\n", opts.logfile_lcn); /* Create runlist for log file. */ rl_logfile = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_logfile) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); rl_logfile[0].vcn = 0LL; - rl_logfile[0].lcn = opt.logfile_lcn; + rl_logfile[0].lcn = opts.logfile_lcn; /* * Determine logfile_size from volume_size (rounded up to a cluster), * making sure it does not overflow the end of the volume. */ - if (opt.volume_size < 2048LL * 1024) /* < 2MiB */ - opt.logfile_size = 256LL * 1024; /* -> 256kiB */ - else if (opt.volume_size < 4000000LL) /* < 4MB */ - opt.logfile_size = 512LL * 1024; /* -> 512kiB */ - else if (opt.volume_size <= 200LL * 1024 * 1024)/* < 200MiB */ - opt.logfile_size = 2048LL * 1024; /* -> 2MiB */ - else if (opt.volume_size >= 400LL << 20) /* > 400MiB */ - opt.logfile_size = 4 << 20; /* -> 4MiB */ + if (opts.volume_size < 2048LL * 1024) /* < 2MiB */ + opts.logfile_size = 256LL * 1024; /* -> 256kiB */ + else if (opts.volume_size < 4000000LL) /* < 4MB */ + opts.logfile_size = 512LL * 1024; /* -> 512kiB */ + else if (opts.volume_size <= 200LL * 1024 * 1024)/* < 200MiB */ + opts.logfile_size = 2048LL * 1024; /* -> 2MiB */ + else if (opts.volume_size >= 400LL << 20) /* > 400MiB */ + opts.logfile_size = 4 << 20; /* -> 4MiB */ else - opt.logfile_size = (opt.volume_size / 100) & + opts.logfile_size = (opts.volume_size / 100) & ~(vol->cluster_size - 1); - j = opt.logfile_size / vol->cluster_size; - while (rl_logfile[0].lcn + j >= opt.nr_clusters) { + j = opts.logfile_size / vol->cluster_size; + while (rl_logfile[0].lcn + j >= opts.nr_clusters) { /* * $Logfile would overflow volume. Need to make it smaller than * the standard size. It's ok as we are creating a non-standard * volume anyway if it is that small. */ - opt.logfile_size >>= 1; - j = opt.logfile_size / vol->cluster_size; + opts.logfile_size >>= 1; + j = opts.logfile_size / vol->cluster_size; } - opt.logfile_size = (opt.logfile_size + vol->cluster_size - 1) & + opts.logfile_size = (opts.logfile_size + vol->cluster_size - 1) & ~(vol->cluster_size - 1); - Dprintf("$LogFile (journal) size = %ikiB\n", opt.logfile_size / 1024); + Dprintf("$LogFile (journal) size = %ikiB\n", opts.logfile_size / 1024); /* * FIXME: The 256kiB limit is arbitrary. Should find out what the real * minimum requirement for Windows is so it doesn't blue screen. */ - if (opt.logfile_size < 256 << 10) + if (opts.logfile_size < 256 << 10) err_exit("$LogFile would be created with invalid size. This " "is not allowed as it would cause Windows to " "blue screen and during boot.\n"); @@ -2811,7 +2782,7 @@ int main(int argc, char **argv) rl_logfile[1].length = 0LL; /* Allocate clusters for log file. */ for (i = 0; i < j; i++) - ntfs_bit_set(lcn_bitmap, opt.logfile_lcn + i, 1); + ntfs_bit_set(lcn_bitmap, opts.logfile_lcn + i, 1); /* Create runlist for $Boot. */ rl_boot = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_boot) @@ -2831,7 +2802,7 @@ int main(int argc, char **argv) for (i = 0; i < j; i++) ntfs_bit_set(lcn_bitmap, 0LL + i, 1); /* Allocate a buffer large enough to hold the mft. */ - buf = calloc(1, opt.mft_size); + buf = calloc(1, opts.mft_size); if (!buf) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -2846,7 +2817,7 @@ int main(int argc, char **argv) * $BadClus named stream $Bad contains the whole volume as a single * sparse runlist entry. */ - rl_bad[1].vcn = rl_bad[0].length = opt.nr_clusters; + rl_bad[1].vcn = rl_bad[0].length = opts.nr_clusters; rl_bad[1].lcn = -1LL; rl_bad[1].length = 0LL; @@ -2856,15 +2827,15 @@ int main(int argc, char **argv) * If not quick format, fill the device with 0s. * FIXME: Except bad blocks! (AIA) */ - if (!opt.quick_format) { + if (!opts.quick_format) { unsigned long position; unsigned long mid_clust; - float progress_inc = (float)opt.nr_clusters / 100; + float progress_inc = (float)opts.nr_clusters / 100; Qprintf("Initialising device with zeroes: 0%%"); fflush(stdout); - mid_clust = (opt.volume_size >> 1) / vol->cluster_size; - for (position = 0; position < opt.nr_clusters; position++) { + mid_clust = (opts.volume_size >> 1) / vol->cluster_size; + for (position = 0; position < opts.nr_clusters; position++) { if (!(position % (int)(progress_inc+1))) { Qprintf("\b\b\b\b%3.0f%%", position / progress_inc); @@ -2889,7 +2860,7 @@ int main(int argc, char **argv) append_to_bad_blocks(position); Qprintf("\nFound bad cluster (%ld). Adding to " "list of bad blocks.\nInitialising " - "device with zeroes: %3.0i%%", position, + "device with zeroes: %3.0f%%", position, position / progress_inc); /* Seek to next cluster. */ lseek(vol->fd, ((off_t)position + 1) * @@ -2897,11 +2868,11 @@ int main(int argc, char **argv) } } Qprintf("\b\b\b\b100%%"); - position = (opt.volume_size & (vol->cluster_size - 1)) / - opt.sector_size; + position = (opts.volume_size & (vol->cluster_size - 1)) / + opts.sector_size; for (i = 0; i < position; i++) { - bw = mkntfs_write(vol->fd, buf, opt.sector_size); - if (bw != opt.sector_size) { + bw = mkntfs_write(vol->fd, buf, opts.sector_size); + if (bw != opts.sector_size) { if (bw != -1 || errno != EIO) err_exit("This should not happen.\n"); else if (i + 1 == position && @@ -2912,7 +2883,7 @@ int main(int argc, char **argv) "location reserved for system " "file $Boot.\n"); /* Seek to next sector. */ - lseek(vol->fd, opt.sector_size, SEEK_CUR); + lseek(vol->fd, opts.sector_size, SEEK_CUR); } } Qprintf(" - Done.\n"); @@ -2951,9 +2922,9 @@ int main(int argc, char **argv) ntfs_bit_set(mft_bitmap, 0LL + i, 1); file_attrs = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM; if (i == FILE_root) { - if (opt.disable_indexing) + if (opts.disable_indexing) file_attrs |= FILE_ATTR_NOT_CONTENT_INDEXED; - if (opt.enable_compression) + if (opts.enable_compression) file_attrs |= FILE_ATTR_COMPRESSED; } add_attr_std_info(m, file_attrs); @@ -2976,7 +2947,7 @@ int main(int argc, char **argv) // FIXME: This should be IGNORE_CASE if (!err) err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, - COLLATION_FILE_NAME, opt.index_block_size); + COLLATION_FILE_NAME, opts.index_block_size); // FIXME: This should be IGNORE_CASE if (!err) err = upgrade_to_large_index(m, "$I30", 4, 0, &index_block); @@ -3006,11 +2977,11 @@ int main(int argc, char **argv) Vprintf("Creating $MFT (mft record 0)\n"); m = (MFT_RECORD*)buf; err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mft, buf, - opt.mft_size); + opts.mft_size); if (!err) err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_MFT, 1), opt.mft_size, - opt.mft_size, FILE_ATTR_HIDDEN | + MAKE_MFT_REF(FILE_MFT, 1), opts.mft_size, + opts.mft_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$MFT", FILE_NAME_WIN32_AND_DOS); if (!err) { @@ -3044,19 +3015,19 @@ int main(int argc, char **argv) //dump_mft_record(m); Vprintf("Creating $LogFile (mft record 2)\n"); m = (MFT_RECORD*)(buf + 2 * vol->mft_record_size); - buf2 = malloc(opt.logfile_size); + buf2 = malloc(opts.logfile_size); if (!buf2) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - memset(buf2, -1, opt.logfile_size); + memset(buf2, -1, opts.logfile_size); err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_logfile, buf2, - opt.logfile_size); + opts.logfile_size); free(buf2); buf2 = NULL; if (!err) err = create_hardlink(index_block, root_ref, m, MAKE_MFT_REF(FILE_LogFile, FILE_LogFile), - opt.logfile_size, opt.logfile_size, + opts.logfile_size, opts.logfile_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$LogFile", FILE_NAME_WIN32_AND_DOS); if (!err) { @@ -3095,12 +3066,12 @@ int main(int argc, char **argv) if (vol->major_ver < 3) buf2_size = 36000; else - buf2_size = opt.attr_defs_len; + buf2_size = opts.attr_defs_len; buf2 = (char*)calloc(1, buf2_size); if (!buf2) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - memcpy(buf2, opt.attr_defs, opt.attr_defs_len); + memcpy(buf2, opts.attr_defs, opts.attr_defs_len); err = add_attr_data(m, NULL, 0, 0, 0, buf2, buf2_size); free(buf2); buf2 = NULL; @@ -3149,18 +3120,18 @@ int main(int argc, char **argv) * already inserted, so no need to worry about these things. */ bs = (NTFS_BOOT_SECTOR*)buf2; - bs->bpb.bytes_per_sector = cpu_to_le16(opt.sector_size); + bs->bpb.bytes_per_sector = cpu_to_le16(opts.sector_size); bs->bpb.sectors_per_cluster = (u8)(vol->cluster_size / - opt.sector_size); + opts.sector_size); bs->bpb.media_type = 0xf8; /* hard disk */ /* * If there are problems go back to bs->unused[0-3] and set them. See * ../include/bootsect.h for details. Other fields to also consider * setting are: bs->bpb.sectors_per_track, .heads, and .hidden_sectors. */ - bs->number_of_sectors = scpu_to_le64(opt.nr_sectors); - bs->mft_lcn = scpu_to_le64(opt.mft_lcn); - bs->mftmirr_lcn = scpu_to_le64(opt.mftmirr_lcn); + bs->number_of_sectors = scpu_to_le64(opts.nr_sectors); + bs->mft_lcn = scpu_to_le64(opts.mft_lcn); + bs->mftmirr_lcn = scpu_to_le64(opts.mftmirr_lcn); if (vol->mft_record_size >= vol->cluster_size) bs->clusters_per_mft_record = vol->mft_record_size / vol->cluster_size; @@ -3174,13 +3145,13 @@ int main(int argc, char **argv) Dprintf("Clusters per mft record = %i (0x%x)\n", bs->clusters_per_mft_record, bs->clusters_per_mft_record); - if (opt.index_block_size >= vol->cluster_size) - bs->clusters_per_index_record = opt.index_block_size / + if (opts.index_block_size >= vol->cluster_size) + bs->clusters_per_index_record = opts.index_block_size / vol->cluster_size; else { - bs->clusters_per_index_record = -(ffs(opt.index_block_size) - 1); + bs->clusters_per_index_record = -(ffs(opts.index_block_size) - 1); if ((1 << -bs->clusters_per_index_record) != - opt.index_block_size) + opts.index_block_size) err_exit("BUG: calculated clusters_per_index_record " "is wrong (= 0x%x)\n", bs->clusters_per_index_record); @@ -3197,7 +3168,7 @@ int main(int argc, char **argv) */ bs->checksum = cpu_to_le32(0); /* Make sure the bootsector is ok. */ - if (!ntfs_boot_sector_is_ntfs(bs, opt.verbose > 0 ? 0 : 1)) + if (!ntfs_boot_sector_is_ntfs(bs, opts.verbose > 0 ? 0 : 1)) err_exit("FATAL: Generated boot sector is invalid!\n"); err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_boot, buf2, 8192); if (!err) @@ -3215,10 +3186,10 @@ int main(int argc, char **argv) err_exit("Couldn't create $Boot: %s\n", strerror(-err)); Vprintf("Creating backup boot sector.\n"); /* - * Write the first max(512, opt.sector_size) bytes from buf2 to the + * Write the first max(512, opts.sector_size) bytes from buf2 to the * last sector. */ - if (lseek(vol->fd, (opt.nr_sectors + 1) * opt.sector_size - i, + if (lseek(vol->fd, (opts.nr_sectors + 1) * opts.sector_size - i, SEEK_SET) == (off_t)-1) goto bb_err; bw = mkntfs_write(vol->fd, buf2, i); @@ -3249,7 +3220,7 @@ bb_err: // FIXME: This should be IGNORE_CASE /* Create a sparse named stream of size equal to the volume size. */ err = add_attr_data_positioned(m, "$Bad", 4, 0, 0, rl_bad, NULL, - opt.nr_clusters * vol->cluster_size); + opts.nr_clusters * vol->cluster_size); if (!err) { err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); } @@ -3301,7 +3272,7 @@ bb_err: //dump_mft_record(m); /* NTFS 1.2 reserved system files (mft records 0xb-0xf) */ for (i = 0xb; i < 0x10; i++) { - Vprintf("Creating system file (mft record 0x%x)\n", i, i); + Vprintf("Creating system file (mft record 0x%x)\n", i); m = (MFT_RECORD*)(buf + i * vol->mft_record_size); err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); if (!err) { @@ -3391,10 +3362,10 @@ bb_err: * its creation. */ Vprintf("Syncing $MFT.\n"); - pos = opt.mft_lcn * vol->cluster_size; + pos = opts.mft_lcn * vol->cluster_size; lw = 1; - for (i = 0; i < opt.mft_size / vol->mft_record_size; i++) { - if (!opt.no_action) + for (i = 0; i < opts.mft_size / vol->mft_record_size; i++) { + if (!opts.no_action) lw = ntfs_mst_pwrite(vol->fd, pos, 1, vol->mft_record_size, buf + i * vol->mft_record_size); @@ -3404,7 +3375,7 @@ bb_err: pos += vol->mft_record_size; } Vprintf("Updating $MFTMirr.\n"); - pos = opt.mftmirr_lcn * vol->cluster_size; + pos = opts.mftmirr_lcn * vol->cluster_size; lw = 1; for (i = 0; i < rl_mftmirr[0].length * vol->cluster_size / vol->mft_record_size; i++) { @@ -3421,7 +3392,7 @@ bb_err: if (usn-- <= 1) usn = 0xfffe; *usnp = cpu_to_le16(usn); - if (!opt.no_action) + if (!opts.no_action) lw = ntfs_mst_pwrite(vol->fd, pos, 1, vol->mft_record_size, buf + i * vol->mft_record_size); From 7f2714f9060c1706c0b4706fcf94426c83055145 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:48:06 +0000 Subject: [PATCH 0439/2994] three strings: ntfs_bugs, ntfs_home and ntfs_gpl (Logical change 1.104) --- ntfsprogs/utils.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 3124da61..c19f3cfd 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -39,12 +39,21 @@ #include "volume.h" #include "debug.h" +const char *ntfs_bugs = "Please report bugs to linux-ntfs-dev@lists.sourceforge.net\n"; +const char *ntfs_home = "Linux NTFS homepage: http://linux-ntfs.sourceforge.net\n"; +const char *ntfs_gpl = "This program is free software, released under the GNU " + "General Public License\nand you are welcome to redistribute it under " + "certain conditions. It comes with\nABSOLUTELY NO WARRANTY; for " + "details read the GNU General Public License to be\nfound in the file " + "\"COPYING\" distributed with this program, or online at:\n" + "http://www.gnu.org/copyleft/gpl.html\n"; + #define NTFS_TIME_OFFSET ((s64)(369 * 365 + 89) * 24 * 3600 * 10000000) /* These utilities require the following functions */ extern int Eprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); extern int Vprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); -extern int Iprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); +extern int Qprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); /** * utils_set_locale @@ -138,13 +147,13 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL } if (vol->flags & VOLUME_IS_DIRTY) { - Iprintf ("Volume is dirty.\n"); + Qprintf ("Volume is dirty.\n"); if (!force) { Eprintf ("Run chkdsk and try again, or use the --force option.\n"); ntfs_umount (vol, FALSE); return NULL; } - Iprintf ("Forced to continue.\n"); + Qprintf ("Forced to continue.\n"); } return vol; From 31cb10fb23d719ac4fe901eba9039227ad69a94f Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:48:06 +0000 Subject: [PATCH 0440/2994] three strings: ntfs_bugs, ntfs_home and ntfs_gpl 2003/01/14 23:44:46+00:00 flatcap.org!flatcap Change mode to -rw-rw-r-- (Logical change 1.104) --- ntfsprogs/utils.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 21ab80d1..8469a044 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -31,6 +31,10 @@ #include #include +extern const char *ntfs_bugs; +extern const char *ntfs_home; +extern const char *ntfs_gpl; + #define PATH_SEP '/' #define GEN_PRINTF(NAME, STREAM, CONTROL, TRIGGER) \ From e5b14ce5b622ddc0a5eb2362566c4d91291f7787 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 11:48:06 +0000 Subject: [PATCH 0441/2994] use the utils rearranged code a bit (Logical change 1.104) --- ntfsprogs/ntfsinfo.c | 260 ++++++++++++++++++++++++++++++++----------- 1 file changed, 198 insertions(+), 62 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 5418bd99..adfb252a 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1,9 +1,9 @@ -/* +/** * ntfsinfo - Part of the Linux-NTFS project. * * Copyright (c) 2002 Matthew J. Fanto * Copyright (c) 2002 Anton Altaparmakov - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002-2003 Richard Russon * * This utility will dump a file's attributes. * @@ -26,94 +26,175 @@ #include #include -#include -#include -#include #include +#include + #include "types.h" #include "mft.h" #include "attrib.h" #include "layout.h" #include "inode.h" +#include "utils.h" -void ntfs_get_file_attributes(const char *dev, long int i); -void ntfs_dump_file_name_attribute(ntfs_inode *inode, MFT_RECORD *mrec); -void ntfs_dump_standard_information(ntfs_inode *inode, MFT_RECORD *mrec); +static const char *AUTHOR = "Matthew J. Fanto"; +static const char *EXEC_NAME = "ntfsinfo"; + +static struct options { + char *device; /* Device/File to work with */ + s64 inode; /* Info for this inode */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int force; /* Override common sense */ +} opts; + +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) /** - * ntfs2utc - Convert an NTFS time to Unix time - * @time: An NTFS time in 100ns units since 1601 + * version - Print version information about the program * - * NTFS stores times as the number of 100ns intervals since January 1st 1601 at - * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. + * Print a copyright statement and a brief description of the program. * - * Return: n A Unix time (number of seconds since 1970) + * Return: none */ -time_t ntfs2utc (long long time) +void version (void) { - return (time - ((long long) (369 * 365 + 89) * 24 * 3600 * 10000000)) / 10000000; + Qprintf ("%s v%s Copyright (C) 2002 %s\nDisplay information about an " + "NTFS Volume\n\n%s is free software, released under the GNU " + "General Public License\nand you are welcome to redistribute " + "it under certain conditions.\n%s comes with ABSOLUTELY NO " + "WARRANTY; for details read the GNU\nGeneral Public License " + "to be found in the file COPYING in the main\nLinux-NTFS " + "distribution directory.\n\n", + EXEC_NAME, VERSION, AUTHOR, EXEC_NAME, EXEC_NAME); } -#define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000) - -int main(int argc, char **argv) +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) { - const char *AUTHOR = "Matthew J. Fanto"; - const char *EXEC_NAME = "ntfsinfo"; - const char *locale; - long i; - - locale = setlocale(LC_ALL, ""); - if (!locale) { - char *locale; - - locale = setlocale(LC_ALL, NULL); - printf("Failed to set locale, using default (%s).\n", locale); - } - - if (argc < 3 || argc > 4) { - fprintf(stderr, "%s v%s - %s\n", EXEC_NAME, VERSION, AUTHOR); - fprintf(stderr, "Usage: ntfsinfo device inode\n"); - exit(1); - } - - else { - i = atoll(argv[2]); - ntfs_get_file_attributes(argv[1], i); - } - - return 0; + Qprintf ("Usage: %s [options] device\n" + " -i num --inode num Display information about this inode\n" + "\n" + " -f --force Use less caution\n" + " -q --quiet Less output\n" + " -v --verbose More output\n" + " -V --version Display version information\n" + " -h --help Display this help\n\n", + EXEC_NAME); + Qprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); } -void ntfs_get_file_attributes(const char *dev, long int i) +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char *argv[]) { + static const char *sopt = "-fhi:qvV"; + static const struct option lopt[] = { + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "inode", required_argument, NULL, 'i' }, + { "quiet", no_argument, NULL, 'q' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 }, + }; - MFT_REF mref; - MFT_RECORD *mrec = NULL; - //ntfs_attr_search_ctx *ctx = NULL; - ntfs_volume *vol = NULL; - ntfs_inode *inode = NULL; - //int error; + char c = -1; + int err = 0; + int ver = 0; + int help = 0; - if(!(vol = ntfs_mount(dev, MS_RDONLY))) { - fprintf(stderr, "ntfsinfo error: cannot mount device %s\n",dev); - exit(1); + opterr = 0; /* We'll handle the errors, thank you. */ + + opts.inode = -1; + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else { + opts.device = NULL; + err++; + } + break; + case 'i': + if ((opts.inode != -1) || + (!utils_parse_size (argv[optind-1], &opts.inode, FALSE))) { + err++; + } + break; + case 'f': + opts.force++; + break; + case 'h': + help++; + break; + case 'q': + opts.quiet++; + break; + case 'v': + opts.verbose++; + break; + case 'V': + ver++; + break; + default: + if ((optopt == 'i') && (!optarg)) { + Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); + } else { + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + } + err++; + break; + } } - mref = (MFT_REF) i; - inode = ntfs_inode_open(vol, mref); + if (help || ver) { + opts.quiet = 0; + } else { + if (opts.device == NULL) { + Eprintf ("You must specify exactly one device.\n"); + err++; + } - if (ntfs_file_record_read(vol, mref, &mrec, NULL)) { - fprintf(stderr, "ntfsinfo error: error reading file record!\n"); - exit(1); + if (opts.inode == -1) { + Eprintf ("You much specify an inode to learn about.\n"); + err++; + } + + if (opts.quiet && opts.verbose) { + Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + err++; + } } - //see flatcap.org/ntfs/info for what formatting should look like - //ntfs_dump_boot_sector_information(inode, mrec); - ntfs_dump_file_name_attribute(inode, mrec); - ntfs_dump_standard_information(inode, mrec); + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); } + +/** + * ntfs_dump_file_name_attribute + */ void ntfs_dump_file_name_attribute(ntfs_inode *inode, MFT_RECORD *mrec) { FILE_NAME_ATTR *file_name_attr = NULL; @@ -164,6 +245,9 @@ void ntfs_dump_file_name_attribute(ntfs_inode *inode, MFT_RECORD *mrec) } +/** + * ntfs_dump_standard_information + */ void ntfs_dump_standard_information(ntfs_inode *inode, MFT_RECORD *mrec) { @@ -192,3 +276,55 @@ void ntfs_dump_standard_information(ntfs_inode *inode, MFT_RECORD *mrec) } +/** + * ntfs_get_file_attributes + */ +void ntfs_get_file_attributes(ntfs_volume *vol, s64 i) +{ + MFT_REF mref; + MFT_RECORD *mrec = NULL; + //ntfs_attr_search_ctx *ctx = NULL; + ntfs_inode *inode = NULL; + //int error; + + mref = (MFT_REF) i; + inode = ntfs_inode_open(vol, mref); + + if (ntfs_file_record_read(vol, mref, &mrec, NULL)) { + fprintf(stderr, "ntfsinfo error: error reading file record!\n"); + exit(1); + } + + //see flatcap.org/ntfs/info for what formatting should look like + //ntfs_dump_boot_sector_information(inode, mrec); + ntfs_dump_file_name_attribute(inode, mrec); + ntfs_dump_standard_information(inode, mrec); +} + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main(int argc, char **argv) +{ + ntfs_volume *vol; + + utils_set_locale(); + + if (!parse_options (argc, argv)) + return 1; + + vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); + if (!vol) + return 1; + + ntfs_get_file_attributes (vol, opts.inode); + + ntfs_umount (vol, FALSE); + return 0; +} + From 4fb575b3cc6323f35ee7e63309826f03ff91df36 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 22:01:18 +0000 Subject: [PATCH 0442/2994] comment blocks standardise usage and version info (Logical change 1.105) --- ntfsprogs/mkntfs.c | 359 ++++++++++++++++++++++++++++++--------------- 1 file changed, 243 insertions(+), 116 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 23171552..96e52935 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1,8 +1,8 @@ -/* +/** * mkntfs - Part of the Linux-NTFS project. * * Copyright (c) 2000-2003 Anton Altaparmakov - * Copyright (c) 2001-2002 Richard Russon + * Copyright (c) 2001-2003 Richard Russon * * This utility will create an NTFS 1.2 (Windows NT 4.0) volume on a user * specified (block) device. @@ -11,8 +11,6 @@ * adapted from e2fsprogs-1.19 and lib/ext2fs/ismounted.c and misc/mke2fs.c in * particular. * - * Anton Altaparmakov - * * 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 of the License, or @@ -177,8 +175,142 @@ GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) void err_exit(const char *fmt, ...) __attribute__ ((noreturn)); +void usage(void) __attribute__ ((noreturn)); -/* Error output and terminate. Ignores quiet (-q). */ +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + printf ("\n%s v%s - Create an NTFS volume on a user specified (block) device.\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c)\n"); + printf (" 2000-2003 Anton Altaparmakov\n"); + printf (" 2001-2003 Richard Russon\n"); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + printf ("\nUsage: %s [options] device [number-of-sectors]\n" + " -s sector-size Specify the sector size for the device\n" + " -c cluster-size Specify the cluster size for the volume\n" + " -L volume-label Set the volume label\n" + " -z mft-zone-multiplier Set the MFT zone multiplier\n" + " -f Perform a quick format\n" + " -Q Perform a quick format\n" + " -C Enable compression on the volume\n" + " -I mft-zone-multiplier \n" + "\n" + " -n Do not write to disk\n" + " -F Use less caution\n" + " -q Quiet execution\n" + " -v Verbose execution\n" + " -v Very verbose execution\n" + " -V Display version information\n" + " -h Display this help\n\n", + EXEC_NAME); + printf ("%s%s\n", ntfs_bugs, ntfs_home); + exit(1); +} + +/** + * parse_options + */ +void parse_options(int argc, char *argv[]) +{ + int c; + long l; + unsigned long u; + char *s; + +// Need to have: mft record size, index record size, ntfs version, mft size, +// logfile size, list of bad blocks, check for bad blocks, ... + if (argc && *argv) + EXEC_NAME = *argv; + while ((c = getopt(argc, argv, "c:fh?nqs:vz:CFIL:QV")) != EOF) + switch (c) { + case 'n': + opts.no_action = 1; + break; + case 'c': + l = strtol(optarg, &s, 0); + if (!l || l > INT_MAX || *s) + err_exit("Invalid cluster size.\n"); + vol->cluster_size = l; + break; + case 'f': + case 'Q': + opts.quick_format = 1; + break; + case 'q': + opts.quiet = 1; + break; + case 's': + l = strtol(optarg, &s, 0); + if (!l || l > INT_MAX || *s) + err_exit("Invalid sector size.\n"); + opts.sector_size = l; + break; + case 'v': + opts.verbose++; + break; + case 'z': + l = strtol(optarg, &s, 0); + if (l < 1 || l > 4 || *s) + err_exit("Invalid MFT zone multiplier.\n"); + opts.mft_zone_multiplier = l; + break; + case 'C': + opts.enable_compression = 1; + break; + case 'F': + opts.force = 1; + break; + case 'I': + opts.disable_indexing = 1; + break; + case 'L': + vol->vol_name = optarg; + break; + case 'V': + version(); + exit(0); + case 'h': + case '?': + default: + usage(); + } + if (optind == argc) + usage(); + vol->dev_name = argv[optind++]; + if (optind < argc) { + u = strtoul(argv[optind++], &s, 0); + if (*s || !u || (u >= ULONG_MAX && errno == ERANGE)) + err_exit("Invalid number of sectors: %s\n", + argv[optind - 1]); + opts.nr_sectors = u; + } + if (optind < argc) + usage(); +} + + +/** + * err_exit + * Error output and terminate. Ignores quiet (-q). + */ void err_exit(const char *fmt, ...) { va_list ap; @@ -191,7 +323,10 @@ void err_exit(const char *fmt, ...) exit(1); } -/* Debugging output (-vv). Overriden by quiet (-q). */ +/** + * Dprintf + * Debugging output (-vv). Overriden by quiet (-q). + */ void Dprintf(const char *fmt, ...) { va_list ap; @@ -204,6 +339,9 @@ void Dprintf(const char *fmt, ...) } } +/** + * append_to_bad_blocks + */ void append_to_bad_blocks(unsigned long block) { long long *new_buf; @@ -221,6 +359,9 @@ void append_to_bad_blocks(unsigned long block) opts.bad_blocks[opts.nr_bad_blocks++] = block; } +/** + * mkntfs_write + */ __inline__ long long mkntfs_write(int fd, const void *buf, long long count) { long long bytes_written, total; @@ -251,7 +392,7 @@ __inline__ long long mkntfs_write(int fd, const void *buf, long long count) return total; } -/* +/** * Write to disk the clusters contained in the runlist @rl taking the data * from @val. Take @val_len bytes from @val and pad the rest with zeroes. * @@ -385,6 +526,9 @@ int stoucs(uchar_t *dest, const char *src, int maxlen) return i; } +/** + * dump_resident_attr_val + */ void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) { const char *don_t_know = "Don't know what to do with this attribute " @@ -529,6 +673,9 @@ void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) } } +/** + * dump_resident_attr + */ void dump_resident_attr(ATTR_RECORD *a) { int i; @@ -549,12 +696,18 @@ void dump_resident_attr(ATTR_RECORD *a) le32_to_cpu(a->value_length)); } +/** + * dump_mapping_pairs_array + */ void dump_mapping_pairs_array(char *b, unsigned int max_len) { // TODO return; } +/** + * dump_non_resident_attr + */ void dump_non_resident_attr(ATTR_RECORD *a) { s64 l; @@ -585,6 +738,9 @@ void dump_non_resident_attr(ATTR_RECORD *a) dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); } +/** + * dump_attr_record + */ void dump_attr_record(ATTR_RECORD *a) { unsigned int u; @@ -677,6 +833,9 @@ void dump_attr_record(ATTR_RECORD *a) } } +/** + * dump_mft_record + */ void dump_mft_record(MFT_RECORD *m) { ATTR_RECORD *a; @@ -724,6 +883,9 @@ void dump_mft_record(MFT_RECORD *m) printf("-- End of attributes. --\n"); } +/** + * format_mft_record + */ void format_mft_record(MFT_RECORD *m) { ATTR_RECORD *a; @@ -823,6 +985,9 @@ int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) return 0; } +/** + * deallocate_scattered_clusters + */ void deallocate_scattered_clusters(const runlist *rl) { LCN j; @@ -852,6 +1017,9 @@ void deallocate_scattered_clusters(const runlist *rl) * TODO: We should be returning the size as well, but for mkntfs this is not * necessary. */ +/** + * allocate_scattered_clusters + */ runlist *allocate_scattered_clusters(s64 clusters) { runlist *rl = NULL, *rlt; @@ -922,7 +1090,8 @@ err_end: return NULL; } -/* +/** + * insert_positioned_attr_in_mft_record * Create a non-resident attribute with a predefined on disk location * specified by the runlist @rl. The clusters specified by @rl are assumed to * be allocated already. @@ -1110,7 +1279,10 @@ err_out: return err; } -/* Return 0 on success and -errno on error. */ +/** + * insert_non_resident_attr_in_mft_record + * Return 0 on success and -errno on error. + */ int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, const char *val, const s64 val_len) @@ -1297,7 +1469,10 @@ err_out: return err; } -/* Return 0 on success and -errno on error. */ +/** + * insert_resident_attr_in_mft_record + * Return 0 on success and -errno on error. + */ int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, const RESIDENT_ATTR_FLAGS res_flags, @@ -1397,13 +1572,19 @@ err_out: return err; } +/** + * time2ntfs + */ s64 time2ntfs(s64 time) { return cpu_to_le64((time + (s64)(369 * 365 + 89) * 24 * 3600) * 10000000); } -/* Return 0 on success or -errno on error. */ +/** + * add_attr_std_info + * Return 0 on success or -errno on error. + */ int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) { STANDARD_INFORMATION si; @@ -1437,7 +1618,10 @@ int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) return err; } -/* Return 0 on success or -errno on error. */ +/** + * add_attr_file_name + * Return 0 on success or -errno on error. + */ int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, const s64 allocated_size, const s64 data_size, const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, @@ -1514,7 +1698,8 @@ int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, return i; } -/* +/** + * add_attr_sd * Create the security descriptor attribute adding the security descriptor @sd * of length @sd_len to the mft record @m. * @@ -1539,7 +1724,10 @@ int add_attr_sd(MFT_RECORD *m, const char *sd, const s64 sd_len) return err; } -/* Return 0 on success or -errno on error. */ +/** + * add_attr_data + * Return 0 on success or -errno on error. + */ int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, const char *val, const s64 val_len) @@ -1571,7 +1759,8 @@ int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, return err; } -/* +/** + * add_attr_data_positioned * Create a non-resident data attribute with a predefined on disk location * specified by the runlist @rl. The clusters specified by @rl are assumed to * be allocated already. @@ -1593,7 +1782,8 @@ int add_attr_data_positioned(MFT_RECORD *m, const char *name, return err; } -/* +/** + * add_attr_vol_name * Create volume name attribute specifying the volume name @vol_name as a null * terminated char string of length @vol_name_len (number of characters not * including the terminating null), which is converted internally to a little @@ -1635,7 +1825,10 @@ int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, return i; } -/* Return 0 on success or -errno on error. */ +/** + * add_attr_vol_info + * Return 0 on success or -errno on error. + */ int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags, const u8 major_ver, const u8 minor_ver) { @@ -1653,7 +1846,10 @@ int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags, return err; } -/* Return 0 on success or -errno on error. */ +/** + * add_attr_index_root + * Return 0 on success or -errno on error. + */ int add_attr_index_root(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const ATTR_TYPES indexed_attr_type, const COLLATION_RULES collation_rule, @@ -1729,7 +1925,10 @@ int add_attr_index_root(MFT_RECORD *m, const char *name, const u32 name_len, return err; } -/* Return 0 on success or -errno on error. */ +/** + * add_attr_index_alloc + * Return 0 on success or -errno on error. + */ int add_attr_index_alloc(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const char *index_alloc_val, const u32 index_alloc_val_len) @@ -1744,7 +1943,10 @@ int add_attr_index_alloc(MFT_RECORD *m, const char *name, const u32 name_len, return err; } -/* Return 0 on success or -errno on error. */ +/** + * add_attr_bitmap + * Return 0 on success or -errno on error. + */ int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const char *bitmap, const u32 bitmap_len) @@ -1765,7 +1967,8 @@ int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, return err; } -/* +/** + * add_attr_bitmap_positioned * Create a non-resident bitmap attribute with a predefined on disk location * specified by the runlist @rl. The clusters specified by @rl are assumed to * be allocated already. @@ -1786,7 +1989,8 @@ int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, return err; } -/* +/** + * upgrade_to_large_index * Create bitmap and index allocation attributes, modify index root * attribute accordingly and move all of the index entries from the index root * into the index allocation. @@ -1946,7 +2150,8 @@ err_out: return err; } -/* +/** + * make_room_for_index_entry_in_index_block * Create space of @size bytes at position @pos inside the index block @index. * * Return 0 on success or -errno on error. @@ -1996,7 +2201,8 @@ int make_room_for_index_entry_in_index_block(INDEX_BLOCK *index, return 0; } -/* +/** + * insert_file_link_in_dir_index * Insert the fully completed FILE_NAME_ATTR @file_name which is inside * the file with mft reference @file_ref into the index (allocation) block * @index (which belongs to @file_ref's parent directory). @@ -2123,7 +2329,8 @@ do_next: return 0; } -/* +/** + * create_hardlink * Create a file_name_attribute in the mft record @m_file which points to the * parent directory with mft reference @ref_parent. * @@ -2219,6 +2426,9 @@ int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, return 0; } +/** + * init_options + */ void init_options() { memset(&opts, 0, sizeof(opts)); @@ -2228,96 +2438,9 @@ void init_options() //Dprintf("Attr_defs table length = %u\n", opts.attr_defs_len); } -void usage(void) __attribute__ ((noreturn)); - -void usage(void) -{ - fprintf(stderr, "Copyright (c) 2001-2003 Anton Altaparmakov.\n" - "Create an NTFS volume on a user specified (block) device.\n" - "Usage: %s [-s sector-size] [-c cluster-size] " - "[-L volume-label]\n\t[-z mft-zone-multiplier] " - "[-fnqvvCFIQV] device [number-of-sectors]\n", - EXEC_NAME); - exit(1); -} - -void parse_options(int argc, char *argv[]) -{ - int c; - long l; - unsigned long u; - char *s; - -// Need to have: mft record size, index record size, ntfs version, mft size, -// logfile size, list of bad blocks, check for bad blocks, ... - if (argc && *argv) - EXEC_NAME = *argv; - fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); - while ((c = getopt(argc, argv, "c:fnqs:vz:CFIL:QV")) != EOF) - switch (c) { - case 'n': - opts.no_action = 1; - break; - case 'c': - l = strtol(optarg, &s, 0); - if (!l || l > INT_MAX || *s) - err_exit("Invalid cluster size.\n"); - vol->cluster_size = l; - break; - case 'f': - case 'Q': - opts.quick_format = 1; - break; - case 'q': - opts.quiet = 1; - break; - case 's': - l = strtol(optarg, &s, 0); - if (!l || l > INT_MAX || *s) - err_exit("Invalid sector size.\n"); - opts.sector_size = l; - break; - case 'v': - opts.verbose++; - break; - case 'z': - l = strtol(optarg, &s, 0); - if (l < 1 || l > 4 || *s) - err_exit("Invalid MFT zone multiplier.\n"); - opts.mft_zone_multiplier = l; - break; - case 'C': - opts.enable_compression = 1; - break; - case 'F': - opts.force = 1; - break; - case 'I': - opts.disable_indexing = 1; - break; - case 'L': - vol->vol_name = optarg; - break; - case 'V': - /* Version number already printed, so just exit. */ - exit(0); - default: - usage(); - } - if (optind == argc) - usage(); - vol->dev_name = argv[optind++]; - if (optind < argc) { - u = strtoul(argv[optind++], &s, 0); - if (*s || !u || (u >= ULONG_MAX && errno == ERANGE)) - err_exit("Invalid number of sectors: %s\n", - argv[optind - 1]); - opts.nr_sectors = u; - } - if (optind < argc) - usage(); -} - +/** + * mkntfs_exit + */ void mkntfs_exit(void) { int err; @@ -2370,7 +2493,9 @@ void mkntfs_exit(void) // What's wrong with MK_MREF? #define MAKE_MFT_REF(_ref, _seqno) cpu_to_le64((((u64)(_seqno)) << 48) \ | ((u64)(_ref))) - +/** + * main + */ int main(int argc, char **argv) { int i, j, err; @@ -2385,6 +2510,8 @@ int main(int argc, char **argv) NTFS_BOOT_SECTOR *bs; unsigned long mnt_flags; + utils_set_locale(); + /* Initialize the random number generator with the current time. */ srandom(time(NULL)); /* Initialize ntfs_volume structure vol. */ From b016aef2ba4b7080505b1974e98cd483ab2b830c Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 22:01:18 +0000 Subject: [PATCH 0443/2994] ignore the new spec file (Logical change 1.105) --- BitKeeper/etc/ignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 6144f4bb..45596fc1 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -12,7 +12,7 @@ config.cache config.status stamp-h libtool -linux-ntfs.spec +ntfsprogs.spec # general build products */.deps/* From ad1e482a7b6b75e3dec3a8a1ae5da2d91f17fedf Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 22:01:18 +0000 Subject: [PATCH 0444/2994] minor layout tweaks (Logical change 1.105) --- ntfsprogs/dumplog.c | 12 +++++++----- ntfsprogs/ntfscluster.h | 2 +- ntfsprogs/ntfsdump_logfile.c | 12 +++++++----- ntfsprogs/ntfsfix.c | 5 ++++- ntfsprogs/ntfsundelete.h | 2 +- ntfsprogs/ntfswipe.h | 2 +- ntfsprogs/sd.c | 4 +++- ntfsprogs/upcase.c | 7 +++++-- ntfsprogs/utils.c | 4 ++-- ntfsprogs/utils.h | 6 +++--- 10 files changed, 34 insertions(+), 22 deletions(-) diff --git a/ntfsprogs/dumplog.c b/ntfsprogs/dumplog.c index 861f3a03..a1fa27ca 100644 --- a/ntfsprogs/dumplog.c +++ b/ntfsprogs/dumplog.c @@ -1,6 +1,4 @@ -const char *EXEC_NAME = "dumplog"; -const char *EXEC_VERSION = "1.0"; -/* +/** * DumpLog - Part of the Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov @@ -9,8 +7,6 @@ const char *EXEC_VERSION = "1.0"; * on the command line and display the results on stdout. Errors will be output * to stderr. * - * Anton Altaparmakov - * * 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 of the License, or @@ -39,6 +35,12 @@ const char *EXEC_VERSION = "1.0"; #include "mst.h" #include "logfile.h" +const char *EXEC_NAME = "dumplog"; +const char *EXEC_VERSION = "1.0"; + +/** + * main + */ int main(int argc, char **argv) { s64 l, br; diff --git a/ntfsprogs/ntfscluster.h b/ntfsprogs/ntfscluster.h index fec1fb75..45ed324e 100644 --- a/ntfsprogs/ntfscluster.h +++ b/ntfsprogs/ntfscluster.h @@ -1,7 +1,7 @@ /* * ntfscluster - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002 Richard Russon * * This utility will XXX * diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 0a9c5f8f..796c5cdd 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -1,6 +1,4 @@ -const char *EXEC_NAME = "NtfsDump_LogFile"; -const char *EXEC_VERSION = "1.0"; -/* +/** * NtfsDump_LogFile - Part of the Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov @@ -9,8 +7,6 @@ const char *EXEC_VERSION = "1.0"; * NTFS partition and display the results on stdout. Errors will be output to * stderr. * - * Anton Altaparmakov - * * 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 of the License, or @@ -56,6 +52,12 @@ const char *EXEC_VERSION = "1.0"; #include "logfile.h" #include "mst.h" +const char *EXEC_NAME = "NtfsDump_LogFile"; +const char *EXEC_VERSION = "1.0"; + +/** + * main + */ int main(int argc, char **argv) { MFT_RECORD *m = NULL; diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index a5752450..0c114327 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -1,4 +1,4 @@ -/* +/** * NtfsFix - Part of the Linux-NTFS project. * * Copyright (c) 2000-2003 Anton Altaparmakov. @@ -58,6 +58,9 @@ #include "disk_io.h" #include "logfile.h" +/** + * main + */ int main(int argc, char **argv) { s64 l, br; diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index a7c76be3..400c33d2 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -1,7 +1,7 @@ /* * ntfsundelete - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002 Richard Russon * * This utility will recover deleted files from an NTFS volume. * diff --git a/ntfsprogs/ntfswipe.h b/ntfsprogs/ntfswipe.h index 2546c7fb..cf1bb7cf 100644 --- a/ntfsprogs/ntfswipe.h +++ b/ntfsprogs/ntfswipe.h @@ -1,7 +1,7 @@ /* * ntfswipe - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002 Richard Russon * * This utility will overwrite usused space on an NTFS volume. * diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c index 0e0f0863..16115b4e 100644 --- a/ntfsprogs/sd.c +++ b/ntfsprogs/sd.c @@ -1,7 +1,9 @@ #include "types.h" #include "layout.h" -/* +/** + * init_system_file_sd + * * NTFS 1.2 - System files security decriptors * =========================================== * diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c index c18a2bd3..45ef8eea 100644 --- a/ntfsprogs/upcase.c +++ b/ntfsprogs/upcase.c @@ -1,8 +1,8 @@ /** * upcase - Part of the Linux-NTFS project. * - * Copyright (c) 2001 Richard Russon - * Copyright (c) 2001-2002 Anton Altaparmakov + * Copyright (c) 2001 Richard Russon + * Copyright (c) 2001-2002 Anton Altaparmakov * * Modified for mkntfs inclusion 9 June 2001 by Anton Altaparmakov. * @@ -26,6 +26,9 @@ #include "types.h" +/** + * init_upcase_table + */ void init_upcase_table(uchar_t *uc, u32 uc_len) { static int uc_run_table[][3] = { /* Start, End, Add */ diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index c19f3cfd..be9bbe2f 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -1,9 +1,9 @@ /** * utils.c - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002 Richard Russon * - * This utility will recover deleted files from an NTFS volume. + * A set of shared functions for ntfs utilities * * 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 diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 8469a044..206e7921 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -1,9 +1,9 @@ /* - * utils.c - Part of the Linux-NTFS project. + * utils.h - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002 Richard Russon * - * This utility will recover deleted files from an NTFS volume. + * A set of shared functions for ntfs utilities * * 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 From 327bd2b2bcc19fdfb07169146ae358e556641be2 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 22:01:18 +0000 Subject: [PATCH 0445/2994] mkntfs and ntfstruncate now use the utils (Logical change 1.105) --- ntfsprogs/Makefile.am | 4 ++-- ntfsprogs/Makefile.in | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 049c97be..72b788a5 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -37,7 +37,7 @@ ntfsfix_SOURCES = ntfsfix.c ntfsfix_LDADD = $(AM_LIBS) ntfsfix_LDFLAGS = $(AM_LFLAGS) -mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c +mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c utils.c utils.h mkntfs_LDADD = $(AM_LIBS) mkntfs_LDFLAGS = $(AM_LFLAGS) @@ -63,7 +63,7 @@ ntfscluster_SOURCES = ntfscluster.c ntfscluster.h utils.c utils.h ntfscluster_LDADD = $(AM_LIBS) ntfscluster_LDFLAGS = $(AM_LFLAGS) -ntfstruncate_SOURCES = attrdef.c ntfstruncate.c +ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index f041de90..90a28059 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -120,7 +120,7 @@ ntfsfix_SOURCES = ntfsfix.c ntfsfix_LDADD = $(AM_LIBS) ntfsfix_LDFLAGS = $(AM_LFLAGS) -mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c +mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c utils.c utils.h mkntfs_LDADD = $(AM_LIBS) mkntfs_LDFLAGS = $(AM_LFLAGS) @@ -146,7 +146,7 @@ ntfscluster_SOURCES = ntfscluster.c ntfscluster.h utils.c utils.h ntfscluster_LDADD = $(AM_LIBS) ntfscluster_LDFLAGS = $(AM_LFLAGS) -ntfstruncate_SOURCES = attrdef.c ntfstruncate.c +ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) @@ -188,7 +188,8 @@ ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) +ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) \ +utils.$(OBJEXT) @REALLYSTATIC_TRUE@ntfstruncate_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@ntfstruncate_DEPENDENCIES = \ @@ -209,7 +210,7 @@ ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ -sd.$(OBJEXT) mkntfs.$(OBJEXT) +sd.$(OBJEXT) mkntfs.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ From 3769e9127428426653d0f51d7ba0f6532896d81d Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 22:01:18 +0000 Subject: [PATCH 0446/2994] standardise usage and version info (Logical change 1.105) --- ntfsprogs/ntfscluster.c | 28 +- ntfsprogs/ntfsinfo.c | 35 +-- ntfsprogs/ntfslabel.c | 15 +- ntfsprogs/ntfsundelete.c | 30 +- ntfsprogs/ntfswipe.c | 618 +++++++++++++++++++-------------------- 5 files changed, 361 insertions(+), 365 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 703a3e14..8dd4d921 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -1,7 +1,7 @@ /** * ntfscluster - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002-2003 Richard Russon * * This utility will locate the owner of any given sector or cluster. * @@ -34,7 +34,6 @@ #include "volume.h" #include "debug.h" -static const char *AUTHOR = "Richard Russon (FlatCap)"; static const char *EXEC_NAME = "ntfscluster"; static struct options opts; @@ -51,14 +50,11 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) */ void version (void) { - Qprintf ("%s v%s Copyright (C) 2002 %s\n***XXX***on " - "an NTFS Volume\n\n%s is free software, released under the GNU " - "General Public License\nand you are welcome to redistribute " - "it under certain conditions.\n%s comes with ABSOLUTELY NO " - "WARRANTY; for details read the GNU\nGeneral Public License " - "to be found in the file COPYING in the main\nLinux-NTFS " - "distribution directory.\n\n", - EXEC_NAME, VERSION, AUTHOR, EXEC_NAME, EXEC_NAME); + printf ("\n%s v%s - Find the owner of any given sector or cluster.\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c)\n"); + printf (" 2002-2003 Richard Russon\n"); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -70,7 +66,7 @@ void version (void) */ void usage (void) { - Qprintf ("Usage: %s [options] device\n" + printf ("\nUsage: %s [options] device\n" " -i --info Print information about the volume\n" " -c range --cluster range Look for objects in this range of clusters\n" " -s range --sector range Look for objects in this range of sectors\n" @@ -82,7 +78,7 @@ void usage (void) " -V --version Version information\n" " -h --help Print this help\n\n", EXEC_NAME); - Qprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); + printf ("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -96,7 +92,7 @@ void usage (void) */ int parse_options (int argc, char **argv) { - static const char *sopt = "-c:fhiqs:vV"; // l + static const char *sopt = "-c:fh?iqs:vV"; // l static const struct option lopt[] = { { "cluster", required_argument, NULL, 'c' }, { "force", no_argument, NULL, 'f' }, @@ -143,6 +139,7 @@ int parse_options (int argc, char **argv) opts.force++; break; case 'h': + case '?': help++; break; case 'i': @@ -196,7 +193,8 @@ int parse_options (int argc, char **argv) opts.quiet = 0; if (opts.device == NULL) { - Eprintf ("You must specify exactly one device.\n"); + if (argc > 1) + Eprintf ("You must specify exactly one device.\n"); err++; } @@ -211,7 +209,7 @@ int parse_options (int argc, char **argv) } else if (opts.range_begin > opts.range_end) { Eprintf ("The range must be in ascending order.\n"); err++; - } + } } if (ver) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index adfb252a..332258e0 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -36,7 +36,6 @@ #include "inode.h" #include "utils.h" -static const char *AUTHOR = "Matthew J. Fanto"; static const char *EXEC_NAME = "ntfsinfo"; static struct options { @@ -60,14 +59,13 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) */ void version (void) { - Qprintf ("%s v%s Copyright (C) 2002 %s\nDisplay information about an " - "NTFS Volume\n\n%s is free software, released under the GNU " - "General Public License\nand you are welcome to redistribute " - "it under certain conditions.\n%s comes with ABSOLUTELY NO " - "WARRANTY; for details read the GNU\nGeneral Public License " - "to be found in the file COPYING in the main\nLinux-NTFS " - "distribution directory.\n\n", - EXEC_NAME, VERSION, AUTHOR, EXEC_NAME, EXEC_NAME); + printf ("\n%s v%s - Display information about an NTFS Volume.\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c)\n"); + printf (" 2002 Matthew J. Fanto\n"); + printf (" 2002 Anton Altaparmakov\n"); + printf (" 2002-2003 Richard Russon\n"); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -79,7 +77,7 @@ void version (void) */ void usage (void) { - Qprintf ("Usage: %s [options] device\n" + printf ("\nUsage: %s [options] device\n" " -i num --inode num Display information about this inode\n" "\n" " -f --force Use less caution\n" @@ -88,7 +86,7 @@ void usage (void) " -V --version Display version information\n" " -h --help Display this help\n\n", EXEC_NAME); - Qprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); + printf ("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -102,7 +100,7 @@ void usage (void) */ int parse_options (int argc, char *argv[]) { - static const char *sopt = "-fhi:qvV"; + static const char *sopt = "-fh?i:qvV"; static const struct option lopt[] = { { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, @@ -142,6 +140,7 @@ int parse_options (int argc, char *argv[]) opts.force++; break; case 'h': + case '?': help++; break; case 'q': @@ -168,12 +167,14 @@ int parse_options (int argc, char *argv[]) opts.quiet = 0; } else { if (opts.device == NULL) { - Eprintf ("You must specify exactly one device.\n"); + if (argc > 1) + Eprintf ("You must specify exactly one device.\n"); err++; } if (opts.inode == -1) { - Eprintf ("You much specify an inode to learn about.\n"); + if (argc > 1) + Eprintf ("You much specify an inode to learn about.\n"); err++; } @@ -313,15 +314,15 @@ int main(int argc, char **argv) { ntfs_volume *vol; - utils_set_locale(); - if (!parse_options (argc, argv)) return 1; + utils_set_locale(); + vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); if (!vol) return 1; - + ntfs_get_file_attributes (vol, opts.inode); ntfs_umount (vol, FALSE); diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 18f11945..bbc806f2 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -60,12 +60,12 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) */ void version (void) { - printf ("\n%s v%s - Display, or set, the label for an NTFS Volume\n\n", + printf ("\n%s v%s - Display, or set, the label for an NTFS Volume.\n\n", EXEC_NAME, VERSION); printf ("Copyright (c)\n"); - printf ("\tMatthew J. Fanto\n"); - printf ("\tAnton Altaparmakov\n"); - printf ("\tRichard Russon\n"); + printf (" 2002 Matthew J. Fanto\n"); + printf (" 2002 Anton Altaparmakov\n"); + printf (" 2002-2003 Richard Russon\n"); printf ("\n%s\n\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -100,7 +100,7 @@ void usage (void) */ int parse_options (int argc, char *argv[]) { - static const char *sopt = "-fhnqvV"; + static const char *sopt = "-fh?nqvV"; static const struct option lopt[] = { { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, @@ -132,6 +132,7 @@ int parse_options (int argc, char *argv[]) opts.force++; break; case 'h': + case '?': help++; break; case 'n': @@ -337,11 +338,11 @@ int main(int argc, char **argv) int result = 0; ntfs_volume *vol; - utils_set_locale(); - if (!parse_options (argc, argv)) return 1; + utils_set_locale(); + //XXX need to set and get mount flags vol = utils_mount_volume (opts.device, 0, opts.force); if (!vol) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index a3fe0c2a..5d5307a5 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -1,7 +1,7 @@ /** * ntfsundelete - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002-2003 Richard Russon * * This utility will recover deleted files from an NTFS volume. * @@ -52,7 +52,6 @@ #include "utils.h" #include "debug.h" -static const char *AUTHOR = "Richard Russon (FlatCap)"; static const char *EXEC_NAME = "ntfsundelete"; static const char *MFTFILE = "mft"; static const char *UNNAMED = ""; @@ -75,14 +74,11 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) */ void version (void) { - Qprintf ("%s v%s Copyright (C) 2002 %s\nRecover deleted files from an " - "NTFS Volume\n\n%s is free software, released under the GNU " - "General Public License\nand you are welcome to redistribute " - "it under certain conditions.\n%s comes with ABSOLUTELY NO " - "WARRANTY; for details read the GNU\nGeneral Public License " - "to be found in the file COPYING in the main\nLinux-NTFS " - "distribution directory.\n\n", - EXEC_NAME, VERSION, AUTHOR, EXEC_NAME, EXEC_NAME); + printf ("\n%s v%s - Recover deleted files from an NTFS Volume.\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c)\n"); + printf (" 2002-2003 Richard Russon\n"); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -94,7 +90,7 @@ void version (void) */ void usage (void) { - Qprintf ("Usage: %s [options] device\n" + printf ("\nUsage: %s [options] device\n" " -s --scan Scan for files (default)\n" " -p num --percentage num Minimum percentage recoverable\n" " -m pattern --match pattern Only work on files with matching names\n" @@ -115,7 +111,7 @@ void usage (void) " -V --version Display version information\n" " -h --help Display this help\n\n", EXEC_NAME); - Qprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); + printf ("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -272,7 +268,7 @@ int parse_time (const char *value, time_t *since) */ int parse_options (int argc, char *argv[]) { - static const char *sopt = "-b:Cc:d:fhm:o:p:sS:t:u:qvV"; + static const char *sopt = "-b:Cc:d:fh?m:o:p:sS:t:u:qvV"; static const struct option lopt[] = { { "byte", required_argument, NULL, 'b' }, { "case", no_argument, NULL, 'C' }, @@ -349,6 +345,7 @@ int parse_options (int argc, char *argv[]) opts.force++; break; case 'h': + case '?': help++; break; case 'm': @@ -436,7 +433,8 @@ int parse_options (int argc, char *argv[]) opts.quiet = 0; } else { if (opts.device == NULL) { - Eprintf ("You must specify exactly one device.\n"); + if (argc > 1) + Eprintf ("You must specify exactly one device.\n"); err++; } @@ -1653,11 +1651,11 @@ int main (int argc, char *argv[]) ntfs_volume *vol; int result = 1; - utils_set_locale(); - if (!parse_options (argc, argv)) goto free; + utils_set_locale(); + vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); if (!vol) return 1; diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 8f4c4f42..2549d948 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -1,7 +1,7 @@ /** * ntfswipe - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002-2003 Richard Russon * * This utility will overwrite usused space on an NTFS volume. * @@ -39,7 +39,6 @@ #include "utils.h" #include "debug.h" -static const char *AUTHOR = "Richard Russon (FlatCap)"; static const char *EXEC_NAME = "ntfswipe"; static struct options opts; @@ -47,6 +46,303 @@ GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + printf ("\n%s v%s - Overwrite the unused space on an NTFS Volume.\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c)\n"); + printf (" 2002-2003 Richard Russon\n"); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + printf ("\nUsage: %s [options] device\n" + " -i --info Show volume information (default)\n" + "\n" + " -d --directory Wipe directory indexes\n" + " -l --logfile Wipe the logfile (journal)\n" + " -m --mft Wipe mft space\n" + " -p --pagefile Wipe pagefile (swap space)\n" + " -t --tails Wipe file tails\n" + " -u --unused Wipe unused clusters\n" + "\n" + " -a --all Wipe all unused space\n" + "\n" + " -c num --count num Number of times to write (default = 1)\n" + " -b list --bytes list List of values to write (default = 0)\n" + "\n" + " -n --no-action Do not write to disk\n" + " -f --force Use less caution\n" + " -q --quiet Less output\n" + " -v --verbose More output\n" + " -V --version Version information\n" + " -h --help Print this help\n\n", + EXEC_NAME); + printf ("%s%s\n", ntfs_bugs, ntfs_home); +} + +/** + * parse_list - Read a comma-separated list of numbers + * @list: The comma-separated list of numbers + * @result: Store the parsed list here (must be freed by caller) + * + * Read a comma-separated list of numbers and allocate an array of ints to store + * them in. The numbers can be in decimal, octal or hex. + * + * N.B. The caller must free the memory returned in @result. + * N.B. If the function fails, @result is not changed. + * + * Return: 0 Error, invalid string + * n Success, the count of numbers parsed + */ +int parse_list (const char *list, int **result) +{ + const char *ptr; + char *end; + int i; + int count; + int *mem = NULL; + + if (!list || !result) + return 0; + + for (count = 0, ptr = list; ptr; ptr = strchr (ptr+1, ',')) + count++; + + mem = malloc ((count+1) * sizeof (int)); + if (!mem) { + Eprintf ("Couldn't allocate memory in parse_list().\n"); + return 0; + } + + memset (mem, 0xFF, (count+1) * sizeof (int)); + + for (ptr = list, i = 0; i < count; i++) { + + end = NULL; + mem[i] = strtol (ptr, &end, 0); + + if (!end || (end == ptr) || ((*end != ',') && (*end != 0))) { + Eprintf ("Invalid list '%s'\n", list); + free (mem); + return 0; + } + + if ((mem[i] < 0) || (mem[i] > 255)) { + Eprintf ("Bytes must be in range 0-255.\n"); + free (mem); + return 0; + } + + ptr = end + 1; + } + + Dprintf ("Parsing list '%s' - ", list); + for (i = 0; i <= count; i++) + Dprintf ("0x%02x ", mem[i]); + Dprintf ("\n"); + + *result = mem; + return count; +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char *argv[]) +{ + static const char *sopt = "-ab:c:dfh?ilmnpqtuvV"; + static const struct option lopt[] = { + { "all", no_argument, NULL, 'a' }, + { "bytes", required_argument, NULL, 'b' }, + { "count", required_argument, NULL, 'c' }, + { "directory", no_argument, NULL, 'd' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "info", no_argument, NULL, 'i' }, + { "logfile", no_argument, NULL, 'l' }, + { "mft", no_argument, NULL, 'm' }, + { "no-action", no_argument, NULL, 'n' }, + { "pagefile", no_argument, NULL, 'p' }, + { "quiet", no_argument, NULL, 'q' }, + { "tails", no_argument, NULL, 't' }, + { "unused", no_argument, NULL, 'u' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + char *end; + int err = 0; + int ver = 0; + int help = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + opts.count = 1; + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else { + opts.device = NULL; + err++; + } + break; + + case 'i': + opts.info++; /* and fall through */ + case 'a': + opts.directory++; + opts.logfile++; + opts.mft++; + opts.pagefile++; + opts.tails++; + opts.unused++; + break; + case 'b': + if (!opts.bytes) { + if (!parse_list (argv[optind-1], &opts.bytes)) + err++; + } else { + err++; + } + break; + case 'c': + if (opts.count == 1) { + end = NULL; + opts.count = strtol (optarg, &end, 0); + if (end && *end) + err++; + } else { + err++; + } + break; + case 'd': + opts.directory++; + break; + case 'f': + opts.force++; + break; + case 'h': + case '?': + help++; + break; + case 'l': + opts.logfile++; + break; + case 'm': + opts.mft++; + break; + case 'n': + opts.noaction++; + break; + case 'p': + opts.pagefile++; + break; + case 'q': + opts.quiet++; + break; + case 't': + opts.tails++; + break; + case 'u': + opts.unused++; + break; + case 'v': + opts.verbose++; + break; + case 'V': + ver++; + break; + default: + if ((optopt == 'b') || (optopt == 'c')) { + Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); + } else { + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + } + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if (opts.device == NULL) { + if (argc > 1) + Eprintf ("You must specify exactly one device.\n"); + err++; + } + + if (opts.quiet && opts.verbose) { + Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + err++; + } + + /* + if (opts.info && (opts.unused || opts.tails || opts.mft || opts.directory)) { + Eprintf ("You may not use any other options with --info.\n"); + err++; + } + */ + + if ((opts.count < 1) || (opts.count > 100)) { + Eprintf ("The iteration count must be between 1 and 100.\n"); + err++; + } + + /* Create a default list */ + if (!opts.bytes) { + opts.bytes = malloc (2 * sizeof (int)); + if (opts.bytes) { + opts.bytes[0] = 0; + opts.bytes[1] = -1; + } else { + Eprintf ("Couldn't allocate memory for byte list.\n"); + err++; + } + } + + if (!opts.directory && !opts.logfile && !opts.mft && + !opts.pagefile && !opts.tails && !opts.unused) { + opts.info = 1; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + + /** * wipe_unused - Wipe unused clusters * @vol: An ntfs volume obtained from ntfs_mount @@ -299,25 +595,25 @@ bmpdone: /* * wipe_unused - volume = n clusters, u unused (%age & MB) - * $Bitmap + * $Bitmap * vol->lcnbmp_na * * wipe_tails - volume = n files, total tail slack space - * $MFT, $DATA - * vol->mft_na + * $MFT, $DATA + * vol->mft_na * * wipe_mft - volume = n mft records, u unused, s total slack space - * $MFT, $BITMAP - * vol->mftbmp_na + * $MFT, $BITMAP + * vol->mftbmp_na * * wipe_directory - volume has d dirs, t total slack space - * $MFT, $INDEX_ROOT, $INDEX_ALLOC, $BITMAP + * $MFT, $INDEX_ROOT, $INDEX_ALLOC, $BITMAP * * wipe_logfile - logfile is - * $MFT, $DATA + * $MFT, $DATA * * wipe_pagefile - pagefile is - * $MFT, $DATA + * $MFT, $DATA */ free (buffer); @@ -343,304 +639,6 @@ bmpdone: } -/** - * version - Print version information about the program - * - * Print a copyright statement and a brief description of the program. - * - * Return: none - */ -void version (void) -{ - Qprintf ("%s v%s Copyright (C) 2002 %s\nOverwrite the unused space on " - "an NTFS Volume\n\n%s is free software, released under the GNU " - "General Public License\nand you are welcome to redistribute " - "it under certain conditions.\n%s comes with ABSOLUTELY NO " - "WARRANTY; for details read the GNU\nGeneral Public License " - "to be found in the file COPYING in the main\nLinux-NTFS " - "distribution directory.\n\n", - EXEC_NAME, VERSION, AUTHOR, EXEC_NAME, EXEC_NAME); -} - -/** - * usage - Print a list of the parameters to the program - * - * Print a list of the parameters and options for the program. - * - * Return: none - */ -void usage (void) -{ - Qprintf ("Usage: %s [options] device\n" - " -i --info Show volume information (default)\n" - "\n" - " -d --directory Wipe directory indexes\n" - " -l --logfile Wipe the logfile (journal)\n" - " -m --mft Wipe mft space\n" - " -p --pagefile Wipe pagefile (swap space)\n" - " -t --tails Wipe file tails\n" - " -u --unused Wipe unused clusters\n" - "\n" - " -a --all Wipe all unused space\n" - "\n" - " -c num --count num Number of times to write (default = 1)\n" - " -b list --bytes list List of values to write (default = 0)\n" - "\n" - " -n --no-action Do not write to disk\n" - " -f --force Use less caution\n" - " -q --quiet Less output\n" - " -v --verbose More output\n" - " -V --version Version information\n" - " -h --help Print this help\n\n", - EXEC_NAME); - Qprintf ("Please report bugs to: linux-ntfs-dev@lists.sf.net\n\n"); -} - -/** - * parse_list - Read a comma-separated list of numbers - * @list: The comma-separated list of numbers - * @result: Store the parsed list here (must be freed by caller) - * - * Read a comma-separated list of numbers and allocate an array of ints to store - * them in. The numbers can be in decimal, octal or hex. - * - * N.B. The caller must free the memory returned in @result. - * N.B. If the function fails, @result is not changed. - * - * Return: 0 Error, invalid string - * n Success, the count of numbers parsed - */ -int parse_list (const char *list, int **result) -{ - const char *ptr; - char *end; - int i; - int count; - int *mem = NULL; - - if (!list || !result) - return 0; - - for (count = 0, ptr = list; ptr; ptr = strchr (ptr+1, ',')) - count++; - - mem = malloc ((count+1) * sizeof (int)); - if (!mem) { - Eprintf ("Couldn't allocate memory in parse_list().\n"); - return 0; - } - - memset (mem, 0xFF, (count+1) * sizeof (int)); - - for (ptr = list, i = 0; i < count; i++) { - - end = NULL; - mem[i] = strtol (ptr, &end, 0); - - if (!end || (end == ptr) || ((*end != ',') && (*end != 0))) { - Eprintf ("Invalid list '%s'\n", list); - free (mem); - return 0; - } - - if ((mem[i] < 0) || (mem[i] > 255)) { - Eprintf ("Bytes must be in range 0-255.\n"); - free (mem); - return 0; - } - - ptr = end + 1; - } - - Dprintf ("Parsing list '%s' - ", list); - for (i = 0; i <= count; i++) - Dprintf ("0x%02x ", mem[i]); - Dprintf ("\n"); - - *result = mem; - return count; -} - -/** - * parse_options - Read and validate the programs command line - * - * Read the command line, verify the syntax and parse the options. - * This function is very long, but quite simple. - * - * Return: 1 Success - * 0 Error, one or more problems - */ -int parse_options (int argc, char *argv[]) -{ - static const char *sopt = "-ab:c:dfhilmnpqtuvV"; - static const struct option lopt[] = { - { "all", no_argument, NULL, 'a' }, - { "bytes", required_argument, NULL, 'b' }, - { "count", required_argument, NULL, 'c' }, - { "directory", no_argument, NULL, 'd' }, - { "force", no_argument, NULL, 'f' }, - { "help", no_argument, NULL, 'h' }, - { "info", no_argument, NULL, 'i' }, - { "logfile", no_argument, NULL, 'l' }, - { "mft", no_argument, NULL, 'm' }, - { "no-action", no_argument, NULL, 'n' }, - { "pagefile", no_argument, NULL, 'p' }, - { "quiet", no_argument, NULL, 'q' }, - { "tails", no_argument, NULL, 't' }, - { "unused", no_argument, NULL, 'u' }, - { "verbose", no_argument, NULL, 'v' }, - { "version", no_argument, NULL, 'V' }, - { NULL, 0, NULL, 0 } - }; - - char c = -1; - char *end; - int err = 0; - int ver = 0; - int help = 0; - - opterr = 0; /* We'll handle the errors, thank you. */ - - opts.count = 1; - - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { - switch (c) { - case 1: /* A non-option argument */ - if (!opts.device) { - opts.device = argv[optind-1]; - } else { - opts.device = NULL; - err++; - } - break; - - case 'i': - opts.info++; /* and fall through */ - case 'a': - opts.directory++; - opts.logfile++; - opts.mft++; - opts.pagefile++; - opts.tails++; - opts.unused++; - break; - case 'b': - if (!opts.bytes) { - if (!parse_list (argv[optind-1], &opts.bytes)) - err++; - } else { - err++; - } - break; - case 'c': - if (opts.count == 1) { - end = NULL; - opts.count = strtol (optarg, &end, 0); - if (end && *end) - err++; - } else { - err++; - } - break; - case 'd': - opts.directory++; - break; - case 'f': - opts.force++; - break; - case 'h': - help++; - break; - case 'l': - opts.logfile++; - break; - case 'm': - opts.mft++; - break; - case 'n': - opts.noaction++; - break; - case 'p': - opts.pagefile++; - break; - case 'q': - opts.quiet++; - break; - case 't': - opts.tails++; - break; - case 'u': - opts.unused++; - break; - case 'v': - opts.verbose++; - break; - case 'V': - ver++; - break; - default: - if ((optopt == 'b') || (optopt == 'c')) { - Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); - } else { - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); - } - err++; - break; - } - } - - if (help || ver) { - opts.quiet = 0; - } else { - if (opts.device == NULL) { - Eprintf ("You must specify exactly one device.\n"); - err++; - } - - if (opts.quiet && opts.verbose) { - Eprintf ("You may not use --quiet and --verbose at the same time.\n"); - err++; - } - - /* - if (opts.info && (opts.unused || opts.tails || opts.mft || opts.directory)) { - Eprintf ("You may not use any other options with --info.\n"); - err++; - } - */ - - if ((opts.count < 1) || (opts.count > 100)) { - Eprintf ("The iteration count must be between 1 and 100.\n"); - err++; - } - - /* Create a default list */ - if (!opts.bytes) { - opts.bytes = malloc (2 * sizeof (int)); - if (opts.bytes) { - opts.bytes[0] = 0; - opts.bytes[1] = -1; - } else { - Eprintf ("Couldn't allocate memory for byte list.\n"); - err++; - } - } - - if (!opts.directory && !opts.logfile && !opts.mft && - !opts.pagefile && !opts.tails && !opts.unused) { - opts.info = 1; - } - } - - if (ver) - version(); - if (help || err) - usage(); - - return (!err && !help && !ver); -} - - /** * print_summary - Tell the user what we are about to do * @@ -699,11 +697,11 @@ int main (int argc, char *argv[]) int i, j; enum action act = act_info; - utils_set_locale(); - if (!parse_options (argc, argv)) return 1; + utils_set_locale(); + if (!opts.info) print_summary(); From fad40b9b78f000ed48511bce0ca66a688a8e9588 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 22:01:18 +0000 Subject: [PATCH 0447/2994] standardise usage and version info comment blocks (Logical change 1.105) --- ntfsprogs/ntfstruncate.c | 325 +++++++++++++++++++++++---------------- 1 file changed, 193 insertions(+), 132 deletions(-) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index b817ab1d..f2c52fa1 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -1,4 +1,4 @@ -/* +/** * ntfstruncate - Part of the Linux-NTFS project. * * Copyright (c) 2002-2003 Anton Altaparmakov @@ -100,21 +100,12 @@ GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) void err_exit(const char *fmt, ...) __attribute__ ((noreturn)); +void usage(void) __attribute__ ((noreturn)); -/* Error output and terminate. Ignores quiet (-q). */ -void err_exit(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "ERROR: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "Aborting...\n"); - exit(1); -} - -/* Debugging output (-vv). Overriden by quiet (-q). */ +/** + * Dprintf + * Debugging output (-vv). Overriden by quiet (-q). + */ void Dprintf(const char *fmt, ...) { va_list ap; @@ -127,6 +118,167 @@ void Dprintf(const char *fmt, ...) } } +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + printf ("\n%s v%s - Truncate a specified attribute of a specified inode.\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c)\n"); + printf (" 2002-2003 Anton Altaparmakov\n"); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + printf ("\nUsage: %s [options] device [attr-type [attr-name]] new-length\n" + " If attr-type is not specified, 0x80 (i.e. $DATA) is assumed.\n" + " If attr-name is not specified, an unnamed attribute is assumed.\n" + "\n" + " -n Do not write to disk\n" + " -f Use less caution\n" + " -q Less output\n" + " -v More output\n" + " -V Display version information\n" + " -h Display this help\n\n", + EXEC_NAME); + printf ("%s%s\n", ntfs_bugs, ntfs_home); + exit (1); +} + +/** + * parse_options + */ +void parse_options(int argc, char *argv[]) +{ + long long ll; + char *s, *s2; + int c; + + if (argc && *argv) + EXEC_NAME = *argv; + //fprintf(stderr, "%s v%s -- Copyright (c) 2002-2003 Anton " + //"Altaparmakov\n", EXEC_NAME, VERSION); + while ((c = getopt(argc, argv, "fh?nqvV")) != EOF) + switch (c) { + case 'f': + opts.force = 1; + break; + case 'n': + opts.no_action = 1; + break; + case 'q': + opts.quiet = 1; + break; + case 'v': + opts.verbose++; + break; + case 'V': + version(); + exit(0); + case 'h': + case '?': + default: + usage(); + } + if (optind == argc) + usage(); + + /* Get the device. */ + dev_name = argv[optind++]; + Dprintf("device name = %s\n", dev_name); + + if (optind == argc) + usage(); + + /* Get the inode. */ + ll = strtoll(argv[optind++], &s, 0); + if (*s || !ll || (ll >= LLONG_MAX && errno == ERANGE)) + err_exit("Invalid inode number: %s\n", argv[optind - 1]); + inode = ll; + Dprintf("inode = %Li\n", (long long)inode); + + if (optind == argc) + usage(); + + /* Get the attribute type, if specified. */ + s = argv[optind++]; + if (optind == argc) { + attr_type = AT_DATA; + attr_name = AT_UNNAMED; + attr_name_len = 0; + } else { + unsigned long ul; + + ul = strtoul(s, &s2, 0); + if (*s2 || !ul || (ul >= ULONG_MAX && errno == ERANGE)) + err_exit("Invalid attribute type %s: %s\n", s, + strerror(errno)); + attr_type = ul; + + /* Get the attribute name, if specified. */ + s = argv[optind++]; + if (optind != argc) { + /* Convert the string to little endian Unicode. */ + attr_name_len = ntfs_mbstoucs(s, &attr_name, 0); + if (attr_name_len < 0) + err_exit("Invalid attribute name \"%s\": %s\n", + s, strerror(errno)); + + /* Keep hold of the original string. */ + s2 = s; + + s = argv[optind++]; + if (optind != argc) + usage(); + } else { + attr_name = AT_UNNAMED; + attr_name_len = 0; + } + } + Dprintf("attribute type = 0x%x\n", attr_type); + if (attr_name == AT_UNNAMED) + Dprintf("attribute name = \"\" (UNNAMED)\n"); + else + Dprintf("attribute name = \"%s\" (length %i Unicode " + "characters)\n", s2, attr_name_len); + + /* Get the new length. */ + ll = strtoll(s, &s2, 0); + if (*s2 || ll < 0 || (ll >= LLONG_MAX && errno == ERANGE)) + err_exit("Invalid new length: %s\n", s); + new_len = ll; + Dprintf("new length = %Li\n", new_len); +} +/* Error output and terminate. Ignores quiet (-q). */ + +/** + * err_exit + */ +void err_exit(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "Aborting...\n"); + exit(1); +} + /** * ucstos - convert unicode-character string to ASCII * @dest: points to buffer to receive the converted string @@ -156,6 +308,9 @@ int ucstos(char *dest, const uchar_t *src, int maxlen) return i; } +/** + * dump_resident_attr_val + */ void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) { const char *don_t_know = "Don't know what to do with this attribute " @@ -300,6 +455,9 @@ void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) } } +/** + * dump_resident_attr + */ void dump_resident_attr(ATTR_RECORD *a) { int i; @@ -320,12 +478,18 @@ void dump_resident_attr(ATTR_RECORD *a) le32_to_cpu(a->value_length)); } +/** + * dump_mapping_pairs_array + */ void dump_mapping_pairs_array(char *b, unsigned int max_len) { // TODO return; } +/** + * dump_non_resident_attr + */ void dump_non_resident_attr(ATTR_RECORD *a) { s64 l; @@ -356,6 +520,9 @@ void dump_non_resident_attr(ATTR_RECORD *a) dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); } +/** + * dump_attr_record + */ void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) { unsigned int u; @@ -449,6 +616,9 @@ void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) } } +/** + * dump_mft_record + */ void dump_mft_record(MFT_RECORD *m) { ATTR_RECORD *a; @@ -497,123 +667,9 @@ void dump_mft_record(MFT_RECORD *m) printf("-- End of attributes. --\n"); } -void usage(void) __attribute__ ((noreturn)); - -void usage(void) -{ - fprintf(stderr, "This utility will truncate a specified attribute " - "belonging to a specified\ninode, i.e. file or " - "directory, to a specified length.\n\n" - "Usage: %s [-fhnqvV] device inode [attr-type " - "[attr-name]] new-length\n If " - "attr-type is not specified, 0x80 (i.e. $DATA) " - "is assumed.\n If attr-name is not " - "specified, an unnamed attribute is assumed.\n", - EXEC_NAME); - exit(1); -} - -void parse_options(int argc, char *argv[]) -{ - long long ll; - char *s, *s2; - int c; - - if (argc && *argv) - EXEC_NAME = *argv; - fprintf(stderr, "%s v%s -- Copyright (c) 2002-2003 Anton " - "Altaparmakov\n", EXEC_NAME, VERSION); - while ((c = getopt(argc, argv, "fhnqvV")) != EOF) - switch (c) { - case 'f': - opts.force = 1; - break; - case 'n': - opts.no_action = 1; - break; - case 'q': - opts.quiet = 1; - break; - case 'v': - opts.verbose++; - break; - case 'V': - /* Version number already printed, so just exit. */ - exit(0); - case 'h': - default: - usage(); - } - if (optind == argc) - usage(); - - /* Get the device. */ - dev_name = argv[optind++]; - Dprintf("device name = %s\n", dev_name); - - if (optind == argc) - usage(); - - /* Get the inode. */ - ll = strtoll(argv[optind++], &s, 0); - if (*s || !ll || (ll >= LLONG_MAX && errno == ERANGE)) - err_exit("Invalid inode number: %s\n", argv[optind - 1]); - inode = ll; - Dprintf("inode = %Li\n", (long long)inode); - - if (optind == argc) - usage(); - - /* Get the attribute type, if specified. */ - s = argv[optind++]; - if (optind == argc) { - attr_type = AT_DATA; - attr_name = AT_UNNAMED; - attr_name_len = 0; - } else { - unsigned long ul; - - ul = strtoul(s, &s2, 0); - if (*s2 || !ul || (ul >= ULONG_MAX && errno == ERANGE)) - err_exit("Invalid attribute type %s: %s\n", s, - strerror(errno)); - attr_type = ul; - - /* Get the attribute name, if specified. */ - s = argv[optind++]; - if (optind != argc) { - /* Convert the string to little endian Unicode. */ - attr_name_len = ntfs_mbstoucs(s, &attr_name, 0); - if (attr_name_len < 0) - err_exit("Invalid attribute name \"%s\": %s\n", - s, strerror(errno)); - - /* Keep hold of the original string. */ - s2 = s; - - s = argv[optind++]; - if (optind != argc) - usage(); - } else { - attr_name = AT_UNNAMED; - attr_name_len = 0; - } - } - Dprintf("attribute type = 0x%x\n", attr_type); - if (attr_name == AT_UNNAMED) - Dprintf("attribute name = \"\" (UNNAMED)\n"); - else - Dprintf("attribute name = \"%s\" (length %i Unicode " - "characters)\n", s2, attr_name_len); - - /* Get the new length. */ - ll = strtoll(s, &s2, 0); - if (*s2 || ll < 0 || (ll >= LLONG_MAX && errno == ERANGE)) - err_exit("Invalid new length: %s\n", s); - new_len = ll; - Dprintf("new length = %Li\n", new_len); -} - +/** + * ntfstruncate_exit + */ void ntfstruncate_exit(void) { int err; @@ -644,6 +700,9 @@ void ntfstruncate_exit(void) free(attr_name); } +/** + * main + */ int main(int argc, char **argv) { unsigned long mnt_flags, ul; @@ -661,6 +720,8 @@ int main(int argc, char **argv) /* Parse command line options. */ parse_options(argc, argv); + utils_set_locale(); + /* Make sure the file system is not mounted. */ if (ntfs_check_if_mounted(dev_name, &mnt_flags)) Eprintf("Failed to determine whether %s is mounted: %s\n", From 3d4314d7cdaf8de67a3fa8c5160f10cbbba662c8 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 22:01:18 +0000 Subject: [PATCH 0448/2994] standardise usage and version info more tools using utils comment blocks for all general tidyup BKrev: 3e2b202eT8-dE2WqCRDZ_qDLFSDzNQ From 1f2fc42fa2f3b3eecde6f0eb4cdc58d7c695ca54 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 22:01:18 +0000 Subject: [PATCH 0449/2994] whitespace tidyup (Logical change 1.105) --- ntfsprogs/ntfsresize.c | 99 ++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 48 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 24795178..b446a93c 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -98,7 +98,7 @@ struct __ntfs_resize_t { s64 new_volume_size; ntfs_inode *ni; /* inode being processed */ MFT_RECORD *mrec; /* MFT buffer being processed */ - ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ + ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ u64 relocations; /* number of clusters to relocate */ u64 inuse; /* number of clusters in use */ }; @@ -304,7 +304,7 @@ void parse_options(int argc, char **argv) memset(&opt, 0, sizeof(opt)); - while ((i = getopt(argc, argv, "dfhins:V")) != EOF) + while ((i = getopt(argc, argv, "dfh?ins:V")) != EOF) switch (i) { case 'd': opt.debug = 1; @@ -313,6 +313,7 @@ void parse_options(int argc, char **argv) opt.force++; break; case 'h': + case '?': usage(); case 'i': opt.info = 1; @@ -361,7 +362,7 @@ int runlist_extent_number(runlist *rl) { int i; - for (i = 0; rl[i].length; i++) + for (i = 0; rl[i].length; i++) ; return i; @@ -393,7 +394,7 @@ s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) * has no bits set. As each attribute record is read the bits in lcn_bitmap are * checked to ensure that no other file already references that cluster. * - * This serves as a rudimentary "chkdsk" operation. + * This serves as a rudimentary "chkdsk" operation. */ void build_lcn_usage_bitmap(ntfs_resize_t *resize) { @@ -491,19 +492,19 @@ void compare_bitmaps(struct bitmap *a) int k, mismatch = 0; char bit; u8 bm[NTFS_BUF_SIZE]; - + printf("Accounting clusters ...\n"); - + i = 0; while (1) { count = ntfs_attr_pread(vol->lcnbmp_na, i, NTFS_BUF_SIZE, bm); if (count == -1) perr_exit("Couldn't get $Bitmap $DATA"); - + if (count == 0) { if (a->size != i) err_exit("$Bitmap file size doesn't match " - "calculated size ((%Ld != %Ld)\n", + "calculated size ((%Ld != %Ld)\n", a->size, i); break; } @@ -513,13 +514,13 @@ void compare_bitmaps(struct bitmap *a) if (a->bm[i + k] == bm[k]) continue; - + for (j = i * 8; j < i * 8 + 8; j++) { - + bit = ntfs_bit_get(a->bm, j); if (bit != ntfs_bit_get(bm, k + j % 8)) continue; - + if (++mismatch > 10) continue; @@ -528,15 +529,15 @@ void compare_bitmaps(struct bitmap *a) j, j, bit ? "missing" : "extra"); } } - + i += count; } - + if (mismatch) { printf("Totally %d cluster accounting mismatches.\n" "You didn't shutdown Windows properly?\n", mismatch); exit(1); - } + } } /** @@ -627,25 +628,25 @@ void advise_on_resize() int fragmanted_end; printf("Calculating smallest shrunken size supported ...\n"); - + for (i = vol->nr_clusters - 1; i > 0 && (i % 8); i--) if (ntfs_bit_get(lcn_bitmap.bm, i)) goto found_used_cluster; - + if (i > 0) { if (ntfs_bit_get(lcn_bitmap.bm, i)) goto found_used_cluster; - } else + } else goto found_used_cluster; - + for (i -= 8; i >= 0; i -= 8) if (lcn_bitmap.bm[i / 8]) break; - + for (i += 7; i > 0; i--) if (ntfs_bit_get(lcn_bitmap.bm, i)) break; - + found_used_cluster: i += 2; /* first free + we reserve one for the backup boot sector */ fragmanted_end = (i >= vol->nr_clusters) ? 1 : 0; @@ -750,7 +751,7 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl_bad)) == -1) perr_exit("ntfs_get_size_for_mapping_pairs"); - + if (mp_size > le32_to_cpu (a->length) - le16_to_cpu (a->mapping_pairs_offset)) err_exit("Enlarging attribute header isn't supported yet.\n"); @@ -792,7 +793,7 @@ void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) continue; for (j = 0; j < rl[i].length; j++) { - if (rl[i].vcn + j < nr_bm_clusters) + if (rl[i].vcn + j < nr_bm_clusters) continue; k = (u64)rl[i].lcn + j; @@ -829,7 +830,7 @@ void enlarge_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) for (i = 0; i < rl->length; i++) ntfs_bit_set(lcn_bitmap.bm, rl->lcn + i, 0); free(rl); - + if (!(rl = *rlist = (runlist *)malloc(2 * sizeof(runlist)))) perr_exit("Couldn't get memory"); @@ -846,10 +847,10 @@ void enlarge_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) if (free_zone != nr_bm_clusters) err_exit("Couldn't allocate $Bitmap clusters.\n"); - + for (; free_zone; free_zone--, i--) ntfs_bit_set(lcn_bitmap.bm, i, 1); - + rl_set(rl, 0LL, i + 1, nr_bm_clusters); rl_set(rl + 1, nr_bm_clusters, -1LL, 0LL); } @@ -872,20 +873,20 @@ void truncate_bitmap_data_attr(ATTR_RECORD *a, s64 nr_clusters) bm_bsize = nr_clusters_to_bitmap_byte_size(nr_clusters); nr_bm_clusters = rounded_up_division(bm_bsize, vol->cluster_size); - + if (!(tmp = (u8 *)realloc(lcn_bitmap.bm, bm_bsize))) perr_exit("realloc"); lcn_bitmap.bm = tmp; lcn_bitmap.size = bm_bsize; bitmap_file_data_fixup(nr_clusters, &lcn_bitmap); - + if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) perr_exit("ntfs_mapping_pairs_decompress"); - + if (runlist_extent_number(rl) != 1) err_exit("$Bitmap data has more than one extent, unusual.\n" "Please report it to linux-ntfs-dev@lists.sf.net"); - + if (nr_clusters < vol->nr_clusters) shrink_bitmap_data_attr(&rl, nr_bm_clusters, nr_clusters); else @@ -893,7 +894,7 @@ void truncate_bitmap_data_attr(ATTR_RECORD *a, s64 nr_clusters) if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl)) == -1) perr_exit("ntfs_get_size_for_mapping_pairs"); - + if (mp_size > le32_to_cpu (a->length) - le16_to_cpu (a->mapping_pairs_offset)) err_exit("Enlarging attribute header isn't supported yet.\n"); @@ -910,11 +911,11 @@ void truncate_bitmap_data_attr(ATTR_RECORD *a, s64 nr_clusters) a->data_size = cpu_to_le64(bm_bsize); a->initialized_size = cpu_to_le64(bm_bsize); - /* - * FIXME: update allocated/data sizes and timestamps in $FILE_NAME - * attribute too, for now chkdsk will do this for us. + /* + * FIXME: update allocated/data sizes and timestamps in $FILE_NAME + * attribute too, for now chkdsk will do this for us. */ - + size = ntfs_rl_pwrite(vol, rl, 0, bm_bsize, lcn_bitmap.bm); if (bm_bsize != size) { if (size == -1) @@ -1064,7 +1065,9 @@ void update_bootsector(s64 nr_clusters) perr_exit("write() error"); } - +/** + * volume_size + */ s64 volume_size(ntfs_volume *vol, s64 nr_clusters) { return nr_clusters * vol->cluster_size; @@ -1089,16 +1092,16 @@ void print_volume_size(char *str, s64 bytes) void print_disk_usage(ntfs_resize_t *resize) { s64 total, used, free, relocations; - + total = vol->nr_clusters * vol->cluster_size; used = resize->inuse * vol->cluster_size; free = total - used; relocations = resize->relocations * vol->cluster_size; - + printf("Space in use : %lld MB (%.1f%%) ", rounded_up_division(used, NTFS_MBYTE), 100.0 * ((float)used / total)); - + printf("\n"); } @@ -1149,7 +1152,7 @@ void mount_volume() perr_exit("Unknown NTFS version"); printf("Cluster size : %u bytes\n", vol->cluster_size); - print_volume_size("Current volume size", + print_volume_size("Current volume size", volume_size(vol, vol->nr_clusters)); } @@ -1170,7 +1173,7 @@ void prepare_volume_fixup() printf("Schedule chkdsk for NTFS consistency check at Windows " "boot time ...\n"); - + if (ntfs_volume_set_flags(vol, flags)) perr_exit("Failed to set $Volume dirty"); @@ -1209,7 +1212,7 @@ int main(int argc, char **argv) err_exit("Couldn't get device size (%Ld)!\n", device_size); print_volume_size("Current device size", device_size); - + if (device_size < vol->nr_clusters * vol->cluster_size) err_exit("Current NTFS volume size is bigger than the device " "size (%Ld)!\nCorrupt partition table or incorrect " @@ -1220,27 +1223,27 @@ int main(int argc, char **argv) err_exit("New size can't be bigger than the " "device size (%Ld bytes).\n", device_size); } else - opt.bytes = device_size; + opt.bytes = device_size; - /* + /* * Take the integer part: we don't want to make the volume bigger - * than requested. Later on we will also decrease this value to save + * than requested. Later on we will also decrease this value to save * room for the backup boot sector. */ new_size = opt.bytes / vol->cluster_size; if (!opt.info) - print_volume_size("New volume size ", + print_volume_size("New volume size ", volume_size(vol, new_size)); - + /* Backup boot sector at the end of device isn't counted in NTFS volume size thus we have to reserve space for. We don't trust the user does this for us: better to be on the safe side ;) */ if (new_size) --new_size; - if (!opt.info && (new_size == vol->nr_clusters || - (opt.bytes == device_size && + if (!opt.info && (new_size == vol->nr_clusters || + (opt.bytes == device_size && new_size == vol->nr_clusters - 1))) { printf("Nothing to do: NTFS volume size is already OK.\n"); exit(0); From b6cfa71e8fdc2ebc5ede3677df7378a79f0eb5aa Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 22:01:18 +0000 Subject: [PATCH 0450/2994] whitespace tweak (Logical change 1.105) --- include/lcnalloc.h | 2 +- include/support.h | 2 +- libntfs/attrib.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/lcnalloc.h b/include/lcnalloc.h index d4853dd7..94774c72 100644 --- a/include/lcnalloc.h +++ b/include/lcnalloc.h @@ -1,6 +1,6 @@ /* * lcnalloc.h - Exports for cluster (de)allocation. Part of the Linux-NTFS - * project. + * project. * * Copyright (c) 2002 Anton Altaparmakov * diff --git a/include/support.h b/include/support.h index a6cd8913..181a79c9 100644 --- a/include/support.h +++ b/include/support.h @@ -58,7 +58,7 @@ #define test_and_clear_bit(bit, var) \ ({ \ - const BOOL old_state = test_bit(bit, var); \ + const BOOL old_state = test_bit(bit, var); \ clear_bit(bit, var); \ old_state; \ }) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 54da6e39..1b5f6057 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2283,8 +2283,8 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) // TODO: update the attribute list attribute in ni->attr_list, removing // all entries corresponding to deleted attributes // TODO: if the attribute list attribute is resident: - // TODO: update the actual attribute in the base mft - // record from ni->attr_list + // TODO: update the actual attribute in the base mft + // record from ni->attr_list // if the attribute list attribute is not resident: // TODO: update the attribute list attribute run list in // ni->attr_list_rl, freeing any no longer used From 6dc846c6287b98505387449a067e9dbb257db971 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 23:45:17 +0000 Subject: [PATCH 0451/2994] change resize to use utils BKrev: 3e2b388dccs8XrWSQD7sU5v12FW9gQ From 5fd45f8c7674c6590a033c133e256b98c37e011d Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 23:45:17 +0000 Subject: [PATCH 0452/2994] ntfsresize now uses the utils (Logical change 1.106) --- ntfsprogs/Makefile.am | 2 +- ntfsprogs/Makefile.in | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 72b788a5..f675da67 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -53,7 +53,7 @@ ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h utils.c utils.h ntfsundelete_LDADD = $(AM_LIBS) ntfsundelete_LDFLAGS = $(AM_LFLAGS) -ntfsresize_SOURCES = ntfsresize.c +ntfsresize_SOURCES = ntfsresize.c utils.c utils.h ntfsresize_LDADD = $(AM_LIBS) ntfsresize_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 90a28059..59316865 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -136,7 +136,7 @@ ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h utils.c utils.h ntfsundelete_LDADD = $(AM_LIBS) ntfsundelete_LDFLAGS = $(AM_LFLAGS) -ntfsresize_SOURCES = ntfsresize.c +ntfsresize_SOURCES = ntfsresize.c utils.c utils.h ntfsresize_LDADD = $(AM_LIBS) ntfsresize_LDFLAGS = $(AM_LFLAGS) @@ -225,7 +225,7 @@ ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) +ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ From 94efdfe2222ea94eff4d2044d554fa1852a4ddc6 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 23:45:17 +0000 Subject: [PATCH 0453/2994] reformat the usage output (Logical change 1.106) --- ntfsprogs/ntfsinfo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 332258e0..cd49b37c 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -80,11 +80,11 @@ void usage (void) printf ("\nUsage: %s [options] device\n" " -i num --inode num Display information about this inode\n" "\n" - " -f --force Use less caution\n" - " -q --quiet Less output\n" - " -v --verbose More output\n" - " -V --version Display version information\n" - " -h --help Display this help\n\n", + " -f --force Use less caution\n" + " -q --quiet Less output\n" + " -v --verbose More output\n" + " -V --version Display version information\n" + " -h --help Display this help\n\n", EXEC_NAME); printf ("%s%s\n", ntfs_bugs, ntfs_home); } From ea7b422e703b371433866c557f26d0e0954b0558 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 19 Jan 2003 23:45:17 +0000 Subject: [PATCH 0454/2994] use the utils standardise usage and version info (Logical change 1.106) --- ntfsprogs/ntfsresize.c | 196 +++++++++++++++++++++++++++-------------- 1 file changed, 131 insertions(+), 65 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index b446a93c..ec63e2c3 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -32,8 +32,6 @@ #include #include #include -#include -#include #include "debug.h" #include "types.h" @@ -47,13 +45,10 @@ #include "bitmap.h" #include "inode.h" #include "runlist.h" +#include "utils.h" static const char *EXEC_NAME = "ntfsresize"; -static const char *ntfs_report_banner = -"\nReport bugs to linux-ntfs-dev@lists.sf.net " -"Homepage: http://linux-ntfs.sf.net\n"; - static const char *resize_warning_msg = "WARNING: Every sanity check passed and only the DANGEROUS operations left.\n" "Please make sure all your important data had been backed up in case of an\n" @@ -74,6 +69,7 @@ static const char *fragmented_volume_msg = struct { int verbose; + int quiet; int debug; int ro_flag; int force; @@ -116,6 +112,10 @@ struct bitmap lcn_bitmap; #define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &opt.verbose, TRUE) +GEN_PRINTF (Qprintf, stdout, &opt.quiet, FALSE) + /** * perr_printf * @@ -174,27 +174,35 @@ int perr_exit(const char *fmt, ...) } /** - * usage + * usage - Print a list of the parameters to the program * - * Print a brief list of program options. + * Print a list of the parameters and options for the program. + * + * Return: none */ void usage() { - printf("\n"); - printf ("Usage: %s [-fhin] [-s size[k|M|G]] device\n", EXEC_NAME); - printf("Resize an NTFS volume non-destructively.\n"); - printf("\n"); - Dprintf(" -d Show debug information\n"); - printf (" -f Force to progress (DANGEROUS)\n"); - printf (" -h This help text\n"); - printf (" -i Calculate the smallest shrunken size supported (read-only)\n"); - printf (" -n Make a test run without write operations (read-only)\n"); - printf (" -s size[k|M|G] Resize volume to size[k|M|G] bytes (k=10^3, M=10^6, G=10^9)\n"); -/* printf (" -v Verbose operation\n"); */ - printf (" -V Version information\n"); - printf("\nThe options -i and -s are mutually exclusive. If both options are " - "omitted then\nthe NTFS volume will be enlarged to the device size.\n"); - printf(ntfs_report_banner); + + printf ("\nUsage: %s [options] device\n" + " Resize an NTFS volume non-destructively.\n" + "\n" + " -i --info Calculate the smallest shrunken size supported\n" + " -s num --size num Resize volume to num[k|M|G] bytes\n" + "\n" + " -n --no-action Do not write to disk\n" + " -f --force Force to progress (DANGEROUS)\n" + /* " -q --quiet Less output\n"*/ + " -v --verbose More output\n" + " -V --version Display version information\n" + " -h --help Display this help\n" +#ifdef DEBUG + " -d --debug Show debug information\n" +#endif + "\n" + " The options -i and -s are mutually exclusive. If both options are\n" + " omitted then the NTFS volume will be enlarged to the device size.\n" + "\n", EXEC_NAME); + printf ("%s%s\n", ntfs_bugs, ntfs_home); exit(1); } @@ -230,15 +238,13 @@ void proceed_question(void) */ void version (void) { - printf ("Resize an NTFS Volume, without data loss.\n\n" - "%s is free software, released under the GNU " - "General Public License\nand you are welcome to redistribute " - "it under certain conditions.\n%s comes with ABSOLUTELY NO " - "WARRANTY; for details read the GNU\nGeneral Public License " - "to be found in the file COPYING in the main\nLinux-NTFS " - "distribution directory.\n\n", - EXEC_NAME, EXEC_NAME); - exit(1); + printf ("\n%s v%s - Resize an NTFS Volume, without data loss.\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c)\n"); + printf (" 2002-2003 Szabolcs Szakacsits\n"); + printf (" 2002-2003 Anton Altaparmakov\n"); + printf (" 2002-2003 Richard Russon\n"); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -292,65 +298,129 @@ s64 get_new_volume_size(char *s) } /** - * parse_options + * parse_options - Read and validate the programs command line * - * Parse the command line options + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems */ -void parse_options(int argc, char **argv) +int parse_options(int argc, char **argv) { - int i; + static const char *sopt = "-dfhins:vV"; + static const struct option lopt[] = { +#ifdef DEBUG + { "debug", no_argument, NULL, 'd' }, +#endif + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "info", no_argument, NULL, 'i' }, + { "no-action", no_argument, NULL, 'n' }, + /* { "quiet", no_argument, NULL, 'q' },*/ + { "size", required_argument, NULL, 's' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } + }; - printf("%s v%s\n", EXEC_NAME, VERSION); + char c; + int err = 0; + int ver = 0; + int help = 0; memset(&opt, 0, sizeof(opt)); - while ((i = getopt(argc, argv, "dfh?ins:V")) != EOF) - switch (i) { + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!err && !opt.volume) + opt.volume = argv[optind-1]; + else + err++; + break; case 'd': - opt.debug = 1; + opt.debug++; break; case 'f': opt.force++; break; case 'h': case '?': - usage(); + help++; + break; case 'i': - opt.info = 1; + opt.info++; break; case 'n': opt.ro_flag = MS_RDONLY; break; + case 'q': + opt.quiet++; + break; case 's': - opt.bytes = get_new_volume_size(optarg); + if (!err && (opt.bytes == 0)) + opt.bytes = get_new_volume_size(optarg); + else + err++; break; case 'v': opt.verbose++; break; case 'V': - version(); + ver++; + break; default: - usage(); + if (optopt == 's') { + Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); + } else { + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + } + err++; + break; } - if (optind == argc) - usage(); - opt.volume = argv[optind++]; - if (optind < argc) - usage(); + } + + if (help || ver) { + opt.quiet = 0; + } else { + if (opt.volume == NULL) { + if (argc > 1) + Eprintf ("You must specify exactly one device.\n"); + err++; + } + + /* + if (opt.quiet && opt.verbose) { + Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + err++; + } + */ + + if (opt.info) { + opt.ro_flag = MS_RDONLY; + if (opt.bytes > 0) { + Eprintf (NERR_PREFIX "Options --info and --size" + " can't be used together.\n"); + err++; + } + } + } stderr = stdout; + +#ifdef DEBUG if (!opt.debug) if (!(stderr = fopen("/dev/null", "rw"))) perr_exit("Couldn't open /dev/null"); +#endif - if (opt.info) { - if (opt.bytes) { - printf(NERR_PREFIX "Options -i and -s can't be used " - "together.\n"); - usage(); - } - opt.ro_flag = MS_RDONLY; - } + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); } /** @@ -1194,15 +1264,11 @@ int main(int argc, char **argv) s64 new_size = 0; /* in clusters */ s64 device_size; /* in bytes */ int i; - const char *locale; - locale = setlocale (LC_ALL, ""); - if (!locale) { - locale = setlocale (LC_ALL, NULL); - printf ("Failed to set locale, using default (%s).\n", locale); - } + if (!parse_options (argc, argv)) + return 1; - parse_options(argc, argv); + utils_set_locale(); mount_volume(); From edaa66643a7305ab174a0807f800dfbdbdc92c69 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Jan 2003 11:08:14 +0000 Subject: [PATCH 0455/2994] Add a little endian mk_mref (Logical change 1.107) --- include/layout.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/layout.h b/include/layout.h index 1d5009ab..c526276f 100644 --- a/include/layout.h +++ b/include/layout.h @@ -271,6 +271,8 @@ typedef u64 MFT_REF; #define MK_MREF(m, s) ((MFT_REF)(((MFT_REF)(s) << 48) | \ ((MFT_REF)(m) & MFT_REF_MASK_CPU))) +#define MK_LE_MREF(m, s) const_cpu_to_le64(((MFT_REF)(((MFT_REF)(s) << 48) | \ + ((MFT_REF)(m) & MFT_REF_MASK_CPU)))) #define MREF(x) ((u64)((x) & MFT_REF_MASK_CPU)) #define MSEQNO(x) ((u16)(((x) >> 48) & 0xffff)) From daae2d00c5aa6c7af512b0a5f4690d1f02507496 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Jan 2003 11:08:14 +0000 Subject: [PATCH 0456/2994] add new options (Logical change 1.107) --- ntfsprogs/mkntfs.8.in | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index f84abeb5..5edbf57d 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -53,6 +53,12 @@ mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system [ .B \-V ] +[ +.B \-l +] +[ +.B \-h +] .I device [ .I number-of-sectors @@ -175,6 +181,16 @@ not implement content indexing at all.) Print the version number of .B mkntfs and exit. +.TP +.B \-l +Print the licensing information of +.B mkntfs +and exit. +.TP +.B \-h +Print the usage information of +.B mkntfs +and exit. .SH BUGS .B mkntfs writes the backup boot sector to the last sector of the block From c8dae5156c54a80a7d02336121165bd332bafba3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Jan 2003 11:08:14 +0000 Subject: [PATCH 0457/2994] cleanup flatcaps changes (reverting a few) as well as add new option (Logical change 1.107) --- ntfsprogs/mkntfs.c | 210 +++++++++++++++++++++------------------ ntfsprogs/ntfstruncate.c | 133 ++++++++++++++----------- 2 files changed, 191 insertions(+), 152 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 96e52935..7b8114e1 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -170,58 +170,110 @@ struct { /* -V, print version and exit. */ } opts; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) - -void err_exit(const char *fmt, ...) __attribute__ ((noreturn)); -void usage(void) __attribute__ ((noreturn)); - /** - * version - Print version information about the program - * - * Print a copyright statement and a brief description of the program. - * - * Return: none + * Dprintf - debugging output (-vv); overriden by quiet (-q) */ -void version (void) +void Dprintf(const char *fmt, ...) { - printf ("\n%s v%s - Create an NTFS volume on a user specified (block) device.\n\n", - EXEC_NAME, VERSION); - printf ("Copyright (c)\n"); - printf (" 2000-2003 Anton Altaparmakov\n"); - printf (" 2001-2003 Richard Russon\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + va_list ap; + + if (!opts.quiet && opts.verbose > 1) { + printf("DEBUG: "); + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } } /** - * usage - Print a list of the parameters to the program - * - * Print a list of the parameters and options for the program. - * - * Return: none + * Eprintf - error output; ignores quiet (-q) */ -void usage (void) +void Eprintf(const char *fmt, ...) { - printf ("\nUsage: %s [options] device [number-of-sectors]\n" - " -s sector-size Specify the sector size for the device\n" - " -c cluster-size Specify the cluster size for the volume\n" - " -L volume-label Set the volume label\n" - " -z mft-zone-multiplier Set the MFT zone multiplier\n" - " -f Perform a quick format\n" - " -Q Perform a quick format\n" - " -C Enable compression on the volume\n" - " -I mft-zone-multiplier \n" - "\n" - " -n Do not write to disk\n" - " -F Use less caution\n" - " -q Quiet execution\n" - " -v Verbose execution\n" - " -v Very verbose execution\n" - " -V Display version information\n" - " -h Display this help\n\n", - EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); +} + +/* Generate code for Vprintf() function: Verbose output (-v). */ +GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) + +/* Generate code for Qprintf() function: Quietable output (if not -q). */ +GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) + +/** + * err_exit - error output and terminate; ignores quiet (-q) + */ +void err_exit(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "Aborting...\n"); + exit(1); + +} + +/** + * copyright - print copyright statements + */ +void copyright(void) +{ + fprintf(stderr, "Copyright (c) 2000-2003 Anton Altaparmakov\n" + "Copyright (c) 2001-2003 Richard Russon\n" + "Create an NTFS volume on a user specified (block) " + "device.\n"); +} + +/** + * license - print licese statement + */ +void license(void) +{ + fprintf(stderr, "%s", ntfs_gpl); +} + +/** + * usage - print a list of the parameters to the program + */ +void usage(void) __attribute__ ((noreturn)); +void usage(void) +{ + copyright(); + fprintf(stderr, "Usage: %s [options] device " + "[number-of-sectors]\n" + " -s sector-size Specify the sector size " + "for the device\n" + " -c cluster-size Specify the cluster " + "size for the volume\n" + " -L volume-label Set the volume label\n" + " -z mft-zone-multiplier Set the MFT zone " + "multiplier\n" + " -f Perform a quick format\n" + " -Q Perform a quick format\n" + " -C Enable compression on " + "the volume\n" + " -I Disable indexing on the " + "volume\n" + " -n Do not write to disk\n" + " -F Force execution despite " + "errors\n" + " -q Quiet execution\n" + " -v Verbose execution\n" + " -vv Very verbose execution\n" + " -V Display version " + "information\n" + " -l Display licensing " + "information\n" + " -h Display this help\n", + EXEC_NAME); + fprintf(stderr, "%s%s", ntfs_bugs, ntfs_home); exit(1); } @@ -239,7 +291,8 @@ void parse_options(int argc, char *argv[]) // logfile size, list of bad blocks, check for bad blocks, ... if (argc && *argv) EXEC_NAME = *argv; - while ((c = getopt(argc, argv, "c:fh?nqs:vz:CFIL:QV")) != EOF) + fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); + while ((c = getopt(argc, argv, "c:fh?nqs:vz:CFIL:QVl")) != EOF) switch (c) { case 'n': opts.no_action = 1; @@ -285,7 +338,11 @@ void parse_options(int argc, char *argv[]) vol->vol_name = optarg; break; case 'V': - version(); + /* Version number already printed, so just exit. */ + exit(0); + case 'l': + copyright(); + license(); exit(0); case 'h': case '?': @@ -306,39 +363,6 @@ void parse_options(int argc, char *argv[]) usage(); } - -/** - * err_exit - * Error output and terminate. Ignores quiet (-q). - */ -void err_exit(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "ERROR: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "Aborting...\n"); - exit(1); -} - -/** - * Dprintf - * Debugging output (-vv). Overriden by quiet (-q). - */ -void Dprintf(const char *fmt, ...) -{ - va_list ap; - - if (!opts.quiet && opts.verbose > 1) { - printf("DEBUG: "); - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); - } -} - /** * append_to_bad_blocks */ @@ -1269,7 +1293,7 @@ int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, if (err >= 0) err = -EIO; Eprintf("insert_positioned_attr_in_mft_record failed with " - "error %lld.\n", err < 0 ? err : bw); + "error %i.\n", err < 0 ? err : (int)bw); } err_out: if (ctx) @@ -2490,9 +2514,6 @@ void mkntfs_exit(void) free(vol); } -// What's wrong with MK_MREF? -#define MAKE_MFT_REF(_ref, _seqno) cpu_to_le64((((u64)(_seqno)) << 48) \ - | ((u64)(_ref))) /** * main */ @@ -2510,6 +2531,7 @@ int main(int argc, char **argv) NTFS_BOOT_SECTOR *bs; unsigned long mnt_flags; + /* Setup the correct locale for string output and conversion. */ utils_set_locale(); /* Initialize the random number generator with the current time. */ @@ -3058,7 +3080,7 @@ int main(int argc, char **argv) // dump_mft_record(m); } /* The root directory mft reference. */ - root_ref = MAKE_MFT_REF(FILE_root, FILE_root); + root_ref = MK_LE_MREF(FILE_root, FILE_root); Vprintf("Creating root directory (mft record 5)\n"); m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); m->flags |= MFT_RECORD_IS_DIRECTORY; @@ -3107,7 +3129,7 @@ int main(int argc, char **argv) opts.mft_size); if (!err) err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_MFT, 1), opts.mft_size, + MK_LE_MREF(FILE_MFT, 1), opts.mft_size, opts.mft_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$MFT", FILE_NAME_WIN32_AND_DOS); @@ -3128,7 +3150,7 @@ int main(int argc, char **argv) rl_mftmirr[0].length * vol->cluster_size); if (!err) err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_MFTMirr, FILE_MFTMirr), + MK_LE_MREF(FILE_MFTMirr, FILE_MFTMirr), rl_mftmirr[0].length * vol->cluster_size, rl_mftmirr[0].length * vol->cluster_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, @@ -3153,7 +3175,7 @@ int main(int argc, char **argv) buf2 = NULL; if (!err) err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_LogFile, FILE_LogFile), + MK_LE_MREF(FILE_LogFile, FILE_LogFile), opts.logfile_size, opts.logfile_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$LogFile", FILE_NAME_WIN32_AND_DOS); @@ -3167,7 +3189,7 @@ int main(int argc, char **argv) Vprintf("Creating $Volume (mft record 3)\n"); m = (MFT_RECORD*)(buf + 3 * vol->mft_record_size); err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_Volume, FILE_Volume), 0LL, 0LL, + MK_LE_MREF(FILE_Volume, FILE_Volume), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$Volume", FILE_NAME_WIN32_AND_DOS); if (!err) { @@ -3204,7 +3226,7 @@ int main(int argc, char **argv) buf2 = NULL; if (!err) err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_AttrDef, FILE_AttrDef), + MK_LE_MREF(FILE_AttrDef, FILE_AttrDef), (buf2_size + vol->cluster_size - 1) & ~(vol->cluster_size - 1), buf2_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, @@ -3222,7 +3244,7 @@ int main(int argc, char **argv) err = add_attr_data(m, NULL, 0, 0, 0, lcn_bitmap, lcn_bitmap_byte_size); if (!err) err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_Bitmap, FILE_Bitmap), + MK_LE_MREF(FILE_Bitmap, FILE_Bitmap), (lcn_bitmap_byte_size + vol->cluster_size - 1) & ~(vol->cluster_size - 1), lcn_bitmap_byte_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, @@ -3300,7 +3322,7 @@ int main(int argc, char **argv) err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_boot, buf2, 8192); if (!err) err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_Boot, FILE_Boot), + MK_LE_MREF(FILE_Boot, FILE_Boot), (8192 + vol->cluster_size - 1) & ~(vol->cluster_size - 1), 8192, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, @@ -3353,7 +3375,7 @@ bb_err: } if (!err) { err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_BadClus, FILE_BadClus), + MK_LE_MREF(FILE_BadClus, FILE_BadClus), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$BadClus", FILE_NAME_WIN32_AND_DOS); } @@ -3369,7 +3391,7 @@ bb_err: err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); if (!err) err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(9, 9), 0LL, 0LL, FILE_ATTR_HIDDEN + MK_LE_MREF(9, 9), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$Quota", FILE_NAME_WIN32_AND_DOS); if (!err) { @@ -3385,7 +3407,7 @@ bb_err: vol->upcase_len << 1); if (!err) err = create_hardlink(index_block, root_ref, m, - MAKE_MFT_REF(FILE_UpCase, FILE_UpCase), + MK_LE_MREF(FILE_UpCase, FILE_UpCase), ((vol->upcase_len << 1) + vol->cluster_size - 1) & ~(vol->cluster_size - 1), vol->upcase_len << 1, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index f2c52fa1..0c9a407f 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -95,16 +95,8 @@ struct { /* -V, print version and exit. */ } opts; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) - -void err_exit(const char *fmt, ...) __attribute__ ((noreturn)); -void usage(void) __attribute__ ((noreturn)); - /** - * Dprintf - * Debugging output (-vv). Overriden by quiet (-q). + * Dprintf - debugging output (-vv); overriden by quiet (-q) */ void Dprintf(const char *fmt, ...) { @@ -119,43 +111,81 @@ void Dprintf(const char *fmt, ...) } /** - * version - Print version information about the program - * - * Print a copyright statement and a brief description of the program. - * - * Return: none + * Eprintf - error output; ignores quiet (-q) */ -void version (void) +void Eprintf(const char *fmt, ...) { - printf ("\n%s v%s - Truncate a specified attribute of a specified inode.\n\n", - EXEC_NAME, VERSION); - printf ("Copyright (c)\n"); - printf (" 2002-2003 Anton Altaparmakov\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); +} + +/* Generate code for Vprintf() function: Verbose output (-v). */ +GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) + +/* Generate code for Qprintf() function: Quietable output (if not -q). */ +GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) + +/** + * err_exit - error output and terminate; ignores quiet (-q) + */ +void err_exit(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "Aborting...\n"); + exit(1); } /** - * usage - Print a list of the parameters to the program - * - * Print a list of the parameters and options for the program. - * - * Return: none + * copyright - print copyright statements */ +void copyright(void) +{ + fprintf(stderr, "Copyright (c) 2002-2003 Anton Altaparmakov\n" + "Copyright (c) 2003 Richard Russon\n" + "Truncate a specified attribute of a specified " + "inode.\n"); +} + +/** + * license - print licese statement + */ +void license(void) +{ + fprintf(stderr, "%s", ntfs_gpl); +} + +/** + * usage - print a list of the parameters to the program + */ +void usage(void) __attribute__ ((noreturn)); void usage (void) { - printf ("\nUsage: %s [options] device [attr-type [attr-name]] new-length\n" - " If attr-type is not specified, 0x80 (i.e. $DATA) is assumed.\n" - " If attr-name is not specified, an unnamed attribute is assumed.\n" - "\n" - " -n Do not write to disk\n" - " -f Use less caution\n" - " -q Less output\n" - " -v More output\n" - " -V Display version information\n" - " -h Display this help\n\n", - EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); - exit (1); + copyright(); + fprintf(stderr, "Usage: %s [options] device [attr-type [attr-name]] " + "new-length\n" + " If attr-type is not specified, 0x80 (i.e. $DATA) " + "is assumed.\n" + " If attr-name is not specified, an unnamed " + "attribute is assumed.\n" + " -n Do not write to disk\n" + " -f Force execution despite errors\n" + " -q Quiet execution\n" + " -v Verbose execution\n" + " -vv Very verbose execution\n" + " -V Display version information\n" + " -l Display licensing information\n" + " -h Display this help\n", EXEC_NAME); + fprintf(stderr, "%s%s", ntfs_bugs, ntfs_home); + exit(1); } /** @@ -169,9 +199,8 @@ void parse_options(int argc, char *argv[]) if (argc && *argv) EXEC_NAME = *argv; - //fprintf(stderr, "%s v%s -- Copyright (c) 2002-2003 Anton " - //"Altaparmakov\n", EXEC_NAME, VERSION); - while ((c = getopt(argc, argv, "fh?nqvV")) != EOF) + fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); + while ((c = getopt(argc, argv, "fh?nqvVl")) != EOF) switch (c) { case 'f': opts.force = 1; @@ -186,7 +215,11 @@ void parse_options(int argc, char *argv[]) opts.verbose++; break; case 'V': - version(); + /* Version number already printed, so just exit. */ + exit(0); + case 'l': + copyright(); + license(); exit(0); case 'h': case '?': @@ -262,22 +295,6 @@ void parse_options(int argc, char *argv[]) new_len = ll; Dprintf("new length = %Li\n", new_len); } -/* Error output and terminate. Ignores quiet (-q). */ - -/** - * err_exit - */ -void err_exit(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "ERROR: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "Aborting...\n"); - exit(1); -} /** * ucstos - convert unicode-character string to ASCII From 18279d0c4cf105324d4cf4ecf62fd92210ebbea2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Jan 2003 11:08:14 +0000 Subject: [PATCH 0458/2994] cleanup flatcaps changes (reverting a few) as well as add new option and a new little endian version of mk_ref BKrev: 3e2bd89esUUHa4fnVmnVQqKc_FYZiA From d7b23b64941538042ac6ba081fb0ddbe4e0322fb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 21 Jan 2003 09:46:19 +0000 Subject: [PATCH 0459/2994] ntfsresize patch from Szaka: - calling fdatasync when appropriate - always print program version - uncommented not yet used program options (Logical change 1.108) --- ntfsprogs/ntfsresize.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index ec63e2c3..3441d10d 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -192,7 +192,7 @@ void usage() " -n --no-action Do not write to disk\n" " -f --force Force to progress (DANGEROUS)\n" /* " -q --quiet Less output\n"*/ - " -v --verbose More output\n" + /* " -v --verbose More output\n"*/ " -V --version Display version information\n" " -h --help Display this help\n" #ifdef DEBUG @@ -238,8 +238,7 @@ void proceed_question(void) */ void version (void) { - printf ("\n%s v%s - Resize an NTFS Volume, without data loss.\n\n", - EXEC_NAME, VERSION); + printf ("\nResize an NTFS Volume, without data loss.\n\n"); printf ("Copyright (c)\n"); printf (" 2002-2003 Szabolcs Szakacsits\n"); printf (" 2002-2003 Anton Altaparmakov\n"); @@ -319,7 +318,7 @@ int parse_options(int argc, char **argv) { "no-action", no_argument, NULL, 'n' }, /* { "quiet", no_argument, NULL, 'q' },*/ { "size", required_argument, NULL, 's' }, - { "verbose", no_argument, NULL, 'v' }, + /* { "verbose", no_argument, NULL, 'v' },*/ { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 } }; @@ -1043,7 +1042,13 @@ void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) */ int write_mft_record(ntfs_attr_search_ctx *ctx) { - return ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec); + if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec)) + perr_exit("ntfs_mft_record_write"); + + if (fdatasync(vol->fd) == -1) + perr_exit("Failed to sync device"); + + return 0; } /** @@ -1247,10 +1252,16 @@ void prepare_volume_fixup() if (ntfs_volume_set_flags(vol, flags)) perr_exit("Failed to set $Volume dirty"); + if (fdatasync(vol->fd) == -1) + perr_exit("Failed to sync device"); + printf("Resetting $LogFile ... (this might take a while)\n"); if (ntfs_logfile_reset(vol)) perr_exit("Failed to reset $LogFile"); + + if (fdatasync(vol->fd) == -1) + perr_exit("Failed to sync device"); } /** @@ -1265,6 +1276,8 @@ int main(int argc, char **argv) s64 device_size; /* in bytes */ int i; + printf("%s v%s\n", EXEC_NAME, VERSION); + if (!parse_options (argc, argv)) return 1; From 6f0025bf50df72d1d8a96d6367dc1d55c0f16502 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 21 Jan 2003 09:46:19 +0000 Subject: [PATCH 0460/2994] ntfsresize patch from Szaka: - calling fdatasync when appropriate - always print program version - uncommented not yet used program options BKrev: 3e2d16ebKXfmh3kqkUwSityYkr6kfw From 0bda9e5cda47e3d11ebfd0c8e3be726f10a36c4f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 25 Jan 2003 15:26:56 +0000 Subject: [PATCH 0461/2994] Add new function ntfs_bitmap_set_run() to complement the existing ntfs_bitmap_clear_run(). (Logical change 1.109) --- include/bitmap.h | 3 +- libntfs/bitmap.c | 75 ++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 62 insertions(+), 16 deletions(-) diff --git a/include/bitmap.h b/include/bitmap.h index 20a91313..910acd2c 100644 --- a/include/bitmap.h +++ b/include/bitmap.h @@ -1,7 +1,7 @@ /* * bitmap.h - Exports for bitmap handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -100,6 +100,7 @@ static __inline__ char ntfs_bit_get_and_set(u8 *bitmap, const u64 bit, return old_bit; } +extern int ntfs_bitmap_set_run(ntfs_attr *na, s64 start_bit, s64 count); extern int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count); #endif /* defined _NTFS_BITMAP_H */ diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index f3636863..45e0f148 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -1,7 +1,7 @@ /* * bitmap.c - Bitmap handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -21,6 +21,7 @@ #include #include +#include #include #include "types.h" @@ -29,17 +30,19 @@ /** - * ntfs_bitmap_clear_run - clear a run of bits in a bitmap + * ntfs_bitmap_set_bits_in__run - set a run of bits in a bitmap to a value * @na: attribute containing the bitmap - * @start_bit: first bit to clear - * @count: number of bits to clear + * @start_bit: first bit to set + * @count: number of bits to set + * @value: value to set the bits to (i.e. 0 or 1) * - * Clear @count bits starting at bit @start_bit in the bitmap described by the - * attribute @na. + * Set @count bits starting at bit @start_bit in the bitmap described by the + * attribute @na to @value, where @value is either 0 or 1. * * On success return 0 and on error return -1 with errno set to the error code. */ -int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) +static int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, s64 count, + int value) { u8 *buf, *lastbyte_buf; s64 bufsize, br; @@ -61,10 +64,12 @@ int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) if (bufsize > 8192) bufsize = 8192; - /* Allocate already zeroed memory. */ - buf = (u8*)calloc(1, bufsize); + /* Allocate memory. */ + buf = (u8*)malloc(bufsize); if (!buf) return -1; + /* Depending on @value, zero or set all bits in the allocated buffer. */ + memset(buf, value ? 0xff : 0, bufsize); /* If there is a first partial byte... */ if (bit) { @@ -75,9 +80,13 @@ int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) errno = EIO; return -1; } - /* and clear the appropriate bits in it. */ - while ((bit & 7) && count--) - *buf &= ~(1 << bit++); + /* and set or clear the appropriate bits in it. */ + while ((bit & 7) && count--) { + if (value) + *buf |= 1 << bit++; + else + *buf &= ~(1 << bit++); + } /* Update @start_bit to the new position. */ start_bit = (start_bit + 7) & ~7; } @@ -115,9 +124,13 @@ int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) err = EIO; goto free_err_out; } - /* and clear the appropriate bits in it. */ - while (bit && count--) - *lastbyte_buf &= ~(1 << --bit); + /* and set/clear the appropriate bits in it. */ + while (bit && count--) { + if (value) + *lastbyte_buf |= 1 << --bit; + else + *lastbyte_buf &= ~(1 << --bit); + } /* We don't want to come back here... */ bit = 0; /* We have a last byte that we have handled. */ @@ -166,3 +179,35 @@ free_err_out: return -1; } +/** + * ntfs_bitmap_set_run - set a run of bits in a bitmap + * @na: attribute containing the bitmap + * @start_bit: first bit to set + * @count: number of bits to set + * + * Set @count bits starting at bit @start_bit in the bitmap described by the + * attribute @na. + * + * On success return 0 and on error return -1 with errno set to the error code. + */ +int ntfs_bitmap_set_run(ntfs_attr *na, s64 start_bit, s64 count) +{ + return ntfs_bitmap_set_bits_in_run(na, start_bit, count, 1); +} + +/** + * ntfs_bitmap_clear_run - clear a run of bits in a bitmap + * @na: attribute containing the bitmap + * @start_bit: first bit to clear + * @count: number of bits to clear + * + * Clear @count bits starting at bit @start_bit in the bitmap described by the + * attribute @na. + * + * On success return 0 and on error return -1 with errno set to the error code. + */ +int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) +{ + return ntfs_bitmap_set_bits_in_run(na, start_bit, count, 0); +} + From cde0777685bde0593c995d68adcc1ce0c4ee9860 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 25 Jan 2003 15:26:56 +0000 Subject: [PATCH 0462/2994] Add new function ntfs_bitmap_set_run() to complement the existing ntfs_bitmap_clear_run(). BKrev: 3e32acc0-_V9roWAi3eAksTeiNfiCw From 6826dc9238768ecf14a08fed0395886002141572 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 25 Jan 2003 15:26:56 +0000 Subject: [PATCH 0463/2994] Update (Logical change 1.109) --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fdf2d9e4..b83cb1cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -185,7 +185,7 @@ - New API functions provided by lcnalloc.[hc]: ntfs_cluster_{alloc,free}(). -- WIP - New API function provided by bitmap.[hc]: - ntfs_bitmap_clear_run(). -- WIP + ntfs_bitmap_{set,clear}_run(). -- WIP - Extend the volume.h::ntfs_volume structure with variables required by the cluster and mft allocators and set them up in volume.c::ntfs_volume_startup(). From 05c32a26e1e49fc2c9d5df3223e2b0b973303cf2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 25 Jan 2003 17:02:31 +0000 Subject: [PATCH 0464/2994] small tidyup (Logical change 1.110) --- include/volume.h | 4 ++-- libntfs/bitmap.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/volume.h b/include/volume.h index 94074ec0..4820cfd5 100644 --- a/include/volume.h +++ b/include/volume.h @@ -123,7 +123,7 @@ struct _ntfs_volume { s64 nr_mft_records; /* Number of records in the mft, equals the number of bits in mft_bitmap. */ - s64 mft_lcn; /* Logical cluster number of the data attribute + LCN mft_lcn; /* Logical cluster number of the data attribute for FILE_MFT. */ ntfs_inode *mft_ni; /* ntfs_inode structure for FILE_MFT. */ ntfs_attr *mft_na; /* ntfs_attr structure for the data attribute @@ -136,7 +136,7 @@ struct _ntfs_volume { vice versa. */ int mftmirr_size; /* Size of the FILE_MFTMirr in mft records. */ - s64 mftmirr_lcn; /* Logical cluster number of the data attribute + LCN mftmirr_lcn; /* Logical cluster number of the data attribute for FILE_MFTMirr. */ ntfs_inode *mftmirr_ni; /* ntfs_inode structure for FILE_MFTMirr. */ ntfs_attr *mftmirr_na; /* ntfs_attr structure for the data attribute diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index 45e0f148..c4eb3b1c 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -44,8 +44,8 @@ static int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, s64 count, int value) { - u8 *buf, *lastbyte_buf; s64 bufsize, br; + u8 *buf, *lastbyte_buf; int bit, firstbyte, lastbyte, lastbyte_pos, tmp, err; if (!na || start_bit < 0 || count < 0) { From f4db4b6cb7ccefd9da8ec198b0be19a2c8ee1f0f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 25 Jan 2003 17:02:31 +0000 Subject: [PATCH 0465/2994] small tidyup BKrev: 3e32c327XL9YSh4AHXpmTSZ_jnbE2g From b37b14e01458fd5e9ade887363eaaf8af70c20c2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 26 Jan 2003 16:47:16 +0000 Subject: [PATCH 0466/2994] Implementation of ntfs_cluster_alloc(). (Some fixme's remaining and note this is _completely_ untested code!!! DANGEROUS!!!) (Logical change 1.111) --- libntfs/lcnalloc.c | 690 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 684 insertions(+), 6 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 88cd7c40..e692fb8c 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -19,12 +19,14 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include "types.h" #include "attrib.h" #include "bitmap.h" +#include "debug.h" #include "runlist.h" #include "volume.h" #include "lcnalloc.h" @@ -52,10 +54,10 @@ * * There are two data zones. First is the area between the end of the mft zone * and the end of the volume, and second is the area between the start of the - * volume and the start of the mft zone. On unmodified/standard volumes, the - * second mft zone doesn't exist due to the mft zone being expanded to cover - * the start of the volume in order to reserve space for the mft bitmap - * attribute. + * volume and the start of the mft zone. On unmodified/standard NTFS 1.x + * volumes, the second date zone doesn't exist due to the mft zone being + * expanded to cover the start of the volume in order to reserve space for the + * mft bitmap attribute. * * This is not the prettiest function but the complexity stems from the need of * implementing the mft vs data zoned approach and from the fact that we have @@ -85,17 +87,693 @@ * possible code paths. So at least for now, I am leaving the double logic - * better safe than sorry... (AIA) */ +// FIXME: Add a start_vcn parameter if we need it and then instead of setting +// rl[rlpos].vcn = 0; for the first run, add a sparse start element (LCN_HOLE), +// and make rl[rlpos].vcn = start_vcn; for the first non-sparse run. (AIA) runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, const NTFS_CLUSTER_ALLOCATION_ZONES zone) { - if (!vol || count < 0 || start_lcn < 0 || !vol->lcnbmp_na || + LCN zone_start, zone_end, bmp_pos, bmp_initial_pos, last_read_pos, lcn; + LCN prev_lcn = 0, prev_run_len = 0, mft_zone_size; + s64 clusters, br; + runlist *rl = NULL, *trl; + u8 *buf, *byte; + int err = 0, rlpos, rlsize, buf_size; + u8 pass, done_zones, search_zone, need_writeback, bit; + + Dprintf("%s(): Entering with count = 0x%Lx, start_lcn = 0x%Lx, + zone = %s_ZONE.\n", (long long)count, + (long long)start_lcn, + zone == MFT_ZONE ? "MFT" : "DATA"); + if (!vol || count < 0 || start_lcn < -1 || !vol->lcnbmp_na || zone < FIRST_ZONE || zone > LAST_ZONE) { + fprintf(stderr, "%s(): Invalid arguments!\n", __FUNCTION__); errno = EINVAL; return NULL; } - errno = ENOTSUP; + /* Allocate memory. */ + buf = (u8*)malloc(8192); + if (!buf) + return NULL; + /* + * If no specific @start_lcn was requested, use the current data zone + * position, otherwise use the requested @start_lcn but make sure it + * lies outside the mft zone. Also set done_zones to 0 (no zones done) + * and pass depending on whether we are starting inside a zone (1) or + * at the beginning of a zone (2). If requesting from the MFT_ZONE, + * we either start at the current position within the mft zone or at + * the specified position. If the latter is out of bounds then we start + * at the beginning of the MFT_ZONE. + */ + done_zones = 0; + pass = 1; + /* + * zone_start and zone_end are the current search range. search_zone + * is 1 for mft zone, 2 for data zone 1 (end of mft zone till end of + * volume) and 4 for data zone 2 (start of volume till start of mft + * zone). + */ + zone_start = start_lcn; + if (zone_start < 0) { + if (zone == DATA_ZONE) + zone_start = vol->data1_zone_pos; + else + zone_start = vol->mft_zone_pos; + if (!zone_start) { + /* + * Zone starts at beginning of volume which means a + * single pass is sufficient. + */ + pass = 2; + } + } else if (zone == DATA_ZONE && zone_start >= vol->mft_zone_start && + zone_start < vol->mft_zone_end) { + zone_start = vol->mft_zone_end; + /* + * Starting at beginning of data1_zone which means a single + * pass in this zone is sufficient. + */ + pass = 2; + } else if (zone == MFT_ZONE && (zone_start < vol->mft_zone_start || + zone_start >= vol->mft_zone_end)) { + zone_start = vol->mft_lcn; + if (!vol->mft_zone_end) + zone_start = 0; + /* + * Starting at beginning of volume which means a single pass + * is sufficient. + */ + pass = 2; + } + if (zone == MFT_ZONE) { +//FIXME: What about when vol->mft_zone_end is zero? (AIA) + zone_end = vol->mft_zone_end; + search_zone = 1; + } else /* if (zone == DATA_ZONE) */ { + /* Skip searching the mft zone. */ + done_zones |= 1; + if (zone_start >= vol->mft_zone_end) { + zone_end = vol->nr_clusters; + search_zone = 2; + } else { + zone_end = vol->mft_zone_start; + search_zone = 4; + } + } + /* + * bmp_pos is the current bit position inside the bitmap. We use + * bmp_initial_pos to determine whether or not to do a zone switch. + */ + bmp_pos = bmp_initial_pos = zone_start; + + /* Loop until all clusters are allocated, i.e. clusters == 0. */ + clusters = count; + rlpos = rlsize = 0; + while (1) { + Dprintf("%s(): Start of outer while loop: done_zones = 0x%x, " + "search_zone = %i, pass = %i, zone_start = " + "0x%Lx, zone_end = 0x%Lx, bmp_initial_pos = " + "0x%Lx, bmp_pos = 0x%Lx, rlpos = %i, rlsize = " + "%i.\n", __FUNCTION__, done_zones, search_zone, + pass, (long long)zone_start, + (long long)zone_end, (long long)bmp_initial_pos, + (long long)bmp_pos, rlpos, rlsize); + /* Loop until we run out of free clusters. */ + last_read_pos = bmp_pos >> 3; + Dprintf("%s(): last_read_pos = 0x%Lx.\n", __FUNCTION__, + (long long)last_read_pos); + br = ntfs_attr_pread(vol->lcnbmp_na, last_read_pos, 8192, buf); + if (br <= 0) { + if (!br) { + /* Reached end of attribute. */ + Dprintf("%s(): End of attribute reached. " + "Skipping to zone_pass_done.\n", + __FUNCTION__); + goto zone_pass_done; + } + err = errno; + Dprintf("%s(): ntfs_attr_pread() failed. Aborting.\n", + __FUNCTION__); + goto err_ret; + } + /* + * We might have read less than 8192 bytes if we are close to + * the end of the attribute. + */ + buf_size = (int)br << 3; + lcn = bmp_pos & 7; + bmp_pos &= ~7; + need_writeback = 0; + Dprintf("%s(): Before inner while loop: buf_size = %i, " + "lcn = 0x%Lx, bmp_pos = 0x%Lx, need_writeback " + "= %i.\n", __FUNCTION__, buf_size, + (long long)lcn, (long long)bmp_pos, + need_writeback); + while (lcn < buf_size && lcn + bmp_pos < zone_end) { + byte = buf + (lcn >> 3); + Dprintf("%s(): In inner while loop: buf_size = %i, " + "lcn = 0x%Lx, bmp_pos = 0x%Lx, " + "need_writeback = %i, byte ofs = 0x%x, " + "*byte = 0x%x.\n", __FUNCTION__, + buf_size, (long long)lcn, + (long long)bmp_pos, need_writeback, + lcn >> 3, *byte); + /* Skip full bytes. */ + if (*byte == 0xff) { + lcn += 8; + Dprintf("%s(): continuing while loop 1.\n", + __FUNCTION__); + continue; + } + bit = 1 << (lcn & 7); + Dprintf("%s(): bit = %i.\n", __FUNCTION__, bit); + /* If the bit is already set, go onto the next one. */ + if (*byte & bit) { + lcn++; + Dprintf("%s(): continuing while loop 2.\n", + __FUNCTION__); + continue; + } + /* Allocate the bitmap bit. */ + *byte |= bit; + /* We need to write this bitmap buffer back to disk! */ + need_writeback = 1; + Dprintf("%s(): *byte = 0x%x, need_writeback is set.\n", + __FUNCTION__, *byte); + /* Reallocate memory if necessary. */ + if ((rlpos + 2) * sizeof(runlist) >= rlsize) { + Dprintf("%s(): Reallocating space.\n", + __FUNCTION__); + /* Setup first free bit return value. */ + if (!rl) { + start_lcn = lcn + bmp_pos; + Dprintf("%s(): start_lcn = 0x%Lx.\n", + __FUNCTION__, + (long long)start_lcn); + } + rlsize += 4096; + trl = (runlist*)realloc(rl, rlsize); + if (!trl) { + err = ENOMEM; + Dprintf("%s(): Failed to allocate " + "memory, going to " + "wb_err_ret.\n", + __FUNCTION__); + goto wb_err_ret; + } + rl = trl; + Dprintf("%s(): Reallocated memory, rlsize = " + "0x%x.\n", __FUNCTION__, + rlsize); + } + /* + * Coalesce with previous run if adjacent LCNs. + * Otherwise, append a new run. + */ + Dprintf("%s(): Adding run (lcn 0x%Lx, len 0x%Lx), " + "prev_lcn = 0x%Lx, lcn = 0x%Lx, " + "bmp_pos = 0x%Lx, prev_run_len = 0x%x, " + "rlpos = %i.\n", __FUNCTION__, + (long long)(lcn + bmp_pos), 1LL, + (long long)prev_lcn, (long long)lcn, + (long long)bmp_pos, + (long long)prev_run_len, rlpos); + if (prev_lcn == lcn + bmp_pos - prev_run_len && rlpos) { + Dprintf("%s(): Coalescing to run (lcn 0x%Lx, " + "len 0x%Lx).\n", __FUNCTION__, + (long long)rl[rlpos - 1].lcn, + (long long) + rl[rlpos - 1].length); + rl[rlpos - 1].length = ++prev_run_len; + Dprintf("%s(): Run now (lcn 0x%Lx, len 0x%Lx), " + "prev_run_len = 0x%Lx.\n", + __FUNCTION__, + (long long)rl[rlpos - 1].lcn, + (long long)rl[rlpos - 1].length, + (long long)prev_run_len); + } else { + if (rlpos) { + Dprintf("%s(): Adding new run, " + "(previous run lcn " + "0x%Lx, len 0x%Lx).\n", + __FUNCTION__, + (long long) + rl[rlpos - 1].lcn, + (long long) + rl[rlpos - 1].length); + rl[rlpos].vcn = rl[rlpos - 1].vcn + + prev_run_len; + } else { + Dprintf("%s(): Adding new run, is " + "first run.\n", + __FUNCTION__); + rl[rlpos].vcn = 0; + } + rl[rlpos].lcn = prev_lcn = lcn + bmp_pos; + rl[rlpos].length = prev_run_len = 1; + rlpos++; + } + /* Done? */ + if (!--clusters) { + LCN tc; + /* + * Update the current zone position. Positions + * of already scanned zones have been updated + * during the respective zone switches. + */ + tc = lcn + bmp_pos + 1; + Dprintf("%s(): Done. Updating current zone " + "position, tc = 0x%Lx, " + "search_zone = %i.\n", + __FUNCTION__, (long long)tc, + search_zone); + switch (search_zone) { + case 1: + Dprintf("%s(): Before checks, " + "vol->mft_zone_pos = " + "0x%Lx.\n", + __FUNCTION__, + (long long) + vol->mft_zone_pos); + if (tc >= vol->mft_zone_end) { + vol->mft_zone_pos = + vol->mft_lcn; + if (!vol->mft_zone_end) + vol->mft_zone_pos = 0; + } else if ((bmp_initial_pos >= + vol->mft_zone_pos || + tc > vol->mft_zone_pos) + && tc >= vol->mft_lcn) + vol->mft_zone_pos = tc; + Dprintf("%s(): After checks, " + "vol->mft_zone_pos = " + "0x%Lx.\n", + __FUNCTION__, + (long long) + vol->mft_zone_pos); + break; + case 2: + Dprintf("%s(): Before checks, " + "vol->data1_zone_pos = " + "0x%Lx.\n", + __FUNCTION__, + (long long) + vol->data1_zone_pos); + if (tc >= vol->nr_clusters) + vol->data1_zone_pos = + vol->mft_zone_end; + else if ((bmp_initial_pos >= + vol->data1_zone_pos || + tc > vol->data1_zone_pos) + && tc >= vol->mft_zone_end) + vol->data1_zone_pos = tc; + Dprintf("%s(): After checks, " + "vol->data1_zone_pos = " + "0x%Lx.\n", + __FUNCTION__, + (long long) + vol->data1_zone_pos); + break; + case 4: + Dprintf("%s(): Before checks, " + "vol->data2_zone_pos = " + "0x%Lx.\n", + __FUNCTION__, + (long long) + vol->data2_zone_pos); + if (tc >= vol->mft_zone_start) + vol->data2_zone_pos = 0; + else if (bmp_initial_pos >= + vol->data2_zone_pos || + tc > vol->data2_zone_pos) + vol->data2_zone_pos = tc; + Dprintf("%s(): After checks, " + "vol->data2_zone_pos = " + "0x%Lx.\n", + __FUNCTION__, + (long long) + vol->data2_zone_pos); + break; + default: + if (rl) + free(rl); + free(buf); + NTFS_BUG("switch(search_zone)"); + return NULL; + } + Dprintf("%s(): Going to done_ret.\n", + __FUNCTION__); + goto done_ret; + } + lcn++; + } + bmp_pos += buf_size; + Dprintf("%s(): After inner while loop: buf_size = 0x%x, " + "lcn = 0x%Lx, bmp_pos = 0x%Lx, need_writeback " + "= %i.\n", __FUNCTION__, buf_size, + (long long)lcn, (long long)bmp_pos, + need_writeback); + if (need_writeback) { + s64 bw; + Dprintf("%s(): Writing back.\n", __FUNCTION__); + need_writeback = 0; + bw = ntfs_attr_pwrite(vol->lcnbmp_na, last_read_pos, + br, buf); + if (bw != br) { + if (bw == -1) + err = errno; + else + err = EIO; + fprintf(stderr, "%s(): Bitmap writeback " + "failed in read next buffer " + "code path with error code " + "%i.\n", __FUNCTION__, err); + goto err_ret; + } + } + if (bmp_pos < zone_end) { + Dprintf("%s(): Continuing outer while loop, bmp_pos = " + "0x%Lx, zone_end = 0x%Lx.\n", + __FUNCTION__, (long long)bmp_pos, + (long long)zone_end); + continue; + } +zone_pass_done: /* Finished with the current zone pass. */ + Dprintf("%s(): At zone_pass_done, pass = %i.\n", __FUNCTION__, + pass); + if (pass == 1) { + /* + * Now do pass 2, scanning the first part of the zone + * we omitted in pass 1. + */ + pass = 2; + zone_end = zone_start; + switch (search_zone) { + case 1: /* mft_zone */ + zone_start = vol->mft_zone_start; + break; + case 2: /* data1_zone */ + zone_start = vol->mft_zone_end; + break; + case 4: /* data2_zone */ + zone_start = 0; + break; + default: + NTFS_BUG("switch(search_zone), 2"); + } + /* Sanity check. */ + if (zone_end < zone_start) + zone_end = zone_start; + bmp_pos = zone_start; + Dprintf("%s(): Continuing outer while loop, pass = 2, " + "zone_start = 0x%Lx, zone_end = 0x%Lx, " + "bmp_pos = 0x%Lx.\n", __FUNCTION__, + zone_start, zone_end, bmp_pos); + continue; + } /* pass == 2 */ +done_zones_check: + Dprintf("%s(): At done_zones_check, search_zone = %i, " + "done_zones before = 0x%x, done_zones after = " + "0x%x.\n", __FUNCTION__, search_zone, + done_zones, done_zones | search_zone); + done_zones |= search_zone; + if (done_zones < 7) { + Dprintf("%s(): Switching zone.\n", __FUNCTION__); + /* Now switch to the next zone we haven't done yet. */ + pass = 1; + switch (search_zone) { + case 1: + Dprintf("%s(): Switching from mft zone to " + "data1 zone.\n", __FUNCTION__); + /* Update mft zone position. */ + if (rlpos) { + LCN tc; + Dprintf("%s(): Before checks, " + "vol->mft_zone_pos = " + "0x%Lx.\n", + __FUNCTION__, + (long long) + vol->mft_zone_pos); + tc = rl[rlpos - 1].lcn + + rl[rlpos - 1].length; + if (tc >= vol->mft_zone_end) { + vol->mft_zone_pos = + vol->mft_lcn; + if (!vol->mft_zone_end) + vol->mft_zone_pos = 0; + } else if ((bmp_initial_pos >= + vol->mft_zone_pos || + tc > vol->mft_zone_pos) + && tc >= vol->mft_lcn) + vol->mft_zone_pos = tc; + Dprintf("%s(): After checks, " + "vol->mft_zone_pos = " + "0x%Lx.\n", + __FUNCTION__, + (long long) + vol->mft_zone_pos); + } + /* Switch from mft zone to data1 zone. */ +switch_to_data1_zone: search_zone = 2; + zone_start = bmp_initial_pos = + vol->data1_zone_pos; + zone_end = vol->nr_clusters; + if (zone_start == vol->mft_zone_end) + pass = 2; + if (zone_start >= zone_end) { + vol->data1_zone_pos = zone_start = + vol->mft_zone_end; + pass = 2; + } + break; + case 2: + Dprintf("%s(): Switching from data1 zone to " + "data2 zone.\n", __FUNCTION__); + /* Update data1 zone position. */ + if (rlpos) { + LCN tc; + Dprintf("%s(): Before checks, " + "vol->data1_zone_pos = " + "0x%Lx.\n", + __FUNCTION__, + (long long) + vol->data1_zone_pos); + tc = rl[rlpos - 1].lcn + + rl[rlpos - 1].length; + if (tc >= vol->nr_clusters) + vol->data1_zone_pos = + vol->mft_zone_end; + else if ((bmp_initial_pos >= + vol->data1_zone_pos || + tc > vol->data1_zone_pos) + && tc >= vol->mft_zone_end) + vol->data1_zone_pos = tc; + Dprintf("%s(): After checks, " + "vol->data1_zone_pos = " + "0x%Lx.\n", + __FUNCTION__, + (long long) + vol->data1_zone_pos); + } + /* Switch from data1 zone to data2 zone. */ + search_zone = 4; + zone_start = bmp_initial_pos = + vol->data2_zone_pos; + zone_end = vol->mft_zone_start; + if (!zone_start) + pass = 2; + if (zone_start >= zone_end) { + vol->data2_zone_pos = zone_start = + bmp_initial_pos = 0; + pass = 2; + } + break; + case 4: + Dprintf("%s(): Switching from data2 zone to " + "data1 zone.\n"); + /* Update data2 zone position. */ + if (rlpos) { + LCN tc; + Dprintf("%s(): Before checks, " + "vol->data2_zone_pos = " + "0x%Lx.\n", + __FUNCTION__, + (long long) + vol->data2_zone_pos); + tc = rl[rlpos - 1].lcn + + rl[rlpos - 1].length; + if (tc >= vol->mft_zone_start) + vol->data2_zone_pos = 0; + else if (bmp_initial_pos >= + vol->data2_zone_pos || + tc > vol->data2_zone_pos) + vol->data2_zone_pos = tc; + Dprintf("%s(): After checks, " + "vol->data2_zone_pos = " + "0x%Lx.\n", + __FUNCTION__, + (long long) + vol->data2_zone_pos); + } + /* Switch from data2 zone to data1 zone. */ + goto switch_to_data1_zone; /* See above. */ + default: + NTFS_BUG("switch(search_zone) 3"); + } + Dprintf("%s(): After zone switch, search_zone = %i, " + "pass = %i, bmp_initial_pos = 0x%Lx, " + "zone_start = 0x%Lx, zone_end = " + "0x%Lx.\n", __FUNCTION__, search_zone, + pass, (long long)bmp_initial_pos, + (long long)zone_start, + (long long)zone_end); + bmp_pos = zone_start; + if (zone_start == zone_end) { + Dprintf("%s(): Empty zone, going to " + "done_zones_check.\n", + __FUNCTION__); + /* Empty zone. Don't bother searching it. */ + goto done_zones_check; + } + Dprintf("%s(): Continuing outer while loop.\n", + __FUNCTION__); + continue; + } /* done_zones == 7 */ + Dprintf("%s(): All zones are finished.\n", __FUNCTION__); + /* + * All zones are finished! If DATA_ZONE, shrink mft zone. If + * MFT_ZONE, we have really run out of space. + */ + mft_zone_size = vol->mft_zone_end - vol->mft_zone_start; + Dprintf("%s(): vol->mft_zone_start = 0x%Lx, vol->mft_zone_end " + "= 0x%Lx, mft_zone_size = 0x%Lx.\n", + __FUNCTION__, (long long)vol->mft_zone_start, + (long long)vol->mft_zone_end, + (long long)mft_zone_size); + if (zone == MFT_ZONE || mft_zone_size <= 0) { + Dprintf("%s(): No free clusters left, going to " + "err_ret.\n", __FUNCTION__); + /* Really no more space left on device. */ + err = ENOSPC; + goto err_ret; + } /* zone == DATA_ZONE && mft_zone_size > 0 */ + Dprintf("%s(): Shrinking mft zone.\n", __FUNCTION__); + zone_end = vol->mft_zone_end; + mft_zone_size >>= 1; + if (mft_zone_size > 0) + vol->mft_zone_end = vol->mft_zone_start + mft_zone_size; + else /* mft zone and data2 zone no longer exist. */ + vol->data2_zone_pos = vol->mft_zone_start = + vol->mft_zone_end = 0; + if (vol->mft_zone_pos >= vol->mft_zone_end) { + vol->mft_zone_pos = vol->mft_lcn; + if (!vol->mft_zone_end) + vol->mft_zone_pos = 0; + } + bmp_pos = zone_start = bmp_initial_pos = + vol->data1_zone_pos = vol->mft_zone_end; + search_zone = 2; + pass = 2; + done_zones &= ~2; + Dprintf("%s(): After shrinking mft zone, mft_zone_size = " + "0x%Lx, vol->mft_zone_start = 0x%Lx, " + "vol->mft_zone_end = 0x%Lx, vol->mft_zone_pos " + "= 0x%Lx, search_zone = 2, pass = 2, " + "dones_zones = 0x%x, zone_start = 0x%Lx, " + "zone_end = 0x%Lx, vol->data1_zone_pos = " + "0x%Lx, continuing outer while loop.\n", + __FUNCTION__, (long long)mft_zone_size, + (long long)vol->mft_zone_start, + (long long)vol->mft_zone_end, + (long long)vol->mft_zone_pos, + done_zones, (long long)zone_start, + (long long)zone_end, + (long long)vol->data1_zone_pos); + } + Dprintf("%s(): After outer while loop.\n"); +done_ret: + Dprintf("%s(): At done_ret.\n"); + /* Add runlist terminator element. */ + rl[rlpos].vcn = rl[rlpos - 1].vcn + rl[rlpos - 1].length; + rl[rlpos].lcn = LCN_ENOENT; + rl[rlpos].length = 0; + if (need_writeback) { + s64 bw; + Dprintf("%s(): Writing back.\n", __FUNCTION__); + need_writeback = 0; + bw = ntfs_attr_pwrite(vol->lcnbmp_na, last_read_pos, br, buf); + if (bw != br) { + if (bw < 0) + err = errno; + else + err = EIO; + fprintf(stderr, "%s(): Bitmap writeback failed " + "in done code path with error code " + "%i.\n", __FUNCTION__, err); + goto err_ret; + } + } +done_err_ret: + Dprintf("%s(): At done_err_ret (follows done_ret).\n"); + free(buf); + /* Done! */ + if (!err) + return rl; + Dprintf("%s(): Failed to allocate clusters. Returning with error code " + "%i.\n", __FUNCTION__, err); + errno = err; return NULL; +wb_err_ret: + Dprintf("%s(): At wb_err_ret.\n", __FUNCTION__); + if (need_writeback) { + s64 bw; + Dprintf("%s(): Writing back.\n", __FUNCTION__); + need_writeback = 0; + bw = ntfs_attr_pwrite(vol->lcnbmp_na, last_read_pos, br, buf); + if (bw != br) { + if (bw < 0) + err = errno; + else + err = EIO; + fprintf(stderr, "%s(): Bitmap writeback failed " + "in error code path with error code " + "%i.\n", __FUNCTION__, err); + } + } +err_ret: + Dprintf("%s(): At err_ret.\n", __FUNCTION__); + if (rl) { + if (err == ENOSPC) { + Dprintf("%s(): err = ENOSPC, first free lcn = 0x%Lx, " + "could allocate up to = 0x%Lx " + "clusters.\n", __FUNCTION__, + (long long)rl[0].lcn, + (long long)count - clusters); + } +//FIXME: We don't have an attribute just a run list here! Also rl is not +// terminated at this moment in time! (AIA) +#if 0 + /* Deallocate all allocated clusters. */ + Dprintf("%s(): Deallocating allocated clusters.\n", + __FUNCTION__); + ntfs_cluster_free(vol, attrib_with_rl, 0, -1); +#endif + fprintf(stderr, "%s(): Eeek! Leaving inconsistent metadata.\n", + __FUNCTION__); + /* Free the runlist. */ + free(rl); + rl = NULL; + } else { + if (err == ENOSPC) { + Dprintf("%s(): No space left at all, err = ENOSPC, " + "first free lcn = 0x%Lx.\n", + __FUNCTION__, + (long long)vol->data1_zone_pos); + } + } + Dprintf("%s(): rl = NULL, going to done_err_ret.\n", __FUNCTION__); + goto done_err_ret; } /** From acc8aa6f0502a63770574010f4ac6ee655a06e7c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 26 Jan 2003 16:47:16 +0000 Subject: [PATCH 0467/2994] New function NTFS_BUG() which prints an error message and then causes a segmentation fault. Only to be used for critical bug catches... (Logical change 1.111) --- include/debug.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/include/debug.h b/include/debug.h index a5716196..440d2112 100644 --- a/include/debug.h +++ b/include/debug.h @@ -22,15 +22,16 @@ #ifndef _NTFS_DEBUG_H #define _NTFS_DEBUG_H -#include "attrib.h" - -#ifdef DEBUG - #include "config.h" #ifdef HAVE_STDIO_H # include #endif + +#include "attrib.h" + +#ifdef DEBUG + #ifdef HAVE_STDARG_H # include #endif @@ -65,14 +66,22 @@ static __inline__ void Dperror(const char *s) extern void ntfs_debug_runlist_dump(const runlist_element *rl); -#else +#else /* if !DEBUG */ static __inline__ void Dprintf(const char *fmt, ...) {} static __inline__ void Dputs(const char *s) {} static __inline__ void Dperror(const char *s) {} static __inline__ void ntfs_debug_runlist_dump(const runlist_element *rl) {} -#endif +#endif /* !DEBUG */ + +#define NTFS_BUG(msg) \ +{ \ + int ___i; \ + fprintf(stderr, "libntfs: Bug in %s(): %s\n", __FUNCTION__, msg); \ + Dputs("Forcing segmentation fault!"); \ + ___i = ((int*)NULL)[1]; \ +} #endif /* defined _NTFS_DEBUG_H */ From e772d632e21a410f06c1fdce5cea457fa8392b5d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 26 Jan 2003 16:47:16 +0000 Subject: [PATCH 0468/2994] libntfs/lcnalloc.c Implementation of ntfs_cluster_alloc(). (Some fixme's remaining and note this is _completely_ untested code!!! DANGEROUS!!!) include/debug.h New function NTFS_BUG() which prints an error message and then causes a segmentation fault. Only to be used for critical bug catches... BKrev: 3e341114gYEYsQFncagPzjIW-aYTXw From 201442e81b3e7a91adec4933340423db3ab4d2d4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 26 Jan 2003 16:47:16 +0000 Subject: [PATCH 0469/2994] update (Logical change 1.111) --- TODO.libntfs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/TODO.libntfs b/TODO.libntfs index e327a531..4d43c773 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -6,9 +6,7 @@ - complete the implementation of ntfs_attr_truncate() -- write ntfs_cluster_allocate() (see ntfs 2.4 driver in CVS) - -- write ntfs_mft_record_{allocate,free}() (see ntfs 2.4 driver in CVS) +- write ntfs_mft_record_allocate() (see ntfs 2.4 driver in CVS) - add read of compressed attributes From 82d9438cb985e1d28d0db6e109f1c8fe010b5291 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 28 Jan 2003 15:40:39 +0000 Subject: [PATCH 0470/2994] remove unnecessary FIXME (Logical change 1.112) --- libntfs/lcnalloc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index e692fb8c..b4d3ff2f 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -167,7 +167,6 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, pass = 2; } if (zone == MFT_ZONE) { -//FIXME: What about when vol->mft_zone_end is zero? (AIA) zone_end = vol->mft_zone_end; search_zone = 1; } else /* if (zone == DATA_ZONE) */ { From 54c576be6c2f222dacfcd019e96b3df3efa3c14d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 28 Jan 2003 15:40:39 +0000 Subject: [PATCH 0471/2994] remove unnecessary FIXME BKrev: 3e36a477FPlolsLJrnqBA-0OnEyx1A From d650fb065b5b313247872a894482d416a2a304e7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Feb 2003 15:20:56 +0000 Subject: [PATCH 0472/2994] Fix stupid bug in ntfs_mapping_pairs_build() (thanks to Szaka!) and a simillar bug in ntfs_get_size_for_mapping_pairs(). (Logical change 1.113) --- libntfs/runlist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index bfd01a5a..81ac0b72 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1,7 +1,7 @@ /* * runlist.c - Run list handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2003 Anton Altaparmakov * Copyright (c) 2002 Richard Russon * * This program/include file is free software; you can redistribute it and/or @@ -1160,7 +1160,7 @@ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, return 0; /* Always need the termining zero byte. */ rls = 1; - for (prev_lcn = i = 0; rl[i].length; prev_lcn = rl[++i].lcn) { + for (prev_lcn = i = 0; rl[i].length; prev_lcn = rl[i++].lcn) { if (rl[i].length < 0 || rl[i].lcn < LCN_HOLE) goto err_out; /* Header byte + length. */ @@ -1269,7 +1269,7 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, * ntfs_write_significant_bytes(). */ dst_max = dst + dst_len - 1; - for (prev_lcn = i = 0; rl[i].length; prev_lcn = rl[++i].lcn) { + for (prev_lcn = i = 0; rl[i].length; prev_lcn = rl[i++].lcn) { if (rl[i].length < 0 || rl[i].lcn < LCN_HOLE) goto err_out; /* Write length. */ From 215471b309d8a4a32dc021d9a031a3dcb6bcb58d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Feb 2003 15:20:56 +0000 Subject: [PATCH 0473/2994] Fix stupid bug in ntfs_mapping_pairs_build() (thanks to Szaka!) and a simillar bug in ntfs_get_size_for_mapping_pairs(). BKrev: 3e427d58e29fPaocHZM9xaP2eWOtOg From e8fccbf21b9a70f61220fc40f38c35156118600a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Feb 2003 15:21:53 +0000 Subject: [PATCH 0474/2994] ntfsresize update from Szaka: - fix mapping pairs generation with multiply extents - support volume enlargement with multiply extents in $Bitmap - support volume shrinking with multiply extents in $Bitmap - more verbose multiply referenced clusters reporting - better hints when filesystem is inconsistent (Logical change 1.114) --- ntfsprogs/ntfsresize.c | 43 ++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 3441d10d..f15d1fc8 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -95,8 +95,9 @@ struct __ntfs_resize_t { ntfs_inode *ni; /* inode being processed */ MFT_RECORD *mrec; /* MFT buffer being processed */ ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ - u64 relocations; /* number of clusters to relocate */ - u64 inuse; /* number of clusters in use */ + u64 relocations; /* num of clusters to relocate */ + u64 inuse; /* num of clusters in use */ + int multi_ref; /* num of clusters ref'd many times */ }; typedef struct __ntfs_resize_t ntfs_resize_t; @@ -499,10 +500,14 @@ void build_lcn_usage_bitmap(ntfs_resize_t *resize) for (j = 0; j < lcn_length; j++) { u64 k = (u64)lcn + j; - if (ntfs_bit_get_and_set(lcn_bitmap.bm, k, 1)) - err_exit("Cluster %lu referenced twice!\n" - "You didn't shutdown your Windows" - "properly?\n", k); + if (ntfs_bit_get_and_set(lcn_bitmap.bm, k, 1)) { + + if (++resize->multi_ref > 10) + continue; + + printf("Cluster %Lu (0x%Lx) referenced " + "multiply times!\n", k, k); + } } resize->inuse += lcn_length; @@ -603,9 +608,11 @@ void compare_bitmaps(struct bitmap *a) } if (mismatch) { - printf("Totally %d cluster accounting mismatches.\n" - "You didn't shutdown Windows properly?\n", mismatch); - exit(1); + printf("Totally %d cluster accounting mismatches.\n", + mismatch); + err_exit("Filesystem check failed! Windows wasn't shutdown " + "properly or inconsistent\nfilesystem. Please run " + "chkdsk on Windows.\n"); } } @@ -894,10 +901,11 @@ void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) void enlarge_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) { runlist *rl = *rlist; - s64 i, free_zone = 0; + s64 i, j, free_zone = 0; - for (i = 0; i < rl->length; i++) - ntfs_bit_set(lcn_bitmap.bm, rl->lcn + i, 0); + for (i = 0; rl[i].length; i++) + for (j = 0; j < rl[i].length; j++) + ntfs_bit_set(lcn_bitmap.bm, rl[i].lcn + j, 0); free(rl); if (!(rl = *rlist = (runlist *)malloc(2 * sizeof(runlist)))) @@ -952,10 +960,6 @@ void truncate_bitmap_data_attr(ATTR_RECORD *a, s64 nr_clusters) if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) perr_exit("ntfs_mapping_pairs_decompress"); - if (runlist_extent_number(rl) != 1) - err_exit("$Bitmap data has more than one extent, unusual.\n" - "Please report it to linux-ntfs-dev@lists.sf.net"); - if (nr_clusters < vol->nr_clusters) shrink_bitmap_data_attr(&rl, nr_bm_clusters, nr_clusters); else @@ -1334,6 +1338,13 @@ int main(int argc, char **argv) resize.new_volume_size = new_size; walk_inodes(&resize); + if (resize.multi_ref) { + printf("Totally %d clusters referenced multiply times.\n", + resize.multi_ref); + err_exit("Filesystem check failed! Windows wasn't shutdown " + "properly or inconsistent\nfilesystem. Please run " + "chkdsk on Windows.\n"); + } compare_bitmaps(&lcn_bitmap); print_disk_usage(&resize); From 922fea02f52b830d50a83f0308cfc2182397bfcf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Feb 2003 15:21:53 +0000 Subject: [PATCH 0475/2994] ntfsresize update from Szaka: - fix mapping pairs generation with multiply extents - support volume enlargement with multiply extents in $Bitmap - support volume shrinking with multiply extents in $Bitmap - more verbose multiply referenced clusters reporting - better hints when filesystem is inconsistent BKrev: 3e427d91T82d2fBbUZA_XMz8A8EOGA From cf2d62f84a09f6b98062bd87628d8f4c4879f55e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Feb 2003 16:47:06 +0000 Subject: [PATCH 0476/2994] ntfsresize patch from Szaka to allow binary prefixes. (Logical change 1.115) --- ntfsprogs/ntfsresize.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index f15d1fc8..4ebb7fe4 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -258,6 +258,7 @@ s64 get_new_volume_size(char *s) { s64 size; char *suffix; + int prefix_kind = 1000; size = strtoll(s, &suffix, 10); if (size <= 0 || errno == ERANGE) @@ -266,7 +267,9 @@ s64 get_new_volume_size(char *s) if (!*suffix) return size; - if (strlen(suffix) > 1) + if (strlen(suffix) == 2 && suffix[1] == 'i') + prefix_kind = 1024; + else if (strlen(suffix) > 1) usage(); /* We follow the SI prefixes: @@ -284,11 +287,11 @@ s64 get_new_volume_size(char *s) /* FIXME: check for overflow */ switch (*suffix) { case 'G': - size *= 1000; + size *= prefix_kind; case 'M': - size *= 1000; + size *= prefix_kind; case 'k': - size *= 1000; + size *= prefix_kind; break; default: usage(); From f404774ea92119d2ab7dd8551bf745559ca87daf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Feb 2003 16:47:06 +0000 Subject: [PATCH 0477/2994] ntfsresize patch from Szaka to allow binary prefixes. BKrev: 3e42918aJeo35pPMN-WN3E4Wp1qHPA From 73b5b028ca8a7bce00ca774dacb076ca7983707b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Feb 2003 17:03:02 +0000 Subject: [PATCH 0478/2994] ntfsresize patch from Szaka: Cluster account reporting fix (Logical change 1.116) --- ntfsprogs/ntfsresize.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 4ebb7fe4..9b597e7b 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -587,12 +587,13 @@ void compare_bitmaps(struct bitmap *a) } for (k = 0; k < count; k++) { - u64 j; + u64 j, start; if (a->bm[i + k] == bm[k]) continue; - for (j = i * 8; j < i * 8 + 8; j++) { + start = (i + k) * 8; + for (j = start; j < start + 8; j++) { bit = ntfs_bit_get(a->bm, j); if (bit != ntfs_bit_get(bm, k + j % 8)) From 701ff83ee9a53d1d338b47028fa587bb1400318a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Feb 2003 17:03:02 +0000 Subject: [PATCH 0479/2994] ntfsresize patch from Szaka: Cluster account reporting fix BKrev: 3e429546C0JnrbxunDTFkFvW8oyl3Q From 582b8303be73005a8b298dafa11f3edeecb2c105 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 9 Feb 2003 22:55:20 +0000 Subject: [PATCH 0480/2994] endian fix minor tidyup (Logical change 1.117) --- ntfsprogs/utils.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index be9bbe2f..b554e0c8 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -361,14 +361,14 @@ ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) if (!mft) return NULL; - ctx = ntfs_attr_get_search_ctx(NULL, mft); + ctx = ntfs_attr_get_search_ctx (NULL, mft); if (!ctx) { Eprintf ("Couldn't create a search context.\n"); return NULL; } rec = find_attribute (type, ctx); - ntfs_attr_put_search_ctx(ctx); + ntfs_attr_put_search_ctx (ctx); if (rec) Dprintf ("find_first_attribute: found attr of type 0x%02x.\n", type); else @@ -388,7 +388,6 @@ ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) */ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) { - // XXX endian // XXX option: names = posix/win32 or dos // flags: path, filename, or both const int max_path = 20; @@ -430,7 +429,7 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) } name_space = attr->file_name_type; - parent = attr->parent_directory; + parent = le64_to_cpu (attr->parent_directory); if (names[i]) { free (names[i]); From 4a3d5ec325bc01a453c9adc3c27d1a06d3f5b114 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 9 Feb 2003 22:55:20 +0000 Subject: [PATCH 0481/2994] endian fixes (Logical change 1.117) --- ntfsprogs/ntfsinfo.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index cd49b37c..503fef80 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -201,7 +201,7 @@ void ntfs_dump_file_name_attribute(ntfs_inode *inode, MFT_RECORD *mrec) FILE_NAME_ATTR *file_name_attr = NULL; ATTR_RECORD *attr = NULL; ntfs_attr_search_ctx *ctx = NULL; - char *file_name; + char *file_name = NULL; time_t ntfs_time; ctx = ntfs_attr_get_search_ctx(inode, mrec); @@ -215,8 +215,6 @@ void ntfs_dump_file_name_attribute(ntfs_inode *inode, MFT_RECORD *mrec) file_name_attr = (FILE_NAME_ATTR*)((char *)attr + le16_to_cpu(attr->value_offset)); - file_name = malloc(file_name_attr->file_name_length * sizeof(char)); - //need to convert the little endian unicode string to a multibyte string ntfs_ucstombs(file_name_attr->file_name, file_name_attr->file_name_length, &file_name, file_name_attr->file_name_length); @@ -230,16 +228,16 @@ void ntfs_dump_file_name_attribute(ntfs_inode *inode, MFT_RECORD *mrec) printf("Real File Size: \t %lld\n", sle64_to_cpu(file_name_attr->data_size)); //time conversion stuff - ntfs_time = ntfs2utc(file_name_attr->creation_time); + ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->creation_time)); printf("File Creation Time: \t %s",ctime(&ntfs_time)); - ntfs_time = ntfs2utc(file_name_attr->last_data_change_time); + ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_data_change_time)); printf("File Altered Time: \t %s",ctime(&ntfs_time)); - ntfs_time = ntfs2utc(file_name_attr->last_mft_change_time); + ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_mft_change_time)); printf("MFT Changed Time: \t %s",ctime(&ntfs_time)); - ntfs_time = ntfs2utc(file_name_attr->last_access_time); + ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_access_time)); printf("Last Acced Time: \t %s",ctime(&ntfs_time)); free(file_name); @@ -269,11 +267,11 @@ void ntfs_dump_standard_information(ntfs_inode *inode, MFT_RECORD *mrec) printf("Dumping $STANDARD_INFORMATION (0x10)\n"); - printf("Maximum Number of Versions: \t %d \n",standard_attr->maximum_versions); - printf("Version Number: \t\t %d \n",standard_attr->version_number); - printf("Class ID: \t\t\t %d \n",standard_attr->class_id); - printf("User ID: \t\t\t %d \n", standard_attr->owner_id); - printf("Security ID: \t\t\t %d \n", standard_attr->security_id); + printf("Maximum Number of Versions: \t %d \n", le32_to_cpu (standard_attr->maximum_versions)); + printf("Version Number: \t\t %d \n", le32_to_cpu (standard_attr->version_number)); + printf("Class ID: \t\t\t %d \n", le32_to_cpu (standard_attr->class_id)); + printf("User ID: \t\t\t %d \n", le32_to_cpu (standard_attr->owner_id)); + printf("Security ID: \t\t\t %d \n", le32_to_cpu (standard_attr->security_id)); } From d163ebf5966c9d27f23fc9bf8b2d4ab2b60e23d9 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 9 Feb 2003 22:55:20 +0000 Subject: [PATCH 0482/2994] endian fixes minor tidyups BKrev: 3e46dc58ZGDI6pQpaxE-EkCLE4pMow From 3987a55edd01f8cd0e896cf00c08a3e952ef99a0 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 9 Feb 2003 22:55:20 +0000 Subject: [PATCH 0483/2994] minor tidyup (Logical change 1.117) --- ntfsprogs/mkntfs.c | 21 +++++---------------- ntfsprogs/ntfslabel.c | 2 +- ntfsprogs/ntfsundelete.c | 2 -- ntfsprogs/ntfswipe.c | 2 -- ntfsprogs/sd.c | 1 - 5 files changed, 6 insertions(+), 22 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 7b8114e1..dc7e2941 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -232,7 +232,7 @@ void copyright(void) } /** - * license - print licese statement + * license - print license statement */ void license(void) { @@ -1030,7 +1030,8 @@ void deallocate_scattered_clusters(const runlist *rl) } } -/* +/** + * allocate_scattered_clusters * Allocate @clusters and create a runlist of the allocated clusters. * * Return the allocated runlist. Caller has to free the runlist when finished @@ -1041,9 +1042,6 @@ void deallocate_scattered_clusters(const runlist *rl) * TODO: We should be returning the size as well, but for mkntfs this is not * necessary. */ -/** - * allocate_scattered_clusters - */ runlist *allocate_scattered_clusters(s64 clusters) { runlist *rl = NULL, *rlt; @@ -1596,15 +1594,6 @@ err_out: return err; } -/** - * time2ntfs - */ -s64 time2ntfs(s64 time) -{ - return cpu_to_le64((time + (s64)(369 * 365 + 89) * 24 * 3600) - * 10000000); -} - /** * add_attr_std_info * Return 0 on success or -errno on error. @@ -1614,7 +1603,7 @@ int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) STANDARD_INFORMATION si; int err; - si.creation_time = time2ntfs(time(NULL)); + si.creation_time = utc2ntfs(time(NULL)); si.last_data_change_time = si.creation_time; si.last_mft_change_time = si.creation_time; si.last_access_time = si.creation_time; @@ -2384,7 +2373,7 @@ int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, fn->parent_directory = ref_parent; // FIXME: Is this correct? Or do we have to copy the creation_time // from the std info? - fn->creation_time = time2ntfs(time(NULL)); + fn->creation_time = utc2ntfs(time(NULL)); fn->last_data_change_time = fn->creation_time; fn->last_mft_change_time = fn->creation_time; fn->last_access_time = fn->creation_time; diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index bbc806f2..7da52ff1 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -66,7 +66,7 @@ void version (void) printf (" 2002 Matthew J. Fanto\n"); printf (" 2002 Anton Altaparmakov\n"); printf (" 2002-2003 Richard Russon\n"); - printf ("\n%s\n\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 5d5307a5..6df3c606 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -37,7 +36,6 @@ #include #include #include -#include #include #include #include diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 2549d948..194e1c36 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -25,8 +25,6 @@ #include #include -#include -#include #include #include #include diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c index 16115b4e..7db46eff 100644 --- a/ntfsprogs/sd.c +++ b/ntfsprogs/sd.c @@ -26,7 +26,6 @@ * * Do NOT free *@sd_val as it is static memory. This also means that you can * only use *@sd_val until the next call to this function. - * */ void init_system_file_sd(int sys_file_no, char **sd_val, int *sd_val_len) { From a95864329aaae0efb06ec153c5dfc16588734fc5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 10 Feb 2003 12:03:24 +0000 Subject: [PATCH 0484/2994] ntfsresize bugfix from Szaka: - if a corresponding byte differed in the two cluster bitmaps then the matching ones were reported as mismatches and vice versa. (Logical change 1.118) --- ntfsprogs/ntfsresize.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 9b597e7b..9e84733a 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -565,7 +565,7 @@ void walk_attributes(ntfs_resize_t *resize) */ void compare_bitmaps(struct bitmap *a) { - s64 i,count; + s64 i, count; int k, mismatch = 0; char bit; u8 bm[NTFS_BUF_SIZE]; @@ -596,7 +596,7 @@ void compare_bitmaps(struct bitmap *a) for (j = start; j < start + 8; j++) { bit = ntfs_bit_get(a->bm, j); - if (bit != ntfs_bit_get(bm, k + j % 8)) + if (bit == ntfs_bit_get(bm, k + j % 8)) continue; if (++mismatch > 10) @@ -664,7 +664,7 @@ void walk_inodes(ntfs_resize_t *resize) ntfs_inode *ni; struct progress_bar progress; - printf("Scanning volume ...\n"); + printf("Checking filesystem consistency ...\n"); last_mft_rec = vol->nr_mft_records - 1; progress_init(&progress, inode, last_mft_rec, 100); From f109f735c4dd6658988709a42aa4843ba52d2d30 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 10 Feb 2003 12:03:24 +0000 Subject: [PATCH 0485/2994] ntfsresize bugfix from Szaka: - if a corresponding byte differed in the two cluster bitmaps then the matching ones were reported as mismatches and vice versa. BKrev: 3e47950ca5AvDvY3Ck-LLRkTx5c1Cg From 63f4498e3c109c84b2764814ecc97c98d2d6af16 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 12 Feb 2003 16:39:32 +0000 Subject: [PATCH 0486/2994] Update for 1.7.0 release. (Logical change 1.119) --- ChangeLog | 5 +++++ configure | 2 +- configure.in | 2 +- ntfsprogs/Makefile.in | 44 +++++++++++++++++++++---------------------- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index b83cb1cb..d1a696cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +12/02/2003 - 1.7.0 - Small bug fixes and updates. + - Bug fixes in mapping pairs array generation in libntfs. + - Bug fixes and updates in ntfsresize. (Szabolcs Szakacsits) + - Tidyups and standardisations. (Richard Russon) + 18/01/2003 - 1.7.0beta - Library rewrite and many new tools. - Highlights of this release are the now hopefully stable API sported by an almost completely rewritten library and the new utilities; diff --git a/configure b/configure index 60fe1ffa..1ccba2b8 100755 --- a/configure +++ b/configure @@ -966,7 +966,7 @@ fi PACKAGE=ntfsprogs -VERSION=1.7.0beta +VERSION=1.7.0 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; } diff --git a/configure.in b/configure.in index 39ee66ea..3e823ca9 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ fi AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(ntfsprogs,1.7.0beta) +AM_INIT_AUTOMAKE(ntfsprogs,1.7.0) AM_MAINTAINER_MODE diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 59316865..fc189524 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -174,62 +174,62 @@ PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) -I.. LIBS = @LIBS@ ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfsdump_logfile_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -dumplog_OBJECTS = dumplog.$(OBJEXT) -@REALLYSTATIC_TRUE@dumplog_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfsdump_logfile_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +dumplog_OBJECTS = dumplog.$(OBJEXT) @REALLYSTATIC_FALSE@dumplog_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@dumplog_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) \ utils.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfstruncate_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@ntfstruncate_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfscluster_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfstruncate_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_FALSE@ntfscluster_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfsfix_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfscluster_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) @REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfsfix_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ sd.$(OBJEXT) mkntfs.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfslabel_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfslabel_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) From 781e0e9c271df8e7a5ef3f2a5a32f924c7bb954b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 12 Feb 2003 16:39:32 +0000 Subject: [PATCH 0487/2994] Updates for 1.7.0 release. BKrev: 3e4a78c4Kh7nyFQZjySerKp7y6eOAg From 46225e5bdbf0a400c0b4a6d8d3e7c1f380668430 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 13 Feb 2003 09:42:26 +0000 Subject: [PATCH 0488/2994] urgent bug fixes to ntfsresize from Szaka: - compare_bitmaps(): fix another bug reporting the correct cluster mismatch - walk_inodes(): fix leaking ntfs_inode in certain cases - delete redundant and unused MFT_RECORD *mrec from ntfs_resize_t (Logical change 1.120) --- ntfsprogs/ntfsresize.c | 43 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 9e84733a..ea394897 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -93,7 +93,6 @@ struct progress_bar { struct __ntfs_resize_t { s64 new_volume_size; ntfs_inode *ni; /* inode being processed */ - MFT_RECORD *mrec; /* MFT buffer being processed */ ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ u64 relocations; /* num of clusters to relocate */ u64 inuse; /* num of clusters in use */ @@ -565,50 +564,47 @@ void walk_attributes(ntfs_resize_t *resize) */ void compare_bitmaps(struct bitmap *a) { - s64 i, count; - int k, mismatch = 0; - char bit; + s64 i, pos, count; + int mismatch = 0; u8 bm[NTFS_BUF_SIZE]; printf("Accounting clusters ...\n"); - i = 0; + pos = 0; while (1) { - count = ntfs_attr_pread(vol->lcnbmp_na, i, NTFS_BUF_SIZE, bm); + count = ntfs_attr_pread(vol->lcnbmp_na, pos, NTFS_BUF_SIZE, bm); if (count == -1) perr_exit("Couldn't get $Bitmap $DATA"); if (count == 0) { - if (a->size != i) + if (a->size != pos) err_exit("$Bitmap file size doesn't match " "calculated size ((%Ld != %Ld)\n", - a->size, i); + a->size, pos); break; } - for (k = 0; k < count; k++) { - u64 j, start; + for (i = 0; i < count; i++, pos++) { + u64 cl; /* current cluster */ - if (a->bm[i + k] == bm[k]) + if (a->bm[pos] == bm[i]) continue; - start = (i + k) * 8; - for (j = start; j < start + 8; j++) { + for (cl = pos * 8; cl < (pos + 1) * 8; cl++) { + char bit; - bit = ntfs_bit_get(a->bm, j); - if (bit == ntfs_bit_get(bm, k + j % 8)) + bit = ntfs_bit_get(a->bm, cl); + if (bit == ntfs_bit_get(bm, i * 8 + cl % 8)) continue; if (++mismatch > 10) continue; - printf("Cluster accounting failed at %llu " + printf("Cluster accounting failed at %Lu " "(0x%Lx): %s cluster in $Bitmap\n", - j, j, bit ? "missing" : "extra"); + cl, cl, bit ? "missing" : "extra"); } } - - i += count; } if (mismatch) { @@ -681,17 +677,16 @@ void walk_inodes(ntfs_resize_t *resize) } if (!(ni->mrec->flags & MFT_RECORD_IN_USE)) - continue; + goto close_inode; if ((ni->mrec->base_mft_record) != 0) - continue; + goto close_inode; resize->ni = ni; - resize->mrec = ni->mrec; walk_attributes(resize); - +close_inode: if (ntfs_inode_close(ni)) - perr_exit("ntfs_inode_close for inode %lld", inode); + perr_exit("ntfs_inode_close for inode %Ld", inode); } } From fb6a425cad7f78471d16425d94f64fb14739b1f2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 13 Feb 2003 09:42:26 +0000 Subject: [PATCH 0489/2994] urgent bug fixes to ntfsresize from Szaka: - compare_bitmaps(): fix another bug reporting the correct cluster mismatch - walk_inodes(): fix leaking ntfs_inode in certain cases - delete redundant and unused MFT_RECORD *mrec from ntfs_resize_t BKrev: 3e4b6882jdyeekJZqcOJWiT27L9FVA From 8813a2c2aa8ff4b91224dd8d25e51f158b23d32e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 13 Feb 2003 10:27:33 +0000 Subject: [PATCH 0490/2994] 1.7.1 release: Urgent bug fixes! - Urgent bug fixes in libntfs (thanks to Szaka for bug reports): - attrib.c::ntfs_external_attr_find(): broken error detection - mft.c::ntfs_mft_records_write(): stupid buffer overflow bug (ouch!) BKrev: 3e4b7315moUIEYyeChY_JUZ-0X5mzg From 4d9974e9790e69ee4e8bbd4db9ef033a10e91957 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 13 Feb 2003 10:27:33 +0000 Subject: [PATCH 0491/2994] Update for (Logical change 1.121) --- ChangeLog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index d1a696cf..8d2d3565 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +13/02/2003 - 1.7.1 - Urgent bug fixes. + - Urgent bug fixes in ntfsresize (Szabolcs Szakacsits): + - compare_bitmaps(): fix another bug reporting the correct cluster + mismatch + - walk_inodes(): fix leaking ntfs_inode in certain cases + - delete redundant and unused MFT_RECORD *mrec from ntfs_resize_t + - Urgent bug fixes in libntfs (thanks to Szaka for bug reports): + - attrib.c::ntfs_external_attr_find(): broken error detection + - mft.c::ntfs_mft_records_write(): stupid buffer overflow bug (ouch!) + 12/02/2003 - 1.7.0 - Small bug fixes and updates. - Bug fixes in mapping pairs array generation in libntfs. - Bug fixes and updates in ntfsresize. (Szabolcs Szakacsits) From bddf42cd8b10800329787dc8bc0604a89a635141 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 13 Feb 2003 10:27:33 +0000 Subject: [PATCH 0492/2994] Update version (Logical change 1.121) --- configure | 2 +- configure.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 1ccba2b8..f8031e48 100755 --- a/configure +++ b/configure @@ -966,7 +966,7 @@ fi PACKAGE=ntfsprogs -VERSION=1.7.0 +VERSION=1.7.1 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; } diff --git a/configure.in b/configure.in index 3e823ca9..7a5d29bf 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ fi AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(ntfsprogs,1.7.0) +AM_INIT_AUTOMAKE(ntfsprogs,1.7.1) AM_MAINTAINER_MODE From 7103d67341e92ecdf7da21be7b96271d6d27f8f2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 13 Feb 2003 10:27:33 +0000 Subject: [PATCH 0493/2994] ntfs_external_attr_find(): broken error detection (Logical change 1.121) --- libntfs/attrib.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 1b5f6057..ae3404bb 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1518,7 +1518,7 @@ find_attr_list_attr: return 0; /* Error! If other than not found return it. */ - if (errno != EINVAL) + if (errno != ENOENT) return rc; /* Not found?!? Absurd! Must be a bug... )-: */ @@ -2092,6 +2092,13 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, return 0; } +static int ntfs_attr_make_non_resident(ntfs_attr *na, + ntfs_attr_search_ctx *ctx) +{ + errno = ENOTSUP; + return -1; +} + /** * ntfs_resident_attr_resize - resize a resident, open ntfs attribute * @na: resident ntfs attribute to resize @@ -2172,7 +2179,26 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) /* Attribute is not allowed to be non-resident. */ } else { /* Make the attribute non-resident. */ - // TODO: do it! + if (ntfs_attr_make_non_resident(na, ctx) < 0) { + if (errno != ENOSPC) { + err = errno; + // FIXME: Eeek! + if (err != ENOTSUP) + fprintf(stderr, "%s(): Eeek! Failed " + "to make attribute " + "non-resident. " + "Aborting...\n", + __FUNCTION__); + goto put_err_out; + } + /* Not enough space to do that. */ + // TODO: Try to make other attributes non-resident! + // TODO: Move it to a new mft record and perhaps make + // it non-resident at same time. + } else { + /* Attribute is now non-resident. */ + // TODO: Resize it! + } } // - make other attributes non-resident to free up enough space From b42dc41d6a75a43b04673c95b17c11138a6be818 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 13 Feb 2003 10:27:33 +0000 Subject: [PATCH 0494/2994] ntfs_mft_records_write(): stupid buffer overflow bug (ouch!) (Logical change 1.121) --- libntfs/mft.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libntfs/mft.c b/libntfs/mft.c index 28f2646e..aedef1b9 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -1,7 +1,7 @@ /* * mft.c - Mft record handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -119,6 +119,8 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, m = MREF(mref); if (m < vol->mftmirr_size) { cnt = vol->mftmirr_size - m; + if (cnt > count) + cnt = count; bmirr = malloc(cnt * vol->mft_record_size); if (!bmirr) return -1; From 8314ab1f9d33071ba26ba3366a015c33838474b8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 18 Feb 2003 21:40:26 +0000 Subject: [PATCH 0495/2994] Endian fix and attribute resize code cleanup. (Logical change 1.122) --- libntfs/attrib.c | 131 +++++++++++++++++++++++++++++------------------ 1 file changed, 80 insertions(+), 51 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index ae3404bb..46419f05 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1937,7 +1937,7 @@ ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol, for (ad = vol->attrdef; (u8*)ad - (u8*)vol->attrdef < vol->attrdef_len && ad->type; ++ad) { /* We haven't found it yet, carry on searching. */ - if (ad->type < type) + if (le32_to_cpu(ad->type) < le32_to_cpu(type)) continue; /* We found the attribute; return it. */ if (ad->type == type) @@ -2151,12 +2151,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) */ if (newsize < vol->mft_record_size) { /* Perform the resize of the attribute record. */ - if (ntfs_resident_attr_value_resize(ctx->mrec, ctx->attr, + if (!ntfs_resident_attr_value_resize(ctx->mrec, ctx->attr, newsize)) { - err = errno; - if (err != ENOSPC) - goto put_err_out; - } else { /* Update the ntfs attribute structure, too. */ na->allocated_size = na->data_size = na->initialized_size = newsize; @@ -2164,51 +2160,62 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) na->compressed_size = newsize; goto resize_done; } + /* Error! If not enough space, just continue. */ + if (errno != ENOSPC) { + err = errno; + // FIXME: Eeek! + if (err != ENOTSUP) + fprintf(stderr, "%s(): Eeek! Failed to resize " + "resident part of attribute. " + "Aborting...\n", __FUNCTION__); + goto put_err_out; + } } /* There is not enough space in the mft record to perform the resize. */ - // FIXME: Need to try to: - /* Check if the attribute is allowed to be non-resident. */ - if (ntfs_attr_can_be_non_resident(vol, na->type) < 0) { - /* If an error occured, abort. */ + if (!ntfs_attr_can_be_non_resident(vol, na->type)) { + /* Make the attribute non-resident. */ + if (!ntfs_attr_make_non_resident(na, ctx)) { + // TODO: Attribute is now non-resident. Resize it! + // goto resize_done; + fprintf(stderr, "%s(): TODO: Resize attribute now that " + "it is non-resident.\n", __FUNCTION__); + err = ENOTSUP; + goto put_err_out; + } + /* Error! If not enough space, just continue. */ + if (errno != ENOSPC) { + err = errno; + // FIXME: Eeek! + if (err != ENOTSUP) + fprintf(stderr, "%s(): Eeek! Failed to make " + "attribute non-resident. " + "Aborting...\n", __FUNCTION__); + goto put_err_out; + } + } else { + /* + * If the attribute can be non-resident but an error occured + * while making it non-resident, abort. + */ if (errno != EPERM) { err = errno; goto put_err_out; } /* Attribute is not allowed to be non-resident. */ - } else { - /* Make the attribute non-resident. */ - if (ntfs_attr_make_non_resident(na, ctx) < 0) { - if (errno != ENOSPC) { - err = errno; - // FIXME: Eeek! - if (err != ENOTSUP) - fprintf(stderr, "%s(): Eeek! Failed " - "to make attribute " - "non-resident. " - "Aborting...\n", - __FUNCTION__); - goto put_err_out; - } - /* Not enough space to do that. */ - // TODO: Try to make other attributes non-resident! - // TODO: Move it to a new mft record and perhaps make - // it non-resident at same time. - } else { - /* Attribute is now non-resident. */ - // TODO: Resize it! - } } - // - make other attributes non-resident to free up enough space - // - move the attribute to a new mft record + // TODO: Try to make other attributes non-resident. + // TODO: Move the attribute to a new mft record. + // Note that some of the above changes also require changes in the // attribute list attribute (or even creation thereof) hence take // care!!! Probably want to try to do things in the same order as // above. Also take care that $MFT/$BITMAP _must_ be non-resident or // windows ntfs driver causes a blue screen of death on mount attempt, // i.e. usually at boot time which renders the machine not bootable. + err = ENOTSUP; goto put_err_out; @@ -2227,6 +2234,25 @@ put_err_out: return -1; } +static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) +{ + // FIXME: For now we cheat and assume there is no attribute list + // present. (AIA) + if (NInoAttrList(na->ni)) { + errno = ENOTSUP; + return -1; + } + + /* Make sure this is not $MFT/$BITMAP or Windows will not boot! */ + if (na->type == AT_BITMAP && na->ni->mft_no == FILE_MFT) { + errno = EPERM; + return -1; + } + + errno = ENOTSUP; + return -1; +} + /** * ntfs_non_resident_attr_shrink - shrink a non-resident, open ntfs attribute * @na: non-resident ntfs attribute to shrink @@ -2330,9 +2356,6 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) // are in the base inode only and hence it is all easier, even // if we are cheating for now... (AIA) - // FIXME: When @newsize is zero, should convert the attribute to a - // resident attribute. - /* The first cluster outside the new allocation. */ first_free_vcn = (newsize + vol->cluster_size - 1) >> vol->cluster_size_bits; @@ -2356,19 +2379,25 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) * resident attribute. */ if (!newsize) { - // TODO: Perform the conversion! (AIA) - - /* Update the ntfs attribute structure accordingly. */ -/* - na->allocated_size = na->data_size = - na->initialized_size = newsize; - if (NAttrCompressed(na) || NAttrSparse(na)) - na->compressed_size = newsize; - NAttrClearNonResident(na); - free(na->rl); - na->rl = NULL; - goto done; -*/ + if (!ntfs_attr_make_resident(na, ctx)) { + /* + * Attribute is now resident. Update the ntfs + * attribute structure accordingly. + */ + na->allocated_size = na->data_size = + na->initialized_size = newsize; + if (NAttrCompressed(na) || NAttrSparse(na)) + na->compressed_size = newsize; + NAttrClearNonResident(na); + free(na->rl); + na->rl = NULL; + goto done; + } + /* If couldn't make resident, just continue. */ + if (errno != EPERM) + Dprintf("%s(): Conversion of attribute to " + "resident failed. Leaving as " + "is...\n", __FUNCTION__); } /* Truncate the runlist itself. */ if (ntfs_rl_truncate(&na->rl, first_free_vcn)) { @@ -2485,7 +2514,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) na->initialized_size = newsize; a->initialized_size = scpu_to_le64(newsize); } -//done: +done: /* Set the inode dirty so it is written out later. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); /* Done! */ From df6d1a2ca9ccd65018ecde72ec5b5b97cd07a797 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 18 Feb 2003 21:40:26 +0000 Subject: [PATCH 0496/2994] libntfs/attrib.c: Endian fix and attribute resize code cleanup. BKrev: 3e52a84axp6pptEAlMMf9avQCc7uNg From 791a3fa5a343384481e6affb37114806358efd5e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 20 Feb 2003 11:19:58 +0000 Subject: [PATCH 0497/2994] Update changelog for development release. (Logical change 1.123) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8d2d3565..983c0ee9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +xx/xx/2003 - 1.7.2-WIP - Work in progress. + - Further work on attribute resizing. + 13/02/2003 - 1.7.1 - Urgent bug fixes. - Urgent bug fixes in ntfsresize (Szabolcs Szakacsits): - compare_bitmaps(): fix another bug reporting the correct cluster From 114478185eafc4aef932605929c019731b3fbf34 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 20 Feb 2003 11:19:58 +0000 Subject: [PATCH 0498/2994] Update version (Logical change 1.123) --- configure | 2 +- configure.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index f8031e48..4280a74b 100755 --- a/configure +++ b/configure @@ -966,7 +966,7 @@ fi PACKAGE=ntfsprogs -VERSION=1.7.1 +VERSION=1.7.2-WIP 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; } diff --git a/configure.in b/configure.in index 7a5d29bf..1c2aaa4b 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ fi AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(ntfsprogs,1.7.1) +AM_INIT_AUTOMAKE(ntfsprogs,1.7.2-WIP) AM_MAINTAINER_MODE From c28402cc41ad5ce098d7d4ebc8073c78958e91d3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 20 Feb 2003 11:19:58 +0000 Subject: [PATCH 0499/2994] Update version to 1.7.2-WIP to show it is work in progress. BKrev: 3e54b9deB5qe1jzFWpJ2pxr5dFcf0A From 1247d0e2ea8950fdf25a99c4fd62381e0425d153 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 25 Feb 2003 18:57:15 +0000 Subject: [PATCH 0500/2994] More work on attribute resizing... (Logical change 1.124) --- libntfs/attrib.c | 302 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 270 insertions(+), 32 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 46419f05..e42b72f9 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2005,22 +2005,73 @@ int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type) { ATTR_DEF *ad; + /* + * $DATA is always allowed to be non-resident even if $AttrDef does not + * specify this in the flags of the $DATA attribute definition record. + */ + if (type == AT_DATA) + return 0; + /* Find the attribute definition record in $AttrDef. */ ad = ntfs_attr_find_in_attrdef(vol, type); if (!ad) return -1; + /* Check the flags and return the result. */ if (ad->flags & CAN_BE_NON_RESIDENT) return 0; errno = EPERM; return -1; } +/** + * ntfs_attr_record_resize - resize an attribute record + * @m: mft record containing attribute record + * @a: attribute record to resize + * @new_size: new size in bytes to which to resize the attribute record @a + * + * Resize the attribute record @a, i.e. the resident part of the attribute, in + * the mft record @m to @new_size bytes. + * + * Return 0 on success and -1 on error with errno set to the error code. + * The following error codes are defined: + * ENOSPC - Not enough space in the mft record @m to perform the resize. + * Note that on error no modifications have been performed whatsoever. + * + * Warning: If you make a record smaller without having copied all the data you + * are interested in the data may be overwritten! + */ +static int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) +{ + /* Align to 8 bytes, just in case the caller hasn't. */ + new_size = (new_size + 7) & ~7; + + /* If the actual attribute length has changed, move things around. */ + if (new_size != le32_to_cpu(a->length)) { + u32 new_muse = le32_to_cpu(m->bytes_in_use) - + le32_to_cpu(a->length) + new_size; + /* Not enough space in this mft record. */ + if (new_muse > le32_to_cpu(m->bytes_allocated)) { + errno = ENOSPC; + return -1; + } + /* Move attributes following @a to their new location. */ + memmove((u8*)a + new_size, (u8*)a + le32_to_cpu(a->length), + le32_to_cpu(m->bytes_in_use) - ((u8*)a - + (u8*)m) - le32_to_cpu(a->length)); + /* Adjust @m to reflect the change in used space. */ + m->bytes_in_use = cpu_to_le32(new_muse); + /* Adjust @a to reflect the new size. */ + a->length = cpu_to_le32(new_size); + } + return 0; +} + /** * ntfs_resident_attr_value_resize - resize the value of a resident attribute * @m: mft record containing attribute record * @a: attribute record whose value to resize - * @newsize: new size in bytes to which to resize the attribute value of @a + * @new_size: new size in bytes to which to resize the attribute value of @a * - * Resize the value of the attribute @a in the mft record @m to @newsize bytes. + * Resize the value of the attribute @a in the mft record @m to @new_size bytes. * If the value is made bigger, the newly "allocated" space is cleared. * * Return 0 on success and -1 on error with errno set to the error code. @@ -2029,10 +2080,8 @@ int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type) * Note that on error no modifications have been performed whatsoever. */ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, - const u32 newsize) + const u32 new_size) { - u32 new_alen, new_muse; - /* * Check that the attribute name hasn't been placed after the * attribute value/mapping pairs array. If it has we need to move it. @@ -2060,42 +2109,231 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, return -1; } } - /* Calculate the new attribute length and mft record bytes used. */ - new_alen = (le16_to_cpu(a->value_offset) + newsize + 7) & ~7; - /* If the actual attribute length has changed, move things around. */ - if (new_alen != le32_to_cpu(a->length)) { - new_muse = le32_to_cpu(m->bytes_in_use) - - le32_to_cpu(a->length) + new_alen; - /* Not enough space in this mft record. */ - if (new_muse > le32_to_cpu(m->bytes_allocated)) { - errno = ENOSPC; - return -1; + /* Resize the resident part of the attribute record. */ + if (ntfs_attr_record_resize(m, a, (le16_to_cpu(a->value_offset) + + new_size + 7) & ~7) < 0) { + if (errno != ENOSPC) { + int eo = errno; + + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Attribute record resize " + "failed. Aborting...\n", __FUNCTION__); + errno = eo; } - /* Move attributes following @a to their new location. */ - memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu(a->length), - le32_to_cpu(m->bytes_in_use) - ((u8*)a - - (u8*)m) - le32_to_cpu(a->length)); - /* Adjust @m to reflect the change in used space. */ - m->bytes_in_use = cpu_to_le32(new_muse); - /* Adjust @a to reflect the new value size. */ - a->length = cpu_to_le32(new_alen); + return -1; } /* * If we made the attribute value bigger, clear the area between the - * old size and @newsize. + * old size and @new_size. */ - if (newsize > le32_to_cpu(a->value_length)) + if (new_size > le32_to_cpu(a->value_length)) memset((u8*)a + le16_to_cpu(a->value_offset) + - le32_to_cpu(a->value_length), 0, newsize - + le32_to_cpu(a->value_length), 0, new_size - le32_to_cpu(a->value_length)); - a->value_length = cpu_to_le32(newsize); + /* Finally update the length of the attribute value. */ + a->value_length = cpu_to_le32(new_size); return 0; } +/** + * ntfs_attr_make_non_resident - convert a resident to a non-resident attribute + * @na: open ntfs attribute to make non-resident + * @ctx: ntfs search context describing the attribute + * + * Convert a resident ntfs attribute to a non-resident one. + * + * Return 0 on success and -1 on error with errno set to the error code. + * + * NOTE to self: No changes in the attribute list are required to move from + * a resident to a non-resident attribute. + * + * Warning: We do not set the inode dirty and we do not write out anything! + * We expect the caller to do this as this is a fairly low level + * function and it is likely there will be further changes made. + */ static int ntfs_attr_make_non_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) { - errno = ENOTSUP; + s64 new_allocated_size, bw; + ntfs_volume *vol = na->ni->vol; + ATTR_REC *a = ctx->attr; + runlist *rl; + int mp_size, mp_ofs, name_ofs, arec_size, err; + + /* Some preliminary sanity checking. */ + if (NAttrNonResident(na)) { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Trying to make non-resident " + "attribute non-resident. Aborting...\n", + __FUNCTION__); + errno = EINVAL; + return -1; + } + /* + * Check that the attribute name hasn't been placed after the + * attribute value. If it has we need to move it. + * TODO: Implement the move. For now just abort. (AIA) + */ + if (a->name_length && le16_to_cpu(a->name_offset) >= + le16_to_cpu(a->value_offset)) { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Name is placed after the " + "attribute value. Aborting...\n", __FUNCTION__); + errno = ENOTSUP; + return -1; + } + + new_allocated_size = (le32_to_cpu(a->value_length) + vol->cluster_size + - 1) & ~(vol->cluster_size - 1); + + /* Start by allocating clusters to hold the attribute value. */ + rl = ntfs_cluster_alloc(vol, new_allocated_size >> + vol->cluster_size_bits, -1, DATA_ZONE); + if (!rl) { + if (errno != ENOSPC) { + int eo = errno; + + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Failed to allocate " + "cluster(s). Aborting...\n", + __FUNCTION__); + errno = eo; + } + return -1; + } + + /* + * Setup the in-memory attribute structure to be non-resident so that + * we can use ntfs_attr_pwrite(). + */ + NAttrSetNonResident(na); + na->rl = rl; + na->allocated_size = new_allocated_size; + na->data_size = na->initialized_size = le32_to_cpu(a->value_length); + /* + * For now just clear all of these as we don't support them when + * writing. + */ + NAttrClearCompressed(na); + NAttrClearSparse(na); + NAttrClearEncrypted(na); + + /* Now copy the attribute value to the allocated cluster(s). */ + bw = ntfs_attr_pwrite(na, 0, le32_to_cpu(a->value_length), + (u8*)a + le16_to_cpu(a->value_offset)); + if (bw != le32_to_cpu(a->value_length)) { + err = errno; + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Failed to write out attribute " + "value (bw = %Li, errno = %i). Aborting...\n", + __FUNCTION__, (long long)bw, err); + if (bw >= 0) + err = EIO; + goto cluster_free_err_out; + } + + /* Determine the size of the mapping pairs array. */ + mp_size = ntfs_get_size_for_mapping_pairs(vol, rl); + if (mp_size < 0) { + err = errno; + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Failed to get size for mapping " + "pairs array. Aborting...\n", __FUNCTION__); + goto cluster_free_err_out; + } + + /* Calculate new offsets for the name and the mapping pairs array. */ + name_ofs = (sizeof(ATTR_REC) - sizeof(a->compressed_size) + 7) & ~7; + mp_ofs = (name_ofs + a->name_length + 7) & ~7; + + /* + * Determine the size of the resident part of the non-resident + * attribute record. (Not compressed thus no compressed_size element + * present.) + */ + arec_size = (mp_ofs + mp_size + 7) & ~7; + + /* Sanity check. */ + if (a->name_length && (le16_to_cpu(a->name_offset) + a->name_length > + arec_size)) { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Name exceeds new record size! " + "Not supported. Aborting...\n", __FUNCTION__); + err = ENOTSUP; + goto cluster_free_err_out; + } + + /* Resize the resident part of the attribute record. */ + if (ntfs_attr_record_resize(ctx->mrec, a, arec_size) < 0) { + err = errno; + if (err != ENOSPC) { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Failed to resize " + "attribute record. Aborting...\n", + __FUNCTION__); + } + goto cluster_free_err_out; + } + + /* + * Convert the resident part of the attribute record to describe a + * non-resident attribute. + */ + a->non_resident = 1; + + /* Move the attribute name if it exists and update the offset. */ + if (a->name_length) + memmove((u8*)a + name_ofs, (u8*)a + le16_to_cpu(a->name_offset), + a->name_length * sizeof(uchar_t)); + a->name_offset = cpu_to_le16(name_ofs); + + /* Update the flags to match the in-memory ones. */ + a->flags &= ~(ATTR_IS_SPARSE | ATTR_IS_ENCRYPTED | + ATTR_COMPRESSION_MASK); + + /* Setup the fields specific to non-resident attributes. */ + a->lowest_vcn = scpu_to_le64(0); + if (na->data_size != 0) + a->highest_vcn = scpu_to_le64(0); + else + a->highest_vcn = scpu_to_le64(-1); + + a->mapping_pairs_offset = cpu_to_le16(mp_ofs); + + a->compression_unit = 0; + + memset(&a->reserved1, 0, sizeof(a->reserved1)); + + a->allocated_size = scpu_to_le64(new_allocated_size); + a->data_size = a->initialized_size = scpu_to_le64(na->data_size); + + /* Generate the mapping pairs array in the attribute record. */ + if (ntfs_mapping_pairs_build(vol, (u8*)a + mp_ofs, arec_size - mp_ofs, + rl) < 0) { + err = errno; + // FIXME: Eeek! We need rollback! (AIA) + fprintf(stderr, "%s(): Eeek! Failed to build mapping pairs. " + "Leaving corrupt attribute record on disk. " + "In memory runlist is still intact! Error " + "code is %i. FIXME: Need to rollback " + "instead!\n", __FUNCTION__, err); + errno = err; + return -1; + } + + /* Done! */ + return 0; + +cluster_free_err_out: + if (ntfs_cluster_free(vol, na, 0, -1) < 0) + fprintf(stderr, "%s(): Eeek! Failed to release allocated " + "clusters in error code path. Leaving " + "inconsistent metadata...\n", __FUNCTION__); + NAttrClearNonResident(na); + na->allocated_size = na->data_size; + na->rl = NULL; + free(rl); + errno = err; return -1; } @@ -2181,6 +2419,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) // goto resize_done; fprintf(stderr, "%s(): TODO: Resize attribute now that " "it is non-resident.\n", __FUNCTION__); + ntfs_inode_mark_dirty(ctx->ntfs_ino); err = ENOTSUP; goto put_err_out; } @@ -2188,10 +2427,9 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) if (errno != ENOSPC) { err = errno; // FIXME: Eeek! - if (err != ENOTSUP) - fprintf(stderr, "%s(): Eeek! Failed to make " - "attribute non-resident. " - "Aborting...\n", __FUNCTION__); + fprintf(stderr, "%s(): Eeek! Failed to make attribute " + "non-resident. Aborting...\n", + __FUNCTION__); goto put_err_out; } } else { From 13d37ddb070ec328612ec240ec0d2f50c436384e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 25 Feb 2003 18:57:15 +0000 Subject: [PATCH 0501/2994] More work on attribute resizing... BKrev: 3e5bbc8bGDlvnZ20woLu4MtNQs34jw From fb7a94516e7cab4efdf93e9a528529322b556797 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 25 Feb 2003 18:57:15 +0000 Subject: [PATCH 0502/2994] Typo fix... (Logical change 1.124) --- libntfs/lcnalloc.c | 2 +- ntfsprogs/ntfstruncate.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index b4d3ff2f..07fc28b6 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -102,7 +102,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, u8 pass, done_zones, search_zone, need_writeback, bit; Dprintf("%s(): Entering with count = 0x%Lx, start_lcn = 0x%Lx, - zone = %s_ZONE.\n", (long long)count, + zone = %s_ZONE.\n", __FUNCTION__, (long long)count, (long long)start_lcn, zone == MFT_ZONE ? "MFT" : "DATA"); if (!vol || count < 0 || start_lcn < -1 || !vol->lcnbmp_na || diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 0c9a407f..409f17a7 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -170,8 +170,8 @@ void usage(void) __attribute__ ((noreturn)); void usage (void) { copyright(); - fprintf(stderr, "Usage: %s [options] device [attr-type [attr-name]] " - "new-length\n" + fprintf(stderr, "Usage: %s [options] device inode [attr-type " + "[attr-name]] new-length\n" " If attr-type is not specified, 0x80 (i.e. $DATA) " "is assumed.\n" " If attr-name is not specified, an unnamed " From 0a0b02761178d23a335339b13a371b18b4663ce0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 7 Mar 2003 17:31:47 +0000 Subject: [PATCH 0503/2994] Fix logic inversion bugs in dir.c. Thanks to Russ Christensen for finding the first one. BKrev: 3e68d783DHUtY9ak186V1CIk_XY5pA From 20c360bdf1ebca68221903316391c3e401ef17bb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 7 Mar 2003 17:31:47 +0000 Subject: [PATCH 0504/2994] Fix logic inversion bugs. Thanks to Russ Christensen for finding the first one. (Logical change 1.125) --- libntfs/dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/dir.c b/libntfs/dir.c index b7d94263..443322b5 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -89,7 +89,7 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const uchar_t *uname, return -1; /* Find the index root attribute in the mft record. */ - if (!ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, + if (ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 0, ctx)) { Dprintf("Index root attribute missing in directory inode " "0x%Lx: %s\n", @@ -671,7 +671,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, /* Get the offset into the index root attribute. */ ir_pos = (int)*pos; /* Find the index root attribute in the mft record. */ - if (!ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, + if (ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 0, ctx)) { Dprintf("Index root attribute missing in directory inode " "0x%Lx.\n", (unsigned long long)dir_ni->mft_no); From 565f90e5e6ec2da7fa5aaed3b4fa0b4773db9e58 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 7 Mar 2003 17:31:47 +0000 Subject: [PATCH 0505/2994] update (Logical change 1.125) --- ChangeLog | 2 ++ libntfs/attrib.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 983c0ee9..71181c0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ xx/xx/2003 - 1.7.2-WIP - Work in progress. - Further work on attribute resizing. + - Fix two logic inversion bugs in dir.c. Thanks to Russ Christensen for + finding the first one. 13/02/2003 - 1.7.1 - Urgent bug fixes. - Urgent bug fixes in ntfsresize (Szabolcs Szakacsits): diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e42b72f9..249b783f 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2441,7 +2441,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) err = errno; goto put_err_out; } - /* Attribute is not allowed to be non-resident. */ + /* Attribute is not allowed to be non-resident, continue. */ } // TODO: Try to make other attributes non-resident. From 726999e6914a43163ba6fefaf56e0a2e4e325a0c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 11 Mar 2003 00:06:21 +0000 Subject: [PATCH 0506/2994] More work on attribute resizing. (Logical change 1.126) --- libntfs/attrib.c | 60 +++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 249b783f..386376fd 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2445,14 +2445,9 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) } // TODO: Try to make other attributes non-resident. - // TODO: Move the attribute to a new mft record. - // Note that some of the above changes also require changes in the - // attribute list attribute (or even creation thereof) hence take - // care!!! Probably want to try to do things in the same order as - // above. Also take care that $MFT/$BITMAP _must_ be non-resident or - // windows ntfs driver causes a blue screen of death on mount attempt, - // i.e. usually at boot time which renders the machine not bootable. + // TODO: Move the attribute to a new mft record, creating an attribute + // list attribute or modifying it if it is already present. err = ENOTSUP; goto put_err_out; @@ -2489,6 +2484,9 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) errno = ENOTSUP; return -1; + + //NAttrClearNonResident(na); + //return 0; } /** @@ -2612,31 +2610,6 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) "failed. Aborting...\n", __FUNCTION__); goto put_err_out; } - /* - * If the attribute now has zero size, need to convert it to a - * resident attribute. - */ - if (!newsize) { - if (!ntfs_attr_make_resident(na, ctx)) { - /* - * Attribute is now resident. Update the ntfs - * attribute structure accordingly. - */ - na->allocated_size = na->data_size = - na->initialized_size = newsize; - if (NAttrCompressed(na) || NAttrSparse(na)) - na->compressed_size = newsize; - NAttrClearNonResident(na); - free(na->rl); - na->rl = NULL; - goto done; - } - /* If couldn't make resident, just continue. */ - if (errno != EPERM) - Dprintf("%s(): Conversion of attribute to " - "resident failed. Leaving as " - "is...\n", __FUNCTION__); - } /* Truncate the runlist itself. */ if (ntfs_rl_truncate(&na->rl, first_free_vcn)) { err = errno; @@ -2649,11 +2622,21 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) /* Update the attribute record and the ntfs_attr structure. */ na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = scpu_to_le64(na->allocated_size); - if (NAttrSparse(na)) { + if (NAttrCompressed(na) || NAttrSparse(na)) { na->compressed_size -= nr_freed_clusters << vol->cluster_size_bits; + // FIXME: Bug catcher. Remove later... (AIA) + if (!newsize && na->compressed_size) { + fprintf(stderr, "%s(): Eeek! !newsize but " + "na->compressed_size not zero " + "(= %Li)! Fixing up by hand!\n", + __FUNCTION__, (long long) + na->compressed_size); + na->compressed_size = 0; + } a->compressed_size = scpu_to_le64(na->compressed_size); + // FIXME: Bug catcher. Remove later... (AIA) if (na->compressed_size < 0) { // FIXME: Eeek! BUG! fprintf(stderr, "%s(): Eeek! Compressed size " @@ -2752,7 +2735,16 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) na->initialized_size = newsize; a->initialized_size = scpu_to_le64(newsize); } -done: + /* If the attribute now has zero size, make it resident. */ + if (!newsize) { + if (ntfs_attr_make_resident(na, ctx)) { + /* If couldn't make resident, just continue. */ + if (errno != EPERM) + Dprintf("%s(): Failed to make attribute " + "resident. Leaving as is...\n", + __FUNCTION__); + } + } /* Set the inode dirty so it is written out later. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); /* Done! */ From 6f221ba794d05d492a52fdf98d06503f929a3b66 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 11 Mar 2003 00:06:21 +0000 Subject: [PATCH 0507/2994] More work on attribute resizing. BKrev: 3e6d287dUyv6h8hddUCIKrL3VcYDYQ From 7e14335b3f6e7e8992004c9c5279a893b3fb39d4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 Mar 2003 00:48:50 +0000 Subject: [PATCH 0508/2994] Fix attempt to release I30 constant. (Logical change 1.127) --- libntfs/attrib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 386376fd..35c48ce0 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -38,6 +38,7 @@ #include "inode.h" #include "runlist.h" #include "lcnalloc.h" +#include "dir.h" uchar_t AT_UNNAMED[] = { const_cpu_to_le16('\0') }; @@ -383,7 +384,8 @@ void ntfs_attr_close(ntfs_attr *na) { if (NAttrNonResident(na) && na->rl) free(na->rl); - if (na->name != AT_UNNAMED) + /* Don't release if using an internal constant. */ + if (na->name != AT_UNNAMED && na->name != I30) free(na->name); free(na); return; From abe29900699a330f8899dff848ac4219c16e64c6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 Mar 2003 00:48:50 +0000 Subject: [PATCH 0509/2994] Fix attempt to release I30 constant. BKrev: 3e7126f2xSoI4tCByjRmVQy7asyyuQ From 958a75b6cd48155bf100db17a08ac85257638b41 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 Mar 2003 00:48:50 +0000 Subject: [PATCH 0510/2994] Fix multi string literal typo. (Logical change 1.127) --- libntfs/lcnalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 07fc28b6..5872139e 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -101,8 +101,8 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, int err = 0, rlpos, rlsize, buf_size; u8 pass, done_zones, search_zone, need_writeback, bit; - Dprintf("%s(): Entering with count = 0x%Lx, start_lcn = 0x%Lx, - zone = %s_ZONE.\n", __FUNCTION__, (long long)count, + Dprintf("%s(): Entering with count = 0x%Lx, start_lcn = 0x%Lx, " + "zone = %s_ZONE.\n", __FUNCTION__, (long long)count, (long long)start_lcn, zone == MFT_ZONE ? "MFT" : "DATA"); if (!vol || count < 0 || start_lcn < -1 || !vol->lcnbmp_na || From 847a85634003a80a664ef83b1ff0704397004b60 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 Mar 2003 00:53:28 +0000 Subject: [PATCH 0511/2994] Add Russ Christensen to CREDITS. (Logical change 1.128) --- CREDITS | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS b/CREDITS index 26028977..da8eb06a 100644 --- a/CREDITS +++ b/CREDITS @@ -9,6 +9,7 @@ someone is missing or if you prefer to not be listed. Anton Altaparmakov Albert D. Cahalan +Russ Christensen Matthew J. Fanto David Martínez Moreno Leonard Norrgĺrd From e2bef765d038efd94a44311124e69e767227fa4c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 Mar 2003 00:53:28 +0000 Subject: [PATCH 0512/2994] Add Russ Christensen to CREDITS. BKrev: 3e7128084do5R9fyPkVglGODhI40Bg From d60f84d88a4f2b7cbd8a81bf7c765a5e38895dba Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 Mar 2003 00:53:28 +0000 Subject: [PATCH 0513/2994] Update. (Logical change 1.128) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 71181c0b..34b7285f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ xx/xx/2003 - 1.7.2-WIP - Work in progress. - Further work on attribute resizing. - Fix two logic inversion bugs in dir.c. Thanks to Russ Christensen for finding the first one. + - Fix attempt to release I30 internal constant. (Russ Christensen) 13/02/2003 - 1.7.1 - Urgent bug fixes. - Urgent bug fixes in ntfsresize (Szabolcs Szakacsits): From 640b2c164bbef526d0945e4f8605264d0d70bfbd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 18 Mar 2003 16:54:39 +0000 Subject: [PATCH 0514/2994] Auto merged 2003/03/18 16:54:33+00:00 cantab.net!aia21 fix typo (Logical change 1.129) --- libntfs/lcnalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 5872139e..dba05e9b 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -55,7 +55,7 @@ * There are two data zones. First is the area between the end of the mft zone * and the end of the volume, and second is the area between the start of the * volume and the start of the mft zone. On unmodified/standard NTFS 1.x - * volumes, the second date zone doesn't exist due to the mft zone being + * volumes, the second data zone doesn't exist due to the mft zone being * expanded to cover the start of the volume in order to reserve space for the * mft bitmap attribute. * From 191cc750cfc47fffab7b59d6a6e7530f5b573309 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 18 Mar 2003 16:54:39 +0000 Subject: [PATCH 0515/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into cantab.net:/home/aia21/ntfsprogs 2003/03/18 16:54:33+00:00 cantab.net!aia21 fix typo BKrev: 3e774f4f1s23DSANKd3pXQKcfTejew From 2d68f8c5df93e85ea1382314b1ded6a4cbec4e9d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 24 Mar 2003 13:34:05 +0000 Subject: [PATCH 0516/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/03/11 00:06:50+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/03/07 17:33:04+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/02/26 12:28:17+00:00 cantab.net!aia21 Update version/config for 1.8.0-devel status. BKrev: 3e7f094dsDWrctRuJxrHG4m7r5mn-g From c41ac4c1dceb3d74221ce96c825c29431a033739 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 24 Mar 2003 13:34:05 +0000 Subject: [PATCH 0517/2994] Update config. (Logical change 1.130) --- BitKeeper/etc/config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config index 8554b936..d704163e 100644 --- a/BitKeeper/etc/config +++ b/BitKeeper/etc/config @@ -1,7 +1,7 @@ -description: Linux NTFS userspace library and utilities +description: Developmental Linux NTFS userspace library and utilities category: System Environment/Base homepage: http://linux-ntfs.sf.net/ -bkweb: http://linux-ntfs.bkbits.net:8080/ntfsprogs +bkweb: http://linux-ntfs.bkbits.net:8080/ntfsprogs-devel contact: Anton Altaparmakov email: aia21@cantab.net logging: logging@openlogging.org From 65d283efc989b7943df6dfdd7befcf98e80f1f02 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 24 Mar 2003 13:34:05 +0000 Subject: [PATCH 0518/2994] Update version. (Logical change 1.130) --- configure | 2 +- configure.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 4280a74b..4b4b6d36 100755 --- a/configure +++ b/configure @@ -966,7 +966,7 @@ fi PACKAGE=ntfsprogs -VERSION=1.7.2-WIP +VERSION=1.8.0-devel 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; } diff --git a/configure.in b/configure.in index 1c2aaa4b..571b6396 100644 --- a/configure.in +++ b/configure.in @@ -12,7 +12,7 @@ fi AC_CANONICAL_SYSTEM -AM_INIT_AUTOMAKE(ntfsprogs,1.7.2-WIP) +AM_INIT_AUTOMAKE(ntfsprogs,1.8.0-devel) AM_MAINTAINER_MODE From 5f681b6ca02e756e80eb9ecbc076c59d5efd0353 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 24 Mar 2003 13:36:19 +0000 Subject: [PATCH 0519/2994] ntfsresize patch from Szaka: - option -i collects info about resizing conditions - if options -i and -s are used together then show needed relocations - option -P added to disable progress bars - walk_inodes(): delete redundant MFT_RECORD_IN_USE check - code refactorings, preparations to move relevant codes to library (Logical change 1.131) --- ntfsprogs/ntfsresize.c | 270 ++++++++++++++++++++++++++++++----------- 1 file changed, 198 insertions(+), 72 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index ea394897..971dfa4a 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -74,6 +74,7 @@ struct { int ro_flag; int force; int info; + int show_progress; s64 bytes; char *volume; } opt; @@ -90,13 +91,30 @@ struct progress_bar { float unit; }; +struct llcn_t { + s64 lcn; /* last used LCN for a "special" file/attr type */ + s64 inode; /* inode using it */ + int total; /* total number of such inodes */ +}; + struct __ntfs_resize_t { - s64 new_volume_size; + s64 new_volume_size; /* in clusters */ + int shrink; /* shrink = 1, enlarge = 0 */ ntfs_inode *ni; /* inode being processed */ ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ u64 relocations; /* num of clusters to relocate */ u64 inuse; /* num of clusters in use */ int multi_ref; /* num of clusters ref'd many times */ + /* Temporary statistics until all case is supported */ + struct llcn_t last_mft; + struct llcn_t last_mftmir; + struct llcn_t last_multi_mft; + struct llcn_t last_compressed_sparse; + struct llcn_t last_sparse; + struct llcn_t last_compressed; + struct llcn_t last_lcn; + int inode_seen; + int inode_seen_special; }; typedef struct __ntfs_resize_t ntfs_resize_t; @@ -186,21 +204,22 @@ void usage() printf ("\nUsage: %s [options] device\n" " Resize an NTFS volume non-destructively.\n" "\n" - " -i --info Calculate the smallest shrunken size supported\n" - " -s num --size num Resize volume to num[k|M|G] bytes\n" + " -i --info Calculate the smallest shrunken size supported\n" + " -s num --size num Resize volume to num[k|M|G] bytes\n" "\n" - " -n --no-action Do not write to disk\n" - " -f --force Force to progress (DANGEROUS)\n" - /* " -q --quiet Less output\n"*/ - /* " -v --verbose More output\n"*/ - " -V --version Display version information\n" - " -h --help Display this help\n" + " -n --no-action Do not write to disk\n" + " -f --force Force to progress (DANGEROUS)\n" + " -P --no-progress-bar Don't show progress bar\n" + /* " -q --quiet Less output\n"*/ + /* " -v --verbose More output\n"*/ + " -V --version Display version information\n" + " -h --help Display this help\n" #ifdef DEBUG - " -d --debug Show debug information\n" + " -d --debug Show debug information\n" #endif "\n" - " The options -i and -s are mutually exclusive. If both options are\n" - " omitted then the NTFS volume will be enlarged to the device size.\n" + " If -i and -s are used together then print information about relocations.\n" + " If both are omitted then the volume will be enlarged to the device size.\n" "\n", EXEC_NAME); printf ("%s%s\n", ntfs_bugs, ntfs_home); exit(1); @@ -239,10 +258,9 @@ void proceed_question(void) void version (void) { printf ("\nResize an NTFS Volume, without data loss.\n\n"); - printf ("Copyright (c)\n"); - printf (" 2002-2003 Szabolcs Szakacsits\n"); - printf (" 2002-2003 Anton Altaparmakov\n"); - printf (" 2002-2003 Richard Russon\n"); + printf ("Copyright (c) 2002-2003 Szabolcs Szakacsits\n"); + printf ("Copyright (c) 2002-2003 Anton Altaparmakov\n"); + printf ("Copyright (c) 2002-2003 Richard Russon\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -310,7 +328,7 @@ s64 get_new_volume_size(char *s) */ int parse_options(int argc, char **argv) { - static const char *sopt = "-dfhins:vV"; + static const char *sopt = "-dfhinPs:vV"; static const struct option lopt[] = { #ifdef DEBUG { "debug", no_argument, NULL, 'd' }, @@ -321,6 +339,7 @@ int parse_options(int argc, char **argv) { "no-action", no_argument, NULL, 'n' }, /* { "quiet", no_argument, NULL, 'q' },*/ { "size", required_argument, NULL, 's' }, + { "no-progress-bar", no_argument, NULL, 'P' }, /* { "verbose", no_argument, NULL, 'v' },*/ { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 } @@ -332,6 +351,7 @@ int parse_options(int argc, char **argv) int help = 0; memset(&opt, 0, sizeof(opt)); + opt.show_progress = 1; while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { @@ -357,6 +377,9 @@ int parse_options(int argc, char **argv) case 'n': opt.ro_flag = MS_RDONLY; break; + case 'P': + opt.show_progress = 0; + break; case 'q': opt.quiet++; break; @@ -399,14 +422,8 @@ int parse_options(int argc, char **argv) } */ - if (opt.info) { + if (opt.info) opt.ro_flag = MS_RDONLY; - if (opt.bytes > 0) { - Eprintf (NERR_PREFIX "Options --info and --size" - " can't be used together.\n"); - err++; - } - } } stderr = stdout; @@ -459,6 +476,89 @@ s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) return bm_bsize; } +void set_last_lcn(ntfs_resize_t *r, struct llcn_t *llcn, s64 lcn, int special) +{ + if (special) { + if (!r->inode_seen_special) { + r->inode_seen_special = 1; + llcn->total++; + } + } else + if (!r->inode_seen) { + r->inode_seen = 1; + llcn->total++; + } + + if (llcn->lcn < lcn) { + llcn->lcn = lcn; + llcn->inode = r->ni->mft_no; + } +} + +void collect_shrink_constraints(ntfs_resize_t *resize, s64 last_lcn) +{ + s64 inode; + ATTR_FLAGS flags; + struct llcn_t *llcn; + + inode = resize->ni->mft_no; + flags = resize->ctx->attr->flags; + + set_last_lcn(resize, &resize->last_lcn, last_lcn, 0); + + if (inode == 0) + llcn = &resize->last_mft; + + else if (inode == 1) + llcn = &resize->last_mftmir; + + else if (NInoAttrList(resize->ni)) + llcn = &resize->last_multi_mft; + + else if ((flags & ATTR_IS_SPARSE) && (flags & ATTR_IS_COMPRESSED)) + llcn = &resize->last_compressed_sparse; + + else if (flags & ATTR_IS_SPARSE) + llcn = &resize->last_sparse; + + else if (flags & ATTR_IS_COMPRESSED) + llcn = &resize->last_compressed; + else + return; + + set_last_lcn(resize, llcn, last_lcn, 1); +} + + +void collect_shrink_info(ntfs_resize_t *resize, runlist *rl) +{ + s64 new_volume_size, lcn, lcn_length; + + lcn = rl->lcn; + lcn_length = rl->length; + new_volume_size = resize->new_volume_size; + + if (lcn + (lcn_length - 1) > new_volume_size) { + + s64 start = lcn; + s64 len = lcn_length; + + if (start <= new_volume_size) { + start = new_volume_size + 1; + len = lcn_length - (start - lcn); + } + + resize->relocations += len; + + if (opt.info && !resize->new_volume_size) + return; + + printf("Relocation needed for inode %8Ld attr 0x%x LCN 0x%08Lx " + "length %6Ld\n", resize->ni->mft_no, + resize->ctx->attr->type, start, len); + } +} + /** * build_lcn_usage_bitmap * @@ -470,13 +570,12 @@ s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) */ void build_lcn_usage_bitmap(ntfs_resize_t *resize) { - s64 new_volume_size, inode; + s64 inode; ATTR_RECORD *a; runlist *rl; - int i, j;//, runs; + int i, j; a = resize->ctx->attr; - new_volume_size = resize->new_volume_size; inode = resize->ni->mft_no; if (!a->non_resident) @@ -485,12 +584,11 @@ void build_lcn_usage_bitmap(ntfs_resize_t *resize) if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) perr_exit("ntfs_decompress_mapping_pairs"); - //runs = runlist_extent_number(rl); - for (i = 0; rl[i].length; i++) { s64 lcn = rl[i].lcn; s64 lcn_length = rl[i].length; + /* CHECKME: LCN_RL_NOT_MAPPED check isn't needed */ if (lcn == LCN_HOLE || lcn == LCN_RL_NOT_MAPPED) continue; @@ -513,22 +611,11 @@ void build_lcn_usage_bitmap(ntfs_resize_t *resize) } resize->inuse += lcn_length; - - if (opt.info) - continue; - - if (lcn + (lcn_length - 1) > new_volume_size) { - - s64 start = lcn; - s64 len = lcn_length; - - if (start <= new_volume_size) { - start = new_volume_size + 1; - len = lcn_length - (start - lcn); - } - - resize->relocations += len; - } + + collect_shrink_constraints(resize, lcn + (lcn_length - 1)); + + if (resize->shrink) + collect_shrink_info(resize, rl + i); } free(rl); } @@ -636,8 +723,12 @@ void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) */ void progress_update(struct progress_bar *p, u64 current) { - float percent = p->unit * current; - + float percent; + + if (!opt.show_progress) + return; + + percent = p->unit * current; if (current != p->stop) { if ((current - p->start) % p->resolution) return; @@ -676,13 +767,12 @@ void walk_inodes(ntfs_resize_t *resize) perr_exit("Reading inode %lld failed", inode); } - if (!(ni->mrec->flags & MFT_RECORD_IN_USE)) - goto close_inode; - if ((ni->mrec->base_mft_record) != 0) goto close_inode; resize->ni = ni; + resize->inode_seen = 0; + resize->inode_seen_special = 0; walk_attributes(resize); close_inode: if (ntfs_inode_close(ni)) @@ -690,6 +780,19 @@ close_inode: } } +void print_hint(const char *s, struct llcn_t llcn) +{ + s64 runs_b, runs_mb; + + if (llcn.lcn == 0) + return; + + runs_b = llcn.lcn * vol->cluster_size; + runs_mb = rounded_up_division(runs_b, NTFS_MBYTE); + printf("%-19s: %6Ld MB %8Ld %11d\n", + s, runs_mb, llcn.inode, llcn.total); +} + /** * advise_on_resize * @@ -697,13 +800,26 @@ close_inode: * already been read into lcn_bitmap. By looking for the last used cluster on * the disk, we can work out by how much we can shrink the volume. */ -void advise_on_resize() +void advise_on_resize(ntfs_resize_t *resize) { s64 i, old_b, new_b, g_b, old_mb, new_mb, g_mb; int fragmanted_end; printf("Calculating smallest shrunken size supported ...\n"); + old_b = vol->nr_clusters * vol->cluster_size; + old_mb = rounded_up_division(old_b, NTFS_MBYTE); + + printf("File feature Last used Last inode " + "Total inodes\n"); + print_hint("$MFT", resize->last_mft); + print_hint("$MFTMirr", resize->last_mftmir); + print_hint("Compressed", resize->last_compressed); + print_hint("Sparse", resize->last_sparse); + print_hint("Compressed&Sparse", resize->last_compressed_sparse); + print_hint("Multi-Record", resize->last_multi_mft); + print_hint("Ordinary&Special", resize->last_lcn); + for (i = vol->nr_clusters - 1; i > 0 && (i % 8); i--) if (ntfs_bit_get(lcn_bitmap.bm, i)) goto found_used_cluster; @@ -723,6 +839,10 @@ void advise_on_resize() break; found_used_cluster: + if (i != resize->last_lcn.lcn) + err_exit("Last used cluster calculations don't match! " + "%Ld != %Ld\n", i, resize->last_lcn); + i += 2; /* first free + we reserve one for the backup boot sector */ fragmanted_end = (i >= vol->nr_clusters) ? 1 : 0; @@ -733,8 +853,6 @@ found_used_cluster: printf("Now "); } - old_b = vol->nr_clusters * vol->cluster_size; - old_mb = rounded_up_division(old_b, NTFS_MBYTE); new_b = i * vol->cluster_size; new_mb = rounded_up_division(new_b, NTFS_MBYTE); g_b = (vol->nr_clusters - i) * vol->cluster_size; @@ -934,19 +1052,23 @@ void enlarge_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) /** * truncate_bitmap_data_attr */ -void truncate_bitmap_data_attr(ATTR_RECORD *a, s64 nr_clusters) +void truncate_bitmap_data_attr(ntfs_resize_t *resize) { + ATTR_RECORD *a; runlist *rl; s64 bm_bsize, size; s64 nr_bm_clusters; + s64 nr_clusters; int mp_size; char *mp; u8 *tmp; + a = resize->ctx->attr; if (!a->non_resident) /* FIXME: handle resident attribute value */ perr_exit("Resident data attribute in $Bitmap not supported!"); + nr_clusters = resize->new_volume_size; bm_bsize = nr_clusters_to_bitmap_byte_size(nr_clusters); nr_bm_clusters = rounded_up_division(bm_bsize, vol->cluster_size); @@ -959,7 +1081,9 @@ void truncate_bitmap_data_attr(ATTR_RECORD *a, s64 nr_clusters) if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) perr_exit("ntfs_mapping_pairs_decompress"); - if (nr_clusters < vol->nr_clusters) + /* NOTE: shrink could use enlarge_bitmap_data_attr() also. Advantages: + less code, better code coverage. "Drawback": could be relocated */ + if (resize->shrink) shrink_bitmap_data_attr(&rl, nr_bm_clusters, nr_clusters); else enlarge_bitmap_data_attr(&rl, nr_bm_clusters, nr_clusters); @@ -1081,20 +1205,17 @@ void truncate_badclust_file(s64 nr_clusters) * * Shrink the $Bitmap file to match the new volume size. */ -void truncate_bitmap_file(s64 nr_clusters) +void truncate_bitmap_file(ntfs_resize_t *resize) { - ntfs_attr_search_ctx *ctx = NULL; - printf("Updating $Bitmap file ...\n"); - lookup_data_attr((MFT_REF)FILE_Bitmap, NULL, &ctx); - /* FIXME: sanity_check_attr(ctx->attr); */ - truncate_bitmap_data_attr(ctx->attr, nr_clusters); + lookup_data_attr((MFT_REF)FILE_Bitmap, NULL, &resize->ctx); + truncate_bitmap_data_attr(resize); - if (write_mft_record(ctx)) + if (write_mft_record(resize->ctx)) perr_exit("Couldn't update $Bitmap"); - ntfs_attr_put_search_ctx(ctx); + ntfs_attr_put_search_ctx(resize->ctx); } /** @@ -1176,11 +1297,14 @@ void print_disk_usage(ntfs_resize_t *resize) free = total - used; relocations = resize->relocations * vol->cluster_size; - printf("Space in use : %lld MB (%.1f%%) ", + printf("Space in use : %lld MB (%.1f%%)\n", rounded_up_division(used, NTFS_MBYTE), 100.0 * ((float)used / total)); - - printf("\n"); + + if (opt.bytes) + printf("Needed relocations : %Ld (%Ld MB)\n", + resize->relocations, + rounded_up_division(relocations, NTFS_MBYTE)); } /** @@ -1281,7 +1405,7 @@ int main(int argc, char **argv) printf("%s v%s\n", EXEC_NAME, VERSION); - if (!parse_options (argc, argv)) + if (!parse_options(argc, argv)) return 1; utils_set_locale(); @@ -1304,7 +1428,7 @@ int main(int argc, char **argv) if (device_size < opt.bytes) err_exit("New size can't be bigger than the " "device size (%Ld bytes).\n", device_size); - } else + } else if (!opt.info) opt.bytes = device_size; /* @@ -1335,7 +1459,9 @@ int main(int argc, char **argv) memset(&resize, 0, sizeof(resize)); resize.new_volume_size = new_size; - + if (new_size < vol->nr_clusters) + resize.shrink = 1; + walk_inodes(&resize); if (resize.multi_ref) { printf("Totally %d clusters referenced multiply times.\n", @@ -1349,14 +1475,14 @@ int main(int argc, char **argv) print_disk_usage(&resize); if (opt.info) { - advise_on_resize(); + advise_on_resize(&resize); exit(0); } for (i = new_size; i < vol->nr_clusters; i++) if (ntfs_bit_get(lcn_bitmap.bm, (u64)i)) { /* FIXME: relocate cluster */ - advise_on_resize(); + advise_on_resize(&resize); exit(1); } @@ -1368,7 +1494,7 @@ int main(int argc, char **argv) prepare_volume_fixup(); truncate_badclust_file(new_size); - truncate_bitmap_file(new_size); + truncate_bitmap_file(&resize); update_bootsector(new_size); /* We don't create backup boot sector because we don't know where the From a41a83339773d719d6b695992ddc907889946224 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 24 Mar 2003 13:36:19 +0000 Subject: [PATCH 0520/2994] ntfsresize patch from Szaka: - option -i collects info about resizing conditions - if options -i and -s are used together then show needed relocations - option -P added to disable progress bars - walk_inodes(): delete redundant MFT_RECORD_IN_USE check - code refactorings, preparations to move relevant codes to library BKrev: 3e7f09d3FlxaBCV0mIGFF10QuZ0eeA From dd765db6609953e5f54d06fb85955597c83c756c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 24 Mar 2003 13:51:37 +0000 Subject: [PATCH 0521/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/03/24 13:51:17+00:00 cantab.net!aia21 patch from Szaka: This is needed, otherwise ntfsimage outputs libntfs messages in debug mode if stdout specified thus confusing e.g. compressing tools reading from pipe. E.g. 'ntfsimage -o - device | bzip2 ...' creates a corrupted, unusable ntfs image. I've looked through libntfs and apparently no other places with this problem. Szaka BKrev: 3e7f0d6917LFxykbD_IeOwj5JDl5qg From 549751634a1318d5cb825b7ef4c019949a24bc44 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 24 Mar 2003 13:51:37 +0000 Subject: [PATCH 0522/2994] patch from Szaka: This is needed, otherwise ntfsimage outputs libntfs messages in debug mode if stdout specified thus confusing e.g. compressing tools reading from pipe. E.g. 'ntfsimage -o - device | bzip2 ...' creates a corrupted, unusable ntfs image. I've looked through libntfs and apparently no other places with this problem. Szaka (Logical change 1.132) --- libntfs/bootsect.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index e8b76cdb..6cff9826 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -32,12 +32,12 @@ /** * ntfs_boot_sector_is_ntfs - check if buffer contains a valid ntfs boot sector * @b: buffer containing putative boot sector to analyze - * @silent: if zero, output progress messages to stdout + * @silent: if zero, output progress messages to stderr * * Check if the buffer @b contains a valid ntfs boot sector. The buffer @b * must be at least 512 bytes in size. * - * If @silent is zero, output progress messages to stdout. Otherwise, do not + * If @silent is zero, output progress messages to stderr. Otherwise, do not * output any messages (except when configured with --enable-debug in which * case warning/debug messages may be displayed). * @@ -48,7 +48,7 @@ BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent) u32 i; if (!silent) - printf("\nBeginning bootsector check...\n"); + fprintf(stderr, "\nBeginning bootsector check...\n"); /* Calculate the checksum. Note, this is just a simple addition of all u32 values in the bootsector starting at the beginning and @@ -59,7 +59,7 @@ BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent) u32 *bi = (u32 *)(&b->checksum); if (!silent) - printf("Calculating bootsector checksum... "); + fprintf(stderr, "Calculating bootsector checksum... "); for (i = 0; u < bi; ++u) i += le32_to_cpup(u); @@ -67,29 +67,29 @@ BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent) if (le32_to_cpu(b->checksum) && le32_to_cpu(b->checksum) != i) goto not_ntfs; if (!silent) - puts("OK"); + fprintf(stderr, "OK\n"); } /* Check OEMidentifier is "NTFS " */ if (!silent) - printf("Checking OEMid... "); + fprintf(stderr, "Checking OEMid... "); if (b->oem_id != cpu_to_le64(0x202020205346544e)) /* "NTFS " */ goto not_ntfs; if (!silent) - puts("OK"); + fprintf(stderr, "OK\n"); /* Check bytes per sector value is between 256 and 4096. */ if (!silent) - printf("Checking bytes per sector... "); + fprintf(stderr, "Checking bytes per sector... "); if (le16_to_cpu(b->bpb.bytes_per_sector) < 0x100 || le16_to_cpu(b->bpb.bytes_per_sector) > 0x1000) goto not_ntfs; if (!silent) - puts("OK"); + fprintf(stderr, "OK\n"); /* Check sectors per cluster value is valid. */ if (!silent) - printf("Checking sectors per cluster... "); + fprintf(stderr, "Checking sectors per cluster... "); switch (b->bpb.sectors_per_cluster) { case 1: case 2: case 4: case 8: case 16: case 32: case 64: case 128: @@ -98,20 +98,20 @@ BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent) goto not_ntfs; } if (!silent) - puts("OK"); + fprintf(stderr, "OK\n"); /* Check the cluster size is not above 65536 bytes. */ if (!silent) - printf("Checking cluster size... "); + fprintf(stderr, "Checking cluster size... "); if ((u32)le16_to_cpu(b->bpb.bytes_per_sector) * b->bpb.sectors_per_cluster > 0x10000) goto not_ntfs; if (!silent) - puts("OK"); + fprintf(stderr, "OK\n"); /* Check reserved/unused fields are really zero. */ if (!silent) - printf("Checking reserved fields are zero... "); + fprintf(stderr, "Checking reserved fields are zero... "); if (le16_to_cpu(b->bpb.reserved_sectors) || le16_to_cpu(b->bpb.root_entries) || le16_to_cpu(b->bpb.sectors) || @@ -120,11 +120,11 @@ BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent) b->bpb.fats) goto not_ntfs; if (!silent) - puts("OK"); + fprintf(stderr, "OK\n"); /* Check clusters per file mft record value is valid. */ if (!silent) - printf("Checking clusters per mft record... "); + fprintf(stderr, "Checking clusters per mft record... "); if ((u8)b->clusters_per_mft_record < 0xe1 || (u8)b->clusters_per_mft_record > 0xf7) { switch (b->clusters_per_mft_record) { @@ -135,11 +135,11 @@ BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent) } } if (!silent) - puts("OK"); + fprintf(stderr, "OK\n"); /* Check clusters per index block value is valid. */ if (!silent) - printf("Checking clusters per index block... "); + fprintf(stderr, "Checking clusters per index block... "); if ((u8)b->clusters_per_index_record < 0xe1 || (u8)b->clusters_per_index_record > 0xf7) { switch (b->clusters_per_index_record) { @@ -150,19 +150,19 @@ BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent) } } if (!silent) - puts("OK"); + fprintf(stderr, "OK\n"); if (b->end_of_sector_marker != cpu_to_le16(0xaa55)) Dputs("Warning: Bootsector has invalid end of sector marker."); if (!silent) - puts("Bootsector check completed successfully."); + fprintf(stderr, "Bootsector check completed successfully.\n"); return TRUE; not_ntfs: if (!silent) { - puts("FAILED"); - puts("Bootsector check failed. Aborting..."); + fprintf(stderr, "FAILED\n"); + fprintf(stderr, "Bootsector check failed. Aborting...\n"); } return FALSE; } From 969a7bcc0d968421439ca5e3774a95f9127e8a44 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 7 Apr 2003 10:55:25 +0000 Subject: [PATCH 0523/2994] patch from Szaka: - Shrink contrains refactored for incremental cluster relocation support and to get closer for parted integration (ped_file_system_get_resize_constraint) (Logical change 1.133) --- ntfsprogs/ntfsresize.c | 118 ++++++++++++----------------------------- 1 file changed, 35 insertions(+), 83 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 971dfa4a..8f0443a6 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -94,7 +94,6 @@ struct progress_bar { struct llcn_t { s64 lcn; /* last used LCN for a "special" file/attr type */ s64 inode; /* inode using it */ - int total; /* total number of such inodes */ }; struct __ntfs_resize_t { @@ -109,12 +108,10 @@ struct __ntfs_resize_t { struct llcn_t last_mft; struct llcn_t last_mftmir; struct llcn_t last_multi_mft; - struct llcn_t last_compressed_sparse; struct llcn_t last_sparse; struct llcn_t last_compressed; struct llcn_t last_lcn; - int inode_seen; - int inode_seen_special; + s64 last_unsupp; /* last unsupported cluster */ }; typedef struct __ntfs_resize_t ntfs_resize_t; @@ -476,25 +473,6 @@ s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) return bm_bsize; } -void set_last_lcn(ntfs_resize_t *r, struct llcn_t *llcn, s64 lcn, int special) -{ - if (special) { - if (!r->inode_seen_special) { - r->inode_seen_special = 1; - llcn->total++; - } - } else - if (!r->inode_seen) { - r->inode_seen = 1; - llcn->total++; - } - - if (llcn->lcn < lcn) { - llcn->lcn = lcn; - llcn->inode = r->ni->mft_no; - } -} - void collect_shrink_constraints(ntfs_resize_t *resize, s64 last_lcn) { s64 inode; @@ -504,29 +482,31 @@ void collect_shrink_constraints(ntfs_resize_t *resize, s64 last_lcn) inode = resize->ni->mft_no; flags = resize->ctx->attr->flags; - set_last_lcn(resize, &resize->last_lcn, last_lcn, 0); - - if (inode == 0) - llcn = &resize->last_mft; - - else if (inode == 1) - llcn = &resize->last_mftmir; - - else if (NInoAttrList(resize->ni)) + if (NInoAttrList(resize->ni)) llcn = &resize->last_multi_mft; - else if ((flags & ATTR_IS_SPARSE) && (flags & ATTR_IS_COMPRESSED)) - llcn = &resize->last_compressed_sparse; - else if (flags & ATTR_IS_SPARSE) llcn = &resize->last_sparse; else if (flags & ATTR_IS_COMPRESSED) llcn = &resize->last_compressed; + + else if (inode == 0) + llcn = &resize->last_mft; + + else if (inode == 1) + llcn = &resize->last_mftmir; + else - return; - - set_last_lcn(resize, llcn, last_lcn, 1); + llcn = &resize->last_lcn; + + if (llcn->lcn < last_lcn) { + llcn->lcn = last_lcn; + llcn->inode = inode; + } + + if (resize->last_unsupp < last_lcn) + resize->last_unsupp = last_lcn; } @@ -666,7 +646,7 @@ void compare_bitmaps(struct bitmap *a) if (count == 0) { if (a->size != pos) err_exit("$Bitmap file size doesn't match " - "calculated size ((%Ld != %Ld)\n", + "calculated size (%Ld != %Ld)\n", a->size, pos); break; } @@ -771,8 +751,6 @@ void walk_inodes(ntfs_resize_t *resize) goto close_inode; resize->ni = ni; - resize->inode_seen = 0; - resize->inode_seen_special = 0; walk_attributes(resize); close_inode: if (ntfs_inode_close(ni)) @@ -789,8 +767,7 @@ void print_hint(const char *s, struct llcn_t llcn) runs_b = llcn.lcn * vol->cluster_size; runs_mb = rounded_up_division(runs_b, NTFS_MBYTE); - printf("%-19s: %6Ld MB %8Ld %11d\n", - s, runs_mb, llcn.inode, llcn.total); + printf("%-19s: %6Ld MB %8Ld\n", s, runs_mb, llcn.inode); } /** @@ -802,7 +779,8 @@ void print_hint(const char *s, struct llcn_t llcn) */ void advise_on_resize(ntfs_resize_t *resize) { - s64 i, old_b, new_b, g_b, old_mb, new_mb, g_mb; + s64 old_b, new_b, g_b, old_mb, new_mb, g_mb; + s64 supp_lcn = 0; /* smallest size supported in LCN */ int fragmanted_end; printf("Calculating smallest shrunken size supported ...\n"); @@ -810,41 +788,18 @@ void advise_on_resize(ntfs_resize_t *resize) old_b = vol->nr_clusters * vol->cluster_size; old_mb = rounded_up_division(old_b, NTFS_MBYTE); - printf("File feature Last used Last inode " - "Total inodes\n"); + printf("File feature Last used Last inode\n"); print_hint("$MFT", resize->last_mft); print_hint("$MFTMirr", resize->last_mftmir); print_hint("Compressed", resize->last_compressed); print_hint("Sparse", resize->last_sparse); - print_hint("Compressed&Sparse", resize->last_compressed_sparse); print_hint("Multi-Record", resize->last_multi_mft); - print_hint("Ordinary&Special", resize->last_lcn); + print_hint("Ordinary", resize->last_lcn); + + supp_lcn = resize->last_unsupp; - for (i = vol->nr_clusters - 1; i > 0 && (i % 8); i--) - if (ntfs_bit_get(lcn_bitmap.bm, i)) - goto found_used_cluster; - - if (i > 0) { - if (ntfs_bit_get(lcn_bitmap.bm, i)) - goto found_used_cluster; - } else - goto found_used_cluster; - - for (i -= 8; i >= 0; i -= 8) - if (lcn_bitmap.bm[i / 8]) - break; - - for (i += 7; i > 0; i--) - if (ntfs_bit_get(lcn_bitmap.bm, i)) - break; - -found_used_cluster: - if (i != resize->last_lcn.lcn) - err_exit("Last used cluster calculations don't match! " - "%Ld != %Ld\n", i, resize->last_lcn); - - i += 2; /* first free + we reserve one for the backup boot sector */ - fragmanted_end = (i >= vol->nr_clusters) ? 1 : 0; + supp_lcn += 2; /* first free + one for the backup boot sector */ + fragmanted_end = (supp_lcn >= vol->nr_clusters) ? 1 : 0; if (fragmanted_end || !opt.info) { printf(fragmented_volume_msg); @@ -853,9 +808,9 @@ found_used_cluster: printf("Now "); } - new_b = i * vol->cluster_size; + new_b = supp_lcn * vol->cluster_size; new_mb = rounded_up_division(new_b, NTFS_MBYTE); - g_b = (vol->nr_clusters - i) * vol->cluster_size; + g_b = (vol->nr_clusters - supp_lcn) * vol->cluster_size; g_mb = g_b / NTFS_MBYTE; printf("You could resize at %lld bytes ", new_b); @@ -1401,7 +1356,6 @@ int main(int argc, char **argv) ntfs_resize_t resize; s64 new_size = 0; /* in clusters */ s64 device_size; /* in bytes */ - int i; printf("%s v%s\n", EXEC_NAME, VERSION); @@ -1478,13 +1432,11 @@ int main(int argc, char **argv) advise_on_resize(&resize); exit(0); } - - for (i = new_size; i < vol->nr_clusters; i++) - if (ntfs_bit_get(lcn_bitmap.bm, (u64)i)) { - /* FIXME: relocate cluster */ - advise_on_resize(&resize); - exit(1); - } + + if (resize.last_unsupp >= new_size) { + advise_on_resize(&resize); + exit(1); + } if (opt.force-- <= 0 && !opt.ro_flag) { printf(resize_warning_msg); From bd65b7e56965ecfa7a65a5b0f3028d33990c4b1f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 7 Apr 2003 10:55:25 +0000 Subject: [PATCH 0524/2994] patch from Szaka: - Shrink contrains refactored for incremental cluster relocation support and to get closer for parted integration (ped_file_system_get_resize_constraint) BKrev: 3e91591dzVYrGC7IIc5i26h-O__Jlw From f1ff1790ead97778cb56967ff88260f1de3f1f22 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 11 Apr 2003 13:08:52 +0000 Subject: [PATCH 0525/2994] (Logical change 1.134) --- ntfsprogs/ntfsclone.c | 933 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 933 insertions(+) create mode 100644 ntfsprogs/ntfsclone.c diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c new file mode 100644 index 00000000..88126ff8 --- /dev/null +++ b/ntfsprogs/ntfsclone.c @@ -0,0 +1,933 @@ +/** + * ntfsclone - Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Szabolcs Szakacsits + * + * ntfsclone clones NTFS data and/or metadata to a sparse file or stdout. + * + * 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 of the License, or + * (at your option) any later version. + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "debug.h" +#include "types.h" +#include "support.h" +#include "endians.h" +#include "bootsect.h" +#include "disk_io.h" +#include "attrib.h" +#include "volume.h" +#include "mft.h" +#include "bitmap.h" +#include "inode.h" +#include "runlist.h" +#include "utils.h" + +static const char *EXEC_NAME = "ntfsclone"; + +struct { + int verbose; + int quiet; + int debug; + int force; + int overwrite; + int stdout; + int metadata_only; + char *output; + char *volume; +} opt; + +struct bitmap { + u8 *bm; + s64 size; +}; + +struct progress_bar { + u64 start; + u64 stop; + int resolution; + float unit; +}; + +struct __ntfs_walk_clusters_ctx { + ntfs_inode *ni; /* inode being processed */ + ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ + u64 inuse; /* number of clusters in use */ +}; + +typedef struct __ntfs_walk_clusters_ctx ntfs_walk_clusters_ctx; +typedef int (ntfs_walk_op)(ntfs_inode *ni, void *data); + +struct ntfs_walk_cluster { + ntfs_walk_op *inode_op; /* not implemented yet */ + ntfs_walk_clusters_ctx *image; +}; + + +ntfs_volume *vol = NULL; +struct bitmap lcn_bitmap; + +int fd_out; +FILE *msg_out = NULL; + +int nr_used_mft_records = 0; +int wipe = 0; +int wiped_unused_mft_data = 0; +int wiped_unused_mft = 0; +int wiped_resident_data = 0; +int wiped_timestamp_data = 0; + +#define NTFS_MBYTE (1000 * 1000) + +#define ERR_PREFIX "ERROR" +#define PERR_PREFIX ERR_PREFIX "(%d): " +#define NERR_PREFIX ERR_PREFIX ": " + +#define LAST_METADATA_INODE 11 + +#define NTFS_MAX_CLUSTER_SIZE 65536 + +#define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) + +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, msg_out, &opt.verbose, TRUE) +GEN_PRINTF(Qprintf, msg_out, &opt.quiet, FALSE) +GEN_PRINTF(Printf, msg_out, NULL, FALSE) + + +void perr_printf(const char *fmt, ...) +{ + va_list ap; + int eo = errno; + + Printf(PERR_PREFIX, eo); + va_start(ap, fmt); + vfprintf(msg_out, fmt, ap); + va_end(ap); + Printf(": %s\n", strerror(eo)); + fflush(msg_out); +} + +void err_printf(const char *fmt, ...) +{ + va_list ap; + + Printf(NERR_PREFIX); + va_start(ap, fmt); + vfprintf(msg_out, fmt, ap); + va_end(ap); + fflush(msg_out); +} + +int err_exit(const char *fmt, ...) +{ + va_list ap; + + Printf(NERR_PREFIX); + va_start(ap, fmt); + vfprintf(msg_out, fmt, ap); + va_end(ap); + fflush(msg_out); + exit(1); +} + + +int perr_exit(const char *fmt, ...) +{ + va_list ap; + int eo = errno; + + Printf(PERR_PREFIX, eo); + va_start(ap, fmt); + vfprintf(msg_out, fmt, ap); + va_end(ap); + Printf(": %s\n", strerror(eo)); + fflush(msg_out); + exit(1); +} + + +void usage() +{ + Eprintf("\nUsage: %s [options] device\n" + " Clone NTFS data to a sparse file or send it to stdout.\n" + "\n" + " -o FILE --output FILE Clone NTFS to the non-existent FILE\n" + " -O FILE Clone NTFS to FILE, overwriting if exists\n" + " -m --metadata Clone *only* metadata (for NTFS experts)\n" + " -f --force Force to progress (DANGEROUS)\n" + " -h --help Display this help\n" +#ifdef DEBUG + " -d --debug Show debug information\n" +#endif + "\n" + " If FILE is '-' then send NTFS data to stdout replacing non used\n" + " NTFS and partition space with zeros.\n" + "\n", EXEC_NAME); + Eprintf("%s%s\n", ntfs_bugs, ntfs_home); + exit(1); +} + + +void parse_options(int argc, char **argv) +{ + static const char *sopt = "-dfhmo:O:"; + static const struct option lopt[] = { +#ifdef DEBUG + { "debug", no_argument, NULL, 'd' }, +#endif + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "metadata", no_argument, NULL, 'm' }, + { "output", required_argument, NULL, 'o' }, + { NULL, 0, NULL, 0 } + }; + + char c; + + memset(&opt, 0, sizeof(opt)); + + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (opt.volume) + usage(); + opt.volume = argv[optind-1]; + break; + case 'd': + opt.debug++; + break; + case 'f': + opt.force++; + break; + case 'h': + case '?': + usage(); + case 'm': + opt.metadata_only++; + break; + case 'O': + opt.overwrite++; + case 'o': + if (opt.output) + usage(); + opt.output = argv[optind-1]; + break; + default: + err_printf("Unknown option '%s'.\n", argv[optind-1]); + usage(); + } + } + + if (opt.output == NULL) { + err_printf("You must specify an output file.\n"); + usage(); + } + + if (strcmp(opt.output, "-") == 0) + opt.stdout++; + + if (opt.volume == NULL) { + err_printf("You must specify a device file.\n"); + usage(); + } + + if (opt.metadata_only && opt.stdout) + err_exit("Cloning only metadata to stdout isn't supported yet!\n"); + + msg_out = stdout; + + /* FIXME: this is a workaround for loosing debug info if stdout != stderr + and for the uncontrollable verbose messages in libntfs. Ughhh. */ + if (opt.stdout) + msg_out = stderr; + else if (opt.debug) + stderr = stdout; + else + if (!(stderr = fopen("/dev/null", "rw"))) + perr_exit("Couldn't open /dev/null"); +} + + +/** + * nr_clusters_to_bitmap_byte_size + * + * Take the number of clusters in the volume and calculate the size of $Bitmap. + * The size will always be a multiple of 8 bytes. + */ +s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) +{ + s64 bm_bsize; + + bm_bsize = rounded_up_division(nr_clusters, 8); + + bm_bsize = (bm_bsize + 7) & ~7; + Dprintf("Bitmap byte size : %lld (%lld clusters)\n", + bm_bsize, rounded_up_division(bm_bsize, vol->cluster_size)); + + return bm_bsize; +} + +int is_critical_meatadata(ntfs_walk_clusters_ctx *image) +{ + s64 inode; + + inode = image->ni->mft_no; + + if (inode <= LAST_METADATA_INODE) + if (inode != FILE_LogFile) + return 1; + + if (image->ctx->attr->type != AT_DATA) + return 1; + + return 0; +} + +void write_cluster(const char *buff) +{ + int count; + + if ((count = write(fd_out, buff, vol->cluster_size)) == -1) + perr_exit("write"); + + if (count != vol->cluster_size) + err_exit("Partial write not yet handled\n"); +} + +void copy_cluster() +{ + int count; + char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ + + /* FIXME: handle partial read/writes */ + if ((count = read(vol->fd, buff, vol->cluster_size)) == -1) + perr_exit("read"); + + if (count != vol->cluster_size) + err_exit("Partial read not yet handled\n"); + + write_cluster(buff); +} + +void lseek_to_cluster(s64 lcn) +{ + off_t pos; + + pos = (off_t)(lcn * vol->cluster_size); + + if (lseek(vol->fd, pos, SEEK_SET) == (off_t)-1) + perr_exit("lseek input"); + + if (opt.stdout) + return; + + if (lseek(fd_out, pos, SEEK_SET) == (off_t)-1) + perr_exit("lseek output"); +} + +void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) +{ + int i; + + if (opt.stdout) + return; + + if (opt.metadata_only && !is_critical_meatadata(image)) + return; + + lseek_to_cluster(rl->lcn); + + /* FIXME: this could give pretty suboptimal performance */ + for (i = 0; i < rl->length; i++) + copy_cluster(); +} + +void dump_to_stdout() +{ + s64 i, pos, count; + u8 bm[NTFS_BUF_SIZE]; + void *buff; + + Printf("Dumping NTFS to stdout ...\n"); + + if ((buff = calloc(1, vol->cluster_size)) == NULL) + perr_exit("dump_to_stdout"); + + pos = 0; + while (1) { + count = ntfs_attr_pread(vol->lcnbmp_na, pos, NTFS_BUF_SIZE, bm); + if (count == -1) + perr_exit("Couldn't read $Bitmap (pos = %Ld)\n", pos); + + if (count == 0) + return; + + for (i = 0; i < count; i++, pos++) { + u64 cl; /* current cluster */ + + for (cl = pos * 8; cl < (pos + 1) * 8; cl++) { + + if (cl > vol->nr_clusters - 1) + return; + + if (ntfs_bit_get(bm, i * 8 + cl % 8)) { + lseek_to_cluster(cl); + copy_cluster(); + } else + write_cluster(buff); + } + } + } +} + +#define WIPE_TIMESTAMPS(atype, attr) \ +do { \ + atype *ats; \ + ats = (atype *)((char*)(attr) + (attr)->value_offset); \ + \ + ats->creation_time = 0; \ + ats->last_data_change_time = 0; \ + ats->last_mft_change_time= 0; \ + ats->last_access_time = 0; \ + \ + wiped_timestamp_data += 32; \ + \ +} while(0) + +void wipe_timestamps(ntfs_walk_clusters_ctx *image) +{ + ATTR_RECORD *a = image->ctx->attr; + + if (image->ni->mft_no <= LAST_METADATA_INODE) + return; + + if (a->type == AT_FILE_NAME) + WIPE_TIMESTAMPS(FILE_NAME_ATTR, a); + + else if (a->type == AT_STANDARD_INFORMATION) + WIPE_TIMESTAMPS(STANDARD_INFORMATION, a); +} + +void wipe_resident_data(ntfs_walk_clusters_ctx *image) +{ + ATTR_RECORD *a; + int i, n = 0; + char *p; + + a = image->ctx->attr; + p = (char *)a + a->value_offset; + + if (image->ni->mft_no <= LAST_METADATA_INODE) + return; + + if (a->type != AT_DATA) + return; + + for (i = 0; i < a->value_length; i++) { + if (p[i]) { + p[i] = 0; + n++; + } + } + + wiped_resident_data += n; +} + +void walk_runs(struct ntfs_walk_cluster *walk) +{ + int i, j; + runlist *rl; + ATTR_RECORD *a; + ntfs_attr_search_ctx *ctx; + + ctx = walk->image->ctx; + a = ctx->attr; + + if (!a->non_resident) { + if (wipe) { + wipe_resident_data(walk->image); + wipe_timestamps(walk->image); + } + return; + } + + if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) + perr_exit("ntfs_decompress_mapping_pairs"); + + for (i = 0; rl[i].length; i++) { + s64 lcn = rl[i].lcn; + s64 lcn_length = rl[i].length; + + if (lcn == LCN_HOLE || lcn == LCN_RL_NOT_MAPPED) + continue; + + /* FIXME: ntfs_mapping_pairs_decompress should return error */ + if (lcn < 0 || lcn_length < 0) + err_exit("Corrupt runlist in inode %lld attr %x LCN " + "%llx length %llx\n", ctx->ntfs_ino->mft_no, + le32_to_cpu (a->type), lcn, lcn_length); + + if (!wipe) + dump_clusters(walk->image, rl + i); + + for (j = 0; j < lcn_length; j++) { + u64 k = (u64)lcn + j; + if (ntfs_bit_get_and_set(lcn_bitmap.bm, k, 1)) + err_exit("Cluster %lu referenced twice!\n" + "You didn't shutdown your Windows" + "properly?\n", k); + } + + walk->image->inuse += lcn_length; + } + + free(rl); +} + + +void walk_attributes(struct ntfs_walk_cluster *walk) +{ + ntfs_attr_search_ctx *ctx; + + if (!(ctx = ntfs_attr_get_search_ctx(walk->image->ni, NULL))) + perr_exit("ntfs_get_attr_search_ctx"); + + while (!ntfs_attrs_walk(ctx)) { + if (ctx->attr->type == AT_END) + break; + + walk->image->ctx = ctx; + walk_runs(walk); + } + + ntfs_attr_put_search_ctx(ctx); +} + + + +void compare_bitmaps(struct bitmap *a) +{ + s64 i, pos, count; + int mismatch = 0; + u8 bm[NTFS_BUF_SIZE]; + + Printf("Accounting clusters ...\n"); + + pos = 0; + while (1) { + count = ntfs_attr_pread(vol->lcnbmp_na, pos, NTFS_BUF_SIZE, bm); + if (count == -1) + perr_exit("Couldn't get $Bitmap $DATA"); + + if (count == 0) { + if (a->size != pos) + err_exit("$Bitmap file size doesn't match " + "calculated size (%Ld != %Ld)\n", + a->size, pos); + break; + } + + for (i = 0; i < count; i++, pos++) { + u64 cl; /* current cluster */ + + if (a->bm[pos] == bm[i]) + continue; + + for (cl = pos * 8; cl < (pos + 1) * 8; cl++) { + char bit; + + bit = ntfs_bit_get(a->bm, cl); + if (bit == ntfs_bit_get(bm, i * 8 + cl % 8)) + continue; + + if (++mismatch > 10) + continue; + + Printf("Cluster accounting failed at %Lu " + "(0x%Lx): %s cluster in $Bitmap\n", + cl, cl, bit ? "missing" : "extra"); + } + } + } + + if (mismatch) { + Printf("Totally %d cluster accounting mismatches.\n", + mismatch); + err_exit("Filesystem check failed! Windows wasn't shutdown " + "properly or inconsistent\nfilesystem. Please run " + "chkdsk on Windows.\n"); + } +} + + +void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) +{ + p->start = start; + p->stop = stop; + p->unit = 100.0 / (stop - start); + p->resolution = res; +} + + +void progress_update(struct progress_bar *p, u64 current) +{ + float percent = p->unit * current; + + if (current != p->stop) { + if ((current - p->start) % p->resolution) + return; + Printf("%6.2f percent completed\r", percent); + } else + Printf("100.00 percent completed\n"); + fflush(msg_out); +} + +int wipe_data(char *p, int pos, int len) +{ + int wiped = 0; + + p += pos; + for (; len > 0; len--) { + if (p[len]) { + p[len] = 0; + wiped++; + } + } + + return wiped; +} + +void wipe_unused_mft_data(ntfs_inode *ni) +{ + int unused; + MFT_RECORD *m = ni->mrec; + + /* FIXME: MFTMirr update is broken in libntfs */ + if (ni->mft_no <= LAST_METADATA_INODE) + return; + + unused = m->bytes_allocated - m->bytes_in_use; + wiped_unused_mft_data += wipe_data((char *)m, m->bytes_in_use, unused); +} + +void wipe_unused_mft(ntfs_inode *ni) +{ + int unused; + MFT_RECORD *m = ni->mrec; + + /* FIXME: MFTMirr update is broken in libntfs */ + if (ni->mft_no <= LAST_METADATA_INODE) + return; + + /* MFT_RECORD doesn't have the XP specific 6 bytes, so add it */ + unused = m->bytes_in_use - (sizeof(MFT_RECORD) + 6); + wiped_unused_mft += wipe_data((char *)m, sizeof(MFT_RECORD), unused); +} + + +int walk_clusters(ntfs_volume *vol, struct ntfs_walk_cluster *walk) +{ + s64 inode = 0; + s64 last_mft_rec; + ntfs_inode *ni; + struct progress_bar progress; + + Printf("Scanning volume ...\n"); + + last_mft_rec = vol->nr_mft_records - 1; + progress_init(&progress, inode, last_mft_rec, 100); + + for (; inode <= last_mft_rec; inode++) { + + int err, deleted_inode; + MFT_REF mref = (MFT_REF)inode; + + progress_update(&progress, inode); + + /* FIXME: Terribe kludge for libntfs not being able to return + a deleted MFT record as inode */ + ni = (ntfs_inode*)calloc(1, sizeof(ntfs_inode)); + if (!ni) + perr_exit("walk_clusters"); + + ni->vol = vol; + + err = ntfs_file_record_read(vol, mref, &ni->mrec, NULL); + if (err == -1) { + free(ni); + continue; + } + + deleted_inode = !(ni->mrec->flags & MFT_RECORD_IN_USE); + + if (deleted_inode) { + + ni->mft_no = MREF(mref); + if (wipe) { + wipe_unused_mft(ni); + wipe_unused_mft_data(ni); + if (ntfs_mft_record_write(vol, ni->mft_no, ni->mrec)) + perr_exit("ntfs_mft_record_write"); + } + } + + if (ni->mrec) + free(ni->mrec); + free(ni); + + if (deleted_inode) + continue; + + if ((ni = ntfs_inode_open(vol, mref)) == NULL) { + /* FIXME: continue only if it make sense, e.g. + MFT record not in use based on $MFT bitmap */ + if (errno == EIO || errno == ENOENT) + continue; + perr_exit("Reading inode %lld failed", inode); + } + + if (wipe) + nr_used_mft_records++; + + if ((ni->mrec->base_mft_record) != 0) + goto out; + + walk->image->ni = ni; + walk_attributes(walk); +out: + if (wipe) { + wipe_unused_mft_data(ni); + if (ntfs_mft_record_write(vol, ni->mft_no, ni->mrec)) + perr_exit("ntfs_mft_record_write"); + } + + if (ntfs_inode_close(ni)) + perr_exit("ntfs_inode_close for inode %Ld", inode); + } + + return 0; +} + + +/* + * $Bitmap can overlap the end of the volume. Any bits in this region + * must be set. This region also encompasses the backup boot sector. + */ +void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) +{ + for (; cluster < bm->size << 3; cluster++) + ntfs_bit_set(bm->bm, (u64)cluster, 1); +} + + +/* + * Allocate a block of memory with one bit for each cluster of the disk. + * All the bits are set to 0, except those representing the region beyond the + * end of the disk. + */ +void setup_lcn_bitmap() +{ + /* Determine lcn bitmap byte size and allocate it. */ + lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); + + if (!(lcn_bitmap.bm = (unsigned char *)calloc(1, lcn_bitmap.size))) + perr_exit("Failed to allocate internal buffer"); + + bitmap_file_data_fixup(vol->nr_clusters, &lcn_bitmap); +} + + +s64 volume_size(ntfs_volume *vol, s64 nr_clusters) +{ + return nr_clusters * vol->cluster_size; +} + + +void print_volume_size(char *str, s64 bytes) +{ + Printf("%s: %lld bytes (%lld MB)\n", + str, bytes, rounded_up_division(bytes, NTFS_MBYTE)); +} + + +void print_disk_usage(ntfs_walk_clusters_ctx *image) +{ + s64 total, used, free; + + total = vol->nr_clusters * vol->cluster_size; + used = image->inuse * vol->cluster_size; + free = total - used; + + Printf("Space in use : %lld MB (%.1f%%) ", + rounded_up_division(used, NTFS_MBYTE), + 100.0 * ((float)used / total)); + + Printf("\n"); +} + +/** + * First perform some checks to determine if the volume is already mounted, or + * is dirty (Windows wasn't shutdown properly). If everything is OK, then mount + * the volume (load the metadata into memory). + */ +void mount_volume(unsigned long new_mntflag) +{ + unsigned long mntflag; + + if (ntfs_check_if_mounted(opt.volume, &mntflag)) + perr_exit("Failed to check '%s' mount state", opt.volume); + + if (mntflag & NTFS_MF_MOUNTED) { + if (!(mntflag & NTFS_MF_READONLY)) + err_exit("Device %s is mounted read-write. " + "You must 'umount' it first.\n", opt.volume); + if (!new_mntflag) + err_exit("Device %s is mounted. " + "You must 'umount' it first.\n", opt.volume); + } + + if (!(vol = ntfs_mount(opt.volume, new_mntflag))) { + + int err = errno; + + perr_printf("ntfs_mount failed"); + if (err == EINVAL) { + Printf("Apparently device '%s' doesn't have a " + "valid NTFS. Maybe you selected\nthe whole " + "disk instead of a partition (e.g. /dev/hda, " + "not /dev/hda1)?\n", opt.volume); + } + exit(1); + } + + if (vol->flags & VOLUME_IS_DIRTY) + if (opt.force-- <= 0) + err_exit("Volume is dirty. Run chkdsk and " + "please try again (or see -f option).\n"); + + if (NTFS_MAX_CLUSTER_SIZE < vol->cluster_size) + err_exit("Cluster size %u is too large!\n", vol->cluster_size); + + Printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); + if (ntfs_version_is_supported(vol)) + perr_exit("Unknown NTFS version"); + + Printf("Cluster size : %u bytes\n", vol->cluster_size); + print_volume_size("Current volume size", + volume_size(vol, vol->nr_clusters)); +} + +struct ntfs_walk_cluster backup_clusters = { NULL, NULL }; + + +int main(int argc, char **argv) +{ + ntfs_walk_clusters_ctx image; + s64 device_size; /* in bytes */ + int flags, wiped_total = 0; + + /* print to stderr, stdout can be an NTFS image ... */ + Eprintf("%s v%s\n", EXEC_NAME, VERSION); + msg_out = stderr; + + parse_options(argc, argv); + + utils_set_locale(); + + mount_volume(MS_RDONLY); + + device_size = ntfs_device_size_get(vol->fd, vol->sector_size); + device_size *= vol->sector_size; + if (device_size <= 0) + err_exit("Couldn't get device size (%Ld)!\n", device_size); + + print_volume_size("Current device size", device_size); + + if (device_size < vol->nr_clusters * vol->cluster_size) + err_exit("Current NTFS volume size is bigger than the device " + "size (%Ld)!\nCorrupt partition table or incorrect " + "device partitioning?\n", device_size); + + if (opt.stdout) { + if ((fd_out = fileno(stdout)) == -1) + perr_exit("fileno for stdout failed"); + } else { + flags = O_CREAT | O_TRUNC | O_WRONLY; + if (!opt.overwrite) + flags |= O_EXCL; + + if ((fd_out = open(opt.output, flags, S_IRWXU)) == -1) + perr_exit("opening file '%s' failed", opt.output); + + if (ftruncate(fd_out, device_size) == -1) + perr_exit("ftruncate failed for file '%s'", opt.output); + } + + setup_lcn_bitmap(); + memset(&image, 0, sizeof(image)); + backup_clusters.image = ℑ + + walk_clusters(vol, &backup_clusters); + compare_bitmaps(&lcn_bitmap); + print_disk_usage(&image); + + free(lcn_bitmap.bm); + + /* FIXME: save backup boot sector */ + + if (opt.stdout) { + dump_to_stdout(); + fsync(fd_out); + exit(0); + } + + Printf("Syncing image file ...\n"); + if (fsync(fd_out) == -1) + perr_exit("fsync"); + + if (!opt.metadata_only) + exit(0); + + wipe = 1; + opt.volume = opt.output; + mount_volume(0); + + setup_lcn_bitmap(); + memset(&image, 0, sizeof(image)); + backup_clusters.image = ℑ + + walk_clusters(vol, &backup_clusters); + + Printf("Num of MFT records = %8Ld\n", vol->nr_mft_records); + Printf("Num of used MFT records = %8d\n", nr_used_mft_records); + + Printf("Wiped unused MFT data = %8d\n", wiped_unused_mft_data); + Printf("Wiped deleted MFT data = %8d\n", wiped_unused_mft); + Printf("Wiped resident user data = %8d\n", wiped_resident_data); + Printf("Wiped timestamp data = %8d\n", wiped_timestamp_data); + + wiped_total += wiped_unused_mft_data; + wiped_total += wiped_unused_mft; + wiped_total += wiped_resident_data; + wiped_total += wiped_timestamp_data; + Printf("Wiped totally = %8d\n", wiped_total); + + exit(0); +} + From f6f76eb44db2b956a2a9441b5597f814f9662d97 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 11 Apr 2003 13:08:52 +0000 Subject: [PATCH 0526/2994] Add ntfsclone to build. (Logical change 1.134) --- ntfsprogs/Makefile.am | 6 +++++- ntfsprogs/Makefile.in | 23 ++++++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index f675da67..38133918 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -20,7 +20,7 @@ LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfscluster +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfscluster ntfsclone man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 @@ -59,6 +59,10 @@ ntfsresize_LDFLAGS = $(AM_LFLAGS) # We don't distribute these +ntfsclone_SOURCES = ntfsclone.c utils.c utils.h +ntfsclone_LDADD = $(AM_LIBS) +ntfsclone_LDFLAGS = $(AM_LFLAGS) + ntfscluster_SOURCES = ntfscluster.c ntfscluster.h utils.c utils.h ntfscluster_LDADD = $(AM_LIBS) ntfscluster_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index fc189524..e1ad4b3a 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -102,7 +102,7 @@ LINK = $(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfscluster +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfscluster ntfsclone man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 @@ -142,6 +142,10 @@ ntfsresize_LDFLAGS = $(AM_LFLAGS) # We don't distribute these +ntfsclone_SOURCES = ntfsclone.c utils.c utils.h +ntfsclone_LDADD = $(AM_LIBS) +ntfsclone_LDFLAGS = $(AM_LFLAGS) + ntfscluster_SOURCES = ntfscluster.c ntfscluster.h utils.c utils.h ntfscluster_LDADD = $(AM_LIBS) ntfscluster_LDFLAGS = $(AM_LFLAGS) @@ -199,6 +203,11 @@ ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) utils.$(OBJEXT) @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@ntfscluster_DEPENDENCIES = \ @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a +ntfsclone_OBJECTS = ntfsclone.$(OBJEXT) utils.$(OBJEXT) +@REALLYSTATIC_FALSE@ntfsclone_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@ntfsclone_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) @REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la @@ -247,12 +256,12 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = gtar GZIP_ENV = --best DEP_FILES = .deps/attrdef.P .deps/boot.P .deps/dumplog.P .deps/mkntfs.P \ -.deps/ntfscluster.P .deps/ntfsdump_logfile.P .deps/ntfsfix.P \ -.deps/ntfsinfo.P .deps/ntfslabel.P .deps/ntfsresize.P \ +.deps/ntfsclone.P .deps/ntfscluster.P .deps/ntfsdump_logfile.P \ +.deps/ntfsfix.P .deps/ntfsinfo.P .deps/ntfslabel.P .deps/ntfsresize.P \ .deps/ntfstruncate.P .deps/ntfsundelete.P .deps/ntfswipe.P .deps/sd.P \ .deps/upcase.P .deps/utils.P -SOURCES = $(ntfsdump_logfile_SOURCES) $(dumplog_SOURCES) $(ntfswipe_SOURCES) $(ntfstruncate_SOURCES) $(ntfscluster_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(ntfsundelete_SOURCES) $(ntfsresize_SOURCES) -OBJECTS = $(ntfsdump_logfile_OBJECTS) $(dumplog_OBJECTS) $(ntfswipe_OBJECTS) $(ntfstruncate_OBJECTS) $(ntfscluster_OBJECTS) $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(ntfsundelete_OBJECTS) $(ntfsresize_OBJECTS) +SOURCES = $(ntfsdump_logfile_SOURCES) $(dumplog_SOURCES) $(ntfswipe_SOURCES) $(ntfstruncate_SOURCES) $(ntfscluster_SOURCES) $(ntfsclone_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(ntfsundelete_SOURCES) $(ntfsresize_SOURCES) +OBJECTS = $(ntfsdump_logfile_OBJECTS) $(dumplog_OBJECTS) $(ntfswipe_OBJECTS) $(ntfstruncate_OBJECTS) $(ntfscluster_OBJECTS) $(ntfsclone_OBJECTS) $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(ntfsundelete_OBJECTS) $(ntfsresize_OBJECTS) all: all-redirect .SUFFIXES: @@ -387,6 +396,10 @@ ntfscluster$(EXEEXT): $(ntfscluster_OBJECTS) $(ntfscluster_DEPENDENCIES) @rm -f ntfscluster$(EXEEXT) $(LINK) $(ntfscluster_LDFLAGS) $(ntfscluster_OBJECTS) $(ntfscluster_LDADD) $(LIBS) +ntfsclone$(EXEEXT): $(ntfsclone_OBJECTS) $(ntfsclone_DEPENDENCIES) + @rm -f ntfsclone$(EXEEXT) + $(LINK) $(ntfsclone_LDFLAGS) $(ntfsclone_OBJECTS) $(ntfsclone_LDADD) $(LIBS) + ntfsfix$(EXEEXT): $(ntfsfix_OBJECTS) $(ntfsfix_DEPENDENCIES) @rm -f ntfsfix$(EXEEXT) $(LINK) $(ntfsfix_LDFLAGS) $(ntfsfix_OBJECTS) $(ntfsfix_LDADD) $(LIBS) From d701a635bcd3ef72fc8968b2ea397f773a73cf94 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 11 Apr 2003 13:08:52 +0000 Subject: [PATCH 0527/2994] Add ntfsclone to build. (Written by Szaka) BKrev: 3e96be64BTFegLfn_6RpDiEI8NG3KQ From 44c49c55e5c59b3c28a7211c061b9349a5a6acad Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 11 Apr 2003 13:08:52 +0000 Subject: [PATCH 0528/2994] Initial revision --- ntfsprogs/ntfsclone.c | 933 ------------------------------------------ 1 file changed, 933 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 88126ff8..e69de29b 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1,933 +0,0 @@ -/** - * ntfsclone - Part of the Linux-NTFS project. - * - * Copyright (c) 2003 Szabolcs Szakacsits - * - * ntfsclone clones NTFS data and/or metadata to a sparse file or stdout. - * - * 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 of the License, or - * (at your option) any later version. - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "debug.h" -#include "types.h" -#include "support.h" -#include "endians.h" -#include "bootsect.h" -#include "disk_io.h" -#include "attrib.h" -#include "volume.h" -#include "mft.h" -#include "bitmap.h" -#include "inode.h" -#include "runlist.h" -#include "utils.h" - -static const char *EXEC_NAME = "ntfsclone"; - -struct { - int verbose; - int quiet; - int debug; - int force; - int overwrite; - int stdout; - int metadata_only; - char *output; - char *volume; -} opt; - -struct bitmap { - u8 *bm; - s64 size; -}; - -struct progress_bar { - u64 start; - u64 stop; - int resolution; - float unit; -}; - -struct __ntfs_walk_clusters_ctx { - ntfs_inode *ni; /* inode being processed */ - ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ - u64 inuse; /* number of clusters in use */ -}; - -typedef struct __ntfs_walk_clusters_ctx ntfs_walk_clusters_ctx; -typedef int (ntfs_walk_op)(ntfs_inode *ni, void *data); - -struct ntfs_walk_cluster { - ntfs_walk_op *inode_op; /* not implemented yet */ - ntfs_walk_clusters_ctx *image; -}; - - -ntfs_volume *vol = NULL; -struct bitmap lcn_bitmap; - -int fd_out; -FILE *msg_out = NULL; - -int nr_used_mft_records = 0; -int wipe = 0; -int wiped_unused_mft_data = 0; -int wiped_unused_mft = 0; -int wiped_resident_data = 0; -int wiped_timestamp_data = 0; - -#define NTFS_MBYTE (1000 * 1000) - -#define ERR_PREFIX "ERROR" -#define PERR_PREFIX ERR_PREFIX "(%d): " -#define NERR_PREFIX ERR_PREFIX ": " - -#define LAST_METADATA_INODE 11 - -#define NTFS_MAX_CLUSTER_SIZE 65536 - -#define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) - -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, msg_out, &opt.verbose, TRUE) -GEN_PRINTF(Qprintf, msg_out, &opt.quiet, FALSE) -GEN_PRINTF(Printf, msg_out, NULL, FALSE) - - -void perr_printf(const char *fmt, ...) -{ - va_list ap; - int eo = errno; - - Printf(PERR_PREFIX, eo); - va_start(ap, fmt); - vfprintf(msg_out, fmt, ap); - va_end(ap); - Printf(": %s\n", strerror(eo)); - fflush(msg_out); -} - -void err_printf(const char *fmt, ...) -{ - va_list ap; - - Printf(NERR_PREFIX); - va_start(ap, fmt); - vfprintf(msg_out, fmt, ap); - va_end(ap); - fflush(msg_out); -} - -int err_exit(const char *fmt, ...) -{ - va_list ap; - - Printf(NERR_PREFIX); - va_start(ap, fmt); - vfprintf(msg_out, fmt, ap); - va_end(ap); - fflush(msg_out); - exit(1); -} - - -int perr_exit(const char *fmt, ...) -{ - va_list ap; - int eo = errno; - - Printf(PERR_PREFIX, eo); - va_start(ap, fmt); - vfprintf(msg_out, fmt, ap); - va_end(ap); - Printf(": %s\n", strerror(eo)); - fflush(msg_out); - exit(1); -} - - -void usage() -{ - Eprintf("\nUsage: %s [options] device\n" - " Clone NTFS data to a sparse file or send it to stdout.\n" - "\n" - " -o FILE --output FILE Clone NTFS to the non-existent FILE\n" - " -O FILE Clone NTFS to FILE, overwriting if exists\n" - " -m --metadata Clone *only* metadata (for NTFS experts)\n" - " -f --force Force to progress (DANGEROUS)\n" - " -h --help Display this help\n" -#ifdef DEBUG - " -d --debug Show debug information\n" -#endif - "\n" - " If FILE is '-' then send NTFS data to stdout replacing non used\n" - " NTFS and partition space with zeros.\n" - "\n", EXEC_NAME); - Eprintf("%s%s\n", ntfs_bugs, ntfs_home); - exit(1); -} - - -void parse_options(int argc, char **argv) -{ - static const char *sopt = "-dfhmo:O:"; - static const struct option lopt[] = { -#ifdef DEBUG - { "debug", no_argument, NULL, 'd' }, -#endif - { "force", no_argument, NULL, 'f' }, - { "help", no_argument, NULL, 'h' }, - { "metadata", no_argument, NULL, 'm' }, - { "output", required_argument, NULL, 'o' }, - { NULL, 0, NULL, 0 } - }; - - char c; - - memset(&opt, 0, sizeof(opt)); - - while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { - switch (c) { - case 1: /* A non-option argument */ - if (opt.volume) - usage(); - opt.volume = argv[optind-1]; - break; - case 'd': - opt.debug++; - break; - case 'f': - opt.force++; - break; - case 'h': - case '?': - usage(); - case 'm': - opt.metadata_only++; - break; - case 'O': - opt.overwrite++; - case 'o': - if (opt.output) - usage(); - opt.output = argv[optind-1]; - break; - default: - err_printf("Unknown option '%s'.\n", argv[optind-1]); - usage(); - } - } - - if (opt.output == NULL) { - err_printf("You must specify an output file.\n"); - usage(); - } - - if (strcmp(opt.output, "-") == 0) - opt.stdout++; - - if (opt.volume == NULL) { - err_printf("You must specify a device file.\n"); - usage(); - } - - if (opt.metadata_only && opt.stdout) - err_exit("Cloning only metadata to stdout isn't supported yet!\n"); - - msg_out = stdout; - - /* FIXME: this is a workaround for loosing debug info if stdout != stderr - and for the uncontrollable verbose messages in libntfs. Ughhh. */ - if (opt.stdout) - msg_out = stderr; - else if (opt.debug) - stderr = stdout; - else - if (!(stderr = fopen("/dev/null", "rw"))) - perr_exit("Couldn't open /dev/null"); -} - - -/** - * nr_clusters_to_bitmap_byte_size - * - * Take the number of clusters in the volume and calculate the size of $Bitmap. - * The size will always be a multiple of 8 bytes. - */ -s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) -{ - s64 bm_bsize; - - bm_bsize = rounded_up_division(nr_clusters, 8); - - bm_bsize = (bm_bsize + 7) & ~7; - Dprintf("Bitmap byte size : %lld (%lld clusters)\n", - bm_bsize, rounded_up_division(bm_bsize, vol->cluster_size)); - - return bm_bsize; -} - -int is_critical_meatadata(ntfs_walk_clusters_ctx *image) -{ - s64 inode; - - inode = image->ni->mft_no; - - if (inode <= LAST_METADATA_INODE) - if (inode != FILE_LogFile) - return 1; - - if (image->ctx->attr->type != AT_DATA) - return 1; - - return 0; -} - -void write_cluster(const char *buff) -{ - int count; - - if ((count = write(fd_out, buff, vol->cluster_size)) == -1) - perr_exit("write"); - - if (count != vol->cluster_size) - err_exit("Partial write not yet handled\n"); -} - -void copy_cluster() -{ - int count; - char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ - - /* FIXME: handle partial read/writes */ - if ((count = read(vol->fd, buff, vol->cluster_size)) == -1) - perr_exit("read"); - - if (count != vol->cluster_size) - err_exit("Partial read not yet handled\n"); - - write_cluster(buff); -} - -void lseek_to_cluster(s64 lcn) -{ - off_t pos; - - pos = (off_t)(lcn * vol->cluster_size); - - if (lseek(vol->fd, pos, SEEK_SET) == (off_t)-1) - perr_exit("lseek input"); - - if (opt.stdout) - return; - - if (lseek(fd_out, pos, SEEK_SET) == (off_t)-1) - perr_exit("lseek output"); -} - -void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) -{ - int i; - - if (opt.stdout) - return; - - if (opt.metadata_only && !is_critical_meatadata(image)) - return; - - lseek_to_cluster(rl->lcn); - - /* FIXME: this could give pretty suboptimal performance */ - for (i = 0; i < rl->length; i++) - copy_cluster(); -} - -void dump_to_stdout() -{ - s64 i, pos, count; - u8 bm[NTFS_BUF_SIZE]; - void *buff; - - Printf("Dumping NTFS to stdout ...\n"); - - if ((buff = calloc(1, vol->cluster_size)) == NULL) - perr_exit("dump_to_stdout"); - - pos = 0; - while (1) { - count = ntfs_attr_pread(vol->lcnbmp_na, pos, NTFS_BUF_SIZE, bm); - if (count == -1) - perr_exit("Couldn't read $Bitmap (pos = %Ld)\n", pos); - - if (count == 0) - return; - - for (i = 0; i < count; i++, pos++) { - u64 cl; /* current cluster */ - - for (cl = pos * 8; cl < (pos + 1) * 8; cl++) { - - if (cl > vol->nr_clusters - 1) - return; - - if (ntfs_bit_get(bm, i * 8 + cl % 8)) { - lseek_to_cluster(cl); - copy_cluster(); - } else - write_cluster(buff); - } - } - } -} - -#define WIPE_TIMESTAMPS(atype, attr) \ -do { \ - atype *ats; \ - ats = (atype *)((char*)(attr) + (attr)->value_offset); \ - \ - ats->creation_time = 0; \ - ats->last_data_change_time = 0; \ - ats->last_mft_change_time= 0; \ - ats->last_access_time = 0; \ - \ - wiped_timestamp_data += 32; \ - \ -} while(0) - -void wipe_timestamps(ntfs_walk_clusters_ctx *image) -{ - ATTR_RECORD *a = image->ctx->attr; - - if (image->ni->mft_no <= LAST_METADATA_INODE) - return; - - if (a->type == AT_FILE_NAME) - WIPE_TIMESTAMPS(FILE_NAME_ATTR, a); - - else if (a->type == AT_STANDARD_INFORMATION) - WIPE_TIMESTAMPS(STANDARD_INFORMATION, a); -} - -void wipe_resident_data(ntfs_walk_clusters_ctx *image) -{ - ATTR_RECORD *a; - int i, n = 0; - char *p; - - a = image->ctx->attr; - p = (char *)a + a->value_offset; - - if (image->ni->mft_no <= LAST_METADATA_INODE) - return; - - if (a->type != AT_DATA) - return; - - for (i = 0; i < a->value_length; i++) { - if (p[i]) { - p[i] = 0; - n++; - } - } - - wiped_resident_data += n; -} - -void walk_runs(struct ntfs_walk_cluster *walk) -{ - int i, j; - runlist *rl; - ATTR_RECORD *a; - ntfs_attr_search_ctx *ctx; - - ctx = walk->image->ctx; - a = ctx->attr; - - if (!a->non_resident) { - if (wipe) { - wipe_resident_data(walk->image); - wipe_timestamps(walk->image); - } - return; - } - - if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) - perr_exit("ntfs_decompress_mapping_pairs"); - - for (i = 0; rl[i].length; i++) { - s64 lcn = rl[i].lcn; - s64 lcn_length = rl[i].length; - - if (lcn == LCN_HOLE || lcn == LCN_RL_NOT_MAPPED) - continue; - - /* FIXME: ntfs_mapping_pairs_decompress should return error */ - if (lcn < 0 || lcn_length < 0) - err_exit("Corrupt runlist in inode %lld attr %x LCN " - "%llx length %llx\n", ctx->ntfs_ino->mft_no, - le32_to_cpu (a->type), lcn, lcn_length); - - if (!wipe) - dump_clusters(walk->image, rl + i); - - for (j = 0; j < lcn_length; j++) { - u64 k = (u64)lcn + j; - if (ntfs_bit_get_and_set(lcn_bitmap.bm, k, 1)) - err_exit("Cluster %lu referenced twice!\n" - "You didn't shutdown your Windows" - "properly?\n", k); - } - - walk->image->inuse += lcn_length; - } - - free(rl); -} - - -void walk_attributes(struct ntfs_walk_cluster *walk) -{ - ntfs_attr_search_ctx *ctx; - - if (!(ctx = ntfs_attr_get_search_ctx(walk->image->ni, NULL))) - perr_exit("ntfs_get_attr_search_ctx"); - - while (!ntfs_attrs_walk(ctx)) { - if (ctx->attr->type == AT_END) - break; - - walk->image->ctx = ctx; - walk_runs(walk); - } - - ntfs_attr_put_search_ctx(ctx); -} - - - -void compare_bitmaps(struct bitmap *a) -{ - s64 i, pos, count; - int mismatch = 0; - u8 bm[NTFS_BUF_SIZE]; - - Printf("Accounting clusters ...\n"); - - pos = 0; - while (1) { - count = ntfs_attr_pread(vol->lcnbmp_na, pos, NTFS_BUF_SIZE, bm); - if (count == -1) - perr_exit("Couldn't get $Bitmap $DATA"); - - if (count == 0) { - if (a->size != pos) - err_exit("$Bitmap file size doesn't match " - "calculated size (%Ld != %Ld)\n", - a->size, pos); - break; - } - - for (i = 0; i < count; i++, pos++) { - u64 cl; /* current cluster */ - - if (a->bm[pos] == bm[i]) - continue; - - for (cl = pos * 8; cl < (pos + 1) * 8; cl++) { - char bit; - - bit = ntfs_bit_get(a->bm, cl); - if (bit == ntfs_bit_get(bm, i * 8 + cl % 8)) - continue; - - if (++mismatch > 10) - continue; - - Printf("Cluster accounting failed at %Lu " - "(0x%Lx): %s cluster in $Bitmap\n", - cl, cl, bit ? "missing" : "extra"); - } - } - } - - if (mismatch) { - Printf("Totally %d cluster accounting mismatches.\n", - mismatch); - err_exit("Filesystem check failed! Windows wasn't shutdown " - "properly or inconsistent\nfilesystem. Please run " - "chkdsk on Windows.\n"); - } -} - - -void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) -{ - p->start = start; - p->stop = stop; - p->unit = 100.0 / (stop - start); - p->resolution = res; -} - - -void progress_update(struct progress_bar *p, u64 current) -{ - float percent = p->unit * current; - - if (current != p->stop) { - if ((current - p->start) % p->resolution) - return; - Printf("%6.2f percent completed\r", percent); - } else - Printf("100.00 percent completed\n"); - fflush(msg_out); -} - -int wipe_data(char *p, int pos, int len) -{ - int wiped = 0; - - p += pos; - for (; len > 0; len--) { - if (p[len]) { - p[len] = 0; - wiped++; - } - } - - return wiped; -} - -void wipe_unused_mft_data(ntfs_inode *ni) -{ - int unused; - MFT_RECORD *m = ni->mrec; - - /* FIXME: MFTMirr update is broken in libntfs */ - if (ni->mft_no <= LAST_METADATA_INODE) - return; - - unused = m->bytes_allocated - m->bytes_in_use; - wiped_unused_mft_data += wipe_data((char *)m, m->bytes_in_use, unused); -} - -void wipe_unused_mft(ntfs_inode *ni) -{ - int unused; - MFT_RECORD *m = ni->mrec; - - /* FIXME: MFTMirr update is broken in libntfs */ - if (ni->mft_no <= LAST_METADATA_INODE) - return; - - /* MFT_RECORD doesn't have the XP specific 6 bytes, so add it */ - unused = m->bytes_in_use - (sizeof(MFT_RECORD) + 6); - wiped_unused_mft += wipe_data((char *)m, sizeof(MFT_RECORD), unused); -} - - -int walk_clusters(ntfs_volume *vol, struct ntfs_walk_cluster *walk) -{ - s64 inode = 0; - s64 last_mft_rec; - ntfs_inode *ni; - struct progress_bar progress; - - Printf("Scanning volume ...\n"); - - last_mft_rec = vol->nr_mft_records - 1; - progress_init(&progress, inode, last_mft_rec, 100); - - for (; inode <= last_mft_rec; inode++) { - - int err, deleted_inode; - MFT_REF mref = (MFT_REF)inode; - - progress_update(&progress, inode); - - /* FIXME: Terribe kludge for libntfs not being able to return - a deleted MFT record as inode */ - ni = (ntfs_inode*)calloc(1, sizeof(ntfs_inode)); - if (!ni) - perr_exit("walk_clusters"); - - ni->vol = vol; - - err = ntfs_file_record_read(vol, mref, &ni->mrec, NULL); - if (err == -1) { - free(ni); - continue; - } - - deleted_inode = !(ni->mrec->flags & MFT_RECORD_IN_USE); - - if (deleted_inode) { - - ni->mft_no = MREF(mref); - if (wipe) { - wipe_unused_mft(ni); - wipe_unused_mft_data(ni); - if (ntfs_mft_record_write(vol, ni->mft_no, ni->mrec)) - perr_exit("ntfs_mft_record_write"); - } - } - - if (ni->mrec) - free(ni->mrec); - free(ni); - - if (deleted_inode) - continue; - - if ((ni = ntfs_inode_open(vol, mref)) == NULL) { - /* FIXME: continue only if it make sense, e.g. - MFT record not in use based on $MFT bitmap */ - if (errno == EIO || errno == ENOENT) - continue; - perr_exit("Reading inode %lld failed", inode); - } - - if (wipe) - nr_used_mft_records++; - - if ((ni->mrec->base_mft_record) != 0) - goto out; - - walk->image->ni = ni; - walk_attributes(walk); -out: - if (wipe) { - wipe_unused_mft_data(ni); - if (ntfs_mft_record_write(vol, ni->mft_no, ni->mrec)) - perr_exit("ntfs_mft_record_write"); - } - - if (ntfs_inode_close(ni)) - perr_exit("ntfs_inode_close for inode %Ld", inode); - } - - return 0; -} - - -/* - * $Bitmap can overlap the end of the volume. Any bits in this region - * must be set. This region also encompasses the backup boot sector. - */ -void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) -{ - for (; cluster < bm->size << 3; cluster++) - ntfs_bit_set(bm->bm, (u64)cluster, 1); -} - - -/* - * Allocate a block of memory with one bit for each cluster of the disk. - * All the bits are set to 0, except those representing the region beyond the - * end of the disk. - */ -void setup_lcn_bitmap() -{ - /* Determine lcn bitmap byte size and allocate it. */ - lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); - - if (!(lcn_bitmap.bm = (unsigned char *)calloc(1, lcn_bitmap.size))) - perr_exit("Failed to allocate internal buffer"); - - bitmap_file_data_fixup(vol->nr_clusters, &lcn_bitmap); -} - - -s64 volume_size(ntfs_volume *vol, s64 nr_clusters) -{ - return nr_clusters * vol->cluster_size; -} - - -void print_volume_size(char *str, s64 bytes) -{ - Printf("%s: %lld bytes (%lld MB)\n", - str, bytes, rounded_up_division(bytes, NTFS_MBYTE)); -} - - -void print_disk_usage(ntfs_walk_clusters_ctx *image) -{ - s64 total, used, free; - - total = vol->nr_clusters * vol->cluster_size; - used = image->inuse * vol->cluster_size; - free = total - used; - - Printf("Space in use : %lld MB (%.1f%%) ", - rounded_up_division(used, NTFS_MBYTE), - 100.0 * ((float)used / total)); - - Printf("\n"); -} - -/** - * First perform some checks to determine if the volume is already mounted, or - * is dirty (Windows wasn't shutdown properly). If everything is OK, then mount - * the volume (load the metadata into memory). - */ -void mount_volume(unsigned long new_mntflag) -{ - unsigned long mntflag; - - if (ntfs_check_if_mounted(opt.volume, &mntflag)) - perr_exit("Failed to check '%s' mount state", opt.volume); - - if (mntflag & NTFS_MF_MOUNTED) { - if (!(mntflag & NTFS_MF_READONLY)) - err_exit("Device %s is mounted read-write. " - "You must 'umount' it first.\n", opt.volume); - if (!new_mntflag) - err_exit("Device %s is mounted. " - "You must 'umount' it first.\n", opt.volume); - } - - if (!(vol = ntfs_mount(opt.volume, new_mntflag))) { - - int err = errno; - - perr_printf("ntfs_mount failed"); - if (err == EINVAL) { - Printf("Apparently device '%s' doesn't have a " - "valid NTFS. Maybe you selected\nthe whole " - "disk instead of a partition (e.g. /dev/hda, " - "not /dev/hda1)?\n", opt.volume); - } - exit(1); - } - - if (vol->flags & VOLUME_IS_DIRTY) - if (opt.force-- <= 0) - err_exit("Volume is dirty. Run chkdsk and " - "please try again (or see -f option).\n"); - - if (NTFS_MAX_CLUSTER_SIZE < vol->cluster_size) - err_exit("Cluster size %u is too large!\n", vol->cluster_size); - - Printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); - if (ntfs_version_is_supported(vol)) - perr_exit("Unknown NTFS version"); - - Printf("Cluster size : %u bytes\n", vol->cluster_size); - print_volume_size("Current volume size", - volume_size(vol, vol->nr_clusters)); -} - -struct ntfs_walk_cluster backup_clusters = { NULL, NULL }; - - -int main(int argc, char **argv) -{ - ntfs_walk_clusters_ctx image; - s64 device_size; /* in bytes */ - int flags, wiped_total = 0; - - /* print to stderr, stdout can be an NTFS image ... */ - Eprintf("%s v%s\n", EXEC_NAME, VERSION); - msg_out = stderr; - - parse_options(argc, argv); - - utils_set_locale(); - - mount_volume(MS_RDONLY); - - device_size = ntfs_device_size_get(vol->fd, vol->sector_size); - device_size *= vol->sector_size; - if (device_size <= 0) - err_exit("Couldn't get device size (%Ld)!\n", device_size); - - print_volume_size("Current device size", device_size); - - if (device_size < vol->nr_clusters * vol->cluster_size) - err_exit("Current NTFS volume size is bigger than the device " - "size (%Ld)!\nCorrupt partition table or incorrect " - "device partitioning?\n", device_size); - - if (opt.stdout) { - if ((fd_out = fileno(stdout)) == -1) - perr_exit("fileno for stdout failed"); - } else { - flags = O_CREAT | O_TRUNC | O_WRONLY; - if (!opt.overwrite) - flags |= O_EXCL; - - if ((fd_out = open(opt.output, flags, S_IRWXU)) == -1) - perr_exit("opening file '%s' failed", opt.output); - - if (ftruncate(fd_out, device_size) == -1) - perr_exit("ftruncate failed for file '%s'", opt.output); - } - - setup_lcn_bitmap(); - memset(&image, 0, sizeof(image)); - backup_clusters.image = ℑ - - walk_clusters(vol, &backup_clusters); - compare_bitmaps(&lcn_bitmap); - print_disk_usage(&image); - - free(lcn_bitmap.bm); - - /* FIXME: save backup boot sector */ - - if (opt.stdout) { - dump_to_stdout(); - fsync(fd_out); - exit(0); - } - - Printf("Syncing image file ...\n"); - if (fsync(fd_out) == -1) - perr_exit("fsync"); - - if (!opt.metadata_only) - exit(0); - - wipe = 1; - opt.volume = opt.output; - mount_volume(0); - - setup_lcn_bitmap(); - memset(&image, 0, sizeof(image)); - backup_clusters.image = ℑ - - walk_clusters(vol, &backup_clusters); - - Printf("Num of MFT records = %8Ld\n", vol->nr_mft_records); - Printf("Num of used MFT records = %8d\n", nr_used_mft_records); - - Printf("Wiped unused MFT data = %8d\n", wiped_unused_mft_data); - Printf("Wiped deleted MFT data = %8d\n", wiped_unused_mft); - Printf("Wiped resident user data = %8d\n", wiped_resident_data); - Printf("Wiped timestamp data = %8d\n", wiped_timestamp_data); - - wiped_total += wiped_unused_mft_data; - wiped_total += wiped_unused_mft; - wiped_total += wiped_resident_data; - wiped_total += wiped_timestamp_data; - Printf("Wiped totally = %8d\n", wiped_total); - - exit(0); -} - From abea868da4e4e59caf94e8d749c0dcbd72ae1714 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 11 Apr 2003 13:08:52 +0000 Subject: [PATCH 0529/2994] update (Logical change 1.134) --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 34b7285f..deaec2e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -xx/xx/2003 - 1.7.2-WIP - Work in progress. +xx/xx/2003 - 1.8.0-devel - Work in progress. - Further work on attribute resizing. - Fix two logic inversion bugs in dir.c. Thanks to Russ Christensen for finding the first one. - Fix attempt to release I30 internal constant. (Russ Christensen) + - Added ntfsclone utility written by Szabolcs Szakacsits. 13/02/2003 - 1.7.1 - Urgent bug fixes. - Urgent bug fixes in ntfsresize (Szabolcs Szakacsits): From 7599028d3e034a3a3103215376a41f2039668116 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 May 2003 22:03:28 +0000 Subject: [PATCH 0530/2994] Add Ian Jackson. (Logical change 1.135) --- CREDITS | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS b/CREDITS index da8eb06a..918d8331 100644 --- a/CREDITS +++ b/CREDITS @@ -12,6 +12,7 @@ Albert D. Cahalan Russ Christensen Matthew J. Fanto David Martínez Moreno +Ian Jackson Leonard Norrgĺrd Yuri Per Richard Russon From 80487422f7c7ec5057f53f8d0b3caffacc03387f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 May 2003 22:03:28 +0000 Subject: [PATCH 0531/2994] Fix off-by-one error in ntfs_cluster_{read,write}(). (Ian Jackson) (Logical change 1.135) --- libntfs/disk_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index 037fe9ac..e0e04ba5 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -290,7 +290,7 @@ s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, errno = EINVAL; return -1; } - if (vol->nr_clusters <= lcn + count) { + if (vol->nr_clusters < lcn + count) { errno = ESPIPE; return -1; } @@ -323,7 +323,7 @@ s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, errno = EINVAL; return -1; } - if (vol->nr_clusters <= lcn + count) { + if (vol->nr_clusters < lcn + count) { errno = ESPIPE; return -1; } From 96e670b8bc631e35bd9afbe3473871bbbfe5ca45 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 May 2003 22:03:28 +0000 Subject: [PATCH 0532/2994] Merge 2003/05/06 23:02:27+01:00 cantab.net!aia21 Fix off-by-one error in disk_io.c::ntfs_cluster_{read,write}(). (Ian Jackson) BKrev: 3eb83130YNfWULNe96LG63b7et2FOw From be79b3a34a6b915553e7643af0617f661800c883 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 May 2003 22:03:28 +0000 Subject: [PATCH 0533/2994] SCCS merged 2003/05/06 23:01:51+01:00 cantab.net!aia21 Update. (Logical change 1.135) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index deaec2e0..8cfbe946 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ xx/xx/2003 - 1.8.0-devel - Work in progress. - Fix two logic inversion bugs in dir.c. Thanks to Russ Christensen for finding the first one. - Fix attempt to release I30 internal constant. (Russ Christensen) + - Fix off-by-one error in disk_io.c::ntfs_cluster_{read,write}(). (Ian + Jackson) - Added ntfsclone utility written by Szabolcs Szakacsits. 13/02/2003 - 1.7.1 - Urgent bug fixes. From 5389b4d556c3e9bad00e4baa5ecd90c98e1eff26 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0534/2994] (Logical change 1.136) --- depcomp | 423 +++++++++++++++++++++++++++++++++++++++++++++++ libntfs/device.c | 75 +++++++++ 2 files changed, 498 insertions(+) create mode 100755 depcomp create mode 100644 libntfs/device.c diff --git a/depcomp b/depcomp new file mode 100755 index 00000000..807b991f --- /dev/null +++ b/depcomp @@ -0,0 +1,423 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. We will use -o /dev/null later, + # however we can't do the remplacement now because + # `-o $object' might simply not be used + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/libntfs/device.c b/libntfs/device.c new file mode 100644 index 00000000..5f8aa339 --- /dev/null +++ b/libntfs/device.c @@ -0,0 +1,75 @@ +/* + * device.c - Low level device io functions. Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include + +#include "device.h" + +/** + * ntfs_device_alloc - allocate an ntfs device structure and pre-initialize it + * + * Allocate an ntfs device structure and pre-initialize it. + * + * On success return a pointer to the allocated ntfs device structure and on + * error return NULL with errno set to the error code returned by malloc(). + */ +struct ntfs_device *ntfs_device_alloc(void) +{ + struct ntfs_device *dev; + + dev = (struct ntfs_device *)malloc(sizeof(struct ntfs_device)); + if (dev) { + dev->d_ops = NULL; + dev->d_state = 0; + dev->d_name = NULL; + dev->d_private = NULL; + } + return dev; +} + +/** + * ntfs_device_free - free an ntfs device structure + * @dev: ntfs device structure to free + * + * Free the ntfs device structure @dev. + * + * Return 0 on success or -1 on error with errno set to the error code. The + * following error codes are defined: + * EINVAL Invalid pointer @dev. + * EBUSY Device is still open. Close it before freeing it! + */ +int ntfs_device_free(struct ntfs_device *dev) +{ + if (!dev) { + errno = EINVAL; + return -1; + } + if (NDevOpen(dev)) { + errno = EBUSY; + return -1; + } + free(dev); + return 0; +} + From 3d929125faaa355a7ab40c2a8d892eae2328540c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0535/2994] Add device.c. 2003/05/25 20:40:26+01:00 cantab.net!aia21 Add -fms-extensions when compiling with gcc-3.2+. (Logical change 1.136) --- libntfs/Makefile.am | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index dac13aec..9fa298cf 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -27,11 +27,18 @@ LTVERSION = 4:0:0 +# Later gcc require -fms-extensions to work. +if GCC_NEEDS_MS_EXTENSIONS +GCCflag = -fms-extensions +else +GCCflag = +endif + # Need this to enable 64-bit (device) file access functions and parameters. if DEBUG -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG $(GCCflag) else -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall $(GCCflag) endif linux_ntfsincludedir = -I$(top_srcdir)/include @@ -43,6 +50,7 @@ libntfs_la_SOURCES = \ bootsect.c \ compat.c \ debug.c \ + device.c \ dir.c \ disk_io.c \ inode.c \ From bd71015de1ca0d3e2988c1cbfbfc4deb1f4833a3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0536/2994] Add device.h to list of headers. (Logical change 1.136) --- include/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/include/Makefile.am b/include/Makefile.am index c931a13f..201be5fe 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -13,6 +13,7 @@ linux_ntfsinclude_HEADERS = \ bootsect.h \ compat.h \ debug.h \ + device.h \ dir.h \ disk_io.h \ endians.h \ From 6aef27ab97d8ce8c298c47121e46cca4386e346c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0537/2994] Auto merged 2003/05/25 20:40:26+01:00 cantab.net!aia21 Add -fms-extensions when compiling with gcc-3.2+. (Logical change 1.136) --- ntfsprogs/Makefile.am | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 38133918..4e561dcd 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -1,8 +1,15 @@ +# Later gcc require -fms-extensions to work. +if GCC_NEEDS_MS_EXTENSIONS +GCCflag = -fms-extensions +else +GCCflag = +endif + # Need this to enable 64-bit (device) file access functions and parameters. if DEBUG -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG $(GCCflag) else -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall +AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall $(GCCflag) endif if REALLYSTATIC From 9f64f96ee9c624b63d93b70c2311b6f327b1fa95 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0538/2994] Initial revision --- configure.ac | 0 depcomp | 423 ----------------------------------------------- getgccver | 0 include/device.h | 0 libntfs/device.c | 75 --------- 5 files changed, 498 deletions(-) create mode 100644 configure.ac create mode 100755 getgccver create mode 100644 include/device.h diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..e69de29b diff --git a/depcomp b/depcomp index 807b991f..e69de29b 100755 --- a/depcomp +++ b/depcomp @@ -1,423 +0,0 @@ -#! /bin/sh - -# depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 2000 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. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi -# `libtool' can also be set to `yes' or `no'. - -if test -z "$depfile"; then - base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` - dir=`echo "$object" | sed 's,/.*$,/,'` - if test "$dir" = "$object"; then - dir= - fi - # FIXME: should be _deps on DOS. - depfile="$dir.deps/$base" -fi - -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. This file always lives in the current directory. - # Also, the AIX compiler puts `$object:' at the start of each line; - # $object doesn't have directory information. - stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - outname="$stripped.o" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir.libs/$base.d" - "$@" -Wc,-MD - else - tmpdepfile1="$dir$base.o.d" - tmpdepfile2="$dir$base.d" - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - else - tmpdepfile="$tmpdepfile2" - fi - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a space and a tab in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. We will use -o /dev/null later, - # however we can't do the remplacement now because - # `-o $object' might simply not be used - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - -*) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 diff --git a/getgccver b/getgccver new file mode 100755 index 00000000..e69de29b diff --git a/include/device.h b/include/device.h new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/device.c b/libntfs/device.c index 5f8aa339..e69de29b 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -1,75 +0,0 @@ -/* - * device.c - Low level device io functions. Part of the Linux-NTFS project. - * - * Copyright (c) 2003 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include -#include - -#include "device.h" - -/** - * ntfs_device_alloc - allocate an ntfs device structure and pre-initialize it - * - * Allocate an ntfs device structure and pre-initialize it. - * - * On success return a pointer to the allocated ntfs device structure and on - * error return NULL with errno set to the error code returned by malloc(). - */ -struct ntfs_device *ntfs_device_alloc(void) -{ - struct ntfs_device *dev; - - dev = (struct ntfs_device *)malloc(sizeof(struct ntfs_device)); - if (dev) { - dev->d_ops = NULL; - dev->d_state = 0; - dev->d_name = NULL; - dev->d_private = NULL; - } - return dev; -} - -/** - * ntfs_device_free - free an ntfs device structure - * @dev: ntfs device structure to free - * - * Free the ntfs device structure @dev. - * - * Return 0 on success or -1 on error with errno set to the error code. The - * following error codes are defined: - * EINVAL Invalid pointer @dev. - * EBUSY Device is still open. Close it before freeing it! - */ -int ntfs_device_free(struct ntfs_device *dev) -{ - if (!dev) { - errno = EINVAL; - return -1; - } - if (NDevOpen(dev)) { - errno = EBUSY; - return -1; - } - free(dev); - return 0; -} - From c161a9b33edfbedb334d783991c199fe8b7c32d3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0539/2994] Just so it compiles for now until we finish the switch to *dev. 2003/05/25 21:04:53+01:00 cantab.net!aia21 Abstract low level device operations. (Logical change 1.136) --- include/volume.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/volume.h b/include/volume.h index 4820cfd5..bf40633f 100644 --- a/include/volume.h +++ b/include/volume.h @@ -35,6 +35,7 @@ typedef struct _ntfs_volume ntfs_volume; #include "types.h" #include "support.h" #include "inode.h" +#include "device.h" /* * Flags returned by the ntfs_check_if_mounted() function. @@ -86,8 +87,9 @@ typedef enum { * ntfs_volume - structure describing an open volume in memory */ struct _ntfs_volume { - int fd; /* File descriptor associated with volume. */ - char *dev_name; /* Name of the device/file the volume is in. */ + int fd; //FIXME: Remove this. -> Use *dev instead. + char *dev_name; //FIXME: Remove this. -> Use *dev instead. + struct ntfs_device *dev;/* NTFS device associated with the volume. */ char *vol_name; /* Name of the volume. */ unsigned long state; /* NTFS specific flags describing this volume. See ntfs_volume_state_bits above. */ @@ -165,4 +167,3 @@ extern int ntfs_volume_set_flags(ntfs_volume *v, const u16 flags); #endif /* defined _NTFS_VOLUME_H */ - From b38ca6c1d024b041ba819b645b2316022d87ff4b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0540/2994] Make it really work this time... 2003/05/25 20:40:26+01:00 cantab.net!aia21 (Logical change 1.136) --- getgccver | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/getgccver b/getgccver index e69de29b..fd5bffa2 100755 --- a/getgccver +++ b/getgccver @@ -0,0 +1,10 @@ +#!/bin/sh + +if test -z "$1"; then + echo "This program is only to be run by the ./configure script." + exit 1 +fi + +# Get the gcc version. Can't do this in configure.ac as automake refuses to +# preserve the square brackets while generating the configure script. +$1 --version 2>&1 | head -1 | sed s/"egcs-"// | sed s/"gcc (GCC) \([0-9]\.[0-9]*\).*"/"\1"/ From b1e0c54b44c93c457e4d940430781c92755e4510 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0541/2994] Manual merge. 2003/05/25 20:40:26+01:00 cantab.net!aia21 Add -fms-extensions when compiling with gcc-3.2+. (Logical change 1.136) --- ntfsprogs/Makefile.in | 750 ++++++++++++++++++++++-------------------- 1 file changed, 387 insertions(+), 363 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index e1ad4b3a..05ccdb04 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,6 +1,8 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am +# Makefile.in generated by automake 1.6.3 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 +# 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,9 +12,7 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# Need this to enable 64-bit (device) file access functions and parameters. - - +@SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ @@ -33,13 +33,9 @@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include - -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ - top_builddir = .. ACLOCAL = @ACLOCAL@ @@ -47,55 +43,70 @@ 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_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ - NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ AS = @AS@ AUTODIRS = @AUTODIRS@ +AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ +DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ -EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ all_includes = @all_includes@ all_libraries = @all_libraries@ -@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG -@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 -Wall -@REALLYSTATIC_TRUE@AM_LIBS = @REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@AM_LIBS = @REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LFLAGS = @REALLYSTATIC_TRUE@-static -@REALLYSTATIC_FALSE@AM_LFLAGS = @REALLYSTATIC_FALSE@$(all_libraries) -@REALLYSTATIC_TRUE@STATIC_LINK = @REALLYSTATIC_TRUE@$(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -@REALLYSTATIC_FALSE@LIBTOOL_LINK = @REALLYSTATIC_FALSE@$(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +# Later gcc require -fms-extensions to work. +@GCC_NEEDS_MS_EXTENSIONS_TRUE@GCCflag = -fms-extensions +@GCC_NEEDS_MS_EXTENSIONS_FALSE@GCCflag = + +# Need this to enable 64-bit (device) file access functions and parameters. +@DEBUG_TRUE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG $(GCCflag) +@DEBUG_FALSE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall $(GCCflag) + +@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +@REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ # Workaround to make REALLYSTATIC work with automake 1.5. LINK = $(STATIC_LINK) $(LIBTOOL_LINK) @@ -165,206 +176,280 @@ ntfsdump_logfile_LDFLAGS = $(AM_LFLAGS) dumplog_SOURCES = dumplog.c dumplog_LDADD = $(AM_LIBS) dumplog_LDFLAGS = $(AM_LFLAGS) +subdir = ntfsprogs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 \ -ntfsprogs.8 ntfsresize.8 ntfsundelete.8 -bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) -sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ -ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 \ + ntfsprogs.8 ntfsresize.8 ntfsundelete.8 +EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) dumplog$(EXEEXT) \ + ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) ntfscluster$(EXEEXT) +bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) +sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) ntfsundelete$(EXEEXT) \ + ntfsresize$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) +am_dumplog_OBJECTS = dumplog.$(OBJEXT) +dumplog_OBJECTS = $(am_dumplog_OBJECTS) +@REALLYSTATIC_TRUE@dumplog_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@dumplog_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ + sd.$(OBJEXT) mkntfs.$(OBJEXT) utils.$(OBJEXT) +mkntfs_OBJECTS = $(am_mkntfs_OBJECTS) +@REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) utils.$(OBJEXT) +ntfscluster_OBJECTS = $(am_ntfscluster_OBJECTS) +@REALLYSTATIC_TRUE@ntfscluster_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfscluster_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) +ntfsdump_logfile_OBJECTS = $(am_ntfsdump_logfile_OBJECTS) +@REALLYSTATIC_TRUE@ntfsdump_logfile_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) +ntfsfix_OBJECTS = $(am_ntfsfix_OBJECTS) +@REALLYSTATIC_TRUE@ntfsfix_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) utils.$(OBJEXT) +ntfsinfo_OBJECTS = $(am_ntfsinfo_OBJECTS) +@REALLYSTATIC_TRUE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) utils.$(OBJEXT) +ntfslabel_OBJECTS = $(am_ntfslabel_OBJECTS) +@REALLYSTATIC_TRUE@ntfslabel_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) utils.$(OBJEXT) +ntfsresize_OBJECTS = $(am_ntfsresize_OBJECTS) +@REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) \ + utils.$(OBJEXT) +ntfstruncate_OBJECTS = $(am_ntfstruncate_OBJECTS) +@REALLYSTATIC_TRUE@ntfstruncate_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfstruncate_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) +ntfsundelete_OBJECTS = $(am_ntfsundelete_OBJECTS) +@REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) +ntfswipe_OBJECTS = $(am_ntfswipe_OBJECTS) +@REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) LIBS = @LIBS@ -ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfsdump_logfile_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -dumplog_OBJECTS = dumplog.$(OBJEXT) -@REALLYSTATIC_FALSE@dumplog_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@dumplog_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) \ -utils.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfstruncate_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfstruncate_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfscluster_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfscluster_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsclone_OBJECTS = ntfsclone.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsclone_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfsclone_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfsfix_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfsinfo_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ -sd.$(OBJEXT) mkntfs.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfslabel_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) utils.$(OBJEXT) -@REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@$(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@$(top_srcdir)/libntfs/.libs/libntfs.a -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrdef.Po ./$(DEPDIR)/boot.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/dumplog.Po ./$(DEPDIR)/mkntfs.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfscluster.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsclone.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsdump_logfile.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsfix.Po ./$(DEPDIR)/ntfsinfo.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfslabel.Po ./$(DEPDIR)/ntfsresize.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfstruncate.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsundelete.Po ./$(DEPDIR)/ntfswipe.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/sd.Po ./$(DEPDIR)/upcase.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/utils.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -man8dir = $(mandir)/man8 -MANS = $(man_MANS) +DIST_SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) \ + $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) \ + $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) \ + $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) \ + $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) NROFF = nroff -DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsfix.8.in \ -ntfsinfo.8.in ntfslabel.8.in ntfsprogs.8.in ntfsresize.8.in \ -ntfsundelete.8.in +MANS = $(man_MANS) +DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsfix.8.in \ + ntfsinfo.8.in ntfslabel.8.in ntfsprogs.8.in ntfsresize.8.in \ + ntfsundelete.8.in +SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) +all: all-am -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -DEP_FILES = .deps/attrdef.P .deps/boot.P .deps/dumplog.P .deps/mkntfs.P \ -.deps/ntfsclone.P .deps/ntfscluster.P .deps/ntfsdump_logfile.P \ -.deps/ntfsfix.P .deps/ntfsinfo.P .deps/ntfslabel.P .deps/ntfsresize.P \ -.deps/ntfstruncate.P .deps/ntfsundelete.P .deps/ntfswipe.P .deps/sd.P \ -.deps/upcase.P .deps/utils.P -SOURCES = $(ntfsdump_logfile_SOURCES) $(dumplog_SOURCES) $(ntfswipe_SOURCES) $(ntfstruncate_SOURCES) $(ntfscluster_SOURCES) $(ntfsclone_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(ntfsundelete_SOURCES) $(ntfsresize_SOURCES) -OBJECTS = $(ntfsdump_logfile_OBJECTS) $(dumplog_OBJECTS) $(ntfswipe_OBJECTS) $(ntfstruncate_OBJECTS) $(ntfscluster_OBJECTS) $(ntfsclone_OBJECTS) $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(ntfsundelete_OBJECTS) $(ntfsresize_OBJECTS) - -all: all-redirect .SUFFIXES: -.SUFFIXES: .S .c .lo .o .obj .s -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu ntfsprogs/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu ntfsprogs/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) mkntfs.8: $(top_builddir)/config.status mkntfs.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsfix.8: $(top_builddir)/config.status ntfsfix.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsinfo.8: $(top_builddir)/config.status ntfsinfo.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfslabel.8: $(top_builddir)/config.status ntfslabel.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsprogs.8: $(top_builddir)/config.status ntfsprogs.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsresize.8: $(top_builddir)/config.status ntfsresize.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsundelete.8: $(top_builddir)/config.status ntfsundelete.8.in - cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - -mostlyclean-binPROGRAMS: - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) - -distclean-binPROGRAMS: - -maintainer-clean-binPROGRAMS: - + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) - list='$(bin_PROGRAMS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ done -mostlyclean-sbinPROGRAMS: - -clean-sbinPROGRAMS: - -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) - -distclean-sbinPROGRAMS: - -maintainer-clean-sbinPROGRAMS: - +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(sbindir) @list='$(sbin_PROGRAMS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f; \ else :; fi; \ done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) - list='$(sbin_PROGRAMS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \ + rm -f $(DESTDIR)$(sbindir)/$$f; \ done -# FIXME: We should only use cygpath when building on Windows, -# and only if it is available. -.c.obj: - $(COMPILE) -c `cygpath -w $<` - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< +clean-sbinPROGRAMS: + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +dumplog$(EXEEXT): $(dumplog_OBJECTS) $(dumplog_DEPENDENCIES) + @rm -f dumplog$(EXEEXT) + $(LINK) $(dumplog_LDFLAGS) $(dumplog_OBJECTS) $(dumplog_LDADD) $(LIBS) +mkntfs$(EXEEXT): $(mkntfs_OBJECTS) $(mkntfs_DEPENDENCIES) + @rm -f mkntfs$(EXEEXT) + $(LINK) $(mkntfs_LDFLAGS) $(mkntfs_OBJECTS) $(mkntfs_LDADD) $(LIBS) +ntfscluster$(EXEEXT): $(ntfscluster_OBJECTS) $(ntfscluster_DEPENDENCIES) + @rm -f ntfscluster$(EXEEXT) + $(LINK) $(ntfscluster_LDFLAGS) $(ntfscluster_OBJECTS) $(ntfscluster_LDADD) $(LIBS) +ntfsdump_logfile$(EXEEXT): $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_DEPENDENCIES) + @rm -f ntfsdump_logfile$(EXEEXT) + $(LINK) $(ntfsdump_logfile_LDFLAGS) $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_LDADD) $(LIBS) +ntfsfix$(EXEEXT): $(ntfsfix_OBJECTS) $(ntfsfix_DEPENDENCIES) + @rm -f ntfsfix$(EXEEXT) + $(LINK) $(ntfsfix_LDFLAGS) $(ntfsfix_OBJECTS) $(ntfsfix_LDADD) $(LIBS) +ntfsinfo$(EXEEXT): $(ntfsinfo_OBJECTS) $(ntfsinfo_DEPENDENCIES) + @rm -f ntfsinfo$(EXEEXT) + $(LINK) $(ntfsinfo_LDFLAGS) $(ntfsinfo_OBJECTS) $(ntfsinfo_LDADD) $(LIBS) +ntfslabel$(EXEEXT): $(ntfslabel_OBJECTS) $(ntfslabel_DEPENDENCIES) + @rm -f ntfslabel$(EXEEXT) + $(LINK) $(ntfslabel_LDFLAGS) $(ntfslabel_OBJECTS) $(ntfslabel_LDADD) $(LIBS) +ntfsresize$(EXEEXT): $(ntfsresize_OBJECTS) $(ntfsresize_DEPENDENCIES) + @rm -f ntfsresize$(EXEEXT) + $(LINK) $(ntfsresize_LDFLAGS) $(ntfsresize_OBJECTS) $(ntfsresize_LDADD) $(LIBS) +ntfstruncate$(EXEEXT): $(ntfstruncate_OBJECTS) $(ntfstruncate_DEPENDENCIES) + @rm -f ntfstruncate$(EXEEXT) + $(LINK) $(ntfstruncate_LDFLAGS) $(ntfstruncate_OBJECTS) $(ntfstruncate_LDADD) $(LIBS) +ntfsundelete$(EXEEXT): $(ntfsundelete_OBJECTS) $(ntfsundelete_DEPENDENCIES) + @rm -f ntfsundelete$(EXEEXT) + $(LINK) $(ntfsundelete_LDFLAGS) $(ntfsundelete_OBJECTS) $(ntfsundelete_LDADD) $(LIBS) +ntfswipe$(EXEEXT): $(ntfswipe_OBJECTS) $(ntfswipe_DEPENDENCIES) + @rm -f ntfswipe$(EXEEXT) + $(LINK) $(ntfswipe_LDFLAGS) $(ntfswipe_OBJECTS) $(ntfswipe_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.o core *.core - -rm -f *.$(OBJEXT) - -clean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c -maintainer-clean-compile: +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attrdef.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boot.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumplog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkntfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscluster.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsdump_logfile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsfix.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsinfo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfslabel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsresize.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfstruncate.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsundelete.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfswipe.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upcase.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< +distclean-depend: + -rm -rf ./$(DEPDIR) -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< +.c.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` + +.c.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +CCDEPMODE = @CCDEPMODE@ mostlyclean-libtool: -rm -f *.lo @@ -373,61 +458,16 @@ clean-libtool: -rm -rf .libs _libs distclean-libtool: + -rm -f libtool +uninstall-info-am: -maintainer-clean-libtool: - -ntfsdump_logfile$(EXEEXT): $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_DEPENDENCIES) - @rm -f ntfsdump_logfile$(EXEEXT) - $(LINK) $(ntfsdump_logfile_LDFLAGS) $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_LDADD) $(LIBS) - -dumplog$(EXEEXT): $(dumplog_OBJECTS) $(dumplog_DEPENDENCIES) - @rm -f dumplog$(EXEEXT) - $(LINK) $(dumplog_LDFLAGS) $(dumplog_OBJECTS) $(dumplog_LDADD) $(LIBS) - -ntfswipe$(EXEEXT): $(ntfswipe_OBJECTS) $(ntfswipe_DEPENDENCIES) - @rm -f ntfswipe$(EXEEXT) - $(LINK) $(ntfswipe_LDFLAGS) $(ntfswipe_OBJECTS) $(ntfswipe_LDADD) $(LIBS) - -ntfstruncate$(EXEEXT): $(ntfstruncate_OBJECTS) $(ntfstruncate_DEPENDENCIES) - @rm -f ntfstruncate$(EXEEXT) - $(LINK) $(ntfstruncate_LDFLAGS) $(ntfstruncate_OBJECTS) $(ntfstruncate_LDADD) $(LIBS) - -ntfscluster$(EXEEXT): $(ntfscluster_OBJECTS) $(ntfscluster_DEPENDENCIES) - @rm -f ntfscluster$(EXEEXT) - $(LINK) $(ntfscluster_LDFLAGS) $(ntfscluster_OBJECTS) $(ntfscluster_LDADD) $(LIBS) - -ntfsclone$(EXEEXT): $(ntfsclone_OBJECTS) $(ntfsclone_DEPENDENCIES) - @rm -f ntfsclone$(EXEEXT) - $(LINK) $(ntfsclone_LDFLAGS) $(ntfsclone_OBJECTS) $(ntfsclone_LDADD) $(LIBS) - -ntfsfix$(EXEEXT): $(ntfsfix_OBJECTS) $(ntfsfix_DEPENDENCIES) - @rm -f ntfsfix$(EXEEXT) - $(LINK) $(ntfsfix_LDFLAGS) $(ntfsfix_OBJECTS) $(ntfsfix_LDADD) $(LIBS) - -ntfsinfo$(EXEEXT): $(ntfsinfo_OBJECTS) $(ntfsinfo_DEPENDENCIES) - @rm -f ntfsinfo$(EXEEXT) - $(LINK) $(ntfsinfo_LDFLAGS) $(ntfsinfo_OBJECTS) $(ntfsinfo_LDADD) $(LIBS) - -mkntfs$(EXEEXT): $(mkntfs_OBJECTS) $(mkntfs_DEPENDENCIES) - @rm -f mkntfs$(EXEEXT) - $(LINK) $(mkntfs_LDFLAGS) $(mkntfs_OBJECTS) $(mkntfs_LDADD) $(LIBS) - -ntfslabel$(EXEEXT): $(ntfslabel_OBJECTS) $(ntfslabel_DEPENDENCIES) - @rm -f ntfslabel$(EXEEXT) - $(LINK) $(ntfslabel_LDFLAGS) $(ntfslabel_OBJECTS) $(ntfslabel_LDADD) $(LIBS) - -ntfsundelete$(EXEEXT): $(ntfsundelete_OBJECTS) $(ntfsundelete_DEPENDENCIES) - @rm -f ntfsundelete$(EXEEXT) - $(LINK) $(ntfsundelete_LDFLAGS) $(ntfsundelete_OBJECTS) $(ntfsundelete_LDADD) $(LIBS) - -ntfsresize$(EXEEXT): $(ntfsresize_OBJECTS) $(ntfsresize_DEPENDENCIES) - @rm -f ntfsresize$(EXEEXT) - $(LINK) $(ntfsresize_LDFLAGS) $(ntfsresize_OBJECTS) $(ntfsresize_LDADD) $(LIBS) - -install-man8: +man8dir = $(mandir)/man8 +install-man8: $(man8_MANS) $(man_MANS) + @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(man8dir) - @list='$(man8_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ + @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ case "$$i" in \ *.8*) list="$$list $$i" ;; \ esac; \ @@ -436,15 +476,21 @@ install-man8: if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 8*) ;; \ + *) ext='8' ;; \ + esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ done - uninstall-man8: - @list='$(man8_MANS)'; \ - l2='$(man_MANS)'; for i in $$l2; do \ + @$(NORMAL_UNINSTALL) + @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ case "$$i" in \ *.8*) list="$$list $$i" ;; \ esac; \ @@ -452,126 +498,94 @@ uninstall-man8: for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \ rm -f $(DESTDIR)$(man8dir)/$$inst; \ done -install-man: $(MANS) - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-man8 -uninstall-man: - @$(NORMAL_UNINSTALL) - $(MAKE) $(AM_MAKEFLAGS) uninstall-man8 + +ETAGS = etags +ETAGSFLAGS = tags: TAGS -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = ntfsprogs +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu ntfsprogs/Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ + @list='$(DISTFILES)'; for file in $$list; do \ + 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 - -DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) - --include $(DEP_FILES) - -mostlyclean-depend: - -clean-depend: - -distclean-depend: - -rm -rf .deps - -maintainer-clean-depend: - -%.o: %.c - @echo '$(COMPILE) -c $<'; \ - $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp - -%.lo: %.c - @echo '$(LTCOMPILE) -c $<'; \ - $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ - < .deps/$(*F).pp > .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm -f .deps/$(*F).pp -info-am: -info: info-am -dvi-am: -dvi: dvi-am check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-binPROGRAMS install-sbinPROGRAMS -install-exec: install-exec-am +all-am: Makefile $(PROGRAMS) $(MANS) -install-data-am: install-man +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir) + +install: install-am +install-exec: install-exec-am 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-sbinPROGRAMS uninstall-man -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) $(MANS) -all-redirect: all-am + +installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) \ - $(DESTDIR)$(mandir)/man8 - - + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: @@ -579,61 +593,71 @@ clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-sbinPROGRAMS \ - mostlyclean-compile mostlyclean-libtool \ - mostlyclean-tags mostlyclean-depend mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-binPROGRAMS clean-sbinPROGRAMS clean-compile \ - clean-libtool clean-tags clean-depend clean-generic \ - mostlyclean-am - + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." clean: clean-am -distclean-am: distclean-binPROGRAMS distclean-sbinPROGRAMS \ - distclean-compile distclean-libtool distclean-tags \ - distclean-depend distclean-generic clean-am - -rm -f libtool +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am -maintainer-clean-am: maintainer-clean-binPROGRAMS \ - maintainer-clean-sbinPROGRAMS maintainer-clean-compile \ - maintainer-clean-libtool maintainer-clean-tags \ - maintainer-clean-depend maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-exec-am: install-binPROGRAMS install-sbinPROGRAMS + +install-info: install-info-am + +install-man: install-man8 + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS clean-sbinPROGRAMS \ -maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \ -install-sbinPROGRAMS mostlyclean-compile distclean-compile \ -clean-compile maintainer-clean-compile mostlyclean-libtool \ -distclean-libtool clean-libtool maintainer-clean-libtool install-man8 \ -uninstall-man8 install-man uninstall-man tags mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir \ -mostlyclean-depend distclean-depend clean-depend \ -maintainer-clean-depend info-am info dvi-am dvi check check-am \ -installcheck-am installcheck 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 +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man \ + uninstall-sbinPROGRAMS + +uninstall-man: uninstall-man8 + +.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-sbinPROGRAMS distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-binPROGRAMS install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-man8 install-sbinPROGRAMS \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-info-am uninstall-man uninstall-man8 \ + uninstall-sbinPROGRAMS # Extra targets strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) $(STRIP) $^ - # 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: From a65b9e26f934af541e47bf3e88a6a2297fa30b8a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0542/2994] Manual merge. 2003/05/25 21:07:10+01:00 cantab.net!aia21 Update. 2003/05/25 20:40:25+01:00 cantab.net!aia21 Update. (Logical change 1.136) --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8cfbe946..b8ae86e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ xx/xx/2003 - 1.8.0-devel - Work in progress. - Fix attempt to release I30 internal constant. (Russ Christensen) - Fix off-by-one error in disk_io.c::ntfs_cluster_{read,write}(). (Ian Jackson) + - Add -fms-extensions when compiling with gcc-3.2+. + - Update for newer autoconf/automake. + - Abstract low level device operations (include/device,h and + libntfs/device.c). - Added ntfsclone utility written by Szabolcs Szakacsits. 13/02/2003 - 1.7.1 - Urgent bug fixes. From d0e6abc340fac8dcb9b2c2fab2fe41846f42c78c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0543/2994] Manual merge. 2003/05/26 13:49:47+01:00 cantab.net!aia21 Make it really work this time... 2003/05/25 21:07:10+01:00 cantab.net!aia21 Update. 2003/05/25 20:40:25+01:00 cantab.net!aia21 Update. (Logical change 1.136) --- configure | 10415 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 8074 insertions(+), 2341 deletions(-) diff --git a/configure b/configure index 4b4b6d36..7d83cbee 100755 --- a/configure +++ b/configure @@ -1,32 +1,246 @@ #! /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 for ntfsprogs 1.7.2-WIP. # +# Report bugs to . +# +# 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 + + # 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 -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer" -ac_default_prefix=/usr/local -ac_help="$ac_help - --enable-debug enable debugging" -ac_help="$ac_help - --enable-really-static completely static binaries" -ac_help="$ac_help - --enable-shared[=PKGS] build shared libraries [default=yes]" -ac_help="$ac_help - --enable-static[=PKGS] build static libraries [default=yes]" -ac_help="$ac_help - --enable-fast-install[=PKGS] optimize for fast installation [default=yes]" -ac_help="$ac_help - --with-gnu-ld assume the C compiler uses GNU ld [default=no]" # Find the correct PATH separator. Usually this is `:', but # DJGPP uses `;' like DOS. @@ -186,20 +400,87 @@ if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then fi -ac_help="$ac_help - --disable-libtool-lock avoid locking (might break parallel builds)" -ac_help="$ac_help - --with-pic try to use only PIC/non-PIC objects [default=use both]" + +# 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 +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='ntfsprogs' +PACKAGE_TARNAME='ntfsprogs' +PACKAGE_VERSION='1.7.2-WIP' +PACKAGE_STRING='ntfsprogs 1.7.2-WIP' +PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' + +ac_unique_file="config.h.in" +ac_default_prefix=/usr/local +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT DEBUG_TRUE DEBUG_FALSE REALLYSTATIC_TRUE REALLYSTATIC_FALSE CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE CC CFLAGS ac_ct_CC CCDEPMODE LN_S RANLIB ac_ct_RANLIB ECHO CPP EGREP LIBTOOL LIBTOOL_DEPS all_includes all_libraries AUTODIRS GCC_NEEDS_MS_EXTENSIONS_TRUE GCC_NEEDS_MS_EXTENSIONS_FALSE 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 @@ -208,10 +489,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' @@ -225,17 +511,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" @@ -243,59 +521,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- \ @@ -304,95 +582,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 \ @@ -401,19 +631,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 \ @@ -427,26 +657,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 \ @@ -463,7 +693,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) @@ -473,7 +703,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 \ @@ -484,58 +714,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. @@ -546,99 +775,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 - -# 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 exec_prefix prefix 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 + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { 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 +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + 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 -# 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 +# 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 + +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=aclocal.m4 # 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=.. @@ -648,13 +888,467 @@ 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_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +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_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_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 ntfsprogs 1.7.2-WIP 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] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of ntfsprogs 1.7.2-WIP:";; + esac + 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 + --enable-debug enable debugging + --enable-really-static completely static binaries + --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) + +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: + CXX C++ compiler command + CXXFLAGS C++ compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CC C compiler command + CFLAGS C compiler flags + 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. + +Report bugs to . +_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 +ntfsprogs configure 1.7.2-WIP +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. +_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 ntfsprogs $as_me 1.7.2-WIP, 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 @@ -665,46 +1359,112 @@ 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 + + + + + + + + + + + + + + + + + + + + + + + -if test "x$nonopt" != "xNONE"; then - host="$nonopt" - nonopt="NONE" -fi ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do @@ -716,105 +1476,111 @@ 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. + +# 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/'` -# Do some error checking and defaulting for the host and target type. -# The inputs are: -# configure --host=HOST --target=TARGET --build=BUILD NONOPT -# -# The rules are: -# 1. You are not allowed to specify --host, --target, and nonopt at the -# same time. -# 2. Host defaults to nonopt. -# 3. If nonopt is not specified, then host defaults to the current host, -# as determined by config.guess. -# 4. Target and build default to nonopt. -# 5. If nonopt is not specified, then target and build default to host. +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/'` + + +echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6 +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && + ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6 +target=$ac_cv_target +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + # The aliases save the names the user supplied, while $host etc. # will get canonicalized. -case $host---$target---$nonopt in -NONE---*---* | *---NONE---* | *---*---NONE) ;; -*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; -esac - - -# Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi - -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:757: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac - -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 - -echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:778: checking target system type" >&5 - -target_alias=$target -case "$target_alias" in -NONE) - case $nonopt in - NONE) target_alias=$host_alias ;; - *) target_alias=$nonopt ;; - esac ;; -esac - -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` -target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$target" 1>&6 - -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:796: checking build system type" >&5 - -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac - -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 - -test "$host_alias" != "$target_alias" && +test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- +# Add the stamp file to the list of files AC keeps track of, +# along with our hook. + ac_config_headers="$ac_config_headers config.h" + + +am__api_version="1.6" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -822,245 +1588,377 @@ test "$host_alias" != "$target_alias" && # 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:831: 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:884: 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 -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:941: 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 +# 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 - cat > conftestmake <<\EOF + 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 + +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 "$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 >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 + # 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 -PACKAGE=ntfsprogs +# Define the identity of the package. + PACKAGE=ntfsprogs + VERSION=1.7.2-WIP VERSION=1.8.0-devel -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } -fi -cat >> confdefs.h <>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" -EOF +_ACEOF -cat >> confdefs.h <>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"} -missing_dir=`cd $ac_aux_dir && pwd` -echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:987: 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 + +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"} + +# 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 + 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 -echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:1000: 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 +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 - AUTOCONF="$missing_dir/missing autoconf" - echo "$ac_t""missing" 1>&6 + 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 -echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:1013: 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 + STRIP=$ac_ct_STRIP else - AUTOMAKE="$missing_dir/missing automake" - echo "$ac_t""missing" 1>&6 + STRIP="$ac_cv_prog_STRIP" fi -echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:1026: checking for working autoheader" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (autoheader --version) < /dev/null > /dev/null 2>&1; then - AUTOHEADER=autoheader - echo "$ac_t""found" 1>&6 -else - AUTOHEADER="$missing_dir/missing autoheader" - echo "$ac_t""missing" 1>&6 +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. + + + + +# This is required to get past a stupid configure bug when making the rpm. +# Basically it is broken to specify the host as a command line argument to +# configure on its own, i.e. without giving --host=. It is supposed to work +# but doesn't. So this sets host and erases nonopt effectively moving the +# standalone command line option into the --host= form. +if test "x$nonopt" != "xNONE"; then + host="$nonopt" + nonopt="NONE" fi -echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:1039: checking for working makeinfo" >&5 -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if (makeinfo --version) < /dev/null > /dev/null 2>&1; then - MAKEINFO=makeinfo - echo "$ac_t""found" 1>&6 -else - MAKEINFO="$missing_dir/missing makeinfo" - echo "$ac_t""missing" 1>&6 -fi - - - -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:1054: checking whether to enable maintainer-specific portions of Makefiles" >&5 +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 +fi; + echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 - echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 - if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= @@ -1069,11 +1967,8 @@ else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi + MAINT=$MAINTAINER_MODE_TRUE - - - - @@ -1083,25 +1978,24 @@ if test "x$prefix" = "xNONE"; then ac_configure_args="$ac_configure_args --prefix $prefix" fi +# Command-line options. # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" - : + else enable_debug=no -fi - +fi; # Check whether --enable-really-static or --disable-really-static was given. if test "${enable_really_static+set}" = set; then enableval="$enable_really_static" - : + else enable_really_static=no -fi - +fi; @@ -1114,6 +2008,7 @@ else fi + if test "$enable_really_static" = yes; then REALLYSTATIC_TRUE= REALLYSTATIC_FALSE='#' @@ -1122,135 +2017,423 @@ else REALLYSTATIC_FALSE= fi -for ac_prog in $CCC c++ g++ gcc CC cxx cc++ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1131: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +# Checks for programs. +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + 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_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # 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_CXX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CXX="$ac_cv_prog_CXX" -if test -n "$CXX"; then - echo "$ac_t""$CXX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$CXX" && break -done -test -n "$CXX" || CXX="gcc" - - -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1163: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 - -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - -cat > conftest.$ac_ext << EOF - -#line 1174 "configure" -#include "confdefs.h" - -int main(){return(0);} -EOF -if { (eval echo configure:1179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cxx_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_cxx_cross=no - else - ac_cv_prog_cxx_cross=yes +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_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cxx_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 +done +done -echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 -if test $ac_cv_prog_cxx_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 ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1205: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 -cross_compiling=$ac_cv_prog_cxx_cross - -echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1210: checking whether we are using GNU C++" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6 else - cat > conftest.C <&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +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_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# 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 &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &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 () +{ + + ; + 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 + 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 +fi +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 + { { 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 () +{ + + ; + 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 + 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_cxx_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 -EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1219: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gxx=yes -else - ac_cv_prog_gxx=no -fi -fi -echo "$ac_t""$ac_cv_prog_gxx" 1>&6 - -if test $ac_cv_prog_gxx = yes; then - GXX=yes + ; + 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 - GXX= + 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_cxx_compiler_gnu=$ac_compiler_gnu -ac_test_CXXFLAGS="${CXXFLAGS+set}" -ac_save_CXXFLAGS="$CXXFLAGS" -CXXFLAGS= -echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1238: checking whether ${CXX-g++} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo 'void f(){}' > conftest.cc -if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + 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_cxx_g=yes else - ac_cv_prog_cxx_g=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_prog_cxx_g=no fi - -echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS="$ac_save_CXXFLAGS" + CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" @@ -1264,7 +2447,6 @@ else CXXFLAGS= fi fi - for ac_declaration in \ ''\ '#include ' \ @@ -1274,256 +2456,668 @@ for ac_declaration in \ 'extern "C" void exit (int);' \ 'void exit (int);' do - cat > conftest.$ac_ext <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_declaration -int main() { +int +main () +{ exit (42); -; return 0; } -EOF -if { (eval echo configure:1287: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; 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 : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - continue + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue fi -rm -f conftest* - cat > conftest.$ac_ext <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() { +int +main () +{ exit (42); -; return 0; } -EOF -if { (eval echo configure:1304: \"$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 break 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 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 +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 +rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null -# 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:1323: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +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 | fgrep -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="$CXX" 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_CXX_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 + + am_cv_CXX_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 + # 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. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}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=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + +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 - 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}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" +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 + +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 "$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 - # 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:1353: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + 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 +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 +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 "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 + 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 "$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:1404: 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 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - ;; - esac + + 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 - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +done +done + fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1436: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 1447 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:1452: \"$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 - else - ac_cv_prog_cc_cross=yes - 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 "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 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; } + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1478: 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:1483: 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 +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 &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +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.c <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 -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes + ; + 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 - GCC= + 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 -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:1511: 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 +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 - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + 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" @@ -1537,6 +3131,292 @@ 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 +#include +#include +#include +/* 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 ' \ + '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 +$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 + +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 + + 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 + # 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. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}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=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CC_dependencies_compiler_type=$depmode + break + 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 + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -1545,275 +3425,206 @@ 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:1554: 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:1607: 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 - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 fi -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1628: 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 +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 + + +# create a working libtool-script if test -z "$LIBTOOL"; then - 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_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 - # Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi - -echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:1676: checking for Cygwin environment" >&5 -if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_cygwin=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_cygwin=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_cygwin" 1>&6 -CYGWIN= -test "$ac_cv_cygwin" = yes && CYGWIN=yes -echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:1709: checking for mingw32 environment" >&5 -if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_mingw32=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_mingw32=no -fi -rm -f conftest* -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_mingw32" 1>&6 -MINGW32= -test "$ac_cv_mingw32" = yes && MINGW32=yes -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1738: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1759: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1776: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1793: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - -# Check whether --enable-shared or --disable-shared was given. + # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" p=${PACKAGE-default} @@ -1834,8 +3645,7 @@ no) enable_shared=no ;; esac else enable_shared=yes -fi - +fi; # Check whether --enable-static or --disable-static was given. if test "${enable_static+set}" = set; then enableval="$enable_static" @@ -1857,8 +3667,7 @@ no) enable_static=no ;; esac else enable_static=yes -fi - +fi; # Check whether --enable-fast-install or --disable-fast-install was given. if test "${enable_fast_install+set}" = set; then enableval="$enable_fast_install" @@ -1880,21 +3689,31 @@ no) enable_fast_install=no ;; esac else enable_fast_install=yes +fi; +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator fi + # 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 - +fi; ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1898: checking for ld used by GCC" >&5 + 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 @@ -1923,14 +3742,14 @@ echo "configure:1898: checking for ld used by GCC" >&5 ;; esac elif test "$with_gnu_ld" = yes; then - echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1928: checking for GNU ld" >&5 + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1931: checking for non-GNU ld" >&5 + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 fi -if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR @@ -1956,15 +3775,19 @@ fi LD="$lt_cv_path_LD" if test -n "$LD"; then - echo "$ac_t""$LD" 1>&6 + echo "$as_me:$LINENO: result: $LD" >&5 +echo "${ECHO_T}$LD" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } -echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1966: checking if the linker ($LD) is GNU ld" >&5 -if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 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 &5; then @@ -1973,27 +3796,27 @@ else lt_cv_prog_gnu_ld=no fi fi - -echo "$ac_t""$lt_cv_prog_gnu_ld" 1>&6 +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 for $LD option to reload object files""... $ac_c" 1>&6 -echo "configure:1983: checking for $LD option to reload object files" >&5 -if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +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 "$ac_t""$lt_cv_ld_reload_flag" 1>&6 +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 $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1995: checking for BSD-compatible nm" >&5 -if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +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. @@ -2026,12 +3849,98 @@ fi fi NM="$lt_cv_path_NM" -echo "$ac_t""$NM" 1>&6 +echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 -echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6 -echo "configure:2033: checking how to recognise dependant libraries" >&5 -if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_executable_p="test -f" +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_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + fi + done + done +done + + # 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 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break + fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 40000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done + done + rm -rf "$tmp" + +fi + +if test "X$SED" != "X"; then + lt_cv_path_SED=$SED +else + SED=$lt_cv_path_SED +fi +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 + +echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 +echo $ECHO_N "checking how to recognise dependent 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= @@ -2106,9 +4015,9 @@ hpux10.20*|hpux11*) lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; -irix5* | irix6*) +irix5* | irix6* | nonstopux*) case $host_os in - irix5*) + irix5* | nonstopux*) # 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" ;; @@ -2130,7 +4039,7 @@ irix5* | irix6*) # This must be Linux ELF. linux-gnu*) case $host_cpu in - alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | s390* ) + alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | s390* | x86_64*) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM @@ -2201,89 +4110,33 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; esac ;; esac fi - -echo "$ac_t""$lt_cv_deplibs_check_method" 1>&6 +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 -echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:2216: checking for object suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftest* -echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:2222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - for ac_file in conftest.*; do - case $ac_file in - *.c) ;; - *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; - esac - done -else - { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_objext" 1>&6 -OBJEXT=$ac_cv_objext -ac_objext=$ac_cv_objext -echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2242: checking for executable suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$CYGWIN" = yes || test "$MINGW32" = yes; then - ac_cv_exeext=.exe -else - rm -f conftest* - echo 'int main () { return 0; }' > conftest.$ac_ext - ac_cv_exeext= - if { (eval echo configure:2252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then - for file in conftest.*; do - case $file in - *.c | *.o | *.obj) ;; - *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - else - { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } - fi - rm -f conftest* - test x"${ac_cv_exeext}" = x && ac_cv_exeext=no -fi -fi - -EXEEXT="" -test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} -echo "$ac_t""${ac_cv_exeext}" 1>&6 -ac_exeext=$EXEEXT - -if test $host != $build; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi # Check for command to grab the raw symbol name followed by C symbol from nm. -echo $ac_n "checking command to parse $NM output""... $ac_c" 1>&6 -echo "configure:2283: checking command to parse $NM output" >&5 -if eval "test \"`echo '$''{'lt_cv_sys_global_symbol_pipe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking command to parse $NM output" >&5 +echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - + # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] @@ -2314,9 +4167,12 @@ hpux*) # Its linker distinguishes data from code symbols lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; -irix*) +irix* | nonstopux*) symcode='[BCDEGRST]' ;; +osf*) + symcode='[BCDEGQRST]' + ;; solaris* | sysv5*) symcode='[BDT]' ;; @@ -2359,10 +4215,18 @@ void nm_test_func(){} int main(){nm_test_var='a';nm_test_func();return(0);} EOF - if { (eval echo configure:2363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + 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 # Now try to grab the symbols. nlist=conftest.nm - if { (eval echo configure:2366: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\") 1>&5; (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5; } && test -s "$nlist"; then + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -2413,7 +4277,11 @@ EOF save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo configure:2417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + 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); } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS="$save_LIBS" @@ -2453,63 +4321,641 @@ else fi if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; then - echo "$ac_t""failed" 1>&6 + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 else - echo "$ac_t""ok" 1>&6 + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 fi -for ac_hdr in dlfcn.h +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 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 -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2466: 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 + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +#else +# include +#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 - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2476: \"$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" + 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* - eval "ac_cv_header_$ac_safe=no" + 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 +_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 +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 + + 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 to if __STDC__ is defined, since + # 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 +#else +# include +#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 +_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 +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 + 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +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 "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no fi rm -f conftest* + fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <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 + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : else - echo "$ac_t""no" 1>&6 + ac_cv_header_stdc=no fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#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 + +#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 "$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 -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +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 <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# 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 +for ac_header in dlfcn.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 + 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 + + + + # 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 $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:2511: checking for ${ac_tool_prefix}file" >&5 -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + 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 /*) @@ -2561,17 +5007,19 @@ fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then - echo "$ac_t""$MAGIC_CMD" 1>&6 + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 else - echo "$ac_t""no" 1>&6 + 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 $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:2573: checking for file" >&5 -if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + 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 /*) @@ -2623,9 +5071,11 @@ fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then - echo "$ac_t""$MAGIC_CMD" 1>&6 + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi else @@ -2637,138 +5087,164 @@ fi ;; esac -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2644: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+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_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 - 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_RANLIB="${ac_tool_prefix}ranlib" - 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_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" +RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - +fi if test -z "$ac_cv_prog_RANLIB"; then -if test -n "$ac_tool_prefix"; 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2676: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+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_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. + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +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 -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 +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 "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + RANLIB=$ac_ct_RANLIB else - RANLIB=":" -fi + RANLIB="$ac_cv_prog_RANLIB" fi -# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2711: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+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_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 - 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_STRIP="${ac_tool_prefix}strip" - 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_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" +STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - +fi if test -z "$ac_cv_prog_STRIP"; then -if test -n "$ac_tool_prefix"; 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2743: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+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_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. + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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_STRIP="strip" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" +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 -STRIP="$ac_cv_prog_STRIP" -if test -n "$STRIP"; then - echo "$ac_t""$STRIP" 1>&6 +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 "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + STRIP=$ac_ct_STRIP else - STRIP=":" -fi + STRIP="$ac_cv_prog_STRIP" fi @@ -2778,9 +5254,8 @@ enable_win32_dll=no # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" - : -fi +fi; test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good @@ -2788,8 +5263,12 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 2792 "configure"' > conftest.$ac_ext - if { (eval echo configure:2793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 5265 "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" @@ -2809,47 +5288,64 @@ case $host in # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" - echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:2814: checking whether the C compiler needs -belf" >&5 -if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + 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 -# 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_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 <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 () +{ -; return 0; } -EOF -if { (eval echo configure:2834: \"$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 lt_cv_cc_needs_belf=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_cc_needs_belf=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no fi -rm -f conftest* +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext 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_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 "$ac_t""$lt_cv_cc_needs_belf" 1>&6 +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" @@ -2949,8 +5445,8 @@ fi set dummy $CC compiler="$2" -echo $ac_n "checking for objdir""... $ac_c" 1>&6 -echo "configure:2954: checking for objdir" >&5 +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then @@ -2960,7 +5456,9 @@ else objdir=_libs fi rmdir .libs 2>/dev/null -echo "$ac_t""$objdir" 1>&6 +echo "$as_me:$LINENO: result: $objdir" >&5 +echo "${ECHO_T}$objdir" >&6 + # Check whether --with-pic or --without-pic was given. @@ -2969,17 +5467,16 @@ if test "${with_pic+set}" = set; then pic_mode="$withval" else pic_mode=default -fi - +fi; test -z "$pic_mode" && pic_mode=default # We assume here that the value for lt_cv_prog_cc_pic will not be cached # in isolation, and that seeing it set (from the cache) indicates that # the associated values are set (in the cache) correctly too. -echo $ac_n "checking for $compiler option to produce PIC""... $ac_c" 1>&6 -echo "configure:2981: checking for $compiler option to produce PIC" >&5 -if eval "test \"`echo '$''{'lt_cv_prog_cc_pic'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_pic+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_cc_pic= lt_cv_prog_cc_shlib= @@ -3008,7 +5505,7 @@ else # like `-m68040'. lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' ;; - beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; darwin* | rhapsody*) @@ -3051,7 +5548,7 @@ else lt_cv_prog_cc_pic='+Z' ;; - irix5* | irix6*) + irix5* | irix6* | nonstopux*) lt_cv_prog_cc_wl='-Wl,' lt_cv_prog_cc_static='-non_shared' # PIC (with -KPIC) is the default. @@ -3095,11 +5592,7 @@ else sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) lt_cv_prog_cc_pic='-KPIC' lt_cv_prog_cc_static='-Bstatic' - if test "x$host_vendor" = xsni; then - lt_cv_prog_cc_wl='-LD' - else - lt_cv_prog_cc_wl='-Wl,' - fi + lt_cv_prog_cc_wl='-Wl,' ;; uts4*) @@ -3123,28 +5616,48 @@ else fi if test -z "$lt_cv_prog_cc_pic"; then - echo "$ac_t""none" 1>&6 + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 else - echo "$ac_t""$lt_cv_prog_cc_pic" 1>&6 + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 # Check to make sure the pic_flag actually works. - echo $ac_n "checking if $compiler PIC flag $lt_cv_prog_cc_pic works""... $ac_c" 1>&6 -echo "configure:3133: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 - if eval "test \"`echo '$''{'lt_cv_prog_cc_pic_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 + if test "${lt_cv_prog_cc_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - cat > conftest.$ac_ext <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 () +{ -; return 0; } -EOF -if { (eval echo configure:3147: \"$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 case $host_os in hpux9* | hpux10* | hpux11*) # On HP-UX, both CC and GCC only warn that PIC is supported... then @@ -3160,17 +5673,17 @@ if { (eval echo configure:3147: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; lt_cv_prog_cc_pic_works=yes ;; esac - + else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - lt_cv_prog_cc_pic_works=no - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_prog_cc_pic_works=no + fi -rm -f conftest* +rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$save_CFLAGS" - + fi @@ -3181,43 +5694,65 @@ fi lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" fi - echo "$ac_t""$lt_cv_prog_cc_pic_works" 1>&6 + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 fi # Check for any special shared library compilation flags. if test -n "$lt_cv_prog_cc_shlib"; then - echo "configure: warning: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" 1>&2 + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : else - echo "configure: warning: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" 1>&2 + { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} lt_cv_prog_cc_can_build_shared=no fi fi -echo $ac_n "checking if $compiler static flag $lt_cv_prog_cc_static works""... $ac_c" 1>&6 -echo "configure:3199: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 -if eval "test \"`echo '$''{'lt_cv_prog_cc_static_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else lt_cv_prog_cc_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - cat > conftest.$ac_ext <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 () +{ -; return 0; } -EOF -if { (eval echo configure:3214: \"$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 lt_cv_prog_cc_static_works=yes 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_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi @@ -3225,7 +5760,8 @@ fi # Belt *and* braces to stop my trousers falling down: test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -echo "$ac_t""$lt_cv_prog_cc_static_works" 1>&6 +echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 pic_flag="$lt_cv_prog_cc_pic" special_shlib_compile_flags="$lt_cv_prog_cc_shlib" @@ -3236,12 +5772,12 @@ can_build_shared="$lt_cv_prog_cc_can_build_shared" # Check to see if options -o and -c are simultaneously supported by compiler -echo $ac_n "checking if $compiler supports -c -o file.$ac_objext""... $ac_c" 1>&6 -echo "configure:3241: checking if $compiler supports -c -o file.$ac_objext" >&5 -if eval "test \"`echo '$''{'lt_cv_compiler_c_o'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - + $rm -r conftest 2>/dev/null mkdir conftest cd conftest @@ -3256,7 +5792,7 @@ chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" compiler_c_o=no -if { (eval echo configure:3260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then +if { (eval echo configure:5794: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then @@ -3280,31 +5816,50 @@ $rm -r conftest 2>/dev/null fi compiler_c_o=$lt_cv_compiler_c_o -echo "$ac_t""$compiler_c_o" 1>&6 +echo "$as_me:$LINENO: result: $compiler_c_o" >&5 +echo "${ECHO_T}$compiler_c_o" >&6 if test x"$compiler_c_o" = x"yes"; then # Check to see if we can write to a .lo - echo $ac_n "checking if $compiler supports -c -o file.lo""... $ac_c" 1>&6 -echo "configure:3289: checking if $compiler supports -c -o file.lo" >&5 - if eval "test \"`echo '$''{'lt_cv_compiler_o_lo'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 + if test "${lt_cv_compiler_o_lo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - + lt_cv_compiler_o_lo=no save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -c -o conftest.lo" save_objext="$ac_objext" ac_objext=lo - cat > conftest.$ac_ext <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 () +{ int some_variable = 0; -; return 0; } -EOF -if { (eval echo configure:3307: \"$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 # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then @@ -3312,19 +5867,21 @@ if { (eval echo configure:3307: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; else lt_cv_compiler_o_lo=yes fi - + 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 ac_objext="$save_objext" CFLAGS="$save_CFLAGS" - + fi compiler_o_lo=$lt_cv_compiler_o_lo - echo "$ac_t""$compiler_o_lo" 1>&6 + echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 +echo "${ECHO_T}$compiler_o_lo" >&6 else compiler_o_lo=no fi @@ -3333,17 +5890,19 @@ fi hard_links="nottested" if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user - echo $ac_n "checking if we can lock with hard links""... $ac_c" 1>&6 -echo "configure:3338: checking if we can lock with hard links" >&5 + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 hard_links=yes $rm conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$ac_t""$hard_links" 1>&6 + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 if test "$hard_links" = no; then - echo "configure: warning: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" 1>&2 + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else @@ -3352,22 +5911,40 @@ fi if test "$GCC" = yes; then # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions""... $ac_c" 1>&6 -echo "configure:3357: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 echo "int some_variable = 0;" > conftest.$ac_ext save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" compiler_rtti_exceptions=no - cat > conftest.$ac_ext <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 () +{ int some_variable = 0; -; return 0; } -EOF -if { (eval echo configure:3370: \"$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 # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then @@ -3375,14 +5952,16 @@ if { (eval echo configure:3370: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; else compiler_rtti_exceptions=yes fi - + 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 CFLAGS="$save_CFLAGS" - echo "$ac_t""$compiler_rtti_exceptions" 1>&6 + echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$compiler_rtti_exceptions" >&6 if test "$compiler_rtti_exceptions" = "yes"; then no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' @@ -3392,8 +5971,8 @@ rm -f conftest* fi # See if the linker supports building shared libraries. -echo $ac_n "checking whether the linker ($LD) supports shared libraries""... $ac_c" 1>&6 -echo "configure:3397: checking whether the linker ($LD) supports shared libraries" >&5 +echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 allow_undefined_flag= no_undefined_flag= @@ -3549,7 +6128,7 @@ EOF # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is. # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname-def; else echo EXPORTS > $output_objdir/$soname-def; @@ -3558,6 +6137,7 @@ EOF set dummy \$symbol; case \$# in 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; esac; _lt_hint=`expr 1 + \$_lt_hint`; @@ -3670,10 +6250,12 @@ else # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix5*) for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + case $ld_flag in + *-brtl*) aix_use_runtimelinking=yes break - fi + ;; + esac done esac @@ -3787,8 +6369,9 @@ else esac # FIXME: Relying on posixy $() will cause problems for # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' # We need to add '_' to the symbols in $export_symbols first #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' hardcode_direct=yes @@ -3840,13 +6423,14 @@ else export_dynamic_flag_spec='${wl}-E' ;; - irix5* | irix6*) + irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='-rpath $libdir' fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; @@ -3874,7 +6458,7 @@ else hardcode_direct=yes hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else @@ -3884,7 +6468,7 @@ else hardcode_libdir_flag_spec='-R$libdir' ;; *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac @@ -3996,13 +6580,23 @@ EOF ;; sysv4) - if test "x$host_vendor" = xsno; then - archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - else - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - fi + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; @@ -4072,12 +6666,13 @@ EOF ;; esac fi -echo "$ac_t""$ld_shlibs" 1>&6 +echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no # Check hardcoding attributes. -echo $ac_n "checking how to hardcode library paths into programs""... $ac_c" 1>&6 -echo "configure:4081: checking how to hardcode library paths into programs" >&5 +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ test -n "$runpath_var"; then @@ -4100,26 +6695,29 @@ else # directories. hardcode_action=unsupported fi -echo "$ac_t""$hardcode_action" 1>&6 +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 striplib= old_striplib= -echo $ac_n "checking whether stripping libraries is possible""... $ac_c" 1>&6 -echo "configure:4109: checking whether stripping libraries is possible" >&5 +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" - 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 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi reload_cmds='$LD$reload_flag -o $output$reload_objs' test -z "$deplibs_check_method" && deplibs_check_method=unknown # PORTME Fill in your ld.so characteristics -echo $ac_n "checking dynamic linker characteristics""... $ac_c" 1>&6 -echo "configure:4123: checking dynamic linker characteristics" >&5 +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= @@ -4146,6 +6744,9 @@ aix3*) aix4* | aix5*) version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' @@ -4184,6 +6785,7 @@ aix4* | aix5*) fi shlibpath_var=LIBPATH fi + hardcode_into_libs=yes ;; amigaos*) @@ -4231,7 +6833,7 @@ cygwin* | mingw* | pw32*) ;; yes,mingw*) library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` ;; yes,pw32*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' @@ -4314,14 +6916,17 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; -irix5* | irix6*) - version_type=irix +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) version_type=irix ;; + esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}.so$major' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' case $host_os in - irix5*) + irix5* | nonstopux*) libsuff= shlibsuff= ;; *) @@ -4366,6 +6971,30 @@ linux-gnu*) # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' + + # Find out which ABI we are using (multilib Linux x86_64 hack). + libsuff= + case "$host_cpu" in + x86_64*|s390x*) + echo '#line 6978 "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 + *64-bit*) + libsuff=64 + ;; + esac + fi + rm -rf conftest* + ;; + *) + ;; + esac + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" ;; netbsd*) @@ -4425,11 +7054,12 @@ os2*) osf3* | osf4* | osf5*) version_type=osf need_version=no - soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + hardcode_into_libs=yes ;; sco3.2v5*) @@ -4472,6 +7102,12 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) case $host_vendor in sni) shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no ;; motorola) need_lib_prefix=no @@ -4511,16 +7147,18 @@ sysv4*MP*) dynamic_linker=no ;; esac -echo "$ac_t""$dynamic_linker" 1>&6 +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no # Report the final consequences. -echo $ac_n "checking if libtool supports shared libraries""... $ac_c" 1>&6 -echo "configure:4520: checking if libtool supports shared libraries" >&5 -echo "$ac_t""$can_build_shared" 1>&6 +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 -echo $ac_n "checking whether to build shared libraries""... $ac_c" 1>&6 -echo "configure:4524: checking whether to build shared libraries" >&5 +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and @@ -4540,13 +7178,15 @@ aix4*) fi ;; esac -echo "$ac_t""$enable_shared" 1>&6 +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 -echo $ac_n "checking whether to build static libraries""... $ac_c" 1>&6 -echo "configure:4547: checking whether to build static libraries" >&5 +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes -echo "$ac_t""$enable_static" 1>&6 +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported @@ -4583,265 +7223,398 @@ else ;; *) - echo $ac_n "checking for shl_load""... $ac_c" 1>&6 -echo "configure:4588: checking for shl_load" >&5 -if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <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 shl_load(); below. */ -#include + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#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 shl_load(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char shl_load (); /* 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_shl_load) || defined (__stub___shl_load) choke me #else -shl_load(); +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:4616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_shl_load=yes" +int +main () +{ +return f != shl_load; + ; + 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_func_shl_load=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_shl_load=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then - echo "$ac_t""yes" 1>&6 +ac_cv_func_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then lt_cv_dlopen="shl_load" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 -echo "configure:4634: checking for shl_load in -ldld" >&5 -ac_lib_var=`echo dld'_'shl_load | 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 shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" -cat > conftest.$ac_ext <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 shl_load(); - -int main() { -shl_load() -; return 0; } -EOF -if { (eval echo configure:4653: \"$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" + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + 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_dld_shl_load=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" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_dld_shl_load=no fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 +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_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -echo "configure:4672: checking for dlopen" >&5 -if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <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 dlopen(); below. */ -#include + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#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 dlopen(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char dlopen (); /* 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_dlopen) || defined (__stub___dlopen) choke me #else -dlopen(); +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:4700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_dlopen=yes" +int +main () +{ +return f != dlopen; + ; + 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_func_dlopen=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_dlopen=no" -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then - echo "$ac_t""yes" 1>&6 +ac_cv_func_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then lt_cv_dlopen="dlopen" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:4718: checking for dlopen in -ldl" >&5 -ac_lib_var=`echo dl'_'dlopen | 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 dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" -cat > conftest.$ac_ext <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 dlopen(); - -int main() { -dlopen() -; return 0; } -EOF -if { (eval echo configure:4737: \"$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" + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + 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_dl_dlopen=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" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_dl_dlopen=no fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 +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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dlopen in -lsvld""... $ac_c" 1>&6 -echo "configure:4756: checking for dlopen in -lsvld" >&5 -ac_lib_var=`echo svld'_'dlopen | 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 dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" -cat > conftest.$ac_ext <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 dlopen(); - -int main() { -dlopen() -; return 0; } -EOF -if { (eval echo configure:4775: \"$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" + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + 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_svld_dlopen=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" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_svld_dlopen=no fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 +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_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 -echo "configure:4794: checking for dld_link in -ldld" >&5 -ac_lib_var=`echo dld'_'dld_link | 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 dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" -cat > conftest.$ac_ext <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 dld_link(); - -int main() { -dld_link() -; return 0; } -EOF -if { (eval echo configure:4813: \"$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" + builtin and then its argument prototype would still apply. */ +char dld_link (); +int +main () +{ +dld_link (); + ; + 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_dld_dld_link=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" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_lib_dld_dld_link=no fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 +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_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -else - echo "$ac_t""no" 1>&6 fi - + fi - + fi - + fi - + fi - + fi ;; @@ -4864,10 +7637,10 @@ fi save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" - echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 -echo "configure:4869: checking whether a program can dlopen itself" >&5 -if eval "test \"`echo '$''{'lt_cv_dlopen_self'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross @@ -4875,7 +7648,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) 2>/dev/null lt_status=$? case x$lt_status in @@ -4951,17 +7728,17 @@ EOF fi rm -fr conftest* - -fi -echo "$ac_t""$lt_cv_dlopen_self" 1>&6 +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 if test "x$lt_cv_dlopen_self" = xyes; then LDFLAGS="$LDFLAGS $link_static_flag" - echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 -echo "configure:4963: checking whether a statically linked program can dlopen itself" >&5 -if eval "test \"`echo '$''{'lt_cv_dlopen_self_static'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross @@ -4969,7 +7746,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} 2>/dev/null; then + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) 2>/dev/null lt_status=$? case x$lt_status in @@ -5045,10 +7826,10 @@ EOF fi rm -fr conftest* - -fi -echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 fi CPPFLAGS="$save_CPPFLAGS" @@ -5078,15 +7859,19 @@ if test "$enable_shared" = yes && test "$GCC" = yes; then # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - echo $ac_n "checking whether -lc should be explicitly linked in""... $ac_c" 1>&6 -echo "configure:5083: checking whether -lc should be explicitly linked in" >&5 - if eval "test \"`echo '$''{'lt_cv_archive_cmds_need_lc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + if test "${lt_cv_archive_cmds_need_lc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else $rm conftest* echo 'static int dummy;' > conftest.$ac_ext - if { (eval echo configure:5090: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + 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 soname=conftest lib=conftest libobjs=conftest.$ac_objext @@ -5099,7 +7884,11 @@ else libname=conftest save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= - if { (eval echo configure:5103: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\") 1>&5; (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5; } + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } then lt_cv_archive_cmds_need_lc=no else @@ -5111,7 +7900,8 @@ else fi fi - echo "$ac_t""$lt_cv_archive_cmds_need_lc" 1>&6 + echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 +echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 ;; esac fi @@ -5139,7 +7929,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS \ + for var in echo old_CC old_CFLAGS SED \ AR AR_FLAGS CC LD LN_S NM SHELL \ reload_flag reload_cmds wl \ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ @@ -5201,8 +7991,11 @@ if test -f "$ltmain"; then # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +# A sed that does not truncate output. +SED=$lt_SED + # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="sed -e s/^X//" +Xsed="${SED} -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -5680,19 +8473,20 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion - ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. + #LIBTOOL="$LIBTOOL --silent" + ac_ext=c 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_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 + - LIBTOOL_SHELL='/bin/sh ./libtool' else LIBTOOL_SHELL=$LIBTOOL fi +# add --with-extra-includes and --with-extra-libs switch to ./configure all_libraries="$all_libraries $USER_LDFLAGS" all_includes="$all_includes $USER_INCLUDES" @@ -5704,72 +8498,117 @@ all_includes="$all_includes $USER_INCLUDES" +# Get compiler name if test ! -z "$CC"; then _cc="$CC" else _cc="gcc" fi -echo $ac_n "checking version of $_cc""... $ac_c" 1>&6 -echo "configure:5715: checking version of $_cc" >&5 -cc_version=`$_cc --version 2>&1 | head -1 | sed 's/egcs-//' | sed 's/gcc (GCC) \(0-9\.0-9\).*/\1/'` +# Check for gcc version being >= 2.96. +echo "$as_me:$LINENO: checking version of $_cc" >&5 +echo $ECHO_N "checking version of $_cc... $ECHO_C" >&6 +cc_version=`./getgccver $_cc` cc_major=`echo $cc_version | cut -d'.' -f1` cc_minor=`echo $cc_version | cut -d'.' -f2` -if test -z $cc_version; then +if test -z "$cc_version"; then cc_version="v. ?.??" cc_major=1 + cc_minor=1 fi if test $cc_major -lt 2 -o \( $cc_major -eq 2 -a $cc_minor -lt 96 \) ; then cc_version="$cc_version, bad" -echo "$ac_t""$cc_version" 1>&6 -{ echo "configure: error: Please upgrade your gcc compiler to gcc-2.96+ or gcc-3+ version!\ +echo "$as_me:$LINENO: result: $cc_version" >&5 +echo "${ECHO_T}$cc_version" >&6 +{ { echo "$as_me:$LINENO: error: Please upgrade your gcc compiler to gcc-2.96+ or gcc-3+ version!\ Earlier compiler versions will NOT work as these do not support \ -unnamed/annonymous structures and unions which are used heavily in linux-ntfs." 1>&2; exit 1; } +unnamed/annonymous structures and unions which are used heavily in linux-ntfs." >&5 +echo "$as_me: error: Please upgrade your gcc compiler to gcc-2.96+ or gcc-3+ version!\ + Earlier compiler versions will NOT work as these do not support \ +unnamed/annonymous structures and unions which are used heavily in linux-ntfs." >&2;} + { (exit 1); exit 1; }; } fi cc_version="$cc_version, ok" -echo "$ac_t""$cc_version" 1>&6 +echo "$as_me:$LINENO: result: $cc_version" >&5 +echo "${ECHO_T}$cc_version" >&6 + +# Add -fms-extensions for gcc-3.2+. -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:5735: 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 +if test $cc_major -gt 3 -o \( $cc_major -eq 3 -a $cc_minor -ge 2 \); then + GCC_NEEDS_MS_EXTENSIONS_TRUE= + GCC_NEEDS_MS_EXTENSIONS_FALSE='#' else - cat > conftest.$ac_ext <&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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include #include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5748: \"$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 <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 -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* @@ -5778,16 +8617,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 <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 -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* @@ -5796,855 +8639,3745 @@ 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 <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 -#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:5815: \"$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 -fi -rm -fr conftest* -fi + 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 -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +fi +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 -for ac_hdr in stdint.h stdlib.h fcntl.h unistd.h errno.h sys/stat.h \ - sys/ioctl.h sys/types.h linux/types.h asm/byteorder.h sys/mount.h \ - time.h mntent.h stdio.h stdarg.h string.h getopt.h linux/major.h \ - limits.h linux/fd.h wchar.h + + + + + + + + + + + + + + + + + + + + + + + + + + +for ac_header in fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ + stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ + sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h getopt.h sys/stat.h \ + sys/types.h linux/types.h asm/byteorder.h linux/major.h linux/fd.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5845: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5855: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +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 -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - echo "$ac_t""no" 1>&6 + # 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 + 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:5883: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +# Checks for typedefs, structures, and compiler characteristics. +echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 +echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6 +if test "${ac_cv_header_stdbool_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <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() { +#include +#ifndef bool +# error bool is not defined +#endif +#ifndef false +# error false is not defined +#endif +#if false +# error false is not 0 +#endif +#ifndef true +# error true is not defined +#endif +#if true != 1 +# error true is not 1 +#endif +#ifndef __bool_true_false_are_defined +# error __bool_true_false_are_defined is not defined +#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; + struct s { _Bool s: 1; _Bool t; } s; - *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; -} + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) -0.5 == true ? 1 : -1]; + bool e = &s; + char f[(_Bool) -0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; -; return 0; } -EOF -if { (eval echo configure:5937: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +int +main () +{ + return !a + !b + !c + !d + !e + !f + !g + !h + !i; + ; + 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_stdbool_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdbool_h=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6 +echo "$as_me:$LINENO: checking for _Bool" >&5 +echo $ECHO_N "checking for _Bool... $ECHO_C" >&6 +if test "${ac_cv_type__Bool+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 +int +main () +{ +if ((_Bool *) 0) + return 0; +if (sizeof (_Bool)) + 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__Bool=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type__Bool=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 +echo "${ECHO_T}$ac_cv_type__Bool" >&6 +if test $ac_cv_type__Bool = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE__BOOL 1 +_ACEOF + + +fi + +if test $ac_cv_header_stdbool_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STDBOOL_H 1 +_ACEOF + +fi + +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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +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 + + ; + 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_c_const=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$ac_t""$ac_cv_c_const" 1>&6 +ac_cv_c_const=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +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 inline""... $ac_c" 1>&6 -echo "configure:5958: checking for inline" >&5 -if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif -int main() { -} $ac_kw foo() { -; return 0; } -EOF -if { (eval echo configure:5972: \"$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_inline=$ac_kw; break 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 done fi - -echo "$ac_t""$ac_cv_c_inline" 1>&6 -case "$ac_cv_c_inline" in +echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 +case $ac_cv_c_inline in inline | yes) ;; - no) cat >> confdefs.h <<\EOF -#define inline -EOF + no) +cat >>confdefs.h <<\_ACEOF +#define inline +_ACEOF ;; - *) cat >> confdefs.h <>confdefs.h <<_ACEOF #define inline $ac_cv_c_inline -EOF +_ACEOF ;; esac -echo $ac_n "checking for long double""... $ac_c" 1>&6 -echo "configure:5998: checking for long double" >&5 -if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for working long double with more range or precision than double" >&5 +echo $ECHO_N "checking for working long double with more range or precision than double... $ECHO_C" >&6 +if test "${ac_cv_c_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$GCC" = yes; then + 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 + long double foo = 0.0; +int +main () +{ +static int test_array [1 - 2 * !(/* Using '|' rather than '||' catches a GCC 2.95.2 x86 bug. */ + (DBL_MAX < LDBL_MAX) | (LDBL_EPSILON < DBL_EPSILON) + | (DBL_MAX_EXP < LDBL_MAX_EXP) | (DBL_MANT_DIG < LDBL_MANT_DIG))]; +test_array [0] = 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_c_long_double=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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_c_long_double=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_long_double=no -fi -rm -fr conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_c_long_double=no fi +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_c_long_double" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_c_long_double" >&5 +echo "${ECHO_T}$ac_cv_c_long_double" >&6 if test $ac_cv_c_long_double = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_LONG_DOUBLE 1 -EOF +_ACEOF fi -echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:6041: 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 < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* + 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 -#define off_t long -EOF - +rm -f conftest.$ac_objext conftest.$ac_ext fi - -echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:6074: 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: 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 > conftest.$ac_ext < -#if STDC_HEADERS -#include -#include -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* + +cat >>confdefs.h <<_ACEOF +#define off_t long +_ACEOF + +fi + +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 <<_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 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:6108: checking for 8-bit clean memcmp" >&5 -if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5 +echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6 +if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then - ac_cv_func_memcmp_clean=no -else - cat > conftest.$ac_ext <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 () { - char c0 = 0x40, c1 = 0x80, c2 = 0x81; - exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1); +static struct stat ac_aggr; +if (ac_aggr.st_blocks) +return 0; + ; + return 0; } - -EOF -if { (eval echo configure:6126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_func_memcmp_clean=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_cv_member_struct_stat_st_blocks=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_memcmp_clean=no -fi -rm -fr conftest* -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -fi - -echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 -test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" - -for ac_func in memset strdup puts printf fprintf vprintf vfprintf \ - perror strerror malloc calloc free realloc open close read write \ - lseek fdatasync ioctl fflush atexit exit time srandom random wcrtomb \ - mbrtowc mbsrtowcs setmntent getmntent endmntent hasmntopt -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6149: 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 +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_blocks) +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_blocks=yes else - cat > conftest.$ac_ext < + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_member_struct_stat_st_blocks=no +fi +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_blocks" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6 +if test $ac_cv_member_struct_stat_st_blocks = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ST_BLOCKS 1 +_ACEOF + +else + LIBOBJS="$LIBOBJS fileblocks.$ac_objext" +fi + + +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 <<_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 "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_member_struct_stat_st_rdev=no +fi +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 + + +fi + + +# Checks for library functions. +# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware. +echo "$as_me:$LINENO: checking for getmntent in -lsun" >&5 +echo $ECHO_N "checking for getmntent in -lsun... $ECHO_C" >&6 +if test "${ac_cv_lib_sun_getmntent+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsun $LIBS" +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 $ac_func(); + builtin and then its argument prototype would still apply. */ +char getmntent (); +int +main () +{ +getmntent (); + ; + 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_sun_getmntent=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -int main() { +ac_cv_lib_sun_getmntent=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_sun_getmntent" >&5 +echo "${ECHO_T}$ac_cv_lib_sun_getmntent" >&6 +if test $ac_cv_lib_sun_getmntent = yes; then + LIBS="-lsun $LIBS" +else + echo "$as_me:$LINENO: checking for getmntent in -lseq" >&5 +echo $ECHO_N "checking for getmntent in -lseq... $ECHO_C" >&6 +if test "${ac_cv_lib_seq_getmntent+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lseq $LIBS" +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 getmntent (); +int +main () +{ +getmntent (); + ; + 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_seq_getmntent=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_seq_getmntent=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_seq_getmntent" >&5 +echo "${ECHO_T}$ac_cv_lib_seq_getmntent" >&6 +if test $ac_cv_lib_seq_getmntent = yes; then + LIBS="-lseq $LIBS" +else + echo "$as_me:$LINENO: checking for getmntent in -lgen" >&5 +echo $ECHO_N "checking for getmntent in -lgen... $ECHO_C" >&6 +if test "${ac_cv_lib_gen_getmntent+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgen $LIBS" +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 getmntent (); +int +main () +{ +getmntent (); + ; + 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_gen_getmntent=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_gen_getmntent=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_gen_getmntent" >&5 +echo "${ECHO_T}$ac_cv_lib_gen_getmntent" >&6 +if test $ac_cv_lib_gen_getmntent = yes; then + LIBS="-lgen $LIBS" +fi + +fi + +fi + + +for ac_func in getmntent +do +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. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#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 (); /* 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:6177: \"$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" +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 "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 + 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 <&6 fi done -if test "$program_transform_name" = s,x,x,; then - program_transform_name= +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 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 + ac_pattern="Autoconf.*'x'" + 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 +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +else + ac_cv_prog_gcc_traditional=no fi -test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},; $program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" - -# sed with no file args requires a program. -test "$program_transform_name" = "" && program_transform_name="s,x,x," +rm -f conftest* -trap '' 1 2 15 -cat > confcache <<\EOF + if test $ac_cv_prog_gcc_traditional = no; then + 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 +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + + +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 + 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 GNU libc compatible malloc" >&5 +echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6 +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_malloc_0_nonnull=no +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 STDC_HEADERS || HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif + +int +main () +{ +exit (malloc (0) ? 0 : 1); + ; + return 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 + ac_cv_func_malloc_0_nonnull=yes +else + 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_func_malloc_0_nonnull=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 +echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6 +if test $ac_cv_func_malloc_0_nonnull = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 1 +_ACEOF + +else + cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 0 +_ACEOF + + LIBOBJS="$LIBOBJS malloc.$ac_objext" + +cat >>confdefs.h <<\_ACEOF +#define malloc rpl_malloc +_ACEOF + +fi + + + + + echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 +echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6 +if test "${ac_cv_func_mbrtowc+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 +int +main () +{ +mbstate_t state; return ! (sizeof state && mbrtowc); + ; + 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_func_mbrtowc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_mbrtowc=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_mbrtowc" >&5 +echo "${ECHO_T}$ac_cv_func_mbrtowc" >&6 + if test $ac_cv_func_mbrtowc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MBRTOWC 1 +_ACEOF + + fi + +echo "$as_me:$LINENO: checking for working memcmp" >&5 +echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 +if test "${ac_cv_func_memcmp_working+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_memcmp_working=no +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 () +{ + + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = 0x40, c1 = 0x80, c2 = 0x81; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + exit (1); + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + exit (1); + } + exit (0); + } + + ; + return 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 + ac_cv_func_memcmp_working=yes +else + 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_func_memcmp_working=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 +echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 +test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext" + + +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 + 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 GNU libc compatible realloc" >&5 +echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6 +if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_realloc_0_nonnull=no +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 STDC_HEADERS || HAVE_STDLIB_H +# include +#else +char *realloc (); +#endif + +int +main () +{ +exit (realloc (0, 0) ? 0 : 1); + ; + return 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 + ac_cv_func_realloc_0_nonnull=yes +else + 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_func_realloc_0_nonnull=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5 +echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6 +if test $ac_cv_func_realloc_0_nonnull = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_REALLOC 1 +_ACEOF + +else + cat >>confdefs.h <<\_ACEOF +#define HAVE_REALLOC 0 +_ACEOF + + LIBOBJS="$LIBOBJS realloc.$ac_objext" + +cat >>confdefs.h <<\_ACEOF +#define realloc rpl_realloc +_ACEOF + +fi + + + +echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 +echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6 +if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f conftest.sym conftest.file +echo >conftest.file +if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then + if test "$cross_compiling" = yes; then + ac_cv_func_lstat_dereferences_slashed_symlink=no +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 +int +main () +{ +struct stat sbuf; + /* Linux will dereference the symlink and fail. + That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1); + ; + return 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 + ac_cv_func_lstat_dereferences_slashed_symlink=yes +else + 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_func_lstat_dereferences_slashed_symlink=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +else + # If the `ln -s' command failed, then we probably don't even + # have an lstat function. + ac_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f conftest.sym conftest.file + +fi +echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 +echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6 + +test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && + +cat >>confdefs.h <<_ACEOF +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 +_ACEOF + + +if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then + LIBOBJS="$LIBOBJS lstat.$ac_objext" +fi + +echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5 +echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6 +if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_stat_empty_string_bug=yes +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 +int +main () +{ +struct stat sbuf; + exit (stat ("", &sbuf) ? 1 : 0); + ; + return 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 + ac_cv_func_stat_empty_string_bug=yes +else + 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_func_stat_empty_string_bug=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5 +echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6 +if test $ac_cv_func_stat_empty_string_bug = yes; then + LIBOBJS="$LIBOBJS stat.$ac_objext" + +cat >>confdefs.h <<_ACEOF +#define HAVE_STAT_EMPTY_STRING_BUG 1 +_ACEOF + +fi + + +for ac_func in strftime +do +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. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#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 (); +/* 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 +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +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 + +else + # strftime is in -lintl on SCO UNIX. +echo "$as_me:$LINENO: checking for strftime in -lintl" >&5 +echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6 +if test "${ac_cv_lib_intl_strftime+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +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 strftime (); +int +main () +{ +strftime (); + ; + 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_intl_strftime=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_intl_strftime=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_intl_strftime" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6 +if test $ac_cv_lib_intl_strftime = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_STRFTIME 1 +_ACEOF + +LIBS="-lintl $LIBS" +fi + +fi +done + +echo "$as_me:$LINENO: checking whether utime accepts a null argument" >&5 +echo $ECHO_N "checking whether utime accepts a null argument... $ECHO_C" >&6 +if test "${ac_cv_func_utime_null+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f conftest.data; >conftest.data +# Sequent interprets utime(file, 0) to mean use start of epoch. Wrong. +if test "$cross_compiling" = yes; then + ac_cv_func_utime_null=no +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 +int +main () +{ +struct stat s, t; + exit (!(stat ("conftest.data", &s) == 0 + && utime ("conftest.data", (long *)0) == 0 + && stat ("conftest.data", &t) == 0 + && t.st_mtime >= s.st_mtime + && t.st_mtime - s.st_mtime < 120)); + ; + return 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 + ac_cv_func_utime_null=yes +else + 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_func_utime_null=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f core core.* *.core +fi +echo "$as_me:$LINENO: result: $ac_cv_func_utime_null" >&5 +echo "${ECHO_T}$ac_cv_func_utime_null" >&6 +if test $ac_cv_func_utime_null = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UTIME_NULL 1 +_ACEOF + +fi +rm -f conftest.data + + +for ac_func in vprintf +do +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. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#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 (); +/* 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 +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +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 + +echo "$as_me:$LINENO: checking for _doprnt" >&5 +echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 +if test "${ac_cv_func__doprnt+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 _doprnt (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#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 _doprnt (); +/* 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__doprnt) || defined (__stub____doprnt) +choke me +#else +char (*f) () = _doprnt; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != _doprnt; + ; + 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_func__doprnt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func__doprnt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 +echo "${ECHO_T}$ac_cv_func__doprnt" >&6 +if test $ac_cv_func__doprnt = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DOPRNT 1 +_ACEOF + +fi + +fi +done + + + + + + + + + + + + + + + + +for ac_func in atexit fdatasync hasmntopt memmove memset regcomp setlocale \ + strcasecmp strchr strdup strerror strtol strtoul utime +do +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. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#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 (); +/* 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 +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +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 + +fi +done + + +# Makefiles to be created by configure. + ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile libntfs/Makefile ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" + +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} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS </dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -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 +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 -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" +LTLIBOBJS=$ac_ltlibobjs -trap 'rm -fr `echo " - Makefile - doc/Makefile - include/Makefile - libntfs/Makefile - ntfsprogs/Makefile - ntfsprogs/mkntfs.8 - ntfsprogs/ntfsfix.8 - ntfsprogs/ntfsinfo.8 - ntfsprogs/ntfslabel.8 - ntfsprogs/ntfsprogs.8 - ntfsprogs/ntfsresize.8 - ntfsprogs/ntfsundelete.8 - ntfsprogs.spec - config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < 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%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@target@%$target%g -s%@target_alias@%$target_alias%g -s%@target_cpu@%$target_cpu%g -s%@target_vendor@%$target_vendor%g -s%@target_os@%$target_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%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%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g -s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g -s%@MAINT@%$MAINT%g -s%@DEBUG_TRUE@%$DEBUG_TRUE%g -s%@DEBUG_FALSE@%$DEBUG_FALSE%g -s%@REALLYSTATIC_TRUE@%$REALLYSTATIC_TRUE%g -s%@REALLYSTATIC_FALSE@%$REALLYSTATIC_FALSE%g -s%@CXX@%$CXX%g -s%@CC@%$CC%g -s%@LN_S@%$LN_S%g -s%@OBJEXT@%$OBJEXT%g -s%@EXEEXT@%$EXEEXT%g -s%@ECHO@%$ECHO%g -s%@RANLIB@%$RANLIB%g -s%@STRIP@%$STRIP%g -s%@CPP@%$CPP%g -s%@LIBTOOL@%$LIBTOOL%g -s%@LIBTOOL_DEPS@%$LIBTOOL_DEPS%g -s%@all_includes@%$all_includes%g -s%@all_libraries@%$all_libraries%g -s%@AUTODIRS@%$AUTODIRS%g -s%@LIBOBJS@%$LIBOBJS%g - -CEOF -EOF - -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 - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - 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` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat +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 "${DEBUG_TRUE}" && test -z "${DEBUG_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"DEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"DEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${REALLYSTATIC_TRUE}" && test -z "${REALLYSTATIC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"REALLYSTATIC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"REALLYSTATIC\" 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 "${GCC_NEEDS_MS_EXTENSIONS_TRUE}" && test -z "${GCC_NEEDS_MS_EXTENSIONS_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"GCC_NEEDS_MS_EXTENSIONS\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"GCC_NEEDS_MS_EXTENSIONS\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } fi -EOF -cat >> $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. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. -CONFIG_FILES=\${CONFIG_FILES-"Makefile - doc/Makefile - include/Makefile - libntfs/Makefile - ntfsprogs/Makefile - ntfsprogs/mkntfs.8 - ntfsprogs/ntfsfix.8 - ntfsprogs/ntfsinfo.8 - ntfsprogs/ntfslabel.8 - ntfsprogs/ntfsprogs.8 - ntfsprogs/ntfsresize.8 - ntfsprogs/ntfsundelete.8 - ntfsprogs.spec -"} -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" ;; +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 + 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:$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 - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + # 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; }; } - # 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'` + # 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 - ac_dir_suffix= ac_dots= + 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 ntfsprogs $as_me 1.7.2-WIP, 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 ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +ntfsprogs config.status 1.7.2-WIP +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 + +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 + +_ACEOF + +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" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "libntfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libntfs/Makefile" ;; + "ntfsprogs/Makefile" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/Makefile" ;; + "ntfsprogs/mkntfs.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/mkntfs.8" ;; + "ntfsprogs/ntfsfix.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsfix.8" ;; + "ntfsprogs/ntfsinfo.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsinfo.8" ;; + "ntfsprogs/ntfslabel.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfslabel.8" ;; + "ntfsprogs/ntfsprogs.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsprogs.8" ;; + "ntfsprogs/ntfsresize.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsresize.8" ;; + "ntfsprogs/ntfsundelete.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsundelete.8" ;; + "ntfsprogs.spec" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs.spec" ;; + "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 +} + +# Create a (secure) tmp directory for tmp files. + +{ + 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,@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,@target@,$target,;t t +s,@target_cpu@,$target_cpu,;t t +s,@target_vendor@,$target_vendor,;t t +s,@target_os@,$target_os,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;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,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t +s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t +s,@MAINT@,$MAINT,;t t +s,@DEBUG_TRUE@,$DEBUG_TRUE,;t t +s,@DEBUG_FALSE@,$DEBUG_FALSE,;t t +s,@REALLYSTATIC_TRUE@,$REALLYSTATIC_TRUE,;t t +s,@REALLYSTATIC_FALSE@,$REALLYSTATIC_FALSE,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;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,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@LN_S@,$LN_S,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@ECHO@,$ECHO,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@LIBTOOL_DEPS@,$LIBTOOL_DEPS,;t t +s,@all_includes@,$all_includes,;t t +s,@all_libraries@,$all_libraries,;t t +s,@AUTODIRS@,$AUTODIRS,;t t +s,@GCC_NEEDS_MS_EXTENSIONS_TRUE@,$GCC_NEEDS_MS_EXTENSIONS_TRUE,;t t +s,@GCC_NEEDS_MS_EXTENSIONS_FALSE@,$GCC_NEEDS_MS_EXTENSIONS_FALSE,;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" + +_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 + + # 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 + + 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 - 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" ;; - esac +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_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 - - 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* +# +# 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' +ac_uD=',;t' -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then +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 + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} - 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 + # 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 -EOF +_ACEOF -# 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 +# 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 : +while grep . conftest.defines >/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 <> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$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 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 + 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.vals +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS -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 +# 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 grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$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 $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" - fi - rm -f $ac_file - mv conftest.h $ac_file + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi -fi; done + 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; }; }; } -EOF -cat >> $CONFIG_STATUS <"./stamp-h1" + ;; + esac +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` -EOF -cat >> $CONFIG_STATUS <<\EOF -test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + { 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; }; }; } -exit 0 -EOF + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (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 + From 4d4aa5793710176883502d3afd7ab3cd87c3572e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0544/2994] Manual merge. 2003/05/26 13:49:48+01:00 cantab.net!aia21 Fixes and start of low level device io abstraction. 2003/05/25 20:40:27+01:00 cantab.net!aia21 - Add -fms-extensions for gcc-3.2+ to fix compilations. - Update to newer autoconf/automake. BKrev: 3ed20f81yfmhtLiIzXaTuGL9i8yhqw From 49f21f5d346356fdf5b3196f576a91a9c25ef3a7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0545/2994] Manual merge. 2003/05/26 13:51:54+01:00 cantab.net!aia21 Merge rename: configure.in -> configure.ac 2003/05/26 13:49:47+01:00 cantab.net!aia21 Make it really work this time... 2003/05/25 20:40:26+01:00 cantab.net!aia21 Add -fms-extensions when compiling with gcc-3.2+. 2003/05/25 12:23:06+01:00 cantab.net!aia21 Rename: configure.in -> configure.ac (Logical change 1.136) --- configure.ac | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/configure.ac b/configure.ac index e69de29b..c6a75e84 100644 --- a/configure.ac +++ b/configure.ac @@ -0,0 +1,151 @@ +AC_PREREQ(2.57) +AC_INIT(ntfsprogs, 1.8-devel, linux-ntfs-dev@lists.sourceforge.net) +AC_CANONICAL_TARGET([]) +AC_CONFIG_SRCDIR([config.h.in]) +AM_CONFIG_HEADER([config.h]) +AM_INIT_AUTOMAKE + +# This is required to get past a stupid configure bug when making the rpm. +# Basically it is broken to specify the host as a command line argument to +# configure on its own, i.e. without giving --host=. It is supposed to work +# but doesn't. So this sets host and erases nonopt effectively moving the +# standalone command line option into the --host= form. +if test "x$nonopt" != "xNONE"; then + host="$nonopt" + nonopt="NONE" +fi + +AM_MAINTAINER_MODE + +AC_PREFIX_DEFAULT(/usr/local) +if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix $prefix" +fi + +# Command-line options. +AC_ARG_ENABLE(debug, + [ --enable-debug enable debugging], , + enable_debug=no +) + +AC_ARG_ENABLE(really-static, + [ --enable-really-static completely static binaries], , + enable_really_static=no +) + +AM_CONDITIONAL(DEBUG, test "$enable_debug" = yes) +AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes) + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_RANLIB + +# create a working libtool-script +if test -z "$LIBTOOL"; then + AC_LANG_PUSH(C) + AM_PROG_LIBTOOL + #LIBTOOL="$LIBTOOL --silent" + AC_LANG_POP + AC_SUBST(LIBTOOL_DEPS) + LIBTOOL_SHELL='/bin/sh ./libtool' +else + LIBTOOL_SHELL=$LIBTOOL +fi + +# add --with-extra-includes and --with-extra-libs switch to ./configure +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +AC_SUBST(CFLAGS) +AC_SUBST(CPPFLAGS) +AC_SUBST(LDFLAGS) + +AC_SUBST(AUTODIRS) + +# Get compiler name +if test ! -z "$CC"; then + _cc="$CC" +else + _cc="gcc" +fi + +# Check for gcc version being >= 2.96. +AC_MSG_CHECKING(version of $_cc) +cc_version=`./getgccver $_cc` +cc_major=`echo $cc_version | cut -d'.' -f1` +cc_minor=`echo $cc_version | cut -d'.' -f2` +if test -z "$cc_version"; then + cc_version="v. ?.??" + cc_major=1 + cc_minor=1 +fi +if test $cc_major -lt 2 -o \( $cc_major -eq 2 -a $cc_minor -lt 96 \) ; then +cc_version="$cc_version, bad" +AC_MSG_RESULT($cc_version) +AC_MSG_ERROR(Please upgrade your gcc compiler to gcc-2.96+ or gcc-3+ version!\ + Earlier compiler versions will NOT work as these do not support \ +unnamed/annonymous structures and unions which are used heavily in linux-ntfs.) +fi +cc_version="$cc_version, ok" +AC_MSG_RESULT($cc_version) + +# Add -fms-extensions for gcc-3.2+. +AM_CONDITIONAL(GCC_NEEDS_MS_EXTENSIONS, test $cc_major -gt 3 -o \( $cc_major -eq 3 -a $cc_minor -ge 2 \)) + +# Checks for libraries. + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ + stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ + sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h getopt.h sys/stat.h \ + sys/types.h linux/types.h asm/byteorder.h linux/major.h linux/fd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_C_INLINE +AC_C_LONG_DOUBLE +AC_TYPE_OFF_T +AC_TYPE_SIZE_T +AC_STRUCT_ST_BLOCKS +AC_CHECK_MEMBERS([struct stat.st_rdev]) + +# Checks for library functions. +AC_FUNC_GETMNTENT +AC_PROG_GCC_TRADITIONAL +AC_FUNC_MALLOC +AC_FUNC_MBRTOWC +AC_FUNC_MEMCMP +AC_FUNC_REALLOC +AC_FUNC_STAT +AC_FUNC_STRFTIME +AC_FUNC_UTIME_NULL +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \ + strcasecmp strchr strdup strerror strtol strtoul utime]) + +# Makefiles to be created by configure. +AC_CONFIG_FILES([ + Makefile + doc/Makefile + include/Makefile + libntfs/Makefile + ntfsprogs/Makefile + ntfsprogs/mkntfs.8 + ntfsprogs/ntfsfix.8 + ntfsprogs/ntfsinfo.8 + ntfsprogs/ntfslabel.8 + ntfsprogs/ntfsprogs.8 + ntfsprogs/ntfsresize.8 + ntfsprogs/ntfsundelete.8 + ntfsprogs.spec +]) +AC_OUTPUT From 497caee13a7182d0f964a9ae35187fb6cd16f571 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0546/2994] Manual merge. }(Logical change 1.136) --- configure.in | 141 --------------------------------------------------- 1 file changed, 141 deletions(-) delete mode 100644 configure.in diff --git a/configure.in b/configure.in deleted file mode 100644 index 571b6396..00000000 --- a/configure.in +++ /dev/null @@ -1,141 +0,0 @@ -AC_INIT(aclocal.m4) - -dnl This is required to get past a stupid configure bug when making the rpm. -dnl Basically it is broken to specify the host as a command line argument to -dnl configure on its own, i.e. without giving --host=. It is supposed to work -dnl but doesn't. So this sets host and erases nonopt effectively moving the -dnl standalone command line option into the --host= form. -if test "x$nonopt" != "xNONE"; then - host="$nonopt" - nonopt="NONE" -fi - -AC_CANONICAL_SYSTEM - -AM_INIT_AUTOMAKE(ntfsprogs,1.8.0-devel) - -AM_MAINTAINER_MODE - -AM_CONFIG_HEADER(config.h) - -AC_PREFIX_DEFAULT(/usr/local) -if test "x$prefix" = "xNONE"; then - prefix=$ac_default_prefix - ac_configure_args="$ac_configure_args --prefix $prefix" -fi - -dnl Command-line options. -AC_ARG_ENABLE(debug, - [ --enable-debug enable debugging], , - enable_debug=no -) - -AC_ARG_ENABLE(really-static, - [ --enable-really-static completely static binaries], , - enable_really_static=no -) - -AM_CONDITIONAL(DEBUG, test "$enable_debug" = yes) -AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes) - -dnl Checks for programs. -AC_PROG_CXX -AC_PROG_CC -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET - -dnl create a working libtool-script -if test -z "$LIBTOOL"; then - AC_LANG_SAVE - AC_LANG_C - AM_PROG_LIBTOOL - dnl LIBTOOL="$LIBTOOL --silent" - AC_LANG_RESTORE - AC_SUBST(LIBTOOL_DEPS) - LIBTOOL_SHELL='/bin/sh ./libtool' -else - LIBTOOL_SHELL=$LIBTOOL -fi - -dnl add --with-extra-includes and --with-extra-libs switch to ./configure -all_libraries="$all_libraries $USER_LDFLAGS" -all_includes="$all_includes $USER_INCLUDES" -AC_SUBST(all_includes) -AC_SUBST(all_libraries) - -AC_SUBST(AUTODIRS) - -AC_SUBST(CFLAGS) -AC_SUBST(CPPFLAGS) -AC_SUBST(LDFLAGS) - -dnl Get compiler name -if test ! -z "$CC"; then - _cc="$CC" -else - _cc="gcc" -fi - -dnl Check for gcc version being >= 2.96. -AC_MSG_CHECKING(version of $_cc) -cc_version=`$_cc --version 2>&1 | head -1 | sed 's/egcs-//' | sed 's/gcc (GCC) \([0-9]\.[0-9]\).*/\1/'` -cc_major=`echo $cc_version | cut -d'.' -f1` -cc_minor=`echo $cc_version | cut -d'.' -f2` -if test -z $cc_version; then - cc_version="v. ?.??" - cc_major=1 -fi -if test $cc_major -lt 2 -o \( $cc_major -eq 2 -a $cc_minor -lt 96 \) ; then -cc_version="$cc_version, bad" -AC_MSG_RESULT($cc_version) -AC_MSG_ERROR(Please upgrade your gcc compiler to gcc-2.96+ or gcc-3+ version!\ - Earlier compiler versions will NOT work as these do not support \ -unnamed/annonymous structures and unions which are used heavily in linux-ntfs.) -fi -cc_version="$cc_version, ok" -AC_MSG_RESULT($cc_version) - -dnl Checks for libraries. - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(stdint.h stdlib.h fcntl.h unistd.h errno.h sys/stat.h \ - sys/ioctl.h sys/types.h linux/types.h asm/byteorder.h sys/mount.h \ - time.h mntent.h stdio.h stdarg.h string.h getopt.h linux/major.h \ - limits.h linux/fd.h wchar.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_C_INLINE -AC_C_LONG_DOUBLE -AC_TYPE_OFF_T -AC_TYPE_SIZE_T - -dnl Checks for library functions. -AC_FUNC_MEMCMP -AC_CHECK_FUNCS(memset strdup puts printf fprintf vprintf vfprintf \ - perror strerror malloc calloc free realloc open close read write \ - lseek fdatasync ioctl fflush atexit exit time srandom random wcrtomb \ - mbrtowc mbsrtowcs setmntent getmntent endmntent hasmntopt) - -dnl Perform program name transformation. -AC_ARG_PROGRAM - -dnl Makefiles to be created by configure. -AC_OUTPUT([ - Makefile - doc/Makefile - include/Makefile - libntfs/Makefile - ntfsprogs/Makefile - ntfsprogs/mkntfs.8 - ntfsprogs/ntfsfix.8 - ntfsprogs/ntfsinfo.8 - ntfsprogs/ntfslabel.8 - ntfsprogs/ntfsprogs.8 - ntfsprogs/ntfsresize.8 - ntfsprogs/ntfsundelete.8 - ntfsprogs.spec -]) - From b9286881538951b56b9af1f35139e9010f3360db Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0547/2994] Typo fix. 2003/05/25 21:04:53+01:00 cantab.net!aia21 Add allocation and deallocation of devices. 2003/05/25 20:40:26+01:00 cantab.net!aia21 fix typos. 2003/05/25 15:40:47+01:00 cantab.net!aia21 (Logical change 1.136) --- include/device.h | 87 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/include/device.h b/include/device.h index e69de29b..fb483fb8 100644 --- a/include/device.h +++ b/include/device.h @@ -0,0 +1,87 @@ +/* + * device.h - Exports for low level device io. Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_DEVICE_H +#define _NTFS_DEVICE_H + +#include "types.h" +#include "support.h" + +/* + * Defined bits for the state field in the ntfs_device structure. + */ +typedef enum { + ND_Open, /* 1: Device is open. */ + ND_ReadOnly, /* 1: Device is read-only. */ + ND_Dirty, /* 1: Device is dirty, needs sync. */ +} ntfs_device_state_bits; + +#define test_ndev_flag(nd, flag) test_bit(ND_##flag, (nd)->d_state) +#define set_ndev_flag(nd, flag) set_bit(ND_##flag, (nd)->d_state) +#define clear_ndev_flag(nd, flag) clear_bit(ND_##flag, (nd)->d_state) + +#define NDevOpen(nd) test_ndev_flag(nd, Open) +#define NDevSetOpen(nd) set_ndev_flag(nd, Open) +#define NDevClearOpen(nd) clear_ndev_flag(nd, Open) + +#define NDevReadOnly(nd) test_ndev_flag(nd, ReadOnly) +#define NDevSetReadOnly(nd) set_ndev_flag(nd, ReadOnly) +#define NDevClearReadOnly(nd) clear_ndev_flag(nd, ReadOnly) + +#define NDevDirty(nd) test_ndev_flag(nd, Dirty) +#define NDevSetDirty(nd) set_ndev_flag(nd, Dirty) +#define NDevClearDirty(nd) clear_ndev_flag(nd, Dirty) + +/* Forward declaration. */ +struct ntfs_device_operations; + +/* + * The ntfs device structure defining all operations needed to access the low + * level device underlying the ntfs volume. + */ +struct ntfs_device { + struct ntfs_device_operations *d_ops; /* Device operations. */ + unsigned long d_state; /* State of the device. */ + char *d_name; /* Name of device. */ + void *d_private; /* Private data used by the + device operations. */ +}; + +/* + * The ntfs device operations defining all operations that can be performed on + * the low level device described by a ntfs device structure. + */ +struct ntfs_device_operations { + struct ntfs_device *(*open)(const char *pathname, int flags); + int (*close)(struct ntfs_device *dev); + int (*sync)(struct ntfs_device *dev); + s64 (*seek)(struct ntfs_device *dev, s64 offset, int whence); + s64 (*read)(struct ntfs_device *dev, void *buf, s64 count); + s64 (*write)(struct ntfs_device *dev, const void *buf, s64 count); + s64 (*pread)(struct ntfs_device *dev, void *buf, s64 count, s64 offset); + s64 (*pwrite)(struct ntfs_device *dev, const void *buf, s64 count, + s64 offset); +}; + +struct ntfs_device *ntfs_device_alloc(void); +int ntfs_device_free(struct ntfs_device *dev); + +#endif /* defined _NTFS_DEVICE_H */ From dac5ebd4806ff1da202e2e490c4f618bbfeff278 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0548/2994] Update. (Logical change 1.136) --- INSTALL | 126 +++-- Makefile.in | 465 ++++++++++-------- aclocal.m4 | 1142 +++++++++++++++++++++++++++++++++++++------ config.guess | 240 ++++----- config.h.in | 316 ++++++------ config.sub | 149 ++++-- doc/Makefile.in | 188 ++++--- include/Makefile.in | 262 +++++----- install-sh | 36 +- ltmain.sh | 508 ++++++++++++------- missing | 166 ++++++- mkinstalldirs | 73 ++- 12 files changed, 2559 insertions(+), 1112 deletions(-) diff --git a/INSTALL b/INSTALL index 28d8614f..9f879171 100644 --- a/INSTALL +++ b/INSTALL @@ -19,20 +19,27 @@ various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. The simplest way to compile this package is: @@ -66,14 +73,16 @@ Compilers and Options ===================== Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== @@ -86,11 +95,11 @@ directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. Installation Names ================== @@ -137,22 +146,31 @@ emitted to stdout. Specifying the System Type ========================== - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ atchitectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. +where SYSTEM can have one of these forms: - If you are building compiler tools for cross-compiling, you can also + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. Sharing Defaults ================ @@ -165,20 +183,44 @@ default values for variables like `CC', `cache_file', and `prefix'. `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. -Operation Controls +Defining Variables ================== + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + `configure' recognizes the following options to control how it operates. -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - `--help' +`-h' Print a summary of the options to `configure', and exit. +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `./config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + `--quiet' `--silent' `-q' @@ -190,8 +232,6 @@ operates. Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. -`configure' also accepts some other, not widely useful, options. diff --git a/Makefile.in b/Makefile.in index 4cf5b085..9bec01b4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,6 +1,8 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am +# Makefile.in generated by automake 1.6.3 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 +# 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,9 +12,7 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# Need this to enable 64-bit (device) file access functions and parameters. - - +@SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ @@ -33,13 +33,9 @@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include - -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ - top_builddir = . ACLOCAL = @ACLOCAL@ @@ -47,49 +43,59 @@ 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_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ - NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ AS = @AS@ AUTODIRS = @AUTODIRS@ +AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ +DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ -EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ all_includes = @all_includes@ all_libraries = @all_libraries@ -@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall -@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +# Need this to enable 64-bit (device) file access functions and parameters. +@DEBUG_TRUE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall +@DEBUG_FALSE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 SUBDIRS = doc include libntfs ntfsprogs @@ -99,66 +105,71 @@ EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ AUTOMAKE_OPTIONS = gnu +subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = ntfsprogs.spec -DIST_COMMON = README ./stamp-h.in AUTHORS COPYING ChangeLog INSTALL \ -Makefile.am Makefile.in NEWS acconfig.h aclocal.m4 config.guess \ -config.h.in config.sub configure configure.in install-sh ltconfig \ -ltmain.sh missing mkinstalldirs ntfsprogs.spec.in +CONFIG_CLEAN_FILES = ntfsprogs.spec +DIST_SOURCES = +RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ + uninstall-info-recursive all-recursive install-data-recursive \ + install-exec-recursive installdirs-recursive install-recursive \ + uninstall-recursive check-recursive installcheck-recursive +DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ + Makefile.in NEWS aclocal.m4 config.guess config.h.in config.sub \ + configure configure.ac depcomp install-sh ltconfig ltmain.sh \ + missing mkinstalldirs ntfsprogs.spec.in +DIST_SUBDIRS = $(SUBDIRS) +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -all: all-redirect .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in - cd $(srcdir) && $(ACLOCAL) - -config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) +$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck -$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) -config.h: stamp-h +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.ac + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 @if test ! -f $@; then \ - rm -f stamp-h; \ - $(MAKE) stamp-h; \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ 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: @MAINTAINER_MODE_TRUE@$(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 + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h + +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) - @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null - -mostlyclean-hdr: - -clean-hdr: + touch $(srcdir)/config.h.in distclean-hdr: - -rm -f config.h - -maintainer-clean-hdr: + -rm -f config.h stamp-h1 ntfsprogs.spec: $(top_builddir)/config.status ntfsprogs.spec.in - cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + cd $(top_builddir) && $(SHELL) ./config.status $@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -166,13 +177,8 @@ ntfsprogs.spec: $(top_builddir)/config.status ntfsprogs.spec.in # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. - -@SET_MAKE@ - -all-recursive install-data-recursive install-exec-recursive \ -installdirs-recursive install-recursive uninstall-recursive \ -check-recursive installcheck-recursive info-recursive dvi-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -192,13 +198,18 @@ check-recursive installcheck-recursive info-recursive dvi-recursive: mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ + @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ - rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ - rev="$$subdir $$rev"; \ - test "$$subdir" != "." || dot_seen=yes; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ done; \ - test "$$dot_seen" = "no" && rev=". $$rev"; \ + rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ @@ -215,177 +226,236 @@ tags-recursive: test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done +ETAGS = etags +ETAGSFLAGS = + tags: TAGS -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ + if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - fi; \ + fi; \ done; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + 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) + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +top_distdir = . distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) + +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } + +GZIP_ENV = --best +distcleancheck_listfiles = find . -type f -print + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkinstalldirs) $(distdir)/. $(distdir)/ntfsprogs + @list='$(DISTFILES)'; for file in $$list; do \ + 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 \ + 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 \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="${top_distdir}" distdir="$(distdir)" \ + dist-hook + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_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 + $(am__remove_distdir) + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/=build mkdir $(distdir)/=inst - dc_install_base=`cd $(distdir)/=inst && pwd`; \ - cd $(distdir)/=build \ + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ + && cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ + $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) dist - -rm -rf $(distdir) - @banner="$(distdir).tar.gz is ready for distribution"; \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - echo "$$dashes" -dist: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -dist-all: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -distdir: $(DISTFILES) - -rm -rf $(distdir) - mkdir $(distdir) - -chmod 777 $(distdir) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - for subdir in $(SUBDIRS); do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - chmod 777 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook -info-am: -info: info-recursive -dvi-am: -dvi: dvi-recursive + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + find $$dc_install_base -type f -print ; \ + exit 1; } >&2 ) \ + && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ + && rm -f $(distdir).tar.gz \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' +distcleancheck: distclean + if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 check-am: all-am check: check-recursive -installcheck-am: -installcheck: installcheck-recursive -all-recursive-am: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -install-exec-am: -install-exec: install-exec-recursive - -install-data-am: -install-data: install-data-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-recursive -uninstall-am: -uninstall: uninstall-recursive all-am: Makefile config.h -all-redirect: all-recursive-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: installdirs-recursive installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -mostlyclean-am: mostlyclean-hdr mostlyclean-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-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) +distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf autom4te.cache +maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive -clean-am: clean-hdr clean-tags clean-generic mostlyclean-am +mostlyclean-am: mostlyclean-generic mostlyclean-libtool -clean: clean-recursive +uninstall-am: uninstall-info-am -distclean-am: distclean-hdr distclean-tags distclean-generic clean-am - -rm -f libtool +uninstall-info: uninstall-info-recursive -distclean: distclean-recursive - -rm -f config.status - -maintainer-clean-am: maintainer-clean-hdr 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." - -maintainer-clean: maintainer-clean-recursive - -rm -f config.status - -.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ -install-data-recursive uninstall-data-recursive install-exec-recursive \ -uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ -all-recursive check-recursive installcheck-recursive info-recursive \ -dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ -maintainer-clean-recursive tags tags-recursive 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-am \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean +.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive dist dist-all \ + dist-gzip distcheck distclean distclean-generic distclean-hdr \ + distclean-libtool distclean-recursive distclean-tags \ + distcleancheck distdir dvi dvi-am dvi-recursive info info-am \ + info-recursive install install-am install-data install-data-am \ + install-data-recursive install-exec install-exec-am \ + install-exec-recursive install-info install-info-am \ + install-info-recursive install-man install-recursive \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am installdirs-recursive maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive mostlyclean \ + mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ + tags tags-recursive uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive dist-hook: ntfsprogs.spec @@ -396,7 +466,6 @@ libtool: $(LIBTOOL_DEPS) strip: $(MAKE) -C ntfsprogs strip - # 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/aclocal.m4 b/aclocal.m4 index e3c1a7db..3dc75895 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,70 +1,311 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p5 +# aclocal.m4 generated automatically by aclocal 1.6.3 -*- 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 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. -# 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. +# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- -# serial 1 +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) +# 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 + +# 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. We must strip everything past the first ":", +# and everything past the last "/". + +# _AM_DIRNAME(PATH) +# ----------------- +# Like AS_DIRNAME, only do it during macro expansion +AC_DEFUN([_AM_DIRNAME], + [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, + m4_if(regexp([$1], [^//\([^/]\|$\)]), -1, + m4_if(regexp([$1], [^/.*]), -1, + [.], + patsubst([$1], [^\(/\).*], [\1])), + patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), + patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl +])# _AM_DIRNAME + + +# The stamp files are numbered to have different names. +# We could number them on a directory basis, but that's additional +# complications, let's have a unique counter. +m4_define([_AM_STAMP_Count], [0]) + + +# _AM_STAMP(HEADER) +# ----------------- +# The name of the stamp file for HEADER. +AC_DEFUN([_AM_STAMP], +[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl +AS_ESCAPE(_AM_DIRNAME(patsubst([$1], + [:.*])))/stamp-h[]_AM_STAMP_Count]) + + +# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS) +# ------------------------------------------------------------ +# We used to try to get a real timestamp in stamp-h. But the fear is that +# that will cause unnecessary cvs conflicts. +AC_DEFUN([_AM_CONFIG_HEADER], +[# Add the stamp file to the list of files AC keeps track of, +# along with our hook. +AC_CONFIG_HEADERS([$1], + [# update the timestamp +echo 'timestamp for $1' >"_AM_STAMP([$1])" +$2], + [$3]) +])# _AM_CONFIG_HEADER + + +# AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS) +# -------------------------------------------------------------- +AC_DEFUN([AM_CONFIG_HEADER], +[AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])]) +])# AM_CONFIG_HEADER + +# 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 1996, 1997, 1998, 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 8 + +# 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... + + +AC_PREREQ([2.52]) + +# 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])]) + +# 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 + +_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 +]) +]) + +# 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.6"]) + +# 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.6.3])]) + +# 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 @@ -74,7 +315,7 @@ if ( alias in your environment]) fi - test "[$]2" = conftestfile + test "$[2]" = conftest.file ) then # Ok. @@ -83,28 +324,536 @@ 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) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) -fi +[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 + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# AM_AUX_DIR_EXPAND + +# 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])]) + +# serial 4 -*- Autoconf -*- + +# Copyright 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. + + +# 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 + + 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 + # 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. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}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=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_$1_dependencies_compiler_type=$depmode + break + 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_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null +AC_SUBST([DEPDIR]) +]) + + +# 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"]) +]) + +# Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*- + +# 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' +doit: + @echo done +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 | fgrep -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], +[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])]) + # Add --enable-maintainer-mode option to configure. # From Jim Meyering +# Copyright 1996, 1998, 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 1 AC_DEFUN([AM_MAINTAINER_MODE], @@ -115,49 +864,13 @@ AC_DEFUN([AM_MAINTAINER_MODE], (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) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST(MAINT)dnl ] ) -# Define a conditional. - -AC_DEFUN([AM_CONDITIONAL], -[AC_SUBST($1_TRUE) -AC_SUBST($1_FALSE) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi]) - -# Like AC_CONFIG_HEADER, but automatically create stamp file. - -AC_DEFUN([AM_CONFIG_HEADER], -[AC_PREREQ([2.12]) -AC_CONFIG_HEADER([$1]) -dnl When config.status generates a header, we must update the stamp-h file. -dnl This file resides in the same directory as the config header -dnl that is generated. We must strip everything past the first ":", -dnl and everything past the last "/". -AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl -ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, -<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, -<>; do - case " <<$>>CONFIG_HEADERS " in - *" <<$>>am_file "*<<)>> - echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx - ;; - esac - am_indx=`expr "<<$>>am_indx" + 1` -done<<>>dnl>>) -changequote([,]))]) - # libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- # serial 46 AC_PROG_LIBTOOL @@ -187,6 +900,8 @@ 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([LT_AC_PROG_SED])dnl + AC_REQUIRE([AC_PROG_LN_S])dnl AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl AC_REQUIRE([AC_OBJEXT])dnl @@ -354,9 +1069,12 @@ hpux*) # Its linker distinguishes data from code symbols lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; -irix*) +irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; solaris* | sysv5*) symcode='[[BDT]]' ;; @@ -453,7 +1171,7 @@ EOF save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$no_builtin_flag" - if AC_TRY_EVAL(ac_link) && test -s conftest; then + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS="$save_LIBS" @@ -997,7 +1715,7 @@ AC_CACHE_VAL(lt_cv_prog_cc_pic, # like `-m68040'. lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' ;; - beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; darwin* | rhapsody*) @@ -1040,7 +1758,7 @@ AC_CACHE_VAL(lt_cv_prog_cc_pic, lt_cv_prog_cc_pic='+Z' ;; - irix5* | irix6*) + irix5* | irix6* | nonstopux*) lt_cv_prog_cc_wl='-Wl,' lt_cv_prog_cc_static='-non_shared' # PIC (with -KPIC) is the default. @@ -1084,11 +1802,7 @@ AC_CACHE_VAL(lt_cv_prog_cc_pic, sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) lt_cv_prog_cc_pic='-KPIC' lt_cv_prog_cc_static='-Bstatic' - if test "x$host_vendor" = xsni; then - lt_cv_prog_cc_wl='-LD' - else - lt_cv_prog_cc_wl='-Wl,' - fi + lt_cv_prog_cc_wl='-Wl,' ;; uts4*) @@ -1453,7 +2167,7 @@ EOF # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is. # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then + archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname-def; else echo EXPORTS > $output_objdir/$soname-def; @@ -1462,6 +2176,7 @@ EOF set dummy \$symbol; case \[$]# in 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; esac; _lt_hint=`expr 1 + \$_lt_hint`; @@ -1574,10 +2289,12 @@ else # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + case $ld_flag in + *-brtl*) aix_use_runtimelinking=yes break - fi + ;; + esac done esac @@ -1691,8 +2408,9 @@ else esac # FIXME: Relying on posixy $() will cause problems for # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' # We need to add '_' to the symbols in $export_symbols first #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' hardcode_direct=yes @@ -1744,13 +2462,14 @@ else export_dynamic_flag_spec='${wl}-E' ;; - irix5* | irix6*) + irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='-rpath $libdir' fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; @@ -1778,7 +2497,7 @@ else hardcode_direct=yes hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else @@ -1788,7 +2507,7 @@ else hardcode_libdir_flag_spec='-R$libdir' ;; *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac @@ -1900,13 +2619,23 @@ EOF ;; sysv4) - if test "x$host_vendor" = xsno; then - archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - else - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - fi + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; @@ -2047,6 +2776,9 @@ aix3*) aix4* | aix5*) version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' @@ -2085,6 +2817,7 @@ aix4* | aix5*) fi shlibpath_var=LIBPATH fi + hardcode_into_libs=yes ;; amigaos*) @@ -2132,7 +2865,7 @@ cygwin* | mingw* | pw32*) ;; yes,mingw*) library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` ;; yes,pw32*) library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' @@ -2215,14 +2948,17 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; -irix5* | irix6*) - version_type=irix +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) version_type=irix ;; + esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}.so$major' library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' case $host_os in - irix5*) + irix5* | nonstopux*) libsuff= shlibsuff= ;; *) @@ -2267,6 +3003,26 @@ linux-gnu*) # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' + + # Find out which ABI we are using (multilib Linux x86_64 hack). + libsuff= + case "$host_cpu" in + x86_64*|s390x*) + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + ;; + esac + fi + rm -rf conftest* + ;; + *) + ;; + esac + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" ;; netbsd*) @@ -2326,11 +3082,12 @@ os2*) osf3* | osf4* | osf5*) version_type=osf need_version=no - soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + hardcode_into_libs=yes ;; sco3.2v5*) @@ -2373,6 +3130,12 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) case $host_vendor in sni) shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no ;; motorola) need_lib_prefix=no @@ -2527,7 +3290,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS \ + for var in echo old_CC old_CFLAGS SED \ AR AR_FLAGS CC LD LN_S NM SHELL \ reload_flag reload_cmds wl \ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ @@ -2589,8 +3352,11 @@ if test -f "$ltmain"; then # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +# A sed that does not truncate output. +SED=$lt_SED + # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="sed -e s/^X//" +Xsed="${SED} -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -3351,7 +4117,7 @@ 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], +[AC_CACHE_CHECK([how to recognise dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= @@ -3426,9 +4192,9 @@ hpux10.20*|hpux11*) lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; -irix5* | irix6*) +irix5* | irix6* | nonstopux*) case $host_os in - irix5*) + irix5* | nonstopux*) # 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" ;; @@ -3450,7 +4216,7 @@ irix5* | irix6*) # This must be Linux ELF. linux-gnu*) case $host_cpu in - alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* | s390* ) + alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | s390* | x86_64*) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM @@ -3521,6 +4287,9 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; esac ;; esac @@ -3586,12 +4355,12 @@ 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 convenience library and LTDLINCL to the include flags for # the libltdl header and adds --enable-ltdl-convenience to the -# configure arguments. Note that LIBLTDL and INCLTDL are not +# configure arguments. Note that LIBLTDL and LTDLINCL 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 +# with '${top_builddir}/' and LTDLINCL 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. @@ -3603,16 +4372,18 @@ AC_DEFUN([AC_LIBLTDL_CONVENIENCE], 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']) + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" ]) # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library and INCLTDL to the include flags for +# the libltdl installable library and LTDLINCL 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 +# arguments. Note that LIBLTDL and LTDLINCL 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 +# be prefixed with '${top_builddir}/' and LTDLINCL 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. @@ -3630,12 +4401,14 @@ AC_DEFUN([AC_LIBLTDL_INSTALLABLE], 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']) + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" - INCLTDL= + LTDLINCL= fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" ]) # old names @@ -3650,3 +4423,92 @@ AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_executable_p="test -f" +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_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + fi + done + done +done + + # 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 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break + fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 40000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done + done + rm -rf "$tmp" +]) +if test "X$SED" != "X"; then + lt_cv_path_SED=$SED +else + SED=$lt_cv_path_SED +fi +AC_MSG_RESULT([$SED]) +]) + diff --git a/config.guess b/config.guess index ba661651..dff9e481 100755 --- a/config.guess +++ b/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -timestamp='2001-04-20' +timestamp='2001-09-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -95,25 +95,25 @@ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int dummy(){}" > $dummy.c +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; for c in cc gcc c89 ; do - ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; if test $? = 0 ; then - CC_FOR_BUILD="$c"; break - fi - done - rm -f $dummy.c $dummy.o $dummy.rel + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found + CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac +esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 8/24/94.) +# (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi @@ -150,6 +150,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # to ELF recently, or will in the future. case "${UNAME_MACHINE}" in i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then @@ -204,6 +205,7 @@ main: jsr \$26,exit .end main EOF + eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in @@ -225,6 +227,9 @@ EOF 2-307) UNAME_MACHINE="alphaev67" ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; esac fi rm -f $dummy.s $dummy @@ -328,6 +333,9 @@ EOF aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; + sparc*:NetBSD:*) + echo `uname -p`-unknown-netbsd${UNAME_RELEASE} + exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -385,6 +393,7 @@ EOF echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ @@ -475,6 +484,7 @@ EOF exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include @@ -553,6 +563,7 @@ EOF fi ;; esac if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE @@ -586,9 +597,9 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -598,6 +609,7 @@ EOF echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int @@ -633,7 +645,7 @@ EOF 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; - *9??*:MPE/iX:*:*) + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) @@ -677,12 +689,13 @@ EOF echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' @@ -763,97 +776,29 @@ EOF echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) - cat >$dummy.c < /* for printf() prototype */ -int main (int argc, char *argv[]) { -#else -int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __MIPSEB__ - printf ("%s-unknown-linux-gnu\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux-gnu\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in + big) echo mips-unknown-linux-gnu && exit 0 ;; + little) echo mipsel-unknown-linux-gnu && exit 0 ;; + esac ;; ppc:Linux:*:*) - # Determine Lib Version - cat >$dummy.c < -#if defined(__GLIBC__) -extern char __libc_version[]; -extern char __libc_release[]; -#endif -main(argc, argv) - int argc; - char *argv[]; -{ -#if defined(__GLIBC__) - printf("%s %s\n", __libc_version, __libc_release); -#else - printf("unknown\n"); -#endif - return 0; -} -EOF - LIBC="" - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy | grep 1\.99 > /dev/null - if test "$?" = 0 ; then LIBC="libc1" ; fi - fi - rm -f $dummy.c $dummy - echo powerpc-unknown-linux-gnu${LIBC} + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) - cat <$dummy.s - .data - \$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - .text - .globl main - .align 4 - .ent main - main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - LIBC="" - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) UNAME_MACHINE="alpha" ;; - 1-0) UNAME_MACHINE="alphaev5" ;; - 1-1) UNAME_MACHINE="alphaev56" ;; - 1-101) UNAME_MACHINE="alphapca56" ;; - 2-303) UNAME_MACHINE="alphaev6" ;; - 2-307) UNAME_MACHINE="alphaev67" ;; - esac - objdump --private-headers $dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.s $dummy + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) @@ -883,40 +828,30 @@ EOF # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. - ld_supported_emulations=`cd /; ld --help 2>&1 \ - | sed -ne '/supported emulations:/!d + ld_supported_targets=`cd /; ld --help 2>&1 \ + | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g - s/.*supported emulations: *// + s/.*supported targets: *// s/ .*// p'` - case "$ld_supported_emulations" in - i*86linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 - ;; - elf_i*86) + case "$ld_supported_targets" in + elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; - i*86coff) + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 - ;; - esac - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - case "${UNAME_MACHINE}" in - i*86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; esac # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build cat >$dummy.c < #ifdef __cplusplus @@ -928,15 +863,15 @@ EOF #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); + printf ("%s-pc-linux-gnu\n", argv[1]); # else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); + printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif # else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); + printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif #else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); + printf ("%s-pc-linux-gnuaout\n", argv[1]); #endif return 0; } @@ -945,9 +880,10 @@ EOF rm -f $dummy.c $dummy test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; -# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions -# are messed up and put the nodename in both sysname and nodename. i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) @@ -966,14 +902,13 @@ EOF echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; - i*86:*:5:7*) - # Fixed at (any) Pentium or better - UNAME_MACHINE=i586 - if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then - echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} - fi + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then @@ -1067,8 +1002,8 @@ EOF echo ns32k-sni-sysv fi exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) @@ -1080,6 +1015,10 @@ EOF # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; @@ -1172,11 +1111,18 @@ EOF *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 +eval $set_cc_for_build cat >$dummy.c < diff --git a/config.h.in b/config.h.in index f9e8946e..5fce5eb8 100644 --- a/config.h.in +++ b/config.h.in @@ -1,191 +1,227 @@ -/* config.h.in. Generated automatically from configure.in by autoheader. */ +/* config.h.in. Generated from configure.ac by autoheader. */ -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define if the `long double' type works. */ -#undef HAVE_LONG_DOUBLE - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* Define to `long' if doesn't define. */ -#undef off_t - -/* Define to `unsigned' if doesn't define. */ -#undef size_t - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if you have the atexit function. */ -#undef HAVE_ATEXIT - -/* Define if you have the calloc function. */ -#undef HAVE_CALLOC - -/* Define if you have the close function. */ -#undef HAVE_CLOSE - -/* Define if you have the endmntent function. */ -#undef HAVE_ENDMNTENT - -/* Define if you have the exit function. */ -#undef HAVE_EXIT - -/* Define if you have the fdatasync function. */ -#undef HAVE_FDATASYNC - -/* Define if you have the fflush function. */ -#undef HAVE_FFLUSH - -/* Define if you have the fprintf function. */ -#undef HAVE_FPRINTF - -/* Define if you have the free function. */ -#undef HAVE_FREE - -/* Define if you have the getmntent function. */ -#undef HAVE_GETMNTENT - -/* Define if you have the hasmntopt function. */ -#undef HAVE_HASMNTOPT - -/* Define if you have the ioctl function. */ -#undef HAVE_IOCTL - -/* Define if you have the lseek function. */ -#undef HAVE_LSEEK - -/* Define if you have the malloc function. */ -#undef HAVE_MALLOC - -/* Define if you have the mbrtowc function. */ -#undef HAVE_MBRTOWC - -/* Define if you have the mbsrtowcs function. */ -#undef HAVE_MBSRTOWCS - -/* Define if you have the memset function. */ -#undef HAVE_MEMSET - -/* Define if you have the open function. */ -#undef HAVE_OPEN - -/* Define if you have the perror function. */ -#undef HAVE_PERROR - -/* Define if you have the printf function. */ -#undef HAVE_PRINTF - -/* Define if you have the puts function. */ -#undef HAVE_PUTS - -/* Define if you have the random function. */ -#undef HAVE_RANDOM - -/* Define if you have the read function. */ -#undef HAVE_READ - -/* Define if you have the realloc function. */ -#undef HAVE_REALLOC - -/* Define if you have the setmntent function. */ -#undef HAVE_SETMNTENT - -/* Define if you have the srandom function. */ -#undef HAVE_SRANDOM - -/* Define if you have the strdup function. */ -#undef HAVE_STRDUP - -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR - -/* Define if you have the time function. */ -#undef HAVE_TIME - -/* Define if you have the vfprintf function. */ -#undef HAVE_VFPRINTF - -/* Define if you have the vprintf function. */ -#undef HAVE_VPRINTF - -/* Define if you have the wcrtomb function. */ -#undef HAVE_WCRTOMB - -/* Define if you have the write function. */ -#undef HAVE_WRITE - -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_ASM_BYTEORDER_H -/* Define if you have the header file. */ +/* Define to 1 if you have the `atexit' function. */ +#undef HAVE_ATEXIT + +/* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H -/* Define if you have the header file. */ +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +#undef HAVE_DOPRNT + +/* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H -/* Define if you have the header file. */ +/* Define to 1 if you have the `fdatasync' function. */ +#undef HAVE_FDATASYNC + +/* Define to 1 if you have the `getmntent' function. */ +#undef HAVE_GETMNTENT + +/* Define to 1 if you have the header file. */ #undef HAVE_GETOPT_H -/* Define if you have the header file. */ +/* Define to 1 if you have the `hasmntopt' function. */ +#undef HAVE_HASMNTOPT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBINTL_H + +/* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_LINUX_FD_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_LINUX_MAJOR_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TYPES_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define to 1 if long double works and has more range or precision than + double. */ +#undef HAVE_LONG_DOUBLE + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ +#undef HAVE_MBRTOWC + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the header file. */ #undef HAVE_MNTENT_H -/* Define if you have the header file. */ +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#undef HAVE_REALLOC + +/* Define to 1 if you have the `regcomp' function. */ +#undef HAVE_REGCOMP + +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +#undef HAVE_STAT_EMPTY_STRING_BUG + +/* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H -/* Define if you have the header file. */ +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H -/* Define if you have the header file. */ +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the `strftime' function. */ +#undef HAVE_STRFTIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ #undef HAVE_STRING_H -/* Define if you have the header file. */ +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Define to 1 if `st_blocks' is member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BLOCKS + +/* Define to 1 if `st_rdev' is member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_RDEV + +/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ +#undef HAVE_ST_BLOCKS + +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_MOUNT_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_TIME_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Define if you have the header file. */ +/* Define to 1 if you have the `utime' function. */ +#undef HAVE_UTIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_UTIME_H + +/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */ +#undef HAVE_UTIME_NULL + +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF + +/* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#undef LSTAT_FOLLOWS_SLASHED_SYMLINK + /* Name of package */ #undef PACKAGE +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* 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 + /* Version number of package */ #undef VERSION +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +#undef inline + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to `long' if does not define. */ +#undef off_t + +/* Define to rpl_realloc if the replacement function should be used. */ +#undef realloc + +/* Define to `unsigned' if does not define. */ +#undef size_t diff --git a/config.sub b/config.sub index a06a480a..393f13d3 100755 --- a/config.sub +++ b/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -timestamp='2001-04-20' +timestamp='2001-09-07' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -117,7 +117,7 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*) + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -157,6 +157,14 @@ case $os in os=-vxworks basic_machine=$1 ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; -hiux*) os=-hiuxwe2 ;; @@ -215,26 +223,36 @@ esac case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ - | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ - | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 \ - | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ - | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ - | hppa64 \ - | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ - | alphaev6[78] \ - | we32k | ns16k | clipper | i370 | sh | sh[34] \ - | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp10 | pdp11 \ - | mips16 | mips64 | mipsel | mips64el \ - | mips64orion | mips64orionel | mipstx39 | mipstx39el \ - | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ - | mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \ - | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \ - | v850 | c4x \ - | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ - | pj | pjl | h8500) + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsisa32 \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | s390 | s390x \ + | sh | sh[34] | sh[34]eb | shbe | shle \ + | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ + | stormy16 | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 \ + | we32k \ + | x86 | xscale \ + | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) @@ -242,7 +260,7 @@ case $basic_machine in basic_machine=$basic_machine-unknown os=-none ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65) + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' @@ -257,31 +275,43 @@ case $basic_machine in exit 1 ;; # Recognize the basic CPU types with company name. - # FIXME: clean up the formatting here. - vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ - | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ - | xmp-* | ymp-* \ - | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ - | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ - | hppa2.0n-* | hppa64-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ - | alphaev6[78]-* \ - | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ - | clipper-* | orion-* \ - | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ - | mips16-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ - | mipstx39-* | mipstx39el-* | mcore-* \ - | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ - | [cjt]90-* \ - | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ - | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ - | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alphapca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cray2-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ + | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | s390-* | s390x-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ + | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ + | ymp-* \ + | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -727,6 +757,16 @@ case $basic_machine in ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; ps2) basic_machine=i386-ibm ;; @@ -881,6 +921,10 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; xmp) basic_machine=xmp-cray os=-unicos @@ -934,7 +978,7 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4) + sh3 | sh4 | sh3eb | sh4eb) basic_machine=sh-unknown ;; sparc | sparcv9 | sparcv9b) @@ -1018,11 +1062,13 @@ case $os in | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1346,6 +1392,9 @@ case $basic_machine in -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; + -vos*) + vendor=stratus + ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; diff --git a/doc/Makefile.in b/doc/Makefile.in index f403a2cf..0a4bc6c7 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,6 +1,8 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am +# Makefile.in generated by automake 1.6.3 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 +# 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,7 +12,7 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. - +@SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ @@ -31,13 +33,9 @@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include - -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ - top_builddir = .. ACLOCAL = @ACLOCAL@ @@ -45,48 +43,55 @@ 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_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ - NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ AS = @AS@ AUTODIRS = @AUTODIRS@ +AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ +DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ -EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ all_includes = @all_includes@ all_libraries = @all_libraries@ - +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ EXTRA_DIST = \ CodingStyle \ attribute_definitions \ @@ -98,110 +103,133 @@ EXTRA_DIST = \ system_files.txt \ system_security_descriptors.txt +subdir = doc mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -DIST_COMMON = Makefile.am Makefile.in +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in +all: all-am - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -all: all-redirect .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +mostlyclean-libtool: + -rm -f *.lo +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: tags: TAGS TAGS: +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = doc +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu doc/Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ + @list='$(DISTFILES)'; for file in $$list; do \ + 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 -install-exec-am: -install-exec: install-exec-am +all-am: Makefile -install-data-am: +installdirs: + +install: install-am +install-exec: install-exec-am 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: uninstall-am -all-am: Makefile -all-redirect: all-am + +installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - - + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -mostlyclean-am: mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-generic mostlyclean-am - + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." clean: clean-am -distclean-am: distclean-generic clean-am - -rm -f libtool +clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -maintainer-clean-am: 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." +distclean-am: clean-am distclean-generic distclean-libtool + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: tags distdir info-am info dvi-am dvi check check-am \ -installcheck-am installcheck 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 +maintainer-clean-am: distclean-am maintainer-clean-generic +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-info-am + +.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-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool uninstall uninstall-am uninstall-info-am # 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. diff --git a/include/Makefile.in b/include/Makefile.in index b3a02cbd..83491b31 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,6 +1,8 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am +# Makefile.in generated by automake 1.6.3 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 +# 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,9 +12,7 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# Need this to enable 64-bit (device) file access functions and parameters. - - +@SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ @@ -33,13 +33,9 @@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include - -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ - top_builddir = .. ACLOCAL = @ACLOCAL@ @@ -47,49 +43,59 @@ 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_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ - NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ AS = @AS@ AUTODIRS = @AUTODIRS@ +AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ +DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ -EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ all_includes = @all_includes@ all_libraries = @all_libraries@ -@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -g -DDEBUG -@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +# Need this to enable 64-bit (device) file access functions and parameters. +@DEBUG_TRUE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG +@DEBUG_FALSE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 linux_ntfsincludedir = $(includedir)/ntfs linux_ntfsinclude_HEADERS = \ @@ -98,6 +104,7 @@ linux_ntfsinclude_HEADERS = \ bootsect.h \ compat.h \ debug.h \ + device.h \ dir.h \ disk_io.h \ endians.h \ @@ -114,157 +121,190 @@ linux_ntfsinclude_HEADERS = \ unistr.h \ volume.h +subdir = include mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -HEADERS = $(linux_ntfsinclude_HEADERS) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +HEADERS = $(linux_ntfsinclude_HEADERS) -DIST_COMMON = Makefile.am Makefile.in +DIST_COMMON = $(linux_ntfsinclude_HEADERS) Makefile.am Makefile.in +all: all-am - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -all: all-redirect .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu include/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +mostlyclean-libtool: + -rm -f *.lo +clean-libtool: + -rm -rf .libs _libs +distclean-libtool: + -rm -f libtool +uninstall-info-am: +linux_ntfsincludeHEADERS_INSTALL = $(INSTALL_HEADER) install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(linux_ntfsincludedir) @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ - echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(linux_ntfsincludedir)/$$p"; \ - $(INSTALL_DATA) $$d$$p $(DESTDIR)$(linux_ntfsincludedir)/$$p; \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(linux_ntfsincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ + $(linux_ntfsincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(linux_ntfsincludedir)/$$f; \ done uninstall-linux_ntfsincludeHEADERS: @$(NORMAL_UNINSTALL) - list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(linux_ntfsincludedir)/$$p; \ + @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ + rm -f $(DESTDIR)$(linux_ntfsincludedir)/$$f; \ done +ETAGS = etags +ETAGSFLAGS = + tags: TAGS -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = include +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu include/Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ + @list='$(DISTFILES)'; for file in $$list; do \ + 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 -install-exec-am: -install-exec: install-exec-am +all-am: Makefile $(HEADERS) -install-data-am: install-linux_ntfsincludeHEADERS +installdirs: + $(mkinstalldirs) $(DESTDIR)$(linux_ntfsincludedir) + +install: install-am +install-exec: install-exec-am 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-linux_ntfsincludeHEADERS -uninstall: uninstall-am -all-am: Makefile $(HEADERS) -all-redirect: all-am + +installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(linux_ntfsincludedir) - - + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -mostlyclean-am: mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-tags clean-generic mostlyclean-am - + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." clean: clean-am -distclean-am: distclean-tags distclean-generic clean-am - -rm -f libtool +clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -maintainer-clean-am: 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." +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-linux_ntfsincludeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: uninstall-linux_ntfsincludeHEADERS \ -install-linux_ntfsincludeHEADERS tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ -check-am installcheck-am installcheck 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 +maintainer-clean-am: distclean-am maintainer-clean-generic +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +uninstall-am: uninstall-info-am uninstall-linux_ntfsincludeHEADERS + +.PHONY: GTAGS all all-am check check-am clean clean-generic \ + clean-libtool distclean distclean-generic distclean-libtool \ + distclean-tags 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-linux_ntfsincludeHEADERS install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool tags uninstall uninstall-am \ + uninstall-info-am uninstall-linux_ntfsincludeHEADERS # 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. diff --git a/install-sh b/install-sh index e9de2384..11870f1b 100755 --- a/install-sh +++ b/install-sh @@ -109,7 +109,7 @@ then echo "install: no input file specified" exit 1 else - true + : fi if [ x"$dir_arg" != x ]; then @@ -120,7 +120,7 @@ if [ x"$dir_arg" != x ]; then instcmd=: chmodcmd="" else - instcmd=mkdir + instcmd=$mkdirprog fi else @@ -128,9 +128,9 @@ else # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. - if [ -f $src -o -d $src ] + if [ -f "$src" ] || [ -d "$src" ] then - true + : else echo "install: $src does not exist" exit 1 @@ -141,7 +141,7 @@ else echo "install: no destination specified" exit 1 else - true + : fi # If destination is a directory, append the input filename; if your system @@ -151,7 +151,7 @@ else then dst="$dst"/`basename $src` else - true + : fi fi @@ -163,8 +163,8 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then -defaultIFS=' -' +defaultIFS=' + ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" @@ -183,7 +183,7 @@ while [ $# -ne 0 ] ; do then $mkdirprog "${pathcomp}" else - true + : fi pathcomp="${pathcomp}/" @@ -194,10 +194,10 @@ if [ x"$dir_arg" != x ] then $doit $instcmd $dst && - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. @@ -216,7 +216,7 @@ else then dstfile=`basename $dst` else - true + : fi # Make a temp file name in the proper directory. @@ -235,10 +235,10 @@ else # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. diff --git a/ltmain.sh b/ltmain.sh index 2393e14d..dd490ba9 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -48,15 +48,18 @@ EOF exit 0 fi +# define SED for historic ltconfig's generated by Libtool 1.3 +test -z "$SED" && SED=sed + # The name of this program. -progname=`$echo "$0" | sed 's%^.*/%%'` +progname=`$echo "$0" | ${SED} 's%^.*/%%'` modename="$progname" # Constants. PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.4 -TIMESTAMP=" (1.920 2001/04/24 23:26:18)" +VERSION=1.4.3 +TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)" default_mode= help="Try \`$progname --help' for more information." @@ -67,10 +70,19 @@ rm="rm -f" # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' -SP2NL='tr \040 \012' -NL2SP='tr \015\012 \040\040' +# test EBCDIC or ASCII +case `echo A|od -x` in + *[Cc]1*) # EBCDIC based system + SP2NL="tr '\100' '\n'" + NL2SP="tr '\r\n' '\100\100'" + ;; + *) # Assume ASCII based system + SP2NL="tr '\040' '\012'" + NL2SP="tr '\015\012' '\040\040'" + ;; +esac # NLS nuisances. # Only set LANG and LC_ALL to C if already set. @@ -84,6 +96,9 @@ if test "${LANG+set}" = set; then save_LANG="$LANG"; LANG=C; export LANG fi +# Make sure IFS has a sensible default +: ${IFS=" "} + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then echo "$modename: not configured to build any kind of library" 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 @@ -141,7 +156,7 @@ do ;; --config) - sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 exit 0 ;; @@ -174,6 +189,8 @@ do --mode) prevopt="--mode" prev=mode ;; --mode=*) mode="$optarg" ;; + --preserve-dup-deps) duplicate_deps="yes" ;; + --quiet | --silent) show=: ;; @@ -202,12 +219,17 @@ if test -n "$prevopt"; then exit 1 fi +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then case $nonopt in - *cc | *++ | gcc* | *-gcc*) + *cc | *++ | gcc* | *-gcc* | xlc*) mode=link for arg do @@ -329,7 +351,7 @@ if test -z "$show_help"; then -Wc,*) args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= - IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' + save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" @@ -615,6 +637,10 @@ compiler." # Now arrange that obj and lo_libobj become the same file $show "(cd $xdir && $LN_S $baseobj $libobj)" if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi exit 0 else error=$? @@ -745,6 +771,7 @@ compiler." linker_flags= dllsearchpath= lib_search_path=`pwd` + inst_prefix_dir= avoid_version=no dlfiles= @@ -875,6 +902,11 @@ compiler." prev= continue ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; release) release="-$arg" prev= @@ -976,11 +1008,16 @@ compiler." continue ;; + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in - no/*-*-irix*) + no/*-*-irix* | no/*-*-nonstopux*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; @@ -1031,6 +1068,17 @@ compiler." # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; + *-*-openbsd* | *-*-freebsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; esac fi deplibs="$deplibs $arg" @@ -1122,7 +1170,7 @@ compiler." -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` arg= - IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' + save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in @@ -1140,7 +1188,7 @@ compiler." -Wl,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` arg= - IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' + save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" case $flag in @@ -1307,9 +1355,11 @@ compiler." # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi libs="$libs $deplib" done deplibs= @@ -1343,7 +1393,7 @@ compiler." ;; esac for pass in $passes; do - if test "$linkmode" = prog; then + if test $linkmode = prog; then # Determine which files to process case $pass in dlopen) @@ -1360,11 +1410,11 @@ compiler." found=no case $deplib in -l*) - if test "$linkmode" = oldlib && test "$linkmode" = obj; then + if test $linkmode = oldlib && test $linkmode = obj; then $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 continue fi - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi @@ -1384,7 +1434,7 @@ compiler." finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi @@ -1393,16 +1443,16 @@ compiler." case $linkmode in lib) deplibs="$deplib $deplibs" - test "$pass" = conv && continue + test $pass = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi - if test "$pass" = scan; then + if test $pass = scan; then deplibs="$deplib $deplibs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else @@ -1417,7 +1467,7 @@ compiler." continue ;; # -L -R*) - if test "$pass" = link; then + if test $pass = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in @@ -1430,7 +1480,7 @@ compiler." ;; *.la) lib="$deplib" ;; *.$libext) - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi @@ -1438,10 +1488,12 @@ compiler." lib) if test "$deplibs_check_method" != pass_all; then echo - echo "*** Warning: This library needs some functionality provided by $deplib." + echo "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not used here." else echo echo "*** Warning: Linking the shared library $output against the" @@ -1451,7 +1503,7 @@ compiler." continue ;; prog) - if test "$pass" != link; then + if test $pass != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -1462,7 +1514,7 @@ compiler." esac # linkmode ;; # *.$libext *.lo | *.$objext) - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. newdlprefiles="$newdlprefiles $deplib" @@ -1485,7 +1537,7 @@ compiler." fi # Check to see that this really is a libtool archive. - if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 @@ -1512,13 +1564,13 @@ compiler." if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then + { test $linkmode = oldlib && test $linkmode = obj; }; then # Add dl[pre]opened files of deplib test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi - if test "$pass" = conv; then + if test $pass = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then @@ -1532,12 +1584,14 @@ compiler." tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi tmp_libs="$tmp_libs $deplib" done - elif test "$linkmode" != prog && test "$linkmode" != lib; then + elif test $linkmode != prog && test $linkmode != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit 1 fi @@ -1555,7 +1609,7 @@ compiler." fi # This library was specified with -dlopen. - if test "$pass" = dlopen; then + if test $pass = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit 1 @@ -1604,7 +1658,7 @@ compiler." name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then + if test $pass = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit 1 @@ -1623,7 +1677,7 @@ compiler." if test -z "$libdir"; then # Link the convenience library - if test "$linkmode" = lib; then + if test $linkmode = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" @@ -1634,7 +1688,7 @@ compiler." continue fi - if test "$linkmode" = prog && test "$pass" != link; then + if test $linkmode = prog && test $pass != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" @@ -1657,9 +1711,11 @@ compiler." # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi tmp_libs="$tmp_libs $deplib" done # for deplib continue @@ -1671,7 +1727,7 @@ compiler." # Link against this shared library if test "$linkmode,$pass" = "prog,link" || - { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then + { test $linkmode = lib && test $hardcode_into_libs = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. @@ -1693,7 +1749,7 @@ compiler." esac ;; esac - if test "$linkmode" = prog; then + if test $linkmode = prog; then # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. @@ -1743,14 +1799,14 @@ compiler." # Make a new name for the extract_expsyms_cmds to use soroot="$soname" - soname=`echo $soroot | sed -e 's/^.*\///'` - newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + soname=`echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' eval cmds=\"$extract_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" @@ -1763,7 +1819,7 @@ compiler." # Create $newlib if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' eval cmds=\"$old_archive_from_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" @@ -1777,7 +1833,7 @@ compiler." linklib=$newlib fi # test -n $old_archive_from_expsyms_cmds - if test "$linkmode" = prog || test "$mode" != relink; then + if test $linkmode = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= @@ -1826,7 +1882,7 @@ compiler." *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi - if test "$linkmode" = prog; then + if test $linkmode = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else @@ -1843,7 +1899,7 @@ compiler." fi fi - if test "$linkmode" = prog || test "$mode" = relink; then + if test $linkmode = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= @@ -1851,7 +1907,16 @@ compiler." if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + add_dir= + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="-L$inst_prefix_dir$libdir" + ;; + esac + fi + add_dir="$add_dir -L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in @@ -1861,11 +1926,20 @@ compiler." add="-l$name" else # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + add_dir= + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="-L$inst_prefix_dir$libdir" + ;; + esac + fi + add_dir="$add_dir -L$libdir" add="-l$name" fi - if test "$linkmode" = prog; then + if test $linkmode = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else @@ -1873,7 +1947,7 @@ compiler." test -n "$add" && deplibs="$add $deplibs" fi fi - elif test "$linkmode" = prog; then + elif test $linkmode = prog; then if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && @@ -1903,25 +1977,26 @@ compiler." # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo - echo "*** Warning: This library needs some functionality provided by $lib." + echo "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - echo "*** Therefore, libtool will create a static module, that should work " - echo "*** as long as the dlopening application is linked with the -dlopen flag." + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes + build_libtool_libs=module + build_old_libs=yes else - build_libtool_libs=no + build_libtool_libs=no fi fi else @@ -1932,9 +2007,9 @@ compiler." fi fi # link shared/static library? - if test "$linkmode" = lib; then + if test $linkmode = lib; then if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || test $build_old_libs = yes || + { test $hardcode_into_libs != yes || test $build_old_libs = yes || test $link_static = yes; }; then # Extract -R from dependency_libs temp_deplibs= @@ -1958,13 +2033,15 @@ compiler." tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi tmp_libs="$tmp_libs $deplib" done - if test "$link_all_deplibs" != no; then + if test $link_all_deplibs != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in @@ -1986,7 +2063,7 @@ compiler." if grep "^installed=no" $deplib > /dev/null; then path="-L$absdir/$objdir" else - eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit 1 @@ -2007,15 +2084,15 @@ compiler." fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs - if test "$pass" = dlpreopen; then + if test $pass = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi - if test "$pass" != dlopen; then - test "$pass" != scan && dependency_libs="$newdependency_libs" - if test "$pass" != conv; then + if test $pass != dlopen; then + test $pass != scan && dependency_libs="$newdependency_libs" + if test $pass != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do @@ -2073,7 +2150,7 @@ compiler." deplibs= fi done # for pass - if test "$linkmode" = prog; then + if test $linkmode = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi @@ -2175,7 +2252,7 @@ compiler." else # Parse the version information argument. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 IFS="$save_ifs" @@ -2191,7 +2268,7 @@ compiler." # Check that each of the things are valid numbers. case $current in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2200,7 +2277,7 @@ compiler." esac case $revision in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2209,7 +2286,7 @@ compiler." esac case $age in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2250,16 +2327,21 @@ compiler." versuffix=".$current"; ;; - irix) + irix | nonstopux) major=`expr $current - $age + 1` - verstring="sgi$major.$revision" + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test $loop != 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` - verstring="sgi$major.$iface:$verstring" + verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. @@ -2273,7 +2355,7 @@ compiler." ;; osf) - major=`expr $current - $age` + major=.`expr $current - $age` versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" @@ -2312,6 +2394,16 @@ compiler." if test -z "$vinfo" && test -n "$release"; then major= verstring="0.0" + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring="" + ;; + *) + verstring="0.0" + ;; + esac if test "$need_version" = no; then versuffix= else @@ -2355,9 +2447,9 @@ compiler." # Eliminate all temporary directories. for path in $notinst_path; do - lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` - deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` - dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` + lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then @@ -2408,9 +2500,12 @@ compiler." *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; + *-*-openbsd* | *-*-freebsd*) + # Do not include libc due to us having libc/libc_r. + ;; *) # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then + if test $build_libtool_need_lc = "yes"; then deplibs="$deplibs -lc" fi ;; @@ -2466,18 +2561,20 @@ EOF else droppeddeps=yes echo - echo "*** Warning: This library needs some functionality provided by $i." + echo "*** Warning: dynamic linker does not accept needed library $i." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." + echo "*** shared version of the library, which I believe you do not have" + echo "*** because a test_compile did reveal that the linker did not use it for" + echo "*** its dynamic dependency list that programs get resolved with at runtime." fi else newdeplibs="$newdeplibs $i" fi done else - # Error occured in the first compile. Let's try to salvage the situation: - # Compile a seperate program for each library. + # Error occured in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. for i in $deplibs; do name="`expr $i : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. @@ -2496,10 +2593,12 @@ EOF else droppeddeps=yes echo - echo "*** Warning: This library needs some functionality provided by $i." + echo "*** Warning: dynamic linker does not accept needed library $i." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." + echo "*** shared version of the library, which you do not appear to have" + echo "*** because a test_compile did reveal that the linker did not use this one" + echo "*** as a dynamic dependency that programs can get resolved with at runtime." fi else droppeddeps=yes @@ -2538,14 +2637,14 @@ EOF # but so what? potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | sed 's/.* -> //'` + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | sed 10q \ + | ${SED} 10q \ | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" @@ -2556,10 +2655,17 @@ EOF if test -n "$a_deplib" ; then droppeddeps=yes echo - echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + echo "*** with $libname but no candidates were found. (...for file magic test)" + else + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a file magic. Last file checked: $potlib" + fi fi else # Add a -L argument. @@ -2578,8 +2684,9 @@ EOF for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check below in file_magic test if eval echo \"$potent_lib\" 2>/dev/null \ - | sed 10q \ + | ${SED} 10q \ | egrep "$match_pattern_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" @@ -2590,10 +2697,17 @@ EOF if test -n "$a_deplib" ; then droppeddeps=yes echo - echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a regex pattern. Last file checked: $potlib" + fi fi else # Add a -L argument. @@ -2683,7 +2797,7 @@ EOF # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then + if test $hardcode_into_libs = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= @@ -2784,7 +2898,7 @@ EOF export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols eval cmds=\"$export_symbols_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -2858,9 +2972,20 @@ EOF if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval cmds=\"$archive_expsym_cmds\" else + save_deplibs="$deplibs" + for conv in $convenience; do + tmp_deplibs= + for test_deplib in $deplibs; do + if test "$test_deplib" != "$conv"; then + tmp_deplibs="$tmp_deplibs $test_deplib" + fi + done + deplibs="$tmp_deplibs" + done eval cmds=\"$archive_cmds\" + deplibs="$save_deplibs" fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -2988,7 +3113,7 @@ EOF output="$obj" eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -3024,7 +3149,7 @@ EOF reload_objs="$libobjs $reload_conv_objs" output="$libobj" eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -3057,7 +3182,7 @@ EOF prog) case $host in - *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; + *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 @@ -3079,6 +3204,13 @@ EOF # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + ;; + esac ;; esac @@ -3245,9 +3377,9 @@ extern \"C\" { if test -z "$export_symbols"; then export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols - $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else - $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi @@ -3255,7 +3387,7 @@ extern \"C\" { for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" - name=`echo "$arg" | sed -e 's%^.*/%%'` + name=`echo "$arg" | ${SED} -e 's%^.*/%%'` $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done @@ -3270,7 +3402,13 @@ extern \"C\" { fi # Try sorting and uniquifying the output. - if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + if grep -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S @@ -3287,27 +3425,25 @@ extern \"C\" { #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * +# define lt_ptr void * #else -# define lt_ptr_t char * +# define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; - lt_ptr_t address; + lt_ptr address; } lt_preloaded_symbols[] = {\ " - sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ - -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ - < "$nlist" >> "$output_objdir/$dlsyms" + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr_t) 0} + {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ @@ -3494,7 +3630,7 @@ static const void *lt_preloaded_setup() { relink_command="$var=\"$var_value\"; export $var; $relink_command" fi done - relink_command="cd `pwd`; $relink_command" + relink_command="(cd `pwd`; $relink_command)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` fi @@ -3514,7 +3650,7 @@ static const void *lt_preloaded_setup() { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in - *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in @@ -3538,7 +3674,7 @@ static const void *lt_preloaded_setup() { # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout @@ -3576,7 +3712,7 @@ else test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` @@ -3589,7 +3725,7 @@ else fi file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` done # Try to get the absolute directory name. @@ -3603,7 +3739,7 @@ else progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" @@ -3618,8 +3754,9 @@ else # relink executable if necessary if test -n \"\$relink_command\"; then - if (eval \$relink_command); then : + if relink_command_output=\`eval \$relink_command 2>&1\`; then : else + $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi @@ -3648,7 +3785,7 @@ else $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed + # The second colon is a workaround for a bug in BeOS R4 ${SED} $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var @@ -3790,7 +3927,7 @@ fi\ eval cmds=\"$old_archive_cmds\" fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -3823,7 +3960,7 @@ fi\ fi done # Quote the link command for shipping. - relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args" + relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` # Only create the output if not a dry run. @@ -3840,7 +3977,7 @@ fi\ case $deplib in *.la) name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` - eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 exit 1 @@ -3854,7 +3991,7 @@ fi\ newdlfiles= for lib in $dlfiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 @@ -3865,7 +4002,7 @@ fi\ newdlprefiles= for lib in $dlprefiles; do name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 @@ -4089,7 +4226,7 @@ relink_command=\"$relink_command\"" *.la) # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 @@ -4124,12 +4261,30 @@ relink_command=\"$relink_command\"" dir="$dir$objdir" if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit 1 + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` + fi + $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - continue + exit 1 fi fi @@ -4165,7 +4320,7 @@ relink_command=\"$relink_command\"" # Do each command in the postinstall commands. lib="$destdir/$realname" eval cmds=\"$postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -4238,19 +4393,27 @@ relink_command=\"$relink_command\"" fi # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + case $host in + *cygwin*|*mingw*) + wrapper=`echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= # If there is no directory component, then add one. case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then - $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 exit 1 fi @@ -4275,8 +4438,8 @@ relink_command=\"$relink_command\"" relink_command= # If there is no directory component, then add one. case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; esac outputname= @@ -4284,7 +4447,13 @@ relink_command=\"$relink_command\"" if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" + tmpdir_mktemp=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` + if test $? = 0 ; then + tmpdir="$tmpdir_mktemp" + unset tmpdir_mktemp + else + tmpdir="$tmpdir/libtool-$$" + fi if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : else $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 @@ -4324,7 +4493,7 @@ relink_command=\"$relink_command\"" destfile=$destfile.exe ;; *:*.exe) - destfile=`echo $destfile | sed -e 's,.exe$,,'` + destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; @@ -4352,7 +4521,7 @@ relink_command=\"$relink_command\"" # Do each command in the postinstall commands. eval cmds=\"$old_postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -4368,11 +4537,10 @@ relink_command=\"$relink_command\"" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec $SHELL $0 --finish$current_libdirs - exit 1 + exec_cmd='$SHELL $0 --finish$current_libdirs' + else + exit 0 fi - - exit 0 ;; # libtool finish mode @@ -4391,7 +4559,7 @@ relink_command=\"$relink_command\"" if test -n "$finish_cmds"; then # Do each command in the finish commands. eval cmds=\"$finish_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -4473,7 +4641,7 @@ relink_command=\"$relink_command\"" case $file in *.la) # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 @@ -4544,7 +4712,7 @@ relink_command=\"$relink_command\"" -*) ;; *) # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; @@ -4575,11 +4743,8 @@ relink_command=\"$relink_command\"" LANG="$save_LANG"; export LANG fi - # Now actually exec the command. - eval "exec \$cmd$args" - - $echo "$modename: cannot exec \$cmd$args" - exit 1 + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then @@ -4641,14 +4806,14 @@ relink_command=\"$relink_command\"" # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ - || (test -h "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then - : + : elif test -d "$file"; then - exit_status=1 + exit_status=1 continue elif test "$rmforce" = yes; then - continue + continue fi rmfiles="$file" @@ -4656,7 +4821,7 @@ relink_command=\"$relink_command\"" case $name in *.la) # Possibly a libtool archive, so verify it. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. @@ -4670,7 +4835,7 @@ relink_command=\"$relink_command\"" if test -n "$library_names"; then # Do each command in the postuninstall commands. eval cmds=\"$postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -4685,7 +4850,7 @@ relink_command=\"$relink_command\"" if test -n "$old_library"; then # Do each command in the old_postuninstall commands. eval cmds=\"$old_postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -4711,7 +4876,7 @@ relink_command=\"$relink_command\"" *) # Do a test to see if this is a libtool program. if test $mode = clean && - (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then relink_command= . $dir/$file @@ -4744,11 +4909,18 @@ relink_command=\"$relink_command\"" ;; esac - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + fi fi # test -z "$show_help" +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 +fi + # We need to display help for each of the modes. case $mode in "") $echo \ diff --git a/missing b/missing index 7789652e..6a37006e 100755 --- a/missing +++ b/missing @@ -1,7 +1,7 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997 Free Software Foundation, Inc. -# Franc,ois Pinard , 1996. +# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. # 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 @@ -18,11 +18,37 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. case "$1" in -h|--h|--he|--hel|--help) @@ -35,6 +61,7 @@ error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' @@ -43,13 +70,15 @@ Supported PROGRAM values: automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing - GNU libit 0.0" + echo "missing 0.4 - GNU automake" ;; -*) @@ -58,31 +87,46 @@ Supported PROGRAM values: exit 1 ;; - aclocal) + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acinclude.m4' or \`configure.in'. You might want + you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if - you modified \`configure.in'. You might want to install the + you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acconfig.h' or \`configure.in'. You might want + you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do @@ -95,10 +139,15 @@ WARNING: \`$1' is missing on your system. You should only need it if touch $touch_files ;; - automake) + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | @@ -106,6 +155,34 @@ WARNING: \`$1' is missing on your system. You should only need it if while read f; do touch "$f"; done ;; + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1Help2man' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if @@ -159,7 +236,37 @@ WARNING: \`$1' is missing on your system. You should only need it if fi ;; + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file @@ -175,6 +282,45 @@ WARNING: \`$1' is missing on your system. You should only need it if touch $file ;; + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your diff --git a/mkinstalldirs b/mkinstalldirs index 6b3b5fc5..8ab885ec 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -4,9 +4,53 @@ # Created: 1993-05-16 # Public domain -# $Id$ - errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case "${1}" in + -h | --help | --h* ) # -h for help + echo "${usage}" 1>&2; exit 0 ;; + -m ) # -m PERM arg + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + dirmode="${1}" + shift ;; + -- ) shift; break ;; # stop option processing + -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option + * ) break ;; # first non-opt arg + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in +0) exit 0 ;; +esac + +case $dirmode in +'') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi ;; +*) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi ;; +esac for file do @@ -22,13 +66,24 @@ do esac if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" + echo "mkdir $pathcomp" - mkdir "$pathcomp" || lasterr=$? + mkdir "$pathcomp" || lasterr=$? - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi fi pathcomp="$pathcomp/" @@ -37,4 +92,8 @@ done exit $errstatus +# Local Variables: +# mode: shell-script +# sh-indentation: 3 +# End: # mkinstalldirs ends here From 15ed6302890b216c206f7b3a0457fb72b850be27 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 12:58:41 +0000 Subject: [PATCH 0549/2994] Update. 2003/05/25 20:40:26+01:00 cantab.net!aia21 Add -fms-extensions when compiling with gcc-3.2+. (Logical change 1.136) --- libntfs/Makefile.in | 426 +++++++++++++++++++++++--------------------- 1 file changed, 223 insertions(+), 203 deletions(-) diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 9fee3776..f6e43a08 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,6 +1,8 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am +# Makefile.in generated by automake 1.6.3 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 +# 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,6 +12,8 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +@SET_MAKE@ + # # Before making a release, the LTVERSION string should be modified. # The string is of the form CURRENT:REVISION:AGE. @@ -36,8 +40,6 @@ # # - If the interface is the same as the previous version, change to C:R+1:A # - - SHELL = @SHELL@ srcdir = @srcdir@ @@ -58,13 +60,9 @@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include - -DESTDIR = - pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ - top_builddir = .. ACLOCAL = @ACLOCAL@ @@ -72,51 +70,65 @@ 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_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ - NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_alias = @build_alias@ -build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ -target_alias = @target_alias@ -target_triplet = @target@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ AS = @AS@ AUTODIRS = @AUTODIRS@ +AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ +DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ -EXEEXT = @EXEEXT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ all_includes = @all_includes@ all_libraries = @all_libraries@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ LTVERSION = 4:0:0 -@DEBUG_TRUE@AM_CFLAGS = @DEBUG_TRUE@-D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG -@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64 -Wall + +# Later gcc require -fms-extensions to work. +@GCC_NEEDS_MS_EXTENSIONS_TRUE@GCCflag = -fms-extensions +@GCC_NEEDS_MS_EXTENSIONS_FALSE@GCCflag = + +# Need this to enable 64-bit (device) file access functions and parameters. +@DEBUG_TRUE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG $(GCCflag) +@DEBUG_FALSE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall $(GCCflag) linux_ntfsincludedir = -I$(top_srcdir)/include lib_LTLIBRARIES = libntfs.la @@ -127,6 +139,7 @@ libntfs_la_SOURCES = \ bootsect.c \ compat.c \ debug.c \ + device.c \ dir.c \ disk_io.c \ inode.c \ @@ -139,99 +152,125 @@ libntfs_la_SOURCES = \ INCLUDES = $(linux_ntfsincludedir) $(all_includes) +subdir = libntfs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(lib_LTLIBRARIES) +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) +libntfs_la_LIBADD = +am_libntfs_la_OBJECTS = attrib.lo bitmap.lo bootsect.lo compat.lo \ + debug.lo device.lo dir.lo disk_io.lo inode.lo lcnalloc.lo \ + mft.lo mst.lo runlist.lo unistr.lo volume.lo +libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) -DEFS = @DEFS@ -I. -I$(srcdir) -I.. +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) LIBS = @LIBS@ -libntfs_la_LIBADD = -libntfs_la_OBJECTS = attrib.lo bitmap.lo bootsect.lo compat.lo debug.lo \ -dir.lo disk_io.lo inode.lo lcnalloc.lo mft.lo mst.lo runlist.lo \ -unistr.lo volume.lo -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrib.Plo ./$(DEPDIR)/bitmap.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/bootsect.Plo ./$(DEPDIR)/compat.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/debug.Plo ./$(DEPDIR)/device.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/dir.Plo ./$(DEPDIR)/disk_io.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/inode.Plo ./$(DEPDIR)/lcnalloc.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/mft.Plo ./$(DEPDIR)/mst.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/runlist.Plo ./$(DEPDIR)/unistr.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/volume.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ + $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -DEP_FILES = .deps/attrib.P .deps/bitmap.P .deps/bootsect.P \ -.deps/compat.P .deps/debug.P .deps/dir.P .deps/disk_io.P .deps/inode.P \ -.deps/lcnalloc.P .deps/mft.P .deps/mst.P .deps/runlist.P .deps/unistr.P \ -.deps/volume.P +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(libntfs_la_SOURCES) +DIST_COMMON = Makefile.am Makefile.in SOURCES = $(libntfs_la_SOURCES) -OBJECTS = $(libntfs_la_OBJECTS) -all: all-redirect +all: all-am + .SUFFIXES: -.SUFFIXES: .S .c .lo .o .obj .s -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu libntfs/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-libLTLIBRARIES: - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - -distclean-libLTLIBRARIES: - -maintainer-clean-libLTLIBRARIES: - +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu libntfs/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +libLTLIBRARIES_INSTALL = $(INSTALL) install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(libdir) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ else :; fi; \ done uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) - list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ done -# FIXME: We should only use cygpath when building on Windows, -# and only if it is available. -.c.obj: - $(COMPILE) -c `cygpath -w $<` - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test -z "$dir" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libntfs.la: $(libntfs_la_OBJECTS) $(libntfs_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libntfs_la_LDFLAGS) $(libntfs_la_OBJECTS) $(libntfs_la_LIBADD) $(LIBS) mostlyclean-compile: - -rm -f *.o core *.core - -rm -f *.$(OBJEXT) - -clean-compile: + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c -maintainer-clean-compile: +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attrib.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bootsect.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disk_io.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inode.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lcnalloc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mft.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mst.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unistr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volume.Plo@am__quote@ -.s.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< +distclean-depend: + -rm -rf ./$(DEPDIR) -.S.lo: - $(LIBTOOL) --mode=compile $(COMPILE) -c $< +.c.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` + +.c.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +CCDEPMODE = @CCDEPMODE@ mostlyclean-libtool: -rm -f *.lo @@ -240,170 +279,151 @@ clean-libtool: -rm -rf .libs _libs distclean-libtool: + -rm -f libtool +uninstall-info-am: -maintainer-clean-libtool: - -libntfs.la: $(libntfs_la_OBJECTS) $(libntfs_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libntfs_la_LDFLAGS) $(libntfs_la_OBJECTS) $(libntfs_la_LIBADD) $(LIBS) +ETAGS = etags +ETAGSFLAGS = tags: TAGS -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) + mkid -fID $$unique -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique -mostlyclean-tags: - -clean-tags: +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = libntfs +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu libntfs/Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ + @list='$(DISTFILES)'; for file in $$list; do \ + 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 - -DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) - --include $(DEP_FILES) - -mostlyclean-depend: - -clean-depend: - -distclean-depend: - -rm -rf .deps - -maintainer-clean-depend: - -%.o: %.c - @echo '$(COMPILE) -c $<'; \ - $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp - -%.lo: %.c - @echo '$(LTCOMPILE) -c $<'; \ - $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ - < .deps/$(*F).pp > .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm -f .deps/$(*F).pp -info-am: -info: info-am -dvi-am: -dvi: dvi-am check-am: all-am check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-libLTLIBRARIES -install-exec: install-exec-am +all-am: Makefile $(LTLIBRARIES) -install-data-am: +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) + +install: install-am +install-exec: install-exec-am 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-libLTLIBRARIES -uninstall: uninstall-am -all-am: Makefile $(LTLIBRARIES) -all-redirect: all-am + +installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(libdir) - - + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: -mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \ - mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ - mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \ - clean-depend clean-generic mostlyclean-am - + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." clean: clean-am -distclean-am: distclean-libLTLIBRARIES distclean-compile \ - distclean-libtool distclean-tags distclean-depend \ - distclean-generic clean-am - -rm -f libtool +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am distclean: distclean-am -maintainer-clean-am: maintainer-clean-libLTLIBRARIES \ - maintainer-clean-compile maintainer-clean-libtool \ - maintainer-clean-tags maintainer-clean-depend \ - maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: maintainer-clean: maintainer-clean-am -.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \ -clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \ -uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \ -distclean-compile clean-compile maintainer-clean-compile \ -mostlyclean-libtool distclean-libtool clean-libtool \ -maintainer-clean-libtool tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir mostlyclean-depend \ -distclean-depend clean-depend maintainer-clean-depend info-am info \ -dvi-am dvi check check-am installcheck-am installcheck 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 +maintainer-clean-am: distclean-am maintainer-clean-generic +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES + +.PHONY: GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool distclean distclean-compile \ + distclean-depend distclean-generic distclean-libtool \ + distclean-tags 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-libLTLIBRARIES install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool tags uninstall \ + uninstall-am uninstall-info-am uninstall-libLTLIBRARIES # 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. From 6d9dd71bbcb0d64c1368e0ec91bb2a778e73d7f0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 13:00:36 +0000 Subject: [PATCH 0550/2994] Update. (Logical change 1.137) --- Makefile.in | 8 ++++---- configure | 21 ++++++++++----------- ntfsprogs/Makefile.in | 20 +++++++++++++++----- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/Makefile.in b/Makefile.in index 9bec01b4..f41970a5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -117,9 +117,9 @@ RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ - Makefile.in NEWS aclocal.m4 config.guess config.h.in config.sub \ - configure configure.ac depcomp install-sh ltconfig ltmain.sh \ - missing mkinstalldirs ntfsprogs.spec.in + Makefile.in NEWS acconfig.h aclocal.m4 config.guess config.h.in \ + config.sub configure configure.ac depcomp install-sh ltconfig \ + ltmain.sh missing mkinstalldirs ntfsprogs.spec.in DIST_SUBDIRS = $(SUBDIRS) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -152,7 +152,7 @@ stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.ac $(ACLOCAL_M4) $(top_srcdir)/acconfig.h cd $(top_srcdir) && $(AUTOHEADER) touch $(srcdir)/config.h.in diff --git a/configure b/configure index 7d83cbee..75859839 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.7.2-WIP. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8-devel. # # Report bugs to . # @@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.7.2-WIP' -PACKAGE_STRING='ntfsprogs 1.7.2-WIP' +PACKAGE_VERSION='1.8-devel' +PACKAGE_STRING='ntfsprogs 1.8-devel' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -947,7 +947,7 @@ 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 ntfsprogs 1.7.2-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8-devel to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1014,7 +1014,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.7.2-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8-devel:";; esac cat <<\_ACEOF @@ -1115,7 +1115,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.7.2-WIP +ntfsprogs configure 1.8-devel generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1130,7 +1130,7 @@ 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 ntfsprogs $as_me 1.7.2-WIP, which was +It was created by ntfsprogs $as_me 1.8-devel, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1809,9 +1809,8 @@ fi # Define the identity of the package. PACKAGE=ntfsprogs - VERSION=1.7.2-WIP + VERSION=1.8-devel -VERSION=1.8.0-devel cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" @@ -11425,7 +11424,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.7.2-WIP, which was +This file was extended by ntfsprogs $as_me 1.8-devel, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11488,7 +11487,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.7.2-WIP +ntfsprogs config.status 1.8-devel configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 05ccdb04..f4593b4d 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -151,8 +151,8 @@ ntfsresize_SOURCES = ntfsresize.c utils.c utils.h ntfsresize_LDADD = $(AM_LIBS) ntfsresize_LDFLAGS = $(AM_LFLAGS) -# We don't distribute these +# We don't distribute these ntfsclone_SOURCES = ntfsclone.c utils.c utils.h ntfsclone_LDADD = $(AM_LIBS) ntfsclone_LDFLAGS = $(AM_LFLAGS) @@ -182,7 +182,8 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 \ ntfsprogs.8 ntfsresize.8 ntfsundelete.8 EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) dumplog$(EXEEXT) \ - ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) ntfscluster$(EXEEXT) + ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) ntfscluster$(EXEEXT) \ + ntfsclone$(EXEEXT) bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) ntfsundelete$(EXEEXT) \ ntfsresize$(EXEEXT) @@ -201,6 +202,12 @@ mkntfs_OBJECTS = $(am_mkntfs_OBJECTS) @REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ @REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfsclone_OBJECTS = ntfsclone.$(OBJEXT) utils.$(OBJEXT) +ntfsclone_OBJECTS = $(am_ntfsclone_OBJECTS) +@REALLYSTATIC_TRUE@ntfsclone_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfsclone_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la am_ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) utils.$(OBJEXT) ntfscluster_OBJECTS = $(am_ntfscluster_OBJECTS) @REALLYSTATIC_TRUE@ntfscluster_DEPENDENCIES = \ @@ -264,8 +271,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrdef.Po ./$(DEPDIR)/boot.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/dumplog.Po ./$(DEPDIR)/mkntfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfscluster.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsclone.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsclone.Po ./$(DEPDIR)/ntfscluster.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsdump_logfile.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsfix.Po ./$(DEPDIR)/ntfsinfo.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfslabel.Po ./$(DEPDIR)/ntfsresize.Po \ @@ -278,7 +284,7 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -DIST_SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) \ +DIST_SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfsclone_SOURCES) \ $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) \ $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) \ $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) \ @@ -378,6 +384,9 @@ dumplog$(EXEEXT): $(dumplog_OBJECTS) $(dumplog_DEPENDENCIES) mkntfs$(EXEEXT): $(mkntfs_OBJECTS) $(mkntfs_DEPENDENCIES) @rm -f mkntfs$(EXEEXT) $(LINK) $(mkntfs_LDFLAGS) $(mkntfs_OBJECTS) $(mkntfs_LDADD) $(LIBS) +ntfsclone$(EXEEXT): $(ntfsclone_OBJECTS) $(ntfsclone_DEPENDENCIES) + @rm -f ntfsclone$(EXEEXT) + $(LINK) $(ntfsclone_LDFLAGS) $(ntfsclone_OBJECTS) $(ntfsclone_LDADD) $(LIBS) ntfscluster$(EXEEXT): $(ntfscluster_OBJECTS) $(ntfscluster_DEPENDENCIES) @rm -f ntfscluster$(EXEEXT) $(LINK) $(ntfscluster_LDFLAGS) $(ntfscluster_OBJECTS) $(ntfscluster_LDADD) $(LIBS) @@ -416,6 +425,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boot.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumplog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkntfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsclone.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscluster.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsdump_logfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsfix.Po@am__quote@ From 9fe6a7f51c2ecddbbb2ae63f133b9953a6e3f0f7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 May 2003 13:00:36 +0000 Subject: [PATCH 0551/2994] Update. BKrev: 3ed20ff4QLRkiSyPymITaFbNuNUF6Q From d1e19dcd821c917b2f6e69d9fa5e4ab7b5a2a709 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 2 Jun 2003 08:53:04 +0000 Subject: [PATCH 0552/2994] Auto merged 2003/06/02 09:52:24+01:00 cantab.net!aia21 Update build. (Logical change 1.138) --- Makefile.in | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile.in b/Makefile.in index f41970a5..40a5104e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -93,15 +93,11 @@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ -# Need this to enable 64-bit (device) file access functions and parameters. -@DEBUG_TRUE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall -@DEBUG_FALSE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 - SUBDIRS = doc include libntfs ntfsprogs EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ INSTALL NEWS README autogen.sh ntfsprogs.spec.in \ - TODO.ntfsprogs + TODO.ntfsprogs getgccver AUTOMAKE_OPTIONS = gnu From f0628dd514da0cdf8b54bfe479dca78b6e7c5471 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 2 Jun 2003 08:53:04 +0000 Subject: [PATCH 0553/2994] Hopefully finished device io abstraction layer in the library. (Logical change 1.138) --- include/device.h | 8 +- include/disk_io.h | 16 ++-- include/volume.h | 11 +-- libntfs/attrib.c | 23 ++--- libntfs/bootsect.c | 8 +- libntfs/device.c | 97 +++++++++++++++++++++ libntfs/disk_io.c | 209 +++++++++++++++++++++++++++++++++++---------- libntfs/runlist.c | 9 +- libntfs/volume.c | 112 ++++++++++++++++-------- 9 files changed, 369 insertions(+), 124 deletions(-) diff --git a/include/device.h b/include/device.h index fb483fb8..49ba0ce9 100644 --- a/include/device.h +++ b/include/device.h @@ -70,18 +70,20 @@ struct ntfs_device { * the low level device described by a ntfs device structure. */ struct ntfs_device_operations { - struct ntfs_device *(*open)(const char *pathname, int flags); + int (*open)(struct ntfs_device *dev, int flags); int (*close)(struct ntfs_device *dev); - int (*sync)(struct ntfs_device *dev); s64 (*seek)(struct ntfs_device *dev, s64 offset, int whence); s64 (*read)(struct ntfs_device *dev, void *buf, s64 count); s64 (*write)(struct ntfs_device *dev, const void *buf, s64 count); s64 (*pread)(struct ntfs_device *dev, void *buf, s64 count, s64 offset); s64 (*pwrite)(struct ntfs_device *dev, const void *buf, s64 count, s64 offset); + int (*sync)(struct ntfs_device *dev); + int (*ioctl)(struct ntfs_device *dev, int request, void *argp); }; -struct ntfs_device *ntfs_device_alloc(void); +struct ntfs_device *ntfs_device_alloc(const char *name, const long state, + struct ntfs_device_operations *dops, void *private); int ntfs_device_free(struct ntfs_device *dev); #endif /* defined _NTFS_DEVICE_H */ diff --git a/include/disk_io.h b/include/disk_io.h index 749e7c9b..287073ea 100644 --- a/include/disk_io.h +++ b/include/disk_io.h @@ -24,20 +24,22 @@ #include "volume.h" -extern s64 ntfs_pread(const int fd, const s64 pos, s64 count, const void *b); -extern s64 ntfs_pwrite(const int fd, const s64 pos, s64 count, const void *b); +extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, + void *b); +extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, + const void *b); -extern s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, - const u32 bksize, const void *b); -extern s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, +extern s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count, + const u32 bksize, void *b); +extern s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, const u32 bksize, const void *b); extern s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, - const s64 count, const void *b); + const s64 count, void *b); extern s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, const s64 count, const void *b); -extern s64 ntfs_device_size_get(int f, int block_size); +extern s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size); #endif /* defined _NTFS_DISK_IO_H */ diff --git a/include/volume.h b/include/volume.h index bf40633f..157bba35 100644 --- a/include/volume.h +++ b/include/volume.h @@ -1,7 +1,7 @@ /* * volume.h - Exports for NTFS volume handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -87,8 +87,6 @@ typedef enum { * ntfs_volume - structure describing an open volume in memory */ struct _ntfs_volume { - int fd; //FIXME: Remove this. -> Use *dev instead. - char *dev_name; //FIXME: Remove this. -> Use *dev instead. struct ntfs_device *dev;/* NTFS device associated with the volume. */ char *vol_name; /* Name of the volume. */ unsigned long state; /* NTFS specific flags describing this volume. @@ -156,9 +154,12 @@ struct _ntfs_volume { bytes. */ }; -extern ntfs_volume *ntfs_volume_startup(const char *name, unsigned long rwflag); -extern ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag); +extern ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, + unsigned long rwflag); +extern ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, + unsigned long rwflag); +extern ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag); extern int ntfs_umount(ntfs_volume *vol, const BOOL force); extern int ntfs_version_is_supported(ntfs_volume *vol); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 35c48ce0..86ef01b8 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -151,7 +151,7 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, * or can we have sparse runs in uncompressed * files as well? */ - r = ntfs_pread(vol->fd, rl[i].lcn << + r = ntfs_pread(vol->dev, rl[i].lcn << vol->cluster_size_bits, rl[i].length << vol->cluster_size_bits, intbuf); @@ -189,7 +189,7 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, * to 0 for the length of the run, which should * be 16 (= compression unit size). */ - r = ntfs_pread(vol->fd, rl[i].lcn << + r = ntfs_pread(vol->dev, rl[i].lcn << vol->cluster_size_bits, rl[i].length << vol->cluster_size_bits, @@ -580,7 +580,6 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) s64 br, to_read, ofs, total, total2; ntfs_volume *vol; runlist_element *rl; - int f; Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x, pos 0x%Lx, " "count 0x%Lx.\n", __FUNCTION__, @@ -591,11 +590,6 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) return -1; } vol = na->ni->vol; - f = vol->fd; - if (!f) { - errno = EBADF; - return -1; - } /* * Encrypted attributes are not supported. We return access denied, * which is what Windows NT4 does, too. @@ -700,8 +694,8 @@ retry: Dprintf("%s(): Reading 0x%Lx bytes from vcn 0x%Lx, lcn 0x%Lx, " "ofs 0x%Lx.\n", __FUNCTION__, to_read, rl->vcn, rl->lcn, ofs); - br = ntfs_pread(f, (rl->lcn << vol->cluster_size_bits) + ofs, - to_read, b); + br = ntfs_pread(vol->dev, (rl->lcn << vol->cluster_size_bits) + + ofs, to_read, b); /* If everything ok, update progress counters and continue. */ if (br > 0) { total += br; @@ -755,7 +749,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) ntfs_volume *vol; ntfs_attr_search_ctx *ctx = NULL; runlist_element *rl; - int f, eo; + int eo; struct { unsigned int initialized_size : 1; } need_to_undo = { 0 }; @@ -768,11 +762,6 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) return -1; } vol = na->ni->vol; - f = vol->fd; - if (!f) { - errno = EBADF; - return -1; - } /* * Encrypted attributes are not supported. We return access denied, * which is what Windows NT4 does, too. @@ -963,7 +952,7 @@ retry: "ofs 0x%Lx.\n", __FUNCTION__, to_write, rl->vcn, rl->lcn, ofs); if (!NVolReadOnly(vol)) - written = ntfs_pwrite(f, (rl->lcn << + written = ntfs_pwrite(vol->dev, (rl->lcn << vol->cluster_size_bits) + ofs, to_write, b); else diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index 6cff9826..25cc77c1 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -200,7 +200,7 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) if (sectors_per_cluster & (sectors_per_cluster - 1)) { Dprintf("Error: %s is not a valid NTFS partition! " "sectors_per_cluster is not a power of 2.\n", - vol->dev_name); + vol->dev->d_name); return -1; } vol->nr_clusters = sle64_to_cpu(bs->number_of_sectors) >> @@ -214,14 +214,14 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) vol->mftmirr_lcn > vol->nr_clusters) { Dprintf("Error: %s is not a valid NTFS partition! ($Mft LCN " "or\n$MftMirr LCN is greater than the number " - "of clusters!\n", vol->dev_name); + "of clusters!\n", vol->dev->d_name); return -1; } vol->cluster_size = sectors_per_cluster * vol->sector_size; if (vol->cluster_size & (vol->cluster_size - 1)) { Dprintf("Error: %s is not a valid NTFS partition! " "cluster_size is not a power of 2.\n", - vol->dev_name); + vol->dev->d_name); return -1; } vol->cluster_size_bits = ffs(vol->cluster_size) - 1; @@ -247,7 +247,7 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) if (vol->mft_record_size & (vol->mft_record_size - 1)) { Dprintf("Error: %s is not a valid NTFS partition! " "mft_record_size is not a power of 2.\n", - vol->dev_name); + vol->dev->d_name); return -1; } vol->mft_record_size_bits = ffs(vol->mft_record_size) - 1; diff --git a/libntfs/device.c b/libntfs/device.c index e69de29b..1fb956fc 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -0,0 +1,97 @@ +/* + * device.c - Low level device io functions. Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include + +#include "device.h" + +/** + * ntfs_device_alloc - allocate an ntfs device structure and pre-initialize it + * name: name of the device (must be present) + * state: initial device state (usually zero) + * dops: ntfs device operations to use with the device (must be present) + * private: pointer to private data (optional) + * + * Allocate an ntfs device structure and pre-initialize it with the user- + * specified device operations @dops, device state @state, device name @name, + * and optional private data @private. + * + * Note, @name is copied and can hence be freed after this functions returns. + * + * On success return a pointer to the allocated ntfs device structure and on + * error return NULL with errno set to the error code returned by malloc(). + */ +struct ntfs_device *ntfs_device_alloc(const char *name, const long state, + struct ntfs_device_operations *dops, void *private) +{ + struct ntfs_device *dev; + + if (!name) { + errno = EINVAL; + return NULL; + } + + dev = (struct ntfs_device *)malloc(sizeof(struct ntfs_device)); + if (dev) { + if (!(dev->d_name = strdup(name))) { + int eo = errno; + free(dev); + errno = eo; + return NULL; + } + dev->d_ops = dops; + dev->d_state = state; + dev->d_private = private; + } + return dev; +} + +/** + * ntfs_device_free - free an ntfs device structure + * @dev: ntfs device structure to free + * + * Free the ntfs device structure @dev. + * + * Return 0 on success or -1 on error with errno set to the error code. The + * following error codes are defined: + * EINVAL Invalid pointer @dev. + * EBUSY Device is still open. Close it before freeing it! + */ +int ntfs_device_free(struct ntfs_device *dev) +{ + if (!dev) { + errno = EINVAL; + return -1; + } + if (NDevOpen(dev)) { + errno = EBUSY; + return -1; + } + if (dev->d_name) + free(dev->d_name); + free(dev); + return 0; +} + diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index e0e04ba5..8bb72e40 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -26,6 +26,9 @@ #include #include #include +#include +#include +#include #ifdef HAVE_LINUX_FD_H # include # include @@ -35,6 +38,7 @@ #include "disk_io.h" #include "mst.h" #include "debug.h" +#include "device.h" #if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE) # define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ @@ -42,13 +46,13 @@ /** * ntfs_pread - positioned read from disk - * @fd: file descriptor to read from - * @pos: position in file descriptor to read from + * @dev: device to read from + * @pos: position in device to read from * @count: number of bytes to read * @b: output data buffer * - * This function will read @count bytes from file descriptor @fd at position - * @pos into the data buffer @b. + * This function will read @count bytes from device @dev at position @pos into + * the data buffer @b. * * On success, return the number of successfully read bytes. If this number is * lower than @count this means that we have either reached end of file or @@ -56,12 +60,13 @@ * end of file or nothing to read (@count is 0). * * On error and nothing has been read, return -1 with errno set appropriately - * to the return code of either lseek, read, or set to EINVAL in case of + * to the return code of either seek, read, or set to EINVAL in case of * invalid arguments. */ -s64 ntfs_pread(const int fd, const s64 pos, s64 count, const void *b) +s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, void *b) { s64 br, total; + struct ntfs_device_operations *dops; Dprintf("%s(): Entering for pos 0x%Lx, count 0x%Lx.\n", __FUNCTION__, pos, count); @@ -71,15 +76,16 @@ s64 ntfs_pread(const int fd, const s64 pos, s64 count, const void *b) } if (!count) return 0; + dops = dev->d_ops; /* Locate to position. */ - if (lseek(fd, pos, SEEK_SET) == (off_t)-1) { - Dprintf("ntfs_pread: lseek to 0x%Lx returned error: %s\n", pos, - strerror(errno)); + if (dops->seek(dev, pos, SEEK_SET) == (off_t)-1) { + Dprintf("ntfs_pread: device seek to 0x%Lx returned error: " + "%s\n", pos, strerror(errno)); return -1; } /* Read the data. */ for (total = 0; count; count -= br, total += br) { - br = read(fd, (char*)b + total, count); + br = dops->read(dev, (char*)b + total, count); /* If everything ok, continue. */ if (br > 0) continue; @@ -95,13 +101,13 @@ s64 ntfs_pread(const int fd, const s64 pos, s64 count, const void *b) /** * ntfs_pwrite - positioned write to disk - * @fd: file descriptor to write to + * @dev: device to write to * @pos: position in file descriptor to write to * @count: number of bytes to write * @b: data buffer to write to disk * - * This function will write @count bytes from data buffer @b to file descriptor - * @fd at position @pos. + * This function will write @count bytes from data buffer @b to the device @dev + * at position @pos. * * On success, return the number of successfully written bytes. If this number * is lower than @count this means that the write has been interrupted in @@ -109,12 +115,14 @@ s64 ntfs_pread(const int fd, const s64 pos, s64 count, const void *b) * is partial. 0 means nothing was written (also return 0 when @count is 0). * * On error and nothing has been written, return -1 with errno set - * appropriately to the return code of either lseek, write, or set + * appropriately to the return code of either seek, write, or set * to EINVAL in case of invalid arguments. */ -s64 ntfs_pwrite(const int fd, const s64 pos, s64 count, const void *b) +s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, + const void *b) { s64 written, total; + struct ntfs_device_operations *dops; Dprintf("%s(): Entering for pos 0x%Lx, count 0x%Lx.\n", __FUNCTION__, pos, count); @@ -124,15 +132,20 @@ s64 ntfs_pwrite(const int fd, const s64 pos, s64 count, const void *b) } if (!count) return 0; + if (NDevReadOnly(dev)) { + errno = EROFS; + return -1; + } + dops = dev->d_ops; /* Locate to position. */ - if (lseek(fd, pos, SEEK_SET) == (off_t)-1) { - Dprintf("ntfs_pwrite: lseek to 0x%Lx returned error: %s\n", + if (dops->seek(dev, pos, SEEK_SET) == (off_t)-1) { + Dprintf("ntfs_pwrite: seek to 0x%Lx returned error: %s\n", pos, strerror(errno)); return -1; } /* Write the data. */ for (total = 0; count; count -= written, total += written) { - written = write(fd, (char*)b + total, count); + written = dops->write(dev, (char*)b + total, count); /* If everything ok, continue. */ if (written > 0) continue; @@ -148,17 +161,118 @@ s64 ntfs_pwrite(const int fd, const s64 pos, s64 count, const void *b) return total; } +static int ntfs_device_disk_io_open(struct ntfs_device *dev, int flags) +{ + if (NDevOpen(dev)) { + errno = EBUSY; + return -1; + } + + /* Open the device/file obtaining the file descriptor. */ + if (((int)dev->d_private = open(dev->d_name, flags)) == -1) + return -1; + + /* Setup our read-only open flags appropriately. */ + if ((flags & O_RDONLY) == O_RDONLY) + NDevSetReadOnly(dev); + NDevSetOpen(dev); + return 0; +} + +static int ntfs_device_disk_io_close(struct ntfs_device *dev) +{ + if (!NDevOpen(dev)) { + errno = EBADF; + return -1; + } + + /* Close the file descriptor and clear our open flag. */ + if (close((int)dev->d_private) == -1) + return -1; + NDevClearOpen(dev); + + /* Destroy the device as we are done with it. */ + ntfs_device_free(dev); + return 0; +} + +static s64 ntfs_device_disk_io_seek(struct ntfs_device *dev, s64 offset, + int whence) +{ + return lseek((int)dev->d_private, offset, whence); +} + +static s64 ntfs_device_disk_io_read(struct ntfs_device *dev, void *buf, + s64 count) +{ + return read((int)dev->d_private, buf, count); +} + +static s64 ntfs_device_disk_io_write(struct ntfs_device *dev, const void *buf, + s64 count) +{ + if (NDevReadOnly(dev)) { + errno = EROFS; + return -1; + } + return write((int)dev->d_private, buf, count); +} + +static s64 ntfs_device_disk_io_pread(struct ntfs_device *dev, void *buf, + s64 count, s64 offset) +{ + return ntfs_pread(dev, offset, count, buf); +} + +static s64 ntfs_device_disk_io_pwrite(struct ntfs_device *dev, const void *buf, + s64 count, s64 offset) +{ + if (NDevReadOnly(dev)) { + errno = EROFS; + return -1; + } + return ntfs_pwrite(dev, offset, count, buf); +} + +static int ntfs_device_disk_io_sync(struct ntfs_device *dev) +{ + if (!NDevReadOnly(dev)) + return fsync((int)dev->d_private); + return 0; +} + +static int ntfs_device_disk_io_ioctl(struct ntfs_device *dev, int request, + void *argp) +{ + return ioctl((int)dev->d_private, request, argp); +} + +/** + * Default device operations for working with unix style devices and files. + */ +struct ntfs_device_operations ntfs_device_disk_io_ops = { + .open = ntfs_device_disk_io_open, + .close = ntfs_device_disk_io_close, + .seek = ntfs_device_disk_io_seek, + .read = ntfs_device_disk_io_read, + .write = ntfs_device_disk_io_write, + .pread = ntfs_device_disk_io_pread, + .pwrite = ntfs_device_disk_io_pwrite, + .sync = ntfs_device_disk_io_sync, + .ioctl = ntfs_device_disk_io_ioctl, +}; + /** * ntfs_mst_pread - multi sector transfer (mst) positioned read - * @fd: file descriptor to read from + * @dev: device to read from * @pos: position in file descriptor to read from * @count: number of blocks to read * @bksize: size of each block that needs mst deprotecting * @b: output data buffer * * Multi sector transfer (mst) positioned read. This function will read @count - * blocks of size @bksize bytes each from file descriptor @fd at position @pos - * into the data buffer @b. + * blocks of size @bksize bytes each from device @dev at position @pos into the + * the data buffer @b. * * On success, return the number of successfully read blocks. If this number is * lower than @count this means that we have reached end of file, that the read @@ -167,7 +281,7 @@ s64 ntfs_pwrite(const int fd, const s64 pos, s64 count, const void *b) * when @count or @bksize are 0). * * On error and nothing was read, return -1 with errno set appropriately to the - * return code of either lseek, read, or set to EINVAL in case of invalid + * return code of either seek, read, or set to EINVAL in case of invalid * arguments. * * NOTE: If an incomplete multi sector transfer has been detected the magic @@ -177,8 +291,8 @@ s64 ntfs_pwrite(const int fd, const s64 pos, s64 count, const void *b) * sector transfer error. This should be detected by the caller by checking for * the magic being "BAAD". */ -s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, - const u32 bksize, const void *b) +s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count, + const u32 bksize, void *b) { s64 br, i; @@ -187,7 +301,7 @@ s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, return -1; } /* Do the read. */ - br = ntfs_pread(fd, pos, count * bksize, b); + br = ntfs_pread(dev, pos, count * bksize, b); if (br < 0) return br; /* @@ -206,15 +320,15 @@ s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, /** * ntfs_mst_pwrite - multi sector transfer (mst) positioned write - * @fd: file descriptor to write to + * @dev: device to write to * @pos: position in file descriptor to write to * @count: number of blocks to write * @bksize: size of each block that needs mst protecting * @b: data buffer to write to disk * * Multi sector transfer (mst) positioned write. This function will write - * @count blocks of size @bksize bytes each from data buffer @b to file - * descriptor @fd at position @pos. + * @count blocks of size @bksize bytes each from data buffer @b to the device + * @dev at position @pos. * * On success, return the number of successfully written blocks. If this number * is lower than @count this means that the write has been interrutped or that @@ -222,7 +336,7 @@ s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, * means nothing was written (also return 0 when @count or @bksize are 0). * * On error and nothing has been written, return -1 with errno set - * appropriately to the return code of either lseek, write, or set + * appropriately to the return code of either seek, write, or set * to EINVAL in case of invalid arguments. * * NOTE: We mst protect the data, write it, then mst deprotect it using a quick @@ -234,7 +348,7 @@ s64 ntfs_mst_pread(const int fd, const s64 pos, s64 count, * simulating an mst read on the written data. This way cache coherency is * achieved. */ -s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, +s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, const u32 bksize, const void *b) { s64 written, i; @@ -260,7 +374,7 @@ s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, } } /* Write the prepared data. */ - written = ntfs_pwrite(fd, pos, count * bksize, b); + written = ntfs_pwrite(dev, pos, count * bksize, b); /* Quickly deprotect the data again. */ for (i = 0; i < count; ++i) ntfs_mst_post_write_fixup((NTFS_RECORD*)((u8*)b + i * bksize)); @@ -281,8 +395,8 @@ s64 ntfs_mst_pwrite(const int fd, const s64 pos, s64 count, * volume @vol into buffer @b. Return number of clusters read or -1 on error, * with errno set to the error code. */ -s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, - const s64 count, const void *b) +s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, const s64 count, + void *b) { s64 br; @@ -294,7 +408,7 @@ s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, errno = ESPIPE; return -1; } - br = ntfs_pread(vol->fd, lcn << vol->cluster_size_bits, + br = ntfs_pread(vol->dev, lcn << vol->cluster_size_bits, count << vol->cluster_size_bits, b); if (br < 0) { Dperror("Error reading cluster(s)"); @@ -328,7 +442,7 @@ s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, return -1; } if (!NVolReadOnly(vol)) - bw = ntfs_pwrite(vol->fd, lcn << vol->cluster_size_bits, + bw = ntfs_pwrite(vol->dev, lcn << vol->cluster_size_bits, count << vol->cluster_size_bits, b); else bw = count << vol->cluster_size_bits; @@ -341,40 +455,41 @@ s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, /** * ntfs_device_offset_valid - test if a device offset is valid - * @f: open file descriptor of device + * @dev: open device * @ofs: offset to test for validity * * Test if the offset @ofs is an existing location on the device described - * by the open file descriptor @f. + * by the open device structure @dev. * * Return 0 if it is valid and -1 if it is not valid. */ -static inline int ntfs_device_offset_valid(int f, s64 ofs) +static inline int ntfs_device_offset_valid(struct ntfs_device *dev, s64 ofs) { char ch; - if (lseek(f, ofs, SEEK_SET) >= 0 && read(f, &ch, 1) == 1) + if (dev->d_ops->seek(dev, ofs, SEEK_SET) >= 0 && + dev->d_ops->read(dev, &ch, 1) == 1) return 0; return -1; } /** * ntfs_device_size_get - return the size of a device in blocks - * @f: open file descriptor of device + * @dev: open device * @block_size: block size in bytes in which to return the result * * Return the number of @block_size sized blocks in the device described by the - * open file descriptor @f. + * open device @dev. * * Adapted from e2fsutils-1.19, Copyright (C) 1995 Theodore Ts'o. */ -s64 ntfs_device_size_get(int f, int block_size) +s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) { s64 high, low; #ifdef BLKGETSIZE long size; - if (ioctl(f, BLKGETSIZE, &size) >= 0) { + if (dev->d_ops->ioctl(dev, BLKGETSIZE, &size) >= 0) { Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, size); return (s64)size * 512 / block_size; @@ -383,7 +498,7 @@ s64 ntfs_device_size_get(int f, int block_size) #ifdef FDGETPRM { struct floppy_struct this_floppy; - if (ioctl(f, FDGETPRM, &this_floppy) >= 0) { + if (dev->d_ops->ioctl(dev, FDGETPRM, &this_floppy) >= 0) { Dprintf("FDGETPRM nr 512 byte blocks = %ld (0x%ld)\n", this_floppy.size, this_floppy.size); return (s64)this_floppy.size * 512 / block_size; @@ -395,17 +510,17 @@ s64 ntfs_device_size_get(int f, int block_size) * so do binary search to find the size of the device. */ low = 0LL; - for (high = 1024LL; !ntfs_device_offset_valid(f, high); high <<= 1) + for (high = 1024LL; !ntfs_device_offset_valid(dev, high); high <<= 1) low = high; while (low < high - 1LL) { const s64 mid = (low + high) / 2; - if (!ntfs_device_offset_valid(f, mid)) + if (!ntfs_device_offset_valid(dev, mid)) low = mid; else high = mid; } - lseek(f, 0LL, SEEK_SET); + dev->d_ops->seek(dev, 0LL, SEEK_SET); return (low + 1LL) / block_size; } diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 81ac0b72..1d0d178a 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1011,17 +1011,12 @@ s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, const s64 pos, s64 count, void *b) { s64 written, to_write, ofs, total; - int f, err = EIO; + int err = EIO; if (!vol || !rl || pos < 0 || count < 0) { errno = EINVAL; return -1; } - f = vol->fd; - if (!f) { - errno = EBADF; - return -1; - } if (!count) return count; /* Seek in @rl to the run containing @pos. */ @@ -1075,7 +1070,7 @@ s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, ofs); retry: if (!NVolReadOnly(vol)) - written = ntfs_pwrite(f, (rl->lcn << + written = ntfs_pwrite(vol->dev, (rl->lcn << vol->cluster_size_bits) + ofs, to_write, b); else diff --git a/libntfs/volume.c b/libntfs/volume.c index 0ba13f39..600323d4 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -20,6 +20,7 @@ */ #include +#include #include #include #include @@ -69,12 +70,16 @@ static void __ntfs_volume_release(ntfs_volume *v) ntfs_attr_close(v->mftmirr_na); if (v->mftmirr_ni) ntfs_inode_close(v->mftmirr_ni); - if (v->fd) { - fdatasync(v->fd); - close(v->fd); + if (v->dev) { + struct ntfs_device *dev = v->dev; + + if (NDevDirty(dev)) + dev->d_ops->sync(dev); + if (dev->d_ops->close(dev)) + fprintf(stderr, "%s(): Eeek! Failed to close the " + "device. Error: %s\n", __FUNCTION__, + strerror(errno)); } - if (v->dev_name) - free(v->dev_name); if (v->vol_name) free(v->vol_name); if (v->upcase) @@ -118,7 +123,7 @@ static int ntfs_mft_load(ntfs_volume *vol) vol->mft_ni->mft_no = 0; vol->mft_ni->mrec = mb; /* Can't use any of the higher level functions yet! */ - l = ntfs_mst_pread(vol->fd, vol->mft_lcn << vol->cluster_size_bits, 1, + l = ntfs_mst_pread(vol->dev, vol->mft_lcn << vol->cluster_size_bits, 1, vol->mft_record_size, mb); if (l != 1) { if (l != -1) @@ -363,7 +368,7 @@ error_exit: /** * ntfs_volume_startup - allocate and setup an ntfs volume - * @name: name of device/file to open + * @dev: device to open * @rwflag: optional mount flags * * Load, verify, and parse bootsector; load and setup $MFT and $MFTMirr. After @@ -373,7 +378,7 @@ error_exit: * Return the allocated volume structure on success and NULL on error with * errno set to the error code. */ -ntfs_volume *ntfs_volume_startup(const char *name, unsigned long rwflag) +ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) { LCN mft_zone_size, mft_lcn; s64 br; @@ -388,26 +393,30 @@ ntfs_volume *ntfs_volume_startup(const char *name, unsigned long rwflag) BOOL debug = 0; #endif + if (!dev || !dev->d_ops || !dev->d_name) { + errno = EINVAL; + return NULL; + } + /* Allocate the volume structure. */ vol = __ntfs_volume_allocate(); if (!vol) return NULL; - /* Make a copy of the partition name. */ - if (!(vol->dev_name = strdup(name))) - goto error_exit; + /* Attach the device to the volume. */ + vol->dev = dev; + if (rwflag & MS_RDONLY) + NVolSetReadOnly(vol); /* Allocate the boot sector structure. */ if (!(bs = (NTFS_BOOT_SECTOR *)malloc(sizeof(NTFS_BOOT_SECTOR)))) goto error_exit; - if (rwflag & MS_RDONLY) - NVolSetReadOnly(vol); Dprintf("Reading bootsector... "); - if ((vol->fd = open(name, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) < 0) { + if (dev->d_ops->open(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) { Dputs(FAILED); - Dperror("Error opening partition file"); + Dperror("Error opening partition device"); goto error_exit; } /* Now read the bootsector. */ - br = ntfs_pread(vol->fd, 0, sizeof(NTFS_BOOT_SECTOR), bs); + br = ntfs_pread(dev, 0, sizeof(NTFS_BOOT_SECTOR), bs); if (br != sizeof(NTFS_BOOT_SECTOR)) { Dputs(FAILED); if (br != -1) @@ -421,7 +430,8 @@ ntfs_volume *ntfs_volume_startup(const char *name, unsigned long rwflag) } Dputs(OK); if (!ntfs_boot_sector_is_ntfs(bs, !debug)) { - Dprintf("Error: %s is not a valid NTFS partition!\n", name); + Dprintf("Error: %s is not a valid NTFS partition!\n", + dev->d_name); errno = EINVAL; goto error_exit; } @@ -537,31 +547,28 @@ error_exit: } /** - * ntfs_mount - open ntfs volume - * @name: name of device/file to open + * ntfs_device_mount - open ntfs volume + * @dev: device to open * @rwflag: optional mount flags * - * This function mounts an ntfs volume. @name should contain the name of the - * device/file to mount as the ntfs volume. + * This function mounts an ntfs volume. @dev should describe the device which + * to mount as the ntfs volume. * * @rwflags is an optional second parameter. The same flags are used as for * the mount system call (man 2 mount). Currently only the following flag * is implemented: * MS_RDONLY - mount volume read-only * - * The function opens the device or file @name and verifies that it contains a - * valid bootsector. Then, it allocates an ntfs_volume structure and initializes + * The function opens the device @dev and verifies that it contains a valid + * bootsector. Then, it allocates an ntfs_volume structure and initializes * some of the values inside the structure from the information stored in the * bootsector. It proceeds to load the necessary system files and completes * setting up the structure. * * Return the allocated volume structure on success and NULL on error with * errno set to the error code. - * - * Note, that a copy is made of @name, and hence it can be discarded as - * soon as the function returns. */ -ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) +ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) { s64 l; const char *OK = "OK"; @@ -577,12 +584,7 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) int i, j, eo; u32 u; - if (!name) { - errno = EINVAL; - return NULL; - } - - vol = ntfs_volume_startup(name, rwflag); + vol = ntfs_volume_startup(dev, rwflag); if (!vol) { Dperror("Failed to startup volume"); return NULL; @@ -900,13 +902,55 @@ error_exit: return NULL; } +/* External declaration for internal structure. */ +extern struct ntfs_device_operations ntfs_device_disk_io_ops; + +/** + * ntfs_mount - open ntfs volume + * @name: name of device/file to open + * @rwflag: optional mount flags + * + * This function mounts an ntfs volume. @name should contain the name of the + * device/file to mount as the ntfs volume. + * + * @rwflags is an optional second parameter. The same flags are used as for + * the mount system call (man 2 mount). Currently only the following flag + * is implemented: + * MS_RDONLY - mount volume read-only + * + * The function opens the device or file @name and verifies that it contains a + * valid bootsector. Then, it allocates an ntfs_volume structure and initializes + * some of the values inside the structure from the information stored in the + * bootsector. It proceeds to load the necessary system files and completes + * setting up the structure. + * + * Return the allocated volume structure on success and NULL on error with + * errno set to the error code. + * + * Note, that a copy is made of @name, and hence it can be discarded as + * soon as the function returns. + */ +ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) +{ + struct ntfs_device *dev; + + /* Allocate an ntfs_device structure. */ + dev = ntfs_device_alloc(name, 0, &ntfs_device_disk_io_ops, NULL); + if (!dev) + return NULL; + + /* Call ntfs_device_mount() to do the actual mount. */ + return ntfs_device_mount(dev, rwflag); +} + /** * ntfs_umount - close ntfs volume * @vol: address of ntfs_volume structure of volume to close * @force: if true force close the volume even if it is busy * * Deallocate all structures (including @vol itself) associated with the ntfs - * volume @vol. + * volume @vol. Can be used on volumes mounted with ntfs_mount() as well as + * with volumes mounted with ntfs_device_mount(). * * Return 0 on success. On error return -1 with errno set appropriately * (most likely to one of EAGAIN, EBUSY or EINVAL). The EAGAIN error means that From f9a71ac4d48c45952c75959ee4e84029601c36d1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 2 Jun 2003 08:53:04 +0000 Subject: [PATCH 0554/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/06/02 09:52:25+01:00 cantab.net!aia21 Hopefully finished device io abstraction layer in the library. Utilities still not done... BKrev: 3edb107082KdM0axHG5iXLNJyW0UOw From 980387655fb34349581d981831d2fdebc707467f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 2 Jun 2003 08:53:04 +0000 Subject: [PATCH 0555/2994] Update build. (Logical change 1.138) --- Makefile.am | 9 +-------- autogen.sh | 8 ++++---- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Makefile.am b/Makefile.am index b5fb130c..e541a194 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,16 +1,9 @@ -# Need this to enable 64-bit (device) file access functions and parameters. -if DEBUG -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -Wall -else -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -endif - SUBDIRS = doc include libntfs ntfsprogs EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ INSTALL NEWS README autogen.sh ntfsprogs.spec.in \ - TODO.ntfsprogs + TODO.ntfsprogs getgccver AUTOMAKE_OPTIONS = gnu diff --git a/autogen.sh b/autogen.sh index a0e59514..6bcdeaa6 100755 --- a/autogen.sh +++ b/autogen.sh @@ -15,7 +15,7 @@ fi DIE=1 } -(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && { +(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { (libtool --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have \`libtool' installed to compile Linux-NTFS." @@ -60,7 +60,7 @@ xlc ) am_opt=--include-deps;; esac -for coin in `find $srcdir -name configure.in -print` +for coin in `find $srcdir -name configure.ac -print` do dr=`dirname $coin` if test -f $dr/NO-AUTO-GEN; then @@ -76,7 +76,7 @@ do aclocalinclude="$aclocalinclude -I $k" fi done - if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then + if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then if test -z "$NO_LIBTOOLIZE" ; then echo "Running libtoolize..." libtoolize --force --copy @@ -93,7 +93,7 @@ do exit 1 } - if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then + if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then echo "Running autoheader..." autoheader || { echo "**Error**: autoheader failed."; exit 1; } fi From 33c6acd353b1201925ea6217f5c678286f1fd057 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 11:07:54 +0000 Subject: [PATCH 0556/2994] Adapt to changes in library. (Logical change 1.139) --- ntfsprogs/ntfsfix.c | 17 ++++++++++++++--- ntfsprogs/ntfstruncate.c | 36 ------------------------------------ 2 files changed, 14 insertions(+), 39 deletions(-) diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 0c114327..587e8e24 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -56,6 +56,7 @@ #include "attrib.h" #include "mft.h" #include "disk_io.h" +#include "device.h" #include "logfile.h" /** @@ -69,6 +70,7 @@ int main(int argc, char **argv) const char *FAILED = "FAILED"; unsigned char *m = NULL, *m2 = NULL; ntfs_volume *vol; + struct ntfs_device *dev; unsigned long mnt_flags; int i; u16 flags; @@ -122,13 +124,21 @@ int main(int argc, char **argv) } puts(FAILED); - puts("Attempting to correct errors."); + printf("Attempting to correct errors... "); - vol = ntfs_volume_startup(argv[1], 0); + dev = ntfs_device_alloc(argv[1], 0, &ntfs_device_disk_io_ops, NULL); + if (!dev) { + puts(FAILED); + perror("Failed to allocate device"); + goto error_exit; + } + + vol = ntfs_volume_startup(dev, 0); if (!vol) { puts(FAILED); perror("Failed to startup volume"); fprintf(stderr, "Volume is corrupt. You should run chkdsk."); + ntfs_device_free(dev); goto error_exit; } @@ -245,6 +255,7 @@ int main(int argc, char **argv) m = m2 = NULL; printf("Processing of $MFT and $MFTMirr completed successfully.\n\n"); + /* ntfs_umount() will invoke ntfs_device_free() for us. */ if (ntfs_umount(vol, 0)) ntfs_umount(vol, 1); vol = ntfs_mount(argv[1], 0); @@ -300,7 +311,7 @@ mount_ok: /* That's all for now! */ printf("NTFS partition %s was processed successfully.\n", - vol->dev_name); + vol->dev->d_name); /* Set return code to 0. */ i = 0; final_exit: diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 409f17a7..db3ec59b 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -42,7 +42,6 @@ #ifdef HAVE_ERRNO_H # include #endif -#include #include #ifdef HAVE_GETOPT_H # include @@ -80,8 +79,6 @@ ntfs_volume *vol; ntfs_inode *ni; ntfs_attr *na = NULL; -struct flock flk; - ATTR_DEF *attr_defs; struct { @@ -701,12 +698,6 @@ void ntfstruncate_exit(void) fprintf(stderr, "Warning: Failed to close inode %Li: %s\n", (long long)inode, strerror(errno)); } - /* Unlock the device. */ - flk.l_type = F_UNLCK; - err = fcntl(vol->fd, F_SETLK, &flk); - if (err == -1) - fprintf(stderr, "Warning: Could not unlock %s: %s\n", dev_name, - strerror(errno)); /* Unmount the volume. */ err = ntfs_umount(vol, 0); if (err == -1) @@ -761,26 +752,6 @@ int main(int argc, char **argv) if (!vol) err_exit("Failed to mount %s: %s\n", dev_name, strerror(errno)); - /* Acquire exlusive (mandatory) lock on the whole device. */ - memset(&flk, 0, sizeof(flk)); - if (opts.no_action) - flk.l_type = F_RDLCK; - else - flk.l_type = F_WRLCK; - flk.l_whence = SEEK_SET; - flk.l_start = flk.l_len = 0LL; - err = fcntl(vol->fd, F_SETLK, &flk); - if (err == -1) { - Eprintf("Could not lock %s for %s: %s\n", dev_name, - opts.no_action ? "reading" : "writing", - strerror(errno)); - err = ntfs_umount(vol, 0); - if (err == -1) - Eprintf("Warning: Could not umount %s: %s\n", - dev_name, strerror(errno)); - exit(1); - } - /* Register our exit function which will unlock and close the device. */ err = atexit(&ntfstruncate_exit); if (err == -1) { @@ -830,13 +801,6 @@ int main(int argc, char **argv) err_exit("Failed to close inode %Li: %s\n", (long long)inode, strerror(errno)); - /* Unlock the device. */ - flk.l_type = F_UNLCK; - err = fcntl(vol->fd, F_SETLK, &flk); - if (err == -1) - fprintf(stderr, "Warning: Failed to unlock %s: %s\n", dev_name, - strerror(errno)); - /* Unmount the volume. */ err = ntfs_umount(vol, 0); if (err == -1) From e94dd2e6342f9d9a24acfae7b7b70fa302837557 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 11:07:54 +0000 Subject: [PATCH 0557/2994] Adapt to library changes. (Logical change 1.139) --- ntfsprogs/mkntfs.c | 183 +++++++++++++++++++++------------------------ 1 file changed, 86 insertions(+), 97 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index dc7e2941..9df41180 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -63,7 +63,6 @@ # include #endif #include -#include #ifdef HAVE_GETOPT_H # include #else @@ -71,6 +70,7 @@ extern int optind; #endif #include +#include #ifdef HAVE_LINUX_MAJOR_H # include #endif @@ -84,13 +84,14 @@ #endif #include -#if defined(__linux__) && defined(_IO) && !defined(BLKSSZGET) +#if defined(__LINUX__) && defined(_IO) && !defined(BLKSSZGET) # define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytse. */ #endif #include "types.h" #include "bootsect.h" #include "disk_io.h" +#include "device.h" #include "attrib.h" #include "bitmap.h" #include "mst.h" @@ -111,7 +112,6 @@ extern void init_upcase_table(uchar_t *uc, u32 uc_len); const char *EXEC_NAME = "mkntfs"; /* Need these global so mkntfs_exit can access them. */ -struct flock flk; char *buf = NULL; char *buf2 = NULL; int buf2_size = 0; @@ -351,7 +351,7 @@ void parse_options(int argc, char *argv[]) } if (optind == argc) usage(); - vol->dev_name = argv[optind++]; + vol->dev->d_name = argv[optind++]; if (optind < argc) { u = strtoul(argv[optind++], &s, 0); if (*s || !u || (u >= ULONG_MAX && errno == ERANGE)) @@ -386,7 +386,8 @@ void append_to_bad_blocks(unsigned long block) /** * mkntfs_write */ -__inline__ long long mkntfs_write(int fd, const void *buf, long long count) +__inline__ long long mkntfs_write(struct ntfs_device *dev, const void *buf, + long long count) { long long bytes_written, total; int retry; @@ -396,11 +397,11 @@ __inline__ long long mkntfs_write(int fd, const void *buf, long long count) total = 0LL; retry = 0; do { - bytes_written = write(fd, buf, count); + bytes_written = dev->d_ops->write(dev, buf, count); if (bytes_written == -1LL) { retry = errno; - Eprintf("Error writing to %s: %s\n", vol->dev_name, - strerror(errno)); + Eprintf("Error writing to %s: %s\n", vol->dev->d_name, + strerror(errno)); errno = retry; return bytes_written; } else if (!bytes_written) @@ -412,7 +413,7 @@ __inline__ long long mkntfs_write(int fd, const void *buf, long long count) } while (count && retry < 3); if (count) Eprintf("Failed to complete writing to %s after three retries." - "\n", vol->dev_name); + "\n", vol->dev->d_name); return total; } @@ -429,7 +430,7 @@ __inline__ long long mkntfs_write(int fd, const void *buf, long long count) * Return the number of bytes written (minus padding) or -1 on error. Errno * will be set to the error code. */ -s64 ntfs_rlwrite(int fd, const runlist *rl, const char *val, +s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, const char *val, const s64 val_len, s64 *inited_size) { s64 bytes_written, total, length, delta; @@ -450,8 +451,8 @@ s64 ntfs_rlwrite(int fd, const runlist *rl, const char *val, // TODO: Check that *val is really zero at pos and len. continue; } - if (lseek(fd, rl[i].lcn * vol->cluster_size, SEEK_SET) == - (off_t)-1) + if (dev->d_ops->seek(dev, rl[i].lcn * vol->cluster_size, + SEEK_SET) == (off_t)-1) return -1LL; retry = 0; do { @@ -460,11 +461,13 @@ s64 ntfs_rlwrite(int fd, const runlist *rl, const char *val, length = val_len - total; delta -= length; } - bytes_written = write(fd, val + total, length); + bytes_written = dev->d_ops->write(dev, val + total, + length); if (bytes_written == -1LL) { retry = errno; Eprintf("Error writing to %s: %s\n", - vol->dev_name, strerror(errno)); + vol->dev->d_name, + strerror(errno)); errno = retry; return bytes_written; } @@ -478,7 +481,7 @@ s64 ntfs_rlwrite(int fd, const runlist *rl, const char *val, } while (length && retry < 3); if (length) { Eprintf("Failed to complete writing to %s after three " - "retries.\n", vol->dev_name); + "retries.\n", vol->dev->d_name); return total; } } @@ -487,7 +490,7 @@ s64 ntfs_rlwrite(int fd, const runlist *rl, const char *val, if (!buf) err_exit("Error allocating internal buffer: " "%s\n", strerror(errno)); - bytes_written = mkntfs_write(fd, buf, delta); + bytes_written = mkntfs_write(dev, buf, delta); free(buf); if (bytes_written == -1LL) return bytes_written; @@ -1276,7 +1279,7 @@ int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, err = -ENOTSUP; } else { a->compression_unit = 0; - bw = ntfs_rlwrite(vol->fd, rl, val, val_len, &inited_size); + bw = ntfs_rlwrite(vol->dev, rl, val, val_len, &inited_size); if (bw != val_len) Eprintf("Error writing non-resident attribute value." "\n"); @@ -1465,7 +1468,7 @@ int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, err = -ENOTSUP; } else { a->compression_unit = 0; - bw = ntfs_rlwrite(vol->fd, rl, val, val_len, NULL); + bw = ntfs_rlwrite(vol->dev, rl, val, val_len, NULL); if (bw != val_len) Eprintf("Error writing non-resident attribute value." "\n"); @@ -2456,8 +2459,6 @@ void init_options() */ void mkntfs_exit(void) { - int err; - if (index_block) free(index_block); if (buf) @@ -2488,19 +2489,17 @@ void mkntfs_exit(void) free(opts.bad_blocks); if (opts.attr_defs != (ATTR_DEF*)attrdef_ntfs12_array) free(opts.attr_defs); + if (!vol) + return; if (vol->upcase) free(vol->upcase); - flk.l_type = F_UNLCK; - err = fcntl(vol->fd, F_SETLK, &flk); - if (err == -1) - Eprintf("Warning: Could not unlock %s: %s\n", vol->dev_name, - strerror(errno)); - err = close(vol->fd); - if (err == -1) - Eprintf("Warning: Could not close %s: %s\n", vol->dev_name, - strerror(errno)); - if (vol) - free(vol); + if (vol->dev) { + if (NDevOpen(vol->dev) && vol->dev->d_ops->close(vol->dev)) + Eprintf("Warning: Could not close %s: %s\n", + vol->dev->d_name, strerror(errno)); + ntfs_device_free(vol->dev); + } + free(vol); } /** @@ -2522,13 +2521,20 @@ int main(int argc, char **argv) /* Setup the correct locale for string output and conversion. */ utils_set_locale(); - /* Initialize the random number generator with the current time. */ srandom(time(NULL)); - /* Initialize ntfs_volume structure vol. */ - vol = (ntfs_volume*)calloc(1, sizeof(*vol)); + /* Allocate and initialize ntfs_volume structure vol. */ + vol = ntfs_volume_alloc(); if (!vol) err_exit("Could not allocate memory for internal buffer.\n"); + /* Register our exit function which will cleanup everything. */ + err = atexit(&mkntfs_exit); + if (err == -1) { + Eprintf("Could not set up exit() function because atexit() " + "failed. Aborting...\n"); + mkntfs_exit(); + exit(1); + } vol->major_ver = 1; vol->minor_ver = 2; vol->mft_record_size = 1024; @@ -2543,16 +2549,33 @@ int main(int argc, char **argv) init_options(); /* Parse command line options. */ parse_options(argc, argv); - /* Verify we are dealing with a block device. */ - if (stat(vol->dev_name, &sbuf) == -1) { + /* + * Allocate and initialize an ntfs device structure and attach it to + * the volume. + */ + if (!(vol->dev = ntfs_device_alloc(vol->dev->d_name, 0, + &ntfs_device_disk_io_ops, NULL))) + err_exit("Could not allocate memory for internal buffer.\n"); + /* Open the device for reading or reading and writing. */ + if (opts.no_action) { + Qprintf("Running in READ-ONLY mode!\n"); + i = O_RDONLY; + } else + i = O_RDWR; + if (vol->dev->d_ops->open(vol->dev, i)) { if (errno == ENOENT) err_exit("The device doesn't exist; did you specify " "it correctly?\n"); + err_exit("Could not open %s: %s\n", vol->dev->d_name, + strerror(errno)); + } + /* Verify we are dealing with a block device. */ + if (vol->dev->d_ops->stat(vol->dev, &sbuf)) { err_exit("Error getting information about %s: %s\n", - vol->dev_name, strerror(errno)); + vol->dev->d_name, strerror(errno)); } if (!S_ISBLK(sbuf.st_mode)) { - Eprintf("%s is not a block device.\n", vol->dev_name); + Eprintf("%s is not a block device.\n", vol->dev->d_name); if (!opts.force) err_exit("Refusing to make a filesystem here!\n"); if (!opts.nr_sectors) { @@ -2582,64 +2605,27 @@ int main(int argc, char **argv) (SCSI_BLK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 16 == 0)) { err_exit("%s is entire device, not just one partition!\n", - vol->dev_name); + vol->dev->d_name); } #endif /* Make sure the file system is not mounted. */ - if (ntfs_check_if_mounted(vol->dev_name, &mnt_flags)) + if (ntfs_check_if_mounted(vol->dev->d_name, &mnt_flags)) Eprintf("Failed to determine whether %s is mounted: %s\n", - vol->dev_name, strerror(errno)); + vol->dev->d_name, strerror(errno)); else if (mnt_flags & NTFS_MF_MOUNTED) { - Eprintf("%s is mounted.\n", vol->dev_name); + Eprintf("%s is mounted.\n", vol->dev->d_name); if (!opts.force) err_exit("Refusing to make a filesystem here!\n"); fprintf(stderr, "mkntfs forced anyway. Hope /etc/mtab is " "incorrect.\n"); } - - /* Open the device for reading or reading and writing. */ - if (opts.no_action) { - Qprintf("Running in READ-ONLY mode!\n"); - i = O_RDONLY; - } else - i = O_RDWR; - vol->fd = open(vol->dev_name, i); - if (vol->fd == -1) - err_exit("Could not open %s: %s\n", vol->dev_name, - strerror(errno)); - /* Acquire exlusive (mandatory) write lock on the whole device. */ - memset(&flk, 0, sizeof(flk)); - if (opts.no_action) - flk.l_type = F_RDLCK; - else - flk.l_type = F_WRLCK; - flk.l_whence = SEEK_SET; - flk.l_start = flk.l_len = 0LL; - err = fcntl(vol->fd, F_SETLK, &flk); - if (err == -1) { - Eprintf("Could not lock %s for %s: %s\n", vol->dev_name, - opts.no_action ? "reading" : "writing", - strerror(errno)); - err = close(vol->fd); - if (err == -1) - Eprintf("Warning: Could not close %s: %s\n", - vol->dev_name, strerror(errno)); - exit(1); - } - /* Register our exit function which will unlock and close the device. */ - err = atexit(&mkntfs_exit); - if (err == -1) { - Eprintf("Could not set up exit() function because atexit() " - "failed. Aborting...\n"); - mkntfs_exit(); - exit(1); - } /* If user didn't specify the sector size, determine it now. */ if (!opts.sector_size) { #ifdef BLKSSZGET int _sect_size = 0; - if (ioctl(vol->fd, BLKSSZGET, &_sect_size) >= 0) + if (vol->dev->d_ops->ioctl(vol->dev, BLKSSZGET, &_sect_size) + >= 0) opts.sector_size = _sect_size; else #endif @@ -2647,24 +2633,25 @@ int main(int argc, char **argv) Eprintf("No sector size specified for %s and it could " "not be obtained automatically.\n" "Assuming sector size is 512 bytes.\n", - vol->dev_name); + vol->dev->d_name); opts.sector_size = 512; } } /* Validate sector size. */ if ((opts.sector_size - 1) & opts.sector_size || - opts.sector_size < 256 || opts.sector_size > 4096) + opts.sector_size < 256 || opts.sector_size > 4096) err_exit("Error: sector_size is invalid. It must be a power " "of two, and it must be\n greater or equal 256 and " "less than or equal 4096 bytes.\n"); Dprintf("sector size = %i bytes\n", opts.sector_size); /* If user didn't specify the number of sectors, determine it now. */ if (!opts.nr_sectors) { - opts.nr_sectors = ntfs_device_size_get(vol->fd, opts.sector_size); + opts.nr_sectors = ntfs_device_size_get(vol->dev, + opts.sector_size); if (opts.nr_sectors <= 0) err_exit("ntfs_device_size_get(%s) failed. Please " "specify it manually.\n", - vol->dev_name); + vol->dev->d_name); } Dprintf("number of sectors = %Ld (0x%Lx)\n", opts.nr_sectors, opts.nr_sectors); @@ -2979,7 +2966,7 @@ int main(int argc, char **argv) progress_inc); fflush(stdout); } - bw = mkntfs_write(vol->fd, buf, vol->cluster_size); + bw = mkntfs_write(vol->dev, buf, vol->cluster_size); if (bw != vol->cluster_size) { if (bw != -1 || errno != EIO) err_exit("This should not happen.\n"); @@ -3001,7 +2988,8 @@ int main(int argc, char **argv) "device with zeroes: %3.0f%%", position, position / progress_inc); /* Seek to next cluster. */ - lseek(vol->fd, ((off_t)position + 1) * + vol->dev->d_ops->seek(vol->dev, + ((off_t)position + 1) * vol->cluster_size, SEEK_SET); } } @@ -3009,7 +2997,7 @@ int main(int argc, char **argv) position = (opts.volume_size & (vol->cluster_size - 1)) / opts.sector_size; for (i = 0; i < position; i++) { - bw = mkntfs_write(vol->fd, buf, opts.sector_size); + bw = mkntfs_write(vol->dev, buf, opts.sector_size); if (bw != opts.sector_size) { if (bw != -1 || errno != EIO) err_exit("This should not happen.\n"); @@ -3021,7 +3009,8 @@ int main(int argc, char **argv) "location reserved for system " "file $Boot.\n"); /* Seek to next sector. */ - lseek(vol->fd, opts.sector_size, SEEK_CUR); + vol->dev->d_ops->seek(vol->dev, + opts.sector_size, SEEK_CUR); } } Qprintf(" - Done.\n"); @@ -3327,10 +3316,10 @@ int main(int argc, char **argv) * Write the first max(512, opts.sector_size) bytes from buf2 to the * last sector. */ - if (lseek(vol->fd, (opts.nr_sectors + 1) * opts.sector_size - i, - SEEK_SET) == (off_t)-1) + if (vol->dev->d_ops->seek(vol->dev, (opts.nr_sectors + 1) * + opts.sector_size - i, SEEK_SET) == (off_t)-1) goto bb_err; - bw = mkntfs_write(vol->fd, buf2, i); + bw = mkntfs_write(vol->dev, buf2, i); free(buf2); buf2 = NULL; if (bw != i) { @@ -3464,7 +3453,7 @@ bb_err: if (err) err_exit("ntfs_mst_pre_write_fixup() failed while syncing " "root directory index block.\n"); - lw = ntfs_rlwrite(vol->fd, rl_index, (char*)index_block, i, NULL); + lw = ntfs_rlwrite(vol->dev, rl_index, (char*)index_block, i, NULL); if (lw != i) err_exit("Error writing $INDEX_ALLOCATION.\n"); /* No more changes to @index_block below here so no need for fixup: */ @@ -3485,7 +3474,7 @@ bb_err: ntfs_attr_put_search_ctx(ctx); if (!rl) err_exit("ntfs_mapping_pairs_decompress() failed\n"); - lw = ntfs_rlwrite(vol->fd, rl, lcn_bitmap, + lw = ntfs_rlwrite(vol->dev, rl, lcn_bitmap, lcn_bitmap_byte_size, NULL); if (lw != lcn_bitmap_byte_size) err_exit("%s\n", lw == -1 ? strerror(errno) : @@ -3504,7 +3493,7 @@ bb_err: lw = 1; for (i = 0; i < opts.mft_size / vol->mft_record_size; i++) { if (!opts.no_action) - lw = ntfs_mst_pwrite(vol->fd, pos, 1, + lw = ntfs_mst_pwrite(vol->dev, pos, 1, vol->mft_record_size, buf + i * vol->mft_record_size); if (lw != 1) @@ -3531,7 +3520,7 @@ bb_err: usn = 0xfffe; *usnp = cpu_to_le16(usn); if (!opts.no_action) - lw = ntfs_mst_pwrite(vol->fd, pos, 1, + lw = ntfs_mst_pwrite(vol->dev, pos, 1, vol->mft_record_size, buf + i * vol->mft_record_size); if (lw != 1) @@ -3540,7 +3529,7 @@ bb_err: pos += vol->mft_record_size; } Vprintf("Syncing device.\n"); - if (fdatasync(vol->fd) == -1) + if (vol->dev->d_ops->sync(vol->dev)) err_exit("Syncing device. FAILED: %s", strerror(errno)); Qprintf("mkntfs completed successfully. Have a nice day.\n"); /* From ed8e3db271164370bba999716200b62ef6403463 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 11:07:54 +0000 Subject: [PATCH 0558/2994] Add ntfs_volume_alloc() for low level utilities. (Logical change 1.139) --- include/volume.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/volume.h b/include/volume.h index 157bba35..336e065c 100644 --- a/include/volume.h +++ b/include/volume.h @@ -154,6 +154,8 @@ struct _ntfs_volume { bytes. */ }; +extern ntfs_volume *ntfs_volume_alloc(void); + extern ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag); From 137b10dca8d2c828b367a55e2119a6d211a83d38 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 11:07:54 +0000 Subject: [PATCH 0559/2994] Add ntfs_volume_alloc() for low level utilities. 2003/06/03 10:35:17+01:00 cantab.net!aia21 Cleanup and do not destroy the ntfs device structure when unmounting a volume. (Logical change 1.139) --- libntfs/volume.c | 94 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 24 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index 600323d4..6a5430f4 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -38,14 +38,28 @@ #include "runlist.h" /** - * Internal: - * - * __ntfs_volume_allocate - + * ntfs_volume_alloc - * */ -static ntfs_volume *__ntfs_volume_allocate(void) +ntfs_volume *ntfs_volume_alloc(void) { - return (ntfs_volume*)calloc(1, sizeof(ntfs_volume)); + ntfs_volume *vol; + + vol = (ntfs_volume*)calloc(1, sizeof(ntfs_volume)); + if (vol) { + vol->dev = NULL; + vol->vol_name = NULL; + vol->lcnbmp_ni = NULL; + vol->lcnbmp_na = NULL; + vol->mft_ni = NULL; + vol->mft_na = NULL; + vol->mftbmp_na = NULL; + vol->mftmirr_ni = NULL; + vol->mftmirr_na = NULL; + vol->upcase = NULL; + vol->attrdef = NULL; + } + return vol; } /** @@ -385,7 +399,7 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) const char *OK = "OK"; const char *FAILED = "FAILED"; ntfs_volume *vol; - NTFS_BOOT_SECTOR *bs = NULL; + NTFS_BOOT_SECTOR *bs; int eo; #ifdef DEBUG BOOL debug = 1; @@ -398,23 +412,23 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) return NULL; } - /* Allocate the volume structure. */ - vol = __ntfs_volume_allocate(); - if (!vol) - return NULL; - /* Attach the device to the volume. */ - vol->dev = dev; - if (rwflag & MS_RDONLY) - NVolSetReadOnly(vol); /* Allocate the boot sector structure. */ if (!(bs = (NTFS_BOOT_SECTOR *)malloc(sizeof(NTFS_BOOT_SECTOR)))) + return NULL; + /* Allocate the volume structure. */ + vol = ntfs_volume_alloc(); + if (!vol) goto error_exit; + if (rwflag & MS_RDONLY) + NVolSetReadOnly(vol); Dprintf("Reading bootsector... "); if (dev->d_ops->open(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) { Dputs(FAILED); Dperror("Error opening partition device"); goto error_exit; } + /* Attach the device to the volume. */ + vol->dev = dev; /* Now read the bootsector. */ br = ntfs_pread(dev, 0, sizeof(NTFS_BOOT_SECTOR), bs); if (br != sizeof(NTFS_BOOT_SECTOR)) { @@ -538,8 +552,7 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) return vol; error_exit: eo = errno; - if (bs) - free(bs); + free(bs); if (vol) __ntfs_volume_release(vol); errno = eo; @@ -896,15 +909,11 @@ error_exit: free(m); if (m2) free(m2); - if (vol) - __ntfs_volume_release(vol); + __ntfs_volume_release(vol); errno = eo; return NULL; } -/* External declaration for internal structure. */ -extern struct ntfs_device_operations ntfs_device_disk_io_ops; - /** * ntfs_mount - open ntfs volume * @name: name of device/file to open @@ -938,19 +947,52 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) dev = ntfs_device_alloc(name, 0, &ntfs_device_disk_io_ops, NULL); if (!dev) return NULL; - /* Call ntfs_device_mount() to do the actual mount. */ return ntfs_device_mount(dev, rwflag); } +/** + * ntfs_device_umount - close ntfs volume + * @vol: address of ntfs_volume structure of volume to close + * @force: if true force close the volume even if it is busy + * + * Deallocate all structures (including @vol itself) associated with the ntfs + * volume @vol. + * + * Note it is up to the caller to destroy the device associated with the volume + * being unmounted after this function returns. + * + * Return 0 on success. On error return -1 with errno set appropriately + * (most likely to one of EAGAIN, EBUSY or EINVAL). The EAGAIN error means that + * an operation is in progress and if you try the close later the operation + * might be completed and the close succeed. + * + * If @force is true (i.e. not zero) this function will close the volume even + * if this means that data might be lost. + * + * @vol must have previously been returned by a call to ntfs_device_mount(). + * + * @vol itself is deallocated and should no longer be dereferenced after this + * function returns success. If it returns an error then nothing has been done + * so it is safe to continue using @vol. + */ +int ntfs_device_umount(ntfs_volume *vol, const BOOL force) +{ + if (!vol) { + errno = EINVAL; + return -1; + } + __ntfs_volume_release(vol); + return 0; +} + /** * ntfs_umount - close ntfs volume * @vol: address of ntfs_volume structure of volume to close * @force: if true force close the volume even if it is busy * * Deallocate all structures (including @vol itself) associated with the ntfs - * volume @vol. Can be used on volumes mounted with ntfs_mount() as well as - * with volumes mounted with ntfs_device_mount(). + * volume @vol. * * Return 0 on success. On error return -1 with errno set appropriately * (most likely to one of EAGAIN, EBUSY or EINVAL). The EAGAIN error means that @@ -968,11 +1010,15 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) */ int ntfs_umount(ntfs_volume *vol, const BOOL force) { + struct ntfs_device *dev; + if (!vol) { errno = EINVAL; return -1; } + dev = vol->dev; __ntfs_volume_release(vol); + ntfs_device_free(dev); return 0; } From 75d44c72a09a2ebd1d1947d89a222fa289a1bc5e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 11:07:54 +0000 Subject: [PATCH 0560/2994] Add stat to ntfs_device_operations and implement mandatory locking when opening / closing the device (in the default disk_io functions). 2003/06/03 10:35:17+01:00 cantab.net!aia21 Add Dirty bit setting/clearing. (Logical change 1.139) --- libntfs/disk_io.c | 64 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index 8bb72e40..113d36e8 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -40,7 +40,7 @@ #include "debug.h" #include "device.h" -#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE) +#if defined(__LINUX__) && defined(_IO) && !defined(BLKGETSIZE) # define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ #endif @@ -143,6 +143,7 @@ s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, pos, strerror(errno)); return -1; } + NDevSetDirty(dev); /* Write the data. */ for (total = 0; count; count -= written, total += written) { written = dops->write(dev, (char*)b + total, count); @@ -163,36 +164,65 @@ s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, static int ntfs_device_disk_io_open(struct ntfs_device *dev, int flags) { + struct flock flk; + if (NDevOpen(dev)) { errno = EBUSY; return -1; } - /* Open the device/file obtaining the file descriptor. */ if (((int)dev->d_private = open(dev->d_name, flags)) == -1) return -1; - - /* Setup our read-only open flags appropriately. */ + /* Setup our read-only flag. */ if ((flags & O_RDONLY) == O_RDONLY) NDevSetReadOnly(dev); + /* Acquire exlusive (mandatory) lock on the whole device. */ + memset(&flk, 0, sizeof(flk)); + if (NDevReadOnly(dev)) + flk.l_type = F_RDLCK; + else + flk.l_type = F_WRLCK; + flk.l_whence = SEEK_SET; + flk.l_start = flk.l_len = 0LL; + if (fcntl((int)dev->d_private, F_SETLK, &flk)) { + int eo = errno; + Dprintf("ntfs_device_disk_io_open: Could not lock %s for %s: " + "%s\n", dev->d_name, NDevReadOnly(dev) ? + "reading" : "writing", strerror(errno)); + if (close((int)dev->d_private)) + Dprintf("ntfs_device_disk_io_open: Warning: Could not " + "close %s: %s\n", dev->d_name, + strerror(errno)); + errno = eo; + return -1; + } + /* Set our open flag. */ NDevSetOpen(dev); return 0; } static int ntfs_device_disk_io_close(struct ntfs_device *dev) { + struct flock flk; + if (!NDevOpen(dev)) { errno = EBADF; return -1; } - + if (NDevDirty(dev)) + fsync((int)dev->d_private); + /* Release exlusive (mandatory) lock on the whole device. */ + memset(&flk, 0, sizeof(flk)); + flk.l_type = F_UNLCK; + flk.l_whence = SEEK_SET; + flk.l_start = flk.l_len = 0LL; + if (fcntl((int)dev->d_private, F_SETLK, &flk)) + Dprintf("ntfs_device_disk_io_close: Warning: Could not unlock " + "%s: %s\n", dev->d_name, strerror(errno)); /* Close the file descriptor and clear our open flag. */ - if (close((int)dev->d_private) == -1) + if (close((int)dev->d_private)) return -1; NDevClearOpen(dev); - - /* Destroy the device as we are done with it. */ - ntfs_device_free(dev); return 0; } @@ -215,6 +245,7 @@ static s64 ntfs_device_disk_io_write(struct ntfs_device *dev, const void *buf, errno = EROFS; return -1; } + NDevSetDirty(dev); return write((int)dev->d_private, buf, count); } @@ -231,16 +262,26 @@ static s64 ntfs_device_disk_io_pwrite(struct ntfs_device *dev, const void *buf, errno = EROFS; return -1; } + NDevSetDirty(dev); return ntfs_pwrite(dev, offset, count, buf); } static int ntfs_device_disk_io_sync(struct ntfs_device *dev) { - if (!NDevReadOnly(dev)) - return fsync((int)dev->d_private); + if (!NDevReadOnly(dev) && NDevDirty(dev)) { + int res = fsync((int)dev->d_private); + if (!res) + NDevClearDirty(dev); + return res; + } return 0; } +static int ntfs_device_disk_io_stat(struct ntfs_device *dev, struct stat *buf) +{ + return fstat((int)dev->d_private, buf); +} + static int ntfs_device_disk_io_ioctl(struct ntfs_device *dev, int request, void *argp) { @@ -259,6 +300,7 @@ struct ntfs_device_operations ntfs_device_disk_io_ops = { .pread = ntfs_device_disk_io_pread, .pwrite = ntfs_device_disk_io_pwrite, .sync = ntfs_device_disk_io_sync, + .stat = ntfs_device_disk_io_stat, .ioctl = ntfs_device_disk_io_ioctl, }; From fc30058a9576804df86d1c571e1d49d08406216f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 11:07:54 +0000 Subject: [PATCH 0561/2994] Add stat to ntfs_device_operations. (Logical change 1.139) --- include/device.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/device.h b/include/device.h index 49ba0ce9..a0a21d6a 100644 --- a/include/device.h +++ b/include/device.h @@ -22,6 +22,8 @@ #ifndef _NTFS_DEVICE_H #define _NTFS_DEVICE_H +#include + #include "types.h" #include "support.h" @@ -79,6 +81,7 @@ struct ntfs_device_operations { s64 (*pwrite)(struct ntfs_device *dev, const void *buf, s64 count, s64 offset); int (*sync)(struct ntfs_device *dev); + int (*stat)(struct ntfs_device *dev, struct stat *buf); int (*ioctl)(struct ntfs_device *dev, int request, void *argp); }; From 7c5b6a5d15038547939da17c3855c465e4d70abb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 11:07:54 +0000 Subject: [PATCH 0562/2994] Auto merged 2003/06/03 12:06:46+01:00 cantab.net!aia21 Adapt to changes in library. (Logical change 1.139) --- ntfsprogs/ntfsresize.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 8f0443a6..1bf296e3 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1127,7 +1127,7 @@ int write_mft_record(ntfs_attr_search_ctx *ctx) if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec)) perr_exit("ntfs_mft_record_write"); - if (fdatasync(vol->fd) == -1) + if (vol->dev->d_ops->sync(vol->dev) == -1) perr_exit("Failed to sync device"); return 0; @@ -1202,20 +1202,22 @@ void update_bootsector(s64 nr_clusters) printf("Updating Boot record ...\n"); - if (lseek(vol->fd, 0, SEEK_SET) == (off_t)-1) + if (vol->dev->d_ops->seek(vol->dev, 0, SEEK_SET) == (off_t)-1) perr_exit("lseek"); - if (read(vol->fd, &bs, sizeof(NTFS_BOOT_SECTOR)) == -1) + if (vol->dev->d_ops->read(vol->dev, &bs, + sizeof(NTFS_BOOT_SECTOR)) == -1) perr_exit("read() error"); bs.number_of_sectors = nr_clusters * bs.bpb.sectors_per_cluster; bs.number_of_sectors = cpu_to_le64(bs.number_of_sectors); - if (lseek(vol->fd, 0, SEEK_SET) == (off_t)-1) + if (vol->dev->d_ops->seek(vol->dev, 0, SEEK_SET) == (off_t)-1) perr_exit("lseek"); if (!opt.ro_flag) - if (write(vol->fd, &bs, sizeof(NTFS_BOOT_SECTOR)) == -1) + if (vol->dev->d_ops->write(vol->dev, &bs, + sizeof(NTFS_BOOT_SECTOR)) == -1) perr_exit("write() error"); } @@ -1334,7 +1336,7 @@ void prepare_volume_fixup() if (ntfs_volume_set_flags(vol, flags)) perr_exit("Failed to set $Volume dirty"); - if (fdatasync(vol->fd) == -1) + if (vol->dev->d_ops->sync(vol->dev) == -1) perr_exit("Failed to sync device"); printf("Resetting $LogFile ... (this might take a while)\n"); @@ -1342,7 +1344,7 @@ void prepare_volume_fixup() if (ntfs_logfile_reset(vol)) perr_exit("Failed to reset $LogFile"); - if (fdatasync(vol->fd) == -1) + if (vol->dev->d_ops->sync(vol->dev) == -1) perr_exit("Failed to sync device"); } @@ -1366,7 +1368,7 @@ int main(int argc, char **argv) mount_volume(); - device_size = ntfs_device_size_get(vol->fd, vol->sector_size); + device_size = ntfs_device_size_get(vol->dev, vol->sector_size); device_size *= vol->sector_size; if (device_size <= 0) err_exit("Couldn't get device size (%Ld)!\n", device_size); @@ -1458,10 +1460,10 @@ int main(int argc, char **argv) } printf("Syncing device ...\n"); - if (fsync(vol->fd) == -1) + if (vol->dev->d_ops->sync(vol->dev) == -1) perr_exit("fsync"); - printf("Successfully resized NTFS on device '%s'.\n", vol->dev_name); + printf("Successfully resized NTFS on device '%s'.\n", vol->dev->d_name); if (new_size < vol->nr_clusters) printf(resize_important_msg); From f78cfd42a1987ad350f9471ee659baab433e87bd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 11:07:54 +0000 Subject: [PATCH 0563/2994] Export the default opearations so the low level utilities can use them. (Logical change 1.139) --- include/disk_io.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/disk_io.h b/include/disk_io.h index 287073ea..c82a18db 100644 --- a/include/disk_io.h +++ b/include/disk_io.h @@ -24,6 +24,8 @@ #include "volume.h" +extern struct ntfs_device_operations ntfs_device_disk_io_ops; + extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, void *b); extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, From 476ec77963a54c96277729987fe0047e170b7800 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 11:07:54 +0000 Subject: [PATCH 0564/2994] Merge 2003/06/03 12:06:46+01:00 cantab.net!aia21 Adapt to utilities to changes in library. 2003/06/03 11:55:11+01:00 cantab.net!aia21 Cleanups in library. Add mandatory locking to default disk_io open/close functions. Adapt mkntfs to library changes. 2003/06/03 10:35:17+01:00 cantab.net!aia21 Library cleanups and adapt ntfsfix to library changes. BKrev: 3edc818a7VAB82zPLPPMMjAOzFhXcQ From b5d94d76cb47ba969c929063becd832cee298e1a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 11:07:54 +0000 Subject: [PATCH 0565/2994] SCCS merged 2003/06/03 12:06:46+01:00 cantab.net!aia21 Update. (Logical change 1.139) --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b8ae86e2..1e25bd4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,7 +8,7 @@ xx/xx/2003 - 1.8.0-devel - Work in progress. - Add -fms-extensions when compiling with gcc-3.2+. - Update for newer autoconf/automake. - Abstract low level device operations (include/device,h and - libntfs/device.c). + libntfs/device.c) and adapt utilities to changes. - Added ntfsclone utility written by Szabolcs Szakacsits. 13/02/2003 - 1.7.1 - Urgent bug fixes. From 46fd21a9bbd8bf3c353ae43804e0cd7b4bbbc6d0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 11:10:57 +0000 Subject: [PATCH 0566/2994] Adapt ntfsclone to library changes. BKrev: 3edc8241Q6hpRkIbrpXbujO_DNqCWQ From cc9c0f3153559e9fc61bcfb560a8478fb7731f10 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 11:10:57 +0000 Subject: [PATCH 0567/2994] Adapt to library changes. (Logical change 1.140) --- ntfsprogs/ntfsclone.c | 934 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 934 insertions(+) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index e69de29b..40c8116c 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -0,0 +1,934 @@ +/** + * ntfsclone - Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Szabolcs Szakacsits + * + * ntfsclone clones NTFS data and/or metadata to a sparse file or stdout. + * + * 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 of the License, or + * (at your option) any later version. + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "debug.h" +#include "types.h" +#include "support.h" +#include "endians.h" +#include "bootsect.h" +#include "disk_io.h" +#include "attrib.h" +#include "volume.h" +#include "mft.h" +#include "bitmap.h" +#include "inode.h" +#include "runlist.h" +#include "utils.h" + +static const char *EXEC_NAME = "ntfsclone"; + +struct { + int verbose; + int quiet; + int debug; + int force; + int overwrite; + int stdout; + int metadata_only; + char *output; + char *volume; +} opt; + +struct bitmap { + u8 *bm; + s64 size; +}; + +struct progress_bar { + u64 start; + u64 stop; + int resolution; + float unit; +}; + +struct __ntfs_walk_clusters_ctx { + ntfs_inode *ni; /* inode being processed */ + ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ + u64 inuse; /* number of clusters in use */ +}; + +typedef struct __ntfs_walk_clusters_ctx ntfs_walk_clusters_ctx; +typedef int (ntfs_walk_op)(ntfs_inode *ni, void *data); + +struct ntfs_walk_cluster { + ntfs_walk_op *inode_op; /* not implemented yet */ + ntfs_walk_clusters_ctx *image; +}; + + +ntfs_volume *vol = NULL; +struct bitmap lcn_bitmap; + +int fd_out; +FILE *msg_out = NULL; + +int nr_used_mft_records = 0; +int wipe = 0; +int wiped_unused_mft_data = 0; +int wiped_unused_mft = 0; +int wiped_resident_data = 0; +int wiped_timestamp_data = 0; + +#define NTFS_MBYTE (1000 * 1000) + +#define ERR_PREFIX "ERROR" +#define PERR_PREFIX ERR_PREFIX "(%d): " +#define NERR_PREFIX ERR_PREFIX ": " + +#define LAST_METADATA_INODE 11 + +#define NTFS_MAX_CLUSTER_SIZE 65536 + +#define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) + +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, msg_out, &opt.verbose, TRUE) +GEN_PRINTF(Qprintf, msg_out, &opt.quiet, FALSE) +GEN_PRINTF(Printf, msg_out, NULL, FALSE) + + +void perr_printf(const char *fmt, ...) +{ + va_list ap; + int eo = errno; + + Printf(PERR_PREFIX, eo); + va_start(ap, fmt); + vfprintf(msg_out, fmt, ap); + va_end(ap); + Printf(": %s\n", strerror(eo)); + fflush(msg_out); +} + +void err_printf(const char *fmt, ...) +{ + va_list ap; + + Printf(NERR_PREFIX); + va_start(ap, fmt); + vfprintf(msg_out, fmt, ap); + va_end(ap); + fflush(msg_out); +} + +int err_exit(const char *fmt, ...) +{ + va_list ap; + + Printf(NERR_PREFIX); + va_start(ap, fmt); + vfprintf(msg_out, fmt, ap); + va_end(ap); + fflush(msg_out); + exit(1); +} + + +int perr_exit(const char *fmt, ...) +{ + va_list ap; + int eo = errno; + + Printf(PERR_PREFIX, eo); + va_start(ap, fmt); + vfprintf(msg_out, fmt, ap); + va_end(ap); + Printf(": %s\n", strerror(eo)); + fflush(msg_out); + exit(1); +} + + +void usage() +{ + Eprintf("\nUsage: %s [options] device\n" + " Clone NTFS data to a sparse file or send it to stdout.\n" + "\n" + " -o FILE --output FILE Clone NTFS to the non-existent FILE\n" + " -O FILE Clone NTFS to FILE, overwriting if exists\n" + " -m --metadata Clone *only* metadata (for NTFS experts)\n" + " -f --force Force to progress (DANGEROUS)\n" + " -h --help Display this help\n" +#ifdef DEBUG + " -d --debug Show debug information\n" +#endif + "\n" + " If FILE is '-' then send NTFS data to stdout replacing non used\n" + " NTFS and partition space with zeros.\n" + "\n", EXEC_NAME); + Eprintf("%s%s\n", ntfs_bugs, ntfs_home); + exit(1); +} + + +void parse_options(int argc, char **argv) +{ + static const char *sopt = "-dfhmo:O:"; + static const struct option lopt[] = { +#ifdef DEBUG + { "debug", no_argument, NULL, 'd' }, +#endif + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "metadata", no_argument, NULL, 'm' }, + { "output", required_argument, NULL, 'o' }, + { NULL, 0, NULL, 0 } + }; + + char c; + + memset(&opt, 0, sizeof(opt)); + + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (opt.volume) + usage(); + opt.volume = argv[optind-1]; + break; + case 'd': + opt.debug++; + break; + case 'f': + opt.force++; + break; + case 'h': + case '?': + usage(); + case 'm': + opt.metadata_only++; + break; + case 'O': + opt.overwrite++; + case 'o': + if (opt.output) + usage(); + opt.output = argv[optind-1]; + break; + default: + err_printf("Unknown option '%s'.\n", argv[optind-1]); + usage(); + } + } + + if (opt.output == NULL) { + err_printf("You must specify an output file.\n"); + usage(); + } + + if (strcmp(opt.output, "-") == 0) + opt.stdout++; + + if (opt.volume == NULL) { + err_printf("You must specify a device file.\n"); + usage(); + } + + if (opt.metadata_only && opt.stdout) + err_exit("Cloning only metadata to stdout isn't supported yet!\n"); + + msg_out = stdout; + + /* FIXME: this is a workaround for loosing debug info if stdout != stderr + and for the uncontrollable verbose messages in libntfs. Ughhh. */ + if (opt.stdout) + msg_out = stderr; + else if (opt.debug) + stderr = stdout; + else + if (!(stderr = fopen("/dev/null", "rw"))) + perr_exit("Couldn't open /dev/null"); +} + + +/** + * nr_clusters_to_bitmap_byte_size + * + * Take the number of clusters in the volume and calculate the size of $Bitmap. + * The size will always be a multiple of 8 bytes. + */ +s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) +{ + s64 bm_bsize; + + bm_bsize = rounded_up_division(nr_clusters, 8); + + bm_bsize = (bm_bsize + 7) & ~7; + Dprintf("Bitmap byte size : %lld (%lld clusters)\n", + bm_bsize, rounded_up_division(bm_bsize, vol->cluster_size)); + + return bm_bsize; +} + +int is_critical_meatadata(ntfs_walk_clusters_ctx *image) +{ + s64 inode; + + inode = image->ni->mft_no; + + if (inode <= LAST_METADATA_INODE) + if (inode != FILE_LogFile) + return 1; + + if (image->ctx->attr->type != AT_DATA) + return 1; + + return 0; +} + +void write_cluster(const char *buff) +{ + int count; + + if ((count = write(fd_out, buff, vol->cluster_size)) == -1) + perr_exit("write"); + + if (count != vol->cluster_size) + err_exit("Partial write not yet handled\n"); +} + +void copy_cluster() +{ + int count; + char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ + + /* FIXME: handle partial read/writes */ + if ((count = vol->dev->d_ops->read(vol->dev, buff, + vol->cluster_size)) == -1) + perr_exit("read"); + + if (count != vol->cluster_size) + err_exit("Partial read not yet handled\n"); + + write_cluster(buff); +} + +void lseek_to_cluster(s64 lcn) +{ + off_t pos; + + pos = (off_t)(lcn * vol->cluster_size); + + if (vol->dev->d_ops->seek(vol->dev, pos, SEEK_SET) == (off_t)-1) + perr_exit("lseek input"); + + if (opt.stdout) + return; + + if (lseek(fd_out, pos, SEEK_SET) == (off_t)-1) + perr_exit("lseek output"); +} + +void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) +{ + int i; + + if (opt.stdout) + return; + + if (opt.metadata_only && !is_critical_meatadata(image)) + return; + + lseek_to_cluster(rl->lcn); + + /* FIXME: this could give pretty suboptimal performance */ + for (i = 0; i < rl->length; i++) + copy_cluster(); +} + +void dump_to_stdout() +{ + s64 i, pos, count; + u8 bm[NTFS_BUF_SIZE]; + void *buff; + + Printf("Dumping NTFS to stdout ...\n"); + + if ((buff = calloc(1, vol->cluster_size)) == NULL) + perr_exit("dump_to_stdout"); + + pos = 0; + while (1) { + count = ntfs_attr_pread(vol->lcnbmp_na, pos, NTFS_BUF_SIZE, bm); + if (count == -1) + perr_exit("Couldn't read $Bitmap (pos = %Ld)\n", pos); + + if (count == 0) + return; + + for (i = 0; i < count; i++, pos++) { + u64 cl; /* current cluster */ + + for (cl = pos * 8; cl < (pos + 1) * 8; cl++) { + + if (cl > vol->nr_clusters - 1) + return; + + if (ntfs_bit_get(bm, i * 8 + cl % 8)) { + lseek_to_cluster(cl); + copy_cluster(); + } else + write_cluster(buff); + } + } + } +} + +#define WIPE_TIMESTAMPS(atype, attr) \ +do { \ + atype *ats; \ + ats = (atype *)((char*)(attr) + (attr)->value_offset); \ + \ + ats->creation_time = 0; \ + ats->last_data_change_time = 0; \ + ats->last_mft_change_time= 0; \ + ats->last_access_time = 0; \ + \ + wiped_timestamp_data += 32; \ + \ +} while(0) + +void wipe_timestamps(ntfs_walk_clusters_ctx *image) +{ + ATTR_RECORD *a = image->ctx->attr; + + if (image->ni->mft_no <= LAST_METADATA_INODE) + return; + + if (a->type == AT_FILE_NAME) + WIPE_TIMESTAMPS(FILE_NAME_ATTR, a); + + else if (a->type == AT_STANDARD_INFORMATION) + WIPE_TIMESTAMPS(STANDARD_INFORMATION, a); +} + +void wipe_resident_data(ntfs_walk_clusters_ctx *image) +{ + ATTR_RECORD *a; + int i, n = 0; + char *p; + + a = image->ctx->attr; + p = (char *)a + a->value_offset; + + if (image->ni->mft_no <= LAST_METADATA_INODE) + return; + + if (a->type != AT_DATA) + return; + + for (i = 0; i < a->value_length; i++) { + if (p[i]) { + p[i] = 0; + n++; + } + } + + wiped_resident_data += n; +} + +void walk_runs(struct ntfs_walk_cluster *walk) +{ + int i, j; + runlist *rl; + ATTR_RECORD *a; + ntfs_attr_search_ctx *ctx; + + ctx = walk->image->ctx; + a = ctx->attr; + + if (!a->non_resident) { + if (wipe) { + wipe_resident_data(walk->image); + wipe_timestamps(walk->image); + } + return; + } + + if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) + perr_exit("ntfs_decompress_mapping_pairs"); + + for (i = 0; rl[i].length; i++) { + s64 lcn = rl[i].lcn; + s64 lcn_length = rl[i].length; + + if (lcn == LCN_HOLE || lcn == LCN_RL_NOT_MAPPED) + continue; + + /* FIXME: ntfs_mapping_pairs_decompress should return error */ + if (lcn < 0 || lcn_length < 0) + err_exit("Corrupt runlist in inode %lld attr %x LCN " + "%llx length %llx\n", ctx->ntfs_ino->mft_no, + le32_to_cpu (a->type), lcn, lcn_length); + + if (!wipe) + dump_clusters(walk->image, rl + i); + + for (j = 0; j < lcn_length; j++) { + u64 k = (u64)lcn + j; + if (ntfs_bit_get_and_set(lcn_bitmap.bm, k, 1)) + err_exit("Cluster %lu referenced twice!\n" + "You didn't shutdown your Windows" + "properly?\n", k); + } + + walk->image->inuse += lcn_length; + } + + free(rl); +} + + +void walk_attributes(struct ntfs_walk_cluster *walk) +{ + ntfs_attr_search_ctx *ctx; + + if (!(ctx = ntfs_attr_get_search_ctx(walk->image->ni, NULL))) + perr_exit("ntfs_get_attr_search_ctx"); + + while (!ntfs_attrs_walk(ctx)) { + if (ctx->attr->type == AT_END) + break; + + walk->image->ctx = ctx; + walk_runs(walk); + } + + ntfs_attr_put_search_ctx(ctx); +} + + + +void compare_bitmaps(struct bitmap *a) +{ + s64 i, pos, count; + int mismatch = 0; + u8 bm[NTFS_BUF_SIZE]; + + Printf("Accounting clusters ...\n"); + + pos = 0; + while (1) { + count = ntfs_attr_pread(vol->lcnbmp_na, pos, NTFS_BUF_SIZE, bm); + if (count == -1) + perr_exit("Couldn't get $Bitmap $DATA"); + + if (count == 0) { + if (a->size != pos) + err_exit("$Bitmap file size doesn't match " + "calculated size (%Ld != %Ld)\n", + a->size, pos); + break; + } + + for (i = 0; i < count; i++, pos++) { + u64 cl; /* current cluster */ + + if (a->bm[pos] == bm[i]) + continue; + + for (cl = pos * 8; cl < (pos + 1) * 8; cl++) { + char bit; + + bit = ntfs_bit_get(a->bm, cl); + if (bit == ntfs_bit_get(bm, i * 8 + cl % 8)) + continue; + + if (++mismatch > 10) + continue; + + Printf("Cluster accounting failed at %Lu " + "(0x%Lx): %s cluster in $Bitmap\n", + cl, cl, bit ? "missing" : "extra"); + } + } + } + + if (mismatch) { + Printf("Totally %d cluster accounting mismatches.\n", + mismatch); + err_exit("Filesystem check failed! Windows wasn't shutdown " + "properly or inconsistent\nfilesystem. Please run " + "chkdsk on Windows.\n"); + } +} + + +void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) +{ + p->start = start; + p->stop = stop; + p->unit = 100.0 / (stop - start); + p->resolution = res; +} + + +void progress_update(struct progress_bar *p, u64 current) +{ + float percent = p->unit * current; + + if (current != p->stop) { + if ((current - p->start) % p->resolution) + return; + Printf("%6.2f percent completed\r", percent); + } else + Printf("100.00 percent completed\n"); + fflush(msg_out); +} + +int wipe_data(char *p, int pos, int len) +{ + int wiped = 0; + + p += pos; + for (; len > 0; len--) { + if (p[len]) { + p[len] = 0; + wiped++; + } + } + + return wiped; +} + +void wipe_unused_mft_data(ntfs_inode *ni) +{ + int unused; + MFT_RECORD *m = ni->mrec; + + /* FIXME: MFTMirr update is broken in libntfs */ + if (ni->mft_no <= LAST_METADATA_INODE) + return; + + unused = m->bytes_allocated - m->bytes_in_use; + wiped_unused_mft_data += wipe_data((char *)m, m->bytes_in_use, unused); +} + +void wipe_unused_mft(ntfs_inode *ni) +{ + int unused; + MFT_RECORD *m = ni->mrec; + + /* FIXME: MFTMirr update is broken in libntfs */ + if (ni->mft_no <= LAST_METADATA_INODE) + return; + + /* MFT_RECORD doesn't have the XP specific 6 bytes, so add it */ + unused = m->bytes_in_use - (sizeof(MFT_RECORD) + 6); + wiped_unused_mft += wipe_data((char *)m, sizeof(MFT_RECORD), unused); +} + + +int walk_clusters(ntfs_volume *vol, struct ntfs_walk_cluster *walk) +{ + s64 inode = 0; + s64 last_mft_rec; + ntfs_inode *ni; + struct progress_bar progress; + + Printf("Scanning volume ...\n"); + + last_mft_rec = vol->nr_mft_records - 1; + progress_init(&progress, inode, last_mft_rec, 100); + + for (; inode <= last_mft_rec; inode++) { + + int err, deleted_inode; + MFT_REF mref = (MFT_REF)inode; + + progress_update(&progress, inode); + + /* FIXME: Terribe kludge for libntfs not being able to return + a deleted MFT record as inode */ + ni = (ntfs_inode*)calloc(1, sizeof(ntfs_inode)); + if (!ni) + perr_exit("walk_clusters"); + + ni->vol = vol; + + err = ntfs_file_record_read(vol, mref, &ni->mrec, NULL); + if (err == -1) { + free(ni); + continue; + } + + deleted_inode = !(ni->mrec->flags & MFT_RECORD_IN_USE); + + if (deleted_inode) { + + ni->mft_no = MREF(mref); + if (wipe) { + wipe_unused_mft(ni); + wipe_unused_mft_data(ni); + if (ntfs_mft_record_write(vol, ni->mft_no, ni->mrec)) + perr_exit("ntfs_mft_record_write"); + } + } + + if (ni->mrec) + free(ni->mrec); + free(ni); + + if (deleted_inode) + continue; + + if ((ni = ntfs_inode_open(vol, mref)) == NULL) { + /* FIXME: continue only if it make sense, e.g. + MFT record not in use based on $MFT bitmap */ + if (errno == EIO || errno == ENOENT) + continue; + perr_exit("Reading inode %lld failed", inode); + } + + if (wipe) + nr_used_mft_records++; + + if ((ni->mrec->base_mft_record) != 0) + goto out; + + walk->image->ni = ni; + walk_attributes(walk); +out: + if (wipe) { + wipe_unused_mft_data(ni); + if (ntfs_mft_record_write(vol, ni->mft_no, ni->mrec)) + perr_exit("ntfs_mft_record_write"); + } + + if (ntfs_inode_close(ni)) + perr_exit("ntfs_inode_close for inode %Ld", inode); + } + + return 0; +} + + +/* + * $Bitmap can overlap the end of the volume. Any bits in this region + * must be set. This region also encompasses the backup boot sector. + */ +void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) +{ + for (; cluster < bm->size << 3; cluster++) + ntfs_bit_set(bm->bm, (u64)cluster, 1); +} + + +/* + * Allocate a block of memory with one bit for each cluster of the disk. + * All the bits are set to 0, except those representing the region beyond the + * end of the disk. + */ +void setup_lcn_bitmap() +{ + /* Determine lcn bitmap byte size and allocate it. */ + lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); + + if (!(lcn_bitmap.bm = (unsigned char *)calloc(1, lcn_bitmap.size))) + perr_exit("Failed to allocate internal buffer"); + + bitmap_file_data_fixup(vol->nr_clusters, &lcn_bitmap); +} + + +s64 volume_size(ntfs_volume *vol, s64 nr_clusters) +{ + return nr_clusters * vol->cluster_size; +} + + +void print_volume_size(char *str, s64 bytes) +{ + Printf("%s: %lld bytes (%lld MB)\n", + str, bytes, rounded_up_division(bytes, NTFS_MBYTE)); +} + + +void print_disk_usage(ntfs_walk_clusters_ctx *image) +{ + s64 total, used, free; + + total = vol->nr_clusters * vol->cluster_size; + used = image->inuse * vol->cluster_size; + free = total - used; + + Printf("Space in use : %lld MB (%.1f%%) ", + rounded_up_division(used, NTFS_MBYTE), + 100.0 * ((float)used / total)); + + Printf("\n"); +} + +/** + * First perform some checks to determine if the volume is already mounted, or + * is dirty (Windows wasn't shutdown properly). If everything is OK, then mount + * the volume (load the metadata into memory). + */ +void mount_volume(unsigned long new_mntflag) +{ + unsigned long mntflag; + + if (ntfs_check_if_mounted(opt.volume, &mntflag)) + perr_exit("Failed to check '%s' mount state", opt.volume); + + if (mntflag & NTFS_MF_MOUNTED) { + if (!(mntflag & NTFS_MF_READONLY)) + err_exit("Device %s is mounted read-write. " + "You must 'umount' it first.\n", opt.volume); + if (!new_mntflag) + err_exit("Device %s is mounted. " + "You must 'umount' it first.\n", opt.volume); + } + + if (!(vol = ntfs_mount(opt.volume, new_mntflag))) { + + int err = errno; + + perr_printf("ntfs_mount failed"); + if (err == EINVAL) { + Printf("Apparently device '%s' doesn't have a " + "valid NTFS. Maybe you selected\nthe whole " + "disk instead of a partition (e.g. /dev/hda, " + "not /dev/hda1)?\n", opt.volume); + } + exit(1); + } + + if (vol->flags & VOLUME_IS_DIRTY) + if (opt.force-- <= 0) + err_exit("Volume is dirty. Run chkdsk and " + "please try again (or see -f option).\n"); + + if (NTFS_MAX_CLUSTER_SIZE < vol->cluster_size) + err_exit("Cluster size %u is too large!\n", vol->cluster_size); + + Printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); + if (ntfs_version_is_supported(vol)) + perr_exit("Unknown NTFS version"); + + Printf("Cluster size : %u bytes\n", vol->cluster_size); + print_volume_size("Current volume size", + volume_size(vol, vol->nr_clusters)); +} + +struct ntfs_walk_cluster backup_clusters = { NULL, NULL }; + + +int main(int argc, char **argv) +{ + ntfs_walk_clusters_ctx image; + s64 device_size; /* in bytes */ + int flags, wiped_total = 0; + + /* print to stderr, stdout can be an NTFS image ... */ + Eprintf("%s v%s\n", EXEC_NAME, VERSION); + msg_out = stderr; + + parse_options(argc, argv); + + utils_set_locale(); + + mount_volume(MS_RDONLY); + + device_size = ntfs_device_size_get(vol->dev, vol->sector_size); + device_size *= vol->sector_size; + if (device_size <= 0) + err_exit("Couldn't get device size (%Ld)!\n", device_size); + + print_volume_size("Current device size", device_size); + + if (device_size < vol->nr_clusters * vol->cluster_size) + err_exit("Current NTFS volume size is bigger than the device " + "size (%Ld)!\nCorrupt partition table or incorrect " + "device partitioning?\n", device_size); + + if (opt.stdout) { + if ((fd_out = fileno(stdout)) == -1) + perr_exit("fileno for stdout failed"); + } else { + flags = O_CREAT | O_TRUNC | O_WRONLY; + if (!opt.overwrite) + flags |= O_EXCL; + + if ((fd_out = open(opt.output, flags, S_IRWXU)) == -1) + perr_exit("opening file '%s' failed", opt.output); + + if (ftruncate(fd_out, device_size) == -1) + perr_exit("ftruncate failed for file '%s'", opt.output); + } + + setup_lcn_bitmap(); + memset(&image, 0, sizeof(image)); + backup_clusters.image = ℑ + + walk_clusters(vol, &backup_clusters); + compare_bitmaps(&lcn_bitmap); + print_disk_usage(&image); + + free(lcn_bitmap.bm); + + /* FIXME: save backup boot sector */ + + if (opt.stdout) { + dump_to_stdout(); + fsync(fd_out); + exit(0); + } + + Printf("Syncing image file ...\n"); + if (fsync(fd_out) == -1) + perr_exit("fsync"); + + if (!opt.metadata_only) + exit(0); + + wipe = 1; + opt.volume = opt.output; + mount_volume(0); + + setup_lcn_bitmap(); + memset(&image, 0, sizeof(image)); + backup_clusters.image = ℑ + + walk_clusters(vol, &backup_clusters); + + Printf("Num of MFT records = %8Ld\n", vol->nr_mft_records); + Printf("Num of used MFT records = %8d\n", nr_used_mft_records); + + Printf("Wiped unused MFT data = %8d\n", wiped_unused_mft_data); + Printf("Wiped deleted MFT data = %8d\n", wiped_unused_mft); + Printf("Wiped resident user data = %8d\n", wiped_resident_data); + Printf("Wiped timestamp data = %8d\n", wiped_timestamp_data); + + wiped_total += wiped_unused_mft_data; + wiped_total += wiped_unused_mft; + wiped_total += wiped_resident_data; + wiped_total += wiped_timestamp_data; + Printf("Wiped totally = %8d\n", wiped_total); + + exit(0); +} + From bbede46c0b6ea0b6f411a52ee29fa854f307277b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 12:29:04 +0000 Subject: [PATCH 0568/2994] Delete: acconfig.h }(Logical change 1.141) --- acconfig.h | 1 - 1 file changed, 1 deletion(-) delete mode 100644 acconfig.h diff --git a/acconfig.h b/acconfig.h deleted file mode 100644 index 8b137891..00000000 --- a/acconfig.h +++ /dev/null @@ -1 +0,0 @@ - From d1708bbea23ad52039c5dbd8570c0edadb46b2f5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 12:29:04 +0000 Subject: [PATCH 0569/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/06/03 13:28:39+01:00 cantab.net!aia21 Remove obsolete make process file. BKrev: 3edc9490_lVsQWXZhqQB8RNI8WJrEQ From 5c2ff2283b694173db2bf86dc5088b19e5195420 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 12:37:21 +0000 Subject: [PATCH 0570/2994] Bump LTVERSION by one because the library interfaces have changed. (Logical change 1.142) --- libntfs/Makefile.am | 2 +- libntfs/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 9fa298cf..a26d04d9 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -25,7 +25,7 @@ # - If the interface is the same as the previous version, change to C:R+1:A # -LTVERSION = 4:0:0 +LTVERSION = 5:0:0 # Later gcc require -fms-extensions to work. if GCC_NEEDS_MS_EXTENSIONS diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index f6e43a08..fa5b8574 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -120,7 +120,7 @@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ -LTVERSION = 4:0:0 +LTVERSION = 5:0:0 # Later gcc require -fms-extensions to work. @GCC_NEEDS_MS_EXTENSIONS_TRUE@GCCflag = -fms-extensions From eb26fb6aeb678e31044e1e4c4bbc50f10cca0c23 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 12:37:21 +0000 Subject: [PATCH 0571/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/06/03 13:37:01+01:00 cantab.net!aia21 Bump LTVERSION by one because the library interfaces have changed. BKrev: 3edc9681Q8tTjk-DFV0YCbnmwoCDTg From 207a314faba52964cee7ae2efb185f761700fe15 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 12:38:57 +0000 Subject: [PATCH 0572/2994] Update. (Logical change 1.143) --- Makefile.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 40a5104e..ff5aeb94 100644 --- a/Makefile.in +++ b/Makefile.in @@ -113,9 +113,9 @@ RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ - Makefile.in NEWS acconfig.h aclocal.m4 config.guess config.h.in \ - config.sub configure configure.ac depcomp install-sh ltconfig \ - ltmain.sh missing mkinstalldirs ntfsprogs.spec.in + Makefile.in NEWS aclocal.m4 config.guess config.h.in config.sub \ + configure configure.ac depcomp install-sh ltconfig ltmain.sh \ + missing mkinstalldirs ntfsprogs.spec.in DIST_SUBDIRS = $(SUBDIRS) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -148,7 +148,7 @@ stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.ac $(ACLOCAL_M4) $(top_srcdir)/acconfig.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) touch $(srcdir)/config.h.in From 6a48a5fdf2ac9bba4fdf5932b4384610d29d01eb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 3 Jun 2003 12:38:57 +0000 Subject: [PATCH 0573/2994] Update. BKrev: 3edc96e1Iqbx74tAzdX8lMY0oExx8g From d921c961ad646ae0dc83c241bb56f8f2ffd662d1 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 5 Jun 2003 21:41:46 +0000 Subject: [PATCH 0574/2994] Initial revision --- BitKeeper/triggers/post-incoming.testing | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 BitKeeper/triggers/post-incoming.testing diff --git a/BitKeeper/triggers/post-incoming.testing b/BitKeeper/triggers/post-incoming.testing new file mode 100644 index 00000000..e69de29b From 26fa8ed65782019c4cad618e96b3905d371a622a Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 5 Jun 2003 21:41:46 +0000 Subject: [PATCH 0575/2994] Change mode to -rwxr-xr-x 2003/06/05 22:39:15+01:00 flatcap.org!flatcap (Logical change 1.144) --- BitKeeper/triggers/post-incoming.testing | 61 ++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/BitKeeper/triggers/post-incoming.testing b/BitKeeper/triggers/post-incoming.testing index e69de29b..054a1105 100644 --- a/BitKeeper/triggers/post-incoming.testing +++ b/BitKeeper/triggers/post-incoming.testing @@ -0,0 +1,61 @@ +#!/bin/sh + +# Display info about incoming and outgoing csets. + +if [ X$BK_STATUS = XDRYRUN -o X$BK_STATUS = XNOTHING ] +then exit 0 +fi +if [ $BK_SIDE = server ] +then U=$BKD_USER + H=$BKD_HOST + R=$BKD_ROOT +else U=$BK_USER + H=$BK_HOST + R=$BK_ROOT +fi +( +if [ X$BKD_ROOT != X ] +then printf '%-10s%-20s%-20s\n' VAR CLIENT SERVER + printf '%-10s%-20s%-20s\n' === ====== ====== + printf '%-10s%-20s%-20s\n' USER $BK_USER $BKD_USER + printf '%-10s%-20s%-20s\n' HOST $BK_HOST $BKD_HOST + printf '%-10s%-20s%-20s\n' ROOT $BK_ROOT $BKD_ROOT + printf '%-10s%-20s%-20s\n' LEVEL $BK_LEVEL $BKD_LEVEL + printf '%-10s%-20s%-20s\n' TIME_T $BK_TIME_T $BKD_TIME_T + printf '%-10s%-20s%-20s\n' UTC $BK_UTC $BKD_UTC + printf '%-10s%-20s%-20s\n' VERSION $BK_VERSION $BKD_VERSION + echo +fi +echo ${U}@${H} fired the $BK_TRIGGER trigger in $R +case $BK_TRIGGER in + pre-outgoing) VERB=Sending;; + post-outgoing) VERB=Sent;; + pre-incoming) VERB=Receiving;; + post-incoming) VERB=Received;; + pre-resolve) VERB=Resolving;; + pre-commit) VERB=Committing;; + post-commit) VERB=Committed;; + pre-apply) VERB=Applying;; +esac +if [ X$BK_PENDING != X ] +then ( + echo $VERB the following deltas + echo + bk prs - < $BK_PENDING + ) | sed 's/^/ /' +fi +if [ X$BK_CSETLIST != X ] +then ( + echo $VERB the following changesets + echo + bk changes -v - < $BK_CSETLIST + ) | sed 's/^/ /' +fi +if [ X$BK_CSETS != X ] +then ( + echo $VERB the following changesets + echo + bk changes -v -r$BK_CSETS + ) | sed 's/^/ /' +fi +) | mail -s "$BK_EVENT in ${H}:${R}" leonard.norrgard@pp.inet.fi From 07795f1f22b01062d0b90723d18ed4fb9db204e3 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 5 Jun 2003 21:41:46 +0000 Subject: [PATCH 0576/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs-devel into flatcap.org:/mnt/work/bk/ntfsprogs-devel 2003/06/05 22:41:13+01:00 flatcap.org!flatcap Leonard's checkin trigger BKrev: 3edfb91aFh-yIHmNqAMLoB8evNPNkg From 64c7352a24855e9e6b200f54b7775ba85a37d07a Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 5 Jun 2003 21:44:59 +0000 Subject: [PATCH 0577/2994] Change mode to -rwxrwxr-x (Logical change 1.145) From a1d7f81ced0614db0cecf750497828495c3d4112 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 5 Jun 2003 21:44:59 +0000 Subject: [PATCH 0578/2994] changed perms slightly BKrev: 3edfb9dbvBH2DtbS3Mt-g7lqyPnyRQ From 3c256015a216f200af4a88d81ef63b25cc2fb7db Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 5 Jun 2003 21:56:18 +0000 Subject: [PATCH 0579/2994] token change to test a trigger (Logical change 1.146) --- TODO.ntfsprogs | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index f40f94aa..754e203a 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -69,6 +69,7 @@ Low priority - support for compressed files - support for internationalisation - recover by type? +- mass undelete (using wildcards) - display parent directory - name "" to MFTn From ad5158a2f9e97642db422c473d984a8cc7af65d4 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 5 Jun 2003 21:56:18 +0000 Subject: [PATCH 0580/2994] token change to test a trigger BKrev: 3edfbc82fKCFWEMmwTxCf6IvC-aFcw From 8d6e8b9b0d6a345778e26acb7ea6b01502e1bb8f Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 6 Jun 2003 16:53:35 +0000 Subject: [PATCH 0581/2994] Initial revision --- BitKeeper/triggers/post-outgoing.ciabot | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 BitKeeper/triggers/post-outgoing.ciabot diff --git a/BitKeeper/triggers/post-outgoing.ciabot b/BitKeeper/triggers/post-outgoing.ciabot new file mode 100644 index 00000000..e69de29b From 74ff0320cdfd121ffa53b76269d0aca3ab9483ee Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 6 Jun 2003 16:53:35 +0000 Subject: [PATCH 0582/2994] Change mode to -rwxrwxr-x 2003/06/06 17:53:14+01:00 flatcap.org!flatcap (Logical change 1.147) --- BitKeeper/triggers/post-outgoing.ciabot | 97 +++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/BitKeeper/triggers/post-outgoing.ciabot b/BitKeeper/triggers/post-outgoing.ciabot index e69de29b..4d23a0f9 100644 --- a/BitKeeper/triggers/post-outgoing.ciabot +++ b/BitKeeper/triggers/post-outgoing.ciabot @@ -0,0 +1,97 @@ +#!/bin/sh +# +# post-outgoing -- catch and format BitKeeper repository events and mail them to the CIA bot. +# +# Copyright (C) 2003 Leonard Norrgard +# +# 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 of the License, 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. +######################################################################### + +# Submit bkbits.net repository changes to the CIA bot, who in turn +# forwards the messages to #commits on IRC and a project IRC channel, +# as configured below. If your project isn't on bkbits.net, you may need to +# make several changes in the script itself. See "bk help triggers" for the +# basic documentation to how this works. There's a trick: bkbits.net don't +# have triggers enabled, +# +# It tries to makes sure that only pushes to public repositories get broadcasted. +# +# 1) Edit the channel setting below. +# 2) Put this script in a file named post-outgoing.ciabot in +# BitKeeper/triggers/pre-apply.ciabot in your project. +# 3) Check it into your repository on bkbits.net +# 4) The next time anyone pulls the project, they'll get the script. +# From then on, BitKeeper does the rest. +# 4) ? +# 5) Profit! :^) + +# --- begin config section --- +# +# Note: irc network name ignored for now, but must be included. +# What you say here end up as a prefix on each row of your logs +# on #commits. You must use the name of your projects IRC channel in +# order to have the invite the bot there. +# +# example: +# IRCCHANNEL=irc.freenode.net/ourprojectchannel +IRCCHANNEL=irc.freenode.net/ntfs + +# The email address where we send the commit messages. +#COMMITADDRESS=commits@picogui.org +COMMITADDRESS=leonard.norrgard@pp.inet.fi + +# +# --- end config section --- +# +###################################################################### + +if [ X$BK_STATUS = XDRYRUN -o X$BK_STATUS = XNOTHING ] +then exit 0 +fi + +# In order to make sure only pushes to public BitKeeper repositories +# are broadcasted to #commits, we check that a) the parent repository +# is on bkbits.net and b) we are the client. + +# Is parent a public BitKeeper repository at bkbits.net? +if [ -z "`bk parent|grep bkbits.net/`" ] +then exit 0 +fi + +if [ $BK_SIDE != client ] +then exit 0 +fi + +# Display info about incoming and outgoing csets. + +U=$BK_USER +H=$BK_HOST +R=$BK_ROOT + +( +U_OUT="user={light blue}${U}@${H}{normal}" +R_OUT=`echo $R | sed "s,.*/,,"` + +echo repository={green}${R_OUT}{normal} $U_OUT + +# See "bk help prs" for documentation on the formatting string. +if [ X$BK_CSETLIST != X ] +then ( + bk changes -v -d'$if(:GFILE:=ChangeSet){{orange}ChangeSet@:REV:{normal} tags=$if(:TAG:){{red}:TAG:{normal}} $if(:C:){:C:}\n}$unless(:GFILE:=ChangeSet){* :GFILE:$if(:C:){: $each(:C:){(:C:)}}\n}' - < $BK_CSETLIST + ) +fi +) | mail -s "Announce `echo -n $IRCCHANNEL | sed 's,.*/,,'`" $COMMITADDRESS +exit 0 From 4ff28c5d7fdfa87f9700abf53e6a6be0b1cb89ff Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 6 Jun 2003 16:53:35 +0000 Subject: [PATCH 0583/2994] post-outgoing.ciabot: Change mode to -rwxrwxr-x new file BKrev: 3ee0c70fVioM0QPh4S5x68KKnZ_5bw From 7e8d8ab0d3ec7d483a85c860f0e2ca94a142618e Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 6 Jun 2003 17:37:58 +0000 Subject: [PATCH 0584/2994] .del-post-incoming.testing~85f0ca2656c104e3: Delete: BitKeeper/triggers/post-incoming.testing BKrev: 3ee0d176gSLmBoILNig_OZ7Yanl_3A From 6fbac539bd5e78951bd2b8b5aec736a869ee6cbc Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 6 Jun 2003 17:37:58 +0000 Subject: [PATCH 0585/2994] Delete: BitKeeper/triggers/post-incoming.testing }(Logical change 1.148) --- BitKeeper/triggers/post-incoming.testing | 61 ------------------------ 1 file changed, 61 deletions(-) delete mode 100644 BitKeeper/triggers/post-incoming.testing diff --git a/BitKeeper/triggers/post-incoming.testing b/BitKeeper/triggers/post-incoming.testing deleted file mode 100644 index 054a1105..00000000 --- a/BitKeeper/triggers/post-incoming.testing +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -# Display info about incoming and outgoing csets. - -if [ X$BK_STATUS = XDRYRUN -o X$BK_STATUS = XNOTHING ] -then exit 0 -fi -if [ $BK_SIDE = server ] -then U=$BKD_USER - H=$BKD_HOST - R=$BKD_ROOT -else U=$BK_USER - H=$BK_HOST - R=$BK_ROOT -fi -( -if [ X$BKD_ROOT != X ] -then printf '%-10s%-20s%-20s\n' VAR CLIENT SERVER - printf '%-10s%-20s%-20s\n' === ====== ====== - printf '%-10s%-20s%-20s\n' USER $BK_USER $BKD_USER - printf '%-10s%-20s%-20s\n' HOST $BK_HOST $BKD_HOST - printf '%-10s%-20s%-20s\n' ROOT $BK_ROOT $BKD_ROOT - printf '%-10s%-20s%-20s\n' LEVEL $BK_LEVEL $BKD_LEVEL - printf '%-10s%-20s%-20s\n' TIME_T $BK_TIME_T $BKD_TIME_T - printf '%-10s%-20s%-20s\n' UTC $BK_UTC $BKD_UTC - printf '%-10s%-20s%-20s\n' VERSION $BK_VERSION $BKD_VERSION - echo -fi -echo ${U}@${H} fired the $BK_TRIGGER trigger in $R -case $BK_TRIGGER in - pre-outgoing) VERB=Sending;; - post-outgoing) VERB=Sent;; - pre-incoming) VERB=Receiving;; - post-incoming) VERB=Received;; - pre-resolve) VERB=Resolving;; - pre-commit) VERB=Committing;; - post-commit) VERB=Committed;; - pre-apply) VERB=Applying;; -esac -if [ X$BK_PENDING != X ] -then ( - echo $VERB the following deltas - echo - bk prs - < $BK_PENDING - ) | sed 's/^/ /' -fi -if [ X$BK_CSETLIST != X ] -then ( - echo $VERB the following changesets - echo - bk changes -v - < $BK_CSETLIST - ) | sed 's/^/ /' -fi -if [ X$BK_CSETS != X ] -then ( - echo $VERB the following changesets - echo - bk changes -v -r$BK_CSETS - ) | sed 's/^/ /' -fi -) | mail -s "$BK_EVENT in ${H}:${R}" leonard.norrgard@pp.inet.fi From 98b83eea2bd0320278b6c9e75f2f22136bd2b3c9 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sat, 7 Jun 2003 17:25:30 +0000 Subject: [PATCH 0586/2994] eveything's in place.. (Logical change 1.149) --- BitKeeper/triggers/post-outgoing.ciabot | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BitKeeper/triggers/post-outgoing.ciabot b/BitKeeper/triggers/post-outgoing.ciabot index 4d23a0f9..8fc70c1d 100644 --- a/BitKeeper/triggers/post-outgoing.ciabot +++ b/BitKeeper/triggers/post-outgoing.ciabot @@ -50,8 +50,7 @@ IRCCHANNEL=irc.freenode.net/ntfs # The email address where we send the commit messages. -#COMMITADDRESS=commits@picogui.org -COMMITADDRESS=leonard.norrgard@pp.inet.fi +COMMITADDRESS=commits@picogui.org # # --- end config section --- From 589e274b2c7229401ecbc5490cad95bffefa343a Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sat, 7 Jun 2003 17:25:30 +0000 Subject: [PATCH 0587/2994] eveything's in place.. BKrev: 3ee2200ak0iQY1s6_NlLluRFKJonEg From 302c6272706210dc80dc96bc8ec33946b45c7eb8 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sat, 7 Jun 2003 17:30:03 +0000 Subject: [PATCH 0588/2994] A few typos - thanks to Pete Ware for spotting them (Logical change 1.150) --- ntfsprogs/ntfsundelete.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 6df3c606..1b686d62 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -947,9 +947,9 @@ void dump_record (struct ufile *file) if (f->flags & FILE_ATTR_REPARSE_POINT) Qprintf ("Reparse "); if (f->flags & FILE_ATTR_COMPRESSED) Qprintf ("Compressed "); if (f->flags & FILE_ATTR_ENCRYPTED) Qprintf ("Encrypted "); - if (!(f->flags & (FILE_ATTR_SYSTEM || FILE_ATTR_DIRECTORY || - FILE_ATTR_SPARSE_FILE || FILE_ATTR_REPARSE_POINT || - FILE_ATTR_COMPRESSED || FILE_ATTR_ENCRYPTED))) { + if (!(f->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_DIRECTORY | + FILE_ATTR_SPARSE_FILE | FILE_ATTR_REPARSE_POINT | + FILE_ATTR_COMPRESSED | FILE_ATTR_ENCRYPTED))) { Qprintf (NONE); } Qprintf ("\n"); From a7f036134bf68ca069435af70997fe1e286b9c19 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sat, 7 Jun 2003 17:30:03 +0000 Subject: [PATCH 0589/2994] A few typos - thanks to Pete Ware for spotting them BKrev: 3ee2211broHJbEoQMwE35Zwf3QJ8Dw From 05befe33eb999f381881316ed54ceac618fc9c86 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 11 Jul 2003 12:35:05 +0000 Subject: [PATCH 0590/2994] ntfsclone patch from Szaka: This fixes all known issues I knew about or wanted to add to ntfsclone. So it's declared ready and basically works for me for half a year. Future work is only based on requests/needs. I only want to write the manual, if ever have time. Changes: - support block device as output file - handle partial read/write - show progress bar during cloning - significant cloning performance improvement - detect ReiserFS & warn about its extremely poor ftruncate performance - no error if fsync() gives EINVAL (pipe) - several sanity checks added - some cleanup, spelling corrections (Logical change 1.151) --- ntfsprogs/ntfsclone.c | 272 ++++++++++++++++++++++++++++++------------ 1 file changed, 193 insertions(+), 79 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 40c8116c..31ca6533 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -3,7 +3,7 @@ * * Copyright (c) 2003 Szabolcs Szakacsits * - * ntfsclone clones NTFS data and/or metadata to a sparse file or stdout. + * Clone NTFS data and/or metadata to a sparse file, device or stdout. * * 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 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ struct { int force; int overwrite; int stdout; + int blkdev_out; /* output file is block device */ int metadata_only; char *output; char *volume; @@ -104,6 +106,9 @@ int wiped_timestamp_data = 0; #define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) +#define read_all(f, p, n) io_all((f), (p), (n), 0) +#define write_all(f, p, n) io_all((f), (p), (n), 1) + GEN_PRINTF(Eprintf, stderr, NULL, FALSE) GEN_PRINTF(Vprintf, msg_out, &opt.verbose, TRUE) GEN_PRINTF(Qprintf, msg_out, &opt.quiet, FALSE) @@ -165,15 +170,15 @@ int perr_exit(const char *fmt, ...) void usage() { Eprintf("\nUsage: %s [options] device\n" - " Clone NTFS data to a sparse file or send it to stdout.\n" + " Efficiently clone NTFS to a sparse file, device or stdandard output.\n" "\n" - " -o FILE --output FILE Clone NTFS to the non-existent FILE\n" - " -O FILE Clone NTFS to FILE, overwriting if exists\n" - " -m --metadata Clone *only* metadata (for NTFS experts)\n" - " -f --force Force to progress (DANGEROUS)\n" - " -h --help Display this help\n" + " -o FILE --output FILE Clone NTFS to the non-existent FILE\n" + " -O FILE --overwrite FILE Clone NTFS to FILE, overwriting if exists\n" + " -m --metadata Clone *only* metadata (for NTFS experts)\n" + " -f --force Force to progress (DANGEROUS)\n" + " -h --help Display this help\n" #ifdef DEBUG - " -d --debug Show debug information\n" + " -d --debug Show debug information\n" #endif "\n" " If FILE is '-' then send NTFS data to stdout replacing non used\n" @@ -195,6 +200,7 @@ void parse_options(int argc, char **argv) { "help", no_argument, NULL, 'h' }, { "metadata", no_argument, NULL, 'm' }, { "output", required_argument, NULL, 'o' }, + { "overwrite", required_argument, NULL, 'O' }, { NULL, 0, NULL, 0 } }; @@ -248,8 +254,29 @@ void parse_options(int argc, char **argv) } if (opt.metadata_only && opt.stdout) - err_exit("Cloning only metadata to stdout isn't supported yet!\n"); - + err_exit("Cloning only metadata to stdout isn't supported!\n"); + + if (!opt.stdout) { + struct stat st; + + if (stat(opt.output, &st) == -1) { + if (errno != ENOENT) + perr_exit("Couldn't access '%s'", opt.output); + } else { + if (!opt.overwrite) + err_exit("Output file '%s' already exists.\n" + "Use option --overwrite if you want to" + " replace its content.\n", opt.output); + + if (S_ISBLK(st.st_mode)) { + opt.blkdev_out = 1; + if (opt.metadata_only) + err_exit("Cloning only metadata to a " + "block device isn't supported!\n"); + } + } + } + msg_out = stdout; /* FIXME: this is a workaround for loosing debug info if stdout != stderr @@ -263,6 +290,27 @@ void parse_options(int argc, char **argv) perr_exit("Couldn't open /dev/null"); } +void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) +{ + p->start = start; + p->stop = stop; + p->unit = 100.0 / (stop - start); + p->resolution = res; +} + + +void progress_update(struct progress_bar *p, u64 current) +{ + float percent = p->unit * current; + + if (current != p->stop) { + if ((current - p->start) % p->resolution) + return; + Printf("%6.2f percent completed\r", percent); + } else + Printf("100.00 percent completed\n"); + fflush(msg_out); +} /** * nr_clusters_to_bitmap_byte_size @@ -283,7 +331,7 @@ s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) return bm_bsize; } -int is_critical_meatadata(ntfs_walk_clusters_ctx *image) +int is_critical_metadata(ntfs_walk_clusters_ctx *image) { s64 inode; @@ -299,31 +347,38 @@ int is_critical_meatadata(ntfs_walk_clusters_ctx *image) return 0; } -void write_cluster(const char *buff) + +int io_all(void *fd, void *buf, int count, int do_write) { - int count; + int i; + struct ntfs_device *dev = (struct ntfs_device *)fd; - if ((count = write(fd_out, buff, vol->cluster_size)) == -1) - perr_exit("write"); - - if (count != vol->cluster_size) - err_exit("Partial write not yet handled\n"); + while (count > 0) { + if (do_write) + i = write(*(int *)fd, buf, count); + else + i = dev->d_ops->read(dev, buf, count); + if (i < 0) { + if (errno != EAGAIN && errno != EINTR) + return -1; + } else { + count -= i; + buf = i + (char *) buf; + } + } + return 0; } + void copy_cluster() { - int count; char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ - /* FIXME: handle partial read/writes */ - if ((count = vol->dev->d_ops->read(vol->dev, buff, - vol->cluster_size)) == -1) - perr_exit("read"); + if (read_all(vol->dev, buff, vol->cluster_size) == -1) + perr_exit("read_all"); - if (count != vol->cluster_size) - err_exit("Partial read not yet handled\n"); - - write_cluster(buff); + if (write_all(&fd_out, buff, vol->cluster_size) == -1) + perr_exit("write_all"); } void lseek_to_cluster(s64 lcn) @@ -349,7 +404,7 @@ void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) if (opt.stdout) return; - if (opt.metadata_only && !is_critical_meatadata(image)) + if (!opt.metadata_only || !is_critical_metadata(image)) return; lseek_to_cluster(rl->lcn); @@ -359,17 +414,22 @@ void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) copy_cluster(); } -void dump_to_stdout() +void clone_ntfs(u64 nr_clusters) { s64 i, pos, count; u8 bm[NTFS_BUF_SIZE]; - void *buff; + void *buf; + u32 csize = vol->cluster_size; + u64 p_counter = 0; + struct progress_bar progress; - Printf("Dumping NTFS to stdout ...\n"); + Printf("Cloning NTFS ...\n"); - if ((buff = calloc(1, vol->cluster_size)) == NULL) + if ((buf = calloc(1, csize)) == NULL) perr_exit("dump_to_stdout"); + progress_init(&progress, p_counter, nr_clusters, 100); + pos = 0; while (1) { count = ntfs_attr_pread(vol->lcnbmp_na, pos, NTFS_BUF_SIZE, bm); @@ -388,10 +448,17 @@ void dump_to_stdout() return; if (ntfs_bit_get(bm, i * 8 + cl % 8)) { + progress_update(&progress, ++p_counter); lseek_to_cluster(cl); copy_cluster(); - } else - write_cluster(buff); + continue; + } + + if (opt.stdout) { + progress_update(&progress, ++p_counter); + if (write_all(&fd_out, buf, csize) == -1) + perr_exit("write_all"); + } } } } @@ -577,28 +644,6 @@ void compare_bitmaps(struct bitmap *a) } -void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) -{ - p->start = start; - p->stop = stop; - p->unit = 100.0 / (stop - start); - p->resolution = res; -} - - -void progress_update(struct progress_bar *p, u64 current) -{ - float percent = p->unit * current; - - if (current != p->stop) { - if ((current - p->start) % p->resolution) - return; - Printf("%6.2f percent completed\r", percent); - } else - Printf("100.00 percent completed\n"); - fflush(msg_out); -} - int wipe_data(char *p, int pos, int len) { int wiped = 0; @@ -619,7 +664,7 @@ void wipe_unused_mft_data(ntfs_inode *ni) int unused; MFT_RECORD *m = ni->mrec; - /* FIXME: MFTMirr update is broken in libntfs */ + /* FIXME: broken MFTMirr update was fixed in libntfs, check if OK now */ if (ni->mft_no <= LAST_METADATA_INODE) return; @@ -632,7 +677,7 @@ void wipe_unused_mft(ntfs_inode *ni) int unused; MFT_RECORD *m = ni->mrec; - /* FIXME: MFTMirr update is broken in libntfs */ + /* FIXME: broken MFTMirr update was fixed in libntfs, check if OK now */ if (ni->mft_no <= LAST_METADATA_INODE) return; @@ -661,7 +706,7 @@ int walk_clusters(ntfs_volume *vol, struct ntfs_walk_cluster *walk) progress_update(&progress, inode); - /* FIXME: Terribe kludge for libntfs not being able to return + /* FIXME: Terrible kludge for libntfs not being able to return a deleted MFT record as inode */ ni = (ntfs_inode*)calloc(1, sizeof(ntfs_inode)); if (!ni) @@ -769,11 +814,10 @@ void print_volume_size(char *str, s64 bytes) void print_disk_usage(ntfs_walk_clusters_ctx *image) { - s64 total, used, free; + s64 total, used; total = vol->nr_clusters * vol->cluster_size; used = image->inuse * vol->cluster_size; - free = total - used; Printf("Space in use : %lld MB (%.1f%%) ", rounded_up_division(used, NTFS_MBYTE), @@ -836,12 +880,62 @@ void mount_volume(unsigned long new_mntflag) struct ntfs_walk_cluster backup_clusters = { NULL, NULL }; +int device_offset_valid(int fd, s64 ofs) +{ + char ch; + + if (lseek(fd, ofs, SEEK_SET) >= 0 && read(fd, &ch, 1) == 1) + return 0; + return -1; +} + +s64 device_size_get(int fd) +{ + s64 high, low; +#ifdef BLKGETSIZE + long size; + + if (ioctl(fd, BLKGETSIZE, &size) >= 0) { + Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, + size); + return (s64)size * 512; + } +#endif +#ifdef FDGETPRM + { struct floppy_struct this_floppy; + + if (ioctl(fd, FDGETPRM, &this_floppy) >= 0) { + Dprintf("FDGETPRM nr 512 byte blocks = %ld (0x%ld)\n", + this_floppy.size, this_floppy.size); + return (s64)this_floppy.size * 512; + } + } +#endif + /* + * We couldn't figure it out by using a specialized ioctl, + * so do binary search to find the size of the device. + */ + low = 0LL; + for (high = 1024LL; !device_offset_valid(fd, high); high <<= 1) + low = high; + while (low < high - 1LL) { + const s64 mid = (low + high) / 2; + + if (!device_offset_valid(fd, mid)) + low = mid; + else + high = mid; + } + lseek(fd, 0LL, SEEK_SET); + return (low + 1LL); +} + int main(int argc, char **argv) { ntfs_walk_clusters_ctx image; s64 device_size; /* in bytes */ - int flags, wiped_total = 0; + int wiped_total = 0; /* print to stderr, stdout can be an NTFS image ... */ Eprintf("%s v%s\n", EXEC_NAME, VERSION); @@ -853,8 +947,7 @@ int main(int argc, char **argv) mount_volume(MS_RDONLY); - device_size = ntfs_device_size_get(vol->dev, vol->sector_size); - device_size *= vol->sector_size; + device_size = ntfs_device_size_get(vol->dev, 1); if (device_size <= 0) err_exit("Couldn't get device size (%Ld)!\n", device_size); @@ -869,15 +962,39 @@ int main(int argc, char **argv) if ((fd_out = fileno(stdout)) == -1) perr_exit("fileno for stdout failed"); } else { - flags = O_CREAT | O_TRUNC | O_WRONLY; - if (!opt.overwrite) - flags |= O_EXCL; + int flags = O_WRONLY; + + if (!opt.blkdev_out) { + flags |= O_CREAT | O_TRUNC; + if (!opt.overwrite) + flags |= O_EXCL; + } if ((fd_out = open(opt.output, flags, S_IRWXU)) == -1) perr_exit("opening file '%s' failed", opt.output); - if (ftruncate(fd_out, device_size) == -1) - perr_exit("ftruncate failed for file '%s'", opt.output); + if (!opt.blkdev_out) { + struct statfs stfs; + + if (fstatfs(fd_out, &stfs) == -1) + Printf("Couldn't get Linux filesystem type: " + "%s\n", strerror(errno)); + else if (stfs.f_type == 0x52654973) { + Printf("WARNING: You're using ReiserFS, it has " + "very poor performance creating\nlarge " + "sparse files. The next operation " + "might take a very long time!\n" + "Creating sparse output file ...\n"); + } + if (ftruncate(fd_out, device_size) == -1) + perr_exit("ftruncate failed for file '%s'", + opt.output); + } else { + s64 dest_size = device_size_get(fd_out); + if (dest_size < device_size) + err_exit("Output device size (%Ld) is too small" + " to fit an NTFS clone\n", dest_size); + } } setup_lcn_bitmap(); @@ -892,19 +1009,16 @@ int main(int argc, char **argv) /* FIXME: save backup boot sector */ - if (opt.stdout) { - dump_to_stdout(); - fsync(fd_out); + if (opt.stdout || !opt.metadata_only) { + u64 nr_clusters = opt.stdout ? vol->nr_clusters : image.inuse; + + clone_ntfs(nr_clusters); + Printf("Syncing ...\n"); + if (fsync(fd_out) && errno != EINVAL) + perr_exit("fsync"); exit(0); } - Printf("Syncing image file ...\n"); - if (fsync(fd_out) == -1) - perr_exit("fsync"); - - if (!opt.metadata_only) - exit(0); - wipe = 1; opt.volume = opt.output; mount_volume(0); From 622901527f13668b09685d692a5c5703d7a917ef Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 11 Jul 2003 12:35:05 +0000 Subject: [PATCH 0591/2994] ntfsclone patch from Szaka: This fixes all known issues I knew about or wanted to add to ntfsclone. So it's declared ready and basically works for me for half a year. Future work is only based on requests/needs. I only want to write the manual, if ever have time. Changes: - support block device as output file - handle partial read/write - show progress bar during cloning - significant cloning performance improvement - detect ReiserFS & warn about its extremely poor ftruncate performance - no error if fsync() gives EINVAL (pipe) - several sanity checks added - some cleanup, spelling corrections BKrev: 3f0eaef9WUptDWJa7L-xMYco5QF4bQ From 163d414c9f3cdeaeca3f07bb026a726421eec048 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 11 Jul 2003 14:35:49 +0000 Subject: [PATCH 0592/2994] Can't use vol->dev->d_name before it is allocated! D'oh! Thanks to Szaka for reporting this. (Logical change 1.152) --- ntfsprogs/mkntfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 9df41180..2f2571fd 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -123,6 +123,7 @@ runlist *rl = NULL, *rl_mft = NULL, *rl_mft_bmp = NULL, *rl_mftmirr = NULL; runlist *rl_logfile = NULL, *rl_boot = NULL, *rl_bad = NULL, *rl_index; INDEX_ALLOCATION *index_block = NULL; ntfs_volume *vol; +char *dev_name; struct { int sector_size; /* -s, in bytes, power of 2, default is @@ -351,7 +352,7 @@ void parse_options(int argc, char *argv[]) } if (optind == argc) usage(); - vol->dev->d_name = argv[optind++]; + dev_name = argv[optind++]; if (optind < argc) { u = strtoul(argv[optind++], &s, 0); if (*s || !u || (u >= ULONG_MAX && errno == ERANGE)) @@ -2553,7 +2554,7 @@ int main(int argc, char **argv) * Allocate and initialize an ntfs device structure and attach it to * the volume. */ - if (!(vol->dev = ntfs_device_alloc(vol->dev->d_name, 0, + if (!(vol->dev = ntfs_device_alloc(dev_name, 0, &ntfs_device_disk_io_ops, NULL))) err_exit("Could not allocate memory for internal buffer.\n"); /* Open the device for reading or reading and writing. */ From c11d307758b0a905ce222de4c2c20a0e61576676 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 11 Jul 2003 14:35:49 +0000 Subject: [PATCH 0593/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/07/11 15:35:39+01:00 cantab.net!aia21 Can't use vol->dev->d_name before it is allocated! D'oh! Thanks to Szaka for reporting this. BKrev: 3f0ecb45JqUPoTxXdPPT21ldt2-dEQ From 993640ad31deb1d88aa27dc75af58af13af37265 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 12 Jul 2003 15:46:12 +0000 Subject: [PATCH 0594/2994] Fix the O_RDONLY vs O_RDWR check. It was failing because O_RDONLY is zero and hence the old check was always successful. (Logical change 1.153) --- libntfs/disk_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index 113d36e8..7e665e7d 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -174,7 +174,7 @@ static int ntfs_device_disk_io_open(struct ntfs_device *dev, int flags) if (((int)dev->d_private = open(dev->d_name, flags)) == -1) return -1; /* Setup our read-only flag. */ - if ((flags & O_RDONLY) == O_RDONLY) + if ((flags & O_RDWR) != O_RDWR) NDevSetReadOnly(dev); /* Acquire exlusive (mandatory) lock on the whole device. */ memset(&flk, 0, sizeof(flk)); From c6069336f81bfbc8fb253cb8f4ed7cd504b1d91c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 12 Jul 2003 15:46:12 +0000 Subject: [PATCH 0595/2994] Improve the MS_RDONLY check. (Logical change 1.153) --- libntfs/volume.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index 6a5430f4..ca518b45 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -419,7 +419,7 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) vol = ntfs_volume_alloc(); if (!vol) goto error_exit; - if (rwflag & MS_RDONLY) + if ((rwflag & MS_RDONLY) == MS_RDONLY) NVolSetReadOnly(vol); Dprintf("Reading bootsector... "); if (dev->d_ops->open(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) { From 37dd8d0f2b37439b2261ece09efad3ca1209e02a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 12 Jul 2003 15:46:12 +0000 Subject: [PATCH 0596/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/07/12 16:45:15+01:00 cantab.net!aia21 Fix the O_RDONLY vs O_RDWR check. It was failing because O_RDONLY is zero and hence the old check was always successful. BKrev: 3f102d44X0_3CQSe-sCX0tn53xdcoQ From 9cb71a50087792de0f88a0aaf1c0afe8dd8da806 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 16 Jul 2003 15:01:54 +0000 Subject: [PATCH 0597/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/07/16 16:01:32+01:00 cantab.net!aia21 Two little typo fixes. BKrev: 3f1568e23_YOjbTwJszgJx6GgX9AkQ From 53340e947e969c3f271888b24394f528cc94c05c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 16 Jul 2003 15:01:54 +0000 Subject: [PATCH 0598/2994] Two little typo fixes. (Logical change 1.154) --- libntfs/attrib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 86ef01b8..b04bb382 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2331,7 +2331,7 @@ cluster_free_err_out: /** * ntfs_resident_attr_resize - resize a resident, open ntfs attribute * @na: resident ntfs attribute to resize - * @newsize: new size (in bytes) to which to shrink the attribute + * @newsize: new size (in bytes) to which to resize the attribute * * Change the size of a resident, open ntfs attribute @na to @newsize bytes. * @@ -2757,7 +2757,7 @@ put_err_out: * "allocated" space is cleared and if the attribute is non-resident the * newly allocated space is marked as not initialised and no real allocation * on disk is performed. FIXME: Do we have to create sparse runs or can we just - * leave the reunlist to finish below data_size, i.e. can we have + * leave the runlist to finish below data_size, i.e. can we have * allocated_size < data_size? I guess that what we can't and thus we will have * to set the sparse bit of the attribute and create sparse runs to ensure that * allocated_size is >= data_size. We don't need to clear the partial run at From 8ea36f6e8459829b6adbb20d2171caaae8512e32 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 22 Jul 2003 12:20:41 +0000 Subject: [PATCH 0599/2994] (Logical change 1.155) --- libntfs/win32_io.c | 387 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 387 insertions(+) create mode 100644 libntfs/win32_io.c diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c new file mode 100644 index 00000000..8b38b938 --- /dev/null +++ b/libntfs/win32_io.c @@ -0,0 +1,387 @@ +/* + * win32_io.c - A stdio-like disk I/O implementation for low-level disk access + * on Win32. Can access an NTFS volume while it is mounted. + * Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Lode Leroy + * Copyright (c) 2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include +#include + +#include +#include + +/* + * Cannot use "../include/types.h" since it conflicts with "wintypes.h". + * define our own... + */ +typedef long long int s64; +struct flock; +struct stat; + +/* + * Need device, but prevent ../include/types.h to be loaded. + */ +#define _NTFS_TYPES_H +#include "device.h" + +#define FORCE_ALIGNED_READ + +typedef struct win32_fd { + HANDLE handle; + LARGE_INTEGER part_start; + LARGE_INTEGER part_end; + LARGE_INTEGER current_pos; +} win32_fd; + +#ifdef DEBUG +static __inline__ void Dprintf(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); +} +#else +static void Dprintf(const char *fmt, ...) +{ +} +#endif + +#define perror(msg) win32_perror(__FILE__,__LINE__,__FUNCTION__,msg) + +int +win32_perror(char *file, int line, char *func, char *msg) +{ + char buffer[1024] = ""; + DWORD err = GetLastError(); + + if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, buffer, + sizeof (buffer), NULL) <= 0) { + sprintf(buffer, "HRESULT 0x%lx", err); + } + fprintf(stderr, "%s(%d):%s\t%s %s\n", file, line, func, buffer, msg); + return 0; +} + +/** + * ntfs_device_win32_open - open a device + * @dev: ntfs device to open + * @flags: open flags + * + * If name is in format "(hd[0-9],[0-9])" then open a partition. + * If name is in format "(hd[0-9])" then open a volume. + * Otherwise open a file. + */ +static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) +{ + int drive = 0, part = 0, numparams; + HANDLE handle; + win32_fd fd; + char drive_char, filename[256]; + + numparams = sscanf(dev->d_name, "/dev/hd%c%d", &drive_char, &part); + drive = toupper(drive_char) - 'A'; + part--; + + if (numparams >= 1) { + if (numparams == 2) + Dprintf("win32_open(%s) -> drive %d, part %d\n", + dev->d_name, drive, part); + else + Dprintf("win32_open(%s) -> drive %d\n", dev->d_name, + drive); + + sprintf(filename, "\\\\.\\PhysicalDrive%d", drive); + + handle = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, + NULL); + + if (handle == INVALID_HANDLE_VALUE) { + char msg[1024]; + + sprintf(msg, "CreateFile(%s) failed", filename); + perror(msg); + return -1; + } + + if (numparams == 1) { + fd.handle = handle; + fd.part_start.QuadPart = 0; + fd.part_end.QuadPart = -1; + fd.current_pos.QuadPart = 0; + } else { + char buffer[10240]; + DWORD numread; + DRIVE_LAYOUT_INFORMATION *drive_layout; + BOOL rvl; + + rvl = DeviceIoControl(handle, + IOCTL_DISK_GET_DRIVE_LAYOUT, NULL, 0, + &buffer, sizeof (buffer), &numread, + NULL); + if (!rvl) { + perror("ioctl failed"); + return -1; + } + + drive_layout = (DRIVE_LAYOUT_INFORMATION *)buffer; + + if (part >= drive_layout->PartitionCount) { + printf("partition %d not found on drive %d", + part, drive); + return -1; + } + + fd.handle = handle; + fd.part_start = drive_layout-> + PartitionEntry[part].StartingOffset; + fd.part_end.QuadPart = drive_layout-> + PartitionEntry[0].StartingOffset. + QuadPart + drive_layout-> + PartitionEntry[0].PartitionLength. + QuadPart; + fd.current_pos.QuadPart = 0; + } + } else { + BY_HANDLE_FILE_INFORMATION info; + BOOL rvl; + + Dprintf("win32_open(%s) -> file\n", dev->d_name); + + handle = CreateFile(dev->d_name, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); + + rvl = GetFileInformationByHandle(handle, &info); + if (!rvl) { + perror("ioctl failed"); + return -1; + } + + fd.handle = handle; + fd.part_start.QuadPart = 0; + fd.part_end.QuadPart = (((s64) info.nFileSizeHigh) << 32) + + ((s64) info.nFileSizeLow); + fd.current_pos.QuadPart = 0; + } + + Dprintf("win32_open(%s) -> %p, offset 0x%llx\n", dev->d_name, dev, + fd.part_start); + + dev->d_private = malloc(sizeof (win32_fd)); + memcpy(dev->d_private, &fd, sizeof (win32_fd)); + + return 0; +} + +static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, + int whence) +{ + LARGE_INTEGER abs_offset; + struct win32_fd *fd = (win32_fd *)dev->d_private; + int disp; + BOOL rvl; + + Dprintf("win32_seek(%lld=0x%llx,%d)\n", offset, offset, whence); + + switch (whence) { + case SEEK_SET: + disp = FILE_BEGIN; + abs_offset.QuadPart = fd->part_start.QuadPart + offset; + break; + case SEEK_CUR: + disp = FILE_CURRENT; + abs_offset.QuadPart = offset; + break; + case SEEK_END: + /* end of partition != end of disk */ + disp = FILE_BEGIN; + abs_offset.QuadPart = fd->part_end.QuadPart + offset; + break; + default: + printf("win32_seek() wrong mode %d\n", whence); + return -1; + } + + rvl = SetFilePointerEx(fd->handle, abs_offset, &fd->current_pos, disp); + if (!rvl) { + perror("SetFilePointer failed"); + return -1; + } + + return offset; +} + +static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) +{ + struct win32_fd *fd = (win32_fd *)dev->d_private; + LARGE_INTEGER base, offset, numtoread; + DWORD numread = 0; + BOOL rvl = -1; + + offset.QuadPart = fd->current_pos.QuadPart & 0x1FF; + base.QuadPart = fd->current_pos.QuadPart - offset.QuadPart; + numtoread.QuadPart = ((count + offset.QuadPart - 1) | 0x1FF) + 1; + + Dprintf("win32_read(fd=%p,b=%p,count=0x%llx)->(%llx+%llx:%llx)\n", fd, + buf, count, base, offset, numtoread); + +#ifndef FORCE_ALIGNED_READ + if (((((long)buf) & ((s64)0x1FF)) == 0) && ((count & ((s64)0x1FF)) == 0) + && ((fd->current_pos.QuadPart & 0x1FF) == 0)) { + Dprintf("normal read\n"); + + rvl = ReadFile(fd->handle, (LPVOID)buf, count, &numread, + (LPOVERLAPPED)NULL); + } else { + BYTE *alignedbuffer; + + Dprintf("aligned read\n"); +#else + { + BYTE *alignedbuffer; +#endif + LARGE_INTEGER new_pos; + + *alignedbuffer = (BYTE *)VirtualAlloc(NULL, count, MEM_COMMIT, + PAGE_READWRITE); + + Dprintf("set SetFilePointerEx(%llx)\n", base.QuadPart); + // FIXME: Why is rvl not being checked? (AIA) + rvl = SetFilePointerEx(fd->handle, base, NULL, FILE_BEGIN); + rvl = ReadFile(fd->handle, (LPVOID) alignedbuffer, + numtoread.QuadPart, &numread, + (LPOVERLAPPED)NULL); + + new_pos.QuadPart = fd->current_pos.QuadPart + count; + + Dprintf("reset SetFilePointerEx(%llx)\n", new_pos.QuadPart); + rvl = SetFilePointerEx(fd->handle, new_pos, &fd->current_pos, + FILE_BEGIN); + if (!rvl) + printf("SetFilePointerEx failed"); + + memcpy((void *)buf, alignedbuffer + offset.QuadPart, count); + VirtualFree(alignedbuffer, 0, MEM_RELEASE); + } + if (!rvl) { + perror("ReadFile failed"); + return -1; + } + + if (numread > count) + return count; + return numread; +} + +static int ntfs_device_win32_close(struct ntfs_device *dev) +{ + struct win32_fd *fd = (win32_fd *)dev->d_private; + BOOL rvl; + + Dprintf("win32_close(%p)\n", dev); + + rvl = CloseHandle(fd->handle); + fd->handle = 0; + + free(fd); + + if (!rvl) { + perror("CloseHandle failed"); + return -1; + } + + return 0; +} + +s64 win32_bias(struct ntfs_device *dev) +{ + struct win32_fd *fd = (win32_fd *)dev->d_private; + + return fd->part_start.QuadPart; +} + +s64 win32_filepos(struct ntfs_device *dev) +{ + struct win32_fd *fd = (win32_fd *)dev->d_private; + + return fd->current_pos.QuadPart; +} + +static int ntfs_device_win32_sync(struct ntfs_device *dev) +{ + Dprintf("win32_fsync() unimplemented\n"); + // FIXME: Should be returning error, e.g. ENOTSUP. (AIA) + return 0; +} + +static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buffer, + s64 count) +{ + Dprintf("win32_write() unimplemented\n"); + // FIXME: Should be setting errno to e.g. ENOTSUP. (AIA) + return -1; +} + +static int ntfs_device_win32_stat(struct ntfs_device *dev, struct stat *buf) +{ + Dprintf("win32_fstat() unimplemented\n"); + // FIXME: Should be returning error, e.g. ENOTSUP. (AIA) + return 0; +} + +static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, + void *argp) +{ + Dprintf("win32_ioctl() unimplemented\n"); + // FIXME: Should be returning error, e.g. ENOTSUP. (AIA) + return 0; +} + +extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, + void *b); +static s64 ntfs_device_win32_pread(struct ntfs_device *dev, void *buf, + s64 count, s64 offset) +{ + return ntfs_pread(dev, offset, count, buf); +} + +extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, + const void *b); +static s64 ntfs_device_win32_pwrite(struct ntfs_device *dev, const void *buf, + s64 count, s64 offset) +{ + return ntfs_pwrite(dev, offset, count, buf); +} + +struct ntfs_device_operations ntfs_device_win32_ops = { + .open = ntfs_device_win32_open, + .close = ntfs_device_win32_close, + .seek = ntfs_device_win32_seek, + .read = ntfs_device_win32_read, + .write = ntfs_device_win32_write, + .pread = ntfs_device_win32_pread, + .pwrite = ntfs_device_win32_pwrite, + .sync = ntfs_device_win32_sync, + .stat = ntfs_device_win32_stat, + .ioctl = ntfs_device_win32_ioctl +}; + From fef971a4540b3b66349ebb524adc63e24edf5691 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 22 Jul 2003 12:20:41 +0000 Subject: [PATCH 0600/2994] Add Lode Leroy. (Logical change 1.155) --- AUTHORS | 1 + CREDITS | 1 + 2 files changed, 2 insertions(+) diff --git a/AUTHORS b/AUTHORS index 47e36427..cc80d40c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5,6 +5,7 @@ Current active developers on the project are (in alphabetical order): Anton Altaparmakov Matthew J. Fanto + Lode Leroy Richard Russon Szakacsits Szabolcs diff --git a/CREDITS b/CREDITS index 918d8331..a80efc2f 100644 --- a/CREDITS +++ b/CREDITS @@ -11,6 +11,7 @@ Anton Altaparmakov Albert D. Cahalan Russ Christensen Matthew J. Fanto +Lode Leroy David Martínez Moreno Ian Jackson Leonard Norrgĺrd From 6f7f18105746d1d8136ca4803da57f7124f11c98 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 22 Jul 2003 12:20:41 +0000 Subject: [PATCH 0601/2994] Add Lode Leroy. BKrev: 3f1d2c19zPwx201EbjDPSMpRqwtC-Q From 4b02e7606eb89a1977c50afa4fb6053d59cf3f5d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 22 Jul 2003 12:20:41 +0000 Subject: [PATCH 0602/2994] Initial revision --- libntfs/win32_io.c | 387 --------------------------------------------- 1 file changed, 387 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 8b38b938..e69de29b 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -1,387 +0,0 @@ -/* - * win32_io.c - A stdio-like disk I/O implementation for low-level disk access - * on Win32. Can access an NTFS volume while it is mounted. - * Part of the Linux-NTFS project. - * - * Copyright (c) 2003 Lode Leroy - * Copyright (c) 2003 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include -#include - -#include -#include - -/* - * Cannot use "../include/types.h" since it conflicts with "wintypes.h". - * define our own... - */ -typedef long long int s64; -struct flock; -struct stat; - -/* - * Need device, but prevent ../include/types.h to be loaded. - */ -#define _NTFS_TYPES_H -#include "device.h" - -#define FORCE_ALIGNED_READ - -typedef struct win32_fd { - HANDLE handle; - LARGE_INTEGER part_start; - LARGE_INTEGER part_end; - LARGE_INTEGER current_pos; -} win32_fd; - -#ifdef DEBUG -static __inline__ void Dprintf(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); -} -#else -static void Dprintf(const char *fmt, ...) -{ -} -#endif - -#define perror(msg) win32_perror(__FILE__,__LINE__,__FUNCTION__,msg) - -int -win32_perror(char *file, int line, char *func, char *msg) -{ - char buffer[1024] = ""; - DWORD err = GetLastError(); - - if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, buffer, - sizeof (buffer), NULL) <= 0) { - sprintf(buffer, "HRESULT 0x%lx", err); - } - fprintf(stderr, "%s(%d):%s\t%s %s\n", file, line, func, buffer, msg); - return 0; -} - -/** - * ntfs_device_win32_open - open a device - * @dev: ntfs device to open - * @flags: open flags - * - * If name is in format "(hd[0-9],[0-9])" then open a partition. - * If name is in format "(hd[0-9])" then open a volume. - * Otherwise open a file. - */ -static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) -{ - int drive = 0, part = 0, numparams; - HANDLE handle; - win32_fd fd; - char drive_char, filename[256]; - - numparams = sscanf(dev->d_name, "/dev/hd%c%d", &drive_char, &part); - drive = toupper(drive_char) - 'A'; - part--; - - if (numparams >= 1) { - if (numparams == 2) - Dprintf("win32_open(%s) -> drive %d, part %d\n", - dev->d_name, drive, part); - else - Dprintf("win32_open(%s) -> drive %d\n", dev->d_name, - drive); - - sprintf(filename, "\\\\.\\PhysicalDrive%d", drive); - - handle = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, - NULL); - - if (handle == INVALID_HANDLE_VALUE) { - char msg[1024]; - - sprintf(msg, "CreateFile(%s) failed", filename); - perror(msg); - return -1; - } - - if (numparams == 1) { - fd.handle = handle; - fd.part_start.QuadPart = 0; - fd.part_end.QuadPart = -1; - fd.current_pos.QuadPart = 0; - } else { - char buffer[10240]; - DWORD numread; - DRIVE_LAYOUT_INFORMATION *drive_layout; - BOOL rvl; - - rvl = DeviceIoControl(handle, - IOCTL_DISK_GET_DRIVE_LAYOUT, NULL, 0, - &buffer, sizeof (buffer), &numread, - NULL); - if (!rvl) { - perror("ioctl failed"); - return -1; - } - - drive_layout = (DRIVE_LAYOUT_INFORMATION *)buffer; - - if (part >= drive_layout->PartitionCount) { - printf("partition %d not found on drive %d", - part, drive); - return -1; - } - - fd.handle = handle; - fd.part_start = drive_layout-> - PartitionEntry[part].StartingOffset; - fd.part_end.QuadPart = drive_layout-> - PartitionEntry[0].StartingOffset. - QuadPart + drive_layout-> - PartitionEntry[0].PartitionLength. - QuadPart; - fd.current_pos.QuadPart = 0; - } - } else { - BY_HANDLE_FILE_INFORMATION info; - BOOL rvl; - - Dprintf("win32_open(%s) -> file\n", dev->d_name); - - handle = CreateFile(dev->d_name, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, 0, NULL); - - rvl = GetFileInformationByHandle(handle, &info); - if (!rvl) { - perror("ioctl failed"); - return -1; - } - - fd.handle = handle; - fd.part_start.QuadPart = 0; - fd.part_end.QuadPart = (((s64) info.nFileSizeHigh) << 32) + - ((s64) info.nFileSizeLow); - fd.current_pos.QuadPart = 0; - } - - Dprintf("win32_open(%s) -> %p, offset 0x%llx\n", dev->d_name, dev, - fd.part_start); - - dev->d_private = malloc(sizeof (win32_fd)); - memcpy(dev->d_private, &fd, sizeof (win32_fd)); - - return 0; -} - -static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, - int whence) -{ - LARGE_INTEGER abs_offset; - struct win32_fd *fd = (win32_fd *)dev->d_private; - int disp; - BOOL rvl; - - Dprintf("win32_seek(%lld=0x%llx,%d)\n", offset, offset, whence); - - switch (whence) { - case SEEK_SET: - disp = FILE_BEGIN; - abs_offset.QuadPart = fd->part_start.QuadPart + offset; - break; - case SEEK_CUR: - disp = FILE_CURRENT; - abs_offset.QuadPart = offset; - break; - case SEEK_END: - /* end of partition != end of disk */ - disp = FILE_BEGIN; - abs_offset.QuadPart = fd->part_end.QuadPart + offset; - break; - default: - printf("win32_seek() wrong mode %d\n", whence); - return -1; - } - - rvl = SetFilePointerEx(fd->handle, abs_offset, &fd->current_pos, disp); - if (!rvl) { - perror("SetFilePointer failed"); - return -1; - } - - return offset; -} - -static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) -{ - struct win32_fd *fd = (win32_fd *)dev->d_private; - LARGE_INTEGER base, offset, numtoread; - DWORD numread = 0; - BOOL rvl = -1; - - offset.QuadPart = fd->current_pos.QuadPart & 0x1FF; - base.QuadPart = fd->current_pos.QuadPart - offset.QuadPart; - numtoread.QuadPart = ((count + offset.QuadPart - 1) | 0x1FF) + 1; - - Dprintf("win32_read(fd=%p,b=%p,count=0x%llx)->(%llx+%llx:%llx)\n", fd, - buf, count, base, offset, numtoread); - -#ifndef FORCE_ALIGNED_READ - if (((((long)buf) & ((s64)0x1FF)) == 0) && ((count & ((s64)0x1FF)) == 0) - && ((fd->current_pos.QuadPart & 0x1FF) == 0)) { - Dprintf("normal read\n"); - - rvl = ReadFile(fd->handle, (LPVOID)buf, count, &numread, - (LPOVERLAPPED)NULL); - } else { - BYTE *alignedbuffer; - - Dprintf("aligned read\n"); -#else - { - BYTE *alignedbuffer; -#endif - LARGE_INTEGER new_pos; - - *alignedbuffer = (BYTE *)VirtualAlloc(NULL, count, MEM_COMMIT, - PAGE_READWRITE); - - Dprintf("set SetFilePointerEx(%llx)\n", base.QuadPart); - // FIXME: Why is rvl not being checked? (AIA) - rvl = SetFilePointerEx(fd->handle, base, NULL, FILE_BEGIN); - rvl = ReadFile(fd->handle, (LPVOID) alignedbuffer, - numtoread.QuadPart, &numread, - (LPOVERLAPPED)NULL); - - new_pos.QuadPart = fd->current_pos.QuadPart + count; - - Dprintf("reset SetFilePointerEx(%llx)\n", new_pos.QuadPart); - rvl = SetFilePointerEx(fd->handle, new_pos, &fd->current_pos, - FILE_BEGIN); - if (!rvl) - printf("SetFilePointerEx failed"); - - memcpy((void *)buf, alignedbuffer + offset.QuadPart, count); - VirtualFree(alignedbuffer, 0, MEM_RELEASE); - } - if (!rvl) { - perror("ReadFile failed"); - return -1; - } - - if (numread > count) - return count; - return numread; -} - -static int ntfs_device_win32_close(struct ntfs_device *dev) -{ - struct win32_fd *fd = (win32_fd *)dev->d_private; - BOOL rvl; - - Dprintf("win32_close(%p)\n", dev); - - rvl = CloseHandle(fd->handle); - fd->handle = 0; - - free(fd); - - if (!rvl) { - perror("CloseHandle failed"); - return -1; - } - - return 0; -} - -s64 win32_bias(struct ntfs_device *dev) -{ - struct win32_fd *fd = (win32_fd *)dev->d_private; - - return fd->part_start.QuadPart; -} - -s64 win32_filepos(struct ntfs_device *dev) -{ - struct win32_fd *fd = (win32_fd *)dev->d_private; - - return fd->current_pos.QuadPart; -} - -static int ntfs_device_win32_sync(struct ntfs_device *dev) -{ - Dprintf("win32_fsync() unimplemented\n"); - // FIXME: Should be returning error, e.g. ENOTSUP. (AIA) - return 0; -} - -static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buffer, - s64 count) -{ - Dprintf("win32_write() unimplemented\n"); - // FIXME: Should be setting errno to e.g. ENOTSUP. (AIA) - return -1; -} - -static int ntfs_device_win32_stat(struct ntfs_device *dev, struct stat *buf) -{ - Dprintf("win32_fstat() unimplemented\n"); - // FIXME: Should be returning error, e.g. ENOTSUP. (AIA) - return 0; -} - -static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, - void *argp) -{ - Dprintf("win32_ioctl() unimplemented\n"); - // FIXME: Should be returning error, e.g. ENOTSUP. (AIA) - return 0; -} - -extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, - void *b); -static s64 ntfs_device_win32_pread(struct ntfs_device *dev, void *buf, - s64 count, s64 offset) -{ - return ntfs_pread(dev, offset, count, buf); -} - -extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, - const void *b); -static s64 ntfs_device_win32_pwrite(struct ntfs_device *dev, const void *buf, - s64 count, s64 offset) -{ - return ntfs_pwrite(dev, offset, count, buf); -} - -struct ntfs_device_operations ntfs_device_win32_ops = { - .open = ntfs_device_win32_open, - .close = ntfs_device_win32_close, - .seek = ntfs_device_win32_seek, - .read = ntfs_device_win32_read, - .write = ntfs_device_win32_write, - .pread = ntfs_device_win32_pread, - .pwrite = ntfs_device_win32_pwrite, - .sync = ntfs_device_win32_sync, - .stat = ntfs_device_win32_stat, - .ioctl = ntfs_device_win32_ioctl -}; - From ee2c0170e18b5897bab717da6e8f7c95b1d41182 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 22 Jul 2003 12:22:19 +0000 Subject: [PATCH 0603/2994] Ignore ntfsclone. (Logical change 1.156) --- BitKeeper/etc/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 45596fc1..5b399b45 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -38,3 +38,4 @@ ntfsprogs/ntfsresize ntfsprogs/ntfstruncate ntfsprogs/ntfsundelete ntfsprogs/ntfswipe +ntfsprogs/ntfsclone From 1073902242e54e88823d71af7eb8e513d3782194 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 22 Jul 2003 12:22:19 +0000 Subject: [PATCH 0604/2994] Ignore ntfsclone. BKrev: 3f1d2c7bOCcZ9hMqZnUb2apZyxHxKw From 7f4c7ac959f57cfcf40759be154f7925cd39e250 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 22 Jul 2003 20:41:19 +0000 Subject: [PATCH 0605/2994] Initial revision --- ntfsprogs/ntfsls.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ntfsprogs/ntfsls.c diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c new file mode 100644 index 00000000..e69de29b From 6820c2d11031a4810907efd25d83affc86c5a3af Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 22 Jul 2003 20:41:19 +0000 Subject: [PATCH 0606/2994] Lode: smarter way to get the filesize 2003/07/22 21:28:05+01:00 flatcap.org!flatcap Lode: find the file size from the data attribute 2003/07/22 21:08:43+01:00 flatcap.org!flatcap (Logical change 1.157) --- ntfsprogs/ntfsls.c | 446 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 446 insertions(+) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index e69de29b..fbf19578 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -0,0 +1,446 @@ +/** + * ntfsls - Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Lode Leroy + * + * This utility will list a directory's files. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "config.h" + +#include +#include +#include +#include +#include + +#include "types.h" +#include "mft.h" +#include "attrib.h" +#include "layout.h" +#include "inode.h" +#include "utils.h" +#include "dir.h" + +static const char *EXEC_NAME = "ntfsls"; + +static struct options { + char *device; /* Device/File to work with */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int force; /* Override common sense */ + int all; + int sys; + int dos; + int lng; + int inode; + int classify; + int readonly; + int hidden; + int archive; + int system; + char *path; +} opts; + +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + printf ("\n%s v%s - Display information about an NTFS Volume.\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c)\n"); + printf (" 2003 Lode Leroy\n"); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + printf ("\nUsage: %s [options] -d /dev/hda1 -p /WINDOWS\n" + "\n" + " -d --device NTFS volume\n" + " -p --path Relative path to the directory\n" + " -l --long Display long info\n" + " -F --classify Display classification\n" + " -f --force Use less caution\n" + " -q --quiet Less output\n" + " -v --verbose More output\n" + " -V --version Display version information\n" + " -h --help Display this help\n" + " -a Display all files\n" + " -x Use short (DOS 8.3) names\n" + " -s Display system files\n" + "\n", + EXEC_NAME); + printf ("%s%s\n", ntfs_bugs, ntfs_home); +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char *argv[]) +{ + static const char *sopt = "-fh?qvVd:p:asxliFRHSA"; + static const struct option lopt[] = { + { "device", required_argument, NULL, 'd' }, + { "path", required_argument, NULL, 'p' }, + { "all", no_argument, NULL, 'a' }, + { "sys", no_argument, NULL, 's' }, + { "long", no_argument, NULL, 'l' }, + { "inode", no_argument, NULL, 'i' }, + { "classify", no_argument, NULL, 'F' }, + { "system", no_argument, NULL, 'S' }, + { "dos", no_argument, NULL, 'x' }, + + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "quiet", no_argument, NULL, 'q' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 }, + }; + + char c = -1; + int err = 0; + int ver = 0; + int help = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + memset(&opts, 0, sizeof(opts)); + opts.device = "/dev/hda1"; + opts.path = "/"; + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 'd': /* A non-option argument */ + opts.device = argv[optind-1]; + break; + case 'p': + opts.path = optarg; + break; + case 'f': + opts.force++; + break; + case 'h': + case '?': + help++; + break; + case 'q': + opts.quiet++; + break; + case 'v': + opts.verbose++; + break; + case 'V': + ver++; + break; + case 'x': + opts.dos++; + break; + case 'l': + opts.lng++; + break; + case 'i': + opts.inode++; + break; + case 'F': + opts.classify++; + break; + case 'a': + opts.all++; + break; + case 's': + opts.sys++; + break; + case 'R': + opts.readonly++; + break; + case 'H': + opts.hidden++; + break; + case 'S': + opts.system++; + break; + case 'A': + opts.archive++; + break; + default: + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if (opts.device == NULL) { + if (argc > 1) + Eprintf ("You must specify exactly one device.\n"); + err++; + } + + if (opts.quiet && opts.verbose) { + Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + err++; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + + +/** + * ucstos - convert unicode-character string to ASCII + * @dest: points to buffer to receive the converted string + * @src: points to string to convert + * @maxlen: size of @dest buffer in bytes + * + * Return the number of characters written to @dest, not including the + * terminating null byte. If a unicode character was encountered which could + * not be converted -1 is returned. + */ +int ucstos(char *dest, const uchar_t *src, int maxlen) +{ + uchar_t u; + int i; + + /* Need one byte for null terminator. */ + maxlen--; + for (i = 0; i < maxlen; i++) { + u = le16_to_cpu(src[i]); + if (!u) + break; + if (u & 0xff00) + return -1; + dest[i] = u & 0xff; + } + dest[i] = 0; + return i; +} + +/** + * stoucs - convert ASCII string to unicode-character string + * @dest: points to buffer to receive the converted string + * @src: points to string to convert + * @maxlen: size of @dest buffer in bytes + * + * Return the number of characters written to @dest, not including the + * terminating null unicode character. + */ +int stoucs(uchar_t *dest, const char *src, int maxlen) +{ + char c; + int i; + + /* Need two bytes for null terminator. */ + maxlen -= 2; + for (i = 0; i < maxlen; i++) { + c = src[i]; + if (!c) + break; + dest[i] = cpu_to_le16(c); + } + dest[i] = cpu_to_le16('\0'); + return i; +} + +/* Dump a block of memory starting at buf. Display length bytes. The displayed + index of the first byte is start */ +void dump_mem(unsigned char *buf, int start, int length) +{ + int offs,i; + for(offs=0;offs=length) { putchar(' '); } else + if(buf[offs+i]>31 && buf[offs+i]<128)putchar(buf[offs+i] +); + else putchar('.'); + putchar('\n'); + } +} + +typedef struct { + ntfs_volume* vol; +} ntfsls_dirent; + +int +list_entry(ntfsls_dirent* dirent, const uchar_t* name, + const int name_len, const int name_type, const s64 pos, + const MFT_REF mref, const unsigned dt_type) { + + char filename[200]; + ucstos(filename, name, min(name_len+1,sizeof(filename))); + //printf("[%s\t,%d,%d]\n", filename, name_type, dt_type); + if ((filename[0] == '$') && (!opts.sys)) { + return 0; + } else + if (name_type == 0 && !opts.all) { + return 0; + } + if (((name_type & 3) == 1) && (opts.dos!=0)) { + return 0; + } + if (((name_type & 3) == 2) && (opts.dos!=1)) { + return 0; + } + if (dt_type == NTFS_DT_DIR && opts.classify) { + sprintf(filename+strlen(filename),"/"); + } + + if (!opts.lng) { + printf(filename); + printf("\n"); + } else { + ntfs_inode *ni = NULL; + MFT_RECORD *mrec = NULL; + ntfs_attr_search_ctx *ctx = NULL; + FILE_NAME_ATTR *file_name_attr = NULL; + ATTR_RECORD *attr = NULL; + time_t ntfs_time; + + ni = ntfs_inode_open(dirent->vol, mref); + if (!ni) { + return -1; + } + //dump_mem(ni, 0, sizeof(ntfs_inode)); + + ctx = ntfs_attr_get_search_ctx(ni, ni->mrec); + if (!ctx) { + return -1; + } + if(ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + return -1; + } + attr = ctx->attr; + //dump_mem(attr, 0, sizeof(*attr)); + + file_name_attr = (FILE_NAME_ATTR*)((char *)attr + le16_to_cpu(attr->value_offset)); + if (!file_name_attr) { + return -1; + } + //dump_mem(file_name_attr, 0, sizeof(*file_name_attr)); + + ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_data_change_time)); + char t_buf[26]; + strcpy(t_buf, ctime(&ntfs_time)); + t_buf[16] = '\0'; + + s64 filesize = 0; + if (dt_type != NTFS_DT_DIR) { + if(!ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + attr = ctx->attr; + filesize = ntfs_get_attribute_value_length(attr); + } + } + + if (opts.inode) { + printf("%12lld %18lld %s\n", filesize, mref, filename); + } else { + printf("%12lld %s %s\n", filesize, t_buf+4, filename); + } + } + + return 0; +} + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main(int argc, char **argv) +{ + ntfs_volume *vol; + + if (!parse_options (argc, argv)) + return 1; + + utils_set_locale(); + + vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); + + if (!vol) + return 2; + + s64 pos = 0; + u64 ino; + ntfs_inode* ni = vol->mft_ni; + uchar_t unicode[100]; + int len; + ni = ntfs_inode_open(vol, FILE_root); + char* p = opts.path; + while (p && *p && *p == '/') p++; + while (p && *p) { + char* q = strchr(p, '/'); + if (q != NULL) { + *q = '\0'; + q++; + } + len = stoucs(unicode, p, sizeof(unicode)); + ino = ntfs_inode_lookup_by_name(ni, unicode, len); + ni = ntfs_inode_open(vol, ino); + p = q; + while (p && *p && *p == '/') p++; + } + ntfsls_dirent dirent; + dirent.vol = vol; + ntfs_readdir(ni, &pos, &dirent, list_entry); + + ntfs_umount (vol, FALSE); + return 0; +} + +/* + * Local Variables: + * c-basic-offset:4 + * tab-width:8 + * End: + */ From 334c06a1828c45777ada4b435f610bff90800ea7 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 22 Jul 2003 20:41:19 +0000 Subject: [PATCH 0607/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs-devel into flatcap.org:/home/flatcap/ntfsprogs-devel.ls 2003/07/22 21:35:49+01:00 flatcap.org!flatcap Lode Leroy's ntfsls This utility will list a directory's files. BKrev: 3f1da16fOz8HJFYaTT9nisKt8PEEAA From d83672524820ee60b91ed76936f3d3a9e04da695 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 22 Jul 2003 20:41:19 +0000 Subject: [PATCH 0608/2994] added ntfsls (Logical change 1.157) --- ntfsprogs/Makefile.am | 7 ++++++- ntfsprogs/Makefile.in | 27 ++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 4e561dcd..049806fc 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -27,7 +27,8 @@ LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfscluster ntfsclone +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate \ + ntfscluster ntfsclone ntfsls man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 @@ -74,6 +75,10 @@ ntfscluster_SOURCES = ntfscluster.c ntfscluster.h utils.c utils.h ntfscluster_LDADD = $(AM_LIBS) ntfscluster_LDFLAGS = $(AM_LFLAGS) +ntfsls_SOURCES = ntfsls.c utils.c utils.h +ntfsls_LDADD = $(AM_LIBS) +ntfsls_LDFLAGS = $(AM_LFLAGS) + ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index f4593b4d..32b95b81 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -113,7 +113,9 @@ LINK = $(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfscluster ntfsclone +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate \ + ntfscluster ntfsclone ntfsls + man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 @@ -161,6 +163,10 @@ ntfscluster_SOURCES = ntfscluster.c ntfscluster.h utils.c utils.h ntfscluster_LDADD = $(AM_LIBS) ntfscluster_LDFLAGS = $(AM_LFLAGS) +ntfsls_SOURCES = ntfsls.c utils.c utils.h +ntfsls_LDADD = $(AM_LIBS) +ntfsls_LDFLAGS = $(AM_LFLAGS) + ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) @@ -183,7 +189,7 @@ CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 \ ntfsprogs.8 ntfsresize.8 ntfsundelete.8 EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) dumplog$(EXEEXT) \ ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) ntfscluster$(EXEEXT) \ - ntfsclone$(EXEEXT) + ntfsclone$(EXEEXT) ntfsls$(EXEEXT) bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) ntfsundelete$(EXEEXT) \ ntfsresize$(EXEEXT) @@ -238,6 +244,12 @@ ntfslabel_OBJECTS = $(am_ntfslabel_OBJECTS) @REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ @REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfsls_OBJECTS = ntfsls.$(OBJEXT) utils.$(OBJEXT) +ntfsls_OBJECTS = $(am_ntfsls_OBJECTS) +@REALLYSTATIC_TRUE@ntfsls_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfsls_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la am_ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) utils.$(OBJEXT) ntfsresize_OBJECTS = $(am_ntfsresize_OBJECTS) @REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ @@ -274,7 +286,8 @@ am__depfiles_maybe = depfiles @AMDEP_TRUE@ ./$(DEPDIR)/ntfsclone.Po ./$(DEPDIR)/ntfscluster.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsdump_logfile.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsfix.Po ./$(DEPDIR)/ntfsinfo.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfslabel.Po ./$(DEPDIR)/ntfsresize.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfslabel.Po ./$(DEPDIR)/ntfsls.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsresize.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfstruncate.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsundelete.Po ./$(DEPDIR)/ntfswipe.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/sd.Po ./$(DEPDIR)/upcase.Po \ @@ -287,7 +300,7 @@ CCLD = $(CC) DIST_SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfsclone_SOURCES) \ $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) \ $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) \ - $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) \ + $(ntfsls_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) \ $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) NROFF = nroff @@ -295,7 +308,7 @@ MANS = $(man_MANS) DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsfix.8.in \ ntfsinfo.8.in ntfslabel.8.in ntfsprogs.8.in ntfsresize.8.in \ ntfsundelete.8.in -SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) +SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) all: all-am @@ -402,6 +415,9 @@ ntfsinfo$(EXEEXT): $(ntfsinfo_OBJECTS) $(ntfsinfo_DEPENDENCIES) ntfslabel$(EXEEXT): $(ntfslabel_OBJECTS) $(ntfslabel_DEPENDENCIES) @rm -f ntfslabel$(EXEEXT) $(LINK) $(ntfslabel_LDFLAGS) $(ntfslabel_OBJECTS) $(ntfslabel_LDADD) $(LIBS) +ntfsls$(EXEEXT): $(ntfsls_OBJECTS) $(ntfsls_DEPENDENCIES) + @rm -f ntfsls$(EXEEXT) + $(LINK) $(ntfsls_LDFLAGS) $(ntfsls_OBJECTS) $(ntfsls_LDADD) $(LIBS) ntfsresize$(EXEEXT): $(ntfsresize_OBJECTS) $(ntfsresize_DEPENDENCIES) @rm -f ntfsresize$(EXEEXT) $(LINK) $(ntfsresize_LDFLAGS) $(ntfsresize_OBJECTS) $(ntfsresize_LDADD) $(LIBS) @@ -431,6 +447,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsfix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfslabel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsls.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsresize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfstruncate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsundelete.Po@am__quote@ From 550e506f29a080fdca0a35ba65cf3d4cee2c1296 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 22 Jul 2003 21:08:22 +0000 Subject: [PATCH 0609/2994] Add -t (display all timestamps as Epoch) and -T (don't display timestamps at all). Usable for ignoring timestamps when diff'ing. (Logical change 1.158) --- ntfsprogs/ntfsinfo.c | 55 +++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 503fef80..40816d33 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -44,6 +44,8 @@ static struct options { int quiet; /* Less output */ int verbose; /* Extra output */ int force; /* Override common sense */ + int epochtime; /* Report all timestamps as "Thu Jan 1 00:00:00 1970" */ + int notime; /* Don't report timestamps at all */ } opts; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) @@ -65,6 +67,7 @@ void version (void) printf (" 2002 Matthew J. Fanto\n"); printf (" 2002 Anton Altaparmakov\n"); printf (" 2002-2003 Richard Russon\n"); + printf (" 2003 Leonard Norrgard\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -84,7 +87,9 @@ void usage (void) " -q --quiet Less output\n" " -v --verbose More output\n" " -V --version Display version information\n" - " -h --help Display this help\n\n", + " -h --help Display this help\n\n" + " -t --epochtime Report all timestamps as \"Thu Jan 1 00:00:00 1970\"\n" + " -T --notime Don't report timestamps at all\n", EXEC_NAME); printf ("%s%s\n", ntfs_bugs, ntfs_home); } @@ -100,7 +105,7 @@ void usage (void) */ int parse_options (int argc, char *argv[]) { - static const char *sopt = "-fh?i:qvV"; + static const char *sopt = "-fh?i:qtTvV"; static const struct option lopt[] = { { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, @@ -108,6 +113,8 @@ int parse_options (int argc, char *argv[]) { "quiet", no_argument, NULL, 'q' }, { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' }, + { "epochtime", no_argument, NULL, 't' }, + { "notime", no_argument, NULL, 'T' }, { NULL, 0, NULL, 0 }, }; @@ -146,6 +153,12 @@ int parse_options (int argc, char *argv[]) case 'q': opts.quiet++; break; + case 't': + opts.epochtime++; + break; + case 'T': + opts.notime++; + break; case 'v': opts.verbose++; break; @@ -182,6 +195,11 @@ int parse_options (int argc, char *argv[]) Eprintf ("You may not use --quiet and --verbose at the same time.\n"); err++; } + + if (opts.epochtime && opts.notime) { + Eprintf ("You may not use --notime and --epochtime at the same time.\n"); + err++; + } } if (ver) @@ -202,7 +220,6 @@ void ntfs_dump_file_name_attribute(ntfs_inode *inode, MFT_RECORD *mrec) ATTR_RECORD *attr = NULL; ntfs_attr_search_ctx *ctx = NULL; char *file_name = NULL; - time_t ntfs_time; ctx = ntfs_attr_get_search_ctx(inode, mrec); @@ -228,18 +245,30 @@ void ntfs_dump_file_name_attribute(ntfs_inode *inode, MFT_RECORD *mrec) printf("Real File Size: \t %lld\n", sle64_to_cpu(file_name_attr->data_size)); //time conversion stuff - ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->creation_time)); - printf("File Creation Time: \t %s",ctime(&ntfs_time)); + if (!opts.notime) { + time_t ntfs_time = { 0 }; - ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_data_change_time)); - printf("File Altered Time: \t %s",ctime(&ntfs_time)); - - ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_mft_change_time)); - printf("MFT Changed Time: \t %s",ctime(&ntfs_time)); - - ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_access_time)); - printf("Last Acced Time: \t %s",ctime(&ntfs_time)); + if (!opts.epochtime) { + ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->creation_time)); + printf("File Creation Time: \t %s",ctime(&ntfs_time)); + + ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_data_change_time)); + printf("File Altered Time: \t %s",ctime(&ntfs_time)); + + ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_mft_change_time)); + printf("MFT Changed Time: \t %s",ctime(&ntfs_time)); + + ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_access_time)); + printf("Last Accessed Time: \t %s",ctime(&ntfs_time)); + } else { + char *t = asctime(gmtime(&ntfs_time)); + printf("File Creation Time: \t %s",t); + printf("File Altered Time: \t %s",t); + printf("MFT Changed Time: \t %s",t); + printf("Last Accessed Time: \t %s",t); + } + } free(file_name); } From e5bc8a6c1da11b3447bdde4b9dab853b18ec3889 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 22 Jul 2003 21:08:22 +0000 Subject: [PATCH 0610/2994] Leonard: modify ntfsinfo output to help diff'ing BKrev: 3f1da7c6H8Q_4ztyWf6tkK0iT4EQ9w From 369ed9174f90c0fefad763fe376fc6d7018d1efd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 23 Jul 2003 09:33:40 +0000 Subject: [PATCH 0611/2994] AUTHORS Add Leonard to the Authors file. libntfs/win32_io.c Fix a typo when I was Cifying the code. (Thanks to Lode for telling me what I did wrong.) ntfsprogs/ntfsls.c Remove unused line. BKrev: 3f1e5674OnYy8FvP4hSIcOKe5MKtqw From f49595b08b11a3b0b999c840c98bcd2801d525e6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 23 Jul 2003 09:33:40 +0000 Subject: [PATCH 0612/2994] Add Leonard to the Authors file. (Logical change 1.159) --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index cc80d40c..86fcacc5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,6 +6,7 @@ Current active developers on the project are (in alphabetical order): Anton Altaparmakov Matthew J. Fanto Lode Leroy + Leonard Norrgĺrd Richard Russon Szakacsits Szabolcs From 8a4288ed10fe2e03cf893f31ca09c3ede6017962 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 23 Jul 2003 09:33:40 +0000 Subject: [PATCH 0613/2994] Fix a typo when I was Cifying the code. (Thanks to Lode for telling me what I did wrong.) (Logical change 1.159) --- libntfs/win32_io.c | 387 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 387 insertions(+) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index e69de29b..9fecbfaa 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -0,0 +1,387 @@ +/* + * win32_io.c - A stdio-like disk I/O implementation for low-level disk access + * on Win32. Can access an NTFS volume while it is mounted. + * Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Lode Leroy + * Copyright (c) 2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include +#include + +#include +#include + +/* + * Cannot use "../include/types.h" since it conflicts with "wintypes.h". + * define our own... + */ +typedef long long int s64; +struct flock; +struct stat; + +/* + * Need device, but prevent ../include/types.h to be loaded. + */ +#define _NTFS_TYPES_H +#include "device.h" + +#define FORCE_ALIGNED_READ + +typedef struct win32_fd { + HANDLE handle; + LARGE_INTEGER part_start; + LARGE_INTEGER part_end; + LARGE_INTEGER current_pos; +} win32_fd; + +#ifdef DEBUG +static __inline__ void Dprintf(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); +} +#else +static void Dprintf(const char *fmt, ...) +{ +} +#endif + +#define perror(msg) win32_perror(__FILE__,__LINE__,__FUNCTION__,msg) + +int +win32_perror(char *file, int line, char *func, char *msg) +{ + char buffer[1024] = ""; + DWORD err = GetLastError(); + + if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, buffer, + sizeof (buffer), NULL) <= 0) { + sprintf(buffer, "HRESULT 0x%lx", err); + } + fprintf(stderr, "%s(%d):%s\t%s %s\n", file, line, func, buffer, msg); + return 0; +} + +/** + * ntfs_device_win32_open - open a device + * @dev: ntfs device to open + * @flags: open flags + * + * If name is in format "(hd[0-9],[0-9])" then open a partition. + * If name is in format "(hd[0-9])" then open a volume. + * Otherwise open a file. + */ +static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) +{ + int drive = 0, part = 0, numparams; + HANDLE handle; + win32_fd fd; + char drive_char, filename[256]; + + numparams = sscanf(dev->d_name, "/dev/hd%c%d", &drive_char, &part); + drive = toupper(drive_char) - 'A'; + part--; + + if (numparams >= 1) { + if (numparams == 2) + Dprintf("win32_open(%s) -> drive %d, part %d\n", + dev->d_name, drive, part); + else + Dprintf("win32_open(%s) -> drive %d\n", dev->d_name, + drive); + + sprintf(filename, "\\\\.\\PhysicalDrive%d", drive); + + handle = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, + NULL); + + if (handle == INVALID_HANDLE_VALUE) { + char msg[1024]; + + sprintf(msg, "CreateFile(%s) failed", filename); + perror(msg); + return -1; + } + + if (numparams == 1) { + fd.handle = handle; + fd.part_start.QuadPart = 0; + fd.part_end.QuadPart = -1; + fd.current_pos.QuadPart = 0; + } else { + char buffer[10240]; + DWORD numread; + DRIVE_LAYOUT_INFORMATION *drive_layout; + BOOL rvl; + + rvl = DeviceIoControl(handle, + IOCTL_DISK_GET_DRIVE_LAYOUT, NULL, 0, + &buffer, sizeof (buffer), &numread, + NULL); + if (!rvl) { + perror("ioctl failed"); + return -1; + } + + drive_layout = (DRIVE_LAYOUT_INFORMATION *)buffer; + + if (part >= drive_layout->PartitionCount) { + printf("partition %d not found on drive %d", + part, drive); + return -1; + } + + fd.handle = handle; + fd.part_start = drive_layout-> + PartitionEntry[part].StartingOffset; + fd.part_end.QuadPart = drive_layout-> + PartitionEntry[0].StartingOffset. + QuadPart + drive_layout-> + PartitionEntry[0].PartitionLength. + QuadPart; + fd.current_pos.QuadPart = 0; + } + } else { + BY_HANDLE_FILE_INFORMATION info; + BOOL rvl; + + Dprintf("win32_open(%s) -> file\n", dev->d_name); + + handle = CreateFile(dev->d_name, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); + + rvl = GetFileInformationByHandle(handle, &info); + if (!rvl) { + perror("ioctl failed"); + return -1; + } + + fd.handle = handle; + fd.part_start.QuadPart = 0; + fd.part_end.QuadPart = (((s64) info.nFileSizeHigh) << 32) + + ((s64) info.nFileSizeLow); + fd.current_pos.QuadPart = 0; + } + + Dprintf("win32_open(%s) -> %p, offset 0x%llx\n", dev->d_name, dev, + fd.part_start); + + dev->d_private = malloc(sizeof (win32_fd)); + memcpy(dev->d_private, &fd, sizeof (win32_fd)); + + return 0; +} + +static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, + int whence) +{ + LARGE_INTEGER abs_offset; + struct win32_fd *fd = (win32_fd *)dev->d_private; + int disp; + BOOL rvl; + + Dprintf("win32_seek(%lld=0x%llx,%d)\n", offset, offset, whence); + + switch (whence) { + case SEEK_SET: + disp = FILE_BEGIN; + abs_offset.QuadPart = fd->part_start.QuadPart + offset; + break; + case SEEK_CUR: + disp = FILE_CURRENT; + abs_offset.QuadPart = offset; + break; + case SEEK_END: + /* end of partition != end of disk */ + disp = FILE_BEGIN; + abs_offset.QuadPart = fd->part_end.QuadPart + offset; + break; + default: + printf("win32_seek() wrong mode %d\n", whence); + return -1; + } + + rvl = SetFilePointerEx(fd->handle, abs_offset, &fd->current_pos, disp); + if (!rvl) { + perror("SetFilePointer failed"); + return -1; + } + + return offset; +} + +static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) +{ + struct win32_fd *fd = (win32_fd *)dev->d_private; + LARGE_INTEGER base, offset, numtoread; + DWORD numread = 0; + BOOL rvl = -1; + + offset.QuadPart = fd->current_pos.QuadPart & 0x1FF; + base.QuadPart = fd->current_pos.QuadPart - offset.QuadPart; + numtoread.QuadPart = ((count + offset.QuadPart - 1) | 0x1FF) + 1; + + Dprintf("win32_read(fd=%p,b=%p,count=0x%llx)->(%llx+%llx:%llx)\n", fd, + buf, count, base, offset, numtoread); + +#ifndef FORCE_ALIGNED_READ + if (((((long)buf) & ((s64)0x1FF)) == 0) && ((count & ((s64)0x1FF)) == 0) + && ((fd->current_pos.QuadPart & 0x1FF) == 0)) { + Dprintf("normal read\n"); + + rvl = ReadFile(fd->handle, (LPVOID)buf, count, &numread, + (LPOVERLAPPED)NULL); + } else { + BYTE *alignedbuffer; + + Dprintf("aligned read\n"); +#else + { + BYTE *alignedbuffer; +#endif + LARGE_INTEGER new_pos; + + alignedbuffer = (BYTE *)VirtualAlloc(NULL, count, MEM_COMMIT, + PAGE_READWRITE); + + Dprintf("set SetFilePointerEx(%llx)\n", base.QuadPart); + // FIXME: Why is rvl not being checked? (AIA) + rvl = SetFilePointerEx(fd->handle, base, NULL, FILE_BEGIN); + rvl = ReadFile(fd->handle, (LPVOID) alignedbuffer, + numtoread.QuadPart, &numread, + (LPOVERLAPPED)NULL); + + new_pos.QuadPart = fd->current_pos.QuadPart + count; + + Dprintf("reset SetFilePointerEx(%llx)\n", new_pos.QuadPart); + rvl = SetFilePointerEx(fd->handle, new_pos, &fd->current_pos, + FILE_BEGIN); + if (!rvl) + printf("SetFilePointerEx failed"); + + memcpy((void *)buf, alignedbuffer + offset.QuadPart, count); + VirtualFree(alignedbuffer, 0, MEM_RELEASE); + } + if (!rvl) { + perror("ReadFile failed"); + return -1; + } + + if (numread > count) + return count; + return numread; +} + +static int ntfs_device_win32_close(struct ntfs_device *dev) +{ + struct win32_fd *fd = (win32_fd *)dev->d_private; + BOOL rvl; + + Dprintf("win32_close(%p)\n", dev); + + rvl = CloseHandle(fd->handle); + fd->handle = 0; + + free(fd); + + if (!rvl) { + perror("CloseHandle failed"); + return -1; + } + + return 0; +} + +s64 win32_bias(struct ntfs_device *dev) +{ + struct win32_fd *fd = (win32_fd *)dev->d_private; + + return fd->part_start.QuadPart; +} + +s64 win32_filepos(struct ntfs_device *dev) +{ + struct win32_fd *fd = (win32_fd *)dev->d_private; + + return fd->current_pos.QuadPart; +} + +static int ntfs_device_win32_sync(struct ntfs_device *dev) +{ + Dprintf("win32_fsync() unimplemented\n"); + // FIXME: Should be returning error, e.g. ENOTSUP. (AIA) + return 0; +} + +static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buffer, + s64 count) +{ + Dprintf("win32_write() unimplemented\n"); + // FIXME: Should be setting errno to e.g. ENOTSUP. (AIA) + return -1; +} + +static int ntfs_device_win32_stat(struct ntfs_device *dev, struct stat *buf) +{ + Dprintf("win32_fstat() unimplemented\n"); + // FIXME: Should be returning error, e.g. ENOTSUP. (AIA) + return 0; +} + +static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, + void *argp) +{ + Dprintf("win32_ioctl() unimplemented\n"); + // FIXME: Should be returning error, e.g. ENOTSUP. (AIA) + return 0; +} + +extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, + void *b); +static s64 ntfs_device_win32_pread(struct ntfs_device *dev, void *buf, + s64 count, s64 offset) +{ + return ntfs_pread(dev, offset, count, buf); +} + +extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, + const void *b); +static s64 ntfs_device_win32_pwrite(struct ntfs_device *dev, const void *buf, + s64 count, s64 offset) +{ + return ntfs_pwrite(dev, offset, count, buf); +} + +struct ntfs_device_operations ntfs_device_win32_ops = { + .open = ntfs_device_win32_open, + .close = ntfs_device_win32_close, + .seek = ntfs_device_win32_seek, + .read = ntfs_device_win32_read, + .write = ntfs_device_win32_write, + .pread = ntfs_device_win32_pread, + .pwrite = ntfs_device_win32_pwrite, + .sync = ntfs_device_win32_sync, + .stat = ntfs_device_win32_stat, + .ioctl = ntfs_device_win32_ioctl +}; + From 7411e15d6a1ebb22f619c960458f1e114f89a344 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 23 Jul 2003 09:33:40 +0000 Subject: [PATCH 0614/2994] Remove unused line. (Logical change 1.159) --- ntfsprogs/ntfsls.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index fbf19578..2820b861 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -337,7 +337,6 @@ list_entry(ntfsls_dirent* dirent, const uchar_t* name, printf("\n"); } else { ntfs_inode *ni = NULL; - MFT_RECORD *mrec = NULL; ntfs_attr_search_ctx *ctx = NULL; FILE_NAME_ATTR *file_name_attr = NULL; ATTR_RECORD *attr = NULL; From 5f82dd8d27952b2212cdcfdb747a8a750176cf67 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 23 Jul 2003 09:45:39 +0000 Subject: [PATCH 0615/2994] Add right character. (Logical change 1.160) --- ntfsprogs/ntfsinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 40816d33..93428510 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -67,7 +67,7 @@ void version (void) printf (" 2002 Matthew J. Fanto\n"); printf (" 2002 Anton Altaparmakov\n"); printf (" 2002-2003 Richard Russon\n"); - printf (" 2003 Leonard Norrgard\n"); + printf (" 2003 Leonard Norrgĺrd\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } From bc021293a05e2a75b99bb7f66e590e3968cf9d92 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 23 Jul 2003 09:45:39 +0000 Subject: [PATCH 0616/2994] Add right character. BKrev: 3f1e59439I-K0CfzRErSW96rHZrrEA From 58f51f36e0009bc3e470ddeadbea3626cb7ee783 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 23 Jul 2003 09:46:57 +0000 Subject: [PATCH 0617/2994] Add stamp-h1 to ignore file. (Logical change 1.161) --- BitKeeper/etc/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 5b399b45..b2c6db41 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -11,6 +11,7 @@ config.h config.cache config.status stamp-h +stamp-h1 libtool ntfsprogs.spec From 19c21b1fafb18741c3df0eb21463afb0d280a643 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 23 Jul 2003 09:46:57 +0000 Subject: [PATCH 0618/2994] Add stamp-h1 to ignore file. BKrev: 3f1e59916MeebAuUVmjNafyoQ_TChA From 8fb8844f11958cdf9b0429af41f808a1a0bc41cf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 29 Jul 2003 09:12:55 +0000 Subject: [PATCH 0619/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/07/29 10:12:42+01:00 cantab.net!aia21 Update ignore BKrev: 3f263a97iXqiJp9yS1oPUUJpOIzavQ From 8c6751d9ad4147dae211d5d201f5ce5c796962d6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 29 Jul 2003 09:12:55 +0000 Subject: [PATCH 0620/2994] auto-union 2003/07/29 10:12:42+01:00 cantab.net!aia21 Update ignore (Logical change 1.162) --- BitKeeper/etc/ignore | 46 +++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index b2c6db41..89f9fc5c 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -1,35 +1,31 @@ + # Bitkeeper -BitKeeper/*/* -PENDING/* - # configure -Makefile -*/Makefile -ntfsprogs/*.8 -config.log -config.h -config.cache -config.status -stamp-h -stamp-h1 -libtool -ntfsprogs.spec - # general build products +# specific programs +*/*.o +*/.*swp */.deps/* */.libs/* -*/*.o -libntfs/*.l? -tags -TAGS -*/tags +*/Makefile */TAGS +*/tags .*swp -*/.*swp - -# specific programs +BitKeeper/*/* +Makefile +PENDING/* +TAGS +config.cache +config.h +config.log +config.status +libntfs/*.l? +libtool +ntfsprogs.spec +ntfsprogs/*.8 ntfsprogs/dumplog ntfsprogs/mkntfs +ntfsprogs/ntfsclone ntfsprogs/ntfscluster ntfsprogs/ntfsdump_logfile ntfsprogs/ntfsfix @@ -39,4 +35,6 @@ ntfsprogs/ntfsresize ntfsprogs/ntfstruncate ntfsprogs/ntfsundelete ntfsprogs/ntfswipe -ntfsprogs/ntfsclone +stamp-h +stamp-h1 +tags From 18341d53b07d3ac1076201b6037007b9d931c38f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 29 Jul 2003 10:12:43 +0000 Subject: [PATCH 0621/2994] tidy up win32_io.c, especially error returns. I hope this works on windows... (Logical change 1.163) --- libntfs/win32_io.c | 102 +++++++++++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 32 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 9fecbfaa..842bfad7 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -26,6 +26,7 @@ #include #include +#include /* * Cannot use "../include/types.h" since it conflicts with "wintypes.h". @@ -35,9 +36,9 @@ typedef long long int s64; struct flock; struct stat; -/* - * Need device, but prevent ../include/types.h to be loaded. - */ +#include "config.h" + +/* Need device, but prevent ../include/types.h to be loaded. */ #define _NTFS_TYPES_H #include "device.h" @@ -60,24 +61,20 @@ static __inline__ void Dprintf(const char *fmt, ...) va_end(ap); } #else -static void Dprintf(const char *fmt, ...) -{ -} +static __inline__ void Dprintf(const char *fmt, ...) {} #endif #define perror(msg) win32_perror(__FILE__,__LINE__,__FUNCTION__,msg) -int -win32_perror(char *file, int line, char *func, char *msg) +int win32_perror(char *file, int line, char *func, char *msg) { char buffer[1024] = ""; DWORD err = GetLastError(); if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, buffer, - sizeof (buffer), NULL) <= 0) { + sizeof(buffer), NULL) <= 0) sprintf(buffer, "HRESULT 0x%lx", err); - } - fprintf(stderr, "%s(%d):%s\t%s %s\n", file, line, func, buffer, msg); + fprintf(stderr, "%s(%d): %s\t%s %s\n", file, line, func, buffer, msg); return 0; } @@ -117,9 +114,11 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) if (handle == INVALID_HANDLE_VALUE) { char msg[1024]; + int err = errno; sprintf(msg, "CreateFile(%s) failed", filename); perror(msg); + errno = err; return -1; } @@ -139,15 +138,19 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) &buffer, sizeof (buffer), &numread, NULL); if (!rvl) { + int err = errno; perror("ioctl failed"); + errno = err; return -1; } drive_layout = (DRIVE_LAYOUT_INFORMATION *)buffer; if (part >= drive_layout->PartitionCount) { - printf("partition %d not found on drive %d", - part, drive); + int err = errno; + fprintf(stderr, "partition %d not found on " + "drive %d\n", part, drive); + errno = err; return -1; } @@ -172,7 +175,9 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) rvl = GetFileInformationByHandle(handle, &info); if (!rvl) { + int err = errno; perror("ioctl failed"); + errno = err; return -1; } @@ -214,16 +219,25 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, case SEEK_END: /* end of partition != end of disk */ disp = FILE_BEGIN; + if (fd.part_end.QuadPart == -1) { + fprintf(stderr, "win32_seek: position relative to end " + "of disk not implemented\n"); + errno = ENOTSUP; + return -1; + } abs_offset.QuadPart = fd->part_end.QuadPart + offset; break; default: printf("win32_seek() wrong mode %d\n", whence); + errno = EINVAL; return -1; } rvl = SetFilePointerEx(fd->handle, abs_offset, &fd->current_pos, disp); if (!rvl) { + int err = errno; perror("SetFilePointer failed"); + errno = err; return -1; } @@ -235,7 +249,7 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) struct win32_fd *fd = (win32_fd *)dev->d_private; LARGE_INTEGER base, offset, numtoread; DWORD numread = 0; - BOOL rvl = -1; + BOOL rvl; offset.QuadPart = fd->current_pos.QuadPart & 0x1FF; base.QuadPart = fd->current_pos.QuadPart - offset.QuadPart; @@ -251,6 +265,12 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) rvl = ReadFile(fd->handle, (LPVOID)buf, count, &numread, (LPOVERLAPPED)NULL); + if (!rvl) { + int err = errno; + perror("ReadFile failed"); + errno = err; + return -1; + } } else { BYTE *alignedbuffer; @@ -265,27 +285,41 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) PAGE_READWRITE); Dprintf("set SetFilePointerEx(%llx)\n", base.QuadPart); - // FIXME: Why is rvl not being checked? (AIA) + rvl = SetFilePointerEx(fd->handle, base, NULL, FILE_BEGIN); + if (!rvl) { + int err = errno; + fprintf(stderr, "SetFilePointerEx failed\n"); + VirtualFree(alignedbuffer, 0, MEM_RELEASE); + errno = err; + return -1; + } + rvl = ReadFile(fd->handle, (LPVOID) alignedbuffer, numtoread.QuadPart, &numread, (LPOVERLAPPED)NULL); - + if (!rvl) { + int err = errno; + fprintf(stderr, "ReadFile failed\n"); + VirtualFree(alignedbuffer, 0, MEM_RELEASE); + errno = err; + return -1; + } new_pos.QuadPart = fd->current_pos.QuadPart + count; - Dprintf("reset SetFilePointerEx(%llx)\n", new_pos.QuadPart); rvl = SetFilePointerEx(fd->handle, new_pos, &fd->current_pos, FILE_BEGIN); - if (!rvl) - printf("SetFilePointerEx failed"); + if (!rvl) { + int err = errno; + fprintf(stderr, "SetFilePointerEx failed\n"); + VirtualFree(alignedbuffer, 0, MEM_RELEASE); + errno = err; + return -1; + } memcpy((void *)buf, alignedbuffer + offset.QuadPart, count); VirtualFree(alignedbuffer, 0, MEM_RELEASE); } - if (!rvl) { - perror("ReadFile failed"); - return -1; - } if (numread > count) return count; @@ -305,7 +339,9 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) free(fd); if (!rvl) { + int err = errno; perror("CloseHandle failed"); + errno = err; return -1; } @@ -328,36 +364,37 @@ s64 win32_filepos(struct ntfs_device *dev) static int ntfs_device_win32_sync(struct ntfs_device *dev) { - Dprintf("win32_fsync() unimplemented\n"); - // FIXME: Should be returning error, e.g. ENOTSUP. (AIA) - return 0; + fprintf(stderr, "win32_fsync() unimplemented\n"); + errno = ENOTSUP; + return -1; } static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buffer, s64 count) { - Dprintf("win32_write() unimplemented\n"); - // FIXME: Should be setting errno to e.g. ENOTSUP. (AIA) + fprintf(stderr, "win32_write() unimplemented\n"); + errno = ENOTSUP; return -1; } static int ntfs_device_win32_stat(struct ntfs_device *dev, struct stat *buf) { - Dprintf("win32_fstat() unimplemented\n"); - // FIXME: Should be returning error, e.g. ENOTSUP. (AIA) + fprintf(stderr, "win32_fstat() unimplemented\n"); + errno = ENOTSUP; return 0; } static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, void *argp) { - Dprintf("win32_ioctl() unimplemented\n"); - // FIXME: Should be returning error, e.g. ENOTSUP. (AIA) + fprintf(stderr, "win32_ioctl() unimplemented\n"); + errno = ENOTSUP; return 0; } extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, void *b); + static s64 ntfs_device_win32_pread(struct ntfs_device *dev, void *buf, s64 count, s64 offset) { @@ -366,6 +403,7 @@ static s64 ntfs_device_win32_pread(struct ntfs_device *dev, void *buf, extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, const void *b); + static s64 ntfs_device_win32_pwrite(struct ntfs_device *dev, const void *buf, s64 count, s64 offset) { From 02f6f8349b41065a0afd96ffcb365f07db1c3f3f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 29 Jul 2003 10:12:43 +0000 Subject: [PATCH 0622/2994] tidy up win32_io.c, especially error returns. I hope this works on windows... BKrev: 3f26489bJo8Buvqdg-S5_yd1XRrVGw From 162c1b916105e22050c5e95fa562ad66179b2c5c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 29 Jul 2003 16:28:09 +0000 Subject: [PATCH 0623/2994] Lode Leroy: Fix typo in win32_io.c. (Logical change 1.164) --- libntfs/win32_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 842bfad7..f0ef4076 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -219,7 +219,7 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, case SEEK_END: /* end of partition != end of disk */ disp = FILE_BEGIN; - if (fd.part_end.QuadPart == -1) { + if (fd->part_end.QuadPart == -1) { fprintf(stderr, "win32_seek: position relative to end " "of disk not implemented\n"); errno = ENOTSUP; From 5968bd4d06c196c84259369b0d7bb17f8e3ccaa4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 29 Jul 2003 16:28:09 +0000 Subject: [PATCH 0624/2994] Lode Leroy: Fix typo in win32_io.c. BKrev: 3f26a099xPGhBL0OzJ1wpLVLOsJQLQ From c15a40f6494d3f15666555b7d73ae6e28c23321f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 30 Jul 2003 13:45:37 +0000 Subject: [PATCH 0625/2994] Add autom4te.cache to ignore as well as ntfsls. (Logical change 1.165) --- BitKeeper/etc/ignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 89f9fc5c..5b845556 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -15,6 +15,7 @@ BitKeeper/*/* Makefile PENDING/* TAGS +autom4te.cache/* config.cache config.h config.log @@ -31,6 +32,7 @@ ntfsprogs/ntfsdump_logfile ntfsprogs/ntfsfix ntfsprogs/ntfsinfo ntfsprogs/ntfslabel +ntfsprogs/ntfsls ntfsprogs/ntfsresize ntfsprogs/ntfstruncate ntfsprogs/ntfsundelete From af45ca75798a3b46c13cbd740eb9a3018a97a412 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 30 Jul 2003 13:45:37 +0000 Subject: [PATCH 0626/2994] Cleanup ntfsls: - formatting - some error checking - memory leaks (close inodes and release search contexts) - add lots of FIXMEs where work is needed (Logical change 1.165) --- ntfsprogs/ntfsls.c | 275 ++++++++++++++++++++++++++------------------- 1 file changed, 159 insertions(+), 116 deletions(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 2820b861..a433f807 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -2,6 +2,7 @@ * ntfsls - Part of the Linux-NTFS project. * * Copyright (c) 2003 Lode Leroy + * Copyright (c) 2003 Anton Altaparmakov * * This utility will list a directory's files. * @@ -56,9 +57,9 @@ static struct options { char *path; } opts; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * version - Print version information about the program @@ -67,13 +68,13 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -void version (void) +void version(void) { - printf ("\n%s v%s - Display information about an NTFS Volume.\n\n", - EXEC_NAME, VERSION); - printf ("Copyright (c)\n"); - printf (" 2003 Lode Leroy\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + printf("\n%s v%s - Display information about an NTFS Volume.\n\n", + EXEC_NAME, VERSION); + printf("Copyright (c)\n"); + printf(" 2003 Lode Leroy\n"); + printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -83,9 +84,9 @@ void version (void) * * Return: none */ -void usage (void) +void usage(void) { - printf ("\nUsage: %s [options] -d /dev/hda1 -p /WINDOWS\n" + printf("\nUsage: %s [options] -d /dev/hda1 -p /WINDOWS\n" "\n" " -d --device NTFS volume\n" " -p --path Relative path to the directory\n" @@ -101,7 +102,7 @@ void usage (void) " -s Display system files\n" "\n", EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); + printf("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -113,7 +114,7 @@ void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -int parse_options (int argc, char *argv[]) +int parse_options(int argc, char *argv[]) { static const char *sopt = "-fh?qvVd:p:asxliFRHSA"; static const struct option lopt[] = { @@ -143,13 +144,13 @@ int parse_options (int argc, char *argv[]) opterr = 0; /* We'll handle the errors, thank you. */ memset(&opts, 0, sizeof(opts)); - opts.device = "/dev/hda1"; + opts.device = NULL; opts.path = "/"; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { - case 'd': /* A non-option argument */ - opts.device = argv[optind-1]; + case 'd': + opts.device = argv[optind - 1]; break; case 'p': opts.path = optarg; @@ -201,23 +202,25 @@ int parse_options (int argc, char *argv[]) opts.archive++; break; default: - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + Eprintf("Unknown option '%s'.\n", argv[optind - 1]); err++; break; } } - if (help || ver) { + if (help || ver) opts.quiet = 0; - } else { + else { if (opts.device == NULL) { if (argc > 1) - Eprintf ("You must specify exactly one device.\n"); + Eprintf("You must specify exactly one " + "device.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + Eprintf("You may not use --quiet and --verbose at the " + "same time.\n"); err++; } } @@ -230,7 +233,6 @@ int parse_options (int argc, char *argv[]) return (!err && !help && !ver); } - /** * ucstos - convert unicode-character string to ASCII * @dest: points to buffer to receive the converted string @@ -290,100 +292,105 @@ int stoucs(uchar_t *dest, const char *src, int maxlen) index of the first byte is start */ void dump_mem(unsigned char *buf, int start, int length) { - int offs,i; - for(offs=0;offs=length) { putchar(' '); } else - if(buf[offs+i]>31 && buf[offs+i]<128)putchar(buf[offs+i] -); - else putchar('.'); - putchar('\n'); - } + int offs, i; + + for (offs = 0; offs < length; offs += 16) { + printf("%8.8X ", start + offs); + for (i = 0; i < 16; i++) + printf(offs + i < length ? "%2X " : " ", buf[offs+i]); + for (i = 0; i < 16; i++) { + if (offs + i >= length) + putchar(' '); + else if (buf[offs + i] > 31 && buf[offs + i] < 128) + putchar(buf[offs + i]); + else putchar('.'); + } + putchar('\n'); + } } typedef struct { - ntfs_volume* vol; + ntfs_volume* vol; } ntfsls_dirent; -int -list_entry(ntfsls_dirent* dirent, const uchar_t* name, - const int name_len, const int name_type, const s64 pos, - const MFT_REF mref, const unsigned dt_type) { - +// FIXME: Should we print errors as we go along? (AIA) +int list_entry(ntfsls_dirent *dirent, const uchar_t *name, + const int name_len, const int name_type, const s64 pos, + const MFT_REF mref, const unsigned dt_type) { char filename[200]; - ucstos(filename, name, min(name_len+1,sizeof(filename))); + + ucstos(filename, name, min(name_len + 1, sizeof(filename))); + // FIXME: error checking... (AIA) + // FIXME: Why not use ntfs_mbstoucs() from libntfs? (AIA) //printf("[%s\t,%d,%d]\n", filename, name_type, dt_type); - if ((filename[0] == '$') && (!opts.sys)) { + + if ((filename[0] == '$') && (!opts.sys)) return 0; - } else - if (name_type == 0 && !opts.all) { + if (name_type == 0 && !opts.all) return 0; - } - if (((name_type & 3) == 1) && (opts.dos!=0)) { + if (((name_type & 3) == 1) && (opts.dos != 0)) return 0; - } - if (((name_type & 3) == 2) && (opts.dos!=1)) { + if (((name_type & 3) == 2) && (opts.dos != 1)) return 0; - } - if (dt_type == NTFS_DT_DIR && opts.classify) { - sprintf(filename+strlen(filename),"/"); - } + if (dt_type == NTFS_DT_DIR && opts.classify) + sprintf(filename + strlen(filename), "/"); if (!opts.lng) { printf(filename); printf("\n"); } else { - ntfs_inode *ni = NULL; - ntfs_attr_search_ctx *ctx = NULL; - FILE_NAME_ATTR *file_name_attr = NULL; - ATTR_RECORD *attr = NULL; - time_t ntfs_time; + s64 filesize = 0; + ntfs_inode *ni; + ntfs_attr_search_ctx *ctx; + FILE_NAME_ATTR *file_name_attr; + ATTR_RECORD *attr; + time_t ntfs_time; + char t_buf[26]; - ni = ntfs_inode_open(dirent->vol, mref); - if (!ni) { - return -1; - } - //dump_mem(ni, 0, sizeof(ntfs_inode)); + ni = ntfs_inode_open(dirent->vol, mref); + if (!ni) + return -1; + //dump_mem(ni, 0, sizeof(ntfs_inode)); - ctx = ntfs_attr_get_search_ctx(ni, ni->mrec); - if (!ctx) { - return -1; - } - if(ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - return -1; - } - attr = ctx->attr; - //dump_mem(attr, 0, sizeof(*attr)); + ctx = ntfs_attr_get_search_ctx(ni, ni->mrec); + if (!ctx) + return -1; - file_name_attr = (FILE_NAME_ATTR*)((char *)attr + le16_to_cpu(attr->value_offset)); - if (!file_name_attr) { - return -1; - } - //dump_mem(file_name_attr, 0, sizeof(*file_name_attr)); + if (ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, + 0, ctx)) + return -1; + attr = ctx->attr; + //dump_mem(attr, 0, sizeof(*attr)); - ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_data_change_time)); - char t_buf[26]; - strcpy(t_buf, ctime(&ntfs_time)); - t_buf[16] = '\0'; + file_name_attr = (FILE_NAME_ATTR *)((char *)attr + + le16_to_cpu(attr->value_offset)); + if (!file_name_attr) + return -1; + //dump_mem(file_name_attr, 0, sizeof(*file_name_attr)); - s64 filesize = 0; - if (dt_type != NTFS_DT_DIR) { - if(!ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - attr = ctx->attr; - filesize = ntfs_get_attribute_value_length(attr); + ntfs_time = ntfs2utc(sle64_to_cpu( + file_name_attr->last_data_change_time)); + strcpy(t_buf, ctime(&ntfs_time)); + t_buf[16] = '\0'; + + if (dt_type != NTFS_DT_DIR) { + if (!ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, + NULL, 0, ctx)) + filesize = ntfs_get_attribute_value_length( + ctx->attr); } - } - if (opts.inode) { - printf("%12lld %18lld %s\n", filesize, mref, filename); - } else { - printf("%12lld %s %s\n", filesize, t_buf+4, filename); - } + /* Release atrtibute search context and close the inode. */ + ntfs_attr_put_search_ctx(ctx); + ntfs_inode_close(ni); + + if (opts.inode) + printf("%12lld %18lld %s\n", filesize, mref, + filename); + else + printf("%12lld %s %s\n", filesize, t_buf + 4, + filename); } - return 0; } @@ -393,47 +400,83 @@ list_entry(ntfsls_dirent* dirent, const uchar_t* name, * Start from here. * * Return: 0 Success, the program worked - * 1 Error, something went wrong + * 1 Error, parsing mount options failed + * 2 Error, mount attempt failed + * 3 Error, failed to open root directory + * 3 Error, failed to open directory in search path */ int main(int argc, char **argv) { + u64 ino; + s64 pos; ntfs_volume *vol; + ntfs_inode *ni; + char *p; + int len; + uchar_t unicode[100]; + ntfsls_dirent dirent; - if (!parse_options (argc, argv)) + if (!parse_options(argc, argv)) { + // FIXME: Print error... (AIA) return 1; + } utils_set_locale(); - vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); - - if (!vol) + vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); + if (!vol) { + // FIXME: Print error... (AIA) return 2; + } - s64 pos = 0; - u64 ino; - ntfs_inode* ni = vol->mft_ni; - uchar_t unicode[100]; - int len; + /* Open the root directory of the ntfs volume. */ ni = ntfs_inode_open(vol, FILE_root); - char* p = opts.path; - while (p && *p && *p == '/') p++; + if (!ni) { + // FIXME: Print error... (AIA) + ntfs_umount(vol, FALSE); + return 3; + } + + p = opts.path; + while (p && *p && *p == '/') + p++; while (p && *p) { - char* q = strchr(p, '/'); + char *q = strchr(p, '/'); if (q != NULL) { *q = '\0'; q++; } - len = stoucs(unicode, p, sizeof(unicode)); - ino = ntfs_inode_lookup_by_name(ni, unicode, len); - ni = ntfs_inode_open(vol, ino); - p = q; - while (p && *p && *p == '/') p++; - } - ntfsls_dirent dirent; - dirent.vol = vol; - ntfs_readdir(ni, &pos, &dirent, list_entry); - ntfs_umount (vol, FALSE); + len = stoucs(unicode, p, sizeof(unicode)); + // FIXME: error checking... (AIA) + + ino = ntfs_inode_lookup_by_name(ni, unicode, len); + // FIXME: error checking... (AIA) + + /* Finished with the inode; release it. */ + ntfs_inode_close(ni); + + ni = ntfs_inode_open(vol, ino); + if (!ni) { + // FIXME: Print error... (AIA) + ntfs_umount(vol, FALSE); + return 4; + } + + p = q; + while (p && *p && *p == '/') + p++; + } + pos = 0; + memset(&dirent, 0, sizeof(dirent)); + dirent.vol = vol; + ntfs_readdir(ni, &pos, &dirent, (ntfs_filldir_t)list_entry); + // FIXME: error checking... (AIA) + + /* Finished with the inode; release it. */ + ntfs_inode_close(ni); + + ntfs_umount(vol, FALSE); return 0; } From 9fd2d6d51b2081a939d47d247a3d5058e6662944 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 30 Jul 2003 13:45:37 +0000 Subject: [PATCH 0627/2994] Cleanup ntfsls: - formatting - some error checking - memory leaks (close inodes and release search contexts) - add lots of FIXMEs where work is needed Also add ntfsls and autom4te.cache to ignore list of bitkeeper. BKrev: 3f27cc01jv8BQp4YMpffBQM2LPWauQ From 75c3fe2009805ad58678704e130d632f2ee9e4be Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 31 Jul 2003 14:12:36 +0000 Subject: [PATCH 0628/2994] Auto merged 2003/07/31 15:10:10+01:00 cantab.net!aia21 Linux/types.h no longer needed at all. (Logical change 1.166) --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c6a75e84..75ea3b1f 100644 --- a/configure.ac +++ b/configure.ac @@ -106,7 +106,7 @@ AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h getopt.h sys/stat.h \ - sys/types.h linux/types.h asm/byteorder.h linux/major.h linux/fd.h]) + sys/types.h asm/byteorder.h linux/major.h linux/fd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL From 85f9732874326d8e4158a8c47d119954c4b157c9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 31 Jul 2003 14:12:36 +0000 Subject: [PATCH 0629/2994] Include stdio.h. Needed by Cygwin. (Logical change 1.166) --- include/volume.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/volume.h b/include/volume.h index 336e065c..ce9684c2 100644 --- a/include/volume.h +++ b/include/volume.h @@ -24,6 +24,7 @@ #include "config.h" +#include #include #ifdef HAVE_MNTENT_H # include From 2c391fce0b30b61c8e0e979fbdc00b2c0ba37314 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 31 Jul 2003 14:12:36 +0000 Subject: [PATCH 0630/2994] Linux/types.h no longer needed at all. (Logical change 1.166) --- config.h.in | 3 --- 1 file changed, 3 deletions(-) diff --git a/config.h.in b/config.h.in index 5fce5eb8..2fae2ab4 100644 --- a/config.h.in +++ b/config.h.in @@ -45,9 +45,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_MAJOR_H -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_TYPES_H - /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H From bbde93dacf24ea58c7ec0588378f33cc7c769d39 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 31 Jul 2003 14:12:36 +0000 Subject: [PATCH 0631/2994] Linux/types.h no longer needed at all. stdint.h only include if present. (Logical change 1.166) --- include/types.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/types.h b/include/types.h index 58e3d91e..5f6ae2c9 100644 --- a/include/types.h +++ b/include/types.h @@ -2,7 +2,7 @@ * types.h - Misc type definitions not related to on-disk structure. Part of * the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -23,9 +23,12 @@ #ifndef _NTFS_TYPES_H #define _NTFS_TYPES_H +#include "config.h" + +#ifdef HAVE_STDINT_H #include +#endif #include -#include typedef uint8_t u8; /* Unsigned types of an exact size */ typedef uint16_t u16; From 255abc11b272652fab37ef0a5ba8daba126ad883 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 31 Jul 2003 14:12:36 +0000 Subject: [PATCH 0632/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/07/31 15:10:10+01:00 cantab.net!aia21 Linux/types.h no longer needed at all. stdint.h only include if present. Update ignore file. Use hasmntopt only if it exists. __LINUX__ no longer works. Use linux instead. Include stdio.h from volume.h. Needed by Cygwin. sys/ioctl.h always needed in disk_io.c. BKrev: 3f2923d4T-fcpWTgUyvL5O0T2ZP7-g From 951bacc20b90c27978a70ebf34571ec43d9d550c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 31 Jul 2003 14:12:36 +0000 Subject: [PATCH 0633/2994] Use hasmntopt only if it exists. (Logical change 1.166) --- libntfs/volume.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index ca518b45..f83a6571 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1,7 +1,7 @@ /* * volume.c - NTFS volume handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -1049,12 +1049,13 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) *mnt_flags = NTFS_MF_MOUNTED; if (!strcmp(mnt->mnt_dir, "/")) *mnt_flags |= NTFS_MF_ISROOT; +#ifdef HAVE_HASMNTOPT if (hasmntopt(mnt, "ro") && !hasmntopt(mnt, "rw")) *mnt_flags |= NTFS_MF_READONLY; +#endif return 0; } - -#endif +#endif /* HAVE_MNTENT_H */ /** * ntfs_check_if_mounted - check if an ntfs volume is currently mounted From c4c50f12704f154aa3c732858d21760bd9baa98a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 31 Jul 2003 14:12:36 +0000 Subject: [PATCH 0634/2994] __LINUX__ no longer works. Use linux instead. (Logical change 1.166) --- ntfsprogs/mkntfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 2f2571fd..1c8fd65d 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -84,7 +84,7 @@ #endif #include -#if defined(__LINUX__) && defined(_IO) && !defined(BLKSSZGET) +#if defined(linux) && defined(_IO) && !defined(BLKSSZGET) # define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytse. */ #endif From 066303c4c66cf7fd8bf1e3bcb24aa5b33d84bcfb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 31 Jul 2003 14:12:36 +0000 Subject: [PATCH 0635/2994] auto-union 2003/07/31 15:10:10+01:00 cantab.net!aia21 Update ignore file. (Logical change 1.166) From bef4012b5e1aea6ac8eb94f261f324c82d8e259c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 31 Jul 2003 14:12:36 +0000 Subject: [PATCH 0636/2994] sys/ioctl.h always needed. __LINUX__ no longer works. Use linux instead. (Logical change 1.166) --- libntfs/disk_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c index 7e665e7d..9a234198 100644 --- a/libntfs/disk_io.c +++ b/libntfs/disk_io.c @@ -29,8 +29,8 @@ #include #include #include +#include #ifdef HAVE_LINUX_FD_H -# include # include #endif @@ -40,7 +40,7 @@ #include "debug.h" #include "device.h" -#if defined(__LINUX__) && defined(_IO) && !defined(BLKGETSIZE) +#if defined(linux) && defined(_IO) && !defined(BLKGETSIZE) # define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ #endif From f554268a08f523ec307f7d9c71bac696bf35d84a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 31 Jul 2003 14:13:56 +0000 Subject: [PATCH 0637/2994] Copy over from ntfsprogs. (Logical change 1.167) --- BitKeeper/etc/ignore | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 5b845556..d5e199d8 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -1,29 +1,34 @@ - # Bitkeeper -# configure -# general build products -# specific programs -*/*.o -*/.*swp -*/.deps/* -*/.libs/* -*/Makefile -*/TAGS -*/tags -.*swp BitKeeper/*/* -Makefile PENDING/* -TAGS + +# configure autom4te.cache/* -config.cache -config.h +Makefile +*/Makefile +ntfsprogs/*.8 config.log +config.h +config.cache config.status -libntfs/*.l? +stamp-h +stamp-h1 libtool ntfsprogs.spec -ntfsprogs/*.8 + +# general build products +*/.deps/* +*/.libs/* +*/*.o +libntfs/*.l? +tags +TAGS +*/tags +*/TAGS +.*swp +*/.*swp + +# specific programs ntfsprogs/dumplog ntfsprogs/mkntfs ntfsprogs/ntfsclone @@ -37,6 +42,3 @@ ntfsprogs/ntfsresize ntfsprogs/ntfstruncate ntfsprogs/ntfsundelete ntfsprogs/ntfswipe -stamp-h -stamp-h1 -tags From fb2833bef3fcaa3a9a2660c6d6e1e16ace899159 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 31 Jul 2003 14:13:56 +0000 Subject: [PATCH 0638/2994] Copy over ignore from ntfsprogs. BKrev: 3f292424whyjk_5b8aSI4XrEhtkBDA From 8b9987bf4d47e0bd6a56c019bf33dc4bdd63bfc6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 3 Aug 2003 14:54:06 +0000 Subject: [PATCH 0639/2994] - Return ENOTDIR errno if inode is not a directory. - Fix stupid bug where we attempt to close ia_na when it is null. (Logical change 1.168) --- libntfs/dir.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libntfs/dir.c b/libntfs/dir.c index 443322b5..8b9c3046 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -612,6 +612,11 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, return -1; } + if (!(dir_ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)) { + errno = ENOTDIR; + return -1; + } + vol = dir_ni->vol; Dprintf("Entering for inode 0x%Lx, *pos 0x%Lx.\n", @@ -898,7 +903,8 @@ EOD: done: if (bmp_na) ntfs_attr_close(bmp_na); - ntfs_attr_close(ia_na); + if (ia_na) + ntfs_attr_close(ia_na); #ifdef DEBUG if (!rc) Dprintf("EOD, *pos 0x%Lx, returning 0.\n", (long long)*pos); @@ -916,7 +922,8 @@ err_out: ntfs_attr_put_search_ctx(ctx); if (bmp_na) ntfs_attr_close(bmp_na); - ntfs_attr_close(ia_na); + if (ia_na) + ntfs_attr_close(ia_na); errno = eo; return -1; } From 7130beb80742c972dedd51ab2119e98c6b6e4d3f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 3 Aug 2003 14:54:06 +0000 Subject: [PATCH 0640/2994] - Some code tidyups. - Display file when the specified path includes a file name at the end rather than a directory. (Logical change 1.168) --- ntfsprogs/ntfsls.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index a433f807..28ee565e 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -40,21 +40,21 @@ static const char *EXEC_NAME = "ntfsls"; static struct options { - char *device; /* Device/File to work with */ - int quiet; /* Less output */ - int verbose; /* Extra output */ - int force; /* Override common sense */ + char *device; /* Device/File to work with */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int force; /* Override common sense */ int all; int sys; int dos; int lng; - int inode; + int inode; int classify; int readonly; int hidden; int archive; int system; - char *path; + char *path; } opts; GEN_PRINTF(Eprintf, stderr, NULL, FALSE) @@ -127,7 +127,6 @@ int parse_options(int argc, char *argv[]) { "classify", no_argument, NULL, 'F' }, { "system", no_argument, NULL, 'S' }, { "dos", no_argument, NULL, 'x' }, - { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "quiet", no_argument, NULL, 'q' }, @@ -310,7 +309,7 @@ void dump_mem(unsigned char *buf, int start, int length) } typedef struct { - ntfs_volume* vol; + ntfs_volume *vol; } ntfsls_dirent; // FIXME: Should we print errors as we go along? (AIA) @@ -437,6 +436,9 @@ int main(int argc, char **argv) return 3; } + memset(unicode, 0, sizeof(unicode)); + len = 0; + p = opts.path; while (p && *p && *p == '/') p++; @@ -467,11 +469,24 @@ int main(int argc, char **argv) while (p && *p && *p == '/') p++; } + + /* + * We now are at the final path component. If it is a file just + * list it. If it is a directory, list its contents. + */ pos = 0; memset(&dirent, 0, sizeof(dirent)); dirent.vol = vol; - ntfs_readdir(ni, &pos, &dirent, (ntfs_filldir_t)list_entry); - // FIXME: error checking... (AIA) + if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) { + ntfs_readdir(ni, &pos, &dirent, (ntfs_filldir_t)list_entry); + // FIXME: error checking... (AIA) + } else if (len) { + // FIXME: Ought to lookup the actual name in the mft record + // and display that... (AIA) + list_entry(&dirent, unicode, len, 3, pos, ni->mft_no, + NTFS_DT_REG); + // FIXME: error checking... (AIA) + } /* Finished with the inode; release it. */ ntfs_inode_close(ni); @@ -480,9 +495,3 @@ int main(int argc, char **argv) return 0; } -/* - * Local Variables: - * c-basic-offset:4 - * tab-width:8 - * End: - */ From 67c8cd67fd166920d47dadb18b1e7d7fe839053e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 3 Aug 2003 14:54:06 +0000 Subject: [PATCH 0641/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs-devel into cantab.net:/usr/src/ntfsprogs-devel 2003/08/03 15:47:56+01:00 cantab.net!aia21 libntfs/dir.c - Return ENOTDIR errno if inode is not a directory. - Fix stupid bug where we attempt to close ia_na when it is null. ntfsprogs/ntfsls.c - Some code tidyups. - Display file when the specified path includes a file name at the end rather than a directory. BKrev: 3f2d220eHAoK4dOsZ64pllX-kkJGvg From f2dd1f454f8414a4c650768680056f54526d6d4b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 3 Aug 2003 14:56:03 +0000 Subject: [PATCH 0642/2994] Auto merged 2003/08/03 15:52:54+01:00 cantab.net!aia21 - Return ENOTDIR errno if inode is not a directory. - Fix stupid bug where we attempt to close ia_na when it is null. (Logical change 1.169) --- libntfs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/dir.c b/libntfs/dir.c index 8b9c3046..9abb7921 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1,7 +1,7 @@ /* * dir.c - Directory handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published From a51e921e911e9a605e27a9c70b1fca997e47a3fc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 3 Aug 2003 14:56:03 +0000 Subject: [PATCH 0643/2994] Manual merge and Changelog update for ntfsls. 2003/08/03 15:53:25+01:00 cantab.net!aia21 Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into cantab.net:/usr/src/ntfsprogs 2003/08/03 15:52:54+01:00 cantab.net!aia21 dir.c: - Return ENOTDIR errno if inode is not a directory. - Fix stupid bug where we attempt to close ia_na when it is null. BKrev: 3f2d2283bIRV0rbcO6qYcidkcF2BmQ From 020e2d769edceb92d34257fd2f68dde9c98b5c89 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 3 Aug 2003 14:56:03 +0000 Subject: [PATCH 0644/2994] Update. 2003/08/03 15:52:54+01:00 cantab.net!aia21 Update changelog (Logical change 1.169) --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1e25bd4a..d31cabcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,11 @@ xx/xx/2003 - 1.8.0-devel - Work in progress. - Abstract low level device operations (include/device,h and libntfs/device.c) and adapt utilities to changes. - Added ntfsclone utility written by Szabolcs Szakacsits. + - Added ntfsls utility written by Lode Leroy. + - Fix bugs in dir.c::ntfs_readdir() where we try to close ia_na when + it is NULL. + - Return errno ENOTDIR from dir.c::ntfs_readdir() when called with a + file inode. 13/02/2003 - 1.7.1 - Urgent bug fixes. - Urgent bug fixes in ntfsresize (Szabolcs Szakacsits): From 6334ed505642af35022dbb77bc34df35119ad8ec Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 8 Aug 2003 11:29:04 +0000 Subject: [PATCH 0645/2994] - Configure no longer needs to check for linux/types.h. - Build ntfscluster and ntfsls as /bin programs by default and ntfsclone as /sbin program by default. BKrev: 3f338980CwrJ7NfekCDcIgmIPoeOEg From 1e9ef6afae254d24ad237f487e469e4df063e056 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 8 Aug 2003 11:29:04 +0000 Subject: [PATCH 0646/2994] Build ntfscluster and ntfsls as /bin programs by default and ntfsclone as /sbin program by default. (Logical change 1.170) --- ntfsprogs/Makefile.am | 11 +++++------ ntfsprogs/Makefile.in | 20 +++++++++----------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 049806fc..62eefd6c 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -25,10 +25,9 @@ endif # Workaround to make REALLYSTATIC work with automake 1.5. LINK=$(STATIC_LINK) $(LIBTOOL_LINK) -bin_PROGRAMS = ntfsfix ntfsinfo -sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate \ - ntfscluster ntfsclone ntfsls +bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls +sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 @@ -65,8 +64,6 @@ ntfsresize_SOURCES = ntfsresize.c utils.c utils.h ntfsresize_LDADD = $(AM_LIBS) ntfsresize_LDFLAGS = $(AM_LFLAGS) -# We don't distribute these - ntfsclone_SOURCES = ntfsclone.c utils.c utils.h ntfsclone_LDADD = $(AM_LIBS) ntfsclone_LDFLAGS = $(AM_LFLAGS) @@ -79,6 +76,8 @@ ntfsls_SOURCES = ntfsls.c utils.c utils.h ntfsls_LDADD = $(AM_LIBS) ntfsls_LDFLAGS = $(AM_LFLAGS) +# We don't distribute these + ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 32b95b81..3c6be661 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -111,11 +111,9 @@ install_sh = @install_sh@ # Workaround to make REALLYSTATIC work with automake 1.5. LINK = $(STATIC_LINK) $(LIBTOOL_LINK) -bin_PROGRAMS = ntfsfix ntfsinfo -sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate \ - ntfscluster ntfsclone ntfsls - +bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls +sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 @@ -153,8 +151,6 @@ ntfsresize_SOURCES = ntfsresize.c utils.c utils.h ntfsresize_LDADD = $(AM_LIBS) ntfsresize_LDFLAGS = $(AM_LFLAGS) - -# We don't distribute these ntfsclone_SOURCES = ntfsclone.c utils.c utils.h ntfsclone_LDADD = $(AM_LIBS) ntfsclone_LDFLAGS = $(AM_LFLAGS) @@ -167,6 +163,8 @@ ntfsls_SOURCES = ntfsls.c utils.c utils.h ntfsls_LDADD = $(AM_LIBS) ntfsls_LDFLAGS = $(AM_LFLAGS) + +# We don't distribute these ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) @@ -188,11 +186,11 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 \ ntfsprogs.8 ntfsresize.8 ntfsundelete.8 EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) dumplog$(EXEEXT) \ - ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) ntfscluster$(EXEEXT) \ - ntfsclone$(EXEEXT) ntfsls$(EXEEXT) -bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) + ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) +bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ + ntfsls$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) ntfsundelete$(EXEEXT) \ - ntfsresize$(EXEEXT) + ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) am_dumplog_OBJECTS = dumplog.$(OBJEXT) From 83bd769b7effe2287826213e201faa978363ee4e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 8 Aug 2003 11:29:04 +0000 Subject: [PATCH 0647/2994] No longer need linux/types.h. (Logical change 1.170) --- configure | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configure b/configure index 75859839..e6f3206a 100755 --- a/configure +++ b/configure @@ -8729,13 +8729,12 @@ fi - for ac_header in fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h getopt.h sys/stat.h \ - sys/types.h linux/types.h asm/byteorder.h linux/major.h linux/fd.h + sys/types.h asm/byteorder.h linux/major.h linux/fd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then From 9ef4f626657fbdef71aa7c7a32d7d93831322927 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 8 Aug 2003 11:32:25 +0000 Subject: [PATCH 0648/2994] Auto merged 2003/08/08 12:32:08+01:00 cantab.net!aia21 Linux/types.h no longer needed. (Logical change 1.171) From e117a302f34145c778721db9b09f9e30e023ff47 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 8 Aug 2003 11:32:25 +0000 Subject: [PATCH 0649/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/08/08 12:32:11+01:00 cantab.net!aia21 Linux/types.h no longer needed. BKrev: 3f338a49sIePPv1DscY044JRfWe86Q From 03918d98782a6c0acaaa8e378f862a60a0810edf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 12 Aug 2003 10:17:18 +0000 Subject: [PATCH 0650/2994] Auto merged 2003/08/11 22:56:10+01:00 flatcap.org!flatcap make default fillbyte 0 flags logic bug (Logical change 1.172) --- ntfsprogs/ntfsundelete.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 1b686d62..dfcd2ea1 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -489,6 +489,9 @@ int parse_options (int argc, char *argv[]) } } + if (opts.fillbyte == -1) + opts.fillbyte = 0; + if (ver) version(); if (help || err) From e9ccaa1a31a14bd9dd2a670e43622bd2bd8442eb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 12 Aug 2003 10:17:18 +0000 Subject: [PATCH 0651/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/08/11 22:56:10+01:00 flatcap.org!flatcap minor bugfixes BKrev: 3f38beaemGod6cfI9vSIMMC8aHmV_Q From 515eab7cfb3678ccfef6080dd56ec0195a043157 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Tue, 12 Aug 2003 10:17:18 +0000 Subject: [PATCH 0652/2994] mem leak typo (Logical change 1.172) --- ntfsprogs/ntfscluster.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 8dd4d921..e02f63c5 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -247,10 +247,11 @@ int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) if (!in_use) { if (s_begin == s_end) - printf ("clusters isn't in use\n"); + printf ("cluster isn't in use\n"); else printf ("clusters aren't in use\n"); - return 0; + result = 0; + goto free; } // first, is the cluster in use in $Bitmap? From 5384e35cce33311d6dbcb0a00603277d3fa5c438 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 26 Aug 2003 13:05:16 +0000 Subject: [PATCH 0653/2994] Add ntfsls man page (not finished yet but a good start - it still needs descriptions for most of the options)... BKrev: 3f4b5b0cLTx0BYSxy3weBZRPYQGwNA From 73e0cb25b28764302fe64e279ffe4e0808430109 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 26 Aug 2003 13:05:16 +0000 Subject: [PATCH 0654/2994] Add ntfsls man page. (Logical change 1.173) --- ntfsprogs/Makefile.am | 2 +- ntfsprogs/ntfsprogs.8.in | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 62eefd6c..e092e6ec 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -30,7 +30,7 @@ sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ - ntfsundelete.8 ntfsresize.8 ntfsprogs.8 + ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index d819a987..60ea64f1 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -1,8 +1,8 @@ .\" Copyright (c) 2002 Richard Russon. All Rights Reserved. -.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. +.\" Copyright (c) 2002-2003 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSPROGS 8 "May 2002" "Linux-NTFS version @VERSION@" +.TH NTFSPROGS 8 "August 2003" "Linux-NTFS version @VERSION@" .SH OVERVIEW .B ntfsprogs @@ -28,6 +28,10 @@ or directories within it. .PP .BR ntfslabel (8) : Show, or set, an NTFS partition's volume label. +.SS ntfsls +.PP +.BR ntfsls (8) +: List information about files in a directory residing on an NTFS partition. .SS ntfsresize .PP .BR ntfsresize (8) @@ -39,8 +43,7 @@ or directories within it. .SH AUTHORS .PP -The tools have been written by Anton Altaparmakov, Richard Russon, Matthew Fanto -and Szabolcs Szakacsits. +The tools have been written by Anton Altaparmakov, Richard Russon, Matthew Fanto, Szabolcs Szakacsits, and Lode Leroy. .SH AVAILABILITY The From 66d9310d87993433e3f104d5f212124dd804a9d1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 26 Aug 2003 13:05:16 +0000 Subject: [PATCH 0655/2994] Cleanup option parsing, help text, etc so they are all consistent with each other. Also remove unused options. (Logical change 1.173) --- ntfsprogs/ntfsls.c | 87 ++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 50 deletions(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 28ee565e..98b38a4d 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -45,15 +45,11 @@ static struct options { int verbose; /* Extra output */ int force; /* Override common sense */ int all; - int sys; + int system; int dos; int lng; int inode; int classify; - int readonly; - int hidden; - int archive; - int system; char *path; } opts; @@ -86,20 +82,20 @@ void version(void) */ void usage(void) { - printf("\nUsage: %s [options] -d /dev/hda1 -p /WINDOWS\n" + printf("\nUsage: %s [options] -d /dev/hda1\n" "\n" - " -d --device NTFS volume\n" - " -p --path Relative path to the directory\n" - " -l --long Display long info\n" - " -F --classify Display classification\n" - " -f --force Use less caution\n" - " -q --quiet Less output\n" - " -v --verbose More output\n" - " -V --version Display version information\n" - " -h --help Display this help\n" - " -a Display all files\n" - " -x Use short (DOS 8.3) names\n" - " -s Display system files\n" + " -a --all Display all files\n" + " -d DEVICE --device DEVICE NTFS volume\n" + " -F --classify Display classification\n" + " -f --force Use less caution\n" + " -h -? --help Display this help\n" + " -l --long Display long info\n" + " -p PATH --path PATH Directory whose contents to list\n" + " -q --quiet Less output\n" + " -s --system Display system files\n" + " -V --version Display version information\n" + " -v --verbose More output\n" + " -x --dos Use short (DOS 8.3) names\n" "\n", EXEC_NAME); printf("%s%s\n", ntfs_bugs, ntfs_home); @@ -116,22 +112,21 @@ void usage(void) */ int parse_options(int argc, char *argv[]) { - static const char *sopt = "-fh?qvVd:p:asxliFRHSA"; + static const char *sopt = "-ad:Ffh?ilp:qsVvx"; static const struct option lopt[] = { - { "device", required_argument, NULL, 'd' }, - { "path", required_argument, NULL, 'p' }, { "all", no_argument, NULL, 'a' }, - { "sys", no_argument, NULL, 's' }, - { "long", no_argument, NULL, 'l' }, - { "inode", no_argument, NULL, 'i' }, + { "device", required_argument, NULL, 'd' }, { "classify", no_argument, NULL, 'F' }, - { "system", no_argument, NULL, 'S' }, - { "dos", no_argument, NULL, 'x' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, + { "inode", no_argument, NULL, 'i' }, + { "long", no_argument, NULL, 'l' }, + { "path", required_argument, NULL, 'p' }, { "quiet", no_argument, NULL, 'q' }, - { "verbose", no_argument, NULL, 'v' }, + { "system", no_argument, NULL, 's' }, { "version", no_argument, NULL, 'V' }, + { "verbose", no_argument, NULL, 'v' }, + { "dos", no_argument, NULL, 'x' }, { NULL, 0, NULL, 0 }, }; @@ -149,7 +144,7 @@ int parse_options(int argc, char *argv[]) while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { case 'd': - opts.device = argv[optind - 1]; + opts.device = optarg; break; case 'p': opts.path = optarg; @@ -171,7 +166,7 @@ int parse_options(int argc, char *argv[]) ver++; break; case 'x': - opts.dos++; + opts.dos = 1; break; case 'l': opts.lng++; @@ -186,20 +181,8 @@ int parse_options(int argc, char *argv[]) opts.all++; break; case 's': - opts.sys++; - break; - case 'R': - opts.readonly++; - break; - case 'H': - opts.hidden++; - break; - case 'S': opts.system++; break; - case 'A': - opts.archive++; - break; default: Eprintf("Unknown option '%s'.\n", argv[optind - 1]); err++; @@ -316,27 +299,31 @@ typedef struct { int list_entry(ntfsls_dirent *dirent, const uchar_t *name, const int name_len, const int name_type, const s64 pos, const MFT_REF mref, const unsigned dt_type) { - char filename[200]; + char filename[255 + 2]; ucstos(filename, name, min(name_len + 1, sizeof(filename))); // FIXME: error checking... (AIA) // FIXME: Why not use ntfs_mbstoucs() from libntfs? (AIA) //printf("[%s\t,%d,%d]\n", filename, name_type, dt_type); - if ((filename[0] == '$') && (!opts.sys)) + if ((filename[0] == '$') && (!opts.system)) return 0; - if (name_type == 0 && !opts.all) + if (name_type == FILE_NAME_POSIX && !opts.all) return 0; - if (((name_type & 3) == 1) && (opts.dos != 0)) + if (((name_type & FILE_NAME_WIN32_AND_DOS) == FILE_NAME_WIN32) && + opts.dos) return 0; - if (((name_type & 3) == 2) && (opts.dos != 1)) + if (((name_type & FILE_NAME_WIN32_AND_DOS) == FILE_NAME_DOS) && + !opts.dos) return 0; if (dt_type == NTFS_DT_DIR && opts.classify) sprintf(filename + strlen(filename), "/"); if (!opts.lng) { - printf(filename); - printf("\n"); + if (!opts.inode) + printf("%s\n", filename); + else + printf("%18lld %s\n", mref, filename); } else { s64 filesize = 0; ntfs_inode *ni; @@ -384,8 +371,8 @@ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, ntfs_inode_close(ni); if (opts.inode) - printf("%12lld %18lld %s\n", filesize, mref, - filename); + printf("%18lld %12lld %s %s\n", mref, filesize, + t_buf + 4, filename); else printf("%12lld %s %s\n", filesize, t_buf + 4, filename); From d17ac3693eab7b8b74633a3ad723112084e3ce9d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 26 Aug 2003 13:05:16 +0000 Subject: [PATCH 0656/2994] Initial revision --- ntfsprogs/ntfsls.8.in | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ntfsprogs/ntfsls.8.in diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in new file mode 100644 index 00000000..e69de29b From e16ad7372fa37c5444dd268dd57584816ef2855d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 26 Aug 2003 13:05:16 +0000 Subject: [PATCH 0657/2994] (Logical change 1.173) --- ntfsprogs/ntfsls.8.in | 120 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index e69de29b..f2c2ec83 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -0,0 +1,120 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2003 Anton Altaparmakov. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSLS 8 "August 2003" "Linux-NTFS version @VERSION@" +.SH NAME +ntfsls \- list directory contents on an NTFS file system +.SH SYNOPSIS +.B ntfsls +[ +.B \-a +| +.B \-\-all +] +[ +.B \-F +| +.B \-\-classify +] +[ +.B \-f +| +.B \-\-force +] +[ +.B \-h +| +.B \-? +| +.B \-\-help +] +[ +.B \-i +| +.B \-\-inode +] +[ +.B \-l +| +.B \-\-long +] +[ +.B \-p +| +.B \-\-path +.I PATH +] +[ +.B \-q +| +.B \-\-quiet +] +[ +.B \-s +| +.B \-\-system +] +[ +.B \-V +| +.B \-\-version +] +[ +.B \-v +| +.B \-\-verbose +] +[ +.B \-x +| +.B \-\-dos +] +.B \-d +| +.B \-\-device +.I DEVICE +.SH DESCRIPTION +.B ntfsls +is used to list information about the files specified by the +.I PATH +option (the root directory by default). +.I DEVICE +is the special file corresponding to the device (e.g +.IR /dev/hdXX ). +.SH OPTIONS +.TP +.B \-a, \-\-all +Display all files. If this option is not specified file names in the POSIX +namespace will not be displayed. +.TP +.BI "\-d, \-\-device" " DEVICE" +The special file corresponding to the device that contains the NTFS partition +to read. +.TP +.B \-V, \-\-version +Print the version number of +.B ntfsls +and exit. +.TP +.B \-h, \-?, \-\-help +Print the usage information of +.B ntfsls +and exit. +.SH BUGS +We are not aware of any bugs. If you find a bug, please report it to +. Thank you. +.SH AUTHOR +This version of +.B ntfsls +has been written by Lode Leroy and enhanced by +Anton Altaparmakov . This man page has been written by +Anton Altaparmakov. +.SH AVAILABILITY +.B ntfsls +is part of the Linux-NTFS project and is available for download from +http://sf.net/project/showfiles.php?group_id=13956 in source (tar ball and +rpm) and pre-compiled binary (i386 rpm and deb) form. +.SH SEE ALSO +.BR ntfsprogs (8) + From 745ce5a1414968e80fd2d05eefc75797c8d8fb6d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 26 Aug 2003 13:05:16 +0000 Subject: [PATCH 0658/2994] Update configure to generate ntfsls man page. (Logical change 1.173) --- configure | 3 ++- configure.ac | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index e6f3206a..e68fa24a 100755 --- a/configure +++ b/configure @@ -11026,7 +11026,7 @@ done # Makefiles to be created by configure. - ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile libntfs/Makefile ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" + ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile libntfs/Makefile ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -11606,6 +11606,7 @@ do "ntfsprogs/ntfsfix.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsfix.8" ;; "ntfsprogs/ntfsinfo.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsinfo.8" ;; "ntfsprogs/ntfslabel.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfslabel.8" ;; + "ntfsprogs/ntfsls.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsls.8" ;; "ntfsprogs/ntfsprogs.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsprogs.8" ;; "ntfsprogs/ntfsresize.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsresize.8" ;; "ntfsprogs/ntfsundelete.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsundelete.8" ;; diff --git a/configure.ac b/configure.ac index 75ea3b1f..8580c650 100644 --- a/configure.ac +++ b/configure.ac @@ -143,6 +143,7 @@ AC_CONFIG_FILES([ ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 + ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 From 3f4226ebb75de508641565a8acc69a198739bafc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 28 Aug 2003 09:36:26 +0000 Subject: [PATCH 0659/2994] Manual merge 2003/08/27 20:32:43+01:00 flatcap.org!flatcap add ntfscluster to the main build (Logical change 1.174) From 68be3e6f3fee997d3eabb44296671e31e22b8a48 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 28 Aug 2003 09:36:26 +0000 Subject: [PATCH 0660/2994] Manual merge 2003/08/27 20:32:44+01:00 flatcap.org!flatcap minor tweaks BKrev: 3f4dcd1a46XiXzFZwsKqONXha63Mtw From 90eafc8fafd0618c3ac0c38d3a9cde7342ab22bf Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Thu, 28 Aug 2003 09:36:26 +0000 Subject: [PATCH 0661/2994] an extra note for undelete (Logical change 1.174) --- ntfsprogs/ntfsundelete.8.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index 8a533654..bb08b8fb 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -274,6 +274,10 @@ Recover the file with this inode number. This option can be combined with .BR \-\-destination , and .BR \-\-byte . +.sp +When the file is recovered it will be given its original name, unless the +.B "\-\-output" +option is used. .TP .B \-v .br From d1929b01f241ebeee36500f7ad82910d38d8c631 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Aug 2003 13:01:46 +0000 Subject: [PATCH 0662/2994] - Finish the ntfsls man page. - Fix mft reference display bug in ntfsls. - Update display in ntfsls to match /bin/ls. BKrev: 3f4f4eba7GrcC4fO6ZB2fcuFGrrYkw From c606599117d07799d41fe7645dd8459b47f7bc66 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Aug 2003 13:01:46 +0000 Subject: [PATCH 0663/2994] Finish the manpage for ntfsls. (Logical change 1.175) --- ntfsprogs/ntfsls.8.in | 51 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index f2c2ec83..3b9e93da 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -88,19 +88,56 @@ is the special file corresponding to the device (e.g Display all files. If this option is not specified file names in the POSIX namespace will not be displayed. .TP -.BI "\-d, \-\-device" " DEVICE" -The special file corresponding to the device that contains the NTFS partition -to read. +.B \-F, \-\-classify +Append indicator (one of */=@|) to entries. +.TP +.B \-f, \-\-force +Force execution. For example necessary to run on an NTFS partition stored in +a normal file. +.TP +.B \-h, \-?, \-\-help +Print the usage information of +.B ntfsls +and exit. +.TP +.B \-i, \-\-inode +Print inode number of each file. This is the MFT reference number in NTFS +terminology. +.TP +.B \-l, \-\-long +Use a long listing format. +.TP +.B \-p, \-\-path +The directory whose contents to list or the file (including the path) about +which to display information. +.TP +.B \-q, \-\-quiet +Suppress some debug/warning/error messages. +.TP +.B \-s, \-\-system +Unless this options is specified, all files beginning with a dollar sign +character will not be listed as these files are usually system files. .TP .B \-V, \-\-version Print the version number of .B ntfsls and exit. .TP -.B \-h, \-?, \-\-help -Print the usage information of -.B ntfsls -and exit. +.B \-v, \-\-verbose +Display more debug/warning/error messages. +.TP +.B \-x, \-\-dos +Display short file names, i.e. files in the DOS namespace, instead of long +file names, i.e. files in the WIN32 namespace. +.TP +.BI "\-d, \-\-device" " DEVICE" +The special file corresponding to the device that contains the NTFS partition +to read. If you want to use an image of an NTFS partition stored on a normal +file, you will also need to specify the +.B \-f +or +.B \-\-force +options. .SH BUGS We are not aware of any bugs. If you find a bug, please report it to . Thank you. From 644142fbe751d28ec6b2938c82ddb1b627b4072a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Aug 2003 13:01:46 +0000 Subject: [PATCH 0664/2994] Fix a bug with the display of mft reference numbers. Update display to match /bin/ls. (Logical change 1.175) --- ntfsprogs/ntfsls.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 98b38a4d..3bc3734c 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -323,7 +323,7 @@ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, if (!opts.inode) printf("%s\n", filename); else - printf("%18lld %s\n", mref, filename); + printf("%7lld %s\n", MREF(mref), filename); } else { s64 filesize = 0; ntfs_inode *ni; @@ -371,11 +371,10 @@ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, ntfs_inode_close(ni); if (opts.inode) - printf("%18lld %12lld %s %s\n", mref, filesize, + printf("%7lld %8lld %s %s\n", MREF(mref), filesize, t_buf + 4, filename); else - printf("%12lld %s %s\n", filesize, t_buf + 4, - filename); + printf("%8lld %s %s\n", filesize, t_buf + 4, filename); } return 0; } From d0dc48fce8558978f478027dfdc51a99c19f558b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Aug 2003 13:01:46 +0000 Subject: [PATCH 0665/2994] update (Logical change 1.175) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index d31cabcc..f034f666 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,8 @@ xx/xx/2003 - 1.8.0-devel - Work in progress. it is NULL. - Return errno ENOTDIR from dir.c::ntfs_readdir() when called with a file inode. + - Added man page for ntfsls. + - Lots of extensions and cleanups to ntfsls. 13/02/2003 - 1.7.1 - Urgent bug fixes. - Urgent bug fixes in ntfsresize (Szabolcs Szakacsits): From 0d4c8d197b80655c3e427dfcb03eaa3097718f20 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Aug 2003 16:17:15 +0000 Subject: [PATCH 0666/2994] Initial revision --- ntfsprogs/ntfsclone.8.in | 0 ntfsprogs/ntfscluster.8.in | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 ntfsprogs/ntfsclone.8.in create mode 100644 ntfsprogs/ntfscluster.8.in diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfscluster.8.in b/ntfsprogs/ntfscluster.8.in new file mode 100644 index 00000000..e69de29b From c5b2c4eaed4aa1cd4a054aa2d3f3aed86d26a4a9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Aug 2003 16:17:15 +0000 Subject: [PATCH 0667/2994] (Logical change 1.176) From 11ba8d206024f127b4407a25b87f6e35ee7b4b06 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Aug 2003 16:17:15 +0000 Subject: [PATCH 0668/2994] Update for ntfsclone and ntfscluster man pages (currently these are blank!). BKrev: 3f4f7c8bZ6SCgzdyJ48eosOieHPuKw From 3e00ceca93faba72798022eb09e98966be75c74e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 29 Aug 2003 16:17:15 +0000 Subject: [PATCH 0669/2994] Update for ntfsclone and ntfscluster man pages. (Logical change 1.176) --- configure | 4 +++- configure.ac | 2 ++ ntfsprogs/Makefile.am | 3 ++- ntfsprogs/ntfsprogs.8.in | 8 ++++++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/configure b/configure index e68fa24a..9e573441 100755 --- a/configure +++ b/configure @@ -11026,7 +11026,7 @@ done # Makefiles to be created by configure. - ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile libntfs/Makefile ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" + ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile libntfs/Makefile ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -11603,6 +11603,8 @@ do "libntfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libntfs/Makefile" ;; "ntfsprogs/Makefile" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/Makefile" ;; "ntfsprogs/mkntfs.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/mkntfs.8" ;; + "ntfsprogs/ntfsclone.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsclone.8" ;; + "ntfsprogs/ntfscluster.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscluster.8" ;; "ntfsprogs/ntfsfix.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsfix.8" ;; "ntfsprogs/ntfsinfo.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsinfo.8" ;; "ntfsprogs/ntfslabel.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfslabel.8" ;; diff --git a/configure.ac b/configure.ac index 8580c650..fc57eec8 100644 --- a/configure.ac +++ b/configure.ac @@ -140,6 +140,8 @@ AC_CONFIG_FILES([ libntfs/Makefile ntfsprogs/Makefile ntfsprogs/mkntfs.8 + ntfsprogs/ntfsclone.8 + ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index e092e6ec..84243ca7 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -30,7 +30,8 @@ sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ - ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 + ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ + ntfsclone.8 ntfscluster.8 EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index 60ea64f1..60d62236 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -14,6 +14,14 @@ available for free and come with full source code. .PP .BR mkntfs (8) : Format a partition using NTFS. +.SS ntfsclone +.PP +.BR ntfsclone (8) +: Efficiently create/restore an image of an NTFS partition. +.SS ntfscluster +.PP +.BR ntfscluster (8) +: Locate the owner of any given sector or cluster on an NTFS partition. .SS ntfsfix .PP .BR ntfsfix (8) From 72ac9ba05b7e4c58759b43e745edfb8e9e89ce93 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 5 Sep 2003 21:37:08 +0000 Subject: [PATCH 0670/2994] a couple of bugfixes start on info (Logical change 1.177) --- ntfsprogs/ntfscluster.c | 90 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 82 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index e02f63c5..a80206a7 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -67,7 +67,7 @@ void version (void) void usage (void) { printf ("\nUsage: %s [options] device\n" - " -i --info Print information about the volume\n" + " -i --info Print information about the volume (default)\n" " -c range --cluster range Look for objects in this range of clusters\n" " -s range --sector range Look for objects in this range of sectors\n" /* " -l --last Find the last file on the volume\n" */ @@ -204,7 +204,8 @@ int parse_options (int argc, char **argv) } if (opts.action == act_error) { - Eprintf ("You may only specify one action: --info, --cluster, --sector or --last.\n"); + //Eprintf ("You may only specify one action: --info, --cluster, --sector or --last.\n"); + Eprintf ("You may only specify one action: --info, --cluster or --sector.\n"); err++; } else if (opts.range_begin > opts.range_end) { Eprintf ("The range must be in ascending order.\n"); @@ -220,6 +221,79 @@ int parse_options (int argc, char **argv) return (!err && !help && !ver); } + +/** + * free_space - Calculate the amount of space which isn't in use + */ +u64 free_space (ntfs_volume *vol) +{ + return 0; +} + +/** + * user_space - Calculate the amount of space of the user's files + */ +u64 user_space (ntfs_volume *vol) +{ + return 0; +} + +/** + * meta_space - Calculate the amount of space used by the filesystem structures + */ +u64 meta_space (ntfs_volume *vol) +{ + return 0; +} + +/** + * info - Display information about the volume + */ +int info (ntfs_volume *vol) +{ + u64 a, b, c, d, e, f, g, h, i, j, k, l, m, n; + int cps; + u64 fs, us, ms; + + cps = vol->cluster_size_bits - vol->sector_size_bits; + fs = free_space (vol); + ms = meta_space (vol); + us = user_space (vol); + + a = vol->sector_size; + b = vol->cluster_size; + c = 1 << cps; + d = vol->nr_clusters >> cps; + e = vol->nr_clusters; + f = fs / a; + g = fs / b; + h = fs * 100 / a / d; + i = us / a; + j = us / b; + k = us * 100 / a / d; + l = ms / a; + m = ms / b; + n = ms * 100 / a / d; + + printf ("bytes per sector : %lld\n", a); + printf ("bytes per cluster : %lld\n", b); + printf ("sectors per cluster : %lld\n", c); + printf ("sectors per volume : %lld\n", d); + printf ("clusters per volume : %lld\n", e); + printf ("sectors of free space : %lld\n", f); + printf ("clusters of free space : %lld\n", g); + printf ("percentage free space : %lld\n", h); + printf ("sectors of user data : %lld\n", i); + printf ("clusters of user data : %lld\n", j); + printf ("percentage user data : %lld\n", k); + printf ("sectors of metadata : %lld\n", l); + printf ("clusters of metadata : %lld\n", m); + printf ("percentage metadata : %lld\n", n); + + return 0; +} + + /** * cluster_find */ @@ -261,7 +335,7 @@ int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) ntfs_attr_search_ctx *ctx; if (!utils_mftrec_in_use (vol, i)) { - //printf ("%d skipped\n", i); + //printf ("%lld skipped\n", i); continue; } @@ -326,9 +400,8 @@ int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) printf ("inode %lld %s", i, buffer); utils_attr_get_name (vol, ctx->attr, buffer, sizeof (buffer)); printf ("%c%s\n", PATH_SEP, buffer); - //printf ("\n"); } - break; + break; // XXX if verbose, we should list all matching runs } } @@ -344,6 +417,7 @@ free: return result; } + /** * main - Begin here * @@ -373,8 +447,8 @@ int main (int argc, char *argv[]) else Qprintf ("Searching for sector range %lld-%lld\n", opts.range_begin, opts.range_end); /* Convert to clusters */ - opts.range_begin <<= (vol->cluster_size_bits - vol->sector_size_bits); - opts.range_end <<= (vol->cluster_size_bits - vol->sector_size_bits); + opts.range_begin >>= (vol->cluster_size_bits - vol->sector_size_bits); + opts.range_end >>= (vol->cluster_size_bits - vol->sector_size_bits); result = cluster_find (vol, opts.range_begin, opts.range_end); break; case act_cluster: @@ -391,7 +465,7 @@ int main (int argc, char *argv[]) */ case act_info: default: - printf ("Info\n"); + info (vol); break; } From cd9e3ed9700be5aa08735fcbbfe207b00443863c Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 5 Sep 2003 21:37:08 +0000 Subject: [PATCH 0671/2994] comment to help folding (Logical change 1.177) --- libntfs/attrib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index b04bb382..c80ddfaf 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2458,6 +2458,9 @@ put_err_out: return -1; } +/** + * ntfs_attr_make_resident - + */ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) { // FIXME: For now we cheat and assume there is no attribute list From 9f0d02f8ea1e7f37d5d10abc880d33fa6891c508 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 5 Sep 2003 21:37:08 +0000 Subject: [PATCH 0672/2994] start documenting things (Logical change 1.177) --- ntfsprogs/ntfscluster.8.in | 144 +++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/ntfsprogs/ntfscluster.8.in b/ntfsprogs/ntfscluster.8.in index e69de29b..2dbd91a7 100644 --- a/ntfsprogs/ntfscluster.8.in +++ b/ntfsprogs/ntfscluster.8.in @@ -0,0 +1,144 @@ +.\" Copyright (c) 2003 Richard Russon. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSCLUSTER 8 "September 2003" "Linux\-NTFS version @VERSION@" +.SH NAME +ntfscluster \- identify files in a specified region of an NTFS volume. +.SH SYNOPSIS +.B ntfscluster +[ +.I options +] +.B device +.SH DESCRIPTION +.B ntfscluster +has three modes of operation: +.IR info , +.I sector +and +.IR cluster . +.SS Info +.PP +The default mode, +.I info +is currently not implemented. It will display general infomation about the NTFS +volume when it is working. +.SS Sector +.PP +The +.I sector +mode will display a list of files that have data in the specified range of +sectors. +.SS Cluster +The +.I cluster +mode will display a list of files that have data in the specified range of +clusters. When the cluster size is one sector, this will be equivalent to the +.I sector +mode of operation. +.SH OPTIONS +Below is a summary of all the options that +.B ntfscluster +accepts. All options have two equivalent names. The short name is preceded by +.BR \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.BR \-fv +is equivalent to +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. +.TP +.BI "\-c " range +.br +.ns +.TP +.BI "\-\-cluster " range +Any files whose data is in this range of clusters will be displayed. +.TP +.B \-f +.br +.ns +.TP +.B \-\-force +This will override some sensible defaults, such as not working with a mounted +volume. Use this option with caution. +.TP +.B \-\-help +Show a list of options with a brief description of each one. +.TP +.B \-i +.br +.ns +.TP +.B \-\-info +This option is not yet implemented. +.TP +.BI \-q +.br +.ns +.TP +.BI \-\-quiet +Reduce the amount of output to a minimum. Naturally, it doesn't make sense to +combine this option with +.TP +.B \-s +.br +.ns +.TP +.B \-\-sector +Any files whose data is in this range of sectors will be displayed. +.TP +.B \-v +.br +.ns +.TP +.B \-\-verbose +Increase the amount of output that +.B ntfscluster +prints. +.TP +.B \-V +.br +.ns +.TP +.B \-\-version +Show the version number, copyright and license +.BR ntfscluster . +.SH EXAMPLES +Get some information about the volume /dev/hda1. +.RS +.sp +.B ntfscluster /dev/hda1 +.sp +.RE +Look for files in the first 500 clusters of /dev/hda1. +.RS +.sp +.B ntfscluster -c 0-500 /dev/hda1 +.sp +.SH BUGS +The +.I info +mode isn't implemented yet. This program is quite limited, but it has no known +bugs. If you find one, please send an email to +.nh + +.hy +.SH AUTHOR +.B ntfscluster +was written by Richard Russon (FlatCap) +.br +If you find this tool useful, make FlatCap happy and send him an email. +.SH AVAILABILITY +.B ntfscluster +is part of the linux\-ntfs package and is available from +.br +.nh +http://linux\-ntfs.sourceforge.net/downloads.html +.hy +.SH SEE ALSO +.BR ntfsinfo (8), +.BR ntfsprogs (8) + From 17c3d0be6f72f0fcf267b17d9fecab97961c41cb Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 5 Sep 2003 21:37:08 +0000 Subject: [PATCH 0673/2994] stop ntfscluster hanging on certain extent inodes BKrev: 3f590204b0L4ufaNHzQZHXt39eeYsQ From 74d5b2a49236faeb62ce659cd0e2a68884c44dd1 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 5 Sep 2003 21:37:08 +0000 Subject: [PATCH 0674/2994] work around what's probably a bug in ntfs_attr_lookup (with some extent inodes, ntfs_attr_lookup keeps returning the same attribute) need more time to investigate (Logical change 1.177) --- ntfsprogs/utils.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index b554e0c8..294e9e18 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -395,6 +395,7 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) ntfs_volume *vol; ntfs_attr_search_ctx *ctx; ATTR_RECORD *rec; + ATTR_RECORD *oldrec; FILE_NAME_ATTR *attr; int name_space; MFT_REF parent = FILE_root; @@ -420,11 +421,15 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) //printf ("i = %d, inode = %p (%lld)\n", i, inode, inode->mft_no); name_space = 4; + oldrec = NULL; while ((rec = find_attribute (AT_FILE_NAME, ctx))) { + if (rec == oldrec) + break; + oldrec = rec; /* We know this will always be resident. */ attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); - if (attr->file_name_type >= name_space) { //XXX find the ... + if (attr->file_name_type > name_space) { //XXX find the ... continue; } @@ -502,8 +507,8 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) */ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int bufsize) { - int len, namelen, offset = 0; - char *name = NULL; + int len, namelen; + char *name; ATTR_DEF *attrdef; // flags: attr, name, or both @@ -512,6 +517,7 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int attrdef = ntfs_attr_find_in_attrdef (vol, attr->type); if (attrdef) { + name = NULL; namelen = ntfs_ucsnlen (attrdef->name, sizeof (attrdef->name)); if (ntfs_ucstombs (attrdef->name, namelen, &name, namelen) < 0) { Eprintf ("Couldn't translate attribute type to current locale.\n"); @@ -529,24 +535,27 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int return 0; } - offset += len; - if (!attr->name_length) { return 0; } + buffer += len; + bufsize -= len; + + name = NULL; namelen = attr->name_length; if (ntfs_ucstombs ((uchar_t *)((char *)attr + attr->name_offset), namelen, &name, namelen) < 0) { Eprintf ("Couldn't translate attribute name to current locale.\n"); // ? + len = snprintf (buffer, bufsize, ""); return 0; } - len = snprintf (buffer + offset, bufsize - offset, "(%s)", name); + len = snprintf (buffer, bufsize, "(%s)", name); free (name); - if ((len + offset) >= bufsize) { + if (len >= bufsize) { Eprintf ("Attribute name was truncated.\n"); return 0; } From 64e90382d31953b6d4f04d2340b63dd8aea28408 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 5 Sep 2003 21:55:12 +0000 Subject: [PATCH 0675/2994] makefile tweak BKrev: 3f590640snYf7J7f2a0NGXjRWVabXw From 12fccd79904b24968cb7c0c106d17bcb5061189d Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Fri, 5 Sep 2003 21:55:12 +0000 Subject: [PATCH 0676/2994] makefile wasn't cleaning up ntfsls.8, ntfsclone.8 or ntfscluster.8 (Logical change 1.178) --- ntfsprogs/Makefile.in | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 3c6be661..2eb4ff42 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -116,7 +116,8 @@ sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ - ntfsundelete.8 ntfsresize.8 ntfsprogs.8 + ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ + ntfsclone.8 ntfscluster.8 EXTRA_MANS = @@ -183,8 +184,9 @@ dumplog_LDFLAGS = $(AM_LFLAGS) subdir = ntfsprogs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 \ - ntfsprogs.8 ntfsresize.8 ntfsundelete.8 +CONFIG_CLEAN_FILES = mkntfs.8 ntfsclone.8 ntfscluster.8 ntfsfix.8 \ + ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 ntfsresize.8 \ + ntfsundelete.8 EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) dumplog$(EXEEXT) \ ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ @@ -303,9 +305,9 @@ DIST_SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfsclone_SOURCES) \ NROFF = nroff MANS = $(man_MANS) -DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsfix.8.in \ - ntfsinfo.8.in ntfslabel.8.in ntfsprogs.8.in ntfsresize.8.in \ - ntfsundelete.8.in +DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsclone.8.in \ + ntfscluster.8.in ntfsfix.8.in ntfsinfo.8.in ntfslabel.8.in \ + ntfsls.8.in ntfsprogs.8.in ntfsresize.8.in ntfsundelete.8.in SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) all: all-am @@ -319,12 +321,18 @@ Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.s cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) mkntfs.8: $(top_builddir)/config.status mkntfs.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +ntfsclone.8: $(top_builddir)/config.status ntfsclone.8.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +ntfscluster.8: $(top_builddir)/config.status ntfscluster.8.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsfix.8: $(top_builddir)/config.status ntfsfix.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsinfo.8: $(top_builddir)/config.status ntfsinfo.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfslabel.8: $(top_builddir)/config.status ntfslabel.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +ntfsls.8: $(top_builddir)/config.status ntfsls.8.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsprogs.8: $(top_builddir)/config.status ntfsprogs.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsresize.8: $(top_builddir)/config.status ntfsresize.8.in From cabab37a8747e2e00230e8857048b6718f97273c Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 7 Sep 2003 18:20:00 +0000 Subject: [PATCH 0677/2994] document clone BKrev: 3f5b76d0ETrBP2p8hsKmOdOKmj4ezQ From 982e3587113084842ba8ef255818e3c3cad81672 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 7 Sep 2003 18:20:00 +0000 Subject: [PATCH 0678/2994] draft man page for clone (Logical change 1.179) --- ntfsprogs/ntfsclone.8.in | 80 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index e69de29b..befdf869 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -0,0 +1,80 @@ +.\" Copyright (c) 2003 Richard Russon. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSCLONE 8 "September 2003" "Linux\-NTFS version @VERSION@" +.SH NAME +ntfsclone \- Copy an NTFS volume. +.SH SYNOPSIS +.B ntfsclone +[ +.I options +] +.B device +.SH DESCRIPTION +.B ntfsclone +will efficiently clone an NTFS volume to a sparse file, device or stdandard +output. +.SH OPTIONS +Below is a summary of all the options that +.B ntfsclone +accepts. All options have two equivalent names. The short name is preceded by +.BR \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.BR \-fv +is equivalent to +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. +.TP +.BI "\-o " FILE +.br +.ns +.TP +.BI "\-\-output " FILE +Clone NTFS to the non-existent FILE +.TP +.BI "\-O " FILE +.br +.ns +.TP +.BI "\-\-overwrite " FILE +Clone NTFS to FILE, overwriting if exists +.TP +.B \-m +.br +.ns +.TP +.B \-\-metadata +Clone *only* metadata (for NTFS experts) +.TP +.B \-f +.br +.ns +.TP +.B \-\-force +This will override some sensible defaults, such as not working with a mounted +volume. Use this option with caution. +.TP +.B \-\-help +Show a list of options with a brief description of each one. +.SH EXAMPLES +.SH BUGS +This program has no known bugs. If you find one, please send an email to +.nh + +.hy +.SH AUTHOR +.B ntfsclone +was written by Szabolcs Szakacsits . +.SH AVAILABILITY +.B ntfsclone +is part of the linux\-ntfs package and is available from +.br +.nh +http://linux\-ntfs.sourceforge.net/downloads.html +.hy +.SH SEE ALSO +.BR ntfsprogs (8) + From a6883074524ecfacc969bd4cad9086cfaa2c78ae Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 7 Sep 2003 18:20:00 +0000 Subject: [PATCH 0679/2994] typo (Logical change 1.179) --- ntfsprogs/ntfsclone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 31ca6533..c5b25382 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -170,7 +170,7 @@ int perr_exit(const char *fmt, ...) void usage() { Eprintf("\nUsage: %s [options] device\n" - " Efficiently clone NTFS to a sparse file, device or stdandard output.\n" + " Efficiently clone NTFS to a sparse file, device or standard output.\n" "\n" " -o FILE --output FILE Clone NTFS to the non-existent FILE\n" " -O FILE --overwrite FILE Clone NTFS to FILE, overwriting if exists\n" From de41b39f1336559d3b6ad2b00984fd712fd06e1f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Sep 2003 11:51:25 +0000 Subject: [PATCH 0680/2994] Auto merged 2003/09/05 23:58:15+01:00 flatcap.org!flatcap a couple of bugfixes start on info (Logical change 1.180) From 78257028b96c0abc0233fa8b14abd4debb4cb693 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Sep 2003 11:51:25 +0000 Subject: [PATCH 0681/2994] Auto merged 2003/09/05 23:58:15+01:00 flatcap.org!flatcap added comment to help folding (Logical change 1.180) From b18a48dc1e0435da1d0071f2413034b67c0356da Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Sep 2003 11:51:25 +0000 Subject: [PATCH 0682/2994] Auto merged 2003/09/05 23:58:15+01:00 flatcap.org!flatcap added ntfscluster.8 to the build (Logical change 1.180) --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index fc57eec8..f70c5084 100644 --- a/configure.ac +++ b/configure.ac @@ -149,6 +149,7 @@ AC_CONFIG_FILES([ ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 + ntfsprogs/ntfscluster.8 ntfsprogs.spec ]) AC_OUTPUT From dad8bebb439b28ce08cdee122e4141e5ec93c5fa Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Sep 2003 11:51:25 +0000 Subject: [PATCH 0683/2994] Auto merged 2003/09/05 23:58:15+01:00 flatcap.org!flatcap work around what's probably a bug in ntfs_attr_lookup (with some extent inodes, ntfs_attr_lookup keeps returning the same attribute) need more time to investigate (Logical change 1.180) From 95e6b7b92998c6c3b465ec98d1e2edb446ccc543 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Sep 2003 11:51:25 +0000 Subject: [PATCH 0684/2994] Manual merge 2003/09/05 23:58:15+01:00 flatcap.org!flatcap added ntfscluster.8 to the build (Logical change 1.180) --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 9e573441..878703ce 100755 --- a/configure +++ b/configure @@ -11612,6 +11612,7 @@ do "ntfsprogs/ntfsprogs.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsprogs.8" ;; "ntfsprogs/ntfsresize.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsresize.8" ;; "ntfsprogs/ntfsundelete.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsundelete.8" ;; + "ntfsprogs/ntfscluster.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscluster.8" ;; "ntfsprogs.spec" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs.spec" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; From 94230f694ec016566a5ed6f9b357a3a4d0cf525c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Sep 2003 11:51:25 +0000 Subject: [PATCH 0685/2994] Manual merge 2003/09/06 00:05:07+01:00 flatcap.org!flatcap makefile wasn't cleaning up ntfscluster.8 2003/09/05 23:58:15+01:00 flatcap.org!flatcap added ntfscluster.8 to the build (Logical change 1.180) --- ntfsprogs/Makefile.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 2eb4ff42..07a37443 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -339,6 +339,8 @@ ntfsresize.8: $(top_builddir)/config.status ntfsresize.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsundelete.8: $(top_builddir)/config.status ntfsundelete.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +ntfscluster.8: $(top_builddir)/config.status ntfscluster.8.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) From 74a1764f65abc62d2f08dbb8981448f63f333b12 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Sep 2003 11:51:25 +0000 Subject: [PATCH 0686/2994] Merge 2003/09/06 00:05:08+01:00 flatcap.org!flatcap makefile tweak 2003/09/05 23:58:16+01:00 flatcap.org!flatcap stop ntfscluster hanging on certain extent inodes add ntfscluster man page to the build BKrev: 3f684abd5PGCl2Z6OOWpmfb3AOPDvQ From 0d33099fdbeba3e31f29337e7167fca5b3205fd3 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Wed, 17 Sep 2003 11:51:25 +0000 Subject: [PATCH 0687/2994] (Logical change 1.180) From 9d296e3dc664edf2f1237d6239a8bd1dd481cc65 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Sep 2003 11:54:16 +0000 Subject: [PATCH 0688/2994] Update (Logical change 1.181) --- configure | 1 - configure.ac | 1 - ntfsprogs/Makefile.in | 2 -- 3 files changed, 4 deletions(-) diff --git a/configure b/configure index 878703ce..9e573441 100755 --- a/configure +++ b/configure @@ -11612,7 +11612,6 @@ do "ntfsprogs/ntfsprogs.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsprogs.8" ;; "ntfsprogs/ntfsresize.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsresize.8" ;; "ntfsprogs/ntfsundelete.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsundelete.8" ;; - "ntfsprogs/ntfscluster.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscluster.8" ;; "ntfsprogs.spec" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs.spec" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; diff --git a/configure.ac b/configure.ac index f70c5084..fc57eec8 100644 --- a/configure.ac +++ b/configure.ac @@ -149,7 +149,6 @@ AC_CONFIG_FILES([ ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 - ntfsprogs/ntfscluster.8 ntfsprogs.spec ]) AC_OUTPUT diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 07a37443..2eb4ff42 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -339,8 +339,6 @@ ntfsresize.8: $(top_builddir)/config.status ntfsresize.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsundelete.8: $(top_builddir)/config.status ntfsundelete.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfscluster.8: $(top_builddir)/config.status ntfscluster.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) From 2bd3a2dd44f6e253eeec2a0cd02ebef4a6c9045c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Sep 2003 11:54:16 +0000 Subject: [PATCH 0689/2994] Update build (fix fallout from merge) BKrev: 3f684b68QHaB2GXrHKkAw84H0wRJBg From e9bce127fa77bbf4cc57a48e074844c536d2a86f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Sep 2003 13:16:33 +0000 Subject: [PATCH 0690/2994] Auto merged 2003/09/24 14:13:09+01:00 cantab.net!aia21 Fix a silly bug in attrib.c::ntfs_external_attr_find() which caused us to always return the same attribute during an enumeration as soon as the end of the attributes to be enumerated was reached thus causing the program doing the enumeration to hang in a tight loop. NOTE: There is still work to do as ctx->al_entry is set to NULL instead of to the position in the attribute list at which to insert. (Logical change 1.182) --- libntfs/attrib.c | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index c80ddfaf..1ad7172f 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1408,6 +1408,9 @@ static int ntfs_attr_find(const ATTR_TYPES type, const uchar_t *name, * @ctx->base_ntfs_ino->attr_list at which the new attribute's attribute list * entry should be inserted. * + * FIXME: This is how it should be but unfortunately the current code sets + * @ctx->al_entry to NULL, so beware! (AIA) + * * The following error codes are defined: * ENOENT Attribute not found, not an error as such. * EINVAL Invalid arguments. @@ -1711,27 +1714,37 @@ do_next_attr: return -1; not_found: /* - * Seek to the end of the base mft record, i.e. when we return false, - * ctx->mrec and ctx->attr indicate where the attribute should be - * inserted into the attribute record. - * And of course ctx->al_entry points to the end of the attribute - * list inside ctx->base_ntfs_ino->attr_list. - * - * FIXME: Do we really want to do this here? Think about it... (AIA) + * The attribute wasn't found. Before we return, we want to ensure + * ctx->mrec and ctx->attr indicate the position at which the attribute + * should be inserted in the base mft record. */ + /* Rewind the current search so ntfs_attr_find() is happy. */ ntfs_attr_reinit_search_ctx(ctx); /* - * If we were enumerating and reached the end, we can't just use !@type + * If we were enumerating and reached the end, we can't just use @type * because that would return the first attribute instead of the last - * one. Thus we just change @type to AT_END which causes - * ntfs_attr_find() to seek to the end. We also do the same when an - * attribute extent was searched for (i.e. @lowest_vcn != 0), as we - * otherwise rewind the search back to the first extent and we get - * that extent returned twice during a search for all extents. + * one. Thus we just use AT_END which causes ntfs_attr_find() to seek + * to the end. */ - if (!type || lowest_vcn) - type = AT_END; - return ntfs_attr_find(type, name, name_len, ic, val, val_len, ctx); + if (!type) + return ntfs_attr_find(AT_END, name, name_len, ic, val, val_len, + ctx); + /* + * In case there are multiple matches in the base mft record, need to + * keep enumerating until we get an attribute not found response (or + * another error), otherwise we would keep returning the same attribute + * over and over again and all programs using us for enumeration would + * lock up in a tight loop. + */ + { + int ret; + + do { + ret = ntfs_attr_find(type, name, name_len, ic, val, + val_len, ctx); + } while (!ret); + return ret; + } } /** @@ -1785,6 +1798,9 @@ not_found: * the position within @ctx->base_ntfs_ino->attr_list at which the new * attribute's attribute list entry should be inserted. * + * FIXME: This is how it should be but unfortunately the current code sets + * @ctx->al_entry to NULL, so beware! (AIA) + * * The following error codes are defined: * ENOENT Attribute not found, not an error as such. * EINVAL Invalid arguments. From f7c342dafe874f5438e97810418e34c8aae1b8a9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Sep 2003 13:16:33 +0000 Subject: [PATCH 0691/2994] Auto merged 2003/09/24 14:13:09+01:00 cantab.net!aia21 The workaround for the bug in ntfs_attr_lookup() no longer needed as the bug should be fixed. (Logical change 1.182) --- ntfsprogs/utils.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 294e9e18..9092efd8 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -395,7 +395,6 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) ntfs_volume *vol; ntfs_attr_search_ctx *ctx; ATTR_RECORD *rec; - ATTR_RECORD *oldrec; FILE_NAME_ATTR *attr; int name_space; MFT_REF parent = FILE_root; @@ -421,11 +420,7 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) //printf ("i = %d, inode = %p (%lld)\n", i, inode, inode->mft_no); name_space = 4; - oldrec = NULL; while ((rec = find_attribute (AT_FILE_NAME, ctx))) { - if (rec == oldrec) - break; - oldrec = rec; /* We know this will always be resident. */ attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); From f70fc8cb92f6d95e71041d3d4c757b8b9f0574f7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Sep 2003 13:16:33 +0000 Subject: [PATCH 0692/2994] Merge 2003/09/24 14:13:09+01:00 cantab.net!aia21 Fix a silly bug in attrib.c::ntfs_external_attr_find() which caused us to always return the same attribute during an enumeration as soon as the end of the attributes to be enumerated was reached thus causing the program doing the enumeration to hang in a tight loop. NOTE: There is still work to do as ctx->al_entry is set to NULL instead of to the position in the attribute list at which to insert. BKrev: 3f719931_JoFmx_aIArUmYzEq5TzCQ From a139e15ddde7ca42e3b13ddfd5abefc592d4b382 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Sep 2003 13:16:33 +0000 Subject: [PATCH 0693/2994] SCCS merged 2003/09/24 14:13:09+01:00 cantab.net!aia21 update (Logical change 1.182) --- ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index f034f666..4b998601 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,12 @@ xx/xx/2003 - 1.8.0-devel - Work in progress. it is NULL. - Return errno ENOTDIR from dir.c::ntfs_readdir() when called with a file inode. + - Fix a silly bug in attrib.c::ntfs_external_attr_find() which caused + us to always return the same attribute during an enumeration as soon + as the end of the attributes to be enumerated was reached thus + causing the program doing the enumeration to hang in a tight loop. + NOTE: There is still work to do as ctx->al_entry is set to NULL + instead of to the position in the attribute list at which to insert. - Added man page for ntfsls. - Lots of extensions and cleanups to ntfsls. From f433b68d83e3d5945731b987222fc187686f4d52 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 28 Sep 2003 13:00:38 +0000 Subject: [PATCH 0694/2994] typo which made ntfslabel read only (Logical change 1.183) --- ntfsprogs/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 9092efd8..82d24f21 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -140,7 +140,7 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL if (!utils_valid_device (device, force)) return NULL; - vol = ntfs_mount (device, MS_RDONLY); + vol = ntfs_mount (device, flags); if (!vol) { Eprintf ("Couldn't mount device '%s': %s\n", device, strerror (errno)); return NULL; From 565d25f0b6ad0b951cf8f50f194e1c07c365f8a1 Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Sun, 28 Sep 2003 13:00:38 +0000 Subject: [PATCH 0695/2994] typo which made ntfslabel read only BKrev: 3f76db76At8T1xCVInkD1fwxf3FUCA From 335659c0df57ece3953fbd5333f337b97426a427 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 30 Sep 2003 09:42:38 +0000 Subject: [PATCH 0696/2994] Update (Logical change 1.184) --- ChangeLog | 4 +++- NEWS | 17 +++++++++++++---- README | 12 ++++++++++++ configure | 20 ++++++++++---------- configure.ac | 2 +- ntfsprogs.spec.in | 12 ++++++++++++ 6 files changed, 51 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b998601..38487c91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,8 +21,10 @@ xx/xx/2003 - 1.8.0-devel - Work in progress. causing the program doing the enumeration to hang in a tight loop. NOTE: There is still work to do as ctx->al_entry is set to NULL instead of to the position in the attribute list at which to insert. - - Added man page for ntfsls. + - Added man pages for ntfsls and other utilities (Richard Russon and + me). - Lots of extensions and cleanups to ntfsls. + - Other assorted bugfixes and developments (see bk changes). 13/02/2003 - 1.7.1 - Urgent bug fixes. - Urgent bug fixes in ntfsresize (Szabolcs Szakacsits): diff --git a/NEWS b/NEWS index e45d44e8..411e019e 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,19 @@ Current news ============ +Added new utilities: ntfsclone by Szakacsits Szabolcs, ntfscluster by Richard +Russon, ntfsinfo by Matthew Fanto, ntfsls originally by Lode Leroy, modified +by Anton Altaparmakov. + +Library internal enhancements and API additions. Of particular note is the +device io abstraction layer and the addition of the win32 device operations +(these haven't been integrated in the build process yet but do work when +integrated manually). Thanks to Lode Leroy for the win32 code. + + +Older news +========== + Renamed ntfstools to ntfsprogs everywhere. Added new utility ntfslabel by Matthew Fanto. See man 8 ntfslabel for details. @@ -16,10 +29,6 @@ last release (1.6.0). It should now offer a much more solid and stable basis for development of software accessing NTFS volumes. All utilities have been ported to the new API. - -Older news -========== - linux-ntfs should now compile and work on all architectures. Added two options to mkntfs. One to enable compression on the volume and one diff --git a/README b/README index 17b90874..a614ad99 100644 --- a/README +++ b/README @@ -68,3 +68,15 @@ ntfsundelete for more details. ntfsresize - Resize NTFS volumes. See man 8 ntfsresize for details. +ntfsclone - Efficiently create/restore an image of an NTFS partition. See +man 8 ntfsclone for details. + +ntfscluster - Locate the owner of any given sector or cluster on an NTFS +partition. See man 8 ntfscluster for details. + +ntfsinfo - Show some information about an NTFS partition or one of the files +or directories within it. See man 8 ntfsinfo for details. + +ntfsls - List information about files in a directory residing on an NTFS +partition. See man 8 ntfsls for details. + diff --git a/configure b/configure index 9e573441..a2fff4ce 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8-devel. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.0beta. # # Report bugs to . # @@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8-devel' -PACKAGE_STRING='ntfsprogs 1.8-devel' +PACKAGE_VERSION='1.8.0beta' +PACKAGE_STRING='ntfsprogs 1.8.0beta' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -947,7 +947,7 @@ 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 ntfsprogs 1.8-devel to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.0beta to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1014,7 +1014,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8-devel:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.0beta:";; esac cat <<\_ACEOF @@ -1115,7 +1115,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8-devel +ntfsprogs configure 1.8.0beta generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1130,7 +1130,7 @@ 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 ntfsprogs $as_me 1.8-devel, which was +It was created by ntfsprogs $as_me 1.8.0beta, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1809,7 +1809,7 @@ fi # Define the identity of the package. PACKAGE=ntfsprogs - VERSION=1.8-devel + VERSION=1.8.0beta cat >>confdefs.h <<_ACEOF @@ -11423,7 +11423,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8-devel, which was +This file was extended by ntfsprogs $as_me 1.8.0beta, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11486,7 +11486,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8-devel +ntfsprogs config.status 1.8.0beta configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index fc57eec8..c5fd4ded 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8-devel, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.0beta, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index f9223e3c..8bfa2ebf 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -34,6 +34,15 @@ ntfslabel for details. ntfsundelete - Recover deleted files from an NTFS volume. See man 8 ntfsundelete for details. ntfsresize - Resize an NTFS volume. See man 8 ntfsresize for details. + ntfsclone - Efficiently create/restore an image of an NTFS partition. +See man 8 ntfsclone for details. + ntfscluster - Locate the owner of any given sector or cluster on an +NTFS partition. See man 8 ntfscluster for details. + ntfsinfo - Show some information about an NTFS partition or one of the +files or directories within it. See man 8 ntfsinfo for details. + ntfsls - List information about files in a directory residing on an +NTFS partition. See man 8 ntfsls for details. + %package devel Summary : files required to compile software that uses libntfs @@ -78,6 +87,9 @@ rm -rf "$RPM_BUILD_ROOT" %{prefix}/lib/*.la* %changelog +* Tue Sep 30 2003 Anton Altaparmakov +- added the new utilities, ntfsclone, ntfscluster, ntfsinfo, ntfsls. + * Sat Jan 18 2003 Anton Altaparmakov - renamed to ntfsprogs.spec.in - change source tar ball name to ntfsprogs From 7075668849a12bd89395357ea95ecb489a2a610d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 30 Sep 2003 09:42:38 +0000 Subject: [PATCH 0697/2994] Update for 1.8.0beta release. BKrev: 3f79500e9hSElbbl0H0NQBQebHebUQ From ef0d5ec25097d405615f1151f712b98065c538fb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 30 Sep 2003 10:32:09 +0000 Subject: [PATCH 0698/2994] - Add win32_io.c to be distributed. - Add -i parameter to syntax output of ntfsls. BKrev: 3f795ba9XnmsR5Pzf-1lXCmvL3ydoQ From 9016aed815a42b08ec4e7ee53363445307d532f8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 30 Sep 2003 10:32:09 +0000 Subject: [PATCH 0699/2994] Add -i parameter to syntax output of ntfsls. (Logical change 1.185) --- ntfsprogs/ntfsls.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 3bc3734c..bfe3ad20 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -89,6 +89,7 @@ void usage(void) " -F --classify Display classification\n" " -f --force Use less caution\n" " -h -? --help Display this help\n" + " -i --inode Display inode numbers\n" " -l --long Display long info\n" " -p PATH --path PATH Directory whose contents to list\n" " -q --quiet Less output\n" From 433801118e17244fb1fdab136010b8877897acc0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 30 Sep 2003 10:32:09 +0000 Subject: [PATCH 0700/2994] Add win32_io.c to be distributed. (Logical change 1.185) --- libntfs/Makefile.am | 3 +++ libntfs/Makefile.in | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index a26d04d9..97bfd311 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -63,3 +63,6 @@ libntfs_la_SOURCES = \ INCLUDES = $(linux_ntfsincludedir) $(all_includes) +EXTRA_DIST = \ + win32_io.c + diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index fa5b8574..ad016559 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -152,6 +152,10 @@ libntfs_la_SOURCES = \ INCLUDES = $(linux_ntfsincludedir) $(all_includes) + +EXTRA_DIST = \ + win32_io.c + subdir = libntfs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h From a2bc391192025b740f633d57172262934e0b54e1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 1 Oct 2003 09:14:29 +0000 Subject: [PATCH 0701/2994] Update (Logical change 1.186) --- ChangeLog | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38487c91..7734e894 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/2003 - 1.8.0-devel - Work in progress. +xx/10/2003 - 1.8.0beta - Work in progress. - Further work on attribute resizing. - Fix two logic inversion bugs in dir.c. Thanks to Russ Christensen for finding the first one. @@ -21,10 +21,9 @@ xx/xx/2003 - 1.8.0-devel - Work in progress. causing the program doing the enumeration to hang in a tight loop. NOTE: There is still work to do as ctx->al_entry is set to NULL instead of to the position in the attribute list at which to insert. - - Added man pages for ntfsls and other utilities (Richard Russon and - me). + - Added man pages for the new utilities (Richard Russon and me). - Lots of extensions and cleanups to ntfsls. - - Other assorted bugfixes and developments (see bk changes). + - Other assorted bugfixes and developments (see NEWS and bk changes). 13/02/2003 - 1.7.1 - Urgent bug fixes. - Urgent bug fixes in ntfsresize (Szabolcs Szakacsits): From dbace28a5175d350059a349781b55f7db783fac5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 1 Oct 2003 09:14:29 +0000 Subject: [PATCH 0702/2994] Updates for 1.8.0beta BKrev: 3f7a9af5koznpz6MFcNp2-82iuXflQ From 54f1d89ba0e7590d64c25491198893751da325af Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 1 Oct 2003 09:15:15 +0000 Subject: [PATCH 0703/2994] update to ignore the tar ball. (Logical change 1.187) --- BitKeeper/etc/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index d5e199d8..ae30fc92 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -27,6 +27,7 @@ TAGS */TAGS .*swp */.*swp +ntfsprogs-*.tar.gz # specific programs ntfsprogs/dumplog From f051b6dbe7cee7defddd30bb35b1e15a796077a1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 1 Oct 2003 09:15:15 +0000 Subject: [PATCH 0704/2994] update to ignore the tar ball. BKrev: 3f7a9b23-eqKLR7qt3RI2cebPZJKiw From 9a0c63f3028dc05e856446e0233e97d65cbcf931 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0705/2994] (Logical change 1.188) --- include/device_io.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ libntfs/device_io.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 include/device_io.h create mode 100644 libntfs/device_io.c diff --git a/include/device_io.h b/include/device_io.h new file mode 100644 index 00000000..a0fac212 --- /dev/null +++ b/include/device_io.h @@ -0,0 +1,44 @@ +/* + * device_io.h - Exports for default device io. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_DEVICE_IO_H +#define _NTFS_DEVICE_IO_H + +#ifndef __CYGWIN32__ + +/* Not on Cygwin; use standard Unix style low level device operations. */ +#define ntfs_device_default_io_ops ntfs_device_unix_io_ops + +#else /* __CYGWIN32__ */ + +/* On Cygwin; use Win32 low level device operations. */ +#define ntfs_device_default_io_ops ntfs_device_win32_io_ops + +#endif /* __CYGWIN32__ */ + + +/* Forward declaration. */ +struct ntfs_device_operations; + +extern struct ntfs_device_operations ntfs_device_default_io_ops; + +#endif /* defined _NTFS_DEVICE_IO_H */ + diff --git a/libntfs/device_io.c b/libntfs/device_io.c new file mode 100644 index 00000000..670f6958 --- /dev/null +++ b/libntfs/device_io.c @@ -0,0 +1,34 @@ +/* + * device_io.c - Default device io operations. Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#ifndef __CYGWIN32__ + +/* Not on Cygwin; use standard Unix style low level device operations. */ +#include "unix_io.c" + +#else /* __CYGWIN32__ */ + +/* On Cygwin; use Win32 low level device operations. */ +#include "win32_io.c" + +#endif /* __CYGWIN32__ */ From b07f4f6d3c6132bab0132e92bf99de9b432751e3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0706/2994] - Integrate win32 io ops (by Lode Leroy) into build process (if building on Cygwin win32 ops are automatically used and otherwise the usual unix style ops are used). - Apply some fixes to make things work on Cygwin. These changes are based on a patch from Lode Leroy. BKrev: 3f815431R2ENXhAguodfndFht5ynKw From bfd37171ab45fb039a62b7d4e95f6b51c6d804e5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0707/2994] Delete: include/disk_io.h }(Logical change 1.188) --- include/disk_io.h | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 include/disk_io.h diff --git a/include/disk_io.h b/include/disk_io.h deleted file mode 100644 index c82a18db..00000000 --- a/include/disk_io.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * disk_io.h - Exports for disk io. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2003 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_DISK_IO_H -#define _NTFS_DISK_IO_H - -#include "volume.h" - -extern struct ntfs_device_operations ntfs_device_disk_io_ops; - -extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, - void *b); -extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, - const void *b); - -extern s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count, - const u32 bksize, void *b); -extern s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, - const u32 bksize, const void *b); - -extern s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, - const s64 count, void *b); -extern s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, - const s64 count, const void *b); - -extern s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size); - -#endif /* defined _NTFS_DISK_IO_H */ - From b8872ed7adb71c5f1f366f4b6677ecb87e1fd9f1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0708/2994] FIXME: utils_valid_device() doesn't work on Cygwin. For now just don't do it. (Logical change 1.188) --- ntfsprogs/utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 82d24f21..40a69f22 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -2,6 +2,7 @@ * utils.c - Part of the Linux-NTFS project. * * Copyright (c) 2002 Richard Russon + * Copyright (c) 2003 Anton Altaparmakov * * A set of shared functions for ntfs utilities * @@ -137,8 +138,11 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL if (!device) return NULL; +/* FIXME: This doesn't work for Cygwin, so just skip it for now... */ +#ifndef __CYGWIN32__ if (!utils_valid_device (device, force)) return NULL; +#endif vol = ntfs_mount (device, flags); if (!vol) { From 3d3b8533799e92ad41a9bac78a041eabebeb1393 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0709/2994] Initial revision --- include/device_io.h | 44 -------------------------------------------- libntfs/device_io.c | 34 ---------------------------------- libntfs/unix_io.c | 0 3 files changed, 78 deletions(-) create mode 100644 libntfs/unix_io.c diff --git a/include/device_io.h b/include/device_io.h index a0fac212..e69de29b 100644 --- a/include/device_io.h +++ b/include/device_io.h @@ -1,44 +0,0 @@ -/* - * device_io.h - Exports for default device io. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2003 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_DEVICE_IO_H -#define _NTFS_DEVICE_IO_H - -#ifndef __CYGWIN32__ - -/* Not on Cygwin; use standard Unix style low level device operations. */ -#define ntfs_device_default_io_ops ntfs_device_unix_io_ops - -#else /* __CYGWIN32__ */ - -/* On Cygwin; use Win32 low level device operations. */ -#define ntfs_device_default_io_ops ntfs_device_win32_io_ops - -#endif /* __CYGWIN32__ */ - - -/* Forward declaration. */ -struct ntfs_device_operations; - -extern struct ntfs_device_operations ntfs_device_default_io_ops; - -#endif /* defined _NTFS_DEVICE_IO_H */ - diff --git a/libntfs/device_io.c b/libntfs/device_io.c index 670f6958..e69de29b 100644 --- a/libntfs/device_io.c +++ b/libntfs/device_io.c @@ -1,34 +0,0 @@ -/* - * device_io.c - Default device io operations. Part of the Linux-NTFS project. - * - * Copyright (c) 2003 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#ifndef __CYGWIN32__ - -/* Not on Cygwin; use standard Unix style low level device operations. */ -#include "unix_io.c" - -#else /* __CYGWIN32__ */ - -/* On Cygwin; use Win32 low level device operations. */ -#include "win32_io.c" - -#endif /* __CYGWIN32__ */ diff --git a/libntfs/unix_io.c b/libntfs/unix_io.c new file mode 100644 index 00000000..e69de29b From aa247f5101573de49686cb05d40f2852b62c881f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0710/2994] Make it work on Cygwin. (Logical change 1.188) --- include/endians.h | 24 +++++++++++++++++++++++- include/volume.h | 7 +++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/include/endians.h b/include/endians.h index a3bf6790..30eaee76 100644 --- a/include/endians.h +++ b/include/endians.h @@ -2,7 +2,7 @@ * endians.h - Definitions related to handling of byte ordering. Part of the * Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -35,6 +35,28 @@ #include +/* The following are not defined on Cygwin... Luckily Cygwin is LE already. */ +#ifdef __CYGWIN32__ + +#define __le16_to_cpu(x) (x) +#define __le32_to_cpu(x) (x) +#define __le64_to_cpu(x) (x) + +#define __cpu_to_le16(x) (x) +#define __cpu_to_le32(x) (x) +#define __cpu_to_le64(x) (x) + +#define __constant_le16_to_cpu(x) (x) +#define __constant_le32_to_cpu(x) (x) +#define __constant_le64_to_cpu(x) (x) + +#define __constant_cpu_to_le16(x) (x) +#define __constant_cpu_to_le32(x) (x) +#define __constant_cpu_to_le64(x) (x) + +#endif /* __CYGWIN32__ */ + + /* Unsigned from LE to CPU conversion. */ #define le16_to_cpu(x) (u16)__le16_to_cpu((u16)(x)) diff --git a/include/volume.h b/include/volume.h index ce9684c2..0ef8ee63 100644 --- a/include/volume.h +++ b/include/volume.h @@ -30,6 +30,13 @@ # include #endif +/* Cygwin doesn't seem to have MS_RDONLY, so we define it here. */ +#if defined(__CYGWIN32__) && !defined(MS_RDONLY) +typedef enum { + MS_RDONLY = 1, +} MS_MOUNT; +#endif + /* Forward declaration */ typedef struct _ntfs_volume ntfs_volume; From 68fc3c2642fc37436fada09e1b56836587e295da Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0711/2994] Make stat and ioctl return error instead of silently succeeding. This probably breaks Cygwin but never mind... (Logical change 1.188) --- libntfs/win32_io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index f0ef4076..9ae868d8 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -381,7 +381,7 @@ static int ntfs_device_win32_stat(struct ntfs_device *dev, struct stat *buf) { fprintf(stderr, "win32_fstat() unimplemented\n"); errno = ENOTSUP; - return 0; + return -1; } static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, @@ -389,7 +389,7 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, { fprintf(stderr, "win32_ioctl() unimplemented\n"); errno = ENOTSUP; - return 0; + return -1; } extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, @@ -410,7 +410,7 @@ static s64 ntfs_device_win32_pwrite(struct ntfs_device *dev, const void *buf, return ntfs_pwrite(dev, offset, count, buf); } -struct ntfs_device_operations ntfs_device_win32_ops = { +struct ntfs_device_operations ntfs_device_win32_io_ops = { .open = ntfs_device_win32_open, .close = ntfs_device_win32_close, .seek = ntfs_device_win32_seek, From e21db3b3a7a708ec01b86f5780710461a413c0b2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0712/2994] Make work on Cygwin. There is no 1 == non-option argument so have to use -d option instead. (Logical change 1.188) --- ntfsprogs/ntfsinfo.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 93428510..d863d2be 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -2,7 +2,7 @@ * ntfsinfo - Part of the Linux-NTFS project. * * Copyright (c) 2002 Matthew J. Fanto - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2003 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon * * This utility will dump a file's attributes. @@ -80,7 +80,8 @@ void version (void) */ void usage (void) { - printf ("\nUsage: %s [options] device\n" + printf ("\nUsage: %s [options] -d dev\n" + " -d dev --device dev The ntfs volume to display information about\n" " -i num --inode num Display information about this inode\n" "\n" " -f --force Use less caution\n" @@ -105,8 +106,9 @@ void usage (void) */ int parse_options (int argc, char *argv[]) { - static const char *sopt = "-fh?i:qtTvV"; + static const char *sopt = "-fh?i:qtTvVd:"; static const struct option lopt[] = { + { "device", required_argument, NULL, 'd' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "inode", required_argument, NULL, 'i' }, @@ -129,7 +131,7 @@ int parse_options (int argc, char *argv[]) while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { - case 1: /* A non-option argument */ + case 'd': /* A non-option argument */ if (!opts.device) { opts.device = argv[optind-1]; } else { From d999304a70b42446d963e2dfd721a43b7fb5fd9f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0713/2994] Moved from disk_io.c. All functions specific to unix style device operations. 2003/10/06 10:37:38+01:00 cantab.net!aia21 Rename: libntfs/disk_io.c -> libntfs/unix_io.c (Logical change 1.188) --- libntfs/unix_io.c | 187 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) diff --git a/libntfs/unix_io.c b/libntfs/unix_io.c index e69de29b..20e5d7e0 100644 --- a/libntfs/unix_io.c +++ b/libntfs/unix_io.c @@ -0,0 +1,187 @@ +/* + * unix_io.c - Unix stule disk io functions. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_LINUX_FD_H +# include +#endif + +#include "types.h" +#include "mst.h" +#include "debug.h" +#include "device.h" + +#if defined(linux) && defined(_IO) && !defined(BLKGETSIZE) +# define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ +#endif + +static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags) +{ + struct flock flk; + + if (NDevOpen(dev)) { + errno = EBUSY; + return -1; + } + /* Open the device/file obtaining the file descriptor. */ + if (((int)dev->d_private = open(dev->d_name, flags)) == -1) + return -1; + /* Setup our read-only flag. */ + if ((flags & O_RDWR) != O_RDWR) + NDevSetReadOnly(dev); + /* Acquire exlusive (mandatory) lock on the whole device. */ + memset(&flk, 0, sizeof(flk)); + if (NDevReadOnly(dev)) + flk.l_type = F_RDLCK; + else + flk.l_type = F_WRLCK; + flk.l_whence = SEEK_SET; + flk.l_start = flk.l_len = 0LL; + if (fcntl((int)dev->d_private, F_SETLK, &flk)) { + int eo = errno; + Dprintf("ntfs_device_unix_io_open: Could not lock %s for %s: " + "%s\n", dev->d_name, NDevReadOnly(dev) ? + "reading" : "writing", strerror(errno)); + if (close((int)dev->d_private)) + Dprintf("ntfs_device_unix_io_open: Warning: Could not " + "close %s: %s\n", dev->d_name, + strerror(errno)); + errno = eo; + return -1; + } + /* Set our open flag. */ + NDevSetOpen(dev); + return 0; +} + +static int ntfs_device_unix_io_close(struct ntfs_device *dev) +{ + struct flock flk; + + if (!NDevOpen(dev)) { + errno = EBADF; + return -1; + } + if (NDevDirty(dev)) + fsync((int)dev->d_private); + /* Release exlusive (mandatory) lock on the whole device. */ + memset(&flk, 0, sizeof(flk)); + flk.l_type = F_UNLCK; + flk.l_whence = SEEK_SET; + flk.l_start = flk.l_len = 0LL; + if (fcntl((int)dev->d_private, F_SETLK, &flk)) + Dprintf("ntfs_device_unix_io_close: Warning: Could not unlock " + "%s: %s\n", dev->d_name, strerror(errno)); + /* Close the file descriptor and clear our open flag. */ + if (close((int)dev->d_private)) + return -1; + NDevClearOpen(dev); + return 0; +} + +static s64 ntfs_device_unix_io_seek(struct ntfs_device *dev, s64 offset, + int whence) +{ + return lseek((int)dev->d_private, offset, whence); +} + +static s64 ntfs_device_unix_io_read(struct ntfs_device *dev, void *buf, + s64 count) +{ + return read((int)dev->d_private, buf, count); +} + +static s64 ntfs_device_unix_io_write(struct ntfs_device *dev, const void *buf, + s64 count) +{ + if (NDevReadOnly(dev)) { + errno = EROFS; + return -1; + } + NDevSetDirty(dev); + return write((int)dev->d_private, buf, count); +} + +static s64 ntfs_device_unix_io_pread(struct ntfs_device *dev, void *buf, + s64 count, s64 offset) +{ + return ntfs_pread(dev, offset, count, buf); +} + +static s64 ntfs_device_unix_io_pwrite(struct ntfs_device *dev, const void *buf, + s64 count, s64 offset) +{ + if (NDevReadOnly(dev)) { + errno = EROFS; + return -1; + } + NDevSetDirty(dev); + return ntfs_pwrite(dev, offset, count, buf); +} + +static int ntfs_device_unix_io_sync(struct ntfs_device *dev) +{ + if (!NDevReadOnly(dev) && NDevDirty(dev)) { + int res = fsync((int)dev->d_private); + if (!res) + NDevClearDirty(dev); + return res; + } + return 0; +} + +static int ntfs_device_unix_io_stat(struct ntfs_device *dev, struct stat *buf) +{ + return fstat((int)dev->d_private, buf); +} + +static int ntfs_device_unix_io_ioctl(struct ntfs_device *dev, int request, + void *argp) +{ + return ioctl((int)dev->d_private, request, argp); +} + +/** + * Device operations for working with unix style devices and files. + */ +struct ntfs_device_operations ntfs_device_unix_io_ops = { + .open = ntfs_device_unix_io_open, + .close = ntfs_device_unix_io_close, + .seek = ntfs_device_unix_io_seek, + .read = ntfs_device_unix_io_read, + .write = ntfs_device_unix_io_write, + .pread = ntfs_device_unix_io_pread, + .pwrite = ntfs_device_unix_io_pwrite, + .sync = ntfs_device_unix_io_sync, + .stat = ntfs_device_unix_io_stat, + .ioctl = ntfs_device_unix_io_ioctl, +}; + From 0e6dac03b663bcca76f9fdb7339079bc5309b67c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0714/2994] Moved from disk_io.c. All functions specific to unix style device operations. }(Logical change 1.188) --- libntfs/disk_io.c | 568 ---------------------------------------------- 1 file changed, 568 deletions(-) delete mode 100644 libntfs/disk_io.c diff --git a/libntfs/disk_io.c b/libntfs/disk_io.c deleted file mode 100644 index 9a234198..00000000 --- a/libntfs/disk_io.c +++ /dev/null @@ -1,568 +0,0 @@ -/* - * disk_io.c - Disk io functions. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2003 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_LINUX_FD_H -# include -#endif - -#include "types.h" -#include "disk_io.h" -#include "mst.h" -#include "debug.h" -#include "device.h" - -#if defined(linux) && defined(_IO) && !defined(BLKGETSIZE) -# define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ -#endif - -/** - * ntfs_pread - positioned read from disk - * @dev: device to read from - * @pos: position in device to read from - * @count: number of bytes to read - * @b: output data buffer - * - * This function will read @count bytes from device @dev at position @pos into - * the data buffer @b. - * - * On success, return the number of successfully read bytes. If this number is - * lower than @count this means that we have either reached end of file or - * encountered an error during the read so that the read is partial. 0 means - * end of file or nothing to read (@count is 0). - * - * On error and nothing has been read, return -1 with errno set appropriately - * to the return code of either seek, read, or set to EINVAL in case of - * invalid arguments. - */ -s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, void *b) -{ - s64 br, total; - struct ntfs_device_operations *dops; - - Dprintf("%s(): Entering for pos 0x%Lx, count 0x%Lx.\n", __FUNCTION__, - pos, count); - if (!b || count < 0 || pos < 0) { - errno = EINVAL; - return -1; - } - if (!count) - return 0; - dops = dev->d_ops; - /* Locate to position. */ - if (dops->seek(dev, pos, SEEK_SET) == (off_t)-1) { - Dprintf("ntfs_pread: device seek to 0x%Lx returned error: " - "%s\n", pos, strerror(errno)); - return -1; - } - /* Read the data. */ - for (total = 0; count; count -= br, total += br) { - br = dops->read(dev, (char*)b + total, count); - /* If everything ok, continue. */ - if (br > 0) - continue; - /* If EOF or error return number of bytes read. */ - if (!br || total) - return total; - /* Nothing read and error, return error status. */ - return br; - } - /* Finally, return the number of bytes read. */ - return total; -} - -/** - * ntfs_pwrite - positioned write to disk - * @dev: device to write to - * @pos: position in file descriptor to write to - * @count: number of bytes to write - * @b: data buffer to write to disk - * - * This function will write @count bytes from data buffer @b to the device @dev - * at position @pos. - * - * On success, return the number of successfully written bytes. If this number - * is lower than @count this means that the write has been interrupted in - * flight or that an error was encountered during the write so that the write - * is partial. 0 means nothing was written (also return 0 when @count is 0). - * - * On error and nothing has been written, return -1 with errno set - * appropriately to the return code of either seek, write, or set - * to EINVAL in case of invalid arguments. - */ -s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, - const void *b) -{ - s64 written, total; - struct ntfs_device_operations *dops; - - Dprintf("%s(): Entering for pos 0x%Lx, count 0x%Lx.\n", __FUNCTION__, - pos, count); - if (!b || count < 0 || pos < 0) { - errno = EINVAL; - return -1; - } - if (!count) - return 0; - if (NDevReadOnly(dev)) { - errno = EROFS; - return -1; - } - dops = dev->d_ops; - /* Locate to position. */ - if (dops->seek(dev, pos, SEEK_SET) == (off_t)-1) { - Dprintf("ntfs_pwrite: seek to 0x%Lx returned error: %s\n", - pos, strerror(errno)); - return -1; - } - NDevSetDirty(dev); - /* Write the data. */ - for (total = 0; count; count -= written, total += written) { - written = dops->write(dev, (char*)b + total, count); - /* If everything ok, continue. */ - if (written > 0) - continue; - /* - * If nothing written or error return number of bytes written. - */ - if (!written || total) - break; - /* Nothing written and error, return error status. */ - return written; - } - /* Finally, return the number of bytes written. */ - return total; -} - -static int ntfs_device_disk_io_open(struct ntfs_device *dev, int flags) -{ - struct flock flk; - - if (NDevOpen(dev)) { - errno = EBUSY; - return -1; - } - /* Open the device/file obtaining the file descriptor. */ - if (((int)dev->d_private = open(dev->d_name, flags)) == -1) - return -1; - /* Setup our read-only flag. */ - if ((flags & O_RDWR) != O_RDWR) - NDevSetReadOnly(dev); - /* Acquire exlusive (mandatory) lock on the whole device. */ - memset(&flk, 0, sizeof(flk)); - if (NDevReadOnly(dev)) - flk.l_type = F_RDLCK; - else - flk.l_type = F_WRLCK; - flk.l_whence = SEEK_SET; - flk.l_start = flk.l_len = 0LL; - if (fcntl((int)dev->d_private, F_SETLK, &flk)) { - int eo = errno; - Dprintf("ntfs_device_disk_io_open: Could not lock %s for %s: " - "%s\n", dev->d_name, NDevReadOnly(dev) ? - "reading" : "writing", strerror(errno)); - if (close((int)dev->d_private)) - Dprintf("ntfs_device_disk_io_open: Warning: Could not " - "close %s: %s\n", dev->d_name, - strerror(errno)); - errno = eo; - return -1; - } - /* Set our open flag. */ - NDevSetOpen(dev); - return 0; -} - -static int ntfs_device_disk_io_close(struct ntfs_device *dev) -{ - struct flock flk; - - if (!NDevOpen(dev)) { - errno = EBADF; - return -1; - } - if (NDevDirty(dev)) - fsync((int)dev->d_private); - /* Release exlusive (mandatory) lock on the whole device. */ - memset(&flk, 0, sizeof(flk)); - flk.l_type = F_UNLCK; - flk.l_whence = SEEK_SET; - flk.l_start = flk.l_len = 0LL; - if (fcntl((int)dev->d_private, F_SETLK, &flk)) - Dprintf("ntfs_device_disk_io_close: Warning: Could not unlock " - "%s: %s\n", dev->d_name, strerror(errno)); - /* Close the file descriptor and clear our open flag. */ - if (close((int)dev->d_private)) - return -1; - NDevClearOpen(dev); - return 0; -} - -static s64 ntfs_device_disk_io_seek(struct ntfs_device *dev, s64 offset, - int whence) -{ - return lseek((int)dev->d_private, offset, whence); -} - -static s64 ntfs_device_disk_io_read(struct ntfs_device *dev, void *buf, - s64 count) -{ - return read((int)dev->d_private, buf, count); -} - -static s64 ntfs_device_disk_io_write(struct ntfs_device *dev, const void *buf, - s64 count) -{ - if (NDevReadOnly(dev)) { - errno = EROFS; - return -1; - } - NDevSetDirty(dev); - return write((int)dev->d_private, buf, count); -} - -static s64 ntfs_device_disk_io_pread(struct ntfs_device *dev, void *buf, - s64 count, s64 offset) -{ - return ntfs_pread(dev, offset, count, buf); -} - -static s64 ntfs_device_disk_io_pwrite(struct ntfs_device *dev, const void *buf, - s64 count, s64 offset) -{ - if (NDevReadOnly(dev)) { - errno = EROFS; - return -1; - } - NDevSetDirty(dev); - return ntfs_pwrite(dev, offset, count, buf); -} - -static int ntfs_device_disk_io_sync(struct ntfs_device *dev) -{ - if (!NDevReadOnly(dev) && NDevDirty(dev)) { - int res = fsync((int)dev->d_private); - if (!res) - NDevClearDirty(dev); - return res; - } - return 0; -} - -static int ntfs_device_disk_io_stat(struct ntfs_device *dev, struct stat *buf) -{ - return fstat((int)dev->d_private, buf); -} - -static int ntfs_device_disk_io_ioctl(struct ntfs_device *dev, int request, - void *argp) -{ - return ioctl((int)dev->d_private, request, argp); -} - -/** - * Default device operations for working with unix style devices and files. - */ -struct ntfs_device_operations ntfs_device_disk_io_ops = { - .open = ntfs_device_disk_io_open, - .close = ntfs_device_disk_io_close, - .seek = ntfs_device_disk_io_seek, - .read = ntfs_device_disk_io_read, - .write = ntfs_device_disk_io_write, - .pread = ntfs_device_disk_io_pread, - .pwrite = ntfs_device_disk_io_pwrite, - .sync = ntfs_device_disk_io_sync, - .stat = ntfs_device_disk_io_stat, - .ioctl = ntfs_device_disk_io_ioctl, -}; - -/** - * ntfs_mst_pread - multi sector transfer (mst) positioned read - * @dev: device to read from - * @pos: position in file descriptor to read from - * @count: number of blocks to read - * @bksize: size of each block that needs mst deprotecting - * @b: output data buffer - * - * Multi sector transfer (mst) positioned read. This function will read @count - * blocks of size @bksize bytes each from device @dev at position @pos into the - * the data buffer @b. - * - * On success, return the number of successfully read blocks. If this number is - * lower than @count this means that we have reached end of file, that the read - * was interrupted, or that an error was encountered during the read so that - * the read is partial. 0 means end of file or nothing was read (also return 0 - * when @count or @bksize are 0). - * - * On error and nothing was read, return -1 with errno set appropriately to the - * return code of either seek, read, or set to EINVAL in case of invalid - * arguments. - * - * NOTE: If an incomplete multi sector transfer has been detected the magic - * will have been changed to magic_BAAD but no error will be returned. Thus it - * is possible that we return count blocks as being read but that any number - * (between zero and count!) of these blocks is actually subject to a multi - * sector transfer error. This should be detected by the caller by checking for - * the magic being "BAAD". - */ -s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count, - const u32 bksize, void *b) -{ - s64 br, i; - - if (bksize & (bksize - 1) || bksize % NTFS_SECTOR_SIZE) { - errno = EINVAL; - return -1; - } - /* Do the read. */ - br = ntfs_pread(dev, pos, count * bksize, b); - if (br < 0) - return br; - /* - * Apply fixups to successfully read data, disregarding any errors - * returned from the MST fixup function. This is because we want to - * fixup everything possible and we rely on the fact that the "BAAD" - * magic will be detected later on. - */ - count = br / bksize; - for (i = 0; i < count; ++i) - ntfs_mst_post_read_fixup((NTFS_RECORD*) - ((u8*)b + i * bksize), bksize); - /* Finally, return the number of complete blocks read. */ - return count; -} - -/** - * ntfs_mst_pwrite - multi sector transfer (mst) positioned write - * @dev: device to write to - * @pos: position in file descriptor to write to - * @count: number of blocks to write - * @bksize: size of each block that needs mst protecting - * @b: data buffer to write to disk - * - * Multi sector transfer (mst) positioned write. This function will write - * @count blocks of size @bksize bytes each from data buffer @b to the device - * @dev at position @pos. - * - * On success, return the number of successfully written blocks. If this number - * is lower than @count this means that the write has been interrutped or that - * an error was encountered during the write so that the write is partial. 0 - * means nothing was written (also return 0 when @count or @bksize are 0). - * - * On error and nothing has been written, return -1 with errno set - * appropriately to the return code of either seek, write, or set - * to EINVAL in case of invalid arguments. - * - * NOTE: We mst protect the data, write it, then mst deprotect it using a quick - * deprotect algorithm (no checking). This saves us from making a copy before - * the write and at the same time causes the usn to be incremented in the - * buffer. This conceptually fits in better with the idea that cached data is - * always deprotected and protection is performed when the data is actually - * going to hit the disk and the cache is immediately deprotected again - * simulating an mst read on the written data. This way cache coherency is - * achieved. - */ -s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, - const u32 bksize, const void *b) -{ - s64 written, i; - - if (count < 0 || bksize % NTFS_SECTOR_SIZE) { - errno = EINVAL; - return -1; - } - if (!count) - return 0; - /* Prepare data for writing. */ - for (i = 0; i < count; ++i) { - int err; - - err = ntfs_mst_pre_write_fixup((NTFS_RECORD*) - ((u8*)b + i * bksize), bksize); - if (err < 0) { - /* Abort write at this position. */ - if (!i) - return err; - count = i; - break; - } - } - /* Write the prepared data. */ - written = ntfs_pwrite(dev, pos, count * bksize, b); - /* Quickly deprotect the data again. */ - for (i = 0; i < count; ++i) - ntfs_mst_post_write_fixup((NTFS_RECORD*)((u8*)b + i * bksize)); - if (written <= 0) - return written; - /* Finally, return the number of complete blocks written. */ - return written / bksize; -} - -/** - * ntfs_cluster_read - read ntfs clusters - * @vol: volume to read from - * @lcn: starting logical cluster number - * @count: number of clusters to read - * @b: output data buffer - * - * Read @count ntfs clusters starting at logical cluster number @lcn from - * volume @vol into buffer @b. Return number of clusters read or -1 on error, - * with errno set to the error code. - */ -s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, const s64 count, - void *b) -{ - s64 br; - - if (!vol || lcn < 0 || count < 0) { - errno = EINVAL; - return -1; - } - if (vol->nr_clusters < lcn + count) { - errno = ESPIPE; - return -1; - } - br = ntfs_pread(vol->dev, lcn << vol->cluster_size_bits, - count << vol->cluster_size_bits, b); - if (br < 0) { - Dperror("Error reading cluster(s)"); - return br; - } - return br >> vol->cluster_size_bits; -} - -/** - * ntfs_cluster_write - write ntfs clusters - * @vol: volume to write to - * @lcn: starting logical cluster number - * @count: number of clusters to write - * @b: data buffer to write to disk - * - * Write @count ntfs clusters starting at logical cluster number @lcn from - * buffer @b to volume @vol. Return the number of clusters written or -1 on - * error, with errno set to the error code. - */ -s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, - const s64 count, const void *b) -{ - s64 bw; - - if (!vol || lcn < 0 || count < 0) { - errno = EINVAL; - return -1; - } - if (vol->nr_clusters < lcn + count) { - errno = ESPIPE; - return -1; - } - if (!NVolReadOnly(vol)) - bw = ntfs_pwrite(vol->dev, lcn << vol->cluster_size_bits, - count << vol->cluster_size_bits, b); - else - bw = count << vol->cluster_size_bits; - if (bw < 0) { - Dperror("Error writing cluster(s)"); - return bw; - } - return bw >> vol->cluster_size_bits; -} - -/** - * ntfs_device_offset_valid - test if a device offset is valid - * @dev: open device - * @ofs: offset to test for validity - * - * Test if the offset @ofs is an existing location on the device described - * by the open device structure @dev. - * - * Return 0 if it is valid and -1 if it is not valid. - */ -static inline int ntfs_device_offset_valid(struct ntfs_device *dev, s64 ofs) -{ - char ch; - - if (dev->d_ops->seek(dev, ofs, SEEK_SET) >= 0 && - dev->d_ops->read(dev, &ch, 1) == 1) - return 0; - return -1; -} - -/** - * ntfs_device_size_get - return the size of a device in blocks - * @dev: open device - * @block_size: block size in bytes in which to return the result - * - * Return the number of @block_size sized blocks in the device described by the - * open device @dev. - * - * Adapted from e2fsutils-1.19, Copyright (C) 1995 Theodore Ts'o. - */ -s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) -{ - s64 high, low; -#ifdef BLKGETSIZE - long size; - - if (dev->d_ops->ioctl(dev, BLKGETSIZE, &size) >= 0) { - Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, - size); - return (s64)size * 512 / block_size; - } -#endif -#ifdef FDGETPRM - { struct floppy_struct this_floppy; - - if (dev->d_ops->ioctl(dev, FDGETPRM, &this_floppy) >= 0) { - Dprintf("FDGETPRM nr 512 byte blocks = %ld (0x%ld)\n", - this_floppy.size, this_floppy.size); - return (s64)this_floppy.size * 512 / block_size; - } - } -#endif - /* - * We couldn't figure it out by using a specialized ioctl, - * so do binary search to find the size of the device. - */ - low = 0LL; - for (high = 1024LL; !ntfs_device_offset_valid(dev, high); high <<= 1) - low = high; - while (low < high - 1LL) { - const s64 mid = (low + high) / 2; - - if (!ntfs_device_offset_valid(dev, mid)) - low = mid; - else - high = mid; - } - dev->d_ops->seek(dev, 0LL, SEEK_SET); - return (low + 1LL) / block_size; -} - From 786a34f1a2ee8483a8f220296b4ea89ee9c2e8a4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0715/2994] New export: ntfs_device_default_io_ops 2003/10/06 10:49:55+01:00 cantab.net!aia21 Rename: BitKeeper/deleted/.del-device.h~47409fbdf050222e -> include/device.h (Logical change 1.188) --- include/device.h | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/include/device.h b/include/device.h index a0a21d6a..36da5d34 100644 --- a/include/device.h +++ b/include/device.h @@ -1,7 +1,7 @@ /* * device.h - Exports for low level device io. Part of the Linux-NTFS project. * - * Copyright (c) 2003 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -24,8 +24,10 @@ #include +#include "device_io.h" #include "types.h" #include "support.h" +#include "volume.h" /* * Defined bits for the state field in the ntfs_device structure. @@ -85,8 +87,27 @@ struct ntfs_device_operations { int (*ioctl)(struct ntfs_device *dev, int request, void *argp); }; -struct ntfs_device *ntfs_device_alloc(const char *name, const long state, +extern struct ntfs_device_operations ntfs_device_default_io_ops; + +extern struct ntfs_device *ntfs_device_alloc(const char *name, const long state, struct ntfs_device_operations *dops, void *private); -int ntfs_device_free(struct ntfs_device *dev); +extern int ntfs_device_free(struct ntfs_device *dev); + +extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, + void *b); +extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, + const void *b); + +extern s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count, + const u32 bksize, void *b); +extern s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, + const u32 bksize, const void *b); + +extern s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, + const s64 count, void *b); +extern s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, + const s64 count, const void *b); + +extern s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size); #endif /* defined _NTFS_DEVICE_H */ From ae8d6bf9d6568bbc994cd33e401278df347c5a73 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0716/2994] Update (Logical change 1.188) --- ChangeLog | 5 +++++ NEWS | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7734e894..09f29787 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,11 @@ xx/10/2003 - 1.8.0beta - Work in progress. instead of to the position in the attribute list at which to insert. - Added man pages for the new utilities (Richard Russon and me). - Lots of extensions and cleanups to ntfsls. + - Move common bits from disk_io.c into device.c and rename the Unix io + specific code that remains to unix_io.c to complement win32_io.c. + - Integrate win32_io.c into the build process so win32_io ops are used + when compiling under Cygwin and standard Unix style io ops are used + otherwise. - Other assorted bugfixes and developments (see NEWS and bk changes). 13/02/2003 - 1.7.1 - Urgent bug fixes. diff --git a/NEWS b/NEWS index 411e019e..7da8e748 100644 --- a/NEWS +++ b/NEWS @@ -6,9 +6,10 @@ Russon, ntfsinfo by Matthew Fanto, ntfsls originally by Lode Leroy, modified by Anton Altaparmakov. Library internal enhancements and API additions. Of particular note is the -device io abstraction layer and the addition of the win32 device operations -(these haven't been integrated in the build process yet but do work when -integrated manually). Thanks to Lode Leroy for the win32 code. +device io abstraction layer and the addition of the win32 device operations. +(Note the win32 device operations are read only and incomplete but should +allow running of simple read-only ntfs utilities under Cygwin.) Thanks to +Lode Leroy for the win32 code. Older news From 7af52becdd19fbafbbd621a68aaaf9f6c9c71c80 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0717/2994] common functions moved from diks_io.h to device.h (Logical change 1.188) --- libntfs/attrib.c | 2 +- libntfs/mft.c | 2 +- libntfs/runlist.c | 2 +- ntfsprogs/ntfsclone.c | 2 +- ntfsprogs/ntfsdump_logfile.c | 2 +- ntfsprogs/ntfsresize.c | 2 +- ntfsprogs/ntfsundelete.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 1ad7172f..f216a1dd 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -28,7 +28,7 @@ #include "compat.h" #include "attrib.h" -#include "disk_io.h" +#include "device.h" #include "mft.h" #include "debug.h" #include "mst.h" diff --git a/libntfs/mft.c b/libntfs/mft.c index aedef1b9..b9bd4b49 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -27,7 +27,7 @@ #include "compat.h" #include "types.h" -#include "disk_io.h" +#include "device.h" #include "debug.h" #include "bitmap.h" #include "attrib.h" diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 1d0d178a..ef76280b 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -32,7 +32,7 @@ #include "volume.h" #include "layout.h" #include "debug.h" -#include "disk_io.h" +#include "device.h" /** * Internal: diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index c5b25382..8e315383 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -30,7 +30,7 @@ #include "support.h" #include "endians.h" #include "bootsect.h" -#include "disk_io.h" +#include "device.h" #include "attrib.h" #include "volume.h" #include "mft.h" diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 796c5cdd..af876e35 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -48,7 +48,7 @@ #include "types.h" #include "attrib.h" #include "mft.h" -#include "disk_io.h" +#include "device.h" #include "logfile.h" #include "mst.h" diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 1bf296e3..c6ca47e3 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -38,7 +38,7 @@ #include "support.h" #include "endians.h" #include "bootsect.h" -#include "disk_io.h" +#include "device.h" #include "attrib.h" #include "volume.h" #include "mft.h" diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index dfcd2ea1..9dd1e873 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -46,7 +46,7 @@ #include "attrib.h" #include "layout.h" #include "inode.h" -#include "disk_io.h" +#include "device.h" #include "utils.h" #include "debug.h" From 14b8a9bab62134f63b44e625aee2439cad3cd5d3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0718/2994] disk_io is gone. device_io appears. (Logical change 1.188) --- include/Makefile.am | 2 +- include/Makefile.in | 2 +- libntfs/Makefile.am | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/Makefile.am b/include/Makefile.am index 201be5fe..a946b940 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -14,8 +14,8 @@ linux_ntfsinclude_HEADERS = \ compat.h \ debug.h \ device.h \ + device_io.h \ dir.h \ - disk_io.h \ endians.h \ inode.h \ layout.h \ diff --git a/include/Makefile.in b/include/Makefile.in index 83491b31..e27c3087 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -105,8 +105,8 @@ linux_ntfsinclude_HEADERS = \ compat.h \ debug.h \ device.h \ + device_io.h \ dir.h \ - disk_io.h \ endians.h \ inode.h \ layout.h \ diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 97bfd311..4b464666 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -51,8 +51,8 @@ libntfs_la_SOURCES = \ compat.c \ debug.c \ device.c \ + device_io.c \ dir.c \ - disk_io.c \ inode.c \ lcnalloc.c \ mft.c \ @@ -63,6 +63,5 @@ libntfs_la_SOURCES = \ INCLUDES = $(linux_ntfsincludedir) $(all_includes) -EXTRA_DIST = \ - win32_io.c +EXTRA_DIST=unix_io.c win32_io.c From a34d218e909ba1b0fe3a09c99e15259571f56adc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0719/2994] merge common functions from disk_io.c into device.c (Logical change 1.188) --- libntfs/device.c | 396 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 396 insertions(+) diff --git a/libntfs/device.c b/libntfs/device.c index 1fb956fc..39414392 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -21,12 +21,28 @@ #include "config.h" +#include #include #include #include +#include +#include +#include +#include +#include +#ifdef HAVE_LINUX_FD_H +# include +#endif +#include "types.h" +#include "mst.h" +#include "debug.h" #include "device.h" +#if defined(linux) && defined(_IO) && !defined(BLKGETSIZE) +# define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ +#endif + /** * ntfs_device_alloc - allocate an ntfs device structure and pre-initialize it * name: name of the device (must be present) @@ -95,3 +111,383 @@ int ntfs_device_free(struct ntfs_device *dev) return 0; } +/** + * ntfs_pread - positioned read from disk + * @dev: device to read from + * @pos: position in device to read from + * @count: number of bytes to read + * @b: output data buffer + * + * This function will read @count bytes from device @dev at position @pos into + * the data buffer @b. + * + * On success, return the number of successfully read bytes. If this number is + * lower than @count this means that we have either reached end of file or + * encountered an error during the read so that the read is partial. 0 means + * end of file or nothing to read (@count is 0). + * + * On error and nothing has been read, return -1 with errno set appropriately + * to the return code of either seek, read, or set to EINVAL in case of + * invalid arguments. + */ +s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, void *b) +{ + s64 br, total; + struct ntfs_device_operations *dops; + + Dprintf("%s(): Entering for pos 0x%Lx, count 0x%Lx.\n", __FUNCTION__, + pos, count); + if (!b || count < 0 || pos < 0) { + errno = EINVAL; + return -1; + } + if (!count) + return 0; + dops = dev->d_ops; + /* Locate to position. */ + if (dops->seek(dev, pos, SEEK_SET) == (off_t)-1) { + Dprintf("ntfs_pread: device seek to 0x%Lx returned error: " + "%s\n", pos, strerror(errno)); + return -1; + } + /* Read the data. */ + for (total = 0; count; count -= br, total += br) { + br = dops->read(dev, (char*)b + total, count); + /* If everything ok, continue. */ + if (br > 0) + continue; + /* If EOF or error return number of bytes read. */ + if (!br || total) + return total; + /* Nothing read and error, return error status. */ + return br; + } + /* Finally, return the number of bytes read. */ + return total; +} + +/** + * ntfs_pwrite - positioned write to disk + * @dev: device to write to + * @pos: position in file descriptor to write to + * @count: number of bytes to write + * @b: data buffer to write to disk + * + * This function will write @count bytes from data buffer @b to the device @dev + * at position @pos. + * + * On success, return the number of successfully written bytes. If this number + * is lower than @count this means that the write has been interrupted in + * flight or that an error was encountered during the write so that the write + * is partial. 0 means nothing was written (also return 0 when @count is 0). + * + * On error and nothing has been written, return -1 with errno set + * appropriately to the return code of either seek, write, or set + * to EINVAL in case of invalid arguments. + */ +s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, + const void *b) +{ + s64 written, total; + struct ntfs_device_operations *dops; + + Dprintf("%s(): Entering for pos 0x%Lx, count 0x%Lx.\n", __FUNCTION__, + pos, count); + if (!b || count < 0 || pos < 0) { + errno = EINVAL; + return -1; + } + if (!count) + return 0; + if (NDevReadOnly(dev)) { + errno = EROFS; + return -1; + } + dops = dev->d_ops; + /* Locate to position. */ + if (dops->seek(dev, pos, SEEK_SET) == (off_t)-1) { + Dprintf("ntfs_pwrite: seek to 0x%Lx returned error: %s\n", + pos, strerror(errno)); + return -1; + } + NDevSetDirty(dev); + /* Write the data. */ + for (total = 0; count; count -= written, total += written) { + written = dops->write(dev, (char*)b + total, count); + /* If everything ok, continue. */ + if (written > 0) + continue; + /* + * If nothing written or error return number of bytes written. + */ + if (!written || total) + break; + /* Nothing written and error, return error status. */ + return written; + } + /* Finally, return the number of bytes written. */ + return total; +} + +/** + * ntfs_mst_pread - multi sector transfer (mst) positioned read + * @dev: device to read from + * @pos: position in file descriptor to read from + * @count: number of blocks to read + * @bksize: size of each block that needs mst deprotecting + * @b: output data buffer + * + * Multi sector transfer (mst) positioned read. This function will read @count + * blocks of size @bksize bytes each from device @dev at position @pos into the + * the data buffer @b. + * + * On success, return the number of successfully read blocks. If this number is + * lower than @count this means that we have reached end of file, that the read + * was interrupted, or that an error was encountered during the read so that + * the read is partial. 0 means end of file or nothing was read (also return 0 + * when @count or @bksize are 0). + * + * On error and nothing was read, return -1 with errno set appropriately to the + * return code of either seek, read, or set to EINVAL in case of invalid + * arguments. + * + * NOTE: If an incomplete multi sector transfer has been detected the magic + * will have been changed to magic_BAAD but no error will be returned. Thus it + * is possible that we return count blocks as being read but that any number + * (between zero and count!) of these blocks is actually subject to a multi + * sector transfer error. This should be detected by the caller by checking for + * the magic being "BAAD". + */ +s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count, + const u32 bksize, void *b) +{ + s64 br, i; + + if (bksize & (bksize - 1) || bksize % NTFS_SECTOR_SIZE) { + errno = EINVAL; + return -1; + } + /* Do the read. */ + br = ntfs_pread(dev, pos, count * bksize, b); + if (br < 0) + return br; + /* + * Apply fixups to successfully read data, disregarding any errors + * returned from the MST fixup function. This is because we want to + * fixup everything possible and we rely on the fact that the "BAAD" + * magic will be detected later on. + */ + count = br / bksize; + for (i = 0; i < count; ++i) + ntfs_mst_post_read_fixup((NTFS_RECORD*) + ((u8*)b + i * bksize), bksize); + /* Finally, return the number of complete blocks read. */ + return count; +} + +/** + * ntfs_mst_pwrite - multi sector transfer (mst) positioned write + * @dev: device to write to + * @pos: position in file descriptor to write to + * @count: number of blocks to write + * @bksize: size of each block that needs mst protecting + * @b: data buffer to write to disk + * + * Multi sector transfer (mst) positioned write. This function will write + * @count blocks of size @bksize bytes each from data buffer @b to the device + * @dev at position @pos. + * + * On success, return the number of successfully written blocks. If this number + * is lower than @count this means that the write has been interrutped or that + * an error was encountered during the write so that the write is partial. 0 + * means nothing was written (also return 0 when @count or @bksize are 0). + * + * On error and nothing has been written, return -1 with errno set + * appropriately to the return code of either seek, write, or set + * to EINVAL in case of invalid arguments. + * + * NOTE: We mst protect the data, write it, then mst deprotect it using a quick + * deprotect algorithm (no checking). This saves us from making a copy before + * the write and at the same time causes the usn to be incremented in the + * buffer. This conceptually fits in better with the idea that cached data is + * always deprotected and protection is performed when the data is actually + * going to hit the disk and the cache is immediately deprotected again + * simulating an mst read on the written data. This way cache coherency is + * achieved. + */ +s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, + const u32 bksize, const void *b) +{ + s64 written, i; + + if (count < 0 || bksize % NTFS_SECTOR_SIZE) { + errno = EINVAL; + return -1; + } + if (!count) + return 0; + /* Prepare data for writing. */ + for (i = 0; i < count; ++i) { + int err; + + err = ntfs_mst_pre_write_fixup((NTFS_RECORD*) + ((u8*)b + i * bksize), bksize); + if (err < 0) { + /* Abort write at this position. */ + if (!i) + return err; + count = i; + break; + } + } + /* Write the prepared data. */ + written = ntfs_pwrite(dev, pos, count * bksize, b); + /* Quickly deprotect the data again. */ + for (i = 0; i < count; ++i) + ntfs_mst_post_write_fixup((NTFS_RECORD*)((u8*)b + i * bksize)); + if (written <= 0) + return written; + /* Finally, return the number of complete blocks written. */ + return written / bksize; +} + +/** + * ntfs_cluster_read - read ntfs clusters + * @vol: volume to read from + * @lcn: starting logical cluster number + * @count: number of clusters to read + * @b: output data buffer + * + * Read @count ntfs clusters starting at logical cluster number @lcn from + * volume @vol into buffer @b. Return number of clusters read or -1 on error, + * with errno set to the error code. + */ +s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, const s64 count, + void *b) +{ + s64 br; + + if (!vol || lcn < 0 || count < 0) { + errno = EINVAL; + return -1; + } + if (vol->nr_clusters < lcn + count) { + errno = ESPIPE; + return -1; + } + br = ntfs_pread(vol->dev, lcn << vol->cluster_size_bits, + count << vol->cluster_size_bits, b); + if (br < 0) { + Dperror("Error reading cluster(s)"); + return br; + } + return br >> vol->cluster_size_bits; +} + +/** + * ntfs_cluster_write - write ntfs clusters + * @vol: volume to write to + * @lcn: starting logical cluster number + * @count: number of clusters to write + * @b: data buffer to write to disk + * + * Write @count ntfs clusters starting at logical cluster number @lcn from + * buffer @b to volume @vol. Return the number of clusters written or -1 on + * error, with errno set to the error code. + */ +s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, + const s64 count, const void *b) +{ + s64 bw; + + if (!vol || lcn < 0 || count < 0) { + errno = EINVAL; + return -1; + } + if (vol->nr_clusters < lcn + count) { + errno = ESPIPE; + return -1; + } + if (!NVolReadOnly(vol)) + bw = ntfs_pwrite(vol->dev, lcn << vol->cluster_size_bits, + count << vol->cluster_size_bits, b); + else + bw = count << vol->cluster_size_bits; + if (bw < 0) { + Dperror("Error writing cluster(s)"); + return bw; + } + return bw >> vol->cluster_size_bits; +} + +/** + * ntfs_device_offset_valid - test if a device offset is valid + * @dev: open device + * @ofs: offset to test for validity + * + * Test if the offset @ofs is an existing location on the device described + * by the open device structure @dev. + * + * Return 0 if it is valid and -1 if it is not valid. + */ +static inline int ntfs_device_offset_valid(struct ntfs_device *dev, s64 ofs) +{ + char ch; + + if (dev->d_ops->seek(dev, ofs, SEEK_SET) >= 0 && + dev->d_ops->read(dev, &ch, 1) == 1) + return 0; + return -1; +} + +/** + * ntfs_device_size_get - return the size of a device in blocks + * @dev: open device + * @block_size: block size in bytes in which to return the result + * + * Return the number of @block_size sized blocks in the device described by the + * open device @dev. + * + * Adapted from e2fsutils-1.19, Copyright (C) 1995 Theodore Ts'o. + */ +s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) +{ + s64 high, low; +#ifdef BLKGETSIZE + long size; + + if (dev->d_ops->ioctl(dev, BLKGETSIZE, &size) >= 0) { + Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, + size); + return (s64)size * 512 / block_size; + } +#endif +#ifdef FDGETPRM + { struct floppy_struct this_floppy; + + if (dev->d_ops->ioctl(dev, FDGETPRM, &this_floppy) >= 0) { + Dprintf("FDGETPRM nr 512 byte blocks = %ld (0x%ld)\n", + this_floppy.size, this_floppy.size); + return (s64)this_floppy.size * 512 / block_size; + } + } +#endif + /* + * We couldn't figure it out by using a specialized ioctl, + * so do binary search to find the size of the device. + */ + low = 0LL; + for (high = 1024LL; !ntfs_device_offset_valid(dev, high); high <<= 1) + low = high; + while (low < high - 1LL) { + const s64 mid = (low + high) / 2; + + if (!ntfs_device_offset_valid(dev, mid)) + low = mid; + else + high = mid; + } + dev->d_ops->seek(dev, 0LL, SEEK_SET); + return (low + 1LL) / block_size; +} + From f49930c0f4668d7a97e45e55f3eb214185f2c794 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Oct 2003 11:38:25 +0000 Subject: [PATCH 0720/2994] ntfs_device_disk_io_ops is now ntfs_device_default_io_ops. (Logical change 1.188) --- libntfs/volume.c | 4 ++-- ntfsprogs/mkntfs.c | 3 +-- ntfsprogs/ntfsfix.c | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index f83a6571..f068e40e 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -32,7 +32,7 @@ #include "attrib.h" #include "mft.h" #include "bootsect.h" -#include "disk_io.h" +#include "device.h" #include "debug.h" #include "inode.h" #include "runlist.h" @@ -944,7 +944,7 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) struct ntfs_device *dev; /* Allocate an ntfs_device structure. */ - dev = ntfs_device_alloc(name, 0, &ntfs_device_disk_io_ops, NULL); + dev = ntfs_device_alloc(name, 0, &ntfs_device_default_io_ops, NULL); if (!dev) return NULL; /* Call ntfs_device_mount() to do the actual mount. */ diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 1c8fd65d..049b0e5f 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -90,7 +90,6 @@ #include "types.h" #include "bootsect.h" -#include "disk_io.h" #include "device.h" #include "attrib.h" #include "bitmap.h" @@ -2555,7 +2554,7 @@ int main(int argc, char **argv) * the volume. */ if (!(vol->dev = ntfs_device_alloc(dev_name, 0, - &ntfs_device_disk_io_ops, NULL))) + &ntfs_device_default_io_ops, NULL))) err_exit("Could not allocate memory for internal buffer.\n"); /* Open the device for reading or reading and writing. */ if (opts.no_action) { diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 587e8e24..bf47e721 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -55,7 +55,6 @@ #include "types.h" #include "attrib.h" #include "mft.h" -#include "disk_io.h" #include "device.h" #include "logfile.h" @@ -126,7 +125,7 @@ int main(int argc, char **argv) printf("Attempting to correct errors... "); - dev = ntfs_device_alloc(argv[1], 0, &ntfs_device_disk_io_ops, NULL); + dev = ntfs_device_alloc(argv[1], 0, &ntfs_device_default_io_ops, NULL); if (!dev) { puts(FAILED); perror("Failed to allocate device"); From f0c141023b8d19a0d7bd4e2b133de49d51d0482a Mon Sep 17 00:00:00 2001 From: "flatcap.org!flatcap" Date: Mon, 6 Oct 2003 18:52:00 +0000 Subject: [PATCH 0721/2994] display more info (Logical change 1.189) --- ntfsprogs/ntfscluster.c | 45 ++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index a80206a7..fffcbdf3 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -251,7 +251,7 @@ u64 meta_space (ntfs_volume *vol) */ int info (ntfs_volume *vol) { - u64 a, b, c, d, e, f, g, h, i, j, k, l, m, n; + u64 a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q; int cps; u64 fs, us, ms; @@ -265,30 +265,36 @@ int info (ntfs_volume *vol) c = 1 << cps; d = vol->nr_clusters >> cps; e = vol->nr_clusters; - f = fs / a; - g = fs / b; - h = fs * 100 / a / d; - i = us / a; - j = us / b; - k = us * 100 / a / d; - l = ms / a; - m = ms / b; - n = ms * 100 / a / d; + f = vol->nr_mft_records; + g = 0; + h = 0; + i = fs / a; + j = fs / b; + k = fs * 100 / a / d; + l = us / a; + m = us / b; + n = us * 100 / a / d; + o = ms / a; + p = ms / b; + q = ms * 100 / a / d; printf ("bytes per sector : %lld\n", a); printf ("bytes per cluster : %lld\n", b); printf ("sectors per cluster : %lld\n", c); printf ("sectors per volume : %lld\n", d); printf ("clusters per volume : %lld\n", e); - printf ("sectors of free space : %lld\n", f); - printf ("clusters of free space : %lld\n", g); - printf ("percentage free space : %lld\n", h); - printf ("sectors of user data : %lld\n", i); - printf ("clusters of user data : %lld\n", j); - printf ("percentage user data : %lld\n", k); - printf ("sectors of metadata : %lld\n", l); - printf ("clusters of metadata : %lld\n", m); - printf ("percentage metadata : %lld\n", n); + printf ("mft records total : %lld\n", f); + printf ("mft records in use : %lld\n", g); + printf ("mft records percentage : %lld\n", h); + printf ("sectors of free space : %lld\n", i); + printf ("clusters of free space : %lld\n", j); + printf ("percentage free space : %lld\n", k); + printf ("sectors of user data : %lld\n", l); + printf ("clusters of user data : %lld\n", m); + printf ("percentage user data : %lld\n", n); + printf ("sectors of metadata : %lld\n", o); + printf ("clusters of metadata : %lld\n", p); + printf ("percentage metadata : %lld\n", q); return 0; } @@ -473,3 +479,4 @@ int main (int argc, char *argv[]) return result; } + From ecb1673d0e11969891c5584f52f381965834c8cf Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 6 Oct 2003 18:52:00 +0000 Subject: [PATCH 0722/2994] Auto merged 2003/09/28 14:57:05+01:00 flatcap.org!ntfs add a helper to determine if an inode represents metadata (Logical change 1.189) --- ntfsprogs/utils.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 40a69f22..d11f0954 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -673,6 +673,67 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref) } +/** + * __metadata + */ +static int __metadata (ntfs_volume *vol, u64 num) +{ + if (num == FILE_root) + return 0; + if (num <= FILE_UpCase) + return 1; + if (!vol) + return -1; + if ((vol->major_ver == 3) && (num == FILE_Extend)) + return 1; + + return 0; +} + +/** + * utils_is_metadata - Determine if an inode represents a metadata file + * @inode: An ntfs inode to be tested + * + * A handful of files in the volume contain filesystem data - metadata. + * They can be identified by their inode number (offset in MFT/$DATA) or by + * their parent. + * + * Return: 1 inode is a metadata file + * 0 inode is not a metadata file + * -1 Error occurred + */ +int utils_is_metadata (ntfs_inode *inode) +{ + ntfs_volume *vol; + ATTR_RECORD *rec; + FILE_NAME_ATTR *attr; + u64 num; + + if (!inode) + return -1; + vol = inode->vol; + if (!vol) + return -1; + + num = inode->mft_no; + if (__metadata (vol, num) == 1) + return 1; + + rec = find_first_attribute (AT_FILE_NAME, inode->mrec); + if (!rec) + return -1; + + /* We know this will always be resident. */ + attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); + + num = MREF (attr->parent_directory); + if (__metadata (vol, num) == 1) + return 1; + + return 0; +} + + #if 0 hamming weight inline unsigned int hweight32(unsigned int w) From ebb1404359da7e12a5f89339c7ddb5a008dfba60 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 6 Oct 2003 18:52:00 +0000 Subject: [PATCH 0723/2994] Merge bk://add/ntfsprogs-devel into flatcap.org:/mnt/work/ntfsprogs-devel 2003/10/06 19:51:48+01:00 flatcap.org!ntfs bits'n'pieces BKrev: 3f81b9d0GKWfbeQK3rW5PC3087afpQ From fcd4a314f3bac7889380118286d77563e81cfdad Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 6 Oct 2003 18:52:00 +0000 Subject: [PATCH 0724/2994] add a helper to determine if an inode represents metadata (Logical change 1.189) --- ntfsprogs/utils.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 206e7921..14b20b00 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -71,6 +71,7 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize); int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int bufsize); int utils_cluster_in_use (ntfs_volume *vol, long long lcn); int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref); +int utils_is_metadata (ntfs_inode *inode); time_t ntfs2utc (s64 time); s64 utc2ntfs (time_t time); From 47df17cb170a9f4dc83b7be78987b6ff9faff8fd Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 6 Oct 2003 19:21:42 +0000 Subject: [PATCH 0725/2994] Fix the build (Logical change 1.190) --- libntfs/Makefile.in | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index ad016559..7eb137fe 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -140,8 +140,8 @@ libntfs_la_SOURCES = \ compat.c \ debug.c \ device.c \ + device_io.c \ dir.c \ - disk_io.c \ inode.c \ lcnalloc.c \ mft.c \ @@ -153,9 +153,7 @@ libntfs_la_SOURCES = \ INCLUDES = $(linux_ntfsincludedir) $(all_includes) -EXTRA_DIST = \ - win32_io.c - +EXTRA_DIST = unix_io.c win32_io.c subdir = libntfs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h @@ -164,7 +162,7 @@ LTLIBRARIES = $(lib_LTLIBRARIES) libntfs_la_LIBADD = am_libntfs_la_OBJECTS = attrib.lo bitmap.lo bootsect.lo compat.lo \ - debug.lo device.lo dir.lo disk_io.lo inode.lo lcnalloc.lo \ + debug.lo device.lo device_io.lo dir.lo inode.lo lcnalloc.lo \ mft.lo mst.lo runlist.lo unistr.lo volume.lo libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) @@ -176,7 +174,7 @@ am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrib.Plo ./$(DEPDIR)/bitmap.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/bootsect.Plo ./$(DEPDIR)/compat.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/debug.Plo ./$(DEPDIR)/device.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/dir.Plo ./$(DEPDIR)/disk_io.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/device_io.Plo ./$(DEPDIR)/dir.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/inode.Plo ./$(DEPDIR)/lcnalloc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/mft.Plo ./$(DEPDIR)/mst.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/runlist.Plo ./$(DEPDIR)/unistr.Plo \ @@ -244,8 +242,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/disk_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lcnalloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mft.Plo@am__quote@ From b9d2243a6bc96fbd0c2c4f2f4efe0b92553b28d0 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 6 Oct 2003 19:21:42 +0000 Subject: [PATCH 0726/2994] Fix the build BKrev: 3f81c0c6Fg2edhSiIPI8m4jgU3m9Sg From d0cc75987881889ec37e98e96e230d426f272b82 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 9 Oct 2003 07:56:06 +0000 Subject: [PATCH 0727/2994] Updates from Szaka (Logical change 1.191) --- include/volume.h | 2 +- libntfs/attrib.c | 2 +- libntfs/volume.c | 2 +- ntfsprogs/ntfsresize.8.in | 53 +++++++++++++----- ntfsprogs/ntfsresize.c | 114 ++++++++++++++++++++++++-------------- 5 files changed, 113 insertions(+), 60 deletions(-) diff --git a/include/volume.h b/include/volume.h index 0ef8ee63..edcc4e18 100644 --- a/include/volume.h +++ b/include/volume.h @@ -80,7 +80,7 @@ typedef enum { * NTFS version 1.1 and 1.2 are used by Windows NT4. * NTFS version 2.x is used by Windows 2000 Beta * NTFS version 3.0 is used by Windows 2000. - * NTFS version 3.1 is used by Windows XP and .NET. + * NTFS version 3.1 is used by Windows XP and Windows Server 2003. */ #define NTFS_V1_1(major, minor) ((major) == 1 && (minor) == 1) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index f216a1dd..df0a59f6 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2785,7 +2785,7 @@ put_err_out: * and do clear the partial run. The latter approach would be more inline with * what windows would do, even though windows wouldn't even make the attribute * sparse, it would just allocate clusters instead. TODO: Check what happens on - * WinXP and .NET. FIXME: Make sure to check what NT4 does with an NTFS1.2 + * WinXP and 2003. FIXME: Make sure to check what NT4 does with an NTFS1.2 * volume that has sparse files. I suspect it will blow up so we will need to * perform allocations of clusters, like NT4 would do for NTFS1.2 while we can * use sparse attributes on NTFS3.x. diff --git a/libntfs/volume.c b/libntfs/volume.c index f068e40e..17d32d4b 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1100,7 +1100,7 @@ int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags) * Version 1.1 and 1.2 are used by Windows NT4. * Version 2.x is used by Windows 2000 Beta's * Version 3.0 is used by Windows 2000. - * Version 3.1 is used by Windows XP and .NET. + * Version 3.1 is used by Windows XP and Windows Server 2003. * * Return 0 if NTFS version is supported otherwise -1 with errno set. * diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 23fe0a7b..2206722d 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -1,7 +1,7 @@ .\" -*- nroff -*- .\" Copyright 2002-2003 by Szabolcs Szakacsits All Rights Reserved. .\" -.TH NTFSRESIZE 8 "Jan 2003" "ntfsprogs @VERSION@" +.TH NTFSRESIZE 8 "Oct 2003" "ntfsprogs @VERSION@" .SH NAME ntfsresize \- resize an NTFS filesystem .SH SYNOPSIS @@ -12,8 +12,8 @@ ntfsresize \- resize an NTFS filesystem .SH DESCRIPTION The .B ntfsresize -program non-destructively resizes Windows NT4, 2000, XP or .NET -NTFS filesystems. At present it can be used to enlarge or shrink a +program non-destructively resizes Windows NT4, 2000, XP or Windows Server 2003 +NTFS filesystems. At present it can be used to enlarge any or shrink a defragmented NTFS filesystem located on an unmounted .I device (usually a disk partition). The new volume will have @@ -28,12 +28,29 @@ parameter is given in kilo-, mega- or gigabytes respectively. .B ntfsresize conforms to the SI, ATA, IEEE standards and the disk manufacturers by using k=10^3, M=10^6 and G=10^9. -The options + +If both +.B -i +and +.B -s +are omitted then the +NTFS filesystem will be enlarged to the device size. + +If the options .B -i and .B -s -are mutually exclusive. If both of them are omitted then the -NTFS filesystem will be enlarged to the device size. +are used together then list inodes (files) using space over +.I size\fR. At present +.B ntfsresize +can not relocate the files listed to the beginning +of the partition thus it refuses to resize at +.I size +if there is any. +To convert the inodes to meaningful file names, you must mount +the partition and run for instance + 'find /mount/point -inum -o -inum ...'. + Before a real resize operation, always make a read-only test run using the .B -n @@ -45,9 +62,9 @@ program doesn't manipulate the size of partitions. To do that you have to use a disk partitioning tool, for example .BR fdisk (8). .PP -If you wish to enlarge an NTFS filesystem, -you must first make sure you can expand the size of the -underlying partition first. This can be done using +If you wish to enlarge an NTFS filesystem then +first you must enlarge the size of the +underlying partition. This can be done using .BR fdisk (8) by deleting the partition and recreating it with a larger size. Then you may use @@ -78,7 +95,7 @@ computer from the disk! .PP Note, .B ntfsresize -schedules 'chkdsk' to make an NTFS consistency check +schedules an NTFS consistency check when you will boot Windows. Windows may force a reboot after the successful consistency check. @@ -96,7 +113,9 @@ Display help and exit. .TP .B -i Using this option you can calculate the smallest shrunken volume size supported. -This option will not make any changes to the filesystem. +This option will not make any changes to the filesystem. +You can use this option with +.B -s\fR. See the meaning of this case above. .TP .B -n Use this option to make a test run before doing the real resize operation. @@ -109,7 +128,11 @@ Resize volume to \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes. The optional modifiers \fBk\fR, \fBM\fR, \fBG\fR mean the .I size parameter is given in kilo-, mega- or gigabytes respectively. -Conforming to standards, k=10^3, M=10^6 and G=10^9. +Conforming to standards, k=10^3, M=10^6 and G=10^9. You can also use this option +with +.B -i\fR. See the meaning of this case above. +.SH EXIT CODES +The exit code is 0 on success, non-zero otherwise. .SH BUGS No bugs are known or has been reported so far in the current version. If you find otherwise, please report it to @@ -117,8 +140,9 @@ If you find otherwise, please report it to ctx->attr; + + if (resize->ni->mft_no != 8) + return 0; + + if (str2unicode("$Bad", &ustr, &len) == -1) + return -1; + + if (ustr && ntfs_names_are_equal(ustr, len, + (uchar_t*)((char*)a + le16_to_cpu(a->name_offset)), + a->name_length, 0, NULL, 0)) + ret = 1; + + if (ustr != AT_UNNAMED) + free(ustr); + + return ret; +} + void collect_shrink_constraints(ntfs_resize_t *resize, s64 last_lcn) { s64 inode; ATTR_FLAGS flags; - struct llcn_t *llcn; + struct llcn_t *llcn = NULL; + int ret; inode = resize->ni->mft_no; flags = resize->ctx->attr->flags; @@ -491,7 +527,12 @@ void collect_shrink_constraints(ntfs_resize_t *resize, s64 last_lcn) else if (flags & ATTR_IS_COMPRESSED) llcn = &resize->last_compressed; - else if (inode == 0) + else if ((ret = has_bad_sectors(resize)) != 0) { + if (ret == -1) + perr_exit("Couldn't convert string to Unicode."); + err_exit("Device has bad sectors, not supported yet.\n"); + + } else if (inode == 0) llcn = &resize->last_mft; else if (inode == 1) @@ -633,6 +674,7 @@ void compare_bitmaps(struct bitmap *a) { s64 i, pos, count; int mismatch = 0; + int backup_boot = 0; u8 bm[NTFS_BUF_SIZE]; printf("Accounting clusters ...\n"); @@ -664,6 +706,15 @@ void compare_bitmaps(struct bitmap *a) if (bit == ntfs_bit_get(bm, i * 8 + cl % 8)) continue; + if (!mismatch && !bit && !backup_boot && + cl == vol->nr_clusters / 2) { + /* FIXME: call also boot sector check */ + backup_boot = 1; + printf("Found backup boot sector in " + "the middle of the volume.\n"); + continue; + } + if (++mismatch > 10) continue; @@ -679,7 +730,7 @@ void compare_bitmaps(struct bitmap *a) mismatch); err_exit("Filesystem check failed! Windows wasn't shutdown " "properly or inconsistent\nfilesystem. Please run " - "chkdsk on Windows.\n"); + "chkdsk /f on Windows.\n"); } } @@ -767,7 +818,7 @@ void print_hint(const char *s, struct llcn_t llcn) runs_b = llcn.lcn * vol->cluster_size; runs_mb = rounded_up_division(runs_b, NTFS_MBYTE); - printf("%-19s: %6Ld MB %8Ld\n", s, runs_mb, llcn.inode); + printf("%-19s: %9Ld MB %8Ld\n", s, runs_mb, llcn.inode); } /** @@ -788,7 +839,7 @@ void advise_on_resize(ntfs_resize_t *resize) old_b = vol->nr_clusters * vol->cluster_size; old_mb = rounded_up_division(old_b, NTFS_MBYTE); - printf("File feature Last used Last inode\n"); + printf("File feature Last used at By inode\n"); print_hint("$MFT", resize->last_mft); print_hint("$MFTMirr", resize->last_mftmir); print_hint("Compressed", resize->last_compressed); @@ -828,27 +879,6 @@ void advise_on_resize(ntfs_resize_t *resize) printf(").\n"); } -/** - * look_for_bad_sector - * - * Read through the metadata file $BadClus looking for bad sectors on the disk. - */ -void look_for_bad_sector(ATTR_RECORD *a) -{ - runlist *rl; - int i; - - rl = ntfs_mapping_pairs_decompress(vol, a, NULL); - if (!rl) - perr_exit("ntfs_mapping_pairs_decompress"); - - for (i = 0; rl[i].length; i++) - if (rl[i].lcn != LCN_HOLE) - err_exit("Device has bad sectors, not supported\n"); - - free(rl); -} - /** * rl_set * @@ -1101,14 +1131,9 @@ void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) if (!(*ctx = ntfs_attr_get_search_ctx(ni, NULL))) perr_exit("ntfs_get_attr_search_ctx"); - if (aname && ((len = ntfs_mbstoucs(aname, &ustr, 0)) == -1)) + if (str2unicode(aname, &ustr, &len) == -1) perr_exit("Unable to convert string to Unicode"); - if (!ustr || !len) { - ustr = AT_UNNAMED; - len = 0; - } - if (ntfs_attr_lookup(AT_DATA, ustr, len, 0, 0, NULL, 0, *ctx)) perr_exit("ntfs_lookup_attr"); @@ -1145,7 +1170,6 @@ void truncate_badclust_file(s64 nr_clusters) printf("Updating $BadClust file ...\n"); lookup_data_attr((MFT_REF)FILE_BadClus, "$Bad", &ctx); - look_for_bad_sector(ctx->attr); /* FIXME: sanity_check_attr(ctx->attr); */ truncate_badclust_bad_attr(ctx->attr, nr_clusters); @@ -1247,11 +1271,10 @@ void print_volume_size(char *str, s64 bytes) */ void print_disk_usage(ntfs_resize_t *resize) { - s64 total, used, free, relocations; + s64 total, used, relocations; total = vol->nr_clusters * vol->cluster_size; used = resize->inuse * vol->cluster_size; - free = total - used; relocations = resize->relocations * vol->cluster_size; printf("Space in use : %lld MB (%.1f%%)\n", @@ -1275,9 +1298,12 @@ void mount_volume() { unsigned long mntflag; - if (ntfs_check_if_mounted(opt.volume, &mntflag)) - perr_exit("Failed to check '%s' mount state", opt.volume); - + if (ntfs_check_if_mounted(opt.volume, &mntflag)) { + perr_printf("Failed to check '%s' mount state", opt.volume); + printf("Probably /etc/mtab is missing. It's too risky to" + "continue.\nYou might try an another Linux distro.\n"); + exit(1); + } if (mntflag & NTFS_MF_MOUNTED) { if (!(mntflag & NTFS_MF_READONLY)) err_exit("Device %s is mounted read-write. " @@ -1303,7 +1329,7 @@ void mount_volume() if (vol->flags & VOLUME_IS_DIRTY) if (opt.force-- <= 0) - err_exit("Volume is dirty. Run chkdsk and " + err_exit("Volume is dirty. Run chkdsk /f and " "please try again (or see -f option).\n"); printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); @@ -1383,7 +1409,9 @@ int main(int argc, char **argv) if (opt.bytes) { if (device_size < opt.bytes) err_exit("New size can't be bigger than the " - "device size (%Ld bytes).\n", device_size); + "device size (%Ld bytes).\nIf you want to " + "enlarge NTFS then first enlarge the device " + "size by e.g. fdisk.\n", device_size); } else if (!opt.info) opt.bytes = device_size; @@ -1424,7 +1452,7 @@ int main(int argc, char **argv) resize.multi_ref); err_exit("Filesystem check failed! Windows wasn't shutdown " "properly or inconsistent\nfilesystem. Please run " - "chkdsk on Windows.\n"); + "chkdsk /f on Windows.\n"); } compare_bitmaps(&lcn_bitmap); From b04468288eb60bd5ec3d750ef4f9e6f3391d6a21 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 9 Oct 2003 07:56:06 +0000 Subject: [PATCH 0728/2994] Updates from Szaka. ntfsresize changes: - replaced .NET references to Windows Server 2003 (also everywhere in ntfsprogs) - ntfsresize manual update - more verbose ntfsresize error messages, with hints, explanations - handle backup boot sector in the middle - existance of bad block list check moved to the "collect resize constrains" part of the code from the "resize in-progress" part. - replace chkdsk references to chkdsk /f - other minor cleanups BKrev: 3f851496osUfNsqWsYwDH1sUbydJow From 77a57862f422bda98ad4685d5de02a3c9d11923b Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 10 Oct 2003 21:42:48 +0000 Subject: [PATCH 0729/2994] Merge bk://add/ntfsprogs-devel into flatcap.org:/mnt/work/ntfsprogs-devel 2003/10/10 22:41:37+01:00 flatcap.org!ntfs more shared code added to utils: path_to_inode minor fixes to __metadata BKrev: 3f8727d8fSnivOHkXxuFMzcAFv8bhg From 127d183ef8167b511a2c6e1d9162a3b1d86c342c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 10 Oct 2003 21:42:48 +0000 Subject: [PATCH 0730/2994] added MAX_PATH (for ntfsls) (Logical change 1.192) --- ntfsprogs/utils.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 14b20b00..733c2892 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -1,7 +1,7 @@ /* * utils.h - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002-2003 Richard Russon * * A set of shared functions for ntfs utilities * @@ -36,6 +36,7 @@ extern const char *ntfs_home; extern const char *ntfs_gpl; #define PATH_SEP '/' +#define MAX_PATH 1024 #define GEN_PRINTF(NAME, STREAM, CONTROL, TRIGGER) \ __attribute__ ((format (printf, 1, 2))) \ @@ -72,6 +73,7 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int int utils_cluster_in_use (ntfs_volume *vol, long long lcn); int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref); int utils_is_metadata (ntfs_inode *inode); +ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, const char *pathname); time_t ntfs2utc (s64 time); s64 utc2ntfs (time_t time); From 904b95f03deffbdfe6f729c90228688af561f5e4 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 10 Oct 2003 21:42:48 +0000 Subject: [PATCH 0731/2994] added utils_pathname_to_inode based on Lode's version from ntfsls in __metadata the root directory is definitely metadata now (rationale: stuff the user cannot delete) check for extent inodes of metadata files (Logical change 1.192) --- ntfsprogs/utils.c | 107 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index d11f0954..295ba72c 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -1,8 +1,9 @@ /** * utils.c - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002-2003 Richard Russon * Copyright (c) 2003 Anton Altaparmakov + * Copyright (c) 2003 Lode Leroy * * A set of shared functions for ntfs utilities * @@ -39,6 +40,7 @@ #include "types.h" #include "volume.h" #include "debug.h" +#include "dir.h" const char *ntfs_bugs = "Please report bugs to linux-ntfs-dev@lists.sourceforge.net\n"; const char *ntfs_home = "Linux NTFS homepage: http://linux-ntfs.sourceforge.net\n"; @@ -672,14 +674,101 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref) return (buffer[byte] & bit); } +/** + * utils_pathname_to_inode - Find the inode which represents the given pathname + * @vol: An ntfs volume obtained from ntfs_mount + * @parent: A directory inode to begin the search (may be NULL) + * @pathname: Pathname to be located + * + * Take an ASCII pathname and find the inode that represents it. The function + * splits the path and then descends the directory tree. If @parent is NULL, + * then the root directory '.' will be used as the base for the search. + * + * Return: inode Success, the pathname was valid + * NULL Error, the pathname was invalid, or some other error occurred + */ +ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, const char *pathname) +{ + u64 inum; + int len; + char *p, *q; + ntfs_inode *ni; + ntfs_inode *result = NULL; + uchar_t *unicode = NULL; + char *ascii = NULL; + + if (!vol || !pathname) { + return NULL; + } + + if (parent) { + ni = parent; + } else { + ni = ntfs_inode_open (vol, FILE_root); + if (!ni) { + Eprintf ("Couldn't open the inode of the root directory.\n"); + goto close; + } + } + + unicode = calloc (1, MAX_PATH); + ascii = strdup (pathname); // Work with a r/w copy + if (!unicode || !ascii) { + Eprintf ("Out of memory.\n"); + goto close; + } + + p = ascii; + while (p && *p && *p == PATH_SEP) // Remove leading /'s + p++; + while (p && *p) { + q = strchr (p, PATH_SEP); // Find the end of the first token + if (q != NULL) { + *q = '\0'; + q++; + } + + len = ntfs_mbstoucs (p, &unicode, MAX_PATH); + if (len < 0) { + Eprintf ("Couldn't convert name to Unicode: %s.\n", p); + goto close; + } + + inum = ntfs_inode_lookup_by_name (ni, unicode, len); + if (inum == -1) { + Eprintf ("Couldn't find name '%s' in pathname '%s'.\n", p, pathname); + goto close; + } + + if (ni != parent) + ntfs_inode_close (ni); + + ni = ntfs_inode_open (vol, inum); + if (!ni) { + Eprintf ("Cannot open inode %lld: %s.\n", inum, p); + goto close; + } + + p = q; + while (p && *p && *p == PATH_SEP) + p++; + } + + result = ni; + ni = NULL; +close: + if (ni && (ni != parent)) + ntfs_inode_close (ni); + free (ascii); + free (unicode); + return result; +} /** * __metadata */ static int __metadata (ntfs_volume *vol, u64 num) { - if (num == FILE_root) - return 0; if (num <= FILE_UpCase) return 1; if (!vol) @@ -707,10 +796,12 @@ int utils_is_metadata (ntfs_inode *inode) ntfs_volume *vol; ATTR_RECORD *rec; FILE_NAME_ATTR *attr; + MFT_RECORD *file; u64 num; if (!inode) return -1; + vol = inode->vol; if (!vol) return -1; @@ -719,6 +810,14 @@ int utils_is_metadata (ntfs_inode *inode) if (__metadata (vol, num) == 1) return 1; + file = inode->mrec; + if (file && (file->base_mft_record != 0)) { + num = MREF (file->base_mft_record); + if (__metadata (vol, num) == 1) + return 1; + } + file = inode->mrec; + rec = find_first_attribute (AT_FILE_NAME, inode->mrec); if (!rec) return -1; @@ -727,7 +826,7 @@ int utils_is_metadata (ntfs_inode *inode) attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); num = MREF (attr->parent_directory); - if (__metadata (vol, num) == 1) + if ((num != FILE_root) && (__metadata (vol, num) == 1)) return 1; return 0; From 4b15bb47ee6cc939151bdcda820d437aebea0738 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 10 Oct 2003 21:50:49 +0000 Subject: [PATCH 0732/2994] big tidy up BKrev: 3f8729b9NQN89dnTicydt2f6cFR54g From 6a9c6ada8f23dc8df113e95fe220a5b69de70536 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 10 Oct 2003 21:50:49 +0000 Subject: [PATCH 0733/2994] replace ucstos with ntfs_ucstombs replace stoucs with ntfs_mbstoucs adapt routine to convert a path to an inode (now in utils) fix memory leaks in error paths (Logical change 1.193) --- ntfsprogs/ntfsls.c | 218 +++++++++++++++------------------------------ 1 file changed, 71 insertions(+), 147 deletions(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index bfe3ad20..4b83d960 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -3,6 +3,7 @@ * * Copyright (c) 2003 Lode Leroy * Copyright (c) 2003 Anton Altaparmakov + * Copyright (c) 2003 Richard Russon * * This utility will list a directory's files. * @@ -68,8 +69,9 @@ void version(void) { printf("\n%s v%s - Display information about an NTFS Volume.\n\n", EXEC_NAME, VERSION); - printf("Copyright (c)\n"); - printf(" 2003 Lode Leroy\n"); + printf("Copyright (c) 2003 Lode Leroy\n"); + printf("Copyright (c) 2003 Anton Altaparmakov\n"); + printf("Copyright (c) 2003 Richard Russon\n"); printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -216,107 +218,41 @@ int parse_options(int argc, char *argv[]) return (!err && !help && !ver); } -/** - * ucstos - convert unicode-character string to ASCII - * @dest: points to buffer to receive the converted string - * @src: points to string to convert - * @maxlen: size of @dest buffer in bytes - * - * Return the number of characters written to @dest, not including the - * terminating null byte. If a unicode character was encountered which could - * not be converted -1 is returned. - */ -int ucstos(char *dest, const uchar_t *src, int maxlen) -{ - uchar_t u; - int i; - - /* Need one byte for null terminator. */ - maxlen--; - for (i = 0; i < maxlen; i++) { - u = le16_to_cpu(src[i]); - if (!u) - break; - if (u & 0xff00) - return -1; - dest[i] = u & 0xff; - } - dest[i] = 0; - return i; -} - -/** - * stoucs - convert ASCII string to unicode-character string - * @dest: points to buffer to receive the converted string - * @src: points to string to convert - * @maxlen: size of @dest buffer in bytes - * - * Return the number of characters written to @dest, not including the - * terminating null unicode character. - */ -int stoucs(uchar_t *dest, const char *src, int maxlen) -{ - char c; - int i; - - /* Need two bytes for null terminator. */ - maxlen -= 2; - for (i = 0; i < maxlen; i++) { - c = src[i]; - if (!c) - break; - dest[i] = cpu_to_le16(c); - } - dest[i] = cpu_to_le16('\0'); - return i; -} - -/* Dump a block of memory starting at buf. Display length bytes. The displayed - index of the first byte is start */ -void dump_mem(unsigned char *buf, int start, int length) -{ - int offs, i; - - for (offs = 0; offs < length; offs += 16) { - printf("%8.8X ", start + offs); - for (i = 0; i < 16; i++) - printf(offs + i < length ? "%2X " : " ", buf[offs+i]); - for (i = 0; i < 16; i++) { - if (offs + i >= length) - putchar(' '); - else if (buf[offs + i] > 31 && buf[offs + i] < 128) - putchar(buf[offs + i]); - else putchar('.'); - } - putchar('\n'); - } -} - typedef struct { ntfs_volume *vol; } ntfsls_dirent; -// FIXME: Should we print errors as we go along? (AIA) +/** + * list_entry + * FIXME: Should we print errors as we go along? (AIA) + */ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, const int name_len, const int name_type, const s64 pos, - const MFT_REF mref, const unsigned dt_type) { - char filename[255 + 2]; + const MFT_REF mref, const unsigned dt_type) +{ + char *filename = NULL; + int result = 0; - ucstos(filename, name, min(name_len + 1, sizeof(filename))); - // FIXME: error checking... (AIA) - // FIXME: Why not use ntfs_mbstoucs() from libntfs? (AIA) - //printf("[%s\t,%d,%d]\n", filename, name_type, dt_type); + filename = calloc (1, MAX_PATH); + if (!filename) + return -1; + if (ntfs_ucstombs (name, name_len, &filename, MAX_PATH) < 0) { + Eprintf ("Cannot represent filename in current locale.\n"); + goto free; + } + + result = 0; // These are successful if ((filename[0] == '$') && (!opts.system)) - return 0; + goto free; if (name_type == FILE_NAME_POSIX && !opts.all) - return 0; + goto free; if (((name_type & FILE_NAME_WIN32_AND_DOS) == FILE_NAME_WIN32) && opts.dos) - return 0; + goto free; if (((name_type & FILE_NAME_WIN32_AND_DOS) == FILE_NAME_DOS) && !opts.dos) - return 0; + goto free; if (dt_type == NTFS_DT_DIR && opts.classify) sprintf(filename + strlen(filename), "/"); @@ -325,6 +261,7 @@ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, printf("%s\n", filename); else printf("%7lld %s\n", MREF(mref), filename); + result = 0; } else { s64 filesize = 0; ntfs_inode *ni; @@ -334,26 +271,25 @@ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, time_t ntfs_time; char t_buf[26]; + result = -1; // Everything else is bad + ni = ntfs_inode_open(dirent->vol, mref); if (!ni) - return -1; - //dump_mem(ni, 0, sizeof(ntfs_inode)); + goto release; ctx = ntfs_attr_get_search_ctx(ni, ni->mrec); if (!ctx) - return -1; + goto release; if (ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) - return -1; + goto release; attr = ctx->attr; - //dump_mem(attr, 0, sizeof(*attr)); file_name_attr = (FILE_NAME_ATTR *)((char *)attr + le16_to_cpu(attr->value_offset)); if (!file_name_attr) - return -1; - //dump_mem(file_name_attr, 0, sizeof(*file_name_attr)); + goto release; ntfs_time = ntfs2utc(sle64_to_cpu( file_name_attr->last_data_change_time)); @@ -367,17 +303,23 @@ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, ctx->attr); } - /* Release atrtibute search context and close the inode. */ - ntfs_attr_put_search_ctx(ctx); - ntfs_inode_close(ni); - if (opts.inode) printf("%7lld %8lld %s %s\n", MREF(mref), filesize, t_buf + 4, filename); else printf("%8lld %s %s\n", filesize, t_buf + 4, filename); + + result = 0; +release: + /* Release atrtibute search context and close the inode. */ + if (ctx) + ntfs_attr_put_search_ctx(ctx); + if (ni) + ntfs_inode_close(ni); } - return 0; +free: + free (filename); + return result; } /** @@ -389,17 +331,13 @@ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, * 1 Error, parsing mount options failed * 2 Error, mount attempt failed * 3 Error, failed to open root directory - * 3 Error, failed to open directory in search path + * 4 Error, failed to open directory in search path */ int main(int argc, char **argv) { - u64 ino; s64 pos; ntfs_volume *vol; ntfs_inode *ni; - char *p; - int len; - uchar_t unicode[100]; ntfsls_dirent dirent; if (!parse_options(argc, argv)) { @@ -415,48 +353,13 @@ int main(int argc, char **argv) return 2; } - /* Open the root directory of the ntfs volume. */ - ni = ntfs_inode_open(vol, FILE_root); + ni = utils_pathname_to_inode (vol, NULL, opts.path); if (!ni) { // FIXME: Print error... (AIA) ntfs_umount(vol, FALSE); return 3; } - memset(unicode, 0, sizeof(unicode)); - len = 0; - - p = opts.path; - while (p && *p && *p == '/') - p++; - while (p && *p) { - char *q = strchr(p, '/'); - if (q != NULL) { - *q = '\0'; - q++; - } - - len = stoucs(unicode, p, sizeof(unicode)); - // FIXME: error checking... (AIA) - - ino = ntfs_inode_lookup_by_name(ni, unicode, len); - // FIXME: error checking... (AIA) - - /* Finished with the inode; release it. */ - ntfs_inode_close(ni); - - ni = ntfs_inode_open(vol, ino); - if (!ni) { - // FIXME: Print error... (AIA) - ntfs_umount(vol, FALSE); - return 4; - } - - p = q; - while (p && *p && *p == '/') - p++; - } - /* * We now are at the final path component. If it is a file just * list it. If it is a directory, list its contents. @@ -467,12 +370,33 @@ int main(int argc, char **argv) if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) { ntfs_readdir(ni, &pos, &dirent, (ntfs_filldir_t)list_entry); // FIXME: error checking... (AIA) - } else if (len) { - // FIXME: Ought to lookup the actual name in the mft record - // and display that... (AIA) - list_entry(&dirent, unicode, len, 3, pos, ni->mft_no, - NTFS_DT_REG); + } else { + ATTR_RECORD *rec; + FILE_NAME_ATTR *attr; + ntfs_attr_search_ctx *ctx; + int space = 4; + uchar_t *name = NULL; + int name_len = 0;; + + ctx = ntfs_attr_get_search_ctx (NULL, ni->mrec); + if (!ctx) + return -1; + + while ((rec = find_attribute (AT_FILE_NAME, ctx))) { + /* We know this will always be resident. */ + attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); + + if (attr->file_name_type < space) { + name = attr->file_name; + name_len = attr->file_name_length; + space = attr->file_name_type; + } + } + + list_entry(&dirent, name, name_len, space, pos, ni->mft_no, NTFS_DT_REG); // FIXME: error checking... (AIA) + + ntfs_attr_put_search_ctx(ctx); } /* Finished with the inode; release it. */ From c536fe31da386a6c492916f41300d2daccc3c216 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 10 Oct 2003 21:53:32 +0000 Subject: [PATCH 0734/2994] minor bugfix (Logical change 1.194) --- ntfsprogs/ntfsls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 4b83d960..7c77270e 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -265,7 +265,7 @@ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, } else { s64 filesize = 0; ntfs_inode *ni; - ntfs_attr_search_ctx *ctx; + ntfs_attr_search_ctx *ctx = NULL; FILE_NAME_ATTR *file_name_attr; ATTR_RECORD *attr; time_t ntfs_time; From 038982bb62bf5b26deecfa890c18cab10db09728 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 10 Oct 2003 21:53:32 +0000 Subject: [PATCH 0735/2994] ntfsls.c: minor bugfix BKrev: 3f872a5c8WEXnrkYhwKGNLGrIBc0hA From cfacfc10a53fa3fed112de143048a7c0de025d1c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 10 Oct 2003 23:22:23 +0000 Subject: [PATCH 0736/2994] (Logical change 1.195) --- ntfsprogs/ntfscat.8.in | 90 ++++++++++++++++ ntfsprogs/ntfscat.c | 237 +++++++++++++++++++++++++++++++++++++++++ ntfsprogs/ntfscat.h | 37 +++++++ 3 files changed, 364 insertions(+) create mode 100644 ntfsprogs/ntfscat.8.in create mode 100644 ntfsprogs/ntfscat.c create mode 100644 ntfsprogs/ntfscat.h diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in new file mode 100644 index 00000000..64b76bdf --- /dev/null +++ b/ntfsprogs/ntfscat.8.in @@ -0,0 +1,90 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2003 Richard Russon. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSCAT 8 "October 2003" "Linux-NTFS version @VERSION@" +.SH NAME +ntfscat \- concatenate files and print them on the standard output +.SH SYNOPSIS +.B ntfscat +[ +.I options +] +.B device file +.SH DESCRIPTION +.B ntfscat +will read a file from an NTFS volume and display the contents on the standard output. +.PP +The case of the filename passed to +.B ntfscat +is ignored. +.SH OPTIONS +Below is a summary of all the options that +.B ntfscat +accepts. All options have two equivalent names. The short name is preceded by +.BR \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.BR \-fv +is equivalent to +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. +.TP +.B \-f +.br +.ns +.TP +.B \-\-force +This will override some sensible defaults, such as not working with a mounted +volume. Use this option with caution. +.TP +.B \-h +.br +.ns +.TP +.B \-\-help +Show a list of options with a brief description of each one. +.TP +.B \-V +.br +.ns +.TP +.B \-\-version +Show the version number, copyright and license +.BR ntfscat . +.SH EXAMPLES +Display the contents of a file in the root of an NTFS volume. +.RS +.sp +.B ntfscat /dev/hda1 boot.ini +.sp +.RE +Display the contents of a file in a subdirectory of an NTFS volume. +.RS +.sp +.B ntfscat /dev/hda1 /winnt/system32/drivers/etc/hosts +.SH BUGS +.B ntfscat +was written in a short time, to get something "out there". It needs a lot more work. +If you find any bugs, please send an email to +.nh + +.hy +.SH AUTHOR +.B ntfscat +was written by Richard Russon (FlatCap) +.br +If you find this tool useful, make FlatCap happy and send him an email. +.SH AVAILABILITY +.B ntfscat +is part of the linux\-ntfs package and is available from +.br +.nh +http://linux\-ntfs.sourceforge.net/downloads.html +.hy +.SH SEE ALSO +.BR ntfsls (8), +.BR ntfsprogs (8) + diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c new file mode 100644 index 00000000..754f2409 --- /dev/null +++ b/ntfsprogs/ntfscat.c @@ -0,0 +1,237 @@ +/** + * ntfscat - Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Richard Russon + * + * This utility will concatenate files and print on the standard output. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "types.h" +#include "attrib.h" +#include "utils.h" +#include "volume.h" +#include "debug.h" +#include "dir.h" +#include "ntfscat.h" + +static const char *EXEC_NAME = "ntfscat"; +static struct options opts; +static int verbose = 0; +static int quiet = 0; + +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &verbose, TRUE) +GEN_PRINTF (Qprintf, stdout, &quiet, FALSE) + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + printf ("\n%s v%s - Concatenate files and print on the standard output.\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c) 2003 Richard Russon\n"); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + printf ("\nUsage: %s [options] device file\n" + " -f --force Use less caution\n" + " -V --version Version information\n" + " -h --help Print this help\n\n", + //" -A --attribute Display this attribute", + //" -I --file Display this file", + //" -F --inode Display this inode", + //" -N --name Display this attribute name", + //" -r --raw Display the compressed or encrypted file", + EXEC_NAME); + printf ("%s%s\n", ntfs_bugs, ntfs_home); +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char **argv) +{ + static const char *sopt = "-fh?V"; // A:F:I:N: + static const struct option lopt[] = { + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + // { "attribute", required_argument, NULL, 'A' }, + // { "file", required_argument, NULL, 'F' }, + // { "inode", required_argument, NULL, 'I' }, + // { "name", required_argument, NULL, 'N' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + int err = 0; + int ver = 0; + int help = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else if (!opts.file) { + opts.file = argv[optind-1]; + } else { + opts.device = NULL; + opts.file = NULL; + err++; + } + break; + case 'f': + opts.force++; + break; + case 'h': + case '?': + help++; + break; + case 'V': + ver++; + break; + default: + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + err++; + break; + } + } + + if (help || ver) { + } else { + if ((opts.device == NULL) || + (opts.file == NULL)) { + if (argc > 1) + Eprintf ("You must specify one device and one file.\n"); + err++; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + +/** + * cat + */ +int cat (ntfs_volume *vol, ntfs_inode *inode) +{ + const int bufsize = 1024; + char *buffer; + ntfs_attr *attr; + s64 read; + s64 offset; + + buffer = malloc (bufsize); + if (!buffer) + return 1; + + attr = ntfs_attr_open (inode, AT_DATA, NULL, 0); + if (!attr) { + Eprintf ("Cannot cat a directory.\n"); + return 1; + } + + offset = 0; + do { + read = ntfs_attr_pread (attr, offset, bufsize, buffer); + fwrite (buffer, read, 1, stdout); + offset += read; + } while (read > 0); + + ntfs_attr_close (attr); + free (buffer); + return 0; +} + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main (int argc, char *argv[]) +{ + ntfs_volume *vol; + ntfs_inode *inode; + int result = 1; + + if (!parse_options (argc, argv)) + return 1; + + utils_set_locale(); + + vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); + if (!vol) { + printf ("!vol\n"); + return 1; + } + + inode = utils_pathname_to_inode (vol, NULL, opts.file); + if (!inode) { + printf ("!inode\n"); + return 1; + } + + result = cat (vol, inode); + + ntfs_inode_close (inode); + ntfs_umount (vol, FALSE); + if (result) + ;//printf ("failed\n"); + else + ;//printf ("success\n"); + return result; +} + diff --git a/ntfsprogs/ntfscat.h b/ntfsprogs/ntfscat.h new file mode 100644 index 00000000..81170d2a --- /dev/null +++ b/ntfsprogs/ntfscat.h @@ -0,0 +1,37 @@ +/* + * ntfscat - Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Richard Russon + * + * This utility will concatenate files and print on the standard output. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFSCAT_H_ +#define _NTFSCAT_H_ + +#include "types.h" + +struct options { + char *device; /* Device/File to work with */ + char *file; /* File to display */ + int force; /* Override common sense */ +}; + +#endif /* _NTFSCAT_H_ */ + + From 25509ed087d5a3127cd861211e07f82cd18db30a Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 10 Oct 2003 23:22:23 +0000 Subject: [PATCH 0737/2994] Added ntfscat to the build It's only a quick draft BKrev: 3f873f2fbg4v3nRZGsDndAfrqrMCBw From f28338e40c92194a88c269962be4008fc32d6328 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 10 Oct 2003 23:22:23 +0000 Subject: [PATCH 0738/2994] Initial revision --- ntfsprogs/ntfscat.8.in | 90 ---------------- ntfsprogs/ntfscat.c | 237 ----------------------------------------- ntfsprogs/ntfscat.h | 37 ------- 3 files changed, 364 deletions(-) diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in index 64b76bdf..e69de29b 100644 --- a/ntfsprogs/ntfscat.8.in +++ b/ntfsprogs/ntfscat.8.in @@ -1,90 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2003 Richard Russon. All Rights Reserved. -.\" This file may be copied under the terms of the GNU Public License. -.\" -.TH NTFSCAT 8 "October 2003" "Linux-NTFS version @VERSION@" -.SH NAME -ntfscat \- concatenate files and print them on the standard output -.SH SYNOPSIS -.B ntfscat -[ -.I options -] -.B device file -.SH DESCRIPTION -.B ntfscat -will read a file from an NTFS volume and display the contents on the standard output. -.PP -The case of the filename passed to -.B ntfscat -is ignored. -.SH OPTIONS -Below is a summary of all the options that -.B ntfscat -accepts. All options have two equivalent names. The short name is preceded by -.BR \- -and the long name is preceded by -.BR \-\- . -Any single letter options, that don't take an argument, can be combined into a -single command, e.g. -.BR \-fv -is equivalent to -.BR "\-f \-v" . -Long named options can be abbreviated to any unique prefix of their name. -.TP -.B \-f -.br -.ns -.TP -.B \-\-force -This will override some sensible defaults, such as not working with a mounted -volume. Use this option with caution. -.TP -.B \-h -.br -.ns -.TP -.B \-\-help -Show a list of options with a brief description of each one. -.TP -.B \-V -.br -.ns -.TP -.B \-\-version -Show the version number, copyright and license -.BR ntfscat . -.SH EXAMPLES -Display the contents of a file in the root of an NTFS volume. -.RS -.sp -.B ntfscat /dev/hda1 boot.ini -.sp -.RE -Display the contents of a file in a subdirectory of an NTFS volume. -.RS -.sp -.B ntfscat /dev/hda1 /winnt/system32/drivers/etc/hosts -.SH BUGS -.B ntfscat -was written in a short time, to get something "out there". It needs a lot more work. -If you find any bugs, please send an email to -.nh - -.hy -.SH AUTHOR -.B ntfscat -was written by Richard Russon (FlatCap) -.br -If you find this tool useful, make FlatCap happy and send him an email. -.SH AVAILABILITY -.B ntfscat -is part of the linux\-ntfs package and is available from -.br -.nh -http://linux\-ntfs.sourceforge.net/downloads.html -.hy -.SH SEE ALSO -.BR ntfsls (8), -.BR ntfsprogs (8) - diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 754f2409..e69de29b 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -1,237 +0,0 @@ -/** - * ntfscat - Part of the Linux-NTFS project. - * - * Copyright (c) 2003 Richard Russon - * - * This utility will concatenate files and print on the standard output. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include -#include -#include -#include - -#include "types.h" -#include "attrib.h" -#include "utils.h" -#include "volume.h" -#include "debug.h" -#include "dir.h" -#include "ntfscat.h" - -static const char *EXEC_NAME = "ntfscat"; -static struct options opts; -static int verbose = 0; -static int quiet = 0; - -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &quiet, FALSE) - -/** - * version - Print version information about the program - * - * Print a copyright statement and a brief description of the program. - * - * Return: none - */ -void version (void) -{ - printf ("\n%s v%s - Concatenate files and print on the standard output.\n\n", - EXEC_NAME, VERSION); - printf ("Copyright (c) 2003 Richard Russon\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); -} - -/** - * usage - Print a list of the parameters to the program - * - * Print a list of the parameters and options for the program. - * - * Return: none - */ -void usage (void) -{ - printf ("\nUsage: %s [options] device file\n" - " -f --force Use less caution\n" - " -V --version Version information\n" - " -h --help Print this help\n\n", - //" -A --attribute Display this attribute", - //" -I --file Display this file", - //" -F --inode Display this inode", - //" -N --name Display this attribute name", - //" -r --raw Display the compressed or encrypted file", - EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); -} - -/** - * parse_options - Read and validate the programs command line - * - * Read the command line, verify the syntax and parse the options. - * This function is very long, but quite simple. - * - * Return: 1 Success - * 0 Error, one or more problems - */ -int parse_options (int argc, char **argv) -{ - static const char *sopt = "-fh?V"; // A:F:I:N: - static const struct option lopt[] = { - { "force", no_argument, NULL, 'f' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, - // { "attribute", required_argument, NULL, 'A' }, - // { "file", required_argument, NULL, 'F' }, - // { "inode", required_argument, NULL, 'I' }, - // { "name", required_argument, NULL, 'N' }, - { NULL, 0, NULL, 0 } - }; - - char c = -1; - int err = 0; - int ver = 0; - int help = 0; - - opterr = 0; /* We'll handle the errors, thank you. */ - - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { - switch (c) { - case 1: /* A non-option argument */ - if (!opts.device) { - opts.device = argv[optind-1]; - } else if (!opts.file) { - opts.file = argv[optind-1]; - } else { - opts.device = NULL; - opts.file = NULL; - err++; - } - break; - case 'f': - opts.force++; - break; - case 'h': - case '?': - help++; - break; - case 'V': - ver++; - break; - default: - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); - err++; - break; - } - } - - if (help || ver) { - } else { - if ((opts.device == NULL) || - (opts.file == NULL)) { - if (argc > 1) - Eprintf ("You must specify one device and one file.\n"); - err++; - } - } - - if (ver) - version(); - if (help || err) - usage(); - - return (!err && !help && !ver); -} - -/** - * cat - */ -int cat (ntfs_volume *vol, ntfs_inode *inode) -{ - const int bufsize = 1024; - char *buffer; - ntfs_attr *attr; - s64 read; - s64 offset; - - buffer = malloc (bufsize); - if (!buffer) - return 1; - - attr = ntfs_attr_open (inode, AT_DATA, NULL, 0); - if (!attr) { - Eprintf ("Cannot cat a directory.\n"); - return 1; - } - - offset = 0; - do { - read = ntfs_attr_pread (attr, offset, bufsize, buffer); - fwrite (buffer, read, 1, stdout); - offset += read; - } while (read > 0); - - ntfs_attr_close (attr); - free (buffer); - return 0; -} - -/** - * main - Begin here - * - * Start from here. - * - * Return: 0 Success, the program worked - * 1 Error, something went wrong - */ -int main (int argc, char *argv[]) -{ - ntfs_volume *vol; - ntfs_inode *inode; - int result = 1; - - if (!parse_options (argc, argv)) - return 1; - - utils_set_locale(); - - vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); - if (!vol) { - printf ("!vol\n"); - return 1; - } - - inode = utils_pathname_to_inode (vol, NULL, opts.file); - if (!inode) { - printf ("!inode\n"); - return 1; - } - - result = cat (vol, inode); - - ntfs_inode_close (inode); - ntfs_umount (vol, FALSE); - if (result) - ;//printf ("failed\n"); - else - ;//printf ("success\n"); - return result; -} - diff --git a/ntfsprogs/ntfscat.h b/ntfsprogs/ntfscat.h index 81170d2a..e69de29b 100644 --- a/ntfsprogs/ntfscat.h +++ b/ntfsprogs/ntfscat.h @@ -1,37 +0,0 @@ -/* - * ntfscat - Part of the Linux-NTFS project. - * - * Copyright (c) 2003 Richard Russon - * - * This utility will concatenate files and print on the standard output. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFSCAT_H_ -#define _NTFSCAT_H_ - -#include "types.h" - -struct options { - char *device; /* Device/File to work with */ - char *file; /* File to display */ - int force; /* Override common sense */ -}; - -#endif /* _NTFSCAT_H_ */ - - From 8f1f232253ff646d5b465925c7431949e9d320ff Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 10 Oct 2003 23:22:23 +0000 Subject: [PATCH 0739/2994] add ntfscat to the build (Logical change 1.195) --- ntfsprogs/Makefile.am | 6 +++++- ntfsprogs/Makefile.in | 32 ++++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 84243ca7..d699ab63 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -27,7 +27,7 @@ LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfscat man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ @@ -79,6 +79,10 @@ ntfsls_LDFLAGS = $(AM_LFLAGS) # We don't distribute these +ntfscat_SOURCES = ntfscat.c ntfscat.h utils.c utils.h +ntfscat_LDADD = $(AM_LIBS) +ntfscat_LDFLAGS = $(AM_LFLAGS) + ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 2eb4ff42..7d802246 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -113,7 +113,7 @@ LINK = $(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfscat man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ @@ -166,6 +166,10 @@ ntfsls_LDFLAGS = $(AM_LFLAGS) # We don't distribute these +ntfscat_SOURCES = ntfscat.c ntfscat.h utils.c utils.h +ntfscat_LDADD = $(AM_LIBS) +ntfscat_LDFLAGS = $(AM_LFLAGS) + ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) @@ -188,7 +192,7 @@ CONFIG_CLEAN_FILES = mkntfs.8 ntfsclone.8 ntfscluster.8 ntfsfix.8 \ ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 ntfsresize.8 \ ntfsundelete.8 EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) dumplog$(EXEEXT) \ - ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) + ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) ntfscat$(EXEEXT) bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ ntfsls$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) ntfsundelete$(EXEEXT) \ @@ -208,6 +212,12 @@ mkntfs_OBJECTS = $(am_mkntfs_OBJECTS) @REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ @REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfscat_OBJECTS = ntfscat.$(OBJEXT) utils.$(OBJEXT) +ntfscat_OBJECTS = $(am_ntfscat_OBJECTS) +@REALLYSTATIC_TRUE@ntfscat_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfscat_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la am_ntfsclone_OBJECTS = ntfsclone.$(OBJEXT) utils.$(OBJEXT) ntfsclone_OBJECTS = $(am_ntfsclone_OBJECTS) @REALLYSTATIC_TRUE@ntfsclone_DEPENDENCIES = \ @@ -283,7 +293,8 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrdef.Po ./$(DEPDIR)/boot.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/dumplog.Po ./$(DEPDIR)/mkntfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsclone.Po ./$(DEPDIR)/ntfscluster.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfscat.Po ./$(DEPDIR)/ntfsclone.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfscluster.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsdump_logfile.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsfix.Po ./$(DEPDIR)/ntfsinfo.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfslabel.Po ./$(DEPDIR)/ntfsls.Po \ @@ -297,10 +308,11 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -DIST_SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfsclone_SOURCES) \ - $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) \ - $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) \ - $(ntfsls_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) \ +DIST_SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ + $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) \ + $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ + $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ + $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) \ $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) NROFF = nroff @@ -308,7 +320,7 @@ MANS = $(man_MANS) DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsclone.8.in \ ntfscluster.8.in ntfsfix.8.in ntfsinfo.8.in ntfslabel.8.in \ ntfsls.8.in ntfsprogs.8.in ntfsresize.8.in ntfsundelete.8.in -SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) +SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) all: all-am @@ -403,6 +415,9 @@ dumplog$(EXEEXT): $(dumplog_OBJECTS) $(dumplog_DEPENDENCIES) mkntfs$(EXEEXT): $(mkntfs_OBJECTS) $(mkntfs_DEPENDENCIES) @rm -f mkntfs$(EXEEXT) $(LINK) $(mkntfs_LDFLAGS) $(mkntfs_OBJECTS) $(mkntfs_LDADD) $(LIBS) +ntfscat$(EXEEXT): $(ntfscat_OBJECTS) $(ntfscat_DEPENDENCIES) + @rm -f ntfscat$(EXEEXT) + $(LINK) $(ntfscat_LDFLAGS) $(ntfscat_OBJECTS) $(ntfscat_LDADD) $(LIBS) ntfsclone$(EXEEXT): $(ntfsclone_OBJECTS) $(ntfsclone_DEPENDENCIES) @rm -f ntfsclone$(EXEEXT) $(LINK) $(ntfsclone_LDFLAGS) $(ntfsclone_OBJECTS) $(ntfsclone_LDADD) $(LIBS) @@ -447,6 +462,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boot.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumplog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkntfs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsclone.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscluster.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsdump_logfile.Po@am__quote@ From 2fe2986b6e72028323e4d82b3d5f6d62fc01be8d Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 00:13:17 +0000 Subject: [PATCH 0740/2994] add ntfscat to the build (Logical change 1.196) --- configure | 3 ++- configure.ac | 1 + ntfsprogs.spec.in | 6 +++++- ntfsprogs/Makefile.am | 10 +++++----- ntfsprogs/Makefile.in | 29 ++++++++++++++++------------- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/configure b/configure index a2fff4ce..cf03ee9b 100755 --- a/configure +++ b/configure @@ -11026,7 +11026,7 @@ done # Makefiles to be created by configure. - ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile libntfs/Makefile ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" + ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile libntfs/Makefile ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -11603,6 +11603,7 @@ do "libntfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libntfs/Makefile" ;; "ntfsprogs/Makefile" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/Makefile" ;; "ntfsprogs/mkntfs.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/mkntfs.8" ;; + "ntfsprogs/ntfscat.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscat.8" ;; "ntfsprogs/ntfsclone.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsclone.8" ;; "ntfsprogs/ntfscluster.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscluster.8" ;; "ntfsprogs/ntfsfix.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsfix.8" ;; diff --git a/configure.ac b/configure.ac index c5fd4ded..3cbf20fa 100644 --- a/configure.ac +++ b/configure.ac @@ -140,6 +140,7 @@ AC_CONFIG_FILES([ libntfs/Makefile ntfsprogs/Makefile ntfsprogs/mkntfs.8 + ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index 8bfa2ebf..3392be45 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -42,7 +42,8 @@ NTFS partition. See man 8 ntfscluster for details. files or directories within it. See man 8 ntfsinfo for details. ntfsls - List information about files in a directory residing on an NTFS partition. See man 8 ntfsls for details. - + ntfscat - Concatenate files and print their contents on the standard +output. See man 8 ntfscat for details. %package devel Summary : files required to compile software that uses libntfs @@ -87,6 +88,9 @@ rm -rf "$RPM_BUILD_ROOT" %{prefix}/lib/*.la* %changelog +* Fri Oct 19 2003 Richard Russon +- added the new utility ntfscat + * Tue Sep 30 2003 Anton Altaparmakov - added the new utilities, ntfsclone, ntfscluster, ntfsinfo, ntfsls. diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index d699ab63..6c9a73f2 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -25,13 +25,13 @@ endif # Workaround to make REALLYSTATIC work with automake 1.5. LINK=$(STATIC_LINK) $(LIBTOOL_LINK) -bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls +bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfscat +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ - ntfsclone.8 ntfscluster.8 + ntfsclone.8 ntfscluster.8 ntfscat.8 EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) @@ -77,12 +77,12 @@ ntfsls_SOURCES = ntfsls.c utils.c utils.h ntfsls_LDADD = $(AM_LIBS) ntfsls_LDFLAGS = $(AM_LFLAGS) -# We don't distribute these - ntfscat_SOURCES = ntfscat.c ntfscat.h utils.c utils.h ntfscat_LDADD = $(AM_LIBS) ntfscat_LDFLAGS = $(AM_LFLAGS) +# We don't distribute these + ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 7d802246..e4821e38 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -111,13 +111,13 @@ install_sh = @install_sh@ # Workaround to make REALLYSTATIC work with automake 1.5. LINK = $(STATIC_LINK) $(LIBTOOL_LINK) -bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls +bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfscat +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ - ntfsclone.8 ntfscluster.8 + ntfsclone.8 ntfscluster.8 ntfscat.8 EXTRA_MANS = @@ -164,12 +164,12 @@ ntfsls_SOURCES = ntfsls.c utils.c utils.h ntfsls_LDADD = $(AM_LIBS) ntfsls_LDFLAGS = $(AM_LFLAGS) - -# We don't distribute these ntfscat_SOURCES = ntfscat.c ntfscat.h utils.c utils.h ntfscat_LDADD = $(AM_LIBS) ntfscat_LDFLAGS = $(AM_LFLAGS) + +# We don't distribute these ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) @@ -188,13 +188,13 @@ dumplog_LDFLAGS = $(AM_LFLAGS) subdir = ntfsprogs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = mkntfs.8 ntfsclone.8 ntfscluster.8 ntfsfix.8 \ - ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 ntfsresize.8 \ - ntfsundelete.8 +CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ + ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 \ + ntfsresize.8 ntfsundelete.8 EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) dumplog$(EXEEXT) \ - ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) ntfscat$(EXEEXT) + ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ - ntfsls$(EXEEXT) + ntfsls$(EXEEXT) ntfscat$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) ntfsundelete$(EXEEXT) \ ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) @@ -317,9 +317,10 @@ DIST_SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ NROFF = nroff MANS = $(man_MANS) -DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsclone.8.in \ - ntfscluster.8.in ntfsfix.8.in ntfsinfo.8.in ntfslabel.8.in \ - ntfsls.8.in ntfsprogs.8.in ntfsresize.8.in ntfsundelete.8.in +DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfscat.8.in \ + ntfsclone.8.in ntfscluster.8.in ntfsfix.8.in ntfsinfo.8.in \ + ntfslabel.8.in ntfsls.8.in ntfsprogs.8.in ntfsresize.8.in \ + ntfsundelete.8.in SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) all: all-am @@ -333,6 +334,8 @@ Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.s cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) mkntfs.8: $(top_builddir)/config.status mkntfs.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +ntfscat.8: $(top_builddir)/config.status ntfscat.8.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsclone.8: $(top_builddir)/config.status ntfsclone.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfscluster.8: $(top_builddir)/config.status ntfscluster.8.in From 765d4c6b68d7307c052b6b9d9a3310e76004abe2 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 00:13:17 +0000 Subject: [PATCH 0741/2994] add ntfscat to the build BKrev: 3f874b1dot_rME-X7XkPubMOGMUX0A From 210c470c0b4352771e41ed75b5103059175370e9 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 15:23:42 +0000 Subject: [PATCH 0742/2994] Change from Szaka BKrev: 3f88207es3ugCbsEJLGpsBx_CVmT8Q From 64a627283d161a2d566b3f7d4cc8caefc9ed6e31 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 15:23:42 +0000 Subject: [PATCH 0743/2994] typo (Logical change 1.197) --- ntfsprogs/ntfsresize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 4af6b012..1c1b5dc4 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1300,8 +1300,8 @@ void mount_volume() if (ntfs_check_if_mounted(opt.volume, &mntflag)) { perr_printf("Failed to check '%s' mount state", opt.volume); - printf("Probably /etc/mtab is missing. It's too risky to" - "continue.\nYou might try an another Linux distro.\n"); + printf("Probably /etc/mtab is missing. It's too risky to " + "continue. You might try\nan another Linux distro.\n"); exit(1); } if (mntflag & NTFS_MF_MOUNTED) { From ecfbb6ba20a2f1ba886473cf32c71a2b62e7a991 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 15:30:47 +0000 Subject: [PATCH 0744/2994] add ntfscat to news (Logical change 1.198) --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7da8e748..fe82314b 100644 --- a/NEWS +++ b/NEWS @@ -3,7 +3,7 @@ Current news Added new utilities: ntfsclone by Szakacsits Szabolcs, ntfscluster by Richard Russon, ntfsinfo by Matthew Fanto, ntfsls originally by Lode Leroy, modified -by Anton Altaparmakov. +by Anton Altaparmakov, ntfscat by Richard Russon. Library internal enhancements and API additions. Of particular note is the device io abstraction layer and the addition of the win32 device operations. From 20cc34942ab2a658bab57761aefecdd7f05e5361 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 15:30:47 +0000 Subject: [PATCH 0745/2994] extras for cat BKrev: 3f882227mv5TgXoddRLna9ViQPAZ1g From a4f7f86a7b5e3e72a7bcaab0925d0c168e472a9c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 15:30:47 +0000 Subject: [PATCH 0746/2994] ignore ntfscat (Logical change 1.198) --- BitKeeper/etc/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index ae30fc92..f3e0a703 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -32,6 +32,7 @@ ntfsprogs-*.tar.gz # specific programs ntfsprogs/dumplog ntfsprogs/mkntfs +ntfsprogs/ntfscat ntfsprogs/ntfsclone ntfsprogs/ntfscluster ntfsprogs/ntfsdump_logfile From ecbe65ac6bff458bf9bb51631e516dd2cbbbae02 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 15:31:25 +0000 Subject: [PATCH 0747/2994] first draft of mft search contexts (Logical change 1.199) --- ntfsprogs/utils.c | 149 ++++++++++++++++++++++++++++++++++++++++++++++ ntfsprogs/utils.h | 29 +++++++++ 2 files changed, 178 insertions(+) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 295ba72c..869e86be 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -833,6 +833,155 @@ int utils_is_metadata (ntfs_inode *inode) } +/** + * mft_get_search_ctx + */ +struct mft_search_ctx * mft_get_search_ctx (ntfs_volume *vol) +{ + struct mft_search_ctx *ctx; + + ctx = calloc (1, sizeof *ctx); + + ctx->mft_num = -1; + ctx->vol = vol; + + return ctx; +} + +/** + * mft_put_search_ctx + */ +void mft_put_search_ctx (struct mft_search_ctx *ctx) +{ + if (!ctx) + return; + if (ctx->inode) + ntfs_inode_close (ctx->inode); + free (ctx); +} + +/** + * mft_next_record + */ +int mft_next_record (struct mft_search_ctx *ctx) +{ + ATTR_RECORD *attr10 = NULL; + ATTR_RECORD *attr20 = NULL; + ATTR_RECORD *attr80 = NULL; + ntfs_attr_search_ctx *attr_ctx; + + if (!ctx) + return -1; + + if (ctx->inode) { + ntfs_inode_close (ctx->inode); + ctx->inode = NULL; + } + + for (ctx->mft_num++; ctx->mft_num < ctx->vol->nr_mft_records; ctx->mft_num++) { + ctx->flags_match = 0; + int in_use = utils_mftrec_in_use (ctx->vol, (MFT_REF) ctx->mft_num); + if (in_use == -1) { + Eprintf ("Error reading inode %lld. Aborting.", ctx->mft_num); + return -1; + } + + if (in_use) { + ctx->flags_match |= FEMR_IN_USE; + + ctx->inode = ntfs_inode_open (ctx->vol, (MFT_REF) ctx->mft_num); + if (ctx->inode == NULL) { + Eprintf ("Error reading inode %lld.", ctx->mft_num); + return -1; + } + + attr10 = find_first_attribute (AT_STANDARD_INFORMATION, ctx->inode->mrec); + attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, ctx->inode->mrec); + attr80 = find_first_attribute (AT_DATA, ctx->inode->mrec); + + if (attr10) + ctx->flags_match |= FEMR_BASE_RECORD; + else + ctx->flags_match |= FEMR_NOT_BASE_RECORD; + + if (attr20) + ctx->flags_match |= FEMR_BASE_RECORD; + + if (attr80) + ctx->flags_match |= FEMR_FILE; + + if (ctx->flags_search & FEMR_DIR) { + attr_ctx = ntfs_attr_get_search_ctx (NULL, ctx->inode->mrec); + if (attr_ctx) { + if (ntfs_attr_lookup (AT_INDEX_ROOT, I30, 4, 0, 0, NULL, 0, attr_ctx) == 0) + ctx->flags_match |= FEMR_DIR; + + ntfs_attr_put_search_ctx (attr_ctx); + } else { + Eprintf ("Couldn't create a search context.\n"); + return -1; + } + } + + switch (utils_is_metadata (ctx->inode)) { + case 1: ctx->flags_match |= FEMR_METADATA; break; + case 0: ctx->flags_match |= FEMR_NOT_METADATA; break; + default: + ctx->flags_match |= FEMR_NOT_METADATA; break; + //Eprintf ("Error reading inode %lld.", ctx->mft_num); + //return -1; + } + + } else { // !in_use + ntfs_attr *mft; + + ctx->flags_match |= FEMR_NOT_IN_USE; + + ctx->inode = calloc (1, sizeof (*ctx->inode)); + if (!ctx->inode) { + Eprintf ("Out of memory. Aborting."); + return -1; + } + + ctx->inode->mft_no = ctx->mft_num; + ctx->inode->vol = ctx->vol; + ctx->inode->mrec = malloc (ctx->vol->mft_record_size); + if (!ctx->inode->mrec) { + free (ctx->inode); // == ntfs_inode_close + Eprintf ("Out of memory. Aborting."); + return -1; + } + + mft = ntfs_attr_open (ctx->vol->mft_ni, AT_DATA, NULL, 0); + if (!mft) { + Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); + // free / close + return -1; + } + + if (ntfs_attr_pread (mft, ctx->vol->mft_record_size * ctx->mft_num, ctx->vol->mft_record_size, ctx->inode->mrec) < ctx->vol->mft_record_size) { + Eprintf ("Couldn't read MFT Record %lld: %s.\n", ctx->mft_num, strerror (errno)); + // free / close + return -1; + } + } + + if (ctx->flags_match & ctx->flags_search) { + break; + } + + if (ntfs_inode_close (ctx->inode)) { + Eprintf ("Error closing inode %lld.", ctx->mft_num); + return -errno; + } + + ctx->inode = NULL; + } + + return (ctx->inode == NULL); +} + + #if 0 hamming weight inline unsigned int hweight32(unsigned int w) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 733c2892..66864154 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -81,4 +81,33 @@ s64 utc2ntfs (time_t time); ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft); +/** + * defines... + * if *not in use* then the other flags are ignored? + */ +#define FEMR_IN_USE 1 << 0 +#define FEMR_NOT_IN_USE 1 << 1 +#define FEMR_FILE 1 << 2 // $DATA +#define FEMR_DIR 1 << 3 // $INDEX_ROOT, "$I30" +#define FEMR_METADATA 1 << 4 +#define FEMR_NOT_METADATA 1 << 5 +#define FEMR_BASE_RECORD 1 << 6 +#define FEMR_NOT_BASE_RECORD 1 << 7 +#define FEMR_ALL_RECORDS 0xFF + +/** + * struct mft_search_ctx + */ +struct mft_search_ctx { + int flags_search; + int flags_match; + ntfs_inode *inode; + u64 mft_num; + ntfs_volume *vol; +}; + +struct mft_search_ctx * mft_get_search_ctx (ntfs_volume *vol); +void mft_put_search_ctx (struct mft_search_ctx *ctx); +int mft_next_record (struct mft_search_ctx *ctx); + #endif /* _NTFS_UTILS_H_ */ From da7c9dd404f178813b760d81e9d1fe641a484709 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 15:31:25 +0000 Subject: [PATCH 0748/2994] first draft of mft search contexts BKrev: 3f88224dTLrNVxEryLY6fNIw5gLUIg From 740b9f98a431cf42626a6888f9f911322d5c08d4 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 15:36:14 +0000 Subject: [PATCH 0749/2994] added info to cluster BKrev: 3f88236eh8dxdQM-2Q0DXxejZX3meA From 1bd078c21ac283ded1535578b16ef9d5c4a18549 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 15:36:14 +0000 Subject: [PATCH 0750/2994] gather info using mft search contexts (Logical change 1.200) --- ntfsprogs/ntfscluster.c | 154 ++++++++++++++++++++++++---------------- 1 file changed, 93 insertions(+), 61 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index fffcbdf3..0af3237a 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "ntfscluster.h" #include "types.h" @@ -33,6 +34,7 @@ #include "utils.h" #include "volume.h" #include "debug.h" +#include "dir.h" static const char *EXEC_NAME = "ntfscluster"; static struct options opts; @@ -223,83 +225,113 @@ int parse_options (int argc, char **argv) /** - * free_space - Calculate the amount of space which isn't in use - */ -u64 free_space (ntfs_volume *vol) -{ - return 0; -} - -/** - * user_space - Calculate the amount of space of the user's files - */ -u64 user_space (ntfs_volume *vol) -{ - return 0; -} - -/** - * meta_space - Calculate the amount of space used by the filesystem structures - */ -u64 meta_space (ntfs_volume *vol) -{ - return 0; -} - -/** - * info - Display information about the volume + * info */ int info (ntfs_volume *vol) { - u64 a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q; - int cps; - u64 fs, us, ms; + u64 a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u; + int cb, sb, cps; + u64 uc = 0, mc = 0, fc = 0; - cps = vol->cluster_size_bits - vol->sector_size_bits; - fs = free_space (vol); - ms = meta_space (vol); - us = user_space (vol); + struct mft_search_ctx *m_ctx; + ntfs_attr_search_ctx *a_ctx; + runlist_element *rl; + ATTR_RECORD *rec; + int z; + int inuse = 0; + + m_ctx = mft_get_search_ctx (vol); + m_ctx->flags_search = FEMR_IN_USE | FEMR_METADATA | FEMR_BASE_RECORD | FEMR_NOT_BASE_RECORD; + while (mft_next_record (m_ctx) == 0) { + + if (!(m_ctx->flags_match & FEMR_IN_USE)) + continue; + + inuse++; + + a_ctx = ntfs_attr_get_search_ctx (NULL, m_ctx->inode->mrec); + + while ((rec = find_attribute (AT_UNUSED, a_ctx))) { + + if (!rec->non_resident) + continue; + + rl = ntfs_mapping_pairs_decompress (vol, rec, NULL); + + for (z = 0; rl[z].length > 0; z++) + { + if (rl[z].lcn >= 0) { + if (m_ctx->flags_match & FEMR_METADATA) + mc += rl[z].length; + else + uc += rl[z].length; + } + + } + + free (rl); + } + + ntfs_attr_put_search_ctx (a_ctx); + } + mft_put_search_ctx (m_ctx); + + cb = vol->cluster_size_bits; + sb = vol->sector_size_bits; + cps = cb - sb; + + fc = vol->nr_clusters-mc-uc; + fc <<= cb; + mc <<= cb; + uc <<= cb; a = vol->sector_size; b = vol->cluster_size; c = 1 << cps; - d = vol->nr_clusters >> cps; + d = vol->nr_clusters << cb; e = vol->nr_clusters; - f = vol->nr_mft_records; - g = 0; - h = 0; - i = fs / a; - j = fs / b; - k = fs * 100 / a / d; - l = us / a; - m = us / b; - n = us * 100 / a / d; - o = ms / a; - p = ms / b; - q = ms * 100 / a / d; + f = vol->nr_clusters >> cps; + g = vol->nr_mft_records; + h = inuse; + i = h * 100 / g; + j = fc; + k = fc >> sb; + l = fc >> cb; + m = fc * 100 / b / e; + n = uc; + o = uc >> sb; + p = uc >> cb; + q = uc * 100 / b / e; + r = mc; + s = mc >> sb; + t = mc >> cb; + u = mc * 100 / b / e; printf ("bytes per sector : %lld\n", a); printf ("bytes per cluster : %lld\n", b); printf ("sectors per cluster : %lld\n", c); - printf ("sectors per volume : %lld\n", d); - printf ("clusters per volume : %lld\n", e); - printf ("mft records total : %lld\n", f); - printf ("mft records in use : %lld\n", g); - printf ("mft records percentage : %lld\n", h); - printf ("sectors of free space : %lld\n", i); - printf ("clusters of free space : %lld\n", j); - printf ("percentage free space : %lld\n", k); - printf ("sectors of user data : %lld\n", l); - printf ("clusters of user data : %lld\n", m); - printf ("percentage user data : %lld\n", n); - printf ("sectors of metadata : %lld\n", o); - printf ("clusters of metadata : %lld\n", p); - printf ("percentage metadata : %lld\n", q); + printf ("bytes per volume : %lld\n", d); + printf ("sectors per volume : %lld\n", e); + printf ("clusters per volume : %lld\n", f); + printf ("mft records total : %lld\n", g); + printf ("mft records in use : %lld\n", h); + printf ("mft records percentage : %lld\n", i); + printf ("bytes of free space : %lld\n", j); + printf ("sectors of free space : %lld\n", k); + printf ("clusters of free space : %lld\n", l); + printf ("percentage free space : %lld\n", m); + printf ("bytes of user data : %lld\n", n); + printf ("sectors of user data : %lld\n", o); + printf ("clusters of user data : %lld\n", p); + printf ("percentage user data : %lld\n", q); + printf ("bytes of metadata : %lld\n", r); + printf ("sectors of metadata : %lld\n", s); + printf ("clusters of metadata : %lld\n", t); + printf ("percentage metadata : %lld\n", u); return 0; } - /** * cluster_find */ @@ -471,7 +503,7 @@ int main (int argc, char *argv[]) */ case act_info: default: - info (vol); + result = info (vol); break; } From 177ad3b69326211906a599cc5d0ddf7b249bcc08 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 15:36:14 +0000 Subject: [PATCH 0751/2994] slight rearrangement to group standard options (Logical change 1.200) --- ntfsprogs/ntfsinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index d863d2be..65932059 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -83,14 +83,14 @@ void usage (void) printf ("\nUsage: %s [options] -d dev\n" " -d dev --device dev The ntfs volume to display information about\n" " -i num --inode num Display information about this inode\n" + " -t --epochtime Report all timestamps as \"Thu Jan 1 00:00:00 1970\"\n" + " -T --notime Don't report timestamps at all\n" "\n" " -f --force Use less caution\n" " -q --quiet Less output\n" " -v --verbose More output\n" " -V --version Display version information\n" - " -h --help Display this help\n\n" - " -t --epochtime Report all timestamps as \"Thu Jan 1 00:00:00 1970\"\n" - " -T --notime Don't report timestamps at all\n", + " -h --help Display this help\n\n", EXEC_NAME); printf ("%s%s\n", ntfs_bugs, ntfs_home); } From def94f5b0c8e0b79181fd67c48c8bc2726ceb46b Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 15:36:14 +0000 Subject: [PATCH 0752/2994] typo (Logical change 1.200) --- ntfsprogs/ntfscluster.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfscluster.h b/ntfsprogs/ntfscluster.h index 45ed324e..9e2a28f4 100644 --- a/ntfsprogs/ntfscluster.h +++ b/ntfsprogs/ntfscluster.h @@ -1,9 +1,9 @@ /* * ntfscluster - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002-2003 Richard Russon * - * This utility will XXX + * This utility will locate the owner of any given sector or cluster. * * 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 From 9e26482dd5f8c0e229d19c44ccba47aa2efacb8b Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 21:47:38 +0000 Subject: [PATCH 0753/2994] mem leak in error path (Logical change 1.201) --- ntfsprogs/ntfscat.c | 238 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 238 insertions(+) diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index e69de29b..99e61cff 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -0,0 +1,238 @@ +/** + * ntfscat - Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Richard Russon + * + * This utility will concatenate files and print on the standard output. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "types.h" +#include "attrib.h" +#include "utils.h" +#include "volume.h" +#include "debug.h" +#include "dir.h" +#include "ntfscat.h" + +static const char *EXEC_NAME = "ntfscat"; +static struct options opts; +static int verbose = 0; +static int quiet = 0; + +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &verbose, TRUE) +GEN_PRINTF (Qprintf, stdout, &quiet, FALSE) + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + printf ("\n%s v%s - Concatenate files and print on the standard output.\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c) 2003 Richard Russon\n"); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + printf ("\nUsage: %s [options] device file\n" + " -f --force Use less caution\n" + " -V --version Version information\n" + " -h --help Print this help\n\n", + //" -A --attribute Display this attribute", + //" -I --file Display this file", + //" -F --inode Display this inode", + //" -N --name Display this attribute name", + //" -r --raw Display the compressed or encrypted file", + EXEC_NAME); + printf ("%s%s\n", ntfs_bugs, ntfs_home); +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char **argv) +{ + static const char *sopt = "-fh?V"; // A:F:I:N: + static const struct option lopt[] = { + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + // { "attribute", required_argument, NULL, 'A' }, + // { "file", required_argument, NULL, 'F' }, + // { "inode", required_argument, NULL, 'I' }, + // { "name", required_argument, NULL, 'N' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + int err = 0; + int ver = 0; + int help = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else if (!opts.file) { + opts.file = argv[optind-1]; + } else { + opts.device = NULL; + opts.file = NULL; + err++; + } + break; + case 'f': + opts.force++; + break; + case 'h': + case '?': + help++; + break; + case 'V': + ver++; + break; + default: + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + err++; + break; + } + } + + if (help || ver) { + } else { + if ((opts.device == NULL) || + (opts.file == NULL)) { + if (argc > 1) + Eprintf ("You must specify one device and one file.\n"); + err++; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + +/** + * cat + */ +int cat (ntfs_volume *vol, ntfs_inode *inode) +{ + const int bufsize = 1024; + char *buffer; + ntfs_attr *attr; + s64 read; + s64 offset; + + buffer = malloc (bufsize); + if (!buffer) + return 1; + + attr = ntfs_attr_open (inode, AT_DATA, NULL, 0); + if (!attr) { + Eprintf ("Cannot cat a directory.\n"); + free (buffer); + return 1; + } + + offset = 0; + do { + read = ntfs_attr_pread (attr, offset, bufsize, buffer); + fwrite (buffer, read, 1, stdout); + offset += read; + } while (read > 0); + + ntfs_attr_close (attr); + free (buffer); + return 0; +} + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main (int argc, char *argv[]) +{ + ntfs_volume *vol; + ntfs_inode *inode; + int result = 1; + + if (!parse_options (argc, argv)) + return 1; + + utils_set_locale(); + + vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); + if (!vol) { + printf ("!vol\n"); + return 1; + } + + inode = utils_pathname_to_inode (vol, NULL, opts.file); + if (!inode) { + printf ("!inode\n"); + return 1; + } + + result = cat (vol, inode); + + ntfs_inode_close (inode); + ntfs_umount (vol, FALSE); + if (result) + ;//printf ("failed\n"); + else + ;//printf ("success\n"); + return result; +} + From c111faac87f485c430f8354a8f687ac9d7929914 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 11 Oct 2003 21:47:38 +0000 Subject: [PATCH 0754/2994] ntfscat.c: mem leak in error path BKrev: 3f887a7a5FVGZLFZe4o60DNEWK4Cbg From a241416f4446c09349e5b4dce6c87d6d8aea4c91 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 12 Oct 2003 12:45:23 +0000 Subject: [PATCH 0755/2994] first draft of ntfswipe BKrev: 3f894ce3go_56GpMy2qN3sLIUMzLpQ From 5420628b1d6ee226e667ff3a9830a71471a7a224 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 12 Oct 2003 12:45:23 +0000 Subject: [PATCH 0756/2994] wipe unused space seems to work (Logical change 1.202) --- ntfsprogs/ntfswipe.c | 106 +++++++++++++++++++++++++++++++++---------- 1 file changed, 82 insertions(+), 24 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 194e1c36..d4c53328 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -55,8 +55,7 @@ void version (void) { printf ("\n%s v%s - Overwrite the unused space on an NTFS Volume.\n\n", EXEC_NAME, VERSION); - printf ("Copyright (c)\n"); - printf (" 2002-2003 Richard Russon\n"); + printf ("Copyright (c) 2002-2003 Richard Russon\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -351,13 +350,47 @@ int parse_options (int argc, char *argv[]) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -int wipe_unused (ntfs_volume *vol, int byte, enum action act) +s64 wipe_unused (ntfs_volume *vol, int byte, enum action act) { + u64 i; + u64 total = 0; + u64 result = 0; + u8 *buffer = NULL; + if (!vol || (byte < 0)) - return 0; + return -1; + + if (act != act_info) { + buffer = malloc (vol->cluster_size); + if (!buffer) { + Eprintf ("malloc failed\n"); + return -1; + } + memset (buffer, byte, vol->cluster_size); + } + + for (i = 0; i < vol->nr_clusters; i++) { + if (utils_cluster_in_use (vol, i)) { + //Vprintf ("cluster %lld is in use\n", i); + continue; + } + + if (act != act_wipe) { + //Vprintf ("cluster %lld is not in use\n", i); + result = ntfs_pwrite (vol->dev, vol->cluster_size * i, vol->cluster_size, buffer); + if (result != vol->cluster_size) { + Eprintf ("write failed\n"); + goto free; + } + } + + total += vol->cluster_size; + } Qprintf ("wipe_unused 0x%02x\n", byte); - return 1; +free: + free (buffer); + return total; } /** @@ -371,13 +404,13 @@ int wipe_unused (ntfs_volume *vol, int byte, enum action act) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -int wipe_tails (ntfs_volume *vol, int byte, enum action act) +s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) { if (!vol || (byte < 0)) - return 0; + return -1; - Qprintf ("wipe_tails 0x%02x\n", byte); - return 1; + Qprintf ("wipe_tails (not implemented) 0x%02x\n", byte); + return 0; } /** @@ -391,13 +424,36 @@ int wipe_tails (ntfs_volume *vol, int byte, enum action act) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -int wipe_mft (ntfs_volume *vol, int byte, enum action act) +s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) { + u64 i; + u64 total = 0; + u8 *buffer = NULL; + if (!vol || (byte < 0)) - return 0; + return -1; + + if (act == wipe) { + buffer = malloc (vol->mft_record_size); + if (!buffer) { + Eprintf ("malloc failed\n"); + return -1; + } + } + + for (i = 0; i < vol->nr_mft_records; i++) { + if (utils_mftrec_in_use (vol, i)) { + total += 300; // some token amount? + } else { + if (act == act_info) { + total += vol->mft_record_size; + continue; + } + } + } Qprintf ("wipe_mft 0x%02x\n", byte); - return 1; + return total; } /** @@ -411,13 +467,13 @@ int wipe_mft (ntfs_volume *vol, int byte, enum action act) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -int wipe_directory (ntfs_volume *vol, int byte, enum action act) +s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) { if (!vol || (byte < 0)) - return 0; + return -1; - Qprintf ("wipe_directory 0x%02x\n", byte); - return 1; + Qprintf ("wipe_directory (not implemented) 0x%02x\n", byte); + return 0; } /** @@ -431,13 +487,13 @@ int wipe_directory (ntfs_volume *vol, int byte, enum action act) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -int wipe_logfile (ntfs_volume *vol, int byte, enum action act) +s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act) { if (!vol || (byte < 0)) - return 0; + return -1; - Qprintf ("wipe_logfile 0x%02x\n", byte); - return 1; + Qprintf ("wipe_logfile (not implemented) 0x%02x\n", byte); + return 0; } /** @@ -451,13 +507,13 @@ int wipe_logfile (ntfs_volume *vol, int byte, enum action act) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -int wipe_pagefile (ntfs_volume *vol, int byte, enum action act) +s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act) { if (!vol || (byte < 0)) - return 0; + return -1; - Qprintf ("wipe_pagefile 0x%02x\n", byte); - return 1; + Qprintf ("wipe_pagefile (not implemented) 0x%02x\n", byte); + return 0; } @@ -805,6 +861,8 @@ int main (int argc, char *argv[]) if (act == act_info) break; } + + printf ("%llu bytes were wiped\n", total); } result = 0; From ea789ac0e238f3738c9b911fb0eda79ed892fa2e Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 12 Oct 2003 12:48:46 +0000 Subject: [PATCH 0757/2994] ntfswipe.c: typo BKrev: 3f894daeuwKPTwtDA5ZWkFYu9tXXoA From ff9c58f35ebb7324db76780e543f4dff7c76a026 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 12 Oct 2003 12:48:46 +0000 Subject: [PATCH 0758/2994] typo (Logical change 1.203) --- ntfsprogs/ntfswipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index d4c53328..dc7f4486 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -433,7 +433,7 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) if (!vol || (byte < 0)) return -1; - if (act == wipe) { + if (act == act_wipe) { buffer = malloc (vol->mft_record_size); if (!buffer) { Eprintf ("malloc failed\n"); From a3338b7ec23c10c7a6d1dce90eecdb653b670421 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 12 Oct 2003 17:22:04 +0000 Subject: [PATCH 0759/2994] Updates from Szaka BKrev: 3f898dbcmP0NFtngexGwpYJHjmnv7w From 7c7dd078076da98c7266293ede20a2402cf31ba6 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 12 Oct 2003 17:22:04 +0000 Subject: [PATCH 0760/2994] new man page (Logical change 1.204) --- ntfsprogs/ntfsclone.8.in | 162 +++++++++++++++++++++++++++++++++++---- 1 file changed, 146 insertions(+), 16 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index befdf869..c40d328d 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -1,19 +1,105 @@ -.\" Copyright (c) 2003 Richard Russon. All Rights Reserved. +.\" -*- nroff -*- +.\" Copyright (c) 2003 Richard Russon +.\" Copyright (c) 2003 Szabolcs Szakacsits +.\" All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLONE 8 "September 2003" "Linux\-NTFS version @VERSION@" +.TH NTFSCLONE 8 "Oct 2003" "ntfsprogs @VERSION@" .SH NAME -ntfsclone \- Copy an NTFS volume. +ntfsclone \- Efficiently clone an NTFS filesystem .SH SYNOPSIS .B ntfsclone [ -.I options +.B -fhm +] +.B -o +[ +.I FILE +| +.B - ] .B device +.br +.B ntfsclone +[ +.B -fhm +] +.B -O +.I FILE +.B device .SH DESCRIPTION .B ntfsclone -will efficiently clone an NTFS volume to a sparse file, device or stdandard -output. +will efficiently clone (copy, save, backup, restore) an NTFS filesystem to a +sparse file, device (partition) or standard output. +It works at disk sector level and +copies only the used data. Unused disk space becomes zero (cloning to +sparse file), left unchanged (cloning to a disk/partition) or +filled with zeros (cloning to standard output). + +.B ntfsclone +can be useful to make backups, an exact snapshot of an NTFS filesystem +and restore it later on, or for developers to test NTFS read/write +functionality, troubleshot/investigate users' issues using the clone +without the risk of destroying the original filesystem. + +The clone is an exact copy of the original +NTFS filesystem from sector to sector thus it can be also mounted +just like the original NTFS filesystem. +For example an ntfsclone'd sparse file can be mounted as + 'mount -t ntfs -o loop ntfsclone.img /mnt/ntfsclone' +.SH HANDLING LARGE SPARSE FILES +As of today Linux provides inadequate support for managing (tar, cp, +[un]gzip, [un]bzip2, etc) large sparse files. The only main Linux filesystem +having support for efficient sparse file handling is XFS (by XFS_IOC_GETBMAPX). +However none of the common utility supports XFS_IOC_GETBMAPX. This +means when you tar, cp, gzip, bzip2, etc a large sparse file they will +always read the entire file, even if you use the "sparse support" options. + +.BR bzip2 +compresses large sparse files much better than +.BR gzip +but it does so +also much slower, usually. Moreover neither of them handles large sparse +files efficiently during uncompression from disk space usage point of view. + +At present the most efficient way, both speed and space-wise, to +compress and uncompress large sparse files by common tools +is using +.BR tar +with the options +.B -S +(handle sparse files "efficiently") and +.B -j +(filter the archive through bzip2). Altough +.BR tar +still reads and analyses the entire file, it doesn't pass on the +large data blocks having only zeros to filters and it also avoids +writing large amount of zeros to the disk needlessly. +.SH METADATA-ONLY CLONING +One of the features of +.BR ntfsclone +is it can also save only the NTFS metadata using the option +.B -m +or +.B --metadata +and the clone still will be +mountable (but of course all non-metadata file content will be zeros). + +The metadata-only image can be compressed very +well, usually to not more than 1-3 MB thus it's relatively easy to transfer +it via the Internet for investigation to NTFS experts. + +In this mode of ntfsclone, +.B NONE +of the user's data is saved, including the resident user's data +embedded into metadata (they are also filled with zeros). +Moreover all the file timestamps, deleted and unused spaces inside +the metadata are filled with zeros. Thus this mode is inappropriate +for example for forensic analyses. + +Please note, filenames are not wiped out. They might contain +sensitive information, so think twice before sending such an +image to anybody. .SH OPTIONS Below is a summary of all the options that .B ntfsclone @@ -23,54 +109,98 @@ and the long name is preceded by .BR \-\- . Any single letter options, that don't take an argument, can be combined into a single command, e.g. -.BR \-fv +.BR \-fm is equivalent to -.BR "\-f \-v" . -Long named options can be abbreviated to any unique prefix of their name. +.BR "\-f \-m" . .TP .BI "\-o " FILE .br .ns .TP .BI "\-\-output " FILE -Clone NTFS to the non-existent FILE +Clone NTFS to the non-existent FILE. If FILE is '-' then clone to the +standard output. .TP .BI "\-O " FILE .br .ns .TP .BI "\-\-overwrite " FILE -Clone NTFS to FILE, overwriting if exists +Clone NTFS to FILE, overwriting if exists. .TP .B \-m .br .ns .TP .B \-\-metadata -Clone *only* metadata (for NTFS experts) +Clone +.B ONLY METADATA +(for NTFS experts). Moreover only cloning to a file is allowed. +You can't metadata-only clone to a device or standard output. .TP .B \-f .br .ns .TP .B \-\-force -This will override some sensible defaults, such as not working with a mounted -volume. Use this option with caution. +Forces ntfsclone to proceed, overriding some safety checks. +You can use this parameter multiply times if you want +to overcome every single safety checks. +.TP +.B \-h +.br +.ns .TP .B \-\-help Show a list of options with a brief description of each one. .SH EXAMPLES +Clone (save, backup) an NTFS to a non-existent file +.RS +.sp +.B ntfsclone \-\-output ntfs.img /dev/hda1 +.sp +.RE +Restore a clone image to its original partition +.RS +.sp +.B ntfsclone \-\-overwrite /dev/hda1 ntfs.img +.sp +.RE +Efficiently compress a clone image +.RS +.sp +.B tar \-cjSf ntfs.img.tar.bz2 ntfs.img +.sp +.RE +Efficiently uncompress a clone image +.RS +.sp +.B tar \-xjSf ntfs.img.tar.bz2 +.sp +.RE +Pack NTFS metadata for NTFS experts +.RS +.sp +.B ntfsclone \-\-metadata \-\-output ntfsmeta.img /dev/hda1 +.br +.B tar \-cjSf ntfsmeta.img.tar.bz2 ntfsmeta.img .SH BUGS This program has no known bugs. If you find one, please send an email to .nh - +. + +Sometimes it might appear ntfsclone froze using Reiserfs and even +CTRL-C won't stop it. This is not a bug in ntfsclone, however +it's due to Reiserfs being extremely inefficient creating large +sparse files and not handling signals during this operation. +XFS, JFS and ext3 don't have this problem. .hy .SH AUTHOR .B ntfsclone was written by Szabolcs Szakacsits . .SH AVAILABILITY .B ntfsclone -is part of the linux\-ntfs package and is available from +is part of the ntfsprogs package and is available from .br .nh http://linux\-ntfs.sourceforge.net/downloads.html From cc4f8fccbdb5ac91eb22b9dc6e27c0413866dc0c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 12 Oct 2003 17:38:05 +0000 Subject: [PATCH 0761/2994] typo (Logical change 1.205) --- libntfs/mst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/mst.c b/libntfs/mst.c index c63a3fad..41f42eeb 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -113,7 +113,7 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size) * NOTE: We consider the absence / invalidity of an update sequence array to * mean error. This means that you have to create a valid update sequence * array header in the ntfs record before calling this function, otherwise it - * will fail (the header needs to contain the position of the update seqeuence + * will fail (the header needs to contain the position of the update sequence * array together with the number of elements in the array). You also need to * initialise the update sequence number before calling this function * otherwise a random word will be used (whatever was in the record at that From 6be430ea0806ca3d30277d7c4fbb3709ba44f981 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 12 Oct 2003 17:38:05 +0000 Subject: [PATCH 0762/2994] wipe the mft slack space (Logical change 1.205) --- ntfsprogs/ntfswipe.c | 69 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index dc7f4486..1c27de15 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -37,7 +37,7 @@ #include "utils.h" #include "debug.h" -static const char *EXEC_NAME = "ntfswipe"; +static char *EXEC_NAME = "ntfswipe"; static struct options opts; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) @@ -107,9 +107,9 @@ void usage (void) * Return: 0 Error, invalid string * n Success, the count of numbers parsed */ -int parse_list (const char *list, int **result) +int parse_list (char *list, int **result) { - const char *ptr; + char *ptr; char *end; int i; int count; @@ -169,8 +169,8 @@ int parse_list (const char *list, int **result) */ int parse_options (int argc, char *argv[]) { - static const char *sopt = "-ab:c:dfh?ilmnpqtuvV"; - static const struct option lopt[] = { + static char *sopt = "-ab:c:dfh?ilmnpqtuvV"; + static struct option lopt[] = { { "all", no_argument, NULL, 'a' }, { "bytes", required_argument, NULL, 'b' }, { "count", required_argument, NULL, 'c' }, @@ -181,6 +181,7 @@ int parse_options (int argc, char *argv[]) { "logfile", no_argument, NULL, 'l' }, { "mft", no_argument, NULL, 'm' }, { "no-action", no_argument, NULL, 'n' }, + //{ "no-wait", no_argument, NULL, 0 }, { "pagefile", no_argument, NULL, 'p' }, { "quiet", no_argument, NULL, 'q' }, { "tails", no_argument, NULL, 't' }, @@ -352,9 +353,9 @@ int parse_options (int argc, char *argv[]) */ s64 wipe_unused (ntfs_volume *vol, int byte, enum action act) { - u64 i; - u64 total = 0; - u64 result = 0; + s64 i; + s64 total = 0; + s64 result = 0; u8 *buffer = NULL; if (!vol || (byte < 0)) @@ -375,7 +376,7 @@ s64 wipe_unused (ntfs_volume *vol, int byte, enum action act) continue; } - if (act != act_wipe) { + if (act == act_wipe) { //Vprintf ("cluster %lld is not in use\n", i); result = ntfs_pwrite (vol->dev, vol->cluster_size * i, vol->cluster_size, buffer); if (result != vol->cluster_size) { @@ -387,7 +388,7 @@ s64 wipe_unused (ntfs_volume *vol, int byte, enum action act) total += vol->cluster_size; } - Qprintf ("wipe_unused 0x%02x\n", byte); + Qprintf ("wipe_unused 0x%02x, %lld bytes\n", byte, total); free: free (buffer); return total; @@ -426,8 +427,9 @@ s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) */ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) { - u64 i; - u64 total = 0; + s64 i; + s64 total = 0; + s64 result = 0; u8 *buffer = NULL; if (!vol || (byte < 0)) @@ -449,10 +451,51 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) total += vol->mft_record_size; continue; } + + result = ntfs_attr_mst_pread (vol->mft_na, vol->mft_record_size * i, + vol->mft_record_size / vol->sector_size, vol->sector_size, buffer); + if (result != (vol->mft_record_size / vol->sector_size)) { + Eprintf ("error attr mst read %lld\n", i); + total = -1; // XXX just negate result? + goto free; + } + + // Build the record from scratch + memset (buffer, 0, vol->mft_record_size); + + *((u32*) (buffer + 0x00)) = magic_FILE; // Magic + *((u16*) (buffer + 0x06)) = cpu_to_le16 (0x0003); // USA size + *((u16*) (buffer + 0x10)) = cpu_to_le16 (0x0001); // Seq num + *((u32*) (buffer + 0x1C)) = cpu_to_le32 (vol->mft_record_size); // FILE size + *((u16*) (buffer + 0x28)) = cpu_to_le16 (0x0001); // Attr ID + + if (vol->major_ver == 3) { + *((u16*) (buffer + 0x04)) = cpu_to_le16 (0x0030); // USA offset + *((u16*) (buffer + 0x14)) = cpu_to_le16 (0x0038); // Attr offset + *((u32*) (buffer + 0x18)) = cpu_to_le32 (0x00000040); // FILE usage + *((u32*) (buffer + 0x38)) = cpu_to_le32 (0xFFFFFFFF); // End marker + } else { + *((u16*) (buffer + 0x04)) = cpu_to_le16 (0x002A); // USA offset + *((u16*) (buffer + 0x14)) = cpu_to_le16 (0x0030); // Attr offset + *((u32*) (buffer + 0x18)) = cpu_to_le32 (0x00000038); // FILE usage + *((u32*) (buffer + 0x30)) = cpu_to_le32 (0xFFFFFFFF); // End marker + } + + result = ntfs_attr_mst_pwrite (vol->mft_na, vol->mft_record_size * i, + 1, vol->mft_record_size, buffer); + if (result != 1) { + Eprintf ("error attr mst write %lld\n", i); + total = -1; + goto free; + } + + total += vol->mft_record_size; } } - Qprintf ("wipe_mft 0x%02x\n", byte); + Qprintf ("wipe_mft 0x%02x, %lld bytes\n", byte, total); +free: + free (buffer); return total; } From 6f0ffca0c0dfd79278b265822811e256b602f278 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 12 Oct 2003 17:38:05 +0000 Subject: [PATCH 0763/2994] wipe the mft slack space BKrev: 3f89917doi0v0qZS8lISZ_y1LHuifg From 3234ada8a2614bf42d2f5084eb37638786207ae7 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 12 Oct 2003 23:11:03 +0000 Subject: [PATCH 0764/2994] wipe the tails of mft records that are in use (Logical change 1.206) --- ntfsprogs/ntfswipe.c | 77 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 1c27de15..7925a481 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -430,39 +430,78 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) s64 i; s64 total = 0; s64 result = 0; + int size = 0; u8 *buffer = NULL; if (!vol || (byte < 0)) return -1; - if (act == act_wipe) { - buffer = malloc (vol->mft_record_size); - if (!buffer) { - Eprintf ("malloc failed\n"); - return -1; - } + buffer = malloc (vol->mft_record_size); + if (!buffer) { + Eprintf ("malloc failed\n"); + return -1; } for (i = 0; i < vol->nr_mft_records; i++) { if (utils_mftrec_in_use (vol, i)) { - total += 300; // some token amount? + result = ntfs_attr_mst_pread (vol->mft_na, vol->mft_record_size * i, + 1, vol->mft_record_size, buffer); + if (result != 1) { + Eprintf ("error attr mst read %lld\n", i); + total = -1; // XXX just negate result? + goto free; + } + + // We know that the end marker will only take 4 bytes + size = *((u32*) (buffer + 0x18)) - 4; + + if (act == act_info) { + //printf ("mft %d\n", size); + total += size; + continue; + } + + + + memset (buffer + size, byte, vol->mft_record_size - size); + + result = ntfs_attr_mst_pwrite (vol->mft_na, vol->mft_record_size * i, + 1, vol->mft_record_size, buffer); + if (result != 1) { + Eprintf ("error attr mst write %lld\n", i); + total = -1; + goto free; + } + + if ((vol->mft_record_size * (i+1)) <= vol->mftmirr_na->allocated_size) + { + // We have to reduce the update sequence number, or else... + u16 offset; + u16 usa; + offset = le16_to_cpu (*(buffer + 0x04)); + usa = le16_to_cpu (*(buffer + offset)); + *((u16*) (buffer + offset)) = cpu_to_le16 (usa - 1); + + result = ntfs_attr_mst_pwrite (vol->mftmirr_na, vol->mft_record_size * i, + 1, vol->mft_record_size, buffer); + if (result != 1) { + Eprintf ("error attr mst write %lld\n", i); + total = -1; + goto free; + } + } + + total += vol->mft_record_size; } else { if (act == act_info) { total += vol->mft_record_size; continue; } - result = ntfs_attr_mst_pread (vol->mft_na, vol->mft_record_size * i, - vol->mft_record_size / vol->sector_size, vol->sector_size, buffer); - if (result != (vol->mft_record_size / vol->sector_size)) { - Eprintf ("error attr mst read %lld\n", i); - total = -1; // XXX just negate result? - goto free; - } - // Build the record from scratch memset (buffer, 0, vol->mft_record_size); + // Common values *((u32*) (buffer + 0x00)) = magic_FILE; // Magic *((u16*) (buffer + 0x06)) = cpu_to_le16 (0x0003); // USA size *((u16*) (buffer + 0x10)) = cpu_to_le16 (0x0001); // Seq num @@ -470,11 +509,13 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) *((u16*) (buffer + 0x28)) = cpu_to_le16 (0x0001); // Attr ID if (vol->major_ver == 3) { + // Only XP and 2K3 *((u16*) (buffer + 0x04)) = cpu_to_le16 (0x0030); // USA offset *((u16*) (buffer + 0x14)) = cpu_to_le16 (0x0038); // Attr offset *((u32*) (buffer + 0x18)) = cpu_to_le32 (0x00000040); // FILE usage *((u32*) (buffer + 0x38)) = cpu_to_le32 (0xFFFFFFFF); // End marker - } else { + } else { + // Only NT and 2K *((u16*) (buffer + 0x04)) = cpu_to_le16 (0x002A); // USA offset *((u16*) (buffer + 0x14)) = cpu_to_le16 (0x0030); // Attr offset *((u32*) (buffer + 0x18)) = cpu_to_le32 (0x00000038); // FILE usage @@ -908,6 +949,10 @@ int main (int argc, char *argv[]) printf ("%llu bytes were wiped\n", total); } + if (ntfs_volume_set_flags (vol, VOLUME_IS_DIRTY) < 0) { + Eprintf ("Couldn't mark volume dirty\n"); + } + result = 0; umount: ntfs_umount (vol, FALSE); From a1e1de5c23915c2f2534e5e01693081bef157aba Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 12 Oct 2003 23:11:03 +0000 Subject: [PATCH 0765/2994] wipe the tails of mft records that are in use BKrev: 3f89df87Xt3EkBKm9bWoGisB_r8hpg From 9cc93c147951cf7b3f003fd6e5102a12ad81946d Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 16 Oct 2003 21:06:19 +0000 Subject: [PATCH 0766/2994] extra target to make extra programs (Logical change 1.207) --- ntfsprogs/Makefile.am | 2 ++ ntfsprogs/Makefile.in | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 6c9a73f2..6c4c5ad0 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -104,3 +104,5 @@ dumplog_LDFLAGS = $(AM_LFLAGS) strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) $(STRIP) $^ +extras: $(EXTRA_PROGRAMS) + diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index e4821e38..381d6b40 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -710,6 +710,8 @@ uninstall-man: uninstall-man8 strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) $(STRIP) $^ + +extras: $(EXTRA_PROGRAMS) # 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: From fbc51eacb0babb9c37c142c641add3cc11f7b0ee Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 16 Oct 2003 21:06:19 +0000 Subject: [PATCH 0767/2994] extra target to make extra programs BKrev: 3f8f084bO6HkPre6qMN_fXud7wbcpw From f1f109d219f6578ce892a5297d96690a3d8e3b7e Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 16 Oct 2003 21:11:12 +0000 Subject: [PATCH 0768/2994] add "extras" target (alias extra) to build extra programs BKrev: 3f8f0970wRQUWN3E3KNl4nqK3eXaDA From 6913945435882aec5178ec5a9e5a84004c69d65d Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 16 Oct 2003 21:11:12 +0000 Subject: [PATCH 0769/2994] extra/extras target (Logical change 1.208) --- Makefile.am | 5 +++++ Makefile.in | 5 +++++ ntfsprogs/Makefile.am | 2 ++ ntfsprogs/Makefile.in | 2 ++ 4 files changed, 14 insertions(+) diff --git a/Makefile.am b/Makefile.am index e541a194..150a0904 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,3 +16,8 @@ libtool: $(LIBTOOL_DEPS) strip: $(MAKE) -C ntfsprogs strip +extra: extras + +extras: + $(MAKE) -C ntfsprogs extras + diff --git a/Makefile.in b/Makefile.in index ff5aeb94..df39b487 100644 --- a/Makefile.in +++ b/Makefile.in @@ -462,6 +462,11 @@ libtool: $(LIBTOOL_DEPS) strip: $(MAKE) -C ntfsprogs strip + +extra: extras + +extras: + $(MAKE) -C ntfsprogs extras # 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/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 6c4c5ad0..11eb2a0b 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -104,5 +104,7 @@ dumplog_LDFLAGS = $(AM_LFLAGS) strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) $(STRIP) $^ +extra: extras + extras: $(EXTRA_PROGRAMS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 381d6b40..197e592a 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -711,6 +711,8 @@ uninstall-man: uninstall-man8 strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) $(STRIP) $^ +extra: extras + extras: $(EXTRA_PROGRAMS) # 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. From b44276e3f1621a6221ee710fdace95601c929790 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 17 Oct 2003 15:43:14 +0000 Subject: [PATCH 0770/2994] Add -quiet and -verbose options to ntfscat. (Logical change 1.209) --- ntfsprogs/ntfscat.8.in | 104 +++++++++++++++++++++++++++++++++++++++++ ntfsprogs/ntfscat.c | 28 ++++++++--- ntfsprogs/ntfscat.h | 40 ++++++++++++++++ 3 files changed, 166 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in index e69de29b..2d8896f5 100644 --- a/ntfsprogs/ntfscat.8.in +++ b/ntfsprogs/ntfscat.8.in @@ -0,0 +1,104 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2003 Richard Russon. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSCAT 8 "October 2003" "Linux-NTFS version @VERSION@" +.SH NAME +ntfscat \- concatenate files and print them on the standard output +.SH SYNOPSIS +.B ntfscat +[ +.I options +] +.B device file +.SH DESCRIPTION +.B ntfscat +will read a file from an NTFS volume and display the contents on the standard output. +.PP +The case of the filename passed to +.B ntfscat +is ignored. +.SH OPTIONS +Below is a summary of all the options that +.B ntfscat +accepts. All options have two equivalent names. The short name is preceded by +.BR \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.BR \-fv +is equivalent to +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. +.TP +.B \-f +.br +.ns +.TP +.B \-\-force +This will override some sensible defaults, such as not working with a mounted +volume. Use this option with caution. +.TP +.B \-h +.br +.ns +.TP +.B \-\-help +Show a list of options with a brief description of each one. +.TP +.B \-q +.br +.ns +.TP +.B \-\-quiet +Suppress some debug/warning/error messages. +.TP +.B \-V +.br +.ns +.TP +.B \-\-version +Show the version number, copyright and license +.BR ntfscat . +.TP +.B \-v +.br +.ns +.TP +.B \-\-vebose +Display more debug/warning/error messages. +.SH EXAMPLES +Display the contents of a file in the root of an NTFS volume. +.RS +.sp +.B ntfscat /dev/hda1 boot.ini +.sp +.RE +Display the contents of a file in a subdirectory of an NTFS volume. +.RS +.sp +.B ntfscat /dev/hda1 /winnt/system32/drivers/etc/hosts +.SH BUGS +.B ntfscat +was written in a short time, to get something "out there". It needs a lot more work. +If you find any bugs, please send an email to +.nh + +.hy +.SH AUTHOR +.B ntfscat +was written by Richard Russon (FlatCap) +.br +If you find this tool useful, make FlatCap happy and send him an email. +.SH AVAILABILITY +.B ntfscat +is part of the linux\-ntfs package and is available from +.br +.nh +http://linux\-ntfs.sourceforge.net/downloads.html +.hy +.SH SEE ALSO +.BR ntfsls (8), +.BR ntfsprogs (8) + diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 99e61cff..13be2e24 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -2,6 +2,7 @@ * ntfscat - Part of the Linux-NTFS project. * * Copyright (c) 2003 Richard Russon + * Copyright (c) 2003 Anton Altaparmakov * * This utility will concatenate files and print on the standard output. * @@ -38,12 +39,10 @@ static const char *EXEC_NAME = "ntfscat"; static struct options opts; -static int verbose = 0; -static int quiet = 0; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &quiet, FALSE) +GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) /** * version - Print version information about the program @@ -71,8 +70,10 @@ void usage (void) { printf ("\nUsage: %s [options] device file\n" " -f --force Use less caution\n" + " -h --help Print this help\n" + " -q --quiet Less output\n" " -V --version Version information\n" - " -h --help Print this help\n\n", + " -v --verbose More output\n\n", //" -A --attribute Display this attribute", //" -I --file Display this file", //" -F --inode Display this inode", @@ -93,11 +94,13 @@ void usage (void) */ int parse_options (int argc, char **argv) { - static const char *sopt = "-fh?V"; // A:F:I:N: + static const char *sopt = "-fh?qVv"; // A:F:I:N: static const struct option lopt[] = { { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, + { "quiet", no_argument, NULL, 'q' }, { "version", no_argument, NULL, 'V' }, + { "verbose", no_argument, NULL, 'v' }, // { "attribute", required_argument, NULL, 'A' }, // { "file", required_argument, NULL, 'F' }, // { "inode", required_argument, NULL, 'I' }, @@ -132,9 +135,15 @@ int parse_options (int argc, char **argv) case '?': help++; break; + case 'q': + opts.quiet++; + break; case 'V': ver++; break; + case 'v': + opts.verbose++; + break; default: Eprintf ("Unknown option '%s'.\n", argv[optind-1]); err++; @@ -143,6 +152,7 @@ int parse_options (int argc, char **argv) } if (help || ver) { + opts.quiet = 0; } else { if ((opts.device == NULL) || (opts.file == NULL)) { @@ -150,6 +160,12 @@ int parse_options (int argc, char **argv) Eprintf ("You must specify one device and one file.\n"); err++; } + + if (opts.quiet && opts.verbose) { + Eprintf("You may not use --quiet and --verbose at the " + "same time.\n"); + err++; + } } if (ver) diff --git a/ntfsprogs/ntfscat.h b/ntfsprogs/ntfscat.h index e69de29b..babd74f3 100644 --- a/ntfsprogs/ntfscat.h +++ b/ntfsprogs/ntfscat.h @@ -0,0 +1,40 @@ +/* + * ntfscat - Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Richard Russon + * Copyright (c) 2003 Anton Altaparmakov + * + * This utility will concatenate files and print on the standard output. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFSCAT_H_ +#define _NTFSCAT_H_ + +#include "types.h" + +struct options { + char *device; /* Device/File to work with */ + char *file; /* File to display */ + int force; /* Override common sense */ + int quiet; /* Less output */ + int verbose; /* Extra output */ +}; + +#endif /* _NTFSCAT_H_ */ + + From 7b7e3a7ed6c46738326afdda1dcb5a9015844de5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 17 Oct 2003 15:43:14 +0000 Subject: [PATCH 0771/2994] Add -quiet and -verbose options to ntfscat. Update changelog. BKrev: 3f900e12HF3XPYgygxw6DM7EtqVrVw From 67591d025676b15856476968a7ed1d3b8ef08392 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 17 Oct 2003 15:43:14 +0000 Subject: [PATCH 0772/2994] update (Logical change 1.209) --- ChangeLog | 1 + libntfs/attrib.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 09f29787..51394767 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,7 @@ xx/10/2003 - 1.8.0beta - Work in progress. - Integrate win32_io.c into the build process so win32_io ops are used when compiling under Cygwin and standard Unix style io ops are used otherwise. + - Add new utility ntfscat (Richard Russon) and a corresponding man page. - Other assorted bugfixes and developments (see NEWS and bk changes). 13/02/2003 - 1.7.1 - Urgent bug fixes. diff --git a/libntfs/attrib.c b/libntfs/attrib.c index df0a59f6..2f4d0197 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2218,7 +2218,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, na->allocated_size = new_allocated_size; na->data_size = na->initialized_size = le32_to_cpu(a->value_length); /* - * For now just clear all of these as we don't support them when + * FIXME: For now just clear all of these as we don't support them when * writing. */ NAttrClearCompressed(na); From edbeeb397fdcb720ed682c1a1a705986da7bacc3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 23 Oct 2003 12:21:17 +0000 Subject: [PATCH 0773/2994] Auto merged 2003/10/01 10:12:26+01:00 cantab.net!aia21 Auto merged 2003/09/28 14:02:46+01:00 flatcap.org!ntfs typo which made ntfslabel read only (Logical change 1.210) From 91d3027eb243772f685a41c5b125903acb5af68d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 23 Oct 2003 12:21:17 +0000 Subject: [PATCH 0774/2994] Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/10/01 10:15:31+01:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs-devel into cantab.net:/home/aia21/ntfsprogs 2003/10/01 10:12:26+01:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs-devel into cantab.net:/home/aia21/ntfsprogs 2003/09/28 14:03:11+01:00 flatcap.org!ntfs utils.c: typo which made ntfslabel read only BKrev: 3f97c7bdaB8Rg14tULiSzeQJoqzv2w From 9f07090763d59d57c1be3d6da90b5563a08b0930 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 23 Oct 2003 12:28:44 +0000 Subject: [PATCH 0775/2994] Fixes from Lode to make it work on Cygwin. (Logical change 1.211) --- libntfs/win32_io.c | 5 +++++ ntfsprogs/utils.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 9ae868d8..a8a1495c 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -33,13 +33,18 @@ * define our own... */ typedef long long int s64; +typedef unsigned long int u32; struct flock; struct stat; +struct ntfs_volume; +typedef struct ntfs_volume ntfs_volume; #include "config.h" /* Need device, but prevent ../include/types.h to be loaded. */ #define _NTFS_TYPES_H +#define _NTFS_SUPPORT_H +#define _NTFS_VOLUME_H #include "device.h" #define FORCE_ALIGNED_READ diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 66864154..0a97fb34 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -38,6 +38,10 @@ extern const char *ntfs_gpl; #define PATH_SEP '/' #define MAX_PATH 1024 +#ifndef REG_NOERROR +#define REG_NOERROR REG_OKAY +#endif + #define GEN_PRINTF(NAME, STREAM, CONTROL, TRIGGER) \ __attribute__ ((format (printf, 1, 2))) \ int NAME (const char *format, ...) \ From 80d5e408c6274afa8a454a8a3c2ceee9c070cdb1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 23 Oct 2003 12:28:44 +0000 Subject: [PATCH 0776/2994] Fixes from Lode to make it work on Cygwin. BKrev: 3f97c97czD3v7yuUzrkXnsbomw3kgA From 3b2953e8c460e92c508bfa6f8d04ec81c280e123 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 23 Oct 2003 12:41:17 +0000 Subject: [PATCH 0777/2994] Ooops. It's an ENUM not a DEFINE. Hopte this always works... (Logical change 1.212) --- ntfsprogs/utils.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 0a97fb34..55205614 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -30,6 +30,7 @@ #include #include +#include extern const char *ntfs_bugs; extern const char *ntfs_home; @@ -38,7 +39,7 @@ extern const char *ntfs_gpl; #define PATH_SEP '/' #define MAX_PATH 1024 -#ifndef REG_NOERROR +#if (REG_NOERROR != 0) #define REG_NOERROR REG_OKAY #endif From ac308c5503306145b534d5fbf2c07a222219838d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 23 Oct 2003 12:41:17 +0000 Subject: [PATCH 0778/2994] Some fixes. BKrev: 3f97cc6dCaxkaw8v4qGGTl8Yv9y_0Q From 37fdc855361b761bfc2e5c29e28446daf27936d2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 23 Oct 2003 12:41:17 +0000 Subject: [PATCH 0779/2994] Update with ntfscat. (Logical change 1.212) --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index a614ad99..3de8cdd9 100644 --- a/README +++ b/README @@ -80,3 +80,5 @@ or directories within it. See man 8 ntfsinfo for details. ntfsls - List information about files in a directory residing on an NTFS partition. See man 8 ntfsls for details. +ntfscat - Concatenate files and print their contents on the standard output. + From a98c6029efa46999916862d6f9925e39d7299502 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 23 Oct 2003 12:55:04 +0000 Subject: [PATCH 0780/2994] update (Logical change 1.213) --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 51394767..20cb1092 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/10/2003 - 1.8.0beta - Work in progress. +23/10/2003 - 1.8.0beta - The Long Overdue(TM) release. - Further work on attribute resizing. - Fix two logic inversion bugs in dir.c. Thanks to Russ Christensen for finding the first one. From aa09c472c5b338b8415859d7619059fa902cfcde Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 23 Oct 2003 12:55:04 +0000 Subject: [PATCH 0781/2994] update BKrev: 3f97cfa84KpzLme3gD-ZJNEGLdM0MQ From 5af8e6ac6338083337dd5ac5a3b90b063f2fbd8c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 26 Oct 2003 12:40:40 +0000 Subject: [PATCH 0782/2994] Lots of trivial tidyups - mostly bulletproofing BKrev: 3f9bc0c8bnGUGioYz_g-2BY7CjnvOA From 9312550eaa46e0736f32e82afe49e3a74dd2d051 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 26 Oct 2003 12:40:40 +0000 Subject: [PATCH 0783/2994] add reference to ntfscat (Logical change 1.214) --- ntfsprogs/ntfsprogs.8.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index 60d62236..3529a997 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -14,6 +14,11 @@ available for free and come with full source code. .PP .BR mkntfs (8) : Format a partition using NTFS. +.SS ntfscat +.PP +.BR ntfscat (8) +: Dump a file's contents to the standard output. +.PP .SS ntfsclone .PP .BR ntfsclone (8) From 50df3a4189aeeeac51155066aa294f37152fc8ff Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 26 Oct 2003 12:40:40 +0000 Subject: [PATCH 0784/2994] adding errnos for bad calling (Logical change 1.214) --- ntfsprogs/utils.c | 65 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 869e86be..234624f9 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -92,6 +92,14 @@ int utils_valid_device (const char *name, int force) unsigned long mnt_flags = 0; struct stat st; +#ifndef __CYGWIN32__ + return 1; /* FIXME: This doesn't work for Cygwin, so just skip it for now... */ +#endif + if (!name) { + errno = EINVAL; + return 0; + } + if (stat (name, &st) == -1) { if (errno == ENOENT) { Eprintf ("The device %s doesn't exist\n", name); @@ -137,14 +145,13 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL { ntfs_volume *vol; - if (!device) + if (!device) { + errno = EINVAL; return NULL; + } -/* FIXME: This doesn't work for Cygwin, so just skip it for now... */ -#ifndef __CYGWIN32__ if (!utils_valid_device (device, force)) return NULL; -#endif vol = ntfs_mount (device, flags); if (!vol) { @@ -169,7 +176,7 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL * utils_parse_size - Convert a string representing a size * @value: String to be parsed * @size: Parsed size - * @scale: XXX FIXME + * @scale: Whether or not to allow a suffix to scale the value * * Read a string and convert it to a number. Strings may be suffixed to scale * them. Any number without a suffix is assumed to be in bytes. @@ -193,8 +200,10 @@ int utils_parse_size (const char *value, s64 *size, BOOL scale) long long result; char *suffix = NULL; - if (!value || !size) + if (!value || !size) { + errno = EINVAL; return 0; + } Dprintf ("Parsing size '%s'.\n", value); @@ -251,8 +260,10 @@ int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale) s64 a, b; char *middle; - if (!string || !start || !finish) + if (!string || !start || !finish) { + errno = EINVAL; return 0; + } middle = strchr (string, '-'); if (string == middle) { @@ -297,7 +308,7 @@ time_t ntfs2utc (s64 time) } /** - * utc2ntfs - convert Linux time to NTFS time + * utc2ntfs - Convert Linux time to NTFS time * @time: Linux time to convert to NTFS * * Convert the Linux time @time to its corresponding NTFS time. @@ -333,8 +344,10 @@ s64 utc2ntfs (time_t time) */ ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) { - if (!ctx) + if (!ctx) { + errno = EINVAL; return NULL; + } if (ntfs_attr_lookup(type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { Dprintf ("find_attribute didn't find an attribute of type: 0x%02x.\n", type); @@ -364,8 +377,10 @@ ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) ntfs_attr_search_ctx *ctx; ATTR_RECORD *rec; - if (!mft) + if (!mft) { + errno = EINVAL; return NULL; + } ctx = ntfs_attr_get_search_ctx (NULL, mft); if (!ctx) { @@ -407,8 +422,10 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) char *names[max_path + 1];// XXX malloc? and make max bigger? int i, len, offset = 0; - if (!inode || !buffer) + if (!inode || !buffer) { + errno = EINVAL; return 0; + } vol = inode->vol; @@ -513,8 +530,10 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int ATTR_DEF *attrdef; // flags: attr, name, or both - if (!attr || !buffer) + if (!attr || !buffer) { + errno = EINVAL; return 0; + } attrdef = ntfs_attr_find_in_attrdef (vol, attr->type); if (attrdef) { @@ -589,8 +608,10 @@ int utils_cluster_in_use (ntfs_volume *vol, long long lcn) int byte, bit; ntfs_attr *attr; - if (!vol) + if (!vol) { + errno = EINVAL; return -1; + } /* Does lcn lie in the section of $Bitmap we already have cached? */ if ((lcn < bmplcn) || (lcn >= (bmplcn + (sizeof (buffer) << 3)))) { @@ -647,8 +668,10 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref) int byte, bit; - if (!vol) + if (!vol) { + errno = EINVAL; return -1; + } /* Does mref lie in the section of $Bitmap we already have cached? */ if ((mref < bmpmref) || (mref >= (bmpmref + (sizeof (buffer) << 3)))) { @@ -698,6 +721,7 @@ ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, cons char *ascii = NULL; if (!vol || !pathname) { + errno = EINVAL; return NULL; } @@ -799,8 +823,10 @@ int utils_is_metadata (ntfs_inode *inode) MFT_RECORD *file; u64 num; - if (!inode) + if (!inode) { + errno = EINVAL; return -1; + } vol = inode->vol; if (!vol) @@ -840,6 +866,11 @@ struct mft_search_ctx * mft_get_search_ctx (ntfs_volume *vol) { struct mft_search_ctx *ctx; + if (!vol) { + errno = EINVAL; + return NULL; + } + ctx = calloc (1, sizeof *ctx); ctx->mft_num = -1; @@ -870,8 +901,10 @@ int mft_next_record (struct mft_search_ctx *ctx) ATTR_RECORD *attr80 = NULL; ntfs_attr_search_ctx *attr_ctx; - if (!ctx) + if (!ctx) { + errno = EINVAL; return -1; + } if (ctx->inode) { ntfs_inode_close (ctx->inode); From 5587fe0549d16384b7fc6258452675b66805a280 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 26 Oct 2003 12:40:40 +0000 Subject: [PATCH 0785/2994] make ntfs_attr_close a bit safer (Logical change 1.214) --- libntfs/attrib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 2f4d0197..e8289316 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -382,13 +382,14 @@ err_out: */ void ntfs_attr_close(ntfs_attr *na) { + if (!na) + return; if (NAttrNonResident(na) && na->rl) free(na->rl); /* Don't release if using an internal constant. */ if (na->name != AT_UNNAMED && na->name != I30) free(na->name); free(na); - return; } /** From 4ddd73798c4bf8543c29017cd9d70944035ca79e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 27 Oct 2003 15:17:17 +0000 Subject: [PATCH 0786/2994] Fix what must be a logic inverting typo... (Logical change 1.215) --- ntfsprogs/utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 234624f9..22a4e26a 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -92,8 +92,9 @@ int utils_valid_device (const char *name, int force) unsigned long mnt_flags = 0; struct stat st; -#ifndef __CYGWIN32__ - return 1; /* FIXME: This doesn't work for Cygwin, so just skip it for now... */ +#ifdef __CYGWIN32__ + /* FIXME: This doesn't work for Cygwin, so just return success for now... */ + return 1; #endif if (!name) { errno = EINVAL; From 2e4af91cd19496e0a4345ec6c9cd87509214e118 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 27 Oct 2003 15:17:17 +0000 Subject: [PATCH 0787/2994] Fix what must be a logic inverting typo... BKrev: 3f9d36fdIdeqeMfyEj0dgKRNWsXaHA From 1ef194e7ae38a416d41c1f573108991d99df6bff Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 27 Oct 2003 17:07:57 +0000 Subject: [PATCH 0788/2994] (Logical change 1.216) --- libntfs/inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libntfs/inode.c b/libntfs/inode.c index c74268e5..81e08fbd 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -391,6 +391,7 @@ int ntfs_inode_sync(ntfs_inode *ni) if (err != EIO) err = EBUSY; } + NInoSetDirty(ni); } } @@ -410,6 +411,7 @@ int ntfs_inode_sync(ntfs_inode *ni) if (err != EIO) err = EBUSY; } + NInoSetDirty(eni); } } } From 94cf62642f5c2e8b2172a753c3d9da93f7705b27 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 27 Oct 2003 17:07:57 +0000 Subject: [PATCH 0789/2994] Leave inodes dirty if ntfs_inode_sync() fails. BKrev: 3f9d50edaxznDgbmQz0qELluUnzm3A From 75519695ef688b71c7c46f423a143c6f06bea782 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Oct 2003 13:33:42 +0000 Subject: [PATCH 0790/2994] Update from Szaka (Logical change 1.217) --- ntfsprogs/ntfsclone.8.in | 178 +++++++++++++++++++++++++------------- ntfsprogs/ntfsresize.8.in | 11 ++- 2 files changed, 127 insertions(+), 62 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index c40d328d..d77afc01 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -10,21 +10,21 @@ ntfsclone \- Efficiently clone an NTFS filesystem .SH SYNOPSIS .B ntfsclone [ -.B -fhm +.B \-fhm ] -.B -o +.B \-o [ .I FILE | -.B - +.B \- ] .B device .br .B ntfsclone [ -.B -fhm +.B \-fhm ] -.B -O +.B \-O .I FILE .B device .SH DESCRIPTION @@ -45,54 +45,84 @@ without the risk of destroying the original filesystem. The clone is an exact copy of the original NTFS filesystem from sector to sector thus it can be also mounted just like the original NTFS filesystem. -For example an ntfsclone'd sparse file can be mounted as - 'mount -t ntfs -o loop ntfsclone.img /mnt/ntfsclone' +For example if you clone to a file and the kernel has loopback device and +NTFS support then the file can be mounted as +.RS +.sp +.B mount \-t ntfs \-o loop ntfsclone.img /mnt/ntfsclone +.SH SPARSE FILES +A file is sparse if it has unallocated blocks (holes). The reported size of such +files are always higher than the disk space consumed by them. +The +.BR du +command can tell the real disk space used by a sparse file. +The holes are always read as zeros. All major Linux filesystem like, +ext2, ext3, reiserfs, Reiser4, JFS and XFS, supports +sparse files but for example the ISO 9600 CD-ROM filesystem doesn't. .SH HANDLING LARGE SPARSE FILES -As of today Linux provides inadequate support for managing (tar, cp, -[un]gzip, [un]bzip2, etc) large sparse files. The only main Linux filesystem -having support for efficient sparse file handling is XFS (by XFS_IOC_GETBMAPX). -However none of the common utility supports XFS_IOC_GETBMAPX. This -means when you tar, cp, gzip, bzip2, etc a large sparse file they will -always read the entire file, even if you use the "sparse support" options. +As of today Linux provides inadequate support for managing (tar, +cp, gzip, gunzip, bzip2, bunzip2, cat, etc) large sparse files. +The only main Linux filesystem +having support for efficient sparse file handling is XFS by the +XFS_IOC_GETBMAPX +.BR ioctl\fR. +However none of the common utility supports it. +This means when you tar, cp, gzip, bzip2, etc a large sparse file +they will always read the entire file, even if you use the "sparse support" +options. .BR bzip2 compresses large sparse files much better than .BR gzip but it does so -also much slower, usually. Moreover neither of them handles large sparse -files efficiently during uncompression from disk space usage point of view. - +also much slower. Moreover neither of them handles large sparse +files efficiently during uncompression from disk space usage point +of view. A possible workaround is if you pipe the uncompressed +stream through +.BR cp\fR, +for example this way, +.RS +.sp +.B bunzip2 \-c image.bz2 | cp \-\-sparse=always /proc/self/fd/0 image +.sp +.RE At present the most efficient way, both speed and space-wise, to compress and uncompress large sparse files by common tools is using .BR tar with the options -.B -S +.B \-S (handle sparse files "efficiently") and -.B -j +.B \-j (filter the archive through bzip2). Altough .BR tar still reads and analyses the entire file, it doesn't pass on the large data blocks having only zeros to filters and it also avoids -writing large amount of zeros to the disk needlessly. +writing large amount of zeros to the disk needlessly. But since +.BR tar +can't create an archive from the standard input, you can't do this +in-place by just reading +.BR ntfsclone +standard output. .SH METADATA-ONLY CLONING One of the features of .BR ntfsclone is it can also save only the NTFS metadata using the option -.B -m +.B \-m or -.B --metadata +.B \-\-metadata and the clone still will be -mountable (but of course all non-metadata file content will be zeros). +mountable. In this case all non-metadata file content will be lost and +reading them back will result always zeros. The metadata-only image can be compressed very well, usually to not more than 1-3 MB thus it's relatively easy to transfer -it via the Internet for investigation to NTFS experts. +it for investigation to NTFS experts. In this mode of ntfsclone, .B NONE of the user's data is saved, including the resident user's data -embedded into metadata (they are also filled with zeros). +embedded into metadata. All is filled with zeros. Moreover all the file timestamps, deleted and unused spaces inside the metadata are filled with zeros. Thus this mode is inappropriate for example for forensic analyses. @@ -113,71 +143,100 @@ single command, e.g. is equivalent to .BR "\-f \-m" . .TP -.BI "\-o " FILE -.br -.ns -.TP -.BI "\-\-output " FILE -Clone NTFS to the non-existent FILE. If FILE is '-' then clone to the +.BI "\-o, \-\-output " FILE +Clone NTFS to the non-existent +.I FILE\fR. If +.I FILE +is '-' then clone to the standard output. .TP -.BI "\-O " FILE -.br -.ns +.BI "\-O, \-\-overwrite " FILE +Clone NTFS to +.I FILE\fR, overwriting if exists. .TP -.BI "\-\-overwrite " FILE -Clone NTFS to FILE, overwriting if exists. -.TP -.B \-m -.br -.ns -.TP -.B \-\-metadata +.B \-m, \-\-metadata Clone .B ONLY METADATA (for NTFS experts). Moreover only cloning to a file is allowed. You can't metadata-only clone to a device or standard output. .TP -.B \-f -.br -.ns -.TP -.B \-\-force +.B \-f, \-\-force Forces ntfsclone to proceed, overriding some safety checks. You can use this parameter multiply times if you want to overcome every single safety checks. .TP -.B \-h -.br -.ns -.TP -.B \-\-help +.B \-h, \-\-help Show a list of options with a brief description of each one. .SH EXAMPLES -Clone (save, backup) an NTFS to a non-existent file +Cloning (save, backup) an NTFS volume to a non-existent file .RS .sp .B ntfsclone \-\-output ntfs.img /dev/hda1 .sp .RE -Restore a clone image to its original partition +Restoring a clone image to its original partition .RS .sp .B ntfsclone \-\-overwrite /dev/hda1 ntfs.img .sp .RE -Efficiently compress a clone image +Space and speed-wise the most efficient way to compress a clone image .RS .sp .B tar \-cjSf ntfs.img.tar.bz2 ntfs.img .sp .RE -Efficiently uncompress a clone image +Uncompressing a +.BR tar +archived clone image .RS .sp .B tar \-xjSf ntfs.img.tar.bz2 .sp .RE +In-place compressing an NTFS volume. Note, gzip is faster usually +at least 2-4 times but it creates also bigger compressed files. +.RS +.sp +.B ntfsclone \-\-output ntfs.img /dev/hda1 | bzip2 \-c > ntfs.img.bz2 +.sp +.RE +Restoring an NTFS volume from a compressed image +.RS +.sp +.B bunzip2 \-c ntfs.img.bz2 | dd of=/dev/hda1 +.sp +.RE +Backup an NTFS volume to a remote host, using +.BR ssh +default compression. +.RS +.sp +.B ntfsclone \-o \- /dev/hda1 | ssh \-C host 'bzip \-c9 > ntfs.img.bz2' +.sp +.RE +Clone an NTFS volume to a remote host, using +.BR ssh +default compression (type everything in one line). +.RS +.sp +.B ntfsclone \-o \- /dev/hda1 | \\\\ +.br +.B ssh \-C host 'cat | cp \-\-sparse=always /proc/self/fd/0 ntfs.img' +.sp +.RE +Clone a remote NTFS volume to the local filesystem via +.BR ssh +using a custom compression level (type everything in one line). +Speed-wise the optimal compression level depends on your network, +disk and CPU speed, saturation. +.RS +.sp +.B ssh host 'ntfsclone \-o \- /dev/hda1 | gzip \-2c' | \\\\ +.br +.B gunzip \-c | cp \-\-sparse=always /proc/self/fd/0 ntfs.img +.sp +.RE Pack NTFS metadata for NTFS experts .RS .sp @@ -189,10 +248,11 @@ This program has no known bugs. If you find one, please send an email to .nh . -Sometimes it might appear ntfsclone froze using Reiserfs and even -CTRL-C won't stop it. This is not a bug in ntfsclone, however -it's due to Reiserfs being extremely inefficient creating large -sparse files and not handling signals during this operation. +Sometimes it might appear ntfsclone froze if the clone is on ReiserFS +and even CTRL-C won't stop it. This is not a bug in ntfsclone, however +it's due to ReiserFS being extremely inefficient creating large +sparse files and not handling signals during this operation. This +ReiserFS problem was improved in kernel 2.4.22. XFS, JFS and ext3 don't have this problem. .hy .SH AUTHOR diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 2206722d..aa87ca86 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -48,9 +48,14 @@ of the partition thus it refuses to resize at .I size if there is any. To convert the inodes to meaningful file names, you must mount -the partition and run for instance - 'find /mount/point -inum -o -inum ...'. - +the partition with the +.I show_sys_files +mount option and run for instance +.RS +.sp +.B find /mount/point \-inum \-o \-inum ... +.sp +.RE Before a real resize operation, always make a read-only test run using the .B -n From 39a75b5f61e590183b06249edd4f06882f98264d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Oct 2003 13:33:42 +0000 Subject: [PATCH 0791/2994] ntfsresize.8.in, ntfsclone.8.in: Update from Szaka BKrev: 3f9fc1b6yY_L5e3AsI700wYtB6rrDg From 86f747e6731031d9f98b2c53c90c464e28b94fa7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Oct 2003 14:45:57 +0000 Subject: [PATCH 0792/2994] Update comments. (Logical change 1.218) --- include/layout.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/layout.h b/include/layout.h index c526276f..df4b7185 100644 --- a/include/layout.h +++ b/include/layout.h @@ -593,8 +593,8 @@ typedef struct { /* 12*/ ATTR_FLAGS flags; /* Flags describing the attribute. */ /* 14*/ u16 instance; /* The instance of this attribute record. This number is unique within this mft record (see - MFT_RECORD/next_attribute_instance notes in - in mft.h for more details). */ + MFT_RECORD/next_attribute_instance notes + above for more details). */ /* 16*/ union { /* Resident attributes. */ struct { From a0010c53b99991be241476783786e10b8502d708 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Oct 2003 14:45:57 +0000 Subject: [PATCH 0793/2994] layout.h: Update comments. BKrev: 3f9fd2a5nlzYmNm052jCfL-xn6X7AA From d993588f0cbc449de761ed59b0e79e3dd5caa75c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Oct 2003 17:35:15 +0000 Subject: [PATCH 0794/2994] Implement rollback in ntfs_mft_record_free(). (Logical change 1.219) --- libntfs/mft.c | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/libntfs/mft.c b/libntfs/mft.c index b9bd4b49..f8497730 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -278,7 +278,8 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, u64 start) int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni) { u64 mft_no; - u16 seq_no; + int err; + u16 seq_no, old_seq_no; if (!vol || !vol->mftbmp_na || !ni) { errno = EINVAL; @@ -292,34 +293,44 @@ int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni) ni->mrec->flags &= ~MFT_RECORD_IN_USE; /* Increment the sequence number, skipping zero, if it is not zero. */ - seq_no = le16_to_cpu(ni->mrec->sequence_number); + old_seq_no = seq_no = le16_to_cpu(ni->mrec->sequence_number); if (seq_no == 0xffff) seq_no = 1; else if (seq_no) seq_no++; ni->mrec->sequence_number = cpu_to_le16(seq_no); - /* Set the inode dirty and close it so it is written out. */ + /* Set the inode dirty and write it out. */ ntfs_inode_mark_dirty(ni); - if (ntfs_inode_close(ni)) { - int eo = errno; - // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! Failed to close the inode." - "Leaving inconsistent metadata!\n", - __FUNCTION__); - errno = eo; - return -1; + if (ntfs_inode_sync(ni)) { + err = errno; + goto sync_rollback; } /* Clear the bit in the $MFT/$BITMAP corresponding to this record. */ if (ntfs_bitmap_clear_run(vol->mftbmp_na, mft_no, 1)) { - // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! Failed to clear the allocation " - "in the mft bitmap. Leaving deleted mft record " - "marked as in use in the mft bitmap and " - "pretending we succeeded. Error: %s\n", - __FUNCTION__, strerror(errno)); + err = errno; + // FIXME: If ntfs_bitmap_clear_run() guarantees atomicity on + // error, this could be changed to goto sync_rollback; + goto bitmap_rollback; } - return 0; + + /* Throw away the now freed inode. */ + if (!ntfs_inode_close(ni)) + return 0; + err = errno; + + /* Rollback what we did... */ +bitmap_rollback: + if (ntfs_bitmap_set_run(vol->mftbmp_na, mft_no, 1)) + fprintf(stderr, "Eeek! Rollback failed in " + "ntfs_mft_record_free(). Leaving inconsistent " + "metadata!"); +sync_rollback: + ni->mrec->flags |= MFT_RECORD_IN_USE; + ni->mrec->sequence_number = cpu_to_le16(old_seq_no); + ntfs_inode_mark_dirty(ni); + errno = err; + return -1; } From 34a712077d6b7946d38ff322b802446749233d5f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Oct 2003 17:35:15 +0000 Subject: [PATCH 0795/2994] mft.c: Implement rollback in ntfs_mft_record_free(). BKrev: 3f9ffa53BHsDTqMVHN9BU459RtuXTw From 8f310e5bf2fb1789432d186979f4fd489ceb5026 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Oct 2003 17:40:03 +0000 Subject: [PATCH 0796/2994] Make ntfs_attr_make_non_resident() return error EPERM if it is called for an attribute that cannot be non-resident. Implement ntfs_attr_can_be_resident(). Start working on ntfs_attr_make_resident(). (Logical change 1.220) --- libntfs/attrib.c | 144 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 107 insertions(+), 37 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e8289316..23c4c364 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2030,6 +2030,42 @@ int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type) return -1; } +/** + * ntfs_attr_can_be_resident - check if an attribute can be resident + * @vol: ntfs volume to which the attribute belongs + * @type: attribute type which to check + * + * Check whether the attribute of @type on the ntfs volume @vol is allowed to + * be resident. This information is derived from our ntfs knowledge and may + * not be completely accurate, especially when user defined attributes are + * present. Basically we allow everything to be resident except for index + * allocation and extended attribute attributes. + * + * Return 0 if the attribute is allowed to be resident and -1 if not or an + * error occured. On error the error code is stored in errno. The following + * error codes are defined: + * EPERM - The attribute is not allowed to be resident. + * EINVAL - Invalid parameters (e.g. @vol is not valid). + * + * Warning: In the system file $MFT the attribute $Bitmap must be non-resident + * otherwise windows will not boot (blue screen of death)! We cannot + * check for this here as we don't know which inode's $Bitmap is being + * asked about so the caller needs to special case this. + */ +int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type) +{ + if (!vol || !vol->attrdef || !type) { + errno = EINVAL; + return -1; + } + + if (type != AT_INDEX_ALLOCATION && type != AT_EA) + return 0; + + errno = EPERM; + return -1; +} + /** * ntfs_attr_record_resize - resize an attribute record * @m: mft record containing attribute record @@ -2150,7 +2186,10 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, * * Convert a resident ntfs attribute to a non-resident one. * - * Return 0 on success and -1 on error with errno set to the error code. + * Return 0 on success and -1 on error with errno set to the error code. The + * following error codes are defined: + * EPERM - The attribute is not allowed to be non-resident. + * TODO: others... * * NOTE to self: No changes in the attribute list are required to move from * a resident to a non-resident attribute. @@ -2177,6 +2216,11 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, errno = EINVAL; return -1; } + + /* Check that the attribute is allowed to be non-resident. */ + if (ntfs_attr_can_be_non_resident(vol, na->type)) + return -1; + /* * Check that the attribute name hasn't been placed after the * attribute value. If it has we need to move it. @@ -2419,37 +2463,22 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) } /* There is not enough space in the mft record to perform the resize. */ - /* Check if the attribute is allowed to be non-resident. */ - if (!ntfs_attr_can_be_non_resident(vol, na->type)) { - /* Make the attribute non-resident. */ - if (!ntfs_attr_make_non_resident(na, ctx)) { - // TODO: Attribute is now non-resident. Resize it! - // goto resize_done; - fprintf(stderr, "%s(): TODO: Resize attribute now that " - "it is non-resident.\n", __FUNCTION__); - ntfs_inode_mark_dirty(ctx->ntfs_ino); - err = ENOTSUP; - goto put_err_out; - } - /* Error! If not enough space, just continue. */ - if (errno != ENOSPC) { - err = errno; - // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Failed to make attribute " - "non-resident. Aborting...\n", - __FUNCTION__); - goto put_err_out; - } - } else { - /* - * If the attribute can be non-resident but an error occured - * while making it non-resident, abort. - */ - if (errno != EPERM) { - err = errno; - goto put_err_out; - } - /* Attribute is not allowed to be non-resident, continue. */ + /* Make the attribute non-resident if possible. */ + if (!ntfs_attr_make_non_resident(na, ctx)) { + // TODO: Attribute is now non-resident. Resize it! + // goto resize_done; + fprintf(stderr, "%s(): TODO: Resize attribute now that " + "it is non-resident.\n", __FUNCTION__); + ntfs_inode_mark_dirty(ctx->ntfs_ino); + err = ENOTSUP; + goto put_err_out; + } else if (errno != ENOSPC && errno != EPERM) { + err = errno; + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Failed to make attribute " + "non-resident. Aborting...\n", + __FUNCTION__); + goto put_err_out; } // TODO: Try to make other attributes non-resident. @@ -2476,14 +2505,30 @@ put_err_out: } /** - * ntfs_attr_make_resident - + * ntfs_attr_make_resident - convert a non-resident to a resident attribute + * @na: open ntfs attribute to make resident + * @ctx: ntfs search context describing the attribute + * + * Convert a non-resident ntfs attribute to a resident one. + * + * Return 0 on success and -1 on error with errno set to the error code. The + * following error codes are defined: + * EPERM - The attribute is not allowed to be resident. + * TODO: others... + * + * Warning: We do not set the inode dirty and we do not write out anything! + * We expect the caller to do this as this is a fairly low level + * function and it is likely there will be further changes made. */ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) { - // FIXME: For now we cheat and assume there is no attribute list - // present. (AIA) - if (NInoAttrList(na->ni)) { - errno = ENOTSUP; + /* Some preliminary sanity checking. */ + if (!NAttrNonResident(na)) { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Trying to make resident " + "attribute resident. Aborting...\n", + __FUNCTION__); + errno = EINVAL; return -1; } @@ -2493,6 +2538,31 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) return -1; } + /* Check that the attribute is allowed to be resident. */ + if (ntfs_attr_can_be_resident(vol, na->type)) + return -1; + + /* + * Check that the attribute name hasn't been placed after the + * mapping pairs array. If it has we need to move it. + * TODO: Implement the move. For now just abort. (AIA) + */ + if (a->name_length && le16_to_cpu(a->name_offset) >= + le16_to_cpu(a->mapping_pairs_offset)) { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Name is placed after the mapping " + "pairs array. Aborting...\n", __FUNCTION__); + errno = ENOTSUP; + return -1; + } + + // FIXME: For now we cheat and assume there is no attribute list + // present. (AIA) + if (NInoAttrList(na->ni)) { + errno = ENOTSUP; + return -1; + } + errno = ENOTSUP; return -1; From d4d4557ed35427e4a4f08306fc73f6ebe1bded1f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Oct 2003 17:40:03 +0000 Subject: [PATCH 0797/2994] attrib.c: Make ntfs_attr_make_non_resident() return error EPERM if it is called for an attribute that cannot be non-resident. Implement ntfs_attr_can_be_resident(). Start working on ntfs_attr_make_resident(). BKrev: 3f9ffb731gg594AWzF_6XAc1KD2PfQ From 3088f60dc30e0634e845b7945f90deaab96efb2d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Oct 2003 17:42:45 +0000 Subject: [PATCH 0798/2994] Ooops. Make it compile... (Logical change 1.221) --- libntfs/attrib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 23c4c364..a9a733e6 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2522,6 +2522,9 @@ put_err_out: */ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) { + ntfs_volume *vol = na->ni->vol; + ATTR_REC *a = ctx->attr; + /* Some preliminary sanity checking. */ if (!NAttrNonResident(na)) { // FIXME: Eeek! From 316fb4f6db9c4aa6af7171936f3360e23b3f3755 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Oct 2003 17:42:45 +0000 Subject: [PATCH 0799/2994] attrib.c: Ooops. Make it compile... BKrev: 3f9ffc15SDTXIustGMyY_iq3c5xYZg From 46a7f90e148d278c6a73656f73676b0fbfa5d40d Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 29 Oct 2003 19:19:53 +0000 Subject: [PATCH 0800/2994] Auto merged 2003/10/29 13:33:58+00:00 flatcap.org!ntfs updates from Szaka (Logical change 1.222) From 49002f504f67b1136cdd7850a28b78993f13d8bb Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 29 Oct 2003 19:19:53 +0000 Subject: [PATCH 0801/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into flatcap.org:/root/web/bk/ntfsprogs 2003/10/29 16:17:56+00:00 flatcap.org!ntfs Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into flatcap.org:/root/web/bk/ntfsprogs 2003/10/29 14:36:52+00:00 flatcap.org!ntfs Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into flatcap.org:/root/web/bk/ntfsprogs 2003/10/29 13:33:59+00:00 flatcap.org!ntfs updates from Szaka BKrev: 3fa012d97TxRLQT1yV0B5GI_HlHK9A From 2a4f72d8348f4ec88e2b49a135e91f595bf6b1d5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0802/2994] (Logical change 1.223) --- include/gnome-vfs-module.h | 38 ++ libntfs/gnome-vfs-method.c | 877 +++++++++++++++++++++++++++++++++++++ libntfs/gnome-vfs-module.c | 77 ++++ libntfs/libntfs.conf.in | 1 + 4 files changed, 993 insertions(+) create mode 100644 include/gnome-vfs-module.h create mode 100644 libntfs/gnome-vfs-method.c create mode 100644 libntfs/gnome-vfs-module.c create mode 100644 libntfs/libntfs.conf.in diff --git a/include/gnome-vfs-module.h b/include/gnome-vfs-module.h new file mode 100644 index 00000000..c8b38979 --- /dev/null +++ b/include/gnome-vfs-module.h @@ -0,0 +1,38 @@ +/* + * gnome-vfs-module.h - Exports for Gnome-VFS init/shutdown implementation of + * interface to libntfs. Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Jan Kratochvil + * Copyright (c) 2000-2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_GNOME_VFS_MODULE_H +#define _NTFS_GNOME_VFS_MODULE_H + +G_BEGIN_DECLS + +G_LOCK_EXTERN(libntfs); + +#define libntfs_newn(objp, n) ((objp) = g_new(typeof(*(objp)), (n))) +#define libntfs_new(objp) (libntfs_newn((objp), 1)) +#define LIBNTFS_MEMZERO(objp) (memset((objp), 0, sizeof(*(objp)))) + +G_END_DECLS + +#endif /* _NTFS_GNOME_VFS_MODULE_H */ + diff --git a/libntfs/gnome-vfs-method.c b/libntfs/gnome-vfs-method.c new file mode 100644 index 00000000..3b0c9c37 --- /dev/null +++ b/libntfs/gnome-vfs-method.c @@ -0,0 +1,877 @@ +/* + * gnome-vfs-method.c - Gnome-VFS init/shutdown implementation of interface to + * libntfs. Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Jan Kratochvil + * Copyright (c) 2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#undef FALSE +#undef TRUE +#include "types.h" /* for 'FALSE'/'TRUE' libntfs definition */ +#define FALSE FALSE +#define TRUE TRUE + +#include "gnome-vfs-method.h" /* self */ +#include +#include +#include "gnome-vfs-module.h" +#include +#include +#include + +#include "volume.h" +#include "dir.h" + +static GnomeVFSMethod GnomeVFSMethod_static; +G_LOCK_DEFINE_STATIC(GnomeVFSMethod_static); + +/* map: (gchar *)method_name -> (struct method_name_info *) */ +static GHashTable *method_name_hash; +G_LOCK_DEFINE_STATIC(method_name_hash); + +struct method_name_info { + gchar *args; +}; + +static void method_name_hash_key_destroy_func(gchar *key) +{ + g_return_if_fail(key != NULL); + + g_free(key); +} + +static void method_name_hash_value_destroy_func(struct method_name_info *value) +{ + g_return_if_fail(value != NULL); + + g_free(value->args); + g_free(value); +} + +static void method_name_hash_init(void) +{ + G_LOCK(method_name_hash); + if (!method_name_hash) { + method_name_hash = g_hash_table_new_full( + g_str_hash, /* hash_func */ + g_str_equal, /* key_equal_func */ + (GDestroyNotify) method_name_hash_key_destroy_func, /* key_destroy_func */ + (GDestroyNotify) method_name_hash_value_destroy_func); /* value_destroy_func */ + } + G_UNLOCK(method_name_hash); +} + +/* + * map: (gchar *)uri_parent_string "method_name:uri_parent" -> (ntfs_volume *) + */ +static GHashTable *uri_parent_string_hash; +G_LOCK_DEFINE_STATIC(uri_parent_string_hash); + +static void uri_parent_string_hash_key_destroy_func(gchar *key) +{ + g_return_if_fail(key != NULL); + + g_free(key); +} + +static void uri_parent_string_hash_value_destroy_func(ntfs_volume *value) +{ + g_return_if_fail(value != NULL); + + ntfs_umount( /* errors ignored */ + value, /* vol */ + TRUE); /* force; possibly loose modifications */ +} + +static void uri_parent_string_hash_init(void) +{ + G_LOCK(uri_parent_string_hash); + if (!uri_parent_string_hash) { + uri_parent_string_hash = g_hash_table_new_full( + g_str_hash, /* hash_func */ + g_str_equal, /* key_equal_func */ + (GDestroyNotify) uri_parent_string_hash_key_destroy_func, /* key_destroy_func */ + (GDestroyNotify) uri_parent_string_hash_value_destroy_func); /* value_destroy_func */ + } + G_UNLOCK(uri_parent_string_hash); +} + +static GnomeVFSResult libntfs_gnomevfs_uri_parent_init( + ntfs_volume **volume_return, GnomeVFSURI *uri) +{ + gchar *uri_parent_string; + gchar *uri_parent_string_parent; + ntfs_volume *volume; + + g_return_val_if_fail(uri != NULL, GNOME_VFS_ERROR_INVALID_URI); + g_return_val_if_fail(volume_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + uri_parent_string_hash_init(); + + if (!uri->parent) + return GNOME_VFS_ERROR_INVALID_URI; + if (!uri->text) /* not needed here but we don't permit non-specific fs-image reference */ + return GNOME_VFS_ERROR_INVALID_URI; + uri_parent_string_parent = gnome_vfs_uri_to_string(uri->parent, + GNOME_VFS_URI_HIDE_NONE); + g_assert(uri_parent_string_parent != NULL); + + uri_parent_string = g_strdup_printf("%s:%s", uri->method_string, + uri_parent_string_parent); + g_assert(uri_parent_string != NULL); + + G_LOCK(uri_parent_string_hash); + volume = g_hash_table_lookup(uri_parent_string_hash, uri_parent_string); + G_UNLOCK(uri_parent_string_hash); + if (!volume) { + struct method_name_info *method_name_info; + + G_LOCK(method_name_hash); + method_name_info = g_hash_table_lookup(method_name_hash, + uri->method_string); + G_UNLOCK(method_name_hash); + if (!method_name_info) { + /* should not happend */ + g_return_val_if_reached(GNOME_VFS_ERROR_INVALID_URI); + } + + /* TODO: Generic GnomeVFS filter. */ + if (strcmp(uri->parent->method_string, "file")) { + g_free(uri_parent_string); + return GNOME_VFS_ERROR_INVALID_URI; + } + + if (!(volume = ntfs_mount(uri->parent->text, MS_RDONLY))) { + g_free(uri_parent_string); + return GNOME_VFS_ERROR_WRONG_FORMAT; + } + + G_LOCK(uri_parent_string_hash); + g_hash_table_insert(uri_parent_string_hash, + g_strdup(uri_parent_string), volume); + G_UNLOCK(uri_parent_string_hash); + } + g_free(uri_parent_string); + + *volume_return = volume; + return GNOME_VFS_OK; +} + +static GnomeVFSResult inode_open_by_pathname(ntfs_inode **inode_return, + ntfs_volume *volume, const gchar *pathname) +{ + MFT_REF mref; + ntfs_inode *inode; + gchar *pathname_parse, *pathname_next; + int errint; + + g_return_val_if_fail(inode_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(volume != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(pathname != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + + pathname = g_path_skip_root(pathname); + pathname_parse = g_alloca(strlen(pathname) + 1); + strcpy(pathname_parse, pathname); + mref = FILE_root; + for (;;) { + uchar_t *pathname_parse_ucs2; + gchar *pathname_parse_unescaped; + int i; + + G_LOCK(libntfs); + inode = ntfs_inode_open(volume, mref); + G_UNLOCK(libntfs); + if (!inode) + return GNOME_VFS_ERROR_NOT_FOUND; + if (!*pathname_parse) { + *inode_return = inode; + return GNOME_VFS_OK; + } + for (pathname_next = pathname_parse; *pathname_next && + *pathname_next != G_DIR_SEPARATOR; pathname_next++) ; + if (*pathname_next) { + /* terminate current path element */ + *pathname_next++ = '\0'; + } + while (*pathname_next == G_DIR_SEPARATOR) + pathname_next++; + /* FIXME: Is 'pathname' utf8? */ + pathname_parse_unescaped = gnome_vfs_unescape_string( + pathname_parse, NULL); /* illegal_characters */ + libntfs_newn(pathname_parse_ucs2, + strlen(pathname_parse_unescaped) + 1); + for (i = 0; pathname_parse_unescaped[i]; i++) + pathname_parse_ucs2[i] = pathname_parse_unescaped[i]; + pathname_parse_ucs2[i] = 0; + g_free(pathname_parse_unescaped); + G_LOCK(libntfs); + mref = ntfs_inode_lookup_by_name(inode, pathname_parse_ucs2, i); + G_UNLOCK(libntfs); + g_free(pathname_parse_ucs2); + if ((MFT_REF)-1 == mref) + return GNOME_VFS_ERROR_NOT_FOUND; + G_LOCK(libntfs); + errint = ntfs_inode_close(inode); + G_UNLOCK(libntfs); + if (errint) + g_return_val_if_reached(GNOME_VFS_ERROR_INTERNAL); + pathname_parse = pathname_next; + } + /* NOTREACHED */ +} + +struct libntfs_directory { + ntfs_inode *inode; + GList *file_info_list; /* of (GnomeVFSFileInfo *); last item has ->data == NULL */ +}; + +static GnomeVFSResult libntfs_gnomevfs_open_directory(GnomeVFSMethod *method, + GnomeVFSMethodHandle **method_handle, GnomeVFSURI *uri, + GnomeVFSFileInfoOptions options, GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + ntfs_volume *volume; + ntfs_inode *inode; + struct libntfs_directory *libntfs_directory; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(method_handle != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (GNOME_VFS_OK != (errvfsresult = + libntfs_gnomevfs_uri_parent_init(&volume, uri))) + return errvfsresult; + + if (GNOME_VFS_OK != (errvfsresult = inode_open_by_pathname(&inode, + volume, uri->text))) + return errvfsresult; + + libntfs_new(libntfs_directory); + libntfs_directory->inode = inode; + libntfs_directory->file_info_list = NULL; + + *method_handle = (GnomeVFSMethodHandle *)libntfs_directory; + return errvfsresult; +} + +static GnomeVFSResult libntfs_gnomevfs_close_directory(GnomeVFSMethod *method, + GnomeVFSMethodHandle *method_handle, GnomeVFSContext *context) +{ + struct libntfs_directory *libntfs_directory; + int errint; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_directory = (struct libntfs_directory *)method_handle; + g_return_val_if_fail(libntfs_directory != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + G_LOCK(libntfs); + errint = ntfs_inode_close(libntfs_directory->inode); + G_UNLOCK(libntfs); + if (errint) + g_return_val_if_reached(GNOME_VFS_ERROR_INTERNAL); + + if (libntfs_directory->file_info_list) { + GList *last_l; + + /* + * Prevent gnome_vfs_file_info_list_free() and its + * gnome_vfs_file_info_unref() on the last 'file_info_list' + * items as it is EOF with NULL '->data'. + */ + last_l = g_list_last(libntfs_directory->file_info_list); + g_assert(last_l->data == NULL); + libntfs_directory->file_info_list = g_list_delete_link( + libntfs_directory->file_info_list, last_l); + gnome_vfs_file_info_list_free( + libntfs_directory->file_info_list); + } + + g_free(libntfs_directory); + + return GNOME_VFS_OK; +} + +static gchar *libntfs_uchar_to_utf8(const uchar_t *name, const int name_len) +{ + GString *gstring; + int i; + + gstring = g_string_sized_new(name_len); + for (i = 0; i < name_len; i++) + gstring = g_string_append_unichar(gstring, name[i]); + return g_string_free(gstring, /* returns utf8-formatted string */ + FALSE); /* free_segment */ +} + +/* + * Do not lock 'libntfs' here as we are already locked inside ntfs_readdir(). + */ +static int libntfs_gnomevfs_read_directory_filldir( + struct libntfs_directory *libntfs_directory /* dirent */, + const uchar_t *name, const int name_len, const int name_type, + const s64 pos, const MFT_REF mref, const unsigned dt_type) +{ + GnomeVFSFileInfo *file_info; + + g_return_val_if_fail(libntfs_directory != NULL, -1); + g_return_val_if_fail(name != NULL, -1); + g_return_val_if_fail(name_len >= 0, -1); + g_return_val_if_fail(pos >= 0, -1); + + /* system directory; FIXME: What is its proper identification? */ + if (name_len > 0 && name[0] == '$') + return 0; /* continue traversal */ + + file_info = gnome_vfs_file_info_new(); + file_info->name = libntfs_uchar_to_utf8(name, name_len); + file_info->valid_fields = 0; + + switch (dt_type) { + case NTFS_DT_FIFO: + file_info->type = GNOME_VFS_FILE_TYPE_FIFO; + break; + case NTFS_DT_CHR: + file_info->type = GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE; + break; + case NTFS_DT_DIR: + file_info->type = GNOME_VFS_FILE_TYPE_DIRECTORY; + break; + case NTFS_DT_BLK: + file_info->type = GNOME_VFS_FILE_TYPE_BLOCK_DEVICE; + break; + case NTFS_DT_REG: + file_info->type = GNOME_VFS_FILE_TYPE_REGULAR; + break; + case NTFS_DT_LNK: + file_info->type = GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK; + break; + case NTFS_DT_SOCK: + file_info->type = GNOME_VFS_FILE_TYPE_SOCKET; + break; + /* FIXME: What is 'NTFS_DT_WHT'? */ + default: + file_info->type = GNOME_VFS_FILE_TYPE_UNKNOWN; + } + if (file_info->type != GNOME_VFS_FILE_TYPE_UNKNOWN) + file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_TYPE; + + /* Detect 'file_info->size': */ + if (file_info->type == GNOME_VFS_FILE_TYPE_REGULAR) { + ntfs_inode *inode; + + inode = ntfs_inode_open(libntfs_directory->inode->vol, mref); + /* FIXME: Check failed 'inode' open. */ + if (inode) { + ntfs_attr *attr; + int errint; + + attr = ntfs_attr_open(inode, /* ni */ + AT_DATA, /* type */ + NULL, /* name */ + 0); /* name_len */ + /* FIXME: Check failed 'attr' open. */ + if (attr) { + /* FIXME: Is 'data_size' the right field? */ + file_info->size = attr->data_size; + file_info->valid_fields |= + GNOME_VFS_FILE_INFO_FIELDS_SIZE; + ntfs_attr_close(attr); + } + errint = ntfs_inode_close(inode); + /* FIXME: Check 'errint'. */ + } + } + + libntfs_directory->file_info_list = g_list_prepend( + libntfs_directory->file_info_list, file_info); + + return 0; /* continue traversal */ +} + +static GnomeVFSResult libntfs_gnomevfs_read_directory(GnomeVFSMethod *method, + GnomeVFSMethodHandle *method_handle, + GnomeVFSFileInfo *file_info, GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + struct libntfs_directory *libntfs_directory; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_directory = (struct libntfs_directory *)method_handle; + g_return_val_if_fail(libntfs_directory != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(file_info != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (!libntfs_directory->file_info_list) { + int errint; + s64 pos; + + pos = 0; /* read from the start; incl. "." and ".." entries */ + G_LOCK(libntfs); + errint = ntfs_readdir(libntfs_directory->inode, /* dir_ni */ + &pos, /* pos */ + libntfs_directory, /* dirent */ + (ntfs_filldir_t)libntfs_gnomevfs_read_directory_filldir); /* filldir */ + G_UNLOCK(libntfs); + if (errint) + return GNOME_VFS_ERROR_INTERNAL; + + libntfs_directory->file_info_list = g_list_prepend( + libntfs_directory->file_info_list, NULL); /* EOF */ + libntfs_directory->file_info_list = g_list_reverse( + libntfs_directory->file_info_list); + } + + if (!libntfs_directory->file_info_list->data) { + g_assert(libntfs_directory->file_info_list->next == NULL); + /* + * Do not clear the list to leave us stuck at EOF - GnomeVFS + * behaves that way. + */ + errvfsresult = GNOME_VFS_ERROR_EOF; + } else { + /* Cut first list item. */ + gnome_vfs_file_info_copy(file_info, /* dest */ + libntfs_directory->file_info_list->data); /* src */ + gnome_vfs_file_info_unref( + libntfs_directory->file_info_list->data); + libntfs_directory->file_info_list = g_list_delete_link( + libntfs_directory->file_info_list, + libntfs_directory->file_info_list); + errvfsresult = GNOME_VFS_OK; + } + return errvfsresult; +} + +struct libntfs_file { + ntfs_inode *inode; + ntfs_attr *attr; + s64 pos; +}; + +static GnomeVFSResult libntfs_open_attr(struct libntfs_file *libntfs_file) +{ + g_return_val_if_fail(libntfs_file != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(libntfs_file->inode != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (!libntfs_file->attr) { + G_LOCK(libntfs); + libntfs_file->attr = ntfs_attr_open( + libntfs_file->inode, /* ni */ + AT_DATA, /* type */ + NULL, /* name */ + 0); /* name_len */ + G_UNLOCK(libntfs); + if (!libntfs_file->attr) + return GNOME_VFS_ERROR_BAD_FILE; + libntfs_file->pos = 0; + } + + return GNOME_VFS_OK; +} + +static GnomeVFSResult libntfs_gnomevfs_open(GnomeVFSMethod *method, + GnomeVFSMethodHandle **method_handle_return, GnomeVFSURI *uri, + GnomeVFSOpenMode mode, GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + ntfs_volume *volume; + ntfs_inode *inode; + struct libntfs_file *libntfs_file; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(method_handle_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (GNOME_VFS_OK != (errvfsresult = + libntfs_gnomevfs_uri_parent_init(&volume, uri))) + return errvfsresult; + + if (mode & GNOME_VFS_OPEN_WRITE) + return GNOME_VFS_ERROR_READ_ONLY_FILE_SYSTEM; + + if (GNOME_VFS_OK != (errvfsresult = + inode_open_by_pathname(&inode, volume, uri->text))) + return errvfsresult; + + libntfs_new(libntfs_file); + libntfs_file->inode = inode; + libntfs_file->attr = NULL; + + *method_handle_return = (GnomeVFSMethodHandle *)libntfs_file; + return errvfsresult; +} + +static GnomeVFSResult libntfs_gnomevfs_create(GnomeVFSMethod *method, + GnomeVFSMethodHandle **method_handle_return, GnomeVFSURI *uri, + GnomeVFSOpenMode mode, gboolean exclusive, guint perm, + GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + ntfs_volume *volume; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(method_handle_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (GNOME_VFS_OK != (errvfsresult = + libntfs_gnomevfs_uri_parent_init(&volume, uri))) + return errvfsresult; + + return GNOME_VFS_ERROR_READ_ONLY_FILE_SYSTEM; +} + +static GnomeVFSResult libntfs_gnomevfs_close(GnomeVFSMethod *method, + GnomeVFSMethodHandle *method_handle, GnomeVFSContext *context) +{ + struct libntfs_file *libntfs_file; + int errint; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_file = (struct libntfs_file *) method_handle; + g_return_val_if_fail(libntfs_file != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (libntfs_file->attr) { + G_LOCK(libntfs); + ntfs_attr_close(libntfs_file->attr); + G_UNLOCK(libntfs); + } + G_LOCK(libntfs); + errint = ntfs_inode_close(libntfs_file->inode); + G_UNLOCK(libntfs); + if (errint) + g_return_val_if_reached(GNOME_VFS_ERROR_INTERNAL); + + g_free(libntfs_file); + + return GNOME_VFS_OK; +} + +static GnomeVFSResult libntfs_gnomevfs_read(GnomeVFSMethod *method, + GnomeVFSMethodHandle *method_handle, gpointer buffer, + GnomeVFSFileSize num_bytes, GnomeVFSFileSize *bytes_read_return, + GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + struct libntfs_file *libntfs_file; + s64 count_s64, got; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_file = (struct libntfs_file *)method_handle; + g_return_val_if_fail(libntfs_file != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(buffer != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(bytes_read_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (GNOME_VFS_OK != (errvfsresult = libntfs_open_attr(libntfs_file))) + return errvfsresult; + + count_s64 = num_bytes; + g_assert((GnomeVFSFileSize)count_s64 == num_bytes); + G_LOCK(libntfs); + got = ntfs_attr_pread(libntfs_file->attr, libntfs_file->pos, count_s64, + buffer); + G_UNLOCK(libntfs); + if (got == -1) + return GNOME_VFS_ERROR_IO; + + libntfs_file->pos += got; + *bytes_read_return = got; + g_assert((s64)*bytes_read_return == got); + + return GNOME_VFS_OK; +} + +static GnomeVFSResult libntfs_gnomevfs_seek(GnomeVFSMethod *method, + GnomeVFSMethodHandle *method_handle, + GnomeVFSSeekPosition whence, GnomeVFSFileOffset offset, + GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + struct libntfs_file *libntfs_file; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_file = (struct libntfs_file *)method_handle; + g_return_val_if_fail(libntfs_file != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (GNOME_VFS_OK != (errvfsresult = libntfs_open_attr(libntfs_file))) + return errvfsresult; + + switch (whence) { + case GNOME_VFS_SEEK_START: + libntfs_file->pos = offset; + break; + case GNOME_VFS_SEEK_CURRENT: + libntfs_file->pos += offset; + break; + case GNOME_VFS_SEEK_END: + /* FIXME: NOT IMPLEMENTED YET */ + g_return_val_if_reached(GNOME_VFS_ERROR_BAD_PARAMETERS); + default: + g_assert_not_reached(); + } + + return GNOME_VFS_OK; +} + +static GnomeVFSResult libntfs_gnomevfs_tell(GnomeVFSMethod *method, + GnomeVFSMethodHandle *method_handle, + GnomeVFSFileOffset *offset_return) +{ + GnomeVFSResult errvfsresult; + struct libntfs_file *libntfs_file; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_file = (struct libntfs_file *)method_handle; + g_return_val_if_fail(libntfs_file != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(offset_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (GNOME_VFS_OK != (errvfsresult = libntfs_open_attr(libntfs_file))) + return errvfsresult; + + *offset_return = libntfs_file->pos; + g_assert(*offset_return == libntfs_file->pos); + + return errvfsresult; +} + +static gboolean libntfs_gnomevfs_is_local(GnomeVFSMethod *method, + const GnomeVFSURI *uri) +{ + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(uri != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + + return gnome_vfs_uri_is_local(uri->parent); +} + +GnomeVFSResult libntfs_gnomevfs_get_file_info_from_handle( + GnomeVFSMethod *method, GnomeVFSMethodHandle *method_handle, + GnomeVFSFileInfo *file_info, GnomeVFSFileInfoOptions options, + GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + struct libntfs_file *libntfs_file; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_file = (struct libntfs_file *)method_handle; + g_return_val_if_fail(libntfs_file != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(file_info != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + /* handle 'options & GNOME_VFS_FILE_INFO_GET_MIME_TYPE'? */ + + file_info->valid_fields = 0; + /* FIXME: It is complicated to read filename of open 'ntfs_inode'. */ + file_info->name = NULL; + + if (GNOME_VFS_OK != (errvfsresult = libntfs_open_attr(libntfs_file))) { + /* Assume we are directory: */ + file_info->type = GNOME_VFS_FILE_TYPE_DIRECTORY; + /* + * Do not: file_info->valid_fields |= + * GNOME_VFS_FILE_INFO_FIELDS_TYPE; + * as gnome-vfs-xfer.c/copy_items() does not check + * 'GNOME_VFS_FILE_INFO_FIELDS_TYPE' and we are just bluffing + * we know it. + */ + return GNOME_VFS_OK; + } + + /* FIXME: Is 'data_size' the right field? */ + file_info->size = libntfs_file->attr->data_size; + file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SIZE; + + /* + * FIXME: We do not really know the type of 'libntfs_file' but + * gnome-vfs-xfer.c/copy_items() requires 'GNOME_VFS_FILE_TYPE_REGULAR' + * to copy it. + */ + file_info->type = GNOME_VFS_FILE_TYPE_REGULAR; + /* + * Do not: file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_TYPE; + * as gnome-vfs-xfer.c/copy_items() does not check + * 'GNOME_VFS_FILE_INFO_FIELDS_TYPE' and we are just bluffing we know + * it. + */ + + return errvfsresult; +} + +static GnomeVFSResult libntfs_gnomevfs_get_file_info(GnomeVFSMethod *method, + GnomeVFSURI *uri, GnomeVFSFileInfo *file_info, + GnomeVFSFileInfoOptions options, GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + GnomeVFSMethodHandle *method_handle; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(file_info != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + /* handle 'options & GNOME_VFS_FILE_INFO_GET_MIME_TYPE'? */ + + if (GNOME_VFS_OK != (errvfsresult = + libntfs_gnomevfs_open(method, &method_handle, uri, + GNOME_VFS_OPEN_READ, context))) + return errvfsresult; + if (GNOME_VFS_OK != (errvfsresult = + libntfs_gnomevfs_get_file_info_from_handle(method, + method_handle, file_info, options, context))) + return errvfsresult; + if (GNOME_VFS_OK != (errvfsresult = + libntfs_gnomevfs_close(method, method_handle, context))) + return errvfsresult; + + return GNOME_VFS_OK; +} + +GnomeVFSResult libntfs_gnomevfs_check_same_fs(GnomeVFSMethod *method, + GnomeVFSURI *a, GnomeVFSURI *b, gboolean *same_fs_return, + GnomeVFSContext *context) +{ + ntfs_volume *volume_a; + ntfs_volume *volume_b; + GnomeVFSResult errvfsresult; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(same_fs_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + errvfsresult = libntfs_gnomevfs_uri_parent_init(&volume_a, a); + g_return_val_if_fail(errvfsresult == GNOME_VFS_OK, errvfsresult); + + errvfsresult = libntfs_gnomevfs_uri_parent_init(&volume_b, b); + g_return_val_if_fail(errvfsresult == GNOME_VFS_OK, errvfsresult); + + *same_fs_return = (volume_a == volume_b); + + return GNOME_VFS_OK; +} + +/** + * libntfs_gnomevfs_init: + * + * Returns: Initialized structure of #GnomeVFSMethod with static methods of + * libntfs-gnomevfs. + */ +GnomeVFSMethod *libntfs_gnomevfs_method_init(const gchar *method_name, + const gchar *args) +{ + struct method_name_info *method_name_info; + + g_return_val_if_fail(method_name != NULL, NULL); + /* 'args' may be NULL if not supplied. */ + + method_name_hash_init(); + + G_LOCK(method_name_hash); + method_name_info = g_hash_table_lookup(method_name_hash, method_name); + if (method_name_info && strcmp(method_name_info->args, args)) + method_name_info = NULL; + G_UNLOCK(method_name_hash); + if (!method_name_info) { + libntfs_new(method_name_info); + method_name_info->args = g_strdup(args); + G_LOCK(method_name_hash); + g_hash_table_replace(method_name_hash, g_strdup(method_name), + method_name_info); + G_UNLOCK(method_name_hash); + } + + G_LOCK(GnomeVFSMethod_static); + LIBNTFS_MEMZERO(&GnomeVFSMethod_static); + GnomeVFSMethod_static.method_table_size = sizeof(GnomeVFSMethod_static); + GnomeVFSMethod_static.open = libntfs_gnomevfs_open; /* mandatory */ + GnomeVFSMethod_static.create = libntfs_gnomevfs_create; /* mandatory */ + GnomeVFSMethod_static.close = libntfs_gnomevfs_close; + GnomeVFSMethod_static.read = libntfs_gnomevfs_read; + GnomeVFSMethod_static.seek = libntfs_gnomevfs_seek; + GnomeVFSMethod_static.tell = libntfs_gnomevfs_tell; + GnomeVFSMethod_static.open_directory = libntfs_gnomevfs_open_directory; + GnomeVFSMethod_static.close_directory = + libntfs_gnomevfs_close_directory; + GnomeVFSMethod_static.read_directory = libntfs_gnomevfs_read_directory; + GnomeVFSMethod_static.get_file_info = + libntfs_gnomevfs_get_file_info; /* mandatory */ + GnomeVFSMethod_static.get_file_info_from_handle = + libntfs_gnomevfs_get_file_info_from_handle; + GnomeVFSMethod_static.is_local = + libntfs_gnomevfs_is_local; /* mandatory */ + GnomeVFSMethod_static.check_same_fs = libntfs_gnomevfs_check_same_fs; + /* TODO: GnomeVFSMethodFindDirectoryFunc find_directory; */ + /* TODO: GnomeVFSMethodFileControlFunc file_control; */ + /* R/W: GnomeVFSMethodCreateSymbolicLinkFunc create_symbolic_link; */ + /* R/W: GnomeVFSMethodMonitorAddFunc monitor_add; */ + /* R/W: GnomeVFSMethodMonitorCancelFunc monitor_cancel; */ + /* R/W: GnomeVFSMethod_static.write; */ + /* R/W: GnomeVFSMethod_static.truncate_handle; */ + /* R/W: GnomeVFSMethod_static.make_directory; */ + /* R/W: GnomeVFSMethod_static.remove_directory; */ + /* R/W: GnomeVFSMethod_static.move; */ + /* R/W: GnomeVFSMethod_static.unlink; */ + /* R/W: GnomeVFSMethod_static.set_file_info; */ + /* R/W: GnomeVFSMethod_static.truncate; */ + G_UNLOCK(GnomeVFSMethod_static); + + return &GnomeVFSMethod_static; +} + +/** + * libntfs_gnomevfs_method_shutdown: + * + * Shutdowns libntfs-gnomevfs successfuly flushing all caches. + * + * Sad note about gnome-vfs-2.1.5 is that it never calls this function. :-) + */ +void libntfs_gnomevfs_method_shutdown(void) +{ + uri_parent_string_hash_init(); + G_LOCK(uri_parent_string_hash); + g_hash_table_destroy(uri_parent_string_hash); + uri_parent_string_hash = NULL; + G_UNLOCK(uri_parent_string_hash); + + method_name_hash_init(); + G_LOCK(method_name_hash); + g_hash_table_destroy(method_name_hash); + method_name_hash = NULL; + G_UNLOCK(method_name_hash); +} + diff --git a/libntfs/gnome-vfs-module.c b/libntfs/gnome-vfs-module.c new file mode 100644 index 00000000..b0e3ad75 --- /dev/null +++ b/libntfs/gnome-vfs-module.c @@ -0,0 +1,77 @@ +/* + * gnome-vfs-module.c - Gnome-VFS init/shutdown implementation of interface to + * libntfs. Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Jan Kratochvil + * Copyright (c) 2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include "gnome-vfs-method.h" +#include +#include +#include /* for g_atexit() */ + +/* Filesystem-module-scope lock for _any_ libntfs access. */ +G_LOCK_DEFINE(libntfs); + +static void vfs_module_shutdown_atexit(void); + +/** + * vfs_module_init: + * @method_name: FIXME + * @args: FIXME + * + * FIXME + * + * Returns: FIXME + */ +GnomeVFSMethod *vfs_module_init(const char *method_name, const char *args) +{ + GnomeVFSMethod *libntfs_gnomevfs_method_ptr; + + g_return_val_if_fail(method_name != NULL, NULL); + /* 'args' may be NULL if not supplied. */ + + libntfs_gnomevfs_method_ptr = libntfs_gnomevfs_method_init(method_name, + args); + + g_atexit(vfs_module_shutdown_atexit); + + return libntfs_gnomevfs_method_ptr; +} + +/** + * vfs_module_shutdown: + */ +void vfs_module_shutdown(GnomeVFSMethod *method) +{ + /* + * 'method' may be NULL if we are called from + * vfs_module_shutdown_atexit(). + */ + + libntfs_gnomevfs_method_shutdown(); +} + +static void vfs_module_shutdown_atexit(void) +{ + vfs_module_shutdown(NULL); +} + diff --git a/libntfs/libntfs.conf.in b/libntfs/libntfs.conf.in new file mode 100644 index 00000000..bbe71a2e --- /dev/null +++ b/libntfs/libntfs.conf.in @@ -0,0 +1 @@ +libntfs: libntfs-gnomevfs From e216063558c5c7b37f612cb32cf55627013d5e3d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0803/2994] Add Jan Kratochvil to authors. (Logical change 1.223) --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 86fcacc5..0348308f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,6 +4,7 @@ Linux-NTFS is written and maintained by Anton Altaparmakov . Current active developers on the project are (in alphabetical order): Anton Altaparmakov + Jan Kratochvil Matthew J. Fanto Lode Leroy Leonard Norrgĺrd From 3618c4b8f722533f08d4b00c034103238a4bdb74 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0804/2994] Add ntfs gnome vfs header files. (Logical change 1.223) --- include/Makefile.am | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/include/Makefile.am b/include/Makefile.am index a946b940..ef64a6df 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -8,25 +8,27 @@ endif linux_ntfsincludedir = $(includedir)/ntfs linux_ntfsinclude_HEADERS = \ - attrib.h \ - bitmap.h \ - bootsect.h \ - compat.h \ - debug.h \ - device.h \ - device_io.h \ - dir.h \ - endians.h \ - inode.h \ - layout.h \ - lcnalloc.h \ - list.h \ - logfile.h \ - mft.h \ - mst.h \ - runlist.h \ - support.h \ - types.h \ - unistr.h \ + attrib.h \ + bitmap.h \ + bootsect.h \ + compat.h \ + debug.h \ + device.h \ + device_io.h \ + dir.h \ + endians.h \ + gnome-vfs-method.h \ + gnome-vfs-module.h \ + inode.h \ + layout.h \ + lcnalloc.h \ + list.h \ + logfile.h \ + mft.h \ + mst.h \ + runlist.h \ + support.h \ + types.h \ + unistr.h \ volume.h From 3b25f96395a35d4dca7fd0489ca30e611a8a1fee Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0805/2994] Fix signed warnings. (Logical change 1.223) --- ntfsprogs/ntfstruncate.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index db3ec59b..9dfe66c8 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -333,6 +333,7 @@ void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) const char *todo = "This is still work in progress."; char *buf; int i, j; + u32 u; switch (type) { case AT_STANDARD_INFORMATION: @@ -461,11 +462,11 @@ void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) printf("%s\n", don_t_know); return; default: - i = le32_to_cpu(type); + u = le32_to_cpu(type); printf("Cannot display unknown %s defined attribute type 0x%x" - ".\n", i >= + ".\n", u >= le32_to_cpu(AT_FIRST_USER_DEFINED_ATTRIBUTE) ? - "user" : "system", i); + "user" : "system", u); } } @@ -579,7 +580,8 @@ void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) if (a->name_length) { if (ucstos(s, (uchar_t*)((char*)a + cpu_to_le16(a->name_offset)), - min(sizeof(s), a->name_length + 1)) == -1) { + min((int)sizeof(s), + a->name_length + 1)) == -1) { Eprintf("Could not convert Unicode string to single " "byte string in current locale.\n"); strncpy(s, "Error converting Unicode string", From 80b57b880d68548edf7385bb1d95dfc490835cdf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0806/2994] Initial revision --- include/gnome-vfs-method.h | 0 include/gnome-vfs-module.h | 38 -- libntfs/gnome-vfs-method.c | 877 ------------------------------------- libntfs/gnome-vfs-module.c | 77 ---- libntfs/libntfs.conf.in | 1 - 5 files changed, 993 deletions(-) create mode 100644 include/gnome-vfs-method.h diff --git a/include/gnome-vfs-method.h b/include/gnome-vfs-method.h new file mode 100644 index 00000000..e69de29b diff --git a/include/gnome-vfs-module.h b/include/gnome-vfs-module.h index c8b38979..e69de29b 100644 --- a/include/gnome-vfs-module.h +++ b/include/gnome-vfs-module.h @@ -1,38 +0,0 @@ -/* - * gnome-vfs-module.h - Exports for Gnome-VFS init/shutdown implementation of - * interface to libntfs. Part of the Linux-NTFS project. - * - * Copyright (c) 2003 Jan Kratochvil - * Copyright (c) 2000-2002 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_GNOME_VFS_MODULE_H -#define _NTFS_GNOME_VFS_MODULE_H - -G_BEGIN_DECLS - -G_LOCK_EXTERN(libntfs); - -#define libntfs_newn(objp, n) ((objp) = g_new(typeof(*(objp)), (n))) -#define libntfs_new(objp) (libntfs_newn((objp), 1)) -#define LIBNTFS_MEMZERO(objp) (memset((objp), 0, sizeof(*(objp)))) - -G_END_DECLS - -#endif /* _NTFS_GNOME_VFS_MODULE_H */ - diff --git a/libntfs/gnome-vfs-method.c b/libntfs/gnome-vfs-method.c index 3b0c9c37..e69de29b 100644 --- a/libntfs/gnome-vfs-method.c +++ b/libntfs/gnome-vfs-method.c @@ -1,877 +0,0 @@ -/* - * gnome-vfs-method.c - Gnome-VFS init/shutdown implementation of interface to - * libntfs. Part of the Linux-NTFS project. - * - * Copyright (c) 2003 Jan Kratochvil - * Copyright (c) 2003 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#undef FALSE -#undef TRUE -#include "types.h" /* for 'FALSE'/'TRUE' libntfs definition */ -#define FALSE FALSE -#define TRUE TRUE - -#include "gnome-vfs-method.h" /* self */ -#include -#include -#include "gnome-vfs-module.h" -#include -#include -#include - -#include "volume.h" -#include "dir.h" - -static GnomeVFSMethod GnomeVFSMethod_static; -G_LOCK_DEFINE_STATIC(GnomeVFSMethod_static); - -/* map: (gchar *)method_name -> (struct method_name_info *) */ -static GHashTable *method_name_hash; -G_LOCK_DEFINE_STATIC(method_name_hash); - -struct method_name_info { - gchar *args; -}; - -static void method_name_hash_key_destroy_func(gchar *key) -{ - g_return_if_fail(key != NULL); - - g_free(key); -} - -static void method_name_hash_value_destroy_func(struct method_name_info *value) -{ - g_return_if_fail(value != NULL); - - g_free(value->args); - g_free(value); -} - -static void method_name_hash_init(void) -{ - G_LOCK(method_name_hash); - if (!method_name_hash) { - method_name_hash = g_hash_table_new_full( - g_str_hash, /* hash_func */ - g_str_equal, /* key_equal_func */ - (GDestroyNotify) method_name_hash_key_destroy_func, /* key_destroy_func */ - (GDestroyNotify) method_name_hash_value_destroy_func); /* value_destroy_func */ - } - G_UNLOCK(method_name_hash); -} - -/* - * map: (gchar *)uri_parent_string "method_name:uri_parent" -> (ntfs_volume *) - */ -static GHashTable *uri_parent_string_hash; -G_LOCK_DEFINE_STATIC(uri_parent_string_hash); - -static void uri_parent_string_hash_key_destroy_func(gchar *key) -{ - g_return_if_fail(key != NULL); - - g_free(key); -} - -static void uri_parent_string_hash_value_destroy_func(ntfs_volume *value) -{ - g_return_if_fail(value != NULL); - - ntfs_umount( /* errors ignored */ - value, /* vol */ - TRUE); /* force; possibly loose modifications */ -} - -static void uri_parent_string_hash_init(void) -{ - G_LOCK(uri_parent_string_hash); - if (!uri_parent_string_hash) { - uri_parent_string_hash = g_hash_table_new_full( - g_str_hash, /* hash_func */ - g_str_equal, /* key_equal_func */ - (GDestroyNotify) uri_parent_string_hash_key_destroy_func, /* key_destroy_func */ - (GDestroyNotify) uri_parent_string_hash_value_destroy_func); /* value_destroy_func */ - } - G_UNLOCK(uri_parent_string_hash); -} - -static GnomeVFSResult libntfs_gnomevfs_uri_parent_init( - ntfs_volume **volume_return, GnomeVFSURI *uri) -{ - gchar *uri_parent_string; - gchar *uri_parent_string_parent; - ntfs_volume *volume; - - g_return_val_if_fail(uri != NULL, GNOME_VFS_ERROR_INVALID_URI); - g_return_val_if_fail(volume_return != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - - uri_parent_string_hash_init(); - - if (!uri->parent) - return GNOME_VFS_ERROR_INVALID_URI; - if (!uri->text) /* not needed here but we don't permit non-specific fs-image reference */ - return GNOME_VFS_ERROR_INVALID_URI; - uri_parent_string_parent = gnome_vfs_uri_to_string(uri->parent, - GNOME_VFS_URI_HIDE_NONE); - g_assert(uri_parent_string_parent != NULL); - - uri_parent_string = g_strdup_printf("%s:%s", uri->method_string, - uri_parent_string_parent); - g_assert(uri_parent_string != NULL); - - G_LOCK(uri_parent_string_hash); - volume = g_hash_table_lookup(uri_parent_string_hash, uri_parent_string); - G_UNLOCK(uri_parent_string_hash); - if (!volume) { - struct method_name_info *method_name_info; - - G_LOCK(method_name_hash); - method_name_info = g_hash_table_lookup(method_name_hash, - uri->method_string); - G_UNLOCK(method_name_hash); - if (!method_name_info) { - /* should not happend */ - g_return_val_if_reached(GNOME_VFS_ERROR_INVALID_URI); - } - - /* TODO: Generic GnomeVFS filter. */ - if (strcmp(uri->parent->method_string, "file")) { - g_free(uri_parent_string); - return GNOME_VFS_ERROR_INVALID_URI; - } - - if (!(volume = ntfs_mount(uri->parent->text, MS_RDONLY))) { - g_free(uri_parent_string); - return GNOME_VFS_ERROR_WRONG_FORMAT; - } - - G_LOCK(uri_parent_string_hash); - g_hash_table_insert(uri_parent_string_hash, - g_strdup(uri_parent_string), volume); - G_UNLOCK(uri_parent_string_hash); - } - g_free(uri_parent_string); - - *volume_return = volume; - return GNOME_VFS_OK; -} - -static GnomeVFSResult inode_open_by_pathname(ntfs_inode **inode_return, - ntfs_volume *volume, const gchar *pathname) -{ - MFT_REF mref; - ntfs_inode *inode; - gchar *pathname_parse, *pathname_next; - int errint; - - g_return_val_if_fail(inode_return != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(volume != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(pathname != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); - - pathname = g_path_skip_root(pathname); - pathname_parse = g_alloca(strlen(pathname) + 1); - strcpy(pathname_parse, pathname); - mref = FILE_root; - for (;;) { - uchar_t *pathname_parse_ucs2; - gchar *pathname_parse_unescaped; - int i; - - G_LOCK(libntfs); - inode = ntfs_inode_open(volume, mref); - G_UNLOCK(libntfs); - if (!inode) - return GNOME_VFS_ERROR_NOT_FOUND; - if (!*pathname_parse) { - *inode_return = inode; - return GNOME_VFS_OK; - } - for (pathname_next = pathname_parse; *pathname_next && - *pathname_next != G_DIR_SEPARATOR; pathname_next++) ; - if (*pathname_next) { - /* terminate current path element */ - *pathname_next++ = '\0'; - } - while (*pathname_next == G_DIR_SEPARATOR) - pathname_next++; - /* FIXME: Is 'pathname' utf8? */ - pathname_parse_unescaped = gnome_vfs_unescape_string( - pathname_parse, NULL); /* illegal_characters */ - libntfs_newn(pathname_parse_ucs2, - strlen(pathname_parse_unescaped) + 1); - for (i = 0; pathname_parse_unescaped[i]; i++) - pathname_parse_ucs2[i] = pathname_parse_unescaped[i]; - pathname_parse_ucs2[i] = 0; - g_free(pathname_parse_unescaped); - G_LOCK(libntfs); - mref = ntfs_inode_lookup_by_name(inode, pathname_parse_ucs2, i); - G_UNLOCK(libntfs); - g_free(pathname_parse_ucs2); - if ((MFT_REF)-1 == mref) - return GNOME_VFS_ERROR_NOT_FOUND; - G_LOCK(libntfs); - errint = ntfs_inode_close(inode); - G_UNLOCK(libntfs); - if (errint) - g_return_val_if_reached(GNOME_VFS_ERROR_INTERNAL); - pathname_parse = pathname_next; - } - /* NOTREACHED */ -} - -struct libntfs_directory { - ntfs_inode *inode; - GList *file_info_list; /* of (GnomeVFSFileInfo *); last item has ->data == NULL */ -}; - -static GnomeVFSResult libntfs_gnomevfs_open_directory(GnomeVFSMethod *method, - GnomeVFSMethodHandle **method_handle, GnomeVFSURI *uri, - GnomeVFSFileInfoOptions options, GnomeVFSContext *context) -{ - GnomeVFSResult errvfsresult; - ntfs_volume *volume; - ntfs_inode *inode; - struct libntfs_directory *libntfs_directory; - - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(method_handle != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - - if (GNOME_VFS_OK != (errvfsresult = - libntfs_gnomevfs_uri_parent_init(&volume, uri))) - return errvfsresult; - - if (GNOME_VFS_OK != (errvfsresult = inode_open_by_pathname(&inode, - volume, uri->text))) - return errvfsresult; - - libntfs_new(libntfs_directory); - libntfs_directory->inode = inode; - libntfs_directory->file_info_list = NULL; - - *method_handle = (GnomeVFSMethodHandle *)libntfs_directory; - return errvfsresult; -} - -static GnomeVFSResult libntfs_gnomevfs_close_directory(GnomeVFSMethod *method, - GnomeVFSMethodHandle *method_handle, GnomeVFSContext *context) -{ - struct libntfs_directory *libntfs_directory; - int errint; - - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - libntfs_directory = (struct libntfs_directory *)method_handle; - g_return_val_if_fail(libntfs_directory != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - - G_LOCK(libntfs); - errint = ntfs_inode_close(libntfs_directory->inode); - G_UNLOCK(libntfs); - if (errint) - g_return_val_if_reached(GNOME_VFS_ERROR_INTERNAL); - - if (libntfs_directory->file_info_list) { - GList *last_l; - - /* - * Prevent gnome_vfs_file_info_list_free() and its - * gnome_vfs_file_info_unref() on the last 'file_info_list' - * items as it is EOF with NULL '->data'. - */ - last_l = g_list_last(libntfs_directory->file_info_list); - g_assert(last_l->data == NULL); - libntfs_directory->file_info_list = g_list_delete_link( - libntfs_directory->file_info_list, last_l); - gnome_vfs_file_info_list_free( - libntfs_directory->file_info_list); - } - - g_free(libntfs_directory); - - return GNOME_VFS_OK; -} - -static gchar *libntfs_uchar_to_utf8(const uchar_t *name, const int name_len) -{ - GString *gstring; - int i; - - gstring = g_string_sized_new(name_len); - for (i = 0; i < name_len; i++) - gstring = g_string_append_unichar(gstring, name[i]); - return g_string_free(gstring, /* returns utf8-formatted string */ - FALSE); /* free_segment */ -} - -/* - * Do not lock 'libntfs' here as we are already locked inside ntfs_readdir(). - */ -static int libntfs_gnomevfs_read_directory_filldir( - struct libntfs_directory *libntfs_directory /* dirent */, - const uchar_t *name, const int name_len, const int name_type, - const s64 pos, const MFT_REF mref, const unsigned dt_type) -{ - GnomeVFSFileInfo *file_info; - - g_return_val_if_fail(libntfs_directory != NULL, -1); - g_return_val_if_fail(name != NULL, -1); - g_return_val_if_fail(name_len >= 0, -1); - g_return_val_if_fail(pos >= 0, -1); - - /* system directory; FIXME: What is its proper identification? */ - if (name_len > 0 && name[0] == '$') - return 0; /* continue traversal */ - - file_info = gnome_vfs_file_info_new(); - file_info->name = libntfs_uchar_to_utf8(name, name_len); - file_info->valid_fields = 0; - - switch (dt_type) { - case NTFS_DT_FIFO: - file_info->type = GNOME_VFS_FILE_TYPE_FIFO; - break; - case NTFS_DT_CHR: - file_info->type = GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE; - break; - case NTFS_DT_DIR: - file_info->type = GNOME_VFS_FILE_TYPE_DIRECTORY; - break; - case NTFS_DT_BLK: - file_info->type = GNOME_VFS_FILE_TYPE_BLOCK_DEVICE; - break; - case NTFS_DT_REG: - file_info->type = GNOME_VFS_FILE_TYPE_REGULAR; - break; - case NTFS_DT_LNK: - file_info->type = GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK; - break; - case NTFS_DT_SOCK: - file_info->type = GNOME_VFS_FILE_TYPE_SOCKET; - break; - /* FIXME: What is 'NTFS_DT_WHT'? */ - default: - file_info->type = GNOME_VFS_FILE_TYPE_UNKNOWN; - } - if (file_info->type != GNOME_VFS_FILE_TYPE_UNKNOWN) - file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_TYPE; - - /* Detect 'file_info->size': */ - if (file_info->type == GNOME_VFS_FILE_TYPE_REGULAR) { - ntfs_inode *inode; - - inode = ntfs_inode_open(libntfs_directory->inode->vol, mref); - /* FIXME: Check failed 'inode' open. */ - if (inode) { - ntfs_attr *attr; - int errint; - - attr = ntfs_attr_open(inode, /* ni */ - AT_DATA, /* type */ - NULL, /* name */ - 0); /* name_len */ - /* FIXME: Check failed 'attr' open. */ - if (attr) { - /* FIXME: Is 'data_size' the right field? */ - file_info->size = attr->data_size; - file_info->valid_fields |= - GNOME_VFS_FILE_INFO_FIELDS_SIZE; - ntfs_attr_close(attr); - } - errint = ntfs_inode_close(inode); - /* FIXME: Check 'errint'. */ - } - } - - libntfs_directory->file_info_list = g_list_prepend( - libntfs_directory->file_info_list, file_info); - - return 0; /* continue traversal */ -} - -static GnomeVFSResult libntfs_gnomevfs_read_directory(GnomeVFSMethod *method, - GnomeVFSMethodHandle *method_handle, - GnomeVFSFileInfo *file_info, GnomeVFSContext *context) -{ - GnomeVFSResult errvfsresult; - struct libntfs_directory *libntfs_directory; - - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - libntfs_directory = (struct libntfs_directory *)method_handle; - g_return_val_if_fail(libntfs_directory != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(file_info != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); - - if (!libntfs_directory->file_info_list) { - int errint; - s64 pos; - - pos = 0; /* read from the start; incl. "." and ".." entries */ - G_LOCK(libntfs); - errint = ntfs_readdir(libntfs_directory->inode, /* dir_ni */ - &pos, /* pos */ - libntfs_directory, /* dirent */ - (ntfs_filldir_t)libntfs_gnomevfs_read_directory_filldir); /* filldir */ - G_UNLOCK(libntfs); - if (errint) - return GNOME_VFS_ERROR_INTERNAL; - - libntfs_directory->file_info_list = g_list_prepend( - libntfs_directory->file_info_list, NULL); /* EOF */ - libntfs_directory->file_info_list = g_list_reverse( - libntfs_directory->file_info_list); - } - - if (!libntfs_directory->file_info_list->data) { - g_assert(libntfs_directory->file_info_list->next == NULL); - /* - * Do not clear the list to leave us stuck at EOF - GnomeVFS - * behaves that way. - */ - errvfsresult = GNOME_VFS_ERROR_EOF; - } else { - /* Cut first list item. */ - gnome_vfs_file_info_copy(file_info, /* dest */ - libntfs_directory->file_info_list->data); /* src */ - gnome_vfs_file_info_unref( - libntfs_directory->file_info_list->data); - libntfs_directory->file_info_list = g_list_delete_link( - libntfs_directory->file_info_list, - libntfs_directory->file_info_list); - errvfsresult = GNOME_VFS_OK; - } - return errvfsresult; -} - -struct libntfs_file { - ntfs_inode *inode; - ntfs_attr *attr; - s64 pos; -}; - -static GnomeVFSResult libntfs_open_attr(struct libntfs_file *libntfs_file) -{ - g_return_val_if_fail(libntfs_file != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(libntfs_file->inode != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - - if (!libntfs_file->attr) { - G_LOCK(libntfs); - libntfs_file->attr = ntfs_attr_open( - libntfs_file->inode, /* ni */ - AT_DATA, /* type */ - NULL, /* name */ - 0); /* name_len */ - G_UNLOCK(libntfs); - if (!libntfs_file->attr) - return GNOME_VFS_ERROR_BAD_FILE; - libntfs_file->pos = 0; - } - - return GNOME_VFS_OK; -} - -static GnomeVFSResult libntfs_gnomevfs_open(GnomeVFSMethod *method, - GnomeVFSMethodHandle **method_handle_return, GnomeVFSURI *uri, - GnomeVFSOpenMode mode, GnomeVFSContext *context) -{ - GnomeVFSResult errvfsresult; - ntfs_volume *volume; - ntfs_inode *inode; - struct libntfs_file *libntfs_file; - - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(method_handle_return != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - - if (GNOME_VFS_OK != (errvfsresult = - libntfs_gnomevfs_uri_parent_init(&volume, uri))) - return errvfsresult; - - if (mode & GNOME_VFS_OPEN_WRITE) - return GNOME_VFS_ERROR_READ_ONLY_FILE_SYSTEM; - - if (GNOME_VFS_OK != (errvfsresult = - inode_open_by_pathname(&inode, volume, uri->text))) - return errvfsresult; - - libntfs_new(libntfs_file); - libntfs_file->inode = inode; - libntfs_file->attr = NULL; - - *method_handle_return = (GnomeVFSMethodHandle *)libntfs_file; - return errvfsresult; -} - -static GnomeVFSResult libntfs_gnomevfs_create(GnomeVFSMethod *method, - GnomeVFSMethodHandle **method_handle_return, GnomeVFSURI *uri, - GnomeVFSOpenMode mode, gboolean exclusive, guint perm, - GnomeVFSContext *context) -{ - GnomeVFSResult errvfsresult; - ntfs_volume *volume; - - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(method_handle_return != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - - if (GNOME_VFS_OK != (errvfsresult = - libntfs_gnomevfs_uri_parent_init(&volume, uri))) - return errvfsresult; - - return GNOME_VFS_ERROR_READ_ONLY_FILE_SYSTEM; -} - -static GnomeVFSResult libntfs_gnomevfs_close(GnomeVFSMethod *method, - GnomeVFSMethodHandle *method_handle, GnomeVFSContext *context) -{ - struct libntfs_file *libntfs_file; - int errint; - - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - libntfs_file = (struct libntfs_file *) method_handle; - g_return_val_if_fail(libntfs_file != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - - if (libntfs_file->attr) { - G_LOCK(libntfs); - ntfs_attr_close(libntfs_file->attr); - G_UNLOCK(libntfs); - } - G_LOCK(libntfs); - errint = ntfs_inode_close(libntfs_file->inode); - G_UNLOCK(libntfs); - if (errint) - g_return_val_if_reached(GNOME_VFS_ERROR_INTERNAL); - - g_free(libntfs_file); - - return GNOME_VFS_OK; -} - -static GnomeVFSResult libntfs_gnomevfs_read(GnomeVFSMethod *method, - GnomeVFSMethodHandle *method_handle, gpointer buffer, - GnomeVFSFileSize num_bytes, GnomeVFSFileSize *bytes_read_return, - GnomeVFSContext *context) -{ - GnomeVFSResult errvfsresult; - struct libntfs_file *libntfs_file; - s64 count_s64, got; - - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - libntfs_file = (struct libntfs_file *)method_handle; - g_return_val_if_fail(libntfs_file != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(buffer != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(bytes_read_return != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - - if (GNOME_VFS_OK != (errvfsresult = libntfs_open_attr(libntfs_file))) - return errvfsresult; - - count_s64 = num_bytes; - g_assert((GnomeVFSFileSize)count_s64 == num_bytes); - G_LOCK(libntfs); - got = ntfs_attr_pread(libntfs_file->attr, libntfs_file->pos, count_s64, - buffer); - G_UNLOCK(libntfs); - if (got == -1) - return GNOME_VFS_ERROR_IO; - - libntfs_file->pos += got; - *bytes_read_return = got; - g_assert((s64)*bytes_read_return == got); - - return GNOME_VFS_OK; -} - -static GnomeVFSResult libntfs_gnomevfs_seek(GnomeVFSMethod *method, - GnomeVFSMethodHandle *method_handle, - GnomeVFSSeekPosition whence, GnomeVFSFileOffset offset, - GnomeVFSContext *context) -{ - GnomeVFSResult errvfsresult; - struct libntfs_file *libntfs_file; - - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - libntfs_file = (struct libntfs_file *)method_handle; - g_return_val_if_fail(libntfs_file != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - - if (GNOME_VFS_OK != (errvfsresult = libntfs_open_attr(libntfs_file))) - return errvfsresult; - - switch (whence) { - case GNOME_VFS_SEEK_START: - libntfs_file->pos = offset; - break; - case GNOME_VFS_SEEK_CURRENT: - libntfs_file->pos += offset; - break; - case GNOME_VFS_SEEK_END: - /* FIXME: NOT IMPLEMENTED YET */ - g_return_val_if_reached(GNOME_VFS_ERROR_BAD_PARAMETERS); - default: - g_assert_not_reached(); - } - - return GNOME_VFS_OK; -} - -static GnomeVFSResult libntfs_gnomevfs_tell(GnomeVFSMethod *method, - GnomeVFSMethodHandle *method_handle, - GnomeVFSFileOffset *offset_return) -{ - GnomeVFSResult errvfsresult; - struct libntfs_file *libntfs_file; - - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - libntfs_file = (struct libntfs_file *)method_handle; - g_return_val_if_fail(libntfs_file != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(offset_return != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - - if (GNOME_VFS_OK != (errvfsresult = libntfs_open_attr(libntfs_file))) - return errvfsresult; - - *offset_return = libntfs_file->pos; - g_assert(*offset_return == libntfs_file->pos); - - return errvfsresult; -} - -static gboolean libntfs_gnomevfs_is_local(GnomeVFSMethod *method, - const GnomeVFSURI *uri) -{ - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(uri != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); - - return gnome_vfs_uri_is_local(uri->parent); -} - -GnomeVFSResult libntfs_gnomevfs_get_file_info_from_handle( - GnomeVFSMethod *method, GnomeVFSMethodHandle *method_handle, - GnomeVFSFileInfo *file_info, GnomeVFSFileInfoOptions options, - GnomeVFSContext *context) -{ - GnomeVFSResult errvfsresult; - struct libntfs_file *libntfs_file; - - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - libntfs_file = (struct libntfs_file *)method_handle; - g_return_val_if_fail(libntfs_file != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(file_info != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); - /* handle 'options & GNOME_VFS_FILE_INFO_GET_MIME_TYPE'? */ - - file_info->valid_fields = 0; - /* FIXME: It is complicated to read filename of open 'ntfs_inode'. */ - file_info->name = NULL; - - if (GNOME_VFS_OK != (errvfsresult = libntfs_open_attr(libntfs_file))) { - /* Assume we are directory: */ - file_info->type = GNOME_VFS_FILE_TYPE_DIRECTORY; - /* - * Do not: file_info->valid_fields |= - * GNOME_VFS_FILE_INFO_FIELDS_TYPE; - * as gnome-vfs-xfer.c/copy_items() does not check - * 'GNOME_VFS_FILE_INFO_FIELDS_TYPE' and we are just bluffing - * we know it. - */ - return GNOME_VFS_OK; - } - - /* FIXME: Is 'data_size' the right field? */ - file_info->size = libntfs_file->attr->data_size; - file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SIZE; - - /* - * FIXME: We do not really know the type of 'libntfs_file' but - * gnome-vfs-xfer.c/copy_items() requires 'GNOME_VFS_FILE_TYPE_REGULAR' - * to copy it. - */ - file_info->type = GNOME_VFS_FILE_TYPE_REGULAR; - /* - * Do not: file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_TYPE; - * as gnome-vfs-xfer.c/copy_items() does not check - * 'GNOME_VFS_FILE_INFO_FIELDS_TYPE' and we are just bluffing we know - * it. - */ - - return errvfsresult; -} - -static GnomeVFSResult libntfs_gnomevfs_get_file_info(GnomeVFSMethod *method, - GnomeVFSURI *uri, GnomeVFSFileInfo *file_info, - GnomeVFSFileInfoOptions options, GnomeVFSContext *context) -{ - GnomeVFSResult errvfsresult; - GnomeVFSMethodHandle *method_handle; - - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(file_info != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); - /* handle 'options & GNOME_VFS_FILE_INFO_GET_MIME_TYPE'? */ - - if (GNOME_VFS_OK != (errvfsresult = - libntfs_gnomevfs_open(method, &method_handle, uri, - GNOME_VFS_OPEN_READ, context))) - return errvfsresult; - if (GNOME_VFS_OK != (errvfsresult = - libntfs_gnomevfs_get_file_info_from_handle(method, - method_handle, file_info, options, context))) - return errvfsresult; - if (GNOME_VFS_OK != (errvfsresult = - libntfs_gnomevfs_close(method, method_handle, context))) - return errvfsresult; - - return GNOME_VFS_OK; -} - -GnomeVFSResult libntfs_gnomevfs_check_same_fs(GnomeVFSMethod *method, - GnomeVFSURI *a, GnomeVFSURI *b, gboolean *same_fs_return, - GnomeVFSContext *context) -{ - ntfs_volume *volume_a; - ntfs_volume *volume_b; - GnomeVFSResult errvfsresult; - - g_return_val_if_fail(method == &GnomeVFSMethod_static, - GNOME_VFS_ERROR_BAD_PARAMETERS); - g_return_val_if_fail(same_fs_return != NULL, - GNOME_VFS_ERROR_BAD_PARAMETERS); - - errvfsresult = libntfs_gnomevfs_uri_parent_init(&volume_a, a); - g_return_val_if_fail(errvfsresult == GNOME_VFS_OK, errvfsresult); - - errvfsresult = libntfs_gnomevfs_uri_parent_init(&volume_b, b); - g_return_val_if_fail(errvfsresult == GNOME_VFS_OK, errvfsresult); - - *same_fs_return = (volume_a == volume_b); - - return GNOME_VFS_OK; -} - -/** - * libntfs_gnomevfs_init: - * - * Returns: Initialized structure of #GnomeVFSMethod with static methods of - * libntfs-gnomevfs. - */ -GnomeVFSMethod *libntfs_gnomevfs_method_init(const gchar *method_name, - const gchar *args) -{ - struct method_name_info *method_name_info; - - g_return_val_if_fail(method_name != NULL, NULL); - /* 'args' may be NULL if not supplied. */ - - method_name_hash_init(); - - G_LOCK(method_name_hash); - method_name_info = g_hash_table_lookup(method_name_hash, method_name); - if (method_name_info && strcmp(method_name_info->args, args)) - method_name_info = NULL; - G_UNLOCK(method_name_hash); - if (!method_name_info) { - libntfs_new(method_name_info); - method_name_info->args = g_strdup(args); - G_LOCK(method_name_hash); - g_hash_table_replace(method_name_hash, g_strdup(method_name), - method_name_info); - G_UNLOCK(method_name_hash); - } - - G_LOCK(GnomeVFSMethod_static); - LIBNTFS_MEMZERO(&GnomeVFSMethod_static); - GnomeVFSMethod_static.method_table_size = sizeof(GnomeVFSMethod_static); - GnomeVFSMethod_static.open = libntfs_gnomevfs_open; /* mandatory */ - GnomeVFSMethod_static.create = libntfs_gnomevfs_create; /* mandatory */ - GnomeVFSMethod_static.close = libntfs_gnomevfs_close; - GnomeVFSMethod_static.read = libntfs_gnomevfs_read; - GnomeVFSMethod_static.seek = libntfs_gnomevfs_seek; - GnomeVFSMethod_static.tell = libntfs_gnomevfs_tell; - GnomeVFSMethod_static.open_directory = libntfs_gnomevfs_open_directory; - GnomeVFSMethod_static.close_directory = - libntfs_gnomevfs_close_directory; - GnomeVFSMethod_static.read_directory = libntfs_gnomevfs_read_directory; - GnomeVFSMethod_static.get_file_info = - libntfs_gnomevfs_get_file_info; /* mandatory */ - GnomeVFSMethod_static.get_file_info_from_handle = - libntfs_gnomevfs_get_file_info_from_handle; - GnomeVFSMethod_static.is_local = - libntfs_gnomevfs_is_local; /* mandatory */ - GnomeVFSMethod_static.check_same_fs = libntfs_gnomevfs_check_same_fs; - /* TODO: GnomeVFSMethodFindDirectoryFunc find_directory; */ - /* TODO: GnomeVFSMethodFileControlFunc file_control; */ - /* R/W: GnomeVFSMethodCreateSymbolicLinkFunc create_symbolic_link; */ - /* R/W: GnomeVFSMethodMonitorAddFunc monitor_add; */ - /* R/W: GnomeVFSMethodMonitorCancelFunc monitor_cancel; */ - /* R/W: GnomeVFSMethod_static.write; */ - /* R/W: GnomeVFSMethod_static.truncate_handle; */ - /* R/W: GnomeVFSMethod_static.make_directory; */ - /* R/W: GnomeVFSMethod_static.remove_directory; */ - /* R/W: GnomeVFSMethod_static.move; */ - /* R/W: GnomeVFSMethod_static.unlink; */ - /* R/W: GnomeVFSMethod_static.set_file_info; */ - /* R/W: GnomeVFSMethod_static.truncate; */ - G_UNLOCK(GnomeVFSMethod_static); - - return &GnomeVFSMethod_static; -} - -/** - * libntfs_gnomevfs_method_shutdown: - * - * Shutdowns libntfs-gnomevfs successfuly flushing all caches. - * - * Sad note about gnome-vfs-2.1.5 is that it never calls this function. :-) - */ -void libntfs_gnomevfs_method_shutdown(void) -{ - uri_parent_string_hash_init(); - G_LOCK(uri_parent_string_hash); - g_hash_table_destroy(uri_parent_string_hash); - uri_parent_string_hash = NULL; - G_UNLOCK(uri_parent_string_hash); - - method_name_hash_init(); - G_LOCK(method_name_hash); - g_hash_table_destroy(method_name_hash); - method_name_hash = NULL; - G_UNLOCK(method_name_hash); -} - diff --git a/libntfs/gnome-vfs-module.c b/libntfs/gnome-vfs-module.c index b0e3ad75..e69de29b 100644 --- a/libntfs/gnome-vfs-module.c +++ b/libntfs/gnome-vfs-module.c @@ -1,77 +0,0 @@ -/* - * gnome-vfs-module.c - Gnome-VFS init/shutdown implementation of interface to - * libntfs. Part of the Linux-NTFS project. - * - * Copyright (c) 2003 Jan Kratochvil - * Copyright (c) 2003 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include "gnome-vfs-method.h" -#include -#include -#include /* for g_atexit() */ - -/* Filesystem-module-scope lock for _any_ libntfs access. */ -G_LOCK_DEFINE(libntfs); - -static void vfs_module_shutdown_atexit(void); - -/** - * vfs_module_init: - * @method_name: FIXME - * @args: FIXME - * - * FIXME - * - * Returns: FIXME - */ -GnomeVFSMethod *vfs_module_init(const char *method_name, const char *args) -{ - GnomeVFSMethod *libntfs_gnomevfs_method_ptr; - - g_return_val_if_fail(method_name != NULL, NULL); - /* 'args' may be NULL if not supplied. */ - - libntfs_gnomevfs_method_ptr = libntfs_gnomevfs_method_init(method_name, - args); - - g_atexit(vfs_module_shutdown_atexit); - - return libntfs_gnomevfs_method_ptr; -} - -/** - * vfs_module_shutdown: - */ -void vfs_module_shutdown(GnomeVFSMethod *method) -{ - /* - * 'method' may be NULL if we are called from - * vfs_module_shutdown_atexit(). - */ - - libntfs_gnomevfs_method_shutdown(); -} - -static void vfs_module_shutdown_atexit(void) -{ - vfs_module_shutdown(NULL); -} - diff --git a/libntfs/libntfs.conf.in b/libntfs/libntfs.conf.in index bbe71a2e..e69de29b 100644 --- a/libntfs/libntfs.conf.in +++ b/libntfs/libntfs.conf.in @@ -1 +0,0 @@ -libntfs: libntfs-gnomevfs From 05bf546cb00df6595642a49cd8684a85c8d5866a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0807/2994] Now file_size is signed. (Logical change 1.223) --- include/logfile.h | 2 +- ntfsprogs/dumplog.c | 4 ++-- ntfsprogs/ntfsdump_logfile.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/logfile.h b/include/logfile.h index 34a62fd8..e3d5f074 100644 --- a/include/logfile.h +++ b/include/logfile.h @@ -110,7 +110,7 @@ typedef struct { have to be <= 510. Also, the offset to the client array + (log_clients * 0xa0) have to be <= SystemPageSize. = 0x30 */ - u64 file_size; /* Byte size of the log file. If the + s64 file_size; /* Byte size of the log file. If the restart_offset + the offset of the file_size are > 510 then corruption has occured. This is the very first check when starting with diff --git a/ntfsprogs/dumplog.c b/ntfsprogs/dumplog.c index a1fa27ca..96558a5b 100644 --- a/ntfsprogs/dumplog.c +++ b/ntfsprogs/dumplog.c @@ -173,8 +173,8 @@ pass_loc: le16_to_cpu(rr->restart_area_length)); printf("ClientArrayOffset = 0x%x\n", le16_to_cpu(rr->client_array_offset)); - printf("FileSize = %Lu (0x%Lx)\n", le64_to_cpu(rr->file_size), - le64_to_cpu(rr->file_size)); + printf("FileSize = %Lu (0x%Lx)\n", sle64_to_cpu(rr->file_size), + sle64_to_cpu(rr->file_size)); printf("LastLsnDataLength = 0x%x\n", le32_to_cpu(rr->last_lsn_data_length)); printf("RecordLength = 0x%x\n", le16_to_cpu(rr->record_length)); diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index af876e35..a631e46d 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -1,7 +1,7 @@ /** * NtfsDump_LogFile - Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2003 Anton Altaparmakov * * This utility will interpret the contents of the journal ($LogFile) of an * NTFS partition and display the results on stdout. Errors will be output to @@ -223,9 +223,9 @@ pass_loc: le16_to_cpu(rr->restart_area_length)); printf("ClientArrayOffset = 0x%x\n", le16_to_cpu(rr->client_array_offset)); - printf("FileSize = %Lu (0x%Lx)\n", le64_to_cpu(rr->file_size), - le64_to_cpu(rr->file_size)); - if (le64_to_cpu(rr->file_size) != l) + printf("FileSize = %Lu (0x%Lx)\n", sle64_to_cpu(rr->file_size), + sle64_to_cpu(rr->file_size)); + if (sle64_to_cpu(rr->file_size) != l) puts("$LogFile restart area indicates a log file size" "different from the actual size!"); printf("LastLsnDataLength = 0x%x\n", From 973e11099bb5daeea282319c6f352732ef15ce87 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0808/2994] The big mean merge of NTFS Gnome VFS by Jan Kratochvil. This caused several bugfixes in the library and utilities as well due to the signed warnings compiler switch added to the maintainer mode build. Still to do to complete the merge / before the 1.8.0beta 2 release: - Update .spec.in file for ntfs gnome vfs - Write man page "ntfsgnomevfs.8" with examples of usage - Fix all the signed compiler warnings that aren't fixed yet in the utilities. - Clean up the build as we now have CFLAGS modified in both configure AND in local makefiles. Move all of this to configure. BKrev: 3fa7a3c7xL9-9O9E4RZSKunxRs1CvA From 0f24a6c10550fb9246d7b87777201b95cca32576 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0809/2994] Typo... 2003/11/03 17:21:37+00:00 cantab.net!aia21 (Logical change 1.223) --- include/gnome-vfs-method.h | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/include/gnome-vfs-method.h b/include/gnome-vfs-method.h index e69de29b..2a3f4ec3 100644 --- a/include/gnome-vfs-method.h +++ b/include/gnome-vfs-method.h @@ -0,0 +1,39 @@ +/* + * gnome-vfs-method.h - Export for Gnome-VFS init/shutdown implementation of + * interface to libntfs. Par of the Linux-NTFS project. + * + * Copyright (c) 2002-2003 Jan Kratochvil + * Copyright (c) 2000-2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_GNOME_VFS_METHOD_H +#define _NTFS_GNOME_VFS_METHOD_H + +#include + +G_BEGIN_DECLS + +GnomeVFSMethod *libntfs_gnomevfs_method_init(const gchar *method_name, + const gchar *args); + +void libntfs_gnomevfs_method_shutdown(void); + +G_END_DECLS + +#endif /* _NTFS_GNOME_VFS_METHOD_H */ + From 083dca6a1817d92f06948b87527ae0879b0eca89 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0810/2994] Update attr_def min and max size to be s64 not unsigned. (Logical change 1.223) --- include/layout.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/layout.h b/include/layout.h index df4b7185..b62e6000 100644 --- a/include/layout.h +++ b/include/layout.h @@ -475,8 +475,8 @@ typedef struct { FIXME: What does it mean? (AIA) */ /* 88*/ COLLATION_RULES collation_rule; /* Default collation rule. */ /* 8c*/ ATTR_DEF_FLAGS flags; /* Flags describing the attribute. */ -/* 90*/ u64 min_size; /* Optional minimum attribute size. */ -/* 98*/ u64 max_size; /* Maximum size of attribute. */ +/* 90*/ s64 min_size; /* Optional minimum attribute size. */ +/* 98*/ s64 max_size; /* Maximum size of attribute. */ /* sizeof() = 0xa0 or 160 bytes */ } __attribute__ ((__packed__)) ATTR_DEF; From 205c79accff78ff5fa1270dbef8d10763512e73d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0811/2994] Update build for ntfs gnome vfs (Logical change 1.223) --- Makefile.in | 9 ++++++++- doc/Makefile.in | 7 +++++++ ntfsprogs/Makefile.in | 8 +++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index df39b487..066525f2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -76,14 +76,21 @@ CXX = @CXX@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ MAINT = @MAINT@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ @@ -278,7 +285,7 @@ distcleancheck_listfiles = find . -type f -print distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) - $(mkinstalldirs) $(distdir)/. $(distdir)/ntfsprogs + $(mkinstalldirs) $(distdir)/. $(distdir)/libntfs $(distdir)/ntfsprogs @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ diff --git a/doc/Makefile.in b/doc/Makefile.in index 0a4bc6c7..17bb1b32 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -76,14 +76,21 @@ CXX = @CXX@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ MAINT = @MAINT@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 197e592a..aa5a9dae 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -76,14 +76,21 @@ CXX = @CXX@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ MAINT = @MAINT@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ @@ -288,7 +295,6 @@ ntfswipe_OBJECTS = $(am_ntfswipe_OBJECTS) DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrdef.Po ./$(DEPDIR)/boot.Po \ From aecda4e4885f504a5f4fdff7cfe588f07d86bb41 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0812/2994] Update build for ntfs gnome vfs 2003/11/04 11:46:06+00:00 cantab.net!aia21 Fix typo. 2003/11/04 11:44:39+00:00 cantab.net!aia21 Add ntfs gnome vfs library. (Logical change 1.223) --- libntfs/Makefile.am | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 4b464666..887f42c1 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -26,6 +26,8 @@ # LTVERSION = 5:0:0 +LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 + # Later gcc require -fms-extensions to work. if GCC_NEEDS_MS_EXTENSIONS @@ -61,7 +63,18 @@ libntfs_la_SOURCES = \ unistr.c \ volume.c +gnomevfsmoduleslibdir = $(libdir)/gnome-vfs-2.0/modules +gnomevfsmoduleslib_LTLIBRARIES = libntfs-gnomevfs.la + +libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS_GNOMEVFS) +libntfs_gnomevfs_la_SOURCES = \ + gnome-vfs-method.c \ + gnome-vfs-module.c + +gnomevfsmodulesconfdir = $(sysconfdir)/gnome-vfs-2.0/modules +gnomevfsmodulesconf_DATA = libntfs.conf + INCLUDES = $(linux_ntfsincludedir) $(all_includes) -EXTRA_DIST=unix_io.c win32_io.c +EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in From 51931fd51d18080c03e50fddebf74d9193bcb1c8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0813/2994] Update build. (Logical change 1.223) --- include/Makefile.in | 42 ++++++++++++++++++++++-------------------- libntfs/Makefile.in | 25 +++++++++++++++++++++---- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/include/Makefile.in b/include/Makefile.in index e27c3087..00384df9 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -99,26 +99,28 @@ install_sh = @install_sh@ linux_ntfsincludedir = $(includedir)/ntfs linux_ntfsinclude_HEADERS = \ - attrib.h \ - bitmap.h \ - bootsect.h \ - compat.h \ - debug.h \ - device.h \ - device_io.h \ - dir.h \ - endians.h \ - inode.h \ - layout.h \ - lcnalloc.h \ - list.h \ - logfile.h \ - mft.h \ - mst.h \ - runlist.h \ - support.h \ - types.h \ - unistr.h \ + attrib.h \ + bitmap.h \ + bootsect.h \ + compat.h \ + debug.h \ + device.h \ + device_io.h \ + dir.h \ + endians.h \ + gnome-vfs-method.h \ + gnome-vfs-module.h \ + inode.h \ + layout.h \ + lcnalloc.h \ + list.h \ + logfile.h \ + mft.h \ + mst.h \ + runlist.h \ + support.h \ + types.h \ + unistr.h \ volume.h subdir = include diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 7eb137fe..516fbdce 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -121,6 +121,7 @@ am__quote = @am__quote@ install_sh = @install_sh@ LTVERSION = 5:0:0 +LTVERSION_GNOMEVFS = 1:0:0 # Later gcc require -fms-extensions to work. @GCC_NEEDS_MS_EXTENSIONS_TRUE@GCCflag = -fms-extensions @@ -131,7 +132,8 @@ LTVERSION = 5:0:0 @DEBUG_FALSE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall $(GCCflag) linux_ntfsincludedir = -I$(top_srcdir)/include -lib_LTLIBRARIES = libntfs.la +lib_LTLIBRARIES = libntfs.la libntfs-gnomevfs.la + libntfs_la_LDFLAGS = -version-info $(LTVERSION) libntfs_la_SOURCES = \ attrib.c \ @@ -151,15 +153,24 @@ libntfs_la_SOURCES = \ volume.c +libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_GNOMEVFS) +libntfs_gnomevfs_la_SOURCES = \ + gnome-vfs-method.c \ + gnome-vfs-module.c + + INCLUDES = $(linux_ntfsincludedir) $(all_includes) -EXTRA_DIST = unix_io.c win32_io.c +EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in subdir = libntfs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(lib_LTLIBRARIES) +libntfs_gnomevfs_la_LIBADD = +am_libntfs_gnomevfs_la_OBJECTS = gnome-vfs-method.lo gnome-vfs-module.lo +libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) libntfs_la_LIBADD = am_libntfs_la_OBJECTS = attrib.lo bitmap.lo bootsect.lo compat.lo \ debug.lo device.lo device_io.lo dir.lo inode.lo lcnalloc.lo \ @@ -175,6 +186,8 @@ am__depfiles_maybe = depfiles @AMDEP_TRUE@ ./$(DEPDIR)/bootsect.Plo ./$(DEPDIR)/compat.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/debug.Plo ./$(DEPDIR)/device.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/device_io.Plo ./$(DEPDIR)/dir.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/gnome-vfs-method.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/gnome-vfs-module.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/inode.Plo ./$(DEPDIR)/lcnalloc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/mft.Plo ./$(DEPDIR)/mst.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/runlist.Plo ./$(DEPDIR)/unistr.Plo \ @@ -186,9 +199,9 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libntfs_la_SOURCES) +DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) DIST_COMMON = Makefile.am Makefile.in -SOURCES = $(libntfs_la_SOURCES) +SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) all: all-am @@ -227,6 +240,8 @@ clean-libLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done +libntfs-gnomevfs.la: $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libntfs_gnomevfs_la_LDFLAGS) $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_LIBADD) $(LIBS) libntfs.la: $(libntfs_la_OBJECTS) $(libntfs_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libntfs_la_LDFLAGS) $(libntfs_la_OBJECTS) $(libntfs_la_LIBADD) $(LIBS) @@ -244,6 +259,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnome-vfs-method.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gnome-vfs-module.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lcnalloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mft.Plo@am__quote@ From 37f1235091a6825fc9f0b174d25e89c4e9cc99b4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0814/2994] Update change log. (Logical change 1.223) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 20cb1092..e28b0b18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +xx/11/2003 - 1.8.0beta2 - More features! + - Merge ntfsprogs-gnomevfs written by Jan Kratochvil. + 23/10/2003 - 1.8.0beta - The Long Overdue(TM) release. - Further work on attribute resizing. - Fix two logic inversion bugs in dir.c. Thanks to Russ Christensen for From 2103b57235f2fb92c0425c8da6c634edc1c7bdb3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0815/2994] Update for ntfs gnomevfs. (Logical change 1.223) --- NEWS | 2 ++ README | 13 ++++++++++--- TODO.libntfs | 10 ++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index fe82314b..d1ddadda 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ Current news ============ +Merged the NTFS Gnome VFS module by Jan Kratochvil. + Added new utilities: ntfsclone by Szakacsits Szabolcs, ntfscluster by Richard Russon, ntfsinfo by Matthew Fanto, ntfsls originally by Lode Leroy, modified by Anton Altaparmakov, ntfscat by Richard Russon. diff --git a/README b/README index 3de8cdd9..752b0231 100644 --- a/README +++ b/README @@ -14,9 +14,8 @@ All the libraries and utilities come with ABSOLUTELY NO WARRANTY; for details read the GNU General Public License to be found in the file COPYING in the main Linux-NTFS distribution directory. -Linux-NTFS currently consists of the NTFS library (libntfs) and utilities -(ntfsprogs). In the future it will also contain a new NTFS driver for the -Linux kernel. +Linux-NTFS currently consists of the NTFS library (libntfs), the NTFS Gnome VFS +module (libntfs-gnomevfs) and various utilities (ntfsprogs). The Linux-NTFS project is registered on Sourceforge.net. The home page for Linux-NTFS is http://linux-ntfs.sf.net/ and the project page is: @@ -40,6 +39,14 @@ Provides common NTFS access functions to the ntfsprogs and other foreign open source applications. Note, that the library is still under development and a lot of functionality is not yet included. +NTFS Gnome VFS module +===================== + +The Gnome virtual filesystem provides universal access to diffent filesystems. +This modules enables Gnome VFS clients to seamlessly utilize the NTFS library. +For further details and examples of how to make use of the NTFS Gnome VFS +module in practice see man 8 ntfsgnomevfs. + NTFS utilities ============== diff --git a/TODO.libntfs b/TODO.libntfs index 4d43c773..5029567b 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -1,3 +1,13 @@ +******************** +* libntfs-gnomevfs * +******************** + +Be generic GnomeVFS filter; how to redirect ntfs_mount(3) to GnomeVFS parent? + +*********** +* libntfs * +*********** + ***************** * HIGH priority * ***************** From 541450856b97f9ae8a590fcce1f077916cb2aa6f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0816/2994] attrdef_len is now signed (Logical change 1.223) --- include/volume.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/volume.h b/include/volume.h index edcc4e18..9e3b77a1 100644 --- a/include/volume.h +++ b/include/volume.h @@ -158,7 +158,7 @@ struct _ntfs_volume { ATTR_DEF *attrdef; /* Attribute definitions. Obtained from FILE_AttrDef. */ - u32 attrdef_len; /* Size of the attribute definition table in + s32 attrdef_len; /* Size of the attribute definition table in bytes. */ }; From 20e3e64065b71ed79da019d20eb882f5423a0717 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0817/2994] eeek! return MREFs not integers (Logical change 1.223) --- libntfs/dir.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libntfs/dir.c b/libntfs/dir.c index 9abb7921..050545b2 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -540,12 +540,12 @@ static MFT_REF ntfs_mft_get_parent_ref(ntfs_inode *ni) if (!ni) { errno = EINVAL; - return -1; + return ERR_MREF(-1); } ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) - return -1; + return ERR_MREF(-1); if (ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { Dprintf("No file name found in inode 0x%Lx. Corrupt inode.\n", (unsigned long long)ni->mft_no); @@ -573,7 +573,7 @@ err_out: eo = errno; ntfs_attr_put_search_ctx(ctx); errno = eo; - return -1; + return ERR_MREF(-1); } /** @@ -657,7 +657,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, MFT_REF parent_mref; parent_mref = ntfs_mft_get_parent_ref(dir_ni); - if (parent_mref == -1) { + if (parent_mref == ERR_MREF(-1)) { Dprintf("Parent directory not found: %s\n", errno); goto dir_err_out; } From 99d25b212022b9c1b7d56b39f7ebfcd2cfefe1e8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0818/2994] fix signed warning (Logical change 1.223) --- libntfs/lcnalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index dba05e9b..f960cc14 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -261,7 +261,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, Dprintf("%s(): *byte = 0x%x, need_writeback is set.\n", __FUNCTION__, *byte); /* Reallocate memory if necessary. */ - if ((rlpos + 2) * sizeof(runlist) >= rlsize) { + if ((rlpos + 2) * (int)sizeof(runlist) >= rlsize) { Dprintf("%s(): Reallocating space.\n", __FUNCTION__); /* Setup first free bit return value. */ From 9dec022b819650ea249834ac3f927752c6559950 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0819/2994] fix signed warnings (Logical change 1.223) --- libntfs/mst.c | 4 ++-- libntfs/runlist.c | 2 +- libntfs/unistr.c | 2 +- libntfs/volume.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libntfs/mst.c b/libntfs/mst.c index 41f42eeb..530b2722 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -48,7 +48,7 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size) usa_count = le16_to_cpu(b->usa_count) - 1; /* Size and alignment checks. */ if (size & (NTFS_SECTOR_SIZE - 1) || usa_ofs & 1 || - usa_ofs + (usa_count * 2) > size || + (u32)(usa_ofs + (usa_count * 2)) > size || (size >> NTFS_SECTOR_SIZE_BITS) != usa_count) { errno = EINVAL; return -1; @@ -136,7 +136,7 @@ int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size) usa_count = le16_to_cpu(b->usa_count) - 1; /* Size and alignment checks. */ if (size & (NTFS_SECTOR_SIZE - 1) || usa_ofs & 1 || - usa_ofs + (usa_count * 2) > size || + (u32)(usa_ofs + (usa_count * 2)) > size || (size >> NTFS_SECTOR_SIZE_BITS) != usa_count) { errno = EINVAL; return -1; diff --git a/libntfs/runlist.c b/libntfs/runlist.c index ef76280b..cc17870b 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -771,7 +771,7 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, * Allocate more memory if needed, including space for the * not-mapped and terminator elements. */ - if (((rlpos + 3) * sizeof(*old_rl)) > rlsize) { + if ((int)((rlpos + 3) * sizeof(*old_rl)) > rlsize) { runlist_element *rl2; rlsize += 0x1000; diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 848d9f9d..a8267af5 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -342,7 +342,7 @@ int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, memset(&mbstate, 0, sizeof(mbstate)); for (i = o = 0; i < ins_len; i++) { /* Reallocate memory if necessary or abort. */ - if (o + MB_CUR_MAX > mbs_len) { + if ((int)(o + MB_CUR_MAX) > mbs_len) { char *tc; if (mbs == *outs) { errno = ENAMETOOLONG; diff --git a/libntfs/volume.c b/libntfs/volume.c index 17d32d4b..7099a2af 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -839,7 +839,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) "name!"); goto error_exit; } - for (j = 0; j < u; j++) { + for (j = 0; j < (s32)u; j++) { uchar_t uc = le16_to_cpu(vname[j]); if (uc > 0xff) uc = (uchar_t)'_'; From 7712504582eda40d441e90325135993601bab85a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0820/2994] fix signed warnings 2003/11/03 16:11:36+00:00 cantab.net!aia21 Update what is to do to finish non-resident to resident attribute conversion. (Logical change 1.223) --- libntfs/attrib.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index a9a733e6..d5a59730 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1986,8 +1986,8 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type, if (!ad) return -1; /* We found the attribute. - Do the bounds check. */ - if (size >= le64_to_cpu(ad->min_size) && - size <= le64_to_cpu(ad->max_size)) + if (size >= sle64_to_cpu(ad->min_size) && + size <= sle64_to_cpu(ad->max_size)) return 0; /* @size is out of range! */ errno = ERANGE; @@ -2560,12 +2560,25 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) } // FIXME: For now we cheat and assume there is no attribute list - // present. (AIA) + // attribute present. (AIA) if (NInoAttrList(na->ni)) { errno = ENOTSUP; return -1; } + // Is there enough space for the attribute to be resident? + // If not: errno = ENOSPC; return -1; + + // Read and cache runlist if not already done. + + // Convert to resident attribute & resize attribute record. + + // Copy data from run list to resident attribute value. + + // Deallocate clusters from runlist and throw away runlist. + + // Update in-memory struct ntfs_attribute if not done already. + errno = ENOTSUP; return -1; From 03f2e201fee689988608e507c817e539c9779228 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0821/2994] ignore libntfs.conf (Logical change 1.223) --- BitKeeper/etc/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index f3e0a703..3f268b73 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -6,6 +6,7 @@ PENDING/* autom4te.cache/* Makefile */Makefile +libntfs/libntfs.conf ntfsprogs/*.8 config.log config.h From a69cd32d72a52191200f1b1b08adac239d6b1e31 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:04:07 +0000 Subject: [PATCH 0822/2994] update build 2003/11/04 12:26:49+00:00 cantab.net!aia21 Update build for ntfs gnome vfs (Logical change 1.223) --- aclocal.m4 | 271 +++++++ configure | 1927 ++++++++++++++++++++++++++++++++++++++++---------- configure.ac | 47 +- 3 files changed, 1861 insertions(+), 384 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 3dc75895..63b1bcbd 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -4512,3 +4512,274 @@ fi AC_MSG_RESULT([$SED]) ]) +# Configure paths for GLIB +# Owen Taylor 1997-2001 + +dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) +dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or +dnl gthread is specified in MODULES, pass to pkg-config +dnl +AC_DEFUN(AM_PATH_GLIB_2_0, +[dnl +dnl Get the cflags and libraries from pkg-config +dnl +AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], + , enable_glibtest=yes) + + pkg_config_args=glib-2.0 + for module in . $4 + do + case "$module" in + gmodule) + pkg_config_args="$pkg_config_args gmodule-2.0" + ;; + gobject) + pkg_config_args="$pkg_config_args gobject-2.0" + ;; + gthread) + pkg_config_args="$pkg_config_args gthread-2.0" + ;; + esac + done + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + + no_glib="" + + if test x$PKG_CONFIG != xno ; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then + : + else + echo *** pkg-config too old; version 0.7 or better required. + no_glib=yes + PKG_CONFIG=no + fi + else + no_glib=yes + fi + + min_glib_version=ifelse([$1], ,2.0.0,$1) + AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" + enable_glibtest=no + fi + + if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then + : + else + no_glib=yes + fi + fi + + if test x"$no_glib" = x ; then + GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` + GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` + GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + + GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` + GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` + glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_glibtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$GLIB_LIBS $LIBS" +dnl +dnl Now check if the installed GLIB is sufficiently new. (Also sanity +dnl checks the results of pkg-config to some extent) +dnl + rm -f conf.glibtest + AC_TRY_RUN([ +#include +#include +#include + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.glibtest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_glib_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_glib_version"); + exit(1); + } + + if ((glib_major_version != $glib_config_major_version) || + (glib_minor_version != $glib_config_minor_version) || + (glib_micro_version != $glib_config_micro_version)) + { + printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, + glib_major_version, glib_minor_version, glib_micro_version); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); + } + else if ((glib_major_version != GLIB_MAJOR_VERSION) || + (glib_minor_version != GLIB_MINOR_VERSION) || + (glib_micro_version != GLIB_MICRO_VERSION)) + { + printf("*** GLIB header files (version %d.%d.%d) do not match\n", + GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + glib_major_version, glib_minor_version, glib_micro_version); + } + else + { + if ((glib_major_version > major) || + ((glib_major_version == major) && (glib_minor_version > minor)) || + ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", + glib_major_version, glib_minor_version, glib_micro_version); + printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_glib" = x ; then + AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" + else + if test -f conf.glibtest ; then + : + else + echo "*** Could not run GLIB test program, checking why..." + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$LIBS $GLIB_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GLIB or finding the wrong" + echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GLIB_CFLAGS="" + GLIB_LIBS="" + GLIB_GENMARSHAL="" + GOBJECT_QUERY="" + GLIB_MKENUMS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GLIB_CFLAGS) + AC_SUBST(GLIB_LIBS) + AC_SUBST(GLIB_GENMARSHAL) + AC_SUBST(GOBJECT_QUERY) + AC_SUBST(GLIB_MKENUMS) + rm -f conf.glibtest +]) + + +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN(PKG_CHECK_MODULES, [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + + + diff --git a/configure b/configure index cf03ee9b..cfabf75c 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.0beta. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.0betaBK. # # Report bugs to . # @@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.0beta' -PACKAGE_STRING='ntfsprogs 1.8.0beta' +PACKAGE_VERSION='1.8.0betaBK' +PACKAGE_STRING='ntfsprogs 1.8.0betaBK' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -470,7 +470,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT DEBUG_TRUE DEBUG_FALSE REALLYSTATIC_TRUE REALLYSTATIC_FALSE CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE CC CFLAGS ac_ct_CC CCDEPMODE LN_S RANLIB ac_ct_RANLIB ECHO CPP EGREP LIBTOOL LIBTOOL_DEPS all_includes all_libraries AUTODIRS GCC_NEEDS_MS_EXTENSIONS_TRUE GCC_NEEDS_MS_EXTENSIONS_FALSE LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT DEBUG_TRUE DEBUG_FALSE REALLYSTATIC_TRUE REALLYSTATIC_FALSE PKG_CONFIG CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE GLIB_CFLAGS GLIB_LIBS GLIB_GENMARSHAL GOBJECT_QUERY GLIB_MKENUMS CXX CXXFLAGS ac_ct_CXX CXXDEPMODE LN_S RANLIB ac_ct_RANLIB GNOME_VFS_MODULE_CFLAGS GNOME_VFS_MODULE_LIBS ECHO CPP EGREP LIBTOOL LIBTOOL_DEPS all_includes all_libraries AUTODIRS GCC_NEEDS_MS_EXTENSIONS_TRUE GCC_NEEDS_MS_EXTENSIONS_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -911,22 +911,6 @@ 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_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS -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_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} @@ -935,6 +919,22 @@ 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_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} @@ -947,7 +947,7 @@ 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 ntfsprogs 1.8.0beta to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.0betaBK to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1014,7 +1014,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.0beta:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.0betaBK:";; esac cat <<\_ACEOF @@ -1023,12 +1023,13 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer - --enable-debug enable debugging - --enable-really-static completely static binaries - --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-debug enable debugging + --enable-really-static completely static binaries + --disable-glibtest do not try to compile and run a test GLIB program + --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors --enable-fast-install=PKGS optimize for fast installation default=yes --disable-libtool-lock avoid locking (might break parallel builds) @@ -1039,14 +1040,14 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects default=use both Some influential environment variables: - CXX C++ compiler command - CXXFLAGS C++ compiler flags + CC C compiler command + CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CC C compiler command - CFLAGS C compiler flags + CXX C++ compiler command + CXXFLAGS C++ compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help @@ -1115,7 +1116,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.0beta +ntfsprogs configure 1.8.0betaBK generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1130,7 +1131,7 @@ 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 ntfsprogs $as_me 1.8.0beta, which was +It was created by ntfsprogs $as_me 1.8.0betaBK, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1809,7 +1810,7 @@ fi # Define the identity of the package. PACKAGE=ntfsprogs - VERSION=1.8.0beta + VERSION=1.8.0betaBK cat >>confdefs.h <<_ACEOF @@ -1935,17 +1936,6 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" - -# This is required to get past a stupid configure bug when making the rpm. -# Basically it is broken to specify the host as a command line argument to -# configure on its own, i.e. without giving --host=. It is supposed to work -# but doesn't. So this sets host and erases nonopt effectively moving the -# standalone command line option into the --host= form. -if test "x$nonopt" != "xNONE"; then - host="$nonopt" - nonopt="NONE" -fi - 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. @@ -1970,6 +1960,60 @@ fi MAINT=$MAINTAINER_MODE_TRUE +# 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; + +# This is required to get past a stupid configure bug when making the rpm. +# Basically it is broken to specify the host as a command line argument to +# configure on its own, i.e. without giving --host=. It is supposed to work +# but doesn't. So this sets host and erases nonopt effectively moving the +# standalone command line option into the --host= form. +if test "x$nonopt" != "xNONE"; then + host="$nonopt" + nonopt="NONE" +fi if test "x$prefix" = "xNONE"; then @@ -2017,6 +2061,1337 @@ else fi +# Do not discard 'CFLAGS' as they may have been passed us by rpmbuild(8) +if test "$USE_MAINTAINER_MODE" = "yes";then + CFLAGS="$CFLAGS -ggdb3 -Wall -Wstrict-prototypes -Wsign-compare" ## FIXME: fix all source: -Wsign-compare +fi + +rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null + + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +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 | fgrep -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 + + + +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 "$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 +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 +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 "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 + 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 "$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 + ac_prog_rejected=no +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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +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 "$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 +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 +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 + + 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 + +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 + + test -n "$ac_ct_CC" && break +done + + 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 &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &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 () +{ + + ; + 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 + 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 +fi +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 + { { 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 () +{ + + ; + 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 + 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 + + ; + 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 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +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 +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + 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 +#include +#include +#include +/* 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 ' \ + '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 +$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 + +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 + + 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 + # 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. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}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=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CC_dependencies_compiler_type=$depmode + break + 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 + + + +# Check whether --enable-glibtest or --disable-glibtest was given. +if test "${enable_glibtest+set}" = set; then + enableval="$enable_glibtest" + +else + enable_glibtest=yes +fi; + + pkg_config_args=glib-2.0 + for module in . gmodule gobject + do + case "$module" in + gmodule) + pkg_config_args="$pkg_config_args gmodule-2.0" + ;; + gobject) + pkg_config_args="$pkg_config_args gobject-2.0" + ;; + gthread) + pkg_config_args="$pkg_config_args gthread-2.0" + ;; + esac + done + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + no_glib="" + + if test x$PKG_CONFIG != xno ; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then + : + else + echo *** pkg-config too old; version 0.7 or better required. + no_glib=yes + PKG_CONFIG=no + fi + else + no_glib=yes + fi + + min_glib_version=2.0.0 + echo "$as_me:$LINENO: checking for GLIB - version >= $min_glib_version" >&5 +echo $ECHO_N "checking for GLIB - version >= $min_glib_version... $ECHO_C" >&6 + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" + enable_glibtest=no + fi + + if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then + : + else + no_glib=yes + fi + fi + + if test x"$no_glib" = x ; then + GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` + GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` + GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + + GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` + GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` + glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_glibtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$GLIB_LIBS $LIBS" + rm -f conf.glibtest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +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 +#include +#include + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.glibtest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_glib_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_glib_version"); + exit(1); + } + + if ((glib_major_version != $glib_config_major_version) || + (glib_minor_version != $glib_config_minor_version) || + (glib_micro_version != $glib_config_micro_version)) + { + printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, + glib_major_version, glib_minor_version, glib_micro_version); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); + } + else if ((glib_major_version != GLIB_MAJOR_VERSION) || + (glib_minor_version != GLIB_MINOR_VERSION) || + (glib_micro_version != GLIB_MICRO_VERSION)) + { + printf("*** GLIB header files (version %d.%d.%d) do not match\n", + GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + glib_major_version, glib_minor_version, glib_micro_version); + } + else + { + if ((glib_major_version > major) || + ((glib_major_version == major) && (glib_minor_version > minor)) || + ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", + glib_major_version, glib_minor_version, glib_micro_version); + printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} + +_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 "$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 ) +no_glib=yes +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_glib" = x ; then + echo "$as_me:$LINENO: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5 +echo "${ECHO_T}yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6 + : + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" + else + if test -f conf.glibtest ; then + : + else + echo "*** Could not run GLIB test program, checking why..." + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$LIBS $GLIB_LIBS" + 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 +#include + +int +main () +{ + return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); + ; + 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 + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GLIB or finding the wrong" + echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GLIB is incorrectly installed." +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GLIB_CFLAGS="" + GLIB_LIBS="" + GLIB_GENMARSHAL="" + GOBJECT_QUERY="" + GLIB_MKENUMS="" + { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 library." >&5 +echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 library." >&2;} + { (exit 1); exit 1; }; } + fi + + + + + + rm -f conf.glibtest + +CFLAGS="$CFLAGS $GLIB_CFLAGS" +LIBS="$LIBS $GLIB_LIBS" + # Checks for programs. ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' @@ -2131,209 +3506,6 @@ ac_compiler=`set X $ac_compile; echo $2` 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 () -{ - - ; - 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 - 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 -fi -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 - { { 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 () -{ - - ; - 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 - 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_cxx_compiler_gnu+set}" = set; then @@ -2540,79 +3712,6 @@ 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 -rm -f .deps 2>/dev/null -mkdir .deps 2>/dev/null -if test -d .deps; then - DEPDIR=.deps -else - # MS-DOS does not allow filenames that begin with a dot. - DEPDIR=_deps -fi -rmdir .deps 2>/dev/null - - - ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -doit: - @echo done -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 | fgrep -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="$CXX" am_compiler_list= @@ -3615,6 +4714,107 @@ else fi + + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for gnome-vfs-module-2.0" >&5 +echo $ECHO_N "checking for gnome-vfs-module-2.0... $ECHO_C" >&6 + + if $PKG_CONFIG --exists "gnome-vfs-module-2.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + succeeded=yes + + echo "$as_me:$LINENO: checking GNOME_VFS_MODULE_CFLAGS" >&5 +echo $ECHO_N "checking GNOME_VFS_MODULE_CFLAGS... $ECHO_C" >&6 + GNOME_VFS_MODULE_CFLAGS=`$PKG_CONFIG --cflags "gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $GNOME_VFS_MODULE_CFLAGS" >&5 +echo "${ECHO_T}$GNOME_VFS_MODULE_CFLAGS" >&6 + + echo "$as_me:$LINENO: checking GNOME_VFS_MODULE_LIBS" >&5 +echo $ECHO_N "checking GNOME_VFS_MODULE_LIBS... $ECHO_C" >&6 + GNOME_VFS_MODULE_LIBS=`$PKG_CONFIG --libs "gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $GNOME_VFS_MODULE_LIBS" >&5 +echo "${ECHO_T}$GNOME_VFS_MODULE_LIBS" >&6 + else + GNOME_VFS_MODULE_CFLAGS="" + GNOME_VFS_MODULE_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + GNOME_VFS_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gnome-vfs-module-2.0"` + echo $GNOME_VFS_MODULE_PKG_ERRORS + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + : + else + { { echo "$as_me:$LINENO: error: Library requirements (gnome-vfs-module-2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5 +echo "$as_me: error: Library requirements (gnome-vfs-module-2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;} + { (exit 1); exit 1; }; } + fi + +CFLAGS="$CFLAGS $GNOME_VFS_MODULE_CFLAGS" +LIBS="$LIBS $GNOME_VFS_MODULE_LIBS" + # create a working libtool-script if test -z "$LIBTOOL"; then ac_ext=c @@ -3623,51 +4823,7 @@ 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 - # 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. + # 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} @@ -4128,7 +5284,6 @@ deplibs_check_method=$lt_cv_deplibs_check_method - # Check for command to grab the raw symbol name followed by C symbol from nm. echo "$as_me:$LINENO: checking command to parse $NM output" >&5 echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 @@ -5262,7 +6417,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 5265 "configure"' > conftest.$ac_ext + echo '#line 6420 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5791,7 +6946,7 @@ chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" compiler_c_o=no -if { (eval echo configure:5794: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then +if { (eval echo configure:6949: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then @@ -6975,7 +8130,7 @@ linux-gnu*) libsuff= case "$host_cpu" in x86_64*|s390x*) - echo '#line 6978 "configure"' > conftest.$ac_ext + echo '#line 8133 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7647,7 +8802,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -11423,7 +12579,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.0beta, which was +This file was extended by ntfsprogs $as_me 1.8.0betaBK, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11486,7 +12642,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.0beta +ntfsprogs config.status 1.8.0betaBK configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -11601,6 +12757,7 @@ do "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "libntfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libntfs/Makefile" ;; + "libntfs/libntfs.conf" ) CONFIG_FILES="$CONFIG_FILES libntfs/libntfs.conf" ;; "ntfsprogs/Makefile" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/Makefile" ;; "ntfsprogs/mkntfs.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/mkntfs.8" ;; "ntfsprogs/ntfscat.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscat.8" ;; @@ -11737,11 +12894,12 @@ s,@DEBUG_TRUE@,$DEBUG_TRUE,;t t s,@DEBUG_FALSE@,$DEBUG_FALSE,;t t s,@REALLYSTATIC_TRUE@,$REALLYSTATIC_TRUE,;t t s,@REALLYSTATIC_FALSE@,$REALLYSTATIC_FALSE,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;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_CXX@,$ac_ct_CXX,;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 @@ -11750,14 +12908,21 @@ 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,@CXXDEPMODE@,$CXXDEPMODE,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@GLIB_CFLAGS@,$GLIB_CFLAGS,;t t +s,@GLIB_LIBS@,$GLIB_LIBS,;t t +s,@GLIB_GENMARSHAL@,$GLIB_GENMARSHAL,;t t +s,@GOBJECT_QUERY@,$GOBJECT_QUERY,;t t +s,@GLIB_MKENUMS@,$GLIB_MKENUMS,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t s,@LN_S@,$LN_S,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@GNOME_VFS_MODULE_CFLAGS@,$GNOME_VFS_MODULE_CFLAGS,;t t +s,@GNOME_VFS_MODULE_LIBS@,$GNOME_VFS_MODULE_LIBS,;t t s,@ECHO@,$ECHO,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t diff --git a/configure.ac b/configure.ac index 3cbf20fa..8767e496 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,35 @@ +# +# configure.ac - Source file to generate "./configure" to prepare package for +# compilation. +# +# Copyright (c) 2000-2003 Anton Altaparmakov +# Copyright (c) 2003 Jan Kratochvil +# +# This program/include file 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 of the License, or +# (at your option) any later version. +# +# This program/include file 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 (in the main directory of the Linux-NTFS +# distribution in the file COPYING); if not, write to the Free Software +# Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.0beta, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.0betaBK, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE +AM_MAINTAINER_MODE +AM_ENABLE_SHARED +AM_ENABLE_STATIC # This is required to get past a stupid configure bug when making the rpm. # Basically it is broken to specify the host as a command line argument to @@ -15,8 +41,6 @@ if test "x$nonopt" != "xNONE"; then nonopt="NONE" fi -AM_MAINTAINER_MODE - AC_PREFIX_DEFAULT(/usr/local) if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix @@ -37,6 +61,16 @@ AC_ARG_ENABLE(really-static, AM_CONDITIONAL(DEBUG, test "$enable_debug" = yes) AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes) +# Do not discard 'CFLAGS' as they may have been passed us by rpmbuild(8) +if test "$USE_MAINTAINER_MODE" = "yes";then + CFLAGS="$CFLAGS -ggdb3 -Wall -Wstrict-prototypes -Wsign-compare" ## FIXME: fix all source: -Wsign-compare +fi + +AM_PATH_GLIB_2_0(,,[AC_MSG_ERROR([Linux-NTFS Gnome VFS module requires glib-2.0 library.])],[gmodule gobject]) +dnl Force glib-2.0 for the whole package +CFLAGS="$CFLAGS $GLIB_CFLAGS" +LIBS="$LIBS $GLIB_LIBS" + # Checks for programs. AC_PROG_CXX AC_PROG_CC @@ -45,6 +79,11 @@ AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_RANLIB +PKG_CHECK_MODULES(GNOME_VFS_MODULE,gnome-vfs-module-2.0) +dnl Force gnome-vfs-module-2.0 for the whole package +CFLAGS="$CFLAGS $GNOME_VFS_MODULE_CFLAGS" +LIBS="$LIBS $GNOME_VFS_MODULE_LIBS" + # create a working libtool-script if test -z "$LIBTOOL"; then AC_LANG_PUSH(C) @@ -66,6 +105,7 @@ AC_SUBST(all_libraries) AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) +AC_SUBST(LIBS) AC_SUBST(AUTODIRS) @@ -138,6 +178,7 @@ AC_CONFIG_FILES([ doc/Makefile include/Makefile libntfs/Makefile + libntfs/libntfs.conf ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 From ef164c718465ce23f68ff570a57ee8d2fefd6f68 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:13:48 +0000 Subject: [PATCH 0823/2994] Update build. Note noticed by citool before... (Logical change 1.224) --- include/Makefile.in | 7 +++ libntfs/Makefile.in | 120 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 101 insertions(+), 26 deletions(-) diff --git a/include/Makefile.in b/include/Makefile.in index 00384df9..f8699152 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -76,14 +76,21 @@ CXX = @CXX@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ MAINT = @MAINT@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 516fbdce..b5c6f4e4 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -103,14 +103,21 @@ CXX = @CXX@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ +GOBJECT_QUERY = @GOBJECT_QUERY@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ MAINT = @MAINT@ OBJDUMP = @OBJDUMP@ PACKAGE = @PACKAGE@ +PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ STRIP = @STRIP@ VERSION = @VERSION@ @@ -121,7 +128,7 @@ am__quote = @am__quote@ install_sh = @install_sh@ LTVERSION = 5:0:0 -LTVERSION_GNOMEVFS = 1:0:0 +LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 # Later gcc require -fms-extensions to work. @GCC_NEEDS_MS_EXTENSIONS_TRUE@GCCflag = -fms-extensions @@ -132,8 +139,7 @@ LTVERSION_GNOMEVFS = 1:0:0 @DEBUG_FALSE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall $(GCCflag) linux_ntfsincludedir = -I$(top_srcdir)/include -lib_LTLIBRARIES = libntfs.la libntfs-gnomevfs.la - +lib_LTLIBRARIES = libntfs.la libntfs_la_LDFLAGS = -version-info $(LTVERSION) libntfs_la_SOURCES = \ attrib.c \ @@ -153,20 +159,26 @@ libntfs_la_SOURCES = \ volume.c -libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_GNOMEVFS) +gnomevfsmoduleslibdir = $(libdir)/gnome-vfs-2.0/modules +gnomevfsmoduleslib_LTLIBRARIES = libntfs-gnomevfs.la + +libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS_GNOMEVFS) libntfs_gnomevfs_la_SOURCES = \ - gnome-vfs-method.c \ + gnome-vfs-method.c \ gnome-vfs-module.c +gnomevfsmodulesconfdir = $(sysconfdir)/gnome-vfs-2.0/modules +gnomevfsmodulesconf_DATA = libntfs.conf + INCLUDES = $(linux_ntfsincludedir) $(all_includes) EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in subdir = libntfs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(lib_LTLIBRARIES) +CONFIG_CLEAN_FILES = libntfs.conf +LTLIBRARIES = $(gnomevfsmoduleslib_LTLIBRARIES) $(lib_LTLIBRARIES) libntfs_gnomevfs_la_LIBADD = am_libntfs_gnomevfs_la_OBJECTS = gnome-vfs-method.lo gnome-vfs-module.lo @@ -179,7 +191,6 @@ libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrib.Plo ./$(DEPDIR)/bitmap.Plo \ @@ -200,7 +211,9 @@ CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) -DIST_COMMON = Makefile.am Makefile.in +DATA = $(gnomevfsmodulesconf_DATA) + +DIST_COMMON = Makefile.am Makefile.in libntfs.conf.in SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) all: all-am @@ -212,6 +225,36 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configu $(AUTOMAKE) --gnu libntfs/Makefile Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +libntfs.conf: $(top_builddir)/config.status libntfs.conf.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +gnomevfsmoduleslibLTLIBRARIES_INSTALL = $(INSTALL) +install-gnomevfsmoduleslibLTLIBRARIES: $(gnomevfsmoduleslib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(gnomevfsmoduleslibdir) + @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(gnomevfsmoduleslibdir)/$$f"; \ + $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(gnomevfsmoduleslibdir)/$$f; \ + else :; fi; \ + done + +uninstall-gnomevfsmoduleslibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(gnomevfsmoduleslibdir)/$$p"; \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(gnomevfsmoduleslibdir)/$$p; \ + done + +clean-gnomevfsmoduleslibLTLIBRARIES: + -test -z "$(gnomevfsmoduleslib_LTLIBRARIES)" || rm -f $(gnomevfsmoduleslib_LTLIBRARIES) + @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test -z "$dir" && dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done libLTLIBRARIES_INSTALL = $(INSTALL) install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @@ -241,7 +284,7 @@ clean-libLTLIBRARIES: rm -f "$${dir}/so_locations"; \ done libntfs-gnomevfs.la: $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libntfs_gnomevfs_la_LDFLAGS) $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_LIBADD) $(LIBS) + $(LINK) -rpath $(gnomevfsmoduleslibdir) $(libntfs_gnomevfs_la_LDFLAGS) $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_LIBADD) $(LIBS) libntfs.la: $(libntfs_la_OBJECTS) $(libntfs_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libntfs_la_LDFLAGS) $(libntfs_la_OBJECTS) $(libntfs_la_LIBADD) $(LIBS) @@ -300,6 +343,24 @@ clean-libtool: distclean-libtool: -rm -f libtool uninstall-info-am: +gnomevfsmodulesconfDATA_INSTALL = $(INSTALL_DATA) +install-gnomevfsmodulesconfDATA: $(gnomevfsmodulesconf_DATA) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(gnomevfsmodulesconfdir) + @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(gnomevfsmodulesconfDATA_INSTALL) $$d$$p $(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ + $(gnomevfsmodulesconfDATA_INSTALL) $$d$$p $(DESTDIR)$(gnomevfsmodulesconfdir)/$$f; \ + done + +uninstall-gnomevfsmodulesconfDATA: + @$(NORMAL_UNINSTALL) + @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ + rm -f $(DESTDIR)$(gnomevfsmodulesconfdir)/$$f; \ + done ETAGS = etags ETAGSFLAGS = @@ -364,10 +425,10 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(LTLIBRARIES) +all-am: Makefile $(LTLIBRARIES) $(DATA) installdirs: - $(mkinstalldirs) $(DESTDIR)$(libdir) + $(mkinstalldirs) $(DESTDIR)$(gnomevfsmoduleslibdir) $(DESTDIR)$(libdir) $(DESTDIR)$(gnomevfsmodulesconfdir) install: install-am install-exec: install-exec-am @@ -395,8 +456,8 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am +clean-am: clean-generic clean-gnomevfsmoduleslibLTLIBRARIES \ + clean-libLTLIBRARIES clean-libtool mostlyclean-am distclean: distclean-am @@ -411,7 +472,8 @@ info: info-am info-am: -install-data-am: +install-data-am: install-gnomevfsmodulesconfDATA \ + install-gnomevfsmoduleslibLTLIBRARIES install-exec-am: install-libLTLIBRARIES @@ -430,19 +492,25 @@ mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool -uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES +uninstall-am: uninstall-gnomevfsmodulesconfDATA \ + uninstall-gnomevfsmoduleslibLTLIBRARIES uninstall-info-am \ + uninstall-libLTLIBRARIES .PHONY: GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool distclean distclean-compile \ - distclean-depend distclean-generic distclean-libtool \ - distclean-tags 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-libLTLIBRARIES install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool tags uninstall \ - uninstall-am uninstall-info-am uninstall-libLTLIBRARIES + clean-gnomevfsmoduleslibLTLIBRARIES clean-libLTLIBRARIES \ + clean-libtool distclean distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am \ + install-gnomevfsmodulesconfDATA \ + install-gnomevfsmoduleslibLTLIBRARIES install-info \ + install-info-am install-libLTLIBRARIES install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + tags uninstall uninstall-am uninstall-gnomevfsmodulesconfDATA \ + uninstall-gnomevfsmoduleslibLTLIBRARIES uninstall-info-am \ + uninstall-libLTLIBRARIES # 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. From 8851638b84f5eb7e732862d3428653cab6bab230 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 4 Nov 2003 13:13:48 +0000 Subject: [PATCH 0824/2994] Update build. Note noticed by citool before... BKrev: 3fa7a60cCXT89jXQ04WH6DwRfRAX1w From 0edb229552100bd789feb810488ca7d6f22d3e35 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 11:11:24 +0000 Subject: [PATCH 0825/2994] Fix build process so that libntfs-gnomevfs is linked against libntfs properly using libtool. (Logical change 1.225) --- libntfs/Makefile.am | 6 ++++-- libntfs/Makefile.in | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 887f42c1..c7c49d3f 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -25,7 +25,7 @@ # - If the interface is the same as the previous version, change to C:R+1:A # -LTVERSION = 5:0:0 +LTVERSION_LIBNTFS = 5:0:0 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 @@ -44,8 +44,9 @@ AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall $(GCCflag) endif linux_ntfsincludedir = -I$(top_srcdir)/include + lib_LTLIBRARIES = libntfs.la -libntfs_la_LDFLAGS = -version-info $(LTVERSION) +libntfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS) libntfs_la_SOURCES = \ attrib.c \ bitmap.c \ @@ -67,6 +68,7 @@ gnomevfsmoduleslibdir = $(libdir)/gnome-vfs-2.0/modules gnomevfsmoduleslib_LTLIBRARIES = libntfs-gnomevfs.la libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS_GNOMEVFS) +libntfs_gnomevfs_la_LIBADD = libntfs.la libntfs_gnomevfs_la_SOURCES = \ gnome-vfs-method.c \ gnome-vfs-module.c diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index b5c6f4e4..ffae640e 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -127,7 +127,7 @@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ -LTVERSION = 5:0:0 +LTVERSION_LIBNTFS = 5:0:0 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 # Later gcc require -fms-extensions to work. @@ -139,8 +139,9 @@ LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 @DEBUG_FALSE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall $(GCCflag) linux_ntfsincludedir = -I$(top_srcdir)/include + lib_LTLIBRARIES = libntfs.la -libntfs_la_LDFLAGS = -version-info $(LTVERSION) +libntfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS) libntfs_la_SOURCES = \ attrib.c \ bitmap.c \ @@ -163,6 +164,7 @@ gnomevfsmoduleslibdir = $(libdir)/gnome-vfs-2.0/modules gnomevfsmoduleslib_LTLIBRARIES = libntfs-gnomevfs.la libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS_GNOMEVFS) +libntfs_gnomevfs_la_LIBADD = libntfs.la libntfs_gnomevfs_la_SOURCES = \ gnome-vfs-method.c \ gnome-vfs-module.c @@ -180,7 +182,7 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = libntfs.conf LTLIBRARIES = $(gnomevfsmoduleslib_LTLIBRARIES) $(lib_LTLIBRARIES) -libntfs_gnomevfs_la_LIBADD = +libntfs_gnomevfs_la_DEPENDENCIES = libntfs.la am_libntfs_gnomevfs_la_OBJECTS = gnome-vfs-method.lo gnome-vfs-module.lo libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) libntfs_la_LIBADD = From 60845e45cc0c5b1cc07d3b4c53304661a6c6bd14 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 11:11:24 +0000 Subject: [PATCH 0826/2994] Fix build process so that libntfs-gnomevfs is linked against libntfs properly using libtool. BKrev: 3faa2c5cRAidzL55nS3mE753I_nkfw From 3e9b8dc09c6b1a9a729372499d0de86b11fbe61d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 12:32:27 +0000 Subject: [PATCH 0827/2994] Add Jan Kratochvil. (Logical change 1.226) --- CREDITS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CREDITS b/CREDITS index a80efc2f..a10114d0 100644 --- a/CREDITS +++ b/CREDITS @@ -11,9 +11,10 @@ Anton Altaparmakov Albert D. Cahalan Russ Christensen Matthew J. Fanto +Ian Jackson +Jan Kratochvil Lode Leroy David Martínez Moreno -Ian Jackson Leonard Norrgĺrd Yuri Per Richard Russon From 025498f337b6728d09c8ae121c03cfcd4e552207 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 12:32:27 +0000 Subject: [PATCH 0828/2994] Merge libntfs-gnomevfs and other cleanups. (Logical change 1.226) --- ntfsprogs.spec.in | 51 ++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index 3392be45..0fcbf13f 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -19,31 +19,10 @@ Group : System Environment/Base %description The Linux-NTFS project (http://linux-ntfs.sf.net/) aims to bring full support for the NTFS filesystem to the Linux operating system. Linux-NTFS currently -consists of a static library and utilities. This package contains the following -utilities: - NtfsFix - Attempt to fix an NTFS partition that has been damaged by the -Linux NTFS driver. It should be run every time after you have used the Linux -NTFS driver to write to an NTFS partition to prevent massive data corruption -from happening when Windows mounts the partition. -IMPORTANT: Run this only *after* unmounting the partition in Linux but *before* -rebooting into Windows NT/2000! See man 8 ntfsfix for details. - mkntfs - Format a partition with the NTFS filesystem. See man 8 mkntfs -for command line options. - ntfslabel - Display/change the label of an NTFS partition. See man 8 -ntfslabel for details. - ntfsundelete - Recover deleted files from an NTFS volume. See man 8 -ntfsundelete for details. - ntfsresize - Resize an NTFS volume. See man 8 ntfsresize for details. - ntfsclone - Efficiently create/restore an image of an NTFS partition. -See man 8 ntfsclone for details. - ntfscluster - Locate the owner of any given sector or cluster on an -NTFS partition. See man 8 ntfscluster for details. - ntfsinfo - Show some information about an NTFS partition or one of the -files or directories within it. See man 8 ntfsinfo for details. - ntfsls - List information about files in a directory residing on an -NTFS partition. See man 8 ntfsls for details. - ntfscat - Concatenate files and print their contents on the standard -output. See man 8 ntfscat for details. +consists of a static library and utilities (for a full list of included +utilities see man 8 ntfsprogs after installation) as well as a GNOME virtual +filesystem module to allow GNOME VFS clients to seamlessly utilize the NTFS +library. %package devel Summary : files required to compile software that uses libntfs @@ -72,22 +51,36 @@ make DESTDIR="$RPM_BUILD_ROOT" install-strip rm -rf "$RPM_BUILD_ROOT" +%post +/sbin/ldconfig + + +%postun +/sbin/ldconfig + + %files %defattr(-,root,root) %doc AUTHORS COPYING CREDITS ChangeLog INSTALL NEWS README TODO.include TODO.libntfs TODO.ntfsprogs doc/CodingStyle doc/attribute_definitions doc/attributes.txt doc/compression.txt doc/tunable_settings doc/template.c doc/template.h doc/system_files.txt doc/system_security_descriptors.txt %{bindir}/* %{sbindir}/* %{mandir}/*/* -%{prefix}/lib/*.so* +%{_libdir}/libntfs.*so* +%{_libdir}/gnome-vfs-2.0/modules/libntfs-gnomevfs.*so* +%{_sysconfdir}/gnome-vfs-2.0/modules/libntfs.conf %files devel %defattr(-,root,root) -%{prefix}/include/* -%{prefix}/lib/*.a* -%{prefix}/lib/*.la* +%{_includedir}/* +%{_libdir}/libntfs.*a* +%{_libdir}/gnome-vfs-2.0/modules/libntfs-gnomevfs.*a* %changelog +* Thu Nov 6 2003 Anton Altaparmakov +- update description (it was getting too long) +- merge libntfs-gnomevfs + * Fri Oct 19 2003 Richard Russon - added the new utility ntfscat From 6092a909ca838f73e0722cef0792547018ca35a7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 12:32:27 +0000 Subject: [PATCH 0829/2994] Update spec file for libntfs-gnomevfs merge. FIXME: Do we want ntfsprogs rpm to install libntfs-gnomevfs, too or do we want to keep it as a separate rpm for non-gnome users? BKrev: 3faa3f5bUBp7C7CQ2CbVr2UPggcDUg From 50fb15960e60e9303fe4e7d8eebb94a19e92bb7e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 16:30:56 +0000 Subject: [PATCH 0830/2994] Add man page for libntfs-gnomevfs and other man page updates. (Logical change 1.227) --- README | 2 +- configure | 3 +- configure.ac | 1 + libntfs/Makefile.am | 2 ++ libntfs/Makefile.in | 71 +++++++++++++++++++++++++++++++++++----- ntfsprogs/mkntfs.8.in | 2 +- ntfsprogs/ntfsinfo.8.in | 1 - ntfsprogs/ntfsprogs.8.in | 2 ++ 8 files changed, 71 insertions(+), 13 deletions(-) diff --git a/README b/README index 752b0231..fb648de0 100644 --- a/README +++ b/README @@ -45,7 +45,7 @@ NTFS Gnome VFS module The Gnome virtual filesystem provides universal access to diffent filesystems. This modules enables Gnome VFS clients to seamlessly utilize the NTFS library. For further details and examples of how to make use of the NTFS Gnome VFS -module in practice see man 8 ntfsgnomevfs. +module in practice see man 8 libntfs-gnomevfs. NTFS utilities ============== diff --git a/configure b/configure index cfabf75c..1fdf6a9e 100755 --- a/configure +++ b/configure @@ -12182,7 +12182,7 @@ done # Makefiles to be created by configure. - ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile libntfs/Makefile libntfs/libntfs.conf ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" + ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile libntfs/Makefile libntfs/libntfs.conf libntfs/libntfs-gnomevfs.8 ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -12758,6 +12758,7 @@ do "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "libntfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libntfs/Makefile" ;; "libntfs/libntfs.conf" ) CONFIG_FILES="$CONFIG_FILES libntfs/libntfs.conf" ;; + "libntfs/libntfs-gnomevfs.8" ) CONFIG_FILES="$CONFIG_FILES libntfs/libntfs-gnomevfs.8" ;; "ntfsprogs/Makefile" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/Makefile" ;; "ntfsprogs/mkntfs.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/mkntfs.8" ;; "ntfsprogs/ntfscat.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscat.8" ;; diff --git a/configure.ac b/configure.ac index 8767e496..83edb4af 100644 --- a/configure.ac +++ b/configure.ac @@ -179,6 +179,7 @@ AC_CONFIG_FILES([ include/Makefile libntfs/Makefile libntfs/libntfs.conf + libntfs/libntfs-gnomevfs.8 ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index c7c49d3f..851b3da2 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -76,6 +76,8 @@ libntfs_gnomevfs_la_SOURCES = \ gnomevfsmodulesconfdir = $(sysconfdir)/gnome-vfs-2.0/modules gnomevfsmodulesconf_DATA = libntfs.conf +man_MANS = libntfs-gnomevfs.8 + INCLUDES = $(linux_ntfsincludedir) $(all_includes) EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index ffae640e..af8182ed 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -173,13 +173,15 @@ libntfs_gnomevfs_la_SOURCES = \ gnomevfsmodulesconfdir = $(sysconfdir)/gnome-vfs-2.0/modules gnomevfsmodulesconf_DATA = libntfs.conf +man_MANS = libntfs-gnomevfs.8 + INCLUDES = $(linux_ntfsincludedir) $(all_includes) EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in subdir = libntfs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = libntfs.conf +CONFIG_CLEAN_FILES = libntfs.conf libntfs-gnomevfs.8 LTLIBRARIES = $(gnomevfsmoduleslib_LTLIBRARIES) $(lib_LTLIBRARIES) libntfs_gnomevfs_la_DEPENDENCIES = libntfs.la @@ -213,9 +215,13 @@ CCLD = $(CC) LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) + +NROFF = nroff +MANS = $(man_MANS) DATA = $(gnomevfsmodulesconf_DATA) -DIST_COMMON = Makefile.am Makefile.in libntfs.conf.in +DIST_COMMON = Makefile.am Makefile.in libntfs-gnomevfs.8.in \ + libntfs.conf.in SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) all: all-am @@ -229,6 +235,8 @@ Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.s cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) libntfs.conf: $(top_builddir)/config.status libntfs.conf.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +libntfs-gnomevfs.8: $(top_builddir)/config.status libntfs-gnomevfs.8.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ gnomevfsmoduleslibLTLIBRARIES_INSTALL = $(INSTALL) install-gnomevfsmoduleslibLTLIBRARIES: $(gnomevfsmoduleslib_LTLIBRARIES) @$(NORMAL_INSTALL) @@ -345,6 +353,49 @@ clean-libtool: distclean-libtool: -rm -f libtool uninstall-info-am: + +man8dir = $(mandir)/man8 +install-man8: $(man8_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(man8dir) + @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.8*) 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/^.*\\.//'`; \ + case "$$ext" in \ + 8*) ;; \ + *) ext='8' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ + done +uninstall-man8: + @$(NORMAL_UNINSTALL) + @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.8*) 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 -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \ + rm -f $(DESTDIR)$(man8dir)/$$inst; \ + done gnomevfsmodulesconfDATA_INSTALL = $(INSTALL_DATA) install-gnomevfsmodulesconfDATA: $(gnomevfsmodulesconf_DATA) @$(NORMAL_INSTALL) @@ -427,10 +478,10 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(LTLIBRARIES) $(DATA) +all-am: Makefile $(LTLIBRARIES) $(MANS) $(DATA) installdirs: - $(mkinstalldirs) $(DESTDIR)$(gnomevfsmoduleslibdir) $(DESTDIR)$(libdir) $(DESTDIR)$(gnomevfsmodulesconfdir) + $(mkinstalldirs) $(DESTDIR)$(gnomevfsmoduleslibdir) $(DESTDIR)$(libdir) $(DESTDIR)$(man8dir) $(DESTDIR)$(gnomevfsmodulesconfdir) install: install-am install-exec: install-exec-am @@ -475,13 +526,13 @@ info: info-am info-am: install-data-am: install-gnomevfsmodulesconfDATA \ - install-gnomevfsmoduleslibLTLIBRARIES + install-gnomevfsmoduleslibLTLIBRARIES install-man install-exec-am: install-libLTLIBRARIES install-info: install-info-am -install-man: +install-man: install-man8 installcheck-am: @@ -496,7 +547,9 @@ mostlyclean-am: mostlyclean-compile mostlyclean-generic \ uninstall-am: uninstall-gnomevfsmodulesconfDATA \ uninstall-gnomevfsmoduleslibLTLIBRARIES uninstall-info-am \ - uninstall-libLTLIBRARIES + uninstall-libLTLIBRARIES uninstall-man + +uninstall-man: uninstall-man8 .PHONY: GTAGS all all-am check check-am clean clean-generic \ clean-gnomevfsmoduleslibLTLIBRARIES clean-libLTLIBRARIES \ @@ -506,13 +559,13 @@ uninstall-am: uninstall-gnomevfsmodulesconfDATA \ install-data-am install-exec install-exec-am \ install-gnomevfsmodulesconfDATA \ install-gnomevfsmoduleslibLTLIBRARIES install-info \ - install-info-am install-libLTLIBRARIES install-man \ + install-info-am install-libLTLIBRARIES install-man install-man8 \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ tags uninstall uninstall-am uninstall-gnomevfsmodulesconfDATA \ uninstall-gnomevfsmoduleslibLTLIBRARIES uninstall-info-am \ - uninstall-libLTLIBRARIES + uninstall-libLTLIBRARIES uninstall-man uninstall-man8 # 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. diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 5edbf57d..e97d8ede 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -225,6 +225,6 @@ is part of the Linux-NTFS project and is available for download from http://sf.net/project/showfiles.php?group_id=13956 in source (tar ball and rpm) and pre-compiled binary (i386 rpm and deb) form. .SH SEE ALSO -.BR badblocks(8), +.BR badblocks (8), .BR ntfsprogs (8) diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index 96401269..2e03b3dd 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -24,4 +24,3 @@ http://linux-ntfs.sourceforge.net/. .SH SEE ALSO .BR ntfsprogs (8) - diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index 3529a997..e72fbb89 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -65,4 +65,6 @@ can be downloaded from http://linux-ntfs.sourceforge.net/downloads.html .br These manual pages can be viewed online at http://linux-ntfs.sourceforge.net/man/ntfsprogs.html +.SH SEE ALSO +.BR libntfs-gnomevfs (8) From 86424d0660ee5895e39f61b0b386a0b4376ed1ae Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 16:30:56 +0000 Subject: [PATCH 0831/2994] Add man page for libntfs-gnomevfs and other man page updates. BKrev: 3faa7740Nr0XjOC3wqCcLN-coVRU-Q From 2f42ed8d72d49a94266114726de0bedec8e537f0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 16:30:56 +0000 Subject: [PATCH 0832/2994] Initial revision --- libntfs/libntfs-gnomevfs.8.in | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 libntfs/libntfs-gnomevfs.8.in diff --git a/libntfs/libntfs-gnomevfs.8.in b/libntfs/libntfs-gnomevfs.8.in new file mode 100644 index 00000000..e69de29b From c26497232e7f6a433a1b7295e4821977d68a9b89 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 16:30:56 +0000 Subject: [PATCH 0833/2994] (Logical change 1.227) --- libntfs/libntfs-gnomevfs.8.in | 111 ++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/libntfs/libntfs-gnomevfs.8.in b/libntfs/libntfs-gnomevfs.8.in index e69de29b..ad37353c 100644 --- a/libntfs/libntfs-gnomevfs.8.in +++ b/libntfs/libntfs-gnomevfs.8.in @@ -0,0 +1,111 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2003 Anton Altaparmakov. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSPROGS 8 "November 2003" "Linux-NTFS version @VERSION@" + +.SH OVERVIEW +The GNOME virtual filesystem (VFS) provides universal access to different filesystems. +The +.BR libntfs-gnomevfs +module enables GNOME VFS aware clients to seamlessly utilize the NTFS library +.BR libntfs . + +So you can access an NTFS filesystem without needing to use the NTFS utilities themselves +(at least in theory anyway). In practice this is probably more useful for programs and +programmers to make using +.BR libntfs +easier, more generic, and to allow easier debugging of +.BR libntfs . + +.SH Examples +.SS Prerequisites +.PP +To be able to follow these examples you will need to have installed the test utilities +from the gnome-vfs-2.4.x package. The easiest way to do this is to download and compile +the gnome-vfs-2 package, e.g. download from: + +http://ftp.gnome.org/pub/GNOME/desktop/2.4/2.4.0/sources/gnome-vfs-2.4.0.tar.gz + +Then run ./configure followed by make and make install (as root). This will install +it into /usr/local so it should not conflict with your existing installation from +rpm or deb packages which will be in /usr. + +Note you may also need to add /usr/local/lib to /etc/ld.so.conf and then run ldconfig +(as root) to let your system see the installed gnome-vfs-2.4.x libraries. + +Then run ./configure followed by make and make install (as root) in the main +.BR ntfsprogs +directory to build and install the +.BR libntfs-gnomevfs +module and +.BR libntfs +library which is used by the module. + +.SS Copying a file from an NTFS partition +.PP +To copy the file autoexec.bat from the main directory of an NTFS partition (/dev/hda1) +to the /tmp directory on your system you could run: + +/path/to/gnome-vfs-2.4.x/test/test-xfer file:///dev/hda1#libntfs:/autoexec.bat /tmp/autoexec.bat + +To copy a file from a directory inside the NTFS partition you would just specify the full path. +So for example to copy the file win.ini from the Windows directory you would run: + +/path/to/gnome-vfs-2.4.x/test/test-xfer file:///dev/hda1#libntfs:/Windows/win.ini /tmp/win.ini + +.SS Shell access to an NTFS partition +.PP +For debugging it is most useful to be able to do various things to the NTFS partition while it +is being operated upon by +.BR libntfs . +This is achieved using the test-shell utility (from the gnome-vfs-2.4.x package) by running: +/path/to/gnome-vfs-2.4.x/test/test-shell + +This drops you into the GNOME VFS shell from where you can now cd into the NTFS partition (/dev/hda1) +by typing: cd file:///dev/hda1#libntfs:/ + +You are now in the root directory of the NTFS partition. The first thing you will probably want to +do is to type "ls" to display the directory contents. + +You could then change directories using the "cd" command, e.g. to enter the Windows directory you +would type: cd Windows + +You can then open files, seek inside files, read from files (write is not enabled at present), etc +thus exercising large portions of the NTFS library. + +Use the "help" command while in the shell to see the available commands. + +.SH BUGS +.PP +No bugs are known but there are several limitations at the moment: + +You cannot get information about files other than what the "ls" command +in the test-shell can give you, i.e. the "info" command in the test-shell +does not work. + +Further access to the partition is read-only and hence you cannot write +to files. This will be changed in the future once the module has had +more wide testing. + +There may be other limitations and possibly bugs. Please report any +problems to the NTFS mailing list: linux-ntfs-dev@lists.sourceforge.net + +.SH AUTHORS +.PP +The +.BR libntfs-gnomevfs +module was written by Jan Kratochvil. This man page was written by Anton Altaparmakov. + +.SH AVAILABILITY +The +.BR ntfsprogs +package which contains the +.BR libntfs-gnomevfs +module can be downloaded from http://linux-ntfs.sourceforge.net/downloads.html +.BR +These manual pages can be viewed online at http://linux-ntfs.sourceforge.net/man/ntfsprogs.html + +.SH SEE ALSO +.BR ntfsprogs (8) + From 644be9f595a2729c587b13650c92c7b4041747a3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 16:32:28 +0000 Subject: [PATCH 0834/2994] Add man pages in libntfs directory to the ignore list. (Logical change 1.228) --- BitKeeper/etc/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 3f268b73..6631b410 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -7,6 +7,7 @@ autom4te.cache/* Makefile */Makefile libntfs/libntfs.conf +libntfs/*.8 ntfsprogs/*.8 config.log config.h From a087baf3b9c9fee31dd26c66a1088333f601255b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 16:32:28 +0000 Subject: [PATCH 0835/2994] Add man pages in libntfs directory to the ignore list. BKrev: 3faa779cicTVVBfYrii5RL6bXKinOA From 6d8ad66256d273e65e2bb388586e0d433cfd5d6b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 17:34:24 +0000 Subject: [PATCH 0836/2994] Split off libntfs-gnomevfs into its own rpm ntfsprogs-gnomevfs.*.rpm (Logical change 1.229) --- ntfsprogs.spec.in | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index 0fcbf13f..9c4efb0f 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -19,10 +19,19 @@ Group : System Environment/Base %description The Linux-NTFS project (http://linux-ntfs.sf.net/) aims to bring full support for the NTFS filesystem to the Linux operating system. Linux-NTFS currently -consists of a static library and utilities (for a full list of included -utilities see man 8 ntfsprogs after installation) as well as a GNOME virtual -filesystem module to allow GNOME VFS clients to seamlessly utilize the NTFS -library. +consists of a static library and utilities such as mkntfs, ntfscat, ntfsls, +ntfsresize, and ntfsundelete (for a full list of included utilities see man +8 ntfsprogs after installation). + + +%package gnomevfs +Summary : NTFS GNOME virtual filesystem module +Group : System Environment/Base +Requires : ntfsprogs = %{ver}-%{rel} +%description gnomevfs +This package contains the NTFS GNOME virtual filesystem (VFS) module which +allows GNOME VFS clients to seamlessly utilize the NTFS library. + %package devel Summary : files required to compile software that uses libntfs @@ -64,12 +73,16 @@ rm -rf "$RPM_BUILD_ROOT" %doc AUTHORS COPYING CREDITS ChangeLog INSTALL NEWS README TODO.include TODO.libntfs TODO.ntfsprogs doc/CodingStyle doc/attribute_definitions doc/attributes.txt doc/compression.txt doc/tunable_settings doc/template.c doc/template.h doc/system_files.txt doc/system_security_descriptors.txt %{bindir}/* %{sbindir}/* -%{mandir}/*/* +%{mandir}/man8/mkntfs.8* +%{mandir}/man8/ntfs*.8* %{_libdir}/libntfs.*so* + +%files gnomevfs +%defattr(-,root,root) +%{mandir}/man8/libntfs-gnomevfs.8* %{_libdir}/gnome-vfs-2.0/modules/libntfs-gnomevfs.*so* %{_sysconfdir}/gnome-vfs-2.0/modules/libntfs.conf - %files devel %defattr(-,root,root) %{_includedir}/* From fee7837427a957a579cbfb263aba350e127cafa6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 6 Nov 2003 17:34:24 +0000 Subject: [PATCH 0837/2994] Split off libntfs-gnomevfs into its own rpm ntfsprogs-gnomevfs.*.rpm BKrev: 3faa8620Jp83TXajnUFpa3AN3XJf1Q From d8f45af56ff01621dcd2b05c11e38215c64a6065 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 7 Nov 2003 10:16:00 +0000 Subject: [PATCH 0838/2994] Initial revision --- compile | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 compile diff --git a/compile b/compile new file mode 100755 index 00000000..e69de29b From 6f459a9a6411fb490277d61c41d209ead51b4f62 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 7 Nov 2003 10:16:00 +0000 Subject: [PATCH 0839/2994] (Logical change 1.230) --- compile | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/compile b/compile index e69de29b..9bb997a6 100755 --- a/compile +++ b/compile @@ -0,0 +1,99 @@ +#! /bin/sh + +# Wrapper for compilers which do not understand `-c -o'. + +# Copyright 1999, 2000 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Usage: +# compile PROGRAM [ARGS]... +# `-o FOO.o' is removed from the args passed to the actual compile. + +prog=$1 +shift + +ofile= +cfile= +args= +while test $# -gt 0; do + case "$1" in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we do something ugly here. + ofile=$2 + shift + case "$ofile" in + *.o | *.obj) + ;; + *) + args="$args -o $ofile" + ofile= + ;; + esac + ;; + *.c) + cfile=$1 + args="$args $1" + ;; + *) + args="$args $1" + ;; + esac + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$prog" $args +fi + +# Name of file we expect compiler to create. +cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` + +# Create the lock directory. +# Note: use `[/.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d +while true; do + if mkdir $lockdir > /dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir $lockdir; exit 1" 1 2 15 + +# Run the compile. +"$prog" $args +status=$? + +if test -f "$cofile"; then + mv "$cofile" "$ofile" +fi + +rmdir $lockdir +exit $status From 912e86e813a0d9dfe12542fb95346d003bad4769 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 7 Nov 2003 10:16:00 +0000 Subject: [PATCH 0840/2994] Split off ntfsprogs-gnomevfs in separate rpm and move glib/gnome dependencies to it. (Logical change 1.230) --- Makefile.in | 8 +- configure | 2003 +++++++++++++---------------------------- configure.ac | 17 +- doc/Makefile.in | 2 + include/Makefile.in | 2 + libntfs/Makefile.am | 2 + libntfs/Makefile.in | 53 +- ntfsprogs.spec.in | 26 + ntfsprogs/Makefile.in | 2 + 9 files changed, 734 insertions(+), 1381 deletions(-) diff --git a/Makefile.in b/Makefile.in index 066525f2..5551e978 100644 --- a/Makefile.in +++ b/Makefile.in @@ -83,6 +83,8 @@ GLIB_MKENUMS = @GLIB_MKENUMS@ GOBJECT_QUERY = @GOBJECT_QUERY@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ +LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ +LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ @@ -120,9 +122,9 @@ RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ - Makefile.in NEWS aclocal.m4 config.guess config.h.in config.sub \ - configure configure.ac depcomp install-sh ltconfig ltmain.sh \ - missing mkinstalldirs ntfsprogs.spec.in + Makefile.in NEWS aclocal.m4 compile config.guess config.h.in \ + config.sub configure configure.ac depcomp install-sh ltconfig \ + ltmain.sh missing mkinstalldirs ntfsprogs.spec.in DIST_SUBDIRS = $(SUBDIRS) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive diff --git a/configure b/configure index 1fdf6a9e..f564c62e 100755 --- a/configure +++ b/configure @@ -470,7 +470,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT DEBUG_TRUE DEBUG_FALSE REALLYSTATIC_TRUE REALLYSTATIC_FALSE PKG_CONFIG CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE GLIB_CFLAGS GLIB_LIBS GLIB_GENMARSHAL GOBJECT_QUERY GLIB_MKENUMS CXX CXXFLAGS ac_ct_CXX CXXDEPMODE LN_S RANLIB ac_ct_RANLIB GNOME_VFS_MODULE_CFLAGS GNOME_VFS_MODULE_LIBS ECHO CPP EGREP LIBTOOL LIBTOOL_DEPS all_includes all_libraries AUTODIRS GCC_NEEDS_MS_EXTENSIONS_TRUE GCC_NEEDS_MS_EXTENSIONS_FALSE LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT DEBUG_TRUE DEBUG_FALSE REALLYSTATIC_TRUE REALLYSTATIC_FALSE CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE CC CFLAGS ac_ct_CC CCDEPMODE LN_S RANLIB ac_ct_RANLIB PKG_CONFIG GLIB_CFLAGS GLIB_LIBS GLIB_GENMARSHAL GOBJECT_QUERY GLIB_MKENUMS GNOME_VFS_MODULE_CFLAGS GNOME_VFS_MODULE_LIBS ECHO CPP EGREP LIBTOOL LIBTOOL_DEPS all_includes all_libraries LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS AUTODIRS GCC_NEEDS_MS_EXTENSIONS_TRUE GCC_NEEDS_MS_EXTENSIONS_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -911,22 +911,6 @@ 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_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} @@ -935,6 +919,22 @@ ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS +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_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_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} @@ -1027,9 +1027,9 @@ Optional Features: --enable-static=PKGS build static libraries default=yes --enable-debug enable debugging --enable-really-static completely static binaries - --disable-glibtest do not try to compile and run a test GLIB program --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors + --disable-glibtest do not try to compile and run a test GLIB program --enable-fast-install=PKGS optimize for fast installation default=yes --disable-libtool-lock avoid locking (might break parallel builds) @@ -1040,14 +1040,14 @@ Optional Packages: --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 + CXX C++ compiler command + CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CXX C++ compiler command - CXXFLAGS C++ compiler flags + CC C compiler command + CFLAGS C compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help @@ -2066,1332 +2066,6 @@ if test "$USE_MAINTAINER_MODE" = "yes";then CFLAGS="$CFLAGS -ggdb3 -Wall -Wstrict-prototypes -Wsign-compare" ## FIXME: fix all source: -Wsign-compare fi -rm -f .deps 2>/dev/null -mkdir .deps 2>/dev/null -if test -d .deps; then - DEPDIR=.deps -else - # MS-DOS does not allow filenames that begin with a dot. - DEPDIR=_deps -fi -rmdir .deps 2>/dev/null - - - ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -doit: - @echo done -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 | fgrep -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 - - - -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 "$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 -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 -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 "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 - 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 "$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 - ac_prog_rejected=no -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 $# != 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 - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -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 "$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 -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 -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 - - 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 - -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 - - test -n "$ac_ct_CC" && break -done - - 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 &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &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 () -{ - - ; - 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 - 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 -fi -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 - { { 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 () -{ - - ; - 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 - 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 - - ; - 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 - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -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 -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - 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 -#include -#include -#include -/* 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 ' \ - '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 -$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 - -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 - - 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 - # 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. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}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=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && - grep conftest.h conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - am_cv_CC_dependencies_compiler_type=$depmode - break - 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 - - - -# Check whether --enable-glibtest or --disable-glibtest was given. -if test "${enable_glibtest+set}" = set; then - enableval="$enable_glibtest" - -else - enable_glibtest=yes -fi; - - pkg_config_args=glib-2.0 - for module in . gmodule gobject - do - case "$module" in - gmodule) - pkg_config_args="$pkg_config_args gmodule-2.0" - ;; - gobject) - pkg_config_args="$pkg_config_args gobject-2.0" - ;; - gthread) - pkg_config_args="$pkg_config_args gthread-2.0" - ;; - esac - done - - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - no_glib="" - - if test x$PKG_CONFIG != xno ; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then - : - else - echo *** pkg-config too old; version 0.7 or better required. - no_glib=yes - PKG_CONFIG=no - fi - else - no_glib=yes - fi - - min_glib_version=2.0.0 - echo "$as_me:$LINENO: checking for GLIB - version >= $min_glib_version" >&5 -echo $ECHO_N "checking for GLIB - version >= $min_glib_version... $ECHO_C" >&6 - - if test x$PKG_CONFIG != xno ; then - ## don't try to run the test against uninstalled libtool libs - if $PKG_CONFIG --uninstalled $pkg_config_args; then - echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" - enable_glibtest=no - fi - - if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then - : - else - no_glib=yes - fi - fi - - if test x"$no_glib" = x ; then - GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` - GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` - GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` - - GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` - GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` - glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` - if test "x$enable_glibtest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$GLIB_LIBS $LIBS" - rm -f conf.glibtest - if test "$cross_compiling" = yes; then - echo $ac_n "cross compiling; assumed OK... $ac_c" -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 -#include -#include - -int -main () -{ - int major, minor, micro; - char *tmp_version; - - system ("touch conf.glibtest"); - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = g_strdup("$min_glib_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_glib_version"); - exit(1); - } - - if ((glib_major_version != $glib_config_major_version) || - (glib_minor_version != $glib_config_minor_version) || - (glib_micro_version != $glib_config_micro_version)) - { - printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", - $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, - glib_major_version, glib_minor_version, glib_micro_version); - printf ("*** was found! If pkg-config was correct, then it is best\n"); - printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); - printf("*** to point to the correct configuration files\n"); - } - else if ((glib_major_version != GLIB_MAJOR_VERSION) || - (glib_minor_version != GLIB_MINOR_VERSION) || - (glib_micro_version != GLIB_MICRO_VERSION)) - { - printf("*** GLIB header files (version %d.%d.%d) do not match\n", - GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); - printf("*** library (version %d.%d.%d)\n", - glib_major_version, glib_minor_version, glib_micro_version); - } - else - { - if ((glib_major_version > major) || - ((glib_major_version == major) && (glib_minor_version > minor)) || - ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", - glib_major_version, glib_minor_version, glib_micro_version); - printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", - major, minor, micro); - printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); - printf("***\n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); - printf("*** correct copy of pkg-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} - -_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 "$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 ) -no_glib=yes -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_glib" = x ; then - echo "$as_me:$LINENO: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5 -echo "${ECHO_T}yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6 - : - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - if test "$PKG_CONFIG" = "no" ; then - echo "*** A new enough version of pkg-config was not found." - echo "*** See http://www.freedesktop.org/software/pkgconfig/" - else - if test -f conf.glibtest ; then - : - else - echo "*** Could not run GLIB test program, checking why..." - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$LIBS $GLIB_LIBS" - 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 -#include - -int -main () -{ - return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); - ; - 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 - echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GLIB or finding the wrong" - echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GLIB is incorrectly installed." -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - GLIB_CFLAGS="" - GLIB_LIBS="" - GLIB_GENMARSHAL="" - GOBJECT_QUERY="" - GLIB_MKENUMS="" - { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 library." >&5 -echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 library." >&2;} - { (exit 1); exit 1; }; } - fi - - - - - - rm -f conf.glibtest - -CFLAGS="$CFLAGS $GLIB_CFLAGS" -LIBS="$LIBS $GLIB_LIBS" - # Checks for programs. ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' @@ -3506,6 +2180,209 @@ ac_compiler=`set X $ac_compile; echo $2` 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 () +{ + + ; + 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 + 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 +fi +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 + { { 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 () +{ + + ; + 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 + 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_cxx_compiler_gnu+set}" = set; then @@ -3712,6 +2589,79 @@ 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 +rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null + + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +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 | fgrep -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="$CXX" am_compiler_list= @@ -4715,6 +3665,322 @@ fi +# Check whether --enable-glibtest or --disable-glibtest was given. +if test "${enable_glibtest+set}" = set; then + enableval="$enable_glibtest" + +else + enable_glibtest=yes +fi; + + pkg_config_args=glib-2.0 + for module in . gmodule gobject + do + case "$module" in + gmodule) + pkg_config_args="$pkg_config_args gmodule-2.0" + ;; + gobject) + pkg_config_args="$pkg_config_args gobject-2.0" + ;; + gthread) + pkg_config_args="$pkg_config_args gthread-2.0" + ;; + esac + done + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + no_glib="" + + if test x$PKG_CONFIG != xno ; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then + : + else + echo *** pkg-config too old; version 0.7 or better required. + no_glib=yes + PKG_CONFIG=no + fi + else + no_glib=yes + fi + + min_glib_version=2.0.0 + echo "$as_me:$LINENO: checking for GLIB - version >= $min_glib_version" >&5 +echo $ECHO_N "checking for GLIB - version >= $min_glib_version... $ECHO_C" >&6 + + if test x$PKG_CONFIG != xno ; then + ## don't try to run the test against uninstalled libtool libs + if $PKG_CONFIG --uninstalled $pkg_config_args; then + echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" + enable_glibtest=no + fi + + if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then + : + else + no_glib=yes + fi + fi + + if test x"$no_glib" = x ; then + GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` + GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` + GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` + + GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` + GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` + glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_glibtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$GLIB_LIBS $LIBS" + rm -f conf.glibtest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +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 +#include +#include + +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.glibtest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = g_strdup("$min_glib_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_glib_version"); + exit(1); + } + + if ((glib_major_version != $glib_config_major_version) || + (glib_minor_version != $glib_config_minor_version) || + (glib_micro_version != $glib_config_micro_version)) + { + printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, + glib_major_version, glib_minor_version, glib_micro_version); + printf ("*** was found! If pkg-config was correct, then it is best\n"); + printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); + printf("*** to point to the correct configuration files\n"); + } + else if ((glib_major_version != GLIB_MAJOR_VERSION) || + (glib_minor_version != GLIB_MINOR_VERSION) || + (glib_micro_version != GLIB_MICRO_VERSION)) + { + printf("*** GLIB header files (version %d.%d.%d) do not match\n", + GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); + printf("*** library (version %d.%d.%d)\n", + glib_major_version, glib_minor_version, glib_micro_version); + } + else + { + if ((glib_major_version > major) || + ((glib_major_version == major) && (glib_minor_version > minor)) || + ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", + glib_major_version, glib_minor_version, glib_micro_version); + printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); + printf("*** correct copy of pkg-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} + +_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 "$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 ) +no_glib=yes +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_glib" = x ; then + echo "$as_me:$LINENO: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5 +echo "${ECHO_T}yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6 + : + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + if test "$PKG_CONFIG" = "no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" + else + if test -f conf.glibtest ; then + : + else + echo "*** Could not run GLIB test program, checking why..." + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GLIB_CFLAGS" + LIBS="$LIBS $GLIB_LIBS" + 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 +#include + +int +main () +{ + return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); + ; + 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 + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GLIB or finding the wrong" + echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GLIB is incorrectly installed." +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GLIB_CFLAGS="" + GLIB_LIBS="" + GLIB_GENMARSHAL="" + GOBJECT_QUERY="" + GLIB_MKENUMS="" + { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 library." >&5 +echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 library." >&2;} + { (exit 1); exit 1; }; } + fi + + + + + + rm -f conf.glibtest + +LIBNTFS_GNOMEVFS_CFLAGS="$CFLAGS $GLIB_CFLAGS" +LIBNTFS_GNOMEVFS_LIBS="$LIBS $GLIB_LIBS" + + succeeded=no if test -z "$PKG_CONFIG"; then @@ -4812,8 +4078,8 @@ echo "$as_me: error: Library requirements (gnome-vfs-module-2.0) not met; consid { (exit 1); exit 1; }; } fi -CFLAGS="$CFLAGS $GNOME_VFS_MODULE_CFLAGS" -LIBS="$LIBS $GNOME_VFS_MODULE_LIBS" +LIBNTFS_GNOMEVFS_CFLAGS="$LIBNTFS_GNOMEVFS_CFLAGS $CFLAGS $GNOME_VFS_MODULE_CFLAGS" +LIBNTFS_GNOMEVFS_LIBS="$LIBNTFS_GNOMEVFS_LIBS $LIBS $GNOME_VFS_MODULE_LIBS" # create a working libtool-script if test -z "$LIBTOOL"; then @@ -6417,7 +5683,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 6420 "configure"' > conftest.$ac_ext + echo '#line 5686 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6946,7 +6212,7 @@ chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" compiler_c_o=no -if { (eval echo configure:6949: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then +if { (eval echo configure:6215: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then @@ -8130,7 +7396,7 @@ linux-gnu*) libsuff= case "$host_cpu" in x86_64*|s390x*) - echo '#line 8133 "configure"' > conftest.$ac_ext + echo '#line 7399 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8802,7 +8068,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < Date: Fri, 7 Nov 2003 10:16:00 +0000 Subject: [PATCH 0841/2994] Split off ntfsprogs-gnomevfs in separate rpm and move glib/gnome dependencies to it. BKrev: 3fab70e0uvOPZszZl4bUlPl27hmsNQ From f318004b7ab3bd7d06a6332070e9b71f1d874e0a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 7 Nov 2003 18:25:26 +0000 Subject: [PATCH 0842/2994] Make building of libntfs-gnomevfs optional and autodetect it in configure. (Jan Kratochvil) BKrev: 3fabe396nEF9oUufRSC76HSt02-Log From d9bf0f8f6e713a2827e8709be7c360de1e099af5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 7 Nov 2003 18:25:26 +0000 Subject: [PATCH 0843/2994] Make building of libntfs-gnomevfs optional. (Jan Kratochvil) (Logical change 1.231) --- Makefile.in | 6 - TODO.libntfs | 2 +- aclocal.m4 | 213 ------- configure | 1396 +++++++++++------------------------------ configure.ac | 27 +- doc/Makefile.in | 6 - include/Makefile.in | 6 - libntfs/Makefile.am | 10 +- libntfs/Makefile.in | 16 +- ntfsprogs.spec.in | 30 +- ntfsprogs/Makefile.in | 6 - 11 files changed, 388 insertions(+), 1330 deletions(-) diff --git a/Makefile.in b/Makefile.in index 5551e978..c5242514 100644 --- a/Makefile.in +++ b/Makefile.in @@ -72,15 +72,9 @@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ diff --git a/TODO.libntfs b/TODO.libntfs index 5029567b..2f775696 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -2,7 +2,7 @@ * libntfs-gnomevfs * ******************** -Be generic GnomeVFS filter; how to redirect ntfs_mount(3) to GnomeVFS parent? +- be generic filter: provide ntfs_device_operations from parent GnomeVFSHandle *********** * libntfs * diff --git a/aclocal.m4 b/aclocal.m4 index 63b1bcbd..39c9c30e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -4512,219 +4512,6 @@ fi AC_MSG_RESULT([$SED]) ]) -# Configure paths for GLIB -# Owen Taylor 1997-2001 - -dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) -dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or -dnl gthread is specified in MODULES, pass to pkg-config -dnl -AC_DEFUN(AM_PATH_GLIB_2_0, -[dnl -dnl Get the cflags and libraries from pkg-config -dnl -AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], - , enable_glibtest=yes) - - pkg_config_args=glib-2.0 - for module in . $4 - do - case "$module" in - gmodule) - pkg_config_args="$pkg_config_args gmodule-2.0" - ;; - gobject) - pkg_config_args="$pkg_config_args gobject-2.0" - ;; - gthread) - pkg_config_args="$pkg_config_args gthread-2.0" - ;; - esac - done - - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - - no_glib="" - - if test x$PKG_CONFIG != xno ; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then - : - else - echo *** pkg-config too old; version 0.7 or better required. - no_glib=yes - PKG_CONFIG=no - fi - else - no_glib=yes - fi - - min_glib_version=ifelse([$1], ,2.0.0,$1) - AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) - - if test x$PKG_CONFIG != xno ; then - ## don't try to run the test against uninstalled libtool libs - if $PKG_CONFIG --uninstalled $pkg_config_args; then - echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" - enable_glibtest=no - fi - - if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then - : - else - no_glib=yes - fi - fi - - if test x"$no_glib" = x ; then - GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` - GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` - GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` - - GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` - GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` - glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_glibtest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$GLIB_LIBS $LIBS" -dnl -dnl Now check if the installed GLIB is sufficiently new. (Also sanity -dnl checks the results of pkg-config to some extent) -dnl - rm -f conf.glibtest - AC_TRY_RUN([ -#include -#include -#include - -int -main () -{ - int major, minor, micro; - char *tmp_version; - - system ("touch conf.glibtest"); - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = g_strdup("$min_glib_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_glib_version"); - exit(1); - } - - if ((glib_major_version != $glib_config_major_version) || - (glib_minor_version != $glib_config_minor_version) || - (glib_micro_version != $glib_config_micro_version)) - { - printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", - $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, - glib_major_version, glib_minor_version, glib_micro_version); - printf ("*** was found! If pkg-config was correct, then it is best\n"); - printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); - printf("*** to point to the correct configuration files\n"); - } - else if ((glib_major_version != GLIB_MAJOR_VERSION) || - (glib_minor_version != GLIB_MINOR_VERSION) || - (glib_micro_version != GLIB_MICRO_VERSION)) - { - printf("*** GLIB header files (version %d.%d.%d) do not match\n", - GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); - printf("*** library (version %d.%d.%d)\n", - glib_major_version, glib_minor_version, glib_micro_version); - } - else - { - if ((glib_major_version > major) || - ((glib_major_version == major) && (glib_minor_version > minor)) || - ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", - glib_major_version, glib_minor_version, glib_micro_version); - printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", - major, minor, micro); - printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); - printf("***\n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); - printf("*** correct copy of pkg-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} -],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_glib" = x ; then - AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$PKG_CONFIG" = "no" ; then - echo "*** A new enough version of pkg-config was not found." - echo "*** See http://www.freedesktop.org/software/pkgconfig/" - else - if test -f conf.glibtest ; then - : - else - echo "*** Could not run GLIB test program, checking why..." - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$LIBS $GLIB_LIBS" - AC_TRY_LINK([ -#include -#include -], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GLIB or finding the wrong" - echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - GLIB_CFLAGS="" - GLIB_LIBS="" - GLIB_GENMARSHAL="" - GOBJECT_QUERY="" - GLIB_MKENUMS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(GLIB_CFLAGS) - AC_SUBST(GLIB_LIBS) - AC_SUBST(GLIB_GENMARSHAL) - AC_SUBST(GOBJECT_QUERY) - AC_SUBST(GLIB_MKENUMS) - rm -f conf.glibtest -]) - dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page diff --git a/configure b/configure index f564c62e..d95f8317 100755 --- a/configure +++ b/configure @@ -470,7 +470,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT DEBUG_TRUE DEBUG_FALSE REALLYSTATIC_TRUE REALLYSTATIC_FALSE CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE CC CFLAGS ac_ct_CC CCDEPMODE LN_S RANLIB ac_ct_RANLIB PKG_CONFIG GLIB_CFLAGS GLIB_LIBS GLIB_GENMARSHAL GOBJECT_QUERY GLIB_MKENUMS GNOME_VFS_MODULE_CFLAGS GNOME_VFS_MODULE_LIBS ECHO CPP EGREP LIBTOOL LIBTOOL_DEPS all_includes all_libraries LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS AUTODIRS GCC_NEEDS_MS_EXTENSIONS_TRUE GCC_NEEDS_MS_EXTENSIONS_FALSE LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT DEBUG_TRUE DEBUG_FALSE REALLYSTATIC_TRUE REALLYSTATIC_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE LN_S RANLIB ac_ct_RANLIB PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE ECHO CPP EGREP LIBTOOL LIBTOOL_DEPS all_includes all_libraries AUTODIRS GCC_NEEDS_MS_EXTENSIONS_TRUE GCC_NEEDS_MS_EXTENSIONS_FALSE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -911,22 +911,6 @@ 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_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS -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_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} @@ -935,6 +919,14 @@ 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} @@ -1029,7 +1021,7 @@ Optional Features: --enable-really-static completely static binaries --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors - --disable-glibtest do not try to compile and run a test GLIB program + --disable-gnome-vfs Omit Gnome-VFS-2.0 'libntfs' interface (default=detect) --enable-fast-install=PKGS optimize for fast installation default=yes --disable-libtool-lock avoid locking (might break parallel builds) @@ -1040,14 +1032,12 @@ Optional Packages: --with-pic try to use only PIC/non-PIC objects default=use both Some influential environment variables: - CXX C++ compiler command - CXXFLAGS C++ compiler flags + CC C compiler command + CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CC C compiler command - CFLAGS C compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help @@ -2067,671 +2057,6 @@ if test "$USE_MAINTAINER_MODE" = "yes";then fi # Checks for programs. -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC - 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_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # 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_CXX="$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 -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -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_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - - -# 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 &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &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 () -{ - - ; - 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 - 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 -fi -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 - { { 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 () -{ - - ; - 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 - 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_cxx_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 - - ; - 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_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_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_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cxx_g=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -for ac_declaration in \ - ''\ - '#include ' \ - '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 -$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 - -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 -rm -f .deps 2>/dev/null -mkdir .deps 2>/dev/null -if test -d .deps; then - DEPDIR=.deps -else - # MS-DOS does not allow filenames that begin with a dot. - DEPDIR=_deps -fi -rmdir .deps 2>/dev/null - - - ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -doit: - @echo done -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 | fgrep -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="$CXX" 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_CXX_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 - - am_cv_CXX_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 - # 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. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}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=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && - grep conftest.h conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3067,6 +2392,209 @@ ac_compiler=`set X $ac_compile; echo $2` 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 () +{ + + ; + 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 + 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 +fi +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 + { { 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 () +{ + + ; + 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 + 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 @@ -3396,6 +2924,79 @@ 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 +rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null + + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +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 | fgrep -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= @@ -3664,322 +3265,16 @@ else fi - -# Check whether --enable-glibtest or --disable-glibtest was given. -if test "${enable_glibtest+set}" = set; then - enableval="$enable_glibtest" +# Check whether --enable-gnome-vfs or --disable-gnome-vfs was given. +if test "${enable_gnome_vfs+set}" = set; then + enableval="$enable_gnome_vfs" else - enable_glibtest=yes + enable_gnome_vfs=auto + fi; - - pkg_config_args=glib-2.0 - for module in . gmodule gobject - do - case "$module" in - gmodule) - pkg_config_args="$pkg_config_args gmodule-2.0" - ;; - gobject) - pkg_config_args="$pkg_config_args gobject-2.0" - ;; - gthread) - pkg_config_args="$pkg_config_args gthread-2.0" - ;; - esac - done - - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - - no_glib="" - - if test x$PKG_CONFIG != xno ; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then - : - else - echo *** pkg-config too old; version 0.7 or better required. - no_glib=yes - PKG_CONFIG=no - fi - else - no_glib=yes - fi - - min_glib_version=2.0.0 - echo "$as_me:$LINENO: checking for GLIB - version >= $min_glib_version" >&5 -echo $ECHO_N "checking for GLIB - version >= $min_glib_version... $ECHO_C" >&6 - - if test x$PKG_CONFIG != xno ; then - ## don't try to run the test against uninstalled libtool libs - if $PKG_CONFIG --uninstalled $pkg_config_args; then - echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" - enable_glibtest=no - fi - - if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then - : - else - no_glib=yes - fi - fi - - if test x"$no_glib" = x ; then - GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` - GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` - GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` - - GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` - GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` - glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` - glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` - glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ - sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` - if test "x$enable_glibtest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$GLIB_LIBS $LIBS" - rm -f conf.glibtest - if test "$cross_compiling" = yes; then - echo $ac_n "cross compiling; assumed OK... $ac_c" -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 -#include -#include - -int -main () -{ - int major, minor, micro; - char *tmp_version; - - system ("touch conf.glibtest"); - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = g_strdup("$min_glib_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_glib_version"); - exit(1); - } - - if ((glib_major_version != $glib_config_major_version) || - (glib_minor_version != $glib_config_minor_version) || - (glib_micro_version != $glib_config_micro_version)) - { - printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", - $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, - glib_major_version, glib_minor_version, glib_micro_version); - printf ("*** was found! If pkg-config was correct, then it is best\n"); - printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); - printf("*** required on your system.\n"); - printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); - printf("*** to point to the correct configuration files\n"); - } - else if ((glib_major_version != GLIB_MAJOR_VERSION) || - (glib_minor_version != GLIB_MINOR_VERSION) || - (glib_micro_version != GLIB_MICRO_VERSION)) - { - printf("*** GLIB header files (version %d.%d.%d) do not match\n", - GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); - printf("*** library (version %d.%d.%d)\n", - glib_major_version, glib_minor_version, glib_micro_version); - } - else - { - if ((glib_major_version > major) || - ((glib_major_version == major) && (glib_minor_version > minor)) || - ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", - glib_major_version, glib_minor_version, glib_micro_version); - printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", - major, minor, micro); - printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); - printf("***\n"); - printf("*** If you have already installed a sufficiently new version, this error\n"); - printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); - printf("*** being found. The easiest way to fix this is to remove the old version\n"); - printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); - printf("*** correct copy of pkg-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); - printf("*** so that the correct libraries are found at run-time))\n"); - } - } - return 1; -} - -_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 "$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 ) -no_glib=yes -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_glib" = x ; then - echo "$as_me:$LINENO: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5 -echo "${ECHO_T}yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6 - : - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - if test "$PKG_CONFIG" = "no" ; then - echo "*** A new enough version of pkg-config was not found." - echo "*** See http://www.freedesktop.org/software/pkgconfig/" - else - if test -f conf.glibtest ; then - : - else - echo "*** Could not run GLIB test program, checking why..." - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $GLIB_CFLAGS" - LIBS="$LIBS $GLIB_LIBS" - 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 -#include - -int -main () -{ - return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); - ; - 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 - echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GLIB or finding the wrong" - echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GLIB is incorrectly installed." -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - GLIB_CFLAGS="" - GLIB_LIBS="" - GLIB_GENMARSHAL="" - GOBJECT_QUERY="" - GLIB_MKENUMS="" - { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 library." >&5 -echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 library." >&2;} - { (exit 1); exit 1; }; } - fi - - - - - - rm -f conf.glibtest - -LIBNTFS_GNOMEVFS_CFLAGS="$CFLAGS $GLIB_CFLAGS" -LIBNTFS_GNOMEVFS_LIBS="$LIBS $GLIB_LIBS" - +compile_gnome_vfs=false +if test "$enable_gnome_vfs" != "no";then succeeded=no @@ -4034,32 +3329,32 @@ fi else PKG_CONFIG_MIN_VERSION=0.9.0 if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for gnome-vfs-module-2.0" >&5 -echo $ECHO_N "checking for gnome-vfs-module-2.0... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 +echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 - if $PKG_CONFIG --exists "gnome-vfs-module-2.0" ; then + if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 succeeded=yes - echo "$as_me:$LINENO: checking GNOME_VFS_MODULE_CFLAGS" >&5 -echo $ECHO_N "checking GNOME_VFS_MODULE_CFLAGS... $ECHO_C" >&6 - GNOME_VFS_MODULE_CFLAGS=`$PKG_CONFIG --cflags "gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $GNOME_VFS_MODULE_CFLAGS" >&5 -echo "${ECHO_T}$GNOME_VFS_MODULE_CFLAGS" >&6 + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 - echo "$as_me:$LINENO: checking GNOME_VFS_MODULE_LIBS" >&5 -echo $ECHO_N "checking GNOME_VFS_MODULE_LIBS... $ECHO_C" >&6 - GNOME_VFS_MODULE_LIBS=`$PKG_CONFIG --libs "gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $GNOME_VFS_MODULE_LIBS" >&5 -echo "${ECHO_T}$GNOME_VFS_MODULE_LIBS" >&6 + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 else - GNOME_VFS_MODULE_CFLAGS="" - GNOME_VFS_MODULE_LIBS="" + LIBNTFS_GNOMEVFS_CFLAGS="" + LIBNTFS_GNOMEVFS_LIBS="" ## If we have a custom action on failure, don't print errors, but ## do set a variable so people can do so. - GNOME_VFS_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gnome-vfs-module-2.0"` - echo $GNOME_VFS_MODULE_PKG_ERRORS + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + fi @@ -4071,15 +3366,31 @@ echo "${ECHO_T}$GNOME_VFS_MODULE_LIBS" >&6 fi if test $succeeded = yes; then - : + compile_gnome_vfs=true else - { { echo "$as_me:$LINENO: error: Library requirements (gnome-vfs-module-2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5 -echo "$as_me: error: Library requirements (gnome-vfs-module-2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;} + + if test "$enable_gnome_vfs" = "yes";then + { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&5 +echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&2;} { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&5 +echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&2;} + fi + fi -LIBNTFS_GNOMEVFS_CFLAGS="$LIBNTFS_GNOMEVFS_CFLAGS $CFLAGS $GNOME_VFS_MODULE_CFLAGS" -LIBNTFS_GNOMEVFS_LIBS="$LIBNTFS_GNOMEVFS_LIBS $LIBS $GNOME_VFS_MODULE_LIBS" +fi + + +if $compile_gnome_vfs; then + ENABLE_GNOME_VFS_TRUE= + ENABLE_GNOME_VFS_FALSE='#' +else + ENABLE_GNOME_VFS_TRUE='#' + ENABLE_GNOME_VFS_FALSE= +fi + # create a working libtool-script if test -z "$LIBTOOL"; then @@ -4550,6 +3861,7 @@ deplibs_check_method=$lt_cv_deplibs_check_method + # Check for command to grab the raw symbol name followed by C symbol from nm. echo "$as_me:$LINENO: checking command to parse $NM output" >&5 echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 @@ -5683,7 +4995,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 5686 "configure"' > conftest.$ac_ext + echo '#line 4998 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6212,7 +5524,7 @@ chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" compiler_c_o=no -if { (eval echo configure:6215: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then +if { (eval echo configure:5527: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then @@ -7396,7 +6708,7 @@ linux-gnu*) libsuff= case "$host_cpu" in x86_64*|s390x*) - echo '#line 7399 "configure"' > conftest.$ac_ext + echo '#line 6711 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8068,7 +7380,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&2;} { (exit 1); exit 1; }; } fi +if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"ENABLE_GNOME_VFS\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${GCC_NEEDS_MS_EXTENSIONS_TRUE}" && test -z "${GCC_NEEDS_MS_EXTENSIONS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"GCC_NEEDS_MS_EXTENSIONS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -12164,11 +11483,11 @@ s,@DEBUG_TRUE@,$DEBUG_TRUE,;t t s,@DEBUG_FALSE@,$DEBUG_FALSE,;t t s,@REALLYSTATIC_TRUE@,$REALLYSTATIC_TRUE,;t t s,@REALLYSTATIC_FALSE@,$REALLYSTATIC_FALSE,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;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_CXX@,$ac_ct_CXX,;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 @@ -12177,22 +11496,15 @@ 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,@CXXDEPMODE@,$CXXDEPMODE,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@LN_S@,$LN_S,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t -s,@GLIB_CFLAGS@,$GLIB_CFLAGS,;t t -s,@GLIB_LIBS@,$GLIB_LIBS,;t t -s,@GLIB_GENMARSHAL@,$GLIB_GENMARSHAL,;t t -s,@GOBJECT_QUERY@,$GOBJECT_QUERY,;t t -s,@GLIB_MKENUMS@,$GLIB_MKENUMS,;t t -s,@GNOME_VFS_MODULE_CFLAGS@,$GNOME_VFS_MODULE_CFLAGS,;t t -s,@GNOME_VFS_MODULE_LIBS@,$GNOME_VFS_MODULE_LIBS,;t t +s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t +s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t +s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t +s,@ENABLE_GNOME_VFS_FALSE@,$ENABLE_GNOME_VFS_FALSE,;t t s,@ECHO@,$ECHO,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t @@ -12200,8 +11512,6 @@ s,@LIBTOOL@,$LIBTOOL,;t t s,@LIBTOOL_DEPS@,$LIBTOOL_DEPS,;t t s,@all_includes@,$all_includes,;t t s,@all_libraries@,$all_libraries,;t t -s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t -s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@AUTODIRS@,$AUTODIRS,;t t s,@GCC_NEEDS_MS_EXTENSIONS_TRUE@,$GCC_NEEDS_MS_EXTENSIONS_TRUE,;t t s,@GCC_NEEDS_MS_EXTENSIONS_FALSE@,$GCC_NEEDS_MS_EXTENSIONS_FALSE,;t t diff --git a/configure.ac b/configure.ac index 2ef5ed60..75bfd3f3 100644 --- a/configure.ac +++ b/configure.ac @@ -67,22 +67,29 @@ if test "$USE_MAINTAINER_MODE" = "yes";then fi # Checks for programs. -AC_PROG_CXX AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_RANLIB -AM_PATH_GLIB_2_0(,,[AC_MSG_ERROR([Linux-NTFS Gnome VFS module requires glib-2.0 library.])],[gmodule gobject]) -dnl Force glib-2.0 for the whole package -LIBNTFS_GNOMEVFS_CFLAGS="$CFLAGS $GLIB_CFLAGS" -LIBNTFS_GNOMEVFS_LIBS="$LIBS $GLIB_LIBS" - -PKG_CHECK_MODULES(GNOME_VFS_MODULE,gnome-vfs-module-2.0) -dnl Force gnome-vfs-module-2.0 for the whole package -LIBNTFS_GNOMEVFS_CFLAGS="$LIBNTFS_GNOMEVFS_CFLAGS $CFLAGS $GNOME_VFS_MODULE_CFLAGS" -LIBNTFS_GNOMEVFS_LIBS="$LIBNTFS_GNOMEVFS_LIBS $LIBS $GNOME_VFS_MODULE_LIBS" +AC_ARG_ENABLE(gnome-vfs, + [ --disable-gnome-vfs Omit Gnome-VFS-2.0 'libntfs' interface (default=detect)], , + enable_gnome_vfs=auto +) +compile_gnome_vfs=false +if test "$enable_gnome_vfs" != "no";then + PKG_CHECK_MODULES(LIBNTFS_GNOMEVFS, [glib-2.0 gthread-2.0 gnome-vfs-module-2.0], + [ compile_gnome_vfs=true ], + [ + if test "$enable_gnome_vfs" = "yes";then + AC_MSG_ERROR([Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares.]) + else + AC_MSG_WARN([Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares.]) + fi + ]) +fi +AM_CONDITIONAL(ENABLE_GNOME_VFS, $compile_gnome_vfs) # create a working libtool-script if test -z "$LIBTOOL"; then diff --git a/doc/Makefile.in b/doc/Makefile.in index 2239a60b..49827c8a 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -72,15 +72,9 @@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ diff --git a/include/Makefile.in b/include/Makefile.in index acb19290..a0124660 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -72,15 +72,9 @@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 57bd0ce1..44c53233 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -64,9 +64,16 @@ libntfs_la_SOURCES = \ unistr.c \ volume.c +if ENABLE_GNOME_VFS + gnomevfsmoduleslibdir = $(libdir)/gnome-vfs-2.0/modules gnomevfsmoduleslib_LTLIBRARIES = libntfs-gnomevfs.la +gnomevfsmodulesconfdir = $(sysconfdir)/gnome-vfs-2.0/modules +gnomevfsmodulesconf_DATA = libntfs.conf + +endif + libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS_GNOMEVFS) libntfs_gnomevfs_la_LIBADD = libntfs.la libntfs_gnomevfs_la_LIBS = $(LIBNTFS_GNOMEVFS_LIBS) @@ -75,9 +82,6 @@ libntfs_gnomevfs_la_SOURCES = \ gnome-vfs-method.c \ gnome-vfs-module.c -gnomevfsmodulesconfdir = $(sysconfdir)/gnome-vfs-2.0/modules -gnomevfsmodulesconf_DATA = libntfs.conf - man_MANS = libntfs-gnomevfs.8 INCLUDES = $(linux_ntfsincludedir) $(all_includes) diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 9764b46f..38d42da1 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -99,15 +99,9 @@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ @@ -162,8 +156,11 @@ libntfs_la_SOURCES = \ volume.c -gnomevfsmoduleslibdir = $(libdir)/gnome-vfs-2.0/modules -gnomevfsmoduleslib_LTLIBRARIES = libntfs-gnomevfs.la +@ENABLE_GNOME_VFS_TRUE@gnomevfsmoduleslibdir = $(libdir)/gnome-vfs-2.0/modules +@ENABLE_GNOME_VFS_TRUE@gnomevfsmoduleslib_LTLIBRARIES = libntfs-gnomevfs.la + +@ENABLE_GNOME_VFS_TRUE@gnomevfsmodulesconfdir = $(sysconfdir)/gnome-vfs-2.0/modules +@ENABLE_GNOME_VFS_TRUE@gnomevfsmodulesconf_DATA = libntfs.conf libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS_GNOMEVFS) libntfs_gnomevfs_la_LIBADD = libntfs.la @@ -174,9 +171,6 @@ libntfs_gnomevfs_la_SOURCES = \ gnome-vfs-module.c -gnomevfsmodulesconfdir = $(sysconfdir)/gnome-vfs-2.0/modules -gnomevfsmodulesconf_DATA = libntfs.conf - man_MANS = libntfs-gnomevfs.8 INCLUDES = $(linux_ntfsincludedir) $(all_includes) diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index 49ecf01c..7d5d84d8 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -28,30 +28,10 @@ ntfsresize, and ntfsundelete (for a full list of included utilities see man Summary : NTFS GNOME virtual filesystem module Group : System Environment/Base Requires : ntfsprogs = %{ver}-%{rel} -Requires : libbonobo-activation.so.4 -Requires : libcom_err.so.3 -Requires : libcrypto.so.4 -Requires : libdl.so.2 -Requires : libgconf-2.so.4 -Requires : libglib-2.0.so.0 -Requires : libgmodule-2.0.so.0 -Requires : libgnomevfs-2.so.0 -Requires : libgobject-2.0.so.0 -Requires : libgssapi_krb5.so.2 -Requires : libgthread-2.0.so.0 -Requires : libk5crypto.so.3 -Requires : libkrb5.so.3 -Requires : liblinc.so.1 -Requires : libm.so.6 -Requires : libORBit-2.so.0 -Requires : libpthread.so.0 -Requires : libpthread.so.0(GLIBC_2.0) -Requires : libpthread.so.0(GLIBC_2.2) -Requires : libresolv.so.2 -Requires : librt.so.1 -Requires : libssl.so.4 -Requires : libxml2.so.2 -Requires : libz.so.1 +BuildRequires : glib2-devel +Requires : glib2 +BuildRequires : gnome-vfs2-devel +Requires : gnome-vfs2 %description gnomevfs @@ -73,7 +53,7 @@ with libntfs. %build if [ -n "$LINGUAS" ]; then unset LINGUAS; fi -%configure +%configure --enable-gnome-vfs make diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index d78142ed..dc328d15 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -72,15 +72,9 @@ AWK = @AWK@ CC = @CC@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GOBJECT_QUERY = @GOBJECT_QUERY@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ From eb0e4f664fd05a9e0f82892f7214c77fd757dfb8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 10 Nov 2003 10:54:56 +0000 Subject: [PATCH 0844/2994] Release 1.8.0beta2 (Logical change 1.232) --- ChangeLog | 2 +- configure | 20 ++++++++++---------- configure.ac | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index e28b0b18..36624109 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/11/2003 - 1.8.0beta2 - More features! +10/11/2003 - 1.8.0beta2 - More features! - Merge ntfsprogs-gnomevfs written by Jan Kratochvil. 23/10/2003 - 1.8.0beta - The Long Overdue(TM) release. diff --git a/configure b/configure index d95f8317..8c0d10f3 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.0betaBK. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.0beta2. # # Report bugs to . # @@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.0betaBK' -PACKAGE_STRING='ntfsprogs 1.8.0betaBK' +PACKAGE_VERSION='1.8.0beta2' +PACKAGE_STRING='ntfsprogs 1.8.0beta2' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -939,7 +939,7 @@ 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 ntfsprogs 1.8.0betaBK to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.0beta2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1006,7 +1006,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.0betaBK:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.0beta2:";; esac cat <<\_ACEOF @@ -1106,7 +1106,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.0betaBK +ntfsprogs configure 1.8.0beta2 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1121,7 +1121,7 @@ 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 ntfsprogs $as_me 1.8.0betaBK, which was +It was created by ntfsprogs $as_me 1.8.0beta2, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1800,7 +1800,7 @@ fi # Define the identity of the package. PACKAGE=ntfsprogs - VERSION=1.8.0betaBK + VERSION=1.8.0beta2 cat >>confdefs.h <<_ACEOF @@ -11167,7 +11167,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.0betaBK, which was +This file was extended by ntfsprogs $as_me 1.8.0beta2, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11230,7 +11230,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.0betaBK +ntfsprogs config.status 1.8.0beta2 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 75bfd3f3..3f5bb755 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.0betaBK, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.0beta2, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) From 84f4b4857e99a2aaabb9ee2cb022bae50cb29423 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 10 Nov 2003 10:54:56 +0000 Subject: [PATCH 0845/2994] Release 1.8.0beta2 BKrev: 3faf6e80po6nK1q_-jxlk8BkjXqpvQ From 03bde61ab1a512b2e6e2f7285a3341d97c51ca8e Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 12 Nov 2003 18:05:56 +0000 Subject: [PATCH 0846/2994] replace sf with sourceforge in the man pages when they are html-ified, they cause warnings in the link checker BKrev: 3fb27684yhwz3L2knQ62UcZ62gCl1Q From 12317ec4a818a09a945b61c61e6b736d5b564530 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 12 Nov 2003 18:05:56 +0000 Subject: [PATCH 0847/2994] s/sf/sourceforge/g (Logical change 1.233) --- ntfsprogs/mkntfs.8.in | 6 +++--- ntfsprogs/ntfscat.8.in | 2 +- ntfsprogs/ntfsclone.8.in | 2 +- ntfsprogs/ntfscluster.8.in | 2 +- ntfsprogs/ntfsls.8.in | 6 +++--- ntfsprogs/ntfsundelete.8.in | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index e97d8ede..ed4630b9 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -218,12 +218,12 @@ There may be other bugs. Please, report them to the author. This version of .B mkntfs has been written by Anton Altaparmakov (if that fails, use -). +). .SH AVAILABILITY .B mkntfs is part of the Linux-NTFS project and is available for download from -http://sf.net/project/showfiles.php?group_id=13956 in source (tar ball and -rpm) and pre-compiled binary (i386 rpm and deb) form. +http://sourceforge.net/project/showfiles.php?group_id=13956 in source (tar ball +and rpm) and pre-compiled binary (i386 rpm and deb) form. .SH SEE ALSO .BR badblocks (8), .BR ntfsprogs (8) diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in index 2d8896f5..021ef100 100644 --- a/ntfsprogs/ntfscat.8.in +++ b/ntfsprogs/ntfscat.8.in @@ -84,7 +84,7 @@ Display the contents of a file in a subdirectory of an NTFS volume. was written in a short time, to get something "out there". It needs a lot more work. If you find any bugs, please send an email to .nh - + .hy .SH AUTHOR .B ntfscat diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index d77afc01..1618eae4 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -246,7 +246,7 @@ Pack NTFS metadata for NTFS experts .SH BUGS This program has no known bugs. If you find one, please send an email to .nh -. +. Sometimes it might appear ntfsclone froze if the clone is on ReiserFS and even CTRL-C won't stop it. This is not a bug in ntfsclone, however diff --git a/ntfsprogs/ntfscluster.8.in b/ntfsprogs/ntfscluster.8.in index 2dbd91a7..e1572c61 100644 --- a/ntfsprogs/ntfscluster.8.in +++ b/ntfsprogs/ntfscluster.8.in @@ -124,7 +124,7 @@ The mode isn't implemented yet. This program is quite limited, but it has no known bugs. If you find one, please send an email to .nh - + .hy .SH AUTHOR .B ntfscluster diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index 3b9e93da..33874d87 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -140,7 +140,7 @@ or options. .SH BUGS We are not aware of any bugs. If you find a bug, please report it to -. Thank you. +. Thank you. .SH AUTHOR This version of .B ntfsls @@ -150,8 +150,8 @@ Anton Altaparmakov. .SH AVAILABILITY .B ntfsls is part of the Linux-NTFS project and is available for download from -http://sf.net/project/showfiles.php?group_id=13956 in source (tar ball and -rpm) and pre-compiled binary (i386 rpm and deb) form. +http://sourceforge.net/project/showfiles.php?group_id=13956 in source (tar ball +and rpm) and pre-compiled binary (i386 rpm and deb) form. .SH SEE ALSO .BR ntfsprogs (8) diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index bb08b8fb..aaffc47d 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -337,7 +337,7 @@ Save MFT Records 3689 to 3690 to a file 'debug' There are some small limitations to this program, but currently no known bugs. If you find one, please send an email to .nh - + .hy .SH AUTHOR .B ntfsundelete From 0cef8dcd86e54f0f1d31e20a05e696f485911cd4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 13 Nov 2003 14:51:43 +0000 Subject: [PATCH 0848/2994] Make ntfscat show all messages to stderr so output (on stdout) isn't corrupted. (Szaka) (Logical change 1.234) --- ntfsprogs/ntfscat.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 13be2e24..c58edbd6 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -41,8 +41,9 @@ static const char *EXEC_NAME = "ntfscat"; static struct options opts; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) +GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) +GEN_PRINTF (Printf, stderr, NULL, FALSE) /** * version - Print version information about the program @@ -53,10 +54,10 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) */ void version (void) { - printf ("\n%s v%s - Concatenate files and print on the standard output.\n\n", + Printf ("\n%s v%s - Concatenate files and print on the standard output.\n\n", EXEC_NAME, VERSION); - printf ("Copyright (c) 2003 Richard Russon\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + Printf ("Copyright (c) 2003 Richard Russon\n"); + Printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -68,7 +69,7 @@ void version (void) */ void usage (void) { - printf ("\nUsage: %s [options] device file\n" + Printf ("\nUsage: %s [options] device file\n" " -f --force Use less caution\n" " -h --help Print this help\n" " -q --quiet Less output\n" @@ -80,7 +81,7 @@ void usage (void) //" -N --name Display this attribute name", //" -r --raw Display the compressed or encrypted file", EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); + Printf ("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -231,13 +232,13 @@ int main (int argc, char *argv[]) vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); if (!vol) { - printf ("!vol\n"); + Printf ("!vol\n"); return 1; } inode = utils_pathname_to_inode (vol, NULL, opts.file); if (!inode) { - printf ("!inode\n"); + Printf ("!inode\n"); return 1; } @@ -246,9 +247,9 @@ int main (int argc, char *argv[]) ntfs_inode_close (inode); ntfs_umount (vol, FALSE); if (result) - ;//printf ("failed\n"); + ;//Printf ("failed\n"); else - ;//printf ("success\n"); + ;//Printf ("success\n"); return result; } From 7a3e8fdeb56f42cbd52799fdb9773a6beb50a11b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 13 Nov 2003 14:51:43 +0000 Subject: [PATCH 0849/2994] Make ntfscat show all messages to stderr so output (on stdout) isn't corrupted. (Szaka) BKrev: 3fb39a7fieCny0qVgdFuAs457LgbTw From 0803017bb6b9aa437fcbfc0d4ec5ebdf3de890b4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 18 Nov 2003 18:00:31 +0000 Subject: [PATCH 0850/2994] Fix warnings. (Logical change 1.235) --- ntfsprogs/mkntfs.c | 29 +++++++++++++++-------------- ntfsprogs/ntfscluster.c | 4 ++-- ntfsprogs/ntfslabel.c | 2 +- ntfsprogs/upcase.c | 2 +- ntfsprogs/utils.c | 7 ++++--- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 049b0e5f..d94f4eb2 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -694,7 +694,7 @@ void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) default: i = le32_to_cpu(type); printf("Cannot display unknown %s defined attribute type 0x%x" - ".\n", i >= + ".\n", (u32)i >= le32_to_cpu(AT_FIRST_USER_DEFINED_ATTRIBUTE) ? "user" : "system", i); } @@ -809,7 +809,7 @@ void dump_attr_record(ATTR_RECORD *a) if (a->name_length) { if (ucstos(s, (uchar_t*)((char*)a + cpu_to_le16(a->name_offset)), - min(sizeof(s), a->name_length + 1)) == -1) { + min(sizeof(s), a->name_length + 1U)) == -1) { Eprintf("Could not convert Unicode string to single " "byte string in current locale.\n"); strncpy(s, "Error converting Unicode string", @@ -1067,7 +1067,7 @@ runlist *allocate_scattered_clusters(s64 clusters) * Reallocate memory if necessary. Make sure we have * enough for the terminator entry as well. */ - if ((rlpos + 2) * sizeof(runlist) >= rlsize) { + if ((rlpos + 2) * (int)sizeof(runlist) >= rlsize) { rlsize += 4096; /* PAGE_SIZE */ rlt = realloc(rl, rlsize); if (!rlt) @@ -1905,7 +1905,7 @@ int add_attr_index_root(MFT_RECORD *m, const char *name, const u32 name_len, free(r); return -EINVAL; } - if (index_block_size < opts.sector_size) { + if (index_block_size < (u32)opts.sector_size) { Eprintf("add_attr_index_root: index block size is " "smaller than the sector size.\n"); free(r); @@ -2445,7 +2445,7 @@ int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, /** * init_options */ -void init_options() +void init_options(void) { memset(&opts, 0, sizeof(opts)); opts.index_block_size = 4096; @@ -2679,13 +2679,13 @@ int main(int argc, char **argv) else vol->cluster_size = 4096; /* For small volumes on devices with large sector sizes. */ - if (vol->cluster_size < opts.sector_size) + if (vol->cluster_size < (u32)opts.sector_size) vol->cluster_size = opts.sector_size; } /* Validate cluster size. */ if (vol->cluster_size & (vol->cluster_size - 1) || - vol->cluster_size < opts.sector_size || - vol->cluster_size > 128 * opts.sector_size || + vol->cluster_size < (u32)opts.sector_size || + vol->cluster_size > 128 * (u32)opts.sector_size || vol->cluster_size > 65536) err_exit("Error: cluster_size is invalid. It must be a power " "of two, be at least\nthe same as sector_size, be " @@ -2967,7 +2967,7 @@ int main(int argc, char **argv) fflush(stdout); } bw = mkntfs_write(vol->dev, buf, vol->cluster_size); - if (bw != vol->cluster_size) { + if (bw != (ssize_t)vol->cluster_size) { if (bw != -1 || errno != EIO) err_exit("This should not happen.\n"); if (!position) @@ -2996,12 +2996,12 @@ int main(int argc, char **argv) Qprintf("\b\b\b\b100%%"); position = (opts.volume_size & (vol->cluster_size - 1)) / opts.sector_size; - for (i = 0; i < position; i++) { + for (i = 0; (unsigned long)i < position; i++) { bw = mkntfs_write(vol->dev, buf, opts.sector_size); if (bw != opts.sector_size) { if (bw != -1 || errno != EIO) err_exit("This should not happen.\n"); - else if (i + 1 == position && + else if (i + 1UL == position && (vol->major_ver >= 2 || (vol->major_ver == 1 && vol->minor_ver >= 2))) @@ -3264,7 +3264,8 @@ int main(int argc, char **argv) vol->cluster_size; else { bs->clusters_per_mft_record = -(ffs(vol->mft_record_size) - 1); - if ((1 << -bs->clusters_per_mft_record) != vol->mft_record_size) + if ((u32)(1 << -bs->clusters_per_mft_record) != + vol->mft_record_size) err_exit("BUG: calculated clusters_per_mft_record " "is wrong (= 0x%x)\n", bs->clusters_per_mft_record); @@ -3272,7 +3273,7 @@ int main(int argc, char **argv) Dprintf("Clusters per mft record = %i (0x%x)\n", bs->clusters_per_mft_record, bs->clusters_per_mft_record); - if (opts.index_block_size >= vol->cluster_size) + if (opts.index_block_size >= (int)vol->cluster_size) bs->clusters_per_index_record = opts.index_block_size / vol->cluster_size; else { @@ -3491,7 +3492,7 @@ bb_err: Vprintf("Syncing $MFT.\n"); pos = opts.mft_lcn * vol->cluster_size; lw = 1; - for (i = 0; i < opts.mft_size / vol->mft_record_size; i++) { + for (i = 0; i < opts.mft_size / (s32)vol->mft_record_size; i++) { if (!opts.no_action) lw = ntfs_mst_pwrite(vol->dev, pos, 1, vol->mft_record_size, diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 0af3237a..95645025 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -350,7 +350,7 @@ int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) return 1; } - for (i = s_begin; i < s_end; i++) { + for (i = s_begin; (LCN)i < s_end; i++) { if (utils_cluster_in_use (vol, i) == 1) { in_use = 1; break; @@ -368,7 +368,7 @@ int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) // first, is the cluster in use in $Bitmap? - for (i = 0; i < vol->nr_mft_records; i++) { + for (i = 0; (s64)i < vol->nr_mft_records; i++) { ntfs_inode *inode; ntfs_attr_search_ctx *ctx; diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 7da52ff1..1263f116 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -220,7 +220,7 @@ int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + new_alen; /* Check for sufficient space. */ - if (new_muse > le32_to_cpu(m->bytes_allocated)) { + if ((u32)new_muse > le32_to_cpu(m->bytes_allocated)) { errno = ENOSPC; return -1; } diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c index 45ef8eea..7d57dc7d 100644 --- a/ntfsprogs/upcase.c +++ b/ntfsprogs/upcase.c @@ -71,7 +71,7 @@ void init_upcase_table(uchar_t *uc, u32 uc_len) memset((char*)uc, 0, uc_len); uc_len >>= 1; - for (i = 0; i < uc_len; i++) + for (i = 0; (u32)i < uc_len; i++) uc[i] = i; for (r = 0; uc_run_table[r][0]; r++) for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 22a4e26a..7ee3addd 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -675,7 +675,8 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref) } /* Does mref lie in the section of $Bitmap we already have cached? */ - if ((mref < bmpmref) || (mref >= (bmpmref + (sizeof (buffer) << 3)))) { + if (((s64)MREF(mref) < bmpmref) || ((s64)MREF(mref) >= (bmpmref + + (sizeof (buffer) << 3)))) { Dprintf ("Bit lies outside cache.\n"); /* Mark the buffer as not in use, in case the read is shorter. */ @@ -760,7 +761,7 @@ ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, cons } inum = ntfs_inode_lookup_by_name (ni, unicode, len); - if (inum == -1) { + if (inum == (u64)-1) { Eprintf ("Couldn't find name '%s' in pathname '%s'.\n", p, pathname); goto close; } @@ -912,7 +913,7 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->inode = NULL; } - for (ctx->mft_num++; ctx->mft_num < ctx->vol->nr_mft_records; ctx->mft_num++) { + for (ctx->mft_num++; (s64)ctx->mft_num < ctx->vol->nr_mft_records; ctx->mft_num++) { ctx->flags_match = 0; int in_use = utils_mftrec_in_use (ctx->vol, (MFT_REF) ctx->mft_num); if (in_use == -1) { From fb04ff38936f7c8e46452dbef6d713810446de51 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 18 Nov 2003 18:00:31 +0000 Subject: [PATCH 0851/2994] Fix warnings. BKrev: 3fba5e3fGesOj6Diq9IZT-Epy0l3Xw From 4e2220d01878b41428181cb97e6bb6701381296b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 18 Nov 2003 18:19:10 +0000 Subject: [PATCH 0852/2994] Add -fms-extensions to libntfs_gnomevfs compilation, too. (Logical change 1.236) --- libntfs/Makefile.am | 2 +- libntfs/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 44c53233..4092bb68 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -77,7 +77,7 @@ endif libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS_GNOMEVFS) libntfs_gnomevfs_la_LIBADD = libntfs.la libntfs_gnomevfs_la_LIBS = $(LIBNTFS_GNOMEVFS_LIBS) -libntfs_gnomevfs_la_CFLAGS = $(LIBNTFS_GNOMEVFS_CFLAGS) +libntfs_gnomevfs_la_CFLAGS = $(LIBNTFS_GNOMEVFS_CFLAGS) $(GCCflag) libntfs_gnomevfs_la_SOURCES = \ gnome-vfs-method.c \ gnome-vfs-module.c diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 38d42da1..fef108ac 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -165,7 +165,7 @@ libntfs_la_SOURCES = \ libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS_GNOMEVFS) libntfs_gnomevfs_la_LIBADD = libntfs.la libntfs_gnomevfs_la_LIBS = $(LIBNTFS_GNOMEVFS_LIBS) -libntfs_gnomevfs_la_CFLAGS = $(LIBNTFS_GNOMEVFS_CFLAGS) +libntfs_gnomevfs_la_CFLAGS = $(LIBNTFS_GNOMEVFS_CFLAGS) $(GCCflag) libntfs_gnomevfs_la_SOURCES = \ gnome-vfs-method.c \ gnome-vfs-module.c From 88a9b54dc4f0c2b87c0d6acb3fe01dd49030a867 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 18 Nov 2003 18:19:10 +0000 Subject: [PATCH 0853/2994] Add -fms-extensions to libntfs_gnomevfs compilation, too. BKrev: 3fba629eJhZiBUNdnkRuzyb18GVNIQ From f2b687549b56ead12c5875260bfcc7a1364dd6e7 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 18 Nov 2003 21:17:57 +0000 Subject: [PATCH 0854/2994] force the constant to the 64 bit (Logical change 1.237) --- libntfs/bootsect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index 25cc77c1..c386e464 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -73,7 +73,7 @@ BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent) /* Check OEMidentifier is "NTFS " */ if (!silent) fprintf(stderr, "Checking OEMid... "); - if (b->oem_id != cpu_to_le64(0x202020205346544e)) /* "NTFS " */ + if (b->oem_id != cpu_to_le64(0x202020205346544eULL)) /* "NTFS " */ goto not_ntfs; if (!silent) fprintf(stderr, "OK\n"); From d6f2ca4a621e0044ac83b268426c4aa84c1ac404 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 18 Nov 2003 21:17:57 +0000 Subject: [PATCH 0855/2994] remove a non-portable compilation dependency BKrev: 3fba8c85yj5qeUjnJlEcIVUczJgx2g From 05af63dc9bf09869935538f38024f01a303c53fa Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 18 Nov 2003 21:17:57 +0000 Subject: [PATCH 0856/2994] remove the dependency on in favour of and (Logical change 1.237) --- include/endians.h | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/include/endians.h b/include/endians.h index 30eaee76..6f7f271f 100644 --- a/include/endians.h +++ b/include/endians.h @@ -30,13 +30,13 @@ * defaults don't necessarily perform appropriate typecasts. * Also, using our own functions means that we can change them if it * turns out that we do need to use the unaligned access macros on - * architectures requirering aligned memory accesses... + * architectures requiring aligned memory accesses... */ -#include +#include +#include -/* The following are not defined on Cygwin... Luckily Cygwin is LE already. */ -#ifdef __CYGWIN32__ +#if (__BYTE_ORDER == __LITTLE_ENDIAN) #define __le16_to_cpu(x) (x) #define __le32_to_cpu(x) (x) @@ -54,8 +54,29 @@ #define __constant_cpu_to_le32(x) (x) #define __constant_cpu_to_le64(x) (x) -#endif /* __CYGWIN32__ */ +#elif (__BYTE_ORDER == __BIG_ENDIAN) +#define __le16_to_cpu(x) bswap_16(x) +#define __le32_to_cpu(x) bswap_32(x) +#define __le64_to_cpu(x) bswap_64(x) + +#define __cpu_to_le16(x) bswap_16(x) +#define __cpu_to_le32(x) bswap_32(x) +#define __cpu_to_le64(x) bswap_64(x) + +#define __constant_le16_to_cpu(x) __bswap_constant_16(x) +#define __constant_le32_to_cpu(x) __bswap_constant_32(x) +#define __constant_le64_to_cpu(x) __bswap_constant_64(x) + +#define __constant_cpu_to_le16(x) __bswap_constant_16(x) +#define __constant_cpu_to_le32(x) __bswap_constant_32(x) +#define __constant_cpu_to_le64(x) __bswap_constant_64(x) + +#else + +#error "You must define __BYTE_ORDER to be __LITTLE_ENDIAN or __BIG_ENDIAN" + +#endif /* Unsigned from LE to CPU conversion. */ From dde45c851e65230a624f905bd4bf5fde95b9b581 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 19 Nov 2003 00:05:30 +0000 Subject: [PATCH 0857/2994] clear up a few build warnings - sign problems, function declarations BKrev: 3fbab3ca0yZa5kiSgnSQ76p6YRVKyQ From fafd832996b1f7e04f27fd141581a105bf0da1b6 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 19 Nov 2003 00:05:30 +0000 Subject: [PATCH 0858/2994] clear up a few minor build warnings (Logical change 1.238) --- ntfsprogs/ntfsclone.c | 17 +++++++++-------- ntfsprogs/ntfsresize.c | 24 ++++++++++++------------ ntfsprogs/ntfswipe.c | 14 +++++++------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 8e315383..6b5e7349 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -69,7 +69,7 @@ struct progress_bar { struct __ntfs_walk_clusters_ctx { ntfs_inode *ni; /* inode being processed */ ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ - u64 inuse; /* number of clusters in use */ + s64 inuse; /* number of clusters in use */ }; typedef struct __ntfs_walk_clusters_ctx ntfs_walk_clusters_ctx; @@ -167,7 +167,7 @@ int perr_exit(const char *fmt, ...) } -void usage() +void usage(void) { Eprintf("\nUsage: %s [options] device\n" " Efficiently clone NTFS to a sparse file, device or standard output.\n" @@ -370,7 +370,7 @@ int io_all(void *fd, void *buf, int count, int do_write) } -void copy_cluster() +void copy_cluster(void) { char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ @@ -440,7 +440,7 @@ void clone_ntfs(u64 nr_clusters) return; for (i = 0; i < count; i++, pos++) { - u64 cl; /* current cluster */ + s64 cl; /* current cluster */ for (cl = pos * 8; cl < (pos + 1) * 8; cl++) { @@ -495,7 +495,8 @@ void wipe_timestamps(ntfs_walk_clusters_ctx *image) void wipe_resident_data(ntfs_walk_clusters_ctx *image) { ATTR_RECORD *a; - int i, n = 0; + u32 i; + int n = 0; char *p; a = image->ctx->attr; @@ -612,7 +613,7 @@ void compare_bitmaps(struct bitmap *a) } for (i = 0; i < count; i++, pos++) { - u64 cl; /* current cluster */ + s64 cl; /* current cluster */ if (a->bm[pos] == bm[i]) continue; @@ -787,7 +788,7 @@ void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) * All the bits are set to 0, except those representing the region beyond the * end of the disk. */ -void setup_lcn_bitmap() +void setup_lcn_bitmap(void) { /* Determine lcn bitmap byte size and allocate it. */ lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); @@ -1010,7 +1011,7 @@ int main(int argc, char **argv) /* FIXME: save backup boot sector */ if (opt.stdout || !opt.metadata_only) { - u64 nr_clusters = opt.stdout ? vol->nr_clusters : image.inuse; + s64 nr_clusters = opt.stdout ? vol->nr_clusters : image.inuse; clone_ntfs(nr_clusters); Printf("Syncing ...\n"); diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 1c1b5dc4..c66fd607 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -194,7 +194,7 @@ int perr_exit(const char *fmt, ...) * * Return: none */ -void usage() +void usage(void) { printf ("\nUsage: %s [options] device\n" @@ -694,7 +694,7 @@ void compare_bitmaps(struct bitmap *a) } for (i = 0; i < count; i++, pos++) { - u64 cl; /* current cluster */ + s64 cl; /* current cluster */ if (a->bm[pos] == bm[i]) continue; @@ -930,8 +930,8 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl_bad)) == -1) perr_exit("ntfs_get_size_for_mapping_pairs"); - if (mp_size > le32_to_cpu (a->length) - - le16_to_cpu (a->mapping_pairs_offset)) + if (mp_size > (int)(le32_to_cpu (a->length) - + le16_to_cpu (a->mapping_pairs_offset))) err_exit("Enlarging attribute header isn't supported yet.\n"); if (!(mp = (char *)calloc(1, mp_size))) @@ -959,7 +959,7 @@ void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) { runlist *rl = *rlist; int i, j; - u64 k; + s64 k; int trunc_at = -1; /* FIXME: -1 means unset */ /* Unallocate truncated clusters in $Bitmap */ @@ -974,11 +974,11 @@ void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) if (rl[i].vcn + j < nr_bm_clusters) continue; - k = (u64)rl[i].lcn + j; + k = rl[i].lcn + j; if (k < new_size) { ntfs_bit_set(lcn_bitmap.bm, k, 0); Dprintf("Unallocate cluster: " - "%llu (%llx)\n", k, k); + "%lld (%llx)\n", k, k); } } } @@ -1076,8 +1076,8 @@ void truncate_bitmap_data_attr(ntfs_resize_t *resize) if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl)) == -1) perr_exit("ntfs_get_size_for_mapping_pairs"); - if (mp_size > le32_to_cpu (a->length) - - le16_to_cpu (a->mapping_pairs_offset)) + if (mp_size > (int)(le32_to_cpu (a->length) - + le16_to_cpu (a->mapping_pairs_offset))) err_exit("Enlarging attribute header isn't supported yet.\n"); if (!(mp = (char *)calloc(1, mp_size))) @@ -1204,7 +1204,7 @@ void truncate_bitmap_file(ntfs_resize_t *resize) * All the bits are set to 0, except those representing the region beyond the * end of the disk. */ -void setup_lcn_bitmap() +void setup_lcn_bitmap(void) { /* Determine lcn bitmap byte size and allocate it. */ lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); @@ -1294,7 +1294,7 @@ void print_disk_usage(ntfs_resize_t *resize) * is dirty (Windows wasn't shutdown properly). If everything is OK, then mount * the volume (load the metadata into memory). */ -void mount_volume() +void mount_volume(void) { unsigned long mntflag; @@ -1348,7 +1348,7 @@ void mount_volume() * boots it will automatically run chkdsk to check for any problems. If the * read-only command line option was given, this function will do nothing. */ -void prepare_volume_fixup() +void prepare_volume_fixup(void) { u16 flags; diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 7925a481..7772ade4 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -640,11 +640,11 @@ int ntfs_info (ntfs_volume *vol) //Qprintf ("initialized_size = %lld\n", vol->lcnbmp_na->initialized_size); { - u64 offset; - u64 size = vol->lcnbmp_na->allocated_size; + s64 offset; + s64 size = vol->lcnbmp_na->allocated_size; int bufsize = vol->mft_record_size; - u64 use = 0; - u64 not = 0; + s64 use = 0; + s64 not = 0; int i, j; for (offset = 0; offset < size; offset += bufsize) { @@ -680,11 +680,11 @@ done: { u8 *bitmap; - u64 bmpoff; - u64 bmpsize = vol->mftbmp_na->data_size; + s64 bmpoff; + s64 bmpsize = vol->mftbmp_na->data_size; int bmpbufsize = 512; int i, j; - u64 use = 0, not = 0; + s64 use = 0, not = 0; bitmap = malloc (bmpbufsize); if (!bitmap) From e92992ed63e249cd1d9d5d28e4f9a98185bc00bd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 19 Nov 2003 10:31:21 +0000 Subject: [PATCH 0859/2994] Cleanup build system with respect to CFLAGS so they are consistent throughout and the right flags get added for the right things and move all of this in one place in configure.ac removing everything from the Makefile.am files. (Logical change 1.239) --- configure | 116 +++++++++++++++++------------------------- configure.ac | 54 ++++++++++++-------- include/Makefile.am | 7 --- include/Makefile.in | 4 -- libntfs/Makefile.am | 16 +----- ntfsprogs/Makefile.am | 14 ----- ntfsprogs/Makefile.in | 9 ---- 7 files changed, 80 insertions(+), 140 deletions(-) diff --git a/configure b/configure index 8c0d10f3..3c66b08b 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.0beta2. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.0. # # Report bugs to . # @@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.0beta2' -PACKAGE_STRING='ntfsprogs 1.8.0beta2' +PACKAGE_VERSION='1.8.0' +PACKAGE_STRING='ntfsprogs 1.8.0' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -470,7 +470,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT DEBUG_TRUE DEBUG_FALSE REALLYSTATIC_TRUE REALLYSTATIC_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE LN_S RANLIB ac_ct_RANLIB PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE ECHO CPP EGREP LIBTOOL LIBTOOL_DEPS all_includes all_libraries AUTODIRS GCC_NEEDS_MS_EXTENSIONS_TRUE GCC_NEEDS_MS_EXTENSIONS_FALSE LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT REALLYSTATIC_TRUE REALLYSTATIC_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE LN_S RANLIB ac_ct_RANLIB PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE ECHO CPP EGREP LIBTOOL LIBTOOL_DEPS all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -939,7 +939,7 @@ 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 ntfsprogs 1.8.0beta2 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1006,7 +1006,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.0beta2:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.0:";; esac cat <<\_ACEOF @@ -1106,7 +1106,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.0beta2 +ntfsprogs configure 1.8.0 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1121,7 +1121,7 @@ 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 ntfsprogs $as_me 1.8.0beta2, which was +It was created by ntfsprogs $as_me 1.8.0, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1800,7 +1800,7 @@ fi # Define the identity of the package. PACKAGE=ntfsprogs - VERSION=1.8.0beta2 + VERSION=1.8.0 cat >>confdefs.h <<_ACEOF @@ -2032,16 +2032,6 @@ fi; -if test "$enable_debug" = yes; then - DEBUG_TRUE= - DEBUG_FALSE='#' -else - DEBUG_TRUE='#' - DEBUG_FALSE= -fi - - - if test "$enable_really_static" = yes; then REALLYSTATIC_TRUE= REALLYSTATIC_FALSE='#' @@ -2051,11 +2041,6 @@ else fi -# Do not discard 'CFLAGS' as they may have been passed us by rpmbuild(8) -if test "$USE_MAINTAINER_MODE" = "yes";then - CFLAGS="$CFLAGS -ggdb3 -Wall -Wstrict-prototypes -Wsign-compare" ## FIXME: fix all source: -Wsign-compare -fi - # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3274,7 +3259,7 @@ else fi; compile_gnome_vfs=false -if test "$enable_gnome_vfs" != "no";then +if test "$enable_gnome_vfs" != "no"; then succeeded=no @@ -3369,7 +3354,7 @@ echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 compile_gnome_vfs=true else - if test "$enable_gnome_vfs" = "yes";then + if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&2;} { (exit 1); exit 1; }; } @@ -4995,7 +4980,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 4998 "configure"' > conftest.$ac_ext + echo '#line 4983 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5524,7 +5509,7 @@ chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" compiler_c_o=no -if { (eval echo configure:5527: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then +if { (eval echo configure:5512: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then @@ -6708,7 +6693,7 @@ linux-gnu*) libsuff= case "$host_cpu" in x86_64*|s390x*) - echo '#line 6711 "configure"' > conftest.$ac_ext + echo '#line 6696 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7380,7 +7365,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 echo "${ECHO_T}$cc_version" >&6 @@ -8268,17 +8243,36 @@ cc_version="$cc_version, ok" echo "$as_me:$LINENO: result: $cc_version" >&5 echo "${ECHO_T}$cc_version" >&6 -# Add -fms-extensions for gcc-3.2+. +# Add our compiler switches not discarding 'CFLAGS' as they may have been +# passed to us by rpmbuild(8). +# We add -Wall to enable compiler warnings and define _FILE_OFFSET_BITS to 64 +# enable 64-bit (device) file access functions and parameters. +CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -Wall" - -if test $cc_major -gt 3 -o \( $cc_major -eq 3 -a $cc_minor -ge 2 \); then - GCC_NEEDS_MS_EXTENSIONS_TRUE= - GCC_NEEDS_MS_EXTENSIONS_FALSE='#' -else - GCC_NEEDS_MS_EXTENSIONS_TRUE='#' - GCC_NEEDS_MS_EXTENSIONS_FALSE= +# Add extra warnings if in maintainer mode. +if test "$USE_MAINTAINER_MODE" = "yes";then + CFLAGS="$CFLAGS -Wstrict-prototypes -Wsign-compare" fi +# Add -fms-extensions for gcc-3.2+. +if test $cc_major -gt 3 -o \( $cc_major -eq 3 -a $cc_minor -ge 2 \); then + CFLAGS="$CFLAGS -fms-extensions" +fi + +# Add debugging switches if in debug mode. +if test "$enable_debug" = "yes"; then + CFLAGS="$CFLAGS -ggdb3 -DDEBUG" +fi + + + + + + + + + + # Checks for libraries. @@ -10863,13 +10857,6 @@ 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 "${DEBUG_TRUE}" && test -z "${DEBUG_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"DEBUG\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"DEBUG\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi if test -z "${REALLYSTATIC_TRUE}" && test -z "${REALLYSTATIC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"REALLYSTATIC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -10891,13 +10878,6 @@ echo "$as_me: error: conditional \"ENABLE_GNOME_VFS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi -if test -z "${GCC_NEEDS_MS_EXTENSIONS_TRUE}" && test -z "${GCC_NEEDS_MS_EXTENSIONS_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"GCC_NEEDS_MS_EXTENSIONS\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"GCC_NEEDS_MS_EXTENSIONS\" 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 @@ -11167,7 +11147,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.0beta2, which was +This file was extended by ntfsprogs $as_me 1.8.0, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11230,7 +11210,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.0beta2 +ntfsprogs config.status 1.8.0 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -11479,8 +11459,6 @@ s,@SET_MAKE@,$SET_MAKE,;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,@DEBUG_TRUE@,$DEBUG_TRUE,;t t -s,@DEBUG_FALSE@,$DEBUG_FALSE,;t t s,@REALLYSTATIC_TRUE@,$REALLYSTATIC_TRUE,;t t s,@REALLYSTATIC_FALSE@,$REALLYSTATIC_FALSE,;t t s,@CC@,$CC,;t t @@ -11513,8 +11491,6 @@ s,@LIBTOOL_DEPS@,$LIBTOOL_DEPS,;t t s,@all_includes@,$all_includes,;t t s,@all_libraries@,$all_libraries,;t t s,@AUTODIRS@,$AUTODIRS,;t t -s,@GCC_NEEDS_MS_EXTENSIONS_TRUE@,$GCC_NEEDS_MS_EXTENSIONS_TRUE,;t t -s,@GCC_NEEDS_MS_EXTENSIONS_FALSE@,$GCC_NEEDS_MS_EXTENSIONS_FALSE,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF diff --git a/configure.ac b/configure.ac index 3f5bb755..91dce96a 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.0beta2, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.0, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) @@ -58,14 +58,8 @@ AC_ARG_ENABLE(really-static, enable_really_static=no ) -AM_CONDITIONAL(DEBUG, test "$enable_debug" = yes) AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes) -# Do not discard 'CFLAGS' as they may have been passed us by rpmbuild(8) -if test "$USE_MAINTAINER_MODE" = "yes";then - CFLAGS="$CFLAGS -ggdb3 -Wall -Wstrict-prototypes -Wsign-compare" ## FIXME: fix all source: -Wsign-compare -fi - # Checks for programs. AC_PROG_CC AC_PROG_INSTALL @@ -78,11 +72,11 @@ AC_ARG_ENABLE(gnome-vfs, enable_gnome_vfs=auto ) compile_gnome_vfs=false -if test "$enable_gnome_vfs" != "no";then +if test "$enable_gnome_vfs" != "no"; then PKG_CHECK_MODULES(LIBNTFS_GNOMEVFS, [glib-2.0 gthread-2.0 gnome-vfs-module-2.0], [ compile_gnome_vfs=true ], [ - if test "$enable_gnome_vfs" = "yes";then + if test "$enable_gnome_vfs" = "yes"; then AC_MSG_ERROR([Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares.]) else AC_MSG_WARN([Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares.]) @@ -109,16 +103,6 @@ all_includes="$all_includes $USER_INCLUDES" AC_SUBST(all_includes) AC_SUBST(all_libraries) -AC_SUBST(CFLAGS) -AC_SUBST(CPPFLAGS) -AC_SUBST(LDFLAGS) -AC_SUBST(LIBS) - -AC_SUBST(LIBNTFS_GNOMEVFS_CFLAGS) -AC_SUBST(LIBNTFS_GNOMEVFS_LIBS) - -AC_SUBST(AUTODIRS) - # Get compiler name if test ! -z "$CC"; then _cc="$CC" @@ -136,7 +120,7 @@ if test -z "$cc_version"; then cc_major=1 cc_minor=1 fi -if test $cc_major -lt 2 -o \( $cc_major -eq 2 -a $cc_minor -lt 96 \) ; then +if test $cc_major -lt 2 -o \( $cc_major -eq 2 -a $cc_minor -lt 96 \); then cc_version="$cc_version, bad" AC_MSG_RESULT($cc_version) AC_MSG_ERROR(Please upgrade your gcc compiler to gcc-2.96+ or gcc-3+ version!\ @@ -146,8 +130,36 @@ fi cc_version="$cc_version, ok" AC_MSG_RESULT($cc_version) +# Add our compiler switches not discarding 'CFLAGS' as they may have been +# passed to us by rpmbuild(8). +# We add -Wall to enable compiler warnings and define _FILE_OFFSET_BITS to 64 +# enable 64-bit (device) file access functions and parameters. +CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -Wall" + +# Add extra warnings if in maintainer mode. +if test "$USE_MAINTAINER_MODE" = "yes";then + CFLAGS="$CFLAGS -Wstrict-prototypes -Wsign-compare" +fi + # Add -fms-extensions for gcc-3.2+. -AM_CONDITIONAL(GCC_NEEDS_MS_EXTENSIONS, test $cc_major -gt 3 -o \( $cc_major -eq 3 -a $cc_minor -ge 2 \)) +if test $cc_major -gt 3 -o \( $cc_major -eq 3 -a $cc_minor -ge 2 \); then + CFLAGS="$CFLAGS -fms-extensions" +fi + +# Add debugging switches if in debug mode. +if test "$enable_debug" = "yes"; then + CFLAGS="$CFLAGS -ggdb3 -DDEBUG" +fi + +AC_SUBST(CFLAGS) +AC_SUBST(CPPFLAGS) +AC_SUBST(LDFLAGS) +AC_SUBST(LIBS) + +AC_SUBST(LIBNTFS_GNOMEVFS_CFLAGS) +AC_SUBST(LIBNTFS_GNOMEVFS_LIBS) + +AC_SUBST(AUTODIRS) # Checks for libraries. diff --git a/include/Makefile.am b/include/Makefile.am index ef64a6df..605f50cc 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,11 +1,4 @@ -# Need this to enable 64-bit (device) file access functions and parameters. -if DEBUG -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -else -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -endif - linux_ntfsincludedir = $(includedir)/ntfs linux_ntfsinclude_HEADERS = \ attrib.h \ diff --git a/include/Makefile.in b/include/Makefile.in index a0124660..0210d43e 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -96,10 +96,6 @@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ -# Need this to enable 64-bit (device) file access functions and parameters. -@DEBUG_TRUE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -g -DDEBUG -@DEBUG_FALSE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 - linux_ntfsincludedir = $(includedir)/ntfs linux_ntfsinclude_HEADERS = \ attrib.h \ diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 4092bb68..eb1a43ea 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -29,20 +29,6 @@ LTVERSION_LIBNTFS = 5:0:0 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 -# Later gcc require -fms-extensions to work. -if GCC_NEEDS_MS_EXTENSIONS -GCCflag = -fms-extensions -else -GCCflag = -endif - -# Need this to enable 64-bit (device) file access functions and parameters. -if DEBUG -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG $(GCCflag) -else -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall $(GCCflag) -endif - linux_ntfsincludedir = -I$(top_srcdir)/include lib_LTLIBRARIES = libntfs.la @@ -77,7 +63,7 @@ endif libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS_GNOMEVFS) libntfs_gnomevfs_la_LIBADD = libntfs.la libntfs_gnomevfs_la_LIBS = $(LIBNTFS_GNOMEVFS_LIBS) -libntfs_gnomevfs_la_CFLAGS = $(LIBNTFS_GNOMEVFS_CFLAGS) $(GCCflag) +libntfs_gnomevfs_la_CFLAGS = $(LIBNTFS_GNOMEVFS_CFLAGS) libntfs_gnomevfs_la_SOURCES = \ gnome-vfs-method.c \ gnome-vfs-module.c diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 11eb2a0b..e9c6cea5 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -1,17 +1,3 @@ -# Later gcc require -fms-extensions to work. -if GCC_NEEDS_MS_EXTENSIONS -GCCflag = -fms-extensions -else -GCCflag = -endif - -# Need this to enable 64-bit (device) file access functions and parameters. -if DEBUG -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG $(GCCflag) -else -AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall $(GCCflag) -endif - if REALLYSTATIC AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a AM_LFLAGS = -static diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index dc328d15..8159d038 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -95,15 +95,6 @@ all_libraries = @all_libraries@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ - -# Later gcc require -fms-extensions to work. -@GCC_NEEDS_MS_EXTENSIONS_TRUE@GCCflag = -fms-extensions -@GCC_NEEDS_MS_EXTENSIONS_FALSE@GCCflag = - -# Need this to enable 64-bit (device) file access functions and parameters. -@DEBUG_TRUE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG $(GCCflag) -@DEBUG_FALSE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall $(GCCflag) - @REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LFLAGS = -static From a3531f9fbe7989c9eb7b20d7849877681ae94078 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 19 Nov 2003 10:31:21 +0000 Subject: [PATCH 0860/2994] Cleanup build system with respect to CFLAGS so they are consistent throughout and the right flags get added for the right things and move all of this in one place in configure.ac removing everything from the Makefile.am files. BKrev: 3fbb4679qk81uhUM7ZUm-PiyWQ607w From 93fcefa1decbb7b5717fd53fb54bbf8a7efee27f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 19 Nov 2003 10:36:38 +0000 Subject: [PATCH 0861/2994] Update changelog for 1.8.0 release. (Logical change 1.240) --- ChangeLog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 36624109..6112d953 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +19/11/2003 - 1.8.0 - Final fixes and tidy ups. + - Cleanup build system wrt CFLAGS handling placing it all in one place + in configure.ac and removing everything related from the Makefile.am + files. + - Fix all compiler warnings (Richard Russon, me) + - Make libntfs more portable by removing the dependency on + asm/byteorder.h and using and instead. Also + adapting our endians.h appropriately. (Richard Russon) + - Various other small cleanups and fixes. + 10/11/2003 - 1.8.0beta2 - More features! - Merge ntfsprogs-gnomevfs written by Jan Kratochvil. From 12971872b49432bd4c98957c03461b59bd0821f3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 19 Nov 2003 10:36:38 +0000 Subject: [PATCH 0862/2994] Update changelog for 1.8.0 release. BKrev: 3fbb47b6xXnnoTS9akyKU38AXDGbfA From 33918ceae98c066dee029b0e9e3991c15efa625b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 19 Nov 2003 12:16:02 +0000 Subject: [PATCH 0863/2994] Fix nasty buffer overflow bug in ntfs_get_attribute_value() which we use to get the attribute list attribute. This is the same bug that was biting us in the ntfs driver 2.1.4 and was fixed in 2.1.5. Windows XP creates files where an attribute's data size is more than one run list run shorter than the allocated size which causes us to crash out as we assumed this would never happen. (Logical change 1.241) --- ChangeLog | 6 + libntfs/attrib.c | 279 ++++++++++++++++++++++++----------------------- 2 files changed, 147 insertions(+), 138 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6112d953..0c92dca7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,12 @@ - Make libntfs more portable by removing the dependency on asm/byteorder.h and using and instead. Also adapting our endians.h appropriately. (Richard Russon) + - Fix nasty buffer overflow bug in ntfs_get_attribute_value() which we + use to get the attribute list attribute. This is the same bug that + was biting us in the ntfs driver 2.1.4 and was fixed in 2.1.5. + Windows XP creates files where an attribute's data size is more than + one run list run shorter than the allocated size which causes us to + crash out as we assumed this would never happen. - Various other small cleanups and fixes. 10/11/2003 - 1.8.0beta2 - More features! diff --git a/libntfs/attrib.c b/libntfs/attrib.c index d5a59730..f425f772 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -66,6 +66,10 @@ s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a) s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, const ATTR_RECORD *a, u8 *b) { + runlist *rl; + s64 total, r; + int i; + /* Sanity checks. */ if (!vol || !m || !a || !b) { errno = EINVAL; @@ -78,151 +82,150 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, errno = ENOTSUP; return 0; } - if (!a->non_resident) { /* Attribute is resident. */ + if (!a->non_resident) { + /* Attribute is resident. */ + /* Sanity check. */ - if (le32_to_cpu(a->value_length) + - le16_to_cpu(a->value_offset) > le32_to_cpu(a->length)) { + if (le32_to_cpu(a->value_length) + le16_to_cpu(a->value_offset) + > le32_to_cpu(a->length)) { return 0; } + memcpy(b, (char*)a + le16_to_cpu(a->value_offset), - le32_to_cpu(a->value_length)); + le32_to_cpu(a->value_length)); errno = 0; return (s64)le32_to_cpu(a->value_length); - } else { /* Attribute is not resident. */ - runlist *rl; - s64 total, r; - int i; - - /* If no data, return 0. */ - if (!(a->data_size)) { - errno = 0; - return 0; - } - /* - * FIXME: What about attribute lists?!? (AIA) - */ - /* Decompress the mapping pairs array into a runlist. */ - rl = ntfs_mapping_pairs_decompress(vol, a, NULL); - if (!rl) { - errno = EINVAL; - return 0; - } - /* - * FIXED: We were overflowing here in a nasty fashion when we - * reach the last cluster in the runlist as the buffer will - * only be big enough to hold data_size bytes while we are - * reading in allocated_size bytes which is usually larger - * than data_size, since the actual data is unlikely to have a - * size equal to a multiple of the cluster size! - */ - /* Now load all clusters in the runlist into b. */ - for (i = 0, total = 0; rl[i].length; i++) { - if (!rl[i+1].length) { - unsigned char *intbuf = NULL; - /* - * We have reached the last run so we were - * going to overflow when executing the - * ntfs_pread() which is BAAAAAAAD! - * Temporary fix: - * Allocate a new buffer with size: - * rl[i].length << vol->cluster_size_bits, - * do the read into our buffer, then - * memcpy the correct amount of data into - * the caller supplied buffer, free our - * buffer, and continue. - */ - intbuf = malloc(rl[i].length << - vol->cluster_size_bits); - if (!intbuf) { - int eo = errno; - perror("Couldn't allocate memory for " - "internal buffer.\n"); - free(rl); - errno = eo; - return 0; - } - /* - * FIXME: If compressed file: Only read if - * lcn != -1. Otherwise, we are dealing with a - * sparse run and we just memset the user buffer - * to 0 for the length of the run, which should - * be 16 (= compression unit size). - * FIXME: Really only when file is compressed, - * or can we have sparse runs in uncompressed - * files as well? - */ - r = ntfs_pread(vol->dev, rl[i].lcn << - vol->cluster_size_bits, - rl[i].length << - vol->cluster_size_bits, intbuf); - if (r != rl[i].length << - vol->cluster_size_bits) { -#define ESTR "Error reading attribute value" - if (r == -1) { - int eo = errno; - perror(ESTR); - errno = eo; - } else if (r < rl[i].length << - vol->cluster_size_bits - ) { - fprintf(stderr, ESTR ": Ran " - "out of input data.\n"); - errno = EIO; - } else { - fprintf(stderr, ESTR ": " - "unknown error\n"); - errno = EIO; - } -#undef ESTR - free(rl); - return 0; - } - memcpy(b + total, intbuf, - sle64_to_cpu(a->data_size) - total); - free(intbuf); - total = sle64_to_cpu(a->data_size); - } else { - /* - * FIXME: If compressed file: Only read if - * lcn != -1. Otherwise, we are dealing with a - * sparse run and we just memset the user buffer - * to 0 for the length of the run, which should - * be 16 (= compression unit size). - */ - r = ntfs_pread(vol->dev, rl[i].lcn << - vol->cluster_size_bits, - rl[i].length << - vol->cluster_size_bits, - b + total); - if (r != rl[i].length << - vol->cluster_size_bits) { -#define ESTR "Error reading attribute value" - if (r == -1) { - int eo = errno; - perror(ESTR); - errno = eo; - } else if (r < rl[i].length << - vol->cluster_size_bits - ) { - fprintf(stderr, ESTR ": Ran " - "out of input data.\n"); - errno = EIO; - } else { - fprintf(stderr, ESTR ": " - "unknown error\n"); - errno = EIO; - } -#undef ESTR - return 0; - } - total += r; - } - } - free(rl); - return total; } - errno = EINVAL; - return 0; + + /* Attribute is not resident. */ + + /* If no data, return 0. */ + if (!(a->data_size)) { + errno = 0; + return 0; + } + /* + * FIXME: What about attribute lists?!? (AIA) + */ + /* Decompress the mapping pairs array into a runlist. */ + rl = ntfs_mapping_pairs_decompress(vol, a, NULL); + if (!rl) { + errno = EINVAL; + return 0; + } + /* + * FIXED: We were overflowing here in a nasty fashion when we + * reach the last cluster in the runlist as the buffer will + * only be big enough to hold data_size bytes while we are + * reading in allocated_size bytes which is usually larger + * than data_size, since the actual data is unlikely to have a + * size equal to a multiple of the cluster size! + * FIXED2: We were also overflowing here in the same fashion + * when the data_size was more than one run smaller than the + * allocated size which happens with Windows XP sometimes. + */ + /* Now load all clusters in the runlist into b. */ + for (i = 0, total = 0; rl[i].length; i++) { + if (total + (rl[i].length << vol->cluster_size_bits) >= + sle64_to_cpu(a->data_size)) { + unsigned char *intbuf = NULL; + /* + * We have reached the last run so we were going to + * overflow when executing the ntfs_pread() which is + * BAAAAAAAD! + * Temporary fix: + * Allocate a new buffer with size: + * rl[i].length << vol->cluster_size_bits, do the + * read into our buffer, then memcpy the correct + * amount of data into the caller supplied buffer, + * free our buffer, and continue. + * We have reached the end of data size so we were + * going to overflow in the same fashion. + * Temporary fix: same as above. + */ + intbuf = malloc(rl[i].length << vol->cluster_size_bits); + if (!intbuf) { + int eo = errno; + perror("Couldn't allocate memory for internal " + "buffer.\n"); + free(rl); + errno = eo; + return 0; + } + /* + * FIXME: If compressed file: Only read if lcn != -1. + * Otherwise, we are dealing with a sparse run and we + * just memset the user buffer to 0 for the length of + * the run, which should be 16 (= compression unit + * size). + * FIXME: Really only when file is compressed, or can + * we have sparse runs in uncompressed files as well? + * - Yes we can, in sparse files! But not necessarily + * size of 16, just run length. + */ + r = ntfs_pread(vol->dev, rl[i].lcn << + vol->cluster_size_bits, rl[i].length << + vol->cluster_size_bits, intbuf); + if (r != rl[i].length << vol->cluster_size_bits) { +#define ESTR "Error reading attribute value" + if (r == -1) { + int eo = errno; + perror(ESTR); + errno = eo; + } else if (r < rl[i].length << + vol->cluster_size_bits) { + fprintf(stderr, ESTR ": Ran out of " + "input data.\n"); + errno = EIO; + } else { + fprintf(stderr, ESTR ": unknown " + "error\n"); + errno = EIO; + } +#undef ESTR + free(rl); + return 0; + } + memcpy(b + total, intbuf, sle64_to_cpu(a->data_size) - + total); + free(intbuf); + total = sle64_to_cpu(a->data_size); + break; + } + /* + * FIXME: If compressed file: Only read if lcn != -1. + * Otherwise, we are dealing with a sparse run and we just + * memset the user buffer to 0 for the length of the run, which + * should be 16 (= compression unit size). + * FIXME: Really only when file is compressed, or can + * we have sparse runs in uncompressed files as well? + * - Yes we can, in sparse files! But not necessarily size of + * 16, just run length. + */ + r = ntfs_pread(vol->dev, rl[i].lcn << vol->cluster_size_bits, + rl[i].length << vol->cluster_size_bits, + b + total); + if (r != rl[i].length << vol->cluster_size_bits) { +#define ESTR "Error reading attribute value" + if (r == -1) { + int eo = errno; + perror(ESTR); + errno = eo; + } else if (r < rl[i].length << vol->cluster_size_bits) { + fprintf(stderr, ESTR ": Ran out of input " + "data.\n"); + errno = EIO; + } else { + fprintf(stderr, ESTR ": unknown error\n"); + errno = EIO; + } +#undef ESTR + return 0; + } + total += r; + } + free(rl); + return total; } /* Already cleaned up code below, but still look for FIXME:... */ From 756aff8f501632a33a43c2ded3431509665283f3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 19 Nov 2003 12:16:02 +0000 Subject: [PATCH 0864/2994] Fix nasty buffer overflow bug in ntfs_get_attribute_value() which we use to get the attribute list attribute. This is the same bug that was biting us in the ntfs driver 2.1.4 and was fixed in 2.1.5. Windows XP creates files where an attribute's data size is more than one run list run shorter than the allocated size which causes us to crash out as we assumed this would never happen. BKrev: 3fbb5f02obDK9CzE6fg_L0KTjqWWww From 9789e0f7533fd4440f9d9d13f9e584df0c485c2f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 2 Dec 2003 17:16:21 +0000 Subject: [PATCH 0865/2994] Fix small error handling bug. BKrev: 3fccc8e5fcc3m9uE2oXIGA6vJ7hMNg From 09ec84d2052a921519daea9213e634ba5cd27987 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 2 Dec 2003 17:16:21 +0000 Subject: [PATCH 0866/2994] fix small error handling bug. (Logical change 1.242) --- libntfs/runlist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index cc17870b..728512d2 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -729,7 +729,7 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, runlist_element *rl; /* The output runlist. */ u8 *buf; /* Current position in mapping pairs array. */ u8 *attr_end; /* End of attribute. */ - int rlsize; /* Size of runlist buffer. */ + int err, rlsize; /* Size of runlist buffer. */ u16 rlpos; /* Current runlist position in units of runlist_elements. */ u8 b; /* Current byte offset in buf. */ @@ -921,8 +921,10 @@ mpa_err: old_rl = ntfs_runlists_merge(old_rl, rl); if (old_rl) return old_rl; + err = errno; free(rl); Dputs("Failed to merge runlists."); + errno = err; return NULL; io_error: Dputs("Corrupt attribute."); From 19fcf9b688a9085744e14a89ac8977bbe1573926 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 3 Dec 2003 15:38:52 +0000 Subject: [PATCH 0867/2994] Add ntfs_attr_map_whole_runlist(). (Logical change 1.243) --- ChangeLog | 3 ++ include/attrib.h | 1 + libntfs/attrib.c | 128 +++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 129 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c92dca7..3d7e17e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +03/12/2003 - 1.x.x - WIP + - Add new API function attrib.[hc]:ntfs_attr_map_whole_runlist(). + 19/11/2003 - 1.8.0 - Final fixes and tidy ups. - Cleanup build system wrt CFLAGS handling placing it all in one place in configure.ac and removing everything related from the Makefile.am diff --git a/include/attrib.h b/include/attrib.h index cf9cd2ac..9ed5d54d 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -253,6 +253,7 @@ extern s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, const u32 bk_size, void *src); extern int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn); +extern int ntfs_attr_map_whole_runlist(ntfs_attr *na); extern LCN ntfs_attr_vcn_to_lcn(ntfs_attr *na, const VCN vcn); extern runlist_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index f425f772..bd42531c 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -438,6 +438,114 @@ int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn) return -1; } +/** + * ntfs_attr_map_whole_runlist - map the whole runlist of an ntfs attribute + * @na: ntfs attribute for which to map the runlist + * + * Map the whole runlist of an the ntfs attribute @na. For an attribute made + * up of only one attribute extent this is the same as calling + * ntfs_attr_map_runlist(na, 0) but for an attribute with multiple extents this + * will map the runlist fragments from each of the extents thus giving access + * to the entirety of the disk allocation of an attribute. + * + * Return 0 on success and -1 on error with errno set to the error code. + */ +int ntfs_attr_map_whole_runlist(ntfs_attr *na) +{ + VCN next_vcn, last_vcn, highest_vcn; + ntfs_attr_search_ctx *ctx; + ntfs_volume *vol = na->ni->vol; + ATTR_RECORD *a; + int err; + + Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x.\n", __FUNCTION__, + (unsigned long long)na->ni->mft_no, na->type); + + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); + if (!ctx) + return -1; + + /* Map all attribute extents one by one. */ + next_vcn = last_vcn = highest_vcn = 0; + a = NULL; + while (!ntfs_attr_lookup(na->type, na->name, na->name_len, + CASE_SENSITIVE, next_vcn, NULL, 0, ctx)) { + runlist_element *rl; + + a = ctx->attr; + + /* Decode the runlist. */ + rl = ntfs_mapping_pairs_decompress(na->ni->vol, a, na->rl); + if (!rl) + goto err_out; + na->rl = rl; + + /* Are we in the first extent? */ + if (!next_vcn) { + if (a->lowest_vcn) { + Dprintf("%s(): First extent of attribute " + "has non zero lowest_vcn. " + "Inode is corrupt.\n", + __FUNCTION__); + errno = EIO; + goto err_out; + } + /* Get the last vcn in the attribute. */ + last_vcn = sle64_to_cpu(a->allocated_size) >> + vol->cluster_size_bits; + } + + /* Get the lowest vcn for the next extent. */ + highest_vcn = sle64_to_cpu(a->highest_vcn); + next_vcn = highest_vcn + 1; + + /* Only one extent or error, which we catch below. */ + if (next_vcn <= 0) { + errno = ENOENT; + break; + } + + /* Avoid endless loops due to corruption. */ + if (next_vcn < sle64_to_cpu(a->lowest_vcn)) { + Dprintf("%s(): Inode has corrupt attribute list " + "attribute.\n", __FUNCTION__); + errno = EIO; + goto err_out; + } + } + if (!a) { + err = errno; + if (err == ENOENT) + Dprintf("%s(): Attribute not found. Inode is " + "corrupt.\n", __FUNCTION__); + else + Dprintf("%s(): Inode is corrupt.\n", __FUNCTION__); + errno = err; + goto err_out; + } + if (highest_vcn && highest_vcn != last_vcn - 1) { + Dprintf("%s(): Failed to load the complete run list for the " + "attribute. Bug or corrupt inode.\n", + __FUNCTION__); + Dprintf("%s(): highest_vcn = 0x%Lx, last_vcn - 1 = 0x%Lx\n", + __FUNCTION__, (long long)highest_vcn, + (long long)last_vcn - 1); + errno = EIO; + goto err_out; + } + err = errno; + ntfs_attr_put_search_ctx(ctx); + if (err == ENOENT) + return 0; +out_now: + errno = err; + return -1; +err_out: + err = errno; + ntfs_attr_put_search_ctx(ctx); + goto out_now; +} + /** * ntfs_attr_vcn_to_lcn - convert a vcn into a lcn given an ntfs attribute * @na: ntfs attribute whose runlist to use for conversion @@ -2527,6 +2635,8 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) { ntfs_volume *vol = na->ni->vol; ATTR_REC *a = ctx->attr; + int name_ofs, val_ofs; + s64 arec_size; /* Some preliminary sanity checking. */ if (!NAttrNonResident(na)) { @@ -2569,10 +2679,22 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) return -1; } - // Is there enough space for the attribute to be resident? - // If not: errno = ENOSPC; return -1; + /* Work out offsets into and size of the resident attribute. */ + name_ofs = 24; /* = sizeof(resident_ATTR_REC); */ + val_ofs = (name_ofs + a->name_length + 7) & ~7; + arec_size = (val_ofs + na->data_size + 7) & ~7; + + /* Read and cache the whole runlist if not already done. */ + if (ntfs_attr_map_whole_runlist(na)) + return -1; + + // Can be done by ntfs_attr_record_resize() itself! + if (ctx->mrec->bytes_in_use - le32_to_cpu(a->length) + arec_size > + ctx->mrec->bytes_allocated) { + errno = ENOSPC; + return -1; + } - // Read and cache runlist if not already done. // Convert to resident attribute & resize attribute record. From 012e9b8cfc4d4aa3d052334d8e08c2edcaddf8ec Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 3 Dec 2003 15:38:52 +0000 Subject: [PATCH 0868/2994] Add ntfs_attr_map_whole_runlist(). BKrev: 3fce038c-F_KqoT-7I4uIvaBYH7HUg From 608669d5649b7c68d0c2699da70718aa98dd12c2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Dec 2003 18:06:50 +0000 Subject: [PATCH 0869/2994] Add ntfs_rl_pread(). (Logical change 1.244) --- ChangeLog | 1 + include/runlist.h | 2 + libntfs/runlist.c | 99 ++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 97 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3d7e17e4..4682b3fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 03/12/2003 - 1.x.x - WIP - Add new API function attrib.[hc]:ntfs_attr_map_whole_runlist(). + - Add new API function runlist.[hc]:ntfs_rl_pread(). 19/11/2003 - 1.8.0 - Final fixes and tidy ups. - Cleanup build system wrt CFLAGS handling placing it all in one place diff --git a/include/runlist.h b/include/runlist.h index 61069bce..b22b46dc 100644 --- a/include/runlist.h +++ b/include/runlist.h @@ -51,6 +51,8 @@ struct _runlist_element {/* In memory vcn to lcn mapping structure element. */ extern LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn); +extern s64 ntfs_rl_pread(const ntfs_volume *vol, const runlist_element *rl, + const s64 pos, s64 count, void *b); extern s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, const s64 pos, s64 count, void *b); diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 728512d2..fbc76a34 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -988,6 +988,92 @@ LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn) return (LCN)LCN_ENOENT; } +/** + * ntfs_rl_pread - gather read from disk + * @vol: ntfs volume to read from + * @rl: runlist specifying where to read the data from + * @pos: byte position within runlist @rl at which to begin the read + * @count: number of bytes to read + * @b: data buffer into which to read from disk + * + * This function will read @count bytes from the volume @vol to the data buffer + * @b gathering the data as specified by the runlist @rl. The read begins at + * offset @pos into the runlist @rl. + * + * On success, return the number of successfully read bytes. If this number is + * lower than @count this means that the read reached end of file or that an + * error was encountered during the read so that the read is partial. 0 means + * nothing was read (also return 0 when @count is 0). + * + * On error and nothing has been read, return -1 with errno set appropriately + * to the return code of ntfs_pread(), or to EINVAL in case of invalid + * arguments. + * + * NOTE: If we encounter EOF while reading we return EIO because we assume that + * the run list must point to valid locations within the ntfs volume. + */ +s64 ntfs_rl_pread(const ntfs_volume *vol, const runlist_element *rl, + const s64 pos, s64 count, void *b) +{ + s64 bytes_read, to_read, ofs, total; + int err = EIO; + + if (!vol || !rl || pos < 0 || count < 0) { + errno = EINVAL; + return -1; + } + if (!count) + return count; + /* Seek in @rl to the run containing @pos. */ + for (ofs = 0; rl->length && (ofs + rl->length <= pos); rl++) + ofs += rl->length; + /* Offset in the run at which to begin reading. */ + ofs = pos - ofs; + for (total = 0LL; count; rl++, ofs = 0) { + if (!rl->length) + goto rl_err_out; + if (rl->lcn < (LCN)0) { + if (rl->lcn != (LCN)LCN_HOLE) + goto rl_err_out; + /* It is a hole. Just fill buffer @b with zeroes. */ + to_read = min(count, (rl->length << + vol->cluster_size_bits) - ofs); + memset(b, 0, to_read); + /* Update counters and proceed with next run. */ + total += to_read; + count -= to_read; + (u8*)b += to_read; + continue; + } + /* It is a real lcn, read it from the volume. */ + to_read = min(count, (rl->length << vol->cluster_size_bits) - + ofs); +retry: + bytes_read = ntfs_pread(vol->dev, (rl->lcn << + vol->cluster_size_bits) + ofs, to_read, b); + /* If everything ok, update progress counters and continue. */ + if (bytes_read > 0) { + total += bytes_read; + count -= bytes_read; + (u8*)b += bytes_read; + continue; + } + /* If the syscall was interrupted, try again. */ + if (bytes_read == (s64)-1 && errno == EINTR) + goto retry; + if (bytes_read == (s64)-1) + err = errno; + goto rl_err_out; + } + /* Finally, return the number of bytes read. */ + return total; +rl_err_out: + if (total) + return total; + errno = err; + return -1; +} + /** * ntfs_rl_pwrite - scatter write to disk * @vol: ntfs volume to write to @@ -1006,8 +1092,8 @@ LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn) * is partial. 0 means nothing was written (also return 0 when @count is 0). * * On error and nothing has been written, return -1 with errno set - * appropriately to the return code of either lseek, write, fdatasync, or set - * to EINVAL in case of invalid arguments. + * appropriately to the return code of ntfs_pwrite(), or to to EINVAL in case + * of invalid arguments. */ s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, const s64 pos, s64 count, void *b) @@ -1029,7 +1115,7 @@ s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, for (total = 0LL; count; rl++, ofs = 0) { if (!rl->length) goto rl_err_out; - if (rl->lcn < (LCN) 0) { + if (rl->lcn < (LCN)0) { s64 t; int cnt; @@ -1087,7 +1173,7 @@ retry: /* If the syscall was interrupted, try again. */ if (written == (s64)-1 && errno == EINTR) goto retry; - if (written == -1) + if (written == (s64)-1) err = errno; goto rl_err_out; } @@ -1389,9 +1475,12 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) /* Reallocate memory if necessary. */ if (!is_end) { - rl = realloc(*arl, (rl - *arl + 1) * sizeof(runlist_element)); + size_t new_size = (rl - *arl + 1) * sizeof(runlist_element); + rl = realloc(*arl, new_size); if (rl) *arl = rl; + else if (!new_size) + *arl = NULL; else { // FIXME: Eeek! fprintf(stderr, "%s(): Eeek! Failed to reallocate " From fb54204cc70edeb8e64a07691704fade96364f0e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Dec 2003 18:06:50 +0000 Subject: [PATCH 0870/2994] Add ntfs_rl_pread(). BKrev: 3fd0c93aC9FUR9kieGfYbDSEarDghQ From 549393080e23a775ea7f58eb65677fe8dd11d31c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Dec 2003 17:36:00 +0000 Subject: [PATCH 0871/2994] finish off initial implementation of ntfs_attr_make_resident(). (Logical change 1.245) --- libntfs/attrib.c | 128 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 111 insertions(+), 17 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index bd42531c..86555c73 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2635,8 +2635,8 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) { ntfs_volume *vol = na->ni->vol; ATTR_REC *a = ctx->attr; - int name_ofs, val_ofs; - s64 arec_size; + int name_ofs, val_ofs, err = EIO; + s64 arec_size, bytes_read; /* Some preliminary sanity checking. */ if (!NAttrNonResident(na)) { @@ -2675,40 +2675,134 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) // FIXME: For now we cheat and assume there is no attribute list // attribute present. (AIA) if (NInoAttrList(na->ni)) { + fprintf(stderr, "%s(): Working on files with attribute list " + "attribute is not implemented yet.\n", + __FUNCTION__); errno = ENOTSUP; return -1; } + if (NAttrCompressed(na) || NAttrEncrypted(na)) { + fprintf(stderr, "%s(): Making compressed or encrypted files " + "resident is not implemented yet.\n", + __FUNCTION__); + errno = ENOTSUP; + return -1; + } + + /* Read and cache the whole runlist if not already done. */ + if (ntfs_attr_map_whole_runlist(na)) + return -1; /* Work out offsets into and size of the resident attribute. */ name_ofs = 24; /* = sizeof(resident_ATTR_REC); */ val_ofs = (name_ofs + a->name_length + 7) & ~7; arec_size = (val_ofs + na->data_size + 7) & ~7; - /* Read and cache the whole runlist if not already done. */ - if (ntfs_attr_map_whole_runlist(na)) - return -1; - - // Can be done by ntfs_attr_record_resize() itself! - if (ctx->mrec->bytes_in_use - le32_to_cpu(a->length) + arec_size > - ctx->mrec->bytes_allocated) { + /* Sanity check the size before we start modifying the attribute. */ + if (le32_to_cpu(ctx->mrec->bytes_in_use) - le32_to_cpu(a->length) + + arec_size > le32_to_cpu(ctx->mrec->bytes_allocated)) { errno = ENOSPC; return -1; } + /* Move the attribute name if it exists and update the offset. */ + if (a->name_length) { + /* Sanity check. */ + if (le16_to_cpu(a->name_offset) + a->name_length > arec_size) { + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Name exceeds new record " + "size! Not supported. Aborting...\n", + __FUNCTION__); + errno = ENOTSUP; + return -1; + } - // Convert to resident attribute & resize attribute record. + memmove((u8*)a + name_ofs, (u8*)a + le16_to_cpu(a->name_offset), + a->name_length * sizeof(uchar_t)); + } + a->name_offset = cpu_to_le16(name_ofs); - // Copy data from run list to resident attribute value. + /* Resize the resident part of the attribute record. */ + if (ntfs_attr_record_resize(ctx->mrec, a, arec_size) < 0) { + if (errno != ENOSPC) { + err = errno; + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Failed to resize " + "attribute record. Aborting...\n", + __FUNCTION__); + errno = err; + } + return -1; + } - // Deallocate clusters from runlist and throw away runlist. + /* Convert the attribute record to describe a resident attribute. */ + a->non_resident = 0; + a->flags = 0; + a->value_length = cpu_to_le32(na->data_size); + a->value_offset = cpu_to_le16(val_ofs); + /* + * File names cannot be non-resident so we would never see this here + * but at least it serves as a reminder that there may be attributes + * for which we do need to set this flag. (AIA) + */ + if (a->type == AT_FILE_NAME) + a->resident_flags = RESIDENT_ATTR_IS_INDEXED; + else + a->resident_flags = 0; + a->reservedR = 0; - // Update in-memory struct ntfs_attribute if not done already. + /* Sanity fixup... Shouldn't really happen. (AIA) */ + if (na->initialized_size > na->data_size) + na->initialized_size = na->data_size; - errno = ENOTSUP; - return -1; + /* Copy data from run list to resident attribute value. */ + bytes_read = ntfs_rl_pread(vol, na->rl, 0, na->initialized_size, + (u8*)a + val_ofs); + if (bytes_read != na->initialized_size) { + if (bytes_read < 0) + err = errno; + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Failed to read attribute data. " + "Aborting...\n", __FUNCTION__); + errno = err; + return -1; + } - //NAttrClearNonResident(na); - //return 0; + /* Clear memory in gap between initialized_size and data_size. */ + if (na->initialized_size < na->data_size) + memset((u8*)a + val_ofs + na->initialized_size, 0, + na->data_size - na->initialized_size); + + /* + * Deallocate clusters from the runlist. + * + * NOTE: We can use ntfs_cluster_free() because we have already mapped + * the whole run list and thus it doesn't matter that the attribute + * record is in a transiently corrupted state at this moment in time. + */ + if (ntfs_cluster_free(vol, na, 0, -1) < 0) { + err = errno; + // FIXME: Eeek! + fprintf(stderr, "%s(): Eeek! Failed to release allocated " + "clusters (error: %s). Ignoring error and " + "leaving behind wasted clusters.\n", + __FUNCTION__, strerror(err)); + } + + /* Throw away the now unused runlist. */ + free(na->rl); + na->rl = NULL; + + /* Update in-memory struct ntfs_attr. */ + NAttrClearNonResident(na); + NAttrClearCompressed(na); + NAttrClearSparse(na); + NAttrClearEncrypted(na); + na->allocated_size = na->initialized_size = na->compressed_size = + na->data_size; + na->compression_block_size = 0; + na->compression_block_size_bits = na->compression_block_clusters = 0; + return 0; } /** From f7b862b7d15080e395e41441fa2fdce2a20469ca Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Dec 2003 17:36:00 +0000 Subject: [PATCH 0872/2994] finish off initial implementation of ntfs_attr_make_resident(). BKrev: 3fd60800Qz640YAR8FNqszPwCvqbtg From 9bd88a7d39bebf91c0723e84e8dd0ce1ed86a8ca Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Jan 2004 12:39:10 +0000 Subject: [PATCH 0873/2994] Fix bug in run list encoding functions that hit sparse and compressed files with holes. (Szabolcs Szakacsits) (Logical change 1.246) --- ChangeLog | 2 ++ libntfs/runlist.c | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4682b3fd..d27fb331 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 03/12/2003 - 1.x.x - WIP - Add new API function attrib.[hc]:ntfs_attr_map_whole_runlist(). - Add new API function runlist.[hc]:ntfs_rl_pread(). + - Fix bug in run list encoding functions that hit sparse and compressed + files with holes. (Szabolcs Szakacsits) 19/11/2003 - 1.8.0 - Final fixes and tidy ups. - Cleanup build system wrt CFLAGS handling placing it all in one place diff --git a/libntfs/runlist.c b/libntfs/runlist.c index fbc76a34..c2257223 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1243,7 +1243,7 @@ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, return 0; /* Always need the termining zero byte. */ rls = 1; - for (prev_lcn = i = 0; rl[i].length; prev_lcn = rl[i++].lcn) { + for (prev_lcn = i = 0; rl[i].length; i++) { if (rl[i].length < 0 || rl[i].lcn < LCN_HOLE) goto err_out; /* Header byte + length. */ @@ -1255,8 +1255,13 @@ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, */ if (rl[i].lcn == LCN_HOLE && vol->major_ver >= 3) continue; - /* Change in lcn. */ + /* + * Change in lcn. Note: this assumes that on NTFS 1.2-, holes + * are stored with an lcn of -1 and _not_ a delta_lcn of -1 + * (unless both are -1). + */ rls += ntfs_get_nr_significant_bytes(rl[i].lcn - prev_lcn); + prev_lcn = rl[i].lcn; } return rls; err_out: @@ -1352,7 +1357,7 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, * ntfs_write_significant_bytes(). */ dst_max = dst + dst_len - 1; - for (prev_lcn = i = 0; rl[i].length; prev_lcn = rl[i++].lcn) { + for (prev_lcn = i = 0; rl[i].length; i++) { if (rl[i].length < 0 || rl[i].lcn < LCN_HOLE) goto err_out; /* Write length. */ @@ -1366,13 +1371,15 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, * zero space. On earlier NTFS versions we just write the lcn * change. FIXME: Do we need to write the lcn change or just * the lcn in that case? Not sure as I have never seen this - * case on NT4. (AIA) + * case on NT4. - We assume that we just need to write the lcn + * change until someone tells us otherwise... (AIA) */ if (rl[i].lcn != LCN_HOLE || vol->major_ver < 3) { lcn_len = ntfs_write_significant_bytes(dst + 1 + len_len, dst_max, rl[i].lcn - prev_lcn); if (lcn_len < 0) goto size_err; + prev_lcn = rl[i].lcn; } else lcn_len = 0; /* Update header byte. */ From 388a10109fc2d50c50d28263ee9cf085f2c81fe2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Jan 2004 12:39:10 +0000 Subject: [PATCH 0874/2994] Fix bug in run list encoding functions that hit sparse and compressed files with holes. (Szabolcs Szakacsits) BKrev: 3ff95aeeIdV7cV6-u9IuUUVQizEmaw From 1226d98038a81ac0a5f10cc160bcd1204b79480b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 Jan 2004 11:04:29 +0000 Subject: [PATCH 0875/2994] Add compatibility for building with DJGPP under DOS. (Christophe Grenier, slightly modified by me) (Logical change 1.247) --- CREDITS | 1 + ChangeLog | 2 ++ config.h.in | 12 +++++++++--- configure | 8 +++++--- configure.ac | 6 +++--- include/endians.h | 8 ++++++-- include/volume.h | 8 +++++--- libntfs/unistr.c | 32 ++++++++++++++++++++++++++++++++ 8 files changed, 63 insertions(+), 14 deletions(-) diff --git a/CREDITS b/CREDITS index a10114d0..48c04864 100644 --- a/CREDITS +++ b/CREDITS @@ -11,6 +11,7 @@ Anton Altaparmakov Albert D. Cahalan Russ Christensen Matthew J. Fanto +Christophe Grenier Ian Jackson Jan Kratochvil Lode Leroy diff --git a/ChangeLog b/ChangeLog index d27fb331..4eca51f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ - Add new API function runlist.[hc]:ntfs_rl_pread(). - Fix bug in run list encoding functions that hit sparse and compressed files with holes. (Szabolcs Szakacsits) + - Add compatibility for building with DJGPP under DOS. (Christophe + Grenier, slightly modified by me) 19/11/2003 - 1.8.0 - Final fixes and tidy ups. - Cleanup build system wrt CFLAGS handling placing it all in one place diff --git a/config.h.in b/config.h.in index 2fae2ab4..9252b29b 100644 --- a/config.h.in +++ b/config.h.in @@ -1,17 +1,20 @@ /* config.h.in. Generated from configure.ac by autoheader. */ -/* Define to 1 if you have the header file. */ -#undef HAVE_ASM_BYTEORDER_H - /* Define to 1 if you have the `atexit' function. */ #undef HAVE_ATEXIT +/* Define to 1 if you have the header file. */ +#undef HAVE_BYTESWAP_H + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT +/* Define to 1 if you have the header file. */ +#undef HAVE_ENDIAN_H + /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H @@ -59,6 +62,9 @@ /* Define to 1 if mbrtowc and mbstate_t are properly declared. */ #undef HAVE_MBRTOWC +/* Define to 1 if you have the `mbsinit' function. */ +#undef HAVE_MBSINIT + /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE diff --git a/configure b/configure index 3c66b08b..f98bf20b 100755 --- a/configure +++ b/configure @@ -8460,12 +8460,13 @@ fi + for ac_header in fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ - sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h getopt.h sys/stat.h \ - sys/types.h asm/byteorder.h linux/major.h linux/fd.h + endian.h byteswap.h sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h \ + getopt.h sys/stat.h sys/types.h linux/major.h linux/fd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -10671,8 +10672,9 @@ done + for ac_func in atexit fdatasync hasmntopt memmove memset regcomp setlocale \ - strcasecmp strchr strdup strerror strtol strtoul utime + strcasecmp strchr strdup strerror strtol strtoul utime mbsinit do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 diff --git a/configure.ac b/configure.ac index 91dce96a..97846e5f 100644 --- a/configure.ac +++ b/configure.ac @@ -167,8 +167,8 @@ AC_SUBST(AUTODIRS) AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ - sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h getopt.h sys/stat.h \ - sys/types.h asm/byteorder.h linux/major.h linux/fd.h]) + endian.h byteswap.h sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h \ + getopt.h sys/stat.h sys/types.h linux/major.h linux/fd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL @@ -192,7 +192,7 @@ AC_FUNC_STRFTIME AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \ - strcasecmp strchr strdup strerror strtol strtoul utime]) + strcasecmp strchr strdup strerror strtol strtoul utime mbsinit]) # Makefiles to be created by configure. AC_CONFIG_FILES([ diff --git a/include/endians.h b/include/endians.h index 6f7f271f..d7d0133f 100644 --- a/include/endians.h +++ b/include/endians.h @@ -33,8 +33,12 @@ * architectures requiring aligned memory accesses... */ -#include -#include +#ifdef HAVE_ENDIAN_H +# include +#endif +#ifdef HAVE_BYTESWAP_H +# include +#endif #if (__BYTE_ORDER == __LITTLE_ENDIAN) diff --git a/include/volume.h b/include/volume.h index 9e3b77a1..ee5e2d17 100644 --- a/include/volume.h +++ b/include/volume.h @@ -25,13 +25,15 @@ #include "config.h" #include -#include +#ifdef HAVE_SYS_MOUNT_H +# include +#endif #ifdef HAVE_MNTENT_H # include #endif -/* Cygwin doesn't seem to have MS_RDONLY, so we define it here. */ -#if defined(__CYGWIN32__) && !defined(MS_RDONLY) +/* Both under Cygwin and DJGPP we do not have MS_RDONLY, so we define it. */ +#if !defined(MS_RDONLY) typedef enum { MS_RDONLY = 1, } MS_MOUNT; diff --git a/libntfs/unistr.c b/libntfs/unistr.c index a8267af5..2fc0e0af 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -321,7 +321,9 @@ int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, wchar_t wc; int i, o, mbs_len; int cnt = 0; +#ifdef HAVE_MBSINIT mbstate_t mbstate; +#endif if (!ins || !outs) { errno = EINVAL; @@ -339,7 +341,11 @@ int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, if (!mbs) return -1; } +#ifdef HAVE_MBSINIT memset(&mbstate, 0, sizeof(mbstate)); +#else + wctomb(NULL, 0); +#endif for (i = o = 0; i < ins_len; i++) { /* Reallocate memory if necessary or abort. */ if ((int)(o + MB_CUR_MAX) > mbs_len) { @@ -361,7 +367,11 @@ int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, if (!wc) break; /* Convert the CPU endian wide character to multibyte. */ +#ifdef HAVE_MBSINIT cnt = wcrtomb(mbs + o, wc, &mbstate); +#else + cnt = wctomb(mbs + o, wc); +#endif if (cnt == -1) goto err_out; if (cnt <= 0) { @@ -371,12 +381,14 @@ int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, } o += cnt; } +#ifdef HAVE_MBSINIT /* Make sure we are back in the initial state. */ if (!mbsinit(&mbstate)) { Dputs("Eeek. mbstate not in initial state!"); errno = EILSEQ; goto err_out; } +#endif /* Now write the NULL character. */ mbs[o] = '\0'; if (*outs != mbs) @@ -421,7 +433,9 @@ int ntfs_mbstoucs(char *ins, uchar_t **outs, int outs_len) char *s; wchar_t wc; int i, o, cnt, ins_len, ucs_len; +#ifdef HAVE_MBSINIT mbstate_t mbstate; +#endif if (!ins || !outs) { errno = EINVAL; @@ -435,11 +449,19 @@ int ntfs_mbstoucs(char *ins, uchar_t **outs, int outs_len) } /* Determine the length of the multi-byte string. */ s = ins; +#ifdef HAVE_MBSINIT memset(&mbstate, 0, sizeof(mbstate)); ins_len = mbsrtowcs(NULL, (const char **)&s, 0, &mbstate); +#else + ins_len = mbstowcs(NULL, s, 0); +#endif if (ins_len == -1) return ins_len; +#ifdef HAVE_MBSINIT if ((s != ins) || !mbsinit(&mbstate)) { +#else + if (s != ins) { +#endif errno = EILSEQ; return -1; } @@ -451,7 +473,11 @@ int ntfs_mbstoucs(char *ins, uchar_t **outs, int outs_len) if (!ucs) return -1; } +#ifdef HAVE_MBSINIT memset(&mbstate, 0, sizeof(mbstate)); +#else + mbtowc(NULL, NULL, 0); +#endif for (i = o = cnt = 0; o < ins_len; i += cnt, o++) { /* Reallocate memory if necessary or abort. */ if (o >= ucs_len) { @@ -472,7 +498,11 @@ int ntfs_mbstoucs(char *ins, uchar_t **outs, int outs_len) ucs_len /= sizeof(uchar_t); } /* Convert the multibyte character to a wide character. */ +#ifdef HAVE_MBSINIT cnt = mbrtowc(&wc, ins + i, ins_len - i, &mbstate); +#else + cnt = mbtowc(&wc, ins + i, ins_len - i); +#endif if (!cnt) break; if (cnt == -1) @@ -491,6 +521,7 @@ int ntfs_mbstoucs(char *ins, uchar_t **outs, int outs_len) /* Convert the CPU wide character to a LE Unicode character. */ ucs[o] = cpu_to_le16(wc); } +#ifdef HAVE_MBSINIT /* Make sure we are back in the initial state. */ if (!mbsinit(&mbstate)) { Dprintf("%s(): Eeek. mbstate not in initial state!\n", @@ -498,6 +529,7 @@ int ntfs_mbstoucs(char *ins, uchar_t **outs, int outs_len) errno = EILSEQ; goto err_out; } +#endif /* Now write the NULL character. */ ucs[o] = cpu_to_le16(L'\0'); if (*outs != ucs) From 38e8b16253c60bfb745b29a3ea8211d130736af4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 Jan 2004 11:04:29 +0000 Subject: [PATCH 0876/2994] Add compatibility for building with DJGPP under DOS. (Christophe Grenier, slightly modified by me) BKrev: 3ffa963dzLxmiCQdY1CZZjrICqdXGQ From be273eddc87ca76d16d9245720ed690846264cac Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 Jan 2004 11:52:01 +0000 Subject: [PATCH 0877/2994] Update for 1.8.1 release. (Logical change 1.248) --- ChangeLog | 2 +- NEWS | 3 +++ configure | 20 ++++++++++---------- configure.ac | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4eca51f6..a3fe191b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -03/12/2003 - 1.x.x - WIP +06/01/2004 - 1.8.1 - Important bug fix and various enhancements. - Add new API function attrib.[hc]:ntfs_attr_map_whole_runlist(). - Add new API function runlist.[hc]:ntfs_rl_pread(). - Fix bug in run list encoding functions that hit sparse and compressed diff --git a/NEWS b/NEWS index d1ddadda..24a4400f 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ Current news ============ +ntfsprogs should now compile with DJGPP under DOS, too. Thanks to Christophe +Grenier. + Merged the NTFS Gnome VFS module by Jan Kratochvil. Added new utilities: ntfsclone by Szakacsits Szabolcs, ntfscluster by Richard diff --git a/configure b/configure index f98bf20b..920b2a2b 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.0. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.1. # # Report bugs to . # @@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.0' -PACKAGE_STRING='ntfsprogs 1.8.0' +PACKAGE_VERSION='1.8.1' +PACKAGE_STRING='ntfsprogs 1.8.1' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -939,7 +939,7 @@ 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 ntfsprogs 1.8.0 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1006,7 +1006,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.0:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.1:";; esac cat <<\_ACEOF @@ -1106,7 +1106,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.0 +ntfsprogs configure 1.8.1 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1121,7 +1121,7 @@ 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 ntfsprogs $as_me 1.8.0, which was +It was created by ntfsprogs $as_me 1.8.1, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1800,7 +1800,7 @@ fi # Define the identity of the package. PACKAGE=ntfsprogs - VERSION=1.8.0 + VERSION=1.8.1 cat >>confdefs.h <<_ACEOF @@ -11149,7 +11149,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.0, which was +This file was extended by ntfsprogs $as_me 1.8.1, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11212,7 +11212,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.0 +ntfsprogs config.status 1.8.1 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 97846e5f..fdeea028 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.0, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.1, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) From cf7384da43ff5388774833b2a2d7ca034ef2e145 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 Jan 2004 11:52:01 +0000 Subject: [PATCH 0878/2994] Update for 1.8.1 release. BKrev: 3ffaa1610jphpcTM2CgjvAySX_t11Q From 3fea49b48c318d853c06dc5bae7820dd9212f185 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 Jan 2004 14:31:21 +0000 Subject: [PATCH 0879/2994] - Compile fixes for DJGPP. (Chrisophe Grenier, me) - Add compatibility for building on FreeBSD. (Christophe Grenier) (Logical change 1.249) --- ChangeLog | 4 ++++ config.h.in | 9 +++++++++ configure | 8 ++++++-- configure.ac | 5 +++-- include/endians.h | 16 ++++++++++++++++ include/volume.h | 3 +++ ntfsprogs/ntfsundelete.c | 4 +++- ntfsprogs/utils.c | 4 +++- 8 files changed, 47 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3fe191b..e17012a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +06/01/2004 - 1.8.xx - WIP + - Compile fixes for DJGPP. (Chrisophe Grenier, me) + - Add compatibility for building on FreeBSD. (Christophe Grenier) + 06/01/2004 - 1.8.1 - Important bug fix and various enhancements. - Add new API function attrib.[hc]:ntfs_attr_map_whole_runlist(). - Add new API function runlist.[hc]:ntfs_rl_pread(). diff --git a/config.h.in b/config.h.in index 9252b29b..2c599863 100644 --- a/config.h.in +++ b/config.h.in @@ -24,6 +24,9 @@ /* Define to 1 if you have the `fdatasync' function. */ #undef HAVE_FDATASYNC +/* Define to 1 if you have the header file. */ +#undef HAVE_FEATURES_H + /* Define to 1 if you have the `getmntent' function. */ #undef HAVE_GETMNTENT @@ -146,12 +149,18 @@ `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ #undef HAVE_ST_BLOCKS +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_ENDIAN_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MOUNT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H diff --git a/configure b/configure index 920b2a2b..41ac93b1 100755 --- a/configure +++ b/configure @@ -8459,14 +8459,18 @@ fi + + + for ac_header in fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ - endian.h byteswap.h sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h \ - getopt.h sys/stat.h sys/types.h linux/major.h linux/fd.h + unistd.h utime.h wchar.h getopt.h features.h endian.h byteswap.h \ + sys/endian.h sys/param.h sys/ioctl.h sys/mount.h sys/stat.h \ + sys/types.h linux/major.h linux/fd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then diff --git a/configure.ac b/configure.ac index fdeea028..f8883be5 100644 --- a/configure.ac +++ b/configure.ac @@ -167,8 +167,9 @@ AC_SUBST(AUTODIRS) AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ - endian.h byteswap.h sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h \ - getopt.h sys/stat.h sys/types.h linux/major.h linux/fd.h]) + unistd.h utime.h wchar.h getopt.h features.h endian.h byteswap.h \ + sys/endian.h sys/param.h sys/ioctl.h sys/mount.h sys/stat.h \ + sys/types.h linux/major.h linux/fd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL diff --git a/include/endians.h b/include/endians.h index d7d0133f..4a5c2a24 100644 --- a/include/endians.h +++ b/include/endians.h @@ -36,6 +36,22 @@ #ifdef HAVE_ENDIAN_H # include #endif +#ifdef HAVE_SYS_ENDIAN_H +# include +#endif +#ifndef __BYTE_ORDER +# ifdef _BYTE_ORDER +# define __BYTE_ORDER _BYTE_ORDER +# define __LITTLE_ENDIAN _LITTLE_ENDIAN +# define __BIG_ENDIAN _BIG_ENDIAN +# else +# ifdef BYTE_ORDER +# define __BYTE_ORDER BYTE_ORDER +# define __LITTLE_ENDIAN LITTLE_ENDIAN +# define __BIG_ENDIAN BIG_ENDIAN +# endif +# endif +#endif #ifdef HAVE_BYTESWAP_H # include #endif diff --git a/include/volume.h b/include/volume.h index ee5e2d17..4d8c042b 100644 --- a/include/volume.h +++ b/include/volume.h @@ -25,6 +25,9 @@ #include "config.h" #include +#ifdef HAVE_SYS_PARAM_H +# include +#endif #ifdef HAVE_SYS_MOUNT_H # include #endif diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 9dd1e873..682257eb 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -23,7 +23,9 @@ #include "config.h" -#include +#ifdef HAVE_FEATURES_H +# include +#endif #include #include #include diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 7ee3addd..6b6b7fc8 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -31,7 +31,9 @@ #include #include #include -#include +#ifdef HAVE_LIBINTL_H +# include +#endif #include #include From 48d95692494a7a388d22c95983108c7f1a8e468e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 Jan 2004 14:31:21 +0000 Subject: [PATCH 0880/2994] - Compile fixes for DJGPP. (Chrisophe Grenier, me) - Add compatibility for building on FreeBSD. (Christophe Grenier) BKrev: 3ffac6b91lyqS8qjV6Cy56QJKaNIUQ From f70fc867a552bc43be63e7d4ac06bbf6f9662883 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 Jan 2004 14:46:09 +0000 Subject: [PATCH 0881/2994] Update version to 1.8.2-WIP (Logical change 1.250) --- ChangeLog | 2 +- configure | 20 ++++++++++---------- configure.ac | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index e17012a2..1e4d9d84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -06/01/2004 - 1.8.xx - WIP +06/01/2004 - 1.8.2-WIP - Compile fixes for DJGPP. (Chrisophe Grenier, me) - Add compatibility for building on FreeBSD. (Christophe Grenier) diff --git a/configure b/configure index 41ac93b1..53b767e4 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.1. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.2-WIP. # # Report bugs to . # @@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.1' -PACKAGE_STRING='ntfsprogs 1.8.1' +PACKAGE_VERSION='1.8.2-WIP' +PACKAGE_STRING='ntfsprogs 1.8.2-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -939,7 +939,7 @@ 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 ntfsprogs 1.8.1 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.2-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1006,7 +1006,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.1:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.2-WIP:";; esac cat <<\_ACEOF @@ -1106,7 +1106,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.1 +ntfsprogs configure 1.8.2-WIP generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1121,7 +1121,7 @@ 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 ntfsprogs $as_me 1.8.1, which was +It was created by ntfsprogs $as_me 1.8.2-WIP, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1800,7 +1800,7 @@ fi # Define the identity of the package. PACKAGE=ntfsprogs - VERSION=1.8.1 + VERSION=1.8.2-WIP cat >>confdefs.h <<_ACEOF @@ -11153,7 +11153,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.1, which was +This file was extended by ntfsprogs $as_me 1.8.2-WIP, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11216,7 +11216,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.1 +ntfsprogs config.status 1.8.2-WIP configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index f8883be5..9ca6b631 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.1, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.2-WIP, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) From 33082d51a983c8f2e38e3a9d3f4ec6fcc2299c99 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 Jan 2004 14:46:09 +0000 Subject: [PATCH 0882/2994] Update version to 1.8.2-WIP BKrev: 3ffaca31YvMfSgGxzpxoEF8r3GbR0g From 652b1e554df65060f8ceb0dd0c37a9bb2134d8c7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 Jan 2004 16:39:48 +0000 Subject: [PATCH 0883/2994] Add new compile target "make libs" which only compiles libntfs. (Logical change 1.251) --- ChangeLog | 1 + Makefile.am | 3 +++ Makefile.in | 3 +++ libntfs/Makefile.am | 2 ++ libntfs/Makefile.in | 12 +++--------- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e4d9d84..020da267 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 06/01/2004 - 1.8.2-WIP - Compile fixes for DJGPP. (Chrisophe Grenier, me) - Add compatibility for building on FreeBSD. (Christophe Grenier) + - Add new compile target "make libs" which only compiles libntfs. 06/01/2004 - 1.8.1 - Important bug fix and various enhancements. - Add new API function attrib.[hc]:ntfs_attr_map_whole_runlist(). diff --git a/Makefile.am b/Makefile.am index 150a0904..2f0ee189 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,3 +21,6 @@ extra: extras extras: $(MAKE) -C ntfsprogs extras +libs: + $(MAKE) -C libntfs libs + diff --git a/Makefile.in b/Makefile.in index c5242514..0885e97c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -470,6 +470,9 @@ extra: extras extras: $(MAKE) -C ntfsprogs extras + +libs: + $(MAKE) -C libntfs libs # 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/libntfs/Makefile.am b/libntfs/Makefile.am index eb1a43ea..4cc8cba5 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -74,3 +74,5 @@ INCLUDES = $(linux_ntfsincludedir) $(all_includes) EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in +libs: $(lib_LTLIBRARIES) + diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index fef108ac..6075450e 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -126,14 +126,6 @@ install_sh = @install_sh@ LTVERSION_LIBNTFS = 5:0:0 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 -# Later gcc require -fms-extensions to work. -@GCC_NEEDS_MS_EXTENSIONS_TRUE@GCCflag = -fms-extensions -@GCC_NEEDS_MS_EXTENSIONS_FALSE@GCCflag = - -# Need this to enable 64-bit (device) file access functions and parameters. -@DEBUG_TRUE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall -g -DDEBUG $(GCCflag) -@DEBUG_FALSE@AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -Wall $(GCCflag) - linux_ntfsincludedir = -I$(top_srcdir)/include lib_LTLIBRARIES = libntfs.la @@ -165,7 +157,7 @@ libntfs_la_SOURCES = \ libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS_GNOMEVFS) libntfs_gnomevfs_la_LIBADD = libntfs.la libntfs_gnomevfs_la_LIBS = $(LIBNTFS_GNOMEVFS_LIBS) -libntfs_gnomevfs_la_CFLAGS = $(LIBNTFS_GNOMEVFS_CFLAGS) $(GCCflag) +libntfs_gnomevfs_la_CFLAGS = $(LIBNTFS_GNOMEVFS_CFLAGS) libntfs_gnomevfs_la_SOURCES = \ gnome-vfs-method.c \ gnome-vfs-module.c @@ -604,6 +596,8 @@ uninstall-man: uninstall-man8 uninstall-gnomevfsmoduleslibLTLIBRARIES uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-man uninstall-man8 + +libs: $(lib_LTLIBRARIES) # 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: From 7b29b11dc1be3214b6a2fd582ad32232f4fc5506 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 6 Jan 2004 16:39:48 +0000 Subject: [PATCH 0884/2994] Add new compile target "make libs" which only compiles libntfs. BKrev: 3ffae4d42-rCajOh4VPNfCaO9x2j1g From 3eaa5c327fd779268a70bb67383f78719cb74b38 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 10:02:13 +0000 Subject: [PATCH 0885/2994] Remove duplicate redeclaration from device.h. (Christophe Grenier) (Logical change 1.252) --- include/device.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/device.h b/include/device.h index 36da5d34..928ef3f8 100644 --- a/include/device.h +++ b/include/device.h @@ -54,9 +54,6 @@ typedef enum { #define NDevSetDirty(nd) set_ndev_flag(nd, Dirty) #define NDevClearDirty(nd) clear_ndev_flag(nd, Dirty) -/* Forward declaration. */ -struct ntfs_device_operations; - /* * The ntfs device structure defining all operations needed to access the low * level device underlying the ntfs volume. @@ -87,8 +84,6 @@ struct ntfs_device_operations { int (*ioctl)(struct ntfs_device *dev, int request, void *argp); }; -extern struct ntfs_device_operations ntfs_device_default_io_ops; - extern struct ntfs_device *ntfs_device_alloc(const char *name, const long state, struct ntfs_device_operations *dops, void *private); extern int ntfs_device_free(struct ntfs_device *dev); From 029782c0c14e879fcc9e23a02a9f78119d573222 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 10:02:13 +0000 Subject: [PATCH 0886/2994] Remove duplicate redeclaration from device.h. (Christophe Grenier) BKrev: 3ffbd925XbLw39CZC1oZPU918GXF_A From 6651abe32266a182881e2b9db6263f1ba007e320 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 10:22:51 +0000 Subject: [PATCH 0887/2994] More updates from Christophe Grenier for DJGPP and FreeBSD. (Logical change 1.253) --- config.h.in | 6 ++++++ configure | 4 +++- configure.ac | 2 +- include/endians.h | 3 +++ ntfsprogs/ntfsclone.c | 4 +++- ntfsprogs/utils.h | 4 ++-- 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/config.h.in b/config.h.in index 2c599863..0b323f13 100644 --- a/config.h.in +++ b/config.h.in @@ -58,6 +58,9 @@ double. */ #undef HAVE_LONG_DOUBLE +/* Define to 1 if you have the header file. */ +#undef HAVE_MACHINE_ENDIAN_H + /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC @@ -167,6 +170,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_VFS_H + /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H diff --git a/configure b/configure index 53b767e4..66a98f89 100755 --- a/configure +++ b/configure @@ -8463,6 +8463,8 @@ fi + + @@ -8470,7 +8472,7 @@ for ac_header in fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ unistd.h utime.h wchar.h getopt.h features.h endian.h byteswap.h \ sys/endian.h sys/param.h sys/ioctl.h sys/mount.h sys/stat.h \ - sys/types.h linux/major.h linux/fd.h + sys/types.h sys/vfs.h linux/major.h linux/fd.h machine/endian.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then diff --git a/configure.ac b/configure.ac index 9ca6b631..fcdddfd1 100644 --- a/configure.ac +++ b/configure.ac @@ -169,7 +169,7 @@ AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ unistd.h utime.h wchar.h getopt.h features.h endian.h byteswap.h \ sys/endian.h sys/param.h sys/ioctl.h sys/mount.h sys/stat.h \ - sys/types.h linux/major.h linux/fd.h]) + sys/types.h sys/vfs.h linux/major.h linux/fd.h machine/endian.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL diff --git a/include/endians.h b/include/endians.h index 4a5c2a24..b57bdef8 100644 --- a/include/endians.h +++ b/include/endians.h @@ -39,6 +39,9 @@ #ifdef HAVE_SYS_ENDIAN_H # include #endif +#ifdef HAVE_MACHINE_ENDIAN_H +# include +#endif #ifndef __BYTE_ORDER # ifdef _BYTE_ORDER # define __BYTE_ORDER _BYTE_ORDER diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 6b5e7349..c1a927bf 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -18,7 +18,9 @@ #include #include #include -#include +#ifdef HAVE_SYS_VFS_H +# include +#endif #include #include #include diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 55205614..c26bcfa7 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -39,8 +39,8 @@ extern const char *ntfs_gpl; #define PATH_SEP '/' #define MAX_PATH 1024 -#if (REG_NOERROR != 0) -#define REG_NOERROR REG_OKAY +#if !defined(REG_NOERROR) || (REG_NOERROR != 0) +# define REG_NOERROR REG_OKAY #endif #define GEN_PRINTF(NAME, STREAM, CONTROL, TRIGGER) \ From 3d4837f9defd68e37576113cb2ba91af5d675eed Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 10:22:51 +0000 Subject: [PATCH 0888/2994] More updates from Christophe Grenier for DJGPP and FreeBSD. BKrev: 3ffbddfbuXB9MpKECu4fQfTgP7h7dg From 79af991c342ff18a310cbb9cdc335295be9035a1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 10:23:46 +0000 Subject: [PATCH 0889/2994] Update ignore. (Logical change 1.254) --- BitKeeper/etc/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 6631b410..ed2d4cb9 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -11,6 +11,7 @@ libntfs/*.8 ntfsprogs/*.8 config.log config.h +config.h.in~ config.cache config.status stamp-h From d88ac0c31390546753a85e2abd6638d30b8fc1ff Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 10:23:46 +0000 Subject: [PATCH 0890/2994] Update ignore. BKrev: 3ffbde325p76KZmQ_SAB1etPmOUz8Q From 5cb1228eef6ac19511fb364c0db00c69bdb07336 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 10:48:24 +0000 Subject: [PATCH 0891/2994] Change version to 1.8.2. (Logical change 1.255) --- configure | 20 ++++++++++---------- configure.ac | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 66a98f89..44503d3a 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.2-WIP. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.2. # # Report bugs to . # @@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.2-WIP' -PACKAGE_STRING='ntfsprogs 1.8.2-WIP' +PACKAGE_VERSION='1.8.2' +PACKAGE_STRING='ntfsprogs 1.8.2' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -939,7 +939,7 @@ 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 ntfsprogs 1.8.2-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1006,7 +1006,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.2-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.2:";; esac cat <<\_ACEOF @@ -1106,7 +1106,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.2-WIP +ntfsprogs configure 1.8.2 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1121,7 +1121,7 @@ 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 ntfsprogs $as_me 1.8.2-WIP, which was +It was created by ntfsprogs $as_me 1.8.2, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1800,7 +1800,7 @@ fi # Define the identity of the package. PACKAGE=ntfsprogs - VERSION=1.8.2-WIP + VERSION=1.8.2 cat >>confdefs.h <<_ACEOF @@ -11155,7 +11155,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.2-WIP, which was +This file was extended by ntfsprogs $as_me 1.8.2, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11218,7 +11218,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.2-WIP +ntfsprogs config.status 1.8.2 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index fcdddfd1..09acf0c5 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.2-WIP, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.2, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) From 5d03514991dc5bd6e0629525806d3063fe2ffefc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 10:48:24 +0000 Subject: [PATCH 0892/2994] Change version to 1.8.2. Missed a bit from Christophe's patch. BKrev: 3ffbe3f84rB-JHR_BspVf0YYXCcj4Q From e691e34ae76b8b39352b158d9cd686eb1555df2f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 10:48:24 +0000 Subject: [PATCH 0893/2994] Missed a bit from Christophe's patch. (Logical change 1.255) --- ntfsprogs/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index c26bcfa7..6841f11e 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -40,7 +40,7 @@ extern const char *ntfs_gpl; #define MAX_PATH 1024 #if !defined(REG_NOERROR) || (REG_NOERROR != 0) -# define REG_NOERROR REG_OKAY +# define REG_NOERROR 0 #endif #define GEN_PRINTF(NAME, STREAM, CONTROL, TRIGGER) \ From dacd601b9fd8a770598fa14dff72094071360422 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 10:48:24 +0000 Subject: [PATCH 0894/2994] Update (Logical change 1.255) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 020da267..51dd78f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ - Compile fixes for DJGPP. (Chrisophe Grenier, me) - Add compatibility for building on FreeBSD. (Christophe Grenier) - Add new compile target "make libs" which only compiles libntfs. + - Note: DJGPP only works with "make libs". not "make" due to absence + of getopt.h, getopt_long(), snprintf(), vsnprintf(). getopt() does + exist (in unistd.h) so we could switch to that if we wanted. 06/01/2004 - 1.8.1 - Important bug fix and various enhancements. - Add new API function attrib.[hc]:ntfs_attr_map_whole_runlist(). From ee06bb014f05cea501712e048ebd8db6cf8ebb4a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 10:52:46 +0000 Subject: [PATCH 0895/2994] Update NEWS. (Logical change 1.256) --- NEWS | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 24a4400f..cacfc5d2 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,11 @@ Current news ============ -ntfsprogs should now compile with DJGPP under DOS, too. Thanks to Christophe -Grenier. +ntfsprogs now compiles and works on FreeBSD. Thanks to Christophe Grenier. + +ntfsprogs now compiles with DJGPP under DOS, too (only "make libs" target, +which is sufficient to write DOS applications using libntfs). Thanks to +Christophe Grenier. Merged the NTFS Gnome VFS module by Jan Kratochvil. From 8d166264dcdb185e1d8d2b4b143a5cc09a2aef61 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 10:52:46 +0000 Subject: [PATCH 0896/2994] Update NEWS. BKrev: 3ffbe4feNlEOwOUjsGPk1zTAw3q1hw From 3244f17522b28ff28500bf688e7a74ebd173849b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 15:03:17 +0000 Subject: [PATCH 0897/2994] Enable lots of compiler warnings and fix warning from libntfs. (Logical change 1.257) --- configure | 4 ++-- configure.ac | 4 ++-- include/attrib.h | 2 ++ include/bootsect.h | 3 +-- include/debug.h | 8 ++++---- include/device.h | 2 +- include/mft.h | 2 +- include/volume.h | 2 ++ libntfs/attrib.c | 4 ++-- libntfs/bootsect.c | 2 +- libntfs/device.c | 4 ++-- libntfs/inode.c | 2 ++ libntfs/lcnalloc.c | 2 +- libntfs/mft.c | 6 +++--- libntfs/runlist.c | 10 +++++----- libntfs/volume.c | 6 ++++-- ntfsprogs/utils.c | 14 +++++++------- ntfsprogs/utils.h | 4 ++-- 18 files changed, 44 insertions(+), 37 deletions(-) diff --git a/configure b/configure index 44503d3a..59ef7e76 100755 --- a/configure +++ b/configure @@ -8249,9 +8249,9 @@ echo "${ECHO_T}$cc_version" >&6 # enable 64-bit (device) file access functions and parameters. CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -Wall" -# Add extra warnings if in maintainer mode. +# Add lots of extra warnings if in maintainer mode. if test "$USE_MAINTAINER_MODE" = "yes";then - CFLAGS="$CFLAGS -Wstrict-prototypes -Wsign-compare" + CFLAGS="$CFLAGS -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare" fi # Add -fms-extensions for gcc-3.2+. diff --git a/configure.ac b/configure.ac index 09acf0c5..0f5d0830 100644 --- a/configure.ac +++ b/configure.ac @@ -136,9 +136,9 @@ AC_MSG_RESULT($cc_version) # enable 64-bit (device) file access functions and parameters. CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -Wall" -# Add extra warnings if in maintainer mode. +# Add lots of extra warnings if in maintainer mode. if test "$USE_MAINTAINER_MODE" = "yes";then - CFLAGS="$CFLAGS -Wstrict-prototypes -Wsign-compare" + CFLAGS="$CFLAGS -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare" fi # Add -fms-extensions for gcc-3.2+. diff --git a/include/attrib.h b/include/attrib.h index 9ed5d54d..f8610261 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -262,6 +262,8 @@ extern int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type, const s64 size); extern int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type); +extern int ntfs_attr_can_be_resident(const ntfs_volume *vol, + const ATTR_TYPES type); extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, const u32 newsize); diff --git a/include/bootsect.h b/include/bootsect.h index d2ad2e57..345f48d9 100644 --- a/include/bootsect.h +++ b/include/bootsect.h @@ -39,8 +39,7 @@ * disregarding the value of silent (but only if configure was run with * --enable-debug). */ -extern BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, - const BOOL silent); +extern BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, BOOL silent); extern int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b); #endif /* defined _NTFS_BOOTSECT_H */ diff --git a/include/debug.h b/include/debug.h index 440d2112..df6b6886 100644 --- a/include/debug.h +++ b/include/debug.h @@ -68,10 +68,10 @@ extern void ntfs_debug_runlist_dump(const runlist_element *rl); #else /* if !DEBUG */ -static __inline__ void Dprintf(const char *fmt, ...) {} -static __inline__ void Dputs(const char *s) {} -static __inline__ void Dperror(const char *s) {} -static __inline__ void ntfs_debug_runlist_dump(const runlist_element *rl) {} +static __inline__ void Dprintf(const char *fmt __attribute__((unused)), ...) {} +static __inline__ void Dputs(const char *s __attribute__((unused))) {} +static __inline__ void Dperror(const char *s __attribute__((unused))) {} +static __inline__ void ntfs_debug_runlist_dump(const runlist_element *rl __attribute__((unused))) {} #endif /* !DEBUG */ diff --git a/include/device.h b/include/device.h index 928ef3f8..615352a8 100644 --- a/include/device.h +++ b/include/device.h @@ -96,7 +96,7 @@ extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, extern s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count, const u32 bksize, void *b); extern s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, - const u32 bksize, const void *b); + const u32 bksize, void *b); extern s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, const s64 count, void *b); diff --git a/include/mft.h b/include/mft.h index ff423fe7..d45ae7a8 100644 --- a/include/mft.h +++ b/include/mft.h @@ -101,7 +101,7 @@ static __inline__ u32 ntfs_mft_record_get_data_size(const MFT_RECORD *m) return le32_to_cpu(m->bytes_in_use); } -extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, u64 start); +extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, s64 start); extern int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni); diff --git a/include/volume.h b/include/volume.h index 4d8c042b..911a6e52 100644 --- a/include/volume.h +++ b/include/volume.h @@ -174,6 +174,8 @@ extern ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, extern ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag); +extern int ntfs_device_umount(ntfs_volume *vol, const BOOL force); + extern ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag); extern int ntfs_umount(ntfs_volume *vol, const BOOL force); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 86555c73..4f205329 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -64,7 +64,7 @@ s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a) * ntfs_get_attribute_value */ s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, - const ATTR_RECORD *a, u8 *b) + const ATTR_RECORD *a, u8 *b) { runlist *rl; s64 total, r; @@ -91,7 +91,7 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, return 0; } - memcpy(b, (char*)a + le16_to_cpu(a->value_offset), + memcpy(b, (const char*)a + le16_to_cpu(a->value_offset), le32_to_cpu(a->value_length)); errno = 0; return (s64)le32_to_cpu(a->value_length); diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index c386e464..df12276c 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -43,7 +43,7 @@ * * Return TRUE if @b contains a valid ntfs boot sector and FALSE if not. */ -BOOL ntfs_boot_sector_is_ntfs(const NTFS_BOOT_SECTOR *b, const BOOL silent) +BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) { u32 i; diff --git a/libntfs/device.c b/libntfs/device.c index 39414392..d6a3592d 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -213,7 +213,7 @@ s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, NDevSetDirty(dev); /* Write the data. */ for (total = 0; count; count -= written, total += written) { - written = dops->write(dev, (char*)b + total, count); + written = dops->write(dev, (const char*)b + total, count); /* If everything ok, continue. */ if (written > 0) continue; @@ -316,7 +316,7 @@ s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count, * achieved. */ s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, - const u32 bksize, const void *b) + const u32 bksize, void *b) { s64 written, i; diff --git a/libntfs/inode.c b/libntfs/inode.c index 81e08fbd..772ccc96 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -47,6 +47,8 @@ static __inline__ ntfs_inode *__ntfs_inode_allocate(ntfs_volume *vol) return ni; } +extern ntfs_inode *ntfs_inode_allocate(ntfs_volume *vol); + /** * Internal: * diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index f960cc14..a8e53b41 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -106,7 +106,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, (long long)start_lcn, zone == MFT_ZONE ? "MFT" : "DATA"); if (!vol || count < 0 || start_lcn < -1 || !vol->lcnbmp_na || - zone < FIRST_ZONE || zone > LAST_ZONE) { + (s8)zone < FIRST_ZONE || zone > LAST_ZONE) { fprintf(stderr, "%s(): Invalid arguments!\n", __FUNCTION__); errno = EINVAL; return NULL; diff --git a/libntfs/mft.c b/libntfs/mft.c index f8497730..5e3b2de1 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -129,7 +129,7 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, if (m + count > vol->nr_mft_records) { // TODO: Need to extend $MFT. This is not just normal attribute // extension as many rules need to be observed. (AIA) - if (bmirr); + if (bmirr) free(bmirr); errno = ENOTSUP; return -1; @@ -253,9 +253,9 @@ read_failed: * * On error return NULL with errno set to the error code. */ -ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, u64 start) +ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, s64 start) { - if (!vol || !vol->mftbmp_na) { + if (!vol || !vol->mftbmp_na || start < -1) { errno = EINVAL; return NULL; } diff --git a/libntfs/runlist.c b/libntfs/runlist.c index c2257223..1a066c5e 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -727,8 +727,8 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, LCN lcn; /* Current lcn. */ s64 deltaxcn; /* Change in [vl]cn. */ runlist_element *rl; /* The output runlist. */ - u8 *buf; /* Current position in mapping pairs array. */ - u8 *attr_end; /* End of attribute. */ + const u8 *buf; /* Current position in mapping pairs array. */ + const u8 *attr_end; /* End of attribute. */ int err, rlsize; /* Size of runlist buffer. */ u16 rlpos; /* Current runlist position in units of runlist_elements. */ @@ -746,9 +746,9 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, vcn = sle64_to_cpu(attr->lowest_vcn); lcn = 0; /* Get start of the mapping pairs array. */ - buf = (u8*)attr + le16_to_cpu(attr->mapping_pairs_offset); - attr_end = (u8*)attr + le32_to_cpu(attr->length); - if (buf < (u8*)attr || buf > attr_end) { + buf = (const u8*)attr + le16_to_cpu(attr->mapping_pairs_offset); + attr_end = (const u8*)attr + le32_to_cpu(attr->length); + if (buf < (const u8*)attr || buf > attr_end) { Dputs("Corrupt attribute."); errno = EIO; return NULL; diff --git a/libntfs/volume.c b/libntfs/volume.c index 7099a2af..c60d1f9f 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -976,7 +976,8 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) * function returns success. If it returns an error then nothing has been done * so it is safe to continue using @vol. */ -int ntfs_device_umount(ntfs_volume *vol, const BOOL force) +int ntfs_device_umount(ntfs_volume *vol, + const BOOL force __attribute__((unused))) { if (!vol) { errno = EINVAL; @@ -1008,7 +1009,8 @@ int ntfs_device_umount(ntfs_volume *vol, const BOOL force) * function returns success. If it returns an error then nothing has been done * so it is safe to continue using @vol. */ -int ntfs_umount(ntfs_volume *vol, const BOOL force) +int ntfs_umount(ntfs_volume *vol, + const BOOL force __attribute__((unused))) { struct ntfs_device *dev; diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 6b6b7fc8..7b60db58 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -298,23 +298,23 @@ int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale) /** * ntfs2utc - Convert an NTFS time to Unix time - * @time: An NTFS time in 100ns units since 1601 + * @ntfs_time: An NTFS time in 100ns units since 1601 * * NTFS stores times as the number of 100ns intervals since January 1st 1601 at * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. * * Return: n A Unix time (number of seconds since 1970) */ -time_t ntfs2utc (s64 time) +time_t ntfs2utc (s64 ntfs_time) { - return (time - (NTFS_TIME_OFFSET)) / 10000000; + return (ntfs_time - (NTFS_TIME_OFFSET)) / 10000000; } /** * utc2ntfs - Convert Linux time to NTFS time - * @time: Linux time to convert to NTFS + * @utc_time: Linux time to convert to NTFS * - * Convert the Linux time @time to its corresponding NTFS time. + * Convert the Linux time @utc_time to its corresponding NTFS time. * * Linux stores time in a long at present and measures it as the number of * 1-second intervals since 1st January 1970, 00:00:00 UTC. @@ -325,10 +325,10 @@ time_t ntfs2utc (s64 time) * * Return: n An NTFS time (100ns units since Jan 1601) */ -s64 utc2ntfs (time_t time) +s64 utc2ntfs (time_t utc_time) { /* Convert to 100ns intervals and then add the NTFS time offset. */ - return (s64)time * 10000000 + NTFS_TIME_OFFSET; + return (s64)utc_time * 10000000 + NTFS_TIME_OFFSET; } /** diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 6841f11e..e4bbffbf 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -80,8 +80,8 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref); int utils_is_metadata (ntfs_inode *inode); ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, const char *pathname); -time_t ntfs2utc (s64 time); -s64 utc2ntfs (time_t time); +time_t ntfs2utc (s64 ntfs_time); +s64 utc2ntfs (time_t utc_time); ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft); From fc3ed9769b3b4b037f9f13f18fa3df807d750b73 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 15:03:17 +0000 Subject: [PATCH 0898/2994] Enable lots of compiler warnings and fix warning from libntfs. BKrev: 3ffc1fb5hkq-c8Eolw5fyJTv_Um40w From f123fba30eb39d1bad7f81481940bc9fddbf6f93 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 15:03:17 +0000 Subject: [PATCH 0899/2994] Update (Logical change 1.257) --- ChangeLog | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51dd78f8..2c34d62e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,12 @@ -06/01/2004 - 1.8.2-WIP - - Compile fixes for DJGPP. (Chrisophe Grenier, me) +07/01/2004 - 1.8.2 - Make ntfsprogs work on FreeBSD. - Add compatibility for building on FreeBSD. (Christophe Grenier) - Add new compile target "make libs" which only compiles libntfs. + - Compile fixes for DJGPP. (Chrisophe Grenier, me) - Note: DJGPP only works with "make libs". not "make" due to absence - of getopt.h, getopt_long(), snprintf(), vsnprintf(). getopt() does + of getopt.h, getopt_long(), snprintf(), and snprintf(). getopt() does exist (in unistd.h) so we could switch to that if we wanted. + - Enable lots of compiler warnings in maintainer mode and fix all + warnings from libntfs. 06/01/2004 - 1.8.1 - Important bug fix and various enhancements. - Add new API function attrib.[hc]:ntfs_attr_map_whole_runlist(). From d8ece48a50af4cc83524de906483df019ca8d32e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 15:47:28 +0000 Subject: [PATCH 0900/2994] Update (Logical change 1.258) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2c34d62e..2f05d728 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ exist (in unistd.h) so we could switch to that if we wanted. - Enable lots of compiler warnings in maintainer mode and fix all warnings from libntfs. + - Fix memory deallocation bug in mft.c spotted by the additional + warnings. 06/01/2004 - 1.8.1 - Important bug fix and various enhancements. - Add new API function attrib.[hc]:ntfs_attr_map_whole_runlist(). From 8999f2dc1db3d6ba155367a74a03f739d3d49e14 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jan 2004 15:47:28 +0000 Subject: [PATCH 0901/2994] Update changelog BKrev: 3ffc2a10tUSDwASBlNq8j0JIOqLOkA From 0636632d5a14ae3f97135fb922658cfa00274162 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0902/2994] (Logical change 1.259) --- libntfs/compress.c | 217 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 libntfs/compress.c diff --git a/libntfs/compress.c b/libntfs/compress.c new file mode 100644 index 00000000..ceeb5c05 --- /dev/null +++ b/libntfs/compress.c @@ -0,0 +1,217 @@ +/* + * compress.c - Compressed attribute handling code. Part of the Linux-NTFS + * project. + * + * Copyright (c) 2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include + +#include "attrib.h" +#include "debug.h" +#include "volume.h" +#include "types.h" +#include "layout.h" +#include "runlist.h" + +/** + * ntfs_compressed_attr_pread - read from a compressed attribute + * @na: ntfs attribute to read from + * @pos: byte position in the attribute to begin reading from + * @count: number of bytes to read + * @b: output data buffer + * + * NOTE: You probably want to be using attrib.c::ntfs_attr_pread() instead. + * + * This function will read @count bytes starting at offset @pos from the + * compressed ntfs attribute @na into the data buffer @b. + * + * On success, return the number of successfully read bytes. If this number + * is lower than @count this means that the read reached end of file or that + * an error was encountered during the read so that the read is partial. + * 0 means end of file or nothing was read (also return 0 when @count is 0). + * + * On error and nothing has been read, return -1 with errno set appropriately + * to the return code of ntfs_pread(), or to EINVAL in case of invalid + * arguments. + */ +s64 ntfs_compressed_attr_pread(ntfs_attr *na, const s64 pos, s64 count, + void *b) +{ + s64 br, to_read, ofs, total, total2; + u64 cb_size_mask; + VCN start_vcn, end_vcn; + ntfs_volume *vol; + runlist_element *rl; + u8 *ntfs_compression_buffer, *ntfs_uncompressed_buffer; + u8 *cb, *cb_pos, *cb_end; + u32 cb_size; + unsigned int nr_cbs, cb_clusters; + + Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x, pos 0x%Lx, " + "count 0x%Lx.\n", __FUNCTION__, + (unsigned long long)na->ni->mft_no, na->type, + (long long)pos, (long long)count); + if (!na || !NAttrCompressed(na) || !na->ni || !na->ni->vol || !b || + pos < 0 || count < 0) { + errno = EINVAL; + return -1; + } + /* + * Encrypted attributes are not supported. We return access denied, + * which is what Windows NT4 does, too. + */ + if (NAttrEncrypted(na)) { + errno = EACCES; + return -1; + } + if (!count) + return 0; + /* Truncate reads beyond end of attribute. */ + if (pos + count > na->data_size) { + if (pos >= na->data_size) + return 0; + count = na->data_size - pos; + } + /* If it is a resident attribute, simply use ntfs_attr_pread(). */ + if (!NAttrNonResident(na)) + return ntfs_attr_pread(na, pos, count, b); + total = total2 = 0; + /* Zero out reads beyond initialized size. */ + if (pos + count > na->initialized_size) { + if (pos >= na->initialized_size) { + memset(b, 0, count); + return count; + } + total2 = pos + count - na->initialized_size; + count -= total2; + memset((u8*)b + count, 0, total2); + } + vol = na->ni->vol; + cb_size = na->compression_block_size; + cb_size_mask = cb_size - 1UL; + cb_clusters = na->compression_block_clusters; + /* Need a temporary buffer for each loaded compression block. */ + ntfs_compression_buffer = malloc(cb_size); + if (!ntfs_compression_buffer) + return -1; + /* Need a temporary buffer for each uncompressed block. */ + ntfs_uncompressed_buffer = malloc(cb_size); + if (!ntfs_uncompressed_buffer) { + int eo = errno; + free(ntfs_compression_buffer); + errno = eo; + return -1; + } + /* + * The first vcn in the first compression block (cb) which we need to + * decompress. + */ + start_vcn = (pos & ~cb_size_mask) >> vol->cluster_size_bits; + /* + * The first vcn in the cb after the last cb which we need to + * decompress. + */ + end_vcn = ((pos + count + cb_size - 1) & ~cb_size_mask) >> + vol->cluster_size_bits; + /* Number of compression blocks (cbs) in the wanted vcn range. */ + nr_cbs = (end_vcn - start_vcn) << vol->cluster_size_bits >> + na->compression_block_size_bits; +do_next_cb: + nr_cbs--; + cb_pos = cb = ntfs_compression_buffer; + cb_end = cb + cb_size; + +// FIXME: I am here... (AIA) + + free(ntfs_compression_buffer); + free(ntfs_uncompressed_buffer); + errno = ENOTSUP; + return -1; + + /* Find the runlist element containing the vcn. */ + rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits); + if (!rl) { + /* + * If the vcn is not present it is an out of bounds read. + * However, we already truncated the read to the data_size, + * so getting this here is an error. + */ + if (errno == ENOENT) + errno = EIO; + return -1; + } + /* + * Gather the requested data into the linear destination buffer. Note, + * a partial final vcn is taken care of by the @count capping of read + * length. + */ + ofs = pos - (rl->vcn << vol->cluster_size_bits); + for (; count; rl++, ofs = 0) { + if (!rl->length) + goto rl_err_out; + if (rl->lcn < (LCN)0) { + if (rl->lcn != (LCN)LCN_HOLE) + goto rl_err_out; + /* It is a hole, just zero the matching @b range. */ + to_read = min(count, (rl->length << + vol->cluster_size_bits) - ofs); + memset(b, 0, to_read); + /* Update progress counters. */ + total += to_read; + count -= to_read; + (u8*)b += to_read; + continue; + } + /* It is a real lcn, read it into @dst. */ + to_read = min(count, (rl->length << vol->cluster_size_bits) - + ofs); +retry: + Dprintf("%s(): Reading 0x%Lx bytes from vcn 0x%Lx, lcn 0x%Lx, " + "ofs 0x%Lx.\n", __FUNCTION__, to_read, + rl->vcn, rl->lcn, ofs); + br = ntfs_pread(vol->dev, (rl->lcn << vol->cluster_size_bits) + + ofs, to_read, b); + /* If everything ok, update progress counters and continue. */ + if (br > 0) { + total += br; + count -= br; + (u8*)b += br; + continue; + } + /* If the syscall was interrupted, try again. */ + if (br == (s64)-1 && errno == EINTR) + goto retry; + if (total) + return total; + if (!br) + errno = EIO; + return -1; + } + /* Finally, return the number of bytes read. */ + return total + total2; +rl_err_out: + if (total) + return total; + errno = EIO; + return -1; +} + From 9c78a8bf4f1ae30c99ecfb7aec20210c581a89e6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0903/2994] Add compress.h to the build system. (Logical change 1.259) --- include/Makefile.am | 1 + include/Makefile.in | 1 + libntfs/Makefile.am | 1 + libntfs/Makefile.in | 13 ++++++++----- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/Makefile.am b/include/Makefile.am index 605f50cc..a89a340d 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -5,6 +5,7 @@ linux_ntfsinclude_HEADERS = \ bitmap.h \ bootsect.h \ compat.h \ + compress.h \ debug.h \ device.h \ device_io.h \ diff --git a/include/Makefile.in b/include/Makefile.in index 0210d43e..16a91271 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -102,6 +102,7 @@ linux_ntfsinclude_HEADERS = \ bitmap.h \ bootsect.h \ compat.h \ + compress.h \ debug.h \ device.h \ device_io.h \ diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 4cc8cba5..93c434d0 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -38,6 +38,7 @@ libntfs_la_SOURCES = \ bitmap.c \ bootsect.c \ compat.c \ + compress.c \ debug.c \ device.c \ device_io.c \ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 6075450e..6d02058e 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -135,6 +135,7 @@ libntfs_la_SOURCES = \ bitmap.c \ bootsect.c \ compat.c \ + compress.c \ debug.c \ device.c \ device_io.c \ @@ -180,8 +181,8 @@ am_libntfs_gnomevfs_la_OBJECTS = libntfs_gnomevfs_la-gnome-vfs-method.lo \ libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) libntfs_la_LIBADD = am_libntfs_la_OBJECTS = attrib.lo bitmap.lo bootsect.lo compat.lo \ - debug.lo device.lo device_io.lo dir.lo inode.lo lcnalloc.lo \ - mft.lo mst.lo runlist.lo unistr.lo volume.lo + compress.lo debug.lo device.lo device_io.lo dir.lo inode.lo \ + lcnalloc.lo mft.lo mst.lo runlist.lo unistr.lo volume.lo libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) DEFS = @DEFS@ @@ -190,9 +191,10 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrib.Plo ./$(DEPDIR)/bitmap.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/bootsect.Plo ./$(DEPDIR)/compat.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/debug.Plo ./$(DEPDIR)/device.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/device_io.Plo ./$(DEPDIR)/dir.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/inode.Plo ./$(DEPDIR)/lcnalloc.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/compress.Plo ./$(DEPDIR)/debug.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/device.Plo ./$(DEPDIR)/device_io.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/dir.Plo ./$(DEPDIR)/inode.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/lcnalloc.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/mft.Plo ./$(DEPDIR)/mst.Plo \ @@ -301,6 +303,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bootsect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compress.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device_io.Plo@am__quote@ From a7a6c5cfe53f36bac6d46aed598e6ede47e689c9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0904/2994] Fix the previous update... 2004/01/09 10:50:25+00:00 cantab.net!aia21 Update for newer glibc. (Logical change 1.259) --- ntfsprogs/mkntfs.c | 55 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index d94f4eb2..ae5c9683 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1,7 +1,7 @@ /** * mkntfs - Part of the Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * Copyright (c) 2001-2003 Richard Russon * * This utility will create an NTFS 1.2 (Windows NT 4.0) volume on a user @@ -73,14 +73,41 @@ #include #ifdef HAVE_LINUX_MAJOR_H # include -#endif -#ifndef MAJOR -# define MAJOR(dev) ((dev) >> 8) -# define MINOR(dev) ((dev) & 0xff) -#endif -#ifndef SCSI_BLK_MAJOR -# define SCSI_BLK_MAJOR(m) ((m) == SCSI_DISK_MAJOR || \ - (m) == SCSI_CDROM_MAJOR) +# ifndef MAJOR +# define MAJOR(dev) ((dev) >> 8) +# define MINOR(dev) ((dev) & 0xff) +# endif +# ifndef IDE_DISK_MAJOR +# ifndef IDE0_MAJOR +# define IDE0_MAJOR 3 +# define IDE1_MAJOR 22 +# define IDE2_MAJOR 33 +# define IDE3_MAJOR 34 +# define IDE4_MAJOR 56 +# define IDE5_MAJOR 57 +# define IDE6_MAJOR 88 +# define IDE7_MAJOR 89 +# define IDE8_MAJOR 90 +# define IDE9_MAJOR 91 +# endif +# define IDE_DISK_MAJOR(M) \ + ((M) == IDE0_MAJOR || (M) == IDE1_MAJOR || \ + (M) == IDE2_MAJOR || (M) == IDE3_MAJOR || \ + (M) == IDE4_MAJOR || (M) == IDE5_MAJOR || \ + (M) == IDE6_MAJOR || (M) == IDE7_MAJOR || \ + (M) == IDE8_MAJOR || (M) == IDE9_MAJOR) +# endif +# ifndef SCSI_DISK_MAJOR +# ifndef SCSI_DISK0_MAJOR +# define SCSI_DISK0_MAJOR 8 +# define SCSI_DISK1_MAJOR 65 +# define SCSI_DISK7_MAJOR 71 +# endif +# define SCSI_DISK_MAJOR(M) \ + ((M) == SCSI_DISK0_MAJOR || \ + ((M) >= SCSI_DISK1_MAJOR && \ + (M) <= SCSI_DISK7_MAJOR)) +# endif #endif #include @@ -96,7 +123,6 @@ #include "mst.h" #include "dir.h" #include "runlist.h" -//#include "debug.h" #include "utils.h" extern const unsigned char attrdef_ntfs12_array[2400]; @@ -2600,12 +2626,15 @@ int main(int argc, char **argv) fprintf(stderr, "mkntfs forced anyway.\n"); } #ifdef HAVE_LINUX_MAJOR_H - else if ((MAJOR(sbuf.st_rdev) == HD_MAJOR && + else if ((IDE_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 64 == 0) || - (SCSI_BLK_MAJOR(MAJOR(sbuf.st_rdev)) && + (SCSI_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 16 == 0)) { - err_exit("%s is entire device, not just one partition!\n", + Eprintf("%s is entire device, not just one partition.\n", vol->dev->d_name); + if (!opts.force) + err_exit("Refusing to make a filesystem here!\n"); + fprintf(stderr, "mkntfs forced anyway.\n"); } #endif /* Make sure the file system is not mounted. */ From 010e735129a0a1d21d3bafc0ffe57c896e2a9eb3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0905/2994] Initial revision --- include/compress.h | 0 libntfs/compress.c | 217 --------------------------------------------- 2 files changed, 217 deletions(-) create mode 100644 include/compress.h diff --git a/include/compress.h b/include/compress.h new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/compress.c b/libntfs/compress.c index ceeb5c05..e69de29b 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -1,217 +0,0 @@ -/* - * compress.c - Compressed attribute handling code. Part of the Linux-NTFS - * project. - * - * Copyright (c) 2004 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include - -#include "attrib.h" -#include "debug.h" -#include "volume.h" -#include "types.h" -#include "layout.h" -#include "runlist.h" - -/** - * ntfs_compressed_attr_pread - read from a compressed attribute - * @na: ntfs attribute to read from - * @pos: byte position in the attribute to begin reading from - * @count: number of bytes to read - * @b: output data buffer - * - * NOTE: You probably want to be using attrib.c::ntfs_attr_pread() instead. - * - * This function will read @count bytes starting at offset @pos from the - * compressed ntfs attribute @na into the data buffer @b. - * - * On success, return the number of successfully read bytes. If this number - * is lower than @count this means that the read reached end of file or that - * an error was encountered during the read so that the read is partial. - * 0 means end of file or nothing was read (also return 0 when @count is 0). - * - * On error and nothing has been read, return -1 with errno set appropriately - * to the return code of ntfs_pread(), or to EINVAL in case of invalid - * arguments. - */ -s64 ntfs_compressed_attr_pread(ntfs_attr *na, const s64 pos, s64 count, - void *b) -{ - s64 br, to_read, ofs, total, total2; - u64 cb_size_mask; - VCN start_vcn, end_vcn; - ntfs_volume *vol; - runlist_element *rl; - u8 *ntfs_compression_buffer, *ntfs_uncompressed_buffer; - u8 *cb, *cb_pos, *cb_end; - u32 cb_size; - unsigned int nr_cbs, cb_clusters; - - Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x, pos 0x%Lx, " - "count 0x%Lx.\n", __FUNCTION__, - (unsigned long long)na->ni->mft_no, na->type, - (long long)pos, (long long)count); - if (!na || !NAttrCompressed(na) || !na->ni || !na->ni->vol || !b || - pos < 0 || count < 0) { - errno = EINVAL; - return -1; - } - /* - * Encrypted attributes are not supported. We return access denied, - * which is what Windows NT4 does, too. - */ - if (NAttrEncrypted(na)) { - errno = EACCES; - return -1; - } - if (!count) - return 0; - /* Truncate reads beyond end of attribute. */ - if (pos + count > na->data_size) { - if (pos >= na->data_size) - return 0; - count = na->data_size - pos; - } - /* If it is a resident attribute, simply use ntfs_attr_pread(). */ - if (!NAttrNonResident(na)) - return ntfs_attr_pread(na, pos, count, b); - total = total2 = 0; - /* Zero out reads beyond initialized size. */ - if (pos + count > na->initialized_size) { - if (pos >= na->initialized_size) { - memset(b, 0, count); - return count; - } - total2 = pos + count - na->initialized_size; - count -= total2; - memset((u8*)b + count, 0, total2); - } - vol = na->ni->vol; - cb_size = na->compression_block_size; - cb_size_mask = cb_size - 1UL; - cb_clusters = na->compression_block_clusters; - /* Need a temporary buffer for each loaded compression block. */ - ntfs_compression_buffer = malloc(cb_size); - if (!ntfs_compression_buffer) - return -1; - /* Need a temporary buffer for each uncompressed block. */ - ntfs_uncompressed_buffer = malloc(cb_size); - if (!ntfs_uncompressed_buffer) { - int eo = errno; - free(ntfs_compression_buffer); - errno = eo; - return -1; - } - /* - * The first vcn in the first compression block (cb) which we need to - * decompress. - */ - start_vcn = (pos & ~cb_size_mask) >> vol->cluster_size_bits; - /* - * The first vcn in the cb after the last cb which we need to - * decompress. - */ - end_vcn = ((pos + count + cb_size - 1) & ~cb_size_mask) >> - vol->cluster_size_bits; - /* Number of compression blocks (cbs) in the wanted vcn range. */ - nr_cbs = (end_vcn - start_vcn) << vol->cluster_size_bits >> - na->compression_block_size_bits; -do_next_cb: - nr_cbs--; - cb_pos = cb = ntfs_compression_buffer; - cb_end = cb + cb_size; - -// FIXME: I am here... (AIA) - - free(ntfs_compression_buffer); - free(ntfs_uncompressed_buffer); - errno = ENOTSUP; - return -1; - - /* Find the runlist element containing the vcn. */ - rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits); - if (!rl) { - /* - * If the vcn is not present it is an out of bounds read. - * However, we already truncated the read to the data_size, - * so getting this here is an error. - */ - if (errno == ENOENT) - errno = EIO; - return -1; - } - /* - * Gather the requested data into the linear destination buffer. Note, - * a partial final vcn is taken care of by the @count capping of read - * length. - */ - ofs = pos - (rl->vcn << vol->cluster_size_bits); - for (; count; rl++, ofs = 0) { - if (!rl->length) - goto rl_err_out; - if (rl->lcn < (LCN)0) { - if (rl->lcn != (LCN)LCN_HOLE) - goto rl_err_out; - /* It is a hole, just zero the matching @b range. */ - to_read = min(count, (rl->length << - vol->cluster_size_bits) - ofs); - memset(b, 0, to_read); - /* Update progress counters. */ - total += to_read; - count -= to_read; - (u8*)b += to_read; - continue; - } - /* It is a real lcn, read it into @dst. */ - to_read = min(count, (rl->length << vol->cluster_size_bits) - - ofs); -retry: - Dprintf("%s(): Reading 0x%Lx bytes from vcn 0x%Lx, lcn 0x%Lx, " - "ofs 0x%Lx.\n", __FUNCTION__, to_read, - rl->vcn, rl->lcn, ofs); - br = ntfs_pread(vol->dev, (rl->lcn << vol->cluster_size_bits) + - ofs, to_read, b); - /* If everything ok, update progress counters and continue. */ - if (br > 0) { - total += br; - count -= br; - (u8*)b += br; - continue; - } - /* If the syscall was interrupted, try again. */ - if (br == (s64)-1 && errno == EINTR) - goto retry; - if (total) - return total; - if (!br) - errno = EIO; - return -1; - } - /* Finally, return the number of bytes read. */ - return total + total2; -rl_err_out: - if (total) - return total; - errno = EIO; - return -1; -} - From aa3c49bc5bc3f78cd0ac449e1949ca2d519fccd3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0906/2994] Patch from Matthew Fanto with fixups from me. (Logical change 1.259) --- ntfsprogs/ntfsinfo.c | 341 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 288 insertions(+), 53 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 65932059..449779bb 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1,8 +1,8 @@ /** * ntfsinfo - Part of the Linux-NTFS project. * - * Copyright (c) 2002 Matthew J. Fanto - * Copyright (c) 2002-2003 Anton Altaparmakov + * Copyright (c) 2002-2004 Matthew J. Fanto + * Copyright (c) 2002-2004 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon * * This utility will dump a file's attributes. @@ -22,13 +22,34 @@ * distribution in the file COPYING); if not, write to the Free Software * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* TODO LIST: + * 1. Better error checking. In fact, my error checking sucks. + * 2. Fix output issues. + * 3. Check on the 72/48 issue + * 4. Comment things better + * + * Still not dumping certain attributes. Need to find the best + * way to output some of these attributes. + * + * Still need to do: + * $OBJECT_ID - dump correctly + * $SECURITY_DESCRIPTOR + */ + + + #include "config.h" #include #include +#include #include #include +#ifdef HAVE_ERRNO_H +#include +#endif + #include "types.h" #include "mft.h" #include "attrib.h" @@ -46,6 +67,7 @@ static struct options { int force; /* Override common sense */ int epochtime; /* Report all timestamps as "Thu Jan 1 00:00:00 1970" */ int notime; /* Don't report timestamps at all */ + int mft; /* Dump information about the volume as well */ } opts; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) @@ -64,7 +86,7 @@ void version (void) printf ("\n%s v%s - Display information about an NTFS Volume.\n\n", EXEC_NAME, VERSION); printf ("Copyright (c)\n"); - printf (" 2002 Matthew J. Fanto\n"); + printf (" 2002-2004 Matthew J. Fanto\n"); printf (" 2002 Anton Altaparmakov\n"); printf (" 2002-2003 Richard Russon\n"); printf (" 2003 Leonard Norrgĺrd\n"); @@ -83,6 +105,7 @@ void usage (void) printf ("\nUsage: %s [options] -d dev\n" " -d dev --device dev The ntfs volume to display information about\n" " -i num --inode num Display information about this inode\n" + " -m --mft Dump information about the volume\n" " -t --epochtime Report all timestamps as \"Thu Jan 1 00:00:00 1970\"\n" " -T --notime Don't report timestamps at all\n" "\n" @@ -117,6 +140,7 @@ int parse_options (int argc, char *argv[]) { "version", no_argument, NULL, 'V' }, { "epochtime", no_argument, NULL, 't' }, { "notime", no_argument, NULL, 'T' }, + { "mft", no_argument, NULL, 'm' }, { NULL, 0, NULL, 0 }, }; @@ -167,6 +191,9 @@ int parse_options (int argc, char *argv[]) case 'V': ver++; break; + case 'm': + opts.mft++; + break; default: if ((optopt == 'i') && (!optarg)) { Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); @@ -213,20 +240,135 @@ int parse_options (int argc, char *argv[]) } +/** + * ntfs_dump_volume - dump information about the volume + */ +void ntfs_dump_volume(ntfs_volume *vol) +{ + + printf("Volume Information \n"); + printf("\tName of device: %s\n", vol->dev->d_name); + printf("\tDevice state: %lu\n", vol->dev->d_state); + printf("\tVolume Name: %s\n", vol->vol_name); + printf("\tVolume State: %lu\n", vol->state); + printf("\tVolume Version: %u.%u\n", vol->major_ver, vol->minor_ver); + printf("\tSector Size: %hu\n", vol->sector_size); + printf("\tCluster Size: %u\n", vol->cluster_size); + printf("\tVolume Size in Clusters: %lld\n", vol->nr_clusters); + + + printf("MFT Information \n"); + printf("\tMFT Record Size: %u\n", vol->mft_record_size); + printf("\tMFT Zone Multiplier: %u\n", vol->mft_zone_multiplier); + printf("\tMFT Data Position: %lld\n", vol->mft_data_pos); + printf("\tMFT Zone Start: %lld\n", vol->mft_zone_start); + printf("\tMFT Zone End: %lld\n", vol->mft_zone_end); + printf("\tMFT Zone Position: %lld\n", vol->mft_zone_pos); + printf("\tCurrent Position in First Data Zone: %lld\n", vol->data1_zone_pos); + printf("\tCurrent Position in Second Data Zone: %lld\n", vol->data2_zone_pos); + printf("\tNumber of Records in MFT: %lld\n", vol->nr_mft_records); + printf("\tLCN of Data Attribute for FILE_MFT: %lld\n", vol->mft_lcn); + printf("\tFILE_MFTMirr Size: %d\n", vol->mftmirr_size); + printf("\tLCN of Data Attribute for File_MFTMirr: %lld\n", vol->mftmirr_lcn); + printf("\tSize of Attribute Definition Table: %d\n", vol->attrdef_len); + + + printf("FILE_Bitmap Information \n"); + printf("\tFILE_Bitmap MFT Record Number: %lld\n", vol->lcnbmp_ni->mft_no); + printf("\tState of FILE_Bitmap Inode: %lu\n", vol->lcnbmp_ni->state); + printf("\tLength of Attribute List: %u\n", vol->lcnbmp_ni->attr_list_size); + printf("\tAttribute List: %s\n", vol->lcnbmp_ni->attr_list); + printf("\tNumber of Attached Extent Inodes: %d\n", vol->lcnbmp_ni->nr_extents); + //FIXME: need to add code for the union if nr_extens != 0, but + //i dont know if it will ever != 0 with FILE_Bitmap + + printf("FILE_Bitmap Data Attribute Information\n"); + printf("\tDecompressed Runlist: not done yet\n"); + printf("\tBase Inode: %lld\n", vol->lcnbmp_na->ni->mft_no); + printf("\tAttribute Types: not done yet\n"); + //printf("\tAttribute Name: %s\n", vol->lcnbmp_na->name); + printf("\tAttribute Name Length: %u\n", vol->lcnbmp_na->name_len); + printf("\tAttribute State: %lu\n", vol->lcnbmp_na->state); + printf("\tAttribute Allocated Size: %lld\n", vol->lcnbmp_na->allocated_size); + printf("\tAttribute Data Size: %lld\n", vol->lcnbmp_na->data_size); + printf("\tAttribute Initialized Size: %lld\n", vol->lcnbmp_na->initialized_size); + printf("\tAttribute Compressed Size: %lld\n", vol->lcnbmp_na->compressed_size); + printf("\tCompression Block Size: %u\n", vol->lcnbmp_na->compression_block_size); + printf("\tCompression Block Size Bits: %u\n", vol->lcnbmp_na->compression_block_size_bits); + printf("\tCompression Block Clusters: %u\n", vol->lcnbmp_na->compression_block_clusters); + + + //TODO: Still need to add a few more attributes + +} + + + +/** + * ntfs_dump_standard_information + */ +void ntfs_dump_standard_information_attr(ntfs_inode *inode) +{ + + STANDARD_INFORMATION *standard_attr = NULL; + ATTR_RECORD *attr = NULL; + ntfs_attr_search_ctx *ctx = NULL; + + ctx = ntfs_attr_get_search_ctx(inode, NULL); + + if(ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_STANDARD_INFORMATION!\n"); + ntfs_attr_put_search_ctx(ctx); //free ctx + return; + } + + attr = ctx->attr; + + standard_attr = (STANDARD_INFORMATION*)((char *)attr + le16_to_cpu(attr->value_offset)); + + printf("Dumping $STANDARD_INFORMATION (0x10)\n"); + + //check with flatcap/anton and make sure this is correct + if (sizeof(STANDARD_INFORMATION) == 48) { + printf("\t$STANDARD_INFORMATION fields maximum_versions, version_number, \ + class_id, owner_id, security_id missing. This volume has \ + not been upgraded\n"); + } + if (sizeof(STANDARD_INFORMATION) == 72) { + printf("\tMaximum Number of Versions: \t %d \n", le32_to_cpu (standard_attr->maximum_versions)); + printf("\tVersion Number: \t\t %d \n", le32_to_cpu (standard_attr->version_number)); + printf("\tClass ID: \t\t\t %d \n", le32_to_cpu (standard_attr->class_id)); + printf("\tUser ID: \t\t\t %d \n", le32_to_cpu (standard_attr->owner_id)); + printf("\tSecurity ID: \t\t\t %d \n", le32_to_cpu (standard_attr->security_id)); + } + + else { + printf("\tSize of STANDARD_INFORMATION is %d. It should be either 72 or 48, \ + something is wrong...\n",sizeof(STANDARD_INFORMATION)); + } + + + ntfs_attr_put_search_ctx(ctx); //free ctx + +} + + + /** * ntfs_dump_file_name_attribute */ -void ntfs_dump_file_name_attribute(ntfs_inode *inode, MFT_RECORD *mrec) +void ntfs_dump_file_name_attr(ntfs_inode *inode) { FILE_NAME_ATTR *file_name_attr = NULL; ATTR_RECORD *attr = NULL; ntfs_attr_search_ctx *ctx = NULL; char *file_name = NULL; - ctx = ntfs_attr_get_search_ctx(inode, mrec); + ctx = ntfs_attr_get_search_ctx(inode, NULL); if(ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { fprintf(stderr, "ntfsinfo error: cannot lookup attribute AT_FILE_NAME!\n"); + ntfs_attr_put_search_ctx(ctx); //free ctx return; } @@ -241,94 +383,187 @@ void ntfs_dump_file_name_attribute(ntfs_inode *inode, MFT_RECORD *mrec) printf("Dumping $FILE_NAME (0x30)\n"); //basic stuff about the file - printf("File Name: \t\t %s\n",file_name); - printf("File Name Length: \t %d\n",file_name_attr->file_name_length); - printf("Allocated File Size: \t %lld\n", sle64_to_cpu(file_name_attr->allocated_size)); - printf("Real File Size: \t %lld\n", sle64_to_cpu(file_name_attr->data_size)); + printf("\tFile Name: \t\t %s\n",file_name); + printf("\tFile Name Length: \t %d\n",file_name_attr->file_name_length); + printf("\tAllocated File Size: \t %lld\n", sle64_to_cpu(file_name_attr->allocated_size)); + printf("\tReal File Size: \t %lld\n", sle64_to_cpu(file_name_attr->data_size)); //time conversion stuff if (!opts.notime) { time_t ntfs_time = { 0 }; - + if (!opts.epochtime) { ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->creation_time)); - printf("File Creation Time: \t %s",ctime(&ntfs_time)); + printf("\tFile Creation Time: \t %s",ctime(&ntfs_time)); ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_data_change_time)); - printf("File Altered Time: \t %s",ctime(&ntfs_time)); + printf("\tFile Altered Time: \t %s",ctime(&ntfs_time)); ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_mft_change_time)); - printf("MFT Changed Time: \t %s",ctime(&ntfs_time)); + printf("\tMFT Changed Time: \t %s",ctime(&ntfs_time)); ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_access_time)); - printf("Last Accessed Time: \t %s",ctime(&ntfs_time)); + printf("\tLast Accessed Time: \t %s",ctime(&ntfs_time)); } else { char *t = asctime(gmtime(&ntfs_time)); - - printf("File Creation Time: \t %s",t); - printf("File Altered Time: \t %s",t); - printf("MFT Changed Time: \t %s",t); - printf("Last Accessed Time: \t %s",t); + printf("\tFile Creation Time: \t %s",t); + printf("\tFile Altered Time: \t %s",t); + printf("\tMFT Changed Time: \t %s",t); + printf("\tLast Accessed Time: \t %s",t); } } + free(file_name); + ntfs_attr_put_search_ctx(ctx); //free ctx } -/** - * ntfs_dump_standard_information + +/* + * ntfs_dump_object_id + * + * dump the $OBJECT_ID attribute - not present on all systems + * */ -void ntfs_dump_standard_information(ntfs_inode *inode, MFT_RECORD *mrec) +void ntfs_dump_object_id_attr(ntfs_inode *inode) { + + OBJECT_ID_ATTR *obj_id_attr = NULL; + ATTR_RECORD *attr = NULL; + ntfs_attr_search_ctx *ctx = NULL; - STANDARD_INFORMATION *standard_attr = NULL; - ATTR_RECORD *attr = NULL; - ntfs_attr_search_ctx *ctx = NULL; + ctx = ntfs_attr_get_search_ctx(inode, NULL); - ctx = ntfs_attr_get_search_ctx(inode, mrec); + if(ntfs_attr_lookup(AT_OBJECT_ID, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_OBJECT_ID: %s\n", + strerror(errno)); + ntfs_attr_put_search_ctx(ctx); + return; + } - if(ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_STANDARD_INFORMATION!\n"); - return; - } + attr = ctx->attr; - attr = ctx->attr; + obj_id_attr = (OBJECT_ID_ATTR*)((char *)attr + le16_to_cpu(attr->value_offset)); //the attribute plus the offset - standard_attr = (STANDARD_INFORMATION*)((char *)attr + le16_to_cpu(attr->value_offset)); + printf("Dumping $OBJECT_ID (0x40)\n"); - printf("Dumping $STANDARD_INFORMATION (0x10)\n"); + //I believe these attributes are only present on volume versions > 3.0. It was introduced + //in Win2k, which is 3.0 - printf("Maximum Number of Versions: \t %d \n", le32_to_cpu (standard_attr->maximum_versions)); - printf("Version Number: \t\t %d \n", le32_to_cpu (standard_attr->version_number)); - printf("Class ID: \t\t\t %d \n", le32_to_cpu (standard_attr->class_id)); - printf("User ID: \t\t\t %d \n", le32_to_cpu (standard_attr->owner_id)); - printf("Security ID: \t\t\t %d \n", le32_to_cpu (standard_attr->security_id)); + //FIXME: Need to do a check to make sure these attributes are actually present + //even if it is > 3.0. + if (inode->vol->major_ver >= 3.0) { + printf("\tVolume Version > 3.0... Dumping Attributes\n"); + + //printf("\tObject ID: \t\t\t %d\n", obj_id_attr->object_id); + //printf("\tBirth Volume ID: \t\t\t %d\n", obj_id_attr->birth_volume_id); + //printf("\tBirth Object ID: \t\t\t %d\n", obj_id_attr->birth_object_id); + } + else + printf("\t$OBJECT_ID not present. Only NTFS versions > 3.0 have $OBJECT_ID. \ + Your version of NTFS is %d\n", inode->vol->major_ver); + + ntfs_attr_put_search_ctx(ctx); } + +/* + * ntfs_dump_volume_name() + * + * dump the name of the volume the inode belongs to + * + */ +void ntfs_dump_volume_name_attr(ntfs_inode *inode) +{ + VOLUME_NAME *vol_name = NULL; + ATTR_RECORD *attr = NULL; + ntfs_attr_search_ctx *ctx = NULL; + + ctx = ntfs_attr_get_search_ctx(inode, NULL); + + if(ntfs_attr_lookup(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_VOLUME_NAME: %s\n", + strerror(errno)); + ntfs_attr_put_search_ctx(ctx); + return; + } + + attr = ctx->attr; + + vol_name = (VOLUME_NAME*)((char *)attr + le16_to_cpu(attr->value_offset)); + + printf("Dumping $VOLUME_NAME (0x60)\n"); + + //printf("\tVolume Name: \t\t\t %s\n", vol_name->name); + + ntfs_attr_put_search_ctx(ctx); +} + + +/* + * ntfs_dump_volume_information() + * + * dump the information for the volume the inode belongs to + * + */ +void ntfs_dump_volume_information_attr(ntfs_inode *inode) +{ + VOLUME_INFORMATION *vol_information = NULL; + ATTR_RECORD *attr = NULL; + ntfs_attr_search_ctx *ctx = NULL; + + ctx = ntfs_attr_get_search_ctx(inode, NULL); + + if(ntfs_attr_lookup(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_VOLUME_INFORMATION: %s\n", + strerror(errno)); + ntfs_attr_put_search_ctx(ctx); + return; + } + + attr = ctx->attr; + + vol_information = (VOLUME_INFORMATION*)((char *)attr + le16_to_cpu(attr->value_offset)); + + printf("Dumping $VOLUME_INFORMATION (0x70)\n"); + + printf("\tVolume Major Version: \t\t\t %d\n", vol_information->major_ver); + printf("\tVolume Minor Version: \t\t\t %d\n", vol_information->minor_ver); + printf("\tFlags: \t\t\t Not Finished Yet! \n"); + + ntfs_attr_put_search_ctx(ctx); +} + + + /** * ntfs_get_file_attributes */ -void ntfs_get_file_attributes(ntfs_volume *vol, s64 i) +void ntfs_get_file_attributes(ntfs_volume *vol, s64 mft_no, int dump_volume) { - MFT_REF mref; - MFT_RECORD *mrec = NULL; - //ntfs_attr_search_ctx *ctx = NULL; ntfs_inode *inode = NULL; //int error; - mref = (MFT_REF) i; - inode = ntfs_inode_open(vol, mref); + inode = ntfs_inode_open(vol, MK_MREF(mft_no, 0)); - if (ntfs_file_record_read(vol, mref, &mrec, NULL)) { - fprintf(stderr, "ntfsinfo error: error reading file record!\n"); - exit(1); - } + /* if opts.mft is not 0, then we will print out information about + * the volume, such as the sector size and whatnot. + */ +// if (dump_volume) + ntfs_dump_volume(vol); - //see flatcap.org/ntfs/info for what formatting should look like - //ntfs_dump_boot_sector_information(inode, mrec); - ntfs_dump_file_name_attribute(inode, mrec); - ntfs_dump_standard_information(inode, mrec); + + //see flatcap.org/ntfs/info for what formatting should look likei + //FIXME: both $FILE_NAME_ATTR and $STANDARD_INFORMATION has times, when do + //we want to output it? + ntfs_dump_standard_information_attr(inode); + ntfs_dump_file_name_attr(inode); + ntfs_dump_object_id_attr(inode); + ntfs_dump_volume_name_attr(inode); + ntfs_dump_volume_information_attr(inode); + + ntfs_inode_close(inode); } /** @@ -352,7 +587,7 @@ int main(int argc, char **argv) if (!vol) return 1; - ntfs_get_file_attributes (vol, opts.inode); + ntfs_get_file_attributes (vol, opts.inode, opts.mft); ntfs_umount (vol, FALSE); return 0; From 4d7f189a9d94cadcafa2f39cf6080ed77565acc1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0907/2994] Started on compressed attribute reading. Update Matthew Fanto's email address. Apply patch to ntfsinfo from Matthew Fanto (plus some fixes from me). Update mkntfs linux/major.h support for more recent glibc. BKrev: 3ffea0e0wnDv67NJFKIqsvGAAoE9dg From 5aa2088a95eb1a32410cc5f0582b1bcd2eaebcb7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0908/2994] Update (Logical change 1.259) --- README | 2 +- include/device.h | 2 +- include/endians.h | 2 +- libntfs/device.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README b/README index fb648de0..4daf7ed3 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ Linux-NTFS The Linux-NTFS project aims to bring full support for the NTFS filesystem to the Linux operating system. -Linux-NTFS is copyright (c) 2000-2003 Anton Altaparmakov. +Linux-NTFS is copyright (c) 2000-2004 Anton Altaparmakov. All of the contents of the Linux-NTFS project are free software, released under the GNU General Public License and you are welcome to redistribute them under diff --git a/include/device.h b/include/device.h index 615352a8..b5884d03 100644 --- a/include/device.h +++ b/include/device.h @@ -1,7 +1,7 @@ /* * device.h - Exports for low level device io. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published diff --git a/include/endians.h b/include/endians.h index b57bdef8..8debf61c 100644 --- a/include/endians.h +++ b/include/endians.h @@ -2,7 +2,7 @@ * endians.h - Definitions related to handling of byte ordering. Part of the * Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published diff --git a/libntfs/device.c b/libntfs/device.c index d6a3592d..1ed7068f 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -1,7 +1,7 @@ /* * device.c - Low level device io functions. Part of the Linux-NTFS project. * - * Copyright (c) 2003 Anton Altaparmakov + * Copyright (c) 2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published From dff41545772fd92efabdfd2f113b1be011bc9e5e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0909/2994] Update 2004/01/08 17:13:00+00:00 cantab.net!aia21 (Logical change 1.259) --- include/compress.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/include/compress.h b/include/compress.h index e69de29b..c21a3cf5 100644 --- a/include/compress.h +++ b/include/compress.h @@ -0,0 +1,33 @@ +/* + * compress.h - Exports for compressed attribute handling. Part of the + * Linux-NTFS project. + * + * Copyright (c) 2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_COMPRESS_H +#define _NTFS_COMPRESS_H + +#include "types.h" +#include "attrib.h" + +extern s64 ntfs_compressed_attr_pread(ntfs_attr *na, const s64 pos, s64 count, + void *b); + +#endif /* defined _NTFS_COMPRESS_H */ + From 29e697f63a244263bad5ed5056436006dcd5c2af Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0910/2994] Update 2004/01/08 17:13:00+00:00 cantab.net!aia21 Add reading of compressed attributes. (Logical change 1.259) --- libntfs/attrib.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 4f205329..89f42689 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1,7 +1,7 @@ /* * attrib.c - Attribute handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * Copyright (c) 2002 Richard Russon * * This program/include file is free software; you can redistribute it and/or @@ -39,6 +39,7 @@ #include "runlist.h" #include "lcnalloc.h" #include "dir.h" +#include "compress.h" uchar_t AT_UNNAMED[] = { const_cpu_to_le16('\0') }; @@ -701,23 +702,20 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) errno = EINVAL; return -1; } - vol = na->ni->vol; /* - * Encrypted attributes are not supported. We return access denied, + * If this is a compressed attribute it needs special treatment, but + * only if it is non-resident. + */ + if (NAttrCompressed(na) && NAttrNonResident(na)) + return ntfs_compressed_attr_pread(na, pos, count, b); + /* + * Encrypted attributes are not supported. We return access denied, * which is what Windows NT4 does, too. */ if (NAttrEncrypted(na)) { errno = EACCES; return -1; } - /* If this is a compressed attribute it needs special treatment. */ - if (NAttrCompressed(na)) { - // TODO: Implement reading compressed attributes! (AIA) - // return ntfs_attr_pread_compressed(ntfs_attr *na, - // const s64 pos, s64 count, void *b); - errno = ENOTSUP; - return -1; - } if (!count) return 0; /* Truncate reads beyond end of attribute. */ @@ -726,6 +724,7 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) return 0; count = na->data_size - pos; } + vol = na->ni->vol; /* If it is a resident attribute, get the value from the mft record. */ if (!NAttrNonResident(na)) { ntfs_attr_search_ctx *ctx; @@ -2689,10 +2688,6 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) return -1; } - /* Read and cache the whole runlist if not already done. */ - if (ntfs_attr_map_whole_runlist(na)) - return -1; - /* Work out offsets into and size of the resident attribute. */ name_ofs = 24; /* = sizeof(resident_ATTR_REC); */ val_ofs = (name_ofs + a->name_length + 7) & ~7; @@ -2705,6 +2700,10 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) return -1; } + /* Read and cache the whole runlist if not already done. */ + if (ntfs_attr_map_whole_runlist(na)) + return -1; + /* Move the attribute name if it exists and update the offset. */ if (a->name_length) { /* Sanity check. */ From cd99a42e3476e1b482102531328b04ae1ef746bc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0911/2994] Update 2004/01/08 17:13:00+00:00 cantab.net!aia21 Fill in documentation gaps for ntfs_attr structure. (Logical change 1.259) --- include/attrib.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/include/attrib.h b/include/attrib.h index f8610261..155f9bb9 100644 --- a/include/attrib.h +++ b/include/attrib.h @@ -1,7 +1,7 @@ /* * attrib.h - Exports for attribute handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -157,12 +157,19 @@ typedef enum { /** * ntfs_attr - ntfs in memory non-resident attribute structure - * @rl: if not NULL, the decompressed runlist - * @ni: base ntfs inode to which this attribute belongs - * @type: attribute type - * @name: Unicode name of the attribute - * @name_len: length of @name in Unicode characters - * @state: NTFS attribute specific flags descibing this attribute + * @rl: if not NULL, the decompressed runlist + * @ni: base ntfs inode to which this attribute belongs + * @type: attribute type + * @name: Unicode name of the attribute + * @name_len: length of @name in Unicode characters + * @state: NTFS attribute specific flags descibing this attribute + * @allocated_size: copy from the attribute record + * @data_size: copy from the attribute record + * @initialized_size: copy from the attribute record + * @compressed_size: copy from the attribute record + * @compression_block_size: size of a compression block (cb) + * @compression_block_size_bits: log2 of the size of a cb + * @compression_block_clusters: number of clusters per cb * * This structure exists purely to provide a mechanism of caching the runlist * of an attribute. If you want to operate on a particular attribute extent, From 3318f33a0b7f0e94532ef51ee5d7cd9383c4323b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0912/2994] Update 2004/01/08 17:13:00+00:00 cantab.net!aia21 Update version to 1.8.3-WIP (Logical change 1.259) --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 0f5d0830..4f977290 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # configure.ac - Source file to generate "./configure" to prepare package for # compilation. # -# Copyright (c) 2000-2003 Anton Altaparmakov +# Copyright (c) 2000-2004 Anton Altaparmakov # Copyright (c) 2003 Jan Kratochvil # # This program/include file is free software; you can redistribute it and/or @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.2, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.3-WIP, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) From cabb6dc25bfa339ba90adbec26ffdd366e304895 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0913/2994] Update Matthew's email address. (Logical change 1.259) --- AUTHORS | 2 +- CREDITS | 2 +- ntfsprogs/ntfsinfo.8.in | 4 ++-- ntfsprogs/ntfslabel.8.in | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/AUTHORS b/AUTHORS index 0348308f..f1afb852 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5,7 +5,7 @@ Current active developers on the project are (in alphabetical order): Anton Altaparmakov Jan Kratochvil - Matthew J. Fanto + Matthew J. Fanto Lode Leroy Leonard Norrgĺrd Richard Russon diff --git a/CREDITS b/CREDITS index 48c04864..e7a662b6 100644 --- a/CREDITS +++ b/CREDITS @@ -10,7 +10,7 @@ someone is missing or if you prefer to not be listed. Anton Altaparmakov Albert D. Cahalan Russ Christensen -Matthew J. Fanto +Matthew J. Fanto Christophe Grenier Ian Jackson Jan Kratochvil diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index 2e03b3dd..5978d71e 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -1,5 +1,5 @@ .\" -*- nroff -*- -.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. +.\" Copyright (c) 2002-2004 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" .TH NTFSINFO 8 "May 2002" "Linux-NTFS version @VERSION@" @@ -16,7 +16,7 @@ will dump the attributes of inode .PP .SH AUTHOR .B ntfsinfo -was written by Matthew J. Fanto (fanto1mj@cmich.edu). +was written by Matthew J. Fanto (mattjf@uncompiled.com). .SH AVAILABILITY .B ntfsinfo is part of the linux-ntfs package and is available from diff --git a/ntfsprogs/ntfslabel.8.in b/ntfsprogs/ntfslabel.8.in index c9189ed8..1a53cf4a 100644 --- a/ntfsprogs/ntfslabel.8.in +++ b/ntfsprogs/ntfslabel.8.in @@ -1,5 +1,5 @@ .\" -*- nroff -*- -.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved. +.\" Copyright (c) 2002-2004 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" Adapted from e2fsprogs-1.26/misc/e2label.8.in by Theodore Ts'o. .\" @@ -43,8 +43,8 @@ during creation of the file system. .PP .SH AUTHOR .B ntfslabel -was written by Matthew J. Fanto (fanto1mj@cmich.edu). This man page was written -by Anton Altaparmakov (aia21@cantab.net). +was written by Matthew J. Fanto (mattjf@uncompiled.com). This man page was +written by Anton Altaparmakov (aia21@cantab.net). .SH AVAILABILITY .B ntfslabel is part of the linux-ntfs package and is available from From 9bb5b63ccee3ecc97a71abb0c1d9775dc4c0bc6a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Jan 2004 12:38:56 +0000 Subject: [PATCH 0914/2994] Update version to 1.8.3-WIP (Logical change 1.259) --- ChangeLog | 3 +++ configure | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f05d728..cf247f57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +08/01/2004 - 1.8.3 - WIP + - + 07/01/2004 - 1.8.2 - Make ntfsprogs work on FreeBSD. - Add compatibility for building on FreeBSD. (Christophe Grenier) - Add new compile target "make libs" which only compiles libntfs. diff --git a/configure b/configure index 59ef7e76..200f94df 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.2. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.3-WIP. # # Report bugs to . # @@ -427,8 +427,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.2' -PACKAGE_STRING='ntfsprogs 1.8.2' +PACKAGE_VERSION='1.8.3-WIP' +PACKAGE_STRING='ntfsprogs 1.8.3-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -939,7 +939,7 @@ 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 ntfsprogs 1.8.2 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.3-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1006,7 +1006,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.2:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.3-WIP:";; esac cat <<\_ACEOF @@ -1106,7 +1106,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.2 +ntfsprogs configure 1.8.3-WIP generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1121,7 +1121,7 @@ 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 ntfsprogs $as_me 1.8.2, which was +It was created by ntfsprogs $as_me 1.8.3-WIP, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1800,7 +1800,7 @@ fi # Define the identity of the package. PACKAGE=ntfsprogs - VERSION=1.8.2 + VERSION=1.8.3-WIP cat >>confdefs.h <<_ACEOF @@ -11155,7 +11155,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.2, which was +This file was extended by ntfsprogs $as_me 1.8.3-WIP, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11218,7 +11218,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.2 +ntfsprogs config.status 1.8.3-WIP configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" From 57041e1a9485e9c87cca316041d6ef687b6d14fc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 11 Jan 2004 18:01:46 +0000 Subject: [PATCH 0915/2994] Auto merged 2004/01/11 18:01:31+00:00 cantab.net!aia21 update comment (Logical change 1.260) --- libntfs/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 89f42689..de32528c 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2591,7 +2591,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) goto put_err_out; } - // TODO: Try to make other attributes non-resident. + // TODO: Try to make other attributes non-resident and retry each time. // TODO: Move the attribute to a new mft record, creating an attribute // list attribute or modifying it if it is already present. From a73943388aa1650fbe55b77bc658bef52521fae0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 11 Jan 2004 18:01:46 +0000 Subject: [PATCH 0916/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into cantab.net:/home/aia21/ntfsprogs 2004/01/11 18:01:32+00:00 cantab.net!aia21 update comment BKrev: 40018f8acK7XwNuwC6iipD4bQ-I5qQ From e13713fd276446607954e9e6ff2411b6894fd739 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jan 2004 11:05:18 +0000 Subject: [PATCH 0917/2994] Finish attribute decompression code. (Completely untested!) (Logical change 1.261) --- TODO.libntfs | 2 - include/compress.h | 2 +- libntfs/compress.c | 458 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 459 insertions(+), 3 deletions(-) diff --git a/TODO.libntfs b/TODO.libntfs index 2f775696..9e67e62c 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -18,8 +18,6 @@ - write ntfs_mft_record_allocate() (see ntfs 2.4 driver in CVS) -- add read of compressed attributes - ******************* * MEDIUM priority * ******************* diff --git a/include/compress.h b/include/compress.h index c21a3cf5..93df37af 100644 --- a/include/compress.h +++ b/include/compress.h @@ -26,7 +26,7 @@ #include "types.h" #include "attrib.h" -extern s64 ntfs_compressed_attr_pread(ntfs_attr *na, const s64 pos, s64 count, +extern s64 ntfs_compressed_attr_pread(ntfs_attr *na, s64 pos, s64 count, void *b); #endif /* defined _NTFS_COMPRESS_H */ diff --git a/libntfs/compress.c b/libntfs/compress.c index e69de29b..312351d6 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -0,0 +1,458 @@ +/* + * compress.c - Compressed attribute handling code. Part of the Linux-NTFS + * project. + * + * Copyright (c) 2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include + +#include "attrib.h" +#include "debug.h" +#include "volume.h" +#include "types.h" +#include "layout.h" +#include "runlist.h" + +/** + * ntfs_compression_constants - enum of constants used in the compression code + */ +typedef enum { + /* Token types and access mask. */ + NTFS_SYMBOL_TOKEN = 0, + NTFS_PHRASE_TOKEN = 1, + NTFS_TOKEN_MASK = 1, + + /* Compression sub-block constants. */ + NTFS_SB_SIZE_MASK = 0x0fff, + NTFS_SB_SIZE = 0x1000, + NTFS_SB_IS_COMPRESSED = 0x8000, +} ntfs_compression_constants; + +/** + * ntfs_decompress - decompress a compression block into an array of pages + * @dest: buffer to which to write the decompressed data + * @dest_size: size of buffer @dest in bytes + * @cb_start: compression block to decompress + * @cb_size: size of compression block @cb_start in bytes + * + * This decompresses the compression block @cb_start into the destination + * buffer @dest. + * + * @cb_start is a pointer to the compression block which needs decompressing + * and @cb_size is the size of @cb_start in bytes (8-64kiB). + * + * Return 0 if success or -EOVERFLOW on error in the compressed stream. + */ +static int ntfs_decompress(u8 *dest, const u32 dest_size, + u8 *const cb_start, const u32 cb_size) +{ + /* + * Pointers into the compressed data, i.e. the compression block (cb), + * and the therein contained sub-blocks (sb). + */ + u8 *cb_end = cb_start + cb_size; /* End of cb. */ + u8 *cb = cb_start; /* Current position in cb. */ + u8 *cb_sb_start = cb; /* Beginning of the current sb in the cb. */ + u8 *cb_sb_end; /* End of current sb / beginning of next sb. */ + /* Variables for uncompressed data / destination. */ + u8 *dest_end = dest + dest_size; /* End of dest buffer. */ + u8 *dest_sb_start; /* Start of current sub-block in dest. */ + u8 *dest_sb_end; /* End of current sb in dest. */ + /* Variables for tag and token parsing. */ + u8 tag; /* Current tag. */ + int token; /* Loop counter for the eight tokens in tag. */ + + Dprintf("Entering, cb_size = 0x%x.\n", cb_size); +do_next_sb: + Dprintf("Beginning sub-block at offset = 0x%x in the cb.\n", + cb - cb_start); + /* Have we reached the end of the compression block? */ + if (cb == cb_end || !le16_to_cpup((u16*)cb)) { + Dprintf("Completed. Returning success (0).\n"); + return 0; + } + /* Setup offset for the current sub-block destination. */ + dest_sb_start = dest; + dest_sb_end = dest + NTFS_SB_SIZE; + /* Check that we are still within allowed boundaries. */ + if (dest_sb_end > dest_end) + goto return_overflow; + /* Does the minimum size of a compressed sb overflow valid range? */ + if (cb + 6 > cb_end) + goto return_overflow; + /* Setup the current sub-block source pointers and validate range. */ + cb_sb_start = cb; + cb_sb_end = cb_sb_start + (le16_to_cpup((u16*)cb) & NTFS_SB_SIZE_MASK) + + 3; + if (cb_sb_end > cb_end) + goto return_overflow; + /* Now, we are ready to process the current sub-block (sb). */ + if (!(le16_to_cpup((u16*)cb) & NTFS_SB_IS_COMPRESSED)) { + Dprintf("Found uncompressed sub-block.\n"); + /* This sb is not compressed, just copy it into destination. */ + /* Advance source position to first data byte. */ + cb += 2; + /* An uncompressed sb must be full size. */ + if (cb_sb_end - cb != NTFS_SB_SIZE) + goto return_overflow; + /* Copy the block and advance the source position. */ + memcpy(dest, cb, NTFS_SB_SIZE); + cb += NTFS_SB_SIZE; + /* Advance destination position to next sub-block. */ + dest += NTFS_SB_SIZE; + goto do_next_sb; + } + Dprintf("Found compressed sub-block.\n"); + /* This sb is compressed, decompress it into destination. */ + /* Forward to the first tag in the sub-block. */ + cb += 2; +do_next_tag: + if (cb == cb_sb_end) { + /* Check if the decompressed sub-block was not full-length. */ + if (dest < dest_sb_end) { + int nr_bytes = dest_sb_end - dest; + + Dprintf("Filling incomplete sub-block with zeroes.\n"); + /* Zero remainder and update destination position. */ + memset(dest, 0, nr_bytes); + dest += nr_bytes; + } + /* We have finished the current sub-block. */ + goto do_next_sb; + } + /* Check we are still in range. */ + if (cb > cb_sb_end || dest > dest_sb_end) + goto return_overflow; + /* Get the next tag and advance to first token. */ + tag = *cb++; + /* Parse the eight tokens described by the tag. */ + for (token = 0; token < 8; token++, tag >>= 1) { + u16 lg, pt, length, max_non_overlap; + register u16 i; + u8 *dest_back_addr; + + /* Check if we are done / still in range. */ + if (cb >= cb_sb_end || dest > dest_sb_end) + break; + /* Determine token type and parse appropriately.*/ + if ((tag & NTFS_TOKEN_MASK) == NTFS_SYMBOL_TOKEN) { + /* + * We have a symbol token, copy the symbol across, and + * advance the source and destination positions. + */ + *dest++ = *cb++; + /* Continue with the next token. */ + continue; + } + /* + * We have a phrase token. Make sure it is not the first tag in + * the sb as this is illegal and would confuse the code below. + */ + if (dest == dest_sb_start) + goto return_overflow; + /* + * Determine the number of bytes to go back (p) and the number + * of bytes to copy (l). We use an optimized algorithm in which + * we first calculate log2(current destination position in sb), + * which allows determination of l and p in O(1) rather than + * O(n). We just need an arch-optimized log2() function now. + */ + lg = 0; + for (i = dest - dest_sb_start - 1; i >= 0x10; i >>= 1) + lg++; + /* Get the phrase token into i. */ + pt = le16_to_cpup((u16*)cb); + /* + * Calculate starting position of the byte sequence in + * the destination using the fact that p = (pt >> (12 - lg)) + 1 + * and make sure we don't go too far back. + */ + dest_back_addr = dest - (pt >> (12 - lg)) - 1; + if (dest_back_addr < dest_sb_start) + goto return_overflow; + /* Now calculate the length of the byte sequence. */ + length = (pt & (0xfff >> lg)) + 3; + /* Advance destination position and verify it is in range. */ + dest += length; + if (dest > dest_sb_end) + goto return_overflow; + /* The number of non-overlapping bytes. */ + max_non_overlap = dest - dest_back_addr; + if (length <= max_non_overlap) { + /* The byte sequence doesn't overlap, just copy it. */ + memcpy(dest, dest_back_addr, length); + /* Advance destination pointer. */ + dest += length; + } else { + /* + * The byte sequence does overlap, copy non-overlapping + * part and then do a slow byte by byte copy for the + * overlapping part. Also, advance the destination + * pointer. + */ + memcpy(dest, dest_back_addr, max_non_overlap); + dest += max_non_overlap; + dest_back_addr += max_non_overlap; + length -= max_non_overlap; + while (length--) + *dest++ = *dest_back_addr++; + } + /* Advance source position and continue with the next token. */ + cb += 2; + } + /* No tokens left in the current tag. Continue with the next tag. */ + goto do_next_tag; +return_overflow: + Dprintf("Failed. Returning -EOVERFLOW.\n"); + errno = EOVERFLOW; + return -1; +} + +/** + * ntfs_compressed_attr_pread - read from a compressed attribute + * @na: ntfs attribute to read from + * @pos: byte position in the attribute to begin reading from + * @count: number of bytes to read + * @b: output data buffer + * + * NOTE: You probably want to be using attrib.c::ntfs_attr_pread() instead. + * + * This function will read @count bytes starting at offset @pos from the + * compressed ntfs attribute @na into the data buffer @b. + * + * On success, return the number of successfully read bytes. If this number + * is lower than @count this means that the read reached end of file or that + * an error was encountered during the read so that the read is partial. + * 0 means end of file or nothing was read (also return 0 when @count is 0). + * + * On error and nothing has been read, return -1 with errno set appropriately + * to the return code of ntfs_pread(), or to EINVAL in case of invalid + * arguments. + */ +s64 ntfs_compressed_attr_pread(ntfs_attr *na, s64 pos, s64 count, void *b) +{ + s64 br, to_read, ofs, total, total2; + u64 cb_size_mask; + VCN start_vcn, vcn, end_vcn; + ntfs_volume *vol; + runlist_element *rl; + u8 *dest, *cb, *cb_pos, *cb_end; + u32 cb_size; + int err; + unsigned int nr_cbs, cb_clusters; + + Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x, pos 0x%Lx, " + "count 0x%Lx.\n", __FUNCTION__, + (unsigned long long)na->ni->mft_no, na->type, + (long long)pos, (long long)count); + if (!na || !NAttrCompressed(na) || !na->ni || !na->ni->vol || !b || + pos < 0 || count < 0) { + errno = EINVAL; + return -1; + } + /* + * Encrypted attributes are not supported. We return access denied, + * which is what Windows NT4 does, too. + */ + if (NAttrEncrypted(na)) { + errno = EACCES; + return -1; + } + if (!count) + return 0; + /* Truncate reads beyond end of attribute. */ + if (pos + count > na->data_size) { + if (pos >= na->data_size) + return 0; + count = na->data_size - pos; + } + /* If it is a resident attribute, simply use ntfs_attr_pread(). */ + if (!NAttrNonResident(na)) + return ntfs_attr_pread(na, pos, count, b); + total = total2 = 0; + /* Zero out reads beyond initialized size. */ + if (pos + count > na->initialized_size) { + if (pos >= na->initialized_size) { + memset(b, 0, count); + return count; + } + total2 = pos + count - na->initialized_size; + count -= total2; + memset((u8*)b + count, 0, total2); + } + vol = na->ni->vol; + cb_size = na->compression_block_size; + cb_size_mask = cb_size - 1UL; + cb_clusters = na->compression_block_clusters; + /* Need a temporary buffer for each loaded compression block. */ + cb = malloc(cb_size); + if (!cb) + return -1; + /* Need a temporary buffer for each uncompressed block. */ + dest = malloc(cb_size); + if (!dest) { + err = errno; + free(cb); + errno = err; + return -1; + } + /* + * The first vcn in the first compression block (cb) which we need to + * decompress. + */ + start_vcn = (pos & ~cb_size_mask) >> vol->cluster_size_bits; + /* Offset in the uncompressed cb at which to start reading data. */ + ofs = pos & cb_size_mask; + /* + * The first vcn in the cb after the last cb which we need to + * decompress. + */ + end_vcn = ((pos + count + cb_size - 1) & ~cb_size_mask) >> + vol->cluster_size_bits; + /* Number of compression blocks (cbs) in the wanted vcn range. */ + nr_cbs = (end_vcn - start_vcn) << vol->cluster_size_bits >> + na->compression_block_size_bits; + cb_end = cb + cb_size; +do_next_cb: + nr_cbs--; + cb_pos = cb; + vcn = start_vcn; + start_vcn += cb_clusters; + + /* Check whether the compression block is sparse. */ + rl = ntfs_attr_find_vcn(na, vcn); + if (!rl || rl->lcn < LCN_HOLE) { + free(cb); + free(dest); + if (total) + return total; + /* FIXME: Do we want EIO or the error code? (AIA) */ + errno = EIO; + return -1; + } + if (rl->lcn == LCN_HOLE) { + /* Sparse cb, zero out destination range overlapping the cb. */ + Dprintf("Found sparse compression block.\n"); + to_read = min(count, cb_size - ofs); + memset(b, 0, to_read); + ofs = 0; + total += to_read; + count -= to_read; + (u8*)b += to_read; + } else if (rl->length - (vcn - rl->vcn) >= cb_clusters) { + /* + * Uncompressed cb, read it straight into the destination range + * overlapping the cb. + */ + Dprintf("Found uncompressed compression block.\n"); + /* + * Read the uncompressed data into the destination buffer. + * NOTE: We cheat a little bit here by marking the attribute as + * not compressed in the ntfs_attr structure so that we can + * read the data by simply using ntfs_attr_pread(). (-8 + */ + to_read = min(count, cb_size - ofs); + ofs += vcn << vol->cluster_size_bits; + NAttrClearCompressed(na); + do { + br = ntfs_attr_pread(na, ofs, to_read, b); + if (br < 0) { + err = errno; + NAttrSetCompressed(na); + free(cb); + free(dest); + if (total) + return total; + errno = err; + return br; + } + total += br; + count -= br; + (u8*)b += br; + to_read -= br; + ofs += br; + } while (to_read > 0); + NAttrSetCompressed(na); + ofs = 0; + } else { + /* + * Compressed cb, decompress it into the temporary buffer, then + * copy the data to the destination range overlapping the cb. + */ + Dprintf("Found compressed compression block.\n"); + /* + * Read the compressed data into the temporary buffer. + * NOTE: We cheat a little bit here by marking the attribute as + * not compressed in the ntfs_attr structure so that we can + * read the raw, compressed data by simply using + * ntfs_attr_pread(). (-8 + */ + to_read = cb_size; + NAttrClearCompressed(na); + do { + br = ntfs_attr_pread(na, + (vcn << vol->cluster_size_bits) + + (cb_pos - cb), to_read, cb_pos); + if (br < 0) { + err = errno; + NAttrSetCompressed(na); + free(cb); + free(dest); + if (total) + return total; + errno = err; + return br; + } + cb_pos += br; + to_read -= br; + } while (to_read > 0); + NAttrSetCompressed(na); + /* Just a precaution. */ + if (cb_pos + 2 <= cb_end) + *(u16*)cb_pos = 0; + Dprintf("Successfully read the compression block.\n"); + if (ntfs_decompress(dest, cb_size, cb, cb_size) < 0) { + err = errno; + free(cb); + free(dest); + if (total) + return total; + errno = err; + return -1; + } + to_read = min(count, cb_size - ofs); + memcpy(b, dest + ofs, to_read); + total += to_read; + count -= to_read; + (u8*)b += to_read; + ofs = 0; + } + /* Do we have more work to do? */ + if (nr_cbs) + goto do_next_cb; + /* We no longer need the buffers. */ + free(cb); + free(dest); + /* Return number of bytes read. */ + return total + total2; +} + From 2ff2fa7af926dd20e8eca56ae32a61ee67d93039 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jan 2004 11:05:18 +0000 Subject: [PATCH 0918/2994] Finish attribute decompression code. (Completely untested!) BKrev: 4003d0eempNZYviEmx1MB-aCdvbjbw From 22707a789543555c73274ae490f009d20f77ded8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jan 2004 11:05:18 +0000 Subject: [PATCH 0919/2994] Update (Logical change 1.261) --- ChangeLog | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cf247f57..02c1d5f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 08/01/2004 - 1.8.3 - WIP - - + - Update ntfsinfo (Matthew J. Fanto, me) + - Add new API attrib.[hc]:ntfs_compressed_attr_pread(). NOTE: You want + to use ntfs_attr_pread() instead which will transparently read the + compressed attribute and return the decompressed data. + - Improve mkntfs linux/major.h use so should work on newer glibc. 07/01/2004 - 1.8.2 - Make ntfsprogs work on FreeBSD. - Add compatibility for building on FreeBSD. (Christophe Grenier) From 1a926436f938055e769be222b8effa587de8662e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jan 2004 11:26:46 +0000 Subject: [PATCH 0920/2994] Add include to provice prototype. (Logical change 1.262) --- libntfs/compress.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/compress.c b/libntfs/compress.c index 312351d6..b95e1bab 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -31,6 +31,7 @@ #include "types.h" #include "layout.h" #include "runlist.h" +#include "compress.h" /** * ntfs_compression_constants - enum of constants used in the compression code From cb2bace77992bce5563ed59cf857d61282775087 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jan 2004 11:26:46 +0000 Subject: [PATCH 0921/2994] Add include to provice prototype. BKrev: 4003d5f6Sc6YIspmPz5UIGOmRe1AiA From c9076ef6276c002b4b071bea7a1ca00c74717d9f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jan 2004 16:57:10 +0000 Subject: [PATCH 0922/2994] - Apply patch from Szaka to fix all %L to %ll. - Fix remaining %L ti %ll (compress.c). - Run ./autogen.sh on SuSE 9.0. (Logical change 1.263) --- Makefile.in | 239 +- aclocal.m4 | 7451 ++++++++++------ configure | 15012 ++++++++++++++++++++++++++++----- doc/Makefile.in | 146 +- include/Makefile.in | 175 +- include/bitmap.h | 2 +- libntfs/Makefile.in | 306 +- libntfs/attrib.c | 38 +- libntfs/bitmap.c | 2 +- libntfs/bootsect.c | 6 +- libntfs/compress.c | 4 +- libntfs/debug.c | 4 +- libntfs/device.c | 8 +- libntfs/dir.c | 54 +- libntfs/inode.c | 4 +- libntfs/lcnalloc.c | 96 +- libntfs/mft.c | 4 +- libntfs/runlist.c | 10 +- libntfs/volume.c | 12 +- ntfsprogs/Makefile.in | 221 +- ntfsprogs/dumplog.c | 30 +- ntfsprogs/mkntfs.c | 22 +- ntfsprogs/ntfsclone.c | 18 +- ntfsprogs/ntfsdump_logfile.c | 28 +- ntfsprogs/ntfsresize.c | 24 +- ntfsprogs/ntfstruncate.c | 26 +- 26 files changed, 18607 insertions(+), 5335 deletions(-) diff --git a/Makefile.in b/Makefile.in index 0885e97c..6409543c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.6.3 from Makefile.am. +# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# 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, @@ -13,88 +13,140 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -SHELL = @SHELL@ 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 pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c -INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -host_alias = @host_alias@ host_triplet = @host@ - -EXEEXT = @EXEEXT@ -OBJEXT = @OBJEXT@ -PATH_SEPARATOR = @PATH_SEPARATOR@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AS = @AS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ +ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ +LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -OBJDUMP = @OBJDUMP@ +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@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ +REALLYSTATIC_FALSE = @REALLYSTATIC_FALSE@ +REALLYSTATIC_TRUE = @REALLYSTATIC_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_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@ +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 = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ SUBDIRS = doc include libntfs ntfsprogs @@ -111,10 +163,11 @@ CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = ntfsprogs.spec DIST_SOURCES = -RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ - uninstall-info-recursive all-recursive install-data-recursive \ - install-exec-recursive installdirs-recursive install-recursive \ - uninstall-recursive check-recursive installcheck-recursive +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ Makefile.in NEWS aclocal.m4 compile config.guess config.h.in \ config.sub configure configure.ac depcomp install-sh ltconfig \ @@ -224,10 +277,17 @@ tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done ETAGS = etags ETAGSFLAGS = +CTAGS = ctags +CTAGSFLAGS = + tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -243,9 +303,15 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ @@ -258,13 +324,28 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = . @@ -276,13 +357,20 @@ am__remove_distdir = \ && rm -fr $(distdir); }; } GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) $(mkinstalldirs) $(distdir)/. $(distdir)/libntfs $(distdir)/ntfsprogs - @list='$(DISTFILES)'; for file in $$list; do \ + @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 \ @@ -316,7 +404,7 @@ distdir: $(DISTFILES) fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="${top_distdir}" distdir="$(distdir)" \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ @@ -338,12 +426,13 @@ distcheck: dist $(am__remove_distdir) GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/=build - mkdir $(distdir)/=inst + mkdir $(distdir)/_build + mkdir $(distdir)/_inst chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ - && cd $(distdir)/=build \ - && ../configure --srcdir=.. --prefix=$$dc_install_base \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ @@ -351,23 +440,39 @@ distcheck: dist && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - find $$dc_install_base -type f -print ; \ - exit 1; } >&2 ) \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ && rm -f $(distdir).tar.gz \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @echo "$(distdir).tar.gz is ready for distribution" | \ sed 'h;s/./=/g;p;x;p;x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 distcleancheck: distclean - if test '$(srcdir)' = . ; then \ + @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi - test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left after distclean:" ; \ + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am @@ -429,22 +534,31 @@ installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf autom4te.cache + -rm -rf $(top_srcdir)/autom4te.cache maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive -.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive dist dist-all \ - dist-gzip distcheck distclean distclean-generic distclean-hdr \ - distclean-libtool distclean-recursive distclean-tags \ - distcleancheck distdir dvi dvi-am dvi-recursive info info-am \ +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive dist dist-all dist-gzip distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-recursive distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am dvi-recursive info info-am \ info-recursive install install-am install-data install-data-am \ install-data-recursive install-exec install-exec-am \ install-exec-recursive install-info install-info-am \ @@ -453,7 +567,8 @@ uninstall-info: uninstall-info-recursive installdirs-am installdirs-recursive maintainer-clean \ maintainer-clean-generic maintainer-clean-recursive mostlyclean \ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ - tags tags-recursive uninstall uninstall-am uninstall-info-am \ + pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ + tags-recursive uninstall uninstall-am uninstall-info-am \ uninstall-info-recursive uninstall-recursive diff --git a/aclocal.m4 b/aclocal.m4 index 39c9c30e..96590317 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*- +# generated automatically by aclocal 1.7.6 -*- Autoconf -*- -# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# 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, @@ -34,67 +34,15 @@ AC_PREREQ([2.52]) # serial 6 -# 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. We must strip everything past the first ":", -# and everything past the last "/". - -# _AM_DIRNAME(PATH) -# ----------------- -# Like AS_DIRNAME, only do it during macro expansion -AC_DEFUN([_AM_DIRNAME], - [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, - m4_if(regexp([$1], [^//\([^/]\|$\)]), -1, - m4_if(regexp([$1], [^/.*]), -1, - [.], - patsubst([$1], [^\(/\).*], [\1])), - patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), - patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl -])# _AM_DIRNAME - - -# The stamp files are numbered to have different names. -# We could number them on a directory basis, but that's additional -# complications, let's have a unique counter. -m4_define([_AM_STAMP_Count], [0]) - - -# _AM_STAMP(HEADER) -# ----------------- -# The name of the stamp file for HEADER. -AC_DEFUN([_AM_STAMP], -[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl -AS_ESCAPE(_AM_DIRNAME(patsubst([$1], - [:.*])))/stamp-h[]_AM_STAMP_Count]) - - -# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS) -# ------------------------------------------------------------ -# We used to try to get a real timestamp in stamp-h. But the fear is that -# that will cause unnecessary cvs conflicts. -AC_DEFUN([_AM_CONFIG_HEADER], -[# Add the stamp file to the list of files AC keeps track of, -# along with our hook. -AC_CONFIG_HEADERS([$1], - [# update the timestamp -echo 'timestamp for $1' >"_AM_STAMP([$1])" -$2], - [$3]) -])# _AM_CONFIG_HEADER - - -# AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS) -# -------------------------------------------------------------- -AC_DEFUN([AM_CONFIG_HEADER], -[AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])]) -])# AM_CONFIG_HEADER +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # 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 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# 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 @@ -112,16 +60,9 @@ AC_DEFUN([AM_CONFIG_HEADER], # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# serial 8 +# serial 10 -# 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... - - -AC_PREREQ([2.52]) +AC_PREREQ([2.54]) # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow # the ones we care about. @@ -147,6 +88,16 @@ if test "`cd $srcdir && pwd`" != "`pwd`" && AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi +# 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], @@ -154,8 +105,8 @@ m4_ifval([$2], 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 + 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]) @@ -176,19 +127,41 @@ AM_PROG_INSTALL_STRIP # 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], +[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], + [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 + [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 @@ -209,14 +182,14 @@ AC_PROVIDE_IFELSE([AC_PROG_][CXX], # ---------------------------- # 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.6"]) +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.6.3])]) + [AM_AUTOMAKE_VERSION([1.7.6])]) # Helper functions for option handling. -*- Autoconf -*- @@ -502,9 +475,42 @@ fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# serial 4 -*- Autoconf -*- +# -*- Autoconf -*- +# Copyright (C) 2003 Free Software Foundation, Inc. -# Copyright 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 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 @@ -565,18 +571,32 @@ AC_CACHE_CHECK([dependency style of $depcc], # 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. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + : > 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) @@ -594,13 +614,20 @@ AC_CACHE_CHECK([dependency style of $depcc], # 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=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && - grep conftest.h conftest.Po > /dev/null 2>&1 && + 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 - am_cv_$1_dependencies_compiler_type=$depmode - break + # 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 @@ -611,6 +638,9 @@ else 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]) ]) @@ -619,16 +649,8 @@ AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], -[rm -f .deps 2>/dev/null -mkdir .deps 2>/dev/null -if test -d .deps; then - DEPDIR=.deps -else - # MS-DOS does not allow filenames that begin with a dot. - DEPDIR=_deps -fi -rmdir .deps 2>/dev/null -AC_SUBST([DEPDIR]) +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) @@ -730,7 +752,9 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*- +# 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 @@ -755,8 +779,9 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' -doit: +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]) @@ -770,7 +795,7 @@ echo "include confinc" > confmf # 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 | fgrep -v 'ing directory'`" = "done"; then +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU @@ -784,9 +809,9 @@ if test "$am__include" = "#"; then _am_result=BSD fi fi -AC_SUBST(am__include) -AC_SUBST(am__quote) -AC_MSG_RESULT($_am_result) +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) @@ -830,14 +855,14 @@ else fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([conditional \"$1\" was never defined. + AC_MSG_ERROR([conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]) fi])]) # Add --enable-maintainer-mode option to configure. # From Jim Meyering -# Copyright 1996, 1998, 2000, 2001 Free Software Foundation, Inc. +# 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 @@ -854,7 +879,7 @@ fi])]) # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -# serial 1 +# serial 2 AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) @@ -871,12 +896,65 @@ AC_DEFUN([AM_MAINTAINER_MODE], ] ) -# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) -# serial 46 AC_PROG_LIBTOOL +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# serial 47 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# 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 And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +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_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" @@ -887,10 +965,13 @@ AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) -]) +])# _AC_PROG_LIBTOOL + +# AC_LIBTOOL_SETUP +# ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.13)dnl +[AC_PREREQ(2.50)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl @@ -900,15 +981,103 @@ 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([LT_AC_PROG_SED])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 +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -918,327 +1087,78 @@ file_magic*) ;; esac -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -# 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* - ;; +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default -*-*-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 - ;; +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP -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])]) +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl - 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 +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} -_LT_AC_LTCONFIG_HACK +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER -]) -# AC_LIBTOOL_HEADER_ASSERT -# ------------------------ -AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], -[AC_CACHE_CHECK([whether $CC supports assert without backlinking], - [lt_cv_func_assert_works], - [case $host in - *-*-solaris*) - if test "$GCC" = yes && test "$with_gnu_ld" != yes; then - case `$CC --version 2>/dev/null` in - [[12]].*) lt_cv_func_assert_works=no ;; - *) lt_cv_func_assert_works=yes ;; - esac - fi - ;; - esac]) +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX -if test "x$lt_cv_func_assert_works" = xyes; then - AC_CHECK_HEADERS(assert.h) -fi -])# AC_LIBTOOL_HEADER_ASSERT -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h) -])# _LT_AC_CHECK_DLFCN +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $host_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[[ABCDGISTW]]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. -lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[[]] = -{ -EOF - sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AC_FD_CC - fi - else - echo "cannot find nm_test_var in $nlist" >&AC_FD_CC - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC - fi - else - echo "$progname: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" -if test -z "$lt_cv_sys_global_symbol_pipe"; then - global_symbol_to_cdecl= - global_symbol_to_c_name_address= -else - global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" - global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" -fi -if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; -then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - -# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR -# --------------------------------- -AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], -[# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi -])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR - +[_LT_AC_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -1256,7 +1176,7 @@ if test "X[$]1" = X--no-reexec; then elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else @@ -1268,7 +1188,7 @@ if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -1312,7 +1233,7 @@ else break fi done - IFS="$save_ifs" + IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -1385,17 +1306,291 @@ if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then fi AC_SUBST(ECHO) -AC_DIVERT_POP -])# _LT_AC_PROG_ECHO_BACKSLASH +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + 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 + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + 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_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + 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 + ;; +AC_PROVIDE_IFELSE([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) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ------------------------------------------------------------------ AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[if test "$cross_compiling" = yes; then : +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : [$4] else - AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext </dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" -need_locks="$enable_libtool_lock" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -if test x"$host" != x"$build"; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case $host_os in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="[$]2" - -AC_MSG_CHECKING([for objdir]) -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -AC_MSG_RESULT($objdir) - - -AC_ARG_WITH(pic, -[ --with-pic try to use only PIC/non-PIC objects [default=use both]], -pic_mode="$withval", pic_mode=default) -test -z "$pic_mode" && pic_mode=default - -# We assume here that the value for lt_cv_prog_cc_pic will not be cached -# in isolation, and that seeing it set (from the cache) indicates that -# the associated values are set (in the cache) correctly too. -AC_MSG_CHECKING([for $compiler option to produce PIC]) -AC_CACHE_VAL(lt_cv_prog_cc_pic, -[ lt_cv_prog_cc_pic= - lt_cv_prog_cc_shlib= - lt_cv_prog_cc_wl= - lt_cv_prog_cc_static= - lt_cv_prog_cc_no_builtin= - lt_cv_prog_cc_can_build_shared=$can_build_shared - - if test "$GCC" = yes; then - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-static' - - case $host_os in - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # not sure about C++ programs. - lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_cv_prog_cc_pic='-fno-common' - ;; - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_cv_prog_cc_pic=-Kconform_pic - fi - ;; - *) - lt_cv_prog_cc_pic='-fPIC' - ;; - esac - else - # PORTME Check for PIC flags for the system compiler. - case $host_os in - aix3* | aix4* | aix5*) - lt_cv_prog_cc_wl='-Wl,' - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_cv_prog_cc_static='-Bstatic' - else - lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - hpux9* | hpux10* | hpux11*) - # Is there a better lt_cv_prog_cc_static that works with the bundled CC? - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" - lt_cv_prog_cc_pic='+Z' - ;; - - irix5* | irix6* | nonstopux*) - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - - newsos6) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - ;; - - osf3* | osf4* | osf5*) - # All OSF/1 code is PIC. - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - ;; - - sco3.2v5*) - lt_cv_prog_cc_pic='-Kpic' - lt_cv_prog_cc_static='-dn' - lt_cv_prog_cc_shlib='-belf' - ;; - - solaris*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - sunos4*) - lt_cv_prog_cc_pic='-PIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Qoption ld ' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - uts4*) - lt_cv_prog_cc_pic='-pic' - lt_cv_prog_cc_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_cv_prog_cc_pic='-Kconform_pic' - lt_cv_prog_cc_static='-Bstatic' - fi - ;; - - *) - lt_cv_prog_cc_can_build_shared=no - ;; - esac - fi + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* ]) -if test -z "$lt_cv_prog_cc_pic"; then - AC_MSG_RESULT([none]) -else - AC_MSG_RESULT([$lt_cv_prog_cc_pic]) - - # Check to make sure the pic_flag actually works. - AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) - AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - AC_TRY_COMPILE([], [], [dnl - case $host_os in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then - # they create non-PIC objects. So, if there were any warnings, we - # assume that PIC is not supported. - if test -s conftest.err; then - lt_cv_prog_cc_pic_works=no - else - lt_cv_prog_cc_pic_works=yes - fi - ;; - *) - lt_cv_prog_cc_pic_works=yes - ;; - esac - ], [dnl - lt_cv_prog_cc_pic_works=no - ]) - CFLAGS="$save_CFLAGS" - ]) - - if test "X$lt_cv_prog_cc_pic_works" = Xno; then - lt_cv_prog_cc_pic= - lt_cv_prog_cc_can_build_shared=no - else - lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" - fi - - AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) -fi - -# Check for any special shared library compilation flags. -if test -n "$lt_cv_prog_cc_shlib"; then - AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) - lt_cv_prog_cc_can_build_shared=no - fi -fi - -AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) -AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl - lt_cv_prog_cc_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) - LDFLAGS="$save_LDFLAGS" -]) - -# Belt *and* braces to stop my trousers falling down: -test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) - -pic_flag="$lt_cv_prog_cc_pic" -special_shlib_compile_flags="$lt_cv_prog_cc_shlib" -wl="$lt_cv_prog_cc_wl" -link_static_flag="$lt_cv_prog_cc_static" -no_builtin_flag="$lt_cv_prog_cc_no_builtin" -can_build_shared="$lt_cv_prog_cc_can_build_shared" +])# AC_LIBTOOL_PROG_CC_C_O -# Check to see if options -o and -c are simultaneously supported by compiler -AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) -AC_CACHE_VAL([lt_cv_compiler_c_o], [ -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -echo "int some_variable = 0;" > conftest.$ac_ext -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" -compiler_c_o=no -if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - lt_cv_compiler_c_o=no - else - lt_cv_compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&AC_FD_CC - lt_cv_compiler_c_o=no -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null -]) -compiler_c_o=$lt_cv_compiler_c_o -AC_MSG_RESULT([$compiler_c_o]) - -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) - AC_CACHE_VAL([lt_cv_compiler_o_lo], [ - lt_cv_compiler_o_lo=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - save_objext="$ac_objext" - ac_objext=lo - AC_TRY_COMPILE([], [int some_variable = 0;], [dnl - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - lt_cv_compiler_o_lo=no - else - lt_cv_compiler_o_lo=yes - fi - ]) - ac_objext="$save_objext" - CFLAGS="$save_CFLAGS" - ]) - compiler_o_lo=$lt_cv_compiler_o_lo - AC_MSG_RESULT([$compiler_o_lo]) -else - compiler_o_lo=no -fi - +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- # Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes @@ -1977,764 +1856,77 @@ if test "$compiler_c_o" = no && test "$need_locks" != no; then ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then - AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS -if test "$GCC" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) - echo "int some_variable = 0;" > conftest.$ac_ext - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" - compiler_rtti_exceptions=no - AC_TRY_COMPILE([], [int some_variable = 0;], [dnl - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - compiler_rtti_exceptions=no - else - compiler_rtti_exceptions=yes - fi - ]) - CFLAGS="$save_CFLAGS" - AC_MSG_RESULT([$compiler_rtti_exceptions]) - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi -fi - -# See if the linker supports building shared libraries. -AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) - -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -old_archive_from_expsyms_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_into_libs=no -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -link_all_deplibs=unknown -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. -extract_expsyms_cmds= - -case $host_os in -cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; -openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ - sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ - test -f $output_objdir/impgen.exe || (cd $output_objdir && \ - if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ - else $CC -o impgen impgen.c ; fi)~ - $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' - - old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' - - # cygwin and mingw dlls have different entry points and sets of symbols - # to exclude. - # FIXME: what about values for MSVC? - dll_entry=__cygwin_dll_entry@12 - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ - case $host_os in - mingw*) - # mingw values - dll_entry=_DllMainCRTStartup@12 - dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ - ;; - esac - - # mingw and cygwin differ, and it's simplest to just exclude the union - # of the two symbol sets. - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one (in ltdll.c) - if test "x$lt_cv_need_dllmain" = "xyes"; then - ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " - ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ - test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' - else - ltdll_obj= - ltdll_cmds= - fi - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left be newer dlltools. - export_symbols_cmds="$ltdll_cmds"' - $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' - - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is. - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname-def; - else - echo EXPORTS > $output_objdir/$soname-def; - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \[$]# in - 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; - 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; - *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done; - fi~ - '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw* | pw32*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - hardcode_direct=yes - archive_cmds='' - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - shared_flag='${wl}-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall can do strange things, so it is better to - # generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='${wl}-berok' - # This is a bit strange, but is similar to how AIX traditionally builds - # it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' - # We need to add '_' to the symbols in $export_symbols first - #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - hardcode_direct=yes - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load $convenience' - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case $host_os in - hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case "$host_os" in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - #Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - export_dynamic_flag_spec='${wl}-Bexport' - ;; - - solaris*) - # gcc --version < 3.0 without binutils cannot create self contained - # shared libraries reliably, requiring libgcc.a to resolve some of - # the object symbols generated in some cases. Libraries that use - # assert need libgcc.a to resolve __eprintf, for example. Linking - # a copy of libgcc.a into every shared library to guarantee resolving - # such symbols causes other problems: According to Tim Van Holder - # , C++ libraries end up with a separate - # (to the application) exception stack for one thing. - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - [[12]].*) - cat <&2 - -*** Warning: Releases of GCC earlier than version 3.0 cannot reliably -*** create self contained shared libraries on Solaris systems, without -*** introducing a dependency on libgcc.a. Therefore, libtool is disabling -*** -no-undefined support, which will at least allow you to build shared -*** libraries. However, you may find that when you link such libraries -*** into an application without using GCC, you have to manually add -*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to -*** upgrade to a newer version of GCC. Another option is to rebuild your -*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. - -EOF - no_undefined_flag= - ;; - esac - fi - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5uw7* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs fi -AC_MSG_RESULT([$ld_shlibs]) -test "$ld_shlibs" = no && can_build_shared=no +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- # Check hardcoding attributes. -AC_MSG_CHECKING([how to hardcode library paths into programs]) -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. - hardcode_action=relink + _LT_AC_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate + _LT_AC_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. - hardcode_action=unsupported + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported fi -AC_MSG_RESULT([$hardcode_action]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) -striplib= +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then @@ -2742,17 +1934,33 @@ if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else AC_MSG_RESULT([no]) fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP -reload_cmds='$LD$reload_flag -o $output$reload_objs' -test -z "$deplibs_check_method" && deplibs_check_method=unknown +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- # PORTME Fill in your ld.so characteristics -AC_MSG_CHECKING([dynamic linker characteristics]) +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= +shrext=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -2762,16 +1970,35 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) @@ -2781,7 +2008,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -2791,33 +2018,31 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can - # not hardcode correct soname into executable. Probably we can - # add versioning support to collect2, so additional links can - # be useful in future. + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}.so$major' + soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi - hardcode_into_libs=yes ;; amigaos*) @@ -2827,7 +2052,7 @@ amigaos*) ;; beos*) - library_names_spec='${libname}.so' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -2835,13 +2060,12 @@ beos*) bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -2849,29 +2073,55 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows + shrext=".dll" need_version=no need_lib_prefix=no + case $GCC,$host_os in - yes,cygwin*) + yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog .libs/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac ;; - yes,mingw*) - library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` - ;; - yes,pw32*) - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - ;; + *) - library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -2887,10 +2137,25 @@ darwin* | rhapsody*) # FIXME: Relying on posixy $() will cause problems for # cross-compilation, but unfortunately the echo tests do not # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' - soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) @@ -2902,12 +2167,12 @@ freebsd*) version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -2916,7 +2181,11 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - *) + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -2927,8 +2196,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -2936,14 +2205,45 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. - dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -2951,21 +2251,29 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) version_type=irix ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -2974,20 +2282,21 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) +linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. -linux-gnu*) +linux*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -2996,6 +2305,13 @@ linux-gnu*) # before this can be enabled. hardcode_into_libs=yes + case $LD in # libtool.m4 will add one of these switches to LD + *"-m elf_x86_64"*|*"-m elf64ppc"*|*"-m elf64_s390"*|*"-m elf64_sparc"*) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64" + ;; + esac + # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, @@ -3003,26 +2319,6 @@ linux-gnu*) # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' - - # Find out which ABI we are using (multilib Linux x86_64 hack). - libsuff= - case "$host_cpu" in - x86_64*|s390x*) - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *64-bit*) - libsuff=64 - ;; - esac - fi - rm -rf conftest* - ;; - *) - ;; - esac - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" ;; netbsd*) @@ -3030,12 +2326,12 @@ netbsd*) need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -3045,7 +2341,17 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -3054,46 +2360,47 @@ openbsd*) version_type=sunos need_lib_prefix=no need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case "$host_os" in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' + shrext=".dll" need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf + need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; @@ -3101,8 +2408,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -3112,7 +2419,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -3124,8 +2431,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -3146,39 +2453,950 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# Report the final consequences. + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# 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_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# 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], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# 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_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# 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], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# 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_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# 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], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# 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_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# 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_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [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]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +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_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +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 + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$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_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl +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 $CC]) + 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. + [[\\/]]* | ?:[[\\/]]*) + 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 + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + 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. + case `"$lt_cv_path_LD" -v 2>&1 &1 /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_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + 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_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # 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*) + case $host_cpu in + alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh* | x86_64) + 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]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + 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 + ;; + +nto-qnx) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +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 + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + 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*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + 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 + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + 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 + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_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* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL 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, lt_dlinit, + [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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,CXX" | sed 's/^,//'`]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,F77" | sed 's/^,//'`]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[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])])])])])]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,GCJ" | sed 's/^,//'`]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,RC" | sed 's/^,//'`]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3201,6 +3419,34 @@ aix4*) test "$enable_shared" = yes && enable_static=no fi ;; + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + fi + ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3209,111 +3455,1292 @@ AC_MSG_CHECKING([whether to build static libraries]) test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi +if test "$GXX" = yes; then + # Set up default GNU C++ configuration -AC_LIBTOOL_DLOPEN_SELF + AC_PROG_LD -if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - AC_CACHE_VAL([lt_cv_archive_cmds_need_lc], - [$rm conftest* - echo 'static int dummy;' > conftest.$ac_ext + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - if AC_TRY_EVAL(ac_compile); then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_cv_prog_cc_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$save_allow_undefined_flag + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else - cat conftest.err 1>&5 - fi]) - AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) - ;; - esac -fi -need_lc=${lt_cv_archive_cmds_need_lc-yes} + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= -# The second clause should only fire when bootstrapping the + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < "${ofile}T" -#! $SHELL + case $lt_echo in + *'\[$]0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` + ;; + esac -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +ifelse([$1], [], + [cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + AC_MSG_NOTICE([creating $ofile])], + [cfgfile="$ofile"]) + + cat <<__EOF__ >> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -3352,17 +4796,21 @@ if test -f "$ltmain"; then # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed that does not truncate output. +# A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="${SED} -e s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi -# ### BEGIN LIBTOOL CONFIG +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -3376,7 +4824,10 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$need_lc +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -3392,14 +4843,20 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# The default C compiler. -CC=$lt_CC +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) # Is the compiler the GNU C compiler? -with_gcc=$GCC +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP # The linker used to build libraries. -LD=$lt_LD +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) # Whether we need hard or soft links. LN_S=$lt_LN_S @@ -3420,7 +4877,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -3430,7 +4887,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_wl +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) # Object file suffix (normally "o"). objext="$ac_objext" @@ -3438,18 +4895,21 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" +# Shared library suffix (normally ".so"). +shrext='$shrext' + # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_pic_flag +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) pic_mode=$pic_mode -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_compiler_c_o +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len -# Can we write directly to a .lo ? -compiler_o_lo=$lt_compiler_o_lo +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -3470,19 +4930,19 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_link_static_flag +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_no_builtin_flag +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) # Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) # Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) # Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) # Library versioning type. version_type=$version_type @@ -3499,26 +4959,50 @@ soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) # Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) # Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -3526,10 +5010,10 @@ deplibs_check_method=$lt_deplibs_check_method file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) # Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds @@ -3538,13 +5022,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_global_symbol_pipe +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -3556,36 +5040,45 @@ shlibpath_var=$shlibpath_var shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) # Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. -hardcode_direct=$hardcode_direct +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. -hardcode_minus_L=$hardcode_minus_L +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec @@ -3594,30 +5087,33 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" # Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) # The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) # Symbols that must always be exported. -include_expsyms=$lt_include_expsyms +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) -# ### END LIBTOOL CONFIG +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) __EOF__ +ifelse([$1],[], [ case $host_os in aix3*) - cat <<\EOF >> "${ofile}T" + cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -3630,11 +5126,1493 @@ EOF ;; esac + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGISTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $CC in + icc|ecc) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + ccc) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in - cygwin* | mingw* | pw32* | os2*) - cat <<'EOF' >> "${ofile}T" - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi4*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include @@ -3668,748 +6646,13 @@ EOF # return TRUE; # } # /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# 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 of the License, 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. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# /* O_BINARY isn't required (or even defined sometimes) under Unix */ -# #ifndef O_BINARY -# #define O_BINARY 0 -# #endif -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (dll < 1) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) - - mv -f "${ofile}T" "$ofile" || \ - (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") - chmod +x "$ofile" -fi - -])# _LT_AC_LTCONFIG_HACK - -# 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)]) +])# _LT_AC_FILE_LTDLL_C -# 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 -]) +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) -# 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 <&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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])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=$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_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 &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 dependent 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 -aix4* | aix5*) - 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` - ;; - *) # 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* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # 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 | mips | mipsel | powerpc* | sparc* | ia64* | s390* | x86_64*) - 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 - ;; - -newos6*) - 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 - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -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 - 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*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - 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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl -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=$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 LTDLINCL to the include flags for -# the libltdl header and adds --enable-ltdl-convenience to the -# configure arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library and LTDLINCL to the include flags for -# the libltdl header and adds --enable-ltdl-install to the configure -# arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) @@ -4423,6 +6666,16 @@ AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # @@ -4436,79 +6689,51 @@ AC_DEFUN([LT_AC_PROG_SED], AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. -as_executable_p="test -f" 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_prog in sed gsed; do + for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done - - # 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 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/sed$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - { (exit 1); exit 1; } -} - _max=0 - _count=0 - # Add /usr/xpg4/bin/sed as it is typically found on Solaris - # along with /bin/sed that truncates output. - for _sed in $_sed_list /usr/xpg4/bin/sed; do - test ! -f ${_sed} && break - cat /dev/null > "$tmp/sed.in" - _count=0 - echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" - # Check for GNU sed and select it if it is found. - if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then - lt_cv_path_SED=${_sed} - break +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed fi - while true; do - cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" - mv "$tmp/sed.tmp" "$tmp/sed.in" - cp "$tmp/sed.in" "$tmp/sed.nl" - echo >>"$tmp/sed.nl" - ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break - cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break - # 40000 chars as input seems more than enough - test $_count -gt 10 && break - _count=`expr $_count + 1` - if test $_count -gt $_max; then - _max=$_count - lt_cv_path_SED=$_sed - fi - done done - rm -rf "$tmp" +done +SED=$lt_cv_path_SED ]) -if test "X$SED" != "X"; then - lt_cv_path_SED=$SED -else - SED=$lt_cv_path_SED -fi AC_MSG_RESULT([$SED]) ]) diff --git a/configure b/configure index 200f94df..dfef2889 100755 --- a/configure +++ b/configure @@ -242,17 +242,6 @@ IFS=" $as_nl" $as_unset CDPATH -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi - # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -271,7 +260,7 @@ if test "X$1" = X--no-reexec; then elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else @@ -283,7 +272,7 @@ if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -327,7 +317,7 @@ else break fi done - IFS="$save_ifs" + IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -401,6 +391,11 @@ fi + +tagnames=`echo "$tagnames,CXX" | sed 's/^,//'` + +tagnames=`echo "$tagnames,F77" | sed 's/^,//'` + # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. @@ -470,7 +465,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT REALLYSTATIC_TRUE REALLYSTATIC_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE LN_S RANLIB ac_ct_RANLIB PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE ECHO CPP EGREP LIBTOOL LIBTOOL_DEPS all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os 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 REALLYSTATIC_TRUE REALLYSTATIC_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 RANLIB ac_ct_RANLIB PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE EGREP ECHO AR ac_ct_AR CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBTOOL_DEPS all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -931,6 +926,26 @@ ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +ac_env_CXXCPP_set=${CXXCPP+set} +ac_env_CXXCPP_value=$CXXCPP +ac_cv_env_CXXCPP_set=${CXXCPP+set} +ac_cv_env_CXXCPP_value=$CXXCPP +ac_env_F77_set=${F77+set} +ac_env_F77_value=$F77 +ac_cv_env_F77_set=${F77+set} +ac_cv_env_F77_value=$F77 +ac_env_FFLAGS_set=${FFLAGS+set} +ac_env_FFLAGS_value=$FFLAGS +ac_cv_env_FFLAGS_set=${FFLAGS+set} +ac_cv_env_FFLAGS_value=$FFLAGS # # Report the --help message. @@ -1015,21 +1030,27 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer - --enable-shared=PKGS build shared libraries default=yes - --enable-static=PKGS build static libraries default=yes + --enable-shared[=PKGS] + build shared libraries [default=yes] + --enable-static[=PKGS] + build static libraries [default=yes] --enable-debug enable debugging --enable-really-static completely static binaries --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors --disable-gnome-vfs Omit Gnome-VFS-2.0 'libntfs' interface (default=detect) - --enable-fast-install=PKGS optimize for fast installation default=yes + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) 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 + --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] + --with-tags[=TAGS] + include additional configurations [automatic] Some influential environment variables: CC C compiler command @@ -1039,6 +1060,11 @@ Some influential environment variables: CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1565,13 +1591,9 @@ test -n "$target_alias" && NONENONEs,x,x, && program_prefix=${target_alias}- -# Add the stamp file to the list of files AC keeps track of, -# along with our hook. ac_config_headers="$ac_config_headers config.h" - - -am__api_version="1.6" +am__api_version="1.7" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -1790,6 +1812,15 @@ 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 + # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then @@ -1798,9 +1829,19 @@ echo "$as_me: error: source directory already configured; run \"make distclean\" { (exit 1); exit 1; }; } fi +# 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 + + # Define the identity of the package. - PACKAGE=ntfsprogs - VERSION=1.8.3-WIP + PACKAGE='ntfsprogs' + VERSION='1.8.3-WIP' cat >>confdefs.h <<_ACEOF @@ -1954,47 +1995,51 @@ fi 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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else enable_static=yes fi; + # This is required to get past a stupid configure bug when making the rpm. # Basically it is broken to specify the host as a command line argument to # configure on its own, i.e. without giving --host=. It is supposed to work @@ -2909,24 +2954,16 @@ 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 -rm -f .deps 2>/dev/null -mkdir .deps 2>/dev/null -if test -d .deps; then - DEPDIR=.deps -else - # MS-DOS does not allow filenames that begin with a dot. - DEPDIR=_deps -fi -rmdir .deps 2>/dev/null - +DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' -doit: +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 @@ -2941,7 +2978,7 @@ echo "include confinc" > confmf # 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 | fgrep -v 'ing directory'`" = "done"; then +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU @@ -3001,18 +3038,32 @@ else # 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. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + : > 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) @@ -3030,13 +3081,20 @@ else # 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=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && - grep conftest.h conftest.Po > /dev/null 2>&1 && + 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 - am_cv_CC_dependencies_compiler_type=$depmode - break + # 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 @@ -3052,6 +3110,18 @@ 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 # incompatible versions: @@ -3389,35 +3459,98 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu 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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else enable_fast_install=yes fi; -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +SED=$lt_cv_path_SED + fi +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 + +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 + 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then @@ -3429,8 +3562,8 @@ 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 + echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -3440,12 +3573,12 @@ echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 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'` + 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%/%"` + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -3469,22 +3602,26 @@ if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do + IFS="$lt_save_ifs" 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 + case `"$lt_cv_path_LD" -v 2>&1 &6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then +case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 @@ -3528,7 +3668,11 @@ 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" +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 @@ -3539,120 +3683,42 @@ else # Let the user override the test. lt_cv_path_NM="$NM" else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" 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 + 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 + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) 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 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + 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 + ;; + esac + esac fi done - IFS="$ac_save_ifs" + IFS="$lt_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi - +echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6 NM="$lt_cv_path_NM" -echo "$as_me:$LINENO: result: $NM" >&5 -echo "${ECHO_T}$NM" >&6 - -echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_executable_p="test -f" -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_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" - fi - done - done -done - - # 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 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/sed$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - { (exit 1); exit 1; } -} - _max=0 - _count=0 - # Add /usr/xpg4/bin/sed as it is typically found on Solaris - # along with /bin/sed that truncates output. - for _sed in $_sed_list /usr/xpg4/bin/sed; do - test ! -f ${_sed} && break - cat /dev/null > "$tmp/sed.in" - _count=0 - echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" - # Check for GNU sed and select it if it is found. - if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then - lt_cv_path_SED=${_sed} - break - fi - while true; do - cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" - mv "$tmp/sed.tmp" "$tmp/sed.in" - cp "$tmp/sed.in" "$tmp/sed.nl" - echo >>"$tmp/sed.nl" - ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break - cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break - # 40000 chars as input seems more than enough - test $_count -gt 10 && break - _count=`expr $_count + 1` - if test $_count -gt $_max; then - _max=$_count - lt_cv_path_SED=$_sed - fi - done - done - rm -rf "$tmp" - -fi - -if test "X$SED" != "X"; then - lt_cv_path_SED=$SED -else - SED=$lt_cv_path_SED -fi -echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6 echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 @@ -3669,7 +3735,7 @@ lt_cv_deplibs_check_method='unknown' # '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. +# which responds to the $file_magic_cmd with a given extended 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. @@ -3689,21 +3755,24 @@ bsdi4*) ;; cygwin* | mingw* | pw32*) - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' + # win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='win32_libid' ;; darwin* | rhapsody*) + # this will be overwritten by pass_all, but leave it in just in case 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + 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 + lt_cv_deplibs_check_method=pass_all ;; freebsd*) @@ -3726,10 +3795,22 @@ 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' +hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + 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_test_file=/usr/lib/libc.sl + ;; + esac ;; irix5* | irix6* | nonstopux*) @@ -3754,9 +3835,9 @@ irix5* | irix6* | nonstopux*) ;; # This must be Linux ELF. -linux-gnu*) +linux*) case $host_cpu in - alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | s390* | x86_64*) + alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh* | x86_64) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM @@ -3767,9 +3848,9 @@ linux-gnu*) netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; @@ -3779,6 +3860,10 @@ newos6*) lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; +nto-qnx) + lt_cv_deplibs_check_method=unknown + ;; + openbsd*) lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` @@ -3805,10 +3890,6 @@ solaris*) 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 motorola) @@ -3832,6 +3913,10 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ;; esac ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; esac fi @@ -3839,211 +3924,200 @@ 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 +test -z "$deplibs_check_method" && deplibs_check_method=unknown +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +# 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 && enable_libtool_lock=yes -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo "$as_me:$LINENO: checking command to parse $NM output" >&5 -echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris* | sysv5*) - symcode='[BDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $host_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[ABCDGISTW]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. -lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext < 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 - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 3970 "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); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + 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 + fi + rm -rf conftest* + ;; - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > 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.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; -EOF - # Now generate the symbol file. - eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' +*-*-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 -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif + 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. */ -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = +int +main () { -EOF - sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr) 0} -}; -#ifdef __cplusplus + ; + return 0; } -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 +_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); } && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" -if test -z "$lt_cv_sys_global_symbol_pipe"; then - global_symbol_to_cdecl= - global_symbol_to_c_name_address= + (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 - global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" - global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no fi -if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; -then - echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6 -else - echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6 +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 + +need_locks="$enable_libtool_lock" + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4280,21 +4354,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 - 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - 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 @@ -4660,150 +4719,1288 @@ fi done - - - - - -# 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 +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + 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_CXX+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 <&2 + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -*** 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 +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&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 + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +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_CXX+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 <&2 + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -*** 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 +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# 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 &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +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_cxx_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 + + ; + 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_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_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_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" else - MAGIC_CMD=: + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= fi fi +for ac_declaration in \ + ''\ + '#include ' \ + '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 +$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 + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +depcc="$CXX" 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_CXX_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_CXX_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_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_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 +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +#else +# include +#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_cxx_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 +_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_cxx_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 +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 + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6 +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +#else +# include +#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_cxx_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 +_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_cxx_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 +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 \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 f77 xlf frt pgf77 fl32 af77 fort77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 lf95 g95 + 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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # 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_F77="$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 +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 f77 xlf frt pgf77 fl32 af77 fort77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 lf95 g95 +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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +echo "${ECHO_T}$ac_ct_F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_F77" && break +done + + F77=$ac_ct_F77 +fi + + +# Provide some information about the compiler. +echo "$as_me:5467:" \ + "checking for Fortran 77 compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. +ac_save_ext=$ac_ext +ac_ext=F +echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_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_f77_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 +ac_ext=$ac_save_ext +G77=`test $ac_compiler_gnu = yes && echo yes` +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_f77_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_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_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_f77_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "$G77" = yes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "$G77" = yes; then + FFLAGS="-O2" + else + FFLAGS= + fi +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 + + + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGISTW]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + 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); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6 +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES fi ;; esac +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" + 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_AR" && ac_cv_prog_ac_ct_AR="false" +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +fi + 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 @@ -4965,140 +6162,6 @@ else fi -enable_dlopen=no -enable_win32_dll=no - -# 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 && enable_libtool_lock=yes - -# 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 4983 "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 - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" -need_locks="$enable_libtool_lock" - old_CC="$CC" old_CFLAGS="$CFLAGS" @@ -5107,40 +6170,18 @@ test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm +test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o -if test x"$host" != x"$build"; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case $host_os in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' @@ -5158,24 +6199,150 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="$2" - -echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs +# 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 - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -echo "$as_me:$LINENO: result: $objdir" >&5 -echo "${ECHO_T}$objdir" >&6 + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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 + +enable_dlopen=no +enable_win32_dll=no + +# 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 && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. @@ -5187,425 +6354,447 @@ else fi; test -z "$pic_mode" && pic_mode=default -# We assume here that the value for lt_cv_prog_cc_pic will not be cached -# in isolation, and that seeing it set (from the cache) indicates that -# the associated values are set (in the cache) correctly too. -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 -if test "${lt_cv_prog_cc_pic+set}" = set; then +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +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 + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# +# Check for any special shared library compilation flags. +# +lt_prog_cc_shlib= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + lt_prog_cc_shlib='-belf' + ;; + esac +fi +if test -n "$lt_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 +if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_cv_prog_cc_pic= - lt_cv_prog_cc_shlib= - lt_cv_prog_cc_wl= - lt_cv_prog_cc_static= - lt_cv_prog_cc_no_builtin= - lt_cv_prog_cc_can_build_shared=$can_build_shared + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_prog_compiler_static" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 + +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6472: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6476: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-static' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' case $host_os in - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # not sure about C++ programs. - lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi ;; + amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. - lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - lt_cv_prog_cc_pic='-fno-common' + lt_prog_compiler_pic='-fno-common' ;; - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no ;; + sysv4*MP*) if test -d /usr/nec; then - lt_cv_prog_cc_pic=-Kconform_pic + lt_prog_compiler_pic=-Kconform_pic fi ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + *) - lt_cv_prog_cc_pic='-fPIC' + lt_prog_compiler_pic='-fPIC' ;; esac else - # PORTME Check for PIC flags for the system compiler. + # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in - aix3* | aix4* | aix5*) - lt_cv_prog_cc_wl='-Wl,' - # All AIX code is PIC. + aix*) + lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_static='-Bstatic' else - lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + hpux9* | hpux10* | hpux11*) - # Is there a better lt_cv_prog_cc_static that works with the bundled CC? - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" - lt_cv_prog_cc_pic='+Z' + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' + lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' + lt_prog_compiler_static='-non_shared' ;; newsos6) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux*) + case $CC in + icc|ecc) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + ccc) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + esac ;; osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' + lt_prog_compiler_static='-non_shared' ;; sco3.2v5*) - lt_cv_prog_cc_pic='-Kpic' - lt_cv_prog_cc_static='-dn' - lt_cv_prog_cc_shlib='-belf' + lt_prog_compiler_pic='-Kpic' + lt_prog_compiler_static='-dn' ;; solaris*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' ;; sunos4*) - lt_cv_prog_cc_pic='-PIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Qoption ld ' + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - uts4*) - lt_cv_prog_cc_pic='-pic' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then - lt_cv_prog_cc_pic='-Kconform_pic' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' fi ;; + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + *) - lt_cv_prog_cc_can_build_shared=no + lt_prog_compiler_can_build_shared=no ;; esac fi -fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic" >&6 -if test -z "$lt_cv_prog_cc_pic"; then - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 -else - echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 - - # Check to make sure the pic_flag actually works. - echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 - if test "${lt_cv_prog_cc_pic_works+set}" = set; then +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - 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. */ + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6704: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6708: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works=yes + fi + fi + $rm 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 - case $host_os in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then - # they create non-PIC objects. So, if there were any warnings, we - # assume that PIC is not supported. - if test -s conftest.err; then - lt_cv_prog_cc_pic_works=no - else - lt_cv_prog_cc_pic_works=yes - fi - ;; - *) - lt_cv_prog_cc_pic_works=yes - ;; - esac +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 +if test x"$lt_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - lt_cv_prog_cc_pic_works=no - -fi -rm -f conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no fi - - if test "X$lt_cv_prog_cc_pic_works" = Xno; then - lt_cv_prog_cc_pic= - lt_cv_prog_cc_can_build_shared=no - else - lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" - fi - - echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac -# Check for any special shared library compilation flags. -if test -n "$lt_cv_prog_cc_shlib"; then - { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - -echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 -if test "${lt_cv_prog_cc_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_cc_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - 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_prog_cc_static_works=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi - - -# Belt *and* braces to stop my trousers falling down: -test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 - -pic_flag="$lt_cv_prog_cc_pic" -special_shlib_compile_flags="$lt_cv_prog_cc_shlib" -wl="$lt_cv_prog_cc_wl" -link_static_flag="$lt_cv_prog_cc_static" -no_builtin_flag="$lt_cv_prog_cc_no_builtin" -can_build_shared="$lt_cv_prog_cc_can_build_shared" - - -# Check to see if options -o and -c are simultaneously supported by compiler echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_compiler_c_o+set}" = set; then +if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -echo "int some_variable = 0;" > conftest.$ac_ext -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" -compiler_c_o=no -if { (eval echo configure:5512: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - lt_cv_compiler_c_o=no - else - lt_cv_compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&5 - lt_cv_compiler_c_o=no -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6771: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:6775: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 -compiler_c_o=$lt_cv_compiler_c_o -echo "$as_me:$LINENO: result: $compiler_c_o" >&5 -echo "${ECHO_T}$compiler_c_o" >&6 -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 - if test "${lt_cv_compiler_o_lo+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - lt_cv_compiler_o_lo=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - save_objext="$ac_objext" - ac_objext=lo - 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 some_variable = 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 - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - lt_cv_compiler_o_lo=no - else - lt_cv_compiler_o_lo=yes - 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_objext="$save_objext" - CFLAGS="$save_CFLAGS" - -fi - - compiler_o_lo=$lt_cv_compiler_o_lo - echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 -echo "${ECHO_T}$compiler_o_lo" >&6 -else - compiler_o_lo=no -fi - -# Check to see if we can do hard links to lock some files if needed hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 @@ -5626,15 +6815,299 @@ else need_locks=no fi -if test "$GCC" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 - echo "int some_variable = 0;" > conftest.$ac_ext - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" - compiler_rtti_exceptions=no - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag= + enable_shared_with_static_runtimes=no + archive_cmds= + archive_expsym_cmds= + old_archive_From_new_cmds= + old_archive_from_expsyms_cmds= + export_dynamic_flag_spec= + whole_archive_flag_spec= + thread_safe_flag_spec= + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + link_all_deplibs=unknown + hardcode_automatic=no + module_cmds= + module_expsym_cmds= + always_export_symbols=no + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" /* confdefs.h. */ _ACEOF @@ -5645,761 +7118,581 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -int some_variable = 0; + ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +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_objext' + { 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 - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - compiler_rtti_exceptions=no - else - compiler_rtti_exceptions=yes - fi +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$compiler_rtti_exceptions" >&6 +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi -fi + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + 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. */ -# See if the linker supports building shared libraries. -echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 +int +main () +{ -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -old_archive_from_expsyms_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_into_libs=no -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -link_all_deplibs=unknown -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. -extract_expsyms_cmds= + ; + 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 -case $host_os in -cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; -openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ - sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ - test -f $output_objdir/impgen.exe || (cd $output_objdir && \ - if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ - else $CC -o impgen impgen.c ; fi)~ - $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' - - old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' - - # cygwin and mingw dlls have different entry points and sets of symbols - # to exclude. - # FIXME: what about values for MSVC? - dll_entry=__cygwin_dll_entry@12 - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ - case $host_os in - mingw*) - # mingw values - dll_entry=_DllMainCRTStartup@12 - dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ - ;; - esac - - # mingw and cygwin differ, and it's simplest to just exclude the union - # of the two symbol sets. - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one (in ltdll.c) - if test "x$lt_cv_need_dllmain" = "xyes"; then - ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " - ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ - test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' - else - ltdll_obj= - ltdll_cmds= - fi - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left be newer dlltools. - export_symbols_cmds="$ltdll_cmds"' - $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' - - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is. - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname-def; - else - echo EXPORTS > $output_objdir/$soname-def; - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \$# in - 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; - 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; - *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done; - fi~ - '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw* | pw32*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - hardcode_direct=yes - archive_cmds='' - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - shared_flag='${wl}-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec=' ' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi - fi - - # It seems that -bexpall can do strange things, so it is better to - # generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='${wl}-berok' - # This is a bit strange, but is similar to how AIX traditionally builds - # it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' ;; - *) # Darwin 1.3 on - allow_undefined_flag='-flat_namespace -undefined suppress' + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' - # We need to add '_' to the symbols in $export_symbols first - #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - hardcode_direct=yes - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load $convenience' - ;; - freebsd1*) - ld_shlibs=no - ;; + bsdi4*) + export_dynamic_flag_spec=-rdynamic + ;; - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case $host_os in - hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + archive_cmds_need_lc=no case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - #Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - export_dynamic_flag_spec='${wl}-Bexport' - ;; - - solaris*) - # gcc --version < 3.0 without binutils cannot create self contained - # shared libraries reliably, requiring libgcc.a to resolve some of - # the object symbols generated in some cases. Libraries that use - # assert need libgcc.a to resolve __eprintf, for example. Linking - # a copy of libgcc.a into every shared library to guarantee resolving - # such symbols causes other problems: According to Tim Van Holder - # , C++ libraries end up with a separate - # (to the application) exception stack for one thing. - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - [12].*) - cat <&2 - -*** Warning: Releases of GCC earlier than version 3.0 cannot reliably -*** create self contained shared libraries on Solaris systems, without -*** introducing a dependency on libgcc.a. Therefore, libtool is disabling -*** -no-undefined support, which will at least allow you to build shared -*** libraries. However, you may find that when you link such libraries -*** into an application without using GCC, you have to manually add -*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to -*** upgrade to a newer version of GCC. Another option is to rebuild your -*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. - -EOF - no_undefined_flag= + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag='-flat_namespace -undefined suppress' ;; esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='-all_load $convenience' + link_all_deplibs=yes fi - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; + ;; - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; + freebsd1*) + ld_shlibs=no + ;; - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes - sysv4*MP*) - if test -d /usr/nec; then + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + ia64*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + hardcode_shlibpath_var=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + *) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld='-rpath $libdir' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no + export_dynamic_flag_spec='${wl}-Bexport' runpath_var=LD_RUN_PATH hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; + ;; - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; + solaris*) + no_undefined_flag=' -z text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; - sysv5uw7* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + fi - *) - ld_shlibs=no - ;; - esac -fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no -# Check hardcoding attributes. +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +echo "${ECHO_T}$archive_cmds_need_lc" >&6 + ;; + esac + fi + ;; +esac + echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then + test -n "$runpath_var " || \ + test "X$hardcode_automatic"="Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink @@ -6415,6 +7708,15 @@ fi echo "$as_me:$LINENO: result: $hardcode_action" >&5 echo "${ECHO_T}$hardcode_action" >&6 +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + striplib= old_striplib= echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 @@ -6425,19 +7727,31 @@ if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac fi -reload_cmds='$LD$reload_flag -o $output$reload_objs' -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -# PORTME Fill in your ld.so characteristics echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= +shrext=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -6447,16 +7761,35 @@ shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) @@ -6466,7 +7799,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -6476,33 +7809,31 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can - # not hardcode correct soname into executable. Probably we can - # add versioning support to collect2, so additional links can - # be useful in future. + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}.so$major' + soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi - hardcode_into_libs=yes ;; amigaos*) @@ -6512,7 +7843,7 @@ amigaos*) ;; beos*) - library_names_spec='${libname}.so' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -6520,13 +7851,12 @@ beos*) bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -6534,29 +7864,55 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows + shrext=".dll" need_version=no need_lib_prefix=no + case $GCC,$host_os in - yes,cygwin*) + yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog .libs/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac ;; - yes,mingw*) - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` - ;; - yes,pw32*) - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' - ;; + *) - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -6572,10 +7928,25 @@ darwin* | rhapsody*) # FIXME: Relying on posixy $() will cause problems for # cross-compilation, but unfortunately the echo tests do not # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' - soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) @@ -6587,12 +7958,12 @@ freebsd*) version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -6601,7 +7972,11 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - *) + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -6612,8 +7987,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -6621,14 +7996,45 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. - dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -6636,21 +8042,29 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) version_type=irix ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -6659,20 +8073,21 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) +linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. -linux-gnu*) +linux*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -6681,6 +8096,13 @@ linux-gnu*) # before this can be enabled. hardcode_into_libs=yes + case $LD in # libtool.m4 will add one of these switches to LD + *"-m elf_x86_64"*|*"-m elf64ppc"*|*"-m elf64_s390"*|*"-m elf64_sparc"*) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64" + ;; + esac + # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, @@ -6688,30 +8110,6 @@ linux-gnu*) # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' - - # Find out which ABI we are using (multilib Linux x86_64 hack). - libsuff= - case "$host_cpu" in - x86_64*|s390x*) - echo '#line 6696 "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 - *64-bit*) - libsuff=64 - ;; - esac - fi - rm -rf conftest* - ;; - *) - ;; - esac - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff}" - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" ;; netbsd*) @@ -6719,12 +8117,12 @@ netbsd*) need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -6734,7 +8132,17 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -6743,46 +8151,47 @@ openbsd*) version_type=sunos need_lib_prefix=no need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case "$host_os" in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' + shrext=".dll" need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf + need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; @@ -6790,8 +8199,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -6801,7 +8210,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -6813,8 +8222,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -6835,31 +8244,22 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + *) dynamic_linker=no ;; @@ -6868,57 +8268,6 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no -# Report the final consequences. -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 - -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown @@ -6934,11 +8283,84 @@ else lt_cv_dlopen_self=yes ;; - cygwin* | mingw* | pw32*) + mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 @@ -7346,7 +8768,7 @@ fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" @@ -7362,10 +8784,10 @@ else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 fi -if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - if test "${lt_cv_archive_cmds_need_lc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - $rm conftest* - echo 'static int dummy;' > conftest.$ac_ext +# Report which librarie types wil actually be built +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 - 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 - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_cv_prog_cc_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$save_allow_undefined_flag - else - cat conftest.err 1>&5 +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + archive_cmds_need_lc=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + output_verbose_link_cmd='echo' + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' + module_cmds='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='-all_load $convenience' + link_all_deplibs=yes fi -fi - - echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 -echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 ;; - esac -fi -need_lc=${lt_cv_archive_cmds_need_lc-yes} +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 -# The second clause should only fire when bootstrapping the +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +# The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - : -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi - -if test -f "$ltmain"; then - trap "$rm \"${ofile}T\"; exit 1" 1 2 15 - $rm -f "${ofile}T" - - echo creating $ofile - + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS SED \ - AR AR_FLAGS CC LD LN_S NM SHELL \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ - postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ - old_striplib striplib file_magic_cmd export_symbols_cmds \ - deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - global_symbol_to_c_name_address \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + old_postinstall_cmds old_postuninstall_cmds \ + compiler \ + CC \ + LD \ + lt_prog_compiler_wl \ + lt_prog_compiler_pic \ + lt_prog_compiler_static \ + lt_prog_compiler_no_builtin_flag \ + export_dynamic_flag_spec \ + thread_safe_flag_spec \ + whole_archive_flag_spec \ + enable_shared_with_static_runtimes \ + old_archive_cmds \ + old_archive_from_new_cmds \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + exclude_expsyms \ + include_expsyms; do case $var in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -7679,14 +9133,29 @@ if test -f "$ltmain"; then esac done - cat <<__EOF__ > "${ofile}T" + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" #! $SHELL -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -7708,16 +9177,19 @@ if test -f "$ltmain"; then # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed that does not truncate output. +# A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="${SED} -e s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +# The names of the tagged configurations supported by this script. +available_tags= + # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -7732,7 +9204,10 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$need_lc +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -7748,12 +9223,18 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# The default C compiler. -CC=$lt_CC +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC +# An ERE matcher. +EGREP=$lt_EGREP + # The linker used to build libraries. LD=$lt_LD @@ -7776,7 +9257,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -7786,7 +9267,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_wl +wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -7794,18 +9275,21 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" +# Shared library suffix (normally ".so"). +shrext='$shrext' + # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_pic_flag +pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_compiler_c_o +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len -# Can we write directly to a .lo ? -compiler_o_lo=$lt_compiler_o_lo +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -7826,10 +9310,10 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_link_static_flag +link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_no_builtin_flag +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec @@ -7871,10 +9355,34 @@ archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -7894,13 +9402,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_global_symbol_pipe +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -7921,10 +9429,15 @@ hardcode_into_libs=$hardcode_into_libs # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct @@ -7936,6 +9449,10 @@ hardcode_minus_L=$hardcode_minus_L # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic + # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" @@ -7971,9 +9488,10 @@ include_expsyms=$lt_include_expsyms __EOF__ + case $host_os in aix3*) - cat <<\EOF >> "${ofile}T" + cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -7982,186 +9500,6 @@ if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi -EOF - ;; - esac - - case $host_os in - cygwin* | mingw* | pw32* | os2*) - cat <<'EOF' >> "${ofile}T" - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# 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 of the License, 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. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# /* O_BINARY isn't required (or even defined sometimes) under Unix */ -# #ifndef O_BINARY -# #define O_BINARY 0 -# #endif -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (dll < 1) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - mv -f "${ofile}T" "$ofile" || \ - (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" 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 + +CC="$lt_save_CC" + + +# Check whether --with-tags or --without-tags was given. +if test "${with_tags+set}" = set; then + withval="$with_tags" + tagnames="$withval" +fi; + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} + else + { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 +echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in + "") ;; + *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 +echo "$as_me: error: invalid tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 +echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} + { (exit 1); exit 1; }; } + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_flag_spec_ld_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_automatic_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +compiler_CXX=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +else + lt_prog_compiler_no_builtin_flag_CXX= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + +# 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 $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $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. + [\\/]* | ?:[\\/]*) + 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 + 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 + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + 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. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +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. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 +ld_shlibs_CXX=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_CXX=yes + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty executable. + 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_CXX=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX=' ' + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs_CXX=no + fi + ;; + + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + archive_cmds_need_lc_CXX=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag_CXX='-flat_namespace -undefined suppress' + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='-all_load $convenience' + link_all_deplibs_CXX=yes + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + freebsd12*) + # C++ shared libraries reported to be fairly broken before switch to ELF + ld_shlibs_CXX=no + ;; + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + freebsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + gnu*) + ;; + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC) + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_CXX='+b $libdir' + hardcode_libdir_separator_CXX=: + ;; + ia64*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + *) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + archive_cmds_need_lc_CXX=no + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + sco*) + archive_cmds_need_lc_CXX=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.0-5 | solaris2.0-5.*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + archive_cmds_need_lc_CXX=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; +esac +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +GCC_CXX="$GXX" +LD_CXX="$LD" + + +cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + +lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + icpc) + # Intel C++ + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11020: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:11024: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 + +if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11087: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:11091: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_CXX=no + else + archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var CXX" || \ + test "X$hardcode_automatic_CXX"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 +echo "${ECHO_T}$hardcode_action_CXX" >&6 + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + case $LD in # libtool.m4 will add one of these switches to LD + *"-m elf_x86_64"*|*"-m elf64ppc"*|*"-m elf64_s390"*|*"-m elf64_sparc"*) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64" + ;; + esac + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+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 shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +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 shl_load (); +int +main () +{ +shl_load (); + ; + 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=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_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+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 dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=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_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +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 dld_link (); +int +main () +{ +dld_link (); + ; + 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=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_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_CXX \ + CC_CXX \ + LD_CXX \ + lt_prog_compiler_wl_CXX \ + lt_prog_compiler_pic_CXX \ + lt_prog_compiler_static_CXX \ + lt_prog_compiler_no_builtin_flag_CXX \ + export_dynamic_flag_spec_CXX \ + thread_safe_flag_spec_CXX \ + whole_archive_flag_spec_CXX \ + enable_shared_with_static_runtimes_CXX \ + old_archive_cmds_CXX \ + old_archive_from_new_cmds_CXX \ + predep_objects_CXX \ + postdep_objects_CXX \ + predeps_CXX \ + postdeps_CXX \ + compiler_lib_search_path_CXX \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_CXX + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS=$lt_AS + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_CXX +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_CXX + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_CXX" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +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 + +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld + + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + +archive_cmds_need_lc_F77=no +allow_undefined_flag_F77= +always_export_symbols_F77=no +archive_expsym_cmds_F77= +export_dynamic_flag_spec_F77= +hardcode_direct_F77=no +hardcode_libdir_flag_spec_F77= +hardcode_libdir_flag_spec_ld_F77= +hardcode_libdir_separator_F77= +hardcode_minus_L_F77=no +hardcode_automatic_F77=no +module_cmds_F77= +module_expsym_cmds_F77= +link_all_deplibs_F77=unknown +old_archive_cmds_F77=$old_archive_cmds +no_undefined_flag_F77= +whole_archive_flag_spec_F77= +enable_shared_with_static_runtimes_F77=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +objext_F77=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code=" subroutine t\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +compiler_F77=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +test "$ld_shlibs_F77" = no && can_build_shared=no + +GCC_F77="$G77" +LD_F77="$LD" + +lt_prog_compiler_wl_F77= +lt_prog_compiler_pic_F77= +lt_prog_compiler_static_F77= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_static_F77='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_F77=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_F77=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_F77='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + else + lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux*) + case $CC in + icc|ecc) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-static' + ;; + ccc) + lt_prog_compiler_wl_F77='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_F77='-Kpic' + lt_prog_compiler_static_F77='-dn' + ;; + + solaris*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl_F77='-Qoption ld ' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_F77='-Kconform_pic' + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic_F77='-pic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_F77"; then + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13257: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:13261: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 + +if test x"$lt_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_F77=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13324: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:13328: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_F77=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_F77= + enable_shared_with_static_runtimes_F77=no + archive_cmds_F77= + archive_expsym_cmds_F77= + old_archive_From_new_cmds_F77= + old_archive_from_expsyms_cmds_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + thread_safe_flag_spec_F77= + hardcode_libdir_flag_spec_F77= + hardcode_libdir_flag_spec_ld_F77= + hardcode_libdir_separator_F77= + hardcode_direct_F77=no + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=unsupported + link_all_deplibs_F77=unknown + hardcode_automatic_F77=no + module_cmds_F77= + module_expsym_cmds_F77= + always_export_symbols_F77=no + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_F77= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_F77=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + sunos4*) + archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + + if test "$ld_shlibs_F77" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=yes + archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_F77=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_F77=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_F77=yes + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_F77=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_F77='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_F77="-z nodefs" + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_F77=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_F77=' ' + archive_cmds_need_lc_F77=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_F77=no + ;; + + bsdi4*) + export_dynamic_flag_spec_F77=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_F77=' ' + allow_undefined_flag_F77=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_F77='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_F77=yes + ;; + + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + archive_cmds_need_lc_F77=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag_F77='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_F77='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_F77=no + hardcode_automatic_F77=yes + hardcode_shlibpath_var_F77=unsupported + whole_archive_flag_spec_F77='-all_load $convenience' + link_all_deplibs_F77=yes + fi + ;; + + dgux*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + freebsd1*) + ld_shlibs_F77=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_F77='+b $libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + ;; + ia64*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + *) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + link_all_deplibs_F77=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_F77='-rpath $libdir' + fi + hardcode_libdir_separator_F77=: + ;; + + sco3.2v5*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_F77=' -z text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_shlibpath_var_F77=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs_F77=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_F77='$CC -r -o $output$reload_objs' + hardcode_direct_F77=no + ;; + motorola) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv4.3*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_F77=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_F77='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv5*) + no_undefined_flag_F77=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_F77= + hardcode_shlibpath_var_F77=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + *) + ld_shlibs_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 +echo "${ECHO_T}$ld_shlibs_F77" >&6 +test "$ld_shlibs_F77" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_F77" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_F77=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_F77 in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_F77 + allow_undefined_flag_F77= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_F77=no + else + archive_cmds_need_lc_F77=yes + fi + allow_undefined_flag_F77=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var F77" || \ + test "X$hardcode_automatic_F77"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 +echo "${ECHO_T}$hardcode_action_F77" >&6 + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + case $LD in # libtool.m4 will add one of these switches to LD + *"-m elf_x86_64"*|*"-m elf64ppc"*|*"-m elf64_s390"*|*"-m elf64_sparc"*) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64" + ;; + esac + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_F77 \ + CC_F77 \ + LD_F77 \ + lt_prog_compiler_wl_F77 \ + lt_prog_compiler_pic_F77 \ + lt_prog_compiler_static_F77 \ + lt_prog_compiler_no_builtin_flag_F77 \ + export_dynamic_flag_spec_F77 \ + thread_safe_flag_spec_F77 \ + whole_archive_flag_spec_F77 \ + enable_shared_with_static_runtimes_F77 \ + old_archive_cmds_F77 \ + old_archive_from_new_cmds_F77 \ + predep_objects_F77 \ + postdep_objects_F77 \ + predeps_F77 \ + postdeps_F77 \ + compiler_lib_search_path_F77 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_F77 + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS=$lt_AS + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_F77 + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_F77 +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_F77 + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_F77 +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_F77 +archive_expsym_cmds=$lt_archive_expsym_cmds_F77 +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_F77 +module_expsym_cmds=$lt_module_expsym_cmds_F77 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_F77 + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_F77 + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_F77 + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_F77 + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_F77 + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_F77 + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_F77 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_F77 + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_F77" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + + + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +objext_GCJ=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +compiler_GCJ=$CC + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +archive_cmds_need_lc_GCJ=no + + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:15271: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:15275: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl_GCJ= +lt_prog_compiler_pic_GCJ= +lt_prog_compiler_static_GCJ= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_static_GCJ='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_GCJ=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_GCJ=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_GCJ='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + else + lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux*) + case $CC in + icc|ecc) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-static' + ;; + ccc) + lt_prog_compiler_wl_GCJ='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_GCJ='-Kpic' + lt_prog_compiler_static_GCJ='-dn' + ;; + + solaris*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl_GCJ='-Qoption ld ' + lt_prog_compiler_pic_GCJ='-PIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_GCJ='-Kconform_pic' + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic_GCJ='-pic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_GCJ"; then + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:15503: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:15507: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 + +if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_GCJ=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:15570: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:15574: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_GCJ=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_GCJ= + enable_shared_with_static_runtimes_GCJ=no + archive_cmds_GCJ= + archive_expsym_cmds_GCJ= + old_archive_From_new_cmds_GCJ= + old_archive_from_expsyms_cmds_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + thread_safe_flag_spec_GCJ= + hardcode_libdir_flag_spec_GCJ= + hardcode_libdir_flag_spec_ld_GCJ= + hardcode_libdir_separator_GCJ= + hardcode_direct_GCJ=no + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=unsupported + link_all_deplibs_GCJ=unknown + hardcode_automatic_GCJ=no + module_cmds_GCJ= + module_expsym_cmds_GCJ= + always_export_symbols_GCJ=no + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_GCJ= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_GCJ=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + sunos4*) + archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + + if test "$ld_shlibs_GCJ" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=yes + archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_GCJ=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_GCJ=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_GCJ=yes + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_GCJ=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_GCJ='-berok' + # Determine the default libpath from the value encoded in an empty executable. + 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_GCJ="-z nodefs" + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_GCJ=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_GCJ=' ' + archive_cmds_need_lc_GCJ=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_GCJ=no + ;; + + bsdi4*) + export_dynamic_flag_spec_GCJ=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_GCJ=' ' + allow_undefined_flag_GCJ=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_GCJ='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_GCJ=yes + ;; + + darwin* | rhapsody*) + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + archive_cmds_need_lc_GCJ=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='-undefined suppress' + ;; + *) # Darwin 1.3 on + test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_GCJ='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_GCJ=no + hardcode_automatic_GCJ=yes + hardcode_shlibpath_var_GCJ=unsupported + whole_archive_flag_spec_GCJ='-all_load $convenience' + link_all_deplibs_GCJ=yes + fi + ;; + + dgux*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + freebsd1*) + ld_shlibs_GCJ=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + ;; + ia64*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + *) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + link_all_deplibs_GCJ=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + allow_undefined_flag_GCJ=unsupported + archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_GCJ='-rpath $libdir' + fi + hardcode_libdir_separator_GCJ=: + ;; + + sco3.2v5*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_GCJ=' -z text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_shlibpath_var_GCJ=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs_GCJ=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_GCJ='$CC -r -o $output$reload_objs' + hardcode_direct_GCJ=no + ;; + motorola) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4.3*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_GCJ=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_GCJ='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv5*) + no_undefined_flag_GCJ=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_GCJ= + hardcode_shlibpath_var_GCJ=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + *) + ld_shlibs_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 +echo "${ECHO_T}$ld_shlibs_GCJ" >&6 +test "$ld_shlibs_GCJ" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_GCJ" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_GCJ=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_GCJ in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ + allow_undefined_flag_GCJ= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_GCJ=no + else + archive_cmds_need_lc_GCJ=yes + fi + allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var GCJ" || \ + test "X$hardcode_automatic_GCJ"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 +echo "${ECHO_T}$hardcode_action_GCJ" >&6 + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + case $LD in # libtool.m4 will add one of these switches to LD + *"-m elf_x86_64"*|*"-m elf64ppc"*|*"-m elf64_s390"*|*"-m elf64_sparc"*) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64" + ;; + esac + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+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 shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +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 shl_load (); +int +main () +{ +shl_load (); + ; + 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=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_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+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 dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=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_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +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 dld_link (); +int +main () +{ +dld_link (); + ; + 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=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_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_GCJ \ + CC_GCJ \ + LD_GCJ \ + lt_prog_compiler_wl_GCJ \ + lt_prog_compiler_pic_GCJ \ + lt_prog_compiler_static_GCJ \ + lt_prog_compiler_no_builtin_flag_GCJ \ + export_dynamic_flag_spec_GCJ \ + thread_safe_flag_spec_GCJ \ + whole_archive_flag_spec_GCJ \ + enable_shared_with_static_runtimes_GCJ \ + old_archive_cmds_GCJ \ + old_archive_from_new_cmds_GCJ \ + predep_objects_GCJ \ + postdep_objects_GCJ \ + predeps_GCJ \ + postdeps_GCJ \ + compiler_lib_search_path_GCJ \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_GCJ + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_GCJ + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_GCJ + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS=$lt_AS + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_GCJ + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_GCJ +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_GCJ + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_GCJ +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_GCJ +archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_GCJ +module_expsym_cmds=$lt_module_expsym_cmds_GCJ + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_GCJ + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_GCJ + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_GCJ + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_GCJ + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_GCJ + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_GCJ + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_GCJ + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_GCJ + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_GCJ" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + RC) + + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +compiler_RC=$CC +lt_cv_prog_compiler_c_o_RC=yes + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM SED SHELL \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_RC \ + CC_RC \ + LD_RC \ + lt_prog_compiler_wl_RC \ + lt_prog_compiler_pic_RC \ + lt_prog_compiler_static_RC \ + lt_prog_compiler_no_builtin_flag_RC \ + export_dynamic_flag_spec_RC \ + thread_safe_flag_spec_RC \ + whole_archive_flag_spec_RC \ + enable_shared_with_static_runtimes_RC \ + old_archive_cmds_RC \ + old_archive_from_new_cmds_RC \ + predep_objects_RC \ + postdep_objects_RC \ + predeps_RC \ + postdeps_RC \ + compiler_lib_search_path_RC \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_RC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_RC + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS=$lt_AS + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_RC +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_RC + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_RC + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_RC + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_RC" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +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 + +CC="$lt_save_CC" + + ;; + + *) + { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 +echo "$as_me: error: Unsupported tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 +echo "$as_me: error: unable to update list of available tagged configurations." >&2;} + { (exit 1); exit 1; }; } + fi +fi @@ -8190,6 +18672,24 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion + + + + + + + + + + + + + + + + + + #LIBTOOL="$LIBTOOL --silent" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -10879,6 +21379,13 @@ 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 if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -10886,6 +21393,13 @@ echo "$as_me: error: conditional \"ENABLE_GNOME_VFS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" 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 @@ -11450,6 +21964,7 @@ s,@target_os@,$target_os,;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 @@ -11464,6 +21979,7 @@ 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 @@ -11483,6 +21999,8 @@ 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,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t @@ -11491,9 +22009,21 @@ s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t s,@ENABLE_GNOME_VFS_FALSE@,$ENABLE_GNOME_VFS_FALSE,;t t -s,@ECHO@,$ECHO,;t t -s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t +s,@ECHO@,$ECHO,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t +s,@CPP@,$CPP,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@CXXCPP@,$CXXCPP,;t t +s,@F77@,$F77,;t t +s,@FFLAGS@,$FFLAGS,;t t +s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@LIBTOOL_DEPS@,$LIBTOOL_DEPS,;t t s,@all_includes@,$all_includes,;t t @@ -11926,13 +22456,29 @@ echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} cat $tmp/config.h rm -f $tmp/config.h fi - # Run the commands associated with the file. - case $ac_file in - config.h ) # update the timestamp -echo 'timestamp for config.h' >"./stamp-h1" - ;; +# 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 diff --git a/doc/Makefile.in b/doc/Makefile.in index 49827c8a..519131ab 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.6.3 from Makefile.am. +# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# 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, @@ -13,88 +13,140 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -SHELL = @SHELL@ 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 pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c -INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -host_alias = @host_alias@ host_triplet = @host@ - -EXEEXT = @EXEEXT@ -OBJEXT = @OBJEXT@ -PATH_SEPARATOR = @PATH_SEPARATOR@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AS = @AS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ +ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ +LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -OBJDUMP = @OBJDUMP@ +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@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ +REALLYSTATIC_FALSE = @REALLYSTATIC_FALSE@ +REALLYSTATIC_TRUE = @REALLYSTATIC_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_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@ +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 = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ EXTRA_DIST = \ CodingStyle \ attribute_definitions \ @@ -107,6 +159,7 @@ EXTRA_DIST = \ system_security_descriptors.txt subdir = doc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -133,13 +186,22 @@ uninstall-info-am: tags: TAGS TAGS: +ctags: CTAGS +CTAGS: + DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @list='$(DISTFILES)'; for file in $$list; do \ + @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 \ @@ -164,7 +226,6 @@ check: check-am all-am: Makefile installdirs: - install: install-am install-exec: install-exec-am install-data: install-data-am @@ -223,6 +284,14 @@ mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + uninstall-am: uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-libtool \ @@ -232,7 +301,8 @@ uninstall-am: uninstall-info-am install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool uninstall uninstall-am uninstall-info-am + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am # 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. diff --git a/include/Makefile.in b/include/Makefile.in index 16a91271..10950416 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.6.3 from Makefile.am. +# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# 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, @@ -13,88 +13,140 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -SHELL = @SHELL@ 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 pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c -INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -host_alias = @host_alias@ host_triplet = @host@ - -EXEEXT = @EXEEXT@ -OBJEXT = @OBJEXT@ -PATH_SEPARATOR = @PATH_SEPARATOR@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AS = @AS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ +ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ +LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -OBJDUMP = @OBJDUMP@ +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@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ +REALLYSTATIC_FALSE = @REALLYSTATIC_FALSE@ +REALLYSTATIC_TRUE = @REALLYSTATIC_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_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@ +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 = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ linux_ntfsincludedir = $(includedir)/ntfs linux_ntfsinclude_HEADERS = \ @@ -124,6 +176,7 @@ linux_ntfsinclude_HEADERS = \ volume.h subdir = include +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = @@ -171,6 +224,9 @@ uninstall-linux_ntfsincludeHEADERS: ETAGS = etags ETAGSFLAGS = +CTAGS = ctags +CTAGSFLAGS = + tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -196,20 +252,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @list='$(DISTFILES)'; for file in $$list; do \ + @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 \ @@ -235,7 +312,6 @@ all-am: Makefile $(HEADERS) installdirs: $(mkinstalldirs) $(DESTDIR)$(linux_ntfsincludedir) - install: install-am install-exec: install-exec-am install-data: install-data-am @@ -295,18 +371,27 @@ 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-linux_ntfsincludeHEADERS -.PHONY: GTAGS all all-am check check-am clean clean-generic \ - clean-libtool distclean distclean-generic distclean-libtool \ - distclean-tags 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 \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags 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-linux_ntfsincludeHEADERS install-man install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool tags uninstall uninstall-am \ - uninstall-info-am uninstall-linux_ntfsincludeHEADERS + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am \ + uninstall-linux_ntfsincludeHEADERS # 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. diff --git a/include/bitmap.h b/include/bitmap.h index 910acd2c..3f2694b2 100644 --- a/include/bitmap.h +++ b/include/bitmap.h @@ -46,7 +46,7 @@ static __inline__ void ntfs_bit_set(u8 *bitmap, const u64 bit, const u8 new_value) { -// Dprintf("bitmap %p, bit 0x%Lx, new_value %i\n", bitmap, bit, new_value); +// Dprintf("bitmap %p, bit 0x%llx, new_value %i\n", bitmap, bit, new_value); if (!bitmap || new_value > 1) return; if (!new_value) diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 6d02058e..28a38e5e 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.6.3 from Makefile.am. +# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# 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, @@ -40,88 +40,140 @@ # # - If the interface is the same as the previous version, change to C:R+1:A # -SHELL = @SHELL@ 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 pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c -INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -host_alias = @host_alias@ host_triplet = @host@ - -EXEEXT = @EXEEXT@ -OBJEXT = @OBJEXT@ -PATH_SEPARATOR = @PATH_SEPARATOR@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AS = @AS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ +ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ +LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -OBJDUMP = @OBJDUMP@ +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@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ +REALLYSTATIC_FALSE = @REALLYSTATIC_FALSE@ +REALLYSTATIC_TRUE = @REALLYSTATIC_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_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@ +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 = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ LTVERSION_LIBNTFS = 5:0:0 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 @@ -170,6 +222,7 @@ INCLUDES = $(linux_ntfsincludedir) $(all_includes) EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in subdir = libntfs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = libntfs.conf libntfs-gnomevfs.8 @@ -185,7 +238,6 @@ am_libntfs_la_OBJECTS = attrib.lo bitmap.lo bootsect.lo compat.lo \ lcnalloc.lo mft.lo mst.lo runlist.lo unistr.lo volume.lo libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) -DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -254,7 +306,7 @@ clean-gnomevfsmoduleslibLTLIBRARIES: -test -z "$(gnomevfsmoduleslib_LTLIBRARIES)" || rm -f $(gnomevfsmoduleslib_LTLIBRARIES) @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test -z "$dir" && dir=.; \ + test "$$dir" = "$$p" && dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done @@ -282,12 +334,10 @@ clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test -z "$dir" && dir=.; \ + test "$$dir" = "$$p" && dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c -libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c libntfs-gnomevfs.la: $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_DEPENDENCIES) $(LINK) -rpath $(gnomevfsmoduleslibdir) $(libntfs_gnomevfs_la_LDFLAGS) $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_LIBADD) $(LIBS) libntfs.la: $(libntfs_la_OBJECTS) $(libntfs_la_DEPENDENCIES) @@ -322,59 +372,103 @@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `cygpath -w $<` +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` .c.lo: -@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< libntfs_gnomevfs_la-gnome-vfs-method.o: gnome-vfs-method.c -@AMDEP_TRUE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.o `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.o -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" \ +@am__fastdepCC_TRUE@ -c -o libntfs_gnomevfs_la-gnome-vfs-method.o `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.o `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c libntfs_gnomevfs_la-gnome-vfs-method.obj: gnome-vfs-method.c -@AMDEP_TRUE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.obj `cygpath -w gnome-vfs-method.c` +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.obj -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" \ +@am__fastdepCC_TRUE@ -c -o libntfs_gnomevfs_la-gnome-vfs-method.obj `if test -f 'gnome-vfs-method.c'; then $(CYGPATH_W) 'gnome-vfs-method.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-method.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.obj `if test -f 'gnome-vfs-method.c'; then $(CYGPATH_W) 'gnome-vfs-method.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-method.c'; fi` libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c -@AMDEP_TRUE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" \ +@am__fastdepCC_TRUE@ -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c libntfs_gnomevfs_la-gnome-vfs-module.o: gnome-vfs-module.c -@AMDEP_TRUE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.o `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.o -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" \ +@am__fastdepCC_TRUE@ -c -o libntfs_gnomevfs_la-gnome-vfs-module.o `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.o `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c libntfs_gnomevfs_la-gnome-vfs-module.obj: gnome-vfs-module.c -@AMDEP_TRUE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.obj `cygpath -w gnome-vfs-module.c` +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.obj -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" \ +@am__fastdepCC_TRUE@ -c -o libntfs_gnomevfs_la-gnome-vfs-module.obj `if test -f 'gnome-vfs-module.c'; then $(CYGPATH_W) 'gnome-vfs-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-module.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.obj `if test -f 'gnome-vfs-module.c'; then $(CYGPATH_W) 'gnome-vfs-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-module.c'; fi` libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c -@AMDEP_TRUE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c -CCDEPMODE = @CCDEPMODE@ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" \ +@am__fastdepCC_TRUE@ -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c mostlyclean-libtool: -rm -f *.lo @@ -422,6 +516,10 @@ uninstall-man8: done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 8*) ;; \ + *) ext='8' ;; \ + esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ @@ -450,6 +548,9 @@ uninstall-gnomevfsmodulesconfDATA: ETAGS = etags ETAGSFLAGS = +CTAGS = ctags +CTAGSFLAGS = + tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -475,20 +576,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @list='$(DISTFILES)'; for file in $$list; do \ + @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 \ @@ -514,7 +636,6 @@ all-am: Makefile $(LTLIBRARIES) $(MANS) $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(gnomevfsmoduleslibdir) $(DESTDIR)$(libdir) $(DESTDIR)$(man8dir) $(DESTDIR)$(gnomevfsmodulesconfdir) - install: install-am install-exec: install-exec-am install-data: install-data-am @@ -577,25 +698,34 @@ mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + uninstall-am: uninstall-gnomevfsmodulesconfDATA \ uninstall-gnomevfsmoduleslibLTLIBRARIES uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-man uninstall-man: uninstall-man8 -.PHONY: GTAGS all all-am check check-am clean clean-generic \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-gnomevfsmoduleslibLTLIBRARIES clean-libLTLIBRARIES \ - clean-libtool distclean distclean-compile distclean-depend \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am \ - install-gnomevfsmodulesconfDATA \ + clean-libtool ctags distclean distclean-compile \ + distclean-depend distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-gnomevfsmodulesconfDATA \ install-gnomevfsmoduleslibLTLIBRARIES install-info \ install-info-am install-libLTLIBRARIES install-man install-man8 \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - tags uninstall uninstall-am uninstall-gnomevfsmodulesconfDATA \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ + pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-gnomevfsmodulesconfDATA \ uninstall-gnomevfsmoduleslibLTLIBRARIES uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-man uninstall-man8 diff --git a/libntfs/attrib.c b/libntfs/attrib.c index de32528c..e439d1f4 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -327,7 +327,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, ATTR_RECORD *a; int err; - Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x.\n", __FUNCTION__, + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)ni->mft_no, type); if (!ni || !ni->vol || !ni->mrec) { errno = EINVAL; @@ -410,7 +410,7 @@ int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn) ntfs_attr_search_ctx *ctx; int err; - Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x, vcn 0x%Lx.\n", + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, vcn 0x%llx.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type, (long long)vcn); @@ -459,7 +459,7 @@ int ntfs_attr_map_whole_runlist(ntfs_attr *na) ATTR_RECORD *a; int err; - Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x.\n", __FUNCTION__, + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type); ctx = ntfs_attr_get_search_ctx(na->ni, NULL); @@ -528,7 +528,7 @@ int ntfs_attr_map_whole_runlist(ntfs_attr *na) Dprintf("%s(): Failed to load the complete run list for the " "attribute. Bug or corrupt inode.\n", __FUNCTION__); - Dprintf("%s(): highest_vcn = 0x%Lx, last_vcn - 1 = 0x%Lx\n", + Dprintf("%s(): highest_vcn = 0x%llx, last_vcn - 1 = 0x%llx\n", __FUNCTION__, (long long)highest_vcn, (long long)last_vcn - 1); errno = EIO; @@ -694,8 +694,8 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) ntfs_volume *vol; runlist_element *rl; - Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x, pos 0x%Lx, " - "count 0x%Lx.\n", __FUNCTION__, + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, " + "count 0x%llx.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type, (long long)pos, (long long)count); if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) { @@ -802,8 +802,8 @@ res_err_out: to_read = min(count, (rl->length << vol->cluster_size_bits) - ofs); retry: - Dprintf("%s(): Reading 0x%Lx bytes from vcn 0x%Lx, lcn 0x%Lx, " - "ofs 0x%Lx.\n", __FUNCTION__, to_read, + Dprintf("%s(): Reading 0x%llx bytes from vcn 0x%llx, lcn 0x%llx, " + "ofs 0x%llx.\n", __FUNCTION__, to_read, rl->vcn, rl->lcn, ofs); br = ntfs_pread(vol->dev, (rl->lcn << vol->cluster_size_bits) + ofs, to_read, b); @@ -865,8 +865,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) unsigned int initialized_size : 1; } need_to_undo = { 0 }; - Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x, pos 0x%Lx, " - "count 0x%Lx.\n", __FUNCTION__, na->ni->mft_no, + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, " + "count 0x%llx.\n", __FUNCTION__, na->ni->mft_no, na->type, (long long)pos, (long long)count); if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) { errno = EINVAL; @@ -1059,8 +1059,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) to_write = min(count, (rl->length << vol->cluster_size_bits) - ofs); retry: - Dprintf("%s(): Writing 0x%Lx bytes to vcn 0x%Lx, lcn 0x%Lx, " - "ofs 0x%Lx.\n", __FUNCTION__, to_write, + Dprintf("%s(): Writing 0x%llx bytes to vcn 0x%llx, lcn 0x%llx, " + "ofs 0x%llx.\n", __FUNCTION__, to_write, rl->vcn, rl->lcn, ofs); if (!NVolReadOnly(vol)) written = ntfs_pwrite(vol->dev, (rl->lcn << @@ -1175,7 +1175,7 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, s64 br; u8 *end; - Dprintf("%s(): Entering for inode 0x%Lx, attr type 0x%x, pos 0x%Lx.\n", + Dprintf("%s(): Entering for inode 0x%llx, attr type 0x%x, pos 0x%llx.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type, (long long)pos); if (bk_cnt < 0 || bk_size % NTFS_SECTOR_SIZE) { @@ -1227,7 +1227,7 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, { s64 written, i; - Dprintf("%s(): Entering for inode 0x%Lx, attr type 0x%x, pos 0x%Lx.\n", + Dprintf("%s(): Entering for inode 0x%llx, attr type 0x%x, pos 0x%llx.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type, (long long)pos); if (bk_cnt < 0 || bk_size % NTFS_SECTOR_SIZE) { @@ -1544,7 +1544,7 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const uchar_t *name, ni = ctx->ntfs_ino; base_ni = ctx->base_ntfs_ino; - Dprintf("Entering for inode %Lu, attribute type 0x%x.\n", + Dprintf("Entering for inode %llu, attribute type 0x%x.\n", (unsigned long long)ni->mft_no, type); if (!base_ni) { /* First call happens with the base mft record. */ @@ -2387,7 +2387,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, err = errno; // FIXME: Eeek! fprintf(stderr, "%s(): Eeek! Failed to write out attribute " - "value (bw = %Li, errno = %i). Aborting...\n", + "value (bw = %lli, errno = %i). Aborting...\n", __FUNCTION__, (long long)bw, err); if (bw >= 0) err = EIO; @@ -2518,7 +2518,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) ntfs_volume *vol; int err; - Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x.\n", __FUNCTION__, + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type); /* Get the attribute record that needs modification. */ ctx = ntfs_attr_get_search_ctx(na->ni, NULL); @@ -2828,7 +2828,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) u32 new_alen, new_muse; int err, mp_size; - Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x.\n", __FUNCTION__, + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type); vol = na->ni->vol; @@ -2944,7 +2944,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) if (!newsize && na->compressed_size) { fprintf(stderr, "%s(): Eeek! !newsize but " "na->compressed_size not zero " - "(= %Li)! Fixing up by hand!\n", + "(= %lli)! Fixing up by hand!\n", __FUNCTION__, (long long) na->compressed_size); na->compressed_size = 0; diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index c4eb3b1c..f18fb52b 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -161,7 +161,7 @@ static int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, s64 count, if (lastbyte && count != 0) { // FIXME: Eeek! BUG! fprintf(stderr, "%s(): Eeek! Last buffer but count is " - "not zero (= %Li). Leaving " + "not zero (= %lli). Leaving " "inconsistent metadata.\n", __FUNCTION__, count); err = EIO; diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index df12276c..1827f552 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -195,7 +195,7 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) * ntfs_boot_sector_is_ntfs but in this way we can just do this once. */ sectors_per_cluster = bs->bpb.sectors_per_cluster; - Dprintf("NumberOfSectors = %Li\n", sle64_to_cpu(bs->number_of_sectors)); + Dprintf("NumberOfSectors = %lli\n", sle64_to_cpu(bs->number_of_sectors)); Dprintf("SectorsPerCluster = 0x%x\n", sectors_per_cluster); if (sectors_per_cluster & (sectors_per_cluster - 1)) { Dprintf("Error: %s is not a valid NTFS partition! " @@ -208,8 +208,8 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) vol->mft_lcn = sle64_to_cpu(bs->mft_lcn); vol->mftmirr_lcn = sle64_to_cpu(bs->mftmirr_lcn); - Dprintf("MFT LCN = 0x%Lx\n", vol->mft_lcn); - Dprintf("MFTMirr LCN = 0x%Lx\n", vol->mftmirr_lcn); + Dprintf("MFT LCN = 0x%llx\n", vol->mft_lcn); + Dprintf("MFTMirr LCN = 0x%llx\n", vol->mftmirr_lcn); if (vol->mft_lcn > vol->nr_clusters || vol->mftmirr_lcn > vol->nr_clusters) { Dprintf("Error: %s is not a valid NTFS partition! ($Mft LCN " diff --git a/libntfs/compress.c b/libntfs/compress.c index b95e1bab..87fb0e09 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -261,8 +261,8 @@ s64 ntfs_compressed_attr_pread(ntfs_attr *na, s64 pos, s64 count, void *b) int err; unsigned int nr_cbs, cb_clusters; - Dprintf("%s(): Entering for inode 0x%Lx, attr 0x%x, pos 0x%Lx, " - "count 0x%Lx.\n", __FUNCTION__, + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, " + "count 0x%llx.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type, (long long)pos, (long long)count); if (!na || !NAttrCompressed(na) || !na->ni || !na->ni->vol || !b || diff --git a/libntfs/debug.c b/libntfs/debug.c index efe309af..8463ee93 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -46,11 +46,11 @@ void ntfs_debug_runlist_dump(const runlist_element *rl) if (index > -LCN_EINVAL - 1) index = 4; - Dprintf("%-16Lx %s %-16Lx%s\n", rl[i].vcn, + Dprintf("%-16llx %s %-16llx%s\n", rl[i].vcn, lcn_str[index], rl[i].length, rl[i].length ? "" : " (runlist end)"); } else - Dprintf("%-16Lx %-16Lx %-16Lx%s\n", rl[i].vcn, + Dprintf("%-16llx %-16llx %-16llx%s\n", rl[i].vcn, rl[i].lcn, rl[i].length, rl[i].length ? "" : " (runlist end)"); } while (rl[i++].length); diff --git a/libntfs/device.c b/libntfs/device.c index 1ed7068f..9ba4b6f2 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -135,7 +135,7 @@ s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, void *b) s64 br, total; struct ntfs_device_operations *dops; - Dprintf("%s(): Entering for pos 0x%Lx, count 0x%Lx.\n", __FUNCTION__, + Dprintf("%s(): Entering for pos 0x%llx, count 0x%llx.\n", __FUNCTION__, pos, count); if (!b || count < 0 || pos < 0) { errno = EINVAL; @@ -146,7 +146,7 @@ s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, void *b) dops = dev->d_ops; /* Locate to position. */ if (dops->seek(dev, pos, SEEK_SET) == (off_t)-1) { - Dprintf("ntfs_pread: device seek to 0x%Lx returned error: " + Dprintf("ntfs_pread: device seek to 0x%llx returned error: " "%s\n", pos, strerror(errno)); return -1; } @@ -191,7 +191,7 @@ s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, s64 written, total; struct ntfs_device_operations *dops; - Dprintf("%s(): Entering for pos 0x%Lx, count 0x%Lx.\n", __FUNCTION__, + Dprintf("%s(): Entering for pos 0x%llx, count 0x%llx.\n", __FUNCTION__, pos, count); if (!b || count < 0 || pos < 0) { errno = EINVAL; @@ -206,7 +206,7 @@ s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, dops = dev->d_ops; /* Locate to position. */ if (dops->seek(dev, pos, SEEK_SET) == (off_t)-1) { - Dprintf("ntfs_pwrite: seek to 0x%Lx returned error: %s\n", + Dprintf("ntfs_pwrite: seek to 0x%llx returned error: %s\n", pos, strerror(errno)); return -1; } diff --git a/libntfs/dir.c b/libntfs/dir.c index 050545b2..11fe50d1 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -92,7 +92,7 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const uchar_t *uname, if (ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 0, ctx)) { Dprintf("Index root attribute missing in directory inode " - "0x%Lx: %s\n", + "0x%llx: %s\n", (unsigned long long)dir_ni->mft_no, strerror(errno)); goto put_err_out; @@ -228,7 +228,7 @@ found_it: ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, I30, 4); if (!ia_na) { Dprintf("Failed to open index allocation attribute. Directory " - "inode 0x%Lx is corrupt or driver bug: %s\n", + "inode 0x%llx is corrupt or driver bug: %s\n", (unsigned long long)dir_ni->mft_no, strerror(errno)); goto put_err_out; @@ -261,20 +261,20 @@ descend_into_child_node: if (br != 1) { if (br != -1) errno = EIO; - Dprintf("Failed to read vcn 0x%Lx: %s\n", vcn, strerror(errno)); + Dprintf("Failed to read vcn 0x%llx: %s\n", vcn, strerror(errno)); goto close_err_out; } if (sle64_to_cpu(ia->index_block_vcn) != vcn) { - Dprintf("Actual VCN (0x%Lx) of index buffer is different from " - "expected VCN (0x%Lx).\n", + Dprintf("Actual VCN (0x%llx) of index buffer is different from " + "expected VCN (0x%llx).\n", (long long)sle64_to_cpu(ia->index_block_vcn), (long long)vcn); errno = EIO; goto close_err_out; } if (le32_to_cpu(ia->index.allocated_size) + 0x18 != index_block_size) { - Dprintf("Index buffer (VCN 0x%Lx) of directory inode 0x%Lx " + Dprintf("Index buffer (VCN 0x%llx) of directory inode 0x%llx " "has a size (%u) differing from the directory " "specified size (%u).\n", (long long)vcn, (unsigned long long)dir_ni->mft_no, @@ -285,8 +285,8 @@ descend_into_child_node: } index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); if (index_end > (u8*)ia + index_block_size) { - Dprintf("Size of index buffer (VCN 0x%Lx) of directory inode " - "0x%Lx exceeds maximum size.\n", (long long)vcn, + Dprintf("Size of index buffer (VCN 0x%llx) of directory inode " + "0x%llx exceeds maximum size.\n", (long long)vcn, (unsigned long long)dir_ni->mft_no); errno = EIO; goto close_err_out; @@ -307,7 +307,7 @@ descend_into_child_node: (u8*)ie + le16_to_cpu(ie->key_length) > index_end) { Dprintf("Index entry out of bounds in directory inode " - "0x%Lx.\n", + "0x%llx.\n", (unsigned long long)dir_ni->mft_no); errno = EIO; goto close_err_out; @@ -408,7 +408,7 @@ found_it2: if (ie->flags & INDEX_ENTRY_NODE) { if ((ia->index.flags & NODE_MASK) == LEAF_NODE) { Dprintf("Index entry with child node found in a leaf " - "node in directory inode 0x%Lx.\n", + "node in directory inode 0x%llx.\n", (unsigned long long)dir_ni->mft_no); errno = EIO; goto close_err_out; @@ -417,7 +417,7 @@ found_it2: vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8); if (vcn >= 0) goto descend_into_child_node; - Dprintf("Negative child node vcn in directory inode 0x%Lx.\n", + Dprintf("Negative child node vcn in directory inode 0x%llx.\n", (unsigned long long)dir_ni->mft_no); errno = EIO; goto close_err_out; @@ -547,20 +547,20 @@ static MFT_REF ntfs_mft_get_parent_ref(ntfs_inode *ni) if (!ctx) return ERR_MREF(-1); if (ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - Dprintf("No file name found in inode 0x%Lx. Corrupt inode.\n", + Dprintf("No file name found in inode 0x%llx. Corrupt inode.\n", (unsigned long long)ni->mft_no); goto err_out; } if (ctx->attr->non_resident) { Dprintf("File name attribute must be resident. Corrupt inode " - "0x%Lx.\n", (unsigned long long)ni->mft_no); + "0x%llx.\n", (unsigned long long)ni->mft_no); goto io_err_out; } fn = (FILE_NAME_ATTR*)((u8*)ctx->attr + le16_to_cpu(ctx->attr->value_offset)); if ((u8*)fn + le32_to_cpu(ctx->attr->value_length) > (u8*)ctx->attr + le32_to_cpu(ctx->attr->length)) { - Dprintf("Corrupt file name attribute in inode 0x%Lx.\n", + Dprintf("Corrupt file name attribute in inode 0x%llx.\n", (unsigned long long)ni->mft_no); goto io_err_out; } @@ -619,7 +619,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, vol = dir_ni->vol; - Dprintf("Entering for inode 0x%Lx, *pos 0x%Lx.\n", + Dprintf("Entering for inode 0x%llx, *pos 0x%llx.\n", (unsigned long long)dir_ni->mft_no, (long long)*pos); /* Open the index allocation attribute. */ @@ -627,7 +627,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, if (!ia_na) { if (errno != ENOENT) { Dprintf("Failed to open index allocation attribute. " - "Directory inode 0x%Lx is corrupt or " + "Directory inode 0x%llx is corrupt or " "bug: %s\n", (unsigned long long)dir_ni->mft_no, strerror(errno)); @@ -679,7 +679,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, if (ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 0, ctx)) { Dprintf("Index root attribute missing in directory inode " - "0x%Lx.\n", (unsigned long long)dir_ni->mft_no); + "0x%llx.\n", (unsigned long long)dir_ni->mft_no); goto dir_err_out; } /* Get to the index root value. */ @@ -820,7 +820,7 @@ find_next_index_buffer: } } - Dprintf("Handling index block 0x%Lx.", (long long)bmp_pos); + Dprintf("Handling index block 0x%llx.", (long long)bmp_pos); /* Read the index block starting at bmp_pos. */ br = ntfs_attr_mst_pread(ia_na, bmp_pos << index_block_size_bits, 1, @@ -835,15 +835,15 @@ find_next_index_buffer: ia_start = ia_pos & ~(s64)(index_block_size - 1); if (sle64_to_cpu(ia->index_block_vcn) != ia_start >> index_vcn_size_bits) { - Dprintf("Actual VCN (0x%Lx) of index buffer is different from " - "expected VCN (0x%Lx) in inode 0x%Lx.\n", + Dprintf("Actual VCN (0x%llx) of index buffer is different from " + "expected VCN (0x%llx) in inode 0x%llx.\n", (long long)sle64_to_cpu(ia->index_block_vcn), (long long)ia_start >> index_vcn_size_bits, (unsigned long long)dir_ni->mft_no); goto dir_err_out; } if (le32_to_cpu(ia->index.allocated_size) + 0x18 != index_block_size) { - Dprintf("Index buffer (VCN 0x%Lx) of directory inode 0x%Lx " + Dprintf("Index buffer (VCN 0x%llx) of directory inode 0x%llx " "has a size (%u) differing from the directory " "specified size (%u).\n", (long long)ia_start >> index_vcn_size_bits, @@ -854,8 +854,8 @@ find_next_index_buffer: } index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); if (index_end > (u8*)ia + index_block_size) { - Dprintf("Size of index buffer (VCN 0x%Lx) of directory inode " - "0x%Lx exceeds maximum size.\n", + Dprintf("Size of index buffer (VCN 0x%llx) of directory inode " + "0x%llx exceeds maximum size.\n", (long long)ia_start >> index_vcn_size_bits, (unsigned long long)dir_ni->mft_no); goto dir_err_out; @@ -869,7 +869,7 @@ find_next_index_buffer: * enough or signals an error (both covered by the rc test). */ for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { - Dprintf("In index allocation, offset 0x%Lx.\n", + Dprintf("In index allocation, offset 0x%llx.\n", (long long)ia_start + ((u8*)ie - (u8*)ia)); /* Bounds checks. */ if ((u8*)ie < (u8*)ia || (u8*)ie + @@ -877,7 +877,7 @@ find_next_index_buffer: (u8*)ie + le16_to_cpu(ie->key_length) > index_end) { Dprintf("Index entry out of bounds in directory inode " - "0x%Lx.\n", + "0x%llx.\n", (unsigned long long)dir_ni->mft_no); goto dir_err_out; } @@ -907,9 +907,9 @@ done: ntfs_attr_close(ia_na); #ifdef DEBUG if (!rc) - Dprintf("EOD, *pos 0x%Lx, returning 0.\n", (long long)*pos); + Dprintf("EOD, *pos 0x%llx, returning 0.\n", (long long)*pos); else - Dprintf("filldir returned %i, *pos 0x%Lx, returning 0.\n", + Dprintf("filldir returned %i, *pos 0x%llx, returning 0.\n", rc, (long long)*pos); #endif return 0; diff --git a/libntfs/inode.c b/libntfs/inode.c index 772ccc96..b0555cdb 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -110,7 +110,7 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) ntfs_attr_search_ctx *ctx; int err = 0; - Dprintf("%s(): Entering for inode 0x%Lx.\n", __FUNCTION__, MREF(mref)); + Dprintf("%s(): Entering for inode 0x%llx.\n", __FUNCTION__, MREF(mref)); if (!vol) { errno = EINVAL; return NULL; @@ -290,7 +290,7 @@ ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref) errno = EINVAL; return NULL; } - Dprintf("Opening extent inode %Lu (base mft record 0x%Lu).\n", + Dprintf("Opening extent inode %llu (base mft record 0x%llu).\n", (unsigned long long)mft_no, (unsigned long long)base_ni->mft_no); /* Is the extent inode already open and attached to the base inode? */ diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index a8e53b41..6e3afeaf 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -101,7 +101,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, int err = 0, rlpos, rlsize, buf_size; u8 pass, done_zones, search_zone, need_writeback, bit; - Dprintf("%s(): Entering with count = 0x%Lx, start_lcn = 0x%Lx, " + Dprintf("%s(): Entering with count = 0x%llx, start_lcn = 0x%llx, " "zone = %s_ZONE.\n", __FUNCTION__, (long long)count, (long long)start_lcn, zone == MFT_ZONE ? "MFT" : "DATA"); @@ -192,15 +192,15 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, while (1) { Dprintf("%s(): Start of outer while loop: done_zones = 0x%x, " "search_zone = %i, pass = %i, zone_start = " - "0x%Lx, zone_end = 0x%Lx, bmp_initial_pos = " - "0x%Lx, bmp_pos = 0x%Lx, rlpos = %i, rlsize = " + "0x%llx, zone_end = 0x%llx, bmp_initial_pos = " + "0x%llx, bmp_pos = 0x%llx, rlpos = %i, rlsize = " "%i.\n", __FUNCTION__, done_zones, search_zone, pass, (long long)zone_start, (long long)zone_end, (long long)bmp_initial_pos, (long long)bmp_pos, rlpos, rlsize); /* Loop until we run out of free clusters. */ last_read_pos = bmp_pos >> 3; - Dprintf("%s(): last_read_pos = 0x%Lx.\n", __FUNCTION__, + Dprintf("%s(): last_read_pos = 0x%llx.\n", __FUNCTION__, (long long)last_read_pos); br = ntfs_attr_pread(vol->lcnbmp_na, last_read_pos, 8192, buf); if (br <= 0) { @@ -225,14 +225,14 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, bmp_pos &= ~7; need_writeback = 0; Dprintf("%s(): Before inner while loop: buf_size = %i, " - "lcn = 0x%Lx, bmp_pos = 0x%Lx, need_writeback " + "lcn = 0x%llx, bmp_pos = 0x%llx, need_writeback " "= %i.\n", __FUNCTION__, buf_size, (long long)lcn, (long long)bmp_pos, need_writeback); while (lcn < buf_size && lcn + bmp_pos < zone_end) { byte = buf + (lcn >> 3); Dprintf("%s(): In inner while loop: buf_size = %i, " - "lcn = 0x%Lx, bmp_pos = 0x%Lx, " + "lcn = 0x%llx, bmp_pos = 0x%llx, " "need_writeback = %i, byte ofs = 0x%x, " "*byte = 0x%x.\n", __FUNCTION__, buf_size, (long long)lcn, @@ -267,7 +267,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, /* Setup first free bit return value. */ if (!rl) { start_lcn = lcn + bmp_pos; - Dprintf("%s(): start_lcn = 0x%Lx.\n", + Dprintf("%s(): start_lcn = 0x%llx.\n", __FUNCTION__, (long long)start_lcn); } @@ -290,23 +290,23 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, * Coalesce with previous run if adjacent LCNs. * Otherwise, append a new run. */ - Dprintf("%s(): Adding run (lcn 0x%Lx, len 0x%Lx), " - "prev_lcn = 0x%Lx, lcn = 0x%Lx, " - "bmp_pos = 0x%Lx, prev_run_len = 0x%x, " + Dprintf("%s(): Adding run (lcn 0x%llx, len 0x%llx), " + "prev_lcn = 0x%llx, lcn = 0x%llx, " + "bmp_pos = 0x%llx, prev_run_len = 0x%x, " "rlpos = %i.\n", __FUNCTION__, (long long)(lcn + bmp_pos), 1LL, (long long)prev_lcn, (long long)lcn, (long long)bmp_pos, (long long)prev_run_len, rlpos); if (prev_lcn == lcn + bmp_pos - prev_run_len && rlpos) { - Dprintf("%s(): Coalescing to run (lcn 0x%Lx, " - "len 0x%Lx).\n", __FUNCTION__, + Dprintf("%s(): Coalescing to run (lcn 0x%llx, " + "len 0x%llx).\n", __FUNCTION__, (long long)rl[rlpos - 1].lcn, (long long) rl[rlpos - 1].length); rl[rlpos - 1].length = ++prev_run_len; - Dprintf("%s(): Run now (lcn 0x%Lx, len 0x%Lx), " - "prev_run_len = 0x%Lx.\n", + Dprintf("%s(): Run now (lcn 0x%llx, len 0x%llx), " + "prev_run_len = 0x%llx.\n", __FUNCTION__, (long long)rl[rlpos - 1].lcn, (long long)rl[rlpos - 1].length, @@ -315,7 +315,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, if (rlpos) { Dprintf("%s(): Adding new run, " "(previous run lcn " - "0x%Lx, len 0x%Lx).\n", + "0x%llx, len 0x%llx).\n", __FUNCTION__, (long long) rl[rlpos - 1].lcn, @@ -343,7 +343,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, */ tc = lcn + bmp_pos + 1; Dprintf("%s(): Done. Updating current zone " - "position, tc = 0x%Lx, " + "position, tc = 0x%llx, " "search_zone = %i.\n", __FUNCTION__, (long long)tc, search_zone); @@ -351,7 +351,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, case 1: Dprintf("%s(): Before checks, " "vol->mft_zone_pos = " - "0x%Lx.\n", + "0x%llx.\n", __FUNCTION__, (long long) vol->mft_zone_pos); @@ -367,7 +367,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, vol->mft_zone_pos = tc; Dprintf("%s(): After checks, " "vol->mft_zone_pos = " - "0x%Lx.\n", + "0x%llx.\n", __FUNCTION__, (long long) vol->mft_zone_pos); @@ -375,7 +375,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, case 2: Dprintf("%s(): Before checks, " "vol->data1_zone_pos = " - "0x%Lx.\n", + "0x%llx.\n", __FUNCTION__, (long long) vol->data1_zone_pos); @@ -389,7 +389,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, vol->data1_zone_pos = tc; Dprintf("%s(): After checks, " "vol->data1_zone_pos = " - "0x%Lx.\n", + "0x%llx.\n", __FUNCTION__, (long long) vol->data1_zone_pos); @@ -397,7 +397,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, case 4: Dprintf("%s(): Before checks, " "vol->data2_zone_pos = " - "0x%Lx.\n", + "0x%llx.\n", __FUNCTION__, (long long) vol->data2_zone_pos); @@ -409,7 +409,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, vol->data2_zone_pos = tc; Dprintf("%s(): After checks, " "vol->data2_zone_pos = " - "0x%Lx.\n", + "0x%llx.\n", __FUNCTION__, (long long) vol->data2_zone_pos); @@ -429,7 +429,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, } bmp_pos += buf_size; Dprintf("%s(): After inner while loop: buf_size = 0x%x, " - "lcn = 0x%Lx, bmp_pos = 0x%Lx, need_writeback " + "lcn = 0x%llx, bmp_pos = 0x%llx, need_writeback " "= %i.\n", __FUNCTION__, buf_size, (long long)lcn, (long long)bmp_pos, need_writeback); @@ -453,7 +453,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, } if (bmp_pos < zone_end) { Dprintf("%s(): Continuing outer while loop, bmp_pos = " - "0x%Lx, zone_end = 0x%Lx.\n", + "0x%llx, zone_end = 0x%llx.\n", __FUNCTION__, (long long)bmp_pos, (long long)zone_end); continue; @@ -486,8 +486,8 @@ zone_pass_done: /* Finished with the current zone pass. */ zone_end = zone_start; bmp_pos = zone_start; Dprintf("%s(): Continuing outer while loop, pass = 2, " - "zone_start = 0x%Lx, zone_end = 0x%Lx, " - "bmp_pos = 0x%Lx.\n", __FUNCTION__, + "zone_start = 0x%llx, zone_end = 0x%llx, " + "bmp_pos = 0x%llx.\n", __FUNCTION__, zone_start, zone_end, bmp_pos); continue; } /* pass == 2 */ @@ -510,7 +510,7 @@ done_zones_check: LCN tc; Dprintf("%s(): Before checks, " "vol->mft_zone_pos = " - "0x%Lx.\n", + "0x%llx.\n", __FUNCTION__, (long long) vol->mft_zone_pos); @@ -528,7 +528,7 @@ done_zones_check: vol->mft_zone_pos = tc; Dprintf("%s(): After checks, " "vol->mft_zone_pos = " - "0x%Lx.\n", + "0x%llx.\n", __FUNCTION__, (long long) vol->mft_zone_pos); @@ -554,7 +554,7 @@ switch_to_data1_zone: search_zone = 2; LCN tc; Dprintf("%s(): Before checks, " "vol->data1_zone_pos = " - "0x%Lx.\n", + "0x%llx.\n", __FUNCTION__, (long long) vol->data1_zone_pos); @@ -570,7 +570,7 @@ switch_to_data1_zone: search_zone = 2; vol->data1_zone_pos = tc; Dprintf("%s(): After checks, " "vol->data1_zone_pos = " - "0x%Lx.\n", + "0x%llx.\n", __FUNCTION__, (long long) vol->data1_zone_pos); @@ -596,7 +596,7 @@ switch_to_data1_zone: search_zone = 2; LCN tc; Dprintf("%s(): Before checks, " "vol->data2_zone_pos = " - "0x%Lx.\n", + "0x%llx.\n", __FUNCTION__, (long long) vol->data2_zone_pos); @@ -610,7 +610,7 @@ switch_to_data1_zone: search_zone = 2; vol->data2_zone_pos = tc; Dprintf("%s(): After checks, " "vol->data2_zone_pos = " - "0x%Lx.\n", + "0x%llx.\n", __FUNCTION__, (long long) vol->data2_zone_pos); @@ -621,9 +621,9 @@ switch_to_data1_zone: search_zone = 2; NTFS_BUG("switch(search_zone) 3"); } Dprintf("%s(): After zone switch, search_zone = %i, " - "pass = %i, bmp_initial_pos = 0x%Lx, " - "zone_start = 0x%Lx, zone_end = " - "0x%Lx.\n", __FUNCTION__, search_zone, + "pass = %i, bmp_initial_pos = 0x%llx, " + "zone_start = 0x%llx, zone_end = " + "0x%llx.\n", __FUNCTION__, search_zone, pass, (long long)bmp_initial_pos, (long long)zone_start, (long long)zone_end); @@ -645,8 +645,8 @@ switch_to_data1_zone: search_zone = 2; * MFT_ZONE, we have really run out of space. */ mft_zone_size = vol->mft_zone_end - vol->mft_zone_start; - Dprintf("%s(): vol->mft_zone_start = 0x%Lx, vol->mft_zone_end " - "= 0x%Lx, mft_zone_size = 0x%Lx.\n", + Dprintf("%s(): vol->mft_zone_start = 0x%llx, vol->mft_zone_end " + "= 0x%llx, mft_zone_size = 0x%llx.\n", __FUNCTION__, (long long)vol->mft_zone_start, (long long)vol->mft_zone_end, (long long)mft_zone_size); @@ -676,12 +676,12 @@ switch_to_data1_zone: search_zone = 2; pass = 2; done_zones &= ~2; Dprintf("%s(): After shrinking mft zone, mft_zone_size = " - "0x%Lx, vol->mft_zone_start = 0x%Lx, " - "vol->mft_zone_end = 0x%Lx, vol->mft_zone_pos " - "= 0x%Lx, search_zone = 2, pass = 2, " - "dones_zones = 0x%x, zone_start = 0x%Lx, " - "zone_end = 0x%Lx, vol->data1_zone_pos = " - "0x%Lx, continuing outer while loop.\n", + "0x%llx, vol->mft_zone_start = 0x%llx, " + "vol->mft_zone_end = 0x%llx, vol->mft_zone_pos " + "= 0x%llx, search_zone = 2, pass = 2, " + "dones_zones = 0x%x, zone_start = 0x%llx, " + "zone_end = 0x%llx, vol->data1_zone_pos = " + "0x%llx, continuing outer while loop.\n", __FUNCTION__, (long long)mft_zone_size, (long long)vol->mft_zone_start, (long long)vol->mft_zone_end, @@ -744,8 +744,8 @@ err_ret: Dprintf("%s(): At err_ret.\n", __FUNCTION__); if (rl) { if (err == ENOSPC) { - Dprintf("%s(): err = ENOSPC, first free lcn = 0x%Lx, " - "could allocate up to = 0x%Lx " + Dprintf("%s(): err = ENOSPC, first free lcn = 0x%llx, " + "could allocate up to = 0x%llx " "clusters.\n", __FUNCTION__, (long long)rl[0].lcn, (long long)count - clusters); @@ -766,7 +766,7 @@ err_ret: } else { if (err == ENOSPC) { Dprintf("%s(): No space left at all, err = ENOSPC, " - "first free lcn = 0x%Lx.\n", + "first free lcn = 0x%llx.\n", __FUNCTION__, (long long)vol->data1_zone_pos); } @@ -846,7 +846,7 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) // list support! (AIA) if (rl->lcn < 0 && rl->lcn != LCN_HOLE) { // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! invalid lcn (= %Li). " + fprintf(stderr, "%s(): Eeek! invalid lcn (= %lli). " "Should attempt to map runlist! " "Leaving inconsistent metadata!\n", __FUNCTION__, (long long)rl->lcn); @@ -882,7 +882,7 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) if (count != -1 && count != 0) { // FIXME: Eeek! BUG() - fprintf(stderr, "%s(): Eeek! count still not zero (= %Li). " + fprintf(stderr, "%s(): Eeek! count still not zero (= %lli). " "Leaving inconsistent metadata!\n", __FUNCTION__, (long long)count); errno = EIO; diff --git a/libntfs/mft.c b/libntfs/mft.c index 5e3b2de1..d338aaeb 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -59,7 +59,7 @@ int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref, s64 br; VCN m; - Dprintf("%s(): Entering for inode 0x%Lx.\n", __FUNCTION__, MREF(mref)); + Dprintf("%s(): Entering for inode 0x%llx.\n", __FUNCTION__, MREF(mref)); if (!vol || !vol->mft_na || !b || count < 0) { errno = EINVAL; return -1; @@ -111,7 +111,7 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, void *bmirr = NULL; int cnt = 0, res = 0; - Dprintf("%s(): Entering for inode 0x%Lx.\n", __FUNCTION__, MREF(mref)); + Dprintf("%s(): Entering for inode 0x%llx.\n", __FUNCTION__, MREF(mref)); if (!vol || !vol->mft_na || !b || count < 0) { errno = EINVAL; return -1; diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 1a066c5e..b60c2890 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -628,7 +628,7 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, int slots = 0; if (drl[ds].vcn == marker_vcn) { - Dprintf("Old marker = %Li, replacing with " + Dprintf("Old marker = %lli, replacing with " "LCN_ENOENT.\n", (long long)drl[ds].lcn); drl[ds].lcn = (LCN)LCN_ENOENT; @@ -889,8 +889,8 @@ mpa_err: * likely, there are more extents following this one. */ if (deltaxcn < --max_cluster) { - Dprintf("More extents to follow; deltaxcn = 0x%Lx, " - "max_cluster = 0x%Lx\n", + Dprintf("More extents to follow; deltaxcn = 0x%llx, " + "max_cluster = 0x%llx\n", (long long)deltaxcn, (long long)max_cluster); rl[rlpos].vcn = vcn; @@ -898,8 +898,8 @@ mpa_err: rl[rlpos].lcn = (LCN)LCN_RL_NOT_MAPPED; rlpos++; } else if (deltaxcn > max_cluster) { - Dprintf("Corrupt attribute. deltaxcn = 0x%Lx, " - "max_cluster = 0x%Lx", + Dprintf("Corrupt attribute. deltaxcn = 0x%llx, " + "max_cluster = 0x%llx", (long long)deltaxcn, (long long)max_cluster); goto mpa_err; diff --git a/libntfs/volume.c b/libntfs/volume.c index c60d1f9f..4e7e594a 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -280,7 +280,7 @@ mft_has_no_attr_list: if (highest_vcn && highest_vcn != last_vcn - 1) { Dputs("Failed to load the complete runlist for $MFT/$DATA. " "Bug or corrupt $MFT. Run chkdsk."); - Dprintf("highest_vcn = 0x%Lx, last_vcn - 1 = 0x%Lx\n", + Dprintf("highest_vcn = 0x%llx, last_vcn - 1 = 0x%llx\n", (long long)highest_vcn, (long long)last_vcn - 1); goto io_error_exit; @@ -485,7 +485,7 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) /* Setup the mft zone. */ vol->mft_zone_start = vol->mft_zone_pos = vol->mft_lcn; - Dprintf("mft_zone_pos = 0x%Lx\n", (long long)vol->mft_zone_pos); + Dprintf("mft_zone_pos = 0x%llx\n", (long long)vol->mft_zone_pos); /* * Calculate the mft_lcn for an unmodified NTFS volume (see mkntfs @@ -502,7 +502,7 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) vol->cluster_size; if (vol->mft_zone_start <= mft_lcn) vol->mft_zone_start = 0; - Dprintf("mft_zone_start = 0x%Lx\n", (long long)vol->mft_zone_start); + Dprintf("mft_zone_start = 0x%llx\n", (long long)vol->mft_zone_start); /* * Need to cap the mft zone on non-standard volumes so that it does @@ -514,16 +514,16 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) mft_zone_size >>= 1; vol->mft_zone_end = vol->mft_lcn + mft_zone_size; } - Dprintf("mft_zone_end = 0x%Lx\n", (long long)vol->mft_zone_end); + Dprintf("mft_zone_end = 0x%llx\n", (long long)vol->mft_zone_end); /* * Set the current position within each data zone to the start of the * respective zone. */ vol->data1_zone_pos = vol->mft_zone_end; - Dprintf("data1_zone_pos = 0x%Lx\n", vol->data1_zone_pos); + Dprintf("data1_zone_pos = 0x%llx\n", vol->data1_zone_pos); vol->data2_zone_pos = 0; - Dprintf("data2_zone_pos = 0x%Lx\n", vol->data2_zone_pos); + Dprintf("data2_zone_pos = 0x%llx\n", vol->data2_zone_pos); /* Set the mft data allocation position to mft record 24. */ vol->mft_data_pos = 24; diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 8159d038..4f6abc61 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.6.3 from Makefile.am. +# Makefile.in generated by automake 1.7.6 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# 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, @@ -13,88 +13,140 @@ # PARTICULAR PURPOSE. @SET_MAKE@ -SHELL = @SHELL@ 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 pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c -INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ +transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -host_alias = @host_alias@ host_triplet = @host@ - -EXEEXT = @EXEEXT@ -OBJEXT = @OBJEXT@ -PATH_SEPARATOR = @PATH_SEPARATOR@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AS = @AS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ +ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ +LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -OBJDUMP = @OBJDUMP@ +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@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ +REALLYSTATIC_FALSE = @REALLYSTATIC_FALSE@ +REALLYSTATIC_TRUE = @REALLYSTATIC_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_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@ +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 = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ @REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LFLAGS = -static @@ -180,6 +232,7 @@ dumplog_SOURCES = dumplog.c dumplog_LDADD = $(AM_LIBS) dumplog_LDFLAGS = $(AM_LFLAGS) subdir = ntfsprogs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ @@ -280,7 +333,6 @@ ntfswipe_OBJECTS = $(am_ntfswipe_OBJECTS) @REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ @REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -358,7 +410,7 @@ install-binPROGRAMS: $(bin_PROGRAMS) ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ else :; fi; \ done @@ -387,7 +439,7 @@ install-sbinPROGRAMS: $(sbin_PROGRAMS) ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f || exit 1; \ else :; fi; \ done @@ -478,23 +530,37 @@ distclean-depend: -rm -rf ./$(DEPDIR) .c.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `cygpath -w $<` +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` .c.lo: -@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< -CCDEPMODE = @CCDEPMODE@ +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< mostlyclean-libtool: -rm -f *.lo @@ -542,6 +608,10 @@ uninstall-man8: done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 8*) ;; \ + *) ext='8' ;; \ + esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ @@ -552,6 +622,9 @@ uninstall-man8: ETAGS = etags ETAGSFLAGS = +CTAGS = ctags +CTAGSFLAGS = + tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -577,20 +650,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @list='$(DISTFILES)'; for file in $$list; do \ + @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 \ @@ -616,7 +710,6 @@ all-am: Makefile $(PROGRAMS) $(MANS) installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir) - install: install-am install-exec: install-exec-am install-data: install-data-am @@ -679,13 +772,21 @@ mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man \ uninstall-sbinPROGRAMS uninstall-man: uninstall-man8 -.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool clean-sbinPROGRAMS distclean \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-sbinPROGRAMS ctags distclean \ distclean-compile distclean-depend distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am info \ info-am install install-am install-binPROGRAMS install-data \ @@ -693,10 +794,10 @@ uninstall-man: uninstall-man8 install-info-am install-man install-man8 install-sbinPROGRAMS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-info-am uninstall-man uninstall-man8 \ - uninstall-sbinPROGRAMS + mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ + pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-info-am uninstall-man \ + uninstall-man8 uninstall-sbinPROGRAMS # Extra targets diff --git a/ntfsprogs/dumplog.c b/ntfsprogs/dumplog.c index 96558a5b..db4b4559 100644 --- a/ntfsprogs/dumplog.c +++ b/ntfsprogs/dumplog.c @@ -94,7 +94,7 @@ int main(int argc, char **argv) l = sbuf.st_size; if (l > 0x400000LL) { printf("Only analysing the first four megabytes of the " - "logfile (real size = 0x%Lx).\n", + "logfile (real size = 0x%llx).\n", (unsigned long long)l); l = 0x400000LL; } @@ -157,12 +157,12 @@ pass_loc: le16_to_cpu(rph->minor_ver)); printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); printf("magic = RSTR\n"); - printf("ChkDskLsn = 0x%Lx\n", sle64_to_cpu(rph->chkdsk_lsn)); + printf("ChkDskLsn = 0x%llx\n", sle64_to_cpu(rph->chkdsk_lsn)); printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); printf("\n(1st) restart record:\n"); - printf("CurrentLsn = %Lx\n", sle64_to_cpu(rr->current_lsn)); + printf("CurrentLsn = %llx\n", sle64_to_cpu(rr->current_lsn)); printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); @@ -173,7 +173,7 @@ pass_loc: le16_to_cpu(rr->restart_area_length)); printf("ClientArrayOffset = 0x%x\n", le16_to_cpu(rr->client_array_offset)); - printf("FileSize = %Lu (0x%Lx)\n", sle64_to_cpu(rr->file_size), + printf("FileSize = %llu (0x%llx)\n", sle64_to_cpu(rr->file_size), sle64_to_cpu(rr->file_size)); printf("LastLsnDataLength = 0x%x\n", le32_to_cpu(rr->last_lsn_data_length)); @@ -182,12 +182,12 @@ pass_loc: le16_to_cpu(rr->log_page_data_offset)); for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { printf("\nRestart client record number %i:\n", client); - printf("OldestLsn = 0x%Lx\n", sle64_to_cpu(cr->oldest_lsn)); - printf("ClientRestartLsn = 0x%Lx\n", + printf("OldestLsn = 0x%llx\n", sle64_to_cpu(cr->oldest_lsn)); + printf("ClientRestartLsn = 0x%llx\n", sle64_to_cpu(cr->client_restart_lsn)); printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); - printf("SeqNumber = 0x%Lx\n", le64_to_cpu(cr->seq_number)); + printf("SeqNumber = 0x%llx\n", le64_to_cpu(cr->seq_number)); printf("ClientNameLength = 0x%x\n", le32_to_cpu(cr->client_name_length)); if (le32_to_cpu(cr->client_name_length)) { @@ -226,14 +226,14 @@ rcrd_pass_loc: printf(":"); /* Dump log record page */ printf("\nmagic = RCRD\n"); - printf("copy.last_lsn/file_offset = 0x%Lx\n", + printf("copy.last_lsn/file_offset = 0x%llx\n", le64_to_cpu(rcrd_ph->copy.last_lsn)); printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); - printf("header.next_record_offset = 0x%Lx\n", + printf("header.next_record_offset = 0x%llx\n", le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); - printf("header.last_end_lsn = 0x%Lx\n", + printf("header.last_end_lsn = 0x%llx\n", le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); /* * Where does the 0x40 come from? Is it just usa_offset + @@ -243,10 +243,10 @@ rcrd_pass_loc: client = 0; log_record_pass: printf("\nLog record %i:\n", client); - printf("this lsn = 0x%Lx\n", le64_to_cpu(lr->this_lsn)); - printf("client previous lsn = 0x%Lx\n", + printf("this lsn = 0x%llx\n", le64_to_cpu(lr->this_lsn)); + printf("client previous lsn = 0x%llx\n", le64_to_cpu(lr->client_previous_lsn)); - printf("client undo next lsn = 0x%Lx\n", + printf("client undo next lsn = 0x%llx\n", le64_to_cpu(lr->client_undo_next_lsn)); printf("client data length = 0x%x\n", le32_to_cpu(lr->client_data_length)); @@ -283,11 +283,11 @@ log_record_pass: printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); - printf("target_vcn = 0x%Lx\n", sle64_to_cpu(lr->target_vcn)); + printf("target_vcn = 0x%llx\n", sle64_to_cpu(lr->target_vcn)); if (le16_to_cpu(lr->lcns_to_follow) > 0) printf("Array of lcns:\n"); for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) - printf("lcn_list[%i].lcn = 0x%Lx\n", i, + printf("lcn_list[%i].lcn = 0x%llx\n", i, sle64_to_cpu(lr->lcn_list[i].lcn)); client++; lr = (LOG_RECORD*)((char*)lr + 0x70); diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index ae5c9683..2e05ef24 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -767,9 +767,9 @@ void dump_non_resident_attr(ATTR_RECORD *a) int i; l = sle64_to_cpu(a->lowest_vcn); - printf("Lowest VCN = %Li (0x%Lx)\n", l, l); + printf("Lowest VCN = %lli (0x%llx)\n", l, l); l = sle64_to_cpu(a->highest_vcn); - printf("Highest VCN = %Li (0x%Lx)\n", l, l); + printf("Highest VCN = %lli (0x%llx)\n", l, l); printf("Mapping pairs array offset = 0x%x\n", le16_to_cpu(a->mapping_pairs_offset)); printf("Compression unit = 0x%x: %sCOMPRESSED\n", a->compression_unit, @@ -778,14 +778,14 @@ void dump_non_resident_attr(ATTR_RECORD *a) printf("Attribute is not the first extent. The following " "sizes are meaningless:\n"); l = sle64_to_cpu(a->allocated_size); - printf("Allocated size = %Li (0x%Lx)\n", l, l); + printf("Allocated size = %lli (0x%llx)\n", l, l); l = sle64_to_cpu(a->data_size); - printf("Data size = %Li (0x%Lx)\n", l, l); + printf("Data size = %lli (0x%llx)\n", l, l); l = sle64_to_cpu(a->initialized_size); - printf("Initialized size = %Li (0x%Lx)\n", l, l); + printf("Initialized size = %lli (0x%llx)\n", l, l); if (a->flags & ATTR_COMPRESSION_MASK) { l = sle64_to_cpu(a->compressed_size); - printf("Compressed size = %Li (0x%Lx)\n", l, l); + printf("Compressed size = %lli (0x%llx)\n", l, l); } i = le16_to_cpu(a->mapping_pairs_offset); dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); @@ -902,7 +902,7 @@ void dump_mft_record(MFT_RECORD *m) u = le16_to_cpu(m->usa_ofs); printf("Update sequence array offset = %u (0x%x)\n", u, u); printf("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); - printf("$LogFile sequence number (lsn) = %Lu\n", le64_to_cpu(m->lsn)); + printf("$LogFile sequence number (lsn) = %llu\n", le64_to_cpu(m->lsn)); printf("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); printf("Reference (hard link) count = %u\n", le16_to_cpu(m->link_count)); @@ -921,7 +921,7 @@ void dump_mft_record(MFT_RECORD *m) u = le32_to_cpu(m->bytes_allocated); printf("Bytes allocated = %u (0x%x)\n", u, u); r = le64_to_cpu(m->base_mft_record); - printf("Base mft record reference:\n\tMft record number = %Lu\n\t" + printf("Base mft record reference:\n\tMft record number = %llu\n\t" "Sequence number = %u\n", MREF(r), MSEQNO(r)); printf("Next attribute instance = %u\n", le16_to_cpu(m->next_attr_instance)); @@ -2682,7 +2682,7 @@ int main(int argc, char **argv) "specify it manually.\n", vol->dev->d_name); } - Dprintf("number of sectors = %Ld (0x%Lx)\n", opts.nr_sectors, + Dprintf("number of sectors = %lld (0x%llx)\n", opts.nr_sectors, opts.nr_sectors); /* Reserve the last sector for the backup boot sector. */ opts.nr_sectors--; @@ -2696,7 +2696,7 @@ int main(int argc, char **argv) if (opts.volume_size < 1 << 20 /* 1MiB */) err_exit("Error: device is too small (%ikiB). Minimum NTFS " "volume size is 1MiB.\n", opts.volume_size / 1024); - Dprintf("volume size = %LikiB\n", opts.volume_size / 1024); + Dprintf("volume size = %llikiB\n", opts.volume_size / 1024); /* If user didn't specify the cluster size, determine it now. */ if (!vol->cluster_size) { if (opts.volume_size <= 512LL << 20) /* <= 512MB */ @@ -2754,7 +2754,7 @@ int main(int argc, char **argv) opts.volume_size / vol->cluster_size != opts.nr_clusters) err_exit("Illegal combination of volume/cluster/sector size " "and/or cluster/sector number.\n"); - Dprintf("number of clusters = %Lu (0x%Lx)\n", opts.nr_clusters, + Dprintf("number of clusters = %llu (0x%llx)\n", opts.nr_clusters, opts.nr_clusters); /* Determine lcn bitmap byte size and allocate it. */ lcn_bitmap_byte_size = (opts.nr_clusters + 7) >> 3; diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index c1a927bf..cc9b73ec 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -436,7 +436,7 @@ void clone_ntfs(u64 nr_clusters) while (1) { count = ntfs_attr_pread(vol->lcnbmp_na, pos, NTFS_BUF_SIZE, bm); if (count == -1) - perr_exit("Couldn't read $Bitmap (pos = %Ld)\n", pos); + perr_exit("Couldn't read $Bitmap (pos = %lld)\n", pos); if (count == 0) return; @@ -609,7 +609,7 @@ void compare_bitmaps(struct bitmap *a) if (count == 0) { if (a->size != pos) err_exit("$Bitmap file size doesn't match " - "calculated size (%Ld != %Ld)\n", + "calculated size (%lld != %lld)\n", a->size, pos); break; } @@ -630,8 +630,8 @@ void compare_bitmaps(struct bitmap *a) if (++mismatch > 10) continue; - Printf("Cluster accounting failed at %Lu " - "(0x%Lx): %s cluster in $Bitmap\n", + Printf("Cluster accounting failed at %llu " + "(0x%llx): %s cluster in $Bitmap\n", cl, cl, bit ? "missing" : "extra"); } } @@ -767,7 +767,7 @@ out: } if (ntfs_inode_close(ni)) - perr_exit("ntfs_inode_close for inode %Ld", inode); + perr_exit("ntfs_inode_close for inode %lld", inode); } return 0; @@ -952,13 +952,13 @@ int main(int argc, char **argv) device_size = ntfs_device_size_get(vol->dev, 1); if (device_size <= 0) - err_exit("Couldn't get device size (%Ld)!\n", device_size); + err_exit("Couldn't get device size (%lld)!\n", device_size); print_volume_size("Current device size", device_size); if (device_size < vol->nr_clusters * vol->cluster_size) err_exit("Current NTFS volume size is bigger than the device " - "size (%Ld)!\nCorrupt partition table or incorrect " + "size (%lld)!\nCorrupt partition table or incorrect " "device partitioning?\n", device_size); if (opt.stdout) { @@ -995,7 +995,7 @@ int main(int argc, char **argv) } else { s64 dest_size = device_size_get(fd_out); if (dest_size < device_size) - err_exit("Output device size (%Ld) is too small" + err_exit("Output device size (%lld) is too small" " to fit an NTFS clone\n", dest_size); } } @@ -1032,7 +1032,7 @@ int main(int argc, char **argv) walk_clusters(vol, &backup_clusters); - Printf("Num of MFT records = %8Ld\n", vol->nr_mft_records); + Printf("Num of MFT records = %8lld\n", vol->nr_mft_records); Printf("Num of used MFT records = %8d\n", nr_used_mft_records); Printf("Wiped unused MFT data = %8d\n", wiped_unused_mft_data); diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index a631e46d..276bd513 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -207,12 +207,12 @@ pass_loc: le16_to_cpu(rph->minor_ver)); printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); printf("magic = RSTR\n"); - printf("ChkDskLsn = 0x%Lx\n", sle64_to_cpu(rph->chkdsk_lsn)); + printf("ChkDskLsn = 0x%llx\n", sle64_to_cpu(rph->chkdsk_lsn)); printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); printf("\n(1st) restart record:\n"); - printf("CurrentLsn = %Lx\n", sle64_to_cpu(rr->current_lsn)); + printf("CurrentLsn = %llx\n", sle64_to_cpu(rr->current_lsn)); printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); @@ -223,7 +223,7 @@ pass_loc: le16_to_cpu(rr->restart_area_length)); printf("ClientArrayOffset = 0x%x\n", le16_to_cpu(rr->client_array_offset)); - printf("FileSize = %Lu (0x%Lx)\n", sle64_to_cpu(rr->file_size), + printf("FileSize = %llu (0x%llx)\n", sle64_to_cpu(rr->file_size), sle64_to_cpu(rr->file_size)); if (sle64_to_cpu(rr->file_size) != l) puts("$LogFile restart area indicates a log file size" @@ -235,12 +235,12 @@ pass_loc: le16_to_cpu(rr->log_page_data_offset)); for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { printf("\nRestart client record number %i:\n", client); - printf("OldestLsn = 0x%Lx\n", sle64_to_cpu(cr->oldest_lsn)); - printf("ClientRestartLsn = 0x%Lx\n", + printf("OldestLsn = 0x%llx\n", sle64_to_cpu(cr->oldest_lsn)); + printf("ClientRestartLsn = 0x%llx\n", sle64_to_cpu(cr->client_restart_lsn)); printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); - printf("SeqNumber = 0x%Lx\n", le64_to_cpu(cr->seq_number)); + printf("SeqNumber = 0x%llx\n", le64_to_cpu(cr->seq_number)); printf("ClientNameLength = 0x%x\n", le32_to_cpu(cr->client_name_length)); if (le32_to_cpu(cr->client_name_length)) { @@ -279,14 +279,14 @@ rcrd_pass_loc: printf(":"); /* Dump log record page */ printf("\nmagic = RCRD\n"); - printf("copy.last_lsn/file_offset = 0x%Lx\n", + printf("copy.last_lsn/file_offset = 0x%llx\n", le64_to_cpu(rcrd_ph->copy.last_lsn)); printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); - printf("header.next_record_offset = 0x%Lx\n", + printf("header.next_record_offset = 0x%llx\n", le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); - printf("header.last_end_lsn = 0x%Lx\n", + printf("header.last_end_lsn = 0x%llx\n", le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); /* * Where does the 0x40 come from? Is it just usa_offset + @@ -296,10 +296,10 @@ rcrd_pass_loc: client = 0; log_record_pass: printf("\nLog record %i:\n", client); - printf("this lsn = 0x%Lx\n", le64_to_cpu(lr->this_lsn)); - printf("client previous lsn = 0x%Lx\n", + printf("this lsn = 0x%llx\n", le64_to_cpu(lr->this_lsn)); + printf("client previous lsn = 0x%llx\n", le64_to_cpu(lr->client_previous_lsn)); - printf("client undo next lsn = 0x%Lx\n", + printf("client undo next lsn = 0x%llx\n", le64_to_cpu(lr->client_undo_next_lsn)); printf("client data length = 0x%x\n", le32_to_cpu(lr->client_data_length)); @@ -336,11 +336,11 @@ log_record_pass: printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); - printf("target_vcn = 0x%Lx\n", sle64_to_cpu(lr->target_vcn)); + printf("target_vcn = 0x%llx\n", sle64_to_cpu(lr->target_vcn)); if (le16_to_cpu(lr->lcns_to_follow) > 0) printf("Array of lcns:\n"); for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) - printf("lcn_list[%i].lcn = 0x%Lx\n", i, + printf("lcn_list[%i].lcn = 0x%llx\n", i, sle64_to_cpu(lr->lcn_list[i].lcn)); client++; lr = (LOG_RECORD*)((char*)lr + 0x70); diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index c66fd607..6a1eff84 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -574,8 +574,8 @@ void collect_shrink_info(ntfs_resize_t *resize, runlist *rl) if (opt.info && !resize->new_volume_size) return; - printf("Relocation needed for inode %8Ld attr 0x%x LCN 0x%08Lx " - "length %6Ld\n", resize->ni->mft_no, + printf("Relocation needed for inode %8lld attr 0x%x LCN 0x%08llx " + "length %6lld\n", resize->ni->mft_no, resize->ctx->attr->type, start, len); } } @@ -626,7 +626,7 @@ void build_lcn_usage_bitmap(ntfs_resize_t *resize) if (++resize->multi_ref > 10) continue; - printf("Cluster %Lu (0x%Lx) referenced " + printf("Cluster %llu (0x%llx) referenced " "multiply times!\n", k, k); } } @@ -688,7 +688,7 @@ void compare_bitmaps(struct bitmap *a) if (count == 0) { if (a->size != pos) err_exit("$Bitmap file size doesn't match " - "calculated size (%Ld != %Ld)\n", + "calculated size (%lld != %lld)\n", a->size, pos); break; } @@ -718,8 +718,8 @@ void compare_bitmaps(struct bitmap *a) if (++mismatch > 10) continue; - printf("Cluster accounting failed at %Lu " - "(0x%Lx): %s cluster in $Bitmap\n", + printf("Cluster accounting failed at %llu " + "(0x%llx): %s cluster in $Bitmap\n", cl, cl, bit ? "missing" : "extra"); } } @@ -805,7 +805,7 @@ void walk_inodes(ntfs_resize_t *resize) walk_attributes(resize); close_inode: if (ntfs_inode_close(ni)) - perr_exit("ntfs_inode_close for inode %Ld", inode); + perr_exit("ntfs_inode_close for inode %lld", inode); } } @@ -818,7 +818,7 @@ void print_hint(const char *s, struct llcn_t llcn) runs_b = llcn.lcn * vol->cluster_size; runs_mb = rounded_up_division(runs_b, NTFS_MBYTE); - printf("%-19s: %9Ld MB %8Ld\n", s, runs_mb, llcn.inode); + printf("%-19s: %9lld MB %8lld\n", s, runs_mb, llcn.inode); } /** @@ -1282,7 +1282,7 @@ void print_disk_usage(ntfs_resize_t *resize) 100.0 * ((float)used / total)); if (opt.bytes) - printf("Needed relocations : %Ld (%Ld MB)\n", + printf("Needed relocations : %lld (%lld MB)\n", resize->relocations, rounded_up_division(relocations, NTFS_MBYTE)); } @@ -1397,19 +1397,19 @@ int main(int argc, char **argv) device_size = ntfs_device_size_get(vol->dev, vol->sector_size); device_size *= vol->sector_size; if (device_size <= 0) - err_exit("Couldn't get device size (%Ld)!\n", device_size); + err_exit("Couldn't get device size (%lld)!\n", device_size); print_volume_size("Current device size", device_size); if (device_size < vol->nr_clusters * vol->cluster_size) err_exit("Current NTFS volume size is bigger than the device " - "size (%Ld)!\nCorrupt partition table or incorrect " + "size (%lld)!\nCorrupt partition table or incorrect " "device partitioning?\n", device_size); if (opt.bytes) { if (device_size < opt.bytes) err_exit("New size can't be bigger than the " - "device size (%Ld bytes).\nIf you want to " + "device size (%lld bytes).\nIf you want to " "enlarge NTFS then first enlarge the device " "size by e.g. fdisk.\n", device_size); } else if (!opt.info) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 9dfe66c8..da4f79f0 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -238,7 +238,7 @@ void parse_options(int argc, char *argv[]) if (*s || !ll || (ll >= LLONG_MAX && errno == ERANGE)) err_exit("Invalid inode number: %s\n", argv[optind - 1]); inode = ll; - Dprintf("inode = %Li\n", (long long)inode); + Dprintf("inode = %lli\n", (long long)inode); if (optind == argc) usage(); @@ -290,7 +290,7 @@ void parse_options(int argc, char *argv[]) if (*s2 || ll < 0 || (ll >= LLONG_MAX && errno == ERANGE)) err_exit("Invalid new length: %s\n", s); new_len = ll; - Dprintf("new length = %Li\n", new_len); + Dprintf("new length = %lli\n", new_len); } /** @@ -511,9 +511,9 @@ void dump_non_resident_attr(ATTR_RECORD *a) int i; l = sle64_to_cpu(a->lowest_vcn); - printf("Lowest VCN = %Li (0x%Lx)\n", l, l); + printf("Lowest VCN = %lli (0x%llx)\n", l, l); l = sle64_to_cpu(a->highest_vcn); - printf("Highest VCN = %Li (0x%Lx)\n", l, l); + printf("Highest VCN = %lli (0x%llx)\n", l, l); printf("Mapping pairs array offset = 0x%x\n", le16_to_cpu(a->mapping_pairs_offset)); printf("Compression unit = 0x%x: %sCOMPRESSED\n", a->compression_unit, @@ -522,14 +522,14 @@ void dump_non_resident_attr(ATTR_RECORD *a) printf("Attribute is not the first extent. The following " "sizes are meaningless:\n"); l = sle64_to_cpu(a->allocated_size); - printf("Allocated size = %Li (0x%Lx)\n", l, l); + printf("Allocated size = %lli (0x%llx)\n", l, l); l = sle64_to_cpu(a->data_size); - printf("Data size = %Li (0x%Lx)\n", l, l); + printf("Data size = %lli (0x%llx)\n", l, l); l = sle64_to_cpu(a->initialized_size); - printf("Initialized size = %Li (0x%Lx)\n", l, l); + printf("Initialized size = %lli (0x%llx)\n", l, l); if (a->flags & ATTR_COMPRESSION_MASK) { l = sle64_to_cpu(a->compressed_size); - printf("Compressed size = %Li (0x%Lx)\n", l, l); + printf("Compressed size = %lli (0x%llx)\n", l, l); } i = le16_to_cpu(a->mapping_pairs_offset); dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); @@ -648,7 +648,7 @@ void dump_mft_record(MFT_RECORD *m) u = le16_to_cpu(m->usa_ofs); printf("Update sequence array offset = %u (0x%x)\n", u, u); printf("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); - printf("$LogFile sequence number (lsn) = %Lu\n", le64_to_cpu(m->lsn)); + printf("$LogFile sequence number (lsn) = %llu\n", le64_to_cpu(m->lsn)); printf("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); printf("Reference (hard link) count = %u\n", le16_to_cpu(m->link_count)); @@ -667,7 +667,7 @@ void dump_mft_record(MFT_RECORD *m) u = le32_to_cpu(m->bytes_allocated); printf("Bytes allocated = %u (0x%x)\n", u, u); r = le64_to_cpu(m->base_mft_record); - printf("Base mft record reference:\n\tMft record number = %Lu\n\t" + printf("Base mft record reference:\n\tMft record number = %llu\n\t" "Sequence number = %u\n", MREF(r), MSEQNO(r)); printf("Next attribute instance = %u\n", le16_to_cpu(m->next_attr_instance)); @@ -697,7 +697,7 @@ void ntfstruncate_exit(void) ntfs_attr_close(na); /* Close the inode. */ if (ni && ntfs_inode_close(ni)) { - fprintf(stderr, "Warning: Failed to close inode %Li: %s\n", + fprintf(stderr, "Warning: Failed to close inode %lli: %s\n", (long long)inode, strerror(errno)); } /* Unmount the volume. */ @@ -766,7 +766,7 @@ int main(int argc, char **argv) /* Open the specified inode. */ ni = ntfs_inode_open(vol, inode); if (!ni) - err_exit("Failed to open inode %Li: %s\n", (long long)inode, + err_exit("Failed to open inode %lli: %s\n", (long long)inode, strerror(errno)); /* Open the specified attribute. */ @@ -800,7 +800,7 @@ int main(int argc, char **argv) /* Close the inode. */ err = ntfs_inode_close(ni); if (err) - err_exit("Failed to close inode %Li: %s\n", (long long)inode, + err_exit("Failed to close inode %lli: %s\n", (long long)inode, strerror(errno)); /* Unmount the volume. */ From f67f495e28065d55c1b6775cb7176c67ea35cdd0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jan 2004 16:57:10 +0000 Subject: [PATCH 0923/2994] - Apply patch from Szaka to fix all %L to %ll. - Fix remaining %L ti %ll (compress.c). - Run ./autogen.sh on SuSE 9.0. BKrev: 4006c666HDSXMa7CjSIBa9JQsMhuvQ From 401c8ebf7d175a707a7953d0831ea6e4ef1eaaed Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jan 2004 17:07:57 +0000 Subject: [PATCH 0924/2994] apply patch from Szaka: - all warnings fixed for maintainer mode for ntfsresize and ntfsclone - added 'const' to ntfs_ucstombs()'s first parameter - 'fsync' also after metadata-only cloning - fixed forced metadata-only, dirty ntfs cloning (only one -f needed) (Logical change 1.264) --- include/unistr.h | 2 +- libntfs/unistr.c | 2 +- ntfsprogs/ntfsclone.c | 101 +++++++++++++++++++++++------------------ ntfsprogs/ntfsresize.c | 100 ++++++++++++++++++---------------------- 4 files changed, 105 insertions(+), 100 deletions(-) diff --git a/include/unistr.h b/include/unistr.h index 7b7a5ea8..1917bfbd 100644 --- a/include/unistr.h +++ b/include/unistr.h @@ -57,7 +57,7 @@ extern int ntfs_file_values_compare(FILE_NAME_ATTR *file_name_attr1, extern int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, int outs_len); -extern int ntfs_mbstoucs(char *ins, uchar_t **outs, int outs_len); +extern int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len); #endif /* defined _NTFS_UNISTR_H */ diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 2fc0e0af..16b6a427 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -427,7 +427,7 @@ err_out: * ENAMETOOLONG Destination buffer is too small for input string. * ENOMEM Not enough memory to allocate destination buffer. */ -int ntfs_mbstoucs(char *ins, uchar_t **outs, int outs_len) +int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len) { uchar_t *ucs; char *s; diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index cc9b73ec..4adfc036 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1,7 +1,7 @@ /** * ntfsclone - Part of the Linux-NTFS project. * - * Copyright (c) 2003 Szabolcs Szakacsits + * Copyright (c) 2003-2004 Szabolcs Szakacsits * * Clone NTFS data and/or metadata to a sparse file, device or stdout. * @@ -111,13 +111,20 @@ int wiped_timestamp_data = 0; #define read_all(f, p, n) io_all((f), (p), (n), 0) #define write_all(f, p, n) io_all((f), (p), (n), 1) +/* FIXME: They should be #included but Eprintf conflicts with mkntfs's Eprintf */ +extern int Eprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); +extern int Vprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); +extern int Qprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); +/* FIXME: should be 'static' */ +extern int Printf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); + GEN_PRINTF(Eprintf, stderr, NULL, FALSE) GEN_PRINTF(Vprintf, msg_out, &opt.verbose, TRUE) GEN_PRINTF(Qprintf, msg_out, &opt.quiet, FALSE) GEN_PRINTF(Printf, msg_out, NULL, FALSE) -void perr_printf(const char *fmt, ...) +static void perr_printf(const char *fmt, ...) { va_list ap; int eo = errno; @@ -130,7 +137,7 @@ void perr_printf(const char *fmt, ...) fflush(msg_out); } -void err_printf(const char *fmt, ...) +static void err_printf(const char *fmt, ...) { va_list ap; @@ -141,7 +148,7 @@ void err_printf(const char *fmt, ...) fflush(msg_out); } -int err_exit(const char *fmt, ...) +static int err_exit(const char *fmt, ...) { va_list ap; @@ -154,7 +161,7 @@ int err_exit(const char *fmt, ...) } -int perr_exit(const char *fmt, ...) +static int perr_exit(const char *fmt, ...) { va_list ap; int eo = errno; @@ -169,7 +176,7 @@ int perr_exit(const char *fmt, ...) } -void usage(void) +static void usage(void) { Eprintf("\nUsage: %s [options] device\n" " Efficiently clone NTFS to a sparse file, device or standard output.\n" @@ -191,7 +198,7 @@ void usage(void) } -void parse_options(int argc, char **argv) +static void parse_options(int argc, char **argv) { static const char *sopt = "-dfhmo:O:"; static const struct option lopt[] = { @@ -292,7 +299,7 @@ void parse_options(int argc, char **argv) perr_exit("Couldn't open /dev/null"); } -void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) +static void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) { p->start = start; p->stop = stop; @@ -301,7 +308,7 @@ void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) } -void progress_update(struct progress_bar *p, u64 current) +static void progress_update(struct progress_bar *p, u64 current) { float percent = p->unit * current; @@ -320,7 +327,7 @@ void progress_update(struct progress_bar *p, u64 current) * Take the number of clusters in the volume and calculate the size of $Bitmap. * The size will always be a multiple of 8 bytes. */ -s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) +static s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) { s64 bm_bsize; @@ -333,7 +340,7 @@ s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) return bm_bsize; } -int is_critical_metadata(ntfs_walk_clusters_ctx *image) +static int is_critical_metadata(ntfs_walk_clusters_ctx *image) { s64 inode; @@ -350,7 +357,7 @@ int is_critical_metadata(ntfs_walk_clusters_ctx *image) } -int io_all(void *fd, void *buf, int count, int do_write) +static int io_all(void *fd, void *buf, int count, int do_write) { int i; struct ntfs_device *dev = (struct ntfs_device *)fd; @@ -372,7 +379,7 @@ int io_all(void *fd, void *buf, int count, int do_write) } -void copy_cluster(void) +static void copy_cluster(void) { char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ @@ -383,7 +390,7 @@ void copy_cluster(void) perr_exit("write_all"); } -void lseek_to_cluster(s64 lcn) +static void lseek_to_cluster(s64 lcn) { off_t pos; @@ -399,7 +406,7 @@ void lseek_to_cluster(s64 lcn) perr_exit("lseek output"); } -void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) +static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) { int i; @@ -416,7 +423,7 @@ void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) copy_cluster(); } -void clone_ntfs(u64 nr_clusters) +static void clone_ntfs(u64 nr_clusters) { s64 i, pos, count; u8 bm[NTFS_BUF_SIZE]; @@ -480,7 +487,7 @@ do { \ \ } while(0) -void wipe_timestamps(ntfs_walk_clusters_ctx *image) +static void wipe_timestamps(ntfs_walk_clusters_ctx *image) { ATTR_RECORD *a = image->ctx->attr; @@ -494,7 +501,7 @@ void wipe_timestamps(ntfs_walk_clusters_ctx *image) WIPE_TIMESTAMPS(STANDARD_INFORMATION, a); } -void wipe_resident_data(ntfs_walk_clusters_ctx *image) +static void wipe_resident_data(ntfs_walk_clusters_ctx *image) { ATTR_RECORD *a; u32 i; @@ -520,7 +527,7 @@ void wipe_resident_data(ntfs_walk_clusters_ctx *image) wiped_resident_data += n; } -void walk_runs(struct ntfs_walk_cluster *walk) +static void walk_runs(struct ntfs_walk_cluster *walk) { int i, j; runlist *rl; @@ -572,7 +579,7 @@ void walk_runs(struct ntfs_walk_cluster *walk) } -void walk_attributes(struct ntfs_walk_cluster *walk) +static void walk_attributes(struct ntfs_walk_cluster *walk) { ntfs_attr_search_ctx *ctx; @@ -592,7 +599,7 @@ void walk_attributes(struct ntfs_walk_cluster *walk) -void compare_bitmaps(struct bitmap *a) +static void compare_bitmaps(struct bitmap *a) { s64 i, pos, count; int mismatch = 0; @@ -647,7 +654,7 @@ void compare_bitmaps(struct bitmap *a) } -int wipe_data(char *p, int pos, int len) +static int wipe_data(char *p, int pos, int len) { int wiped = 0; @@ -662,7 +669,7 @@ int wipe_data(char *p, int pos, int len) return wiped; } -void wipe_unused_mft_data(ntfs_inode *ni) +static void wipe_unused_mft_data(ntfs_inode *ni) { int unused; MFT_RECORD *m = ni->mrec; @@ -675,7 +682,7 @@ void wipe_unused_mft_data(ntfs_inode *ni) wiped_unused_mft_data += wipe_data((char *)m, m->bytes_in_use, unused); } -void wipe_unused_mft(ntfs_inode *ni) +static void wipe_unused_mft(ntfs_inode *ni) { int unused; MFT_RECORD *m = ni->mrec; @@ -690,7 +697,7 @@ void wipe_unused_mft(ntfs_inode *ni) } -int walk_clusters(ntfs_volume *vol, struct ntfs_walk_cluster *walk) +static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) { s64 inode = 0; s64 last_mft_rec; @@ -699,7 +706,7 @@ int walk_clusters(ntfs_volume *vol, struct ntfs_walk_cluster *walk) Printf("Scanning volume ...\n"); - last_mft_rec = vol->nr_mft_records - 1; + last_mft_rec = volume->nr_mft_records - 1; progress_init(&progress, inode, last_mft_rec, 100); for (; inode <= last_mft_rec; inode++) { @@ -715,9 +722,9 @@ int walk_clusters(ntfs_volume *vol, struct ntfs_walk_cluster *walk) if (!ni) perr_exit("walk_clusters"); - ni->vol = vol; + ni->vol = volume; - err = ntfs_file_record_read(vol, mref, &ni->mrec, NULL); + err = ntfs_file_record_read(volume, mref, &ni->mrec, NULL); if (err == -1) { free(ni); continue; @@ -731,7 +738,7 @@ int walk_clusters(ntfs_volume *vol, struct ntfs_walk_cluster *walk) if (wipe) { wipe_unused_mft(ni); wipe_unused_mft_data(ni); - if (ntfs_mft_record_write(vol, ni->mft_no, ni->mrec)) + if (ntfs_mft_record_write(volume, ni->mft_no, ni->mrec)) perr_exit("ntfs_mft_record_write"); } } @@ -743,7 +750,7 @@ int walk_clusters(ntfs_volume *vol, struct ntfs_walk_cluster *walk) if (deleted_inode) continue; - if ((ni = ntfs_inode_open(vol, mref)) == NULL) { + if ((ni = ntfs_inode_open(volume, mref)) == NULL) { /* FIXME: continue only if it make sense, e.g. MFT record not in use based on $MFT bitmap */ if (errno == EIO || errno == ENOENT) @@ -762,7 +769,7 @@ int walk_clusters(ntfs_volume *vol, struct ntfs_walk_cluster *walk) out: if (wipe) { wipe_unused_mft_data(ni); - if (ntfs_mft_record_write(vol, ni->mft_no, ni->mrec)) + if (ntfs_mft_record_write(volume, ni->mft_no, ni->mrec)) perr_exit("ntfs_mft_record_write"); } @@ -778,7 +785,7 @@ out: * $Bitmap can overlap the end of the volume. Any bits in this region * must be set. This region also encompasses the backup boot sector. */ -void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) +static void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) { for (; cluster < bm->size << 3; cluster++) ntfs_bit_set(bm->bm, (u64)cluster, 1); @@ -790,7 +797,7 @@ void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) * All the bits are set to 0, except those representing the region beyond the * end of the disk. */ -void setup_lcn_bitmap(void) +static void setup_lcn_bitmap(void) { /* Determine lcn bitmap byte size and allocate it. */ lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); @@ -802,20 +809,20 @@ void setup_lcn_bitmap(void) } -s64 volume_size(ntfs_volume *vol, s64 nr_clusters) +static s64 volume_size(ntfs_volume *volume, s64 nr_clusters) { - return nr_clusters * vol->cluster_size; + return nr_clusters * volume->cluster_size; } -void print_volume_size(char *str, s64 bytes) +static void print_volume_size(const char *str, s64 bytes) { Printf("%s: %lld bytes (%lld MB)\n", str, bytes, rounded_up_division(bytes, NTFS_MBYTE)); } -void print_disk_usage(ntfs_walk_clusters_ctx *image) +static void print_disk_usage(ntfs_walk_clusters_ctx *image) { s64 total, used; @@ -834,7 +841,7 @@ void print_disk_usage(ntfs_walk_clusters_ctx *image) * is dirty (Windows wasn't shutdown properly). If everything is OK, then mount * the volume (load the metadata into memory). */ -void mount_volume(unsigned long new_mntflag) +static void mount_volume(unsigned long new_mntflag) { unsigned long mntflag; @@ -883,7 +890,7 @@ void mount_volume(unsigned long new_mntflag) struct ntfs_walk_cluster backup_clusters = { NULL, NULL }; -int device_offset_valid(int fd, s64 ofs) +static int device_offset_valid(int fd, s64 ofs) { char ch; @@ -892,7 +899,7 @@ int device_offset_valid(int fd, s64 ofs) return -1; } -s64 device_size_get(int fd) +static s64 device_size_get(int fd) { s64 high, low; #ifdef BLKGETSIZE @@ -933,6 +940,12 @@ s64 device_size_get(int fd) return (low + 1LL); } +static void fsync_clone(int fd) +{ + Printf("Syncing ...\n"); + if (fsync(fd) && errno != EINVAL) + perr_exit("fsync"); +} int main(int argc, char **argv) { @@ -1016,14 +1029,15 @@ int main(int argc, char **argv) s64 nr_clusters = opt.stdout ? vol->nr_clusters : image.inuse; clone_ntfs(nr_clusters); - Printf("Syncing ...\n"); - if (fsync(fd_out) && errno != EINVAL) - perr_exit("fsync"); + fsync_clone(fd_out); exit(0); } wipe = 1; opt.volume = opt.output; + /* 'force' again mount for dirty volumes (e.g. after resize). + FIXME: use mount flags to avoid potential side-effects in future */ + opt.force++; mount_volume(0); setup_lcn_bitmap(); @@ -1046,6 +1060,7 @@ int main(int argc, char **argv) wiped_total += wiped_timestamp_data; Printf("Wiped totally = %8d\n", wiped_total); + fsync_clone(fd_out); exit(0); } diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 6a1eff84..41f42b68 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1,7 +1,7 @@ /** * ntfsresize - Part of the Linux-NTFS project. * - * Copyright (c) 2002-2003 Szabolcs Szakacsits + * Copyright (c) 2002-2004 Szabolcs Szakacsits * Copyright (c) 2002-2003 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon * @@ -126,6 +126,11 @@ struct bitmap lcn_bitmap; #define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) +/* FIXME: They should be included but Eprintf conflicts with mkntfs's Eprintf */ +extern int Eprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); +extern int Vprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); +extern int Qprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); + GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opt.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opt.quiet, FALSE) @@ -135,7 +140,7 @@ GEN_PRINTF (Qprintf, stdout, &opt.quiet, FALSE) * * Print an error message. */ -void perr_printf(const char *fmt, ...) +static void perr_printf(const char *fmt, ...) { va_list ap; int eo = errno; @@ -154,7 +159,7 @@ void perr_printf(const char *fmt, ...) * * Print and error message and exit the program. */ -int err_exit(const char *fmt, ...) +static int err_exit(const char *fmt, ...) { va_list ap; @@ -172,7 +177,7 @@ int err_exit(const char *fmt, ...) * * Print and error message and exit the program */ -int perr_exit(const char *fmt, ...) +static int perr_exit(const char *fmt, ...) { va_list ap; int eo = errno; @@ -194,7 +199,7 @@ int perr_exit(const char *fmt, ...) * * Return: none */ -void usage(void) +static void usage(void) { printf ("\nUsage: %s [options] device\n" @@ -227,7 +232,7 @@ void usage(void) * Force the user to confirm an action before performing it. * Copy-paste from e2fsprogs */ -void proceed_question(void) +static void proceed_question(void) { char buf[256]; const char *short_yes = "yY"; @@ -251,7 +256,7 @@ void proceed_question(void) * * Return: none */ -void version (void) +static void version (void) { printf ("\nResize an NTFS Volume, without data loss.\n\n"); printf ("Copyright (c) 2002-2003 Szabolcs Szakacsits\n"); @@ -267,7 +272,7 @@ void version (void) * will be assumed to be in bytes. If the number has a suffix of k, M or G it * will be scaled up by 1000, 1000000, or 1000000000. */ -s64 get_new_volume_size(char *s) +static s64 get_new_volume_size(char *s) { s64 size; char *suffix; @@ -322,7 +327,7 @@ s64 get_new_volume_size(char *s) * Return: 1 Success * 0 Error, one or more problems */ -int parse_options(int argc, char **argv) +static int parse_options(int argc, char **argv) { static const char *sopt = "-dfhinPs:vV"; static const struct option lopt[] = { @@ -438,28 +443,13 @@ int parse_options(int argc, char **argv) return (!err && !help && !ver); } -/** - * runlist_extent_number - * - * Count the runs in a runlist. - */ -int runlist_extent_number(runlist *rl) -{ - int i; - - for (i = 0; rl[i].length; i++) - ; - - return i; -} - /** * nr_clusters_to_bitmap_byte_size * * Take the number of clusters in the volume and calculate the size of $Bitmap. * The size will always be a multiple of 8 bytes. */ -s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) +static s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) { s64 bm_bsize; @@ -472,7 +462,7 @@ s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) return bm_bsize; } -int str2unicode(char *aname, uchar_t **ustr, int *len) +static int str2unicode(const char *aname, uchar_t **ustr, int *len) { if (aname && ((*len = ntfs_mbstoucs(aname, ustr, 0)) == -1)) return -1; @@ -485,7 +475,7 @@ int str2unicode(char *aname, uchar_t **ustr, int *len) return 0; } -int has_bad_sectors(ntfs_resize_t *resize) +static int has_bad_sectors(ntfs_resize_t *resize) { int len, ret = 0; uchar_t *ustr = NULL; @@ -508,7 +498,7 @@ int has_bad_sectors(ntfs_resize_t *resize) return ret; } -void collect_shrink_constraints(ntfs_resize_t *resize, s64 last_lcn) +static void collect_shrink_constraints(ntfs_resize_t *resize, s64 last_lcn) { s64 inode; ATTR_FLAGS flags; @@ -551,7 +541,7 @@ void collect_shrink_constraints(ntfs_resize_t *resize, s64 last_lcn) } -void collect_shrink_info(ntfs_resize_t *resize, runlist *rl) +static void collect_shrink_info(ntfs_resize_t *resize, runlist *rl) { s64 new_volume_size, lcn, lcn_length; @@ -589,7 +579,7 @@ void collect_shrink_info(ntfs_resize_t *resize, runlist *rl) * * This serves as a rudimentary "chkdsk" operation. */ -void build_lcn_usage_bitmap(ntfs_resize_t *resize) +static void build_lcn_usage_bitmap(ntfs_resize_t *resize) { s64 inode; ATTR_RECORD *a; @@ -647,7 +637,7 @@ void build_lcn_usage_bitmap(ntfs_resize_t *resize) * For a given MFT Record, iterate through all its attributes. Any non-resident * data runs will be marked in lcn_bitmap. */ -void walk_attributes(ntfs_resize_t *resize) +static void walk_attributes(ntfs_resize_t *resize) { ntfs_attr_search_ctx *ctx; @@ -670,7 +660,7 @@ void walk_attributes(ntfs_resize_t *resize) * Compare two bitmaps. In this case, $Bitmap as read from the disk and * lcn_bitmap which we built from the MFT Records. */ -void compare_bitmaps(struct bitmap *a) +static void compare_bitmaps(struct bitmap *a) { s64 i, pos, count; int mismatch = 0; @@ -739,7 +729,7 @@ void compare_bitmaps(struct bitmap *a) * * Create and scale our progress bar. */ -void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) +static void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) { p->start = start; p->stop = stop; @@ -752,7 +742,7 @@ void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) * * Update the progress bar and tell the user. */ -void progress_update(struct progress_bar *p, u64 current) +static void progress_update(struct progress_bar *p, u64 current) { float percent; @@ -775,7 +765,7 @@ void progress_update(struct progress_bar *p, u64 current) * Read each record in the MFT, skipping the unused ones, and build up a bitmap * from all the non-resident attributes. */ -void walk_inodes(ntfs_resize_t *resize) +static void walk_inodes(ntfs_resize_t *resize) { s64 inode = 0; s64 last_mft_rec; @@ -809,7 +799,7 @@ close_inode: } } -void print_hint(const char *s, struct llcn_t llcn) +static void print_hint(const char *s, struct llcn_t llcn) { s64 runs_b, runs_mb; @@ -828,7 +818,7 @@ void print_hint(const char *s, struct llcn_t llcn) * already been read into lcn_bitmap. By looking for the last used cluster on * the disk, we can work out by how much we can shrink the volume. */ -void advise_on_resize(ntfs_resize_t *resize) +static void advise_on_resize(ntfs_resize_t *resize) { s64 old_b, new_b, g_b, old_mb, new_mb, g_mb; s64 supp_lcn = 0; /* smallest size supported in LCN */ @@ -884,7 +874,7 @@ void advise_on_resize(ntfs_resize_t *resize) * * Helper to set up a runlist object */ -void rl_set(runlist *rl, VCN vcn, LCN lcn, s64 len) +static void rl_set(runlist *rl, VCN vcn, LCN lcn, s64 len) { rl->vcn = vcn; rl->lcn = lcn; @@ -897,7 +887,7 @@ void rl_set(runlist *rl, VCN vcn, LCN lcn, s64 len) * $Bitmap can overlap the end of the volume. Any bits in this region * must be set. This region also encompasses the backup boot sector. */ -void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) +static void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) { for (; cluster < bm->size << 3; cluster++) ntfs_bit_set(bm->bm, (u64)cluster, 1); @@ -911,7 +901,7 @@ void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) * FIXME: this function should go away and instead using a generalized * "truncate_bitmap_data_attr()" */ -void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) +static void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) { runlist *rl_bad; int mp_size; @@ -955,7 +945,7 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) * Shrink the metadata file $Bitmap. It must be large enough for one bit per * cluster of the shrunken volume. Also it must be a of 8 bytes in size. */ -void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) +static void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) { runlist *rl = *rlist; int i, j; @@ -1000,7 +990,7 @@ void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) * Enlarge the metadata file $Bitmap. It must be large enough for one bit per * cluster of the shrunken volume. Also it must be a of 8 bytes in size. */ -void enlarge_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) +static void enlarge_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) { runlist *rl = *rlist; s64 i, j, free_zone = 0; @@ -1037,7 +1027,7 @@ void enlarge_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) /** * truncate_bitmap_data_attr */ -void truncate_bitmap_data_attr(ntfs_resize_t *resize) +static void truncate_bitmap_data_attr(ntfs_resize_t *resize) { ATTR_RECORD *a; runlist *rl; @@ -1116,7 +1106,7 @@ void truncate_bitmap_data_attr(ntfs_resize_t *resize) * Find the $DATA attribute (with or without a name) for the given MFT reference * (inode number). */ -void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) +static void lookup_data_attr(MFT_REF mref, const char *aname, ntfs_attr_search_ctx **ctx) { ntfs_inode *ni; uchar_t *ustr = NULL; @@ -1147,7 +1137,7 @@ void lookup_data_attr(MFT_REF mref, char *aname, ntfs_attr_search_ctx **ctx) * Write an MFT Record back to the disk. If the read-only command line option * was given, this function will do nothing. */ -int write_mft_record(ntfs_attr_search_ctx *ctx) +static int write_mft_record(ntfs_attr_search_ctx *ctx) { if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec)) perr_exit("ntfs_mft_record_write"); @@ -1163,7 +1153,7 @@ int write_mft_record(ntfs_attr_search_ctx *ctx) * * Shrink the $BadClus file to match the new volume size. */ -void truncate_badclust_file(s64 nr_clusters) +static void truncate_badclust_file(s64 nr_clusters) { ntfs_attr_search_ctx *ctx = NULL; @@ -1184,7 +1174,7 @@ void truncate_badclust_file(s64 nr_clusters) * * Shrink the $Bitmap file to match the new volume size. */ -void truncate_bitmap_file(ntfs_resize_t *resize) +static void truncate_bitmap_file(ntfs_resize_t *resize) { printf("Updating $Bitmap file ...\n"); @@ -1204,7 +1194,7 @@ void truncate_bitmap_file(ntfs_resize_t *resize) * All the bits are set to 0, except those representing the region beyond the * end of the disk. */ -void setup_lcn_bitmap(void) +static void setup_lcn_bitmap(void) { /* Determine lcn bitmap byte size and allocate it. */ lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); @@ -1220,7 +1210,7 @@ void setup_lcn_bitmap(void) * * FIXME: should be done using ntfs_* functions */ -void update_bootsector(s64 nr_clusters) +static void update_bootsector(s64 nr_clusters) { NTFS_BOOT_SECTOR bs; @@ -1248,9 +1238,9 @@ void update_bootsector(s64 nr_clusters) /** * volume_size */ -s64 volume_size(ntfs_volume *vol, s64 nr_clusters) +static s64 volume_size(ntfs_volume *v, s64 nr_clusters) { - return nr_clusters * vol->cluster_size; + return nr_clusters * v->cluster_size; } /** @@ -1258,7 +1248,7 @@ s64 volume_size(ntfs_volume *vol, s64 nr_clusters) * * Print the volume size in bytes and decimal megabytes. */ -void print_volume_size(char *str, s64 bytes) +static void print_volume_size(const char *str, s64 bytes) { printf("%s: %lld bytes (%lld MB)\n", str, bytes, rounded_up_division(bytes, NTFS_MBYTE)); @@ -1269,7 +1259,7 @@ void print_volume_size(char *str, s64 bytes) * * Display the amount of disk space in use. */ -void print_disk_usage(ntfs_resize_t *resize) +static void print_disk_usage(ntfs_resize_t *resize) { s64 total, used, relocations; @@ -1294,7 +1284,7 @@ void print_disk_usage(ntfs_resize_t *resize) * is dirty (Windows wasn't shutdown properly). If everything is OK, then mount * the volume (load the metadata into memory). */ -void mount_volume(void) +static void mount_volume(void) { unsigned long mntflag; @@ -1348,7 +1338,7 @@ void mount_volume(void) * boots it will automatically run chkdsk to check for any problems. If the * read-only command line option was given, this function will do nothing. */ -void prepare_volume_fixup(void) +static void prepare_volume_fixup(void) { u16 flags; From 2f2363872f7c9a75b19fc71e65be0d2363067708 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jan 2004 17:07:57 +0000 Subject: [PATCH 0925/2994] apply patch from Szaka: - all warnings fixed for maintainer mode for ntfsresize and ntfsclone - added 'const' to ntfs_ucstombs()'s first parameter - 'fsync' also after metadata-only cloning - fixed forced metadata-only, dirty ntfs cloning (only one -f needed) BKrev: 4006c8edpiMxBmaYFD8M7ZCBgDf2DA From fd1bb1db7ff914971f1d5e7e4abb751f2a372cc3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 09:09:56 +0000 Subject: [PATCH 0926/2994] - Fix range checking error spotted by Szaka. - Fix compiler warning. BKrev: 400b9ee4AsLqshoZcvZQpFohSqeE-A From 4ef67c72477b5bf4e26f78aa04b867f79455d336 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 09:09:56 +0000 Subject: [PATCH 0927/2994] Fix compiler warning. (Logical change 1.265) --- libntfs/unistr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 16b6a427..0b9e12c3 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -430,7 +430,7 @@ err_out: int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len) { uchar_t *ucs; - char *s; + const char *s; wchar_t wc; int i, o, cnt, ins_len, ucs_len; #ifdef HAVE_MBSINIT From 205a5db03782a7f74ebaea622901263655996697 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 09:09:56 +0000 Subject: [PATCH 0928/2994] Fix range checking error spotted by Szaka. (Logical change 1.265) --- libntfs/attrib.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e439d1f4..0225ba94 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2096,12 +2096,15 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type, if (!ad) return -1; /* We found the attribute. - Do the bounds check. */ - if (size >= sle64_to_cpu(ad->min_size) && - size <= sle64_to_cpu(ad->max_size)) - return 0; - /* @size is out of range! */ - errno = ERANGE; - return -1; + if ((sle64_to_cpu(ad->min_size) && size < + sle64_to_cpu(ad->min_size)) || + (sle64_to_cpu(ad->max_size) && size > + sle64_to_cpu(ad->max_size))) { + /* @size is out of range! */ + errno = ERANGE; + return -1; + } + return 0; } /** From 0f80e6b1d76fa6018dcd22d73482c6f39a1a7fa8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 15:58:00 +0000 Subject: [PATCH 0929/2994] - Work around broken mbstowcs() implementation on Cygwin. (Lode Leroy) - Partition handling update from Lode Leroy. BKrev: 400bfe88wlgIpgJIaurprW1u5mSNtg From 4b57fb71eaa54b25a2fa1e173a32e5e255b033cd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 15:58:00 +0000 Subject: [PATCH 0930/2994] Partition handling update from Lode Leroy. (Logical change 1.266) --- libntfs/win32_io.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index a8a1495c..0f2ddae8 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -3,8 +3,8 @@ * on Win32. Can access an NTFS volume while it is mounted. * Part of the Linux-NTFS project. * - * Copyright (c) 2003 Lode Leroy - * Copyright (c) 2003 Anton Altaparmakov + * Copyright (c) 2003-2004 Lode Leroy + * Copyright (c) 2003-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -101,7 +101,6 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) numparams = sscanf(dev->d_name, "/dev/hd%c%d", &drive_char, &part); drive = toupper(drive_char) - 'A'; - part--; if (numparams >= 1) { if (numparams == 2) @@ -137,6 +136,8 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) DWORD numread; DRIVE_LAYOUT_INFORMATION *drive_layout; BOOL rvl; + int i; + int found = 0; rvl = DeviceIoControl(handle, IOCTL_DISK_GET_DRIVE_LAYOUT, NULL, 0, @@ -151,23 +152,34 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) drive_layout = (DRIVE_LAYOUT_INFORMATION *)buffer; - if (part >= drive_layout->PartitionCount) { + for (i = 0; i < drive_layout->PartitionCount; i++) { + if (drive_layout->PartitionEntry[i]. + PartitionNumber == part) { + fd.handle = handle; + fd.part_start = drive_layout-> + PartitionEntry[i]. + StartingOffset; + fd.part_end.QuadPart = drive_layout-> + PartitionEntry[i]. + StartingOffset. + QuadPart + + drive_layout-> + PartitionEntry[i]. + PartitionLength. + QuadPart; + fd.current_pos.QuadPart = 0; + found = 1; + break; + } + } + + if (!found) { int err = errno; fprintf(stderr, "partition %d not found on " "drive %d\n", part, drive); errno = err; return -1; } - - fd.handle = handle; - fd.part_start = drive_layout-> - PartitionEntry[part].StartingOffset; - fd.part_end.QuadPart = drive_layout-> - PartitionEntry[0].StartingOffset. - QuadPart + drive_layout-> - PartitionEntry[0].PartitionLength. - QuadPart; - fd.current_pos.QuadPart = 0; } } else { BY_HANDLE_FILE_INFORMATION info; From 55a4a3409716c37533a7d32d60e5e773900248a5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 15:58:00 +0000 Subject: [PATCH 0931/2994] Update changelog. (Logical change 1.266) --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 02c1d5f2..3995a5b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,11 @@ to use ntfs_attr_pread() instead which will transparently read the compressed attribute and return the decompressed data. - Improve mkntfs linux/major.h use so should work on newer glibc. + - Fix silly bug in ntfs_attr_size_bounds_check() where unbounded + attributes were handled completely wrong. (Thanks to Szaka for + spotting this.) + - Fix wrong print modified %L intead of %ll everywhere. (Szaka, me) + - More Cygwin fixes. (Lode Leroy) 07/01/2004 - 1.8.2 - Make ntfsprogs work on FreeBSD. - Add compatibility for building on FreeBSD. (Christophe Grenier) From af643aef5908f54f0f66485fb9f6ee461a776735 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 15:58:00 +0000 Subject: [PATCH 0932/2994] Work around broken mbstowcs() implementation on Cygwin. (Lode Leroy) (Logical change 1.266) --- libntfs/unistr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 0b9e12c3..2054a8b4 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -1,7 +1,7 @@ /* * unistr.c - Unicode string handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -454,6 +454,11 @@ int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len) ins_len = mbsrtowcs(NULL, (const char **)&s, 0, &mbstate); #else ins_len = mbstowcs(NULL, s, 0); +#endif +#ifdef __CYGWIN32__ + /* Eeek!!! Cygwin has broken mbstowcs() implementation!!! */ + if (!ins_len) + ins_len = strlen(ins); #endif if (ins_len == -1) return ins_len; From 474c5bc3700735c2b26e760e135dd2398bbde9a1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 16:28:03 +0000 Subject: [PATCH 0933/2994] - Update for 1.8.3 release. - Fix ./configure for SuSE 9.0. (Logical change 1.267) --- configure.ac | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4f977290..862969f5 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.3-WIP, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.3, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) @@ -73,6 +73,10 @@ AC_ARG_ENABLE(gnome-vfs, ) compile_gnome_vfs=false if test "$enable_gnome_vfs" != "no"; then + # Make compilation work on SuSE 9.0. + if test -d "/opt/gnome"; then + export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" + fi PKG_CHECK_MODULES(LIBNTFS_GNOMEVFS, [glib-2.0 gthread-2.0 gnome-vfs-module-2.0], [ compile_gnome_vfs=true ], [ From bcc8d797973e1cfe95e46e31cac9078fadca5466 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 16:28:03 +0000 Subject: [PATCH 0934/2994] - spec file: Add %config to tell rpm that libntfs.conf is a config file. - Fix ./configure for SuSE 9.0. - Update for 1.8.3 release. BKrev: 400c0593lGSNZXSAJ7OHa1IoiB6_Dg From eef1eaf64142662680fc6c6ab3d0eaaafbf94ecf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 16:28:03 +0000 Subject: [PATCH 0935/2994] Add %config to tell rpm that libntfs.conf is a config file. (Logical change 1.267) --- ntfsprogs.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index 7d5d84d8..e7be4f5e 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -87,7 +87,7 @@ rm -rf "$RPM_BUILD_ROOT" %defattr(-,root,root) %{mandir}/man8/libntfs-gnomevfs.8* %{_libdir}/gnome-vfs-2.0/modules/libntfs-gnomevfs.*so* -%{_sysconfdir}/gnome-vfs-2.0/modules/libntfs.conf +%config %{_sysconfdir}/gnome-vfs-2.0/modules/libntfs.conf %files devel %defattr(-,root,root) From e5bcdf5752f7bc7e949817cb4611c510f57e9479 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 16:28:03 +0000 Subject: [PATCH 0936/2994] Update for 1.8.3 release. (Logical change 1.267) --- ChangeLog | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3995a5b4..2b9969bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -08/01/2004 - 1.8.3 - WIP +19/01/2004 - 1.8.3 - Lots of small fixes. - Update ntfsinfo (Matthew J. Fanto, me) - Add new API attrib.[hc]:ntfs_compressed_attr_pread(). NOTE: You want to use ntfs_attr_pread() instead which will transparently read the @@ -9,6 +9,9 @@ spotting this.) - Fix wrong print modified %L intead of %ll everywhere. (Szaka, me) - More Cygwin fixes. (Lode Leroy) + - Switch build files to ones generated by current SuSE 9.0 (i.e. I ran + ./autogen.sh on SuSE 9.0 as I will be using SuSE as my desktop from + now on). 07/01/2004 - 1.8.2 - Make ntfsprogs work on FreeBSD. - Add compatibility for building on FreeBSD. (Christophe Grenier) From 7aa67cb5bf8f2731b17b813f30fac9ea50e354c3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 16:28:03 +0000 Subject: [PATCH 0937/2994] Update. (Logical change 1.267) --- configure | 80 +++++++++++++++++++++++-------------------- ntfsprogs/Makefile.in | 4 +-- 2 files changed, 44 insertions(+), 40 deletions(-) diff --git a/configure b/configure index dfef2889..ce06421a 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.3-WIP. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.3. # # Report bugs to . # @@ -422,8 +422,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.3-WIP' -PACKAGE_STRING='ntfsprogs 1.8.3-WIP' +PACKAGE_VERSION='1.8.3' +PACKAGE_STRING='ntfsprogs 1.8.3' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -954,7 +954,7 @@ 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 ntfsprogs 1.8.3-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1021,7 +1021,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.3-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.3:";; esac cat <<\_ACEOF @@ -1132,7 +1132,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.3-WIP +ntfsprogs configure 1.8.3 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1147,7 +1147,7 @@ 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 ntfsprogs $as_me 1.8.3-WIP, which was +It was created by ntfsprogs $as_me 1.8.3, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1841,7 +1841,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.8.3-WIP' + VERSION='1.8.3' cat >>confdefs.h <<_ACEOF @@ -3330,6 +3330,10 @@ else fi; compile_gnome_vfs=false if test "$enable_gnome_vfs" != "no"; then + # Make compilation work on SuSE 9.0. + if test -d "/opt/gnome"; then + export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" + fi succeeded=no @@ -3967,7 +3971,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3970 "configure"' > conftest.$ac_ext + echo '#line 3974 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5464,7 +5468,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5467:" \ +echo "$as_me:5471:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6469,11 +6473,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6472: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6476: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6476: \$? = $ac_status" >&5 + echo "$as_me:6480: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6701,11 +6705,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6704: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6708: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6708: \$? = $ac_status" >&5 + echo "$as_me:6712: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6768,11 +6772,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6771: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6775: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6775: \$? = $ac_status" >&5 + echo "$as_me:6779: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8787,7 +8791,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:11024: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11024: \$? = $ac_status" >&5 + echo "$as_me:11028: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -11084,11 +11088,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11087: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11091: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11091: \$? = $ac_status" >&5 + echo "$as_me:11095: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12334,7 +12338,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13261: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13261: \$? = $ac_status" >&5 + echo "$as_me:13265: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13321,11 +13325,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13324: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13328: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13328: \$? = $ac_status" >&5 + echo "$as_me:13332: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15268,11 +15272,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15271: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15275: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15275: \$? = $ac_status" >&5 + echo "$as_me:15279: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15500,11 +15504,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15503: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15507: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15507: \$? = $ac_status" >&5 + echo "$as_me:15511: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15567,11 +15571,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15570: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15574: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15574: \$? = $ac_status" >&5 + echo "$as_me:15578: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17586,7 +17590,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.3-WIP, which was +This file was extended by ntfsprogs $as_me 1.8.3, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21732,7 +21736,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.3-WIP +ntfsprogs config.status 1.8.3 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 4f6abc61..e75c5253 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -147,10 +147,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_TRUE@AM_LFLAGS = -static @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From 824af638188b9f3916aeeee6db762e9abacdbe9c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 19 Jan 2004 16:28:03 +0000 Subject: [PATCH 0938/2994] update for 1.8.3 release. (Logical change 1.267) --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index cacfc5d2..dc489d59 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ Current news ============ +ntfsprogs now should ./configure and compile cleanly on SuSE as well as RedHat +Linux. + ntfsprogs now compiles and works on FreeBSD. Thanks to Christophe Grenier. ntfsprogs now compiles with DJGPP under DOS, too (only "make libs" target, From 2e726fff11d74b2ee05086f0d2fade2db043bbc1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 21 Jan 2004 12:30:18 +0000 Subject: [PATCH 0939/2994] Add support for compressed, resident attributes. (Logical change 1.268) --- libntfs/attrib.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 0225ba94..a41b85b5 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -309,15 +309,16 @@ void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident, * ntfs_attr_open - open an ntfs attribute for access * @ni: open ntfs inode in which the ntfs attribute resides * @type: attribute type - * @name: attribute name in little endian Unicode or NULL + * @name: attribute name in little endian Unicode or AT_UNNAMED or NULL * @name_len: length of attribute @name in Unicode characters (if @name given) * * Allocate a new ntfs attribute structure, initialize it with @ni, @type, * @name, and @name_len, then return it. Return NULL on error with * errno set to the error code. * - * If looking for an unnamed attribute set @name to NULL. @name_len is not used - * at all in that case. + * If @name is AT_UNNAMED look specifically for an unnamed attribute. If you + * do not care whether the attribute is named or not set @name to NULL. In + * both those cases @name_len is not used at all. */ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, uchar_t *name, const u32 name_len) @@ -326,6 +327,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, ntfs_attr *na; ATTR_RECORD *a; int err; + BOOL cs; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)ni->mft_no, type); @@ -349,8 +351,8 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, goto put_err_out; } a = ctx->attr; + cs = a->flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE); if (a->non_resident) { - BOOL cs = a->flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE); ntfs_attr_init(na, TRUE, a->flags & ATTR_IS_COMPRESSED, a->flags & ATTR_IS_ENCRYPTED, a->flags & ATTR_IS_SPARSE, @@ -361,12 +363,11 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, cs ? a->compression_unit : 0); } else { s64 l = le32_to_cpu(a->value_length); - if (a->flags & (ATTR_COMPRESSION_MASK | ATTR_IS_ENCRYPTED | - ATTR_IS_SPARSE)) { - err = EIO; - goto put_err_out; - } - ntfs_attr_init(na, FALSE, FALSE, FALSE, FALSE, l, l, l, 0, 0); + ntfs_attr_init(na, FALSE, a->flags & ATTR_IS_COMPRESSED, + a->flags & ATTR_IS_ENCRYPTED, + a->flags & ATTR_IS_SPARSE, l, l, l, + cs ? sle64_to_cpu(a->compressed_size) : 0, + cs ? a->compression_unit : 0); } ntfs_attr_put_search_ctx(ctx); return na; @@ -1544,8 +1545,8 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const uchar_t *name, ni = ctx->ntfs_ino; base_ni = ctx->base_ntfs_ino; - Dprintf("Entering for inode %llu, attribute type 0x%x.\n", - (unsigned long long)ni->mft_no, type); + Dprintf("%s(): Entering for inode 0x%llx, attribute type 0x%x.\n", + __FUNCTION__, (unsigned long long)ni->mft_no, type); if (!base_ni) { /* First call happens with the base mft record. */ base_ni = ctx->base_ntfs_ino = ctx->ntfs_ino; From 6c7b8a6ef6bd345e0d51499f8065039f38775c75 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 21 Jan 2004 12:30:18 +0000 Subject: [PATCH 0940/2994] Fix a debug printf. (Logical change 1.268) --- libntfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index b0555cdb..99bb9a91 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -290,8 +290,8 @@ ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref) errno = EINVAL; return NULL; } - Dprintf("Opening extent inode %llu (base mft record 0x%llu).\n", - (unsigned long long)mft_no, + Dprintf("%s(): Opening extent inode 0x%llx (base mft record 0x%llx).\n", + __FUNCTION__, (unsigned long long)mft_no, (unsigned long long)base_ni->mft_no); /* Is the extent inode already open and attached to the base inode? */ if (base_ni->nr_extents > 0) { From c0454867e20f88ab16637fb08d022acf90755fc3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 21 Jan 2004 12:30:18 +0000 Subject: [PATCH 0941/2994] Fix decompression code. Hopefully for good... Famous last words. (-; BKrev: 400e70dab-fkLB2Wh74ySoAsE82zug From 6b87731c2af05070373623362283a3ed115e541c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 21 Jan 2004 12:30:18 +0000 Subject: [PATCH 0942/2994] Make decompression work in all test cases I tried. (Logical change 1.268) --- libntfs/compress.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/libntfs/compress.c b/libntfs/compress.c index 87fb0e09..27e1b1eb 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -192,9 +192,8 @@ do_next_tag: goto return_overflow; /* Now calculate the length of the byte sequence. */ length = (pt & (0xfff >> lg)) + 3; - /* Advance destination position and verify it is in range. */ - dest += length; - if (dest > dest_sb_end) + /* Verify destination is in range. */ + if (dest + length > dest_sb_end) goto return_overflow; /* The number of non-overlapping bytes. */ max_non_overlap = dest - dest_back_addr; @@ -282,8 +281,9 @@ s64 ntfs_compressed_attr_pread(ntfs_attr *na, s64 pos, s64 count, void *b) return 0; /* Truncate reads beyond end of attribute. */ if (pos + count > na->data_size) { - if (pos >= na->data_size) + if (pos >= na->data_size) { return 0; + } count = na->data_size - pos; } /* If it is a resident attribute, simply use ntfs_attr_pread(). */ @@ -360,6 +360,7 @@ do_next_cb: count -= to_read; (u8*)b += to_read; } else if (rl->length - (vcn - rl->vcn) >= cb_clusters) { + s64 tdata_size, tinitialized_size; /* * Uncompressed cb, read it straight into the destination range * overlapping the cb. @@ -369,11 +370,16 @@ do_next_cb: * Read the uncompressed data into the destination buffer. * NOTE: We cheat a little bit here by marking the attribute as * not compressed in the ntfs_attr structure so that we can - * read the data by simply using ntfs_attr_pread(). (-8 + * read the data by simply using ntfs_attr_pread(). (-8 Note, + * Note, we have to modify data_size and initialized_size + * temporarily as well... */ to_read = min(count, cb_size - ofs); ofs += vcn << vol->cluster_size_bits; NAttrClearCompressed(na); + tdata_size = na->data_size; + tinitialized_size = na->initialized_size; + na->data_size = na->initialized_size = na->allocated_size; do { br = ntfs_attr_pread(na, ofs, to_read, b); if (br < 0) { @@ -392,9 +398,13 @@ do_next_cb: to_read -= br; ofs += br; } while (to_read > 0); + na->data_size = tdata_size; + na->initialized_size = tinitialized_size; NAttrSetCompressed(na); ofs = 0; } else { + s64 tdata_size, tinitialized_size; + /* * Compressed cb, decompress it into the temporary buffer, then * copy the data to the destination range overlapping the cb. @@ -405,10 +415,14 @@ do_next_cb: * NOTE: We cheat a little bit here by marking the attribute as * not compressed in the ntfs_attr structure so that we can * read the raw, compressed data by simply using - * ntfs_attr_pread(). (-8 + * ntfs_attr_pread(). (-8 Note, we have to modify data_size + * and initialized_size temporarily as well... */ to_read = cb_size; NAttrClearCompressed(na); + tdata_size = na->data_size; + tinitialized_size = na->initialized_size; + na->data_size = na->initialized_size = na->allocated_size; do { br = ntfs_attr_pread(na, (vcn << vol->cluster_size_bits) + @@ -426,6 +440,8 @@ do_next_cb: cb_pos += br; to_read -= br; } while (to_read > 0); + na->data_size = tdata_size; + na->initialized_size = tinitialized_size; NAttrSetCompressed(na); /* Just a precaution. */ if (cb_pos + 2 <= cb_end) From b260aaa7fcd652cc91c742f00def5be79ec92a6e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 21 Jan 2004 12:33:31 +0000 Subject: [PATCH 0943/2994] Build update. (Logical change 1.269) --- ntfsprogs/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index e75c5253..4f6abc61 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -147,10 +147,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From eec41c0b5c0cc9766bf1850af9ae8ddf9299d2cb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 21 Jan 2004 12:33:31 +0000 Subject: [PATCH 0944/2994] Build update. BKrev: 400e719bWmViheo6BrIZRm8xXL4wfQ From 892f097d8cff68f42c461f1b5eb4ae76a09d37cc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Jan 2004 14:56:39 +0000 Subject: [PATCH 0945/2994] Change Lode's email address. (Logical change 1.270) --- AUTHORS | 2 +- CREDITS | 2 +- ntfsprogs/ntfsls.8.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index f1afb852..1304451e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,7 +6,7 @@ Current active developers on the project are (in alphabetical order): Anton Altaparmakov Jan Kratochvil Matthew J. Fanto - Lode Leroy + Lode Leroy Leonard Norrgĺrd Richard Russon Szakacsits Szabolcs diff --git a/CREDITS b/CREDITS index e7a662b6..5981df5d 100644 --- a/CREDITS +++ b/CREDITS @@ -14,7 +14,7 @@ Matthew J. Fanto Christophe Grenier Ian Jackson Jan Kratochvil -Lode Leroy +Lode Leroy David Martínez Moreno Leonard Norrgĺrd Yuri Per diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index 33874d87..a50be2a1 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -144,7 +144,7 @@ We are not aware of any bugs. If you find a bug, please report it to .SH AUTHOR This version of .B ntfsls -has been written by Lode Leroy and enhanced by +has been written by Lode Leroy and enhanced by Anton Altaparmakov . This man page has been written by Anton Altaparmakov. .SH AVAILABILITY From c84d4b91f1e6e8ba1c244cb925ac9d5a1380af7d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Jan 2004 14:56:39 +0000 Subject: [PATCH 0946/2994] Change Lode's email address. BKrev: 400fe4a72b5oFQ38QRKA08JdHR_7OA From cf2c13e0798f3df15766489b4773399543623958 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Jan 2004 15:43:54 +0000 Subject: [PATCH 0947/2994] Start 1.8.4-WIP (Logical change 1.271) --- ChangeLog | 3 +++ configure | 20 ++++++++++---------- configure.ac | 2 +- ntfsprogs/Makefile.in | 4 ++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b9969bf..8af7b9f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +xx/xx/2004 - 1.8.4 - WIP + - . + 19/01/2004 - 1.8.3 - Lots of small fixes. - Update ntfsinfo (Matthew J. Fanto, me) - Add new API attrib.[hc]:ntfs_compressed_attr_pread(). NOTE: You want diff --git a/configure b/configure index ce06421a..c08b00f4 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.3. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.4-WIP. # # Report bugs to . # @@ -422,8 +422,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.3' -PACKAGE_STRING='ntfsprogs 1.8.3' +PACKAGE_VERSION='1.8.4-WIP' +PACKAGE_STRING='ntfsprogs 1.8.4-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -954,7 +954,7 @@ 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 ntfsprogs 1.8.3 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.4-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1021,7 +1021,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.3:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.4-WIP:";; esac cat <<\_ACEOF @@ -1132,7 +1132,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.3 +ntfsprogs configure 1.8.4-WIP generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1147,7 +1147,7 @@ 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 ntfsprogs $as_me 1.8.3, which was +It was created by ntfsprogs $as_me 1.8.4-WIP, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1841,7 +1841,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.8.3' + VERSION='1.8.4-WIP' cat >>confdefs.h <<_ACEOF @@ -21673,7 +21673,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.3, which was +This file was extended by ntfsprogs $as_me 1.8.4-WIP, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21736,7 +21736,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.3 +ntfsprogs config.status 1.8.4-WIP configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 862969f5..06d40815 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.3, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.4-WIP, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 4f6abc61..e75c5253 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -147,10 +147,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_TRUE@AM_LFLAGS = -static @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From 825338e8666d37a17e7ba2ab6845800a145abe6a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Jan 2004 15:43:54 +0000 Subject: [PATCH 0948/2994] Start 1.8.4-WIP BKrev: 400fefbaoXAmT5RgX-X5jjPdCcX8Gg From b19215d1ed4e6b98371336f5a56a8412d4f35c3f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Jan 2004 23:53:36 +0000 Subject: [PATCH 0949/2994] Fix memory leaks in ntfs_readdir() and ntfs_inode_lookup_by_name(). Thanks to Christophe Grenier who used Valgrind to find them. (Logical change 1.272) --- libntfs/dir.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libntfs/dir.c b/libntfs/dir.c index 11fe50d1..83897179 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -238,6 +238,7 @@ found_it: ia = (INDEX_ALLOCATION*)malloc(index_block_size); if (!ia) { Dperror("Failed to allocate buffer for index block"); + ntfs_attr_close(ia_na); goto put_err_out; } @@ -335,6 +336,7 @@ found_it2: * about having matched imperfectly before. */ mref = le64_to_cpu(ie->indexed_file); + free(ia); ntfs_attr_close(ia_na); ntfs_attr_put_search_ctx(ctx); return mref; @@ -422,6 +424,7 @@ found_it2: errno = EIO; goto close_err_out; } + free(ia); ntfs_attr_close(ia_na); ntfs_attr_put_search_ctx(ctx); /* @@ -599,10 +602,10 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, ntfs_volume *vol; ntfs_attr *ia_na, *bmp_na = NULL; ntfs_attr_search_ctx *ctx = NULL; - u8 *index_end, *bmp; + u8 *index_end, *bmp = NULL; INDEX_ROOT *ir; INDEX_ENTRY *ie; - INDEX_ALLOCATION *ia; + INDEX_ALLOCATION *ia = NULL; int rc, ir_pos, bmp_buf_size, bmp_buf_pos, eo; u32 index_block_size, index_vcn_size; u8 index_block_size_bits, index_vcn_size_bits; @@ -901,6 +904,10 @@ EOD: /* We are finished, set *pos to EOD. */ *pos = i_size + vol->mft_record_size; done: + if (ia) + free(ia); + if (bmp) + free(bmp); if (bmp_na) ntfs_attr_close(bmp_na); if (ia_na) @@ -920,6 +927,10 @@ err_out: Dprintf("%s() failed.\n", __FUNCTION__); if (ctx) ntfs_attr_put_search_ctx(ctx); + if (ia) + free(ia); + if (bmp) + free(bmp); if (bmp_na) ntfs_attr_close(bmp_na); if (ia_na) From cba63740aed7edf419b28c20692344d7628951e5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Jan 2004 23:53:36 +0000 Subject: [PATCH 0950/2994] Fix memory leaks in ntfs_readdir(), ntfs_inode_lookup_by_name(), and ntfs_attr_open(). Thanks to Christophe Grenier who used Valgrind to find them. BKrev: 40106280zigSMMr2Lc0yRFCTOIPrnw From e14583bed75dadb8de23ee5b7f5ff7f8bfdf77de Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Jan 2004 23:53:36 +0000 Subject: [PATCH 0951/2994] Fix memory leek in error code path ntfs_attr_open(). Thanks to Christophe Grenier who used Valgrind to find it. (Logical change 1.272) --- libntfs/attrib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index a41b85b5..0c600a12 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -374,6 +374,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, put_err_out: ntfs_attr_put_search_ctx(ctx); err_out: + free(na); errno = err; return NULL; } From 85bc7db09804342e8bdbe01fe60443e6d07efab4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 22 Jan 2004 23:53:36 +0000 Subject: [PATCH 0952/2994] Update (Logical change 1.272) --- ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8af7b9f2..c812e140 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ xx/xx/2004 - 1.8.4 - WIP - - . + - Fix memory leaks in libntfs/dir.c::ntfs_inode_lookup_by_name(), + libntfs/dir.c::ntfs_readdir() and libntfs/attrib.c::ntfs_attr_open(). + Thanks to Christophe Grenier and valgrind for finding them. 19/01/2004 - 1.8.3 - Lots of small fixes. - Update ntfsinfo (Matthew J. Fanto, me) From b3f275dccd6d692f80bd26d0858a2c6f602aeb54 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 Jan 2004 09:53:57 +0000 Subject: [PATCH 0953/2994] Update for 1.8.4 release. (Logical change 1.273) --- ChangeLog | 2 +- Makefile.in | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c812e140..e5631396 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/2004 - 1.8.4 - WIP +23/01/2004 - 1.8.4 - Memory leak fixes. - Fix memory leaks in libntfs/dir.c::ntfs_inode_lookup_by_name(), libntfs/dir.c::ntfs_readdir() and libntfs/attrib.c::ntfs_attr_open(). Thanks to Christophe Grenier and valgrind for finding them. diff --git a/Makefile.in b/Makefile.in index 6409543c..b6a590f9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -78,7 +78,6 @@ LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ From 26fbe3a1019aca8ea19a283044970f4aaf2565e0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 Jan 2004 09:53:57 +0000 Subject: [PATCH 0954/2994] Update for latest libtool/autoconf/automake. (Logical change 1.273) --- configure | 466 +++++++++++++++++------------------------- configure.ac | 16 +- doc/Makefile.in | 1 - include/Makefile.in | 1 - libntfs/Makefile.in | 1 - ntfsprogs/Makefile.in | 5 +- 6 files changed, 186 insertions(+), 304 deletions(-) diff --git a/configure b/configure index c08b00f4..28c7a2be 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.4-WIP. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.4. # # Report bugs to . # @@ -422,8 +422,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.4-WIP' -PACKAGE_STRING='ntfsprogs 1.8.4-WIP' +PACKAGE_VERSION='1.8.4' +PACKAGE_STRING='ntfsprogs 1.8.4' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -465,7 +465,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os 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 REALLYSTATIC_TRUE REALLYSTATIC_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 RANLIB ac_ct_RANLIB PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE EGREP ECHO AR ac_ct_AR CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBTOOL_DEPS all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os 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 REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -954,7 +954,7 @@ 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 ntfsprogs 1.8.4-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1021,7 +1021,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.4-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.4:";; esac cat <<\_ACEOF @@ -1038,10 +1038,10 @@ Optional Features: --enable-really-static completely static binaries --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors - --disable-gnome-vfs Omit Gnome-VFS-2.0 'libntfs' interface (default=detect) --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --disable-gnome-vfs Omit Gnome-VFS-2.0 'libntfs' interface (default=detect) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1132,7 +1132,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.4-WIP +ntfsprogs configure 1.8.4 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1147,7 +1147,7 @@ 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 ntfsprogs $as_me 1.8.4-WIP, which was +It was created by ntfsprogs $as_me 1.8.4, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1841,7 +1841,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.8.4-WIP' + VERSION='1.8.4' cat >>confdefs.h <<_ACEOF @@ -3239,227 +3239,7 @@ echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi -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 - - -# Check whether --enable-gnome-vfs or --disable-gnome-vfs was given. -if test "${enable_gnome_vfs+set}" = set; then - enableval="$enable_gnome_vfs" - -else - enable_gnome_vfs=auto - -fi; -compile_gnome_vfs=false -if test "$enable_gnome_vfs" != "no"; then - # Make compilation work on SuSE 9.0. - if test -d "/opt/gnome"; then - export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" - fi - - succeeded=no - - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - fi - - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 -echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 - - if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - succeeded=yes - - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 - - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 - else - LIBNTFS_GNOMEVFS_CFLAGS="" - LIBNTFS_GNOMEVFS_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - - fi - - - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_gnome_vfs=true - else - - if test "$enable_gnome_vfs" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&5 -echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&5 -echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&2;} - fi - - fi - -fi - - -if $compile_gnome_vfs; then - ENABLE_GNOME_VFS_TRUE= - ENABLE_GNOME_VFS_FALSE='#' -else - ENABLE_GNOME_VFS_TRUE='#' - ENABLE_GNOME_VFS_FALSE= -fi - - -# create a working libtool-script -if test -z "$LIBTOOL"; then - 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 - - # Check whether --enable-fast-install or --disable-fast-install was given. +# 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} @@ -3971,7 +3751,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3974 "configure"' > conftest.$ac_ext + echo '#line 3754 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5468,7 +5248,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5471:" \ +echo "$as_me:5251:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6473,11 +6253,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6476: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6256: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6480: \$? = $ac_status" >&5 + echo "$as_me:6260: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6705,11 +6485,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6708: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6488: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6712: \$? = $ac_status" >&5 + echo "$as_me:6492: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6772,11 +6552,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6775: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6555: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6779: \$? = $ac_status" >&5 + echo "$as_me:6559: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8791,7 +8571,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10804: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11028: \$? = $ac_status" >&5 + echo "$as_me:10808: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -11088,11 +10868,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11091: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10871: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11095: \$? = $ac_status" >&5 + echo "$as_me:10875: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12338,7 +12118,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13041: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13265: \$? = $ac_status" >&5 + echo "$as_me:13045: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13325,11 +13105,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13328: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13108: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13332: \$? = $ac_status" >&5 + echo "$as_me:13112: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15272,11 +15052,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15275: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15055: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15279: \$? = $ac_status" >&5 + echo "$as_me:15059: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15504,11 +15284,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15507: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15287: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15511: \$? = $ac_status" >&5 + echo "$as_me:15291: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15571,11 +15351,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15574: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15354: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15578: \$? = $ac_status" >&5 + echo "$as_me:15358: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17590,7 +17370,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 +echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 + + if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + succeeded=yes + + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 + + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 + else + LIBNTFS_GNOMEVFS_CFLAGS="" + LIBNTFS_GNOMEVFS_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + compile_gnome_vfs=true + else + + if test "$enable_gnome_vfs" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&5 +echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&5 +echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&2;} + fi + + fi + +fi + + +if $compile_gnome_vfs; then + ENABLE_GNOME_VFS_TRUE= + ENABLE_GNOME_VFS_FALSE='#' +else + ENABLE_GNOME_VFS_TRUE='#' + ENABLE_GNOME_VFS_FALSE= +fi + # add --with-extra-includes and --with-extra-libs switch to ./configure all_libraries="$all_libraries $USER_LDFLAGS" @@ -21390,13 +21289,6 @@ 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 -if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"ENABLE_GNOME_VFS\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -21404,6 +21296,13 @@ echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"ENABLE_GNOME_VFS\" 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 @@ -21673,7 +21572,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.4-WIP, which was +This file was extended by ntfsprogs $as_me 1.8.4, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21736,7 +21635,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.4-WIP +ntfsprogs config.status 1.8.4 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -22006,17 +21905,12 @@ 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,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@PKG_CONFIG@,$PKG_CONFIG,;t t -s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t -s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t -s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t -s,@ENABLE_GNOME_VFS_FALSE@,$ENABLE_GNOME_VFS_FALSE,;t t s,@EGREP@,$EGREP,;t t s,@ECHO@,$ECHO,;t t s,@AR@,$AR,;t t s,@ac_ct_AR@,$ac_ct_AR,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t @@ -22029,7 +21923,11 @@ s,@F77@,$F77,;t t s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t -s,@LIBTOOL_DEPS@,$LIBTOOL_DEPS,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t +s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t +s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t +s,@ENABLE_GNOME_VFS_FALSE@,$ENABLE_GNOME_VFS_FALSE,;t t s,@all_includes@,$all_includes,;t t s,@all_libraries@,$all_libraries,;t t s,@AUTODIRS@,$AUTODIRS,;t t diff --git a/configure.ac b/configure.ac index 06d40815..7e3255ae 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.4-WIP, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.4, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) @@ -65,7 +65,7 @@ AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET -AC_PROG_RANLIB +AC_PROG_LIBTOOL AC_ARG_ENABLE(gnome-vfs, [ --disable-gnome-vfs Omit Gnome-VFS-2.0 'libntfs' interface (default=detect)], , @@ -89,18 +89,6 @@ if test "$enable_gnome_vfs" != "no"; then fi AM_CONDITIONAL(ENABLE_GNOME_VFS, $compile_gnome_vfs) -# create a working libtool-script -if test -z "$LIBTOOL"; then - AC_LANG_PUSH(C) - AM_PROG_LIBTOOL - #LIBTOOL="$LIBTOOL --silent" - AC_LANG_POP - AC_SUBST(LIBTOOL_DEPS) - LIBTOOL_SHELL='/bin/sh ./libtool' -else - LIBTOOL_SHELL=$LIBTOOL -fi - # add --with-extra-includes and --with-extra-libs switch to ./configure all_libraries="$all_libraries $USER_LDFLAGS" all_includes="$all_includes $USER_INCLUDES" diff --git a/doc/Makefile.in b/doc/Makefile.in index 519131ab..ec95f413 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -78,7 +78,6 @@ LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ diff --git a/include/Makefile.in b/include/Makefile.in index 10950416..c055e2e3 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -78,7 +78,6 @@ LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 28a38e5e..a5aaa9c8 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -105,7 +105,6 @@ LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index e75c5253..7604c942 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -78,7 +78,6 @@ LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ @@ -147,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From 743a352c6036a450b2312c820a7c7bdbbf22340c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 Jan 2004 09:53:57 +0000 Subject: [PATCH 0955/2994] Update spec file change log. (Logical change 1.273) --- ntfsprogs.spec.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index e7be4f5e..cbc3879d 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -96,6 +96,9 @@ rm -rf "$RPM_BUILD_ROOT" %{_libdir}/gnome-vfs-2.0/modules/libntfs-gnomevfs.*a* %changelog +* Mon Jan 19 2004 Anton Altaparmakov +- Add %config to tell rpm that libntfs.conf is a config file. + * Thu Nov 6 2003 Anton Altaparmakov - update description (it was getting too long) - merge libntfs-gnomevfs From f6e26b3feddeac79d3fc027ab145ccf72dccc909 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 Jan 2004 09:53:57 +0000 Subject: [PATCH 0956/2994] Update with latest libtoolize. (Logical change 1.273) --- config.guess | 586 ++++++----- config.sub | 310 +++--- ltmain.sh | 2679 ++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 2469 insertions(+), 1106 deletions(-) diff --git a/config.guess b/config.guess index dff9e481..c8fc6835 100755 --- a/config.guess +++ b/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2001-09-04' +timestamp='2003-07-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,8 +24,9 @@ timestamp='2001-09-04' # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Written by Per Bothner . -# Please send patches to . +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and @@ -87,30 +88,42 @@ if test $# != 0; then exit 1 fi +trap 'exit 1' 1 2 15 -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. -# CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. -set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int dummy(){}" > $dummy.c ; - for c in cc gcc c89 ; do - ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; - if test $? = 0 ; then +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; - rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac' +esac ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -123,33 +136,44 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) - # Netbsd (nbsd) targets should (where applicable) match one or + # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. - # Determine the machine/vendor (is the vendor relevant). - case "${UNAME_MACHINE}" in - amiga) machine=m68k-unknown ;; - arm32) machine=arm-unknown ;; - atari*) machine=m68k-atari ;; - sun3*) machine=m68k-sun ;; - mac68k) machine=m68k-apple ;; - macppc) machine=powerpc-apple ;; - hp3[0-9][05]) machine=m68k-hp ;; - ibmrt|romp-ibm) machine=romp-ibm ;; - *) machine=${UNAME_MACHINE}-unknown ;; + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. - case "${UNAME_MACHINE}" in - i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null @@ -166,75 +190,112 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ;; esac # The OS release - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - cat <$dummy.s - .data -\$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - eval $set_cc_for_build - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - 2-1307) - UNAME_MACHINE="alphaev68" - ;; - esac - fi - rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; + Alpha*:OpenVMS:*:*) + echo alpha-hp-vms + exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -247,29 +308,11 @@ EOF Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; - arc64:OpenBSD:*:*) - echo mips64el-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hkmips:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition @@ -291,6 +334,13 @@ EOF NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; @@ -319,7 +369,7 @@ EOF echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) - UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) @@ -333,12 +383,6 @@ EOF aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; - sparc*:NetBSD:*) - echo `uname -p`-unknown-netbsd${UNAME_RELEASE} - exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -365,18 +409,6 @@ EOF *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; @@ -415,15 +447,20 @@ EOF exit (-1); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; @@ -496,8 +533,7 @@ EOF exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 @@ -506,7 +542,7 @@ EOF fi exit 0 ;; *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else @@ -546,10 +582,8 @@ EOF 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - case "${HPUX_REV}" in - 11.[0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 @@ -558,13 +592,13 @@ EOF case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac - fi ;; - esac - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include @@ -597,11 +631,21 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy - fi ;; + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) @@ -635,8 +679,7 @@ EOF exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) @@ -664,9 +707,6 @@ EOF parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; - hppa*:OpenBSD:*:*) - echo hppa-unknown-openbsd - exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; @@ -685,9 +725,6 @@ EOF C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; - CRAY*X-MP:*:*:*) - echo xmp-cray-unicos - exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; @@ -700,27 +737,21 @@ EOF CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; - CRAY*T3D:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; + *:UNICOS/mp:*:*) + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; @@ -730,11 +761,22 @@ EOF *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; - *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + # GNU/FreeBSD systems have a "k" prefix to indicate we are using + # FreeBSD's kernel, but not the complete OS. + case ${LIBC} in gnu) kernel_only='k' ;; esac + echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -745,11 +787,17 @@ EOF i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix + echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin @@ -767,25 +815,60 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux + exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; mips:Linux:*:*) - case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in - big) echo mips-unknown-linux-gnu && exit 0 ;; - little) echo mipsel-unknown-linux-gnu && exit 0 ;; - esac + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-${VENDOR}-linux exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-${VENDOR}-linux exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -798,37 +881,41 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-${VENDOR}-linux ;; + PA8*) echo hppa2.0-${VENDOR}-linux ;; + *) echo hppa-${VENDOR}-linux ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-${VENDOR}-linux exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux + exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo x86_64-${VENDOR}-linux exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. - ld_supported_targets=`cd /; ld --help 2>&1 \ + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// @@ -836,48 +923,44 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" + exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" + echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or + # Either a pre-BFD a.out linker (linuxoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build - cat >$dummy.c < -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-pc-linux-gnu\n", argv[1]); -# else - printf ("%s-pc-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-pc-linux-gnulibc1\n", argv[1]); -# endif -#else - printf ("%s-pc-linux-gnuaout\n", argv[1]); -#endif - return 0; -} + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) @@ -894,6 +977,23 @@ EOF # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -915,22 +1015,19 @@ EOF UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about @@ -954,9 +1051,15 @@ EOF # "miniframe" echo m68010-convergent-sysv exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -973,9 +1076,6 @@ EOF mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; @@ -1047,6 +1147,9 @@ EOF SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; @@ -1054,18 +1157,24 @@ EOF echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) - echo `uname -p`-apple-darwin${UNAME_RELEASE} + case `uname -p` in + *86) UNAME_PROCESSOR=i686 ;; + powerpc) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) - if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo `uname -p`-${UNAME_MACHINE}-nto-qnx + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSR-[KW]:NONSTOP_KERNEL:*:*) + NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) @@ -1088,11 +1197,6 @@ EOF fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; @@ -1111,11 +1215,8 @@ EOF *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; esac @@ -1237,8 +1338,7 @@ main () } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. diff --git a/config.sub b/config.sub index 393f13d3..9952c14c 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2001-09-07' +timestamp='2003-07-04' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -29,7 +29,8 @@ timestamp='2001-09-07' # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Please send patches to . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -117,7 +118,7 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) + nto-qnx* | linux-gnu* | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -226,32 +227,44 @@ case $basic_machine in 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ - | d10v | d30v | dsp16xx \ - | fr30 \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ + | ip2k \ | m32r | m68000 | m68k | m88k | mcore \ - | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el | mips64vr4300 \ - | mips64vr4300el | mips64vr5000 | mips64vr5000el \ - | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ - | mipsisa32 \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | msp430 \ | ns16k | ns32k \ - | openrisc \ + | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | s390 | s390x \ - | sh | sh[34] | sh[34]eb | shbe | shle \ - | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ - | stormy16 | strongarm \ - | tahoe | thumb | tic80 | tron \ - | v850 \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ | we32k \ - | x86 | xscale \ + | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; @@ -278,38 +291,55 @@ case $basic_machine in 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alphapca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armv*-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c54x-* \ - | clipper-* | cray2-* | cydra-* \ - | d10v-* | d30v-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | fx80-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* \ | m32r-* \ - | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ - | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ - | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ - | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | msp430-* \ + | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | s390-* | s390x-* \ - | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ - | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ - | v850-* | vax-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ | ymp-* \ | z8k-*) ;; @@ -343,6 +373,9 @@ case $basic_machine in basic_machine=a29k-none os=-bsd ;; + amd64) + basic_machine=x86_64-pc + ;; amdahl) basic_machine=580-amdahl os=-sysv @@ -374,6 +407,10 @@ case $basic_machine in basic_machine=ns32k-sequent os=-dynix ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -394,16 +431,8 @@ case $basic_machine in basic_machine=c38-convex os=-bsd ;; - cray | ymp) - basic_machine=ymp-cray - os=-unicos - ;; - cray2) - basic_machine=cray2-cray - os=-unicos - ;; - [cjt]90) - basic_machine=${basic_machine}-cray + cray | j90) + basic_machine=j90-cray os=-unicos ;; crds | unos) @@ -418,6 +447,14 @@ case $basic_machine in decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola @@ -598,14 +635,6 @@ case $basic_machine in basic_machine=m68k-atari os=-mint ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux-gnu - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux-gnu - ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; @@ -620,6 +649,10 @@ case $basic_machine in basic_machine=m68k-rom68k os=-coff ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; msdos) basic_machine=i386-pc os=-msdos @@ -692,6 +725,10 @@ case $basic_machine in np1) basic_machine=np1-gould ;; + nv1) + basic_machine=nv1-cray + os=-unicosmp + ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -699,6 +736,10 @@ case $basic_machine in basic_machine=hppa1.1-oki os=-proelf ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose @@ -721,49 +762,55 @@ case $basic_machine in pbb) basic_machine=m68k-tti ;; - pc532 | pc532-*) + pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | k6 | nexgen) + pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; - pentiumpro | p6 | 6x86 | athlon) + pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; - pentiumii | pentium2) + pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-*) + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumii-* | pentium2-*) + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown - ;; + ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown - ;; + ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown - ;; + ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown - ;; + ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; @@ -784,10 +831,26 @@ case $basic_machine in rtpc | rtpc-*) basic_machine=romp-ibm ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; sa29200) basic_machine=a29k-amd os=-udi ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; sequent) basic_machine=i386-sequent ;; @@ -795,7 +858,10 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; - sparclite-wrs) + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; @@ -862,19 +928,35 @@ case $basic_machine in os=-dynix ;; t3e) - basic_machine=t3e-cray + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; tower | tower-32) basic_machine=m68k-ncr ;; @@ -899,8 +981,8 @@ case $basic_machine in os=-vms ;; vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; + basic_machine=f301-fujitsu + ;; vxworks960) basic_machine=i960-wrs os=-vxworks @@ -921,17 +1003,13 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; - windows32) - basic_machine=i386-pc - os=-windows32-msvcrt - ;; - xmp) - basic_machine=xmp-cray - os=-unicos - ;; - xps | xps100) + xps | xps100) basic_machine=xps100-honeywell ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim @@ -952,13 +1030,6 @@ case $basic_machine in op60c) basic_machine=hppa1.1-oki ;; - mips) - if [ x$os = x-linux-gnu ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi - ;; romp) basic_machine=romp-ibm ;; @@ -978,13 +1049,16 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh3eb | sh4eb) + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; + sh64) + basic_machine=sh64-unknown + ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; - cydra) + cydra) basic_machine=cydra-cydrome ;; orion) @@ -999,10 +1073,6 @@ case $basic_machine in pmac | pmac-mpw) basic_machine=powerpc-apple ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; @@ -1058,17 +1128,19 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos*) + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1080,8 +1152,10 @@ case $os in ;; esac ;; + -nto-qnx*) + ;; -nto*) - os=-nto-qnx + os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ @@ -1090,9 +1164,6 @@ case $os in -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; @@ -1120,14 +1191,20 @@ case $os in -acis*) os=-aos ;; + -atheos*) + os=-atheos + ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; + -nova*) + os=-rtmk-nova + ;; -ns2 ) - os=-nextstep2 + os=-nextstep2 ;; -nsk*) os=-nsk @@ -1166,8 +1243,14 @@ case $os in -xenix) os=-xenix ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos ;; -none) ;; @@ -1200,10 +1283,14 @@ case $basic_machine in arm*-semi) os=-aout ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; - pdp11-*) + pdp11-*) os=-none ;; *-dec | vax-*) @@ -1230,6 +1317,9 @@ case $basic_machine in mips*-*) os=-elf ;; + or32-*) + os=-coff + ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; @@ -1293,19 +1383,19 @@ case $basic_machine in *-next) os=-nextstep3 ;; - *-gould) + *-gould) os=-sysv ;; - *-highlevel) + *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; - *-sgi) + *-sgi) os=-irix ;; - *-siemens) + *-siemens) os=-sysv4 ;; *-masscomp) @@ -1377,7 +1467,7 @@ case $basic_machine in -ptx*) vendor=sequent ;; - -vxsim* | -vxworks*) + -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) diff --git a/ltmain.sh b/ltmain.sh index dd490ba9..8bf1b20b 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -48,9 +48,6 @@ EOF exit 0 fi -# define SED for historic ltconfig's generated by Libtool 1.3 -test -z "$SED" && SED=sed - # The name of this program. progname=`$echo "$0" | ${SED} 's%^.*/%%'` modename="$progname" @@ -58,8 +55,8 @@ modename="$progname" # Constants. PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.4.3 -TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)" +VERSION=1.5 +TIMESTAMP=" (1.1220.2.1 2003/04/14 22:48:00)" default_mode= help="Try \`$progname --help' for more information." @@ -72,17 +69,17 @@ rm="rm -f" # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' -# test EBCDIC or ASCII -case `echo A|od -x` in - *[Cc]1*) # EBCDIC based system - SP2NL="tr '\100' '\n'" - NL2SP="tr '\r\n' '\100\100'" - ;; - *) # Assume ASCII based system - SP2NL="tr '\040' '\012'" - NL2SP="tr '\015\012' '\040\040'" - ;; -esac +# test EBCDIC or ASCII +case `echo A|od -x` in + *[Cc]1*) # EBCDIC based system + SP2NL="tr '\100' '\n'" + NL2SP="tr '\r\n' '\100\100'" + ;; + *) # Assume ASCII based system + SP2NL="tr '\040' '\012'" + NL2SP="tr '\015\012' '\040\040'" + ;; +esac # NLS nuisances. # Only set LANG and LC_ALL to C if already set. @@ -100,8 +97,8 @@ fi : ${IFS=" "} if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - echo "$modename: not configured to build any kind of library" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + $echo "$modename: not configured to build any kind of library" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi @@ -117,8 +114,51 @@ execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +win32_libid () { + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` + if test "X$win32_nmres" = "Ximport" ; then + win32_libid_type="x86 archive import" + else + win32_libid_type="x86 archive static" + fi + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + +# End of Shell function definitions +##################################### + # Parse our command line options once, thoroughly. -while test $# -gt 0 +while test "$#" -gt 0 do arg="$1" shift @@ -134,6 +174,33 @@ do execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; + tag) + tagname="$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit 1 + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; *) eval "$prev=\$arg" ;; @@ -151,17 +218,25 @@ do ;; --version) - echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2003 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit 0 ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" + done exit 0 ;; --debug) - echo "$progname: enabling shell trace mode" + $echo "$progname: enabling shell trace mode" set -x ;; @@ -170,16 +245,16 @@ do ;; --features) - echo "host: $host" + $echo "host: $host" if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" + $echo "enable shared libraries" else - echo "disable shared libraries" + $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - echo "enable static libraries" + $echo "enable static libraries" else - echo "disable static libraries" + $echo "disable static libraries" fi exit 0 ;; @@ -195,6 +270,13 @@ do show=: ;; + --tag) prevopt="--tag" prev=tag ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + ;; + -dlopen) prevopt="-dlopen" prev=execute_dlfiles @@ -228,8 +310,10 @@ if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 case $nonopt in - *cc | *++ | gcc* | *-gcc* | xlc*) + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do @@ -284,158 +368,127 @@ if test -z "$show_help"; then modename="$modename: compile" # Get the compilation command and the source file. base_compile= - prev= - lastarg= - srcfile="$nonopt" + srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_output= + arg_mode=normal + libobj= - user_target=no for arg do - case $prev in - "") ;; - xcompiler) - # Aesthetically quote the previous argument. - prev= - lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - - case $arg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - continue - ;; - esac - - # Accept any command-line options. - case $arg in - -o) - if test "$user_target" != "no"; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - user_target=next + case "$arg_mode" in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal ;; - -static) - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - continue - ;; - esac - - case $user_target in - next) - # The next one is the -o target name - user_target=yes - continue - ;; - yes) - # We got the output file - user_target=set + target ) libobj="$arg" + arg_mode=normal continue ;; - esac - # Accept the current argument as the source file. - lastarg="$srcfile" - srcfile="$arg" + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + arg_mode=target + continue + ;; + + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode # Aesthetically quote the previous argument. - - # Backslashify any backslashes, double quotes, and dollar signs. - # These are the only characters that are still specially - # interpreted inside of double-quoted scrings. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. - case $lastarg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") lastarg="\"$lastarg\"" ;; esac - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - done + base_compile="$base_compile $lastarg" + done # for arg - case $user_target in - set) + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit 1 ;; - no) - # Get the name of the library object. - libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - *) + target) $echo "$modename: you must specify a target with \`-o'" 1>&2 exit 1 ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSfmso]' + xform='[cCFSifmso]' case $libobj in *.ada) xform=ada ;; *.adb) xform=adb ;; @@ -443,10 +496,13 @@ if test -z "$show_help"; then *.asm) xform=asm ;; *.c++) xform=c++ ;; *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; *.cpp) xform=cpp ;; *.cxx) xform=cxx ;; *.f90) xform=f90 ;; *.for) xform=for ;; + *.java) xform=java ;; esac libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` @@ -459,6 +515,56 @@ if test -z "$show_help"; then ;; esac + # Infer tagged configuration to use if any are available and + # if one wasn't chosen via the "--tag" command line option. + # Only attempt this if the compiler in the base compile + # command doesn't match the default compiler. + if test -n "$available_tags" && test -z "$tagname"; then + case $base_compile in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" + case "$base_compile " in + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit 1 +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi + + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 @@ -467,9 +573,9 @@ if test -z "$show_help"; then # Delete any leftover library objects. if test "$build_old_libs" = yes; then - removelist="$obj $libobj" + removelist="$obj $lobj $libobj ${libobj}T" else - removelist="$libobj" + removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist @@ -494,6 +600,7 @@ if test -z "$show_help"; then removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit 1" 1 2 15 else + output_obj= need_locks=no lockfile= fi @@ -507,7 +614,7 @@ if test -z "$show_help"; then done elif test "$need_locks" = warn; then if test -f "$lockfile"; then - echo "\ + $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` @@ -521,56 +628,55 @@ compiler." $run $rm $removelist exit 1 fi - echo $srcfile > "$lockfile" + $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != x"$srcfile"; then - echo "\ + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -599,9 +705,9 @@ compiler." fi # Just move the object if needed, then go on to compile the next one - if test x"$output_obj" != x"$libobj"; then - $show "$mv $output_obj $libobj" - if $run $mv $output_obj $libobj; then : + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist @@ -609,48 +715,21 @@ compiler." fi fi - # If we have no pic_flag, then copy the object into place and finish. - if (test -z "$pic_flag" || test "$pic_mode" != default) && - test "$build_old_libs" = yes; then - # Rename the .lo from within objdir to obj - if test -f $obj; then - $show $rm $obj - $run $rm $obj - fi + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != x"$srcfile"; then - echo "\ + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -698,7 +775,7 @@ compiler." fi # Just move the object if needed - if test x"$output_obj" != x"$obj"; then + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else @@ -708,23 +785,25 @@ compiler." fi fi - # Create an invalid libtool object if no PIC, so that we do not - # accidentally link it into a program. - if test "$build_libtool_libs" != yes; then - $show "echo timestamp > $libobj" - $run eval "echo timestamp > \$libobj" || exit $? - else - # Move the .lo from within objdir - $show "$mv $libobj $lo_libobj" - if $run $mv $libobj $lo_libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T <\?\'\ \ ]*|*]*|"") @@ -902,7 +985,7 @@ compiler." prev= continue ;; - inst_prefix) + inst_prefix) inst_prefix_dir="$arg" prev= continue @@ -912,6 +995,113 @@ compiler." prev= continue ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit 1 + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit 1 + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit 1 + fi + arg=$save_arg + prev= + continue + ;; rpath | xrpath) # We need an absolute path. case $arg in @@ -950,13 +1140,21 @@ compiler." finalize_command="$finalize_command $wl$qarg" continue ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac - fi # test -n $prev + fi # test -n "$prev" prevarg="$arg" @@ -1017,7 +1215,7 @@ compiler." # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in - no/*-*-irix* | no/*-*-nonstopux*) + no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; @@ -1072,14 +1270,18 @@ compiler." # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd*) - # Do not include libc_r directly, use -pthread flag. + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" continue - ;; esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac fi deplibs="$deplibs $arg" continue @@ -1090,6 +1292,34 @@ compiler." continue ;; + # gcc -m* arguments should be passed to the linker via $compiler_flags + # in order to pass architecture information to the linker + # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo + # but this is not reliable with gcc because gcc may use -mfoo to + # select a different linker, different libraries, etc, while + # -Wl,-mfoo simply passes -mfoo to the linker. + -m*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + if test "$with_gcc" = "yes" ; then + compiler_flags="$compiler_flags $arg" + fi + continue + ;; + + -shrext) + prev=shrext + continue + ;; + -no-fast-install) fast_install=no continue @@ -1114,6 +1344,11 @@ compiler." continue ;; + -objectlist) + prev=objectlist + continue + ;; + -o) prev=output ;; -release) @@ -1166,6 +1401,11 @@ compiler." prev=vinfo continue ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` @@ -1214,6 +1454,11 @@ compiler." continue ;; + -XCClinker) + prev=xcclinker + continue + ;; + # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need @@ -1226,29 +1471,101 @@ compiler." esac ;; - *.lo | *.$objext) - # A library or standard object. - if test "$prev" = dlfiles; then - # This file was specified with -dlopen. - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $arg" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi + *.$objext) + # A standard object. + objs="$objs $arg" + ;; - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` - prev= - else + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. case $arg in - *.lo) libobjs="$libobjs $arg" ;; - *) objs="$objs $arg" ;; + */* | *\\*) . $arg ;; + *) . ./$arg ;; esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit 1 + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit 1 + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi fi ;; @@ -1302,12 +1619,54 @@ compiler." exit 1 fi + # Infer tagged configuration to use if any are available and + # if one wasn't chosen via the "--tag" command line option. + # Only attempt this if the compiler in the base link + # command doesn't match the default compiler. + if test -n "$available_tags" && test -z "$tagname"; then + case $base_compile in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" + case $base_compile in + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) + # The compiler in $compile_command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit 1 +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" fi + oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" @@ -1328,11 +1687,11 @@ compiler." output_objdir="$output_objdir/$objdir" fi # Create the object directory. - if test ! -d $output_objdir; then + if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? - if test $status -ne 0 && test ! -d $output_objdir; then + if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi @@ -1350,7 +1709,17 @@ compiler." *) linkmode=prog ;; # Anything else should be a program. esac + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplcations in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac specialdeplibs= + libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) @@ -1362,6 +1731,25 @@ compiler." fi libs="$libs $deplib" done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + deplibs= newdependency_libs= newlib_search_path= @@ -1393,28 +1781,33 @@ compiler." ;; esac for pass in $passes; do - if test $linkmode = prog; then - # Determine which files to process + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then case $pass in - dlopen) - libs="$dlfiles" - save_deplibs="$deplibs" # Collect dlpreopened libraries - deplibs= - ;; + dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi for deplib in $libs; do lib= found=no case $deplib in -l*) - if test $linkmode = oldlib && test $linkmode = obj; then - $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi @@ -1434,25 +1827,61 @@ compiler." finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" - test $pass = conv && continue + test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi - if test $pass = scan; then + if test "$pass" = scan; then deplibs="$deplib $deplibs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else @@ -1461,13 +1890,13 @@ compiler." fi ;; *) - $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) - if test $pass = link; then + if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in @@ -1480,30 +1909,30 @@ compiler." ;; *.la) lib="$deplib" ;; *.$libext) - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) if test "$deplibs_check_method" != pass_all; then - echo - echo "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not used here." + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." else - echo - echo "*** Warning: Linking the shared library $output against the" - echo "*** static library $deplib is not portable!" + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) - if test $pass != link; then + if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -1514,14 +1943,18 @@ compiler." esac # linkmode ;; # *.$libext *.lo | *.$objext) - if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi fi continue ;; @@ -1530,14 +1963,14 @@ compiler." continue ;; esac # case $deplib - if test $found = yes || test -f "$lib"; then : + if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 exit 1 fi # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 @@ -1553,8 +1986,9 @@ compiler." library_names= old_library= # If the library was installed with an old release of libtool, - # it will not redefine variable installed. + # it will not redefine variables installed, or shouldnotlink installed=yes + shouldnotlink=no # Read the .la file case $lib in @@ -1564,13 +1998,12 @@ compiler." if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || - { test $linkmode = oldlib && test $linkmode = obj; }; then - # Add dl[pre]opened files of deplib + { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi - if test $pass = conv; then + if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then @@ -1591,13 +2024,14 @@ compiler." fi tmp_libs="$tmp_libs $deplib" done - elif test $linkmode != prog && test $linkmode != lib; then + elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit 1 fi continue fi # $pass = conv + # Get the name of the library we link against. linklib= for l in $old_library $library_names; do @@ -1609,15 +2043,17 @@ compiler." fi # This library was specified with -dlopen. - if test $pass = dlopen; then + if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit 1 fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. - dlprefiles="$dlprefiles $lib" + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi @@ -1658,7 +2094,7 @@ compiler." name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. - if test $pass = dlpreopen; then + if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit 1 @@ -1677,18 +2113,19 @@ compiler." if test -z "$libdir"; then # Link the convenience library - if test $linkmode = lib; then + if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else - deplibs="$lib $deplibs" + deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi - if test $linkmode = prog && test $pass != link; then + + if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" @@ -1704,7 +2141,7 @@ compiler." -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? - if test $linkalldeplibs = yes; then + if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths @@ -1721,13 +2158,19 @@ compiler." continue fi # $linkmode = prog... - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # Link against this shared library + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi - if test "$linkmode,$pass" = "prog,link" || - { test $linkmode = lib && test $hardcode_into_libs = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. @@ -1749,17 +2192,6 @@ compiler." esac ;; esac - if test $linkmode = prog; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - fi fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && @@ -1769,11 +2201,51 @@ compiler." # We only need to search for static libraries continue fi + fi + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi + # This is a shared library + + # Warn about portability, can't link against -module's on some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname @@ -1787,7 +2259,7 @@ compiler." elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin*) + *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; @@ -1799,8 +2271,8 @@ compiler." # Make a new name for the extract_expsyms_cmds to use soroot="$soname" - soname=`echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : @@ -1831,9 +2303,9 @@ compiler." # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib - fi # test -n $old_archive_from_expsyms_cmds + fi # test -n "$old_archive_from_expsyms_cmds" - if test $linkmode = prog || test "$mode" != relink; then + if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= @@ -1842,6 +2314,22 @@ compiler." immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" + case $host in + *-*-sco3.2v5* ) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against it, someone + # is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; @@ -1860,6 +2348,14 @@ compiler." add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="-L$inst_prefix_dir$libdir $add_dir" + ;; + esac + fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" @@ -1882,7 +2378,7 @@ compiler." *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi - if test $linkmode = prog; then + if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else @@ -1899,7 +2395,7 @@ compiler." fi fi - if test $linkmode = prog || test "$mode" = relink; then + if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= add_dir= add= @@ -1907,16 +2403,7 @@ compiler." if test "$hardcode_direct" = yes; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then - # Try looking first in the location we're being installed to. - add_dir= - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="-L$inst_prefix_dir$libdir" - ;; - esac - fi - add_dir="$add_dir -L$libdir" + add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in @@ -1924,22 +2411,27 @@ compiler." *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi else # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" # Try looking first in the location we're being installed to. - add_dir= if test -n "$inst_prefix_dir"; then case "$libdir" in - [\\/]*) - add_dir="-L$inst_prefix_dir$libdir" - ;; + [\\/]*) + add_dir="-L$inst_prefix_dir$libdir $add_dir" + ;; esac fi - add_dir="$add_dir -L$libdir" add="-l$name" fi - if test $linkmode = prog; then + if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else @@ -1947,16 +2439,7 @@ compiler." test -n "$add" && deplibs="$add $deplibs" fi fi - elif test $linkmode = prog; then - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - - # Try to link the static library + elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. @@ -1976,21 +2459,21 @@ compiler." # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - echo - echo "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -2007,10 +2490,10 @@ compiler." fi fi # link shared/static library? - if test $linkmode = lib; then + if test "$linkmode" = lib; then if test -n "$dependency_libs" && - { test $hardcode_into_libs != yes || test $build_old_libs = yes || - test $link_static = yes; }; then + { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || + test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do @@ -2041,7 +2524,7 @@ compiler." tmp_libs="$tmp_libs $deplib" done - if test $link_all_deplibs != no; then + if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in @@ -2061,7 +2544,7 @@ compiler." ;; esac if grep "^installed=no" $deplib > /dev/null; then - path="-L$absdir/$objdir" + path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then @@ -2071,12 +2554,53 @@ compiler." if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi - path="-L$absdir" + path="$absdir" fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + newlib_search_path="$newlib_search_path $path" + path="" + fi + ;; + *) + path="-L$path" + ;; + esac + + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac ;; *) continue ;; esac case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$deplibs $depdepl" ;; + esac + case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac @@ -2084,15 +2608,15 @@ compiler." fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs - if test $pass = dlpreopen; then + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi - if test $pass != dlopen; then - test $pass != scan && dependency_libs="$newdependency_libs" - if test $pass != conv; then + if test "$pass" != dlopen; then + if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do @@ -2114,9 +2638,30 @@ compiler." eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) @@ -2144,19 +2689,31 @@ compiler." eval $var=\"$tmp_libs\" done # for var fi - if test "$pass" = "conv" && - { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then - libs="$deplibs" # reset libs - deplibs= - fi + # Last step: remove runtime libs from dependency_libs (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs done # for pass - if test $linkmode = prog; then + if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi @@ -2170,7 +2727,7 @@ compiler." fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then @@ -2192,6 +2749,7 @@ compiler." case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext\" eval libname=\"$libname_spec\" ;; *) @@ -2203,6 +2761,7 @@ compiler." if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` @@ -2215,9 +2774,9 @@ compiler." $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit 1 else - echo - echo "*** Warning: Linking the shared library $output against the non-libtool" - echo "*** objects $objs is not portable!" + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi @@ -2227,7 +2786,7 @@ compiler." fi set dummy $rpath - if test $# -gt 2; then + if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" @@ -2236,14 +2795,16 @@ compiler." if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. - libext=al + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then @@ -2262,13 +2823,50 @@ compiler." exit 1 fi - current="$2" - revision="$3" - age="$4" + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac # Check that each of the things are valid numbers. case $current in - [0-9]*) ;; + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2277,7 +2875,7 @@ compiler." esac case $revision in - [0-9]*) ;; + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2286,7 +2884,7 @@ compiler." esac case $age in - [0-9]*) ;; + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2294,7 +2892,7 @@ compiler." ;; esac - if test $age -gt $current; then + if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 @@ -2338,7 +2936,7 @@ compiler." # Add in all the interfaces that we are compatible with. loop=$revision - while test $loop != 0; do + while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" @@ -2361,7 +2959,7 @@ compiler." # Add in all the interfaces that we are compatible with. loop=$age - while test $loop != 0; do + while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" @@ -2385,7 +2983,7 @@ compiler." *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 ;; esac @@ -2393,12 +2991,11 @@ compiler." # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= - verstring="0.0" case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely - verstring="" + verstring= ;; *) verstring="0.0" @@ -2432,9 +3029,24 @@ compiler." fi if test "$mode" != relink; then - # Remove our outputs. - $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" - $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi fi # Now set the variables for building old libraries. @@ -2447,9 +3059,9 @@ compiler." # Eliminate all temporary directories. for path in $notinst_path; do - lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then @@ -2462,7 +3074,7 @@ compiler." *) finalize_rpath="$finalize_rpath $libdir" ;; esac done - if test $hardcode_into_libs != yes || test $build_old_libs = yes; then + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi @@ -2502,10 +3114,11 @@ compiler." ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue ;; - *) + *) # Add libc to deplibs on all other systems if necessary. - if test $build_libtool_need_lc = "yes"; then + if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; @@ -2532,7 +3145,7 @@ compiler." # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behaviour. + # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) @@ -2545,45 +3158,22 @@ compiler." int main() { return 0; } EOF $rm conftest - $CC -o conftest conftest.c $deplibs - if test $? -eq 0 ; then + $LTCC -o conftest conftest.c $deplibs + if test "$?" -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do name="`expr $i : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - echo - echo "*** Warning: dynamic linker does not accept needed library $i." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which I believe you do not have" - echo "*** because a test_compile did reveal that the linker did not use it for" - echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occured in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - $rm conftest - $CC -o conftest conftest.c $i - # Did it work? - if test $? -eq 0 ; then - ldd_output=`ldd conftest` + if test "$name" != "" && test "$name" -ne "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then libname=`eval \\$echo \"$libname_spec\"` deplib_matches=`eval \\$echo \"$library_names_spec\"` set dummy $deplib_matches @@ -2592,21 +3182,64 @@ EOF newdeplibs="$newdeplibs $i" else droppeddeps=yes - echo - echo "*** Warning: dynamic linker does not accept needed library $i." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because a test_compile did reveal that the linker did not use this one" - echo "*** as a dynamic dependency that programs can get resolved with at runtime." + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which I believe you do not have" + $echo "*** because a test_compile did reveal that the linker did not use it for" + $echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occurred in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" != "0"; then + $rm conftest + $LTCC -o conftest conftest.c $i + # Did it work? + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because a test_compile did reveal that the linker did not use this one" + $echo "*** as a dynamic dependency that programs can get resolved with at runtime." + fi fi else droppeddeps=yes - echo - echo "*** Warning! Library $i is needed by this library but I was not able to" - echo "*** make it link in! You will probably need to install it or some" - echo "*** library that it depends on before this library will be fully" - echo "*** functional. Installing it before continuing would be even better." + $echo + $echo "*** Warning! Library $i is needed by this library but I was not able to" + $echo "*** make it link in! You will probably need to install it or some" + $echo "*** library that it depends on before this library will be fully" + $echo "*** functional. Installing it before continuing would be even better." fi else newdeplibs="$newdeplibs $i" @@ -2620,11 +3253,20 @@ EOF for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do + if test "$name" != "" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then @@ -2645,26 +3287,27 @@ EOF done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ - | egrep "$file_magic_regex" > /dev/null; then + | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi - done - done + done + done + fi if test -n "$a_deplib" ; then droppeddeps=yes - echo - echo "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - echo "*** with $libname but no candidates were found. (...for file magic test)" + $echo "*** with $libname but no candidates were found. (...for file magic test)" else - echo "*** with $libname and none of the candidates passed a file format test" - echo "*** using a file magic. Last file checked: $potlib" + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" fi fi else @@ -2680,33 +3323,43 @@ EOF name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check below in file_magic test - if eval echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | egrep "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done done - done + fi if test -n "$a_deplib" ; then droppeddeps=yes - echo - echo "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - echo "*** with $libname but no candidates were found. (...for regex pattern test)" + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else - echo "*** with $libname and none of the candidates passed a file format test" - echo "*** using a regex pattern. Last file checked: $potlib" + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else @@ -2717,16 +3370,23 @@ EOF ;; none | unknown | *) newdeplibs="" - if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | - grep . >/dev/null; then - echo + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." + $echo "*** Warning: inter-library dependencies are not supported in this platform." else - echo "*** Warning: inter-library dependencies are not known to be supported." + $echo "*** Warning: inter-library dependencies are not known to be supported." fi - echo "*** All declared inter-library dependencies are being dropped." + $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; @@ -2746,17 +3406,17 @@ EOF if test "$droppeddeps" = yes; then if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - echo "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -2766,16 +3426,16 @@ EOF build_libtool_libs=no fi else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." - if test $allow_undefined = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -2797,7 +3457,7 @@ EOF # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then - if test $hardcode_into_libs = yes; then + if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= @@ -2833,7 +3493,11 @@ EOF if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" - eval dep_rpath=\"$hardcode_libdir_flag_spec\" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. @@ -2853,6 +3517,7 @@ EOF fi # Get the real and link names of the library. + eval shared_ext=\"$shrext\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" @@ -2863,7 +3528,9 @@ EOF else soname="$realname" fi - test -z "$dlname" && dlname=$soname + if test -z "$dlname"; then + dlname=$soname + fi lib="$output_objdir/$realname" for link @@ -2871,23 +3538,6 @@ EOF linknames="$linknames $link" done - # Ensure that we have .o objects for linkers which dislike .lo - # (e.g. aix) in case we are running --disable-static - for obj in $libobjs; do - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - if test ! -f $xdir/$oldobj; then - $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" - $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? - fi - done - # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -2901,13 +3551,21 @@ EOF save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then - $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi @@ -2918,17 +3576,29 @@ EOF $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" status=$? - if test $status -ne 0 && test ! -d "$gentop"; then + if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" @@ -2944,16 +3614,42 @@ EOF $show "${rm}r $xdir" $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" status=$? - if test $status -ne 0 && test ! -d "$xdir"; then + if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi - libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done fi fi @@ -2969,21 +3665,130 @@ EOF fi # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval cmds=\"$module_expsym_cmds\" + else + eval cmds=\"$module_cmds\" + fi + else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval cmds=\"$archive_expsym_cmds\" else - save_deplibs="$deplibs" - for conv in $convenience; do - tmp_deplibs= - for test_deplib in $deplibs; do - if test "$test_deplib" != "$conv"; then - tmp_deplibs="$tmp_deplibs $test_deplib" - fi - done - deplibs="$tmp_deplibs" - done eval cmds=\"$archive_cmds\" - deplibs="$save_deplibs" + fi + fi + + if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$save_output-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$save_output-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$save_output-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadale object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do @@ -3075,10 +3880,10 @@ EOF gentop="$output_objdir/${obj}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" status=$? - if test $status -ne 0 && test ! -d "$gentop"; then + if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" @@ -3094,16 +3899,42 @@ EOF $show "${rm}r $xdir" $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" status=$? - if test $status -ne 0 && test ! -d "$xdir"; then + if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi - reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done fi fi @@ -3139,8 +3970,8 @@ EOF # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. - $show "echo timestamp > $libobj" - $run eval "echo timestamp > $libobj" || exit $? + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? exit 0 fi @@ -3156,20 +3987,6 @@ EOF $run eval "$cmd" || exit $? done IFS="$save_ifs" - else - # Just create a symlink. - $show $rm $libobj - $run $rm $libobj - xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$libobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - $show "(cd $xdir && $LN_S $oldobj $baseobj)" - $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then @@ -3182,7 +3999,7 @@ EOF prog) case $host in - *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 @@ -3204,16 +4021,19 @@ EOF # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - ;; - esac ;; esac + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -3364,12 +4184,12 @@ extern \"C\" { done if test -n "$exclude_expsyms"; then - $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then - $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi @@ -3387,8 +4207,8 @@ extern \"C\" { for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" - name=`echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval 'echo ": $name " >> "$nlist"' + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done @@ -3397,7 +4217,7 @@ extern \"C\" { test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then - egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi @@ -3417,7 +4237,7 @@ extern \"C\" { if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else - echo '/* NONE */' >> "$output_objdir/$dlsyms" + $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ @@ -3469,18 +4289,18 @@ static const void *lt_preloaded_setup() { *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC";; + *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" @@ -3505,7 +4325,7 @@ static const void *lt_preloaded_setup() { finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi - if test $need_relink = no || test "$build_libtool_libs" != yes; then + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" @@ -3650,13 +4470,228 @@ static const void *lt_preloaded_setup() { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in - *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in - *cygwin*) exeext=.exe ;; + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac + case $host in + *cygwin* | *mingw* ) + cwrappersource=`$echo ${objdir}/lt-${output}.c` + cwrapper=`$echo ${output}.exe` + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +#define DIR_SEPARATOR '/' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +#define HAVE_DOS_BASED_FILE_SYSTEM +#ifndef DIR_SEPARATOR_2 +#define DIR_SEPARATOR_2 '\\' +#endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +char * basename (const char *name); +char * fnqualify(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup ((char *) basename (argv[0])); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = fnqualify(argv[0]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +char * +basename (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha (name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return (char *) base; +} + +char * +fnqualify(const char *path) +{ + size_t size; + char *p; + char tmp[LT_PATHMAX + 1]; + + assert(path != NULL); + + /* Is it qualified already? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha (path[0]) && path[1] == ':') + return xstrdup (path); +#endif + if (IS_DIR_SEPARATOR (path[0])) + return xstrdup (path); + + /* prepend the current directory */ + /* doesn't handle '~' */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ + p = XMALLOC(char, size); + sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); + return p; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC -s -o $cwrapper $cwrappersource + ;; + esac $rm $output trap "$rm $output; exit 1" 1 2 15 @@ -3674,7 +4709,7 @@ static const void *lt_preloaded_setup() { # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' +Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout @@ -3734,7 +4769,7 @@ else " if test "$fast_install" = yes; then - echo >> $output "\ + $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" @@ -3750,7 +4785,7 @@ else $rm \"\$progdir/\$file\" fi" - echo >> $output "\ + $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then @@ -3768,13 +4803,13 @@ else $rm \"\$progdir/\$file\" fi" else - echo >> $output "\ + $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi - echo >> $output "\ + $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" @@ -3785,7 +4820,7 @@ else $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 ${SED} + # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var @@ -3805,14 +4840,6 @@ else # Run the actual program with our arguments. " case $host in - # win32 systems need to use the prog path for dll - # lookup to work - *-*-cygwin* | *-*-pw32*) - $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} -" - ;; - # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ @@ -3822,11 +4849,7 @@ else *) $echo >> $output "\ - # Export the path to the program. - PATH=\"\$progdir:\$PATH\" - export PATH - - exec \$program \${1+\"\$@\"} + exec \$progdir/\$program \${1+\"\$@\"} " ;; esac @@ -3838,7 +4861,7 @@ else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 - echo \"See the $PACKAGE documentation for more information.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ @@ -3861,7 +4884,7 @@ fi\ oldobjs="$libobjs_save" build_libtool_libs=no else - oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi @@ -3870,10 +4893,10 @@ fi\ gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" status=$? - if test $status -ne 0 && test ! -d "$gentop"; then + if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" @@ -3890,14 +4913,40 @@ fi\ $show "${rm}r $xdir" $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" status=$? - if test $status -ne 0 && test ! -d "$xdir"; then + if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` done @@ -3907,25 +4956,65 @@ fi\ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then eval cmds=\"$old_archive_from_new_cmds\" else - # Ensure that we have .o objects in place in case we decided - # not to build a shared library, and have fallen back to building - # static libs even though --disable-static was passed! - for oldobj in $oldobjs; do - if test ! -f $oldobj; then - xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$oldobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` - obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` - $show "(cd $xdir && ${LN_S} $obj $baseobj)" - $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? - fi - done - eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~$old_archive_cmds\" + fi + fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do @@ -4015,7 +5104,7 @@ fi\ # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file @@ -4044,13 +5133,16 @@ revision=$revision # Is this an already installed library? installed=$installed +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" - if test "$installed" = no && test $need_relink = yes; then + if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi @@ -4186,7 +5278,7 @@ relink_command=\"$relink_command\"" # Not a directory, so check to see that there is only one file specified. set dummy $files - if test $# -gt 2; then + if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit 1 @@ -4226,7 +5318,7 @@ relink_command=\"$relink_command\"" *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 @@ -4262,11 +5354,14 @@ relink_command=\"$relink_command\"" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit 1 @@ -4274,9 +5369,9 @@ relink_command=\"$relink_command\"" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 @@ -4306,7 +5401,7 @@ relink_command=\"$relink_command\"" $run eval "$striplib $destdir/$realname" || exit $? fi - if test $# -gt 0; then + if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do @@ -4392,23 +5487,43 @@ relink_command=\"$relink_command\"" destfile="$destdir/$destfile" fi + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) - wrapper=`echo $file | ${SED} -e 's,.exe$,,'` + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac - if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac # If there is no directory component, then add one. case $file in - */* | *\\*) . $wrapper ;; - *) . ./$wrapper ;; + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. @@ -4436,10 +5551,17 @@ relink_command=\"$relink_command\"" done relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac # If there is no directory component, then add one. case $file in - */* | *\\*) . $wrapper ;; - *) . ./$wrapper ;; + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; esac outputname= @@ -4447,19 +5569,14 @@ relink_command=\"$relink_command\"" if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir_mktemp=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` - if test $? = 0 ; then - tmpdir="$tmpdir_mktemp" - unset tmpdir_mktemp - else - tmpdir="$tmpdir/libtool-$$" - fi + tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` || + tmpdir="$tmpdir/libtool-$$" if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : else $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi - file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` @@ -4477,14 +5594,14 @@ relink_command=\"$relink_command\"" fi else # Install the binary that we compiled earlier. - file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in - /usr/bin/install*,*cygwin*) + */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok @@ -4493,7 +5610,7 @@ relink_command=\"$relink_command\"" destfile=$destfile.exe ;; *:*.exe) - destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; @@ -4578,42 +5695,42 @@ relink_command=\"$relink_command\"" fi # Exit here if they wanted silent mode. - test "$show" = ":" && exit 0 + test "$show" = : && exit 0 - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" + $echo "----------------------------------------------------------------------" + $echo "Libraries have been installed in:" for libdir in $libdirs; do - echo " $libdir" + $echo " $libdir" done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" fi if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" - echo " - use the \`$flag' linker flag" + $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then - echo " - have your system administrator run these commands:$admincmds" + $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi - echo - echo "See any operating system documentation about shared libraries for" - echo "more information, such as the ld(1) and ld.so(8) manual pages." - echo "----------------------------------------------------------------------" + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "----------------------------------------------------------------------" exit 0 ;; @@ -4641,7 +5758,7 @@ relink_command=\"$relink_command\"" case $file in *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 @@ -4712,7 +5829,7 @@ relink_command=\"$relink_command\"" -*) ;; *) # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; @@ -4735,7 +5852,7 @@ relink_command=\"$relink_command\"" eval "export $shlibpath_var" fi - # Restore saved enviroment variables + # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi @@ -4744,14 +5861,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" + exec_cmd="\"\$cmd\"$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - $echo "$cmd$args" + eval \$echo \"\$cmd\"$args exit 0 fi ;; @@ -4785,19 +5902,20 @@ relink_command=\"$relink_command\"" rmdirs= + origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. - objdir="$objdir" + objdir="$origobjdir" else - objdir="$dir/$objdir" + objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test $mode = uninstall && objdir="$dir" + test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates - if test $mode = clean; then + if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; @@ -4821,7 +5939,7 @@ relink_command=\"$relink_command\"" case $name in *.la) # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. @@ -4829,9 +5947,9 @@ relink_command=\"$relink_command\"" rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - if test $mode = uninstall; then + if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. eval cmds=\"$postuninstall_cmds\" @@ -4840,7 +5958,7 @@ relink_command=\"$relink_command\"" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" - if test $? != 0 && test "$rmforce" != yes; then + if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -4855,7 +5973,7 @@ relink_command=\"$relink_command\"" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" - if test $? != 0 && test "$rmforce" != yes; then + if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -4867,22 +5985,52 @@ relink_command=\"$relink_command\"" ;; *.lo) - if test "$build_old_libs" = yes; then - oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` - rmfiles="$rmfiles $dir/$oldobj" + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi fi ;; *) - # Do a test to see if this is a libtool program. - if test $mode = clean && - (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$file + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi fi fi ;; @@ -4890,6 +6038,7 @@ relink_command=\"$relink_command\"" $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done + objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -4937,6 +6086,7 @@ Provide generalized library-building support services. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: @@ -4950,7 +6100,9 @@ MODE must be one of the following: uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE." +a more detailed description of MODE. + +Report bugs to ." exit 0 ;; @@ -5062,6 +6214,7 @@ The following components of LINK-COMMAND are treated specially: -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries @@ -5107,11 +6260,31 @@ Otherwise, only FILE itself is deleted using RM." ;; esac -echo +$echo $echo "Try \`$modename --help' for more information about other modes." exit 0 +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + # Local Variables: # mode:shell-script # sh-indentation:2 From 3921f01f2eacf3c929e640ddff7f60db117d7f7c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 Jan 2004 09:53:57 +0000 Subject: [PATCH 0957/2994] Updates for latest libtool and 1.8.4 release. BKrev: 4014e3b5i190HbH6WLsoG7N0CeBSQA From 0dc21e3d77d32f6d295571c3ca63cb0b13deae32 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 Jan 2004 10:19:35 +0000 Subject: [PATCH 0958/2994] Start 1.8.5-WIP. (Logical change 1.274) --- ChangeLog | 3 +++ configure | 20 ++++++++++---------- configure.ac | 2 +- ntfsprogs/Makefile.in | 4 ++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5631396..f9dc4f63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +xx/xx/2004 - 1.8.5 - WIP + - . + 23/01/2004 - 1.8.4 - Memory leak fixes. - Fix memory leaks in libntfs/dir.c::ntfs_inode_lookup_by_name(), libntfs/dir.c::ntfs_readdir() and libntfs/attrib.c::ntfs_attr_open(). diff --git a/configure b/configure index 28c7a2be..8eda0240 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.4. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.5-WIP. # # Report bugs to . # @@ -422,8 +422,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.4' -PACKAGE_STRING='ntfsprogs 1.8.4' +PACKAGE_VERSION='1.8.5-WIP' +PACKAGE_STRING='ntfsprogs 1.8.5-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -954,7 +954,7 @@ 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 ntfsprogs 1.8.4 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.5-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1021,7 +1021,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.4:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.5-WIP:";; esac cat <<\_ACEOF @@ -1132,7 +1132,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.4 +ntfsprogs configure 1.8.5-WIP generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1147,7 +1147,7 @@ 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 ntfsprogs $as_me 1.8.4, which was +It was created by ntfsprogs $as_me 1.8.5-WIP, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1841,7 +1841,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.8.4' + VERSION='1.8.5-WIP' cat >>confdefs.h <<_ACEOF @@ -21572,7 +21572,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.4, which was +This file was extended by ntfsprogs $as_me 1.8.5-WIP, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21635,7 +21635,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.4 +ntfsprogs config.status 1.8.5-WIP configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 7e3255ae..3cf51d48 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.4, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.5-WIP, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 7604c942..c8f05bf1 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_TRUE@AM_LFLAGS = -static @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From 613bd563d270f4d6d9d98e2af4f9cb616550dacd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 26 Jan 2004 10:19:35 +0000 Subject: [PATCH 0959/2994] Start 1.8.5-WIP. BKrev: 4014e9b7riK7Am3U9sPq0y5I0L0fqA From 8a6020472c0dd3ea283dd4367e94a80d6f954df2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 29 Jan 2004 23:16:07 +0000 Subject: [PATCH 0960/2994] update TODO.libntfs; several points have been implemented already! (-: (Logical change 1.275) --- TODO.libntfs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/TODO.libntfs b/TODO.libntfs index 9e67e62c..50f96cb8 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -18,6 +18,9 @@ - write ntfs_mft_record_allocate() (see ntfs 2.4 driver in CVS) +- extend ntfs_attr_pwrite to cope with extending the attribute size and with + instantiating holes + ******************* * MEDIUM priority * ******************* @@ -27,9 +30,6 @@ - add write of compressed attributes -- extend ntfs_attr_pwrite to cope with extending the attribute size and with - instantiating holes - - write ntfs_attr_{rm,create,add}() - write ntfs_index_{rm_from,add_to,create,rm}() @@ -42,13 +42,11 @@ - write API for conventional high level file access. -- implement loads of utilities a-la ntcp, ntrm, ntcreat, ntdir, etc... +- implement loads of utilities a-la ntcp, ntrm, ntcreat, etc... - implement a ntfs shell where can use the above much faster with caching, probably extending the library in the process -- extend attrib API with ntfs_rl_pread() - **************** * LOW priority * **************** From 315c5d150d2ed5439139c59b567c5ab56665b3cd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 29 Jan 2004 23:16:07 +0000 Subject: [PATCH 0961/2994] update TODO.libntfs; several points have been implemented already! (-: BKrev: 401994376dZqMgrANWGWZCFvPileuQ From 5fd2457c548a64598bb68d3a371f1b09ebaa0a99 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 5 Feb 2004 16:51:10 +0000 Subject: [PATCH 0962/2994] Fixup ntfsinfo a little bit and give its manpage a small update to reflect reality a little better. (Logical change 1.276) --- ChangeLog | 3 ++- ntfsprogs/ntfsinfo.8.in | 7 ++--- ntfsprogs/ntfsinfo.c | 58 +++++++++++++++++++++++------------------ 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9dc4f63..efadc00c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ xx/xx/2004 - 1.8.5 - WIP - - . + - Fixup ntfsinfo a little bit and give its manpage a small update to + reflect reality a little better. 23/01/2004 - 1.8.4 - Memory leak fixes. - Fix memory leaks in libntfs/dir.c::ntfs_inode_lookup_by_name(), diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index 5978d71e..cdb227dd 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -2,17 +2,18 @@ .\" Copyright (c) 2002-2004 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSINFO 8 "May 2002" "Linux-NTFS version @VERSION@" +.TH NTFSINFO 8 "Feb 2004" "Linux-NTFS version @VERSION@" .SH NAME ntfsinfo \- dump a file's attributes .SH SYNOPSIS .B ntfsinfo -.I device -.I inode-number +.I -d device +.I -i inode-number .SH DESCRIPTION .B ntfsinfo will dump the attributes of inode .IR inode-number . +Run ntfsinfo without arguments for a full list of options. .PP .SH AUTHOR .B ntfsinfo diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 449779bb..d5fda02c 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -87,7 +87,7 @@ void version (void) EXEC_NAME, VERSION); printf ("Copyright (c)\n"); printf (" 2002-2004 Matthew J. Fanto\n"); - printf (" 2002 Anton Altaparmakov\n"); + printf (" 2002-2004 Anton Altaparmakov\n"); printf (" 2002-2003 Richard Russon\n"); printf (" 2003 Leonard Norrgĺrd\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); @@ -105,7 +105,7 @@ void usage (void) printf ("\nUsage: %s [options] -d dev\n" " -d dev --device dev The ntfs volume to display information about\n" " -i num --inode num Display information about this inode\n" - " -m --mft Dump information about the volume\n" + " -m --mft Dump information about the volume\n" " -t --epochtime Report all timestamps as \"Thu Jan 1 00:00:00 1970\"\n" " -T --notime Don't report timestamps at all\n" "\n" @@ -129,7 +129,7 @@ void usage (void) */ int parse_options (int argc, char *argv[]) { - static const char *sopt = "-fh?i:qtTvVd:"; + static const char *sopt = "-fh?i:mqtTvVd:"; static const struct option lopt[] = { { "device", required_argument, NULL, 'd' }, { "force", no_argument, NULL, 'f' }, @@ -214,7 +214,7 @@ int parse_options (int argc, char *argv[]) err++; } - if (opts.inode == -1) { + if (opts.inode == -1 && !opts.mft) { if (argc > 1) Eprintf ("You much specify an inode to learn about.\n"); err++; @@ -317,7 +317,8 @@ void ntfs_dump_standard_information_attr(ntfs_inode *inode) ctx = ntfs_attr_get_search_ctx(inode, NULL); if(ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_STANDARD_INFORMATION!\n"); + if (errno != ENOENT) + fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_STANDARD_INFORMATION!\n"); ntfs_attr_put_search_ctx(ctx); //free ctx return; } @@ -365,9 +366,10 @@ void ntfs_dump_file_name_attr(ntfs_inode *inode) char *file_name = NULL; ctx = ntfs_attr_get_search_ctx(inode, NULL); - +do_next: if(ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - fprintf(stderr, "ntfsinfo error: cannot lookup attribute AT_FILE_NAME!\n"); + if (errno != ENOENT) + fprintf(stderr, "ntfsinfo error: cannot lookup attribute AT_FILE_NAME!\n"); ntfs_attr_put_search_ctx(ctx); //free ctx return; } @@ -414,8 +416,8 @@ void ntfs_dump_file_name_attr(ntfs_inode *inode) } free(file_name); - ntfs_attr_put_search_ctx(ctx); //free ctx - + file_name = NULL; + goto do_next; } @@ -434,12 +436,14 @@ void ntfs_dump_object_id_attr(ntfs_inode *inode) ctx = ntfs_attr_get_search_ctx(inode, NULL); - if(ntfs_attr_lookup(AT_OBJECT_ID, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_OBJECT_ID: %s\n", - strerror(errno)); - ntfs_attr_put_search_ctx(ctx); - return; - } + if(ntfs_attr_lookup(AT_OBJECT_ID, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (errno != ENOENT) + fprintf(stderr, "ntfsinfo error: cannot look up " + "attribute AT_OBJECT_ID: %s\n", + strerror(errno)); + ntfs_attr_put_search_ctx(ctx); + return; + } attr = ctx->attr; @@ -483,7 +487,8 @@ void ntfs_dump_volume_name_attr(ntfs_inode *inode) ctx = ntfs_attr_get_search_ctx(inode, NULL); if(ntfs_attr_lookup(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_VOLUME_NAME: %s\n", + if (errno != ENOENT) + fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_VOLUME_NAME: %s\n", strerror(errno)); ntfs_attr_put_search_ctx(ctx); return; @@ -516,7 +521,8 @@ void ntfs_dump_volume_information_attr(ntfs_inode *inode) ctx = ntfs_attr_get_search_ctx(inode, NULL); if(ntfs_attr_lookup(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_VOLUME_INFORMATION: %s\n", + if (errno != ENOENT) + fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_VOLUME_INFORMATION: %s\n", strerror(errno)); ntfs_attr_put_search_ctx(ctx); return; @@ -540,20 +546,13 @@ void ntfs_dump_volume_information_attr(ntfs_inode *inode) /** * ntfs_get_file_attributes */ -void ntfs_get_file_attributes(ntfs_volume *vol, s64 mft_no, int dump_volume) +void ntfs_get_file_attributes(ntfs_volume *vol, s64 mft_no) { ntfs_inode *inode = NULL; //int error; inode = ntfs_inode_open(vol, MK_MREF(mft_no, 0)); - /* if opts.mft is not 0, then we will print out information about - * the volume, such as the sector size and whatnot. - */ -// if (dump_volume) - ntfs_dump_volume(vol); - - //see flatcap.org/ntfs/info for what formatting should look likei //FIXME: both $FILE_NAME_ATTR and $STANDARD_INFORMATION has times, when do //we want to output it? @@ -587,7 +586,14 @@ int main(int argc, char **argv) if (!vol) return 1; - ntfs_get_file_attributes (vol, opts.inode, opts.mft); + /* if opts.mft is not 0, then we will print out information about + * the volume, such as the sector size and whatnot. + */ + if (opts.mft) + ntfs_dump_volume(vol); + + if (opts.inode != -1) + ntfs_get_file_attributes(vol, opts.inode); ntfs_umount (vol, FALSE); return 0; From 9a18a4a5ed707e9c09975c5739ad28de0a6dfff9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 5 Feb 2004 16:51:10 +0000 Subject: [PATCH 0963/2994] Fixup ntfsinfo a little bit and give its manpage a small update to reflect reality a little better. BKrev: 4022747ejCBjdMGlBS2n9jruCpQSLQ From 46f0709d290b5081ab58d7a8ec44fe2f43cd885b Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Tue, 17 Feb 2004 03:40:22 +0000 Subject: [PATCH 0964/2994] BLKGETSIZE ioctl uses unsigned long, not long for the size parameter. Thus the maximum supported device is 2 TB on 32 bit platforms instead of only 1 TB. (Logical change 1.277) --- ntfsprogs/ntfsclone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 4adfc036..6e979004 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -903,7 +903,7 @@ static s64 device_size_get(int fd) { s64 high, low; #ifdef BLKGETSIZE - long size; + unsigned long size; if (ioctl(fd, BLKGETSIZE, &size) >= 0) { Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, From 7e89018759e1f337c564633bab623534218344f3 Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Tue, 17 Feb 2004 03:40:22 +0000 Subject: [PATCH 0965/2994] BLKGETSIZE ioctl uses unsigned long, not long for the size parameter. Thus the maximum supported device is 2 TB on 32 bit platforms instead of only 1 TB. BKrev: 40318d26G8SNg1gN6OC0_Rlo6FFULg From 5f20b21ef812f744076b76f4dd142c3cfef50667 Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Tue, 17 Feb 2004 03:40:22 +0000 Subject: [PATCH 0966/2994] BLKGETSIZE ioctl uses unsigned long, not long for the size parameter. Thus the maximum supported device is 2 TB on 32 bit platforms instead of only 1 TB. (Logical change 1.277) --- libntfs/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/device.c b/libntfs/device.c index 9ba4b6f2..4d192e1c 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -454,7 +454,7 @@ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) { s64 high, low; #ifdef BLKGETSIZE - long size; + unsigned long size; if (dev->d_ops->ioctl(dev, BLKGETSIZE, &size) >= 0) { Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, From a033e9dfa006276a8a5d9533f874e47208d02f95 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 17 Feb 2004 14:01:22 +0000 Subject: [PATCH 0967/2994] Add use of BLKGETSIZE64 and fix typos in debug output. (Logical change 1.278) --- libntfs/device.c | 31 +++++++++++++++++++++++-------- ntfsprogs/ntfsclone.c | 26 +++++++++++++++++++------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/libntfs/device.c b/libntfs/device.c index 4d192e1c..229e8bbb 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -40,7 +40,10 @@ #include "device.h" #if defined(linux) && defined(_IO) && !defined(BLKGETSIZE) -# define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ +#define BLKGETSIZE _IO(0x12,96) /* Get device size in 512-byte blocks. */ +#endif +#if defined(linux) && defined(_IOR) && !defined(BLKGETSIZE64) +#define BLKGETSIZE64 _IOR(0x12,114,sizeof(u64)) /* Get device size in bytes. */ #endif /** @@ -453,20 +456,32 @@ static inline int ntfs_device_offset_valid(struct ntfs_device *dev, s64 ofs) s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) { s64 high, low; -#ifdef BLKGETSIZE - unsigned long size; +#ifdef BLKGETSIZE64 + { u64 size; - if (dev->d_ops->ioctl(dev, BLKGETSIZE, &size) >= 0) { - Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, - size); - return (s64)size * 512 / block_size; + if (dev->d_ops->ioctl(dev, BLKGETSIZE64, &size) >= 0) { + Dprintf("BLKGETSIZE64 nr bytes = %llu (0x%llx)\n", + (unsigned long long)size, + (unsigned long long)size); + return (s64)size / block_size; + } + } +#endif +#ifdef BLKGETSIZE + { unsigned long size; + + if (dev->d_ops->ioctl(dev, BLKGETSIZE, &size) >= 0) { + Dprintf("BLKGETSIZE nr 512 byte blocks = %lu " + "(0x%lx)\n", size, size); + return (s64)size * 512 / block_size; + } } #endif #ifdef FDGETPRM { struct floppy_struct this_floppy; if (dev->d_ops->ioctl(dev, FDGETPRM, &this_floppy) >= 0) { - Dprintf("FDGETPRM nr 512 byte blocks = %ld (0x%ld)\n", + Dprintf("FDGETPRM nr 512 byte blocks = %lu (0x%lx)\n", this_floppy.size, this_floppy.size); return (s64)this_floppy.size * 512 / block_size; } diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 6e979004..e9179fcb 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -902,20 +902,32 @@ static int device_offset_valid(int fd, s64 ofs) static s64 device_size_get(int fd) { s64 high, low; -#ifdef BLKGETSIZE - unsigned long size; +#ifdef BLKGETSIZE64 + { u64 size; - if (ioctl(fd, BLKGETSIZE, &size) >= 0) { - Dprintf("BLKGETSIZE nr 512 byte blocks = %ld (0x%ld)\n", size, - size); - return (s64)size * 512; + if (ioctl(fd, BLKGETSIZE64, &size) >= 0) { + Dprintf("BLKGETSIZE64 nr bytes = %llu (0x%llx)\n", + (unsigned long long)size, + (unsigned long long)size); + return (s64)size / block_size; + } + } +#endif +#ifdef BLKGETSIZE + { unsigned long size; + + if (ioctl(fd, BLKGETSIZE, &size) >= 0) { + Dprintf("BLKGETSIZE nr 512 byte blocks = %lu " + "(0x%lx)\n", size, size); + return (s64)size * 512; + } } #endif #ifdef FDGETPRM { struct floppy_struct this_floppy; if (ioctl(fd, FDGETPRM, &this_floppy) >= 0) { - Dprintf("FDGETPRM nr 512 byte blocks = %ld (0x%ld)\n", + Dprintf("FDGETPRM nr 512 byte blocks = %lu (0x%lx)\n", this_floppy.size, this_floppy.size); return (s64)this_floppy.size * 512; } From d4f756e709ae2ce75a0ed23c2d1140981e0887ee Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 17 Feb 2004 14:01:22 +0000 Subject: [PATCH 0968/2994] Add use of BLKGETSIZE64 and fix typos in debug output. BKrev: 40321eb2dA-eXMZxm2jGslXWDl2o0Q From 3be519245cc166bbf24c651d0e068f08b4b9e892 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 17 Feb 2004 14:01:22 +0000 Subject: [PATCH 0969/2994] Update (Logical change 1.278) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index efadc00c..8c877534 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ xx/xx/2004 - 1.8.5 - WIP - Fixup ntfsinfo a little bit and give its manpage a small update to reflect reality a little better. + - Fix BLKGETSIZE usage; parameter is unsigned long not long. (Szaka) + - Use BLKGETSIZE64 when available which allows use of devices bigger + than 2TiB. 23/01/2004 - 1.8.4 - Memory leak fixes. - Fix memory leaks in libntfs/dir.c::ntfs_inode_lookup_by_name(), From 31045b8034b3cae44bc3d57e952cc26c11d2c655 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 20 Feb 2004 14:44:16 +0000 Subject: [PATCH 0970/2994] - Enable GNU extensions on systems that have them. - Use AC_SYS_LARGEFILE instead of manually defining _FILE_OFFSET_BITS=64 in CFLAGS. - Include config.h before any other non-ntfs headers. BKrev: 40361d40VWmNboUAiybe3q0bFu-4oA From c0cfabf990b4b698f67f3945652909a7ff91695f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 20 Feb 2004 14:44:16 +0000 Subject: [PATCH 0971/2994] Enable GNU extensions on systems that have them. Use AC_SYS_LARGEFILE instead of manually defining _FILE_OFFSET_BITS=64 in CFLAGS. (Logical change 1.279) --- configure.ac | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 3cf51d48..54d2a6ca 100644 --- a/configure.ac +++ b/configure.ac @@ -60,6 +60,14 @@ AC_ARG_ENABLE(really-static, AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes) +# Enable GNU extensions on systems that have them. +AH_VERBATIM([_GNU_SOURCE], +[/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif]) +AC_DEFINE(_GNU_SOURCE) + # Checks for programs. AC_PROG_CC AC_PROG_INSTALL @@ -67,6 +75,9 @@ AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_LIBTOOL +# Enable large file support. +AC_SYS_LARGEFILE + AC_ARG_ENABLE(gnome-vfs, [ --disable-gnome-vfs Omit Gnome-VFS-2.0 'libntfs' interface (default=detect)], , enable_gnome_vfs=auto @@ -124,9 +135,8 @@ AC_MSG_RESULT($cc_version) # Add our compiler switches not discarding 'CFLAGS' as they may have been # passed to us by rpmbuild(8). -# We add -Wall to enable compiler warnings and define _FILE_OFFSET_BITS to 64 -# enable 64-bit (device) file access functions and parameters. -CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -Wall" +# We add -Wall to enable compiler warnings. +CFLAGS="$CFLAGS -Wall" # Add lots of extra warnings if in maintainer mode. if test "$USE_MAINTAINER_MODE" = "yes";then From 441947337e37c15ba232c74f43ee84217bc282df Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 20 Feb 2004 14:44:16 +0000 Subject: [PATCH 0972/2994] Include config.h before any other non-ntfs headers. (Logical change 1.279) --- include/compat.h | 4 +++- include/device.h | 2 ++ include/device_io.h | 46 ++++++++++++++++++++++++++++++++++++ include/endians.h | 2 ++ include/gnome-vfs-method.h | 4 +++- include/gnome-vfs-module.h | 40 +++++++++++++++++++++++++++++++ include/support.h | 4 +++- libntfs/attrib.c | 2 ++ libntfs/bitmap.c | 4 +++- libntfs/bootsect.c | 4 +++- libntfs/compat.c | 4 +++- libntfs/compress.c | 2 ++ libntfs/debug.c | 4 +++- libntfs/dir.c | 4 +++- libntfs/inode.c | 4 +++- libntfs/lcnalloc.c | 4 +++- libntfs/mft.c | 4 +++- libntfs/mst.c | 4 +++- libntfs/runlist.c | 4 +++- libntfs/unistr.c | 2 ++ libntfs/volume.c | 4 +++- libntfs/win32_io.c | 3 +++ ntfsprogs/dumplog.c | 4 +++- ntfsprogs/ntfsdump_logfile.c | 4 +++- ntfsprogs/upcase.c | 4 +++- ntfsprogs/utils.c | 4 +++- ntfsprogs/utils.h | 3 +++ 27 files changed, 156 insertions(+), 18 deletions(-) diff --git a/include/compat.h b/include/compat.h index 81be6ef0..866f6ae7 100644 --- a/include/compat.h +++ b/include/compat.h @@ -2,7 +2,7 @@ * compat.h - Tweaks for Windows compatability. * * Copyright (c) 2002 Richard Russon - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -23,6 +23,8 @@ #ifndef _NTFS_COMPAT_H #define _NTFS_COMPAT_H +#include "config.h" + #ifdef WINDOWS #ifndef HAVE_FFS diff --git a/include/device.h b/include/device.h index b5884d03..c9490cd9 100644 --- a/include/device.h +++ b/include/device.h @@ -22,6 +22,8 @@ #ifndef _NTFS_DEVICE_H #define _NTFS_DEVICE_H +#include "config.h" + #include #include "device_io.h" diff --git a/include/device_io.h b/include/device_io.h index e69de29b..03e03849 100644 --- a/include/device_io.h +++ b/include/device_io.h @@ -0,0 +1,46 @@ +/* + * device_io.h - Exports for default device io. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_DEVICE_IO_H +#define _NTFS_DEVICE_IO_H + +#include "config.h" + +#ifndef __CYGWIN32__ + +/* Not on Cygwin; use standard Unix style low level device operations. */ +#define ntfs_device_default_io_ops ntfs_device_unix_io_ops + +#else /* __CYGWIN32__ */ + +/* On Cygwin; use Win32 low level device operations. */ +#define ntfs_device_default_io_ops ntfs_device_win32_io_ops + +#endif /* __CYGWIN32__ */ + + +/* Forward declaration. */ +struct ntfs_device_operations; + +extern struct ntfs_device_operations ntfs_device_default_io_ops; + +#endif /* defined _NTFS_DEVICE_IO_H */ + diff --git a/include/endians.h b/include/endians.h index 8debf61c..75f464d1 100644 --- a/include/endians.h +++ b/include/endians.h @@ -23,6 +23,8 @@ #ifndef _NTFS_ENDIANS_H #define _NTFS_ENDIANS_H +#include "config.h" + /* * Notes: * diff --git a/include/gnome-vfs-method.h b/include/gnome-vfs-method.h index 2a3f4ec3..ca7cb87a 100644 --- a/include/gnome-vfs-method.h +++ b/include/gnome-vfs-method.h @@ -3,7 +3,7 @@ * interface to libntfs. Par of the Linux-NTFS project. * * Copyright (c) 2002-2003 Jan Kratochvil - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -24,6 +24,8 @@ #ifndef _NTFS_GNOME_VFS_METHOD_H #define _NTFS_GNOME_VFS_METHOD_H +#include "config.h" + #include G_BEGIN_DECLS diff --git a/include/gnome-vfs-module.h b/include/gnome-vfs-module.h index e69de29b..7de4665c 100644 --- a/include/gnome-vfs-module.h +++ b/include/gnome-vfs-module.h @@ -0,0 +1,40 @@ +/* + * gnome-vfs-module.h - Exports for Gnome-VFS init/shutdown implementation of + * interface to libntfs. Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Jan Kratochvil + * Copyright (c) 2000-2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_GNOME_VFS_MODULE_H +#define _NTFS_GNOME_VFS_MODULE_H + +#include "config.h" + +G_BEGIN_DECLS + +G_LOCK_EXTERN(libntfs); + +#define libntfs_newn(objp, n) ((objp) = g_new(typeof(*(objp)), (n))) +#define libntfs_new(objp) (libntfs_newn((objp), 1)) +#define LIBNTFS_MEMZERO(objp) (memset((objp), 0, sizeof(*(objp)))) + +G_END_DECLS + +#endif /* _NTFS_GNOME_VFS_MODULE_H */ + diff --git a/include/support.h b/include/support.h index 181a79c9..3ddbb136 100644 --- a/include/support.h +++ b/include/support.h @@ -1,7 +1,7 @@ /* * support.h - Useful definitions and macros. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -22,6 +22,8 @@ #ifndef _NTFS_SUPPORT_H #define _NTFS_SUPPORT_H +#include "config.h" + #include /* diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 0c600a12..e63af89d 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -20,6 +20,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index f18fb52b..4d4af184 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -1,7 +1,7 @@ /* * bitmap.c - Bitmap handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002-2003 Anton Altaparmakov + * Copyright (c) 2002-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -19,6 +19,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index 1827f552..7d7aa0b0 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -1,7 +1,7 @@ /* * bootsect.c - Boot sector handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -19,6 +19,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/libntfs/compat.c b/libntfs/compat.c index c23616ff..8dd258d6 100644 --- a/libntfs/compat.c +++ b/libntfs/compat.c @@ -2,7 +2,7 @@ * compat.c - Tweaks for Windows compatability * * Copyright (c) 2002 Richard Russon - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -22,6 +22,8 @@ #ifdef WINDOWS +#include "config.h" + #include "compat.h" // TODO: Add check for FFS in the configure script... (AIA) diff --git a/libntfs/compress.c b/libntfs/compress.c index 27e1b1eb..7600f604 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -20,6 +20,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/libntfs/debug.c b/libntfs/debug.c index 8463ee93..dd4df2fa 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -1,7 +1,7 @@ /* * debug.c - Debugging output functions. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -19,6 +19,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include "debug.h" #ifdef DEBUG diff --git a/libntfs/dir.c b/libntfs/dir.c index 83897179..31796a8d 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1,7 +1,7 @@ /* * dir.c - Directory handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002-2003 Anton Altaparmakov + * Copyright (c) 2002-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -19,6 +19,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/libntfs/inode.c b/libntfs/inode.c index 99bb9a91..22755339 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -1,7 +1,7 @@ /* * inode.c - Inode handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -19,6 +19,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 6e3afeaf..f6ad5708 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -1,7 +1,7 @@ /* * lcnalloc.c - Cluster (de)allocation code. Part of the Linux-NTFS project. * - * Copyright (c) 2002-2003 Anton Altaparmakov + * Copyright (c) 2002-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -19,6 +19,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/libntfs/mft.c b/libntfs/mft.c index d338aaeb..31785b73 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -1,7 +1,7 @@ /* * mft.c - Mft record handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -19,6 +19,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/libntfs/mst.c b/libntfs/mst.c index 530b2722..8c539028 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -1,7 +1,7 @@ /* * mst.c - Multi sector fixup handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -19,6 +19,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include "mst.h" #include diff --git a/libntfs/runlist.c b/libntfs/runlist.c index b60c2890..63c1082d 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1,7 +1,7 @@ /* * runlist.c - Run list handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002-2003 Anton Altaparmakov + * Copyright (c) 2002-2004 Anton Altaparmakov * Copyright (c) 2002 Richard Russon * * This program/include file is free software; you can redistribute it and/or @@ -20,6 +20,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 2054a8b4..fcfcc4f8 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -19,6 +19,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/libntfs/volume.c b/libntfs/volume.c index 4e7e594a..afeb5802 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1,7 +1,7 @@ /* * volume.c - NTFS volume handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -19,6 +19,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 0f2ddae8..bfc7bf8c 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -21,6 +21,9 @@ * distribution in the file COPYING); if not, write to the Free Software * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "config.h" + #include #include diff --git a/ntfsprogs/dumplog.c b/ntfsprogs/dumplog.c index db4b4559..a97a2039 100644 --- a/ntfsprogs/dumplog.c +++ b/ntfsprogs/dumplog.c @@ -1,7 +1,7 @@ /** * DumpLog - Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This utility will interpret the contents of the journal ($LogFile) specified * on the command line and display the results on stdout. Errors will be output @@ -23,6 +23,8 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 276bd513..2315cb78 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -1,7 +1,7 @@ /** * NtfsDump_LogFile - Part of the Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This utility will interpret the contents of the journal ($LogFile) of an * NTFS partition and display the results on stdout. Errors will be output to @@ -38,6 +38,8 @@ * Anton Altaparmakov */ +#include "config.h" + #include #include #include diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c index 7d57dc7d..ea78d7c1 100644 --- a/ntfsprogs/upcase.c +++ b/ntfsprogs/upcase.c @@ -2,7 +2,7 @@ * upcase - Part of the Linux-NTFS project. * * Copyright (c) 2001 Richard Russon - * Copyright (c) 2001-2002 Anton Altaparmakov + * Copyright (c) 2001-2004 Anton Altaparmakov * * Modified for mkntfs inclusion 9 June 2001 by Anton Altaparmakov. * @@ -22,6 +22,8 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include "types.h" diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 7b60db58..4854ebfb 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -2,7 +2,7 @@ * utils.c - Part of the Linux-NTFS project. * * Copyright (c) 2002-2003 Richard Russon - * Copyright (c) 2003 Anton Altaparmakov + * Copyright (c) 2003-2004 Anton Altaparmakov * Copyright (c) 2003 Lode Leroy * * A set of shared functions for ntfs utilities @@ -23,6 +23,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index e4bbffbf..94a4bfb9 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -2,6 +2,7 @@ * utils.h - Part of the Linux-NTFS project. * * Copyright (c) 2002-2003 Richard Russon + * Copyright (c) 2004 Anton Altaparmakov * * A set of shared functions for ntfs utilities * @@ -24,6 +25,8 @@ #ifndef _NTFS_UTILS_H_ #define _NTFS_UTILS_H_ +#include "config.h" + #include "types.h" #include "layout.h" #include "volume.h" From 4fc6296c769aeac03e7606bef16a8b362da04167 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 20 Feb 2004 14:44:16 +0000 Subject: [PATCH 0973/2994] Update. (Logical change 1.279) --- ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8c877534..b6ce5dd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,13 @@ xx/xx/2004 - 1.8.5 - WIP - Fix BLKGETSIZE usage; parameter is unsigned long not long. (Szaka) - Use BLKGETSIZE64 when available which allows use of devices bigger than 2TiB. + - Enable GNU extensions if present. This means that you need to + include config.h before any other non-ntfs header files. + - Use AC_SYS_LARGEFILE in configure.ac instead of manually defining + _FILE_OFFSET_BITS=64 in CFLAGS. This means that you need to include + config.h before any other non-ntfs header files. + - Update all source to include config.h before any other non-ntfs + header files. 23/01/2004 - 1.8.4 - Memory leak fixes. - Fix memory leaks in libntfs/dir.c::ntfs_inode_lookup_by_name(), From 876c19e268c5b964fcbdcd007629980cb21a1e17 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 20 Feb 2004 14:44:16 +0000 Subject: [PATCH 0974/2994] update (Logical change 1.279) --- config.h.in | 11 ++ configure | 381 +++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 361 insertions(+), 31 deletions(-) diff --git a/config.h.in b/config.h.in index 0b323f13..637a2f6f 100644 --- a/config.h.in +++ b/config.h.in @@ -225,6 +225,17 @@ /* Version number of package */ #undef VERSION +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/configure b/configure index 8eda0240..9b40db5e 100755 --- a/configure +++ b/configure @@ -1041,6 +1041,7 @@ Optional Features: --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 --disable-gnome-vfs Omit Gnome-VFS-2.0 'libntfs' interface (default=detect) Optional Packages: @@ -2086,6 +2087,14 @@ else fi +# Enable GNU extensions on systems that have them. + + +cat >>confdefs.h <<\_ACEOF +#define _GNU_SOURCE 1 +_ACEOF + + # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3751,7 +3760,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3754 "configure"' > conftest.$ac_ext + echo '#line 3763 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5248,7 +5257,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5251:" \ +echo "$as_me:5260:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6253,11 +6262,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6256: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6265: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6260: \$? = $ac_status" >&5 + echo "$as_me:6269: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6485,11 +6494,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6488: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6497: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6492: \$? = $ac_status" >&5 + echo "$as_me:6501: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6552,11 +6561,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6555: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6564: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6559: \$? = $ac_status" >&5 + echo "$as_me:6568: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8571,7 +8580,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10813: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10808: \$? = $ac_status" >&5 + echo "$as_me:10817: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10868,11 +10877,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10871: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10880: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10875: \$? = $ac_status" >&5 + echo "$as_me:10884: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12118,7 +12127,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13050: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13045: \$? = $ac_status" >&5 + echo "$as_me:13054: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13105,11 +13114,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13108: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13117: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13112: \$? = $ac_status" >&5 + echo "$as_me:13121: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15052,11 +15061,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15055: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15064: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15059: \$? = $ac_status" >&5 + echo "$as_me:15068: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15284,11 +15293,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15287: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15296: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15291: \$? = $ac_status" >&5 + echo "$as_me:15300: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15351,11 +15360,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15354: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15363: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15358: \$? = $ac_status" >&5 + echo "$as_me:15367: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17370,7 +17379,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 +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 + ac_save_CC=$CC + while :; do + # 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 <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +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 + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext + CC="$CC -n32" + 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'; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +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 "$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 + while :; do + ac_cv_sys_file_offset_bits=no + 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 + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +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 + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +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. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +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; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + break +done +fi +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 <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF + +fi +rm -f conftest* + 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 + while :; do + ac_cv_sys_large_files=no + 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 + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +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 + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +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. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +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; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + break +done +fi +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 <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF + +fi +rm -f conftest* +fi + # Check whether --enable-gnome-vfs or --disable-gnome-vfs was given. if test "${enable_gnome_vfs+set}" = set; then @@ -18648,9 +18968,8 @@ echo "${ECHO_T}$cc_version" >&6 # Add our compiler switches not discarding 'CFLAGS' as they may have been # passed to us by rpmbuild(8). -# We add -Wall to enable compiler warnings and define _FILE_OFFSET_BITS to 64 -# enable 64-bit (device) file access functions and parameters. -CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -Wall" +# We add -Wall to enable compiler warnings. +CFLAGS="$CFLAGS -Wall" # Add lots of extra warnings if in maintainer mode. if test "$USE_MAINTAINER_MODE" = "yes";then From 44d6eb97048ffbd109bef96c80af4a946536677d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0975/2994] (Logical change 1.280) --- include/Makefile.am | 29 +----- include/Makefile.in | 210 +++++++++++++++++++++++++++----------------- 2 files changed, 131 insertions(+), 108 deletions(-) diff --git a/include/Makefile.am b/include/Makefile.am index a89a340d..88bf3dd5 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,28 +1 @@ - -linux_ntfsincludedir = $(includedir)/ntfs -linux_ntfsinclude_HEADERS = \ - attrib.h \ - bitmap.h \ - bootsect.h \ - compat.h \ - compress.h \ - debug.h \ - device.h \ - device_io.h \ - dir.h \ - endians.h \ - gnome-vfs-method.h \ - gnome-vfs-module.h \ - inode.h \ - layout.h \ - lcnalloc.h \ - list.h \ - logfile.h \ - mft.h \ - mst.h \ - runlist.h \ - support.h \ - types.h \ - unistr.h \ - volume.h - +SUBDIRS = ntfs diff --git a/include/Makefile.in b/include/Makefile.in index c055e2e3..b08add4a 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -146,44 +146,22 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ - -linux_ntfsincludedir = $(includedir)/ntfs -linux_ntfsinclude_HEADERS = \ - attrib.h \ - bitmap.h \ - bootsect.h \ - compat.h \ - compress.h \ - debug.h \ - device.h \ - device_io.h \ - dir.h \ - endians.h \ - gnome-vfs-method.h \ - gnome-vfs-module.h \ - inode.h \ - layout.h \ - lcnalloc.h \ - list.h \ - logfile.h \ - mft.h \ - mst.h \ - runlist.h \ - support.h \ - types.h \ - unistr.h \ - volume.h - +SUBDIRS = ntfs subdir = include ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = -HEADERS = $(linux_ntfsinclude_HEADERS) -DIST_COMMON = $(linux_ntfsinclude_HEADERS) Makefile.am Makefile.in -all: all-am +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = Makefile.am Makefile.in +DIST_SUBDIRS = $(SUBDIRS) +all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) @@ -201,23 +179,64 @@ clean-libtool: distclean-libtool: -rm -f libtool uninstall-info-am: -linux_ntfsincludeHEADERS_INSTALL = $(INSTALL_HEADER) -install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(linux_ntfsincludedir) - @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(linux_ntfsincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ - $(linux_ntfsincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(linux_ntfsincludedir)/$$f; \ - done -uninstall-linux_ntfsincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ - rm -f $(DESTDIR)$(linux_ntfsincludedir)/$$f; \ +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ETAGS = etags @@ -237,10 +256,21 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) END { for (i in files) print i; }'`; \ mkid -fID $$unique -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + else \ + include_option=--include; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ @@ -252,7 +282,7 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $$tags $$unique ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ @@ -305,21 +335,34 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done check-am: all-am -check: check-am -all-am: Makefile $(HEADERS) +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: -installdirs: - $(mkinstalldirs) $(DESTDIR)$(linux_ntfsincludedir) -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -installcheck: installcheck-am +installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ @@ -335,62 +378,69 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -clean: clean-am +clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am -distclean: distclean-am +distclean: distclean-recursive distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags -dvi: dvi-am +dvi: dvi-recursive dvi-am: -info: info-am +info: info-recursive info-am: -install-data-am: install-linux_ntfsincludeHEADERS +install-data-am: install-exec-am: -install-info: install-info-am +install-info: install-info-recursive install-man: installcheck-am: -maintainer-clean: maintainer-clean-am +maintainer-clean: maintainer-clean-recursive maintainer-clean-am: distclean-am maintainer-clean-generic -mostlyclean: mostlyclean-am +mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool -pdf: pdf-am +pdf: pdf-recursive pdf-am: -ps: ps-am +ps: ps-recursive ps-am: -uninstall-am: uninstall-info-am uninstall-linux_ntfsincludeHEADERS +uninstall-am: uninstall-info-am -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ - distclean-libtool distclean-tags 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-linux_ntfsincludeHEADERS install-man install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am \ - uninstall-linux_ntfsincludeHEADERS +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am \ + dvi-recursive info info-am info-recursive install install-am \ + install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-am install-info-recursive install-man \ + install-recursive install-strip installcheck installcheck-am \ + installdirs installdirs-am installdirs-recursive \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ + pdf-recursive ps ps-am ps-recursive tags tags-recursive \ + uninstall uninstall-am uninstall-info-am \ + uninstall-info-recursive uninstall-recursive # 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. From b1c59d1796f7164cdd6ffde7d233a4b8623a46a3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0976/2994] Initial revision --- include/ntfs/Makefile.am | 0 include/ntfs/Makefile.in | 0 include/ntfs/attrib.h | 0 include/ntfs/bitmap.h | 0 include/ntfs/bootsect.h | 0 include/ntfs/compat.h | 0 include/ntfs/compress.h | 0 include/ntfs/debug.h | 0 include/ntfs/device.h | 0 include/ntfs/device_io.h | 0 include/ntfs/dir.h | 0 include/ntfs/endians.h | 0 include/ntfs/gnome-vfs-method.h | 0 include/ntfs/gnome-vfs-module.h | 0 include/ntfs/inode.h | 0 include/ntfs/layout.h | 0 include/ntfs/lcnalloc.h | 0 include/ntfs/list.h | 0 include/ntfs/logfile.h | 0 include/ntfs/mft.h | 0 include/ntfs/mst.h | 0 include/ntfs/runlist.h | 0 include/ntfs/support.h | 0 include/ntfs/types.h | 0 include/ntfs/unistr.h | 0 include/ntfs/volume.h | 0 26 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 include/ntfs/Makefile.am create mode 100644 include/ntfs/Makefile.in create mode 100644 include/ntfs/attrib.h create mode 100644 include/ntfs/bitmap.h create mode 100644 include/ntfs/bootsect.h create mode 100644 include/ntfs/compat.h create mode 100644 include/ntfs/compress.h create mode 100644 include/ntfs/debug.h create mode 100644 include/ntfs/device.h create mode 100644 include/ntfs/device_io.h create mode 100644 include/ntfs/dir.h create mode 100644 include/ntfs/endians.h create mode 100644 include/ntfs/gnome-vfs-method.h create mode 100644 include/ntfs/gnome-vfs-module.h create mode 100644 include/ntfs/inode.h create mode 100644 include/ntfs/layout.h create mode 100644 include/ntfs/lcnalloc.h create mode 100644 include/ntfs/list.h create mode 100644 include/ntfs/logfile.h create mode 100644 include/ntfs/mft.h create mode 100644 include/ntfs/mst.h create mode 100644 include/ntfs/runlist.h create mode 100644 include/ntfs/support.h create mode 100644 include/ntfs/types.h create mode 100644 include/ntfs/unistr.h create mode 100644 include/ntfs/volume.h diff --git a/include/ntfs/Makefile.am b/include/ntfs/Makefile.am new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/bitmap.h b/include/ntfs/bitmap.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/bootsect.h b/include/ntfs/bootsect.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/compat.h b/include/ntfs/compat.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/compress.h b/include/ntfs/compress.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/debug.h b/include/ntfs/debug.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/device.h b/include/ntfs/device.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/device_io.h b/include/ntfs/device_io.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/gnome-vfs-method.h b/include/ntfs/gnome-vfs-method.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/gnome-vfs-module.h b/include/ntfs/gnome-vfs-module.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/lcnalloc.h b/include/ntfs/lcnalloc.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/list.h b/include/ntfs/list.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/mft.h b/include/ntfs/mft.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/mst.h b/include/ntfs/mst.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/runlist.h b/include/ntfs/runlist.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/support.h b/include/ntfs/support.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/types.h b/include/ntfs/types.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/unistr.h b/include/ntfs/unistr.h new file mode 100644 index 00000000..e69de29b diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h new file mode 100644 index 00000000..e69de29b From 335c60d7ed1cdd629d17d9111fe8c76270bb5116 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0977/2994] Move include files from ntfsprogs/include to ntfsprogs/include/ntfs and adapt build system. (Requested by Christophe Grenier.) BKrev: 403caf5aJJ6atbJ5xXxqsnnX8lEl4w From 1f65bb86c0383458cd4341ebce2d64f044d90d3c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0978/2994] Rename: include/Makefile.am -> include/ntfs/Makefile.am (Logical change 1.280) --- include/ntfs/Makefile.am | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/ntfs/Makefile.am b/include/ntfs/Makefile.am index e69de29b..a89a340d 100644 --- a/include/ntfs/Makefile.am +++ b/include/ntfs/Makefile.am @@ -0,0 +1,28 @@ + +linux_ntfsincludedir = $(includedir)/ntfs +linux_ntfsinclude_HEADERS = \ + attrib.h \ + bitmap.h \ + bootsect.h \ + compat.h \ + compress.h \ + debug.h \ + device.h \ + device_io.h \ + dir.h \ + endians.h \ + gnome-vfs-method.h \ + gnome-vfs-module.h \ + inode.h \ + layout.h \ + lcnalloc.h \ + list.h \ + logfile.h \ + mft.h \ + mst.h \ + runlist.h \ + support.h \ + types.h \ + unistr.h \ + volume.h + From f2c1a93bc85e3f7dde2dd37c2e99b40ae94b8972 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0979/2994] Rename: include/attrib.h -> include/ntfs/attrib.h (Logical change 1.280) --- include/ntfs/attrib.h | 312 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 312 insertions(+) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index e69de29b..155f9bb9 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -0,0 +1,312 @@ +/* + * attrib.h - Exports for attribute handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_ATTRIB_H +#define _NTFS_ATTRIB_H + +/* Forward declarations */ +typedef struct _ntfs_attr ntfs_attr; +typedef struct _ntfs_attr_search_ctx ntfs_attr_search_ctx; + +#include "types.h" +#include "unistr.h" +#include "runlist.h" +#include "volume.h" + +extern uchar_t AT_UNNAMED[]; + +/** + * ntfs_lcn_special_values - special return values for ntfs_*_vcn_to_lcn() + * + * Special return values for ntfs_rl_vcn_to_lcn() and ntfs_attr_vcn_to_lcn(). + * + * TODO: Describe them. + */ +typedef enum { + LCN_HOLE = -1, /* Keep this as highest value or die! */ + LCN_RL_NOT_MAPPED = -2, + LCN_ENOENT = -3, + LCN_EINVAL = -4, + LCN_EIO = -5, +} ntfs_lcn_special_values; + +/** + * ntfs_attr_search_ctx - search context used in attribute search functions + * @mrec: buffer containing mft record to search + * @attr: attribute record in @mrec where to begin/continue search + * @is_first: if true lookup_attr() begins search with @attr, else after @attr + * + * Structure must be initialized to zero before the first call to one of the + * attribute search functions. Initialize @mrec to point to the mft record to + * search, and @attr to point to the first attribute within @mrec (not necessary + * if calling the _first() functions), and set @is_first to TRUE (not necessary + * if calling the _first() functions). + * + * If @is_first is TRUE, the search begins with @attr. If @is_first is FALSE, + * the search begins after @attr. This is so that, after the first call to one + * of the search attribute functions, we can call the function again, without + * any modification of the search context, to automagically get the next + * matching attribute. + */ +struct _ntfs_attr_search_ctx { + MFT_RECORD *mrec; + ATTR_RECORD *attr; + BOOL is_first; + ntfs_inode *ntfs_ino; + ATTR_LIST_ENTRY *al_entry; + ntfs_inode *base_ntfs_ino; + MFT_RECORD *base_mrec; + ATTR_RECORD *base_attr; +}; + +extern void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx); +extern ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, + MFT_RECORD *mrec); +extern void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx); + +extern int ntfs_attr_lookup(const ATTR_TYPES type, const uchar_t *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const VCN lowest_vcn, const u8 *val, const u32 val_len, + ntfs_attr_search_ctx *ctx); + +extern ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol, + const ATTR_TYPES type); + +/** + * ntfs_attrs_walk - syntactic sugar for walking all attributes in an inode + * @ctx: initialised attribute search context + * + * Syntactic sugar for walking attributes in an inode. + * + * Return 0 on success and -1 on error with errno set to the error code from + * ntfs_attr_lookup(). + * + * Example: When you want to enumerate all attributes in an open ntfs inode + * @ni, you can simply do: + * + * int err; + * ntfs_attr_search_ctx *ctx = ntfs_attr_get_search_ctx(ni, NULL); + * if (!ctx) + * // Error code is in errno. Handle this case. + * while (!(err = ntfs_attrs_walk(ctx))) { + * ATTR_RECORD *attr = ctx->attr; + * // attr now contains the next attribute. Do whatever you want + * // with it and then just continue with the while loop. + * } + * if (err && errno != ENOENT) + * // Ooops. An error occured! You should handle this case. + * // Now finished with all attributes in the inode. + */ +static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx) +{ + return ntfs_attr_lookup(0, NULL, 0, 0, 0, NULL, 0, ctx); +} + +/** + * ntfs_attr_state_bits - bits for the state field in the ntfs_attr structure + */ +typedef enum { + NA_Initialized, /* 1: structure is initialized. */ + NA_NonResident, /* 1: Attribute is not resident. */ + NA_Compressed, /* 1: Attribute is compressed. */ + NA_Encrypted, /* 1: Attribute is encrypted. */ + NA_Sparse, /* 1: Attribute is sparse. */ +} ntfs_attr_state_bits; + +#define test_nattr_flag(na, flag) test_bit(NA_##flag, (na)->state) +#define set_nattr_flag(na, flag) set_bit(NA_##flag, (na)->state) +#define clear_nattr_flag(na, flag) clear_bit(NA_##flag, (na)->state) + +#define NAttrInitialized(na) test_nattr_flag(na, Initialized) +#define NAttrSetInitialized(na) set_nattr_flag(na, Initialized) +#define NAttrClearInitialized(na) clear_nattr_flag(na, Initialized) + +#define NAttrNonResident(na) test_nattr_flag(na, NonResident) +#define NAttrSetNonResident(na) set_nattr_flag(na, NonResident) +#define NAttrClearNonResident(na) clear_nattr_flag(na, NonResident) + +#define NAttrCompressed(na) test_nattr_flag(na, Compressed) +#define NAttrSetCompressed(na) set_nattr_flag(na, Compressed) +#define NAttrClearCompressed(na) clear_nattr_flag(na, Compressed) + +#define NAttrEncrypted(na) test_nattr_flag(na, Encrypted) +#define NAttrSetEncrypted(na) set_nattr_flag(na, Encrypted) +#define NAttrClearEncrypted(na) clear_nattr_flag(na, Encrypted) + +#define NAttrSparse(na) test_nattr_flag(na, Sparse) +#define NAttrSetSparse(na) set_nattr_flag(na, Sparse) +#define NAttrClearSparse(na) clear_nattr_flag(na, Sparse) + +/** + * ntfs_attr - ntfs in memory non-resident attribute structure + * @rl: if not NULL, the decompressed runlist + * @ni: base ntfs inode to which this attribute belongs + * @type: attribute type + * @name: Unicode name of the attribute + * @name_len: length of @name in Unicode characters + * @state: NTFS attribute specific flags descibing this attribute + * @allocated_size: copy from the attribute record + * @data_size: copy from the attribute record + * @initialized_size: copy from the attribute record + * @compressed_size: copy from the attribute record + * @compression_block_size: size of a compression block (cb) + * @compression_block_size_bits: log2 of the size of a cb + * @compression_block_clusters: number of clusters per cb + * + * This structure exists purely to provide a mechanism of caching the runlist + * of an attribute. If you want to operate on a particular attribute extent, + * you should not be using this structure at all. If you want to work with a + * resident attribute, you should not be using this structure at all. As a + * fail-safe check make sure to test NAttrNonResident() and if it is false, you + * know you shouldn't be using this structure. + * + * If you want to work on a resident attribute or on a specific attribute + * extent, you should use ntfs_lookup_attr() to retrieve the attribute (extent) + * record, edit that, and then write back the mft record (or set the + * corresponding ntfs inode dirty for delayed write back). + * + * @rl is the decompressed runlist of the attribute described by this + * structure. Obviously this only makes sense if the attribute is not resident, + * i.e. NAttrNonResident() is true. If the runlist hasn't been decomressed yet + * @rl is NULL, so be prepared to cope with @rl == NULL. + * + * @ni is the base ntfs inode of the attribute described by this structure. + * + * @type is the attribute type (see layout.h for the definition of ATTR_TYPES), + * @name and @name_len are the little endian Unicode name and the name length + * in Unicode characters of the attribute, respecitvely. + * + * @state contains NTFS attribute specific flags descibing this attribute + * structure. See ntfs_attr_state_bits above. + */ +struct _ntfs_attr { + runlist_element *rl; + ntfs_inode *ni; + ATTR_TYPES type; + uchar_t *name; + u32 name_len; + unsigned long state; + s64 allocated_size; + s64 data_size; + s64 initialized_size; + s64 compressed_size; + u32 compression_block_size; + u8 compression_block_size_bits; + u8 compression_block_clusters; +}; + +/* + * Union of all known attribute values. For convenience. Used in the attr + * structure. + */ +typedef union { + u8 _default; /* Unnamed u8 to serve as default when just using + a_val without specifying any of the below. */ + STANDARD_INFORMATION std_inf; + ATTR_LIST_ENTRY al_entry; + FILE_NAME_ATTR filename; + OBJECT_ID_ATTR obj_id; + SECURITY_DESCRIPTOR_ATTR sec_desc; + VOLUME_NAME vol_name; + VOLUME_INFORMATION vol_inf; + DATA_ATTR data; + INDEX_ROOT index_root; + INDEX_BLOCK index_blk; + BITMAP_ATTR bmp; + REPARSE_POINT reparse; + EA_INFORMATION ea_inf; + EA_ATTR ea; + PROPERTY_SET property_set; + LOGGED_UTILITY_STREAM logged_util_stream; + EFS_ATTR efs; +} attr_val; + +extern void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident, + const BOOL compressed, const BOOL encrypted, const BOOL sparse, + const s64 allocated_size, const s64 data_size, + const s64 initialized_size, const s64 compressed_size, + const u8 compression_unit); + +extern ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, + uchar_t *name, const u32 name_len); +extern void ntfs_attr_close(ntfs_attr *na); + +extern s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, + void *b); +extern s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, + void *b); + +extern s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, + const s64 bk_cnt, const u32 bk_size, void *dst); +extern s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, + s64 bk_cnt, const u32 bk_size, void *src); + +extern int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn); +extern int ntfs_attr_map_whole_runlist(ntfs_attr *na); + +extern LCN ntfs_attr_vcn_to_lcn(ntfs_attr *na, const VCN vcn); +extern runlist_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn); + +extern int ntfs_attr_size_bounds_check(const ntfs_volume *vol, + const ATTR_TYPES type, const s64 size); +extern int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, + const ATTR_TYPES type); +extern int ntfs_attr_can_be_resident(const ntfs_volume *vol, + const ATTR_TYPES type); + +extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, + const u32 newsize); + +extern int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize); + +// FIXME / TODO: Above here the file is cleaned up. (AIA) +/** + * get_attribute_value_length - return the length of the value of an attribute + * @a: pointer to a buffer containing the attribute record + * + * Return the byte size of the attribute value of the attribute @a (as it + * would be after eventual decompression and filling in of holes if sparse). + * If we return 0, check errno. If errno is 0 the actual length was 0, + * otherwise errno describes the error. + * + * FIXME: Describe possible errnos. + */ +s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a); + +/** + * get_attribute_value - return the attribute value of an attribute + * @vol: volume on which the attribute is present + * @a: attribute to get the value of + * @b: destination buffer for the attribute value + * + * Make a copy of the attribute value of the attribute @a into the destination + * buffer @b. Note, that the size of @b has to be at least equal to the value + * returned by get_attribute_value_length(@a). + * + * Return number of bytes copied. If this is zero check errno. If errno is 0 + * then nothing was read due to a zero-length attribute value, otherwise + * errno describes the error. + */ +s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, + const ATTR_RECORD *a, u8 *b); + +#endif /* defined _NTFS_ATTRIB_H */ + From 37b43614ab60101f702c9e511d7d92d76e18a60b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0980/2994] Rename: include/attrib.h -> include/ntfs/attrib.h }(Logical change 1.280) --- include/attrib.h | 312 ----------------------------------------------- 1 file changed, 312 deletions(-) delete mode 100644 include/attrib.h diff --git a/include/attrib.h b/include/attrib.h deleted file mode 100644 index 155f9bb9..00000000 --- a/include/attrib.h +++ /dev/null @@ -1,312 +0,0 @@ -/* - * attrib.h - Exports for attribute handling. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2004 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_ATTRIB_H -#define _NTFS_ATTRIB_H - -/* Forward declarations */ -typedef struct _ntfs_attr ntfs_attr; -typedef struct _ntfs_attr_search_ctx ntfs_attr_search_ctx; - -#include "types.h" -#include "unistr.h" -#include "runlist.h" -#include "volume.h" - -extern uchar_t AT_UNNAMED[]; - -/** - * ntfs_lcn_special_values - special return values for ntfs_*_vcn_to_lcn() - * - * Special return values for ntfs_rl_vcn_to_lcn() and ntfs_attr_vcn_to_lcn(). - * - * TODO: Describe them. - */ -typedef enum { - LCN_HOLE = -1, /* Keep this as highest value or die! */ - LCN_RL_NOT_MAPPED = -2, - LCN_ENOENT = -3, - LCN_EINVAL = -4, - LCN_EIO = -5, -} ntfs_lcn_special_values; - -/** - * ntfs_attr_search_ctx - search context used in attribute search functions - * @mrec: buffer containing mft record to search - * @attr: attribute record in @mrec where to begin/continue search - * @is_first: if true lookup_attr() begins search with @attr, else after @attr - * - * Structure must be initialized to zero before the first call to one of the - * attribute search functions. Initialize @mrec to point to the mft record to - * search, and @attr to point to the first attribute within @mrec (not necessary - * if calling the _first() functions), and set @is_first to TRUE (not necessary - * if calling the _first() functions). - * - * If @is_first is TRUE, the search begins with @attr. If @is_first is FALSE, - * the search begins after @attr. This is so that, after the first call to one - * of the search attribute functions, we can call the function again, without - * any modification of the search context, to automagically get the next - * matching attribute. - */ -struct _ntfs_attr_search_ctx { - MFT_RECORD *mrec; - ATTR_RECORD *attr; - BOOL is_first; - ntfs_inode *ntfs_ino; - ATTR_LIST_ENTRY *al_entry; - ntfs_inode *base_ntfs_ino; - MFT_RECORD *base_mrec; - ATTR_RECORD *base_attr; -}; - -extern void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx); -extern ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, - MFT_RECORD *mrec); -extern void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx); - -extern int ntfs_attr_lookup(const ATTR_TYPES type, const uchar_t *name, - const u32 name_len, const IGNORE_CASE_BOOL ic, - const VCN lowest_vcn, const u8 *val, const u32 val_len, - ntfs_attr_search_ctx *ctx); - -extern ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol, - const ATTR_TYPES type); - -/** - * ntfs_attrs_walk - syntactic sugar for walking all attributes in an inode - * @ctx: initialised attribute search context - * - * Syntactic sugar for walking attributes in an inode. - * - * Return 0 on success and -1 on error with errno set to the error code from - * ntfs_attr_lookup(). - * - * Example: When you want to enumerate all attributes in an open ntfs inode - * @ni, you can simply do: - * - * int err; - * ntfs_attr_search_ctx *ctx = ntfs_attr_get_search_ctx(ni, NULL); - * if (!ctx) - * // Error code is in errno. Handle this case. - * while (!(err = ntfs_attrs_walk(ctx))) { - * ATTR_RECORD *attr = ctx->attr; - * // attr now contains the next attribute. Do whatever you want - * // with it and then just continue with the while loop. - * } - * if (err && errno != ENOENT) - * // Ooops. An error occured! You should handle this case. - * // Now finished with all attributes in the inode. - */ -static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx) -{ - return ntfs_attr_lookup(0, NULL, 0, 0, 0, NULL, 0, ctx); -} - -/** - * ntfs_attr_state_bits - bits for the state field in the ntfs_attr structure - */ -typedef enum { - NA_Initialized, /* 1: structure is initialized. */ - NA_NonResident, /* 1: Attribute is not resident. */ - NA_Compressed, /* 1: Attribute is compressed. */ - NA_Encrypted, /* 1: Attribute is encrypted. */ - NA_Sparse, /* 1: Attribute is sparse. */ -} ntfs_attr_state_bits; - -#define test_nattr_flag(na, flag) test_bit(NA_##flag, (na)->state) -#define set_nattr_flag(na, flag) set_bit(NA_##flag, (na)->state) -#define clear_nattr_flag(na, flag) clear_bit(NA_##flag, (na)->state) - -#define NAttrInitialized(na) test_nattr_flag(na, Initialized) -#define NAttrSetInitialized(na) set_nattr_flag(na, Initialized) -#define NAttrClearInitialized(na) clear_nattr_flag(na, Initialized) - -#define NAttrNonResident(na) test_nattr_flag(na, NonResident) -#define NAttrSetNonResident(na) set_nattr_flag(na, NonResident) -#define NAttrClearNonResident(na) clear_nattr_flag(na, NonResident) - -#define NAttrCompressed(na) test_nattr_flag(na, Compressed) -#define NAttrSetCompressed(na) set_nattr_flag(na, Compressed) -#define NAttrClearCompressed(na) clear_nattr_flag(na, Compressed) - -#define NAttrEncrypted(na) test_nattr_flag(na, Encrypted) -#define NAttrSetEncrypted(na) set_nattr_flag(na, Encrypted) -#define NAttrClearEncrypted(na) clear_nattr_flag(na, Encrypted) - -#define NAttrSparse(na) test_nattr_flag(na, Sparse) -#define NAttrSetSparse(na) set_nattr_flag(na, Sparse) -#define NAttrClearSparse(na) clear_nattr_flag(na, Sparse) - -/** - * ntfs_attr - ntfs in memory non-resident attribute structure - * @rl: if not NULL, the decompressed runlist - * @ni: base ntfs inode to which this attribute belongs - * @type: attribute type - * @name: Unicode name of the attribute - * @name_len: length of @name in Unicode characters - * @state: NTFS attribute specific flags descibing this attribute - * @allocated_size: copy from the attribute record - * @data_size: copy from the attribute record - * @initialized_size: copy from the attribute record - * @compressed_size: copy from the attribute record - * @compression_block_size: size of a compression block (cb) - * @compression_block_size_bits: log2 of the size of a cb - * @compression_block_clusters: number of clusters per cb - * - * This structure exists purely to provide a mechanism of caching the runlist - * of an attribute. If you want to operate on a particular attribute extent, - * you should not be using this structure at all. If you want to work with a - * resident attribute, you should not be using this structure at all. As a - * fail-safe check make sure to test NAttrNonResident() and if it is false, you - * know you shouldn't be using this structure. - * - * If you want to work on a resident attribute or on a specific attribute - * extent, you should use ntfs_lookup_attr() to retrieve the attribute (extent) - * record, edit that, and then write back the mft record (or set the - * corresponding ntfs inode dirty for delayed write back). - * - * @rl is the decompressed runlist of the attribute described by this - * structure. Obviously this only makes sense if the attribute is not resident, - * i.e. NAttrNonResident() is true. If the runlist hasn't been decomressed yet - * @rl is NULL, so be prepared to cope with @rl == NULL. - * - * @ni is the base ntfs inode of the attribute described by this structure. - * - * @type is the attribute type (see layout.h for the definition of ATTR_TYPES), - * @name and @name_len are the little endian Unicode name and the name length - * in Unicode characters of the attribute, respecitvely. - * - * @state contains NTFS attribute specific flags descibing this attribute - * structure. See ntfs_attr_state_bits above. - */ -struct _ntfs_attr { - runlist_element *rl; - ntfs_inode *ni; - ATTR_TYPES type; - uchar_t *name; - u32 name_len; - unsigned long state; - s64 allocated_size; - s64 data_size; - s64 initialized_size; - s64 compressed_size; - u32 compression_block_size; - u8 compression_block_size_bits; - u8 compression_block_clusters; -}; - -/* - * Union of all known attribute values. For convenience. Used in the attr - * structure. - */ -typedef union { - u8 _default; /* Unnamed u8 to serve as default when just using - a_val without specifying any of the below. */ - STANDARD_INFORMATION std_inf; - ATTR_LIST_ENTRY al_entry; - FILE_NAME_ATTR filename; - OBJECT_ID_ATTR obj_id; - SECURITY_DESCRIPTOR_ATTR sec_desc; - VOLUME_NAME vol_name; - VOLUME_INFORMATION vol_inf; - DATA_ATTR data; - INDEX_ROOT index_root; - INDEX_BLOCK index_blk; - BITMAP_ATTR bmp; - REPARSE_POINT reparse; - EA_INFORMATION ea_inf; - EA_ATTR ea; - PROPERTY_SET property_set; - LOGGED_UTILITY_STREAM logged_util_stream; - EFS_ATTR efs; -} attr_val; - -extern void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident, - const BOOL compressed, const BOOL encrypted, const BOOL sparse, - const s64 allocated_size, const s64 data_size, - const s64 initialized_size, const s64 compressed_size, - const u8 compression_unit); - -extern ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, - uchar_t *name, const u32 name_len); -extern void ntfs_attr_close(ntfs_attr *na); - -extern s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, - void *b); -extern s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, - void *b); - -extern s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, - const s64 bk_cnt, const u32 bk_size, void *dst); -extern s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, - s64 bk_cnt, const u32 bk_size, void *src); - -extern int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn); -extern int ntfs_attr_map_whole_runlist(ntfs_attr *na); - -extern LCN ntfs_attr_vcn_to_lcn(ntfs_attr *na, const VCN vcn); -extern runlist_element *ntfs_attr_find_vcn(ntfs_attr *na, const VCN vcn); - -extern int ntfs_attr_size_bounds_check(const ntfs_volume *vol, - const ATTR_TYPES type, const s64 size); -extern int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, - const ATTR_TYPES type); -extern int ntfs_attr_can_be_resident(const ntfs_volume *vol, - const ATTR_TYPES type); - -extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, - const u32 newsize); - -extern int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize); - -// FIXME / TODO: Above here the file is cleaned up. (AIA) -/** - * get_attribute_value_length - return the length of the value of an attribute - * @a: pointer to a buffer containing the attribute record - * - * Return the byte size of the attribute value of the attribute @a (as it - * would be after eventual decompression and filling in of holes if sparse). - * If we return 0, check errno. If errno is 0 the actual length was 0, - * otherwise errno describes the error. - * - * FIXME: Describe possible errnos. - */ -s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a); - -/** - * get_attribute_value - return the attribute value of an attribute - * @vol: volume on which the attribute is present - * @a: attribute to get the value of - * @b: destination buffer for the attribute value - * - * Make a copy of the attribute value of the attribute @a into the destination - * buffer @b. Note, that the size of @b has to be at least equal to the value - * returned by get_attribute_value_length(@a). - * - * Return number of bytes copied. If this is zero check errno. If errno is 0 - * then nothing was read due to a zero-length attribute value, otherwise - * errno describes the error. - */ -s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, - const ATTR_RECORD *a, u8 *b); - -#endif /* defined _NTFS_ATTRIB_H */ - From d87fde8436c63d9bf43d3e2c3d14f9acf5532f17 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0981/2994] Rename: include/bitmap.h -> include/ntfs/bitmap.h (Logical change 1.280) --- include/ntfs/bitmap.h | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/include/ntfs/bitmap.h b/include/ntfs/bitmap.h index e69de29b..3f2694b2 100644 --- a/include/ntfs/bitmap.h +++ b/include/ntfs/bitmap.h @@ -0,0 +1,107 @@ +/* + * bitmap.h - Exports for bitmap handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_BITMAP_H +#define _NTFS_BITMAP_H + +#include "types.h" +#include "attrib.h" + +/* + * NOTES: + * + * - Operations are 8-bit only to ensure the functions work both on little + * and big endian machines! So don't make them 32-bit ops! + * - bitmap starts at bit = 0 and ends at bit = bitmap size - 1. + * - _Caller_ has to make sure that the bit to operate on is less than the + * size of the bitmap. + */ + +/** + * ntfs_bit_set - set a bit in a field of bits + * @bitmap: field of bits + * @bit: bit to set + * @new_value: value to set bit to (0 or 1) + * + * Set the bit @bit in the @bitmap to @new_value. Ignore all errors. + */ +static __inline__ void ntfs_bit_set(u8 *bitmap, const u64 bit, + const u8 new_value) +{ +// Dprintf("bitmap %p, bit 0x%llx, new_value %i\n", bitmap, bit, new_value); + if (!bitmap || new_value > 1) + return; + if (!new_value) + bitmap[bit >> 3] &= ~(1 << (bit & 7)); + else + bitmap[bit >> 3] |= (1 << (bit & 7)); +} + +/** + * ntfs_bit_get - get value of a bit in a field of bits + * @bitmap: field of bits + * @bit: bit to get + * + * Get and return the value of the bit @bit in @bitmap (0 or 1). + * Return -1 on error. + */ +static __inline__ char ntfs_bit_get(const u8 *bitmap, const u64 bit) +{ + if (!bitmap) + return -1; + return (bitmap[bit >> 3] >> (bit & 7)) & 1; +} + +static __inline__ void ntfs_bit_change(u8 *bitmap, const u64 bit) +{ + if (!bitmap) + return; + bitmap[bit >> 3] ^= 1 << (bit & 7); +} + +/** + * ntfs_bit_get_and_set - get value of a bit in a field of bits and set it + * @bitmap: field of bits + * @bit: bit to get/set + * @new_value: value to set bit to (0 or 1) + * + * Return the value of the bit @bit and set it to @new_value (0 or 1). + * Return -1 on error. + */ +static __inline__ char ntfs_bit_get_and_set(u8 *bitmap, const u64 bit, + const u8 new_value) +{ + register u8 old_bit, shift; + + if (!bitmap || new_value > 1) + return -1; + shift = bit & 7; + old_bit = (bitmap[bit >> 3] >> shift) & 1; + if (new_value != old_bit) + bitmap[bit >> 3] ^= 1 << shift; + return old_bit; +} + +extern int ntfs_bitmap_set_run(ntfs_attr *na, s64 start_bit, s64 count); +extern int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count); + +#endif /* defined _NTFS_BITMAP_H */ + From 38c6220836bab4a5d722952bb801bf088eead84b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0982/2994] Rename: include/bitmap.h -> include/ntfs/bitmap.h }(Logical change 1.280) --- include/bitmap.h | 107 ----------------------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 include/bitmap.h diff --git a/include/bitmap.h b/include/bitmap.h deleted file mode 100644 index 3f2694b2..00000000 --- a/include/bitmap.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * bitmap.h - Exports for bitmap handling. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2003 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_BITMAP_H -#define _NTFS_BITMAP_H - -#include "types.h" -#include "attrib.h" - -/* - * NOTES: - * - * - Operations are 8-bit only to ensure the functions work both on little - * and big endian machines! So don't make them 32-bit ops! - * - bitmap starts at bit = 0 and ends at bit = bitmap size - 1. - * - _Caller_ has to make sure that the bit to operate on is less than the - * size of the bitmap. - */ - -/** - * ntfs_bit_set - set a bit in a field of bits - * @bitmap: field of bits - * @bit: bit to set - * @new_value: value to set bit to (0 or 1) - * - * Set the bit @bit in the @bitmap to @new_value. Ignore all errors. - */ -static __inline__ void ntfs_bit_set(u8 *bitmap, const u64 bit, - const u8 new_value) -{ -// Dprintf("bitmap %p, bit 0x%llx, new_value %i\n", bitmap, bit, new_value); - if (!bitmap || new_value > 1) - return; - if (!new_value) - bitmap[bit >> 3] &= ~(1 << (bit & 7)); - else - bitmap[bit >> 3] |= (1 << (bit & 7)); -} - -/** - * ntfs_bit_get - get value of a bit in a field of bits - * @bitmap: field of bits - * @bit: bit to get - * - * Get and return the value of the bit @bit in @bitmap (0 or 1). - * Return -1 on error. - */ -static __inline__ char ntfs_bit_get(const u8 *bitmap, const u64 bit) -{ - if (!bitmap) - return -1; - return (bitmap[bit >> 3] >> (bit & 7)) & 1; -} - -static __inline__ void ntfs_bit_change(u8 *bitmap, const u64 bit) -{ - if (!bitmap) - return; - bitmap[bit >> 3] ^= 1 << (bit & 7); -} - -/** - * ntfs_bit_get_and_set - get value of a bit in a field of bits and set it - * @bitmap: field of bits - * @bit: bit to get/set - * @new_value: value to set bit to (0 or 1) - * - * Return the value of the bit @bit and set it to @new_value (0 or 1). - * Return -1 on error. - */ -static __inline__ char ntfs_bit_get_and_set(u8 *bitmap, const u64 bit, - const u8 new_value) -{ - register u8 old_bit, shift; - - if (!bitmap || new_value > 1) - return -1; - shift = bit & 7; - old_bit = (bitmap[bit >> 3] >> shift) & 1; - if (new_value != old_bit) - bitmap[bit >> 3] ^= 1 << shift; - return old_bit; -} - -extern int ntfs_bitmap_set_run(ntfs_attr *na, s64 start_bit, s64 count); -extern int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count); - -#endif /* defined _NTFS_BITMAP_H */ - From 5f77178020480cefe44eb708227da0f49593c2ff Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0983/2994] Rename: include/bootsect.h -> include/ntfs/bootsect.h (Logical change 1.280) --- include/ntfs/bootsect.h | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/include/ntfs/bootsect.h b/include/ntfs/bootsect.h index e69de29b..345f48d9 100644 --- a/include/ntfs/bootsect.h +++ b/include/ntfs/bootsect.h @@ -0,0 +1,46 @@ +/* + * bootsect.h - Exports for bootsector record handling. Part of the Linux-NTFS + * project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_BOOTSECT_H +#define _NTFS_BOOTSECT_H + +#include "types.h" +#include "volume.h" +#include "layout.h" + +/** + * is_boot_sector_ntfs - check a boot sector for describing an ntfs volume + * @b: buffer containing the boot sector + * @silent: if 1 don't display progress information + * + * This function checks the boot sector in @b for describing a valid ntfs + * volume. Return TRUE if @b is a valid NTFS boot sector or FALSE otherwise. + * If silent is FALSE, progress output will be output to stdout. If silent is + * TRUE no output to stdout will occur. Errors/warnings to stderr will occur + * disregarding the value of silent (but only if configure was run with + * --enable-debug). + */ +extern BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, BOOL silent); +extern int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b); + +#endif /* defined _NTFS_BOOTSECT_H */ + From 1904c8d11874be42e083c0ceba5b1490e4f5af68 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0984/2994] Rename: include/bootsect.h -> include/ntfs/bootsect.h }(Logical change 1.280) --- include/bootsect.h | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 include/bootsect.h diff --git a/include/bootsect.h b/include/bootsect.h deleted file mode 100644 index 345f48d9..00000000 --- a/include/bootsect.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * bootsect.h - Exports for bootsector record handling. Part of the Linux-NTFS - * project. - * - * Copyright (c) 2000-2002 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_BOOTSECT_H -#define _NTFS_BOOTSECT_H - -#include "types.h" -#include "volume.h" -#include "layout.h" - -/** - * is_boot_sector_ntfs - check a boot sector for describing an ntfs volume - * @b: buffer containing the boot sector - * @silent: if 1 don't display progress information - * - * This function checks the boot sector in @b for describing a valid ntfs - * volume. Return TRUE if @b is a valid NTFS boot sector or FALSE otherwise. - * If silent is FALSE, progress output will be output to stdout. If silent is - * TRUE no output to stdout will occur. Errors/warnings to stderr will occur - * disregarding the value of silent (but only if configure was run with - * --enable-debug). - */ -extern BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, BOOL silent); -extern int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b); - -#endif /* defined _NTFS_BOOTSECT_H */ - From 9cd9e1edf9e296d0fa7d646b425980c78a04acc2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0985/2994] Rename: include/compat.h -> include/ntfs/compat.h (Logical change 1.280) --- include/ntfs/compat.h | 52 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/include/ntfs/compat.h b/include/ntfs/compat.h index e69de29b..866f6ae7 100644 --- a/include/ntfs/compat.h +++ b/include/ntfs/compat.h @@ -0,0 +1,52 @@ +/* + * compat.h - Tweaks for Windows compatability. + * + * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002-2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_COMPAT_H +#define _NTFS_COMPAT_H + +#include "config.h" + +#ifdef WINDOWS + +#ifndef HAVE_FFS +#define HAVE_FFS +extern int ffs(int i); +#endif /* HAVE_FFS */ + +#define HAVE_STDIO_H /* mimic config.h */ +#define HAVE_STDARG_H + +#define atoll _atoi64 +#define fdatasync commit +#define __inline__ inline +#define __attribute__(X) /*nothing*/ + +#else /* !defined WINDOWS */ + +#ifndef O_BINARY +#define O_BINARY 0 /* unix is binary by default */ +#endif + +#endif /* defined WINDOWS */ + +#endif /* defined _NTFS_COMPAT_H */ + From 49455232ba0b5eeafd1980d85a245de33dff3cdd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0986/2994] Rename: include/compat.h -> include/ntfs/compat.h }(Logical change 1.280) --- include/compat.h | 52 ------------------------------------------------ 1 file changed, 52 deletions(-) delete mode 100644 include/compat.h diff --git a/include/compat.h b/include/compat.h deleted file mode 100644 index 866f6ae7..00000000 --- a/include/compat.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * compat.h - Tweaks for Windows compatability. - * - * Copyright (c) 2002 Richard Russon - * Copyright (c) 2002-2004 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_COMPAT_H -#define _NTFS_COMPAT_H - -#include "config.h" - -#ifdef WINDOWS - -#ifndef HAVE_FFS -#define HAVE_FFS -extern int ffs(int i); -#endif /* HAVE_FFS */ - -#define HAVE_STDIO_H /* mimic config.h */ -#define HAVE_STDARG_H - -#define atoll _atoi64 -#define fdatasync commit -#define __inline__ inline -#define __attribute__(X) /*nothing*/ - -#else /* !defined WINDOWS */ - -#ifndef O_BINARY -#define O_BINARY 0 /* unix is binary by default */ -#endif - -#endif /* defined WINDOWS */ - -#endif /* defined _NTFS_COMPAT_H */ - From 508ce7ac22d50da3dc8b3d7817ada13629fe3f82 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0987/2994] Rename: include/compress.h -> include/ntfs/compress.h (Logical change 1.280) --- include/ntfs/compress.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/include/ntfs/compress.h b/include/ntfs/compress.h index e69de29b..93df37af 100644 --- a/include/ntfs/compress.h +++ b/include/ntfs/compress.h @@ -0,0 +1,33 @@ +/* + * compress.h - Exports for compressed attribute handling. Part of the + * Linux-NTFS project. + * + * Copyright (c) 2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_COMPRESS_H +#define _NTFS_COMPRESS_H + +#include "types.h" +#include "attrib.h" + +extern s64 ntfs_compressed_attr_pread(ntfs_attr *na, s64 pos, s64 count, + void *b); + +#endif /* defined _NTFS_COMPRESS_H */ + From 9ffd8007b6f5f6aca4aaa166bed975decb547474 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0988/2994] Rename: include/compress.h -> include/ntfs/compress.h }(Logical change 1.280) --- include/compress.h | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 include/compress.h diff --git a/include/compress.h b/include/compress.h deleted file mode 100644 index 93df37af..00000000 --- a/include/compress.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * compress.h - Exports for compressed attribute handling. Part of the - * Linux-NTFS project. - * - * Copyright (c) 2004 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_COMPRESS_H -#define _NTFS_COMPRESS_H - -#include "types.h" -#include "attrib.h" - -extern s64 ntfs_compressed_attr_pread(ntfs_attr *na, s64 pos, s64 count, - void *b); - -#endif /* defined _NTFS_COMPRESS_H */ - From dc727b8307fbd94a1a0183759d10b8d72d64184d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0989/2994] Rename: include/debug.h -> include/ntfs/debug.h (Logical change 1.280) --- include/ntfs/debug.h | 87 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/include/ntfs/debug.h b/include/ntfs/debug.h index e69de29b..df6b6886 100644 --- a/include/ntfs/debug.h +++ b/include/ntfs/debug.h @@ -0,0 +1,87 @@ +/* + * debug.h - Debugging output functions. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_DEBUG_H +#define _NTFS_DEBUG_H + +#include "config.h" + +#ifdef HAVE_STDIO_H +# include +#endif + +#include "attrib.h" + +#ifdef DEBUG + +#ifdef HAVE_STDARG_H +# include +#endif +#include + +/* Debug output to stderr. To get it run ./configure --enable-debug. */ + +static __inline__ void Dprintf(const char *fmt, ...) +{ + int eo = errno; + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + errno = eo; +} + +static __inline__ void Dputs(const char *s) +{ + int eo = errno; + fprintf(stderr, "%s\n", s); + errno = eo; +} + +static __inline__ void Dperror(const char *s) +{ + int eo = errno; + perror(s); + errno = eo; +} + +extern void ntfs_debug_runlist_dump(const runlist_element *rl); + +#else /* if !DEBUG */ + +static __inline__ void Dprintf(const char *fmt __attribute__((unused)), ...) {} +static __inline__ void Dputs(const char *s __attribute__((unused))) {} +static __inline__ void Dperror(const char *s __attribute__((unused))) {} +static __inline__ void ntfs_debug_runlist_dump(const runlist_element *rl __attribute__((unused))) {} + +#endif /* !DEBUG */ + +#define NTFS_BUG(msg) \ +{ \ + int ___i; \ + fprintf(stderr, "libntfs: Bug in %s(): %s\n", __FUNCTION__, msg); \ + Dputs("Forcing segmentation fault!"); \ + ___i = ((int*)NULL)[1]; \ +} + +#endif /* defined _NTFS_DEBUG_H */ + From 14e54a2347439ba9d39a2b1b2e0e87765f439bee Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0990/2994] Rename: include/debug.h -> include/ntfs/debug.h }(Logical change 1.280) --- include/debug.h | 87 ------------------------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 include/debug.h diff --git a/include/debug.h b/include/debug.h deleted file mode 100644 index df6b6886..00000000 --- a/include/debug.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * debug.h - Debugging output functions. Part of the Linux-NTFS project. - * - * Copyright (c) 2002 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_DEBUG_H -#define _NTFS_DEBUG_H - -#include "config.h" - -#ifdef HAVE_STDIO_H -# include -#endif - -#include "attrib.h" - -#ifdef DEBUG - -#ifdef HAVE_STDARG_H -# include -#endif -#include - -/* Debug output to stderr. To get it run ./configure --enable-debug. */ - -static __inline__ void Dprintf(const char *fmt, ...) -{ - int eo = errno; - va_list ap; - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - errno = eo; -} - -static __inline__ void Dputs(const char *s) -{ - int eo = errno; - fprintf(stderr, "%s\n", s); - errno = eo; -} - -static __inline__ void Dperror(const char *s) -{ - int eo = errno; - perror(s); - errno = eo; -} - -extern void ntfs_debug_runlist_dump(const runlist_element *rl); - -#else /* if !DEBUG */ - -static __inline__ void Dprintf(const char *fmt __attribute__((unused)), ...) {} -static __inline__ void Dputs(const char *s __attribute__((unused))) {} -static __inline__ void Dperror(const char *s __attribute__((unused))) {} -static __inline__ void ntfs_debug_runlist_dump(const runlist_element *rl __attribute__((unused))) {} - -#endif /* !DEBUG */ - -#define NTFS_BUG(msg) \ -{ \ - int ___i; \ - fprintf(stderr, "libntfs: Bug in %s(): %s\n", __FUNCTION__, msg); \ - Dputs("Forcing segmentation fault!"); \ - ___i = ((int*)NULL)[1]; \ -} - -#endif /* defined _NTFS_DEBUG_H */ - From bb8f192c259607fe8bc15e4d3f203a7b411676ad Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0991/2994] Rename: include/device.h -> include/ntfs/device.h (Logical change 1.280) --- include/ntfs/device.h | 110 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/include/ntfs/device.h b/include/ntfs/device.h index e69de29b..c9490cd9 100644 --- a/include/ntfs/device.h +++ b/include/ntfs/device.h @@ -0,0 +1,110 @@ +/* + * device.h - Exports for low level device io. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_DEVICE_H +#define _NTFS_DEVICE_H + +#include "config.h" + +#include + +#include "device_io.h" +#include "types.h" +#include "support.h" +#include "volume.h" + +/* + * Defined bits for the state field in the ntfs_device structure. + */ +typedef enum { + ND_Open, /* 1: Device is open. */ + ND_ReadOnly, /* 1: Device is read-only. */ + ND_Dirty, /* 1: Device is dirty, needs sync. */ +} ntfs_device_state_bits; + +#define test_ndev_flag(nd, flag) test_bit(ND_##flag, (nd)->d_state) +#define set_ndev_flag(nd, flag) set_bit(ND_##flag, (nd)->d_state) +#define clear_ndev_flag(nd, flag) clear_bit(ND_##flag, (nd)->d_state) + +#define NDevOpen(nd) test_ndev_flag(nd, Open) +#define NDevSetOpen(nd) set_ndev_flag(nd, Open) +#define NDevClearOpen(nd) clear_ndev_flag(nd, Open) + +#define NDevReadOnly(nd) test_ndev_flag(nd, ReadOnly) +#define NDevSetReadOnly(nd) set_ndev_flag(nd, ReadOnly) +#define NDevClearReadOnly(nd) clear_ndev_flag(nd, ReadOnly) + +#define NDevDirty(nd) test_ndev_flag(nd, Dirty) +#define NDevSetDirty(nd) set_ndev_flag(nd, Dirty) +#define NDevClearDirty(nd) clear_ndev_flag(nd, Dirty) + +/* + * The ntfs device structure defining all operations needed to access the low + * level device underlying the ntfs volume. + */ +struct ntfs_device { + struct ntfs_device_operations *d_ops; /* Device operations. */ + unsigned long d_state; /* State of the device. */ + char *d_name; /* Name of device. */ + void *d_private; /* Private data used by the + device operations. */ +}; + +/* + * The ntfs device operations defining all operations that can be performed on + * the low level device described by a ntfs device structure. + */ +struct ntfs_device_operations { + int (*open)(struct ntfs_device *dev, int flags); + int (*close)(struct ntfs_device *dev); + s64 (*seek)(struct ntfs_device *dev, s64 offset, int whence); + s64 (*read)(struct ntfs_device *dev, void *buf, s64 count); + s64 (*write)(struct ntfs_device *dev, const void *buf, s64 count); + s64 (*pread)(struct ntfs_device *dev, void *buf, s64 count, s64 offset); + s64 (*pwrite)(struct ntfs_device *dev, const void *buf, s64 count, + s64 offset); + int (*sync)(struct ntfs_device *dev); + int (*stat)(struct ntfs_device *dev, struct stat *buf); + int (*ioctl)(struct ntfs_device *dev, int request, void *argp); +}; + +extern struct ntfs_device *ntfs_device_alloc(const char *name, const long state, + struct ntfs_device_operations *dops, void *private); +extern int ntfs_device_free(struct ntfs_device *dev); + +extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, + void *b); +extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, + const void *b); + +extern s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count, + const u32 bksize, void *b); +extern s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, + const u32 bksize, void *b); + +extern s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, + const s64 count, void *b); +extern s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, + const s64 count, const void *b); + +extern s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size); + +#endif /* defined _NTFS_DEVICE_H */ From 9d1e7a0987e06ad3980ebf1c1c0448f1adca2faa Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0992/2994] Rename: include/device.h -> include/ntfs/device.h }(Logical change 1.280) --- include/device.h | 110 ----------------------------------------------- 1 file changed, 110 deletions(-) delete mode 100644 include/device.h diff --git a/include/device.h b/include/device.h deleted file mode 100644 index c9490cd9..00000000 --- a/include/device.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * device.h - Exports for low level device io. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2004 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_DEVICE_H -#define _NTFS_DEVICE_H - -#include "config.h" - -#include - -#include "device_io.h" -#include "types.h" -#include "support.h" -#include "volume.h" - -/* - * Defined bits for the state field in the ntfs_device structure. - */ -typedef enum { - ND_Open, /* 1: Device is open. */ - ND_ReadOnly, /* 1: Device is read-only. */ - ND_Dirty, /* 1: Device is dirty, needs sync. */ -} ntfs_device_state_bits; - -#define test_ndev_flag(nd, flag) test_bit(ND_##flag, (nd)->d_state) -#define set_ndev_flag(nd, flag) set_bit(ND_##flag, (nd)->d_state) -#define clear_ndev_flag(nd, flag) clear_bit(ND_##flag, (nd)->d_state) - -#define NDevOpen(nd) test_ndev_flag(nd, Open) -#define NDevSetOpen(nd) set_ndev_flag(nd, Open) -#define NDevClearOpen(nd) clear_ndev_flag(nd, Open) - -#define NDevReadOnly(nd) test_ndev_flag(nd, ReadOnly) -#define NDevSetReadOnly(nd) set_ndev_flag(nd, ReadOnly) -#define NDevClearReadOnly(nd) clear_ndev_flag(nd, ReadOnly) - -#define NDevDirty(nd) test_ndev_flag(nd, Dirty) -#define NDevSetDirty(nd) set_ndev_flag(nd, Dirty) -#define NDevClearDirty(nd) clear_ndev_flag(nd, Dirty) - -/* - * The ntfs device structure defining all operations needed to access the low - * level device underlying the ntfs volume. - */ -struct ntfs_device { - struct ntfs_device_operations *d_ops; /* Device operations. */ - unsigned long d_state; /* State of the device. */ - char *d_name; /* Name of device. */ - void *d_private; /* Private data used by the - device operations. */ -}; - -/* - * The ntfs device operations defining all operations that can be performed on - * the low level device described by a ntfs device structure. - */ -struct ntfs_device_operations { - int (*open)(struct ntfs_device *dev, int flags); - int (*close)(struct ntfs_device *dev); - s64 (*seek)(struct ntfs_device *dev, s64 offset, int whence); - s64 (*read)(struct ntfs_device *dev, void *buf, s64 count); - s64 (*write)(struct ntfs_device *dev, const void *buf, s64 count); - s64 (*pread)(struct ntfs_device *dev, void *buf, s64 count, s64 offset); - s64 (*pwrite)(struct ntfs_device *dev, const void *buf, s64 count, - s64 offset); - int (*sync)(struct ntfs_device *dev); - int (*stat)(struct ntfs_device *dev, struct stat *buf); - int (*ioctl)(struct ntfs_device *dev, int request, void *argp); -}; - -extern struct ntfs_device *ntfs_device_alloc(const char *name, const long state, - struct ntfs_device_operations *dops, void *private); -extern int ntfs_device_free(struct ntfs_device *dev); - -extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, - void *b); -extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, - const void *b); - -extern s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count, - const u32 bksize, void *b); -extern s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, - const u32 bksize, void *b); - -extern s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, - const s64 count, void *b); -extern s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, - const s64 count, const void *b); - -extern s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size); - -#endif /* defined _NTFS_DEVICE_H */ From 52ff000fe93f8446bbc3567eb87ef44b01f3e784 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0993/2994] Rename: include/device_io.h -> include/ntfs/device_io.h (Logical change 1.280) --- include/ntfs/device_io.h | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/include/ntfs/device_io.h b/include/ntfs/device_io.h index e69de29b..03e03849 100644 --- a/include/ntfs/device_io.h +++ b/include/ntfs/device_io.h @@ -0,0 +1,46 @@ +/* + * device_io.h - Exports for default device io. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_DEVICE_IO_H +#define _NTFS_DEVICE_IO_H + +#include "config.h" + +#ifndef __CYGWIN32__ + +/* Not on Cygwin; use standard Unix style low level device operations. */ +#define ntfs_device_default_io_ops ntfs_device_unix_io_ops + +#else /* __CYGWIN32__ */ + +/* On Cygwin; use Win32 low level device operations. */ +#define ntfs_device_default_io_ops ntfs_device_win32_io_ops + +#endif /* __CYGWIN32__ */ + + +/* Forward declaration. */ +struct ntfs_device_operations; + +extern struct ntfs_device_operations ntfs_device_default_io_ops; + +#endif /* defined _NTFS_DEVICE_IO_H */ + From 4c0f3b21d0ad5cb1ab64ffac847337f494408cd1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0994/2994] Rename: include/device_io.h -> include/ntfs/device_io.h }(Logical change 1.280) --- include/device_io.h | 46 --------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 include/device_io.h diff --git a/include/device_io.h b/include/device_io.h deleted file mode 100644 index 03e03849..00000000 --- a/include/device_io.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * device_io.h - Exports for default device io. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2004 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_DEVICE_IO_H -#define _NTFS_DEVICE_IO_H - -#include "config.h" - -#ifndef __CYGWIN32__ - -/* Not on Cygwin; use standard Unix style low level device operations. */ -#define ntfs_device_default_io_ops ntfs_device_unix_io_ops - -#else /* __CYGWIN32__ */ - -/* On Cygwin; use Win32 low level device operations. */ -#define ntfs_device_default_io_ops ntfs_device_win32_io_ops - -#endif /* __CYGWIN32__ */ - - -/* Forward declaration. */ -struct ntfs_device_operations; - -extern struct ntfs_device_operations ntfs_device_default_io_ops; - -#endif /* defined _NTFS_DEVICE_IO_H */ - From 00fa855ac7a5d830e6a75d16afc789018d0a8968 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0995/2994] Rename: include/dir.h -> include/ntfs/dir.h (Logical change 1.280) --- include/ntfs/dir.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index e69de29b..e13e3753 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -0,0 +1,60 @@ +/* + * dir.h - Exports for directory handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_DIR_H +#define _NTFS_DIR_H + +#include "types.h" + +/* The little endian Unicode string $I30 as a global constant. */ +extern uchar_t I30[5]; + +extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, + const uchar_t *uname, const int uname_len); + +/* + * File types (adapted from include ) + */ +#define NTFS_DT_UNKNOWN 0 +#define NTFS_DT_FIFO 1 +#define NTFS_DT_CHR 2 +#define NTFS_DT_DIR 4 +#define NTFS_DT_BLK 6 +#define NTFS_DT_REG 8 +#define NTFS_DT_LNK 10 +#define NTFS_DT_SOCK 12 +#define NTFS_DT_WHT 14 + +/* + * This is the "ntfs_filldir" function type, used by ntfs_readdir() to let + * the caller specify what kind of dirent layout it wants to have. + * This allows the caller to read directories into their application or + * to have different dirent layouts depending on the binary type. + */ +typedef int (*ntfs_filldir_t)(void *dirent, const uchar_t *name, + const int name_len, const int name_type, const s64 pos, + const MFT_REF mref, const unsigned dt_type); + +extern int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, + void *dirent, ntfs_filldir_t filldir); + +#endif /* defined _NTFS_DIR_H */ + From 7be2dcc70ee4cca964511f3578e06e692279f499 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0996/2994] Rename: include/dir.h -> include/ntfs/dir.h }(Logical change 1.280) --- include/dir.h | 60 --------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 include/dir.h diff --git a/include/dir.h b/include/dir.h deleted file mode 100644 index e13e3753..00000000 --- a/include/dir.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * dir.h - Exports for directory handling. Part of the Linux-NTFS project. - * - * Copyright (c) 2002 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_DIR_H -#define _NTFS_DIR_H - -#include "types.h" - -/* The little endian Unicode string $I30 as a global constant. */ -extern uchar_t I30[5]; - -extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, - const uchar_t *uname, const int uname_len); - -/* - * File types (adapted from include ) - */ -#define NTFS_DT_UNKNOWN 0 -#define NTFS_DT_FIFO 1 -#define NTFS_DT_CHR 2 -#define NTFS_DT_DIR 4 -#define NTFS_DT_BLK 6 -#define NTFS_DT_REG 8 -#define NTFS_DT_LNK 10 -#define NTFS_DT_SOCK 12 -#define NTFS_DT_WHT 14 - -/* - * This is the "ntfs_filldir" function type, used by ntfs_readdir() to let - * the caller specify what kind of dirent layout it wants to have. - * This allows the caller to read directories into their application or - * to have different dirent layouts depending on the binary type. - */ -typedef int (*ntfs_filldir_t)(void *dirent, const uchar_t *name, - const int name_len, const int name_type, const s64 pos, - const MFT_REF mref, const unsigned dt_type); - -extern int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, - void *dirent, ntfs_filldir_t filldir); - -#endif /* defined _NTFS_DIR_H */ - From c1e3dc03beb51160615e577c0763a82b8f84cb69 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0997/2994] Rename: include/endians.h -> include/ntfs/endians.h (Logical change 1.280) --- include/ntfs/endians.h | 158 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h index e69de29b..75f464d1 100644 --- a/include/ntfs/endians.h +++ b/include/ntfs/endians.h @@ -0,0 +1,158 @@ +/* + * endians.h - Definitions related to handling of byte ordering. Part of the + * Linux-NTFS project. + * + * Copyright (c) 2000-2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_ENDIANS_H +#define _NTFS_ENDIANS_H + +#include "config.h" + +/* + * Notes: + * + * We define the conversion functions including typecasts since the + * defaults don't necessarily perform appropriate typecasts. + * Also, using our own functions means that we can change them if it + * turns out that we do need to use the unaligned access macros on + * architectures requiring aligned memory accesses... + */ + +#ifdef HAVE_ENDIAN_H +# include +#endif +#ifdef HAVE_SYS_ENDIAN_H +# include +#endif +#ifdef HAVE_MACHINE_ENDIAN_H +# include +#endif +#ifndef __BYTE_ORDER +# ifdef _BYTE_ORDER +# define __BYTE_ORDER _BYTE_ORDER +# define __LITTLE_ENDIAN _LITTLE_ENDIAN +# define __BIG_ENDIAN _BIG_ENDIAN +# else +# ifdef BYTE_ORDER +# define __BYTE_ORDER BYTE_ORDER +# define __LITTLE_ENDIAN LITTLE_ENDIAN +# define __BIG_ENDIAN BIG_ENDIAN +# endif +# endif +#endif +#ifdef HAVE_BYTESWAP_H +# include +#endif + +#if (__BYTE_ORDER == __LITTLE_ENDIAN) + +#define __le16_to_cpu(x) (x) +#define __le32_to_cpu(x) (x) +#define __le64_to_cpu(x) (x) + +#define __cpu_to_le16(x) (x) +#define __cpu_to_le32(x) (x) +#define __cpu_to_le64(x) (x) + +#define __constant_le16_to_cpu(x) (x) +#define __constant_le32_to_cpu(x) (x) +#define __constant_le64_to_cpu(x) (x) + +#define __constant_cpu_to_le16(x) (x) +#define __constant_cpu_to_le32(x) (x) +#define __constant_cpu_to_le64(x) (x) + +#elif (__BYTE_ORDER == __BIG_ENDIAN) + +#define __le16_to_cpu(x) bswap_16(x) +#define __le32_to_cpu(x) bswap_32(x) +#define __le64_to_cpu(x) bswap_64(x) + +#define __cpu_to_le16(x) bswap_16(x) +#define __cpu_to_le32(x) bswap_32(x) +#define __cpu_to_le64(x) bswap_64(x) + +#define __constant_le16_to_cpu(x) __bswap_constant_16(x) +#define __constant_le32_to_cpu(x) __bswap_constant_32(x) +#define __constant_le64_to_cpu(x) __bswap_constant_64(x) + +#define __constant_cpu_to_le16(x) __bswap_constant_16(x) +#define __constant_cpu_to_le32(x) __bswap_constant_32(x) +#define __constant_cpu_to_le64(x) __bswap_constant_64(x) + +#else + +#error "You must define __BYTE_ORDER to be __LITTLE_ENDIAN or __BIG_ENDIAN" + +#endif + +/* Unsigned from LE to CPU conversion. */ + +#define le16_to_cpu(x) (u16)__le16_to_cpu((u16)(x)) +#define le32_to_cpu(x) (u32)__le32_to_cpu((u32)(x)) +#define le64_to_cpu(x) (u64)__le64_to_cpu((u64)(x)) + +#define le16_to_cpup(x) (u16)__le16_to_cpu(*(u16*)(x)) +#define le32_to_cpup(x) (u32)__le32_to_cpu(*(u32*)(x)) +#define le64_to_cpup(x) (u64)__le64_to_cpu(*(u64*)(x)) + +/* Signed from LE to CPU conversion. */ + +#define sle16_to_cpu(x) (s16)__le16_to_cpu((s16)(x)) +#define sle32_to_cpu(x) (s32)__le32_to_cpu((s32)(x)) +#define sle64_to_cpu(x) (s64)__le64_to_cpu((s64)(x)) + +#define sle16_to_cpup(x) (s16)__le16_to_cpu(*(s16*)(x)) +#define sle32_to_cpup(x) (s32)__le32_to_cpu(*(s32*)(x)) +#define sle64_to_cpup(x) (s64)__le64_to_cpu(*(s64*)(x)) + +/* Unsigned from CPU to LE conversion. */ + +#define cpu_to_le16(x) (u16)__cpu_to_le16((u16)(x)) +#define cpu_to_le32(x) (u32)__cpu_to_le32((u32)(x)) +#define cpu_to_le64(x) (u64)__cpu_to_le64((u64)(x)) + +#define cpu_to_le16p(x) (u16)__cpu_to_le16(*(u16*)(x)) +#define cpu_to_le32p(x) (u32)__cpu_to_le32(*(u32*)(x)) +#define cpu_to_le64p(x) (u64)__cpu_to_le64(*(u64*)(x)) + +/* Signed from CPU to LE conversion. */ + +#define scpu_to_le16(x) (s16)__cpu_to_le16((s16)(x)) +#define scpu_to_le32(x) (s32)__cpu_to_le32((s32)(x)) +#define scpu_to_le64(x) (s64)__cpu_to_le64((s64)(x)) + +#define scpu_to_le16p(x) (s16)__cpu_to_le16(*(s16*)(x)) +#define scpu_to_le32p(x) (s32)__cpu_to_le32(*(s32*)(x)) +#define scpu_to_le64p(x) (s64)__cpu_to_le64(*(s64*)(x)) + +/* + * Constant endianness conversion defines. + */ +#define const_le16_to_cpu(x) __constant_le16_to_cpu(x) +#define const_le32_to_cpu(x) __constant_le32_to_cpu(x) +#define const_le64_to_cpu(x) __constant_le64_to_cpu(x) + +#define const_cpu_to_le16(x) __constant_cpu_to_le16(x) +#define const_cpu_to_le32(x) __constant_cpu_to_le32(x) +#define const_cpu_to_le64(x) __constant_cpu_to_le64(x) + +#endif /* defined _NTFS_ENDIANS_H */ + From e7d3d0e4201b53896b1e77cbc970db28d89d1818 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0998/2994] Rename: include/endians.h -> include/ntfs/endians.h }(Logical change 1.280) --- include/endians.h | 158 ---------------------------------------------- 1 file changed, 158 deletions(-) delete mode 100644 include/endians.h diff --git a/include/endians.h b/include/endians.h deleted file mode 100644 index 75f464d1..00000000 --- a/include/endians.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * endians.h - Definitions related to handling of byte ordering. Part of the - * Linux-NTFS project. - * - * Copyright (c) 2000-2004 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_ENDIANS_H -#define _NTFS_ENDIANS_H - -#include "config.h" - -/* - * Notes: - * - * We define the conversion functions including typecasts since the - * defaults don't necessarily perform appropriate typecasts. - * Also, using our own functions means that we can change them if it - * turns out that we do need to use the unaligned access macros on - * architectures requiring aligned memory accesses... - */ - -#ifdef HAVE_ENDIAN_H -# include -#endif -#ifdef HAVE_SYS_ENDIAN_H -# include -#endif -#ifdef HAVE_MACHINE_ENDIAN_H -# include -#endif -#ifndef __BYTE_ORDER -# ifdef _BYTE_ORDER -# define __BYTE_ORDER _BYTE_ORDER -# define __LITTLE_ENDIAN _LITTLE_ENDIAN -# define __BIG_ENDIAN _BIG_ENDIAN -# else -# ifdef BYTE_ORDER -# define __BYTE_ORDER BYTE_ORDER -# define __LITTLE_ENDIAN LITTLE_ENDIAN -# define __BIG_ENDIAN BIG_ENDIAN -# endif -# endif -#endif -#ifdef HAVE_BYTESWAP_H -# include -#endif - -#if (__BYTE_ORDER == __LITTLE_ENDIAN) - -#define __le16_to_cpu(x) (x) -#define __le32_to_cpu(x) (x) -#define __le64_to_cpu(x) (x) - -#define __cpu_to_le16(x) (x) -#define __cpu_to_le32(x) (x) -#define __cpu_to_le64(x) (x) - -#define __constant_le16_to_cpu(x) (x) -#define __constant_le32_to_cpu(x) (x) -#define __constant_le64_to_cpu(x) (x) - -#define __constant_cpu_to_le16(x) (x) -#define __constant_cpu_to_le32(x) (x) -#define __constant_cpu_to_le64(x) (x) - -#elif (__BYTE_ORDER == __BIG_ENDIAN) - -#define __le16_to_cpu(x) bswap_16(x) -#define __le32_to_cpu(x) bswap_32(x) -#define __le64_to_cpu(x) bswap_64(x) - -#define __cpu_to_le16(x) bswap_16(x) -#define __cpu_to_le32(x) bswap_32(x) -#define __cpu_to_le64(x) bswap_64(x) - -#define __constant_le16_to_cpu(x) __bswap_constant_16(x) -#define __constant_le32_to_cpu(x) __bswap_constant_32(x) -#define __constant_le64_to_cpu(x) __bswap_constant_64(x) - -#define __constant_cpu_to_le16(x) __bswap_constant_16(x) -#define __constant_cpu_to_le32(x) __bswap_constant_32(x) -#define __constant_cpu_to_le64(x) __bswap_constant_64(x) - -#else - -#error "You must define __BYTE_ORDER to be __LITTLE_ENDIAN or __BIG_ENDIAN" - -#endif - -/* Unsigned from LE to CPU conversion. */ - -#define le16_to_cpu(x) (u16)__le16_to_cpu((u16)(x)) -#define le32_to_cpu(x) (u32)__le32_to_cpu((u32)(x)) -#define le64_to_cpu(x) (u64)__le64_to_cpu((u64)(x)) - -#define le16_to_cpup(x) (u16)__le16_to_cpu(*(u16*)(x)) -#define le32_to_cpup(x) (u32)__le32_to_cpu(*(u32*)(x)) -#define le64_to_cpup(x) (u64)__le64_to_cpu(*(u64*)(x)) - -/* Signed from LE to CPU conversion. */ - -#define sle16_to_cpu(x) (s16)__le16_to_cpu((s16)(x)) -#define sle32_to_cpu(x) (s32)__le32_to_cpu((s32)(x)) -#define sle64_to_cpu(x) (s64)__le64_to_cpu((s64)(x)) - -#define sle16_to_cpup(x) (s16)__le16_to_cpu(*(s16*)(x)) -#define sle32_to_cpup(x) (s32)__le32_to_cpu(*(s32*)(x)) -#define sle64_to_cpup(x) (s64)__le64_to_cpu(*(s64*)(x)) - -/* Unsigned from CPU to LE conversion. */ - -#define cpu_to_le16(x) (u16)__cpu_to_le16((u16)(x)) -#define cpu_to_le32(x) (u32)__cpu_to_le32((u32)(x)) -#define cpu_to_le64(x) (u64)__cpu_to_le64((u64)(x)) - -#define cpu_to_le16p(x) (u16)__cpu_to_le16(*(u16*)(x)) -#define cpu_to_le32p(x) (u32)__cpu_to_le32(*(u32*)(x)) -#define cpu_to_le64p(x) (u64)__cpu_to_le64(*(u64*)(x)) - -/* Signed from CPU to LE conversion. */ - -#define scpu_to_le16(x) (s16)__cpu_to_le16((s16)(x)) -#define scpu_to_le32(x) (s32)__cpu_to_le32((s32)(x)) -#define scpu_to_le64(x) (s64)__cpu_to_le64((s64)(x)) - -#define scpu_to_le16p(x) (s16)__cpu_to_le16(*(s16*)(x)) -#define scpu_to_le32p(x) (s32)__cpu_to_le32(*(s32*)(x)) -#define scpu_to_le64p(x) (s64)__cpu_to_le64(*(s64*)(x)) - -/* - * Constant endianness conversion defines. - */ -#define const_le16_to_cpu(x) __constant_le16_to_cpu(x) -#define const_le32_to_cpu(x) __constant_le32_to_cpu(x) -#define const_le64_to_cpu(x) __constant_le64_to_cpu(x) - -#define const_cpu_to_le16(x) __constant_cpu_to_le16(x) -#define const_cpu_to_le32(x) __constant_cpu_to_le32(x) -#define const_cpu_to_le64(x) __constant_cpu_to_le64(x) - -#endif /* defined _NTFS_ENDIANS_H */ - From ad03d832e5ae9e3069bfefdfbc0eab4f60da6cef Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 0999/2994] Rename: include/gnome-vfs-method.h -> include/ntfs/gnome-vfs-method.h (Logical change 1.280) --- include/ntfs/gnome-vfs-method.h | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/include/ntfs/gnome-vfs-method.h b/include/ntfs/gnome-vfs-method.h index e69de29b..ca7cb87a 100644 --- a/include/ntfs/gnome-vfs-method.h +++ b/include/ntfs/gnome-vfs-method.h @@ -0,0 +1,41 @@ +/* + * gnome-vfs-method.h - Export for Gnome-VFS init/shutdown implementation of + * interface to libntfs. Par of the Linux-NTFS project. + * + * Copyright (c) 2002-2003 Jan Kratochvil + * Copyright (c) 2000-2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_GNOME_VFS_METHOD_H +#define _NTFS_GNOME_VFS_METHOD_H + +#include "config.h" + +#include + +G_BEGIN_DECLS + +GnomeVFSMethod *libntfs_gnomevfs_method_init(const gchar *method_name, + const gchar *args); + +void libntfs_gnomevfs_method_shutdown(void); + +G_END_DECLS + +#endif /* _NTFS_GNOME_VFS_METHOD_H */ + From baf0188ac5f6aeae859911968601469071eeebfb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1000/2994] Rename: include/gnome-vfs-method.h -> include/ntfs/gnome-vfs-method.h }(Logical change 1.280) --- include/gnome-vfs-method.h | 41 -------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 include/gnome-vfs-method.h diff --git a/include/gnome-vfs-method.h b/include/gnome-vfs-method.h deleted file mode 100644 index ca7cb87a..00000000 --- a/include/gnome-vfs-method.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * gnome-vfs-method.h - Export for Gnome-VFS init/shutdown implementation of - * interface to libntfs. Par of the Linux-NTFS project. - * - * Copyright (c) 2002-2003 Jan Kratochvil - * Copyright (c) 2000-2004 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_GNOME_VFS_METHOD_H -#define _NTFS_GNOME_VFS_METHOD_H - -#include "config.h" - -#include - -G_BEGIN_DECLS - -GnomeVFSMethod *libntfs_gnomevfs_method_init(const gchar *method_name, - const gchar *args); - -void libntfs_gnomevfs_method_shutdown(void); - -G_END_DECLS - -#endif /* _NTFS_GNOME_VFS_METHOD_H */ - From 7d26c4c57e76799a266fb869cf499536db5a996e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1001/2994] Rename: include/gnome-vfs-module.h -> include/ntfs/gnome-vfs-module.h (Logical change 1.280) --- include/ntfs/gnome-vfs-module.h | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/include/ntfs/gnome-vfs-module.h b/include/ntfs/gnome-vfs-module.h index e69de29b..7de4665c 100644 --- a/include/ntfs/gnome-vfs-module.h +++ b/include/ntfs/gnome-vfs-module.h @@ -0,0 +1,40 @@ +/* + * gnome-vfs-module.h - Exports for Gnome-VFS init/shutdown implementation of + * interface to libntfs. Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Jan Kratochvil + * Copyright (c) 2000-2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_GNOME_VFS_MODULE_H +#define _NTFS_GNOME_VFS_MODULE_H + +#include "config.h" + +G_BEGIN_DECLS + +G_LOCK_EXTERN(libntfs); + +#define libntfs_newn(objp, n) ((objp) = g_new(typeof(*(objp)), (n))) +#define libntfs_new(objp) (libntfs_newn((objp), 1)) +#define LIBNTFS_MEMZERO(objp) (memset((objp), 0, sizeof(*(objp)))) + +G_END_DECLS + +#endif /* _NTFS_GNOME_VFS_MODULE_H */ + From 982c071d0e8d76321f89f02c8bc45f5efe88a967 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1002/2994] Rename: include/gnome-vfs-module.h -> include/ntfs/gnome-vfs-module.h }(Logical change 1.280) --- include/gnome-vfs-module.h | 40 -------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 include/gnome-vfs-module.h diff --git a/include/gnome-vfs-module.h b/include/gnome-vfs-module.h deleted file mode 100644 index 7de4665c..00000000 --- a/include/gnome-vfs-module.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * gnome-vfs-module.h - Exports for Gnome-VFS init/shutdown implementation of - * interface to libntfs. Part of the Linux-NTFS project. - * - * Copyright (c) 2003 Jan Kratochvil - * Copyright (c) 2000-2004 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_GNOME_VFS_MODULE_H -#define _NTFS_GNOME_VFS_MODULE_H - -#include "config.h" - -G_BEGIN_DECLS - -G_LOCK_EXTERN(libntfs); - -#define libntfs_newn(objp, n) ((objp) = g_new(typeof(*(objp)), (n))) -#define libntfs_new(objp) (libntfs_newn((objp), 1)) -#define LIBNTFS_MEMZERO(objp) (memset((objp), 0, sizeof(*(objp)))) - -G_END_DECLS - -#endif /* _NTFS_GNOME_VFS_MODULE_H */ - From 2661b1d8fbb1ec3ad282d688410f1042c6e4875b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1003/2994] Rename: include/inode.h -> include/ntfs/inode.h (Logical change 1.280) --- include/ntfs/inode.h | 138 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index e69de29b..24fc7bc4 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -0,0 +1,138 @@ +/* + * inode.h - Defines for NTFS inode handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2001,2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_INODE_H +#define _NTFS_INODE_H + +/* Forward declaration */ +typedef struct _ntfs_inode ntfs_inode; + +#include "types.h" +#include "support.h" +#include "runlist.h" + +/* + * Defined bits for the state field in the ntfs_inode structure. + * (f) = files only, (d) = directories only + */ +typedef enum { + NI_Dirty, /* 1: Mft record needs to be written to disk. */ + + /* The NI_AttrList* tests only make sense for base inodes. */ + NI_AttrList, /* 1: Mft record contains an attribute list. */ + NI_AttrListNonResident, /* 1: Attribute list is non-resident. Implies + NI_AttrList is set. */ + NI_AttrListDirty, /* 1: Attribute list needs to be written to the + mft record and then to disk. */ +} ntfs_inode_state_bits; + +#define test_nino_flag(ni, flag) test_bit(NI_##flag, (ni)->state) +#define set_nino_flag(ni, flag) set_bit(NI_##flag, (ni)->state) +#define clear_nino_flag(ni, flag) clear_bit(NI_##flag, (ni)->state) + +#define test_and_set_nino_flag(ni, flag) \ + test_and_set_bit(NI_##flag, (ni)->state) +#define test_and_clear_nino_flag(ni, flag) \ + test_and_clear_bit(NI_##flag, (ni)->state) + +#define NInoDirty(ni) test_nino_flag(ni, Dirty) +#define NInoSetDirty(ni) set_nino_flag(ni, Dirty) +#define NInoClearDirty(ni) clear_nino_flag(ni, Dirty) +#define NInoTestAndSetDirty(ni) test_and_set_nino_flag(ni, Dirty) +#define NInoTestAndClearDirty(ni) test_and_clear_nino_flag(ni, Dirty) + +#define NInoAttrList(ni) test_nino_flag(ni, AttrList) +#define NInoSetAttrList(ni) set_nino_flag(ni, AttrList) +#define NInoClearAttrList(ni) clear_nino_flag(ni, AttrList) + + +#define test_nino_al_flag(ni, flag) test_nino_flag(ni, AttrList##flag) +#define set_nino_al_flag(ni, flag) set_nino_flag(ni, AttrList##flag) +#define clear_nino_al_flag(ni, flag) clear_nino_flag(ni, AttrList##flag) + +#define NInoAttrListNonResident(ni) test_nino_al_flag(ni, NonResident) +#define NInoSetAttrListNonResident(ni) set_nino_al_flag(ni, NonResident) +#define NInoClearAttrListNonResident(ni) clear_nino_al_flag(ni, NonResident) + +#define NInoAttrListDirty(ni) test_nino_al_flag(ni, Dirty) +#define NInoAttrListSetDirty(ni) set_nino_al_flag(ni, Dirty) +#define NInoAttrListClearDirty(ni) clear_nino_al_flag(ni, Dirty) + +/* + * The NTFS in-memory inode structure. It is just used as an extension to the + * fields already provided in the VFS inode. + */ +struct _ntfs_inode { + u64 mft_no; /* Inode / mft record number. */ + MFT_RECORD *mrec; /* The actual mft record of the inode. */ + ntfs_volume *vol; /* Pointer to the ntfs volume of this inode. */ + unsigned long state; /* NTFS specific flags describing this inode. + See ntfs_inode_state_bits above. */ + /* + * Attribute list support (for use by the attribute lookup functions). + * Setup during ntfs_open_inode() for all inodes with attribute lists. + * Only valid if NI_AttrList is set in state, further attr_list_rl is + * only valid if NI_AttrListNonResident is set. + */ + u32 attr_list_size; /* Length of attribute list value in bytes. */ + u8 *attr_list; /* Attribute list value itself. */ + runlist *attr_list_rl; /* Run list for the attribute list value. */ + /* Below fields are always valid. */ + s32 nr_extents; /* For a base mft record, the number of + attached extent inodes (0 if none), for + extent records this is -1. */ + union { /* This union is only used if nr_extents != 0. */ + ntfs_inode **extent_nis;/* For nr_extents > 0, array of the + ntfs inodes of the extent mft + records belonging to this base + inode which have been loaded. */ + ntfs_inode *base_ni; /* For nr_extents == -1, the ntfs + inode of the base mft record. */ + }; +}; + +extern ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref); + +extern int ntfs_inode_close(ntfs_inode *ni); + +extern ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, + const MFT_REF mref); + +/** + * ntfs_inode_mark_dirty - set the inode (and its base inode if it exists) dirty + * @ni: ntfs inode to set dirty + * + * Set the inode @ni dirty so it is written out later (at the latest at + * ntfs_inode_close() time). If @ni is an extent inode, set the base inode + * dirty, too. + * + * This function cannot fail. + */ +static __inline__ void ntfs_inode_mark_dirty(ntfs_inode *ni) { + NInoSetDirty(ni); + if (ni->nr_extents == -1) + NInoSetDirty(ni->base_ni); +} + +extern int ntfs_inode_sync(ntfs_inode *ni); + +#endif /* defined _NTFS_INODE_H */ + From fe4841914060db6d3415adf83d35d3f400afbcad Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1004/2994] Rename: include/inode.h -> include/ntfs/inode.h }(Logical change 1.280) --- include/inode.h | 138 ------------------------------------------------ 1 file changed, 138 deletions(-) delete mode 100644 include/inode.h diff --git a/include/inode.h b/include/inode.h deleted file mode 100644 index 24fc7bc4..00000000 --- a/include/inode.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * inode.h - Defines for NTFS inode handling. Part of the Linux-NTFS project. - * - * Copyright (c) 2001,2002 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_INODE_H -#define _NTFS_INODE_H - -/* Forward declaration */ -typedef struct _ntfs_inode ntfs_inode; - -#include "types.h" -#include "support.h" -#include "runlist.h" - -/* - * Defined bits for the state field in the ntfs_inode structure. - * (f) = files only, (d) = directories only - */ -typedef enum { - NI_Dirty, /* 1: Mft record needs to be written to disk. */ - - /* The NI_AttrList* tests only make sense for base inodes. */ - NI_AttrList, /* 1: Mft record contains an attribute list. */ - NI_AttrListNonResident, /* 1: Attribute list is non-resident. Implies - NI_AttrList is set. */ - NI_AttrListDirty, /* 1: Attribute list needs to be written to the - mft record and then to disk. */ -} ntfs_inode_state_bits; - -#define test_nino_flag(ni, flag) test_bit(NI_##flag, (ni)->state) -#define set_nino_flag(ni, flag) set_bit(NI_##flag, (ni)->state) -#define clear_nino_flag(ni, flag) clear_bit(NI_##flag, (ni)->state) - -#define test_and_set_nino_flag(ni, flag) \ - test_and_set_bit(NI_##flag, (ni)->state) -#define test_and_clear_nino_flag(ni, flag) \ - test_and_clear_bit(NI_##flag, (ni)->state) - -#define NInoDirty(ni) test_nino_flag(ni, Dirty) -#define NInoSetDirty(ni) set_nino_flag(ni, Dirty) -#define NInoClearDirty(ni) clear_nino_flag(ni, Dirty) -#define NInoTestAndSetDirty(ni) test_and_set_nino_flag(ni, Dirty) -#define NInoTestAndClearDirty(ni) test_and_clear_nino_flag(ni, Dirty) - -#define NInoAttrList(ni) test_nino_flag(ni, AttrList) -#define NInoSetAttrList(ni) set_nino_flag(ni, AttrList) -#define NInoClearAttrList(ni) clear_nino_flag(ni, AttrList) - - -#define test_nino_al_flag(ni, flag) test_nino_flag(ni, AttrList##flag) -#define set_nino_al_flag(ni, flag) set_nino_flag(ni, AttrList##flag) -#define clear_nino_al_flag(ni, flag) clear_nino_flag(ni, AttrList##flag) - -#define NInoAttrListNonResident(ni) test_nino_al_flag(ni, NonResident) -#define NInoSetAttrListNonResident(ni) set_nino_al_flag(ni, NonResident) -#define NInoClearAttrListNonResident(ni) clear_nino_al_flag(ni, NonResident) - -#define NInoAttrListDirty(ni) test_nino_al_flag(ni, Dirty) -#define NInoAttrListSetDirty(ni) set_nino_al_flag(ni, Dirty) -#define NInoAttrListClearDirty(ni) clear_nino_al_flag(ni, Dirty) - -/* - * The NTFS in-memory inode structure. It is just used as an extension to the - * fields already provided in the VFS inode. - */ -struct _ntfs_inode { - u64 mft_no; /* Inode / mft record number. */ - MFT_RECORD *mrec; /* The actual mft record of the inode. */ - ntfs_volume *vol; /* Pointer to the ntfs volume of this inode. */ - unsigned long state; /* NTFS specific flags describing this inode. - See ntfs_inode_state_bits above. */ - /* - * Attribute list support (for use by the attribute lookup functions). - * Setup during ntfs_open_inode() for all inodes with attribute lists. - * Only valid if NI_AttrList is set in state, further attr_list_rl is - * only valid if NI_AttrListNonResident is set. - */ - u32 attr_list_size; /* Length of attribute list value in bytes. */ - u8 *attr_list; /* Attribute list value itself. */ - runlist *attr_list_rl; /* Run list for the attribute list value. */ - /* Below fields are always valid. */ - s32 nr_extents; /* For a base mft record, the number of - attached extent inodes (0 if none), for - extent records this is -1. */ - union { /* This union is only used if nr_extents != 0. */ - ntfs_inode **extent_nis;/* For nr_extents > 0, array of the - ntfs inodes of the extent mft - records belonging to this base - inode which have been loaded. */ - ntfs_inode *base_ni; /* For nr_extents == -1, the ntfs - inode of the base mft record. */ - }; -}; - -extern ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref); - -extern int ntfs_inode_close(ntfs_inode *ni); - -extern ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, - const MFT_REF mref); - -/** - * ntfs_inode_mark_dirty - set the inode (and its base inode if it exists) dirty - * @ni: ntfs inode to set dirty - * - * Set the inode @ni dirty so it is written out later (at the latest at - * ntfs_inode_close() time). If @ni is an extent inode, set the base inode - * dirty, too. - * - * This function cannot fail. - */ -static __inline__ void ntfs_inode_mark_dirty(ntfs_inode *ni) { - NInoSetDirty(ni); - if (ni->nr_extents == -1) - NInoSetDirty(ni->base_ni); -} - -extern int ntfs_inode_sync(ntfs_inode *ni); - -#endif /* defined _NTFS_INODE_H */ - From 28ddffc9ca05c7bc3968a97ecc133f5f449da19a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1005/2994] Rename: include/layout.h -> include/ntfs/layout.h (Logical change 1.280) --- include/ntfs/layout.h | 2196 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2196 insertions(+) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index e69de29b..b62e6000 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -0,0 +1,2196 @@ +/* + * layout.h - Ntfs on-disk layout structures. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_LAYOUT_H +#define _NTFS_LAYOUT_H + +#include "types.h" +#include "endians.h" +#include "support.h" + +/* The NTFS oem_id */ +#define magicNTFS const_cpu_to_le64(0x202020205346544e) /* "NTFS " */ + +/* + * Location of bootsector on partition: + * The standard NTFS_BOOT_SECTOR is on sector 0 of the partition. + * On NT4 and above there is one backup copy of the boot sector to + * be found on the last sector of the partition (not normally accessible + * from within Windows as the bootsector contained number of sectors + * value is one less than the actual value!). + * On versions of NT 3.51 and earlier, the backup copy was located at + * number of sectors/2 (integer divide), i.e. in the middle of the volume. + */ + +/* + * BIOS parameter block (bpb) structure. + */ +typedef struct { + u16 bytes_per_sector; /* Size of a sector in bytes. */ + u8 sectors_per_cluster; /* Size of a cluster in sectors. */ + u16 reserved_sectors; /* zero */ + u8 fats; /* zero */ + u16 root_entries; /* zero */ + u16 sectors; /* zero */ + u8 media_type; /* 0xf8 = hard disk */ + u16 sectors_per_fat; /* zero */ + u16 sectors_per_track; /* irrelevant */ + u16 heads; /* irrelevant */ + u32 hidden_sectors; /* zero */ + u32 large_sectors; /* zero */ +/* sizeof() = 25 (0x19) bytes */ +} __attribute__ ((__packed__)) BIOS_PARAMETER_BLOCK; + +/* + * NTFS boot sector structure. + */ +typedef struct { + u8 jump[3]; /* Irrelevant (jump to boot up code).*/ + u64 oem_id; /* Magic "NTFS ". */ + BIOS_PARAMETER_BLOCK bpb; /* See BIOS_PARAMETER_BLOCK. */ + u8 unused[4]; /* zero, NTFS diskedit.exe states that + this is actually: + u8 physical_drive; // 0x80 + u8 current_head; // zero + u8 extended_boot_signature; // 0x80 + u8 unused; // zero + */ +/*0x28*/s64 number_of_sectors; /* Number of sectors in volume. Gives + maximum volume size of 2^63 sectors. + Assuming standard sector size of 512 + bytes, the maximum byte size is + approx. 4.7x10^21 bytes. (-; */ + s64 mft_lcn; /* Cluster location of mft data. */ + s64 mftmirr_lcn; /* Cluster location of copy of mft. */ + s8 clusters_per_mft_record; /* Mft record size in clusters. */ + u8 reserved0[3]; /* zero */ + s8 clusters_per_index_record; /* Index block size in clusters. */ + u8 reserved1[3]; /* zero */ + u64 volume_serial_number; /* Irrelevant (serial number). */ + u32 checksum; /* Boot sector checksum. */ +/*0x54*/u8 bootstrap[426]; /* Irrelevant (boot up code). */ + u16 end_of_sector_marker; /* End of bootsector magic. Always is + 0xaa55 in little endian. */ +/* sizeof() = 512 (0x200) bytes */ +} __attribute__ ((__packed__)) NTFS_BOOT_SECTOR; + +/* + * Magic identifiers present at the beginning of all ntfs record containing + * records (like mft records for example). + */ +typedef enum { + magic_BAAD = const_cpu_to_le32(0x44414142), /* BAAD == corrupt record */ + magic_CHKD = const_cpu_to_le32(0x424b4843), /* CHKD == chkdsk ??? */ + magic_FILE = const_cpu_to_le32(0x454c4946), /* FILE == mft entry */ + magic_HOLE = const_cpu_to_le32(0x454c4f48), /* HOLE == ? (NTFS 3.0+?) */ + magic_INDX = const_cpu_to_le32(0x58444e49), /* INDX == index buffer */ +} NTFS_RECORD_TYPES; + +/* + * Generic magic comparison macros. Finally found a use for the ## preprocessor + * operator! (-8 + */ +#define ntfs_is_magic(x, m) ( (u32)(x) == (u32)magic_##m ) +#define ntfs_is_magicp(p, m) ( *(u32*)(p) == (u32)magic_##m ) + +/* + * Specialised magic comparison macros. + */ +#define ntfs_is_baad_record(x) ( ntfs_is_magic (x, BAAD) ) +#define ntfs_is_baad_recordp(p) ( ntfs_is_magicp(p, BAAD) ) +#define ntfs_is_chkd_record(x) ( ntfs_is_magic (x, CHKD) ) +#define ntfs_is_chkd_recordp(p) ( ntfs_is_magicp(p, CHKD) ) +#define ntfs_is_file_record(x) ( ntfs_is_magic (x, FILE) ) +#define ntfs_is_file_recordp(p) ( ntfs_is_magicp(p, FILE) ) +#define ntfs_is_hole_record(x) ( ntfs_is_magic (x, HOLE) ) +#define ntfs_is_hole_recordp(p) ( ntfs_is_magicp(p, HOLE) ) +#define ntfs_is_indx_record(x) ( ntfs_is_magic (x, INDX) ) +#define ntfs_is_indx_recordp(p) ( ntfs_is_magicp(p, INDX) ) + +#define ntfs_is_mft_record(x) ( ntfs_is_file_record(x) ) +#define ntfs_is_mft_recordp(p) ( ntfs_is_file_recordp(p) ) + +/* + * Defines for the NTFS filesystem. Don't want to use BLOCK_SIZE and + * BLOCK_SIZE_BITS from the kernel as that is 1024 and hence too high for us. + */ +#define NTFS_SECTOR_SIZE 512 +#define NTFS_SECTOR_SIZE_BITS 9 + +/* + * The Update Sequence Array (usa) is an array of the u16 values which belong + * to the end of each sector protected by the update sequence record in which + * this array is contained. Note that the first entry is the Update Sequence + * Number (usn), a cyclic counter of how many times the protected record has + * been written to disk. The values 0 and -1 (ie. 0xffff) are not used. All + * last u16's of each sector have to be equal to the usn (during reading) or + * are set to it (during writing). If they are not, an incomplete multi sector + * transfer has occured when the data was written. + * The maximum size for the update sequence array is fixed to: + * maximum size = usa_ofs + (usa_count * 2) = 510 bytes + * The 510 bytes comes from the fact that the last u16 in the array has to + * (obviously) finish before the last u16 of the first 512-byte sector. + * This formula can be used as a consistency check in that usa_ofs + + * (usa_count * 2) has to be less than or equal to 510. + */ +typedef struct { + NTFS_RECORD_TYPES magic;/* A four-byte magic identifying the + record type and/or status. */ + u16 usa_ofs; /* Offset to the Update Sequence Array (usa) + from the start of the ntfs record. */ + u16 usa_count; /* Number of u16 sized entries in the usa + including the Update Sequence Number (usn), + thus the number of fixups is the usa_count + minus 1. */ +} __attribute__ ((__packed__)) NTFS_RECORD; + +/* + * System files mft record numbers. All these files are always marked as used + * in the bitmap attribute of the mft; presumably in order to avoid accidental + * allocation for random other mft records. Also, the sequence number for each + * of the system files is always equal to their mft record number and it is + * never modified. + */ +typedef enum { + FILE_MFT = 0, /* Master file table (mft). Data attribute + contains the entries and bitmap attribute + records which ones are in use (bit==1). */ + FILE_MFTMirr = 1, /* Mft mirror: copy of first four mft records + in data attribute. If cluster size > 4kiB, + copy of first N mft records, with + N = cluster_size / mft_record_size. */ + FILE_LogFile = 2, /* Journalling log in data attribute. */ + FILE_Volume = 3, /* Volume name attribute and volume information + attribute (flags and ntfs version). Windows + refers to this file as volume DASD (Direct + Access Storage Device). */ + FILE_AttrDef = 4, /* Array of attribute definitions in data + attribute. */ + FILE_root = 5, /* Root directory. */ + FILE_Bitmap = 6, /* Allocation bitmap of all clusters (lcns) in + data attribute. */ + FILE_Boot = 7, /* Boot sector (always at cluster 0) in data + attribute. */ + FILE_BadClus = 8, /* Contains all bad clusters in the non-resident + data attribute. */ + FILE_Secure = 9, /* Shared security descriptors in data attribute + and two indexes into the descriptors. + Appeared in Windows 2000. Before that, this + file was named $Quota but was unused. */ + FILE_UpCase = 10, /* Uppercase equivalents of all 65536 Unicode + characters in data attribute. */ + FILE_Extend = 11, /* Directory containing other system files (eg. + $ObjId, $Quota, $Reparse and $UsnJrnl). This + is new to NTFS3.0. */ + FILE_reserved12 = 12, /* Reserved for future use (records 12-15). */ + FILE_reserved13 = 13, + FILE_reserved14 = 14, + FILE_reserved15 = 15, + FILE_first_user = 16, /* First user file, used as test limit for + whether to allow opening a file or not. */ +} NTFS_SYSTEM_FILES; + +/* + * These are the so far known MFT_RECORD_* flags (16-bit) which contain + * information about the mft record in which they are present. + */ +typedef enum { + MFT_RECORD_IN_USE = const_cpu_to_le16(0x0001), + MFT_RECORD_IS_DIRECTORY = const_cpu_to_le16(0x0002), + MFT_REC_SPACE_FILLER = 0xffff /* Just to make flags 16-bit. */ +} __attribute__ ((__packed__)) MFT_RECORD_FLAGS; + +/* + * mft references (aka file references or file record segment references) are + * used whenever a structure needs to refer to a record in the mft. + * + * A reference consists of a 48-bit index into the mft and a 16-bit sequence + * number used to detect stale references. + * + * For error reporting purposes we treat the 48-bit index as a signed quantity. + * + * The sequence number is a circular counter (skipping 0) describing how many + * times the referenced mft record has been (re)used. This has to match the + * sequence number of the mft record being referenced, otherwise the reference + * is considered stale and removed (FIXME: only ntfsck or the driver itself?). + * + * If the sequence number is zero it is assumed that no sequence number + * consistency checking should be performed. + * + * FIXME: Since inodes are 32-bit as of now, the driver needs to always check + * for high_part being 0 and if not either BUG(), cause a panic() or handle + * the situation in some other way. This shouldn't be a problem as a volume has + * to become HUGE in order to need more than 32-bits worth of mft records. + * Assuming the standard mft record size of 1kb only the records (never mind + * the non-resident attributes, etc.) would require 4Tb of space on their own + * for the first 32 bits worth of records. This is only if some strange person + * doesn't decide to foul play and make the mft sparse which would be a really + * horrible thing to do as it would trash our current driver implementation. )-: + * Do I hear screams "we want 64-bit inodes!" ?!? (-; + * + * FIXME: The mft zone is defined as the first 12% of the volume. This space is + * reserved so that the mft can grow contiguously and hence doesn't become + * fragmented. Volume free space includes the empty part of the mft zone and + * when the volume's free 88% are used up, the mft zone is shrunk by a factor + * of 2, thus making more space available for more files/data. This process is + * repeated everytime there is no more free space except for the mft zone until + * there really is no more free space. + */ + +/* + * Typedef the MFT_REF as a 64-bit value for easier handling. + * Also define two unpacking macros to get to the reference (MREF) and + * sequence number (MSEQNO) respectively. + * The _LE versions are to be applied on little endian MFT_REFs. + * Note: The _LE versions will return a CPU endian formatted value! + */ +typedef enum { + MFT_REF_MASK_CPU = 0x0000ffffffffffffULL, + MFT_REF_MASK_LE = const_cpu_to_le64(0x0000ffffffffffffULL), +} MFT_REF_CONSTS; + +typedef u64 MFT_REF; + +#define MK_MREF(m, s) ((MFT_REF)(((MFT_REF)(s) << 48) | \ + ((MFT_REF)(m) & MFT_REF_MASK_CPU))) +#define MK_LE_MREF(m, s) const_cpu_to_le64(((MFT_REF)(((MFT_REF)(s) << 48) | \ + ((MFT_REF)(m) & MFT_REF_MASK_CPU)))) + +#define MREF(x) ((u64)((x) & MFT_REF_MASK_CPU)) +#define MSEQNO(x) ((u16)(((x) >> 48) & 0xffff)) +#define MREF_LE(x) ((u64)(const_le64_to_cpu(x) & MFT_REF_MASK_CPU)) +#define MSEQNO_LE(x) ((u16)((const_le64_to_cpu(x) >> 48) & 0xffff)) + +#define IS_ERR_MREF(x) (((x) & 0x0000800000000000ULL) ? 1 : 0) +#define ERR_MREF(x) ((u64)((s64)(x))) +#define MREF_ERR(x) ((int)((s64)(x))) + +/* + * The mft record header present at the beginning of every record in the mft. + * This is followed by a sequence of variable length attribute records which + * is terminated by an attribute of type AT_END which is a truncated attribute + * in that it only consists of the attribute type code AT_END and none of the + * other members of the attribute structure are present. + */ +typedef struct { +/*Ofs*/ +/* 0*/ NTFS_RECORD; /* Usually the magic is "FILE". */ +/* 8*/ u64 lsn; /* $LogFile sequence number for this record. + Changed every time the record is modified. */ +/* 16*/ u16 sequence_number; /* Number of times this mft record has been + reused. (See description for MFT_REF + above.) NOTE: The increment (skipping zero) + is done when the file is deleted. NOTE: If + this is zero it is left zero. */ +/* 18*/ u16 link_count; /* Number of hard links, i.e. the number of + directory entries referencing this record. + NOTE: Only used in mft base records. + NOTE: When deleting a directory entry we + check the link_count and if it is 1 we + delete the file. Otherwise we delete the + FILE_NAME_ATTR being referenced by the + directory entry from the mft record and + decrement the link_count. + FIXME: Careful with Win32 + DOS names! */ +/* 20*/ u16 attrs_offset; /* Byte offset to the first attribute in this + mft record from the start of the mft record. + NOTE: Must be aligned to 8-byte boundary. */ +/* 22*/ MFT_RECORD_FLAGS flags; /* Bit array of MFT_RECORD_FLAGS. When a file + is deleted, the MFT_RECORD_IN_USE flag is + set to zero. */ +/* 24*/ u32 bytes_in_use; /* Number of bytes used in this mft record. + NOTE: Must be aligned to 8-byte boundary. */ +/* 28*/ u32 bytes_allocated; /* Number of bytes allocated for this mft + record. This should be equal to the mft + record size. */ +/* 32*/ MFT_REF base_mft_record; /* This is zero for base mft records. + When it is not zero it is a mft reference + pointing to the base mft record to which + this record belongs (this is then used to + locate the attribute list attribute present + in the base record which describes this + extension record and hence might need + modification when the extension record + itself is modified, also locating the + attribute list also means finding the other + potential extents, belonging to the non-base + mft record). */ +/* 40*/ u16 next_attr_instance; /* The instance number that will be + assigned to the next attribute added to this + mft record. NOTE: Incremented each time + after it is used. NOTE: Every time the mft + record is reused this number is set to zero. + NOTE: The first instance number is always 0. + */ +/* sizeof() = 42 bytes */ +/* NTFS 3.1+ (Windows XP and above) introduce the following additions. */ +/* 42*/ //u16 reserved; /* Reserved/alignment. */ +/* 44*/ //u32 mft_record_number; /* Number of this mft record. */ +/* sizeof() = 48 bytes */ +/* + * When (re)using the mft record, we place the update sequence array at this + * offset, i.e. before we start with the attributes. This also makes sense, + * otherwise we could run into problems with the update sequence array + * containing in itself the last two bytes of a sector which would mean that + * multi sector transfer protection wouldn't work. As you can't protect data + * by overwriting it since you then can't get it back... + * When reading we obviously use the data from the ntfs record header. + */ +} __attribute__ ((__packed__)) MFT_RECORD; + +/* + * System defined attributes (32-bit). Each attribute type has a corresponding + * attribute name (Unicode string of maximum 64 character length) as described + * by the attribute definitions present in the data attribute of the $AttrDef + * system file. On NTFS 3.0 volumes the names are just as the types are named + * in the below enum exchanging AT_ for the dollar sign ($). If that isn't a + * revealing choice of symbol... (-; + */ +typedef enum { + AT_UNUSED = const_cpu_to_le32( 0), + AT_STANDARD_INFORMATION = const_cpu_to_le32( 0x10), + AT_ATTRIBUTE_LIST = const_cpu_to_le32( 0x20), + AT_FILE_NAME = const_cpu_to_le32( 0x30), + AT_OBJECT_ID = const_cpu_to_le32( 0x40), + AT_SECURITY_DESCRIPTOR = const_cpu_to_le32( 0x50), + AT_VOLUME_NAME = const_cpu_to_le32( 0x60), + AT_VOLUME_INFORMATION = const_cpu_to_le32( 0x70), + AT_DATA = const_cpu_to_le32( 0x80), + AT_INDEX_ROOT = const_cpu_to_le32( 0x90), + AT_INDEX_ALLOCATION = const_cpu_to_le32( 0xa0), + AT_BITMAP = const_cpu_to_le32( 0xb0), + AT_REPARSE_POINT = const_cpu_to_le32( 0xc0), + AT_EA_INFORMATION = const_cpu_to_le32( 0xd0), + AT_EA = const_cpu_to_le32( 0xe0), + AT_PROPERTY_SET = const_cpu_to_le32( 0xf0), + AT_LOGGED_UTILITY_STREAM = const_cpu_to_le32( 0x100), + AT_FIRST_USER_DEFINED_ATTRIBUTE = const_cpu_to_le32( 0x1000), + AT_END = const_cpu_to_le32(0xffffffff), +} ATTR_TYPES; + +/* + * The collation rules for sorting views/indexes/etc (32-bit). + * + * COLLATION_UNICODE_STRING - Collate Unicode strings by comparing their binary + * Unicode values, except that when a character can be uppercased, the + * upper case value collates before the lower case one. + * COLLATION_FILE_NAME - Collate file names as Unicode strings. The collation + * is done very much like COLLATION_UNICODE_STRING. In fact I have no idea + * what the difference is. Perhaps the difference is that file names + * would treat some special characters in an odd way (see + * unistr.c::ntfs_collate_names() and unistr.c::legal_ansi_char_array[] + * for what I mean but COLLATION_UNICODE_STRING would not give any special + * treatment to any characters at all, but this is speculation. + * COLLATION_NTOFS_ULONG - Sorting is done according to ascending u32 key + * values. E.g. used for $SII index in FILE_Secure, which sorts by + * security_id (u32). + * COLLATION_NTOFS_SID - Sorting is done according to ascending SID values. + * E.g. used for $O index in FILE_Extend/$Quota. + * COLLATION_NTOFS_SECURITY_HASH - Sorting is done first by ascending hash + * values and second by ascending security_id values. E.g. used for $SDH + * index in FILE_Secure. + * COLLATION_NTOFS_ULONGS - Sorting is done according to a sequence of ascending + * u32 key values. E.g. used for $O index in FILE_Extend/$ObjId, which + * sorts by object_id (16-byte), by splitting up the object_id in four + * u32 values and using them as individual keys. E.g. take the following + * two security_ids, stored as follows on disk: + * 1st: a1 61 65 b7 65 7b d4 11 9e 3d 00 e0 81 10 42 59 + * 2nd: 38 14 37 d2 d2 f3 d4 11 a5 21 c8 6b 79 b1 97 45 + * To compare them, they are split into four u32 values each, like so: + * 1st: 0xb76561a1 0x11d47b65 0xe0003d9e 0x59421081 + * 2nd: 0xd2371438 0x11d4f3d2 0x6bc821a5 0x4597b179 + * Now, it is apparent why the 2nd object_id collates after the 1st: the + * first u32 value of the 1st object_id is less than the first u32 of + * the 2nd object_id. If the first u32 values of both object_ids were + * equal then the second u32 values would be compared, etc. + */ +typedef enum { + COLLATION_BINARY = const_cpu_to_le32(0), /* Collate by binary + compare where the first byte is most + significant. */ + COLLATION_FILE_NAME = const_cpu_to_le32(1), /* Collate file names + as Unicode strings. */ + COLLATION_UNICODE_STRING = const_cpu_to_le32(2), /* Collate Unicode + strings by comparing their binary + Unicode values, except that when a + character can be uppercased, the upper + case value collates before the lower + case one. */ + COLLATION_NTOFS_ULONG = const_cpu_to_le32(16), + COLLATION_NTOFS_SID = const_cpu_to_le32(17), + COLLATION_NTOFS_SECURITY_HASH = const_cpu_to_le32(18), + COLLATION_NTOFS_ULONGS = const_cpu_to_le32(19), +} COLLATION_RULES; + +/* + * The flags (32-bit) describing attribute properties in the attribute + * definition structure. FIXME: This information is from Regis's information + * and, according to him, it is not certain and probably incomplete. + * The INDEXABLE flag is fairly certainly correct as only the file name + * attribute has this flag set and this is the only attribute indexed in NT4. + */ +typedef enum { + INDEXABLE = const_cpu_to_le32(0x02), /* Attribute can be + indexed. */ + NEED_TO_REGENERATE = const_cpu_to_le32(0x40), /* Need to regenerate + during regeneration + phase. */ + CAN_BE_NON_RESIDENT = const_cpu_to_le32(0x80), /* Attribute can be + non-resident. */ +} ATTR_DEF_FLAGS; + +/* + * The data attribute of FILE_AttrDef contains a sequence of attribute + * definitions for the NTFS volume. With this, it is supposed to be safe for an + * older NTFS driver to mount a volume containing a newer NTFS version without + * damaging it (that's the theory. In practice it's: not damaging it too much). + * Entries are sorted by attribute type. The flags describe whether the + * attribute can be resident/non-resident and possibly other things, but the + * actual bits are unknown. + */ +typedef struct { +/*hex ofs*/ +/* 0*/ uchar_t name[0x40]; /* Unicode name of the attribute. Zero + terminated. */ +/* 80*/ ATTR_TYPES type; /* Type of the attribute. */ +/* 84*/ u32 display_rule; /* Default display rule. + FIXME: What does it mean? (AIA) */ +/* 88*/ COLLATION_RULES collation_rule; /* Default collation rule. */ +/* 8c*/ ATTR_DEF_FLAGS flags; /* Flags describing the attribute. */ +/* 90*/ s64 min_size; /* Optional minimum attribute size. */ +/* 98*/ s64 max_size; /* Maximum size of attribute. */ +/* sizeof() = 0xa0 or 160 bytes */ +} __attribute__ ((__packed__)) ATTR_DEF; + +/* + * Attribute flags (16-bit). + */ +typedef enum { + ATTR_IS_COMPRESSED = const_cpu_to_le16(0x0001), + ATTR_COMPRESSION_MASK = const_cpu_to_le16(0x00ff), /* Compression + method mask. Also, first + illegal value. */ + ATTR_IS_ENCRYPTED = const_cpu_to_le16(0x4000), + ATTR_IS_SPARSE = const_cpu_to_le16(0x8000), +} __attribute__ ((__packed__)) ATTR_FLAGS; + +/* + * Attribute compression. + * + * Only the data attribute is ever compressed in the current ntfs driver in + * Windows. Further, compression is only applied when the data attribute is + * non-resident. Finally, to use compression, the maximum allowed cluster size + * on a volume is 4kib. + * + * The compression method is based on independently compressing blocks of X + * clusters, where X is determined from the compression_unit value found in the + * non-resident attribute record header (more precisely: X = 2^compression_unit + * clusters). On Windows NT/2k, X always is 16 clusters (compression_unit = 4). + * + * There are three different cases of how a compression block of X clusters + * can be stored: + * + * 1) The data in the block is all zero (a sparse block): + * This is stored as a sparse block in the runlist, i.e. the runlist + * entry has length = X and lcn = -1. The mapping pairs array actually + * uses a delta_lcn value length of 0, i.e. delta_lcn is not present at + * all, which is then interpreted by the driver as lcn = -1. + * NOTE: Even uncompressed files can be sparse on NTFS 3.0 volumes, then + * the same principles apply as above, except that the length is not + * restricted to being any particular value. + * + * 2) The data in the block is not compressed: + * This happens when compression doesn't reduce the size of the block + * in clusters. I.e. if compression has a small effect so that the + * compressed data still occupies X clusters, then the uncompressed data + * is stored in the block. + * This case is recognised by the fact that the runlist entry has + * length = X and lcn >= 0. The mapping pairs array stores this as + * normal with a run length of X and some specific delta_lcn, i.e. + * delta_lcn has to be present. + * + * 3) The data in the block is compressed: + * The common case. This case is recognised by the fact that the run + * list entry has length L < X and lcn >= 0. The mapping pairs array + * stores this as normal with a run length of X and some specific + * delta_lcn, i.e. delta_lcn has to be present. This runlist entry is + * immediately followed by a sparse entry with length = X - L and + * lcn = -1. The latter entry is to make up the vcn counting to the + * full compression block size X. + * + * In fact, life is more complicated because adjacent entries of the same type + * can be coalesced. This means that one has to keep track of the number of + * clusters handled and work on a basis of X clusters at a time being one + * block. An example: if length L > X this means that this particular runlist + * entry contains a block of length X and part of one or more blocks of length + * L - X. Another example: if length L < X, this does not necessarily mean that + * the block is compressed as it might be that the lcn changes inside the block + * and hence the following runlist entry describes the continuation of the + * potentially compressed block. The block would be compressed if the + * following runlist entry describes at least X - L sparse clusters, thus + * making up the compression block length as described in point 3 above. (Of + * course, there can be several runlist entries with small lengths so that the + * sparse entry does not follow the first data containing entry with + * length < X.) + * + * NOTE: At the end of the compressed attribute value, there most likely is not + * just the right amount of data to make up a compression block, thus this data + * is not even attempted to be compressed. It is just stored as is, unless + * the number of clusters it occupies is reduced when compressed in which case + * it is stored as a compressed compression block, complete with sparse + * clusters at the end. + */ + +/* + * Flags of resident attributes (8-bit). + */ +typedef enum { + RESIDENT_ATTR_IS_INDEXED = 0x01, /* Attribute is referenced in an index + (has implications for deleting and + modifying the attribute). */ +} __attribute__ ((__packed__)) RESIDENT_ATTR_FLAGS; + +/* + * Attribute record header. Always aligned to 8-byte boundary. + */ +typedef struct { +/*Ofs*/ +/* 0*/ ATTR_TYPES type; /* The (32-bit) type of the attribute. */ +/* 4*/ u32 length; /* Byte size of the resident part of the + attribute (aligned to 8-byte boundary). + Used to get to the next attribute. */ +/* 8*/ u8 non_resident; /* If 0, attribute is resident. + If 1, attribute is non-resident. */ +/* 9*/ u8 name_length; /* Unicode character size of name of attribute. + 0 if unnamed. */ +/* 10*/ u16 name_offset; /* If name_length != 0, the byte offset to the + beginning of the name from the attribute + record. Note that the name is stored as a + Unicode string. When creating, place offset + just at the end of the record header. Then, + follow with attribute value or mapping pairs + array, resident and non-resident attributes + respectively, aligning to an 8-byte + boundary. */ +/* 12*/ ATTR_FLAGS flags; /* Flags describing the attribute. */ +/* 14*/ u16 instance; /* The instance of this attribute record. This + number is unique within this mft record (see + MFT_RECORD/next_attribute_instance notes + above for more details). */ +/* 16*/ union { + /* Resident attributes. */ + struct { +/* 16 */ u32 value_length; /* Byte size of attribute value. */ +/* 20 */ u16 value_offset; /* Byte offset of the attribute + value from the start of the + attribute record. When creating, + align to 8-byte boundary if we + have a name present as this might + not have a length of a multiple + of 8-bytes. */ +/* 22 */ RESIDENT_ATTR_FLAGS resident_flags; /* See above. */ +/* 23 */ s8 reservedR; /* Reserved/alignment to 8-byte + boundary. */ + } __attribute__ ((__packed__)); + /* Non-resident attributes. */ + struct { +/* 16*/ VCN lowest_vcn; /* Lowest valid virtual cluster number + for this portion of the attribute value or + 0 if this is the only extent (usually the + case). - Only when an attribute list is used + does lowest_vcn != 0 ever occur. */ +/* 24*/ VCN highest_vcn; /* Highest valid vcn of this extent of + the attribute value. - Usually there is only one + portion, so this usually equals the attribute + value size in clusters minus 1. Can be -1 for + zero length files. Can be 0 for "single extent" + attributes. */ +/* 32*/ u16 mapping_pairs_offset; /* Byte offset from the + beginning of the structure to the mapping pairs + array which contains the mappings between the + vcns and the logical cluster numbers (lcns). + When creating, place this at the end of this + record header aligned to 8-byte boundary. */ +/* 34*/ u8 compression_unit; /* The compression unit expressed + as the log to the base 2 of the number of + clusters in a compression unit. 0 means not + compressed. (This effectively limits the + compression unit size to be a power of two + clusters.) WinNT4 only uses a value of 4. */ +/* 35*/ u8 reserved1[5]; /* Align to 8-byte boundary. */ +/* The sizes below are only used when lowest_vcn is zero, as otherwise it would + be difficult to keep them up-to-date.*/ +/* 40*/ s64 allocated_size; /* Byte size of disk space + allocated to hold the attribute value. Always + is a multiple of the cluster size. When a file + is compressed, this field is a multiple of the + compression block size (2^compression_unit) and + it represents the logically allocated space + rather than the actual on disk usage. For this + use the compressed_size (see below). */ +/* 48*/ s64 data_size; /* Byte size of the attribute + value. Can be larger than allocated_size if + attribute value is compressed or sparse. */ +/* 56*/ s64 initialized_size; /* Byte size of initialized + portion of the attribute value. Usually equals + data_size. */ +/* sizeof(uncompressed attr) = 64*/ +/* 64*/ s64 compressed_size; /* Byte size of the attribute + value after compression. Only present when + compressed. Always is a multiple of the + cluster size. Represents the actual amount of + disk space being used on the disk. */ +/* sizeof(compressed attr) = 72*/ + } __attribute__ ((__packed__)); + } __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) ATTR_RECORD; + +typedef ATTR_RECORD ATTR_REC; + +/* + * File attribute flags (32-bit). + */ +typedef enum { + /* + * These flags are only present in the STANDARD_INFORMATION attribute + * (in the field file_attributes). + */ + FILE_ATTR_READONLY = const_cpu_to_le32(0x00000001), + FILE_ATTR_HIDDEN = const_cpu_to_le32(0x00000002), + FILE_ATTR_SYSTEM = const_cpu_to_le32(0x00000004), + /* Old DOS volid. Unused in NT. = cpu_to_le32(0x00000008), */ + + FILE_ATTR_DIRECTORY = const_cpu_to_le32(0x00000010), + /* FILE_ATTR_DIRECTORY is not considered valid in NT. It is reserved + for the DOS SUBDIRECTORY flag. */ + FILE_ATTR_ARCHIVE = const_cpu_to_le32(0x00000020), + FILE_ATTR_DEVICE = const_cpu_to_le32(0x00000040), + FILE_ATTR_NORMAL = const_cpu_to_le32(0x00000080), + + FILE_ATTR_TEMPORARY = const_cpu_to_le32(0x00000100), + FILE_ATTR_SPARSE_FILE = const_cpu_to_le32(0x00000200), + FILE_ATTR_REPARSE_POINT = const_cpu_to_le32(0x00000400), + FILE_ATTR_COMPRESSED = const_cpu_to_le32(0x00000800), + + FILE_ATTR_OFFLINE = const_cpu_to_le32(0x00001000), + FILE_ATTR_NOT_CONTENT_INDEXED = const_cpu_to_le32(0x00002000), + FILE_ATTR_ENCRYPTED = const_cpu_to_le32(0x00004000), + + FILE_ATTR_VALID_FLAGS = const_cpu_to_le32(0x00007fb7), + /* FILE_ATTR_VALID_FLAGS masks out the old DOS VolId and the + FILE_ATTR_DEVICE and preserves everything else. This mask + is used to obtain all flags that are valid for reading. */ + FILE_ATTR_VALID_SET_FLAGS = const_cpu_to_le32(0x000031a7), + /* FILE_ATTR_VALID_SET_FLAGS masks out the old DOS VolId, the + F_A_DEVICE, F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT, + F_A_COMPRESSED and F_A_ENCRYPTED and preserves the rest. This mask + is used to to obtain all flags that are valid for setting. */ + + /* + * These flags are only present in the FILE_NAME attribute (in the + * field file_attributes). + */ + FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT = const_cpu_to_le32(0x10000000), + /* This is a copy of the corresponding bit from the mft record, telling + us whether this is a directory or not, i.e. whether it has an + index root attribute or not. */ + FILE_ATTR_DUP_VIEW_INDEX_PRESENT = const_cpu_to_le32(0x20000000), + /* This is a copy of the corresponding bit from the mft record, telling + us whether this file has a view index present (eg. object id index, + quota index, one of the security indexes or the encrypting file + system related indexes). */ +} FILE_ATTR_FLAGS; + +/* + * NOTE on times in NTFS: All times are in MS standard time format, i.e. they + * are the number of 100-nanosecond intervals since 1st January 1601, 00:00:00 + * universal coordinated time (UTC). (In Linux time starts 1st January 1970, + * 00:00:00 UTC and is stored as the number of 1-second intervals since then.) + */ + +/* + * Attribute: Standard information (0x10). + * + * NOTE: Always resident. + * NOTE: Present in all base file records on a volume. + * NOTE: There is conflicting information about the meaning of each of the time + * fields but the meaning as defined below has been verified to be + * correct by practical experimentation on Windows NT4 SP6a and is hence + * assumed to be the one and only correct interpretation. + */ +typedef struct { +/*Ofs*/ +/* 0*/ s64 creation_time; /* Time file was created. Updated when + a filename is changed(?). */ +/* 8*/ s64 last_data_change_time; /* Time the data attribute was last + modified. */ +/* 16*/ s64 last_mft_change_time; /* Time this mft record was last + modified. */ +/* 24*/ s64 last_access_time; /* Approximate time when the file was + last accessed (obviously this is not + updated on read-only volumes). In + Windows this is only updated when + accessed if some time delta has + passed since the last update. Also, + last access times updates can be + disabled altogether for speed. */ +/* 32*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */ +/* 36*/ union { + /* NTFS 1.2 (and previous, presumably) */ +/* 36 */ u8 reserved12[12]; /* Reserved/alignment to 8-byte + boundary. */ +/* sizeof() = 48 bytes */ + /* NTFS 3.0 */ + struct { +/* + * If a volume has been upgraded from a previous NTFS version, then these + * fields are present only if the file has been accessed since the upgrade. + * Recognize the difference by comparing the length of the resident attribute + * value. If it is 48, then the following fields are missing. If it is 72 then + * the fields are present. Maybe just check like this: + * if (resident.ValueLength < sizeof(STANDARD_INFORMATION)) { + * Assume NTFS 1.2- format. + * If (volume version is 3.0+) + * Upgrade attribute to NTFS 3.0 format. + * else + * Use NTFS 1.2- format for access. + * } else + * Use NTFS 3.0 format for access. + * Only problem is that it might be legal to set the length of the value to + * arbitrarily large values thus spoiling this check. - But chkdsk probably + * views that as a corruption, assuming that it behaves like this for all + * attributes. + */ + /* 36*/ u32 maximum_versions; /* Maximum allowed versions for + file. Zero if version numbering is disabled. */ + /* 40*/ u32 version_number; /* This file's version (if any). + Set to zero if maximum_versions is zero. */ + /* 44*/ u32 class_id; /* Class id from bidirectional + class id index (?). */ + /* 48*/ u32 owner_id; /* Owner_id of the user owning + the file. Translate via $Q index in FILE_Extend + /$Quota to the quota control entry for the user + owning the file. Zero if quotas are disabled. */ + /* 52*/ u32 security_id; /* Security_id for the file. + Translate via $SII index and $SDS data stream + in FILE_Secure to the security descriptor. */ + /* 56*/ u64 quota_charged; /* Byte size of the charge to + the quota for all streams of the file. Note: Is + zero if quotas are disabled. */ + /* 64*/ u64 usn; /* Last update sequence number + of the file. This is a direct index into the + change (aka usn) journal file. It is zero if + the usn journal is disabled. + NOTE: To disable the journal need to delete + the journal file itself and to then walk the + whole mft and set all Usn entries in all mft + records to zero! (This can take a while!) + The journal is FILE_Extend/$UsnJrnl. Win2k + will recreate the journal and initiate + logging if necessary when mounting the + partition. This, in contrast to disabling the + journal is a very fast process, so the user + won't even notice it. */ + }; + }; +/* sizeof() = 72 bytes (NTFS 3.0) */ +} __attribute__ ((__packed__)) STANDARD_INFORMATION; + +/* + * Attribute: Attribute list (0x20). + * + * - Can be either resident or non-resident. + * - Value consists of a sequence of variable length, 8-byte aligned, + * ATTR_LIST_ENTRY records. + * - The attribute list attribute contains one entry for each attribute of + * the file in which the list is located, except for the list attribute + * itself. The list is sorted: first by attribute type, second by attribute + * name (if present), third by instance number. The extents of one + * non-resident attribute (if present) immediately follow after the initial + * extent. They are ordered by lowest_vcn and have their instace set to zero. + * It is not allowed to have two attributes with all sorting keys equal. + * - Further restrictions: + * - If not resident, the vcn to lcn mapping array has to fit inside the + * base mft record. + * - The attribute list attribute value has a maximum size of 256kb. This + * is imposed by the Windows cache manager. + * - Attribute lists are only used when the attributes of mft record do not + * fit inside the mft record despite all attributes (that can be made + * non-resident) having been made non-resident. This can happen e.g. when: + * - File has a large number of hard links (lots of file name + * attributes present). + * - The mapping pairs array of some non-resident attribute becomes so + * large due to fragmentation that it overflows the mft record. + * - The security descriptor is very complex (not applicable to + * NTFS 3.0 volumes). + * - There are many named streams. + */ +typedef struct { +/*Ofs*/ +/* 0*/ ATTR_TYPES type; /* Type of referenced attribute. */ +/* 4*/ u16 length; /* Byte size of this entry. */ +/* 6*/ u8 name_length; /* Size in Unicode chars of the name of the + attribute or 0 if unnamed. */ +/* 7*/ u8 name_offset; /* Byte offset to beginning of attribute name + (always set this to where the name would + start even if unnamed). */ +/* 8*/ VCN lowest_vcn; /* Lowest virtual cluster number of this portion + of the attribute value. This is usually 0. It + is non-zero for the case where one attribute + does not fit into one mft record and thus + several mft records are allocated to hold + this attribute. In the latter case, each mft + record holds one extent of the attribute and + there is one attribute list entry for each + extent. NOTE: This is DEFINITELY a signed + value! The windows driver uses cmp, followed + by jg when comparing this, thus it treats it + as signed. */ +/* 16*/ MFT_REF mft_reference; /* The reference of the mft record holding + the ATTR_RECORD for this portion of the + attribute value. */ +/* 24*/ u16 instance; /* If lowest_vcn = 0, the instance of the + attribute being referenced; otherwise 0. */ +/* 26*/ uchar_t name[0]; /* Use when creating only. When reading use + name_offset to determine the location of the + name. */ +/* sizeof() = 26 + (attribute_name_length * 2) bytes */ +} __attribute__ ((__packed__)) ATTR_LIST_ENTRY; + +/* + * The maximum allowed length for a file name. + */ +#define MAXIMUM_FILE_NAME_LENGTH 255 + +/* + * Possible namespaces for filenames in ntfs (8-bit). + */ +typedef enum { + FILE_NAME_POSIX = 0x00, + /* This is the largest namespace. It is case sensitive and + allows all Unicode characters except for: '\0' and '/'. + Beware that in WinNT/2k files which eg have the same name + except for their case will not be distinguished by the + standard utilities and thus a "del filename" will delete + both "filename" and "fileName" without warning. */ + FILE_NAME_WIN32 = 0x01, + /* The standard WinNT/2k NTFS long filenames. Case insensitive. + All Unicode chars except: '\0', '"', '*', '/', ':', '<', + '>', '?', '\' and '|'. Further, names cannot end with a '.' + or a space. */ + FILE_NAME_DOS = 0x02, + /* The standard DOS filenames (8.3 format). Uppercase only. + All 8-bit characters greater space, except: '"', '*', '+', + ',', '/', ':', ';', '<', '=', '>', '?' and '\'. */ + FILE_NAME_WIN32_AND_DOS = 0x03, + /* 3 means that both the Win32 and the DOS filenames are + identical and hence have been saved in this single filename + record. */ +} __attribute__ ((__packed__)) FILE_NAME_TYPE_FLAGS; + +/* + * Attribute: Filename (0x30). + * + * NOTE: Always resident. + * NOTE: All fields, except the parent_directory, are only updated when the + * filename is changed. Until then, they just become out of sync with + * reality and the more up to date values are present in the standard + * information attribute. + * NOTE: There is conflicting information about the meaning of each of the time + * fields but the meaning as defined below has been verified to be + * correct by practical experimentation on Windows NT4 SP6a and is hence + * assumed to be the one and only correct interpretation. + */ +typedef struct { +/*hex ofs*/ +/* 0*/ MFT_REF parent_directory; /* Directory this filename is + referenced from. */ +/* 8*/ s64 creation_time; /* Time file was created. */ +/* 10*/ s64 last_data_change_time; /* Time the data attribute was last + modified. */ +/* 18*/ s64 last_mft_change_time; /* Time this mft record was last + modified. */ +/* 20*/ s64 last_access_time; /* Last time this mft record was + accessed. */ +/* 28*/ s64 allocated_size; /* Byte size of allocated space for the + data attribute. NOTE: Is a multiple + of the cluster size. */ +/* 30*/ s64 data_size; /* Byte size of actual data in data + attribute. */ +/* 38*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */ +/* 3c*/ union { + /* 3c*/ struct { + /* 3c*/ u16 packed_ea_size; /* Size of the buffer needed to + pack the extended attributes + (EAs), if such are present.*/ + /* 3e*/ u16 reserved; /* Reserved for alignment. */ + } __attribute__ ((__packed__)); + /* 3c*/ u32 reparse_point_tag; /* Type of reparse point, + present only in reparse + points and only if there are + no EAs. */ + } __attribute__ ((__packed__)); +/* 40*/ u8 file_name_length; /* Length of file name in + (Unicode) characters. */ +/* 41*/ FILE_NAME_TYPE_FLAGS file_name_type; /* Namespace of the file name.*/ +/* 42*/ uchar_t file_name[0]; /* File name in Unicode. */ +} __attribute__ ((__packed__)) FILE_NAME_ATTR; + +/* + * GUID structures store globally unique identifiers (GUID). A GUID is a + * 128-bit value consisting of one group of eight hexadecimal digits, followed + * by three groups of four hexadecimal digits each, followed by one group of + * twelve hexadecimal digits. GUIDs are Microsoft's implementation of the + * distributed computing environment (DCE) universally unique identifier (UUID). + * Example of a GUID: + * 1F010768-5A73-BC91-0010A52216A7 + */ +typedef struct { + u32 data1; /* The first eight hexadecimal digits of the GUID. */ + u16 data2; /* The first group of four hexadecimal digits. */ + u16 data3; /* The second group of four hexadecimal digits. */ + u8 data4[8]; /* The first two bytes are the third group of four + hexadecimal digits. The remaining six bytes are the + final 12 hexadecimal digits. */ +} __attribute__ ((__packed__)) GUID; + +/* + * FILE_Extend/$ObjId contains an index named $O. This index contains all + * object_ids present on the volume as the index keys and the corresponding + * mft_record numbers as the index entry data parts. The data part (defined + * below) also contains three other object_ids: + * birth_volume_id - object_id of FILE_Volume on which the file was first + * created. Optional (i.e. can be zero). + * birth_object_id - object_id of file when it was first created. Usually + * equals the object_id. Optional (i.e. can be zero). + * domain_id - Reserved (always zero). + */ +typedef struct { + MFT_REF mft_reference; /* Mft record containing the object_id in + the index entry key. */ + union { + struct { + GUID birth_volume_id; + GUID birth_object_id; + GUID domain_id; + } __attribute__ ((__packed__)); + u8 extended_info[48]; + } __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) OBJ_ID_INDEX_DATA; + +/* + * Attribute: Object id (NTFS 3.0+) (0x40). + * + * NOTE: Always resident. + */ +typedef struct { + GUID object_id; /* Unique id assigned to the + file.*/ + /* The following fields are optional. The attribute value size is 16 + bytes, i.e. sizeof(GUID), if these are not present at all. Note, + the entries can be present but one or more (or all) can be zero + meaning that that particular value(s) is(are) not defined. Note, + when the fields are missing here, it is well possible that they are + to be found within the $Extend/$ObjId system file indexed under the + above object_id. */ + union { + struct { + GUID birth_volume_id; /* Unique id of volume on which + the file was first created.*/ + GUID birth_object_id; /* Unique id of file when it was + first created. */ + GUID domain_id; /* Reserved, zero. */ + } __attribute__ ((__packed__)); + u8 extended_info[48]; + } __attribute__ ((__packed__)); +} __attribute__ ((__packed__)) OBJECT_ID_ATTR; + +/* + * The pre-defined IDENTIFIER_AUTHORITIES used as SID_IDENTIFIER_AUTHORITY in + * the SID structure (see below). + */ +//typedef enum { /* SID string prefix. */ +// SECURITY_NULL_SID_AUTHORITY = {0, 0, 0, 0, 0, 0}, /* S-1-0 */ +// SECURITY_WORLD_SID_AUTHORITY = {0, 0, 0, 0, 0, 1}, /* S-1-1 */ +// SECURITY_LOCAL_SID_AUTHORITY = {0, 0, 0, 0, 0, 2}, /* S-1-2 */ +// SECURITY_CREATOR_SID_AUTHORITY = {0, 0, 0, 0, 0, 3}, /* S-1-3 */ +// SECURITY_NON_UNIQUE_AUTHORITY = {0, 0, 0, 0, 0, 4}, /* S-1-4 */ +// SECURITY_NT_SID_AUTHORITY = {0, 0, 0, 0, 0, 5}, /* S-1-5 */ +//} IDENTIFIER_AUTHORITIES; + +/* + * These relative identifiers (RIDs) are used with the above identifier + * authorities to make up universal well-known SIDs. + * + * Note: The relative identifier (RID) refers to the portion of a SID, which + * identifies a user or group in relation to the authority that issued the SID. + * For example, the universal well-known SID Creator Owner ID (S-1-3-0) is + * made up of the identifier authority SECURITY_CREATOR_SID_AUTHORITY (3) and + * the relative identifier SECURITY_CREATOR_OWNER_RID (0). + */ +typedef enum { /* Identifier authority. */ + SECURITY_NULL_RID = 0, /* S-1-0 */ + SECURITY_WORLD_RID = 0, /* S-1-1 */ + SECURITY_LOCAL_RID = 0, /* S-1-2 */ + + SECURITY_CREATOR_OWNER_RID = 0, /* S-1-3 */ + SECURITY_CREATOR_GROUP_RID = 1, /* S-1-3 */ + + SECURITY_CREATOR_OWNER_SERVER_RID = 2, /* S-1-3 */ + SECURITY_CREATOR_GROUP_SERVER_RID = 3, /* S-1-3 */ + + SECURITY_DIALUP_RID = 1, + SECURITY_NETWORK_RID = 2, + SECURITY_BATCH_RID = 3, + SECURITY_INTERACTIVE_RID = 4, + SECURITY_SERVICE_RID = 6, + SECURITY_ANONYMOUS_LOGON_RID = 7, + SECURITY_PROXY_RID = 8, + SECURITY_ENTERPRISE_CONTROLLERS_RID=9, + SECURITY_SERVER_LOGON_RID = 9, + SECURITY_PRINCIPAL_SELF_RID = 0xa, + SECURITY_AUTHENTICATED_USER_RID = 0xb, + SECURITY_RESTRICTED_CODE_RID = 0xc, + SECURITY_TERMINAL_SERVER_RID = 0xd, + + SECURITY_LOGON_IDS_RID = 5, + SECURITY_LOGON_IDS_RID_COUNT = 3, + + SECURITY_LOCAL_SYSTEM_RID = 0x12, + + SECURITY_NT_NON_UNIQUE = 0x15, + + SECURITY_BUILTIN_DOMAIN_RID = 0x20, + + /* + * Well-known domain relative sub-authority values (RIDs). + */ + + /* Users. */ + DOMAIN_USER_RID_ADMIN = 0x1f4, + DOMAIN_USER_RID_GUEST = 0x1f5, + DOMAIN_USER_RID_KRBTGT = 0x1f6, + + /* Groups. */ + DOMAIN_GROUP_RID_ADMINS = 0x200, + DOMAIN_GROUP_RID_USERS = 0x201, + DOMAIN_GROUP_RID_GUESTS = 0x202, + DOMAIN_GROUP_RID_COMPUTERS = 0x203, + DOMAIN_GROUP_RID_CONTROLLERS = 0x204, + DOMAIN_GROUP_RID_CERT_ADMINS = 0x205, + DOMAIN_GROUP_RID_SCHEMA_ADMINS = 0x206, + DOMAIN_GROUP_RID_ENTERPRISE_ADMINS= 0x207, + DOMAIN_GROUP_RID_POLICY_ADMINS = 0x208, + + /* Aliases. */ + DOMAIN_ALIAS_RID_ADMINS = 0x220, + DOMAIN_ALIAS_RID_USERS = 0x221, + DOMAIN_ALIAS_RID_GUESTS = 0x222, + DOMAIN_ALIAS_RID_POWER_USERS = 0x223, + + DOMAIN_ALIAS_RID_ACCOUNT_OPS = 0x224, + DOMAIN_ALIAS_RID_SYSTEM_OPS = 0x225, + DOMAIN_ALIAS_RID_PRINT_OPS = 0x226, + DOMAIN_ALIAS_RID_BACKUP_OPS = 0x227, + + DOMAIN_ALIAS_RID_REPLICATOR = 0x228, + DOMAIN_ALIAS_RID_RAS_SERVERS = 0x229, + DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = 0x22a, +} RELATIVE_IDENTIFIERS; + +/* + * The universal well-known SIDs: + * + * NULL_SID S-1-0-0 + * WORLD_SID S-1-1-0 + * LOCAL_SID S-1-2-0 + * CREATOR_OWNER_SID S-1-3-0 + * CREATOR_GROUP_SID S-1-3-1 + * CREATOR_OWNER_SERVER_SID S-1-3-2 + * CREATOR_GROUP_SERVER_SID S-1-3-3 + * + * (Non-unique IDs) S-1-4 + * + * NT well-known SIDs: + * + * NT_AUTHORITY_SID S-1-5 + * DIALUP_SID S-1-5-1 + * + * NETWORD_SID S-1-5-2 + * BATCH_SID S-1-5-3 + * INTERACTIVE_SID S-1-5-4 + * SERVICE_SID S-1-5-6 + * ANONYMOUS_LOGON_SID S-1-5-7 (aka null logon session) + * PROXY_SID S-1-5-8 + * SERVER_LOGON_SID S-1-5-9 (aka domain controller account) + * SELF_SID S-1-5-10 (self RID) + * AUTHENTICATED_USER_SID S-1-5-11 + * RESTRICTED_CODE_SID S-1-5-12 (running restricted code) + * TERMINAL_SERVER_SID S-1-5-13 (running on terminal server) + * + * (Logon IDs) S-1-5-5-X-Y + * + * (NT non-unique IDs) S-1-5-0x15-... + * + * (Built-in domain) S-1-5-0x20 + */ + +/* + * The SID_IDENTIFIER_AUTHORITY is a 48-bit value used in the SID structure. + */ +typedef union { + struct { + u32 low_part; /* Low 32-bits. */ + u16 high_part; /* High 16-bits. */ + } __attribute__ ((__packed__)); + u8 value[6]; /* Value as individual bytes. */ +} __attribute__ ((__packed__)) SID_IDENTIFIER_AUTHORITY; + +/* + * The SID structure is a variable-length structure used to uniquely identify + * users or groups. SID stands for security identifier. + * + * The standard textual representation of the SID is of the form: + * S-R-I-S-S... + * Where: + * - The first "S" is the literal character 'S' identifying the following + * digits as a SID. + * - R is the revision level of the SID expressed as a sequence of digits + * either in decimal or hexadecimal (if the later, prefixed by "0x"). + * - I is the 48-bit identifier_authority, expressed as digits as R above. + * - S... is one or more sub_authority values, expressed as digits as above. + * + * Example SID; the domain-relative SID of the local Administrators group on + * Windows NT/2k: + * S-1-5-32-544 + * This translates to a SID with: + * revision = 1, + * sub_authority_count = 2, + * identifier_authority = {0,0,0,0,0,5}, // SECURITY_NT_AUTHORITY + * sub_authority[0] = 32, // SECURITY_BUILTIN_DOMAIN_RID + * sub_authority[1] = 544 // DOMAIN_ALIAS_RID_ADMINS + */ +typedef struct { + u8 revision; + u8 sub_authority_count; + SID_IDENTIFIER_AUTHORITY identifier_authority; + u32 sub_authority[1]; /* At least one sub_authority. */ +} __attribute__ ((__packed__)) SID; + +/* + * Current constants for SIDs. + */ +typedef enum { + SID_REVISION = 1, /* Current revision level. */ + SID_MAX_SUB_AUTHORITIES = 15, /* Maximum number of those. */ + SID_RECOMMENDED_SUB_AUTHORITIES = 1, /* Will change to around 6 in + a future revision. */ +} SID_CONSTANTS; + +/* + * The predefined ACE types (8-bit, see below). + */ +typedef enum { + ACCESS_MIN_MS_ACE_TYPE = 0, + ACCESS_ALLOWED_ACE_TYPE = 0, + ACCESS_DENIED_ACE_TYPE = 1, + SYSTEM_AUDIT_ACE_TYPE = 2, + SYSTEM_ALARM_ACE_TYPE = 3, /* Not implemented as of Win2k. */ + ACCESS_MAX_MS_V2_ACE_TYPE = 3, + + ACCESS_ALLOWED_COMPOUND_ACE_TYPE= 4, + ACCESS_MAX_MS_V3_ACE_TYPE = 4, + + /* The following are Win2k only. */ + ACCESS_MIN_MS_OBJECT_ACE_TYPE = 5, + ACCESS_ALLOWED_OBJECT_ACE_TYPE = 5, + ACCESS_DENIED_OBJECT_ACE_TYPE = 6, + SYSTEM_AUDIT_OBJECT_ACE_TYPE = 7, + SYSTEM_ALARM_OBJECT_ACE_TYPE = 8, + ACCESS_MAX_MS_OBJECT_ACE_TYPE = 8, + + ACCESS_MAX_MS_V4_ACE_TYPE = 8, + + /* This one is for WinNT&2k. */ + ACCESS_MAX_MS_ACE_TYPE = 8, +} __attribute__ ((__packed__)) ACE_TYPES; + +/* + * The ACE flags (8-bit) for audit and inheritance (see below). + * + * SUCCESSFUL_ACCESS_ACE_FLAG is only used with system audit and alarm ACE + * types to indicate that a message is generated (in Windows!) for successful + * accesses. + * + * FAILED_ACCESS_ACE_FLAG is only used with system audit and alarm ACE types + * to indicate that a message is generated (in Windows!) for failed accesses. + */ +typedef enum { + /* The inheritance flags. */ + OBJECT_INHERIT_ACE = 0x01, + CONTAINER_INHERIT_ACE = 0x02, + NO_PROPAGATE_INHERIT_ACE = 0x04, + INHERIT_ONLY_ACE = 0x08, + INHERITED_ACE = 0x10, /* Win2k only. */ + VALID_INHERIT_FLAGS = 0x1f, + + /* The audit flags. */ + SUCCESSFUL_ACCESS_ACE_FLAG = 0x40, + FAILED_ACCESS_ACE_FLAG = 0x80, +} __attribute__ ((__packed__)) ACE_FLAGS; + +/* + * An ACE is an access-control entry in an access-control list (ACL). + * An ACE defines access to an object for a specific user or group or defines + * the types of access that generate system-administration messages or alarms + * for a specific user or group. The user or group is identified by a security + * identifier (SID). + * + * Each ACE starts with an ACE_HEADER structure (aligned on 4-byte boundary), + * which specifies the type and size of the ACE. The format of the subsequent + * data depends on the ACE type. + */ +typedef struct { + ACE_TYPES type; /* Type of the ACE. */ + ACE_FLAGS flags; /* Flags describing the ACE. */ + u16 size; /* Size in bytes of the ACE. */ +} __attribute__ ((__packed__)) ACE_HEADER; + +/* + * The access mask (32-bit). Defines the access rights. + */ +typedef enum { + /* + * The specific rights (bits 0 to 15). Depend on the type of the + * object being secured by the ACE. + */ + + /* Specific rights for files and directories are as follows: */ + + /* Right to read data from the file. (FILE) */ + FILE_READ_DATA = const_cpu_to_le32(0x00000001), + /* Right to list contents of a directory. (DIRECTORY) */ + FILE_LIST_DIRECTORY = const_cpu_to_le32(0x00000001), + + /* Right to write data to the file. (FILE) */ + FILE_WRITE_DATA = const_cpu_to_le32(0x00000002), + /* Right to create a file in the directory. (DIRECTORY) */ + FILE_ADD_FILE = const_cpu_to_le32(0x00000002), + + /* Right to append data to the file. (FILE) */ + FILE_APPEND_DATA = const_cpu_to_le32(0x00000004), + /* Right to create a subdirectory. (DIRECTORY) */ + FILE_ADD_SUBDIRECTORY = const_cpu_to_le32(0x00000004), + + /* Right to read extended attributes. (FILE/DIRECTORY) */ + FILE_READ_EA = const_cpu_to_le32(0x00000008), + + /* Right to write extended attributes. (FILE/DIRECTORY) */ + FILE_WRITE_EA = const_cpu_to_le32(0x00000010), + + /* Right to execute a file. (FILE) */ + FILE_EXECUTE = const_cpu_to_le32(0x00000020), + /* Right to traverse the directory. (DIRECTORY) */ + FILE_TRAVERSE = const_cpu_to_le32(0x00000020), + + /* + * Right to delete a directory and all the files it contains (its + * children), even if the files are read-only. (DIRECTORY) + */ + FILE_DELETE_CHILD = const_cpu_to_le32(0x00000040), + + /* Right to read file attributes. (FILE/DIRECTORY) */ + FILE_READ_ATTRIBUTES = const_cpu_to_le32(0x00000080), + + /* Right to change file attributes. (FILE/DIRECTORY) */ + FILE_WRITE_ATTRIBUTES = const_cpu_to_le32(0x00000100), + + /* + * The standard rights (bits 16 to 23). Are independent of the type of + * object being secured. + */ + + /* Right to delete the object. */ + DELETE = const_cpu_to_le32(0x00010000), + + /* + * Right to read the information in the object's security descriptor, + * not including the information in the SACL. I.e. right to read the + * security descriptor and owner. + */ + READ_CONTROL = const_cpu_to_le32(0x00020000), + + /* Right to modify the DACL in the object's security descriptor. */ + WRITE_DAC = const_cpu_to_le32(0x00040000), + + /* Right to change the owner in the object's security descriptor. */ + WRITE_OWNER = const_cpu_to_le32(0x00080000), + + /* + * Right to use the object for synchronization. Enables a process to + * wait until the object is in the signalled state. Some object types + * do not support this access right. + */ + SYNCHRONIZE = const_cpu_to_le32(0x00100000), + + /* + * The following STANDARD_RIGHTS_* are combinations of the above for + * convenience and are defined by the Win32 API. + */ + + /* These are currently defined to READ_CONTROL. */ + STANDARD_RIGHTS_READ = const_cpu_to_le32(0x00020000), + STANDARD_RIGHTS_WRITE = const_cpu_to_le32(0x00020000), + STANDARD_RIGHTS_EXECUTE = const_cpu_to_le32(0x00020000), + + /* Combines DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER access. */ + STANDARD_RIGHTS_REQUIRED = const_cpu_to_le32(0x000f0000), + + /* + * Combines DELETE, READ_CONTROL, WRITE_DAC, WRITE_OWNER, and + * SYNCHRONIZE access. + */ + STANDARD_RIGHTS_ALL = const_cpu_to_le32(0x001f0000), + + /* + * The access system ACL and maximum allowed access types (bits 24 to + * 25, bits 26 to 27 are reserved). + */ + ACCESS_SYSTEM_SECURITY = const_cpu_to_le32(0x01000000), + MAXIMUM_ALLOWED = const_cpu_to_le32(0x02000000), + + /* + * The generic rights (bits 28 to 31). These map onto the standard and + * specific rights. + */ + + /* Read, write, and execute access. */ + GENERIC_ALL = const_cpu_to_le32(0x10000000), + + /* Execute access. */ + GENERIC_EXECUTE = const_cpu_to_le32(0x20000000), + + /* + * Write access. For files, this maps onto: + * FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_DATA | + * FILE_WRITE_EA | STANDARD_RIGHTS_WRITE | SYNCHRONIZE + * For directories, the mapping has the same numberical value. See + * above for the descriptions of the rights granted. + */ + GENERIC_WRITE = const_cpu_to_le32(0x40000000), + + /* + * Read access. For files, this maps onto: + * FILE_READ_ATTRIBUTES | FILE_READ_DATA | FILE_READ_EA | + * STANDARD_RIGHTS_READ | SYNCHRONIZE + * For directories, the mapping has the same numberical value. See + * above for the descriptions of the rights granted. + */ + GENERIC_READ = const_cpu_to_le32(0x80000000), +} ACCESS_MASK; + +/* + * The generic mapping array. Used to denote the mapping of each generic + * access right to a specific access mask. + * + * FIXME: What exactly is this and what is it for? (AIA) + */ +typedef struct { + ACCESS_MASK generic_read; + ACCESS_MASK generic_write; + ACCESS_MASK generic_execute; + ACCESS_MASK generic_all; +} __attribute__ ((__packed__)) GENERIC_MAPPING; + +/* + * The predefined ACE type structures are as defined below. + */ + +/* + * ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE + */ +typedef struct { + ACE_HEADER; /* The ACE header. */ + ACCESS_MASK mask; /* Access mask associated with the ACE. */ + SID sid; /* The SID associated with the ACE. */ +} __attribute__ ((__packed__)) ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, + SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE; + +/* + * The object ACE flags (32-bit). + */ +typedef enum { + ACE_OBJECT_TYPE_PRESENT = const_cpu_to_le32(1), + ACE_INHERITED_OBJECT_TYPE_PRESENT = const_cpu_to_le32(2), +} OBJECT_ACE_FLAGS; + +typedef struct { + ACE_HEADER; /* The ACE_HEADER. */ + ACCESS_MASK mask; /* Access mask associated with the ACE. */ + OBJECT_ACE_FLAGS flags; /* Flags describing the object ACE. */ + GUID object_type; + GUID inherited_object_type; + SID sid; /* The SID associated with the ACE. */ +} __attribute__ ((__packed__)) ACCESS_ALLOWED_OBJECT_ACE, + ACCESS_DENIED_OBJECT_ACE, + SYSTEM_AUDIT_OBJECT_ACE, + SYSTEM_ALARM_OBJECT_ACE; + +/* + * An ACL is an access-control list (ACL). + * An ACL starts with an ACL header structure, which specifies the size of + * the ACL and the number of ACEs it contains. The ACL header is followed by + * zero or more access control entries (ACEs). The ACL as well as each ACE + * are aligned on 4-byte boundaries. + */ +typedef struct { + u8 revision; /* Revision of this ACL. */ + u8 alignment1; + u16 size; /* Allocated space in bytes for ACL. Includes this + header, the ACEs and the remaining free space. */ + u16 ace_count;/* Number of ACEs in the ACL. */ + u16 alignment2; +/* sizeof() = 8 bytes */ +} __attribute__ ((__packed__)) ACL; + +/* + * Current constants for ACLs. + */ +typedef enum { + /* Current revision. */ + ACL_REVISION = 2, + ACL_REVISION_DS = 4, + + /* History of revisions. */ + ACL_REVISION1 = 1, + MIN_ACL_REVISION = 2, + ACL_REVISION2 = 2, + ACL_REVISION3 = 3, + ACL_REVISION4 = 4, + MAX_ACL_REVISION = 4, +} ACL_CONSTANTS; + +/* + * The security descriptor control flags (16-bit). + * + * SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the + * SID pointed to by the Owner field was provided by a + * defaulting mechanism rather than explicitly provided by the + * original provider of the security descriptor. This may + * affect the treatment of the SID with respect to inheritence + * of an owner. + * + * SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the + * SID in the Group field was provided by a defaulting mechanism + * rather than explicitly provided by the original provider of + * the security descriptor. This may affect the treatment of + * the SID with respect to inheritence of a primary group. + * + * SE_DACL_PRESENT - This boolean flag, when set, indicates that the + * security descriptor contains a discretionary ACL. If this + * flag is set and the Dacl field of the SECURITY_DESCRIPTOR is + * null, then a null ACL is explicitly being specified. + * + * SE_DACL_DEFAULTED - This boolean flag, when set, indicates that the + * ACL pointed to by the Dacl field was provided by a defaulting + * mechanism rather than explicitly provided by the original + * provider of the security descriptor. This may affect the + * treatment of the ACL with respect to inheritence of an ACL. + * This flag is ignored if the DaclPresent flag is not set. + * + * SE_SACL_PRESENT - This boolean flag, when set, indicates that the + * security descriptor contains a system ACL pointed to by the + * Sacl field. If this flag is set and the Sacl field of the + * SECURITY_DESCRIPTOR is null, then an empty (but present) + * ACL is being specified. + * + * SE_SACL_DEFAULTED - This boolean flag, when set, indicates that the + * ACL pointed to by the Sacl field was provided by a defaulting + * mechanism rather than explicitly provided by the original + * provider of the security descriptor. This may affect the + * treatment of the ACL with respect to inheritence of an ACL. + * This flag is ignored if the SaclPresent flag is not set. + * + * SE_SELF_RELATIVE - This boolean flag, when set, indicates that the + * security descriptor is in self-relative form. In this form, + * all fields of the security descriptor are contiguous in memory + * and all pointer fields are expressed as offsets from the + * beginning of the security descriptor. + */ +typedef enum { + SE_OWNER_DEFAULTED = const_cpu_to_le16(0x0001), + SE_GROUP_DEFAULTED = const_cpu_to_le16(0x0002), + SE_DACL_PRESENT = const_cpu_to_le16(0x0004), + SE_DACL_DEFAULTED = const_cpu_to_le16(0x0008), + SE_SACL_PRESENT = const_cpu_to_le16(0x0010), + SE_SACL_DEFAULTED = const_cpu_to_le16(0x0020), + SE_DACL_AUTO_INHERIT_REQ = const_cpu_to_le16(0x0100), + SE_SACL_AUTO_INHERIT_REQ = const_cpu_to_le16(0x0200), + SE_DACL_AUTO_INHERITED = const_cpu_to_le16(0x0400), + SE_SACL_AUTO_INHERITED = const_cpu_to_le16(0x0800), + SE_DACL_PROTECTED = const_cpu_to_le16(0x1000), + SE_SACL_PROTECTED = const_cpu_to_le16(0x2000), + SE_RM_CONTROL_VALID = const_cpu_to_le16(0x4000), + SE_SELF_RELATIVE = const_cpu_to_le16(0x8000), +} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_CONTROL; + +/* + * Self-relative security descriptor. Contains the owner and group SIDs as well + * as the sacl and dacl ACLs inside the security descriptor itself. + */ +typedef struct { + u8 revision; /* Revision level of the security descriptor. */ + u8 alignment; + SECURITY_DESCRIPTOR_CONTROL control; /* Flags qualifying the type of + the descriptor as well as the following fields. */ + u32 owner; /* Byte offset to a SID representing an object's + owner. If this is NULL, no owner SID is present in + the descriptor. */ + u32 group; /* Byte offset to a SID representing an object's + primary group. If this is NULL, no primary group + SID is present in the descriptor. */ + u32 sacl; /* Byte offset to a system ACL. Only valid, if + SE_SACL_PRESENT is set in the control field. If + SE_SACL_PRESENT is set but sacl is NULL, a NULL ACL + is specified. */ + u32 dacl; /* Byte offset to a discretionary ACL. Only valid, if + SE_DACL_PRESENT is set in the control field. If + SE_DACL_PRESENT is set but dacl is NULL, a NULL ACL + (unconditionally granting access) is specified. */ +/* sizeof() = 0x14 bytes */ +} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_RELATIVE; + +/* + * Absolute security descriptor. Does not contain the owner and group SIDs, nor + * the sacl and dacl ACLs inside the security descriptor. Instead, it contains + * pointers to these structures in memory. Obviously, absolute security + * descriptors are only useful for in memory representations of security + * descriptors. On disk, a self-relative security descriptor is used. + */ +typedef struct { + u8 revision; /* Revision level of the security descriptor. */ + u8 alignment; + SECURITY_DESCRIPTOR_CONTROL control; /* Flags qualifying the type of + the descriptor as well as the following fields. */ + SID *owner; /* Points to a SID representing an object's owner. If + this is NULL, no owner SID is present in the + descriptor. */ + SID *group; /* Points to a SID representing an object's primary + group. If this is NULL, no primary group SID is + present in the descriptor. */ + ACL *sacl; /* Points to a system ACL. Only valid, if + SE_SACL_PRESENT is set in the control field. If + SE_SACL_PRESENT is set but sacl is NULL, a NULL ACL + is specified. */ + ACL *dacl; /* Points to a discretionary ACL. Only valid, if + SE_DACL_PRESENT is set in the control field. If + SE_DACL_PRESENT is set but dacl is NULL, a NULL ACL + (unconditionally granting access) is specified. */ +} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR; + +/* + * Current constants for security descriptors. + */ +typedef enum { + /* Current revision. */ + SECURITY_DESCRIPTOR_REVISION = 1, + SECURITY_DESCRIPTOR_REVISION1 = 1, + + /* The sizes of both the absolute and relative security descriptors is + the same as pointers, at least on ia32 architecture are 32-bit. */ + SECURITY_DESCRIPTOR_MIN_LENGTH = sizeof(SECURITY_DESCRIPTOR), +} SECURITY_DESCRIPTOR_CONSTANTS; + +/* + * Attribute: Security descriptor (0x50). A standard self-relative security + * descriptor. + * + * NOTE: Can be resident or non-resident. + * NOTE: Not used in NTFS 3.0+, as security descriptors are stored centrally + * in FILE_Secure and the correct descriptor is found using the security_id + * from the standard information attribute. + */ +typedef SECURITY_DESCRIPTOR_RELATIVE SECURITY_DESCRIPTOR_ATTR; + +/* + * On NTFS 3.0+, all security descriptors are stored in FILE_Secure. Only one + * referenced instance of each unique security descriptor is stored. + * + * FILE_Secure contains no unnamed data attribute, i.e. it has zero length. It + * does, however, contain two indexes ($SDH and $SII) as well as a named data + * stream ($SDS). + * + * Every unique security descriptor is assigned a unique security identifier + * (security_id, not to be confused with a SID). The security_id is unique for + * the NTFS volume and is used as an index into the $SII index, which maps + * security_ids to the security descriptor's storage location within the $SDS + * data attribute. The $SII index is sorted by ascending security_id. + * + * A simple hash is computed from each security descriptor. This hash is used + * as an index into the $SDH index, which maps security descriptor hashes to + * the security descriptor's storage location within the $SDS data attribute. + * The $SDH index is sorted by security descriptor hash and is stored in a B+ + * tree. When searching $SDH (with the intent of determining whether or not a + * new security descriptor is already present in the $SDS data stream), if a + * matching hash is found, but the security descriptors do not match, the + * search in the $SDH index is continued, searching for a next matching hash. + * + * When a precise match is found, the security_id coresponding to the security + * descriptor in the $SDS attribute is read from the found $SDH index entry and + * is stored in the $STANDARD_INFORMATION attribute of the file/directory to + * which the security descriptor is being applied. The $STANDARD_INFORMATION + * attribute is present in all base mft records (i.e. in all files and + * directories). + * + * If a match is not found, the security descriptor is assigned a new unique + * security_id and is added to the $SDS data attribute. Then, entries + * referencing the this security descriptor in the $SDS data attribute are + * added to the $SDH and $SII indexes. + * + * Note: Entries are never deleted from FILE_Secure, even if nothing + * references an entry any more. + */ + +/* + * This header precedes each security descriptor in the $SDS data stream. + * This is also the index entry data part of both the $SII and $SDH indexes. + */ +typedef struct { + u32 hash; /* Hash of the security descriptor. */ + u32 security_id; /* The security_id assigned to the descriptor. */ + u64 offset; /* Byte offset of this entry in the $SDS stream. */ + u32 length; /* Size in bytes of this entry in $SDS stream. */ +} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_HEADER; + +/* + * The $SDS data stream contains the security descriptors, aligned on 16-byte + * boundaries, sorted by security_id in a B+ tree. Security descriptors cannot + * cross 256kib boundaries (this restriction is imposed by the Windows cache + * manager). Each security descriptor is contained in a SDS_ENTRY structure. + * Also, each security descriptor is stored twice in the $SDS stream with a + * fixed offset of 0x40000 bytes (256kib, the Windows cache manager's max size) + * between them; i.e. if a SDS_ENTRY specifies an offset of 0x51d0, then the + * the first copy of the security descriptor will be at offset 0x51d0 in the + * $SDS data stream and the second copy will be at offset 0x451d0. + */ +typedef struct { + SECURITY_DESCRIPTOR_HEADER; /* The security descriptor header. */ + SECURITY_DESCRIPTOR_RELATIVE sid; /* The self-relative security + descriptor. */ +} __attribute__ ((__packed__)) SDS_ENTRY; + +/* + * The index entry key used in the $SII index. The collation type is + * COLLATION_NTOFS_ULONG. + */ +typedef struct { + u32 security_id; /* The security_id assigned to the descriptor. */ +} __attribute__ ((__packed__)) SII_INDEX_KEY; + +/* + * The index entry key used in the $SDH index. The keys are sorted first by + * hash and then by security_id. The collation rule is + * COLLATION_NTOFS_SECURITY_HASH. + */ +typedef struct { + u32 hash; /* Hash of the security descriptor. */ + u32 security_id; /* The security_id assigned to the descriptor. */ +} __attribute__ ((__packed__)) SDH_INDEX_KEY; + +/* + * Attribute: Volume name (0x60). + * + * NOTE: Always resident. + * NOTE: Present only in FILE_Volume. + */ +typedef struct { + uchar_t name[0]; /* The name of the volume in Unicode. */ +} __attribute__ ((__packed__)) VOLUME_NAME; + +/* + * Possible flags for the volume (16-bit). + */ +typedef enum { + VOLUME_IS_DIRTY = const_cpu_to_le16(0x0001), + VOLUME_RESIZE_LOG_FILE = const_cpu_to_le16(0x0002), + VOLUME_UPGRADE_ON_MOUNT = const_cpu_to_le16(0x0004), + VOLUME_MOUNTED_ON_NT4 = const_cpu_to_le16(0x0008), + VOLUME_DELETE_USN_UNDERWAY = const_cpu_to_le16(0x0010), + VOLUME_REPAIR_OBJECT_ID = const_cpu_to_le16(0x0020), + VOLUME_MODIFIED_BY_CHKDSK = const_cpu_to_le16(0x8000), + VOLUME_FLAGS_MASK = const_cpu_to_le16(0x803f), +} __attribute__ ((__packed__)) VOLUME_FLAGS; + +/* + * Attribute: Volume information (0x70). + * + * NOTE: Always resident. + * NOTE: Present only in FILE_Volume. + * NOTE: Windows 2000 uses NTFS 3.0 while Windows NT4 service pack 6a uses + * NTFS 1.2. I haven't personally seen other values yet. + */ +typedef struct { + u64 reserved; /* Not used (yet?). */ + u8 major_ver; /* Major version of the ntfs format. */ + u8 minor_ver; /* Minor version of the ntfs format. */ + VOLUME_FLAGS flags; /* Bit array of VOLUME_* flags. */ +} __attribute__ ((__packed__)) VOLUME_INFORMATION; + +/* + * Attribute: Data attribute (0x80). + * + * NOTE: Can be resident or non-resident. + * + * Data contents of a file (i.e. the unnamed stream) or of a named stream. + */ +typedef struct { + u8 data[0]; /* The file's data contents. */ +} __attribute__ ((__packed__)) DATA_ATTR; + +/* + * Index header flags (8-bit). + */ +typedef enum { + /* When index header is in an index root attribute: */ + SMALL_INDEX = 0, /* The index is small enough to fit inside the + index root attribute and there is no index + allocation attribute present. */ + LARGE_INDEX = 1, /* The index is too large to fit in the index + root attribute and/or an index allocation + attribute is present. */ + /* + * When index header is in an index block, i.e. is part of index + * allocation attribute: + */ + LEAF_NODE = 0, /* This is a leaf node, i.e. there are no more + nodes branching off it. */ + INDEX_NODE = 1, /* This node indexes other nodes, i.e. is not a + leaf node. */ + NODE_MASK = 1, /* Mask for accessing the *_NODE bits. */ +} __attribute__ ((__packed__)) INDEX_HEADER_FLAGS; + +/* + * This is the header for indexes, describing the INDEX_ENTRY records, which + * follow the INDEX_HEADER. Together the index header and the index entries + * make up a complete index. + * + * IMPORTANT NOTE: The offset, length and size structure members are counted + * relative to the start of the index header structure and not relative to the + * start of the index root or index allocation structures themselves. + */ +typedef struct { + u32 entries_offset; /* Byte offset to first INDEX_ENTRY + aligned to 8-byte boundary. */ + u32 index_length; /* Data size of the index in bytes, + i.e. bytes used from allocated + size, aligned to 8-byte boundary. */ + u32 allocated_size; /* Byte size of this index (block), + multiple of 8 bytes. */ + /* NOTE: For the index root attribute, the above two numbers are always + equal, as the attribute is resident and it is resized as needed. In + the case of the index allocation attribute the attribute is not + resident and hence the allocated_size is a fixed value and must + equal the index_block_size specified by the INDEX_ROOT attribute + corresponding to the INDEX_ALLOCATION attribute this INDEX_BLOCK + belongs to. */ + INDEX_HEADER_FLAGS flags; /* Bit field of INDEX_HEADER_FLAGS. */ + u8 reserved[3]; /* Reserved/align to 8-byte boundary. */ +} __attribute__ ((__packed__)) INDEX_HEADER; + +/* + * Attribute: Index root (0x90). + * + * NOTE: Always resident. + * + * This is followed by a sequence of index entries (INDEX_ENTRY structures) + * as described by the index header. + * + * When a directory is small enough to fit inside the index root then this + * is the only attribute describing the directory. When the directory is too + * large to fit in the index root, on the other hand, two aditional attributes + * are present: an index allocation attribute, containing sub-nodes of the B+ + * directory tree (see below), and a bitmap attribute, describing which virtual + * cluster numbers (vcns) in the index allocation attribute are in use by an + * index block. + * + * NOTE: The root directory (FILE_root) contains an entry for itself. Other + * dircetories do not contain entries for themselves, though. + */ +typedef struct { + ATTR_TYPES type; /* Type of the indexed attribute. Is + $FILE_NAME for directories, zero + for view indexes. No other values + allowed. */ + COLLATION_RULES collation_rule; /* Collation rule used to sort the + index entries. If type is $FILE_NAME, + this must be COLLATION_FILE_NAME. */ + u32 index_block_size; /* Size of each index block in bytes (in + the index allocation attribute). */ + u8 clusters_per_index_block; /* Cluster size of each index block (in + the index allocation attribute), when + an index block is >= than a cluster, + otherwise this will be the log of + the size (like how the encoding of + the mft record size and the index + record size found in the boot sector + work). Has to be a power of 2. */ + u8 reserved[3]; /* Reserved/align to 8-byte boundary. */ + INDEX_HEADER index; /* Index header describing the + following index entries. */ +} __attribute__ ((__packed__)) INDEX_ROOT; + +/* + * Attribute: Index allocation (0xa0). + * + * NOTE: Always non-resident (doesn't make sense to be resident anyway!). + * + * This is an array of index blocks. Each index block starts with an + * INDEX_BLOCK structure containing an index header, followed by a sequence of + * index entries (INDEX_ENTRY structures), as described by the INDEX_HEADER. + */ +typedef struct { +/* 0*/ NTFS_RECORD; /* Magic is "INDX". */ +/* 8*/ s64 lsn; /* $LogFile sequence number of the last + modification of this index block. */ +/* 16*/ VCN index_block_vcn; /* Virtual cluster number of the index block. */ +/* 24*/ INDEX_HEADER index; /* Describes the following index entries. */ +/* sizeof()= 40 (0x28) bytes */ +/* + * When creating the index block, we place the update sequence array at this + * offset, i.e. before we start with the index entries. This also makes sense, + * otherwise we could run into problems with the update sequence array + * containing in itself the last two bytes of a sector which would mean that + * multi sector transfer protection wouldn't work. As you can't protect data + * by overwriting it since you then can't get it back... + * When reading use the data from the ntfs record header. + */ +} __attribute__ ((__packed__)) INDEX_BLOCK; + +typedef INDEX_BLOCK INDEX_ALLOCATION; + +/* + * The system file FILE_Extend/$Reparse contains an index named $R listing + * all reparse points on the volume. The index entry keys are as defined + * below. Note, that there is no index data associated with the index entries. + * + * The index entries are sorted by the index key file_id. The collation rule is + * COLLATION_NTOFS_ULONGS. FIXME: Verify whether the reparse_tag is not the + * primary key / is not a key at all. (AIA) + */ +typedef struct { + u32 reparse_tag; /* Reparse point type (inc. flags). */ + MFT_REF file_id; /* Mft record of the file containing the + reparse point attribute. */ +} __attribute__ ((__packed__)) REPARSE_INDEX_KEY; + +/* + * Quota flags (32-bit). + */ +typedef enum { + /* The user quota flags. Names explain meaning. */ + QUOTA_FLAG_DEFAULT_LIMITS = const_cpu_to_le32(0x00000001), + QUOTA_FLAG_LIMIT_REACHED = const_cpu_to_le32(0x00000002), + QUOTA_FLAG_ID_DELETED = const_cpu_to_le32(0x00000004), + + QUOTA_FLAG_USER_MASK = const_cpu_to_le32(0x00000007), + /* Bit mask for user quota flags. */ + + /* These flags are only present in the quota defaults index entry, + i.e. in the entry where owner_id = QUOTA_DEFAULTS_ID. */ + QUOTA_FLAG_TRACKING_ENABLED = const_cpu_to_le32(0x00000010), + QUOTA_FLAG_ENFORCEMENT_ENABLED = const_cpu_to_le32(0x00000020), + QUOTA_FLAG_TRACKING_REQUESTED = const_cpu_to_le32(0x00000040), + QUOTA_FLAG_LOG_THRESHOLD = const_cpu_to_le32(0x00000080), + QUOTA_FLAG_LOG_LIMIT = const_cpu_to_le32(0x00000100), + QUOTA_FLAG_OUT_OF_DATE = const_cpu_to_le32(0x00000200), + QUOTA_FLAG_CORRUPT = const_cpu_to_le32(0x00000400), + QUOTA_FLAG_PENDING_DELETES = const_cpu_to_le32(0x00000800), +} QUOTA_FLAGS; + +/* + * The system file FILE_Extend/$Quota contains two indexes $O and $Q. Quotas + * are on a per volume and per user basis. + * + * The $Q index contains one entry for each existing user_id on the volume. The + * index key is the user_id of the user/group owning this quota control entry, + * i.e. the key is the owner_id. The user_id of the owner of a file, i.e. the + * owner_id, is found in the standard information attribute. The collation rule + * for $Q is COLLATION_NTOFS_ULONG. + * + * The $O index contains one entry for each user/group who has been assigned + * a quota on that volume. The index key holds the SID of the user_id the + * entry belongs to, i.e. the owner_id. The collation rule for $O is + * COLLATION_NTOFS_SID. + * + * The $O index entry data is the user_id of the user corresponding to the SID. + * This user_id is used as an index into $Q to find the quota control entry + * associated with the SID. + * + * The $Q index entry data is the quota control entry and is defined below. + */ +typedef struct { + u32 version; /* Currently equals 2. */ + QUOTA_FLAGS flags; /* Flags describing this quota entry. */ + u64 bytes_used; /* How many bytes of the quota are in use. */ + s64 change_time; /* Last time this quota entry was changed. */ + s64 threshold; /* Soft quota (-1 if not limited). */ + s64 limit; /* Hard quota (-1 if not limited). */ + s64 exceeded_time; /* How long the soft quota has been exceeded. */ + SID sid; /* The SID of the user/object associated with + this quota entry. Equals zero for the quota + defaults entry. */ +} __attribute__ ((__packed__)) QUOTA_CONTROL_ENTRY; + +/* + * Predefined owner_id values (32-bit). + */ +typedef enum { + QUOTA_INVALID_ID = const_cpu_to_le32(0x00000000), + QUOTA_DEFAULTS_ID = const_cpu_to_le32(0x00000001), + QUOTA_FIRST_USER_ID = const_cpu_to_le32(0x00000100), +} PREDEFINED_OWNER_IDS; + +/* + * Index entry flags (16-bit). + */ +typedef enum { + INDEX_ENTRY_NODE = const_cpu_to_le16(1), /* This entry contains a + sub-node, i.e. a reference to an index + block in form of a virtual cluster + number (see below). */ + INDEX_ENTRY_END = const_cpu_to_le16(2), /* This signifies the last + entry in an index block. The index + entry does not represent a file but it + can point to a sub-node. */ + INDEX_ENTRY_SPACE_FILLER = 0xffff, /* Just to force 16-bit width. */ +} __attribute__ ((__packed__)) INDEX_ENTRY_FLAGS; + +/* + * This the index entry header (see below). + */ +typedef struct { +/* 0*/ union { /* Only valid when INDEX_ENTRY_END is not set. */ + MFT_REF indexed_file; /* The mft reference of the file + described by this index + entry. Used for directory + indexes. */ + struct { /* Used for views/indexes to find the entry's data. */ + u16 data_offset; /* Data byte offset from this + INDEX_ENTRY. Follows the + index key. */ + u16 data_length; /* Data length in bytes. */ + u32 reservedV; /* Reserved (zero). */ + } __attribute__ ((__packed__)); + } __attribute__ ((__packed__)); +/* 8*/ u16 length; /* Byte size of this index entry, multiple of + 8-bytes. */ +/* 10*/ u16 key_length; /* Byte size of the key value, which is in the + index entry. It follows field reserved. Not + multiple of 8-bytes. */ +/* 12*/ INDEX_ENTRY_FLAGS flags; /* Bit field of INDEX_ENTRY_* flags. */ +/* 14*/ u16 reserved; /* Reserved/align to 8-byte boundary. */ +/* sizeof() = 16 bytes */ +} __attribute__ ((__packed__)) INDEX_ENTRY_HEADER; + +/* + * This is an index entry. A sequence of such entries follows each INDEX_HEADER + * structure. Together they make up a complete index. The index follows either + * an index root attribute or an index allocation attribute. + * + * NOTE: Before NTFS 3.0 only filename attributes were indexed. + */ +typedef struct { +/* 0*/ INDEX_ENTRY_HEADER; /* The index entry header (see above). */ +/* 16*/ union { /* The key of the indexed attribute. NOTE: Only present + if INDEX_ENTRY_END bit in flags is not set. NOTE: On + NTFS versions before 3.0 the only valid key is the + FILE_NAME_ATTR. On NTFS 3.0+ the following + additional index keys are defined: */ + FILE_NAME_ATTR file_name;/* $I30 index in directories. */ + SII_INDEX_KEY sii; /* $SII index in $Secure. */ + SDH_INDEX_KEY sdh; /* $SDH index in $Secure. */ + GUID object_id; /* $O index in FILE_Extend/$ObjId: The + object_id of the mft record found in + the data part of the index. */ + REPARSE_INDEX_KEY; /* $R index in FILE_Extend/$Reparse. */ + SID sid; /* $O index in FILE_Extend/$Quota: + SID of the owner of the user_id. */ + u32 owner_id; /* $Q index in FILE_Extend/$Quota: + user_id of the owner of the quota + control entry in the data part of + the index. */ + } __attribute__ ((__packed__)) key; + /* The (optional) index data is inserted here when creating. */ + // VCN vcn; /* If INDEX_ENTRY_NODE bit in flags is set, the last + // eight bytes of this index entry contain the virtual + // cluster number of the index block that holds the + // entries immediately preceding the current entry (the + // vcn references the corresponding cluster in the data + // of the non-resident index allocation attribute). If + // the key_length is zero, then the vcn immediately + // follows the INDEX_ENTRY_HEADER. Regardless of + // key_length, the address of the 8-byte boundary + // alligned vcn of INDEX_ENTRY{_HEADER} *ie is given by + // (char*)ie + le16_to_cpu(ie*)->length) - sizeof(VCN), + // where sizeof(VCN) can be hardcoded as 8 if wanted. */ +} __attribute__ ((__packed__)) INDEX_ENTRY; + +/* + * Attribute: Bitmap (0xb0). + * + * Contains an array of bits (aka a bitfield). + * + * When used in conjunction with the index allocation attribute, each bit + * corresponds to one index block within the index allocation attribute. Thus + * the number of bits in the bitmap * index block size / cluster size is the + * number of clusters in the index allocation attribute. + */ +typedef struct { + u8 bitmap[0]; /* Array of bits. */ +} __attribute__ ((__packed__)) BITMAP_ATTR; + +/* + * The reparse point tag defines the type of the reparse point. It also + * includes several flags, which further describe the reparse point. + * + * The reparse point tag is an unsigned 32-bit value divided in three parts: + * + * 1. The least significant 16 bits (i.e. bits 0 to 15) specifiy the type of + * the reparse point. + * 2. The 13 bits after this (i.e. bits 16 to 28) are reserved for future use. + * 3. The most significant three bits are flags describing the reparse point. + * They are defined as follows: + * bit 29: Name surrogate bit. If set, the filename is an alias for + * another object in the system. + * bit 30: High-latency bit. If set, accessing the first byte of data will + * be slow. (E.g. the data is stored on a tape drive.) + * bit 31: Microsoft bit. If set, the tag is owned by Microsoft. User + * defined tags have to use zero here. + */ +typedef enum { + IO_REPARSE_TAG_IS_ALIAS = const_cpu_to_le32(0x20000000), + IO_REPARSE_TAG_IS_HIGH_LATENCY = const_cpu_to_le32(0x40000000), + IO_REPARSE_TAG_IS_MICROSOFT = const_cpu_to_le32(0x80000000), + + IO_REPARSE_TAG_RESERVED_ZERO = const_cpu_to_le32(0x00000000), + IO_REPARSE_TAG_RESERVED_ONE = const_cpu_to_le32(0x00000001), + IO_REPARSE_TAG_RESERVED_RANGE = const_cpu_to_le32(0x00000001), + + IO_REPARSE_TAG_NSS = const_cpu_to_le32(0x68000005), + IO_REPARSE_TAG_NSS_RECOVER = const_cpu_to_le32(0x68000006), + IO_REPARSE_TAG_SIS = const_cpu_to_le32(0x68000007), + IO_REPARSE_TAG_DFS = const_cpu_to_le32(0x68000008), + + IO_REPARSE_TAG_MOUNT_POINT = const_cpu_to_le32(0x88000003), + + IO_REPARSE_TAG_HSM = const_cpu_to_le32(0xa8000004), + + IO_REPARSE_TAG_SYMBOLIC_LINK = const_cpu_to_le32(0xe8000000), + + IO_REPARSE_TAG_VALID_VALUES = const_cpu_to_le32(0xe000ffff), +} PREDEFINED_REPARSE_TAGS; + +/* + * Attribute: Reparse point (0xc0). + * + * NOTE: Can be resident or non-resident. + */ +typedef struct { + u32 reparse_tag; /* Reparse point type (inc. flags). */ + u16 reparse_data_length; /* Byte size of reparse data. */ + u16 reserved; /* Align to 8-byte boundary. */ + u8 reparse_data[0]; /* Meaning depends on reparse_tag. */ +} __attribute__ ((__packed__)) REPARSE_POINT; + +/* + * Attribute: Extended attribute (EA) information (0xd0). + * + * NOTE: Always resident. (Is this true???) + */ +typedef struct { + u16 ea_length; /* Byte size of the packed extended + attributes. */ + u16 need_ea_count; /* The number of extended attributes which have + the NEED_EA bit set. */ + u32 ea_query_length; /* Byte size of the buffer required to query + the extended attributes when calling + ZwQueryEaFile() in Windows NT/2k. I.e. the + byte size of the unpacked extended + attributes. */ +} __attribute__ ((__packed__)) EA_INFORMATION; + +/* + * Extended attribute flags (8-bit). + */ +typedef enum { + NEED_EA = 0x80, +} __attribute__ ((__packed__)) EA_FLAGS; + +/* + * Attribute: Extended attribute (EA) (0xe0). + * + * NOTE: Always non-resident. (Is this true?) + * + * Like the attribute list and the index buffer list, the EA attribute value is + * a sequence of EA_ATTR variable length records. + * + * FIXME: It appears weird that the EA name is not unicode. Is it true? + */ +typedef struct { + u32 next_entry_offset; /* Offset to the next EA_ATTR. */ + EA_FLAGS flags; /* Flags describing the EA. */ + u8 ea_name_length; /* Length of the name of the extended + attribute in bytes. */ + u16 ea_value_length; /* Byte size of the EA's value. */ + u8 ea_name[0]; /* Name of the EA. */ + u8 ea_value[0]; /* The value of the EA. Immediately + follows the name. */ +} __attribute__ ((__packed__)) EA_ATTR; + +/* + * Attribute: Property set (0xf0). + * + * Intended to support Native Structure Storage (NSS) - a feature removed from + * NTFS 3.0 during beta testing. + */ +typedef struct { + /* Irrelevant as feature unused. */ +} __attribute__ ((__packed__)) PROPERTY_SET; + +/* + * Attribute: Logged utility stream (0x100). + * + * NOTE: Can be resident or non-resident. + * + * Operations on this attribute are logged to the journal ($LogFile) like + * normal metadata changes. + * + * Used by the Encrypting File System (EFS). All encrypted files have this + * attribute with the name $EFS. + */ +typedef struct { + /* Can be anything the creator chooses. */ + /* EFS uses it as follows: */ + // FIXME: Type this info, verifying it along the way. (AIA) +} __attribute__ ((__packed__)) LOGGED_UTILITY_STREAM, EFS_ATTR; + +#endif /* defined _NTFS_LAYOUT_H */ + From 44b052d5ff5bb9df3585655e310a18b5b77b73a8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1006/2994] Rename: include/layout.h -> include/ntfs/layout.h }(Logical change 1.280) --- include/layout.h | 2196 ---------------------------------------------- 1 file changed, 2196 deletions(-) delete mode 100644 include/layout.h diff --git a/include/layout.h b/include/layout.h deleted file mode 100644 index b62e6000..00000000 --- a/include/layout.h +++ /dev/null @@ -1,2196 +0,0 @@ -/* - * layout.h - Ntfs on-disk layout structures. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2002 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_LAYOUT_H -#define _NTFS_LAYOUT_H - -#include "types.h" -#include "endians.h" -#include "support.h" - -/* The NTFS oem_id */ -#define magicNTFS const_cpu_to_le64(0x202020205346544e) /* "NTFS " */ - -/* - * Location of bootsector on partition: - * The standard NTFS_BOOT_SECTOR is on sector 0 of the partition. - * On NT4 and above there is one backup copy of the boot sector to - * be found on the last sector of the partition (not normally accessible - * from within Windows as the bootsector contained number of sectors - * value is one less than the actual value!). - * On versions of NT 3.51 and earlier, the backup copy was located at - * number of sectors/2 (integer divide), i.e. in the middle of the volume. - */ - -/* - * BIOS parameter block (bpb) structure. - */ -typedef struct { - u16 bytes_per_sector; /* Size of a sector in bytes. */ - u8 sectors_per_cluster; /* Size of a cluster in sectors. */ - u16 reserved_sectors; /* zero */ - u8 fats; /* zero */ - u16 root_entries; /* zero */ - u16 sectors; /* zero */ - u8 media_type; /* 0xf8 = hard disk */ - u16 sectors_per_fat; /* zero */ - u16 sectors_per_track; /* irrelevant */ - u16 heads; /* irrelevant */ - u32 hidden_sectors; /* zero */ - u32 large_sectors; /* zero */ -/* sizeof() = 25 (0x19) bytes */ -} __attribute__ ((__packed__)) BIOS_PARAMETER_BLOCK; - -/* - * NTFS boot sector structure. - */ -typedef struct { - u8 jump[3]; /* Irrelevant (jump to boot up code).*/ - u64 oem_id; /* Magic "NTFS ". */ - BIOS_PARAMETER_BLOCK bpb; /* See BIOS_PARAMETER_BLOCK. */ - u8 unused[4]; /* zero, NTFS diskedit.exe states that - this is actually: - u8 physical_drive; // 0x80 - u8 current_head; // zero - u8 extended_boot_signature; // 0x80 - u8 unused; // zero - */ -/*0x28*/s64 number_of_sectors; /* Number of sectors in volume. Gives - maximum volume size of 2^63 sectors. - Assuming standard sector size of 512 - bytes, the maximum byte size is - approx. 4.7x10^21 bytes. (-; */ - s64 mft_lcn; /* Cluster location of mft data. */ - s64 mftmirr_lcn; /* Cluster location of copy of mft. */ - s8 clusters_per_mft_record; /* Mft record size in clusters. */ - u8 reserved0[3]; /* zero */ - s8 clusters_per_index_record; /* Index block size in clusters. */ - u8 reserved1[3]; /* zero */ - u64 volume_serial_number; /* Irrelevant (serial number). */ - u32 checksum; /* Boot sector checksum. */ -/*0x54*/u8 bootstrap[426]; /* Irrelevant (boot up code). */ - u16 end_of_sector_marker; /* End of bootsector magic. Always is - 0xaa55 in little endian. */ -/* sizeof() = 512 (0x200) bytes */ -} __attribute__ ((__packed__)) NTFS_BOOT_SECTOR; - -/* - * Magic identifiers present at the beginning of all ntfs record containing - * records (like mft records for example). - */ -typedef enum { - magic_BAAD = const_cpu_to_le32(0x44414142), /* BAAD == corrupt record */ - magic_CHKD = const_cpu_to_le32(0x424b4843), /* CHKD == chkdsk ??? */ - magic_FILE = const_cpu_to_le32(0x454c4946), /* FILE == mft entry */ - magic_HOLE = const_cpu_to_le32(0x454c4f48), /* HOLE == ? (NTFS 3.0+?) */ - magic_INDX = const_cpu_to_le32(0x58444e49), /* INDX == index buffer */ -} NTFS_RECORD_TYPES; - -/* - * Generic magic comparison macros. Finally found a use for the ## preprocessor - * operator! (-8 - */ -#define ntfs_is_magic(x, m) ( (u32)(x) == (u32)magic_##m ) -#define ntfs_is_magicp(p, m) ( *(u32*)(p) == (u32)magic_##m ) - -/* - * Specialised magic comparison macros. - */ -#define ntfs_is_baad_record(x) ( ntfs_is_magic (x, BAAD) ) -#define ntfs_is_baad_recordp(p) ( ntfs_is_magicp(p, BAAD) ) -#define ntfs_is_chkd_record(x) ( ntfs_is_magic (x, CHKD) ) -#define ntfs_is_chkd_recordp(p) ( ntfs_is_magicp(p, CHKD) ) -#define ntfs_is_file_record(x) ( ntfs_is_magic (x, FILE) ) -#define ntfs_is_file_recordp(p) ( ntfs_is_magicp(p, FILE) ) -#define ntfs_is_hole_record(x) ( ntfs_is_magic (x, HOLE) ) -#define ntfs_is_hole_recordp(p) ( ntfs_is_magicp(p, HOLE) ) -#define ntfs_is_indx_record(x) ( ntfs_is_magic (x, INDX) ) -#define ntfs_is_indx_recordp(p) ( ntfs_is_magicp(p, INDX) ) - -#define ntfs_is_mft_record(x) ( ntfs_is_file_record(x) ) -#define ntfs_is_mft_recordp(p) ( ntfs_is_file_recordp(p) ) - -/* - * Defines for the NTFS filesystem. Don't want to use BLOCK_SIZE and - * BLOCK_SIZE_BITS from the kernel as that is 1024 and hence too high for us. - */ -#define NTFS_SECTOR_SIZE 512 -#define NTFS_SECTOR_SIZE_BITS 9 - -/* - * The Update Sequence Array (usa) is an array of the u16 values which belong - * to the end of each sector protected by the update sequence record in which - * this array is contained. Note that the first entry is the Update Sequence - * Number (usn), a cyclic counter of how many times the protected record has - * been written to disk. The values 0 and -1 (ie. 0xffff) are not used. All - * last u16's of each sector have to be equal to the usn (during reading) or - * are set to it (during writing). If they are not, an incomplete multi sector - * transfer has occured when the data was written. - * The maximum size for the update sequence array is fixed to: - * maximum size = usa_ofs + (usa_count * 2) = 510 bytes - * The 510 bytes comes from the fact that the last u16 in the array has to - * (obviously) finish before the last u16 of the first 512-byte sector. - * This formula can be used as a consistency check in that usa_ofs + - * (usa_count * 2) has to be less than or equal to 510. - */ -typedef struct { - NTFS_RECORD_TYPES magic;/* A four-byte magic identifying the - record type and/or status. */ - u16 usa_ofs; /* Offset to the Update Sequence Array (usa) - from the start of the ntfs record. */ - u16 usa_count; /* Number of u16 sized entries in the usa - including the Update Sequence Number (usn), - thus the number of fixups is the usa_count - minus 1. */ -} __attribute__ ((__packed__)) NTFS_RECORD; - -/* - * System files mft record numbers. All these files are always marked as used - * in the bitmap attribute of the mft; presumably in order to avoid accidental - * allocation for random other mft records. Also, the sequence number for each - * of the system files is always equal to their mft record number and it is - * never modified. - */ -typedef enum { - FILE_MFT = 0, /* Master file table (mft). Data attribute - contains the entries and bitmap attribute - records which ones are in use (bit==1). */ - FILE_MFTMirr = 1, /* Mft mirror: copy of first four mft records - in data attribute. If cluster size > 4kiB, - copy of first N mft records, with - N = cluster_size / mft_record_size. */ - FILE_LogFile = 2, /* Journalling log in data attribute. */ - FILE_Volume = 3, /* Volume name attribute and volume information - attribute (flags and ntfs version). Windows - refers to this file as volume DASD (Direct - Access Storage Device). */ - FILE_AttrDef = 4, /* Array of attribute definitions in data - attribute. */ - FILE_root = 5, /* Root directory. */ - FILE_Bitmap = 6, /* Allocation bitmap of all clusters (lcns) in - data attribute. */ - FILE_Boot = 7, /* Boot sector (always at cluster 0) in data - attribute. */ - FILE_BadClus = 8, /* Contains all bad clusters in the non-resident - data attribute. */ - FILE_Secure = 9, /* Shared security descriptors in data attribute - and two indexes into the descriptors. - Appeared in Windows 2000. Before that, this - file was named $Quota but was unused. */ - FILE_UpCase = 10, /* Uppercase equivalents of all 65536 Unicode - characters in data attribute. */ - FILE_Extend = 11, /* Directory containing other system files (eg. - $ObjId, $Quota, $Reparse and $UsnJrnl). This - is new to NTFS3.0. */ - FILE_reserved12 = 12, /* Reserved for future use (records 12-15). */ - FILE_reserved13 = 13, - FILE_reserved14 = 14, - FILE_reserved15 = 15, - FILE_first_user = 16, /* First user file, used as test limit for - whether to allow opening a file or not. */ -} NTFS_SYSTEM_FILES; - -/* - * These are the so far known MFT_RECORD_* flags (16-bit) which contain - * information about the mft record in which they are present. - */ -typedef enum { - MFT_RECORD_IN_USE = const_cpu_to_le16(0x0001), - MFT_RECORD_IS_DIRECTORY = const_cpu_to_le16(0x0002), - MFT_REC_SPACE_FILLER = 0xffff /* Just to make flags 16-bit. */ -} __attribute__ ((__packed__)) MFT_RECORD_FLAGS; - -/* - * mft references (aka file references or file record segment references) are - * used whenever a structure needs to refer to a record in the mft. - * - * A reference consists of a 48-bit index into the mft and a 16-bit sequence - * number used to detect stale references. - * - * For error reporting purposes we treat the 48-bit index as a signed quantity. - * - * The sequence number is a circular counter (skipping 0) describing how many - * times the referenced mft record has been (re)used. This has to match the - * sequence number of the mft record being referenced, otherwise the reference - * is considered stale and removed (FIXME: only ntfsck or the driver itself?). - * - * If the sequence number is zero it is assumed that no sequence number - * consistency checking should be performed. - * - * FIXME: Since inodes are 32-bit as of now, the driver needs to always check - * for high_part being 0 and if not either BUG(), cause a panic() or handle - * the situation in some other way. This shouldn't be a problem as a volume has - * to become HUGE in order to need more than 32-bits worth of mft records. - * Assuming the standard mft record size of 1kb only the records (never mind - * the non-resident attributes, etc.) would require 4Tb of space on their own - * for the first 32 bits worth of records. This is only if some strange person - * doesn't decide to foul play and make the mft sparse which would be a really - * horrible thing to do as it would trash our current driver implementation. )-: - * Do I hear screams "we want 64-bit inodes!" ?!? (-; - * - * FIXME: The mft zone is defined as the first 12% of the volume. This space is - * reserved so that the mft can grow contiguously and hence doesn't become - * fragmented. Volume free space includes the empty part of the mft zone and - * when the volume's free 88% are used up, the mft zone is shrunk by a factor - * of 2, thus making more space available for more files/data. This process is - * repeated everytime there is no more free space except for the mft zone until - * there really is no more free space. - */ - -/* - * Typedef the MFT_REF as a 64-bit value for easier handling. - * Also define two unpacking macros to get to the reference (MREF) and - * sequence number (MSEQNO) respectively. - * The _LE versions are to be applied on little endian MFT_REFs. - * Note: The _LE versions will return a CPU endian formatted value! - */ -typedef enum { - MFT_REF_MASK_CPU = 0x0000ffffffffffffULL, - MFT_REF_MASK_LE = const_cpu_to_le64(0x0000ffffffffffffULL), -} MFT_REF_CONSTS; - -typedef u64 MFT_REF; - -#define MK_MREF(m, s) ((MFT_REF)(((MFT_REF)(s) << 48) | \ - ((MFT_REF)(m) & MFT_REF_MASK_CPU))) -#define MK_LE_MREF(m, s) const_cpu_to_le64(((MFT_REF)(((MFT_REF)(s) << 48) | \ - ((MFT_REF)(m) & MFT_REF_MASK_CPU)))) - -#define MREF(x) ((u64)((x) & MFT_REF_MASK_CPU)) -#define MSEQNO(x) ((u16)(((x) >> 48) & 0xffff)) -#define MREF_LE(x) ((u64)(const_le64_to_cpu(x) & MFT_REF_MASK_CPU)) -#define MSEQNO_LE(x) ((u16)((const_le64_to_cpu(x) >> 48) & 0xffff)) - -#define IS_ERR_MREF(x) (((x) & 0x0000800000000000ULL) ? 1 : 0) -#define ERR_MREF(x) ((u64)((s64)(x))) -#define MREF_ERR(x) ((int)((s64)(x))) - -/* - * The mft record header present at the beginning of every record in the mft. - * This is followed by a sequence of variable length attribute records which - * is terminated by an attribute of type AT_END which is a truncated attribute - * in that it only consists of the attribute type code AT_END and none of the - * other members of the attribute structure are present. - */ -typedef struct { -/*Ofs*/ -/* 0*/ NTFS_RECORD; /* Usually the magic is "FILE". */ -/* 8*/ u64 lsn; /* $LogFile sequence number for this record. - Changed every time the record is modified. */ -/* 16*/ u16 sequence_number; /* Number of times this mft record has been - reused. (See description for MFT_REF - above.) NOTE: The increment (skipping zero) - is done when the file is deleted. NOTE: If - this is zero it is left zero. */ -/* 18*/ u16 link_count; /* Number of hard links, i.e. the number of - directory entries referencing this record. - NOTE: Only used in mft base records. - NOTE: When deleting a directory entry we - check the link_count and if it is 1 we - delete the file. Otherwise we delete the - FILE_NAME_ATTR being referenced by the - directory entry from the mft record and - decrement the link_count. - FIXME: Careful with Win32 + DOS names! */ -/* 20*/ u16 attrs_offset; /* Byte offset to the first attribute in this - mft record from the start of the mft record. - NOTE: Must be aligned to 8-byte boundary. */ -/* 22*/ MFT_RECORD_FLAGS flags; /* Bit array of MFT_RECORD_FLAGS. When a file - is deleted, the MFT_RECORD_IN_USE flag is - set to zero. */ -/* 24*/ u32 bytes_in_use; /* Number of bytes used in this mft record. - NOTE: Must be aligned to 8-byte boundary. */ -/* 28*/ u32 bytes_allocated; /* Number of bytes allocated for this mft - record. This should be equal to the mft - record size. */ -/* 32*/ MFT_REF base_mft_record; /* This is zero for base mft records. - When it is not zero it is a mft reference - pointing to the base mft record to which - this record belongs (this is then used to - locate the attribute list attribute present - in the base record which describes this - extension record and hence might need - modification when the extension record - itself is modified, also locating the - attribute list also means finding the other - potential extents, belonging to the non-base - mft record). */ -/* 40*/ u16 next_attr_instance; /* The instance number that will be - assigned to the next attribute added to this - mft record. NOTE: Incremented each time - after it is used. NOTE: Every time the mft - record is reused this number is set to zero. - NOTE: The first instance number is always 0. - */ -/* sizeof() = 42 bytes */ -/* NTFS 3.1+ (Windows XP and above) introduce the following additions. */ -/* 42*/ //u16 reserved; /* Reserved/alignment. */ -/* 44*/ //u32 mft_record_number; /* Number of this mft record. */ -/* sizeof() = 48 bytes */ -/* - * When (re)using the mft record, we place the update sequence array at this - * offset, i.e. before we start with the attributes. This also makes sense, - * otherwise we could run into problems with the update sequence array - * containing in itself the last two bytes of a sector which would mean that - * multi sector transfer protection wouldn't work. As you can't protect data - * by overwriting it since you then can't get it back... - * When reading we obviously use the data from the ntfs record header. - */ -} __attribute__ ((__packed__)) MFT_RECORD; - -/* - * System defined attributes (32-bit). Each attribute type has a corresponding - * attribute name (Unicode string of maximum 64 character length) as described - * by the attribute definitions present in the data attribute of the $AttrDef - * system file. On NTFS 3.0 volumes the names are just as the types are named - * in the below enum exchanging AT_ for the dollar sign ($). If that isn't a - * revealing choice of symbol... (-; - */ -typedef enum { - AT_UNUSED = const_cpu_to_le32( 0), - AT_STANDARD_INFORMATION = const_cpu_to_le32( 0x10), - AT_ATTRIBUTE_LIST = const_cpu_to_le32( 0x20), - AT_FILE_NAME = const_cpu_to_le32( 0x30), - AT_OBJECT_ID = const_cpu_to_le32( 0x40), - AT_SECURITY_DESCRIPTOR = const_cpu_to_le32( 0x50), - AT_VOLUME_NAME = const_cpu_to_le32( 0x60), - AT_VOLUME_INFORMATION = const_cpu_to_le32( 0x70), - AT_DATA = const_cpu_to_le32( 0x80), - AT_INDEX_ROOT = const_cpu_to_le32( 0x90), - AT_INDEX_ALLOCATION = const_cpu_to_le32( 0xa0), - AT_BITMAP = const_cpu_to_le32( 0xb0), - AT_REPARSE_POINT = const_cpu_to_le32( 0xc0), - AT_EA_INFORMATION = const_cpu_to_le32( 0xd0), - AT_EA = const_cpu_to_le32( 0xe0), - AT_PROPERTY_SET = const_cpu_to_le32( 0xf0), - AT_LOGGED_UTILITY_STREAM = const_cpu_to_le32( 0x100), - AT_FIRST_USER_DEFINED_ATTRIBUTE = const_cpu_to_le32( 0x1000), - AT_END = const_cpu_to_le32(0xffffffff), -} ATTR_TYPES; - -/* - * The collation rules for sorting views/indexes/etc (32-bit). - * - * COLLATION_UNICODE_STRING - Collate Unicode strings by comparing their binary - * Unicode values, except that when a character can be uppercased, the - * upper case value collates before the lower case one. - * COLLATION_FILE_NAME - Collate file names as Unicode strings. The collation - * is done very much like COLLATION_UNICODE_STRING. In fact I have no idea - * what the difference is. Perhaps the difference is that file names - * would treat some special characters in an odd way (see - * unistr.c::ntfs_collate_names() and unistr.c::legal_ansi_char_array[] - * for what I mean but COLLATION_UNICODE_STRING would not give any special - * treatment to any characters at all, but this is speculation. - * COLLATION_NTOFS_ULONG - Sorting is done according to ascending u32 key - * values. E.g. used for $SII index in FILE_Secure, which sorts by - * security_id (u32). - * COLLATION_NTOFS_SID - Sorting is done according to ascending SID values. - * E.g. used for $O index in FILE_Extend/$Quota. - * COLLATION_NTOFS_SECURITY_HASH - Sorting is done first by ascending hash - * values and second by ascending security_id values. E.g. used for $SDH - * index in FILE_Secure. - * COLLATION_NTOFS_ULONGS - Sorting is done according to a sequence of ascending - * u32 key values. E.g. used for $O index in FILE_Extend/$ObjId, which - * sorts by object_id (16-byte), by splitting up the object_id in four - * u32 values and using them as individual keys. E.g. take the following - * two security_ids, stored as follows on disk: - * 1st: a1 61 65 b7 65 7b d4 11 9e 3d 00 e0 81 10 42 59 - * 2nd: 38 14 37 d2 d2 f3 d4 11 a5 21 c8 6b 79 b1 97 45 - * To compare them, they are split into four u32 values each, like so: - * 1st: 0xb76561a1 0x11d47b65 0xe0003d9e 0x59421081 - * 2nd: 0xd2371438 0x11d4f3d2 0x6bc821a5 0x4597b179 - * Now, it is apparent why the 2nd object_id collates after the 1st: the - * first u32 value of the 1st object_id is less than the first u32 of - * the 2nd object_id. If the first u32 values of both object_ids were - * equal then the second u32 values would be compared, etc. - */ -typedef enum { - COLLATION_BINARY = const_cpu_to_le32(0), /* Collate by binary - compare where the first byte is most - significant. */ - COLLATION_FILE_NAME = const_cpu_to_le32(1), /* Collate file names - as Unicode strings. */ - COLLATION_UNICODE_STRING = const_cpu_to_le32(2), /* Collate Unicode - strings by comparing their binary - Unicode values, except that when a - character can be uppercased, the upper - case value collates before the lower - case one. */ - COLLATION_NTOFS_ULONG = const_cpu_to_le32(16), - COLLATION_NTOFS_SID = const_cpu_to_le32(17), - COLLATION_NTOFS_SECURITY_HASH = const_cpu_to_le32(18), - COLLATION_NTOFS_ULONGS = const_cpu_to_le32(19), -} COLLATION_RULES; - -/* - * The flags (32-bit) describing attribute properties in the attribute - * definition structure. FIXME: This information is from Regis's information - * and, according to him, it is not certain and probably incomplete. - * The INDEXABLE flag is fairly certainly correct as only the file name - * attribute has this flag set and this is the only attribute indexed in NT4. - */ -typedef enum { - INDEXABLE = const_cpu_to_le32(0x02), /* Attribute can be - indexed. */ - NEED_TO_REGENERATE = const_cpu_to_le32(0x40), /* Need to regenerate - during regeneration - phase. */ - CAN_BE_NON_RESIDENT = const_cpu_to_le32(0x80), /* Attribute can be - non-resident. */ -} ATTR_DEF_FLAGS; - -/* - * The data attribute of FILE_AttrDef contains a sequence of attribute - * definitions for the NTFS volume. With this, it is supposed to be safe for an - * older NTFS driver to mount a volume containing a newer NTFS version without - * damaging it (that's the theory. In practice it's: not damaging it too much). - * Entries are sorted by attribute type. The flags describe whether the - * attribute can be resident/non-resident and possibly other things, but the - * actual bits are unknown. - */ -typedef struct { -/*hex ofs*/ -/* 0*/ uchar_t name[0x40]; /* Unicode name of the attribute. Zero - terminated. */ -/* 80*/ ATTR_TYPES type; /* Type of the attribute. */ -/* 84*/ u32 display_rule; /* Default display rule. - FIXME: What does it mean? (AIA) */ -/* 88*/ COLLATION_RULES collation_rule; /* Default collation rule. */ -/* 8c*/ ATTR_DEF_FLAGS flags; /* Flags describing the attribute. */ -/* 90*/ s64 min_size; /* Optional minimum attribute size. */ -/* 98*/ s64 max_size; /* Maximum size of attribute. */ -/* sizeof() = 0xa0 or 160 bytes */ -} __attribute__ ((__packed__)) ATTR_DEF; - -/* - * Attribute flags (16-bit). - */ -typedef enum { - ATTR_IS_COMPRESSED = const_cpu_to_le16(0x0001), - ATTR_COMPRESSION_MASK = const_cpu_to_le16(0x00ff), /* Compression - method mask. Also, first - illegal value. */ - ATTR_IS_ENCRYPTED = const_cpu_to_le16(0x4000), - ATTR_IS_SPARSE = const_cpu_to_le16(0x8000), -} __attribute__ ((__packed__)) ATTR_FLAGS; - -/* - * Attribute compression. - * - * Only the data attribute is ever compressed in the current ntfs driver in - * Windows. Further, compression is only applied when the data attribute is - * non-resident. Finally, to use compression, the maximum allowed cluster size - * on a volume is 4kib. - * - * The compression method is based on independently compressing blocks of X - * clusters, where X is determined from the compression_unit value found in the - * non-resident attribute record header (more precisely: X = 2^compression_unit - * clusters). On Windows NT/2k, X always is 16 clusters (compression_unit = 4). - * - * There are three different cases of how a compression block of X clusters - * can be stored: - * - * 1) The data in the block is all zero (a sparse block): - * This is stored as a sparse block in the runlist, i.e. the runlist - * entry has length = X and lcn = -1. The mapping pairs array actually - * uses a delta_lcn value length of 0, i.e. delta_lcn is not present at - * all, which is then interpreted by the driver as lcn = -1. - * NOTE: Even uncompressed files can be sparse on NTFS 3.0 volumes, then - * the same principles apply as above, except that the length is not - * restricted to being any particular value. - * - * 2) The data in the block is not compressed: - * This happens when compression doesn't reduce the size of the block - * in clusters. I.e. if compression has a small effect so that the - * compressed data still occupies X clusters, then the uncompressed data - * is stored in the block. - * This case is recognised by the fact that the runlist entry has - * length = X and lcn >= 0. The mapping pairs array stores this as - * normal with a run length of X and some specific delta_lcn, i.e. - * delta_lcn has to be present. - * - * 3) The data in the block is compressed: - * The common case. This case is recognised by the fact that the run - * list entry has length L < X and lcn >= 0. The mapping pairs array - * stores this as normal with a run length of X and some specific - * delta_lcn, i.e. delta_lcn has to be present. This runlist entry is - * immediately followed by a sparse entry with length = X - L and - * lcn = -1. The latter entry is to make up the vcn counting to the - * full compression block size X. - * - * In fact, life is more complicated because adjacent entries of the same type - * can be coalesced. This means that one has to keep track of the number of - * clusters handled and work on a basis of X clusters at a time being one - * block. An example: if length L > X this means that this particular runlist - * entry contains a block of length X and part of one or more blocks of length - * L - X. Another example: if length L < X, this does not necessarily mean that - * the block is compressed as it might be that the lcn changes inside the block - * and hence the following runlist entry describes the continuation of the - * potentially compressed block. The block would be compressed if the - * following runlist entry describes at least X - L sparse clusters, thus - * making up the compression block length as described in point 3 above. (Of - * course, there can be several runlist entries with small lengths so that the - * sparse entry does not follow the first data containing entry with - * length < X.) - * - * NOTE: At the end of the compressed attribute value, there most likely is not - * just the right amount of data to make up a compression block, thus this data - * is not even attempted to be compressed. It is just stored as is, unless - * the number of clusters it occupies is reduced when compressed in which case - * it is stored as a compressed compression block, complete with sparse - * clusters at the end. - */ - -/* - * Flags of resident attributes (8-bit). - */ -typedef enum { - RESIDENT_ATTR_IS_INDEXED = 0x01, /* Attribute is referenced in an index - (has implications for deleting and - modifying the attribute). */ -} __attribute__ ((__packed__)) RESIDENT_ATTR_FLAGS; - -/* - * Attribute record header. Always aligned to 8-byte boundary. - */ -typedef struct { -/*Ofs*/ -/* 0*/ ATTR_TYPES type; /* The (32-bit) type of the attribute. */ -/* 4*/ u32 length; /* Byte size of the resident part of the - attribute (aligned to 8-byte boundary). - Used to get to the next attribute. */ -/* 8*/ u8 non_resident; /* If 0, attribute is resident. - If 1, attribute is non-resident. */ -/* 9*/ u8 name_length; /* Unicode character size of name of attribute. - 0 if unnamed. */ -/* 10*/ u16 name_offset; /* If name_length != 0, the byte offset to the - beginning of the name from the attribute - record. Note that the name is stored as a - Unicode string. When creating, place offset - just at the end of the record header. Then, - follow with attribute value or mapping pairs - array, resident and non-resident attributes - respectively, aligning to an 8-byte - boundary. */ -/* 12*/ ATTR_FLAGS flags; /* Flags describing the attribute. */ -/* 14*/ u16 instance; /* The instance of this attribute record. This - number is unique within this mft record (see - MFT_RECORD/next_attribute_instance notes - above for more details). */ -/* 16*/ union { - /* Resident attributes. */ - struct { -/* 16 */ u32 value_length; /* Byte size of attribute value. */ -/* 20 */ u16 value_offset; /* Byte offset of the attribute - value from the start of the - attribute record. When creating, - align to 8-byte boundary if we - have a name present as this might - not have a length of a multiple - of 8-bytes. */ -/* 22 */ RESIDENT_ATTR_FLAGS resident_flags; /* See above. */ -/* 23 */ s8 reservedR; /* Reserved/alignment to 8-byte - boundary. */ - } __attribute__ ((__packed__)); - /* Non-resident attributes. */ - struct { -/* 16*/ VCN lowest_vcn; /* Lowest valid virtual cluster number - for this portion of the attribute value or - 0 if this is the only extent (usually the - case). - Only when an attribute list is used - does lowest_vcn != 0 ever occur. */ -/* 24*/ VCN highest_vcn; /* Highest valid vcn of this extent of - the attribute value. - Usually there is only one - portion, so this usually equals the attribute - value size in clusters minus 1. Can be -1 for - zero length files. Can be 0 for "single extent" - attributes. */ -/* 32*/ u16 mapping_pairs_offset; /* Byte offset from the - beginning of the structure to the mapping pairs - array which contains the mappings between the - vcns and the logical cluster numbers (lcns). - When creating, place this at the end of this - record header aligned to 8-byte boundary. */ -/* 34*/ u8 compression_unit; /* The compression unit expressed - as the log to the base 2 of the number of - clusters in a compression unit. 0 means not - compressed. (This effectively limits the - compression unit size to be a power of two - clusters.) WinNT4 only uses a value of 4. */ -/* 35*/ u8 reserved1[5]; /* Align to 8-byte boundary. */ -/* The sizes below are only used when lowest_vcn is zero, as otherwise it would - be difficult to keep them up-to-date.*/ -/* 40*/ s64 allocated_size; /* Byte size of disk space - allocated to hold the attribute value. Always - is a multiple of the cluster size. When a file - is compressed, this field is a multiple of the - compression block size (2^compression_unit) and - it represents the logically allocated space - rather than the actual on disk usage. For this - use the compressed_size (see below). */ -/* 48*/ s64 data_size; /* Byte size of the attribute - value. Can be larger than allocated_size if - attribute value is compressed or sparse. */ -/* 56*/ s64 initialized_size; /* Byte size of initialized - portion of the attribute value. Usually equals - data_size. */ -/* sizeof(uncompressed attr) = 64*/ -/* 64*/ s64 compressed_size; /* Byte size of the attribute - value after compression. Only present when - compressed. Always is a multiple of the - cluster size. Represents the actual amount of - disk space being used on the disk. */ -/* sizeof(compressed attr) = 72*/ - } __attribute__ ((__packed__)); - } __attribute__ ((__packed__)); -} __attribute__ ((__packed__)) ATTR_RECORD; - -typedef ATTR_RECORD ATTR_REC; - -/* - * File attribute flags (32-bit). - */ -typedef enum { - /* - * These flags are only present in the STANDARD_INFORMATION attribute - * (in the field file_attributes). - */ - FILE_ATTR_READONLY = const_cpu_to_le32(0x00000001), - FILE_ATTR_HIDDEN = const_cpu_to_le32(0x00000002), - FILE_ATTR_SYSTEM = const_cpu_to_le32(0x00000004), - /* Old DOS volid. Unused in NT. = cpu_to_le32(0x00000008), */ - - FILE_ATTR_DIRECTORY = const_cpu_to_le32(0x00000010), - /* FILE_ATTR_DIRECTORY is not considered valid in NT. It is reserved - for the DOS SUBDIRECTORY flag. */ - FILE_ATTR_ARCHIVE = const_cpu_to_le32(0x00000020), - FILE_ATTR_DEVICE = const_cpu_to_le32(0x00000040), - FILE_ATTR_NORMAL = const_cpu_to_le32(0x00000080), - - FILE_ATTR_TEMPORARY = const_cpu_to_le32(0x00000100), - FILE_ATTR_SPARSE_FILE = const_cpu_to_le32(0x00000200), - FILE_ATTR_REPARSE_POINT = const_cpu_to_le32(0x00000400), - FILE_ATTR_COMPRESSED = const_cpu_to_le32(0x00000800), - - FILE_ATTR_OFFLINE = const_cpu_to_le32(0x00001000), - FILE_ATTR_NOT_CONTENT_INDEXED = const_cpu_to_le32(0x00002000), - FILE_ATTR_ENCRYPTED = const_cpu_to_le32(0x00004000), - - FILE_ATTR_VALID_FLAGS = const_cpu_to_le32(0x00007fb7), - /* FILE_ATTR_VALID_FLAGS masks out the old DOS VolId and the - FILE_ATTR_DEVICE and preserves everything else. This mask - is used to obtain all flags that are valid for reading. */ - FILE_ATTR_VALID_SET_FLAGS = const_cpu_to_le32(0x000031a7), - /* FILE_ATTR_VALID_SET_FLAGS masks out the old DOS VolId, the - F_A_DEVICE, F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT, - F_A_COMPRESSED and F_A_ENCRYPTED and preserves the rest. This mask - is used to to obtain all flags that are valid for setting. */ - - /* - * These flags are only present in the FILE_NAME attribute (in the - * field file_attributes). - */ - FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT = const_cpu_to_le32(0x10000000), - /* This is a copy of the corresponding bit from the mft record, telling - us whether this is a directory or not, i.e. whether it has an - index root attribute or not. */ - FILE_ATTR_DUP_VIEW_INDEX_PRESENT = const_cpu_to_le32(0x20000000), - /* This is a copy of the corresponding bit from the mft record, telling - us whether this file has a view index present (eg. object id index, - quota index, one of the security indexes or the encrypting file - system related indexes). */ -} FILE_ATTR_FLAGS; - -/* - * NOTE on times in NTFS: All times are in MS standard time format, i.e. they - * are the number of 100-nanosecond intervals since 1st January 1601, 00:00:00 - * universal coordinated time (UTC). (In Linux time starts 1st January 1970, - * 00:00:00 UTC and is stored as the number of 1-second intervals since then.) - */ - -/* - * Attribute: Standard information (0x10). - * - * NOTE: Always resident. - * NOTE: Present in all base file records on a volume. - * NOTE: There is conflicting information about the meaning of each of the time - * fields but the meaning as defined below has been verified to be - * correct by practical experimentation on Windows NT4 SP6a and is hence - * assumed to be the one and only correct interpretation. - */ -typedef struct { -/*Ofs*/ -/* 0*/ s64 creation_time; /* Time file was created. Updated when - a filename is changed(?). */ -/* 8*/ s64 last_data_change_time; /* Time the data attribute was last - modified. */ -/* 16*/ s64 last_mft_change_time; /* Time this mft record was last - modified. */ -/* 24*/ s64 last_access_time; /* Approximate time when the file was - last accessed (obviously this is not - updated on read-only volumes). In - Windows this is only updated when - accessed if some time delta has - passed since the last update. Also, - last access times updates can be - disabled altogether for speed. */ -/* 32*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */ -/* 36*/ union { - /* NTFS 1.2 (and previous, presumably) */ -/* 36 */ u8 reserved12[12]; /* Reserved/alignment to 8-byte - boundary. */ -/* sizeof() = 48 bytes */ - /* NTFS 3.0 */ - struct { -/* - * If a volume has been upgraded from a previous NTFS version, then these - * fields are present only if the file has been accessed since the upgrade. - * Recognize the difference by comparing the length of the resident attribute - * value. If it is 48, then the following fields are missing. If it is 72 then - * the fields are present. Maybe just check like this: - * if (resident.ValueLength < sizeof(STANDARD_INFORMATION)) { - * Assume NTFS 1.2- format. - * If (volume version is 3.0+) - * Upgrade attribute to NTFS 3.0 format. - * else - * Use NTFS 1.2- format for access. - * } else - * Use NTFS 3.0 format for access. - * Only problem is that it might be legal to set the length of the value to - * arbitrarily large values thus spoiling this check. - But chkdsk probably - * views that as a corruption, assuming that it behaves like this for all - * attributes. - */ - /* 36*/ u32 maximum_versions; /* Maximum allowed versions for - file. Zero if version numbering is disabled. */ - /* 40*/ u32 version_number; /* This file's version (if any). - Set to zero if maximum_versions is zero. */ - /* 44*/ u32 class_id; /* Class id from bidirectional - class id index (?). */ - /* 48*/ u32 owner_id; /* Owner_id of the user owning - the file. Translate via $Q index in FILE_Extend - /$Quota to the quota control entry for the user - owning the file. Zero if quotas are disabled. */ - /* 52*/ u32 security_id; /* Security_id for the file. - Translate via $SII index and $SDS data stream - in FILE_Secure to the security descriptor. */ - /* 56*/ u64 quota_charged; /* Byte size of the charge to - the quota for all streams of the file. Note: Is - zero if quotas are disabled. */ - /* 64*/ u64 usn; /* Last update sequence number - of the file. This is a direct index into the - change (aka usn) journal file. It is zero if - the usn journal is disabled. - NOTE: To disable the journal need to delete - the journal file itself and to then walk the - whole mft and set all Usn entries in all mft - records to zero! (This can take a while!) - The journal is FILE_Extend/$UsnJrnl. Win2k - will recreate the journal and initiate - logging if necessary when mounting the - partition. This, in contrast to disabling the - journal is a very fast process, so the user - won't even notice it. */ - }; - }; -/* sizeof() = 72 bytes (NTFS 3.0) */ -} __attribute__ ((__packed__)) STANDARD_INFORMATION; - -/* - * Attribute: Attribute list (0x20). - * - * - Can be either resident or non-resident. - * - Value consists of a sequence of variable length, 8-byte aligned, - * ATTR_LIST_ENTRY records. - * - The attribute list attribute contains one entry for each attribute of - * the file in which the list is located, except for the list attribute - * itself. The list is sorted: first by attribute type, second by attribute - * name (if present), third by instance number. The extents of one - * non-resident attribute (if present) immediately follow after the initial - * extent. They are ordered by lowest_vcn and have their instace set to zero. - * It is not allowed to have two attributes with all sorting keys equal. - * - Further restrictions: - * - If not resident, the vcn to lcn mapping array has to fit inside the - * base mft record. - * - The attribute list attribute value has a maximum size of 256kb. This - * is imposed by the Windows cache manager. - * - Attribute lists are only used when the attributes of mft record do not - * fit inside the mft record despite all attributes (that can be made - * non-resident) having been made non-resident. This can happen e.g. when: - * - File has a large number of hard links (lots of file name - * attributes present). - * - The mapping pairs array of some non-resident attribute becomes so - * large due to fragmentation that it overflows the mft record. - * - The security descriptor is very complex (not applicable to - * NTFS 3.0 volumes). - * - There are many named streams. - */ -typedef struct { -/*Ofs*/ -/* 0*/ ATTR_TYPES type; /* Type of referenced attribute. */ -/* 4*/ u16 length; /* Byte size of this entry. */ -/* 6*/ u8 name_length; /* Size in Unicode chars of the name of the - attribute or 0 if unnamed. */ -/* 7*/ u8 name_offset; /* Byte offset to beginning of attribute name - (always set this to where the name would - start even if unnamed). */ -/* 8*/ VCN lowest_vcn; /* Lowest virtual cluster number of this portion - of the attribute value. This is usually 0. It - is non-zero for the case where one attribute - does not fit into one mft record and thus - several mft records are allocated to hold - this attribute. In the latter case, each mft - record holds one extent of the attribute and - there is one attribute list entry for each - extent. NOTE: This is DEFINITELY a signed - value! The windows driver uses cmp, followed - by jg when comparing this, thus it treats it - as signed. */ -/* 16*/ MFT_REF mft_reference; /* The reference of the mft record holding - the ATTR_RECORD for this portion of the - attribute value. */ -/* 24*/ u16 instance; /* If lowest_vcn = 0, the instance of the - attribute being referenced; otherwise 0. */ -/* 26*/ uchar_t name[0]; /* Use when creating only. When reading use - name_offset to determine the location of the - name. */ -/* sizeof() = 26 + (attribute_name_length * 2) bytes */ -} __attribute__ ((__packed__)) ATTR_LIST_ENTRY; - -/* - * The maximum allowed length for a file name. - */ -#define MAXIMUM_FILE_NAME_LENGTH 255 - -/* - * Possible namespaces for filenames in ntfs (8-bit). - */ -typedef enum { - FILE_NAME_POSIX = 0x00, - /* This is the largest namespace. It is case sensitive and - allows all Unicode characters except for: '\0' and '/'. - Beware that in WinNT/2k files which eg have the same name - except for their case will not be distinguished by the - standard utilities and thus a "del filename" will delete - both "filename" and "fileName" without warning. */ - FILE_NAME_WIN32 = 0x01, - /* The standard WinNT/2k NTFS long filenames. Case insensitive. - All Unicode chars except: '\0', '"', '*', '/', ':', '<', - '>', '?', '\' and '|'. Further, names cannot end with a '.' - or a space. */ - FILE_NAME_DOS = 0x02, - /* The standard DOS filenames (8.3 format). Uppercase only. - All 8-bit characters greater space, except: '"', '*', '+', - ',', '/', ':', ';', '<', '=', '>', '?' and '\'. */ - FILE_NAME_WIN32_AND_DOS = 0x03, - /* 3 means that both the Win32 and the DOS filenames are - identical and hence have been saved in this single filename - record. */ -} __attribute__ ((__packed__)) FILE_NAME_TYPE_FLAGS; - -/* - * Attribute: Filename (0x30). - * - * NOTE: Always resident. - * NOTE: All fields, except the parent_directory, are only updated when the - * filename is changed. Until then, they just become out of sync with - * reality and the more up to date values are present in the standard - * information attribute. - * NOTE: There is conflicting information about the meaning of each of the time - * fields but the meaning as defined below has been verified to be - * correct by practical experimentation on Windows NT4 SP6a and is hence - * assumed to be the one and only correct interpretation. - */ -typedef struct { -/*hex ofs*/ -/* 0*/ MFT_REF parent_directory; /* Directory this filename is - referenced from. */ -/* 8*/ s64 creation_time; /* Time file was created. */ -/* 10*/ s64 last_data_change_time; /* Time the data attribute was last - modified. */ -/* 18*/ s64 last_mft_change_time; /* Time this mft record was last - modified. */ -/* 20*/ s64 last_access_time; /* Last time this mft record was - accessed. */ -/* 28*/ s64 allocated_size; /* Byte size of allocated space for the - data attribute. NOTE: Is a multiple - of the cluster size. */ -/* 30*/ s64 data_size; /* Byte size of actual data in data - attribute. */ -/* 38*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */ -/* 3c*/ union { - /* 3c*/ struct { - /* 3c*/ u16 packed_ea_size; /* Size of the buffer needed to - pack the extended attributes - (EAs), if such are present.*/ - /* 3e*/ u16 reserved; /* Reserved for alignment. */ - } __attribute__ ((__packed__)); - /* 3c*/ u32 reparse_point_tag; /* Type of reparse point, - present only in reparse - points and only if there are - no EAs. */ - } __attribute__ ((__packed__)); -/* 40*/ u8 file_name_length; /* Length of file name in - (Unicode) characters. */ -/* 41*/ FILE_NAME_TYPE_FLAGS file_name_type; /* Namespace of the file name.*/ -/* 42*/ uchar_t file_name[0]; /* File name in Unicode. */ -} __attribute__ ((__packed__)) FILE_NAME_ATTR; - -/* - * GUID structures store globally unique identifiers (GUID). A GUID is a - * 128-bit value consisting of one group of eight hexadecimal digits, followed - * by three groups of four hexadecimal digits each, followed by one group of - * twelve hexadecimal digits. GUIDs are Microsoft's implementation of the - * distributed computing environment (DCE) universally unique identifier (UUID). - * Example of a GUID: - * 1F010768-5A73-BC91-0010A52216A7 - */ -typedef struct { - u32 data1; /* The first eight hexadecimal digits of the GUID. */ - u16 data2; /* The first group of four hexadecimal digits. */ - u16 data3; /* The second group of four hexadecimal digits. */ - u8 data4[8]; /* The first two bytes are the third group of four - hexadecimal digits. The remaining six bytes are the - final 12 hexadecimal digits. */ -} __attribute__ ((__packed__)) GUID; - -/* - * FILE_Extend/$ObjId contains an index named $O. This index contains all - * object_ids present on the volume as the index keys and the corresponding - * mft_record numbers as the index entry data parts. The data part (defined - * below) also contains three other object_ids: - * birth_volume_id - object_id of FILE_Volume on which the file was first - * created. Optional (i.e. can be zero). - * birth_object_id - object_id of file when it was first created. Usually - * equals the object_id. Optional (i.e. can be zero). - * domain_id - Reserved (always zero). - */ -typedef struct { - MFT_REF mft_reference; /* Mft record containing the object_id in - the index entry key. */ - union { - struct { - GUID birth_volume_id; - GUID birth_object_id; - GUID domain_id; - } __attribute__ ((__packed__)); - u8 extended_info[48]; - } __attribute__ ((__packed__)); -} __attribute__ ((__packed__)) OBJ_ID_INDEX_DATA; - -/* - * Attribute: Object id (NTFS 3.0+) (0x40). - * - * NOTE: Always resident. - */ -typedef struct { - GUID object_id; /* Unique id assigned to the - file.*/ - /* The following fields are optional. The attribute value size is 16 - bytes, i.e. sizeof(GUID), if these are not present at all. Note, - the entries can be present but one or more (or all) can be zero - meaning that that particular value(s) is(are) not defined. Note, - when the fields are missing here, it is well possible that they are - to be found within the $Extend/$ObjId system file indexed under the - above object_id. */ - union { - struct { - GUID birth_volume_id; /* Unique id of volume on which - the file was first created.*/ - GUID birth_object_id; /* Unique id of file when it was - first created. */ - GUID domain_id; /* Reserved, zero. */ - } __attribute__ ((__packed__)); - u8 extended_info[48]; - } __attribute__ ((__packed__)); -} __attribute__ ((__packed__)) OBJECT_ID_ATTR; - -/* - * The pre-defined IDENTIFIER_AUTHORITIES used as SID_IDENTIFIER_AUTHORITY in - * the SID structure (see below). - */ -//typedef enum { /* SID string prefix. */ -// SECURITY_NULL_SID_AUTHORITY = {0, 0, 0, 0, 0, 0}, /* S-1-0 */ -// SECURITY_WORLD_SID_AUTHORITY = {0, 0, 0, 0, 0, 1}, /* S-1-1 */ -// SECURITY_LOCAL_SID_AUTHORITY = {0, 0, 0, 0, 0, 2}, /* S-1-2 */ -// SECURITY_CREATOR_SID_AUTHORITY = {0, 0, 0, 0, 0, 3}, /* S-1-3 */ -// SECURITY_NON_UNIQUE_AUTHORITY = {0, 0, 0, 0, 0, 4}, /* S-1-4 */ -// SECURITY_NT_SID_AUTHORITY = {0, 0, 0, 0, 0, 5}, /* S-1-5 */ -//} IDENTIFIER_AUTHORITIES; - -/* - * These relative identifiers (RIDs) are used with the above identifier - * authorities to make up universal well-known SIDs. - * - * Note: The relative identifier (RID) refers to the portion of a SID, which - * identifies a user or group in relation to the authority that issued the SID. - * For example, the universal well-known SID Creator Owner ID (S-1-3-0) is - * made up of the identifier authority SECURITY_CREATOR_SID_AUTHORITY (3) and - * the relative identifier SECURITY_CREATOR_OWNER_RID (0). - */ -typedef enum { /* Identifier authority. */ - SECURITY_NULL_RID = 0, /* S-1-0 */ - SECURITY_WORLD_RID = 0, /* S-1-1 */ - SECURITY_LOCAL_RID = 0, /* S-1-2 */ - - SECURITY_CREATOR_OWNER_RID = 0, /* S-1-3 */ - SECURITY_CREATOR_GROUP_RID = 1, /* S-1-3 */ - - SECURITY_CREATOR_OWNER_SERVER_RID = 2, /* S-1-3 */ - SECURITY_CREATOR_GROUP_SERVER_RID = 3, /* S-1-3 */ - - SECURITY_DIALUP_RID = 1, - SECURITY_NETWORK_RID = 2, - SECURITY_BATCH_RID = 3, - SECURITY_INTERACTIVE_RID = 4, - SECURITY_SERVICE_RID = 6, - SECURITY_ANONYMOUS_LOGON_RID = 7, - SECURITY_PROXY_RID = 8, - SECURITY_ENTERPRISE_CONTROLLERS_RID=9, - SECURITY_SERVER_LOGON_RID = 9, - SECURITY_PRINCIPAL_SELF_RID = 0xa, - SECURITY_AUTHENTICATED_USER_RID = 0xb, - SECURITY_RESTRICTED_CODE_RID = 0xc, - SECURITY_TERMINAL_SERVER_RID = 0xd, - - SECURITY_LOGON_IDS_RID = 5, - SECURITY_LOGON_IDS_RID_COUNT = 3, - - SECURITY_LOCAL_SYSTEM_RID = 0x12, - - SECURITY_NT_NON_UNIQUE = 0x15, - - SECURITY_BUILTIN_DOMAIN_RID = 0x20, - - /* - * Well-known domain relative sub-authority values (RIDs). - */ - - /* Users. */ - DOMAIN_USER_RID_ADMIN = 0x1f4, - DOMAIN_USER_RID_GUEST = 0x1f5, - DOMAIN_USER_RID_KRBTGT = 0x1f6, - - /* Groups. */ - DOMAIN_GROUP_RID_ADMINS = 0x200, - DOMAIN_GROUP_RID_USERS = 0x201, - DOMAIN_GROUP_RID_GUESTS = 0x202, - DOMAIN_GROUP_RID_COMPUTERS = 0x203, - DOMAIN_GROUP_RID_CONTROLLERS = 0x204, - DOMAIN_GROUP_RID_CERT_ADMINS = 0x205, - DOMAIN_GROUP_RID_SCHEMA_ADMINS = 0x206, - DOMAIN_GROUP_RID_ENTERPRISE_ADMINS= 0x207, - DOMAIN_GROUP_RID_POLICY_ADMINS = 0x208, - - /* Aliases. */ - DOMAIN_ALIAS_RID_ADMINS = 0x220, - DOMAIN_ALIAS_RID_USERS = 0x221, - DOMAIN_ALIAS_RID_GUESTS = 0x222, - DOMAIN_ALIAS_RID_POWER_USERS = 0x223, - - DOMAIN_ALIAS_RID_ACCOUNT_OPS = 0x224, - DOMAIN_ALIAS_RID_SYSTEM_OPS = 0x225, - DOMAIN_ALIAS_RID_PRINT_OPS = 0x226, - DOMAIN_ALIAS_RID_BACKUP_OPS = 0x227, - - DOMAIN_ALIAS_RID_REPLICATOR = 0x228, - DOMAIN_ALIAS_RID_RAS_SERVERS = 0x229, - DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = 0x22a, -} RELATIVE_IDENTIFIERS; - -/* - * The universal well-known SIDs: - * - * NULL_SID S-1-0-0 - * WORLD_SID S-1-1-0 - * LOCAL_SID S-1-2-0 - * CREATOR_OWNER_SID S-1-3-0 - * CREATOR_GROUP_SID S-1-3-1 - * CREATOR_OWNER_SERVER_SID S-1-3-2 - * CREATOR_GROUP_SERVER_SID S-1-3-3 - * - * (Non-unique IDs) S-1-4 - * - * NT well-known SIDs: - * - * NT_AUTHORITY_SID S-1-5 - * DIALUP_SID S-1-5-1 - * - * NETWORD_SID S-1-5-2 - * BATCH_SID S-1-5-3 - * INTERACTIVE_SID S-1-5-4 - * SERVICE_SID S-1-5-6 - * ANONYMOUS_LOGON_SID S-1-5-7 (aka null logon session) - * PROXY_SID S-1-5-8 - * SERVER_LOGON_SID S-1-5-9 (aka domain controller account) - * SELF_SID S-1-5-10 (self RID) - * AUTHENTICATED_USER_SID S-1-5-11 - * RESTRICTED_CODE_SID S-1-5-12 (running restricted code) - * TERMINAL_SERVER_SID S-1-5-13 (running on terminal server) - * - * (Logon IDs) S-1-5-5-X-Y - * - * (NT non-unique IDs) S-1-5-0x15-... - * - * (Built-in domain) S-1-5-0x20 - */ - -/* - * The SID_IDENTIFIER_AUTHORITY is a 48-bit value used in the SID structure. - */ -typedef union { - struct { - u32 low_part; /* Low 32-bits. */ - u16 high_part; /* High 16-bits. */ - } __attribute__ ((__packed__)); - u8 value[6]; /* Value as individual bytes. */ -} __attribute__ ((__packed__)) SID_IDENTIFIER_AUTHORITY; - -/* - * The SID structure is a variable-length structure used to uniquely identify - * users or groups. SID stands for security identifier. - * - * The standard textual representation of the SID is of the form: - * S-R-I-S-S... - * Where: - * - The first "S" is the literal character 'S' identifying the following - * digits as a SID. - * - R is the revision level of the SID expressed as a sequence of digits - * either in decimal or hexadecimal (if the later, prefixed by "0x"). - * - I is the 48-bit identifier_authority, expressed as digits as R above. - * - S... is one or more sub_authority values, expressed as digits as above. - * - * Example SID; the domain-relative SID of the local Administrators group on - * Windows NT/2k: - * S-1-5-32-544 - * This translates to a SID with: - * revision = 1, - * sub_authority_count = 2, - * identifier_authority = {0,0,0,0,0,5}, // SECURITY_NT_AUTHORITY - * sub_authority[0] = 32, // SECURITY_BUILTIN_DOMAIN_RID - * sub_authority[1] = 544 // DOMAIN_ALIAS_RID_ADMINS - */ -typedef struct { - u8 revision; - u8 sub_authority_count; - SID_IDENTIFIER_AUTHORITY identifier_authority; - u32 sub_authority[1]; /* At least one sub_authority. */ -} __attribute__ ((__packed__)) SID; - -/* - * Current constants for SIDs. - */ -typedef enum { - SID_REVISION = 1, /* Current revision level. */ - SID_MAX_SUB_AUTHORITIES = 15, /* Maximum number of those. */ - SID_RECOMMENDED_SUB_AUTHORITIES = 1, /* Will change to around 6 in - a future revision. */ -} SID_CONSTANTS; - -/* - * The predefined ACE types (8-bit, see below). - */ -typedef enum { - ACCESS_MIN_MS_ACE_TYPE = 0, - ACCESS_ALLOWED_ACE_TYPE = 0, - ACCESS_DENIED_ACE_TYPE = 1, - SYSTEM_AUDIT_ACE_TYPE = 2, - SYSTEM_ALARM_ACE_TYPE = 3, /* Not implemented as of Win2k. */ - ACCESS_MAX_MS_V2_ACE_TYPE = 3, - - ACCESS_ALLOWED_COMPOUND_ACE_TYPE= 4, - ACCESS_MAX_MS_V3_ACE_TYPE = 4, - - /* The following are Win2k only. */ - ACCESS_MIN_MS_OBJECT_ACE_TYPE = 5, - ACCESS_ALLOWED_OBJECT_ACE_TYPE = 5, - ACCESS_DENIED_OBJECT_ACE_TYPE = 6, - SYSTEM_AUDIT_OBJECT_ACE_TYPE = 7, - SYSTEM_ALARM_OBJECT_ACE_TYPE = 8, - ACCESS_MAX_MS_OBJECT_ACE_TYPE = 8, - - ACCESS_MAX_MS_V4_ACE_TYPE = 8, - - /* This one is for WinNT&2k. */ - ACCESS_MAX_MS_ACE_TYPE = 8, -} __attribute__ ((__packed__)) ACE_TYPES; - -/* - * The ACE flags (8-bit) for audit and inheritance (see below). - * - * SUCCESSFUL_ACCESS_ACE_FLAG is only used with system audit and alarm ACE - * types to indicate that a message is generated (in Windows!) for successful - * accesses. - * - * FAILED_ACCESS_ACE_FLAG is only used with system audit and alarm ACE types - * to indicate that a message is generated (in Windows!) for failed accesses. - */ -typedef enum { - /* The inheritance flags. */ - OBJECT_INHERIT_ACE = 0x01, - CONTAINER_INHERIT_ACE = 0x02, - NO_PROPAGATE_INHERIT_ACE = 0x04, - INHERIT_ONLY_ACE = 0x08, - INHERITED_ACE = 0x10, /* Win2k only. */ - VALID_INHERIT_FLAGS = 0x1f, - - /* The audit flags. */ - SUCCESSFUL_ACCESS_ACE_FLAG = 0x40, - FAILED_ACCESS_ACE_FLAG = 0x80, -} __attribute__ ((__packed__)) ACE_FLAGS; - -/* - * An ACE is an access-control entry in an access-control list (ACL). - * An ACE defines access to an object for a specific user or group or defines - * the types of access that generate system-administration messages or alarms - * for a specific user or group. The user or group is identified by a security - * identifier (SID). - * - * Each ACE starts with an ACE_HEADER structure (aligned on 4-byte boundary), - * which specifies the type and size of the ACE. The format of the subsequent - * data depends on the ACE type. - */ -typedef struct { - ACE_TYPES type; /* Type of the ACE. */ - ACE_FLAGS flags; /* Flags describing the ACE. */ - u16 size; /* Size in bytes of the ACE. */ -} __attribute__ ((__packed__)) ACE_HEADER; - -/* - * The access mask (32-bit). Defines the access rights. - */ -typedef enum { - /* - * The specific rights (bits 0 to 15). Depend on the type of the - * object being secured by the ACE. - */ - - /* Specific rights for files and directories are as follows: */ - - /* Right to read data from the file. (FILE) */ - FILE_READ_DATA = const_cpu_to_le32(0x00000001), - /* Right to list contents of a directory. (DIRECTORY) */ - FILE_LIST_DIRECTORY = const_cpu_to_le32(0x00000001), - - /* Right to write data to the file. (FILE) */ - FILE_WRITE_DATA = const_cpu_to_le32(0x00000002), - /* Right to create a file in the directory. (DIRECTORY) */ - FILE_ADD_FILE = const_cpu_to_le32(0x00000002), - - /* Right to append data to the file. (FILE) */ - FILE_APPEND_DATA = const_cpu_to_le32(0x00000004), - /* Right to create a subdirectory. (DIRECTORY) */ - FILE_ADD_SUBDIRECTORY = const_cpu_to_le32(0x00000004), - - /* Right to read extended attributes. (FILE/DIRECTORY) */ - FILE_READ_EA = const_cpu_to_le32(0x00000008), - - /* Right to write extended attributes. (FILE/DIRECTORY) */ - FILE_WRITE_EA = const_cpu_to_le32(0x00000010), - - /* Right to execute a file. (FILE) */ - FILE_EXECUTE = const_cpu_to_le32(0x00000020), - /* Right to traverse the directory. (DIRECTORY) */ - FILE_TRAVERSE = const_cpu_to_le32(0x00000020), - - /* - * Right to delete a directory and all the files it contains (its - * children), even if the files are read-only. (DIRECTORY) - */ - FILE_DELETE_CHILD = const_cpu_to_le32(0x00000040), - - /* Right to read file attributes. (FILE/DIRECTORY) */ - FILE_READ_ATTRIBUTES = const_cpu_to_le32(0x00000080), - - /* Right to change file attributes. (FILE/DIRECTORY) */ - FILE_WRITE_ATTRIBUTES = const_cpu_to_le32(0x00000100), - - /* - * The standard rights (bits 16 to 23). Are independent of the type of - * object being secured. - */ - - /* Right to delete the object. */ - DELETE = const_cpu_to_le32(0x00010000), - - /* - * Right to read the information in the object's security descriptor, - * not including the information in the SACL. I.e. right to read the - * security descriptor and owner. - */ - READ_CONTROL = const_cpu_to_le32(0x00020000), - - /* Right to modify the DACL in the object's security descriptor. */ - WRITE_DAC = const_cpu_to_le32(0x00040000), - - /* Right to change the owner in the object's security descriptor. */ - WRITE_OWNER = const_cpu_to_le32(0x00080000), - - /* - * Right to use the object for synchronization. Enables a process to - * wait until the object is in the signalled state. Some object types - * do not support this access right. - */ - SYNCHRONIZE = const_cpu_to_le32(0x00100000), - - /* - * The following STANDARD_RIGHTS_* are combinations of the above for - * convenience and are defined by the Win32 API. - */ - - /* These are currently defined to READ_CONTROL. */ - STANDARD_RIGHTS_READ = const_cpu_to_le32(0x00020000), - STANDARD_RIGHTS_WRITE = const_cpu_to_le32(0x00020000), - STANDARD_RIGHTS_EXECUTE = const_cpu_to_le32(0x00020000), - - /* Combines DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER access. */ - STANDARD_RIGHTS_REQUIRED = const_cpu_to_le32(0x000f0000), - - /* - * Combines DELETE, READ_CONTROL, WRITE_DAC, WRITE_OWNER, and - * SYNCHRONIZE access. - */ - STANDARD_RIGHTS_ALL = const_cpu_to_le32(0x001f0000), - - /* - * The access system ACL and maximum allowed access types (bits 24 to - * 25, bits 26 to 27 are reserved). - */ - ACCESS_SYSTEM_SECURITY = const_cpu_to_le32(0x01000000), - MAXIMUM_ALLOWED = const_cpu_to_le32(0x02000000), - - /* - * The generic rights (bits 28 to 31). These map onto the standard and - * specific rights. - */ - - /* Read, write, and execute access. */ - GENERIC_ALL = const_cpu_to_le32(0x10000000), - - /* Execute access. */ - GENERIC_EXECUTE = const_cpu_to_le32(0x20000000), - - /* - * Write access. For files, this maps onto: - * FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_DATA | - * FILE_WRITE_EA | STANDARD_RIGHTS_WRITE | SYNCHRONIZE - * For directories, the mapping has the same numberical value. See - * above for the descriptions of the rights granted. - */ - GENERIC_WRITE = const_cpu_to_le32(0x40000000), - - /* - * Read access. For files, this maps onto: - * FILE_READ_ATTRIBUTES | FILE_READ_DATA | FILE_READ_EA | - * STANDARD_RIGHTS_READ | SYNCHRONIZE - * For directories, the mapping has the same numberical value. See - * above for the descriptions of the rights granted. - */ - GENERIC_READ = const_cpu_to_le32(0x80000000), -} ACCESS_MASK; - -/* - * The generic mapping array. Used to denote the mapping of each generic - * access right to a specific access mask. - * - * FIXME: What exactly is this and what is it for? (AIA) - */ -typedef struct { - ACCESS_MASK generic_read; - ACCESS_MASK generic_write; - ACCESS_MASK generic_execute; - ACCESS_MASK generic_all; -} __attribute__ ((__packed__)) GENERIC_MAPPING; - -/* - * The predefined ACE type structures are as defined below. - */ - -/* - * ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE - */ -typedef struct { - ACE_HEADER; /* The ACE header. */ - ACCESS_MASK mask; /* Access mask associated with the ACE. */ - SID sid; /* The SID associated with the ACE. */ -} __attribute__ ((__packed__)) ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, - SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE; - -/* - * The object ACE flags (32-bit). - */ -typedef enum { - ACE_OBJECT_TYPE_PRESENT = const_cpu_to_le32(1), - ACE_INHERITED_OBJECT_TYPE_PRESENT = const_cpu_to_le32(2), -} OBJECT_ACE_FLAGS; - -typedef struct { - ACE_HEADER; /* The ACE_HEADER. */ - ACCESS_MASK mask; /* Access mask associated with the ACE. */ - OBJECT_ACE_FLAGS flags; /* Flags describing the object ACE. */ - GUID object_type; - GUID inherited_object_type; - SID sid; /* The SID associated with the ACE. */ -} __attribute__ ((__packed__)) ACCESS_ALLOWED_OBJECT_ACE, - ACCESS_DENIED_OBJECT_ACE, - SYSTEM_AUDIT_OBJECT_ACE, - SYSTEM_ALARM_OBJECT_ACE; - -/* - * An ACL is an access-control list (ACL). - * An ACL starts with an ACL header structure, which specifies the size of - * the ACL and the number of ACEs it contains. The ACL header is followed by - * zero or more access control entries (ACEs). The ACL as well as each ACE - * are aligned on 4-byte boundaries. - */ -typedef struct { - u8 revision; /* Revision of this ACL. */ - u8 alignment1; - u16 size; /* Allocated space in bytes for ACL. Includes this - header, the ACEs and the remaining free space. */ - u16 ace_count;/* Number of ACEs in the ACL. */ - u16 alignment2; -/* sizeof() = 8 bytes */ -} __attribute__ ((__packed__)) ACL; - -/* - * Current constants for ACLs. - */ -typedef enum { - /* Current revision. */ - ACL_REVISION = 2, - ACL_REVISION_DS = 4, - - /* History of revisions. */ - ACL_REVISION1 = 1, - MIN_ACL_REVISION = 2, - ACL_REVISION2 = 2, - ACL_REVISION3 = 3, - ACL_REVISION4 = 4, - MAX_ACL_REVISION = 4, -} ACL_CONSTANTS; - -/* - * The security descriptor control flags (16-bit). - * - * SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the - * SID pointed to by the Owner field was provided by a - * defaulting mechanism rather than explicitly provided by the - * original provider of the security descriptor. This may - * affect the treatment of the SID with respect to inheritence - * of an owner. - * - * SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the - * SID in the Group field was provided by a defaulting mechanism - * rather than explicitly provided by the original provider of - * the security descriptor. This may affect the treatment of - * the SID with respect to inheritence of a primary group. - * - * SE_DACL_PRESENT - This boolean flag, when set, indicates that the - * security descriptor contains a discretionary ACL. If this - * flag is set and the Dacl field of the SECURITY_DESCRIPTOR is - * null, then a null ACL is explicitly being specified. - * - * SE_DACL_DEFAULTED - This boolean flag, when set, indicates that the - * ACL pointed to by the Dacl field was provided by a defaulting - * mechanism rather than explicitly provided by the original - * provider of the security descriptor. This may affect the - * treatment of the ACL with respect to inheritence of an ACL. - * This flag is ignored if the DaclPresent flag is not set. - * - * SE_SACL_PRESENT - This boolean flag, when set, indicates that the - * security descriptor contains a system ACL pointed to by the - * Sacl field. If this flag is set and the Sacl field of the - * SECURITY_DESCRIPTOR is null, then an empty (but present) - * ACL is being specified. - * - * SE_SACL_DEFAULTED - This boolean flag, when set, indicates that the - * ACL pointed to by the Sacl field was provided by a defaulting - * mechanism rather than explicitly provided by the original - * provider of the security descriptor. This may affect the - * treatment of the ACL with respect to inheritence of an ACL. - * This flag is ignored if the SaclPresent flag is not set. - * - * SE_SELF_RELATIVE - This boolean flag, when set, indicates that the - * security descriptor is in self-relative form. In this form, - * all fields of the security descriptor are contiguous in memory - * and all pointer fields are expressed as offsets from the - * beginning of the security descriptor. - */ -typedef enum { - SE_OWNER_DEFAULTED = const_cpu_to_le16(0x0001), - SE_GROUP_DEFAULTED = const_cpu_to_le16(0x0002), - SE_DACL_PRESENT = const_cpu_to_le16(0x0004), - SE_DACL_DEFAULTED = const_cpu_to_le16(0x0008), - SE_SACL_PRESENT = const_cpu_to_le16(0x0010), - SE_SACL_DEFAULTED = const_cpu_to_le16(0x0020), - SE_DACL_AUTO_INHERIT_REQ = const_cpu_to_le16(0x0100), - SE_SACL_AUTO_INHERIT_REQ = const_cpu_to_le16(0x0200), - SE_DACL_AUTO_INHERITED = const_cpu_to_le16(0x0400), - SE_SACL_AUTO_INHERITED = const_cpu_to_le16(0x0800), - SE_DACL_PROTECTED = const_cpu_to_le16(0x1000), - SE_SACL_PROTECTED = const_cpu_to_le16(0x2000), - SE_RM_CONTROL_VALID = const_cpu_to_le16(0x4000), - SE_SELF_RELATIVE = const_cpu_to_le16(0x8000), -} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_CONTROL; - -/* - * Self-relative security descriptor. Contains the owner and group SIDs as well - * as the sacl and dacl ACLs inside the security descriptor itself. - */ -typedef struct { - u8 revision; /* Revision level of the security descriptor. */ - u8 alignment; - SECURITY_DESCRIPTOR_CONTROL control; /* Flags qualifying the type of - the descriptor as well as the following fields. */ - u32 owner; /* Byte offset to a SID representing an object's - owner. If this is NULL, no owner SID is present in - the descriptor. */ - u32 group; /* Byte offset to a SID representing an object's - primary group. If this is NULL, no primary group - SID is present in the descriptor. */ - u32 sacl; /* Byte offset to a system ACL. Only valid, if - SE_SACL_PRESENT is set in the control field. If - SE_SACL_PRESENT is set but sacl is NULL, a NULL ACL - is specified. */ - u32 dacl; /* Byte offset to a discretionary ACL. Only valid, if - SE_DACL_PRESENT is set in the control field. If - SE_DACL_PRESENT is set but dacl is NULL, a NULL ACL - (unconditionally granting access) is specified. */ -/* sizeof() = 0x14 bytes */ -} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_RELATIVE; - -/* - * Absolute security descriptor. Does not contain the owner and group SIDs, nor - * the sacl and dacl ACLs inside the security descriptor. Instead, it contains - * pointers to these structures in memory. Obviously, absolute security - * descriptors are only useful for in memory representations of security - * descriptors. On disk, a self-relative security descriptor is used. - */ -typedef struct { - u8 revision; /* Revision level of the security descriptor. */ - u8 alignment; - SECURITY_DESCRIPTOR_CONTROL control; /* Flags qualifying the type of - the descriptor as well as the following fields. */ - SID *owner; /* Points to a SID representing an object's owner. If - this is NULL, no owner SID is present in the - descriptor. */ - SID *group; /* Points to a SID representing an object's primary - group. If this is NULL, no primary group SID is - present in the descriptor. */ - ACL *sacl; /* Points to a system ACL. Only valid, if - SE_SACL_PRESENT is set in the control field. If - SE_SACL_PRESENT is set but sacl is NULL, a NULL ACL - is specified. */ - ACL *dacl; /* Points to a discretionary ACL. Only valid, if - SE_DACL_PRESENT is set in the control field. If - SE_DACL_PRESENT is set but dacl is NULL, a NULL ACL - (unconditionally granting access) is specified. */ -} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR; - -/* - * Current constants for security descriptors. - */ -typedef enum { - /* Current revision. */ - SECURITY_DESCRIPTOR_REVISION = 1, - SECURITY_DESCRIPTOR_REVISION1 = 1, - - /* The sizes of both the absolute and relative security descriptors is - the same as pointers, at least on ia32 architecture are 32-bit. */ - SECURITY_DESCRIPTOR_MIN_LENGTH = sizeof(SECURITY_DESCRIPTOR), -} SECURITY_DESCRIPTOR_CONSTANTS; - -/* - * Attribute: Security descriptor (0x50). A standard self-relative security - * descriptor. - * - * NOTE: Can be resident or non-resident. - * NOTE: Not used in NTFS 3.0+, as security descriptors are stored centrally - * in FILE_Secure and the correct descriptor is found using the security_id - * from the standard information attribute. - */ -typedef SECURITY_DESCRIPTOR_RELATIVE SECURITY_DESCRIPTOR_ATTR; - -/* - * On NTFS 3.0+, all security descriptors are stored in FILE_Secure. Only one - * referenced instance of each unique security descriptor is stored. - * - * FILE_Secure contains no unnamed data attribute, i.e. it has zero length. It - * does, however, contain two indexes ($SDH and $SII) as well as a named data - * stream ($SDS). - * - * Every unique security descriptor is assigned a unique security identifier - * (security_id, not to be confused with a SID). The security_id is unique for - * the NTFS volume and is used as an index into the $SII index, which maps - * security_ids to the security descriptor's storage location within the $SDS - * data attribute. The $SII index is sorted by ascending security_id. - * - * A simple hash is computed from each security descriptor. This hash is used - * as an index into the $SDH index, which maps security descriptor hashes to - * the security descriptor's storage location within the $SDS data attribute. - * The $SDH index is sorted by security descriptor hash and is stored in a B+ - * tree. When searching $SDH (with the intent of determining whether or not a - * new security descriptor is already present in the $SDS data stream), if a - * matching hash is found, but the security descriptors do not match, the - * search in the $SDH index is continued, searching for a next matching hash. - * - * When a precise match is found, the security_id coresponding to the security - * descriptor in the $SDS attribute is read from the found $SDH index entry and - * is stored in the $STANDARD_INFORMATION attribute of the file/directory to - * which the security descriptor is being applied. The $STANDARD_INFORMATION - * attribute is present in all base mft records (i.e. in all files and - * directories). - * - * If a match is not found, the security descriptor is assigned a new unique - * security_id and is added to the $SDS data attribute. Then, entries - * referencing the this security descriptor in the $SDS data attribute are - * added to the $SDH and $SII indexes. - * - * Note: Entries are never deleted from FILE_Secure, even if nothing - * references an entry any more. - */ - -/* - * This header precedes each security descriptor in the $SDS data stream. - * This is also the index entry data part of both the $SII and $SDH indexes. - */ -typedef struct { - u32 hash; /* Hash of the security descriptor. */ - u32 security_id; /* The security_id assigned to the descriptor. */ - u64 offset; /* Byte offset of this entry in the $SDS stream. */ - u32 length; /* Size in bytes of this entry in $SDS stream. */ -} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_HEADER; - -/* - * The $SDS data stream contains the security descriptors, aligned on 16-byte - * boundaries, sorted by security_id in a B+ tree. Security descriptors cannot - * cross 256kib boundaries (this restriction is imposed by the Windows cache - * manager). Each security descriptor is contained in a SDS_ENTRY structure. - * Also, each security descriptor is stored twice in the $SDS stream with a - * fixed offset of 0x40000 bytes (256kib, the Windows cache manager's max size) - * between them; i.e. if a SDS_ENTRY specifies an offset of 0x51d0, then the - * the first copy of the security descriptor will be at offset 0x51d0 in the - * $SDS data stream and the second copy will be at offset 0x451d0. - */ -typedef struct { - SECURITY_DESCRIPTOR_HEADER; /* The security descriptor header. */ - SECURITY_DESCRIPTOR_RELATIVE sid; /* The self-relative security - descriptor. */ -} __attribute__ ((__packed__)) SDS_ENTRY; - -/* - * The index entry key used in the $SII index. The collation type is - * COLLATION_NTOFS_ULONG. - */ -typedef struct { - u32 security_id; /* The security_id assigned to the descriptor. */ -} __attribute__ ((__packed__)) SII_INDEX_KEY; - -/* - * The index entry key used in the $SDH index. The keys are sorted first by - * hash and then by security_id. The collation rule is - * COLLATION_NTOFS_SECURITY_HASH. - */ -typedef struct { - u32 hash; /* Hash of the security descriptor. */ - u32 security_id; /* The security_id assigned to the descriptor. */ -} __attribute__ ((__packed__)) SDH_INDEX_KEY; - -/* - * Attribute: Volume name (0x60). - * - * NOTE: Always resident. - * NOTE: Present only in FILE_Volume. - */ -typedef struct { - uchar_t name[0]; /* The name of the volume in Unicode. */ -} __attribute__ ((__packed__)) VOLUME_NAME; - -/* - * Possible flags for the volume (16-bit). - */ -typedef enum { - VOLUME_IS_DIRTY = const_cpu_to_le16(0x0001), - VOLUME_RESIZE_LOG_FILE = const_cpu_to_le16(0x0002), - VOLUME_UPGRADE_ON_MOUNT = const_cpu_to_le16(0x0004), - VOLUME_MOUNTED_ON_NT4 = const_cpu_to_le16(0x0008), - VOLUME_DELETE_USN_UNDERWAY = const_cpu_to_le16(0x0010), - VOLUME_REPAIR_OBJECT_ID = const_cpu_to_le16(0x0020), - VOLUME_MODIFIED_BY_CHKDSK = const_cpu_to_le16(0x8000), - VOLUME_FLAGS_MASK = const_cpu_to_le16(0x803f), -} __attribute__ ((__packed__)) VOLUME_FLAGS; - -/* - * Attribute: Volume information (0x70). - * - * NOTE: Always resident. - * NOTE: Present only in FILE_Volume. - * NOTE: Windows 2000 uses NTFS 3.0 while Windows NT4 service pack 6a uses - * NTFS 1.2. I haven't personally seen other values yet. - */ -typedef struct { - u64 reserved; /* Not used (yet?). */ - u8 major_ver; /* Major version of the ntfs format. */ - u8 minor_ver; /* Minor version of the ntfs format. */ - VOLUME_FLAGS flags; /* Bit array of VOLUME_* flags. */ -} __attribute__ ((__packed__)) VOLUME_INFORMATION; - -/* - * Attribute: Data attribute (0x80). - * - * NOTE: Can be resident or non-resident. - * - * Data contents of a file (i.e. the unnamed stream) or of a named stream. - */ -typedef struct { - u8 data[0]; /* The file's data contents. */ -} __attribute__ ((__packed__)) DATA_ATTR; - -/* - * Index header flags (8-bit). - */ -typedef enum { - /* When index header is in an index root attribute: */ - SMALL_INDEX = 0, /* The index is small enough to fit inside the - index root attribute and there is no index - allocation attribute present. */ - LARGE_INDEX = 1, /* The index is too large to fit in the index - root attribute and/or an index allocation - attribute is present. */ - /* - * When index header is in an index block, i.e. is part of index - * allocation attribute: - */ - LEAF_NODE = 0, /* This is a leaf node, i.e. there are no more - nodes branching off it. */ - INDEX_NODE = 1, /* This node indexes other nodes, i.e. is not a - leaf node. */ - NODE_MASK = 1, /* Mask for accessing the *_NODE bits. */ -} __attribute__ ((__packed__)) INDEX_HEADER_FLAGS; - -/* - * This is the header for indexes, describing the INDEX_ENTRY records, which - * follow the INDEX_HEADER. Together the index header and the index entries - * make up a complete index. - * - * IMPORTANT NOTE: The offset, length and size structure members are counted - * relative to the start of the index header structure and not relative to the - * start of the index root or index allocation structures themselves. - */ -typedef struct { - u32 entries_offset; /* Byte offset to first INDEX_ENTRY - aligned to 8-byte boundary. */ - u32 index_length; /* Data size of the index in bytes, - i.e. bytes used from allocated - size, aligned to 8-byte boundary. */ - u32 allocated_size; /* Byte size of this index (block), - multiple of 8 bytes. */ - /* NOTE: For the index root attribute, the above two numbers are always - equal, as the attribute is resident and it is resized as needed. In - the case of the index allocation attribute the attribute is not - resident and hence the allocated_size is a fixed value and must - equal the index_block_size specified by the INDEX_ROOT attribute - corresponding to the INDEX_ALLOCATION attribute this INDEX_BLOCK - belongs to. */ - INDEX_HEADER_FLAGS flags; /* Bit field of INDEX_HEADER_FLAGS. */ - u8 reserved[3]; /* Reserved/align to 8-byte boundary. */ -} __attribute__ ((__packed__)) INDEX_HEADER; - -/* - * Attribute: Index root (0x90). - * - * NOTE: Always resident. - * - * This is followed by a sequence of index entries (INDEX_ENTRY structures) - * as described by the index header. - * - * When a directory is small enough to fit inside the index root then this - * is the only attribute describing the directory. When the directory is too - * large to fit in the index root, on the other hand, two aditional attributes - * are present: an index allocation attribute, containing sub-nodes of the B+ - * directory tree (see below), and a bitmap attribute, describing which virtual - * cluster numbers (vcns) in the index allocation attribute are in use by an - * index block. - * - * NOTE: The root directory (FILE_root) contains an entry for itself. Other - * dircetories do not contain entries for themselves, though. - */ -typedef struct { - ATTR_TYPES type; /* Type of the indexed attribute. Is - $FILE_NAME for directories, zero - for view indexes. No other values - allowed. */ - COLLATION_RULES collation_rule; /* Collation rule used to sort the - index entries. If type is $FILE_NAME, - this must be COLLATION_FILE_NAME. */ - u32 index_block_size; /* Size of each index block in bytes (in - the index allocation attribute). */ - u8 clusters_per_index_block; /* Cluster size of each index block (in - the index allocation attribute), when - an index block is >= than a cluster, - otherwise this will be the log of - the size (like how the encoding of - the mft record size and the index - record size found in the boot sector - work). Has to be a power of 2. */ - u8 reserved[3]; /* Reserved/align to 8-byte boundary. */ - INDEX_HEADER index; /* Index header describing the - following index entries. */ -} __attribute__ ((__packed__)) INDEX_ROOT; - -/* - * Attribute: Index allocation (0xa0). - * - * NOTE: Always non-resident (doesn't make sense to be resident anyway!). - * - * This is an array of index blocks. Each index block starts with an - * INDEX_BLOCK structure containing an index header, followed by a sequence of - * index entries (INDEX_ENTRY structures), as described by the INDEX_HEADER. - */ -typedef struct { -/* 0*/ NTFS_RECORD; /* Magic is "INDX". */ -/* 8*/ s64 lsn; /* $LogFile sequence number of the last - modification of this index block. */ -/* 16*/ VCN index_block_vcn; /* Virtual cluster number of the index block. */ -/* 24*/ INDEX_HEADER index; /* Describes the following index entries. */ -/* sizeof()= 40 (0x28) bytes */ -/* - * When creating the index block, we place the update sequence array at this - * offset, i.e. before we start with the index entries. This also makes sense, - * otherwise we could run into problems with the update sequence array - * containing in itself the last two bytes of a sector which would mean that - * multi sector transfer protection wouldn't work. As you can't protect data - * by overwriting it since you then can't get it back... - * When reading use the data from the ntfs record header. - */ -} __attribute__ ((__packed__)) INDEX_BLOCK; - -typedef INDEX_BLOCK INDEX_ALLOCATION; - -/* - * The system file FILE_Extend/$Reparse contains an index named $R listing - * all reparse points on the volume. The index entry keys are as defined - * below. Note, that there is no index data associated with the index entries. - * - * The index entries are sorted by the index key file_id. The collation rule is - * COLLATION_NTOFS_ULONGS. FIXME: Verify whether the reparse_tag is not the - * primary key / is not a key at all. (AIA) - */ -typedef struct { - u32 reparse_tag; /* Reparse point type (inc. flags). */ - MFT_REF file_id; /* Mft record of the file containing the - reparse point attribute. */ -} __attribute__ ((__packed__)) REPARSE_INDEX_KEY; - -/* - * Quota flags (32-bit). - */ -typedef enum { - /* The user quota flags. Names explain meaning. */ - QUOTA_FLAG_DEFAULT_LIMITS = const_cpu_to_le32(0x00000001), - QUOTA_FLAG_LIMIT_REACHED = const_cpu_to_le32(0x00000002), - QUOTA_FLAG_ID_DELETED = const_cpu_to_le32(0x00000004), - - QUOTA_FLAG_USER_MASK = const_cpu_to_le32(0x00000007), - /* Bit mask for user quota flags. */ - - /* These flags are only present in the quota defaults index entry, - i.e. in the entry where owner_id = QUOTA_DEFAULTS_ID. */ - QUOTA_FLAG_TRACKING_ENABLED = const_cpu_to_le32(0x00000010), - QUOTA_FLAG_ENFORCEMENT_ENABLED = const_cpu_to_le32(0x00000020), - QUOTA_FLAG_TRACKING_REQUESTED = const_cpu_to_le32(0x00000040), - QUOTA_FLAG_LOG_THRESHOLD = const_cpu_to_le32(0x00000080), - QUOTA_FLAG_LOG_LIMIT = const_cpu_to_le32(0x00000100), - QUOTA_FLAG_OUT_OF_DATE = const_cpu_to_le32(0x00000200), - QUOTA_FLAG_CORRUPT = const_cpu_to_le32(0x00000400), - QUOTA_FLAG_PENDING_DELETES = const_cpu_to_le32(0x00000800), -} QUOTA_FLAGS; - -/* - * The system file FILE_Extend/$Quota contains two indexes $O and $Q. Quotas - * are on a per volume and per user basis. - * - * The $Q index contains one entry for each existing user_id on the volume. The - * index key is the user_id of the user/group owning this quota control entry, - * i.e. the key is the owner_id. The user_id of the owner of a file, i.e. the - * owner_id, is found in the standard information attribute. The collation rule - * for $Q is COLLATION_NTOFS_ULONG. - * - * The $O index contains one entry for each user/group who has been assigned - * a quota on that volume. The index key holds the SID of the user_id the - * entry belongs to, i.e. the owner_id. The collation rule for $O is - * COLLATION_NTOFS_SID. - * - * The $O index entry data is the user_id of the user corresponding to the SID. - * This user_id is used as an index into $Q to find the quota control entry - * associated with the SID. - * - * The $Q index entry data is the quota control entry and is defined below. - */ -typedef struct { - u32 version; /* Currently equals 2. */ - QUOTA_FLAGS flags; /* Flags describing this quota entry. */ - u64 bytes_used; /* How many bytes of the quota are in use. */ - s64 change_time; /* Last time this quota entry was changed. */ - s64 threshold; /* Soft quota (-1 if not limited). */ - s64 limit; /* Hard quota (-1 if not limited). */ - s64 exceeded_time; /* How long the soft quota has been exceeded. */ - SID sid; /* The SID of the user/object associated with - this quota entry. Equals zero for the quota - defaults entry. */ -} __attribute__ ((__packed__)) QUOTA_CONTROL_ENTRY; - -/* - * Predefined owner_id values (32-bit). - */ -typedef enum { - QUOTA_INVALID_ID = const_cpu_to_le32(0x00000000), - QUOTA_DEFAULTS_ID = const_cpu_to_le32(0x00000001), - QUOTA_FIRST_USER_ID = const_cpu_to_le32(0x00000100), -} PREDEFINED_OWNER_IDS; - -/* - * Index entry flags (16-bit). - */ -typedef enum { - INDEX_ENTRY_NODE = const_cpu_to_le16(1), /* This entry contains a - sub-node, i.e. a reference to an index - block in form of a virtual cluster - number (see below). */ - INDEX_ENTRY_END = const_cpu_to_le16(2), /* This signifies the last - entry in an index block. The index - entry does not represent a file but it - can point to a sub-node. */ - INDEX_ENTRY_SPACE_FILLER = 0xffff, /* Just to force 16-bit width. */ -} __attribute__ ((__packed__)) INDEX_ENTRY_FLAGS; - -/* - * This the index entry header (see below). - */ -typedef struct { -/* 0*/ union { /* Only valid when INDEX_ENTRY_END is not set. */ - MFT_REF indexed_file; /* The mft reference of the file - described by this index - entry. Used for directory - indexes. */ - struct { /* Used for views/indexes to find the entry's data. */ - u16 data_offset; /* Data byte offset from this - INDEX_ENTRY. Follows the - index key. */ - u16 data_length; /* Data length in bytes. */ - u32 reservedV; /* Reserved (zero). */ - } __attribute__ ((__packed__)); - } __attribute__ ((__packed__)); -/* 8*/ u16 length; /* Byte size of this index entry, multiple of - 8-bytes. */ -/* 10*/ u16 key_length; /* Byte size of the key value, which is in the - index entry. It follows field reserved. Not - multiple of 8-bytes. */ -/* 12*/ INDEX_ENTRY_FLAGS flags; /* Bit field of INDEX_ENTRY_* flags. */ -/* 14*/ u16 reserved; /* Reserved/align to 8-byte boundary. */ -/* sizeof() = 16 bytes */ -} __attribute__ ((__packed__)) INDEX_ENTRY_HEADER; - -/* - * This is an index entry. A sequence of such entries follows each INDEX_HEADER - * structure. Together they make up a complete index. The index follows either - * an index root attribute or an index allocation attribute. - * - * NOTE: Before NTFS 3.0 only filename attributes were indexed. - */ -typedef struct { -/* 0*/ INDEX_ENTRY_HEADER; /* The index entry header (see above). */ -/* 16*/ union { /* The key of the indexed attribute. NOTE: Only present - if INDEX_ENTRY_END bit in flags is not set. NOTE: On - NTFS versions before 3.0 the only valid key is the - FILE_NAME_ATTR. On NTFS 3.0+ the following - additional index keys are defined: */ - FILE_NAME_ATTR file_name;/* $I30 index in directories. */ - SII_INDEX_KEY sii; /* $SII index in $Secure. */ - SDH_INDEX_KEY sdh; /* $SDH index in $Secure. */ - GUID object_id; /* $O index in FILE_Extend/$ObjId: The - object_id of the mft record found in - the data part of the index. */ - REPARSE_INDEX_KEY; /* $R index in FILE_Extend/$Reparse. */ - SID sid; /* $O index in FILE_Extend/$Quota: - SID of the owner of the user_id. */ - u32 owner_id; /* $Q index in FILE_Extend/$Quota: - user_id of the owner of the quota - control entry in the data part of - the index. */ - } __attribute__ ((__packed__)) key; - /* The (optional) index data is inserted here when creating. */ - // VCN vcn; /* If INDEX_ENTRY_NODE bit in flags is set, the last - // eight bytes of this index entry contain the virtual - // cluster number of the index block that holds the - // entries immediately preceding the current entry (the - // vcn references the corresponding cluster in the data - // of the non-resident index allocation attribute). If - // the key_length is zero, then the vcn immediately - // follows the INDEX_ENTRY_HEADER. Regardless of - // key_length, the address of the 8-byte boundary - // alligned vcn of INDEX_ENTRY{_HEADER} *ie is given by - // (char*)ie + le16_to_cpu(ie*)->length) - sizeof(VCN), - // where sizeof(VCN) can be hardcoded as 8 if wanted. */ -} __attribute__ ((__packed__)) INDEX_ENTRY; - -/* - * Attribute: Bitmap (0xb0). - * - * Contains an array of bits (aka a bitfield). - * - * When used in conjunction with the index allocation attribute, each bit - * corresponds to one index block within the index allocation attribute. Thus - * the number of bits in the bitmap * index block size / cluster size is the - * number of clusters in the index allocation attribute. - */ -typedef struct { - u8 bitmap[0]; /* Array of bits. */ -} __attribute__ ((__packed__)) BITMAP_ATTR; - -/* - * The reparse point tag defines the type of the reparse point. It also - * includes several flags, which further describe the reparse point. - * - * The reparse point tag is an unsigned 32-bit value divided in three parts: - * - * 1. The least significant 16 bits (i.e. bits 0 to 15) specifiy the type of - * the reparse point. - * 2. The 13 bits after this (i.e. bits 16 to 28) are reserved for future use. - * 3. The most significant three bits are flags describing the reparse point. - * They are defined as follows: - * bit 29: Name surrogate bit. If set, the filename is an alias for - * another object in the system. - * bit 30: High-latency bit. If set, accessing the first byte of data will - * be slow. (E.g. the data is stored on a tape drive.) - * bit 31: Microsoft bit. If set, the tag is owned by Microsoft. User - * defined tags have to use zero here. - */ -typedef enum { - IO_REPARSE_TAG_IS_ALIAS = const_cpu_to_le32(0x20000000), - IO_REPARSE_TAG_IS_HIGH_LATENCY = const_cpu_to_le32(0x40000000), - IO_REPARSE_TAG_IS_MICROSOFT = const_cpu_to_le32(0x80000000), - - IO_REPARSE_TAG_RESERVED_ZERO = const_cpu_to_le32(0x00000000), - IO_REPARSE_TAG_RESERVED_ONE = const_cpu_to_le32(0x00000001), - IO_REPARSE_TAG_RESERVED_RANGE = const_cpu_to_le32(0x00000001), - - IO_REPARSE_TAG_NSS = const_cpu_to_le32(0x68000005), - IO_REPARSE_TAG_NSS_RECOVER = const_cpu_to_le32(0x68000006), - IO_REPARSE_TAG_SIS = const_cpu_to_le32(0x68000007), - IO_REPARSE_TAG_DFS = const_cpu_to_le32(0x68000008), - - IO_REPARSE_TAG_MOUNT_POINT = const_cpu_to_le32(0x88000003), - - IO_REPARSE_TAG_HSM = const_cpu_to_le32(0xa8000004), - - IO_REPARSE_TAG_SYMBOLIC_LINK = const_cpu_to_le32(0xe8000000), - - IO_REPARSE_TAG_VALID_VALUES = const_cpu_to_le32(0xe000ffff), -} PREDEFINED_REPARSE_TAGS; - -/* - * Attribute: Reparse point (0xc0). - * - * NOTE: Can be resident or non-resident. - */ -typedef struct { - u32 reparse_tag; /* Reparse point type (inc. flags). */ - u16 reparse_data_length; /* Byte size of reparse data. */ - u16 reserved; /* Align to 8-byte boundary. */ - u8 reparse_data[0]; /* Meaning depends on reparse_tag. */ -} __attribute__ ((__packed__)) REPARSE_POINT; - -/* - * Attribute: Extended attribute (EA) information (0xd0). - * - * NOTE: Always resident. (Is this true???) - */ -typedef struct { - u16 ea_length; /* Byte size of the packed extended - attributes. */ - u16 need_ea_count; /* The number of extended attributes which have - the NEED_EA bit set. */ - u32 ea_query_length; /* Byte size of the buffer required to query - the extended attributes when calling - ZwQueryEaFile() in Windows NT/2k. I.e. the - byte size of the unpacked extended - attributes. */ -} __attribute__ ((__packed__)) EA_INFORMATION; - -/* - * Extended attribute flags (8-bit). - */ -typedef enum { - NEED_EA = 0x80, -} __attribute__ ((__packed__)) EA_FLAGS; - -/* - * Attribute: Extended attribute (EA) (0xe0). - * - * NOTE: Always non-resident. (Is this true?) - * - * Like the attribute list and the index buffer list, the EA attribute value is - * a sequence of EA_ATTR variable length records. - * - * FIXME: It appears weird that the EA name is not unicode. Is it true? - */ -typedef struct { - u32 next_entry_offset; /* Offset to the next EA_ATTR. */ - EA_FLAGS flags; /* Flags describing the EA. */ - u8 ea_name_length; /* Length of the name of the extended - attribute in bytes. */ - u16 ea_value_length; /* Byte size of the EA's value. */ - u8 ea_name[0]; /* Name of the EA. */ - u8 ea_value[0]; /* The value of the EA. Immediately - follows the name. */ -} __attribute__ ((__packed__)) EA_ATTR; - -/* - * Attribute: Property set (0xf0). - * - * Intended to support Native Structure Storage (NSS) - a feature removed from - * NTFS 3.0 during beta testing. - */ -typedef struct { - /* Irrelevant as feature unused. */ -} __attribute__ ((__packed__)) PROPERTY_SET; - -/* - * Attribute: Logged utility stream (0x100). - * - * NOTE: Can be resident or non-resident. - * - * Operations on this attribute are logged to the journal ($LogFile) like - * normal metadata changes. - * - * Used by the Encrypting File System (EFS). All encrypted files have this - * attribute with the name $EFS. - */ -typedef struct { - /* Can be anything the creator chooses. */ - /* EFS uses it as follows: */ - // FIXME: Type this info, verifying it along the way. (AIA) -} __attribute__ ((__packed__)) LOGGED_UTILITY_STREAM, EFS_ATTR; - -#endif /* defined _NTFS_LAYOUT_H */ - From 1b5fbcee9a23d718cd26200dda18dafefe7986bf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1007/2994] Rename: include/lcnalloc.h -> include/ntfs/lcnalloc.h (Logical change 1.280) --- include/ntfs/lcnalloc.h | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/include/ntfs/lcnalloc.h b/include/ntfs/lcnalloc.h index e69de29b..94774c72 100644 --- a/include/ntfs/lcnalloc.h +++ b/include/ntfs/lcnalloc.h @@ -0,0 +1,44 @@ +/* + * lcnalloc.h - Exports for cluster (de)allocation. Part of the Linux-NTFS + * project. + * + * Copyright (c) 2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_LCNALLOC_H +#define _NTFS_LCNALLOC_H + +#include "types.h" +#include "runlist.h" +#include "volume.h" + +typedef enum { + FIRST_ZONE = 0, /* For sanity checking. */ + MFT_ZONE = 0, /* Allocate from $MFT zone. */ + DATA_ZONE = 1, /* Allocate from $DATA zone. */ + LAST_ZONE = 1, /* For sanity checking. */ +} NTFS_CLUSTER_ALLOCATION_ZONES; + +extern runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, + const NTFS_CLUSTER_ALLOCATION_ZONES zone); + +extern int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, + s64 count); + +#endif /* defined _NTFS_LCNALLOC_H */ + From f0a07eee9fc297ac06aa04715afd5b1af82530b2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1008/2994] Rename: include/lcnalloc.h -> include/ntfs/lcnalloc.h }(Logical change 1.280) --- include/lcnalloc.h | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 include/lcnalloc.h diff --git a/include/lcnalloc.h b/include/lcnalloc.h deleted file mode 100644 index 94774c72..00000000 --- a/include/lcnalloc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * lcnalloc.h - Exports for cluster (de)allocation. Part of the Linux-NTFS - * project. - * - * Copyright (c) 2002 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_LCNALLOC_H -#define _NTFS_LCNALLOC_H - -#include "types.h" -#include "runlist.h" -#include "volume.h" - -typedef enum { - FIRST_ZONE = 0, /* For sanity checking. */ - MFT_ZONE = 0, /* Allocate from $MFT zone. */ - DATA_ZONE = 1, /* Allocate from $DATA zone. */ - LAST_ZONE = 1, /* For sanity checking. */ -} NTFS_CLUSTER_ALLOCATION_ZONES; - -extern runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, - const NTFS_CLUSTER_ALLOCATION_ZONES zone); - -extern int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, - s64 count); - -#endif /* defined _NTFS_LCNALLOC_H */ - From f23548e88fb2904fbfa19bb1e94a34690a55e35e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1009/2994] Rename: include/list.h -> include/ntfs/list.h (Logical change 1.280) --- include/ntfs/list.h | 184 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) diff --git a/include/ntfs/list.h b/include/ntfs/list.h index e69de29b..73041234 100644 --- a/include/ntfs/list.h +++ b/include/ntfs/list.h @@ -0,0 +1,184 @@ +/* + * list.h - Linked list implementation. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov and others + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_LIST_H +#define _NTFS_LIST_H + +/* + * Simple doubly linked list implementation. - Copied from Linux kernel + * 2.4.2-ac18 into Linux-NTFS (with minor modifications). - AIA + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know the prev/next + * entries already! + */ +static __inline__ void __list_add(struct list_head * new, + struct list_head * prev, struct list_head * next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static __inline__ void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static __inline__ void list_add_tail(struct list_head *new, struct list_head *head) +{ + __list_add(new, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries point to each other. + * + * This is only for internal list manipulation where we know the prev/next + * entries already! + */ +static __inline__ void __list_del(struct list_head * prev, + struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * + * Note: list_empty on entry does not return true after this, the entry is in + * an undefined state. + */ +static __inline__ void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static __inline__ void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static __inline__ int list_empty(struct list_head *head) +{ + return head->next == head; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static __inline__ void list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + + if (first != list) { + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +#endif /* defined _NTFS_LIST_H */ + From 51e1b946609a900f1570fd183c0ce82d139e4ca2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1010/2994] Rename: include/list.h -> include/ntfs/list.h }(Logical change 1.280) --- include/list.h | 184 ------------------------------------------------- 1 file changed, 184 deletions(-) delete mode 100644 include/list.h diff --git a/include/list.h b/include/list.h deleted file mode 100644 index 73041234..00000000 --- a/include/list.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * list.h - Linked list implementation. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2002 Anton Altaparmakov and others - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_LIST_H -#define _NTFS_LIST_H - -/* - * Simple doubly linked list implementation. - Copied from Linux kernel - * 2.4.2-ac18 into Linux-NTFS (with minor modifications). - AIA - * - * Some of the internal functions ("__xxx") are useful when - * manipulating whole lists rather than single entries, as - * sometimes we already know the next/prev entries and we can - * generate better code by using them directly rather than - * using the generic single-entry routines. - */ - -struct list_head { - struct list_head *next, *prev; -}; - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -#define INIT_LIST_HEAD(ptr) do { \ - (ptr)->next = (ptr); (ptr)->prev = (ptr); \ -} while (0) - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know the prev/next - * entries already! - */ -static __inline__ void __list_add(struct list_head * new, - struct list_head * prev, struct list_head * next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -/** - * list_add - add a new entry - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -static __inline__ void list_add(struct list_head *new, struct list_head *head) -{ - __list_add(new, head, head->next); -} - -/** - * list_add_tail - add a new entry - * @new: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -static __inline__ void list_add_tail(struct list_head *new, struct list_head *head) -{ - __list_add(new, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries point to each other. - * - * This is only for internal list manipulation where we know the prev/next - * entries already! - */ -static __inline__ void __list_del(struct list_head * prev, - struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * - * Note: list_empty on entry does not return true after this, the entry is in - * an undefined state. - */ -static __inline__ void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); -} - -/** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -static __inline__ void list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -static __inline__ int list_empty(struct list_head *head) -{ - return head->next == head; -} - -/** - * list_splice - join two lists - * @list: the new list to add. - * @head: the place to add it in the first list. - */ -static __inline__ void list_splice(struct list_head *list, - struct list_head *head) -{ - struct list_head *first = list->next; - - if (first != list) { - struct list_head *last = list->prev; - struct list_head *at = head->next; - - first->prev = head; - head->next = first; - - last->next = at; - at->prev = last; - } -} - -/** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - */ -#define list_entry(ptr, type, member) \ - ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) - -/** - * list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop counter. - * @n: another &struct list_head to use as temporary storage - * @head: the head for your list. - */ -#define list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) - -#endif /* defined _NTFS_LIST_H */ - From 1ce0bb34b1da9eb2bfaecb9769818b8527bab6d9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1011/2994] Rename: include/logfile.h -> include/ntfs/logfile.h (Logical change 1.280) --- include/ntfs/logfile.h | 241 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 241 insertions(+) diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index e69de29b..e3d5f074 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -0,0 +1,241 @@ +/* + * logfile.h - Exports for $LogFile handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_LOGFILE_H +#define _NTFS_LOGFILE_H + +#include "types.h" + +typedef enum { + magic_RSTR = const_cpu_to_le32(0x52545352), /* "RSTR", restart area */ + magic_RCRD = const_cpu_to_le32(0x44524352), /* "RCRD", log record */ +} LOG_FILE_RECORD_TYPES; + +/* + * Specialised magic comparison macros. + */ +#define ntfs_is_rstr_record(x) ( ntfs_is_magic (x, RSTR) ) +#define ntfs_is_rstr_recordp(p) ( ntfs_is_magicp(p, RSTR) ) +#define ntfs_is_rcrd_record(x) ( ntfs_is_magic (x, RCRD) ) +#define ntfs_is_rcrd_recordp(p) ( ntfs_is_magicp(p, RCRD) ) + +/* + * Log file organization: + * Two restart areas present in the first two pages (restart pages). When + * the volume is unmounted they should be identical. + * These are followed by log records organized in pages headed by a record + * header going up to log file size. Not all pages contain log records when a + * volume is first formatted, but as the volume ages, all records will be used. + * When the log file fills up, the records at the beginning are purged (by + * modifying the oldest_lsn to a higher value presumably) and writing begins + * at the beginning of the file. Effectively, the log file is viewed as a + * circular entity. + */ + +/* + * Log file restart page header (begins the restart area). + */ +typedef struct { + NTFS_RECORD; /* The magic is "RSTR". */ + u64 chkdsk_lsn; /* The check disk log file sequence number for + this restart page. Only used when the + magic is changed to "CHKD". = 0 */ + u32 system_page_size; /* Byte size of system pages, has to be >= 512 + and a power of 2. Use this to calculate the + required size of the usa and add this to the + ntfs.usa_offset value. Then verify that the + result is less than the value of the + restart_offset. = 0x1000 */ + u32 log_page_size; /* Byte size of log file records, has to be + >= 512 and a power of 2. = 0x1000 */ + u16 restart_offset; /* Byte offset from the start of the record to + the restart record. Value has to be aligned + to 8-byte boundary. = 0x30 */ + s16 minor_ver; /* Log file minor version. Only check if major + version is 1. (=1 but >=1 is treated the + same and <=0 is also ok) */ + u16 major_ver; /* Log file major version (=1 but =0 is ok) */ +} __attribute__ ((__packed__)) RESTART_PAGE_HEADER; + +/* + * Log file restart area record. The offset of this record is found by adding + * the offset of the RESTART_PAGE_HEADER to the restart_offset value found in + * it. + */ +typedef struct { + u64 current_lsn; /* Log file record. = 0x700000, 0x700808 */ + u16 log_clients; /* Number of log client records following + the restart_area. = 1 */ + s16 client_free_list; /* How many clients are free(?). If != 0xffff, + check that log_clients > client_free_list. + = 0xffff */ + s16 client_in_use_list;/* How many clients are in use(?). If != 0xffff + check that log_clients > client_in_use_list. + = 0 */ + u16 flags; /* ??? = 0 */ + u32 seq_number_bits; /* ??? = 0x2c or 0x2d */ + u16 restart_area_length;/* Length of the restart area. Following + checks required if version matches. + Otherwise, skip them. restart_offset + + restart_area_length has to be <= + system_page_size. Also, restart_area_length + has to be >= client_array_offset + + (log_clients * 0xa0). = 0xd0 */ + u16 client_array_offset;/* Offset from the start of this record to + the first client record if versions are + matched. The offset is otherwise assumed to + be (sizeof(RESTART_AREA) + 7) & ~7, i.e. + rounded up to first 8-byte boundary. Either + way, the offset to the client array has to be + aligned to an 8-byte boundary. Also, + restart_offset + offset to the client array + have to be <= 510. Also, the offset to the + client array + (log_clients * 0xa0) have to + be <= SystemPageSize. = 0x30 */ + s64 file_size; /* Byte size of the log file. If the + restart_offset + the offset of the file_size + are > 510 then corruption has occured. This + is the very first check when starting with + the restart_area as if it fails it means + that some of the above values will be + corrupted by the multi sector transfer + protection! If the structure is deprotected + then these checks are futile of course. + Calculate the file_size bits and check that + seq_number_bits == 0x43 - file_size bits. + = 0x400000 */ + u32 last_lsn_data_length;/* ??? = 0, 0x40 */ + u16 record_length; /* Byte size of this record. If the version + matches then check that the value of + record_length is a multiple of 8, i.e. + (record_length + 7) & ~7 == record_length. + = 0x30 */ + u16 log_page_data_offset;/* ??? = 0x40 */ + /* + * There are eight bytes here at offset 0x58, which contain a value, + * which we don't know what it means. It looks like it could be a + * 64-bit number or a 32-bit plus something else (the second 32-bits + * are zero so can't tell). Have to try to zero it and see if Windows + * copes with this. + */ +} __attribute__ ((__packed__)) RESTART_AREA; + +/* + * Log file restart client. The offset of this record is found by adding + * the offset of the RESTART_AREA to the client_array_offset value found in it. + */ +typedef struct { + u64 oldest_lsn; /* Oldest log file sequence number for this + client record. */ + u64 client_restart_lsn; /* Log file sequence number at which to + restart the volume, i.e. the current + position within the logfile. */ + s16 prev_client; /* ??? = 0xffff */ + s16 next_client; /* ??? = 0xffff */ + u64 seq_number; /* ??? = 1, size uncertain, Regis calls this + "volume clear flag" and gives a size of one + byte. */ + u32 client_name_length; /* ??? length of client name in bytes. = 8, + size uncertain, offset uncertain */ + uchar_t client_name[0]; /* ??? Name of the client in unicode. = NTFS */ + /* + * Or it could be the client name is fixed size like in attr def struct + * and the 8 means something else. Favouring this is that the + * RESTART_CLIENT struct is assumed to be fixed size of 0xa0 bytes, + * just like the attr def struct! There might be parallels to be drawn + * between the two. + */ +} __attribute__ ((__packed__)) RESTART_CLIENT; + +/* + * Log page record page header. Each log page begins with this header and is + * followed by several LOG_RECORD structures, starting at offset 0x40 (the + * size of this structure and the following update sequence array and then + * aligned to 8 byte boundary, but is this specified anywhere?). + */ +typedef struct { + NTFS_RECORD; /* The magic is "RCRD". */ + union { + u64 last_lsn; + u32 file_offset; + } __attribute__ ((__packed__)) copy; + u32 flags; + u16 page_count; + u16 page_position; + union { + struct { + u64 next_record_offset; + u64 last_end_lsn; + } __attribute__ ((__packed__)) packed; + } __attribute__ ((__packed__)) header; +} __attribute__ ((__packed__)) RECORD_PAGE_HEADER; + +/* + * Possible flags for log records. + */ +typedef enum { + LOG_RECORD_MULTI_PAGE = const_cpu_to_le16(0x0001), /* ??? */ + LOG_RECORD_SIZE_PLACE_HOLDER = 0xffff, + /* This has nothing to do with the log record. It is only so + gcc knows to make the flags 16-bit. */ +} __attribute__ ((__packed__)) LOG_RECORD_FLAGS; + +/* + * Log record header. Each log record seems to have a constant size of 0x70 + * bytes. + */ +typedef struct { + u64 this_lsn; + u64 client_previous_lsn; + u64 client_undo_next_lsn; + u32 client_data_length; + struct { + u16 seq_number; + u16 client_index; + } __attribute__ ((__packed__)) client_id; + u32 record_type; + u32 transaction_id; + LOG_RECORD_FLAGS flags; + u16 reserved_or_alignment[3]; +/* Now are at ofs 0x30 into struct. */ + u16 redo_operation; + u16 undo_operation; + u16 redo_offset; + u16 redo_length; + u16 undo_offset; + u16 undo_length; + u16 target_attribute; + u16 lcns_to_follow; /* Number of lcn_list entries + following this entry. */ +/* Now at ofs 0x40. */ + u16 record_offset; + u16 attribute_offset; + u32 alignment_or_reserved; + s64 target_vcn; +/* Now at ofs 0x50. */ + struct { /* Only present if lcns_to_follow + is not 0. */ + s64 lcn; + } __attribute__((__packed__)) lcn_list[0]; +} __attribute__ ((__packed__)) LOG_RECORD; + +#endif /* defined _NTFS_LOGFILE_H */ + From d281afae83b00a5291ef457d565cea514b971121 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1012/2994] Rename: include/logfile.h -> include/ntfs/logfile.h }(Logical change 1.280) --- include/logfile.h | 241 ---------------------------------------------- 1 file changed, 241 deletions(-) delete mode 100644 include/logfile.h diff --git a/include/logfile.h b/include/logfile.h deleted file mode 100644 index e3d5f074..00000000 --- a/include/logfile.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * logfile.h - Exports for $LogFile handling. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2002 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_LOGFILE_H -#define _NTFS_LOGFILE_H - -#include "types.h" - -typedef enum { - magic_RSTR = const_cpu_to_le32(0x52545352), /* "RSTR", restart area */ - magic_RCRD = const_cpu_to_le32(0x44524352), /* "RCRD", log record */ -} LOG_FILE_RECORD_TYPES; - -/* - * Specialised magic comparison macros. - */ -#define ntfs_is_rstr_record(x) ( ntfs_is_magic (x, RSTR) ) -#define ntfs_is_rstr_recordp(p) ( ntfs_is_magicp(p, RSTR) ) -#define ntfs_is_rcrd_record(x) ( ntfs_is_magic (x, RCRD) ) -#define ntfs_is_rcrd_recordp(p) ( ntfs_is_magicp(p, RCRD) ) - -/* - * Log file organization: - * Two restart areas present in the first two pages (restart pages). When - * the volume is unmounted they should be identical. - * These are followed by log records organized in pages headed by a record - * header going up to log file size. Not all pages contain log records when a - * volume is first formatted, but as the volume ages, all records will be used. - * When the log file fills up, the records at the beginning are purged (by - * modifying the oldest_lsn to a higher value presumably) and writing begins - * at the beginning of the file. Effectively, the log file is viewed as a - * circular entity. - */ - -/* - * Log file restart page header (begins the restart area). - */ -typedef struct { - NTFS_RECORD; /* The magic is "RSTR". */ - u64 chkdsk_lsn; /* The check disk log file sequence number for - this restart page. Only used when the - magic is changed to "CHKD". = 0 */ - u32 system_page_size; /* Byte size of system pages, has to be >= 512 - and a power of 2. Use this to calculate the - required size of the usa and add this to the - ntfs.usa_offset value. Then verify that the - result is less than the value of the - restart_offset. = 0x1000 */ - u32 log_page_size; /* Byte size of log file records, has to be - >= 512 and a power of 2. = 0x1000 */ - u16 restart_offset; /* Byte offset from the start of the record to - the restart record. Value has to be aligned - to 8-byte boundary. = 0x30 */ - s16 minor_ver; /* Log file minor version. Only check if major - version is 1. (=1 but >=1 is treated the - same and <=0 is also ok) */ - u16 major_ver; /* Log file major version (=1 but =0 is ok) */ -} __attribute__ ((__packed__)) RESTART_PAGE_HEADER; - -/* - * Log file restart area record. The offset of this record is found by adding - * the offset of the RESTART_PAGE_HEADER to the restart_offset value found in - * it. - */ -typedef struct { - u64 current_lsn; /* Log file record. = 0x700000, 0x700808 */ - u16 log_clients; /* Number of log client records following - the restart_area. = 1 */ - s16 client_free_list; /* How many clients are free(?). If != 0xffff, - check that log_clients > client_free_list. - = 0xffff */ - s16 client_in_use_list;/* How many clients are in use(?). If != 0xffff - check that log_clients > client_in_use_list. - = 0 */ - u16 flags; /* ??? = 0 */ - u32 seq_number_bits; /* ??? = 0x2c or 0x2d */ - u16 restart_area_length;/* Length of the restart area. Following - checks required if version matches. - Otherwise, skip them. restart_offset + - restart_area_length has to be <= - system_page_size. Also, restart_area_length - has to be >= client_array_offset + - (log_clients * 0xa0). = 0xd0 */ - u16 client_array_offset;/* Offset from the start of this record to - the first client record if versions are - matched. The offset is otherwise assumed to - be (sizeof(RESTART_AREA) + 7) & ~7, i.e. - rounded up to first 8-byte boundary. Either - way, the offset to the client array has to be - aligned to an 8-byte boundary. Also, - restart_offset + offset to the client array - have to be <= 510. Also, the offset to the - client array + (log_clients * 0xa0) have to - be <= SystemPageSize. = 0x30 */ - s64 file_size; /* Byte size of the log file. If the - restart_offset + the offset of the file_size - are > 510 then corruption has occured. This - is the very first check when starting with - the restart_area as if it fails it means - that some of the above values will be - corrupted by the multi sector transfer - protection! If the structure is deprotected - then these checks are futile of course. - Calculate the file_size bits and check that - seq_number_bits == 0x43 - file_size bits. - = 0x400000 */ - u32 last_lsn_data_length;/* ??? = 0, 0x40 */ - u16 record_length; /* Byte size of this record. If the version - matches then check that the value of - record_length is a multiple of 8, i.e. - (record_length + 7) & ~7 == record_length. - = 0x30 */ - u16 log_page_data_offset;/* ??? = 0x40 */ - /* - * There are eight bytes here at offset 0x58, which contain a value, - * which we don't know what it means. It looks like it could be a - * 64-bit number or a 32-bit plus something else (the second 32-bits - * are zero so can't tell). Have to try to zero it and see if Windows - * copes with this. - */ -} __attribute__ ((__packed__)) RESTART_AREA; - -/* - * Log file restart client. The offset of this record is found by adding - * the offset of the RESTART_AREA to the client_array_offset value found in it. - */ -typedef struct { - u64 oldest_lsn; /* Oldest log file sequence number for this - client record. */ - u64 client_restart_lsn; /* Log file sequence number at which to - restart the volume, i.e. the current - position within the logfile. */ - s16 prev_client; /* ??? = 0xffff */ - s16 next_client; /* ??? = 0xffff */ - u64 seq_number; /* ??? = 1, size uncertain, Regis calls this - "volume clear flag" and gives a size of one - byte. */ - u32 client_name_length; /* ??? length of client name in bytes. = 8, - size uncertain, offset uncertain */ - uchar_t client_name[0]; /* ??? Name of the client in unicode. = NTFS */ - /* - * Or it could be the client name is fixed size like in attr def struct - * and the 8 means something else. Favouring this is that the - * RESTART_CLIENT struct is assumed to be fixed size of 0xa0 bytes, - * just like the attr def struct! There might be parallels to be drawn - * between the two. - */ -} __attribute__ ((__packed__)) RESTART_CLIENT; - -/* - * Log page record page header. Each log page begins with this header and is - * followed by several LOG_RECORD structures, starting at offset 0x40 (the - * size of this structure and the following update sequence array and then - * aligned to 8 byte boundary, but is this specified anywhere?). - */ -typedef struct { - NTFS_RECORD; /* The magic is "RCRD". */ - union { - u64 last_lsn; - u32 file_offset; - } __attribute__ ((__packed__)) copy; - u32 flags; - u16 page_count; - u16 page_position; - union { - struct { - u64 next_record_offset; - u64 last_end_lsn; - } __attribute__ ((__packed__)) packed; - } __attribute__ ((__packed__)) header; -} __attribute__ ((__packed__)) RECORD_PAGE_HEADER; - -/* - * Possible flags for log records. - */ -typedef enum { - LOG_RECORD_MULTI_PAGE = const_cpu_to_le16(0x0001), /* ??? */ - LOG_RECORD_SIZE_PLACE_HOLDER = 0xffff, - /* This has nothing to do with the log record. It is only so - gcc knows to make the flags 16-bit. */ -} __attribute__ ((__packed__)) LOG_RECORD_FLAGS; - -/* - * Log record header. Each log record seems to have a constant size of 0x70 - * bytes. - */ -typedef struct { - u64 this_lsn; - u64 client_previous_lsn; - u64 client_undo_next_lsn; - u32 client_data_length; - struct { - u16 seq_number; - u16 client_index; - } __attribute__ ((__packed__)) client_id; - u32 record_type; - u32 transaction_id; - LOG_RECORD_FLAGS flags; - u16 reserved_or_alignment[3]; -/* Now are at ofs 0x30 into struct. */ - u16 redo_operation; - u16 undo_operation; - u16 redo_offset; - u16 redo_length; - u16 undo_offset; - u16 undo_length; - u16 target_attribute; - u16 lcns_to_follow; /* Number of lcn_list entries - following this entry. */ -/* Now at ofs 0x40. */ - u16 record_offset; - u16 attribute_offset; - u32 alignment_or_reserved; - s64 target_vcn; -/* Now at ofs 0x50. */ - struct { /* Only present if lcns_to_follow - is not 0. */ - s64 lcn; - } __attribute__((__packed__)) lcn_list[0]; -} __attribute__ ((__packed__)) LOG_RECORD; - -#endif /* defined _NTFS_LOGFILE_H */ - From bafd0f97bc6d8ceee0bf457e36ba4afb38243b47 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1013/2994] Rename: include/mft.h -> include/ntfs/mft.h (Logical change 1.280) --- include/ntfs/mft.h | 109 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/include/ntfs/mft.h b/include/ntfs/mft.h index e69de29b..d45ae7a8 100644 --- a/include/ntfs/mft.h +++ b/include/ntfs/mft.h @@ -0,0 +1,109 @@ +/* + * mft.h - Exports for MFT record handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_MFT_H +#define _NTFS_MFT_H + +#include "volume.h" +#include "inode.h" +#include "layout.h" + +extern int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref, + const s64 count, MFT_RECORD *b); + +/** + * ntfs_mft_record_read - read a record from the mft + * @vol: volume to read from + * @mref: mft record number to read + * @b: output data buffer + * + * Read the mft record specified by @mref from volume @vol into buffer @b. + * Return 0 on success or -1 on error, with errno set to the error code. + * + * The read mft record is mst deprotected and is hence ready to use. The caller + * should check the record with is_baad_record() in case mst deprotection + * failed. + * + * NOTE: @b has to be at least of size vol->mft_record_size. + */ +static __inline__ int ntfs_mft_record_read(const ntfs_volume *vol, + const MFT_REF mref, MFT_RECORD *b) +{ + return ntfs_mft_records_read(vol, mref, 1, b); +} + +extern int ntfs_file_record_read(const ntfs_volume *vol, const MFT_REF mref, + MFT_RECORD **mrec, ATTR_RECORD **attr); + +extern int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, + const s64 count, MFT_RECORD *b); + +/** + * ntfs_mft_record_write - write an mft record to disk + * @vol: volume to write to + * @mref: mft record number to write + * @b: data buffer containing the mft record to write + * + * Write the mft record specified by @mref from buffer @b to volume @vol. + * Return 0 on success or -1 on error, with errno set to the error code. + * + * Before the mft record is written, it is mst protected. After the write, it + * is deprotected again, thus resulting in an increase in the update sequence + * number inside the buffer @b. + * + * NOTE: @b has to be at least of size vol->mft_record_size. + */ +static __inline__ int ntfs_mft_record_write(const ntfs_volume *vol, + const MFT_REF mref, MFT_RECORD *b) +{ + return ntfs_mft_records_write(vol, mref, 1, b); +} + +/** + * ntfs_mft_record_get_data_size - return number of bytes used in mft record @b + * @m: mft record to get the data size of + * + * Takes the mft record @m and returns the number of bytes used in the record + * or 0 on error (i.e. @m is not a valid mft record). Zero is not a valid size + * for an mft record as it at least has to have the MFT_RECORD, thus making the + * minimum size: + * (sizeof(MFT_RECORD) + 7) & ~7 + sizeof(ATTR_TYPES) = 52 bytes + * Aside: The 8-byte alignment and the 4 bytes for the attribute type are needed + * as each mft record has to have a list of attributes even if it only contains + * the attribute $END which doesn't contain anything else apart from its type. + * Also, you would expect every mft record to contain an update sequence array + * as well but that could in theory be non-existent (don't know if Windows' + * NTFS driver/chkdsk wouldn't view this as corruption in itself though). + */ +static __inline__ u32 ntfs_mft_record_get_data_size(const MFT_RECORD *m) +{ + if (!m || !ntfs_is_mft_record(m->magic)) + return 0; + /* Get the number of used bytes and return it. */ + return le32_to_cpu(m->bytes_in_use); +} + +extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, s64 start); + +extern int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni); + +#endif /* defined _NTFS_MFT_H */ + From fc58f7f637f7b0813b7b767f6d4414114816e747 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1014/2994] Rename: include/mft.h -> include/ntfs/mft.h }(Logical change 1.280) --- include/mft.h | 109 -------------------------------------------------- 1 file changed, 109 deletions(-) delete mode 100644 include/mft.h diff --git a/include/mft.h b/include/mft.h deleted file mode 100644 index d45ae7a8..00000000 --- a/include/mft.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * mft.h - Exports for MFT record handling. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2002 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_MFT_H -#define _NTFS_MFT_H - -#include "volume.h" -#include "inode.h" -#include "layout.h" - -extern int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref, - const s64 count, MFT_RECORD *b); - -/** - * ntfs_mft_record_read - read a record from the mft - * @vol: volume to read from - * @mref: mft record number to read - * @b: output data buffer - * - * Read the mft record specified by @mref from volume @vol into buffer @b. - * Return 0 on success or -1 on error, with errno set to the error code. - * - * The read mft record is mst deprotected and is hence ready to use. The caller - * should check the record with is_baad_record() in case mst deprotection - * failed. - * - * NOTE: @b has to be at least of size vol->mft_record_size. - */ -static __inline__ int ntfs_mft_record_read(const ntfs_volume *vol, - const MFT_REF mref, MFT_RECORD *b) -{ - return ntfs_mft_records_read(vol, mref, 1, b); -} - -extern int ntfs_file_record_read(const ntfs_volume *vol, const MFT_REF mref, - MFT_RECORD **mrec, ATTR_RECORD **attr); - -extern int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, - const s64 count, MFT_RECORD *b); - -/** - * ntfs_mft_record_write - write an mft record to disk - * @vol: volume to write to - * @mref: mft record number to write - * @b: data buffer containing the mft record to write - * - * Write the mft record specified by @mref from buffer @b to volume @vol. - * Return 0 on success or -1 on error, with errno set to the error code. - * - * Before the mft record is written, it is mst protected. After the write, it - * is deprotected again, thus resulting in an increase in the update sequence - * number inside the buffer @b. - * - * NOTE: @b has to be at least of size vol->mft_record_size. - */ -static __inline__ int ntfs_mft_record_write(const ntfs_volume *vol, - const MFT_REF mref, MFT_RECORD *b) -{ - return ntfs_mft_records_write(vol, mref, 1, b); -} - -/** - * ntfs_mft_record_get_data_size - return number of bytes used in mft record @b - * @m: mft record to get the data size of - * - * Takes the mft record @m and returns the number of bytes used in the record - * or 0 on error (i.e. @m is not a valid mft record). Zero is not a valid size - * for an mft record as it at least has to have the MFT_RECORD, thus making the - * minimum size: - * (sizeof(MFT_RECORD) + 7) & ~7 + sizeof(ATTR_TYPES) = 52 bytes - * Aside: The 8-byte alignment and the 4 bytes for the attribute type are needed - * as each mft record has to have a list of attributes even if it only contains - * the attribute $END which doesn't contain anything else apart from its type. - * Also, you would expect every mft record to contain an update sequence array - * as well but that could in theory be non-existent (don't know if Windows' - * NTFS driver/chkdsk wouldn't view this as corruption in itself though). - */ -static __inline__ u32 ntfs_mft_record_get_data_size(const MFT_RECORD *m) -{ - if (!m || !ntfs_is_mft_record(m->magic)) - return 0; - /* Get the number of used bytes and return it. */ - return le32_to_cpu(m->bytes_in_use); -} - -extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, s64 start); - -extern int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni); - -#endif /* defined _NTFS_MFT_H */ - From 1e61d4ca7d95f96979b8072126037d682a1d7eab Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1015/2994] Rename: include/mst.h -> include/ntfs/mst.h (Logical change 1.280) --- include/ntfs/mst.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/include/ntfs/mst.h b/include/ntfs/mst.h index e69de29b..0808b3c1 100644 --- a/include/ntfs/mst.h +++ b/include/ntfs/mst.h @@ -0,0 +1,34 @@ +/* + * mst.h - Exports for multi sector transfer fixup functions. Part of the + * Linux-NTFS project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_MST_H +#define _NTFS_MST_H + +#include "types.h" +#include "layout.h" + +extern int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size); +extern int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size); +extern void ntfs_mst_post_write_fixup(NTFS_RECORD *b); + +#endif /* defined _NTFS_MST_H */ + From d9b62e0a626dff512af2000b07a5b9e489067d77 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1016/2994] Rename: include/mst.h -> include/ntfs/mst.h }(Logical change 1.280) --- include/mst.h | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 include/mst.h diff --git a/include/mst.h b/include/mst.h deleted file mode 100644 index 0808b3c1..00000000 --- a/include/mst.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * mst.h - Exports for multi sector transfer fixup functions. Part of the - * Linux-NTFS project. - * - * Copyright (c) 2000-2002 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_MST_H -#define _NTFS_MST_H - -#include "types.h" -#include "layout.h" - -extern int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size); -extern int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size); -extern void ntfs_mst_post_write_fixup(NTFS_RECORD *b); - -#endif /* defined _NTFS_MST_H */ - From ea202b473fe91cd2b610f192a902843d7d480284 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1017/2994] Rename: include/runlist.h -> include/ntfs/runlist.h (Logical change 1.280) --- include/ntfs/runlist.h | 79 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/include/ntfs/runlist.h b/include/ntfs/runlist.h index e69de29b..b22b46dc 100644 --- a/include/ntfs/runlist.h +++ b/include/ntfs/runlist.h @@ -0,0 +1,79 @@ +/* + * runlist.h - Exports for runlist handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002 Richard Russon + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_RUNLIST_H +#define _NTFS_RUNLIST_H + +#include "types.h" + +/* Forward declarations */ +typedef struct _runlist_element runlist_element; +typedef runlist_element runlist; + +#include "attrib.h" +#include "volume.h" + +/* + * runlist_element - in memory vcn to lcn mapping array element + * @vcn: starting vcn of the current array element + * @lcn: starting lcn of the current array element + * @length: length in clusters of the current array element + * + * The last vcn (in fact the last vcn + 1) is reached when length == 0. + * + * When lcn == -1 this means that the count vcns starting at vcn are not + * physically allocated (i.e. this is a hole / data is sparse). + */ +struct _runlist_element {/* In memory vcn to lcn mapping structure element. */ + VCN vcn; /* vcn = Starting virtual cluster number. */ + LCN lcn; /* lcn = Starting logical cluster number. */ + s64 length; /* Run length in clusters. */ +}; + +extern LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn); + +extern s64 ntfs_rl_pread(const ntfs_volume *vol, const runlist_element *rl, + const s64 pos, s64 count, void *b); +extern s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, + const s64 pos, s64 count, void *b); + +extern runlist_element *ntfs_runlists_merge(runlist_element *drl, + runlist_element *srl); + +extern runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, + const ATTR_RECORD *attr, runlist_element *old_rl); + +extern int ntfs_get_nr_significant_bytes(const s64 n); + +extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, + const runlist_element *rl); + +extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, + const s64 n); + +extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, + const int dst_len, const runlist_element *rl); + +extern int ntfs_rl_truncate(runlist **rl, const VCN start_vcn); + +#endif /* defined _NTFS_RUNLIST_H */ + From c01551305fbd19dbaa10b5a0cc4ac8cd041c7dd1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1018/2994] Rename: include/runlist.h -> include/ntfs/runlist.h }(Logical change 1.280) --- include/runlist.h | 79 ----------------------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 include/runlist.h diff --git a/include/runlist.h b/include/runlist.h deleted file mode 100644 index b22b46dc..00000000 --- a/include/runlist.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * runlist.h - Exports for runlist handling. Part of the Linux-NTFS project. - * - * Copyright (c) 2002 Anton Altaparmakov - * Copyright (c) 2002 Richard Russon - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_RUNLIST_H -#define _NTFS_RUNLIST_H - -#include "types.h" - -/* Forward declarations */ -typedef struct _runlist_element runlist_element; -typedef runlist_element runlist; - -#include "attrib.h" -#include "volume.h" - -/* - * runlist_element - in memory vcn to lcn mapping array element - * @vcn: starting vcn of the current array element - * @lcn: starting lcn of the current array element - * @length: length in clusters of the current array element - * - * The last vcn (in fact the last vcn + 1) is reached when length == 0. - * - * When lcn == -1 this means that the count vcns starting at vcn are not - * physically allocated (i.e. this is a hole / data is sparse). - */ -struct _runlist_element {/* In memory vcn to lcn mapping structure element. */ - VCN vcn; /* vcn = Starting virtual cluster number. */ - LCN lcn; /* lcn = Starting logical cluster number. */ - s64 length; /* Run length in clusters. */ -}; - -extern LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn); - -extern s64 ntfs_rl_pread(const ntfs_volume *vol, const runlist_element *rl, - const s64 pos, s64 count, void *b); -extern s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, - const s64 pos, s64 count, void *b); - -extern runlist_element *ntfs_runlists_merge(runlist_element *drl, - runlist_element *srl); - -extern runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, - const ATTR_RECORD *attr, runlist_element *old_rl); - -extern int ntfs_get_nr_significant_bytes(const s64 n); - -extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, - const runlist_element *rl); - -extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, - const s64 n); - -extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, - const int dst_len, const runlist_element *rl); - -extern int ntfs_rl_truncate(runlist **rl, const VCN start_vcn); - -#endif /* defined _NTFS_RUNLIST_H */ - From 8e46abe9bbf1f160c2359a07f950aa9ca4c75bcb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1019/2994] Rename: include/support.h -> include/ntfs/support.h (Logical change 1.280) --- include/ntfs/support.h | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/include/ntfs/support.h b/include/ntfs/support.h index e69de29b..3ddbb136 100644 --- a/include/ntfs/support.h +++ b/include/ntfs/support.h @@ -0,0 +1,69 @@ +/* + * support.h - Useful definitions and macros. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_SUPPORT_H +#define _NTFS_SUPPORT_H + +#include "config.h" + +#include + +/* + * Generic macro to convert pointers to values for comparison purposes. + */ +#ifndef p2n +#define p2n(p) ((ptrdiff_t)((ptrdiff_t*)(p))) +#endif + +/* + * The classical min and max macros. + */ +#ifndef min +#define min(a,b) ((a) <= (b) ? (a) : (b)) +#endif + +#ifndef max +#define max(a,b) ((a) >= (b) ? (a) : (b)) +#endif + +/* + * Simple bit operation macros. NOTE: These are NOT atomic. + */ +#define test_bit(bit, var) ((var) & (1 << (bit))) +#define set_bit(bit, var) (var) |= 1 << (bit) +#define clear_bit(bit, var) (var) &= ~(1 << (bit)) + +#define test_and_set_bit(bit, var) \ +({ \ + const BOOL old_state = test_bit(bit, var); \ + set_bit(bit, var); \ + old_state; \ +}) + +#define test_and_clear_bit(bit, var) \ +({ \ + const BOOL old_state = test_bit(bit, var); \ + clear_bit(bit, var); \ + old_state; \ +}) + +#endif /* defined _NTFS_SUPPORT_H */ + From 307edb606f89d91e74ee08826fa3d5dc6aec6ef9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1020/2994] Rename: include/support.h -> include/ntfs/support.h }(Logical change 1.280) --- include/support.h | 69 ----------------------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 include/support.h diff --git a/include/support.h b/include/support.h deleted file mode 100644 index 3ddbb136..00000000 --- a/include/support.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * support.h - Useful definitions and macros. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2004 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_SUPPORT_H -#define _NTFS_SUPPORT_H - -#include "config.h" - -#include - -/* - * Generic macro to convert pointers to values for comparison purposes. - */ -#ifndef p2n -#define p2n(p) ((ptrdiff_t)((ptrdiff_t*)(p))) -#endif - -/* - * The classical min and max macros. - */ -#ifndef min -#define min(a,b) ((a) <= (b) ? (a) : (b)) -#endif - -#ifndef max -#define max(a,b) ((a) >= (b) ? (a) : (b)) -#endif - -/* - * Simple bit operation macros. NOTE: These are NOT atomic. - */ -#define test_bit(bit, var) ((var) & (1 << (bit))) -#define set_bit(bit, var) (var) |= 1 << (bit) -#define clear_bit(bit, var) (var) &= ~(1 << (bit)) - -#define test_and_set_bit(bit, var) \ -({ \ - const BOOL old_state = test_bit(bit, var); \ - set_bit(bit, var); \ - old_state; \ -}) - -#define test_and_clear_bit(bit, var) \ -({ \ - const BOOL old_state = test_bit(bit, var); \ - clear_bit(bit, var); \ - old_state; \ -}) - -#endif /* defined _NTFS_SUPPORT_H */ - From 450e974e53a3577d9991c104229bbeb1d8d9419c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1021/2994] Rename: include/types.h -> include/ntfs/types.h (Logical change 1.280) --- include/ntfs/types.h | 71 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/include/ntfs/types.h b/include/ntfs/types.h index e69de29b..5f6ae2c9 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -0,0 +1,71 @@ +/* + * types.h - Misc type definitions not related to on-disk structure. Part of + * the Linux-NTFS project. + * + * Copyright (c) 2000-2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_TYPES_H +#define _NTFS_TYPES_H + +#include "config.h" + +#ifdef HAVE_STDINT_H +#include +#endif +#include + +typedef uint8_t u8; /* Unsigned types of an exact size */ +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; + +typedef int8_t s8; /* Signed types of an exact size */ +typedef int16_t s16; +typedef int32_t s32; +typedef int64_t s64; + +typedef u16 uchar_t; /* 2-byte Unicode character type. */ +#define UCHAR_T_SIZE_BITS 1 + +/* + * Clusters are signed 64-bit values on NTFS volumes. We define two types, LCN + * and VCN, to allow for type checking and better code readability. + */ +typedef s64 VCN; +typedef s64 LCN; + +/* + * These are just to make the code more readable... + */ +typedef enum { + FALSE = 0, + NO = 0, + ZERO = 0, + TRUE = 1, + YES = 1, + ONE = 1, +} BOOL; + +typedef enum { + CASE_SENSITIVE = 0, + IGNORE_CASE = 1, +} IGNORE_CASE_BOOL; + +#endif /* defined _NTFS_TYPES_H */ + From 9c545b1a67187df872a94cd49599ad5013301a11 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1022/2994] Rename: include/types.h -> include/ntfs/types.h }(Logical change 1.280) --- include/types.h | 71 ------------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 include/types.h diff --git a/include/types.h b/include/types.h deleted file mode 100644 index 5f6ae2c9..00000000 --- a/include/types.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * types.h - Misc type definitions not related to on-disk structure. Part of - * the Linux-NTFS project. - * - * Copyright (c) 2000-2003 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_TYPES_H -#define _NTFS_TYPES_H - -#include "config.h" - -#ifdef HAVE_STDINT_H -#include -#endif -#include - -typedef uint8_t u8; /* Unsigned types of an exact size */ -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef int8_t s8; /* Signed types of an exact size */ -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - -typedef u16 uchar_t; /* 2-byte Unicode character type. */ -#define UCHAR_T_SIZE_BITS 1 - -/* - * Clusters are signed 64-bit values on NTFS volumes. We define two types, LCN - * and VCN, to allow for type checking and better code readability. - */ -typedef s64 VCN; -typedef s64 LCN; - -/* - * These are just to make the code more readable... - */ -typedef enum { - FALSE = 0, - NO = 0, - ZERO = 0, - TRUE = 1, - YES = 1, - ONE = 1, -} BOOL; - -typedef enum { - CASE_SENSITIVE = 0, - IGNORE_CASE = 1, -} IGNORE_CASE_BOOL; - -#endif /* defined _NTFS_TYPES_H */ - From 2de41afeb09566b7d18281f79a95013e027bfc63 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1023/2994] Rename: include/unistr.h -> include/ntfs/unistr.h (Logical change 1.280) --- include/ntfs/unistr.h | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/include/ntfs/unistr.h b/include/ntfs/unistr.h index e69de29b..1917bfbd 100644 --- a/include/ntfs/unistr.h +++ b/include/ntfs/unistr.h @@ -0,0 +1,63 @@ +/* + * unistr.h - Exports for unicode string handling. Part of the Linux-NTFS + * project. + * + * Copyright (c) 2000-2002 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_UNISTR_H +#define _NTFS_UNISTR_H + +#include "types.h" +#include "layout.h" + +extern const u8 legal_ansi_char_array[0x40]; + +extern BOOL ntfs_names_are_equal(const uchar_t *s1, size_t s1_len, + const uchar_t *s2, size_t s2_len, const IGNORE_CASE_BOOL ic, + const uchar_t *upcase, const u32 upcase_size); + +extern int ntfs_names_collate(const uchar_t *name1, const u32 name1_len, + const uchar_t *name2, const u32 name2_len, + const int err_val, const IGNORE_CASE_BOOL ic, + const uchar_t *upcase, const u32 upcase_len); + +extern int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n); + +extern int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, + const uchar_t *upcase, const u32 upcase_size); + +extern u32 ntfs_ucsnlen(const uchar_t *s, u32 maxlen); + +extern void ntfs_name_upcase(uchar_t *name, u32 name_len, + const uchar_t *upcase, const u32 upcase_len); + +extern void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, + const uchar_t *upcase, const u32 upcase_len); + +extern int ntfs_file_values_compare(FILE_NAME_ATTR *file_name_attr1, + FILE_NAME_ATTR *file_name_attr2, + const int err_val, const IGNORE_CASE_BOOL ic, + const uchar_t *upcase, const u32 upcase_len); + +extern int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, + int outs_len); +extern int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len); + +#endif /* defined _NTFS_UNISTR_H */ + From 1cfb7cb780de2af42328d43715fab3827154526a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1024/2994] Rename: include/unistr.h -> include/ntfs/unistr.h }(Logical change 1.280) --- include/unistr.h | 63 ------------------------------------------------ 1 file changed, 63 deletions(-) delete mode 100644 include/unistr.h diff --git a/include/unistr.h b/include/unistr.h deleted file mode 100644 index 1917bfbd..00000000 --- a/include/unistr.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * unistr.h - Exports for unicode string handling. Part of the Linux-NTFS - * project. - * - * Copyright (c) 2000-2002 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_UNISTR_H -#define _NTFS_UNISTR_H - -#include "types.h" -#include "layout.h" - -extern const u8 legal_ansi_char_array[0x40]; - -extern BOOL ntfs_names_are_equal(const uchar_t *s1, size_t s1_len, - const uchar_t *s2, size_t s2_len, const IGNORE_CASE_BOOL ic, - const uchar_t *upcase, const u32 upcase_size); - -extern int ntfs_names_collate(const uchar_t *name1, const u32 name1_len, - const uchar_t *name2, const u32 name2_len, - const int err_val, const IGNORE_CASE_BOOL ic, - const uchar_t *upcase, const u32 upcase_len); - -extern int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n); - -extern int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, - const uchar_t *upcase, const u32 upcase_size); - -extern u32 ntfs_ucsnlen(const uchar_t *s, u32 maxlen); - -extern void ntfs_name_upcase(uchar_t *name, u32 name_len, - const uchar_t *upcase, const u32 upcase_len); - -extern void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, - const uchar_t *upcase, const u32 upcase_len); - -extern int ntfs_file_values_compare(FILE_NAME_ATTR *file_name_attr1, - FILE_NAME_ATTR *file_name_attr2, - const int err_val, const IGNORE_CASE_BOOL ic, - const uchar_t *upcase, const u32 upcase_len); - -extern int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, - int outs_len); -extern int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len); - -#endif /* defined _NTFS_UNISTR_H */ - From 96d9f30e1a15fc5d3708f117f204e896d3f446a1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1025/2994] Rename: include/volume.h -> include/ntfs/volume.h (Logical change 1.280) --- include/ntfs/volume.h | 187 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index e69de29b..911a6e52 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -0,0 +1,187 @@ +/* + * volume.h - Exports for NTFS volume handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2000-2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_VOLUME_H +#define _NTFS_VOLUME_H + +#include "config.h" + +#include +#ifdef HAVE_SYS_PARAM_H +# include +#endif +#ifdef HAVE_SYS_MOUNT_H +# include +#endif +#ifdef HAVE_MNTENT_H +# include +#endif + +/* Both under Cygwin and DJGPP we do not have MS_RDONLY, so we define it. */ +#if !defined(MS_RDONLY) +typedef enum { + MS_RDONLY = 1, +} MS_MOUNT; +#endif + +/* Forward declaration */ +typedef struct _ntfs_volume ntfs_volume; + +#include "types.h" +#include "support.h" +#include "inode.h" +#include "device.h" + +/* + * Flags returned by the ntfs_check_if_mounted() function. + */ +typedef enum { + NTFS_MF_MOUNTED = 1, /* Device is mounted. */ + NTFS_MF_ISROOT = 2, /* Device is mounted as system root. */ + NTFS_MF_READONLY = 4, /* Device is mounted read-only. */ +} ntfs_mount_flags; + +extern int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags); + +/* + * Defined bits for the state field in the ntfs_volume structure. + */ +typedef enum { + NV_ReadOnly, /* 1: Volume is read-only. */ + NV_CaseSensitive, /* 1: Volume is mounted case-sensitive. */ +} ntfs_volume_state_bits; + +#define test_nvol_flag(nv, flag) test_bit(NV_##flag, (nv)->state) +#define set_nvol_flag(nv, flag) set_bit(NV_##flag, (nv)->state) +#define clear_nvol_flag(nv, flag) clear_bit(NV_##flag, (nv)->state) + +#define NVolReadOnly(nv) test_nvol_flag(nv, ReadOnly) +#define NVolSetReadOnly(nv) set_nvol_flag(nv, ReadOnly) +#define NVolClearReadOnly(nv) clear_nvol_flag(nv, ReadOnly) + +#define NVolCaseSensitive(nv) test_nvol_flag(nv, CaseSensitive) +#define NVolSetCaseSensitive(nv) set_nvol_flag(nv, CaseSensitive) +#define NVolClearCaseSensitive(nv) clear_nvol_flag(nv, CaseSensitive) + +/* + * NTFS version 1.1 and 1.2 are used by Windows NT4. + * NTFS version 2.x is used by Windows 2000 Beta + * NTFS version 3.0 is used by Windows 2000. + * NTFS version 3.1 is used by Windows XP and Windows Server 2003. + */ + +#define NTFS_V1_1(major, minor) ((major) == 1 && (minor) == 1) +#define NTFS_V1_2(major, minor) ((major) == 1 && (minor) == 2) +#define NTFS_V2_X(major, minor) ((major) == 2) +#define NTFS_V3_0(major, minor) ((major) == 3 && (minor) == 0) +#define NTFS_V3_1(major, minor) ((major) == 3 && (minor) == 1) + +#define NTFS_BUF_SIZE 8192 + +/* + * ntfs_volume - structure describing an open volume in memory + */ +struct _ntfs_volume { + struct ntfs_device *dev;/* NTFS device associated with the volume. */ + char *vol_name; /* Name of the volume. */ + unsigned long state; /* NTFS specific flags describing this volume. + See ntfs_volume_state_bits above. */ + u8 major_ver; /* Ntfs major version of volume. */ + u8 minor_ver; /* Ntfs minor version of volume. */ + u16 flags; /* Bit array of VOLUME_* flags. */ + + u16 sector_size; /* Byte size of a sector. */ + u8 sector_size_bits; /* Log(2) of the byte size of a sector. */ + u32 cluster_size; /* Byte size of a cluster. */ + u32 mft_record_size; /* Byte size of a mft record. */ + u8 cluster_size_bits; /* Log(2) of the byte size of a cluster. */ + u8 mft_record_size_bits;/* Log(2) of the byte size of a mft record. */ + + /* Variables used by the cluster and mft allocators. */ + u8 mft_zone_multiplier; /* Initial mft zone multiplier. */ + s64 mft_data_pos; /* Mft record number at which to allocate the + next mft record. */ + LCN mft_zone_start; /* First cluster of the mft zone. */ + LCN mft_zone_end; /* First cluster beyond the mft zone. */ + LCN mft_zone_pos; /* Current position in the mft zone. */ + LCN data1_zone_pos; /* Current position in the first data zone. */ + LCN data2_zone_pos; /* Current position in the second data zone. */ + + s64 nr_clusters; /* Volume size in clusters, hence also the + number of bits in lcn_bitmap. */ + ntfs_inode *lcnbmp_ni; /* ntfs_inode structure for FILE_Bitmap. */ + ntfs_attr *lcnbmp_na; /* ntfs_attr structure for the data attribute + of FILE_Bitmap. Each bit represents a + cluster on the volume, bit 0 representing + lcn 0 and so on. A set bit means that the + cluster and vice versa. */ + + s64 nr_mft_records; /* Number of records in the mft, equals the + number of bits in mft_bitmap. */ + LCN mft_lcn; /* Logical cluster number of the data attribute + for FILE_MFT. */ + ntfs_inode *mft_ni; /* ntfs_inode structure for FILE_MFT. */ + ntfs_attr *mft_na; /* ntfs_attr structure for the data attribute + of FILE_MFT. */ + ntfs_attr *mftbmp_na; /* ntfs_attr structure for the bitmap attribute + of FILE_MFT. Each bit represents an mft + record in the $DATA attribute, bit 0 + representing mft record 0 and so on. A set + bit means that the mft record is in use and + vice versa. */ + + int mftmirr_size; /* Size of the FILE_MFTMirr in mft records. */ + LCN mftmirr_lcn; /* Logical cluster number of the data attribute + for FILE_MFTMirr. */ + ntfs_inode *mftmirr_ni; /* ntfs_inode structure for FILE_MFTMirr. */ + ntfs_attr *mftmirr_na; /* ntfs_attr structure for the data attribute + of FILE_MFTMirr. */ + + uchar_t *upcase; /* Upper case equivalents of all 65536 2-byte + Unicode characters. Obtained from + FILE_UpCase. */ + u32 upcase_len; /* Length in Unicode characters of the upcase + table. */ + + ATTR_DEF *attrdef; /* Attribute definitions. Obtained from + FILE_AttrDef. */ + s32 attrdef_len; /* Size of the attribute definition table in + bytes. */ +}; + +extern ntfs_volume *ntfs_volume_alloc(void); + +extern ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, + unsigned long rwflag); + +extern ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, + unsigned long rwflag); +extern int ntfs_device_umount(ntfs_volume *vol, const BOOL force); + +extern ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag); +extern int ntfs_umount(ntfs_volume *vol, const BOOL force); + +extern int ntfs_version_is_supported(ntfs_volume *vol); +extern int ntfs_logfile_reset(ntfs_volume *vol); +extern int ntfs_volume_set_flags(ntfs_volume *v, const u16 flags); + +#endif /* defined _NTFS_VOLUME_H */ + From 6a2d6277e9cb4697f7e4fd68befc7cce1aa294e2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1026/2994] Rename: include/volume.h -> include/ntfs/volume.h }(Logical change 1.280) --- include/volume.h | 187 ----------------------------------------------- 1 file changed, 187 deletions(-) delete mode 100644 include/volume.h diff --git a/include/volume.h b/include/volume.h deleted file mode 100644 index 911a6e52..00000000 --- a/include/volume.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * volume.h - Exports for NTFS volume handling. Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2003 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_VOLUME_H -#define _NTFS_VOLUME_H - -#include "config.h" - -#include -#ifdef HAVE_SYS_PARAM_H -# include -#endif -#ifdef HAVE_SYS_MOUNT_H -# include -#endif -#ifdef HAVE_MNTENT_H -# include -#endif - -/* Both under Cygwin and DJGPP we do not have MS_RDONLY, so we define it. */ -#if !defined(MS_RDONLY) -typedef enum { - MS_RDONLY = 1, -} MS_MOUNT; -#endif - -/* Forward declaration */ -typedef struct _ntfs_volume ntfs_volume; - -#include "types.h" -#include "support.h" -#include "inode.h" -#include "device.h" - -/* - * Flags returned by the ntfs_check_if_mounted() function. - */ -typedef enum { - NTFS_MF_MOUNTED = 1, /* Device is mounted. */ - NTFS_MF_ISROOT = 2, /* Device is mounted as system root. */ - NTFS_MF_READONLY = 4, /* Device is mounted read-only. */ -} ntfs_mount_flags; - -extern int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags); - -/* - * Defined bits for the state field in the ntfs_volume structure. - */ -typedef enum { - NV_ReadOnly, /* 1: Volume is read-only. */ - NV_CaseSensitive, /* 1: Volume is mounted case-sensitive. */ -} ntfs_volume_state_bits; - -#define test_nvol_flag(nv, flag) test_bit(NV_##flag, (nv)->state) -#define set_nvol_flag(nv, flag) set_bit(NV_##flag, (nv)->state) -#define clear_nvol_flag(nv, flag) clear_bit(NV_##flag, (nv)->state) - -#define NVolReadOnly(nv) test_nvol_flag(nv, ReadOnly) -#define NVolSetReadOnly(nv) set_nvol_flag(nv, ReadOnly) -#define NVolClearReadOnly(nv) clear_nvol_flag(nv, ReadOnly) - -#define NVolCaseSensitive(nv) test_nvol_flag(nv, CaseSensitive) -#define NVolSetCaseSensitive(nv) set_nvol_flag(nv, CaseSensitive) -#define NVolClearCaseSensitive(nv) clear_nvol_flag(nv, CaseSensitive) - -/* - * NTFS version 1.1 and 1.2 are used by Windows NT4. - * NTFS version 2.x is used by Windows 2000 Beta - * NTFS version 3.0 is used by Windows 2000. - * NTFS version 3.1 is used by Windows XP and Windows Server 2003. - */ - -#define NTFS_V1_1(major, minor) ((major) == 1 && (minor) == 1) -#define NTFS_V1_2(major, minor) ((major) == 1 && (minor) == 2) -#define NTFS_V2_X(major, minor) ((major) == 2) -#define NTFS_V3_0(major, minor) ((major) == 3 && (minor) == 0) -#define NTFS_V3_1(major, minor) ((major) == 3 && (minor) == 1) - -#define NTFS_BUF_SIZE 8192 - -/* - * ntfs_volume - structure describing an open volume in memory - */ -struct _ntfs_volume { - struct ntfs_device *dev;/* NTFS device associated with the volume. */ - char *vol_name; /* Name of the volume. */ - unsigned long state; /* NTFS specific flags describing this volume. - See ntfs_volume_state_bits above. */ - u8 major_ver; /* Ntfs major version of volume. */ - u8 minor_ver; /* Ntfs minor version of volume. */ - u16 flags; /* Bit array of VOLUME_* flags. */ - - u16 sector_size; /* Byte size of a sector. */ - u8 sector_size_bits; /* Log(2) of the byte size of a sector. */ - u32 cluster_size; /* Byte size of a cluster. */ - u32 mft_record_size; /* Byte size of a mft record. */ - u8 cluster_size_bits; /* Log(2) of the byte size of a cluster. */ - u8 mft_record_size_bits;/* Log(2) of the byte size of a mft record. */ - - /* Variables used by the cluster and mft allocators. */ - u8 mft_zone_multiplier; /* Initial mft zone multiplier. */ - s64 mft_data_pos; /* Mft record number at which to allocate the - next mft record. */ - LCN mft_zone_start; /* First cluster of the mft zone. */ - LCN mft_zone_end; /* First cluster beyond the mft zone. */ - LCN mft_zone_pos; /* Current position in the mft zone. */ - LCN data1_zone_pos; /* Current position in the first data zone. */ - LCN data2_zone_pos; /* Current position in the second data zone. */ - - s64 nr_clusters; /* Volume size in clusters, hence also the - number of bits in lcn_bitmap. */ - ntfs_inode *lcnbmp_ni; /* ntfs_inode structure for FILE_Bitmap. */ - ntfs_attr *lcnbmp_na; /* ntfs_attr structure for the data attribute - of FILE_Bitmap. Each bit represents a - cluster on the volume, bit 0 representing - lcn 0 and so on. A set bit means that the - cluster and vice versa. */ - - s64 nr_mft_records; /* Number of records in the mft, equals the - number of bits in mft_bitmap. */ - LCN mft_lcn; /* Logical cluster number of the data attribute - for FILE_MFT. */ - ntfs_inode *mft_ni; /* ntfs_inode structure for FILE_MFT. */ - ntfs_attr *mft_na; /* ntfs_attr structure for the data attribute - of FILE_MFT. */ - ntfs_attr *mftbmp_na; /* ntfs_attr structure for the bitmap attribute - of FILE_MFT. Each bit represents an mft - record in the $DATA attribute, bit 0 - representing mft record 0 and so on. A set - bit means that the mft record is in use and - vice versa. */ - - int mftmirr_size; /* Size of the FILE_MFTMirr in mft records. */ - LCN mftmirr_lcn; /* Logical cluster number of the data attribute - for FILE_MFTMirr. */ - ntfs_inode *mftmirr_ni; /* ntfs_inode structure for FILE_MFTMirr. */ - ntfs_attr *mftmirr_na; /* ntfs_attr structure for the data attribute - of FILE_MFTMirr. */ - - uchar_t *upcase; /* Upper case equivalents of all 65536 2-byte - Unicode characters. Obtained from - FILE_UpCase. */ - u32 upcase_len; /* Length in Unicode characters of the upcase - table. */ - - ATTR_DEF *attrdef; /* Attribute definitions. Obtained from - FILE_AttrDef. */ - s32 attrdef_len; /* Size of the attribute definition table in - bytes. */ -}; - -extern ntfs_volume *ntfs_volume_alloc(void); - -extern ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, - unsigned long rwflag); - -extern ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, - unsigned long rwflag); -extern int ntfs_device_umount(ntfs_volume *vol, const BOOL force); - -extern ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag); -extern int ntfs_umount(ntfs_volume *vol, const BOOL force); - -extern int ntfs_version_is_supported(ntfs_volume *vol); -extern int ntfs_logfile_reset(ntfs_volume *vol); -extern int ntfs_volume_set_flags(ntfs_volume *v, const u16 flags); - -#endif /* defined _NTFS_VOLUME_H */ - From 2e94e0d4cac24cf5614a4a60ed3c2336ba5b54d4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1027/2994] Update (Logical change 1.280) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index b6ce5dd8..709e290a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,8 @@ xx/xx/2004 - 1.8.5 - WIP config.h before any other non-ntfs header files. - Update all source to include config.h before any other non-ntfs header files. + - Move include files from ntfsprogs/include to ntfsprogs/include/ntfs + and adapt build system. (Requested by Christophe Grenier.) 23/01/2004 - 1.8.4 - Memory leak fixes. - Fix memory leaks in libntfs/dir.c::ntfs_inode_lookup_by_name(), From 1f2547829c8daadc71dc3c362e3f16f84fb8e836 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1028/2994] Update for move of include files. (Logical change 1.280) --- configure | 3 ++- configure.ac | 1 + libntfs/Makefile.am | 2 +- libntfs/Makefile.in | 2 +- ntfsprogs/Makefile.am | 4 ++-- ntfsprogs/Makefile.in | 4 ++-- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 9b40db5e..96ccc398 100755 --- a/configure +++ b/configure @@ -21487,7 +21487,7 @@ done # Makefiles to be created by configure. - ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile libntfs/Makefile libntfs/libntfs.conf libntfs/libntfs-gnomevfs.8 ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" + ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile include/ntfs/Makefile libntfs/Makefile libntfs/libntfs.conf libntfs/libntfs-gnomevfs.8 ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -22068,6 +22068,7 @@ do "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "include/ntfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/ntfs/Makefile" ;; "libntfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libntfs/Makefile" ;; "libntfs/libntfs.conf" ) CONFIG_FILES="$CONFIG_FILES libntfs/libntfs.conf" ;; "libntfs/libntfs-gnomevfs.8" ) CONFIG_FILES="$CONFIG_FILES libntfs/libntfs-gnomevfs.8" ;; diff --git a/configure.ac b/configure.ac index 54d2a6ca..0e8b63e3 100644 --- a/configure.ac +++ b/configure.ac @@ -202,6 +202,7 @@ AC_CONFIG_FILES([ Makefile doc/Makefile include/Makefile + include/ntfs/Makefile libntfs/Makefile libntfs/libntfs.conf libntfs/libntfs-gnomevfs.8 diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 93c434d0..fa90081c 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -29,7 +29,7 @@ LTVERSION_LIBNTFS = 5:0:0 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 -linux_ntfsincludedir = -I$(top_srcdir)/include +linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs lib_LTLIBRARIES = libntfs.la libntfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS) diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index a5aaa9c8..8c56a637 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -177,7 +177,7 @@ target_vendor = @target_vendor@ LTVERSION_LIBNTFS = 5:0:0 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 -linux_ntfsincludedir = -I$(top_srcdir)/include +linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs lib_LTLIBRARIES = libntfs.la libntfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index e9c6cea5..dbebdd39 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -22,10 +22,10 @@ EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) -linux_ntfsincludedir = -I$(top_srcdir)/include +linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs # Set the include path. -INCLUDES = -I$(top_srcdir)/include $(all_includes) +INCLUDES = -I$(top_srcdir)/include/ntfs $(all_includes) ntfsfix_SOURCES = ntfsfix.c ntfsfix_LDADD = $(AM_LIBS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index c8f05bf1..a0f7e0d5 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -168,10 +168,10 @@ EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) -linux_ntfsincludedir = -I$(top_srcdir)/include +linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs # Set the include path. -INCLUDES = -I$(top_srcdir)/include $(all_includes) +INCLUDES = -I$(top_srcdir)/include/ntfs $(all_includes) ntfsfix_SOURCES = ntfsfix.c ntfsfix_LDADD = $(AM_LIBS) From 83a577b1e5abcba635e4ac94b023bee81d4e86db Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 14:21:14 +0000 Subject: [PATCH 1029/2994] Update for move of include files. 2004/02/25 13:57:19+00:00 cantab.net!aia21 Rename: include/Makefile.in -> include/ntfs/Makefile.in (Logical change 1.280) --- include/ntfs/Makefile.in | 397 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 397 insertions(+) diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index e69de29b..514ffa37 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -0,0 +1,397 @@ +# Makefile.in generated by automake 1.7.6 from Makefile.am. +# @configure_input@ + +# 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. + +# 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. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +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@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTODIRS = @AUTODIRS@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ +ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ +LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +REALLYSTATIC_FALSE = @REALLYSTATIC_FALSE@ +REALLYSTATIC_TRUE = @REALLYSTATIC_TRUE@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +all_includes = @all_includes@ +all_libraries = @all_libraries@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_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@ +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 = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ + +linux_ntfsincludedir = $(includedir)/ntfs +linux_ntfsinclude_HEADERS = \ + attrib.h \ + bitmap.h \ + bootsect.h \ + compat.h \ + compress.h \ + debug.h \ + device.h \ + device_io.h \ + dir.h \ + endians.h \ + gnome-vfs-method.h \ + gnome-vfs-module.h \ + inode.h \ + layout.h \ + lcnalloc.h \ + list.h \ + logfile.h \ + mft.h \ + mst.h \ + runlist.h \ + support.h \ + types.h \ + unistr.h \ + volume.h + +subdir = include/ntfs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +HEADERS = $(linux_ntfsinclude_HEADERS) + +DIST_COMMON = $(linux_ntfsinclude_HEADERS) Makefile.am Makefile.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu include/ntfs/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: +linux_ntfsincludeHEADERS_INSTALL = $(INSTALL_HEADER) +install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(linux_ntfsincludedir) + @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(linux_ntfsincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ + $(linux_ntfsincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(linux_ntfsincludedir)/$$f; \ + done + +uninstall-linux_ntfsincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ + rm -f $(DESTDIR)$(linux_ntfsincludedir)/$$f; \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @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 \ + 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 \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(linux_ntfsincludedir) +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-linux_ntfsincludeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +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-linux_ntfsincludeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags 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-linux_ntfsincludeHEADERS install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am \ + uninstall-linux_ntfsincludeHEADERS + +# 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: From 536b80cb569d8ac1819220e1f1eba5d2d7920ca9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 17:14:40 +0000 Subject: [PATCH 1030/2994] Fix bug in stoucs(). Thanks to Andras Erdei. (Logical change 1.281) --- ntfsprogs/mkntfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 2e05ef24..94463a62 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -567,8 +567,10 @@ int stoucs(uchar_t *dest, const char *src, int maxlen) char c; int i; - /* Need two bytes for null terminator. */ - maxlen -= 2; + /* Convert maxlen from bytes to unicode characters. */ + maxlen /= sizeof(uchar_t); + /* Need space for null terminator. */ + maxlen--; for (i = 0; i < maxlen; i++) { c = src[i]; if (!c) From d9c6c0bb707a5de7ac6d51d2e2dd3277f23be38f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 25 Feb 2004 17:14:40 +0000 Subject: [PATCH 1031/2994] Fix bug in stoucs(). Thanks to Andras Erdei. BKrev: 403cd800pyF0NHzgs0Lnz9Vp_dN7FA From eb3974ae349ee1490a4d52b12f7651e9a7145058 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 09:18:49 +0000 Subject: [PATCH 1032/2994] Add Andras Erdei (Logical change 1.282) --- CREDITS | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS b/CREDITS index 5981df5d..a4cd9127 100644 --- a/CREDITS +++ b/CREDITS @@ -10,6 +10,7 @@ someone is missing or if you prefer to not be listed. Anton Altaparmakov Albert D. Cahalan Russ Christensen +Andras Erdei Matthew J. Fanto Christophe Grenier Ian Jackson From 4c3e523e8ad8898733e55dd7a3d5def60066b1b5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 09:18:49 +0000 Subject: [PATCH 1033/2994] Add Andras Erdei to CREDITS and update ChangeLog with mkntfs fix. BKrev: 403db9f9OWitdTv1Znwg3Y-1S7vFGw From ca8aa8a4fc0cbdb0c586838d707c613124e9076c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 09:18:49 +0000 Subject: [PATCH 1034/2994] Update (Logical change 1.282) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 709e290a..7b1934a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ xx/xx/2004 - 1.8.5 - WIP header files. - Move include files from ntfsprogs/include to ntfsprogs/include/ntfs and adapt build system. (Requested by Christophe Grenier.) + - Fix bug in ntfsprogs/mkntfs.c::stoucs(). Thanks to Andras Erdei. 23/01/2004 - 1.8.4 - Memory leak fixes. - Fix memory leaks in libntfs/dir.c::ntfs_inode_lookup_by_name(), From f0fd6cce620d8be2345d800cb495d8d97fd9b1dc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 11:41:48 +0000 Subject: [PATCH 1035/2994] - Small cleanup of ./configure.ac to show better formatted option help text and other little bits. - Add --disable-default-device-io-ops option to ./configure which makes for a smaller libntfs but results in ntfs_mount() always returning error with errno set to ENOTSUP. You need to use ntfs_device_mount() instead. This only makes sense with "make libs" and when an application linking statically against libntfs provides its own device io operations. (Feature requested by Christophe Grenier.) (Logical change 1.283) --- configure.ac | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 0e8b63e3..a1113165 100644 --- a/configure.ac +++ b/configure.ac @@ -49,15 +49,38 @@ fi # Command-line options. AC_ARG_ENABLE(debug, - [ --enable-debug enable debugging], , + AC_HELP_STRING([--enable-debug],[enable additional debugging code and + output]), , enable_debug=no ) -AC_ARG_ENABLE(really-static, - [ --enable-really-static completely static binaries], , - enable_really_static=no +# AH_TEMPLATE is needed here because we want to have a template in config.h +# regardless of whether the option is given or not. +AH_TEMPLATE([NO_NTFS_DEVICE_DEFAULT_IO_OPS], + [Define this if you do not want the NTFS library to provide default + device io operations. This means that you cannot use ntfs_mount() + but have to use ntfs_device_mount() and provide your own device + operations.]) +AC_ARG_ENABLE(default-device-io-ops, + AC_HELP_STRING([--disable-default-device-io-ops], + [do not provide default device io operations]), + if test "$enable_default_device_io_ops" == "no"; then + AC_DEFINE(NO_NTFS_DEVICE_DEFAULT_IO_OPS) + fi, ) +AC_ARG_ENABLE(gnome-vfs, + AC_HELP_STRING([--disable-gnome-vfs], + [omit Gnome-VFS-2.0 'libntfs' interface + (default=detect)]), , + enable_gnome_vfs=auto +) + +AC_ARG_ENABLE(really-static, + AC_HELP_STRING([--enable-really-static],[create completely static + binaries for the utilities]), , + enable_really_static=no +) AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes) # Enable GNU extensions on systems that have them. @@ -78,10 +101,7 @@ AC_PROG_LIBTOOL # Enable large file support. AC_SYS_LARGEFILE -AC_ARG_ENABLE(gnome-vfs, - [ --disable-gnome-vfs Omit Gnome-VFS-2.0 'libntfs' interface (default=detect)], , - enable_gnome_vfs=auto -) +# Autodetect whether to build Gnome VFS or not. compile_gnome_vfs=false if test "$enable_gnome_vfs" != "no"; then # Make compilation work on SuSE 9.0. @@ -92,9 +112,9 @@ if test "$enable_gnome_vfs" != "no"; then [ compile_gnome_vfs=true ], [ if test "$enable_gnome_vfs" = "yes"; then - AC_MSG_ERROR([Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares.]) + AC_MSG_ERROR([Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries.]) else - AC_MSG_WARN([Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares.]) + AC_MSG_WARN([Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries.]) fi ]) fi From e48ba0d47f7413d6815f7747df9a4d61fbe0ac73 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 11:41:48 +0000 Subject: [PATCH 1036/2994] - Small cleanup of ./configure.ac to show better formatted option help text and other little bits. - Add --disable-default-device-io-ops option to ./configure which makes for a smaller libntfs but results in ntfs_mount() always returning error with errno set to ENOTSUP. You need to use ntfs_device_mount() instead. This only makes sense with "make libs" and when an application linking statically against libntfs provides its own device io operations. (Feature requested by Christophe Grenier.) BKrev: 403ddb7cbi9vmQs-n7i-pGYWYNnXVQ From 4b12f1bfcea08b1bc05bb79fa7a6d33b74274dde Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 11:41:48 +0000 Subject: [PATCH 1037/2994] Add NO_NTFS_DEVICE_DEFAULT_IO_OPS. (Logical change 1.283) --- include/ntfs/device_io.h | 4 ++++ libntfs/device_io.c | 38 ++++++++++++++++++++++++++++++++++++++ libntfs/volume.c | 10 ++++++++++ 3 files changed, 52 insertions(+) diff --git a/include/ntfs/device_io.h b/include/ntfs/device_io.h index 03e03849..7213631e 100644 --- a/include/ntfs/device_io.h +++ b/include/ntfs/device_io.h @@ -24,6 +24,8 @@ #include "config.h" +#ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS + #ifndef __CYGWIN32__ /* Not on Cygwin; use standard Unix style low level device operations. */ @@ -42,5 +44,7 @@ struct ntfs_device_operations; extern struct ntfs_device_operations ntfs_device_default_io_ops; +#endif /* NO_NTFS_DEVICE_DEFAULT_IO_OPS */ + #endif /* defined _NTFS_DEVICE_IO_H */ diff --git a/libntfs/device_io.c b/libntfs/device_io.c index e69de29b..9a044d61 100644 --- a/libntfs/device_io.c +++ b/libntfs/device_io.c @@ -0,0 +1,38 @@ +/* + * device_io.c - Default device io operations. Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS + +#ifndef __CYGWIN32__ + +/* Not on Cygwin; use standard Unix style low level device operations. */ +#include "unix_io.c" + +#else /* __CYGWIN32__ */ + +/* On Cygwin; use Win32 low level device operations. */ +#include "win32_io.c" + +#endif /* __CYGWIN32__ */ + +#endif /* NO_NTFS_DEVICE_DEFAULT_IO_OPS */ diff --git a/libntfs/volume.c b/libntfs/volume.c index afeb5802..69df2493 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -945,10 +945,20 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) { struct ntfs_device *dev; +#ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS /* Allocate an ntfs_device structure. */ dev = ntfs_device_alloc(name, 0, &ntfs_device_default_io_ops, NULL); if (!dev) return NULL; +#else + /* + * ntfs_mount() makes no sense if NO_NTFS_DEVICE_DEFAULT_IO_OPS is + * defined as there are no device operations available in libntfs in + * this case. + */ + errno = ENOTSUP; + return NULL; +#endif /* Call ntfs_device_mount() to do the actual mount. */ return ntfs_device_mount(dev, rwflag); } From 6cecd0e726f3f6b2b067c1850df2dbaa9cbcbb65 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 11:41:48 +0000 Subject: [PATCH 1038/2994] Detect NO_NTFS_DEVICE_DEFAULT_IO_OPS and #error appropriately. (Logical change 1.283) --- ntfsprogs/mkntfs.c | 6 ++++++ ntfsprogs/ntfsfix.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 94463a62..82e837e8 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -125,6 +125,12 @@ #include "runlist.h" #include "utils.h" +#ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS +# error "No default device io operations! Cannot build mkntfs. \ +You need to run ./configure without the --disable-default-device-io-ops \ +switch if you want to be able to build the NTFS utilities." +#endif + extern const unsigned char attrdef_ntfs12_array[2400]; extern const unsigned char boot_array[3429]; extern void init_system_file_sd(int sys_file_no, char **sd_val, diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index bf47e721..66550a01 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -58,6 +58,12 @@ #include "device.h" #include "logfile.h" +#ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS +# error "No default device io operations! Cannot build ntfsfix. \ +You need to run ./configure without the --disable-default-device-io-ops \ +switch if you want to be able to build the NTFS utilities." +#endif + /** * main */ From f0ad8c7ed0c026c4b6116770ea1b2d6c941bbe2c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 11:41:48 +0000 Subject: [PATCH 1039/2994] Update (Logical change 1.283) --- config.h.in | 5 ++ configure | 107 +++++++++++++++++++++++++----------------- ntfsprogs/Makefile.in | 4 +- 3 files changed, 70 insertions(+), 46 deletions(-) diff --git a/config.h.in b/config.h.in index 637a2f6f..00c24ccc 100644 --- a/config.h.in +++ b/config.h.in @@ -201,6 +201,11 @@ slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK +/* Define this if you do not want the NTFS library to provide default device + io operations. This means that you cannot use ntfs_mount() but have to use + ntfs_device_mount() and provide your own device operations. */ +#undef NO_NTFS_DEVICE_DEFAULT_IO_OPS + /* Name of package */ #undef PACKAGE diff --git a/configure b/configure index 96ccc398..4d1f4401 100755 --- a/configure +++ b/configure @@ -1034,15 +1034,18 @@ Optional Features: build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] - --enable-debug enable debugging - --enable-really-static completely static binaries + --enable-debug enable additional debugging code and output + --disable-default-device-io-ops + do not provide default device io operations + --disable-gnome-vfs omit Gnome-VFS-2.0 'libntfs' interface + (default=detect) + --enable-really-static create completely static binaries for the utilities --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors --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 - --disable-gnome-vfs Omit Gnome-VFS-2.0 'libntfs' interface (default=detect) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -2067,6 +2070,30 @@ else fi; +# AH_TEMPLATE is needed here because we want to have a template in config.h +# regardless of whether the option is given or not. + + +# Check whether --enable-default-device-io-ops or --disable-default-device-io-ops was given. +if test "${enable_default_device_io_ops+set}" = set; then + enableval="$enable_default_device_io_ops" + if test "$enable_default_device_io_ops" == "no"; then + cat >>confdefs.h <<\_ACEOF +#define NO_NTFS_DEVICE_DEFAULT_IO_OPS 1 +_ACEOF + + fi +fi; + +# Check whether --enable-gnome-vfs or --disable-gnome-vfs was given. +if test "${enable_gnome_vfs+set}" = set; then + enableval="$enable_gnome_vfs" + +else + enable_gnome_vfs=auto + +fi; + # Check whether --enable-really-static or --disable-really-static was given. if test "${enable_really_static+set}" = set; then enableval="$enable_really_static" @@ -2077,7 +2104,6 @@ else fi; - if test "$enable_really_static" = yes; then REALLYSTATIC_TRUE= REALLYSTATIC_FALSE='#' @@ -3760,7 +3786,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3763 "configure"' > conftest.$ac_ext + echo '#line 3789 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5257,7 +5283,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5260:" \ +echo "$as_me:5286:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6262,11 +6288,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6265: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6291: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6269: \$? = $ac_status" >&5 + echo "$as_me:6295: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6494,11 +6520,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6497: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6523: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6501: \$? = $ac_status" >&5 + echo "$as_me:6527: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6561,11 +6587,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6564: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6590: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6568: \$? = $ac_status" >&5 + echo "$as_me:6594: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8580,7 +8606,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10839: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10817: \$? = $ac_status" >&5 + echo "$as_me:10843: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10877,11 +10903,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10880: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10906: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10884: \$? = $ac_status" >&5 + echo "$as_me:10910: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12127,7 +12153,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13076: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13054: \$? = $ac_status" >&5 + echo "$as_me:13080: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13114,11 +13140,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13117: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13143: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13121: \$? = $ac_status" >&5 + echo "$as_me:13147: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15061,11 +15087,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15064: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15090: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15068: \$? = $ac_status" >&5 + echo "$as_me:15094: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15293,11 +15319,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15296: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15322: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15300: \$? = $ac_status" >&5 + echo "$as_me:15326: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15360,11 +15386,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15363: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15389: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15367: \$? = $ac_status" >&5 + echo "$as_me:15393: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17379,7 +17405,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 else if test "$enable_gnome_vfs" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&5 -echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&2;} + { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} { (exit 1); exit 1; }; } else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&5 -echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 librares." >&2;} + { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi fi diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index a0f7e0d5..3e283e46 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From 3949cb41a698727a1d32004a7bcac46514e07aa7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 11:41:48 +0000 Subject: [PATCH 1040/2994] Update. (Logical change 1.283) --- ChangeLog | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b1934a7..74184e97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,8 +12,17 @@ xx/xx/2004 - 1.8.5 - WIP - Update all source to include config.h before any other non-ntfs header files. - Move include files from ntfsprogs/include to ntfsprogs/include/ntfs - and adapt build system. (Requested by Christophe Grenier.) - - Fix bug in ntfsprogs/mkntfs.c::stoucs(). Thanks to Andras Erdei. + and adapt build system. (Feature requested by Christophe Grenier.) + - Fix potential buffer overflow bug in ntfsprogs/mkntfs.c::stoucs(). + Thanks to Andras Erdei. + - Small cleanup of ./configure.ac to show better formatted option help + text and other little bits. + - Add --disable-default-device-io-ops option to ./configure which makes + for a smaller libntfs but results in ntfs_mount() always returning + error with errno set to ENOTSUP. You need to use ntfs_device_mount() + instead. This only makes sense with "make libs" and when an + application linking statically against libntfs provides its own + device io operations. (Feature requested by Christophe Grenier.) 23/01/2004 - 1.8.4 - Memory leak fixes. - Fix memory leaks in libntfs/dir.c::ntfs_inode_lookup_by_name(), From 42e3faba21cca76127a987d65e1c195b4b054a17 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 12:08:23 +0000 Subject: [PATCH 1041/2994] Fix the fix. (-: (Logical change 1.284) --- ntfsprogs/mkntfs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 82e837e8..7205821b 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -567,12 +567,20 @@ int ucstos(char *dest, const uchar_t *src, int maxlen) * * Return the number of characters written to @dest, not including the * terminating null unicode character. + * + * If @maxlen is less than the size of a single unicode character we cannot + * write the terminating null unicode character and hence return -1 with errno + * set to EINVAL. */ int stoucs(uchar_t *dest, const char *src, int maxlen) { char c; int i; + if (maxlen < sizeof(uchar_t)) { + errno = EINVAL; + return -1; + } /* Convert maxlen from bytes to unicode characters. */ maxlen /= sizeof(uchar_t); /* Need space for null terminator. */ From a16c548e713551c957daa0f1396c1367f9578db7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 12:08:23 +0000 Subject: [PATCH 1042/2994] Fix the fix. (-: BKrev: 403de1b7iPcmIN33bXzNithwVtCgAA From 6eb9812220fbeb96e31b751b78728c6af358e541 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 13:48:16 +0000 Subject: [PATCH 1043/2994] - Fix a duplicated free() in mkntfs. (Andras Erdei) - Fix option display in mkntfs. (Andras Erdei) (Logical change 1.285) --- ChangeLog | 2 ++ ntfsprogs/mkntfs.c | 22 +++++++--------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74184e97..a3e178b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,8 @@ xx/xx/2004 - 1.8.5 - WIP instead. This only makes sense with "make libs" and when an application linking statically against libntfs provides its own device io operations. (Feature requested by Christophe Grenier.) + - Fix a duplicated free() in mkntfs. (Andras Erdei) + - Fix option display in mkntfs. (Andras Erdei) 23/01/2004 - 1.8.4 - Memory leak fixes. - Fix memory leaks in libntfs/dir.c::ntfs_inode_lookup_by_name(), diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 7205821b..76b42ac6 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -408,8 +408,6 @@ void append_to_bad_blocks(unsigned long block) if (!new_buf) err_exit("Reallocating memory for bad blocks list " "failed: %s\n", strerror(errno)); - if (opts.bad_blocks != new_buf) - free(opts.bad_blocks); opts.bad_blocks = new_buf; } opts.bad_blocks[opts.nr_bad_blocks++] = block; @@ -656,50 +654,44 @@ void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) } j = 0; if (i & VOLUME_MODIFIED_BY_CHKDSK) { - j = 1; printf("VOLUME_MODIFIED_BY_CHKDSK"); + j = 1; } if (i & VOLUME_REPAIR_OBJECT_ID) { if (j) printf(" | "); - else - j = 0; printf("VOLUME_REPAIR_OBJECT_ID"); + j = 1; } if (i & VOLUME_DELETE_USN_UNDERWAY) { if (j) printf(" | "); - else - j = 0; printf("VOLUME_DELETE_USN_UNDERWAY"); + j = 1; } if (i & VOLUME_MOUNTED_ON_NT4) { if (j) printf(" | "); - else - j = 0; printf("VOLUME_MOUNTED_ON_NT4"); + j = 1; } if (i & VOLUME_UPGRADE_ON_MOUNT) { if (j) printf(" | "); - else - j = 0; printf("VOLUME_UPGRADE_ON_MOUNT"); + j = 1; } if (i & VOLUME_RESIZE_LOG_FILE) { if (j) printf(" | "); - else - j = 0; printf("VOLUME_RESIZE_LOG_FILE"); + j = 1; } if (i & VOLUME_IS_DIRTY) { if (j) printf(" | "); - else - j = 0; printf("VOLUME_IS_DIRTY"); + j = 1; } printf("\n"); return; From dfa5c497f753cc285b528ace6bdd1548a11d9e53 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 13:48:16 +0000 Subject: [PATCH 1044/2994] - Fix a duplicated free() in mkntfs. (Andras Erdei) - Fix option display in mkntfs. (Andras Erdei) BKrev: 403df9200bFP9MajDeL2uvp59lrN2Q From 1002bad82c4f5e419f4efca6c7e966a461315aa3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 15:01:19 +0000 Subject: [PATCH 1045/2994] Fix typo in Andra's email address. (Logical change 1.286) --- CREDITS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CREDITS b/CREDITS index a4cd9127..83e566cc 100644 --- a/CREDITS +++ b/CREDITS @@ -10,7 +10,7 @@ someone is missing or if you prefer to not be listed. Anton Altaparmakov Albert D. Cahalan Russ Christensen -Andras Erdei +Andras Erdei Matthew J. Fanto Christophe Grenier Ian Jackson From f5090dc76350ab99de17c8fa23e1c59deb1a9658 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 26 Feb 2004 15:01:19 +0000 Subject: [PATCH 1046/2994] Fix typo in Andra's email address. BKrev: 403e0a3fQB-9CgbOXwJCCW7SZqwdfw From 25766b3757f389b9cc6eb6251edbf8a07c24ee2d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Feb 2004 16:44:10 +0000 Subject: [PATCH 1047/2994] - Update for 1.8.5 relelase. - Adapt BLKGETSIZE64 definition to the one found in 2.6 kernels. - Remove compiler warning by rearranging code a bit in ntfs_mount(). BKrev: 403f73daa9iktClfg6W-4WlIYJmjhA From 7239c1f42beffb6b279de06c41d154c53564ab9d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Feb 2004 16:44:10 +0000 Subject: [PATCH 1048/2994] Adapt BLKGETSIZE64 definition to the one found in 2.6 kernels. (Logical change 1.287) --- libntfs/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/device.c b/libntfs/device.c index 229e8bbb..f66b5e42 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -43,7 +43,7 @@ #define BLKGETSIZE _IO(0x12,96) /* Get device size in 512-byte blocks. */ #endif #if defined(linux) && defined(_IOR) && !defined(BLKGETSIZE64) -#define BLKGETSIZE64 _IOR(0x12,114,sizeof(u64)) /* Get device size in bytes. */ +#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* Get device size in bytes. */ #endif /** From 3f12891c07f8403cee12726744c327f4eedfab41 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Feb 2004 16:44:10 +0000 Subject: [PATCH 1049/2994] Remove compiler warning by rearranging code a bit in ntfs_mount(). (Logical change 1.287) --- libntfs/volume.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index 69df2493..eccf56d3 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -941,15 +941,18 @@ error_exit: * Note, that a copy is made of @name, and hence it can be discarded as * soon as the function returns. */ -ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) +ntfs_volume *ntfs_mount(const char *name __attribute__((unused)), + unsigned long rwflag __attribute__((unused))) { +#ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS struct ntfs_device *dev; -#ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS /* Allocate an ntfs_device structure. */ dev = ntfs_device_alloc(name, 0, &ntfs_device_default_io_ops, NULL); if (!dev) return NULL; + /* Call ntfs_device_mount() to do the actual mount. */ + return ntfs_device_mount(dev, rwflag); #else /* * ntfs_mount() makes no sense if NO_NTFS_DEVICE_DEFAULT_IO_OPS is @@ -959,8 +962,6 @@ ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag) errno = ENOTSUP; return NULL; #endif - /* Call ntfs_device_mount() to do the actual mount. */ - return ntfs_device_mount(dev, rwflag); } /** From acbe4ec1e789783b983f34d669e74c43efe259d8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Feb 2004 16:44:10 +0000 Subject: [PATCH 1050/2994] Update (Logical change 1.287) --- configure | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 4d1f4401..33713c64 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.5-WIP. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.5. # # Report bugs to . # @@ -422,8 +422,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.5-WIP' -PACKAGE_STRING='ntfsprogs 1.8.5-WIP' +PACKAGE_VERSION='1.8.5' +PACKAGE_STRING='ntfsprogs 1.8.5' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -954,7 +954,7 @@ 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 ntfsprogs 1.8.5-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1021,7 +1021,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.5-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.5:";; esac cat <<\_ACEOF @@ -1136,7 +1136,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.5-WIP +ntfsprogs configure 1.8.5 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1151,7 +1151,7 @@ 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 ntfsprogs $as_me 1.8.5-WIP, which was +It was created by ntfsprogs $as_me 1.8.5, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1845,7 +1845,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.8.5-WIP' + VERSION='1.8.5' cat >>confdefs.h <<_ACEOF @@ -21910,7 +21910,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.5-WIP, which was +This file was extended by ntfsprogs $as_me 1.8.5, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21973,7 +21973,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.5-WIP +ntfsprogs config.status 1.8.5 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" From a619085383413ae0f6fb86a93a1f9f594bedeff4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Feb 2004 16:44:10 +0000 Subject: [PATCH 1051/2994] Update for 1.8.5 release. (Logical change 1.287) --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a1113165..36dda4b6 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.5-WIP, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.5, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) From 9c38c54864f6852906e5b8f7f78c1c407ac375e4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Feb 2004 16:44:10 +0000 Subject: [PATCH 1052/2994] Update for 1.8.5 relelase. (Logical change 1.287) --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a3e178b0..f134b01a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/2004 - 1.8.5 - WIP +27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to reflect reality a little better. - Fix BLKGETSIZE usage; parameter is unsigned long not long. (Szaka) From 40261dcd62ee200cdabb194d9a35e4f8e9c84fe5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 27 Feb 2004 16:44:10 +0000 Subject: [PATCH 1053/2994] Update. (Logical change 1.287) --- ntfsprogs/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 3e283e46..a0f7e0d5 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_TRUE@AM_LFLAGS = -static @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From f64410dbb791e5380b326077d877494140ecb2da Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Feb 2004 14:09:45 +0000 Subject: [PATCH 1054/2994] Guard config.h inclusiong with ifdef HAVE_CONFIG_H (Logical change 1.288) --- include/ntfs/compat.h | 2 ++ include/ntfs/debug.h | 4 +++- include/ntfs/device.h | 2 ++ include/ntfs/device_io.h | 2 ++ include/ntfs/endians.h | 2 ++ include/ntfs/gnome-vfs-method.h | 2 ++ include/ntfs/gnome-vfs-module.h | 2 ++ include/ntfs/support.h | 2 ++ include/ntfs/types.h | 4 +++- include/ntfs/volume.h | 4 +++- 10 files changed, 23 insertions(+), 3 deletions(-) diff --git a/include/ntfs/compat.h b/include/ntfs/compat.h index 866f6ae7..156cc515 100644 --- a/include/ntfs/compat.h +++ b/include/ntfs/compat.h @@ -23,7 +23,9 @@ #ifndef _NTFS_COMPAT_H #define _NTFS_COMPAT_H +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef WINDOWS diff --git a/include/ntfs/debug.h b/include/ntfs/debug.h index df6b6886..1f96e621 100644 --- a/include/ntfs/debug.h +++ b/include/ntfs/debug.h @@ -1,7 +1,7 @@ /* * debug.h - Debugging output functions. Part of the Linux-NTFS project. * - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -22,7 +22,9 @@ #ifndef _NTFS_DEBUG_H #define _NTFS_DEBUG_H +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDIO_H # include diff --git a/include/ntfs/device.h b/include/ntfs/device.h index c9490cd9..b6d0aace 100644 --- a/include/ntfs/device.h +++ b/include/ntfs/device.h @@ -22,7 +22,9 @@ #ifndef _NTFS_DEVICE_H #define _NTFS_DEVICE_H +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include diff --git a/include/ntfs/device_io.h b/include/ntfs/device_io.h index 7213631e..b6f0d810 100644 --- a/include/ntfs/device_io.h +++ b/include/ntfs/device_io.h @@ -22,7 +22,9 @@ #ifndef _NTFS_DEVICE_IO_H #define _NTFS_DEVICE_IO_H +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h index 75f464d1..ba23a0f6 100644 --- a/include/ntfs/endians.h +++ b/include/ntfs/endians.h @@ -23,7 +23,9 @@ #ifndef _NTFS_ENDIANS_H #define _NTFS_ENDIANS_H +#ifdef HAVE_CONFIG_H #include "config.h" +#endif /* * Notes: diff --git a/include/ntfs/gnome-vfs-method.h b/include/ntfs/gnome-vfs-method.h index ca7cb87a..c8069ab6 100644 --- a/include/ntfs/gnome-vfs-method.h +++ b/include/ntfs/gnome-vfs-method.h @@ -24,7 +24,9 @@ #ifndef _NTFS_GNOME_VFS_METHOD_H #define _NTFS_GNOME_VFS_METHOD_H +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include diff --git a/include/ntfs/gnome-vfs-module.h b/include/ntfs/gnome-vfs-module.h index 7de4665c..7dddd5cc 100644 --- a/include/ntfs/gnome-vfs-module.h +++ b/include/ntfs/gnome-vfs-module.h @@ -24,7 +24,9 @@ #ifndef _NTFS_GNOME_VFS_MODULE_H #define _NTFS_GNOME_VFS_MODULE_H +#ifdef HAVE_CONFIG_H #include "config.h" +#endif G_BEGIN_DECLS diff --git a/include/ntfs/support.h b/include/ntfs/support.h index 3ddbb136..72f797b5 100644 --- a/include/ntfs/support.h +++ b/include/ntfs/support.h @@ -22,7 +22,9 @@ #ifndef _NTFS_SUPPORT_H #define _NTFS_SUPPORT_H +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include diff --git a/include/ntfs/types.h b/include/ntfs/types.h index 5f6ae2c9..d1f335a5 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -2,7 +2,7 @@ * types.h - Misc type definitions not related to on-disk structure. Part of * the Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -23,7 +23,9 @@ #ifndef _NTFS_TYPES_H #define _NTFS_TYPES_H +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDINT_H #include diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 911a6e52..feeabdab 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -1,7 +1,7 @@ /* * volume.h - Exports for NTFS volume handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -22,7 +22,9 @@ #ifndef _NTFS_VOLUME_H #define _NTFS_VOLUME_H +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #ifdef HAVE_SYS_PARAM_H From 089a45c62564eb3e2dd5f4bc488fb8d87602eebe Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Feb 2004 14:09:45 +0000 Subject: [PATCH 1055/2994] Guard config.h inclusiong with ifdef HAVE_CONFIG_H. Suggested by Christophe Grenier. BKrev: 4041f2a9ad7n_rWxn-oYtMdMPYYHHA From 989f4ad69f90117fd51ce7501689c3bf76c99c05 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Feb 2004 14:09:45 +0000 Subject: [PATCH 1056/2994] Update. (Logical change 1.288) --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index f134b01a..69d2297d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +xx/xx/2004 - 1.8.6-WIP + - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef + HAVE_CONFIG_H (suggestion by Christophe Grenier). + 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to reflect reality a little better. From ddc702a582bd374ffc17192a5d33ca1fb690ad24 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Feb 2004 14:20:03 +0000 Subject: [PATCH 1057/2994] Update to 1.8.6-WIP. (Logical change 1.289) --- configure | 20 ++++++++++---------- configure.ac | 2 +- ntfsprogs/Makefile.in | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 33713c64..b2c8c29c 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.5. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.6-WIP. # # Report bugs to . # @@ -422,8 +422,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.5' -PACKAGE_STRING='ntfsprogs 1.8.5' +PACKAGE_VERSION='1.8.6-WIP' +PACKAGE_STRING='ntfsprogs 1.8.6-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -954,7 +954,7 @@ 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 ntfsprogs 1.8.5 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.8.6-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1021,7 +1021,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.5:";; + short | recursive ) echo "Configuration of ntfsprogs 1.8.6-WIP:";; esac cat <<\_ACEOF @@ -1136,7 +1136,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.5 +ntfsprogs configure 1.8.6-WIP generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1151,7 +1151,7 @@ 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 ntfsprogs $as_me 1.8.5, which was +It was created by ntfsprogs $as_me 1.8.6-WIP, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1845,7 +1845,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.8.5' + VERSION='1.8.6-WIP' cat >>confdefs.h <<_ACEOF @@ -21910,7 +21910,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.5, which was +This file was extended by ntfsprogs $as_me 1.8.6-WIP, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21973,7 +21973,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.5 +ntfsprogs config.status 1.8.6-WIP configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 36dda4b6..905405dd 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.5, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT(ntfsprogs, 1.8.6-WIP, linux-ntfs-dev@lists.sourceforge.net) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AM_CONFIG_HEADER([config.h]) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index a0f7e0d5..3e283e46 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From 5f2ae1a245b3c33054ca4899332e5c458ab9a3eb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 29 Feb 2004 14:20:03 +0000 Subject: [PATCH 1058/2994] Update to 1.8.6-WIP. BKrev: 4041f513kMym4zqrJcnjdh3JzFrbMg From 4460ccc41ad01bb581e11567609218e22f2771d9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 1 Mar 2004 12:47:17 +0000 Subject: [PATCH 1059/2994] Update ChangeLog (Logical change 1.290) --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 69d2297d..2e2c3089 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ xx/xx/2004 - 1.8.6-WIP - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef - HAVE_CONFIG_H (suggestion by Christophe Grenier). + HAVE_CONFIG_H. (Suggested by Christophe.) + - Update doc/CodingStyle. (Suggested by Szaka.) 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to From 42d06b623c12d56c52a9c37bd42b2efcdee38a18 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 1 Mar 2004 12:47:17 +0000 Subject: [PATCH 1060/2994] Update CodingStyle as suggested by Szaka. BKrev: 404330d5HTRnMqOaDr6XDbTFv6IVwA From b99d0450754f6b9866fe83231bdea411f5e34481 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 1 Mar 2004 12:47:17 +0000 Subject: [PATCH 1061/2994] Update doc/CodingStyle (Logical change 1.290) --- doc/CodingStyle | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/CodingStyle b/doc/CodingStyle index a2606be6..8dc07d1d 100644 --- a/doc/CodingStyle +++ b/doc/CodingStyle @@ -1,13 +1,24 @@ The standard K&R coding style is used in this project and the guidelines -outlined in the Linux kernel CodingStyle document (found in the Linux kernel -main directory in Documentation/CodingStyle) should be adhered to as strictly -as possible. +outlined in the Linux kernel CodingStyle document (found in the latest Linux +kernel main directory in Documentation/CodingStyle) should be adhered to as +strictly as possible. Special notes: Capitals are used when declaring NTFS on-disk structures which you can't just go ahead modifying without getting killed (in a bug sense, - not literally...). In memory structures are named with lower case as + not literally...). In memory structures are named with lower case as usual. + For styles that are not explicitly defined in the document or in the + kernel one, check/read the kernel and/or libntfs source. Some parts + of the kernel might use unwanted coding styles but usually, e.g. + linux/kernel/* + has what Linus prefers/writes and most developers follow. + + The latest Linux kernel contains the script Lindent in the scripts/ + directory which formats the source the most preferred way. Moreover, + the below patch will be applied to the official kernel tree as well: + http://lkml.org/lkml/2004/1/30/180 + Check indent(1) for what the used/unused (default) parameters mean. From 863a98f704a102cb88a06b4fb8df441a6cc0b4cc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 4 Mar 2004 16:59:58 +0000 Subject: [PATCH 1062/2994] - Fix mkntfs for large volumes where the number of clusters would exceed the maximum of 32 bits and mkntfs would segfault. Now we increase the cluster size until the number of clusters no longer exceeds 32 bits or the maximum cluster size is reached. We then exit with an appropriate error message. (Thanks to Szaka for the bug report.) - Also fix some compiler warnings in mkntfs with --enable-maintainer-mode. BKrev: 4047608erW-8wtmrh6ySSD3kjzZB4Q From 743f2c36320802ada40a0d69224ae290bc487110 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 4 Mar 2004 16:59:58 +0000 Subject: [PATCH 1063/2994] Fix compiler warning with --enable-maintainer-mode. (Logical change 1.291) --- ntfsprogs/sd.c | 1 + ntfsprogs/upcase.c | 1 + 2 files changed, 2 insertions(+) diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c index 7db46eff..3a5e2f45 100644 --- a/ntfsprogs/sd.c +++ b/ntfsprogs/sd.c @@ -27,6 +27,7 @@ * Do NOT free *@sd_val as it is static memory. This also means that you can * only use *@sd_val until the next call to this function. */ +void init_system_file_sd(int sys_file_no, char **sd_val, int *sd_val_len); void init_system_file_sd(int sys_file_no, char **sd_val, int *sd_val_len) { static char sd_array[0x68]; diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c index ea78d7c1..ae5db1e0 100644 --- a/ntfsprogs/upcase.c +++ b/ntfsprogs/upcase.c @@ -31,6 +31,7 @@ /** * init_upcase_table */ +void init_upcase_table(uchar_t *uc, u32 uc_len); void init_upcase_table(uchar_t *uc, u32 uc_len) { static int uc_run_table[][3] = { /* Start, End, Add */ From 852af74c586399d023561aa2ffdac21d488f9ba6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 4 Mar 2004 16:59:58 +0000 Subject: [PATCH 1064/2994] Fix mkntfs for large volumes where the number of clusters would exceed the maximum of 32 bits and mkntfs would segfault. Now we increase the cluster size until the number of clusters no longer exceeds 32 bits or the maximum cluster size is reached. We then exit with an appropriate error message. (Thanks to Szaka for the bug report.) Also fix some compiler warnings in mkntfs with --enable-maintainer-mode. (Logical change 1.291) --- ntfsprogs/mkntfs.c | 164 ++++++++++++++++++++++++++------------------- 1 file changed, 95 insertions(+), 69 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 76b42ac6..fb28571a 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -205,7 +205,7 @@ struct { /** * Dprintf - debugging output (-vv); overriden by quiet (-q) */ -void Dprintf(const char *fmt, ...) +static void Dprintf(const char *fmt, ...) { va_list ap; @@ -220,6 +220,7 @@ void Dprintf(const char *fmt, ...) /** * Eprintf - error output; ignores quiet (-q) */ +void Eprintf(const char *fmt, ...); void Eprintf(const char *fmt, ...) { va_list ap; @@ -239,7 +240,7 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * err_exit - error output and terminate; ignores quiet (-q) */ -void err_exit(const char *fmt, ...) +static void err_exit(const char *fmt, ...) { va_list ap; @@ -255,7 +256,7 @@ void err_exit(const char *fmt, ...) /** * copyright - print copyright statements */ -void copyright(void) +static void copyright(void) { fprintf(stderr, "Copyright (c) 2000-2003 Anton Altaparmakov\n" "Copyright (c) 2001-2003 Richard Russon\n" @@ -266,7 +267,7 @@ void copyright(void) /** * license - print license statement */ -void license(void) +static void license(void) { fprintf(stderr, "%s", ntfs_gpl); } @@ -274,8 +275,8 @@ void license(void) /** * usage - print a list of the parameters to the program */ -void usage(void) __attribute__ ((noreturn)); -void usage(void) +static void usage(void) __attribute__ ((noreturn)); +static void usage(void) { copyright(); fprintf(stderr, "Usage: %s [options] device " @@ -312,7 +313,7 @@ void usage(void) /** * parse_options */ -void parse_options(int argc, char *argv[]) +static void parse_options(int argc, char *argv[]) { int c; long l; @@ -398,7 +399,7 @@ void parse_options(int argc, char *argv[]) /** * append_to_bad_blocks */ -void append_to_bad_blocks(unsigned long block) +static void append_to_bad_blocks(unsigned long block) { long long *new_buf; @@ -416,8 +417,8 @@ void append_to_bad_blocks(unsigned long block) /** * mkntfs_write */ -__inline__ long long mkntfs_write(struct ntfs_device *dev, const void *buf, - long long count) +static __inline__ long long mkntfs_write(struct ntfs_device *dev, + const void *buf, long long count) { long long bytes_written, total; int retry; @@ -460,8 +461,8 @@ __inline__ long long mkntfs_write(struct ntfs_device *dev, const void *buf, * Return the number of bytes written (minus padding) or -1 on error. Errno * will be set to the error code. */ -s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, const char *val, - const s64 val_len, s64 *inited_size) +static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, + const char *val, const s64 val_len, s64 *inited_size) { s64 bytes_written, total, length, delta; int retry, i; @@ -538,7 +539,7 @@ s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, const char *val, * terminating null byte. If a unicode character was encountered which could * not be converted -1 is returned. */ -int ucstos(char *dest, const uchar_t *src, int maxlen) +static int ucstos(char *dest, const uchar_t *src, int maxlen) { uchar_t u; int i; @@ -570,12 +571,12 @@ int ucstos(char *dest, const uchar_t *src, int maxlen) * write the terminating null unicode character and hence return -1 with errno * set to EINVAL. */ -int stoucs(uchar_t *dest, const char *src, int maxlen) +static int stoucs(uchar_t *dest, const char *src, int maxlen) { char c; int i; - if (maxlen < sizeof(uchar_t)) { + if (maxlen < (int)sizeof(uchar_t)) { errno = EINVAL; return -1; } @@ -596,7 +597,7 @@ int stoucs(uchar_t *dest, const char *src, int maxlen) /** * dump_resident_attr_val */ -void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) +static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) { const char *don_t_know = "Don't know what to do with this attribute " "type yet."; @@ -737,7 +738,7 @@ void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) /** * dump_resident_attr */ -void dump_resident_attr(ATTR_RECORD *a) +static void dump_resident_attr(ATTR_RECORD *a) { int i; @@ -760,7 +761,7 @@ void dump_resident_attr(ATTR_RECORD *a) /** * dump_mapping_pairs_array */ -void dump_mapping_pairs_array(char *b, unsigned int max_len) +static void dump_mapping_pairs_array(char *b, unsigned int max_len) { // TODO return; @@ -769,7 +770,7 @@ void dump_mapping_pairs_array(char *b, unsigned int max_len) /** * dump_non_resident_attr */ -void dump_non_resident_attr(ATTR_RECORD *a) +static void dump_non_resident_attr(ATTR_RECORD *a) { s64 l; int i; @@ -802,7 +803,7 @@ void dump_non_resident_attr(ATTR_RECORD *a) /** * dump_attr_record */ -void dump_attr_record(ATTR_RECORD *a) +static void dump_attr_record(ATTR_RECORD *a) { unsigned int u; char s[0x200]; @@ -897,7 +898,7 @@ void dump_attr_record(ATTR_RECORD *a) /** * dump_mft_record */ -void dump_mft_record(MFT_RECORD *m) +static void dump_mft_record(MFT_RECORD *m) { ATTR_RECORD *a; unsigned int u; @@ -947,7 +948,7 @@ void dump_mft_record(MFT_RECORD *m) /** * format_mft_record */ -void format_mft_record(MFT_RECORD *m) +static void format_mft_record(MFT_RECORD *m) { ATTR_RECORD *a; @@ -1009,7 +1010,7 @@ void format_mft_record(MFT_RECORD *m) * -EINVAL Can only occur if mkntfs was compiled with -DEBUG. Means * the input parameters were faulty. */ -int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) +static int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) { u32 biu; @@ -1049,7 +1050,7 @@ int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) /** * deallocate_scattered_clusters */ -void deallocate_scattered_clusters(const runlist *rl) +static void deallocate_scattered_clusters(const runlist *rl) { LCN j; int i; @@ -1079,7 +1080,7 @@ void deallocate_scattered_clusters(const runlist *rl) * TODO: We should be returning the size as well, but for mkntfs this is not * necessary. */ -runlist *allocate_scattered_clusters(s64 clusters) +static runlist *allocate_scattered_clusters(s64 clusters) { runlist *rl = NULL, *rlt; VCN vcn = 0LL; @@ -1157,10 +1158,10 @@ err_end: * * Return 0 on success and -errno on error. */ -int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, - const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, - const ATTR_FLAGS flags, const runlist *rl, - const char *val, const s64 val_len) +static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, + const ATTR_TYPES type, const char *name, u32 name_len, + const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, + const runlist *rl, const char *val, const s64 val_len) { ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; @@ -1342,9 +1343,10 @@ err_out: * insert_non_resident_attr_in_mft_record * Return 0 on success and -errno on error. */ -int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, - const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, - const ATTR_FLAGS flags, const char *val, const s64 val_len) +static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, + const ATTR_TYPES type, const char *name, u32 name_len, + const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, + const char *val, const s64 val_len) { ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; @@ -1532,9 +1534,10 @@ err_out: * insert_resident_attr_in_mft_record * Return 0 on success and -errno on error. */ -int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, - const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, - const ATTR_FLAGS flags, const RESIDENT_ATTR_FLAGS res_flags, +static int insert_resident_attr_in_mft_record(MFT_RECORD *m, + const ATTR_TYPES type, const char *name, u32 name_len, + const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, + const RESIDENT_ATTR_FLAGS res_flags, const char *val, const u32 val_len) { ntfs_attr_search_ctx *ctx; @@ -1635,7 +1638,7 @@ err_out: * add_attr_std_info * Return 0 on success or -errno on error. */ -int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) +static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) { STANDARD_INFORMATION si; int err; @@ -1672,7 +1675,7 @@ int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) * add_attr_file_name * Return 0 on success or -errno on error. */ -int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, +static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, const s64 allocated_size, const s64 data_size, const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, const u32 reparse_point_tag, const char *file_name, @@ -1755,7 +1758,7 @@ int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, * * Return 0 on success or -errno on error. */ -int add_attr_sd(MFT_RECORD *m, const char *sd, const s64 sd_len) +static int add_attr_sd(MFT_RECORD *m, const char *sd, const s64 sd_len) { int err; @@ -1778,7 +1781,7 @@ int add_attr_sd(MFT_RECORD *m, const char *sd, const s64 sd_len) * add_attr_data * Return 0 on success or -errno on error. */ -int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, +static int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, const char *val, const s64 val_len) { @@ -1817,7 +1820,7 @@ int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, * * Return 0 on success or -errno on error. */ -int add_attr_data_positioned(MFT_RECORD *m, const char *name, +static int add_attr_data_positioned(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, const runlist *rl, const char *val, const s64 val_len) @@ -1842,7 +1845,7 @@ int add_attr_data_positioned(MFT_RECORD *m, const char *name, * * Return 0 on success or -errno on error. */ -int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, +static int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, const int vol_name_len) { uchar_t *uname; @@ -1879,7 +1882,7 @@ int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, * add_attr_vol_info * Return 0 on success or -errno on error. */ -int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags, +static int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags, const u8 major_ver, const u8 minor_ver) { VOLUME_INFORMATION vi; @@ -1900,8 +1903,9 @@ int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags, * add_attr_index_root * Return 0 on success or -errno on error. */ -int add_attr_index_root(MFT_RECORD *m, const char *name, const u32 name_len, - const IGNORE_CASE_BOOL ic, const ATTR_TYPES indexed_attr_type, +static int add_attr_index_root(MFT_RECORD *m, const char *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const ATTR_TYPES indexed_attr_type, const COLLATION_RULES collation_rule, const u32 index_block_size) { @@ -1979,9 +1983,9 @@ int add_attr_index_root(MFT_RECORD *m, const char *name, const u32 name_len, * add_attr_index_alloc * Return 0 on success or -errno on error. */ -int add_attr_index_alloc(MFT_RECORD *m, const char *name, const u32 name_len, - const IGNORE_CASE_BOOL ic, const char *index_alloc_val, - const u32 index_alloc_val_len) +static int add_attr_index_alloc(MFT_RECORD *m, const char *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const char *index_alloc_val, const u32 index_alloc_val_len) { int err; @@ -1997,7 +2001,7 @@ int add_attr_index_alloc(MFT_RECORD *m, const char *name, const u32 name_len, * add_attr_bitmap * Return 0 on success or -errno on error. */ -int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, +static int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const char *bitmap, const u32 bitmap_len) { @@ -2025,7 +2029,7 @@ int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, * * Return 0 on success or -errno on error. */ -int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, +static int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const runlist *rl, const char *bitmap, const u32 bitmap_len) { @@ -2047,7 +2051,7 @@ int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, * * Return 0 on success or -errno on error. */ -int upgrade_to_large_index(MFT_RECORD *m, const char *name, +static int upgrade_to_large_index(MFT_RECORD *m, const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, INDEX_ALLOCATION **index) { @@ -2206,7 +2210,7 @@ err_out: * * Return 0 on success or -errno on error. */ -int make_room_for_index_entry_in_index_block(INDEX_BLOCK *index, +static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *index, INDEX_ENTRY *pos, u32 size) { u32 biu; @@ -2259,7 +2263,7 @@ int make_room_for_index_entry_in_index_block(INDEX_BLOCK *index, * * Return 0 on success or -errno on error. */ -int insert_file_link_in_dir_index(INDEX_BLOCK *index, MFT_REF file_ref, +static int insert_file_link_in_dir_index(INDEX_BLOCK *index, MFT_REF file_ref, FILE_NAME_ATTR *file_name, u32 file_name_size) { int err, i; @@ -2391,7 +2395,7 @@ do_next: * * Return 0 on success or -errno on error. */ -int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, +static int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, MFT_RECORD *m_file, const MFT_REF ref_file, const s64 allocated_size, const s64 data_size, const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, @@ -2479,7 +2483,7 @@ int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, /** * init_options */ -void init_options(void) +static void init_options(void) { memset(&opts, 0, sizeof(opts)); opts.index_block_size = 4096; @@ -2491,7 +2495,7 @@ void init_options(void) /** * mkntfs_exit */ -void mkntfs_exit(void) +static void mkntfs_exit(void) { if (index_block) free(index_block); @@ -2521,7 +2525,7 @@ void mkntfs_exit(void) free(rl_index); if (opts.bad_blocks) free(opts.bad_blocks); - if (opts.attr_defs != (ATTR_DEF*)attrdef_ntfs12_array) + if (opts.attr_defs != (const ATTR_DEF*)attrdef_ntfs12_array) free(opts.attr_defs); if (!vol) return; @@ -2677,7 +2681,7 @@ int main(int argc, char **argv) /* Validate sector size. */ if ((opts.sector_size - 1) & opts.sector_size || opts.sector_size < 256 || opts.sector_size > 4096) - err_exit("Error: sector_size is invalid. It must be a power " + err_exit("sector_size is invalid. It must be a power " "of two, and it must be\n greater or equal 256 and " "less than or equal 4096 bytes.\n"); Dprintf("sector size = %i bytes\n", opts.sector_size); @@ -2698,12 +2702,11 @@ int main(int argc, char **argv) if (!opts.volume_size) opts.volume_size = opts.nr_sectors * opts.sector_size; else if (opts.volume_size & (opts.sector_size - 1)) - err_exit("Error: volume_size is not a multiple of " - "sector_size.\n"); + err_exit("volume_size is not a multiple of sector_size.\n"); /* Validate volume size. */ if (opts.volume_size < 1 << 20 /* 1MiB */) - err_exit("Error: device is too small (%ikiB). Minimum NTFS " - "volume size is 1MiB.\n", opts.volume_size / 1024); + err_exit("Device is too small (%ikiB). Minimum NTFS volume " + "size is 1MiB.\n", opts.volume_size / 1024); Dprintf("volume size = %llikiB\n", opts.volume_size / 1024); /* If user didn't specify the cluster size, determine it now. */ if (!vol->cluster_size) { @@ -2718,24 +2721,36 @@ int main(int argc, char **argv) /* For small volumes on devices with large sector sizes. */ if (vol->cluster_size < (u32)opts.sector_size) vol->cluster_size = opts.sector_size; + /* + * For huge volumes, grow the cluster size until the number of + * clusters fits into 32 bits or the cluster size exceeds the + * maximum limit of 64kiB. + */ + while (opts.volume_size >> (ffs(vol->cluster_size) - 1 + 32)) { + vol->cluster_size <<= 1; + if (vol->cluster_size > 65536) + err_exit("Device is too large to hold an NTFS " + "volume (maximum size is " + "256TiB).\n"); + } } /* Validate cluster size. */ if (vol->cluster_size & (vol->cluster_size - 1) || vol->cluster_size < (u32)opts.sector_size || vol->cluster_size > 128 * (u32)opts.sector_size || vol->cluster_size > 65536) - err_exit("Error: cluster_size is invalid. It must be a power " - "of two, be at least\nthe same as sector_size, be " - "maximum 64kB, and the sectors per cluster value " - "has\nto fit inside eight bits. (We do not support " - "larger cluster sizes yet.)\n"); + err_exit("Cluster_size is invalid. It must be a power of two, " + "be at least\nthe same as sector_size, be maximum " + "64kiB, and the sectors per cluster value has\n" + "to fit inside eight bits. (We do not support larger " + "cluster sizes yet.)\n"); vol->cluster_size_bits = ffs(vol->cluster_size) - 1; Dprintf("cluster size = %i bytes\n", vol->cluster_size); if (vol->cluster_size > 4096) { if (opts.enable_compression) { if (!opts.force) - err_exit("Error: cluster_size is above 4096 " - "bytes and compression is " + err_exit("Cluster_size is above 4096 bytes " + "and compression is " "requested.\nThis is not " "possible due to limitations " "in the compression algorithm " @@ -2764,6 +2779,17 @@ int main(int argc, char **argv) "and/or cluster/sector number.\n"); Dprintf("number of clusters = %llu (0x%llx)\n", opts.nr_clusters, opts.nr_clusters); + /* Number of clusters must fit within 32 bits (Win2k limitation). */ + if (opts.nr_clusters >> 32) { + if (vol->cluster_size >= 65536) + err_exit("Device is too large to hold an NTFS volume " + "(maximum size is 256TiB).\n"); + err_exit("Number of clusters exceeds 32 bits. Please try " + "again with a larger\ncluster size or leave " + "the cluster size unspecified and the " + "smallest possible\ncluster size for the size " + "of the device will be used.\n"); + } /* Determine lcn bitmap byte size and allocate it. */ lcn_bitmap_byte_size = (opts.nr_clusters + 7) >> 3; /* Needs to be multiple of 8 bytes. */ @@ -3362,7 +3388,7 @@ int main(int argc, char **argv) buf2 = NULL; if (bw != i) { int _e = errno; - char *_s; + const char *_s; if (bw == -1LL) _s = strerror(_e); From 6b66bce89db3e1f9987fd64226130fd8264f0760 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 4 Mar 2004 16:59:58 +0000 Subject: [PATCH 1065/2994] update (Logical change 1.291) --- ChangeLog | 6 ++++++ ntfsprogs/Makefile.in | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e2c3089..cf49e581 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ xx/xx/2004 - 1.8.6-WIP - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef HAVE_CONFIG_H. (Suggested by Christophe.) - Update doc/CodingStyle. (Suggested by Szaka.) + - Fix mkntfs for large volumes where the number of clusters would + exceed the maximum of 32 bits and mkntfs would segfault. Now we + increase the cluster size until the number of clusters no longer + exceeds 32 bits or the maximum cluster size is reached. We then + exit with an appropriate error message. (Thanks to Szaka for the + bug report.) 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 3e283e46..a0f7e0d5 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_TRUE@AM_LFLAGS = -static @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From a6629ede038ddc02932679248b34b4a99378bfa2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 4 Mar 2004 17:03:27 +0000 Subject: [PATCH 1066/2994] And another compiler warning. (Logical change 1.292) --- ntfsprogs/mkntfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index fb28571a..2576a431 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -898,6 +898,7 @@ static void dump_attr_record(ATTR_RECORD *a) /** * dump_mft_record */ +static void dump_mft_record(MFT_RECORD *m) __attribute__((unused)); static void dump_mft_record(MFT_RECORD *m) { ATTR_RECORD *a; From 32ee437ae4602683f22615ab3b0261c329ea02de Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 4 Mar 2004 17:03:27 +0000 Subject: [PATCH 1067/2994] Minor update and fix another compiler warning. BKrev: 4047615fP5BnfzxqixCA3rxSshEqjQ From b87932368a8d7b7eaa89a6535076cbe289daa626 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 4 Mar 2004 17:03:27 +0000 Subject: [PATCH 1068/2994] Minor update. (Logical change 1.292) --- libntfs/attrib.c | 9 +++------ libntfs/runlist.c | 10 ---------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e63af89d..b615efab 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2175,10 +2175,8 @@ int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type) errno = EINVAL; return -1; } - if (type != AT_INDEX_ALLOCATION && type != AT_EA) return 0; - errno = EPERM; return -1; } @@ -2204,7 +2202,6 @@ static int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) { /* Align to 8 bytes, just in case the caller hasn't. */ new_size = (new_size + 7) & ~7; - /* If the actual attribute length has changed, move things around. */ if (new_size != le32_to_cpu(a->length)) { u32 new_muse = le32_to_cpu(m->bytes_in_use) - @@ -2275,7 +2272,6 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, new_size + 7) & ~7) < 0) { if (errno != ENOSPC) { int eo = errno; - // FIXME: Eeek! fprintf(stderr, "%s(): Eeek! Attribute record resize " "failed. Aborting...\n", __FUNCTION__); @@ -2603,6 +2599,9 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) // TODO: Move the attribute to a new mft record, creating an attribute // list attribute or modifying it if it is already present. + // TODO: If that is still not enough, split the attribute into multiple + // extents and save them to several mft records. + err = ENOTSUP; goto put_err_out; @@ -3133,9 +3132,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) errno = ENOTSUP; return -1; } - if (NAttrNonResident(na)) return ntfs_non_resident_attr_shrink(na, newsize); return ntfs_resident_attr_resize(na, newsize); } - diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 63c1082d..7ef1c0d9 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1427,9 +1427,7 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) errno = EINVAL; return -1; } - rl = *arl; - if (start_vcn < rl->vcn) { // FIXME: Eeek! BUG() fprintf(stderr, "%s(): Eeek! start_vcn lies outside front of " @@ -1437,7 +1435,6 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) errno = EIO; return -1; } - /* Find the starting vcn in the run list. */ while (rl->length) { if (start_vcn < rl[1].vcn) @@ -1458,13 +1455,10 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) errno = EIO; return -1; } - if (rl->length) { is_end = FALSE; - /* Truncate the run. */ rl->length = start_vcn - rl->vcn; - /* * If a run was partially truncated, make the following runlist * element a terminator instead of the truncated runlist @@ -1479,9 +1473,7 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) } } else is_end = TRUE; - rl->lcn = (LCN)LCN_ENOENT; - /* Reallocate memory if necessary. */ if (!is_end) { size_t new_size = (rl - *arl + 1) * sizeof(runlist_element); @@ -1498,8 +1490,6 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) __FUNCTION__); } } - /* Done! */ return 0; } - From e749fdc22926cbd5fbbcab2d71a50afe7f93ca36 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 09:45:14 +0000 Subject: [PATCH 1069/2994] Add Yuval Fledel. (Logical change 1.293) --- CREDITS | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS b/CREDITS index 83e566cc..eb919c2a 100644 --- a/CREDITS +++ b/CREDITS @@ -12,6 +12,7 @@ Albert D. Cahalan Russ Christensen Andras Erdei Matthew J. Fanto +Yuval Fledel (no email address on request) Christophe Grenier Ian Jackson Jan Kratochvil From 260305c10233cbf6772280dcc3b055dacfc9d68d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 09:45:14 +0000 Subject: [PATCH 1070/2994] Modify layout.h and logfile.h expanding/naming annonymous structs and unions (much like I did earlier in the kernel driver) so that the -fms-extensions switch is no longer required. Also, removed the -fms-extensions switch and associated autodetection from ./configure.ac. (Yuval Fledel with small fixes from me) (Logical change 1.293) --- configure | 5 --- configure.ac | 5 --- include/ntfs/layout.h | 75 +++++++++++++++++++++++++++++++++--------- include/ntfs/logfile.h | 12 +++++-- 4 files changed, 70 insertions(+), 27 deletions(-) diff --git a/configure b/configure index b2c8c29c..d6efe4ea 100755 --- a/configure +++ b/configure @@ -18995,11 +18995,6 @@ if test "$USE_MAINTAINER_MODE" = "yes";then CFLAGS="$CFLAGS -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare" fi -# Add -fms-extensions for gcc-3.2+. -if test $cc_major -gt 3 -o \( $cc_major -eq 3 -a $cc_minor -ge 2 \); then - CFLAGS="$CFLAGS -fms-extensions" -fi - # Add debugging switches if in debug mode. if test "$enable_debug" = "yes"; then CFLAGS="$CFLAGS -ggdb3 -DDEBUG" diff --git a/configure.ac b/configure.ac index 905405dd..9aa23737 100644 --- a/configure.ac +++ b/configure.ac @@ -163,11 +163,6 @@ if test "$USE_MAINTAINER_MODE" = "yes";then CFLAGS="$CFLAGS -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare" fi -# Add -fms-extensions for gcc-3.2+. -if test $cc_major -gt 3 -o \( $cc_major -eq 3 -a $cc_minor -ge 2 \); then - CFLAGS="$CFLAGS -fms-extensions" -fi - # Add debugging switches if in debug mode. if test "$enable_debug" = "yes"; then CFLAGS="$CFLAGS -ggdb3 -DDEBUG" diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index b62e6000..3216a718 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -292,7 +292,11 @@ typedef u64 MFT_REF; */ typedef struct { /*Ofs*/ -/* 0*/ NTFS_RECORD; /* Usually the magic is "FILE". */ +/* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ + NTFS_RECORD_TYPES magic;/* Usually the magic is "FILE". */ + u16 usa_ofs; /* See NTFS_RECORD definition above. */ + u16 usa_count; /* See NTFS_RECORD definition above. */ + /* 8*/ u64 lsn; /* $LogFile sequence number for this record. Changed every time the record is modified. */ /* 16*/ u16 sequence_number; /* Number of times this mft record has been @@ -1428,9 +1432,13 @@ typedef struct { * ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE */ typedef struct { - ACE_HEADER; /* The ACE header. */ - ACCESS_MASK mask; /* Access mask associated with the ACE. */ - SID sid; /* The SID associated with the ACE. */ +/* 0 ACE_HEADER; -- Unfolded here as gcc doesn't like unnamed structs. */ + ACE_TYPES type; /* Type of the ACE. */ + ACE_FLAGS flags; /* Flags describing the ACE. */ + u16 size; /* Size in bytes of the ACE. */ + +/* 4*/ ACCESS_MASK mask; /* Access mask associated with the ACE. */ +/* 8*/ SID sid; /* The SID associated with the ACE. */ } __attribute__ ((__packed__)) ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE; @@ -1443,12 +1451,16 @@ typedef enum { } OBJECT_ACE_FLAGS; typedef struct { - ACE_HEADER; /* The ACE_HEADER. */ - ACCESS_MASK mask; /* Access mask associated with the ACE. */ - OBJECT_ACE_FLAGS flags; /* Flags describing the object ACE. */ - GUID object_type; - GUID inherited_object_type; - SID sid; /* The SID associated with the ACE. */ +/* 0 ACE_HEADER; -- Unfolded here as gcc doesn't like unnamed structs. */ + ACE_TYPES type; /* Type of the ACE. */ + ACE_FLAGS flags; /* Flags describing the ACE. */ + u16 size; /* Size in bytes of the ACE. */ + +/* 4*/ ACCESS_MASK mask; /* Access mask associated with the ACE. */ +/* 8*/ OBJECT_ACE_FLAGS object_flags; /* Flags describing the object ACE. */ +/* 12*/ GUID object_type; +/* 28*/ GUID inherited_object_type; +/* 44*/ SID sid; /* The SID associated with the ACE. */ } __attribute__ ((__packed__)) ACCESS_ALLOWED_OBJECT_ACE, ACCESS_DENIED_OBJECT_ACE, SYSTEM_AUDIT_OBJECT_ACE, @@ -1692,8 +1704,13 @@ typedef struct { * $SDS data stream and the second copy will be at offset 0x451d0. */ typedef struct { - SECURITY_DESCRIPTOR_HEADER; /* The security descriptor header. */ - SECURITY_DESCRIPTOR_RELATIVE sid; /* The self-relative security +/* 0 SECURITY_DESCRIPTOR_HEADER; -- Unfolded here as gcc doesn't like + unnamed structs. */ + u32 hash; /* Hash of the security descriptor. */ + u32 security_id; /* The security_id assigned to the descriptor. */ + u64 offset; /* Byte offset of this entry in the $SDS stream. */ + u32 length; /* Size in bytes of this entry in $SDS stream. */ +/* 20*/ SECURITY_DESCRIPTOR_RELATIVE sid; /* The self-relative security descriptor. */ } __attribute__ ((__packed__)) SDS_ENTRY; @@ -1867,7 +1884,11 @@ typedef struct { * index entries (INDEX_ENTRY structures), as described by the INDEX_HEADER. */ typedef struct { -/* 0*/ NTFS_RECORD; /* Magic is "INDX". */ +/* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ + NTFS_RECORD_TYPES magic;/* Magic is "INDX". */ + u16 usa_ofs; /* See NTFS_RECORD definition. */ + u16 usa_count; /* See NTFS_RECORD definition. */ + /* 8*/ s64 lsn; /* $LogFile sequence number of the last modification of this index block. */ /* 16*/ VCN index_block_vcn; /* Virtual cluster number of the index block. */ @@ -2018,7 +2039,30 @@ typedef struct { * NOTE: Before NTFS 3.0 only filename attributes were indexed. */ typedef struct { -/* 0*/ INDEX_ENTRY_HEADER; /* The index entry header (see above). */ +/* 0 INDEX_ENTRY_HEADER; -- Unfolded here as gcc dislikes unnamed structs. */ + union { + struct { /* Only valid when INDEX_ENTRY_END is not set. */ + MFT_REF indexed_file; /* The mft reference of the file + described by this index + entry. Used for directory + indexes. */ + } __attribute__ ((__packed__)); + struct { /* Used for views/indexes to find the entry's data. */ + u16 data_offset; /* Data byte offset from this + INDEX_ENTRY. Follows the + index key. */ + u16 data_length; /* Data length in bytes. */ + u32 reservedV; /* Reserved (zero). */ + } __attribute__ ((__packed__)); + } __attribute__ ((__packed__)); + u16 length; /* Byte size of this index entry, multiple of + 8-bytes. */ + u16 key_length; /* Byte size of the key value, which is in the + index entry. It follows field reserved. Not + multiple of 8-bytes. */ + INDEX_ENTRY_FLAGS flags; /* Bit field of INDEX_ENTRY_* flags. */ + u16 reserved; /* Reserved/align to 8-byte boundary. */ + /* 16*/ union { /* The key of the indexed attribute. NOTE: Only present if INDEX_ENTRY_END bit in flags is not set. NOTE: On NTFS versions before 3.0 the only valid key is the @@ -2030,7 +2074,8 @@ typedef struct { GUID object_id; /* $O index in FILE_Extend/$ObjId: The object_id of the mft record found in the data part of the index. */ - REPARSE_INDEX_KEY; /* $R index in FILE_Extend/$Reparse. */ + REPARSE_INDEX_KEY reparse; /* $R index in + FILE_Extend/$Reparse. */ SID sid; /* $O index in FILE_Extend/$Quota: SID of the owner of the user_id. */ u32 owner_id; /* $Q index in FILE_Extend/$Quota: diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index e3d5f074..7671ee2a 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -54,7 +54,11 @@ typedef enum { * Log file restart page header (begins the restart area). */ typedef struct { - NTFS_RECORD; /* The magic is "RSTR". */ +/* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ + NTFS_RECORD_TYPES magic;/* The magic is "RSTR". */ + u16 usa_ofs; /* See NTFS_RECORD definition above. */ + u16 usa_count; /* See NTFS_RECORD definition above. */ + u64 chkdsk_lsn; /* The check disk log file sequence number for this restart page. Only used when the magic is changed to "CHKD". = 0 */ @@ -172,7 +176,11 @@ typedef struct { * aligned to 8 byte boundary, but is this specified anywhere?). */ typedef struct { - NTFS_RECORD; /* The magic is "RCRD". */ +/* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ + NTFS_RECORD_TYPES magic;/* Usually the magic is "RCRD". */ + u16 usa_ofs; /* See NTFS_RECORD definition above. */ + u16 usa_count; /* See NTFS_RECORD definition above. */ + union { u64 last_lsn; u32 file_offset; From a7e6f2acb59055307e1940ee43e546ce47b75a40 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 09:45:14 +0000 Subject: [PATCH 1071/2994] Modify layout.h and logfile.h expanding/naming annonymous structs and unions (much like I did earlier in the kernel driver) so that the -fms-extensions switch is no longer required. Also, removed the -fms-extensions switch and associated autodetection from ./configure.ac. (Yuval Fledel with small fixes from me) BKrev: 40484c2asRC1SlQMVfhDhHkULzq0Ew From 7bd2f3f8d54eecd63047104ea6387941fffaa976 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 09:45:14 +0000 Subject: [PATCH 1072/2994] Update. (Logical change 1.293) --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index cf49e581..ca91d579 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,11 @@ xx/xx/2004 - 1.8.6-WIP exceeds 32 bits or the maximum cluster size is reached. We then exit with an appropriate error message. (Thanks to Szaka for the bug report.) + - Modify layout.h and logfile.h expanding/naming annonymous structs + and unions (much like I did earlier in the kernel driver) so that + the -fms-extensions switch is no longer required. Also, removed + the -fms-extensions switch and associated autodetection from + ./configure.ac. (Yuval Fledel with small fixes from me) 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to From a2e4ff7cb639f4a6d593d69999c276b6cb000e1c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:04:40 +0000 Subject: [PATCH 1073/2994] Rename INCLUDES to AM_CPPFLAGS. (Logical change 1.294) --- libntfs/Makefile.am | 2 +- libntfs/Makefile.in | 2 +- ntfsprogs/Makefile.am | 2 +- ntfsprogs/Makefile.in | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index fa90081c..1a15a074 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -71,7 +71,7 @@ libntfs_gnomevfs_la_SOURCES = \ man_MANS = libntfs-gnomevfs.8 -INCLUDES = $(linux_ntfsincludedir) $(all_includes) +AM_CPPFLAGS = $(linux_ntfsincludedir) $(all_includes) EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 8c56a637..44d7d713 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -217,7 +217,7 @@ libntfs_gnomevfs_la_SOURCES = \ man_MANS = libntfs-gnomevfs.8 -INCLUDES = $(linux_ntfsincludedir) $(all_includes) +AM_CPPFLAGS = $(linux_ntfsincludedir) $(all_includes) EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in subdir = libntfs diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index dbebdd39..5e1f2456 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -25,7 +25,7 @@ CLEANFILES = $(EXTRA_PROGRAMS) linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs # Set the include path. -INCLUDES = -I$(top_srcdir)/include/ntfs $(all_includes) +AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs $(all_includes) ntfsfix_SOURCES = ntfsfix.c ntfsfix_LDADD = $(AM_LIBS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index a0f7e0d5..86fce4dc 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @@ -171,7 +171,7 @@ CLEANFILES = $(EXTRA_PROGRAMS) linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs # Set the include path. -INCLUDES = -I$(top_srcdir)/include/ntfs $(all_includes) +AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs $(all_includes) ntfsfix_SOURCES = ntfsfix.c ntfsfix_LDADD = $(AM_LIBS) From 589f5ec22fabe86f207a063606310641ea3ba018 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:04:40 +0000 Subject: [PATCH 1074/2994] Update so getggcver is always found (make distcheck used to fail because of this for example). (Logical change 1.294) --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 9aa23737..cee539c3 100644 --- a/configure.ac +++ b/configure.ac @@ -22,10 +22,10 @@ # AC_PREREQ(2.57) -AC_INIT(ntfsprogs, 1.8.6-WIP, linux-ntfs-dev@lists.sourceforge.net) +AC_INIT([ntfsprogs],[1.8.6-WIP],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) -AM_CONFIG_HEADER([config.h]) +AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE AM_MAINTAINER_MODE AM_ENABLE_SHARED @@ -135,7 +135,7 @@ fi # Check for gcc version being >= 2.96. AC_MSG_CHECKING(version of $_cc) -cc_version=`./getgccver $_cc` +cc_version=`$srcdir/getgccver $_cc` cc_major=`echo $cc_version | cut -d'.' -f1` cc_minor=`echo $cc_version | cut -d'.' -f2` if test -z "$cc_version"; then From 73fdc0ebd95e42800fc1ac5b6f1e8b11a032e916 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:04:40 +0000 Subject: [PATCH 1075/2994] Update to use autoreconf. (Logical change 1.294) --- autogen.sh | 128 +++++++++++++---------------------------------------- 1 file changed, 31 insertions(+), 97 deletions(-) diff --git a/autogen.sh b/autogen.sh index 6bcdeaa6..3a624c31 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,52 +1,31 @@ #!/bin/sh # Run this to generate all the initial makefiles, etc. -DIE=0 - -if test x$srcdir = x; then - srcdir=. +if test "$srcdir" == ""; then + srcdir=. +elif test "$srcdir" != "."; then + pushd $srcdir > /dev/null fi -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`autoconf' installed to compile Linux-NTFS." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { - (libtool --version) < /dev/null > /dev/null 2>&1 || { +(autoreconf --version) < /dev/null > /dev/null 2>&1 || { + (autoconf --version) < /dev/null > /dev/null 2>&1 || { echo - echo "**Error**: You must have \`libtool' installed to compile Linux-NTFS." - echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 + echo "**Error**: You must have the GNU Build System (autoconf, automake, " + echo "libtool, etc) to update the ntfsprogs build system. Download the " + echo "appropriate packages for your distribution, or get the source " + echo "tar balls from ftp://ftp.gnu.org/pub/gnu/." + exit 1 } -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { echo - echo "**Error**: You must have \`automake' installed to compile Linux-NTFS." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - NO_AUTOMAKE=yes -} - -# if no automake, don't bother testing for aclocal -test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: Missing \`aclocal'. The version of \`automake'" - echo "installed doesn't appear recent enough." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -if test "$DIE" -eq 1; then + echo "**Error**: Your version of autoconf is too old (you need 2.57) to " + echo "update the ntfsprogs build system. Download the appropriate " + echo "updated package for your distribution, or get the source tar ball " + echo "from ftp://ftp.gnu.org/pub/gnu/." exit 1 -fi +} + +echo Running autoreconf --verbose --install --warnings=all +autoreconf --verbose --install --warnings=all if test -z "$*"; then echo "**Warning**: I am going to run \`configure' with no arguments." @@ -55,63 +34,18 @@ if test -z "$*"; then echo fi -case $CC in -xlc ) - am_opt=--include-deps;; -esac +conf_flags="--enable-maintainer-mode --enable-compile-warnings" -for coin in `find $srcdir -name configure.ac -print` -do - dr=`dirname $coin` - if test -f $dr/NO-AUTO-GEN; then - echo skipping $dr -- flagged as no auto-gen - else - echo processing $dr - macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin` - ( cd $dr - macrosdir=`find . -name macros -print` - aclocalinclude="$ACLOCAL_FLAGS" - for k in $macrodirs; do - if test -d $k; then - aclocalinclude="$aclocalinclude -I $k" - fi - done - if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then - if test -z "$NO_LIBTOOLIZE" ; then - echo "Running libtoolize..." - libtoolize --force --copy - fi - fi - echo "Running aclocal $aclocalinclude ..." - aclocal $aclocalinclude || { - echo - echo "**Error**: aclocal failed. This may mean that you have not" - echo "installed all of the packages you need, or you may need to" - echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" - echo "for the prefix where you installed the packages whose" - echo "macros were not found" - exit 1 - } +echo Running $srcdir/configure $conf_flags "$@" ... +$srcdir/configure $conf_flags "$@" \ + && echo Now type \`make\' to compile ntfsprogs. || err=1 - if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then - echo "Running autoheader..." - autoheader || { echo "**Error**: autoheader failed."; exit 1; } - fi - echo "Running automake --gnu $am_opt ..." - automake --add-missing --gnu $am_opt || - { echo "**Error**: automake failed."; exit 1; } - echo "Running autoconf ..." - autoconf || { echo "**Error**: autoconf failed."; exit 1; } - ) || exit 1 - fi -done - -conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c - -if test x$NOCONFIGURE = x; then - echo Running $srcdir/configure $conf_flags "$@" ... - $srcdir/configure $conf_flags "$@" \ - && echo Now type \`make\' to compile $PKG_NAME || exit 1 -else - echo Skipping configure process. +if test "$srcdir" != "."; then + popd > /dev/null fi + +if test "$err" == "1"; then + exit 1 +fi + +exit 0 From a2a03c63b37a3bdb01531607c876d8612b226082 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:04:40 +0000 Subject: [PATCH 1076/2994] Update. (Logical change 1.294) --- COPYING | 6 +- ChangeLog | 3 + INSTALL | 21 ++- aclocal.m4 | 26 --- configure | 2 +- depcomp | 472 ++++++++++++++++++++++++++++++++++++++++++++++++++ install-sh | 149 ++++++++++------ mkinstalldirs | 116 +++++++------ 8 files changed, 654 insertions(+), 141 deletions(-) diff --git a/COPYING b/COPYING index 6b2ef060..593ca947 100644 --- a/COPYING +++ b/COPYING @@ -1,5 +1,5 @@ - NOTE: The GPL below is copyrighted by the Free Software Foundation, + NOTE: The GPL below is copyrighted by the Free Software Foundation, but the instances of code that it refers to (the Linux-NTFS project, including the NTFS library "libntfs", the NTFS utilities "ntfsprogs" and the Linux kernel NTFS driver) are copyrighted by me and others @@ -13,7 +13,7 @@ Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -324,7 +324,7 @@ Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/ChangeLog b/ChangeLog index ca91d579..82711e5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,9 @@ xx/xx/2004 - 1.8.6-WIP the -fms-extensions switch is no longer required. Also, removed the -fms-extensions switch and associated autodetection from ./configure.ac. (Yuval Fledel with small fixes from me) + - Update the build system: autogen.sh now uses autoreconf; run + autoupdate && autoreconf --force and fixup the fallout damage; rename + INCLUDES to AM_CPPFLAGS; add $srcdir to getgccver invocation. 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to diff --git a/INSTALL b/INSTALL index 9f879171..e1fb6264 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,10 @@ -Quick installation +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Quick Installation ================== In most cases it should be sufficient to do: @@ -8,12 +14,14 @@ Quick installation make install The above will compile and install the NTFS library and utility -programs into /usr/local/lib and /usr/local/bin respectively. The man +programs into /usr/local/lib and /usr/local/bin respectively. The man pages will be installed by default in /usr/local/man. Basic Installation ================== + These are generic installation instructions. + The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. @@ -80,7 +88,7 @@ for details on some of the pertinent environment variables. by setting variables in the command line or in the environment. Here is an example: - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. @@ -149,15 +157,16 @@ Specifying the System Type There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the -_same_ atchitectures, `configure' can figure that out, but if it prints +_same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: + CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: - OS KERNEL-OS + OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't @@ -214,7 +223,7 @@ operates. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, - traditionally `./config.cache'. FILE defaults to `/dev/null' to + traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' diff --git a/aclocal.m4 b/aclocal.m4 index 96590317..f96c0ba9 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -11,32 +11,6 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# 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($@)]) - # Do all the work for Automake. -*- Autoconf -*- # This macro actually does too much some checks are only needed if diff --git a/configure b/configure index d6efe4ea..b824233f 100755 --- a/configure +++ b/configure @@ -18961,7 +18961,7 @@ fi # Check for gcc version being >= 2.96. echo "$as_me:$LINENO: checking version of $_cc" >&5 echo $ECHO_N "checking version of $_cc... $ECHO_C" >&6 -cc_version=`./getgccver $_cc` +cc_version=`$srcdir/getgccver $_cc` cc_major=`echo $cc_version | cut -d'.' -f1` cc_minor=`echo $cc_version | cut -d'.' -f2` if test -z "$cc_version"; then diff --git a/depcomp b/depcomp index e69de29b..aea3d007 100755 --- a/depcomp +++ b/depcomp @@ -0,0 +1,472 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/install-sh b/install-sh index 11870f1b..6ce63b9f 100755 --- a/install-sh +++ b/install-sh @@ -1,19 +1,37 @@ #!/bin/sh # # install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). # -# Copyright 1991 by the Massachusetts Institute of Technology +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. # -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it @@ -56,7 +74,7 @@ dir_arg="" while [ x"$1" != x ]; do case $1 in - -c) instcmd="$cpprog" + -c) instcmd=$cpprog shift continue;; @@ -79,7 +97,7 @@ while [ x"$1" != x ]; do shift continue;; - -s) stripcmd="$stripprog" + -s) stripcmd=$stripprog shift continue;; @@ -106,7 +124,7 @@ done if [ x"$src" = x ] then - echo "install: no input file specified" + echo "$0: no input file specified" >&2 exit 1 else : @@ -115,8 +133,8 @@ fi if [ x"$dir_arg" != x ]; then dst=$src src="" - - if [ -d $dst ]; then + + if [ -d "$dst" ]; then instcmd=: chmodcmd="" else @@ -125,20 +143,20 @@ if [ x"$dir_arg" != x ]; then else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad +# might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f "$src" ] || [ -d "$src" ] then : else - echo "install: $src does not exist" + echo "$0: $src does not exist" >&2 exit 1 fi - + if [ x"$dst" = x ] then - echo "install: no destination specified" + echo "$0: no destination specified" >&2 exit 1 else : @@ -147,16 +165,16 @@ else # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic - if [ -d $dst ] + if [ -d "$dst" ] then - dst="$dst"/`basename $src` + dst=$dst/`basename "$src"` else : fi fi ## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` +dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script @@ -165,69 +183,73 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` if [ ! -d "$dstdir" ]; then defaultIFS=' ' -IFS="${IFS-${defaultIFS}}" +IFS="${IFS-$defaultIFS}" -oIFS="${IFS}" +oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" +set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS=$oIFS pathcomp='' while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" + pathcomp=$pathcomp$1 shift - if [ ! -d "${pathcomp}" ] ; + if [ ! -d "$pathcomp" ] ; then - $mkdirprog "${pathcomp}" + $mkdirprog "$pathcomp" else : fi - pathcomp="${pathcomp}/" + pathcomp=$pathcomp/ done fi if [ x"$dir_arg" != x ] then - $doit $instcmd $dst && + $doit $instcmd "$dst" && - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi else # If we're going to rename the final executable, determine the name now. - if [ x"$transformarg" = x ] + if [ x"$transformarg" = x ] then - dstfile=`basename $dst` + dstfile=`basename "$dst"` else - dstfile=`basename $dst $transformbasename | + dstfile=`basename "$dst" $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename - if [ x"$dstfile" = x ] + if [ x"$dstfile" = x ] then - dstfile=`basename $dst` + dstfile=`basename "$dst"` else : fi -# Make a temp file name in the proper directory. +# Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/#inst.$$# + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + +# Trap to clean up temp files at exit. + + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 # Move or copy the file name to the temp name - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && + $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits @@ -235,17 +257,38 @@ else # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && + +# Now remove or move aside any old file at destination location. We try this +# two ways since rm can't unlink itself on some systems and the destination +# file might be busy for other reasons. In this case, the final cleanup +# might fail but the new file should still install successfully. + +{ + if [ -f "$dstdir/$dstfile" ] + then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || + $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || + { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi +} && # Now rename the file to the real destination. - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" fi && +# The final little trick to "correctly" pass the exit status to the exit trap. -exit 0 +{ + (exit 0); exit +} diff --git a/mkinstalldirs b/mkinstalldirs index 8ab885ec..d2d5f21b 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -12,18 +12,29 @@ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." # process command line arguments while test $# -gt 0 ; do - case "${1}" in - -h | --help | --h* ) # -h for help - echo "${usage}" 1>&2; exit 0 ;; - -m ) # -m PERM arg - shift - test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } - dirmode="${1}" - shift ;; - -- ) shift; break ;; # stop option processing - -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option - * ) break ;; # first non-opt arg - esac + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" 1>&2 + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac done for file @@ -36,64 +47,65 @@ do done case $# in -0) exit 0 ;; + 0) exit 0 ;; esac case $dirmode in -'') - if mkdir -p -- . 2>/dev/null; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - fi ;; -*) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - fi ;; + '') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi + ;; + *) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi + ;; esac for file do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" - mkdir "$pathcomp" || lasterr=$? + mkdir "$pathcomp" || lasterr=$? - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done + pathcomp="$pathcomp/" + done done exit $errstatus # Local Variables: # mode: shell-script -# sh-indentation: 3 +# sh-indentation: 2 # End: # mkinstalldirs ends here From 61115edf14af6f3d777a4e2e5a9f63750a137fbc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:04:40 +0000 Subject: [PATCH 1077/2994] Update/modernise build system: autogen.sh now uses autoreconf; run autoupdate && autoreconf --force and fixup the fallout damage; rename INCLUDES to AM_CPPFLAGS; add $srcdir to getgccver invocation. BKrev: 40485ec8_gVMUo34wsOoiNQoLmoq4g From 607036db7d0fcd4433a3bb1f02aa7a692599199c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:23:42 +0000 Subject: [PATCH 1078/2994] Rename private to priv_data in ntfs_device_alloc() to avoid name space clashes with C++. (Yuval Fledel, modified fix by me) (Logical change 1.295) --- include/ntfs/device.h | 2 +- libntfs/device.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/ntfs/device.h b/include/ntfs/device.h index b6d0aace..7db9b0e7 100644 --- a/include/ntfs/device.h +++ b/include/ntfs/device.h @@ -89,7 +89,7 @@ struct ntfs_device_operations { }; extern struct ntfs_device *ntfs_device_alloc(const char *name, const long state, - struct ntfs_device_operations *dops, void *private); + struct ntfs_device_operations *dops, void *priv_data); extern int ntfs_device_free(struct ntfs_device *dev); extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, diff --git a/libntfs/device.c b/libntfs/device.c index f66b5e42..dc451d03 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -51,11 +51,11 @@ * name: name of the device (must be present) * state: initial device state (usually zero) * dops: ntfs device operations to use with the device (must be present) - * private: pointer to private data (optional) + * priv_data: pointer to private data (optional) * * Allocate an ntfs device structure and pre-initialize it with the user- * specified device operations @dops, device state @state, device name @name, - * and optional private data @private. + * and optional private data @priv_data. * * Note, @name is copied and can hence be freed after this functions returns. * @@ -63,7 +63,7 @@ * error return NULL with errno set to the error code returned by malloc(). */ struct ntfs_device *ntfs_device_alloc(const char *name, const long state, - struct ntfs_device_operations *dops, void *private) + struct ntfs_device_operations *dops, void *priv_data) { struct ntfs_device *dev; @@ -82,7 +82,7 @@ struct ntfs_device *ntfs_device_alloc(const char *name, const long state, } dev->d_ops = dops; dev->d_state = state; - dev->d_private = private; + dev->d_private = priv_data; } return dev; } From 0905db9495480ea34ea759fae7f8610f326d89ad Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:23:42 +0000 Subject: [PATCH 1079/2994] Rename private to priv_data in ntfs_device_alloc() to avoid name space clashes with C++. (Yuval Fledel, modified fix by me) BKrev: 4048633eFq7vztAr7U8Kibj34d15Uw From 9d701534831accef3f1370ba9d16fa4f70e22bb3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:23:42 +0000 Subject: [PATCH 1080/2994] Update. (Logical change 1.295) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 82711e5f..c78b57f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,8 @@ xx/xx/2004 - 1.8.6-WIP - Update the build system: autogen.sh now uses autoreconf; run autoupdate && autoreconf --force and fixup the fallout damage; rename INCLUDES to AM_CPPFLAGS; add $srcdir to getgccver invocation. + - Rename private to priv_data in ntfs_device_alloc() to avoid name + space clashes with C++. (Yuval Fledel, modified fix by me) 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to From 654f3b7721d47a1e95ae57a92a639fa8d3142047 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:27:01 +0000 Subject: [PATCH 1081/2994] Rename 'opt' struct member stdout to std_out because stdout is a macro on Cygwin and compilation fails. (Yuval Fledel) (Logical change 1.296) --- ntfsprogs/ntfsclone.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index e9179fcb..4793762b 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -49,7 +49,7 @@ struct { int debug; int force; int overwrite; - int stdout; + int std_out; int blkdev_out; /* output file is block device */ int metadata_only; char *output; @@ -255,17 +255,17 @@ static void parse_options(int argc, char **argv) } if (strcmp(opt.output, "-") == 0) - opt.stdout++; + opt.std_out++; if (opt.volume == NULL) { err_printf("You must specify a device file.\n"); usage(); } - if (opt.metadata_only && opt.stdout) + if (opt.metadata_only && opt.std_out) err_exit("Cloning only metadata to stdout isn't supported!\n"); - if (!opt.stdout) { + if (!opt.std_out) { struct stat st; if (stat(opt.output, &st) == -1) { @@ -290,7 +290,7 @@ static void parse_options(int argc, char **argv) /* FIXME: this is a workaround for loosing debug info if stdout != stderr and for the uncontrollable verbose messages in libntfs. Ughhh. */ - if (opt.stdout) + if (opt.std_out) msg_out = stderr; else if (opt.debug) stderr = stdout; @@ -399,7 +399,7 @@ static void lseek_to_cluster(s64 lcn) if (vol->dev->d_ops->seek(vol->dev, pos, SEEK_SET) == (off_t)-1) perr_exit("lseek input"); - if (opt.stdout) + if (opt.std_out) return; if (lseek(fd_out, pos, SEEK_SET) == (off_t)-1) @@ -410,7 +410,7 @@ static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) { int i; - if (opt.stdout) + if (opt.std_out) return; if (!opt.metadata_only || !is_critical_metadata(image)) @@ -463,7 +463,7 @@ static void clone_ntfs(u64 nr_clusters) continue; } - if (opt.stdout) { + if (opt.std_out) { progress_update(&progress, ++p_counter); if (write_all(&fd_out, buf, csize) == -1) perr_exit("write_all"); @@ -986,7 +986,7 @@ int main(int argc, char **argv) "size (%lld)!\nCorrupt partition table or incorrect " "device partitioning?\n", device_size); - if (opt.stdout) { + if (opt.std_out) { if ((fd_out = fileno(stdout)) == -1) perr_exit("fileno for stdout failed"); } else { @@ -1037,8 +1037,8 @@ int main(int argc, char **argv) /* FIXME: save backup boot sector */ - if (opt.stdout || !opt.metadata_only) { - s64 nr_clusters = opt.stdout ? vol->nr_clusters : image.inuse; + if (opt.std_out || !opt.metadata_only) { + s64 nr_clusters = opt.std_out ? vol->nr_clusters : image.inuse; clone_ntfs(nr_clusters); fsync_clone(fd_out); From 5729164fad3b6504d5a9b985eb27b3366de88626 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:27:01 +0000 Subject: [PATCH 1082/2994] Rename 'opt' struct member stdout to std_out in ntfsclone.c because stdout is a macro on Cygwin and compilation fails. (Yuval Fledel) BKrev: 40486405bIKlyf0vdHiK_Tpx867NxA From c5543c6049cfb212d83a11964b9ccd8cc3abf9d4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:27:01 +0000 Subject: [PATCH 1083/2994] Update (Logical change 1.296) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index c78b57f0..91200acf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,8 @@ xx/xx/2004 - 1.8.6-WIP INCLUDES to AM_CPPFLAGS; add $srcdir to getgccver invocation. - Rename private to priv_data in ntfs_device_alloc() to avoid name space clashes with C++. (Yuval Fledel, modified fix by me) + - Rename 'opt' struct member stdout to std_out in ntfsclone.c because + stdout is a macro on Cygwin and compilation fails. (Yuval Fledel) 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to From 3c69e66ff881df2d7f66cfa202737b3548e85aee Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:41:37 +0000 Subject: [PATCH 1084/2994] In attribute lookup code in libntfs/attrib.c, check type against AT_UNUSED and not zero. (Logical change 1.297) --- libntfs/attrib.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index b615efab..70a61ead 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1289,8 +1289,8 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, * If @ctx->is_first is TRUE, the search begins with @ctx->attr itself. If it * is FALSE, the search begins after @ctx->attr. * - * If @type is zero (i.e. AT_UNUSED), return the first found attribute, i.e. - * one can enumerate all attributes by setting @type to zero and then calling + * If @type is AT_UNUSED, return the first found attribute, i.e. one can + * enumerate all attributes by setting @type to AT_UNUSED and then calling * ntfs_attr_find() repeatedly until it returns -1 with errno set to ENOENT to * indicate that there are no more entries. During the enumeration, each * successful call of ntfs_attr_find() will return the next attribute in the @@ -1369,7 +1369,8 @@ static int ntfs_attr_find(const ATTR_TYPES type, const uchar_t *name, break; ctx->attr = a; /* We catch $END with this more general check, too... */ - if ((type && (le32_to_cpu(a->type) > le32_to_cpu(type))) || + if (((type != AT_UNUSED) && (le32_to_cpu(a->type) > + le32_to_cpu(type))) || (a->type == AT_END)) { errno = ENOENT; return -1; @@ -1377,7 +1378,7 @@ static int ntfs_attr_find(const ATTR_TYPES type, const uchar_t *name, if (!a->length) break; /* If this is an enumeration return this attribute. */ - if (!type) + if (type == AT_UNUSED) return 0; if (a->type != type) continue; @@ -1484,8 +1485,8 @@ static int ntfs_attr_find(const ATTR_TYPES type, const uchar_t *name, * if the attribute is in a different mft record/inode, find the attribute in * there and return it. * - * If @type is zero (i.e. AT_UNUSED), return the first found attribute, i.e. - * one can enumerate all attributes by setting @type to zero and then calling + * If @type is AT_UNUSED, return the first found attribute, i.e. one can + * enumerate all attributes by setting @type to AT_UNUSED and then calling * ntfs_external_attr_find() repeatedly until it returns -1 with errno set to * ENOENT to indicate that there are no more entries. During the enumeration, * each successful call of ntfs_external_attr_find() will return the next @@ -1578,7 +1579,8 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const uchar_t *name, * the attribute list itself, need to return the attribute list * attribute. */ - if (!type && is_first_search && le16_to_cpu(al_entry->type) > + if ((type == AT_UNUSED) && is_first_search && + le16_to_cpu(al_entry->type) > le16_to_cpu(AT_ATTRIBUTE_LIST)) goto find_attr_list_attr; } else { @@ -1590,7 +1592,7 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const uchar_t *name, * attribute list attribute from the base mft record as it is * not listed in the attribute list itself. */ - if (!type && le16_to_cpu(ctx->al_entry->type) < + if ((type == AT_UNUSED) && le16_to_cpu(ctx->al_entry->type) < le16_to_cpu(AT_ATTRIBUTE_LIST) && le16_to_cpu(al_entry->type) > le16_to_cpu(AT_ATTRIBUTE_LIST)) { @@ -1654,7 +1656,7 @@ find_attr_list_attr: break; next_al_entry = (ATTR_LIST_ENTRY*)((char*)al_entry + le16_to_cpu(al_entry->length)); - if (type) { + if (type != AT_UNUSED) { if (le32_to_cpu(al_entry->type) > le32_to_cpu(type)) goto not_found; if (type != al_entry->type) @@ -1666,7 +1668,7 @@ find_attr_list_attr: * If !@type we want the attribute represented by this * attribute list entry. */ - if (!type) + if (type == AT_UNUSED) goto is_enumeration; /* * If @name is AT_UNNAMED we want an unnamed attribute. @@ -1808,7 +1810,7 @@ do_next_attr_loop: * have found it! Also, if !@type, it is an enumeration, so we * want the current attribute. */ - if (!type || !val || (!a->non_resident && + if ((type == AT_UNUSED) || !val || (!a->non_resident && le32_to_cpu(a->value_length) == val_len && !memcmp((char*)a + le16_to_cpu(a->value_offset), val, val_len))) { @@ -1841,7 +1843,7 @@ not_found: * one. Thus we just use AT_END which causes ntfs_attr_find() to seek * to the end. */ - if (!type) + if (type == AT_UNUSED) return ntfs_attr_find(AT_END, name, name_len, ic, val, val_len, ctx); /* @@ -1880,8 +1882,8 @@ not_found: * This function transparently handles attribute lists and @ctx is used to * continue searches where they were left off at. * - * If @type is zero (i.e. AT_UNUSED), return the first found attribute, i.e. - * one can enumerate all attributes by setting @type to zero and then calling + * If @type is AT_UNUSED, return the first found attribute, i.e. one can + * enumerate all attributes by setting @type to AT_UNUSED and then calling * ntfs_attr_lookup() repeatedly until it returns -1 with errno set to ENOENT * to indicate that there are no more entries. During the enumeration, each * successful call of ntfs_attr_lookup() will return the next attribute, with From 4de7c6fde0f095b692e6f686fc2b05033c3bebee Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:41:37 +0000 Subject: [PATCH 1085/2994] Make ntfs_attrs_walk() use AT_UNUSED and CASE_SENSITIVE instead of zero when calling ntfs_lookup() for type checking correctness. (Yuval Fledel) (Logical change 1.297) --- include/ntfs/attrib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 155f9bb9..402694ce 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -117,7 +117,8 @@ extern ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol, */ static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx) { - return ntfs_attr_lookup(0, NULL, 0, 0, 0, NULL, 0, ctx); + return ntfs_attr_lookup(AT_UNUSED, NULL, 0, CASE_SENSITIVE, 0, + NULL, 0, ctx); } /** From 88609677fd16253774d86cd44eea402f8cf8f557 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:41:37 +0000 Subject: [PATCH 1086/2994] Make ntfs_attrs_walk() use AT_UNUSED and CASE_SENSITIVE instead of zero when calling ntfs_lookup() for type checking correctness. (Yuval Fledel) In attribute lookup code in libntfs/attrib.c, check type against AT_UNUSED and not zero. BKrev: 40486771LHDy46YxgQ1hvUUpK2k5ow From 0260c6db9c81c4f31cf70bbc32fda3522fd790c8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 11:41:37 +0000 Subject: [PATCH 1087/2994] Update (Logical change 1.297) --- ChangeLog | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 91200acf..6ea8ce4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,7 +19,12 @@ xx/xx/2004 - 1.8.6-WIP - Rename private to priv_data in ntfs_device_alloc() to avoid name space clashes with C++. (Yuval Fledel, modified fix by me) - Rename 'opt' struct member stdout to std_out in ntfsclone.c because - stdout is a macro on Cygwin and compilation fails. (Yuval Fledel) + stdout is a macro on Cygwin and compilation fails. (Yuval Fledel) + - Make ntfs_attrs_walk() use AT_UNUSED and CASE_SENSITIVE instead of + zero when calling ntfs_lookup() for type checking correctness. (Yuval + Fledel) + - In attribute lookup code in libntfs/attrib.c, check type against + AT_UNUSED and not zero. 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to From 2658aaa398738735a04dd96c664a64fda9cf1efe Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 23:19:25 +0000 Subject: [PATCH 1088/2994] Add AC_CANONICAL_HOST([]) to configure.ac and after AC_PROG_CC add manual provision of CC=gcc, AR=ar, and LD=ld if they are not set and the target is *-*-*djgpp. (Requested by Christophe Grenier) (Logical change 1.298) --- configure.ac | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index cee539c3..55df15df 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,7 @@ AC_PREREQ(2.57) AC_INIT([ntfsprogs],[1.8.6-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADERS([config.h]) @@ -37,14 +38,14 @@ AM_ENABLE_STATIC # but doesn't. So this sets host and erases nonopt effectively moving the # standalone command line option into the --host= form. if test "x$nonopt" != "xNONE"; then - host="$nonopt" - nonopt="NONE" + host="$nonopt" + nonopt="NONE" fi AC_PREFIX_DEFAULT(/usr/local) if test "x$prefix" = "xNONE"; then - prefix=$ac_default_prefix - ac_configure_args="$ac_configure_args --prefix $prefix" + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix $prefix" fi # Command-line options. @@ -98,6 +99,14 @@ AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_LIBTOOL +case "$target" in +*-*-*djgpp) + if test -z "$CC"; then CC=gcc; fi + if test -z "$AR"; then AR=ar; fi + if test -z "$LD"; then LD=ld; fi +;; +esac + # Enable large file support. AC_SYS_LARGEFILE From 4c58805dbf9bff5c0a8ea9e35695cfead8663520 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 23:19:25 +0000 Subject: [PATCH 1089/2994] Add AC_CANONICAL_HOST([]) to configure.ac and after AC_PROG_CC add manual provision of CC=gcc, AR=ar, and LD=ld if they are not set and the target is *-*-*djgpp. (Requested by Christophe Grenier) BKrev: 40490afdVA7BUL7-q11Cv7hRLr9Sxg From 71943895e4c1e9dfe9eb9c67a001046b27236177 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 5 Mar 2004 23:19:25 +0000 Subject: [PATCH 1090/2994] Update (Logical change 1.298) --- ChangeLog | 3 +++ configure | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ea8ce4c..17a180fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,9 @@ xx/xx/2004 - 1.8.6-WIP Fledel) - In attribute lookup code in libntfs/attrib.c, check type against AT_UNUSED and not zero. + - Add AC_CANONICAL_HOST([]) to configure.ac and after AC_PROG_CC add + manual provision of CC=gcc, AR=ar, and LD=ld if they are not set and + the target is *-*-*djgpp. (Requested by Christophe Grenier) 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to diff --git a/configure b/configure index b824233f..79fe4950 100755 --- a/configure +++ b/configure @@ -2050,14 +2050,14 @@ fi; # but doesn't. So this sets host and erases nonopt effectively moving the # standalone command line option into the --host= form. if test "x$nonopt" != "xNONE"; then - host="$nonopt" - nonopt="NONE" + host="$nonopt" + nonopt="NONE" fi if test "x$prefix" = "xNONE"; then - prefix=$ac_default_prefix - ac_configure_args="$ac_configure_args --prefix $prefix" + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix $prefix" fi # Command-line options. @@ -18509,6 +18509,14 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +case "$target" in +*-*-*djgpp) + if test -z "$CC"; then CC=gcc; fi + if test -z "$AR"; then AR=ar; fi + if test -z "$LD"; then LD=ld; fi +;; +esac # Enable large file support. # Check whether --enable-largefile or --disable-largefile was given. From fdacd9951856558d66a7efae0408739b44b21ae1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1091/2994] Add attribute and inode options to ntfscat (Szaka, modified by me). (Logical change 1.299) --- ntfsprogs/ntfscat.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ntfsprogs/ntfscat.h b/ntfsprogs/ntfscat.h index babd74f3..f93b4691 100644 --- a/ntfsprogs/ntfscat.h +++ b/ntfsprogs/ntfscat.h @@ -26,10 +26,13 @@ #define _NTFSCAT_H_ #include "types.h" +#include "layout.h" struct options { char *device; /* Device/File to work with */ char *file; /* File to display */ + ATTR_TYPES attr; /* Attribute type to display */ + s64 inode; /* Inode to work with */ int force; /* Override common sense */ int quiet; /* Less output */ int verbose; /* Extra output */ From 2da888cefe0b0c12c9cd9379a2cdaf6e75654649 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1092/2994] Auto merged 2003/12/03 18:23:31+00:00 flatcap.org!ntfs fix: output option was being ignored (Logical change 1.299) --- ntfsprogs/ntfsundelete.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 682257eb..4d3e823b 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -1388,6 +1388,7 @@ int undelete_file (ntfs_volume *vol, long long inode) int fd = -1; long long k; int result = 0; + char *name; if (!vol) return 0; @@ -1434,7 +1435,12 @@ int undelete_file (ntfs_volume *vol, long long inode) list_for_each (item, &file->data) { struct data *d = list_entry (item, struct data, list); - create_pathname (opts.dest, file->pref_name, d->name, pathname, sizeof (pathname)); + if (opts.output) + name = opts.output; + else + name = file->pref_name; + + create_pathname (opts.dest, name, d->name, pathname, sizeof (pathname)); if (d->resident) { fd = open_file (pathname); if (fd < 0) { From d6c51bf64cd791d1bfeb9a2ff777b1caa1971eb4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1093/2994] Auto merged 2004/01/07 15:48:41+00:00 cantab.net!aia21 Auto merged 2003/11/02 23:22:27+00:00 flatcap.org!ntfs declare [EQV]printf 2003/10/29 18:13:30+00:00 flatcap.org!ntfs added dump_mem (Logical change 1.299) --- ntfsprogs/utils.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 94a4bfb9..e605da63 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -46,6 +46,10 @@ extern const char *ntfs_gpl; # define REG_NOERROR 0 #endif +#define DEC_PRINTF(NAME) \ + int NAME (const char *format, ...) \ + __attribute__ ((format (printf, 1, 2))); + #define GEN_PRINTF(NAME, STREAM, CONTROL, TRIGGER) \ __attribute__ ((format (printf, 1, 2))) \ int NAME (const char *format, ...) \ @@ -82,6 +86,7 @@ int utils_cluster_in_use (ntfs_volume *vol, long long lcn); int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref); int utils_is_metadata (ntfs_inode *inode); ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, const char *pathname); +void utils_dump_mem (u8 *buf, int start, int length, int ascii); time_t ntfs2utc (s64 ntfs_time); s64 utc2ntfs (time_t utc_time); From c4105e54e746edc2810be5705dab5a49aa67ed4b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1094/2994] Auto merged 2004/01/07 15:48:41+00:00 cantab.net!aia21 Auto merged 2004/01/06 14:43:22+00:00 cantab.net!aia21 Auto merged 2003/11/19 00:40:18+00:00 flatcap.org!ntfs Auto merged 2003/10/29 18:13:30+00:00 flatcap.org!ntfs add dump_mem remove junk that wasn't being used (Logical change 1.299) --- ntfsprogs/utils.c | 106 ++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 59 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 4854ebfb..19c18e2c 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -38,6 +38,7 @@ #endif #include #include +#include #include "config.h" #include "utils.h" @@ -864,6 +865,52 @@ int utils_is_metadata (ntfs_inode *inode) return 0; } +/** + * utils_dump_mem - Display a block of memory in hex and ascii + * @buf: Buffer to be displayed + * @start: Offset into @buf to start from + * @length: Number of bytes to display + * @ascii: Whether or not to display the ascii values + * + * Display a block of memory in a tradition hex-dump manner. + * Optionally the ascii part can be turned off. + */ +void utils_dump_mem (u8 *buf, int start, int length, int ascii) +{ + int off, i, s, e; + + s = start & ~15; // round down + e = (start + length + 15) & ~15; // round up + + for (off = s; off < e; off += 16) { + if (off == s) + printf("%6.6x ", start); + else + printf("%6.6x ", off); + + for (i = 0; i < 16; i++) { + if (i == 8) + printf (" -"); + if (((off+i) >= start) && ((off+i) < (start+length))) + printf (" %02X", buf[off+i]); + else + printf (" "); + } + if (ascii) { + printf (" "); + for (i = 0; i < 16; i++) { + if (((off+i) < start) || ((off+i) >= (start+length))) + printf (" "); + else if (isprint (buf[off + i])) + printf ("%c", buf[off + i]); + else + printf ("."); + } + } + printf ("\n"); + } +} + /** * mft_get_search_ctx @@ -1021,62 +1068,3 @@ int mft_next_record (struct mft_search_ctx *ctx) } -#if 0 -hamming weight -inline unsigned int hweight32(unsigned int w) -{ - unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); - res = (res & 0x33333333) + ((res >> 2) & 0x33333333); - res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F); - res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF); - return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF); -} - -inline unsigned int hweight16(unsigned int w) -{ - unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555); - res = (res & 0x3333) + ((res >> 2) & 0x3333); - res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F); - return (res & 0x00FF) + ((res >> 8) & 0x00FF); -} - -inline unsigned int hweight8(unsigned int w) -{ - unsigned int res = (w & 0x55) + ((w >> 1) & 0x55); - res = (res & 0x33) + ((res >> 2) & 0x33); - return (res & 0x0F) + ((res >> 4) & 0x0F); -} - -inline int set_bit(int nr,long * addr) -{ - int mask, retval; - - addr += nr >> 5; - mask = 1 << (nr & 0x1f); - retval = (mask & *addr) != 0; - *addr |= mask; - return retval; -} - -inline int clear_bit(int nr, long * addr) -{ - int mask, retval; - - addr += nr >> 5; - mask = 1 << (nr & 0x1f); - retval = (mask & *addr) != 0; - *addr &= ~mask; - return retval; -} - -inline int test_bit(int nr, long * addr) -{ - int mask; - - addr += nr >> 5; - mask = 1 << (nr & 0x1f); - return ((mask & *addr) != 0); -} - -#endif - From 001054baa9e21a1bb05d647a5fb758e4a78592ff Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1095/2994] Auto merged 2004/01/15 16:58:19+00:00 cantab.net!aia21 Auto merged 2003/10/28 15:55:31+00:00 flatcap.org!ntfs typo (Logical change 1.299) --- libntfs/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index 4d4af184..2a5f7b90 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -32,7 +32,7 @@ /** - * ntfs_bitmap_set_bits_in__run - set a run of bits in a bitmap to a value + * ntfs_bitmap_set_bits_in_run - set a run of bits in a bitmap to a value * @na: attribute containing the bitmap * @start_bit: first bit to set * @count: number of bits to set From 1564a5b72e47b91c1f917179db48270ba9d36111 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1096/2994] Auto merged 2004/01/15 16:58:19+00:00 cantab.net!aia21 Auto merged 2004/01/07 15:48:41+00:00 cantab.net!aia21 Auto merged 2003/11/04 13:06:21+00:00 cantab.net!aia21 Auto merged 2003/10/28 15:55:31+00:00 flatcap.org!ntfs move comment to help folding (Logical change 1.299) --- libntfs/lcnalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index f6ad5708..a616e8af 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -33,7 +33,6 @@ #include "volume.h" #include "lcnalloc.h" - /** * ntfs_cluster_alloc - allocate clusters on an ntfs volume * @vol: mounted ntfs volume on which to allocate the clusters @@ -88,10 +87,11 @@ * removing the duplicate logic requires _very_ careful consideration of _all_ * possible code paths. So at least for now, I am leaving the double logic - * better safe than sorry... (AIA) + * + * FIXME: Add a start_vcn parameter if we need it and then instead of setting + * rl[rlpos].vcn = 0; for the first run, add a sparse start element (LCN_HOLE), + * and make rl[rlpos].vcn = start_vcn; for the first non-sparse run. (AIA) */ -// FIXME: Add a start_vcn parameter if we need it and then instead of setting -// rl[rlpos].vcn = 0; for the first run, add a sparse start element (LCN_HOLE), -// and make rl[rlpos].vcn = start_vcn; for the first non-sparse run. (AIA) runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, const NTFS_CLUSTER_ALLOCATION_ZONES zone) { From 5205fae60f57bb2a201ea7aeeed073a063dbee3e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1097/2994] Auto merged 2004/02/17 18:14:43+00:00 cantab.net!aia21 Manual merge 2004/02/17 06:22:34+02:00 omakaista.fi!szaka BLKGETSIZE ioctl uses unsigned long, not long for the size parameter. Thus the maximum supported device is 2 TB on 32 bit platforms now instead of only 1 TB. (Logical change 1.299) From 402df7a21e8216d96bbdc9efd2647a4b6c8fee32 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1098/2994] Auto merged 2004/02/20 14:44:47+00:00 cantab.net!aia21 Auto merged 2004/01/15 16:58:19+00:00 cantab.net!aia21 Auto merged 2004/01/07 15:48:41+00:00 cantab.net!aia21 Auto merged 2004/01/05 12:39:36+00:00 cantab.net!aia21 Auto merged 2003/12/05 18:09:00+00:00 cantab.net!aia21 Auto merged 2003/12/03 12:41:54+00:00 cantab.net!aia21 Auto merged 2003/11/04 13:06:21+00:00 cantab.net!aia21 Auto merged 2003/10/28 15:55:31+00:00 flatcap.org!ntfs a few tweaks to help folding (Logical change 1.299) --- libntfs/runlist.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 7ef1c0d9..cec4f337 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -63,7 +63,7 @@ static __inline__ void ntfs_rl_mc(runlist_element *dstbase, int dst, /** * Internal: * - * ntfs_rl_realloc - Reallocate memory for runlists* + * ntfs_rl_realloc - Reallocate memory for runlists * @rl: original runlist * @old_size: number of runlist elements in the original runlist @rl * @new_size: number of runlist elements we need space for @@ -268,7 +268,8 @@ static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, /* disc => Discontinuity between the end of @dst and the start of @src. * This means we might need to insert a hole. * hole => @dst ends with a hole or an unmapped region which we can - * extend to match the discontinuity. */ + * extend to match the discontinuity. + */ if (loc == 0) disc = (src[0].vcn > 0); else { @@ -286,7 +287,8 @@ static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, } /* Space required: @dst size + @src size, less one if we merged, plus - * one if there was a discontinuity, less one for a trailing hole. */ + * one if there was a discontinuity, less one for a trailing hole. + */ dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - left + disc - hole); if (!dst) return dst; @@ -378,7 +380,8 @@ static __inline__ runlist_element *ntfs_rl_replace(runlist_element *dst, left = ntfs_rl_are_mergeable(dst + loc - 1, src); /* Allocate some space. We'll need less if the left, right, or both - * ends were merged. */ + * ends were merged. + */ dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - left - right); if (!dst) return dst; @@ -649,7 +652,8 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, /* Add an unmapped runlist element. */ if (!slots) { /* FIXME/TODO: We need to have the - * extra memory already! (AIA) */ + * extra memory already! (AIA) + */ drl = ntfs_rl_realloc(drl, ds, ds + 2); if (!drl) goto critical_error; @@ -669,7 +673,8 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, ds++; if (!slots) { /* FIXME/TODO: We need to have the extra - * memory already! (AIA) */ + * memory already! (AIA) + */ drl = ntfs_rl_realloc(drl, ds, ds + 1); if (!drl) goto critical_error; From b0fa32a8e70352fd44c9dc7aa5921b887d72524c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1099/2994] Auto merged 2004/02/25 14:43:29+00:00 cantab.net!aia21 Merge rename: include/Makefile.in -> include/ntfs/Makefile.in (Logical change 1.299) From d55b3f83c5133e48bbec2a140aeefd37aa95b189 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1100/2994] Auto merged 2004/02/25 14:43:31+00:00 cantab.net!aia21 Auto merged 2003/11/19 16:05:20+00:00 cantab.net!aia21 Auto merged 2003/11/02 23:22:27+00:00 flatcap.org!ntfs add cluster to the build 2003/10/28 15:48:10+00:00 flatcap.org!ntfs add ntfsmove to the build (Logical change 1.299) --- ntfsprogs/Makefile.am | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 5e1f2456..1976407f 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -13,7 +13,7 @@ LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfsmove man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ @@ -55,7 +55,7 @@ ntfsclone_SOURCES = ntfsclone.c utils.c utils.h ntfsclone_LDADD = $(AM_LIBS) ntfsclone_LDFLAGS = $(AM_LFLAGS) -ntfscluster_SOURCES = ntfscluster.c ntfscluster.h utils.c utils.h +ntfscluster_SOURCES = ntfscluster.c ntfscluster.h cluster.c cluster.h utils.c utils.h ntfscluster_LDADD = $(AM_LIBS) ntfscluster_LDFLAGS = $(AM_LFLAGS) @@ -73,6 +73,10 @@ ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) +ntfsmove_SOURCES = ntfsmove.c ntfsmove.h utils.c utils.h +ntfsmove_LDADD = $(AM_LIBS) +ntfsmove_LDFLAGS = $(AM_LFLAGS) + ntfswipe_SOURCES = ntfswipe.c ntfswipe.h utils.c utils.h ntfswipe_LDADD = $(AM_LIBS) ntfswipe_LDFLAGS = $(AM_LFLAGS) From 7cad421d4049ca8cf49ec575f5b73d9447cb8d00 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1101/2994] Auto merged 2004/02/25 14:43:31+00:00 cantab.net!aia21 Auto merged 2004/01/26 11:18:38+00:00 cantab.net!aia21 Auto merged 2004/01/15 16:58:18+00:00 cantab.net!aia21 Auto merged 2004/01/09 12:39:22+00:00 cantab.net!aia21 Auto merged 2004/01/06 16:51:51+00:00 cantab.net!aia21 Auto merged 2003/11/19 16:38:20+00:00 cantab.net!aia21 Update after merge. 2003/11/19 00:40:18+00:00 flatcap.org!ntfs Auto merged 2003/11/07 18:26:20+00:00 cantab.net!aia21 Auto merged 2003/11/07 10:16:23+00:00 cantab.net!aia21 Auto merged 2003/11/06 16:33:05+00:00 cantab.net!aia21 Auto merged 2003/11/06 11:31:07+00:00 cantab.net!aia21 Auto merged 2003/11/04 13:14:19+00:00 cantab.net!aia21 Auto merged 2003/11/04 13:10:10+00:00 cantab.net!aia21 Update build (Logical change 1.299) From 8140d928d7609b0fe2dc021f9f4e0a026fde5fd2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1102/2994] Auto merged 2004/02/25 14:43:31+00:00 cantab.net!aia21 Auto merged 2004/02/25 14:43:29+00:00 cantab.net!aia21 Merge rename: include/support.h -> include/ntfs/support.h (Logical change 1.299) --- include/ntfs/support.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ntfs/support.h b/include/ntfs/support.h index 72f797b5..a9e92cf7 100644 --- a/include/ntfs/support.h +++ b/include/ntfs/support.h @@ -36,7 +36,7 @@ #endif /* - * The classical min and max macros. + * The classic min and max macros. */ #ifndef min #define min(a,b) ((a) <= (b) ? (a) : (b)) From 799ae391659f0db7c8e75d280179bd212f561d43 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1103/2994] Auto merged 2004/02/25 14:43:31+00:00 cantab.net!aia21 Auto merged 2004/02/25 14:43:30+00:00 cantab.net!aia21 Merge rename: include/attrib.h -> include/ntfs/attrib.h (Logical change 1.299) From 7569534a3e942a77d6df18b321ac4540c362a3d1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1104/2994] Auto merged 2004/02/27 17:36:16+00:00 cantab.net!aia21 Auto merged 2004/02/17 18:14:14+00:00 cantab.net!aia21 Manual merge 2004/02/17 06:22:34+02:00 omakaista.fi!szaka BLKGETSIZE ioctl uses unsigned long, not long for the size parameter. Thus the maximum supported device is 2 TB on 32 bit platforms now instead of only 1 TB. (Logical change 1.299) From 9351c4b16874e3ebf649c7943efb46f19af8952c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1105/2994] Auto merged 2004/03/04 17:04:07+00:00 cantab.net!aia21 Auto merged 2004/02/20 14:44:46+00:00 cantab.net!aia21 Auto merged 2004/01/22 23:55:32+00:00 cantab.net!aia21 Auto merged 2004/01/21 12:36:41+00:00 cantab.net!aia21 Auto merged 2004/01/19 09:10:18+00:00 cantab.net!aia21 Auto merged 2004/01/15 16:58:18+00:00 cantab.net!aia21 Auto merged 2004/01/13 11:25:24+00:00 cantab.net!aia21 Remove conflicting ntfs_attr_pread_compressed prototype. 2004/01/11 18:02:45+00:00 cantab.net!aia21 Auto merged 2004/01/09 12:40:52+00:00 cantab.net!aia21 merge 2004/01/07 15:48:41+00:00 cantab.net!aia21 Auto merged 2003/12/09 17:36:24+00:00 cantab.net!aia21 Auto merged 2003/12/03 15:39:34+00:00 cantab.net!aia21 Auto merged 2003/11/19 16:05:20+00:00 cantab.net!aia21 Auto merged 2003/11/04 13:06:21+00:00 cantab.net!aia21 Auto merged 2003/10/29 17:44:01+00:00 cantab.net!aia21 Auto merged 2003/10/28 15:49:32+00:00 flatcap.org!ntfs port compression code from the new driver (Logical change 1.299) From b37c41267151317a9e8611ea782b2779f442bdde Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1106/2994] Auto merged 2004/03/04 17:04:37+00:00 cantab.net!aia21 merge 2004/02/27 17:37:05+00:00 cantab.net!aia21 merge 2004/02/26 11:42:14+00:00 cantab.net!aia21 Auto merged 2004/02/25 14:43:30+00:00 cantab.net!aia21 Auto merged 2004/02/20 14:44:45+00:00 cantab.net!aia21 Auto merged 2004/01/26 11:20:15+00:00 cantab.net!aia21 merge 2004/01/26 11:19:22+00:00 cantab.net!aia21 manual merge 2004/01/22 23:55:45+00:00 cantab.net!aia21 merge 2004/01/21 12:38:43+00:00 cantab.net!aia21 Fallout from merge. 2004/01/21 12:37:28+00:00 cantab.net!aia21 merge 2004/01/15 17:02:30+00:00 cantab.net!aia21 Run ./autogen.sh on SuSE 9.0. 2004/01/15 16:58:48+00:00 cantab.net!aia21 merge 2004/01/09 12:40:52+00:00 cantab.net!aia21 merge 2004/01/07 15:51:43+00:00 cantab.net!aia21 update configure 2004/01/07 15:49:24+00:00 cantab.net!aia21 manual merger 2004/01/06 16:52:55+00:00 cantab.net!aia21 manual merge 2004/01/06 14:43:22+00:00 cantab.net!aia21 Auto merged 2004/01/06 11:55:15+00:00 cantab.net!aia21 Manual merge 2004/01/06 11:04:48+00:00 cantab.net!aia21 Auto merged 2003/11/19 16:38:20+00:00 cantab.net!aia21 Update after merge. 2003/11/19 16:07:10+00:00 cantab.net!aia21 merge 2003/11/10 22:16:26+00:00 cantab.net!aia21 SCCS merged 2003/11/07 18:26:20+00:00 cantab.net!aia21 Auto merged 2003/11/07 10:16:23+00:00 cantab.net!aia21 Auto merged 2003/11/06 16:33:05+00:00 cantab.net!aia21 Auto merged 2003/11/04 13:10:10+00:00 cantab.net!aia21 Update configure. 2003/11/04 13:08:37+00:00 cantab.net!aia21 Ignore this. Will fix in a moment by running ./autogen.sh 2003/10/27 15:30:05+00:00 cantab.net!aia21 Update version to 1.9-devel. (Logical change 1.299) --- configure | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 79fe4950..c93746ed 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.8.6-WIP. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.9-devel. # # Report bugs to . # @@ -422,8 +422,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.8.6-WIP' -PACKAGE_STRING='ntfsprogs 1.8.6-WIP' +PACKAGE_VERSION='1.9-devel' +PACKAGE_STRING='ntfsprogs 1.9-devel' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -954,7 +954,7 @@ 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 ntfsprogs 1.8.6-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.9-devel to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1021,7 +1021,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.8.6-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.9-devel:";; esac cat <<\_ACEOF @@ -1136,7 +1136,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.8.6-WIP +ntfsprogs configure 1.9-devel generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1151,7 +1151,7 @@ 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 ntfsprogs $as_me 1.8.6-WIP, which was +It was created by ntfsprogs $as_me 1.9-devel, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1845,7 +1845,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.8.6-WIP' + VERSION='1.9-devel' cat >>confdefs.h <<_ACEOF @@ -21913,7 +21913,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.8.6-WIP, which was +This file was extended by ntfsprogs $as_me 1.9-devel, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21976,7 +21976,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.8.6-WIP +ntfsprogs config.status 1.9-devel configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" From 476ec32ef89eebdc380b95ee01566e5fc012a8f5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1107/2994] Auto merged 2004/03/04 17:05:35+00:00 cantab.net!aia21 manual merge fallout. 2004/03/04 17:04:08+00:00 cantab.net!aia21 Auto merged 2004/02/27 17:41:05+00:00 cantab.net!aia21 merge fall out 2004/02/27 17:36:16+00:00 cantab.net!aia21 Auto merged 2004/02/26 11:42:15+00:00 cantab.net!aia21 Auto merged 2004/02/25 14:45:54+00:00 cantab.net!aia21 update 2004/02/25 14:43:31+00:00 cantab.net!aia21 Auto merged 2004/01/26 11:20:15+00:00 cantab.net!aia21 merge 2004/01/26 11:18:38+00:00 cantab.net!aia21 Auto merged 2004/01/22 23:55:32+00:00 cantab.net!aia21 Auto merged 2004/01/21 12:36:41+00:00 cantab.net!aia21 Auto merged 2004/01/15 17:02:30+00:00 cantab.net!aia21 Run ./autogen.sh on SuSE 9.0. 2004/01/15 16:58:19+00:00 cantab.net!aia21 Auto merged 2003/11/19 16:05:20+00:00 cantab.net!aia21 Auto merged 2003/11/07 18:26:20+00:00 cantab.net!aia21 Auto merged 2003/11/07 10:16:23+00:00 cantab.net!aia21 Auto merged 2003/11/04 13:06:21+00:00 cantab.net!aia21 Auto merged 2003/11/02 23:22:27+00:00 flatcap.org!ntfs add cluster to the build 2003/10/28 15:48:10+00:00 flatcap.org!ntfs add ntfsmove to the build (Logical change 1.299) --- ntfsprogs/Makefile.in | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 86fce4dc..9ab31413 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -158,7 +158,7 @@ LINK = $(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate +EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfsmove man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ @@ -201,7 +201,7 @@ ntfsclone_SOURCES = ntfsclone.c utils.c utils.h ntfsclone_LDADD = $(AM_LIBS) ntfsclone_LDFLAGS = $(AM_LFLAGS) -ntfscluster_SOURCES = ntfscluster.c ntfscluster.h utils.c utils.h +ntfscluster_SOURCES = ntfscluster.c ntfscluster.h cluster.c cluster.h utils.c utils.h ntfscluster_LDADD = $(AM_LIBS) ntfscluster_LDFLAGS = $(AM_LFLAGS) @@ -219,6 +219,10 @@ ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) +ntfsmove_SOURCES = ntfsmove.c ntfsmove.h utils.c utils.h +ntfsmove_LDADD = $(AM_LIBS) +ntfsmove_LDFLAGS = $(AM_LFLAGS) + ntfswipe_SOURCES = ntfswipe.c ntfswipe.h utils.c utils.h ntfswipe_LDADD = $(AM_LIBS) ntfswipe_LDFLAGS = $(AM_LFLAGS) @@ -238,7 +242,7 @@ CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 \ ntfsresize.8 ntfsundelete.8 EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) dumplog$(EXEEXT) \ - ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) + ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ ntfsls$(EXEEXT) ntfscat$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) ntfsundelete$(EXEEXT) \ @@ -270,7 +274,8 @@ ntfsclone_OBJECTS = $(am_ntfsclone_OBJECTS) @REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@ntfsclone_DEPENDENCIES = \ @REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) utils.$(OBJEXT) +am_ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) cluster.$(OBJEXT) \ + utils.$(OBJEXT) ntfscluster_OBJECTS = $(am_ntfscluster_OBJECTS) @REALLYSTATIC_TRUE@ntfscluster_DEPENDENCIES = \ @REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a @@ -306,6 +311,12 @@ ntfsls_OBJECTS = $(am_ntfsls_OBJECTS) @REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@ntfsls_DEPENDENCIES = \ @REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +am_ntfsmove_OBJECTS = ntfsmove.$(OBJEXT) utils.$(OBJEXT) +ntfsmove_OBJECTS = $(am_ntfsmove_OBJECTS) +@REALLYSTATIC_TRUE@ntfsmove_DEPENDENCIES = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@ntfsmove_DEPENDENCIES = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la am_ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) utils.$(OBJEXT) ntfsresize_OBJECTS = $(am_ntfsresize_OBJECTS) @REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ @@ -336,13 +347,13 @@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrdef.Po ./$(DEPDIR)/boot.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/dumplog.Po ./$(DEPDIR)/mkntfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfscat.Po ./$(DEPDIR)/ntfsclone.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfscluster.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/cluster.Po ./$(DEPDIR)/dumplog.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/mkntfs.Po ./$(DEPDIR)/ntfscat.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsclone.Po ./$(DEPDIR)/ntfscluster.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsdump_logfile.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsfix.Po ./$(DEPDIR)/ntfsinfo.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfslabel.Po ./$(DEPDIR)/ntfsls.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsresize.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsmove.Po ./$(DEPDIR)/ntfsresize.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfstruncate.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsundelete.Po ./$(DEPDIR)/ntfswipe.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/sd.Po ./$(DEPDIR)/upcase.Po \ @@ -356,8 +367,9 @@ DIST_SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) \ $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ - $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) \ - $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) + $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) \ + $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ + $(ntfswipe_SOURCES) NROFF = nroff MANS = $(man_MANS) @@ -365,7 +377,7 @@ DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfscat.8.in \ ntfsclone.8.in ntfscluster.8.in ntfsfix.8.in ntfsinfo.8.in \ ntfslabel.8.in ntfsls.8.in ntfsprogs.8.in ntfsresize.8.in \ ntfsundelete.8.in -SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) +SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) all: all-am @@ -486,6 +498,9 @@ ntfslabel$(EXEEXT): $(ntfslabel_OBJECTS) $(ntfslabel_DEPENDENCIES) ntfsls$(EXEEXT): $(ntfsls_OBJECTS) $(ntfsls_DEPENDENCIES) @rm -f ntfsls$(EXEEXT) $(LINK) $(ntfsls_LDFLAGS) $(ntfsls_OBJECTS) $(ntfsls_LDADD) $(LIBS) +ntfsmove$(EXEEXT): $(ntfsmove_OBJECTS) $(ntfsmove_DEPENDENCIES) + @rm -f ntfsmove$(EXEEXT) + $(LINK) $(ntfsmove_LDFLAGS) $(ntfsmove_OBJECTS) $(ntfsmove_LDADD) $(LIBS) ntfsresize$(EXEEXT): $(ntfsresize_OBJECTS) $(ntfsresize_DEPENDENCIES) @rm -f ntfsresize$(EXEEXT) $(LINK) $(ntfsresize_LDFLAGS) $(ntfsresize_OBJECTS) $(ntfsresize_LDADD) $(LIBS) @@ -507,6 +522,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attrdef.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boot.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cluster.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumplog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkntfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscat.Po@am__quote@ @@ -517,6 +533,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfslabel.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsls.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmove.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsresize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfstruncate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsundelete.Po@am__quote@ From 6636c33a6d622724c3775123a9314b1f1ff70b1c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1108/2994] Fix signed/unsigned warnings. 2004/01/06 11:56:52+00:00 cantab.net!aia21 Add attribute and inode options to ntfscat (Szaka, modified by me). 2003/11/13 14:52:41+00:00 cantab.net!aia21 Merge 2003/10/28 15:50:53+00:00 flatcap.org!ntfs prepare to cat other attributes (Logical change 1.299) --- ntfsprogs/ntfscat.c | 117 ++++++++++++++++++++++++++++++++------------ 1 file changed, 85 insertions(+), 32 deletions(-) diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index c58edbd6..727cc98e 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -40,7 +40,7 @@ static const char *EXEC_NAME = "ntfscat"; static struct options opts; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) GEN_PRINTF (Printf, stderr, NULL, FALSE) @@ -69,17 +69,17 @@ void version (void) */ void usage (void) { - Printf ("\nUsage: %s [options] device file\n" - " -f --force Use less caution\n" - " -h --help Print this help\n" - " -q --quiet Less output\n" - " -V --version Version information\n" - " -v --verbose More output\n\n", - //" -A --attribute Display this attribute", - //" -I --file Display this file", - //" -F --inode Display this inode", - //" -N --name Display this attribute name", - //" -r --raw Display the compressed or encrypted file", + Printf ("\nUsage: %s [options] device [file]\n\n" + " -a, --attribute num Display this attribute\n" + " -i, --inode num Display this inode\n\n" + " -f --force Use less caution\n" + " -h --help Print this help\n" + " -q --quiet Less output\n" + " -V --version Version information\n" + " -v --verbose More output\n\n", + //" -N --name Display this attribute name", + //" -F --file Display this file", + //" -r --raw Display the compressed or encrypted file", EXEC_NAME); Printf ("%s%s\n", ntfs_bugs, ntfs_home); } @@ -95,16 +95,16 @@ void usage (void) */ int parse_options (int argc, char **argv) { - static const char *sopt = "-fh?qVv"; // A:F:I:N: + static const char *sopt = "-a:fh?i:qVv"; // F:N: static const struct option lopt[] = { + { "attribute", required_argument, NULL, 'a' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, + { "inode", required_argument, NULL, 'i' }, { "quiet", no_argument, NULL, 'q' }, { "version", no_argument, NULL, 'V' }, { "verbose", no_argument, NULL, 'v' }, - // { "attribute", required_argument, NULL, 'A' }, // { "file", required_argument, NULL, 'F' }, - // { "inode", required_argument, NULL, 'I' }, // { "name", required_argument, NULL, 'N' }, { NULL, 0, NULL, 0 } }; @@ -113,9 +113,13 @@ int parse_options (int argc, char **argv) int err = 0; int ver = 0; int help = 0; + s64 attr; opterr = 0; /* We'll handle the errors, thank you. */ + opts.inode = -1; + opts.attr = -1; + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { case 1: /* A non-option argument */ @@ -124,11 +128,21 @@ int parse_options (int argc, char **argv) } else if (!opts.file) { opts.file = argv[optind-1]; } else { - opts.device = NULL; - opts.file = NULL; + Eprintf("You must specify exactly one file.\n"); err++; } break; + case 'a': + if (opts.attr != (ATTR_TYPES)-1) + Eprintf("You must specify exactly one attribute.\n"); + else if (utils_parse_size(argv[optind-1], &attr, FALSE)) { + opts.attr = (ATTR_TYPES)attr; + break; + } else + Eprintf("Couldn't parse attribute number.\n"); + err++; + break; + case 'f': opts.force++; break; @@ -136,6 +150,15 @@ int parse_options (int argc, char **argv) case '?': help++; break; + case 'i': + if (opts.inode != -1) + Eprintf("You must specify exactly one inode.\n"); + else if (utils_parse_size(argv[optind-1], &opts.inode, FALSE)) + break; + else + Eprintf("Couldn't parse inode number.\n"); + err++; + break; case 'q': opts.quiet++; break; @@ -155,10 +178,17 @@ int parse_options (int argc, char **argv) if (help || ver) { opts.quiet = 0; } else { - if ((opts.device == NULL) || - (opts.file == NULL)) { - if (argc > 1) - Eprintf ("You must specify one device and one file.\n"); + if (opts.device == NULL) { + Eprintf ("You must specify a device.\n"); + err++; + + } else if (opts.file == NULL && opts.inode == -1) { + Eprintf ("You must specify a file or inode " + "with the -i option.\n"); + err++; + + } else if (opts.file != NULL && opts.inode != -1) { + Eprintf ("You can't specify both a file and inode.\n"); err++; } @@ -180,19 +210,20 @@ int parse_options (int argc, char **argv) /** * cat */ -int cat (ntfs_volume *vol, ntfs_inode *inode) +int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, uchar_t *name, int namelen) { - const int bufsize = 1024; + /* increase 1024 only if you fix partial writes below */ + const int bufsize = 1024; char *buffer; ntfs_attr *attr; - s64 read; + s64 read, written; s64 offset; buffer = malloc (bufsize); if (!buffer) return 1; - attr = ntfs_attr_open (inode, AT_DATA, NULL, 0); + attr = ntfs_attr_open (inode, type, NULL, 0); if (!attr) { Eprintf ("Cannot cat a directory.\n"); free (buffer); @@ -200,11 +231,22 @@ int cat (ntfs_volume *vol, ntfs_inode *inode) } offset = 0; - do { + for (;;) { read = ntfs_attr_pread (attr, offset, bufsize, buffer); - fwrite (buffer, read, 1, stdout); + if (read == -1) { + perror ("ERROR: Couldn't read file"); + break; + } + if (!read) + break; + + written = fwrite (buffer, 1, read, stdout); + if (written != read) { + perror ("ERROR: Couldn't output all data!"); + break; + } offset += read; - } while (read > 0); + } ntfs_attr_close (attr); free (buffer); @@ -223,6 +265,7 @@ int main (int argc, char *argv[]) { ntfs_volume *vol; ntfs_inode *inode; + ATTR_TYPES attr; int result = 1; if (!parse_options (argc, argv)) @@ -230,19 +273,29 @@ int main (int argc, char *argv[]) utils_set_locale(); + //XXX quieten errors, temporarily + vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); if (!vol) { - Printf ("!vol\n"); + perror("ERROR: couldn't mount volume"); return 1; } - inode = utils_pathname_to_inode (vol, NULL, opts.file); + if (opts.inode != -1) + inode = ntfs_inode_open (vol, opts.inode); + else + inode = utils_pathname_to_inode (vol, NULL, opts.file); + if (!inode) { - Printf ("!inode\n"); + perror("ERROR: Couldn't open inode"); return 1; } - result = cat (vol, inode); + attr = AT_DATA; + if (opts.attr != (ATTR_TYPES)-1) + attr = opts.attr; + + result = cat (vol, inode, attr, NULL, 0); ntfs_inode_close (inode); ntfs_umount (vol, FALSE); From 76364af60e6935caaea93fc48faf9ddddf36983b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1109/2994] Initial revision --- ntfsprogs/ntfsmove.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ntfsprogs/ntfsmove.c diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c new file mode 100644 index 00000000..e69de29b From e37d6644b21540c4744a8ca3485d1a40c11bcb5e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1110/2994] Fix what seems to be a cut'n'paste error... bitmap_alloc instead of bitmap_free 2003/10/31 18:10:18+00:00 flatcap.org!ntfs big reorganisation extra options will move any attributes now, including dirs (prevented it touching metadata) 2003/10/29 18:13:30+00:00 flatcap.org!ntfs move dump_mem to utils 2003/10/28 15:48:10+00:00 flatcap.org!ntfs (Logical change 1.299) --- ntfsprogs/ntfsmove.c | 874 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 874 insertions(+) diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index e69de29b..bcd44eeb 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -0,0 +1,874 @@ +/** + * ntfsmove - Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Richard Russon + * Copyright (c) 2003 Anton Altaparmakov + * + * This utility will move files on an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "types.h" +#include "attrib.h" +#include "utils.h" +#include "volume.h" +#include "debug.h" +#include "dir.h" +#include "bitmap.h" +#include "ntfsmove.h" + +static const char *EXEC_NAME = "ntfsmove"; +static struct options opts; + +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) + +#define RED "" +#define YELLOW "" +#define GREEN "" +#define NORM "" + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + printf ("\n%s v%s - Move files and directories on an NTFS volume.\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c) 2003 Richard Russon\n"); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + printf ("\nUsage: %s [options] device file\n" + "\n" + " -S --start Move to the start of the volume\n" + " -B --best Move to the best place on the volume\n" + " -E --end Move to the end of the volume\n" + " -C num --cluster num Move to this cluster offset\n" + "\n" + " -D --no-dirty Do not mark volume dirty (require chkdsk)\n" + " -n --no-action Do not write to disk\n" + " -f --force Use less caution\n" + " -h --help Print this help\n" + " -q --quiet Less output\n" + " -V --version Version information\n" + " -v --verbose More output\n\n", + EXEC_NAME); + printf ("%s%s\n", ntfs_bugs, ntfs_home); +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char **argv) +{ + static const char *sopt = "-BC:DEfh?nqSVv"; + static const struct option lopt[] = { + { "best", no_argument, NULL, 'B' }, + { "cluster", required_argument, NULL, 'C' }, + { "end", no_argument, NULL, 'E' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "no-action", no_argument, NULL, 'n' }, + { "no-dirty", no_argument, NULL, 'D' }, + { "quiet", no_argument, NULL, 'q' }, + { "start", no_argument, NULL, 'S' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + int err = 0; + int ver = 0; + int help = 0; + char *end = NULL; + + opterr = 0; /* We'll handle the errors, thank you. */ + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else if (!opts.file) { + opts.file = argv[optind-1]; + } else { + opts.device = NULL; + opts.file = NULL; + err++; + } + break; + case 'B': + if (opts.location == 0) + opts.location = NTFS_MOVE_LOC_BEST; + else + opts.location = -1; + break; + case 'C': + if (opts.location == 0) { + opts.location = strtoll (optarg, &end, 0); + if (end && *end) + err++; + } else { + opts.location = -1; + } + break; + case 'D': + opts.nodirty++; + break; + case 'E': + if (opts.location == 0) + opts.location = NTFS_MOVE_LOC_END; + else + opts.location = -1; + break; + case 'f': + opts.force++; + break; + case 'h': + case '?': + help++; + break; + case 'n': + opts.noaction++; + break; + case 'q': + opts.quiet++; + break; + case 'S': + if (opts.location == 0) + opts.location = NTFS_MOVE_LOC_START; + else + opts.location = -1; + break; + case 'V': + ver++; + break; + case 'v': + opts.verbose++; + break; + default: + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if ((opts.device == NULL) || + (opts.file == NULL)) { + if (argc > 1) + Eprintf ("You must specify one device and one file.\n"); + err++; + } + + if (opts.quiet && opts.verbose) { + Eprintf("You may not use --quiet and --verbose at the " + "same time.\n"); + err++; + } + + if (opts.location == -1) { + Eprintf ("You may only specify one location option: " + "--start, --best, --end or --cluster\n"); + err++; + } else if (opts.location == 0) { + opts.location = NTFS_MOVE_LOC_BEST; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + + +/** + * ntfs_debug_runlist_dump2 - Dump a runlist. + */ +int ntfs_debug_runlist_dump2 (const runlist *rl, int abbr, char *prefix) +{ + //int abbr = 3; /* abbreviate long lists */ + int len = 0; + int i; + int res = 0; + u64 total = 0; + const char *lcn_str[5] = { "HOLE", "NOTMAP", "ENOENT", "EINVAL", "XXXX" }; + + if (!rl) { + printf(" Run list not present.\n"); + return 0; + } + + if (!prefix) + prefix = ""; + + if (abbr) + for (len = 0; rl[len].length; len++) ; + + printf("%s VCN LCN len\n", prefix); + for (i = 0; rl->length; i++, rl++) { + LCN lcn = rl->lcn; + + total += rl->length; + if (abbr) + if (len > 20) { + if ((i == abbr) && (len > (abbr*2))) + printf ("%s ... ... ...\n", prefix); + if ((i > (abbr-1)) && (i < (len - (abbr-1)))) + continue; + } + + if (rl->vcn < -1) + res = -1; + + if (lcn < (LCN)0) { + int index = -lcn - 1; + + if ((index < 0) || (index > 4)) { + index = 4; + res = -1; + } + printf("%s%8lld %8s %8lld\n", prefix, + rl->vcn, lcn_str[index], rl->length); + } else + printf("%s%8lld %8lld %8lld\n", prefix, + rl->vcn, rl->lcn, rl->length); + } + printf ("%s --------\n", prefix); + printf ("%s %8lld\n", prefix, total); + printf ("\n"); + return res; +} + +/** + * resize_nonres_attr + */ +int resize_nonres_attr (MFT_RECORD *m, ATTR_RECORD *a, const u32 new_size) +{ + int this_attr; + int next_attr; + int tail_size; + int file_size; + int old_size; + u8 *ptr; + + old_size = a->length; + file_size = m->bytes_in_use; + this_attr = p2n(a)-p2n(m); + next_attr = this_attr + a->length; + tail_size = file_size - next_attr; + ptr = (u8*) m; + + /* + printf ("old_size = %d\n", old_size); + printf ("new_size = %d\n", new_size); + printf ("file_size = %d\n", file_size); + printf ("this_attr = %d\n", this_attr); + printf ("next_attr = %d\n", next_attr); + printf ("tail_size = %d\n", tail_size); + */ + + memmove (ptr + this_attr + new_size, ptr + next_attr, tail_size); + + a->length = new_size; + m->bytes_in_use += new_size - old_size; + + return 0; +} + +/** + * calc_attr_length + */ +int calc_attr_length (ATTR_RECORD *rec, int runlength) +{ + int size; + + if (!rec) + return -1; + if (!rec->non_resident) + return -1; + + size = rec->mapping_pairs_offset + runlength + 7; + size &= 0xFFF8; + return size; +} + +/** + * dump_runs + */ +void dump_runs (u8 *buffer, int len) +{ + int i; + printf ("RUN: "); + + for (i = 0; i < len; i++) { + printf (" %02x", buffer[i]); + } + printf ("\n"); +} + +/** + * find_unused + */ +runlist * find_unused (ntfs_volume *vol, s64 size, u64 loc, int flags) +{ + const int bufsize = 8192; + u8 *buffer; + int clus; + int read; + int i; + int j; + int curr = 0; + int count = 0; + s64 start = 0; + int bit = 0; + runlist *res = NULL; + + //printf ("find_unused\n"); + buffer = malloc (bufsize); + if (!buffer) { + printf ("!buffer\n"); + return NULL; + } + + //printf ("looking for space for %lld clusters\n", size); + + clus = vol->lcnbmp_na->allocated_size / bufsize; + //printf ("clus = %d\n", clus); + + for (i = 0; i < clus; i++) { + read = ntfs_attr_pread (vol->lcnbmp_na, i*bufsize, bufsize, buffer); + if (read != bufsize) { + printf ("!read\n"); + return NULL; + } + for (j = 0; j < bufsize*8; j++) { + bit = !!test_bit (j & 7, buffer[j>>3]); + if (curr == bit) { + count++; + if ((!bit) && (count >= size)) { + //res = calloc (2, sizeof (*res)); + res = calloc (1, 4096); + if (res) { + res[0].vcn = 0; + res[0].lcn = start; + res[0].length = size; + res[1].lcn = LCN_ENOENT; + } + goto done; + } + } else { + //printf ("%d * %d\n", curr, count); + curr = bit; + count = 1; + start = i*bufsize*8 + j; + } + } + } +done: + //printf ("%d * %d\n", curr, count); + + free (buffer); + + if (res) { + for (i = 0; i < size; i++) { + if (utils_cluster_in_use (vol, res->lcn + i)) { + printf ("ERROR cluster %lld in use\n", res->lcn + i); + } + } + } else { + printf ("failed\n"); + } + + return res; +} + +/** + * dont_move + * + * Don't let the user move: + * ANY metadata + * Any fragmented MFT records + * The boot file 'ntldr' + */ +int dont_move (ntfs_inode *ino) +{ + static const uchar_t ntldr[6] = { + const_cpu_to_le16('n'), const_cpu_to_le16('t'), const_cpu_to_le16('l'), + const_cpu_to_le16('d'), const_cpu_to_le16('r'), const_cpu_to_le16('\0') + }; + + ATTR_RECORD *rec; + FILE_NAME_ATTR *name; + + if (utils_is_metadata (ino)) { + Eprintf ("metadata\n"); + return 1; + } + + rec = find_first_attribute (AT_ATTRIBUTE_LIST, ino->mrec); + if (rec) { + Eprintf ("attribute list\n"); + return 1; + } + + rec = find_first_attribute (AT_FILE_NAME, ino->mrec); + if (!rec) { + Eprintf ("extend inode\n"); + return 1; + } + + name = (FILE_NAME_ATTR*) ((u8*)rec + rec->value_offset); + if (ntfs_names_are_equal (ntldr, 5, name->file_name, name->file_name_length, + IGNORE_CASE, ino->vol->upcase, ino->vol->upcase_len)) { + Eprintf ("ntldr\n"); + return 1; + } + + return 0; +} + + +/** + * bitmap_alloc + */ +int bitmap_alloc (ntfs_volume *vol, runlist_element *rl) +{ + int res; + + if (!rl) + return -1; + + res = ntfs_bitmap_set_run (vol->lcnbmp_na, rl->lcn, rl->length); + if (res < 0) { + Eprintf ("bitmap alloc returns %d\n", res); + } + + return res; +} + +/** + * bitmap_free + */ +int bitmap_free (ntfs_volume *vol, runlist_element *rl) +{ + int res; + + if (!rl) + return -1; + + res = ntfs_bitmap_clear_run (vol->lcnbmp_na, rl->lcn, rl->length); + if (res < 0) { + Eprintf ("bitmap free returns %d\n", res); + } + + return res; +} + +/** + * data_copy + */ +int data_copy (ntfs_volume *vol, runlist_element *from, runlist_element *to) +{ + int i; + u8 *buffer; + s64 res = 0; + + if (!vol || !from || !to) + return -1; + if ((from->length != to->length) || (from->lcn < 0) || (to->lcn < 0)) + return -1; + + //printf ("data_copy: from 0x%llx to 0x%llx\n", from->lcn, to->lcn); + buffer = malloc (vol->cluster_size); + if (!buffer) { + printf ("!buffer\n"); + return -1; + } + + for (i = 0; i < from->length; i++) { + //printf ("read cluster at %8lld\n", from->lcn+i); + res = ntfs_pread (vol->dev, (from->lcn+i) * vol->cluster_size, vol->cluster_size, buffer); + if (res != vol->cluster_size) { + Eprintf ("!read\n"); + res = -1; + break; + } + + //printf ("write cluster to %8lld\n", to->lcn+i); + res = ntfs_pwrite (vol->dev, (to->lcn+i) * vol->cluster_size, vol->cluster_size, buffer); + if (res != vol->cluster_size) { + Eprintf ("!write %lld\n", res); + res = -1; + break; + } + } + + free (buffer); + return res; +} + +/** + * move_runlist + * + * validate: + * runlists are the same size + * from in use + * to not in use + * allocate new space + * copy data + * deallocate old space + */ +s64 move_runlist (ntfs_volume *vol, runlist_element *from, runlist_element *to) +{ + int i; + + if (!vol || !from || !to) + return -1; + if (from->length != to->length) { + Eprintf ("diffsizes\n"); + return -1; + } + + if ((from->lcn < 0) || (to->lcn < 0)) { + Eprintf ("invalid runs\n"); + return -1; + } + + for (i = 0; i < from->length; i++) { + if (!utils_cluster_in_use (vol, from->lcn+i)) { + Eprintf ("from not in use\n"); + return -1; + } + } + + for (i = 0; i < to->length; i++) { + if (utils_cluster_in_use (vol, to->lcn+i)) { + Eprintf ("to is in use\n"); + return -1; + } + } + + if (bitmap_alloc (vol, to) < 0) { + Eprintf ("cannot bitmap_alloc\n"); + return -1; + } + + if (data_copy (vol, from, to) < 0) { + Eprintf ("cannot data_copy\n"); + return -1; + } + + if (bitmap_free (vol, from) < 0) { + Eprintf ("cannot bitmap_free\n"); + return -1; + } + + return 0; +} + + +/**original + * move_datarun + * > 0 Bytes moved / size to be moved + * = 0 Nothing to do + * < 0 Error + */ + +// get size of runlist +// find somewhere to put data +// backup original runlist +// move the data + +// got to get the runlist out of this function +// requires a mrec arg, not an ino (ino->mrec will do for now) +// check size of new runlist before allocting / moving +// replace one datarun with another (by hand) +s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, runlist_element *run, u64 loc, int flags) +{ + runlist *from; + runlist *to; + int need_from; + int need_to; + int i; + s64 res = -1; + + // find empty space + to = find_unused (vol, run->length, loc, flags); + if (!to) { + Eprintf ("!to\n"); + return -1; + } + + to->vcn = run->vcn; + + // copy original runlist + from = ntfs_mapping_pairs_decompress (vol, rec, NULL); + if (!from) { + printf ("!from\n"); + return -1; + } + + printf ("move %lld,%lld,%lld to %lld,%lld,%lld\n", run->vcn, run->lcn, run->length, to->vcn, to->lcn, to->length); + + need_from = ntfs_get_size_for_mapping_pairs (vol, from); + printf ("orig data run = %d bytes\n", need_from); + + //ntfs_debug_runlist_dump2 (from, 5, "\t"); + + for (i = 0; to[i].length > 0; i++) { + if (from[i].vcn == run->vcn) { + from[i].lcn = to->lcn; + break; + } + } + + //ntfs_debug_runlist_dump2 (from, 5, "\t"); + + need_to = ntfs_get_size_for_mapping_pairs (vol, from); + printf ("new data run = %d bytes\n", need_to); + + need_from = calc_attr_length (rec, need_from); + need_to = calc_attr_length (rec, need_to); + + printf (RED "Before %d, after %d\n" NORM, need_from, need_to); + + if (need_from != need_to) { + if (resize_nonres_attr (ino->mrec, rec, need_to) < 0) { + printf ("!resize\n"); + return -1; + } + } + + res = move_runlist (vol, run, to); + if (res < 0) { + Eprintf ("!move_runlist\n"); + return -1; + } + + // wipe orig runs + memset (((u8*)rec) +rec->mapping_pairs_offset, 0, need_to - rec->mapping_pairs_offset); + + // update data runs + ntfs_mapping_pairs_build (vol, ((u8*)rec) + rec->mapping_pairs_offset, need_to, from); + + // commit + ntfs_inode_mark_dirty (ino); + + if (ntfs_inode_sync (ino) < 0) { + printf ("!sync\n"); + return -1; + } + + free (from); + free (to); + return res; +} + +/** + * move_attribute + * > 0 Bytes moved / size to be moved + * = 0 Nothing to do + * < 0 Error + */ +s64 move_attribute (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, u64 loc, int flags) +{ + int i; + s64 res; + s64 count = 0; + runlist *runs; + + // NTFS_MOVE_LOC_BEST : assess how much space this attribute will need, + // find that space and pass the location to our children. + // Anything else we pass directly to move_datarun. + + runs = ntfs_mapping_pairs_decompress (vol, rec, NULL); + if (!runs) { + Eprintf ("!runs\n"); + return -1; + } + + //ntfs_debug_runlist_dump2 (runs, 5, "\t"); + + //printf (" VCN LCN Length\n"); + for (i = 0; runs[i].length > 0; i++) { + if (runs[i].lcn == LCN_RL_NOT_MAPPED) { + continue; + } + + res = move_datarun (vol, ino, rec, runs+i, loc, flags); + //printf (" %8lld %8lld %8lld\n", runs[i].vcn, runs[i].lcn, runs[i].length); + if (res < 0) { + Eprintf ("!move_datarun\n"); + count = res; + break; + } + count += res; + } + + return count; +} + +/** + * move_file + * > 0 Bytes moved / size to be moved + * = 0 Nothing to do + * < 0 Error + */ +s64 move_file (ntfs_volume *vol, ntfs_inode *ino, u64 loc, int flags) +{ + char *buffer; + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *rec; + s64 res; + s64 count = 0; + + buffer = malloc (MAX_PATH); + if (!buffer) { + Eprintf ("Out of memory\n"); + return -1; + } + + utils_inode_get_name (ino, buffer, MAX_PATH); + + if (dont_move (ino)) { + Eprintf ("can't move\n"); + return -1; + } + + printf ("Moving %s\n", buffer); + + // NTFS_MOVE_LOC_BEST : assess how much space all the attributes will need, + // find that space and pass the location to our children. + // Anything else we pass directly to move_attribute. + + ctx = ntfs_attr_get_search_ctx (ino, NULL); + + while ((rec = find_attribute (AT_UNUSED, ctx))) { + utils_attr_get_name (vol, rec, buffer, MAX_PATH); + printf ("\tAttribute 0x%02x %s is ", rec->type, buffer); + + if (rec->non_resident) { + printf ("non-resident. Moving it.\n"); + + res = move_attribute (vol, ino, rec, loc, flags); + if (res < 0) { + count = res; + break; + } + count += res; + } else { + printf ("resident.\n\t\tSkipping it.\n"); + } + } + + ntfs_attr_put_search_ctx (ctx); + free (buffer); + return count; +} + + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main (int argc, char *argv[]) +{ + ntfs_volume *vol; + ntfs_inode *inode; + int flags = 0; + int result = 1; + s64 count; + + if (!parse_options (argc, argv)) + return 1; + + utils_set_locale(); + + if (opts.noaction) + flags |= MS_RDONLY; + + vol = utils_mount_volume (opts.device, flags, opts.force); + if (!vol) { + printf ("!vol\n"); + return 1; + } + + inode = utils_pathname_to_inode (vol, NULL, opts.file); + if (!inode) { + printf ("!inode\n"); + return 1; + } + + count = move_file (vol, inode, opts.location, 0); + if ((count > 0) && (!opts.nodirty)) { + if (ntfs_volume_set_flags (vol, VOLUME_IS_DIRTY) < 0) { + Eprintf ("Couldn't mark volume dirty\n"); + } + printf ("Relocated %lld bytes\n", count); + } + if (count >= 0) + result = 0; + + if (result) + printf ("failed\n"); + else + printf ("success\n"); + + ntfs_inode_close (inode); + ntfs_umount (vol, FALSE); + return result; +} + From 06ed41eb5f43daba469c0d52751211178093ff6a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1111/2994] Manual merge. 2004/03/04 17:04:37+00:00 cantab.net!aia21 merge 2004/02/27 17:37:06+00:00 cantab.net!aia21 merge 2004/02/26 11:42:14+00:00 cantab.net!aia21 Auto merged 2004/02/25 14:43:30+00:00 cantab.net!aia21 Auto merged 2004/02/20 14:44:45+00:00 cantab.net!aia21 Auto merged 2004/01/26 11:19:22+00:00 cantab.net!aia21 manual merge 2004/01/22 23:56:16+00:00 cantab.net!aia21 merge 2004/01/21 12:37:28+00:00 cantab.net!aia21 merge 2004/01/09 12:40:52+00:00 cantab.net!aia21 merge 2004/01/07 15:49:24+00:00 cantab.net!aia21 manual merger 2004/01/06 16:52:55+00:00 cantab.net!aia21 manual merge 2004/01/06 14:43:22+00:00 cantab.net!aia21 Auto merged 2004/01/06 11:55:15+00:00 cantab.net!aia21 Manual merge 2004/01/06 11:04:48+00:00 cantab.net!aia21 Auto merged 2003/11/19 16:07:10+00:00 cantab.net!aia21 merge 2003/11/10 22:17:15+00:00 cantab.net!aia21 merge 2003/11/07 18:26:20+00:00 cantab.net!aia21 Auto merged 2003/11/07 10:16:23+00:00 cantab.net!aia21 Auto merged 2003/11/06 16:33:05+00:00 cantab.net!aia21 Auto merged 2003/11/04 13:08:37+00:00 cantab.net!aia21 Merge 2003/10/27 15:30:05+00:00 cantab.net!aia21 Update version to 1.9-devel. (Logical change 1.299) --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 55df15df..03f57728 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT([ntfsprogs],[1.8.6-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.9-devel],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) From 584bf82ed7538ccbb3891fead95e729b7938ec18 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1112/2994] Merge 2004/03/04 17:05:36+00:00 cantab.net!aia21 manual merge fallout. 2004/03/04 17:04:38+00:00 cantab.net!aia21 merge 2004/02/27 17:41:05+00:00 cantab.net!aia21 merge fallout 2004/02/27 17:37:06+00:00 cantab.net!aia21 merge 2004/02/26 15:01:44+00:00 cantab.net!aia21 Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/02/26 13:48:29+00:00 cantab.net!aia21 Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/02/26 12:08:38+00:00 cantab.net!aia21 Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/02/26 11:42:15+00:00 cantab.net!aia21 Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/02/25 17:15:05+00:00 cantab.net!aia21 Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/02/25 14:46:10+00:00 cantab.net!aia21 Makefile.in: update 2004/02/25 14:43:32+00:00 cantab.net!aia21 Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/02/20 14:44:48+00:00 cantab.net!aia21 Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/02/17 18:14:49+00:00 cantab.net!aia21 Merge 2004/02/17 06:22:34+02:00 omakaista.fi!szaka BLKGETSIZE ioctl uses unsigned long, not long for the size parameter. Thus the maximum supported device is 2 TB on 32 bit platforms now instead of only 1 TB. 2004/02/09 09:25:34+02:00 omakaista.fi!szaka Added some related utils to ntfsclone manual's "SEE ALSO" section. 2004/02/09 09:13:04+02:00 omakaista.fi!szaka Almost completely rewritten ntfsresize manual, extended with the data relocation related issues. 2004/02/05 16:51:32+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2004/01/30 11:40:10+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2004/01/27 02:13:09+02:00 omakaista.fi!szaka Added relocation support with the continuous help of Miguel Lastra and his collegues at the University of Granada, Dewey M. Sasser, Erik Meade, Martin Fick, Sandro Hawke, Dave Croal, Lorrin Nelson, Geert Hendrickx, Robert Bjorkman and Richard Burdick. 2004/01/26 11:20:16+00:00 cantab.net!aia21 merge 2004/01/26 11:19:22+00:00 cantab.net!aia21 manual merge 2004/01/22 23:57:01+00:00 cantab.net!aia21 Merge 2004/01/22 14:56:58+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2004/01/21 12:38:43+00:00 cantab.net!aia21 Fallout from merge. 2004/01/21 12:37:28+00:00 cantab.net!aia21 merge 2004/01/19 15:58:17+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2004/01/19 09:10:18+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2004/01/15 17:08:16+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2004/01/15 17:02:31+00:00 cantab.net!aia21 Run ./autogen.sh on SuSE 9.0. 2004/01/15 16:58:49+00:00 cantab.net!aia21 merge 2004/01/13 11:26:54+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2004/01/13 11:25:24+00:00 cantab.net!aia21 Remove conflicting ntfs_attr_pread_compressed prototype. Nothing like a bit of duplicated work. Oh well, never mind. 2004/01/13 11:21:09+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2004/01/11 18:02:45+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2004/01/09 12:40:52+00:00 cantab.net!aia21 merge 2004/01/07 15:51:43+00:00 cantab.net!aia21 update configure 2004/01/07 15:49:24+00:00 cantab.net!aia21 merge 2004/01/06 16:52:55+00:00 cantab.net!aia21 manual merge 2004/01/06 14:43:22+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2004/01/06 11:59:00+00:00 cantab.net!aia21 Fix signed/unsigned warnings. 2004/01/06 11:56:52+00:00 cantab.net!aia21 Add attribute and inode options to ntfscat (Szaka, modified by me). 2004/01/06 11:55:15+00:00 cantab.net!aia21 Manual merge 2004/01/06 11:04:48+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2004/01/05 12:39:36+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/12/09 17:36:24+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/12/05 18:09:01+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/12/03 18:27:21+00:00 flatcap.org!ntfs Merge bk://add/ntfsprogs-devel into flatcap.org:/home/flatcap/work/ntfsprogs-devel 2003/12/03 18:23:31+00:00 flatcap.org!ntfs fix: output option was being ignored 2003/12/03 15:39:34+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/12/03 12:41:54+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/11/19 16:38:21+00:00 cantab.net!aia21 Update after merge. 2003/11/19 16:07:11+00:00 cantab.net!aia21 merge 2003/11/19 00:49:13+00:00 flatcap.org!ntfs one more sign problem 2003/11/19 00:42:29+00:00 flatcap.org!ntfs fix minor build warnings 2003/11/13 14:52:41+00:00 cantab.net!aia21 Merge 2003/11/12 18:16:17+00:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/work/ntfsprogs into flatcap.org:/home/flatcap/work/ntfsprogs-devel 2003/11/10 22:17:19+00:00 cantab.net!aia21 Merge 2003/11/07 18:26:20+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/11/07 10:16:24+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/11/06 17:35:37+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/11/06 16:34:37+00:00 cantab.net!aia21 Fix etc/ignore again... 2003/11/06 16:33:05+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/11/06 12:32:42+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/11/06 11:31:07+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/11/04 13:14:19+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/11/04 13:13:01+00:00 cantab.net!aia21 Update ignore file back to sanity. 2003/11/04 13:10:10+00:00 cantab.net!aia21 Update build 2003/11/04 13:08:37+00:00 cantab.net!aia21 Merge 2003/11/03 19:39:29+00:00 flatcap.org!ntfs Merge ssh://linux-ntfs@bkbits.net/ntfsprogs-devel into flatcap.org:/root/web/bk/ntfsprogs-devel 2003/11/03 09:35:39+00:00 cantab.net!aia21 ntfsmove.c: Fix what seems to be a cut'n'paste error... bitmap_alloc instead of bitmap_free 2003/11/02 23:22:28+00:00 flatcap.org!ntfs move cluster_find into a separate module (so others can use it) make it use a callback 2003/10/31 18:12:04+00:00 flatcap.org!ntfs Merge bk://add/ntfsprogs-devel into flatcap.org:/mnt/work/ntfsprogs-devel 2003/10/31 18:10:18+00:00 flatcap.org!ntfs move is more generic, not much safer yet 2003/10/29 19:19:05+00:00 flatcap.org!ntfs Merge ssh://linux-ntfs@bkbits.net/ntfsprogs-devel into flatcap.org:/root/web/bk/ntfsprogs-devel 2003/10/29 18:13:43+00:00 flatcap.org!ntfs move dump_mem 2003/10/29 17:44:01+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/10/29 14:46:14+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/10/29 13:34:28+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/10/29 14:32:00+00:00 flatcap.org!ntfs Merge ssh://linux-ntfs@bkbits.net/ntfsprogs-devel into flatcap.org:/root/web/bk/ntfsprogs-devel 2003/10/29 13:30:18+00:00 flatcap.org!ntfs updates from Szaka 2003/10/29 13:15:54+00:00 cantab.net!aia21 Merge cantab.net:/home/aia21/ntfsprogs into cantab.net:/home/aia21/ntfsprogs-devel 2003/10/29 10:25:42+00:00 flatcap.org!ntfs display cluster info about a file / inode 2003/10/28 15:56:43+00:00 flatcap.org!ntfs Merge bk://add/ntfsprogs-devel-rich into flatcap.org:/mnt/work/ntfsprogs-devel-rich 2003/10/28 15:55:31+00:00 flatcap.org!ntfs minor tidyups 2003/10/28 15:50:53+00:00 flatcap.org!ntfs minor tool updates 2003/10/28 15:49:33+00:00 flatcap.org!ntfs port compression code from the new driver (it compiles, it isn't plumbed in yet) 2003/10/28 15:48:10+00:00 flatcap.org!ntfs new tool ntfsmove - relocate a file 2003/10/27 15:30:05+00:00 cantab.net!aia21 Update version to 1.9-devel. BKrev: 404a0d84YklPbJxsrcWBSkX5OjqvSQ From 7f95c1db70521a088e4922c6688f3e0c1c1285b7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1113/2994] auto-union 2003/11/06 16:34:37+00:00 cantab.net!aia21 Fix etc/ignore again... 2003/11/06 16:33:04+00:00 cantab.net!aia21 auto-union 2003/11/04 13:13:01+00:00 cantab.net!aia21 Update ignore file back to sanity. 2003/11/04 13:06:20+00:00 cantab.net!aia21 auto-union 2003/10/28 15:48:10+00:00 flatcap.org!ntfs ignore new build target (Logical change 1.299) --- BitKeeper/etc/ignore | 53 ++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index ed2d4cb9..7a5cffd4 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -1,38 +1,33 @@ + # Bitkeeper -BitKeeper/*/* -PENDING/* - # configure -autom4te.cache/* -Makefile -*/Makefile -libntfs/libntfs.conf -libntfs/*.8 -ntfsprogs/*.8 -config.log -config.h -config.h.in~ -config.cache -config.status -stamp-h -stamp-h1 -libtool -ntfsprogs.spec - # general build products +# specific programs +*/*.o +*/.*swp */.deps/* */.libs/* -*/*.o -libntfs/*.l? -tags -TAGS -*/tags +*/Makefile */TAGS +*/tags .*swp -*/.*swp +BitKeeper/*/* +Makefile +PENDING/* +TAGS +autom4te.cache/* +config.cache +config.h +config.h.in~ +config.log +config.status +libntfs/*.8 +libntfs/*.l? +libntfs/libntfs.conf +libtool ntfsprogs-*.tar.gz - -# specific programs +ntfsprogs.spec +ntfsprogs/*.8 ntfsprogs/dumplog ntfsprogs/mkntfs ntfsprogs/ntfscat @@ -43,7 +38,11 @@ ntfsprogs/ntfsfix ntfsprogs/ntfsinfo ntfsprogs/ntfslabel ntfsprogs/ntfsls +ntfsprogs/ntfsmove ntfsprogs/ntfsresize ntfsprogs/ntfstruncate ntfsprogs/ntfsundelete ntfsprogs/ntfswipe +stamp-h +stamp-h1 +tags From c6b229f6d40ffcaae87e26eae5562d7101fded06 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1114/2994] (Logical change 1.299) --- ntfsprogs/cluster.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 ntfsprogs/cluster.h diff --git a/ntfsprogs/cluster.h b/ntfsprogs/cluster.h new file mode 100644 index 00000000..f3fdebe7 --- /dev/null +++ b/ntfsprogs/cluster.h @@ -0,0 +1,39 @@ +/* + * cluster - Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Richard Russon + * + * This function will locate the owner of any given sector or cluster range. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _CLUSTER_H_ +#define _CLUSTER_H_ + +#include "types.h" +#include "volume.h" + +typedef struct { + int x; +} ntfs_cluster; + +typedef int (cluster_cb) (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void *data); + +int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void *data); + +#endif /* _CLUSTER_H_ */ + From 65182be2728df67f6d4ed8593062bde0f9035c5e Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1115/2994] Auto merged 2003/10/28 15:50:53+00:00 flatcap.org!ntfs some cut'n'pasted code to wipe the pagefile and logfile (Logical change 1.299) --- ntfsprogs/ntfswipe.c | 169 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 151 insertions(+), 18 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 7772ade4..7bc21341 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -340,7 +340,6 @@ int parse_options (int argc, char *argv[]) return (!err && !help && !ver); } - /** * wipe_unused - Wipe unused clusters * @vol: An ntfs volume obtained from ntfs_mount @@ -427,6 +426,8 @@ s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) */ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) { + // by considering the individual attributes we might be able to + // wipe a few more bytes at the attr's tail. s64 i; s64 total = 0; s64 result = 0; @@ -461,8 +462,6 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) continue; } - - memset (buffer + size, byte, vol->mft_record_size - size); result = ntfs_attr_mst_pwrite (vol->mft_na, vol->mft_record_size * i, @@ -573,10 +572,91 @@ s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) */ s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act) { + const int NTFS_BUF_SIZE2 = 8192; + //FIXME(?): We might need to zero the LSN field of every single mft + //record as well. (But, first try without doing that and see what + //happens, since chkdsk might pickup the pieces and do it for us...) + ntfs_inode *ni; + ntfs_attr *na; + s64 len, pos, count; + char buf[NTFS_BUF_SIZE2]; + int eo; + if (!vol || (byte < 0)) return -1; - Qprintf ("wipe_logfile (not implemented) 0x%02x\n", byte); + //Qprintf ("wipe_logfile (not implemented) 0x%02x\n", byte); + + if ((ni = ntfs_inode_open(vol, FILE_LogFile)) == NULL) { + Dprintf("Failed to open inode FILE_LogFile.\n"); + return -1; + } + + if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) { + Dprintf("Failed to open $FILE_LogFile/$DATA\n"); + goto error_exit; + } + + /* The $DATA attribute of the $LogFile has to be non-resident. */ + if (!NAttrNonResident(na)) { + Dprintf("$LogFile $DATA attribute is resident!?!\n"); + errno = EIO; + goto io_error_exit; + } + + /* Get length of $LogFile contents. */ + len = na->data_size; + if (!len) { + Dprintf("$LogFile has zero length, no disk write needed.\n"); + return 0; + } + + /* Read $LogFile until its end. We do this as a check for correct + length thus making sure we are decompressing the mapping pairs + array correctly and hence writing below is safe as well. */ + pos = 0; + while ((count = ntfs_attr_pread(na, pos, NTFS_BUF_SIZE2, buf)) > 0) + pos += count; + + if (count == -1 || pos != len) { + Dprintf("Amount of $LogFile data read does not " + "correspond to expected length!"); + if (count != -1) + errno = EIO; + goto io_error_exit; + } + + /* Fill the buffer with 0xff's. */ + memset(buf, -1, NTFS_BUF_SIZE2); + + /* Set the $DATA attribute. */ + pos = 0; + while ((count = len - pos) > 0) { + if (count > NTFS_BUF_SIZE2) + count = NTFS_BUF_SIZE2; + + if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { + Dprintf("Failed to set the $LogFile attribute value."); + if (count != -1) + errno = EIO; + goto io_error_exit; + } + + pos += count; + } + + ntfs_attr_close(na); + return ntfs_inode_close(ni); + +io_error_exit: + eo = errno; + ntfs_attr_close(na); + errno = eo; +error_exit: + eo = errno; + ntfs_inode_close(ni); + errno = eo; + return -1; return 0; } @@ -593,13 +673,75 @@ s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act) */ s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act) { + // wipe completely, chkdsk doesn't do anything, booting writes header + const int NTFS_BUF_SIZE2 = 4096; + ntfs_inode *ni; + ntfs_attr *na; + s64 len, pos, count; + char buf[NTFS_BUF_SIZE2]; + int eo; + if (!vol || (byte < 0)) return -1; - Qprintf ("wipe_pagefile (not implemented) 0x%02x\n", byte); - return 0; -} + //Qprintf ("wipe_pagefile (not implemented) 0x%02x\n", byte); + + ni = utils_pathname_to_inode (vol, NULL, "pagefile.sys"); + if (!ni) { + Dprintf("Failed to open inode FILE_LogFile.\n"); + return -1; + } + if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) { + Dprintf("Failed to open $FILE_LogFile/$DATA\n"); + goto error_exit; + } + + /* The $DATA attribute of the $LogFile has to be non-resident. */ + if (!NAttrNonResident(na)) { + Dprintf("$LogFile $DATA attribute is resident!?!\n"); + errno = EIO; + goto io_error_exit; + } + + /* Get length of $LogFile contents. */ + len = na->data_size; + if (!len) { + Dprintf("$LogFile has zero length, no disk write needed.\n"); + return 0; + } + + memset(buf, byte, NTFS_BUF_SIZE2); + + /* Set the $DATA attribute. */ + pos = 0; + while ((count = len - pos) > 0) { + if (count > NTFS_BUF_SIZE2) + count = NTFS_BUF_SIZE2; + + if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { + Dprintf("Failed to set the $LogFile attribute value."); + if (count != -1) + errno = EIO; + goto io_error_exit; + } + + pos += count; + } + + ntfs_attr_close(na); + return ntfs_inode_close(ni); + +io_error_exit: + eo = errno; + ntfs_attr_close(na); + errno = eo; +error_exit: + eo = errno; + ntfs_inode_close(ni); + errno = eo; + return -1; +} /** * ntfs_info - Display information about the NTFS Volume @@ -730,7 +872,6 @@ bmpdone: free (bitmap); } - /* * wipe_unused - volume = n clusters, u unused (%age & MB) * $Bitmap @@ -776,7 +917,6 @@ bmpdone: return 1; } - /** * print_summary - Tell the user what we are about to do * @@ -850,14 +990,8 @@ int main (int argc, char *argv[]) if (!vol) goto free; - if (vol->flags & VOLUME_IS_DIRTY) { - Qprintf ("Volume is dirty.\n"); - if (!opts.force) { - Eprintf ("Run chkdsk and try again, or use the --force option.\n"); - goto umount; - } - Qprintf ("Forced to continue.\n"); - } + if ((vol->flags & VOLUME_IS_DIRTY) && (!opts.force)) + goto umount; if (opts.info) { act = act_info; @@ -962,4 +1096,3 @@ free: return result; } - From 86716d6d624ba29d4a68c4948ddb5082f11f4b78 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1116/2994] Initial revision --- ntfsprogs/cluster.c | 0 ntfsprogs/cluster.h | 39 --------------------------------------- ntfsprogs/ntfsmove.h | 0 3 files changed, 39 deletions(-) create mode 100644 ntfsprogs/cluster.c create mode 100644 ntfsprogs/ntfsmove.h diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/cluster.h b/ntfsprogs/cluster.h index f3fdebe7..e69de29b 100644 --- a/ntfsprogs/cluster.h +++ b/ntfsprogs/cluster.h @@ -1,39 +0,0 @@ -/* - * cluster - Part of the Linux-NTFS project. - * - * Copyright (c) 2003 Richard Russon - * - * This function will locate the owner of any given sector or cluster range. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _CLUSTER_H_ -#define _CLUSTER_H_ - -#include "types.h" -#include "volume.h" - -typedef struct { - int x; -} ntfs_cluster; - -typedef int (cluster_cb) (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void *data); - -int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void *data); - -#endif /* _CLUSTER_H_ */ - diff --git a/ntfsprogs/ntfsmove.h b/ntfsprogs/ntfsmove.h new file mode 100644 index 00000000..e69de29b From 100d6d7deba6941a491c72e99e6cf69bdb380544 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1117/2994] extra options 2003/10/28 15:48:10+00:00 flatcap.org!ntfs (Logical change 1.299) --- ntfsprogs/ntfsmove.h | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/ntfsprogs/ntfsmove.h b/ntfsprogs/ntfsmove.h index e69de29b..d5081ee5 100644 --- a/ntfsprogs/ntfsmove.h +++ b/ntfsprogs/ntfsmove.h @@ -0,0 +1,46 @@ +/* + * ntfsmove - Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Richard Russon + * + * This utility will move files on an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFSMOVE_H_ +#define _NTFSMOVE_H_ + +#include "types.h" + /* Move files to */ +#define NTFS_MOVE_LOC_START -1000 /* the first available space */ +#define NTFS_MOVE_LOC_BEST -1001 /* place big enough for entire file */ +#define NTFS_MOVE_LOC_END -1002 /* the last available space */ + +struct options { + char *device; /* Device/File to work with */ + char *file; /* File to display */ + int force; /* Override common sense */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int noaction; /* Do not write to disk */ + int nodirty; /* Do not mark volume dirty */ + s64 location; /* Where to place the file */ +}; + +#endif /* _NTFSMOVE_H_ */ + + From e4f970bfc126a9be7f6c15f400b2adb2ed87d23e Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1118/2994] no changes 2003/11/02 23:22:27+00:00 flatcap.org!ntfs move cluster_find to separate source module implement last option 2003/10/29 10:25:42+00:00 flatcap.org!ntfs display cluster info about a file / inode (Logical change 1.299) --- ntfsprogs/ntfscluster.c | 260 +++++++++++++++++++++------------------- 1 file changed, 134 insertions(+), 126 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 95645025..df81b944 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "ntfscluster.h" #include "types.h" @@ -35,6 +36,7 @@ #include "volume.h" #include "debug.h" #include "dir.h" +#include "cluster.h" static const char *EXEC_NAME = "ntfscluster"; static struct options opts; @@ -54,8 +56,7 @@ void version (void) { printf ("\n%s v%s - Find the owner of any given sector or cluster.\n\n", EXEC_NAME, VERSION); - printf ("Copyright (c)\n"); - printf (" 2002-2003 Richard Russon\n"); + printf ("Copyright (c) 2002-2003 Richard Russon\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -70,8 +71,11 @@ void usage (void) { printf ("\nUsage: %s [options] device\n" " -i --info Print information about the volume (default)\n" + "\n" " -c range --cluster range Look for objects in this range of clusters\n" " -s range --sector range Look for objects in this range of sectors\n" + " -I num --inode num Show information about this inode\n" + " -F name --filename name Show information about this file\n" /* " -l --last Find the last file on the volume\n" */ "\n" " -f --force Use less caution\n" @@ -94,13 +98,15 @@ void usage (void) */ int parse_options (int argc, char **argv) { - static const char *sopt = "-c:fh?iqs:vV"; // l + static const char *sopt = "-c:F:fh?I:ilqs:vV"; static const struct option lopt[] = { { "cluster", required_argument, NULL, 'c' }, + { "filename", required_argument, NULL, 'F' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "info", no_argument, NULL, 'i' }, - //{ "last", no_argument, NULL, 'l' }, + { "inode", required_argument, NULL, 'I' }, + { "last", no_argument, NULL, 'l' }, { "quiet", no_argument, NULL, 'q' }, { "sector", required_argument, NULL, 's' }, { "verbose", no_argument, NULL, 'v' }, @@ -112,6 +118,7 @@ int parse_options (int argc, char **argv) int err = 0; int ver = 0; int help = 0; + char *end = NULL; opterr = 0; /* We'll handle the errors, thank you. */ @@ -137,6 +144,14 @@ int parse_options (int argc, char **argv) else opts.action = act_error; break; + case 'F': + if (opts.action == act_none) { + opts.action = act_file; + opts.filename = optarg; + } else { + opts.action = act_error; + } + break; case 'f': opts.force++; break; @@ -144,22 +159,28 @@ int parse_options (int argc, char **argv) case '?': help++; break; - case 'i': + case 'I': if (opts.action == act_none) { - opts.action = act_info; + opts.action = act_inode; + opts.inode = strtol (optarg, &end, 0); + if (end && *end) + err++; } else { opts.action = act_error; - err++; } break; - /* + case 'i': + if (opts.action == act_none) + opts.action = act_info; + else + opts.action = act_error; + break; case 'l': if (opts.action == act_none) opts.action = act_last; else opts.action = act_error; break; - */ case 'q': opts.quiet++; break; @@ -206,8 +227,7 @@ int parse_options (int argc, char **argv) } if (opts.action == act_error) { - //Eprintf ("You may only specify one action: --info, --cluster, --sector or --last.\n"); - Eprintf ("You may only specify one action: --info, --cluster or --sector.\n"); + Eprintf ("You may only specify one action: --info, --cluster, --sector or --last.\n"); err++; } else if (opts.range_begin > opts.range_end) { Eprintf ("The range must be in ascending order.\n"); @@ -333,128 +353,88 @@ int info (ntfs_volume *vol) } /** - * cluster_find + * dump_file */ -int cluster_find (ntfs_volume *vol, LCN s_begin, LCN s_end) +int dump_file (ntfs_volume *vol, ntfs_inode *ino) { - u64 i; - int in_use = 0, result = 1; - u8 *buffer; + u8 buffer[1024]; + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *rec; + int i; + runlist *runs; - if (!vol) - return 1; + utils_inode_get_name (ino, buffer, sizeof (buffer)); - buffer = malloc (vol->mft_record_size); - if (!buffer) { - Eprintf ("Couldn't allocate memory.\n"); - return 1; - } + printf ("Dump: %s\n", buffer); - for (i = s_begin; (LCN)i < s_end; i++) { - if (utils_cluster_in_use (vol, i) == 1) { - in_use = 1; - break; - } - } + ctx = ntfs_attr_get_search_ctx (ino, NULL); - if (!in_use) { - if (s_begin == s_end) - printf ("cluster isn't in use\n"); - else - printf ("clusters aren't in use\n"); - result = 0; - goto free; - } - - // first, is the cluster in use in $Bitmap? - - for (i = 0; (s64)i < vol->nr_mft_records; i++) { - ntfs_inode *inode; - ntfs_attr_search_ctx *ctx; - - if (!utils_mftrec_in_use (vol, i)) { - //printf ("%lld skipped\n", i); - continue; - } - - inode = ntfs_inode_open (vol, i); - if (!inode) { - Eprintf ("Can't read inode %lld\n", i); - goto free; - } - - if (inode->nr_extents == -1) { - printf ("inode %lld is an extent record\n", i); - goto close; - } - - Vprintf ("Inode: %lld\n", i); - ctx = ntfs_attr_get_search_ctx (inode, NULL); - - if (ntfs_attr_lookup (AT_STANDARD_INFORMATION, NULL, 0, IGNORE_CASE, 0, NULL, 0, ctx) < 0) { - //printf ("extent inode\n"); - continue; - } - ntfs_attr_reinit_search_ctx (ctx); - - //printf ("Searching for cluster range %lld-%lld\n", s_begin, s_end); - while (ntfs_attr_lookup (AT_UNUSED, NULL, 0, IGNORE_CASE, 0, NULL, 0, ctx) >= 0) { - runlist_element *runs; - int j; - - if (!ctx->attr->non_resident) { - //printf ("0x%02X ", ctx->attr->type); - continue; - } - - runs = ntfs_mapping_pairs_decompress (vol, ctx->attr, NULL); - if (!runs) { - Eprintf ("Couldn't read the data runs.\n"); - ntfs_inode_close (inode); - goto free; - } - - Vprintf ("\t[0x%02X]\n", ctx->attr->type); - - Vprintf ("\t\tVCN\tLCN\tLength\n"); - for (j = 0; runs[j].length > 0; j++) { - LCN a_begin = runs[j].lcn; - LCN a_end = a_begin + runs[j].length - 1; - - if (a_begin < 0) - continue; // sparse, discontiguous, etc - - Vprintf ("\t\t%lld\t%lld-%lld (%lld)\n", runs[j].vcn, runs[j].lcn, runs[j].lcn + runs[j].length - 1, runs[j].length); - //Vprintf ("\t\t%lld\t%lld\t%lld\n", runs[j].vcn, runs[j].lcn, runs[j].length); - //dprint list - - if ((a_begin > s_end) || (a_end < s_begin)) - continue; // before or after search range - - { - char buffer[256]; - utils_inode_get_name (inode, buffer, sizeof (buffer)); - //XXX distinguish between file/dir - printf ("inode %lld %s", i, buffer); - utils_attr_get_name (vol, ctx->attr, buffer, sizeof (buffer)); - printf ("%c%s\n", PATH_SEP, buffer); + while ((rec = find_attribute (AT_UNUSED, ctx))) { + printf (" 0x%02x - ", rec->type); + if (rec->non_resident) { + printf ("non-resident\n"); + runs = ntfs_mapping_pairs_decompress (vol, rec, NULL); + if (runs) { + printf (" VCN LCN Length\n"); + for (i = 0; runs[i].length > 0; i++) { + printf (" %8lld %8lld %8lld\n", runs[i].vcn, runs[i].lcn, runs[i].length); } - break; // XXX if verbose, we should list all matching runs + free (runs); } + } else { + printf ("resident\n"); } - - ntfs_attr_put_search_ctx (ctx); - ctx = NULL; -close: - //printf ("\n"); - ntfs_inode_close (inode); } -free: - free (buffer); - result = 0; - return result; + + ntfs_attr_put_search_ctx (ctx); + return 0; } +/** + * print_match + */ +int print_match (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void *data) +{ + char *buffer; + + if (!ino || !attr || !run) + return 1; + + buffer = malloc (MAX_PATH); + if (!buffer) { + Eprintf ("!buffer\n"); + return 1; + } + + utils_inode_get_name (ino, buffer, MAX_PATH); + printf ("Inode %lld %s", ino->mft_no, buffer); + + utils_attr_get_name (ino->vol, attr, buffer, MAX_PATH); + printf ("/%s\n", buffer); + + free (buffer); + return 0; +} + +/** + * find_last + */ +int find_last (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void *data) +{ + struct match *m; + + if (!ino || !attr || !run || !data) + return 1; + + m = data; + + if ((run->lcn + run->length) > m->lcn) { + m->inum = ino->mft_no; + m->lcn = run->lcn + run->length; + } + + return 0; +} /** * main - Begin here @@ -467,6 +447,8 @@ free: int main (int argc, char *argv[]) { ntfs_volume *vol; + ntfs_inode *ino = NULL; + struct match m; int result = 1; if (!parse_options (argc, argv)) @@ -487,20 +469,46 @@ int main (int argc, char *argv[]) /* Convert to clusters */ opts.range_begin >>= (vol->cluster_size_bits - vol->sector_size_bits); opts.range_end >>= (vol->cluster_size_bits - vol->sector_size_bits); - result = cluster_find (vol, opts.range_begin, opts.range_end); + result = cluster_find (vol, opts.range_begin, opts.range_end, (cluster_cb*)&print_match, NULL); break; case act_cluster: if (opts.range_begin == opts.range_end) Qprintf ("Searching for cluster %lld\n", opts.range_begin); else Qprintf ("Searching for cluster range %lld-%lld\n", opts.range_begin, opts.range_end); - result = cluster_find (vol, opts.range_begin, opts.range_end); + result = cluster_find (vol, opts.range_begin, opts.range_end, (cluster_cb*)&print_match, NULL); + break; + case act_file: + ino = utils_pathname_to_inode (vol, NULL, opts.filename); + if (ino) + result = dump_file (vol, ino); + break; + case act_inode: + ino = ntfs_inode_open (vol, opts.inode); + if (ino) { + result = dump_file (vol, ino); + ntfs_inode_close (ino); + } else { + Eprintf ("Cannot open inode %lld\n", opts.inode); + } break; - /* case act_last: - printf ("Last\n"); + memset (&m, 0, sizeof (m)); + m.lcn = -1; + result = cluster_find (vol, 0, LONG_MAX, (cluster_cb*)&find_last, &m); + if (m.lcn >= 0) { + ino = ntfs_inode_open (vol, m.inum); + if (ino) { + result = dump_file (vol, ino); + ntfs_inode_close (ino); + } else { + Eprintf ("Cannot open inode %lld\n", opts.inode); + } + result = 0; + } else { + result = 1; + } break; - */ case act_info: default: result = info (vol); From 3a6065e753b90243082eaa72cb81d13aa25c98e2 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1119/2994] one more sign problem 2003/11/02 23:22:27+00:00 flatcap.org!ntfs (Logical change 1.299) --- ntfsprogs/cluster.c | 134 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c index e69de29b..cc1d7c3a 100644 --- a/ntfsprogs/cluster.c +++ b/ntfsprogs/cluster.c @@ -0,0 +1,134 @@ +/** + * cluster - Part of the Linux-NTFS project. + * + * Copyright (c) 2002-2003 Richard Russon + * + * This function will locate the owner of any given sector or cluster range. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "cluster.h" +#include "utils.h" + +DEC_PRINTF (Eprintf) +DEC_PRINTF (Vprintf) +DEC_PRINTF (Qprintf) + +#define RED "" +#define YELLOW "" +#define GREEN "" +#define NORM "" + +/** + * cluster_find + */ +int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void *data) +{ + u64 i; + int j; + int in_use = 0; + int result = -1; + struct mft_search_ctx *m_ctx = NULL; + ntfs_attr_search_ctx *a_ctx = NULL; + ATTR_RECORD *rec; + runlist *runs; + + if (!vol || !cb) + return -1; + + // Quick check that at least one cluster is in use + for (i = c_begin; (LCN)i < c_end; i++) { + if (utils_cluster_in_use (vol, i) == 1) { + in_use = 1; + break; + } + } + + if (!in_use) { + if (c_begin == c_end) + Vprintf ("cluster isn't in use\n"); + else + Vprintf ("clusters aren't in use\n"); + return 0; + } + + m_ctx = mft_get_search_ctx (vol); + m_ctx->flags_search = FEMR_IN_USE | FEMR_BASE_RECORD; + + while (mft_next_record (m_ctx) == 0) { + printf (RED "Inode: %lld\n" NORM, m_ctx->inode->mft_no); + + if (!(m_ctx->flags_match & FEMR_BASE_RECORD)) + continue; + + Vprintf ("Inode: %lld\n", m_ctx->inode->mft_no); + + a_ctx = ntfs_attr_get_search_ctx (NULL, m_ctx->inode->mrec); + + while ((rec = find_attribute (AT_UNUSED, a_ctx))) { + + if (!rec->non_resident) { + Vprintf ("0x%02x skipped - attr is resident\n", a_ctx->attr->type); + continue; + } + + runs = ntfs_mapping_pairs_decompress (vol, a_ctx->attr, NULL); + if (!runs) { + Eprintf ("Couldn't read the data runs.\n"); + goto done; + } + + Vprintf ("\t[0x%02X]\n", a_ctx->attr->type); + + Vprintf ("\t\tVCN\tLCN\tLength\n"); + for (j = 0; runs[j].length > 0; j++) { + LCN a_begin = runs[j].lcn; + LCN a_end = a_begin + runs[j].length - 1; + + if (a_begin < 0) + continue; // sparse, discontiguous, etc + + Vprintf ("\t\t%lld\t%lld-%lld (%lld)\n", runs[j].vcn, runs[j].lcn, runs[j].lcn + runs[j].length - 1, runs[j].length); + //dprint list + + if ((a_begin > c_end) || (a_end < c_begin)) + continue; // before or after search range + + if ((*cb) (m_ctx->inode, a_ctx->attr, runs+j, data)) + return 1; + } + } + + ntfs_attr_put_search_ctx (a_ctx); + a_ctx = NULL; + } + + result = 0; +done: + ntfs_attr_put_search_ctx (a_ctx); + mft_put_search_ctx (m_ctx); + + return result; +} + From 0e41f6aab1864bc6b197e328aeb2818ea7dbe8a1 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1120/2994] remove unnecessary values for enum struct for saving last used cluster 2003/10/29 10:25:42+00:00 flatcap.org!ntfs display cluster info about a file / inode (Logical change 1.299) --- ntfsprogs/ntfscluster.h | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfscluster.h b/ntfsprogs/ntfscluster.h index 9e2a28f4..1bf31474 100644 --- a/ntfsprogs/ntfscluster.h +++ b/ntfsprogs/ntfscluster.h @@ -25,14 +25,17 @@ #define _NTFSCLUSTER_H_ #include "types.h" +#include "layout.h" enum action { - act_none = 1, - act_info = 2, - act_cluster = 3, - act_sector = 4, - act_last = 5, - act_error = 6, + act_none, + act_info, + act_cluster, + act_sector, + act_inode, + act_file, + act_last, + act_error, }; struct options { @@ -41,10 +44,20 @@ struct options { int quiet; /* Less output */ int verbose; /* Extra output */ int force; /* Override common sense */ + char *filename; /* File to examine */ + u64 inode; /* Inode to examine */ u64 range_begin; /* Look for objects in this range */ u64 range_end; }; +struct match { + u64 inum; /* Inode number */ + ATTR_TYPES type; /* Attribute type */ + uchar_t *name; /* Attribute name */ + int name_len; /* Length of attribute name */ + LCN lcn; /* Last cluster in use */ +}; + #endif /* _NTFSCLUSTER_H_ */ From 7d763a6b293f2fff362b9df357c5d89a4e25f9e7 Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1121/2994] Added relocation support with the continuous help of Miguel Lastra and his collegues at the University of Granada, Dewey M. Sasser, Erik Meade, Martin Fick, Sandro Hawke, Dave Croal, Lorrin Nelson, Geert Hendrickx, Robert Bjorkman and Richard Burdick. (Logical change 1.299) --- ntfsprogs/ntfsresize.c | 1146 ++++++++++++++++++++++++++++++---------- 1 file changed, 869 insertions(+), 277 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 41f42b68..f38bed37 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -63,12 +63,13 @@ static const char *resize_important_msg = " 4) set the bootable flag for the partition if it existed before\n" "Otherwise you may lose your data or can't boot your computer from the disk!\n"; -static const char *fragmented_volume_msg = -"The volume end is fragmented, this case is not yet supported.\n"; +static const char *invalid_ntfs_msg = +"Apparently device '%s' doesn't have a valid NTFS.\n" +"Maybe you selected the wrong partition or the whole disk\n" +"instead of a partition (e.g. /dev/hda, not /dev/hda1)?\n"; struct { int verbose; - int quiet; int debug; int ro_flag; int force; @@ -96,13 +97,19 @@ struct llcn_t { }; struct __ntfs_resize_t { - s64 new_volume_size; /* in clusters */ + s64 new_volume_size; /* in clusters; 0 = --info w/o --size */ int shrink; /* shrink = 1, enlarge = 0 */ ntfs_inode *ni; /* inode being processed */ + MFT_REF mref; /* mft reference */ + MFT_RECORD *mrec; /* mft record */ ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ u64 relocations; /* num of clusters to relocate */ - u64 inuse; /* num of clusters in use */ + s64 inuse; /* num of clusters in use */ int multi_ref; /* num of clusters ref'd many times */ + runlist mftmir_rl; /* $MFTMirr AT_DATA's new position */ + s64 mftmir_old; /* $MFTMirr AT_DATA's old LCN */ + int dirty_inode; /* some inode data got relocated */ + struct progress_bar progress; /* Temporary statistics until all case is supported */ struct llcn_t last_mft; struct llcn_t last_mftmir; @@ -110,13 +117,19 @@ struct __ntfs_resize_t { struct llcn_t last_sparse; struct llcn_t last_compressed; struct llcn_t last_lcn; + s64 last_unsafe; /* last "unsafe-to-move" cluster */ s64 last_unsupp; /* last unsupported cluster */ }; typedef struct __ntfs_resize_t ntfs_resize_t; +/* FIXME: This will go to struct __ntfs_resize_t */ ntfs_volume *vol = NULL; + +/* FIXME: These and 'pos' from find_free_cluster() will make a cluster + allocation related structure, attached to struct __ntfs_resize_t */ struct bitmap lcn_bitmap; +s64 max_free_cluster_range = 0; #define NTFS_MBYTE (1000 * 1000) @@ -124,16 +137,22 @@ struct bitmap lcn_bitmap; #define PERR_PREFIX ERR_PREFIX "(%d): " #define NERR_PREFIX ERR_PREFIX ": " +#define DIRTY_NONE (0) +#define DIRTY_INODE (1) +#define DIRTY_ATTRIB (2) + +#define NTFS_MAX_CLUSTER_SIZE (65536) + #define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) /* FIXME: They should be included but Eprintf conflicts with mkntfs's Eprintf */ -extern int Eprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); -extern int Vprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); -extern int Qprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); +extern int Eprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); +extern int Vprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); +extern int Qprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &opt.verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &opt.quiet, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stdout, &opt.verbose, TRUE) +GEN_PRINTF(Qprintf, stdout, NULL, FALSE) /** * perr_printf @@ -149,7 +168,19 @@ static void perr_printf(const char *fmt, ...) va_start(ap, fmt); vfprintf(stdout, fmt, ap); va_end(ap); - printf(": %s\n", strerror(eo)); + fprintf(stdout, ": %s\n", strerror(eo)); + fflush(stdout); + fflush(stderr); +} + +static void err_printf(const char *fmt, ...) +{ + va_list ap; + + fprintf(stdout, NERR_PREFIX); + va_start(ap, fmt); + vfprintf(stdout, fmt, ap); + va_end(ap); fflush(stdout); fflush(stderr); } @@ -211,8 +242,7 @@ static void usage(void) " -n --no-action Do not write to disk\n" " -f --force Force to progress (DANGEROUS)\n" " -P --no-progress-bar Don't show progress bar\n" - /* " -q --quiet Less output\n"*/ - /* " -v --verbose More output\n"*/ + " -v --verbose More output\n" " -V --version Display version information\n" " -h --help Display this help\n" #ifdef DEBUG @@ -222,7 +252,8 @@ static void usage(void) " If -i and -s are used together then print information about relocations.\n" " If both are omitted then the volume will be enlarged to the device size.\n" "\n", EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); + printf ("%s%s", ntfs_bugs, ntfs_home); + printf ("Ntfsresize FAQ: http://linux-ntfs.sourceforge.net/info/ntfsresize.html\n"); exit(1); } @@ -259,10 +290,10 @@ static void proceed_question(void) static void version (void) { printf ("\nResize an NTFS Volume, without data loss.\n\n"); - printf ("Copyright (c) 2002-2003 Szabolcs Szakacsits\n"); + printf ("Copyright (c) 2002-2004 Szabolcs Szakacsits\n"); printf ("Copyright (c) 2002-2003 Anton Altaparmakov\n"); printf ("Copyright (c) 2002-2003 Richard Russon\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + printf ("\n%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -295,8 +326,8 @@ static s64 get_new_volume_size(char *s) http://physics.nist.gov/cuu/Units/binary.html Disk partitioning tools use prefixes as, k M G - old fdisk 2^10 2^20 10^3*2^20 - recent fdisk 10^3 10^6 10^9 + fdisk 2.11x- 2^10 2^20 10^3*2^20 + fdisk 2.11y+ 10^3 10^6 10^9 cfdisk 10^3 10^6 10^9 sfdisk 2^10 2^20 parted 2^10 2^20 (may change) @@ -338,10 +369,9 @@ static int parse_options(int argc, char **argv) { "help", no_argument, NULL, 'h' }, { "info", no_argument, NULL, 'i' }, { "no-action", no_argument, NULL, 'n' }, - /* { "quiet", no_argument, NULL, 'q' },*/ - { "size", required_argument, NULL, 's' }, { "no-progress-bar", no_argument, NULL, 'P' }, - /* { "verbose", no_argument, NULL, 'v' },*/ + { "size", required_argument, NULL, 's' }, + { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 } }; @@ -381,9 +411,6 @@ static int parse_options(int argc, char **argv) case 'P': opt.show_progress = 0; break; - case 'q': - opt.quiet++; - break; case 's': if (!err && (opt.bytes == 0)) opt.bytes = get_new_volume_size(optarg); @@ -407,22 +434,12 @@ static int parse_options(int argc, char **argv) } } - if (help || ver) { - opt.quiet = 0; - } else { + if (!help && !ver) { if (opt.volume == NULL) { if (argc > 1) Eprintf ("You must specify exactly one device.\n"); err++; } - - /* - if (opt.quiet && opt.verbose) { - Eprintf ("You may not use --quiet and --verbose at the same time.\n"); - err++; - } - */ - if (opt.info) opt.ro_flag = MS_RDONLY; } @@ -443,6 +460,76 @@ static int parse_options(int argc, char **argv) return (!err && !help && !ver); } +static void print_advise(s64 supp_lcn, int flags) +{ + s64 old_b, new_b, freed_b, old_mb, new_mb, freed_mb; + int beta = flags & 1; + int final = flags & 2; + + old_b = vol->nr_clusters * vol->cluster_size; + old_mb = rounded_up_division(old_b, NTFS_MBYTE); + + /* Take the next supported cluster (free or relocatable) + plus reserve a cluster for the backup boot sector */ + supp_lcn += 2; + + if (supp_lcn > vol->nr_clusters) { + if (final) + printf("This fragmentation type " + "isn't supported yet. Sorry.\n"); + return; + } + + new_b = supp_lcn * vol->cluster_size; + new_mb = rounded_up_division(new_b, NTFS_MBYTE); + freed_b = (vol->nr_clusters - supp_lcn + 1) * vol->cluster_size; + freed_mb = freed_b / NTFS_MBYTE; + + printf("You %s resize at %lld bytes ", beta ? "might" : "could", new_b); + if ((new_mb * NTFS_MBYTE) < old_b) + printf("or %lld MB ", new_mb); + + printf("(freeing "); + if (freed_mb && (old_mb - new_mb)) + printf("%lld MB", old_mb - new_mb); + else + printf("%lld bytes", freed_b); + printf("). %s\n", beta ? "BETA." : "STABLE."); + + if (final) + printf("Please make a test run using both the -n and -s " + "options before real resizing!\n"); +} + +static void rl_set(runlist *rl, VCN vcn, LCN lcn, s64 len) +{ + rl->vcn = vcn; + rl->lcn = lcn; + rl->length = len; +} + +static int rl_items(runlist *rl) +{ + int i = 0; + + while (rl[i++].length) + ; + + return i; +} + +static void dump_run(runlist_element *r) +{ + Vprintf(" %8lld %8lld (0x%08llx) %lld\n", + r->vcn, r->lcn, r->lcn, r->length); +} + +static void dump_runlist(runlist *rl) +{ + while (rl->length) + dump_run(rl++); +} + /** * nr_clusters_to_bitmap_byte_size * @@ -481,7 +568,7 @@ static int has_bad_sectors(ntfs_resize_t *resize) uchar_t *ustr = NULL; ATTR_RECORD *a = resize->ctx->attr; - if (resize->ni->mft_no != 8) + if (resize->ni->mft_no != FILE_BadClus) return 0; if (str2unicode("$Bad", &ustr, &len) == -1) @@ -498,44 +585,69 @@ static int has_bad_sectors(ntfs_resize_t *resize) return ret; } -static void collect_shrink_constraints(ntfs_resize_t *resize, s64 last_lcn) +static void collect_shrink_constraints(ntfs_resize_t *resize, runlist *rl) { - s64 inode; + s64 inode, last_lcn; ATTR_FLAGS flags; struct llcn_t *llcn = NULL; - int ret; + int ret, supported = 0; + + last_lcn = rl->lcn + (rl->length - 1); inode = resize->ni->mft_no; flags = resize->ctx->attr->flags; - if (NInoAttrList(resize->ni)) - llcn = &resize->last_multi_mft; - - else if (flags & ATTR_IS_SPARSE) - llcn = &resize->last_sparse; - - else if (flags & ATTR_IS_COMPRESSED) - llcn = &resize->last_compressed; - - else if ((ret = has_bad_sectors(resize)) != 0) { + if ((ret = has_bad_sectors(resize)) != 0) { if (ret == -1) - perr_exit("Couldn't convert string to Unicode."); + perr_exit("Couldn't convert string to Unicode"); err_exit("Device has bad sectors, not supported yet.\n"); + } - } else if (inode == 0) + if (NInoAttrList(resize->ni)) { + llcn = &resize->last_multi_mft; + + if (inode != FILE_MFT && inode != FILE_MFTMirr) + supported = 1; + + } else if (flags & ATTR_IS_SPARSE) { + llcn = &resize->last_sparse; + supported = 1; + + } else if (flags & ATTR_IS_COMPRESSED) { + llcn = &resize->last_compressed; + supported = 1; + + } else if (inode == FILE_MFT) { llcn = &resize->last_mft; + + /* First run of $MFT DATA attribute isn't supported yet */ + if (resize->ctx->attr->type != AT_DATA || rl->vcn) + supported = 1; - else if (inode == 1) + } else if (inode == FILE_MFTMirr) { llcn = &resize->last_mftmir; - - else + supported = 1; + + /* Fragmented $MFTMirr DATA attribute isn't supported yet */ + if (resize->ctx->attr->type == AT_DATA) + if (rl[1].length != 0 || rl->vcn) + supported = 0; + } else { llcn = &resize->last_lcn; + supported = 1; + } if (llcn->lcn < last_lcn) { llcn->lcn = last_lcn; llcn->inode = inode; } + if (resize->last_unsafe < last_lcn) + resize->last_unsafe = last_lcn; + + if (supported) + return; + if (resize->last_unsupp < last_lcn) resize->last_unsupp = last_lcn; } @@ -543,31 +655,45 @@ static void collect_shrink_constraints(ntfs_resize_t *resize, s64 last_lcn) static void collect_shrink_info(ntfs_resize_t *resize, runlist *rl) { - s64 new_volume_size, lcn, lcn_length; + s64 lcn, lcn_length, start, len, inode; + s64 new_vol_size; /* (last LCN on the volume) + 1 */ lcn = rl->lcn; lcn_length = rl->length; - new_volume_size = resize->new_volume_size; + inode = resize->ni->mft_no; + new_vol_size = resize->new_volume_size; - if (lcn + (lcn_length - 1) > new_volume_size) { + if (lcn + lcn_length <= new_vol_size) + return; - s64 start = lcn; - s64 len = lcn_length; + start = lcn; + len = lcn_length; - if (start <= new_volume_size) { - start = new_volume_size + 1; - len = lcn_length - (start - lcn); + if (lcn < new_vol_size) { + start = new_vol_size; + len = lcn_length - (new_vol_size - lcn); + + if (!opt.info && (inode == FILE_MFT || inode == FILE_MFTMirr)) { + int unsafe = 3; + s64 last_lcn; + + err_printf("$MFT%s can't be split up yet. Please try " + "a different size.\n", inode ? "Mirr" : ""); + last_lcn = lcn + lcn_length - 1; + if (last_lcn == resize->last_unsafe) + unsafe = 2; + print_advise(last_lcn, unsafe); + exit(1); } - - resize->relocations += len; - - if (opt.info && !resize->new_volume_size) - return; - - printf("Relocation needed for inode %8lld attr 0x%x LCN 0x%08llx " - "length %6lld\n", resize->ni->mft_no, - resize->ctx->attr->type, start, len); } + + resize->relocations += len; + + if (!opt.info || !resize->new_volume_size) + return; + + printf("Relocation needed for inode %8lld attr 0x%x LCN 0x%08llx " + "length %6lld\n", inode, resize->ctx->attr->type, start, len); } /** @@ -623,7 +749,7 @@ static void build_lcn_usage_bitmap(ntfs_resize_t *resize) resize->inuse += lcn_length; - collect_shrink_constraints(resize, lcn + (lcn_length - 1)); + collect_shrink_constraints(resize, rl + i); if (resize->shrink) collect_shrink_info(resize, rl + i); @@ -770,15 +896,14 @@ static void walk_inodes(ntfs_resize_t *resize) s64 inode = 0; s64 last_mft_rec; ntfs_inode *ni; - struct progress_bar progress; printf("Checking filesystem consistency ...\n"); last_mft_rec = vol->nr_mft_records - 1; - progress_init(&progress, inode, last_mft_rec, 100); + progress_init(&resize->progress, inode, last_mft_rec, 100); for (; inode <= last_mft_rec; inode++) { - progress_update(&progress, inode); + progress_update(&resize->progress, inode); if ((ni = ntfs_inode_open(vol, (MFT_REF)inode)) == NULL) { /* FIXME: continue only if it make sense, e.g. @@ -799,6 +924,536 @@ close_inode: } } +static void rl_fixup(runlist **rl) +{ + runlist *tmp = *rl; + + if (tmp->lcn == LCN_RL_NOT_MAPPED) { + s64 unmapped_len = tmp->length; + + Vprintf("Skip unmapped run at the beginning ...\n"); + + if (!tmp->length) + err_exit("Empty unmapped runlist! Please report!\n"); + (*rl)++; + for (tmp = *rl; tmp->length; tmp++) + tmp->vcn -= unmapped_len; + } + + for (tmp = *rl; tmp->length; tmp++) { + if (tmp->lcn == LCN_RL_NOT_MAPPED) { + Vprintf("Skip unmapped run at the end ...\n"); + + if (tmp[1].length) + err_exit("Unmapped runlist in the middle! " + "Please report!\n"); + tmp->lcn = LCN_ENOENT; + tmp->length = 0; + } + } +} + +static void replace_attribute_runlist(ntfs_attr_search_ctx *ctx, runlist *rl) +{ + int mp_size, l; + void *mp; + char *next_attr; + ATTR_RECORD *a = ctx->attr; + + rl_fixup(&rl); + + if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl)) == -1) + perr_exit("ntfs_get_size_for_mapping_pairs"); + + if (a->name_length) { + u16 name_offs = le16_to_cpu(a->name_offset); + u16 mp_offs = le16_to_cpu(a->mapping_pairs_offset); + + if (name_offs >= mp_offs) + err_exit("Attribute name is after mapping pairs! " + "Please report!\n"); + } + + /* CHECKME: don't trust mapping_pairs is always the last item in the + attribute, instead check for the real size/space */ + l = (int)le32_to_cpu(a->length) - le16_to_cpu(a->mapping_pairs_offset); + if (mp_size > l) { + s64 remains_size; //, new_attr_size; + + Vprintf("Enlarging attribute header ...\n"); + + mp_size = (mp_size + 7) & ~7; + + Vprintf("Old mp size : %d\n", l); + Vprintf("New mp size : %d\n", mp_size); + Vprintf("Bytes in use : %d\n", ctx->mrec->bytes_in_use); + + next_attr = (char *)a + le16_to_cpu(a->length); + l = mp_size - l; + + Vprintf("Bytes in use new : %d\n", ctx->mrec->bytes_in_use + l); + Vprintf("Bytes allocated : %d\n", ctx->mrec->bytes_allocated); + + remains_size = ctx->mrec->bytes_in_use; + remains_size -= (next_attr - (char *)ctx->mrec); + + Vprintf("increase : %d\n", l); + Vprintf("shift : %lld\n", remains_size); + + if (ctx->mrec->bytes_in_use + l > ctx->mrec->bytes_allocated) + err_exit("Extended record needed (%d > %d), not yet " + "supported!\nPlease try to free less space.\n", + ctx->mrec->bytes_in_use + l, + ctx->mrec->bytes_allocated); + + memmove(next_attr + l, next_attr, remains_size); + ctx->mrec->bytes_in_use += l; + a->length += l; + } + + if (!(mp = calloc(1, mp_size))) + perr_exit("Couldn't get memory"); + + if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl)) + perr_exit("ntfs_mapping_pairs_build"); + + memmove((char *)a + le16_to_cpu(a->mapping_pairs_offset), mp, mp_size); + + free(mp); +} + +static void set_bitmap_range(s64 pos, s64 length, u8 bit) +{ + while (length--) + ntfs_bit_set(lcn_bitmap.bm, pos++, bit); +} + +static void set_bitmap_clusters(runlist *rl, u8 bit) +{ + for (; rl->length; rl++) + set_bitmap_range(rl->lcn, rl->length, bit); +} + +static void release_bitmap_clusters(runlist *rl) +{ + max_free_cluster_range = 0; + set_bitmap_clusters(rl, 0); +} + +static void set_max_free_zone(s64 length, s64 end, runlist_element *rle) +{ + if (length > rle->length) { + rle->lcn = end - length; + rle->length = length; + } +} + +static int find_free_cluster(runlist_element *rle, s64 nr_vol_clusters, int hint) +{ + /* FIXME: get rid of this 'static' variable */ + static s64 pos = 0; + s64 i, items = rle->length; + s64 free_zone = 0; + + if (pos >= nr_vol_clusters) + pos = 0; + if (!max_free_cluster_range) + max_free_cluster_range = nr_vol_clusters; + rle->lcn = rle->length = 0; + if (hint) + pos = nr_vol_clusters / 2; + i = pos; + + do { + if (!ntfs_bit_get(lcn_bitmap.bm, i)) { + if (++free_zone == items) { + set_max_free_zone(free_zone, i + 1, rle); + break; + } + } else { + set_max_free_zone(free_zone, i, rle); + free_zone = 0; + } + if (++i == nr_vol_clusters) { + set_max_free_zone(free_zone, i, rle); + i = free_zone = 0; + } + if (rle->length == max_free_cluster_range) + break; + } while (i != pos); + + if (i) + set_max_free_zone(free_zone, i, rle); + + if (!rle->lcn) { + errno = ENOSPC; + return -1; + } + if (rle->length < items && rle->length < max_free_cluster_range) { + max_free_cluster_range = rle->length; + Vprintf("Max free range: %7lld \n", max_free_cluster_range); + } + pos = rle->lcn + items; + if (pos == nr_vol_clusters) + pos = 0; + + set_bitmap_range(rle->lcn, rle->length, 1); + return 0; +} + +static runlist *alloc_cluster(s64 items, s64 nr_vol_clusters, int hint) +{ + runlist_element rle; + runlist *rl = NULL; + int rl_size, runs = 0; + s64 vcn = 0; + + if (items <= 0) { + errno = EINVAL; + return NULL; + } + + while (items > 0) { + + if (runs) + hint = 0; + rle.length = items; + if (find_free_cluster(&rle, nr_vol_clusters, hint) == -1) + return NULL; + + rl_size = (runs + 2) * sizeof(runlist_element); + if (!(rl = (runlist *)realloc(rl, rl_size))) + return NULL; + + rl_set(rl + runs, vcn, rle.lcn, rle.length); + + vcn += rle.length; + items -= rle.length; + runs++; + } + + rl_set(rl + runs, vcn, -1LL, 0LL); + + if (runs > 1) { + Vprintf("Multi-run allocation: \n"); + dump_runlist(rl); + } + return rl; +} + +static int read_all(struct ntfs_device *dev, void *buf, int count) +{ + int i; + + while (count > 0) { + + i = count; + if (!NDevReadOnly(dev)) + i = dev->d_ops->read(dev, buf, count); + + if (i < 0) { + if (errno != EAGAIN && errno != EINTR) + return -1; + } else if (i > 0) { + count -= i; + buf = i + (char *)buf; + } else + err_exit("Unexpected end of file!\n"); + } + return 0; +} + +static int write_all(struct ntfs_device *dev, void *buf, int count) +{ + int i; + + while (count > 0) { + + i = count; + if (!NDevReadOnly(dev)) + i = dev->d_ops->write(dev, buf, count); + + if (i < 0) { + if (errno != EAGAIN && errno != EINTR) + return -1; + } else { + count -= i; + buf = i + (char *)buf; + } + } + return 0; +} + +/** + * write_mft_record + * + * Write an MFT Record back to the disk. If the read-only command line option + * was given, this function will do nothing. + */ +static int write_mft_record(const MFT_REF mref, MFT_RECORD *mrec) +{ + if (ntfs_mft_record_write(vol, mref, mrec)) + perr_exit("ntfs_mft_record_write"); + +// if (vol->dev->d_ops->sync(vol->dev) == -1) +// perr_exit("Failed to sync device"); + + return 0; +} + +static void lseek_to_cluster(s64 lcn) +{ + off_t pos; + + pos = (off_t)(lcn * vol->cluster_size); + + if (vol->dev->d_ops->seek(vol->dev, pos, SEEK_SET) == (off_t)-1) + perr_exit("seek failed to position %lld", lcn); +} + +static void copy_clusters(ntfs_resize_t *resize, s64 dest, s64 src, s64 len) +{ + s64 i; + char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ + + for (i = 0; i < len; i++) { + + lseek_to_cluster(src + i); + + if (read_all(vol->dev, buff, vol->cluster_size) == -1) + perr_exit("read_all"); + + lseek_to_cluster(dest + i); + + if (write_all(vol->dev, buff, vol->cluster_size) == -1) + perr_exit("write_all"); + + resize->relocations++; + progress_update(&resize->progress, resize->relocations); + } +} + +static void relocate_clusters(ntfs_resize_t *r, runlist *dest_rl, s64 src_lcn) +{ + /* collect_shrink_constraints() ensured $MFTMir DATA is one run */ + if (r->mref == FILE_MFTMirr && r->ctx->attr->type == AT_DATA) { + if (!r->mftmir_old) { + r->mftmir_rl.lcn = dest_rl->lcn; + r->mftmir_rl.length = dest_rl->length; + r->mftmir_old = src_lcn; + } else + err_exit("Multi-run $MFTMirr. Please report!\n"); + } + + for (; dest_rl->length; src_lcn += dest_rl->length, dest_rl++) + copy_clusters(r, dest_rl->lcn, src_lcn, dest_rl->length); +} + +static void rl_split_run(runlist **rl, int run, s64 pos) +{ + runlist *rl_new, *rle_new, *rle; + int items, new_size, size_head, size_tail; + s64 len_head, len_tail; + + items = rl_items(*rl); + new_size = (items + 1) * sizeof(runlist_element); + size_head = run * sizeof(runlist_element); + size_tail = (items - run - 1) * sizeof(runlist_element); + + if (!(rl_new = (runlist *)malloc(new_size))) + perr_exit("malloc"); + + rle_new = rl_new + run; + rle = *rl + run; + + memmove(rl_new, *rl, size_head); + memmove(rle_new + 2, rle + 1, size_tail); + + len_tail = rle->length - (pos - rle->lcn); + len_head = rle->length - len_tail; + + rl_set(rle_new, rle->vcn, rle->lcn, len_head); + rl_set(rle_new + 1, rle->vcn + len_head, rle->lcn + len_head, len_tail); + + Vprintf("Splitting run at cluster %lld:\n", pos); + dump_run(rle); dump_run(rle_new); dump_run(rle_new + 1); + + free(*rl); + *rl = rl_new; +} + +static void rl_insert_at_run(runlist **rl, int run, runlist *ins) +{ + int items, ins_items; + int new_size, size_tail; + runlist *rle; + s64 vcn; + + items = rl_items(*rl); + ins_items = rl_items(ins) - 1; + new_size = ((items - 1) + ins_items) * sizeof(runlist_element); + size_tail = (items - run - 1) * sizeof(runlist_element); + + if (!(*rl = (runlist *)realloc(*rl, new_size))) + perr_exit("realloc"); + + rle = *rl + run; + + memmove(rle + ins_items, rle + 1, size_tail); + + for (vcn = rle->vcn; ins->length; rle++, vcn += ins->length, ins++) { + rl_set(rle, vcn, ins->lcn, ins->length); +// dump_run(rle); + } + + return; + + /* FIXME: fastpath if ins_items = 1 */ +// (*rl + run)->lcn = ins->lcn; +} + +static void relocate_run(ntfs_resize_t *resize, runlist **rl, int run) +{ + s64 lcn, lcn_length; + s64 new_vol_size; /* (last LCN on the volume) + 1 */ + runlist *relocate_rl; /* relocate runlist to relocate_rl */ + int hint; + + lcn = (*rl + run)->lcn; + lcn_length = (*rl + run)->length; + new_vol_size = resize->new_volume_size; + + if (lcn + lcn_length <= new_vol_size) + return; + + if (lcn < new_vol_size) { + rl_split_run(rl, run, new_vol_size); + return; + } + + hint = (resize->mref == FILE_MFTMirr) ? 1 : 0; + if (!(relocate_rl = alloc_cluster(lcn_length, new_vol_size, hint))) + perr_exit("Cluster allocation failed for %llu:%lld", + resize->mref, lcn_length); + + /* FIXME: check $MFTMirr DATA isn't multi-run (or support it) */ + Vprintf("Relocate inode %7llu:0x%x:%08lld:0x%08llx --> 0x%08llx\n", + resize->mref, resize->ctx->attr->type, lcn_length, lcn, + relocate_rl->lcn); + + relocate_clusters(resize, relocate_rl, lcn); + rl_insert_at_run(rl, run, relocate_rl); + + /* We don't release old clusters in the bitmap, that area isn't + used by the allocator and will be truncated later on */ + free(relocate_rl); + + resize->dirty_inode = DIRTY_ATTRIB; +} + +static void relocate_attribute(ntfs_resize_t *resize) +{ + ATTR_RECORD *a; + runlist *rl; + int i; + + a = resize->ctx->attr; + + if (!a->non_resident) + return; + + if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) + perr_exit("ntfs_decompress_mapping_pairs"); + + for (i = 0; rl[i].length; i++) { + s64 lcn = rl[i].lcn; + s64 lcn_length = rl[i].length; + + if (lcn == LCN_HOLE || lcn == LCN_RL_NOT_MAPPED) + continue; + + /* FIXME: ntfs_mapping_pairs_decompress should return error */ + if (lcn < 0 || lcn_length <= 0) + err_exit("Corrupt runlist in MTF %llu attr %x LCN " + "%llx length %llx\n", resize->mref, + le32_to_cpu (a->type), lcn, lcn_length); + + relocate_run(resize, &rl, i); + } + + if (resize->dirty_inode == DIRTY_ATTRIB) { + replace_attribute_runlist(resize->ctx, rl); + resize->dirty_inode = DIRTY_INODE; + } + + free(rl); +} + +static void relocate_attributes(ntfs_resize_t *resize) +{ + ntfs_attr_search_ctx *ctx; + + if (!(ctx = ntfs_attr_get_search_ctx(NULL, resize->mrec))) + perr_exit("ntfs_get_attr_search_ctx"); + + while (!ntfs_attrs_walk(ctx)) { + if (ctx->attr->type == AT_END) + break; + resize->ctx = ctx; + relocate_attribute(resize); + } + + ntfs_attr_put_search_ctx(ctx); +} + +static void relocate_inode(ntfs_resize_t *resize, MFT_REF mref) +{ + if (ntfs_file_record_read(vol, mref, &resize->mrec, NULL)) { + /* FIXME: continue only if it make sense, e.g. + MFT record not in use based on $MFT bitmap */ + if (errno == EIO || errno == ENOENT) + return; + perr_exit("ntfs_file_record_record"); + } + + if (!(resize->mrec->flags & MFT_RECORD_IN_USE)) + return; + + resize->mref = mref; + resize->dirty_inode = DIRTY_NONE; + + relocate_attributes(resize); + + if (resize->dirty_inode == DIRTY_INODE) { +// if (vol->dev->d_ops->sync(vol->dev) == -1) +// perr_exit("Failed to sync device"); + if (write_mft_record(mref, resize->mrec)) + perr_exit("Couldn't update inode %llu", mref); + } +} + +static void relocate_inodes(ntfs_resize_t *resize) +{ + MFT_REF mref; + + printf("Relocating needed data ...\n"); + + progress_init(&resize->progress, 0, resize->relocations, 100); + resize->relocations = 0; + + resize->mrec = (MFT_RECORD *)malloc(vol->mft_record_size); + if (!resize->mrec) + perr_exit("malloc failed"); + + for (mref = 1; mref < (MFT_REF)vol->nr_mft_records; mref++) + relocate_inode(resize, mref); + + relocate_inode(resize, 0); + + if (resize->mrec) + free(resize->mrec); +} + static void print_hint(const char *s, struct llcn_t llcn) { s64 runs_b, runs_mb; @@ -820,65 +1475,27 @@ static void print_hint(const char *s, struct llcn_t llcn) */ static void advise_on_resize(ntfs_resize_t *resize) { - s64 old_b, new_b, g_b, old_mb, new_mb, g_mb; - s64 supp_lcn = 0; /* smallest size supported in LCN */ - int fragmanted_end; + int final; printf("Calculating smallest shrunken size supported ...\n"); - old_b = vol->nr_clusters * vol->cluster_size; - old_mb = rounded_up_division(old_b, NTFS_MBYTE); - printf("File feature Last used at By inode\n"); print_hint("$MFT", resize->last_mft); - print_hint("$MFTMirr", resize->last_mftmir); - print_hint("Compressed", resize->last_compressed); - print_hint("Sparse", resize->last_sparse); print_hint("Multi-Record", resize->last_multi_mft); - print_hint("Ordinary", resize->last_lcn); - - supp_lcn = resize->last_unsupp; - - supp_lcn += 2; /* first free + one for the backup boot sector */ - fragmanted_end = (supp_lcn >= vol->nr_clusters) ? 1 : 0; - - if (fragmanted_end || !opt.info) { - printf(fragmented_volume_msg); - if (fragmanted_end) - return; - printf("Now "); + if (opt.verbose) { + print_hint("$MFTMirr", resize->last_mftmir); + print_hint("Compressed", resize->last_compressed); + print_hint("Sparse", resize->last_sparse); + print_hint("Ordinary", resize->last_lcn); } - new_b = supp_lcn * vol->cluster_size; - new_mb = rounded_up_division(new_b, NTFS_MBYTE); - g_b = (vol->nr_clusters - supp_lcn) * vol->cluster_size; - g_mb = g_b / NTFS_MBYTE; + final = (resize->last_unsafe == resize->last_unsupp) ? 2 : 0; + print_advise(resize->last_unsafe, final); - printf("You could resize at %lld bytes ", new_b); + if (final) + return; - if ((new_mb * NTFS_MBYTE) < old_b) - printf("or %lld MB ", new_mb); - - printf("(freeing "); - - if (g_mb && (old_mb - new_mb)) - printf("%lld MB", old_mb - new_mb); - else - printf("%lld bytes", g_b); - - printf(").\n"); -} - -/** - * rl_set - * - * Helper to set up a runlist object - */ -static void rl_set(runlist *rl, VCN vcn, LCN lcn, s64 len) -{ - rl->vcn = vcn; - rl->lcn = lcn; - rl->length = len; + print_advise(resize->last_unsupp, 3); } /** @@ -901,42 +1518,28 @@ static void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) * FIXME: this function should go away and instead using a generalized * "truncate_bitmap_data_attr()" */ -static void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters) +static void truncate_badclust_bad_attr(ntfs_attr_search_ctx *ctx, s64 nr_clusters) { runlist *rl_bad; - int mp_size; - char *mp; + ATTR_RECORD *a = ctx->attr; if (!a->non_resident) /* FIXME: handle resident attribute value */ - perr_exit("Resident attribute in $BadClust not supported!"); + err_exit("Resident attribute in $BadClust isn't supported!\n"); - if (!(rl_bad = (runlist *)malloc(2 * sizeof(runlist)))) + if (!(rl_bad = (runlist *)malloc(2 * sizeof(runlist_element)))) perr_exit("Couldn't get memory"); - rl_set(rl_bad, 0LL, (LCN)LCN_HOLE, nr_clusters); - rl_set(rl_bad + 1, nr_clusters, -1LL, 0LL); - - if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl_bad)) == -1) - perr_exit("ntfs_get_size_for_mapping_pairs"); - - if (mp_size > (int)(le32_to_cpu (a->length) - - le16_to_cpu (a->mapping_pairs_offset))) - err_exit("Enlarging attribute header isn't supported yet.\n"); - - if (!(mp = (char *)calloc(1, mp_size))) - perr_exit("Couldn't get memory"); - - if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl_bad)) - perr_exit("ntfs_mapping_pairs_build"); - - memcpy((char *)a + le16_to_cpu (a->mapping_pairs_offset), mp, mp_size); a->highest_vcn = cpu_to_le64(nr_clusters - 1LL); a->allocated_size = cpu_to_le64(nr_clusters * vol->cluster_size); a->data_size = cpu_to_le64(nr_clusters * vol->cluster_size); + rl_set(rl_bad, 0LL, (LCN)LCN_HOLE, nr_clusters); + rl_set(rl_bad + 1, nr_clusters, -1LL, 0LL); + + replace_attribute_runlist(ctx, rl_bad); + free(rl_bad); - free(mp); } /** @@ -990,38 +1593,18 @@ static void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new * Enlarge the metadata file $Bitmap. It must be large enough for one bit per * cluster of the shrunken volume. Also it must be a of 8 bytes in size. */ -static void enlarge_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) +static void enlarge_bitmap_data_attr(runlist **rl, s64 nr_bm_clusters, s64 new_size) { - runlist *rl = *rlist; - s64 i, j, free_zone = 0; + s64 i; - for (i = 0; rl[i].length; i++) - for (j = 0; j < rl[i].length; j++) - ntfs_bit_set(lcn_bitmap.bm, rl[i].lcn + j, 0); - free(rl); - - if (!(rl = *rlist = (runlist *)malloc(2 * sizeof(runlist)))) - perr_exit("Couldn't get memory"); + release_bitmap_clusters(*rl); + free(*rl); for (i = vol->nr_clusters; i < new_size; i++) ntfs_bit_set(lcn_bitmap.bm, i, 0); - for (i = 0; i < new_size; i++) { - if (!ntfs_bit_get(lcn_bitmap.bm, i)) { - if (++free_zone == nr_bm_clusters) - break; - } else - free_zone = 0; - } - - if (free_zone != nr_bm_clusters) - err_exit("Couldn't allocate $Bitmap clusters.\n"); - - for (; free_zone; free_zone--, i--) - ntfs_bit_set(lcn_bitmap.bm, i, 1); - - rl_set(rl, 0LL, i + 1, nr_bm_clusters); - rl_set(rl + 1, nr_bm_clusters, -1LL, 0LL); + if (!(*rl = alloc_cluster(nr_bm_clusters, new_size, 0))) + perr_exit("Couldn't allocate $Bitmap clusters"); } /** @@ -1034,14 +1617,12 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) s64 bm_bsize, size; s64 nr_bm_clusters; s64 nr_clusters; - int mp_size; - char *mp; u8 *tmp; a = resize->ctx->attr; if (!a->non_resident) /* FIXME: handle resident attribute value */ - perr_exit("Resident data attribute in $Bitmap not supported!"); + err_exit("Resident attribute in $Bitmap isn't supported!\n"); nr_clusters = resize->new_volume_size; bm_bsize = nr_clusters_to_bitmap_byte_size(nr_clusters); @@ -1063,24 +1644,12 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) else enlarge_bitmap_data_attr(&rl, nr_bm_clusters, nr_clusters); - if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl)) == -1) - perr_exit("ntfs_get_size_for_mapping_pairs"); - - if (mp_size > (int)(le32_to_cpu (a->length) - - le16_to_cpu (a->mapping_pairs_offset))) - err_exit("Enlarging attribute header isn't supported yet.\n"); - - if (!(mp = (char *)calloc(1, mp_size))) - perr_exit("Couldn't get memory"); - - if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl)) - perr_exit("ntfs_mapping_pairs_build"); - - memcpy((char *)a + le16_to_cpu (a->mapping_pairs_offset), mp, mp_size); a->highest_vcn = cpu_to_le64(nr_bm_clusters - 1LL); a->allocated_size = cpu_to_le64(nr_bm_clusters * vol->cluster_size); a->data_size = cpu_to_le64(bm_bsize); a->initialized_size = cpu_to_le64(bm_bsize); + + replace_attribute_runlist(resize->ctx, rl); /* * FIXME: update allocated/data sizes and timestamps in $FILE_NAME @@ -1091,13 +1660,11 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) if (bm_bsize != size) { if (size == -1) perr_exit("Couldn't write $Bitmap"); - printf("Couldn't write full $Bitmap file " - "(%lld from %lld)\n", size, bm_bsize); - exit(1); + err_exit("Couldn't write full $Bitmap file " + "(%lld from %lld)\n", size, bm_bsize); } free(rl); - free(mp); } /** @@ -1131,23 +1698,6 @@ static void lookup_data_attr(MFT_REF mref, const char *aname, ntfs_attr_search_c free(ustr); } -/** - * write_mft_record - * - * Write an MFT Record back to the disk. If the read-only command line option - * was given, this function will do nothing. - */ -static int write_mft_record(ntfs_attr_search_ctx *ctx) -{ - if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec)) - perr_exit("ntfs_mft_record_write"); - - if (vol->dev->d_ops->sync(vol->dev) == -1) - perr_exit("Failed to sync device"); - - return 0; -} - /** * truncate_badclust_file * @@ -1161,9 +1711,9 @@ static void truncate_badclust_file(s64 nr_clusters) lookup_data_attr((MFT_REF)FILE_BadClus, "$Bad", &ctx); /* FIXME: sanity_check_attr(ctx->attr); */ - truncate_badclust_bad_attr(ctx->attr, nr_clusters); + truncate_badclust_bad_attr(ctx, nr_clusters); - if (write_mft_record(ctx)) + if (write_mft_record(ctx->ntfs_ino->mft_no, ctx->mrec)) perr_exit("Couldn't update $BadClust"); ntfs_attr_put_search_ctx(ctx); @@ -1181,7 +1731,7 @@ static void truncate_bitmap_file(ntfs_resize_t *resize) lookup_data_attr((MFT_REF)FILE_Bitmap, NULL, &resize->ctx); truncate_bitmap_data_attr(resize); - if (write_mft_record(resize->ctx)) + if (write_mft_record(resize->ctx->ntfs_ino->mft_no, resize->ctx->mrec)) perr_exit("Couldn't update $Bitmap"); ntfs_attr_put_search_ctx(resize->ctx); @@ -1210,45 +1760,55 @@ static void setup_lcn_bitmap(void) * * FIXME: should be done using ntfs_* functions */ -static void update_bootsector(s64 nr_clusters) +static void update_bootsector(ntfs_resize_t *r) { NTFS_BOOT_SECTOR bs; + s64 bs_size = sizeof(NTFS_BOOT_SECTOR); printf("Updating Boot record ...\n"); if (vol->dev->d_ops->seek(vol->dev, 0, SEEK_SET) == (off_t)-1) perr_exit("lseek"); - if (vol->dev->d_ops->read(vol->dev, &bs, - sizeof(NTFS_BOOT_SECTOR)) == -1) + if (vol->dev->d_ops->read(vol->dev, &bs, bs_size) == -1) perr_exit("read() error"); - bs.number_of_sectors = nr_clusters * bs.bpb.sectors_per_cluster; + bs.number_of_sectors = r->new_volume_size * bs.bpb.sectors_per_cluster; bs.number_of_sectors = cpu_to_le64(bs.number_of_sectors); + if (r->mftmir_old) { + int save_progress = opt.show_progress; + + opt.show_progress = 0; + copy_clusters(r, r->mftmir_rl.lcn, r->mftmir_old, + r->mftmir_rl.length); + bs.mftmirr_lcn = cpu_to_le64(r->mftmir_rl.lcn); + opt.show_progress = save_progress; + } + if (vol->dev->d_ops->seek(vol->dev, 0, SEEK_SET) == (off_t)-1) perr_exit("lseek"); if (!opt.ro_flag) - if (vol->dev->d_ops->write(vol->dev, &bs, - sizeof(NTFS_BOOT_SECTOR)) == -1) + if (vol->dev->d_ops->write(vol->dev, &bs, bs_size) == -1) perr_exit("write() error"); } /** - * volume_size + * vol_size */ -static s64 volume_size(ntfs_volume *v, s64 nr_clusters) +static s64 vol_size(ntfs_volume *v, s64 nr_clusters) { - return nr_clusters * v->cluster_size; + /* add one sector_size for the backup boot sector */ + return nr_clusters * v->cluster_size + v->sector_size; } /** - * print_volume_size + * print_vol_size * * Print the volume size in bytes and decimal megabytes. */ -static void print_volume_size(const char *str, s64 bytes) +static void print_vol_size(const char *str, s64 bytes) { printf("%s: %lld bytes (%lld MB)\n", str, bytes, rounded_up_division(bytes, NTFS_MBYTE)); @@ -1261,20 +1821,22 @@ static void print_volume_size(const char *str, s64 bytes) */ static void print_disk_usage(ntfs_resize_t *resize) { - s64 total, used, relocations; + s64 total, used; total = vol->nr_clusters * vol->cluster_size; used = resize->inuse * vol->cluster_size; - relocations = resize->relocations * vol->cluster_size; printf("Space in use : %lld MB (%.1f%%)\n", rounded_up_division(used, NTFS_MBYTE), 100.0 * ((float)used / total)); +} + +static void print_num_of_relocations(ntfs_resize_t *resize) +{ + s64 relocations = resize->relocations * vol->cluster_size; - if (opt.bytes) - printf("Needed relocations : %lld (%lld MB)\n", - resize->relocations, - rounded_up_division(relocations, NTFS_MBYTE)); + printf("Needed relocations : %lld (%lld MB)\n", resize->relocations, + rounded_up_division(relocations, NTFS_MBYTE)); } /** @@ -1308,12 +1870,8 @@ static void mount_volume(void) int err = errno; perr_printf("ntfs_mount failed"); - if (err == EINVAL) { - printf("Apparently device '%s' doesn't have a " - "valid NTFS. Maybe you selected\nthe whole " - "disk instead of a partition (e.g. /dev/hda, " - "not /dev/hda1)?\n", opt.volume); - } + if (err == EINVAL) + printf(invalid_ntfs_msg, opt.volume); exit(1); } @@ -1321,14 +1879,16 @@ static void mount_volume(void) if (opt.force-- <= 0) err_exit("Volume is dirty. Run chkdsk /f and " "please try again (or see -f option).\n"); + + if (NTFS_MAX_CLUSTER_SIZE < vol->cluster_size) + err_exit("Cluster size %u is too large!\n", vol->cluster_size); printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); if (ntfs_version_is_supported(vol)) perr_exit("Unknown NTFS version"); printf("Cluster size : %u bytes\n", vol->cluster_size); - print_volume_size("Current volume size", - volume_size(vol, vol->nr_clusters)); + print_vol_size("Current volume size", vol_size(vol, vol->nr_clusters)); } /** @@ -1364,15 +1924,51 @@ static void prepare_volume_fixup(void) perr_exit("Failed to sync device"); } -/** - * main - * - * Start here - */ + +static void set_disk_usage_constraint(ntfs_resize_t *resize) +{ + /* last lcn for a filled up volume (no empty space) */ + s64 last = resize->inuse - 1; + + if (resize->last_unsupp < last) + resize->last_unsupp = last; +} + +static void check_shrink_constraints(ntfs_resize_t *resize) +{ + s64 new_size = resize->new_volume_size; + + /* FIXME: resize.shrink true also if only -i is used */ + if (!resize->shrink) + return; + + if (resize->inuse == vol->nr_clusters) + err_exit("Volume is full. To shrink it, " + "delete unused files.\n"); + + if (opt.info) + return; + + /* FIXME: reserve some extra space so Windows can boot ... */ + if (new_size < resize->inuse) + err_exit("New size can't be less than the space already" + " occupied by data.\nYou either need to delete unused" + " files or see the -i option.\n"); + + if (new_size <= resize->last_unsupp) + err_exit("The fragmentation type, you have, isn't " + "supported yet. Rerun ntfsresize\nwith " + "the -i option to calculate the smallest " + "shrunken volume size supported.\n"); + + print_num_of_relocations(resize); +} + + int main(int argc, char **argv) { ntfs_resize_t resize; - s64 new_size = 0; /* in clusters */ + s64 new_size = 0; /* in clusters; 0 = --info w/o --size */ s64 device_size; /* in bytes */ printf("%s v%s\n", EXEC_NAME, VERSION); @@ -1389,39 +1985,32 @@ int main(int argc, char **argv) if (device_size <= 0) err_exit("Couldn't get device size (%lld)!\n", device_size); - print_volume_size("Current device size", device_size); + print_vol_size("Current device size", device_size); if (device_size < vol->nr_clusters * vol->cluster_size) err_exit("Current NTFS volume size is bigger than the device " - "size (%lld)!\nCorrupt partition table or incorrect " - "device partitioning?\n", device_size); + "size!\nCorrupt partition table or incorrect device " + "partitioning?\n"); - if (opt.bytes) { - if (device_size < opt.bytes) - err_exit("New size can't be bigger than the " - "device size (%lld bytes).\nIf you want to " - "enlarge NTFS then first enlarge the device " - "size by e.g. fdisk.\n", device_size); - } else if (!opt.info) + if (!opt.bytes && !opt.info) opt.bytes = device_size; - /* - * Take the integer part: we don't want to make the volume bigger - * than requested. Later on we will also decrease this value to save - * room for the backup boot sector. - */ + /* Take the integer part: don't make the volume bigger than requested */ new_size = opt.bytes / vol->cluster_size; - if (!opt.info) - print_volume_size("New volume size ", - volume_size(vol, new_size)); - /* Backup boot sector at the end of device isn't counted in NTFS - volume size thus we have to reserve space for. We don't trust - the user does this for us: better to be on the safe side ;) */ + volume size thus we have to reserve space for it. */ if (new_size) --new_size; + if (!opt.info) { + print_vol_size("New volume size ", vol_size(vol, new_size)); + if (device_size < opt.bytes) + err_exit("New size can't be bigger than the device size" + ".\nIf you want to enlarge NTFS then first " + "enlarge the device size by e.g. fdisk.\n"); + } + if (!opt.info && (new_size == vol->nr_clusters || (opt.bytes == device_size && new_size == vol->nr_clusters - 1))) { @@ -1433,6 +2022,8 @@ int main(int argc, char **argv) memset(&resize, 0, sizeof(resize)); resize.new_volume_size = new_size; + + /* This is also true if --info was used w/o --size (new_size = 0) */ if (new_size < vol->nr_clusters) resize.shrink = 1; @@ -1447,30 +2038,32 @@ int main(int argc, char **argv) compare_bitmaps(&lcn_bitmap); print_disk_usage(&resize); + + set_disk_usage_constraint(&resize); + check_shrink_constraints(&resize); if (opt.info) { - advise_on_resize(&resize); + advise_on_resize(&resize); exit(0); } - - if (resize.last_unsupp >= new_size) { - advise_on_resize(&resize); - exit(1); - } if (opt.force-- <= 0 && !opt.ro_flag) { printf(resize_warning_msg); proceed_question(); } + /* FIXME: performance - relocate logfile here if it's needed */ prepare_volume_fixup(); + if (resize.relocations) + relocate_inodes(&resize); + truncate_badclust_file(new_size); truncate_bitmap_file(&resize); - update_bootsector(new_size); + update_bootsector(&resize); /* We don't create backup boot sector because we don't know where the - partition will be split. The scheduled chkdsk will fix it anyway */ + partition will be split. The scheduled chkdsk will fix it */ if (opt.ro_flag) { printf("The read-only test run ended successfully.\n"); @@ -1482,9 +2075,8 @@ int main(int argc, char **argv) perr_exit("fsync"); printf("Successfully resized NTFS on device '%s'.\n", vol->dev->d_name); - if (new_size < vol->nr_clusters) + if (resize.shrink) printf(resize_important_msg); return 0; } - From 278d707401af6a3e0b0e99ca5a347a3045e04a45 Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1122/2994] Added some related utils to "SEE ALSO". 2003/11/12 18:16:17+00:00 flatcap.org!ntfs Auto merged 2003/11/04 13:06:21+00:00 cantab.net!aia21 Auto merged 2003/10/29 13:34:28+00:00 cantab.net!aia21 Auto merged 2003/10/29 13:30:17+00:00 flatcap.org!ntfs updates from Szaka (Logical change 1.299) --- ntfsprogs/ntfsclone.8.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 1618eae4..c84888bc 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -266,5 +266,9 @@ is part of the ntfsprogs package and is available from http://linux\-ntfs.sourceforge.net/downloads.html .hy .SH SEE ALSO +.BR ntfsresize (8) .BR ntfsprogs (8) +.BR xfs_copy (8) +.BR debugreiserfs (8) +.BR e2image (8) From fa02ef73bf25eb40dadcc198ed0d16478bc6383a Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Sat, 6 Mar 2004 17:42:28 +0000 Subject: [PATCH 1123/2994] Almost completely rewritten, extended with the data relocation related issues. 2003/11/04 13:06:21+00:00 cantab.net!aia21 Auto merged 2003/10/29 13:34:28+00:00 cantab.net!aia21 Auto merged 2003/10/29 13:30:17+00:00 flatcap.org!ntfs updates from Szaka (Logical change 1.299) --- ntfsprogs/ntfsresize.8.in | 242 ++++++++++++++++++++++---------------- 1 file changed, 138 insertions(+), 104 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index aa87ca86..e94b7ed8 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -1,22 +1,27 @@ .\" -*- nroff -*- -.\" Copyright 2002-2003 by Szabolcs Szakacsits All Rights Reserved. +.\" Copyright 2002-2004 by Szabolcs Szakacsits All Rights Reserved. .\" -.TH NTFSRESIZE 8 "Oct 2003" "ntfsprogs @VERSION@" +.TH NTFSRESIZE 8 "Feb 2004" "ntfsprogs @VERSION@" .SH NAME -ntfsresize \- resize an NTFS filesystem +ntfsresize \- resize an NTFS filesystem without data loss .SH SYNOPSIS .B ntfsresize -[\fB\-fhin\fR] -[\fB\-s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR]] +[\fBOPTIONS\fR] +.B --info +.I device +.br +.B ntfsresize +[\fBOPTIONS\fR] +[\fB\-\-size \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR]] .I device .SH DESCRIPTION The .B ntfsresize -program non-destructively resizes Windows NT4, 2000, XP or Windows Server 2003 -NTFS filesystems. At present it can be used to enlarge any or shrink a -defragmented NTFS filesystem located on an unmounted +program non-destructively resizes Windows XP/2000/NT4, Windows Server 2003 +or Longhorn Beta NTFS filesystems. It can be used to shrink or enlarge +any NTFS filesystem located on an unmounted .I device -(usually a disk partition). The new volume will have +(usually a disk partition). The new filesystem will have .I size bytes. The @@ -30,36 +35,11 @@ conforms to the SI, ATA, IEEE standards and the disk manufacturers by using k=10^3, M=10^6 and G=10^9. If both -.B -i +.B --info and -.B -s +.B --size are omitted then the -NTFS filesystem will be enlarged to the device size. - -If the options -.B -i -and -.B -s -are used together then list inodes (files) using space over -.I size\fR. At present -.B ntfsresize -can not relocate the files listed to the beginning -of the partition thus it refuses to resize at -.I size -if there is any. -To convert the inodes to meaningful file names, you must mount -the partition with the -.I show_sys_files -mount option and run for instance -.RS -.sp -.B find /mount/point \-inum \-o \-inum ... -.sp -.RE -Before a real resize operation, always make a read-only -test run using the -.B -n -option. +NTFS filesystem will be enlarged to the underlying device size. .PP The .B ntfsresize @@ -67,104 +47,158 @@ program doesn't manipulate the size of partitions. To do that you have to use a disk partitioning tool, for example .BR fdisk (8). .PP -If you wish to enlarge an NTFS filesystem then -first you must enlarge the size of the -underlying partition. This can be done using -.BR fdisk (8) -by deleting the partition and recreating it with a larger size. -Then you may use -.B ntfsresize -to enlarge the size of the filesystem. -.PP +.B IMPORTANT! +Generally it's a good practice making regular backups of your +valuable data, especially before using any partitioning tools. To do so +for NTFS, you could use +.BR ntfsclone (8). +It's also included in the +.BR ntfsprogs (8) +package. +.SH SHRINKAGE If you wish to shrink an NTFS partition, first use .B ntfsresize to shrink the size of the filesystem. Then you may use .BR fdisk (8) to shrink the size of the partition by deleting the partition and recreating it with the smaller size. -.PP -.B IMPORTANT! -When recreating the partition with +But be careful, do not make the partition smaller than the new size of +the NTFS filesystem otherwise you won't be able to boot and +you might lose your data. +.SH ENLARGEMENT +To enlarge an NTFS filesystem, first you must enlarge the size of the +underlying partition. This can be done using .BR fdisk (8) -make sure you create it with the same starting -disk cylinder and partition type -as before. -If you enlarge a partition make sure it will not overlap with -an other existing partition! -If you shrink a partition, do not make -it smaller than the new size of the NTFS filesystem! +by deleting the partition and recreating it with a larger size. +Make sure it will not overlap with an other existing partition. +Then you may use +.B ntfsresize +to enlarge the size of the filesystem. +.SH PARTITIONING +When recreating the partition by a disk partitioning tool, +make sure you create it with the same +starting disk cylinder (sector) and partition type as before. Otherwise you may lose your entire filesystem. + Also make sure you set the bootable flag for the partition if it existed before. Failing to do so you might not be able to boot your -computer from the disk! -.PP -Note, -.B ntfsresize -schedules an NTFS consistency check -when you will boot Windows. Windows may force a reboot after -the successful consistency check. - +computer from the disk. .SH OPTIONS -.TP -.B -f -Forces ntfsresize to proceed with the filesystem resize operation, overriding -some safety checks which +Below is a summary of all the options that .B ntfsresize -normally enforces. You can use this -parameter multiply times if you want to overcome every single safety checks. +accepts. All options have two equivalent names. The short name is preceded by +.BR \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.BR \-fi +is equivalent to +.BR "\-f \-i". .TP -.B -h -Display help and exit. +.B -i, --info +By using this option ntfsresize will determine the theoretically smallest +shrunken filesystem size supported. Most of the time the result is the space +already used on the filesystem. Ntfsresize will refuse shrinking to a +smaller size than what you got by this option and depending on several +factors it might be unable to shrink very close to this theoretically +size. Although the integrity of your data should be never in risk in +any case, it's recommended to make a test run using the +.B --no-action +option before real resizing. + +Practically the smallest shrunken size generally is +at around "used space" + (20-200 MB). Please also take into account +that Windows might need about 50-100 MB free space left to boot safely. + +This option never causes any changes to the filesystem, the partition is +opened read-only. .TP -.B -i -Using this option you can calculate the smallest shrunken volume size supported. -This option will not make any changes to the filesystem. -You can use this option with -.B -s\fR. See the meaning of this case above. -.TP -.B -n -Use this option to make a test run before doing the real resize operation. -Volume will be opened read-only and -.B ntfsresize -displays what it would do if it were to resize the filesystem. -.TP -.B -s \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] -Resize volume to \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes. +.B -s, --size \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] +Resize filesystem to \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes. The optional modifiers \fBk\fR, \fBM\fR, \fBG\fR mean the .I size parameter is given in kilo-, mega- or gigabytes respectively. -Conforming to standards, k=10^3, M=10^6 and G=10^9. You can also use this option +Conforming to standards, k=10^3, M=10^6 and G=10^9. Use this option with -.B -i\fR. See the meaning of this case above. +.B --no-action +first. +.TP +.B -f, --force +Forces ntfsresize to proceed with the resize operation if the filesystem +is marked "dirty" for consistency check. + +Please note, ntfsresize always marks the filesystem +"dirty" before a real resize operation and it leaves that way for extra +safety. Thus if NTFS was marked by ntfsresize then it's safe to +use this option. If you need +to resize several times without booting into Windows between each +resizing steps then you must use this option. +.TP +.B -n, --no-action +Use this option to make a test run before doing the real resize operation. +Volume will be opened read-only and +.B ntfsresize +displays what it would do if it were to resize the filesystem. +Continue with the real resizing only if the test run passed. +.TP +.B -P, --no-progress-bar +Don't show progress bars. +.TP +.B -v, --verbose +More output. +.TP +.B -h, --help +Display help and exit. .SH EXIT CODES The exit code is 0 on success, non-zero otherwise. -.SH BUGS -No bugs are known or has been reported so far in the current version. -If you find otherwise, please report it to -(no subscription needed). It's also strongly advised you -.B MAKE SURE YOU HAVE A BACKUP -of your important data in case of an unexpected failure. +.SH KNOWN ISSUES +No reliability problems are known or has been reported. If you need +help please try the ntfsresize FAQ first (see below) and if you +don't find your answer then send your question, comment or bug report to +. No subscription is needed +but the mailing list is moderated and it can take some time +to approve your post. .PP -Future work is planned to include support for resizing fragmented NTFS volumes. -Please note, Windows 2000, XP and Windows Server 2003 have built in NTFS -defragmenter. +There are some very rarely met limitations at present: filesystems having +bad sectors, highly fragmented Master File Table (MFT) and relocation +of the first MFT extent aren't supported yet. These cases are +detected and resizing is refused or restricted to a safe size. +.PP +.B ntfsresize +schedules an NTFS consistency check and +after the first boot into Windows you must see +.B chkdsk +running on a blue background. This is intentional. +Windows may force a quick reboot after the consistency check. +Moreover after repartitioning your disk and depending on the +hardware configuration, the Windows message +.B System Settings Change +may also appear. Just acknowledge it and reboot again. .SH AUTHOR .B ntfsresize has been written by Szabolcs Szakacsits . .SH ACKNOWLEDGEMENT -Many thanks to Anton Altaparmakov and Richard Russon (FlatCap) -for libntfs, excellent documentation, comments, testing and fixes, -moreover to Theodore Ts'o whose +Many thanks to Anton Altaparmakov and Richard Russon +for libntfs, the excellent documentation and comments, +to Gergely Madarasz, Dewey M. Sasser and Miguel Lastra and his colleagues +at the University of Granada for their continuous and highly valuable help, +furthermore to Erik Meade, Martin Fick, Sandro Hawke, Dave Croal, +Lorrin Nelson, Geert Hendrickx, Robert Bjorkman and Richard Burdick +for beta testing and to Theodore Ts'o whose .BR resize2fs (8) man page formed the basis of this page. .SH AVAILABILITY .B ntfsresize -is part of the linux-ntfs package and is available from -http://linux-ntfs.sourceforge.net/ as source and pre-compiled binary. +is part of the +.BR ntfsprogs (8) +package and is available from +http://linux-ntfs.sourceforge.net/ as source and precompiled binary. .B ntfsresize -related news, example of usage and FAQ (frequently asked questions) -is maintained at +related news, example of usage, troubleshooting, statically linked binary and +FAQ (frequently asked questions) is maintained at +.br http://mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html .SH SEE ALSO .BR fdisk (8), From 7e83a08c1eabd56c5bea19400959901f0df185a1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 18:08:14 +0000 Subject: [PATCH 1124/2994] update (Logical change 1.300) --- ntfsprogs/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 9ab31413..9ee15e86 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_TRUE@AM_LFLAGS = -static @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From 3a520c42aeccfe21892fcd61ad789518073e854c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 6 Mar 2004 18:08:14 +0000 Subject: [PATCH 1125/2994] update build file BKrev: 404a138e8Ih8CK5NDwba0buv6ArGbg From eb6e78a185ff4e5032501d96ba679a97870e64e4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 7 Mar 2004 20:23:38 +0000 Subject: [PATCH 1126/2994] Auto merged 2004/03/07 20:22:03+00:00 cantab.net!aia21 (Logical change 1.301) --- configure | 73 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/configure b/configure index c93746ed..0ec3a40b 100755 --- a/configure +++ b/configure @@ -2121,6 +2121,15 @@ cat >>confdefs.h <<\_ACEOF _ACEOF +# For djgpp support. (Note: This needs to be before AC_PROG_CC.) +case "$target" in +*-*-*djgpp) + if test -z "$CC"; then CC=gcc; fi + if test -z "$AR"; then AR=ar; fi + if test -z "$LD"; then LD=ld; fi +;; +esac + # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3786,7 +3795,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3789 "configure"' > conftest.$ac_ext + echo '#line 3798 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5283,7 +5292,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5286:" \ +echo "$as_me:5295:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6288,11 +6297,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6291: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6300: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6295: \$? = $ac_status" >&5 + echo "$as_me:6304: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6520,11 +6529,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6523: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6532: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6527: \$? = $ac_status" >&5 + echo "$as_me:6536: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6587,11 +6596,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6590: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6599: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6594: \$? = $ac_status" >&5 + echo "$as_me:6603: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8606,7 +8615,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10848: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10843: \$? = $ac_status" >&5 + echo "$as_me:10852: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10903,11 +10912,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10906: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10915: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10910: \$? = $ac_status" >&5 + echo "$as_me:10919: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12153,7 +12162,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13085: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13080: \$? = $ac_status" >&5 + echo "$as_me:13089: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13140,11 +13149,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13143: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13152: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13147: \$? = $ac_status" >&5 + echo "$as_me:13156: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15087,11 +15096,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15090: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15099: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15094: \$? = $ac_status" >&5 + echo "$as_me:15103: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15319,11 +15328,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15322: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15331: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15326: \$? = $ac_status" >&5 + echo "$as_me:15335: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15386,11 +15395,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15389: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15398: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15393: \$? = $ac_status" >&5 + echo "$as_me:15402: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17405,7 +17414,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < Date: Sun, 7 Mar 2004 20:23:38 +0000 Subject: [PATCH 1127/2994] Auto merged 2004/03/07 20:22:08+00:00 cantab.net!aia21 Move djgpp support stuff to above AC_PROG_CC. (Logical change 1.301) --- configure.ac | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 03f57728..c8ff0812 100644 --- a/configure.ac +++ b/configure.ac @@ -92,13 +92,7 @@ AH_VERBATIM([_GNU_SOURCE], #endif]) AC_DEFINE(_GNU_SOURCE) -# Checks for programs. -AC_PROG_CC -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET -AC_PROG_LIBTOOL - +# For djgpp support. (Note: This needs to be before AC_PROG_CC.) case "$target" in *-*-*djgpp) if test -z "$CC"; then CC=gcc; fi @@ -107,6 +101,13 @@ case "$target" in ;; esac +# Checks for programs. +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_LIBTOOL + # Enable large file support. AC_SYS_LARGEFILE From 04ef0428b3b501eab43f59c0bf7771e02a5afab3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 7 Mar 2004 20:23:38 +0000 Subject: [PATCH 1128/2994] Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/03/07 20:23:09+00:00 cantab.net!aia21 Move djgpp support stuff to above AC_PROG_CC in configure.ac BKrev: 404b84ca2fXKnA6cCdErYO_gv_pJlQ From 904af325b1e52319d21cb8ccffeaffe777948353 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 8 Mar 2004 12:19:08 +0000 Subject: [PATCH 1129/2994] Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2004/03/08 12:13:28+00:00 cantab.net!aia21 Use bswap_xx instead of __bswap_constant_xx when the constant version is not available as is the case on some architectures. (Thanks to David Martínez Moreno for the bug report.) BKrev: 404c64bcSW2HoY3r5wE2bVlkCpOKEA From 60877615e6dc8c699a919b93fd24e26d92f0f9a1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 8 Mar 2004 12:19:08 +0000 Subject: [PATCH 1130/2994] Update (Logical change 1.302) --- ChangeLog | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 17a180fe..a5c6c92d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,9 +25,12 @@ xx/xx/2004 - 1.8.6-WIP Fledel) - In attribute lookup code in libntfs/attrib.c, check type against AT_UNUSED and not zero. - - Add AC_CANONICAL_HOST([]) to configure.ac and after AC_PROG_CC add + - Add AC_CANONICAL_HOST([]) to configure.ac and before AC_PROG_CC add manual provision of CC=gcc, AR=ar, and LD=ld if they are not set and the target is *-*-*djgpp. (Requested by Christophe Grenier) + - Use bswap_xx instead of __bswap_constant_xx when the constant version + is not available as is the case on some architectures. (Thanks to + David Martínez Moreno for the bug report.) 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to From 232af61717e9e7f5760ba8f2a84d437b86ebd65b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 8 Mar 2004 12:19:08 +0000 Subject: [PATCH 1131/2994] =?UTF-8?q?Use=20bswap=5Fxx=20instead=20of=20=5F?= =?UTF-8?q?=5Fbswap=5Fconstant=5Fxx=20when=20the=20constant=20version=20is?= =?UTF-8?q?=20not=20available=20as=20is=20the=20case=20on=20some=20archite?= =?UTF-8?q?ctures.=20=20(Thanks=20to=20David=20Mart=EDnez=20Moreno=20for?= =?UTF-8?q?=20the=20bug=20report.)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (Logical change 1.302) --- include/ntfs/endians.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h index ba23a0f6..e43e7cc6 100644 --- a/include/ntfs/endians.h +++ b/include/ntfs/endians.h @@ -91,6 +91,17 @@ #define __cpu_to_le32(x) bswap_32(x) #define __cpu_to_le64(x) bswap_64(x) +/* For architectures that do not provide some/all of the constant versions. */ +#ifndef __bswap_constant_16 +#define __bswap_constant_16(x) bswap_16(x) +#endif +#ifndef __bswap_constant_32 +#define __bswap_constant_32(x) bswap_32(x) +#endif +#ifndef __bswap_constant_64 +#define __bswap_constant_64(x) bswap_64(x) +#endif + #define __constant_le16_to_cpu(x) __bswap_constant_16(x) #define __constant_le32_to_cpu(x) __bswap_constant_32(x) #define __constant_le64_to_cpu(x) __bswap_constant_64(x) From 6c4c7b1721d4084d8e99146a5f60099c525cad37 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 8 Mar 2004 17:04:17 +0000 Subject: [PATCH 1132/2994] Fix typo. (From SUSE LINUX) (Logical change 1.303) --- ntfsprogs/ntfsinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index d5fda02c..34dc9e05 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -216,7 +216,7 @@ int parse_options (int argc, char *argv[]) if (opts.inode == -1 && !opts.mft) { if (argc > 1) - Eprintf ("You much specify an inode to learn about.\n"); + Eprintf ("You must specify an inode to learn about.\n"); err++; } From bdfeae1d31f8a08084c54ae0b2378d4c923f9c6c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 8 Mar 2004 17:04:17 +0000 Subject: [PATCH 1133/2994] Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/03/08 17:03:22+00:00 cantab.net!aia21 - Use head -n 1 instead of -1 in getgccver script. (From SUSE LINUX) - Fix typo in ntfsinfo.c. (From SUSE LINUX) BKrev: 404ca791aIIJT3whYPFDuwIGakLxCw From 96557cde6c68d7b8e2e26d2fc297c8b1e00e0b9d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 8 Mar 2004 17:04:17 +0000 Subject: [PATCH 1134/2994] Update (Logical change 1.303) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index a5c6c92d..8764d98b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,9 @@ xx/xx/2004 - 1.8.6-WIP - Use bswap_xx instead of __bswap_constant_xx when the constant version is not available as is the case on some architectures. (Thanks to David Martínez Moreno for the bug report.) + - Use head -n 1 instead of -1 in getgccver script. (From SUSE LINUX) + - Fix typo in ntfsinfo.c. (From SUSE LINUX) + 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to From d5c044de1bbd3dc1abc9f56cfdda5690362ac4f2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 8 Mar 2004 17:04:17 +0000 Subject: [PATCH 1135/2994] Use head -n 1 instead of -1. (From SUSE LINUX) (Logical change 1.303) --- getgccver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getgccver b/getgccver index fd5bffa2..a0e6e22e 100755 --- a/getgccver +++ b/getgccver @@ -7,4 +7,4 @@ fi # Get the gcc version. Can't do this in configure.ac as automake refuses to # preserve the square brackets while generating the configure script. -$1 --version 2>&1 | head -1 | sed s/"egcs-"// | sed s/"gcc (GCC) \([0-9]\.[0-9]*\).*"/"\1"/ +$1 --version 2>&1 | head -n 1 | sed s/"egcs-"// | sed s/"gcc (GCC) \([0-9]\.[0-9]*\).*"/"\1"/ From 02376d05928c4ccf141abff115b6c48df40ba2a4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 11:06:54 +0000 Subject: [PATCH 1136/2994] Auto merged 2004/03/09 10:52:14+00:00 cantab.net!aia21 update (Logical change 1.304) From f5bb3c333f3ec5c4b9ec70d51bd81a26d4cb6130 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 11:06:54 +0000 Subject: [PATCH 1137/2994] Make the device fd in unix_io.c be stored in malloc()ed space pointed to by the d_private pointer instead of inside the d_private pointer itself. Makes the warnings on 64 bit architectures go away. (Logical change 1.304) --- libntfs/unix_io.c | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/libntfs/unix_io.c b/libntfs/unix_io.c index 20e5d7e0..6b817bad 100644 --- a/libntfs/unix_io.c +++ b/libntfs/unix_io.c @@ -43,17 +43,24 @@ # define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ #endif +#define DEV_FD(dev) (*(int *)dev->d_private) + static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags) { struct flock flk; + int err; if (NDevOpen(dev)) { errno = EBUSY; return -1; } - /* Open the device/file obtaining the file descriptor. */ - if (((int)dev->d_private = open(dev->d_name, flags)) == -1) + if (!(dev->d_private = malloc(sizeof(int)))) return -1; + /* Open the device/file obtaining the file descriptor. */ + if ((*(int *)dev->d_private = open(dev->d_name, flags)) == -1) { + err = errno; + goto err_out; + } /* Setup our read-only flag. */ if ((flags & O_RDWR) != O_RDWR) NDevSetReadOnly(dev); @@ -65,21 +72,25 @@ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags) flk.l_type = F_WRLCK; flk.l_whence = SEEK_SET; flk.l_start = flk.l_len = 0LL; - if (fcntl((int)dev->d_private, F_SETLK, &flk)) { - int eo = errno; + if (fcntl(DEV_FD(dev), F_SETLK, &flk)) { + err = errno; Dprintf("ntfs_device_unix_io_open: Could not lock %s for %s: " "%s\n", dev->d_name, NDevReadOnly(dev) ? "reading" : "writing", strerror(errno)); - if (close((int)dev->d_private)) + if (close(DEV_FD(dev))) Dprintf("ntfs_device_unix_io_open: Warning: Could not " "close %s: %s\n", dev->d_name, strerror(errno)); - errno = eo; - return -1; + goto err_out; } /* Set our open flag. */ NDevSetOpen(dev); return 0; +err_out: + free(dev->d_private); + dev->d_private = NULL; + errno = err; + return -1; } static int ntfs_device_unix_io_close(struct ntfs_device *dev) @@ -91,32 +102,34 @@ static int ntfs_device_unix_io_close(struct ntfs_device *dev) return -1; } if (NDevDirty(dev)) - fsync((int)dev->d_private); + fsync(DEV_FD(dev)); /* Release exlusive (mandatory) lock on the whole device. */ memset(&flk, 0, sizeof(flk)); flk.l_type = F_UNLCK; flk.l_whence = SEEK_SET; flk.l_start = flk.l_len = 0LL; - if (fcntl((int)dev->d_private, F_SETLK, &flk)) + if (fcntl(DEV_FD(dev), F_SETLK, &flk)) Dprintf("ntfs_device_unix_io_close: Warning: Could not unlock " "%s: %s\n", dev->d_name, strerror(errno)); /* Close the file descriptor and clear our open flag. */ - if (close((int)dev->d_private)) + if (close(DEV_FD(dev))) return -1; NDevClearOpen(dev); + free(dev->d_private); + dev->d_private = NULL; return 0; } static s64 ntfs_device_unix_io_seek(struct ntfs_device *dev, s64 offset, int whence) { - return lseek((int)dev->d_private, offset, whence); + return lseek(DEV_FD(dev), offset, whence); } static s64 ntfs_device_unix_io_read(struct ntfs_device *dev, void *buf, s64 count) { - return read((int)dev->d_private, buf, count); + return read(DEV_FD(dev), buf, count); } static s64 ntfs_device_unix_io_write(struct ntfs_device *dev, const void *buf, @@ -127,7 +140,7 @@ static s64 ntfs_device_unix_io_write(struct ntfs_device *dev, const void *buf, return -1; } NDevSetDirty(dev); - return write((int)dev->d_private, buf, count); + return write(DEV_FD(dev), buf, count); } static s64 ntfs_device_unix_io_pread(struct ntfs_device *dev, void *buf, @@ -150,7 +163,7 @@ static s64 ntfs_device_unix_io_pwrite(struct ntfs_device *dev, const void *buf, static int ntfs_device_unix_io_sync(struct ntfs_device *dev) { if (!NDevReadOnly(dev) && NDevDirty(dev)) { - int res = fsync((int)dev->d_private); + int res = fsync(DEV_FD(dev)); if (!res) NDevClearDirty(dev); return res; @@ -160,13 +173,13 @@ static int ntfs_device_unix_io_sync(struct ntfs_device *dev) static int ntfs_device_unix_io_stat(struct ntfs_device *dev, struct stat *buf) { - return fstat((int)dev->d_private, buf); + return fstat(DEV_FD(dev), buf); } static int ntfs_device_unix_io_ioctl(struct ntfs_device *dev, int request, void *argp) { - return ioctl((int)dev->d_private, request, argp); + return ioctl(DEV_FD(dev), request, argp); } /** From f83f7b5f9c418dfa44e836b4b8015634d5d3dd85 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 11:06:54 +0000 Subject: [PATCH 1138/2994] Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/03/09 10:52:14+00:00 cantab.net!aia21 Make the device fd in unix_io.c be stored in malloc()ed space pointed to by the d_private pointer instead of inside the d_private pointer itself. Makes the warnings on 64 bit architectures go away. BKrev: 404da54egDOFADYrwrjwiUnZsoj6Jw From 15e437c9d4d4127291f0cd8df3b82a46ff90994f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 11:06:54 +0000 Subject: [PATCH 1139/2994] update (Logical change 1.304) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8764d98b..83329b69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,9 @@ xx/xx/2004 - 1.8.6-WIP David Martínez Moreno for the bug report.) - Use head -n 1 instead of -1 in getgccver script. (From SUSE LINUX) - Fix typo in ntfsinfo.c. (From SUSE LINUX) + - Make the device fd in unix_io.c be stored in malloc()ed space pointed + to by the d_private pointer instead of inside the d_private pointer + itself. Makes the warnings on 64 bit architectures go away. 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes From 8a26e04bb35b47993d6dbaff875224d7931ae822 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 12:38:51 +0000 Subject: [PATCH 1140/2994] Auto merged 2004/03/09 12:38:19+00:00 cantab.net!aia21 Update. (Logical change 1.305) --- ntfsprogs/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 9ee15e86..9ab31413 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From c5b58a7e5a26c38bc83ff4ea6d37f639156937b7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 12:38:51 +0000 Subject: [PATCH 1141/2994] Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/03/09 12:38:19+00:00 cantab.net!aia21 - Start using the default INSTALL and COPYING so our changes don't keep getting lost when anyone does autoreconf -f or autoupdate. The Linux-NTFS specific content has been moved to the README file. - Several typo fixes in the documentation/text files. BKrev: 404dbadbYldROfH6sHtUQhqEmoHu_w From 140f32650ee4f2ce93766a76521c5bf6d8f5b892 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 12:38:51 +0000 Subject: [PATCH 1142/2994] Start using the default COPYING so our changes don't keep getting lost when anyone does autoreconf -f or autoupdate. The Linux-NTFS specific content has been moved to the README file. (Logical change 1.305) --- COPYING | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/COPYING b/COPYING index 593ca947..d60c31a9 100644 --- a/COPYING +++ b/COPYING @@ -1,14 +1,3 @@ - - NOTE: The GPL below is copyrighted by the Free Software Foundation, - but the instances of code that it refers to (the Linux-NTFS project, - including the NTFS library "libntfs", the NTFS utilities "ntfsprogs" - and the Linux kernel NTFS driver) are copyrighted by me and others - who actually wrote them. - - Anton Altaparmakov - --------------------------------------------------------------------- - GNU GENERAL PUBLIC LICENSE Version 2, June 1991 From a0e310c4c606f5feaa8744146862e8d0ba479174 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 12:38:51 +0000 Subject: [PATCH 1143/2994] Start using the default INSTALL and COPYING so our changes don't keep getting lost when anyone does autoreconf -f or autoupdate. The Linux-NTFS specific content has been moved to the README file. (Logical change 1.305) --- README | 82 +++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 26 deletions(-) diff --git a/README b/README index 4daf7ed3..edf18054 100644 --- a/README +++ b/README @@ -9,35 +9,65 @@ Linux-NTFS is copyright (c) 2000-2004 Anton Altaparmakov. All of the contents of the Linux-NTFS project are free software, released under the GNU General Public License and you are welcome to redistribute them under -certain conditions. -All the libraries and utilities come with ABSOLUTELY NO WARRANTY; for details -read the GNU General Public License to be found in the file COPYING in the main -Linux-NTFS distribution directory. +certain conditions. All the libraries and utilities come with ABSOLUTELY NO +WARRANTY; for details read the GNU General Public License to be found in the +file COPYING. Note that while the GNU General Public License is copyrighted by +the Free Software Foundation, the instances of code that it refers to (the +Linux-NTFS project, including the ntfsprogs package containing the NTFS library +(libntfs) and the NTFS utilities (ntfsprogs) and the Linux kernel NTFS driver +are copyrighted by me and others who actually wrote them. -Linux-NTFS currently consists of the NTFS library (libntfs), the NTFS Gnome VFS -module (libntfs-gnomevfs) and various utilities (ntfsprogs). +The Linux-NTFS ntfsprogs package currently consists of the NTFS library +(libntfs), the NTFS Gnome VFS module (libntfs-gnomevfs), and various utilities +(ntfsprogs). -The Linux-NTFS project is registered on Sourceforge.net. The home page for -Linux-NTFS is http://linux-ntfs.sf.net/ and the project page is: -http://sf.net/projects/linux-ntfs/ +The Linux-NTFS home page is at: + http://linux-ntfs.sourceforge.net/ + +The SourceForge.net Linux-NTFS project page is at: + http://sourceforge.net/projects/linux-ntfs/ + +The latest Linux-NTFS source code is available from our BitKeeper repositories +which can be found at: + http://linux-ntfs.bkbits.net/ If you would like to take part in the development of Linux-NTFS, you are invited to subscribe to the development mailing list, -linux-ntfs-dev@lists.sourceforge.net. The easiest way to do this is to visit -the list page on sourceforge at: +linux-ntfs-dev@lists.sourceforge.net. The easiest way to do this is to visit +the list page on SourceForge at: http://lists.sourceforge.net/lists/listinfo/linux-ntfs-dev If you would like to be kept up to date about new releases and other Linux-NTFS announcements, subscribe to the linux-ntfs-announce mailing list (very low -volume). The easiest way to do this is to visit the list page on sourceforge at: +volume). The easiest way to do this is to visit the list page on SourceForge +at: http://lists.sourceforge.net/lists/listinfo/linux-ntfs-announce +Quick Installation +================== + + In most cases it should be sufficient to do: + + ./configure + make + make install <-- You usually need to be root for this one. + +The above will compile and install the NTFS library and utility programs into +/usr/local/lib and /usr/local/bin respectively. The man pages will be +installed by default in /usr/local/man. + +For more detailed installation instructions, please read the file INSTALL. + +Note, if you want to enable the additional debugging checks in the code as well +as the output of debugging information, which will be emitted to stdout, you +need to specify the `--enable-debug' option to `configure'. + NTFS library ============ Provides common NTFS access functions to the ntfsprogs and other foreign -open source applications. Note, that the library is still under development and -a lot of functionality is not yet included. +open source applications. Note, that the library is still under development +and a lot of functionality is not yet included. NTFS Gnome VFS module ===================== @@ -51,41 +81,41 @@ NTFS utilities ============== The ntfsprogs will eventually include utilities for doing all required tasks -to NTFS partitions. In general, just run a utility without any command line +to NTFS partitions. In general, just run a utility without any command line options to display the version number and usage syntax. The following utilities are so far implemented: -NtfsFix - Attempt to fix an NTFS partition that has been damaged by the Linux -NTFS driver. Note that you should run it every time after you have used the old -Linux NTFS driver to write to an NTFS partition to prevent massive data +NtfsFix - Attempt to fix an NTFS partition that has been damaged by the old +Linux NTFS driver. Note that you should run it every time after you have used +the old Linux NTFS driver to write to an NTFS partition to prevent massive data corruption from happening when Windows mounts the partition. IMPORTANT: Run this only *after* unmounting the partition in Linux but *before* rebooting into Windows NT/2000 or you *will* suffer! - You have been warned! See man 8 ntfsfix for details. -mkntfs - Format a partition with the NTFS filesystem. See man 8 mkntfs for +mkntfs - Format a partition with the NTFS filesystem. See man 8 mkntfs for command line options. -ntfslabel - Display/change the label of an NTFS partition. See man 8 ntfslabel +ntfslabel - Display/change the label of an NTFS partition. See man 8 ntfslabel for details. -ntfsundelete - Recover deleted files from an NTFS volume. See man 8 +ntfsundelete - Recover deleted files from an NTFS volume. See man 8 ntfsundelete for more details. -ntfsresize - Resize NTFS volumes. See man 8 ntfsresize for details. +ntfsresize - Resize NTFS volumes. See man 8 ntfsresize for details. -ntfsclone - Efficiently create/restore an image of an NTFS partition. See +ntfsclone - Efficiently create/restore an image of an NTFS partition. See man 8 ntfsclone for details. ntfscluster - Locate the owner of any given sector or cluster on an NTFS -partition. See man 8 ntfscluster for details. +partition. See man 8 ntfscluster for details. ntfsinfo - Show some information about an NTFS partition or one of the files -or directories within it. See man 8 ntfsinfo for details. +or directories within it. See man 8 ntfsinfo for details. ntfsls - List information about files in a directory residing on an NTFS -partition. See man 8 ntfsls for details. +partition. See man 8 ntfsls for details. ntfscat - Concatenate files and print their contents on the standard output. From 0003d039bd775f0421476ae36c6be92e2b1c4083 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 12:38:51 +0000 Subject: [PATCH 1144/2994] Start using the default INSTALL so our changes don't keep getting lost when anyone does autoreconf -f or autoupdate. The Linux-NTFS specific content has been moved to the README file. (Logical change 1.305) --- INSTALL | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/INSTALL b/INSTALL index e1fb6264..54caf7c1 100644 --- a/INSTALL +++ b/INSTALL @@ -4,19 +4,6 @@ Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. -Quick Installation -================== - - In most cases it should be sufficient to do: - - ./configure - make - make install - - The above will compile and install the NTFS library and utility -programs into /usr/local/lib and /usr/local/bin respectively. The man -pages will be installed by default in /usr/local/man. - Basic Installation ================== @@ -147,10 +134,6 @@ find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. - The `--enable-debug' option to `configure' will enable additional debugging -checks in the code as well as debugging information output which will be -emitted to stdout. - Specifying the System Type ========================== From 9cdb31ec2d38b58825b7ad4e5ff07f896f355300 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 12:38:51 +0000 Subject: [PATCH 1145/2994] Typo fixes. (Logical change 1.305) --- CREDITS | 2 +- NEWS | 2 +- TODO.libntfs | 2 +- TODO.ntfsprogs | 2 +- doc/attribute_definitions | 8 ++++---- doc/system_files.txt | 12 ++++++------ ntfsprogs.spec.in | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CREDITS b/CREDITS index eb919c2a..fc0fdb1d 100644 --- a/CREDITS +++ b/CREDITS @@ -1,4 +1,4 @@ -The following people have contributed directly or indirectly to the linux-ntfs +The following people have contributed directly or indirectly to the Linux-NTFS project. The list is sorted alphabetically, so please keep it this way! diff --git a/NEWS b/NEWS index dc489d59..f12cfb89 100644 --- a/NEWS +++ b/NEWS @@ -14,7 +14,7 @@ Merged the NTFS Gnome VFS module by Jan Kratochvil. Added new utilities: ntfsclone by Szakacsits Szabolcs, ntfscluster by Richard Russon, ntfsinfo by Matthew Fanto, ntfsls originally by Lode Leroy, modified -by Anton Altaparmakov, ntfscat by Richard Russon. +by Anton Altaparmakov, and ntfscat by Richard Russon. Library internal enhancements and API additions. Of particular note is the device io abstraction layer and the addition of the win32 device operations. diff --git a/TODO.libntfs b/TODO.libntfs index 50f96cb8..a432a132 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -51,7 +51,7 @@ * LOW priority * **************** -- Do we attach attributes (ntfs_attr) to the corresponding ntfs_inode? Now we +- Do we attach attributes (ntfs_attr) to the corresponding ntfs_inode? Now we just atach the inode to the attribute and expect the user to not shoot themselves in the foot. diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 754e203a..bd17fe42 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -24,7 +24,7 @@ Thanks, - Cleanup to use ntfs_attr_* API for editing $MFTMirr, $Volume, and $LogFile. This has the immediate benefit of enabling attribute list support and making the code simpler. -- On ntfs 3.0+ volumes need to disable the usn journal if it is active. This +- On ntfs 3.0+ volumes need to disable the usn journal if it is active. This means deleting file $UsnJrnl from /$Extend directory. - On ntfs 3.0+ volumes need to mark the quota out of date? - Probably, but it shouldn't cause any corruption not doing so for the moment so this is diff --git a/doc/attribute_definitions b/doc/attribute_definitions index 5cad62a9..45b4d2c4 100644 --- a/doc/attribute_definitions +++ b/doc/attribute_definitions @@ -21,7 +21,7 @@ __u32 flags = 0x42 __u64 min_size = 0x44 __u64 max_size = 0x242 -/* The $volume_version attribute has never been observed in the field. It +/* The $volume_version attribute has never been observed in the field. It * probably never was used and was hence replaced by the $object_id in * Windows 2000. */ __u16 name[64] = "$VOLUME_VERSION" in Win2k: "$OBJECT_ID" @@ -80,7 +80,7 @@ __u32 flags = 0x80 __u64 min_size = 0 __u64 max_size = -1 -/* The $symbolic_link attribute has never been observed in the field. It +/* The $symbolic_link attribute has never been observed in the field. It * probably never was used and was hence replaced by the $reparse_point in * Windows 2000. */ __u16 name[64] = "$SYMBOLIC_LINK" in Win2k: "$REPARSE_POINT" @@ -121,8 +121,8 @@ __u64 min_size = 0 __u64 max_size = 0x10000 /* - * This is terminated by a single record all of whose fields are zero. This - * also finishes the $AttrDef data attribute. I.e. the attribute size is the + * This is terminated by a single record all of whose fields are zero. This + * also finishes the $AttrDef data attribute, i.e. the attribute size is the * correct size of the sequence of attribute definitions (2560 bytes, i.e. * 16 attribute definitions of 160 bytes each). */ diff --git a/doc/system_files.txt b/doc/system_files.txt index 9ed13365..9a6cf279 100644 --- a/doc/system_files.txt +++ b/doc/system_files.txt @@ -1,17 +1,17 @@ -System files mft record numbers. All these files are always marked as used +System files mft record numbers. All these files are always marked as used in the bitmap attribute of the mft; presumably in order to avoid accidental -allocation for random other mft records. Also, the sequence number for each +allocation for random other mft records. Also, the sequence number for each of the system files is always equal to their mft record number and it is never modified. (Only $MFT has a sequence number of 1, rather than 0.) -FILE_$MFT = 0, /* Master file table (mft). Data attribute +FILE_$MFT = 0, /* Master file table (mft). Data attribute contains the entries and bitmap attribute records which ones are in use (bit==1). */ FILE_$MFTMirr = 1, /* Mft mirror (copy of first four mft records) in data attribute. */ FILE_$LogFile = 2, /* Journalling log in data attribute. */ FILE_$Volume = 3, /* Volume name attribute and volume information - attribute (flags and ntfs version). Windows + attribute (flags and ntfs version). Windows refers to this file as volume DASD (Direct Access Storage Device). */ FILE_$AttrDef = 4, /* Array of attribute definitions in data @@ -25,12 +25,12 @@ FILE_$BadClus = 8, /* Contains all bad clusters in the non-resident data attribute. */ FILE_$Secure = 9, /* Shared security descriptors in data attribute and two indexes into the descriptors. - Appeared in Windows 2000. Before that, this + Appeared in Windows 2000. Before that, this file was named $Quota but was unused. */ FILE_$UpCase = 10, /* Uppercase equivalents of all 65536 Unicode characters in data attribute. */ FILE_$Extend = 11, /* Directory containing other system files (eg. - $ObjId, $Quota, $Reparse and $UsnJrnl). This + $ObjId, $Quota, $Reparse and $UsnJrnl). This is new to NTFS3.0. */ FILE_reserved12 = 12, /* Reserved for future use (records 12-15). */ FILE_reserved13 = 13, diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index cbc3879d..baf21568 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -18,7 +18,7 @@ License : GPL Group : System Environment/Base %description The Linux-NTFS project (http://linux-ntfs.sf.net/) aims to bring full support -for the NTFS filesystem to the Linux operating system. Linux-NTFS currently +for the NTFS filesystem to the Linux operating system. Linux-NTFS currently consists of a static library and utilities such as mkntfs, ntfscat, ntfsls, ntfsresize, and ntfsundelete (for a full list of included utilities see man 8 ntfsprogs after installation). From 74a1a8f8d128ef00f13d9834d67f32f7d0245408 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 12:38:51 +0000 Subject: [PATCH 1146/2994] Update (Logical change 1.305) --- TODO.include | 4 ++++ doc/template.c | 2 +- doc/template.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/TODO.include b/TODO.include index 86012265..dd1337de 100644 --- a/TODO.include +++ b/TODO.include @@ -2,3 +2,7 @@ Finish layout.h: in particular, add: - more about EFS and the EFS attribute. +Finish logfile.h: in particular, add: + +- more about the $LogFile on disk structures + diff --git a/doc/template.c b/doc/template.c index 89f9bd85..062116b4 100644 --- a/doc/template.c +++ b/doc/template.c @@ -3,7 +3,7 @@ const char *EXEC_VERSION= "0.0.1"; /* * EXEC_NAME - Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * Short description here. * diff --git a/doc/template.h b/doc/template.h index e7d34d88..9d48a6e2 100644 --- a/doc/template.h +++ b/doc/template.h @@ -1,7 +1,7 @@ /* * NAME.h - Description. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published From 43d2c583cc32e9d9448d8220be2aa15c435b03e7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 14:47:34 +0000 Subject: [PATCH 1147/2994] Auto merged 2004/03/09 14:38:49+00:00 cantab.net!aia21 Fix all occurences of printf with %ll length modifiers but 64 bit arguments to typecast the arguments to (unsigned) long long to avoid the warnings when compiling on 64 bit architectures. (Logical change 1.306) --- libntfs/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index 2a5f7b90..23c7807e 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -165,7 +165,7 @@ static int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, s64 count, fprintf(stderr, "%s(): Eeek! Last buffer but count is " "not zero (= %lli). Leaving " "inconsistent metadata.\n", - __FUNCTION__, count); + __FUNCTION__, (long long)count); err = EIO; goto free_err_out; } From 43280fed0324d21d66fb8c4473c6178c46cc14c2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 14:47:34 +0000 Subject: [PATCH 1148/2994] Auto merged 2004/03/09 14:38:50+00:00 cantab.net!aia21 Fix all occurences of printf with %ll length modifiers but 64 bit arguments to typecast the arguments to (unsigned) long long to avoid the warnings when compiling on 64 bit architectures. (Logical change 1.306) --- ntfsprogs/ntfsclone.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 4793762b..8d0f8adc 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -637,9 +637,11 @@ static void compare_bitmaps(struct bitmap *a) if (++mismatch > 10) continue; - Printf("Cluster accounting failed at %llu " - "(0x%llx): %s cluster in $Bitmap\n", - cl, cl, bit ? "missing" : "extra"); + Printf("Cluster accounting failed at %lld " + "(0x%llx): %s cluster in " + "$Bitmap\n", (long long)cl, + (unsigned long long)cl, + bit ? "missing" : "extra"); } } } @@ -817,8 +819,8 @@ static s64 volume_size(ntfs_volume *volume, s64 nr_clusters) static void print_volume_size(const char *str, s64 bytes) { - Printf("%s: %lld bytes (%lld MB)\n", - str, bytes, rounded_up_division(bytes, NTFS_MBYTE)); + Printf("%s: %lld bytes (%lld MB)\n", str, (long long)bytes, + (long long)rounded_up_division(bytes, NTFS_MBYTE)); } @@ -830,8 +832,8 @@ static void print_disk_usage(ntfs_walk_clusters_ctx *image) used = image->inuse * vol->cluster_size; Printf("Space in use : %lld MB (%.1f%%) ", - rounded_up_division(used, NTFS_MBYTE), - 100.0 * ((float)used / total)); + (long long)rounded_up_division(used, NTFS_MBYTE), + 100.0 * ((float)used / total)); Printf("\n"); } @@ -1058,7 +1060,8 @@ int main(int argc, char **argv) walk_clusters(vol, &backup_clusters); - Printf("Num of MFT records = %8lld\n", vol->nr_mft_records); + Printf("Num of MFT records = %8lld\n", + (long long)vol->nr_mft_records); Printf("Num of used MFT records = %8d\n", nr_used_mft_records); Printf("Wiped unused MFT data = %8d\n", wiped_unused_mft_data); From 6dea8392526c61a37b07f5ad1a9f7b61e46f6919 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 14:47:34 +0000 Subject: [PATCH 1149/2994] Auto merged 2004/03/09 14:38:51+00:00 cantab.net!aia21 Fix all occurences of printf with %ll length modifiers but 64 bit arguments to typecast the arguments to (unsigned) long long to avoid the warnings when compiling on 64 bit architectures. (Logical change 1.306) --- ntfsprogs/ntfsundelete.c | 23 +++++++++++++++----- ntfsprogs/ntfswipe.c | 47 +++++++++++++++++++++++++--------------- ntfsprogs/utils.c | 24 +++++++++++++------- 3 files changed, 62 insertions(+), 32 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 4d3e823b..c3244e73 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -861,14 +861,17 @@ int calc_percentage (struct ufile *file, ntfs_volume *vol) } if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ - Vprintf ("Missing segment at beginning, %lld clusters\n", rl[0].length); + Vprintf ("Missing segment at beginning, %lld " + "clusters\n", (long long)rl[0].length); inuse += rl[0].length; rl++; } for (i = 0; rl[i].length > 0; i++) { if (rl[i].lcn == LCN_RL_NOT_MAPPED) { - Vprintf ("Missing segment at end, %lld clusters\n", rl[i].length); + Vprintf ("Missing segment at end, %lld " + "clusters\n", + (long long)rl[i].length); inuse += rl[i].length; continue; } @@ -994,7 +997,9 @@ void dump_record (struct ufile *file) Qprintf (" None\n"); } else { for (i = 0; d->runlist[i].length > 0; i++) { - Qprintf (" %lld @ %lld\n", d->runlist[i].length, d->runlist[i].lcn); + Qprintf (" %lld @ %lld\n", + (long long)d->runlist[i].length, + (long long)d->runlist[i].lcn); } } @@ -1478,7 +1483,9 @@ int undelete_file (ntfs_volume *vol, long long inode) } if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ - Vprintf ("Missing segment at beginning, %lld clusters.\n", rl[0].length); + Vprintf ("Missing segment at beginning, %lld " + "clusters.\n", + (long long)rl[0].length); memset (buffer, opts.fillbyte, bufsize); for (k = 0; k < rl[0].length * vol->cluster_size; k += bufsize) { if (write_data (fd, buffer, bufsize) < bufsize) { @@ -1492,7 +1499,9 @@ int undelete_file (ntfs_volume *vol, long long inode) for (i = 0; rl[i].length > 0; i++) { if (rl[i].lcn == LCN_RL_NOT_MAPPED) { - Vprintf ("Missing segment at end, %lld clusters.\n", rl[i].length); + Vprintf ("Missing segment at end, " + "%lld clusters.\n", + (long long)rl[i].length); memset (buffer, opts.fillbyte, bufsize); for (k = 0; k < rl[k].length * vol->cluster_size; k += bufsize) { if (write_data (fd, buffer, bufsize) < bufsize) { @@ -1684,7 +1693,9 @@ int main (int argc, char *argv[]) result = !copy_mft (vol, opts.mft_begin, opts.mft_end); if (result) Vprintf ("Failed to read MFT blocks %lld-%lld.\n", - opts.mft_begin, min (vol->nr_mft_records, opts.mft_end)); + (long long)opts.mft_begin, + (long long)min(vol->nr_mft_records, + opts.mft_end)); break; default: ; /* Cannot happen */ diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 7bc21341..650fef7a 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -387,7 +387,7 @@ s64 wipe_unused (ntfs_volume *vol, int byte, enum action act) total += vol->cluster_size; } - Qprintf ("wipe_unused 0x%02x, %lld bytes\n", byte, total); + Qprintf ("wipe_unused 0x%02x, %lld bytes\n", byte, (long long)total); free: free (buffer); return total; @@ -448,7 +448,8 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) result = ntfs_attr_mst_pread (vol->mft_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); if (result != 1) { - Eprintf ("error attr mst read %lld\n", i); + Eprintf ("error attr mst read %lld\n", + (long long)i); total = -1; // XXX just negate result? goto free; } @@ -467,7 +468,8 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) result = ntfs_attr_mst_pwrite (vol->mft_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); if (result != 1) { - Eprintf ("error attr mst write %lld\n", i); + Eprintf ("error attr mst write %lld\n", + (long long)i); total = -1; goto free; } @@ -484,7 +486,8 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) result = ntfs_attr_mst_pwrite (vol->mftmirr_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); if (result != 1) { - Eprintf ("error attr mst write %lld\n", i); + Eprintf ("error attr mst write %lld\n", + (long long)i); total = -1; goto free; } @@ -524,7 +527,8 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) result = ntfs_attr_mst_pwrite (vol->mft_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); if (result != 1) { - Eprintf ("error attr mst write %lld\n", i); + Eprintf ("error attr mst write %lld\n", + (long long)i); total = -1; goto free; } @@ -533,7 +537,7 @@ s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) } } - Qprintf ("wipe_mft 0x%02x, %lld bytes\n", byte, total); + Qprintf ("wipe_mft 0x%02x, %lld bytes\n", byte, (long long)total); free: free (buffer); return total; @@ -765,9 +769,11 @@ int ntfs_info (ntfs_volume *vol) Qprintf ("\n"); Qprintf ("Cluster size = %u\n", vol->cluster_size); - Qprintf ("Volume size = %lld clusters\n", vol->nr_clusters); - Qprintf ("Volume size = %lld bytes\n", vol->nr_clusters * vol->cluster_size); - Qprintf ("Volume size = %lld MiB\n", vol->nr_clusters * vol->cluster_size / (1024*1024)); /* round up? */ + Qprintf ("Volume size = %lld clusters\n", (long long)vol->nr_clusters); + Qprintf ("Volume size = %lld bytes\n", + (long long)vol->nr_clusters * vol->cluster_size); + Qprintf ("Volume size = %lld MiB\n", (long long)vol->nr_clusters * + vol->cluster_size / (1024*1024)); /* round up? */ Qprintf ("\n"); @@ -778,7 +784,7 @@ int ntfs_info (ntfs_volume *vol) Qprintf ("cluster\n"); //Qprintf ("allocated_size = %lld\n", vol->lcnbmp_na->allocated_size); - Qprintf ("data_size = %lld\n", vol->lcnbmp_na->data_size); + Qprintf ("data_size = %lld\n", (long long)vol->lcnbmp_na->data_size); //Qprintf ("initialized_size = %lld\n", vol->lcnbmp_na->initialized_size); { @@ -815,7 +821,8 @@ int ntfs_info (ntfs_volume *vol) } done: - Qprintf ("cluster use %lld, not %lld, total %lld\n", use, not, use+not); + Qprintf ("cluster use %lld, not %lld, total %lld\n", (long long)use, + (long long)not, (long long)(use + not)); Qprintf ("\n"); } @@ -832,13 +839,13 @@ done: if (!bitmap) return 0; - printf ("mft has %lld records\n", vol->nr_mft_records); + printf ("mft has %lld records\n", (long long)vol->nr_mft_records); //Qprintf ("allocated_size = %lld\n", vol->mftbmp_na->allocated_size); - Qprintf ("data_size = %lld\n", vol->mftbmp_na->data_size); + Qprintf ("data_size = %lld\n", (long long)vol->mftbmp_na->data_size); //Qprintf ("initialized_size = %lld\n", vol->mftbmp_na->initialized_size); - printf ("bmpsize = %lld\n", bmpsize); + printf ("bmpsize = %lld\n", (long long)bmpsize); for (bmpoff = 0; bmpoff < bmpsize; bmpoff += bmpbufsize) { if ((bmpoff + bmpbufsize) > bmpsize) bmpbufsize = bmpsize - bmpoff; @@ -867,7 +874,8 @@ done: bmpdone: printf ("mft\n"); - printf ("use %lld, not %lld, total %lld\n", use, not, use+not); + printf ("use %lld, not %lld, total %lld\n", (long long)use, + (long long)not, (long long)(use + not)); free (bitmap); } @@ -1014,9 +1022,12 @@ int main (int argc, char *argv[]) runlist_element *rl = vol->mft_na->rl; printf ("________________________________________________________________________________\n\n"); for (; rl->length > 0; rl++, i++) { - printf ("%4d %lld,%lld,%lld\n", i, rl->vcn, rl->lcn, rl->length); + printf ("%4d %lld,%lld,%lld\n", i, (long long)rl->vcn, + (long long)rl->lcn, + (long long)rl->length); } - printf ("%4d %lld,%lld,%lld\n", i, rl->vcn, rl->lcn, rl->length); + printf ("%4d %lld,%lld,%lld\n", i, (long long)rl->vcn, + (long long)rl->lcn, (long long)rl->length); return 0; } @@ -1080,7 +1091,7 @@ int main (int argc, char *argv[]) break; } - printf ("%llu bytes were wiped\n", total); + printf ("%lld bytes were wiped\n", (long long)total); } if (ntfs_volume_set_flags (vol, VOLUME_IS_DIRTY) < 0) { diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 19c18e2c..91039222 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -238,7 +238,7 @@ int utils_parse_size (const char *value, s64 *size, BOOL scale) } } else { if ((suffix[0] != '-') && (suffix[0] != 0)) { - Eprintf ("Invalid number '%.*s'.\n", (suffix - value + 1), value); + Eprintf ("Invalid number '%.*s'.\n", (int)(suffix - value + 1), value); return 0; } } @@ -472,7 +472,8 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) temp = malloc (30); if (!temp) return 0; - snprintf (temp, 30, "", inode->mft_no); + snprintf (temp, 30, "", (unsigned + long long)inode->mft_no); names[i] = temp; } @@ -492,7 +493,8 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) inode = ntfs_inode_open (vol, parent); if (!inode) { - Eprintf ("Couldn't open inode %lld.\n", MREF (parent)); + Eprintf ("Couldn't open inode %llu.\n", + (unsigned long long)MREF(parent)); break; } } @@ -776,7 +778,8 @@ ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, cons ni = ntfs_inode_open (vol, inum); if (!ni) { - Eprintf ("Cannot open inode %lld: %s.\n", inum, p); + Eprintf ("Cannot open inode %llu: %s.\n", + (unsigned long long)inum, p); goto close; } @@ -968,7 +971,8 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->flags_match = 0; int in_use = utils_mftrec_in_use (ctx->vol, (MFT_REF) ctx->mft_num); if (in_use == -1) { - Eprintf ("Error reading inode %lld. Aborting.", ctx->mft_num); + Eprintf ("Error reading inode %llu. Aborting.", + (unsigned long long)ctx->mft_num); return -1; } @@ -977,7 +981,8 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->inode = ntfs_inode_open (ctx->vol, (MFT_REF) ctx->mft_num); if (ctx->inode == NULL) { - Eprintf ("Error reading inode %lld.", ctx->mft_num); + Eprintf ("Error reading inode %llu.", (unsigned + long long) ctx->mft_num); return -1; } @@ -1046,7 +1051,9 @@ int mft_next_record (struct mft_search_ctx *ctx) } if (ntfs_attr_pread (mft, ctx->vol->mft_record_size * ctx->mft_num, ctx->vol->mft_record_size, ctx->inode->mrec) < ctx->vol->mft_record_size) { - Eprintf ("Couldn't read MFT Record %lld: %s.\n", ctx->mft_num, strerror (errno)); + Eprintf ("Couldn't read MFT Record %llu: %s.\n", + (unsigned long long) + ctx->mft_num, strerror (errno)); // free / close return -1; } @@ -1057,7 +1064,8 @@ int mft_next_record (struct mft_search_ctx *ctx) } if (ntfs_inode_close (ctx->inode)) { - Eprintf ("Error closing inode %lld.", ctx->mft_num); + Eprintf ("Error closing inode %llu.", + (unsigned long long)ctx->mft_num); return -errno; } From ddeee65b8d8c506ca9fcebd45abbafd7a455d52a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 14:47:34 +0000 Subject: [PATCH 1150/2994] Fix all occurences of printf with %ll length modifiers but 64 bit arguments to typecast the arguments to (unsigned) long long to avoid the warnings when compiling on 64 bit architectures. (Logical change 1.306) --- ChangeLog | 4 +- ntfsprogs/dumplog.c | 37 ++++++++------ ntfsprogs/mkntfs.c | 21 +++++--- ntfsprogs/ntfsdump_logfile.c | 37 ++++++++------ ntfsprogs/ntfsinfo.c | 94 ++++++++++++++++++++---------------- ntfsprogs/ntfsls.c | 12 +++-- ntfsprogs/ntfstruncate.c | 26 ++++++---- ntfsprogs/ntfsundelete.h | 8 +-- 8 files changed, 142 insertions(+), 97 deletions(-) diff --git a/ChangeLog b/ChangeLog index 83329b69..91e6f787 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,7 +36,9 @@ xx/xx/2004 - 1.8.6-WIP - Make the device fd in unix_io.c be stored in malloc()ed space pointed to by the d_private pointer instead of inside the d_private pointer itself. Makes the warnings on 64 bit architectures go away. - + - Fix all occurences of printf with %ll length modifiers but 64 bit + arguments to typecast the arguments to (unsigned) long long to avoid + the warnings when compiling on 64 bit architectures. 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to diff --git a/ntfsprogs/dumplog.c b/ntfsprogs/dumplog.c index a97a2039..e48c92bf 100644 --- a/ntfsprogs/dumplog.c +++ b/ntfsprogs/dumplog.c @@ -159,12 +159,14 @@ pass_loc: le16_to_cpu(rph->minor_ver)); printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); printf("magic = RSTR\n"); - printf("ChkDskLsn = 0x%llx\n", sle64_to_cpu(rph->chkdsk_lsn)); + printf("ChkDskLsn = 0x%llx\n", + (unsigned long long)sle64_to_cpu(rph->chkdsk_lsn)); printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); printf("\n(1st) restart record:\n"); - printf("CurrentLsn = %llx\n", sle64_to_cpu(rr->current_lsn)); + printf("CurrentLsn = %llx\n", + (unsigned long long)sle64_to_cpu(rr->current_lsn)); printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); @@ -175,8 +177,9 @@ pass_loc: le16_to_cpu(rr->restart_area_length)); printf("ClientArrayOffset = 0x%x\n", le16_to_cpu(rr->client_array_offset)); - printf("FileSize = %llu (0x%llx)\n", sle64_to_cpu(rr->file_size), - sle64_to_cpu(rr->file_size)); + printf("FileSize = %lld (0x%llx)\n", + (long long)sle64_to_cpu(rr->file_size), + (unsigned long long)sle64_to_cpu(rr->file_size)); printf("LastLsnDataLength = 0x%x\n", le32_to_cpu(rr->last_lsn_data_length)); printf("RecordLength = 0x%x\n", le16_to_cpu(rr->record_length)); @@ -184,12 +187,14 @@ pass_loc: le16_to_cpu(rr->log_page_data_offset)); for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { printf("\nRestart client record number %i:\n", client); - printf("OldestLsn = 0x%llx\n", sle64_to_cpu(cr->oldest_lsn)); - printf("ClientRestartLsn = 0x%llx\n", + printf("OldestLsn = 0x%llx\n", (unsigned long long) + sle64_to_cpu(cr->oldest_lsn)); + printf("ClientRestartLsn = 0x%llx\n", (unsigned long long) sle64_to_cpu(cr->client_restart_lsn)); printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); - printf("SeqNumber = 0x%llx\n", le64_to_cpu(cr->seq_number)); + printf("SeqNumber = 0x%llx\n", (unsigned long long) + le64_to_cpu(cr->seq_number)); printf("ClientNameLength = 0x%x\n", le32_to_cpu(cr->client_name_length)); if (le32_to_cpu(cr->client_name_length)) { @@ -228,14 +233,14 @@ rcrd_pass_loc: printf(":"); /* Dump log record page */ printf("\nmagic = RCRD\n"); - printf("copy.last_lsn/file_offset = 0x%llx\n", + printf("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd_ph->copy.last_lsn)); printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); - printf("header.next_record_offset = 0x%llx\n", + printf("header.next_record_offset = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); - printf("header.last_end_lsn = 0x%llx\n", + printf("header.last_end_lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); /* * Where does the 0x40 come from? Is it just usa_offset + @@ -245,10 +250,11 @@ rcrd_pass_loc: client = 0; log_record_pass: printf("\nLog record %i:\n", client); - printf("this lsn = 0x%llx\n", le64_to_cpu(lr->this_lsn)); - printf("client previous lsn = 0x%llx\n", + printf("this lsn = 0x%llx\n", + (unsigned long long)le64_to_cpu(lr->this_lsn)); + printf("client previous lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(lr->client_previous_lsn)); - printf("client undo next lsn = 0x%llx\n", + printf("client undo next lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(lr->client_undo_next_lsn)); printf("client data length = 0x%x\n", le32_to_cpu(lr->client_data_length)); @@ -285,11 +291,12 @@ log_record_pass: printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); - printf("target_vcn = 0x%llx\n", sle64_to_cpu(lr->target_vcn)); + printf("target_vcn = 0x%llx\n", + (unsigned long long)sle64_to_cpu(lr->target_vcn)); if (le16_to_cpu(lr->lcns_to_follow) > 0) printf("Array of lcns:\n"); for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) - printf("lcn_list[%i].lcn = 0x%llx\n", i, + printf("lcn_list[%i].lcn = 0x%llx\n", i, (unsigned long long) sle64_to_cpu(lr->lcn_list[i].lcn)); client++; lr = (LOG_RECORD*)((char*)lr + 0x70); diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 2576a431..e4c82ad3 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -776,7 +776,8 @@ static void dump_non_resident_attr(ATTR_RECORD *a) int i; l = sle64_to_cpu(a->lowest_vcn); - printf("Lowest VCN = %lli (0x%llx)\n", l, l); + printf("Lowest VCN = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); l = sle64_to_cpu(a->highest_vcn); printf("Highest VCN = %lli (0x%llx)\n", l, l); printf("Mapping pairs array offset = 0x%x\n", @@ -787,14 +788,18 @@ static void dump_non_resident_attr(ATTR_RECORD *a) printf("Attribute is not the first extent. The following " "sizes are meaningless:\n"); l = sle64_to_cpu(a->allocated_size); - printf("Allocated size = %lli (0x%llx)\n", l, l); + printf("Allocated size = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); l = sle64_to_cpu(a->data_size); - printf("Data size = %lli (0x%llx)\n", l, l); + printf("Data size = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); l = sle64_to_cpu(a->initialized_size); - printf("Initialized size = %lli (0x%llx)\n", l, l); + printf("Initialized size = %lli (0x%llx)\n", + (long long)l, (unsigned long long)l); if (a->flags & ATTR_COMPRESSION_MASK) { l = sle64_to_cpu(a->compressed_size); - printf("Compressed size = %lli (0x%llx)\n", l, l); + printf("Compressed size = %lli (0x%llx)\n", + (long long)l, (unsigned long long)l); } i = le16_to_cpu(a->mapping_pairs_offset); dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); @@ -912,7 +917,8 @@ static void dump_mft_record(MFT_RECORD *m) u = le16_to_cpu(m->usa_ofs); printf("Update sequence array offset = %u (0x%x)\n", u, u); printf("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); - printf("$LogFile sequence number (lsn) = %llu\n", le64_to_cpu(m->lsn)); + printf("$LogFile sequence number (lsn) = %llu\n", + (unsigned long long)le64_to_cpu(m->lsn)); printf("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); printf("Reference (hard link) count = %u\n", le16_to_cpu(m->link_count)); @@ -932,7 +938,8 @@ static void dump_mft_record(MFT_RECORD *m) printf("Bytes allocated = %u (0x%x)\n", u, u); r = le64_to_cpu(m->base_mft_record); printf("Base mft record reference:\n\tMft record number = %llu\n\t" - "Sequence number = %u\n", MREF(r), MSEQNO(r)); + "Sequence number = %u\n", (unsigned long long)MREF(r), + MSEQNO(r)); printf("Next attribute instance = %u\n", le16_to_cpu(m->next_attr_instance)); a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 2315cb78..b12587a3 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -209,12 +209,14 @@ pass_loc: le16_to_cpu(rph->minor_ver)); printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); printf("magic = RSTR\n"); - printf("ChkDskLsn = 0x%llx\n", sle64_to_cpu(rph->chkdsk_lsn)); + printf("ChkDskLsn = 0x%llx\n", + (unsigned long long)sle64_to_cpu(rph->chkdsk_lsn)); printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); printf("\n(1st) restart record:\n"); - printf("CurrentLsn = %llx\n", sle64_to_cpu(rr->current_lsn)); + printf("CurrentLsn = %llx\n", + (unsigned long long)sle64_to_cpu(rr->current_lsn)); printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); @@ -225,8 +227,9 @@ pass_loc: le16_to_cpu(rr->restart_area_length)); printf("ClientArrayOffset = 0x%x\n", le16_to_cpu(rr->client_array_offset)); - printf("FileSize = %llu (0x%llx)\n", sle64_to_cpu(rr->file_size), - sle64_to_cpu(rr->file_size)); + printf("FileSize = %lld (0x%llx)\n", + (long long)sle64_to_cpu(rr->file_size), + (unsigned long long)sle64_to_cpu(rr->file_size)); if (sle64_to_cpu(rr->file_size) != l) puts("$LogFile restart area indicates a log file size" "different from the actual size!"); @@ -237,12 +240,14 @@ pass_loc: le16_to_cpu(rr->log_page_data_offset)); for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { printf("\nRestart client record number %i:\n", client); - printf("OldestLsn = 0x%llx\n", sle64_to_cpu(cr->oldest_lsn)); - printf("ClientRestartLsn = 0x%llx\n", + printf("OldestLsn = 0x%llx\n", (unsigned long long) + sle64_to_cpu(cr->oldest_lsn)); + printf("ClientRestartLsn = 0x%llx\n", (unsigned long long) sle64_to_cpu(cr->client_restart_lsn)); printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); - printf("SeqNumber = 0x%llx\n", le64_to_cpu(cr->seq_number)); + printf("SeqNumber = 0x%llx\n", (unsigned long long) + le64_to_cpu(cr->seq_number)); printf("ClientNameLength = 0x%x\n", le32_to_cpu(cr->client_name_length)); if (le32_to_cpu(cr->client_name_length)) { @@ -281,14 +286,14 @@ rcrd_pass_loc: printf(":"); /* Dump log record page */ printf("\nmagic = RCRD\n"); - printf("copy.last_lsn/file_offset = 0x%llx\n", + printf("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd_ph->copy.last_lsn)); printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); - printf("header.next_record_offset = 0x%llx\n", + printf("header.next_record_offset = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); - printf("header.last_end_lsn = 0x%llx\n", + printf("header.last_end_lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); /* * Where does the 0x40 come from? Is it just usa_offset + @@ -298,10 +303,11 @@ rcrd_pass_loc: client = 0; log_record_pass: printf("\nLog record %i:\n", client); - printf("this lsn = 0x%llx\n", le64_to_cpu(lr->this_lsn)); - printf("client previous lsn = 0x%llx\n", + printf("this lsn = 0x%llx\n", + (unsigned long long)le64_to_cpu(lr->this_lsn)); + printf("client previous lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(lr->client_previous_lsn)); - printf("client undo next lsn = 0x%llx\n", + printf("client undo next lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(lr->client_undo_next_lsn)); printf("client data length = 0x%x\n", le32_to_cpu(lr->client_data_length)); @@ -338,11 +344,12 @@ log_record_pass: printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); - printf("target_vcn = 0x%llx\n", sle64_to_cpu(lr->target_vcn)); + printf("target_vcn = 0x%llx\n", + (unsigned long long)sle64_to_cpu(lr->target_vcn)); if (le16_to_cpu(lr->lcns_to_follow) > 0) printf("Array of lcns:\n"); for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) - printf("lcn_list[%i].lcn = 0x%llx\n", i, + printf("lcn_list[%i].lcn = 0x%llx\n", i, (unsigned long long) sle64_to_cpu(lr->lcn_list[i].lcn)); client++; lr = (LOG_RECORD*)((char*)lr + 0x70); diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 34dc9e05..d6ef6537 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -254,27 +254,31 @@ void ntfs_dump_volume(ntfs_volume *vol) printf("\tVolume Version: %u.%u\n", vol->major_ver, vol->minor_ver); printf("\tSector Size: %hu\n", vol->sector_size); printf("\tCluster Size: %u\n", vol->cluster_size); - printf("\tVolume Size in Clusters: %lld\n", vol->nr_clusters); - + printf("\tVolume Size in Clusters: %lld\n", (long long)vol->nr_clusters); printf("MFT Information \n"); printf("\tMFT Record Size: %u\n", vol->mft_record_size); printf("\tMFT Zone Multiplier: %u\n", vol->mft_zone_multiplier); - printf("\tMFT Data Position: %lld\n", vol->mft_data_pos); - printf("\tMFT Zone Start: %lld\n", vol->mft_zone_start); - printf("\tMFT Zone End: %lld\n", vol->mft_zone_end); - printf("\tMFT Zone Position: %lld\n", vol->mft_zone_pos); - printf("\tCurrent Position in First Data Zone: %lld\n", vol->data1_zone_pos); - printf("\tCurrent Position in Second Data Zone: %lld\n", vol->data2_zone_pos); - printf("\tNumber of Records in MFT: %lld\n", vol->nr_mft_records); - printf("\tLCN of Data Attribute for FILE_MFT: %lld\n", vol->mft_lcn); + printf("\tMFT Data Position: %lld\n", (long long)vol->mft_data_pos); + printf("\tMFT Zone Start: %lld\n", (long long)vol->mft_zone_start); + printf("\tMFT Zone End: %lld\n", (long long)vol->mft_zone_end); + printf("\tMFT Zone Position: %lld\n", (long long)vol->mft_zone_pos); + printf("\tCurrent Position in First Data Zone: %lld\n", + (long long)vol->data1_zone_pos); + printf("\tCurrent Position in Second Data Zone: %lld\n", + (long long)vol->data2_zone_pos); + printf("\tNumber of Records in MFT: %lld\n", + (long long)vol->nr_mft_records); + printf("\tLCN of Data Attribute for FILE_MFT: %lld\n", + (long long)vol->mft_lcn); printf("\tFILE_MFTMirr Size: %d\n", vol->mftmirr_size); - printf("\tLCN of Data Attribute for File_MFTMirr: %lld\n", vol->mftmirr_lcn); + printf("\tLCN of Data Attribute for File_MFTMirr: %lld\n", + (long long)vol->mftmirr_lcn); printf("\tSize of Attribute Definition Table: %d\n", vol->attrdef_len); - printf("FILE_Bitmap Information \n"); - printf("\tFILE_Bitmap MFT Record Number: %lld\n", vol->lcnbmp_ni->mft_no); + printf("\tFILE_Bitmap MFT Record Number: %llu\n", + (unsigned long long)vol->lcnbmp_ni->mft_no); printf("\tState of FILE_Bitmap Inode: %lu\n", vol->lcnbmp_ni->state); printf("\tLength of Attribute List: %u\n", vol->lcnbmp_ni->attr_list_size); printf("\tAttribute List: %s\n", vol->lcnbmp_ni->attr_list); @@ -284,26 +288,30 @@ void ntfs_dump_volume(ntfs_volume *vol) printf("FILE_Bitmap Data Attribute Information\n"); printf("\tDecompressed Runlist: not done yet\n"); - printf("\tBase Inode: %lld\n", vol->lcnbmp_na->ni->mft_no); + printf("\tBase Inode: %llu\n", + (unsigned long long)vol->lcnbmp_na->ni->mft_no); printf("\tAttribute Types: not done yet\n"); //printf("\tAttribute Name: %s\n", vol->lcnbmp_na->name); printf("\tAttribute Name Length: %u\n", vol->lcnbmp_na->name_len); printf("\tAttribute State: %lu\n", vol->lcnbmp_na->state); - printf("\tAttribute Allocated Size: %lld\n", vol->lcnbmp_na->allocated_size); - printf("\tAttribute Data Size: %lld\n", vol->lcnbmp_na->data_size); - printf("\tAttribute Initialized Size: %lld\n", vol->lcnbmp_na->initialized_size); - printf("\tAttribute Compressed Size: %lld\n", vol->lcnbmp_na->compressed_size); - printf("\tCompression Block Size: %u\n", vol->lcnbmp_na->compression_block_size); - printf("\tCompression Block Size Bits: %u\n", vol->lcnbmp_na->compression_block_size_bits); - printf("\tCompression Block Clusters: %u\n", vol->lcnbmp_na->compression_block_clusters); - + printf("\tAttribute Allocated Size: %lld\n", + (long long)vol->lcnbmp_na->allocated_size); + printf("\tAttribute Data Size: %lld\n", + (long long)vol->lcnbmp_na->data_size); + printf("\tAttribute Initialized Size: %lld\n", + (long long)vol->lcnbmp_na->initialized_size); + printf("\tAttribute Compressed Size: %lld\n", + (long long)vol->lcnbmp_na->compressed_size); + printf("\tCompression Block Size: %u\n", + vol->lcnbmp_na->compression_block_size); + printf("\tCompression Block Size Bits: %u\n", + vol->lcnbmp_na->compression_block_size_bits); + printf("\tCompression Block Clusters: %u\n", + vol->lcnbmp_na->compression_block_clusters); //TODO: Still need to add a few more attributes - } - - /** * ntfs_dump_standard_information */ @@ -336,25 +344,25 @@ void ntfs_dump_standard_information_attr(ntfs_inode *inode) not been upgraded\n"); } if (sizeof(STANDARD_INFORMATION) == 72) { - printf("\tMaximum Number of Versions: \t %d \n", le32_to_cpu (standard_attr->maximum_versions)); - printf("\tVersion Number: \t\t %d \n", le32_to_cpu (standard_attr->version_number)); - printf("\tClass ID: \t\t\t %d \n", le32_to_cpu (standard_attr->class_id)); - printf("\tUser ID: \t\t\t %d \n", le32_to_cpu (standard_attr->owner_id)); - printf("\tSecurity ID: \t\t\t %d \n", le32_to_cpu (standard_attr->security_id)); + printf("\tMaximum Number of Versions: \t %u \n", + le32_to_cpu(standard_attr->maximum_versions)); + printf("\tVersion Number: \t\t %u \n", + le32_to_cpu(standard_attr->version_number)); + printf("\tClass ID: \t\t\t %u \n", + le32_to_cpu(standard_attr->class_id)); + printf("\tUser ID: \t\t\t %u \n", + le32_to_cpu (standard_attr->owner_id)); + printf("\tSecurity ID: \t\t\t %u \n", + le32_to_cpu(standard_attr->security_id)); + } else { + printf("\tSize of STANDARD_INFORMATION is %u. It should be either 72 or 48, \ + something is wrong...\n", sizeof(STANDARD_INFORMATION)); } - else { - printf("\tSize of STANDARD_INFORMATION is %d. It should be either 72 or 48, \ - something is wrong...\n",sizeof(STANDARD_INFORMATION)); - } - - ntfs_attr_put_search_ctx(ctx); //free ctx } - - /** * ntfs_dump_file_name_attribute */ @@ -385,10 +393,12 @@ do_next: printf("Dumping $FILE_NAME (0x30)\n"); //basic stuff about the file - printf("\tFile Name: \t\t %s\n",file_name); - printf("\tFile Name Length: \t %d\n",file_name_attr->file_name_length); - printf("\tAllocated File Size: \t %lld\n", sle64_to_cpu(file_name_attr->allocated_size)); - printf("\tReal File Size: \t %lld\n", sle64_to_cpu(file_name_attr->data_size)); + printf("\tFile Name: \t\t %s\n", file_name); + printf("\tFile Name Length: \t %d\n", file_name_attr->file_name_length); + printf("\tAllocated File Size: \t %lld\n", + (long long)sle64_to_cpu(file_name_attr->allocated_size)); + printf("\tReal File Size: \t %lld\n", + (long long)sle64_to_cpu(file_name_attr->data_size)); //time conversion stuff if (!opts.notime) { diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 7c77270e..9e2a186d 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -260,7 +260,8 @@ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, if (!opts.inode) printf("%s\n", filename); else - printf("%7lld %s\n", MREF(mref), filename); + printf("%7llu %s\n", (unsigned long long)MREF(mref), + filename); result = 0; } else { s64 filesize = 0; @@ -304,10 +305,13 @@ int list_entry(ntfsls_dirent *dirent, const uchar_t *name, } if (opts.inode) - printf("%7lld %8lld %s %s\n", MREF(mref), filesize, - t_buf + 4, filename); + printf("%7llu %8lld %s %s\n", + (unsigned long long)MREF(mref), + (long long)filesize, t_buf + 4, + filename); else - printf("%8lld %s %s\n", filesize, t_buf + 4, filename); + printf("%8lld %s %s\n", (long long)filesize, t_buf + 4, + filename); result = 0; release: diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index da4f79f0..9e6441b9 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -511,9 +511,11 @@ void dump_non_resident_attr(ATTR_RECORD *a) int i; l = sle64_to_cpu(a->lowest_vcn); - printf("Lowest VCN = %lli (0x%llx)\n", l, l); + printf("Lowest VCN = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); l = sle64_to_cpu(a->highest_vcn); - printf("Highest VCN = %lli (0x%llx)\n", l, l); + printf("Highest VCN = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); printf("Mapping pairs array offset = 0x%x\n", le16_to_cpu(a->mapping_pairs_offset)); printf("Compression unit = 0x%x: %sCOMPRESSED\n", a->compression_unit, @@ -522,14 +524,18 @@ void dump_non_resident_attr(ATTR_RECORD *a) printf("Attribute is not the first extent. The following " "sizes are meaningless:\n"); l = sle64_to_cpu(a->allocated_size); - printf("Allocated size = %lli (0x%llx)\n", l, l); + printf("Allocated size = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); l = sle64_to_cpu(a->data_size); - printf("Data size = %lli (0x%llx)\n", l, l); + printf("Data size = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); l = sle64_to_cpu(a->initialized_size); - printf("Initialized size = %lli (0x%llx)\n", l, l); + printf("Initialized size = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); if (a->flags & ATTR_COMPRESSION_MASK) { l = sle64_to_cpu(a->compressed_size); - printf("Compressed size = %lli (0x%llx)\n", l, l); + printf("Compressed size = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); } i = le16_to_cpu(a->mapping_pairs_offset); dump_mapping_pairs_array((char*)a + i, le32_to_cpu(a->length) - i); @@ -545,7 +551,7 @@ void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) int i; printf("-- Beginning dump of attribute record at offset 0x%x. --\n", - (u8*)a - (u8*)m); + (unsigned)((u8*)a - (u8*)m)); if (a->type == AT_END) { printf("Attribute type = 0x%x ($END)\n", le32_to_cpu(AT_END)); u = le32_to_cpu(a->length); @@ -648,7 +654,8 @@ void dump_mft_record(MFT_RECORD *m) u = le16_to_cpu(m->usa_ofs); printf("Update sequence array offset = %u (0x%x)\n", u, u); printf("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); - printf("$LogFile sequence number (lsn) = %llu\n", le64_to_cpu(m->lsn)); + printf("$LogFile sequence number (lsn) = %llu\n", + (unsigned long long)le64_to_cpu(m->lsn)); printf("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); printf("Reference (hard link) count = %u\n", le16_to_cpu(m->link_count)); @@ -668,7 +675,8 @@ void dump_mft_record(MFT_RECORD *m) printf("Bytes allocated = %u (0x%x)\n", u, u); r = le64_to_cpu(m->base_mft_record); printf("Base mft record reference:\n\tMft record number = %llu\n\t" - "Sequence number = %u\n", MREF(r), MSEQNO(r)); + "Sequence number = %u\n", + (unsigned long long)MREF(r), MSEQNO(r)); printf("Next attribute instance = %u\n", le16_to_cpu(m->next_attr_instance)); a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index 400c33d2..9378229c 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -50,10 +50,10 @@ struct options { int verbose; /* Extra output */ int force; /* Override common sense */ time_t since; /* Since this time */ - long long size_begin; /* Range for file size */ - long long size_end; - long long mft_begin; /* Range for mft copy */ - long long mft_end; + s64 size_begin; /* Range for file size */ + s64 size_end; + s64 mft_begin; /* Range for mft copy */ + s64 mft_end; }; struct filename { From 8b9213603f91c844d540230752d243a2be0fbd4b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 14:47:34 +0000 Subject: [PATCH 1151/2994] Manual merge. 2004/03/09 14:38:50+00:00 cantab.net!aia21 Fix all occurences of printf with %ll length modifiers but 64 bit arguments to typecast the arguments to (unsigned) long long to avoid the warnings when compiling on 64 bit architectures. (Logical change 1.306) --- ntfsprogs/ntfscluster.c | 52 +++++++++++++++++++++-------------------- ntfsprogs/ntfsresize.c | 36 +++++++++++++++++----------- 2 files changed, 49 insertions(+), 39 deletions(-) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index df81b944..065797e9 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -327,27 +327,27 @@ int info (ntfs_volume *vol) t = mc >> cb; u = mc * 100 / b / e; - printf ("bytes per sector : %lld\n", a); - printf ("bytes per cluster : %lld\n", b); - printf ("sectors per cluster : %lld\n", c); - printf ("bytes per volume : %lld\n", d); - printf ("sectors per volume : %lld\n", e); - printf ("clusters per volume : %lld\n", f); - printf ("mft records total : %lld\n", g); - printf ("mft records in use : %lld\n", h); - printf ("mft records percentage : %lld\n", i); - printf ("bytes of free space : %lld\n", j); - printf ("sectors of free space : %lld\n", k); - printf ("clusters of free space : %lld\n", l); - printf ("percentage free space : %lld\n", m); - printf ("bytes of user data : %lld\n", n); - printf ("sectors of user data : %lld\n", o); - printf ("clusters of user data : %lld\n", p); - printf ("percentage user data : %lld\n", q); - printf ("bytes of metadata : %lld\n", r); - printf ("sectors of metadata : %lld\n", s); - printf ("clusters of metadata : %lld\n", t); - printf ("percentage metadata : %lld\n", u); + printf ("bytes per sector : %llu\n", (unsigned long long)a); + printf ("bytes per cluster : %llu\n", (unsigned long long)b); + printf ("sectors per cluster : %llu\n", (unsigned long long)c); + printf ("bytes per volume : %llu\n", (unsigned long long)d); + printf ("sectors per volume : %llu\n", (unsigned long long)e); + printf ("clusters per volume : %llu\n", (unsigned long long)f); + printf ("mft records total : %llu\n", (unsigned long long)g); + printf ("mft records in use : %llu\n", (unsigned long long)h); + printf ("mft records percentage : %llu\n", (unsigned long long)i); + printf ("bytes of free space : %llu\n", (unsigned long long)j); + printf ("sectors of free space : %llu\n", (unsigned long long)k); + printf ("clusters of free space : %llu\n", (unsigned long long)l); + printf ("percentage free space : %llu\n", (unsigned long long)m); + printf ("bytes of user data : %llu\n", (unsigned long long)n); + printf ("sectors of user data : %llu\n", (unsigned long long)o); + printf ("clusters of user data : %llu\n", (unsigned long long)p); + printf ("percentage user data : %llu\n", (unsigned long long)q); + printf ("bytes of metadata : %llu\n", (unsigned long long)r); + printf ("sectors of metadata : %llu\n", (unsigned long long)s); + printf ("clusters of metadata : %llu\n", (unsigned long long)t); + printf ("percentage metadata : %llu\n", (unsigned long long)u); return 0; } @@ -463,9 +463,10 @@ int main (int argc, char *argv[]) switch (opts.action) { case act_sector: if (opts.range_begin == opts.range_end) - Qprintf ("Searching for sector %lld\n", opts.range_begin); + Qprintf ("Searching for sector %llu\n", + (unsigned long long)opts.range_begin); else - Qprintf ("Searching for sector range %lld-%lld\n", opts.range_begin, opts.range_end); + Qprintf ("Searching for sector range %llu-%llu\n", (unsigned long long)opts.range_begin, (unsigned long long)opts.range_end); /* Convert to clusters */ opts.range_begin >>= (vol->cluster_size_bits - vol->sector_size_bits); opts.range_end >>= (vol->cluster_size_bits - vol->sector_size_bits); @@ -473,9 +474,10 @@ int main (int argc, char *argv[]) break; case act_cluster: if (opts.range_begin == opts.range_end) - Qprintf ("Searching for cluster %lld\n", opts.range_begin); + Qprintf ("Searching for cluster %llu\n", + (unsigned long long)opts.range_begin); else - Qprintf ("Searching for cluster range %lld-%lld\n", opts.range_begin, opts.range_end); + Qprintf ("Searching for cluster range %llu-%llu\n", (unsigned long long)opts.range_begin, (unsigned long long)opts.range_end); result = cluster_find (vol, opts.range_begin, opts.range_end, (cluster_cb*)&print_match, NULL); break; case act_file: diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index f38bed37..9ae5b551 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -693,7 +693,9 @@ static void collect_shrink_info(ntfs_resize_t *resize, runlist *rl) return; printf("Relocation needed for inode %8lld attr 0x%x LCN 0x%08llx " - "length %6lld\n", inode, resize->ctx->attr->type, start, len); + "length %6lld\n", (long long)inode, + resize->ctx->attr->type, (unsigned long long)start, + (long long)len); } /** @@ -741,9 +743,11 @@ static void build_lcn_usage_bitmap(ntfs_resize_t *resize) if (++resize->multi_ref > 10) continue; - + printf("Cluster %llu (0x%llx) referenced " - "multiply times!\n", k, k); + "multiply times!\n", + (unsigned long long)k, + (unsigned long long)k); } } @@ -834,9 +838,11 @@ static void compare_bitmaps(struct bitmap *a) if (++mismatch > 10) continue; - printf("Cluster accounting failed at %llu " - "(0x%llx): %s cluster in $Bitmap\n", - cl, cl, bit ? "missing" : "extra"); + printf("Cluster accounting failed at %lld " + "(0x%llx): %s cluster in " + "$Bitmap\n", (long long)cl, + (unsigned long long)cl, + bit ? "missing" : "extra"); } } } @@ -1463,7 +1469,8 @@ static void print_hint(const char *s, struct llcn_t llcn) runs_b = llcn.lcn * vol->cluster_size; runs_mb = rounded_up_division(runs_b, NTFS_MBYTE); - printf("%-19s: %9lld MB %8lld\n", s, runs_mb, llcn.inode); + printf("%-19s: %9lld MB %8lld\n", s, (long long)runs_mb, + (long long)llcn.inode); } /** @@ -1660,8 +1667,8 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) if (bm_bsize != size) { if (size == -1) perr_exit("Couldn't write $Bitmap"); - err_exit("Couldn't write full $Bitmap file " - "(%lld from %lld)\n", size, bm_bsize); + err_exit("Couldn't write full $Bitmap file (%lld from %lld)\n", + (long long)size, (long long)bm_bsize); } free(rl); @@ -1810,8 +1817,8 @@ static s64 vol_size(ntfs_volume *v, s64 nr_clusters) */ static void print_vol_size(const char *str, s64 bytes) { - printf("%s: %lld bytes (%lld MB)\n", - str, bytes, rounded_up_division(bytes, NTFS_MBYTE)); + printf("%s: %lld bytes (%lld MB)\n", str, (long long)bytes, + (long long)rounded_up_division(bytes, NTFS_MBYTE)); } /** @@ -1827,7 +1834,7 @@ static void print_disk_usage(ntfs_resize_t *resize) used = resize->inuse * vol->cluster_size; printf("Space in use : %lld MB (%.1f%%)\n", - rounded_up_division(used, NTFS_MBYTE), + (long long)rounded_up_division(used, NTFS_MBYTE), 100.0 * ((float)used / total)); } @@ -1835,8 +1842,9 @@ static void print_num_of_relocations(ntfs_resize_t *resize) { s64 relocations = resize->relocations * vol->cluster_size; - printf("Needed relocations : %lld (%lld MB)\n", resize->relocations, - rounded_up_division(relocations, NTFS_MBYTE)); + printf("Needed relocations : %lld (%lld MB)\n", + (long long)resize->relocations, (long long) + rounded_up_division(relocations, NTFS_MBYTE)); } /** From 91249ad35227c64e63b38b01edffedd6d1cce54e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 14:47:34 +0000 Subject: [PATCH 1152/2994] Merge 2004/03/09 14:38:52+00:00 cantab.net!aia21 Fix all occurences of printf with %ll length modifiers but 64 bit arguments to typecast the arguments to (unsigned) long long to avoid the warnings when compiling on 64 bit architectures. BKrev: 404dd906ZnIHBbTe4bIWl40WThcnkA From b36be2a790c20bac68093901c52e98d7bba383dc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 15:27:10 +0000 Subject: [PATCH 1153/2994] Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/03/09 15:26:54+00:00 cantab.net!aia21 Missed a few one. BKrev: 404de24eZCHx5oI4jEh1CqfDELPQSQ From 717484f223747489fb7efc57cfbd42404d9a9f16 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 15:27:10 +0000 Subject: [PATCH 1154/2994] Missed this one. (Logical change 1.307) --- ntfsprogs/mkntfs.c | 3 ++- ntfsprogs/ntfsinfo.c | 5 +++-- ntfsprogs/ntfslabel.c | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index e4c82ad3..7dfa9aa5 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -779,7 +779,8 @@ static void dump_non_resident_attr(ATTR_RECORD *a) printf("Lowest VCN = %lli (0x%llx)\n", (long long)l, (unsigned long long)l); l = sle64_to_cpu(a->highest_vcn); - printf("Highest VCN = %lli (0x%llx)\n", l, l); + printf("Highest VCN = %lli (0x%llx)\n", (long long)l, + (unsigned long long)l); printf("Mapping pairs array offset = 0x%x\n", le16_to_cpu(a->mapping_pairs_offset)); printf("Compression unit = 0x%x: %sCOMPRESSED\n", a->compression_unit, diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index d6ef6537..bdab9eb0 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -355,8 +355,9 @@ void ntfs_dump_standard_information_attr(ntfs_inode *inode) printf("\tSecurity ID: \t\t\t %u \n", le32_to_cpu(standard_attr->security_id)); } else { - printf("\tSize of STANDARD_INFORMATION is %u. It should be either 72 or 48, \ - something is wrong...\n", sizeof(STANDARD_INFORMATION)); + printf("\tSize of STANDARD_INFORMATION is %u. It should be " + "either 72 or 48, something is wrong...\n", + (unsigned)sizeof(STANDARD_INFORMATION)); } ntfs_attr_put_search_ctx(ctx); //free ctx diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 1263f116..8ea8843a 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -300,9 +300,9 @@ int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, BOOL fo } label_len *= sizeof(uchar_t); if (label_len > 0x100) { - fprintf(stderr, "New label is too long. Maximum %i characters " + fprintf(stderr, "New label is too long. Maximum %u characters " "allowed. Truncating excess characters.\n", - 0x100 / sizeof(uchar_t)); + (unsigned)(0x100 / sizeof(uchar_t))); label_len = 0x100; new_label[label_len / sizeof(uchar_t)] = cpu_to_le16(L'\0'); } From 0acde67ddea7bbbfbd547c8dbf24e8c13b09d173 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 16:00:13 +0000 Subject: [PATCH 1155/2994] A few missed. (Logical change 1.308) --- ntfsprogs/cluster.c | 13 ++++++++++--- ntfsprogs/ntfscluster.c | 15 +++++++++++---- ntfsprogs/ntfsresize.c | 27 ++++++++++++++++----------- 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c index cc1d7c3a..5f3bfcaf 100644 --- a/ntfsprogs/cluster.c +++ b/ntfsprogs/cluster.c @@ -77,12 +77,14 @@ int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void m_ctx->flags_search = FEMR_IN_USE | FEMR_BASE_RECORD; while (mft_next_record (m_ctx) == 0) { - printf (RED "Inode: %lld\n" NORM, m_ctx->inode->mft_no); + printf (RED "Inode: %llu\n" NORM, (unsigned long long) + m_ctx->inode->mft_no); if (!(m_ctx->flags_match & FEMR_BASE_RECORD)) continue; - Vprintf ("Inode: %lld\n", m_ctx->inode->mft_no); + Vprintf ("Inode: %llu\n", (unsigned long long) + m_ctx->inode->mft_no); a_ctx = ntfs_attr_get_search_ctx (NULL, m_ctx->inode->mrec); @@ -109,7 +111,12 @@ int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void if (a_begin < 0) continue; // sparse, discontiguous, etc - Vprintf ("\t\t%lld\t%lld-%lld (%lld)\n", runs[j].vcn, runs[j].lcn, runs[j].lcn + runs[j].length - 1, runs[j].length); + Vprintf ("\t\t%lld\t%lld-%lld (%lld)\n", + (long long)runs[j].vcn, + (long long)runs[j].lcn, + (long long)(runs[j].lcn + + runs[j].length - 1), + (long long)runs[j].length); //dprint list if ((a_begin > c_end) || (a_end < c_begin)) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 065797e9..e80f7af2 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -377,7 +377,11 @@ int dump_file (ntfs_volume *vol, ntfs_inode *ino) if (runs) { printf (" VCN LCN Length\n"); for (i = 0; runs[i].length > 0; i++) { - printf (" %8lld %8lld %8lld\n", runs[i].vcn, runs[i].lcn, runs[i].length); + printf (" %8lld %8lld %8lld\n", + (long long)runs[i].vcn, + (long long)runs[i].lcn, + (long long) + runs[i].length); } free (runs); } @@ -407,7 +411,7 @@ int print_match (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void } utils_inode_get_name (ino, buffer, MAX_PATH); - printf ("Inode %lld %s", ino->mft_no, buffer); + printf ("Inode %llu %s", (unsigned long long)ino->mft_no, buffer); utils_attr_get_name (ino->vol, attr, buffer, MAX_PATH); printf ("/%s\n", buffer); @@ -491,7 +495,8 @@ int main (int argc, char *argv[]) result = dump_file (vol, ino); ntfs_inode_close (ino); } else { - Eprintf ("Cannot open inode %lld\n", opts.inode); + Eprintf ("Cannot open inode %llu\n", + (unsigned long long)opts.inode); } break; case act_last: @@ -504,7 +509,9 @@ int main (int argc, char *argv[]) result = dump_file (vol, ino); ntfs_inode_close (ino); } else { - Eprintf ("Cannot open inode %lld\n", opts.inode); + Eprintf ("Cannot open inode %llu\n", + (unsigned long long) + opts.inode); } result = 0; } else { diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 9ae5b551..f8546443 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -485,15 +485,16 @@ static void print_advise(s64 supp_lcn, int flags) freed_b = (vol->nr_clusters - supp_lcn + 1) * vol->cluster_size; freed_mb = freed_b / NTFS_MBYTE; - printf("You %s resize at %lld bytes ", beta ? "might" : "could", new_b); + printf("You %s resize at %lld bytes ", beta ? "might" : "could", + (long long)new_b); if ((new_mb * NTFS_MBYTE) < old_b) - printf("or %lld MB ", new_mb); + printf("or %lld MB ", (long long)new_mb); printf("(freeing "); if (freed_mb && (old_mb - new_mb)) - printf("%lld MB", old_mb - new_mb); + printf("%lld MB", (long long)(old_mb - new_mb)); else - printf("%lld bytes", freed_b); + printf("%lld bytes", (long long)freed_b); printf("). %s\n", beta ? "BETA." : "STABLE."); if (final) @@ -520,8 +521,9 @@ static int rl_items(runlist *rl) static void dump_run(runlist_element *r) { - Vprintf(" %8lld %8lld (0x%08llx) %lld\n", - r->vcn, r->lcn, r->lcn, r->length); + Vprintf(" %8lld %8lld (0x%08llx) %lld\n", (long long)r->vcn, + (long long)r->lcn, (long long)r->lcn, + (long long)r->length); } static void dump_runlist(runlist *rl) @@ -1004,7 +1006,7 @@ static void replace_attribute_runlist(ntfs_attr_search_ctx *ctx, runlist *rl) remains_size -= (next_attr - (char *)ctx->mrec); Vprintf("increase : %d\n", l); - Vprintf("shift : %lld\n", remains_size); + Vprintf("shift : %lld\n", (long long)remains_size); if (ctx->mrec->bytes_in_use + l > ctx->mrec->bytes_allocated) err_exit("Extended record needed (%d > %d), not yet " @@ -1097,7 +1099,8 @@ static int find_free_cluster(runlist_element *rle, s64 nr_vol_clusters, int hint } if (rle->length < items && rle->length < max_free_cluster_range) { max_free_cluster_range = rle->length; - Vprintf("Max free range: %7lld \n", max_free_cluster_range); + Vprintf("Max free range: %7lld \n", + (long long)max_free_cluster_range); } pos = rle->lcn + items; if (pos == nr_vol_clusters) @@ -1281,7 +1284,7 @@ static void rl_split_run(runlist **rl, int run, s64 pos) rl_set(rle_new, rle->vcn, rle->lcn, len_head); rl_set(rle_new + 1, rle->vcn + len_head, rle->lcn + len_head, len_tail); - Vprintf("Splitting run at cluster %lld:\n", pos); + Vprintf("Splitting run at cluster %lld:\n", (long long)pos); dump_run(rle); dump_run(rle_new); dump_run(rle_new + 1); free(*rl); @@ -1344,8 +1347,10 @@ static void relocate_run(ntfs_resize_t *resize, runlist **rl, int run) /* FIXME: check $MFTMirr DATA isn't multi-run (or support it) */ Vprintf("Relocate inode %7llu:0x%x:%08lld:0x%08llx --> 0x%08llx\n", - resize->mref, resize->ctx->attr->type, lcn_length, lcn, - relocate_rl->lcn); + (unsigned long long)resize->mref, + resize->ctx->attr->type, (long long)lcn_length, + (unsigned long long)lcn, + (unsigned long long)relocate_rl->lcn); relocate_clusters(resize, relocate_rl, lcn); rl_insert_at_run(rl, run, relocate_rl); From b57d8e84bc6424a12ee0f9307150e570f89a1034 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 9 Mar 2004 16:00:13 +0000 Subject: [PATCH 1156/2994] A few missed. BKrev: 404dea0del9O_HdQcM0damCtpyAP7w From 728eff061446368fae6273813380008fb288e0bc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:21:53 +0000 Subject: [PATCH 1157/2994] Auto merged 2004/03/10 09:20:50+00:00 cantab.net!aia21 Update. (Logical change 1.309) --- ntfsprogs/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 9ab31413..9ee15e86 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_TRUE@AM_LFLAGS = -static @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From e325efce766a9d1cc8cc520c511cdc4adc018952 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:21:53 +0000 Subject: [PATCH 1158/2994] Auto merged 2004/03/10 09:20:50+00:00 cantab.net!aia21 Use AC_GNU_SOURCE instead of doing it manually. (Logical change 1.309) --- configure | 72 ++++++++++++++++++++++++++-------------------------- configure.ac | 11 +++----- 2 files changed, 39 insertions(+), 44 deletions(-) diff --git a/configure b/configure index 0ec3a40b..8e38f4d4 100755 --- a/configure +++ b/configure @@ -2113,14 +2113,6 @@ else fi -# Enable GNU extensions on systems that have them. - - -cat >>confdefs.h <<\_ACEOF -#define _GNU_SOURCE 1 -_ACEOF - - # For djgpp support. (Note: This needs to be before AC_PROG_CC.) case "$target" in *-*-*djgpp) @@ -3795,7 +3787,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3798 "configure"' > conftest.$ac_ext + echo '#line 3790 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5292,7 +5284,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5295:" \ +echo "$as_me:5287:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6297,11 +6289,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6300: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6292: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6304: \$? = $ac_status" >&5 + echo "$as_me:6296: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6529,11 +6521,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6532: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6524: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6536: \$? = $ac_status" >&5 + echo "$as_me:6528: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6596,11 +6588,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6599: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6591: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6603: \$? = $ac_status" >&5 + echo "$as_me:6595: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8615,7 +8607,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10840: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10852: \$? = $ac_status" >&5 + echo "$as_me:10844: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10912,11 +10904,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10915: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10907: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10919: \$? = $ac_status" >&5 + echo "$as_me:10911: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12162,7 +12154,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13077: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13089: \$? = $ac_status" >&5 + echo "$as_me:13081: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13149,11 +13141,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13152: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13144: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13156: \$? = $ac_status" >&5 + echo "$as_me:13148: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15096,11 +15088,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15099: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15091: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15103: \$? = $ac_status" >&5 + echo "$as_me:15095: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15328,11 +15320,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15331: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15323: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15335: \$? = $ac_status" >&5 + echo "$as_me:15327: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15395,11 +15387,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15398: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15390: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15402: \$? = $ac_status" >&5 + echo "$as_me:15394: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17414,7 +17406,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <>confdefs.h <<\_ACEOF +#define _GNU_SOURCE 1 +_ACEOF + + # Enable large file support. # Check whether --enable-largefile or --disable-largefile was given. diff --git a/configure.ac b/configure.ac index c8ff0812..0994d71d 100644 --- a/configure.ac +++ b/configure.ac @@ -84,14 +84,6 @@ AC_ARG_ENABLE(really-static, ) AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes) -# Enable GNU extensions on systems that have them. -AH_VERBATIM([_GNU_SOURCE], -[/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif]) -AC_DEFINE(_GNU_SOURCE) - # For djgpp support. (Note: This needs to be before AC_PROG_CC.) case "$target" in *-*-*djgpp) @@ -108,6 +100,9 @@ AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_LIBTOOL +# Use GNU extensions if available.(AIA) +AC_GNU_SOURCE + # Enable large file support. AC_SYS_LARGEFILE From 9f277af3d88601992606b06832434a3b07336941 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:21:53 +0000 Subject: [PATCH 1159/2994] Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/03/10 09:20:51+00:00 cantab.net!aia21 Use AC_GNU_SOURCE instead of doing it manually. BKrev: 404ede31HIgRE3BpmQv_DLWjL-aQzg From 255305ee932671da94380a76f156c323d5ce2b5c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:21:53 +0000 Subject: [PATCH 1160/2994] Update. (Logical change 1.309) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 91e6f787..9b057578 100644 --- a/ChangeLog +++ b/ChangeLog @@ -39,6 +39,7 @@ xx/xx/2004 - 1.8.6-WIP - Fix all occurences of printf with %ll length modifiers but 64 bit arguments to typecast the arguments to (unsigned) long long to avoid the warnings when compiling on 64 bit architectures. + - Use AC_GNU_SOURCE in configure.ac instead of doing it manually. 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to From 3d757997b04cd1da4a2ebacb83e64921a02b6277 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:21:53 +0000 Subject: [PATCH 1161/2994] Use AC_GNU_SOURCE instead of doing it manually. (Logical change 1.309) --- config.h.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.h.in b/config.h.in index 00c24ccc..f9155955 100644 --- a/config.h.in +++ b/config.h.in @@ -233,9 +233,9 @@ /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS -/* Enable GNU extensions on systems that have them. */ +/* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE -# define _GNU_SOURCE +# undef _GNU_SOURCE #endif /* Define for large files, on AIX-style hosts. */ From 0098e55da30479e7a92981626bb4243e0d7d80c2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:26:51 +0000 Subject: [PATCH 1162/2994] Auto merged 2004/03/10 09:26:24+00:00 cantab.net!aia21 Move AC_GNU_SOURCE before AC_PROG_CC... (Logical change 1.310) --- configure | 72 ++++++++++++++++++++++++++-------------------------- configure.ac | 6 ++--- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/configure b/configure index 8e38f4d4..58f56b00 100755 --- a/configure +++ b/configure @@ -2113,6 +2113,14 @@ else fi +# Use GNU extensions if available. + +cat >>confdefs.h <<\_ACEOF +#define _GNU_SOURCE 1 +_ACEOF + + + # For djgpp support. (Note: This needs to be before AC_PROG_CC.) case "$target" in *-*-*djgpp) @@ -3787,7 +3795,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3790 "configure"' > conftest.$ac_ext + echo '#line 3798 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5284,7 +5292,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5287:" \ +echo "$as_me:5295:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6289,11 +6297,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6292: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6300: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6296: \$? = $ac_status" >&5 + echo "$as_me:6304: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6521,11 +6529,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6524: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6532: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6528: \$? = $ac_status" >&5 + echo "$as_me:6536: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6588,11 +6596,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6591: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6599: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6595: \$? = $ac_status" >&5 + echo "$as_me:6603: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8607,7 +8615,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:10848: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10844: \$? = $ac_status" >&5 + echo "$as_me:10852: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10904,11 +10912,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10907: $lt_compile\"" >&5) + (eval echo "\"\$as_me:10915: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10911: \$? = $ac_status" >&5 + echo "$as_me:10919: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12154,7 +12162,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13085: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13081: \$? = $ac_status" >&5 + echo "$as_me:13089: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13141,11 +13149,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13144: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13152: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13148: \$? = $ac_status" >&5 + echo "$as_me:13156: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15088,11 +15096,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15091: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15099: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15095: \$? = $ac_status" >&5 + echo "$as_me:15103: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15320,11 +15328,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15323: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15331: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15327: \$? = $ac_status" >&5 + echo "$as_me:15335: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15387,11 +15395,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15390: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15398: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15394: \$? = $ac_status" >&5 + echo "$as_me:15402: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17406,7 +17414,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <>confdefs.h <<\_ACEOF -#define _GNU_SOURCE 1 -_ACEOF - - # Enable large file support. # Check whether --enable-largefile or --disable-largefile was given. diff --git a/configure.ac b/configure.ac index 0994d71d..b6c22530 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,9 @@ AC_ARG_ENABLE(really-static, ) AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes) +# Use GNU extensions if available. +AC_GNU_SOURCE + # For djgpp support. (Note: This needs to be before AC_PROG_CC.) case "$target" in *-*-*djgpp) @@ -100,9 +103,6 @@ AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_LIBTOOL -# Use GNU extensions if available.(AIA) -AC_GNU_SOURCE - # Enable large file support. AC_SYS_LARGEFILE From 95d653045f26c328b2ddb3966951eff4604e1840 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:26:51 +0000 Subject: [PATCH 1163/2994] Auto merged 2004/03/10 09:26:25+00:00 cantab.net!aia21 Move AC_GNU_SOURCE before AC_PROG_CC... (Logical change 1.310) --- ntfsprogs/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 9ee15e86..9ab31413 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From 2e1295c6b2d7f9108db889ea0bc8a2bdc22ca285 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:26:51 +0000 Subject: [PATCH 1164/2994] Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/03/10 09:26:25+00:00 cantab.net!aia21 Move AC_GNU_SOURCE before AC_PROG_CC... BKrev: 404edf5bvVU0AYST1k-t4Ooaw4pr5A From 6b7c265ea89fba520e71bcbbcc84b4781b81026a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:28:31 +0000 Subject: [PATCH 1165/2994] Update (Logical change 1.311) --- ntfsprogs/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 9ab31413..9ee15e86 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_TRUE@AM_LFLAGS = -static @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From a054b1657144293b84498c1acff3d9d9f2fc7889 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:28:31 +0000 Subject: [PATCH 1166/2994] Update BKrev: 404edfbfciwhHQrmrQUc42PBbCNrww From 9bf03159a34cef1e740287576dd064a38ca3f944 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:28:44 +0000 Subject: [PATCH 1167/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs-devel into cantab.net:/home/src/ntfsprogs-devel 2004/03/10 11:08:29+02:00 omakaista.fi!szaka hand merged 2004/03/10 10:20:07+02:00 omakaista.fi!szaka - Added warnings about not modifying text messages external tools use - Options -i -s together aren't supported, if needed use -n -v -s instead - Usage() cleanup - Some endianness fixes - Suggests chkdsk /f if mount fails with EIO (Paul A. Steckler) - Removed BETA and STABLE hints, now there is only one STABLE - The --info option estimates the theoretically smallest shrunken size thus the message changed from "You ccould resize ..." to "You might resize ...". - Manual update BKrev: 404edfcc7Y3OUv1fPIlkj_nB4-MkBQ From bf67069b3fafeaac62e850eb7c51347b721616db Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Wed, 10 Mar 2004 09:28:44 +0000 Subject: [PATCH 1168/2994] Spelling fixes and update (Logical change 1.312) --- ntfsprogs/ntfsresize.8.in | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index e94b7ed8..32b37054 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -1,7 +1,7 @@ .\" -*- nroff -*- .\" Copyright 2002-2004 by Szabolcs Szakacsits All Rights Reserved. .\" -.TH NTFSRESIZE 8 "Feb 2004" "ntfsprogs @VERSION@" +.TH NTFSRESIZE 8 "Mar 2004" "ntfsprogs @VERSION@" .SH NAME ntfsresize \- resize an NTFS filesystem without data loss .SH SYNOPSIS @@ -101,9 +101,9 @@ By using this option ntfsresize will determine the theoretically smallest shrunken filesystem size supported. Most of the time the result is the space already used on the filesystem. Ntfsresize will refuse shrinking to a smaller size than what you got by this option and depending on several -factors it might be unable to shrink very close to this theoretically -size. Although the integrity of your data should be never in risk in -any case, it's recommended to make a test run using the +factors it might be unable to shrink very close to this theoretical +size. Although the integrity of your data should be never in risk, +it's still strongly recommended to make a test run by using the .B --no-action option before real resizing. @@ -161,9 +161,11 @@ but the mailing list is moderated and it can take some time to approve your post. .PP There are some very rarely met limitations at present: filesystems having -bad sectors, highly fragmented Master File Table (MFT) and relocation -of the first MFT extent aren't supported yet. These cases are -detected and resizing is refused or restricted to a safe size. +bad sectors, highly fragmented Master File Table (MFT), relocation +of the first MFT extent and resizing in the middle of some metadata +in some cases aren't supported yet. These cases are detected and +resizing is refused, restricted to a safe size or the closest safe +size is displayed. .PP .B ntfsresize schedules an NTFS consistency check and From c90976e02301612dadd149b390fc2e5ca7461da2 Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Wed, 10 Mar 2004 09:28:44 +0000 Subject: [PATCH 1169/2994] hand merged 2004/03/10 10:13:38+02:00 omakaista.fi!szaka - Added warnings about not modifying text messages external tools use - Options -i -s together aren't supported anymore, if needed use -n -v -s instead - Usage() cleanup - Some endianness fixes - Suggest chkdsk /f if mount fails with EIO (Paul A. Steckler) - Removed BETA and STABLE hints, now there is only one STABLE - The --info option estimates the theoretically smallest shrunken size thus the message changed from "You ccould resize ..." to "You might resize ...". (Logical change 1.312) --- ntfsprogs/ntfsresize.c | 100 +++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 48 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index f8546443..c0e9e214 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -5,7 +5,11 @@ * Copyright (c) 2002-2003 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon * - * This utility will resize an NTFS volume. + * This utility will resize an NTFS volume without data loss. + * + * WARNING FOR DEVELOPERS!!! Several external tools grep for text messages + * to control execution thus if you would like to change any message + * then PLEASE think twice before doing so then don't modify it. Thanks! * * 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 @@ -133,6 +137,7 @@ s64 max_free_cluster_range = 0; #define NTFS_MBYTE (1000 * 1000) +/* WARNING: don't modify the text, external tools grep for it */ #define ERR_PREFIX "ERROR" #define PERR_PREFIX ERR_PREFIX "(%d): " #define NERR_PREFIX ERR_PREFIX ": " @@ -236,21 +241,21 @@ static void usage(void) printf ("\nUsage: %s [options] device\n" " Resize an NTFS volume non-destructively.\n" "\n" - " -i --info Calculate the smallest shrunken size supported\n" - " -s num --size num Resize volume to num[k|M|G] bytes\n" + " -i, --info Estimate the smallest shrunken size supported\n" + " -s, --size SIZE Resize volume to SIZE[k|M|G] bytes\n" "\n" - " -n --no-action Do not write to disk\n" - " -f --force Force to progress (DANGEROUS)\n" - " -P --no-progress-bar Don't show progress bar\n" - " -v --verbose More output\n" - " -V --version Display version information\n" - " -h --help Display this help\n" + " -n, --no-action Do not write to disk\n" + " -f, --force Force to progress (DANGEROUS)\n" + " -P, --no-progress-bar Don't show progress bar\n" + " -v, --verbose More output\n" + " -V, --version Display version information\n" + " -h, --help Display this help\n" #ifdef DEBUG - " -d --debug Show debug information\n" + " -d, --debug Show debug information\n" #endif "\n" - " If -i and -s are used together then print information about relocations.\n" - " If both are omitted then the volume will be enlarged to the device size.\n" + " The options -i and -s are mutually exclusive. If both options are\n" + " omitted then the NTFS volume will be enlarged to the device size.\n" "\n", EXEC_NAME); printf ("%s%s", ntfs_bugs, ntfs_home); printf ("Ntfsresize FAQ: http://linux-ntfs.sourceforge.net/info/ntfsresize.html\n"); @@ -425,9 +430,9 @@ static int parse_options(int argc, char **argv) break; default: if (optopt == 's') { - Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); + Eprintf("Option '%s' requires an argument.\n", argv[optind-1]); } else { - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + Eprintf("Unknown option '%s'.\n", argv[optind-1]); } err++; break; @@ -437,11 +442,17 @@ static int parse_options(int argc, char **argv) if (!help && !ver) { if (opt.volume == NULL) { if (argc > 1) - Eprintf ("You must specify exactly one device.\n"); + Eprintf("You must specify exactly one device.\n"); err++; } - if (opt.info) + if (opt.info) { opt.ro_flag = MS_RDONLY; + if (opt.bytes) { + Eprintf(NERR_PREFIX "Options --info and --size " + "can't be used together.\n"); + usage(); + } + } } stderr = stdout; @@ -460,11 +471,9 @@ static int parse_options(int argc, char **argv) return (!err && !help && !ver); } -static void print_advise(s64 supp_lcn, int flags) +static void print_advise(s64 supp_lcn) { s64 old_b, new_b, freed_b, old_mb, new_mb, freed_mb; - int beta = flags & 1; - int final = flags & 2; old_b = vol->nr_clusters * vol->cluster_size; old_mb = rounded_up_division(old_b, NTFS_MBYTE); @@ -474,10 +483,10 @@ static void print_advise(s64 supp_lcn, int flags) supp_lcn += 2; if (supp_lcn > vol->nr_clusters) { - if (final) - printf("This fragmentation type " - "isn't supported yet. Sorry.\n"); - return; + err_printf("Very rare fragmentation type detected. " + "Sorry, it's not supported yet.\n" + "Try to defragment your NTFS, perhaps it helps.\n"); + exit(1); } new_b = supp_lcn * vol->cluster_size; @@ -485,8 +494,8 @@ static void print_advise(s64 supp_lcn, int flags) freed_b = (vol->nr_clusters - supp_lcn + 1) * vol->cluster_size; freed_mb = freed_b / NTFS_MBYTE; - printf("You %s resize at %lld bytes ", beta ? "might" : "could", - (long long)new_b); + /* WARNING: don't modify the text, external tools grep for it */ + printf("You might resize at %lld bytes ", (long long)new_b); if ((new_mb * NTFS_MBYTE) < old_b) printf("or %lld MB ", (long long)new_mb); @@ -495,11 +504,10 @@ static void print_advise(s64 supp_lcn, int flags) printf("%lld MB", (long long)(old_mb - new_mb)); else printf("%lld bytes", (long long)freed_b); - printf("). %s\n", beta ? "BETA." : "STABLE."); + printf(").\n"); - if (final) - printf("Please make a test run using both the -n and -s " - "options before real resizing!\n"); + printf("Please make a test run using both the -n and -s options " + "before real resizing!\n"); } static void rl_set(runlist *rl, VCN vcn, LCN lcn, s64 len) @@ -578,7 +586,7 @@ static int has_bad_sectors(ntfs_resize_t *resize) if (ustr && ntfs_names_are_equal(ustr, len, (uchar_t*)((char*)a + le16_to_cpu(a->name_offset)), - a->name_length, 0, NULL, 0)) + le16_to_cpu(a->name_length), 0, NULL, 0)) ret = 1; if (ustr != AT_UNNAMED) @@ -676,15 +684,12 @@ static void collect_shrink_info(ntfs_resize_t *resize, runlist *rl) len = lcn_length - (new_vol_size - lcn); if (!opt.info && (inode == FILE_MFT || inode == FILE_MFTMirr)) { - int unsafe = 3; s64 last_lcn; err_printf("$MFT%s can't be split up yet. Please try " "a different size.\n", inode ? "Mirr" : ""); last_lcn = lcn + lcn_length - 1; - if (last_lcn == resize->last_unsafe) - unsafe = 2; - print_advise(last_lcn, unsafe); + print_advise(last_lcn); exit(1); } } @@ -883,6 +888,7 @@ static void progress_update(struct progress_bar *p, u64 current) if (!opt.show_progress) return; + /* WARNING: don't modify the texts, external tools grep for them */ percent = p->unit * current; if (current != p->stop) { if ((current - p->start) % p->resolution) @@ -905,6 +911,7 @@ static void walk_inodes(ntfs_resize_t *resize) s64 last_mft_rec; ntfs_inode *ni; + /* WARNING: don't modify the text, external tools grep for it */ printf("Checking filesystem consistency ...\n"); last_mft_rec = vol->nr_mft_records - 1; @@ -965,7 +972,6 @@ static void replace_attribute_runlist(ntfs_attr_search_ctx *ctx, runlist *rl) { int mp_size, l; void *mp; - char *next_attr; ATTR_RECORD *a = ctx->attr; rl_fixup(&rl); @@ -973,7 +979,7 @@ static void replace_attribute_runlist(ntfs_attr_search_ctx *ctx, runlist *rl) if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl)) == -1) perr_exit("ntfs_get_size_for_mapping_pairs"); - if (a->name_length) { + if (le16_to_cpu(a->name_length)) { u16 name_offs = le16_to_cpu(a->name_offset); u16 mp_offs = le16_to_cpu(a->mapping_pairs_offset); @@ -986,7 +992,8 @@ static void replace_attribute_runlist(ntfs_attr_search_ctx *ctx, runlist *rl) attribute, instead check for the real size/space */ l = (int)le32_to_cpu(a->length) - le16_to_cpu(a->mapping_pairs_offset); if (mp_size > l) { - s64 remains_size; //, new_attr_size; + s64 remains_size; + char *next_attr; Vprintf("Enlarging attribute header ...\n"); @@ -1487,9 +1494,7 @@ static void print_hint(const char *s, struct llcn_t llcn) */ static void advise_on_resize(ntfs_resize_t *resize) { - int final; - - printf("Calculating smallest shrunken size supported ...\n"); + printf("Estimating smallest shrunken size supported ...\n"); printf("File feature Last used at By inode\n"); print_hint("$MFT", resize->last_mft); @@ -1501,13 +1506,7 @@ static void advise_on_resize(ntfs_resize_t *resize) print_hint("Ordinary", resize->last_lcn); } - final = (resize->last_unsafe == resize->last_unsupp) ? 2 : 0; - print_advise(resize->last_unsafe, final); - - if (final) - return; - - print_advise(resize->last_unsupp, 3); + print_advise(resize->last_unsupp); } /** @@ -1838,6 +1837,7 @@ static void print_disk_usage(ntfs_resize_t *resize) total = vol->nr_clusters * vol->cluster_size; used = resize->inuse * vol->cluster_size; + /* WARNING: don't modify the text, external tools grep for it */ printf("Space in use : %lld MB (%.1f%%)\n", (long long)rounded_up_division(used, NTFS_MBYTE), 100.0 * ((float)used / total)); @@ -1885,6 +1885,9 @@ static void mount_volume(void) perr_printf("ntfs_mount failed"); if (err == EINVAL) printf(invalid_ntfs_msg, opt.volume); + else if (err == EIO) + printf("Apparently you have a corrupted volume. " + "Please run chkdsk /f and try again!\n"); exit(1); } @@ -1971,7 +1974,7 @@ static void check_shrink_constraints(ntfs_resize_t *resize) if (new_size <= resize->last_unsupp) err_exit("The fragmentation type, you have, isn't " "supported yet. Rerun ntfsresize\nwith " - "the -i option to calculate the smallest " + "the -i option to estimate the smallest " "shrunken volume size supported.\n"); print_num_of_relocations(resize); @@ -2083,6 +2086,7 @@ int main(int argc, char **argv) exit(0); } + /* WARNING: don't modify the texts, external tools grep for them */ printf("Syncing device ...\n"); if (vol->dev->d_ops->sync(vol->dev) == -1) perr_exit("fsync"); From 05592a6c0727009d222b849353ebd65785e71b43 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:36:44 +0000 Subject: [PATCH 1170/2994] Fix two bugs in ntfsresize, a->name_length is 8 bit not 16 bit... BKrev: 404ee1acERCAJRHEsYyTCejD6vS_gQ From c5847ae8cf0bb85703734543d527334b1596a149 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 09:36:44 +0000 Subject: [PATCH 1171/2994] Fix two bugs, a->name_length is 8 bit not 16 bit... (Logical change 1.313) --- ntfsprogs/ntfsresize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index c0e9e214..d503c497 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -586,7 +586,7 @@ static int has_bad_sectors(ntfs_resize_t *resize) if (ustr && ntfs_names_are_equal(ustr, len, (uchar_t*)((char*)a + le16_to_cpu(a->name_offset)), - le16_to_cpu(a->name_length), 0, NULL, 0)) + a->name_length, 0, NULL, 0)) ret = 1; if (ustr != AT_UNNAMED) @@ -979,7 +979,7 @@ static void replace_attribute_runlist(ntfs_attr_search_ctx *ctx, runlist *rl) if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl)) == -1) perr_exit("ntfs_get_size_for_mapping_pairs"); - if (le16_to_cpu(a->name_length)) { + if (a->name_length) { u16 name_offs = le16_to_cpu(a->name_offset); u16 mp_offs = le16_to_cpu(a->mapping_pairs_offset); From c89452b85a76e4b1f9d49d9c66231839e826f751 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 10:22:03 +0000 Subject: [PATCH 1172/2994] Auto merged 2004/03/10 10:21:34+00:00 cantab.net!aia21 Use AC_CHECK_DECLS in configure.ac to determine if the constant bswap functions are defined/declared and define them to the non-constant ones in endians.h if not. (Logical change 1.314) --- configure | 191 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) diff --git a/configure b/configure index 58f56b00..1e8e9925 100755 --- a/configure +++ b/configure @@ -21509,6 +21509,197 @@ fi done +# Check for declarations of constant bswap function as some systems do not +# provide all of them. +echo "$as_me:$LINENO: checking whether __bswap_constant_16 is declared" >&5 +echo $ECHO_N "checking whether __bswap_constant_16 is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl___bswap_constant_16+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 + +int +main () +{ +#ifndef __bswap_constant_16 + char *p = (char *) __bswap_constant_16; +#endif + + ; + 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_have_decl___bswap_constant_16=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl___bswap_constant_16=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl___bswap_constant_16" >&5 +echo "${ECHO_T}$ac_cv_have_decl___bswap_constant_16" >&6 +if test $ac_cv_have_decl___bswap_constant_16 = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___BSWAP_CONSTANT_16 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___BSWAP_CONSTANT_16 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether __bswap_constant_32 is declared" >&5 +echo $ECHO_N "checking whether __bswap_constant_32 is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl___bswap_constant_32+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 + +int +main () +{ +#ifndef __bswap_constant_32 + char *p = (char *) __bswap_constant_32; +#endif + + ; + 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_have_decl___bswap_constant_32=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl___bswap_constant_32=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl___bswap_constant_32" >&5 +echo "${ECHO_T}$ac_cv_have_decl___bswap_constant_32" >&6 +if test $ac_cv_have_decl___bswap_constant_32 = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___BSWAP_CONSTANT_32 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___BSWAP_CONSTANT_32 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether __bswap_constant_64 is declared" >&5 +echo $ECHO_N "checking whether __bswap_constant_64 is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl___bswap_constant_64+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 + +int +main () +{ +#ifndef __bswap_constant_64 + char *p = (char *) __bswap_constant_64; +#endif + + ; + 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_have_decl___bswap_constant_64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl___bswap_constant_64=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl___bswap_constant_64" >&5 +echo "${ECHO_T}$ac_cv_have_decl___bswap_constant_64" >&6 +if test $ac_cv_have_decl___bswap_constant_64 = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___BSWAP_CONSTANT_64 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL___BSWAP_CONSTANT_64 0 +_ACEOF + + +fi + + + # Makefiles to be created by configure. ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile include/ntfs/Makefile libntfs/Makefile libntfs/libntfs.conf libntfs/libntfs-gnomevfs.8 ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" From 525f6519fbb43f6fc9e45860e116f8ac44fc0c1e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 10:22:03 +0000 Subject: [PATCH 1173/2994] Auto merged 2004/03/10 10:21:35+00:00 cantab.net!aia21 Use AC_CHECK_DECLS in configure.ac to determine if the constant bswap functions are defined/declared and define them to the non-constant ones in endians.h if not. (Logical change 1.314) --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index b6c22530..538bede6 100644 --- a/configure.ac +++ b/configure.ac @@ -217,6 +217,11 @@ AC_FUNC_VPRINTF AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \ strcasecmp strchr strdup strerror strtol strtoul utime mbsinit]) +# Check for declarations of constant bswap function as some systems do not +# provide all of them. +AC_CHECK_DECLS([__bswap_constant_16, __bswap_constant_32, __bswap_constant_64], + , , [#include ]) + # Makefiles to be created by configure. AC_CONFIG_FILES([ Makefile From aa0398ea0e159ef14649ce9bfd2d0ed537e36712 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 10:22:03 +0000 Subject: [PATCH 1174/2994] Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/03/10 10:21:36+00:00 cantab.net!aia21 Use AC_CHECK_DECLS in configure.ac to determine if the constant bswap functions are defined/declared and define them to the non-constant ones in endians.h if not. BKrev: 404eec4bHP7cgSgBv1XkbN3OUz3fGQ From 0dd38ddd7d03d1f69786b44b662049694fb3ad61 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 10:22:03 +0000 Subject: [PATCH 1175/2994] Use AC_CHECK_DECLS in configure.ac to determine if the constant bswap functions are defined/declared and define them to the non-constant ones in endians.h if not. (Logical change 1.314) --- config.h.in | 12 ++++++++++++ include/ntfs/endians.h | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/config.h.in b/config.h.in index f9155955..b586808a 100644 --- a/config.h.in +++ b/config.h.in @@ -6,6 +6,18 @@ /* Define to 1 if you have the header file. */ #undef HAVE_BYTESWAP_H +/* Define to 1 if you have the declaration of `__bswap_constant_16', and to 0 + if you don't. */ +#undef HAVE_DECL___BSWAP_CONSTANT_16 + +/* Define to 1 if you have the declaration of `__bswap_constant_32', and to 0 + if you don't. */ +#undef HAVE_DECL___BSWAP_CONSTANT_32 + +/* Define to 1 if you have the declaration of `__bswap_constant_64', and to 0 + if you don't. */ +#undef HAVE_DECL___BSWAP_CONSTANT_64 + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h index e43e7cc6..bb8cf543 100644 --- a/include/ntfs/endians.h +++ b/include/ntfs/endians.h @@ -92,13 +92,13 @@ #define __cpu_to_le64(x) bswap_64(x) /* For architectures that do not provide some/all of the constant versions. */ -#ifndef __bswap_constant_16 +#if defined HAVE_DECL___BSWAP_CONSTANT_16 && !HAVE_DECL___BSWAP_CONSTANT_16 #define __bswap_constant_16(x) bswap_16(x) #endif -#ifndef __bswap_constant_32 +#if defined HAVE_DECL___BSWAP_CONSTANT_32 && !HAVE_DECL___BSWAP_CONSTANT_32 #define __bswap_constant_32(x) bswap_32(x) #endif -#ifndef __bswap_constant_64 +#if defined HAVE_DECL___BSWAP_CONSTANT_64 && !HAVE_DECL___BSWAP_CONSTANT_64 #define __bswap_constant_64(x) bswap_64(x) #endif From 1c984054e8672d22784a6e4aac6cbb6e07f98eda Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 15:17:51 +0000 Subject: [PATCH 1176/2994] Auto merged 2004/03/10 15:17:28+00:00 cantab.net!aia21 Remove the bswap constant detection from configure.ac again to try out the SuSE patch for fixing the problem. (Logical change 1.315) --- configure | 190 +-------------------------------------------------- configure.ac | 4 +- 2 files changed, 4 insertions(+), 190 deletions(-) diff --git a/configure b/configure index 1e8e9925..8975a221 100755 --- a/configure +++ b/configure @@ -21511,194 +21511,8 @@ done # Check for declarations of constant bswap function as some systems do not # provide all of them. -echo "$as_me:$LINENO: checking whether __bswap_constant_16 is declared" >&5 -echo $ECHO_N "checking whether __bswap_constant_16 is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl___bswap_constant_16+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 - -int -main () -{ -#ifndef __bswap_constant_16 - char *p = (char *) __bswap_constant_16; -#endif - - ; - 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_have_decl___bswap_constant_16=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl___bswap_constant_16=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl___bswap_constant_16" >&5 -echo "${ECHO_T}$ac_cv_have_decl___bswap_constant_16" >&6 -if test $ac_cv_have_decl___bswap_constant_16 = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___BSWAP_CONSTANT_16 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___BSWAP_CONSTANT_16 0 -_ACEOF - - -fi -echo "$as_me:$LINENO: checking whether __bswap_constant_32 is declared" >&5 -echo $ECHO_N "checking whether __bswap_constant_32 is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl___bswap_constant_32+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 - -int -main () -{ -#ifndef __bswap_constant_32 - char *p = (char *) __bswap_constant_32; -#endif - - ; - 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_have_decl___bswap_constant_32=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl___bswap_constant_32=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl___bswap_constant_32" >&5 -echo "${ECHO_T}$ac_cv_have_decl___bswap_constant_32" >&6 -if test $ac_cv_have_decl___bswap_constant_32 = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___BSWAP_CONSTANT_32 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___BSWAP_CONSTANT_32 0 -_ACEOF - - -fi -echo "$as_me:$LINENO: checking whether __bswap_constant_64 is declared" >&5 -echo $ECHO_N "checking whether __bswap_constant_64 is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl___bswap_constant_64+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 - -int -main () -{ -#ifndef __bswap_constant_64 - char *p = (char *) __bswap_constant_64; -#endif - - ; - 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_have_decl___bswap_constant_64=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_have_decl___bswap_constant_64=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl___bswap_constant_64" >&5 -echo "${ECHO_T}$ac_cv_have_decl___bswap_constant_64" >&6 -if test $ac_cv_have_decl___bswap_constant_64 = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___BSWAP_CONSTANT_64 1 -_ACEOF - - -else - cat >>confdefs.h <<_ACEOF -#define HAVE_DECL___BSWAP_CONSTANT_64 0 -_ACEOF - - -fi - - +#AC_CHECK_DECLS([__bswap_constant_16, __bswap_constant_32, __bswap_constant_64], +# , , [#include ]) # Makefiles to be created by configure. ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile include/ntfs/Makefile libntfs/Makefile libntfs/libntfs.conf libntfs/libntfs-gnomevfs.8 ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" diff --git a/configure.ac b/configure.ac index 538bede6..aa2e21b2 100644 --- a/configure.ac +++ b/configure.ac @@ -219,8 +219,8 @@ AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \ # Check for declarations of constant bswap function as some systems do not # provide all of them. -AC_CHECK_DECLS([__bswap_constant_16, __bswap_constant_32, __bswap_constant_64], - , , [#include ]) +#AC_CHECK_DECLS([__bswap_constant_16, __bswap_constant_32, __bswap_constant_64], +# , , [#include ]) # Makefiles to be created by configure. AC_CONFIG_FILES([ From b207b80f620a18acce85d99399770daa8a5b74fe Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 15:17:51 +0000 Subject: [PATCH 1177/2994] Merge cantab.net:/home/src/ntfsprogs into cantab.net:/home/src/ntfsprogs-devel 2004/03/10 15:17:29+00:00 cantab.net!aia21 Try the SuSE patch for fixing the constant bswap absence on some arch problem. BKrev: 404f319fX7YIicfmWB5TDur9Pd5WFg From a259a69c8d8a3248451bff2fbd4b085839e0c344 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 15:17:51 +0000 Subject: [PATCH 1178/2994] Remove the bswap constant detection from configure.ac again to try out the SuSE patch for fixing the problem. (Logical change 1.315) --- config.h.in | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/config.h.in b/config.h.in index b586808a..f9155955 100644 --- a/config.h.in +++ b/config.h.in @@ -6,18 +6,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_BYTESWAP_H -/* Define to 1 if you have the declaration of `__bswap_constant_16', and to 0 - if you don't. */ -#undef HAVE_DECL___BSWAP_CONSTANT_16 - -/* Define to 1 if you have the declaration of `__bswap_constant_32', and to 0 - if you don't. */ -#undef HAVE_DECL___BSWAP_CONSTANT_32 - -/* Define to 1 if you have the declaration of `__bswap_constant_64', and to 0 - if you don't. */ -#undef HAVE_DECL___BSWAP_CONSTANT_64 - /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H From 77c794f202648f7f64f10ec912aa1dca2c453ddc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 15:17:51 +0000 Subject: [PATCH 1179/2994] Try the SuSE patch. (Logical change 1.315) --- include/ntfs/endians.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h index bb8cf543..7b2a05b6 100644 --- a/include/ntfs/endians.h +++ b/include/ntfs/endians.h @@ -92,14 +92,26 @@ #define __cpu_to_le64(x) bswap_64(x) /* For architectures that do not provide some/all of the constant versions. */ -#if defined HAVE_DECL___BSWAP_CONSTANT_16 && !HAVE_DECL___BSWAP_CONSTANT_16 -#define __bswap_constant_16(x) bswap_16(x) +#ifndef __bswap_constant_16 +#define __bswap_constant_16(x) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) #endif -#if defined HAVE_DECL___BSWAP_CONSTANT_32 && !HAVE_DECL___BSWAP_CONSTANT_32 -#define __bswap_constant_32(x) bswap_32(x) +#ifndef __bswap_constant_32 +#define __bswap_constant_32(x) \ + ((((x) & 0xff000000) >> 24) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x000000ff) << 24)) #endif -#if defined HAVE_DECL___BSWAP_CONSTANT_64 && !HAVE_DECL___BSWAP_CONSTANT_64 -#define __bswap_constant_64(x) bswap_64(x) +#ifndef __bswap_constant_64 +#define __bswap_constant_64(x) \ + ((((x) & 0xff00000000000000ull) >> 56) | \ + (((x) & 0x00ff000000000000ull) >> 40) | \ + (((x) & 0x0000ff0000000000ull) >> 24) | \ + (((x) & 0x000000ff00000000ull) >> 8) | \ + (((x) & 0x00000000ff000000ull) << 8) | \ + (((x) & 0x0000000000ff0000ull) << 24) | \ + (((x) & 0x000000000000ff00ull) << 40) | \ + (((x) & 0x00000000000000ffull) << 56)) #endif #define __constant_le16_to_cpu(x) __bswap_constant_16(x) From f19081ab43a6f0e3766a84f5368029f5c967b1b6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 21:52:35 +0000 Subject: [PATCH 1180/2994] Update for 1.9.0 release. (Logical change 1.316) --- AUTHORS | 2 +- ChangeLog | 4 +++ NEWS | 61 +++++-------------------------------------- README | 1 - configure | 25 +++++++----------- configure.ac | 7 +---- ntfsprogs.spec.in | 17 ++++++------ ntfsprogs/Makefile.in | 4 +-- 8 files changed, 33 insertions(+), 88 deletions(-) diff --git a/AUTHORS b/AUTHORS index 1304451e..44938851 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,5 +1,5 @@ -Linux-NTFS is written and maintained by Anton Altaparmakov . +ntfsprogs is written and maintained by Anton Altaparmakov . Current active developers on the project are (in alphabetical order): diff --git a/ChangeLog b/ChangeLog index 9b057578..6b8ba08b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,10 @@ xx/xx/2004 - 1.8.6-WIP arguments to typecast the arguments to (unsigned) long long to avoid the warnings when compiling on 64 bit architectures. - Use AC_GNU_SOURCE in configure.ac instead of doing it manually. + - Add relocation support to ntfsresize. Note, this modifies the + command line options a little as well as the returned output so + applications using ntfsresize might need modifications before they + will work with the updated ntfsresize. (Szaka) 27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes - Fixup ntfsinfo a little bit and give its manpage a small update to diff --git a/NEWS b/NEWS index f12cfb89..867366c7 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,12 @@ Current news ============ +ntfsresize now supports relocation which generally means you are now able to +resize to any size you like (as long as there is enough free space). Note, +this modifies the command line options a little as well as the returned output +so applications using ntfsresize might need modifications before they will +work with the updated ntfsresize. (Szakacsits Szabolcs) + ntfsprogs now should ./configure and compile cleanly on SuSE as well as RedHat Linux. @@ -36,59 +42,4 @@ more details. Added new utility ntfsresize by Szakacsits Szabolcs. See man 8 ntfsresize for details. -The API has been fully reworked and the library mostly rewritten since the -last release (1.6.0). It should now offer a much more solid and stable basis -for development of software accessing NTFS volumes. All utilities have been -ported to the new API. - -linux-ntfs should now compile and work on all architectures. - -Added two options to mkntfs. One to enable compression on the volume and one -to disable content indexing. See man 8 mkntfs for details. - -Changed version numbers of mkntfs and ntfsfix to match linux-ntfs release. - -ntfsfix had two minor bugs fixed. This also should remove the compilation -warnings in ntfsfix.c on 64-bit-pointer-size architectures. - -mkntfs now should be truly bug free. - -ntfs_mount syntax changed to accept a read-only flag. - -mkntfs now allows creation of small NTFS volumes (current minimum size is one -mega byte). This allows placing NTFS on a floppy disk for example. - -mkntfs now correctly handles directories on volumes with large clusters. - -ntfsfix now works on Windows XP NTFS volumes (NTFS 3.1). - -Reenabled shared library generation and use. - -ntfsfix now has a man page, too. Donated by David Martínez Moreno. - -mkntfs now uses correct defaults for small partitions on devices with -non-standard sector sizes. - -mkntfs now in sbin not bin and it got some bugs fixed. - Gcc 2.96 or above is required to compile. - -Dropped ldm, ntfsdump_logfile and dumplog from linux-ntfs distribution. ldm will -reappear in a different package as ldminfo (probably linux-ldm) while the dump -tools are only useful to us developers to play with they don't actually do -anything useful (and these remain in CVS for developer (ab)use). - -We now have mkntfs. Yey! And it even has a man page. So go read it. (-8 - -Disable shared library building by default as it breaks on some systems. (No -idea why. If any one can figure it out and tell me what the problem/fix is I -would be thankful.) - -libntfs and hence ntfsfix still don't support attribute lists. - -Updated ntfsdump_logfile to really dump the whole logfile with all the current -knowledge about the structures. Also added dumplog which does the same but -operates on a file rather than a partition, i.e. it can operate on a live -mounted NTFS partition under linux when the -o show_sys_files was used on mount. -(Note this mount option first appeared in Linux kernel 2.4.4-ac18.) - diff --git a/README b/README index edf18054..58bc6d57 100644 --- a/README +++ b/README @@ -118,4 +118,3 @@ ntfsls - List information about files in a directory residing on an NTFS partition. See man 8 ntfsls for details. ntfscat - Concatenate files and print their contents on the standard output. - diff --git a/configure b/configure index 8975a221..95c1f08b 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.9-devel. +# Generated by GNU Autoconf 2.57 for ntfsprogs 1.9.0. # # Report bugs to . # @@ -422,8 +422,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.9-devel' -PACKAGE_STRING='ntfsprogs 1.9-devel' +PACKAGE_VERSION='1.9.0' +PACKAGE_STRING='ntfsprogs 1.9.0' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -954,7 +954,7 @@ 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 ntfsprogs 1.9-devel to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.9.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1021,7 +1021,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.9-devel:";; + short | recursive ) echo "Configuration of ntfsprogs 1.9.0:";; esac cat <<\_ACEOF @@ -1136,7 +1136,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.9-devel +ntfsprogs configure 1.9.0 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -1151,7 +1151,7 @@ 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 ntfsprogs $as_me 1.9-devel, which was +It was created by ntfsprogs $as_me 1.9.0, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1845,7 +1845,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.9-devel' + VERSION='1.9.0' cat >>confdefs.h <<_ACEOF @@ -21509,11 +21509,6 @@ fi done -# Check for declarations of constant bswap function as some systems do not -# provide all of them. -#AC_CHECK_DECLS([__bswap_constant_16, __bswap_constant_32, __bswap_constant_64], -# , , [#include ]) - # Makefiles to be created by configure. ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile include/ntfs/Makefile libntfs/Makefile libntfs/libntfs.conf libntfs/libntfs-gnomevfs.8 ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" @@ -21919,7 +21914,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.9-devel, which was +This file was extended by ntfsprogs $as_me 1.9.0, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21982,7 +21977,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.9-devel +ntfsprogs config.status 1.9.0 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index aa2e21b2..82f3bc06 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.57) -AC_INIT([ntfsprogs],[1.9-devel],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.9.0],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) @@ -217,11 +217,6 @@ AC_FUNC_VPRINTF AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \ strcasecmp strchr strdup strerror strtol strtoul utime mbsinit]) -# Check for declarations of constant bswap function as some systems do not -# provide all of them. -#AC_CHECK_DECLS([__bswap_constant_16, __bswap_constant_32, __bswap_constant_64], -# , , [#include ]) - # Makefiles to be created by configure. AC_CONFIG_FILES([ Makefile diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index baf21568..36a3b0eb 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -18,10 +18,10 @@ License : GPL Group : System Environment/Base %description The Linux-NTFS project (http://linux-ntfs.sf.net/) aims to bring full support -for the NTFS filesystem to the Linux operating system. Linux-NTFS currently -consists of a static library and utilities such as mkntfs, ntfscat, ntfsls, -ntfsresize, and ntfsundelete (for a full list of included utilities see man -8 ntfsprogs after installation). +for the NTFS filesystem to the Linux operating system. The ntfsprogs package +currently consists of a static library and utilities such as mkntfs, ntfscat, +ntfsls, ntfsresize, and ntfsundelete (for a full list of included utilities +see man 8 ntfsprogs after installation). %package gnomevfs @@ -32,11 +32,9 @@ BuildRequires : glib2-devel Requires : glib2 BuildRequires : gnome-vfs2-devel Requires : gnome-vfs2 - - %description gnomevfs This package contains the NTFS GNOME virtual filesystem (VFS) module which -allows GNOME VFS clients to seamlessly utilize the NTFS library. +allows GNOME VFS clients to seamlessly utilize the NTFS library (libntfs). %package devel @@ -45,7 +43,7 @@ Group : Development/System Requires : ntfsprogs = %{ver}-%{rel} %description devel This package includes the header files and libraries needed to link software -with libntfs. +with the NTFS library (libntfs). %prep @@ -96,6 +94,9 @@ rm -rf "$RPM_BUILD_ROOT" %{_libdir}/gnome-vfs-2.0/modules/libntfs-gnomevfs.*a* %changelog +* Wed Mar 10 2004 Anton Altaparmakov +- Cleanup descriptions ready for 1.9.0 release. + * Mon Jan 19 2004 Anton Altaparmakov - Add %config to tell rpm that libntfs.conf is a config file. diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 9ee15e86..9ab31413 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From 60917570faced9a69058cc248e83467aff84b711 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 21:52:35 +0000 Subject: [PATCH 1181/2994] Update for 1.9.0 release. BKrev: 404f8e23O6wo6eTEywk8tlV_8rvkuw From 3c429be66400066b91420785cf4edbb682f6cfcd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 22:03:54 +0000 Subject: [PATCH 1182/2994] Typo fixes (Ender) (Logical change 1.317) --- doc/compression.txt | 2 +- libntfs/libntfs-gnomevfs.8.in | 3 ++- ntfsprogs/mkntfs.8.in | 2 +- ntfsprogs/ntfscat.8.in | 2 +- ntfsprogs/ntfscluster.8.in | 2 +- ntfsprogs/ntfsfix.8.in | 10 +++++----- ntfsprogs/ntfsinfo.8.in | 4 ++-- ntfsprogs/ntfslabel.8.in | 4 ++-- ntfsprogs/ntfsls.8.in | 4 ++-- ntfsprogs/ntfsprogs.8.in | 5 +++-- ntfsprogs/ntfsundelete.8.in | 4 ++-- ntfsprogs/ntfswipe.h | 2 +- 12 files changed, 23 insertions(+), 21 deletions(-) diff --git a/doc/compression.txt b/doc/compression.txt index 368f16f2..5da5238f 100644 --- a/doc/compression.txt +++ b/doc/compression.txt @@ -132,7 +132,7 @@ Note that decompression has to occur byte by byte, as it is possible that some of the bytes pointed to by the pt will only be generated in the sliding window as the byte sequence pointed to by the pt is being copied into it! -To give a concrete example; a block full of the letter A would be compressed +To give a concrete example: a block full of the letter A would be compressed by storing the byte A once as a symbol token, followed by a single phrase token with back pointer -1 (p = 0, therefore go back by -(0 + 1) bytes) and length 4095 (l=0xffc, therefore length 0xffc + 3 bytes). diff --git a/libntfs/libntfs-gnomevfs.8.in b/libntfs/libntfs-gnomevfs.8.in index ad37353c..f365d61c 100644 --- a/libntfs/libntfs-gnomevfs.8.in +++ b/libntfs/libntfs-gnomevfs.8.in @@ -3,7 +3,8 @@ .\" This file may be copied under the terms of the GNU Public License. .\" .TH NTFSPROGS 8 "November 2003" "Linux-NTFS version @VERSION@" - +.SH NAME +libntfs-gnomevfs \- Module for GNOME VFS that allows access to NTFS filesystems. .SH OVERVIEW The GNOME virtual filesystem (VFS) provides universal access to different filesystems. The diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index ed4630b9..53923f86 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -3,7 +3,7 @@ .\" This file may be copied under the terms of the GNU Public License. .\" Adapted from e2fsprogs-1.19/misc/mke2fs.8.in by Theodore Ts'o. .\" -.TH MKNTFS 8 "March 2002" "Linux-NTFS version @VERSION@" +.TH MKNTFS 8 "March 2002" "ntfsprogs version @VERSION@" .SH NAME mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system .SH SYNOPSIS diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in index 021ef100..36c976bd 100644 --- a/ntfsprogs/ntfscat.8.in +++ b/ntfsprogs/ntfscat.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2003 Richard Russon. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCAT 8 "October 2003" "Linux-NTFS version @VERSION@" +.TH NTFSCAT 8 "October 2003" "ntfsprogs version @VERSION@" .SH NAME ntfscat \- concatenate files and print them on the standard output .SH SYNOPSIS diff --git a/ntfsprogs/ntfscluster.8.in b/ntfsprogs/ntfscluster.8.in index e1572c61..763158b8 100644 --- a/ntfsprogs/ntfscluster.8.in +++ b/ntfsprogs/ntfscluster.8.in @@ -1,7 +1,7 @@ .\" Copyright (c) 2003 Richard Russon. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLUSTER 8 "September 2003" "Linux\-NTFS version @VERSION@" +.TH NTFSCLUSTER 8 "September 2003" "ntfsprogs version @VERSION@" .SH NAME ntfscluster \- identify files in a specified region of an NTFS volume. .SH SYNOPSIS diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index 2cbe98dd..04b323c7 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH NTFSFIX 8 "July 2001" "Linux-NTFS version @VERSION@" +.TH NTFSFIX 8 "March 2004" "ntfsprogs version @VERSION@" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -38,22 +38,22 @@ stupidity when fixing altered partitions. Because the main problems are journal files, \fBntfsfix\fP aims to fix those issues. .sp Running ntfsfix after mounting NTFS partitions read-write is recommended -for reducing the chance of severe data loss when NT/W2K tries to remount +for reducing the chance of severe data loss when NT/W2K/XP tries to remount the affected partition(s). .sp In order to use \fBntfsfix\fP you must unmount the NTFS partition, and run ntfsfix device, where device is the NTFS partition. After this, you can -safely reboot into NT/W2K. Please note that \fBntfsfix\fP is not a +safely reboot into NT/W2K/XP. Please note that \fBntfsfix\fP is not a chkdsk-like tool, and so is not guaranteed that it could fix all the alterations provoked by the NTFS driver. .SH AUTHOR This manual page was written by David Martínez Moreno -, for the Debian GNU/Linux +, for Debian the GNU/Linux system (but may be used by others). .SH AVAILABILITY .B ntfsfix -is part of the linux-ntfs package and is available from +is part of the ntfsprogs package and is available from http://linux-ntfs.sourceforge.net/. .SH SEE ALSO .BR mkntfs (8), diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index cdb227dd..ea7259a4 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2002-2004 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSINFO 8 "Feb 2004" "Linux-NTFS version @VERSION@" +.TH NTFSINFO 8 "Feb 2004" "ntfsprogs version @VERSION@" .SH NAME ntfsinfo \- dump a file's attributes .SH SYNOPSIS @@ -20,7 +20,7 @@ Run ntfsinfo without arguments for a full list of options. was written by Matthew J. Fanto (mattjf@uncompiled.com). .SH AVAILABILITY .B ntfsinfo -is part of the linux-ntfs package and is available from +is part of the ntfsprogs package and is available from http://linux-ntfs.sourceforge.net/. .SH SEE ALSO .BR ntfsprogs (8) diff --git a/ntfsprogs/ntfslabel.8.in b/ntfsprogs/ntfslabel.8.in index 1a53cf4a..b647cf4f 100644 --- a/ntfsprogs/ntfslabel.8.in +++ b/ntfsprogs/ntfslabel.8.in @@ -3,7 +3,7 @@ .\" This file may be copied under the terms of the GNU Public License. .\" Adapted from e2fsprogs-1.26/misc/e2label.8.in by Theodore Ts'o. .\" -.TH NTFSLABEL 8 "April 2002" "Linux-NTFS version @VERSION@" +.TH NTFSLABEL 8 "April 2002" "ntfsprogs version @VERSION@" .SH NAME ntfslabel \- display/change the label on an ntfs file system .SH SYNOPSIS @@ -47,7 +47,7 @@ was written by Matthew J. Fanto (mattjf@uncompiled.com). This man page was written by Anton Altaparmakov (aia21@cantab.net). .SH AVAILABILITY .B ntfslabel -is part of the linux-ntfs package and is available from +is part of the ntfsprogs package and is available from http://linux-ntfs.sourceforge.net/. .SH SEE ALSO .BR mkntfs (8), diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index a50be2a1..0880251f 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -2,9 +2,9 @@ .\" Copyright (c) 2003 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSLS 8 "August 2003" "Linux-NTFS version @VERSION@" +.TH NTFSLS 8 "August 2003" "ntfsprogs version @VERSION@" .SH NAME -ntfsls \- list directory contents on an NTFS file system +ntfsls \- list directory contents on an NTFS filesystem .SH SYNOPSIS .B ntfsls [ diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index e72fbb89..71831204 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -2,8 +2,9 @@ .\" Copyright (c) 2002-2003 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSPROGS 8 "August 2003" "Linux-NTFS version @VERSION@" - +.TH NTFSPROGS 8 "August 2003" "ntfsprogs version @VERSION@" +.SH NAME +ntfstools \- several tools for doing neat things with NTFS partitions .SH OVERVIEW .B ntfsprogs is a suite of NTFS utilities based around a shared library. The tools are diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index aaffc47d..7ae20992 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -1,7 +1,7 @@ .\" Copyright (c) 2002 Richard Russon. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSUNDELETE 8 "June 2002" "Linux\-NTFS version @VERSION@" +.TH NTFSUNDELETE 8 "June 2002" "ntfsprogs version @VERSION@" .SH NAME ntfsundelete \- recover a deleted file from an NTFS volume. .SH SYNOPSIS @@ -346,7 +346,7 @@ was written by Richard Russon (FlatCap) If you find this tool useful, make FlatCap happy and send him an email. .SH AVAILABILITY .B ntfsundelete -is part of the linux\-ntfs package and is available from +is part of the ntfsprogs package and is available from .br .nh http://linux\-ntfs.sourceforge.net/downloads.html diff --git a/ntfsprogs/ntfswipe.h b/ntfsprogs/ntfswipe.h index cf1bb7cf..d9de8017 100644 --- a/ntfsprogs/ntfswipe.h +++ b/ntfsprogs/ntfswipe.h @@ -3,7 +3,7 @@ * * Copyright (c) 2002 Richard Russon * - * This utility will overwrite usused space on an NTFS volume. + * This utility will overwrite unused space on an NTFS volume. * * 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 From 5dda8485539715c7443a9fc985d05f80f6202e26 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 22:03:54 +0000 Subject: [PATCH 1183/2994] Auto merged 2004/03/10 21:54:13+00:00 cantab.net!aia21 Typo fixes (Ender) (Logical change 1.317) --- ntfsprogs/ntfsclone.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index c84888bc..eb709b57 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -4,7 +4,7 @@ .\" All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLONE 8 "Oct 2003" "ntfsprogs @VERSION@" +.TH NTFSCLONE 8 "Oct 2003" "ntfsprogs version @VERSION@" .SH NAME ntfsclone \- Efficiently clone an NTFS filesystem .SH SYNOPSIS From 41c90506c52c5bd6db7a51e20152059a6762092a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 22:03:54 +0000 Subject: [PATCH 1184/2994] Auto merged 2004/03/10 21:54:27+00:00 cantab.net!aia21 Typo fixes (Ender) (Logical change 1.317) --- ntfsprogs/ntfswipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 650fef7a..3a9e619d 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -3,7 +3,7 @@ * * Copyright (c) 2002-2003 Richard Russon * - * This utility will overwrite usused space on an NTFS volume. + * This utility will overwrite unused space on an NTFS volume. * * 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 From 03dfcd6614662ed02712e127ecb078da21cd1165 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 22:03:54 +0000 Subject: [PATCH 1185/2994] Latest one (Ender) (Logical change 1.317) --- config.guess | 95 ++++++++++++++++++++++++++++++---------------------- config.sub | 50 +++++++++++++++++++++++---- 2 files changed, 98 insertions(+), 47 deletions(-) diff --git a/config.guess b/config.guess index c8fc6835..e8c6fc0c 100755 --- a/config.guess +++ b/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2003-07-02' +timestamp='2004-01-05' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -136,16 +136,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -231,6 +221,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + pegasos:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -317,6 +310,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; @@ -744,7 +740,7 @@ EOF echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` @@ -752,6 +748,11 @@ EOF FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; @@ -761,7 +762,7 @@ EOF *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; - *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) + *:FreeBSD:*:*) # Determine whether the default compiler uses glibc. eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -773,7 +774,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - # GNU/FreeBSD systems have a "k" prefix to indicate we are using + # GNU/KFreeBSD systems have a "k" prefix to indicate we are using # FreeBSD's kernel, but not the complete OS. case ${LIBC} in gnu) kernel_only='k' ;; esac echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} @@ -809,22 +810,27 @@ EOF echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux + echo cris-axis-linux-gnu exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -843,7 +849,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -862,13 +868,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux + echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux + echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -881,34 +887,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux + echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux + echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -923,18 +929,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" + echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" + echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linuxoldld) or + # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -958,9 +964,12 @@ EOF LIBC=gnuaout #endif #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) @@ -988,6 +997,9 @@ EOF i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; @@ -1059,7 +1071,7 @@ EOF exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -1174,7 +1186,7 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) @@ -1218,6 +1230,9 @@ EOF SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; + *:DRAGONFLY:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE} + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/config.sub b/config.sub index 9952c14c..463186db 100755 --- a/config.sub +++ b/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2003-07-04' +timestamp='2004-01-05' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -118,7 +118,8 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -228,13 +229,14 @@ case $basic_machine in | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ - | ip2k \ + | ip2k | iq2000 \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ @@ -247,6 +249,7 @@ case $basic_machine in | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ @@ -304,7 +307,7 @@ case $basic_machine in | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ + | ip2k-* | iq2000-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ @@ -319,6 +322,7 @@ case $basic_machine in | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ @@ -376,6 +380,9 @@ case $basic_machine in amd64) basic_machine=x86_64-pc ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; amdahl) basic_machine=580-amdahl os=-sysv @@ -740,6 +747,10 @@ case $basic_machine in basic_machine=or32-unknown os=-coff ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose @@ -960,6 +971,10 @@ case $basic_machine in tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -1128,19 +1143,19 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ + | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1164,6 +1179,12 @@ case $os in -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; @@ -1173,6 +1194,9 @@ case $os in -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1194,6 +1218,9 @@ case $os in -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1216,6 +1243,9 @@ case $os in -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1464,9 +1494,15 @@ case $basic_machine in -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; + -tpf*) + vendor=ibm + ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; From c86e4174a9f12dbfbb3d3a4627eeaa0989723f8d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 22:03:54 +0000 Subject: [PATCH 1186/2994] Manual merge. 2004/03/10 21:54:24+00:00 cantab.net!aia21 Typo fixes (Ender) (Logical change 1.317) --- ntfsprogs/ntfsresize.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 32b37054..87395885 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -1,7 +1,7 @@ .\" -*- nroff -*- .\" Copyright 2002-2004 by Szabolcs Szakacsits All Rights Reserved. .\" -.TH NTFSRESIZE 8 "Mar 2004" "ntfsprogs @VERSION@" +.TH NTFSRESIZE 8 "Mar 2004" "ntfsprogs version @VERSION@" .SH NAME ntfsresize \- resize an NTFS filesystem without data loss .SH SYNOPSIS From 217ac9678f22aadae23d16a8ef60f8770d83d7ac Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 22:03:54 +0000 Subject: [PATCH 1187/2994] Merge 2004/03/10 21:58:46+00:00 cantab.net!aia21 - A few replacements of Linux-NTFS package by ntfsprogs package. (me) Updates from Ender: - Updates config.guess and config.sub to the latest ones. - Fixes several typos spreaded along all the docs. - Added several glitches to the manpages for the sake of compliance. - Updates my address to the Debian one. BKrev: 404f90ca-_pDJ68w1glaRYVn8De63g From 56dd09715a7b50991c9a952d4010e316a64de46c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 22:03:54 +0000 Subject: [PATCH 1188/2994] Typo fixes (Ender) (Logical change 1.317) --- doc/attributes.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/attributes.txt b/doc/attributes.txt index a7436db1..94fec5f0 100644 --- a/doc/attributes.txt +++ b/doc/attributes.txt @@ -49,7 +49,7 @@ the location of each attribute. The attribute list attribute lists all attributes that belong to this mft record (with the exception of itself). Each entry in the attribute list -describes the attribute listed and in which mft record it's attribute header can +describes the attribute listed and in which mft record its attribute header can be found. For resident attributes this will be the same number as the base mft record in which the attribute list attribute is located itself. For non-resident attributes, this will be another mft record, called an extension mft record. @@ -59,14 +59,14 @@ Only one attribute is stored in an extension mft record, even if the attribute is very small. At least this is the case with Windows NT4 SP6a driver. Should the mapping pairs array of an attribute become so large as to not fit -into an extenstion mft record, even though it's attribute is the only attribute +into an extenstion mft record, even though its attribute is the only attribute in this extension record, then the attribute is splitt into several extents. -The first extent starts at vcn 0 and has it's lowest vcn value set to zero and -continues up to it's highest vcn value. This is determined by splitting up the +The first extent starts at vcn 0 and has its lowest vcn value set to zero and +continues up to its highest vcn value. This is determined by splitting up the mapping pairs array into chunks which just fit into an extension mft record each. Thus the first mapping pairs array chunk will determine the value of the highest vcn for the first extent. The attribute list will contain an entry -for this extent. Then, a second extent is created which has it's lowest vcn +for this extent. Then, a second extent is created which has its lowest vcn value set to the highest vcn of the previous extent + 1 and the next chunk of the mapping pairs array is inserted into this extent. Again, an entry for this extent is placed into the attribute list, and so on, until the whole @@ -105,7 +105,7 @@ Since NTFS 3.0, the attribute value of each $DATA attribute can be encrypted, to protect the contents from spying eyes. If this is the case, the ATTR_IS_ENCRYPTED flag is set. -FIXME: Write notes on attribute encryption. The descussions from the articles +FIXME: Write notes on attribute encryption. The discussions from the articles "Inside the Encrypting File System" in Windows NT magazine (?) are very good starting points. (AIA) From a8ec7f16af90b07302225d58d5aad6960e0ef824 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 22:03:54 +0000 Subject: [PATCH 1189/2994] Update Ender's email address. (Logical change 1.317) --- CREDITS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CREDITS b/CREDITS index fc0fdb1d..cdeabce6 100644 --- a/CREDITS +++ b/CREDITS @@ -17,7 +17,7 @@ Christophe Grenier Ian Jackson Jan Kratochvil Lode Leroy -David Martínez Moreno +David Martínez Moreno Leonard Norrgĺrd Yuri Per Richard Russon From 491d7096caf1309dc53009dfa727b5b54703d934 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 22:03:54 +0000 Subject: [PATCH 1190/2994] Update for 1.9.0 release. 2004/03/10 21:53:05+00:00 cantab.net!aia21 Update (Logical change 1.317) --- ChangeLog | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b8ba08b..831d8b3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/2004 - 1.8.6-WIP +11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef HAVE_CONFIG_H. (Suggested by Christophe.) - Update doc/CodingStyle. (Suggested by Szaka.) @@ -40,12 +40,17 @@ xx/xx/2004 - 1.8.6-WIP arguments to typecast the arguments to (unsigned) long long to avoid the warnings when compiling on 64 bit architectures. - Use AC_GNU_SOURCE in configure.ac instead of doing it manually. + - Fix lots of typos in the documentation. (David Martínez Moreno) + - Update config.sub and config.guess to latest ones. (David Martínez + Moreno) + - Change Linux-NTFS to ntfsprogs everywhere when talking about the + package rather than the project (especially man pages affected). - Add relocation support to ntfsresize. Note, this modifies the command line options a little as well as the returned output so applications using ntfsresize might need modifications before they will work with the updated ntfsresize. (Szaka) -27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes +27/02/2004 - 1.8.5 - Springclean of the build process, cleanups, bug fixes. - Fixup ntfsinfo a little bit and give its manpage a small update to reflect reality a little better. - Fix BLKGETSIZE usage; parameter is unsigned long not long. (Szaka) From a0cbfc4ce44bb16f69b30a7cfe4f50ebb14db81b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 22:53:49 +0000 Subject: [PATCH 1191/2994] Provide our own __ntfs_bswap_constant_xx functions so we completely avoid the mess that some architectures define only some of the constant bswap functions. (Logical change 1.318) --- include/ntfs/endians.h | 53 ++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h index 7b2a05b6..bc230919 100644 --- a/include/ntfs/endians.h +++ b/include/ntfs/endians.h @@ -91,36 +91,33 @@ #define __cpu_to_le32(x) bswap_32(x) #define __cpu_to_le64(x) bswap_64(x) -/* For architectures that do not provide some/all of the constant versions. */ -#ifndef __bswap_constant_16 -#define __bswap_constant_16(x) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) -#endif -#ifndef __bswap_constant_32 -#define __bswap_constant_32(x) \ - ((((x) & 0xff000000) >> 24) | \ - (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0x0000ff00) << 8) | \ - (((x) & 0x000000ff) << 24)) -#endif -#ifndef __bswap_constant_64 -#define __bswap_constant_64(x) \ - ((((x) & 0xff00000000000000ull) >> 56) | \ - (((x) & 0x00ff000000000000ull) >> 40) | \ - (((x) & 0x0000ff0000000000ull) >> 24) | \ - (((x) & 0x000000ff00000000ull) >> 8) | \ - (((x) & 0x00000000ff000000ull) << 8) | \ - (((x) & 0x0000000000ff0000ull) << 24) | \ - (((x) & 0x000000000000ff00ull) << 40) | \ - (((x) & 0x00000000000000ffull) << 56)) -#endif +#define __ntfs_bswap_constant_16(x) \ + (u16)((((u16)(x) & 0xff00) >> 8) | \ + (((u16)(x) & 0x00ff) << 8)) -#define __constant_le16_to_cpu(x) __bswap_constant_16(x) -#define __constant_le32_to_cpu(x) __bswap_constant_32(x) -#define __constant_le64_to_cpu(x) __bswap_constant_64(x) +#define __ntfs_bswap_constant_32(x) \ + (u32)((((u32)(x) & 0xff000000u) >> 24) | \ + (((u32)(x) & 0x00ff0000u) >> 8) | \ + (((u32)(x) & 0x0000ff00u) << 8) | \ + (((u32)(x) & 0x000000ffu) << 24)) -#define __constant_cpu_to_le16(x) __bswap_constant_16(x) -#define __constant_cpu_to_le32(x) __bswap_constant_32(x) -#define __constant_cpu_to_le64(x) __bswap_constant_64(x) +#define __ntfs_bswap_constant_64(x) \ + (u64)((((u64)(x) & 0xff00000000000000ull) >> 56) | \ + (((u64)(x) & 0x00ff000000000000ull) >> 40) | \ + (((u64)(x) & 0x0000ff0000000000ull) >> 24) | \ + (((u64)(x) & 0x000000ff00000000ull) >> 8) | \ + (((u64)(x) & 0x00000000ff000000ull) << 8) | \ + (((u64)(x) & 0x0000000000ff0000ull) << 24) | \ + (((u64)(x) & 0x000000000000ff00ull) << 40) | \ + (((u64)(x) & 0x00000000000000ffull) << 56)) + +#define __constant_le16_to_cpu(x) __ntfs_bswap_constant_16((u16)(x)) +#define __constant_le32_to_cpu(x) __ntfs_bswap_constant_32((u32)(x)) +#define __constant_le64_to_cpu(x) __ntfs_bswap_constant_64((u64)(x)) + +#define __constant_cpu_to_le16(x) __ntfs_bswap_constant_16((u16)(x)) +#define __constant_cpu_to_le32(x) __ntfs_bswap_constant_32((u32)(x)) +#define __constant_cpu_to_le64(x) __ntfs_bswap_constant_64((u64)(x)) #else From 1318c07ee51c407a6133180d3015fe6013d195a0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 22:53:49 +0000 Subject: [PATCH 1192/2994] Provide our own byteswap constant versions in endians.h so we avoid the mess that some architectures define only some of them. BKrev: 404f9c7dbVXwMn4i_lRRR-VBVHrTOg From f62ab8a60a24be9d6fe8d5cc7715d59e5f32f57a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 22:53:49 +0000 Subject: [PATCH 1193/2994] Update (Logical change 1.318) --- ChangeLog | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 831d8b3d..e094aa83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,9 +28,8 @@ - Add AC_CANONICAL_HOST([]) to configure.ac and before AC_PROG_CC add manual provision of CC=gcc, AR=ar, and LD=ld if they are not set and the target is *-*-*djgpp. (Requested by Christophe Grenier) - - Use bswap_xx instead of __bswap_constant_xx when the constant version - is not available as is the case on some architectures. (Thanks to - David Martínez Moreno for the bug report.) + - Provide our own byteswap constant versions in endians.h so we avoid + the mess that some architectures define only some of them. - Use head -n 1 instead of -1 in getgccver script. (From SUSE LINUX) - Fix typo in ntfsinfo.c. (From SUSE LINUX) - Make the device fd in unix_io.c be stored in malloc()ed space pointed From b1346afec135e7846292b3b38b293209ecb53dc1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 23:32:43 +0000 Subject: [PATCH 1194/2994] Final updates for 1.9.0 release. BKrev: 404fa59bWX4Q72O9J3E-aku-FuG2IQ From 94036606c8a4feac6e50d3001174dbe7cc10bea3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 23:32:43 +0000 Subject: [PATCH 1195/2994] Update (Logical change 1.319) --- ntfsprogs/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 9ab31413..9ee15e86 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_TRUE@AM_LFLAGS = -static @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From 12b9f913c3ef45d00837c1e180e05d8d9ed0bb63 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 23:32:43 +0000 Subject: [PATCH 1196/2994] Update for 1.9.0 release. (Logical change 1.319) --- NEWS | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 867366c7..fa19b778 100644 --- a/NEWS +++ b/NEWS @@ -10,11 +10,10 @@ work with the updated ntfsresize. (Szakacsits Szabolcs) ntfsprogs now should ./configure and compile cleanly on SuSE as well as RedHat Linux. -ntfsprogs now compiles and works on FreeBSD. Thanks to Christophe Grenier. - -ntfsprogs now compiles with DJGPP under DOS, too (only "make libs" target, -which is sufficient to write DOS applications using libntfs). Thanks to -Christophe Grenier. +ntfsprogs ("make libs" only) now compiles on FreeBSD, NetBSD, Windows (Cygwin), +and DOS (DJGPP). Thanks to Christophe Grenier for DOS and FreeBSD testing +and fixes and to Lode Leroy for Windows testing and fixes. Note, the Windows +version is read-only and has limited functionality at present. Merged the NTFS Gnome VFS module by Jan Kratochvil. From c446b5b7c02e2d218ba8a12aa736e1f91158a2e8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 23:37:54 +0000 Subject: [PATCH 1197/2994] Update (Logical change 1.320) --- ntfsprogs/mkntfs.8.in | 2 +- ntfsprogs/ntfscat.8.in | 2 +- ntfsprogs/ntfscluster.8.in | 2 +- ntfsprogs/ntfsls.8.in | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 53923f86..679924a6 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -221,7 +221,7 @@ has been written by Anton Altaparmakov (if that fails, use ). .SH AVAILABILITY .B mkntfs -is part of the Linux-NTFS project and is available for download from +is part of the ntfsprogs package and is available for download from http://sourceforge.net/project/showfiles.php?group_id=13956 in source (tar ball and rpm) and pre-compiled binary (i386 rpm and deb) form. .SH SEE ALSO diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in index 36c976bd..84cac67a 100644 --- a/ntfsprogs/ntfscat.8.in +++ b/ntfsprogs/ntfscat.8.in @@ -93,7 +93,7 @@ was written by Richard Russon (FlatCap) If you find this tool useful, make FlatCap happy and send him an email. .SH AVAILABILITY .B ntfscat -is part of the linux\-ntfs package and is available from +is part of the ntfsprogs package and is available from .br .nh http://linux\-ntfs.sourceforge.net/downloads.html diff --git a/ntfsprogs/ntfscluster.8.in b/ntfsprogs/ntfscluster.8.in index 763158b8..0fb979c5 100644 --- a/ntfsprogs/ntfscluster.8.in +++ b/ntfsprogs/ntfscluster.8.in @@ -133,7 +133,7 @@ was written by Richard Russon (FlatCap) If you find this tool useful, make FlatCap happy and send him an email. .SH AVAILABILITY .B ntfscluster -is part of the linux\-ntfs package and is available from +is part of the ntfsprogs package and is available from .br .nh http://linux\-ntfs.sourceforge.net/downloads.html diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index 0880251f..4910b42f 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -149,7 +149,7 @@ Anton Altaparmakov . This man page has been written by Anton Altaparmakov. .SH AVAILABILITY .B ntfsls -is part of the Linux-NTFS project and is available for download from +is part of the ntfsprogs package and is available for download from http://sourceforge.net/project/showfiles.php?group_id=13956 in source (tar ball and rpm) and pre-compiled binary (i386 rpm and deb) form. .SH SEE ALSO From 83beb9f65ce5f4624e608c126671256a2234b772 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 23:37:54 +0000 Subject: [PATCH 1198/2994] Update some man pages with Linux-NTFS -> ntfsprogs. BKrev: 404fa6d2TclZRnzaGDCUibAwEau3Sw From 0db6071738939aedd868c726a0cc01cda7ad68be Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 23:41:00 +0000 Subject: [PATCH 1199/2994] Makefile.in: Update BKrev: 404fa78cDRjGrJHTDvBAo_zu3CvzZQ From d7f7475b587923ff23e98655bc43245ea9d50c95 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 10 Mar 2004 23:41:00 +0000 Subject: [PATCH 1200/2994] Update (Logical change 1.321) --- ntfsprogs/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 9ee15e86..9ab31413 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -146,10 +146,10 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From 9b3652469c9637827fbf7d01b89dcfc26e7fa299 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 11 Mar 2004 15:33:34 +0000 Subject: [PATCH 1201/2994] Update with SuSE 9.1 beta 1 versions of GNU build system. (Logical change 1.322) --- Makefile.in | 226 ++- aclocal.m4 | 2118 +++++++++++----------- compile | 105 +- config.guess | 58 +- config.h.in | 6 +- config.sub | 5 +- configure | 3645 +++++++++++++++++++++++++------------- configure.ac | 19 +- depcomp | 74 +- doc/Makefile.in | 83 +- include/Makefile.in | 135 +- include/ntfs/Makefile.in | 114 +- install-sh | 452 ++--- libntfs/Makefile.in | 300 ++-- ltmain.sh | 309 ++-- missing | 58 +- mkinstalldirs | 58 +- ntfsprogs/Makefile.in | 441 +++-- 18 files changed, 4934 insertions(+), 3272 deletions(-) diff --git a/Makefile.in b/Makefile.in index b6a590f9..2af54ab2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.6 from Makefile.am. +# Makefile.in generated by automake 1.8.2 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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. @@ -13,7 +13,6 @@ # PARTICULAR PURPOSE. @SET_MAKE@ - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -21,7 +20,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -36,6 +34,43 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(srcdir)/ntfsprogs.spec.in $(top_srcdir)/configure AUTHORS \ + COPYING ChangeLog INSTALL NEWS compile config.guess config.sub \ + depcomp install-sh ltconfig ltmain.sh missing mkinstalldirs +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = ntfsprogs.spec +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ @@ -135,6 +170,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -146,51 +182,48 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ - SUBDIRS = doc include libntfs ntfsprogs - EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ INSTALL NEWS README autogen.sh ntfsprogs.spec.in \ TODO.ntfsprogs getgccver - AUTOMAKE_OPTIONS = gnu -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = ntfsprogs.spec -DIST_SOURCES = - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ - Makefile.in NEWS aclocal.m4 compile config.guess config.h.in \ - config.sub configure configure.ac depcomp install-sh ltconfig \ - ltmain.sh missing mkinstalldirs ntfsprogs.spec.in -DIST_SUBDIRS = $(SUBDIRS) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: - -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; -$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck -$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.ac +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @@ -202,14 +235,14 @@ config.h: stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h - -$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) - touch $(srcdir)/config.h.in + rm -f stamp-h1 + touch $@ distclean-hdr: -rm -f config.h stamp-h1 -ntfsprogs.spec: $(top_builddir)/config.status ntfsprogs.spec.in +ntfsprogs.spec: $(top_builddir)/config.status $(srcdir)/ntfsprogs.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: @@ -281,14 +314,6 @@ ctags-recursive: test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -297,6 +322,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique +tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -322,7 +348,6 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique - ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -345,24 +370,11 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = . -distdir = $(PACKAGE)-$(VERSION) - -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } - -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) - $(mkinstalldirs) $(distdir)/. $(distdir)/libntfs $(distdir)/ntfsprogs + $(mkdir_p) $(distdir)/. $(distdir)/libntfs $(distdir)/ntfsprogs @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ @@ -374,7 +386,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -391,13 +403,13 @@ distdir: $(DISTFILES) done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ @@ -414,6 +426,23 @@ dist-gzip: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) +dist-bzip2: distdir + $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + dist dist-all: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) @@ -422,8 +451,18 @@ dist dist-all: distdir # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist - $(am__remove_distdir) - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst @@ -443,19 +482,20 @@ distcheck: dist distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ - (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ + (cd ../.. && $(mkdir_p) "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ - && rm -f $(distdir).tar.gz \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) - @echo "$(distdir).tar.gz is ready for distribution" | \ - sed 'h;s/./=/g;p;x;p;x' + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ @@ -479,7 +519,6 @@ check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: - install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -491,7 +530,7 @@ install-am: all-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -499,7 +538,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -510,13 +549,16 @@ clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ - distclean-tags + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: +html: html-recursive + info: info-recursive info-am: @@ -534,6 +576,7 @@ installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive @@ -552,23 +595,20 @@ uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive dist dist-all dist-gzip distcheck distclean \ +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am clean clean-generic clean-libtool clean-recursive \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-recursive distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am dvi-recursive info info-am \ - info-recursive install install-am install-data install-data-am \ - install-data-recursive install-exec install-exec-am \ - install-exec-recursive install-info install-info-am \ - install-info-recursive install-man install-recursive \ + distuninstallcheck dvi dvi-am html html-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-strip installcheck installcheck-am installdirs \ - installdirs-am installdirs-recursive maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive mostlyclean \ - mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ - pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ - tags-recursive uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive + installdirs-am maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am uninstall-info-am dist-hook: ntfsprogs.spec diff --git a/aclocal.m4 b/aclocal.m4 index f96c0ba9..0811dfda 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.7.6 -*- Autoconf -*- +# generated automatically by aclocal 1.8.2 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -11,867 +11,6 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# 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. - -# 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([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 - -# 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.6])]) - -# 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 > 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 conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - 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". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# -*- 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_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 - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# AM_AUX_DIR_EXPAND - -# 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], -[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])]) - -# 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]) - # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # serial 47 AC_PROG_LIBTOOL @@ -1416,7 +555,8 @@ need_locks="$enable_libtool_lock" # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_CACHE_CHECK([$1], [$2], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], [$2=no ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) printf "$lt_simple_compile_test_code" > conftest.$ac_ext @@ -1521,6 +661,12 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=8192; ;; + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but @@ -1684,7 +830,7 @@ else lt_cv_dlopen_self=yes ]) ;; - + *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], @@ -1773,13 +919,6 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext - # According to Tom Tromey, Ian Lance Taylor reported there are C compilers - # that will create temporary files in the current directory regardless of - # the output directory. Thus, making CWD read-only will cause this test - # to fail, enabling locking or at least warning the user not to do parallel - # builds. - chmod -w . - lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -1803,8 +942,11 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], fi fi chmod u+w . - $rm conftest* out/* - rmdir out + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* @@ -1921,7 +1063,7 @@ fi *) AC_MSG_RESULT([no]) ;; - esac + esac fi ])# AC_LIBTOOL_SYS_LIB_STRIP @@ -2022,7 +1164,7 @@ aix4* | aix5*) amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) @@ -2069,7 +1211,7 @@ cygwin* | mingw* | pw32*) cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix @@ -2108,17 +1250,16 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -2136,6 +1277,18 @@ freebsd1*) dynamic_linker=no ;; +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat @@ -2279,12 +1432,11 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - case $LD in # libtool.m4 will add one of these switches to LD - *"-m elf_x86_64"*|*"-m elf64ppc"*|*"-m elf64_s390"*|*"-m elf64_sparc"*) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64" - ;; - esac + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -2295,6 +1447,18 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -2304,7 +1468,7 @@ netbsd*) finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi @@ -2320,7 +1484,7 @@ newsos6) shlibpath_overrides_runpath=yes ;; -nto-qnx) +nto-qnx*) version_type=linux need_lib_prefix=no need_version=no @@ -2333,7 +1497,7 @@ nto-qnx) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + need_version=yes library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -2789,7 +1953,7 @@ fi # AC_PROG_LD # ---------- -# find the path to the GNU or non-GNU linker +# find the pathname to the GNU or non-GNU linker AC_DEFUN([AC_PROG_LD], [AC_ARG_WITH([gnu-ld], [AC_HELP_STRING([--with-gnu-ld], @@ -2815,7 +1979,7 @@ if test "$GCC" = yes; then # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the path of ld + # Canonicalize the pathname 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%/%"` @@ -2943,28 +2107,24 @@ bsdi4*) lt_cv_file_magic_test_file=/shlib/libc.so ;; -cygwin* | mingw* | pw32*) +cygwin*) # win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='win32_libid' ;; +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # win32_libid shell function, so use a weaker test based on 'objdump'. + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + darwin* | rhapsody*) - # this will be overwritten by pass_all, but leave it in just in case - 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 lt_cv_deplibs_check_method=pass_all ;; -freebsd*) +freebsd* | kfreebsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -3003,36 +2163,27 @@ hpux10.20* | hpux11*) ;; irix5* | irix6* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # 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" - ;; + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; 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*) case $host_cpu in - alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh* | x86_64) + alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM + # this will be overridden with pass_all, but let us keep it just in case 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` + lt_cv_deplibs_check_method=pass_all ;; netbsd*) @@ -3049,7 +2200,7 @@ newos6*) lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; -nto-qnx) +nto-qnx*) lt_cv_deplibs_check_method=unknown ;; @@ -3064,9 +2215,6 @@ openbsd*) ;; 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 ;; @@ -3076,7 +2224,6 @@ sco3.2v5*) solaris*) lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) @@ -3116,7 +2263,7 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown # AC_PROG_NM # ---------- -# find the path to a BSD-compatible name lister +# find the pathname to a BSD-compatible name lister AC_DEFUN([AC_PROG_NM], [AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, [if test -n "$NM"; then @@ -3254,7 +2401,7 @@ AC_DEFUN([AC_LIBTOOL_CXX], AC_DEFUN([_LT_AC_LANG_CXX], [AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,CXX" | sed 's/^,//'`]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) ])# _LT_AC_LANG_CXX @@ -3270,7 +2417,7 @@ AC_DEFUN([AC_LIBTOOL_F77], # --------------- AC_DEFUN([_LT_AC_LANG_F77], [AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,F77" | sed 's/^,//'`]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) ])# _LT_AC_LANG_F77 @@ -3291,7 +2438,7 @@ AC_DEFUN([_LT_AC_LANG_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])])])])])]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,GCJ" | sed 's/^,//'`]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) ])# _LT_AC_LANG_GCJ @@ -3300,7 +2447,7 @@ _LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,GCJ" | sed 's/^,//'`]) # enable support for Windows resource files AC_DEFUN([AC_LIBTOOL_RC], [AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,RC" | sed 's/^,//'`]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) ])# AC_LIBTOOL_RC @@ -3342,7 +2489,7 @@ if test "$GCC" = no; then fi if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : else AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no @@ -3365,9 +2512,9 @@ AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_DLOPEN_SELF($1) # Report which librarie types wil actually be built @@ -3394,33 +2541,42 @@ aix4*) fi ;; darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + if test "$GCC" = yes; then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case "$host_os" in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ;; *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi ;; esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - output_verbose_link_cmd='echo' + output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3555,7 +2711,7 @@ if test "$GXX" = yes; then # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists @@ -3722,41 +2878,54 @@ case $host_os in ;; darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + if test "$GXX" = yes; then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case "$host_os" in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ;; *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi ;; esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi ;; dgux*) @@ -3783,7 +2952,7 @@ case $host_os in freebsd-elf*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; - freebsd*) + freebsd* | kfreebsd*-gnu) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_AC_TAGVAR(ld_shlibs, $1)=yes @@ -4293,9 +3462,9 @@ AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_DLOPEN_SELF($1) AC_LIBTOOL_CONFIG($1) @@ -4537,9 +3706,10 @@ AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) + AC_LIBTOOL_CONFIG($1) @@ -4587,9 +3757,9 @@ AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) AC_LIBTOOL_DLOPEN_SELF($1) AC_LIBTOOL_CONFIG($1) @@ -4654,11 +3824,12 @@ if test -f "$ltmain"; then # without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST - fi + fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM SED SHELL \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ @@ -4708,7 +3879,7 @@ if test -f "$ltmain"; then _LT_AC_TAGVAR(archive_cmds, $1) | \ _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ _LT_AC_TAGVAR(module_cmds, $1) | \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ extract_expsyms_cmds | reload_cmds | finish_cmds | \ @@ -4839,7 +4010,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$STRIP +STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -5114,7 +4285,10 @@ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. - test -f Makefile && make "$ltmain" + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi fi ])# AC_LIBTOOL_CONFIG @@ -5187,7 +4361,7 @@ osf*) symcode='[[BCDEGQRST]]' ;; solaris* | sysv5*) - symcode='[[BDT]]' + symcode='[[BDRT]]' ;; sysv4) symcode='[[DFNSTU]]' @@ -5205,7 +4379,7 @@ esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) - symcode='[[ABCDGISTW]]' ;; + symcode='[[ABCDGIRSTW]]' ;; esac # Try without a prefix undercore, then with it. @@ -5420,7 +4594,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; esac ;; - freebsd*) + freebsd* | kfreebsd*-gnu) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) @@ -5471,7 +4645,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; + ;; cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha @@ -5696,12 +4870,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) linux*) case $CC in - icc|ecc) + icc* | ecc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - ccc) + ccc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' @@ -5831,7 +5005,7 @@ ifelse([$1],[CXX],[ _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown _LT_AC_TAGVAR(hardcode_automatic, $1)=no _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* @@ -5974,6 +5148,31 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -6162,20 +5361,27 @@ EOF ;; darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + if test "$GXX" = yes ; then _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case "$host_os" in rhapsody* | darwin1.[[012]]) _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' ;; *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi ;; esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then @@ -6186,20 +5392,22 @@ EOF else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's if test "X$lt_int_apple_cc_single_mod" = Xyes ; then _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi ;; dgux*) @@ -6232,7 +5440,7 @@ EOF ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) + freebsd* | kfreebsd*-gnu) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes @@ -6549,7 +5757,7 @@ x|xyes) AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $rm conftest* printf "$lt_simple_compile_test_code" > conftest.$ac_ext - + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest @@ -6769,3 +5977,923 @@ AC_DEFUN(PKG_CHECK_MODULES, [ +# -*- Autoconf -*- +# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Generated from amversion.in; do not edit by hand. + +# 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.8"]) + +# 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.8.2])]) + +# AM_AUX_DIR_EXPAND + +# Copyright (C) 2001, 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. + +# 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. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 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 6 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + 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])]) + +# serial 6 -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# 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 build + --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 (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. + +#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"]) +]) + +# 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. + +# 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 11 + +# 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_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +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 + +# 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 +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# 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]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright (C) 2001, 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. + +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)]) + +# -*- 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])]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004 +# 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 + +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]) + +# 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 +]) + +# -*- Autoconf -*- + + +# Copyright (C) 1997, 1999, 2000, 2001, 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 3 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[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 + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. + +# Copyright (C) 2003, 2004 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. + +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p -- . 2>/dev/null; then + # Keeping the `.' argument allows $(mkdir_p) to be used without + # argument. Indeed, we sometimes output rules like + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. + # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more + # expensive solution, as it forces Make to start a sub-shell.) + mkdir_p='mkdir -p -- .' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- 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_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 (C) 1996, 1997, 2000, 2001, 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 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +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 conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + 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". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# AM_PROG_INSTALL_STRIP + +# Copyright (C) 2001, 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. + +# 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])]) + diff --git a/compile b/compile index 9bb997a6..a81e000a 100755 --- a/compile +++ b/compile @@ -1,8 +1,9 @@ #! /bin/sh - # Wrapper for compilers which do not understand `-c -o'. -# Copyright 1999, 2000 Free Software Foundation, Inc. +scriptversion=2003-11-09.00 + +# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -24,9 +25,36 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# Usage: -# compile PROGRAM [ARGS]... -# `-o FOO.o' is removed from the args passed to the actual compile. +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand `-c -o'. +Remove `-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file `INSTALL'. + +Report bugs to . +EOF + exit 0 + ;; + -v | --v*) + echo "compile $scriptversion" + exit 0 + ;; +esac + prog=$1 shift @@ -35,39 +63,39 @@ ofile= cfile= args= while test $# -gt 0; do - case "$1" in + case "$1" in -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we do something ugly here. - ofile=$2 - shift - case "$ofile" in + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we do something ugly here. + ofile=$2 + shift + case "$ofile" in *.o | *.obj) - ;; + ;; *) - args="$args -o $ofile" - ofile= - ;; - esac + args="$args -o $ofile" + ofile= + ;; + esac ;; *.c) - cfile=$1 - args="$args $1" - ;; + cfile=$1 + args="$args $1" + ;; *) - args="$args $1" - ;; - esac - shift + args="$args $1" + ;; + esac + shift done if test -z "$ofile" || test -z "$cfile"; then - # If no `-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # `.c' file was seen then we are probably linking. That is also - # ok. - exec "$prog" $args + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$prog" $args fi # Name of file we expect compiler to create. @@ -79,10 +107,10 @@ cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` # object file name, since that is what matters with a parallel build. lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d while true; do - if mkdir $lockdir > /dev/null 2>&1; then - break - fi - sleep 1 + if mkdir $lockdir > /dev/null 2>&1; then + break + fi + sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir $lockdir; exit 1" 1 2 15 @@ -92,8 +120,17 @@ trap "rmdir $lockdir; exit 1" 1 2 15 status=$? if test -f "$cofile"; then - mv "$cofile" "$ofile" + mv "$cofile" "$ofile" fi rmdir $lockdir exit $status + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/config.guess b/config.guess index e8c6fc0c..57cc92ea 100755 --- a/config.guess +++ b/config.guess @@ -136,6 +136,16 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -821,16 +831,16 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo cris-axis-linux exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -849,7 +859,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -868,13 +878,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-${VENDOR}-linux exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-${VENDOR}-linux exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -887,34 +897,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-${VENDOR}-linux ;; + PA8*) echo hppa2.0-${VENDOR}-linux ;; + *) echo hppa-${VENDOR}-linux ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-${VENDOR}-linux exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo x86_64-${VENDOR}-linux exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -929,18 +939,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" + echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" + echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or + # Either a pre-BFD a.out linker (linuxoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -969,7 +979,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.h.in b/config.h.in index f9155955..821c67db 100644 --- a/config.h.in +++ b/config.h.in @@ -244,9 +244,11 @@ /* Define to empty if `const' does not conform to ANSI C. */ #undef const -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus #undef inline +#endif /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc diff --git a/config.sub b/config.sub index 463186db..77322df8 100755 --- a/config.sub +++ b/config.sub @@ -1149,7 +1149,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1182,9 +1182,6 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index 95c1f08b..5f5292c5 100755 --- a/configure +++ b/configure @@ -1,11 +1,10 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for ntfsprogs 1.9.0. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.0. # # Report bugs to . # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -22,9 +21,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -43,7 +43,7 @@ for as_var in \ 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 + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -220,16 +220,17 @@ rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p 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" +as_tr_cpp="eval 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" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -392,9 +393,9 @@ fi -tagnames=`echo "$tagnames,CXX" | sed 's/^,//'` +tagnames=${tagnames+${tagnames},}CXX -tagnames=`echo "$tagnames,F77" | sed 's/^,//'` +tagnames=${tagnames+${tagnames},}F77 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, @@ -465,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os 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 REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os 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 mkdir_p AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -824,7 +825,7 @@ done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir + localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in @@ -864,10 +865,10 @@ if test -z "$srcdir"; then # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -979,9 +980,9 @@ _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -1028,8 +1029,8 @@ if test -n "$ac_init_help"; then 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 + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] @@ -1038,10 +1039,10 @@ Optional Features: --disable-default-device-io-ops do not provide default device io operations --disable-gnome-vfs omit Gnome-VFS-2.0 'libntfs' interface - (default=detect) + default=detect --enable-really-static create completely static binaries for the utilities - --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) @@ -1107,12 +1108,45 @@ case $srcdir in 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` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. @@ -1123,7 +1157,7 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then + test -f $ac_srcdir/configure.in; then echo $ac_configure --help else @@ -1137,10 +1171,9 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF ntfsprogs configure 1.9.0 -generated by GNU Autoconf 2.57 +generated by GNU Autoconf 2.59 -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1152,7 +1185,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by ntfsprogs $as_me 1.9.0, which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1229,19 +1262,19 @@ do 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. + 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 + 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. @@ -1275,12 +1308,12 @@ _ASBOX 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" + "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" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } @@ -1309,7 +1342,7 @@ _ASBOX for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi @@ -1328,7 +1361,7 @@ _ASBOX echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 - rm -f core core.* *.core && + rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 @@ -1408,7 +1441,7 @@ fi # 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 + 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" @@ -1425,13 +1458,13 @@ echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ,);; *) 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:$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:$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:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. @@ -1597,7 +1630,7 @@ test -n "$target_alias" && ac_config_headers="$ac_config_headers config.h" -am__api_version="1.7" +am__api_version="1.8" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -1609,6 +1642,7 @@ am__api_version="1.7" # 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" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 @@ -1625,6 +1659,7 @@ do case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -1632,20 +1667,20 @@ case $as_dir/ in # 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 + 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 done ;; @@ -1733,7 +1768,6 @@ _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` @@ -1747,6 +1781,31 @@ else echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi +if mkdir -p -- . 2>/dev/null; then + # Keeping the `.' argument allows $(mkdir_p) to be used without + # argument. Indeed, we sometimes output rules like + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. + # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more + # expensive solution, as it forces Make to start a sub-shell.) + mkdir_p='mkdir -p -- .' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +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. @@ -1789,7 +1848,7 @@ done 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_,'` +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 @@ -1825,7 +1884,7 @@ else fi rmdir .tst 2>/dev/null - # test to see if srcdir already configured +# 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 @@ -2467,7 +2526,6 @@ ac_compiler=`set X $ac_compile; echo $2` (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2487,8 +2545,8 @@ 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 +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $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 @@ -2508,23 +2566,23 @@ 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. - ;; + # This is the source file. + ;; [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; + # 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;; + 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;; + break;; esac done else @@ -2598,8 +2656,8 @@ for ac_file in conftest.exe conftest conftest.*; do 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;; + export ac_cv_exeext + break;; * ) break;; esac done @@ -2624,7 +2682,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 @@ -2675,7 +2732,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 @@ -2695,11 +2751,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2712,7 +2778,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi @@ -2728,7 +2794,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 @@ -2745,11 +2810,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2762,7 +2837,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err 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 @@ -2789,7 +2864,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 @@ -2817,6 +2891,16 @@ static char *f (char * (*g) (char **, int), char **p, ...) va_end (v); return s; } + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -2843,11 +2927,21 @@ 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 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2860,7 +2954,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext +rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC @@ -2888,19 +2982,28 @@ cat >conftest.$ac_ext <<_ACEOF _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 ' \ + '' \ '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 ();' \ @@ -2908,14 +3011,13 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 '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 $ac_declaration +#include int main () { @@ -2926,11 +3028,21 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2943,9 +3055,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2962,11 +3073,21 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2978,7 +3099,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -2992,7 +3113,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3177,6 +3298,7 @@ fi # 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" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 @@ -3193,6 +3315,7 @@ do case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -3200,20 +3323,20 @@ case $as_dir/ in # 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 + 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 done ;; @@ -3256,7 +3379,7 @@ fi 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_,'` +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 @@ -3403,7 +3526,7 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld + # Canonicalize the pathname 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%/%"` @@ -3582,28 +3705,24 @@ bsdi4*) lt_cv_file_magic_test_file=/shlib/libc.so ;; -cygwin* | mingw* | pw32*) +cygwin*) # win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='win32_libid' ;; +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # win32_libid shell function, so use a weaker test based on 'objdump'. + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + darwin* | rhapsody*) - # this will be overwritten by pass_all, but leave it in just in case - 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 lt_cv_deplibs_check_method=pass_all ;; -freebsd*) +freebsd* | kfreebsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -3642,36 +3761,27 @@ hpux10.20* | hpux11*) ;; irix5* | irix6* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # 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" - ;; + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; 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*) case $host_cpu in - alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh* | x86_64) + alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM + # this will be overridden with pass_all, but let us keep it just in case 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` + lt_cv_deplibs_check_method=pass_all ;; netbsd*) @@ -3688,7 +3798,7 @@ newos6*) lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; -nto-qnx) +nto-qnx*) lt_cv_deplibs_check_method=unknown ;; @@ -3703,9 +3813,6 @@ openbsd*) ;; 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 ;; @@ -3715,7 +3822,6 @@ sco3.2v5*) solaris*) lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) @@ -3795,7 +3901,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3798 "configure"' > conftest.$ac_ext + echo '#line 3904 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -3892,7 +3998,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 @@ -3909,11 +4014,21 @@ main () _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3926,7 +4041,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 lt_cv_cc_needs_belf=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err 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' @@ -3975,7 +4091,6 @@ do # 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 @@ -3986,7 +4101,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -3998,6 +4113,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -4018,7 +4134,6 @@ 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 @@ -4036,6 +4151,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -4082,7 +4198,6 @@ do # 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 @@ -4093,7 +4208,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -4105,6 +4220,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -4125,7 +4241,6 @@ 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 @@ -4143,6 +4258,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -4188,7 +4304,6 @@ if test "${ac_cv_header_stdc+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 @@ -4209,11 +4324,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4226,12 +4351,11 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err 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 <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4253,7 +4377,6 @@ 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 <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4278,7 +4401,6 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4290,9 +4412,9 @@ cat >>conftest.$ac_ext <<_ACEOF # 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')) + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -4303,7 +4425,7 @@ main () int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) exit(2); exit (0); } @@ -4328,7 +4450,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -4353,7 +4475,7 @@ fi for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.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 @@ -4362,7 +4484,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 @@ -4374,11 +4495,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4391,7 +4522,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err 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 @@ -4422,7 +4553,6 @@ else 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 @@ -4433,11 +4563,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4450,7 +4590,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -4458,7 +4598,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 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 @@ -4476,6 +4615,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -4495,33 +4635,32 @@ 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 ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag 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 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + 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: 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: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## --------------------------------------------------- ## +## Report this to linux-ntfs-dev@lists.sourceforge.net ## +## --------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -4532,7 +4671,7 @@ 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" + 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 @@ -4666,7 +4805,6 @@ if test "${ac_cv_cxx_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 @@ -4686,11 +4824,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4703,7 +4851,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi @@ -4719,7 +4867,6 @@ if test "${ac_cv_prog_cxx_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 @@ -4736,11 +4883,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4753,7 +4910,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 @@ -4773,8 +4930,7 @@ else fi fi for ac_declaration in \ - ''\ - '#include ' \ + '' \ '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 ();' \ @@ -4782,14 +4938,13 @@ for ac_declaration in \ '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 $ac_declaration +#include int main () { @@ -4800,11 +4955,21 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4817,9 +4982,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -4836,11 +5000,21 @@ exit (42); _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -4852,7 +5026,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -4993,7 +5167,6 @@ do # 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 @@ -5004,7 +5177,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -5016,6 +5189,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi @@ -5036,7 +5210,6 @@ 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 @@ -5054,6 +5227,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi @@ -5100,7 +5274,6 @@ do # 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 @@ -5111,7 +5284,7 @@ cat >>conftest.$ac_ext <<_ACEOF #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -5123,6 +5296,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi @@ -5143,7 +5317,6 @@ 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 @@ -5161,6 +5334,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi @@ -5205,7 +5379,7 @@ ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_f77_compiler_gnu if test -n "$ac_tool_prefix"; then - for ac_prog in g77 f77 xlf frt pgf77 fl32 af77 fort77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 lf95 g95 + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran 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 @@ -5247,7 +5421,7 @@ fi fi if test -z "$F77"; then ac_ct_F77=$F77 - for ac_prog in g77 f77 xlf frt pgf77 fl32 af77 fort77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 lf95 g95 + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -5292,7 +5466,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5295:" \ +echo "$as_me:5469:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5310,9 +5484,10 @@ ac_compiler=`set X $ac_compile; echo $2` ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } +rm -f a.out # If we don't use `.F' as extension, the preprocessor is not run on the -# input file. +# input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 @@ -5330,11 +5505,21 @@ else _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5347,14 +5532,13 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_f77_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 ac_ext=$ac_save_ext -G77=`test $ac_compiler_gnu = yes && echo yes` ac_test_FFLAGS=${FFLAGS+set} ac_save_FFLAGS=$FFLAGS FFLAGS= @@ -5371,11 +5555,21 @@ cat >conftest.$ac_ext <<_ACEOF _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -5388,7 +5582,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_f77_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 @@ -5396,18 +5590,20 @@ echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 if test "$ac_test_FFLAGS" = set; then FFLAGS=$ac_save_FFLAGS elif test $ac_cv_prog_f77_g = yes; then - if test "$G77" = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-g -O2" else FFLAGS="-g" fi else - if test "$G77" = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then FFLAGS="-O2" else FFLAGS= fi fi + +G77=`test $ac_compiler_gnu = yes && echo yes` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -5454,6 +5650,12 @@ else lt_cv_sys_max_cmd_len=8192; ;; + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but @@ -5535,7 +5737,7 @@ osf*) symcode='[BCDEGQRST]' ;; solaris* | sysv5*) - symcode='[BDT]' + symcode='[BDRT]' ;; sysv4) symcode='[DFNSTU]' @@ -5553,7 +5755,7 @@ esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) - symcode='[ABCDGISTW]' ;; + symcode='[ABCDGIRSTW]' ;; esac # Try without a prefix undercore, then with it. @@ -6279,7 +6481,8 @@ lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' - echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -6297,11 +6500,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6300: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6503: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6304: \$? = $ac_status" >&5 + echo "$as_me:6507: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6444,12 +6647,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 linux*) case $CC in - icc|ecc) + icc* | ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - ccc) + ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' @@ -6511,7 +6714,8 @@ echo "${ECHO_T}$lt_prog_compiler_pic" >&6 # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then - echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -6529,11 +6733,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6532: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6736: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6536: \$? = $ac_status" >&5 + echo "$as_me:6740: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6580,13 +6784,6 @@ else mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext - # According to Tom Tromey, Ian Lance Taylor reported there are C compilers - # that will create temporary files in the current directory regardless of - # the output directory. Thus, making CWD read-only will cause this test - # to fail, enabling locking or at least warning the user not to do parallel - # builds. - chmod -w . - lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -6596,11 +6793,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6599: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6796: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6603: \$? = $ac_status" >&5 + echo "$as_me:6800: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -6610,8 +6807,11 @@ else fi fi chmod u+w . - $rm conftest* out/* - rmdir out + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* @@ -6808,6 +7008,31 @@ EOF hardcode_shlibpath_var=no ;; + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds="$tmp_archive_cmds" + fi + else + ld_shlibs=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -6936,7 +7161,6 @@ EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -6953,11 +7177,21 @@ main () _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -6974,7 +7208,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" @@ -6987,7 +7222,6 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -7004,11 +7238,21 @@ main () _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -7025,7 +7269,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" @@ -7078,20 +7323,27 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + if test "$GXX" = yes ; then archive_cmds_need_lc=no case "$host_os" in rhapsody* | darwin1.[012]) allow_undefined_flag='-undefined suppress' ;; *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag='-flat_namespace -undefined suppress' + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag='-undefined dynamic_lookup' + ;; + esac + fi ;; esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then @@ -7102,19 +7354,21 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi - module_cmds='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='-all_load $convenience' link_all_deplibs=yes + else + ld_shlibs=no fi ;; @@ -7148,7 +7402,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) + freebsd* | kfreebsd*-gnu) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes @@ -7508,72 +7762,6 @@ echo "${ECHO_T}$archive_cmds_need_lc" >&6 ;; esac -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var " || \ - test "X$hardcode_automatic"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6 - -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= @@ -7667,7 +7855,7 @@ aix4* | aix5*) amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) @@ -7714,7 +7902,7 @@ cygwin* | mingw* | pw32*) cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix @@ -7753,17 +7941,16 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -7781,6 +7968,18 @@ freebsd1*) dynamic_linker=no ;; +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat @@ -7924,12 +8123,11 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - case $LD in # libtool.m4 will add one of these switches to LD - *"-m elf_x86_64"*|*"-m elf64ppc"*|*"-m elf64_s390"*|*"-m elf64_sparc"*) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64" - ;; - esac + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -7940,6 +8138,18 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -7949,7 +8159,7 @@ netbsd*) finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi @@ -7965,7 +8175,7 @@ newsos6) shlibpath_overrides_runpath=yes ;; -nto-qnx) +nto-qnx*) version_type=linux need_lib_prefix=no need_version=no @@ -7978,7 +8188,7 @@ nto-qnx) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + need_version=yes library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -8096,6 +8306,72 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var " || \ + test "X$hardcode_automatic"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown @@ -8131,7 +8407,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8155,11 +8430,21 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8172,7 +8457,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 @@ -8196,21 +8482,28 @@ if test "${ac_cv_func_shl_load+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. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef shl_load + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -8241,11 +8534,21 @@ return f != shl_load; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8258,7 +8561,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 @@ -8273,7 +8577,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8297,11 +8600,21 @@ shl_load (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8314,7 +8627,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 @@ -8328,21 +8642,28 @@ if test "${ac_cv_func_dlopen+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. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef dlopen + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -8373,11 +8694,21 @@ return f != dlopen; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8390,7 +8721,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 @@ -8405,7 +8737,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8429,11 +8760,21 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8446,7 +8787,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 @@ -8462,7 +8804,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8486,11 +8827,21 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8503,7 +8854,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 @@ -8519,7 +8871,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -8543,11 +8894,21 @@ dld_link (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -8560,7 +8921,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 @@ -8615,7 +8977,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&1 | grep 'Apple' >/dev/null ; then + if test "$GCC" = yes; then archive_cmds_need_lc=no case "$host_os" in rhapsody* | darwin1.[012]) allow_undefined_flag='-undefined suppress' ;; *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag='-flat_namespace -undefined suppress' + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag='-undefined dynamic_lookup' + ;; + esac + fi ;; esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - output_verbose_link_cmd='echo' + output_verbose_link_cmd='echo' archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - module_cmds='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='-all_load $convenience' link_all_deplibs=yes - fi + else + ld_shlibs=no + fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 @@ -8895,7 +9266,8 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM SED SHELL \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ @@ -9073,7 +9445,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$STRIP +STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -9346,7 +9718,10 @@ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. - test -f Makefile && make "$ltmain" + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi fi @@ -9527,7 +9902,7 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld + # Canonicalize the pathname 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%/%"` @@ -9641,7 +10016,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists @@ -9749,7 +10124,6 @@ case $host_os in allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9766,11 +10140,21 @@ main () _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9787,7 +10171,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" @@ -9801,7 +10186,6 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9818,11 +10202,21 @@ main () _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -9839,7 +10233,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" @@ -9891,41 +10286,54 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + if test "$GXX" = yes; then archive_cmds_need_lc_CXX=no case "$host_os" in rhapsody* | darwin1.[012]) allow_undefined_flag_CXX='-undefined suppress' ;; *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag_CXX='-flat_namespace -undefined suppress' + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag_CXX='-undefined dynamic_lookup' + ;; + esac + fi ;; esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_CXX='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported whole_archive_flag_spec_CXX='-all_load $convenience' link_all_deplibs_CXX=yes - fi + else + ld_shlibs_CXX=no + fi ;; dgux*) @@ -9952,7 +10360,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi freebsd-elf*) archive_cmds_need_lc_CXX=no ;; - freebsd*) + freebsd* | kfreebsd*-gnu) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes @@ -10659,7 +11067,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; esac ;; - freebsd*) + freebsd* | kfreebsd*-gnu) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) @@ -10827,7 +11235,8 @@ echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_CXX"; then - echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -10845,11 +11254,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10848: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11257: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:10852: \$? = $ac_status" >&5 + echo "$as_me:11261: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -10896,13 +11305,6 @@ else mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext - # According to Tom Tromey, Ian Lance Taylor reported there are C compilers - # that will create temporary files in the current directory regardless of - # the output directory. Thus, making CWD read-only will cause this test - # to fail, enabling locking or at least warning the user not to do parallel - # builds. - chmod -w . - lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -10912,11 +11314,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:10915: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11317: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:10919: \$? = $ac_status" >&5 + echo "$as_me:11321: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10926,8 +11328,11 @@ else fi fi chmod u+w . - $rm conftest* out/* - rmdir out + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* @@ -11055,72 +11460,6 @@ echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 ;; esac -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || \ - test -n "$runpath_var CXX" || \ - test "X$hardcode_automatic_CXX"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 -echo "${ECHO_T}$hardcode_action_CXX" >&6 - -if test "$hardcode_action_CXX" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= @@ -11214,7 +11553,7 @@ aix4* | aix5*) amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) @@ -11261,7 +11600,7 @@ cygwin* | mingw* | pw32*) cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix @@ -11300,17 +11639,16 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -11328,6 +11666,18 @@ freebsd1*) dynamic_linker=no ;; +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat @@ -11471,12 +11821,11 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - case $LD in # libtool.m4 will add one of these switches to LD - *"-m elf_x86_64"*|*"-m elf64ppc"*|*"-m elf64_s390"*|*"-m elf64_sparc"*) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64" - ;; - esac + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -11487,6 +11836,18 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -11496,7 +11857,7 @@ netbsd*) finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi @@ -11512,7 +11873,7 @@ newsos6) shlibpath_overrides_runpath=yes ;; -nto-qnx) +nto-qnx*) version_type=linux need_lib_prefix=no need_version=no @@ -11525,7 +11886,7 @@ nto-qnx) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + need_version=yes library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -11643,6 +12004,72 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var CXX" || \ + test "X$hardcode_automatic_CXX"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 +echo "${ECHO_T}$hardcode_action_CXX" >&6 + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown @@ -11678,7 +12105,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11702,11 +12128,21 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11719,7 +12155,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 @@ -11743,21 +12180,28 @@ if test "${ac_cv_func_shl_load+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. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef shl_load + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -11788,11 +12232,21 @@ return f != shl_load; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11805,7 +12259,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 @@ -11820,7 +12275,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11844,11 +12298,21 @@ shl_load (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11861,7 +12325,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 @@ -11875,21 +12340,28 @@ if test "${ac_cv_func_dlopen+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. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef dlopen + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -11920,11 +12392,21 @@ return f != dlopen; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11937,7 +12419,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 @@ -11952,7 +12435,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11976,11 +12458,21 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -11993,7 +12485,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 @@ -12009,7 +12502,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12033,11 +12525,21 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12050,7 +12552,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 @@ -12066,7 +12569,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12090,11 +12592,21 @@ dld_link (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -12107,7 +12619,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 @@ -12162,7 +12675,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 linux*) case $CC in - icc|ecc) + icc* | ecc*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - ccc) + ccc*) lt_prog_compiler_wl_F77='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_F77='-non_shared' @@ -13064,7 +13581,8 @@ echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_F77"; then - echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_F77+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13082,11 +13600,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13085: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13603: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13089: \$? = $ac_status" >&5 + echo "$as_me:13607: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13133,13 +13651,6 @@ else mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext - # According to Tom Tromey, Ian Lance Taylor reported there are C compilers - # that will create temporary files in the current directory regardless of - # the output directory. Thus, making CWD read-only will cause this test - # to fail, enabling locking or at least warning the user not to do parallel - # builds. - chmod -w . - lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -13149,11 +13660,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13152: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13663: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13156: \$? = $ac_status" >&5 + echo "$as_me:13667: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13163,8 +13674,11 @@ else fi fi chmod u+w . - $rm conftest* out/* - rmdir out + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* @@ -13361,6 +13875,31 @@ EOF hardcode_shlibpath_var_F77=no ;; + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds_F77="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_F77="$tmp_archive_cmds" + fi + else + ld_shlibs_F77=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -13495,11 +14034,21 @@ EOF _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13516,7 +14065,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" @@ -13535,11 +14085,21 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -13556,7 +14116,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" @@ -13609,20 +14170,27 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + if test "$GXX" = yes ; then archive_cmds_need_lc_F77=no case "$host_os" in rhapsody* | darwin1.[012]) allow_undefined_flag_F77='-undefined suppress' ;; *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag_F77='-flat_namespace -undefined suppress' + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag_F77='-undefined dynamic_lookup' + ;; + esac + fi ;; esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then @@ -13633,19 +14201,21 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi - module_cmds_F77='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported whole_archive_flag_spec_F77='-all_load $convenience' link_all_deplibs_F77=yes + else + ld_shlibs_F77=no fi ;; @@ -13679,7 +14249,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) + freebsd* | kfreebsd*-gnu) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes @@ -14039,72 +14609,6 @@ echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 ;; esac -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_F77= -if test -n "$hardcode_libdir_flag_spec_F77" || \ - test -n "$runpath_var F77" || \ - test "X$hardcode_automatic_F77"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_F77" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && - test "$hardcode_minus_L_F77" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_F77=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_F77=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_F77=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 -echo "${ECHO_T}$hardcode_action_F77" >&6 - -if test "$hardcode_action_F77" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= @@ -14198,7 +14702,7 @@ aix4* | aix5*) amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) @@ -14245,7 +14749,7 @@ cygwin* | mingw* | pw32*) cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix @@ -14284,17 +14788,16 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -14312,6 +14815,18 @@ freebsd1*) dynamic_linker=no ;; +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat @@ -14455,12 +14970,11 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - case $LD in # libtool.m4 will add one of these switches to LD - *"-m elf_x86_64"*|*"-m elf64ppc"*|*"-m elf64_s390"*|*"-m elf64_sparc"*) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64" - ;; - esac + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -14471,6 +14985,18 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -14480,7 +15006,7 @@ netbsd*) finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi @@ -14496,7 +15022,7 @@ newsos6) shlibpath_overrides_runpath=yes ;; -nto-qnx) +nto-qnx*) version_type=linux need_lib_prefix=no need_version=no @@ -14509,7 +15035,7 @@ nto-qnx) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + need_version=yes library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -14627,6 +15153,73 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var F77" || \ + test "X$hardcode_automatic_F77"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 +echo "${ECHO_T}$hardcode_action_F77" >&6 + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + + # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh @@ -14641,7 +15234,8 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM SED SHELL \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ deplibs_check_method reload_flag reload_cmds need_locks \ @@ -14771,7 +15365,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$STRIP +STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -15019,7 +15613,10 @@ else # If there is no Makefile yet, we rely on a make rule to execute # `config.status --recheck' to rerun these tests and create the # libtool script then. - test -f Makefile && make "$ltmain" + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi fi @@ -15078,7 +15675,8 @@ lt_prog_compiler_no_builtin_flag_GCJ= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' - echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -15096,11 +15694,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15099: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15697: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15103: \$? = $ac_status" >&5 + echo "$as_me:15701: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15243,12 +15841,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 linux*) case $CC in - icc|ecc) + icc* | ecc*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - ccc) + ccc*) lt_prog_compiler_wl_GCJ='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static_GCJ='-non_shared' @@ -15310,7 +15908,8 @@ echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic_GCJ"; then - echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -15328,11 +15927,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15331: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15930: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15335: \$? = $ac_status" >&5 + echo "$as_me:15934: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15379,13 +15978,6 @@ else mkdir out printf "$lt_simple_compile_test_code" > conftest.$ac_ext - # According to Tom Tromey, Ian Lance Taylor reported there are C compilers - # that will create temporary files in the current directory regardless of - # the output directory. Thus, making CWD read-only will cause this test - # to fail, enabling locking or at least warning the user not to do parallel - # builds. - chmod -w . - lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. @@ -15395,11 +15987,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15398: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15990: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15402: \$? = $ac_status" >&5 + echo "$as_me:15994: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15409,8 +16001,11 @@ else fi fi chmod u+w . - $rm conftest* out/* - rmdir out + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out cd .. rmdir conftest $rm conftest* @@ -15607,6 +16202,31 @@ EOF hardcode_shlibpath_var_GCJ=no ;; + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds_GCJ="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_GCJ="$tmp_archive_cmds" + fi + else + ld_shlibs_GCJ=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -15735,7 +16355,6 @@ EOF allow_undefined_flag_GCJ='-berok' # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -15752,11 +16371,21 @@ main () _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -15773,7 +16402,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" @@ -15786,7 +16416,6 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an empty executable. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -15803,11 +16432,21 @@ main () _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -15824,7 +16463,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" @@ -15877,20 +16517,27 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then + if test "$GXX" = yes ; then archive_cmds_need_lc_GCJ=no case "$host_os" in rhapsody* | darwin1.[012]) allow_undefined_flag_GCJ='-undefined suppress' ;; *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='-undefined dynamic_lookup' + ;; + esac + fi ;; esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! lt_int_apple_cc_single_mod=no output_verbose_link_cmd='echo' if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then @@ -15901,19 +16548,21 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' fi - module_cmds_GCJ='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' + module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's if test "X$lt_int_apple_cc_single_mod" = Xyes ; then archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported whole_archive_flag_spec_GCJ='-all_load $convenience' link_all_deplibs_GCJ=yes + else + ld_shlibs_GCJ=no fi ;; @@ -15947,7 +16596,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) + freebsd* | kfreebsd*-gnu) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes @@ -16307,72 +16956,6 @@ echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 ;; esac -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_GCJ= -if test -n "$hardcode_libdir_flag_spec_GCJ" || \ - test -n "$runpath_var GCJ" || \ - test "X$hardcode_automatic_GCJ"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_GCJ" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && - test "$hardcode_minus_L_GCJ" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_GCJ=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_GCJ=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_GCJ=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 -echo "${ECHO_T}$hardcode_action_GCJ" >&6 - -if test "$hardcode_action_GCJ" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= @@ -16466,7 +17049,7 @@ aix4* | aix5*) amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) @@ -16513,7 +17096,7 @@ cygwin* | mingw* | pw32*) cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw*) # MinGW DLLs use traditional 'lib' prefix @@ -16552,17 +17135,16 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' fi sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; @@ -16580,6 +17162,18 @@ freebsd1*) dynamic_linker=no ;; +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat @@ -16723,12 +17317,11 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - case $LD in # libtool.m4 will add one of these switches to LD - *"-m elf_x86_64"*|*"-m elf64ppc"*|*"-m elf64_s390"*|*"-m elf64_sparc"*) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64" - ;; - esac + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -16739,6 +17332,18 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -16748,7 +17353,7 @@ netbsd*) finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi @@ -16764,7 +17369,7 @@ newsos6) shlibpath_overrides_runpath=yes ;; -nto-qnx) +nto-qnx*) version_type=linux need_lib_prefix=no need_version=no @@ -16777,7 +17382,7 @@ nto-qnx) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + need_version=yes library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -16895,6 +17500,72 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var GCJ" || \ + test "X$hardcode_automatic_GCJ"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 +echo "${ECHO_T}$hardcode_action_GCJ" >&6 + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown @@ -16930,7 +17601,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -16954,11 +17624,21 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -16971,7 +17651,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 @@ -16995,21 +17676,28 @@ if test "${ac_cv_func_shl_load+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. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shl_load (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef shl_load + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -17040,11 +17728,21 @@ return f != shl_load; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -17057,7 +17755,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shl_load=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 echo "${ECHO_T}$ac_cv_func_shl_load" >&6 @@ -17072,7 +17771,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17096,11 +17794,21 @@ shl_load (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -17113,7 +17821,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 @@ -17127,21 +17836,28 @@ if test "${ac_cv_func_dlopen+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. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef dlopen + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -17172,11 +17888,21 @@ return f != dlopen; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -17189,7 +17915,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 @@ -17204,7 +17931,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17228,11 +17954,21 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -17245,7 +17981,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 @@ -17261,7 +17998,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17285,11 +18021,21 @@ dlopen (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -17302,7 +18048,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_svld_dlopen=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 @@ -17318,7 +18065,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -17342,11 +18088,21 @@ dld_link (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -17359,7 +18115,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_dld_link=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 @@ -17414,7 +18171,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -18564,11 +19328,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18580,15 +19354,25 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext +rm -f conftest.err conftest.$ac_objext CC="$CC -n32" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18600,8 +19384,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext - break +rm -f conftest.err conftest.$ac_objext + break done CC=$ac_save_CC rm -f conftest.$ac_ext @@ -18621,7 +19405,6 @@ else while :; do ac_cv_sys_file_offset_bits=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -18646,11 +19429,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18662,9 +19455,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -18690,11 +19482,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18706,7 +19508,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext break done fi @@ -18728,7 +19530,6 @@ else while :; do ac_cv_sys_large_files=no cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -18753,11 +19554,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18769,9 +19580,8 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -18797,11 +19607,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -18813,7 +19633,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext break done fi @@ -19028,7 +19848,6 @@ if test "${ac_cv_header_stdc+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 @@ -19049,11 +19868,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -19066,12 +19895,11 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err 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 <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -19093,7 +19921,6 @@ 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 <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -19118,7 +19945,6 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -19130,9 +19956,9 @@ cat >>conftest.$ac_ext <<_ACEOF # 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')) + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -19143,7 +19969,7 @@ main () int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) exit(2); exit (0); } @@ -19168,7 +19994,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -19233,7 +20059,6 @@ else 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 @@ -19244,11 +20069,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -19261,7 +20096,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -19269,7 +20104,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 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 @@ -19287,6 +20121,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -19306,33 +20141,32 @@ 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 ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag 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 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + 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: 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: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## --------------------------------------------------- ## +## Report this to linux-ntfs-dev@lists.sourceforge.net ## +## --------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -19343,7 +20177,7 @@ 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" + 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 @@ -19366,7 +20200,6 @@ if test "${ac_cv_header_stdbool_h+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 @@ -19393,17 +20226,17 @@ cat >>conftest.$ac_ext <<_ACEOF # error __bool_true_false_are_defined is not defined #endif - struct s { _Bool s: 1; _Bool t; } s; + struct s { _Bool s: 1; _Bool t; } s; - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) -0.5 == true ? 1 : -1]; - bool e = &s; - char f[(_Bool) -0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) -0.5 == true ? 1 : -1]; + bool e = &s; + char f[(_Bool) -0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; int main () @@ -19415,11 +20248,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -19432,7 +20275,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdbool_h=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6 @@ -19442,7 +20285,6 @@ if test "${ac_cv_type__Bool+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 @@ -19462,11 +20304,21 @@ if (sizeof (_Bool)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -19479,7 +20331,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type__Bool=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 echo "${ECHO_T}$ac_cv_type__Bool" >&6 @@ -19506,7 +20358,6 @@ if test "${ac_cv_c_const+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 @@ -19569,11 +20420,21 @@ main () _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -19586,7 +20447,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 @@ -19606,7 +20467,6 @@ else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -19621,11 +20481,21 @@ $ac_kw foo_t foo () {return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -19637,23 +20507,27 @@ else sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done fi echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 echo "${ECHO_T}$ac_cv_c_inline" >&6 + + case $ac_cv_c_inline in inline | yes) ;; - no) -cat >>confdefs.h <<\_ACEOF -#define inline + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif _ACEOF - ;; - *) cat >>confdefs.h <<_ACEOF -#define inline $ac_cv_c_inline -_ACEOF - ;; + ;; esac echo "$as_me:$LINENO: checking for working long double with more range or precision than double" >&5 @@ -19662,7 +20536,6 @@ if test "${ac_cv_c_long_double+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 @@ -19674,7 +20547,7 @@ int main () { static int test_array [1 - 2 * !(/* Using '|' rather than '||' catches a GCC 2.95.2 x86 bug. */ - (DBL_MAX < LDBL_MAX) | (LDBL_EPSILON < DBL_EPSILON) + (DBL_MAX < LDBL_MAX) | (LDBL_EPSILON < DBL_EPSILON) | (DBL_MAX_EXP < LDBL_MAX_EXP) | (DBL_MANT_DIG < LDBL_MANT_DIG))]; test_array [0] = 0 @@ -19684,11 +20557,21 @@ test_array [0] = 0 _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -19701,7 +20584,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_long_double=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_c_long_double" >&5 echo "${ECHO_T}$ac_cv_c_long_double" >&6 @@ -19719,7 +20602,6 @@ if test "${ac_cv_type_off_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 @@ -19739,11 +20621,21 @@ if (sizeof (off_t)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -19756,7 +20648,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err 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 @@ -19776,7 +20668,6 @@ if test "${ac_cv_type_size_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 @@ -19796,11 +20687,21 @@ if (sizeof (size_t)) _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -19813,7 +20714,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err 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 @@ -19833,7 +20734,6 @@ if test "${ac_cv_member_struct_stat_st_blocks+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 @@ -19852,11 +20752,21 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -19868,7 +20778,6 @@ else sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -19887,11 +20796,21 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -19904,9 +20823,9 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_blocks=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5 echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6 @@ -19922,7 +20841,14 @@ cat >>confdefs.h <<\_ACEOF _ACEOF else - LIBOBJS="$LIBOBJS fileblocks.$ac_objext" + case $LIBOBJS in + "fileblocks.$ac_objext" | \ + *" fileblocks.$ac_objext" | \ + "fileblocks.$ac_objext "* | \ + *" fileblocks.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext" ;; +esac + fi @@ -19932,7 +20858,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 <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -19951,11 +20876,21 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -19967,7 +20902,6 @@ else sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -19986,11 +20920,21 @@ return 0; _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -20003,9 +20947,9 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_rdev=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err 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 @@ -20029,7 +20973,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lsun $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -20053,11 +20996,21 @@ getmntent (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -20070,7 +21023,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_sun_getmntent=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_sun_getmntent" >&5 @@ -20086,7 +21040,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lseq $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -20110,11 +21063,21 @@ getmntent (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -20127,7 +21090,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_seq_getmntent=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_seq_getmntent" >&5 @@ -20143,7 +21107,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lgen $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -20167,11 +21130,21 @@ getmntent (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -20184,7 +21157,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_gen_getmntent=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_gen_getmntent" >&5 @@ -20207,21 +21181,28 @@ 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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -20252,11 +21233,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -20269,7 +21260,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err 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 @@ -20290,7 +21282,6 @@ if test "${ac_cv_prog_gcc_traditional+set}" = set; then else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -20310,7 +21301,6 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -20351,7 +21341,6 @@ else 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 @@ -20362,11 +21351,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -20379,7 +21378,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -20387,7 +21386,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 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 @@ -20405,6 +21403,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -20424,33 +21423,32 @@ 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 ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag 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 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + 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: 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: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## --------------------------------------------------- ## +## Report this to linux-ntfs-dev@lists.sourceforge.net ## +## --------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -20461,7 +21459,7 @@ 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" + 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 @@ -20485,7 +21483,6 @@ else ac_cv_func_malloc_0_nonnull=no else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -20525,7 +21522,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_malloc_0_nonnull=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 @@ -20541,7 +21538,14 @@ else #define HAVE_MALLOC 0 _ACEOF - LIBOBJS="$LIBOBJS malloc.$ac_objext" + case $LIBOBJS in + "malloc.$ac_objext" | \ + *" malloc.$ac_objext" | \ + "malloc.$ac_objext "* | \ + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; +esac + cat >>confdefs.h <<\_ACEOF #define malloc rpl_malloc @@ -20558,7 +21562,6 @@ if test "${ac_cv_func_mbrtowc+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 @@ -20575,11 +21578,21 @@ mbstate_t state; return ! (sizeof state && mbrtowc); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -20592,7 +21605,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_mbrtowc=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_mbrtowc" >&5 echo "${ECHO_T}$ac_cv_func_mbrtowc" >&6 @@ -20613,13 +21627,12 @@ else ac_cv_func_memcmp_working=no 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 int main () { @@ -20638,12 +21651,12 @@ main () int i; for (i = 0; i < 4; i++) { - char *a = foo + i; - char *b = bar + i; - strcpy (a, "--------01111111"); - strcpy (b, "--------10000000"); - if (memcmp (a, b, 16) >= 0) - exit (1); + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + exit (1); } exit (0); } @@ -20672,12 +21685,19 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_memcmp_working=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 -test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext" +test $ac_cv_func_memcmp_working = no && case $LIBOBJS in + "memcmp.$ac_objext" | \ + *" memcmp.$ac_objext" | \ + "memcmp.$ac_objext "* | \ + *" memcmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; +esac + for ac_header in stdlib.h @@ -20696,7 +21716,6 @@ else 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 @@ -20707,11 +21726,21 @@ $ac_includes_default _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 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); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -20724,7 +21753,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -20732,7 +21761,6 @@ echo "${ECHO_T}$ac_header_compiler" >&6 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 @@ -20750,6 +21778,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -20769,33 +21798,32 @@ 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 ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag 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 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + 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: 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: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## +## --------------------------------------------------- ## +## Report this to linux-ntfs-dev@lists.sourceforge.net ## +## --------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -20806,7 +21834,7 @@ 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" + 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 @@ -20830,7 +21858,6 @@ else ac_cv_func_realloc_0_nonnull=no else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -20870,7 +21897,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_realloc_0_nonnull=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5 @@ -20886,7 +21913,14 @@ else #define HAVE_REALLOC 0 _ACEOF - LIBOBJS="$LIBOBJS realloc.$ac_objext" + case $LIBOBJS in + "realloc.$ac_objext" | \ + *" realloc.$ac_objext" | \ + "realloc.$ac_objext "* | \ + *" realloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; +esac + cat >>confdefs.h <<\_ACEOF #define realloc rpl_realloc @@ -20908,7 +21942,6 @@ if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then ac_cv_func_lstat_dereferences_slashed_symlink=no else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -20920,8 +21953,8 @@ main () { struct stat sbuf; /* Linux will dereference the symlink and fail. - That is better in the sense that it means we will not - have to compile and use the lstat wrapper. */ + That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1); ; return 0; @@ -20947,7 +21980,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_lstat_dereferences_slashed_symlink=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even @@ -20968,7 +22001,14 @@ _ACEOF if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then - LIBOBJS="$LIBOBJS lstat.$ac_objext" + case $LIBOBJS in + "lstat.$ac_objext" | \ + *" lstat.$ac_objext" | \ + "lstat.$ac_objext "* | \ + *" lstat.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; +esac + fi echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5 @@ -20980,7 +22020,6 @@ else ac_cv_func_stat_empty_string_bug=yes else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -21016,13 +22055,20 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_stat_empty_string_bug=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5 echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6 if test $ac_cv_func_stat_empty_string_bug = yes; then - LIBOBJS="$LIBOBJS stat.$ac_objext" + case $LIBOBJS in + "stat.$ac_objext" | \ + *" stat.$ac_objext" | \ + "stat.$ac_objext "* | \ + *" stat.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; +esac + cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 @@ -21040,21 +22086,28 @@ 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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -21085,11 +22138,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -21102,7 +22165,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err 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 @@ -21121,7 +22185,6 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -21145,11 +22208,21 @@ strftime (); _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -21162,7 +22235,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_intl_strftime=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5 @@ -21189,7 +22263,6 @@ if test "$cross_compiling" = yes; then ac_cv_func_utime_null=no else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -21201,10 +22274,10 @@ main () { struct stat s, t; exit (!(stat ("conftest.data", &s) == 0 - && utime ("conftest.data", (long *)0) == 0 - && stat ("conftest.data", &t) == 0 - && t.st_mtime >= s.st_mtime - && t.st_mtime - s.st_mtime < 120)); + && utime ("conftest.data", (long *)0) == 0 + && stat ("conftest.data", &t) == 0 + && t.st_mtime >= s.st_mtime + && t.st_mtime - s.st_mtime < 120)); ; return 0; } @@ -21229,9 +22302,9 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_utime_null=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -f core core.* *.core +rm -f core *.core fi echo "$as_me:$LINENO: result: $ac_cv_func_utime_null" >&5 echo "${ECHO_T}$ac_cv_func_utime_null" >&6 @@ -21254,21 +22327,28 @@ 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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -21299,11 +22379,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -21316,7 +22406,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err 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 @@ -21331,21 +22422,28 @@ if test "${ac_cv_func__doprnt+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. */ +/* Define _doprnt to an innocuous variant, in case declares _doprnt. + For example, HP-UX 11i declares gettimeofday. */ +#define _doprnt innocuous__doprnt + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef _doprnt + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -21376,11 +22474,21 @@ return f != _doprnt; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -21393,7 +22501,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__doprnt=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 echo "${ECHO_T}$ac_cv_func__doprnt" >&6 @@ -21434,21 +22543,28 @@ 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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -21479,11 +22595,21 @@ return f != $ac_func; _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 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); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -21496,7 +22622,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err 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 @@ -21540,13 +22667,13 @@ _ACEOF # `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" + "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" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -21576,13 +22703,13 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # 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[ ]*=/{ + ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; +s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; -s/^[^=]*=[ ]*$//; +s/^[^=]*=[ ]*$//; }' fi @@ -21593,7 +22720,7 @@ 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$//'` + 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' @@ -21679,9 +22806,10 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -21700,7 +22828,7 @@ for as_var in \ 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 + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -21879,16 +23007,17 @@ rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p 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" +as_tr_cpp="eval 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" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -21915,7 +23044,7 @@ _ASBOX cat >&5 <<_CSEOF This file was extended by ntfsprogs $as_me 1.9.0, which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -21959,9 +23088,9 @@ Usage: $0 [OPTIONS] [FILE]... -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 + instantiate the configuration file FILE --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + instantiate the configuration header FILE Configuration files: $config_files @@ -21978,11 +23107,10 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ ntfsprogs config.status 1.9.0 -configured by $0, generated by GNU Autoconf 2.57, +configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 2003 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 @@ -22223,6 +23351,7 @@ 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,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t @@ -22305,9 +23434,9 @@ _ACEOF (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" + 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" + 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 @@ -22325,21 +23454,21 @@ 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,:.*,,'` ;; + 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=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # 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 || + 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; } @@ -22355,10 +23484,10 @@ echo X"$ac_file" | 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 || + 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; } @@ -22396,12 +23525,45 @@ case $srcdir in 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` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac case $INSTALL in @@ -22423,7 +23585,7 @@ echo "$as_me: creating $ac_file" >&6;} configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." + sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. @@ -22432,24 +23594,24 @@ echo "$as_me: creating $ac_file" >&6;} 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 + # 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;; + 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 + 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;; + fi;; esac done` || { (exit 1); exit 1; } _ACEOF @@ -22491,12 +23653,12 @@ cat >>$CONFIG_STATUS <<\_ACEOF # 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_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_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' @@ -22505,11 +23667,11 @@ 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 - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + 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=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac @@ -22523,28 +23685,29 @@ echo "$as_me: creating $ac_file" >&6;} 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 + # 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;; + # Do quote $f, to prevent DOS paths from being IFS'd. + 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 + 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;; + fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF @@ -22567,9 +23730,9 @@ s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +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 +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 @@ -22583,13 +23746,13 @@ rm -f confdef2sed.sed # 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.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +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 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 @@ -22598,7 +23761,7 @@ do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -22625,7 +23788,7 @@ do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -22659,10 +23822,10 @@ 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 || + 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; } @@ -22678,10 +23841,10 @@ echo X"$ac_file" | 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 || + 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; } @@ -22713,10 +23876,10 @@ for _am_header in $config_headers :; do 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 || + 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; } @@ -22735,16 +23898,41 @@ for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue 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 || + 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'` + { 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 @@ -22770,12 +23958,45 @@ case $srcdir in 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` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 @@ -22793,10 +24014,10 @@ echo "$as_me: executing $ac_dest commands" >&6;} 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 || + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -22832,10 +24053,10 @@ echo X"$mf" | 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 || + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -22851,10 +24072,10 @@ echo X"$file" | 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 || + 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; } diff --git a/configure.ac b/configure.ac index 82f3bc06..bc4459e1 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ # Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -AC_PREREQ(2.57) +AC_PREREQ(2.59) AC_INIT([ntfsprogs],[1.9.0],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) @@ -50,8 +50,8 @@ fi # Command-line options. AC_ARG_ENABLE(debug, - AC_HELP_STRING([--enable-debug],[enable additional debugging code and - output]), , + AS_HELP_STRING(--enable-debug,enable additional debugging code and + output), , enable_debug=no ) @@ -63,23 +63,22 @@ AH_TEMPLATE([NO_NTFS_DEVICE_DEFAULT_IO_OPS], but have to use ntfs_device_mount() and provide your own device operations.]) AC_ARG_ENABLE(default-device-io-ops, - AC_HELP_STRING([--disable-default-device-io-ops], - [do not provide default device io operations]), + AS_HELP_STRING(--disable-default-device-io-ops,do not provide default + device io operations), if test "$enable_default_device_io_ops" == "no"; then AC_DEFINE(NO_NTFS_DEVICE_DEFAULT_IO_OPS) fi, ) AC_ARG_ENABLE(gnome-vfs, - AC_HELP_STRING([--disable-gnome-vfs], - [omit Gnome-VFS-2.0 'libntfs' interface - (default=detect)]), , + AS_HELP_STRING(--disable-gnome-vfs,omit Gnome-VFS-2.0 'libntfs' + interface [default=detect]), , enable_gnome_vfs=auto ) AC_ARG_ENABLE(really-static, - AC_HELP_STRING([--enable-really-static],[create completely static - binaries for the utilities]), , + AS_HELP_STRING(--enable-really-static,create completely static + binaries for the utilities), , enable_really_static=no ) AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes) diff --git a/depcomp b/depcomp index aea3d007..9e5522d0 100755 --- a/depcomp +++ b/depcomp @@ -1,7 +1,9 @@ #! /bin/sh - # depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 2000 Free Software Foundation, Inc. + +scriptversion=2003-11-08.23 + +# Copyright (C) 1999, 2000, 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 @@ -25,6 +27,36 @@ # Originally written by Alexandre Oliva . +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit 0 + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit 0 + ;; +esac + if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 @@ -172,19 +204,25 @@ sgi) aix) # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. This file always lives in the current directory. - # Also, the AIX compiler puts `$object:' at the start of each line; - # $object doesn't have directory information. - stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" - outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi - stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + if test $stat -eq 0; then : else rm -f "$tmpdepfile" @@ -192,6 +230,7 @@ aix) fi if test -f "$tmpdepfile"; then + outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. @@ -278,8 +317,8 @@ tru64) fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a space and a tab in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi @@ -292,7 +331,7 @@ tru64) dashmstdout) # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o. + # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. @@ -388,7 +427,7 @@ makedepend) cpp) # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout. + # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. @@ -430,7 +469,7 @@ cpp) msvisualcpp) # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, + # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " @@ -470,3 +509,12 @@ none) esac exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/doc/Makefile.in b/doc/Makefile.in index ec95f413..63ca48c2 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.6 from Makefile.am. +# Makefile.in generated by automake 1.8.2 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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. @@ -13,7 +13,6 @@ # PARTICULAR PURPOSE. @SET_MAKE@ - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -21,7 +20,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -36,6 +34,18 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ +subdir = doc +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ @@ -135,6 +145,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -157,21 +168,38 @@ EXTRA_DIST = \ system_files.txt \ system_security_descriptors.txt -subdir = doc -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -DIST_COMMON = Makefile.am Makefile.in all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh mostlyclean-libtool: -rm -f *.lo @@ -188,10 +216,6 @@ TAGS: ctags: CTAGS CTAGS: -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @@ -205,7 +229,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -223,7 +247,6 @@ distdir: $(DISTFILES) check-am: all-am check: check-am all-am: Makefile - installdirs: install: install-am install-exec: install-exec-am @@ -236,7 +259,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -244,7 +267,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -254,13 +277,15 @@ clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am - + -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool dvi: dvi-am dvi-am: +html: html-am + info: info-am info-am: @@ -276,7 +301,7 @@ install-man: installcheck-am: maintainer-clean: maintainer-clean-am - + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am @@ -295,10 +320,10 @@ uninstall-am: uninstall-info-am .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-strip installcheck \ - installcheck-am installdirs maintainer-clean \ + dvi-am html html-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-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 diff --git a/include/Makefile.in b/include/Makefile.in index b08add4a..680fe65f 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.6 from Makefile.am. +# Makefile.in generated by automake 1.8.2 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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. @@ -13,7 +13,6 @@ # PARTICULAR PURPOSE. @SET_MAKE@ - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -21,7 +20,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -36,6 +34,27 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ +subdir = include +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ @@ -135,6 +154,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -147,28 +167,38 @@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ SUBDIRS = ntfs -subdir = include -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = Makefile.am Makefile.in -DIST_SUBDIRS = $(SUBDIRS) all: all-recursive .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu include/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh mostlyclean-libtool: -rm -f *.lo @@ -239,14 +269,6 @@ ctags-recursive: test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -255,6 +277,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique +tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -280,7 +303,6 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique - ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -303,10 +325,6 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @@ -320,7 +338,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -337,13 +355,13 @@ distdir: $(DISTFILES) done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ @@ -353,7 +371,6 @@ check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: - install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -365,7 +382,7 @@ install-am: all-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -373,7 +390,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -383,7 +400,7 @@ clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive - + -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags @@ -391,6 +408,8 @@ dvi: dvi-recursive dvi-am: +html: html-recursive + info: info-recursive info-am: @@ -406,7 +425,7 @@ install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive - + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive @@ -425,22 +444,18 @@ uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive ctags \ +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am \ - dvi-recursive info info-am info-recursive install install-am \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-recursive install-strip installcheck installcheck-am \ - installdirs installdirs-am installdirs-recursive \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ - pdf-recursive ps ps-am ps-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-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-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am # 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. diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 514ffa37..92fdf3b8 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.6 from Makefile.am. +# Makefile.in generated by automake 1.8.2 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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. @@ -21,7 +21,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -36,6 +35,24 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ +subdir = include/ntfs +DIST_COMMON = $(linux_ntfsinclude_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +am__installdirs = $(DESTDIR)$(linux_ntfsincludedir) +linux_ntfsincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(linux_ntfsinclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ @@ -135,6 +152,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -146,7 +164,6 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ - linux_ntfsincludedir = $(includedir)/ntfs linux_ntfsinclude_HEADERS = \ attrib.h \ @@ -174,23 +191,38 @@ linux_ntfsinclude_HEADERS = \ unistr.h \ volume.h -subdir = include/ntfs -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -HEADERS = $(linux_ntfsinclude_HEADERS) - -DIST_COMMON = $(linux_ntfsinclude_HEADERS) Makefile.am Makefile.in all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/ntfs/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu include/ntfs/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh mostlyclean-libtool: -rm -f *.lo @@ -201,10 +233,9 @@ clean-libtool: distclean-libtool: -rm -f libtool uninstall-info-am: -linux_ntfsincludeHEADERS_INSTALL = $(INSTALL_HEADER) install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(linux_ntfsincludedir) + $(mkdir_p) $(DESTDIR)$(linux_ntfsincludedir) @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ @@ -220,14 +251,6 @@ uninstall-linux_ntfsincludeHEADERS: rm -f $(DESTDIR)$(linux_ntfsincludedir)/$$f; \ done -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -236,6 +259,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique +tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -250,7 +274,6 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique - ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -273,10 +296,6 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @@ -290,7 +309,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -308,9 +327,8 @@ distdir: $(DISTFILES) check-am: all-am check: check-am all-am: Makefile $(HEADERS) - installdirs: - $(mkinstalldirs) $(DESTDIR)$(linux_ntfsincludedir) + $(mkdir_p) $(DESTDIR)$(linux_ntfsincludedir) install: install-am install-exec: install-exec-am install-data: install-data-am @@ -322,7 +340,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -330,7 +348,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -340,7 +358,7 @@ clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am - + -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags @@ -348,6 +366,8 @@ dvi: dvi-am dvi-am: +html: html-am + info: info-am info-am: @@ -363,7 +383,7 @@ install-man: installcheck-am: maintainer-clean: maintainer-clean-am - + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am @@ -382,14 +402,14 @@ uninstall-am: uninstall-info-am uninstall-linux_ntfsincludeHEADERS .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean distclean-generic \ - distclean-libtool distclean-tags 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-linux_ntfsincludeHEADERS install-man install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-info-am \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-linux_ntfsincludeHEADERS install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am \ uninstall-linux_ntfsincludeHEADERS # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/install-sh b/install-sh index 6ce63b9f..040ebc88 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,8 @@ #!/bin/sh -# # install - install a program, script, or datafile -# + +scriptversion=2004-01-12.10 + # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. @@ -41,13 +42,11 @@ # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. - # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" - # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" @@ -59,236 +58,253 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" -transformbasename="" -transform_arg="" +transformbasename= +transform_arg= instcmd="$mvprog" chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" +chowncmd= +chgrpcmd= +stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" -src="" -dst="" -dir_arg="" +src= +dst= +dir_arg= -while [ x"$1" != x ]; do - case $1 in - -c) instcmd=$cpprog - shift - continue;; +usage="Usage: $0 [OPTION]... SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 -d DIRECTORIES... - -d) dir_arg=true - shift - continue;; +In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. +In the second, create the directory path DIR. - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; +Options: +-b=TRANSFORMBASENAME +-c copy source (using $cpprog) instead of moving (using $mvprog). +-d create directories instead of installing files. +-g GROUP $chgrp installed files to GROUP. +-m MODE $chmod installed files to MODE. +-o USER $chown installed files to USER. +-s strip installed files (using $stripprog). +-t=TRANSFORM +--help display this help and exit. +--version display version info and exit. - -o) chowncmd="$chownprog $2" - shift - shift - continue;; +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; +while test -n "$1"; do + case $1 in + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; - -s) stripcmd=$stripprog - shift - continue;; + -c) instcmd=$cpprog + shift + continue;; - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; + -d) dir_arg=true + shift + continue;; - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; + --help) echo "$usage"; exit 0;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + --version) echo "$0 $scriptversion"; exit 0;; + + *) # When -d is used, all remaining arguments are directories to create. + test -n "$dir_arg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + instcmd=: + chmodcmd= + else + instcmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$instcmd $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + test -d "$pathcomp" || $mkdirprog "$pathcomp" + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $instcmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + # If we're going to rename the final executable, determine the name now. + if test -z "$transformarg"; then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename \ + | sed $transformarg`$transformbasename + fi + + # don't allow the sed command to completely eliminate the filename. + test -z "$dstfile" && dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Move or copy the file name to the temp name + $doit $instcmd "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $instcmd $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now remove or move aside any old file at destination location. We + # try this two ways since rm can't unlink itself on some systems and + # the destination file might be busy for other reasons. In this case, + # the final cleanup might fail but the new file should still install + # successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + fi || { (exit 1); exit; } done -if [ x"$src" = x ] -then - echo "$0: no input file specified" >&2 - exit 1 -else - : -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d "$dst" ]; then - instcmd=: - chmodcmd="" - else - instcmd=$mkdirprog - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f "$src" ] || [ -d "$src" ] - then - : - else - echo "$0: $src does not exist" >&2 - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "$0: no destination specified" >&2 - exit 1 - else - : - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d "$dst" ] - then - dst=$dst/`basename "$src"` - else - : - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' - ' -IFS="${IFS-$defaultIFS}" - -oIFS=$IFS -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS=$oIFS - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp=$pathcomp$1 - shift - - if [ ! -d "$pathcomp" ] ; - then - $mkdirprog "$pathcomp" - else - : - fi - - pathcomp=$pathcomp/ -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd "$dst" && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename "$dst"` - else - dstfile=`basename "$dst" $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename "$dst"` - else - : - fi - -# Make a couple of temp file names in the proper directory. - - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - -# Trap to clean up temp files at exit. - - trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 - trap '(exit $?); exit' 1 2 13 15 - -# Move or copy the file name to the temp name - - $doit $instcmd "$src" "$dsttmp" && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && - -# Now remove or move aside any old file at destination location. We try this -# two ways since rm can't unlink itself on some systems and the destination -# file might be busy for other reasons. In this case, the final cleanup -# might fail but the new file should still install successfully. - -{ - if [ -f "$dstdir/$dstfile" ] - then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || - $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || - { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi -} && - -# Now rename the file to the real destination. - - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - -fi && - # The final little trick to "correctly" pass the exit status to the exit trap. - { - (exit 0); exit + (exit 0); exit } + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 44d7d713..0f1340c9 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.6 from Makefile.am. +# Makefile.in generated by automake 1.8.2 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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. @@ -41,6 +41,9 @@ # - If the interface is the same as the previous version, change to C:R+1:A # + +SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) + srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -48,7 +51,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -63,6 +65,62 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ +subdir = libntfs +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/libntfs-gnomevfs.8.in $(srcdir)/libntfs.conf.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = libntfs.conf libntfs-gnomevfs.8 +am__installdirs = $(DESTDIR)$(gnomevfsmoduleslibdir) $(DESTDIR)$(libdir) $(DESTDIR)$(man8dir) $(DESTDIR)$(gnomevfsmodulesconfdir) +gnomevfsmoduleslibLTLIBRARIES_INSTALL = $(INSTALL) +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(gnomevfsmoduleslib_LTLIBRARIES) $(lib_LTLIBRARIES) +libntfs_gnomevfs_la_DEPENDENCIES = libntfs.la +am_libntfs_gnomevfs_la_OBJECTS = \ + libntfs_gnomevfs_la-gnome-vfs-method.lo \ + libntfs_gnomevfs_la-gnome-vfs-module.lo +libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) +libntfs_la_LIBADD = +am_libntfs_la_OBJECTS = attrib.lo bitmap.lo bootsect.lo compat.lo \ + compress.lo debug.lo device.lo device_io.lo dir.lo inode.lo \ + lcnalloc.lo mft.lo mst.lo runlist.lo unistr.lo volume.lo +libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrib.Plo ./$(DEPDIR)/bitmap.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/bootsect.Plo ./$(DEPDIR)/compat.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/compress.Plo ./$(DEPDIR)/debug.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/device.Plo ./$(DEPDIR)/device_io.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/dir.Plo ./$(DEPDIR)/inode.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/lcnalloc.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/mft.Plo ./$(DEPDIR)/mst.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/runlist.Plo ./$(DEPDIR)/unistr.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/volume.Plo +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) +DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) +man8dir = $(mandir)/man8 +NROFF = nroff +MANS = $(man_MANS) +gnomevfsmodulesconfDATA_INSTALL = $(INSTALL_DATA) +DATA = $(gnomevfsmodulesconf_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ @@ -162,6 +220,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -173,12 +232,9 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ - LTVERSION_LIBNTFS = 5:0:0 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 - linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs - lib_LTLIBRARIES = libntfs.la libntfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS) libntfs_la_SOURCES = \ @@ -199,13 +255,10 @@ libntfs_la_SOURCES = \ unistr.c \ volume.c - @ENABLE_GNOME_VFS_TRUE@gnomevfsmoduleslibdir = $(libdir)/gnome-vfs-2.0/modules @ENABLE_GNOME_VFS_TRUE@gnomevfsmoduleslib_LTLIBRARIES = libntfs-gnomevfs.la - @ENABLE_GNOME_VFS_TRUE@gnomevfsmodulesconfdir = $(sysconfdir)/gnome-vfs-2.0/modules @ENABLE_GNOME_VFS_TRUE@gnomevfsmodulesconf_DATA = libntfs.conf - libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS_GNOMEVFS) libntfs_gnomevfs_la_LIBADD = libntfs.la libntfs_gnomevfs_la_LIBS = $(LIBNTFS_GNOMEVFS_LIBS) @@ -214,77 +267,49 @@ libntfs_gnomevfs_la_SOURCES = \ gnome-vfs-method.c \ gnome-vfs-module.c - man_MANS = libntfs-gnomevfs.8 - AM_CPPFLAGS = $(linux_ntfsincludedir) $(all_includes) - EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in -subdir = libntfs -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = libntfs.conf libntfs-gnomevfs.8 -LTLIBRARIES = $(gnomevfsmoduleslib_LTLIBRARIES) $(lib_LTLIBRARIES) - -libntfs_gnomevfs_la_DEPENDENCIES = libntfs.la -am_libntfs_gnomevfs_la_OBJECTS = libntfs_gnomevfs_la-gnome-vfs-method.lo \ - libntfs_gnomevfs_la-gnome-vfs-module.lo -libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) -libntfs_la_LIBADD = -am_libntfs_la_OBJECTS = attrib.lo bitmap.lo bootsect.lo compat.lo \ - compress.lo debug.lo device.lo device_io.lo dir.lo inode.lo \ - lcnalloc.lo mft.lo mst.lo runlist.lo unistr.lo volume.lo -libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrib.Plo ./$(DEPDIR)/bitmap.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/bootsect.Plo ./$(DEPDIR)/compat.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/compress.Plo ./$(DEPDIR)/debug.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/device.Plo ./$(DEPDIR)/device_io.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/dir.Plo ./$(DEPDIR)/inode.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/lcnalloc.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/mft.Plo ./$(DEPDIR)/mst.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/runlist.Plo ./$(DEPDIR)/unistr.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/volume.Plo -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) - -NROFF = nroff -MANS = $(man_MANS) -DATA = $(gnomevfsmodulesconf_DATA) - -DIST_COMMON = Makefile.am Makefile.in libntfs-gnomevfs.8.in \ - libntfs.conf.in -SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) - all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libntfs/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu libntfs/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -libntfs.conf: $(top_builddir)/config.status libntfs.conf.in +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +libntfs.conf: $(top_builddir)/config.status $(srcdir)/libntfs.conf.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -libntfs-gnomevfs.8: $(top_builddir)/config.status libntfs-gnomevfs.8.in +libntfs-gnomevfs.8: $(top_builddir)/config.status $(srcdir)/libntfs-gnomevfs.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -gnomevfsmoduleslibLTLIBRARIES_INSTALL = $(INSTALL) install-gnomevfsmoduleslibLTLIBRARIES: $(gnomevfsmoduleslib_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(gnomevfsmoduleslibdir) + $(mkdir_p) $(DESTDIR)$(gnomevfsmoduleslibdir) @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f="`echo $$p | sed -e 's|^.*/||'`"; \ @@ -309,10 +334,9 @@ clean-gnomevfsmoduleslibLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libLTLIBRARIES_INSTALL = $(INSTALL) install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libdir) + $(mkdir_p) $(DESTDIR)$(libdir) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f="`echo $$p | sed -e 's|^.*/||'`"; \ @@ -343,7 +367,7 @@ libntfs.la: $(libntfs_la_OBJECTS) $(libntfs_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libntfs_la_LDFLAGS) $(libntfs_la_OBJECTS) $(libntfs_la_LIBADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @@ -367,103 +391,73 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unistr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volume.Plo@am__quote@ -distclean-depend: - -rm -rf ./$(DEPDIR) - .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libntfs_gnomevfs_la-gnome-vfs-method.o: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.o -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" \ -@am__fastdepCC_TRUE@ -c -o libntfs_gnomevfs_la-gnome-vfs-method.o `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.o -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.o `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.o `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c libntfs_gnomevfs_la-gnome-vfs-method.obj: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.obj -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" \ -@am__fastdepCC_TRUE@ -c -o libntfs_gnomevfs_la-gnome-vfs-method.obj `if test -f 'gnome-vfs-method.c'; then $(CYGPATH_W) 'gnome-vfs-method.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-method.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.obj -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.obj `if test -f 'gnome-vfs-method.c'; then $(CYGPATH_W) 'gnome-vfs-method.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-method.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.obj `if test -f 'gnome-vfs-method.c'; then $(CYGPATH_W) 'gnome-vfs-method.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-method.c'; fi` libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" \ -@am__fastdepCC_TRUE@ -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPlo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c libntfs_gnomevfs_la-gnome-vfs-module.o: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.o -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" \ -@am__fastdepCC_TRUE@ -c -o libntfs_gnomevfs_la-gnome-vfs-module.o `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.o -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.o `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.o `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c libntfs_gnomevfs_la-gnome-vfs-module.obj: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.obj -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" \ -@am__fastdepCC_TRUE@ -c -o libntfs_gnomevfs_la-gnome-vfs-module.obj `if test -f 'gnome-vfs-module.c'; then $(CYGPATH_W) 'gnome-vfs-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-module.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.obj -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.obj `if test -f 'gnome-vfs-module.c'; then $(CYGPATH_W) 'gnome-vfs-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-module.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.obj `if test -f 'gnome-vfs-module.c'; then $(CYGPATH_W) 'gnome-vfs-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-module.c'; fi` libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" \ -@am__fastdepCC_TRUE@ -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPlo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @@ -478,11 +472,9 @@ clean-libtool: distclean-libtool: -rm -f libtool uninstall-info-am: - -man8dir = $(mandir)/man8 install-man8: $(man8_MANS) $(man_MANS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(man8dir) + $(mkdir_p) $(DESTDIR)$(man8dir) @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ @@ -525,10 +517,9 @@ uninstall-man8: echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \ rm -f $(DESTDIR)$(man8dir)/$$inst; \ done -gnomevfsmodulesconfDATA_INSTALL = $(INSTALL_DATA) install-gnomevfsmodulesconfDATA: $(gnomevfsmodulesconf_DATA) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(gnomevfsmodulesconfdir) + $(mkdir_p) $(DESTDIR)$(gnomevfsmodulesconfdir) @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ @@ -544,14 +535,6 @@ uninstall-gnomevfsmodulesconfDATA: rm -f $(DESTDIR)$(gnomevfsmodulesconfdir)/$$f; \ done -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -560,6 +543,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique +tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -574,7 +558,6 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique - ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -597,10 +580,6 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @@ -614,7 +593,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -632,9 +611,8 @@ distdir: $(DISTFILES) check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(MANS) $(DATA) - installdirs: - $(mkinstalldirs) $(DESTDIR)$(gnomevfsmoduleslibdir) $(DESTDIR)$(libdir) $(DESTDIR)$(man8dir) $(DESTDIR)$(gnomevfsmodulesconfdir) + $(mkdir_p) $(DESTDIR)$(gnomevfsmoduleslibdir) $(DESTDIR)$(libdir) $(DESTDIR)$(man8dir) $(DESTDIR)$(gnomevfsmodulesconfdir) install: install-am install-exec: install-exec-am install-data: install-data-am @@ -646,7 +624,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -654,7 +632,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -665,14 +643,17 @@ clean-am: clean-generic clean-gnomevfsmoduleslibLTLIBRARIES \ clean-libLTLIBRARIES clean-libtool mostlyclean-am distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-libtool distclean-tags + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags dvi: dvi-am dvi-am: +html: html-am + info: info-am info-am: @@ -689,7 +670,8 @@ install-man: install-man8 installcheck-am: maintainer-clean: maintainer-clean-am - + -rm -rf ./$(DEPDIR) + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am @@ -714,17 +696,17 @@ uninstall-man: uninstall-man8 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-gnomevfsmoduleslibLTLIBRARIES clean-libLTLIBRARIES \ clean-libtool ctags distclean distclean-compile \ - distclean-depend distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-gnomevfsmodulesconfDATA \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-gnomevfsmodulesconfDATA \ install-gnomevfsmoduleslibLTLIBRARIES install-info \ - install-info-am install-libLTLIBRARIES install-man install-man8 \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-gnomevfsmodulesconfDATA \ + install-info-am install-libLTLIBRARIES install-man \ + install-man8 install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-gnomevfsmodulesconfDATA \ uninstall-gnomevfsmoduleslibLTLIBRARIES uninstall-info-am \ uninstall-libLTLIBRARIES uninstall-man uninstall-man8 diff --git a/ltmain.sh b/ltmain.sh index 8bf1b20b..5eb4c3a3 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -55,8 +55,8 @@ modename="$progname" # Constants. PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5 -TIMESTAMP=" (1.1220.2.1 2003/04/14 22:48:00)" +VERSION=1.5.2 +TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08)" default_mode= help="Try \`$progname --help' for more information." @@ -70,8 +70,8 @@ rm="rm -f" Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' # test EBCDIC or ASCII -case `echo A|od -x` in - *[Cc]1*) # EBCDIC based system +case `echo A|tr A '\301'` in + A) # EBCDIC based system SP2NL="tr '\100' '\n'" NL2SP="tr '\r\n' '\100\100'" ;; @@ -94,7 +94,8 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -: ${IFS=" "} +: ${IFS=" +"} if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -176,6 +177,7 @@ do ;; tag) tagname="$arg" + preserve_args="${preserve_args}=$arg" # Check whether tagname contains only valid characters case $tagname in @@ -238,6 +240,7 @@ do --debug) $echo "$progname: enabling shell trace mode" set -x + preserve_args="$preserve_args $arg" ;; --dry-run | -n) @@ -268,6 +271,7 @@ do --quiet | --silent) show=: + preserve_args="$preserve_args $arg" ;; --tag) prevopt="--tag" prev=tag ;; @@ -275,6 +279,7 @@ do set tag "$optarg" ${1+"$@"} shift prev=tag + preserve_args="$preserve_args --tag" ;; -dlopen) @@ -369,9 +374,11 @@ if test -z "$show_help"; then # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes suppress_output= arg_mode=normal libobj= + later= for arg do @@ -400,18 +407,13 @@ if test -z "$show_help"; then continue ;; - -static) - build_old_libs=yes + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" continue ;; - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no + -no-suppress) + suppress_opt=no continue ;; @@ -556,6 +558,25 @@ if test -z "$show_help"; then esac fi + for arg in $later; do + case $arg in + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -722,7 +743,9 @@ pic_object='$objdir/$objname' EOF # Allow error messages only from the first compilation. - suppress_output=' >/dev/null 2>&1' + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi else # No PIC object so indicate it doesn't exist in the libtool # object file. @@ -835,7 +858,7 @@ EOF ;; esac libtool_args="$nonopt" - base_compile="$nonopt" + base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" @@ -867,6 +890,7 @@ EOF no_install=no objs= non_pic_objects= + precious_files_regex= prefer_static_libs=no preload=no prev= @@ -880,6 +904,47 @@ EOF vinfo= vinfo_number=no + # Infer tagged configuration to use if any are available and + # if one wasn't chosen via the "--tag" command line option. + # Only attempt this if the compiler in the base link + # command doesn't match the default compiler. + if test -n "$available_tags" && test -z "$tagname"; then + case $base_compile in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" + case $base_compile in + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) + # The compiler in $compile_command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit 1 +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi + # We need to know -static, to get the right output filenames. for arg do @@ -911,7 +976,6 @@ EOF # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg="$1" - base_compile="$base_compile $arg" shift case $arg in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") @@ -990,6 +1054,11 @@ EOF prev= continue ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; release) release="-$arg" prev= @@ -1287,6 +1356,11 @@ EOF continue ;; + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + deplibs="$deplibs $arg" + continue + ;; + -module) module=yes continue @@ -1351,6 +1425,11 @@ EOF -o) prev=output ;; + -precious-files-regex) + prev=precious_regex + continue + ;; + -release) prev=release continue @@ -1619,47 +1698,6 @@ EOF exit 1 fi - # Infer tagged configuration to use if any are available and - # if one wasn't chosen via the "--tag" command line option. - # Only attempt this if the compiler in the base link - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case $base_compile in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in $compile_command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" @@ -1802,6 +1840,15 @@ EOF lib= found=no case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + fi + continue + ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 @@ -1813,12 +1860,18 @@ EOF fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - # Search the libtool library - lib="$searchdir/lib${name}.la" - if test -f "$lib"; then - found=yes - break - fi + for search_ext in .la $shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library @@ -2279,9 +2332,10 @@ EOF else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" + cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -2292,9 +2346,10 @@ EOF if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" + cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -2352,7 +2407,7 @@ EOF if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) - add_dir="-L$inst_prefix_dir$libdir $add_dir" + add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi @@ -2424,7 +2479,7 @@ EOF if test -n "$inst_prefix_dir"; then case "$libdir" in [\\/]*) - add_dir="-L$inst_prefix_dir$libdir $add_dir" + add_dir="$add_dir -L$inst_prefix_dir$libdir" ;; esac fi @@ -2568,9 +2623,13 @@ EOF if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" fi - newlib_search_path="$newlib_search_path $path" - path="" + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac fi + path="" ;; *) path="-L$path" @@ -3038,6 +3097,10 @@ EOF *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi removelist="$removelist $p" ;; *) ;; @@ -3547,10 +3610,11 @@ EOF $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" + cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" if len=`expr "X$cmd" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then $show "$cmd" @@ -3667,19 +3731,23 @@ EOF # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval cmds=\"$module_expsym_cmds\" + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds else - eval cmds=\"$module_cmds\" + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds else - eval cmds=\"$archive_cmds\" + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds fi fi - if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` && + if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else @@ -3764,6 +3832,7 @@ EOF save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3780,19 +3849,28 @@ EOF # value of $libobjs for piecewise linking. # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi else - eval cmds=\"$archive_cmds\" + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi fi # Append the command to remove the reloadable object files # to the just-reset $cmds. - eval cmds=\"\$cmds~$rm $delfiles\" + eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3943,10 +4021,11 @@ EOF reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" - eval cmds=\"$reload_cmds\" + cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3979,10 +4058,11 @@ EOF # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" - eval cmds=\"$reload_cmds\" + cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4954,13 +5034,13 @@ fi\ # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" + cmds=$old_archive_from_new_cmds else eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : + cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts $echo "using piecewise archive linking..." @@ -5012,12 +5092,13 @@ fi\ if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else - eval cmds=\"\$concat_cmds~$old_archive_cmds\" + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do + eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? @@ -5049,9 +5130,11 @@ fi\ fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command="(cd `pwd`; $SHELL $0 $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - + if test "$hardcode_automatic" = yes ; then + relink_command= + fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do @@ -5099,6 +5182,25 @@ fi\ newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin @@ -5414,10 +5516,11 @@ relink_command=\"$relink_command\"" # Do each command in the postinstall commands. lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" + cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -5569,12 +5672,14 @@ relink_command=\"$relink_command\"" if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` || - tmpdir="$tmpdir/libtool-$$" - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + if tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`; then : else - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue + tmpdir="$tmpdir/libtool-$$" + if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" @@ -5631,16 +5736,17 @@ relink_command=\"$relink_command\"" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? - if test -n "$stripme" && test -n "$striplib"; then + if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" + cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -5654,7 +5760,7 @@ relink_command=\"$relink_command\"" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $0 --finish$current_libdirs' + exec_cmd='$SHELL $0 $preserve_args --finish$current_libdirs' else exit 0 fi @@ -5675,10 +5781,11 @@ relink_command=\"$relink_command\"" for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" + cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" @@ -5952,10 +6059,11 @@ relink_command=\"$relink_command\"" if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" + cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then @@ -5967,10 +6075,11 @@ relink_command=\"$relink_command\"" if test -n "$old_library"; then # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" + cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" if test "$?" -ne 0 && test "$rmforce" != yes; then @@ -6215,6 +6324,8 @@ The following components of LINK-COMMAND are treated specially: -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries diff --git a/missing b/missing index 6a37006e..e7ef83a1 100755 --- a/missing +++ b/missing @@ -1,6 +1,10 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. + +scriptversion=2003-09-02.23 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 +# Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -38,12 +42,23 @@ else configure_ac=configure.in fi +msg="missing on your system" + case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi ;; esac @@ -74,11 +89,13 @@ Supported PROGRAM values: lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.4 - GNU automake" + echo "missing $scriptversion (GNU Automake)" ;; -*) @@ -94,7 +111,7 @@ Supported PROGRAM values: fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." @@ -108,7 +125,7 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." @@ -122,7 +139,7 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." @@ -146,7 +163,7 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." @@ -162,10 +179,10 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the proper tools for further handling them. - You can get \`$1Help2man' as part of \`Autoconf' from any GNU + You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` @@ -185,7 +202,7 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your bison|yacc) echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." @@ -215,7 +232,7 @@ WARNING: \`$1' is missing on your system. You should only need it if lex|flex) echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." @@ -243,7 +260,7 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." @@ -268,7 +285,7 @@ WARNING: \`$1' is missing on your system. You should only need it if fi echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if +WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, @@ -323,10 +340,10 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments. *) echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequirements for installing + it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 @@ -334,3 +351,10 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your esac exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/mkinstalldirs b/mkinstalldirs index d2d5f21b..6504b744 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -1,20 +1,32 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman + +scriptversion=2003-11-08.23 + +# Original author: Noah Friedman # Created: 1993-05-16 -# Public domain +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to or send patches to +# . errstatus=0 dirmode="" usage="\ -Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... + +Create each directory DIR (with mode MODE, if specified), including all +leading file name components. + +Report bugs to ." # process command line arguments while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help - echo "$usage" 1>&2 + echo "$usage" exit 0 ;; -m) # -m PERM arg @@ -23,6 +35,10 @@ while test $# -gt 0 ; do dirmode=$1 shift ;; + --version) + echo "$0 $scriptversion" + exit 0 + ;; --) # stop option processing shift break @@ -55,12 +71,25 @@ case $dirmode in if mkdir -p -- . 2>/dev/null; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" + else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + test -d ./-p && rmdir ./-p + test -d ./-- && rmdir ./-- fi ;; *) if mkdir -m "$dirmode" -p -- . 2>/dev/null; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" + else + # Clean up after NextStep and OpenStep mkdir. + for d in ./-m ./-p ./-- "./$dirmode"; + do + test -d $d && rmdir $d + done fi ;; esac @@ -84,17 +113,17 @@ do mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then - errstatus=$lasterr + errstatus=$lasterr else - if test ! -z "$dirmode"; then + if test ! -z "$dirmode"; then echo "chmod $dirmode $pathcomp" - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi fi fi @@ -107,5 +136,8 @@ exit $errstatus # Local Variables: # mode: shell-script # sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" # End: -# mkinstalldirs ends here diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 9ab31413..fcfcbf1e 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.6 from Makefile.am. +# Makefile.in generated by automake 1.8.2 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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. @@ -14,6 +14,8 @@ @SET_MAKE@ +SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) + srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -21,7 +23,6 @@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 @@ -36,6 +37,127 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : host_triplet = @host@ +bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ + ntfsls$(EXEEXT) ntfscat$(EXEEXT) +sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ + ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) +EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) dumplog$(EXEEXT) \ + ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) +subdir = ntfsprogs +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/mkntfs.8.in $(srcdir)/ntfscat.8.in \ + $(srcdir)/ntfsclone.8.in $(srcdir)/ntfscluster.8.in \ + $(srcdir)/ntfsfix.8.in $(srcdir)/ntfsinfo.8.in \ + $(srcdir)/ntfslabel.8.in $(srcdir)/ntfsls.8.in \ + $(srcdir)/ntfsprogs.8.in $(srcdir)/ntfsresize.8.in \ + $(srcdir)/ntfsundelete.8.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ + ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 \ + ntfsresize.8 ntfsundelete.8 +am__installdirs = $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir) +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) +am_dumplog_OBJECTS = dumplog.$(OBJEXT) +dumplog_OBJECTS = $(am_dumplog_OBJECTS) +@REALLYSTATIC_FALSE@am__DEPENDENCIES_1 = \ +@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@am__DEPENDENCIES_1 = \ +@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +dumplog_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ + sd.$(OBJEXT) mkntfs.$(OBJEXT) utils.$(OBJEXT) +mkntfs_OBJECTS = $(am_mkntfs_OBJECTS) +mkntfs_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfscat_OBJECTS = ntfscat.$(OBJEXT) utils.$(OBJEXT) +ntfscat_OBJECTS = $(am_ntfscat_OBJECTS) +ntfscat_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfsclone_OBJECTS = ntfsclone.$(OBJEXT) utils.$(OBJEXT) +ntfsclone_OBJECTS = $(am_ntfsclone_OBJECTS) +ntfsclone_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) cluster.$(OBJEXT) \ + utils.$(OBJEXT) +ntfscluster_OBJECTS = $(am_ntfscluster_OBJECTS) +ntfscluster_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) +ntfsdump_logfile_OBJECTS = $(am_ntfsdump_logfile_OBJECTS) +ntfsdump_logfile_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) +ntfsfix_OBJECTS = $(am_ntfsfix_OBJECTS) +ntfsfix_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) utils.$(OBJEXT) +ntfsinfo_OBJECTS = $(am_ntfsinfo_OBJECTS) +ntfsinfo_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) utils.$(OBJEXT) +ntfslabel_OBJECTS = $(am_ntfslabel_OBJECTS) +ntfslabel_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfsls_OBJECTS = ntfsls.$(OBJEXT) utils.$(OBJEXT) +ntfsls_OBJECTS = $(am_ntfsls_OBJECTS) +ntfsls_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfsmove_OBJECTS = ntfsmove.$(OBJEXT) utils.$(OBJEXT) +ntfsmove_OBJECTS = $(am_ntfsmove_OBJECTS) +ntfsmove_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) utils.$(OBJEXT) +ntfsresize_OBJECTS = $(am_ntfsresize_OBJECTS) +ntfsresize_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) \ + utils.$(OBJEXT) +ntfstruncate_OBJECTS = $(am_ntfstruncate_OBJECTS) +ntfstruncate_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) +ntfsundelete_OBJECTS = $(am_ntfsundelete_OBJECTS) +ntfsundelete_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) +ntfswipe_OBJECTS = $(am_ntfswipe_OBJECTS) +ntfswipe_DEPENDENCIES = $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrdef.Po ./$(DEPDIR)/boot.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/cluster.Po ./$(DEPDIR)/dumplog.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/mkntfs.Po ./$(DEPDIR)/ntfscat.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsclone.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfscluster.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsdump_logfile.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsfix.Po ./$(DEPDIR)/ntfsinfo.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfslabel.Po ./$(DEPDIR)/ntfsls.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsmove.Po ./$(DEPDIR)/ntfsresize.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfstruncate.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsundelete.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfswipe.Po ./$(DEPDIR)/sd.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/upcase.Po ./$(DEPDIR)/utils.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ + $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) \ + $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ + $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ + $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) \ + $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ + $(ntfswipe_SOURCES) +DIST_SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ + $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) \ + $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ + $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ + $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) \ + $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ + $(ntfswipe_SOURCES) +man8dir = $(mandir)/man8 +NROFF = nroff +MANS = $(man_MANS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ @@ -135,6 +257,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ prefix = @prefix@ program_transform_name = @program_transform_name@ @@ -146,274 +269,130 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LFLAGS = -static +@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) +@REALLYSTATIC_TRUE@AM_LFLAGS = -static @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ @REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ # Workaround to make REALLYSTATIC work with automake 1.5. LINK = $(STATIC_LINK) $(LIBTOOL_LINK) - -bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat -sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfsmove - man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ ntfsclone.8 ntfscluster.8 ntfscat.8 EXTRA_MANS = - CLEANFILES = $(EXTRA_PROGRAMS) - linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs # Set the include path. AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs $(all_includes) - ntfsfix_SOURCES = ntfsfix.c ntfsfix_LDADD = $(AM_LIBS) ntfsfix_LDFLAGS = $(AM_LFLAGS) - mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c utils.c utils.h mkntfs_LDADD = $(AM_LIBS) mkntfs_LDFLAGS = $(AM_LFLAGS) - ntfslabel_SOURCES = ntfslabel.c utils.c utils.h ntfslabel_LDADD = $(AM_LIBS) ntfslabel_LDFLAGS = $(AM_LFLAGS) - ntfsinfo_SOURCES = ntfsinfo.c utils.c utils.h ntfsinfo_LDADD = $(AM_LIBS) ntfsinfo_LDFLAGS = $(AM_LFLAGS) - ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h utils.c utils.h ntfsundelete_LDADD = $(AM_LIBS) ntfsundelete_LDFLAGS = $(AM_LFLAGS) - ntfsresize_SOURCES = ntfsresize.c utils.c utils.h ntfsresize_LDADD = $(AM_LIBS) ntfsresize_LDFLAGS = $(AM_LFLAGS) - ntfsclone_SOURCES = ntfsclone.c utils.c utils.h ntfsclone_LDADD = $(AM_LIBS) ntfsclone_LDFLAGS = $(AM_LFLAGS) - ntfscluster_SOURCES = ntfscluster.c ntfscluster.h cluster.c cluster.h utils.c utils.h ntfscluster_LDADD = $(AM_LIBS) ntfscluster_LDFLAGS = $(AM_LFLAGS) - ntfsls_SOURCES = ntfsls.c utils.c utils.h ntfsls_LDADD = $(AM_LIBS) ntfsls_LDFLAGS = $(AM_LFLAGS) - ntfscat_SOURCES = ntfscat.c ntfscat.h utils.c utils.h ntfscat_LDADD = $(AM_LIBS) ntfscat_LDFLAGS = $(AM_LFLAGS) - # We don't distribute these ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) - ntfsmove_SOURCES = ntfsmove.c ntfsmove.h utils.c utils.h ntfsmove_LDADD = $(AM_LIBS) ntfsmove_LDFLAGS = $(AM_LFLAGS) - ntfswipe_SOURCES = ntfswipe.c ntfswipe.h utils.c utils.h ntfswipe_LDADD = $(AM_LIBS) ntfswipe_LDFLAGS = $(AM_LFLAGS) - ntfsdump_logfile_SOURCES = ntfsdump_logfile.c ntfsdump_logfile_LDADD = $(AM_LIBS) ntfsdump_logfile_LDFLAGS = $(AM_LFLAGS) - dumplog_SOURCES = dumplog.c dumplog_LDADD = $(AM_LIBS) dumplog_LDFLAGS = $(AM_LFLAGS) -subdir = ntfsprogs -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ - ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 \ - ntfsresize.8 ntfsundelete.8 -EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) dumplog$(EXEEXT) \ - ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) -bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ - ntfsls$(EXEEXT) ntfscat$(EXEEXT) -sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) ntfsundelete$(EXEEXT) \ - ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) - -am_dumplog_OBJECTS = dumplog.$(OBJEXT) -dumplog_OBJECTS = $(am_dumplog_OBJECTS) -@REALLYSTATIC_TRUE@dumplog_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@dumplog_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ - sd.$(OBJEXT) mkntfs.$(OBJEXT) utils.$(OBJEXT) -mkntfs_OBJECTS = $(am_mkntfs_OBJECTS) -@REALLYSTATIC_TRUE@mkntfs_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@mkntfs_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfscat_OBJECTS = ntfscat.$(OBJEXT) utils.$(OBJEXT) -ntfscat_OBJECTS = $(am_ntfscat_OBJECTS) -@REALLYSTATIC_TRUE@ntfscat_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfscat_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfsclone_OBJECTS = ntfsclone.$(OBJEXT) utils.$(OBJEXT) -ntfsclone_OBJECTS = $(am_ntfsclone_OBJECTS) -@REALLYSTATIC_TRUE@ntfsclone_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfsclone_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) cluster.$(OBJEXT) \ - utils.$(OBJEXT) -ntfscluster_OBJECTS = $(am_ntfscluster_OBJECTS) -@REALLYSTATIC_TRUE@ntfscluster_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfscluster_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) -ntfsdump_logfile_OBJECTS = $(am_ntfsdump_logfile_OBJECTS) -@REALLYSTATIC_TRUE@ntfsdump_logfile_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfsdump_logfile_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) -ntfsfix_OBJECTS = $(am_ntfsfix_OBJECTS) -@REALLYSTATIC_TRUE@ntfsfix_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfsfix_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) utils.$(OBJEXT) -ntfsinfo_OBJECTS = $(am_ntfsinfo_OBJECTS) -@REALLYSTATIC_TRUE@ntfsinfo_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfsinfo_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) utils.$(OBJEXT) -ntfslabel_OBJECTS = $(am_ntfslabel_OBJECTS) -@REALLYSTATIC_TRUE@ntfslabel_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfslabel_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfsls_OBJECTS = ntfsls.$(OBJEXT) utils.$(OBJEXT) -ntfsls_OBJECTS = $(am_ntfsls_OBJECTS) -@REALLYSTATIC_TRUE@ntfsls_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfsls_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfsmove_OBJECTS = ntfsmove.$(OBJEXT) utils.$(OBJEXT) -ntfsmove_OBJECTS = $(am_ntfsmove_OBJECTS) -@REALLYSTATIC_TRUE@ntfsmove_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfsmove_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) utils.$(OBJEXT) -ntfsresize_OBJECTS = $(am_ntfsresize_OBJECTS) -@REALLYSTATIC_TRUE@ntfsresize_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfsresize_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) \ - utils.$(OBJEXT) -ntfstruncate_OBJECTS = $(am_ntfstruncate_OBJECTS) -@REALLYSTATIC_TRUE@ntfstruncate_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfstruncate_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) -ntfsundelete_OBJECTS = $(am_ntfsundelete_OBJECTS) -@REALLYSTATIC_TRUE@ntfsundelete_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfsundelete_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la -am_ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) -ntfswipe_OBJECTS = $(am_ntfswipe_OBJECTS) -@REALLYSTATIC_TRUE@ntfswipe_DEPENDENCIES = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@ntfswipe_DEPENDENCIES = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrdef.Po ./$(DEPDIR)/boot.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/cluster.Po ./$(DEPDIR)/dumplog.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/mkntfs.Po ./$(DEPDIR)/ntfscat.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsclone.Po ./$(DEPDIR)/ntfscluster.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsdump_logfile.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsfix.Po ./$(DEPDIR)/ntfsinfo.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfslabel.Po ./$(DEPDIR)/ntfsls.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsmove.Po ./$(DEPDIR)/ntfsresize.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfstruncate.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsundelete.Po ./$(DEPDIR)/ntfswipe.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/sd.Po ./$(DEPDIR)/upcase.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/utils.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -DIST_SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ - $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) \ - $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ - $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ - $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) \ - $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ - $(ntfswipe_SOURCES) - -NROFF = nroff -MANS = $(man_MANS) -DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfscat.8.in \ - ntfsclone.8.in ntfscluster.8.in ntfsfix.8.in ntfsinfo.8.in \ - ntfslabel.8.in ntfsls.8.in ntfsprogs.8.in ntfsresize.8.in \ - ntfsundelete.8.in -SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) - all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ntfsprogs/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu ntfsprogs/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -mkntfs.8: $(top_builddir)/config.status mkntfs.8.in +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +mkntfs.8: $(top_builddir)/config.status $(srcdir)/mkntfs.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfscat.8: $(top_builddir)/config.status ntfscat.8.in +ntfscat.8: $(top_builddir)/config.status $(srcdir)/ntfscat.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsclone.8: $(top_builddir)/config.status ntfsclone.8.in +ntfsclone.8: $(top_builddir)/config.status $(srcdir)/ntfsclone.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfscluster.8: $(top_builddir)/config.status ntfscluster.8.in +ntfscluster.8: $(top_builddir)/config.status $(srcdir)/ntfscluster.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsfix.8: $(top_builddir)/config.status ntfsfix.8.in +ntfsfix.8: $(top_builddir)/config.status $(srcdir)/ntfsfix.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsinfo.8: $(top_builddir)/config.status ntfsinfo.8.in +ntfsinfo.8: $(top_builddir)/config.status $(srcdir)/ntfsinfo.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfslabel.8: $(top_builddir)/config.status ntfslabel.8.in +ntfslabel.8: $(top_builddir)/config.status $(srcdir)/ntfslabel.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsls.8: $(top_builddir)/config.status ntfsls.8.in +ntfsls.8: $(top_builddir)/config.status $(srcdir)/ntfsls.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsprogs.8: $(top_builddir)/config.status ntfsprogs.8.in +ntfsprogs.8: $(top_builddir)/config.status $(srcdir)/ntfsprogs.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsresize.8: $(top_builddir)/config.status ntfsresize.8.in +ntfsresize.8: $(top_builddir)/config.status $(srcdir)/ntfsresize.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsundelete.8: $(top_builddir)/config.status ntfsundelete.8.in +ntfsundelete.8: $(top_builddir)/config.status $(srcdir)/ntfsundelete.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) + $(mkdir_p) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -439,10 +418,9 @@ clean-binPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done -sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(sbindir) + $(mkdir_p) $(DESTDIR)$(sbindir) @list='$(sbin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ @@ -515,7 +493,7 @@ ntfswipe$(EXEEXT): $(ntfswipe_OBJECTS) $(ntfswipe_DEPENDENCIES) $(LINK) $(ntfswipe_LDFLAGS) $(ntfswipe_OBJECTS) $(ntfswipe_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @@ -542,41 +520,29 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upcase.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ -distclean-depend: - -rm -rf ./$(DEPDIR) - .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -587,11 +553,9 @@ clean-libtool: distclean-libtool: -rm -f libtool uninstall-info-am: - -man8dir = $(mandir)/man8 install-man8: $(man8_MANS) $(man_MANS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(man8dir) + $(mkdir_p) $(DESTDIR)$(man8dir) @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ @@ -635,14 +599,6 @@ uninstall-man8: rm -f $(DESTDIR)$(man8dir)/$$inst; \ done -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -651,6 +607,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique +tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -665,7 +622,6 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique - ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -688,10 +644,6 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @@ -705,7 +657,7 @@ distdir: $(DISTFILES) dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -723,9 +675,8 @@ distdir: $(DISTFILES) check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(MANS) - installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir) + $(mkdir_p) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir) install: install-am install-exec: install-exec-am install-data: install-data-am @@ -737,7 +688,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -746,7 +697,7 @@ clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -757,14 +708,17 @@ clean-am: clean-binPROGRAMS clean-generic clean-libtool \ clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-libtool distclean-tags + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags dvi: dvi-am dvi-am: +html: html-am + info: info-am info-am: @@ -780,7 +734,8 @@ install-man: install-man8 installcheck-am: maintainer-clean: maintainer-clean-am - + -rm -rf ./$(DEPDIR) + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am @@ -803,15 +758,15 @@ uninstall-man: uninstall-man8 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-libtool clean-sbinPROGRAMS ctags distclean \ - distclean-compile distclean-depend distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am info \ - info-am install install-am install-binPROGRAMS install-data \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-man8 install-sbinPROGRAMS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-info-am uninstall-man \ uninstall-man8 uninstall-sbinPROGRAMS From 2612bb6d23091eb410d515ba35458467d9d7019c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 11 Mar 2004 15:33:34 +0000 Subject: [PATCH 1202/2994] Update with SuSE 9.1 beta 1 versions of GNU build system. BKrev: 405086cewPVETii5P8vmSiUjZLvjcw From ce30981faeaaaafa8fb9e50632b7bbdcb7c6e306 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 11 Mar 2004 15:38:01 +0000 Subject: [PATCH 1203/2994] Start 1.9.1-WIP. (Logical change 1.323) --- configure | 20 ++++++++++---------- configure.ac | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 5f5292c5..c3046224 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.0. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.1-WIP. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.9.0' -PACKAGE_STRING='ntfsprogs 1.9.0' +PACKAGE_VERSION='1.9.1-WIP' +PACKAGE_STRING='ntfsprogs 1.9.1-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -955,7 +955,7 @@ 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 ntfsprogs 1.9.0 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.9.1-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1022,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.9.0:";; + short | recursive ) echo "Configuration of ntfsprogs 1.9.1-WIP:";; esac cat <<\_ACEOF @@ -1170,7 +1170,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.9.0 +ntfsprogs configure 1.9.1-WIP generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1184,7 +1184,7 @@ 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 ntfsprogs $as_me 1.9.0, which was +It was created by ntfsprogs $as_me 1.9.1-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1904,7 +1904,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.9.0' + VERSION='1.9.1-WIP' cat >>confdefs.h <<_ACEOF @@ -23043,7 +23043,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.9.0, which was +This file was extended by ntfsprogs $as_me 1.9.1-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23106,7 +23106,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.9.0 +ntfsprogs config.status 1.9.1-WIP configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index bc4459e1..7d8343d0 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.9.0],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.9.1-WIP],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) From 08d8066f75bd5f83bb74fda8d0dd9ff3910c8389 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 11 Mar 2004 15:38:01 +0000 Subject: [PATCH 1204/2994] Start 1.9.1-WIP. BKrev: 405087d9hHp4JUJh1WQ25b7T_eobZw From c553f499775723a25d007c0f6d747f8095bed4f9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 11 Mar 2004 15:38:01 +0000 Subject: [PATCH 1205/2994] Update (Logical change 1.323) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index e094aa83..51393312 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +xx/xx/2004 - 1.9.1-WIP + - Update with SuSE 9.1 beta 1 versions of GNU build system. + 11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef HAVE_CONFIG_H. (Suggested by Christophe.) From e14c9479ce56162a15f08cdda73128ac6f589b85 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 12 Mar 2004 09:30:03 +0000 Subject: [PATCH 1206/2994] Update (Logical change 1.324) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 51393312..cdefd09c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ xx/xx/2004 - 1.9.1-WIP - Update with SuSE 9.1 beta 1 versions of GNU build system. + - Fix warnings on powerpc architecture where it would seem char is + unsigned so comparisons with -1 cause a warning that comparison is + always true/wrong. (Thanks to Ender for reporting.) 11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From 9193cb62985ea8261b56618bdc1dc235d3bbe0e9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 12 Mar 2004 09:30:03 +0000 Subject: [PATCH 1207/2994] Update Fix warnings on powerpc architecture where it would seem char is unsigned so comparisons with -1 cause a warning that comparison is always true/wrong. (Thanks to Ender for reporting.) (Logical change 1.324) --- ntfsprogs/ntfscat.c | 2 +- ntfsprogs/ntfsclone.c | 2 +- ntfsprogs/ntfscluster.c | 2 +- ntfsprogs/ntfsinfo.c | 2 +- ntfsprogs/ntfsls.c | 2 +- ntfsprogs/ntfsresize.c | 2 +- ntfsprogs/ntfsundelete.c | 17 ++++++++++------- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 727cc98e..ba793716 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -120,7 +120,7 @@ int parse_options (int argc, char **argv) opts.inode = -1; opts.attr = -1; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!opts.device) { diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 8d0f8adc..89603df6 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -217,7 +217,7 @@ static void parse_options(int argc, char **argv) memset(&opt, 0, sizeof(opt)); - while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (opt.volume) diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index e80f7af2..3b278a8a 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -126,7 +126,7 @@ int parse_options (int argc, char **argv) opts.range_begin = -1; opts.range_end = -1; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!opts.device) { diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index bdab9eb0..37ef08bf 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -153,7 +153,7 @@ int parse_options (int argc, char *argv[]) opts.inode = -1; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 'd': /* A non-option argument */ if (!opts.device) { diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 9e2a186d..00310f96 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -144,7 +144,7 @@ int parse_options(int argc, char *argv[]) opts.device = NULL; opts.path = "/"; - while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 'd': opts.device = optarg; diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index d503c497..4b33a055 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -389,7 +389,7 @@ static int parse_options(int argc, char **argv) memset(&opt, 0, sizeof(opt)); opt.show_progress = 1; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!err && !opt.volume) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index c3244e73..eace377e 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -302,7 +302,7 @@ int parse_options (int argc, char *argv[]) opts.percent = -1; opts.fillbyte = -1; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!opts.device) { @@ -313,7 +313,7 @@ int parse_options (int argc, char *argv[]) } break; case 'b': - if (opts.fillbyte == -1) { + if (opts.fillbyte == (char)-1) { end = NULL; opts.fillbyte = strtol (optarg, &end, 0); if (end && *end) @@ -444,7 +444,8 @@ int parse_options (int argc, char *argv[]) switch (opts.mode) { case MODE_SCAN: - if (opts.output || opts.dest || (opts.fillbyte != -1)) { + if (opts.output || opts.dest || + (opts.fillbyte != (char)-1)) { Eprintf ("Scan can only be used with --percent, " "--match, --ignore-case, --size and --time.\n"); err++; @@ -463,9 +464,11 @@ int parse_options (int argc, char *argv[]) } break; case MODE_COPY: - if ((opts.fillbyte != -1) || (opts.percent != -1) || - opts.match || opts.match_case || - (opts.size_begin > 0) || (opts.size_end > 0)) { + if ((opts.fillbyte != (char)-1) || + (opts.percent != -1) || + opts.match || opts.match_case || + (opts.size_begin > 0) || + (opts.size_end > 0)) { Eprintf ("Copy can only be used with --output and --destination.\n"); err++; } @@ -491,7 +494,7 @@ int parse_options (int argc, char *argv[]) } } - if (opts.fillbyte == -1) + if (opts.fillbyte == (char)-1) opts.fillbyte = 0; if (ver) From 54fddf28aa361816c142381495214096ccf4bc57 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 12 Mar 2004 09:30:03 +0000 Subject: [PATCH 1208/2994] Update Fix warnings on powerpc architecture where it would seem char is unsigned so comparisons with -1 cause a warning that comparison is always true/wrong. (Thanks to Ender for reporting.) BKrev: 4051831bqIU4RTqyE7g6tqfLL1lm1Q From c70036ff300c7292b2811cc87e37e5df08f682c4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 12 Mar 2004 09:41:02 +0000 Subject: [PATCH 1209/2994] Update to SuSE 9.1 pkgconfig. (Logical change 1.325) --- aclocal.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index 0811dfda..bb528c71 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -5923,7 +5923,7 @@ AC_MSG_RESULT([$SED]) dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN(PKG_CHECK_MODULES, [ +AC_DEFUN([PKG_CHECK_MODULES], [ succeeded=no if test -z "$PKG_CONFIG"; then From e09b28c9b379f0472f7dc45106bbfc295abef642 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 12 Mar 2004 09:41:02 +0000 Subject: [PATCH 1210/2994] Update to SuSE 9.1 pkgconfig. BKrev: 405185aeyVTIis9_wEhv_rY8MKxUJw From cb3b41894ac59a8a5087157c27f28dd830bcf9f6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 12 Mar 2004 15:50:52 +0000 Subject: [PATCH 1211/2994] Modify meaning of ntfs_volume->nr_mft_records to be the number of initialized mft records, not total mft records. This makes far more sense and in fact reflects how nr_mft_records is being used in both libntfs and the utilities. (Logical change 1.326) --- include/ntfs/volume.h | 5 +++-- libntfs/mft.c | 23 +++++++++++++--------- libntfs/volume.c | 4 ++-- ntfsprogs/ntfscluster.c | 42 ++++++++++++++++++++--------------------- ntfsprogs/ntfsinfo.c | 2 +- 5 files changed, 41 insertions(+), 35 deletions(-) diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index feeabdab..b401362b 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -136,8 +136,9 @@ struct _ntfs_volume { lcn 0 and so on. A set bit means that the cluster and vice versa. */ - s64 nr_mft_records; /* Number of records in the mft, equals the - number of bits in mft_bitmap. */ + s64 nr_mft_records; /* Number of initialized records in the mft, + equals the number of bits in mft_bitmap that + may be set. */ LCN mft_lcn; /* Logical cluster number of the data attribute for FILE_MFT. */ ntfs_inode *mft_ni; /* ntfs_inode structure for FILE_MFT. */ diff --git a/libntfs/mft.c b/libntfs/mft.c index 31785b73..1edac6bd 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -49,6 +49,10 @@ * @b. Return 0 on success or -1 on error, with errno set to the error * code. * + * If any of the records exceed the initialized size of the $MFT/$DATA + * attribute, i.e. they cannot possibly be allocated mft records, assume this + * is a bug and return error code ESPIPE. + * * The read mft records are mst deprotected and are hence ready to use. The * caller should check each record with is_baad_record() in case mst * deprotection failed. @@ -67,6 +71,7 @@ int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref, return -1; } m = MREF(mref); + /* Refuse to read non-allocated mft records. */ if (m + count > vol->nr_mft_records) { errno = ESPIPE; return -1; @@ -95,6 +100,10 @@ int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref, * Write @count mft records starting at @mref from data buffer @b to volume * @vol. Return 0 on success or -1 on error, with errno set to the error code. * + * If any of the records exceed the initialized size of the $MFT/$DATA + * attribute, i.e. they cannot possibly be allocated mft records, assume this + * is a bug and return error code ESPIPE. + * * Before the mft records are written, they are mst protected. After the write, * they are deprotected again, thus resulting in an increase in the update * sequence number inside the data buffer @b. @@ -119,6 +128,11 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, return -1; } m = MREF(mref); + /* Refuse to write non-allocated mft records. */ + if (m + count > vol->nr_mft_records) { + errno = ESPIPE; + return -1; + } if (m < vol->mftmirr_size) { cnt = vol->mftmirr_size - m; if (cnt > count) @@ -128,14 +142,6 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, return -1; memcpy(bmirr, b, cnt * vol->mft_record_size); } - if (m + count > vol->nr_mft_records) { - // TODO: Need to extend $MFT. This is not just normal attribute - // extension as many rules need to be observed. (AIA) - if (bmirr) - free(bmirr); - errno = ENOTSUP; - return -1; - } bw = ntfs_attr_mst_pwrite(vol->mft_na, m << vol->mft_record_size_bits, count, vol->mft_record_size, b); if (bw != count) { @@ -335,4 +341,3 @@ sync_rollback: errno = err; return -1; } - diff --git a/libntfs/volume.c b/libntfs/volume.c index eccf56d3..a6e675da 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -218,8 +218,8 @@ mft_has_no_attr_list: Dperror("Failed to open ntfs attribute"); goto error_exit; } - /* Set the number of mft records. */ - vol->nr_mft_records = vol->mft_na->data_size >> + /* Set the number of initialized mft records. */ + vol->nr_mft_records = vol->mft_na->initialized_size >> vol->mft_record_size_bits; /* Read all extents from the $DATA attribute in $MFT. */ ntfs_attr_reinit_search_ctx(ctx); diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 3b278a8a..bb6dbad6 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -327,27 +327,27 @@ int info (ntfs_volume *vol) t = mc >> cb; u = mc * 100 / b / e; - printf ("bytes per sector : %llu\n", (unsigned long long)a); - printf ("bytes per cluster : %llu\n", (unsigned long long)b); - printf ("sectors per cluster : %llu\n", (unsigned long long)c); - printf ("bytes per volume : %llu\n", (unsigned long long)d); - printf ("sectors per volume : %llu\n", (unsigned long long)e); - printf ("clusters per volume : %llu\n", (unsigned long long)f); - printf ("mft records total : %llu\n", (unsigned long long)g); - printf ("mft records in use : %llu\n", (unsigned long long)h); - printf ("mft records percentage : %llu\n", (unsigned long long)i); - printf ("bytes of free space : %llu\n", (unsigned long long)j); - printf ("sectors of free space : %llu\n", (unsigned long long)k); - printf ("clusters of free space : %llu\n", (unsigned long long)l); - printf ("percentage free space : %llu\n", (unsigned long long)m); - printf ("bytes of user data : %llu\n", (unsigned long long)n); - printf ("sectors of user data : %llu\n", (unsigned long long)o); - printf ("clusters of user data : %llu\n", (unsigned long long)p); - printf ("percentage user data : %llu\n", (unsigned long long)q); - printf ("bytes of metadata : %llu\n", (unsigned long long)r); - printf ("sectors of metadata : %llu\n", (unsigned long long)s); - printf ("clusters of metadata : %llu\n", (unsigned long long)t); - printf ("percentage metadata : %llu\n", (unsigned long long)u); + printf ("bytes per sector : %llu\n", (unsigned long long)a); + printf ("bytes per cluster : %llu\n", (unsigned long long)b); + printf ("sectors per cluster : %llu\n", (unsigned long long)c); + printf ("bytes per volume : %llu\n", (unsigned long long)d); + printf ("sectors per volume : %llu\n", (unsigned long long)e); + printf ("clusters per volume : %llu\n", (unsigned long long)f); + printf ("initialized mft records : %llu\n", (unsigned long long)g); + printf ("mft records in use : %llu\n", (unsigned long long)h); + printf ("mft records percentage : %llu\n", (unsigned long long)i); + printf ("bytes of free space : %llu\n", (unsigned long long)j); + printf ("sectors of free space : %llu\n", (unsigned long long)k); + printf ("clusters of free space : %llu\n", (unsigned long long)l); + printf ("percentage free space : %llu\n", (unsigned long long)m); + printf ("bytes of user data : %llu\n", (unsigned long long)n); + printf ("sectors of user data : %llu\n", (unsigned long long)o); + printf ("clusters of user data : %llu\n", (unsigned long long)p); + printf ("percentage user data : %llu\n", (unsigned long long)q); + printf ("bytes of metadata : %llu\n", (unsigned long long)r); + printf ("sectors of metadata : %llu\n", (unsigned long long)s); + printf ("clusters of metadata : %llu\n", (unsigned long long)t); + printf ("percentage metadata : %llu\n", (unsigned long long)u); return 0; } diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 37ef08bf..245adfea 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -267,7 +267,7 @@ void ntfs_dump_volume(ntfs_volume *vol) (long long)vol->data1_zone_pos); printf("\tCurrent Position in Second Data Zone: %lld\n", (long long)vol->data2_zone_pos); - printf("\tNumber of Records in MFT: %lld\n", + printf("\tNumber of Initialized Records in MFT: %lld\n", (long long)vol->nr_mft_records); printf("\tLCN of Data Attribute for FILE_MFT: %lld\n", (long long)vol->mft_lcn); From 6276a27b774ee82742110dae9e3847ca23105267 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 12 Mar 2004 15:50:52 +0000 Subject: [PATCH 1212/2994] Modify meaning of ntfs_volume->nr_mft_records to be the number of initialized mft records, not total mft records. This makes far more sense and in fact reflects how nr_mft_records is being used in both libntfs and the utilities. BKrev: 4051dc5cII9Ej77Nwtp5gvjahGMMyA From a9d3049ded31f0d89f9856a565a4783e4cc9966f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 12 Mar 2004 15:50:52 +0000 Subject: [PATCH 1213/2994] Update (Logical change 1.326) --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index cdefd09c..77db42ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ xx/xx/2004 - 1.9.1-WIP - Fix warnings on powerpc architecture where it would seem char is unsigned so comparisons with -1 cause a warning that comparison is always true/wrong. (Thanks to Ender for reporting.) + - Modify meaning of ntfs_volume->nr_mft_records to be the number of + initialized mft records, not total mft records. This makes far more + sense and in fact reflects how nr_mft_records is being used in both + libntfs and the utilities. 11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From 3cfb4590eb5758244df4decde03b9bceb9c73636 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 12 Mar 2004 17:25:04 +0000 Subject: [PATCH 1214/2994] Provide new API functions: ntfs_bitmap_{set,clear}_bit(). (Logical change 1.327) --- include/ntfs/bitmap.h | 32 +++++++++++++++++++++++++++++--- libntfs/bitmap.c | 5 ++--- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/include/ntfs/bitmap.h b/include/ntfs/bitmap.h index 3f2694b2..c18aa43b 100644 --- a/include/ntfs/bitmap.h +++ b/include/ntfs/bitmap.h @@ -1,7 +1,7 @@ /* * bitmap.h - Exports for bitmap handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -46,7 +46,6 @@ static __inline__ void ntfs_bit_set(u8 *bitmap, const u64 bit, const u8 new_value) { -// Dprintf("bitmap %p, bit 0x%llx, new_value %i\n", bitmap, bit, new_value); if (!bitmap || new_value > 1) return; if (!new_value) @@ -103,5 +102,32 @@ static __inline__ char ntfs_bit_get_and_set(u8 *bitmap, const u64 bit, extern int ntfs_bitmap_set_run(ntfs_attr *na, s64 start_bit, s64 count); extern int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count); -#endif /* defined _NTFS_BITMAP_H */ +/** + * ntfs_bitmap_set_bit - set a bit in a bitmap + * @na: attribute containing the bitmap + * @bit: bit to set + * + * Set the @bit in the bitmap described by the attribute @na. + * + * On success return 0 and on error return -1 with errno set to the error code. + */ +static __inline__ int ntfs_bitmap_set_bit(ntfs_attr *na, s64 bit) +{ + return ntfs_bitmap_set_run(na, bit, 1); +} +/** + * ntfs_bitmap_clear_bit - clear a bit in a bitmap + * @na: attribute containing the bitmap + * @bit: bit to clear + * + * Clear @bit in the bitmap described by the attribute @na. + * + * On success return 0 and on error return -1 with errno set to the error code. + */ +static __inline__ int ntfs_bitmap_clear_bit(ntfs_attr *na, s64 bit) +{ + return ntfs_bitmap_clear_run(na, bit, 1); +} + +#endif /* defined _NTFS_BITMAP_H */ diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index 23c7807e..8eda13e0 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -43,8 +43,8 @@ * * On success return 0 and on error return -1 with errno set to the error code. */ -static int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, s64 count, - int value) +static __inline__ int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, + s64 count, int value) { s64 bufsize, br; u8 *buf, *lastbyte_buf; @@ -212,4 +212,3 @@ int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) { return ntfs_bitmap_set_bits_in_run(na, start_bit, count, 0); } - From 8b7d1e993495c0e27b7bec0488e7dee3b2be88ca Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 12 Mar 2004 17:25:04 +0000 Subject: [PATCH 1215/2994] Provide new API functions: ntfs_bitmap_{set,clear}_bit(). BKrev: 4051f270fGW0jp1WetRiozD-lMAA7Q From 63ecb1990cfb13d28eb42124ef55c85e114107b9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 12 Mar 2004 17:25:04 +0000 Subject: [PATCH 1216/2994] Update (Logical change 1.327) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 77db42ce..b3891135 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ xx/xx/2004 - 1.9.1-WIP initialized mft records, not total mft records. This makes far more sense and in fact reflects how nr_mft_records is being used in both libntfs and the utilities. + - Add new API bitmap.h::ntfs_bitmap_{set,clear}_bit(). 11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From a06a32695995aa87908288287bb2c399a088a142 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 13 Mar 2004 19:22:57 +0000 Subject: [PATCH 1217/2994] Fix layout.h STANDARD_INFORMATION and FILE_ATTR_FLAGS typedefs by adding the packed attribute where it was missing causing havoc due to 64 bit alignment. (Yuval Fledel) (Logical change 1.328) --- include/ntfs/layout.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 3216a718..7467b1e7 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -721,7 +721,7 @@ typedef enum { us whether this file has a view index present (eg. object id index, quota index, one of the security indexes or the encrypting file system related indexes). */ -} FILE_ATTR_FLAGS; +} __attribute__ ((__packed__)) FILE_ATTR_FLAGS; /* * NOTE on times in NTFS: All times are in MS standard time format, i.e. they @@ -813,8 +813,8 @@ typedef struct { partition. This, in contrast to disabling the journal is a very fast process, so the user won't even notice it. */ - }; - }; + } __attribute__ ((__packed__)); + } __attribute__ ((__packed__)); /* sizeof() = 72 bytes (NTFS 3.0) */ } __attribute__ ((__packed__)) STANDARD_INFORMATION; From 68b214894a70f1dc22b3f747433a6eb96509184b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 13 Mar 2004 19:22:57 +0000 Subject: [PATCH 1218/2994] Fix layout.h STANDARD_INFORMATION and FILE_ATTR_FLAGS typedefs by adding the packed attribute where it was missing causing havoc due to 64 bit alignment. (Yuval Fledel) BKrev: 40535f91lvgJaVPl6zIe8HGKEBt6UQ From abd576179f03176ca18c962641fd144bf211e388 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 13 Mar 2004 19:22:57 +0000 Subject: [PATCH 1219/2994] Update (Logical change 1.328) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index b3891135..797ac552 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,9 @@ xx/xx/2004 - 1.9.1-WIP sense and in fact reflects how nr_mft_records is being used in both libntfs and the utilities. - Add new API bitmap.h::ntfs_bitmap_{set,clear}_bit(). + - Fix layout.h STANDARD_INFORMATION and FILE_ATTR_FLAGS typedefs by + adding the packed attribute where it was missing causing havoc due + to 64 bit alignment. (Yuval Fledel) 11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From 49f8d5e364b704960b0ffddd86f89fd55eb223d4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 13 Mar 2004 19:30:28 +0000 Subject: [PATCH 1220/2994] Fix validation of STANDARD_INFORMATION attribute size in ntfsinfo.c and remove relevant FIXME comments. (Yuval Fledel) (Logical change 1.329) --- ntfsprogs/ntfsinfo.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 245adfea..0ae607ad 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -25,8 +25,7 @@ /* TODO LIST: * 1. Better error checking. In fact, my error checking sucks. * 2. Fix output issues. - * 3. Check on the 72/48 issue - * 4. Comment things better + * 3. Comment things better * * Still not dumping certain attributes. Need to find the best * way to output some of these attributes. @@ -321,6 +320,7 @@ void ntfs_dump_standard_information_attr(ntfs_inode *inode) STANDARD_INFORMATION *standard_attr = NULL; ATTR_RECORD *attr = NULL; ntfs_attr_search_ctx *ctx = NULL; + u32 value_length; ctx = ntfs_attr_get_search_ctx(inode, NULL); @@ -337,13 +337,13 @@ void ntfs_dump_standard_information_attr(ntfs_inode *inode) printf("Dumping $STANDARD_INFORMATION (0x10)\n"); - //check with flatcap/anton and make sure this is correct - if (sizeof(STANDARD_INFORMATION) == 48) { + value_length = le32_to_cpu(attr->value_length); + if (value_length == 48) { printf("\t$STANDARD_INFORMATION fields maximum_versions, version_number, \ class_id, owner_id, security_id missing. This volume has \ not been upgraded\n"); } - if (sizeof(STANDARD_INFORMATION) == 72) { + if (value_length == 72) { printf("\tMaximum Number of Versions: \t %u \n", le32_to_cpu(standard_attr->maximum_versions)); printf("\tVersion Number: \t\t %u \n", @@ -357,7 +357,7 @@ void ntfs_dump_standard_information_attr(ntfs_inode *inode) } else { printf("\tSize of STANDARD_INFORMATION is %u. It should be " "either 72 or 48, something is wrong...\n", - (unsigned)sizeof(STANDARD_INFORMATION)); + value_length); } ntfs_attr_put_search_ctx(ctx); //free ctx From 980d0b4c5c9e5eb33b28a30d2eb81656d8c139a2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 13 Mar 2004 19:30:28 +0000 Subject: [PATCH 1221/2994] Fix validation of STANDARD_INFORMATION attribute size in ntfsinfo.c and remove relevant FIXME comments. (Yuval Fledel) BKrev: 40536154-GAlc187fpX39WPxOgj9LQ From 205b4dc359278041aa14ddbff27a62450b14f1ab Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 13 Mar 2004 19:30:28 +0000 Subject: [PATCH 1222/2994] Update. (Logical change 1.329) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 797ac552..1a41f61c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,8 @@ xx/xx/2004 - 1.9.1-WIP - Fix layout.h STANDARD_INFORMATION and FILE_ATTR_FLAGS typedefs by adding the packed attribute where it was missing causing havoc due to 64 bit alignment. (Yuval Fledel) + - Fix validation of STANDARD_INFORMATION attribute size in ntfsinfo.c + and remove relevant FIXME comments. (Yuval Fledel) 11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From a0fdf1985f7278572eed1f896f46ddbabb5ab241 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 14 Mar 2004 18:04:17 +0000 Subject: [PATCH 1223/2994] (Logical change 1.330) --- include/ntfs/security.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/ntfs/security.h diff --git a/include/ntfs/security.h b/include/ntfs/security.h new file mode 100644 index 00000000..fc6b8ad0 --- /dev/null +++ b/include/ntfs/security.h @@ -0,0 +1,34 @@ +/* + * security.h - Exports for handling security/ACLs in NTFS. Part of the + * Linux-NTFS project. + * + * Copyright (c) 2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_SECURITY_H +#define _NTFS_SECURITY_H + +#include "types.h" +#include "layout.h" + +extern const GUID *const zero_guid; + +extern BOOL ntfs_guid_is_zero(const GUID *guid); +extern char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str); + +#endif /* defined _NTFS_SECURITY_H */ From a8f5ab126d93b58a7729aaa375f9712e412092d5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 14 Mar 2004 18:04:17 +0000 Subject: [PATCH 1224/2994] Add security.c to build. (Logical change 1.330) --- libntfs/Makefile.am | 1 + libntfs/Makefile.in | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 1a15a074..ff246f96 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -48,6 +48,7 @@ libntfs_la_SOURCES = \ mft.c \ mst.c \ runlist.c \ + security.c \ unistr.c \ volume.c diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 0f1340c9..3f706fa2 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -87,7 +87,8 @@ libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) libntfs_la_LIBADD = am_libntfs_la_OBJECTS = attrib.lo bitmap.lo bootsect.lo compat.lo \ compress.lo debug.lo device.lo device_io.lo dir.lo inode.lo \ - lcnalloc.lo mft.lo mst.lo runlist.lo unistr.lo volume.lo + lcnalloc.lo mft.lo mst.lo runlist.lo security.lo unistr.lo \ + volume.lo libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp @@ -101,8 +102,8 @@ am__depfiles_maybe = depfiles @AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/mft.Plo ./$(DEPDIR)/mst.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/runlist.Plo ./$(DEPDIR)/unistr.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/volume.Plo +@AMDEP_TRUE@ ./$(DEPDIR)/runlist.Plo ./$(DEPDIR)/security.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/unistr.Plo ./$(DEPDIR)/volume.Plo COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ @@ -252,6 +253,7 @@ libntfs_la_SOURCES = \ mft.c \ mst.c \ runlist.c \ + security.c \ unistr.c \ volume.c @@ -388,6 +390,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mft.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mst.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/security.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unistr.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volume.Plo@am__quote@ From 2324aa8e3fcd78b2d23f2e84e7724db57b24cec7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 14 Mar 2004 18:04:17 +0000 Subject: [PATCH 1225/2994] Add security.h to Makefile.*. (Logical change 1.330) --- include/ntfs/Makefile.am | 1 + include/ntfs/Makefile.in | 1 + 2 files changed, 2 insertions(+) diff --git a/include/ntfs/Makefile.am b/include/ntfs/Makefile.am index a89a340d..98869b88 100644 --- a/include/ntfs/Makefile.am +++ b/include/ntfs/Makefile.am @@ -21,6 +21,7 @@ linux_ntfsinclude_HEADERS = \ mft.h \ mst.h \ runlist.h \ + security.h \ support.h \ types.h \ unistr.h \ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 92fdf3b8..fec9b20c 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -186,6 +186,7 @@ linux_ntfsinclude_HEADERS = \ mft.h \ mst.h \ runlist.h \ + security.h \ support.h \ types.h \ unistr.h \ From 84db0e8dfb4767821bfcc96408cafe94803b972b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 14 Mar 2004 18:04:17 +0000 Subject: [PATCH 1226/2994] Initial revision --- include/ntfs/security.h | 34 ---------------------------------- libntfs/security.c | 0 2 files changed, 34 deletions(-) create mode 100644 libntfs/security.c diff --git a/include/ntfs/security.h b/include/ntfs/security.h index fc6b8ad0..e69de29b 100644 --- a/include/ntfs/security.h +++ b/include/ntfs/security.h @@ -1,34 +0,0 @@ -/* - * security.h - Exports for handling security/ACLs in NTFS. Part of the - * Linux-NTFS project. - * - * Copyright (c) 2004 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_SECURITY_H -#define _NTFS_SECURITY_H - -#include "types.h" -#include "layout.h" - -extern const GUID *const zero_guid; - -extern BOOL ntfs_guid_is_zero(const GUID *guid); -extern char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str); - -#endif /* defined _NTFS_SECURITY_H */ diff --git a/libntfs/security.c b/libntfs/security.c new file mode 100644 index 00000000..e69de29b From 802ed33475566634d6f125ac52af6b8c6adda753 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 14 Mar 2004 18:04:17 +0000 Subject: [PATCH 1227/2994] New file: security.c includes new API ntfs_guid_is_zero() and ntfs_guid_to_mbs(). 2004/03/14 17:38:29+00:00 cantab.net!aia21 (Logical change 1.330) --- libntfs/security.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/libntfs/security.c b/libntfs/security.c index e69de29b..e1f4113e 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -0,0 +1,97 @@ +/* + * security.c - Code for handling security/ACLs in NTFS. Part of the + * Linux-NTFS project. + * + * Copyright (c) 2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "types.h" +#include "layout.h" +#include "security.h" + +/* + * The zero GUID. + */ +static const GUID __zero_guid = { const_cpu_to_le32(0), const_cpu_to_le16(0), + const_cpu_to_le16(0), { 0, 0, 0, 0, 0, 0, 0, 0 } }; +const GUID *const zero_guid = &__zero_guid; + +/** + * ntfs_guid_is_zero - check if a GUID is zero + * @guid: guid to check + * + * Return TRUE if @guid is a valid pointer to a GUID and it is the zero GUID + * and FALSE otherwise. + */ +BOOL ntfs_guid_is_zero(const GUID *guid) +{ + return (memcmp(guid, zero_guid, sizeof(*zero_guid))); +} + +/** + * ntfs_guid_to_mbs - convert a GUID to a multi byte string + * @guid: guid to convert + * @guid_str: string in which to return the GUID (optional) + * + * Convert the GUID pointed to by @guid to a multi byte string of the form + * "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX". Therefore, @guid_str (if not NULL) + * needs to be able to store at least 37 bytes. + * + * If @guid_str is not NULL it will contain the converted GUID on return. If + * it is NULL a string will be allocated and this will be returned. The caller + * is responsible for free()ing the string in that case. + * + * On success return the converted string and on failure return NULL with errno + * set to the error code. + */ +char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str) +{ + char *_guid_str; + int res; + + if (!guid) { + errno = EINVAL; + return (char *)guid; + } + _guid_str = guid_str; + if (!_guid_str) { + _guid_str = malloc(37); + if (!_guid_str) + return _guid_str; + } + res = snprintf(_guid_str, 37, + "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", + le32_to_cpu(guid->data1), + le16_to_cpu(guid->data2), le16_to_cpu(guid->data3), + guid->data4[0], guid->data4[1], + guid->data4[2], guid->data4[3], guid->data4[4], + guid->data4[5], guid->data4[6], guid->data4[7]); + if (res == 36) + return _guid_str; + if (!guid_str) + free(_guid_str); + errno = EINVAL; + return NULL; +} From 90cc6f8e734c652ea475870b8412e4556cbe49a6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 14 Mar 2004 18:04:17 +0000 Subject: [PATCH 1228/2994] New files: security.[hc] include new API ntfs_guid_is_zero() and ntfs_guid_to_mbs(). BKrev: 40549ea1_tPbB3_FU1heEkOBr9qhKw From 8eca7085ec8f56abd6bbe9e5bac2ada8ff2a8757 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 14 Mar 2004 18:04:17 +0000 Subject: [PATCH 1229/2994] Update. (Logical change 1.330) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 1a41f61c..8c57d319 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ xx/xx/2004 - 1.9.1-WIP to 64 bit alignment. (Yuval Fledel) - Fix validation of STANDARD_INFORMATION attribute size in ntfsinfo.c and remove relevant FIXME comments. (Yuval Fledel) + - Add new API security.[hc]::ntfs_guid_is_zero() and ntfs_guid_to_mbs(). 11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From 95ab07c8233a84f0866ff144644d2bda4ed8e981 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 14 Mar 2004 18:29:21 +0000 Subject: [PATCH 1230/2994] Forgot to include security.h... 2004/03/14 18:22:33+00:00 cantab.net!aia21 Implement dumping of object id attribute. (Yuval Fledel, me) (Logical change 1.331) --- ntfsprogs/ntfsinfo.c | 76 +++++++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 25 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 0ae607ad..399bc1c5 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -55,6 +55,7 @@ #include "layout.h" #include "inode.h" #include "utils.h" +#include "security.h" static const char *EXEC_NAME = "ntfsinfo"; @@ -440,14 +441,13 @@ do_next: */ void ntfs_dump_object_id_attr(ntfs_inode *inode) { - - OBJECT_ID_ATTR *obj_id_attr = NULL; - ATTR_RECORD *attr = NULL; - ntfs_attr_search_ctx *ctx = NULL; + OBJECT_ID_ATTR *obj_id_attr = NULL; + ATTR_RECORD *attr = NULL; + ntfs_attr_search_ctx *ctx = NULL; - ctx = ntfs_attr_get_search_ctx(inode, NULL); + ctx = ntfs_attr_get_search_ctx(inode, NULL); - if(ntfs_attr_lookup(AT_OBJECT_ID, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (ntfs_attr_lookup(AT_OBJECT_ID, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { if (errno != ENOENT) fprintf(stderr, "ntfsinfo error: cannot look up " "attribute AT_OBJECT_ID: %s\n", @@ -456,30 +456,57 @@ void ntfs_dump_object_id_attr(ntfs_inode *inode) return; } - attr = ctx->attr; + attr = ctx->attr; - obj_id_attr = (OBJECT_ID_ATTR*)((char *)attr + le16_to_cpu(attr->value_offset)); //the attribute plus the offset + obj_id_attr = (OBJECT_ID_ATTR *)((u8*)attr + + le16_to_cpu(attr->value_offset)); - printf("Dumping $OBJECT_ID (0x40)\n"); + printf("Dumping $OBJECT_ID (0x40)\n"); - //I believe these attributes are only present on volume versions > 3.0. It was introduced - //in Win2k, which is 3.0 + if (inode->vol->major_ver >= 3.0) { + u32 value_length; + char printable_GUID[37]; - //FIXME: Need to do a check to make sure these attributes are actually present - //even if it is > 3.0. - if (inode->vol->major_ver >= 3.0) { - printf("\tVolume Version > 3.0... Dumping Attributes\n"); - - //printf("\tObject ID: \t\t\t %d\n", obj_id_attr->object_id); - //printf("\tBirth Volume ID: \t\t\t %d\n", obj_id_attr->birth_volume_id); - //printf("\tBirth Object ID: \t\t\t %d\n", obj_id_attr->birth_object_id); - } + printf("\tVolume Version >= 3.0... Dumping Attributes\n"); - else - printf("\t$OBJECT_ID not present. Only NTFS versions > 3.0 have $OBJECT_ID. \ - Your version of NTFS is %d\n", inode->vol->major_ver); + value_length = le32_to_cpu(attr->value_length); - ntfs_attr_put_search_ctx(ctx); + /* Object ID is mandatory. */ + ntfs_guid_to_mbs(&obj_id_attr->object_id, printable_GUID); + printf("\tObject ID:\t\t%s\n", printable_GUID); + + /* Dump Birth Volume ID. */ + if ((value_length > sizeof(GUID)) && !ntfs_guid_is_zero( + &obj_id_attr->birth_volume_id)) { + ntfs_guid_to_mbs(&obj_id_attr->birth_volume_id, + printable_GUID); + printf("\tBirth Volume ID:\t\t%s\n", printable_GUID); + } else + printf("\tBirth Volume ID:\tmissing\n"); + + /* Dumping Birth Object ID */ + if ((value_length > sizeof(GUID)) && !ntfs_guid_is_zero( + &obj_id_attr->birth_object_id)) { + ntfs_guid_to_mbs(&obj_id_attr->birth_object_id, + printable_GUID); + printf("\tBirth Object ID:\t\t%s\n", printable_GUID); + } else + printf("\tBirth Object ID:\tmissing\n"); + + /* Dumping Domain_id - reserved for now */ + if ((value_length > sizeof(GUID)) && !ntfs_guid_is_zero( + &obj_id_attr->domain_id)) { + ntfs_guid_to_mbs(&obj_id_attr->domain_id, + printable_GUID); + printf("\tDomain ID:\t\t\t%s\n", printable_GUID); + } else + printf("\tDomain ID:\t\tmissing\n"); + } else + printf("\t$OBJECT_ID not present. Only NTFS versions > 3.0 " + "have $OBJECT_ID. Your version of NTFS is " + "%d.\n", inode->vol->major_ver); + + ntfs_attr_put_search_ctx(ctx); } @@ -487,7 +514,6 @@ void ntfs_dump_object_id_attr(ntfs_inode *inode) * ntfs_dump_volume_name() * * dump the name of the volume the inode belongs to - * */ void ntfs_dump_volume_name_attr(ntfs_inode *inode) { From fb5ceff176bc12338d718e152a59338133803416 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 14 Mar 2004 18:29:21 +0000 Subject: [PATCH 1231/2994] Implement dumping of object id attribute in ntfsinfo. (Yuval Fledel, me) BKrev: 4054a481GkSbppqwY-UO-BMCdp7nRw From 161768d20584e1f4514e35cc24027cfa3d336db1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 14 Mar 2004 18:29:21 +0000 Subject: [PATCH 1232/2994] Update (Logical change 1.331) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 8c57d319..9037b8a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ xx/xx/2004 - 1.9.1-WIP - Fix validation of STANDARD_INFORMATION attribute size in ntfsinfo.c and remove relevant FIXME comments. (Yuval Fledel) - Add new API security.[hc]::ntfs_guid_is_zero() and ntfs_guid_to_mbs(). + - Implement dumping of object id in ntfsinfo. (Yuval Fledel, me) 11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From 481241602cbda23a294fa04ab518ea29657f3484 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 15 Mar 2004 10:54:47 +0000 Subject: [PATCH 1233/2994] Change ntfs_get_attribute_value syntax to not have the MFT_RECORD as it wasn't used anyway and the function is headed for death anyway... (Logical change 1.332) --- include/ntfs/attrib.h | 4 ++-- libntfs/attrib.c | 4 ++-- libntfs/inode.c | 2 +- libntfs/volume.c | 3 +-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 402694ce..57fcbb69 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -306,8 +306,8 @@ s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a); * then nothing was read due to a zero-length attribute value, otherwise * errno describes the error. */ -s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, - const ATTR_RECORD *a, u8 *b); +s64 ntfs_get_attribute_value(const ntfs_volume *vol, const ATTR_RECORD *a, + u8 *b); #endif /* defined _NTFS_ATTRIB_H */ diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 70a61ead..77b4c4a8 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -66,7 +66,7 @@ s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a) /** * ntfs_get_attribute_value */ -s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, +s64 ntfs_get_attribute_value(const ntfs_volume *vol, const ATTR_RECORD *a, u8 *b) { runlist *rl; @@ -74,7 +74,7 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, const MFT_RECORD *m, int i; /* Sanity checks. */ - if (!vol || !m || !a || !b) { + if (!vol || !a || !b) { errno = EINVAL; return 0; } diff --git a/libntfs/inode.c b/libntfs/inode.c index 22755339..f6dfceb3 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -148,7 +148,7 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) ni->attr_list = malloc(ni->attr_list_size); if (!ni->attr_list) goto put_err_out; - l = ntfs_get_attribute_value(vol, ni->mrec, ctx->attr, ni->attr_list); + l = ntfs_get_attribute_value(vol, ctx->attr, ni->attr_list); if (!l) goto put_err_out; if (l != ni->attr_list_size) { diff --git a/libntfs/volume.c b/libntfs/volume.c index a6e675da..8b1bdffc 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -187,8 +187,7 @@ static int ntfs_mft_load(ntfs_volume *vol) Dputs("Error: failed to allocate buffer for attribute list."); goto error_exit; } - l = ntfs_get_attribute_value(vol, vol->mft_ni->mrec, ctx->attr, - vol->mft_ni->attr_list); + l = ntfs_get_attribute_value(vol, ctx->attr, vol->mft_ni->attr_list); if (!l) { Dputs("Error: failed to get value of $MFT/$ATTRIBUTE_LIST."); goto io_error_exit; From 011ba54358b5109d314a49eb8a8cb5be48373190 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 15 Mar 2004 10:54:47 +0000 Subject: [PATCH 1234/2994] Change ntfs_get_attribute_value syntax to not have the MFT_RECORD as it wasn't used anyway and the function is headed for death anyway... BKrev: 40558b77Sl9p5QUBbikMJW929228Sg From a8ce4055bebfeeabfa186e9ec65f88aa6bdc692a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 15 Mar 2004 10:54:47 +0000 Subject: [PATCH 1235/2994] Update comment for ntfs_mft_record_get_data_size(). (Logical change 1.332) --- include/ntfs/mft.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/ntfs/mft.h b/include/ntfs/mft.h index d45ae7a8..e3f18e7a 100644 --- a/include/ntfs/mft.h +++ b/include/ntfs/mft.h @@ -82,16 +82,16 @@ static __inline__ int ntfs_mft_record_write(const ntfs_volume *vol, * @m: mft record to get the data size of * * Takes the mft record @m and returns the number of bytes used in the record - * or 0 on error (i.e. @m is not a valid mft record). Zero is not a valid size - * for an mft record as it at least has to have the MFT_RECORD, thus making the - * minimum size: - * (sizeof(MFT_RECORD) + 7) & ~7 + sizeof(ATTR_TYPES) = 52 bytes - * Aside: The 8-byte alignment and the 4 bytes for the attribute type are needed - * as each mft record has to have a list of attributes even if it only contains - * the attribute $END which doesn't contain anything else apart from its type. - * Also, you would expect every mft record to contain an update sequence array - * as well but that could in theory be non-existent (don't know if Windows' - * NTFS driver/chkdsk wouldn't view this as corruption in itself though). + * or 0 on error (i.e. @m is not a valid mft record). Zero is not a valid size + * for an mft record as it at least has to have the MFT_RECORD itself and a + * zero length attribute of type AT_END, thus making the minimum size 56 bytes. + * + * Aside: The size is independent of NTFS versions 1.x/3.x because the 8-byte + * alignment of the first attribute mask the difference in MFT_RECORD size + * between NTFS 1.x and 3.x. Also, you would expect every mft record to + * contain an update sequence array as well but that could in theory be + * non-existent (don't know if Windows' NTFS driver/chkdsk wouldn't view this + * as corruption in itself though). */ static __inline__ u32 ntfs_mft_record_get_data_size(const MFT_RECORD *m) { From 14658c8c43ee2b9e41f86fb8dd5561ef3deb48c3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 15 Mar 2004 11:34:30 +0000 Subject: [PATCH 1236/2994] Copy MFT_RECORD typedef to MFT_RECORD_OLD and modify MFT_RECORD to contain the NTFS 3.1+ specific fields. Also, update mkntfs and ntfsclone appropriately. (Logical change 1.333) --- ChangeLog | 3 ++ include/ntfs/layout.h | 74 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 73 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9037b8a8..96f61754 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,9 @@ xx/xx/2004 - 1.9.1-WIP and remove relevant FIXME comments. (Yuval Fledel) - Add new API security.[hc]::ntfs_guid_is_zero() and ntfs_guid_to_mbs(). - Implement dumping of object id in ntfsinfo. (Yuval Fledel, me) + - Copy MFT_RECORD typedef to MFT_RECORD_OLD and modify MFT_RECORD to + contain the NTFS 3.1+ specific fields. Also, update mkntfs and + ntfsclone appropriately. 11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 7467b1e7..178741aa 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -344,10 +344,9 @@ typedef struct { record is reused this number is set to zero. NOTE: The first instance number is always 0. */ -/* sizeof() = 42 bytes */ -/* NTFS 3.1+ (Windows XP and above) introduce the following additions. */ -/* 42*/ //u16 reserved; /* Reserved/alignment. */ -/* 44*/ //u32 mft_record_number; /* Number of this mft record. */ +/* The below fields are specific to NTFS 3.1+ (Windows XP and above): */ +/* 42*/ u16 reserved; /* Reserved/alignment. */ +/* 44*/ u32 mft_record_number; /* Number of this mft record. */ /* sizeof() = 48 bytes */ /* * When (re)using the mft record, we place the update sequence array at this @@ -360,6 +359,73 @@ typedef struct { */ } __attribute__ ((__packed__)) MFT_RECORD; +/* This is the version without the NTFS 3.1+ specific fields. */ +typedef struct { +/*Ofs*/ +/* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ + NTFS_RECORD_TYPES magic;/* Usually the magic is "FILE". */ + u16 usa_ofs; /* See NTFS_RECORD definition above. */ + u16 usa_count; /* See NTFS_RECORD definition above. */ + +/* 8*/ u64 lsn; /* $LogFile sequence number for this record. + Changed every time the record is modified. */ +/* 16*/ u16 sequence_number; /* Number of times this mft record has been + reused. (See description for MFT_REF + above.) NOTE: The increment (skipping zero) + is done when the file is deleted. NOTE: If + this is zero it is left zero. */ +/* 18*/ u16 link_count; /* Number of hard links, i.e. the number of + directory entries referencing this record. + NOTE: Only used in mft base records. + NOTE: When deleting a directory entry we + check the link_count and if it is 1 we + delete the file. Otherwise we delete the + FILE_NAME_ATTR being referenced by the + directory entry from the mft record and + decrement the link_count. + FIXME: Careful with Win32 + DOS names! */ +/* 20*/ u16 attrs_offset; /* Byte offset to the first attribute in this + mft record from the start of the mft record. + NOTE: Must be aligned to 8-byte boundary. */ +/* 22*/ MFT_RECORD_FLAGS flags; /* Bit array of MFT_RECORD_FLAGS. When a file + is deleted, the MFT_RECORD_IN_USE flag is + set to zero. */ +/* 24*/ u32 bytes_in_use; /* Number of bytes used in this mft record. + NOTE: Must be aligned to 8-byte boundary. */ +/* 28*/ u32 bytes_allocated; /* Number of bytes allocated for this mft + record. This should be equal to the mft + record size. */ +/* 32*/ MFT_REF base_mft_record; /* This is zero for base mft records. + When it is not zero it is a mft reference + pointing to the base mft record to which + this record belongs (this is then used to + locate the attribute list attribute present + in the base record which describes this + extension record and hence might need + modification when the extension record + itself is modified, also locating the + attribute list also means finding the other + potential extents, belonging to the non-base + mft record). */ +/* 40*/ u16 next_attr_instance; /* The instance number that will be + assigned to the next attribute added to this + mft record. NOTE: Incremented each time + after it is used. NOTE: Every time the mft + record is reused this number is set to zero. + NOTE: The first instance number is always 0. + */ +/* sizeof() = 42 bytes */ +/* + * When (re)using the mft record, we place the update sequence array at this + * offset, i.e. before we start with the attributes. This also makes sense, + * otherwise we could run into problems with the update sequence array + * containing in itself the last two bytes of a sector which would mean that + * multi sector transfer protection wouldn't work. As you can't protect data + * by overwriting it since you then can't get it back... + * When reading we obviously use the data from the ntfs record header. + */ +} __attribute__ ((__packed__)) MFT_RECORD_OLD; + /* * System defined attributes (32-bit). Each attribute type has a corresponding * attribute name (Unicode string of maximum 64 character length) as described From c6dbf75a464f58c46658bba30b9b718d0c3dc942 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 15 Mar 2004 11:34:30 +0000 Subject: [PATCH 1237/2994] Copy MFT_RECORD typedef to MFT_RECORD_OLD and modify MFT_RECORD to contain the NTFS 3.1+ specific fields. Also, update mkntfs and ntfsclone appropriately. BKrev: 405594c6XwAKWIBiXSo4fZGQMBN9oQ From cf419787bd54b3051938a7004f0887bfa80b9aa0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 15 Mar 2004 11:34:30 +0000 Subject: [PATCH 1238/2994] Use sizeof(MFT_RECORD) instead of sizeof(MFT_RECORD) + 6 as MFT_RECORD now includes the NTFS 3.1+ specific fields. (Logical change 1.333) --- ntfsprogs/ntfsclone.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 89603df6..e96da3b7 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -693,8 +693,7 @@ static void wipe_unused_mft(ntfs_inode *ni) if (ni->mft_no <= LAST_METADATA_INODE) return; - /* MFT_RECORD doesn't have the XP specific 6 bytes, so add it */ - unused = m->bytes_in_use - (sizeof(MFT_RECORD) + 6); + unused = m->bytes_in_use - sizeof(MFT_RECORD); wiped_unused_mft += wipe_data((char *)m, sizeof(MFT_RECORD), unused); } From ab2da48e25cd7c8f8054ea99709da2cb2578165b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 15 Mar 2004 11:34:30 +0000 Subject: [PATCH 1239/2994] Use sizeof(MFT_RECORD_OLD) instead of sizeof(MFT_RECORD) as MFT_RECORD now includes the NTFS 3.1+ specific fields. (Logical change 1.333) --- ntfsprogs/mkntfs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 7dfa9aa5..d4847061 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -963,8 +963,12 @@ static void format_mft_record(MFT_RECORD *m) memset(m, 0, vol->mft_record_size); m->magic = magic_FILE; - /* Aligned to 2-byte boundary. */ - m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD) + 1) & ~1); + /* + * Aligned to 2-byte boundary. Note, we use the MFT_RECORD_OLD here + * explicitly as the MFT_RECORD structure has extra fields at the end + * which are only present in NTFS 3.1+. + */ + m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD_OLD) + 1) & ~1); if (vol->mft_record_size >= NTFS_SECTOR_SIZE) m->usa_count = cpu_to_le16(vol->mft_record_size / NTFS_SECTOR_SIZE + 1); @@ -977,7 +981,7 @@ static void format_mft_record(MFT_RECORD *m) "system created was corrupt.\nThank you."); } /* Set the update sequence number to 1. */ - *(u16*)((char*)m + ((sizeof(MFT_RECORD) + 1) & ~1)) = cpu_to_le16(1); + *(u16*)((u8*)m + le16_to_cpu(m->usa_ofs)) = cpu_to_le16(1); m->lsn = cpu_to_le64(0LL); m->sequence_number = cpu_to_le16(1); m->link_count = cpu_to_le16(0); From 9bb30a06012abd4058647548fe55f30192fbd91f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 15 Mar 2004 11:36:21 +0000 Subject: [PATCH 1240/2994] Ooops, forgot to test make extra when changing ntfs_get_attribute_value(). (Logical change 1.334) --- ntfsprogs/ntfsdump_logfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index b12587a3..0a5b5992 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -156,7 +156,7 @@ version_error: goto log_file_error; } /* Read in the $LogFile into the buffer. */ - if (l != ntfs_get_attribute_value(vol, m, a, lfd)) { + if (l != ntfs_get_attribute_value(vol, a, lfd)) { puts("Amount of data read does not correspond to expected " "length!"); free(lfd); From b5af3df4b8a45d28e55f9c1c1a1c93a162c249ab Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 15 Mar 2004 11:36:21 +0000 Subject: [PATCH 1241/2994] Ooops, forgot to test make extra when changing ntfs_get_attribute_value(). BKrev: 40559535JUFzt7wNIK2dsvgx6mIeZQ From 2bd298bc2d1060053e98f74886e80ff7e8878bec Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 15 Mar 2004 12:50:18 +0000 Subject: [PATCH 1242/2994] Add new API mft.[hc]::ntfs_mft_record_{layout,format}() and make mkntfs use it. (Logical change 1.335) --- include/ntfs/mft.h | 5 ++ libntfs/mft.c | 127 +++++++++++++++++++++++++++++++++++++++++++-- ntfsprogs/mkntfs.c | 67 +++++------------------- 3 files changed, 141 insertions(+), 58 deletions(-) diff --git a/include/ntfs/mft.h b/include/ntfs/mft.h index e3f18e7a..0ece8c95 100644 --- a/include/ntfs/mft.h +++ b/include/ntfs/mft.h @@ -101,6 +101,11 @@ static __inline__ u32 ntfs_mft_record_get_data_size(const MFT_RECORD *m) return le32_to_cpu(m->bytes_in_use); } +extern int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref, + MFT_RECORD *mrec); + +extern int ntfs_mft_record_format(const ntfs_volume *vol, const MFT_REF mref); + extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, s64 start); extern int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni); diff --git a/libntfs/mft.c b/libntfs/mft.c index 1edac6bd..f42719b5 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -123,7 +123,7 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, int cnt = 0, res = 0; Dprintf("%s(): Entering for inode 0x%llx.\n", __FUNCTION__, MREF(mref)); - if (!vol || !vol->mft_na || !b || count < 0) { + if (!vol || !vol->mft_na || vol->mftmirr_size <= 0 || !b || count < 0) { errno = EINVAL; return -1; } @@ -134,6 +134,10 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, return -1; } if (m < vol->mftmirr_size) { + if (!vol->mftmirr_na) { + errno = EINVAL; + return -1; + } cnt = vol->mftmirr_size - m; if (cnt > count) cnt = count; @@ -248,9 +252,126 @@ read_failed: return -1; } +/** + * ntfs_mft_record_layout - layout an mft record into a memory buffer + * @vol: volume to which the mft record will belong + * @mref: mft reference specifying the mft record number + * @m: destination buffer of size >= @vol->mft_record_size bytes + * + * Layout an empty, unused mft record with the mft reference @mref into the + * buffer @m. The volume @vol is needed because the mft record structure was + * modified in NTFS 3.1 so we need to know which volume version this mft record + * will be used on. + * + * On success return 0 and on error return -1 with errno set to the error code. + */ +int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref, + MFT_RECORD *m) +{ + ATTR_RECORD *a; + + if (!vol || !m) { + errno = EINVAL; + return -1; + } + /* Aligned to 2-byte boundary. */ + if (vol->major_ver < 3 || (vol->major_ver == 3 && !vol->minor_ver)) + m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD_OLD) + 1) & ~1); + else { + /* Abort if mref is > 32 bits. */ + if (MREF(mref) & 0x0000ffff00000000ull) { + fprintf(stderr, "Mft reference exceeds 32 bits!"); + errno = ERANGE; + return -1; + } + m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD) + 1) & ~1); + /* + * Set the NTFS 3.1+ specific fields while we know that the + * volume version is 3.1+. + */ + m->reserved = cpu_to_le16(0); + m->mft_record_number = cpu_to_le32(MREF(mref)); + } + m->magic = magic_FILE; + if (vol->mft_record_size >= NTFS_SECTOR_SIZE) + m->usa_count = cpu_to_le16(vol->mft_record_size / + NTFS_SECTOR_SIZE + 1); + else { + m->usa_count = cpu_to_le16(1); + fprintf(stderr, "Sector size is bigger than MFT record size. " + "Setting usa_count to 1. If Windows\nchkdsk " + "reports this as corruption, please email " + "linux-ntfs-dev@lists.sf.net\nstating that " + "you saw this message and that the file " + "system created was corrupt.\nThank you."); + } + /* Set the update sequence number to 1. */ + *(u16*)((u8*)m + le16_to_cpu(m->usa_ofs)) = cpu_to_le16(1); + m->lsn = cpu_to_le64(0ull); + m->sequence_number = cpu_to_le16(1); + m->link_count = cpu_to_le16(0); + /* Aligned to 8-byte boundary. */ + m->attrs_offset = cpu_to_le16((le16_to_cpu(m->usa_ofs) + + (le16_to_cpu(m->usa_count) << 1) + 7) & ~7); + m->flags = cpu_to_le16(0); + /* + * Using attrs_offset plus eight bytes (for the termination attribute), + * aligned to 8-byte boundary. + */ + m->bytes_in_use = cpu_to_le32((le16_to_cpu(m->attrs_offset) + 8 + 7) & + ~7); + m->bytes_allocated = cpu_to_le32(vol->mft_record_size); + m->base_mft_record = cpu_to_le64((MFT_REF)0); + m->next_attr_instance = cpu_to_le16(0); + a = (ATTR_RECORD*)((u8*)m + le16_to_cpu(m->attrs_offset)); + a->type = AT_END; + a->length = cpu_to_le32(0); + /* Finally, clear the unused part of the mft record. */ + memset((u8*)a + 8, 0, vol->mft_record_size - ((u8*)a + 8 - (u8*)m)); + return 0; +} + +/** + * ntfs_mft_record_format - format an mft record on an ntfs volume + * @vol: volume on which to format the mft record + * @mref: mft reference specifying mft record to format + * + * Format the mft record with the mft reference @mref in $MFT/$DATA, i.e. lay + * out an empty, unused mft record in memory and write it to the volume @vol. + * + * On success return 0 and on error return -1 with errno set to the error code. + */ +int ntfs_mft_record_format(const ntfs_volume *vol, const MFT_REF mref) +{ + MFT_RECORD *m; + int err; + + if (!vol || !vol->mft_na) { + errno = EINVAL; + return -1; + } + m = malloc(vol->mft_record_size); + if (!m) + return -1; + if (ntfs_mft_record_layout(vol, mref, m)) { + err = errno; + free(m); + errno = err; + return -1; + } + if (ntfs_mft_record_write(vol, mref, m)) { + err = errno; + free(m); + errno = err; + return -1; + } + free(m); + return 0; +} + /** * ntfs_mft_record_alloc - allocate an mft record on an ntfs volume - * @vol: mounted ntfs volume on which to allocate the mft record + * @vol: volume on which to allocate the mft record * @start: starting mft record at which to allocate (or -1 if none) * * Allocate an mft record in $MFT/$DATA starting to search for a free record @@ -274,7 +395,7 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, s64 start) /** * ntfs_mft_record_free - free an mft record on an ntfs volume - * @vol: mounted ntfs volume on which to free the mft record + * @vol: volume on which to free the mft record * @ni: open ntfs inode of the mft record to free * * Free the mft record of the open inode @ni on the mounted ntfs volume @vol. diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index d4847061..fe4fc148 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -123,6 +123,7 @@ #include "mst.h" #include "dir.h" #include "runlist.h" +#include "mft.h" #include "utils.h" #ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS @@ -954,59 +955,6 @@ static void dump_mft_record(MFT_RECORD *m) printf("-- End of attributes. --\n"); } -/** - * format_mft_record - */ -static void format_mft_record(MFT_RECORD *m) -{ - ATTR_RECORD *a; - - memset(m, 0, vol->mft_record_size); - m->magic = magic_FILE; - /* - * Aligned to 2-byte boundary. Note, we use the MFT_RECORD_OLD here - * explicitly as the MFT_RECORD structure has extra fields at the end - * which are only present in NTFS 3.1+. - */ - m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD_OLD) + 1) & ~1); - if (vol->mft_record_size >= NTFS_SECTOR_SIZE) - m->usa_count = cpu_to_le16(vol->mft_record_size / - NTFS_SECTOR_SIZE + 1); - else { - m->usa_count = cpu_to_le16(1); - Qprintf("Sector size is bigger than MFT record size. Setting " - "usa_count to 1. If Windows\nchkdsk reports this as " - "corruption, please email linux-ntfs-dev@lists.sf.net\n" - "stating that you saw this message and that the file " - "system created was corrupt.\nThank you."); - } - /* Set the update sequence number to 1. */ - *(u16*)((u8*)m + le16_to_cpu(m->usa_ofs)) = cpu_to_le16(1); - m->lsn = cpu_to_le64(0LL); - m->sequence_number = cpu_to_le16(1); - m->link_count = cpu_to_le16(0); - /* Aligned to 8-byte boundary. */ - m->attrs_offset = cpu_to_le16((le16_to_cpu(m->usa_ofs) + - (le16_to_cpu(m->usa_count) << 1) + 7) & ~7); - m->flags = cpu_to_le16(0); - /* - * Using attrs_offset plus eight bytes (for the termination attribute), - * aligned to 8-byte boundary. - */ - m->bytes_in_use = cpu_to_le32((le16_to_cpu(m->attrs_offset) + 8 + 7) & - ~7); - m->bytes_allocated = cpu_to_le32(vol->mft_record_size); - m->base_mft_record = cpu_to_le64((MFT_REF)0); - m->next_attr_instance = cpu_to_le16(0); - a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); - a->type = AT_END; - a->length = cpu_to_le32(0); -#if 0 - if (!opts.quiet && opts.verbose > 1) - dump_mft_record(m); -#endif -} - /** * make_room_for_attribute - make room for an attribute inside an mft record * @m: mft record @@ -3092,8 +3040,17 @@ int main(int argc, char **argv) Qprintf(" - Done.\n"); } Qprintf("Creating NTFS volume structures.\n"); - /* Setup an empty mft record. */ - format_mft_record((MFT_RECORD*)buf); + /* + * Setup an empty mft record. Note, we can just give 0 as the mft + * reference as we are creating an NTFS 1.2 volume for which the mft + * reference is ignored by ntfs_mft_record_layout(). + */ + if (ntfs_mft_record_layout(vol, 0, (MFT_RECORD *)buf)) + err_exit("Error: Failed to layout mft record.\n"); +#if 0 + if (!opts.quiet && opts.verbose > 1) + dump_mft_record((MFT_RECORD*)buf); +#endif /* * Copy the mft record onto all 16 records in the buffer and setup the * sequence numbers of each system file to equal the mft record number From adcfb23551d95ee40c2630d489a527241ebc02ee Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 15 Mar 2004 12:50:18 +0000 Subject: [PATCH 1243/2994] Add new API mft.[hc]::ntfs_mft_record_{layout,format}() and make mkntfs use it. BKrev: 4055a68a3-bSTZZ2kpX4ycLLgNqYuA From 52aeada3559eb635ff8e3dce8a9293980609175a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 15 Mar 2004 12:50:18 +0000 Subject: [PATCH 1244/2994] Update. (Logical change 1.335) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 96f61754..f5fe545d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,8 @@ xx/xx/2004 - 1.9.1-WIP - Copy MFT_RECORD typedef to MFT_RECORD_OLD and modify MFT_RECORD to contain the NTFS 3.1+ specific fields. Also, update mkntfs and ntfsclone appropriately. + - Add new API mft.[hc]::ntfs_mft_record_{layout,format}() and make + mkntfs use it. 11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From d05932849c69d79aef383623850d98678d0b4e27 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 12:22:03 +0000 Subject: [PATCH 1245/2994] - Add new API device.[hc]::ntfs_device_partition_start_sector_get() and make mkntfs use it. - Provide a new command line option "-p" to allow the user to specify the partition start sector manually. - Add include sys/ioctl.h to fix sector size detection. (Logical change 1.336) --- ntfsprogs/mkntfs.c | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index fe4fc148..4720a82d 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -70,6 +70,7 @@ extern int optind; #endif #include +#include #include #ifdef HAVE_LINUX_MAJOR_H # include @@ -160,6 +161,8 @@ char *dev_name; struct { int sector_size; /* -s, in bytes, power of 2, default is 512 bytes. */ + long long part_start_sect; /* start sector of partition on parent + device */ long long nr_sectors; /* size of device in sectors */ long long nr_clusters; /* Note: Win2k treats clusters as 32-bit entities! */ @@ -259,7 +262,7 @@ static void err_exit(const char *fmt, ...) */ static void copyright(void) { - fprintf(stderr, "Copyright (c) 2000-2003 Anton Altaparmakov\n" + fprintf(stderr, "Copyright (c) 2000-2004 Anton Altaparmakov\n" "Copyright (c) 2001-2003 Richard Russon\n" "Create an NTFS volume on a user specified (block) " "device.\n"); @@ -284,6 +287,8 @@ static void usage(void) "[number-of-sectors]\n" " -s sector-size Specify the sector size " "for the device\n" + " -p part-start-sect Specify the partition " + "start sector\n" " -c cluster-size Specify the cluster " "size for the volume\n" " -L volume-label Set the volume label\n" @@ -326,7 +331,7 @@ static void parse_options(int argc, char *argv[]) if (argc && *argv) EXEC_NAME = *argv; fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); - while ((c = getopt(argc, argv, "c:fh?nqs:vz:CFIL:QVl")) != EOF) + while ((c = getopt(argc, argv, "c:fh?np:qs:vz:CFIL:QVl")) != EOF) switch (c) { case 'n': opts.no_action = 1; @@ -341,6 +346,16 @@ static void parse_options(int argc, char *argv[]) case 'Q': opts.quick_format = 1; break; + case 'p': + u = strtoul(optarg, &s, 0); + opts.part_start_sect = u; + if ((u >= ULONG_MAX && errno == ERANGE) || *s || + (opts.part_start_sect >> 32)) + err_exit("Invalid partition start sector: %s " + "Maximum is 4294967295 " + "(2^32-1).\n", + optarg); + break; case 'q': opts.quiet = 1; break; @@ -2447,6 +2462,7 @@ static int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, static void init_options(void) { memset(&opts, 0, sizeof(opts)); + opts.part_start_sect = -1; opts.index_block_size = 4096; opts.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; opts.attr_defs_len = sizeof(attrdef_ntfs12_array); @@ -2659,6 +2675,20 @@ int main(int argc, char **argv) opts.nr_sectors); /* Reserve the last sector for the backup boot sector. */ opts.nr_sectors--; + /* If user didn't specify the partition start sector, determine it. */ + if (opts.part_start_sect == -1) { + opts.part_start_sect = ntfs_device_partition_start_sector_get( + vol->dev); + if (opts.part_start_sect < 0) { + Eprintf("No partition start sector specified for %s " + "and it could not\nbe obtained " + "automatically. Setting it to 0.\n" + "This will probably cause Windows not " + "to be able to boot from this " + "volume.\n", vol->dev->d_name); + opts.part_start_sect = 0; + } + } /* If user didn't specify the volume size, determine it now. */ if (!opts.volume_size) opts.volume_size = opts.nr_sectors * opts.sector_size; @@ -3284,10 +3314,13 @@ int main(int argc, char **argv) bs->bpb.sectors_per_cluster = (u8)(vol->cluster_size / opts.sector_size); bs->bpb.media_type = 0xf8; /* hard disk */ + bs->bpb.hidden_sectors = cpu_to_le32(opts.part_start_sect); + Dprintf("hidden sectors = %lli (0x%llx)\n", opts.part_start_sect, + opts.part_start_sect); /* * If there are problems go back to bs->unused[0-3] and set them. See - * ../include/bootsect.h for details. Other fields to also consider - * setting are: bs->bpb.sectors_per_track, .heads, and .hidden_sectors. + * ../include/layout.h for details. Other fields to also consider + * setting are: bs->bpb.sectors_per_track and .heads. */ bs->number_of_sectors = scpu_to_le64(opts.nr_sectors); bs->mft_lcn = scpu_to_le64(opts.mft_lcn); @@ -3303,7 +3336,7 @@ int main(int argc, char **argv) "is wrong (= 0x%x)\n", bs->clusters_per_mft_record); } - Dprintf("Clusters per mft record = %i (0x%x)\n", + Dprintf("clusters per mft record = %i (0x%x)\n", bs->clusters_per_mft_record, bs->clusters_per_mft_record); if (opts.index_block_size >= (int)vol->cluster_size) @@ -3317,7 +3350,7 @@ int main(int argc, char **argv) "is wrong (= 0x%x)\n", bs->clusters_per_index_record); } - Dprintf("Clusters per index block = %i (0x%x)\n", + Dprintf("clusters per index block = %i (0x%x)\n", bs->clusters_per_index_record, bs->clusters_per_index_record); /* Generate a 64-bit random number for the serial number. */ From ba5eb0d651839f517488f3feff74c4ddba0867bc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 12:22:03 +0000 Subject: [PATCH 1246/2994] - Add new API device.[hc]::ntfs_device_partition_start_sector_get() and make mkntfs use it. - Provide a new command line option "-p" to allow the user to specify the partition start sector manually. - Fix mkntfs and ntfsclone to include sys/ioctl.h. - Define the ioctls we use in ntfsclone if they are not defined, as it is done in device.c. BKrev: 405842ebQ8PDL9eZ6O_KykKk2YKyQA From 60231ba41237541500464c2298bf93e67d793d77 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 12:22:03 +0000 Subject: [PATCH 1247/2994] - Fix to include sys/ioctl.h. - Define the ioctls we use if they are not defined, as it is done in device.c. (Logical change 1.336) --- ntfsprogs/ntfsclone.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index e96da3b7..1f244f19 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -18,6 +18,7 @@ #include #include #include +#include #ifdef HAVE_SYS_VFS_H # include #endif @@ -41,6 +42,13 @@ #include "runlist.h" #include "utils.h" +#if defined(linux) && defined(_IO) && !defined(BLKGETSIZE) +#define BLKGETSIZE _IO(0x12,96) /* Get device size in 512-byte blocks. */ +#endif +#if defined(linux) && defined(_IOR) && !defined(BLKGETSIZE64) +#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* Get device size in bytes. */ +#endif + static const char *EXEC_NAME = "ntfsclone"; struct { @@ -910,7 +918,7 @@ static s64 device_size_get(int fd) Dprintf("BLKGETSIZE64 nr bytes = %llu (0x%llx)\n", (unsigned long long)size, (unsigned long long)size); - return (s64)size / block_size; + return (s64)size; } } #endif From 78a57841cbb80681a1db63625a3d5fd21130dea7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 12:22:03 +0000 Subject: [PATCH 1248/2994] Add detection of linux/hdreg.h needed for HDIO_GETGEO. (Logical change 1.336) --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7d8343d0..efb4198e 100644 --- a/configure.ac +++ b/configure.ac @@ -190,7 +190,8 @@ AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ unistd.h utime.h wchar.h getopt.h features.h endian.h byteswap.h \ sys/endian.h sys/param.h sys/ioctl.h sys/mount.h sys/stat.h \ - sys/types.h sys/vfs.h linux/major.h linux/fd.h machine/endian.h]) + sys/types.h sys/vfs.h linux/major.h linux/fd.h linux/hdreg.h \ + machine/endian.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL From 9318887cd520906cf387c8e87ddd3fc7e1a235b3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 12:22:03 +0000 Subject: [PATCH 1249/2994] Add new API device.[hc]::ntfs_device_partition_start_sector_get() and make mkntfs use it. (Logical change 1.336) --- include/ntfs/device.h | 2 ++ libntfs/device.c | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/include/ntfs/device.h b/include/ntfs/device.h index 7db9b0e7..4acd2896 100644 --- a/include/ntfs/device.h +++ b/include/ntfs/device.h @@ -109,4 +109,6 @@ extern s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, extern s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size); +extern s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev); + #endif /* defined _NTFS_DEVICE_H */ diff --git a/libntfs/device.c b/libntfs/device.c index dc451d03..d0450c58 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -33,6 +33,9 @@ #ifdef HAVE_LINUX_FD_H # include #endif +#ifdef HAVE_LINUX_HDREG_H +# include +#endif #include "types.h" #include "mst.h" @@ -40,10 +43,13 @@ #include "device.h" #if defined(linux) && defined(_IO) && !defined(BLKGETSIZE) -#define BLKGETSIZE _IO(0x12,96) /* Get device size in 512-byte blocks. */ +#define BLKGETSIZE _IO(0x12,96) /* Get device size in 512-byte blocks. */ #endif #if defined(linux) && defined(_IOR) && !defined(BLKGETSIZE64) -#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* Get device size in bytes. */ +#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* Get device size in bytes. */ +#endif +#if defined(linux) && !defined(HDIO_GETGEO) +#define HDIO_GETGEO 0x0301 /* Get device geometry. */ #endif /** @@ -506,3 +512,30 @@ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) return (low + 1LL) / block_size; } +/** + * ntfs_device_partition_start_sector_get - get starting sector of a partition + * @dev: open device + * + * On success, return the starting sector of the partition @dev in the parent + * block device of @dev. On error return -1 with errno set to the error code. + * + * The following error codes are defined: + * ENOTSUP System does not support HDIO_GETGEO ioctl + * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO + */ +s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev) +{ +#ifdef HDIO_GETGEO + { struct hd_geometry geo; + + if (!dev->d_ops->ioctl(dev, HDIO_GETGEO, &geo)) { + Dprintf("HDIO_GETGEO start_sect = %lu (0x%lx)\n", + geo.start, geo.start); + return geo.start; + } + } +#else + errno = ENOTSUP; +#endif + return -1; +} From 117c16ec74cf164289ef3b89de2617a8c324127d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 12:22:03 +0000 Subject: [PATCH 1250/2994] Fix a compiler warning. (Logical change 1.336) --- libntfs/security.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/security.c b/libntfs/security.c index e1f4113e..70c441d7 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -73,7 +73,7 @@ char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str) if (!guid) { errno = EINVAL; - return (char *)guid; + return NULL; } _guid_str = guid_str; if (!_guid_str) { From 08bd36ca6282962540c144cd8cc586078d9a8238 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 12:22:03 +0000 Subject: [PATCH 1251/2994] Provide a new command line option "-p" to allow the user to specify the partition start sector manually. (Logical change 1.336) --- ntfsprogs/mkntfs.8.in | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 679924a6..55bed95d 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -13,6 +13,10 @@ mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system .I sector-size ] [ +.B \-p +.I part-start-sect +] +[ .B \-c .I cluster-size ] @@ -80,21 +84,29 @@ automagically figures the file system size. Specify the size of sectors in bytes. Valid sector size values are 256, 512, 1024, 2048 and 4096 bytes per sector. If omitted, .B mkntfs +attempts to determine the .I sector-size -is determined automatically and if that fails a default of 512 -bytes per sector is used. +automatically and if that fails a default of 512 bytes per sector is used. +.TP +.BI \-p " part-start-sect" +Specify the partition start sector. The maximum is 4294967295 (2^32-1). If +omitted, +.B mkntfs +attempts to determine +.I part-start-sect +automatically and if that fails a default of 0 is used. .TP .BI \-c " cluster-size" Specify the size of clusters in bytes. Valid cluster size values are powers of two, with at least 256, and at most 65536 bytes per cluster. If omitted, .B mkntfs +determines the .I cluster-size -is determined by the volume size. The value is determined as -follows: +from the volume size. The value is determined as follows: .TS lB lB lB l l r. -Volume size Default cluster +Volume size Default cluster size 0 - 512MB 512 bytes 512MB - 1GB 1024 bytes 1GB - 2GB 2048 bytes From 0719c9de0246ade8d76e5ab6b771d60534c1ae20 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 12:22:03 +0000 Subject: [PATCH 1252/2994] Update (Logical change 1.336) --- ChangeLog | 7 +++++++ config.h.in | 3 +++ configure | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f5fe545d..7ce15a63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,13 @@ xx/xx/2004 - 1.9.1-WIP ntfsclone appropriately. - Add new API mft.[hc]::ntfs_mft_record_{layout,format}() and make mkntfs use it. + - Add new API device.[hc]::ntfs_device_partition_start_sector_get() and + make mkntfs use it. + - Provide a new command line option "-p" to mkntfs to allow the user to + specify the partition start sector manually. + - Fix mkntfs and ntfsclone to include sys/ioctl.h. + - Define the ioctls we use in ntfsclone if they are not defined, as it + is done in device.c. 11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef diff --git a/config.h.in b/config.h.in index 821c67db..fcb99e06 100644 --- a/config.h.in +++ b/config.h.in @@ -48,6 +48,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_FD_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_HDREG_H + /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_MAJOR_H diff --git a/configure b/configure index c3046224..5de21adf 100755 --- a/configure +++ b/configure @@ -20037,13 +20037,15 @@ fi + for ac_header in fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ unistd.h utime.h wchar.h getopt.h features.h endian.h byteswap.h \ sys/endian.h sys/param.h sys/ioctl.h sys/mount.h sys/stat.h \ - sys/types.h sys/vfs.h linux/major.h linux/fd.h machine/endian.h + sys/types.h sys/vfs.h linux/major.h linux/fd.h linux/hdreg.h \ + machine/endian.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then From f33bdf28a5cebc67471415a014ef45e59c5e2f79 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 12:22:03 +0000 Subject: [PATCH 1253/2994] Update comment for hidden_sectors in BIOS_PARAMETER_BLOCK. (Logical change 1.336) --- include/ntfs/layout.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 178741aa..fab9205f 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -54,7 +54,8 @@ typedef struct { u16 sectors_per_fat; /* zero */ u16 sectors_per_track; /* irrelevant */ u16 heads; /* irrelevant */ - u32 hidden_sectors; /* zero */ + u32 hidden_sectors; /* Offset to the start of the partition + relative to the disk in sectors. */ u32 large_sectors; /* zero */ /* sizeof() = 25 (0x19) bytes */ } __attribute__ ((__packed__)) BIOS_PARAMETER_BLOCK; From e5f05c840162d3004cd1698025a2309966b7552f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 14:41:47 +0000 Subject: [PATCH 1254/2994] Update for 1.9.1 release. (Logical change 1.337) --- ChangeLog | 4 ++-- NEWS | 3 +++ configure | 20 ++++++++++---------- configure.ac | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ce15a63..ad02a878 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/2004 - 1.9.1-WIP +17/03/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. - Fix warnings on powerpc architecture where it would seem char is unsigned so comparisons with -1 cause a warning that comparison is @@ -28,7 +28,7 @@ xx/xx/2004 - 1.9.1-WIP - Define the ioctls we use in ntfsclone if they are not defined, as it is done in device.c. -11/04/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. +11/03/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef HAVE_CONFIG_H. (Suggested by Christophe.) - Update doc/CodingStyle. (Suggested by Szaka.) diff --git a/NEWS b/NEWS index fa19b778..1516dc98 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ Current news ============ +mkntfs now creates bootable ntfs volumes so you can install Windows on an +ntfs volume created with mkntfs and Windows will manage to boot afterwards. + ntfsresize now supports relocation which generally means you are now able to resize to any size you like (as long as there is enough free space). Note, this modifies the command line options a little as well as the returned output diff --git a/configure b/configure index 5de21adf..47c52d79 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.1-WIP. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.1. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.9.1-WIP' -PACKAGE_STRING='ntfsprogs 1.9.1-WIP' +PACKAGE_VERSION='1.9.1' +PACKAGE_STRING='ntfsprogs 1.9.1' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -955,7 +955,7 @@ 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 ntfsprogs 1.9.1-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.9.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1022,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.9.1-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.9.1:";; esac cat <<\_ACEOF @@ -1170,7 +1170,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.9.1-WIP +ntfsprogs configure 1.9.1 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1184,7 +1184,7 @@ 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 ntfsprogs $as_me 1.9.1-WIP, which was +It was created by ntfsprogs $as_me 1.9.1, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1904,7 +1904,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.9.1-WIP' + VERSION='1.9.1' cat >>confdefs.h <<_ACEOF @@ -23045,7 +23045,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.9.1-WIP, which was +This file was extended by ntfsprogs $as_me 1.9.1, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23108,7 +23108,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.9.1-WIP +ntfsprogs config.status 1.9.1 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index efb4198e..95f6c154 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.9.1-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.9.1],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) From 4e71d24e136afd223d9029e22ca2912035faf777 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 14:41:47 +0000 Subject: [PATCH 1255/2994] Update for 1.9.1 release. BKrev: 405863abL5s3YuyRFNDfryHum801XQ From 9c6906ed487502884899d44bd78afb7733981957 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 16:53:29 +0000 Subject: [PATCH 1256/2994] - Remove AM_MAINTAINER_MODE. - Add configure option --enable-warnings and make that enable all the compiler warnings (this used to be done in maintainer mode). (Logical change 1.338) --- configure.ac | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 95f6c154..a97f7d81 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,6 @@ AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE -AM_MAINTAINER_MODE AM_ENABLE_SHARED AM_ENABLE_STATIC @@ -72,7 +71,7 @@ AC_ARG_ENABLE(default-device-io-ops, AC_ARG_ENABLE(gnome-vfs, AS_HELP_STRING(--disable-gnome-vfs,omit Gnome-VFS-2.0 'libntfs' - interface [default=detect]), , + interface (default=detect)), , enable_gnome_vfs=auto ) @@ -83,6 +82,11 @@ AC_ARG_ENABLE(really-static, ) AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes) +AC_ARG_ENABLE(warnings, + AS_HELP_STRING(--enable-warnings,enable additional compiler warnings), , + enable_warnings=no +) + # Use GNU extensions if available. AC_GNU_SOURCE @@ -159,15 +163,15 @@ AC_MSG_RESULT($cc_version) # Add our compiler switches not discarding 'CFLAGS' as they may have been # passed to us by rpmbuild(8). -# We add -Wall to enable compiler warnings. +# We add -Wall to enable some compiler warnings. CFLAGS="$CFLAGS -Wall" -# Add lots of extra warnings if in maintainer mode. -if test "$USE_MAINTAINER_MODE" = "yes";then +# Add lots of extra warnings if --enable-warnings was specified. +if test "$enable_warnings" = "yes"; then CFLAGS="$CFLAGS -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare" fi -# Add debugging switches if in debug mode. +# Add debugging switches if --enable-debug was specified. if test "$enable_debug" = "yes"; then CFLAGS="$CFLAGS -ggdb3 -DDEBUG" fi From 8f51b1fdcd6a897cf290924aae699d38a4e73f2a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 16:53:29 +0000 Subject: [PATCH 1257/2994] - Remove AM_MAINTAINER_MODE. - Add configure option --enable-warnings and make that enable all the compiler warnings (this used to be done in maintainer mode). - Do not specify maintainer mode or enable compiler warnings in autogen.sh. BKrev: 40588289PkOte4KVeOlh70tKAhrf1A From be3bd771e172b5e4e885caa83851eb373f58f25e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 16:53:29 +0000 Subject: [PATCH 1258/2994] Do not specify maintainer mode or enable compiler warnings. (Logical change 1.338) --- autogen.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/autogen.sh b/autogen.sh index 3a624c31..6d9db571 100755 --- a/autogen.sh +++ b/autogen.sh @@ -34,11 +34,8 @@ if test -z "$*"; then echo fi -conf_flags="--enable-maintainer-mode --enable-compile-warnings" - -echo Running $srcdir/configure $conf_flags "$@" ... -$srcdir/configure $conf_flags "$@" \ - && echo Now type \`make\' to compile ntfsprogs. || err=1 +echo Running $srcdir/configure "$@" ... +$srcdir/configure "$@" && echo Now type \`make\' to compile ntfsprogs. || err=1 if test "$srcdir" != "."; then popd > /dev/null From 93acd345a75e75d3fdcb0c8b7d49151d0d86a152 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 17 Mar 2004 16:53:29 +0000 Subject: [PATCH 1259/2994] Update (Logical change 1.338) --- ChangeLog | 5 ++ Makefile.in | 11 ++-- aclocal.m4 | 40 -------------- configure | 114 +++++++++++++++------------------------ doc/Makefile.in | 9 ++-- include/Makefile.in | 9 ++-- include/ntfs/Makefile.in | 9 ++-- libntfs/Makefile.in | 9 ++-- ntfsprogs/Makefile.in | 9 ++-- 9 files changed, 68 insertions(+), 147 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad02a878..4328a618 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,11 @@ - Fix mkntfs and ntfsclone to include sys/ioctl.h. - Define the ioctls we use in ntfsclone if they are not defined, as it is done in device.c. + - Do not specify maintainer mode or enable compiler warnings in + autogen.sh. + - Create new config option --enable-warnings and make that enable all + the compiler warnings (this used to be done in maintainer mode). + - Remove AM_MAINTAINER_MODE from configure.ac. 11/03/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef diff --git a/Makefile.in b/Makefile.in index 2af54ab2..4d3b4ea6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -115,9 +115,6 @@ 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@ @@ -194,7 +191,7 @@ all: config.h .SUFFIXES: am--refresh: @: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -221,9 +218,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(top_srcdir)/configure: $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @@ -235,7 +232,7 @@ config.h: stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(srcdir)/config.h.in: $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ diff --git a/aclocal.m4 b/aclocal.m4 index bb528c71..51509148 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -6543,46 +6543,6 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) -# Add --enable-maintainer-mode option to configure. -# From Jim Meyering - -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004 -# 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 - -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]) - # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. diff --git a/configure b/configure index 47c52d79..db93bcce 100755 --- a/configure +++ b/configure @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os 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 mkdir_p AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os 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 mkdir_p AWK SET_MAKE am__leading_dot REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1029,8 +1029,6 @@ if test -n "$ac_init_help"; then 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 --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] @@ -1039,8 +1037,9 @@ Optional Features: --disable-default-device-io-ops do not provide default device io operations --disable-gnome-vfs omit Gnome-VFS-2.0 'libntfs' interface - default=detect + (default=detect) --enable-really-static create completely static binaries for the utilities + --enable-warnings enable additional compiler warnings --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-fast-install[=PKGS] @@ -2030,30 +2029,6 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" -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 - - # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" @@ -2172,6 +2147,15 @@ else fi +# Check whether --enable-warnings or --disable-warnings was given. +if test "${enable_warnings+set}" = set; then + enableval="$enable_warnings" + +else + enable_warnings=no + +fi; + # Use GNU extensions if available. cat >>confdefs.h <<\_ACEOF @@ -3901,7 +3885,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3904 "configure"' > conftest.$ac_ext + echo '#line 3888 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5466,7 +5450,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5469:" \ +echo "$as_me:5453:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6500,11 +6484,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6503: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6487: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6507: \$? = $ac_status" >&5 + echo "$as_me:6491: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6733,11 +6717,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6736: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6720: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6740: \$? = $ac_status" >&5 + echo "$as_me:6724: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6793,11 +6777,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6796: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6780: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6800: \$? = $ac_status" >&5 + echo "$as_me:6784: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8977,7 +8961,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:11241: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11261: \$? = $ac_status" >&5 + echo "$as_me:11245: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -11314,11 +11298,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11317: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11301: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11321: \$? = $ac_status" >&5 + echo "$as_me:11305: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12675,7 +12659,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13587: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13607: \$? = $ac_status" >&5 + echo "$as_me:13591: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13660,11 +13644,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13663: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13647: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13667: \$? = $ac_status" >&5 + echo "$as_me:13651: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15694,11 +15678,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15697: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15681: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15701: \$? = $ac_status" >&5 + echo "$as_me:15685: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15927,11 +15911,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15930: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15914: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15934: \$? = $ac_status" >&5 + echo "$as_me:15918: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15987,11 +15971,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15990: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15974: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15994: \$? = $ac_status" >&5 + echo "$as_me:15978: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18171,7 +18155,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 # Add our compiler switches not discarding 'CFLAGS' as they may have been # passed to us by rpmbuild(8). -# We add -Wall to enable compiler warnings. +# We add -Wall to enable some compiler warnings. CFLAGS="$CFLAGS -Wall" -# Add lots of extra warnings if in maintainer mode. -if test "$USE_MAINTAINER_MODE" = "yes";then +# Add lots of extra warnings if --enable-warnings was specified. +if test "$enable_warnings" = "yes"; then CFLAGS="$CFLAGS -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare" fi -# Add debugging switches if in debug mode. +# Add debugging switches if --enable-debug was specified. if test "$enable_debug" = "yes"; then CFLAGS="$CFLAGS -ggdb3 -DDEBUG" fi @@ -22732,13 +22716,6 @@ LIBOBJS=$ac_libobjs 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 "${REALLYSTATIC_TRUE}" && test -z "${REALLYSTATIC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"REALLYSTATIC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -23357,9 +23334,6 @@ s,@mkdir_p@,$mkdir_p,;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,@REALLYSTATIC_TRUE@,$REALLYSTATIC_TRUE,;t t s,@REALLYSTATIC_FALSE@,$REALLYSTATIC_FALSE,;t t s,@CC@,$CC,;t t diff --git a/doc/Makefile.in b/doc/Makefile.in index 63ca48c2..c2c3485b 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -90,9 +90,6 @@ 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@ @@ -171,7 +168,7 @@ EXTRA_DIST = \ all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -196,9 +193,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh mostlyclean-libtool: diff --git a/include/Makefile.in b/include/Makefile.in index 680fe65f..fb59d3ca 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -99,9 +99,6 @@ 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@ @@ -170,7 +167,7 @@ SUBDIRS = ntfs all: all-recursive .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -195,9 +192,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh mostlyclean-libtool: diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index fec9b20c..b64caf92 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -97,9 +97,6 @@ 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@ @@ -195,7 +192,7 @@ linux_ntfsinclude_HEADERS = \ all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -220,9 +217,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh mostlyclean-libtool: diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 3f706fa2..aec6bf08 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -166,9 +166,6 @@ 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@ @@ -276,7 +273,7 @@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -301,9 +298,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh libntfs.conf: $(top_builddir)/config.status $(srcdir)/libntfs.conf.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index fcfcbf1e..ca6c21c4 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -202,9 +202,6 @@ 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@ @@ -339,7 +336,7 @@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -364,9 +361,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh mkntfs.8: $(top_builddir)/config.status $(srcdir)/mkntfs.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ From ae7789dcd084f63939eaa00296397db6a2b71dd9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 19 Mar 2004 10:21:05 +0000 Subject: [PATCH 1260/2994] Support the case where $Volume does not have a $VOLUME_NAME attribute in ntfs_device_mount() and let ntfslabel create the attribute when it is not present. (Logical change 1.339) --- libntfs/volume.c | 86 +++++++++++++++++++++++++++---------------- ntfsprogs/ntfsinfo.c | 41 ++++++++++----------- ntfsprogs/ntfslabel.c | 66 +++++++++++++++++++++++++-------- 3 files changed, 125 insertions(+), 68 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index 8b1bdffc..701b224e 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -764,7 +764,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) Dperror("Failed to open inode"); goto error_exit; } - /* Get an ntfs attribute for $UpCase/$DATA. */ + /* Get a search context for the $Volume/$VOLUME_INFORMATION lookup. */ ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { Dputs(FAILED); @@ -807,46 +807,70 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) /* Do not use le16_to_cpu() macro here as our VOLUME_FLAGS are defined using cpu_to_le16() macro and hence are consistent. */ vol->flags = vinf->flags; - /* Find the $VOLUME_NAME attribute. */ + /* + * Reinitialize the search context for the $Volume/$VOLUME_NAME lookup. + */ ntfs_attr_reinit_search_ctx(ctx); if (ntfs_attr_lookup(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - Dputs(FAILED); - Dputs("$VOLUME_NAME attribute not found in $Volume?!?"); - goto error_exit; - } - a = ctx->attr; - /* Has to be resident. */ - if (a->non_resident) { - Dputs(FAILED); - Dputs("Error: Attribute $VOLUME_NAME must be resident!"); - errno = EIO; - goto error_exit; - } - /* Get a pointer to the value of the attribute. */ - vname = (uchar_t*)(le16_to_cpu(a->value_offset) + (char*)a); - u = le32_to_cpu(a->value_length) / 2; - /* Convert Unicode volume name to current locale multibyte format. */ - vol->vol_name = NULL; - if (ntfs_ucstombs(vname, u, &vol->vol_name, 0) == -1) { - Dperror("Error: Volume name could not be converted to " - "current locale"); - Dputs("Forcing name into ASCII by replacing non-ASCII " - "characters with underscores."); - vol->vol_name = malloc(u + 1); + if (errno != ENOENT) { + Dputs(FAILED); + Dputs("Error: Lookup of $VOLUME_NAME attribute in " + "$Volume failed. This probably means " + "something is corrupt. Run chkdsk."); + goto error_exit; + } + /* + * Attribute not present. This has been seen in the field. + * Treat this the same way as if the attribute was present but + * had zero length. + */ + vol->vol_name = malloc(1); if (!vol->vol_name) { Dputs(FAILED); Dputs("Error: Unable to allocate memory for volume " "name!"); goto error_exit; } - for (j = 0; j < (s32)u; j++) { - uchar_t uc = le16_to_cpu(vname[j]); - if (uc > 0xff) - uc = (uchar_t)'_'; - vol->vol_name[j] = (char)uc; + vol->vol_name[0] = '\0'; + } else { + a = ctx->attr; + /* Has to be resident. */ + if (a->non_resident) { + Dputs(FAILED); + Dputs("Error: Attribute $VOLUME_NAME must be " + "resident!"); + errno = EIO; + goto error_exit; + } + /* Get a pointer to the value of the attribute. */ + vname = (uchar_t*)(le16_to_cpu(a->value_offset) + (char*)a); + u = le32_to_cpu(a->value_length) / 2; + /* + * Convert Unicode volume name to current locale multibyte + * format. + */ + vol->vol_name = NULL; + if (ntfs_ucstombs(vname, u, &vol->vol_name, 0) == -1) { + Dperror("Error: Volume name could not be converted to " + "current locale"); + Dputs("Forcing name into ASCII by replacing non-ASCII " + "characters with underscores."); + vol->vol_name = malloc(u + 1); + if (!vol->vol_name) { + Dputs(FAILED); + Dputs("Error: Unable to allocate memory for " + "volume name!"); + goto error_exit; + } + for (j = 0; j < (s32)u; j++) { + uchar_t uc = le16_to_cpu(vname[j]); + if (uc > 0xff) + uc = (uchar_t)'_'; + vol->vol_name[j] = (char)uc; + } + vol->vol_name[u] = '\0'; } - vol->vol_name[u] = '\0'; } Dputs(OK); ntfs_attr_put_search_ctx(ctx); diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 399bc1c5..486089a0 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -517,29 +517,28 @@ void ntfs_dump_object_id_attr(ntfs_inode *inode) */ void ntfs_dump_volume_name_attr(ntfs_inode *inode) { - VOLUME_NAME *vol_name = NULL; - ATTR_RECORD *attr = NULL; - ntfs_attr_search_ctx *ctx = NULL; + VOLUME_NAME *vol_name = NULL; + ATTR_RECORD *attr = NULL; + ntfs_attr_search_ctx *ctx = NULL; - ctx = ntfs_attr_get_search_ctx(inode, NULL); - - if(ntfs_attr_lookup(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - if (errno != ENOENT) - fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_VOLUME_NAME: %s\n", - strerror(errno)); + ctx = ntfs_attr_get_search_ctx(inode, NULL); + if (ntfs_attr_lookup(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, + ctx)) { + if (errno != ENOENT) + fprintf(stderr, "ntfsinfo error: cannot look up " + "attribute AT_VOLUME_NAME: %s\n", + strerror(errno)); + ntfs_attr_put_search_ctx(ctx); + return; + } + attr = ctx->attr; + vol_name = (VOLUME_NAME*)((char *)attr + + le16_to_cpu(attr->value_offset)); + printf("Dumping $VOLUME_NAME (0x60)\n"); + // FIXME: convert the name to current locale multibyte sequence + // then output the converted name. + //printf("\tVolume Name: \t\t\t %s\n", vol_name->name); ntfs_attr_put_search_ctx(ctx); - return; - } - - attr = ctx->attr; - - vol_name = (VOLUME_NAME*)((char *)attr + le16_to_cpu(attr->value_offset)); - - printf("Dumping $VOLUME_NAME (0x60)\n"); - - //printf("\tVolume Name: \t\t\t %s\n", vol_name->name); - - ntfs_attr_put_search_ctx(ctx); } diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 8ea8843a..74597805 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -2,7 +2,7 @@ * ntfslabel - Part of the Linux-NTFS project. * * Copyright (c) 2002 Matthew J. Fanto - * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2002-2004 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon * * This utility will display/change the label on an NTFS partition. @@ -64,7 +64,7 @@ void version (void) EXEC_NAME, VERSION); printf ("Copyright (c)\n"); printf (" 2002 Matthew J. Fanto\n"); - printf (" 2002 Anton Altaparmakov\n"); + printf (" 2002-2004 Anton Altaparmakov\n"); printf (" 2002-2003 Richard Russon\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -164,7 +164,8 @@ int parse_options (int argc, char *argv[]) } if (opts.quiet && opts.verbose) { - Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + Eprintf ("You may not use --quiet and --verbose at " + "the same time.\n"); err++; } } @@ -283,15 +284,21 @@ int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, BOOL fo perror("Failed to get attribute search context"); goto err_out; } - if (ntfs_attr_lookup(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - perror("Lookup of $VOLUME_NAME attribute failed"); - goto err_out; - } - a = ctx->attr; - if (a->non_resident) { - fprintf(stderr, "Error: Attribute $VOLUME_NAME must be " - "resident.\n"); - goto err_out; + if (ntfs_attr_lookup(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, + ctx)) { + if (errno != ENOENT) { + perror("Lookup of $VOLUME_NAME attribute failed"); + goto err_out; + } + /* The volume name attribute does not exist. Need to add it. */ + a = NULL; + } else { + a = ctx->attr; + if (a->non_resident) { + fprintf(stderr, "Error: Attribute $VOLUME_NAME must be " + "resident.\n"); + goto err_out; + } } label_len = ntfs_mbstoucs(label, &new_label, 0); if (label_len == -1) { @@ -306,11 +313,38 @@ int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, BOOL fo label_len = 0x100; new_label[label_len / sizeof(uchar_t)] = cpu_to_le16(L'\0'); } - if (resize_resident_attribute_value(mrec, a, label_len)) { - perror("Error resizing resident attribute"); - goto err_out; + if (a) { + if (resize_resident_attribute_value(mrec, a, label_len)) { + perror("Error resizing resident attribute"); + goto err_out; + } + } else { + /* sizeof(resident attribute record header) == 24 */ + int asize = (24 + label_len + 7) & ~7; + u32 biu = le32_to_cpu(mrec->bytes_in_use); + if (biu + asize > le32_to_cpu(mrec->bytes_allocated)) { + errno = ENOSPC; + perror("Error adding resident attribute"); + goto err_out; + } + a = ctx->attr; + memmove((u8*)a + asize, a, biu - ((u8*)a - (u8*)mrec)); + mrec->bytes_in_use = cpu_to_le32(biu + asize); + a->type = AT_VOLUME_NAME; + a->length = cpu_to_le32(asize); + a->non_resident = 0; + a->name_length = 0; + a->name_offset = cpu_to_le16(24); + a->flags = cpu_to_le16(0); + a->instance = mrec->next_attr_instance; + mrec->next_attr_instance = cpu_to_le16((le16_to_cpu( + mrec->next_attr_instance) + 1) & 0xffff); + a->value_length = cpu_to_le32(label_len); + a->value_offset = a->name_offset; + a->resident_flags = 0; + a->reservedR = 0; } - memcpy((char*)a + le16_to_cpu(a->value_offset), new_label, label_len); + memcpy((u8*)a + le16_to_cpu(a->value_offset), new_label, label_len); if (ntfs_mft_record_write(vol, (MFT_REF)FILE_Volume, mrec)) { perror("Error writing MFT Record to disk"); goto err_out; From ed9f46c3495796e29cb00a45abe2d05b7d6a356d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 19 Mar 2004 10:21:05 +0000 Subject: [PATCH 1261/2994] Support the case where $Volume does not have a $VOLUME_NAME attribute in ntfs_device_mount() and let ntfslabel create the attribute when it is not present. BKrev: 405ac991tgthsWAgze2t2_BVuQLrog From 0a9fe97b85701ae7724f058b2242dc53ba2d6c2a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 19 Mar 2004 10:21:05 +0000 Subject: [PATCH 1262/2994] Update (Logical change 1.339) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4328a618..0be725b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,9 @@ - Create new config option --enable-warnings and make that enable all the compiler warnings (this used to be done in maintainer mode). - Remove AM_MAINTAINER_MODE from configure.ac. + - Support the case where $Volume does not have a $VOLUME_NAME + attribute in ntfs_device_mount() and let ntfslabel create the + attribute when it is not present. 11/03/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From 592b4662dba866f9de328378a956630833cbfad0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 19 Mar 2004 17:36:45 +0000 Subject: [PATCH 1263/2994] Add attrlist.c to build. (Logical change 1.340) --- libntfs/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index ff246f96..0e0816d3 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -35,6 +35,7 @@ lib_LTLIBRARIES = libntfs.la libntfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS) libntfs_la_SOURCES = \ attrib.c \ + attrlist.c \ bitmap.c \ bootsect.c \ compat.c \ From 1a9faf5ae811b2e13550e399df32817a583f06e5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 19 Mar 2004 17:36:45 +0000 Subject: [PATCH 1264/2994] Add attrlist.h to list of headers. (Logical change 1.340) --- include/ntfs/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/include/ntfs/Makefile.am b/include/ntfs/Makefile.am index 98869b88..21ab13ba 100644 --- a/include/ntfs/Makefile.am +++ b/include/ntfs/Makefile.am @@ -2,6 +2,7 @@ linux_ntfsincludedir = $(includedir)/ntfs linux_ntfsinclude_HEADERS = \ attrib.h \ + attrlist.h \ bitmap.h \ bootsect.h \ compat.h \ From 5da4ab55e0a0c224348b5f98956b1481d27bf006 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 19 Mar 2004 17:36:45 +0000 Subject: [PATCH 1265/2994] Add new files include/ntfs/attrlist.h and libntfs/attrlist.c for the upcoming attribute list attribute handling code. BKrev: 405b2fadc8Po3t37cxgqA7hdUI_wBQ From 1c970228e29624ef627f56ad58b7fd2d22988fd5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 19 Mar 2004 17:36:45 +0000 Subject: [PATCH 1266/2994] Initial revision --- include/ntfs/attrlist.h | 0 libntfs/attrlist.c | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 include/ntfs/attrlist.h create mode 100644 libntfs/attrlist.c diff --git a/include/ntfs/attrlist.h b/include/ntfs/attrlist.h new file mode 100644 index 00000000..e69de29b diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c new file mode 100644 index 00000000..e69de29b From 6507533a0a714d611ff3e62c3e38c91eb9ed02cd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 19 Mar 2004 17:36:45 +0000 Subject: [PATCH 1267/2994] (Logical change 1.340) --- include/ntfs/attrlist.h | 26 ++++++++++++++++++++++++++ libntfs/attrlist.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/include/ntfs/attrlist.h b/include/ntfs/attrlist.h index e69de29b..6fa3fa3c 100644 --- a/include/ntfs/attrlist.h +++ b/include/ntfs/attrlist.h @@ -0,0 +1,26 @@ +/* + * attrlist.h - Exports for attribute list attribute handling. Part of the + * Linux-NTFS project. + * + * Copyright (c) 2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_ATTRLIST_H +#define _NTFS_ATTRLIST_H + +#endif /* defined _NTFS_ATTRLIST_H */ diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index e69de29b..406a301d 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -0,0 +1,38 @@ +/* + * attrlist.c - Attribute list attribute handling code. Part of the Linux-NTFS + * project. + * + * Copyright (c) 2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include "types.h" +#include "layout.h" +#include "attrib.h" +#include "attrlist.h" + +/** + * ntfs_ - . + * @: . + * + * . + */ +static void ntfs_something_or_other(void) +{ +} From 1500287b1c8e38c990e68563d867ba01afc5d25a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 19 Mar 2004 17:36:45 +0000 Subject: [PATCH 1268/2994] Update (Logical change 1.340) --- include/ntfs/Makefile.in | 1 + libntfs/Makefile.in | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index b64caf92..6a25d91c 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -164,6 +164,7 @@ target_vendor = @target_vendor@ linux_ntfsincludedir = $(includedir)/ntfs linux_ntfsinclude_HEADERS = \ attrib.h \ + attrlist.h \ bitmap.h \ bootsect.h \ compat.h \ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index aec6bf08..79930a8e 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -85,15 +85,16 @@ am_libntfs_gnomevfs_la_OBJECTS = \ libntfs_gnomevfs_la-gnome-vfs-module.lo libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) libntfs_la_LIBADD = -am_libntfs_la_OBJECTS = attrib.lo bitmap.lo bootsect.lo compat.lo \ - compress.lo debug.lo device.lo device_io.lo dir.lo inode.lo \ - lcnalloc.lo mft.lo mst.lo runlist.lo security.lo unistr.lo \ - volume.lo +am_libntfs_la_OBJECTS = attrib.lo attrlist.lo bitmap.lo bootsect.lo \ + compat.lo compress.lo debug.lo device.lo device_io.lo dir.lo \ + inode.lo lcnalloc.lo mft.lo mst.lo runlist.lo security.lo \ + unistr.lo volume.lo libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrib.Plo ./$(DEPDIR)/bitmap.Plo \ +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrib.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/attrlist.Plo ./$(DEPDIR)/bitmap.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/bootsect.Plo ./$(DEPDIR)/compat.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/compress.Plo ./$(DEPDIR)/debug.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/device.Plo ./$(DEPDIR)/device_io.Plo \ @@ -237,6 +238,7 @@ lib_LTLIBRARIES = libntfs.la libntfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS) libntfs_la_SOURCES = \ attrib.c \ + attrlist.c \ bitmap.c \ bootsect.c \ compat.c \ @@ -372,6 +374,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attrib.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attrlist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bootsect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compat.Plo@am__quote@ From 6b5861e6b4c90bc3821c132a305f166431401a74 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 22 Mar 2004 09:09:32 +0000 Subject: [PATCH 1269/2994] Add a TODO item for mkntfs. (Logical change 1.341) --- TODO.ntfsprogs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index bd17fe42..a1288508 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -14,6 +14,11 @@ Thanks, and the subsequent chkdsk (which will happen on reboot into Windows automatically) recreates the backup boot sector if the Linux kernel lied to us about the number of sectors. +- Got a report that creating a floppy with mkntfs failed. Difference between + this floppy and the floppy created by the special tool found on the net was + said to be that the bitmap is 256kib on the special floppy while mkntfs will + make it much smaller. Need to verify this and experiment with the bitmap + size to make it work. Note, reporter was using win2k. From 822fb42c749b7280f2eaed34e2c1840df7373fc2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 22 Mar 2004 09:09:32 +0000 Subject: [PATCH 1270/2994] Add a TODO item for mkntfs. BKrev: 405ead4cIyLuzJW0wHsmA8LqDP8qgg From f6fa31b6b018946b7a1c5ac1226660f73bdc79d9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 22 Mar 2004 09:09:44 +0000 Subject: [PATCH 1271/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into cantab.net:/home/src/ntfsprogs 2004/03/21 20:28:25+02:00 omakaista.fi!szaka - recommend chkdsk /f if mapping pairs decoding fails with EIO (Kent B. Larsen) - use corrupt_volume_msg in all relevant cases - explain "bad sectors" a bit better BKrev: 405ead58OtBH8eBBOL8HUmZ9Q9fliw From 8f77300f3a730ae2e2fff1c2524213aee525104c Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Mon, 22 Mar 2004 09:09:44 +0000 Subject: [PATCH 1272/2994] - recommend chkdsk /f if mapping pairs decoding fails with EIO (Kent B. Larsen) - use corrupt_volume_msg in all relevant cases - explain "bad sectors" a bit better (Logical change 1.342) --- ntfsprogs/ntfsresize.c | 45 ++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 4b33a055..ef0004bb 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -69,8 +69,15 @@ static const char *resize_important_msg = static const char *invalid_ntfs_msg = "Apparently device '%s' doesn't have a valid NTFS.\n" -"Maybe you selected the wrong partition or the whole disk\n" -"instead of a partition (e.g. /dev/hda, not /dev/hda1)?\n"; +"Maybe you selected the wrong partition? Or the whole disk instead of a\n" +"partition (e.g. /dev/hda, not /dev/hda1)? This error might also occur\n" +"if the disk was incorrectly repartitioned (see the ntfsresize FAQ).\n"; + +static const char *corrupt_volume_msg = +"Apparently you have a corrupted NTFS. Please run the filesystem checker\n" +"on Windows by invoking chkdsk /f. Don't forget the /f (force) parameter,\n" +"it's important! You probably also need to reboot Windows to take effect.\n" +"Then you can try ntfsresize again. No modification was made to your NTFS.\n"; struct { int verbose; @@ -610,7 +617,8 @@ static void collect_shrink_constraints(ntfs_resize_t *resize, runlist *rl) if ((ret = has_bad_sectors(resize)) != 0) { if (ret == -1) perr_exit("Couldn't convert string to Unicode"); - err_exit("Device has bad sectors, not supported yet.\n"); + err_exit("Your disk has bad sectors (manufacturing faults or " + "dying disk).\nThis situation isn't supported yet.\n"); } if (NInoAttrList(resize->ni)) { @@ -727,8 +735,14 @@ static void build_lcn_usage_bitmap(ntfs_resize_t *resize) if (!a->non_resident) return; - if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) - perr_exit("ntfs_decompress_mapping_pairs"); + if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) { + int err = errno; + perr_printf("ntfs_decompress_mapping_pairs"); + if (err == EIO) + printf(corrupt_volume_msg); + exit(1); + } + for (i = 0; rl[i].length; i++) { s64 lcn = rl[i].lcn; @@ -855,11 +869,10 @@ static void compare_bitmaps(struct bitmap *a) } if (mismatch) { - printf("Totally %d cluster accounting mismatches.\n", - mismatch); - err_exit("Filesystem check failed! Windows wasn't shutdown " - "properly or inconsistent\nfilesystem. Please run " - "chkdsk /f on Windows.\n"); + err_printf("Filesystem check failed! Totally %d cluster " + "accounting mismatches.\n", mismatch); + printf(corrupt_volume_msg); + exit(1); } } @@ -1886,8 +1899,7 @@ static void mount_volume(void) if (err == EINVAL) printf(invalid_ntfs_msg, opt.volume); else if (err == EIO) - printf("Apparently you have a corrupted volume. " - "Please run chkdsk /f and try again!\n"); + printf(corrupt_volume_msg); exit(1); } @@ -2045,11 +2057,10 @@ int main(int argc, char **argv) walk_inodes(&resize); if (resize.multi_ref) { - printf("Totally %d clusters referenced multiply times.\n", - resize.multi_ref); - err_exit("Filesystem check failed! Windows wasn't shutdown " - "properly or inconsistent\nfilesystem. Please run " - "chkdsk /f on Windows.\n"); + err_printf("Filesystem check failed! Totally %d clusters " + "referenced multiply times.\n", resize.multi_ref); + printf(corrupt_volume_msg); + exit(1); } compare_bitmaps(&lcn_bitmap); From b1f825493040745cdb74bcbf7a9122768d46f4c7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 22 Mar 2004 10:42:38 +0000 Subject: [PATCH 1273/2994] Remove the FIXME in ntfs_attr_lookup() and complete the implementation of ntfs_external_attr_find() so it now returns the attribute list attribute position at which the attribute should be inserted in @ctx->al_entry (see descritpion for ntfs_attr_lookup() in attrib.c for details). (Logical change 1.343) --- libntfs/attrib.c | 115 ++++++++++++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 46 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 77b4c4a8..cdd36163 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1493,9 +1493,10 @@ static int ntfs_attr_find(const ATTR_TYPES type, const uchar_t *name, * attribute described by the attribute list of the base mft record described * by the search context @ctx. * - * If @type is AT_END, seek to the end and return -1 with errno set to ENOENT. - * AT_END is not a valid attribute, its length is zero for example, thus it is - * safer to return error instead of success in this case. + * If @type is AT_END, seek to the end of the base mft record ignoring the + * attribute list completely and return -1 with errno set to ENOENT. AT_END is + * not a valid attribute, its length is zero for example, thus it is safer to + * return error instead of success in this case. * * If @name is AT_UNNAMED search for an unnamed attribute. If @name is present * but not AT_UNNAMED search for a named attribute matching @name. Otherwise, @@ -1513,19 +1514,21 @@ static int ntfs_attr_find(const ATTR_TYPES type, const uchar_t *name, * Return 0 if the search was successful and -1 if not, with errno set to the * error code. * - * On success, @ctx->attr is the found attribute and it is in mft record - * @ctx->mrec. + * On success, @ctx->attr is the found attribute, it is in mft record + * @ctx->mrec, and @ctx->al_entry is the attribute list entry for this + * attribute with @ctx->base_* being the base mft record to which @ctx->attr + * belongs. * - * On error, @ctx->attr is the attribute which collates just after the attribute - * being searched for in the base ntfs inode, i.e. if one wants to add the - * attribute to the mft record this is the correct place to insert it into, - * and if there is not enough space, the attribute should be placed in an - * extent mft record. @ctx->al_entry points to the position within - * @ctx->base_ntfs_ino->attr_list at which the new attribute's attribute list - * entry should be inserted. - * - * FIXME: This is how it should be but unfortunately the current code sets - * @ctx->al_entry to NULL, so beware! (AIA) + * On error ENOENT, i.e. attribute not found, @ctx->attr is set to the + * attribute which collates just after the attribute being searched for in the + * base ntfs inode, i.e. if one wants to add the attribute to the mft record + * this is the correct place to insert it into, and if there is not enough + * space, the attribute should be placed in an extent mft record. + * @ctx->al_entry points to the position within @ctx->base_ntfs_ino->attr_list + * at which the new attribute's attribute list entry should be inserted. The + * other @ctx fields, base_ntfs_ino, base_mrec, and base_attr are set to NULL. + * The only exception to this is when @type is AT_END, in which case + * @ctx->al_entry is set to NULL also (see above). * * The following error codes are defined: * ENOENT Attribute not found, not an error as such. @@ -1555,11 +1558,10 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const uchar_t *name, /* First call happens with the base mft record. */ base_ni = ctx->base_ntfs_ino = ctx->ntfs_ino; ctx->base_mrec = ctx->mrec; + ctx->base_attr = ctx->attr; } if (type == AT_END) goto not_found; - if (ni == base_ni) - ctx->base_attr = ctx->attr; vol = base_ni->vol; al_start = base_ni->attr_list; al_end = al_start + base_ni->attr_list_size; @@ -1831,21 +1833,36 @@ do_next_attr: return -1; not_found: /* - * The attribute wasn't found. Before we return, we want to ensure - * ctx->mrec and ctx->attr indicate the position at which the attribute - * should be inserted in the base mft record. + * If we were looking for AT_END or we were enumerating and reached the + * end, we reset the search context @ctx and use ntfs_attr_find() to + * seek to the end of the base mft record. */ - /* Rewind the current search so ntfs_attr_find() is happy. */ - ntfs_attr_reinit_search_ctx(ctx); - /* - * If we were enumerating and reached the end, we can't just use @type - * because that would return the first attribute instead of the last - * one. Thus we just use AT_END which causes ntfs_attr_find() to seek - * to the end. - */ - if (type == AT_UNUSED) + if (type == AT_UNUSED || type == AT_END) { + ntfs_attr_reinit_search_ctx(ctx); return ntfs_attr_find(AT_END, name, name_len, ic, val, val_len, ctx); + } + /* + * The attribute wasn't found. Before we return, we want to ensure + * @ctx->mrec and @ctx->attr indicate the position at which the + * attribute should be inserted in the base mft record. Since we also + * want to preserve @ctx->al_entry we cannot reinitialize the search + * context using ntfs_attr_reinit_search_ctx() as this would set + * @ctx->al_entry to NULL. Thus we do the necessary bits manually (see + * ntfs_attr_init_search_ctx() below). Note, we _only_ preserve + * @ctx->al_entry as the remaining fields (base_*) are identical to + * their non base_ counterparts and we cannot set @ctx->base_attr + * correctly yet as we do not know what @ctx->attr will be set to by + * the call to ntfs_attr_find() below. + */ + ctx->mrec = ctx->base_mrec; + ctx->attr = (ATTR_RECORD*)((u8*)ctx->mrec + + le16_to_cpu(ctx->mrec->attrs_offset)); + ctx->is_first = TRUE; + ctx->ntfs_ino = ctx->base_ntfs_ino; + ctx->base_ntfs_ino = NULL; + ctx->base_mrec = NULL; + ctx->base_attr = NULL; /* * In case there are multiple matches in the base mft record, need to * keep enumerating until we get an attribute not found response (or @@ -1889,11 +1906,12 @@ not_found: * successful call of ntfs_attr_lookup() will return the next attribute, with * the current attribute being described by the search context @ctx. * - * If @type is AT_END, seek to the end of the attribute and return -1 with - * errno set to ENOENT. AT_END is not a valid attribute, its length is zero for - * example, thus it is safer to return error instead of success in this case. - * It should never ne needed to do this, but we implement the functionality - * because it allows for simpler code inside ntfs_external_attr_find(). + * If @type is AT_END, seek to the end of the base mft record ignoring the + * attribute list completely and return -1 with errno set to ENOENT. AT_END is + * not a valid attribute, its length is zero for example, thus it is safer to + * return error instead of success in this case. It should never ne needed to + * do this, but we implement the functionality because it allows for simpler + * code inside ntfs_external_attr_find(). * * If @name is AT_UNNAMED search for an unnamed attribute. If @name is present * but not AT_UNNAMED search for a named attribute matching @name. Otherwise, @@ -1906,17 +1924,23 @@ not_found: * Return 0 if the search was successful and -1 if not, with errno set to the * error code. * - * On success, @ctx->attr is the found attribute and it is in mft record - * @ctx->mrec. + * On success, @ctx->attr is the found attribute, it is in mft record + * @ctx->mrec, and @ctx->al_entry is the attribute list entry for this + * attribute with @ctx->base_* being the base mft record to which @ctx->attr + * belongs. If no attribute list attribute is present @ctx->al_entry and + * @ctx->base_* are NULL. * - * On error, @ctx->attr is the attribute which collates just after the attribute - * being searched for, i.e. if one wants to add the attribute to the mft - * record this is the correct place to insert it into. @ctx->al_entry points to - * the position within @ctx->base_ntfs_ino->attr_list at which the new - * attribute's attribute list entry should be inserted. + * On error ENOENT, i.e. attribute not found, @ctx->attr is set to the + * attribute which collates just after the attribute being searched for in the + * base ntfs inode, i.e. if one wants to add the attribute to the mft record + * this is the correct place to insert it into, and if there is not enough + * space, the attribute should be placed in an extent mft record. + * @ctx->al_entry points to the position within @ctx->base_ntfs_ino->attr_list + * at which the new attribute's attribute list entry should be inserted. The + * other @ctx fields, base_ntfs_ino, base_mrec, and base_attr are set to NULL. + * The only exception to this is when @type is AT_END, in which case + * @ctx->al_entry is set to NULL also (see above). * - * FIXME: This is how it should be but unfortunately the current code sets - * @ctx->al_entry to NULL, so beware! (AIA) * * The following error codes are defined: * ENOENT Attribute not found, not an error as such. @@ -1963,8 +1987,7 @@ static __inline__ void ntfs_attr_init_search_ctx(ntfs_attr_search_ctx *ctx, mrec = ni->mrec; ctx->mrec = mrec; /* Sanity checks are performed elsewhere. */ - ctx->attr = (ATTR_RECORD*)((char*)mrec + - le16_to_cpu(mrec->attrs_offset)); + ctx->attr = (ATTR_RECORD*)((u8*)mrec + le16_to_cpu(mrec->attrs_offset)); ctx->is_first = TRUE; ctx->ntfs_ino = ni; ctx->al_entry = NULL; @@ -1988,7 +2011,7 @@ void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx) /* No attribute list. */ ctx->is_first = TRUE; /* Sanity checks are performed elsewhere. */ - ctx->attr = (ATTR_RECORD*)((char*)ctx->mrec + + ctx->attr = (ATTR_RECORD*)((u8*)ctx->mrec + le16_to_cpu(ctx->mrec->attrs_offset)); return; } /* Attribute list. */ From 785e4e2c63fb5207c68f393f5ff73b21176f5a62 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 22 Mar 2004 10:42:38 +0000 Subject: [PATCH 1274/2994] Remove the FIXME in ntfs_attr_lookup() and complete the implementation of ntfs_external_attr_find() so it now returns the attribute list attribute position at which the attribute should be inserted in @ctx->al_entry (see descritpion for ntfs_attr_lookup() in attrib.c for details). BKrev: 405ec31eBCw-_Ae0uZ9LjtFRYtH3XA From 9661074cdb3d959117618562aa5851cf03fb70ac Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 22 Mar 2004 10:42:38 +0000 Subject: [PATCH 1275/2994] Update (Logical change 1.343) --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0be725b3..1bc85a2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,11 @@ - Support the case where $Volume does not have a $VOLUME_NAME attribute in ntfs_device_mount() and let ntfslabel create the attribute when it is not present. + - Remove the FIXME in ntfs_attr_lookup() and complete the + implementation of ntfs_external_attr_find() so it now returns the + attribute list attribute position at which the attribute should be + inserted in @ctx->al_entry (see descritpion for ntfs_attr_lookup() in + attrib.c for details). 11/03/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From 5154256c62396c79d886ed26a4ab995203b6b4b8 Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Tue, 23 Mar 2004 02:00:56 +0000 Subject: [PATCH 1276/2994] - Check the mount state of the output device in ntfsclone. - Correct a too strong sanity check in ntfsclone that prevented cloning from larger device to a smaller one but the NTFS image could have fit fully. (Logical change 1.344) --- ntfsprogs/ntfsclone.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 1f244f19..e95933d2 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -845,6 +845,23 @@ static void print_disk_usage(ntfs_walk_clusters_ctx *image) Printf("\n"); } +static void check_if_mounted(const char *device, unsigned long new_mntflag) +{ + unsigned long mntflag; + + if (ntfs_check_if_mounted(device, &mntflag)) + perr_exit("Failed to check '%s' mount state", device); + + if (mntflag & NTFS_MF_MOUNTED) { + if (!(mntflag & NTFS_MF_READONLY)) + err_exit("Device %s is mounted read-write. " + "You must 'umount' it first.\n", device); + if (!new_mntflag) + err_exit("Device %s is mounted. " + "You must 'umount' it first.\n", device); + } +} + /** * First perform some checks to determine if the volume is already mounted, or * is dirty (Windows wasn't shutdown properly). If everything is OK, then mount @@ -852,20 +869,8 @@ static void print_disk_usage(ntfs_walk_clusters_ctx *image) */ static void mount_volume(unsigned long new_mntflag) { - unsigned long mntflag; + check_if_mounted(opt.volume, new_mntflag); - if (ntfs_check_if_mounted(opt.volume, &mntflag)) - perr_exit("Failed to check '%s' mount state", opt.volume); - - if (mntflag & NTFS_MF_MOUNTED) { - if (!(mntflag & NTFS_MF_READONLY)) - err_exit("Device %s is mounted read-write. " - "You must 'umount' it first.\n", opt.volume); - if (!new_mntflag) - err_exit("Device %s is mounted. " - "You must 'umount' it first.\n", opt.volume); - } - if (!(vol = ntfs_mount(opt.volume, new_mntflag))) { int err = errno; @@ -1008,7 +1013,7 @@ int main(int argc, char **argv) } if ((fd_out = open(opt.output, flags, S_IRWXU)) == -1) - perr_exit("opening file '%s' failed", opt.output); + perr_exit("Opening file '%s' failed", opt.output); if (!opt.blkdev_out) { struct statfs stfs; @@ -1028,9 +1033,13 @@ int main(int argc, char **argv) opt.output); } else { s64 dest_size = device_size_get(fd_out); - if (dest_size < device_size) + s64 ntfs_size = vol->nr_clusters * vol->cluster_size; + ntfs_size += 512; /* add backup boot sector */ + if (dest_size < ntfs_size) err_exit("Output device size (%lld) is too small" - " to fit an NTFS clone\n", dest_size); + " to fit the NTFS image.\n", dest_size); + + check_if_mounted(opt.output, 0); } } From c6ad3f570d39096f35e4ca546be0eef2eb51ed41 Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Tue, 23 Mar 2004 02:00:56 +0000 Subject: [PATCH 1277/2994] - Check the mount state of the output device in ntfsclone. - Correct a too strong sanity check in ntfsclone that prevented cloning from larger device to a smaller one but the NTFS image could have fit fully. - Added a few (hopefully) better explanatory messages to ntfsresize. (Logical change 1.344) --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1bc85a2d..46e14af7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,11 @@ attribute list attribute position at which the attribute should be inserted in @ctx->al_entry (see descritpion for ntfs_attr_lookup() in attrib.c for details). + - Check the mount state of the output device in ntfsclone. + - Correct a too strong sanity check in ntfsclone that prevented + cloning from larger device to a smaller one but the NTFS image + could have fit fully. + - Added a few (hopefully) better explanatory messages to ntfsresize. 11/03/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From 2ef925e0feedfc9bc8e6700b141ee985ccbf8283 Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Tue, 23 Mar 2004 02:00:56 +0000 Subject: [PATCH 1278/2994] - Check the mount state of the output device in ntfsclone. - Correct a too strong sanity check in ntfsclone that prevented cloning from larger device to a smaller one but the NTFS image could have fit fully. - ChangeLog update BKrev: 405f9a58_jCkCGrW1BbZ2Ynhw8S22Q From c5a065d0486f8c99821085894eb32c5a745981fa Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 10:36:31 +0000 Subject: [PATCH 1279/2994] - Add new API device.[hc]::ntfs_device_heads_get() and make mkntfs use it. - Provide a new command line option "-H" to mkntfs to allow the user to specify the number of heads manually. - Add new API device.[hc]::ntfs_device_sectors_per_track_get() and make mkntfs use it. - Provide a new command line option "-S" to mkntfs to allow the user to specify the number of sectors per track manually. (Logical change 1.345) --- ntfsprogs/mkntfs.c | 109 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 95 insertions(+), 14 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 4720a82d..c63f1910 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -161,6 +161,9 @@ char *dev_name; struct { int sector_size; /* -s, in bytes, power of 2, default is 512 bytes. */ + int sectors_per_track; /* number of sectors per track on + device */ + int heads; /* number of heads on device */ long long part_start_sect; /* start sector of partition on parent device */ long long nr_sectors; /* size of device in sectors */ @@ -289,6 +292,10 @@ static void usage(void) "for the device\n" " -p part-start-sect Specify the partition " "start sector\n" + " -H heads Specify the number of " + "heads\n" + " -S sectors-per-track Specify the number of " + "sectors per track\n" " -c cluster-size Specify the cluster " "size for the volume\n" " -L volume-label Set the volume label\n" @@ -338,7 +345,7 @@ static void parse_options(int argc, char *argv[]) break; case 'c': l = strtol(optarg, &s, 0); - if (!l || l > INT_MAX || *s) + if (l <= 0 || l > INT_MAX || *s) err_exit("Invalid cluster size.\n"); vol->cluster_size = l; break; @@ -348,20 +355,29 @@ static void parse_options(int argc, char *argv[]) break; case 'p': u = strtoul(optarg, &s, 0); + if ((u >= ULONG_MAX && errno == ERANGE) || *s) + err_exit("Invalid partition start sector.\n"); opts.part_start_sect = u; - if ((u >= ULONG_MAX && errno == ERANGE) || *s || - (opts.part_start_sect >> 32)) - err_exit("Invalid partition start sector: %s " - "Maximum is 4294967295 " - "(2^32-1).\n", - optarg); + break; + case 'H': + l = strtol(optarg, &s, 0); + if (l <= 0 || l > INT_MAX || *s) + err_exit("Invalid number of heads.\n"); + opts.heads = l; + break; + case 'S': + l = strtol(optarg, &s, 0); + if (l <= 0 || l > INT_MAX || *s) + err_exit("Invalid number of sectors per " + "track.\n"); + opts.sectors_per_track = l; break; case 'q': opts.quiet = 1; break; case 's': l = strtol(optarg, &s, 0); - if (!l || l > INT_MAX || *s) + if (l <= 0 || l > INT_MAX || *s) err_exit("Invalid sector size.\n"); opts.sector_size = l; break; @@ -2462,6 +2478,8 @@ static int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, static void init_options(void) { memset(&opts, 0, sizeof(opts)); + opts.sectors_per_track = -1; + opts.heads = -1; opts.part_start_sect = -1; opts.index_block_size = 4096; opts.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; @@ -2676,19 +2694,77 @@ int main(int argc, char **argv) /* Reserve the last sector for the backup boot sector. */ opts.nr_sectors--; /* If user didn't specify the partition start sector, determine it. */ - if (opts.part_start_sect == -1) { + if (opts.part_start_sect < 0) { opts.part_start_sect = ntfs_device_partition_start_sector_get( vol->dev); if (opts.part_start_sect < 0) { Eprintf("No partition start sector specified for %s " "and it could not\nbe obtained " "automatically. Setting it to 0.\n" - "This will probably cause Windows not " - "to be able to boot from this " - "volume.\n", vol->dev->d_name); + "This will cause Windows not to be " + "able to boot from this volume.\n", + vol->dev->d_name); + opts.part_start_sect = 0; + } else if (opts.part_start_sect >> 32) { + Eprintf("No partition start sector specified for %s " + "and the automatically\ndetermined " + "value is too large. Setting it to 0." + " This will cause Windows not\nto be " + "able to boot from this volume.\n", + vol->dev->d_name); opts.part_start_sect = 0; } - } + } else if (opts.part_start_sect >> 32) + err_exit("Invalid partition start sector specified: %lli " + "Maximum is 4294967295 (2^32-1).\n", + opts.part_start_sect); + /* If user didn't specify the sectors per track, determine it now. */ + if (opts.sectors_per_track < 0) { + opts.sectors_per_track = + ntfs_device_sectors_per_track_get(vol->dev); + if (opts.sectors_per_track < 0) { + Eprintf("No number of sectors per track specified for " + "%s and\nit could not be obtained " + "automatically. Setting it to 0. " + "This will cause\nWindows not to be " + "able to boot from this volume.\n", + vol->dev->d_name); + opts.sectors_per_track = 0; + } else if (opts.sectors_per_track > 0xffff) { + Eprintf("No number of sectors per track specified for " + "%s and the automatically\ndetermined " + "value is too large. Setting it to 0." + " This will cause Windows not\nto be " + "able to boot from this volume.\n", + vol->dev->d_name); + opts.sectors_per_track = 0; + } + } else if (opts.sectors_per_track > 0xffff) + err_exit("Invalid number of sectors per track specified: %i " + "Maximum is 65535 (0xffff).\n", + opts.sectors_per_track); + /* If user didn't specify the number of heads, determine it now. */ + if (opts.heads < 0) { + opts.heads = ntfs_device_heads_get(vol->dev); + if (opts.heads < 0) { + Eprintf("No number of heads specified for %s and it " + "could not\nbe obtained automatically." + " Setting it to 0. This will cause " + "Windows not to\nbe able to boot from " + "this volume.\n", vol->dev->d_name); + opts.heads = 0; + } else if (opts.heads > 0xffff) { + Eprintf("No number of heads specified for %s and the " + "automatically\ndetermined value is " + "too large. Setting it to 0. This " + "will cause Windows not\nto be able " + "to boot from this volume.\n", + vol->dev->d_name); + opts.heads = 0; + } + } else if (opts.heads > 0xffff) + err_exit("Invalid number of heads specified: %i Maximum is " + "65535 (0xffff).\n", opts.heads); /* If user didn't specify the volume size, determine it now. */ if (!opts.volume_size) opts.volume_size = opts.nr_sectors * opts.sector_size; @@ -3314,8 +3390,13 @@ int main(int argc, char **argv) bs->bpb.sectors_per_cluster = (u8)(vol->cluster_size / opts.sector_size); bs->bpb.media_type = 0xf8; /* hard disk */ + bs->bpb.sectors_per_track = cpu_to_le16(opts.sectors_per_track); + Dprintf("sectors per track = %u (0x%x)\n", opts.sectors_per_track, + opts.sectors_per_track); + bs->bpb.heads = cpu_to_le16(opts.heads); + Dprintf("heads = %u (0x%x)\n", opts.heads, opts.heads); bs->bpb.hidden_sectors = cpu_to_le32(opts.part_start_sect); - Dprintf("hidden sectors = %lli (0x%llx)\n", opts.part_start_sect, + Dprintf("hidden sectors = %llu (0x%llx)\n", opts.part_start_sect, opts.part_start_sect); /* * If there are problems go back to bs->unused[0-3] and set them. See From b8c685fcc5e056ae48c0510e18dceeda48a756e8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 10:36:31 +0000 Subject: [PATCH 1280/2994] - Add new API device.[hc]::ntfs_device_heads_get() and make mkntfs use it. - Provide a new command line option "-H" to mkntfs to allow the user to specify the number of heads manually. - Add new API device.[hc]::ntfs_device_sectors_per_track_get() and make mkntfs use it. - Provide a new command line option "-S" to mkntfs to allow the user to specify the number of sectors per track manually. BKrev: 406164afQ_1Kz39PXlQ36g3TtdL3dw From 559786d6c98cdfa4ec20323a56b0448205fe2450 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 10:36:31 +0000 Subject: [PATCH 1281/2994] - Add new API ntfs_device_heads_get() and ntfs_device_sectors_per_track_get(). (Logical change 1.345) --- libntfs/device.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/libntfs/device.c b/libntfs/device.c index d0450c58..3b4d8fe4 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -458,10 +458,17 @@ static inline int ntfs_device_offset_valid(struct ntfs_device *dev, s64 ofs) * open device @dev. * * Adapted from e2fsutils-1.19, Copyright (C) 1995 Theodore Ts'o. + * + * On error return -1 with errno set to the error code. */ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) { s64 high, low; + + if (!dev || block_size <= 0 || (block_size - 1) & block_size) { + errno = EINVAL; + return -1; + } #ifdef BLKGETSIZE64 { u64 size; @@ -520,11 +527,16 @@ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) * block device of @dev. On error return -1 with errno set to the error code. * * The following error codes are defined: + * EINVAL Input parameter error * ENOTSUP System does not support HDIO_GETGEO ioctl * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO */ s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev) { + if (!dev) { + errno = EINVAL; + return -1; + } #ifdef HDIO_GETGEO { struct hd_geometry geo; @@ -539,3 +551,71 @@ s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev) #endif return -1; } + +/** + * ntfs_device_heads_get - get number of heads of device + * @dev: open device + * + * On success, return the number of heads on the device @dev. On error return + * -1 with errno set to the error code. + * + * The following error codes are defined: + * EINVAL Input parameter error + * ENOTSUP System does not support HDIO_GETGEO ioctl + * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO + */ +int ntfs_device_heads_get(struct ntfs_device *dev) +{ + if (!dev) { + errno = EINVAL; + return -1; + } +#ifdef HDIO_GETGEO + { struct hd_geometry geo; + + if (!dev->d_ops->ioctl(dev, HDIO_GETGEO, &geo)) { + Dprintf("HDIO_GETGEO heads = %u (0x%x)\n", + (unsigned)geo.heads, + (unsigned)geo.heads); + return geo.heads; + } + } +#else + errno = ENOTSUP; +#endif + return -1; +} + +/** + * ntfs_device_sectors_per_track_get - get number of sectors per track of device + * @dev: open device + * + * On success, return the number of sectors per track on the device @dev. On + * error return -1 with errno set to the error code. + * + * The following error codes are defined: + * EINVAL Input parameter error + * ENOTSUP System does not support HDIO_GETGEO ioctl + * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO + */ +int ntfs_device_sectors_per_track_get(struct ntfs_device *dev) +{ + if (!dev) { + errno = EINVAL; + return -1; + } +#ifdef HDIO_GETGEO + { struct hd_geometry geo; + + if (!dev->d_ops->ioctl(dev, HDIO_GETGEO, &geo)) { + Dprintf("HDIO_GETGEO sectors_per_track = %u (0x%x)\n", + (unsigned)geo.sectors, + (unsigned)geo.sectors); + return geo.sectors; + } + } +#else + errno = ENOTSUP; +#endif + return -1; +} From 16bc6199a6a43bf08a38981848ee37776c713851 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 10:36:31 +0000 Subject: [PATCH 1282/2994] - Provide a new command line option "-H" to mkntfs to allow the user to specify the number of heads manually. - Provide a new command line option "-S" to mkntfs to allow the user to specify the number of sectors per track manually. (Logical change 1.345) --- ntfsprogs/mkntfs.8.in | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 55bed95d..e1e84dec 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -17,6 +17,14 @@ mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system .I part-start-sect ] [ +.B \-H +.I heads +] +[ +.B \-S +.I sectors-per-track +] +[ .B \-c .I cluster-size ] @@ -94,7 +102,28 @@ omitted, .B mkntfs attempts to determine .I part-start-sect -automatically and if that fails a default of 0 is used. +automatically and if that fails a default of 0 is used. Note that +.I part-start-sect +is required for Windows to be able to boot from the created volume. +.TP +.BI \-H " heads" +Specify the number of heads. The maximum is 65535 (0xffff). If omitted, +.B mkntfs +attempts to determine the number of +.I heads +automatically and if that fails a default of 0 is used. Note that +.I heads +is required for Windows to be able to boot from the created volume. +.TP +.BI \-S " sectors-per-track" +Specify the number of sectors per track. The maximum is 65535 (0xffff). If +omitted, +.B mkntfs +attempts to determine the number of +.I sectors-per-track +automatically and if that fails a default of 0 is used. Note that +.I sectors-per-track +is required for Windows to be able to boot from the created volume. .TP .BI \-c " cluster-size" Specify the size of clusters in bytes. Valid cluster size values are powers of From c15c7b19a6e3edd9517f792ce84eb8f9bcd6150d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 10:36:31 +0000 Subject: [PATCH 1283/2994] Add export for ntfs_attrlist_entry_rm(). -- Not implemented yet. (Logical change 1.345) --- include/ntfs/attrlist.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/ntfs/attrlist.h b/include/ntfs/attrlist.h index 6fa3fa3c..fd3ed6c0 100644 --- a/include/ntfs/attrlist.h +++ b/include/ntfs/attrlist.h @@ -23,4 +23,8 @@ #ifndef _NTFS_ATTRLIST_H #define _NTFS_ATTRLIST_H +#include "attrib.h" + +extern int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx); + #endif /* defined _NTFS_ATTRLIST_H */ From d2ea0b8741e8dba7aada024c6d5a00407abfeb32 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 10:36:31 +0000 Subject: [PATCH 1284/2994] Add exports for ntfs_device_heads_get() and ntfs_device_sectors_per_track_get(). (Logical change 1.345) --- include/ntfs/device.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/ntfs/device.h b/include/ntfs/device.h index 4acd2896..4ca66af7 100644 --- a/include/ntfs/device.h +++ b/include/ntfs/device.h @@ -108,7 +108,8 @@ extern s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, const s64 count, const void *b); extern s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size); - extern s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev); +extern int ntfs_device_heads_get(struct ntfs_device *dev); +extern int ntfs_device_sectors_per_track_get(struct ntfs_device *dev); #endif /* defined _NTFS_DEVICE_H */ From 3e63b65e23297405a75417c4633e4a51591e9370 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 10:36:31 +0000 Subject: [PATCH 1285/2994] Add placeholder for ntfs_attrlist_entry_rm(). -- Not implemented yet. (Logical change 1.345) --- libntfs/attrlist.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 406a301d..98efe64a 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -22,17 +22,24 @@ #include "config.h" +#include + #include "types.h" #include "layout.h" #include "attrib.h" #include "attrlist.h" /** - * ntfs_ - . - * @: . + * ntfs_attrlist_entry_rm - remove an attribute list attribute entry + * @ctx: attribute search context describing the attrubute list entry * - * . + * Remove the attribute list entry @ctx->al_entry from the attribute list + * attribute of the base mft record to which the attribute @ctx->attr belongs. + * + * Return 0 on success and -1 on error with errno set to the error code. */ -static void ntfs_something_or_other(void) +int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) { + errno = ENOTSUP; + return -1; } From 59fb52eff19975e78d0e530e25601e15ee75dbee Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 10:36:31 +0000 Subject: [PATCH 1286/2994] Update (Logical change 1.345) --- ChangeLog | 8 ++++++++ include/ntfs/layout.h | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46e14af7..49c9a140 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,6 +45,14 @@ cloning from larger device to a smaller one but the NTFS image could have fit fully. - Added a few (hopefully) better explanatory messages to ntfsresize. + - Add new API device.[hc]::ntfs_device_heads_get() and make mkntfs use + it. + - Provide a new command line option "-H" to mkntfs to allow the user to + specify the number of heads manually. + - Add new API device.[hc]::ntfs_device_sectors_per_track_get() and make + mkntfs use it. + - Provide a new command line option "-S" to mkntfs to allow the user to + specify the number of sectors per track manually. 11/03/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index fab9205f..1f8329a1 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1,7 +1,7 @@ /* * layout.h - Ntfs on-disk layout structures. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -52,10 +52,11 @@ typedef struct { u16 sectors; /* zero */ u8 media_type; /* 0xf8 = hard disk */ u16 sectors_per_fat; /* zero */ - u16 sectors_per_track; /* irrelevant */ - u16 heads; /* irrelevant */ + u16 sectors_per_track; /* Required to boot Windows. */ + u16 heads; /* Required to boot Windows. */ u32 hidden_sectors; /* Offset to the start of the partition - relative to the disk in sectors. */ + relative to the disk in sectors. + Required to boot Windows. */ u32 large_sectors; /* zero */ /* sizeof() = 25 (0x19) bytes */ } __attribute__ ((__packed__)) BIOS_PARAMETER_BLOCK; From dfab5d3816335e7cf25df1a255b682d75841966b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 17:38:31 +0000 Subject: [PATCH 1287/2994] - Make ntfsdump_logfile.c use more libntfs APIs and other cleanups. - Remove dumplog utility as it was unnecessary and duplicated the functionality of ntfsdump_logfile. BKrev: 4061c797bAjIEeVlFZkuQQpkN2Zdgw From d37f75cfded8b4c0d30b4e0788b13b390f2c8776 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 17:38:31 +0000 Subject: [PATCH 1288/2994] Delete: ntfsprogs/dumplog.c }(Logical change 1.346) --- ntfsprogs/dumplog.c | 319 -------------------------------------------- 1 file changed, 319 deletions(-) delete mode 100644 ntfsprogs/dumplog.c diff --git a/ntfsprogs/dumplog.c b/ntfsprogs/dumplog.c deleted file mode 100644 index e48c92bf..00000000 --- a/ntfsprogs/dumplog.c +++ /dev/null @@ -1,319 +0,0 @@ -/** - * DumpLog - Part of the Linux-NTFS project. - * - * Copyright (c) 2000-2004 Anton Altaparmakov - * - * This utility will interpret the contents of the journal ($LogFile) specified - * on the command line and display the results on stdout. Errors will be output - * to stderr. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS source - * in the file COPYING); if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include - -#include "types.h" -#include "mst.h" -#include "logfile.h" - -const char *EXEC_NAME = "dumplog"; -const char *EXEC_VERSION = "1.0"; - -/** - * main - */ -int main(int argc, char **argv) -{ - s64 l, br; - unsigned char *lfd = NULL; - RESTART_PAGE_HEADER *rph; - RESTART_AREA *rr; - RESTART_CLIENT *cr; - RECORD_PAGE_HEADER *rcrd_ph; - LOG_RECORD *lr; - int pass = 1; - int i, lps, client; - int f = 0; - char zero[4096]; - struct stat sbuf; - - memset(zero, 0, sizeof(zero)); - printf("\n"); - if (argc != 2) { - printf("%s v%s - Interpret and display information about the " - "journal\ngiven on the command line.\n\n" - /* Generic copyright / disclaimer. */ - "Copyright (c) 2001 Anton Altaparmakov.\n\n" - "%s is free software, released under the GNU " - "General Public License\nand you are welcome to " - "redistribute it under certain conditions.\n" - "%s comes with ABSOLUTELY NO WARRANTY; for details " - "read the GNU\nGeneral Public License to be found " - "in the file COPYING in the main Linux-NTFS\n" - "distribution directory.\n\n" - /* Generic part ends here. */ - "Syntax: dumplog log_file_name\n" - " e.g. dumplog /mnt/ntfstest/\\$LogFile\n\n", - EXEC_NAME, EXEC_VERSION, EXEC_NAME, EXEC_NAME); - fprintf(stderr, "Error: incorrect syntax\n"); - exit(1); - } - if (stat(argv[1], &sbuf) == -1) { - if (errno == ENOENT) - fprintf(stderr, "The file doesn't exist; did you " - "specify it correctly?\n"); - else - fprintf(stderr, "Error getting information about %s: " - "%s\n", argv[1], strerror(errno)); - exit(1); - } - f = open(argv[1], O_RDONLY); - if (f == -1) { - perror("Couldn't open file"); - exit(1); - } - l = sbuf.st_size; - if (l > 0x400000LL) { - printf("Only analysing the first four megabytes of the " - "logfile (real size = 0x%llx).\n", - (unsigned long long)l); - l = 0x400000LL; - } - lfd = (unsigned char*)calloc(1, l); - if (!lfd) { - perror("Couldn't allocate internal buffer"); - goto log_file_error; - } - /* Read in the $LogFile into the buffer. */ - if ((br = read(f, lfd, l)) == -1) { - perror("Couldn't read file"); - goto log_file_error; - } - /* Valid data length in buffer. */ - l = min(br, l); - /* Check restart area. */ - if (!ntfs_is_rstr_recordp(lfd)) { - s64 _l; - - for (_l = 0LL; _l < l; _l++) - if (lfd[_l] != (unsigned char)-1) - break; - if (_l < l) - puts("Logfile contents are corrupt (magic RSTR " - "missing)!"); - else - puts("Logfile is empty."); - goto log_file_error; - } - /* Do the interpretation and display now. */ - rph = (RESTART_PAGE_HEADER*)lfd; - lps = le32_to_cpu(rph->log_page_size); -pass_loc: - if (ntfs_mst_post_read_fixup((NTFS_RECORD*)rph, lps) || - ntfs_is_baad_record(rph->magic)) { - puts("Logfile incomplete multi sector transfer detected! " - "Cannot handle this yet!"); - goto log_file_error; - } - if ((pass == 2) && !memcmp(lfd, rph, lps)) { - printf("2nd restart area fully matches the 1st one. Skipping " - "display.\n"); - goto skip_rstr_pass; - } - if (le16_to_cpu(rph->major_ver != 1) || - le16_to_cpu(rph->minor_ver != 1)) { - fprintf(stderr, "$LogFile version %i.%i! Error: Unknown " - "$LogFile version!\n", - le16_to_cpu(rph->major_ver), - le16_to_cpu(rph->minor_ver)); - goto log_file_error; - } - rr = (RESTART_AREA*)((char*)rph + le16_to_cpu(rph->restart_offset)); - cr = (RESTART_CLIENT*)((char*)rr + - le16_to_cpu(rr->client_array_offset)); - /* Dump of the interpreted $LogFile restart area. */ - if (pass == 1) - printf("\n$LogFile version %i.%i.\n", - le16_to_cpu(rph->major_ver), - le16_to_cpu(rph->minor_ver)); - printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); - printf("magic = RSTR\n"); - printf("ChkDskLsn = 0x%llx\n", - (unsigned long long)sle64_to_cpu(rph->chkdsk_lsn)); - printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); - printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); - printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); - printf("\n(1st) restart record:\n"); - printf("CurrentLsn = %llx\n", - (unsigned long long)sle64_to_cpu(rr->current_lsn)); - printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); - printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); - printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); - printf("Flags = 0x%x\n", le16_to_cpu(rr->flags)); - printf("SeqNumberBits = %u (0x%x)\n", le32_to_cpu(rr->seq_number_bits), - le32_to_cpu(rr->seq_number_bits)); - printf("RestartAreaLength = 0x%x\n", - le16_to_cpu(rr->restart_area_length)); - printf("ClientArrayOffset = 0x%x\n", - le16_to_cpu(rr->client_array_offset)); - printf("FileSize = %lld (0x%llx)\n", - (long long)sle64_to_cpu(rr->file_size), - (unsigned long long)sle64_to_cpu(rr->file_size)); - printf("LastLsnDataLength = 0x%x\n", - le32_to_cpu(rr->last_lsn_data_length)); - printf("RecordLength = 0x%x\n", le16_to_cpu(rr->record_length)); - printf("LogPageDataOffset = 0x%x\n", - le16_to_cpu(rr->log_page_data_offset)); - for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { - printf("\nRestart client record number %i:\n", client); - printf("OldestLsn = 0x%llx\n", (unsigned long long) - sle64_to_cpu(cr->oldest_lsn)); - printf("ClientRestartLsn = 0x%llx\n", (unsigned long long) - sle64_to_cpu(cr->client_restart_lsn)); - printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); - printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); - printf("SeqNumber = 0x%llx\n", (unsigned long long) - le64_to_cpu(cr->seq_number)); - printf("ClientNameLength = 0x%x\n", - le32_to_cpu(cr->client_name_length)); - if (le32_to_cpu(cr->client_name_length)) { - // convert to ascii and print out. - // printf("ClientName = %u\n", le16_to_cpu(cr->client_name)); - } - /* Size of a restart client record is fixed at 0xa0 bytes. */ - cr = (RESTART_CLIENT*)((char*)cr + 0xa0); - } -skip_rstr_pass: - if (pass == 1) { - rph = (RESTART_PAGE_HEADER*)((char*)rph + lps); - ++pass; - goto pass_loc; - } - rcrd_ph = (RECORD_PAGE_HEADER*)rph; - /* Reuse pass for log record clienter. */ - pass = 0; - printf("\nFinished with restart area. Beginning with log area.\n"); -rcrd_pass_loc: - rcrd_ph = (RECORD_PAGE_HEADER*)((char*)rcrd_ph + lps); - if ((char*)rcrd_ph + lps > (char*)lfd + l) - goto end_of_rcrd_passes; - printf("\nLog record page number %i", pass); - if (!ntfs_is_rcrd_record(rcrd_ph->magic)) { - for (i = 0; i < lps; i++) - if (((char*)rcrd_ph)[i] != (char)-1) - break; - if (i < lps) - puts(" is corrupt (magic RCRD is missing)."); - else - puts(" is empty."); - pass++; - goto rcrd_pass_loc; - } else - printf(":"); - /* Dump log record page */ - printf("\nmagic = RCRD\n"); - printf("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long) - le64_to_cpu(rcrd_ph->copy.last_lsn)); - printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); - printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); - printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); - printf("header.next_record_offset = 0x%llx\n", (unsigned long long) - le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); - printf("header.last_end_lsn = 0x%llx\n", (unsigned long long) - le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); - /* - * Where does the 0x40 come from? Is it just usa_offset + - * usa_client * 2 + 7 & ~7 or is it derived from somewhere? - */ - lr = (LOG_RECORD*)((char*)rcrd_ph + 0x40); - client = 0; -log_record_pass: - printf("\nLog record %i:\n", client); - printf("this lsn = 0x%llx\n", - (unsigned long long)le64_to_cpu(lr->this_lsn)); - printf("client previous lsn = 0x%llx\n", (unsigned long long) - le64_to_cpu(lr->client_previous_lsn)); - printf("client undo next lsn = 0x%llx\n", (unsigned long long) - le64_to_cpu(lr->client_undo_next_lsn)); - printf("client data length = 0x%x\n", - le32_to_cpu(lr->client_data_length)); - printf("client_id.seq_number = 0x%x\n", - le16_to_cpu(lr->client_id.seq_number)); - printf("client_id.client_index = 0x%x\n", - le16_to_cpu(lr->client_id.client_index)); - printf("record type = 0x%x\n", le32_to_cpu(lr->record_type)); - printf("transaction_id = 0x%x\n", le32_to_cpu(lr->transaction_id)); - printf("flags = 0x%x:", lr->flags); - if (!lr->flags) - printf(" NONE\n"); - else { - int _b = 0; - - if (lr->flags & LOG_RECORD_MULTI_PAGE) { - printf(" LOG_RECORD_MULTI_PAGE"); - _b = 1; - } - if (lr->flags & ~LOG_RECORD_MULTI_PAGE) { - if (_b) - printf(" |"); - printf(" Unknown flags"); - } - printf("\n"); - } - printf("redo_operation = 0x%x\n", le16_to_cpu(lr->redo_operation)); - printf("undo_operation = 0x%x\n", le16_to_cpu(lr->undo_operation)); - printf("redo_offset = 0x%x\n", le16_to_cpu(lr->redo_offset)); - printf("redo_length = 0x%x\n", le16_to_cpu(lr->redo_length)); - printf("undo_offset = 0x%x\n", le16_to_cpu(lr->undo_offset)); - printf("undo_length = 0x%x\n", le16_to_cpu(lr->undo_length)); - printf("target_attribute = 0x%x\n", le16_to_cpu(lr->target_attribute)); - printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); - printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); - printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); - printf("target_vcn = 0x%llx\n", - (unsigned long long)sle64_to_cpu(lr->target_vcn)); - if (le16_to_cpu(lr->lcns_to_follow) > 0) - printf("Array of lcns:\n"); - for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) - printf("lcn_list[%i].lcn = 0x%llx\n", i, (unsigned long long) - sle64_to_cpu(lr->lcn_list[i].lcn)); - client++; - lr = (LOG_RECORD*)((char*)lr + 0x70); - if (((char*)lr + 0x70 <= (char*)rcrd_ph + - le64_to_cpu(rcrd_ph->header.packed.next_record_offset))) - goto log_record_pass; - pass++; - goto rcrd_pass_loc; -end_of_rcrd_passes: -log_file_error: - printf("\n"); - /* Set return code to 0. */ - i = 0; - if (lfd) - free(lfd); - if (f) - close(f); - return i; -} - From 163f9002b7109fa5e2615eeb585622eef6fa8c6d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 17:38:31 +0000 Subject: [PATCH 1289/2994] Remove dumplog utility as it was unnecessary and duplicated the functionality of ntfsdump_logfile. (Logical change 1.346) --- ntfsprogs/Makefile.am | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 1976407f..16f62c56 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -13,7 +13,7 @@ LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone -EXTRA_PROGRAMS = ntfsdump_logfile dumplog ntfswipe ntfstruncate ntfsmove +EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ @@ -85,10 +85,6 @@ ntfsdump_logfile_SOURCES= ntfsdump_logfile.c ntfsdump_logfile_LDADD = $(AM_LIBS) ntfsdump_logfile_LDFLAGS= $(AM_LFLAGS) -dumplog_SOURCES = dumplog.c -dumplog_LDADD = $(AM_LIBS) -dumplog_LDFLAGS = $(AM_LFLAGS) - # Extra targets strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) From ad18c0bac953df2a328ce4c98b0d184255123d3c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 17:38:31 +0000 Subject: [PATCH 1290/2994] Update (Logical change 1.346) --- ChangeLog | 4 ++++ ntfsprogs/Makefile.in | 38 +++++++++++++------------------------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49c9a140..57438a01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -53,6 +53,10 @@ mkntfs use it. - Provide a new command line option "-S" to mkntfs to allow the user to specify the number of sectors per track manually. + - Remove dumplog utility as it was unnecessary and duplicated the + functionality of ntfsdump_logfile. + - Cleanup ntfsdump_logfile utility to use more libntfs APIs and other + cleanups. 11/03/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index ca6c21c4..969f31ee 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) +SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -41,8 +41,8 @@ bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ ntfsls$(EXEEXT) ntfscat$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) -EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) dumplog$(EXEEXT) \ - ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) +EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) ntfswipe$(EXEEXT) \ + ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) subdir = ntfsprogs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/mkntfs.8.in $(srcdir)/ntfscat.8.in \ @@ -64,16 +64,13 @@ am__installdirs = $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir) binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) -am_dumplog_OBJECTS = dumplog.$(OBJEXT) -dumplog_OBJECTS = $(am_dumplog_OBJECTS) +am_mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ + sd.$(OBJEXT) mkntfs.$(OBJEXT) utils.$(OBJEXT) +mkntfs_OBJECTS = $(am_mkntfs_OBJECTS) @REALLYSTATIC_FALSE@am__DEPENDENCIES_1 = \ @REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@am__DEPENDENCIES_1 = \ @REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a -dumplog_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ - sd.$(OBJEXT) mkntfs.$(OBJEXT) utils.$(OBJEXT) -mkntfs_OBJECTS = $(am_mkntfs_OBJECTS) mkntfs_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfscat_OBJECTS = ntfscat.$(OBJEXT) utils.$(OBJEXT) ntfscat_OBJECTS = $(am_ntfscat_OBJECTS) @@ -120,9 +117,8 @@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrdef.Po ./$(DEPDIR)/boot.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/cluster.Po ./$(DEPDIR)/dumplog.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/mkntfs.Po ./$(DEPDIR)/ntfscat.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsclone.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/cluster.Po ./$(DEPDIR)/mkntfs.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfscat.Po ./$(DEPDIR)/ntfsclone.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfscluster.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsdump_logfile.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsfix.Po ./$(DEPDIR)/ntfsinfo.Po \ @@ -138,14 +134,13 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ - $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) \ - $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ - $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ - $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) \ +SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) \ + $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) \ + $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) \ + $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) \ $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ $(ntfswipe_SOURCES) -DIST_SOURCES = $(dumplog_SOURCES) $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ +DIST_SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) \ $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ @@ -329,9 +324,6 @@ ntfswipe_LDFLAGS = $(AM_LFLAGS) ntfsdump_logfile_SOURCES = ntfsdump_logfile.c ntfsdump_logfile_LDADD = $(AM_LIBS) ntfsdump_logfile_LDFLAGS = $(AM_LFLAGS) -dumplog_SOURCES = dumplog.c -dumplog_LDADD = $(AM_LIBS) -dumplog_LDFLAGS = $(AM_LFLAGS) all: all-am .SUFFIXES: @@ -443,9 +435,6 @@ clean-sbinPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done -dumplog$(EXEEXT): $(dumplog_OBJECTS) $(dumplog_DEPENDENCIES) - @rm -f dumplog$(EXEEXT) - $(LINK) $(dumplog_LDFLAGS) $(dumplog_OBJECTS) $(dumplog_LDADD) $(LIBS) mkntfs$(EXEEXT): $(mkntfs_OBJECTS) $(mkntfs_DEPENDENCIES) @rm -f mkntfs$(EXEEXT) $(LINK) $(mkntfs_LDFLAGS) $(mkntfs_OBJECTS) $(mkntfs_LDADD) $(LIBS) @@ -498,7 +487,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attrdef.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boot.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cluster.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumplog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkntfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsclone.Po@am__quote@ From 3cc9f21016517f2a0d7a6621779d736e3fa28af0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 17:38:31 +0000 Subject: [PATCH 1291/2994] Update comments. (Logical change 1.346) --- libntfs/volume.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index 701b224e..d1049e1f 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1135,15 +1135,15 @@ int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags) * @vol: ntfs volume whose version we're interested in. * * The function checks if the NTFS volume version is known or not. - * Version 1.1 and 1.2 are used by Windows NT4. - * Version 2.x is used by Windows 2000 Beta's + * Version 1.1 and 1.2 are used by Windows NT3.x and NT4. + * Version 2.x is used by Windows 2000 Betas. * Version 3.0 is used by Windows 2000. * Version 3.1 is used by Windows XP and Windows Server 2003. * * Return 0 if NTFS version is supported otherwise -1 with errno set. * * The following error codes are defined: - * ENOTSUP Unknown NTFS versions + * ENOTSUP Unknown NTFS version * EINVAL Invalid argument */ int ntfs_version_is_supported(ntfs_volume *vol) From 61fe186d2181edd1b98edad2b0e54be7aae18411 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 24 Mar 2004 17:38:31 +0000 Subject: [PATCH 1292/2994] Use more libntfs APIs and other cleanups. (Logical change 1.346) --- ntfsprogs/ntfsdump_logfile.c | 217 +++++++++++++++++------------------ 1 file changed, 103 insertions(+), 114 deletions(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 0a5b5992..3f1c467e 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -40,34 +40,68 @@ #include "config.h" -#include +#include #include #include -#include #include #include #include "types.h" +#include "endians.h" +#include "volume.h" +#include "inode.h" #include "attrib.h" -#include "mft.h" -#include "device.h" +#include "layout.h" #include "logfile.h" #include "mst.h" -const char *EXEC_NAME = "NtfsDump_LogFile"; -const char *EXEC_VERSION = "1.0"; +/* Need these global so ntfsdump_logfile_exit can access them. */ +static char *EXEC_NAME; +static ntfs_volume *vol; +static ntfs_inode *ni; +static ntfs_attr *na; +static u8 *lfd; + +/** + * err_exit - error output and terminate + */ +void err_exit(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "Aborting...\n"); + exit(1); +} + +/** + * ntfsdump_logfile_exit + */ +void ntfsdump_logfile_exit(void) +{ + if (lfd) + free(lfd); + if (na) + ntfs_attr_close(na); + if (ni && ntfs_inode_close(ni)) + fprintf(stderr, "Warning: Failed to close $LogFile (inode " + "%i): %s\n", FILE_LogFile, strerror(errno)); + if (ntfs_umount(vol, 0)) + fprintf(stderr, "Warning: Failed to umount %s: %s\n", + EXEC_NAME, strerror(errno)); +} /** * main */ int main(int argc, char **argv) { - MFT_RECORD *m = NULL; - ATTR_RECORD *a; - s64 l; - unsigned char *lfd = NULL; - ntfs_volume *vol = NULL; - ntfs_attr_search_ctx *ctx = NULL; + s64 br; + int err; + RESTART_PAGE_HEADER *rph; RESTART_AREA *rr; RESTART_CLIENT *cr; @@ -75,101 +109,70 @@ int main(int argc, char **argv) LOG_RECORD *lr; int pass = 1; int i, lps, client; - char zero[4096]; - memset(zero, 0, sizeof(zero)); + EXEC_NAME = argv[0]; printf("\n"); - if (argc != 2) { - printf("%s v%s - Interpret and display information about the " - "journal\n($LogFile) of an NTFS volume.\n\n" - /* Generic copyright / disclaimer. */ - "Copyright (c) 2000, 2001 Anton Altaparmakov.\n\n" - "%s is free software, released under the GNU " - "General Public License\nand you are welcome to " - "redistribute it under certain conditions.\n" - "%s comes with ABSOLUTELY NO WARRANTY; for details " - "read the GNU\nGeneral Public License to be found " - "in the file COPYING in the main Linux-NTFS\n" - "distribution directory.\n\n" - /* Generic part ends here. */ - "Syntax: ntfsdump_logfile partition_or_file_name\n" - " e.g. ntfsdump_logfile /dev/hda6\n\n", - EXEC_NAME, EXEC_VERSION, EXEC_NAME, EXEC_NAME); - fprintf(stderr, "Error: incorrect syntax\n"); - exit(1); - } + if (argc != 2) + err_exit("%s v%s - Interpret and display information about " + "the journal\n($LogFile) of an NTFS volume.\n" + "Copyright (c) 2000-2004 Anton Altaparmakov.\n" + "%s is free software, released under the GNU " + "General Public License\nand you are welcome " + "to redistribute it under certain " + "conditions.\n%s comes with ABSOLUTELY NO " + "WARRANTY; for details read the GNU\nGeneral " + "Public License to be found in the file " + "COPYING in the main Linux-NTFS\ndistribution " + "directory.\nUsage: %s device\n e.g. %s " + "/dev/hda6\n", EXEC_NAME, VERSION, EXEC_NAME, + EXEC_NAME, EXEC_NAME, EXEC_NAME); vol = ntfs_mount(argv[1], MS_RDONLY); - if (!vol) { - perror("ntfs_mount(MS_RDONLY) failed"); - exit(1); - } - /* Check NTFS version is ok for us. */ - printf("\nNTFS volume version is %i.%i.\n", vol->major_ver, - vol->minor_ver); - switch (vol->major_ver) { - case 1: - if (vol->minor_ver == 1 || vol->minor_ver == 2) - break; - else - goto version_error; - case 2: case 3: - if (vol->minor_ver == 0) - break; - /* Fall through on error. */ - default: -version_error: - fprintf(stderr, "Error: Unknown NTFS version.\n"); - goto error_exit; - } - /* Read in $LogFile. */ - if (ntfs_file_record_read(vol, FILE_LogFile, &m, NULL)) { - fprintf(stderr, "Error reading mft record for $LogFile.\n"); - goto error_exit; - } - if (!(m->flags & MFT_RECORD_IN_USE)) { - fprintf(stderr, "Error: $LogFile has been deleted. Run chkdsk " - "to fix this.\n"); - goto error_exit; - } - ctx = ntfs_attr_get_search_ctx(NULL, m); - if (!ctx) { - perror("Failed to allocate attribute search context"); - goto error_exit; - } - /* Find the $DATA attribute of the $LogFile. */ - if (ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - fprintf(stderr, "Error: Attribute $DATA was not found in" \ - "$LogFile!\n"); - goto log_file_error; - } - a = ctx->attr; - /* Get length of $LogFile contents. */ - l = ntfs_get_attribute_value_length(a); - if (!l) { - puts("$LogFile has zero length, no need to write to disk."); - goto log_file_error; - } - /* Allocate a buffer to hold all of the $LogFile contents. */ - lfd = (unsigned char*)malloc(l); - if (!lfd) { - puts("Not enough memory to load $LogFile."); - goto log_file_error; - } - /* Read in the $LogFile into the buffer. */ - if (l != ntfs_get_attribute_value(vol, a, lfd)) { - puts("Amount of data read does not correspond to expected " - "length!"); - free(lfd); - goto log_file_error; + if (!vol) + err_exit("Failed to mount %s: %s\n", argv[1], strerror(errno)); + err = atexit(&ntfsdump_logfile_exit); + if (err < 0) { + err = errno; + ntfsdump_logfile_exit(); + err_exit("Could not set up exit() function because atexit() " + "failed: %s\n", strerror(err)); } + printf("\nMounted NTFS volume %s (NTFS v%i.%i) on device %s.\n", + vol->vol_name ? vol->vol_name : "", + vol->major_ver, vol->minor_ver, argv[1]); + if (ntfs_version_is_supported(vol)) + err_exit("Unsupported NTFS version.\n"); + ni = ntfs_inode_open(vol, FILE_LogFile); + if (!ni) + err_exit("Failed to open $LogFile (inode %i): %s\n", + FILE_LogFile, strerror(errno)); + na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); + if (!na) + err_exit("Failed to open $LogFile/$DATA (attribute 0x%x): " + "%s\n", le32_to_cpu(AT_DATA), strerror(errno)); + if (!na->data_size) + err_exit("$LogFile has zero length. Run chkdsk /f to correct " + "this.\n"); + /* For simplicity we hold the entirety of $LogFile/$DATA in memory. */ + lfd = malloc(na->data_size); + if (!lfd) + err_exit("Failed to allocate buffer for $LogFile/$DATA: %s", + strerror(errno)); + br = ntfs_attr_pread(na, 0, na->data_size, lfd); + if (br != na->data_size) + err_exit("Failed to read $LogFile/$DATA: %s", br < 0 ? + strerror(errno) : "Partial read."); + /* + * We now have the entirety of $LogFile/$DATA in the memory buffer lfd. + */ +// FIXME: TODO: I am here... (AIA) /* Check restart area. */ if (!ntfs_is_rstr_recordp(lfd)) { s64 _l; - for (_l = 0LL; _l < l; _l++) + for (_l = 0LL; _l < na->data_size; _l++) if (lfd[_l] != (unsigned char)-1) break; - if (_l < l) + if (_l < na->data_size) puts("$LogFile contents are corrupt (magic RSTR " "missing)!"); else @@ -230,7 +233,7 @@ pass_loc: printf("FileSize = %lld (0x%llx)\n", (long long)sle64_to_cpu(rr->file_size), (unsigned long long)sle64_to_cpu(rr->file_size)); - if (sle64_to_cpu(rr->file_size) != l) + if (sle64_to_cpu(rr->file_size) != na->data_size) puts("$LogFile restart area indicates a log file size" "different from the actual size!"); printf("LastLsnDataLength = 0x%x\n", @@ -269,7 +272,7 @@ skip_rstr_pass: printf("\nFinished with restart area. Beginning with log area.\n"); rcrd_pass_loc: rcrd_ph = (RECORD_PAGE_HEADER*)((char*)rcrd_ph + lps); - if ((char*)rcrd_ph + lps > (char*)lfd + l) + if ((char*)rcrd_ph + lps > (char*)lfd + na->data_size) goto end_of_rcrd_passes; printf("\nLog record page number %i", pass); if (!ntfs_is_rcrd_record(rcrd_ph->magic)) { @@ -361,20 +364,6 @@ log_record_pass: end_of_rcrd_passes: log_file_error: printf("\n"); - /* Set return code to 0. */ - i = 0; -final_exit: - if (lfd) - free(lfd); - if (ctx) - ntfs_attr_put_search_ctx(ctx); - if (m) - free(m); - if (vol && ntfs_umount(vol, 0)) - ntfs_umount(vol, 1); - return i; -error_exit: - i = 1; - goto final_exit; + return 0; } From d65ee1a07ae71f363ae97827339ed2f0649eb6d5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 25 Mar 2004 18:55:44 +0000 Subject: [PATCH 1293/2994] (Logical change 1.347) --- doc/encryption.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 doc/encryption.txt diff --git a/doc/encryption.txt b/doc/encryption.txt new file mode 100644 index 00000000..c8c6b5d2 --- /dev/null +++ b/doc/encryption.txt @@ -0,0 +1,12 @@ +These are just a collection of notes on encryption in NTFS. + +- System files cannot be encrypted. Check the file attributes and if + FILE_ATTR_SYSTEM is set refuse to encrypt. This also means can sanity + check that FILE_ATTR_SYSTEM and FILE_ATTR_ENCRYPTED are never set together. + +- The desktop.ini file in each directory has a setting which can disallow + encryption of files in it. The section name is Encrpytion and the key name + is Disable. + +- Everything in %windir% except for Profiles directory is not encryptable as + it is considered a system file. From 22bf6511af1612a70f9076e706121b8721283f3c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 25 Mar 2004 18:55:44 +0000 Subject: [PATCH 1294/2994] - Define a new tpydef LSN for log sequence numbers and use it. - Add some random notes on encryption in doc/encryption.txt. BKrev: 40632b30sU2O4kWOrRB_ChkUYqc-XQ From 80fda796830edbcdd728bad49c84517ef3b71e92 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 25 Mar 2004 18:55:44 +0000 Subject: [PATCH 1295/2994] Add typedef for LSN. (Logical change 1.347) --- include/ntfs/types.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/ntfs/types.h b/include/ntfs/types.h index d1f335a5..2a399f2d 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -1,5 +1,5 @@ /* - * types.h - Misc type definitions not related to on-disk structure. Part of + * types.h - Misc type definitions not related to on-disk structure. Part of * the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov @@ -46,12 +46,19 @@ typedef u16 uchar_t; /* 2-byte Unicode character type. */ #define UCHAR_T_SIZE_BITS 1 /* - * Clusters are signed 64-bit values on NTFS volumes. We define two types, LCN + * Clusters are signed 64-bit values on NTFS volumes. We define two types, LCN * and VCN, to allow for type checking and better code readability. */ typedef s64 VCN; typedef s64 LCN; +/* + * The NTFS journal $LogFile uses log sequence numbers which are signed 64-bit + * values. We define our own type LSN, to allow for type checking and better + * code readability. + */ +typedef s64 LSN; + /* * These are just to make the code more readable... */ From 6a511403dd8243ca4de04ffa76a04909b28a2640 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 25 Mar 2004 18:55:44 +0000 Subject: [PATCH 1296/2994] Initial revision --- doc/encryption.txt | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/doc/encryption.txt b/doc/encryption.txt index c8c6b5d2..e69de29b 100644 --- a/doc/encryption.txt +++ b/doc/encryption.txt @@ -1,12 +0,0 @@ -These are just a collection of notes on encryption in NTFS. - -- System files cannot be encrypted. Check the file attributes and if - FILE_ATTR_SYSTEM is set refuse to encrypt. This also means can sanity - check that FILE_ATTR_SYSTEM and FILE_ATTR_ENCRYPTED are never set together. - -- The desktop.ini file in each directory has a setting which can disallow - encryption of files in it. The section name is Encrpytion and the key name - is Disable. - -- Everything in %windir% except for Profiles directory is not encryptable as - it is considered a system file. From 31c61d34040b40dc6f52d23aeeae5abd2da9270c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 25 Mar 2004 18:55:44 +0000 Subject: [PATCH 1297/2994] Use new type LSN. (Logical change 1.347) --- include/ntfs/layout.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 1f8329a1..931b8c00 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1,5 +1,5 @@ /* - * layout.h - Ntfs on-disk layout structures. Part of the Linux-NTFS project. + * layout.h - Ntfs on-disk layout structures. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov * @@ -299,7 +299,7 @@ typedef struct { u16 usa_ofs; /* See NTFS_RECORD definition above. */ u16 usa_count; /* See NTFS_RECORD definition above. */ -/* 8*/ u64 lsn; /* $LogFile sequence number for this record. +/* 8*/ LSN lsn; /* $LogFile sequence number for this record. Changed every time the record is modified. */ /* 16*/ u16 sequence_number; /* Number of times this mft record has been reused. (See description for MFT_REF @@ -369,7 +369,7 @@ typedef struct { u16 usa_ofs; /* See NTFS_RECORD definition above. */ u16 usa_count; /* See NTFS_RECORD definition above. */ -/* 8*/ u64 lsn; /* $LogFile sequence number for this record. +/* 8*/ LSN lsn; /* $LogFile sequence number for this record. Changed every time the record is modified. */ /* 16*/ u16 sequence_number; /* Number of times this mft record has been reused. (See description for MFT_REF @@ -1957,7 +1957,7 @@ typedef struct { u16 usa_ofs; /* See NTFS_RECORD definition. */ u16 usa_count; /* See NTFS_RECORD definition. */ -/* 8*/ s64 lsn; /* $LogFile sequence number of the last +/* 8*/ LSN lsn; /* $LogFile sequence number of the last modification of this index block. */ /* 16*/ VCN index_block_vcn; /* Virtual cluster number of the index block. */ /* 24*/ INDEX_HEADER index; /* Describes the following index entries. */ From 59c98d3fb1a721b80e0ea3fe30ff604801e787ca Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 25 Mar 2004 18:55:44 +0000 Subject: [PATCH 1298/2994] Use the new LSN data type. (Logical change 1.347) --- include/ntfs/logfile.h | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index 7671ee2a..11686539 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -1,7 +1,7 @@ /* - * logfile.h - Exports for $LogFile handling. Part of the Linux-NTFS project. + * logfile.h - Exports for $LogFile handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -23,6 +23,8 @@ #define _NTFS_LOGFILE_H #include "types.h" +#include "endians.h" +#include "layout.h" typedef enum { magic_RSTR = const_cpu_to_le32(0x52545352), /* "RSTR", restart area */ @@ -59,7 +61,7 @@ typedef struct { u16 usa_ofs; /* See NTFS_RECORD definition above. */ u16 usa_count; /* See NTFS_RECORD definition above. */ - u64 chkdsk_lsn; /* The check disk log file sequence number for + LSN chkdsk_lsn; /* The check disk log file sequence number for this restart page. Only used when the magic is changed to "CHKD". = 0 */ u32 system_page_size; /* Byte size of system pages, has to be >= 512 @@ -85,7 +87,7 @@ typedef struct { * it. */ typedef struct { - u64 current_lsn; /* Log file record. = 0x700000, 0x700808 */ + LSN current_lsn; /* Log file record. = 0x700000, 0x700808 */ u16 log_clients; /* Number of log client records following the restart_area. = 1 */ s16 client_free_list; /* How many clients are free(?). If != 0xffff, @@ -147,9 +149,9 @@ typedef struct { * the offset of the RESTART_AREA to the client_array_offset value found in it. */ typedef struct { - u64 oldest_lsn; /* Oldest log file sequence number for this + LSN oldest_lsn; /* Oldest log file sequence number for this client record. */ - u64 client_restart_lsn; /* Log file sequence number at which to + LSN client_restart_lsn; /* Log file sequence number at which to restart the volume, i.e. the current position within the logfile. */ s16 prev_client; /* ??? = 0xffff */ @@ -182,7 +184,7 @@ typedef struct { u16 usa_count; /* See NTFS_RECORD definition above. */ union { - u64 last_lsn; + LSN last_lsn; u32 file_offset; } __attribute__ ((__packed__)) copy; u32 flags; @@ -191,7 +193,7 @@ typedef struct { union { struct { u64 next_record_offset; - u64 last_end_lsn; + LSN last_end_lsn; } __attribute__ ((__packed__)) packed; } __attribute__ ((__packed__)) header; } __attribute__ ((__packed__)) RECORD_PAGE_HEADER; @@ -211,9 +213,9 @@ typedef enum { * bytes. */ typedef struct { - u64 this_lsn; - u64 client_previous_lsn; - u64 client_undo_next_lsn; + LSN this_lsn; + LSN client_previous_lsn; + LSN client_undo_next_lsn; u32 client_data_length; struct { u16 seq_number; @@ -237,11 +239,11 @@ typedef struct { u16 record_offset; u16 attribute_offset; u32 alignment_or_reserved; - s64 target_vcn; + VCN target_vcn; /* Now at ofs 0x50. */ struct { /* Only present if lcns_to_follow is not 0. */ - s64 lcn; + LCN lcn; } __attribute__((__packed__)) lcn_list[0]; } __attribute__ ((__packed__)) LOG_RECORD; From 5ba8738cfbf6488c3f1214c3cf3f5ac9b003ddf8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 26 Mar 2004 14:42:21 +0000 Subject: [PATCH 1299/2994] - Fix some compiler warnings with latest gcc from SUSE 9.1 beta 3. - Sanitize logfile.h somewhat and adapt ntfsdump_logfile so it compiles. BKrev: 4064414dPMOGUVja5hokYTjuLIhJEA From 17f7990e20edb4e4a4a552a19c3414a9e969c606 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 26 Mar 2004 14:42:21 +0000 Subject: [PATCH 1300/2994] - Move all the magic_* stuff into one place in layout.h. - Sanitize the structure comments to make a little more sense (I hope). (Logical change 1.348) --- include/ntfs/logfile.h | 214 +++++++++++++++++++++-------------------- 1 file changed, 109 insertions(+), 105 deletions(-) diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index 11686539..ba72bc8a 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -26,23 +26,12 @@ #include "endians.h" #include "layout.h" -typedef enum { - magic_RSTR = const_cpu_to_le32(0x52545352), /* "RSTR", restart area */ - magic_RCRD = const_cpu_to_le32(0x44524352), /* "RCRD", log record */ -} LOG_FILE_RECORD_TYPES; - -/* - * Specialised magic comparison macros. - */ -#define ntfs_is_rstr_record(x) ( ntfs_is_magic (x, RSTR) ) -#define ntfs_is_rstr_recordp(p) ( ntfs_is_magicp(p, RSTR) ) -#define ntfs_is_rcrd_record(x) ( ntfs_is_magic (x, RCRD) ) -#define ntfs_is_rcrd_recordp(p) ( ntfs_is_magicp(p, RCRD) ) - /* * Log file organization: - * Two restart areas present in the first two pages (restart pages). When - * the volume is unmounted they should be identical. + * + * Two restart areas present in the first two pages (restart pages, one restart + * area in each page). When the volume is unmounted they should be identical. + * * These are followed by log records organized in pages headed by a record * header going up to log file size. Not all pages contain log records when a * volume is first formatted, but as the volume ages, all records will be used. @@ -50,6 +39,12 @@ typedef enum { * modifying the oldest_lsn to a higher value presumably) and writing begins * at the beginning of the file. Effectively, the log file is viewed as a * circular entity. + * + * NOTE: Windows NT, 2000, and XP all use log file version 1.1 but they accept + * versions <= 1.x, including -1.-1. (Yes, these are minus ones in there!) We + * probably only want to support 1.1 as this seems to be the current version + * and we don't know how that differs from the older versions -1.-1, 0.x, and + * 1.0 */ /* @@ -58,118 +53,118 @@ typedef enum { typedef struct { /* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ NTFS_RECORD_TYPES magic;/* The magic is "RSTR". */ - u16 usa_ofs; /* See NTFS_RECORD definition above. */ - u16 usa_count; /* See NTFS_RECORD definition above. */ + u16 usa_ofs; /* See NTFS_RECORD definition in layout.h. + When creating, set this to be immediately + after this header structure (without any + alignment). */ + u16 usa_count; /* See NTFS_RECORD definition in layout.h. */ - LSN chkdsk_lsn; /* The check disk log file sequence number for - this restart page. Only used when the - magic is changed to "CHKD". = 0 */ - u32 system_page_size; /* Byte size of system pages, has to be >= 512 - and a power of 2. Use this to calculate the - required size of the usa and add this to the - ntfs.usa_offset value. Then verify that the - result is less than the value of the - restart_offset. = 0x1000 */ - u32 log_page_size; /* Byte size of log file records, has to be - >= 512 and a power of 2. = 0x1000 */ - u16 restart_offset; /* Byte offset from the start of the record to - the restart record. Value has to be aligned - to 8-byte boundary. = 0x30 */ - s16 minor_ver; /* Log file minor version. Only check if major - version is 1. (=1 but >=1 is treated the - same and <=0 is also ok) */ - u16 major_ver; /* Log file major version (=1 but =0 is ok) */ + LSN chkdsk_lsn; /* The last log file sequence number found by + chkdsk. Only used when the magic is changed + to "CHKD". Otherwise this is zero. */ + u32 system_page_size; /* Byte size of system pages when the log file + was created, has to be >= 512 and a power of + 2. Use this to calculate the required size + of the usa (usa_count) and add it to usa_ofs. + Then verify that the result is less than the + value of the restart_offset. */ + u32 log_page_size; /* Byte size of log file records, has to be >= + 512 and a power of 2. Usually is 4096 (or + is it just set to system_page_size?). */ + u16 restart_offset; /* Byte offset from the start of this header to + the RESTART_AREA. Value has to be aligned + to 8-byte boundary. When creating, set this + to be after the usa. */ + s16 minor_ver; /* Log file minor version. Only check if major + version is 1. */ + s16 major_ver; /* Log file major version. We only support + version 1.1. */ } __attribute__ ((__packed__)) RESTART_PAGE_HEADER; /* - * Log file restart area record. The offset of this record is found by adding + * Log file restart area record. The offset of this record is found by adding * the offset of the RESTART_PAGE_HEADER to the restart_offset value found in - * it. + * it. See notes at restart_offset above. */ typedef struct { - LSN current_lsn; /* Log file record. = 0x700000, 0x700808 */ - u16 log_clients; /* Number of log client records following - the restart_area. = 1 */ - s16 client_free_list; /* How many clients are free(?). If != 0xffff, + LSN current_lsn; /* The current LSN inside the log when the + restart area was last written. This happens + often but what is the interval? Is it just + fixed time or is it every time a check point + is written or somethine else? */ + u16 log_clients; /* Number of log client records in the array of + log client records which follows this + restart area. Must be 1. */ + u16 client_free_list; /* How many log client records are free in the + array of log client records. If != 0xffff, check that log_clients > client_free_list. = 0xffff */ - s16 client_in_use_list;/* How many clients are in use(?). If != 0xffff - check that log_clients > client_in_use_list. - = 0 */ - u16 flags; /* ??? = 0 */ - u32 seq_number_bits; /* ??? = 0x2c or 0x2d */ - u16 restart_area_length;/* Length of the restart area. Following + u16 client_in_use_list; /* How many log client records are in use in + the array of log client records. If != + 0xffff check that log_clients > + client_in_use_list. = 0 */ + u16 flags; /* Flags modifying LFS behaviour. = 0 */ + u32 seq_number_bits; /* How many bits to use for the sequence + number. I have seen 0x2c and 0x2d. */ + u16 restart_area_length;/* Length of the restart area. Following checks required if version matches. - Otherwise, skip them. restart_offset + + Otherwise, skip them. restart_offset + restart_area_length has to be <= - system_page_size. Also, restart_area_length + system_page_size. Also, restart_area_length has to be >= client_array_offset + - (log_clients * 0xa0). = 0xd0 */ + (log_clients * 0xa0). = 0xd0 */ u16 client_array_offset;/* Offset from the start of this record to - the first client record if versions are - matched. The offset is otherwise assumed to - be (sizeof(RESTART_AREA) + 7) & ~7, i.e. - rounded up to first 8-byte boundary. Either - way, the offset to the client array has to be - aligned to an 8-byte boundary. Also, - restart_offset + offset to the client array - have to be <= 510. Also, the offset to the - client array + (log_clients * 0xa0) have to - be <= SystemPageSize. = 0x30 */ - s64 file_size; /* Byte size of the log file. If the + the first log client record if versions are + matched. When creating, set this to be + after this restart area structure, aligned + to 8-bytes boundary. If the versions do not + match, the offset is otherwise assumed to be + (sizeof(RESTART_AREA) + 7) & ~7, i.e. + rounded up to first 8-byte boundary. Either + way, client_array_offset has to be aligned + to an 8-byte boundary. Also, restart_offset + + client_array_offset has to be <= 510. + Finally, client_array_offset + (log_clients + * 0xa0) has to be <= system_page_size. */ + s64 file_size; /* Byte size of the log file. If the restart_offset + the offset of the file_size - are > 510 then corruption has occured. This + are > 510 then corruption has occured. This is the very first check when starting with the restart_area as if it fails it means that some of the above values will be corrupted by the multi sector transfer - protection! If the structure is deprotected + protection! If the structure is deprotected then these checks are futile of course. Calculate the file_size bits and check that seq_number_bits == 0x43 - file_size bits. = 0x400000 */ u32 last_lsn_data_length;/* ??? = 0, 0x40 */ - u16 record_length; /* Byte size of this record. If the version + u16 record_length; /* Byte size of log records. If the version matches then check that the value of record_length is a multiple of 8, i.e. (record_length + 7) & ~7 == record_length. = 0x30 */ u16 log_page_data_offset;/* ??? = 0x40 */ - /* - * There are eight bytes here at offset 0x58, which contain a value, - * which we don't know what it means. It looks like it could be a - * 64-bit number or a 32-bit plus something else (the second 32-bits - * are zero so can't tell). Have to try to zero it and see if Windows - * copes with this. - */ + u32 unknown; /* ??? = 0 */ + u32 reserved; /* Reserved/alignment to 8-byte boundary. */ } __attribute__ ((__packed__)) RESTART_AREA; /* - * Log file restart client. The offset of this record is found by adding - * the offset of the RESTART_AREA to the client_array_offset value found in it. + * Log client record. The offset of this record is found by adding the offset + * of the RESTART_AREA to the client_array_offset value found in it. */ typedef struct { - LSN oldest_lsn; /* Oldest log file sequence number for this - client record. */ - LSN client_restart_lsn; /* Log file sequence number at which to - restart the volume, i.e. the current - position within the logfile. */ - s16 prev_client; /* ??? = 0xffff */ - s16 next_client; /* ??? = 0xffff */ - u64 seq_number; /* ??? = 1, size uncertain, Regis calls this - "volume clear flag" and gives a size of one - byte. */ - u32 client_name_length; /* ??? length of client name in bytes. = 8, - size uncertain, offset uncertain */ - uchar_t client_name[0]; /* ??? Name of the client in unicode. = NTFS */ - /* - * Or it could be the client name is fixed size like in attr def struct - * and the 8 means something else. Favouring this is that the - * RESTART_CLIENT struct is assumed to be fixed size of 0xa0 bytes, - * just like the attr def struct! There might be parallels to be drawn - * between the two. - */ -} __attribute__ ((__packed__)) RESTART_CLIENT; + LSN oldest_lsn; /* Oldest LSN needed by this client. */ + LSN client_restart_lsn; /* LSN at which this client needs to restart + the volume, i.e. the current position within + the log file. */ + u16 prev_client; /* ??? = 0xffff */ + u16 next_client; /* ??? = 0xffff */ + u16 seq_number; /* ??? = 1 */ + u8 reserved[6]; /* Reserved/alignment. */ + u32 client_name_length; /* Length of client name in bytes. = 8 */ + uchar_t client_name[64];/* Name of the client in Unicode. = NTFS */ +} __attribute__ ((__packed__)) LOG_CLIENT_RECORD; /* * Log page record page header. Each log page begins with this header and is @@ -180,26 +175,30 @@ typedef struct { typedef struct { /* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ NTFS_RECORD_TYPES magic;/* Usually the magic is "RCRD". */ - u16 usa_ofs; /* See NTFS_RECORD definition above. */ - u16 usa_count; /* See NTFS_RECORD definition above. */ + u16 usa_ofs; /* See NTFS_RECORD definition in layout.h. + When creating, set this to be immediately + after this header structure (without any + alignment). */ + u16 usa_count; /* See NTFS_RECORD definition in layout.h. */ union { LSN last_lsn; - u32 file_offset; + s64 file_offset; } __attribute__ ((__packed__)) copy; u32 flags; u16 page_count; u16 page_position; union { struct { - u64 next_record_offset; + u16 next_record_offset; + u8 reserved[6]; LSN last_end_lsn; } __attribute__ ((__packed__)) packed; } __attribute__ ((__packed__)) header; } __attribute__ ((__packed__)) RECORD_PAGE_HEADER; /* - * Possible flags for log records. + * Possible 16-bit flags for log records. (Or is it log record pages?) */ typedef enum { LOG_RECORD_MULTI_PAGE = const_cpu_to_le16(0x0001), /* ??? */ @@ -209,7 +208,15 @@ typedef enum { } __attribute__ ((__packed__)) LOG_RECORD_FLAGS; /* - * Log record header. Each log record seems to have a constant size of 0x70 + * The log client id structure identifying a log client. + */ +typedef struct { + u16 seq_number; + u16 client_index; +} __attribute__ ((__packed__)) LOG_CLIENT_ID; + +/* + * Log record header. Each log record seems to have a constant size of 0x70 * bytes. */ typedef struct { @@ -217,13 +224,10 @@ typedef struct { LSN client_previous_lsn; LSN client_undo_next_lsn; u32 client_data_length; - struct { - u16 seq_number; - u16 client_index; - } __attribute__ ((__packed__)) client_id; + LOG_CLIENT_ID client_id; u32 record_type; u32 transaction_id; - LOG_RECORD_FLAGS flags; + u16 flags; u16 reserved_or_alignment[3]; /* Now are at ofs 0x30 into struct. */ u16 redo_operation; From e3fbfe6b967fe2393de8cac388e852c3f98a6a67 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 26 Mar 2004 14:42:21 +0000 Subject: [PATCH 1301/2994] Correct typo. (Logical change 1.348) --- include/ntfs/unistr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ntfs/unistr.h b/include/ntfs/unistr.h index 1917bfbd..1119c5ee 100644 --- a/include/ntfs/unistr.h +++ b/include/ntfs/unistr.h @@ -1,8 +1,8 @@ /* - * unistr.h - Exports for unicode string handling. Part of the Linux-NTFS + * unistr.h - Exports for Unicode string handling. Part of the Linux-NTFS * project. * - * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2000-2004 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published From a8c7b62ffcb8f60c0f822d1b5f40de21182fa385 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 26 Mar 2004 14:42:21 +0000 Subject: [PATCH 1302/2994] Fix some compiler warnings. (Logical change 1.348) --- libntfs/attrib.c | 10 +++++----- libntfs/compress.c | 6 +++--- libntfs/runlist.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index cdd36163..9b1d8d91 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -799,7 +799,7 @@ res_err_out: /* Update progress counters. */ total += to_read; count -= to_read; - (u8*)b += to_read; + b = (u8*)b + to_read; continue; } /* It is a real lcn, read it into @dst. */ @@ -815,7 +815,7 @@ retry: if (br > 0) { total += br; count -= br; - (u8*)b += br; + b = (u8*)b + br; continue; } /* If the syscall was interrupted, try again. */ @@ -1056,7 +1056,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) */ total += to_write; count -= to_write; - (u8*)b += to_write; + b = (u8*)b + to_write; continue; } /* It is a real lcn, write it to the volume. */ @@ -1076,7 +1076,7 @@ retry: if (written > 0) { total += written; count -= written; - (u8*)b += written; + b = (u8*)b + written; continue; } /* If the syscall was interrupted, try again. */ @@ -1190,7 +1190,7 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, if (br <= 0) return br; br /= bk_size; - for (end = (u8*)b + br * bk_size; (u8*)b < end; (u8*)b += bk_size) + for (end = (u8*)b + br * bk_size; (u8*)b < end; b = (u8*)b + bk_size) ntfs_mst_post_read_fixup((NTFS_RECORD*)b, bk_size); /* Finally, return the number of blocks read. */ return br; diff --git a/libntfs/compress.c b/libntfs/compress.c index 7600f604..ed9698bc 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -360,7 +360,7 @@ do_next_cb: ofs = 0; total += to_read; count -= to_read; - (u8*)b += to_read; + b = (u8*)b + to_read; } else if (rl->length - (vcn - rl->vcn) >= cb_clusters) { s64 tdata_size, tinitialized_size; /* @@ -396,7 +396,7 @@ do_next_cb: } total += br; count -= br; - (u8*)b += br; + b = (u8*)b + br; to_read -= br; ofs += br; } while (to_read > 0); @@ -462,7 +462,7 @@ do_next_cb: memcpy(b, dest + ofs, to_read); total += to_read; count -= to_read; - (u8*)b += to_read; + b = (u8*)b + to_read; ofs = 0; } /* Do we have more work to do? */ diff --git a/libntfs/runlist.c b/libntfs/runlist.c index cec4f337..452f24a8 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1049,7 +1049,7 @@ s64 ntfs_rl_pread(const ntfs_volume *vol, const runlist_element *rl, /* Update counters and proceed with next run. */ total += to_read; count -= to_read; - (u8*)b += to_read; + b = (u8*)b + to_read; continue; } /* It is a real lcn, read it from the volume. */ @@ -1062,7 +1062,7 @@ retry: if (bytes_read > 0) { total += bytes_read; count -= bytes_read; - (u8*)b += bytes_read; + b = (u8*)b + bytes_read; continue; } /* If the syscall was interrupted, try again. */ @@ -1157,7 +1157,7 @@ s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, */ total += to_write; count -= to_write; - (u8*)b += to_write; + b = (u8*)b + to_write; continue; } /* It is a real lcn, write it to the volume. */ @@ -1174,7 +1174,7 @@ retry: if (written > 0) { total += written; count -= written; - (u8*)b += written; + b = (u8*)b + written; continue; } /* If the syscall was interrupted, try again. */ From d224481da923d2f78f586cde06cb720344af919c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 26 Mar 2004 14:42:21 +0000 Subject: [PATCH 1303/2994] Make it compile with changes in logfile.h. (Logical change 1.348) --- ntfsprogs/ntfsdump_logfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 3f1c467e..d098e74c 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -104,7 +104,7 @@ int main(int argc, char **argv) RESTART_PAGE_HEADER *rph; RESTART_AREA *rr; - RESTART_CLIENT *cr; + LOG_CLIENT_RECORD *cr; RECORD_PAGE_HEADER *rcrd_ph; LOG_RECORD *lr; int pass = 1; @@ -203,7 +203,7 @@ pass_loc: goto log_file_error; } rr = (RESTART_AREA*)((char*)rph + le16_to_cpu(rph->restart_offset)); - cr = (RESTART_CLIENT*)((char*)rr + + cr = (LOG_CLIENT_RECORD*)((char*)rr + le16_to_cpu(rr->client_array_offset)); /* Dump of the interpreted $LogFile restart area. */ if (pass == 1) @@ -258,7 +258,7 @@ pass_loc: // printf("ClientName = %u\n", le16_to_cpu(cr->client_name)); } /* Size of a restart client record is fixed at 0xa0 bytes. */ - cr = (RESTART_CLIENT*)((char*)cr + 0xa0); + cr = (LOG_CLIENT_RECORD*)((char*)cr + 0xa0); } skip_rstr_pass: if (pass == 1) { From 89698664fec2a022a21dd140bbce7349d127235d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 26 Mar 2004 14:42:21 +0000 Subject: [PATCH 1304/2994] Move all the magic_* stuff into one place in layout.h. (Logical change 1.348) --- include/ntfs/layout.h | 48 ++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 931b8c00..bd0db481 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -99,11 +99,21 @@ typedef struct { * records (like mft records for example). */ typedef enum { - magic_BAAD = const_cpu_to_le32(0x44414142), /* BAAD == corrupt record */ - magic_CHKD = const_cpu_to_le32(0x424b4843), /* CHKD == chkdsk ??? */ - magic_FILE = const_cpu_to_le32(0x454c4946), /* FILE == mft entry */ - magic_HOLE = const_cpu_to_le32(0x454c4f48), /* HOLE == ? (NTFS 3.0+?) */ - magic_INDX = const_cpu_to_le32(0x58444e49), /* INDX == index buffer */ + /* Found in $MFT/$DATA. */ + magic_FILE = const_cpu_to_le32(0x454c4946), /* mft entry */ + magic_INDX = const_cpu_to_le32(0x58444e49), /* index buffer */ + magic_HOLE = const_cpu_to_le32(0x454c4f48), /* ? (NTFS 3.0+?) */ + + /* Found in $LogFile/$DATA. */ + magic_RSTR = const_cpu_to_le32(0x52545352), /* restart area */ + magic_RCRD = const_cpu_to_le32(0x44524352), /* log record */ + + /* Found in $LogFile/$DATA but maybe found in $MFT/$DATA, also? */ + magic_CHKD = const_cpu_to_le32(0x424b4843), /* modified by chkdsk */ + + /* Found in both $MFT/$DATA and $LogFile/$DATA. */ + magic_BAAD = const_cpu_to_le32(0x44414142), /* failed multi sector + transfer was detected */ } NTFS_RECORD_TYPES; /* @@ -114,21 +124,27 @@ typedef enum { #define ntfs_is_magicp(p, m) ( *(u32*)(p) == (u32)magic_##m ) /* - * Specialised magic comparison macros. + * Specialised magic comparison macros for the NTFS_RECORD_TYPES defined above. */ -#define ntfs_is_baad_record(x) ( ntfs_is_magic (x, BAAD) ) -#define ntfs_is_baad_recordp(p) ( ntfs_is_magicp(p, BAAD) ) -#define ntfs_is_chkd_record(x) ( ntfs_is_magic (x, CHKD) ) -#define ntfs_is_chkd_recordp(p) ( ntfs_is_magicp(p, CHKD) ) #define ntfs_is_file_record(x) ( ntfs_is_magic (x, FILE) ) #define ntfs_is_file_recordp(p) ( ntfs_is_magicp(p, FILE) ) -#define ntfs_is_hole_record(x) ( ntfs_is_magic (x, HOLE) ) -#define ntfs_is_hole_recordp(p) ( ntfs_is_magicp(p, HOLE) ) -#define ntfs_is_indx_record(x) ( ntfs_is_magic (x, INDX) ) -#define ntfs_is_indx_recordp(p) ( ntfs_is_magicp(p, INDX) ) - #define ntfs_is_mft_record(x) ( ntfs_is_file_record(x) ) #define ntfs_is_mft_recordp(p) ( ntfs_is_file_recordp(p) ) +#define ntfs_is_indx_record(x) ( ntfs_is_magic (x, INDX) ) +#define ntfs_is_indx_recordp(p) ( ntfs_is_magicp(p, INDX) ) +#define ntfs_is_hole_record(x) ( ntfs_is_magic (x, HOLE) ) +#define ntfs_is_hole_recordp(p) ( ntfs_is_magicp(p, HOLE) ) + +#define ntfs_is_rstr_record(x) ( ntfs_is_magic (x, RSTR) ) +#define ntfs_is_rstr_recordp(p) ( ntfs_is_magicp(p, RSTR) ) +#define ntfs_is_rcrd_record(x) ( ntfs_is_magic (x, RCRD) ) +#define ntfs_is_rcrd_recordp(p) ( ntfs_is_magicp(p, RCRD) ) + +#define ntfs_is_chkd_record(x) ( ntfs_is_magic (x, CHKD) ) +#define ntfs_is_chkd_recordp(p) ( ntfs_is_magicp(p, CHKD) ) + +#define ntfs_is_baad_record(x) ( ntfs_is_magic (x, BAAD) ) +#define ntfs_is_baad_recordp(p) ( ntfs_is_magicp(p, BAAD) ) /* * Defines for the NTFS filesystem. Don't want to use BLOCK_SIZE and @@ -2265,7 +2281,7 @@ typedef enum { * Like the attribute list and the index buffer list, the EA attribute value is * a sequence of EA_ATTR variable length records. * - * FIXME: It appears weird that the EA name is not unicode. Is it true? + * FIXME: It appears weird that the EA name is not Unicode. Is it true? */ typedef struct { u32 next_entry_offset; /* Offset to the next EA_ATTR. */ From 3eaf28ead24fe00837940ead7798ae192797e152 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 26 Mar 2004 14:42:21 +0000 Subject: [PATCH 1305/2994] Update (Logical change 1.348) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 57438a01..674c9ead 100644 --- a/ChangeLog +++ b/ChangeLog @@ -57,6 +57,9 @@ functionality of ntfsdump_logfile. - Cleanup ntfsdump_logfile utility to use more libntfs APIs and other cleanups. + - Remove some compiler warnings that appeared with the latest gcc + update from SUSE 9.1 beta 3. + - Sanitize logfile.h somewhat and adapt ntfsdump_logfile so it compiles. 11/03/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From 78922e89fa518c4e1455c3afbc1405c7c2b4cada Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 26 Mar 2004 14:50:33 +0000 Subject: [PATCH 1306/2994] Update to automake 1.8.3. (Logical change 1.349) --- Makefile.in | 4 +-- aclocal.m4 | 30 ++++++++++------ configure | 74 +++++++++++++++++++++------------------- doc/Makefile.in | 2 +- include/Makefile.in | 2 +- include/ntfs/Makefile.in | 18 +++++----- libntfs/Makefile.in | 48 +++++++++++++------------- ntfsprogs/Makefile.in | 38 +++++++++++---------- 8 files changed, 118 insertions(+), 98 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4d3b4ea6..5cca236d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.2 from Makefile.am. +# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -479,7 +479,7 @@ distcheck: dist distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ - (cd ../.. && $(mkdir_p) "$$dc_destdir") \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ diff --git a/aclocal.m4 b/aclocal.m4 index 51509148..bc9cb7db 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.8.2 -*- Autoconf -*- +# generated automatically by aclocal 1.8.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. @@ -6006,7 +6006,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"]) # 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.8.2])]) + [AM_AUTOMAKE_VERSION([1.8.3])]) # AM_AUX_DIR_EXPAND @@ -6115,7 +6115,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]) fi])]) -# serial 6 -*- Autoconf -*- +# serial 7 -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. @@ -6202,7 +6202,9 @@ AC_CACHE_CHECK([dependency style of $depcc], : > 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 + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf @@ -6278,7 +6280,7 @@ AC_SUBST([AMDEPBACKSLASH]) # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 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 @@ -6317,14 +6319,14 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], 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"` + DEPDIR=`sed -n 's/^DEPDIR = //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"` + U=`sed -n 's/^U = //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 ' + for file in `sed -n ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop @@ -6683,8 +6685,16 @@ fi # # Do not use -m 0755 and let people choose whatever they expect by # setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) AC_DEFUN([AM_PROG_MKDIR_P], -[if mkdir -p -- . 2>/dev/null; then +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # Keeping the `.' argument allows $(mkdir_p) to be used without # argument. Indeed, we sometimes output rules like # $(mkdir_p) $(somedir) @@ -6697,7 +6707,7 @@ else # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. - for d in ./-p ./--; + for d in ./-p ./--version; do test -d $d && rmdir $d done diff --git a/configure b/configure index db93bcce..d776b08e 100755 --- a/configure +++ b/configure @@ -1780,7 +1780,7 @@ else echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi -if mkdir -p -- . 2>/dev/null; then +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then # Keeping the `.' argument allows $(mkdir_p) to be used without # argument. Indeed, we sometimes output rules like # $(mkdir_p) $(somedir) @@ -1793,7 +1793,7 @@ else # recognize any option. It will interpret all options as # directories to create, and then abort because `.' already # exists. - for d in ./-p ./--; + for d in ./-p ./--version; do test -d $d && rmdir $d done @@ -3210,7 +3210,9 @@ else : > 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 + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf @@ -3885,7 +3887,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3888 "configure"' > conftest.$ac_ext + echo '#line 3890 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5066,7 +5068,9 @@ else : > 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 + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf @@ -5450,7 +5454,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5453:" \ +echo "$as_me:5457:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6484,11 +6488,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6487: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6491: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6491: \$? = $ac_status" >&5 + echo "$as_me:6495: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6717,11 +6721,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6720: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6724: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6724: \$? = $ac_status" >&5 + echo "$as_me:6728: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6777,11 +6781,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6780: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6784: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6784: \$? = $ac_status" >&5 + echo "$as_me:6788: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8961,7 +8965,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:11245: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11245: \$? = $ac_status" >&5 + echo "$as_me:11249: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -11298,11 +11302,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11301: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11305: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11305: \$? = $ac_status" >&5 + echo "$as_me:11309: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12659,7 +12663,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13591: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13591: \$? = $ac_status" >&5 + echo "$as_me:13595: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13644,11 +13648,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13647: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13651: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13651: \$? = $ac_status" >&5 + echo "$as_me:13655: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15678,11 +15682,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15681: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15685: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15685: \$? = $ac_status" >&5 + echo "$as_me:15689: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15911,11 +15915,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15914: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15918: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15918: \$? = $ac_status" >&5 + echo "$as_me:15922: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15971,11 +15975,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15974: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15978: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15978: \$? = $ac_status" >&5 + echo "$as_me:15982: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18155,7 +18159,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + DEPDIR=`sed -n 's/^DEPDIR = //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"` + U=`sed -n 's/^U = //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 ' + for file in `sed -n ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop diff --git a/doc/Makefile.in b/doc/Makefile.in index c2c3485b..200d08e6 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.2 from Makefile.am. +# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/include/Makefile.in b/include/Makefile.in index fb59d3ca..f621ba46 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.2 from Makefile.am. +# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 6a25d91c..d6a59487 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.2 from Makefile.am. +# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -47,7 +47,7 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = -am__installdirs = $(DESTDIR)$(linux_ntfsincludedir) +am__installdirs = "$(DESTDIR)$(linux_ntfsincludedir)" linux_ntfsincludeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(linux_ntfsinclude_HEADERS) ETAGS = etags @@ -234,20 +234,20 @@ distclean-libtool: uninstall-info-am: install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(linux_ntfsincludedir) + test -z "$(linux_ntfsincludedir)" || $(mkdir_p) "$(DESTDIR)$(linux_ntfsincludedir)" @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(linux_ntfsincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ - $(linux_ntfsincludeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(linux_ntfsincludedir)/$$f; \ + echo " $(linux_ntfsincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(linux_ntfsincludedir)/$$f'"; \ + $(linux_ntfsincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ done uninstall-linux_ntfsincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ - rm -f $(DESTDIR)$(linux_ntfsincludedir)/$$f; \ + echo " rm -f '$(DESTDIR)$(linux_ntfsincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -327,7 +327,9 @@ check-am: all-am check: check-am all-am: Makefile $(HEADERS) installdirs: - $(mkdir_p) $(DESTDIR)$(linux_ntfsincludedir) + for dir in "$(DESTDIR)$(linux_ntfsincludedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 79930a8e..df12cb16 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.2 from Makefile.am. +# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -75,7 +75,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = libntfs.conf libntfs-gnomevfs.8 -am__installdirs = $(DESTDIR)$(gnomevfsmoduleslibdir) $(DESTDIR)$(libdir) $(DESTDIR)$(man8dir) $(DESTDIR)$(gnomevfsmodulesconfdir) +am__installdirs = "$(DESTDIR)$(gnomevfsmoduleslibdir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(gnomevfsmodulesconfdir)" gnomevfsmoduleslibLTLIBRARIES_INSTALL = $(INSTALL) libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(gnomevfsmoduleslib_LTLIBRARIES) $(lib_LTLIBRARIES) @@ -310,12 +310,12 @@ libntfs-gnomevfs.8: $(top_builddir)/config.status $(srcdir)/libntfs-gnomevfs.8.i cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-gnomevfsmoduleslibLTLIBRARIES: $(gnomevfsmoduleslib_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(gnomevfsmoduleslibdir) + test -z "$(gnomevfsmoduleslibdir)" || $(mkdir_p) "$(DESTDIR)$(gnomevfsmoduleslibdir)" @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(gnomevfsmoduleslibdir)/$$f"; \ - $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(gnomevfsmoduleslibdir)/$$f; \ + echo " $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gnomevfsmoduleslibdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gnomevfsmoduleslibdir)/$$f"; \ else :; fi; \ done @@ -323,8 +323,8 @@ uninstall-gnomevfsmoduleslibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(gnomevfsmoduleslibdir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(gnomevfsmoduleslibdir)/$$p; \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(gnomevfsmoduleslibdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(gnomevfsmoduleslibdir)/$$p"; \ done clean-gnomevfsmoduleslibLTLIBRARIES: @@ -337,12 +337,12 @@ clean-gnomevfsmoduleslibLTLIBRARIES: done install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(libdir) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ done @@ -350,8 +350,8 @@ uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done clean-libLTLIBRARIES: @@ -477,7 +477,7 @@ distclean-libtool: uninstall-info-am: install-man8: $(man8_MANS) $(man_MANS) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(man8dir) + test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)" @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ @@ -496,8 +496,8 @@ install-man8: $(man8_MANS) $(man_MANS) inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \ done uninstall-man8: @$(NORMAL_UNINSTALL) @@ -517,25 +517,25 @@ uninstall-man8: inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \ - rm -f $(DESTDIR)$(man8dir)/$$inst; \ + echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man8dir)/$$inst"; \ done install-gnomevfsmodulesconfDATA: $(gnomevfsmodulesconf_DATA) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(gnomevfsmodulesconfdir) + test -z "$(gnomevfsmodulesconfdir)" || $(mkdir_p) "$(DESTDIR)$(gnomevfsmodulesconfdir)" @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(gnomevfsmodulesconfDATA_INSTALL) $$d$$p $(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ - $(gnomevfsmodulesconfDATA_INSTALL) $$d$$p $(DESTDIR)$(gnomevfsmodulesconfdir)/$$f; \ + echo " $(gnomevfsmodulesconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f'"; \ + $(gnomevfsmodulesconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ done uninstall-gnomevfsmodulesconfDATA: @$(NORMAL_UNINSTALL) @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ - rm -f $(DESTDIR)$(gnomevfsmodulesconfdir)/$$f; \ + echo " rm -f '$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f'"; \ + rm -f "$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -615,7 +615,9 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(MANS) $(DATA) installdirs: - $(mkdir_p) $(DESTDIR)$(gnomevfsmoduleslibdir) $(DESTDIR)$(libdir) $(DESTDIR)$(man8dir) $(DESTDIR)$(gnomevfsmodulesconfdir) + for dir in "$(DESTDIR)$(gnomevfsmoduleslibdir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(gnomevfsmodulesconfdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 969f31ee..c8dcf76e 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.2 from Makefile.am. +# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -60,7 +60,7 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 \ ntfsresize.8 ntfsundelete.8 -am__installdirs = $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir) +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) @@ -381,15 +381,15 @@ ntfsundelete.8: $(top_builddir)/config.status $(srcdir)/ntfsundelete.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(bindir) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ || test -f $$p1 \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done @@ -397,8 +397,8 @@ uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: @@ -409,15 +409,15 @@ clean-binPROGRAMS: done install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(sbindir) + test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)" @list='$(sbin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ || test -f $$p1 \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) $$p $(DESTDIR)$(sbindir)/$$f || exit 1; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \ else :; fi; \ done @@ -425,8 +425,8 @@ uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f $(DESTDIR)$(sbindir)/$$f"; \ - rm -f $(DESTDIR)$(sbindir)/$$f; \ + echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ + rm -f "$(DESTDIR)$(sbindir)/$$f"; \ done clean-sbinPROGRAMS: @@ -540,7 +540,7 @@ distclean-libtool: uninstall-info-am: install-man8: $(man8_MANS) $(man_MANS) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(man8dir) + test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)" @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ @@ -559,8 +559,8 @@ install-man8: $(man8_MANS) $(man_MANS) inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \ done uninstall-man8: @$(NORMAL_UNINSTALL) @@ -580,8 +580,8 @@ uninstall-man8: inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \ - rm -f $(DESTDIR)$(man8dir)/$$inst; \ + echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man8dir)/$$inst"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) @@ -661,7 +661,9 @@ check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(MANS) installdirs: - $(mkdir_p) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir) + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am From 3cef28ae3080355782e870f664c56cd2e2052f69 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 26 Mar 2004 14:50:33 +0000 Subject: [PATCH 1307/2994] Update to automake 1.8.3. BKrev: 40644339QDxS5Fv6k4eX8OvUGyXuDQ From 7e2b0aad08cef0c4eb671d29abfd486fd3689a72 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 30 Mar 2004 14:00:35 +0000 Subject: [PATCH 1308/2994] Move declaration of variable to beginning of block. Thanks to Alexei Alexandrov for the fix. (Logical change 1.350) --- ntfsprogs/utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 91039222..4a42cae1 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -968,8 +968,10 @@ int mft_next_record (struct mft_search_ctx *ctx) } for (ctx->mft_num++; (s64)ctx->mft_num < ctx->vol->nr_mft_records; ctx->mft_num++) { + int in_use; + ctx->flags_match = 0; - int in_use = utils_mftrec_in_use (ctx->vol, (MFT_REF) ctx->mft_num); + in_use = utils_mftrec_in_use (ctx->vol, (MFT_REF) ctx->mft_num); if (in_use == -1) { Eprintf ("Error reading inode %llu. Aborting.", (unsigned long long)ctx->mft_num); From 16629ca38c5a0184763dad1b36e2f64066121b5e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 30 Mar 2004 14:00:35 +0000 Subject: [PATCH 1309/2994] Move declaration of variable to beginning of block. Thanks to Alexei Alexandrov for the fix. BKrev: 40697d83jIaaAhVDixRVnIRIvZ8ksA From e0ccb034eacb28037053c504e61c1282ac789a92 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 30 Mar 2004 14:00:35 +0000 Subject: [PATCH 1310/2994] Update. (Logical change 1.350) --- include/ntfs/logfile.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index ba72bc8a..daaeaccb 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -41,10 +41,12 @@ * circular entity. * * NOTE: Windows NT, 2000, and XP all use log file version 1.1 but they accept - * versions <= 1.x, including -1.-1. (Yes, these are minus ones in there!) We + * versions <= 1.x, including 0.-1. (Yes, that is a minus one in there!) We * probably only want to support 1.1 as this seems to be the current version - * and we don't know how that differs from the older versions -1.-1, 0.x, and - * 1.0 + * and we don't know how that differs from the older versions. The only + * exception is if the journal is clean as marked by the two restart pages + * then it doesn't matter whether we are on an earlier version. We can just + * reinitialize the logfile and start again with version 1.1. */ /* @@ -95,13 +97,13 @@ typedef struct { u16 log_clients; /* Number of log client records in the array of log client records which follows this restart area. Must be 1. */ - u16 client_free_list; /* How many log client records are free in the - array of log client records. If != 0xffff, - check that log_clients > client_free_list. - = 0xffff */ - u16 client_in_use_list; /* How many log client records are in use in - the array of log client records. If != - 0xffff check that log_clients > + u16 client_free_list; /* The index of the first free log client record + in the array of log client records. If != + 0xffff, check that log_clients > + client_free_list. = 0xffff */ + u16 client_in_use_list; /* The index of the first in-use log client + revcord in the array of log client records. + If != 0xffff check that log_clients > client_in_use_list. = 0 */ u16 flags; /* Flags modifying LFS behaviour. = 0 */ u32 seq_number_bits; /* How many bits to use for the sequence From 465aed1efd748781a29f1c9c4fa1e35535ca2d47 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 30 Mar 2004 14:02:26 +0000 Subject: [PATCH 1311/2994] Add Alexei Alexandrov (Logical change 1.351) --- CREDITS | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS b/CREDITS index cdeabce6..e69b315f 100644 --- a/CREDITS +++ b/CREDITS @@ -7,6 +7,7 @@ Please let me know (email Anton Altaparmakov ) if you believe someone is missing or if you prefer to not be listed. +Alexei Alexandrov Anton Altaparmakov Albert D. Cahalan Russ Christensen From 9b58b899e7eb480f04f6bb109f803b61073aa727 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 30 Mar 2004 14:02:26 +0000 Subject: [PATCH 1312/2994] Add Alexei Alexandrov to CREDITS and update ChangeLog. BKrev: 40697df2Ot845FC5gSspdXNqCz_bmQ From ec359479a37f0f7b14e267f9fcf7132b5feca0a0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 30 Mar 2004 14:02:26 +0000 Subject: [PATCH 1313/2994] Update (Logical change 1.351) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 674c9ead..ef1851e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -60,6 +60,8 @@ - Remove some compiler warnings that appeared with the latest gcc update from SUSE 9.1 beta 3. - Sanitize logfile.h somewhat and adapt ntfsdump_logfile so it compiles. + - Move declaration of a variable in utils.c to beginning of block. + Thanks to Alexei Alexandrov for the bug report and patch. 11/03/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From a111528d7c63a728cb7efc9dc4daaf9b3a887df6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 31 Mar 2004 14:47:08 +0000 Subject: [PATCH 1314/2994] Add ability to use a file as the logfile source rather than a ntfs volume containing device, i.e. you can now grab a copy of $LogFile and use ntfsdump_logfile -f mylogfilecopy. (Logical change 1.352) --- ntfsprogs/ntfsdump_logfile.c | 404 +++++++++++++++++++++-------------- 1 file changed, 243 insertions(+), 161 deletions(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index d098e74c..fc7a34f0 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -1,10 +1,10 @@ /** - * NtfsDump_LogFile - Part of the Linux-NTFS project. + * ntfsdump_logfile - Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov * * This utility will interpret the contents of the journal ($LogFile) of an - * NTFS partition and display the results on stdout. Errors will be output to + * NTFS partition and display the results on stdout. Errors will be output to * stderr. * * This program is free software; you can redistribute it and/or modify @@ -23,23 +23,11 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* - * WARNING: This program might not work on architectures which do not allow - * unaligned access. For those, the program would need to start using - * get/put_unaligned macros (#include ), but not doing it yet, - * since NTFS really mostly applies to ia32 only, which does allow unaligned - * accesses. We might not actually have a problem though, since the structs are - * defined as being packed so that might be enough for gcc to insert the - * correct code. - * - * If anyone using a non-little endian and/or an aligned access only CPU tries - * this program please let me know whether it works or not! - * - * Anton Altaparmakov - */ - #include "config.h" +#include +#include +#include #include #include #include @@ -55,16 +43,10 @@ #include "logfile.h" #include "mst.h" -/* Need these global so ntfsdump_logfile_exit can access them. */ -static char *EXEC_NAME; -static ntfs_volume *vol; -static ntfs_inode *ni; -static ntfs_attr *na; -static u8 *lfd; - /** * err_exit - error output and terminate */ +void err_exit(const char *fmt, ...) __attribute__ ((noreturn)); void err_exit(const char *fmt, ...) { va_list ap; @@ -78,12 +60,15 @@ void err_exit(const char *fmt, ...) } /** - * ntfsdump_logfile_exit + * device_err_exit - */ -void ntfsdump_logfile_exit(void) +void device_err_exit(char *dev_name, ntfs_volume *vol, ntfs_inode *ni, + ntfs_attr *na, const char *fmt, ...) __attribute__ ((noreturn)); +void device_err_exit(char *dev_name, ntfs_volume *vol, ntfs_inode *ni, + ntfs_attr *na, const char *fmt, ...) { - if (lfd) - free(lfd); + va_list ap; + if (na) ntfs_attr_close(na); if (ni && ntfs_inode_close(ni)) @@ -91,193 +76,289 @@ void ntfsdump_logfile_exit(void) "%i): %s\n", FILE_LogFile, strerror(errno)); if (ntfs_umount(vol, 0)) fprintf(stderr, "Warning: Failed to umount %s: %s\n", - EXEC_NAME, strerror(errno)); + dev_name, strerror(errno)); + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "Aborting...\n"); + exit(1); } /** - * main + * usage - + */ +void usage(void) __attribute__ ((noreturn)); +void usage(const char *exec_name) +{ + fprintf(stderr, "%s v%s - Interpret and display information about the " + "journal\n($LogFile) of an NTFS volume.\n" + "Copyright (c) 2000-2004 Anton Altaparmakov.\n" + "%s is free software, released under the GNU General " + "Public License\nand you are welcome to redistribute " + "it under certain conditions.\n%s comes with " + "ABSOLUTELY NO WARRANTY; for details read the GNU\n" + "General Public License to be found in the file " + "COPYING in the main Linux-NTFS\ndistribution " + "directory.\nUsage: %s device\n e.g. %s /dev/hda6\n" + "Alternative usage: %s -f file\n e.g. %s -f " + "MyCopyOfTheLogFile\n", exec_name, VERSION, exec_name, + exec_name, exec_name, exec_name, exec_name, exec_name); + exit(1); +} + +/** + * main - */ int main(int argc, char **argv) { - s64 br; - int err; - - RESTART_PAGE_HEADER *rph; - RESTART_AREA *rr; - LOG_CLIENT_RECORD *cr; - RECORD_PAGE_HEADER *rcrd_ph; + u8 *buf; + RESTART_PAGE_HEADER *rstr; + RESTART_AREA *ra; + LOG_CLIENT_RECORD *lcr; + RECORD_PAGE_HEADER *rcrd; LOG_RECORD *lr; - int pass = 1; - int i, lps, client; + int buf_size, err, i, lps, client, pass = 1; - EXEC_NAME = argv[0]; printf("\n"); - if (argc != 2) - err_exit("%s v%s - Interpret and display information about " - "the journal\n($LogFile) of an NTFS volume.\n" - "Copyright (c) 2000-2004 Anton Altaparmakov.\n" - "%s is free software, released under the GNU " - "General Public License\nand you are welcome " - "to redistribute it under certain " - "conditions.\n%s comes with ABSOLUTELY NO " - "WARRANTY; for details read the GNU\nGeneral " - "Public License to be found in the file " - "COPYING in the main Linux-NTFS\ndistribution " - "directory.\nUsage: %s device\n e.g. %s " - "/dev/hda6\n", EXEC_NAME, VERSION, EXEC_NAME, - EXEC_NAME, EXEC_NAME, EXEC_NAME); - vol = ntfs_mount(argv[1], MS_RDONLY); - if (!vol) - err_exit("Failed to mount %s: %s\n", argv[1], strerror(errno)); - err = atexit(&ntfsdump_logfile_exit); - if (err < 0) { - err = errno; - ntfsdump_logfile_exit(); - err_exit("Could not set up exit() function because atexit() " - "failed: %s\n", strerror(err)); - } - printf("\nMounted NTFS volume %s (NTFS v%i.%i) on device %s.\n", - vol->vol_name ? vol->vol_name : "", - vol->major_ver, vol->minor_ver, argv[1]); - if (ntfs_version_is_supported(vol)) - err_exit("Unsupported NTFS version.\n"); - ni = ntfs_inode_open(vol, FILE_LogFile); - if (!ni) - err_exit("Failed to open $LogFile (inode %i): %s\n", - FILE_LogFile, strerror(errno)); - na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); - if (!na) - err_exit("Failed to open $LogFile/$DATA (attribute 0x%x): " - "%s\n", le32_to_cpu(AT_DATA), strerror(errno)); - if (!na->data_size) - err_exit("$LogFile has zero length. Run chkdsk /f to correct " - "this.\n"); - /* For simplicity we hold the entirety of $LogFile/$DATA in memory. */ - lfd = malloc(na->data_size); - if (!lfd) - err_exit("Failed to allocate buffer for $LogFile/$DATA: %s", - strerror(errno)); - br = ntfs_attr_pread(na, 0, na->data_size, lfd); - if (br != na->data_size) - err_exit("Failed to read $LogFile/$DATA: %s", br < 0 ? - strerror(errno) : "Partial read."); + if (argc < 2 || argc > 3) + usage(argv[0]); /* - * We now have the entirety of $LogFile/$DATA in the memory buffer lfd. + * If one argument, it is a device containing an NTFS volume which we + * need to mount and read the $LogFile from so we can dump its contents. + * + * If two arguments the first one must be "-f" and the second one is + * the path and name of the $LogFile (or copy thereof) which we need to + * read and dump the contents of. */ -// FIXME: TODO: I am here... (AIA) - /* Check restart area. */ - if (!ntfs_is_rstr_recordp(lfd)) { - s64 _l; + if (argc == 2) { + s64 br; + ntfs_volume *vol; + ntfs_inode *ni; + ntfs_attr *na; - for (_l = 0LL; _l < na->data_size; _l++) - if (lfd[_l] != (unsigned char)-1) - break; - if (_l < na->data_size) - puts("$LogFile contents are corrupt (magic RSTR " + vol = ntfs_mount(argv[1], MS_RDONLY); + if (!vol) + err_exit("Failed to mount %s: %s\n", argv[1], + strerror(errno)); + printf("\nMounted NTFS volume %s (NTFS v%i.%i) on device %s.\n", + vol->vol_name ? vol->vol_name : "", + vol->major_ver, vol->minor_ver, argv[1]); + if (ntfs_version_is_supported(vol)) + device_err_exit(argv[1], vol, NULL, NULL, + "Unsupported NTFS version.\n"); + ni = ntfs_inode_open(vol, FILE_LogFile); + if (!ni) + device_err_exit(argv[1], vol, NULL, NULL, "Failed to " + "open $LogFile (inode %i): %s\n", + FILE_LogFile, strerror(errno)); + na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); + if (!na) + device_err_exit(argv[1], vol, ni, NULL, "Failed to " + "open $LogFile/$DATA (attribute " + "0x%x): %s\n", le32_to_cpu(AT_DATA), + strerror(errno)); + if (!na->data_size) + device_err_exit(argv[1], vol, ni, na, "$LogFile has " + "zero length. Run chkdsk /f to " + "correct this.\n"); + if (na->data_size <= 64 * 1024 * 1024) + buf_size = na->data_size; + else { + fprintf(stderr, "Warning: $LogFile is too big. Only " + "analysing the first 64MiB.\n"); + buf_size = 64 * 1024 * 1024; + } + /* For simplicity we read all of $LogFile/$DATA into memory. */ + buf = malloc(buf_size); + if (!buf) + device_err_exit(argv[1], vol, ni, na, "Failed to " + "allocate buffer for $LogFile/$DATA: " + "%s", strerror(errno)); + br = ntfs_attr_pread(na, 0, buf_size, buf); + if (br != buf_size) { + free(buf); + device_err_exit(argv[1], vol, ni, na, "Failed to read " + "$LogFile/$DATA: %s", br < 0 ? + strerror(errno) : "Partial read."); + } + ntfs_attr_close(na); + if (ntfs_inode_close(ni)) + fprintf(stderr, "Warning: Failed to close $LogFile " + "(inode %i): %s\n", FILE_LogFile, + strerror(errno)); + if (ntfs_umount(vol, 0)) + fprintf(stderr, "Warning: Failed to umount %s: %s\n", + argv[1], strerror(errno)); + } else /* if (argc == 3) */ { + ssize_t br; + int fd; + struct stat sbuf; + + if (strncmp(argv[1], "-f", strlen("-f"))) + usage(argv[0]); + if (stat(argv[2], &sbuf) == -1) { + if (errno == ENOENT) + err_exit("The file %s does not exist. Did " + "you specify it correctly?\n", + argv[2]); + err_exit("Error getting information about %s: %s\n", + argv[2], strerror(errno)); + } + if (sbuf.st_size <= 64 * 1024 * 1024) + buf_size = sbuf.st_size; + else { + fprintf(stderr, "Warning: File %s is too big. Only " + "analysing the first 64MiB.\n", + argv[2]); + buf_size = 64 * 1024 * 1024; + } + /* For simplicity we read all of the file into memory. */ + buf = malloc(buf_size); + if (!buf) + err_exit("Failed to allocate buffer for file data: %s", + strerror(errno)); + fd = open(argv[2], O_RDONLY); + if (fd == -1) { + free(buf); + err_exit("Failed to open file %s: %s\n", argv[2], + strerror(errno)); + } + /* Read in the file into the buffer. */ + br = read(fd, buf, buf_size); + err = errno; + if (close(fd)) + fprintf(stderr, "Warning: Failed to close file %s: " + "%s\n", strerror(errno)); + if (br != buf_size) { + free(buf); + err_exit("Failed to read data from %s: %s", argv[2], + br < 0 ? strerror(err) : + "Partial read."); + } + } + /* + * We now have the entirety of the journal ($LogFile/$DATA or argv[2]) + * in the memory buffer buf and this has a size of buf_size. Note we + * apply a size capping at 64MiB, so if the journal is any bigger we + * only have the first 64MiB. This should not be a problem as I have + * never seen such a large $LogFile. Usually it is only a few MiB in + * size. + */ +// TODO: I am here... (AIA) + /* Check for presence of restart area signature. */ + if (!ntfs_is_rstr_recordp(buf)) { + s8 *pos = (s8*)buf; + s8 *end = pos + buf_size; + while (pos < end && *pos == -1) + pos++; + free(buf); + if (pos != end) + err_exit("$LogFile contents are corrupt (magic RSTR " "missing)!"); - else - puts("$LogFile is empty."); - goto log_file_error; + /* All bytes are -1. */ + puts("$LogFile is not initialized."); + return 0; } /* Do the interpretation and display now. */ - rph = (RESTART_PAGE_HEADER*)lfd; - lps = le32_to_cpu(rph->log_page_size); + rstr = (RESTART_PAGE_HEADER*)buf; + lps = le32_to_cpu(rstr->log_page_size); pass_loc: - if (ntfs_mst_post_read_fixup((NTFS_RECORD*)rph, lps) || - ntfs_is_baad_record(rph->magic)) { + if (ntfs_mst_post_read_fixup((NTFS_RECORD*)rstr, lps) || + ntfs_is_baad_record(rstr->magic)) { puts("$LogFile incomplete multi sector transfer detected! " "Cannot handle this yet!"); goto log_file_error; } - if ((pass == 2) && !memcmp(lfd, rph, lps)) { + if ((pass == 2) && !memcmp(buf, rstr, lps)) { printf("2nd restart area fully matches the 1st one. Skipping " "display.\n"); goto skip_rstr_pass; } - if (le16_to_cpu(rph->major_ver != 1) || - le16_to_cpu(rph->minor_ver != 1)) { + if (le16_to_cpu(rstr->major_ver != 1) || + le16_to_cpu(rstr->minor_ver != 1)) { fprintf(stderr, "$LogFile version %i.%i! Error: Unknown " "$LogFile version!\n", - le16_to_cpu(rph->major_ver), - le16_to_cpu(rph->minor_ver)); + le16_to_cpu(rstr->major_ver), + le16_to_cpu(rstr->minor_ver)); goto log_file_error; } - rr = (RESTART_AREA*)((char*)rph + le16_to_cpu(rph->restart_offset)); - cr = (LOG_CLIENT_RECORD*)((char*)rr + - le16_to_cpu(rr->client_array_offset)); + ra = (RESTART_AREA*)((u8*)rstr + le16_to_cpu(rstr->restart_offset)); + lcr = (LOG_CLIENT_RECORD*)((u8*)ra + + le16_to_cpu(ra->client_array_offset)); /* Dump of the interpreted $LogFile restart area. */ if (pass == 1) printf("\n$LogFile version %i.%i.\n", - le16_to_cpu(rph->major_ver), - le16_to_cpu(rph->minor_ver)); + le16_to_cpu(rstr->major_ver), + le16_to_cpu(rstr->minor_ver)); printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); printf("magic = RSTR\n"); printf("ChkDskLsn = 0x%llx\n", - (unsigned long long)sle64_to_cpu(rph->chkdsk_lsn)); - printf("SystemPageSize = %u\n", le32_to_cpu(rph->system_page_size)); - printf("LogPageSize = %u\n", le32_to_cpu(rph->log_page_size)); - printf("RestartOffset = 0x%x\n", le16_to_cpu(rph->restart_offset)); + (unsigned long long)sle64_to_cpu(rstr->chkdsk_lsn)); + printf("SystemPageSize = %u\n", le32_to_cpu(rstr->system_page_size)); + printf("LogPageSize = %u\n", le32_to_cpu(rstr->log_page_size)); + printf("RestartOffset = 0x%x\n", le16_to_cpu(rstr->restart_offset)); printf("\n(1st) restart record:\n"); printf("CurrentLsn = %llx\n", - (unsigned long long)sle64_to_cpu(rr->current_lsn)); - printf("LogClients = %u\n", le16_to_cpu(rr->log_clients)); - printf("ClientFreeList = %i\n", sle16_to_cpu(rr->client_free_list)); - printf("ClientInUseList = %i\n", sle16_to_cpu(rr->client_in_use_list)); - printf("Flags = 0x%x\n", le16_to_cpu(rr->flags)); - printf("SeqNumberBits = %u (0x%x)\n", le32_to_cpu(rr->seq_number_bits), - le32_to_cpu(rr->seq_number_bits)); + (unsigned long long)sle64_to_cpu(ra->current_lsn)); + printf("LogClients = %u\n", le16_to_cpu(ra->log_clients)); + printf("ClientFreeList = %i\n", sle16_to_cpu(ra->client_free_list)); + printf("ClientInUseList = %i\n", sle16_to_cpu(ra->client_in_use_list)); + printf("Flags = 0x%x\n", le16_to_cpu(ra->flags)); + printf("SeqNumberBits = %u (0x%x)\n", le32_to_cpu(ra->seq_number_bits), + le32_to_cpu(ra->seq_number_bits)); printf("RestartAreaLength = 0x%x\n", - le16_to_cpu(rr->restart_area_length)); + le16_to_cpu(ra->restart_area_length)); printf("ClientArrayOffset = 0x%x\n", - le16_to_cpu(rr->client_array_offset)); + le16_to_cpu(ra->client_array_offset)); printf("FileSize = %lld (0x%llx)\n", - (long long)sle64_to_cpu(rr->file_size), - (unsigned long long)sle64_to_cpu(rr->file_size)); - if (sle64_to_cpu(rr->file_size) != na->data_size) + (long long)sle64_to_cpu(ra->file_size), + (unsigned long long)sle64_to_cpu(ra->file_size)); + if (sle64_to_cpu(ra->file_size) != buf_size) puts("$LogFile restart area indicates a log file size" "different from the actual size!"); printf("LastLsnDataLength = 0x%x\n", - le32_to_cpu(rr->last_lsn_data_length)); - printf("RecordLength = 0x%x\n", le16_to_cpu(rr->record_length)); + le32_to_cpu(ra->last_lsn_data_length)); + printf("RecordLength = 0x%x\n", le16_to_cpu(ra->record_length)); printf("LogPageDataOffset = 0x%x\n", - le16_to_cpu(rr->log_page_data_offset)); - for (client = 0; client < le16_to_cpu(rr->log_clients); client++) { + le16_to_cpu(ra->log_page_data_offset)); + for (client = 0; client < le16_to_cpu(ra->log_clients); client++) { printf("\nRestart client record number %i:\n", client); printf("OldestLsn = 0x%llx\n", (unsigned long long) - sle64_to_cpu(cr->oldest_lsn)); + sle64_to_cpu(lcr->oldest_lsn)); printf("ClientRestartLsn = 0x%llx\n", (unsigned long long) - sle64_to_cpu(cr->client_restart_lsn)); - printf("PrevClient = %i\n", sle16_to_cpu(cr->prev_client)); - printf("NextClient = %i\n", sle16_to_cpu(cr->next_client)); + sle64_to_cpu(lcr->client_restart_lsn)); + printf("PrevClient = %i\n", sle16_to_cpu(lcr->prev_client)); + printf("NextClient = %i\n", sle16_to_cpu(lcr->next_client)); printf("SeqNumber = 0x%llx\n", (unsigned long long) - le64_to_cpu(cr->seq_number)); + le64_to_cpu(lcr->seq_number)); printf("ClientNameLength = 0x%x\n", - le32_to_cpu(cr->client_name_length)); - if (le32_to_cpu(cr->client_name_length)) { + le32_to_cpu(lcr->client_name_length)); + if (le32_to_cpu(lcr->client_name_length)) { // convert to ascii and print out. - // printf("ClientName = %u\n", le16_to_cpu(cr->client_name)); + // printf("ClientName = %u\n", le16_to_cpu(lcr->client_name)); } /* Size of a restart client record is fixed at 0xa0 bytes. */ - cr = (LOG_CLIENT_RECORD*)((char*)cr + 0xa0); + lcr = (LOG_CLIENT_RECORD*)((u8*)lcr + 0xa0); } skip_rstr_pass: if (pass == 1) { - rph = (RESTART_PAGE_HEADER*)((char*)rph + lps); + rstr = (RESTART_PAGE_HEADER*)((u8*)rstr + lps); ++pass; goto pass_loc; } - rcrd_ph = (RECORD_PAGE_HEADER*)rph; + rcrd = (RECORD_PAGE_HEADER*)rstr; /* Reuse pass for log record clienter. */ pass = 0; printf("\nFinished with restart area. Beginning with log area.\n"); rcrd_pass_loc: - rcrd_ph = (RECORD_PAGE_HEADER*)((char*)rcrd_ph + lps); - if ((char*)rcrd_ph + lps > (char*)lfd + na->data_size) + rcrd = (RECORD_PAGE_HEADER*)((u8*)rcrd + lps); + if ((u8*)rcrd + lps > buf + buf_size) goto end_of_rcrd_passes; printf("\nLog record page number %i", pass); - if (!ntfs_is_rcrd_record(rcrd_ph->magic)) { + if (!ntfs_is_rcrd_record(rcrd->magic)) { for (i = 0; i < lps; i++) - if (((char*)rcrd_ph)[i] != (char)-1) + if (((u8*)rcrd)[i] != (u8)-1) break; if (i < lps) puts(" is corrupt (magic RCRD is missing)."); @@ -290,19 +371,19 @@ rcrd_pass_loc: /* Dump log record page */ printf("\nmagic = RCRD\n"); printf("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long) - le64_to_cpu(rcrd_ph->copy.last_lsn)); - printf("flags = 0x%x\n", le32_to_cpu(rcrd_ph->flags)); - printf("page count = %i\n", le16_to_cpu(rcrd_ph->page_count)); - printf("page position = %i\n", le16_to_cpu(rcrd_ph->page_position)); + le64_to_cpu(rcrd->copy.last_lsn)); + printf("flags = 0x%x\n", le32_to_cpu(rcrd->flags)); + printf("page count = %i\n", le16_to_cpu(rcrd->page_count)); + printf("page position = %i\n", le16_to_cpu(rcrd->page_position)); printf("header.next_record_offset = 0x%llx\n", (unsigned long long) - le64_to_cpu(rcrd_ph->header.packed.next_record_offset)); + le64_to_cpu(rcrd->header.packed.next_record_offset)); printf("header.last_end_lsn = 0x%llx\n", (unsigned long long) - le64_to_cpu(rcrd_ph->header.packed.last_end_lsn)); + le64_to_cpu(rcrd->header.packed.last_end_lsn)); /* * Where does the 0x40 come from? Is it just usa_offset + * usa_client * 2 + 7 & ~7 or is it derived from somewhere? */ - lr = (LOG_RECORD*)((char*)rcrd_ph + 0x40); + lr = (LOG_RECORD*)((u8*)rcrd + 0x40); client = 0; log_record_pass: printf("\nLog record %i:\n", client); @@ -355,15 +436,16 @@ log_record_pass: printf("lcn_list[%i].lcn = 0x%llx\n", i, (unsigned long long) sle64_to_cpu(lr->lcn_list[i].lcn)); client++; - lr = (LOG_RECORD*)((char*)lr + 0x70); - if (((char*)lr + 0x70 <= (char*)rcrd_ph + - le64_to_cpu(rcrd_ph->header.packed.next_record_offset))) + lr = (LOG_RECORD*)((u8*)lr + 0x70); + if (((u8*)lr + 0x70 <= (u8*)rcrd + + le64_to_cpu(rcrd->header.packed.next_record_offset))) goto log_record_pass; pass++; goto rcrd_pass_loc; end_of_rcrd_passes: log_file_error: printf("\n"); + free(buf); return 0; } From 8a80625a4bb1eca07114afb64c0774a488fce1e9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 31 Mar 2004 14:47:08 +0000 Subject: [PATCH 1315/2994] More updates. (Logical change 1.352) --- include/ntfs/logfile.h | 106 +++++++++++++++++++++++++---------------- 1 file changed, 66 insertions(+), 40 deletions(-) diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index daaeaccb..fe60d492 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -53,34 +53,36 @@ * Log file restart page header (begins the restart area). */ typedef struct { +/*Ofs*/ /* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ - NTFS_RECORD_TYPES magic;/* The magic is "RSTR". */ - u16 usa_ofs; /* See NTFS_RECORD definition in layout.h. +/* 0*/ NTFS_RECORD_TYPES magic;/* The magic is "RSTR". */ +/* 4*/ u16 usa_ofs; /* See NTFS_RECORD definition in layout.h. When creating, set this to be immediately after this header structure (without any alignment). */ - u16 usa_count; /* See NTFS_RECORD definition in layout.h. */ +/* 6*/ u16 usa_count; /* See NTFS_RECORD definition in layout.h. */ - LSN chkdsk_lsn; /* The last log file sequence number found by +/* 8*/ LSN chkdsk_lsn; /* The last log file sequence number found by chkdsk. Only used when the magic is changed to "CHKD". Otherwise this is zero. */ - u32 system_page_size; /* Byte size of system pages when the log file +/* 16*/ u32 system_page_size; /* Byte size of system pages when the log file was created, has to be >= 512 and a power of 2. Use this to calculate the required size of the usa (usa_count) and add it to usa_ofs. Then verify that the result is less than the value of the restart_offset. */ - u32 log_page_size; /* Byte size of log file records, has to be >= +/* 20*/ u32 log_page_size; /* Byte size of log file records, has to be >= 512 and a power of 2. Usually is 4096 (or is it just set to system_page_size?). */ - u16 restart_offset; /* Byte offset from the start of this header to +/* 24*/ u16 restart_offset; /* Byte offset from the start of this header to the RESTART_AREA. Value has to be aligned to 8-byte boundary. When creating, set this to be after the usa. */ - s16 minor_ver; /* Log file minor version. Only check if major +/* 26*/ s16 minor_ver; /* Log file minor version. Only check if major version is 1. */ - s16 major_ver; /* Log file major version. We only support +/* 28*/ s16 major_ver; /* Log file major version. We only support version 1.1. */ +/* sizeof() = 30 (0x1e) bytes */ } __attribute__ ((__packed__)) RESTART_PAGE_HEADER; /* @@ -89,33 +91,42 @@ typedef struct { * it. See notes at restart_offset above. */ typedef struct { - LSN current_lsn; /* The current LSN inside the log when the +/*Ofs*/ +/* 0*/ LSN current_lsn; /* The current LSN inside the log when the restart area was last written. This happens often but what is the interval? Is it just fixed time or is it every time a check point is written or somethine else? */ - u16 log_clients; /* Number of log client records in the array of +/* 8*/ u16 log_clients; /* Number of log client records in the array of log client records which follows this restart area. Must be 1. */ - u16 client_free_list; /* The index of the first free log client record - in the array of log client records. If != - 0xffff, check that log_clients > - client_free_list. = 0xffff */ - u16 client_in_use_list; /* The index of the first in-use log client - revcord in the array of log client records. - If != 0xffff check that log_clients > - client_in_use_list. = 0 */ - u16 flags; /* Flags modifying LFS behaviour. = 0 */ - u32 seq_number_bits; /* How many bits to use for the sequence +/* 10*/ u16 client_free_list; /* The index of the first free log client record + in the array of log client records. 0xffff + means that there are no free log client + records in the array. If != 0xffff, check + that log_clients > client_free_list. On a + clean volume this is != 0xffff, should at + present always be 0. At present on dirty + volume this is 0xffff. */ +/* 12*/ u16 client_in_use_list; /* The index of the first in-use log client + record in the array of log client records. + 0xffff means that there are no in-use log + client records in the array. If != 0xffff + check that log_clients > client_in_use_list. + On a clean volume this is 0xffff. On a + dirty volume this is != 0xffff. At present + on dirty volume this is 0. */ +/* 14*/ u16 flags; /* Flags modifying LFS behaviour. = 0 */ +/* 16*/ u32 seq_number_bits; /* How many bits to use for the sequence number. I have seen 0x2c and 0x2d. */ - u16 restart_area_length;/* Length of the restart area. Following +/* 20*/ u16 restart_area_length;/* Length of the restart area. Following checks required if version matches. Otherwise, skip them. restart_offset + restart_area_length has to be <= system_page_size. Also, restart_area_length has to be >= client_array_offset + - (log_clients * 0xa0). = 0xd0 */ - u16 client_array_offset;/* Offset from the start of this record to + (log_clients * sizeof(log client record)). */ +/* 22*/ u16 client_array_offset;/* Offset from the start of this record to the first log client record if versions are matched. When creating, set this to be after this restart area structure, aligned @@ -127,8 +138,9 @@ typedef struct { to an 8-byte boundary. Also, restart_offset + client_array_offset has to be <= 510. Finally, client_array_offset + (log_clients - * 0xa0) has to be <= system_page_size. */ - s64 file_size; /* Byte size of the log file. If the + * sizeof(log client record)) has to be <= + system_page_size. */ +/* 24*/ s64 file_size; /* Byte size of the log file. If the restart_offset + the offset of the file_size are > 510 then corruption has occured. This is the very first check when starting with @@ -140,15 +152,17 @@ typedef struct { Calculate the file_size bits and check that seq_number_bits == 0x43 - file_size bits. = 0x400000 */ - u32 last_lsn_data_length;/* ??? = 0, 0x40 */ - u16 record_length; /* Byte size of log records. If the version +/* 32*/ u32 last_lsn_data_length;/* ??? = 0, 0x40 */ +/* 36*/ u16 record_length; /* Byte size of log records. If the version matches then check that the value of record_length is a multiple of 8, i.e. (record_length + 7) & ~7 == record_length. = 0x30 */ - u16 log_page_data_offset;/* ??? = 0x40 */ - u32 unknown; /* ??? = 0 */ - u32 reserved; /* Reserved/alignment to 8-byte boundary. */ +/* 38*/ u16 log_page_data_offset;/* ??? = 0x40 */ +/* 40*/ u32 unknown; /* ??? It seems like it = 0 if clean and it != 0 + if dirty. */ +/* 44*/ u32 reserved; /* Reserved/alignment to 8-byte boundary. */ +/* sizeof() = 48 (0x30) bytes */ } __attribute__ ((__packed__)) RESTART_AREA; /* @@ -156,16 +170,28 @@ typedef struct { * of the RESTART_AREA to the client_array_offset value found in it. */ typedef struct { - LSN oldest_lsn; /* Oldest LSN needed by this client. */ - LSN client_restart_lsn; /* LSN at which this client needs to restart +/*Ofs*/ +/* 0*/ LSN oldest_lsn; /* Oldest LSN needed by this client. */ +/* 8*/ LSN client_restart_lsn; /* LSN at which this client needs to restart the volume, i.e. the current position within - the log file. */ - u16 prev_client; /* ??? = 0xffff */ - u16 next_client; /* ??? = 0xffff */ - u16 seq_number; /* ??? = 1 */ - u8 reserved[6]; /* Reserved/alignment. */ - u32 client_name_length; /* Length of client name in bytes. = 8 */ - uchar_t client_name[64];/* Name of the client in Unicode. = NTFS */ + the log file. At present, if clean this + should = current_lsn in restart area but it + probably also = current_lsn when dirty most + of the time. */ +/* 16*/ u16 prev_client; /* The offset to the previous log client record + in the array of log client records. 0xffff + means there is no previous client record, + i.e. this is the first one. */ +/* 18*/ u16 next_client; /* The offset to the next log client record in + the array of log client records. 0xffff + means there are no next client records, i.e. + this is the last one. */ +/* 20*/ u16 seq_number; /* ??? It is 1 when clean and 0 when dirty, + but don't know if this is always the case. */ +/* 22*/ u8 reserved[6]; /* Reserved/alignment. */ +/* 28*/ u32 client_name_length; /* Length of client name in bytes. = 8 */ +/* 32*/ uchar_t client_name[64];/* Name of the client in Unicode. = NTFS */ +/* sizeof() = 160 (0xa0) bytes */ } __attribute__ ((__packed__)) LOG_CLIENT_RECORD; /* From 8ed1a0e96ec4e1c19098b1c03c77550325b177a6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 31 Mar 2004 14:47:08 +0000 Subject: [PATCH 1316/2994] Update (Logical change 1.352) --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ef1851e2..aca7c535 100644 --- a/ChangeLog +++ b/ChangeLog @@ -59,7 +59,7 @@ cleanups. - Remove some compiler warnings that appeared with the latest gcc update from SUSE 9.1 beta 3. - - Sanitize logfile.h somewhat and adapt ntfsdump_logfile so it compiles. + - Sanitize/update logfile.h somewhat and adapt ntfsdump_logfile. - Move declaration of a variable in utils.c to beginning of block. Thanks to Alexei Alexandrov for the bug report and patch. From a40f3db9db7785e44af28a8fee969cb07060e855 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 31 Mar 2004 14:47:08 +0000 Subject: [PATCH 1317/2994] ntfsdump_logfile: Add ability to use a file as the logfile source rather than a ntfs volume containing device, i.e. you can now grab a copy of $LogFile and use ntfsdump_logfile -f mylogfilecopy. BKrev: 406ad9ecUoJa0FH6sQ9bAAPLNrD-Gg From 527d7780cbd6ff13c2a14b1edef3d390c53b6daa Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 31 Mar 2004 15:01:05 +0000 Subject: [PATCH 1318/2994] Make it compile... (Logical change 1.353) --- ntfsprogs/ntfsdump_logfile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index fc7a34f0..79c0bafd 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -31,8 +31,9 @@ #include #include #include -#include #include +#include +#include #include "types.h" #include "endians.h" @@ -88,7 +89,7 @@ void device_err_exit(char *dev_name, ntfs_volume *vol, ntfs_inode *ni, /** * usage - */ -void usage(void) __attribute__ ((noreturn)); +void usage(const char *exec_name) __attribute__ ((noreturn)); void usage(const char *exec_name) { fprintf(stderr, "%s v%s - Interpret and display information about the " @@ -229,7 +230,7 @@ int main(int argc, char **argv) err = errno; if (close(fd)) fprintf(stderr, "Warning: Failed to close file %s: " - "%s\n", strerror(errno)); + "%s\n", argv[2], strerror(errno)); if (br != buf_size) { free(buf); err_exit("Failed to read data from %s: %s", argv[2], From 97c8324339252937d9fda9757c4ced0e377f1bd8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 31 Mar 2004 15:01:05 +0000 Subject: [PATCH 1319/2994] Make ntfsdump_logfile.c compile again. BKrev: 406add31gzcllyWek4ivS7RChe-Y6A From f569675d007c1e5493372e73b1f146941142fe0b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 31 Mar 2004 15:01:05 +0000 Subject: [PATCH 1320/2994] Update (Logical change 1.353) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index aca7c535..6ab2ef42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,6 +62,8 @@ - Sanitize/update logfile.h somewhat and adapt ntfsdump_logfile. - Move declaration of a variable in utils.c to beginning of block. Thanks to Alexei Alexandrov for the bug report and patch. + - Add the ability to read the logfile from a supplied file using the + command line option -f to ntfsdump_logfile. 11/03/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From 6c3d5259637e083c18a18deaf3e1f3adad38cc05 Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Thu, 1 Apr 2004 21:30:42 +0000 Subject: [PATCH 1321/2994] - Updated ntfsclone manual. - Added some diagnostic and explanatory messages to ntfsclone. (Logical change 1.354) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6ab2ef42..4b766f4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,6 +64,8 @@ Thanks to Alexei Alexandrov for the bug report and patch. - Add the ability to read the logfile from a supplied file using the command line option -f to ntfsdump_logfile. + - Updated ntfsclone manual. + - Added some diagnostic and explanatory messages to ntfsclone. 11/03/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From 1bfe7eeb00fd59f080af91443c7a05b7c608fa42 Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Thu, 1 Apr 2004 21:30:42 +0000 Subject: [PATCH 1322/2994] - Updated ntfsclone manual. - Added some diagnostic and explanatory messages to ntfsclone. BKrev: 406c8a027Nr8NJF6iOSXHsU0YE8iIg From 37cf1d9b38877fc5bc8d8c1a60594bdf9d522f07 Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Thu, 1 Apr 2004 21:30:42 +0000 Subject: [PATCH 1323/2994] Added some diagnostic and explanatory messages to ntfsclone. (Logical change 1.354) --- ntfsprogs/ntfsclone.c | 79 +++++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 26 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index e95933d2..a2652816 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -62,6 +62,7 @@ struct { int metadata_only; char *output; char *volume; + struct statfs stfs; } opt; struct bitmap { @@ -189,13 +190,13 @@ static void usage(void) Eprintf("\nUsage: %s [options] device\n" " Efficiently clone NTFS to a sparse file, device or standard output.\n" "\n" - " -o FILE --output FILE Clone NTFS to the non-existent FILE\n" - " -O FILE --overwrite FILE Clone NTFS to FILE, overwriting if exists\n" - " -m --metadata Clone *only* metadata (for NTFS experts)\n" - " -f --force Force to progress (DANGEROUS)\n" - " -h --help Display this help\n" + " -o, --output FILE Clone NTFS to the non-existent FILE\n" + " -O, --overwrite FILE Clone NTFS to FILE, overwriting if exists\n" + " -m, --metadata Clone *only* metadata (for NTFS experts)\n" + " -f, --force Force to progress (DANGEROUS)\n" + " -h, --help Display this help\n" #ifdef DEBUG - " -d --debug Show debug information\n" + " -d, --debug Show debug information\n" #endif "\n" " If FILE is '-' then send NTFS data to stdout replacing non used\n" @@ -394,8 +395,16 @@ static void copy_cluster(void) if (read_all(vol->dev, buff, vol->cluster_size) == -1) perr_exit("read_all"); - if (write_all(&fd_out, buff, vol->cluster_size) == -1) - perr_exit("write_all"); + if (write_all(&fd_out, buff, vol->cluster_size) == -1) { + int err = errno; + perr_printf("Write failed"); + if (err == EIO && opt.stfs.f_type == 0x517b) + Printf("Apparently you tried to clone to a remote " + "Windows computer but they don't\nhave " + "efficient sparse file handling by default. " + "Please try a different method.\n"); + exit(1); + } } static void lseek_to_cluster(s64 lcn) @@ -973,6 +982,39 @@ static void fsync_clone(int fd) perr_exit("fsync"); } +static void set_filesize(s64 filesize) +{ + if (fstatfs(fd_out, &opt.stfs) == -1) + Printf("WARNING: Couldn't get filesystem type: " + "%s\n", strerror(errno)); + else if (opt.stfs.f_type == 0x52654973) + Printf("WARNING: You're using ReiserFS, it has very poor " + "performance creating\nlarge sparse files. The next " + "operation might take a very long time!\n" + "Creating sparse output file ...\n"); + else if (opt.stfs.f_type == 0x517b) + Printf("WARNING: You're using SMBFS and if the remote share " + "isn't Samba but a Windows\ncomputer then the clone " + "operation will be very inefficient and may fail!\n"); + + if (ftruncate(fd_out, filesize) == -1) { + int err = errno; + perr_printf("ftruncate failed for file '%s'", opt.output); + if (err == E2BIG) { + Printf("Your system or the destination filesystem " + "doesn't support large files.\n"); + if (opt.stfs.f_type == 0x517b) { + Printf("SMBFS needs minimum Linux kernel " + "version 2.4.25 and\n the 'lfs' option" + "\nfor mount or smbmount to have large " + "file support.\n"); + } + } + exit(1); + } +} + + int main(int argc, char **argv) { ntfs_walk_clusters_ctx image; @@ -1015,23 +1057,7 @@ int main(int argc, char **argv) if ((fd_out = open(opt.output, flags, S_IRWXU)) == -1) perr_exit("Opening file '%s' failed", opt.output); - if (!opt.blkdev_out) { - struct statfs stfs; - - if (fstatfs(fd_out, &stfs) == -1) - Printf("Couldn't get Linux filesystem type: " - "%s\n", strerror(errno)); - else if (stfs.f_type == 0x52654973) { - Printf("WARNING: You're using ReiserFS, it has " - "very poor performance creating\nlarge " - "sparse files. The next operation " - "might take a very long time!\n" - "Creating sparse output file ...\n"); - } - if (ftruncate(fd_out, device_size) == -1) - perr_exit("ftruncate failed for file '%s'", - opt.output); - } else { + if (opt.blkdev_out) { s64 dest_size = device_size_get(fd_out); s64 ntfs_size = vol->nr_clusters * vol->cluster_size; ntfs_size += 512; /* add backup boot sector */ @@ -1040,7 +1066,8 @@ int main(int argc, char **argv) " to fit the NTFS image.\n", dest_size); check_if_mounted(opt.output, 0); - } + } else + set_filesize(device_size); } setup_lcn_bitmap(); From 1d17c6e4290a7179c69a0a6b9ed429b2dc6ff02f Mon Sep 17 00:00:00 2001 From: "omakaista.fi!szaka" Date: Thu, 1 Apr 2004 21:30:42 +0000 Subject: [PATCH 1324/2994] Update, corrections and removed all mentions of the buggy cp --sparse=always that could corrupt data if the destination is block device (though GNU cp was fixed after we reported the problem). (Logical change 1.354) --- ntfsprogs/ntfsclone.8.in | 55 ++++++++++++---------------------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index eb709b57..32ad1bf6 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -1,10 +1,10 @@ .\" -*- nroff -*- .\" Copyright (c) 2003 Richard Russon -.\" Copyright (c) 2003 Szabolcs Szakacsits +.\" Copyright (c) 2003-2004 Szabolcs Szakacsits .\" All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLONE 8 "Oct 2003" "ntfsprogs version @VERSION@" +.TH NTFSCLONE 8 "Mar 2004" "ntfsprogs version @VERSION@" .SH NAME ntfsclone \- Efficiently clone an NTFS filesystem .SH SYNOPSIS @@ -12,11 +12,11 @@ ntfsclone \- Efficiently clone an NTFS filesystem [ .B \-fhm ] -.B \-o +.B \-\-output [ .I FILE | -.B \- +.B \- ] .B device .br @@ -24,7 +24,7 @@ ntfsclone \- Efficiently clone an NTFS filesystem [ .B \-fhm ] -.B \-O +.B \-\-overwrite .I FILE .B device .SH DESCRIPTION @@ -66,7 +66,7 @@ The only main Linux filesystem having support for efficient sparse file handling is XFS by the XFS_IOC_GETBMAPX .BR ioctl\fR. -However none of the common utility supports it. +However none of the common utilities supports it. This means when you tar, cp, gzip, bzip2, etc a large sparse file they will always read the entire file, even if you use the "sparse support" options. @@ -77,15 +77,8 @@ compresses large sparse files much better than but it does so also much slower. Moreover neither of them handles large sparse files efficiently during uncompression from disk space usage point -of view. A possible workaround is if you pipe the uncompressed -stream through -.BR cp\fR, -for example this way, -.RS -.sp -.B bunzip2 \-c image.bz2 | cp \-\-sparse=always /proc/self/fd/0 image -.sp -.RE +of view. + At present the most efficient way, both speed and space-wise, to compress and uncompress large sparse files by common tools is using @@ -117,7 +110,7 @@ reading them back will result always zeros. The metadata-only image can be compressed very well, usually to not more than 1-3 MB thus it's relatively easy to transfer -it for investigation to NTFS experts. +for investigation, troubleshooting. In this mode of ntfsclone, .B NONE @@ -168,13 +161,13 @@ to overcome every single safety checks. .B \-h, \-\-help Show a list of options with a brief description of each one. .SH EXAMPLES -Cloning (save, backup) an NTFS volume to a non-existent file +Clone (save, backup) an NTFS volume to a non-existent file .RS .sp .B ntfsclone \-\-output ntfs.img /dev/hda1 .sp .RE -Restoring a clone image to its original partition +Restore a clone image to its original partition .RS .sp .B ntfsclone \-\-overwrite /dev/hda1 ntfs.img @@ -201,10 +194,10 @@ at least 2-4 times but it creates also bigger compressed files. .B ntfsclone \-\-output ntfs.img /dev/hda1 | bzip2 \-c > ntfs.img.bz2 .sp .RE -Restoring an NTFS volume from a compressed image +Restore an NTFS volume from a compressed image .RS .sp -.B bunzip2 \-c ntfs.img.bz2 | dd of=/dev/hda1 +.B bunzip2 \-c ntfs.img.bz2 | dd of=/dev/hda1 bs=8192 .sp .RE Backup an NTFS volume to a remote host, using @@ -215,26 +208,10 @@ default compression. .B ntfsclone \-o \- /dev/hda1 | ssh \-C host 'bzip \-c9 > ntfs.img.bz2' .sp .RE -Clone an NTFS volume to a remote host, using -.BR ssh -default compression (type everything in one line). +Restore an NTFS volume from a remote host via ssh. .RS .sp -.B ntfsclone \-o \- /dev/hda1 | \\\\ -.br -.B ssh \-C host 'cat | cp \-\-sparse=always /proc/self/fd/0 ntfs.img' -.sp -.RE -Clone a remote NTFS volume to the local filesystem via -.BR ssh -using a custom compression level (type everything in one line). -Speed-wise the optimal compression level depends on your network, -disk and CPU speed, saturation. -.RS -.sp -.B ssh host 'ntfsclone \-o \- /dev/hda1 | gzip \-2c' | \\\\ -.br -.B gunzip \-c | cp \-\-sparse=always /proc/self/fd/0 ntfs.img +.B ssh host 'cat ntfs.img.bz2' | bunzip2 | dd of=/dev/hda1 bs=8192 .sp .RE Pack NTFS metadata for NTFS experts @@ -243,7 +220,7 @@ Pack NTFS metadata for NTFS experts .B ntfsclone \-\-metadata \-\-output ntfsmeta.img /dev/hda1 .br .B tar \-cjSf ntfsmeta.img.tar.bz2 ntfsmeta.img -.SH BUGS +.SH KNOWN ISSUES This program has no known bugs. If you find one, please send an email to .nh . From 80cb606d36b88c783fc8272fb9730d6f00ca7c38 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 08:42:10 +0000 Subject: [PATCH 1325/2994] Big update. (Not finished yet.) (Logical change 1.355) --- ntfsprogs/ntfsdump_logfile.c | 373 ++++++++++++++++++++++++----------- 1 file changed, 254 insertions(+), 119 deletions(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 79c0bafd..6c3869bd 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -44,22 +44,6 @@ #include "logfile.h" #include "mst.h" -/** - * err_exit - error output and terminate - */ -void err_exit(const char *fmt, ...) __attribute__ ((noreturn)); -void err_exit(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "ERROR: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "Aborting...\n"); - exit(1); -} - /** * device_err_exit - */ @@ -86,6 +70,24 @@ void device_err_exit(char *dev_name, ntfs_volume *vol, ntfs_inode *ni, exit(1); } +/** + * log_err_exit - + */ +void log_err_exit(u8 *buf, const char *fmt, ...) __attribute__ ((noreturn)); +void log_err_exit(u8 *buf, const char *fmt, ...) +{ + va_list ap; + + if (buf) + free(buf); + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "Aborting...\n"); + exit(1); +} + /** * usage - */ @@ -119,7 +121,7 @@ int main(int argc, char **argv) LOG_CLIENT_RECORD *lcr; RECORD_PAGE_HEADER *rcrd; LOG_RECORD *lr; - int buf_size, err, i, lps, client, pass = 1; + int buf_size, err, i, page_size, usa_end_ofs, client, pass = 1; printf("\n"); if (argc < 2 || argc > 3) @@ -140,7 +142,7 @@ int main(int argc, char **argv) vol = ntfs_mount(argv[1], MS_RDONLY); if (!vol) - err_exit("Failed to mount %s: %s\n", argv[1], + log_err_exit(NULL, "Failed to mount %s: %s\n", argv[1], strerror(errno)); printf("\nMounted NTFS volume %s (NTFS v%i.%i) on device %s.\n", vol->vol_name ? vol->vol_name : "", @@ -200,11 +202,11 @@ int main(int argc, char **argv) usage(argv[0]); if (stat(argv[2], &sbuf) == -1) { if (errno == ENOENT) - err_exit("The file %s does not exist. Did " - "you specify it correctly?\n", - argv[2]); - err_exit("Error getting information about %s: %s\n", - argv[2], strerror(errno)); + log_err_exit(NULL, "The file %s does not " + "exist. Did you specify it " + "correctly?\n", argv[2]); + log_err_exit(NULL, "Error getting information about " + "%s: %s\n", argv[2], strerror(errno)); } if (sbuf.st_size <= 64 * 1024 * 1024) buf_size = sbuf.st_size; @@ -217,26 +219,22 @@ int main(int argc, char **argv) /* For simplicity we read all of the file into memory. */ buf = malloc(buf_size); if (!buf) - err_exit("Failed to allocate buffer for file data: %s", - strerror(errno)); + log_err_exit(NULL, "Failed to allocate buffer for " + "file data: %s", strerror(errno)); fd = open(argv[2], O_RDONLY); - if (fd == -1) { - free(buf); - err_exit("Failed to open file %s: %s\n", argv[2], + if (fd == -1) + log_err_exit("Failed to open file %s: %s\n", argv[2], strerror(errno)); - } /* Read in the file into the buffer. */ br = read(fd, buf, buf_size); err = errno; if (close(fd)) fprintf(stderr, "Warning: Failed to close file %s: " "%s\n", argv[2], strerror(errno)); - if (br != buf_size) { - free(buf); - err_exit("Failed to read data from %s: %s", argv[2], - br < 0 ? strerror(err) : + if (br != buf_size) + log_err_exit(buf, "Failed to read data from %s: %s", + argv[2], br < 0 ? strerror(err) : "Partial read."); - } } /* * We now have the entirety of the journal ($LogFile/$DATA or argv[2]) @@ -246,131 +244,270 @@ int main(int argc, char **argv) * never seen such a large $LogFile. Usually it is only a few MiB in * size. */ -// TODO: I am here... (AIA) + rstr = (RESTART_PAGE_HEADER*)buf; /* Check for presence of restart area signature. */ - if (!ntfs_is_rstr_recordp(buf)) { + if (!ntfs_is_rstr_record(rstr->magic) && + !ntfs_is_chkd_record(rstr->magic)) { s8 *pos = (s8*)buf; s8 *end = pos + buf_size; while (pos < end && *pos == -1) pos++; - free(buf); if (pos != end) - err_exit("$LogFile contents are corrupt (magic RSTR " - "missing)!"); + log_err_exit(buf, "$LogFile contents are corrupt " + "(magic RSTR is missing). Cannot " + "handle this yet.\n"); /* All bytes are -1. */ + free(buf); puts("$LogFile is not initialized."); return 0; } - /* Do the interpretation and display now. */ - rstr = (RESTART_PAGE_HEADER*)buf; - lps = le32_to_cpu(rstr->log_page_size); -pass_loc: - if (ntfs_mst_post_read_fixup((NTFS_RECORD*)rstr, lps) || - ntfs_is_baad_record(rstr->magic)) { - puts("$LogFile incomplete multi sector transfer detected! " - "Cannot handle this yet!"); - goto log_file_error; + /* + * First, verify the restart page header for consistency. + */ + /* Only CHKD records are allowed to have chkdsk_lsn set. */ + if (!ntfs_is_chkd_record(rstr->magic) && sle64_to_cpu(rstr->chkdsk_lsn)) + log_err_exit(buf, "$LogFile is corrupt: Restart page header " + "magic is not CHKD but a chkdsk LSN is " + "specified. Cannot handle this yet.\n"); + /* Both system and log page size must be >= 512 and a power of 2. */ + page_size = le32_to_cpu(rstr->log_page_size); + if (page_size < 512 || page_size & (page_size - 1)) + log_err_exit(buf, "$LogFile is corrupt: Restart page header " + "specifies invalid log page size. Cannot " + "handle this yet.\n"); + if (page_size != le32_to_cpu(rstr->system_page_size)) { + page_size = le32_to_cpu(rstr->system_page_size); + if (page_size < 512 || page_size & (page_size - 1)) + log_err_exit(buf, "$LogFile is corrupt: Restart page " + "header specifies invalid system page " + "size. Cannot handle this yet.\n"); } - if ((pass == 2) && !memcmp(buf, rstr, lps)) { - printf("2nd restart area fully matches the 1st one. Skipping " - "display.\n"); - goto skip_rstr_pass; - } - if (le16_to_cpu(rstr->major_ver != 1) || - le16_to_cpu(rstr->minor_ver != 1)) { - fprintf(stderr, "$LogFile version %i.%i! Error: Unknown " - "$LogFile version!\n", - le16_to_cpu(rstr->major_ver), - le16_to_cpu(rstr->minor_ver)); - goto log_file_error; - } - ra = (RESTART_AREA*)((u8*)rstr + le16_to_cpu(rstr->restart_offset)); - lcr = (LOG_CLIENT_RECORD*)((u8*)ra + - le16_to_cpu(ra->client_array_offset)); - /* Dump of the interpreted $LogFile restart area. */ + /* Abort if the version number is not 1.1. */ + if (sle16_to_cpu(rstr->major_ver != 1) || + sle16_to_cpu(rstr->minor_ver != 1)) + log_err_exit(buf, "Unknown $LogFile version %i.%i. Only know " + "how to handle version 1.1.\n", + sle16_to_cpu(rstr->major_ver), + sle16_to_cpu(rstr->minor_ver)); + /* Verify the location and size of the update sequence array. */ + usa_end_ofs = le16_to_cpu(rstr->usa_ofs) + + le16_to_cpu(rstr->usa_count) * sizeof(u16); + if (page_size / NTFS_SECTOR_SIZE + 1 != le16_to_cpu(rstr->usa_count)) + log_err_exit(buf, "Restart page header in $LogFile is " + "corrupt: Update sequence array size is " + "wrong. Cannot handle this yet.\n"); + if (le16_to_cpu(rstr->usa_ofs) < sizeof(RESTART_PAGE_HEADER)) + log_err_exit(buf, "Restart page header in $LogFile is " + "corrupt: Update sequence array overlaps " + "restart page header. Cannot handle this " + "yet.\n"); + if (usa_end_ofs >= NTFS_SECTOR_SIZE - sizeof(u16)) + log_err_exit(buf, "Restart page header in $LogFile is " + "corrupt: Update sequence array overlaps or " + "is behind first protected sequence number. " + "Cannot handle this yet.\n"); + if (usa_end_ofs > le16_to_cpu(rstr->restart_offset)) + log_err_exit(buf, "Restart page header in $LogFile is " + "corrupt: Update sequence array overlaps or " + "is behind restart area. Cannot handle this " + "yet.\n"); + /* Finally, verify the offset of the restart area. */ + if (le16_to_cpu(rstr->restart_offset) & 7) + log_err_exit(buf, "Restart page header in $LogFile is " + "corrupt: Restart area offset is not aligned " + "to 8-byte boundary. Cannot handle this " + "yet.\n"); + /* + * Second, verify the restart area itself. + */ + // TODO: Implement this. + fprintf(stderr, "Warning: Sanity checking of restart area not " + "implemented yet.\n"); + /* + * Third and last, verify the array of log client records. + */ + // TODO: Implement this. + fprintf(stderr, "Warning: Sanity checking of array of log client " + "records not implemented yet.\n"); +rstr_pass_loc: + if (ntfs_is_chkd_record(rstr->magic)) + log_err_exit(buf, "The %s restart page header in $LogFile has " + "been modified by chkdsk. Do not know how to " + "handle this yet. Reboot into Windows to fix " + "this.\n", (u8*)rstr == buf ? "first" : + "second"); + if (ntfs_mst_post_read_fixup((NTFS_RECORD*)rstr, page_size) || + ntfs_is_baad_record(rstr->magic)) + log_err_exit(buf, "$LogFile incomplete multi sector transfer " + "detected in restart page header. Cannot " + "handle this yet.\n"); if (pass == 1) - printf("\n$LogFile version %i.%i.\n", - le16_to_cpu(rstr->major_ver), - le16_to_cpu(rstr->minor_ver)); - printf("\n%s restart area:\n", pass == 1? "1st": "2nd"); - printf("magic = RSTR\n"); - printf("ChkDskLsn = 0x%llx\n", + printf("$LogFile version %i.%i.\n", + sle16_to_cpu(rstr->major_ver), + sle16_to_cpu(rstr->minor_ver)); + else /* if (pass == 2) */ { + /* + * rstr is now the second restart page so we declare rstr1 + * as the first restart page as this one has been verified in + * the first pass so we can use all its members safely. + */ + RESTART_PAGE_HEADER *rstr1 = (RESTART_PAGE_HEADER*)buf; + + /* Exclude the usa from the comparison. */ + ra = (RESTART_AREA*)((u8*)rstr1 + + le16_to_cpu(rstr1->restart_offset)); + if (!memcmp(rstr1, rstr, le16_to_cpu(rstr1->usa_ofs)) && + !memcmp((u8*)rstr1 + le16_to_cpu( + rstr1->restart_offset), (u8*)rstr + + le16_to_cpu(rstr->restart_offset), + le16_to_cpu(ra->restart_area_length))) { + puts("\nSkipping analysis of second restart page " + "because it fully matches the first " + "one."); + goto skip_rstr_pass; + } + /* + * The $LogFile versions specified in each of the two restart + * page headers must match. + */ + if (rstr1->major_ver != rstr->major_ver || + rstr1->minor_ver != rstr->minor_ver) + log_err_exit(buf, "Second restart area specifies " + "different $LogFile version to first " + "restart area. Cannot handle this " + "yet.\n"); + } + /* The restart page header is in rstr and it is mst deprotected. */ + printf("\n%s restart page:\n", pass == 1 ? "1st" : "2nd"); + printf("\nRestart page header:\n"); + printf("magic = %s\n", ntfs_is_rstr_record(rstr->magic) ? "RSTR" : + "CHKD"); + printf("usa_ofs = %u (0x%x)\n", le16_to_cpu(rstr->usa_ofs), + le16_to_cpu(rstr->usa_ofs)); + printf("usa_count = %u (0x%x)\n", le16_to_cpu(rstr->usa_count), + le16_to_cpu(rstr->usa_count)); + printf("chkdsk_lsn = %lli (0x%llx)\n", + (long long)sle64_to_cpu(rstr->chkdsk_lsn), (unsigned long long)sle64_to_cpu(rstr->chkdsk_lsn)); - printf("SystemPageSize = %u\n", le32_to_cpu(rstr->system_page_size)); - printf("LogPageSize = %u\n", le32_to_cpu(rstr->log_page_size)); - printf("RestartOffset = 0x%x\n", le16_to_cpu(rstr->restart_offset)); - printf("\n(1st) restart record:\n"); - printf("CurrentLsn = %llx\n", + printf("system_page_size = %u (0x%x)\n", + le32_to_cpu(rstr->system_page_size), + le32_to_cpu(rstr->system_page_size)); + printf("log_page_size = %u (0x%x)\n", le32_to_cpu(rstr->log_page_size), + le32_to_cpu(rstr->log_page_size)); + printf("restart_offset = %u (0x%x)\n", + le16_to_cpu(rstr->restart_offset), + le16_to_cpu(rstr->restart_offset)); + printf("\nRestart area:\n"); + ra = (RESTART_AREA*)((u8*)rstr + le16_to_cpu(rstr->restart_offset)); + printf("current_lsn = %lli (0x%llx)\n", + (long long)sle64_to_cpu(ra->current_lsn), (unsigned long long)sle64_to_cpu(ra->current_lsn)); - printf("LogClients = %u\n", le16_to_cpu(ra->log_clients)); - printf("ClientFreeList = %i\n", sle16_to_cpu(ra->client_free_list)); - printf("ClientInUseList = %i\n", sle16_to_cpu(ra->client_in_use_list)); - printf("Flags = 0x%x\n", le16_to_cpu(ra->flags)); - printf("SeqNumberBits = %u (0x%x)\n", le32_to_cpu(ra->seq_number_bits), + printf("log_clients = %u (0x%x)\n", le16_to_cpu(ra->log_clients), + le16_to_cpu(ra->log_clients)); + printf("client_free_list = %i (0x%x)\n", + (s16)le16_to_cpu(ra->client_free_list), + le16_to_cpu(ra->client_free_list)); + printf("client_in_use_list = %i (0x%x)\n", + (s16)le16_to_cpu(ra->client_in_use_list), + le16_to_cpu(ra->client_in_use_list)); + printf("flags = 0x%.4x\n", le16_to_cpu(ra->flags)); + printf("seq_number_bits = %u (0x%x)\n", + le32_to_cpu(ra->seq_number_bits), le32_to_cpu(ra->seq_number_bits)); - printf("RestartAreaLength = 0x%x\n", + printf("restart_area_length = %u (0x%x)\n", + le16_to_cpu(ra->restart_area_length), le16_to_cpu(ra->restart_area_length)); - printf("ClientArrayOffset = 0x%x\n", + printf("client_array_offset = %u (0x%x)\n", + le16_to_cpu(ra->client_array_offset), le16_to_cpu(ra->client_array_offset)); - printf("FileSize = %lld (0x%llx)\n", + printf("file_size = %lli (0x%llx)\n", (long long)sle64_to_cpu(ra->file_size), (unsigned long long)sle64_to_cpu(ra->file_size)); - if (sle64_to_cpu(ra->file_size) != buf_size) - puts("$LogFile restart area indicates a log file size" - "different from the actual size!"); - printf("LastLsnDataLength = 0x%x\n", + printf("last_lsn_data_length = %u (0x%x)\n", + le32_to_cpu(ra->last_lsn_data_length), le32_to_cpu(ra->last_lsn_data_length)); - printf("RecordLength = 0x%x\n", le16_to_cpu(ra->record_length)); - printf("LogPageDataOffset = 0x%x\n", + printf("record_length = %u (0x%x)\n", le16_to_cpu(ra->record_length), + le16_to_cpu(ra->record_length)); + printf("log_page_data_offset = %u (0x%x)\n", + le16_to_cpu(ra->log_page_data_offset), le16_to_cpu(ra->log_page_data_offset)); + printf("unknown = %u (0x%x)\n", le16_to_cpu(ra->unknown), + le16_to_cpu(ra->unknown)); + lcr = (LOG_CLIENT_RECORD*)((u8*)ra + + le16_to_cpu(ra->client_array_offset)); for (client = 0; client < le16_to_cpu(ra->log_clients); client++) { - printf("\nRestart client record number %i:\n", client); - printf("OldestLsn = 0x%llx\n", (unsigned long long) + char *client_name; + + printf("\nLog client record number %i:\n", client + 1); + printf("oldest_lsn = %lli (0x%llx)\n", + (long long)sle64_to_cpu(lcr->oldest_lsn), + (unsigned long long) sle64_to_cpu(lcr->oldest_lsn)); - printf("ClientRestartLsn = 0x%llx\n", (unsigned long long) + printf("client_restart_lsn = %lli (0x%llx)\n", (long long) + sle64_to_cpu(lcr->client_restart_lsn), + (unsigned long long) sle64_to_cpu(lcr->client_restart_lsn)); - printf("PrevClient = %i\n", sle16_to_cpu(lcr->prev_client)); - printf("NextClient = %i\n", sle16_to_cpu(lcr->next_client)); - printf("SeqNumber = 0x%llx\n", (unsigned long long) - le64_to_cpu(lcr->seq_number)); - printf("ClientNameLength = 0x%x\n", - le32_to_cpu(lcr->client_name_length)); + printf("prev_client = %i (0x%x)\n", + (s16)le16_to_cpu(lcr->prev_client), + le16_to_cpu(lcr->prev_client)); + printf("next_client = %i (0x%x)\n", + (s16)le16_to_cpu(lcr->next_client), + le16_to_cpu(lcr->next_client)); + printf("seq_number = %u (0x%x)\n", le16_to_cpu(lcr->seq_number), + le16_to_cpu(lcr->seq_number)); + printf("client_name_length = %u (0x%x)\n", + le32_to_cpu(lcr->client_name_length) / 2, + le32_to_cpu(lcr->client_name_length) / 2); if (le32_to_cpu(lcr->client_name_length)) { - // convert to ascii and print out. - // printf("ClientName = %u\n", le16_to_cpu(lcr->client_name)); - } - /* Size of a restart client record is fixed at 0xa0 bytes. */ - lcr = (LOG_CLIENT_RECORD*)((u8*)lcr + 0xa0); + client_name = NULL; + if (ntfs_ucstombs(lcr->client_name, + le32_to_cpu(lcr->client_name_length) / + 2, &client_name, 0) < 0) { + perror("Failed to convert log client name"); + client_name = strdup(""); + } + } else + client_name = strdup(""); + printf("client_name = %s\n", client_name); + free(client_name); + /* + * Log client records are fixed size so we can simply use the + * C increment operator to get to the next one. + */ + lcr++; } skip_rstr_pass: if (pass == 1) { - rstr = (RESTART_PAGE_HEADER*)((u8*)rstr + lps); + rstr = (RESTART_PAGE_HEADER*)((u8*)rstr + page_size); ++pass; - goto pass_loc; + goto rstr_pass_loc; } - rcrd = (RECORD_PAGE_HEADER*)rstr; - /* Reuse pass for log record clienter. */ + printf("\n\nFinished with restart pages. Beginning with log pages.\n"); + /* Reuse pass for log area. */ pass = 0; - printf("\nFinished with restart area. Beginning with log area.\n"); + rcrd = (RECORD_PAGE_HEADER*)rstr; rcrd_pass_loc: - rcrd = (RECORD_PAGE_HEADER*)((u8*)rcrd + lps); - if ((u8*)rcrd + lps > buf + buf_size) + rcrd = (RECORD_PAGE_HEADER*)((u8*)rcrd + page_size); + if ((u8*)rcrd + page_size > buf + buf_size) goto end_of_rcrd_passes; printf("\nLog record page number %i", pass); - if (!ntfs_is_rcrd_record(rcrd->magic)) { - for (i = 0; i < lps; i++) + if (!ntfs_is_rcrd_record(rcrd->magic) && + !ntfs_is_chkd_record(rcrd->magic)) { + for (i = 0; i < page_size; i++) if (((u8*)rcrd)[i] != (u8)-1) break; - if (i < lps) - puts(" is corrupt (magic RCRD is missing)."); + if (i < page_size) + puts(" is corrupt (magic is not RCRD or CHKD)."); else puts(" is empty."); pass++; goto rcrd_pass_loc; } else - printf(":"); + puts(":"); /* Dump log record page */ - printf("\nmagic = RCRD\n"); + printf("magic = %s\n", ntfs_is_rcrd_record(rcrd->magic) ? "RCRD" : + "CHKD"); +// TODO: I am here... (AIA) printf("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd->copy.last_lsn)); printf("flags = 0x%x\n", le32_to_cpu(rcrd->flags)); @@ -444,8 +581,6 @@ log_record_pass: pass++; goto rcrd_pass_loc; end_of_rcrd_passes: -log_file_error: - printf("\n"); free(buf); return 0; } From 2f3d8287a5107d97bce5412c5710e8bfaa56a4d1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 08:42:10 +0000 Subject: [PATCH 1326/2994] More ntfsdump_logfile updates. BKrev: 40711be2YTBdRjjYNs9TQv2eXuPGTQ From f94ee6946fee36363bd72c8cd3a12ab08ba7cdb4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 08:42:10 +0000 Subject: [PATCH 1327/2994] Update (Logical change 1.355) --- include/ntfs/logfile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index fe60d492..4dfb0cfd 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -71,7 +71,7 @@ typedef struct { of the usa (usa_count) and add it to usa_ofs. Then verify that the result is less than the value of the restart_offset. */ -/* 20*/ u32 log_page_size; /* Byte size of log file records, has to be >= +/* 20*/ u32 log_page_size; /* Byte size of log file pages, has to be >= 512 and a power of 2. Usually is 4096 (or is it just set to system_page_size?). */ /* 24*/ u16 restart_offset; /* Byte offset from the start of this header to From 5e56debf45bee3fa4b9dcdc23f96d1fc0294b92a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 08:44:32 +0000 Subject: [PATCH 1328/2994] Mostly rewrite ntfsinfo. (Yuval Fledel and some fixes by me) (Logical change 1.356) --- ntfsprogs/ntfsinfo.c | 900 ++++++++++++++++++++++++++++++------------- 1 file changed, 639 insertions(+), 261 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 486089a0..d3e51710 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -23,20 +23,30 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* TODO LIST: - * 1. Better error checking. In fact, my error checking sucks. - * 2. Fix output issues. - * 3. Comment things better + * 1. Better error checking. (focus on ntfs_dump_volume) + * 2. Comment things better. + * 3. More things at verbose mode. + * 4. Dump ACLs when security_id exists (NTFS 3+ only). + * 5. Dump by name rather by Inode . + * 6. Clean ups. + * 7. Internationalization. + * 8. The AT_ATTRIBUTE_LIST issue. + * 9. Add more Indexed Attr Types. + * 10.Make formatting look more like www.flatcap.org/ntfs/info * * Still not dumping certain attributes. Need to find the best - * way to output some of these attributes. + * way to output some of these attributes. * * Still need to do: - * $OBJECT_ID - dump correctly * $SECURITY_DESCRIPTOR + * $REPARSE_POINT/$SYMBOLIC_LINK + * $EA_INFORMATION + * $EA + * $PROPERTY_SET + * $LOGGED_UTILITY_STREAM + * ntfs_dump_attr_unknown() */ - - #include "config.h" #include @@ -65,7 +75,6 @@ static struct options { int quiet; /* Less output */ int verbose; /* Extra output */ int force; /* Override common sense */ - int epochtime; /* Report all timestamps as "Thu Jan 1 00:00:00 1970" */ int notime; /* Don't report timestamps at all */ int mft; /* Dump information about the volume as well */ } opts; @@ -106,8 +115,7 @@ void usage (void) " -d dev --device dev The ntfs volume to display information about\n" " -i num --inode num Display information about this inode\n" " -m --mft Dump information about the volume\n" - " -t --epochtime Report all timestamps as \"Thu Jan 1 00:00:00 1970\"\n" - " -T --notime Don't report timestamps at all\n" + " -t --notime Don't report timestamps\n" "\n" " -f --force Use less caution\n" " -q --quiet Less output\n" @@ -138,10 +146,9 @@ int parse_options (int argc, char *argv[]) { "quiet", no_argument, NULL, 'q' }, { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' }, - { "epochtime", no_argument, NULL, 't' }, { "notime", no_argument, NULL, 'T' }, - { "mft", no_argument, NULL, 'm' }, - { NULL, 0, NULL, 0 }, + { "mft", no_argument, NULL, 'm' }, + { NULL, 0, NULL, 0 } }; char c = -1; @@ -180,10 +187,12 @@ int parse_options (int argc, char *argv[]) opts.quiet++; break; case 't': - opts.epochtime++; + opts.notime++; break; case 'T': - opts.notime++; + /* 'T' is depreceted, notify */ + Eprintf ("Option 'T' is deprecated, it was replaced by 't'.\n"); + err++; break; case 'v': opts.verbose++; @@ -224,11 +233,6 @@ int parse_options (int argc, char *argv[]) Eprintf ("You may not use --quiet and --verbose at the same time.\n"); err++; } - - if (opts.epochtime && opts.notime) { - Eprintf ("You may not use --notime and --epochtime at the same time.\n"); - err++; - } } if (ver) @@ -239,197 +243,252 @@ int parse_options (int argc, char *argv[]) return (!err && !help && !ver); } +/**************** utility functions *********************/ + +/** + * ntfsinfo_time_to_str() + * @sle_ntfs_clock The disk time format, meaning 100ns units since 1st jan 1601 + * in little-endian format + * + * Return char* in a format 'Thu Jan 1 00:00:00 1970'. + * + * Example of usage: + * char *time_str = ntfsinfo_time_to_str( + * sle64_to_cpu(standard_attr->creation_time)); + * printf("\tFile Creation Time: \t %s",time_str); + * free(time_str); + */ +char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) +{ + time_t unix_clock = ntfs2utc(sle64_to_cpu(sle_ntfs_clock)); + return ctime(&unix_clock); +} + +/** + * ntfs_attr_get_name() + * @attr a vaild attribute record + * + * return multi-byte string containing the attribute name if exist. the user + * is then responsible of freeing that memory. + * null if no name exists (attr->name_length==0). no memory allocated. + * null if cannot convert to multi-byte string. errno would contain the + * error id. no memory allocated in that case + */ +char *ntfs_attr_get_name(ATTR_RECORD *attr) +{ + uchar_t *ucs_attr_name; + char *mbs_attr_name = NULL; + int mbs_attr_name_size; + + /* calculate name position */ + ucs_attr_name = (uchar_t *)((char *)attr + le16_to_cpu(attr->name_offset)); + /* convert unicode to printable format */ + mbs_attr_name_size = ntfs_ucstombs(ucs_attr_name,attr->name_length, + &mbs_attr_name,0); + if (mbs_attr_name_size>0) { + return mbs_attr_name; + } else { + return NULL; + } +} + +/**************** functions for dumping global info *********************/ /** * ntfs_dump_volume - dump information about the volume */ void ntfs_dump_volume(ntfs_volume *vol) { - - printf("Volume Information \n"); - printf("\tName of device: %s\n", vol->dev->d_name); - printf("\tDevice state: %lu\n", vol->dev->d_state); - printf("\tVolume Name: %s\n", vol->vol_name); - printf("\tVolume State: %lu\n", vol->state); - printf("\tVolume Version: %u.%u\n", vol->major_ver, vol->minor_ver); - printf("\tSector Size: %hu\n", vol->sector_size); - printf("\tCluster Size: %u\n", vol->cluster_size); - printf("\tVolume Size in Clusters: %lld\n", (long long)vol->nr_clusters); - - printf("MFT Information \n"); - printf("\tMFT Record Size: %u\n", vol->mft_record_size); - printf("\tMFT Zone Multiplier: %u\n", vol->mft_zone_multiplier); - printf("\tMFT Data Position: %lld\n", (long long)vol->mft_data_pos); - printf("\tMFT Zone Start: %lld\n", (long long)vol->mft_zone_start); - printf("\tMFT Zone End: %lld\n", (long long)vol->mft_zone_end); - printf("\tMFT Zone Position: %lld\n", (long long)vol->mft_zone_pos); - printf("\tCurrent Position in First Data Zone: %lld\n", - (long long)vol->data1_zone_pos); - printf("\tCurrent Position in Second Data Zone: %lld\n", - (long long)vol->data2_zone_pos); - printf("\tNumber of Initialized Records in MFT: %lld\n", - (long long)vol->nr_mft_records); - printf("\tLCN of Data Attribute for FILE_MFT: %lld\n", - (long long)vol->mft_lcn); - printf("\tFILE_MFTMirr Size: %d\n", vol->mftmirr_size); - printf("\tLCN of Data Attribute for File_MFTMirr: %lld\n", - (long long)vol->mftmirr_lcn); - printf("\tSize of Attribute Definition Table: %d\n", vol->attrdef_len); - - printf("FILE_Bitmap Information \n"); - printf("\tFILE_Bitmap MFT Record Number: %llu\n", - (unsigned long long)vol->lcnbmp_ni->mft_no); - printf("\tState of FILE_Bitmap Inode: %lu\n", vol->lcnbmp_ni->state); - printf("\tLength of Attribute List: %u\n", vol->lcnbmp_ni->attr_list_size); - printf("\tAttribute List: %s\n", vol->lcnbmp_ni->attr_list); - printf("\tNumber of Attached Extent Inodes: %d\n", vol->lcnbmp_ni->nr_extents); - //FIXME: need to add code for the union if nr_extens != 0, but - //i dont know if it will ever != 0 with FILE_Bitmap - - printf("FILE_Bitmap Data Attribute Information\n"); - printf("\tDecompressed Runlist: not done yet\n"); - printf("\tBase Inode: %llu\n", - (unsigned long long)vol->lcnbmp_na->ni->mft_no); - printf("\tAttribute Types: not done yet\n"); - //printf("\tAttribute Name: %s\n", vol->lcnbmp_na->name); - printf("\tAttribute Name Length: %u\n", vol->lcnbmp_na->name_len); - printf("\tAttribute State: %lu\n", vol->lcnbmp_na->state); - printf("\tAttribute Allocated Size: %lld\n", - (long long)vol->lcnbmp_na->allocated_size); - printf("\tAttribute Data Size: %lld\n", - (long long)vol->lcnbmp_na->data_size); - printf("\tAttribute Initialized Size: %lld\n", - (long long)vol->lcnbmp_na->initialized_size); - printf("\tAttribute Compressed Size: %lld\n", - (long long)vol->lcnbmp_na->compressed_size); - printf("\tCompression Block Size: %u\n", - vol->lcnbmp_na->compression_block_size); - printf("\tCompression Block Size Bits: %u\n", - vol->lcnbmp_na->compression_block_size_bits); - printf("\tCompression Block Clusters: %u\n", - vol->lcnbmp_na->compression_block_clusters); + printf("Volume Information \n"); + printf("\tName of device: %s\n", vol->dev->d_name); + printf("\tDevice state: %lu\n", vol->dev->d_state); + printf("\tVolume Name: %s\n", vol->vol_name); + printf("\tVolume State: %lu\n", vol->state); + printf("\tVolume Version: %u.%u\n", vol->major_ver, vol->minor_ver); + printf("\tSector Size: %hu\n", vol->sector_size); + printf("\tCluster Size: %u\n", vol->cluster_size); + printf("\tVolume Size in Clusters: %lld\n", (long long)vol->nr_clusters); + + printf("MFT Information \n"); + printf("\tMFT Record Size: %u\n", vol->mft_record_size); + printf("\tMFT Zone Multiplier: %u\n", vol->mft_zone_multiplier); + printf("\tMFT Data Position: %lld\n", (long long)vol->mft_data_pos); + printf("\tMFT Zone Start: %lld\n", (long long)vol->mft_zone_start); + printf("\tMFT Zone End: %lld\n", (long long)vol->mft_zone_end); + printf("\tMFT Zone Position: %lld\n", (long long)vol->mft_zone_pos); + printf("\tCurrent Position in First Data Zone: %lld\n", + (long long)vol->data1_zone_pos); + printf("\tCurrent Position in Second Data Zone: %lld\n", + (long long)vol->data2_zone_pos); + printf("\tNumber of Initialized Records in MFT: %lld\n", + (long long)vol->nr_mft_records); + printf("\tLCN of Data Attribute for FILE_MFT: %lld\n", + (long long)vol->mft_lcn); + printf("\tFILE_MFTMirr Size: %d\n", vol->mftmirr_size); + printf("\tLCN of Data Attribute for File_MFTMirr: %lld\n", + (long long)vol->mftmirr_lcn); + printf("\tSize of Attribute Definition Table: %d\n", vol->attrdef_len); + + printf("FILE_Bitmap Information \n"); + printf("\tFILE_Bitmap MFT Record Number: %llu\n", + (unsigned long long)vol->lcnbmp_ni->mft_no); + printf("\tState of FILE_Bitmap Inode: %lu\n", vol->lcnbmp_ni->state); + printf("\tLength of Attribute List: %u\n", vol->lcnbmp_ni->attr_list_size); + printf("\tAttribute List: %s\n", vol->lcnbmp_ni->attr_list); + printf("\tNumber of Attached Extent Inodes: %d\n", + vol->lcnbmp_ni->nr_extents); + /* FIXME: need to add code for the union if nr_extens != 0, but + i dont know if it will ever != 0 with FILE_Bitmap */ + + printf("FILE_Bitmap Data Attribute Information\n"); + printf("\tDecompressed Runlist: not done yet\n"); + printf("\tBase Inode: %llu\n", + (unsigned long long)vol->lcnbmp_na->ni->mft_no); + printf("\tAttribute Types: not done yet\n"); + //printf("\tAttribute Name: %s\n", vol->lcnbmp_na->name); + printf("\tAttribute Name Length: %u\n", vol->lcnbmp_na->name_len); + printf("\tAttribute State: %lu\n", vol->lcnbmp_na->state); + printf("\tAttribute Allocated Size: %lld\n", + (long long)vol->lcnbmp_na->allocated_size); + printf("\tAttribute Data Size: %lld\n", + (long long)vol->lcnbmp_na->data_size); + printf("\tAttribute Initialized Size: %lld\n", + (long long)vol->lcnbmp_na->initialized_size); + printf("\tAttribute Compressed Size: %lld\n", + (long long)vol->lcnbmp_na->compressed_size); + printf("\tCompression Block Size: %u\n", + vol->lcnbmp_na->compression_block_size); + printf("\tCompression Block Size Bits: %u\n", + vol->lcnbmp_na->compression_block_size_bits); + printf("\tCompression Block Clusters: %u\n", + vol->lcnbmp_na->compression_block_clusters); - //TODO: Still need to add a few more attributes + //TODO: Still need to add a few more attributes } +/**************** functions for dumping attributes *********************/ + /** * ntfs_dump_standard_information */ -void ntfs_dump_standard_information_attr(ntfs_inode *inode) +void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) { - STANDARD_INFORMATION *standard_attr = NULL; - ATTR_RECORD *attr = NULL; - ntfs_attr_search_ctx *ctx = NULL; u32 value_length; - ctx = ntfs_attr_get_search_ctx(inode, NULL); + standard_attr = (STANDARD_INFORMATION*)((char *)attr + + le16_to_cpu(attr->value_offset)); - if(ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - if (errno != ENOENT) - fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_STANDARD_INFORMATION!\n"); - ntfs_attr_put_search_ctx(ctx); //free ctx - return; + printf("Dumping attribute $STANDARD_INFORMATION (0x10)\n"); + + /* let's start with mandatory? fields */ + + /* time conversion stuff */ + if (!opts.notime) { + char *ntfs_time_str = NULL; + + ntfs_time_str = ntfsinfo_time_to_str(standard_attr->creation_time); + printf("\tFile Creation Time: \t %s",ntfs_time_str); + + ntfs_time_str = ntfsinfo_time_to_str( + standard_attr->last_data_change_time); + printf("\tFile Altered Time: \t %s",ntfs_time_str); + + ntfs_time_str = ntfsinfo_time_to_str( + standard_attr->last_mft_change_time); + printf("\tMFT Changed Time: \t %s",ntfs_time_str); + + ntfs_time_str = ntfsinfo_time_to_str(standard_attr->last_access_time); + printf("\tLast Accessed Time: \t %s",ntfs_time_str); } + + /* TODO: file_attributes - Flags describing the file. */ + + printf("\tMax Number of Versions:\t %u \n", + le32_to_cpu(standard_attr->maximum_versions)); + printf("\tVersion Number: \t %u \n", + le32_to_cpu(standard_attr->version_number)); + printf("\tClass ID: \t\t %u \n", + le32_to_cpu(standard_attr->class_id)); - attr = ctx->attr; - - standard_attr = (STANDARD_INFORMATION*)((char *)attr + le16_to_cpu(attr->value_offset)); - - printf("Dumping $STANDARD_INFORMATION (0x10)\n"); value_length = le32_to_cpu(attr->value_length); if (value_length == 48) { - printf("\t$STANDARD_INFORMATION fields maximum_versions, version_number, \ - class_id, owner_id, security_id missing. This volume has \ - not been upgraded\n"); - } - if (value_length == 72) { - printf("\tMaximum Number of Versions: \t %u \n", - le32_to_cpu(standard_attr->maximum_versions)); - printf("\tVersion Number: \t\t %u \n", - le32_to_cpu(standard_attr->version_number)); - printf("\tClass ID: \t\t\t %u \n", - le32_to_cpu(standard_attr->class_id)); - printf("\tUser ID: \t\t\t %u \n", - le32_to_cpu (standard_attr->owner_id)); - printf("\tSecurity ID: \t\t\t %u \n", - le32_to_cpu(standard_attr->security_id)); +/* printf("\t$STANDARD_INFORMATION fields owner_id, security_id, quota \n" + "\t & usn are missing. This volume has not been upgraded\n"); */ + } else if (value_length == 72) { + printf("\tUser ID: \t\t %u \n", + le32_to_cpu (standard_attr->owner_id)); + printf("\tSecurity ID: \t\t %u \n", + le32_to_cpu(standard_attr->security_id)); } else { printf("\tSize of STANDARD_INFORMATION is %u. It should be " - "either 72 or 48, something is wrong...\n", - value_length); + "either 72 or 48, something is wrong...\n", value_length); } - - ntfs_attr_put_search_ctx(ctx); //free ctx } /** - * ntfs_dump_file_name_attribute + * ntfs_dump_attr_file_name() */ -void ntfs_dump_file_name_attr(ntfs_inode *inode) +void ntfs_dump_attr_file_name(ATTR_RECORD *attr) { FILE_NAME_ATTR *file_name_attr = NULL; - ATTR_RECORD *attr = NULL; - ntfs_attr_search_ctx *ctx = NULL; - char *file_name = NULL; - ctx = ntfs_attr_get_search_ctx(inode, NULL); -do_next: - if(ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - if (errno != ENOENT) - fprintf(stderr, "ntfsinfo error: cannot lookup attribute AT_FILE_NAME!\n"); - ntfs_attr_put_search_ctx(ctx); //free ctx - return; + file_name_attr = (FILE_NAME_ATTR*)((char *)attr + + le16_to_cpu(attr->value_offset)); + + printf("Dumping attribute $FILE_NAME (0x30)\n"); + + /* let's start with the obvious - file name */ + + if (file_name_attr->file_name_length>0) { + /* but first we need to convert the little endian unicode string + into a printable format */ + char *mbs_file_name = NULL; + int mbs_file_name_size; + + mbs_file_name_size = ntfs_ucstombs(file_name_attr->file_name, + file_name_attr->file_name_length,&mbs_file_name,0); + + if (mbs_file_name_size>0) { + printf("\tFile Name: \t\t '%s'\n", mbs_file_name); + free(mbs_file_name); + } else { + /* an error occured, errno holds the reason - notify the user */ + fprintf(stderr, "ntfsinfo error: could not parse file name: %s\n", + strerror(errno)); + } + /* any way, error or not, print the length */ + printf("\tFile Name Length: \t %d\n", file_name_attr->file_name_length); + } else { + printf("\tFile Name: \t\t unnamed?!?\n"); } - - attr = ctx->attr; - - file_name_attr = (FILE_NAME_ATTR*)((char *)attr + le16_to_cpu(attr->value_offset)); - - //need to convert the little endian unicode string to a multibyte string - ntfs_ucstombs(file_name_attr->file_name, file_name_attr->file_name_length, - &file_name, file_name_attr->file_name_length); - - printf("Dumping $FILE_NAME (0x30)\n"); - - //basic stuff about the file - printf("\tFile Name: \t\t %s\n", file_name); - printf("\tFile Name Length: \t %d\n", file_name_attr->file_name_length); + + /* other basic stuff about the file */ printf("\tAllocated File Size: \t %lld\n", - (long long)sle64_to_cpu(file_name_attr->allocated_size)); + (long long)sle64_to_cpu(file_name_attr->allocated_size)); printf("\tReal File Size: \t %lld\n", - (long long)sle64_to_cpu(file_name_attr->data_size)); + (long long)sle64_to_cpu(file_name_attr->data_size)); - //time conversion stuff + /* time stuff stuff */ if (!opts.notime) { - time_t ntfs_time = { 0 }; + char *ntfs_time_str; - if (!opts.epochtime) { - ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->creation_time)); - printf("\tFile Creation Time: \t %s",ctime(&ntfs_time)); - - ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_data_change_time)); - printf("\tFile Altered Time: \t %s",ctime(&ntfs_time)); - - ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_mft_change_time)); - printf("\tMFT Changed Time: \t %s",ctime(&ntfs_time)); - - ntfs_time = ntfs2utc (sle64_to_cpu (file_name_attr->last_access_time)); - printf("\tLast Accessed Time: \t %s",ctime(&ntfs_time)); - } else { - char *t = asctime(gmtime(&ntfs_time)); - printf("\tFile Creation Time: \t %s",t); - printf("\tFile Altered Time: \t %s",t); - printf("\tMFT Changed Time: \t %s",t); - printf("\tLast Accessed Time: \t %s",t); - } + ntfs_time_str = ntfsinfo_time_to_str(file_name_attr->creation_time); + printf("\tFile Creation Time: \t %s",ntfs_time_str); + + ntfs_time_str = ntfsinfo_time_to_str( + file_name_attr->last_data_change_time); + printf("\tFile Altered Time: \t %s",ntfs_time_str); + + ntfs_time_str = ntfsinfo_time_to_str( + file_name_attr->last_mft_change_time); + printf("\tMFT Changed Time: \t %s",ntfs_time_str); + + ntfs_time_str = ntfsinfo_time_to_str(file_name_attr->last_access_time); + printf("\tLast Accessed Time: \t %s",ntfs_time_str); } - - free(file_name); - file_name = NULL; - goto do_next; } @@ -439,106 +498,102 @@ do_next: * dump the $OBJECT_ID attribute - not present on all systems * */ -void ntfs_dump_object_id_attr(ntfs_inode *inode) +void ntfs_dump_attr_object_id(ATTR_RECORD *attr,ntfs_volume *vol) { OBJECT_ID_ATTR *obj_id_attr = NULL; - ATTR_RECORD *attr = NULL; - ntfs_attr_search_ctx *ctx = NULL; - - ctx = ntfs_attr_get_search_ctx(inode, NULL); - - if (ntfs_attr_lookup(AT_OBJECT_ID, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - if (errno != ENOENT) - fprintf(stderr, "ntfsinfo error: cannot look up " - "attribute AT_OBJECT_ID: %s\n", - strerror(errno)); - ntfs_attr_put_search_ctx(ctx); - return; - } - - attr = ctx->attr; obj_id_attr = (OBJECT_ID_ATTR *)((u8*)attr + le16_to_cpu(attr->value_offset)); - printf("Dumping $OBJECT_ID (0x40)\n"); + printf("Dumping attribute $OBJECT_ID (0x40)\n"); - if (inode->vol->major_ver >= 3.0) { + if (vol->major_ver >= 3.0) { u32 value_length; char printable_GUID[37]; - printf("\tVolume Version >= 3.0... Dumping Attributes\n"); - value_length = le32_to_cpu(attr->value_length); /* Object ID is mandatory. */ ntfs_guid_to_mbs(&obj_id_attr->object_id, printable_GUID); - printf("\tObject ID:\t\t%s\n", printable_GUID); + printf("\tObject ID:\t\t %s\n", printable_GUID); /* Dump Birth Volume ID. */ if ((value_length > sizeof(GUID)) && !ntfs_guid_is_zero( &obj_id_attr->birth_volume_id)) { ntfs_guid_to_mbs(&obj_id_attr->birth_volume_id, printable_GUID); - printf("\tBirth Volume ID:\t\t%s\n", printable_GUID); + printf("\tBirth Volume ID:\t\t %s\n", printable_GUID); } else - printf("\tBirth Volume ID:\tmissing\n"); + printf("\tBirth Volume ID:\t missing\n"); /* Dumping Birth Object ID */ if ((value_length > sizeof(GUID)) && !ntfs_guid_is_zero( &obj_id_attr->birth_object_id)) { ntfs_guid_to_mbs(&obj_id_attr->birth_object_id, printable_GUID); - printf("\tBirth Object ID:\t\t%s\n", printable_GUID); + printf("\tBirth Object ID:\t\t %s\n", printable_GUID); } else - printf("\tBirth Object ID:\tmissing\n"); + printf("\tBirth Object ID:\t missing\n"); /* Dumping Domain_id - reserved for now */ if ((value_length > sizeof(GUID)) && !ntfs_guid_is_zero( &obj_id_attr->domain_id)) { ntfs_guid_to_mbs(&obj_id_attr->domain_id, printable_GUID); - printf("\tDomain ID:\t\t\t%s\n", printable_GUID); + printf("\tDomain ID:\t\t\t %s\n", printable_GUID); } else - printf("\tDomain ID:\t\tmissing\n"); - } else - printf("\t$OBJECT_ID not present. Only NTFS versions > 3.0 " - "have $OBJECT_ID. Your version of NTFS is " - "%d.\n", inode->vol->major_ver); - - ntfs_attr_put_search_ctx(ctx); + printf("\tDomain ID:\t\t missing\n"); + } else + printf("\t$OBJECT_ID not present. Only NTFS versions > 3.0\n" + "\thave $OBJECT_ID. Your version of NTFS is %d.\n", + vol->major_ver); } +/* + * ntfs_dump_security_descriptor() + * + * dump the security information about the file + */ +void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr) +{ + printf("Dumping attribute $SECURITY_DESCRIPTOR (0x50)\n"); + printf("\tTODO\n"); +} /* * ntfs_dump_volume_name() * * dump the name of the volume the inode belongs to */ -void ntfs_dump_volume_name_attr(ntfs_inode *inode) +void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) { - VOLUME_NAME *vol_name = NULL; - ATTR_RECORD *attr = NULL; - ntfs_attr_search_ctx *ctx = NULL; + uchar_t *ucs_vol_name = NULL; - ctx = ntfs_attr_get_search_ctx(inode, NULL); - if (ntfs_attr_lookup(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, - ctx)) { - if (errno != ENOENT) - fprintf(stderr, "ntfsinfo error: cannot look up " - "attribute AT_VOLUME_NAME: %s\n", - strerror(errno)); - ntfs_attr_put_search_ctx(ctx); - return; + printf("Dumping attribute $VOLUME_NAME (0x60)\n"); + + if (attr->value_length>0) { + char *mbs_vol_name = NULL; + int mbs_vol_name_length; + /* calculate volume name position */ + ucs_vol_name = (uchar_t*)((u8*)attr + + le16_to_cpu(attr->value_offset)); + /* convert the name to current locale multibyte sequence */ + mbs_vol_name_length = ntfs_ucstombs(ucs_vol_name, + attr->value_length/sizeof(uchar_t), + &mbs_vol_name,0); + + if (mbs_vol_name_length>0) { + /* output the converted name. */ + printf("\tVolume Name: \t\t '%s'\n",mbs_vol_name); + free(mbs_vol_name); + } else { + /* an error occured, errno holds the reason - notify the user */ + fprintf(stderr,"ntfsinfo error: could not parse volume name: %s\n", + strerror(errno)); + } + } else { + printf("\tVolume Name: \t\t unnamed\n"); } - attr = ctx->attr; - vol_name = (VOLUME_NAME*)((char *)attr + - le16_to_cpu(attr->value_offset)); - printf("Dumping $VOLUME_NAME (0x60)\n"); - // FIXME: convert the name to current locale multibyte sequence - // then output the converted name. - //printf("\tVolume Name: \t\t\t %s\n", vol_name->name); - ntfs_attr_put_search_ctx(ctx); } @@ -548,36 +603,280 @@ void ntfs_dump_volume_name_attr(ntfs_inode *inode) * dump the information for the volume the inode belongs to * */ -void ntfs_dump_volume_information_attr(ntfs_inode *inode) +void ntfs_dump_attr_volume_information(ATTR_RECORD *attr) { - VOLUME_INFORMATION *vol_information = NULL; - ATTR_RECORD *attr = NULL; - ntfs_attr_search_ctx *ctx = NULL; + VOLUME_INFORMATION *vol_information = NULL; + + vol_information = (VOLUME_INFORMATION*)((char *)attr+ + le16_to_cpu(attr->value_offset)); - ctx = ntfs_attr_get_search_ctx(inode, NULL); + printf("Dumping attribute $VOLUME_INFORMATION (0x70)\n"); - if(ntfs_attr_lookup(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - if (errno != ENOENT) - fprintf(stderr, "ntfsinfo error: cannot look up attribute AT_VOLUME_INFORMATION: %s\n", - strerror(errno)); - ntfs_attr_put_search_ctx(ctx); - return; - } - - attr = ctx->attr; - - vol_information = (VOLUME_INFORMATION*)((char *)attr + le16_to_cpu(attr->value_offset)); - - printf("Dumping $VOLUME_INFORMATION (0x70)\n"); - - printf("\tVolume Major Version: \t\t\t %d\n", vol_information->major_ver); - printf("\tVolume Minor Version: \t\t\t %d\n", vol_information->minor_ver); - printf("\tFlags: \t\t\t Not Finished Yet! \n"); - - ntfs_attr_put_search_ctx(ctx); + printf("\tVolume Version: \t %d.%d\n", vol_information->major_ver, + vol_information->minor_ver); + printf("\tFlags: \t\t\t "); + if (vol_information->flags & VOLUME_IS_DIRTY) + printf("DIRTY "); + if (vol_information->flags & VOLUME_RESIZE_LOG_FILE) + printf("RESIZE_LOG "); + if (vol_information->flags & VOLUME_UPGRADE_ON_MOUNT) + printf("UPG_ON_MOUNT "); + if (vol_information->flags & VOLUME_MOUNTED_ON_NT4) + printf("MOUNTED_NT4 "); + if (vol_information->flags & VOLUME_DELETE_USN_UNDERWAY) + printf("DEL_USN "); + if (vol_information->flags & VOLUME_REPAIR_OBJECT_ID) + printf("REPAIR_OBJID "); + if (vol_information->flags & VOLUME_MODIFIED_BY_CHKDSK) + printf("MOD_BY_CHKDSK "); + if (vol_information->flags & VOLUME_FLAGS_MASK) { + printf("\n"); + } else { + printf("none set\n"); + } + if (vol_information->flags & (0xFFFF - VOLUME_FLAGS_MASK)) + printf("\t\t\t\t Unknown Flags: 0x%04x\n", + vol_information->flags & (0xFFFF - VOLUME_FLAGS_MASK)); } +/* + * ntfs_dump_data_attr() + * + * dump some info about the data attribute + */ +void ntfs_dump_attr_data(ATTR_RECORD *attr) +{ + printf("Dumping attribute $DATA (0x80) related info\n"); + /* Dump stream name */ + if (attr->name_length) { + char *stream_name = NULL; + + stream_name = ntfs_attr_get_name(attr); + if (stream_name) { + printf("\tStream name: \t\t '%s'\n",stream_name); + free(stream_name); + } else { + /* an error occured, errno holds the reason - notify the user */ + fprintf(stderr, "ntfsinfo error: could not parse stream name: %s\n", + strerror(errno)); + } + } else { + printf("\tStream name: \t\t unnamed\n"); + } + +/* length + u16 name_offset; + ATTR_FLAGS flags; + u16 instance; */ + + /* fork by residence */ + if (attr->non_resident) { +/* VCN lowest_vcn; Lowest valid virtual cluster number + VCN highest_vcn; Highest valid vcn of this extent of + u16 mapping_pairs_offset; Byte offset from the ... */ + printf("\tIs resident? \t\t No\n"); + printf("\tData size: \t\t %llu\n", + (long long)le64_to_cpu(attr->data_size)); + printf("\tAllocated size: \t %llu\n", + (long long)le64_to_cpu(attr->allocated_size)); + printf("\tInitialized size: \t %llu\n", + (long long)le64_to_cpu(attr->initialized_size)); + if (attr->compression_unit) { + printf("\tCompression unit: \t %u\n",attr->compression_unit); + printf("\tCompressed size: \t %llu\n", + (long long)le64_to_cpu(attr->compressed_size)); + } else { + printf("\tNot Compressed\n"); + } + } else { + printf("\tIs resident? \t\t Yes\n"); + printf("\tData size: \t\t %u\n",le32_to_cpu(attr->value_length)); +/* u16 value_offset; Byte offset of the attribute + RESIDENT_ATTR_FLAGS resident_flags; */ + } +} + +/* + * ntfs_dump_attr_index_root() + * + * dump the index_root attribute + */ +void ntfs_dump_attr_index_root(ATTR_RECORD *attr) +{ + INDEX_ROOT *index_root = NULL; + + index_root = (INDEX_ROOT*)((u8*)attr + le16_to_cpu(attr->value_offset)); + + printf("Dumping attribute $INDEX_ROOT (0x90)\n"); + + /* Dump index name */ + if (attr->name_length) { + char *index_name = NULL; + index_name = ntfs_attr_get_name(attr); + + if (index_name) { + printf("\tIndex name: \t\t '%s'\n",index_name); + free(index_name); + } else { + /* an error occured, errno holds the reason - notify the user */ + fprintf(stderr, "ntfsinfo error: could not parse index name: %s\n", + strerror(errno)); + } + } else { + printf("\tIndex name: \t\t unnamed\n"); + } + + /* attr_type dumping */ + printf("\tIndexed Attr Type: \t "); + if (index_root->type) { + if (index_root->type & (0xFFFF - AT_FILE_NAME)) { + /* wierd, this should be illgeal */ + printf("%4X\n",index_root->type); + fprintf(stderr, "ntfsinfo error: Illeal Indexed Attr Type: %4X\n", + index_root->type); + } else { + printf("file names\n"); + } + } else { + /* fixme: add some more index types */ + printf("unknown\n"); + } + + /* collation rule dumping */ + printf("\tCollation Rule: \t %u\n", + le32_to_cpu(index_root->collation_rule)); +/* COLLATION_BINARY, COLLATION_FILE_NAME, COLLATION_UNICODE_STRING, + COLLATION_NTOFS_ULONG, COLLATION_NTOFS_SID, + COLLATION_NTOFS_SECURITY_HASH, COLLATION_NTOFS_ULONGS */ + + printf("\tIndex Block Size:\t %u\n", + le32_to_cpu(index_root->index_block_size)); + printf("\tClusters Per Block:\t %u\n", + index_root->clusters_per_index_block); + + /* index header starts here */ + printf("\tAllocated Size:\t\t %u\n", + le32_to_cpu(index_root->index.allocated_size)); + printf("\tUsed Size:\t\t %u\n", + le32_to_cpu(index_root->index.index_length)); + printf("\tFlags:\t\t\t %u\n",index_root->index.flags); + /* printf("\tIndex Entries Following\t %u\n", ???? );*/ +} + +/* + * ntfs_dump_attr_index_allocation() + * + * dump the index_allocation attribute + */ +void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr) +{ + printf("Dumping attribute $INDEX_ALLOCATION (0xA0)\n"); + + /* Dump index name */ + if (attr->name_length) { + char *index_name = NULL; + index_name = ntfs_attr_get_name(attr); + + if (index_name) { + printf("\tIndex name: \t\t '%s'\n",index_name); + free(index_name); + } else { + /* an error occured, errno holds the reason - notify the user */ + fprintf(stderr, "ntfsinfo error: could not parse index name: %s\n", + strerror(errno)); + } + } else { + printf("\tIndex name: \t\t unnamed\n"); + } +} + +/* + * ntfs_dump_attr_bitmap() + * + * dump the bitmap attribute + */ +void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) +{ + printf("Dumping attribute $BITMAP (0xB0)\n"); + + /* Dump bitmap name */ + if (attr->name_length) { + char *bitmap_name = NULL; + bitmap_name = ntfs_attr_get_name(attr); + + if (bitmap_name) { + printf("\tBitmap name: \t\t '%s'\n",bitmap_name); + free(bitmap_name); + } else { + /* an error occured, errno holds the reason - notify the user */ + fprintf(stderr, "ntfsinfo error: could not parse bitmap name: %s\n", + strerror(errno)); + } + } else { + printf("\tBitmap name: \t\t unnamed\n"); + } +} + +/* + * ntfs_dump_attr_reparse_point() + * + * of ntfs 3.x dumps the reparse_point attribute + */ +void ntfs_dump_attr_reparse_point(ATTR_RECORD *attr) +{ + printf("Dumping attribute $REPARSE_POINT/$SYMBOLIC_LINK (0xC0)\n"); + printf("\tTODO\n"); +} + +/* + * ntfs_dump_attr_ea_information() + * + * dump the ea_information attribute + */ +void ntfs_dump_attr_ea_information(ATTR_RECORD *attr) +{ + printf("Dumping attribute $EA_INFORMATION (0xD0)\n"); + printf("\tTODO\n"); +} + +/* + * ntfs_dump_attr_ea() + * + * dump the ea attribute + */ +void ntfs_dump_attr_ea(ATTR_RECORD *attr) +{ + printf("Dumping attribute $EA (0xE0)\n"); + printf("\tTODO\n"); +} + +/* + * ntfs_dump_attr_property_set() + * + * dump the property_set attribute + */ +void ntfs_dump_attr_property_set(ATTR_RECORD *attr) +{ + printf("Dumping attribute $PROPERTY_SET (0xF0)\n"); + printf("\tTODO\n"); +} + +/* + * ntfs_dump_attr_logged_utility_stream() + * + * dump the property_set attribute + */ +void ntfs_dump_attr_logged_utility_stream(ATTR_RECORD *attr) +{ + printf("Dumping attribute $LOGGED_UTILITY_STREAM (0x100)\n"); + printf("\tTODO\n"); +} + +void ntfs_dump_attr_unknown(ATTR_RECORD *attr) +{ + printf("TODO: ntfs_dump_unknown_attr\n"); +} /** * ntfs_get_file_attributes @@ -585,24 +884,103 @@ void ntfs_dump_volume_information_attr(ntfs_inode *inode) void ntfs_get_file_attributes(ntfs_volume *vol, s64 mft_no) { ntfs_inode *inode = NULL; - //int error; + ntfs_attr_search_ctx *ctx = NULL; + /* first obtain our inode */ inode = ntfs_inode_open(vol, MK_MREF(mft_no, 0)); + if (!inode) { + /* can't open inode */ + /* note: when the specified inode does not exist, EIO is returned + is there a way to give the correct response instead? */ + fprintf(stderr, "Error loading node: %s\n", strerror(errno)); + return; + } + + /* then start enumerating attributes + see ntfs_attr_lookup documentation for detailed explenation */ + ctx = ntfs_attr_get_search_ctx(inode, NULL); + while (!ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx)) { + switch (ctx->attr->type) { + case AT_UNUSED: + /* That's an internal type, isn't it? */ + printf("Weird: AT_UNUSED type was returned, please report this.\n"); + break; + case AT_STANDARD_INFORMATION: + ntfs_dump_attr_standard_information(ctx->attr); + break; + case AT_ATTRIBUTE_LIST: + /* As far as I know, ntfs_attr_lookup transparantly iterate + through AT_ATTRIBUTE_LIST, so we shouldn't get to this */ + /* FIXME: inode 9: $Secure does that, I'll have to check */ + printf("Weird: AT_ATTRIBUTE_LIST type was returned.\n"); + break; + case AT_FILE_NAME: + ntfs_dump_attr_file_name(ctx->attr); + break; + case AT_OBJECT_ID: + ntfs_dump_attr_object_id(ctx->attr,vol); + break; + case AT_SECURITY_DESCRIPTOR: + ntfs_dump_attr_security_descriptor(ctx->attr); + break; + case AT_VOLUME_NAME: + ntfs_dump_attr_volume_name(ctx->attr); + break; + case AT_VOLUME_INFORMATION: + ntfs_dump_attr_volume_information(ctx->attr); + break; + case AT_DATA: + ntfs_dump_attr_data(ctx->attr); + break; + case AT_INDEX_ROOT: + ntfs_dump_attr_index_root(ctx->attr); + break; + case AT_INDEX_ALLOCATION: + ntfs_dump_attr_index_allocation(ctx->attr); + break; + case AT_BITMAP: + ntfs_dump_attr_bitmap(ctx->attr); + break; + case AT_REPARSE_POINT: + ntfs_dump_attr_reparse_point(ctx->attr); + break; + case AT_EA_INFORMATION: + ntfs_dump_attr_ea_information(ctx->attr); + break; + case AT_EA: + ntfs_dump_attr_ea(ctx->attr); + break; + case AT_PROPERTY_SET: + ntfs_dump_attr_property_set(ctx->attr); + break; + case AT_LOGGED_UTILITY_STREAM: + ntfs_dump_attr_logged_utility_stream(ctx->attr); + break; + case AT_END: + printf("Weird: AT_END type was returned, please report this.\n"); + break; + default: + ntfs_dump_attr_unknown(ctx->attr); + } + } + + /* if we exited the loop before we're done - notify the user */ + if (errno != ENOENT) { + fprintf(stderr, "ntfsinfo error: stopped before finished " + "enumerating attributes: %s\n", strerror(errno)); + } else { + printf("End of attribute list reached\n"); + } - //see flatcap.org/ntfs/info for what formatting should look likei - //FIXME: both $FILE_NAME_ATTR and $STANDARD_INFORMATION has times, when do - //we want to output it? - ntfs_dump_standard_information_attr(inode); - ntfs_dump_file_name_attr(inode); - ntfs_dump_object_id_attr(inode); - ntfs_dump_volume_name_attr(inode); - ntfs_dump_volume_information_attr(inode); - + /* close all data-structures we used */ + ntfs_attr_put_search_ctx(ctx); ntfs_inode_close(inode); + + /* happily exit */ } /** - * main - Begin here + * main() - Begin here * * Start from here. * @@ -623,7 +1001,7 @@ int main(int argc, char **argv) return 1; /* if opts.mft is not 0, then we will print out information about - * the volume, such as the sector size and whatnot. + * the volume, such as the sector size and whatnot. */ if (opts.mft) ntfs_dump_volume(vol); From 863655fc9e8fadbc04af4a5c590845bf4e2eb567 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 08:44:32 +0000 Subject: [PATCH 1329/2994] Mostly rewrite ntfsinfo. (Yuval Fledel and some fixes by me) BKrev: 40711c70z36gU_0s-QFvzwueUwapyA From 11cf412fda18277b34b71a69a62fe3b970042cc1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 08:44:32 +0000 Subject: [PATCH 1330/2994] Update (Logical change 1.356) --- ChangeLog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4b766f4c..aeec6d1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,8 +64,9 @@ Thanks to Alexei Alexandrov for the bug report and patch. - Add the ability to read the logfile from a supplied file using the command line option -f to ntfsdump_logfile. - - Updated ntfsclone manual. - - Added some diagnostic and explanatory messages to ntfsclone. + - Updated ntfsclone manual. (Szaka) + - Added some diagnostic and explanatory messages to ntfsclone. (Szaka) + - Mostly rewrite ntfsinfo. (Yuval Fledel and some fixes by me) 11/03/2004 - 1.9.0 - Added ntfsresize relocation support and a lot of cleanups. - In include/ntfs/*.h Wrap all #include "config.h" by #ifdef From 0027b876bc6ecc1e4b362d98bf3be7b008e3f4c1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 09:08:35 +0000 Subject: [PATCH 1331/2994] Add Yuval Fledel. (Logical change 1.357) --- AUTHORS | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/AUTHORS b/AUTHORS index 44938851..877fcf85 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3,11 +3,11 @@ ntfsprogs is written and maintained by Anton Altaparmakov . Current active developers on the project are (in alphabetical order): - Anton Altaparmakov - Jan Kratochvil - Matthew J. Fanto - Lode Leroy - Leonard Norrgĺrd - Richard Russon - Szakacsits Szabolcs - +Anton Altaparmakov +Jan Kratochvil +Matthew J. Fanto +Yuval Fledel (no email address on request) +Lode Leroy +Leonard Norrgĺrd +Richard Russon +Szakacsits Szabolcs From efe99ebfe20e12190de5f93bdbf2a8b91b4574ae Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 09:08:35 +0000 Subject: [PATCH 1332/2994] Minor updates for 1.9.1 release. BKrev: 40712213SbujRyapcq_SZ8hB-PnyTQ From 3005df0091149c1d96e0a4637144661cb380fc7b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 09:08:35 +0000 Subject: [PATCH 1333/2994] Move some news items to older news section. (Logical change 1.357) --- NEWS | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 1516dc98..0d4468fc 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,10 @@ and DOS (DJGPP). Thanks to Christophe Grenier for DOS and FreeBSD testing and fixes and to Lode Leroy for Windows testing and fixes. Note, the Windows version is read-only and has limited functionality at present. + +Older news +========== + Merged the NTFS Gnome VFS module by Jan Kratochvil. Added new utilities: ntfsclone by Szakacsits Szabolcs, ntfscluster by Richard @@ -30,10 +34,6 @@ device io abstraction layer and the addition of the win32 device operations. allow running of simple read-only ntfs utilities under Cygwin.) Thanks to Lode Leroy for the win32 code. - -Older news -========== - Renamed ntfstools to ntfsprogs everywhere. Added new utility ntfslabel by Matthew Fanto. See man 8 ntfslabel for details. From dd71d5915a1647983fea2c55f97289b08a3b799f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 09:08:35 +0000 Subject: [PATCH 1334/2994] Remove last line of file. (Logical change 1.357) --- CREDITS | 1 - 1 file changed, 1 deletion(-) diff --git a/CREDITS b/CREDITS index e69b315f..11c1cd47 100644 --- a/CREDITS +++ b/CREDITS @@ -28,4 +28,3 @@ Also, various code snippets and especially the autoconf/automake automated configuration, compilation and installation system have been ripped shamelessly from numerous different GNU and Gnome utilities and libraries so "Many thanks!" to all the people who have participated in their creation! - From fe2860441080e0dda65c9a4379068a2049949dc4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 09:11:20 +0000 Subject: [PATCH 1335/2994] Update date stamp... (Logical change 1.358) --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index aeec6d1f..657beebc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -17/03/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. +05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. - Fix warnings on powerpc architecture where it would seem char is unsigned so comparisons with -1 cause a warning that comparison is From b4f854016c45df9fc13754c9f440acf197dc3246 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 09:11:20 +0000 Subject: [PATCH 1336/2994] Update date stamp... BKrev: 407122b8r-BrXlZq4GS-hpgNX0F5HQ From 5fb435e10c752d98c03ac76cc437cb343101017f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 21:29:35 +0000 Subject: [PATCH 1337/2994] Hopefully fix the autogen.sh problems using the --force and touch config.h.in sledge hammers. (Logical change 1.359) --- autogen.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 6d9db571..dcdf42a8 100755 --- a/autogen.sh +++ b/autogen.sh @@ -25,7 +25,11 @@ fi } echo Running autoreconf --verbose --install --warnings=all -autoreconf --verbose --install --warnings=all +autoreconf --force --verbose --install --warnings=all + +# This gets around the BitKeeper problem that it checks out files with the +# current time stamp rather than the time stamp at check in time. +touch config.h.in if test -z "$*"; then echo "**Warning**: I am going to run \`configure' with no arguments." From ee1bd3469675a2125a03531445dd2e7ba765e6de Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 21:29:35 +0000 Subject: [PATCH 1338/2994] Hopefully fix the autogen.sh problems using the --force and touch config.h.in sledge hammers. BKrev: 4071cfbfS-HvNfIj3mnOzQf5nX-lUg From f92f0e8badc0d2e28c3c5db40c328974f999f064 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 5 Apr 2004 21:29:35 +0000 Subject: [PATCH 1339/2994] Update (Logical change 1.359) --- ChangeLog | 4 ++++ config.guess | 36 ++++++++++++++++++++++++++++++------ config.sub | 18 +++++++++++++++--- configure | 20 ++++++++++---------- configure.ac | 2 +- install-sh | 16 +++++++++++----- mkinstalldirs | 17 ++++++++++++----- 7 files changed, 83 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 657beebc..4c042b1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +xx/xx/2004 - 1.9.2-WIP + - Hopefully fix the autogen.sh problems using the --force and touch + config.h.in sledge hammers. + 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. - Fix warnings on powerpc architecture where it would seem char is diff --git a/config.guess b/config.guess index 57cc92ea..9b9789b1 100755 --- a/config.guess +++ b/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2004-01-05' +timestamp='2004-03-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -207,12 +207,18 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; + amd64:OpenBSD:*:*) + echo x86_64-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + cats:OpenBSD:*:*) + echo arm-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -249,10 +255,24 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit 0 ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU @@ -290,11 +310,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha*:OpenVMS:*:*) echo alpha-hp-vms @@ -415,6 +436,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; @@ -1240,8 +1264,8 @@ EOF SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; - *:DRAGONFLY:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE} + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; esac diff --git a/config.sub b/config.sub index 77322df8..be933fde 100755 --- a/config.sub +++ b/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2004-01-05' +timestamp='2004-02-23' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -363,6 +363,9 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -442,12 +445,20 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -1143,8 +1154,9 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ diff --git a/configure b/configure index d776b08e..8076eb9e 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.1. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.2-WIP. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.9.1' -PACKAGE_STRING='ntfsprogs 1.9.1' +PACKAGE_VERSION='1.9.2-WIP' +PACKAGE_STRING='ntfsprogs 1.9.2-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -955,7 +955,7 @@ 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 ntfsprogs 1.9.1 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.9.2-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1022,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.9.1:";; + short | recursive ) echo "Configuration of ntfsprogs 1.9.2-WIP:";; esac cat <<\_ACEOF @@ -1169,7 +1169,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.9.1 +ntfsprogs configure 1.9.2-WIP generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1183,7 +1183,7 @@ 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 ntfsprogs $as_me 1.9.1, which was +It was created by ntfsprogs $as_me 1.9.2-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1903,7 +1903,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.9.1' + VERSION='1.9.2-WIP' cat >>confdefs.h <<_ACEOF @@ -23026,7 +23026,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.9.1, which was +This file was extended by ntfsprogs $as_me 1.9.2-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23089,7 +23089,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.9.1 +ntfsprogs config.status 1.9.2-WIP configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index a97f7d81..791a73ef 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.9.1],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.9.2-WIP],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) diff --git a/install-sh b/install-sh index 040ebc88..77bc3814 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-01-12.10 +scriptversion=2004-02-15.20 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -214,7 +214,7 @@ do # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' - ' + ' IFS="${IFS-$defaultIFS}" oIFS=$IFS @@ -228,7 +228,13 @@ do while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift - test -d "$pathcomp" || $mkdirprog "$pathcomp" + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" || lasterr=$? + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } + fi pathcomp=$pathcomp/ done fi @@ -284,8 +290,8 @@ do $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit } else : diff --git a/mkinstalldirs b/mkinstalldirs index 6504b744..6fbe5e11 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -1,7 +1,7 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -scriptversion=2003-11-08.23 +scriptversion=2004-02-15.20 # Original author: Noah Friedman # Created: 1993-05-16 @@ -66,9 +66,15 @@ case $# in 0) exit 0 ;; esac +# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. This is a problem when calling mkinstalldirs +# from a parallel make. We use --version in the probe to restrict +# ourselves to GNU mkdir, which is thread-safe. case $dirmode in '') - if mkdir -p -- . 2>/dev/null; then + if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then echo "mkdir -p -- $*" exec mkdir -p -- "$@" else @@ -77,16 +83,17 @@ case $dirmode in # directories to create, and then abort because `.' already # exists. test -d ./-p && rmdir ./-p - test -d ./-- && rmdir ./-- + test -d ./--version && rmdir ./--version fi ;; *) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && + test ! -d ./--version; then echo "mkdir -m $dirmode -p -- $*" exec mkdir -m "$dirmode" -p -- "$@" else # Clean up after NextStep and OpenStep mkdir. - for d in ./-m ./-p ./-- "./$dirmode"; + for d in ./-m ./-p ./--version "./$dirmode"; do test -d $d && rmdir $d done From 2a97938898c9f5bb6c07ebea7c10641fd10624fe Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Thu, 8 Apr 2004 08:00:53 +0000 Subject: [PATCH 1340/2994] Fix the incorrect usage example. (Logical change 1.360) --- ntfsprogs/ntfsclone.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 32ad1bf6..c1209ae1 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -191,7 +191,7 @@ In-place compressing an NTFS volume. Note, gzip is faster usually at least 2-4 times but it creates also bigger compressed files. .RS .sp -.B ntfsclone \-\-output ntfs.img /dev/hda1 | bzip2 \-c > ntfs.img.bz2 +.B ntfsclone \-\-output \- /dev/hda1 | bzip2 \-c > ntfs.img.bz2 .sp .RE Restore an NTFS volume from a compressed image From 70e0ef757a46a5c760378ac1b623cf6820081be0 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Thu, 8 Apr 2004 08:00:53 +0000 Subject: [PATCH 1341/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into a80-186-119-178.elisa-laajakaista.fi:/home/szaka/ntfs/bk/ntfsprogs 2004/04/08 11:00:32+03:00 elisa-laajakaista.fi!szaka Fix the incorrect ntfsclone usage example. BKrev: 407506b5n4tl-PUOu0gPBNwYnNXbSw From 62910c57ab5351eda838792e9a7a42bb58279975 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Apr 2004 12:55:19 +0000 Subject: [PATCH 1342/2994] Fix a few compiler warnings in win32_io.c found using 'configure --enable-warnings'. Mostly trivial. (Yuval) - 'char *' changed to 'const char *' - prototypes - unsigned/signed comparison - duplicate extern declerations BKrev: 40769d37XoUwSQMV7nYNPnaRllccRw From 61a416121e24d3f00dfaf755c104ed135074a481 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Apr 2004 12:55:19 +0000 Subject: [PATCH 1343/2994] Update (Logical change 1.361) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4c042b1a..9bb765db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ xx/xx/2004 - 1.9.2-WIP - Hopefully fix the autogen.sh problems using the --force and touch config.h.in sledge hammers. + - Fix the incorrect ntfsclone usage example in the man page. (Szaka) + - Fix compiler warnings in win32_io.c. (Yuval) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From 56fd4cd70df8f25f7c3036eb18552d4cc1b27e5a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Apr 2004 12:55:19 +0000 Subject: [PATCH 1344/2994] Yuval: A few compiler warnings I found using 'configure -enable-warnings' Mostly trivial. - 'char *' changed to 'const char *' - prototypes - unsigned/signed comparison - duplicate extern declerations (Logical change 1.361) --- libntfs/win32_io.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index bfc7bf8c..0edb511f 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -74,7 +74,8 @@ static __inline__ void Dprintf(const char *fmt, ...) {} #define perror(msg) win32_perror(__FILE__,__LINE__,__FUNCTION__,msg) -int win32_perror(char *file, int line, char *func, char *msg) +int win32_perror(const char *file, int line, const char *func, const char *msg); +int win32_perror(const char *file, int line, const char *func, const char *msg) { char buffer[1024] = ""; DWORD err = GetLastError(); @@ -97,17 +98,18 @@ int win32_perror(char *file, int line, char *func, char *msg) */ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) { - int drive = 0, part = 0, numparams; + int drive = 0, numparams; + unsigned int part = 0; HANDLE handle; win32_fd fd; char drive_char, filename[256]; - numparams = sscanf(dev->d_name, "/dev/hd%c%d", &drive_char, &part); + numparams = sscanf(dev->d_name, "/dev/hd%c%u", &drive_char, &part); drive = toupper(drive_char) - 'A'; if (numparams >= 1) { if (numparams == 2) - Dprintf("win32_open(%s) -> drive %d, part %d\n", + Dprintf("win32_open(%s) -> drive %d, part %u\n", dev->d_name, drive, part); else Dprintf("win32_open(%s) -> drive %d\n", dev->d_name, @@ -139,7 +141,7 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) DWORD numread; DRIVE_LAYOUT_INFORMATION *drive_layout; BOOL rvl; - int i; + unsigned int i; int found = 0; rvl = DeviceIoControl(handle, @@ -178,7 +180,7 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) if (!found) { int err = errno; - fprintf(stderr, "partition %d not found on " + fprintf(stderr, "partition %u not found on " "drive %d\n", part, drive); errno = err; return -1; @@ -368,6 +370,7 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) return 0; } +s64 win32_bias(struct ntfs_device *dev); s64 win32_bias(struct ntfs_device *dev) { struct win32_fd *fd = (win32_fd *)dev->d_private; @@ -375,6 +378,7 @@ s64 win32_bias(struct ntfs_device *dev) return fd->part_start.QuadPart; } +s64 win32_filepos(struct ntfs_device *dev); s64 win32_filepos(struct ntfs_device *dev) { struct win32_fd *fd = (win32_fd *)dev->d_private; @@ -412,18 +416,12 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, return -1; } -extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, - void *b); - static s64 ntfs_device_win32_pread(struct ntfs_device *dev, void *buf, s64 count, s64 offset) { return ntfs_pread(dev, offset, count, buf); } -extern s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, - const void *b); - static s64 ntfs_device_win32_pwrite(struct ntfs_device *dev, const void *buf, s64 count, s64 offset) { From 62d47d085e19469874b5e7ee8b64ed64e47926e1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Apr 2004 14:49:40 +0000 Subject: [PATCH 1345/2994] (Logical change 1.362) --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9bb765db..01e5ba83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ xx/xx/2004 - 1.9.2-WIP config.h.in sledge hammers. - Fix the incorrect ntfsclone usage example in the man page. (Szaka) - Fix compiler warnings in win32_io.c. (Yuval) + - Move constant bswap macros out of the ifdefs in endians.h so they are + always available. (Yuval) + - Add conditional include of sys/param.h in endians.h which provides + endianness support on Cygwin. (Yuval) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From 58c28e0f7844903c2dc57fb3ea122ef8f00cad19 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Apr 2004 14:49:40 +0000 Subject: [PATCH 1346/2994] - Move constant bswap macros out of the ifdefs in endians.h so they are always available. (Yuval) - Add conditional include of sys/param.h in endians.h which provides endianness support on Cygwin. (Yuval) (Logical change 1.362) --- include/ntfs/endians.h | 63 +++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h index bc230919..6192fc16 100644 --- a/include/ntfs/endians.h +++ b/include/ntfs/endians.h @@ -46,6 +46,9 @@ #ifdef HAVE_MACHINE_ENDIAN_H # include #endif +#ifdef HAVE_SYS_PARAM_H +# include +#endif #ifndef __BYTE_ORDER # ifdef _BYTE_ORDER # define __BYTE_ORDER _BYTE_ORDER @@ -56,6 +59,8 @@ # define __BYTE_ORDER BYTE_ORDER # define __LITTLE_ENDIAN LITTLE_ENDIAN # define __BIG_ENDIAN BIG_ENDIAN +# else +# error "__BYTE_ORDER is not defined." # endif # endif #endif @@ -63,34 +68,6 @@ # include #endif -#if (__BYTE_ORDER == __LITTLE_ENDIAN) - -#define __le16_to_cpu(x) (x) -#define __le32_to_cpu(x) (x) -#define __le64_to_cpu(x) (x) - -#define __cpu_to_le16(x) (x) -#define __cpu_to_le32(x) (x) -#define __cpu_to_le64(x) (x) - -#define __constant_le16_to_cpu(x) (x) -#define __constant_le32_to_cpu(x) (x) -#define __constant_le64_to_cpu(x) (x) - -#define __constant_cpu_to_le16(x) (x) -#define __constant_cpu_to_le32(x) (x) -#define __constant_cpu_to_le64(x) (x) - -#elif (__BYTE_ORDER == __BIG_ENDIAN) - -#define __le16_to_cpu(x) bswap_16(x) -#define __le32_to_cpu(x) bswap_32(x) -#define __le64_to_cpu(x) bswap_64(x) - -#define __cpu_to_le16(x) bswap_16(x) -#define __cpu_to_le32(x) bswap_32(x) -#define __cpu_to_le64(x) bswap_64(x) - #define __ntfs_bswap_constant_16(x) \ (u16)((((u16)(x) & 0xff00) >> 8) | \ (((u16)(x) & 0x00ff) << 8)) @@ -111,6 +88,34 @@ (((u64)(x) & 0x000000000000ff00ull) << 40) | \ (((u64)(x) & 0x00000000000000ffull) << 56)) +#if defined(__LITTLE_ENDIAN) && (__BYTE_ORDER == __LITTLE_ENDIAN) + +#define __le16_to_cpu(x) (x) +#define __le32_to_cpu(x) (x) +#define __le64_to_cpu(x) (x) + +#define __cpu_to_le16(x) (x) +#define __cpu_to_le32(x) (x) +#define __cpu_to_le64(x) (x) + +#define __constant_le16_to_cpu(x) (x) +#define __constant_le32_to_cpu(x) (x) +#define __constant_le64_to_cpu(x) (x) + +#define __constant_cpu_to_le16(x) (x) +#define __constant_cpu_to_le32(x) (x) +#define __constant_cpu_to_le64(x) (x) + +#elif defined(__BIG_ENDIAN) && (__BYTE_ORDER == __BIG_ENDIAN) + +#define __le16_to_cpu(x) bswap_16(x) +#define __le32_to_cpu(x) bswap_32(x) +#define __le64_to_cpu(x) bswap_64(x) + +#define __cpu_to_le16(x) bswap_16(x) +#define __cpu_to_le32(x) bswap_32(x) +#define __cpu_to_le64(x) bswap_64(x) + #define __constant_le16_to_cpu(x) __ntfs_bswap_constant_16((u16)(x)) #define __constant_le32_to_cpu(x) __ntfs_bswap_constant_32((u32)(x)) #define __constant_le64_to_cpu(x) __ntfs_bswap_constant_64((u64)(x)) @@ -121,7 +126,7 @@ #else -#error "You must define __BYTE_ORDER to be __LITTLE_ENDIAN or __BIG_ENDIAN" +#error "You must define __BYTE_ORDER to be __LITTLE_ENDIAN or __BIG_ENDIAN." #endif From 57e46f6cb83fdba428c7b874675064a59af11817 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 9 Apr 2004 14:49:40 +0000 Subject: [PATCH 1347/2994] - Move constant bswap macros out of the ifdefs in endians.h so they are always available. (Yuval) - Add conditional include of sys/param.h in endians.h which provides endianness support on Cygwin. (Yuval) BKrev: 4076b804GVCAi2kLXcE2S1lz2KSfzQ From c7f948d5542833122255005aa02a34ee30707878 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 13 Apr 2004 22:56:11 +0000 Subject: [PATCH 1348/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into a80-186-119-178.elisa-laajakaista.fi:/home/szaka/ntfs/bk/ntfsprogs 2004/04/14 01:54:36+03:00 elisa-laajakaista.fi!szaka ntfsclone: destination device must be opened O_RDWR because device_size_get() might need to read() BKrev: 407c700buw8CD3qUrtauDjlQyEYIIQ From 443662a5d67bc48f0199cd381735cb98bd3ce781 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 13 Apr 2004 22:56:11 +0000 Subject: [PATCH 1349/2994] destination device must be opened O_RDWR because device_size_get() might need to read() (Logical change 1.363) --- ntfsprogs/ntfsclone.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index a2652816..9e86ef3a 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1046,7 +1046,8 @@ int main(int argc, char **argv) if ((fd_out = fileno(stdout)) == -1) perr_exit("fileno for stdout failed"); } else { - int flags = O_WRONLY; + /* device_size_get() might need to read() */ + int flags = O_RDWR; if (!opt.blkdev_out) { flags |= O_CREAT | O_TRUNC; From cb7d91eb16403675b32ab53e7e2777a8725ea859 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Wed, 14 Apr 2004 01:23:36 +0000 Subject: [PATCH 1350/2994] got rid of the global struct bitmap lcn_bitmap (some work towards code reuse) (Logical change 1.364) --- ntfsprogs/ntfsresize.c | 94 ++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 39 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index ef0004bb..780dff7b 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -107,7 +107,7 @@ struct llcn_t { s64 inode; /* inode using it */ }; -struct __ntfs_resize_t { +typedef struct { s64 new_volume_size; /* in clusters; 0 = --info w/o --size */ int shrink; /* shrink = 1, enlarge = 0 */ ntfs_inode *ni; /* inode being processed */ @@ -121,6 +121,7 @@ struct __ntfs_resize_t { s64 mftmir_old; /* $MFTMirr AT_DATA's old LCN */ int dirty_inode; /* some inode data got relocated */ struct progress_bar progress; + struct bitmap lcn_bitmap; /* Temporary statistics until all case is supported */ struct llcn_t last_mft; struct llcn_t last_mftmir; @@ -130,16 +131,14 @@ struct __ntfs_resize_t { struct llcn_t last_lcn; s64 last_unsafe; /* last "unsafe-to-move" cluster */ s64 last_unsupp; /* last unsupported cluster */ -}; +} ntfs_resize_t; -typedef struct __ntfs_resize_t ntfs_resize_t; -/* FIXME: This will go to struct __ntfs_resize_t */ +/* FIXME: This will go to ntfs_resize_t */ ntfs_volume *vol = NULL; -/* FIXME: These and 'pos' from find_free_cluster() will make a cluster - allocation related structure, attached to struct __ntfs_resize_t */ -struct bitmap lcn_bitmap; +/* FIXME: This, lcn_bitmap and pos from find_free_cluster() will make a cluster + allocation related structure, attached to ntfs_resize_t */ s64 max_free_cluster_range = 0; #define NTFS_MBYTE (1000 * 1000) @@ -728,6 +727,7 @@ static void build_lcn_usage_bitmap(ntfs_resize_t *resize) ATTR_RECORD *a; runlist *rl; int i, j; + struct bitmap *lcn_bitmap = &resize->lcn_bitmap; a = resize->ctx->attr; inode = resize->ni->mft_no; @@ -760,7 +760,7 @@ static void build_lcn_usage_bitmap(ntfs_resize_t *resize) for (j = 0; j < lcn_length; j++) { u64 k = (u64)lcn + j; - if (ntfs_bit_get_and_set(lcn_bitmap.bm, k, 1)) { + if (ntfs_bit_get_and_set(lcn_bitmap->bm, k, 1)) { if (++resize->multi_ref > 10) continue; @@ -1050,22 +1050,22 @@ static void replace_attribute_runlist(ntfs_attr_search_ctx *ctx, runlist *rl) free(mp); } -static void set_bitmap_range(s64 pos, s64 length, u8 bit) +static void set_bitmap_range(struct bitmap *bm, s64 pos, s64 length, u8 bit) { while (length--) - ntfs_bit_set(lcn_bitmap.bm, pos++, bit); + ntfs_bit_set(bm->bm, pos++, bit); } -static void set_bitmap_clusters(runlist *rl, u8 bit) +static void set_bitmap_clusters(struct bitmap *bm, runlist *rl, u8 bit) { for (; rl->length; rl++) - set_bitmap_range(rl->lcn, rl->length, bit); + set_bitmap_range(bm, rl->lcn, rl->length, bit); } -static void release_bitmap_clusters(runlist *rl) +static void release_bitmap_clusters(struct bitmap *bm, runlist *rl) { max_free_cluster_range = 0; - set_bitmap_clusters(rl, 0); + set_bitmap_clusters(bm, rl, 0); } static void set_max_free_zone(s64 length, s64 end, runlist_element *rle) @@ -1076,7 +1076,10 @@ static void set_max_free_zone(s64 length, s64 end, runlist_element *rle) } } -static int find_free_cluster(runlist_element *rle, s64 nr_vol_clusters, int hint) +static int find_free_cluster(struct bitmap *bm, + runlist_element *rle, + s64 nr_vol_clusters, + int hint) { /* FIXME: get rid of this 'static' variable */ static s64 pos = 0; @@ -1093,7 +1096,7 @@ static int find_free_cluster(runlist_element *rle, s64 nr_vol_clusters, int hint i = pos; do { - if (!ntfs_bit_get(lcn_bitmap.bm, i)) { + if (!ntfs_bit_get(bm->bm, i)) { if (++free_zone == items) { set_max_free_zone(free_zone, i + 1, rle); break; @@ -1126,11 +1129,14 @@ static int find_free_cluster(runlist_element *rle, s64 nr_vol_clusters, int hint if (pos == nr_vol_clusters) pos = 0; - set_bitmap_range(rle->lcn, rle->length, 1); + set_bitmap_range(bm, rle->lcn, rle->length, 1); return 0; } -static runlist *alloc_cluster(s64 items, s64 nr_vol_clusters, int hint) +static runlist *alloc_cluster(struct bitmap *bm, + s64 items, + s64 nr_vol_clusters, + int hint) { runlist_element rle; runlist *rl = NULL; @@ -1147,7 +1153,7 @@ static runlist *alloc_cluster(s64 items, s64 nr_vol_clusters, int hint) if (runs) hint = 0; rle.length = items; - if (find_free_cluster(&rle, nr_vol_clusters, hint) == -1) + if (find_free_cluster(bm, &rle, nr_vol_clusters, hint) == -1) return NULL; rl_size = (runs + 2) * sizeof(runlist_element); @@ -1361,7 +1367,8 @@ static void relocate_run(ntfs_resize_t *resize, runlist **rl, int run) } hint = (resize->mref == FILE_MFTMirr) ? 1 : 0; - if (!(relocate_rl = alloc_cluster(lcn_length, new_vol_size, hint))) + if (!(relocate_rl = alloc_cluster(&resize->lcn_bitmap, lcn_length, + new_vol_size, hint))) perr_exit("Cluster allocation failed for %llu:%lld", resize->mref, lcn_length); @@ -1572,7 +1579,10 @@ static void truncate_badclust_bad_attr(ntfs_attr_search_ctx *ctx, s64 nr_cluster * Shrink the metadata file $Bitmap. It must be large enough for one bit per * cluster of the shrunken volume. Also it must be a of 8 bytes in size. */ -static void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size) +static void shrink_bitmap_data_attr(struct bitmap *bm, + runlist **rlist, + s64 nr_bm_clusters, + s64 new_size) { runlist *rl = *rlist; int i, j; @@ -1593,7 +1603,7 @@ static void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new k = rl[i].lcn + j; if (k < new_size) { - ntfs_bit_set(lcn_bitmap.bm, k, 0); + ntfs_bit_set(bm->bm, k, 0); Dprintf("Unallocate cluster: " "%lld (%llx)\n", k, k); } @@ -1617,17 +1627,20 @@ static void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new * Enlarge the metadata file $Bitmap. It must be large enough for one bit per * cluster of the shrunken volume. Also it must be a of 8 bytes in size. */ -static void enlarge_bitmap_data_attr(runlist **rl, s64 nr_bm_clusters, s64 new_size) +static void enlarge_bitmap_data_attr(struct bitmap *bm, + runlist **rl, + s64 nr_bm_clusters, + s64 new_size) { s64 i; - release_bitmap_clusters(*rl); + release_bitmap_clusters(bm, *rl); free(*rl); for (i = vol->nr_clusters; i < new_size; i++) - ntfs_bit_set(lcn_bitmap.bm, i, 0); + ntfs_bit_set(bm->bm, i, 0); - if (!(*rl = alloc_cluster(nr_bm_clusters, new_size, 0))) + if (!(*rl = alloc_cluster(bm, nr_bm_clusters, new_size, 0))) perr_exit("Couldn't allocate $Bitmap clusters"); } @@ -1652,11 +1665,11 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) bm_bsize = nr_clusters_to_bitmap_byte_size(nr_clusters); nr_bm_clusters = rounded_up_division(bm_bsize, vol->cluster_size); - if (!(tmp = (u8 *)realloc(lcn_bitmap.bm, bm_bsize))) + if (!(tmp = (u8 *)realloc(resize->lcn_bitmap.bm, bm_bsize))) perr_exit("realloc"); - lcn_bitmap.bm = tmp; - lcn_bitmap.size = bm_bsize; - bitmap_file_data_fixup(nr_clusters, &lcn_bitmap); + resize->lcn_bitmap.bm = tmp; + resize->lcn_bitmap.size = bm_bsize; + bitmap_file_data_fixup(nr_clusters, &resize->lcn_bitmap); if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) perr_exit("ntfs_mapping_pairs_decompress"); @@ -1664,9 +1677,11 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) /* NOTE: shrink could use enlarge_bitmap_data_attr() also. Advantages: less code, better code coverage. "Drawback": could be relocated */ if (resize->shrink) - shrink_bitmap_data_attr(&rl, nr_bm_clusters, nr_clusters); + shrink_bitmap_data_attr(&resize->lcn_bitmap, &rl, + nr_bm_clusters, nr_clusters); else - enlarge_bitmap_data_attr(&rl, nr_bm_clusters, nr_clusters); + enlarge_bitmap_data_attr(&resize->lcn_bitmap, &rl, + nr_bm_clusters, nr_clusters); a->highest_vcn = cpu_to_le64(nr_bm_clusters - 1LL); a->allocated_size = cpu_to_le64(nr_bm_clusters * vol->cluster_size); @@ -1680,7 +1695,7 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) * attribute too, for now chkdsk will do this for us. */ - size = ntfs_rl_pwrite(vol, rl, 0, bm_bsize, lcn_bitmap.bm); + size = ntfs_rl_pwrite(vol, rl, 0, bm_bsize, resize->lcn_bitmap.bm); if (bm_bsize != size) { if (size == -1) perr_exit("Couldn't write $Bitmap"); @@ -1768,15 +1783,15 @@ static void truncate_bitmap_file(ntfs_resize_t *resize) * All the bits are set to 0, except those representing the region beyond the * end of the disk. */ -static void setup_lcn_bitmap(void) +static void setup_lcn_bitmap(struct bitmap *bm) { /* Determine lcn bitmap byte size and allocate it. */ - lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); + bm->size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); - if (!(lcn_bitmap.bm = (unsigned char *)calloc(1, lcn_bitmap.size))) + if (!(bm->bm = (unsigned char *)calloc(1, bm->size))) perr_exit("Failed to allocate internal buffer"); - bitmap_file_data_fixup(vol->nr_clusters, &lcn_bitmap); + bitmap_file_data_fixup(vol->nr_clusters, bm); } /** @@ -2046,10 +2061,11 @@ int main(int argc, char **argv) exit(0); } - setup_lcn_bitmap(); memset(&resize, 0, sizeof(resize)); resize.new_volume_size = new_size; + + setup_lcn_bitmap(&resize.lcn_bitmap); /* This is also true if --info was used w/o --size (new_size = 0) */ if (new_size < vol->nr_clusters) @@ -2062,7 +2078,7 @@ int main(int argc, char **argv) printf(corrupt_volume_msg); exit(1); } - compare_bitmaps(&lcn_bitmap); + compare_bitmaps(&resize.lcn_bitmap); print_disk_usage(&resize); From 04c554b927cd1e462ddfd09796413a48cc2915d6 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Wed, 14 Apr 2004 01:23:36 +0000 Subject: [PATCH 1351/2994] ntfsresize: got rid of the global struct bitmap lcn_bitmap (some work towards code reuse) BKrev: 407c929888CoOtrBfDIarP3QUIlVvQ From 61ea0f59d8402ea780b5736957ce5e0b8353848e Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Wed, 14 Apr 2004 23:31:11 +0000 Subject: [PATCH 1352/2994] ntfsclone --metadata also saves at least the first 8 KiB of the $LogFile (Logical change 1.365) --- ChangeLog | 2 ++ ntfsprogs/ntfsclone.c | 40 +++++++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 01e5ba83..244b8b67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ xx/xx/2004 - 1.9.2-WIP always available. (Yuval) - Add conditional include of sys/param.h in endians.h which provides endianness support on Cygwin. (Yuval) + - ntfsclone --metadata also saves at least the first 8 KiB of the + $LogFile (Szaka) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 9e86ef3a..bd16aa27 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -77,13 +77,12 @@ struct progress_bar { float unit; }; -struct __ntfs_walk_clusters_ctx { +typedef struct { ntfs_inode *ni; /* inode being processed */ ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ s64 inuse; /* number of clusters in use */ -}; +} ntfs_walk_clusters_ctx; -typedef struct __ntfs_walk_clusters_ctx ntfs_walk_clusters_ctx; typedef int (ntfs_walk_op)(ntfs_inode *ni, void *data); struct ntfs_walk_cluster { @@ -349,18 +348,29 @@ static s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) return bm_bsize; } -static int is_critical_metadata(ntfs_walk_clusters_ctx *image) +static s64 is_critical_metadata(ntfs_walk_clusters_ctx *image, runlist *rl) { - s64 inode; - - inode = image->ni->mft_no; + s64 inode = image->ni->mft_no; - if (inode <= LAST_METADATA_INODE) + if (inode <= LAST_METADATA_INODE) { if (inode != FILE_LogFile) - return 1; + return rl->length; + + if (image->ctx->attr->type == AT_DATA) { + /* Save at least the first 8 KiB of FILE_LogFile */ + s64 s = (s64)8192 - rl->vcn * vol->cluster_size; + if (s > 0) { + s = rounded_up_division(s, vol->cluster_size); + if (rl->length < s) + s = rl->length; + return s; + } + return 0; + } + } if (image->ctx->attr->type != AT_DATA) - return 1; + return rl->length; return 0; } @@ -425,18 +435,18 @@ static void lseek_to_cluster(s64 lcn) static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) { - int i; + s64 i, len; /* number of clusters to copy */ - if (opt.std_out) + if (opt.std_out || !opt.metadata_only) return; - if (!opt.metadata_only || !is_critical_metadata(image)) + if (!(len = is_critical_metadata(image, rl))) return; - + lseek_to_cluster(rl->lcn); /* FIXME: this could give pretty suboptimal performance */ - for (i = 0; i < rl->length; i++) + for (i = 0; i < len; i++) copy_cluster(); } From 8d343b3eecc648f78bb255d4ee624a90bdf4093d Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Wed, 14 Apr 2004 23:31:11 +0000 Subject: [PATCH 1353/2994] ntfsclone --metadata also saves at least the first 8 KiB of the $LogFile BKrev: 407dc9bfW-z6bxJFdFoBxq7Ryxq7vA From 8c67ce1c361a23ee08a94e63ce68296bd9ecbc33 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Thu, 15 Apr 2004 00:42:33 +0000 Subject: [PATCH 1354/2994] Fix incorrect getopt_long() usage: converted argv[optind-1] to optarg so utilities won't do bogus and unexpected things (Logical change 1.366) --- ChangeLog | 2 ++ ntfsprogs/ntfscat.c | 4 ++-- ntfsprogs/ntfsclone.c | 2 +- ntfsprogs/ntfsinfo.c | 2 +- ntfsprogs/ntfsundelete.c | 12 ++++++------ ntfsprogs/ntfswipe.c | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 244b8b67..3f242bd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ xx/xx/2004 - 1.9.2-WIP endianness support on Cygwin. (Yuval) - ntfsclone --metadata also saves at least the first 8 KiB of the $LogFile (Szaka) + - Fix incorrect getopt_long() usage: converted argv[optind-1] to optarg + so utilities won't do bogus and unexpected things (Szaka) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index ba793716..5f7d2d99 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -135,7 +135,7 @@ int parse_options (int argc, char **argv) case 'a': if (opts.attr != (ATTR_TYPES)-1) Eprintf("You must specify exactly one attribute.\n"); - else if (utils_parse_size(argv[optind-1], &attr, FALSE)) { + else if (utils_parse_size(optarg, &attr, FALSE)) { opts.attr = (ATTR_TYPES)attr; break; } else @@ -153,7 +153,7 @@ int parse_options (int argc, char **argv) case 'i': if (opts.inode != -1) Eprintf("You must specify exactly one inode.\n"); - else if (utils_parse_size(argv[optind-1], &opts.inode, FALSE)) + else if (utils_parse_size(optarg, &opts.inode, FALSE)) break; else Eprintf("Couldn't parse inode number.\n"); diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index bd16aa27..0009a9a0 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -249,7 +249,7 @@ static void parse_options(int argc, char **argv) case 'o': if (opt.output) usage(); - opt.output = argv[optind-1]; + opt.output = optarg; break; default: err_printf("Unknown option '%s'.\n", argv[optind-1]); diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index d3e51710..688842db 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -172,7 +172,7 @@ int parse_options (int argc, char *argv[]) break; case 'i': if ((opts.inode != -1) || - (!utils_parse_size (argv[optind-1], &opts.inode, FALSE))) { + (!utils_parse_size (optarg, &opts.inode, FALSE))) { err++; } break; diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index eace377e..c9a565b0 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -327,7 +327,7 @@ int parse_options (int argc, char *argv[]) break; case 'c': if (opts.mode == MODE_NONE) { - if (!utils_parse_range (argv[optind-1], + if (!utils_parse_range (optarg, &opts.mft_begin, &opts.mft_end, TRUE)) err++; opts.mode = MODE_COPY; @@ -337,7 +337,7 @@ int parse_options (int argc, char *argv[]) break; case 'd': if (!opts.dest) - opts.dest = argv[optind-1]; + opts.dest = optarg; else err++; break; @@ -350,7 +350,7 @@ int parse_options (int argc, char *argv[]) break; case 'm': if (!opts.match) { - if (!transform (argv[optind-1], &opts.match)) + if (!transform (optarg, &opts.match)) err++; } else { err++; @@ -358,7 +358,7 @@ int parse_options (int argc, char *argv[]) break; case 'o': if (!opts.output) { - opts.output = argv[optind-1]; + opts.output = optarg; } else { err++; } @@ -384,14 +384,14 @@ int parse_options (int argc, char *argv[]) break; case 'S': if ((opts.size_begin > 0) || (opts.size_end > 0) || - !utils_parse_range (argv[optind-1], &opts.size_begin, + !utils_parse_range (optarg, &opts.size_begin, &opts.size_end, TRUE)) { err++; } break; case 't': if (opts.since == 0) { - if (!parse_time (argv[optind-1], &opts.since)) + if (!parse_time (optarg, &opts.since)) err++; } else { err++; diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 3a9e619d..1e94b9b0 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -224,7 +224,7 @@ int parse_options (int argc, char *argv[]) break; case 'b': if (!opts.bytes) { - if (!parse_list (argv[optind-1], &opts.bytes)) + if (!parse_list (optarg, &opts.bytes)) err++; } else { err++; From 11b90db25bc65546a652265a4d62d35436c759f6 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Thu, 15 Apr 2004 00:42:33 +0000 Subject: [PATCH 1355/2994] Fix incorrect getopt_long() usage: converted argv[optind-1] to optarg so utilities won't do bogus and unexpected things BKrev: 407dda7949vKnweBtGT2RPpJHDVnkA From 204a58e75e26472889a416ffc197af4d63e209b1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 08:10:14 +0000 Subject: [PATCH 1356/2994] Add export for ntfs_sid_to_mbs(). (Logical change 1.367) --- include/ntfs/security.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/include/ntfs/security.h b/include/ntfs/security.h index e69de29b..7a7d7458 100644 --- a/include/ntfs/security.h +++ b/include/ntfs/security.h @@ -0,0 +1,36 @@ +/* + * security.h - Exports for handling security/ACLs in NTFS. Part of the + * Linux-NTFS project. + * + * Copyright (c) 2004 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_SECURITY_H +#define _NTFS_SECURITY_H + +#include "types.h" +#include "layout.h" + +extern const GUID *const zero_guid; + +extern BOOL ntfs_guid_is_zero(const GUID *guid); +extern char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str); + +extern char *ntfs_sid_to_mbs(const SID *sid, char *sid_str); + +#endif /* defined _NTFS_SECURITY_H */ From 46530a95ba7c347412f09ea00fa288ace478b5a6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 08:10:14 +0000 Subject: [PATCH 1357/2994] Minor typo fix in layout.h. BKrev: 407e4366W5B4BKUVuSaJ_2kSRUjv7A From 5107604fffb9e911c919183e819e6cbc35384875 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 08:10:14 +0000 Subject: [PATCH 1358/2994] Minor typo fix. (Logical change 1.367) --- include/ntfs/layout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index bd0db481..d535b107 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1562,7 +1562,7 @@ typedef struct { u8 alignment1; u16 size; /* Allocated space in bytes for ACL. Includes this header, the ACEs and the remaining free space. */ - u16 ace_count;/* Number of ACEs in the ACL. */ + u16 ace_count; /* Number of ACEs in the ACL. */ u16 alignment2; /* sizeof() = 8 bytes */ } __attribute__ ((__packed__)) ACL; From 7fa7b339af5e27c03a8358cf2bff53f75aeebfba Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 11:10:40 +0000 Subject: [PATCH 1359/2994] Add new API to security.[hc]: ntfs_sid_is_valid(), ntfs_sid_to_mbs(), and ntfs_sid_to_mbs_size(). BKrev: 407e6db0U33Qo46DqIBjsMBhV7oxeA From e44d450539d7fa046ba3d7a3b10b9c84c3ec05cc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 11:10:40 +0000 Subject: [PATCH 1360/2994] Add ntfs_sid_is_valid() and exports for ntfs_sid_to_mbs_size() and ntfs_sid_to_mbs(). (Logical change 1.368) --- include/ntfs/security.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/include/ntfs/security.h b/include/ntfs/security.h index 7a7d7458..1eac550a 100644 --- a/include/ntfs/security.h +++ b/include/ntfs/security.h @@ -31,6 +31,24 @@ extern const GUID *const zero_guid; extern BOOL ntfs_guid_is_zero(const GUID *guid); extern char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str); -extern char *ntfs_sid_to_mbs(const SID *sid, char *sid_str); +/** + * ntfs_sid_is_valid - determine if a SID is valid + * @sid: [IN] SID for which to determine if it is valid + * + * Determine if the SID pointed to by @sid is valid. + * + * Return TRUE if it is valid and FALSE otherwise. + */ +static __inline__ BOOL ntfs_sid_is_valid(const SID *sid) +{ + if (!sid || sid->revision != SID_REVISION || + sid->sub_authority_count > SID_MAX_SUB_AUTHORITIES) + return FALSE; + return TRUE; +} + +extern int ntfs_sid_to_mbs_size(const SID *sid); +extern char *ntfs_sid_to_mbs(const SID *sid, char *sid_str, + size_t sid_str_size); #endif /* defined _NTFS_SECURITY_H */ From 8d9353c06213e76c00034883dce83f4ffa3135ca Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 11:10:40 +0000 Subject: [PATCH 1361/2994] Add ntfs_sid_to_mbs_size() and ntfs_sid_to_mbs(). (Logical change 1.368) --- libntfs/security.c | 154 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 150 insertions(+), 4 deletions(-) diff --git a/libntfs/security.c b/libntfs/security.c index 70c441d7..252e3744 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -40,7 +40,7 @@ const GUID *const zero_guid = &__zero_guid; /** * ntfs_guid_is_zero - check if a GUID is zero - * @guid: guid to check + * @guid: [IN] guid to check * * Return TRUE if @guid is a valid pointer to a GUID and it is the zero GUID * and FALSE otherwise. @@ -52,8 +52,8 @@ BOOL ntfs_guid_is_zero(const GUID *guid) /** * ntfs_guid_to_mbs - convert a GUID to a multi byte string - * @guid: guid to convert - * @guid_str: string in which to return the GUID (optional) + * @guid: [IN] guid to convert + * @guid_str: [OUT] string in which to return the GUID (optional) * * Convert the GUID pointed to by @guid to a multi byte string of the form * "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX". Therefore, @guid_str (if not NULL) @@ -83,7 +83,7 @@ char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str) } res = snprintf(_guid_str, 37, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - le32_to_cpu(guid->data1), + (unsigned int)le32_to_cpu(guid->data1), le16_to_cpu(guid->data2), le16_to_cpu(guid->data3), guid->data4[0], guid->data4[1], guid->data4[2], guid->data4[3], guid->data4[4], @@ -95,3 +95,149 @@ char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str) errno = EINVAL; return NULL; } + +/** + * ntfs_sid_to_mbs_size - determine maximum size for the string of a SID + * @sid: [IN] SID for which to determine the maximum string size + * + * Determine the maximum multi byte string size in bytes which is needed to + * store the standard textual representation of the SID pointed to by @sid. + * See ntfs_sid_to_mbs(), below. + * + * On success return the maximum number of bytes needed to store the multi byte + * string and on failure return -1 with errno set to the error code. + */ +int ntfs_sid_to_mbs_size(const SID *sid) +{ + int size, i; + + if (!ntfs_sid_is_valid(sid)) { + errno = EINVAL; + return -1; + } + /* Start with "S-". */ + size = 2; + /* + * Add the SID_REVISION. Hopefully the compiler will optimize this + * away as SID_REVISION is a constant. + */ + for (i = SID_REVISION; i > 0; i /= 10) + size++; + /* Add the "-". */ + size++; + /* + * Add the identifier authority. If it needs to be in decimal, the + * maximum is 2^32-1 = 4294967295 = 10 characters. If it needs to be + * in hexadecimal, then maximum is 0x665544332211 = 14 characters. + */ + if (!sid->identifier_authority.high_part) + size += 10; + else + size += 14; + /* + * Finally, add the sub authorities. For each we have a "-" followed + * by a decimal which can be up to 2^32-1 = 4294967295 = 10 characters. + */ + size += (1 + 10) * sid->sub_authority_count; + /* We need the zero byte at the end, too. */ + size++; + return size * sizeof(char); +} + +/** + * ntfs_sid_to_mbs - convert a SID to a multi byte string + * @sid: [IN] SID to convert + * @sid_str: [OUT] string in which to return the SID (optional) + * @sid_str_size: [IN] size in bytes of @sid_str + * + * Convert the SID pointed to by @sid to its standard textual representation. + * @sid_str (if not NULL) needs to be able to store at least + * ntfs_sid_to_mbs_size() bytes. @sid_str_size is the size in bytes of + * @sid_str if @sid_str is not NULL. + * + * The standard textual representation of the SID is of the form: + * S-R-I-S-S... + * Where: + * - The first "S" is the literal character 'S' identifying the following + * digits as a SID. + * - R is the revision level of the SID expressed as a sequence of digits + * in decimal. + * - I is the 48-bit identifier_authority, expressed as digits in decimal, + * if I < 2^32, or hexadecimal prefixed by "0x", if I >= 2^32. + * - S... is one or more sub_authority values, expressed as digits in + * decimal. + * + * If @sid_str is not NULL it will contain the converted SUID on return. If it + * is NULL a string will be allocated and this will be returned. The caller is + * responsible for free()ing the string in that case. + * + * On success return the converted string and on failure return NULL with errno + * set to the error code. + */ +char *ntfs_sid_to_mbs(const SID *sid, char *sid_str, size_t sid_str_size) +{ + u64 u; + char *s; + size_t cnt; + int i, j; + + /* + * No need to check @sid if !@sid_str since ntfs_sid_to_mbs_size() will + * check @sid, too. 8 is the minimum SID string size. + */ + if (sid_str && (sid_str_size < 8 || !ntfs_sid_is_valid(sid))) { + errno = EINVAL; + return NULL; + } + /* Allocate string if not provided. */ + if (!sid_str) { + cnt = ntfs_sid_to_mbs_size(sid); + if (cnt < 0) + return NULL; + s = malloc(cnt); + if (!s) + return s; + sid_str = s; + /* So we know we allocated it. */ + sid_str_size = 0; + } else { + s = sid_str; + cnt = sid_str_size; + } + /* Start with "S-R-". */ + i = snprintf(s, cnt, "S-%c-", (char)sid->revision); + if (i < 0 || i >= cnt) + goto err_out; + s += i; + cnt -= i; + /* Add the identifier authority. */ + for (u = i = 0, j = 40; i < 6; i++, j -= 8) + u += (u64)sid->identifier_authority.value[i] << j; + if (!sid->identifier_authority.high_part) + i = snprintf(s, cnt, "%lu", (unsigned long)u); + else + i = snprintf(s, cnt, "0x%llx", (unsigned long long)u); + if (i < 0 || i >= cnt) + goto err_out; + s += i; + cnt -= i; + /* Finally, add the sub authorities. */ + for (i = 0; i < sid->sub_authority_count; i++) { + j = snprintf(s, cnt, "-%u", (unsigned int) + le32_to_cpu(sid->sub_authority[i])); + if (j < 0 || j >= cnt) + goto err_out; + s += j; + cnt -= j; + } + return sid_str; +err_out: + if (i >= cnt) + i = EMSGSIZE; + else + i = errno; + if (!sid_str_size) + free(sid_str); + errno = i; + return NULL; +} From 385c9deeec71c949a36d0de22e82b157c82f10bf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 11:10:40 +0000 Subject: [PATCH 1362/2994] Fix SID_IDENTIFIER_AUTHORITY. It is big endian. (Logical change 1.368) --- include/ntfs/layout.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index d535b107..e7f5db31 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1049,7 +1049,7 @@ typedef struct { * twelve hexadecimal digits. GUIDs are Microsoft's implementation of the * distributed computing environment (DCE) universally unique identifier (UUID). * Example of a GUID: - * 1F010768-5A73-BC91-0010A52216A7 + * 1F010768-5A73-BC91-0010-A52216A7 */ typedef struct { u32 data1; /* The first eight hexadecimal digits of the GUID. */ @@ -1243,11 +1243,13 @@ typedef enum { /* Identifier authority. */ /* * The SID_IDENTIFIER_AUTHORITY is a 48-bit value used in the SID structure. + * + * NOTE: This is stored as a big endian number. */ typedef union { struct { - u32 low_part; /* Low 32-bits. */ u16 high_part; /* High 16-bits. */ + u32 low_part; /* Low 32-bits. */ } __attribute__ ((__packed__)); u8 value[6]; /* Value as individual bytes. */ } __attribute__ ((__packed__)) SID_IDENTIFIER_AUTHORITY; @@ -1262,9 +1264,11 @@ typedef union { * - The first "S" is the literal character 'S' identifying the following * digits as a SID. * - R is the revision level of the SID expressed as a sequence of digits - * either in decimal or hexadecimal (if the later, prefixed by "0x"). - * - I is the 48-bit identifier_authority, expressed as digits as R above. - * - S... is one or more sub_authority values, expressed as digits as above. + * in decimal. + * - I is the 48-bit identifier_authority, expressed as digits in decimal, + * if I < 2^32, or hexadecimal prefixed by "0x", if I >= 2^32. + * - S... is one or more sub_authority values, expressed as digits in + * decimal. * * Example SID; the domain-relative SID of the local Administrators group on * Windows NT/2k: From 9b931dc4f6c85c900a7947c3be7a8f3df60f0c19 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 11:10:40 +0000 Subject: [PATCH 1363/2994] Update (Logical change 1.368) --- ChangeLog | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f242bd9..24304e47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,9 +8,11 @@ xx/xx/2004 - 1.9.2-WIP - Add conditional include of sys/param.h in endians.h which provides endianness support on Cygwin. (Yuval) - ntfsclone --metadata also saves at least the first 8 KiB of the - $LogFile (Szaka) + $LogFile. (Szaka) - Fix incorrect getopt_long() usage: converted argv[optind-1] to optarg - so utilities won't do bogus and unexpected things (Szaka) + so utilities won't do bogus and unexpected things. (Szaka) + - Add new API security.[hc]::ntfs_sid_is_valid(), ntfs_sid_to_mbs(), and + ntfs_sid_to_mbs_size(). 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From e39688c9ab76d85ca2cd131dd3c427b514f01ae4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 11:55:46 +0000 Subject: [PATCH 1364/2994] Big update from Yuval with some bits modified by me. (Logical change 1.369) --- ntfsprogs/ntfsinfo.c | 317 ++++++++++++++++++++++++++++++------------- 1 file changed, 222 insertions(+), 95 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 688842db..4db00d55 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -90,7 +90,7 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -void version (void) +static void version (void) { printf ("\n%s v%s - Display information about an NTFS Volume.\n\n", EXEC_NAME, VERSION); @@ -109,7 +109,7 @@ void version (void) * * Return: none */ -void usage (void) +static void usage (void) { printf ("\nUsage: %s [options] -d dev\n" " -d dev --device dev The ntfs volume to display information about\n" @@ -135,7 +135,7 @@ void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -int parse_options (int argc, char *argv[]) +static int parse_options (int argc, char *argv[]) { static const char *sopt = "-fh?i:mqtTvVd:"; static const struct option lopt[] = { @@ -162,13 +162,11 @@ int parse_options (int argc, char *argv[]) while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { - case 'd': /* A non-option argument */ - if (!opts.device) { + case 'd': + if (!opts.device) opts.device = argv[optind-1]; - } else { - opts.device = NULL; + else err++; - } break; case 'i': if ((opts.inode != -1) || @@ -246,19 +244,19 @@ int parse_options (int argc, char *argv[]) /**************** utility functions *********************/ /** - * ntfsinfo_time_to_str() - * @sle_ntfs_clock The disk time format, meaning 100ns units since 1st jan 1601 - * in little-endian format + * ntfsinfo_time_to_str() - + * @sle_ntfs_clock: on disk time format in 100ns units since 1st jan 1601 + * in little-endian format * * Return char* in a format 'Thu Jan 1 00:00:00 1970'. + * No need to free the returned memory. * * Example of usage: - * char *time_str = ntfsinfo_time_to_str( - * sle64_to_cpu(standard_attr->creation_time)); - * printf("\tFile Creation Time: \t %s",time_str); - * free(time_str); + * char *time_str = ntfsinfo_time_to_str( + * sle64_to_cpu(standard_attr->creation_time)); + * printf("\tFile Creation Time: \t %s", time_str); */ -char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) +static char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) { time_t unix_clock = ntfs2utc(sle64_to_cpu(sle_ntfs_clock)); return ctime(&unix_clock); @@ -266,7 +264,7 @@ char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) /** * ntfs_attr_get_name() - * @attr a vaild attribute record + * @attr: a vaild attribute record * * return multi-byte string containing the attribute name if exist. the user * is then responsible of freeing that memory. @@ -274,7 +272,7 @@ char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) * null if cannot convert to multi-byte string. errno would contain the * error id. no memory allocated in that case */ -char *ntfs_attr_get_name(ATTR_RECORD *attr) +static char *ntfs_attr_get_name(ATTR_RECORD *attr) { uchar_t *ucs_attr_name; char *mbs_attr_name = NULL; @@ -297,7 +295,7 @@ char *ntfs_attr_get_name(ATTR_RECORD *attr) /** * ntfs_dump_volume - dump information about the volume */ -void ntfs_dump_volume(ntfs_volume *vol) +static void ntfs_dump_volume(ntfs_volume *vol) { printf("Volume Information \n"); printf("\tName of device: %s\n", vol->dev->d_name); @@ -306,62 +304,66 @@ void ntfs_dump_volume(ntfs_volume *vol) printf("\tVolume State: %lu\n", vol->state); printf("\tVolume Version: %u.%u\n", vol->major_ver, vol->minor_ver); printf("\tSector Size: %hu\n", vol->sector_size); - printf("\tCluster Size: %u\n", vol->cluster_size); - printf("\tVolume Size in Clusters: %lld\n", (long long)vol->nr_clusters); + printf("\tCluster Size: %u\n", (unsigned int)vol->cluster_size); + printf("\tVolume Size in Clusters: %lld\n", + (long long)vol->nr_clusters); printf("MFT Information \n"); - printf("\tMFT Record Size: %u\n", vol->mft_record_size); + printf("\tMFT Record Size: %u\n", (unsigned int)vol->mft_record_size); printf("\tMFT Zone Multiplier: %u\n", vol->mft_zone_multiplier); printf("\tMFT Data Position: %lld\n", (long long)vol->mft_data_pos); printf("\tMFT Zone Start: %lld\n", (long long)vol->mft_zone_start); printf("\tMFT Zone End: %lld\n", (long long)vol->mft_zone_end); printf("\tMFT Zone Position: %lld\n", (long long)vol->mft_zone_pos); printf("\tCurrent Position in First Data Zone: %lld\n", - (long long)vol->data1_zone_pos); + (long long)vol->data1_zone_pos); printf("\tCurrent Position in Second Data Zone: %lld\n", - (long long)vol->data2_zone_pos); + (long long)vol->data2_zone_pos); printf("\tNumber of Initialized Records in MFT: %lld\n", - (long long)vol->nr_mft_records); + (long long)vol->nr_mft_records); printf("\tLCN of Data Attribute for FILE_MFT: %lld\n", - (long long)vol->mft_lcn); + (long long)vol->mft_lcn); printf("\tFILE_MFTMirr Size: %d\n", vol->mftmirr_size); printf("\tLCN of Data Attribute for File_MFTMirr: %lld\n", - (long long)vol->mftmirr_lcn); - printf("\tSize of Attribute Definition Table: %d\n", vol->attrdef_len); + (long long)vol->mftmirr_lcn); + printf("\tSize of Attribute Definition Table: %d\n", + (int)vol->attrdef_len); printf("FILE_Bitmap Information \n"); printf("\tFILE_Bitmap MFT Record Number: %llu\n", - (unsigned long long)vol->lcnbmp_ni->mft_no); + (unsigned long long)vol->lcnbmp_ni->mft_no); printf("\tState of FILE_Bitmap Inode: %lu\n", vol->lcnbmp_ni->state); - printf("\tLength of Attribute List: %u\n", vol->lcnbmp_ni->attr_list_size); + printf("\tLength of Attribute List: %u\n", + (unsigned int)vol->lcnbmp_ni->attr_list_size); printf("\tAttribute List: %s\n", vol->lcnbmp_ni->attr_list); printf("\tNumber of Attached Extent Inodes: %d\n", - vol->lcnbmp_ni->nr_extents); + (int)vol->lcnbmp_ni->nr_extents); /* FIXME: need to add code for the union if nr_extens != 0, but i dont know if it will ever != 0 with FILE_Bitmap */ printf("FILE_Bitmap Data Attribute Information\n"); printf("\tDecompressed Runlist: not done yet\n"); printf("\tBase Inode: %llu\n", - (unsigned long long)vol->lcnbmp_na->ni->mft_no); + (unsigned long long)vol->lcnbmp_na->ni->mft_no); printf("\tAttribute Types: not done yet\n"); //printf("\tAttribute Name: %s\n", vol->lcnbmp_na->name); - printf("\tAttribute Name Length: %u\n", vol->lcnbmp_na->name_len); + printf("\tAttribute Name Length: %u\n", + (unsigned int)vol->lcnbmp_na->name_len); printf("\tAttribute State: %lu\n", vol->lcnbmp_na->state); printf("\tAttribute Allocated Size: %lld\n", - (long long)vol->lcnbmp_na->allocated_size); + (long long)vol->lcnbmp_na->allocated_size); printf("\tAttribute Data Size: %lld\n", - (long long)vol->lcnbmp_na->data_size); + (long long)vol->lcnbmp_na->data_size); printf("\tAttribute Initialized Size: %lld\n", - (long long)vol->lcnbmp_na->initialized_size); + (long long)vol->lcnbmp_na->initialized_size); printf("\tAttribute Compressed Size: %lld\n", - (long long)vol->lcnbmp_na->compressed_size); + (long long)vol->lcnbmp_na->compressed_size); printf("\tCompression Block Size: %u\n", - vol->lcnbmp_na->compression_block_size); + (unsigned int)vol->lcnbmp_na->compression_block_size); printf("\tCompression Block Size Bits: %u\n", - vol->lcnbmp_na->compression_block_size_bits); + vol->lcnbmp_na->compression_block_size_bits); printf("\tCompression Block Clusters: %u\n", - vol->lcnbmp_na->compression_block_clusters); + vol->lcnbmp_na->compression_block_clusters); //TODO: Still need to add a few more attributes } @@ -371,7 +373,7 @@ void ntfs_dump_volume(ntfs_volume *vol) /** * ntfs_dump_standard_information */ -void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) +static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) { STANDARD_INFORMATION *standard_attr = NULL; u32 value_length; @@ -405,11 +407,11 @@ void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) /* TODO: file_attributes - Flags describing the file. */ printf("\tMax Number of Versions:\t %u \n", - le32_to_cpu(standard_attr->maximum_versions)); + (unsigned int)le32_to_cpu(standard_attr->maximum_versions)); printf("\tVersion Number: \t %u \n", - le32_to_cpu(standard_attr->version_number)); + (unsigned int)le32_to_cpu(standard_attr->version_number)); printf("\tClass ID: \t\t %u \n", - le32_to_cpu(standard_attr->class_id)); + (unsigned int)le32_to_cpu(standard_attr->class_id)); value_length = le32_to_cpu(attr->value_length); @@ -418,20 +420,32 @@ void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) "\t & usn are missing. This volume has not been upgraded\n"); */ } else if (value_length == 72) { printf("\tUser ID: \t\t %u \n", - le32_to_cpu (standard_attr->owner_id)); + (unsigned int)le32_to_cpu(standard_attr->owner_id)); printf("\tSecurity ID: \t\t %u \n", - le32_to_cpu(standard_attr->security_id)); + (unsigned int)le32_to_cpu(standard_attr->security_id)); } else { printf("\tSize of STANDARD_INFORMATION is %u. It should be " - "either 72 or 48, something is wrong...\n", value_length); + "either 72 or 48, something is wrong...\n", + (unsigned int)value_length); } } +/** + * ntfs_dump_attr_list() + */ +static void ntfs_dump_attr_list(ATTR_RECORD *attr) +{ + /* As far as I know, ntfs_attr_lookup transparantly iterate + through AT_ATTRIBUTE_LIST, so we shouldn't get to this */ + /* FIXME: inode 9: $Secure does that, I'll have to check. */ + printf("AT_ATTRIBUTE_LIST type was returned.\n"); +} + /** * ntfs_dump_attr_file_name() */ -void ntfs_dump_attr_file_name(ATTR_RECORD *attr) +static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) { FILE_NAME_ATTR *file_name_attr = NULL; @@ -498,7 +512,7 @@ void ntfs_dump_attr_file_name(ATTR_RECORD *attr) * dump the $OBJECT_ID attribute - not present on all systems * */ -void ntfs_dump_attr_object_id(ATTR_RECORD *attr,ntfs_volume *vol) +static void ntfs_dump_attr_object_id(ATTR_RECORD *attr,ntfs_volume *vol) { OBJECT_ID_ATTR *obj_id_attr = NULL; @@ -549,15 +563,107 @@ void ntfs_dump_attr_object_id(ATTR_RECORD *attr,ntfs_volume *vol) vol->major_ver); } +static void ntfs_dump_acl(const char *prefix,ACL *acl) +{ + unsigned int i; + u16 ace_count; + ACCESS_ALLOWED_ACE *ace; + + printf("%sRevision\t %u\n",prefix,acl->revision); + + /* don't recalc le16_to_cpu every iteration (minor speedup on big-endians */ + ace_count = le16_to_cpu(acl->ace_count); + + /* initialize 'ace' to the first ace (if any) */ + ace = (ACCESS_ALLOWED_ACE *)((char *)acl + 8); + + /* iterate through ACE's */ + for (i=0;iace_count;i++) { + const char *ace_type; + char *sid; + + /* set ace_type. */ + switch (ace->type) { + case ACCESS_ALLOWED_ACE_TYPE: + ace_type = "allow"; + break; + case ACCESS_DENIED_ACE_TYPE: + ace_type = "deny"; + break; + case SYSTEM_AUDIT_ACE_TYPE: + ace_type = "audit"; + break; + default: + ace_type = "unknown"; + break; + } + + printf("%sACE:\t\t type:%s flags:0x%x access:0x%x\n",prefix,ace_type, + (unsigned int)le16_to_cpu(ace->flags),(unsigned int)le32_to_cpu(ace->mask)); + /* get a SID string */ + sid = ntfs_sid_to_mbs(&ace->sid, NULL, 0); + printf("%s\t\t SID: %s\n",prefix,sid); + if (sid) + free(sid); + + /* proceed to next ACE */ + ace = (ACCESS_ALLOWED_ACE *)(((char *)ace) + le32_to_cpu(ace->size)); + } +} + /* * ntfs_dump_security_descriptor() * * dump the security information about the file */ -void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr) +static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr) { + SECURITY_DESCRIPTOR_ATTR *sec_desc_attr; + char *sid; + + sec_desc_attr = (SECURITY_DESCRIPTOR_ATTR *)((u8*)attr + + le16_to_cpu(attr->value_offset)); + printf("Dumping attribute $SECURITY_DESCRIPTOR (0x50)\n"); - printf("\tTODO\n"); + + printf("\tRevision:\t\t %u\n",sec_desc_attr->revision); + printf("\tFlags:\t\t\t 0x%0x\n",sec_desc_attr->control); +/* todo: stringify flags */ + + sid = ntfs_sid_to_mbs((SID *)((char *)sec_desc_attr + + sec_desc_attr->owner), NULL, 0); + printf("\tOwner SID:\t\t %s\n",sid); + free(sid); + + sid = ntfs_sid_to_mbs((SID *)((char *)sec_desc_attr + + sec_desc_attr->group), NULL, 0); + printf("\tGroup SID:\t\t %s\n",sid); + free(sid); + + printf("\tSystem ACL:\t\t "); + if (sec_desc_attr->control & SE_SACL_PRESENT) { + if (sec_desc_attr->control & SE_SACL_DEFAULTED) { + printf("defaulted"); + } + printf("\n"); + ntfs_dump_acl("\t\t",(ACL *)((char *)sec_desc_attr + + sec_desc_attr->sacl)); + } else { + printf("missing\n"); + } + + printf("\tDiscretionary ACL:\t\t "); + if (sec_desc_attr->control & SE_DACL_PRESENT) { + if (sec_desc_attr->control & SE_SACL_DEFAULTED) { + printf("Defaulted"); + } + printf("\n"); + ntfs_dump_acl("\t\t",(ACL *)((char *)sec_desc_attr + + sec_desc_attr->dacl)); + } else { + printf("missing\n"); + } + } /* @@ -565,7 +671,7 @@ void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr) * * dump the name of the volume the inode belongs to */ -void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) +static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) { uchar_t *ucs_vol_name = NULL; @@ -573,16 +679,16 @@ void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) if (attr->value_length>0) { char *mbs_vol_name = NULL; - int mbs_vol_name_length; + int mbs_vol_name_size; /* calculate volume name position */ ucs_vol_name = (uchar_t*)((u8*)attr + le16_to_cpu(attr->value_offset)); /* convert the name to current locale multibyte sequence */ - mbs_vol_name_length = ntfs_ucstombs(ucs_vol_name, - attr->value_length/sizeof(uchar_t), + mbs_vol_name_size = ntfs_ucstombs(ucs_vol_name, + le32_to_cpu(attr->value_length)/sizeof(uchar_t), &mbs_vol_name,0); - if (mbs_vol_name_length>0) { + if (mbs_vol_name_size>0) { /* output the converted name. */ printf("\tVolume Name: \t\t '%s'\n",mbs_vol_name); free(mbs_vol_name); @@ -603,7 +709,7 @@ void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) * dump the information for the volume the inode belongs to * */ -void ntfs_dump_attr_volume_information(ATTR_RECORD *attr) +static void ntfs_dump_attr_volume_information(ATTR_RECORD *attr) { VOLUME_INFORMATION *vol_information = NULL; @@ -644,7 +750,7 @@ void ntfs_dump_attr_volume_information(ATTR_RECORD *attr) * * dump some info about the data attribute */ -void ntfs_dump_attr_data(ATTR_RECORD *attr) +static void ntfs_dump_attr_data(ATTR_RECORD *attr) { printf("Dumping attribute $DATA (0x80) related info\n"); @@ -691,7 +797,8 @@ void ntfs_dump_attr_data(ATTR_RECORD *attr) } } else { printf("\tIs resident? \t\t Yes\n"); - printf("\tData size: \t\t %u\n",le32_to_cpu(attr->value_length)); + printf("\tData size: \t\t %u\n", + (unsigned int)le32_to_cpu(attr->value_length)); /* u16 value_offset; Byte offset of the attribute RESIDENT_ATTR_FLAGS resident_flags; */ } @@ -702,7 +809,7 @@ void ntfs_dump_attr_data(ATTR_RECORD *attr) * * dump the index_root attribute */ -void ntfs_dump_attr_index_root(ATTR_RECORD *attr) +static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) { INDEX_ROOT *index_root = NULL; @@ -745,21 +852,21 @@ void ntfs_dump_attr_index_root(ATTR_RECORD *attr) /* collation rule dumping */ printf("\tCollation Rule: \t %u\n", - le32_to_cpu(index_root->collation_rule)); + (unsigned int)le32_to_cpu(index_root->collation_rule)); /* COLLATION_BINARY, COLLATION_FILE_NAME, COLLATION_UNICODE_STRING, COLLATION_NTOFS_ULONG, COLLATION_NTOFS_SID, COLLATION_NTOFS_SECURITY_HASH, COLLATION_NTOFS_ULONGS */ printf("\tIndex Block Size:\t %u\n", - le32_to_cpu(index_root->index_block_size)); + (unsigned int)le32_to_cpu(index_root->index_block_size)); printf("\tClusters Per Block:\t %u\n", index_root->clusters_per_index_block); /* index header starts here */ printf("\tAllocated Size:\t\t %u\n", - le32_to_cpu(index_root->index.allocated_size)); + (unsigned int)le32_to_cpu(index_root->index.allocated_size)); printf("\tUsed Size:\t\t %u\n", - le32_to_cpu(index_root->index.index_length)); + (unsigned int)le32_to_cpu(index_root->index.index_length)); printf("\tFlags:\t\t\t %u\n",index_root->index.flags); /* printf("\tIndex Entries Following\t %u\n", ???? );*/ } @@ -769,7 +876,7 @@ void ntfs_dump_attr_index_root(ATTR_RECORD *attr) * * dump the index_allocation attribute */ -void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr) +static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr) { printf("Dumping attribute $INDEX_ALLOCATION (0xA0)\n"); @@ -796,7 +903,7 @@ void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr) * * dump the bitmap attribute */ -void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) +static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) { printf("Dumping attribute $BITMAP (0xB0)\n"); @@ -823,7 +930,7 @@ void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) * * of ntfs 3.x dumps the reparse_point attribute */ -void ntfs_dump_attr_reparse_point(ATTR_RECORD *attr) +static void ntfs_dump_attr_reparse_point(ATTR_RECORD *attr) { printf("Dumping attribute $REPARSE_POINT/$SYMBOLIC_LINK (0xC0)\n"); printf("\tTODO\n"); @@ -834,7 +941,7 @@ void ntfs_dump_attr_reparse_point(ATTR_RECORD *attr) * * dump the ea_information attribute */ -void ntfs_dump_attr_ea_information(ATTR_RECORD *attr) +static void ntfs_dump_attr_ea_information(ATTR_RECORD *attr) { printf("Dumping attribute $EA_INFORMATION (0xD0)\n"); printf("\tTODO\n"); @@ -845,7 +952,7 @@ void ntfs_dump_attr_ea_information(ATTR_RECORD *attr) * * dump the ea attribute */ -void ntfs_dump_attr_ea(ATTR_RECORD *attr) +static void ntfs_dump_attr_ea(ATTR_RECORD *attr) { printf("Dumping attribute $EA (0xE0)\n"); printf("\tTODO\n"); @@ -856,7 +963,7 @@ void ntfs_dump_attr_ea(ATTR_RECORD *attr) * * dump the property_set attribute */ -void ntfs_dump_attr_property_set(ATTR_RECORD *attr) +static void ntfs_dump_attr_property_set(ATTR_RECORD *attr) { printf("Dumping attribute $PROPERTY_SET (0xF0)\n"); printf("\tTODO\n"); @@ -867,35 +974,44 @@ void ntfs_dump_attr_property_set(ATTR_RECORD *attr) * * dump the property_set attribute */ -void ntfs_dump_attr_logged_utility_stream(ATTR_RECORD *attr) +static void ntfs_dump_attr_logged_utility_stream(ATTR_RECORD *attr) { printf("Dumping attribute $LOGGED_UTILITY_STREAM (0x100)\n"); printf("\tTODO\n"); } -void ntfs_dump_attr_unknown(ATTR_RECORD *attr) +static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) { printf("TODO: ntfs_dump_unknown_attr\n"); } - + +static void ntfs_dump_inode_general_info(ntfs_inode *inode) +{ + printf("Dumping Inode #%llu\n",(long long)inode->mft_no); +/* + NTFS_RECORD_TYPES magic;// Usually the magic is "FILE". + u16 usa_ofs; // See NTFS_RECORD definition above. + u16 usa_count; // See NTFS_RECORD definition above. + LSN lsn; // $LogFile sequence number for this record. Changed every time the record is modified. + u16 sequence_number; // Number of times this mft record has been reused. + u16 link_count; // Number of hard links + MFT_RECORD_FLAGS flags; // Bit array of MFT_RECORD_FLAGS. + u32 bytes_in_use; // Number of bytes used in this mft record. + u32 bytes_allocated; // Number of bytes allocated for this mft record. This should be equal to the mft record size. + MFT_REF base_mft_record; // This is zero for base mft records. + u16 next_attr_instance; // The instance number that will be assigned to the next attribute added to this mft record. +// The below fields are specific to NTFS 3.1+ (Windows XP and above): + u32 mft_record_number; // Number of this mft record. +*/ +} + /** * ntfs_get_file_attributes */ -void ntfs_get_file_attributes(ntfs_volume *vol, s64 mft_no) +static void ntfs_dump_file_attributes(ntfs_inode *inode) { - ntfs_inode *inode = NULL; ntfs_attr_search_ctx *ctx = NULL; - /* first obtain our inode */ - inode = ntfs_inode_open(vol, MK_MREF(mft_no, 0)); - if (!inode) { - /* can't open inode */ - /* note: when the specified inode does not exist, EIO is returned - is there a way to give the correct response instead? */ - fprintf(stderr, "Error loading node: %s\n", strerror(errno)); - return; - } - /* then start enumerating attributes see ntfs_attr_lookup documentation for detailed explenation */ ctx = ntfs_attr_get_search_ctx(inode, NULL); @@ -909,16 +1025,13 @@ void ntfs_get_file_attributes(ntfs_volume *vol, s64 mft_no) ntfs_dump_attr_standard_information(ctx->attr); break; case AT_ATTRIBUTE_LIST: - /* As far as I know, ntfs_attr_lookup transparantly iterate - through AT_ATTRIBUTE_LIST, so we shouldn't get to this */ - /* FIXME: inode 9: $Secure does that, I'll have to check */ - printf("Weird: AT_ATTRIBUTE_LIST type was returned.\n"); + ntfs_dump_attr_list(ctx->attr); break; case AT_FILE_NAME: ntfs_dump_attr_file_name(ctx->attr); break; case AT_OBJECT_ID: - ntfs_dump_attr_object_id(ctx->attr,vol); + ntfs_dump_attr_object_id(ctx->attr,inode->vol); break; case AT_SECURITY_DESCRIPTOR: ntfs_dump_attr_security_descriptor(ctx->attr); @@ -969,7 +1082,7 @@ void ntfs_get_file_attributes(ntfs_volume *vol, s64 mft_no) fprintf(stderr, "ntfsinfo error: stopped before finished " "enumerating attributes: %s\n", strerror(errno)); } else { - printf("End of attribute list reached\n"); + printf("End of inode reached\n"); } /* close all data-structures we used */ @@ -1001,13 +1114,27 @@ int main(int argc, char **argv) return 1; /* if opts.mft is not 0, then we will print out information about - * the volume, such as the sector size and whatnot. - */ + * the volume, such as the sector size and whatnot. */ if (opts.mft) ntfs_dump_volume(vol); - if (opts.inode != -1) - ntfs_get_file_attributes(vol, opts.inode); + if (opts.inode != -1) { + ntfs_inode *inode; + /* obtain the inode */ + inode = ntfs_inode_open(vol, MK_LE_MREF(opts.inode, 0)); + + if (inode) { + /* general info */ + ntfs_dump_inode_general_info(inode); + /* dump attributes */ + ntfs_dump_file_attributes(inode); + } else { + /* can't open inode */ + /* note: when the specified inode does not exist, EIO is returned + * is there a way to give the correct response instead? */ + fprintf(stderr, "Error loading node: %s\n", strerror(errno)); + } + } ntfs_umount (vol, FALSE); return 0; From 52889ba7a6cdc114da43c2cc360d351efbf702d2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 11:55:46 +0000 Subject: [PATCH 1365/2994] Big update from Yuval with some bits modified by me. BKrev: 407e7842gn6IZECpDvcO77hHVfzn_w From cd0bb098d9cea7e8962af71c7beaf5716883f5a4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 11:55:46 +0000 Subject: [PATCH 1366/2994] Fix silly typo/bug. (Logical change 1.369) --- libntfs/security.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/security.c b/libntfs/security.c index 252e3744..1db2ebd8 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -205,7 +205,7 @@ char *ntfs_sid_to_mbs(const SID *sid, char *sid_str, size_t sid_str_size) cnt = sid_str_size; } /* Start with "S-R-". */ - i = snprintf(s, cnt, "S-%c-", (char)sid->revision); + i = snprintf(s, cnt, "S-%hhu-", (unsigned char)sid->revision); if (i < 0 || i >= cnt) goto err_out; s += i; From ac5a6513c260a12c414e28697a6b7567e852f5e2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 14:30:43 +0000 Subject: [PATCH 1367/2994] Update (Logical change 1.370) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 24304e47..07e4ce4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,7 @@ xx/xx/2004 - 1.9.2-WIP so utilities won't do bogus and unexpected things. (Szaka) - Add new API security.[hc]::ntfs_sid_is_valid(), ntfs_sid_to_mbs(), and ntfs_sid_to_mbs_size(). + - Big enhancement of ntfsinfo. (Yuval, me) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From 8ff4b87536020f75ee24d582247c374e5a5fd4cf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Apr 2004 14:30:43 +0000 Subject: [PATCH 1368/2994] Update ChangeLog BKrev: 407e9c931wa9uYbh8AC46yOE97oR7w From d636e248354fabd6cb5faa3c727c29cb4e102dba Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Thu, 15 Apr 2004 21:10:18 +0000 Subject: [PATCH 1369/2994] TODO.ntfsprogs changes: ntfsresize updated, ntfsclone added BKrev: 407efa3aZaN1izFLDNxMgQYVZOcVnQ From 0d75e309a915066c890406d92748db063077fef3 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Thu, 15 Apr 2004 21:10:18 +0000 Subject: [PATCH 1370/2994] ntfsresize updated, ntfsclone added (Logical change 1.371) --- TODO.ntfsprogs | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index a1288508..2a88a526 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -4,7 +4,6 @@ Thanks, Anton - ********** * mkntfs * ********** @@ -21,6 +20,18 @@ Thanks, size to make it work. Note, reporter was using win2k. +************* +* ntfsclone * +************* + +- get rid of the unneeded lseek()'s during reads/writes +- catch if source and dest are the same +- add sparse encoding/decoding, perhaps using Partimage image format? +- consider badblock list +- add dd's noerror option +- disable consistency check for --metadata (e.g. if the check is crashing) +- make "wiped", etc statistic variables long long + *********** * ntfsfix * @@ -36,7 +47,6 @@ Thanks, not a showstopper bug for the first release. (AIA) - ************* * ntfslabel * ************* @@ -44,26 +54,23 @@ Thanks, - Support ioctls for ntfs tng driver 2.?.? for reading/changing the label. - ************** * ntfsresize * ************** High priority - - support fragmented volumes -- WIP - - recovery support, journaling + - move ntfs consistency check to libntfs (for ntfsck, ntfsclone, etc) + - use different exit codes (e.g. corrupt volume detected, unsupported case, + bad sectors, etc) Medium priority - - easy usage by partitioning tools -- WIP - - move useful things to libntfs - - extended error codes at exit() - - cleanup at exit() - - quiet operation + - support disks having bad sectors + - cope with the rare, unsupported cases, see man ntfsresize 'KNOWN ISSUES' + - save $Bitmap if it was modified and an error occures (e.g. bad sector). + - handle signals (^C, etc) Low priority - move volume start - - support disks having bad blocks - **************** From 510540736b3769909f7b237c550e6b6fe4f7112e Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Fri, 16 Apr 2004 19:25:24 +0000 Subject: [PATCH 1371/2994] ntfsresize: split walk_inodes() into check_allocation_bitmap() and set_resize_constrains() [in progress] BKrev: 40803324Ufc5i_8jR0P9PSNH-Rw8Yw From 49bc22ac54abf57fbb21ecb4588943f4bfd66b34 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Fri, 16 Apr 2004 19:25:24 +0000 Subject: [PATCH 1372/2994] split walk_inodes() into check_allocation_bitmap() and set_resize_constrains() [in progress] (Logical change 1.372) --- ntfsprogs/ntfsresize.c | 111 ++++++++++++++++++++++++++++++----------- 1 file changed, 81 insertions(+), 30 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 780dff7b..d0765097 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -601,7 +601,7 @@ static int has_bad_sectors(ntfs_resize_t *resize) return ret; } -static void collect_shrink_constraints(ntfs_resize_t *resize, runlist *rl) +static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) { s64 inode, last_lcn; ATTR_FLAGS flags; @@ -670,7 +670,7 @@ static void collect_shrink_constraints(ntfs_resize_t *resize, runlist *rl) } -static void collect_shrink_info(ntfs_resize_t *resize, runlist *rl) +static void collect_relocation_info(ntfs_resize_t *resize, runlist *rl) { s64 lcn, lcn_length, start, len, inode; s64 new_vol_size; /* (last LCN on the volume) + 1 */ @@ -771,13 +771,7 @@ static void build_lcn_usage_bitmap(ntfs_resize_t *resize) (unsigned long long)k); } } - resize->inuse += lcn_length; - - collect_shrink_constraints(resize, rl + i); - - if (resize->shrink) - collect_shrink_info(resize, rl + i); } free(rl); } @@ -790,19 +784,16 @@ static void build_lcn_usage_bitmap(ntfs_resize_t *resize) */ static void walk_attributes(ntfs_resize_t *resize) { - ntfs_attr_search_ctx *ctx; - - if (!(ctx = ntfs_attr_get_search_ctx(resize->ni, NULL))) + if (!(resize->ctx = ntfs_attr_get_search_ctx(resize->ni, NULL))) perr_exit("ntfs_get_attr_search_ctx"); - while (!ntfs_attrs_walk(ctx)) { - if (ctx->attr->type == AT_END) + while (!ntfs_attrs_walk(resize->ctx)) { + if (resize->ctx->attr->type == AT_END) break; - resize->ctx = ctx; build_lcn_usage_bitmap(resize); } - ntfs_attr_put_search_ctx(ctx); + ntfs_attr_put_search_ctx(resize->ctx); } /** @@ -918,20 +909,19 @@ static void progress_update(struct progress_bar *p, u64 current) * Read each record in the MFT, skipping the unused ones, and build up a bitmap * from all the non-resident attributes. */ -static void walk_inodes(ntfs_resize_t *resize) +static void build_allocation_bitmap(ntfs_resize_t *resize) { s64 inode = 0; - s64 last_mft_rec; ntfs_inode *ni; + struct progress_bar progress; /* WARNING: don't modify the text, external tools grep for it */ printf("Checking filesystem consistency ...\n"); - last_mft_rec = vol->nr_mft_records - 1; - progress_init(&resize->progress, inode, last_mft_rec, 100); + progress_init(&progress, inode, vol->nr_mft_records - 1, 100); - for (; inode <= last_mft_rec; inode++) { - progress_update(&resize->progress, inode); + for (; inode < vol->nr_mft_records; inode++) { + progress_update(&progress, inode); if ((ni = ntfs_inode_open(vol, (MFT_REF)inode)) == NULL) { /* FIXME: continue only if it make sense, e.g. @@ -952,6 +942,69 @@ close_inode: } } +static void build_resize_constrains(ntfs_resize_t *resize) +{ + s64 i; + runlist *rl; + + if (!resize->ctx->attr->non_resident) + return; + + if (!(rl = ntfs_mapping_pairs_decompress(vol, resize->ctx->attr, NULL))) + perr_exit("ntfs_decompress_mapping_pairs"); + + for (i = 0; rl[i].length; i++) { + /* CHECKME: LCN_RL_NOT_MAPPED check isn't needed */ + if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) + continue; + + collect_resize_constraints(resize, rl + i); + if (resize->shrink) + collect_relocation_info(resize, rl + i); + } + free(rl); +} + +static void resize_constrains_by_attributes(ntfs_resize_t *resize) +{ + if (!(resize->ctx = ntfs_attr_get_search_ctx(resize->ni, NULL))) + perr_exit("ntfs_get_attr_search_ctx"); + + while (!ntfs_attrs_walk(resize->ctx)) { + if (resize->ctx->attr->type == AT_END) + break; + build_resize_constrains(resize); + } + + ntfs_attr_put_search_ctx(resize->ctx); +} + +static void set_resize_constrains(ntfs_resize_t *resize) +{ + s64 inode; + ntfs_inode *ni; + + printf("Collecting shrinkage constrains ...\n"); + + for (inode = 0; inode < vol->nr_mft_records; inode++) { + + if ((ni = ntfs_inode_open(vol, (MFT_REF)inode)) == NULL) { + if (errno == EIO || errno == ENOENT) + continue; + perr_exit("Reading inode %lld failed", inode); + } + + if ((ni->mrec->base_mft_record) != 0) + goto close_inode; + + resize->ni = ni; + resize_constrains_by_attributes(resize); +close_inode: + if (ntfs_inode_close(ni)) + perr_exit("ntfs_inode_close for inode %lld", inode); + } +} + static void rl_fixup(runlist **rl) { runlist *tmp = *rl; @@ -1429,19 +1482,16 @@ static void relocate_attribute(ntfs_resize_t *resize) static void relocate_attributes(ntfs_resize_t *resize) { - ntfs_attr_search_ctx *ctx; - - if (!(ctx = ntfs_attr_get_search_ctx(NULL, resize->mrec))) + if (!(resize->ctx = ntfs_attr_get_search_ctx(NULL, resize->mrec))) perr_exit("ntfs_get_attr_search_ctx"); - while (!ntfs_attrs_walk(ctx)) { - if (ctx->attr->type == AT_END) + while (!ntfs_attrs_walk(resize->ctx)) { + if (resize->ctx->attr->type == AT_END) break; - resize->ctx = ctx; relocate_attribute(resize); } - ntfs_attr_put_search_ctx(ctx); + ntfs_attr_put_search_ctx(resize->ctx); } static void relocate_inode(ntfs_resize_t *resize, MFT_REF mref) @@ -2071,7 +2121,7 @@ int main(int argc, char **argv) if (new_size < vol->nr_clusters) resize.shrink = 1; - walk_inodes(&resize); + build_allocation_bitmap(&resize); if (resize.multi_ref) { err_printf("Filesystem check failed! Totally %d clusters " "referenced multiply times.\n", resize.multi_ref); @@ -2081,7 +2131,8 @@ int main(int argc, char **argv) compare_bitmaps(&resize.lcn_bitmap); print_disk_usage(&resize); - + + set_resize_constrains(&resize); set_disk_usage_constraint(&resize); check_shrink_constraints(&resize); From 4a5abe324202b8891855ced9b950d58673138ff4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 16 Apr 2004 20:43:28 +0000 Subject: [PATCH 1373/2994] Split up into multiple functions. (Yuval) (Logical change 1.373) --- ntfsprogs/mkntfs.c | 311 +++++++++++++++++++++++++++++---------------- 1 file changed, 203 insertions(+), 108 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index c63f1910..e47fd902 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -660,7 +660,7 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) printf("%s\n", todo); return; case AT_VOLUME_NAME: - printf("Volume name length = %i\n", val_len); + printf("Volume name length = %i\n", (unsigned int)val_len); if (val_len) { buf = calloc(1, val_len); if (!buf) @@ -849,7 +849,8 @@ static void dump_attr_record(ATTR_RECORD *a) printf("-- Beginning dump of attribute record. --\n"); if (a->type == AT_END) { - printf("Attribute type = 0x%x ($END)\n", le32_to_cpu(AT_END)); + printf("Attribute type = 0x%x ($END)\n", + (unsigned int)le32_to_cpu(AT_END)); u = le32_to_cpu(a->length); printf("Length of resident part = %u (0x%x)\n", u, u); return; @@ -2536,52 +2537,14 @@ static void mkntfs_exit(void) } /** - * main + * mkntfs_open_partition - */ -int main(int argc, char **argv) +static void mkntfs_open_partition(void) { - int i, j, err; - ssize_t bw; + int i; struct stat sbuf; - long long lw, pos; - MFT_RECORD *m; - ATTR_RECORD *a; - MFT_REF root_ref; - ntfs_attr_search_ctx *ctx; - char *sd; - NTFS_BOOT_SECTOR *bs; unsigned long mnt_flags; - /* Setup the correct locale for string output and conversion. */ - utils_set_locale(); - /* Initialize the random number generator with the current time. */ - srandom(time(NULL)); - /* Allocate and initialize ntfs_volume structure vol. */ - vol = ntfs_volume_alloc(); - if (!vol) - err_exit("Could not allocate memory for internal buffer.\n"); - /* Register our exit function which will cleanup everything. */ - err = atexit(&mkntfs_exit); - if (err == -1) { - Eprintf("Could not set up exit() function because atexit() " - "failed. Aborting...\n"); - mkntfs_exit(); - exit(1); - } - vol->major_ver = 1; - vol->minor_ver = 2; - vol->mft_record_size = 1024; - vol->mft_record_size_bits = 10; - /* Length is in unicode characters. */ - vol->upcase_len = 65536; - vol->upcase = (uchar_t*)malloc(vol->upcase_len * sizeof(uchar_t)); - if (!vol->upcase) - err_exit("Could not allocate memory for internal buffer.\n"); - init_upcase_table(vol->upcase, vol->upcase_len * sizeof(uchar_t)); - /* Initialize opts to zero / required values. */ - init_options(); - /* Parse command line options. */ - parse_options(argc, argv); /* * Allocate and initialize an ntfs device structure and attach it to * the volume. @@ -2655,6 +2618,13 @@ int main(int argc, char **argv) fprintf(stderr, "mkntfs forced anyway. Hope /etc/mtab is " "incorrect.\n"); } +} + +/** + * mkntfs_override_phys_params - + */ +static void mkntfs_override_phys_params(void) +{ /* If user didn't specify the sector size, determine it now. */ if (!opts.sector_size) { #ifdef BLKSSZGET @@ -2857,6 +2827,15 @@ int main(int argc, char **argv) "smallest possible\ncluster size for the size " "of the device will be used.\n"); } +} + +/** + * mkntfs_initialize_bitmaps - + */ +static void mkntfs_initialize_bitmaps(void) +{ + int i, j; + /* Determine lcn bitmap byte size and allocate it. */ lcn_bitmap_byte_size = (opts.nr_clusters + 7) >> 3; /* Needs to be multiple of 8 bytes. */ @@ -2912,6 +2891,15 @@ int main(int argc, char **argv) rl_mft_bmp[1].length = 0LL; /* Allocate cluster for mft bitmap. */ ntfs_bit_set(lcn_bitmap, (s64)j, 1); +} + +/** + * mkntfs_initialize_rl_mft - + */ +static void mkntfs_initialize_rl_mft(void) +{ + int i, j; + /* If user didn't specify the mft lcn, determine it now. */ if (!opts.mft_lcn) { /* @@ -2989,6 +2977,15 @@ int main(int argc, char **argv) ntfs_bit_set(lcn_bitmap, opts.mftmirr_lcn + i, 1); opts.logfile_lcn = opts.mftmirr_lcn + j; Dprintf("$LogFile logical cluster number = 0x%x\n", opts.logfile_lcn); +} + +/** + * mkntfs_initialize_rl_logfile - + */ +static void mkntfs_initialize_rl_logfile(void) +{ + int i, j; + /* Create runlist for log file. */ rl_logfile = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_logfile) @@ -3038,6 +3035,14 @@ int main(int argc, char **argv) /* Allocate clusters for log file. */ for (i = 0; i < j; i++) ntfs_bit_set(lcn_bitmap, opts.logfile_lcn + i, 1); +} + +/** + * mkntfs_initialize_rl_boot - + */ +static void mkntfs_initialize_rl_boot(void) +{ + int i, j; /* Create runlist for $Boot. */ rl_boot = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_boot) @@ -3056,11 +3061,13 @@ int main(int argc, char **argv) /* Allocate clusters for $Boot. */ for (i = 0; i < j; i++) ntfs_bit_set(lcn_bitmap, 0LL + i, 1); - /* Allocate a buffer large enough to hold the mft. */ - buf = calloc(1, opts.mft_size); - if (!buf) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); +} + +/** + * mkntfs_initialize_rl_bad - + */ +static void mkntfs_initialize_rl_bad(void) +{ /* Create runlist for $BadClus, $DATA named stream $Bad. */ rl_bad = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_bad) @@ -3077,74 +3084,95 @@ int main(int argc, char **argv) rl_bad[1].length = 0LL; // TODO: Mark bad blocks as such. +} +/** + * mkntfs_fill_device_with_zeroes - + */ +static void mkntfs_fill_device_with_zeroes(void) +{ /* * If not quick format, fill the device with 0s. * FIXME: Except bad blocks! (AIA) */ - if (!opts.quick_format) { - unsigned long position; - unsigned long mid_clust; - float progress_inc = (float)opts.nr_clusters / 100; + int i; + ssize_t bw; + unsigned long position; + unsigned long mid_clust; + float progress_inc = (float)opts.nr_clusters / 100; - Qprintf("Initialising device with zeroes: 0%%"); - fflush(stdout); - mid_clust = (opts.volume_size >> 1) / vol->cluster_size; - for (position = 0; position < opts.nr_clusters; position++) { - if (!(position % (int)(progress_inc+1))) { - Qprintf("\b\b\b\b%3.0f%%", position / - progress_inc); - fflush(stdout); - } - bw = mkntfs_write(vol->dev, buf, vol->cluster_size); - if (bw != (ssize_t)vol->cluster_size) { - if (bw != -1 || errno != EIO) - err_exit("This should not happen.\n"); - if (!position) - err_exit("Error: Cluster zero is bad. " - "Cannot create NTFS file " - "system.\n"); - if (position == mid_clust && - (vol->major_ver < 1 || - (vol->major_ver == 1 && - vol->minor_ver < 2))) - err_exit("Error: Bad cluster found in " - "location reserved for system " - "file $Boot.\n"); - /* Add the baddie to our bad blocks list. */ - append_to_bad_blocks(position); - Qprintf("\nFound bad cluster (%ld). Adding to " - "list of bad blocks.\nInitialising " - "device with zeroes: %3.0f%%", position, - position / progress_inc); - /* Seek to next cluster. */ - vol->dev->d_ops->seek(vol->dev, - ((off_t)position + 1) * - vol->cluster_size, SEEK_SET); - } + Qprintf("Initialising device with zeroes: 0%%"); + fflush(stdout); + mid_clust = (opts.volume_size >> 1) / vol->cluster_size; + for (position = 0; position < opts.nr_clusters; position++) { + if (!(position % (int)(progress_inc+1))) { + Qprintf("\b\b\b\b%3.0f%%", position / + progress_inc); + fflush(stdout); } - Qprintf("\b\b\b\b100%%"); - position = (opts.volume_size & (vol->cluster_size - 1)) / - opts.sector_size; - for (i = 0; (unsigned long)i < position; i++) { - bw = mkntfs_write(vol->dev, buf, opts.sector_size); - if (bw != opts.sector_size) { - if (bw != -1 || errno != EIO) - err_exit("This should not happen.\n"); - else if (i + 1UL == position && - (vol->major_ver >= 2 || - (vol->major_ver == 1 && - vol->minor_ver >= 2))) - err_exit("Error: Bad cluster found in " - "location reserved for system " - "file $Boot.\n"); - /* Seek to next sector. */ - vol->dev->d_ops->seek(vol->dev, - opts.sector_size, SEEK_CUR); - } + bw = mkntfs_write(vol->dev, buf, vol->cluster_size); + if (bw != (ssize_t)vol->cluster_size) { + if (bw != -1 || errno != EIO) + err_exit("This should not happen.\n"); + if (!position) + err_exit("Error: Cluster zero is bad. " + "Cannot create NTFS file " + "system.\n"); + if (position == mid_clust && + (vol->major_ver < 1 || + (vol->major_ver == 1 && + vol->minor_ver < 2))) + err_exit("Error: Bad cluster found in " + "location reserved for system " + "file $Boot.\n"); + /* Add the baddie to our bad blocks list. */ + append_to_bad_blocks(position); + Qprintf("\nFound bad cluster (%ld). Adding to " + "list of bad blocks.\nInitialising " + "device with zeroes: %3.0f%%", position, + position / progress_inc); + /* Seek to next cluster. */ + vol->dev->d_ops->seek(vol->dev, + ((off_t)position + 1) * + vol->cluster_size, SEEK_SET); } - Qprintf(" - Done.\n"); } + Qprintf("\b\b\b\b100%%"); + position = (opts.volume_size & (vol->cluster_size - 1)) / + opts.sector_size; + for (i = 0; (unsigned long)i < position; i++) { + bw = mkntfs_write(vol->dev, buf, opts.sector_size); + if (bw != opts.sector_size) { + if (bw != -1 || errno != EIO) + err_exit("This should not happen.\n"); + else if (i + 1UL == position && + (vol->major_ver >= 2 || + (vol->major_ver == 1 && + vol->minor_ver >= 2))) + err_exit("Error: Bad cluster found in " + "location reserved for system " + "file $Boot.\n"); + /* Seek to next sector. */ + vol->dev->d_ops->seek(vol->dev, + opts.sector_size, SEEK_CUR); + } + } + Qprintf(" - Done.\n"); +} + +/** + * mkntfs_create_root_structures - + */ +static void mkntfs_create_root_structures(void) +{ + NTFS_BOOT_SECTOR *bs; + ATTR_RECORD *a; + MFT_RECORD *m; + MFT_REF root_ref; + ssize_t bw; + int i, j, err; + char *sd; + Qprintf("Creating NTFS volume structures.\n"); /* * Setup an empty mft record. Note, we can just give 0 as the mft @@ -3218,6 +3246,7 @@ int main(int argc, char **argv) if (!err) err = upgrade_to_large_index(m, "$I30", 4, 0, &index_block); if (!err) { + ntfs_attr_search_ctx *ctx; ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) err_exit("Failed to allocate attribute search " @@ -3559,6 +3588,73 @@ bb_err: i, i, strerror(-err)); //dump_mft_record(m); } +} + +/** + * main + */ +int main(int argc, char **argv) +{ + ntfs_attr_search_ctx *ctx; + long long lw, pos; + ATTR_RECORD *a; + MFT_RECORD *m; + int i, err; + + /* Setup the correct locale for string output and conversion. */ + utils_set_locale(); + /* Initialize the random number generator with the current time. */ + srandom(time(NULL)); + /* Allocate and initialize ntfs_volume structure vol. */ + vol = ntfs_volume_alloc(); + if (!vol) + err_exit("Could not allocate memory for internal buffer.\n"); + /* Register our exit function which will cleanup everything. */ + err = atexit(&mkntfs_exit); + if (err == -1) { + Eprintf("Could not set up exit() function because atexit() " + "failed. Aborting...\n"); + mkntfs_exit(); + exit(1); + } + vol->major_ver = 1; + vol->minor_ver = 2; + vol->mft_record_size = 1024; + vol->mft_record_size_bits = 10; + /* Length is in unicode characters. */ + vol->upcase_len = 65536; + vol->upcase = (uchar_t*)malloc(vol->upcase_len * sizeof(uchar_t)); + if (!vol->upcase) + err_exit("Could not allocate memory for internal buffer.\n"); + init_upcase_table(vol->upcase, vol->upcase_len * sizeof(uchar_t)); + /* Initialize opts to zero / required values. */ + init_options(); + /* Parse command line options. */ + parse_options(argc, argv); + /* Open the partition. */ + mkntfs_open_partition(); + /* Decide on the sectors/tracks/heads/size, etc. */ + mkntfs_override_phys_params(); + /* Initialize $Bitmap and $MFT/$BITMAP related stuff. */ + mkntfs_initialize_bitmaps(); + /* Initialize MFT & set opts.logfile_lcn. */ + mkntfs_initialize_rl_mft(); + /* Initlialize $LogFile. */ + mkntfs_initialize_rl_logfile(); + /* Initialize $Boot. */ + mkntfs_initialize_rl_boot(); + /* Allocate a buffer large enough to hold the mft. */ + buf = calloc(1, opts.mft_size); + if (!buf) + err_exit("Failed to allocate internal buffer: %s\n", + strerror(errno)); + /* Create runlist for $BadClus, $DATA named stream $Bad. */ + mkntfs_initialize_rl_bad(); + /* If not quick format, fill the device with 0s. */ + if (!opts.quick_format) + mkntfs_fill_device_with_zeroes(); + /* Create NTFS volume structures. */ + mkntfs_create_root_structures(); // - Do not step onto bad blocks!!! // - If any bad blocks were specified or found, modify $BadClus, allocating the // bad clusters in $Bitmap. @@ -3686,4 +3782,3 @@ bb_err: */ return 0; } - From 4d47eca8419e220bc3ca41719b8b905dbbb81303 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 16 Apr 2004 20:43:28 +0000 Subject: [PATCH 1374/2994] Split up mkntfs into multiple functions. (Yuval) BKrev: 40804570EIWBfhtZCP1Yi0VNasOh7g From 86c68c96e1975ccd2f197e69864decdb97c680e4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 16 Apr 2004 20:43:28 +0000 Subject: [PATCH 1375/2994] Update (Logical change 1.373) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 07e4ce4f..da217838 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,7 @@ xx/xx/2004 - 1.9.2-WIP - Add new API security.[hc]::ntfs_sid_is_valid(), ntfs_sid_to_mbs(), and ntfs_sid_to_mbs_size(). - Big enhancement of ntfsinfo. (Yuval, me) + - Split mkntfs into multiple functions. (Yuval) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From 16ca8d02531d994b6ea814085c7f4486dcb3388c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 16 Apr 2004 20:54:34 +0000 Subject: [PATCH 1376/2994] Compiler warning fixes in utilities mostly due to GEN_PRINTF stuff. (Yuval) BKrev: 4080480aB67Npmg7VhPx4tp1cOTmBA From 71c1fe3af863463e67bf223ef5a6fe3e987af598 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 16 Apr 2004 20:54:34 +0000 Subject: [PATCH 1377/2994] Update (Logical change 1.374) --- ChangeLog | 6 ++++-- ntfsprogs/cluster.c | 4 ---- ntfsprogs/mkntfs.c | 4 ++-- ntfsprogs/ntfscat.c | 6 ++++-- ntfsprogs/ntfsclone.c | 9 +-------- ntfsprogs/ntfsresize.c | 7 +------ ntfsprogs/utils.c | 5 ----- ntfsprogs/utils.h | 10 ++++++++++ 8 files changed, 22 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index da217838..01e9a0cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,10 +11,12 @@ xx/xx/2004 - 1.9.2-WIP $LogFile. (Szaka) - Fix incorrect getopt_long() usage: converted argv[optind-1] to optarg so utilities won't do bogus and unexpected things. (Szaka) - - Add new API security.[hc]::ntfs_sid_is_valid(), ntfs_sid_to_mbs(), and - ntfs_sid_to_mbs_size(). + - Add new API security.[hc]::ntfs_sid_is_valid(), ntfs_sid_to_mbs(), + and ntfs_sid_to_mbs_size(). - Big enhancement of ntfsinfo. (Yuval, me) - Split mkntfs into multiple functions. (Yuval) + - Compiler warning fixes in utilities related to GEN_PRINTF() and other + things. (Yuval) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c index 5f3bfcaf..fc281dfe 100644 --- a/ntfsprogs/cluster.c +++ b/ntfsprogs/cluster.c @@ -31,10 +31,6 @@ #include "cluster.h" #include "utils.h" -DEC_PRINTF (Eprintf) -DEC_PRINTF (Vprintf) -DEC_PRINTF (Qprintf) - #define RED "" #define YELLOW "" #define GREEN "" diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index e47fd902..315fea83 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -227,8 +227,7 @@ static void Dprintf(const char *fmt, ...) /** * Eprintf - error output; ignores quiet (-q) */ -void Eprintf(const char *fmt, ...); -void Eprintf(const char *fmt, ...) +int Eprintf(const char *fmt, ...) { va_list ap; @@ -236,6 +235,7 @@ void Eprintf(const char *fmt, ...) va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); + return 0; } /* Generate code for Vprintf() function: Verbose output (-v). */ diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 5f7d2d99..304ba129 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -299,10 +299,12 @@ int main (int argc, char *argv[]) ntfs_inode_close (inode); ntfs_umount (vol, FALSE); +#if 0 if (result) - ;//Printf ("failed\n"); + Printf ("failed\n"); else - ;//Printf ("success\n"); + Printf ("success\n"); +#endif return result; } diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 0009a9a0..82a8246f 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -119,17 +119,10 @@ int wiped_timestamp_data = 0; #define read_all(f, p, n) io_all((f), (p), (n), 0) #define write_all(f, p, n) io_all((f), (p), (n), 1) -/* FIXME: They should be #included but Eprintf conflicts with mkntfs's Eprintf */ -extern int Eprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); -extern int Vprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); -extern int Qprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); -/* FIXME: should be 'static' */ -extern int Printf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); - GEN_PRINTF(Eprintf, stderr, NULL, FALSE) GEN_PRINTF(Vprintf, msg_out, &opt.verbose, TRUE) GEN_PRINTF(Qprintf, msg_out, &opt.quiet, FALSE) -GEN_PRINTF(Printf, msg_out, NULL, FALSE) +static GEN_PRINTF(Printf, msg_out, NULL, FALSE) static void perr_printf(const char *fmt, ...) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index d0765097..86d134e0 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -156,14 +156,9 @@ s64 max_free_cluster_range = 0; #define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) -/* FIXME: They should be included but Eprintf conflicts with mkntfs's Eprintf */ -extern int Eprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); -extern int Vprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); -extern int Qprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); - GEN_PRINTF(Eprintf, stderr, NULL, FALSE) GEN_PRINTF(Vprintf, stdout, &opt.verbose, TRUE) -GEN_PRINTF(Qprintf, stdout, NULL, FALSE) +GEN_PRINTF(Qprintf, stdout, NULL, FALSE) /** * perr_printf diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 4a42cae1..36cbf37e 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -58,11 +58,6 @@ const char *ntfs_gpl = "This program is free software, released under the GNU " #define NTFS_TIME_OFFSET ((s64)(369 * 365 + 89) * 24 * 3600 * 10000000) -/* These utilities require the following functions */ -extern int Eprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); -extern int Vprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); -extern int Qprintf (const char *format, ...) __attribute__ ((format (printf, 1, 2))); - /** * utils_set_locale */ diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index e605da63..73678a84 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -70,6 +70,16 @@ extern const char *ntfs_gpl; return ret; \ } +/* utils.c's utilities require the following functions implemented. + * Example of implementation is: + * GEN_PRINTF (Eprintf, stderr, NULL, FALSE) + * GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) + * GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) + */ +extern DEC_PRINTF(Eprintf) +extern DEC_PRINTF(Vprintf) +extern DEC_PRINTF(Qprintf) + struct _IO_FILE; int ntfs_printf (struct _IO_FILE *stream, int *control, BOOL trigger, From b1a398abfb031c186838590174d5ada27e8a1994 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 16 Apr 2004 20:58:20 +0000 Subject: [PATCH 1378/2994] Update (Logical change 1.375) --- ntfsprogs/ntfstruncate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 9e6441b9..b0d35670 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -110,7 +110,7 @@ void Dprintf(const char *fmt, ...) /** * Eprintf - error output; ignores quiet (-q) */ -void Eprintf(const char *fmt, ...) +int Eprintf(const char *fmt, ...) { va_list ap; From 21712a814fd1e22c886087c43edf0f61351b2271 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 16 Apr 2004 20:58:20 +0000 Subject: [PATCH 1379/2994] Update BKrev: 408048ecMR8YadNs1cmk4qbJDsoo1Q From 12639f64b78163c5973aeee05e4bd496b4bc2883 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 16 Apr 2004 21:00:27 +0000 Subject: [PATCH 1380/2994] Update (Logical change 1.376) --- ntfsprogs/ntfstruncate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index b0d35670..abb59e1a 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -118,6 +118,7 @@ int Eprintf(const char *fmt, ...) va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); + return 0; } /* Generate code for Vprintf() function: Verbose output (-v). */ From b87c41cea482f738def06afcde9f104022a65656 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 16 Apr 2004 21:00:27 +0000 Subject: [PATCH 1381/2994] ntfstruncate.c: Update BKrev: 4080496bkAV5bFMuLX9HKBRatOcoGw From fbd9efac4e61edb292862900bdc23fd36f2671bd Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 17 Apr 2004 01:02:42 +0000 Subject: [PATCH 1382/2994] Auto merged 2004/04/17 04:01:46+03:00 elisa-laajakaista.fi!szaka Detached ntfs_fsck_t from ntfs_resize_t and use it for check_allocation_bitmap() [in progress] (Logical change 1.377) --- ntfsprogs/ntfsresize.c | 100 ++++++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 45 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 86d134e0..2717c062 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -108,18 +108,25 @@ struct llcn_t { }; typedef struct { - s64 new_volume_size; /* in clusters; 0 = --info w/o --size */ - int shrink; /* shrink = 1, enlarge = 0 */ - ntfs_inode *ni; /* inode being processed */ - MFT_REF mref; /* mft reference */ - MFT_RECORD *mrec; /* mft record */ - ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ - u64 relocations; /* num of clusters to relocate */ - s64 inuse; /* num of clusters in use */ - int multi_ref; /* num of clusters ref'd many times */ - runlist mftmir_rl; /* $MFTMirr AT_DATA's new position */ - s64 mftmir_old; /* $MFTMirr AT_DATA's old LCN */ - int dirty_inode; /* some inode data got relocated */ + ntfs_inode *ni; /* inode being processed */ + ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ + s64 inuse; /* num of clusters in use */ + int multi_ref; /* num of clusters referenced many times */ + struct bitmap lcn_bitmap; +} ntfs_fsck_t; + +typedef struct { + s64 new_volume_size; /* in clusters; 0 = --info w/o --size */ + int shrink; /* shrink = 1, enlarge = 0 */ + ntfs_inode *ni; /* inode being processed */ + MFT_REF mref; /* mft reference */ + MFT_RECORD *mrec; /* mft record */ + ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ + u64 relocations; /* num of clusters to relocate */ + s64 inuse; /* num of clusters in use */ + runlist mftmir_rl; /* $MFTMirr AT_DATA's new position */ + s64 mftmir_old; /* $MFTMirr AT_DATA's old LCN */ + int dirty_inode; /* some inode data got relocated */ struct progress_bar progress; struct bitmap lcn_bitmap; /* Temporary statistics until all case is supported */ @@ -129,8 +136,8 @@ typedef struct { struct llcn_t last_sparse; struct llcn_t last_compressed; struct llcn_t last_lcn; - s64 last_unsafe; /* last "unsafe-to-move" cluster */ - s64 last_unsupp; /* last unsupported cluster */ + s64 last_unsafe; /* last "unsafe-to-move" cluster */ + s64 last_unsupp; /* last unsupported cluster */ } ntfs_resize_t; @@ -716,16 +723,16 @@ static void collect_relocation_info(ntfs_resize_t *resize, runlist *rl) * * This serves as a rudimentary "chkdsk" operation. */ -static void build_lcn_usage_bitmap(ntfs_resize_t *resize) +static void build_lcn_usage_bitmap(ntfs_fsck_t *fsck) { s64 inode; ATTR_RECORD *a; runlist *rl; int i, j; - struct bitmap *lcn_bitmap = &resize->lcn_bitmap; + struct bitmap *lcn_bitmap = &fsck->lcn_bitmap; - a = resize->ctx->attr; - inode = resize->ni->mft_no; + a = fsck->ctx->attr; + inode = fsck->ni->mft_no; if (!a->non_resident) return; @@ -757,7 +764,7 @@ static void build_lcn_usage_bitmap(ntfs_resize_t *resize) u64 k = (u64)lcn + j; if (ntfs_bit_get_and_set(lcn_bitmap->bm, k, 1)) { - if (++resize->multi_ref > 10) + if (++fsck->multi_ref > 10) continue; printf("Cluster %llu (0x%llx) referenced " @@ -766,7 +773,7 @@ static void build_lcn_usage_bitmap(ntfs_resize_t *resize) (unsigned long long)k); } } - resize->inuse += lcn_length; + fsck->inuse += lcn_length; } free(rl); } @@ -777,18 +784,18 @@ static void build_lcn_usage_bitmap(ntfs_resize_t *resize) * For a given MFT Record, iterate through all its attributes. Any non-resident * data runs will be marked in lcn_bitmap. */ -static void walk_attributes(ntfs_resize_t *resize) +static void walk_attributes(ntfs_fsck_t *fsck) { - if (!(resize->ctx = ntfs_attr_get_search_ctx(resize->ni, NULL))) + if (!(fsck->ctx = ntfs_attr_get_search_ctx(fsck->ni, NULL))) perr_exit("ntfs_get_attr_search_ctx"); - while (!ntfs_attrs_walk(resize->ctx)) { - if (resize->ctx->attr->type == AT_END) + while (!ntfs_attrs_walk(fsck->ctx)) { + if (fsck->ctx->attr->type == AT_END) break; - build_lcn_usage_bitmap(resize); + build_lcn_usage_bitmap(fsck); } - ntfs_attr_put_search_ctx(resize->ctx); + ntfs_attr_put_search_ctx(fsck->ctx); } /** @@ -904,7 +911,7 @@ static void progress_update(struct progress_bar *p, u64 current) * Read each record in the MFT, skipping the unused ones, and build up a bitmap * from all the non-resident attributes. */ -static void build_allocation_bitmap(ntfs_resize_t *resize) +static void build_allocation_bitmap(ntfs_fsck_t *fsck) { s64 inode = 0; ntfs_inode *ni; @@ -929,8 +936,8 @@ static void build_allocation_bitmap(ntfs_resize_t *resize) if ((ni->mrec->base_mft_record) != 0) goto close_inode; - resize->ni = ni; - walk_attributes(resize); + fsck->ni = ni; + walk_attributes(fsck); close_inode: if (ntfs_inode_close(ni)) perr_exit("ntfs_inode_close for inode %lld", inode); @@ -1903,12 +1910,12 @@ static void print_vol_size(const char *str, s64 bytes) * * Display the amount of disk space in use. */ -static void print_disk_usage(ntfs_resize_t *resize) +static void print_disk_usage(s64 nr_used_clusters) { s64 total, used; total = vol->nr_clusters * vol->cluster_size; - used = resize->inuse * vol->cluster_size; + used = nr_used_clusters * vol->cluster_size; /* WARNING: don't modify the text, external tools grep for it */ printf("Space in use : %lld MB (%.1f%%)\n", @@ -2055,6 +2062,7 @@ static void check_shrink_constraints(ntfs_resize_t *resize) int main(int argc, char **argv) { + ntfs_fsck_t fsck; ntfs_resize_t resize; s64 new_size = 0; /* in clusters; 0 = --info w/o --size */ s64 device_size; /* in bytes */ @@ -2106,26 +2114,28 @@ int main(int argc, char **argv) exit(0); } - - memset(&resize, 0, sizeof(resize)); - resize.new_volume_size = new_size; + memset(&fsck, 0, sizeof(fsck)); + setup_lcn_bitmap(&fsck.lcn_bitmap); - setup_lcn_bitmap(&resize.lcn_bitmap); - - /* This is also true if --info was used w/o --size (new_size = 0) */ - if (new_size < vol->nr_clusters) - resize.shrink = 1; - - build_allocation_bitmap(&resize); - if (resize.multi_ref) { + build_allocation_bitmap(&fsck); + if (fsck.multi_ref) { err_printf("Filesystem check failed! Totally %d clusters " - "referenced multiply times.\n", resize.multi_ref); + "referenced multiply times.\n", fsck.multi_ref); printf(corrupt_volume_msg); exit(1); } - compare_bitmaps(&resize.lcn_bitmap); + compare_bitmaps(&fsck.lcn_bitmap); - print_disk_usage(&resize); + print_disk_usage(fsck.inuse); + + memset(&resize, 0, sizeof(resize)); + resize.new_volume_size = new_size; + resize.inuse = fsck.inuse; + resize.lcn_bitmap = fsck.lcn_bitmap; + + /* This is also true if --info was used w/o --size (new_size = 0) */ + if (new_size < vol->nr_clusters) + resize.shrink = 1; set_resize_constrains(&resize); set_disk_usage_constraint(&resize); From 1b6c7d679d12f8bbe100e76c5ac7d2b70d1cad64 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 17 Apr 2004 01:02:42 +0000 Subject: [PATCH 1383/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into a80-186-119-178.elisa-laajakaista.fi:/home/szaka/ntfs/bk/ntfsprogs 2004/04/17 04:01:47+03:00 elisa-laajakaista.fi!szaka ntfsresize: Detached ntfs_fsck_t from ntfs_resize_t and use it for check_allocation_bitmap() [in progress] BKrev: 408082327nIgMzQiTZNjVb2zleFMCg From 62a4991b9aeaecc3d02d9edbf28662c8a0f7d50f Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 20 Apr 2004 21:19:45 +0000 Subject: [PATCH 1384/2994] Renamed the last ntfstools reference to ntfsprogs (Logical change 1.378) --- ntfsprogs/ntfsprogs.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index 71831204..a70b0ea4 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -4,7 +4,7 @@ .\" .TH NTFSPROGS 8 "August 2003" "ntfsprogs version @VERSION@" .SH NAME -ntfstools \- several tools for doing neat things with NTFS partitions +ntfsprogs \- several tools for doing neat things with NTFS partitions .SH OVERVIEW .B ntfsprogs is a suite of NTFS utilities based around a shared library. The tools are From 54fd7ad8f5c24fc27208900877aa095789f063e8 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 20 Apr 2004 21:19:45 +0000 Subject: [PATCH 1385/2994] ntfsprogs.8.in: Renamed the last ntfstools reference to ntfsprogs BKrev: 408593f1AogxtKddQORMYbP1efSOyg From d990c89479e7ce41a154009e200ad727ec525a78 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 23 Apr 2004 10:12:49 +0000 Subject: [PATCH 1386/2994] - Make endian safe. (Anton) - Fix some compiler warnings. (Yuval) (Logical change 1.379) --- ntfsprogs/ntfsclone.c | 20 +++++++++-------- ntfsprogs/ntfsresize.c | 50 +++++++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 82a8246f..00516674 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -2,6 +2,7 @@ * ntfsclone - Part of the Linux-NTFS project. * * Copyright (c) 2003-2004 Szabolcs Szakacsits + * Copyright (c) 2004 Anton Altaparmakov * * Clone NTFS data and/or metadata to a sparse file, device or stdout. * @@ -526,10 +527,10 @@ static void wipe_resident_data(ntfs_walk_clusters_ctx *image) ATTR_RECORD *a; u32 i; int n = 0; - char *p; + u8 *p; a = image->ctx->attr; - p = (char *)a + a->value_offset; + p = (u8*)a + le16_to_cpu(a->value_offset); if (image->ni->mft_no <= LAST_METADATA_INODE) return; @@ -537,7 +538,7 @@ static void wipe_resident_data(ntfs_walk_clusters_ctx *image) if (a->type != AT_DATA) return; - for (i = 0; i < a->value_length; i++) { + for (i = 0; i < le32_to_cpu(a->value_length); i++) { if (p[i]) { p[i] = 0; n++; @@ -700,8 +701,9 @@ static void wipe_unused_mft_data(ntfs_inode *ni) if (ni->mft_no <= LAST_METADATA_INODE) return; - unused = m->bytes_allocated - m->bytes_in_use; - wiped_unused_mft_data += wipe_data((char *)m, m->bytes_in_use, unused); + unused = le32_to_cpu(m->bytes_allocated) - le32_to_cpu(m->bytes_in_use); + wiped_unused_mft_data += wipe_data((char *)m, + le32_to_cpu(m->bytes_in_use), unused); } static void wipe_unused_mft(ntfs_inode *ni) @@ -713,7 +715,7 @@ static void wipe_unused_mft(ntfs_inode *ni) if (ni->mft_no <= LAST_METADATA_INODE) return; - unused = m->bytes_in_use - sizeof(MFT_RECORD); + unused = le32_to_cpu(m->bytes_in_use) - sizeof(MFT_RECORD); wiped_unused_mft += wipe_data((char *)m, sizeof(MFT_RECORD), unused); } @@ -782,7 +784,7 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) if (wipe) nr_used_mft_records++; - if ((ni->mrec->base_mft_record) != 0) + if (ni->mrec->base_mft_record) goto out; walk->image->ni = ni; @@ -909,7 +911,8 @@ static void mount_volume(unsigned long new_mntflag) if (ntfs_version_is_supported(vol)) perr_exit("Unknown NTFS version"); - Printf("Cluster size : %u bytes\n", vol->cluster_size); + Printf("Cluster size : %u bytes\n", + (unsigned int)vol->cluster_size); print_volume_size("Current volume size", volume_size(vol, vol->nr_clusters)); } @@ -1125,4 +1128,3 @@ int main(int argc, char **argv) fsync_clone(fd_out); exit(0); } - diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 2717c062..90cf80a8 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2,7 +2,7 @@ * ntfsresize - Part of the Linux-NTFS project. * * Copyright (c) 2002-2004 Szabolcs Szakacsits - * Copyright (c) 2002-2003 Anton Altaparmakov + * Copyright (c) 2002-2004 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon * * This utility will resize an NTFS volume without data loss. @@ -304,7 +304,7 @@ static void version (void) { printf ("\nResize an NTFS Volume, without data loss.\n\n"); printf ("Copyright (c) 2002-2004 Szabolcs Szakacsits\n"); - printf ("Copyright (c) 2002-2003 Anton Altaparmakov\n"); + printf ("Copyright (c) 2002-2004 Anton Altaparmakov\n"); printf ("Copyright (c) 2002-2003 Richard Russon\n"); printf ("\n%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -593,7 +593,7 @@ static int has_bad_sectors(ntfs_resize_t *resize) return -1; if (ustr && ntfs_names_are_equal(ustr, len, - (uchar_t*)((char*)a + le16_to_cpu(a->name_offset)), + (uchar_t*)((u8*)a + le16_to_cpu(a->name_offset)), a->name_length, 0, NULL, 0)) ret = 1; @@ -710,8 +710,8 @@ static void collect_relocation_info(ntfs_resize_t *resize, runlist *rl) printf("Relocation needed for inode %8lld attr 0x%x LCN 0x%08llx " "length %6lld\n", (long long)inode, - resize->ctx->attr->type, (unsigned long long)start, - (long long)len); + (unsigned int)le32_to_cpu(resize->ctx->attr->type), + (unsigned long long)start, (long long)len); } /** @@ -758,7 +758,7 @@ static void build_lcn_usage_bitmap(ntfs_fsck_t *fsck) if (lcn < 0 || lcn_length <= 0) err_exit("Corrupt runlist in inode %lld attr %x LCN " "%llx length %llx\n", inode, - le32_to_cpu (a->type), lcn, lcn_length); + le32_to_cpu(a->type), lcn, lcn_length); for (j = 0; j < lcn_length; j++) { u64 k = (u64)lcn + j; @@ -933,7 +933,7 @@ static void build_allocation_bitmap(ntfs_fsck_t *fsck) perr_exit("Reading inode %lld failed", inode); } - if ((ni->mrec->base_mft_record) != 0) + if (ni->mrec->base_mft_record) goto close_inode; fsck->ni = ni; @@ -996,7 +996,7 @@ static void set_resize_constrains(ntfs_resize_t *resize) perr_exit("Reading inode %lld failed", inode); } - if ((ni->mrec->base_mft_record) != 0) + if (ni->mrec->base_mft_record) goto close_inode; resize->ni = ni; @@ -1069,28 +1069,33 @@ static void replace_attribute_runlist(ntfs_attr_search_ctx *ctx, runlist *rl) Vprintf("Old mp size : %d\n", l); Vprintf("New mp size : %d\n", mp_size); - Vprintf("Bytes in use : %d\n", ctx->mrec->bytes_in_use); + Vprintf("Bytes in use : %u\n", (unsigned int) + le32_to_cpu(ctx->mrec->bytes_in_use)); next_attr = (char *)a + le16_to_cpu(a->length); l = mp_size - l; - Vprintf("Bytes in use new : %d\n", ctx->mrec->bytes_in_use + l); - Vprintf("Bytes allocated : %d\n", ctx->mrec->bytes_allocated); + Vprintf("Bytes in use new : %u\n", l + (unsigned int) + le32_to_cpu(ctx->mrec->bytes_in_use)); + Vprintf("Bytes allocated : %u\n", (unsigned int) + le32_to_cpu(ctx->mrec->bytes_allocated)); - remains_size = ctx->mrec->bytes_in_use; + remains_size = le32_to_cpu(ctx->mrec->bytes_in_use); remains_size -= (next_attr - (char *)ctx->mrec); Vprintf("increase : %d\n", l); Vprintf("shift : %lld\n", (long long)remains_size); - if (ctx->mrec->bytes_in_use + l > ctx->mrec->bytes_allocated) + if (le32_to_cpu(ctx->mrec->bytes_in_use) + l > + le32_to_cpu(ctx->mrec->bytes_allocated)) err_exit("Extended record needed (%d > %d), not yet " "supported!\nPlease try to free less space.\n", - ctx->mrec->bytes_in_use + l, - ctx->mrec->bytes_allocated); + le32_to_cpu(ctx->mrec->bytes_in_use) + l, + le32_to_cpu(ctx->mrec->bytes_allocated)); memmove(next_attr + l, next_attr, remains_size); - ctx->mrec->bytes_in_use += l; + ctx->mrec->bytes_in_use = cpu_to_le32(l + + le32_to_cpu(ctx->mrec->bytes_in_use)); a->length += l; } @@ -1100,7 +1105,7 @@ static void replace_attribute_runlist(ntfs_attr_search_ctx *ctx, runlist *rl) if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl)) perr_exit("ntfs_mapping_pairs_build"); - memmove((char *)a + le16_to_cpu(a->mapping_pairs_offset), mp, mp_size); + memmove((u8*)a + le16_to_cpu(a->mapping_pairs_offset), mp, mp_size); free(mp); } @@ -1430,8 +1435,8 @@ static void relocate_run(ntfs_resize_t *resize, runlist **rl, int run) /* FIXME: check $MFTMirr DATA isn't multi-run (or support it) */ Vprintf("Relocate inode %7llu:0x%x:%08lld:0x%08llx --> 0x%08llx\n", (unsigned long long)resize->mref, - resize->ctx->attr->type, (long long)lcn_length, - (unsigned long long)lcn, + (unsigned int)le32_to_cpu(resize->ctx->attr->type), + (long long)lcn_length, (unsigned long long)lcn, (unsigned long long)relocate_rl->lcn); relocate_clusters(resize, relocate_rl, lcn); @@ -1864,8 +1869,8 @@ static void update_bootsector(ntfs_resize_t *r) if (vol->dev->d_ops->read(vol->dev, &bs, bs_size) == -1) perr_exit("read() error"); - bs.number_of_sectors = r->new_volume_size * bs.bpb.sectors_per_cluster; - bs.number_of_sectors = cpu_to_le64(bs.number_of_sectors); + bs.number_of_sectors = scpu_to_le64(r->new_volume_size * + bs.bpb.sectors_per_cluster); if (r->mftmir_old) { int save_progress = opt.show_progress; @@ -1982,7 +1987,8 @@ static void mount_volume(void) if (ntfs_version_is_supported(vol)) perr_exit("Unknown NTFS version"); - printf("Cluster size : %u bytes\n", vol->cluster_size); + printf("Cluster size : %u bytes\n", + (unsigned int)vol->cluster_size); print_vol_size("Current volume size", vol_size(vol, vol->nr_clusters)); } From 38cebf3309b1dcd1be515484725966afb063997a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 23 Apr 2004 10:12:49 +0000 Subject: [PATCH 1387/2994] - Make ntfsclone and ntfsresize endian safe. (Anton) - Fix some compiler warnings. (Yuval) BKrev: 4088ec2110GxrRbxWNWsgYKzC6qg7Q From f90c2cd5b9d26c240848108f0a7abbfda1d0c6d8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 23 Apr 2004 10:12:49 +0000 Subject: [PATCH 1388/2994] Fix some compiler warnings. (Yuval) (Logical change 1.379) --- ntfsprogs/ntfsdump_logfile.c | 31 +++++++++++++++++-------------- ntfsprogs/ntfswipe.c | 2 +- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 6c3869bd..e7238b79 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -390,10 +390,11 @@ rstr_pass_loc: (long long)sle64_to_cpu(rstr->chkdsk_lsn), (unsigned long long)sle64_to_cpu(rstr->chkdsk_lsn)); printf("system_page_size = %u (0x%x)\n", - le32_to_cpu(rstr->system_page_size), - le32_to_cpu(rstr->system_page_size)); - printf("log_page_size = %u (0x%x)\n", le32_to_cpu(rstr->log_page_size), - le32_to_cpu(rstr->log_page_size)); + (unsigned int)le32_to_cpu(rstr->system_page_size), + (unsigned int)le32_to_cpu(rstr->system_page_size)); + printf("log_page_size = %u (0x%x)\n", + (unsigned int)le32_to_cpu(rstr->log_page_size), + (unsigned int)le32_to_cpu(rstr->log_page_size)); printf("restart_offset = %u (0x%x)\n", le16_to_cpu(rstr->restart_offset), le16_to_cpu(rstr->restart_offset)); @@ -412,8 +413,8 @@ rstr_pass_loc: le16_to_cpu(ra->client_in_use_list)); printf("flags = 0x%.4x\n", le16_to_cpu(ra->flags)); printf("seq_number_bits = %u (0x%x)\n", - le32_to_cpu(ra->seq_number_bits), - le32_to_cpu(ra->seq_number_bits)); + (unsigned int)le32_to_cpu(ra->seq_number_bits), + (unsigned int)le32_to_cpu(ra->seq_number_bits)); printf("restart_area_length = %u (0x%x)\n", le16_to_cpu(ra->restart_area_length), le16_to_cpu(ra->restart_area_length)); @@ -424,8 +425,8 @@ rstr_pass_loc: (long long)sle64_to_cpu(ra->file_size), (unsigned long long)sle64_to_cpu(ra->file_size)); printf("last_lsn_data_length = %u (0x%x)\n", - le32_to_cpu(ra->last_lsn_data_length), - le32_to_cpu(ra->last_lsn_data_length)); + (unsigned int)le32_to_cpu(ra->last_lsn_data_length), + (unsigned int)le32_to_cpu(ra->last_lsn_data_length)); printf("record_length = %u (0x%x)\n", le16_to_cpu(ra->record_length), le16_to_cpu(ra->record_length)); printf("log_page_data_offset = %u (0x%x)\n", @@ -456,8 +457,8 @@ rstr_pass_loc: printf("seq_number = %u (0x%x)\n", le16_to_cpu(lcr->seq_number), le16_to_cpu(lcr->seq_number)); printf("client_name_length = %u (0x%x)\n", - le32_to_cpu(lcr->client_name_length) / 2, - le32_to_cpu(lcr->client_name_length) / 2); + (unsigned int)le32_to_cpu(lcr->client_name_length) / 2, + (unsigned int)le32_to_cpu(lcr->client_name_length) / 2); if (le32_to_cpu(lcr->client_name_length)) { client_name = NULL; if (ntfs_ucstombs(lcr->client_name, @@ -510,7 +511,7 @@ rcrd_pass_loc: // TODO: I am here... (AIA) printf("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd->copy.last_lsn)); - printf("flags = 0x%x\n", le32_to_cpu(rcrd->flags)); + printf("flags = 0x%x\n", (unsigned int)le32_to_cpu(rcrd->flags)); printf("page count = %i\n", le16_to_cpu(rcrd->page_count)); printf("page position = %i\n", le16_to_cpu(rcrd->page_position)); printf("header.next_record_offset = 0x%llx\n", (unsigned long long) @@ -532,13 +533,15 @@ log_record_pass: printf("client undo next lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(lr->client_undo_next_lsn)); printf("client data length = 0x%x\n", - le32_to_cpu(lr->client_data_length)); + (unsigned int)le32_to_cpu(lr->client_data_length)); printf("client_id.seq_number = 0x%x\n", le16_to_cpu(lr->client_id.seq_number)); printf("client_id.client_index = 0x%x\n", le16_to_cpu(lr->client_id.client_index)); - printf("record type = 0x%x\n", le32_to_cpu(lr->record_type)); - printf("transaction_id = 0x%x\n", le32_to_cpu(lr->transaction_id)); + printf("record type = 0x%x\n", + (unsigned int)le32_to_cpu(lr->record_type)); + printf("transaction_id = 0x%x\n", + (unsigned int)le32_to_cpu(lr->transaction_id)); printf("flags = 0x%x:", lr->flags); if (!lr->flags) printf(" NONE\n"); diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 1e94b9b0..90bb0479 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -768,7 +768,7 @@ int ntfs_info (ntfs_volume *vol) Qprintf ("\n"); - Qprintf ("Cluster size = %u\n", vol->cluster_size); + Qprintf ("Cluster size = %u\n", (unsigned int)vol->cluster_size); Qprintf ("Volume size = %lld clusters\n", (long long)vol->nr_clusters); Qprintf ("Volume size = %lld bytes\n", (long long)vol->nr_clusters * vol->cluster_size); From 4ab2a0a694c26f76a89cd0e84d035a22c12cf362 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 23 Apr 2004 10:12:49 +0000 Subject: [PATCH 1389/2994] Update (Logical change 1.379) --- ChangeLog | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 01e9a0cf..f20bd715 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ xx/xx/2004 - 1.9.2-WIP - Hopefully fix the autogen.sh problems using the --force and touch - config.h.in sledge hammers. + config.h.in sledge hammers. (Anton) - Fix the incorrect ntfsclone usage example in the man page. (Szaka) - Fix compiler warnings in win32_io.c. (Yuval) - Move constant bswap macros out of the ifdefs in endians.h so they are @@ -12,11 +12,12 @@ xx/xx/2004 - 1.9.2-WIP - Fix incorrect getopt_long() usage: converted argv[optind-1] to optarg so utilities won't do bogus and unexpected things. (Szaka) - Add new API security.[hc]::ntfs_sid_is_valid(), ntfs_sid_to_mbs(), - and ntfs_sid_to_mbs_size(). - - Big enhancement of ntfsinfo. (Yuval, me) + and ntfs_sid_to_mbs_size(). (Anton) + - Big enhancement of ntfsinfo. (Yuval, Anton) - Split mkntfs into multiple functions. (Yuval) - Compiler warning fixes in utilities related to GEN_PRINTF() and other - things. (Yuval) + things, mostly printf() related. (Yuval) + - Make ntfsclone and ntfsresize endiansafe. (Anton) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From 14449e4e00200235b921b42f126138b33c2afe4c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 23 Apr 2004 10:54:57 +0000 Subject: [PATCH 1390/2994] - Fix silly bug where j is used to store the error code but i is later expected to be storing it. (Yuval) - Fix some warnings. (Yuval, me) (Logical change 1.380) --- libntfs/security.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libntfs/security.c b/libntfs/security.c index 1db2ebd8..78fcae99 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -178,8 +178,7 @@ char *ntfs_sid_to_mbs(const SID *sid, char *sid_str, size_t sid_str_size) { u64 u; char *s; - size_t cnt; - int i, j; + int i, j, cnt; /* * No need to check @sid if !@sid_str since ntfs_sid_to_mbs_size() will @@ -222,13 +221,13 @@ char *ntfs_sid_to_mbs(const SID *sid, char *sid_str, size_t sid_str_size) s += i; cnt -= i; /* Finally, add the sub authorities. */ - for (i = 0; i < sid->sub_authority_count; i++) { - j = snprintf(s, cnt, "-%u", (unsigned int) - le32_to_cpu(sid->sub_authority[i])); - if (j < 0 || j >= cnt) + for (j = 0; j < sid->sub_authority_count; j++) { + i = snprintf(s, cnt, "-%u", (unsigned int) + le32_to_cpu(sid->sub_authority[j])); + if (i < 0 || i >= cnt) goto err_out; - s += j; - cnt -= j; + s += i; + cnt -= i; } return sid_str; err_out: From 1cc0d3146a06091d2edf1d98604521089eb3b112 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 23 Apr 2004 10:54:57 +0000 Subject: [PATCH 1391/2994] libntfs/security.c:: - Fix silly bug where j is used to store the error code but i is later expected to be storing it. (Yuval) - Fix some warnings. (Yuval, me) BKrev: 4088f601g-KiCcRTsoOr9TFHUkHc4g From 123b1028ecea619dd0f31d707d9f9036873dbe52 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 23 Apr 2004 13:55:49 +0000 Subject: [PATCH 1392/2994] Fix lots of warnings about no prototypes by adding the 'static' keyword. (Yuval) (Logical change 1.381) --- ntfsprogs/ntfscat.c | 10 +++++----- ntfsprogs/ntfscluster.c | 16 ++++++++------- ntfsprogs/ntfslabel.c | 12 +++++------ ntfsprogs/ntfsls.c | 8 ++++---- ntfsprogs/ntfsmove.c | 35 +++++++++++++++++--------------- ntfsprogs/ntfstruncate.c | 26 ++++++++++++------------ ntfsprogs/ntfsundelete.c | 43 ++++++++++++++++++++-------------------- ntfsprogs/ntfswipe.c | 24 +++++++++++----------- 8 files changed, 90 insertions(+), 84 deletions(-) diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 304ba129..c16c5907 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -43,7 +43,7 @@ static struct options opts; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) -GEN_PRINTF (Printf, stderr, NULL, FALSE) +static GEN_PRINTF (Printf, stderr, NULL, FALSE) /** * version - Print version information about the program @@ -52,7 +52,7 @@ GEN_PRINTF (Printf, stderr, NULL, FALSE) * * Return: none */ -void version (void) +static void version (void) { Printf ("\n%s v%s - Concatenate files and print on the standard output.\n\n", EXEC_NAME, VERSION); @@ -67,7 +67,7 @@ void version (void) * * Return: none */ -void usage (void) +static void usage (void) { Printf ("\nUsage: %s [options] device [file]\n\n" " -a, --attribute num Display this attribute\n" @@ -93,7 +93,7 @@ void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -int parse_options (int argc, char **argv) +static int parse_options (int argc, char **argv) { static const char *sopt = "-a:fh?i:qVv"; // F:N: static const struct option lopt[] = { @@ -210,7 +210,7 @@ int parse_options (int argc, char **argv) /** * cat */ -int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, uchar_t *name, int namelen) +static int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, uchar_t *name, int namelen) { /* increase 1024 only if you fix partial writes below */ const int bufsize = 1024; diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index bb6dbad6..777c142a 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -52,7 +52,7 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -void version (void) +static void version (void) { printf ("\n%s v%s - Find the owner of any given sector or cluster.\n\n", EXEC_NAME, VERSION); @@ -67,7 +67,7 @@ void version (void) * * Return: none */ -void usage (void) +static void usage (void) { printf ("\nUsage: %s [options] device\n" " -i --info Print information about the volume (default)\n" @@ -96,7 +96,7 @@ void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -int parse_options (int argc, char **argv) +static int parse_options (int argc, char **argv) { static const char *sopt = "-c:F:fh?I:ilqs:vV"; static const struct option lopt[] = { @@ -247,7 +247,7 @@ int parse_options (int argc, char **argv) /** * info */ -int info (ntfs_volume *vol) +static int info (ntfs_volume *vol) { u64 a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u; int cb, sb, cps; @@ -355,7 +355,7 @@ int info (ntfs_volume *vol) /** * dump_file */ -int dump_file (ntfs_volume *vol, ntfs_inode *ino) +static int dump_file (ntfs_volume *vol, ntfs_inode *ino) { u8 buffer[1024]; ntfs_attr_search_ctx *ctx; @@ -397,7 +397,8 @@ int dump_file (ntfs_volume *vol, ntfs_inode *ino) /** * print_match */ -int print_match (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void *data) +static int print_match (ntfs_inode *ino, ATTR_RECORD *attr, + runlist_element *run, void *data) { char *buffer; @@ -423,7 +424,8 @@ int print_match (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void /** * find_last */ -int find_last (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void *data) +static int find_last (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, + void *data) { struct match *m; diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 74597805..3ad49878 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -58,7 +58,7 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -void version (void) +static void version (void) { printf ("\n%s v%s - Display, or set, the label for an NTFS Volume.\n\n", EXEC_NAME, VERSION); @@ -76,7 +76,7 @@ void version (void) * * Return: none */ -void usage (void) +static void usage (void) { printf ("\nUsage: %s [options] device [label]\n" " -n --no-action Do not write to disk\n" @@ -98,7 +98,7 @@ void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -int parse_options (int argc, char *argv[]) +static int parse_options (int argc, char *argv[]) { static const char *sopt = "-fh?nqvV"; static const struct option lopt[] = { @@ -187,7 +187,7 @@ int parse_options (int argc, char *argv[]) * * Print the label of the device @dev to stdout. */ -int print_label (ntfs_volume *vol, unsigned long mnt_flags) +static int print_label (ntfs_volume *vol, unsigned long mnt_flags) { int result = 0; //XXX significant? @@ -211,7 +211,7 @@ int print_label (ntfs_volume *vol, unsigned long mnt_flags) * Return 0 on success and -1 with errno = ENOSPC if not enough space in the * mft record. */ -int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, +static int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, const u32 new_vsize) { int new_alen, new_muse; @@ -246,7 +246,7 @@ int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, * * Change the label on the device @dev to @label. */ -int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, BOOL force) +static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, BOOL force) { ntfs_attr_search_ctx *ctx = NULL; uchar_t *new_label = NULL; diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 00310f96..ac1734c0 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -65,7 +65,7 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -void version(void) +static void version(void) { printf("\n%s v%s - Display information about an NTFS Volume.\n\n", EXEC_NAME, VERSION); @@ -82,7 +82,7 @@ void version(void) * * Return: none */ -void usage(void) +static void usage(void) { printf("\nUsage: %s [options] -d /dev/hda1\n" "\n" @@ -113,7 +113,7 @@ void usage(void) * Return: 1 Success * 0 Error, one or more problems */ -int parse_options(int argc, char *argv[]) +static int parse_options(int argc, char *argv[]) { static const char *sopt = "-ad:Ffh?ilp:qsVvx"; static const struct option lopt[] = { @@ -226,7 +226,7 @@ typedef struct { * list_entry * FIXME: Should we print errors as we go along? (AIA) */ -int list_entry(ntfsls_dirent *dirent, const uchar_t *name, +static int list_entry(ntfsls_dirent *dirent, const uchar_t *name, const int name_len, const int name_type, const s64 pos, const MFT_REF mref, const unsigned dt_type) { diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index bcd44eeb..f1f600fe 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -57,7 +57,7 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -void version (void) +static void version (void) { printf ("\n%s v%s - Move files and directories on an NTFS volume.\n\n", EXEC_NAME, VERSION); @@ -72,7 +72,7 @@ void version (void) * * Return: none */ -void usage (void) +static void usage (void) { printf ("\nUsage: %s [options] device file\n" "\n" @@ -101,7 +101,7 @@ void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -int parse_options (int argc, char **argv) +static int parse_options (int argc, char **argv) { static const char *sopt = "-BC:DEfh?nqSVv"; static const struct option lopt[] = { @@ -233,7 +233,7 @@ int parse_options (int argc, char **argv) /** * ntfs_debug_runlist_dump2 - Dump a runlist. */ -int ntfs_debug_runlist_dump2 (const runlist *rl, int abbr, char *prefix) +static int ntfs_debug_runlist_dump2 (const runlist *rl, int abbr, char *prefix) { //int abbr = 3; /* abbreviate long lists */ int len = 0; @@ -291,7 +291,7 @@ int ntfs_debug_runlist_dump2 (const runlist *rl, int abbr, char *prefix) /** * resize_nonres_attr */ -int resize_nonres_attr (MFT_RECORD *m, ATTR_RECORD *a, const u32 new_size) +static int resize_nonres_attr (MFT_RECORD *m, ATTR_RECORD *a, const u32 new_size) { int this_attr; int next_attr; @@ -327,7 +327,7 @@ int resize_nonres_attr (MFT_RECORD *m, ATTR_RECORD *a, const u32 new_size) /** * calc_attr_length */ -int calc_attr_length (ATTR_RECORD *rec, int runlength) +static int calc_attr_length (ATTR_RECORD *rec, int runlength) { int size; @@ -344,7 +344,7 @@ int calc_attr_length (ATTR_RECORD *rec, int runlength) /** * dump_runs */ -void dump_runs (u8 *buffer, int len) +static void dump_runs (u8 *buffer, int len) { int i; printf ("RUN: "); @@ -358,7 +358,7 @@ void dump_runs (u8 *buffer, int len) /** * find_unused */ -runlist * find_unused (ntfs_volume *vol, s64 size, u64 loc, int flags) +static runlist * find_unused (ntfs_volume *vol, s64 size, u64 loc, int flags) { const int bufsize = 8192; u8 *buffer; @@ -439,7 +439,7 @@ done: * Any fragmented MFT records * The boot file 'ntldr' */ -int dont_move (ntfs_inode *ino) +static int dont_move (ntfs_inode *ino) { static const uchar_t ntldr[6] = { const_cpu_to_le16('n'), const_cpu_to_le16('t'), const_cpu_to_le16('l'), @@ -480,7 +480,7 @@ int dont_move (ntfs_inode *ino) /** * bitmap_alloc */ -int bitmap_alloc (ntfs_volume *vol, runlist_element *rl) +static int bitmap_alloc (ntfs_volume *vol, runlist_element *rl) { int res; @@ -498,7 +498,7 @@ int bitmap_alloc (ntfs_volume *vol, runlist_element *rl) /** * bitmap_free */ -int bitmap_free (ntfs_volume *vol, runlist_element *rl) +static int bitmap_free (ntfs_volume *vol, runlist_element *rl) { int res; @@ -516,7 +516,7 @@ int bitmap_free (ntfs_volume *vol, runlist_element *rl) /** * data_copy */ -int data_copy (ntfs_volume *vol, runlist_element *from, runlist_element *to) +static int data_copy (ntfs_volume *vol, runlist_element *from, runlist_element *to) { int i; u8 *buffer; @@ -567,7 +567,8 @@ int data_copy (ntfs_volume *vol, runlist_element *from, runlist_element *to) * copy data * deallocate old space */ -s64 move_runlist (ntfs_volume *vol, runlist_element *from, runlist_element *to) +static s64 move_runlist (ntfs_volume *vol, runlist_element *from, + runlist_element *to) { int i; @@ -632,7 +633,8 @@ s64 move_runlist (ntfs_volume *vol, runlist_element *from, runlist_element *to) // requires a mrec arg, not an ino (ino->mrec will do for now) // check size of new runlist before allocting / moving // replace one datarun with another (by hand) -s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, runlist_element *run, u64 loc, int flags) +static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, + runlist_element *run, u64 loc, int flags) { runlist *from; runlist *to; @@ -719,7 +721,8 @@ s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, runlist_e * = 0 Nothing to do * < 0 Error */ -s64 move_attribute (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, u64 loc, int flags) +static s64 move_attribute (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, + u64 loc, int flags) { int i; s64 res; @@ -763,7 +766,7 @@ s64 move_attribute (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, u64 loc * = 0 Nothing to do * < 0 Error */ -s64 move_file (ntfs_volume *vol, ntfs_inode *ino, u64 loc, int flags) +static s64 move_file (ntfs_volume *vol, ntfs_inode *ino, u64 loc, int flags) { char *buffer; ntfs_attr_search_ctx *ctx; diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index abb59e1a..8a048357 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -95,7 +95,7 @@ struct { /** * Dprintf - debugging output (-vv); overriden by quiet (-q) */ -void Dprintf(const char *fmt, ...) +static void Dprintf(const char *fmt, ...) { va_list ap; @@ -130,7 +130,7 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * err_exit - error output and terminate; ignores quiet (-q) */ -void err_exit(const char *fmt, ...) +static void err_exit(const char *fmt, ...) { va_list ap; @@ -145,7 +145,7 @@ void err_exit(const char *fmt, ...) /** * copyright - print copyright statements */ -void copyright(void) +static void copyright(void) { fprintf(stderr, "Copyright (c) 2002-2003 Anton Altaparmakov\n" "Copyright (c) 2003 Richard Russon\n" @@ -156,7 +156,7 @@ void copyright(void) /** * license - print licese statement */ -void license(void) +static void license(void) { fprintf(stderr, "%s", ntfs_gpl); } @@ -189,7 +189,7 @@ void usage (void) /** * parse_options */ -void parse_options(int argc, char *argv[]) +static void parse_options(int argc, char *argv[]) { long long ll; char *s, *s2; @@ -304,7 +304,7 @@ void parse_options(int argc, char *argv[]) * terminating null byte. If a unicode character was encountered which could * not be converted -1 is returned. */ -int ucstos(char *dest, const uchar_t *src, int maxlen) +static int ucstos(char *dest, const uchar_t *src, int maxlen) { uchar_t u; int i; @@ -326,7 +326,7 @@ int ucstos(char *dest, const uchar_t *src, int maxlen) /** * dump_resident_attr_val */ -void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) +static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) { const char *don_t_know = "Don't know what to do with this attribute " "type yet."; @@ -474,7 +474,7 @@ void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) /** * dump_resident_attr */ -void dump_resident_attr(ATTR_RECORD *a) +static void dump_resident_attr(ATTR_RECORD *a) { int i; @@ -497,7 +497,7 @@ void dump_resident_attr(ATTR_RECORD *a) /** * dump_mapping_pairs_array */ -void dump_mapping_pairs_array(char *b, unsigned int max_len) +static void dump_mapping_pairs_array(char *b, unsigned int max_len) { // TODO return; @@ -506,7 +506,7 @@ void dump_mapping_pairs_array(char *b, unsigned int max_len) /** * dump_non_resident_attr */ -void dump_non_resident_attr(ATTR_RECORD *a) +static void dump_non_resident_attr(ATTR_RECORD *a) { s64 l; int i; @@ -545,7 +545,7 @@ void dump_non_resident_attr(ATTR_RECORD *a) /** * dump_attr_record */ -void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) +static void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) { unsigned int u; char s[0x200]; @@ -642,7 +642,7 @@ void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) /** * dump_mft_record */ -void dump_mft_record(MFT_RECORD *m) +static void dump_mft_record(MFT_RECORD *m) { ATTR_RECORD *a; unsigned int u; @@ -695,7 +695,7 @@ void dump_mft_record(MFT_RECORD *m) /** * ntfstruncate_exit */ -void ntfstruncate_exit(void) +static void ntfstruncate_exit(void) { int err; diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index c9a565b0..ef37d08b 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -72,7 +72,7 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -void version (void) +static void version (void) { printf ("\n%s v%s - Recover deleted files from an NTFS Volume.\n\n", EXEC_NAME, VERSION); @@ -88,7 +88,7 @@ void version (void) * * Return: none */ -void usage (void) +static void usage (void) { printf ("\nUsage: %s [options] device\n" " -s --scan Scan for files (default)\n" @@ -135,7 +135,7 @@ void usage (void) * Return: 1, Success, the string was transformed * 0, An error occurred */ -int transform (const char *pattern, char **regex) +static int transform (const char *pattern, char **regex) { char *result; int length, i, j; @@ -210,7 +210,7 @@ int transform (const char *pattern, char **regex) * Return: 1 Success * 0 Error, the string was malformed */ -int parse_time (const char *value, time_t *since) +static int parse_time (const char *value, time_t *since) { time_t result, now; char *suffix = NULL; @@ -266,7 +266,7 @@ int parse_time (const char *value, time_t *since) * Return: 1 Success * 0 Error, one or more problems */ -int parse_options (int argc, char *argv[]) +static int parse_options (int argc, char *argv[]) { static const char *sopt = "-b:Cc:d:fh?m:o:p:sS:t:u:qvV"; static const struct option lopt[] = { @@ -515,7 +515,7 @@ int parse_options (int argc, char *argv[]) * * Return: none */ -void free_file (struct ufile *file) +static void free_file (struct ufile *file) { struct list_head *item, *tmp; @@ -563,7 +563,7 @@ void free_file (struct ufile *file) * Return: n The number of $FILENAME attributes found * -1 Error */ -int get_filenames (struct ufile *file) +static int get_filenames (struct ufile *file) { ATTR_RECORD *rec; FILE_NAME_ATTR *attr; @@ -639,7 +639,7 @@ int get_filenames (struct ufile *file) * Return: n The number of $FILENAME attributes found * -1 Error */ -int get_data (struct ufile *file, ntfs_volume *vol) +static int get_data (struct ufile *file, ntfs_volume *vol) { ATTR_RECORD *rec; ntfs_attr_search_ctx *ctx; @@ -713,7 +713,7 @@ int get_data (struct ufile *file, ntfs_volume *vol) * Return: Pointer A ufile object containing the results * NULL Error */ -struct ufile * read_record (ntfs_volume *vol, long long record) +static struct ufile * read_record (ntfs_volume *vol, long long record) { ATTR_RECORD *attr10, *attr20, *attr90; struct ufile *file; @@ -807,7 +807,7 @@ struct ufile * read_record (ntfs_volume *vol, long long record) * Return: n The percentage of the file that _could_ be recovered * -1 Error */ -int calc_percentage (struct ufile *file, ntfs_volume *vol) +static int calc_percentage (struct ufile *file, ntfs_volume *vol) { runlist_element *rl = NULL; struct list_head *pos; @@ -924,7 +924,7 @@ int calc_percentage (struct ufile *file, ntfs_volume *vol) * * Return: none */ -void dump_record (struct ufile *file) +static void dump_record (struct ufile *file) { char buffer[20]; char *name; @@ -1035,7 +1035,7 @@ void dump_record (struct ufile *file) * * Return: none */ -void list_record (struct ufile *file) +static void list_record (struct ufile *file) { char buffer[20]; struct list_head *item; @@ -1092,7 +1092,7 @@ void list_record (struct ufile *file) * Return: 1 There is a matching filename. * 0 There is no match. */ -int name_match (regex_t *re, struct ufile *file) +static int name_match (regex_t *re, struct ufile *file) { struct list_head *item; int result; @@ -1130,7 +1130,8 @@ int name_match (regex_t *re, struct ufile *file) * Return: -1 Error, something went wrong * 0 Success, all the data was written */ -unsigned int write_data (int fd, const char *buffer, unsigned int bufsize) +static unsigned int write_data (int fd, const char *buffer, + unsigned int bufsize) { ssize_t result1, result2; @@ -1177,8 +1178,8 @@ unsigned int write_data (int fd, const char *buffer, unsigned int bufsize) * * Return: n Length of the allocated name */ -int create_pathname (const char *dir, const char *name, const char *stream, - char *buffer, int bufsize) +static int create_pathname (const char *dir, const char *name, + const char *stream, char *buffer, int bufsize) { if (!name) name = UNKNOWN; @@ -1208,7 +1209,7 @@ int create_pathname (const char *dir, const char *name, const char *stream, * Return: -1 Error, failed to create the file * n Success, this is the file descriptor */ -int open_file (const char *pathname) +static int open_file (const char *pathname) { int flags; @@ -1232,7 +1233,7 @@ int open_file (const char *pathname) * Return: 1 Success, set the file's date and time * 0 Error, failed to change the file's date and time */ -int set_date (const char *pathname, time_t date) +static int set_date (const char *pathname, time_t date) { struct utimbuf ut; @@ -1260,7 +1261,7 @@ int set_date (const char *pathname, time_t date) * Return: -1 Error, something went wrong * n Success, the number of recoverable files */ -int scan_disk (ntfs_volume *vol) +static int scan_disk (ntfs_volume *vol) { const int BUFSIZE = 8192; char *buffer = NULL; @@ -1383,7 +1384,7 @@ out: * Return: 0 Error, something went wrong * 1 Success, the data was recovered */ -int undelete_file (ntfs_volume *vol, long long inode) +static int undelete_file (ntfs_volume *vol, long long inode) { char pathname[256]; char *buffer = NULL; @@ -1586,7 +1587,7 @@ free: * Return: 0 Success, all the records were written * 1 Error, something went wrong */ -int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) +static int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) { char pathname[256]; ntfs_attr *mft; diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 90bb0479..7df7d5a7 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -51,7 +51,7 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -void version (void) +static void version (void) { printf ("\n%s v%s - Overwrite the unused space on an NTFS Volume.\n\n", EXEC_NAME, VERSION); @@ -66,7 +66,7 @@ void version (void) * * Return: none */ -void usage (void) +static void usage (void) { printf ("\nUsage: %s [options] device\n" " -i --info Show volume information (default)\n" @@ -107,7 +107,7 @@ void usage (void) * Return: 0 Error, invalid string * n Success, the count of numbers parsed */ -int parse_list (char *list, int **result) +static int parse_list (char *list, int **result) { char *ptr; char *end; @@ -167,7 +167,7 @@ int parse_list (char *list, int **result) * Return: 1 Success * 0 Error, one or more problems */ -int parse_options (int argc, char *argv[]) +static int parse_options (int argc, char *argv[]) { static char *sopt = "-ab:c:dfh?ilmnpqtuvV"; static struct option lopt[] = { @@ -350,7 +350,7 @@ int parse_options (int argc, char *argv[]) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -s64 wipe_unused (ntfs_volume *vol, int byte, enum action act) +static s64 wipe_unused (ntfs_volume *vol, int byte, enum action act) { s64 i; s64 total = 0; @@ -404,7 +404,7 @@ free: * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) +static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) { if (!vol || (byte < 0)) return -1; @@ -424,7 +424,7 @@ s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) +static s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) { // by considering the individual attributes we might be able to // wipe a few more bytes at the attr's tail. @@ -554,7 +554,7 @@ free: * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) +static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) { if (!vol || (byte < 0)) return -1; @@ -574,7 +574,7 @@ s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act) +static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act) { const int NTFS_BUF_SIZE2 = 8192; //FIXME(?): We might need to zero the LSN field of every single mft @@ -675,7 +675,7 @@ error_exit: * Return: 1 Success, the clusters were wiped * 0 Error, something went wrong */ -s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act) +static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act) { // wipe completely, chkdsk doesn't do anything, booting writes header const int NTFS_BUF_SIZE2 = 4096; @@ -757,7 +757,7 @@ error_exit: * Return: 1 Success, displayed some info * 0 Error, something went wrong */ -int ntfs_info (ntfs_volume *vol) +static int ntfs_info (ntfs_volume *vol) { u8 *buffer; @@ -933,7 +933,7 @@ bmpdone: * * Return: none */ -void print_summary (void) +static void print_summary (void) { int i; From 82d7cbd7b2d758cd0ec26507170e120af86d95f6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 23 Apr 2004 13:55:49 +0000 Subject: [PATCH 1393/2994] Fix lots of warnings about no prototypes by adding the 'static' keyword. (Yuval) BKrev: 40892065jZ32rETJZyE3l8gnVveYJA From 1e637d370977350e9fa3536a86c192e386cb7461 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 23 Apr 2004 14:27:09 +0000 Subject: [PATCH 1394/2994] Remove global rl as it was used only in one place. (Yuval, Anton) (Logical change 1.382) --- ntfsprogs/mkntfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 315fea83..17db6f67 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -152,7 +152,7 @@ int mft_bitmap_size, mft_bitmap_byte_size; unsigned char *mft_bitmap = NULL; int lcn_bitmap_byte_size; unsigned char *lcn_bitmap = NULL; -runlist *rl = NULL, *rl_mft = NULL, *rl_mft_bmp = NULL, *rl_mftmirr = NULL; +runlist *rl_mft = NULL, *rl_mft_bmp = NULL, *rl_mftmirr = NULL; runlist *rl_logfile = NULL, *rl_boot = NULL, *rl_bad = NULL, *rl_index; INDEX_ALLOCATION *index_block = NULL; ntfs_volume *vol; @@ -2503,8 +2503,6 @@ static void mkntfs_exit(void) free(lcn_bitmap); if (mft_bitmap) free(mft_bitmap); - if (rl) - free(rl); if (rl_mft) free(rl_mft); if (rl_mft_bmp) @@ -3714,14 +3712,16 @@ int main(int argc, char **argv) } a = ctx->attr; if (a->non_resident) { - rl = ntfs_mapping_pairs_decompress(vol, a, NULL); + runlist *rl = ntfs_mapping_pairs_decompress(vol, a, NULL); ntfs_attr_put_search_ctx(ctx); if (!rl) err_exit("ntfs_mapping_pairs_decompress() failed\n"); lw = ntfs_rlwrite(vol->dev, rl, lcn_bitmap, lcn_bitmap_byte_size, NULL); + err = errno; + free(rl); if (lw != lcn_bitmap_byte_size) - err_exit("%s\n", lw == -1 ? strerror(errno) : + err_exit("%s\n", lw == -1 ? strerror(err) : "unknown error"); } else { memcpy((char*)a + le16_to_cpu(a->value_offset), lcn_bitmap, From 75b4efb807ef98bc6faa5c1bcd082e721d68ef31 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 23 Apr 2004 14:27:09 +0000 Subject: [PATCH 1395/2994] Remove global rl as it was used only in one place. (Yuval, Anton) BKrev: 408927bdPoZ_d1bJ1owjOEOKOPpfZA From b3cf7689901648c5b1f023a4aafe8e9de3c35d31 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 23 Apr 2004 14:27:09 +0000 Subject: [PATCH 1396/2994] Update. (Logical change 1.382) --- ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f20bd715..1124d7e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,8 +16,10 @@ xx/xx/2004 - 1.9.2-WIP - Big enhancement of ntfsinfo. (Yuval, Anton) - Split mkntfs into multiple functions. (Yuval) - Compiler warning fixes in utilities related to GEN_PRINTF() and other - things, mostly printf() related. (Yuval) + things, e.g. printf() and static related. (Yuval) - Make ntfsclone and ntfsresize endiansafe. (Anton) + - Remove global variable rl from mkntfs as it was used only in one + place. (Yuval, Anton) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From 411835bca3c23c0b2f110c6e82737c0feb06c159 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 24 Apr 2004 20:24:28 +0000 Subject: [PATCH 1397/2994] Fix warnings by renaming some variables. (Yuval) (Logical change 1.383) --- ntfsprogs/ntfsundelete.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index ef37d08b..27384500 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -814,7 +814,7 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) struct data *data; long long i, j; long long start, end; - int inuse, free; + int clusters_inuse, clusters_free; int percent = 0; if (!file || !vol) @@ -832,8 +832,8 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) list_for_each (pos, &file->data) { data = list_entry (pos, struct data, list); - inuse = 0; - free = 0; + clusters_inuse = 0; + clusters_free = 0; if (data->encrypted) { Vprintf ("File is encrypted, recovery is impossible.\n"); @@ -866,7 +866,7 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ Vprintf ("Missing segment at beginning, %lld " "clusters\n", (long long)rl[0].length); - inuse += rl[0].length; + clusters_inuse += rl[0].length; rl++; } @@ -875,12 +875,12 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) Vprintf ("Missing segment at end, %lld " "clusters\n", (long long)rl[i].length); - inuse += rl[i].length; + clusters_inuse += rl[i].length; continue; } if (rl[i].lcn == LCN_HOLE) { - free += rl[i].length; + clusters_free += rl[i].length; continue; } @@ -889,18 +889,19 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) for (j = start; j < end; j++) { if (utils_cluster_in_use (vol, j)) - inuse++; + clusters_inuse++; else - free++; + clusters_free++; } } - - if ((inuse + free) == 0) { + + if ((clusters_inuse + clusters_free) == 0) { Eprintf ("Unexpected error whilst calculating percentage for inode %lld\n", file->inode); continue; } - data->percent = (free * 100) / (inuse + free); + data->percent = (clusters_free * 100) / + (clusters_inuse + clusters_free); percent = max (percent, data->percent); } @@ -1268,7 +1269,6 @@ static int scan_disk (ntfs_volume *vol) int results = 0; ntfs_attr *attr; long long size; - long long read; long long bmpsize; int i, j, k, b; int percent; @@ -1306,8 +1306,8 @@ static int scan_disk (ntfs_volume *vol) Qprintf ("Inode Flags %%age Date Size Filename\n"); Qprintf ("---------------------------------------------------------------\n"); for (i = 0; i < bmpsize; i += BUFSIZE) { - read = min ((bmpsize - i), BUFSIZE); - size = ntfs_attr_pread (attr, i, read, buffer); + long long read_count = min ((bmpsize - i), BUFSIZE); + size = ntfs_attr_pread (attr, i, read_count, buffer); if (size < 0) break; From cd4f9980d51b2878aa4d08f13b69a1b75ae63a23 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 24 Apr 2004 20:24:28 +0000 Subject: [PATCH 1398/2994] ntfsundelete.c: Fix warnings by renaming some variables. (Yuval) BKrev: 408accfcGEjiouL-pbBaHsodx5W-zg From 9de9d6bdf1ea9a896446b6dcd70cdd31fb80206e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 27 Apr 2004 12:48:14 +0000 Subject: [PATCH 1399/2994] Update (Logical change 1.384) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1124d7e2..f50456f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,8 @@ xx/xx/2004 - 1.9.2-WIP - Make ntfsclone and ntfsresize endiansafe. (Anton) - Remove global variable rl from mkntfs as it was used only in one place. (Yuval, Anton) + - Work around mbstowcs() bug in DJGPP and update workaround for bug in + mbsrtowcs() on Cygwin. (Lode, Christophe, Anton) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From 03a99a7ecec0bae1fb49b06dfb0456e535332e63 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 27 Apr 2004 12:48:14 +0000 Subject: [PATCH 1400/2994] Work around mbstowcs() bug in DJGPP and update workaround for bug in mbsrtowcs() on Cygwin. (Lode, Christophe, Anton) (Logical change 1.384) --- libntfs/unistr.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/libntfs/unistr.c b/libntfs/unistr.c index fcfcc4f8..cfb78f24 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -451,16 +451,20 @@ int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len) } /* Determine the length of the multi-byte string. */ s = ins; -#ifdef HAVE_MBSINIT +#if defined(HAVE_MBSINIT) memset(&mbstate, 0, sizeof(mbstate)); ins_len = mbsrtowcs(NULL, (const char **)&s, 0, &mbstate); -#else - ins_len = mbstowcs(NULL, s, 0); -#endif #ifdef __CYGWIN32__ - /* Eeek!!! Cygwin has broken mbstowcs() implementation!!! */ - if (!ins_len) + if (!ins_len && *ins) { + /* Older Cygwin had broken mbsrtowcs() implementation. */ ins_len = strlen(ins); + } +#endif +#elif !defined(DJGPP) + ins_len = mbstowcs(NULL, s, 0); +#else + /* Eeek!!! DJGPP has broken mbstowcs() implementation!!! */ + ins_len = strlen(ins); #endif if (ins_len == -1) return ins_len; @@ -550,4 +554,3 @@ err_out: } return -1; } - From 301a541ffc1842ed9966147819c4f4f861013855 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 27 Apr 2004 12:48:14 +0000 Subject: [PATCH 1401/2994] Work around mbstowcs() bug in DJGPP and update workaround for bug in mbsrtowcs() on Cygwin. (Lode, Christophe, Anton) BKrev: 408e568evEe4T1xjSmokvu-9Z0X-Tg From cc4526d757275a00060e9765ca03a6280c7920b8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 28 Apr 2004 08:06:17 +0000 Subject: [PATCH 1402/2994] Add SetFilePointerEx() emulation to win32_io.c. (Lode) BKrev: 408f65f9pKdstEq-2epH-_isfXv2FQ From 653cfec1cab947a311a9d1e3a7b0abda21fb0c6e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 28 Apr 2004 08:06:17 +0000 Subject: [PATCH 1403/2994] Add SetFilePointerEx() emulation. (Lode) (Logical change 1.385) --- libntfs/win32_io.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 0edb511f..4d09a76a 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -74,8 +74,8 @@ static __inline__ void Dprintf(const char *fmt, ...) {} #define perror(msg) win32_perror(__FILE__,__LINE__,__FUNCTION__,msg) -int win32_perror(const char *file, int line, const char *func, const char *msg); -int win32_perror(const char *file, int line, const char *func, const char *msg) +static int win32_perror(const char *file, int line, const char *func, + const char *msg) { char buffer[1024] = ""; DWORD err = GetLastError(); @@ -87,6 +87,24 @@ int win32_perror(const char *file, int line, const char *func, const char *msg) return 0; } +#ifdef EMULATE_SETFILEPOINTEREX +static BOOL WINAPI SetFilePointerEx(HANDLE hFile, + LARGE_INTEGER liDistanceToMove, + PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod) +{ + liDistanceToMove.LowPart = SetFilePointer(hFile, + liDistanceToMove.LowPart, &liDistanceToMove.HighPart, + dwMoveMethod); + if (liDistanceToMove.LowPart == INVALID_SET_FILE_POINTER && + GetLastError() != NO_ERROR) { + lpNewFilePointer->QuadPart = -1; + return FALSE; + } + lpNewFilePointer->QuadPart = liDistanceToMove.QuadPart; + return TRUE; +} +#endif + /** * ntfs_device_win32_open - open a device * @dev: ntfs device to open @@ -370,16 +388,14 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) return 0; } -s64 win32_bias(struct ntfs_device *dev); -s64 win32_bias(struct ntfs_device *dev) +static s64 win32_bias(struct ntfs_device *dev) { struct win32_fd *fd = (win32_fd *)dev->d_private; return fd->part_start.QuadPart; } -s64 win32_filepos(struct ntfs_device *dev); -s64 win32_filepos(struct ntfs_device *dev) +static s64 win32_filepos(struct ntfs_device *dev) { struct win32_fd *fd = (win32_fd *)dev->d_private; @@ -440,4 +456,3 @@ struct ntfs_device_operations ntfs_device_win32_io_ops = { .stat = ntfs_device_win32_stat, .ioctl = ntfs_device_win32_ioctl }; - From 159d3a1a7450cea3c78f21245cca38819a6a3525 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 28 Apr 2004 08:06:17 +0000 Subject: [PATCH 1404/2994] Update (Logical change 1.385) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index f50456f3..2489ba0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ xx/xx/2004 - 1.9.2-WIP place. (Yuval, Anton) - Work around mbstowcs() bug in DJGPP and update workaround for bug in mbsrtowcs() on Cygwin. (Lode, Christophe, Anton) + - Add SetFilePointerEx() emulation to win32_io.c. (Lode) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From eb6c56168375c45be74a803ba26ef43986f3b5e5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 2 May 2004 08:46:37 +0000 Subject: [PATCH 1405/2994] Add inode selection by path/filename to ntfsinfo. (Yuval) (Logical change 1.386) --- ntfsprogs/ntfsinfo.c | 58 +++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 4db00d55..9c81294a 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -23,16 +23,15 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* TODO LIST: - * 1. Better error checking. (focus on ntfs_dump_volume) - * 2. Comment things better. - * 3. More things at verbose mode. - * 4. Dump ACLs when security_id exists (NTFS 3+ only). - * 5. Dump by name rather by Inode . - * 6. Clean ups. - * 7. Internationalization. - * 8. The AT_ATTRIBUTE_LIST issue. - * 9. Add more Indexed Attr Types. - * 10.Make formatting look more like www.flatcap.org/ntfs/info + * - Better error checking. (focus on ntfs_dump_volume) + * - Comment things better. + * - More things at verbose mode. + * - Dump ACLs when security_id exists (NTFS 3+ only). + * - Clean ups. + * - Internationalization. + * - The AT_ATTRIBUTE_LIST issue. + * - Add more Indexed Attr Types. + * - Make formatting look more like www.flatcap.org/ntfs/info * * Still not dumping certain attributes. Need to find the best * way to output some of these attributes. @@ -77,6 +76,7 @@ static struct options { int force; /* Override common sense */ int notime; /* Don't report timestamps at all */ int mft; /* Dump information about the volume as well */ + const char *filename; } opts; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) @@ -114,6 +114,7 @@ static void usage (void) printf ("\nUsage: %s [options] -d dev\n" " -d dev --device dev The ntfs volume to display information about\n" " -i num --inode num Display information about this inode\n" + " -F file --file file Display information about this file (absolute path)\n" " -m --mft Dump information about the volume\n" " -t --notime Don't report timestamps\n" "\n" @@ -137,12 +138,13 @@ static void usage (void) */ static int parse_options (int argc, char *argv[]) { - static const char *sopt = "-fh?i:mqtTvVd:"; + static const char *sopt = "-fh?i:F:mqtTvVd:"; static const struct option lopt[] = { { "device", required_argument, NULL, 'd' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "inode", required_argument, NULL, 'i' }, + { "file", required_argument, NULL, 'F' }, { "quiet", no_argument, NULL, 'q' }, { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' }, @@ -159,6 +161,7 @@ static int parse_options (int argc, char *argv[]) opterr = 0; /* We'll handle the errors, thank you. */ opts.inode = -1; + opts.filename = NULL; while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { @@ -174,6 +177,15 @@ static int parse_options (int argc, char *argv[]) err++; } break; + case 'F': + if (opts.filename == NULL) { + /* The inode can not be resolved here, store the filename */ + opts.filename = argv[optind-1]; + } else { + /* "-F" can't appear more than once */ + err++; + } + break; case 'f': opts.force++; break; @@ -221,7 +233,7 @@ static int parse_options (int argc, char *argv[]) err++; } - if (opts.inode == -1 && !opts.mft) { + if ((opts.inode == -1) && (opts.filename == NULL) && !opts.mft) { if (argc > 1) Eprintf ("You must specify an inode to learn about.\n"); err++; @@ -231,6 +243,13 @@ static int parse_options (int argc, char *argv[]) Eprintf ("You may not use --quiet and --verbose at the same time.\n"); err++; } + + if ((opts.inode != -1) && (opts.filename != NULL)) { + if (argc > 1) + Eprintf ("You may not specify --inode and --file together.\n"); + err++; + } + } if (ver) @@ -1118,20 +1137,25 @@ int main(int argc, char **argv) if (opts.mft) ntfs_dump_volume(vol); - if (opts.inode != -1) { + if ((opts.inode != -1) || opts.filename) { ntfs_inode *inode; /* obtain the inode */ - inode = ntfs_inode_open(vol, MK_LE_MREF(opts.inode, 0)); + if (opts.filename) { + inode = utils_pathname_to_inode (vol, NULL, opts.filename); + } else { + inode = ntfs_inode_open(vol, MK_LE_MREF(opts.inode, 0)); + } + /* dump the inode information */ if (inode) { - /* general info */ + /* general info about the inode's mft record */ ntfs_dump_inode_general_info(inode); /* dump attributes */ ntfs_dump_file_attributes(inode); } else { /* can't open inode */ - /* note: when the specified inode does not exist, EIO is returned - * is there a way to give the correct response instead? */ + /* note: when the specified inode does not exist, either EIO or + * or ESPIPE is returned, we should notify better in those cases */ fprintf(stderr, "Error loading node: %s\n", strerror(errno)); } } From 10c16778094708c4dd1175a7412d0aa0976a47c6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 2 May 2004 08:46:37 +0000 Subject: [PATCH 1406/2994] Add inode selection by path/filename to ntfsinfo. (Yuval) BKrev: 4094b56d2tX48ocjmzBlFHtJ0aRnpw From f44bad1d4b299182e583e896b6c246ec84365597 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 2 May 2004 08:46:37 +0000 Subject: [PATCH 1407/2994] Update (Logical change 1.386) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 2489ba0d..388d2f51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ xx/xx/2004 - 1.9.2-WIP - Work around mbstowcs() bug in DJGPP and update workaround for bug in mbsrtowcs() on Cygwin. (Lode, Christophe, Anton) - Add SetFilePointerEx() emulation to win32_io.c. (Lode) + - Add inode selection by path/filename to ntfsinfo. (Yuval) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From 0d541c679151cceb1a94fcfc883d931268bbeaad Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 8 May 2004 23:25:46 +0000 Subject: [PATCH 1408/2994] prepare truncate_badclust_file() for global variables elimination (Logical change 1.387) --- ntfsprogs/ntfsresize.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 90cf80a8..4a1bc48d 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1606,10 +1606,11 @@ static void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) * FIXME: this function should go away and instead using a generalized * "truncate_bitmap_data_attr()" */ -static void truncate_badclust_bad_attr(ntfs_attr_search_ctx *ctx, s64 nr_clusters) +static void truncate_badclust_bad_attr(ntfs_resize_t *resize) { runlist *rl_bad; - ATTR_RECORD *a = ctx->attr; + ATTR_RECORD *a = resize->ctx->attr; + s64 nr_clusters = resize->new_volume_size; if (!a->non_resident) /* FIXME: handle resident attribute value */ @@ -1625,7 +1626,7 @@ static void truncate_badclust_bad_attr(ntfs_attr_search_ctx *ctx, s64 nr_cluster rl_set(rl_bad, 0LL, (LCN)LCN_HOLE, nr_clusters); rl_set(rl_bad + 1, nr_clusters, -1LL, 0LL); - replace_attribute_runlist(ctx, rl_bad); + replace_attribute_runlist(resize->ctx, rl_bad); free(rl_bad); } @@ -1799,20 +1800,18 @@ static void lookup_data_attr(MFT_REF mref, const char *aname, ntfs_attr_search_c * * Shrink the $BadClus file to match the new volume size. */ -static void truncate_badclust_file(s64 nr_clusters) +static void truncate_badclust_file(ntfs_resize_t *resize) { - ntfs_attr_search_ctx *ctx = NULL; - printf("Updating $BadClust file ...\n"); - lookup_data_attr((MFT_REF)FILE_BadClus, "$Bad", &ctx); + lookup_data_attr((MFT_REF)FILE_BadClus, "$Bad", &resize->ctx); /* FIXME: sanity_check_attr(ctx->attr); */ - truncate_badclust_bad_attr(ctx, nr_clusters); + truncate_badclust_bad_attr(resize); - if (write_mft_record(ctx->ntfs_ino->mft_no, ctx->mrec)) + if (write_mft_record(resize->ctx->ntfs_ino->mft_no,resize->ctx->mrec)) perr_exit("Couldn't update $BadClust"); - ntfs_attr_put_search_ctx(ctx); + ntfs_attr_put_search_ctx(resize->ctx); } /** @@ -2163,7 +2162,7 @@ int main(int argc, char **argv) if (resize.relocations) relocate_inodes(&resize); - truncate_badclust_file(new_size); + truncate_badclust_file(&resize); truncate_bitmap_file(&resize); update_bootsector(&resize); From bc92ae57e8e4f6c55aff143433352ca4de0d7fbd Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 8 May 2004 23:25:46 +0000 Subject: [PATCH 1409/2994] prepare truncate_badclust_file() for global variables elimination BKrev: 409d6c7aNA96eKy22m5q3_oD85pgsQ From 6e0b4d5d32693d84daaeeedcceca0b5df937699a Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 8 May 2004 23:29:54 +0000 Subject: [PATCH 1410/2994] remove not-used-anymore last_unsafe member from ntfs_resize_t (Logical change 1.388) --- ntfsprogs/ntfsresize.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 4a1bc48d..9aa144ee 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -136,7 +136,6 @@ typedef struct { struct llcn_t last_sparse; struct llcn_t last_compressed; struct llcn_t last_lcn; - s64 last_unsafe; /* last "unsafe-to-move" cluster */ s64 last_unsupp; /* last unsupported cluster */ } ntfs_resize_t; @@ -661,9 +660,6 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) llcn->inode = inode; } - if (resize->last_unsafe < last_lcn) - resize->last_unsafe = last_lcn; - if (supported) return; From 771f8fdc3b2b6a11133912c9ea89dc5ce56bc54a Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 8 May 2004 23:29:54 +0000 Subject: [PATCH 1411/2994] remove not-used-anymore last_unsafe member from ntfs_resize_t BKrev: 409d6d72e47fpMOIjLwcPmLkr61ULA From aadb68f43e5f2293e1c8ec6189d34121c3c087a5 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sun, 9 May 2004 01:43:45 +0000 Subject: [PATCH 1412/2994] eliminated the global ntfs_volume variable (Logical change 1.389) --- ntfsprogs/ntfsresize.c | 142 +++++++++++++++++++++++------------------ 1 file changed, 79 insertions(+), 63 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 9aa144ee..335292c0 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -116,6 +116,7 @@ typedef struct { } ntfs_fsck_t; typedef struct { + ntfs_volume *vol; s64 new_volume_size; /* in clusters; 0 = --info w/o --size */ int shrink; /* shrink = 1, enlarge = 0 */ ntfs_inode *ni; /* inode being processed */ @@ -139,10 +140,6 @@ typedef struct { s64 last_unsupp; /* last unsupported cluster */ } ntfs_resize_t; - -/* FIXME: This will go to ntfs_resize_t */ -ntfs_volume *vol = NULL; - /* FIXME: This, lcn_bitmap and pos from find_free_cluster() will make a cluster allocation related structure, attached to ntfs_resize_t */ s64 max_free_cluster_range = 0; @@ -478,7 +475,7 @@ static int parse_options(int argc, char **argv) return (!err && !help && !ver); } -static void print_advise(s64 supp_lcn) +static void print_advise(ntfs_volume *vol, s64 supp_lcn) { s64 old_b, new_b, freed_b, old_mb, new_mb, freed_mb; @@ -558,10 +555,7 @@ static s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) s64 bm_bsize; bm_bsize = rounded_up_division(nr_clusters, 8); - bm_bsize = (bm_bsize + 7) & ~7; - Dprintf("Bitmap byte size : %lld (%lld clusters)\n", - bm_bsize, rounded_up_division(bm_bsize, vol->cluster_size)); return bm_bsize; } @@ -694,7 +688,7 @@ static void collect_relocation_info(ntfs_resize_t *resize, runlist *rl) err_printf("$MFT%s can't be split up yet. Please try " "a different size.\n", inode ? "Mirr" : ""); last_lcn = lcn + lcn_length - 1; - print_advise(last_lcn); + print_advise(resize->vol, last_lcn); exit(1); } } @@ -719,7 +713,7 @@ static void collect_relocation_info(ntfs_resize_t *resize, runlist *rl) * * This serves as a rudimentary "chkdsk" operation. */ -static void build_lcn_usage_bitmap(ntfs_fsck_t *fsck) +static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfs_fsck_t *fsck) { s64 inode; ATTR_RECORD *a; @@ -780,7 +774,7 @@ static void build_lcn_usage_bitmap(ntfs_fsck_t *fsck) * For a given MFT Record, iterate through all its attributes. Any non-resident * data runs will be marked in lcn_bitmap. */ -static void walk_attributes(ntfs_fsck_t *fsck) +static void walk_attributes(ntfs_volume *vol, ntfs_fsck_t *fsck) { if (!(fsck->ctx = ntfs_attr_get_search_ctx(fsck->ni, NULL))) perr_exit("ntfs_get_attr_search_ctx"); @@ -788,7 +782,7 @@ static void walk_attributes(ntfs_fsck_t *fsck) while (!ntfs_attrs_walk(fsck->ctx)) { if (fsck->ctx->attr->type == AT_END) break; - build_lcn_usage_bitmap(fsck); + build_lcn_usage_bitmap(vol, fsck); } ntfs_attr_put_search_ctx(fsck->ctx); @@ -800,7 +794,7 @@ static void walk_attributes(ntfs_fsck_t *fsck) * Compare two bitmaps. In this case, $Bitmap as read from the disk and * lcn_bitmap which we built from the MFT Records. */ -static void compare_bitmaps(struct bitmap *a) +static void compare_bitmaps(ntfs_volume *vol, struct bitmap *a) { s64 i, pos, count; int mismatch = 0; @@ -907,7 +901,7 @@ static void progress_update(struct progress_bar *p, u64 current) * Read each record in the MFT, skipping the unused ones, and build up a bitmap * from all the non-resident attributes. */ -static void build_allocation_bitmap(ntfs_fsck_t *fsck) +static void build_allocation_bitmap(ntfs_volume *vol, ntfs_fsck_t *fsck) { s64 inode = 0; ntfs_inode *ni; @@ -933,7 +927,7 @@ static void build_allocation_bitmap(ntfs_fsck_t *fsck) goto close_inode; fsck->ni = ni; - walk_attributes(fsck); + walk_attributes(vol, fsck); close_inode: if (ntfs_inode_close(ni)) perr_exit("ntfs_inode_close for inode %lld", inode); @@ -948,7 +942,8 @@ static void build_resize_constrains(ntfs_resize_t *resize) if (!resize->ctx->attr->non_resident) return; - if (!(rl = ntfs_mapping_pairs_decompress(vol, resize->ctx->attr, NULL))) + if (!(rl = ntfs_mapping_pairs_decompress(resize->vol, + resize->ctx->attr, NULL))) perr_exit("ntfs_decompress_mapping_pairs"); for (i = 0; rl[i].length; i++) { @@ -984,9 +979,10 @@ static void set_resize_constrains(ntfs_resize_t *resize) printf("Collecting shrinkage constrains ...\n"); - for (inode = 0; inode < vol->nr_mft_records; inode++) { + for (inode = 0; inode < resize->vol->nr_mft_records; inode++) { - if ((ni = ntfs_inode_open(vol, (MFT_REF)inode)) == NULL) { + ni = ntfs_inode_open(resize->vol, (MFT_REF)inode); + if (ni == NULL) { if (errno == EIO || errno == ENOENT) continue; perr_exit("Reading inode %lld failed", inode); @@ -1032,7 +1028,9 @@ static void rl_fixup(runlist **rl) } } -static void replace_attribute_runlist(ntfs_attr_search_ctx *ctx, runlist *rl) +static void replace_attribute_runlist(ntfs_volume *vol, + ntfs_attr_search_ctx *ctx, + runlist *rl) { int mp_size, l; void *mp; @@ -1281,18 +1279,18 @@ static int write_all(struct ntfs_device *dev, void *buf, int count) * Write an MFT Record back to the disk. If the read-only command line option * was given, this function will do nothing. */ -static int write_mft_record(const MFT_REF mref, MFT_RECORD *mrec) +static int write_mft_record(ntfs_volume *v, const MFT_REF mref, MFT_RECORD *buf) { - if (ntfs_mft_record_write(vol, mref, mrec)) + if (ntfs_mft_record_write(v, mref, buf)) perr_exit("ntfs_mft_record_write"); -// if (vol->dev->d_ops->sync(vol->dev) == -1) +// if (v->dev->d_ops->sync(v->dev) == -1) // perr_exit("Failed to sync device"); return 0; } -static void lseek_to_cluster(s64 lcn) +static void lseek_to_cluster(ntfs_volume *vol, s64 lcn) { off_t pos; @@ -1306,15 +1304,16 @@ static void copy_clusters(ntfs_resize_t *resize, s64 dest, s64 src, s64 len) { s64 i; char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ - + ntfs_volume *vol = resize->vol; + for (i = 0; i < len; i++) { - lseek_to_cluster(src + i); + lseek_to_cluster(vol, src + i); if (read_all(vol->dev, buff, vol->cluster_size) == -1) perr_exit("read_all"); - lseek_to_cluster(dest + i); + lseek_to_cluster(vol, dest + i); if (write_all(vol->dev, buff, vol->cluster_size) == -1) perr_exit("write_all"); @@ -1456,7 +1455,7 @@ static void relocate_attribute(ntfs_resize_t *resize) if (!a->non_resident) return; - if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) + if (!(rl = ntfs_mapping_pairs_decompress(resize->vol, a, NULL))) perr_exit("ntfs_decompress_mapping_pairs"); for (i = 0; rl[i].length; i++) { @@ -1476,7 +1475,7 @@ static void relocate_attribute(ntfs_resize_t *resize) } if (resize->dirty_inode == DIRTY_ATTRIB) { - replace_attribute_runlist(resize->ctx, rl); + replace_attribute_runlist(resize->vol, resize->ctx, rl); resize->dirty_inode = DIRTY_INODE; } @@ -1499,7 +1498,7 @@ static void relocate_attributes(ntfs_resize_t *resize) static void relocate_inode(ntfs_resize_t *resize, MFT_REF mref) { - if (ntfs_file_record_read(vol, mref, &resize->mrec, NULL)) { + if (ntfs_file_record_read(resize->vol, mref, &resize->mrec, NULL)) { /* FIXME: continue only if it make sense, e.g. MFT record not in use based on $MFT bitmap */ if (errno == EIO || errno == ENOENT) @@ -1518,7 +1517,7 @@ static void relocate_inode(ntfs_resize_t *resize, MFT_REF mref) if (resize->dirty_inode == DIRTY_INODE) { // if (vol->dev->d_ops->sync(vol->dev) == -1) // perr_exit("Failed to sync device"); - if (write_mft_record(mref, resize->mrec)) + if (write_mft_record(resize->vol, mref, resize->mrec)) perr_exit("Couldn't update inode %llu", mref); } } @@ -1532,11 +1531,11 @@ static void relocate_inodes(ntfs_resize_t *resize) progress_init(&resize->progress, 0, resize->relocations, 100); resize->relocations = 0; - resize->mrec = (MFT_RECORD *)malloc(vol->mft_record_size); + resize->mrec = (MFT_RECORD *)malloc(resize->vol->mft_record_size); if (!resize->mrec) perr_exit("malloc failed"); - for (mref = 1; mref < (MFT_REF)vol->nr_mft_records; mref++) + for (mref = 1; mref < (MFT_REF)resize->vol->nr_mft_records; mref++) relocate_inode(resize, mref); relocate_inode(resize, 0); @@ -1545,7 +1544,7 @@ static void relocate_inodes(ntfs_resize_t *resize) free(resize->mrec); } -static void print_hint(const char *s, struct llcn_t llcn) +static void print_hint(ntfs_volume *vol, const char *s, struct llcn_t llcn) { s64 runs_b, runs_mb; @@ -1567,19 +1566,21 @@ static void print_hint(const char *s, struct llcn_t llcn) */ static void advise_on_resize(ntfs_resize_t *resize) { + ntfs_volume *vol = resize->vol; + printf("Estimating smallest shrunken size supported ...\n"); printf("File feature Last used at By inode\n"); - print_hint("$MFT", resize->last_mft); - print_hint("Multi-Record", resize->last_multi_mft); + print_hint(vol, "$MFT", resize->last_mft); + print_hint(vol, "Multi-Record", resize->last_multi_mft); if (opt.verbose) { - print_hint("$MFTMirr", resize->last_mftmir); - print_hint("Compressed", resize->last_compressed); - print_hint("Sparse", resize->last_sparse); - print_hint("Ordinary", resize->last_lcn); + print_hint(vol, "$MFTMirr", resize->last_mftmir); + print_hint(vol, "Compressed", resize->last_compressed); + print_hint(vol, "Sparse", resize->last_sparse); + print_hint(vol, "Ordinary", resize->last_lcn); } - print_advise(resize->last_unsupp); + print_advise(vol, resize->last_unsupp); } /** @@ -1607,6 +1608,7 @@ static void truncate_badclust_bad_attr(ntfs_resize_t *resize) runlist *rl_bad; ATTR_RECORD *a = resize->ctx->attr; s64 nr_clusters = resize->new_volume_size; + ntfs_volume *vol = resize->vol; if (!a->non_resident) /* FIXME: handle resident attribute value */ @@ -1622,7 +1624,7 @@ static void truncate_badclust_bad_attr(ntfs_resize_t *resize) rl_set(rl_bad, 0LL, (LCN)LCN_HOLE, nr_clusters); rl_set(rl_bad + 1, nr_clusters, -1LL, 0LL); - replace_attribute_runlist(resize->ctx, rl_bad); + replace_attribute_runlist(vol, resize->ctx, rl_bad); free(rl_bad); } @@ -1681,7 +1683,8 @@ static void shrink_bitmap_data_attr(struct bitmap *bm, * Enlarge the metadata file $Bitmap. It must be large enough for one bit per * cluster of the shrunken volume. Also it must be a of 8 bytes in size. */ -static void enlarge_bitmap_data_attr(struct bitmap *bm, +static void enlarge_bitmap_data_attr(ntfs_volume *vol, + struct bitmap *bm, runlist **rl, s64 nr_bm_clusters, s64 new_size) @@ -1709,6 +1712,7 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) s64 nr_bm_clusters; s64 nr_clusters; u8 *tmp; + ntfs_volume *vol = resize->vol; a = resize->ctx->attr; if (!a->non_resident) @@ -1734,7 +1738,7 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) shrink_bitmap_data_attr(&resize->lcn_bitmap, &rl, nr_bm_clusters, nr_clusters); else - enlarge_bitmap_data_attr(&resize->lcn_bitmap, &rl, + enlarge_bitmap_data_attr(vol, &resize->lcn_bitmap, &rl, nr_bm_clusters, nr_clusters); a->highest_vcn = cpu_to_le64(nr_bm_clusters - 1LL); @@ -1742,7 +1746,7 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) a->data_size = cpu_to_le64(bm_bsize); a->initialized_size = cpu_to_le64(bm_bsize); - replace_attribute_runlist(resize->ctx, rl); + replace_attribute_runlist(vol, resize->ctx, rl); /* * FIXME: update allocated/data sizes and timestamps in $FILE_NAME @@ -1766,7 +1770,10 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) * Find the $DATA attribute (with or without a name) for the given MFT reference * (inode number). */ -static void lookup_data_attr(MFT_REF mref, const char *aname, ntfs_attr_search_ctx **ctx) +static void lookup_data_attr(ntfs_volume *vol, + MFT_REF mref, + const char *aname, + ntfs_attr_search_ctx **ctx) { ntfs_inode *ni; uchar_t *ustr = NULL; @@ -1800,11 +1807,12 @@ static void truncate_badclust_file(ntfs_resize_t *resize) { printf("Updating $BadClust file ...\n"); - lookup_data_attr((MFT_REF)FILE_BadClus, "$Bad", &resize->ctx); + lookup_data_attr(resize->vol, FILE_BadClus, "$Bad", &resize->ctx); /* FIXME: sanity_check_attr(ctx->attr); */ truncate_badclust_bad_attr(resize); - if (write_mft_record(resize->ctx->ntfs_ino->mft_no,resize->ctx->mrec)) + if (write_mft_record(resize->vol, resize->ctx->ntfs_ino->mft_no, + resize->ctx->mrec)) perr_exit("Couldn't update $BadClust"); ntfs_attr_put_search_ctx(resize->ctx); @@ -1819,10 +1827,11 @@ static void truncate_bitmap_file(ntfs_resize_t *resize) { printf("Updating $Bitmap file ...\n"); - lookup_data_attr((MFT_REF)FILE_Bitmap, NULL, &resize->ctx); + lookup_data_attr(resize->vol, FILE_Bitmap, NULL, &resize->ctx); truncate_bitmap_data_attr(resize); - if (write_mft_record(resize->ctx->ntfs_ino->mft_no, resize->ctx->mrec)) + if (write_mft_record(resize->vol, resize->ctx->ntfs_ino->mft_no, + resize->ctx->mrec)) perr_exit("Couldn't update $Bitmap"); ntfs_attr_put_search_ctx(resize->ctx); @@ -1835,15 +1844,15 @@ static void truncate_bitmap_file(ntfs_resize_t *resize) * All the bits are set to 0, except those representing the region beyond the * end of the disk. */ -static void setup_lcn_bitmap(struct bitmap *bm) +static void setup_lcn_bitmap(struct bitmap *bm, s64 nr_clusters) { /* Determine lcn bitmap byte size and allocate it. */ - bm->size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); + bm->size = nr_clusters_to_bitmap_byte_size(nr_clusters); if (!(bm->bm = (unsigned char *)calloc(1, bm->size))) perr_exit("Failed to allocate internal buffer"); - bitmap_file_data_fixup(vol->nr_clusters, bm); + bitmap_file_data_fixup(nr_clusters, bm); } /** @@ -1855,6 +1864,7 @@ static void update_bootsector(ntfs_resize_t *r) { NTFS_BOOT_SECTOR bs; s64 bs_size = sizeof(NTFS_BOOT_SECTOR); + ntfs_volume *vol = r->vol; printf("Updating Boot record ...\n"); @@ -1910,7 +1920,7 @@ static void print_vol_size(const char *str, s64 bytes) * * Display the amount of disk space in use. */ -static void print_disk_usage(s64 nr_used_clusters) +static void print_disk_usage(ntfs_volume *vol, s64 nr_used_clusters) { s64 total, used; @@ -1925,7 +1935,7 @@ static void print_disk_usage(s64 nr_used_clusters) static void print_num_of_relocations(ntfs_resize_t *resize) { - s64 relocations = resize->relocations * vol->cluster_size; + s64 relocations = resize->relocations * resize->vol->cluster_size; printf("Needed relocations : %lld (%lld MB)\n", (long long)resize->relocations, (long long) @@ -1939,9 +1949,10 @@ static void print_num_of_relocations(ntfs_resize_t *resize) * is dirty (Windows wasn't shutdown properly). If everything is OK, then mount * the volume (load the metadata into memory). */ -static void mount_volume(void) +static ntfs_volume *mount_volume(void) { unsigned long mntflag; + ntfs_volume *vol = NULL; if (ntfs_check_if_mounted(opt.volume, &mntflag)) { perr_printf("Failed to check '%s' mount state", opt.volume); @@ -1985,6 +1996,8 @@ static void mount_volume(void) printf("Cluster size : %u bytes\n", (unsigned int)vol->cluster_size); print_vol_size("Current volume size", vol_size(vol, vol->nr_clusters)); + + return vol; } /** @@ -1994,7 +2007,7 @@ static void mount_volume(void) * boots it will automatically run chkdsk to check for any problems. If the * read-only command line option was given, this function will do nothing. */ -static void prepare_volume_fixup(void) +static void prepare_volume_fixup(ntfs_volume *vol) { u16 flags; @@ -2038,7 +2051,7 @@ static void check_shrink_constraints(ntfs_resize_t *resize) if (!resize->shrink) return; - if (resize->inuse == vol->nr_clusters) + if (resize->inuse == resize->vol->nr_clusters) err_exit("Volume is full. To shrink it, " "delete unused files.\n"); @@ -2067,6 +2080,7 @@ int main(int argc, char **argv) ntfs_resize_t resize; s64 new_size = 0; /* in clusters; 0 = --info w/o --size */ s64 device_size; /* in bytes */ + ntfs_volume *vol; printf("%s v%s\n", EXEC_NAME, VERSION); @@ -2075,7 +2089,8 @@ int main(int argc, char **argv) utils_set_locale(); - mount_volume(); + if ((vol = mount_volume()) == NULL) + err_exit("Couldn't open volume '%s'!\n", opt.volume); device_size = ntfs_device_size_get(vol->dev, vol->sector_size); device_size *= vol->sector_size; @@ -2116,23 +2131,24 @@ int main(int argc, char **argv) } memset(&fsck, 0, sizeof(fsck)); - setup_lcn_bitmap(&fsck.lcn_bitmap); + setup_lcn_bitmap(&fsck.lcn_bitmap, vol->nr_clusters); - build_allocation_bitmap(&fsck); + build_allocation_bitmap(vol, &fsck); if (fsck.multi_ref) { err_printf("Filesystem check failed! Totally %d clusters " "referenced multiply times.\n", fsck.multi_ref); printf(corrupt_volume_msg); exit(1); } - compare_bitmaps(&fsck.lcn_bitmap); + compare_bitmaps(vol, &fsck.lcn_bitmap); - print_disk_usage(fsck.inuse); + print_disk_usage(vol, fsck.inuse); memset(&resize, 0, sizeof(resize)); resize.new_volume_size = new_size; resize.inuse = fsck.inuse; resize.lcn_bitmap = fsck.lcn_bitmap; + resize.vol = vol; /* This is also true if --info was used w/o --size (new_size = 0) */ if (new_size < vol->nr_clusters) @@ -2153,7 +2169,7 @@ int main(int argc, char **argv) } /* FIXME: performance - relocate logfile here if it's needed */ - prepare_volume_fixup(); + prepare_volume_fixup(vol); if (resize.relocations) relocate_inodes(&resize); From 0649be9d8e50bceee705920afa3c8a03dd9645e6 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sun, 9 May 2004 01:43:45 +0000 Subject: [PATCH 1413/2994] ntfsresize: eliminated the global ntfs_volume variable BKrev: 409d8cd17YSZ_BMSluvSHbLdZBuo_A From da742f48daed3f95f59a32f6f251a14f6c7d5255 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 11 May 2004 09:21:24 +0000 Subject: [PATCH 1414/2994] =?UTF-8?q?-=20Fix=20a=20bug=20where=20we=20woul?= =?UTF-8?q?d=20not=20always=20detect=20that=20we=20have=20reached=20the=20?= =?UTF-8?q?=20=20end=20of=20a=20compression=20block=20because=20we=20were?= =?UTF-8?q?=20ending=20at=20minus=20one=20byte=20=20=20which=20is=20effect?= =?UTF-8?q?ively=20the=20same=20as=20being=20at=20the=20end.=20=20The=20fi?= =?UTF-8?q?x=20is=20to=20=20=20check=20whether=20the=20uncompressed=20buff?= =?UTF-8?q?er=20has=20been=20fully=20filled=20and=20if=20so=20=20=20we=20a?= =?UTF-8?q?ssume=20we=20have=20reached=20the=20end=20of=20the=20compressio?= =?UTF-8?q?n=20block.=20=20A=20big=20=20=20thank=20you=20to=20Marcin=20Gib?= =?UTF-8?q?u=C5=82a=20for=20the=20bug=20report,=20the=20assistance=20in=20?= =?UTF-8?q?=20=20tracking=20down=20the=20bug=20and=20testing=20the=20fix.?= =?UTF-8?q?=20-=20Fix=20a=20bug=20where=20we=20forgot=20to=20reset=20the?= =?UTF-8?q?=20data=5Fsize=20and=20initialized=5Fsize=20=20=20in=20two=20er?= =?UTF-8?q?ror=20code=20paths.=20-=20Fix=20a=20bug=20where=20an=20uncompre?= =?UTF-8?q?ssed=20block=20could=20be=20misdetected=20as=20a=20=20=20compre?= =?UTF-8?q?ssed=20one=20if=20it=20was=20made=20up=20of=20multiple=20runs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (Logical change 1.390) --- libntfs/compress.c | 76 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 10 deletions(-) diff --git a/libntfs/compress.c b/libntfs/compress.c index ed9698bc..e0f101a4 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -1,5 +1,5 @@ /* - * compress.c - Compressed attribute handling code. Part of the Linux-NTFS + * compress.c - Compressed attribute handling code. Part of the Linux-NTFS * project. * * Copyright (c) 2004 Anton Altaparmakov @@ -88,8 +88,13 @@ static int ntfs_decompress(u8 *dest, const u32 dest_size, do_next_sb: Dprintf("Beginning sub-block at offset = 0x%x in the cb.\n", cb - cb_start); - /* Have we reached the end of the compression block? */ - if (cb == cb_end || !le16_to_cpup((u16*)cb)) { + /* + * Have we reached the end of the compression block or the end of the + * decompressed data? The latter can happen for example if the current + * position in the compression block is one byte before its end so the + * first two checks do not detect it. + */ + if (cb == cb_end || !le16_to_cpup((u16*)cb) || dest == dest_end) { Dprintf("Completed. Returning success (0).\n"); return 0; } @@ -166,7 +171,7 @@ do_next_tag: /* Continue with the next token. */ continue; } - /* + /* * We have a phrase token. Make sure it is not the first tag in * the sb as this is illegal and would confuse the code below. */ @@ -229,6 +234,53 @@ return_overflow: return -1; } +/** + * ntfs_is_cb_compressed - internal function, do not use + * + * This is a very specialised function determining if a cb is compressed or + * uncompressed. It is assumed that checking for a sparse cb has already been + * performed and that the cb is not sparse. It makes all sorts of other + * assumptions as well and hence it is not useful anywhere other than where it + * is used at the moment. Please, do not make this function available for use + * outside of compress.c as it is bound to confuse people and not do what they + * want. + * + * Return TRUE on errors so that the error will be detected later on in the + * code. Might be a bit confusing to debug but there really should never be + * errors coming from here. + */ +static __inline__ BOOL ntfs_is_cb_compressed(ntfs_attr *na, + runlist_element *rl, VCN cb_start_vcn, int cb_clusters) +{ + /* + * The simplest case: the run starting at @cb_start_vcn contains + * @cb_clusters clusters which are all not sparse, thus the cb is not + * compressed. + */ + if (rl->length - (cb_start_vcn - rl->vcn) >= cb_clusters) + return FALSE; + cb_clusters -= rl->length - (cb_start_vcn - rl->vcn); + do { + /* Go to the next run. */ + rl++; + /* Map the next runlist fragment if it is not mapped. */ + if (rl->lcn < LCN_HOLE || !rl->length) { + rl = ntfs_attr_find_vcn(na, rl->vcn); + if (!rl || rl->lcn < LCN_HOLE || !rl->length) + return TRUE; + } + /* If the current run is sparse, the cb is compressed. */ + if (rl->lcn == LCN_HOLE) + return TRUE; + /* If the whole cb is not sparse, it is not compressed. */ + if (rl->length >= cb_clusters) + return FALSE; + cb_clusters -= rl->length; + } while (cb_clusters > 0); + /* All cb_clusters were not sparse thus the cb is not compressed. */ + return FALSE; +} + /** * ntfs_compressed_attr_pread - read from a compressed attribute * @na: ntfs attribute to read from @@ -361,7 +413,7 @@ do_next_cb: total += to_read; count -= to_read; b = (u8*)b + to_read; - } else if (rl->length - (vcn - rl->vcn) >= cb_clusters) { + } else if (!ntfs_is_cb_compressed(na, rl, vcn, cb_clusters)) { s64 tdata_size, tinitialized_size; /* * Uncompressed cb, read it straight into the destination range @@ -372,8 +424,8 @@ do_next_cb: * Read the uncompressed data into the destination buffer. * NOTE: We cheat a little bit here by marking the attribute as * not compressed in the ntfs_attr structure so that we can - * read the data by simply using ntfs_attr_pread(). (-8 Note, - * Note, we have to modify data_size and initialized_size + * read the data by simply using ntfs_attr_pread(). (-8 + * NOTE: we have to modify data_size and initialized_size * temporarily as well... */ to_read = min(count, cb_size - ofs); @@ -386,6 +438,8 @@ do_next_cb: br = ntfs_attr_pread(na, ofs, to_read, b); if (br < 0) { err = errno; + na->data_size = tdata_size; + na->initialized_size = tinitialized_size; NAttrSetCompressed(na); free(cb); free(dest); @@ -417,8 +471,9 @@ do_next_cb: * NOTE: We cheat a little bit here by marking the attribute as * not compressed in the ntfs_attr structure so that we can * read the raw, compressed data by simply using - * ntfs_attr_pread(). (-8 Note, we have to modify data_size - * and initialized_size temporarily as well... + * ntfs_attr_pread(). (-8 + * NOTE: We have to modify data_size and initialized_size + * temporarily as well... */ to_read = cb_size; NAttrClearCompressed(na); @@ -431,6 +486,8 @@ do_next_cb: (cb_pos - cb), to_read, cb_pos); if (br < 0) { err = errno; + na->data_size = tdata_size; + na->initialized_size = tinitialized_size; NAttrSetCompressed(na); free(cb); free(dest); @@ -474,4 +531,3 @@ do_next_cb: /* Return number of bytes read. */ return total + total2; } - From 7ecb829f8fd2f1f79b6551707015f1301785ebae Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 11 May 2004 09:21:24 +0000 Subject: [PATCH 1415/2994] Cleanup. (Logical change 1.390) --- include/ntfs/layout.h | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index e7f5db31..45be461d 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -100,28 +100,37 @@ typedef struct { */ typedef enum { /* Found in $MFT/$DATA. */ - magic_FILE = const_cpu_to_le32(0x454c4946), /* mft entry */ - magic_INDX = const_cpu_to_le32(0x58444e49), /* index buffer */ + magic_FILE = const_cpu_to_le32(0x454c4946), /* Mft entry. */ + magic_INDX = const_cpu_to_le32(0x58444e49), /* Index buffer. */ magic_HOLE = const_cpu_to_le32(0x454c4f48), /* ? (NTFS 3.0+?) */ /* Found in $LogFile/$DATA. */ - magic_RSTR = const_cpu_to_le32(0x52545352), /* restart area */ - magic_RCRD = const_cpu_to_le32(0x44524352), /* log record */ + magic_RSTR = const_cpu_to_le32(0x52545352), /* Restart page. */ + magic_RCRD = const_cpu_to_le32(0x44524352), /* Log record page. */ - /* Found in $LogFile/$DATA but maybe found in $MFT/$DATA, also? */ - magic_CHKD = const_cpu_to_le32(0x424b4843), /* modified by chkdsk */ + /* Found in $LogFile/$DATA. (May be found in $MFT/$DATA, also?) */ + magic_CHKD = const_cpu_to_le32(0x424b4843), /* Modified by chkdsk. */ - /* Found in both $MFT/$DATA and $LogFile/$DATA. */ - magic_BAAD = const_cpu_to_le32(0x44414142), /* failed multi sector - transfer was detected */ + /* Found in all ntfs record containing records. */ + magic_BAAD = const_cpu_to_le32(0x44414142), /* Failed multi sector + transfer was detected. */ + + /* + * Found in $LogFile/$DATA when a page is full or 0xff bytes and is + * thus not initialized. User has to initialize the page before using + * it. + */ + magic_empty = const_cpu_to_le32(0xffffffff),/* Record is empty and has + to be initialized before + it can be used. */ } NTFS_RECORD_TYPES; /* * Generic magic comparison macros. Finally found a use for the ## preprocessor * operator! (-8 */ -#define ntfs_is_magic(x, m) ( (u32)(x) == (u32)magic_##m ) -#define ntfs_is_magicp(p, m) ( *(u32*)(p) == (u32)magic_##m ) +#define ntfs_is_magic(x, m) ( (u32)(x) == (u32)magic_##m ) +#define ntfs_is_magicp(p, m) ( *(u32*)(p) == (u32)magic_##m ) /* * Specialised magic comparison macros for the NTFS_RECORD_TYPES defined above. @@ -146,6 +155,9 @@ typedef enum { #define ntfs_is_baad_record(x) ( ntfs_is_magic (x, BAAD) ) #define ntfs_is_baad_recordp(p) ( ntfs_is_magicp(p, BAAD) ) +#define ntfs_is_empty_record(x) ( ntfs_is_magic (x, empty) ) +#define ntfs_is_empty_recordp(p) ( ntfs_is_magicp(p, empty) ) + /* * Defines for the NTFS filesystem. Don't want to use BLOCK_SIZE and * BLOCK_SIZE_BITS from the kernel as that is 1024 and hence too high for us. From dd001233ff15f6ffacf5e6f0a278718f5b4ba305 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 11 May 2004 09:21:24 +0000 Subject: [PATCH 1416/2994] Minor off by one bug fix. (Logical change 1.390) --- ntfsprogs/ntfsdump_logfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index e7238b79..b652170f 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -301,7 +301,7 @@ int main(int argc, char **argv) "corrupt: Update sequence array overlaps " "restart page header. Cannot handle this " "yet.\n"); - if (usa_end_ofs >= NTFS_SECTOR_SIZE - sizeof(u16)) + if (usa_end_ofs > NTFS_SECTOR_SIZE - sizeof(u16)) log_err_exit(buf, "Restart page header in $LogFile is " "corrupt: Update sequence array overlaps or " "is behind first protected sequence number. " From 13538af029bbf7e4095630554e022eff53cd1131 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 11 May 2004 09:21:24 +0000 Subject: [PATCH 1417/2994] Remove trailing whitespace. (Logical change 1.390) --- TODO.include | 1 - TODO.libntfs | 1 - TODO.ntfsprogs | 1 - 3 files changed, 3 deletions(-) diff --git a/TODO.include b/TODO.include index dd1337de..d9185bc9 100644 --- a/TODO.include +++ b/TODO.include @@ -5,4 +5,3 @@ Finish layout.h: in particular, add: Finish logfile.h: in particular, add: - more about the $LogFile on disk structures - diff --git a/TODO.libntfs b/TODO.libntfs index a432a132..6175b40f 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -66,4 +66,3 @@ - add defrag API to library - write utilities for all of the above - diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 2a88a526..f3dadd12 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -84,4 +84,3 @@ Low priority - mass undelete (using wildcards) - display parent directory - name "" to MFTn - From 2b4b259c1bda999aacf028cc17f516d1c90adeee Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 11 May 2004 09:21:24 +0000 Subject: [PATCH 1418/2994] Three bug fixes in the decompression code and preparation for the 1.9.2 release. BKrev: 40a09b14pk0uZYBZiU5ckxpPyfj6Bg From 1ab984166135ec3b62366acc4df8188e722cb339 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 11 May 2004 09:21:24 +0000 Subject: [PATCH 1419/2994] Update a little for the new ntfsinfo functionality. (Logical change 1.390) --- ntfsprogs/ntfsinfo.8.in | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index ea7259a4..a77ed87f 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -9,15 +9,23 @@ ntfsinfo \- dump a file's attributes .B ntfsinfo .I -d device .I -i inode-number +.I -F path-filename +.I -m .SH DESCRIPTION .B ntfsinfo will dump the attributes of inode -.IR inode-number . +.I inode-number +or the file +.I path-filename +and/or information about the mft ( +.I -m +option). Run ntfsinfo without arguments for a full list of options. .PP .SH AUTHOR .B ntfsinfo -was written by Matthew J. Fanto (mattjf@uncompiled.com). +was written by Matthew J. Fanto (mattjf@uncompiled.com) and largely rewritten +by Yuval Fledel with a little help from Anton Altaparmakov. .SH AVAILABILITY .B ntfsinfo is part of the ntfsprogs package and is available from From e9f7c1122715dfbb2c90e6475d83dd5809e2d048 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 11 May 2004 09:21:24 +0000 Subject: [PATCH 1420/2994] Update for 1.9.2 release. (Logical change 1.390) --- NEWS | 4 ++++ configure | 20 ++++++++++---------- configure.ac | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index 0d4468fc..84dab551 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ Current news ============ +ntfsinfo has been extended and now provides much more detailed information as +well as being able to resolve a path/filename instead of requiring the inode +number. (Yuval Fledel, Anton Altaparmakov) + mkntfs now creates bootable ntfs volumes so you can install Windows on an ntfs volume created with mkntfs and Windows will manage to boot afterwards. diff --git a/configure b/configure index 8076eb9e..a57e11b5 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.2-WIP. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.2. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.9.2-WIP' -PACKAGE_STRING='ntfsprogs 1.9.2-WIP' +PACKAGE_VERSION='1.9.2' +PACKAGE_STRING='ntfsprogs 1.9.2' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -955,7 +955,7 @@ 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 ntfsprogs 1.9.2-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.9.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1022,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.9.2-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.9.2:";; esac cat <<\_ACEOF @@ -1169,7 +1169,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.9.2-WIP +ntfsprogs configure 1.9.2 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1183,7 +1183,7 @@ 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 ntfsprogs $as_me 1.9.2-WIP, which was +It was created by ntfsprogs $as_me 1.9.2, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1903,7 +1903,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.9.2-WIP' + VERSION='1.9.2' cat >>confdefs.h <<_ACEOF @@ -23026,7 +23026,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.9.2-WIP, which was +This file was extended by ntfsprogs $as_me 1.9.2, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23089,7 +23089,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.9.2-WIP +ntfsprogs config.status 1.9.2 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 791a73ef..b30c0835 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.9.2-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.9.2],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) From ac67e7dce2b91ff029ac7eec9b25fa83b74cdae9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 11 May 2004 09:21:24 +0000 Subject: [PATCH 1421/2994] =?UTF-8?q?Use=20UTF8=20instead=20of=20iso8859-1?= =?UTF-8?q?=20and=20add=20Marcin=20Gibu=C5=82a.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (Logical change 1.390) --- CREDITS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CREDITS b/CREDITS index 11c1cd47..19aee038 100644 --- a/CREDITS +++ b/CREDITS @@ -14,12 +14,13 @@ Russ Christensen Andras Erdei Matthew J. Fanto Yuval Fledel (no email address on request) +Marcin GibuĹ‚a Christophe Grenier Ian Jackson Jan Kratochvil Lode Leroy -David Martínez Moreno -Leonard Norrgĺrd +David MartĂ­nez Moreno +Leonard NorrgĂĄrd Yuri Per Richard Russon Szakacsits Szabolcs From c03f0bf6fbee0f661695d0be9136d03980831c13 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 11 May 2004 09:21:24 +0000 Subject: [PATCH 1422/2994] Use UTF8 instead of iso8859-1 and update for 1.9.2 release. (Logical change 1.390) --- ChangeLog | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 388d2f51..2a832255 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/2004 - 1.9.2-WIP +11/05/2004 - 1.9.2 - Decomrpession bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch config.h.in sledge hammers. (Anton) - Fix the incorrect ntfsclone usage example in the man page. (Szaka) @@ -24,6 +24,17 @@ xx/xx/2004 - 1.9.2-WIP mbsrtowcs() on Cygwin. (Lode, Christophe, Anton) - Add SetFilePointerEx() emulation to win32_io.c. (Lode) - Add inode selection by path/filename to ntfsinfo. (Yuval) + - Fix a bug where we would not always detect that we have reached the + end of a compression block because we were ending at minus one byte + which is effectively the same as being at the end. The fix is to + check whether the uncompressed buffer has been fully filled and if so + we assume we have reached the end of the compression block. A big + thank you to Marcin GibuĹ‚a for the bug report, the assistance in + tracking down the bug and testing the fix. (Anton) + - Fix a bug where we forgot to reset the data_size and initialized_size + in two error code paths in ntfs_compressed_attr_pread(). (Anton) + - Fix a bug where an uncompressed block could be misdetected as a + compressed one if it was made up of multiple runs. (Anton) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. @@ -136,8 +147,8 @@ xx/xx/2004 - 1.9.2-WIP arguments to typecast the arguments to (unsigned) long long to avoid the warnings when compiling on 64 bit architectures. - Use AC_GNU_SOURCE in configure.ac instead of doing it manually. - - Fix lots of typos in the documentation. (David Martínez Moreno) - - Update config.sub and config.guess to latest ones. (David Martínez + - Fix lots of typos in the documentation. (David MartĂ­nez Moreno) + - Update config.sub and config.guess to latest ones. (David MartĂ­nez Moreno) - Change Linux-NTFS to ntfsprogs everywhere when talking about the package rather than the project (especially man pages affected). @@ -550,7 +561,7 @@ xx/xx/2004 - 1.9.2-WIP Minor updates/clarifications to include/layout.h. 02/08/2001 - 1.2.1 - Added ntfsfix man page and minor cleanup. - David Martínez Moreno donated a man page + David MartĂ­nez Moreno donated a man page for ntfsfix as well as spelling mistake fixes all over the place. 26/07/2001 - 1.2.0 - Important bug fixes to mkntfs. From de1aea149c0e157041c8d4550b9ab7a671a890b9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 11 May 2004 09:21:24 +0000 Subject: [PATCH 1423/2994] Use UTF8 instead of iso8859-1. (Logical change 1.390) --- AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 877fcf85..55de56ac 100644 --- a/AUTHORS +++ b/AUTHORS @@ -8,6 +8,6 @@ Jan Kratochvil Matthew J. Fanto Yuval Fledel (no email address on request) Lode Leroy -Leonard Norrgĺrd +Leonard NorrgĂĄrd Richard Russon Szakacsits Szabolcs From 5e1b0ba260caaa50257464f5576dddaf95979231 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 May 2004 08:07:19 +0000 Subject: [PATCH 1424/2994] Add Pete Curran. (Logical change 1.391) --- CREDITS | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS b/CREDITS index 19aee038..ac45f301 100644 --- a/CREDITS +++ b/CREDITS @@ -11,6 +11,7 @@ Alexei Alexandrov Anton Altaparmakov Albert D. Cahalan Russ Christensen +Pete Curran Andras Erdei Matthew J. Fanto Yuval Fledel (no email address on request) From 153114e5fdc192644a9f70b903a039b1d0b106c5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 May 2004 08:07:19 +0000 Subject: [PATCH 1425/2994] Bump version to 1.9.3-WIP. (Logical change 1.391) --- configure | 20 ++++++++++---------- configure.ac | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/configure b/configure index a57e11b5..a8071ed4 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.2. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.3-WIP. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.9.2' -PACKAGE_STRING='ntfsprogs 1.9.2' +PACKAGE_VERSION='1.9.3-WIP' +PACKAGE_STRING='ntfsprogs 1.9.3-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -955,7 +955,7 @@ 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 ntfsprogs 1.9.2 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.9.3-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1022,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.9.2:";; + short | recursive ) echo "Configuration of ntfsprogs 1.9.3-WIP:";; esac cat <<\_ACEOF @@ -1169,7 +1169,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.9.2 +ntfsprogs configure 1.9.3-WIP generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1183,7 +1183,7 @@ 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 ntfsprogs $as_me 1.9.2, which was +It was created by ntfsprogs $as_me 1.9.3-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1903,7 +1903,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.9.2' + VERSION='1.9.3-WIP' cat >>confdefs.h <<_ACEOF @@ -23026,7 +23026,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.9.2, which was +This file was extended by ntfsprogs $as_me 1.9.3-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23089,7 +23089,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.9.2 +ntfsprogs config.status 1.9.3-WIP configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index b30c0835..fc2064a3 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.9.2],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.9.3-WIP],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) From 9ae1b7306a46acf3f9517bb58b432a3cce581822 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 May 2004 08:07:19 +0000 Subject: [PATCH 1426/2994] Fix access of MFT_RECORD->bytes_in_use to use le32_to_cpu() instead of le16_to_cpu() in libntfs/volume.c. (Pete Curran) (Logical change 1.391) --- libntfs/volume.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index d1049e1f..eb426a86 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -792,7 +792,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) vinf = (VOLUME_INFORMATION*)(le16_to_cpu(a->value_offset) + (char*)a); /* Sanity checks. */ if ((char*)vinf + le32_to_cpu(a->value_length) > (char*)ctx->mrec + - le16_to_cpu(ctx->mrec->bytes_in_use) || + le32_to_cpu(ctx->mrec->bytes_in_use) || le16_to_cpu(a->value_offset) + le32_to_cpu( a->value_length) > le32_to_cpu(a->length)) { Dputs(FAILED); From 94e687a5b4019ef7cbd7f4b34197b47dd693cc02 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 May 2004 08:07:19 +0000 Subject: [PATCH 1427/2994] Fix access of MFT_RECORD->bytes_in_use to use le32_to_cpu() instead of le16_to_cpu() in libntfs/volume.c. (Pete Curran) BKrev: 40a47e3742mktSpbpcOe-OlQLGX-Pg From ab8db675c6383381ec7cc5feccde0fcd5d28dde5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 May 2004 08:07:19 +0000 Subject: [PATCH 1428/2994] Update (Logical change 1.391) --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2a832255..ab2b2cbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +xx/xx/2004 - 1.9.3-WIP + + - Fix access of MFT_RECORD->bytes_in_use to use le32_to_cpu() instead + of le16_to_cpu() in libntfs/volume.c. (Pete Curran) + 11/05/2004 - 1.9.2 - Decomrpession bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch config.h.in sledge hammers. (Anton) From 3423a8a909c9eb431e3638b2d5870e0116345306 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 May 2004 13:02:33 +0000 Subject: [PATCH 1429/2994] Rename uchar_t to ntfschar. (Logical change 1.392) --- ChangeLog | 3 + include/ntfs/attrib.h | 8 +- include/ntfs/dir.h | 6 +- include/ntfs/layout.h | 8 +- include/ntfs/logfile.h | 2 +- include/ntfs/types.h | 2 +- include/ntfs/unistr.h | 32 +- include/ntfs/volume.h | 2 +- libntfs/attrib.c | 32 +- libntfs/dir.c | 22 +- libntfs/gnome-vfs-method.c | 877 +++++++++++++++++++++++++++++++++++++ libntfs/unistr.c | 60 +-- libntfs/volume.c | 10 +- ntfsprogs/mkntfs.c | 66 +-- ntfsprogs/ntfscat.c | 2 +- ntfsprogs/ntfscluster.h | 2 +- ntfsprogs/ntfsinfo.c | 10 +- ntfsprogs/ntfslabel.c | 8 +- ntfsprogs/ntfsls.c | 4 +- ntfsprogs/ntfsmove.c | 2 +- ntfsprogs/ntfsresize.c | 8 +- ntfsprogs/ntfstruncate.c | 10 +- ntfsprogs/ntfsundelete.c | 2 +- ntfsprogs/ntfsundelete.h | 4 +- ntfsprogs/upcase.c | 4 +- ntfsprogs/utils.c | 4 +- 26 files changed, 1035 insertions(+), 155 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab2b2cbd..286c6b31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ xx/xx/2004 - 1.9.3-WIP - Fix access of MFT_RECORD->bytes_in_use to use le32_to_cpu() instead of le16_to_cpu() in libntfs/volume.c. (Pete Curran) + - Rename uchar_t to ntfschar everywhere since uchar_t is already + defined on Solaris to be an unsigned 1-byte character and it is also + defined like this in POSIX. 11/05/2004 - 1.9.2 - Decomrpession bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 57fcbb69..ca209b13 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -31,7 +31,7 @@ typedef struct _ntfs_attr_search_ctx ntfs_attr_search_ctx; #include "runlist.h" #include "volume.h" -extern uchar_t AT_UNNAMED[]; +extern ntfschar AT_UNNAMED[]; /** * ntfs_lcn_special_values - special return values for ntfs_*_vcn_to_lcn() @@ -82,7 +82,7 @@ extern ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec); extern void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx); -extern int ntfs_attr_lookup(const ATTR_TYPES type, const uchar_t *name, +extern int ntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx); @@ -202,7 +202,7 @@ struct _ntfs_attr { runlist_element *rl; ntfs_inode *ni; ATTR_TYPES type; - uchar_t *name; + ntfschar *name; u32 name_len; unsigned long state; s64 allocated_size; @@ -247,7 +247,7 @@ extern void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident, const u8 compression_unit); extern ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, - uchar_t *name, const u32 name_len); + ntfschar *name, const u32 name_len); extern void ntfs_attr_close(ntfs_attr *na); extern s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index e13e3753..035de300 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -25,10 +25,10 @@ #include "types.h" /* The little endian Unicode string $I30 as a global constant. */ -extern uchar_t I30[5]; +extern ntfschar I30[5]; extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, - const uchar_t *uname, const int uname_len); + const ntfschar *uname, const int uname_len); /* * File types (adapted from include ) @@ -49,7 +49,7 @@ extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, * This allows the caller to read directories into their application or * to have different dirent layouts depending on the binary type. */ -typedef int (*ntfs_filldir_t)(void *dirent, const uchar_t *name, +typedef int (*ntfs_filldir_t)(void *dirent, const ntfschar *name, const int name_len, const int name_type, const s64 pos, const MFT_REF mref, const unsigned dt_type); diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 45be461d..26c8f81f 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -568,7 +568,7 @@ typedef enum { */ typedef struct { /*hex ofs*/ -/* 0*/ uchar_t name[0x40]; /* Unicode name of the attribute. Zero +/* 0*/ ntfschar name[0x40]; /* Unicode name of the attribute. Zero terminated. */ /* 80*/ ATTR_TYPES type; /* Type of the attribute. */ /* 84*/ u32 display_rule; /* Default display rule. @@ -969,7 +969,7 @@ typedef struct { attribute value. */ /* 24*/ u16 instance; /* If lowest_vcn = 0, the instance of the attribute being referenced; otherwise 0. */ -/* 26*/ uchar_t name[0]; /* Use when creating only. When reading use +/* 26*/ ntfschar name[0]; /* Use when creating only. When reading use name_offset to determine the location of the name. */ /* sizeof() = 26 + (attribute_name_length * 2) bytes */ @@ -1051,7 +1051,7 @@ typedef struct { /* 40*/ u8 file_name_length; /* Length of file name in (Unicode) characters. */ /* 41*/ FILE_NAME_TYPE_FLAGS file_name_type; /* Namespace of the file name.*/ -/* 42*/ uchar_t file_name[0]; /* File name in Unicode. */ +/* 42*/ ntfschar file_name[0]; /* File name in Unicode. */ } __attribute__ ((__packed__)) FILE_NAME_ATTR; /* @@ -1839,7 +1839,7 @@ typedef struct { * NOTE: Present only in FILE_Volume. */ typedef struct { - uchar_t name[0]; /* The name of the volume in Unicode. */ + ntfschar name[0]; /* The name of the volume in Unicode. */ } __attribute__ ((__packed__)) VOLUME_NAME; /* diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index 4dfb0cfd..d5144d64 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -190,7 +190,7 @@ typedef struct { but don't know if this is always the case. */ /* 22*/ u8 reserved[6]; /* Reserved/alignment. */ /* 28*/ u32 client_name_length; /* Length of client name in bytes. = 8 */ -/* 32*/ uchar_t client_name[64];/* Name of the client in Unicode. = NTFS */ +/* 32*/ ntfschar client_name[64];/* Name of the client in Unicode. = NTFS */ /* sizeof() = 160 (0xa0) bytes */ } __attribute__ ((__packed__)) LOG_CLIENT_RECORD; diff --git a/include/ntfs/types.h b/include/ntfs/types.h index 2a399f2d..8b1ac35f 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -42,7 +42,7 @@ typedef int16_t s16; typedef int32_t s32; typedef int64_t s64; -typedef u16 uchar_t; /* 2-byte Unicode character type. */ +typedef u16 ntfschar; /* 2-byte Unicode character type. */ #define UCHAR_T_SIZE_BITS 1 /* diff --git a/include/ntfs/unistr.h b/include/ntfs/unistr.h index 1119c5ee..5e4a1a56 100644 --- a/include/ntfs/unistr.h +++ b/include/ntfs/unistr.h @@ -28,36 +28,36 @@ extern const u8 legal_ansi_char_array[0x40]; -extern BOOL ntfs_names_are_equal(const uchar_t *s1, size_t s1_len, - const uchar_t *s2, size_t s2_len, const IGNORE_CASE_BOOL ic, - const uchar_t *upcase, const u32 upcase_size); +extern BOOL ntfs_names_are_equal(const ntfschar *s1, size_t s1_len, + const ntfschar *s2, size_t s2_len, const IGNORE_CASE_BOOL ic, + const ntfschar *upcase, const u32 upcase_size); -extern int ntfs_names_collate(const uchar_t *name1, const u32 name1_len, - const uchar_t *name2, const u32 name2_len, +extern int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, + const ntfschar *name2, const u32 name2_len, const int err_val, const IGNORE_CASE_BOOL ic, - const uchar_t *upcase, const u32 upcase_len); + const ntfschar *upcase, const u32 upcase_len); -extern int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n); +extern int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n); -extern int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, - const uchar_t *upcase, const u32 upcase_size); +extern int ntfs_ucsncasecmp(const ntfschar *s1, const ntfschar *s2, size_t n, + const ntfschar *upcase, const u32 upcase_size); -extern u32 ntfs_ucsnlen(const uchar_t *s, u32 maxlen); +extern u32 ntfs_ucsnlen(const ntfschar *s, u32 maxlen); -extern void ntfs_name_upcase(uchar_t *name, u32 name_len, - const uchar_t *upcase, const u32 upcase_len); +extern void ntfs_name_upcase(ntfschar *name, u32 name_len, + const ntfschar *upcase, const u32 upcase_len); extern void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, - const uchar_t *upcase, const u32 upcase_len); + const ntfschar *upcase, const u32 upcase_len); extern int ntfs_file_values_compare(FILE_NAME_ATTR *file_name_attr1, FILE_NAME_ATTR *file_name_attr2, const int err_val, const IGNORE_CASE_BOOL ic, - const uchar_t *upcase, const u32 upcase_len); + const ntfschar *upcase, const u32 upcase_len); -extern int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, +extern int ntfs_ucstombs(const ntfschar *ins, const int ins_len, char **outs, int outs_len); -extern int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len); +extern int ntfs_mbstoucs(const char *ins, ntfschar **outs, int outs_len); #endif /* defined _NTFS_UNISTR_H */ diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index b401362b..205d097d 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -158,7 +158,7 @@ struct _ntfs_volume { ntfs_attr *mftmirr_na; /* ntfs_attr structure for the data attribute of FILE_MFTMirr. */ - uchar_t *upcase; /* Upper case equivalents of all 65536 2-byte + ntfschar *upcase; /* Upper case equivalents of all 65536 2-byte Unicode characters. Obtained from FILE_UpCase. */ u32 upcase_len; /* Length in Unicode characters of the upcase diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 9b1d8d91..81502626 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -43,7 +43,7 @@ #include "dir.h" #include "compress.h" -uchar_t AT_UNNAMED[] = { const_cpu_to_le16('\0') }; +ntfschar AT_UNNAMED[] = { const_cpu_to_le16('\0') }; /** * ntfs_get_attribute_value_length @@ -246,7 +246,7 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, * Initialize the ntfs attribute @na with @ni, @type, @name, and @name_len. */ static __inline__ void __ntfs_attr_init(ntfs_attr *na, ntfs_inode *ni, - const ATTR_TYPES type, uchar_t *name, const u32 name_len) + const ATTR_TYPES type, ntfschar *name, const u32 name_len) { na->rl = NULL; na->ni = ni; @@ -323,7 +323,7 @@ void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident, * both those cases @name_len is not used at all. */ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, - uchar_t *name, const u32 name_len) + ntfschar *name, const u32 name_len) { ntfs_attr_search_ctx *ctx; ntfs_attr *na; @@ -1331,13 +1331,13 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, * Warning: Never use @val when looking for attribute types which can be * non-resident as this most likely will result in a crash! */ -static int ntfs_attr_find(const ATTR_TYPES type, const uchar_t *name, +static int ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) { ATTR_RECORD *a; ntfs_volume *vol; - uchar_t *upcase; + ntfschar *upcase; u32 upcase_len; if (!ctx || !ctx->mrec || !ctx->attr) { @@ -1394,12 +1394,12 @@ static int ntfs_attr_find(const ATTR_TYPES type, const uchar_t *name, return -1; } } else if (name && !ntfs_names_are_equal(name, name_len, - (uchar_t*)((char*)a + le16_to_cpu(a->name_offset)), + (ntfschar*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, ic, upcase, upcase_len)) { register int rc; rc = ntfs_names_collate(name, name_len, - (uchar_t*)((char*)a + + (ntfschar*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, 1, IGNORE_CASE, upcase, upcase_len); @@ -1415,7 +1415,7 @@ static int ntfs_attr_find(const ATTR_TYPES type, const uchar_t *name, if (rc) continue; rc = ntfs_names_collate(name, name_len, - (uchar_t*)((char*)a + + (ntfschar*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, 1, CASE_SENSITIVE, upcase, upcase_len); @@ -1536,7 +1536,7 @@ static int ntfs_attr_find(const ATTR_TYPES type, const uchar_t *name, * EIO I/O error or corrupt data structures found. * ENOMEM Not enough memory to allocate necessary buffers. */ -static int ntfs_external_attr_find(ATTR_TYPES type, const uchar_t *name, +static int ntfs_external_attr_find(ATTR_TYPES type, const ntfschar *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) @@ -1546,7 +1546,7 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const uchar_t *name, ATTR_LIST_ENTRY *al_entry, *next_al_entry; char *al_start, *al_end; ATTR_RECORD *a; - uchar_t *al_name; + ntfschar *al_name; u32 al_name_len; BOOL is_first_search = FALSE; @@ -1665,7 +1665,7 @@ find_attr_list_attr: continue; } al_name_len = al_entry->name_length; - al_name = (uchar_t*)((char*)al_entry + al_entry->name_offset); + al_name = (ntfschar*)((char*)al_entry + al_entry->name_offset); /* * If !@type we want the attribute represented by this * attribute list entry. @@ -1727,7 +1727,7 @@ find_attr_list_attr: lowest_vcn && next_al_entry->type == al_entry->type && next_al_entry->name_length == al_name_len && - ntfs_names_are_equal((uchar_t*)((char*) + ntfs_names_are_equal((ntfschar*)((char*) next_al_entry + next_al_entry->name_offset), next_al_entry->name_length, @@ -1800,7 +1800,7 @@ do_next_attr_loop: */ if (al_entry->type != a->type) break; - if (!ntfs_names_are_equal((uchar_t*)((char*)a + + if (!ntfs_names_are_equal((ntfschar*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, al_name, al_name_len, CASE_SENSITIVE, @@ -1948,7 +1948,7 @@ not_found: * EIO I/O error or corrupt data structures found. * ENOMEM Not enough memory to allocate necessary buffers. */ -int ntfs_attr_lookup(const ATTR_TYPES type, const uchar_t *name, +int ntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const VCN lowest_vcn, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) @@ -2474,7 +2474,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, /* Move the attribute name if it exists and update the offset. */ if (a->name_length) memmove((u8*)a + name_ofs, (u8*)a + le16_to_cpu(a->name_offset), - a->name_length * sizeof(uchar_t)); + a->name_length * sizeof(ntfschar)); a->name_offset = cpu_to_le16(name_ofs); /* Update the flags to match the in-memory ones. */ @@ -2748,7 +2748,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) } memmove((u8*)a + name_ofs, (u8*)a + le16_to_cpu(a->name_offset), - a->name_length * sizeof(uchar_t)); + a->name_length * sizeof(ntfschar)); } a->name_offset = cpu_to_le16(name_ofs); diff --git a/libntfs/dir.c b/libntfs/dir.c index 31796a8d..a1c09b87 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -35,7 +35,7 @@ /* * The little endian Unicode string "$I30" as a global constant. */ -uchar_t I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'), +ntfschar I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'), const_cpu_to_le16('3'), const_cpu_to_le16('0'), const_cpu_to_le16('\0') }; @@ -64,7 +64,7 @@ uchar_t I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'), * If the volume is mounted with the case sensitive flag set, then we only * allow exact matches. */ -u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const uchar_t *uname, +u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname, const int uname_len) { VCN vcn; @@ -137,7 +137,7 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const uchar_t *uname, * returning. */ if (ntfs_names_are_equal(uname, uname_len, - (uchar_t*)&ie->key.file_name.file_name, + (ntfschar*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, CASE_SENSITIVE, vol->upcase, vol->upcase_len)) { found_it: @@ -158,7 +158,7 @@ found_it: if (!NVolCaseSensitive(vol) && ie->key.file_name.file_name_type && ntfs_names_are_equal(uname, uname_len, - (uchar_t*)&ie->key.file_name.file_name, + (ntfschar*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, IGNORE_CASE, vol->upcase, vol->upcase_len)) { /* Only one case insensitive matching name allowed. */ @@ -178,7 +178,7 @@ found_it: * know which way in the B+tree we have to go. */ rc = ntfs_names_collate(uname, uname_len, - (uchar_t*)&ie->key.file_name.file_name, + (ntfschar*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, 1, IGNORE_CASE, vol->upcase, vol->upcase_len); /* @@ -197,7 +197,7 @@ found_it: * collation. */ rc = ntfs_names_collate(uname, uname_len, - (uchar_t*)&ie->key.file_name.file_name, + (ntfschar*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, 1, CASE_SENSITIVE, vol->upcase, vol->upcase_len); if (rc == -1) @@ -329,7 +329,7 @@ descend_into_child_node: * returning. */ if (ntfs_names_are_equal(uname, uname_len, - (uchar_t*)&ie->key.file_name.file_name, + (ntfschar*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, CASE_SENSITIVE, vol->upcase, vol->upcase_len)) { found_it2: @@ -352,7 +352,7 @@ found_it2: if (!NVolCaseSensitive(vol) && ie->key.file_name.file_name_type && ntfs_names_are_equal(uname, uname_len, - (uchar_t*)&ie->key.file_name.file_name, + (ntfschar*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, IGNORE_CASE, vol->upcase, vol->upcase_len)) { /* Only one case insensitive matching name allowed. */ @@ -372,7 +372,7 @@ found_it2: * know which way in the B+tree we have to go. */ rc = ntfs_names_collate(uname, uname_len, - (uchar_t*)&ie->key.file_name.file_name, + (ntfschar*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, 1, IGNORE_CASE, vol->upcase, vol->upcase_len); /* @@ -391,7 +391,7 @@ found_it2: * collation. */ rc = ntfs_names_collate(uname, uname_len, - (uchar_t*)&ie->key.file_name.file_name, + (ntfschar*)&ie->key.file_name.file_name, ie->key.file_name.file_name_length, 1, CASE_SENSITIVE, vol->upcase, vol->upcase_len); if (rc == -1) @@ -456,7 +456,7 @@ close_err_out: /* * The little endian Unicode string ".." for ntfs_readdir(). */ -static const uchar_t dotdot[3] = { const_cpu_to_le16('.'), +static const ntfschar dotdot[3] = { const_cpu_to_le16('.'), const_cpu_to_le16('.'), const_cpu_to_le16('\0') }; diff --git a/libntfs/gnome-vfs-method.c b/libntfs/gnome-vfs-method.c index e69de29b..07844fc7 100644 --- a/libntfs/gnome-vfs-method.c +++ b/libntfs/gnome-vfs-method.c @@ -0,0 +1,877 @@ +/* + * gnome-vfs-method.c - Gnome-VFS init/shutdown implementation of interface to + * libntfs. Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Jan Kratochvil + * Copyright (c) 2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#undef FALSE +#undef TRUE +#include "types.h" /* for 'FALSE'/'TRUE' libntfs definition */ +#define FALSE FALSE +#define TRUE TRUE + +#include "gnome-vfs-method.h" /* self */ +#include +#include +#include "gnome-vfs-module.h" +#include +#include +#include + +#include "volume.h" +#include "dir.h" + +static GnomeVFSMethod GnomeVFSMethod_static; +G_LOCK_DEFINE_STATIC(GnomeVFSMethod_static); + +/* map: (gchar *)method_name -> (struct method_name_info *) */ +static GHashTable *method_name_hash; +G_LOCK_DEFINE_STATIC(method_name_hash); + +struct method_name_info { + gchar *args; +}; + +static void method_name_hash_key_destroy_func(gchar *key) +{ + g_return_if_fail(key != NULL); + + g_free(key); +} + +static void method_name_hash_value_destroy_func(struct method_name_info *value) +{ + g_return_if_fail(value != NULL); + + g_free(value->args); + g_free(value); +} + +static void method_name_hash_init(void) +{ + G_LOCK(method_name_hash); + if (!method_name_hash) { + method_name_hash = g_hash_table_new_full( + g_str_hash, /* hash_func */ + g_str_equal, /* key_equal_func */ + (GDestroyNotify) method_name_hash_key_destroy_func, /* key_destroy_func */ + (GDestroyNotify) method_name_hash_value_destroy_func); /* value_destroy_func */ + } + G_UNLOCK(method_name_hash); +} + +/* + * map: (gchar *)uri_parent_string "method_name:uri_parent" -> (ntfs_volume *) + */ +static GHashTable *uri_parent_string_hash; +G_LOCK_DEFINE_STATIC(uri_parent_string_hash); + +static void uri_parent_string_hash_key_destroy_func(gchar *key) +{ + g_return_if_fail(key != NULL); + + g_free(key); +} + +static void uri_parent_string_hash_value_destroy_func(ntfs_volume *value) +{ + g_return_if_fail(value != NULL); + + ntfs_umount( /* errors ignored */ + value, /* vol */ + TRUE); /* force; possibly loose modifications */ +} + +static void uri_parent_string_hash_init(void) +{ + G_LOCK(uri_parent_string_hash); + if (!uri_parent_string_hash) { + uri_parent_string_hash = g_hash_table_new_full( + g_str_hash, /* hash_func */ + g_str_equal, /* key_equal_func */ + (GDestroyNotify) uri_parent_string_hash_key_destroy_func, /* key_destroy_func */ + (GDestroyNotify) uri_parent_string_hash_value_destroy_func); /* value_destroy_func */ + } + G_UNLOCK(uri_parent_string_hash); +} + +static GnomeVFSResult libntfs_gnomevfs_uri_parent_init( + ntfs_volume **volume_return, GnomeVFSURI *uri) +{ + gchar *uri_parent_string; + gchar *uri_parent_string_parent; + ntfs_volume *volume; + + g_return_val_if_fail(uri != NULL, GNOME_VFS_ERROR_INVALID_URI); + g_return_val_if_fail(volume_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + uri_parent_string_hash_init(); + + if (!uri->parent) + return GNOME_VFS_ERROR_INVALID_URI; + if (!uri->text) /* not needed here but we don't permit non-specific fs-image reference */ + return GNOME_VFS_ERROR_INVALID_URI; + uri_parent_string_parent = gnome_vfs_uri_to_string(uri->parent, + GNOME_VFS_URI_HIDE_NONE); + g_assert(uri_parent_string_parent != NULL); + + uri_parent_string = g_strdup_printf("%s:%s", uri->method_string, + uri_parent_string_parent); + g_assert(uri_parent_string != NULL); + + G_LOCK(uri_parent_string_hash); + volume = g_hash_table_lookup(uri_parent_string_hash, uri_parent_string); + G_UNLOCK(uri_parent_string_hash); + if (!volume) { + struct method_name_info *method_name_info; + + G_LOCK(method_name_hash); + method_name_info = g_hash_table_lookup(method_name_hash, + uri->method_string); + G_UNLOCK(method_name_hash); + if (!method_name_info) { + /* should not happend */ + g_return_val_if_reached(GNOME_VFS_ERROR_INVALID_URI); + } + + /* TODO: Generic GnomeVFS filter. */ + if (strcmp(uri->parent->method_string, "file")) { + g_free(uri_parent_string); + return GNOME_VFS_ERROR_INVALID_URI; + } + + if (!(volume = ntfs_mount(uri->parent->text, MS_RDONLY))) { + g_free(uri_parent_string); + return GNOME_VFS_ERROR_WRONG_FORMAT; + } + + G_LOCK(uri_parent_string_hash); + g_hash_table_insert(uri_parent_string_hash, + g_strdup(uri_parent_string), volume); + G_UNLOCK(uri_parent_string_hash); + } + g_free(uri_parent_string); + + *volume_return = volume; + return GNOME_VFS_OK; +} + +static GnomeVFSResult inode_open_by_pathname(ntfs_inode **inode_return, + ntfs_volume *volume, const gchar *pathname) +{ + MFT_REF mref; + ntfs_inode *inode; + gchar *pathname_parse, *pathname_next; + int errint; + + g_return_val_if_fail(inode_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(volume != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(pathname != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + + pathname = g_path_skip_root(pathname); + pathname_parse = g_alloca(strlen(pathname) + 1); + strcpy(pathname_parse, pathname); + mref = FILE_root; + for (;;) { + ntfschar *pathname_parse_ucs2; + gchar *pathname_parse_unescaped; + int i; + + G_LOCK(libntfs); + inode = ntfs_inode_open(volume, mref); + G_UNLOCK(libntfs); + if (!inode) + return GNOME_VFS_ERROR_NOT_FOUND; + if (!*pathname_parse) { + *inode_return = inode; + return GNOME_VFS_OK; + } + for (pathname_next = pathname_parse; *pathname_next && + *pathname_next != G_DIR_SEPARATOR; pathname_next++) ; + if (*pathname_next) { + /* terminate current path element */ + *pathname_next++ = '\0'; + } + while (*pathname_next == G_DIR_SEPARATOR) + pathname_next++; + /* FIXME: Is 'pathname' utf8? */ + pathname_parse_unescaped = gnome_vfs_unescape_string( + pathname_parse, NULL); /* illegal_characters */ + libntfs_newn(pathname_parse_ucs2, + strlen(pathname_parse_unescaped) + 1); + for (i = 0; pathname_parse_unescaped[i]; i++) + pathname_parse_ucs2[i] = pathname_parse_unescaped[i]; + pathname_parse_ucs2[i] = 0; + g_free(pathname_parse_unescaped); + G_LOCK(libntfs); + mref = ntfs_inode_lookup_by_name(inode, pathname_parse_ucs2, i); + G_UNLOCK(libntfs); + g_free(pathname_parse_ucs2); + if ((MFT_REF)-1 == mref) + return GNOME_VFS_ERROR_NOT_FOUND; + G_LOCK(libntfs); + errint = ntfs_inode_close(inode); + G_UNLOCK(libntfs); + if (errint) + g_return_val_if_reached(GNOME_VFS_ERROR_INTERNAL); + pathname_parse = pathname_next; + } + /* NOTREACHED */ +} + +struct libntfs_directory { + ntfs_inode *inode; + GList *file_info_list; /* of (GnomeVFSFileInfo *); last item has ->data == NULL */ +}; + +static GnomeVFSResult libntfs_gnomevfs_open_directory(GnomeVFSMethod *method, + GnomeVFSMethodHandle **method_handle, GnomeVFSURI *uri, + GnomeVFSFileInfoOptions options, GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + ntfs_volume *volume; + ntfs_inode *inode; + struct libntfs_directory *libntfs_directory; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(method_handle != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (GNOME_VFS_OK != (errvfsresult = + libntfs_gnomevfs_uri_parent_init(&volume, uri))) + return errvfsresult; + + if (GNOME_VFS_OK != (errvfsresult = inode_open_by_pathname(&inode, + volume, uri->text))) + return errvfsresult; + + libntfs_new(libntfs_directory); + libntfs_directory->inode = inode; + libntfs_directory->file_info_list = NULL; + + *method_handle = (GnomeVFSMethodHandle *)libntfs_directory; + return errvfsresult; +} + +static GnomeVFSResult libntfs_gnomevfs_close_directory(GnomeVFSMethod *method, + GnomeVFSMethodHandle *method_handle, GnomeVFSContext *context) +{ + struct libntfs_directory *libntfs_directory; + int errint; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_directory = (struct libntfs_directory *)method_handle; + g_return_val_if_fail(libntfs_directory != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + G_LOCK(libntfs); + errint = ntfs_inode_close(libntfs_directory->inode); + G_UNLOCK(libntfs); + if (errint) + g_return_val_if_reached(GNOME_VFS_ERROR_INTERNAL); + + if (libntfs_directory->file_info_list) { + GList *last_l; + + /* + * Prevent gnome_vfs_file_info_list_free() and its + * gnome_vfs_file_info_unref() on the last 'file_info_list' + * items as it is EOF with NULL '->data'. + */ + last_l = g_list_last(libntfs_directory->file_info_list); + g_assert(last_l->data == NULL); + libntfs_directory->file_info_list = g_list_delete_link( + libntfs_directory->file_info_list, last_l); + gnome_vfs_file_info_list_free( + libntfs_directory->file_info_list); + } + + g_free(libntfs_directory); + + return GNOME_VFS_OK; +} + +static gchar *libntfs_ntfscharo_utf8(const ntfschar *name, const int name_len) +{ + GString *gstring; + int i; + + gstring = g_string_sized_new(name_len); + for (i = 0; i < name_len; i++) + gstring = g_string_append_unichar(gstring, name[i]); + return g_string_free(gstring, /* returns utf8-formatted string */ + FALSE); /* free_segment */ +} + +/* + * Do not lock 'libntfs' here as we are already locked inside ntfs_readdir(). + */ +static int libntfs_gnomevfs_read_directory_filldir( + struct libntfs_directory *libntfs_directory /* dirent */, + const ntfschar *name, const int name_len, const int name_type, + const s64 pos, const MFT_REF mref, const unsigned dt_type) +{ + GnomeVFSFileInfo *file_info; + + g_return_val_if_fail(libntfs_directory != NULL, -1); + g_return_val_if_fail(name != NULL, -1); + g_return_val_if_fail(name_len >= 0, -1); + g_return_val_if_fail(pos >= 0, -1); + + /* system directory; FIXME: What is its proper identification? */ + if (name_len > 0 && name[0] == '$') + return 0; /* continue traversal */ + + file_info = gnome_vfs_file_info_new(); + file_info->name = libntfs_ntfscharo_utf8(name, name_len); + file_info->valid_fields = 0; + + switch (dt_type) { + case NTFS_DT_FIFO: + file_info->type = GNOME_VFS_FILE_TYPE_FIFO; + break; + case NTFS_DT_CHR: + file_info->type = GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE; + break; + case NTFS_DT_DIR: + file_info->type = GNOME_VFS_FILE_TYPE_DIRECTORY; + break; + case NTFS_DT_BLK: + file_info->type = GNOME_VFS_FILE_TYPE_BLOCK_DEVICE; + break; + case NTFS_DT_REG: + file_info->type = GNOME_VFS_FILE_TYPE_REGULAR; + break; + case NTFS_DT_LNK: + file_info->type = GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK; + break; + case NTFS_DT_SOCK: + file_info->type = GNOME_VFS_FILE_TYPE_SOCKET; + break; + /* FIXME: What is 'NTFS_DT_WHT'? */ + default: + file_info->type = GNOME_VFS_FILE_TYPE_UNKNOWN; + } + if (file_info->type != GNOME_VFS_FILE_TYPE_UNKNOWN) + file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_TYPE; + + /* Detect 'file_info->size': */ + if (file_info->type == GNOME_VFS_FILE_TYPE_REGULAR) { + ntfs_inode *inode; + + inode = ntfs_inode_open(libntfs_directory->inode->vol, mref); + /* FIXME: Check failed 'inode' open. */ + if (inode) { + ntfs_attr *attr; + int errint; + + attr = ntfs_attr_open(inode, /* ni */ + AT_DATA, /* type */ + NULL, /* name */ + 0); /* name_len */ + /* FIXME: Check failed 'attr' open. */ + if (attr) { + /* FIXME: Is 'data_size' the right field? */ + file_info->size = attr->data_size; + file_info->valid_fields |= + GNOME_VFS_FILE_INFO_FIELDS_SIZE; + ntfs_attr_close(attr); + } + errint = ntfs_inode_close(inode); + /* FIXME: Check 'errint'. */ + } + } + + libntfs_directory->file_info_list = g_list_prepend( + libntfs_directory->file_info_list, file_info); + + return 0; /* continue traversal */ +} + +static GnomeVFSResult libntfs_gnomevfs_read_directory(GnomeVFSMethod *method, + GnomeVFSMethodHandle *method_handle, + GnomeVFSFileInfo *file_info, GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + struct libntfs_directory *libntfs_directory; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_directory = (struct libntfs_directory *)method_handle; + g_return_val_if_fail(libntfs_directory != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(file_info != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (!libntfs_directory->file_info_list) { + int errint; + s64 pos; + + pos = 0; /* read from the start; incl. "." and ".." entries */ + G_LOCK(libntfs); + errint = ntfs_readdir(libntfs_directory->inode, /* dir_ni */ + &pos, /* pos */ + libntfs_directory, /* dirent */ + (ntfs_filldir_t)libntfs_gnomevfs_read_directory_filldir); /* filldir */ + G_UNLOCK(libntfs); + if (errint) + return GNOME_VFS_ERROR_INTERNAL; + + libntfs_directory->file_info_list = g_list_prepend( + libntfs_directory->file_info_list, NULL); /* EOF */ + libntfs_directory->file_info_list = g_list_reverse( + libntfs_directory->file_info_list); + } + + if (!libntfs_directory->file_info_list->data) { + g_assert(libntfs_directory->file_info_list->next == NULL); + /* + * Do not clear the list to leave us stuck at EOF - GnomeVFS + * behaves that way. + */ + errvfsresult = GNOME_VFS_ERROR_EOF; + } else { + /* Cut first list item. */ + gnome_vfs_file_info_copy(file_info, /* dest */ + libntfs_directory->file_info_list->data); /* src */ + gnome_vfs_file_info_unref( + libntfs_directory->file_info_list->data); + libntfs_directory->file_info_list = g_list_delete_link( + libntfs_directory->file_info_list, + libntfs_directory->file_info_list); + errvfsresult = GNOME_VFS_OK; + } + return errvfsresult; +} + +struct libntfs_file { + ntfs_inode *inode; + ntfs_attr *attr; + s64 pos; +}; + +static GnomeVFSResult libntfs_open_attr(struct libntfs_file *libntfs_file) +{ + g_return_val_if_fail(libntfs_file != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(libntfs_file->inode != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (!libntfs_file->attr) { + G_LOCK(libntfs); + libntfs_file->attr = ntfs_attr_open( + libntfs_file->inode, /* ni */ + AT_DATA, /* type */ + NULL, /* name */ + 0); /* name_len */ + G_UNLOCK(libntfs); + if (!libntfs_file->attr) + return GNOME_VFS_ERROR_BAD_FILE; + libntfs_file->pos = 0; + } + + return GNOME_VFS_OK; +} + +static GnomeVFSResult libntfs_gnomevfs_open(GnomeVFSMethod *method, + GnomeVFSMethodHandle **method_handle_return, GnomeVFSURI *uri, + GnomeVFSOpenMode mode, GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + ntfs_volume *volume; + ntfs_inode *inode; + struct libntfs_file *libntfs_file; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(method_handle_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (GNOME_VFS_OK != (errvfsresult = + libntfs_gnomevfs_uri_parent_init(&volume, uri))) + return errvfsresult; + + if (mode & GNOME_VFS_OPEN_WRITE) + return GNOME_VFS_ERROR_READ_ONLY_FILE_SYSTEM; + + if (GNOME_VFS_OK != (errvfsresult = + inode_open_by_pathname(&inode, volume, uri->text))) + return errvfsresult; + + libntfs_new(libntfs_file); + libntfs_file->inode = inode; + libntfs_file->attr = NULL; + + *method_handle_return = (GnomeVFSMethodHandle *)libntfs_file; + return errvfsresult; +} + +static GnomeVFSResult libntfs_gnomevfs_create(GnomeVFSMethod *method, + GnomeVFSMethodHandle **method_handle_return, GnomeVFSURI *uri, + GnomeVFSOpenMode mode, gboolean exclusive, guint perm, + GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + ntfs_volume *volume; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(method_handle_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (GNOME_VFS_OK != (errvfsresult = + libntfs_gnomevfs_uri_parent_init(&volume, uri))) + return errvfsresult; + + return GNOME_VFS_ERROR_READ_ONLY_FILE_SYSTEM; +} + +static GnomeVFSResult libntfs_gnomevfs_close(GnomeVFSMethod *method, + GnomeVFSMethodHandle *method_handle, GnomeVFSContext *context) +{ + struct libntfs_file *libntfs_file; + int errint; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_file = (struct libntfs_file *) method_handle; + g_return_val_if_fail(libntfs_file != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (libntfs_file->attr) { + G_LOCK(libntfs); + ntfs_attr_close(libntfs_file->attr); + G_UNLOCK(libntfs); + } + G_LOCK(libntfs); + errint = ntfs_inode_close(libntfs_file->inode); + G_UNLOCK(libntfs); + if (errint) + g_return_val_if_reached(GNOME_VFS_ERROR_INTERNAL); + + g_free(libntfs_file); + + return GNOME_VFS_OK; +} + +static GnomeVFSResult libntfs_gnomevfs_read(GnomeVFSMethod *method, + GnomeVFSMethodHandle *method_handle, gpointer buffer, + GnomeVFSFileSize num_bytes, GnomeVFSFileSize *bytes_read_return, + GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + struct libntfs_file *libntfs_file; + s64 count_s64, got; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_file = (struct libntfs_file *)method_handle; + g_return_val_if_fail(libntfs_file != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(buffer != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(bytes_read_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (GNOME_VFS_OK != (errvfsresult = libntfs_open_attr(libntfs_file))) + return errvfsresult; + + count_s64 = num_bytes; + g_assert((GnomeVFSFileSize)count_s64 == num_bytes); + G_LOCK(libntfs); + got = ntfs_attr_pread(libntfs_file->attr, libntfs_file->pos, count_s64, + buffer); + G_UNLOCK(libntfs); + if (got == -1) + return GNOME_VFS_ERROR_IO; + + libntfs_file->pos += got; + *bytes_read_return = got; + g_assert((s64)*bytes_read_return == got); + + return GNOME_VFS_OK; +} + +static GnomeVFSResult libntfs_gnomevfs_seek(GnomeVFSMethod *method, + GnomeVFSMethodHandle *method_handle, + GnomeVFSSeekPosition whence, GnomeVFSFileOffset offset, + GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + struct libntfs_file *libntfs_file; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_file = (struct libntfs_file *)method_handle; + g_return_val_if_fail(libntfs_file != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (GNOME_VFS_OK != (errvfsresult = libntfs_open_attr(libntfs_file))) + return errvfsresult; + + switch (whence) { + case GNOME_VFS_SEEK_START: + libntfs_file->pos = offset; + break; + case GNOME_VFS_SEEK_CURRENT: + libntfs_file->pos += offset; + break; + case GNOME_VFS_SEEK_END: + /* FIXME: NOT IMPLEMENTED YET */ + g_return_val_if_reached(GNOME_VFS_ERROR_BAD_PARAMETERS); + default: + g_assert_not_reached(); + } + + return GNOME_VFS_OK; +} + +static GnomeVFSResult libntfs_gnomevfs_tell(GnomeVFSMethod *method, + GnomeVFSMethodHandle *method_handle, + GnomeVFSFileOffset *offset_return) +{ + GnomeVFSResult errvfsresult; + struct libntfs_file *libntfs_file; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_file = (struct libntfs_file *)method_handle; + g_return_val_if_fail(libntfs_file != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(offset_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + if (GNOME_VFS_OK != (errvfsresult = libntfs_open_attr(libntfs_file))) + return errvfsresult; + + *offset_return = libntfs_file->pos; + g_assert(*offset_return == libntfs_file->pos); + + return errvfsresult; +} + +static gboolean libntfs_gnomevfs_is_local(GnomeVFSMethod *method, + const GnomeVFSURI *uri) +{ + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(uri != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + + return gnome_vfs_uri_is_local(uri->parent); +} + +GnomeVFSResult libntfs_gnomevfs_get_file_info_from_handle( + GnomeVFSMethod *method, GnomeVFSMethodHandle *method_handle, + GnomeVFSFileInfo *file_info, GnomeVFSFileInfoOptions options, + GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + struct libntfs_file *libntfs_file; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + libntfs_file = (struct libntfs_file *)method_handle; + g_return_val_if_fail(libntfs_file != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(file_info != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + /* handle 'options & GNOME_VFS_FILE_INFO_GET_MIME_TYPE'? */ + + file_info->valid_fields = 0; + /* FIXME: It is complicated to read filename of open 'ntfs_inode'. */ + file_info->name = NULL; + + if (GNOME_VFS_OK != (errvfsresult = libntfs_open_attr(libntfs_file))) { + /* Assume we are directory: */ + file_info->type = GNOME_VFS_FILE_TYPE_DIRECTORY; + /* + * Do not: file_info->valid_fields |= + * GNOME_VFS_FILE_INFO_FIELDS_TYPE; + * as gnome-vfs-xfer.c/copy_items() does not check + * 'GNOME_VFS_FILE_INFO_FIELDS_TYPE' and we are just bluffing + * we know it. + */ + return GNOME_VFS_OK; + } + + /* FIXME: Is 'data_size' the right field? */ + file_info->size = libntfs_file->attr->data_size; + file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_SIZE; + + /* + * FIXME: We do not really know the type of 'libntfs_file' but + * gnome-vfs-xfer.c/copy_items() requires 'GNOME_VFS_FILE_TYPE_REGULAR' + * to copy it. + */ + file_info->type = GNOME_VFS_FILE_TYPE_REGULAR; + /* + * Do not: file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_TYPE; + * as gnome-vfs-xfer.c/copy_items() does not check + * 'GNOME_VFS_FILE_INFO_FIELDS_TYPE' and we are just bluffing we know + * it. + */ + + return errvfsresult; +} + +static GnomeVFSResult libntfs_gnomevfs_get_file_info(GnomeVFSMethod *method, + GnomeVFSURI *uri, GnomeVFSFileInfo *file_info, + GnomeVFSFileInfoOptions options, GnomeVFSContext *context) +{ + GnomeVFSResult errvfsresult; + GnomeVFSMethodHandle *method_handle; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(file_info != NULL, GNOME_VFS_ERROR_BAD_PARAMETERS); + /* handle 'options & GNOME_VFS_FILE_INFO_GET_MIME_TYPE'? */ + + if (GNOME_VFS_OK != (errvfsresult = + libntfs_gnomevfs_open(method, &method_handle, uri, + GNOME_VFS_OPEN_READ, context))) + return errvfsresult; + if (GNOME_VFS_OK != (errvfsresult = + libntfs_gnomevfs_get_file_info_from_handle(method, + method_handle, file_info, options, context))) + return errvfsresult; + if (GNOME_VFS_OK != (errvfsresult = + libntfs_gnomevfs_close(method, method_handle, context))) + return errvfsresult; + + return GNOME_VFS_OK; +} + +GnomeVFSResult libntfs_gnomevfs_check_same_fs(GnomeVFSMethod *method, + GnomeVFSURI *a, GnomeVFSURI *b, gboolean *same_fs_return, + GnomeVFSContext *context) +{ + ntfs_volume *volume_a; + ntfs_volume *volume_b; + GnomeVFSResult errvfsresult; + + g_return_val_if_fail(method == &GnomeVFSMethod_static, + GNOME_VFS_ERROR_BAD_PARAMETERS); + g_return_val_if_fail(same_fs_return != NULL, + GNOME_VFS_ERROR_BAD_PARAMETERS); + + errvfsresult = libntfs_gnomevfs_uri_parent_init(&volume_a, a); + g_return_val_if_fail(errvfsresult == GNOME_VFS_OK, errvfsresult); + + errvfsresult = libntfs_gnomevfs_uri_parent_init(&volume_b, b); + g_return_val_if_fail(errvfsresult == GNOME_VFS_OK, errvfsresult); + + *same_fs_return = (volume_a == volume_b); + + return GNOME_VFS_OK; +} + +/** + * libntfs_gnomevfs_init: + * + * Returns: Initialized structure of #GnomeVFSMethod with static methods of + * libntfs-gnomevfs. + */ +GnomeVFSMethod *libntfs_gnomevfs_method_init(const gchar *method_name, + const gchar *args) +{ + struct method_name_info *method_name_info; + + g_return_val_if_fail(method_name != NULL, NULL); + /* 'args' may be NULL if not supplied. */ + + method_name_hash_init(); + + G_LOCK(method_name_hash); + method_name_info = g_hash_table_lookup(method_name_hash, method_name); + if (method_name_info && strcmp(method_name_info->args, args)) + method_name_info = NULL; + G_UNLOCK(method_name_hash); + if (!method_name_info) { + libntfs_new(method_name_info); + method_name_info->args = g_strdup(args); + G_LOCK(method_name_hash); + g_hash_table_replace(method_name_hash, g_strdup(method_name), + method_name_info); + G_UNLOCK(method_name_hash); + } + + G_LOCK(GnomeVFSMethod_static); + LIBNTFS_MEMZERO(&GnomeVFSMethod_static); + GnomeVFSMethod_static.method_table_size = sizeof(GnomeVFSMethod_static); + GnomeVFSMethod_static.open = libntfs_gnomevfs_open; /* mandatory */ + GnomeVFSMethod_static.create = libntfs_gnomevfs_create; /* mandatory */ + GnomeVFSMethod_static.close = libntfs_gnomevfs_close; + GnomeVFSMethod_static.read = libntfs_gnomevfs_read; + GnomeVFSMethod_static.seek = libntfs_gnomevfs_seek; + GnomeVFSMethod_static.tell = libntfs_gnomevfs_tell; + GnomeVFSMethod_static.open_directory = libntfs_gnomevfs_open_directory; + GnomeVFSMethod_static.close_directory = + libntfs_gnomevfs_close_directory; + GnomeVFSMethod_static.read_directory = libntfs_gnomevfs_read_directory; + GnomeVFSMethod_static.get_file_info = + libntfs_gnomevfs_get_file_info; /* mandatory */ + GnomeVFSMethod_static.get_file_info_from_handle = + libntfs_gnomevfs_get_file_info_from_handle; + GnomeVFSMethod_static.is_local = + libntfs_gnomevfs_is_local; /* mandatory */ + GnomeVFSMethod_static.check_same_fs = libntfs_gnomevfs_check_same_fs; + /* TODO: GnomeVFSMethodFindDirectoryFunc find_directory; */ + /* TODO: GnomeVFSMethodFileControlFunc file_control; */ + /* R/W: GnomeVFSMethodCreateSymbolicLinkFunc create_symbolic_link; */ + /* R/W: GnomeVFSMethodMonitorAddFunc monitor_add; */ + /* R/W: GnomeVFSMethodMonitorCancelFunc monitor_cancel; */ + /* R/W: GnomeVFSMethod_static.write; */ + /* R/W: GnomeVFSMethod_static.truncate_handle; */ + /* R/W: GnomeVFSMethod_static.make_directory; */ + /* R/W: GnomeVFSMethod_static.remove_directory; */ + /* R/W: GnomeVFSMethod_static.move; */ + /* R/W: GnomeVFSMethod_static.unlink; */ + /* R/W: GnomeVFSMethod_static.set_file_info; */ + /* R/W: GnomeVFSMethod_static.truncate; */ + G_UNLOCK(GnomeVFSMethod_static); + + return &GnomeVFSMethod_static; +} + +/** + * libntfs_gnomevfs_method_shutdown: + * + * Shutdowns libntfs-gnomevfs successfuly flushing all caches. + * + * Sad note about gnome-vfs-2.1.5 is that it never calls this function. :-) + */ +void libntfs_gnomevfs_method_shutdown(void) +{ + uri_parent_string_hash_init(); + G_LOCK(uri_parent_string_hash); + g_hash_table_destroy(uri_parent_string_hash); + uri_parent_string_hash = NULL; + G_UNLOCK(uri_parent_string_hash); + + method_name_hash_init(); + G_LOCK(method_name_hash); + g_hash_table_destroy(method_name_hash); + method_name_hash = NULL; + G_UNLOCK(method_name_hash); +} + diff --git a/libntfs/unistr.c b/libntfs/unistr.c index cfb78f24..8122d873 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -71,10 +71,10 @@ const u8 legal_ansi_char_array[0x40] = { * identical, or FALSE (0) if they are not identical. If @ic is IGNORE_CASE, * the @upcase table is used to performa a case insensitive comparison. */ -BOOL ntfs_names_are_equal(const uchar_t *s1, size_t s1_len, - const uchar_t *s2, size_t s2_len, +BOOL ntfs_names_are_equal(const ntfschar *s1, size_t s1_len, + const ntfschar *s2, size_t s2_len, const IGNORE_CASE_BOOL ic, - const uchar_t *upcase, const u32 upcase_size) + const ntfschar *upcase, const u32 upcase_size) { if (s1_len != s2_len) return FALSE; @@ -104,13 +104,13 @@ BOOL ntfs_names_are_equal(const uchar_t *s1, size_t s1_len, * * The following characters are considered invalid: '"', '*', '<', '>' and '?'. */ -int ntfs_names_collate(const uchar_t *name1, const u32 name1_len, - const uchar_t *name2, const u32 name2_len, +int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, + const ntfschar *name2, const u32 name2_len, const int err_val, const IGNORE_CASE_BOOL ic, - const uchar_t *upcase, const u32 upcase_len) + const ntfschar *upcase, const u32 upcase_len) { u32 cnt; - uchar_t c1, c2; + ntfschar c1, c2; #ifdef DEBUG if (!name1 || !name2 || (ic && !upcase && upcase_len)) { @@ -160,9 +160,9 @@ int ntfs_names_collate(const uchar_t *name1, const u32 name1_len, * if @s1 (or the first @n Unicode characters thereof) is found, respectively, * to be less than, to match, or be greater than @s2. */ -int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n) +int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n) { - uchar_t c1, c2; + ntfschar c1, c2; size_t i; #ifdef DEBUG @@ -202,10 +202,10 @@ int ntfs_ucsncmp(const uchar_t *s1, const uchar_t *s2, size_t n) * if @s1 (or the first @n Unicode characters thereof) is found, respectively, * to be less than, to match, or be greater than @s2. */ -int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, - const uchar_t *upcase, const u32 upcase_size) +int ntfs_ucsncasecmp(const ntfschar *s1, const ntfschar *s2, size_t n, + const ntfschar *upcase, const u32 upcase_size) { - uchar_t c1, c2; + ntfschar c1, c2; size_t i; #ifdef DEBUG @@ -236,12 +236,12 @@ int ntfs_ucsncasecmp(const uchar_t *s1, const uchar_t *s2, size_t n, * * Return the number of Unicode characters in the little endian Unicode * string @s up to a maximum of maxlen Unicode characters, not including - * the terminating (uchar_t)'\0'. If there is no (uchar_t)'\0' between @s + * the terminating (ntfschar)'\0'. If there is no (ntfschar)'\0' between @s * and @s + @maxlen, @maxlen is returned. * * This function never looks beyond @s + @maxlen. */ -u32 ntfs_ucsnlen(const uchar_t *s, u32 maxlen) +u32 ntfs_ucsnlen(const ntfschar *s, u32 maxlen) { u32 i; @@ -255,11 +255,11 @@ u32 ntfs_ucsnlen(const uchar_t *s, u32 maxlen) /** * ntfs_name_upcase */ -void ntfs_name_upcase(uchar_t *name, u32 name_len, const uchar_t *upcase, +void ntfs_name_upcase(ntfschar *name, u32 name_len, const ntfschar *upcase, const u32 upcase_len) { u32 i; - uchar_t u; + ntfschar u; for (i = 0; i < name_len; i++) if ((u = le16_to_cpu(name[i])) < upcase_len) @@ -270,9 +270,9 @@ void ntfs_name_upcase(uchar_t *name, u32 name_len, const uchar_t *upcase, * ntfs_file_value_upcase */ void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, - const uchar_t *upcase, const u32 upcase_len) + const ntfschar *upcase, const u32 upcase_len) { - ntfs_name_upcase((uchar_t*)&file_name_attr->file_name, + ntfs_name_upcase((ntfschar*)&file_name_attr->file_name, file_name_attr->file_name_length, upcase, upcase_len); } @@ -282,11 +282,11 @@ void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, int ntfs_file_values_compare(FILE_NAME_ATTR *file_name_attr1, FILE_NAME_ATTR *file_name_attr2, const int err_val, const IGNORE_CASE_BOOL ic, - const uchar_t *upcase, const u32 upcase_len) + const ntfschar *upcase, const u32 upcase_len) { - return ntfs_names_collate((uchar_t*)&file_name_attr1->file_name, + return ntfs_names_collate((ntfschar*)&file_name_attr1->file_name, file_name_attr1->file_name_length, - (uchar_t*)&file_name_attr2->file_name, + (ntfschar*)&file_name_attr2->file_name, file_name_attr2->file_name_length, err_val, ic, upcase, upcase_len); } @@ -316,7 +316,7 @@ int ntfs_file_values_compare(FILE_NAME_ATTR *file_name_attr1, * ENAMETOOLONG Destination buffer is too small for input string. * ENOMEM Not enough memory to allocate destination buffer. */ -int ntfs_ucstombs(const uchar_t *ins, const int ins_len, char **outs, +int ntfs_ucstombs(const ntfschar *ins, const int ins_len, char **outs, int outs_len) { char *mbs; @@ -429,9 +429,9 @@ err_out: * ENAMETOOLONG Destination buffer is too small for input string. * ENOMEM Not enough memory to allocate destination buffer. */ -int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len) +int ntfs_mbstoucs(const char *ins, ntfschar **outs, int outs_len) { - uchar_t *ucs; + ntfschar *ucs; const char *s; wchar_t wc; int i, o, cnt, ins_len, ucs_len; @@ -480,7 +480,7 @@ int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len) ins_len++; if (!ucs) { ucs_len = ins_len; - ucs = (uchar_t*)malloc(ucs_len * sizeof(uchar_t)); + ucs = (ntfschar*)malloc(ucs_len * sizeof(ntfschar)); if (!ucs) return -1; } @@ -492,7 +492,7 @@ int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len) for (i = o = cnt = 0; o < ins_len; i += cnt, o++) { /* Reallocate memory if necessary or abort. */ if (o >= ucs_len) { - uchar_t *tc; + ntfschar *tc; if (ucs == *outs) { errno = ENAMETOOLONG; return -1; @@ -501,12 +501,12 @@ int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len) * We will never get here but hey, it's only a bit of * extra code... */ - ucs_len = (ucs_len * sizeof(uchar_t) + 64) & ~63; - tc = (uchar_t*)realloc(ucs, ucs_len); + ucs_len = (ucs_len * sizeof(ntfschar) + 64) & ~63; + tc = (ntfschar*)realloc(ucs, ucs_len); if (!tc) goto err_out; ucs = tc; - ucs_len /= sizeof(uchar_t); + ucs_len /= sizeof(ntfschar); } /* Convert the multibyte character to a wide character. */ #ifdef HAVE_MBSINIT @@ -525,7 +525,7 @@ int ntfs_mbstoucs(const char *ins, uchar_t **outs, int outs_len) } /* Make sure we are not overflowing the NTFS Unicode set. */ if ((unsigned long)wc >= (unsigned long)(1 << - (8 * sizeof(uchar_t)))) { + (8 * sizeof(ntfschar)))) { errno = EILSEQ; goto err_out; } diff --git a/libntfs/volume.c b/libntfs/volume.c index eb426a86..e82fb056 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -594,7 +594,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) ntfs_attr *na; ATTR_RECORD *a; VOLUME_INFORMATION *vinf; - uchar_t *vname; + ntfschar *vname; int i, j, eo; u32 u; @@ -732,7 +732,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) goto error_exit; } vol->upcase_len = na->data_size >> 1; - vol->upcase = (uchar_t*)malloc(na->data_size); + vol->upcase = (ntfschar*)malloc(na->data_size); if (!vol->upcase) { Dputs(FAILED); Dputs("Not enough memory to load $UpCase."); @@ -844,7 +844,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) goto error_exit; } /* Get a pointer to the value of the attribute. */ - vname = (uchar_t*)(le16_to_cpu(a->value_offset) + (char*)a); + vname = (ntfschar*)(le16_to_cpu(a->value_offset) + (char*)a); u = le32_to_cpu(a->value_length) / 2; /* * Convert Unicode volume name to current locale multibyte @@ -864,9 +864,9 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) goto error_exit; } for (j = 0; j < (s32)u; j++) { - uchar_t uc = le16_to_cpu(vname[j]); + ntfschar uc = le16_to_cpu(vname[j]); if (uc > 0xff) - uc = (uchar_t)'_'; + uc = (ntfschar)'_'; vol->vol_name[j] = (char)uc; } vol->vol_name[u] = '\0'; diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 17db6f67..97284d17 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -137,7 +137,7 @@ extern const unsigned char attrdef_ntfs12_array[2400]; extern const unsigned char boot_array[3429]; extern void init_system_file_sd(int sys_file_no, char **sd_val, int *sd_val_len); -extern void init_upcase_table(uchar_t *uc, u32 uc_len); +extern void init_upcase_table(ntfschar *uc, u32 uc_len); /* Page size on ia32. Can change to 8192 on Alpha. */ #define NTFS_PAGE_SIZE 4096 @@ -193,7 +193,7 @@ struct { bad clusters from. */ ATTR_DEF *attr_defs; /* filename, attribute defs. */ int attr_defs_len; /* in bytes */ - uchar_t *upcase; /* filename, upcase table. */ + ntfschar *upcase; /* filename, upcase table. */ u32 upcase_len; /* Determined automatically. */ int quiet; /* -q, quiet execution. */ int verbose; /* -v, verbose execution, given twice, @@ -571,9 +571,9 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, * terminating null byte. If a unicode character was encountered which could * not be converted -1 is returned. */ -static int ucstos(char *dest, const uchar_t *src, int maxlen) +static int ucstos(char *dest, const ntfschar *src, int maxlen) { - uchar_t u; + ntfschar u; int i; /* Need one byte for null terminator. */ @@ -603,17 +603,17 @@ static int ucstos(char *dest, const uchar_t *src, int maxlen) * write the terminating null unicode character and hence return -1 with errno * set to EINVAL. */ -static int stoucs(uchar_t *dest, const char *src, int maxlen) +static int stoucs(ntfschar *dest, const char *src, int maxlen) { char c; int i; - if (maxlen < (int)sizeof(uchar_t)) { + if (maxlen < (int)sizeof(ntfschar)) { errno = EINVAL; return -1; } /* Convert maxlen from bytes to unicode characters. */ - maxlen /= sizeof(uchar_t); + maxlen /= sizeof(ntfschar); /* Need space for null terminator. */ maxlen--; for (i = 0; i < maxlen; i++) { @@ -666,7 +666,7 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) if (!buf) err_exit("Failed to allocate internal buffer: " "%s\n", strerror(errno)); - i = ucstos(buf, (uchar_t*)val, val_len); + i = ucstos(buf, (ntfschar*)val, val_len); if (i == -1) printf("Volume name contains non-displayable " "Unicode characters.\n"); @@ -881,7 +881,7 @@ static void dump_attr_record(ATTR_RECORD *a) cpu_to_le16(a->name_offset)); u = a->flags; if (a->name_length) { - if (ucstos(s, (uchar_t*)((char*)a + + if (ucstos(s, (ntfschar*)((char*)a + cpu_to_le16(a->name_offset)), min(sizeof(s), a->name_length + 1U)) == -1) { Eprintf("Could not convert Unicode string to single " @@ -1162,15 +1162,15 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, int asize, mpa_size, err, i; s64 bw = 0, inited_size; VCN highest_vcn; - uchar_t *uname; + ntfschar *uname; /* if (base record) attr_lookup(); else */ if (name_len) { - i = (name_len + 1) * sizeof(uchar_t); - uname = (uchar_t*)calloc(1, i); + i = (name_len + 1) * sizeof(ntfschar); + uname = (ntfschar*)calloc(1, i); if (!uname) return -errno; name_len = stoucs(uname, name, i); @@ -1347,15 +1347,15 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, int asize, mpa_size, err, i; runlist *rl = NULL; s64 bw = 0; - uchar_t *uname; + ntfschar *uname; /* if (base record) attr_lookup(); else */ if (name_len) { - i = (name_len + 1) * sizeof(uchar_t); - uname = (uchar_t*)calloc(1, i); + i = (name_len + 1) * sizeof(ntfschar); + uname = (ntfschar*)calloc(1, i); if (!uname) return -errno; name_len = stoucs(uname, name, i); @@ -1536,15 +1536,15 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; int asize, err, i; - uchar_t *uname; + ntfschar *uname; /* if (base record) ntfs_attr_lookup(); else */ if (name_len) { - i = (name_len + 1) * sizeof(uchar_t); - uname = (uchar_t*)calloc(1, i); + i = (name_len + 1) * sizeof(ntfschar); + uname = (ntfschar*)calloc(1, i); name_len = stoucs(uname, name, i); if (name_len > 0xff) return -ENAMETOOLONG; @@ -1695,7 +1695,7 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, } si = (STANDARD_INFORMATION*)((char*)ctx->attr + le16_to_cpu(ctx->attr->value_offset)); - i = (strlen(file_name) + 1) * sizeof(uchar_t); + i = (strlen(file_name) + 1) * sizeof(ntfschar); fn_size = sizeof(FILE_NAME_ATTR) + i; fn = (FILE_NAME_ATTR*)malloc(fn_size); if (!fn) { @@ -1735,7 +1735,7 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, } /* No terminating null in file names. */ fn->file_name_length = i; - fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(uchar_t); + fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(ntfschar); i = insert_resident_attr_in_mft_record(m, AT_FILE_NAME, NULL, 0, 0, 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size); free(fn); @@ -1833,7 +1833,7 @@ static int add_attr_data_positioned(MFT_RECORD *m, const char *name, * Create volume name attribute specifying the volume name @vol_name as a null * terminated char string of length @vol_name_len (number of characters not * including the terminating null), which is converted internally to a little - * endian uchar_t string. The name is at least 1 character long and at most + * endian ntfschar string. The name is at least 1 character long and at most * 0xff characters long (not counting the terminating null). * * Return 0 on success or -errno on error. @@ -1841,15 +1841,15 @@ static int add_attr_data_positioned(MFT_RECORD *m, const char *name, static int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, const int vol_name_len) { - uchar_t *uname; + ntfschar *uname; int i, len; if (vol_name_len) { - len = (vol_name_len + 1) * sizeof(uchar_t); + len = (vol_name_len + 1) * sizeof(ntfschar); uname = calloc(1, len); if (!uname) return -errno; - i = (stoucs(uname, vol_name, len) + 1) * sizeof(uchar_t); + i = (stoucs(uname, vol_name, len) + 1) * sizeof(ntfschar); if (!i) { free(uname); return -EINVAL; @@ -2053,14 +2053,14 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, INDEX_ROOT *r; INDEX_ENTRY *re; INDEX_ALLOCATION *ia_val = NULL; - uchar_t *uname; + ntfschar *uname; char bmp[8]; char *re_start, *re_end; int i, err, index_block_size; if (name_len) { - i = (name_len + 1) * sizeof(uchar_t); - uname = (uchar_t*)calloc(1, i); + i = (name_len + 1) * sizeof(ntfschar); + uname = (ntfschar*)calloc(1, i); if (!uname) return -errno; name_len = stoucs(uname, name, i); @@ -2289,7 +2289,7 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *index, MFT_REF file_ref, if (!__buf) err_exit("Failed to allocate internal buffer: " "%s\n", strerror(errno)); - i = ucstos(__buf, (uchar_t*)&file_name->file_name, + i = ucstos(__buf, (ntfschar*)&file_name->file_name, file_name->file_name_length + 1); if (i == -1) Dprintf("Name contains non-displayable " @@ -2399,7 +2399,7 @@ static int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, int i, fn_size; /* Create the file_name attribute. */ - i = (strlen(file_name) + 1) * sizeof(uchar_t); + i = (strlen(file_name) + 1) * sizeof(ntfschar); fn_size = sizeof(FILE_NAME_ATTR) + i; fn = (FILE_NAME_ATTR*)malloc(fn_size); if (!fn) @@ -2436,7 +2436,7 @@ static int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, } /* No terminating null in file names. */ fn->file_name_length = i; - fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(uchar_t); + fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(ntfschar); /* Increment the link count of @m_file. */ i = le16_to_cpu(m_file->link_count); if (i == 0xffff) { @@ -3621,10 +3621,10 @@ int main(int argc, char **argv) vol->mft_record_size_bits = 10; /* Length is in unicode characters. */ vol->upcase_len = 65536; - vol->upcase = (uchar_t*)malloc(vol->upcase_len * sizeof(uchar_t)); + vol->upcase = (ntfschar*)malloc(vol->upcase_len * sizeof(ntfschar)); if (!vol->upcase) err_exit("Could not allocate memory for internal buffer.\n"); - init_upcase_table(vol->upcase, vol->upcase_len * sizeof(uchar_t)); + init_upcase_table(vol->upcase, vol->upcase_len * sizeof(ntfschar)); /* Initialize opts to zero / required values. */ init_options(); /* Parse command line options. */ @@ -3666,7 +3666,7 @@ int main(int argc, char **argv) // update during each subsequent c&w of each system file. Vprintf("Syncing root directory index record.\n"); m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); - i = 5 * sizeof(uchar_t); + i = 5 * sizeof(ntfschar); ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) err_exit("Failed to allocate attribute search context: %s\n", diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index c16c5907..bd2d8834 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -210,7 +210,7 @@ static int parse_options (int argc, char **argv) /** * cat */ -static int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, uchar_t *name, int namelen) +static int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int namelen) { /* increase 1024 only if you fix partial writes below */ const int bufsize = 1024; diff --git a/ntfsprogs/ntfscluster.h b/ntfsprogs/ntfscluster.h index 1bf31474..afba3f39 100644 --- a/ntfsprogs/ntfscluster.h +++ b/ntfsprogs/ntfscluster.h @@ -53,7 +53,7 @@ struct options { struct match { u64 inum; /* Inode number */ ATTR_TYPES type; /* Attribute type */ - uchar_t *name; /* Attribute name */ + ntfschar *name; /* Attribute name */ int name_len; /* Length of attribute name */ LCN lcn; /* Last cluster in use */ }; diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 9c81294a..6b48294d 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -293,12 +293,12 @@ static char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) */ static char *ntfs_attr_get_name(ATTR_RECORD *attr) { - uchar_t *ucs_attr_name; + ntfschar *ucs_attr_name; char *mbs_attr_name = NULL; int mbs_attr_name_size; /* calculate name position */ - ucs_attr_name = (uchar_t *)((char *)attr + le16_to_cpu(attr->name_offset)); + ucs_attr_name = (ntfschar *)((char *)attr + le16_to_cpu(attr->name_offset)); /* convert unicode to printable format */ mbs_attr_name_size = ntfs_ucstombs(ucs_attr_name,attr->name_length, &mbs_attr_name,0); @@ -692,7 +692,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr) */ static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) { - uchar_t *ucs_vol_name = NULL; + ntfschar *ucs_vol_name = NULL; printf("Dumping attribute $VOLUME_NAME (0x60)\n"); @@ -700,11 +700,11 @@ static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) char *mbs_vol_name = NULL; int mbs_vol_name_size; /* calculate volume name position */ - ucs_vol_name = (uchar_t*)((u8*)attr + + ucs_vol_name = (ntfschar*)((u8*)attr + le16_to_cpu(attr->value_offset)); /* convert the name to current locale multibyte sequence */ mbs_vol_name_size = ntfs_ucstombs(ucs_vol_name, - le32_to_cpu(attr->value_length)/sizeof(uchar_t), + le32_to_cpu(attr->value_length)/sizeof(ntfschar), &mbs_vol_name,0); if (mbs_vol_name_size>0) { diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 3ad49878..51c5f7ea 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -249,7 +249,7 @@ static int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, BOOL force) { ntfs_attr_search_ctx *ctx = NULL; - uchar_t *new_label = NULL; + ntfschar *new_label = NULL; MFT_RECORD *mrec = NULL; ATTR_RECORD *a; int label_len; @@ -305,13 +305,13 @@ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, perror("Unable to convert label string to Unicode"); goto err_out; } - label_len *= sizeof(uchar_t); + label_len *= sizeof(ntfschar); if (label_len > 0x100) { fprintf(stderr, "New label is too long. Maximum %u characters " "allowed. Truncating excess characters.\n", - (unsigned)(0x100 / sizeof(uchar_t))); + (unsigned)(0x100 / sizeof(ntfschar))); label_len = 0x100; - new_label[label_len / sizeof(uchar_t)] = cpu_to_le16(L'\0'); + new_label[label_len / sizeof(ntfschar)] = cpu_to_le16(L'\0'); } if (a) { if (resize_resident_attribute_value(mrec, a, label_len)) { diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index ac1734c0..35072dfb 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -226,7 +226,7 @@ typedef struct { * list_entry * FIXME: Should we print errors as we go along? (AIA) */ -static int list_entry(ntfsls_dirent *dirent, const uchar_t *name, +static int list_entry(ntfsls_dirent *dirent, const ntfschar *name, const int name_len, const int name_type, const s64 pos, const MFT_REF mref, const unsigned dt_type) { @@ -379,7 +379,7 @@ int main(int argc, char **argv) FILE_NAME_ATTR *attr; ntfs_attr_search_ctx *ctx; int space = 4; - uchar_t *name = NULL; + ntfschar *name = NULL; int name_len = 0;; ctx = ntfs_attr_get_search_ctx (NULL, ni->mrec); diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index f1f600fe..d334b6ee 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -441,7 +441,7 @@ done: */ static int dont_move (ntfs_inode *ino) { - static const uchar_t ntldr[6] = { + static const ntfschar ntldr[6] = { const_cpu_to_le16('n'), const_cpu_to_le16('t'), const_cpu_to_le16('l'), const_cpu_to_le16('d'), const_cpu_to_le16('r'), const_cpu_to_le16('\0') }; diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 335292c0..689a8b47 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -560,7 +560,7 @@ static s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) return bm_bsize; } -static int str2unicode(const char *aname, uchar_t **ustr, int *len) +static int str2unicode(const char *aname, ntfschar **ustr, int *len) { if (aname && ((*len = ntfs_mbstoucs(aname, ustr, 0)) == -1)) return -1; @@ -576,7 +576,7 @@ static int str2unicode(const char *aname, uchar_t **ustr, int *len) static int has_bad_sectors(ntfs_resize_t *resize) { int len, ret = 0; - uchar_t *ustr = NULL; + ntfschar *ustr = NULL; ATTR_RECORD *a = resize->ctx->attr; if (resize->ni->mft_no != FILE_BadClus) @@ -586,7 +586,7 @@ static int has_bad_sectors(ntfs_resize_t *resize) return -1; if (ustr && ntfs_names_are_equal(ustr, len, - (uchar_t*)((u8*)a + le16_to_cpu(a->name_offset)), + (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)), a->name_length, 0, NULL, 0)) ret = 1; @@ -1776,7 +1776,7 @@ static void lookup_data_attr(ntfs_volume *vol, ntfs_attr_search_ctx **ctx) { ntfs_inode *ni; - uchar_t *ustr = NULL; + ntfschar *ustr = NULL; int len = 0; if (!(ni = ntfs_inode_open(vol, mref))) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 8a048357..6c4efa31 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -71,7 +71,7 @@ BOOL success = FALSE; char *dev_name; s64 inode; u32 attr_type; -uchar_t *attr_name = NULL; +ntfschar *attr_name = NULL; u32 attr_name_len; s64 new_len; @@ -304,9 +304,9 @@ static void parse_options(int argc, char *argv[]) * terminating null byte. If a unicode character was encountered which could * not be converted -1 is returned. */ -static int ucstos(char *dest, const uchar_t *src, int maxlen) +static int ucstos(char *dest, const ntfschar *src, int maxlen) { - uchar_t u; + ntfschar u; int i; /* Need one byte for null terminator. */ @@ -364,7 +364,7 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) if (!buf) err_exit("Failed to allocate internal buffer: " "%s\n", strerror(errno)); - i = ucstos(buf, (uchar_t*)val, val_len); + i = ucstos(buf, (ntfschar*)val, val_len); if (i == -1) printf("Volume name contains non-displayable " "Unicode characters.\n"); @@ -585,7 +585,7 @@ static void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) cpu_to_le16(a->name_offset)); u = a->flags; if (a->name_length) { - if (ucstos(s, (uchar_t*)((char*)a + + if (ucstos(s, (ntfschar*)((char*)a + cpu_to_le16(a->name_offset)), min((int)sizeof(s), a->name_length + 1)) == -1) { diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 27384500..8976e64c 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -666,7 +666,7 @@ static int get_data (struct ufile *file, ntfs_volume *vol) data->encrypted = rec->flags & ATTR_IS_ENCRYPTED; if (rec->name_length) { - data->uname = (uchar_t *) ((char *) rec + le16_to_cpu (rec->name_offset)); + data->uname = (ntfschar *) ((char *) rec + le16_to_cpu (rec->name_offset)); data->uname_len = rec->name_length; if (ntfs_ucstombs (data->uname, data->uname_len, &data->name, diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index 9378229c..d2cb4c66 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -60,7 +60,7 @@ struct filename { struct list_head list; /* Previous/Next links */ char *name; /* Filename in current locale */ FILE_NAME_TYPE_FLAGS name_space; - uchar_t *uname; /* Filename in unicode */ + ntfschar *uname; /* Filename in unicode */ int uname_len; /* and its length */ long long size_alloc; /* Allocated size (multiple of cluster size) */ long long size_data; /* Actual size of data */ @@ -74,7 +74,7 @@ struct filename { struct data { struct list_head list; /* Previous/Next links */ char *name; /* Stream name in current locale */ - uchar_t *uname; /* Unicode stream name */ + ntfschar *uname; /* Unicode stream name */ int uname_len; /* and its length */ int resident; /* Stream is resident */ int compressed; /* Stream is compressed */ diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c index ae5db1e0..ec02a64b 100644 --- a/ntfsprogs/upcase.c +++ b/ntfsprogs/upcase.c @@ -31,8 +31,8 @@ /** * init_upcase_table */ -void init_upcase_table(uchar_t *uc, u32 uc_len); -void init_upcase_table(uchar_t *uc, u32 uc_len) +void init_upcase_table(ntfschar *uc, u32 uc_len); +void init_upcase_table(ntfschar *uc, u32 uc_len) { static int uc_run_table[][3] = { /* Start, End, Add */ {0x0061, 0x007B, -32}, {0x0451, 0x045D, -80}, {0x1F70, 0x1F72, 74}, diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 36cbf37e..e96d8a83 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -567,7 +567,7 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int name = NULL; namelen = attr->name_length; - if (ntfs_ucstombs ((uchar_t *)((char *)attr + attr->name_offset), + if (ntfs_ucstombs ((ntfschar *)((char *)attr + attr->name_offset), namelen, &name, namelen) < 0) { Eprintf ("Couldn't translate attribute name to current locale.\n"); // ? @@ -721,7 +721,7 @@ ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, cons char *p, *q; ntfs_inode *ni; ntfs_inode *result = NULL; - uchar_t *unicode = NULL; + ntfschar *unicode = NULL; char *ascii = NULL; if (!vol || !pathname) { From cca66954fd2d87f554198205566c0416a6bbcdbc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 14 May 2004 13:02:33 +0000 Subject: [PATCH 1430/2994] Rename uchar_t to ntfschar. BKrev: 40a4c369hyg4ewkGdCJVFJ2VRdqzJQ From a6cd1084c3b0ff4f4319fdcc04f07c569d7ec3e0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 21 May 2004 21:21:38 +0000 Subject: [PATCH 1431/2994] Do not use the ++ operator on a variable when it is being passed as a parameter to a macro in libntfs/unistr.c. (Pete Curran, Yuval) (Logical change 1.393) --- libntfs/unistr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 8122d873..f14c8af2 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -120,8 +120,10 @@ int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, #endif for (cnt = 0; cnt < min(name1_len, name2_len); ++cnt) { - c1 = le16_to_cpu(*name1++); - c2 = le16_to_cpu(*name2++); + c1 = le16_to_cpu(*name1); + name1++; + c2 = le16_to_cpu(*name2); + name2++; if (ic) { if (c1 < upcase_len) c1 = le16_to_cpu(upcase[c1]); From 1a33cda57d7ddff53a95b0dfee6becfa5d1dd500 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 21 May 2004 21:21:38 +0000 Subject: [PATCH 1432/2994] Do not use the ++ operator on a variable when it is being passed as a parameter to a macro in libntfs/unistr.c. (Pete Curran, Yuval) BKrev: 40ae72e2mwIsTYOwnS_fi0I7Wj0mnQ From 1f49d8348fb361c769967ce21c29868cb9ac1982 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 21 May 2004 21:21:38 +0000 Subject: [PATCH 1433/2994] Update (Logical change 1.393) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 286c6b31..6a548b33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ xx/xx/2004 - 1.9.3-WIP - Rename uchar_t to ntfschar everywhere since uchar_t is already defined on Solaris to be an unsigned 1-byte character and it is also defined like this in POSIX. + - Do not use the ++ operator on a variable when it is being passed as a + parameter to a macro in libntfs/unistr.c. (Pete Curran, Yuval) 11/05/2004 - 1.9.2 - Decomrpession bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From 31a22bc88fe5bb87643896e444327f25002e8231 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 21 May 2004 22:01:03 +0000 Subject: [PATCH 1434/2994] Fix out of source tree build of utilities by changing $top_srcdir to $top_builddir in the references to the build library in the makefile template ntfsprogs/Makefile.am. (Yuval) (Logical change 1.394) --- ntfsprogs/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 16f62c56..82d457ca 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -1,9 +1,9 @@ if REALLYSTATIC -AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a +AM_LIBS = $(top_builddir)/libntfs/.libs/libntfs.a AM_LFLAGS = -static STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ else -AM_LIBS = $(top_srcdir)/libntfs/libntfs.la +AM_LIBS = $(top_builddir)/libntfs/libntfs.la AM_LFLAGS = $(all_libraries) LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ endif From eec67646120b165137878471ffe731bf9d9bc7ee Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 21 May 2004 22:01:03 +0000 Subject: [PATCH 1435/2994] Fix out of source tree build of utilities by changing $top_srcdir to $top_builddir in the references to the build library in the makefile template ntfsprogs/Makefile.am. (Yuval) BKrev: 40ae7c1fPDtB679KdjaXSP8IkcJUFA From 37dab5f6a55b373d366a6c4da8f1205bccf17b52 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 21 May 2004 22:01:03 +0000 Subject: [PATCH 1436/2994] Update (Logical change 1.394) --- ChangeLog | 3 +++ ntfsprogs/Makefile.in | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a548b33..ec09325b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,9 @@ xx/xx/2004 - 1.9.3-WIP defined like this in POSIX. - Do not use the ++ operator on a variable when it is being passed as a parameter to a macro in libntfs/unistr.c. (Pete Curran, Yuval) + - Fix out of source tree build of utilities by changing $top_srcdir to + $top_builddir in the references to the build library in the makefile + template ntfsprogs/Makefile.am. (Yuval) 11/05/2004 - 1.9.2 - Decomrpession bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index c8dcf76e..6c54ba91 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -68,9 +68,9 @@ am_mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ sd.$(OBJEXT) mkntfs.$(OBJEXT) utils.$(OBJEXT) mkntfs_OBJECTS = $(am_mkntfs_OBJECTS) @REALLYSTATIC_FALSE@am__DEPENDENCIES_1 = \ -@REALLYSTATIC_FALSE@ $(top_srcdir)/libntfs/libntfs.la +@REALLYSTATIC_FALSE@ $(top_builddir)/libntfs/libntfs.la @REALLYSTATIC_TRUE@am__DEPENDENCIES_1 = \ -@REALLYSTATIC_TRUE@ $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_TRUE@ $(top_builddir)/libntfs/.libs/libntfs.a mkntfs_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfscat_OBJECTS = ntfscat.$(OBJEXT) utils.$(OBJEXT) ntfscat_OBJECTS = $(am_ntfscat_OBJECTS) @@ -261,8 +261,8 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -@REALLYSTATIC_FALSE@AM_LIBS = $(top_srcdir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LIBS = $(top_srcdir)/libntfs/.libs/libntfs.a +@REALLYSTATIC_FALSE@AM_LIBS = $(top_builddir)/libntfs/libntfs.la +@REALLYSTATIC_TRUE@AM_LIBS = $(top_builddir)/libntfs/.libs/libntfs.a @REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) @REALLYSTATIC_TRUE@AM_LFLAGS = -static @REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ From 25737058b12c24350ff989278b6a3c3eb1c2e642 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 23 May 2004 20:10:46 +0000 Subject: [PATCH 1437/2994] Dump general info about an inode in ntfsinfo. (Yuval) BKrev: 40b10546n7D7kynT0KptuJFiejdZrQ From 3d4c6f8bf722e6a54228402ced3ecde54436f54b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 23 May 2004 20:10:46 +0000 Subject: [PATCH 1438/2994] Dump general info about an inode. (Logical change 1.395) --- ntfsprogs/ntfsinfo.c | 60 +++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 6b48294d..e36c3d0f 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1006,22 +1006,52 @@ static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) static void ntfs_dump_inode_general_info(ntfs_inode *inode) { + u16 inode_flags = le16_to_cpu(inode->mrec->flags); + printf("Dumping Inode #%llu\n",(long long)inode->mft_no); -/* - NTFS_RECORD_TYPES magic;// Usually the magic is "FILE". - u16 usa_ofs; // See NTFS_RECORD definition above. - u16 usa_count; // See NTFS_RECORD definition above. - LSN lsn; // $LogFile sequence number for this record. Changed every time the record is modified. - u16 sequence_number; // Number of times this mft record has been reused. - u16 link_count; // Number of hard links - MFT_RECORD_FLAGS flags; // Bit array of MFT_RECORD_FLAGS. - u32 bytes_in_use; // Number of bytes used in this mft record. - u32 bytes_allocated; // Number of bytes allocated for this mft record. This should be equal to the mft record size. - MFT_REF base_mft_record; // This is zero for base mft records. - u16 next_attr_instance; // The instance number that will be assigned to the next attribute added to this mft record. -// The below fields are specific to NTFS 3.1+ (Windows XP and above): - u32 mft_record_number; // Number of this mft record. -*/ + + printf("Update Sequence Array Count:\t%hu\n", + le16_to_cpu(inode->mrec->usa_count)); + printf("$LogFile seqNum for this Inode:\t0x%llx\n", + (signed long long int)sle64_to_cpu(inode->mrec->lsn)); + printf("Number of times reused:\t\t%hu\n", + (short unsigned int)le16_to_cpu(inode->mrec->sequence_number)); + printf("Number of hard links:\t\t%hu\n", + le16_to_cpu(inode->mrec->link_count)); + + printf("MFT record Flags:\t\t"); + /* we would like to convert MFT_RECORD_IN_USE -> DELETED + and we do that by xoring */ + inode_flags = inode_flags ^ MFT_RECORD_IN_USE; + + if (inode_flags) { + /* MFT_RECORD_IN_USE is now backwards */ + if (MFT_RECORD_IN_USE & inode_flags) { + printf("DELETED "); + } + if (MFT_RECORD_IS_DIRECTORY & inode_flags) { + printf("DIRECTORY "); + } + if (MFT_RECORD_IN_USE & !MFT_RECORD_IS_DIRECTORY & + MFT_REC_SPACE_FILLER & inode_flags) { + printf("UNKNOWN:0x%x",inode_flags); + } + } else { + printf("none"); + } + printf("\n"); + + printf("Size - Used:\t\t\t%u bytes\n", + (unsigned int)le32_to_cpu(inode->mrec->bytes_in_use)); + printf("Size - Allocated:\t\t%u bytes\n", + (unsigned int)le32_to_cpu(inode->mrec->bytes_allocated)); + + if (inode->mrec->base_mft_record) { + printf("base MFT record:\t\t%llu\n", + MREF_LE(inode->mrec->base_mft_record)); + } + printf("Next Attribute Instance Num\t%hu\n", + le16_to_cpu(inode->mrec->next_attr_instance)); } /** From 68b1426c2855320ad8b346019ea95f3c43690414 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 23 May 2004 20:10:46 +0000 Subject: [PATCH 1439/2994] Update (Logical change 1.395) --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ec09325b..94f7dd72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,10 +6,11 @@ xx/xx/2004 - 1.9.3-WIP defined on Solaris to be an unsigned 1-byte character and it is also defined like this in POSIX. - Do not use the ++ operator on a variable when it is being passed as a - parameter to a macro in libntfs/unistr.c. (Pete Curran, Yuval) + parameter to a macro in libntfs/unistr.c. (Pete Curran) - Fix out of source tree build of utilities by changing $top_srcdir to $top_builddir in the references to the build library in the makefile template ntfsprogs/Makefile.am. (Yuval) + - Dump general info about an inode in ntfsinfo. (Yuval) 11/05/2004 - 1.9.2 - Decomrpession bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From 7d0ecd98329c553f62aa68d8586d78abcd7ae880 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 24 May 2004 13:54:07 +0000 Subject: [PATCH 1440/2994] - Add detection for and make endianness detection work on Solaris 2.6 (Yuval) and Solaris 9 (Anton). - Emulate bswap_{16,32,64}() if not available/we cannot find them. (Logical change 1.396) --- include/ntfs/endians.h | 46 ++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h index 6192fc16..e716604e 100644 --- a/include/ntfs/endians.h +++ b/include/ntfs/endians.h @@ -46,27 +46,37 @@ #ifdef HAVE_MACHINE_ENDIAN_H # include #endif +#ifdef HAVE_SYS_BYTEORDER_H +# include +#endif #ifdef HAVE_SYS_PARAM_H # include #endif #ifndef __BYTE_ORDER -# ifdef _BYTE_ORDER +# if defined(_BYTE_ORDER) # define __BYTE_ORDER _BYTE_ORDER # define __LITTLE_ENDIAN _LITTLE_ENDIAN # define __BIG_ENDIAN _BIG_ENDIAN +# elif defined(BYTE_ORDER) +# define __BYTE_ORDER BYTE_ORDER +# define __LITTLE_ENDIAN LITTLE_ENDIAN +# define __BIG_ENDIAN BIG_ENDIAN +# elif defined(__BYTE_ORDER__) +# define __BYTE_ORDER __BYTE_ORDER__ +# define __LITTLE_ENDIAN __LITTLE_ENDIAN__ +# define __BIG_ENDIAN __BIG_ENDIAN__ +# elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) +# define __BYTE_ORDER 1 +# define __LITTLE_ENDIAN 1 +# define __BIG_ENDIAN 0 +# elif !defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN) +# define __BYTE_ORDER 0 +# define __LITTLE_ENDIAN 1 +# define __BIG_ENDIAN 0 # else -# ifdef BYTE_ORDER -# define __BYTE_ORDER BYTE_ORDER -# define __LITTLE_ENDIAN LITTLE_ENDIAN -# define __BIG_ENDIAN BIG_ENDIAN -# else -# error "__BYTE_ORDER is not defined." -# endif +# error "__BYTE_ORDER is not defined." # endif #endif -#ifdef HAVE_BYTESWAP_H -# include -#endif #define __ntfs_bswap_constant_16(x) \ (u16)((((u16)(x) & 0xff00) >> 8) | \ @@ -88,6 +98,14 @@ (((u64)(x) & 0x000000000000ff00ull) << 40) | \ (((u64)(x) & 0x00000000000000ffull) << 56)) +#ifdef HAVE_BYTESWAP_H +# include +#else +# define bswap_16(x) __ntfs_bswap_constant_16(x) +# define bswap_32(x) __ntfs_bswap_constant_32(x) +# define bswap_64(x) __ntfs_bswap_constant_64(x) +#endif + #if defined(__LITTLE_ENDIAN) && (__BYTE_ORDER == __LITTLE_ENDIAN) #define __le16_to_cpu(x) (x) @@ -170,9 +188,8 @@ #define scpu_to_le32p(x) (s32)__cpu_to_le32(*(s32*)(x)) #define scpu_to_le64p(x) (s64)__cpu_to_le64(*(s64*)(x)) -/* - * Constant endianness conversion defines. - */ +/* Constant endianness conversion defines. */ + #define const_le16_to_cpu(x) __constant_le16_to_cpu(x) #define const_le32_to_cpu(x) __constant_le32_to_cpu(x) #define const_le64_to_cpu(x) __constant_le64_to_cpu(x) @@ -182,4 +199,3 @@ #define const_cpu_to_le64(x) __constant_cpu_to_le64(x) #endif /* defined _NTFS_ENDIANS_H */ - From b803a16d8c9e85f11232dd0fc30c904046138562 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 24 May 2004 13:54:07 +0000 Subject: [PATCH 1441/2994] - Add detection for and make endianness detection work on Solaris 2.6 (Yuval) and Solaris 9 (Anton). - Emulate bswap_{16,32,64}() if not available/we cannot find them. BKrev: 40b1fe7f9xCV9vUK6-MKQa-OweY4HA From bc60f44a0577132fda8f2fdc02ad4b3d9e8fb937 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 24 May 2004 13:54:07 +0000 Subject: [PATCH 1442/2994] Add detection for . (Logical change 1.396) --- config.h.in | 3 +++ configure | 7 ++++--- configure.ac | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config.h.in b/config.h.in index fcb99e06..8fd0f7b9 100644 --- a/config.h.in +++ b/config.h.in @@ -155,6 +155,9 @@ `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ #undef HAVE_ST_BLOCKS +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_BYTEORDER_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_ENDIAN_H diff --git a/configure b/configure index a8071ed4..16fc9532 100755 --- a/configure +++ b/configure @@ -20026,14 +20026,15 @@ fi + for ac_header in fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ unistd.h utime.h wchar.h getopt.h features.h endian.h byteswap.h \ - sys/endian.h sys/param.h sys/ioctl.h sys/mount.h sys/stat.h \ - sys/types.h sys/vfs.h linux/major.h linux/fd.h linux/hdreg.h \ - machine/endian.h + sys/byteorder.h sys/endian.h sys/param.h sys/ioctl.h sys/mount.h \ + sys/stat.h sys/types.h sys/vfs.h linux/major.h linux/fd.h \ + linux/hdreg.h machine/endian.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then diff --git a/configure.ac b/configure.ac index fc2064a3..a3084848 100644 --- a/configure.ac +++ b/configure.ac @@ -193,9 +193,9 @@ AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ unistd.h utime.h wchar.h getopt.h features.h endian.h byteswap.h \ - sys/endian.h sys/param.h sys/ioctl.h sys/mount.h sys/stat.h \ - sys/types.h sys/vfs.h linux/major.h linux/fd.h linux/hdreg.h \ - machine/endian.h]) + sys/byteorder.h sys/endian.h sys/param.h sys/ioctl.h sys/mount.h \ + sys/stat.h sys/types.h sys/vfs.h linux/major.h linux/fd.h \ + linux/hdreg.h machine/endian.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL From c55508d4b0322ce7236d2bd13de7cce9ddfd0edb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 24 May 2004 14:04:19 +0000 Subject: [PATCH 1443/2994] Update (Logical change 1.397) --- ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 94f7dd72..70aa86d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,13 @@ xx/xx/2004 - 1.9.3-WIP $top_builddir in the references to the build library in the makefile template ntfsprogs/Makefile.am. (Yuval) - Dump general info about an inode in ntfsinfo. (Yuval) + - Add detection for and make endianness detection + work on Solaris 2.6 (Yuval) and Solaris 9 (Anton). + - Emulate bswap_{16,32,64}() if not available/we cannot find them. + This has the advantage that the problems on FreeBSD running on big + endian, 64-bit machine will just disappear as we will emulate the + calls even though they exist with a different name (bswap16(), etc + instead of bswap_16(), etc). (Anton) 11/05/2004 - 1.9.2 - Decomrpession bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From 3528535640ed457e0838e8f690b47e9641d0c992 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 24 May 2004 14:04:19 +0000 Subject: [PATCH 1444/2994] Update ChangeLog for the previous commit. BKrev: 40b200e3lp3ldlWwXtG6kqsCAdAHPA From 0e3341d9162ee3c3db951b20ecf4b03deedfa120 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Wed, 26 May 2004 04:16:34 +0000 Subject: [PATCH 1445/2994] Eliminate the global opt.show_progress from progress_update() for code reuse (Logical change 1.398) --- ntfsprogs/ntfsresize.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 689a8b47..41f5ec9f 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -95,10 +95,14 @@ struct bitmap { s64 size; }; +#define NTFS_PROGBAR 0x0001 +#define NTFS_PROGBAR_SUPPRESS 0x0002 + struct progress_bar { u64 start; u64 stop; int resolution; + int flags; float unit; }; @@ -106,12 +110,15 @@ struct llcn_t { s64 lcn; /* last used LCN for a "special" file/attr type */ s64 inode; /* inode using it */ }; - + +#define NTFSCK_PROGBAR 0x0001 + typedef struct { ntfs_inode *ni; /* inode being processed */ ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ s64 inuse; /* num of clusters in use */ int multi_ref; /* num of clusters referenced many times */ + int flags; struct bitmap lcn_bitmap; } ntfs_fsck_t; @@ -864,12 +871,13 @@ static void compare_bitmaps(ntfs_volume *vol, struct bitmap *a) * * Create and scale our progress bar. */ -static void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) +static void progress_init(struct progress_bar *p, u64 start, u64 stop, int flags) { p->start = start; p->stop = stop; p->unit = 100.0 / (stop - start); - p->resolution = res; + p->resolution = 100; + p->flags = flags; } /** @@ -881,7 +889,9 @@ static void progress_update(struct progress_bar *p, u64 current) { float percent; - if (!opt.show_progress) + if (!(p->flags & NTFS_PROGBAR)) + return; + if (p->flags & NTFS_PROGBAR_SUPPRESS) return; /* WARNING: don't modify the texts, external tools grep for them */ @@ -906,11 +916,15 @@ static void build_allocation_bitmap(ntfs_volume *vol, ntfs_fsck_t *fsck) s64 inode = 0; ntfs_inode *ni; struct progress_bar progress; + int pb_flags = 0; /* progress bar flags */ /* WARNING: don't modify the text, external tools grep for it */ printf("Checking filesystem consistency ...\n"); - progress_init(&progress, inode, vol->nr_mft_records - 1, 100); + if (fsck->flags & NTFSCK_PROGBAR) + pb_flags |= NTFS_PROGBAR; + + progress_init(&progress, inode, vol->nr_mft_records - 1, pb_flags); for (; inode < vol->nr_mft_records; inode++) { progress_update(&progress, inode); @@ -1527,8 +1541,8 @@ static void relocate_inodes(ntfs_resize_t *resize) MFT_REF mref; printf("Relocating needed data ...\n"); - - progress_init(&resize->progress, 0, resize->relocations, 100); + + progress_init(&resize->progress, 0, resize->relocations, resize->progress.flags); resize->relocations = 0; resize->mrec = (MFT_RECORD *)malloc(resize->vol->mft_record_size); @@ -1878,13 +1892,11 @@ static void update_bootsector(ntfs_resize_t *r) bs.bpb.sectors_per_cluster); if (r->mftmir_old) { - int save_progress = opt.show_progress; - - opt.show_progress = 0; + r->progress.flags |= NTFS_PROGBAR_SUPPRESS; copy_clusters(r, r->mftmir_rl.lcn, r->mftmir_old, r->mftmir_rl.length); bs.mftmirr_lcn = cpu_to_le64(r->mftmir_rl.lcn); - opt.show_progress = save_progress; + r->progress.flags &= ~NTFS_PROGBAR_SUPPRESS; } if (vol->dev->d_ops->seek(vol->dev, 0, SEEK_SET) == (off_t)-1) @@ -2131,8 +2143,10 @@ int main(int argc, char **argv) } memset(&fsck, 0, sizeof(fsck)); + if (opt.show_progress) + fsck.flags |= NTFSCK_PROGBAR; + setup_lcn_bitmap(&fsck.lcn_bitmap, vol->nr_clusters); - build_allocation_bitmap(vol, &fsck); if (fsck.multi_ref) { err_printf("Filesystem check failed! Totally %d clusters " @@ -2149,6 +2163,8 @@ int main(int argc, char **argv) resize.inuse = fsck.inuse; resize.lcn_bitmap = fsck.lcn_bitmap; resize.vol = vol; + if (opt.show_progress) + resize.progress.flags |= NTFS_PROGBAR; /* This is also true if --info was used w/o --size (new_size = 0) */ if (new_size < vol->nr_clusters) From a85d57bb14d0b3af73cc443c534aea0e4c2e1459 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Wed, 26 May 2004 04:16:34 +0000 Subject: [PATCH 1446/2994] ntfsresize: eliminate the global opt.show_progress from progress_update() for code resuse BKrev: 40b41a2215ZbjgH-KptyRYhoiQDwAQ From 75fe0ab10013a723ef1da8b054cefac42b4027a9 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Wed, 26 May 2004 04:20:29 +0000 Subject: [PATCH 1447/2994] Rename ntfs_fsck_t to ntfsck_t (Logical change 1.399) --- ntfsprogs/ntfsresize.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 41f5ec9f..9d6c58d5 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -120,7 +120,7 @@ typedef struct { int multi_ref; /* num of clusters referenced many times */ int flags; struct bitmap lcn_bitmap; -} ntfs_fsck_t; +} ntfsck_t; typedef struct { ntfs_volume *vol; @@ -720,7 +720,7 @@ static void collect_relocation_info(ntfs_resize_t *resize, runlist *rl) * * This serves as a rudimentary "chkdsk" operation. */ -static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfs_fsck_t *fsck) +static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfsck_t *fsck) { s64 inode; ATTR_RECORD *a; @@ -781,7 +781,7 @@ static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfs_fsck_t *fsck) * For a given MFT Record, iterate through all its attributes. Any non-resident * data runs will be marked in lcn_bitmap. */ -static void walk_attributes(ntfs_volume *vol, ntfs_fsck_t *fsck) +static void walk_attributes(ntfs_volume *vol, ntfsck_t *fsck) { if (!(fsck->ctx = ntfs_attr_get_search_ctx(fsck->ni, NULL))) perr_exit("ntfs_get_attr_search_ctx"); @@ -911,7 +911,7 @@ static void progress_update(struct progress_bar *p, u64 current) * Read each record in the MFT, skipping the unused ones, and build up a bitmap * from all the non-resident attributes. */ -static void build_allocation_bitmap(ntfs_volume *vol, ntfs_fsck_t *fsck) +static void build_allocation_bitmap(ntfs_volume *vol, ntfsck_t *fsck) { s64 inode = 0; ntfs_inode *ni; @@ -2088,7 +2088,7 @@ static void check_shrink_constraints(ntfs_resize_t *resize) int main(int argc, char **argv) { - ntfs_fsck_t fsck; + ntfsck_t fsck; ntfs_resize_t resize; s64 new_size = 0; /* in clusters; 0 = --info w/o --size */ s64 device_size; /* in bytes */ From 9410d1297a22c330b6c00c65e131b5405fe4c359 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Wed, 26 May 2004 04:20:29 +0000 Subject: [PATCH 1448/2994] ntfsresize: rename ntfs_fsck_t to ntfsck_t BKrev: 40b41b0dyDZcxF6PrpZTkiayyR4ufA From 7d26680bff247e47a78f69f9c219d35bc2167a4e Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 26 May 2004 07:41:00 +0000 Subject: [PATCH 1449/2994] (Logical change 1.400) --- ntfsprogs/ntfsrm.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 ntfsprogs/ntfsrm.h diff --git a/ntfsprogs/ntfsrm.h b/ntfsprogs/ntfsrm.h new file mode 100644 index 00000000..b8d25b96 --- /dev/null +++ b/ntfsprogs/ntfsrm.h @@ -0,0 +1,43 @@ +/* + * ntfsrm - Part of the Linux-NTFS project. + * + * Copyright (c) 2004 Richard Russon + * + * This utility will delete files from an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFSRM_H_ +#define _NTFSRM_H_ + +#include "types.h" +#include "layout.h" + +struct options { + char *device; /* Device/File to work with */ + char *file; /* File to delete */ + int force; /* Override common sense */ + int interactive; /* Ask before deleting files */ + int recursive; /* Delete files in subdirectories */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int noaction; /* Do not write to disk */ + int nodirty; /* Do not mark volume dirty */ +}; + +#endif /* _NTFSRM_H_ */ + From 2bb3b959a1ad8594b480f0742e353feda693a29c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 26 May 2004 07:41:00 +0000 Subject: [PATCH 1450/2994] Auto merged 2004/05/03 15:41:18+01:00 flatcap.org!ntfs build process changes from the main line 2004/03/11 00:03:56+00:00 flatcap.org!flatcap Auto merged 2004/02/16 00:25:33+00:00 flatcap.org!ntfs add ntfsrm to the build (Logical change 1.400) --- ntfsprogs/Makefile.am | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 82d457ca..6865f0b6 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -13,7 +13,7 @@ LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone -EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove +EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove ntfsrm man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ @@ -69,6 +69,10 @@ ntfscat_LDFLAGS = $(AM_LFLAGS) # We don't distribute these +ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h +ntfsrm_LDADD = $(AM_LIBS) +ntfsrm_LDFLAGS = $(AM_LFLAGS) + ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) From fe07034fc3237af000ceb243d77e093ebd2c4261 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 26 May 2004 07:41:00 +0000 Subject: [PATCH 1451/2994] Auto merged 2004/05/03 15:42:34+01:00 flatcap.org!ntfs put ntfsrm back in the build 2004/05/03 15:41:18+01:00 flatcap.org!ntfs build process changes from the main line 2004/03/11 00:03:56+00:00 flatcap.org!flatcap Auto merged 2004/02/16 00:25:33+00:00 flatcap.org!ntfs add ntfsrm to the build (Logical change 1.400) --- ntfsprogs/Makefile.in | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 6c54ba91..49a5c6f5 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) +SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -42,7 +42,7 @@ bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) ntfswipe$(EXEEXT) \ - ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) + ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) ntfsrm$(EXEEXT) subdir = ntfsprogs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/mkntfs.8.in $(srcdir)/ntfscat.8.in \ @@ -103,6 +103,9 @@ ntfsmove_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) utils.$(OBJEXT) ntfsresize_OBJECTS = $(am_ntfsresize_OBJECTS) ntfsresize_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfsrm_OBJECTS = ntfsrm.$(OBJEXT) utils.$(OBJEXT) +ntfsrm_OBJECTS = $(am_ntfsrm_OBJECTS) +ntfsrm_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) \ utils.$(OBJEXT) ntfstruncate_OBJECTS = $(am_ntfstruncate_OBJECTS) @@ -124,7 +127,7 @@ am__depfiles_maybe = depfiles @AMDEP_TRUE@ ./$(DEPDIR)/ntfsfix.Po ./$(DEPDIR)/ntfsinfo.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfslabel.Po ./$(DEPDIR)/ntfsls.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsmove.Po ./$(DEPDIR)/ntfsresize.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfstruncate.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsrm.Po ./$(DEPDIR)/ntfstruncate.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfsundelete.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ntfswipe.Po ./$(DEPDIR)/sd.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/upcase.Po ./$(DEPDIR)/utils.Po @@ -138,13 +141,13 @@ SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) \ $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) \ $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) \ $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) \ - $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ - $(ntfswipe_SOURCES) + $(ntfsrm_SOURCES) $(ntfstruncate_SOURCES) \ + $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) DIST_SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) \ $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ - $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) \ + $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ $(ntfswipe_SOURCES) man8dir = $(mandir)/man8 @@ -312,6 +315,9 @@ ntfscat_LDADD = $(AM_LIBS) ntfscat_LDFLAGS = $(AM_LFLAGS) # We don't distribute these +ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h +ntfsrm_LDADD = $(AM_LIBS) +ntfsrm_LDFLAGS = $(AM_LFLAGS) ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) @@ -468,6 +474,9 @@ ntfsmove$(EXEEXT): $(ntfsmove_OBJECTS) $(ntfsmove_DEPENDENCIES) ntfsresize$(EXEEXT): $(ntfsresize_OBJECTS) $(ntfsresize_DEPENDENCIES) @rm -f ntfsresize$(EXEEXT) $(LINK) $(ntfsresize_LDFLAGS) $(ntfsresize_OBJECTS) $(ntfsresize_LDADD) $(LIBS) +ntfsrm$(EXEEXT): $(ntfsrm_OBJECTS) $(ntfsrm_DEPENDENCIES) + @rm -f ntfsrm$(EXEEXT) + $(LINK) $(ntfsrm_LDFLAGS) $(ntfsrm_OBJECTS) $(ntfsrm_LDADD) $(LIBS) ntfstruncate$(EXEEXT): $(ntfstruncate_OBJECTS) $(ntfstruncate_DEPENDENCIES) @rm -f ntfstruncate$(EXEEXT) $(LINK) $(ntfstruncate_LDFLAGS) $(ntfstruncate_OBJECTS) $(ntfstruncate_LDADD) $(LIBS) @@ -498,6 +507,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsls.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmove.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsresize.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsrm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfstruncate.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsundelete.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfswipe.Po@am__quote@ From 1938117fd017f493ee894ba047ee5cc96a50d45b Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 26 May 2004 07:41:00 +0000 Subject: [PATCH 1452/2994] Initial revision --- ntfsprogs/ntfsrm.c | 0 ntfsprogs/ntfsrm.h | 43 ------------------------------------------- 2 files changed, 43 deletions(-) create mode 100644 ntfsprogs/ntfsrm.c diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c new file mode 100644 index 00000000..e69de29b diff --git a/ntfsprogs/ntfsrm.h b/ntfsprogs/ntfsrm.h index b8d25b96..e69de29b 100644 --- a/ntfsprogs/ntfsrm.h +++ b/ntfsprogs/ntfsrm.h @@ -1,43 +0,0 @@ -/* - * ntfsrm - Part of the Linux-NTFS project. - * - * Copyright (c) 2004 Richard Russon - * - * This utility will delete files from an NTFS volume. - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFSRM_H_ -#define _NTFSRM_H_ - -#include "types.h" -#include "layout.h" - -struct options { - char *device; /* Device/File to work with */ - char *file; /* File to delete */ - int force; /* Override common sense */ - int interactive; /* Ask before deleting files */ - int recursive; /* Delete files in subdirectories */ - int quiet; /* Less output */ - int verbose; /* Extra output */ - int noaction; /* Do not write to disk */ - int nodirty; /* Do not mark volume dirty */ -}; - -#endif /* _NTFSRM_H_ */ - From b69d1980b3af6a5150f9531e03dfc75721de1761 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 26 May 2004 07:41:00 +0000 Subject: [PATCH 1453/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfsprogs.rm 2004/05/24 13:33:48+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/backup/old/home/ntfsprogs.rm 2004/05/14 15:48:36+01:00 flatcap.org!ntfs uchar_t -> ntfschar 2004/05/14 14:36:34+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfsprogs.rm 2004/05/12 00:29:05+01:00 flatcap.org!ntfs actually remove the entry from the index alloc 2004/05/11 17:50:50+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfsprogs.rm 2004/05/10 22:59:12+01:00 flatcap.org!ntfs cope with variable sized indexes, recurse directories, ignore things that are hard to delete 2004/05/10 16:35:32+01:00 flatcap.org!ntfs ntfsrm.c: find the dt that needs and entry deleting 2004/05/10 00:03:29+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfsprogs.rm 2004/05/10 00:01:11+01:00 flatcap.org!ntfs recursively descend a directory tree 2004/05/10 00:00:44+01:00 flatcap.org!ntfs alloc freeing of a null inode 2004/05/09 22:02:10+01:00 flatcap.org!ntfs fix mem leaks 2004/05/09 21:21:14+01:00 flatcap.org!ntfs recursive mapping of one directory's index 2004/05/09 13:01:52+01:00 flatcap.org!ntfs mapping of dir and first-level dt work 2004/05/08 11:45:28+01:00 flatcap.org!ntfs happy with structures 2004/05/03 15:42:34+01:00 flatcap.org!ntfs put ntfsrm back in the build 2004/05/03 15:41:19+01:00 flatcap.org!ntfs build process changes from the main line 2004/03/11 00:03:57+00:00 flatcap.org!flatcap Merge ssh://linux-ntfs@bkbits.net/ntfsprogs-devel into flatcap.org:/home/flatcap/ntfs.rm 2004/02/16 00:27:27+00:00 flatcap.org!ntfs added ntfsrm - just some hacked together code for now BKrev: 40b44a0cMBq66htcV3V9x1KVCHxxng From c05355e71133ebf31d0ce9c84ea62890a5dc4755 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 26 May 2004 07:41:00 +0000 Subject: [PATCH 1454/2994] alloc freeing of a null inode (Logical change 1.400) --- libntfs/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libntfs/inode.c b/libntfs/inode.c index f6dfceb3..b5fc80da 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -205,6 +205,9 @@ err_out: */ int ntfs_inode_close(ntfs_inode *ni) { + if (!ni) + return 0; + /* If we have dirty metadata, write it out. */ if (NInoDirty(ni) || NInoAttrListDirty(ni)) { if (ntfs_inode_sync(ni)) { From ab15c2b4a193478c525646ea4592a97dec7dc4ed Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 26 May 2004 07:41:00 +0000 Subject: [PATCH 1455/2994] build process changes from the main line 2004/02/16 00:25:33+00:00 flatcap.org!ntfs add ntfsrm to the build (Logical change 1.400) From 52957ad843ba274821ac842b2bf4e2dd6e1111cd Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 26 May 2004 07:41:00 +0000 Subject: [PATCH 1456/2994] build process changes from the main line 2004/03/11 00:03:55+00:00 flatcap.org!flatcap Auto merged 2004/02/16 00:25:33+00:00 flatcap.org!ntfs add ntfsrm to the build (Logical change 1.400) From 1dbe2802c64901e41ba79f59ce56d9b4cd4dd66b Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 26 May 2004 07:41:00 +0000 Subject: [PATCH 1457/2994] build process changes from the main line 2004/03/11 00:03:56+00:00 flatcap.org!flatcap Auto merged 2004/02/16 00:25:33+00:00 flatcap.org!ntfs add ntfsrm to the build (Logical change 1.400) From 0916464b205f7ce1ab12d9cb577c475aeb10acdd Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 26 May 2004 07:41:00 +0000 Subject: [PATCH 1458/2994] build process changes from the main line 2004/03/11 00:03:56+00:00 flatcap.org!flatcap Auto merged 2004/03/11 00:03:55+00:00 flatcap.org!flatcap Merge rename: include/Makefile.in -> include/ntfs/Makefile.in (Logical change 1.400) From c55f8598081eb8cacd6026f5111da0647b8109e2 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 26 May 2004 07:41:00 +0000 Subject: [PATCH 1459/2994] ignore ntfsrm (Logical change 1.400) --- BitKeeper/etc/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 7a5cffd4..9331d037 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -40,6 +40,7 @@ ntfsprogs/ntfslabel ntfsprogs/ntfsls ntfsprogs/ntfsmove ntfsprogs/ntfsresize +ntfsprogs/ntfsrm ntfsprogs/ntfstruncate ntfsprogs/ntfsundelete ntfsprogs/ntfswipe From a522a0437faaaf79509355c20ebb18ab57734668 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 26 May 2004 07:41:00 +0000 Subject: [PATCH 1460/2994] uchar_t -> ntfschar 2004/05/12 00:29:05+01:00 flatcap.org!ntfs actually remove the entry from the index alloc 2004/05/10 22:59:11+01:00 flatcap.org!ntfs cope with variable sized indexes, recurse directories, ignore things that are hard to delete 2004/05/10 16:34:57+01:00 flatcap.org!ntfs find the dt that needs and entry deleting 2004/05/10 00:01:11+01:00 flatcap.org!ntfs recursively descend a directory tree 2004/05/09 22:02:10+01:00 flatcap.org!ntfs fix mem leaks 2004/05/09 21:21:13+01:00 flatcap.org!ntfs recursive mapping of one directory's index 2004/05/09 13:01:51+01:00 flatcap.org!ntfs mapping of dir and first-level dt work 2004/05/08 11:45:27+01:00 flatcap.org!ntfs happy with structures 2004/02/16 00:25:33+00:00 flatcap.org!ntfs (Logical change 1.400) --- ntfsprogs/ntfsrm.c | 1272 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1272 insertions(+) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index e69de29b..79222501 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -0,0 +1,1272 @@ +/** + * ntfsrm - Part of the Linux-NTFS project. + * + * Copyright (c) 2004 Richard Russon + * + * This utility will delete files from an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "utils.h" +#include "ntfsrm.h" +#include "debug.h" +#include "dir.h" + +static const char *EXEC_NAME = "ntfsrm"; +static struct options opts; + +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +void version (void) +{ + printf ("\n%s v%s - Delete files from an NTFS volume.\n\n", + EXEC_NAME, VERSION); + printf ("Copyright (c) 2004 Richard Russon\n"); + printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +void usage (void) +{ + printf ("\nUsage: %s [options] device file\n" + "\n" + " -r --recursive Delete files in subdirectories\n" + " -i --interactive Ask before deleting files\n" + //" -I num --inode num Delete the file with this inode number\n" + //" -U --unlink Unlink the file, deleting all references \n" + "\n" + " -D --no-dirty Do not mark volume dirty (require chkdsk)\n" + " -n --no-action Do not write to disk\n" + " -f --force Use less caution\n" + " -h --help Print this help\n" + " -q --quiet Less output\n" + " -V --version Version information\n" + " -v --verbose More output\n\n", + EXEC_NAME); + printf ("%s%s\n", ntfs_bugs, ntfs_home); +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +int parse_options (int argc, char **argv) +{ + static const char *sopt = "-Dfh?inqRrVv"; //"-Dfh?I:inqRrUVv"; + static const struct option lopt[] = { + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + //{ "inode", required_argument, NULL, 'I' }, + { "interactive", no_argument, NULL, 'i' }, + { "no-action", no_argument, NULL, 'n' }, + { "no-dirty", no_argument, NULL, 'D' }, + { "quiet", no_argument, NULL, 'q' }, + { "recursive", no_argument, NULL, 'r' }, + //{ "unlink", no_argument, NULL, 'U' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + int err = 0; + int ver = 0; + int help = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else if (!opts.file) { + opts.file = argv[optind-1]; + } else { + opts.device = NULL; + opts.file = NULL; + err++; + } + break; + case 'D': + opts.nodirty++; + break; + case 'f': + opts.force++; + break; + case 'h': + case '?': + help++; + break; + case 'i': + opts.interactive++; + break; + case 'n': + opts.noaction++; + break; + case 'q': + opts.quiet++; + break; + case 'R': + case 'r': + opts.recursive++; + break; + case 'V': + ver++; + break; + case 'v': + opts.verbose++; + break; + default: + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if ((opts.device == NULL) || + (opts.file == NULL)) { + if (argc > 1) + Eprintf ("You must specify one device and one file.\n"); + err++; + } + + if (opts.quiet && opts.verbose) { + Eprintf("You may not use --quiet and --verbose at the " + "same time.\n"); + err++; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + + +static int my_alloc = 0; +static int my_free = 0; + +/** + * ntfs_malloc + */ +void * ntfs_malloc (int size) +{ + void *ptr; + my_alloc++; + ptr = malloc (size); + //printf ("alloc %p\n", ptr); + return ptr; +} + +/** + * ntfs_calloc + */ +void * ntfs_calloc (int count, int size) +{ + void *ptr; + my_alloc++; + ptr = calloc (count, size); + //printf ("alloc %p\n", ptr); + return ptr; +} + +/** + * ntfs_realloc + */ +void * ntfs_realloc (void *ptr, int size) +{ + void *new; + + new = realloc (ptr, size); + + if (ptr) { + //printf ("free %p\n", ptr); + my_free++; + } + if (new) { + //printf ("alloc %p\n", new); + my_alloc++; + } + return new; +} + +/** + * ntfs_free + */ +void ntfs_free (void *ptr) +{ + if (!ptr) + return; + my_free++; + //printf ("free %p\n", ptr); + free (ptr); +} + +/** + * ntfs_print_name + */ +void ntfs_print_name (ntfschar *name, int name_len) +{ + char *buffer = NULL; + + ntfs_ucstombs (name, name_len, (char**) &buffer, 0); + printf ("%s", buffer); + free (buffer); +} + + +// ntfs_dir_child_open (ntfs_dir *parent, ntfschar *name) +// ntfs_dir_add_child (ntfs_dir *parent, ntfschar *name, int flags) file/dir +// ntfs_dir_del_child (ntfs_dir *parent, ntfschar *name, int flags) file/dir/unlink +// ntfs_dir_link (ntfs_dir *parent, ntfschar *name, inode *child) +// ntfs_dir_list (ntfs_dir *parent, funct *callback) + +struct ntfs_dir; + +/** + * struct bmp_page + */ +struct bmp_page { + u8 *data; + VCN vcn; +}; + +/** + * struct mft_bitmap + */ +struct mft_bitmap { + ntfs_attr *bmp; + struct bmp_page **pages; + int count; +}; + +/** + * struct ntfs_dt + */ +struct ntfs_dt { + struct ntfs_dir *dir; + struct ntfs_dt *parent; + u8 *data; /* Raw index data */ + int data_len; + struct ntfs_dt **sub_nodes; + int child_count; /* All my descendents */ + INDEX_ENTRY **children; + INDEX_HEADER *header; + BOOL changed; /* How do I commit myself */ + VCN vcn; +}; + +/** + * struct ntfs_dir + */ +struct ntfs_dir { + ntfs_volume *vol; + struct ntfs_dir *parent; + ntfschar *name; + int name_len; + struct ntfs_dt *index; + struct ntfs_dir **children; + int child_count; + MFT_REF mft_num; + struct mft_bitmap *bitmap; + ntfs_inode *inode; + ntfs_attr *iroot; + ntfs_attr *ialloc; + ntfs_attr *ibmp; +}; + + +/** + * ntfs_dt_alloc_children + */ +INDEX_ENTRY ** ntfs_dt_alloc_children (INDEX_ENTRY **children, int count) +{ + int old = (count + 0x1e) & ~0x1f; + int new = (count + 0x1f) & ~0x1f; + + if (old == new) + return children; + + return ntfs_realloc (children, new * sizeof (INDEX_ENTRY*)); +} + +/** + * ntfs_dt_count_root + */ +int ntfs_dt_count_root (struct ntfs_dt *dt) +{ + u8 *buffer = NULL; + u8 *ptr = NULL; + VCN *vcn = NULL; + s64 size = 0; + char *name = NULL; + + INDEX_ROOT *root; + INDEX_HEADER *header; + INDEX_ENTRY *entry; + + if (!dt) + return -1; + + buffer = dt->data; + size = dt->data_len; + + root = (INDEX_ROOT*) buffer; + if (root->type != AT_FILE_NAME) + return -1; + + header = (INDEX_HEADER*) (buffer + 0x10); + if (header->index_length > size) + return -1; + + dt->child_count = 0; + ptr = buffer + header->entries_offset + 0x10; + + while (ptr < (buffer + size)) { + entry = (INDEX_ENTRY*) ptr; + dt->child_count++; + + dt->children = ntfs_dt_alloc_children (dt->children, dt->child_count); + + if (entry->flags & INDEX_ENTRY_NODE) { + vcn = (VCN *) (ptr + ((entry->key_length + 0x17) & ~7)); + //printf ("VCN %lld\n", *vcn); + } + + if (!(entry->flags & INDEX_ENTRY_END)) { + ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, entry->key.file_name.file_name_length); + //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); + free (name); + name = NULL; + } + + //printf ("CC[%d] = %p\n", dt->child_count-1, entry); + dt->children[dt->child_count-1] = entry; + + ptr += entry->length; + } + + //printf ("count = %d\n\n", dt->child_count); + + if (dt->child_count > 0) { + //printf ("%d subnodes\n", dt->child_count); + dt->sub_nodes = ntfs_calloc (dt->child_count, sizeof (struct ntfs_dt *)); + } + return dt->child_count; +} + +/** + * ntfs_dt_count_alloc + */ +int ntfs_dt_count_alloc (struct ntfs_dt *dt) +{ + u8 *buffer = NULL; + u8 *ptr = NULL; + VCN *vcn = NULL; + s64 size = 0; + char *name = NULL; + + INDEX_BLOCK *block; + INDEX_ENTRY *entry; + + if (!dt) + return -1; + + buffer = dt->data; + size = dt->data_len; + + //utils_dump_mem (buffer, 0, 128, TRUE); + + block = (INDEX_BLOCK*) buffer; + //printf ("INDX %lld\n", block->index_block_vcn); + + ptr = buffer + 0x18 + block->index.entries_offset; + + //printf ("block size %d\n", block->index.index_length); + dt->child_count = 0; + while (ptr < (buffer + 0x18 + block->index.index_length)) { + entry = (INDEX_ENTRY*) ptr; + dt->child_count++; + + dt->children = ntfs_dt_alloc_children (dt->children, dt->child_count); + + if (entry->flags & INDEX_ENTRY_NODE) { + vcn = (VCN *) (ptr + ((entry->key_length + 0x17) & ~7)); + //printf ("\tVCN %lld\n", *vcn); + } + + dt->children[dt->child_count-1] = entry; + + if (entry->flags & INDEX_ENTRY_END) { + break; + } else { + ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, entry->key.file_name.file_name_length); + //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); + free (name); + name = NULL; + } + + ptr += entry->length; + } + //printf ("count = %d\n", dt->child_count); + + if (dt->child_count > 0) { + //printf ("%d subnodes\n", dt->child_count); + dt->sub_nodes = ntfs_calloc (dt->child_count, sizeof (struct ntfs_dt *)); + } + + return dt->child_count; +} + + +/** + * ntfs_dt_alloc + */ +struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn) +{ + struct ntfs_dt *dt = NULL; + //int i; + + if (!dir) + return NULL; + + dt = ntfs_calloc (1, sizeof (*dt)); + if (!dt) + return NULL; + + dt->dir = dir; + dt->parent = parent; + dt->children = NULL; + dt->child_count = 0; + dt->changed = FALSE; + dt->sub_nodes = NULL; + dt->vcn = vcn; + + if (parent) { + //printf ("alloc a = %lld\n", dir->ialloc->allocated_size); + //printf ("alloc d = %lld\n", dir->ialloc->data_size); + //printf ("alloc i = %lld\n", dir->ialloc->initialized_size); + //printf ("vcn = %lld\n", vcn); + + dt->data_len = parent->data_len; + //printf ("parent size = %d\n", dt->data_len); + dt->data = ntfs_malloc (dt->data_len); + //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 2, 2048, dt->data)); + ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data); + //utils_dump_mem (dt->data, 0, dt->data_len, 1); + //printf ("\n"); + + ntfs_dt_count_alloc (dt); + + dt->header = &((INDEX_BLOCK*)dt->data)->index; + //printf ("USA = %d\n", ((INDEX_BLOCK*)dt->data)->usa_count); + +#if 0 + for (i = 0; i < dt->child_count; i++) { + INDEX_ENTRY *ie = dt->children[i]; + + printf ("%d\n", ((u8*)ie) - dt->data); + if (ie->flags & INDEX_ENTRY_END) + printf ("IE (%d)\n", ie->length); + else + printf ("IE %lld (%d)\n", MREF (ie->key.file_name.parent_directory), ie->length); + utils_dump_mem ((u8*)ie, 0, ie->length, 1); + printf ("\n"); + } +#endif + } else { + //printf ("root a = %lld\n", dir->iroot->allocated_size); + //printf ("root d = %lld\n", dir->iroot->data_size); + //printf ("root i = %lld\n", dir->iroot->initialized_size); + + dt->data_len = dir->iroot->allocated_size; + dt->data = ntfs_malloc (dt->data_len); + //printf ("%lld\n", ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data)); + ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data); + //utils_dump_mem (dt->data, 0, dt->data_len, 1); + + ntfs_dt_count_root (dt); + + dt->header = &((INDEX_ROOT*)dt->data)->index; + dt->data_len = ((INDEX_ROOT*)dt->data)->index_block_size; + //printf ("IBS = %d\n", ((INDEX_ROOT*)dt->data)->index_block_size); + +#if 0 + for (i = 0; i < dt->child_count; i++) { + INDEX_ENTRY *ie = dt->children[i]; + + printf ("%d\n", ((u8*)ie) - dt->data); + if (ie->flags & INDEX_ENTRY_END) + printf ("IE (%d)\n", ie->length); + else + printf ("IE %lld (%d)\n", MREF (ie->key.file_name.parent_directory), ie->length); + utils_dump_mem ((u8*)ie, 0, ie->length, 1); + printf ("\n"); + } +#endif + } + //printf ("index_header (%d,%d)\n", dt->header.index_length, dt->header.allocated_size); + + return dt; +} + +/** + * ntfs_dt_free + */ +void ntfs_dt_free (struct ntfs_dt *dt) +{ + int i; + + if (!dt) + return; + + for (i = 0; i < dt->child_count; i++) + ntfs_dt_free (dt->sub_nodes[i]); + + ntfs_free (dt->sub_nodes); + ntfs_free (dt->children); + ntfs_free (dt->data); + ntfs_free (dt); +} + +/** + * ntfs_dt_find + */ +MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) +{ + MFT_REF res = -1; + INDEX_ENTRY *ie; + struct ntfs_dt *sub; + VCN vcn; + int i; + int r; + + if (!dt || !name) + return -1; + + /* + * State Children Action + * ------------------------------------------- + * collates after - keep searching + * match name - return MREF + * collates before no return -1 + * collates before yes map & recurse + * end marker no return -1 + * end marker yes map & recurse + */ + + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + if (ie->flags & INDEX_ENTRY_END) { + r = -1; + } else { + //printf ("\t"); ntfs_print_name (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); + r = ntfs_names_collate (name, name_len, + ie->key.file_name.file_name, + ie->key.file_name.file_name_length, + 2, IGNORE_CASE, + dt->dir->vol->upcase, + dt->dir->vol->upcase_len); + } + + //printf ("%d, %d\n", i, r); + + if (r == 1) { + //printf ("keep searching\n"); + continue; + } else if (r == 0) { + res = MREF (ie->indexed_file); + //printf ("match %lld\n", res); + } else if (r == -1) { + if (ie->flags & INDEX_ENTRY_NODE) { + //printf ("map & recurse\n"); + //printf ("sub %p\n", dt->sub_nodes); + if (!dt->sub_nodes[i]) { + vcn = *(VCN*)(((u8*)ie) + ie->length - sizeof (VCN)); + //printf ("vcn = %lld\n", vcn); + sub = ntfs_dt_alloc (dt->dir, dt, vcn); + dt->sub_nodes[i] = sub; + } + res = ntfs_dt_find (dt->sub_nodes[i], name, name_len); + } else { + //printf ("ENOENT\n"); + } + } else { + //printf ("error collating name\n"); + } + break; + } + + return res; +} + +/** + * ntfs_dt_find2 + */ +struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *uname, int len, int *index) +{ + struct ntfs_dt *res = NULL; + INDEX_ENTRY *ie; + int i; + int r; + + if (!dt || !uname) + return NULL; + + //printf ("child_count = %d\n", dt->child_count); + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + if (ie->flags & INDEX_ENTRY_END) { + r = -1; + } else { + r = ntfs_names_collate (uname, len, + ie->key.file_name.file_name, + ie->key.file_name.file_name_length, + 2, IGNORE_CASE, + dt->dir->vol->upcase, + dt->dir->vol->upcase_len); + } + + if (r == 1) { + //printf ("keep searching\n"); + continue; + } else if (r == 0) { + //printf ("match\n"); + res = dt; + if (index) + *index = i; + } else if (r == -1) { + //printf ("recurse\n"); + res = ntfs_dt_find2 (dt->sub_nodes[i], uname, len, index); + } else { + //printf ("error\n"); + } + break; + } + + return res; +} + + +/** + * ntfs_dt_remove + */ +int ntfs_dt_remove (struct ntfs_dt *dt, int index) +{ + INDEX_ENTRY *ie = NULL; + int i; + u8 *dest; + u8 *src; + u8 *end; + int off; + int len; + + if (!dt) + return 1; + if ((index < 0) || (index >= dt->child_count)) + return 1; + + //printf ("removing entry %d of %d\n", index, dt->child_count); + //printf ("index size = %d\n", dt->data_len); + //printf ("index use = %d\n", dt->header.index_length); + + //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); + //write (2, dt->data, dt->data_len); + + off = (u8*)dt->children[0] - dt->data; + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + //printf ("%2d %4d ", i, off); + off += ie->length; + + if (ie->flags & INDEX_ENTRY_END) { + //printf ("END (%d)\n", ie->length); + break; + } + + //ntfs_print_name (ie->key.file_name.file_name, ie->key.file_name.file_name_length); + //printf (" (%d)\n", ie->length); + } + //printf ("total = %d\n", off); + + ie = dt->children[index]; + dest = (u8*)ie; + + src = dest + ie->length; + + ie = dt->children[dt->child_count-1]; + end = (u8*)ie + ie->length; + + len = end - src; + + //printf ("move %d bytes\n", len); + //printf ("%d, %d, %d\n", dest - dt->data, src - dt->data, len); + memmove (dest, src, len); + + //printf ("clear %d bytes\n", dt->data_len - (dest - dt->data) - len); + //printf ("%d, %d, %d\n", dest - dt->data + len, 0, dt->data_len - (dest - dt->data) - len); + memset (dest + len, 0, dt->data_len - (dest - dt->data) - len); + + for (i = index; i < dt->child_count; i++) { + ntfs_dt_free (dt->sub_nodes[i]); // shouldn't be any, yet + } + + ntfs_free (dt->sub_nodes); + dt->sub_nodes = NULL; + ntfs_free (dt->children); + dt->children = NULL; + dt->child_count = 0; + + dt->header->index_length -= src - dest; + + ntfs_dt_count_alloc (dt); + //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); + //write (2, dt->data, 48); + +#if 1 + //printf ("\n"); + //printf ("index size = %d\n", dt->data_len); + //printf ("index use = %d\n", dt->header.index_length); + + off = (u8*)dt->children[0] - dt->data; + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + printf ("%2d %4d ", i, off); + off += ie->length; + + if (ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", ie->length); + break; + } + + ntfs_print_name (ie->key.file_name.file_name, + ie->key.file_name.file_name_length); + printf (" (%d)\n", ie->length); + } +#endif + + return 0; +} + +/** + * ntfs_dt_del_child + */ +int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) +{ + struct ntfs_dt *del; + INDEX_ENTRY *ie; + ntfs_inode *inode = NULL; + ntfs_attr *attr = NULL; + int index = 0; + int res = 1; + + del = ntfs_dt_find2 (dt, uname, len, &index); + if (!del) { + printf ("can't find item to delete\n"); + goto close; + } + + if ((index < 0) || (index >= del->child_count)) { + printf ("error in dt_find\n"); + goto close; + } + + if (del->header->flags & INDEX_NODE) { + printf ("can only delete leaf nodes\n"); + goto close; + } + + ie = del->children[index]; + if (ie->key.file_name.file_attributes & FILE_ATTR_DIRECTORY) { + printf ("can't delete directories\n"); + goto close; + } + + if (ie->key.file_name.file_attributes & FILE_ATTR_SYSTEM) { + printf ("can't delete system files\n"); + goto close; + } + + inode = ntfs_inode_open (dt->dir->vol, MREF (ie->indexed_file)); + if (!inode) { + printf ("can't open inode\n"); + goto close; + } + + attr = ntfs_attr_open (inode, AT_ATTRIBUTE_LIST, NULL, 0); + if (attr) { + printf ("can't delete files with an attribute list\n"); + goto close; + } + + ntfs_attr_close (attr); + + attr = ntfs_attr_open (inode, AT_INDEX_ROOT, NULL, 0); + if (attr) { + printf ("can't delete directories\n"); + goto close; + } + + ntfs_attr_close (attr); + + attr = ntfs_attr_open (inode, AT_DATA, NULL, 0); + if (!attr) { + printf ("can't open data\n"); + goto close; + } + + if (attr->rl) { + printf ("can't delete non-resident files\n"); + goto close; + } + + //printf ("deleting file\n"); + + res = ntfs_dt_remove (del, index); +close: + ntfs_attr_close (attr); + ntfs_inode_close (inode); + return res; +} + + +/** + * ntfs_dir_alloc + */ +struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) +{ + struct ntfs_dir *dir = NULL; + ntfs_inode *inode = NULL; + + if (!vol) + return NULL; + + inode = ntfs_inode_open (vol, mft_num); + if (!inode) + return NULL; + + dir = ntfs_calloc (1, sizeof (*dir)); + if (!dir) { + ntfs_inode_close (inode); + return NULL; + } + + dir->vol = vol; + dir->parent = NULL; + dir->name = NULL; + dir->name_len = 0; + dir->index = NULL; + dir->children = NULL; + dir->child_count = 0; + dir->mft_num = mft_num; + dir->bitmap = NULL; + + dir->inode = inode; + dir->iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); + dir->ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); + dir->ibmp = ntfs_attr_open (inode, AT_BITMAP, I30, 4); + + if (!dir->iroot) { + ntfs_free (dir); + return NULL; + } + + return dir; +} + +/** + * ntfs_dir_free + */ +void ntfs_dir_free (struct ntfs_dir *dir) +{ + int i; + + if (!dir) + return; + + ntfs_attr_close (dir->iroot); + ntfs_attr_close (dir->ialloc); + ntfs_attr_close (dir->ibmp); + ntfs_inode_close (dir->inode); + + for (i = 0; i < dir->child_count; i++) + ntfs_dir_free (dir->children[i]); + + ntfs_free (dir->children); + + ntfs_dt_free (dir->index); + ntfs_free (dir); +} + +/** + * ntfs_dir_find + */ +MFT_REF ntfs_dir_find (struct ntfs_dir *dir, char *name) +{ + MFT_REF mft_num; + ntfschar *uname = NULL; + int len; + + if (!dir || !name) + return -1; + + len = ntfs_mbstoucs (name, &uname, 0); + if (len < 0) + return -1; + + if (!dir->index) + dir->index = ntfs_dt_alloc (dir, NULL, -1); + + //printf ("dir->index = %p\n", dir->index); + //printf ("dir->child_count = %d\n", dir->child_count); + //printf ("uname = %p\n", uname); + mft_num = ntfs_dt_find (dir->index, uname, len); + + free (uname); + return mft_num; +} + +/** + * ntfs_dir_add + */ +void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) +{ + if (!parent || !child) + return; + + parent->child_count++; + //printf ("child count = %d\n", parent->child_count); + parent->children = ntfs_realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); + child->parent = parent; + + parent->children[parent->child_count-1] = child; +} + + +/** + * utils_pathname_to_mftref + */ +MFT_REF utils_pathname_to_mftref (ntfs_volume *vol, struct ntfs_dir *parent, const char *pathname, struct ntfs_dir **finddir) +{ + MFT_REF mft_num; + MFT_REF result = -1; + char *p, *q; + char *ascii = NULL; + struct ntfs_dir *dir = NULL; + + if (!vol || !parent || !pathname) { + errno = EINVAL; + return -1; + } + + ascii = strdup (pathname); // Work with a r/w copy + if (!ascii) { + Eprintf ("Out of memory.\n"); + goto close; + } + + p = ascii; + while (p && *p && *p == PATH_SEP) // Remove leading /'s + p++; + while (p && *p) { + q = strchr (p, PATH_SEP); // Find the end of the first token + if (q != NULL) { + *q = '\0'; + q++; + } + + //printf ("looking for %s\n", p); + mft_num = ntfs_dir_find (parent, p); + if (mft_num == (u64)-1) { + Eprintf ("Couldn't find name '%s' in pathname '%s'.\n", p, pathname); + goto close; + } + + if (q) { + dir = ntfs_dir_alloc (vol, mft_num); + if (!dir) { + Eprintf ("Couldn't allocate a new directory (%lld).\n", mft_num); + goto close; + } + + ntfs_dir_add (parent, dir); + parent = dir; + } else { + //printf ("file %s\n", p); + result = mft_num; + if (finddir) + *finddir = dir ? dir : parent; + break; + } + + p = q; + while (p && *p && *p == PATH_SEP) + p++; + } + +close: + free (ascii); + return result; +} + + +/** + * ntfsrm2 + */ +int ntfsrm2 (ntfs_volume *vol, char *name) +{ + struct ntfs_dir *dir = NULL; + struct ntfs_dir *finddir = NULL; + MFT_REF mft_num; + ntfschar *uname = NULL; + int len; + + dir = ntfs_dir_alloc (vol, FILE_root); + if (!dir) + return 1; + + //mft_num = ntfs_dir_find (dir, name); + //printf ("%s = %lld\n", name, mft_num); + + mft_num = utils_pathname_to_mftref (vol, dir, name, &finddir); + //printf ("mft_num = %lld\n", mft_num); + //printf ("finddir = %p\n", finddir); + + if (rindex (name, PATH_SEP)) + name = rindex (name, PATH_SEP) + 1; + len = ntfs_mbstoucs (name, &uname, 0); + if (len < 0) + return 1; + + ntfs_dt_del_child (finddir->index, uname, len); + + ntfs_dir_free (dir); + free (uname); + return 0; +} + +/** + * utils_mftrec_mark_free + */ +int utils_mftrec_mark_free (ntfs_volume *vol, MFT_REF mref) +{ + static u8 buffer[512]; + static s64 bmpmref = -sizeof (buffer) - 1; /* Which bit of $BITMAP is in the buffer */ + + int byte, bit; + + if (!vol) { + errno = EINVAL; + return -1; + } + + /* Does mref lie in the section of $Bitmap we already have cached? */ + if (((s64)MREF(mref) < bmpmref) || ((s64)MREF(mref) >= (bmpmref + + (sizeof (buffer) << 3)))) { + Dprintf ("Bit lies outside cache.\n"); + + /* Mark the buffer as not in use, in case the read is shorter. */ + memset (buffer, 0, sizeof (buffer)); + bmpmref = mref & (~((sizeof (buffer) << 3) - 1)); + + if (ntfs_attr_pread (vol->mftbmp_na, (bmpmref>>3), sizeof (buffer), buffer) < 0) { + Eprintf ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno)); + return -1; + } + + Dprintf ("Reloaded bitmap buffer.\n"); + } + + bit = 1 << (mref & 7); + byte = (mref >> 3) & (sizeof (buffer) - 1); + Dprintf ("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", + mref, bmpmref, byte, bit, buffer[byte] & bit); + + return (buffer[byte] & bit); +} + +/** + * ntfsrm - Delete a file from an NTFS volume + */ +int ntfsrm (ntfs_volume *vol, ntfs_inode *inode, struct options *opts) +{ + char buffer[128]; + ntfs_inode *parent; + int links = 0; + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *rec; + FILE_NAME_ATTR *name; + char *namestr = NULL; + u64 parent_mref = 0; + //struct ntfs_dt *dt; + + if (!vol || !inode || !opts) + return 1; + if (!inode->mrec) + return 1; + + utils_inode_get_name (inode, buffer, sizeof (buffer)); + printf ("deleting %s\n", buffer); + printf ("\n"); + + parent = NULL; + + links = inode->mrec->link_count; + printf ("file has %d hard links\n", links); + + ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); + if (!ctx) + return 1; + + printf ("file inum = %lld\n", inode->mft_no); + + while ((rec = find_attribute (AT_FILE_NAME, ctx))) { + name = (FILE_NAME_ATTR*) ((u8*)rec + rec->value_offset); + + ntfs_ucstombs (name->file_name, name->file_name_length, &namestr, 0); + printf ("$FILE_NAME: %s\n", namestr); + if (parent_mref == 0) { + parent_mref = name->parent_directory; + printf ("parent = %lld\n", MREF (parent_mref)); + } + + free (namestr); + namestr = NULL; + } + printf ("\n"); + + if (parent_mref == 0) + return 1; + + parent = ntfs_inode_open (vol, parent_mref); + if (!parent) + return 1; + + //dt = ntfs_dt_init (parent); + //ntfs_dt_free (dt); + + // check mft and mft's bitmap agree that record is in use + + // local pointers to + // mft record + // mft bitmap + // volume bitmap + + // pointer to + // index root + // index alloc + + ntfs_inode_close (parent); + return 0; +} + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main (int argc, char *argv[]) +{ + ntfs_volume *vol; + ntfs_inode *inode; + int flags = 0; + int result = 1; + + if (!parse_options (argc, argv)) + return 1; + + utils_set_locale(); + + /* + printf ("sizeof (bmp_page) = %d\n", sizeof (struct bmp_page)); + printf ("sizeof (mft_bitmap) = %d\n", sizeof (struct mft_bitmap)); + printf ("sizeof (ntfs_dt) = %d\n", sizeof (struct ntfs_dt)); + printf ("sizeof (ntfs_dir) = %d\n", sizeof (struct ntfs_dir)); + printf ("\n"); + */ + + if (opts.noaction) + flags |= MS_RDONLY; + + vol = utils_mount_volume (opts.device, flags, opts.force); + if (!vol) { + printf ("!vol\n"); + return 1; + } + + inode = utils_pathname_to_inode (vol, NULL, opts.file); + if (!inode) { + printf ("!inode\n"); + return 1; + } + + //result = ntfsrm (vol, inode, &opts); + result = ntfsrm2 (vol, opts.file); + /* + if (result) + printf ("failed\n"); + else + printf ("success\n"); + */ + + ntfs_inode_close (inode); + ntfs_umount (vol, FALSE); + //printf ("mem (%d,%d)\n", my_alloc, my_free); + return result; +} + From e9008c86175ee1514eff756edbfb4608ebc55a1a Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 29 May 2004 14:21:50 +0000 Subject: [PATCH 1461/2994] fix rest of mem problems, remove debug code (Logical change 1.401) --- ntfsprogs/ntfsrm.c | 252 ++++++++++++++++++++++++--------------------- 1 file changed, 135 insertions(+), 117 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 79222501..1d7d98f4 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -191,84 +191,6 @@ int parse_options (int argc, char **argv) } -static int my_alloc = 0; -static int my_free = 0; - -/** - * ntfs_malloc - */ -void * ntfs_malloc (int size) -{ - void *ptr; - my_alloc++; - ptr = malloc (size); - //printf ("alloc %p\n", ptr); - return ptr; -} - -/** - * ntfs_calloc - */ -void * ntfs_calloc (int count, int size) -{ - void *ptr; - my_alloc++; - ptr = calloc (count, size); - //printf ("alloc %p\n", ptr); - return ptr; -} - -/** - * ntfs_realloc - */ -void * ntfs_realloc (void *ptr, int size) -{ - void *new; - - new = realloc (ptr, size); - - if (ptr) { - //printf ("free %p\n", ptr); - my_free++; - } - if (new) { - //printf ("alloc %p\n", new); - my_alloc++; - } - return new; -} - -/** - * ntfs_free - */ -void ntfs_free (void *ptr) -{ - if (!ptr) - return; - my_free++; - //printf ("free %p\n", ptr); - free (ptr); -} - -/** - * ntfs_print_name - */ -void ntfs_print_name (ntfschar *name, int name_len) -{ - char *buffer = NULL; - - ntfs_ucstombs (name, name_len, (char**) &buffer, 0); - printf ("%s", buffer); - free (buffer); -} - - -// ntfs_dir_child_open (ntfs_dir *parent, ntfschar *name) -// ntfs_dir_add_child (ntfs_dir *parent, ntfschar *name, int flags) file/dir -// ntfs_dir_del_child (ntfs_dir *parent, ntfschar *name, int flags) file/dir/unlink -// ntfs_dir_link (ntfs_dir *parent, ntfschar *name, inode *child) -// ntfs_dir_list (ntfs_dir *parent, funct *callback) - struct ntfs_dir; /** @@ -294,13 +216,13 @@ struct mft_bitmap { struct ntfs_dt { struct ntfs_dir *dir; struct ntfs_dt *parent; - u8 *data; /* Raw index data */ + u8 *data; int data_len; struct ntfs_dt **sub_nodes; - int child_count; /* All my descendents */ + int child_count; INDEX_ENTRY **children; INDEX_HEADER *header; - BOOL changed; /* How do I commit myself */ + BOOL changed; VCN vcn; }; @@ -310,7 +232,7 @@ struct ntfs_dt { struct ntfs_dir { ntfs_volume *vol; struct ntfs_dir *parent; - ntfschar *name; + ntfschar *name; int name_len; struct ntfs_dt *index; struct ntfs_dir **children; @@ -324,6 +246,44 @@ struct ntfs_dir { }; +/** + * ntfs_print_name + */ +void ntfs_print_name (ntfschar *name, int name_len) +{ + char *buffer = NULL; + + ntfs_ucstombs (name, name_len, (char**) &buffer, 0); + printf ("%s", buffer); + free (buffer); +} + +/** + * ntfs_print_dir + */ +void ntfs_print_dir (struct ntfs_dir *dir) +{ + if (!dir) + return; + + printf ("vol = %p\n", dir->vol); + printf ("parent = %p\n", dir->parent); + printf ("name = "); ntfs_print_name (dir->name, dir->name_len); printf ("\n"); + printf ("name_len = %d\n", dir->name_len); + printf ("index = %p\n", dir->index); + printf ("children = %p\n", dir->children); + printf ("child_count = %d\n", dir->child_count); + printf ("mft_num = %8.8llx\n", dir->mft_num); + printf ("bitmap = %p\n", dir->bitmap); + printf ("inode = %p\n", dir->inode); + printf ("iroot = %p\n", dir->iroot); + printf ("ialloc = %p\n", dir->ialloc); + printf ("ibmp = %p\n", dir->ibmp); +} + + + + /** * ntfs_dt_alloc_children */ @@ -335,7 +295,7 @@ INDEX_ENTRY ** ntfs_dt_alloc_children (INDEX_ENTRY **children, int count) if (old == new) return children; - return ntfs_realloc (children, new * sizeof (INDEX_ENTRY*)); + return realloc (children, new * sizeof (INDEX_ENTRY*)); } /** @@ -398,7 +358,7 @@ int ntfs_dt_count_root (struct ntfs_dt *dt) if (dt->child_count > 0) { //printf ("%d subnodes\n", dt->child_count); - dt->sub_nodes = ntfs_calloc (dt->child_count, sizeof (struct ntfs_dt *)); + dt->sub_nodes = calloc (dt->child_count, sizeof (struct ntfs_dt *)); } return dt->child_count; } @@ -460,7 +420,7 @@ int ntfs_dt_count_alloc (struct ntfs_dt *dt) if (dt->child_count > 0) { //printf ("%d subnodes\n", dt->child_count); - dt->sub_nodes = ntfs_calloc (dt->child_count, sizeof (struct ntfs_dt *)); + dt->sub_nodes = calloc (dt->child_count, sizeof (struct ntfs_dt *)); } return dt->child_count; @@ -478,7 +438,7 @@ struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *parent, VC if (!dir) return NULL; - dt = ntfs_calloc (1, sizeof (*dt)); + dt = calloc (1, sizeof (*dt)); if (!dt) return NULL; @@ -498,7 +458,7 @@ struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *parent, VC dt->data_len = parent->data_len; //printf ("parent size = %d\n", dt->data_len); - dt->data = ntfs_malloc (dt->data_len); + dt->data = malloc (dt->data_len); //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 2, 2048, dt->data)); ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data); //utils_dump_mem (dt->data, 0, dt->data_len, 1); @@ -528,7 +488,7 @@ struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *parent, VC //printf ("root i = %lld\n", dir->iroot->initialized_size); dt->data_len = dir->iroot->allocated_size; - dt->data = ntfs_malloc (dt->data_len); + dt->data = malloc (dt->data_len); //printf ("%lld\n", ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data)); ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data); //utils_dump_mem (dt->data, 0, dt->data_len, 1); @@ -571,10 +531,10 @@ void ntfs_dt_free (struct ntfs_dt *dt) for (i = 0; i < dt->child_count; i++) ntfs_dt_free (dt->sub_nodes[i]); - ntfs_free (dt->sub_nodes); - ntfs_free (dt->children); - ntfs_free (dt->data); - ntfs_free (dt); + free (dt->sub_nodes); + free (dt->children); + free (dt->data); + free (dt); } /** @@ -698,6 +658,24 @@ struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *uname, int len, in } +/** + * ntfs_dt_print + */ +void ntfs_dt_print (struct ntfs_dt *dt, int indent) +{ + char *space = " "; + int i; + + if (!dt) + return; + + printf ("%.*s%p\n", indent, space, dt); + + for (i = 0; i < dt->child_count; i++) { + ntfs_dt_print (dt->sub_nodes[i], indent + 4); + } +} + /** * ntfs_dt_remove */ @@ -756,25 +734,28 @@ int ntfs_dt_remove (struct ntfs_dt *dt, int index) //printf ("clear %d bytes\n", dt->data_len - (dest - dt->data) - len); //printf ("%d, %d, %d\n", dest - dt->data + len, 0, dt->data_len - (dest - dt->data) - len); +#if 1 memset (dest + len, 0, dt->data_len - (dest - dt->data) - len); for (i = index; i < dt->child_count; i++) { + printf ("this shouldn't happen\n"); ntfs_dt_free (dt->sub_nodes[i]); // shouldn't be any, yet } - ntfs_free (dt->sub_nodes); + free (dt->sub_nodes); dt->sub_nodes = NULL; - ntfs_free (dt->children); + free (dt->children); dt->children = NULL; dt->child_count = 0; dt->header->index_length -= src - dest; ntfs_dt_count_alloc (dt); +#endif //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); - //write (2, dt->data, 48); + //write (2, dt->data, dt->data_len); -#if 1 +#if 0 //printf ("\n"); //printf ("index size = %d\n", dt->data_len); //printf ("index use = %d\n", dt->header.index_length); @@ -811,6 +792,9 @@ int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) ntfs_attr *attr = NULL; int index = 0; int res = 1; + ATTR_RECORD *arec; + FILE_NAME_ATTR *file; + MFT_REF mft_num; del = ntfs_dt_find2 (dt, uname, len, &index); if (!del) { @@ -851,16 +835,12 @@ int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) goto close; } - ntfs_attr_close (attr); - - attr = ntfs_attr_open (inode, AT_INDEX_ROOT, NULL, 0); + attr = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); if (attr) { printf ("can't delete directories\n"); goto close; } - ntfs_attr_close (attr); - attr = ntfs_attr_open (inode, AT_DATA, NULL, 0); if (!attr) { printf ("can't open data\n"); @@ -872,9 +852,35 @@ int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) goto close; } - //printf ("deleting file\n"); + ntfs_attr_close (attr); + attr = NULL; - res = ntfs_dt_remove (del, index); + arec = find_first_attribute (AT_FILE_NAME, inode->mrec); + if (!arec) { + printf ("can't read filename\n"); + goto close; + } + + file = (FILE_NAME_ATTR*) ((u8*) arec + arec->value_offset); + mft_num = MREF (file->parent_directory); + + ntfs_inode_close (inode); + + inode = ntfs_inode_open (dt->dir->vol, mft_num); + if (!inode) { + printf ("can't open parent directory\n"); + goto close; + } + + attr = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); + if (!attr) { + printf ("parent doesn't have 0xA0\n"); + goto close; + } + + printf ("deleting file\n"); + //ntfs_dt_print (del->dir->index, 0); + //res = ntfs_dt_remove (del, index); close: ntfs_attr_close (attr); ntfs_inode_close (inode); @@ -897,7 +903,7 @@ struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) if (!inode) return NULL; - dir = ntfs_calloc (1, sizeof (*dir)); + dir = calloc (1, sizeof (*dir)); if (!dir) { ntfs_inode_close (inode); return NULL; @@ -919,7 +925,7 @@ struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) dir->ibmp = ntfs_attr_open (inode, AT_BITMAP, I30, 4); if (!dir->iroot) { - ntfs_free (dir); + free (dir); return NULL; } @@ -931,11 +937,21 @@ struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) */ void ntfs_dir_free (struct ntfs_dir *dir) { + struct ntfs_dir *parent; int i; if (!dir) return; + parent = dir->parent; + if (parent) { + for (i = 0; i < parent->child_count; i++) { + if (parent->children[i] == dir) { + parent->children[i] = NULL; + } + } + } + ntfs_attr_close (dir->iroot); ntfs_attr_close (dir->ialloc); ntfs_attr_close (dir->ibmp); @@ -944,10 +960,10 @@ void ntfs_dir_free (struct ntfs_dir *dir) for (i = 0; i < dir->child_count; i++) ntfs_dir_free (dir->children[i]); - ntfs_free (dir->children); + free (dir->children); ntfs_dt_free (dir->index); - ntfs_free (dir); + free (dir); } /** @@ -988,7 +1004,7 @@ void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) parent->child_count++; //printf ("child count = %d\n", parent->child_count); - parent->children = ntfs_realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); + parent->children = realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); child->parent = parent; parent->children[parent->child_count-1] = child; @@ -1082,10 +1098,11 @@ int ntfsrm2 (ntfs_volume *vol, char *name) mft_num = utils_pathname_to_mftref (vol, dir, name, &finddir); //printf ("mft_num = %lld\n", mft_num); - //printf ("finddir = %p\n", finddir); + //ntfs_print_dir (finddir); if (rindex (name, PATH_SEP)) name = rindex (name, PATH_SEP) + 1; + len = ntfs_mbstoucs (name, &uname, 0); if (len < 0) return 1; @@ -1222,23 +1239,23 @@ int ntfsrm (ntfs_volume *vol, ntfs_inode *inode, struct options *opts) */ int main (int argc, char *argv[]) { - ntfs_volume *vol; - ntfs_inode *inode; + ntfs_volume *vol = NULL; + ntfs_inode *inode = NULL; int flags = 0; int result = 1; if (!parse_options (argc, argv)) - return 1; + goto done; utils_set_locale(); - /* +#if 0 printf ("sizeof (bmp_page) = %d\n", sizeof (struct bmp_page)); printf ("sizeof (mft_bitmap) = %d\n", sizeof (struct mft_bitmap)); printf ("sizeof (ntfs_dt) = %d\n", sizeof (struct ntfs_dt)); printf ("sizeof (ntfs_dir) = %d\n", sizeof (struct ntfs_dir)); printf ("\n"); - */ +#endif if (opts.noaction) flags |= MS_RDONLY; @@ -1246,13 +1263,13 @@ int main (int argc, char *argv[]) vol = utils_mount_volume (opts.device, flags, opts.force); if (!vol) { printf ("!vol\n"); - return 1; + goto done; } inode = utils_pathname_to_inode (vol, NULL, opts.file); if (!inode) { printf ("!inode\n"); - return 1; + goto done; } //result = ntfsrm (vol, inode, &opts); @@ -1264,9 +1281,10 @@ int main (int argc, char *argv[]) printf ("success\n"); */ +done: ntfs_inode_close (inode); ntfs_umount (vol, FALSE); - //printf ("mem (%d,%d)\n", my_alloc, my_free); + return result; } From cb41d62d724c3bd24930ea58fcbea37c74e7513b Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 29 May 2004 14:21:50 +0000 Subject: [PATCH 1462/2994] fix rest of mem problems, remove debug code BKrev: 40b89c7eniLYsktrRlULFIDTJntH_Q From ef75cd263f186ae5784759559aa101dd67640306 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 29 May 2004 14:21:50 +0000 Subject: [PATCH 1463/2994] make output human-readable (Logical change 1.401) --- ntfsprogs/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index e96d8a83..b66f3e36 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -1,7 +1,7 @@ /** * utils.c - Part of the Linux-NTFS project. * - * Copyright (c) 2002-2003 Richard Russon + * Copyright (c) 2002-2004 Richard Russon * Copyright (c) 2003-2004 Anton Altaparmakov * Copyright (c) 2003 Lode Leroy * @@ -771,6 +771,7 @@ ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, cons if (ni != parent) ntfs_inode_close (ni); + inum = MREF (inum); ni = ntfs_inode_open (vol, inum); if (!ni) { Eprintf ("Cannot open inode %llu: %s.\n", From 9886424982a448bb6efc9299bbe7007c1dd0f425 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 30 May 2004 16:52:00 +0000 Subject: [PATCH 1464/2994] fix non-res check (Logical change 1.402) --- ntfsprogs/ntfsrm.c | 104 ++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 1d7d98f4..4674ece4 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -35,6 +35,7 @@ static const char *EXEC_NAME = "ntfsrm"; static struct options opts; +static char *space = " "; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) @@ -247,9 +248,9 @@ struct ntfs_dir { /** - * ntfs_print_name + * ntfs_name_print */ -void ntfs_print_name (ntfschar *name, int name_len) +void ntfs_name_print (ntfschar *name, int name_len) { char *buffer = NULL; @@ -259,29 +260,40 @@ void ntfs_print_name (ntfschar *name, int name_len) } /** - * ntfs_print_dir + * ntfs_dir_print */ -void ntfs_print_dir (struct ntfs_dir *dir) +void ntfs_dir_print (struct ntfs_dir *dir, int indent) { + int i; if (!dir) return; - printf ("vol = %p\n", dir->vol); - printf ("parent = %p\n", dir->parent); - printf ("name = "); ntfs_print_name (dir->name, dir->name_len); printf ("\n"); - printf ("name_len = %d\n", dir->name_len); - printf ("index = %p\n", dir->index); - printf ("children = %p\n", dir->children); - printf ("child_count = %d\n", dir->child_count); - printf ("mft_num = %8.8llx\n", dir->mft_num); - printf ("bitmap = %p\n", dir->bitmap); - printf ("inode = %p\n", dir->inode); - printf ("iroot = %p\n", dir->iroot); - printf ("ialloc = %p\n", dir->ialloc); - printf ("ibmp = %p\n", dir->ibmp); + printf ("%.*s%p ", indent, space, dir); + ntfs_name_print (dir->name, dir->name_len); + printf ("\n"); + + for (i = 0; i < dir->child_count; i++) { + ntfs_dir_print (dir->children[i], indent + 4); + } + } +/** + * ntfs_dt_print + */ +void ntfs_dt_print (struct ntfs_dt *dt, int indent) +{ + int i; + if (!dt) + return; + + printf ("%.*s%p (%d)\n", indent, space, dt, dt->child_count); + + for (i = 0; i < dt->child_count; i++) { + ntfs_dt_print (dt->sub_nodes[i], indent + 4); + } +} /** @@ -569,7 +581,7 @@ MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) if (ie->flags & INDEX_ENTRY_END) { r = -1; } else { - //printf ("\t"); ntfs_print_name (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); + //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); r = ntfs_names_collate (name, name_len, ie->key.file_name.file_name, ie->key.file_name.file_name_length, @@ -658,24 +670,6 @@ struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *uname, int len, in } -/** - * ntfs_dt_print - */ -void ntfs_dt_print (struct ntfs_dt *dt, int indent) -{ - char *space = " "; - int i; - - if (!dt) - return; - - printf ("%.*s%p\n", indent, space, dt); - - for (i = 0; i < dt->child_count; i++) { - ntfs_dt_print (dt->sub_nodes[i], indent + 4); - } -} - /** * ntfs_dt_remove */ @@ -713,7 +707,7 @@ int ntfs_dt_remove (struct ntfs_dt *dt, int index) break; } - //ntfs_print_name (ie->key.file_name.file_name, ie->key.file_name.file_name_length); + //ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); //printf (" (%d)\n", ie->length); } //printf ("total = %d\n", off); @@ -734,13 +728,17 @@ int ntfs_dt_remove (struct ntfs_dt *dt, int index) //printf ("clear %d bytes\n", dt->data_len - (dest - dt->data) - len); //printf ("%d, %d, %d\n", dest - dt->data + len, 0, dt->data_len - (dest - dt->data) - len); + + //ntfs_dt_print (dt->dir->index, 0); #if 1 memset (dest + len, 0, dt->data_len - (dest - dt->data) - len); - for (i = index; i < dt->child_count; i++) { - printf ("this shouldn't happen\n"); + /* + for (i = 0; i < dt->child_count; i++) { + printf ("this shouldn't happen %p\n", dt->sub_nodes[i]); ntfs_dt_free (dt->sub_nodes[i]); // shouldn't be any, yet } + */ free (dt->sub_nodes); dt->sub_nodes = NULL; @@ -772,7 +770,7 @@ int ntfs_dt_remove (struct ntfs_dt *dt, int index) break; } - ntfs_print_name (ie->key.file_name.file_name, + ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf (" (%d)\n", ie->length); } @@ -790,6 +788,7 @@ int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) INDEX_ENTRY *ie; ntfs_inode *inode = NULL; ntfs_attr *attr = NULL; + ntfs_attr_search_ctx *ctx = NULL; int index = 0; int res = 1; ATTR_RECORD *arec; @@ -841,23 +840,21 @@ int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) goto close; } - attr = ntfs_attr_open (inode, AT_DATA, NULL, 0); - if (!attr) { - printf ("can't open data\n"); - goto close; - } - - if (attr->rl) { + arec = find_first_attribute (AT_DATA, inode->mrec); + if (arec->non_resident) { printf ("can't delete non-resident files\n"); goto close; } - ntfs_attr_close (attr); - attr = NULL; + ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); + if (!ctx) { + printf ("can't create a search context\n"); + goto close; + } - arec = find_first_attribute (AT_FILE_NAME, inode->mrec); - if (!arec) { - printf ("can't read filename\n"); + arec = find_attribute (AT_FILE_NAME, ctx); + if (find_attribute (AT_FILE_NAME, ctx)) { + printf ("file has more than one name\n"); goto close; } @@ -880,8 +877,9 @@ int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) printf ("deleting file\n"); //ntfs_dt_print (del->dir->index, 0); - //res = ntfs_dt_remove (del, index); + res = ntfs_dt_remove (del, index); close: + ntfs_attr_put_search_ctx (ctx); ntfs_attr_close (attr); ntfs_inode_close (inode); return res; From a9d8a962a97bd16b206e91f3a925f0c2d8ef9d41 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 30 May 2004 16:52:00 +0000 Subject: [PATCH 1465/2994] fix non-res check BKrev: 40ba11301-Wz03L_1TQM_blOIhCUpg From 79b403acca17e1ce75b6b59d2b5dff4e1c4822ec Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 30 May 2004 17:26:50 +0000 Subject: [PATCH 1466/2994] tidy warnings (Logical change 1.403) --- ntfsprogs/ntfsrm.c | 78 ++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 4674ece4..e873473c 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -35,7 +35,7 @@ static const char *EXEC_NAME = "ntfsrm"; static struct options opts; -static char *space = " "; +static const char *space = " "; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) @@ -48,7 +48,7 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -void version (void) +static void version (void) { printf ("\n%s v%s - Delete files from an NTFS volume.\n\n", EXEC_NAME, VERSION); @@ -63,7 +63,7 @@ void version (void) * * Return: none */ -void usage (void) +static void usage (void) { printf ("\nUsage: %s [options] device file\n" "\n" @@ -92,7 +92,7 @@ void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -int parse_options (int argc, char **argv) +static int parse_options (int argc, char **argv) { static const char *sopt = "-Dfh?inqRrVv"; //"-Dfh?I:inqRrUVv"; static const struct option lopt[] = { @@ -250,7 +250,7 @@ struct ntfs_dir { /** * ntfs_name_print */ -void ntfs_name_print (ntfschar *name, int name_len) +static void ntfs_name_print (ntfschar *name, int name_len) { char *buffer = NULL; @@ -262,7 +262,7 @@ void ntfs_name_print (ntfschar *name, int name_len) /** * ntfs_dir_print */ -void ntfs_dir_print (struct ntfs_dir *dir, int indent) +static void ntfs_dir_print (struct ntfs_dir *dir, int indent) { int i; if (!dir) @@ -281,7 +281,7 @@ void ntfs_dir_print (struct ntfs_dir *dir, int indent) /** * ntfs_dt_print */ -void ntfs_dt_print (struct ntfs_dt *dt, int indent) +static void ntfs_dt_print (struct ntfs_dt *dt, int indent) { int i; @@ -299,7 +299,7 @@ void ntfs_dt_print (struct ntfs_dt *dt, int indent) /** * ntfs_dt_alloc_children */ -INDEX_ENTRY ** ntfs_dt_alloc_children (INDEX_ENTRY **children, int count) +static INDEX_ENTRY ** ntfs_dt_alloc_children (INDEX_ENTRY **children, int count) { int old = (count + 0x1e) & ~0x1f; int new = (count + 0x1f) & ~0x1f; @@ -313,7 +313,7 @@ INDEX_ENTRY ** ntfs_dt_alloc_children (INDEX_ENTRY **children, int count) /** * ntfs_dt_count_root */ -int ntfs_dt_count_root (struct ntfs_dt *dt) +static int ntfs_dt_count_root (struct ntfs_dt *dt) { u8 *buffer = NULL; u8 *ptr = NULL; @@ -378,7 +378,7 @@ int ntfs_dt_count_root (struct ntfs_dt *dt) /** * ntfs_dt_count_alloc */ -int ntfs_dt_count_alloc (struct ntfs_dt *dt) +static int ntfs_dt_count_alloc (struct ntfs_dt *dt) { u8 *buffer = NULL; u8 *ptr = NULL; @@ -442,7 +442,7 @@ int ntfs_dt_count_alloc (struct ntfs_dt *dt) /** * ntfs_dt_alloc */ -struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn) +static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn) { struct ntfs_dt *dt = NULL; //int i; @@ -533,7 +533,7 @@ struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *parent, VC /** * ntfs_dt_free */ -void ntfs_dt_free (struct ntfs_dt *dt) +static void ntfs_dt_free (struct ntfs_dt *dt) { int i; @@ -552,7 +552,7 @@ void ntfs_dt_free (struct ntfs_dt *dt) /** * ntfs_dt_find */ -MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) +static MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) { MFT_REF res = -1; INDEX_ENTRY *ie; @@ -624,7 +624,7 @@ MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) /** * ntfs_dt_find2 */ -struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *uname, int len, int *index) +static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *uname, int len, int *index_num) { struct ntfs_dt *res = NULL; INDEX_ENTRY *ie; @@ -655,11 +655,11 @@ struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *uname, int len, in } else if (r == 0) { //printf ("match\n"); res = dt; - if (index) - *index = i; + if (index_num) + *index_num = i; } else if (r == -1) { //printf ("recurse\n"); - res = ntfs_dt_find2 (dt->sub_nodes[i], uname, len, index); + res = ntfs_dt_find2 (dt->sub_nodes[i], uname, len, index_num); } else { //printf ("error\n"); } @@ -673,7 +673,7 @@ struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *uname, int len, in /** * ntfs_dt_remove */ -int ntfs_dt_remove (struct ntfs_dt *dt, int index) +static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) { INDEX_ENTRY *ie = NULL; int i; @@ -685,10 +685,10 @@ int ntfs_dt_remove (struct ntfs_dt *dt, int index) if (!dt) return 1; - if ((index < 0) || (index >= dt->child_count)) + if ((index_num < 0) || (index_num >= dt->child_count)) return 1; - //printf ("removing entry %d of %d\n", index, dt->child_count); + //printf ("removing entry %d of %d\n", index_num, dt->child_count); //printf ("index size = %d\n", dt->data_len); //printf ("index use = %d\n", dt->header.index_length); @@ -712,7 +712,7 @@ int ntfs_dt_remove (struct ntfs_dt *dt, int index) } //printf ("total = %d\n", off); - ie = dt->children[index]; + ie = dt->children[index_num]; dest = (u8*)ie; src = dest + ie->length; @@ -729,7 +729,7 @@ int ntfs_dt_remove (struct ntfs_dt *dt, int index) //printf ("clear %d bytes\n", dt->data_len - (dest - dt->data) - len); //printf ("%d, %d, %d\n", dest - dt->data + len, 0, dt->data_len - (dest - dt->data) - len); - //ntfs_dt_print (dt->dir->index, 0); + //ntfs_dt_print (dt->dir->index_num, 0); #if 1 memset (dest + len, 0, dt->data_len - (dest - dt->data) - len); @@ -782,26 +782,26 @@ int ntfs_dt_remove (struct ntfs_dt *dt, int index) /** * ntfs_dt_del_child */ -int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) +static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) { struct ntfs_dt *del; INDEX_ENTRY *ie; ntfs_inode *inode = NULL; ntfs_attr *attr = NULL; ntfs_attr_search_ctx *ctx = NULL; - int index = 0; + int index_num = 0; int res = 1; ATTR_RECORD *arec; FILE_NAME_ATTR *file; MFT_REF mft_num; - del = ntfs_dt_find2 (dt, uname, len, &index); + del = ntfs_dt_find2 (dt, uname, len, &index_num); if (!del) { printf ("can't find item to delete\n"); goto close; } - if ((index < 0) || (index >= del->child_count)) { + if ((index_num < 0) || (index_num >= del->child_count)) { printf ("error in dt_find\n"); goto close; } @@ -811,7 +811,7 @@ int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) goto close; } - ie = del->children[index]; + ie = del->children[index_num]; if (ie->key.file_name.file_attributes & FILE_ATTR_DIRECTORY) { printf ("can't delete directories\n"); goto close; @@ -876,8 +876,8 @@ int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) } printf ("deleting file\n"); - //ntfs_dt_print (del->dir->index, 0); - res = ntfs_dt_remove (del, index); + //ntfs_dt_print (del->dir->index_num, 0); + res = ntfs_dt_remove (del, index_num); close: ntfs_attr_put_search_ctx (ctx); ntfs_attr_close (attr); @@ -889,7 +889,7 @@ close: /** * ntfs_dir_alloc */ -struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) +static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) { struct ntfs_dir *dir = NULL; ntfs_inode *inode = NULL; @@ -933,7 +933,7 @@ struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) /** * ntfs_dir_free */ -void ntfs_dir_free (struct ntfs_dir *dir) +static void ntfs_dir_free (struct ntfs_dir *dir) { struct ntfs_dir *parent; int i; @@ -967,7 +967,7 @@ void ntfs_dir_free (struct ntfs_dir *dir) /** * ntfs_dir_find */ -MFT_REF ntfs_dir_find (struct ntfs_dir *dir, char *name) +static MFT_REF ntfs_dir_find (struct ntfs_dir *dir, char *name) { MFT_REF mft_num; ntfschar *uname = NULL; @@ -995,7 +995,7 @@ MFT_REF ntfs_dir_find (struct ntfs_dir *dir, char *name) /** * ntfs_dir_add */ -void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) +static void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) { if (!parent || !child) return; @@ -1012,7 +1012,7 @@ void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) /** * utils_pathname_to_mftref */ -MFT_REF utils_pathname_to_mftref (ntfs_volume *vol, struct ntfs_dir *parent, const char *pathname, struct ntfs_dir **finddir) +static MFT_REF utils_pathname_to_mftref (ntfs_volume *vol, struct ntfs_dir *parent, const char *pathname, struct ntfs_dir **finddir) { MFT_REF mft_num; MFT_REF result = -1; @@ -1079,7 +1079,7 @@ close: /** * ntfsrm2 */ -int ntfsrm2 (ntfs_volume *vol, char *name) +static int ntfsrm2 (ntfs_volume *vol, char *name) { struct ntfs_dir *dir = NULL; struct ntfs_dir *finddir = NULL; @@ -1112,10 +1112,11 @@ int ntfsrm2 (ntfs_volume *vol, char *name) return 0; } +#if 0 /** * utils_mftrec_mark_free */ -int utils_mftrec_mark_free (ntfs_volume *vol, MFT_REF mref) +static int utils_mftrec_mark_free (ntfs_volume *vol, MFT_REF mref) { static u8 buffer[512]; static s64 bmpmref = -sizeof (buffer) - 1; /* Which bit of $BITMAP is in the buffer */ @@ -1155,7 +1156,7 @@ int utils_mftrec_mark_free (ntfs_volume *vol, MFT_REF mref) /** * ntfsrm - Delete a file from an NTFS volume */ -int ntfsrm (ntfs_volume *vol, ntfs_inode *inode, struct options *opts) +static int ntfsrm (ntfs_volume *vol, ntfs_inode *inode, struct options *opts2) { char buffer[128]; ntfs_inode *parent; @@ -1167,7 +1168,7 @@ int ntfsrm (ntfs_volume *vol, ntfs_inode *inode, struct options *opts) u64 parent_mref = 0; //struct ntfs_dt *dt; - if (!vol || !inode || !opts) + if (!vol || !inode || !opts2) return 1; if (!inode->mrec) return 1; @@ -1227,6 +1228,7 @@ int ntfsrm (ntfs_volume *vol, ntfs_inode *inode, struct options *opts) return 0; } +#endif /** * main - Begin here * From a1b0b8420879c5c75c65661a8978d69075fdc220 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 30 May 2004 17:26:50 +0000 Subject: [PATCH 1467/2994] tidy warnings BKrev: 40ba195aaQXW3ABkUmOipbukhlaQnw From 489ceda90fa324231d76303122bad743d0879fca Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 31 May 2004 13:11:55 +0000 Subject: [PATCH 1468/2994] another case to ignore, remove unused code, mark mft rec as unused (Logical change 1.404) --- ntfsprogs/ntfsrm.c | 592 ++++++++++++++++++++------------------------- 1 file changed, 268 insertions(+), 324 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index e873473c..c1909a67 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -670,222 +670,6 @@ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *uname, int } -/** - * ntfs_dt_remove - */ -static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) -{ - INDEX_ENTRY *ie = NULL; - int i; - u8 *dest; - u8 *src; - u8 *end; - int off; - int len; - - if (!dt) - return 1; - if ((index_num < 0) || (index_num >= dt->child_count)) - return 1; - - //printf ("removing entry %d of %d\n", index_num, dt->child_count); - //printf ("index size = %d\n", dt->data_len); - //printf ("index use = %d\n", dt->header.index_length); - - //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); - //write (2, dt->data, dt->data_len); - - off = (u8*)dt->children[0] - dt->data; - for (i = 0; i < dt->child_count; i++) { - ie = dt->children[i]; - - //printf ("%2d %4d ", i, off); - off += ie->length; - - if (ie->flags & INDEX_ENTRY_END) { - //printf ("END (%d)\n", ie->length); - break; - } - - //ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); - //printf (" (%d)\n", ie->length); - } - //printf ("total = %d\n", off); - - ie = dt->children[index_num]; - dest = (u8*)ie; - - src = dest + ie->length; - - ie = dt->children[dt->child_count-1]; - end = (u8*)ie + ie->length; - - len = end - src; - - //printf ("move %d bytes\n", len); - //printf ("%d, %d, %d\n", dest - dt->data, src - dt->data, len); - memmove (dest, src, len); - - //printf ("clear %d bytes\n", dt->data_len - (dest - dt->data) - len); - //printf ("%d, %d, %d\n", dest - dt->data + len, 0, dt->data_len - (dest - dt->data) - len); - - //ntfs_dt_print (dt->dir->index_num, 0); -#if 1 - memset (dest + len, 0, dt->data_len - (dest - dt->data) - len); - - /* - for (i = 0; i < dt->child_count; i++) { - printf ("this shouldn't happen %p\n", dt->sub_nodes[i]); - ntfs_dt_free (dt->sub_nodes[i]); // shouldn't be any, yet - } - */ - - free (dt->sub_nodes); - dt->sub_nodes = NULL; - free (dt->children); - dt->children = NULL; - dt->child_count = 0; - - dt->header->index_length -= src - dest; - - ntfs_dt_count_alloc (dt); -#endif - //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); - //write (2, dt->data, dt->data_len); - -#if 0 - //printf ("\n"); - //printf ("index size = %d\n", dt->data_len); - //printf ("index use = %d\n", dt->header.index_length); - - off = (u8*)dt->children[0] - dt->data; - for (i = 0; i < dt->child_count; i++) { - ie = dt->children[i]; - - printf ("%2d %4d ", i, off); - off += ie->length; - - if (ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", ie->length); - break; - } - - ntfs_name_print (ie->key.file_name.file_name, - ie->key.file_name.file_name_length); - printf (" (%d)\n", ie->length); - } -#endif - - return 0; -} - -/** - * ntfs_dt_del_child - */ -static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) -{ - struct ntfs_dt *del; - INDEX_ENTRY *ie; - ntfs_inode *inode = NULL; - ntfs_attr *attr = NULL; - ntfs_attr_search_ctx *ctx = NULL; - int index_num = 0; - int res = 1; - ATTR_RECORD *arec; - FILE_NAME_ATTR *file; - MFT_REF mft_num; - - del = ntfs_dt_find2 (dt, uname, len, &index_num); - if (!del) { - printf ("can't find item to delete\n"); - goto close; - } - - if ((index_num < 0) || (index_num >= del->child_count)) { - printf ("error in dt_find\n"); - goto close; - } - - if (del->header->flags & INDEX_NODE) { - printf ("can only delete leaf nodes\n"); - goto close; - } - - ie = del->children[index_num]; - if (ie->key.file_name.file_attributes & FILE_ATTR_DIRECTORY) { - printf ("can't delete directories\n"); - goto close; - } - - if (ie->key.file_name.file_attributes & FILE_ATTR_SYSTEM) { - printf ("can't delete system files\n"); - goto close; - } - - inode = ntfs_inode_open (dt->dir->vol, MREF (ie->indexed_file)); - if (!inode) { - printf ("can't open inode\n"); - goto close; - } - - attr = ntfs_attr_open (inode, AT_ATTRIBUTE_LIST, NULL, 0); - if (attr) { - printf ("can't delete files with an attribute list\n"); - goto close; - } - - attr = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); - if (attr) { - printf ("can't delete directories\n"); - goto close; - } - - arec = find_first_attribute (AT_DATA, inode->mrec); - if (arec->non_resident) { - printf ("can't delete non-resident files\n"); - goto close; - } - - ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); - if (!ctx) { - printf ("can't create a search context\n"); - goto close; - } - - arec = find_attribute (AT_FILE_NAME, ctx); - if (find_attribute (AT_FILE_NAME, ctx)) { - printf ("file has more than one name\n"); - goto close; - } - - file = (FILE_NAME_ATTR*) ((u8*) arec + arec->value_offset); - mft_num = MREF (file->parent_directory); - - ntfs_inode_close (inode); - - inode = ntfs_inode_open (dt->dir->vol, mft_num); - if (!inode) { - printf ("can't open parent directory\n"); - goto close; - } - - attr = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); - if (!attr) { - printf ("parent doesn't have 0xA0\n"); - goto close; - } - - printf ("deleting file\n"); - //ntfs_dt_print (del->dir->index_num, 0); - res = ntfs_dt_remove (del, index_num); -close: - ntfs_attr_put_search_ctx (ctx); - ntfs_attr_close (attr); - ntfs_inode_close (inode); - return res; -} - - /** * ntfs_dir_alloc */ @@ -1075,44 +859,6 @@ close: return result; } - -/** - * ntfsrm2 - */ -static int ntfsrm2 (ntfs_volume *vol, char *name) -{ - struct ntfs_dir *dir = NULL; - struct ntfs_dir *finddir = NULL; - MFT_REF mft_num; - ntfschar *uname = NULL; - int len; - - dir = ntfs_dir_alloc (vol, FILE_root); - if (!dir) - return 1; - - //mft_num = ntfs_dir_find (dir, name); - //printf ("%s = %lld\n", name, mft_num); - - mft_num = utils_pathname_to_mftref (vol, dir, name, &finddir); - //printf ("mft_num = %lld\n", mft_num); - //ntfs_print_dir (finddir); - - if (rindex (name, PATH_SEP)) - name = rindex (name, PATH_SEP) + 1; - - len = ntfs_mbstoucs (name, &uname, 0); - if (len < 0) - return 1; - - ntfs_dt_del_child (finddir->index, uname, len); - - ntfs_dir_free (dir); - free (uname); - return 0; -} - -#if 0 /** * utils_mftrec_mark_free */ @@ -1154,81 +900,280 @@ static int utils_mftrec_mark_free (ntfs_volume *vol, MFT_REF mref) } /** - * ntfsrm - Delete a file from an NTFS volume + * utils_mftrec_mark_free2 */ -static int ntfsrm (ntfs_volume *vol, ntfs_inode *inode, struct options *opts2) +static int utils_mftrec_mark_free2 (ntfs_inode *inode) { - char buffer[128]; - ntfs_inode *parent; - int links = 0; - ntfs_attr_search_ctx *ctx; - ATTR_RECORD *rec; - FILE_NAME_ATTR *name; - char *namestr = NULL; - u64 parent_mref = 0; - //struct ntfs_dt *dt; + if (!inode) + return -1; - if (!vol || !inode || !opts2) - return 1; - if (!inode->mrec) - return 1; - - utils_inode_get_name (inode, buffer, sizeof (buffer)); - printf ("deleting %s\n", buffer); - printf ("\n"); - - parent = NULL; - - links = inode->mrec->link_count; - printf ("file has %d hard links\n", links); - - ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); - if (!ctx) - return 1; - - printf ("file inum = %lld\n", inode->mft_no); - - while ((rec = find_attribute (AT_FILE_NAME, ctx))) { - name = (FILE_NAME_ATTR*) ((u8*)rec + rec->value_offset); - - ntfs_ucstombs (name->file_name, name->file_name_length, &namestr, 0); - printf ("$FILE_NAME: %s\n", namestr); - if (parent_mref == 0) { - parent_mref = name->parent_directory; - printf ("parent = %lld\n", MREF (parent_mref)); - } - - free (namestr); - namestr = NULL; - } - printf ("\n"); - - if (parent_mref == 0) - return 1; - - parent = ntfs_inode_open (vol, parent_mref); - if (!parent) - return 1; - - //dt = ntfs_dt_init (parent); - //ntfs_dt_free (dt); - - // check mft and mft's bitmap agree that record is in use - - // local pointers to - // mft record - // mft bitmap - // volume bitmap - - // pointer to - // index root - // index alloc - - ntfs_inode_close (parent); + inode->mrec->flags &= ~MFT_RECORD_IN_USE; return 0; } +/** + * ntfs_dt_remove + */ +static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) +{ + INDEX_ENTRY *ie = NULL; + int i; + u8 *dest; + u8 *src; + u8 *end; + int off; + int len; + + if (!dt) + return 1; + if ((index_num < 0) || (index_num >= dt->child_count)) + return 1; + + //printf ("removing entry %d of %d\n", index_num, dt->child_count); + //printf ("index size = %d\n", dt->data_len); + //printf ("index use = %d\n", dt->header.index_length); + + //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); + //write (2, dt->data, dt->data_len); + + off = (u8*)dt->children[0] - dt->data; + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + //printf ("%2d %4d ", i, off); + off += ie->length; + + if (ie->flags & INDEX_ENTRY_END) { + //printf ("END (%d)\n", ie->length); + break; + } + + //ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); + //printf (" (%d)\n", ie->length); + } + //printf ("total = %d\n", off); + + ie = dt->children[index_num]; + dest = (u8*)ie; + + src = dest + ie->length; + + ie = dt->children[dt->child_count-1]; + end = (u8*)ie + ie->length; + + len = end - src; + + //printf ("move %d bytes\n", len); + //printf ("%d, %d, %d\n", dest - dt->data, src - dt->data, len); + memmove (dest, src, len); + + //printf ("clear %d bytes\n", dt->data_len - (dest - dt->data) - len); + //printf ("%d, %d, %d\n", dest - dt->data + len, 0, dt->data_len - (dest - dt->data) - len); + + //ntfs_dt_print (dt->dir->index, 0); +#if 1 + memset (dest + len, 0, dt->data_len - (dest - dt->data) - len); + + for (i = 0; i < dt->child_count; i++) { + if (dt->sub_nodes[i]) { + printf ("this shouldn't happen %p\n", dt->sub_nodes[i]); + ntfs_dt_free (dt->sub_nodes[i]); // shouldn't be any, yet + } + } + + free (dt->sub_nodes); + dt->sub_nodes = NULL; + free (dt->children); + dt->children = NULL; + dt->child_count = 0; + + dt->header->index_length -= src - dest; + + ntfs_dt_count_alloc (dt); #endif + //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); + //write (2, dt->data, dt->data_len); + +#if 0 + //printf ("\n"); + //printf ("index size = %d\n", dt->data_len); + //printf ("index use = %d\n", dt->header.index_length); + + off = (u8*)dt->children[0] - dt->data; + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + printf ("%2d %4d ", i, off); + off += ie->length; + + if (ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", ie->length); + break; + } + + ntfs_name_print (ie->key.file_name.file_name, + ie->key.file_name.file_name_length); + printf (" (%d)\n", ie->length); + } +#endif + + return 0; +} + +/** + * ntfs_dt_del_child + */ +static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) +{ + struct ntfs_dt *del; + INDEX_ENTRY *ie; + ntfs_inode *inode = NULL; + ntfs_attr *attr = NULL; + ntfs_attr_search_ctx *ctx = NULL; + int index_num = 0; + int res = 1; + ATTR_RECORD *arec; + FILE_NAME_ATTR *file; + MFT_REF mft_num; + + del = ntfs_dt_find2 (dt, uname, len, &index_num); + if (!del) { + printf ("can't find item to delete\n"); + goto close; + } + + if ((index_num < 0) || (index_num >= del->child_count)) { + printf ("error in dt_find\n"); + goto close; + } + + if (del->header->flags & INDEX_NODE) { + printf ("can only delete leaf nodes\n"); + goto close; + } + + if (!del->parent) { + printf ("has 0xA0, but isn't in use\n"); + goto close; + } + + ie = del->children[index_num]; + if (ie->key.file_name.file_attributes & FILE_ATTR_DIRECTORY) { + printf ("can't delete directories\n"); + goto close; + } + + if (ie->key.file_name.file_attributes & FILE_ATTR_SYSTEM) { + printf ("can't delete system files\n"); + goto close; + } + + inode = ntfs_inode_open (dt->dir->vol, MREF (ie->indexed_file)); + if (!inode) { + printf ("can't open inode\n"); + goto close; + } + + attr = ntfs_attr_open (inode, AT_ATTRIBUTE_LIST, NULL, 0); + if (attr) { + printf ("can't delete files with an attribute list\n"); + goto close; + } + + attr = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); + if (attr) { + printf ("can't delete directories\n"); + goto close; + } + + arec = find_first_attribute (AT_DATA, inode->mrec); + if (arec->non_resident) { + printf ("can't delete non-resident files\n"); + goto close; + } + + ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); + if (!ctx) { + printf ("can't create a search context\n"); + goto close; + } + + arec = find_attribute (AT_FILE_NAME, ctx); + if (find_attribute (AT_FILE_NAME, ctx)) { + printf ("file has more than one name\n"); + goto close; + } + + file = (FILE_NAME_ATTR*) ((u8*) arec + arec->value_offset); + mft_num = MREF (file->parent_directory); + + ntfs_inode_close (inode); + + inode = ntfs_inode_open (dt->dir->vol, mft_num); + if (!inode) { + printf ("can't open parent directory\n"); + goto close; + } + + attr = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); + if (!attr) { + printf ("parent doesn't have 0xA0\n"); + goto close; + } + + printf ("deleting file\n"); + //ntfs_dt_print (del->dir->index_num, 0); + res = ntfs_dt_remove (del, index_num); + + res = utils_mftrec_mark_free (dt->dir->vol, dt->dir->mft_num); + //printf ("mft free = %d\n", res); + + res = utils_mftrec_mark_free2 (dt->dir->inode); + +close: + ntfs_attr_put_search_ctx (ctx); + ntfs_attr_close (attr); + ntfs_inode_close (inode); + return res; +} + + +/** + * ntfsrm + */ +static int ntfsrm (ntfs_volume *vol, char *name) +{ + struct ntfs_dir *dir = NULL; + struct ntfs_dir *finddir = NULL; + MFT_REF mft_num; + ntfschar *uname = NULL; + int len; + + dir = ntfs_dir_alloc (vol, FILE_root); + if (!dir) + return 1; + + //mft_num = ntfs_dir_find (dir, name); + //printf ("%s = %lld\n", name, mft_num); + + mft_num = utils_pathname_to_mftref (vol, dir, name, &finddir); + //printf ("mft_num = %lld\n", mft_num); + //ntfs_print_dir (finddir); + + if (rindex (name, PATH_SEP)) + name = rindex (name, PATH_SEP) + 1; + + len = ntfs_mbstoucs (name, &uname, 0); + if (len < 0) + return 1; + + ntfs_dt_del_child (finddir->index, uname, len); + + ntfs_dir_free (dir); + free (uname); + return 0; +} + /** * main - Begin here * @@ -1272,8 +1217,7 @@ int main (int argc, char *argv[]) goto done; } - //result = ntfsrm (vol, inode, &opts); - result = ntfsrm2 (vol, opts.file); + result = ntfsrm (vol, opts.file); /* if (result) printf ("failed\n"); From 2d238ffee3717c49bb150a94c128b2f0994a1463 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 31 May 2004 13:11:55 +0000 Subject: [PATCH 1469/2994] another case to ignore, remove unused code, mark mft rec as unused BKrev: 40bb2f1biprXLRnVGV-ZyYaBwBoubg From 1782b0a8cbdf1d47f95a791756e8934bdebaadea Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 31 May 2004 19:17:15 +0000 Subject: [PATCH 1470/2994] refuse any resident attributes, commit changes to mft record, mft bitmap and index record. Delete works! (Logical change 1.405) --- ntfsprogs/ntfsrm.c | 102 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 78 insertions(+), 24 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index c1909a67..917699ce 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -471,7 +471,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par dt->data_len = parent->data_len; //printf ("parent size = %d\n", dt->data_len); dt->data = malloc (dt->data_len); - //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 2, 2048, dt->data)); + //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data)); ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data); //utils_dump_mem (dt->data, 0, dt->data_len, 1); //printf ("\n"); @@ -874,8 +874,10 @@ static int utils_mftrec_mark_free (ntfs_volume *vol, MFT_REF mref) return -1; } + mref = MREF (mref); + //printf ("mref = %lld\n", mref); /* Does mref lie in the section of $Bitmap we already have cached? */ - if (((s64)MREF(mref) < bmpmref) || ((s64)MREF(mref) >= (bmpmref + + if (((s64)mref < bmpmref) || ((s64)mref >= (bmpmref + (sizeof (buffer) << 3)))) { Dprintf ("Bit lies outside cache.\n"); @@ -896,18 +898,60 @@ static int utils_mftrec_mark_free (ntfs_volume *vol, MFT_REF mref) Dprintf ("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", mref, bmpmref, byte, bit, buffer[byte] & bit); + if ((buffer[byte] & bit) == 0) { + Eprintf ("MFT record isn't in use (1).\n"); + return -1; + } + + //utils_dump_mem (buffer, byte, 1, 0); + buffer[byte] &= ~bit; + //utils_dump_mem (buffer, byte, 1, 0); + + if (ntfs_attr_pwrite (vol->mftbmp_na, (bmpmref>>3), sizeof (buffer), buffer) < 0) { + Eprintf ("Couldn't write $MFT/$BITMAP: %s\n", strerror (errno)); + return -1; + } + return (buffer[byte] & bit); } /** * utils_mftrec_mark_free2 */ -static int utils_mftrec_mark_free2 (ntfs_inode *inode) +static int utils_mftrec_mark_free2 (ntfs_volume *vol, MFT_REF mref) { - if (!inode) + u8 buffer[1024]; + s64 pos; + s64 count; + u32 blk; + s64 res; + MFT_RECORD *rec; + + if (!vol) return -1; - inode->mrec->flags &= ~MFT_RECORD_IN_USE; + pos = MREF (mref) << vol->mft_record_size_bits; + count = 1; + blk = vol->mft_record_size; + + res = ntfs_attr_mst_pread (vol->mft_na, pos, count, blk, buffer); + printf ("res = %lld\n", res); + + rec = (MFT_RECORD*) buffer; + + if ((rec->flags & MFT_RECORD_IN_USE) == 0) { + Eprintf ("MFT record isn't in use (2).\n"); + return -1; + } + + rec->flags &= ~MFT_RECORD_IN_USE; + + //printf ("\n"); + //utils_dump_mem (buffer, 0, 1024, 1); + + res = ntfs_attr_mst_pwrite (vol->mft_na, pos, count, blk, buffer); + printf ("res = %lld\n", res); + return 0; } @@ -923,6 +967,7 @@ static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) u8 *end; int off; int len; + s64 res; if (!dt) return 1; @@ -987,7 +1032,9 @@ static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) dt->children = NULL; dt->child_count = 0; + //printf ("before = %d\n", dt->header->index_length + 24); dt->header->index_length -= src - dest; + //printf ("after = %d\n", dt->header->index_length + 24); ntfs_dt_count_alloc (dt); #endif @@ -1016,6 +1063,9 @@ static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) printf (" (%d)\n", ie->length); } #endif + //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); + res = ntfs_attr_mst_pwrite (dt->dir->ialloc, dt->vcn*512, 1, dt->data_len, dt->data); + printf ("res = %lld\n", res); return 0; } @@ -1032,9 +1082,10 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) ntfs_attr_search_ctx *ctx = NULL; int index_num = 0; int res = 1; - ATTR_RECORD *arec; + ATTR_RECORD *arec = NULL; + MFT_REF mft_num = -1; FILE_NAME_ATTR *file; - MFT_REF mft_num; + int filenames = 0; del = ntfs_dt_find2 (dt, uname, len, &index_num); if (!del) { @@ -1086,27 +1137,30 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) goto close; } - arec = find_first_attribute (AT_DATA, inode->mrec); - if (arec->non_resident) { - printf ("can't delete non-resident files\n"); - goto close; - } - ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); if (!ctx) { printf ("can't create a search context\n"); goto close; } - arec = find_attribute (AT_FILE_NAME, ctx); - if (find_attribute (AT_FILE_NAME, ctx)) { + while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { + arec = ctx->attr; + if (arec->non_resident) { + printf ("can't delete non-resident files\n"); + goto close; + } + if (arec->type == AT_FILE_NAME) { + filenames++; + file = (FILE_NAME_ATTR*) ((u8*) arec + arec->value_offset); + mft_num = MREF (file->parent_directory); + } + } + + if (filenames != 1) { printf ("file has more than one name\n"); goto close; } - file = (FILE_NAME_ATTR*) ((u8*) arec + arec->value_offset); - mft_num = MREF (file->parent_directory); - ntfs_inode_close (inode); inode = ntfs_inode_open (dt->dir->vol, mft_num); @@ -1121,14 +1175,14 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) goto close; } - printf ("deleting file\n"); + //printf ("deleting file\n"); //ntfs_dt_print (del->dir->index_num, 0); + +#if 1 + res = utils_mftrec_mark_free (dt->dir->vol, del->children[index_num]->indexed_file); + res = utils_mftrec_mark_free2 (dt->dir->vol, del->children[index_num]->indexed_file); res = ntfs_dt_remove (del, index_num); - - res = utils_mftrec_mark_free (dt->dir->vol, dt->dir->mft_num); - //printf ("mft free = %d\n", res); - - res = utils_mftrec_mark_free2 (dt->dir->inode); +#endif close: ntfs_attr_put_search_ctx (ctx); From b5a43f6b8dc499b33aaa22682c8ce20495ffb888 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 31 May 2004 19:17:15 +0000 Subject: [PATCH 1471/2994] refuse any resident attributes, commit changes to mft record, mft bitmap and index record. Delete works! BKrev: 40bb84bb49uQyn1I7d9DqWzHx94KeA From 90548737d552a777fe4c00725e7012a2a661198f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 1 Jun 2004 16:29:45 +0000 Subject: [PATCH 1472/2994] Update a forgotten comment in mkntfs.c. BKrev: 40bcaef9VMTdNc4Zq4fZSlilTrFmOw From b2ce5e087c176fdb3c8321b9c2ab767dc852374d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 1 Jun 2004 16:29:45 +0000 Subject: [PATCH 1473/2994] Update a forgotten comment. (Logical change 1.406) --- ntfsprogs/mkntfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 97284d17..05f545db 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3427,8 +3427,7 @@ static void mkntfs_create_root_structures(void) opts.part_start_sect); /* * If there are problems go back to bs->unused[0-3] and set them. See - * ../include/layout.h for details. Other fields to also consider - * setting are: bs->bpb.sectors_per_track and .heads. + * ../include/layout.h for details. */ bs->number_of_sectors = scpu_to_le64(opts.nr_sectors); bs->mft_lcn = scpu_to_le64(opts.mft_lcn); From a892a133eeeb553736d97c9fc663f1d38e2e028b Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 1 Jun 2004 20:07:35 +0000 Subject: [PATCH 1474/2994] remove my email address (Logical change 1.407) --- ntfsprogs/ntfscat.8.in | 4 +--- ntfsprogs/ntfscluster.8.in | 4 +--- ntfsprogs/ntfsundelete.8.in | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in index 84cac67a..5227beb5 100644 --- a/ntfsprogs/ntfscat.8.in +++ b/ntfsprogs/ntfscat.8.in @@ -88,9 +88,7 @@ If you find any bugs, please send an email to .hy .SH AUTHOR .B ntfscat -was written by Richard Russon (FlatCap) -.br -If you find this tool useful, make FlatCap happy and send him an email. +was written by Richard Russon (FlatCap) .SH AVAILABILITY .B ntfscat is part of the ntfsprogs package and is available from diff --git a/ntfsprogs/ntfscluster.8.in b/ntfsprogs/ntfscluster.8.in index 0fb979c5..e9bac1bb 100644 --- a/ntfsprogs/ntfscluster.8.in +++ b/ntfsprogs/ntfscluster.8.in @@ -128,9 +128,7 @@ bugs. If you find one, please send an email to .hy .SH AUTHOR .B ntfscluster -was written by Richard Russon (FlatCap) -.br -If you find this tool useful, make FlatCap happy and send him an email. +was written by Richard Russon (FlatCap) .SH AVAILABILITY .B ntfscluster is part of the ntfsprogs package and is available from diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index 7ae20992..839d979f 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -341,9 +341,7 @@ If you find one, please send an email to .hy .SH AUTHOR .B ntfsundelete -was written by Richard Russon (FlatCap) -.br -If you find this tool useful, make FlatCap happy and send him an email. +was written by Richard Russon (FlatCap) .SH AVAILABILITY .B ntfsundelete is part of the ntfsprogs package and is available from From 1f5cbb78fdd5f0315c6a963296b995318dc1a425 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 1 Jun 2004 20:07:35 +0000 Subject: [PATCH 1475/2994] remove my email address BKrev: 40bce207cdxiYtpmjIz1VO-ZFv2s4A From 24ac35406253715a5524d5a96cfdf96d8d01f67c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 1 Jun 2004 20:20:24 +0000 Subject: [PATCH 1476/2994] Added Holger for modifications to undelete (Logical change 1.408) --- CREDITS | 1 + ChangeLog | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CREDITS b/CREDITS index ac45f301..77876026 100644 --- a/CREDITS +++ b/CREDITS @@ -22,6 +22,7 @@ Jan Kratochvil Lode Leroy David MartĂ­nez Moreno Leonard NorrgĂĄrd +Holger Ohmacht Yuri Per Richard Russon Szakacsits Szabolcs diff --git a/ChangeLog b/ChangeLog index 70aa86d4..d97efea8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,8 +18,9 @@ xx/xx/2004 - 1.9.3-WIP endian, 64-bit machine will just disappear as we will emulate the calls even though they exist with a different name (bswap16(), etc instead of bswap_16(), etc). (Anton) + - Undelete: add ability to recover ranges of inodes. (Holger Ohmacht) -11/05/2004 - 1.9.2 - Decomrpession bug fixes, ntfsinfo enhancements, updates. +11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch config.h.in sledge hammers. (Anton) - Fix the incorrect ntfsclone usage example in the man page. (Szaka) @@ -28,7 +29,7 @@ xx/xx/2004 - 1.9.3-WIP always available. (Yuval) - Add conditional include of sys/param.h in endians.h which provides endianness support on Cygwin. (Yuval) - - ntfsclone --metadata also saves at least the first 8 KiB of the + - ntfsclone --metadata also saves at least the first 8 KiB of the $LogFile. (Szaka) - Fix incorrect getopt_long() usage: converted argv[optind-1] to optarg so utilities won't do bogus and unexpected things. (Szaka) @@ -100,8 +101,8 @@ xx/xx/2004 - 1.9.3-WIP inserted in @ctx->al_entry (see descritpion for ntfs_attr_lookup() in attrib.c for details). - Check the mount state of the output device in ntfsclone. - - Correct a too strong sanity check in ntfsclone that prevented - cloning from larger device to a smaller one but the NTFS image + - Correct a too strong sanity check in ntfsclone that prevented + cloning from larger device to a smaller one but the NTFS image could have fit fully. - Added a few (hopefully) better explanatory messages to ntfsresize. - Add new API device.[hc]::ntfs_device_heads_get() and make mkntfs use From 6995b610d3fb0be590bff28d7737a4704a1576b3 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 1 Jun 2004 20:20:24 +0000 Subject: [PATCH 1477/2994] Allow undelete to recover a set / range of inodes (Logical change 1.408) --- ntfsprogs/ntfsundelete.8.in | 18 ++-- ntfsprogs/ntfsundelete.c | 168 ++++++++++++++++++++++++++++++++---- 2 files changed, 165 insertions(+), 21 deletions(-) diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index 839d979f..b35c2e40 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -264,12 +264,14 @@ option. Only match files that have been altered since this time. The time must be given as number using a suffix of d, w, m, y for days, weeks, months or years ago. .TP -.BI "\-u " num +.BI "\-u " nums .br .ns .TP -.BI "\-\-undelete " num -Recover the file with this inode number. This option can be combined with +.BI "\-\-undelete " nums +Recover the files with these inode numbers. You can specify more than +one inode by separating with "," or a range of inodes by using +"-". This option can be combined with .BR \-\-output , .BR \-\-destination , and @@ -321,6 +323,12 @@ Look for deleted files altered in the last two days .B ntfsundelete /dev/hda1 \-t 2d .sp .RE +Undelete inodes 2, 5 and 100 to 131 of device /dev/sda1 +.RS +.sp +.B ntfsundelete /dev/sda1 -u 2,5,100-131 +.sp +.RE Undelete inode number 3689, call the file 'work.doc' and put it in the user's home directory. .RS @@ -339,9 +347,9 @@ If you find one, please send an email to .nh .hy -.SH AUTHOR +.SH AUTHORS .B ntfsundelete -was written by Richard Russon (FlatCap) +was written by Richard Russon (FlatCap) and Holger Ohmacht. .SH AVAILABILITY .B ntfsundelete is part of the ntfsprogs package and is available from diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 8976e64c..b91e70d3 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -1,7 +1,8 @@ /** * ntfsundelete - Part of the Linux-NTFS project. * - * Copyright (c) 2002-2003 Richard Russon + * Copyright (c) 2002-2004 Richard Russon + * Copyright (c) 2004 Holger Ohmacht * * This utility will recover deleted files from an NTFS volume. * @@ -55,16 +56,136 @@ static const char *EXEC_NAME = "ntfsundelete"; static const char *MFTFILE = "mft"; static const char *UNNAMED = ""; -static char *NONE = ""; -static char *UNKNOWN = "unknown"; +static const char *NONE = ""; +static const char *UNKNOWN = "unknown"; static struct options opts; +typedef struct +{ + u32 begin; + u32 end; +} range; + +static range *ranges; +static long nr_entries; + GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) #define _(S) gettext(S) +/** + * parse_inode_arg - parses the inode expression + * + * Parses the optarg after parameter -u for valid ranges + * + * Return: Number of correct inode specifications or -1 for error + */ +static int parse_inode_arg (void) +{ + int p; + u32 imax; + u32 range_begin; + u32 range_end; + u32 range_temp; + u32 inode; + char *opt_arg_ptr; + char *opt_arg_temp; + char *opt_arg_end1; + char *opt_arg_end2; + + /* init variables */ + p = strlen (optarg); + imax = p; + opt_arg_ptr = optarg; + opt_arg_end1 = optarg; + opt_arg_end2 = &(optarg[p]); + nr_entries = 0; + + /* alloc mem for range table */ + ranges = (range *) malloc ((p + 1) * sizeof (range)); + if (ranges == NULL) + { + printf ("ERROR: Couldn't alloc mem for parsing inodes!\n"); + return (-1); + } + + /* loop */ + while ((opt_arg_end1 != opt_arg_end2) && (p > 0)) + { + inode = strtoul (opt_arg_ptr, &opt_arg_end1, 0); + p--; + + /* invalid char at begin */ + if ((opt_arg_ptr == opt_arg_end1) || (opt_arg_ptr == opt_arg_end2)) + { + printf ("ERROR: Invalid Number: %s\n", opt_arg_ptr); + return (-1); + } + + /* RANGE - Check for range */ + if (opt_arg_end1[0] == '-') + { + /* get range end */ + opt_arg_temp = opt_arg_end1; + opt_arg_end1 = & (opt_arg_temp[1]); + if (opt_arg_temp >= opt_arg_end2) + { + printf ("ERROR: Missing range end!\n"); + return (-1); + } + range_begin = inode; + + /* get count */ + range_end = strtoul (opt_arg_end1, &opt_arg_temp, 0); + if (opt_arg_temp == opt_arg_end1) + { + printf ("ERROR: Invalid Number: %s\n", opt_arg_temp); + return (-1); + } + + /* check for correct values */ + if (range_begin > range_end) + { + range_temp = range_end; + range_end = range_begin; + range_begin = range_temp; + } + + /* put into struct */ + ranges[nr_entries].begin = range_begin; + ranges[nr_entries].end = range_end; + nr_entries++; + + /* Last check */ + opt_arg_ptr = & (opt_arg_temp[1]); + if (opt_arg_ptr >= opt_arg_end2) + break; + } else if (opt_arg_end1[0] == ',') { + /* SINGLE VALUE, BUT CONTINUING */ + /* put inode into range list */ + ranges[nr_entries].begin = inode; + ranges[nr_entries].end = inode; + nr_entries++; + + /* Next inode */ + opt_arg_ptr = & (opt_arg_end1[1]); + if (opt_arg_ptr >= opt_arg_end2) + { + printf ("ERROR: Missing new value at end of input!\n"); + return (-1); + } + continue; + } else { /* SINGLE VALUE, END */ + ranges[nr_entries].begin = inode; + ranges[nr_entries].end = inode; + nr_entries++; + } + } + return (nr_entries); +} + /** * version - Print version information about the program * @@ -98,7 +219,7 @@ static void usage (void) " -S range --size range Match files of this size\n" " -t since --time since Last referenced since this time\n" "\n" - " -u num --undelete num Undelete inode\n" + " -u nums --undelete nums Undelete inodes\n" " -o file --output file Save with this filename\n" " -d dir --destination dir Destination directory\n" " -b num --byte num Fill missing parts with this byte\n" @@ -398,10 +519,13 @@ static int parse_options (int argc, char *argv[]) } break; case 'u': - if (opts.mode == MODE_NONE) { + if (opts.mode == MODE_NONE) + { end = NULL; opts.mode = MODE_UNDELETE; - opts.uinode = strtol (optarg, &end, 0); + /* parse inodes */ + if (parse_inode_arg() == -1) + err++; if (end && *end) err++; } else { @@ -894,7 +1018,7 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) clusters_free++; } } - + if ((clusters_inuse + clusters_free) == 0) { Eprintf ("Unexpected error whilst calculating percentage for inode %lld\n", file->inode); continue; @@ -928,7 +1052,7 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) static void dump_record (struct ufile *file) { char buffer[20]; - char *name; + const char *name; struct list_head *item; int i; @@ -1040,7 +1164,7 @@ static void list_record (struct ufile *file) { char buffer[20]; struct list_head *item; - char *name = NULL; + const char *name = NULL; long long size = 0; int percent = 0; @@ -1179,7 +1303,7 @@ static unsigned int write_data (int fd, const char *buffer, * * Return: n Length of the allocated name */ -static int create_pathname (const char *dir, const char *name, +static int create_pathname (const char *dir, const char *name, const char *stream, char *buffer, int bufsize) { if (!name) @@ -1672,6 +1796,8 @@ int main (int argc, char *argv[]) { ntfs_volume *vol; int result = 1; + int i; + u32 inode; if (!parse_options (argc, argv)) goto free; @@ -1689,17 +1815,27 @@ int main (int argc, char *argv[]) Vprintf ("Failed to scan device '%s'.\n", opts.device); break; case MODE_UNDELETE: - result = !undelete_file (vol, opts.uinode); - if (result) - Vprintf ("Failed to undelete inode %d.\n", opts.uinode); + if (nr_entries == 0) + { + printf ("ERROR: No inode(s) specified!\n"); + break; + } + + for (i = 0; i < nr_entries; i++) + { + for (inode = ranges[i].begin; inode <= ranges[i].end; inode ++) + { + result = !undelete_file (vol, inode); + if (result) + Vprintf ("ERROR: Failed to undelete inode %d\n!", inode); + } + } break; case MODE_COPY: result = !copy_mft (vol, opts.mft_begin, opts.mft_end); if (result) Vprintf ("Failed to read MFT blocks %lld-%lld.\n", - (long long)opts.mft_begin, - (long long)min(vol->nr_mft_records, - opts.mft_end)); + opts.mft_begin, min(vol->nr_mft_records, opts.mft_end)); break; default: ; /* Cannot happen */ From 05e1a11b9db9b9d3f4a677ff8ec6e00afeb6b982 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 1 Jun 2004 20:20:24 +0000 Subject: [PATCH 1478/2994] Holger Ohmacht: Allow undelete to recover a set / range of inodes. BKrev: 40bce5089J-tTCmZv2oFAsemX2ACCQ From 23586780a09684d61d235b4c0a05429c0f357e50 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 1 Jun 2004 20:21:57 +0000 Subject: [PATCH 1479/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/06/01 19:31:51+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/06/01 00:44:06+01:00 flatcap.org!ntfs start working on non-resident files BKrev: 40bce565GnWbDXC8l2vrmZzjnb0fbA From d840a80df9cc0bca28ac30d4ca18411b687fa276 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 1 Jun 2004 20:21:57 +0000 Subject: [PATCH 1480/2994] start working on non-resident files (Logical change 1.409) --- ntfsprogs/ntfsrm.c | 97 +++++++++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 26 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 917699ce..38fe7c73 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -955,6 +955,38 @@ static int utils_mftrec_mark_free2 (ntfs_volume *vol, MFT_REF mref) return 0; } +/** + * utils_free_non_residents + */ +static int utils_free_non_residents (ntfs_inode *inode) +{ + ntfs_attr_search_ctx *ctx; + ntfs_attr *na; + ATTR_RECORD *arec; + + if (!inode) + return -1; + + ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); + if (!ctx) { + printf ("can't create a search context\n"); + return -1; + } + + while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { + arec = ctx->attr; + if (arec->non_resident) { + na = ntfs_attr_open (inode, arec->type, NULL, 0); + if (na) { + printf ("truncate = %d\n", ntfs_attr_truncate (na, 0)); + } + } + } + + ntfs_attr_put_search_ctx (ctx); + return 0; +} + /** * ntfs_dt_remove */ @@ -1077,7 +1109,8 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) { struct ntfs_dt *del; INDEX_ENTRY *ie; - ntfs_inode *inode = NULL; + ntfs_inode *ichild = NULL; + ntfs_inode *iparent = NULL; ntfs_attr *attr = NULL; ntfs_attr_search_ctx *ctx = NULL; int index_num = 0; @@ -1119,25 +1152,13 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) goto close; } - inode = ntfs_inode_open (dt->dir->vol, MREF (ie->indexed_file)); - if (!inode) { + ichild = ntfs_inode_open (dt->dir->vol, MREF (ie->indexed_file)); + if (!ichild) { printf ("can't open inode\n"); goto close; } - attr = ntfs_attr_open (inode, AT_ATTRIBUTE_LIST, NULL, 0); - if (attr) { - printf ("can't delete files with an attribute list\n"); - goto close; - } - - attr = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); - if (attr) { - printf ("can't delete directories\n"); - goto close; - } - - ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); + ctx = ntfs_attr_get_search_ctx (NULL, ichild->mrec); if (!ctx) { printf ("can't create a search context\n"); goto close; @@ -1146,7 +1167,29 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { arec = ctx->attr; if (arec->non_resident) { + ntfs_attr *a; printf ("can't delete non-resident files\n"); + a = ntfs_attr_open (ichild, arec->type, NULL, 0); + if (a) { + runlist_element *rl; + LCN size; + LCN count; + ntfs_attr_map_whole_runlist (a); + rl = a->rl; + size = a->allocated_size >> ichild->vol->cluster_size_bits; + for (count = 0; count < size; count += rl->length, rl++) { + printf ("rl(%llu,%llu,%lld)\n", rl->vcn, rl->lcn, rl->length); + } + ntfs_attr_close (a); + } + //goto close; + } + if (arec->type == AT_ATTRIBUTE_LIST) { + printf ("can't delete files with an attribute list\n"); + goto close; + } + if (arec->type == AT_INDEX_ROOT) { + printf ("can't delete directories\n"); goto close; } if (arec->type == AT_FILE_NAME) { @@ -1161,33 +1204,35 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) goto close; } - ntfs_inode_close (inode); - - inode = ntfs_inode_open (dt->dir->vol, mft_num); - if (!inode) { + iparent = ntfs_inode_open (dt->dir->vol, mft_num); + if (!iparent) { printf ("can't open parent directory\n"); goto close; } - attr = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); + attr = ntfs_attr_open (iparent, AT_INDEX_ALLOCATION, I30, 4); if (!attr) { printf ("parent doesn't have 0xA0\n"); goto close; } - //printf ("deleting file\n"); + printf ("deleting file\n"); //ntfs_dt_print (del->dir->index_num, 0); -#if 1 + if (0) { + res = utils_free_non_residents (ichild); res = utils_mftrec_mark_free (dt->dir->vol, del->children[index_num]->indexed_file); - res = utils_mftrec_mark_free2 (dt->dir->vol, del->children[index_num]->indexed_file); res = ntfs_dt_remove (del, index_num); -#endif + // chkdsk will recover up to this point + res = utils_mftrec_mark_free2 (dt->dir->vol, del->children[index_num]->indexed_file); + } close: ntfs_attr_put_search_ctx (ctx); ntfs_attr_close (attr); - ntfs_inode_close (inode); + ntfs_inode_close (iparent); + ntfs_inode_close (ichild); + return res; } From f550ce88fe624ca534d4c908affc61ec03ed98ed Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 2 Jun 2004 22:07:18 +0000 Subject: [PATCH 1481/2994] delete non-resident files too (Logical change 1.410) --- ntfsprogs/ntfsrm.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 38fe7c73..62e536cf 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -32,6 +32,7 @@ #include "ntfsrm.h" #include "debug.h" #include "dir.h" +#include "lcnalloc.h" static const char *EXEC_NAME = "ntfsrm"; static struct options opts; @@ -978,7 +979,18 @@ static int utils_free_non_residents (ntfs_inode *inode) if (arec->non_resident) { na = ntfs_attr_open (inode, arec->type, NULL, 0); if (na) { - printf ("truncate = %d\n", ntfs_attr_truncate (na, 0)); + runlist_element *rl; + LCN size; + LCN count; + ntfs_attr_map_whole_runlist (na); + rl = na->rl; + size = na->allocated_size >> inode->vol->cluster_size_bits; + for (count = 0; count < size; count += rl->length, rl++) { + //printf ("rl(%llu,%llu,%lld)\n", rl->vcn, rl->lcn, rl->length); + //printf ("freed %d\n", ntfs_cluster_free (inode->vol, na, rl->vcn, rl->length)); + ntfs_cluster_free (inode->vol, na, rl->vcn, rl->length); + } + ntfs_attr_close (na); } } } @@ -1120,6 +1132,8 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) FILE_NAME_ATTR *file; int filenames = 0; + // compressed & encrypted files? + del = ntfs_dt_find2 (dt, uname, len, &index_num); if (!del) { printf ("can't find item to delete\n"); @@ -1166,24 +1180,12 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { arec = ctx->attr; + /* if (arec->non_resident) { - ntfs_attr *a; printf ("can't delete non-resident files\n"); - a = ntfs_attr_open (ichild, arec->type, NULL, 0); - if (a) { - runlist_element *rl; - LCN size; - LCN count; - ntfs_attr_map_whole_runlist (a); - rl = a->rl; - size = a->allocated_size >> ichild->vol->cluster_size_bits; - for (count = 0; count < size; count += rl->length, rl++) { - printf ("rl(%llu,%llu,%lld)\n", rl->vcn, rl->lcn, rl->length); - } - ntfs_attr_close (a); - } - //goto close; + goto close; } + */ if (arec->type == AT_ATTRIBUTE_LIST) { printf ("can't delete files with an attribute list\n"); goto close; @@ -1219,13 +1221,10 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) printf ("deleting file\n"); //ntfs_dt_print (del->dir->index_num, 0); - if (0) { - res = utils_free_non_residents (ichild); - res = utils_mftrec_mark_free (dt->dir->vol, del->children[index_num]->indexed_file); - res = ntfs_dt_remove (del, index_num); - // chkdsk will recover up to this point - res = utils_mftrec_mark_free2 (dt->dir->vol, del->children[index_num]->indexed_file); - } + if (1) res = utils_free_non_residents (ichild); + if (1) res = utils_mftrec_mark_free (dt->dir->vol, del->children[index_num]->indexed_file); + if (1) res = utils_mftrec_mark_free2 (dt->dir->vol, del->children[index_num]->indexed_file); + if (1) res = ntfs_dt_remove (del, index_num); close: ntfs_attr_put_search_ctx (ctx); From f6b3aff863031fe82ee6e53f9ab8c7905c38bc2c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 2 Jun 2004 22:07:18 +0000 Subject: [PATCH 1482/2994] delete non-resident files too BKrev: 40be4f96HV24jYEymG7uNisVU30GRg From b6d50b08ad75fd1cd7af059df2a8a1e66f23d3b1 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Fri, 4 Jun 2004 08:59:26 +0000 Subject: [PATCH 1483/2994] Fix message, mount -t smbfs doesn't understand 'lfs', only smbmount (Logical change 1.411) --- ntfsprogs/ntfsclone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 00516674..6bcefa51 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1012,7 +1012,7 @@ static void set_filesize(s64 filesize) if (opt.stfs.f_type == 0x517b) { Printf("SMBFS needs minimum Linux kernel " "version 2.4.25 and\n the 'lfs' option" - "\nfor mount or smbmount to have large " + "\nfor smbmount to have large " "file support.\n"); } } From 3588a1c64947c4f5750d6ca18393fc2424a7f4f6 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Fri, 4 Jun 2004 08:59:26 +0000 Subject: [PATCH 1484/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into a80-186-119-178.elisa-laajakaista.fi:/home/szaka/ntfs/bk/ntfsprogs 2004/06/04 11:55:55+03:00 elisa-laajakaista.fi!szaka ntfsclone: fix message, mount -t smbfs doesn't understand 'lfs', only smbmount BKrev: 40c039eeZDGvvf4B4StIZ4zgNNsWVg From 8c3a38b818d5290afb36ac177611ca9a112e1e6a Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 6 Jun 2004 13:51:54 +0000 Subject: [PATCH 1485/2994] split remove into remove_alloc and remove_root, added function to resize an attribute, now it can delete root entries (Logical change 1.412) --- ntfsprogs/ntfsrm.c | 301 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 265 insertions(+), 36 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 62e536cf..a0fb5e41 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -33,6 +33,7 @@ #include "debug.h" #include "dir.h" #include "lcnalloc.h" +#include "mft.h" static const char *EXEC_NAME = "ntfsrm"; static struct options opts; @@ -245,6 +246,7 @@ struct ntfs_dir { ntfs_attr *iroot; ntfs_attr *ialloc; ntfs_attr *ibmp; + int index_size; }; @@ -469,7 +471,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par //printf ("alloc i = %lld\n", dir->ialloc->initialized_size); //printf ("vcn = %lld\n", vcn); - dt->data_len = parent->data_len; + dt->data_len = dt->dir->index_size; //printf ("parent size = %d\n", dt->data_len); dt->data = malloc (dt->data_len); //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data)); @@ -509,7 +511,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par ntfs_dt_count_root (dt); dt->header = &((INDEX_ROOT*)dt->data)->index; - dt->data_len = ((INDEX_ROOT*)dt->data)->index_block_size; + //dt->data_len = ((INDEX_ROOT*)dt->data)->index_block_size; //printf ("IBS = %d\n", ((INDEX_ROOT*)dt->data)->index_block_size); #if 0 @@ -692,6 +694,11 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) return NULL; } + dir->inode = inode; + dir->iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); + dir->ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); + dir->ibmp = ntfs_attr_open (inode, AT_BITMAP, I30, 4); + dir->vol = vol; dir->parent = NULL; dir->name = NULL; @@ -702,10 +709,10 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) dir->mft_num = mft_num; dir->bitmap = NULL; - dir->inode = inode; - dir->iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); - dir->ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); - dir->ibmp = ntfs_attr_open (inode, AT_BITMAP, I30, 4); + if (dir->ialloc) + dir->index_size = dir->ialloc->allocated_size; + else + dir->index_size = 0; if (!dir->iroot) { free (dir); @@ -826,7 +833,7 @@ static MFT_REF utils_pathname_to_mftref (ntfs_volume *vol, struct ntfs_dir *pare q++; } - //printf ("looking for %s\n", p); + //printf ("looking for %s in %p\n", p, parent); mft_num = ntfs_dir_find (parent, p); if (mft_num == (u64)-1) { Eprintf ("Couldn't find name '%s' in pathname '%s'.\n", p, pathname); @@ -922,24 +929,17 @@ static int utils_mftrec_mark_free (ntfs_volume *vol, MFT_REF mref) static int utils_mftrec_mark_free2 (ntfs_volume *vol, MFT_REF mref) { u8 buffer[1024]; - s64 pos; - s64 count; - u32 blk; s64 res; MFT_RECORD *rec; if (!vol) return -1; - pos = MREF (mref) << vol->mft_record_size_bits; - count = 1; - blk = vol->mft_record_size; - - res = ntfs_attr_mst_pread (vol->mft_na, pos, count, blk, buffer); - printf ("res = %lld\n", res); - rec = (MFT_RECORD*) buffer; + res = ntfs_mft_record_read (vol, mref, rec); + printf ("res = %lld\n", res); + if ((rec->flags & MFT_RECORD_IN_USE) == 0) { Eprintf ("MFT record isn't in use (2).\n"); return -1; @@ -950,7 +950,7 @@ static int utils_mftrec_mark_free2 (ntfs_volume *vol, MFT_REF mref) //printf ("\n"); //utils_dump_mem (buffer, 0, 1024, 1); - res = ntfs_attr_mst_pwrite (vol->mft_na, pos, count, blk, buffer); + res = ntfs_mft_record_write (vol, mref, rec); printf ("res = %lld\n", res); return 0; @@ -999,10 +999,108 @@ static int utils_free_non_residents (ntfs_inode *inode) return 0; } + /** - * ntfs_dt_remove + * ntfs_mft_resize_resident */ -static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) +static int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len, u8 *data, int data_len) +{ + int mft_size; + int mft_usage; + int mft_free; + int attr_orig; + int attr_new; + u8 *src; + u8 *dst; + u8 *end; + int len; + ntfs_attr_search_ctx *ctx = NULL; + ATTR_RECORD *arec = NULL; + MFT_RECORD *mrec = NULL; + int res = -1; + + if ((!inode) || (!inode->mrec)) + return -1; + if ((!data) || (data_len < 0)) + return -1; + + mrec = inode->mrec; + + mft_size = mrec->bytes_allocated; + mft_usage = mrec->bytes_in_use; + mft_free = mft_size - mft_usage; + + //printf ("mft_size = %d\n", mft_size); + //printf ("mft_usage = %d\n", mft_usage); + //printf ("mft_free = %d\n", mft_free); + //printf ("\n"); + + ctx = ntfs_attr_get_search_ctx (NULL, mrec); + if (!ctx) + goto done; + + if (ntfs_attr_lookup(type, name, name_len, CASE_SENSITIVE, 0, NULL, 0, ctx) != 0) + goto done; + + arec = ctx->attr; + + if (arec->non_resident) { + printf ("attributes isn't resident\n"); + goto done; + } + + attr_orig = arec->value_length; + attr_new = data_len; + + //printf ("attr orig = %d\n", attr_orig); + //printf ("attr new = %d\n", attr_new); + //printf ("\n"); + + if (attr_new == attr_orig) { + printf ("nothing to do\n"); + res = 0; + goto done; + } + + if ((attr_new - attr_orig + mft_usage) > mft_size) { + printf ("attribute won't fit into mft record\n"); + goto done; + } + + //printf ("new free space = %d\n", mft_size - (attr_new - attr_orig + mft_usage)); + + src = (u8*)arec + arec->length; + dst = src + (attr_new - attr_orig); + end = (u8*)mrec + mft_usage; + len = end - src; + + //printf ("src = %d\n", src - (u8*)mrec); + //printf ("dst = %d\n", dst - (u8*)mrec); + //printf ("end = %d\n", end - (u8*)mrec); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + memcpy ((u8*)arec + arec->value_offset, data, data_len); + + mrec->bytes_in_use += (attr_new - attr_orig); + arec->length += (attr_new - attr_orig); + arec->value_length += (attr_new - attr_orig); + + memset ((u8*)mrec + mrec->bytes_in_use, 'R', mft_size - mrec->bytes_in_use); + + mft_usage += (attr_new - attr_orig); + //utils_dump_mem ((u8*) mrec, 0, mft_size, 1); + res = 0; +done: + ntfs_attr_put_search_ctx (ctx); + return res; +} + + +/** + * ntfs_dt_remove_alloc + */ +static int ntfs_dt_remove_alloc (struct ntfs_dt *dt, int index_num) { INDEX_ENTRY *ie = NULL; int i; @@ -1013,14 +1111,9 @@ static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) int len; s64 res; - if (!dt) - return 1; - if ((index_num < 0) || (index_num >= dt->child_count)) - return 1; - - //printf ("removing entry %d of %d\n", index_num, dt->child_count); + //printf ("removing entry %d of %d\n", index_num+1, dt->child_count); //printf ("index size = %d\n", dt->data_len); - //printf ("index use = %d\n", dt->header.index_length); + //printf ("index use = %d\n", dt->header->index_length); //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); //write (2, dt->data, dt->data_len); @@ -1114,6 +1207,145 @@ static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) return 0; } +/** + * ntfs_dt_remove_root + */ +static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) +{ + INDEX_ENTRY *ie = NULL; + INDEX_ROOT *ir = NULL; + int i; + u8 *dest; + u8 *src; + u8 *end; + int off; + int len; + s64 res; + + //printf ("removing entry %d of %d\n", index_num+1, dt->child_count); + //printf ("index size = %d\n", dt->data_len); + //printf ("index use = %d\n", dt->header->index_length); + + //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); + //write (2, dt->data, dt->data_len); + + off = (u8*)dt->children[0] - dt->data; + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + //printf ("%2d %4d ", i+1, off); + off += ie->length; + + if (ie->flags & INDEX_ENTRY_END) { + //printf ("END (%d)\n", ie->length); + break; + } + + //ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); + //printf (" (%d)\n", ie->length); + } + //printf ("total = %d\n", off); + + ie = dt->children[index_num]; + dest = (u8*)ie; + + src = dest + ie->length; + + ie = dt->children[dt->child_count-1]; + end = (u8*)ie + ie->length; + + len = end - src; + + //printf ("move %d bytes\n", len); + //printf ("%d, %d, %d\n", dest - dt->data, src - dt->data, len); + memmove (dest, src, len); + + dt->data_len -= (src - dt->data - sizeof (INDEX_ROOT)); + dt->child_count--; + + ir = (INDEX_ROOT*) dt->data; + ir->index.index_length = dt->data_len - 16; + ir->index.allocated_size = dt->data_len - 16; + + ntfs_mft_resize_resident (dt->dir->inode, AT_INDEX_ROOT, I30, 4, dt->data, dt->data_len); + dt->data = realloc (dt->data, dt->data_len); + + //printf ("ih->index_length = %d\n", ir->index.index_length); + //printf ("ih->allocated_size = %d\n", ir->index.allocated_size); + //printf ("dt->data_len = %d\n", dt->data_len); + + //utils_dump_mem (dt->data, 0, dt->data_len, 1); + //ntfs_dt_print (dt->dir->index, 0); +#if 1 + for (i = 0; i < dt->child_count; i++) { + if (dt->sub_nodes[i]) { + printf ("this shouldn't happen %p\n", dt->sub_nodes[i]); + ntfs_dt_free (dt->sub_nodes[i]); // shouldn't be any, yet + } + } + + free (dt->sub_nodes); + dt->sub_nodes = NULL; + free (dt->children); + dt->children = NULL; + dt->child_count = 0; + + //printf ("before = %d\n", dt->header->index_length + 24); + dt->header->index_length -= src - dest; + //printf ("after = %d\n", dt->header->index_length + 24); + + ntfs_dt_count_root (dt); +#endif + //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); + //write (2, dt->data, dt->data_len); + +#if 0 + //printf ("\n"); + //printf ("index size = %d\n", dt->data_len); + //printf ("index use = %d\n", dt->header.index_length); + + off = (u8*)dt->children[0] - dt->data; + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + printf ("%2d %4d ", i, off); + off += ie->length; + + if (ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", ie->length); + break; + } + + ntfs_name_print (ie->key.file_name.file_name, + ie->key.file_name.file_name_length); + printf (" (%d)\n", ie->length); + } +#endif + //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); + + res = ntfs_mft_record_write (dt->dir->inode->vol, dt->dir->inode->mft_no, dt->dir->inode->mrec); + printf ("res = %lld\n", res); + + return 0; +} + +/** + * ntfs_dt_remove + */ +static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) +{ + if (!dt) + return 1; + if ((index_num < 0) || (index_num >= dt->child_count)) + return 1; + + if (dt->parent) + return ntfs_dt_remove_alloc (dt, index_num); + else + return ntfs_dt_remove_root (dt, index_num); +} + + /** * ntfs_dt_del_child */ @@ -1150,10 +1382,12 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) goto close; } + /* if (!del->parent) { printf ("has 0xA0, but isn't in use\n"); goto close; } + */ ie = del->children[index_num]; if (ie->key.file_name.file_attributes & FILE_ATTR_DIRECTORY) { @@ -1180,12 +1414,6 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { arec = ctx->attr; - /* - if (arec->non_resident) { - printf ("can't delete non-resident files\n"); - goto close; - } - */ if (arec->type == AT_ATTRIBUTE_LIST) { printf ("can't delete files with an attribute list\n"); goto close; @@ -1212,13 +1440,15 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) goto close; } + /* attr = ntfs_attr_open (iparent, AT_INDEX_ALLOCATION, I30, 4); if (!attr) { printf ("parent doesn't have 0xA0\n"); goto close; } + */ - printf ("deleting file\n"); + //printf ("deleting file\n"); //ntfs_dt_print (del->dir->index_num, 0); if (1) res = utils_free_non_residents (ichild); @@ -1235,7 +1465,6 @@ close: return res; } - /** * ntfsrm */ @@ -1256,7 +1485,7 @@ static int ntfsrm (ntfs_volume *vol, char *name) mft_num = utils_pathname_to_mftref (vol, dir, name, &finddir); //printf ("mft_num = %lld\n", mft_num); - //ntfs_print_dir (finddir); + //ntfs_dir_print (finddir, 0); if (rindex (name, PATH_SEP)) name = rindex (name, PATH_SEP) + 1; From 309c26e588adbaccead83b22c689cd60d92cea8a Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 6 Jun 2004 13:51:54 +0000 Subject: [PATCH 1486/2994] split remove into remove_alloc and remove_root, added function to resize an attribute, now it can delete root entries BKrev: 40c3217aQYwMqLcZyWaqyXCccKtGQw From 1649de2d467ab7948c49b36a1a544ad52017ae2d Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 6 Jun 2004 14:17:26 +0000 Subject: [PATCH 1487/2994] Change mode to -rw-rw-r-- (Logical change 1.413) --- ntfsprogs/cluster.h | 39 +++++++++++++++++++++++++++++++++++++++ ntfsprogs/ntfsrm.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/ntfsprogs/cluster.h b/ntfsprogs/cluster.h index e69de29b..f3fdebe7 100644 --- a/ntfsprogs/cluster.h +++ b/ntfsprogs/cluster.h @@ -0,0 +1,39 @@ +/* + * cluster - Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Richard Russon + * + * This function will locate the owner of any given sector or cluster range. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _CLUSTER_H_ +#define _CLUSTER_H_ + +#include "types.h" +#include "volume.h" + +typedef struct { + int x; +} ntfs_cluster; + +typedef int (cluster_cb) (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void *data); + +int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void *data); + +#endif /* _CLUSTER_H_ */ + diff --git a/ntfsprogs/ntfsrm.h b/ntfsprogs/ntfsrm.h index e69de29b..b8d25b96 100644 --- a/ntfsprogs/ntfsrm.h +++ b/ntfsprogs/ntfsrm.h @@ -0,0 +1,43 @@ +/* + * ntfsrm - Part of the Linux-NTFS project. + * + * Copyright (c) 2004 Richard Russon + * + * This utility will delete files from an NTFS volume. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFSRM_H_ +#define _NTFSRM_H_ + +#include "types.h" +#include "layout.h" + +struct options { + char *device; /* Device/File to work with */ + char *file; /* File to delete */ + int force; /* Override common sense */ + int interactive; /* Ask before deleting files */ + int recursive; /* Delete files in subdirectories */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int noaction; /* Do not write to disk */ + int nodirty; /* Do not mark volume dirty */ +}; + +#endif /* _NTFSRM_H_ */ + From 698d98ed16f9c5d47e8154d9c4c96b82781cc350 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 6 Jun 2004 14:17:26 +0000 Subject: [PATCH 1488/2994] minor tidy BKrev: 40c32776a6FfvfqJXLcKsiefXRXuhw From 8ebc4d57e777fa23e022f8b7a1f8a89e7ccf6fd4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 8 Jun 2004 15:55:55 +0000 Subject: [PATCH 1489/2994] Indentation fixes to ntfsinfo. (Yuval) BKrev: 40c5e18bQCP6G7--UdSQaatl4mUt4Q From 99f61bb374c402e7664bc7e8d716c7388ec66ad0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 8 Jun 2004 15:55:55 +0000 Subject: [PATCH 1490/2994] Indentation fixes. (Logical change 1.414) --- ntfsprogs/ntfsinfo.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index e36c3d0f..ead54e82 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -886,7 +886,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) (unsigned int)le32_to_cpu(index_root->index.allocated_size)); printf("\tUsed Size:\t\t %u\n", (unsigned int)le32_to_cpu(index_root->index.index_length)); - printf("\tFlags:\t\t\t %u\n",index_root->index.flags); + printf("\tFlags:\t\t\t 0x%x\n",index_root->index.flags); /* printf("\tIndex Entries Following\t %u\n", ???? );*/ } @@ -1010,16 +1010,16 @@ static void ntfs_dump_inode_general_info(ntfs_inode *inode) printf("Dumping Inode #%llu\n",(long long)inode->mft_no); - printf("Update Sequence Array Count:\t%hu\n", + printf("Update Sequence Array Count:\t %hu\n", le16_to_cpu(inode->mrec->usa_count)); - printf("$LogFile seqNum for this Inode:\t0x%llx\n", + printf("$LogFile seqNum for this Inode:\t 0x%llx\n", (signed long long int)sle64_to_cpu(inode->mrec->lsn)); - printf("Number of times reused:\t\t%hu\n", + printf("Number of times reused:\t\t %hu\n", (short unsigned int)le16_to_cpu(inode->mrec->sequence_number)); - printf("Number of hard links:\t\t%hu\n", + printf("Number of hard links:\t\t %hu\n", le16_to_cpu(inode->mrec->link_count)); - printf("MFT record Flags:\t\t"); + printf("MFT record Flags:\t\t "); /* we would like to convert MFT_RECORD_IN_USE -> DELETED and we do that by xoring */ inode_flags = inode_flags ^ MFT_RECORD_IN_USE; @@ -1041,16 +1041,16 @@ static void ntfs_dump_inode_general_info(ntfs_inode *inode) } printf("\n"); - printf("Size - Used:\t\t\t%u bytes\n", + printf("Size - Used:\t\t\t %u bytes\n", (unsigned int)le32_to_cpu(inode->mrec->bytes_in_use)); - printf("Size - Allocated:\t\t%u bytes\n", + printf("Size - Allocated:\t\t %u bytes\n", (unsigned int)le32_to_cpu(inode->mrec->bytes_allocated)); if (inode->mrec->base_mft_record) { - printf("base MFT record:\t\t%llu\n", + printf("base MFT record:\t\t %llu\n", MREF_LE(inode->mrec->base_mft_record)); } - printf("Next Attribute Instance Num\t%hu\n", + printf("Next Attribute Instance Num\t %hu\n", le16_to_cpu(inode->mrec->next_attr_instance)); } From 137edfd5c195431ba5218772d1a33dd11b9d00e4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 8 Jun 2004 15:57:09 +0000 Subject: [PATCH 1491/2994] Dump unknown attributes in ntfsinfo. (Yuval) BKrev: 40c5e1d5trTFOKfbko-MOA-ThT9EFg From 0e46071eb064d5801f88486a12602d3ad4b7a29a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 8 Jun 2004 15:57:09 +0000 Subject: [PATCH 1492/2994] Dump unknown attributes. (Logical change 1.415) --- ntfsprogs/ntfsinfo.c | 103 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index ead54e82..9f2638d3 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -999,9 +999,110 @@ static void ntfs_dump_attr_logged_utility_stream(ATTR_RECORD *attr) printf("\tTODO\n"); } +static void ntfs_hex_dump(void *buf,unsigned int length) +{ + unsigned int i=0; + while (i126)) { + c = '.'; + } + printf("%c",c); + } + + /* end line */ + printf("\n"); + i=j; + } +} + static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) { - printf("TODO: ntfs_dump_unknown_attr\n"); + printf("Dumping unknown attribute type 0x%X.\n" + "--Please report this to linux-ntfs-dev@lists.sourceforge.net--\n", + (unsigned int)le32_to_cpu(attr->type)); + + printf("\tResident size:\t\t %u\n",(unsigned int)le32_to_cpu(attr->length)); + + printf("\tIs resident? \t\t "); + if (attr->non_resident) { + printf("No\n"); + } else { + printf("Yes\n"); + } + + /* Dump attribute name */ + if (attr->name_length) { + char *attr_name = NULL; + attr_name = ntfs_attr_get_name(attr); + + if (attr_name) { + printf("\tAttribute name: \t '%s'\n",attr_name); + free(attr_name); + } else { + /* an error occured, errno holds the reason - notify the user */ + fprintf(stderr, "ntfsinfo error: could not parse attribute name: %s\n", + strerror(errno)); + } + } else { + printf("\tAttribute name: \t unnamed\n"); + } + + /* we could parse the flags */ + /* however, it does not make sense with a new attribute type */ + printf("\tFlags:\t\t\t 0x%x\n",attr->flags); + + /* fork by residence */ + printf("\tIs resident?\t\t "); + if (attr->non_resident) { + printf("No\n"); + printf("\tAllocated data size:\t %llu\n", + (unsigned long long)le64_to_cpu(attr->allocated_size)); + printf("\tUsed data size:\t %llu\n", + (unsigned long long)le64_to_cpu(attr->data_size)); + printf("\tInitialized data size:\t %llu\n", + (unsigned long long)le64_to_cpu(attr->initialized_size)); + + /* if the attribute resident part is large enough, it may contain + the compressed size */ + if ((le32_to_cpu(attr->length)>=72) && + ((attr->name_offset==0) || (le16_to_cpu(attr->name_offset)>=72))) { + printf("\tCompressed size:\t %llu\n", + (unsigned long long)le64_to_cpu(attr->compressed_size)); + } + } else { + printf("Yes\n"); + printf("\tResident payload size:\t %u\n", + (unsigned int)le32_to_cpu(attr->value_length)); + + /* residence flags are 1 byte, cast it to a longer type */ + printf("\tResidence Flags:\t 0x%hx\n", + (short unsigned int)attr->resident_flags); + + /* hex dump */ + printf("\tDumping some of the attribute data:\n"); + ntfs_hex_dump((u8*)attr + le16_to_cpu(attr->value_offset), + (le16_to_cpu(attr->value_length)>128)?128:le16_to_cpu(attr->value_length)); + } } static void ntfs_dump_inode_general_info(ntfs_inode *inode) From d7f280873fbeb4dcdd3e13be4f7924c98515c45e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 8 Jun 2004 15:58:32 +0000 Subject: [PATCH 1493/2994] Remove irrelevant whitespace from output of ntfsinfo. (Yuval) BKrev: 40c5e228HVlB1Zi1psKzTT7-uSCBYg From 2dafbdd60277b7f0411d6a678b48524100d8cf56 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 8 Jun 2004 15:58:32 +0000 Subject: [PATCH 1494/2994] Remove irrelevant whitespace from output. (Logical change 1.416) --- ntfsprogs/ntfsinfo.c | 85 ++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 9f2638d3..4d8715a0 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -273,7 +273,7 @@ static int parse_options (int argc, char *argv[]) * Example of usage: * char *time_str = ntfsinfo_time_to_str( * sle64_to_cpu(standard_attr->creation_time)); - * printf("\tFile Creation Time: \t %s", time_str); + * printf("\tFile Creation Time:\t %s", time_str); */ static char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) { @@ -409,27 +409,27 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) char *ntfs_time_str = NULL; ntfs_time_str = ntfsinfo_time_to_str(standard_attr->creation_time); - printf("\tFile Creation Time: \t %s",ntfs_time_str); + printf("\tFile Creation Time:\t %s",ntfs_time_str); ntfs_time_str = ntfsinfo_time_to_str( standard_attr->last_data_change_time); - printf("\tFile Altered Time: \t %s",ntfs_time_str); + printf("\tFile Altered Time:\t %s",ntfs_time_str); ntfs_time_str = ntfsinfo_time_to_str( standard_attr->last_mft_change_time); - printf("\tMFT Changed Time: \t %s",ntfs_time_str); + printf("\tMFT Changed Time:\t %s",ntfs_time_str); ntfs_time_str = ntfsinfo_time_to_str(standard_attr->last_access_time); - printf("\tLast Accessed Time: \t %s",ntfs_time_str); + printf("\tLast Accessed Time:\t %s",ntfs_time_str); } /* TODO: file_attributes - Flags describing the file. */ printf("\tMax Number of Versions:\t %u \n", (unsigned int)le32_to_cpu(standard_attr->maximum_versions)); - printf("\tVersion Number: \t %u \n", + printf("\tVersion Number:\t\t %u \n", (unsigned int)le32_to_cpu(standard_attr->version_number)); - printf("\tClass ID: \t\t %u \n", + printf("\tClass ID:\t\t %u \n", (unsigned int)le32_to_cpu(standard_attr->class_id)); @@ -438,9 +438,9 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) /* printf("\t$STANDARD_INFORMATION fields owner_id, security_id, quota \n" "\t & usn are missing. This volume has not been upgraded\n"); */ } else if (value_length == 72) { - printf("\tUser ID: \t\t %u \n", + printf("\tUser ID:\t\t %u \n", (unsigned int)le32_to_cpu(standard_attr->owner_id)); - printf("\tSecurity ID: \t\t %u \n", + printf("\tSecurity ID:\t\t %u \n", (unsigned int)le32_to_cpu(standard_attr->security_id)); } else { printf("\tSize of STANDARD_INFORMATION is %u. It should be " @@ -485,7 +485,7 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) file_name_attr->file_name_length,&mbs_file_name,0); if (mbs_file_name_size>0) { - printf("\tFile Name: \t\t '%s'\n", mbs_file_name); + printf("\tFile Name:\t\t '%s'\n", mbs_file_name); free(mbs_file_name); } else { /* an error occured, errno holds the reason - notify the user */ @@ -493,15 +493,15 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) strerror(errno)); } /* any way, error or not, print the length */ - printf("\tFile Name Length: \t %d\n", file_name_attr->file_name_length); + printf("\tFile Name Length:\t %d\n", file_name_attr->file_name_length); } else { - printf("\tFile Name: \t\t unnamed?!?\n"); + printf("\tFile Name:\t\t unnamed?!?\n"); } /* other basic stuff about the file */ - printf("\tAllocated File Size: \t %lld\n", + printf("\tAllocated File Size:\t %lld\n", (long long)sle64_to_cpu(file_name_attr->allocated_size)); - printf("\tReal File Size: \t %lld\n", + printf("\tReal File Size:\t\t %lld\n", (long long)sle64_to_cpu(file_name_attr->data_size)); /* time stuff stuff */ @@ -509,27 +509,26 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) char *ntfs_time_str; ntfs_time_str = ntfsinfo_time_to_str(file_name_attr->creation_time); - printf("\tFile Creation Time: \t %s",ntfs_time_str); + printf("\tFile Creation Time:\t %s",ntfs_time_str); ntfs_time_str = ntfsinfo_time_to_str( file_name_attr->last_data_change_time); - printf("\tFile Altered Time: \t %s",ntfs_time_str); + printf("\tFile Altered Time:\t %s",ntfs_time_str); ntfs_time_str = ntfsinfo_time_to_str( file_name_attr->last_mft_change_time); - printf("\tMFT Changed Time: \t %s",ntfs_time_str); + printf("\tMFT Changed Time:\t %s",ntfs_time_str); ntfs_time_str = ntfsinfo_time_to_str(file_name_attr->last_access_time); - printf("\tLast Accessed Time: \t %s",ntfs_time_str); + printf("\tLast Accessed Time:\t %s",ntfs_time_str); } } /* - * ntfs_dump_object_id + * ntfs_dump_object_id() * * dump the $OBJECT_ID attribute - not present on all systems - * */ static void ntfs_dump_attr_object_id(ATTR_RECORD *attr,ntfs_volume *vol) { @@ -709,7 +708,7 @@ static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) if (mbs_vol_name_size>0) { /* output the converted name. */ - printf("\tVolume Name: \t\t '%s'\n",mbs_vol_name); + printf("\tVolume Name:\t\t '%s'\n",mbs_vol_name); free(mbs_vol_name); } else { /* an error occured, errno holds the reason - notify the user */ @@ -717,7 +716,7 @@ static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) strerror(errno)); } } else { - printf("\tVolume Name: \t\t unnamed\n"); + printf("\tVolume Name:\t\t unnamed\n"); } } @@ -737,9 +736,9 @@ static void ntfs_dump_attr_volume_information(ATTR_RECORD *attr) printf("Dumping attribute $VOLUME_INFORMATION (0x70)\n"); - printf("\tVolume Version: \t %d.%d\n", vol_information->major_ver, + printf("\tVolume Version:\t %d.%d\n", vol_information->major_ver, vol_information->minor_ver); - printf("\tFlags: \t\t\t "); + printf("\tFlags:\t\t\t "); if (vol_information->flags & VOLUME_IS_DIRTY) printf("DIRTY "); if (vol_information->flags & VOLUME_RESIZE_LOG_FILE) @@ -779,7 +778,7 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr) stream_name = ntfs_attr_get_name(attr); if (stream_name) { - printf("\tStream name: \t\t '%s'\n",stream_name); + printf("\tStream name:\t\t '%s'\n",stream_name); free(stream_name); } else { /* an error occured, errno holds the reason - notify the user */ @@ -787,7 +786,7 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr) strerror(errno)); } } else { - printf("\tStream name: \t\t unnamed\n"); + printf("\tStream name:\t\t unnamed\n"); } /* length @@ -801,22 +800,22 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr) VCN highest_vcn; Highest valid vcn of this extent of u16 mapping_pairs_offset; Byte offset from the ... */ printf("\tIs resident? \t\t No\n"); - printf("\tData size: \t\t %llu\n", + printf("\tData size:\t\t %llu\n", (long long)le64_to_cpu(attr->data_size)); - printf("\tAllocated size: \t %llu\n", + printf("\tAllocated size:\t\t %llu\n", (long long)le64_to_cpu(attr->allocated_size)); - printf("\tInitialized size: \t %llu\n", + printf("\tInitialized size:\t %llu\n", (long long)le64_to_cpu(attr->initialized_size)); if (attr->compression_unit) { - printf("\tCompression unit: \t %u\n",attr->compression_unit); - printf("\tCompressed size: \t %llu\n", + printf("\tCompression unit:\t %u\n",attr->compression_unit); + printf("\tCompressed size:\t %llu\n", (long long)le64_to_cpu(attr->compressed_size)); } else { printf("\tNot Compressed\n"); } } else { printf("\tIs resident? \t\t Yes\n"); - printf("\tData size: \t\t %u\n", + printf("\tData size:\t\t %u\n", (unsigned int)le32_to_cpu(attr->value_length)); /* u16 value_offset; Byte offset of the attribute RESIDENT_ATTR_FLAGS resident_flags; */ @@ -842,7 +841,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) index_name = ntfs_attr_get_name(attr); if (index_name) { - printf("\tIndex name: \t\t '%s'\n",index_name); + printf("\tIndex name:\t\t '%s'\n",index_name); free(index_name); } else { /* an error occured, errno holds the reason - notify the user */ @@ -850,11 +849,11 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) strerror(errno)); } } else { - printf("\tIndex name: \t\t unnamed\n"); + printf("\tIndex name:\t\t unnamed\n"); } /* attr_type dumping */ - printf("\tIndexed Attr Type: \t "); + printf("\tIndexed Attr Type:\t "); if (index_root->type) { if (index_root->type & (0xFFFF - AT_FILE_NAME)) { /* wierd, this should be illgeal */ @@ -870,7 +869,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) } /* collation rule dumping */ - printf("\tCollation Rule: \t %u\n", + printf("\tCollation Rule:\t\t %u\n", (unsigned int)le32_to_cpu(index_root->collation_rule)); /* COLLATION_BINARY, COLLATION_FILE_NAME, COLLATION_UNICODE_STRING, COLLATION_NTOFS_ULONG, COLLATION_NTOFS_SID, @@ -905,7 +904,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr) index_name = ntfs_attr_get_name(attr); if (index_name) { - printf("\tIndex name: \t\t '%s'\n",index_name); + printf("\tIndex name:\t\t '%s'\n",index_name); free(index_name); } else { /* an error occured, errno holds the reason - notify the user */ @@ -913,7 +912,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr) strerror(errno)); } } else { - printf("\tIndex name: \t\t unnamed\n"); + printf("\tIndex name:\t\t unnamed\n"); } } @@ -932,7 +931,7 @@ static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) bitmap_name = ntfs_attr_get_name(attr); if (bitmap_name) { - printf("\tBitmap name: \t\t '%s'\n",bitmap_name); + printf("\tBitmap name:\t\t '%s'\n",bitmap_name); free(bitmap_name); } else { /* an error occured, errno holds the reason - notify the user */ @@ -940,7 +939,7 @@ static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) strerror(errno)); } } else { - printf("\tBitmap name: \t\t unnamed\n"); + printf("\tBitmap name:\t\t unnamed\n"); } } @@ -1056,7 +1055,7 @@ static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) attr_name = ntfs_attr_get_name(attr); if (attr_name) { - printf("\tAttribute name: \t '%s'\n",attr_name); + printf("\tAttribute name:\t '%s'\n",attr_name); free(attr_name); } else { /* an error occured, errno holds the reason - notify the user */ @@ -1064,7 +1063,7 @@ static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) strerror(errno)); } } else { - printf("\tAttribute name: \t unnamed\n"); + printf("\tAttribute name:\t unnamed\n"); } /* we could parse the flags */ @@ -1274,7 +1273,7 @@ int main(int argc, char **argv) if (opts.filename) { inode = utils_pathname_to_inode (vol, NULL, opts.filename); } else { - inode = ntfs_inode_open(vol, MK_LE_MREF(opts.inode, 0)); + inode = ntfs_inode_open(vol, MK_LE_MREF(opts.inode, 0)); } /* dump the inode information */ From 2f2a306dec937bae1301beaa84ea7a19193cf6b9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 8 Jun 2004 16:17:51 +0000 Subject: [PATCH 1495/2994] global miscellaneous cleanup to ntfsinfo. (Yuval, some fixes from Anton) BKrev: 40c5e6af5cN5vKogU8PtIGDM6EJQLw From 53b60abae5757d189d268769018992c585baf1e2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 8 Jun 2004 16:17:51 +0000 Subject: [PATCH 1496/2994] global miscellaneous cleanup. (Logical change 1.417) --- ntfsprogs/ntfsinfo.c | 128 +++++++++++++++++++++++++++++++------------ 1 file changed, 92 insertions(+), 36 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 4d8715a0..2c77c3a6 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -29,7 +29,6 @@ * - Dump ACLs when security_id exists (NTFS 3+ only). * - Clean ups. * - Internationalization. - * - The AT_ATTRIBUTE_LIST issue. * - Add more Indexed Attr Types. * - Make formatting look more like www.flatcap.org/ntfs/info * @@ -37,13 +36,11 @@ * way to output some of these attributes. * * Still need to do: - * $SECURITY_DESCRIPTOR * $REPARSE_POINT/$SYMBOLIC_LINK * $EA_INFORMATION * $EA * $PROPERTY_SET * $LOGGED_UTILITY_STREAM - * ntfs_dump_attr_unknown() */ #include "config.h" @@ -455,10 +452,38 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) */ static void ntfs_dump_attr_list(ATTR_RECORD *attr) { - /* As far as I know, ntfs_attr_lookup transparantly iterate - through AT_ATTRIBUTE_LIST, so we shouldn't get to this */ - /* FIXME: inode 9: $Secure does that, I'll have to check. */ - printf("AT_ATTRIBUTE_LIST type was returned.\n"); + printf("Dumping attribute AT_ATTRIBUTE_LIST (0x20)\n"); + + /* Dump list's name */ + if (attr->name_length) { + char *stream_name = NULL; + + stream_name = ntfs_attr_get_name(attr); + if (stream_name) { + printf("\tList name:\t\t '%s'\n",stream_name); + free(stream_name); + } else { + /* an error occured, errno holds the reason - notify the user */ + fprintf(stderr, "ntfsinfo error: could not parse stream name: %s\n", + strerror(errno)); + } + } else { + printf("\tList name:\t\t unnamed\n"); + } + + /* Dump list's size */ + if (attr->non_resident) { + printf("\tAllocated size:\t\t %llu\n", + (unsigned long long)le64_to_cpu(attr->allocated_size)); + printf("\tUsed size:\t\t %llu\n", + (unsigned long long)le64_to_cpu(attr->data_size)); + } else { + /* print only the payload's size */ + /* - "bytes" is mentioned here to avoid confusion with bits + this is not required (almost) anywhere else */ + printf("\tList's size:\t\t %u bytes\n", + (unsigned int)le32_to_cpu(attr->value_length)); + } } /** @@ -581,6 +606,11 @@ static void ntfs_dump_attr_object_id(ATTR_RECORD *attr,ntfs_volume *vol) vol->major_ver); } +/* + * ntfs_dump_acl() + * + * given an acl, print it in a beautiful & lovley way. + */ static void ntfs_dump_acl(const char *prefix,ACL *acl) { unsigned int i; @@ -645,8 +675,9 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr) printf("Dumping attribute $SECURITY_DESCRIPTOR (0x50)\n"); printf("\tRevision:\t\t %u\n",sec_desc_attr->revision); + + /* TODO: parse the flags */ printf("\tFlags:\t\t\t 0x%0x\n",sec_desc_attr->control); -/* todo: stringify flags */ sid = ntfs_sid_to_mbs((SID *)((char *)sec_desc_attr + sec_desc_attr->owner), NULL, 0); @@ -789,10 +820,8 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr) printf("\tStream name:\t\t unnamed\n"); } -/* length - u16 name_offset; - ATTR_FLAGS flags; - u16 instance; */ + /* TODO: parse the flags */ + printf("\tFlags:\t\t\t 0x%04hx\n",le16_to_cpu(attr->flags)); /* fork by residence */ if (attr->non_resident) { @@ -817,8 +846,9 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr) printf("\tIs resident? \t\t Yes\n"); printf("\tData size:\t\t %u\n", (unsigned int)le32_to_cpu(attr->value_length)); -/* u16 value_offset; Byte offset of the attribute - RESIDENT_ATTR_FLAGS resident_flags; */ + + /* TODO: parse the flags */ + printf("\tResidence Flags:\t 0x%02hhx\n", attr->resident_flags); } } @@ -829,6 +859,7 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr) */ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) { + unsigned int type; INDEX_ROOT *index_root = NULL; index_root = (INDEX_ROOT*)((u8*)attr + le16_to_cpu(attr->value_offset)); @@ -854,12 +885,13 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) /* attr_type dumping */ printf("\tIndexed Attr Type:\t "); - if (index_root->type) { - if (index_root->type & (0xFFFF - AT_FILE_NAME)) { + type = le32_to_cpu(index_root->type); + if (type) { + if (index_root->type != AT_FILE_NAME) { /* wierd, this should be illgeal */ - printf("%4X\n",index_root->type); - fprintf(stderr, "ntfsinfo error: Illeal Indexed Attr Type: %4X\n", - index_root->type); + printf("0x%0X\n", type); + fprintf(stderr, "ntfsinfo error: Unknown Indexed Attr Type: 0x%0X\n", + type); } else { printf("file names\n"); } @@ -885,7 +917,9 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) (unsigned int)le32_to_cpu(index_root->index.allocated_size)); printf("\tUsed Size:\t\t %u\n", (unsigned int)le32_to_cpu(index_root->index.index_length)); - printf("\tFlags:\t\t\t 0x%x\n",index_root->index.flags); + + /* the flags are 8bit long, no need for byte-order handling */ + printf("\tFlags:\t\t\t 0x%02x\n",index_root->index.flags); /* printf("\tIndex Entries Following\t %u\n", ???? );*/ } @@ -914,6 +948,21 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr) } else { printf("\tIndex name:\t\t unnamed\n"); } + + /* dump index's size */ + if (attr->non_resident) { + /* print only the non resident part's size */ + printf("\tAllocated data size:\t %llu\n", + (unsigned long long)le64_to_cpu(attr->allocated_size)); + printf("\tUsed data size:\t\t %llu\n", + (unsigned long long)le64_to_cpu(attr->data_size)); + } else { + /* print only the payload's size */ + printf("\tValue's size:\t\t %u\n", + (unsigned int)le32_to_cpu(attr->value_length)); + } + + /* TODO: parse how many records does this B-*+/Tree contains */ } /* @@ -941,6 +990,21 @@ static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) } else { printf("\tBitmap name:\t\t unnamed\n"); } + + /* dump bitmap size */ + if (attr->non_resident) { + /* print only the non resident part's size */ + printf("\tAllocated data size:\t %llu\n", + (unsigned long long)le64_to_cpu(attr->allocated_size)); + printf("\tUsed data size:\t\t %llu\n", + (unsigned long long)le64_to_cpu(attr->data_size)); + } else { + /* print only the payload's size */ + /* - "bytes" is mentioned here to avoid confusion with bits + this is not required (almost) anywhere else */ + printf("\tBitmap's size:\t\t %u bytes\n", + (unsigned int)le32_to_cpu(attr->value_length)); + } } /* @@ -1010,12 +1074,12 @@ static void ntfs_hex_dump(void *buf,unsigned int length) /* hex content */ for (j=i;(jflags); + printf("\tFlags:\t\t\t 0x%04hx\n",le16_to_cpu(attr->flags)); /* fork by residence */ printf("\tIs resident?\t\t "); @@ -1093,9 +1157,7 @@ static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) printf("\tResident payload size:\t %u\n", (unsigned int)le32_to_cpu(attr->value_length)); - /* residence flags are 1 byte, cast it to a longer type */ - printf("\tResidence Flags:\t 0x%hx\n", - (short unsigned int)attr->resident_flags); + printf("\tResidence Flags:\t 0x%02hhx\n", attr->resident_flags); /* hex dump */ printf("\tDumping some of the attribute data:\n"); @@ -1106,7 +1168,7 @@ static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) static void ntfs_dump_inode_general_info(ntfs_inode *inode) { - u16 inode_flags = le16_to_cpu(inode->mrec->flags); + u16 inode_flags = inode->mrec->flags; printf("Dumping Inode #%llu\n",(long long)inode->mft_no); @@ -1120,21 +1182,15 @@ static void ntfs_dump_inode_general_info(ntfs_inode *inode) le16_to_cpu(inode->mrec->link_count)); printf("MFT record Flags:\t\t "); - /* we would like to convert MFT_RECORD_IN_USE -> DELETED - and we do that by xoring */ - inode_flags = inode_flags ^ MFT_RECORD_IN_USE; - if (inode_flags) { - /* MFT_RECORD_IN_USE is now backwards */ - if (MFT_RECORD_IN_USE & inode_flags) { + if (!(MFT_RECORD_IN_USE & inode_flags)) { printf("DELETED "); } if (MFT_RECORD_IS_DIRECTORY & inode_flags) { printf("DIRECTORY "); } - if (MFT_RECORD_IN_USE & !MFT_RECORD_IS_DIRECTORY & - MFT_REC_SPACE_FILLER & inode_flags) { - printf("UNKNOWN:0x%x",inode_flags); + if (~(MFT_RECORD_IN_USE | MFT_RECORD_IS_DIRECTORY) & inode_flags) { + printf("UNKNOWN:0x%04hx",inode_flags); } } else { printf("none"); From 49b10c0f61a66e802595f2987ae900be9ccaef6f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 8 Jun 2004 16:25:01 +0000 Subject: [PATCH 1497/2994] Remove compiler warnings about unused parameters by adding the __attribute__((unused)) Note: these functions are still in the todo list at the top of the file, so removing the warnings will not make it forgotten. (Logical change 1.418) --- ntfsprogs/ntfsinfo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 2c77c3a6..a05fda38 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1012,7 +1012,7 @@ static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) * * of ntfs 3.x dumps the reparse_point attribute */ -static void ntfs_dump_attr_reparse_point(ATTR_RECORD *attr) +static void ntfs_dump_attr_reparse_point(ATTR_RECORD *attr __attribute__((unused))) { printf("Dumping attribute $REPARSE_POINT/$SYMBOLIC_LINK (0xC0)\n"); printf("\tTODO\n"); @@ -1023,7 +1023,7 @@ static void ntfs_dump_attr_reparse_point(ATTR_RECORD *attr) * * dump the ea_information attribute */ -static void ntfs_dump_attr_ea_information(ATTR_RECORD *attr) +static void ntfs_dump_attr_ea_information(ATTR_RECORD *attr __attribute__((unused))) { printf("Dumping attribute $EA_INFORMATION (0xD0)\n"); printf("\tTODO\n"); @@ -1034,7 +1034,7 @@ static void ntfs_dump_attr_ea_information(ATTR_RECORD *attr) * * dump the ea attribute */ -static void ntfs_dump_attr_ea(ATTR_RECORD *attr) +static void ntfs_dump_attr_ea(ATTR_RECORD *attr __attribute__((unused))) { printf("Dumping attribute $EA (0xE0)\n"); printf("\tTODO\n"); @@ -1045,7 +1045,7 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr) * * dump the property_set attribute */ -static void ntfs_dump_attr_property_set(ATTR_RECORD *attr) +static void ntfs_dump_attr_property_set(ATTR_RECORD *attr __attribute__((unused))) { printf("Dumping attribute $PROPERTY_SET (0xF0)\n"); printf("\tTODO\n"); @@ -1056,7 +1056,7 @@ static void ntfs_dump_attr_property_set(ATTR_RECORD *attr) * * dump the property_set attribute */ -static void ntfs_dump_attr_logged_utility_stream(ATTR_RECORD *attr) +static void ntfs_dump_attr_logged_utility_stream(ATTR_RECORD *attr __attribute__((unused))) { printf("Dumping attribute $LOGGED_UTILITY_STREAM (0x100)\n"); printf("\tTODO\n"); From 3a429c0bc87daf4a218970e44fdbf613c5ac29a7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 8 Jun 2004 16:25:01 +0000 Subject: [PATCH 1498/2994] ntfsinfo patch from Yuval: Remove compiler warnings about unused parameters by adding the __attribute__((unused)) Note: these functions are still in the todo list at the top of the file, so removing the warnings will not make it forgotten. BKrev: 40c5e85dMT0bnsF_IUd35AdHDVGclg From 8ad9c17322fd84d28172e379bd3d029fe5418ad8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 8 Jun 2004 16:26:25 +0000 Subject: [PATCH 1499/2994] Update (Logical change 1.419) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index d97efea8..54d5c3e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,7 @@ xx/xx/2004 - 1.9.3-WIP calls even though they exist with a different name (bswap16(), etc instead of bswap_16(), etc). (Anton) - Undelete: add ability to recover ranges of inodes. (Holger Ohmacht) + - Lots of updates to ntfsinfo, see "bk changes". (Yuval) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From cce896589321319866eeb7a2fcc4063baac26f77 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 8 Jun 2004 16:26:25 +0000 Subject: [PATCH 1500/2994] Update changelog. BKrev: 40c5e8b1a4cXIRt_2gEVC6tyPq-U4A From 4b697efed2d979ce2ab5bf998cabc1e6621dcbf6 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 16 Jun 2004 22:16:30 +0000 Subject: [PATCH 1501/2994] Add Yura (Logical change 1.420) --- CREDITS | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS b/CREDITS index 77876026..653aeea5 100644 --- a/CREDITS +++ b/CREDITS @@ -23,6 +23,7 @@ Lode Leroy David MartĂ­nez Moreno Leonard NorrgĂĄrd Holger Ohmacht +Yura Pakhuchiy Yuri Per Richard Russon Szakacsits Szabolcs From e7ccf6839f81ba95b63fd450a06a9cd549ba96fb Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 16 Jun 2004 22:16:30 +0000 Subject: [PATCH 1502/2994] bug fix for ntfsinfo BKrev: 40d0c6beqBaSBMTZHMPS7kZRk_dU6w From b9bb3745e3832a951a36b7f36ce652e92bbd12e3 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 16 Jun 2004 22:16:30 +0000 Subject: [PATCH 1503/2994] bugfix for ntfsinfo (Logical change 1.420) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 54d5c3e6..72b89a52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ xx/xx/2004 - 1.9.3-WIP instead of bswap_16(), etc). (Anton) - Undelete: add ability to recover ranges of inodes. (Holger Ohmacht) - Lots of updates to ntfsinfo, see "bk changes". (Yuval) + - Fix crash in ntfsinfo for non-resident Security Info. (Yura) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From 2099f9392cc2b7e0892655d3c3a1081562457372 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 16 Jun 2004 22:16:30 +0000 Subject: [PATCH 1504/2994] stop info crashing when it encounters a non-resident security attribute (Logical change 1.420) --- ntfsprogs/ntfsinfo.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index a05fda38..6856ea80 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -664,16 +664,33 @@ static void ntfs_dump_acl(const char *prefix,ACL *acl) * * dump the security information about the file */ -static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr) +static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *vol) { SECURITY_DESCRIPTOR_ATTR *sec_desc_attr; char *sid; - - sec_desc_attr = (SECURITY_DESCRIPTOR_ATTR *)((u8*)attr + - le16_to_cpu(attr->value_offset)); - - printf("Dumping attribute $SECURITY_DESCRIPTOR (0x50)\n"); + printf("Dumping attribute $SECURITY_DESCRIPTOR (0x50)\n"); + + if (attr->non_resident) { + runlist *rl = ntfs_mapping_pairs_decompress(vol, attr, 0); + if (rl) { + sec_desc_attr = malloc(attr->data_size); + s64 bytes_read = ntfs_rl_pread(vol, rl, 0, + attr->data_size, sec_desc_attr); + if (bytes_read != attr->data_size) { + Eprintf("ntfsinfo error: could not read secutiry descriptor\n"); + free(sec_desc_attr); + return; + } + } else { + Eprintf("ntfsinfo error: could not decompress runlist\n"); + return; + } + } else { + sec_desc_attr = (SECURITY_DESCRIPTOR_ATTR *)((u8*)attr + + le16_to_cpu(attr->value_offset)); + } + printf("\tRevision:\t\t %u\n",sec_desc_attr->revision); /* TODO: parse the flags */ @@ -713,6 +730,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr) printf("missing\n"); } + if (attr->non_resident) free(sec_desc_attr); } /* @@ -1236,10 +1254,10 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) ntfs_dump_attr_file_name(ctx->attr); break; case AT_OBJECT_ID: - ntfs_dump_attr_object_id(ctx->attr,inode->vol); + ntfs_dump_attr_object_id(ctx->attr, inode->vol); break; case AT_SECURITY_DESCRIPTOR: - ntfs_dump_attr_security_descriptor(ctx->attr); + ntfs_dump_attr_security_descriptor(ctx->attr, inode->vol); break; case AT_VOLUME_NAME: ntfs_dump_attr_volume_name(ctx->attr); From f5d428139c7f1a36c332f9a36dc280e2accc9db6 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 16 Jun 2004 22:44:00 +0000 Subject: [PATCH 1505/2994] Merge 2004/06/07 23:00:44+01:00 flatcap.org!ntfs index alloc size 2004/06/06 21:18:20+01:00 flatcap.org!ntfs dump an index 2004/06/06 19:47:07+01:00 flatcap.org!ntfs minor fixes BKrev: 40d0cd30AobgjXrgpe9aTSV3Km_MTA From 08285f5f8298639d152bccfa5a0233e02a08c61f Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 16 Jun 2004 22:44:00 +0000 Subject: [PATCH 1506/2994] SCCS merged 2004/06/07 23:00:44+01:00 flatcap.org!ntfs add size to index alloc, change comments slightly to allow vim to fold (Logical change 1.421) --- ntfsprogs/ntfsinfo.c | 54 ++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 6856ea80..6a344d57 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -22,7 +22,8 @@ * distribution in the file COPYING); if not, write to the Free Software * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* TODO LIST: +/* + * TODO LIST: * - Better error checking. (focus on ntfs_dump_volume) * - Comment things better. * - More things at verbose mode. @@ -95,7 +96,7 @@ static void version (void) printf (" 2002-2004 Matthew J. Fanto\n"); printf (" 2002-2004 Anton Altaparmakov\n"); printf (" 2002-2003 Richard Russon\n"); - printf (" 2003 Leonard Norrgĺrd\n"); + printf (" 2003 Leonard NorrgĂĄrd\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -549,9 +550,8 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) } } - -/* - * ntfs_dump_object_id() +/** + * ntfs_dump_object_id * * dump the $OBJECT_ID attribute - not present on all systems */ @@ -606,8 +606,8 @@ static void ntfs_dump_attr_object_id(ATTR_RECORD *attr,ntfs_volume *vol) vol->major_ver); } -/* - * ntfs_dump_acl() +/** + * ntfs_dump_acl * * given an acl, print it in a beautiful & lovley way. */ @@ -659,7 +659,7 @@ static void ntfs_dump_acl(const char *prefix,ACL *acl) } } -/* +/** * ntfs_dump_security_descriptor() * * dump the security information about the file @@ -733,7 +733,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v if (attr->non_resident) free(sec_desc_attr); } -/* +/** * ntfs_dump_volume_name() * * dump the name of the volume the inode belongs to @@ -769,8 +769,7 @@ static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) } } - -/* +/** * ntfs_dump_volume_information() * * dump the information for the volume the inode belongs to @@ -812,7 +811,7 @@ static void ntfs_dump_attr_volume_information(ATTR_RECORD *attr) vol_information->flags & (0xFFFF - VOLUME_FLAGS_MASK)); } -/* +/** * ntfs_dump_data_attr() * * dump some info about the data attribute @@ -870,7 +869,7 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr) } } -/* +/** * ntfs_dump_attr_index_root() * * dump the index_root attribute @@ -941,7 +940,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) /* printf("\tIndex Entries Following\t %u\n", ???? );*/ } -/* +/** * ntfs_dump_attr_index_allocation() * * dump the index_allocation attribute @@ -983,7 +982,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr) /* TODO: parse how many records does this B-*+/Tree contains */ } -/* +/** * ntfs_dump_attr_bitmap() * * dump the bitmap attribute @@ -1025,7 +1024,7 @@ static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) } } -/* +/** * ntfs_dump_attr_reparse_point() * * of ntfs 3.x dumps the reparse_point attribute @@ -1036,7 +1035,7 @@ static void ntfs_dump_attr_reparse_point(ATTR_RECORD *attr __attribute__((unused printf("\tTODO\n"); } -/* +/** * ntfs_dump_attr_ea_information() * * dump the ea_information attribute @@ -1047,7 +1046,7 @@ static void ntfs_dump_attr_ea_information(ATTR_RECORD *attr __attribute__((unuse printf("\tTODO\n"); } -/* +/** * ntfs_dump_attr_ea() * * dump the ea attribute @@ -1058,7 +1057,7 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr __attribute__((unused))) printf("\tTODO\n"); } -/* +/** * ntfs_dump_attr_property_set() * * dump the property_set attribute @@ -1069,7 +1068,7 @@ static void ntfs_dump_attr_property_set(ATTR_RECORD *attr __attribute__((unused) printf("\tTODO\n"); } -/* +/** * ntfs_dump_attr_logged_utility_stream() * * dump the property_set attribute @@ -1184,6 +1183,9 @@ static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) } } +/** + * ntfs_dump_inode_general_info + */ static void ntfs_dump_inode_general_info(ntfs_inode *inode) { u16 inode_flags = inode->mrec->flags; @@ -1336,8 +1338,10 @@ int main(int argc, char **argv) if (!vol) return 1; - /* if opts.mft is not 0, then we will print out information about - * the volume, such as the sector size and whatnot. */ + /* + * if opts.mft is not 0, then we will print out information about + * the volume, such as the sector size and whatnot. + */ if (opts.mft) ntfs_dump_volume(vol); @@ -1358,8 +1362,10 @@ int main(int argc, char **argv) ntfs_dump_file_attributes(inode); } else { /* can't open inode */ - /* note: when the specified inode does not exist, either EIO or - * or ESPIPE is returned, we should notify better in those cases */ + /* + * note: when the specified inode does not exist, either EIO or + * or ESPIPE is returned, we should notify better in those cases + */ fprintf(stderr, "Error loading node: %s\n", strerror(errno)); } } From 53cdde3dda6c86d41087e903493236c92f3cc2bb Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 16 Jun 2004 22:44:00 +0000 Subject: [PATCH 1507/2994] dump an index 2004/06/06 19:47:06+01:00 flatcap.org!ntfs make the find's more similar. stop crash if file not found. stop reading entire index. (Logical change 1.421) --- ntfsprogs/ntfsrm.c | 160 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 139 insertions(+), 21 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index a0fb5e41..f1b0d3c8 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -578,6 +578,7 @@ static MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) * end marker yes map & recurse */ + //printf ("child_count = %d\n", dt->child_count); for (i = 0; i < dt->child_count; i++) { ie = dt->children[i]; @@ -616,7 +617,7 @@ static MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) //printf ("ENOENT\n"); } } else { - //printf ("error collating name\n"); + printf ("error collating name\n"); } break; } @@ -627,16 +628,27 @@ static MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) /** * ntfs_dt_find2 */ -static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *uname, int len, int *index_num) +static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) { struct ntfs_dt *res = NULL; INDEX_ENTRY *ie; int i; int r; - if (!dt || !uname) + if (!dt || !name) return NULL; - + + /* + * State Children Action + * ------------------------------------------- + * collates after - keep searching + * match name - return MREF + * collates before no return -1 + * collates before yes map & recurse + * end marker no return -1 + * end marker yes map & recurse + */ + //printf ("child_count = %d\n", dt->child_count); for (i = 0; i < dt->child_count; i++) { ie = dt->children[i]; @@ -644,7 +656,8 @@ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *uname, int if (ie->flags & INDEX_ENTRY_END) { r = -1; } else { - r = ntfs_names_collate (uname, len, + //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); + r = ntfs_names_collate (name, name_len, ie->key.file_name.file_name, ie->key.file_name.file_name_length, 2, IGNORE_CASE, @@ -652,19 +665,21 @@ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *uname, int dt->dir->vol->upcase_len); } + //printf ("%d, %d\n", i, r); + if (r == 1) { //printf ("keep searching\n"); continue; } else if (r == 0) { - //printf ("match\n"); res = dt; + //printf ("match %lld\n", res); if (index_num) *index_num = i; } else if (r == -1) { //printf ("recurse\n"); - res = ntfs_dt_find2 (dt->sub_nodes[i], uname, len, index_num); + res = ntfs_dt_find2 (dt->sub_nodes[i], name, name_len, index_num); } else { - //printf ("error\n"); + //printf ("error collating name\n"); } break; } @@ -680,6 +695,8 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) { struct ntfs_dir *dir = NULL; ntfs_inode *inode = NULL; + ATTR_RECORD *rec = NULL; + INDEX_ROOT *ir = NULL; if (!vol) return NULL; @@ -709,10 +726,13 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) dir->mft_num = mft_num; dir->bitmap = NULL; - if (dir->ialloc) - dir->index_size = dir->ialloc->allocated_size; - else + if (dir->ialloc) { + rec = find_first_attribute (AT_INDEX_ROOT, inode->mrec); + ir = (INDEX_ROOT*) ((u8*)rec + rec->value_offset); + dir->index_size = ir->index_block_size; + } else { dir->index_size = 0; + } if (!dir->iroot) { free (dir); @@ -1056,12 +1076,6 @@ static int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfscha //printf ("attr new = %d\n", attr_new); //printf ("\n"); - if (attr_new == attr_orig) { - printf ("nothing to do\n"); - res = 0; - goto done; - } - if ((attr_new - attr_orig + mft_usage) > mft_size) { printf ("attribute won't fit into mft record\n"); goto done; @@ -1079,14 +1093,16 @@ static int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfscha //printf ("end = %d\n", end - (u8*)mrec); //printf ("len = %d\n", len); - memmove (dst, src, len); + if (src != dst) + memmove (dst, src, len); + memcpy ((u8*)arec + arec->value_offset, data, data_len); mrec->bytes_in_use += (attr_new - attr_orig); arec->length += (attr_new - attr_orig); arec->value_length += (attr_new - attr_orig); - memset ((u8*)mrec + mrec->bytes_in_use, 'R', mft_size - mrec->bytes_in_use); + memset ((u8*)mrec + mrec->bytes_in_use, 0, mft_size - mrec->bytes_in_use); mft_usage += (attr_new - attr_orig); //utils_dump_mem ((u8*) mrec, 0, mft_size, 1); @@ -1449,7 +1465,7 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) */ //printf ("deleting file\n"); - //ntfs_dt_print (del->dir->index_num, 0); + //ntfs_dt_print (del->dir->index, 0); if (1) res = utils_free_non_residents (ichild); if (1) res = utils_mftrec_mark_free (dt->dir->vol, del->children[index_num]->indexed_file); @@ -1487,6 +1503,11 @@ static int ntfsrm (ntfs_volume *vol, char *name) //printf ("mft_num = %lld\n", mft_num); //ntfs_dir_print (finddir, 0); + if (!finddir) { + printf ("Couldn't find the index entry for %s\n", name); + return 1; + } + if (rindex (name, PATH_SEP)) name = rindex (name, PATH_SEP) + 1; @@ -1501,6 +1522,102 @@ static int ntfsrm (ntfs_volume *vol, char *name) return 0; } + +/** + * ntfs_index_dump_alloc + */ +static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) +{ + u8 buffer[4096]; + INDEX_BLOCK *block; + INDEX_ENTRY *entry; + u8 *ptr; + int size; + VCN *newvcn; + + ntfs_attr_mst_pread (attr, vcn*512, 1, sizeof (buffer), buffer); + + block = (INDEX_BLOCK*) buffer; + size = block->index.allocated_size; + + ptr = buffer + 64; + + while (ptr < (buffer + size)) { + entry = (INDEX_ENTRY*) ptr; + + if (entry->flags & INDEX_ENTRY_NODE) { + newvcn = (VCN*) (ptr + ((entry->key_length + 0x17) & ~7)); + ntfs_index_dump_alloc (attr, *newvcn, indent+4); + } + + printf ("%.*s", indent, space); + + if (entry->flags & INDEX_ENTRY_END) { + printf ("[END]"); + ptr += sizeof (buffer); + } else { + ntfs_name_print (entry->key.file_name.file_name, entry->key.file_name.file_name_length); + } + + if (entry->flags & INDEX_ENTRY_NODE) { + printf (" (%lld)\n", *newvcn); + } else { + printf ("\n"); + } + + ptr += entry->length; + } + return 0; +} + +/** + * ntfs_index_dump + */ +static int ntfs_index_dump (ntfs_inode *inode) +{ + u8 buffer[1024]; + ntfs_attr *iroot; + ntfs_attr *ialloc; + INDEX_ROOT *root; + INDEX_ENTRY *entry; + u8 *ptr; + int size; + VCN *vcn; + + iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); + ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); + + size = (int) ntfs_attr_pread (iroot, 0, sizeof (buffer), buffer); + + root = (INDEX_ROOT*) buffer; + + ptr = buffer + root->index.entries_offset + 0x10; + + while (ptr < (buffer + size)) { + entry = (INDEX_ENTRY*) ptr; + + if (entry->flags & INDEX_ENTRY_NODE) { + vcn = (VCN*) (ptr + ((entry->key_length + 0x17) & ~7)); + ntfs_index_dump_alloc (ialloc, *vcn, 4); + } + + if (entry->flags & INDEX_ENTRY_END) { + printf ("[END]"); + } else { + ntfs_name_print (entry->key.file_name.file_name, entry->key.file_name.file_name_length); + } + + if (entry->flags & INDEX_ENTRY_NODE) { + printf (" (%lld)", *vcn); + } + printf ("\n"); + + ptr += entry->length; + } + return 0; +} + + /** * main - Begin here * @@ -1544,7 +1661,8 @@ int main (int argc, char *argv[]) goto done; } - result = ntfsrm (vol, opts.file); + if (0) result = ntfsrm (vol, opts.file); + if (1) result = ntfs_index_dump (inode); /* if (result) printf ("failed\n"); From 514d5bb3b5a054f6a4b8088ccb92a3613d0c4b5d Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 16 Jun 2004 22:51:38 +0000 Subject: [PATCH 1508/2994] more folding BKrev: 40d0cefasqUEwWMx6-mOoS2CqbH2WA From 395cf1b994d82247c71b7a7f8ac6085d824b4311 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 16 Jun 2004 22:51:38 +0000 Subject: [PATCH 1509/2994] sort out the folding after a botched merge (Logical change 1.422) --- ntfsprogs/ntfsinfo.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 6a344d57..8cab6c37 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -258,8 +258,8 @@ static int parse_options (int argc, char *argv[]) return (!err && !help && !ver); } -/**************** utility functions *********************/ +/* *************** utility functions ******************** */ /** * ntfsinfo_time_to_str() - * @sle_ntfs_clock: on disk time format in 100ns units since 1st jan 1601 @@ -307,8 +307,8 @@ static char *ntfs_attr_get_name(ATTR_RECORD *attr) } } -/**************** functions for dumping global info *********************/ +/* *************** functions for dumping global info ******************** */ /** * ntfs_dump_volume - dump information about the volume */ @@ -385,8 +385,8 @@ static void ntfs_dump_volume(ntfs_volume *vol) //TODO: Still need to add a few more attributes } -/**************** functions for dumping attributes *********************/ +/* *************** functions for dumping attributes ******************** */ /** * ntfs_dump_standard_information */ @@ -1079,6 +1079,9 @@ static void ntfs_dump_attr_logged_utility_stream(ATTR_RECORD *attr __attribute__ printf("\tTODO\n"); } +/** + * ntfs_hex_dump + */ static void ntfs_hex_dump(void *buf,unsigned int length) { unsigned int i=0; @@ -1115,6 +1118,9 @@ static void ntfs_hex_dump(void *buf,unsigned int length) } } +/** + * ntfs_dump_attr_unknown + */ static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) { printf("Dumping unknown attribute type 0x%X.\n" From 4a82a887c34d0315ddf81edbe94d72000ffcb304 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 17 Jun 2004 20:09:32 +0000 Subject: [PATCH 1510/2994] Auto merged 2004/06/17 21:03:45+01:00 cantab.net!aia21 Auto merged 2004/06/17 21:03:28+01:00 cantab.net!aia21 Endianness fix. (Logical change 1.423) --- ntfsprogs/ntfsinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 8cab6c37..06c51435 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -902,7 +902,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) /* attr_type dumping */ printf("\tIndexed Attr Type:\t "); - type = le32_to_cpu(index_root->type); + type = index_root->type; if (type) { if (index_root->type != AT_FILE_NAME) { /* wierd, this should be illgeal */ From aa69ba08e4c2887c22d44653d7444aa5e08af8dd Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 17 Jun 2004 20:09:32 +0000 Subject: [PATCH 1511/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/06/17 21:03:45+01:00 cantab.net!aia21 Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into cantab.net:/home/src/ntfsprogs 2004/06/17 21:03:38+01:00 cantab.net!aia21 ntfsinfo.c: Endianness fix. BKrev: 40d1fa7cM0elyrDoCCQoAF2ByDI0-w From 6219eecc7ba855fbb89c5fd7a1f05b00b4538775 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 17 Jun 2004 21:49:42 +0000 Subject: [PATCH 1512/2994] start some index entry manipulation routines (Logical change 1.424) --- ntfsprogs/ntfsrm.c | 250 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 229 insertions(+), 21 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index f1b0d3c8..f1adacaa 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "utils.h" #include "ntfsrm.h" @@ -225,7 +226,6 @@ struct ntfs_dt { int child_count; INDEX_ENTRY **children; INDEX_HEADER *header; - BOOL changed; VCN vcn; }; @@ -452,7 +452,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par if (!dir) return NULL; - + dt = calloc (1, sizeof (*dt)); if (!dt) return NULL; @@ -461,7 +461,6 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par dt->parent = parent; dt->children = NULL; dt->child_count = 0; - dt->changed = FALSE; dt->sub_nodes = NULL; dt->vcn = vcn; @@ -574,7 +573,7 @@ static MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) * match name - return MREF * collates before no return -1 * collates before yes map & recurse - * end marker no return -1 + * end marker no return -1 * end marker yes map & recurse */ @@ -645,7 +644,7 @@ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int n * match name - return MREF * collates before no return -1 * collates before yes map & recurse - * end marker no return -1 + * end marker no return -1 * end marker yes map & recurse */ @@ -787,7 +786,7 @@ static MFT_REF ntfs_dir_find (struct ntfs_dir *dir, char *name) if (!dir || !name) return -1; - + len = ntfs_mbstoucs (name, &uname, 0); if (len < 0) return -1; @@ -811,7 +810,7 @@ static void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) { if (!parent || !child) return; - + parent->child_count++; //printf ("child count = %d\n", parent->child_count); parent->children = realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); @@ -955,6 +954,7 @@ static int utils_mftrec_mark_free2 (ntfs_volume *vol, MFT_REF mref) if (!vol) return -1; + mref = MREF (mref); rec = (MFT_RECORD*) buffer; res = ntfs_mft_record_read (vol, mref, rec); @@ -1158,7 +1158,7 @@ static int ntfs_dt_remove_alloc (struct ntfs_dt *dt, int index_num) ie = dt->children[dt->child_count-1]; end = (u8*)ie + ie->length; - + len = end - src; //printf ("move %d bytes\n", len); @@ -1269,7 +1269,7 @@ static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) ie = dt->children[dt->child_count-1]; end = (u8*)ie + ie->length; - + len = end - src; //printf ("move %d bytes\n", len); @@ -1523,6 +1523,197 @@ static int ntfsrm (ntfs_volume *vol, char *name) } +#define ATTR_SIZE(s) (((s)+7) & ~7) + +/** + * ntfsinfo_time_to_str() - + * @sle_ntfs_clock: on disk time format in 100ns units since 1st jan 1601 + * in little-endian format + * + * Return char* in a format 'Thu Jan 1 00:00:00 1970'. + * No need to free the returned memory. + * + * Example of usage: + * char *time_str = ntfsinfo_time_to_str( + * sle64_to_cpu(standard_attr->creation_time)); + * printf("\tFile Creation Time:\t %s", time_str); + */ +static const char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) +{ + time_t unix_clock = ntfs2utc(sle64_to_cpu(sle_ntfs_clock)); + if (sle_ntfs_clock == 0) + return "none\n"; + else + return ctime(&unix_clock); +} + +/** + * ntfs_ie_dump + */ +static void ntfs_ie_dump (INDEX_ENTRY *ie) +{ + if (!ie) + return; + + utils_dump_mem ((u8*)ie, 0, ie->length, 1); + printf ("\n"); + + printf ("MFT Ref: 0x%llx\n", ie->indexed_file); + printf ("length: %d\n", ie->length); + printf ("flags: "); + if (ie->flags == INDEX_ENTRY_NODE) printf ("NODE "); + if (ie->flags == INDEX_ENTRY_END) printf ("END"); + printf ("\n"); + printf ("reserved 0x%04x\n", ie->reserved); + printf ("mft parent: 0x%llx\n", ie->key.file_name.parent_directory); + + printf ("ctime: %s", ntfsinfo_time_to_str(ie->key.file_name.creation_time)); + printf ("dtime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_data_change_time)); + printf ("mtime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_mft_change_time)); + printf ("atime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_access_time)); + printf ("alloc size: %lld\n", ie->key.file_name.allocated_size); + printf ("data size: %lld\n", ie->key.file_name.data_size); + printf ("file flags: 0x%04x\n", ie->key.file_name.file_attributes); + printf ("reserved: 0x%04x\n", ie->key.file_name.reserved); + printf ("name len: %d\n", ie->key.file_name.file_name_length); + if (ie->key.file_name.file_name_length > 0) { + int i, r; + printf ("name type: %d\n", ie->key.file_name.file_name_type); + ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); + printf ("\n"); + r = ATTR_SIZE (2 * (ie->key.file_name.file_name_length+1)) - (2 * (ie->key.file_name.file_name_length+1)); + if (r > 0) { + u8 *ptr; + printf ("padding: "); + ptr = (u8*) (ie->key.file_name.file_name + ie->key.file_name.file_name_length); + for (i = 0; i < r; i++, ptr++) + printf ("0x%02x ", *ptr); + printf ("\n"); + } + } + if (ie->flags == INDEX_ENTRY_NODE) { + VCN *vcn = (VCN*) ((u8*) ie + ie->length - 8); + printf ("child vcn = %lld\n", *vcn); + } +} + +/** + * ntfs_ie_create + */ +static INDEX_ENTRY * ntfs_ie_create (void) +{ + int length; + INDEX_ENTRY *ie; + + length = 88; + ie = calloc (1, length); + if (!ie) + return NULL; + + ie->length = length; + return ie; +} + +/** + * ntfs_ie_copy + */ +static INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie) +{ + INDEX_ENTRY *copy = NULL; + + if (!ie) + return NULL; + + copy = malloc (ie->length); + if (!copy) + return NULL; + memcpy (copy, ie, ie->length); + + return copy; +} + +/** + * ntfs_ie_set_flags + */ +static int ntfs_ie_set_flags (INDEX_ENTRY *ie, INDEX_ENTRY_FLAGS flags) +{ + if (!ie) + return 0; + + if (flags == INDEX_ENTRY_NODE) { + } + if (flags == INDEX_ENTRY_END) { + } + return 0; +} + +/** + * ntfs_ie_set_child + */ +static int ntfs_ie_set_child (INDEX_ENTRY *ie, VCN vcn) +{ + if (!ie) + return 0; + vcn = 0; + return 0; +} + +/** + * ntfs_ie_set_name + */ +static int ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype) +{ + FILE_NAME_ATTR *file; + int klen; + int need; + + if (!ie || !name) + return 0; + + /* + * INDEX_ENTRY + * MFT_REF indexed_file; + * u16 length; + * u16 key_length; + * INDEX_ENTRY_FLAGS flags; + * u16 reserved; + * + * MFT_REF parent_directory; + * s64 creation_time; + * s64 last_data_change_time; + * s64 last_mft_change_time; + * s64 last_access_time; + * s64 allocated_size; + * s64 data_size; + * FILE_ATTR_FLAGS file_attributes; + * u32 reserved; + * u8 file_name_length; + * FILE_NAME_TYPE_FLAGS file_name_type; + * ntfschar file_name[l]; + * + * u8 reserved[n] + * + * VCN vcn; + */ + + file = &ie->key.file_name; + klen = ATTR_SIZE (ie->key_length); + need = ATTR_SIZE (sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar))); + + if (klen < need) { + } else if (klen > need) { + } else { + } + //realloc(); + + //clear end marker flag + + namelen = 0; + nametype = FILE_NAME_WIN32; + return 0; +} + + /** * ntfs_index_dump_alloc */ @@ -1540,9 +1731,7 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) block = (INDEX_BLOCK*) buffer; size = block->index.allocated_size; - ptr = buffer + 64; - - while (ptr < (buffer + size)) { + for (ptr = buffer + 64; ptr < (buffer + size); ptr += entry->length) { entry = (INDEX_ENTRY*) ptr; if (entry->flags & INDEX_ENTRY_NODE) { @@ -1554,7 +1743,6 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) if (entry->flags & INDEX_ENTRY_END) { printf ("[END]"); - ptr += sizeof (buffer); } else { ntfs_name_print (entry->key.file_name.file_name, entry->key.file_name.file_name_length); } @@ -1565,8 +1753,11 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) printf ("\n"); } - ptr += entry->length; + if (entry->flags & INDEX_ENTRY_END) + break; } + printf ("%.*s", indent, space); + printf ("fill = %d/%d\n", block->index.index_length, block->index.allocated_size); return 0; } @@ -1596,6 +1787,9 @@ static int ntfs_index_dump (ntfs_inode *inode) while (ptr < (buffer + size)) { entry = (INDEX_ENTRY*) ptr; + ntfs_ie_dump (entry); + exit (1); + if (entry->flags & INDEX_ENTRY_NODE) { vcn = (VCN*) (ptr + ((entry->key_length + 0x17) & ~7)); ntfs_index_dump_alloc (ialloc, *vcn, 4); @@ -1614,6 +1808,7 @@ static int ntfs_index_dump (ntfs_inode *inode) ptr += entry->length; } + printf ("fill = %d\n", ptr - buffer); return 0; } @@ -1661,14 +1856,27 @@ int main (int argc, char *argv[]) goto done; } - if (0) result = ntfsrm (vol, opts.file); if (1) result = ntfs_index_dump (inode); - /* - if (result) - printf ("failed\n"); - else - printf ("success\n"); - */ + if (0) result = ntfsrm (vol, opts.file); + + { + INDEX_ENTRY *ie1 = NULL; + INDEX_ENTRY *ie2 = NULL; + int namelen = 0; + ntfschar *name = NULL; + + namelen = ntfs_mbstoucs("richard", &name, 0); + + if (1) ie1 = ntfs_ie_create(); + if (0) ie2 = ntfs_ie_copy (ie1); + if (0) ntfs_ie_set_flags (ie1, INDEX_ENTRY_NODE); + if (0) ntfs_ie_set_child (ie1, 1234); + if (1) ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); + + ntfs_ie_dump (ie1); + free (ie1); + free (ie2); + } done: ntfs_inode_close (inode); From fadd3d0d2b26ca00e9ad6c5fea6b91e8c89ffdac Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 17 Jun 2004 21:49:42 +0000 Subject: [PATCH 1513/2994] start some index entry manipulation routines BKrev: 40d211f6CHTVuCsvBAiJc72rwEpS4g From 9847ef4fccc71d310b38814b34ddffeafddd9be5 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 17 Jun 2004 23:22:44 +0000 Subject: [PATCH 1514/2994] create an index entry from scratch (Logical change 1.425) --- ntfsprogs/ntfsrm.c | 226 ++++++++++++++++++++++++++++----------------- 1 file changed, 143 insertions(+), 83 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index f1adacaa..a1d7dd4f 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1560,35 +1560,40 @@ static void ntfs_ie_dump (INDEX_ENTRY *ie) printf ("MFT Ref: 0x%llx\n", ie->indexed_file); printf ("length: %d\n", ie->length); + printf ("keylen: %d\n", ie->key_length); printf ("flags: "); - if (ie->flags == INDEX_ENTRY_NODE) printf ("NODE "); - if (ie->flags == INDEX_ENTRY_END) printf ("END"); + if (ie->flags & INDEX_ENTRY_NODE) printf ("NODE "); + if (ie->flags & INDEX_ENTRY_END) printf ("END"); + if (!(ie->flags & (INDEX_ENTRY_NODE | INDEX_ENTRY_END))) printf ("none"); printf ("\n"); printf ("reserved 0x%04x\n", ie->reserved); - printf ("mft parent: 0x%llx\n", ie->key.file_name.parent_directory); + if (ie->key_length > 0) { + printf ("mft parent: 0x%llx\n", ie->key.file_name.parent_directory); - printf ("ctime: %s", ntfsinfo_time_to_str(ie->key.file_name.creation_time)); - printf ("dtime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_data_change_time)); - printf ("mtime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_mft_change_time)); - printf ("atime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_access_time)); - printf ("alloc size: %lld\n", ie->key.file_name.allocated_size); - printf ("data size: %lld\n", ie->key.file_name.data_size); - printf ("file flags: 0x%04x\n", ie->key.file_name.file_attributes); - printf ("reserved: 0x%04x\n", ie->key.file_name.reserved); - printf ("name len: %d\n", ie->key.file_name.file_name_length); - if (ie->key.file_name.file_name_length > 0) { - int i, r; - printf ("name type: %d\n", ie->key.file_name.file_name_type); - ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); - printf ("\n"); - r = ATTR_SIZE (2 * (ie->key.file_name.file_name_length+1)) - (2 * (ie->key.file_name.file_name_length+1)); - if (r > 0) { - u8 *ptr; - printf ("padding: "); - ptr = (u8*) (ie->key.file_name.file_name + ie->key.file_name.file_name_length); - for (i = 0; i < r; i++, ptr++) - printf ("0x%02x ", *ptr); + printf ("ctime: %s", ntfsinfo_time_to_str(ie->key.file_name.creation_time)); + printf ("dtime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_data_change_time)); + printf ("mtime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_mft_change_time)); + printf ("atime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_access_time)); + printf ("alloc size: %lld\n", ie->key.file_name.allocated_size); + printf ("data size: %lld\n", ie->key.file_name.data_size); + printf ("file flags: 0x%04x\n", ie->key.file_name.file_attributes); + printf ("reserved: 0x%04x\n", ie->key.file_name.reserved); + printf ("name len: %d\n", ie->key.file_name.file_name_length); + if (ie->key.file_name.file_name_length > 0) { + int i, r; + printf ("name type: %d\n", ie->key.file_name.file_name_type); + printf ("name: "); + ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); + r = ATTR_SIZE (2 * (ie->key.file_name.file_name_length+1)) - (2 * (ie->key.file_name.file_name_length+1)); + if (r > 0) { + u8 *ptr; + printf ("padding: "); + ptr = (u8*) (ie->key.file_name.file_name + ie->key.file_name.file_name_length); + for (i = 0; i < r; i++, ptr++) + printf ("0x%02x ", *ptr); + printf ("\n"); + } } } if (ie->flags == INDEX_ENTRY_NODE) { @@ -1605,12 +1610,16 @@ static INDEX_ENTRY * ntfs_ie_create (void) int length; INDEX_ENTRY *ie; - length = 88; - ie = calloc (1, length); + length = 16; + ie = malloc (length); if (!ie) return NULL; - ie->length = length; + ie->indexed_file = 0; + ie->length = length; + ie->key_length = 0; + ie->flags = INDEX_ENTRY_END; + ie->reserved = 0; return ie; } @@ -1633,18 +1642,30 @@ static INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie) } /** - * ntfs_ie_set_flags + * ntfs_ie_reset_flags */ -static int ntfs_ie_set_flags (INDEX_ENTRY *ie, INDEX_ENTRY_FLAGS flags) +static INDEX_ENTRY * ntfs_ie_reset_flags (INDEX_ENTRY *ie, INDEX_ENTRY_FLAGS flags) { + VCN vcn; + if (!ie) return 0; - if (flags == INDEX_ENTRY_NODE) { + if ((flags & INDEX_ENTRY_NODE) && (!(ie->flags & INDEX_ENTRY_NODE))) { + ie->length -= 8; + ie->flags &= ~INDEX_ENTRY_NODE; + ie = realloc (ie, ie->length); } - if (flags == INDEX_ENTRY_END) { + + if ((!(flags & INDEX_ENTRY_END)) && (ie->flags & INDEX_ENTRY_END)) { + ie->length -= ATTR_SIZE (ie->key_length); + vcn = *((VCN*) ((u8*) ie + ie->length - 8)); + + *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; + ie->flags |= INDEX_ENTRY_END; } - return 0; + + return ie; } /** @@ -1661,56 +1682,70 @@ static int ntfs_ie_set_child (INDEX_ENTRY *ie, VCN vcn) /** * ntfs_ie_set_name */ -static int ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype) +static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype) { FILE_NAME_ATTR *file; int klen; int need; + VCN vcn = 0; if (!ie || !name) - return 0; + return NULL; /* * INDEX_ENTRY - * MFT_REF indexed_file; - * u16 length; - * u16 key_length; - * INDEX_ENTRY_FLAGS flags; - * u16 reserved; + * MFT_REF indexed_file; + * u16 length; + * u16 key_length; + * INDEX_ENTRY_FLAGS flags; + * u16 reserved; * - * MFT_REF parent_directory; - * s64 creation_time; - * s64 last_data_change_time; - * s64 last_mft_change_time; - * s64 last_access_time; - * s64 allocated_size; - * s64 data_size; - * FILE_ATTR_FLAGS file_attributes; - * u32 reserved; - * u8 file_name_length; - * FILE_NAME_TYPE_FLAGS file_name_type; - * ntfschar file_name[l]; - * - * u8 reserved[n] - * - * VCN vcn; + * FILENAME + * MFT_REF parent_directory; + * s64 creation_time; + * s64 last_data_change_time; + * s64 last_mft_change_time; + * s64 last_access_time; + * s64 allocated_size; + * s64 data_size; + * FILE_ATTR_FLAGS file_attributes; + * u32 reserved; + * u8 file_name_length; + * FILE_NAME_TYPE_FLAGS file_name_type; + * ntfschar file_name[l]; + * u8 reserved[n] + * + * VCN vcn; */ file = &ie->key.file_name; + klen = ATTR_SIZE (ie->key_length); need = ATTR_SIZE (sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar))); - if (klen < need) { - } else if (klen > need) { - } else { - } - //realloc(); + printf ("ilen = %d\n", ie->length); + printf ("klen = %d\n", klen); + printf ("need = %d\n", need); - //clear end marker flag + if (ie->flags & INDEX_ENTRY_NODE) + vcn = *((VCN*) ((u8*) ie + ie->length - 8)); - namelen = 0; - nametype = FILE_NAME_WIN32; - return 0; + ie->length = 16 + need; + ie->key_length = sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar)); + ie = realloc (ie, ie->length + ie->key_length); + if (!ie) + return NULL; + + memcpy (ie->key.file_name.file_name, name, namelen * 2); + + if (ie->flags & INDEX_ENTRY_NODE) + *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; + + ie->key.file_name.file_name_length = namelen; + ie->key.file_name.file_name_type = nametype; + ie->flags &= ~INDEX_ENTRY_END; + + return ie; } @@ -1786,10 +1821,6 @@ static int ntfs_index_dump (ntfs_inode *inode) while (ptr < (buffer + size)) { entry = (INDEX_ENTRY*) ptr; - - ntfs_ie_dump (entry); - exit (1); - if (entry->flags & INDEX_ENTRY_NODE) { vcn = (VCN*) (ptr + ((entry->key_length + 0x17) & ~7)); ntfs_index_dump_alloc (ialloc, *vcn, 4); @@ -1856,26 +1887,55 @@ int main (int argc, char *argv[]) goto done; } - if (1) result = ntfs_index_dump (inode); + if (0) result = ntfs_index_dump (inode); if (0) result = ntfsrm (vol, opts.file); - { - INDEX_ENTRY *ie1 = NULL; - INDEX_ENTRY *ie2 = NULL; - int namelen = 0; - ntfschar *name = NULL; + if (1) { + INDEX_ENTRY *ie1 = NULL; + INDEX_ENTRY *ie2 = NULL; + int namelen = 0; + ntfschar *name = NULL; - namelen = ntfs_mbstoucs("richard", &name, 0); + if (1) { + ie1 = ntfs_ie_create(); + ntfs_ie_dump (ie1); + } - if (1) ie1 = ntfs_ie_create(); - if (0) ie2 = ntfs_ie_copy (ie1); - if (0) ntfs_ie_set_flags (ie1, INDEX_ENTRY_NODE); - if (0) ntfs_ie_set_child (ie1, 1234); - if (1) ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); + if (0) { + ie2 = ntfs_ie_copy (ie1); + ntfs_ie_dump (ie2); + } - ntfs_ie_dump (ie1); - free (ie1); - free (ie2); + if (0) { + ie1 = ntfs_ie_reset_flags (ie1, INDEX_ENTRY_END); + ntfs_ie_dump (ie1); + } + + if (0) { + ntfs_ie_set_child (ie1, 1234); + ntfs_ie_dump (ie1); + } + + namelen = ntfs_mbstoucs("richard", &name, 0); + if (1) ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); + free (name); + name = NULL; + namelen = ntfs_mbstoucs("richard2", &name, 0); + if (1) ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); + + ie1->indexed_file = 1234; + ie1->key.file_name.parent_directory = 5; + ie1->key.file_name.creation_time = utc2ntfs (time(NULL)); + ie1->key.file_name.last_data_change_time = utc2ntfs (time(NULL)); + ie1->key.file_name.last_mft_change_time = utc2ntfs (time(NULL)); + ie1->key.file_name.last_access_time = utc2ntfs (time(NULL)); + ie1->key.file_name.allocated_size = 4096; + ie1->key.file_name.data_size = 3973; + + ntfs_ie_dump (ie1); + free (name); + free (ie1); + free (ie2); } done: From 32c0424f26a349fb2d97914ddb173981e5c08ee4 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 17 Jun 2004 23:22:44 +0000 Subject: [PATCH 1515/2994] create an index entry from scratch BKrev: 40d227c4Oi4CmLKIatH7-cb81AZAiA From 5bc3824d8575e547bd2fcc4687ca214d7dd99756 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 18 Jun 2004 17:51:59 +0000 Subject: [PATCH 1516/2994] index entry code BKrev: 40d32bbf2EZ82ncb-xQ9sOWUgbjzzQ From acef9d58b314450ae62f36cf5708316f62290bda Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 18 Jun 2004 17:51:59 +0000 Subject: [PATCH 1517/2994] routines to add/remove a name and add/remove a vcn (Logical change 1.426) --- ntfsprogs/ntfsrm.c | 201 ++++++++++++++++++++++++++++----------------- 1 file changed, 126 insertions(+), 75 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index a1d7dd4f..8a5330cf 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1555,8 +1555,9 @@ static void ntfs_ie_dump (INDEX_ENTRY *ie) if (!ie) return; - utils_dump_mem ((u8*)ie, 0, ie->length, 1); + printf ("________________________________________________"); printf ("\n"); + utils_dump_mem ((u8*)ie, 0, ie->length, 1); printf ("MFT Ref: 0x%llx\n", ie->indexed_file); printf ("length: %d\n", ie->length); @@ -1577,8 +1578,7 @@ static void ntfs_ie_dump (INDEX_ENTRY *ie) printf ("alloc size: %lld\n", ie->key.file_name.allocated_size); printf ("data size: %lld\n", ie->key.file_name.data_size); printf ("file flags: 0x%04x\n", ie->key.file_name.file_attributes); - printf ("reserved: 0x%04x\n", ie->key.file_name.reserved); - printf ("name len: %d\n", ie->key.file_name.file_name_length); + printf ("reserved: 0x%04x\n", ie->key.file_name.reserved); printf ("name len: %d\n", ie->key.file_name.file_name_length); if (ie->key.file_name.file_name_length > 0) { int i, r; printf ("name type: %d\n", ie->key.file_name.file_name_type); @@ -1642,41 +1642,43 @@ static INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie) } /** - * ntfs_ie_reset_flags + * ntfs_ie_set_child */ -static INDEX_ENTRY * ntfs_ie_reset_flags (INDEX_ENTRY *ie, INDEX_ENTRY_FLAGS flags) +static INDEX_ENTRY * ntfs_ie_set_child (INDEX_ENTRY *ie, VCN vcn) { - VCN vcn; - if (!ie) return 0; - if ((flags & INDEX_ENTRY_NODE) && (!(ie->flags & INDEX_ENTRY_NODE))) { - ie->length -= 8; - ie->flags &= ~INDEX_ENTRY_NODE; - ie = realloc (ie, ie->length); - } - - if ((!(flags & INDEX_ENTRY_END)) && (ie->flags & INDEX_ENTRY_END)) { - ie->length -= ATTR_SIZE (ie->key_length); - vcn = *((VCN*) ((u8*) ie + ie->length - 8)); - + if (ie->flags & INDEX_ENTRY_NODE) { *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; - ie->flags |= INDEX_ENTRY_END; + return ie; } - return ie; + ie->length += 8; + ie = realloc (ie, ie->length); + if (!ie) + return NULL; + + ie->flags |= INDEX_ENTRY_NODE; + *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; + + return 0; } /** - * ntfs_ie_set_child + * ntfs_ie_remove_child */ -static int ntfs_ie_set_child (INDEX_ENTRY *ie, VCN vcn) +static INDEX_ENTRY * ntfs_ie_remove_child (INDEX_ENTRY *ie) { if (!ie) - return 0; - vcn = 0; - return 0; + return NULL; + if (!(ie->flags & INDEX_ENTRY_NODE)) + return ie; + + ie->length -= 8; + ie->flags &= ~INDEX_ENTRY_NODE; + ie = realloc (ie, ie->length); + return NULL; } /** @@ -1723,9 +1725,9 @@ static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int name klen = ATTR_SIZE (ie->key_length); need = ATTR_SIZE (sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar))); - printf ("ilen = %d\n", ie->length); - printf ("klen = %d\n", klen); - printf ("need = %d\n", need); + //printf ("ilen = %d\n", ie->length); + //printf ("klen = %d\n", klen); + //printf ("need = %d\n", need); if (ie->flags & INDEX_ENTRY_NODE) vcn = *((VCN*) ((u8*) ie + ie->length - 8)); @@ -1748,6 +1750,102 @@ static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int name return ie; } +/** + * ntfs_ie_remove_name + */ +static INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) +{ + VCN vcn; + + if (!ie) + return NULL; + if (ie->key_length == 0) + return ie; + + if (ie->flags & INDEX_ENTRY_NODE) + vcn = *((VCN*) ((u8*) ie + ie->length - 8)); + + ie->length -= ATTR_SIZE (ie->key_length); + ie->key_length = 0; + ie->flags |= INDEX_ENTRY_END; + + ie = realloc (ie, ie->length); + if (!ie) + return NULL; + + if (ie->flags & INDEX_ENTRY_NODE) + *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; + return ie; +} + +/** + * ntfs_ie_test + */ +static int ntfs_ie_test (void) +{ + INDEX_ENTRY *ie1 = NULL; + INDEX_ENTRY *ie2 = NULL; + int namelen = 0; + ntfschar *name = NULL; + + printf ("\n\n\n\n\n\n----------------------------------------------------------------------------------\n\n"); + if (1) { + ie1 = ntfs_ie_create(); + //ntfs_ie_dump (ie1); + } + + if (0) { + ie2 = ntfs_ie_copy (ie1); + ntfs_ie_dump (ie2); + } + + if (1) { + namelen = ntfs_mbstoucs("richard", &name, 0); + ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); + free (name); + name = NULL; + ntfs_ie_dump (ie1); + } + + if (1) { + namelen = ntfs_mbstoucs("richard2", &name, 0); + ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); + free (name); + name = NULL; + ntfs_ie_dump (ie1); + } + + if (1) { + ie1 = ntfs_ie_remove_name (ie1); + ntfs_ie_dump (ie1); + } + + if (1) { + ntfs_ie_set_child (ie1, 1234); + ntfs_ie_dump (ie1); + } + + if (1) { + ntfs_ie_remove_child (ie1); + ntfs_ie_dump (ie1); + } + + ie1->indexed_file = 1234; + ie1->key.file_name.parent_directory = 5; + ie1->key.file_name.creation_time = utc2ntfs (time(NULL)); + ie1->key.file_name.last_data_change_time = utc2ntfs (time(NULL)); + ie1->key.file_name.last_mft_change_time = utc2ntfs (time(NULL)); + ie1->key.file_name.last_access_time = utc2ntfs (time(NULL)); + ie1->key.file_name.allocated_size = 4096; + ie1->key.file_name.data_size = 3973; + + //ntfs_ie_dump (ie1); + free (name); + free (ie1); + free (ie2); + return 0; +} + /** * ntfs_index_dump_alloc @@ -1889,54 +1987,7 @@ int main (int argc, char *argv[]) if (0) result = ntfs_index_dump (inode); if (0) result = ntfsrm (vol, opts.file); - - if (1) { - INDEX_ENTRY *ie1 = NULL; - INDEX_ENTRY *ie2 = NULL; - int namelen = 0; - ntfschar *name = NULL; - - if (1) { - ie1 = ntfs_ie_create(); - ntfs_ie_dump (ie1); - } - - if (0) { - ie2 = ntfs_ie_copy (ie1); - ntfs_ie_dump (ie2); - } - - if (0) { - ie1 = ntfs_ie_reset_flags (ie1, INDEX_ENTRY_END); - ntfs_ie_dump (ie1); - } - - if (0) { - ntfs_ie_set_child (ie1, 1234); - ntfs_ie_dump (ie1); - } - - namelen = ntfs_mbstoucs("richard", &name, 0); - if (1) ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); - free (name); - name = NULL; - namelen = ntfs_mbstoucs("richard2", &name, 0); - if (1) ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); - - ie1->indexed_file = 1234; - ie1->key.file_name.parent_directory = 5; - ie1->key.file_name.creation_time = utc2ntfs (time(NULL)); - ie1->key.file_name.last_data_change_time = utc2ntfs (time(NULL)); - ie1->key.file_name.last_mft_change_time = utc2ntfs (time(NULL)); - ie1->key.file_name.last_access_time = utc2ntfs (time(NULL)); - ie1->key.file_name.allocated_size = 4096; - ie1->key.file_name.data_size = 3973; - - ntfs_ie_dump (ie1); - free (name); - free (ie1); - free (ie2); - } + if (0) result = ntfs_ie_test(); done: ntfs_inode_close (inode); From 3f9850d4cf3b33ee88fc68a9c6d7f143162148ae Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 18 Jun 2004 17:54:41 +0000 Subject: [PATCH 1518/2994] Auto merged 2004/06/18 16:24:15+01:00 cantab.net!aia21 Exclude (Logical change 1.427) --- ntfsprogs/ntfsinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 06c51435..8cab6c37 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -902,7 +902,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) /* attr_type dumping */ printf("\tIndexed Attr Type:\t "); - type = index_root->type; + type = le32_to_cpu(index_root->type); if (type) { if (index_root->type != AT_FILE_NAME) { /* wierd, this should be illgeal */ From d74632353d8004963338d2bc70c427d379685db7 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 18 Jun 2004 17:54:41 +0000 Subject: [PATCH 1519/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into flatcap.org:/home/flatcap/ntfsprogs 2004/06/18 16:24:16+01:00 cantab.net!aia21 Cset exclude: aia21@cantab.net|ChangeSet|20040617200338|20487 BKrev: 40d32c61oc6gmDs0r26TIwzaHych5A From 715d0aa02495ce9122fd49b23032521f5b7b390d Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 20 Jun 2004 16:47:19 +0000 Subject: [PATCH 1520/2994] Yura: ntfswipe - wipe file tails BKrev: 40d5bf976wEWiVQkeCAsYVeEPC1CnA From b429c1fc690333aa477674f04a29f61379b0ffac Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 20 Jun 2004 16:47:19 +0000 Subject: [PATCH 1521/2994] bugfix for ntfs_rl_pread,pwrite for pos > 0 (Logical change 1.428) --- libntfs/runlist.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 452f24a8..8cadc325 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -3,6 +3,7 @@ * * Copyright (c) 2002-2004 Anton Altaparmakov * Copyright (c) 2002 Richard Russon + * Copyright (c) 2004 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -1032,8 +1033,10 @@ s64 ntfs_rl_pread(const ntfs_volume *vol, const runlist_element *rl, if (!count) return count; /* Seek in @rl to the run containing @pos. */ - for (ofs = 0; rl->length && (ofs + rl->length <= pos); rl++) - ofs += rl->length; + for (ofs = 0; rl->length && + (ofs + rl->length << vol->cluster_size_bits <= pos); rl++) { + ofs += rl->length * vol->cluster_size; + } /* Offset in the run at which to begin reading. */ ofs = pos - ofs; for (total = 0LL; count; rl++, ofs = 0) { @@ -1115,8 +1118,10 @@ s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, if (!count) return count; /* Seek in @rl to the run containing @pos. */ - for (ofs = 0; rl->length && (ofs + rl->length <= pos); rl++) - ofs += rl->length; + for (ofs = 0; rl->length && + (ofs + rl->length << vol->cluster_size_bits <= pos); rl++) { + ofs += rl->length * vol->cluster_size; + } /* Offset in the run at which to begin writing. */ ofs = pos - ofs; for (total = 0LL; count; rl++, ofs = 0) { From def9a888b697ea40979aebc9c6311c970911d275 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 20 Jun 2004 16:47:19 +0000 Subject: [PATCH 1522/2994] credits for Yura (Logical change 1.428) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 72b89a52..2f47eab9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,8 @@ xx/xx/2004 - 1.9.3-WIP - Undelete: add ability to recover ranges of inodes. (Holger Ohmacht) - Lots of updates to ntfsinfo, see "bk changes". (Yuval) - Fix crash in ntfsinfo for non-resident Security Info. (Yura) + - ntfswipe - wipe file tails (Yura) + - Bugfix in ntfs_rl_pread,pwrite for pos > 0. (Yura) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From c90bc03ffdbfb5e777d20495d005f8aa6ebe2a8d Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 20 Jun 2004 16:47:19 +0000 Subject: [PATCH 1523/2994] missing credit (Logical change 1.428) --- ntfsprogs/ntfsinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 8cab6c37..8d201cb1 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -4,6 +4,7 @@ * Copyright (c) 2002-2004 Matthew J. Fanto * Copyright (c) 2002-2004 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon + * Copyright (c) 2004 Yura Pakhuchiy * * This utility will dump a file's attributes. * From fb1cdc88255d2b7e026f9b591a1be34c878f3bc0 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 20 Jun 2004 16:47:19 +0000 Subject: [PATCH 1524/2994] wipe file tails (Logical change 1.428) --- ntfsprogs/ntfswipe.c | 91 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 7df7d5a7..90fc8d36 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -2,6 +2,7 @@ * ntfswipe - Part of the Linux-NTFS project. * * Copyright (c) 2002-2003 Richard Russon + * Copyright (c) 2004 Yura Pakhuchiy * * This utility will overwrite unused space on an NTFS volume. * @@ -406,11 +407,97 @@ free: */ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) { + s64 total = 0; + s64 size; + s64 inode_num; + ntfs_attr_search_ctx *ctx; + ntfs_inode *ni; + unsigned char *buf; + ATTR_RECORD *attr; + runlist *rl; + if (!vol || (byte < 0)) return -1; + + for (inode_num = 16; inode_num < vol->nr_mft_records; inode_num++) { + Vprintf ("Inode %lli - ", inode_num); + ni = ntfs_inode_open (vol, inode_num); + if (!ni) { + Vprintf ("Could not open inode\n"); + continue; + } + + ctx = ntfs_attr_get_search_ctx(ni, 0); + if (!ctx) { + Vprintf ("Internal error\n"); + Eprintf ("Could not get search context\n"); + goto close_inode; + } - Qprintf ("wipe_tails (not implemented) 0x%02x\n", byte); - return 0; + if (ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + Vprintf ("Could not open $DATA attribute\n"); + goto put_search_ctx; + } + attr = ctx->attr; + + if (!attr->non_resident) { + Vprintf ("Resident $DATA atrributes. Skipping.\n"); + goto put_search_ctx; + } + + if (attr->flags & + (ATTR_IS_SPARSE | ATTR_IS_ENCRYPTED | ATTR_IS_COMPRESSED)) { + Vprintf ("Sparse, encrypted and compressed are not " + "supported.\n"); + goto put_search_ctx; + } + + size = attr->allocated_size - attr->data_size; + if (!size) { + Vprintf ("Nothing to wipe\n"); + goto put_search_ctx; + } + + if (act == act_info) { + total += size; + Vprintf ("Can wipe %lld bytes\n", size); + goto put_search_ctx; + } + + buf = malloc (size); + if (!buf) { + Vprintf ("Not enough memory\n"); + Eprintf ("Not enough memory to allocate %lld bytes\n", size); + goto put_search_ctx; + } + memset (buf, byte, size); + + rl = ntfs_mapping_pairs_decompress(vol, attr, 0); + if (!rl) { + Vprintf ("Internal error\n"); + Eprintf ("Could not decompress mapping pairs\n"); + goto free_buf; + } + + s64 bw = ntfs_rl_pwrite (vol, rl, attr->data_size, size, buf); + if (bw == -1) { + Vprintf ("Internal error\n"); + Eprintf ("Couldn't wipe tail of inode %lld\n", inode_num); + } else { + Vprintf ("Wiped %lld bytes\n", bw); + total += bw; + } + + free (rl); +free_buf: + free (buf); +put_search_ctx: + ntfs_attr_put_search_ctx (ctx); +close_inode: + ntfs_inode_close (ni); + } + Qprintf ("wipe_tails 0x%02x, %lld bytes\n", byte, (long long)total); + return total; } /** From 2bd3dc1596a1fa0e459734a3fc5eefc106e2dc1a Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 20 Jun 2004 23:15:53 +0000 Subject: [PATCH 1525/2994] add an index entry to an index (Logical change 1.429) --- ntfsprogs/ntfsrm.c | 235 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 233 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 8a5330cf..2100060a 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -196,6 +196,8 @@ static int parse_options (int argc, char **argv) struct ntfs_dir; +static void ntfs_ie_dump (INDEX_ENTRY *ie); +static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype); /** * struct bmp_page @@ -678,7 +680,65 @@ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int n //printf ("recurse\n"); res = ntfs_dt_find2 (dt->sub_nodes[i], name, name_len, index_num); } else { - //printf ("error collating name\n"); + printf ("error collating name\n"); + } + break; + } + + return res; +} + +/** + * ntfs_dt_find3 + */ +static struct ntfs_dt * ntfs_dt_find3 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) +{ + struct ntfs_dt *res = NULL; + INDEX_ENTRY *ie; + int i; + int r; + + if (!dt || !name) + return NULL; + + //printf ("child_count = %d\n", dt->child_count); + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + if (ie->flags & INDEX_ENTRY_END) { + r = -1; + } else { + //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); + r = ntfs_names_collate (name, name_len, + ie->key.file_name.file_name, + ie->key.file_name.file_name_length, + 2, IGNORE_CASE, + dt->dir->vol->upcase, + dt->dir->vol->upcase_len); + } + + //printf ("%d, %d\n", i, r); + + if (r == 1) { + //printf ("keep searching\n"); + continue; + } else if (r == 0) { + res = dt; + //printf ("match %p\n", res); + if (index_num) + *index_num = i; + } else if (r == -1) { + if (ie->flags & INDEX_ENTRY_NODE) { + //printf ("recurse\n"); + res = ntfs_dt_find3 (dt->sub_nodes[i], name, name_len, index_num); + } else { + //printf ("no match\n"); + res = dt; + if (index_num) + *index_num = i; + } + } else { + printf ("error collating name\n"); } break; } @@ -1113,6 +1173,102 @@ done: } +/** + * ntfs_dt_add_alloc + */ +static int ntfs_dt_add_alloc (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie) +{ + INDEX_BLOCK *block; + int need; + int space; + u8 *src; + u8 *dst; + int len; + + if (!parent || !ie) + return 0; + + block = (INDEX_BLOCK*) parent->data; + + need = ie->length; + space = parent->data_len - block->index.index_length - 24; + + printf ("need %d, have %d\n", need, space); + if (ie->length > space) { + printf ("no room"); + return 0; + } + + //printf ("--------------------------------------------------------------------------------\n"); + //utils_dump_mem (parent->data, 0, parent->data_len, 1); + //printf ("\n"); + + src = (u8*) parent->children[index_num]; + dst = src + need; + len = parent->data + parent->data_len - src - space; + //printf ("src = %d\n", src - parent->data); + //printf ("dst = %d\n", dst - parent->data); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + dst = src; + src = (u8*) ie; + len = need; + + memcpy (dst, src, len); + + block->index.index_length += len; + + dst = parent->data + block->index.index_length + 24; + len = parent->data_len - block->index.index_length - 24; + + memset (dst, 0, len); + + //printf ("--------------------------------------------------------------------------------\n"); + //utils_dump_mem (parent->data, 0, parent->data_len, 1); + //printf ("\n"); + return 0; +} + +/** + * ntfs_dt_add_root + */ +static int ntfs_dt_add_root (struct ntfs_dt *parent, struct ntfs_dt *child) +{ + return 0; +} + +/** + * ntfs_dt_add + */ +static int ntfs_dt_add (struct ntfs_dt *parent, INDEX_ENTRY *ie) +{ + FILE_NAME_ATTR *file; + struct ntfs_dt *dt; + int index_num = -1; + + if (!ie) + return 0; + + file = &ie->key.file_name; + + dt = ntfs_dt_find3 (parent, file->file_name, file->file_name_length, &index_num); + if (!dt) + return 0; + + //printf ("dt = %p, index = %d\n", dt, index_num); + //ntfs_ie_dump (dt->children[index_num]); + utils_dump_mem ((u8*)dt->children[index_num], 0, dt->children[index_num]->length, 1); + printf ("\n"); + + ntfs_dt_add_alloc (dt, index_num, ie); + + if (0) ntfs_dt_add_root (parent, NULL); + return 0; +} + + /** * ntfs_dt_remove_alloc */ @@ -1361,7 +1517,6 @@ static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) return ntfs_dt_remove_root (dt, index_num); } - /** * ntfs_dt_del_child */ @@ -1481,6 +1636,7 @@ close: return res; } + /** * ntfsrm */ @@ -1908,6 +2064,9 @@ static int ntfs_index_dump (ntfs_inode *inode) int size; VCN *vcn; + if (!inode) + return 0; + iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); @@ -1942,6 +2101,77 @@ static int ntfs_index_dump (ntfs_inode *inode) } +/** + * ntfsadd + */ +static int ntfsadd (ntfs_volume *vol, char *name) +{ + struct ntfs_dir *dir = NULL; + struct ntfs_dir *finddir = NULL; + struct ntfs_dt *del = NULL; + INDEX_ENTRY *ie = NULL; + MFT_REF mft_num; + ntfschar *uname = NULL; + int len; + int index_num = 0; + + dir = ntfs_dir_alloc (vol, FILE_root); + if (!dir) + return 1; + + mft_num = utils_pathname_to_mftref (vol, dir, name, &finddir); + //printf ("mft_num = %lld\n", mft_num); + //ntfs_dir_print (finddir, 0); + + if (!finddir) { + printf ("Couldn't find the index entry for %s\n", name); + return 1; + } + + if (rindex (name, PATH_SEP)) + name = rindex (name, PATH_SEP) + 1; + + len = ntfs_mbstoucs (name, &uname, 0); + if (len < 0) + return 1; + + del = ntfs_dt_find2 (finddir->index, uname, len, &index_num); + if (!del) { + printf ("can't find item to delete\n"); + goto done; + } + + ie = ntfs_ie_copy (del->children[index_num]); + if (!ie) + goto done; + + free (uname); + uname = NULL; + + len = ntfs_mbstoucs ("file26a", &uname, 0); + if (len < 0) + goto done; + + ie = ntfs_ie_set_name (ie, uname, len, FILE_NAME_WIN32); + if (!ie) + goto done; + + utils_dump_mem ((u8*)ie, 0, ie->length, 1); + printf ("\n"); + //printf ("ie = %lld\n", MREF (ie->indexed_file)); + //ntfs_dt_del_child (finddir->index, uname, len); + + //ntfs_dt_print (finddir->index, 0); + ntfs_dt_add (finddir->index, ie); + +done: + ntfs_dir_free (dir); + free (uname); + free (ie); + return 0; +} + + /** * main - Begin here * @@ -1988,6 +2218,7 @@ int main (int argc, char *argv[]) if (0) result = ntfs_index_dump (inode); if (0) result = ntfsrm (vol, opts.file); if (0) result = ntfs_ie_test(); + if (1) result = ntfsadd (vol, opts.file); done: ntfs_inode_close (inode); From 34ec6052e22dec2d85a169818971fbd3bfca47c0 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 20 Jun 2004 23:15:53 +0000 Subject: [PATCH 1526/2994] add an index entry to an index BKrev: 40d61aa9U92h3kKVzRTIXS4Euy3XlQ From 66c60d96598b9b0f2b2bf8c4dfbd5a293fb35f0f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 21 Jun 2004 09:51:07 +0000 Subject: [PATCH 1527/2994] Fix Yura's fix. (Logical change 1.430) --- libntfs/runlist.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 8cadc325..0e6b2c75 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1033,10 +1033,9 @@ s64 ntfs_rl_pread(const ntfs_volume *vol, const runlist_element *rl, if (!count) return count; /* Seek in @rl to the run containing @pos. */ - for (ofs = 0; rl->length && - (ofs + rl->length << vol->cluster_size_bits <= pos); rl++) { + for (ofs = 0; rl->length && (ofs + (rl->length << + vol->cluster_size_bits) <= pos); rl++) ofs += rl->length * vol->cluster_size; - } /* Offset in the run at which to begin reading. */ ofs = pos - ofs; for (total = 0LL; count; rl++, ofs = 0) { @@ -1118,10 +1117,9 @@ s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, if (!count) return count; /* Seek in @rl to the run containing @pos. */ - for (ofs = 0; rl->length && - (ofs + rl->length << vol->cluster_size_bits <= pos); rl++) { + for (ofs = 0; rl->length && (ofs + (rl->length << + vol->cluster_size_bits) <= pos); rl++) ofs += rl->length * vol->cluster_size; - } /* Offset in the run at which to begin writing. */ ofs = pos - ofs; for (total = 0LL; count; rl++, ofs = 0) { From fe45c2b8348239dabde8ff86802dc53f2edeb53f Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 21 Jun 2004 09:51:07 +0000 Subject: [PATCH 1528/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/06/21 10:21:16+01:00 cantab.net!aia21 Fix Yura's fix to libntfs/runlist.c::ntfs_rl_p{read,write}(). (Anton) BKrev: 40d6af8bM0FSGat4Xl-6TA59eMSM5A From 546750a4f513fff3e9d3be3ec281a050849b02e1 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 21 Jun 2004 19:00:00 +0000 Subject: [PATCH 1529/2994] add an index entry to an index root (Logical change 1.431) --- ntfsprogs/ntfsrm.c | 108 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 99 insertions(+), 9 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 2100060a..a1486a18 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1172,6 +1172,36 @@ done: return res; } +/** + * ntfs_mft_free_space + */ +static int ntfs_mft_free_space (struct ntfs_dir *dir) +{ + u8 *buffer = NULL; + ntfs_volume *vol; + int res = 0; + MFT_RECORD *mft; + + if (!dir) + return -1; + + buffer = malloc (512); + if (!buffer) + return -1; + + vol = dir->vol; + + if (ntfs_attr_pread (vol->mft_na, dir->mft_num << vol->mft_record_size_bits, 512, buffer) != 512) + goto done; + + mft = (MFT_RECORD*) buffer; + + res = mft->bytes_allocated - mft->bytes_in_use; +done: + free (buffer); + return res; +} + /** * ntfs_dt_add_alloc @@ -1194,7 +1224,7 @@ static int ntfs_dt_add_alloc (struct ntfs_dt *parent, int index_num, INDEX_ENTRY space = parent->data_len - block->index.index_length - 24; printf ("need %d, have %d\n", need, space); - if (ie->length > space) { + if (need > space) { printf ("no room"); return 0; } @@ -1234,8 +1264,68 @@ static int ntfs_dt_add_alloc (struct ntfs_dt *parent, int index_num, INDEX_ENTRY /** * ntfs_dt_add_root */ -static int ntfs_dt_add_root (struct ntfs_dt *parent, struct ntfs_dt *child) +static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie) { + INDEX_ROOT *root; + int need; + int space; + u8 *attr; + u8 *src; + u8 *dst; + int len; + + if (!parent || !ie) + return 0; + + root = (INDEX_ROOT*) parent->data; + + printf (""); + utils_dump_mem (parent->data, 0, parent->data_len, 1); + printf ("\n"); + + need = ie->length; + space = ntfs_mft_free_space (parent->dir); + + printf ("need %d, have %d\n", need, space); + if (need > space) { + printf ("no room"); + return 0; + } + + attr = malloc (parent->data_len + need); + + src = parent->data; + dst = attr; + len = root->index.entries_offset + 16; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) ie; + len = ie->length; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) parent->children[index_num]; + len = parent->data + parent->data_len - src; + + memcpy (dst, src, len); + + free (parent->data); + parent->data = attr; + parent->data_len += need; + + root = (INDEX_ROOT*) parent->data; + root->index.index_length = parent->data_len - 16; + root->index.allocated_size = parent->data_len - 16; + + printf (""); + utils_dump_mem (parent->data, 0, parent->data_len, 1); + printf ("\n"); + + ntfs_mft_resize_resident (parent->dir->inode, AT_INDEX_ROOT, I30, 4, parent->data, parent->data_len); + return 0; } @@ -1259,12 +1349,12 @@ static int ntfs_dt_add (struct ntfs_dt *parent, INDEX_ENTRY *ie) //printf ("dt = %p, index = %d\n", dt, index_num); //ntfs_ie_dump (dt->children[index_num]); - utils_dump_mem ((u8*)dt->children[index_num], 0, dt->children[index_num]->length, 1); - printf ("\n"); + //utils_dump_mem ((u8*)dt->children[index_num], 0, dt->children[index_num]->length, 1); + //printf ("\n"); - ntfs_dt_add_alloc (dt, index_num, ie); + if (0) ntfs_dt_add_alloc (dt, index_num, ie); + if (0) ntfs_dt_add_root (dt->dir->index, 0, ie); - if (0) ntfs_dt_add_root (parent, NULL); return 0; } @@ -1944,7 +2034,7 @@ static int ntfs_ie_test (void) int namelen = 0; ntfschar *name = NULL; - printf ("\n\n\n\n\n\n----------------------------------------------------------------------------------\n\n"); + printf ("\n\n\n\n\n\n"); if (1) { ie1 = ntfs_ie_create(); //ntfs_ie_dump (ie1); @@ -2156,8 +2246,8 @@ static int ntfsadd (ntfs_volume *vol, char *name) if (!ie) goto done; - utils_dump_mem ((u8*)ie, 0, ie->length, 1); - printf ("\n"); + //utils_dump_mem ((u8*)ie, 0, ie->length, 1); + //printf ("\n"); //printf ("ie = %lld\n", MREF (ie->indexed_file)); //ntfs_dt_del_child (finddir->index, uname, len); From 6e698185ad6f33feeafd5aa283769c746c4116c6 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 21 Jun 2004 19:00:00 +0000 Subject: [PATCH 1530/2994] add an index entry to an index root BKrev: 40d730302ZpzTo7rSo0tbXrtmq8zjg From 4764e7ad657fb01d1cff2ee1bad618a113805e1f Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 21 Jun 2004 22:43:07 +0000 Subject: [PATCH 1531/2994] start manipulating keys on delete (Logical change 1.432) --- ntfsprogs/ntfsrm.c | 248 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 201 insertions(+), 47 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index a1486a18..86781b6c 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -197,6 +197,7 @@ static int parse_options (int argc, char **argv) struct ntfs_dir; static void ntfs_ie_dump (INDEX_ENTRY *ie); +static VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie); static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype); /** @@ -322,7 +323,7 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt) { u8 *buffer = NULL; u8 *ptr = NULL; - VCN *vcn = NULL; + VCN vcn; s64 size = 0; char *name = NULL; @@ -354,8 +355,8 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt) dt->children = ntfs_dt_alloc_children (dt->children, dt->child_count); if (entry->flags & INDEX_ENTRY_NODE) { - vcn = (VCN *) (ptr + ((entry->key_length + 0x17) & ~7)); - //printf ("VCN %lld\n", *vcn); + vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); + //printf ("VCN %lld\n", vcn); } if (!(entry->flags & INDEX_ENTRY_END)) { @@ -387,7 +388,7 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) { u8 *buffer = NULL; u8 *ptr = NULL; - VCN *vcn = NULL; + VCN vcn; s64 size = 0; char *name = NULL; @@ -416,8 +417,8 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) dt->children = ntfs_dt_alloc_children (dt->children, dt->child_count); if (entry->flags & INDEX_ENTRY_NODE) { - vcn = (VCN *) (ptr + ((entry->key_length + 0x17) & ~7)); - //printf ("\tVCN %lld\n", *vcn); + vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); + //printf ("\tVCN %lld\n", vcn); } dt->children[dt->child_count-1] = entry; @@ -608,7 +609,7 @@ static MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) //printf ("map & recurse\n"); //printf ("sub %p\n", dt->sub_nodes); if (!dt->sub_nodes[i]) { - vcn = *(VCN*)(((u8*)ie) + ie->length - sizeof (VCN)); + vcn = ntfs_ie_get_vcn (ie); //printf ("vcn = %lld\n", vcn); sub = ntfs_dt_alloc (dt->dir, dt, vcn); dt->sub_nodes[i] = sub; @@ -673,7 +674,7 @@ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int n continue; } else if (r == 0) { res = dt; - //printf ("match %lld\n", res); + //printf ("match %p\n", res); if (index_num) *index_num = i; } else if (r == -1) { @@ -746,6 +747,72 @@ static struct ntfs_dt * ntfs_dt_find3 (struct ntfs_dt *dt, ntfschar *name, int n return res; } +/** + * ntfs_dt_find4 + * find successor + */ +static struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) +{ + struct ntfs_dt *res = NULL; + struct ntfs_dt *sub = NULL; + INDEX_ENTRY *ie; + VCN vcn; + int i; + int r; + + if (!dt || !name) + return NULL; + + //printf ("child_count = %d\n", dt->child_count); + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + if (ie->flags & INDEX_ENTRY_END) { + r = -1; + } else { + //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); + r = ntfs_names_collate (name, name_len, + ie->key.file_name.file_name, + ie->key.file_name.file_name_length, + 2, IGNORE_CASE, + dt->dir->vol->upcase, + dt->dir->vol->upcase_len); + } + + //printf ("%d, %d\n", i, r); + + if (r == 1) { + //printf ("keep searching\n"); + } else if (r == 0) { + //res = dt; + //printf ("match\n"); + // ignore + } else if (r == -1) { + if (ie->flags & INDEX_ENTRY_NODE) { + //printf ("recurse\n"); + if (!dt->sub_nodes[i]) { + vcn = ntfs_ie_get_vcn (ie); + //printf ("vcn = %lld\n", vcn); + sub = ntfs_dt_alloc (dt->dir, dt, vcn); + dt->sub_nodes[i] = sub; + } + res = ntfs_dt_find4 (dt->sub_nodes[i], name, name_len, index_num); + } else { + //printf ("no match\n"); + res = dt; + if (index_num) + *index_num = i; + } + break; + } else { + printf ("error collating name\n"); + } + //break; + } + + return res; +} + /** * ntfs_dir_alloc @@ -1125,7 +1192,7 @@ static int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfscha arec = ctx->attr; if (arec->non_resident) { - printf ("attributes isn't resident\n"); + printf ("attribute isn't resident\n"); goto done; } @@ -1177,28 +1244,16 @@ done: */ static int ntfs_mft_free_space (struct ntfs_dir *dir) { - u8 *buffer = NULL; - ntfs_volume *vol; int res = 0; MFT_RECORD *mft; - if (!dir) + if ((!dir) || (!dir->inode)) return -1; - buffer = malloc (512); - if (!buffer) - return -1; - - vol = dir->vol; - - if (ntfs_attr_pread (vol->mft_na, dir->mft_num << vol->mft_record_size_bits, 512, buffer) != 512) - goto done; - - mft = (MFT_RECORD*) buffer; + mft = (MFT_RECORD*) dir->inode->mrec; res = mft->bytes_allocated - mft->bytes_in_use; -done: - free (buffer); + return res; } @@ -1726,7 +1781,6 @@ close: return res; } - /** * ntfsrm */ @@ -1843,8 +1897,7 @@ static void ntfs_ie_dump (INDEX_ENTRY *ie) } } if (ie->flags == INDEX_ENTRY_NODE) { - VCN *vcn = (VCN*) ((u8*) ie + ie->length - 8); - printf ("child vcn = %lld\n", *vcn); + printf ("child vcn = %lld\n", ntfs_ie_get_vcn (ie)); } } @@ -1888,27 +1941,24 @@ static INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie) } /** - * ntfs_ie_set_child + * ntfs_ie_set_vcn */ -static INDEX_ENTRY * ntfs_ie_set_child (INDEX_ENTRY *ie, VCN vcn) +static INDEX_ENTRY * ntfs_ie_set_vcn (INDEX_ENTRY *ie, VCN vcn) { if (!ie) return 0; - if (ie->flags & INDEX_ENTRY_NODE) { - *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; - return ie; + if (!(ie->flags & INDEX_ENTRY_NODE)) { + ie->length += 8; + ie = realloc (ie, ie->length); + if (!ie) + return NULL; + + ie->flags |= INDEX_ENTRY_NODE; } - ie->length += 8; - ie = realloc (ie, ie->length); - if (!ie) - return NULL; - - ie->flags |= INDEX_ENTRY_NODE; *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; - - return 0; + return ie; } /** @@ -1976,7 +2026,7 @@ static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int name //printf ("need = %d\n", need); if (ie->flags & INDEX_ENTRY_NODE) - vcn = *((VCN*) ((u8*) ie + ie->length - 8)); + vcn = ntfs_ie_get_vcn (ie); ie->length = 16 + need; ie->key_length = sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar)); @@ -1987,7 +2037,7 @@ static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int name memcpy (ie->key.file_name.file_name, name, namelen * 2); if (ie->flags & INDEX_ENTRY_NODE) - *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; + ie = ntfs_ie_set_vcn (ie, vcn); ie->key.file_name.file_name_length = namelen; ie->key.file_name.file_name_type = nametype; @@ -2009,7 +2059,7 @@ static INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) return ie; if (ie->flags & INDEX_ENTRY_NODE) - vcn = *((VCN*) ((u8*) ie + ie->length - 8)); + vcn = ntfs_ie_get_vcn (ie); ie->length -= ATTR_SIZE (ie->key_length); ie->key_length = 0; @@ -2020,7 +2070,7 @@ static INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) return NULL; if (ie->flags & INDEX_ENTRY_NODE) - *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; + ie = ntfs_ie_set_vcn (ie, vcn); return ie; } @@ -2067,12 +2117,12 @@ static int ntfs_ie_test (void) } if (1) { - ntfs_ie_set_child (ie1, 1234); + ie1 = ntfs_ie_set_vcn (ie1, 1234); ntfs_ie_dump (ie1); } if (1) { - ntfs_ie_remove_child (ie1); + ie1 = ntfs_ie_remove_child (ie1); ntfs_ie_dump (ie1); } @@ -2092,6 +2142,17 @@ static int ntfs_ie_test (void) return 0; } +/** + * ntfs_ie_get_vcn + */ +static VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie) +{ + if (!ie) + return -1; + + return *((VCN*) ((u8*) ie + ie->length - 8)); +} + /** * ntfs_index_dump_alloc @@ -2261,6 +2322,98 @@ done: return 0; } +/** + * ntfsrm2 + */ +static int ntfsrm2 (ntfs_volume *vol, char *name) +{ + struct ntfs_dir *root_dir = NULL; + struct ntfs_dir *find_dir = NULL; + struct ntfs_dt *del = NULL; + struct ntfs_dt *suc = NULL; + MFT_REF mft_num; + ntfschar *uname = NULL; + int del_num = 0; + int suc_num = 0; + int len; + VCN vcn; + INDEX_ENTRY *del_ie = NULL; + INDEX_ENTRY *suc_ie = NULL; + + root_dir = ntfs_dir_alloc (vol, FILE_root); + if (!root_dir) + return 1; + + mft_num = utils_pathname_to_mftref (vol, root_dir, name, &find_dir); + + if (!find_dir) { + printf ("Couldn't find the index entry for %s\n", name); + goto done; + } + + if (rindex (name, PATH_SEP)) + name = rindex (name, PATH_SEP) + 1; + + len = ntfs_mbstoucs (name, &uname, 0); + if (len < 0) + goto done; + + del = ntfs_dt_find2 (find_dir->index, uname, len, &del_num); + if (!del) { + printf ("can't find item to delete\n"); + goto done; + } + + del_ie = del->children[del_num]; + utils_dump_mem ((u8*)del_ie, 0, del_ie->length, 1); + printf ("\n"); + + if (del->header->flags & INDEX_NODE) { + printf ("node\n"); + + vcn = ntfs_ie_get_vcn (del_ie); + //printf ("vcn = %lld\n", vcn); + + suc = ntfs_dt_find4 (find_dir->index, uname, len, &suc_num); + //printf ("succ = %p, index = %d\n", suc, suc_num); + printf ("\n"); + + suc_ie = ntfs_ie_copy ((INDEX_ENTRY*) suc->children[suc_num]); + //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, 1); + //printf ("\n"); + + suc_ie = ntfs_ie_set_vcn (suc_ie, vcn); + utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, 1); + printf ("\n"); + + if (del_ie->length != suc_ie->length) { + printf ("realloc!\n"); + return -1; + } + + memcpy (del->children[del_num], suc_ie, suc_ie->length); + + ntfs_mft_resize_resident (find_dir->inode, AT_INDEX_ROOT, I30, 4, (u8*)del->data, del->data_len); + //utils_dump_mem ((u8*)find_dir->inode->mrec, 0, 1024, 1); + + //commit + + // Continue delete with the original successor + del = suc; + del_num = suc_num; + } + + //remove key + + //if (!empty) + // done + +done: + ntfs_dir_free (root_dir); + free (uname); + return 0; +} + /** * main - Begin here @@ -2308,7 +2461,8 @@ int main (int argc, char *argv[]) if (0) result = ntfs_index_dump (inode); if (0) result = ntfsrm (vol, opts.file); if (0) result = ntfs_ie_test(); - if (1) result = ntfsadd (vol, opts.file); + if (0) result = ntfsadd (vol, opts.file); + if (1) result = ntfsrm2 (vol, opts.file); done: ntfs_inode_close (inode); From efbd356702e8da4c3413ea967d1dae95aea63dea Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 21 Jun 2004 22:43:07 +0000 Subject: [PATCH 1532/2994] start manipulating keys on delete BKrev: 40d7647buGMrRiPGeRhMTKSTfykRtQ From 09bb4cf775a0e942ecaa39d621842656ba187390 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 21 Jun 2004 22:44:47 +0000 Subject: [PATCH 1533/2994] Added ntfsprogs/ntfsinfo.c~ to the ignore list (Logical change 1.433) --- BitKeeper/etc/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 9331d037..e5633e19 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -47,3 +47,4 @@ ntfsprogs/ntfswipe stamp-h stamp-h1 tags +ntfsprogs/ntfsinfo.c~ From c6f44798eb6ae01ea0c7ec60eff4e7b0b8529eee Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 21 Jun 2004 22:44:47 +0000 Subject: [PATCH 1534/2994] Free runlist after use (Logical change 1.433) --- ntfsprogs/ntfsinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 8d201cb1..09e0e87a 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -683,6 +683,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v free(sec_desc_attr); return; } + free (rl); } else { Eprintf("ntfsinfo error: could not decompress runlist\n"); return; From 0819e9f0737f48de97dd5344e4c06893276c1182 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 21 Jun 2004 22:44:47 +0000 Subject: [PATCH 1535/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/06/21 21:04:44+03:00 (none)!yura Fixed small memleak BKrev: 40d764dfmqMOFKvlL0l--W0PwqYbAQ From e1ed723ee54e16386c993065d0ebb3a9ca62bbd1 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 21 Jun 2004 23:09:35 +0000 Subject: [PATCH 1536/2994] Merge flatcap.org:/home/flatcap/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/06/22 00:08:36+01:00 flatcap.org!ntfs tidy up ignore file BKrev: 40d76aafmOYduSUD_uUNJMZ5HvI6mw From d0c18bfb7df1e13de27af194c28ca409a0b6c03b Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 21 Jun 2004 23:09:35 +0000 Subject: [PATCH 1537/2994] restore the grouping. ignore temporary files (*~) wherever they are. (Logical change 1.434) --- BitKeeper/etc/ignore | 50 +++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index e5633e19..71a53422 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -1,33 +1,44 @@ - # Bitkeeper -# configure -# general build products -# specific programs -*/*.o -*/.*swp -*/.deps/* -*/.libs/* -*/Makefile -*/TAGS -*/tags -.*swp BitKeeper/*/* -Makefile PENDING/* -TAGS + +# configure autom4te.cache/* config.cache config.h config.h.in~ config.log config.status +libtool +Makefile +*/Makefile +ntfsprogs/*.8 +stamp-h +stamp-h1 + +# general build products +*/.deps/* libntfs/*.8 libntfs/*.l? libntfs/libntfs.conf -libtool -ntfsprogs-*.tar.gz +*/.libs/* +*/*.o +tags +*/tags +TAGS +*/TAGS + +# other +*~ +*/*~ +*/*/~ +.*swp +*/.*swp +*/*/.*swp ntfsprogs.spec -ntfsprogs/*.8 +ntfsprogs-*.tar.gz + +# specific programs ntfsprogs/dumplog ntfsprogs/mkntfs ntfsprogs/ntfscat @@ -44,7 +55,4 @@ ntfsprogs/ntfsrm ntfsprogs/ntfstruncate ntfsprogs/ntfsundelete ntfsprogs/ntfswipe -stamp-h -stamp-h1 -tags -ntfsprogs/ntfsinfo.c~ + From ff0334f3c55cef58b817d4461c69a42799ce8a2b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 22 Jun 2004 17:55:38 +0000 Subject: [PATCH 1538/2994] Output runlist for DATA attribute in verbose mode (Logical change 1.435) --- ntfsprogs/ntfsinfo.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 09e0e87a..b99d5e6b 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -818,7 +818,7 @@ static void ntfs_dump_attr_volume_information(ATTR_RECORD *attr) * * dump some info about the data attribute */ -static void ntfs_dump_attr_data(ATTR_RECORD *attr) +static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol) { printf("Dumping attribute $DATA (0x80) related info\n"); @@ -861,6 +861,23 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr) } else { printf("\tNot Compressed\n"); } + + if (opts.verbose) { + runlist *rl = ntfs_mapping_pairs_decompress(vol, attr, 0); + if (rl) { + printf ("\tRunlist:\tVCN\t\tLCN\t\tLength\n"); + runlist *rlc = rl; + while (rlc->length) { + printf ("\t\t\t%lld\t\t%lld\t\t%lld\n", + rlc->vcn, rlc->lcn, rlc->length); + rlc++; + } + free (rl); + } else { + Eprintf("ntfsinfo error: could not decompress runlist\n"); + return; + } + } } else { printf("\tIs resident? \t\t Yes\n"); printf("\tData size:\t\t %u\n", @@ -1276,7 +1293,7 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) ntfs_dump_attr_volume_information(ctx->attr); break; case AT_DATA: - ntfs_dump_attr_data(ctx->attr); + ntfs_dump_attr_data(ctx->attr, inode->vol); break; case AT_INDEX_ROOT: ntfs_dump_attr_index_root(ctx->attr); From d09e6a7f4aba650d7622c886f1cef52b8f9151e7 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 22 Jun 2004 17:55:38 +0000 Subject: [PATCH 1539/2994] wipe_tails implementation for compressed, encrypted and sparce files. (Logical change 1.435) --- ntfsprogs/ntfswipe.c | 165 +++++++++++++++++++++++++++++++------------ 1 file changed, 121 insertions(+), 44 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 90fc8d36..f3963745 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -410,6 +410,7 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) s64 total = 0; s64 size; s64 inode_num; + u64 offset; ntfs_attr_search_ctx *ctx; ntfs_inode *ni; unsigned char *buf; @@ -439,58 +440,134 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) goto put_search_ctx; } attr = ctx->attr; - + if (!attr->non_resident) { Vprintf ("Resident $DATA atrributes. Skipping.\n"); goto put_search_ctx; } - - if (attr->flags & - (ATTR_IS_SPARSE | ATTR_IS_ENCRYPTED | ATTR_IS_COMPRESSED)) { - Vprintf ("Sparse, encrypted and compressed are not " - "supported.\n"); - goto put_search_ctx; - } - - size = attr->allocated_size - attr->data_size; - if (!size) { - Vprintf ("Nothing to wipe\n"); - goto put_search_ctx; - } - - if (act == act_info) { - total += size; - Vprintf ("Can wipe %lld bytes\n", size); - goto put_search_ctx; - } - - buf = malloc (size); - if (!buf) { - Vprintf ("Not enough memory\n"); - Eprintf ("Not enough memory to allocate %lld bytes\n", size); - goto put_search_ctx; - } - memset (buf, byte, size); - - rl = ntfs_mapping_pairs_decompress(vol, attr, 0); - if (!rl) { - Vprintf ("Internal error\n"); - Eprintf ("Could not decompress mapping pairs\n"); - goto free_buf; - } - s64 bw = ntfs_rl_pwrite (vol, rl, attr->data_size, size, buf); - if (bw == -1) { - Vprintf ("Internal error\n"); - Eprintf ("Couldn't wipe tail of inode %lld\n", inode_num); + if (attr->flags & ATTR_IS_COMPRESSED) { + rl = ntfs_mapping_pairs_decompress(vol, attr, 0); + if (!rl) { + Vprintf ("Internal error\n"); + Eprintf ("Could not decompress mapping pairs\n"); + goto put_search_ctx; + } + + u16 block_size; + u64 wiped = 0; + s64 ret; + runlist *rlc = rl; + while (rlc->length) { + if ((rlc->length >> attr->compression_unit) || + (rlc->lcn == -1)) { + rlc++; + continue; + } + + offset = 0; + while (1) { + ret = ntfs_rl_pread (vol, rlc, offset, 2, + &block_size); + if (ret != 2) { + Vprintf ("Internal error\n"); + Eprintf ("ntfs_rl_pread failed\n"); + goto free_rl; + } + if (block_size == 0) { + offset += 2; + break; + } + block_size &= 0x0FFF; + block_size += 3; + offset += block_size; + if (offset >= + (rlc->length << vol->cluster_size_bits)) + goto next; + } + size = (rlc->length << vol->cluster_size_bits) - offset; + + if ((act == act_info) || (!size)) { + wiped += size; + rlc++; + continue; + } + + buf = malloc (size); + if (!buf) { + Vprintf ("Not enough memory\n"); + Eprintf ("Not enough memory to allocate " + "%lld bytes\n", size); + goto free_rl; + } + memset (buf, byte, size); + + ret = ntfs_rl_pwrite (vol, rlc, offset, size, buf); + if (ret != size) { + Vprintf ("Internal error\n"); + Eprintf ("ntfs_rl_pwrite failed\n"); + free (buf); + goto free_rl; + } + free (buf); + wiped += ret; +next: + rlc++; + } + if (wiped) + Vprintf ("Wiped %lld bytes\n", wiped); + else + Vprintf ("Nothing to wipe\n"); + total += wiped; +free_rl: + free (rl); } else { - Vprintf ("Wiped %lld bytes\n", bw); - total += bw; - } + offset = attr->data_size; + if (attr->flags & ATTR_IS_ENCRYPTED) + offset = (((offset - 1) >> 10) + 1) << 10; - free (rl); + size = (vol->cluster_size - offset) % vol->cluster_size; + + if (!size) { + Vprintf ("Nothing to wipe\n"); + goto put_search_ctx; + } + + if (act == act_info) { + total += size; + Vprintf ("Can wipe %lld bytes\n", size); + goto put_search_ctx; + } + + buf = malloc (size); + if (!buf) { + Vprintf ("Not enough memory\n"); + Eprintf ("Not enough memory to allocate %lld bytes\n", + size); + goto put_search_ctx; + } + memset (buf, byte, size); + + rl = ntfs_mapping_pairs_decompress(vol, attr, 0); + if (!rl) { + Vprintf ("Internal error\n"); + Eprintf ("Could not decompress mapping pairs\n"); + goto free_buf; + } + + s64 bw = ntfs_rl_pwrite (vol, rl, offset, size, buf); + if (bw == -1) { + Vprintf ("Internal error\n"); + Eprintf ("Couldn't wipe tail of inode %lld\n", inode_num); + } else { + Vprintf ("Wiped %lld bytes\n", bw); + total += bw; + } + + free (rl); free_buf: - free (buf); + free (buf); + } put_search_ctx: ntfs_attr_put_search_ctx (ctx); close_inode: From 9c8df3da557c78928c645d993bdbe53f2c0c8aa2 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 22 Jun 2004 17:55:38 +0000 Subject: [PATCH 1540/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/06/22 19:49:17+03:00 (none)!yura ntfswipe: wipe_tails implementation for compressed, encrypted and sparce files. ntfsinfo: Output runlist for DATA attribute in verbose mode BKrev: 40d8729a9cx9Vmle0BP4mUEGsAbWVg From a18ae8d3c447f63c7d183f82b30f13497717b2e1 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 22 Jun 2004 22:13:52 +0000 Subject: [PATCH 1541/2994] replace non-leaf node with its successor (Logical change 1.436) --- ntfsprogs/ntfsrm.c | 209 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 179 insertions(+), 30 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 86781b6c..8d6f37f8 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -307,6 +307,7 @@ static void ntfs_dt_print (struct ntfs_dt *dt, int indent) */ static INDEX_ENTRY ** ntfs_dt_alloc_children (INDEX_ENTRY **children, int count) { + // XXX calculate for 2K and 4K indexes max and min filenames (inc/exc VCN) int old = (count + 0x1e) & ~0x1f; int new = (count + 0x1f) & ~0x1f; @@ -556,6 +557,8 @@ static void ntfs_dt_free (struct ntfs_dt *dt) /** * ntfs_dt_find + * find dt by name, return MFT_REF + * maps dt's as necessary */ static MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) { @@ -629,6 +632,8 @@ static MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) /** * ntfs_dt_find2 + * find dt by name, returns dt and index + * maps dt's as necessary */ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) { @@ -691,6 +696,8 @@ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int n /** * ntfs_dt_find3 + * find dt by name, returns dt and index + * does not map new dt's */ static struct ntfs_dt * ntfs_dt_find3 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) { @@ -749,7 +756,8 @@ static struct ntfs_dt * ntfs_dt_find3 (struct ntfs_dt *dt, ntfschar *name, int n /** * ntfs_dt_find4 - * find successor + * find successor to specified name, returns dt and index + * maps dt's as necessary */ static struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) { @@ -1284,7 +1292,7 @@ static int ntfs_dt_add_alloc (struct ntfs_dt *parent, int index_num, INDEX_ENTRY return 0; } - //printf ("--------------------------------------------------------------------------------\n"); + //printf (""); //utils_dump_mem (parent->data, 0, parent->data_len, 1); //printf ("\n"); @@ -1310,7 +1318,7 @@ static int ntfs_dt_add_alloc (struct ntfs_dt *parent, int index_num, INDEX_ENTRY memset (dst, 0, len); - //printf ("--------------------------------------------------------------------------------\n"); + //printf (""); //utils_dump_mem (parent->data, 0, parent->data_len, 1); //printf ("\n"); return 0; @@ -2252,6 +2260,134 @@ static int ntfs_index_dump (ntfs_inode *inode) } +/** + * ntfs_dt_root_replace + */ +static int ntfs_dt_root_replace (struct ntfs_dt *dt, int dt_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) +{ + u8 *src; + u8 *dst; + u8 *attr; + int len; + int i; + + if (!dt || !del_ie || !suc_ie) + return FALSE; + + //utils_dump_mem (dt->data, 0, dt->data_len, 1); + //printf ("\n"); + + attr = malloc (dt->data_len + suc_ie->length - del_ie->length); + + dst = attr; + src = dt->data; + len = (u8*) del_ie - dt->data; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) suc_ie; + len = suc_ie->length; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) del_ie + del_ie->length; + len = dt->data_len + (dt->data - (u8*) del_ie) - del_ie->length; + + memcpy (dst, src, len); + + len = dt->data_len + suc_ie->length - del_ie->length; + free (dt->data); + dt->data = attr; + dt->data_len = len; + + ntfs_mft_resize_resident (dt->dir->inode, AT_INDEX_ROOT, I30, 4, dt->data, dt->data_len); + + //utils_dump_mem (attr, 0, dt->data_len, 1); + + //for (i = 0; i < dt->child_count; i++) + // printf ("Child %d %p\n", i, dt->children[i]); + //printf ("\n"); + + len = suc_ie->length - del_ie->length + 8; + //printf ("len = %d\n", len); + + for (i = dt_num+1; i < dt->child_count; i++) + dt->children[i] = (INDEX_ENTRY*) ((u8*) dt->children[i] + len); + + //for (i = 0; i < dt->child_count; i++) + // printf ("Child %d %p\n", i, dt->children[i]); + //printf ("\n"); + + //utils_dump_mem (dt->data, 0, dt->data_len, 1); + //printf ("\n"); + + printf ("Modified: inode %lld MFT_RECORD, attribute 0x90\n", dt->dir->inode->mft_no); + return TRUE; +} + +/** + * ntfs_dt_alloc_replace + */ +static BOOL ntfs_dt_alloc_replace (struct ntfs_dt *dt, int dt_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) +{ + u8 *src; + u8 *dst; + int len; + int i; + + if (!dt || !del_ie || !suc_ie) + return FALSE; + + //utils_dump_mem (dt->data, 0, dt->data_len, 1); + + src = (u8*) del_ie + del_ie->length; + dst = (u8*) del_ie + suc_ie->length; + len = dt->header->index_length + 24 + (dt->data - src); + //printf ("src = %d\n", src - dt->data); + //printf ("dst = %d\n", dst - dt->data); + //printf ("len = %d\n", len); + + if (src != dst) + memmove (dst, src, len); + + src = (u8*) suc_ie; + dst = (u8*) del_ie; + len = suc_ie->length; + + memcpy (dst, src, len); + + //utils_dump_mem (dt->data, 0, dt->data_len, 1); + + dt->header->index_length += suc_ie->length - del_ie->length; + + dst = dt->data + dt->header->index_length + 24; + len = dt->data_len - dt->header->index_length - 24; + + memset (dst, 0, len); + + //for (i = 0; i < dt->child_count; i++) + // printf ("Child %d %p\n", i, dt->children[i]); + //printf ("\n"); + + len = suc_ie->length - del_ie->length; + //printf ("len = %d\n", len); + + for (i = dt_num+1; i < dt->child_count; i++) + dt->children[i] = (INDEX_ENTRY*) ((u8*) dt->children[i] + len); + + //for (i = 0; i < dt->child_count; i++) + // printf ("Child %d %p\n", i, dt->children[i]); + //printf ("\n"); + + //utils_dump_mem (dt->data, 0, dt->data_len, 1); + + printf ("Modified: inode %lld, INDEX_ALLOCATION vcn %lld-%lld\n", dt->dir->inode->mft_no, dt->vcn, dt->vcn + 4); + return TRUE; +} + + /** * ntfsadd */ @@ -2333,12 +2469,13 @@ static int ntfsrm2 (ntfs_volume *vol, char *name) struct ntfs_dt *suc = NULL; MFT_REF mft_num; ntfschar *uname = NULL; + int name_len; int del_num = 0; int suc_num = 0; - int len; - VCN vcn; INDEX_ENTRY *del_ie = NULL; INDEX_ENTRY *suc_ie = NULL; + int res; + VCN vcn; root_dir = ntfs_dir_alloc (vol, FILE_root); if (!root_dir) @@ -2354,59 +2491,71 @@ static int ntfsrm2 (ntfs_volume *vol, char *name) if (rindex (name, PATH_SEP)) name = rindex (name, PATH_SEP) + 1; - len = ntfs_mbstoucs (name, &uname, 0); - if (len < 0) + name_len = ntfs_mbstoucs (name, &uname, 0); + if (name_len < 0) goto done; - del = ntfs_dt_find2 (find_dir->index, uname, len, &del_num); + del = ntfs_dt_find2 (find_dir->index, uname, name_len, &del_num); if (!del) { printf ("can't find item to delete\n"); goto done; } del_ie = del->children[del_num]; - utils_dump_mem ((u8*)del_ie, 0, del_ie->length, 1); - printf ("\n"); + //printf (""); + //utils_dump_mem ((u8*)del_ie, 0, del_ie->length, 1); + //printf ("\n"); + + /* + * If the key is not in a leaf node, then replace it with its successor. + * Continue the delete as if the successor had been deleted. + */ if (del->header->flags & INDEX_NODE) { - printf ("node\n"); - vcn = ntfs_ie_get_vcn (del_ie); //printf ("vcn = %lld\n", vcn); - suc = ntfs_dt_find4 (find_dir->index, uname, len, &suc_num); + suc = ntfs_dt_find4 (find_dir->index, uname, name_len, &suc_num); //printf ("succ = %p, index = %d\n", suc, suc_num); - printf ("\n"); + //printf ("\n"); suc_ie = ntfs_ie_copy ((INDEX_ENTRY*) suc->children[suc_num]); //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, 1); //printf ("\n"); suc_ie = ntfs_ie_set_vcn (suc_ie, vcn); - utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, 1); - printf ("\n"); + //printf (""); + //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, 1); + //printf ("\n"); - if (del_ie->length != suc_ie->length) { - printf ("realloc!\n"); - return -1; - } + if (del->parent) + res = ntfs_dt_alloc_replace (del, del_num, del_ie, suc_ie); + else + res = ntfs_dt_root_replace (del, del_num, del_ie, suc_ie); - memcpy (del->children[del_num], suc_ie, suc_ie->length); + free (suc_ie); - ntfs_mft_resize_resident (find_dir->inode, AT_INDEX_ROOT, I30, 4, (u8*)del->data, del->data_len); - //utils_dump_mem ((u8*)find_dir->inode->mrec, 0, 1024, 1); + if (res == FALSE) + goto done; - //commit - - // Continue delete with the original successor del = suc; - del_num = suc_num; + del_num = suc_num; // Continue delete with the successor } - //remove key + /* + * Now we have the simple case of deleting from a leaf node. + */ - //if (!empty) - // done + //XX ntfs_dt_remove_key (dt, index) root/alloc + + if (del->child_count > 1) // XXX ntfs_dt_empty (dt), ntfs_dt_full (dt, new) + goto commit; + + // find first non-empty parent + // find its successor + // unhook and add to successor's node + +commit: done: ntfs_dir_free (root_dir); From 46559d925e0440486be1c71aaa11814060d81257 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 22 Jun 2004 22:13:52 +0000 Subject: [PATCH 1542/2994] replace non-leaf node with its successor BKrev: 40d8af20IqGULXH7BuLi0TlIrXkS0w From be6c3651f6a82c74aeef32bdb8a8cc9785db188b Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Wed, 23 Jun 2004 14:18:45 +0000 Subject: [PATCH 1543/2994] make fsck related functions reusable: exit -> return conversations [ongoing] (Logical change 1.437) --- ntfsprogs/ntfsresize.c | 77 ++++++++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 9d6c58d5..6b1e8edb 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -164,12 +164,15 @@ s64 max_free_cluster_range = 0; #define NTFS_MAX_CLUSTER_SIZE (65536) -#define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) - GEN_PRINTF(Eprintf, stderr, NULL, FALSE) GEN_PRINTF(Vprintf, stdout, &opt.verbose, TRUE) GEN_PRINTF(Qprintf, stdout, NULL, FALSE) +static s64 rounded_up_division(s64 numer, s64 denom) +{ + return (numer + (denom - 1)) / denom; +} + /** * perr_printf * @@ -775,16 +778,27 @@ static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfsck_t *fsck) free(rl); } + +static ntfs_attr_search_ctx *attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) +{ + ntfs_attr_search_ctx *ret; + + if ((ret = ntfs_attr_get_search_ctx(ni, mrec)) == NULL) + perr_printf("ntfs_attr_get_search_ctx"); + + return ret; +} + /** * walk_attributes * * For a given MFT Record, iterate through all its attributes. Any non-resident * data runs will be marked in lcn_bitmap. */ -static void walk_attributes(ntfs_volume *vol, ntfsck_t *fsck) +static int walk_attributes(ntfs_volume *vol, ntfsck_t *fsck) { - if (!(fsck->ctx = ntfs_attr_get_search_ctx(fsck->ni, NULL))) - perr_exit("ntfs_get_attr_search_ctx"); + if (!(fsck->ctx = attr_get_search_ctx(fsck->ni, NULL))) + return -1; while (!ntfs_attrs_walk(fsck->ctx)) { if (fsck->ctx->attr->type == AT_END) @@ -793,6 +807,7 @@ static void walk_attributes(ntfs_volume *vol, ntfsck_t *fsck) } ntfs_attr_put_search_ctx(fsck->ctx); + return 0; } /** @@ -905,13 +920,23 @@ static void progress_update(struct progress_bar *p, u64 current) fflush(stdout); } +static int inode_close(ntfs_inode *ni) +{ + if (ntfs_inode_close(ni)) { + perr_printf("ntfs_inode_close for inode %llu", + (unsigned long long)ni->mft_no); + return -1; + } + return 0; +} + /** * walk_inodes * * Read each record in the MFT, skipping the unused ones, and build up a bitmap * from all the non-resident attributes. */ -static void build_allocation_bitmap(ntfs_volume *vol, ntfsck_t *fsck) +static int build_allocation_bitmap(ntfs_volume *vol, ntfsck_t *fsck) { s64 inode = 0; ntfs_inode *ni; @@ -934,18 +959,23 @@ static void build_allocation_bitmap(ntfs_volume *vol, ntfsck_t *fsck) MFT record not in use based on $MFT bitmap */ if (errno == EIO || errno == ENOENT) continue; - perr_exit("Reading inode %lld failed", inode); + perr_printf("Reading inode %lld failed", inode); + return -1; } if (ni->mrec->base_mft_record) goto close_inode; fsck->ni = ni; - walk_attributes(vol, fsck); + if (walk_attributes(vol, fsck) != 0) { + inode_close(ni); + return -1; + } close_inode: - if (ntfs_inode_close(ni)) - perr_exit("ntfs_inode_close for inode %lld", inode); + if (inode_close(ni) != 0) + return -1; } + return 0; } static void build_resize_constrains(ntfs_resize_t *resize) @@ -974,8 +1004,8 @@ static void build_resize_constrains(ntfs_resize_t *resize) static void resize_constrains_by_attributes(ntfs_resize_t *resize) { - if (!(resize->ctx = ntfs_attr_get_search_ctx(resize->ni, NULL))) - perr_exit("ntfs_get_attr_search_ctx"); + if (!(resize->ctx = attr_get_search_ctx(resize->ni, NULL))) + exit(1); while (!ntfs_attrs_walk(resize->ctx)) { if (resize->ctx->attr->type == AT_END) @@ -1008,8 +1038,8 @@ static void set_resize_constrains(ntfs_resize_t *resize) resize->ni = ni; resize_constrains_by_attributes(resize); close_inode: - if (ntfs_inode_close(ni)) - perr_exit("ntfs_inode_close for inode %lld", inode); + if (inode_close(ni) != 0) + exit(1); } } @@ -1498,8 +1528,8 @@ static void relocate_attribute(ntfs_resize_t *resize) static void relocate_attributes(ntfs_resize_t *resize) { - if (!(resize->ctx = ntfs_attr_get_search_ctx(NULL, resize->mrec))) - perr_exit("ntfs_get_attr_search_ctx"); + if (!(resize->ctx = attr_get_search_ctx(NULL, resize->mrec))) + exit(1); while (!ntfs_attrs_walk(resize->ctx)) { if (resize->ctx->attr->type == AT_END) @@ -1799,8 +1829,8 @@ static void lookup_data_attr(ntfs_volume *vol, if (NInoAttrList(ni)) perr_exit("Attribute list attribute not yet supported"); - if (!(*ctx = ntfs_attr_get_search_ctx(ni, NULL))) - perr_exit("ntfs_get_attr_search_ctx"); + if (!(*ctx = attr_get_search_ctx(ni, NULL))) + exit(1); if (str2unicode(aname, &ustr, &len) == -1) perr_exit("Unable to convert string to Unicode"); @@ -1858,15 +1888,16 @@ static void truncate_bitmap_file(ntfs_resize_t *resize) * All the bits are set to 0, except those representing the region beyond the * end of the disk. */ -static void setup_lcn_bitmap(struct bitmap *bm, s64 nr_clusters) +static int setup_lcn_bitmap(struct bitmap *bm, s64 nr_clusters) { /* Determine lcn bitmap byte size and allocate it. */ bm->size = nr_clusters_to_bitmap_byte_size(nr_clusters); if (!(bm->bm = (unsigned char *)calloc(1, bm->size))) - perr_exit("Failed to allocate internal buffer"); + return -1; bitmap_file_data_fixup(nr_clusters, bm); + return 0; } /** @@ -2146,8 +2177,10 @@ int main(int argc, char **argv) if (opt.show_progress) fsck.flags |= NTFSCK_PROGBAR; - setup_lcn_bitmap(&fsck.lcn_bitmap, vol->nr_clusters); - build_allocation_bitmap(vol, &fsck); + if (setup_lcn_bitmap(&fsck.lcn_bitmap, vol->nr_clusters) != 0) + perr_exit("Failed to setup allocation bitmap"); + if (build_allocation_bitmap(vol, &fsck) != 0) + exit(1); if (fsck.multi_ref) { err_printf("Filesystem check failed! Totally %d clusters " "referenced multiply times.\n", fsck.multi_ref); From da6b6d8a9a276e94c95b60c354bb51b2a4e846ee Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 23 Jun 2004 14:18:45 +0000 Subject: [PATCH 1544/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/06/23 02:42:46+03:00 elisa-laajakaista.fi!szaka ntfsresize: make fsck related functions reusable: exit -> return conversations [ongoing] BKrev: 40d99145HbPsmQ2qiAspzG--Xko39g From 0f0a8013fc5a10095a7f55a805d60744ba126f96 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 23 Jun 2004 23:20:53 +0000 Subject: [PATCH 1545/2994] wipe_tails: * Support of very fragmented files (runlist don't fit one mft record) * Code restructure * Minor bugfixes (Logical change 1.438) --- ntfsprogs/ntfswipe.c | 351 ++++++++++++++++++++++++++----------------- 1 file changed, 214 insertions(+), 137 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index f3963745..b8c8a141 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -394,180 +394,257 @@ free: return total; } +/** + * wipe_compressed_attribute - Wipe compressed $DATA attribute + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * @act: Wipe, test or info + * @attr: A vaild $DATA attribute record + * @compr_unit: Compression unit obtained from first $DATA attribute (because in other + * it 0) + * + * Return: >0 Success, the atrribute was wiped + * 0 Nothing to wipe + * -1 Error, something went wrong + */ +static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, enum action act, + ATTR_RECORD *attr, u8 compr_unit) +{ + runlist *rl; + unsigned char *buf; + s64 size; + u64 offset; + u16 block_size; + u64 wiped = 0; + s64 ret; + runlist *rlc; + + if (compr_unit != 4) + Eprintf ("strange: compression unit is %u (not 4)\n", compr_unit); + + if (!compr_unit) { + Vprintf ("Internal error\n"); + Eprintf ("Compression unit could not be 0"); + return -1; + } + + rl = ntfs_mapping_pairs_decompress(vol, attr, 0); + if (!rl) { + Vprintf ("Internal error\n"); + Eprintf ("Could not decompress mapping pairs inode"); + return -1; + } + + rlc = rl; + while (rlc->length) { + if ((rlc->length >> compr_unit) || (rlc->lcn < 0)) { + rlc++; + continue; + } + + offset = 0; + while (1) { + ret = ntfs_rl_pread (vol, rlc, offset, 2, &block_size); + if (ret != 2) { + Vprintf ("Internal error\n"); + Eprintf ("ntfs_rl_pread failed"); + wiped = -1; + goto free_rl; + } + if (block_size == 0) { + offset += 2; + break; + } + block_size &= 0x0FFF; + block_size += 3; + offset += block_size; + if (offset >= (rlc->length << vol->cluster_size_bits) - 2) + goto next; + } + size = (rlc->length << vol->cluster_size_bits) - offset; + + if ((act == act_info) || (!size)) { + wiped += size; + rlc++; + continue; + } + + buf = malloc (size); + if (!buf) { + Vprintf ("Not enough memory\n"); + Eprintf ("Not enough memory to allocate %lld bytes", size); + wiped = -1; + goto free_rl; + } + memset (buf, byte, size); + + ret = ntfs_rl_pwrite (vol, rlc, offset, size, buf); + if (ret != size) { + Vprintf ("Internal error\n"); + Eprintf ("ntfs_rl_pwrite failed"); + free (buf); + wiped = -1; + goto free_rl; + } + free (buf); + wiped += ret; +next: + rlc++; + } +free_rl: + free (rl); + return wiped; +} + +/** + * wipe_attribute - Wipe not compressed $DATA attribute + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * @attr: A vaild $DATA attribute record + * @size: How many bytes to wipe + * @offset: Offset where start wiping + * + * Return: >0 Success, the atrribute was wiped + * -1 Error, something went wrong + */ +static s64 wipe_attribute (ntfs_volume *vol, int byte, ATTR_RECORD *attr, + s64 size, u64 offset) +{ + runlist *rl; + unsigned char *buf; + s64 wiped; + + buf = malloc (size); + if (!buf) { + Vprintf ("Not enough memory\n"); + Eprintf ("Not enough memory to allocate %lld bytes", size); + return -1; + } + memset (buf, byte, size); + + rl = ntfs_mapping_pairs_decompress(vol, attr, 0); + if (!rl) { + Vprintf ("Internal error\n"); + Eprintf ("Could not decompress mapping pairs"); + wiped = -1; + goto free_buf; + } + + wiped = ntfs_rl_pwrite (vol, rl, offset, size, buf); + if (wiped == -1) { + Vprintf ("Internal error\n"); + Eprintf ("Couldn't wipe tail"); + } + + free (rl); +free_buf: + free (buf); + return wiped; +} + /** * wipe_tails - Wipe the file tails * @vol: An ntfs volume obtained from ntfs_mount * @byte: Overwrite with this value + * @act: Wipe, test or info * * Disk space is allocated in clusters. If a file isn't an exact multiple of * the cluster size, there is some slack space at the end. Wipe this space. * - * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong + * Return: >0 Success, the clusters were wiped + * 0 Nothing to wipe + * -1 Error, something went wrong */ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) { s64 total = 0; - s64 size; s64 inode_num; - u64 offset; ntfs_attr_search_ctx *ctx; ntfs_inode *ni; - unsigned char *buf; ATTR_RECORD *attr; - runlist *rl; - + if (!vol || (byte < 0)) return -1; - + for (inode_num = 16; inode_num < vol->nr_mft_records; inode_num++) { - Vprintf ("Inode %lli - ", inode_num); + Vprintf ("Inode %lld - ", inode_num); ni = ntfs_inode_open (vol, inode_num); if (!ni) { Vprintf ("Could not open inode\n"); continue; } + if (ni->mrec->base_mft_record) { + Vprintf ("Not base mft record. Skipping\n"); + goto close_inode; + } + ctx = ntfs_attr_get_search_ctx(ni, 0); if (!ctx) { Vprintf ("Internal error\n"); - Eprintf ("Could not get search context\n"); + Eprintf ("Could not get search context (inode %lld)\n",inode_num); goto close_inode; } - if (ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - Vprintf ("Could not open $DATA attribute\n"); - goto put_search_ctx; - } - attr = ctx->attr; - - if (!attr->non_resident) { - Vprintf ("Resident $DATA atrributes. Skipping.\n"); - goto put_search_ctx; - } - - if (attr->flags & ATTR_IS_COMPRESSED) { - rl = ntfs_mapping_pairs_decompress(vol, attr, 0); - if (!rl) { - Vprintf ("Internal error\n"); - Eprintf ("Could not decompress mapping pairs\n"); + u64 wiped_in_file = 0; + u8 compr_unit; + s64 size = -1; + u64 offset; + VCN last_vcn; + while (!ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + attr = ctx->attr; + + if (!attr->non_resident) { + Vprintf ("Resident $DATA atrribute. Skipping.\n"); goto put_search_ctx; } - - u16 block_size; - u64 wiped = 0; - s64 ret; - runlist *rlc = rl; - while (rlc->length) { - if ((rlc->length >> attr->compression_unit) || - (rlc->lcn == -1)) { - rlc++; - continue; - } - - offset = 0; - while (1) { - ret = ntfs_rl_pread (vol, rlc, offset, 2, - &block_size); - if (ret != 2) { - Vprintf ("Internal error\n"); - Eprintf ("ntfs_rl_pread failed\n"); - goto free_rl; - } - if (block_size == 0) { - offset += 2; - break; - } - block_size &= 0x0FFF; - block_size += 3; - offset += block_size; - if (offset >= - (rlc->length << vol->cluster_size_bits)) - goto next; - } - size = (rlc->length << vol->cluster_size_bits) - offset; - - if ((act == act_info) || (!size)) { - wiped += size; - rlc++; - continue; - } - - buf = malloc (size); - if (!buf) { - Vprintf ("Not enough memory\n"); - Eprintf ("Not enough memory to allocate " - "%lld bytes\n", size); - goto free_rl; - } - memset (buf, byte, size); - - ret = ntfs_rl_pwrite (vol, rlc, offset, size, buf); - if (ret != size) { - Vprintf ("Internal error\n"); - Eprintf ("ntfs_rl_pwrite failed\n"); - free (buf); - goto free_rl; - } - free (buf); - wiped += ret; -next: - rlc++; - } - if (wiped) - Vprintf ("Wiped %lld bytes\n", wiped); - else - Vprintf ("Nothing to wipe\n"); - total += wiped; -free_rl: - free (rl); - } else { - offset = attr->data_size; - if (attr->flags & ATTR_IS_ENCRYPTED) - offset = (((offset - 1) >> 10) + 1) << 10; - - size = (vol->cluster_size - offset) % vol->cluster_size; - - if (!size) { - Vprintf ("Nothing to wipe\n"); - goto put_search_ctx; - } - - if (act == act_info) { - total += size; - Vprintf ("Can wipe %lld bytes\n", size); - goto put_search_ctx; - } - - buf = malloc (size); - if (!buf) { - Vprintf ("Not enough memory\n"); - Eprintf ("Not enough memory to allocate %lld bytes\n", - size); - goto put_search_ctx; - } - memset (buf, byte, size); - - rl = ntfs_mapping_pairs_decompress(vol, attr, 0); - if (!rl) { - Vprintf ("Internal error\n"); - Eprintf ("Could not decompress mapping pairs\n"); - goto free_buf; - } - - s64 bw = ntfs_rl_pwrite (vol, rl, offset, size, buf); - if (bw == -1) { - Vprintf ("Internal error\n"); - Eprintf ("Couldn't wipe tail of inode %lld\n", inode_num); + + s64 wiped; + if (attr->flags & ATTR_IS_COMPRESSED) { + if (attr->compression_unit) + compr_unit = attr->compression_unit; + wiped = wipe_compressed_attribute (vol, byte, act, + attr, compr_unit); } else { - Vprintf ("Wiped %lld bytes\n", bw); - total += bw; + if (size == -1) { + offset = attr->data_size; + if (!offset) + break; + if (attr->flags & ATTR_IS_ENCRYPTED) + offset = (((offset - 1) >> 10) + 1) << 10; + size = (vol->cluster_size - offset) % + vol->cluster_size; + last_vcn = attr->data_size >> + vol->cluster_size_bits; + } + if (!size) { + wiped_in_file = 0; + break; + } + if (act == act_info) { + wiped_in_file = size; + break; + } + if (attr->highest_vcn == last_vcn) + wiped = wipe_attribute (vol, byte, attr, + size, offset); + else + continue; } - free (rl); -free_buf: - free (buf); + if (wiped != -1) + wiped_in_file += wiped; + else { + Eprintf (" (inode %lld)\n", inode_num); + goto put_search_ctx; + } } + + if (wiped_in_file) { + Vprintf ("Wiped %llu bytes\n", wiped_in_file); + total += wiped_in_file; + } else + Vprintf ("Nothing to wipe\n"); put_search_ctx: ntfs_attr_put_search_ctx (ctx); close_inode: From ac0ec2a817a16fa87e850b86ab6a460ae493e3c0 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 23 Jun 2004 23:20:53 +0000 Subject: [PATCH 1546/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/06/24 01:14:45+03:00 (none)!yura ntfswipe: improvments to the wipe_tails BKrev: 40da1055QaPciTfD8UaGoy9lNgSB4g From 9b00923dd53e45afb2a8bbc0f83ec4a47095b723 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 24 Jun 2004 13:08:28 +0000 Subject: [PATCH 1547/2994] cleaner versions of remove root/alloc (Logical change 1.439) --- ntfsprogs/ntfsrm.c | 470 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 365 insertions(+), 105 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 8d6f37f8..929bedd1 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -317,6 +317,25 @@ static INDEX_ENTRY ** ntfs_dt_alloc_children (INDEX_ENTRY **children, int count) return realloc (children, new * sizeof (INDEX_ENTRY*)); } +/** + * ntfs_dt_alloc_children2 + */ +static BOOL ntfs_dt_alloc_children2 (struct ntfs_dt *dt, int count) +{ + // XXX calculate for 2K and 4K indexes max and min filenames (inc/exc VCN) + + int old = (count + 0x1e) & ~0x1f; + int new = (count + 0x1f) & ~0x1f; + + if (old == new) + return TRUE; + + dt->children = realloc (dt->children, new * sizeof (*dt->children)); + dt->sub_nodes = realloc (dt->sub_nodes, new * sizeof (*dt->sub_nodes)); + + return (dt->children && dt->sub_nodes); +} + /** * ntfs_dt_count_root */ @@ -402,7 +421,7 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) buffer = dt->data; size = dt->data_len; - //utils_dump_mem (buffer, 0, 128, TRUE); + //utils_dump_mem (buffer, 0, 128, DM_DEFAULTS); block = (INDEX_BLOCK*) buffer; //printf ("INDX %lld\n", block->index_block_vcn); @@ -479,7 +498,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par dt->data = malloc (dt->data_len); //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data)); ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data); - //utils_dump_mem (dt->data, 0, dt->data_len, 1); + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); //printf ("\n"); ntfs_dt_count_alloc (dt); @@ -496,7 +515,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par printf ("IE (%d)\n", ie->length); else printf ("IE %lld (%d)\n", MREF (ie->key.file_name.parent_directory), ie->length); - utils_dump_mem ((u8*)ie, 0, ie->length, 1); + utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); } #endif @@ -509,7 +528,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par dt->data = malloc (dt->data_len); //printf ("%lld\n", ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data)); ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data); - //utils_dump_mem (dt->data, 0, dt->data_len, 1); + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); ntfs_dt_count_root (dt); @@ -526,7 +545,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par printf ("IE (%d)\n", ie->length); else printf ("IE %lld (%d)\n", MREF (ie->key.file_name.parent_directory), ie->length); - utils_dump_mem ((u8*)ie, 0, ie->length, 1); + utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); } #endif @@ -1065,9 +1084,9 @@ static int utils_mftrec_mark_free (ntfs_volume *vol, MFT_REF mref) return -1; } - //utils_dump_mem (buffer, byte, 1, 0); + //utils_dump_mem (buffer, byte, 1, DM_NO_ASCII); buffer[byte] &= ~bit; - //utils_dump_mem (buffer, byte, 1, 0); + //utils_dump_mem (buffer, byte, 1, DM_NO_ASCII); if (ntfs_attr_pwrite (vol->mftbmp_na, (bmpmref>>3), sizeof (buffer), buffer) < 0) { Eprintf ("Couldn't write $MFT/$BITMAP: %s\n", strerror (errno)); @@ -1103,7 +1122,7 @@ static int utils_mftrec_mark_free2 (ntfs_volume *vol, MFT_REF mref) rec->flags &= ~MFT_RECORD_IN_USE; //printf ("\n"); - //utils_dump_mem (buffer, 0, 1024, 1); + //utils_dump_mem (buffer, 0, 1024, DM_DEFAULTS); res = ntfs_mft_record_write (vol, mref, rec); printf ("res = %lld\n", res); @@ -1116,6 +1135,8 @@ static int utils_mftrec_mark_free2 (ntfs_volume *vol, MFT_REF mref) */ static int utils_free_non_residents (ntfs_inode *inode) { + // XXX need to do this in memory + ntfs_attr_search_ctx *ctx; ntfs_attr *na; ATTR_RECORD *arec; @@ -1240,7 +1261,7 @@ static int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfscha memset ((u8*)mrec + mrec->bytes_in_use, 0, mft_size - mrec->bytes_in_use); mft_usage += (attr_new - attr_orig); - //utils_dump_mem ((u8*) mrec, 0, mft_size, 1); + //utils_dump_mem ((u8*) mrec, 0, mft_size, DM_DEFAULTS); res = 0; done: ntfs_attr_put_search_ctx (ctx); @@ -1292,8 +1313,7 @@ static int ntfs_dt_add_alloc (struct ntfs_dt *parent, int index_num, INDEX_ENTRY return 0; } - //printf (""); - //utils_dump_mem (parent->data, 0, parent->data_len, 1); + //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); //printf ("\n"); src = (u8*) parent->children[index_num]; @@ -1318,9 +1338,8 @@ static int ntfs_dt_add_alloc (struct ntfs_dt *parent, int index_num, INDEX_ENTRY memset (dst, 0, len); - //printf (""); - //utils_dump_mem (parent->data, 0, parent->data_len, 1); - //printf ("\n"); + //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); + //printf ("\n"); return 0; } @@ -1342,9 +1361,8 @@ static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY root = (INDEX_ROOT*) parent->data; - printf (""); - utils_dump_mem (parent->data, 0, parent->data_len, 1); - printf ("\n"); + utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); + printf ("\n"); need = ie->length; space = ntfs_mft_free_space (parent->dir); @@ -1383,9 +1401,8 @@ static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY root->index.index_length = parent->data_len - 16; root->index.allocated_size = parent->data_len - 16; - printf (""); - utils_dump_mem (parent->data, 0, parent->data_len, 1); - printf ("\n"); + utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); + printf ("\n"); ntfs_mft_resize_resident (parent->dir->inode, AT_INDEX_ROOT, I30, 4, parent->data, parent->data_len); @@ -1412,7 +1429,7 @@ static int ntfs_dt_add (struct ntfs_dt *parent, INDEX_ENTRY *ie) //printf ("dt = %p, index = %d\n", dt, index_num); //ntfs_ie_dump (dt->children[index_num]); - //utils_dump_mem ((u8*)dt->children[index_num], 0, dt->children[index_num]->length, 1); + //utils_dump_mem ((u8*)dt->children[index_num], 0, dt->children[index_num]->length, DM_DEFAULTS); //printf ("\n"); if (0) ntfs_dt_add_alloc (dt, index_num, ie); @@ -1429,7 +1446,7 @@ static int ntfs_dt_remove_alloc (struct ntfs_dt *dt, int index_num) { INDEX_ENTRY *ie = NULL; int i; - u8 *dest; + u8 *dst; u8 *src; u8 *end; int off; @@ -1440,8 +1457,7 @@ static int ntfs_dt_remove_alloc (struct ntfs_dt *dt, int index_num) //printf ("index size = %d\n", dt->data_len); //printf ("index use = %d\n", dt->header->index_length); - //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); - //write (2, dt->data, dt->data_len); + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); off = (u8*)dt->children[0] - dt->data; for (i = 0; i < dt->child_count; i++) { @@ -1461,9 +1477,9 @@ static int ntfs_dt_remove_alloc (struct ntfs_dt *dt, int index_num) //printf ("total = %d\n", off); ie = dt->children[index_num]; - dest = (u8*)ie; + dst = (u8*)ie; - src = dest + ie->length; + src = dst + ie->length; ie = dt->children[dt->child_count-1]; end = (u8*)ie + ie->length; @@ -1471,15 +1487,15 @@ static int ntfs_dt_remove_alloc (struct ntfs_dt *dt, int index_num) len = end - src; //printf ("move %d bytes\n", len); - //printf ("%d, %d, %d\n", dest - dt->data, src - dt->data, len); - memmove (dest, src, len); + //printf ("%d, %d, %d\n", dst - dt->data, src - dt->data, len); + memmove (dst, src, len); - //printf ("clear %d bytes\n", dt->data_len - (dest - dt->data) - len); - //printf ("%d, %d, %d\n", dest - dt->data + len, 0, dt->data_len - (dest - dt->data) - len); + //printf ("clear %d bytes\n", dt->data_len - (dst - dt->data) - len); + //printf ("%d, %d, %d\n", dst - dt->data + len, 0, dt->data_len - (dst - dt->data) - len); //ntfs_dt_print (dt->dir->index, 0); -#if 1 - memset (dest + len, 0, dt->data_len - (dest - dt->data) - len); + + memset (dst + len, 0, dt->data_len - (dst - dt->data) - len); for (i = 0; i < dt->child_count; i++) { if (dt->sub_nodes[i]) { @@ -1495,13 +1511,12 @@ static int ntfs_dt_remove_alloc (struct ntfs_dt *dt, int index_num) dt->child_count = 0; //printf ("before = %d\n", dt->header->index_length + 24); - dt->header->index_length -= src - dest; + dt->header->index_length -= src - dst; //printf ("after = %d\n", dt->header->index_length + 24); ntfs_dt_count_alloc (dt); -#endif - //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); - //write (2, dt->data, dt->data_len); + + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); #if 0 //printf ("\n"); @@ -1525,7 +1540,7 @@ static int ntfs_dt_remove_alloc (struct ntfs_dt *dt, int index_num) printf (" (%d)\n", ie->length); } #endif - //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); res = ntfs_attr_mst_pwrite (dt->dir->ialloc, dt->vcn*512, 1, dt->data_len, dt->data); printf ("res = %lld\n", res); @@ -1540,7 +1555,7 @@ static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) INDEX_ENTRY *ie = NULL; INDEX_ROOT *ir = NULL; int i; - u8 *dest; + u8 *dst; u8 *src; u8 *end; int off; @@ -1551,8 +1566,7 @@ static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) //printf ("index size = %d\n", dt->data_len); //printf ("index use = %d\n", dt->header->index_length); - //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); - //write (2, dt->data, dt->data_len); + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); off = (u8*)dt->children[0] - dt->data; for (i = 0; i < dt->child_count; i++) { @@ -1572,9 +1586,9 @@ static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) //printf ("total = %d\n", off); ie = dt->children[index_num]; - dest = (u8*)ie; + dst = (u8*)ie; - src = dest + ie->length; + src = dst + ie->length; ie = dt->children[dt->child_count-1]; end = (u8*)ie + ie->length; @@ -1582,8 +1596,8 @@ static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) len = end - src; //printf ("move %d bytes\n", len); - //printf ("%d, %d, %d\n", dest - dt->data, src - dt->data, len); - memmove (dest, src, len); + //printf ("%d, %d, %d\n", dst - dt->data, src - dt->data, len); + memmove (dst, src, len); dt->data_len -= (src - dt->data - sizeof (INDEX_ROOT)); dt->child_count--; @@ -1599,7 +1613,7 @@ static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) //printf ("ih->allocated_size = %d\n", ir->index.allocated_size); //printf ("dt->data_len = %d\n", dt->data_len); - //utils_dump_mem (dt->data, 0, dt->data_len, 1); + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); //ntfs_dt_print (dt->dir->index, 0); #if 1 for (i = 0; i < dt->child_count; i++) { @@ -1616,13 +1630,12 @@ static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) dt->child_count = 0; //printf ("before = %d\n", dt->header->index_length + 24); - dt->header->index_length -= src - dest; + dt->header->index_length -= src - dst; //printf ("after = %d\n", dt->header->index_length + 24); ntfs_dt_count_root (dt); #endif - //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); - //write (2, dt->data, dt->data_len); + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); #if 0 //printf ("\n"); @@ -1646,7 +1659,7 @@ static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) printf (" (%d)\n", ie->length); } #endif - //utils_dump_mem (dt->data, 0, dt->data_len, TRUE); + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); res = ntfs_mft_record_write (dt->dir->inode->vol, dt->dir->inode->mft_no, dt->dir->inode->mrec); printf ("res = %lld\n", res); @@ -1865,7 +1878,7 @@ static void ntfs_ie_dump (INDEX_ENTRY *ie) printf ("________________________________________________"); printf ("\n"); - utils_dump_mem ((u8*)ie, 0, ie->length, 1); + utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); printf ("MFT Ref: 0x%llx\n", ie->indexed_file); printf ("length: %d\n", ie->length); @@ -2092,7 +2105,6 @@ static int ntfs_ie_test (void) int namelen = 0; ntfschar *name = NULL; - printf ("\n\n\n\n\n\n"); if (1) { ie1 = ntfs_ie_create(); //ntfs_ie_dump (ie1); @@ -2263,7 +2275,7 @@ static int ntfs_index_dump (ntfs_inode *inode) /** * ntfs_dt_root_replace */ -static int ntfs_dt_root_replace (struct ntfs_dt *dt, int dt_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) +static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) { u8 *src; u8 *dst; @@ -2271,17 +2283,17 @@ static int ntfs_dt_root_replace (struct ntfs_dt *dt, int dt_num, INDEX_ENTRY *de int len; int i; - if (!dt || !del_ie || !suc_ie) + if (!del || !del_ie || !suc_ie) return FALSE; - //utils_dump_mem (dt->data, 0, dt->data_len, 1); + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); //printf ("\n"); - attr = malloc (dt->data_len + suc_ie->length - del_ie->length); + attr = malloc (del->data_len + suc_ie->length - del_ie->length); dst = attr; - src = dt->data; - len = (u8*) del_ie - dt->data; + src = del->data; + len = (u8*) del_ie - del->data; memcpy (dst, src, len); @@ -2293,60 +2305,60 @@ static int ntfs_dt_root_replace (struct ntfs_dt *dt, int dt_num, INDEX_ENTRY *de dst += len; src = (u8*) del_ie + del_ie->length; - len = dt->data_len + (dt->data - (u8*) del_ie) - del_ie->length; + len = del->data_len + (del->data - (u8*) del_ie) - del_ie->length; memcpy (dst, src, len); - len = dt->data_len + suc_ie->length - del_ie->length; - free (dt->data); - dt->data = attr; - dt->data_len = len; + len = del->data_len + suc_ie->length - del_ie->length; + free (del->data); + del->data = attr; + del->data_len = len; - ntfs_mft_resize_resident (dt->dir->inode, AT_INDEX_ROOT, I30, 4, dt->data, dt->data_len); + ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); - //utils_dump_mem (attr, 0, dt->data_len, 1); + //utils_dump_mem (attr, 0, del->data_len, DM_DEFAULTS); - //for (i = 0; i < dt->child_count; i++) - // printf ("Child %d %p\n", i, dt->children[i]); + //for (i = 0; i < del->child_count; i++) + // printf ("Child %d %p\n", i, del->children[i]); //printf ("\n"); len = suc_ie->length - del_ie->length + 8; //printf ("len = %d\n", len); - for (i = dt_num+1; i < dt->child_count; i++) - dt->children[i] = (INDEX_ENTRY*) ((u8*) dt->children[i] + len); + for (i = del_num+1; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); - //for (i = 0; i < dt->child_count; i++) - // printf ("Child %d %p\n", i, dt->children[i]); + //for (i = 0; i < del->child_count; i++) + // printf ("Child %d %p\n", i, del->children[i]); //printf ("\n"); - //utils_dump_mem (dt->data, 0, dt->data_len, 1); + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); //printf ("\n"); - printf ("Modified: inode %lld MFT_RECORD, attribute 0x90\n", dt->dir->inode->mft_no); + printf ("Modified: inode %lld MFT_RECORD, attribute 0x90\n", del->dir->inode->mft_no); return TRUE; } /** * ntfs_dt_alloc_replace */ -static BOOL ntfs_dt_alloc_replace (struct ntfs_dt *dt, int dt_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) +static BOOL ntfs_dt_alloc_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) { u8 *src; u8 *dst; int len; int i; - if (!dt || !del_ie || !suc_ie) + if (!del || !del_ie || !suc_ie) return FALSE; - //utils_dump_mem (dt->data, 0, dt->data_len, 1); + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); src = (u8*) del_ie + del_ie->length; dst = (u8*) del_ie + suc_ie->length; - len = dt->header->index_length + 24 + (dt->data - src); - //printf ("src = %d\n", src - dt->data); - //printf ("dst = %d\n", dst - dt->data); + len = del->header->index_length + 24 + (del->data - src); + //printf ("src = %d\n", src - del->data); + //printf ("dst = %d\n", dst - del->data); //printf ("len = %d\n", len); if (src != dst) @@ -2358,32 +2370,259 @@ static BOOL ntfs_dt_alloc_replace (struct ntfs_dt *dt, int dt_num, INDEX_ENTRY * memcpy (dst, src, len); - //utils_dump_mem (dt->data, 0, dt->data_len, 1); + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - dt->header->index_length += suc_ie->length - del_ie->length; + del->header->index_length += suc_ie->length - del_ie->length; - dst = dt->data + dt->header->index_length + 24; - len = dt->data_len - dt->header->index_length - 24; + dst = del->data + del->header->index_length + 24; + len = del->data_len - del->header->index_length - 24; memset (dst, 0, len); - //for (i = 0; i < dt->child_count; i++) - // printf ("Child %d %p\n", i, dt->children[i]); + //for (i = 0; i < del->child_count; i++) + // printf ("Child %d %p\n", i, del->children[i]); //printf ("\n"); len = suc_ie->length - del_ie->length; //printf ("len = %d\n", len); - for (i = dt_num+1; i < dt->child_count; i++) - dt->children[i] = (INDEX_ENTRY*) ((u8*) dt->children[i] + len); + for (i = del_num+1; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); - //for (i = 0; i < dt->child_count; i++) - // printf ("Child %d %p\n", i, dt->children[i]); + //for (i = 0; i < del->child_count; i++) + // printf ("Child %d %p\n", i, del->children[i]); //printf ("\n"); - //utils_dump_mem (dt->data, 0, dt->data_len, 1); + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - printf ("Modified: inode %lld, INDEX_ALLOCATION vcn %lld-%lld\n", dt->dir->inode->mft_no, dt->vcn, dt->vcn + 4); + printf ("Modified: inode %lld, INDEX_ALLOCATION vcn %lld-%lld\n", del->dir->inode->mft_no, del->vcn, del->vcn + 4); + return TRUE; +} + + +/** + * ntfs_dt_root_remove + */ +static BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) +{ + INDEX_ENTRY *del_ie = NULL; + u8 *src; + u8 *dst; + int len; + int i; + //int off; + + if (!del) + return FALSE; + + //utils_dump_mem (del->data, 0, del->data_len, DM_RED); + //printf ("\n"); + +#if 0 + off = (u8*) del->children[0] - del->data; + for (i = 0; i < del->child_count; i++) { + del_ie = del->children[i]; + + printf ("%2d %4d ", i+1, off); + off += del_ie->length; + + if (del_ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", del_ie->length); + break; + } + + ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + printf (" (%d)\n", del_ie->length); + } + printf ("total = %d\n", off); +#endif + + del_ie = del->children[del_num]; + + src = (u8*) del_ie + del_ie->length; + dst = (u8*) del_ie; + len = del->header->index_length + 16 - (src - del->data); + + //printf ("src = %d\n", src - del->data); + //printf ("dst = %d\n", dst - del->data); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + del->data_len -= del_ie->length; + del->child_count--; + + del->header->index_length = del->data_len - 16; + del->header->allocated_size = del->data_len - 16; + + ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); + del->data = realloc (del->data, del->data_len); + + //utils_dump_mem (del->data, 0, del->data_len, DM_GREEN | DM_RED); + + src = (u8*) (&del->children[del_num+1]); + dst = (u8*) (&del->children[del_num]); + len = (del->child_count - del_num) * sizeof (INDEX_ENTRY*); + + //printf ("src = %d\n", src - (u8*) del->children); + //printf ("dst = %d\n", dst - (u8*) del->children); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + src = (u8*) (&del->sub_nodes[del_num+1]); + dst = (u8*) (&del->sub_nodes[del_num]); + len = (del->child_count - del_num) * sizeof (struct ntfs_dt*); + + //printf ("src = %d\n", src - (u8*) del->children); + //printf ("dst = %d\n", dst - (u8*) del->children); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + //printf ("del_num = %d\n", del_num); + for (i = del_num; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_ie->length); + + if (!ntfs_dt_alloc_children2 (del, del->child_count)) + return FALSE; + +#if 0 + off = (u8*) del->children[0] - del->data; + for (i = 0; i < del->child_count; i++) { + del_ie = del->children[i]; + + printf ("%2d %4d ", i+1, off); + off += del_ie->length; + + if (del_ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", del_ie->length); + break; + } + + ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + printf (" (%d)\n", del_ie->length); + } + printf ("total = %d\n", off); +#endif + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + + printf ("Modified: inode %lld MFT_RECORD, attribute 0x90\n", del->dir->inode->mft_no); + return TRUE; +} + +/** + * ntfs_dt_alloc_remove + */ +static BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) +{ + INDEX_ENTRY *del_ie = NULL; + u8 *dst; + u8 *src; + int len; + int i; + //int off; + + if (!del) + return FALSE; + +#if 0 + off = (u8*)del->children[0] - del->data; + for (i = 0; i < del->child_count; i++) { + del_ie = del->children[i]; + + printf ("%2d %4d ", i, off); + off += del_ie->length; + + if (del_ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", del_ie->length); + break; + } + + ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + printf (" (%d)\n", del_ie->length); + } + printf ("total = %d\n", off); + printf ("\n"); +#endif + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + //printf ("\n"); + + del_ie = del->children[del_num]; + + src = (u8*) del_ie + del_ie->length; + dst = (u8*) del_ie; + len = del->header->index_length + 24 - (src - del->data); + + //printf ("src = %d\n", src - del->data); + //printf ("dst = %d\n", dst - del->data); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + del->header->index_length -= src - dst; + del->child_count--; + + dst += len; + len = del->data_len - del->header->index_length - 24; + + //printf ("dst = %d\n", dst - del->data); + //printf ("len = %d\n", len); + + memset (dst, 0, len); + + src = (u8*) (&del->children[del_num+1]); + dst = (u8*) (&del->children[del_num]); + len = (del->child_count - del_num) * sizeof (INDEX_ENTRY*); + + //printf ("src = %d\n", src - (u8*) del->children); + //printf ("dst = %d\n", dst - (u8*) del->children); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + src = (u8*) (&del->sub_nodes[del_num+1]); + dst = (u8*) (&del->sub_nodes[del_num]); + len = (del->child_count - del_num) * sizeof (struct ntfs_dt*); + + //printf ("src = %d\n", src - (u8*) del->children); + //printf ("dst = %d\n", dst - (u8*) del->children); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + //printf ("del_num = %d\n", del_num); + for (i = del_num; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_ie->length); + + if (!ntfs_dt_alloc_children2 (del, del->child_count)) + return FALSE; + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + +#if 0 + off = (u8*)del->children[0] - del->data; + for (i = 0; i < del->child_count; i++) { + del_ie = del->children[i]; + + printf ("%2d %4d ", i, off); + off += del_ie->length; + + if (del_ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", del_ie->length); + break; + } + + ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + printf (" (%d)\n", del_ie->length); + } + printf ("total = %d\n", off); + printf ("\n"); +#endif + + //printf ("Modified: inode %lld, INDEX_ALLOCATION vcn %lld-%lld\n", del->dir->inode->mft_no, del->vcn, del->vcn + 4); return TRUE; } @@ -2443,7 +2682,7 @@ static int ntfsadd (ntfs_volume *vol, char *name) if (!ie) goto done; - //utils_dump_mem ((u8*)ie, 0, ie->length, 1); + //utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); //printf ("\n"); //printf ("ie = %lld\n", MREF (ie->indexed_file)); //ntfs_dt_del_child (finddir->index, uname, len); @@ -2463,6 +2702,9 @@ done: */ static int ntfsrm2 (ntfs_volume *vol, char *name) { + // XXX work with inode - lookup name outside? + // how do I do the inode -> dt lookup? + struct ntfs_dir *root_dir = NULL; struct ntfs_dir *find_dir = NULL; struct ntfs_dt *del = NULL; @@ -2502,8 +2744,7 @@ static int ntfsrm2 (ntfs_volume *vol, char *name) } del_ie = del->children[del_num]; - //printf (""); - //utils_dump_mem ((u8*)del_ie, 0, del_ie->length, 1); + //utils_dump_mem ((u8*)del_ie, 0, del_ie->length, DM_DEFAULTS); //printf ("\n"); /* @@ -2519,14 +2760,13 @@ static int ntfsrm2 (ntfs_volume *vol, char *name) //printf ("succ = %p, index = %d\n", suc, suc_num); //printf ("\n"); - suc_ie = ntfs_ie_copy ((INDEX_ENTRY*) suc->children[suc_num]); - //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, 1); + suc_ie = ntfs_ie_copy (suc->children[suc_num]); + //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, DM_DEFAULTS); //printf ("\n"); suc_ie = ntfs_ie_set_vcn (suc_ie, vcn); - //printf (""); - //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, 1); - //printf ("\n"); + //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, DM_DEFAULTS); + //printf ("\n"); if (del->parent) res = ntfs_dt_alloc_replace (del, del_num, del_ie, suc_ie); @@ -2538,24 +2778,44 @@ static int ntfsrm2 (ntfs_volume *vol, char *name) if (res == FALSE) goto done; - del = suc; - del_num = suc_num; // Continue delete with the successor + del = suc; // Continue delete with the successor + del_num = suc_num; + del_ie = suc->children[suc_num]; } /* * Now we have the simple case of deleting from a leaf node. + * If this step creates an empty node, we have more to do. */ - //XX ntfs_dt_remove_key (dt, index) root/alloc + if (del->parent) + ntfs_dt_alloc_remove (del, del_num); + else + ntfs_dt_root_remove (del, del_num); if (del->child_count > 1) // XXX ntfs_dt_empty (dt), ntfs_dt_full (dt, new) goto commit; - // find first non-empty parent - // find its successor - // unhook and add to successor's node + /* + * Ascend the tree until we find a node that is not empty. Take the + * ancestor key and unhook it. This will free up some space in the + * index allocation. Finally add the ancestor to the node of its + * successor. + */ + + // find the key which has no descendents + // unhook and hold onto the dt's + // unhook the key + // find successor + // insert key into successor + // if any new nodes are needed, reuse the preserved nodes + // remove any unused nodes + + printf ("empty\n"); + goto done; commit: + printf ("commit\n"); done: ntfs_dir_free (root_dir); @@ -2611,7 +2871,7 @@ int main (int argc, char *argv[]) if (0) result = ntfsrm (vol, opts.file); if (0) result = ntfs_ie_test(); if (0) result = ntfsadd (vol, opts.file); - if (1) result = ntfsrm2 (vol, opts.file); + if (0) result = ntfsrm2 (vol, opts.file); done: ntfs_inode_close (inode); From 4f7f3e7dc690be8137b0aa738e5a0a8005ae3d5e Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 24 Jun 2004 13:08:28 +0000 Subject: [PATCH 1548/2994] cleaner versions of remove root/alloc BKrev: 40dad24c7r47g_o02XmY_galSxLCYA From 2adcb49e33f80f1aad0d34df7f1847de698c83fb Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 24 Jun 2004 13:08:28 +0000 Subject: [PATCH 1549/2994] jazzed up dump mem (Logical change 1.439) --- ntfsprogs/utils.c | 23 +++++++++++++++++++---- ntfsprogs/utils.h | 10 ++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index b66f3e36..00830a67 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -874,28 +874,41 @@ int utils_is_metadata (ntfs_inode *inode) * Display a block of memory in a tradition hex-dump manner. * Optionally the ascii part can be turned off. */ -void utils_dump_mem (u8 *buf, int start, int length, int ascii) +void utils_dump_mem (u8 *buf, int start, int length, int flags) { - int off, i, s, e; + int off, i, s, e, col; s = start & ~15; // round down e = (start + length + 15) & ~15; // round up for (off = s; off < e; off += 16) { + col = 30; + if (flags & DM_RED) + col += 1; + if (flags & DM_GREEN) + col += 2; + if (flags & DM_BLUE) + col += 4; + if (flags & DM_INDENT) + printf ("\t"); + if (flags & DM_BOLD) + printf (""); + if (flags & (DM_RED | DM_BLUE | DM_GREEN | DM_BOLD)) + printf ("[%dm", col); if (off == s) printf("%6.6x ", start); else printf("%6.6x ", off); for (i = 0; i < 16; i++) { - if (i == 8) + if ((i == 8) && (!(flags & DM_NO_DIVIDER))) printf (" -"); if (((off+i) >= start) && ((off+i) < (start+length))) printf (" %02X", buf[off+i]); else printf (" "); } - if (ascii) { + if (!(flags & DM_NO_ASCII)) { printf (" "); for (i = 0; i < 16; i++) { if (((off+i) < start) || ((off+i) >= (start+length))) @@ -906,6 +919,8 @@ void utils_dump_mem (u8 *buf, int start, int length, int ascii) printf ("."); } } + if (flags & (DM_RED | DM_BLUE | DM_GREEN | DM_BOLD)) + printf (""); printf ("\n"); } } diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 73678a84..ac8a8060 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -133,4 +133,14 @@ struct mft_search_ctx * mft_get_search_ctx (ntfs_volume *vol); void mft_put_search_ctx (struct mft_search_ctx *ctx); int mft_next_record (struct mft_search_ctx *ctx); +// Flags for dump mem +#define DM_DEFAULTS 0 +#define DM_NO_ASCII (1 << 0) +#define DM_NO_DIVIDER (1 << 1) +#define DM_INDENT (1 << 2) +#define DM_RED (1 << 3) +#define DM_GREEN (1 << 4) +#define DM_BLUE (1 << 5) +#define DM_BOLD (1 << 6) + #endif /* _NTFS_UTILS_H_ */ From f961d41277877bc9cdc83c8f1b9df57af39d1ced Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 24 Jun 2004 18:03:37 +0000 Subject: [PATCH 1550/2994] tidier version of add_root/alloc (Logical change 1.440) --- ntfsprogs/ntfsrm.c | 160 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 153 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 929bedd1..ba3815f9 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -2622,15 +2622,156 @@ static BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) printf ("\n"); #endif - //printf ("Modified: inode %lld, INDEX_ALLOCATION vcn %lld-%lld\n", del->dir->inode->mft_no, del->vcn, del->vcn + 4); + printf ("Modified: inode %lld, INDEX_ALLOCATION vcn %lld-%lld\n", del->dir->inode->mft_no, del->vcn, del->vcn + 4); return TRUE; } /** - * ntfsadd + * ntfs_dt_root_add */ -static int ntfsadd (ntfs_volume *vol, char *name) +static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) +{ + FILE_NAME_ATTR *file; + struct ntfs_dt *suc; + int suc_num; + int need; + int space; + u8 *attr; + u8 *src; + u8 *dst; + int len; + + if (!add || !add_ie) + return 0; + + //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); + //printf ("\n"); + + need = add_ie->length; + space = ntfs_mft_free_space (add->dir); + + file = &add_ie->key.file_name; + + suc = ntfs_dt_find3 (add, file->file_name, file->file_name_length, &suc_num); + if (!suc) + return 0; + + // hmm, suc == add + + printf ("need %d, have %d\n", need, space); + if (need > space) { + printf ("no room"); + return 0; + } + + attr = malloc (add->data_len + need); + + src = add->data; + dst = attr; + len = add->header->entries_offset + 16; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) add_ie; + len = add_ie->length; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) suc->children[suc_num]; + len = add->data + add->data_len - src; + + memcpy (dst, src, len); + + free (add->data); + add->data = attr; + add->data_len += need; + + add->header->index_length = add->data_len - 16; + add->header->allocated_size = add->data_len - 16; + + ntfs_mft_resize_resident (add->dir->inode, AT_INDEX_ROOT, I30, 4, add->data, add->data_len); + + //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); + //printf ("\n"); + + printf ("Modified: inode %lld MFT_RECORD, attribute 0x90\n", add->dir->inode->mft_no); + return 0; +} + +/** + * ntfs_dt_alloc_add + */ +static int ntfs_dt_alloc_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) +{ + FILE_NAME_ATTR *file; + struct ntfs_dt *suc_dt; + int suc_num; + int need; + int space; + u8 *src; + u8 *dst; + int len; + + if (!add || !add_ie) + return 0; + + need = add_ie->length; + space = add->data_len - add->header->index_length - 24; + + file = &add_ie->key.file_name; + + suc_dt = ntfs_dt_find3 (add, file->file_name, file->file_name_length, &suc_num); + if (!suc_dt) + return 0; + + // hmm, suc_dt == add + + printf ("need %d, have %d\n", need, space); + if (need > space) { + printf ("no room"); + return 0; + } + + //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); + //printf ("\n"); + + src = (u8*) suc_dt->children[suc_num]; + dst = src + need; + len = add->data + add->data_len - src - space; + //printf ("src = %d\n", src - add->data); + //printf ("dst = %d\n", dst - add->data); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + dst = src; + src = (u8*) add_ie; + len = need; + + memcpy (dst, src, len); + + add->header->index_length += len; + + dst = add->data + add->header->index_length + 24; + len = add->data_len - add->header->index_length - 24; + + memset (dst, 0, len); + + //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); + //printf ("\n"); + + printf ("Modified: inode %lld, INDEX_ALLOCATION vcn %lld-%lld\n", add->dir->inode->mft_no, add->vcn, add->vcn + 4); + return 0; +} + + +/** + * ntfs_file_add + */ +static int ntfs_file_add (ntfs_volume *vol, char *name) { struct ntfs_dir *dir = NULL; struct ntfs_dir *finddir = NULL; @@ -2690,6 +2831,11 @@ static int ntfsadd (ntfs_volume *vol, char *name) //ntfs_dt_print (finddir->index, 0); ntfs_dt_add (finddir->index, ie); + // test + if (0) ntfs_dt_alloc_add (del, ie); + if (0) ntfs_dt_root_add (del, ie); + // test + done: ntfs_dir_free (dir); free (uname); @@ -2698,9 +2844,9 @@ done: } /** - * ntfsrm2 + * ntfs_file_remove */ -static int ntfsrm2 (ntfs_volume *vol, char *name) +static int ntfs_file_remove (ntfs_volume *vol, char *name) { // XXX work with inode - lookup name outside? // how do I do the inode -> dt lookup? @@ -2870,8 +3016,8 @@ int main (int argc, char *argv[]) if (0) result = ntfs_index_dump (inode); if (0) result = ntfsrm (vol, opts.file); if (0) result = ntfs_ie_test(); - if (0) result = ntfsadd (vol, opts.file); - if (0) result = ntfsrm2 (vol, opts.file); + if (0) result = ntfs_file_add (vol, opts.file); + if (0) result = ntfs_file_remove (vol, opts.file); done: ntfs_inode_close (inode); From 3c13c55f5acdfb21a46e85668822266161060e32 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 24 Jun 2004 18:03:37 +0000 Subject: [PATCH 1551/2994] tidier version of add_root/alloc BKrev: 40db1779OuoVusPELJp67N1zDGHXVQ From 97b67d3f67ab5b1148c4feab93200fe0e615c61b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 25 Jun 2004 17:08:20 +0000 Subject: [PATCH 1552/2994] fixes to ntfswipe in wipe_tails BKrev: 40dc5c04W-4bdfUDbnLCmL4fD-SUuA From 9d0b3d8069fb47e516e7d4205a5e97f003236402 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 25 Jun 2004 17:08:20 +0000 Subject: [PATCH 1553/2994] wipe_tails: * disable of handling compressed DATA attribute (it isn't safe now), until I implement it properly * fixed bug in handling very fragmented files (Logical change 1.441) --- ntfsprogs/ntfswipe.c | 72 ++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index b8c8a141..34960fa2 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -402,13 +402,14 @@ free: * @attr: A vaild $DATA attribute record * @compr_unit: Compression unit obtained from first $DATA attribute (because in other * it 0) + * @tail: If last is not compressed, how many we have to wipe in it end * * Return: >0 Success, the atrribute was wiped * 0 Nothing to wipe * -1 Error, something went wrong */ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, enum action act, - ATTR_RECORD *attr, u8 compr_unit) + ATTR_RECORD *attr, u8 compr_unit, u32 tail) { runlist *rl; unsigned char *buf; @@ -418,6 +419,7 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, enum action ac u64 wiped = 0; s64 ret; runlist *rlc; + u64 cu_mask; if (compr_unit != 4) Eprintf ("strange: compression unit is %u (not 4)\n", compr_unit); @@ -427,6 +429,8 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, enum action ac Eprintf ("Compression unit could not be 0"); return -1; } + + cu_mask = (1 << compr_unit) - 1; rl = ntfs_mapping_pairs_decompress(vol, attr, 0); if (!rl) { @@ -437,31 +441,37 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, enum action ac rlc = rl; while (rlc->length) { - if ((rlc->length >> compr_unit) || (rlc->lcn < 0)) { + if ((!(rlc->length & cu_mask) && ((rlc+1)->length || !tail)) + || (rlc->lcn < 0)) { rlc++; continue; } - offset = 0; - while (1) { - ret = ntfs_rl_pread (vol, rlc, offset, 2, &block_size); - if (ret != 2) { - Vprintf ("Internal error\n"); - Eprintf ("ntfs_rl_pread failed"); - wiped = -1; - goto free_rl; + if (rlc->length & cu_mask) { + offset = (rlc->length & (~cu_mask)) << vol->cluster_size_bits; + while (1) { + ret = ntfs_rl_pread (vol, rlc, offset, 2, &block_size); + if (ret != 2) { + Vprintf ("Internal error\n"); + Eprintf ("ntfs_rl_pread failed"); + wiped = -1; + goto free_rl; + } + if (block_size == 0) { + offset += 2; + break; + } + block_size &= 0x0FFF; + block_size += 3; + offset += block_size; + if (offset >= (rlc->length << vol->cluster_size_bits) - 2) + goto next; } - if (block_size == 0) { - offset += 2; - break; - } - block_size &= 0x0FFF; - block_size += 3; - offset += block_size; - if (offset >= (rlc->length << vol->cluster_size_bits) - 2) - goto next; + size = (rlc->length << vol->cluster_size_bits) - offset; + } else { + size = tail; + offset = (rlc->length << vol->cluster_size_bits) - tail; } - size = (rlc->length << vol->cluster_size_bits) - offset; if ((act == act_info) || (!size)) { wiped += size; @@ -591,6 +601,8 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) s64 size = -1; u64 offset; VCN last_vcn; + u32 tail; + ATTR_RECORD *first_attr = 0; while (!ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { attr = ctx->attr; @@ -598,13 +610,21 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) Vprintf ("Resident $DATA atrribute. Skipping.\n"); goto put_search_ctx; } + + if (!first_attr) { + first_attr = attr; + if (attr->compression_unit) { + compr_unit = attr->compression_unit; + tail = attr->allocated_size - attr->data_size; + } + } s64 wiped; - if (attr->flags & ATTR_IS_COMPRESSED) { - if (attr->compression_unit) - compr_unit = attr->compression_unit; - wiped = wipe_compressed_attribute (vol, byte, act, - attr, compr_unit); + if (first_attr->flags & ATTR_IS_COMPRESSED) { + Vprintf ("Compressed $DATA attribute. Not supported yet ;(\n"); + goto put_search_ctx; +// wiped = wipe_compressed_attribute (vol, byte, act, +// attr, compr_unit, tail); } else { if (size == -1) { offset = attr->data_size; @@ -613,7 +633,7 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) if (attr->flags & ATTR_IS_ENCRYPTED) offset = (((offset - 1) >> 10) + 1) << 10; size = (vol->cluster_size - offset) % - vol->cluster_size; + vol->cluster_size; last_vcn = attr->data_size >> vol->cluster_size_bits; } From 26d2ca28d0439c4b046c3b4844b4c32f41fac678 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 26 Jun 2004 10:35:23 +0000 Subject: [PATCH 1554/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/06/26 11:31:19+01:00 flatcap.org!ntfs make bitmap alterations in memory BKrev: 40dd516bI19f8h5aJ50809UbhoPqUA From 6b1670837cb64fa8c0426941a54f09be22bc1206 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 26 Jun 2004 10:35:23 +0000 Subject: [PATCH 1555/2994] make bitmap alterations in memory (Logical change 1.442) --- ntfsprogs/ntfsrm.c | 308 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 295 insertions(+), 13 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index ba3815f9..6e38bbc2 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -201,20 +201,15 @@ static VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie); static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype); /** - * struct bmp_page + * struct ntfs_bmp + * a cache for either dir/$BITMAP, $MFT/$BITMAP or $MFT/$Bitmap */ -struct bmp_page { - u8 *data; - VCN vcn; -}; - -/** - * struct mft_bitmap - */ -struct mft_bitmap { - ntfs_attr *bmp; - struct bmp_page **pages; - int count; +struct ntfs_bmp { + ntfs_attr *attr; + u8 **data; + VCN *data_vcn; + int count; + //int cluster_size; }; /** @@ -302,6 +297,225 @@ static void ntfs_dt_print (struct ntfs_dt *dt, int indent) } +/** + * ntfs_bmp_free + */ +static void ntfs_bmp_free (struct ntfs_bmp *bmp) +{ + int i; + + if (!bmp) + return; + + for (i = 0; i < bmp->count; i++) + free (bmp->data[i]); + + ntfs_attr_close (bmp->attr); + + free (bmp->data); + free (bmp->data_vcn); + free (bmp); +} + +/** + * ntfs_bmp_alloc + */ +static struct ntfs_bmp * ntfs_bmp_alloc (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len) +{ + struct ntfs_bmp *bmp; + ntfs_attr *attr; + + if (!inode) + return NULL; + + attr = ntfs_attr_open (inode, type, name, name_len); + if (!attr) + return NULL; + + bmp = calloc (1, sizeof (*bmp)); + if (!bmp) + return NULL; + + bmp->attr = attr; + bmp->data = calloc (16, sizeof (*bmp->data)); + bmp->data_vcn = calloc (16, sizeof (*bmp->data_vcn)); + bmp->count = 0; + + if (!bmp->data || !bmp->data_vcn) { + ntfs_bmp_free (bmp); + return NULL; + } + + return bmp; +} + +/** + * ntfs_bmp_add_data + */ +static int ntfs_bmp_add_data (struct ntfs_bmp *bmp, VCN vcn, u8 *data) +{ + int i = 0; + int old; + int new; + + if (!bmp || !data) + return -1; + + old = ((bmp->count + 15) & ~15); + bmp->count++; + new = ((bmp->count + 15) & ~15); + + if (old != new) { + bmp->data = realloc (bmp->data, new * sizeof (*bmp->data)); + bmp->data_vcn = realloc (bmp->data_vcn , new * sizeof (*bmp->data_vcn)); + } + + for (i = 0; i < bmp->count-1; i++) + if (bmp->data_vcn[i] > vcn) + break; + + if ((bmp->count-i) > 0) { + memmove (&bmp->data[i+1], &bmp->data[i], (bmp->count-i) * sizeof (*bmp->data)); + memmove (&bmp->data_vcn[i+1], &bmp->data_vcn[i], (bmp->count-i) * sizeof (*bmp->data_vcn)); + } + + bmp->data[i] = data; + bmp->data_vcn[i] = vcn; + + return bmp->count; +} + +/** + * ntfs_bmp_get_data + */ +static u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn) +{ + u8 *buffer; + int i; + VCN begin; + VCN end; + + if (!bmp) + return NULL; + + for (i = 0; i < bmp->count; i++) { + begin = (bmp->data_vcn[i] >> 3) & (~(512-1)); + end = begin + (512 << 3); + if ((vcn >= begin) && (vcn < end)) { + //printf ("%lld, %lld, %lld\n", begin, vcn, end); + return bmp->data[i]; + } + } + + buffer = malloc (512); + if (!buffer) + return NULL; + + begin = (vcn>>3) & (~(512-1)); + //printf ("loading from offset %lld\n", begin); + if (ntfs_attr_pread (bmp->attr, begin, 512, buffer) < 0) { + free (buffer); + return NULL; + } + + ntfs_bmp_add_data (bmp, vcn, buffer); + return buffer; +} + +/** + * ntfs_bmp_set_range + */ +static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, u64 length, int value) +{ + u64 i; + u8 *buffer; + VCN begin; + VCN end; + int start; + int finish; + u8 sta_part; + u8 fin_part; + + if (!bmp) + return -1; + + //printf ("\n"); + //printf ("set range: %lld - %lld\n", vcn, vcn+length-1); + + for (i = vcn; i < (vcn+length); i += 4096) { + buffer = ntfs_bmp_get_data (bmp, i); + if (!buffer) + return -1; + +#if 0 + memset (buffer, 0xFF, 512); + value = 0; +#else + memset (buffer, 0x00, 512); + value = 1; +#endif + //utils_dump_mem (buffer, 0, 32, DM_DEFAULTS); + //printf ("\n"); + + begin = i & ~4095; + end = begin + 4095; + //printf ("begin = %lld, vcn = %lld,%lld end = %lld\n", begin, vcn, vcn+length-1, end); + + if ((vcn > begin) && (vcn < end)) { + //printf ("1\n"); + start = ((vcn+8) >> 3) & 511; + sta_part = 0xff << (vcn&7); + } else { + //printf ("2\n"); + start = 0; + } + + if (((vcn+length-1) >= begin) && ((vcn+length-1) <= end)) { + //printf ("3\n"); + finish = ((vcn+length-1) >> 3) & 511; + fin_part = 0xff >> (7-((vcn+length-1)&7)); + } else { + //printf ("4\n"); + finish = 511; + } + +#if 0 + //printf ("\n"); + printf ("%lld) ", i>>12); + if (start > 0) { + printf ("(%02x) ", sta_part); + } else { + printf (" "); + } + + printf ("%d - %d", start, finish); + + if (finish < 511) { + printf (" (%02x)\n", fin_part); + } else { + printf (" \n"); + } +#endif + if (value) { + if (start != 0) + buffer[start-1] |= sta_part; + if ((finish - start) > 0) + memset (buffer+start, 0xff, finish-start); + buffer[finish] |= fin_part; + } else { + if (start != 0) + buffer[start-1] &= ~sta_part; + if ((finish - start) > 0) + memset (buffer+start, 0x00, finish-start); + buffer[finish] &= ~fin_part; + } + utils_dump_mem (buffer, 0, 16, DM_DEFAULTS); + } + + return 1; +} + + /** * ntfs_dt_alloc_children */ @@ -1175,6 +1389,47 @@ static int utils_free_non_residents (ntfs_inode *inode) return 0; } +/** + * utils_free_non_residents2 + */ +static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) +{ + ntfs_attr_search_ctx *ctx; + ntfs_attr *na; + ATTR_RECORD *arec; + + if (!inode) + return -1; + + ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); + if (!ctx) { + printf ("can't create a search context\n"); + return -1; + } + + while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { + arec = ctx->attr; + if (arec->non_resident) { + na = ntfs_attr_open (inode, arec->type, NULL, 0); + if (na) { + runlist_element *rl; + LCN size; + LCN count; + ntfs_attr_map_whole_runlist (na); + rl = na->rl; + size = na->allocated_size >> inode->vol->cluster_size_bits; + for (count = 0; count < size; count += rl->length, rl++) { + ntfs_bmp_set_range (bmp, rl->lcn, rl->length, 0); + } + ntfs_attr_close (na); + } + } + } + + ntfs_attr_put_search_ctx (ctx); + return 0; +} + /** * ntfs_mft_resize_resident @@ -2969,6 +3224,32 @@ done: return 0; } +/** + * ntfs_test_bmp + */ +static int ntfs_test_bmp (ntfs_volume *vol, ntfs_inode *inode, int s, int f) +{ + ntfs_inode *volbmp; + struct ntfs_bmp *bmp; + //u8 *buffer; + //int i; + + volbmp = ntfs_inode_open (vol, FILE_Bitmap); + if (!volbmp) + return 1; + + bmp = ntfs_bmp_alloc (volbmp, AT_DATA, NULL, 0); + if (!bmp) + return 1; + + if (0) utils_free_non_residents2 (inode, bmp); + + ntfs_bmp_set_range (bmp, s, f, 1); + + ntfs_bmp_free (bmp); + return 0; +} + /** * main - Begin here @@ -3018,6 +3299,7 @@ int main (int argc, char *argv[]) if (0) result = ntfs_ie_test(); if (0) result = ntfs_file_add (vol, opts.file); if (0) result = ntfs_file_remove (vol, opts.file); + if (0) result = ntfs_test_bmp (vol, inode, s, f-s+1); done: ntfs_inode_close (inode); From a1805f921228d2bde2aade5bf5fe533e999b5048 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 27 Jun 2004 01:05:48 +0000 Subject: [PATCH 1556/2994] make mft modifications in memory (Logical change 1.443) --- ntfsprogs/ntfsrm.c | 68 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 6e38bbc2..2faeaf6f 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -202,7 +202,7 @@ static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int name /** * struct ntfs_bmp - * a cache for either dir/$BITMAP, $MFT/$BITMAP or $MFT/$Bitmap + * a cache for either dir/$BITMAP, $MFT/$BITMAP or $Bitmap/$DATA */ struct ntfs_bmp { ntfs_attr *attr; @@ -509,9 +509,16 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, u64 length, int va memset (buffer+start, 0x00, finish-start); buffer[finish] &= ~fin_part; } - utils_dump_mem (buffer, 0, 16, DM_DEFAULTS); + //utils_dump_mem (buffer, 0, 16, DM_DEFAULTS); } + printf ("Modified: inode %lld, ", bmp->attr->ni->mft_no); + switch (bmp->attr->type) { + case AT_BITMAP: printf ("$BITMAP"); break; + case AT_DATA: printf ("$DATA"); break; + } + printf (" vcn %lld-%lld\n", vcn>>12, (vcn+length)>>12); + return 1; } @@ -1344,6 +1351,40 @@ static int utils_mftrec_mark_free2 (ntfs_volume *vol, MFT_REF mref) return 0; } +/** + * utils_mftrec_mark_free3 + */ +static int utils_mftrec_mark_free3 (struct ntfs_bmp *bmp, MFT_REF mref) +{ + return ntfs_bmp_set_range (bmp, (VCN) MREF (mref), 1, 0); +} + +/** + * utils_mftrec_mark_free4 + */ +static int utils_mftrec_mark_free4 (ntfs_inode *inode) +{ + MFT_RECORD *rec; + + if (!inode) + return -1; + + rec = (MFT_RECORD*) inode->mrec; + + if ((rec->flags & MFT_RECORD_IN_USE) == 0) { + Eprintf ("MFT record isn't in use (2).\n"); + return -1; + } + + rec->flags &= ~MFT_RECORD_IN_USE; + + //printf ("\n"); + //utils_dump_mem (buffer, 0, 1024, DM_DEFAULTS); + + printf ("Modified: inode %lld MFT_RECORD header\n", inode->mft_no); + return 0; +} + /** * utils_free_non_residents */ @@ -2650,7 +2691,7 @@ static BOOL ntfs_dt_alloc_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - printf ("Modified: inode %lld, INDEX_ALLOCATION vcn %lld-%lld\n", del->dir->inode->mft_no, del->vcn, del->vcn + 4); + printf ("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", del->dir->inode->mft_no, del->vcn, del->vcn + 4); return TRUE; } @@ -2877,7 +2918,7 @@ static BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) printf ("\n"); #endif - printf ("Modified: inode %lld, INDEX_ALLOCATION vcn %lld-%lld\n", del->dir->inode->mft_no, del->vcn, del->vcn + 4); + printf ("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", del->dir->inode->mft_no, del->vcn, del->vcn + 4); return TRUE; } @@ -3018,7 +3059,7 @@ static int ntfs_dt_alloc_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); //printf ("\n"); - printf ("Modified: inode %lld, INDEX_ALLOCATION vcn %lld-%lld\n", add->dir->inode->mft_no, add->vcn, add->vcn + 4); + printf ("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", add->dir->inode->mft_no, add->vcn, add->vcn + 4); return 0; } @@ -3227,10 +3268,11 @@ done: /** * ntfs_test_bmp */ -static int ntfs_test_bmp (ntfs_volume *vol, ntfs_inode *inode, int s, int f) +static int ntfs_test_bmp (ntfs_volume *vol, ntfs_inode *inode) { ntfs_inode *volbmp; struct ntfs_bmp *bmp; + struct ntfs_bmp *bmp2; //u8 *buffer; //int i; @@ -3242,9 +3284,14 @@ static int ntfs_test_bmp (ntfs_volume *vol, ntfs_inode *inode, int s, int f) if (!bmp) return 1; - if (0) utils_free_non_residents2 (inode, bmp); + bmp2 = ntfs_bmp_alloc (vol->mft_ni, AT_BITMAP, NULL, 0); + if (!bmp2) + return 1; - ntfs_bmp_set_range (bmp, s, f, 1); + if (0) ntfs_bmp_set_range (bmp, 0, 9, 1); + if (0) utils_free_non_residents2 (inode, bmp); + if (0) utils_mftrec_mark_free3 (bmp2, inode->mft_no); + if (0) utils_mftrec_mark_free4 (inode); ntfs_bmp_free (bmp); return 0; @@ -3272,8 +3319,7 @@ int main (int argc, char *argv[]) utils_set_locale(); #if 0 - printf ("sizeof (bmp_page) = %d\n", sizeof (struct bmp_page)); - printf ("sizeof (mft_bitmap) = %d\n", sizeof (struct mft_bitmap)); + printf ("sizeof (ntfs_bmp) = %d\n", sizeof (struct ntfs_bmp)); printf ("sizeof (ntfs_dt) = %d\n", sizeof (struct ntfs_dt)); printf ("sizeof (ntfs_dir) = %d\n", sizeof (struct ntfs_dir)); printf ("\n"); @@ -3299,7 +3345,7 @@ int main (int argc, char *argv[]) if (0) result = ntfs_ie_test(); if (0) result = ntfs_file_add (vol, opts.file); if (0) result = ntfs_file_remove (vol, opts.file); - if (0) result = ntfs_test_bmp (vol, inode, s, f-s+1); + if (0) result = ntfs_test_bmp (vol, inode); done: ntfs_inode_close (inode); From 2e579e14a7f37ce38d777c24a77cf3913b69f5be Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 27 Jun 2004 01:05:48 +0000 Subject: [PATCH 1557/2994] ntfsrm: make mft modifications in memory BKrev: 40de1d6cdb3V3VSrY1zusTN1vCbBnQ From 07ef30bdf68dbf9dc3ae436579e5ec922dc20851 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 28 Jun 2004 23:05:50 +0000 Subject: [PATCH 1558/2994] wipe_tails: * proper implementation of wipe_compressed_attribute * various fixes (Logical change 1.444) --- ntfsprogs/ntfswipe.c | 233 ++++++++++++++++--------------------------- 1 file changed, 88 insertions(+), 145 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 34960fa2..38a3a0b6 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -398,64 +398,47 @@ free: * wipe_compressed_attribute - Wipe compressed $DATA attribute * @vol: An ntfs volume obtained from ntfs_mount * @byte: Overwrite with this value + * @na: Opened ntfs attribute * @act: Wipe, test or info - * @attr: A vaild $DATA attribute record - * @compr_unit: Compression unit obtained from first $DATA attribute (because in other - * it 0) - * @tail: If last is not compressed, how many we have to wipe in it end * * Return: >0 Success, the atrribute was wiped * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, enum action act, - ATTR_RECORD *attr, u8 compr_unit, u32 tail) +static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, ntfs_attr *na, + enum action act) { - runlist *rl; unsigned char *buf; s64 size; u64 offset; u16 block_size; - u64 wiped = 0; s64 ret; - runlist *rlc; - u64 cu_mask; - - if (compr_unit != 4) - Eprintf ("strange: compression unit is %u (not 4)\n", compr_unit); - - if (!compr_unit) { - Vprintf ("Internal error\n"); - Eprintf ("Compression unit could not be 0"); - return -1; - } - - cu_mask = (1 << compr_unit) - 1; - - rl = ntfs_mapping_pairs_decompress(vol, attr, 0); - if (!rl) { - Vprintf ("Internal error\n"); - Eprintf ("Could not decompress mapping pairs inode"); - return -1; - } - - rlc = rl; + u64 wiped = 0; + VCN cur_vcn = 0; + runlist *rlc = na->rl; + u64 cu_mask = na->compression_block_clusters - 1; + while (rlc->length) { - if ((!(rlc->length & cu_mask) && ((rlc+1)->length || !tail)) - || (rlc->lcn < 0)) { + cur_vcn += rlc->length; + if ((cur_vcn & cu_mask) || + (((rlc + 1)->length) && (rlc->lcn != LCN_HOLE))) { rlc++; continue; } - - if (rlc->length & cu_mask) { - offset = (rlc->length & (~cu_mask)) << vol->cluster_size_bits; + + if (rlc->lcn == LCN_HOLE) { + offset = cur_vcn - rlc->length; + if (offset == (offset & (~cu_mask))) { + rlc++; + continue; + } + offset = (offset & (~cu_mask)) << vol->cluster_size_bits; while (1) { - ret = ntfs_rl_pread (vol, rlc, offset, 2, &block_size); + ret = ntfs_rl_pread (vol, na->rl, offset, 2, &block_size); if (ret != 2) { Vprintf ("Internal error\n"); Eprintf ("ntfs_rl_pread failed"); - wiped = -1; - goto free_rl; + return -1; } if (block_size == 0) { offset += 2; @@ -464,15 +447,24 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, enum action ac block_size &= 0x0FFF; block_size += 3; offset += block_size; - if (offset >= (rlc->length << vol->cluster_size_bits) - 2) + if (offset >= (((cur_vcn - rlc->length) + << vol->cluster_size_bits) - 2)) goto next; } - size = (rlc->length << vol->cluster_size_bits) - offset; + size = ((cur_vcn - rlc->length) + << vol->cluster_size_bits) - offset; } else { - size = tail; - offset = (rlc->length << vol->cluster_size_bits) - tail; + size = na->allocated_size - na->data_size; + offset = (cur_vcn << vol->cluster_size_bits) - size; } - + + if (size < 0) { + Vprintf ("Internal error\n"); + Eprintf ("bug or damaged fs: we want allocate buffer " + "size %lld bytes", size); + return -1; + } + if ((act == act_info) || (!size)) { wiped += size; rlc++; @@ -483,26 +475,22 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, enum action ac if (!buf) { Vprintf ("Not enough memory\n"); Eprintf ("Not enough memory to allocate %lld bytes", size); - wiped = -1; - goto free_rl; + return -1; } memset (buf, byte, size); - ret = ntfs_rl_pwrite (vol, rlc, offset, size, buf); + ret = ntfs_rl_pwrite (vol, na->rl, offset, size, buf); + free (buf); if (ret != size) { Vprintf ("Internal error\n"); Eprintf ("ntfs_rl_pwrite failed"); - free (buf); - wiped = -1; - goto free_rl; + return -1; } - free (buf); wiped += ret; next: rlc++; } -free_rl: - free (rl); + return wiped; } @@ -510,19 +498,28 @@ free_rl: * wipe_attribute - Wipe not compressed $DATA attribute * @vol: An ntfs volume obtained from ntfs_mount * @byte: Overwrite with this value - * @attr: A vaild $DATA attribute record - * @size: How many bytes to wipe - * @offset: Offset where start wiping + * @na: Opened ntfs attribute + * @act: Wipe, test or info * * Return: >0 Success, the atrribute was wiped + * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_attribute (ntfs_volume *vol, int byte, ATTR_RECORD *attr, - s64 size, u64 offset) +static s64 wipe_attribute (ntfs_volume *vol, int byte, ntfs_attr *na, enum action act) { - runlist *rl; unsigned char *buf; s64 wiped; + s64 size; + u64 offset = na->data_size; + + if (!offset) + return 0; + if (NAttrEncrypted(na)) + offset = (((offset - 1) >> 10) + 1) << 10; + size = (vol->cluster_size - offset) % vol->cluster_size; + + if (act == act_info) + return size; buf = malloc (size); if (!buf) { @@ -532,22 +529,12 @@ static s64 wipe_attribute (ntfs_volume *vol, int byte, ATTR_RECORD *attr, } memset (buf, byte, size); - rl = ntfs_mapping_pairs_decompress(vol, attr, 0); - if (!rl) { - Vprintf ("Internal error\n"); - Eprintf ("Could not decompress mapping pairs"); - wiped = -1; - goto free_buf; - } - - wiped = ntfs_rl_pwrite (vol, rl, offset, size, buf); + wiped = ntfs_rl_pwrite (vol, na->rl, offset, size, buf); if (wiped == -1) { Vprintf ("Internal error\n"); Eprintf ("Couldn't wipe tail"); } - free (rl); -free_buf: free (buf); return wiped; } @@ -569,9 +556,8 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) { s64 total = 0; s64 inode_num; - ntfs_attr_search_ctx *ctx; ntfs_inode *ni; - ATTR_RECORD *attr; + ntfs_attr *na; if (!vol || (byte < 0)) return -1; @@ -583,94 +569,51 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) Vprintf ("Could not open inode\n"); continue; } - + if (ni->mrec->base_mft_record) { Vprintf ("Not base mft record. Skipping\n"); goto close_inode; } - - ctx = ntfs_attr_get_search_ctx(ni, 0); - if (!ctx) { - Vprintf ("Internal error\n"); - Eprintf ("Could not get search context (inode %lld)\n",inode_num); + + na = ntfs_attr_open (ni, AT_DATA, AT_UNNAMED, 0); + if (!na) { + Vprintf ("Couldn't open $DATA attribute\n"); goto close_inode; } - u64 wiped_in_file = 0; - u8 compr_unit; - s64 size = -1; - u64 offset; - VCN last_vcn; - u32 tail; - ATTR_RECORD *first_attr = 0; - while (!ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - attr = ctx->attr; - - if (!attr->non_resident) { - Vprintf ("Resident $DATA atrribute. Skipping.\n"); - goto put_search_ctx; - } - - if (!first_attr) { - first_attr = attr; - if (attr->compression_unit) { - compr_unit = attr->compression_unit; - tail = attr->allocated_size - attr->data_size; - } - } - - s64 wiped; - if (first_attr->flags & ATTR_IS_COMPRESSED) { - Vprintf ("Compressed $DATA attribute. Not supported yet ;(\n"); - goto put_search_ctx; -// wiped = wipe_compressed_attribute (vol, byte, act, -// attr, compr_unit, tail); - } else { - if (size == -1) { - offset = attr->data_size; - if (!offset) - break; - if (attr->flags & ATTR_IS_ENCRYPTED) - offset = (((offset - 1) >> 10) + 1) << 10; - size = (vol->cluster_size - offset) % - vol->cluster_size; - last_vcn = attr->data_size >> - vol->cluster_size_bits; - } - if (!size) { - wiped_in_file = 0; - break; - } - if (act == act_info) { - wiped_in_file = size; - break; - } - if (attr->highest_vcn == last_vcn) - wiped = wipe_attribute (vol, byte, attr, - size, offset); - else - continue; - } - - if (wiped != -1) - wiped_in_file += wiped; - else { - Eprintf (" (inode %lld)\n", inode_num); - goto put_search_ctx; - } + if (!NAttrNonResident(na)) { + Vprintf ("Resident $DATA atrribute. Skipping.\n"); + goto close_attr; } - if (wiped_in_file) { - Vprintf ("Wiped %llu bytes\n", wiped_in_file); - total += wiped_in_file; + if (ntfs_attr_map_whole_runlist(na)) { + Vprintf ("Internal error\n"); + Eprintf ("Couldn't map runlist (inode %lld)", inode_num); + goto close_attr; + } + + s64 wiped; + if (NAttrCompressed(na)) + wiped = wipe_compressed_attribute (vol, byte, na, act); + else + wiped = wipe_attribute (vol, byte, na, act); + + if (wiped == -1) { + Eprintf (" (inode %lld)\n", inode_num); + goto close_attr; + } + + if (wiped) { + Vprintf ("Wiped %llu bytes\n", wiped); + total += wiped; } else Vprintf ("Nothing to wipe\n"); -put_search_ctx: - ntfs_attr_put_search_ctx (ctx); +close_attr: + ntfs_attr_close (na); close_inode: ntfs_inode_close (ni); } - Qprintf ("wipe_tails 0x%02x, %lld bytes\n", byte, (long long)total); + Qprintf ("wipe_tails 0x%02x, %lld bytes\n", byte, total); return total; } From 5ec44c6f680545f16a1788a455af7e5b23485de6 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 28 Jun 2004 23:05:50 +0000 Subject: [PATCH 1559/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/06/28 16:13:42+03:00 (none)!yura ntfswipe: fixes to wipe_tails wipe_tails looks pretty complete! BKrev: 40e0a44eP8B1Ua-nl0-sL2jD-Msswg From 3a415641731e1b1a420f011d7564eff2b1966309 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 4 Jul 2004 16:41:24 +0000 Subject: [PATCH 1560/2994] Various cleanups and fixes (Logical change 1.445) --- ntfsprogs/ntfswipe.c | 208 +++++++++++++++++++++++-------------------- 1 file changed, 113 insertions(+), 95 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 38a3a0b6..313d4968 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -57,6 +57,7 @@ static void version (void) printf ("\n%s v%s - Overwrite the unused space on an NTFS Volume.\n\n", EXEC_NAME, VERSION); printf ("Copyright (c) 2002-2003 Richard Russon\n"); + printf ("Copyright (c) 2004 Yura Pakhuchiy\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -348,8 +349,9 @@ static int parse_options (int argc, char *argv[]) * * Read $Bitmap and wipe any clusters that are marked as not in use. * - * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong + * Return: >0 Success, the atrribute was wiped + * 0 Nothing to wipe + * -1 Error, something went wrong */ static s64 wipe_unused (ntfs_volume *vol, int byte, enum action act) { @@ -625,8 +627,9 @@ close_inode: * MFT Records are 1024 bytes long, but some of this space isn't used. Wipe any * unused space at the end of the record and wipe any unused records. * - * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong + * Return: >0 Success, the clusters were wiped + * 0 Nothing to wipe + * -1 Error, something went wrong */ static s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) { @@ -755,8 +758,9 @@ free: * Directories are kept in sorted B+ Trees. Index blocks may not be full. Wipe * the unused space at the ends of these blocks. * - * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong + * Return: >0 Success, the clusters were wiped + * 0 Nothing to wipe + * -1 Error, something went wrong */ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) { @@ -775,8 +779,9 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) * The logfile journals the metadata to give the volume fault-tolerance. If the * volume is in a consistant state, then this information can be erased. * - * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong + * Return: >0 Success, the clusters were wiped + * 0 Nothing to wipe + * -1 Error, something went wrong */ static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act) { @@ -834,91 +839,7 @@ static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act) goto io_error_exit; } - /* Fill the buffer with 0xff's. */ - memset(buf, -1, NTFS_BUF_SIZE2); - - /* Set the $DATA attribute. */ - pos = 0; - while ((count = len - pos) > 0) { - if (count > NTFS_BUF_SIZE2) - count = NTFS_BUF_SIZE2; - - if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { - Dprintf("Failed to set the $LogFile attribute value."); - if (count != -1) - errno = EIO; - goto io_error_exit; - } - - pos += count; - } - - ntfs_attr_close(na); - return ntfs_inode_close(ni); - -io_error_exit: - eo = errno; - ntfs_attr_close(na); - errno = eo; -error_exit: - eo = errno; - ntfs_inode_close(ni); - errno = eo; - return -1; - return 0; -} - -/** - * wipe_pagefile - Wipe the pagefile (swap space) - * @vol: An ntfs volume obtained from ntfs_mount - * @byte: Overwrite with this value - * - * pagefile.sys is used by Windows as extra virtual memory (swap space). - * Windows recreates the file at bootup, so it can be wiped without harm. - * - * Return: 1 Success, the clusters were wiped - * 0 Error, something went wrong - */ -static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act) -{ - // wipe completely, chkdsk doesn't do anything, booting writes header - const int NTFS_BUF_SIZE2 = 4096; - ntfs_inode *ni; - ntfs_attr *na; - s64 len, pos, count; - char buf[NTFS_BUF_SIZE2]; - int eo; - - if (!vol || (byte < 0)) - return -1; - - //Qprintf ("wipe_pagefile (not implemented) 0x%02x\n", byte); - - ni = utils_pathname_to_inode (vol, NULL, "pagefile.sys"); - if (!ni) { - Dprintf("Failed to open inode FILE_LogFile.\n"); - return -1; - } - - if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) { - Dprintf("Failed to open $FILE_LogFile/$DATA\n"); - goto error_exit; - } - - /* The $DATA attribute of the $LogFile has to be non-resident. */ - if (!NAttrNonResident(na)) { - Dprintf("$LogFile $DATA attribute is resident!?!\n"); - errno = EIO; - goto io_error_exit; - } - - /* Get length of $LogFile contents. */ - len = na->data_size; - if (!len) { - Dprintf("$LogFile has zero length, no disk write needed.\n"); - return 0; - } - + /* Fill the buffer with @byte's. */ memset(buf, byte, NTFS_BUF_SIZE2); /* Set the $DATA attribute. */ @@ -938,7 +859,95 @@ static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act) } ntfs_attr_close(na); - return ntfs_inode_close(ni); + ntfs_inode_close(ni); + Qprintf ("wipe_logfile 0x%02x, %lld bytes\n", byte, pos); + return pos; + +io_error_exit: + eo = errno; + ntfs_attr_close(na); + errno = eo; +error_exit: + eo = errno; + ntfs_inode_close(ni); + errno = eo; + return -1; +} + +/** + * wipe_pagefile - Wipe the pagefile (swap space) + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * + * pagefile.sys is used by Windows as extra virtual memory (swap space). + * Windows recreates the file at bootup, so it can be wiped without harm. + * + * Return: >0 Success, the clusters were wiped + * 0 Nothing to wipe + * -1 Error, something went wrong + */ +static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act) +{ + // wipe completely, chkdsk doesn't do anything, booting writes header + const int NTFS_BUF_SIZE2 = 4096; + ntfs_inode *ni; + ntfs_attr *na; + s64 len, pos, count; + char buf[NTFS_BUF_SIZE2]; + int eo; + + if (!vol || (byte < 0)) + return -1; + + //Qprintf ("wipe_pagefile (not implemented) 0x%02x\n", byte); + + ni = utils_pathname_to_inode (vol, NULL, "pagefile.sys"); + if (!ni) { + Dprintf("Failed to open inode of pagefile.sys.\n"); + return 0; + } + + if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) { + Dprintf("Failed to open pagefile.sys/$DATA\n"); + goto error_exit; + } + + /* The $DATA attribute of the pagefile.sys has to be non-resident. */ + if (!NAttrNonResident(na)) { + Dprintf("pagefile.sys $DATA attribute is resident!?!\n"); + errno = EIO; + goto io_error_exit; + } + + /* Get length of pagfile.sys contents. */ + len = na->data_size; + if (!len) { + Dprintf("pagefile.sys has zero length, no disk write needed.\n"); + return 0; + } + + memset(buf, byte, NTFS_BUF_SIZE2); + + /* Set the $DATA attribute. */ + pos = 0; + while ((count = len - pos) > 0) { + if (count > NTFS_BUF_SIZE2) + count = NTFS_BUF_SIZE2; + + if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { + Dprintf("Failed to set the pagefile.sys attribute value."); + if (count != -1) + errno = EIO; + goto io_error_exit; + } + + pos += count; + } + + ntfs_attr_close(na); + ntfs_inode_close(ni); + Qprintf ("wipe_pagefile 0x%02x, %lld bytes\n", byte, pos); + return pos; io_error_exit: eo = errno; @@ -961,6 +970,7 @@ error_exit: * Return: 1 Success, displayed some info * 0 Error, something went wrong */ +#if 0 static int ntfs_info (ntfs_volume *vol) { u8 *buffer; @@ -1128,6 +1138,7 @@ bmpdone: return 1; } +#endif /** * print_summary - Tell the user what we are about to do @@ -1220,7 +1231,7 @@ int main (int argc, char *argv[]) sleep (5); } - if (0) +#if 0 { int i = 0; runlist_element *rl = vol->mft_na->rl; @@ -1234,6 +1245,7 @@ int main (int argc, char *argv[]) (long long)rl->lcn, (long long)rl->length); return 0; } +#endif printf ("\n"); for (i = 0; i < opts.count; i++) { @@ -1297,6 +1309,12 @@ int main (int argc, char *argv[]) printf ("%lld bytes were wiped\n", (long long)total); } + + if (opts.logfile && (opts.bytes[j - 1] != 0xFF) && (act != act_info)) { + printf ("Fixing logfile: "); + wipe_logfile (vol, 0xFF, act); + } + if (ntfs_volume_set_flags (vol, VOLUME_IS_DIRTY) < 0) { Eprintf ("Couldn't mark volume dirty\n"); From 84d353521613b50b6f7e5915910c9b3187c28d9c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 4 Jul 2004 16:41:24 +0000 Subject: [PATCH 1561/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/07/02 20:17:23+03:00 (none)!yura ntfswipe: various cleanups and fixes BKrev: 40e83334I0ihCAUeHz5hQDaixH0NQw From 5435e5faef567255ed8ae539ff52033263181150 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 6 Jul 2004 19:53:05 +0000 Subject: [PATCH 1562/2994] * endian fix * indention fixes (Logical change 1.446) --- ntfsprogs/ntfsinfo.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index b99d5e6b..2a1d32de 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -675,17 +675,20 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v if (attr->non_resident) { runlist *rl = ntfs_mapping_pairs_decompress(vol, attr, 0); if (rl) { - sec_desc_attr = malloc(attr->data_size); + s64 data_size = sle64_to_cpu(attr->data_size); + sec_desc_attr = malloc(data_size); s64 bytes_read = ntfs_rl_pread(vol, rl, 0, - attr->data_size, sec_desc_attr); - if (bytes_read != attr->data_size) { - Eprintf("ntfsinfo error: could not read secutiry descriptor\n"); + data_size, sec_desc_attr); + if (bytes_read != data_size) { + Eprintf("ntfsinfo error: could not " + "read secutiry descriptor\n"); free(sec_desc_attr); return; } free (rl); } else { - Eprintf("ntfsinfo error: could not decompress runlist\n"); + Eprintf("ntfsinfo error: could not " + "decompress runlist\n"); return; } } else { From 5286770d63da14d74472424c19c1347300d18299 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 6 Jul 2004 19:53:05 +0000 Subject: [PATCH 1563/2994] * wipe_directory implementation * don't force overwrite logfile with 0xFF for ntfs v3.1 * endian fix * indention fixes * cleanups * bugfix ntfswipe_tail for compressed blocks followed by >1 sparse blocks (Logical change 1.446) --- ntfsprogs/ntfswipe.c | 461 ++++++++++++++++++++++--------------------- 1 file changed, 240 insertions(+), 221 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 313d4968..1e4b280d 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -37,6 +37,8 @@ #include "volume.h" #include "utils.h" #include "debug.h" +#include "dir.h" +#include "mst.h" static char *EXEC_NAME = "ntfswipe"; static struct options opts; @@ -346,6 +348,7 @@ static int parse_options (int argc, char *argv[]) * wipe_unused - Wipe unused clusters * @vol: An ntfs volume obtained from ntfs_mount * @byte: Overwrite with this value + * @act: Wipe, test or info * * Read $Bitmap and wipe any clusters that are marked as not in use. * @@ -400,15 +403,15 @@ free: * wipe_compressed_attribute - Wipe compressed $DATA attribute * @vol: An ntfs volume obtained from ntfs_mount * @byte: Overwrite with this value - * @na: Opened ntfs attribute * @act: Wipe, test or info + * @na: Opened ntfs attribute * * Return: >0 Success, the atrribute was wiped * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, ntfs_attr *na, - enum action act) +static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, + enum action act, ntfs_attr *na) { unsigned char *buf; s64 size; @@ -434,9 +437,14 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, ntfs_attr *na, rlc++; continue; } - offset = (offset & (~cu_mask)) << vol->cluster_size_bits; + offset = (offset & (~cu_mask)) + << vol->cluster_size_bits; + runlist *rlt = rlc; + while ((rlt - 1)->lcn == LCN_HOLE) rlt--; while (1) { - ret = ntfs_rl_pread (vol, na->rl, offset, 2, &block_size); + ret = ntfs_rl_pread (vol, na->rl, + offset, 2, &block_size); + block_size = le16_to_cpu (block_size); if (ret != 2) { Vprintf ("Internal error\n"); Eprintf ("ntfs_rl_pread failed"); @@ -449,12 +457,11 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, ntfs_attr *na, block_size &= 0x0FFF; block_size += 3; offset += block_size; - if (offset >= (((cur_vcn - rlc->length) - << vol->cluster_size_bits) - 2)) + if (offset >= (((rlt->vcn) << + vol->cluster_size_bits) - 2)) goto next; } - size = ((cur_vcn - rlc->length) - << vol->cluster_size_bits) - offset; + size = (rlt->vcn << vol->cluster_size_bits) - offset; } else { size = na->allocated_size - na->data_size; offset = (cur_vcn << vol->cluster_size_bits) - size; @@ -462,8 +469,8 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, ntfs_attr *na, if (size < 0) { Vprintf ("Internal error\n"); - Eprintf ("bug or damaged fs: we want allocate buffer " - "size %lld bytes", size); + Eprintf ("bug or damaged fs: we want " + "allocate buffer size %lld bytes", size); return -1; } @@ -476,7 +483,8 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, ntfs_attr *na, buf = malloc (size); if (!buf) { Vprintf ("Not enough memory\n"); - Eprintf ("Not enough memory to allocate %lld bytes", size); + Eprintf ("Not enough memory to allocate " + "%lld bytes", size); return -1; } memset (buf, byte, size); @@ -485,7 +493,8 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, ntfs_attr *na, free (buf); if (ret != size) { Vprintf ("Internal error\n"); - Eprintf ("ntfs_rl_pwrite failed"); + Eprintf ("ntfs_rl_pwrite failed, offset %llu, " + "size %lld, vcn %lld", offset, size, rlc->vcn); return -1; } wiped += ret; @@ -500,14 +509,15 @@ next: * wipe_attribute - Wipe not compressed $DATA attribute * @vol: An ntfs volume obtained from ntfs_mount * @byte: Overwrite with this value - * @na: Opened ntfs attribute * @act: Wipe, test or info + * @na: Opened ntfs attribute * * Return: >0 Success, the atrribute was wiped * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_attribute (ntfs_volume *vol, int byte, ntfs_attr *na, enum action act) +static s64 wipe_attribute (ntfs_volume *vol, int byte, enum action act, + ntfs_attr *na) { unsigned char *buf; s64 wiped; @@ -590,15 +600,15 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) if (ntfs_attr_map_whole_runlist(na)) { Vprintf ("Internal error\n"); - Eprintf ("Couldn't map runlist (inode %lld)", inode_num); + Eprintf ("Can't map runlist (inode %lld)\n", inode_num); goto close_attr; } s64 wiped; if (NAttrCompressed(na)) - wiped = wipe_compressed_attribute (vol, byte, na, act); + wiped = wipe_compressed_attribute (vol, byte, act, na); else - wiped = wipe_attribute (vol, byte, na, act); + wiped = wipe_attribute (vol, byte, act, na); if (wiped == -1) { Eprintf (" (inode %lld)\n", inode_num); @@ -623,6 +633,7 @@ close_inode: * wipe_mft - Wipe the MFT slack space * @vol: An ntfs volume obtained from ntfs_mount * @byte: Overwrite with this value + * @act: Wipe, test or info * * MFT Records are 1024 bytes long, but some of this space isn't used. Wipe any * unused space at the end of the record and wipe any unused records. @@ -750,10 +761,127 @@ free: return total; } +/** + * wipe_index_allocation - Wipe $INDEX_ALLOCATION attribute + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * @act: Wipe, test or info + * @naa: Opened ntfs $INDEX_ALLOCATION attribute + * @nab: Opened ntfs $BIMTAP attribute + * + * Return: >0 Success, the clusters were wiped + * 0 Nothing to wipe + * -1 Error, something went wrong + */ +static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act, + ntfs_attr *naa, ntfs_attr *nab) { + const u32 indx_record_size = 4096; + s64 total = 0; + s64 wiped = 0; + s64 offset = 0; + s64 obyte = 0; + u64 wipe_offset; + s64 wipe_size; + u8 obit = 0; + u8 mask; + u8 *bitmap; + u8 *buf; + + bitmap = malloc (nab->data_size); + if (!bitmap) { + Vprintf ("malloc failed\n"); + Eprintf ("Couldn't allocate %lld bytes", nab->data_size); + return -1; + } + + if (ntfs_attr_pread (nab, 0, nab->data_size, bitmap) + != nab->data_size) { + Vprintf ("Internal error\n"); + Eprintf ("Couldn't read $BITMAP"); + total = -1; + goto free_bitmap; + } + + buf = malloc (indx_record_size); + if (!buf) { + Vprintf ("malloc failed\n"); + Eprintf ("Couldn't allocate %d bytes", indx_record_size); + total = -1; + goto free_bitmap; + } + + while (offset < naa->allocated_size) { + mask = 1 << obit; + if (bitmap[obyte] & mask) { + INDEX_ALLOCATION *indx; + + s64 ret = ntfs_rl_pread (vol, naa->rl, + offset, indx_record_size, buf); + if (ret != indx_record_size) { + Vprintf ("ntfs_rl_pread failed\n"); + Eprintf ("Couldn't read INDX record"); + total = -1; + goto free_buf; + } + + indx = (INDEX_ALLOCATION *) buf; + if (ntfs_mst_post_read_fixup ((NTFS_RECORD *)buf, + indx_record_size)) + Eprintf ("damaged fs: mst_post_read_fixup failed"); + + if ((le32_to_cpu(indx->index.allocated_size) + 0x18) != + indx_record_size) { + Vprintf ("Internal error\n"); + Eprintf ("INDX record should be 4096 bytes"); + total = -1; + goto free_buf; + } + + wipe_offset = le32_to_cpu(indx->index.index_length) + 0x18; + wipe_size = indx_record_size - wipe_offset; + memset (buf + wipe_offset, byte, wipe_size); + if (ntfs_mst_pre_write_fixup ((NTFS_RECORD *)indx, + indx_record_size)) + Eprintf ("damaged fs: mst_pre_write_protect failed"); + if (opts.verbose > 1) + Vprintf ("+"); + } else { + wipe_size = indx_record_size; + memset (buf, byte, wipe_size); + if (opts.verbose > 1) + Vprintf ("x"); + } + + wiped = ntfs_rl_pwrite (vol, naa->rl, offset, indx_record_size, buf); + if (wiped != indx_record_size) { + Vprintf ("ntfs_rl_pwrite failed\n"); + Eprintf ("Couldn't wipe tail of INDX record"); + total = -1; + goto free_buf; + } + total += wipe_size; + + offset += indx_record_size; + obit++; + if (obit > 7) { + obit = 0; + obyte++; + } + } + if ((opts.verbose > 1) && (wiped != -1)) + Vprintf ("\n\t"); +free_buf: + free (buf); +free_bitmap: + free (bitmap); + return total; +} + /** * wipe_directory - Wipe the directory indexes - * @vol: An ntfs volume obtained from ntfs_mount - * @byte: Overwrite with this value + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * @act: Wipe, test or info * * Directories are kept in sorted B+ Trees. Index blocks may not be full. Wipe * the unused space at the ends of these blocks. @@ -764,17 +892,94 @@ free: */ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) { + s64 total = 0; + s64 inode_num; + ntfs_inode *ni; + ntfs_attr *naa; + ntfs_attr *nab; + if (!vol || (byte < 0)) return -1; - Qprintf ("wipe_directory (not implemented) 0x%02x\n", byte); - return 0; + for (inode_num = 5; inode_num < vol->nr_mft_records; inode_num++) { + Vprintf ("Inode %lld - ", inode_num); + ni = ntfs_inode_open (vol, inode_num); + if (!ni) { + if (opts.verbose > 2) + Vprintf ("Could not open inode\n"); + else + Vprintf ("\r"); + continue; + } + + if (ni->mrec->base_mft_record) { + if (opts.verbose > 2) + Vprintf ("Not base mft record. Skipping\n"); + else + Vprintf ("\r"); + goto close_inode; + } + + naa = ntfs_attr_open (ni, AT_INDEX_ALLOCATION, I30, 4); + if (!naa) { + if (opts.verbose > 2) + Vprintf ("Couldn't open $INDEX_ALLOCATION\n"); + else + Vprintf ("\r"); + goto close_inode; + } + + if (!NAttrNonResident(naa)) { + Vprintf ("Resident $INDEX_ALLOCATION\n"); + Eprintf ("damaged fs: Resident $INDEX_ALLOCATION " + "(inode %lld)\n", inode_num); + goto close_attr_a; + } + + if (ntfs_attr_map_whole_runlist(naa)) { + Vprintf ("Internal error\n"); + Eprintf ("Can't map runlist for $INDEX_ALLOCATION " + "(inode %lld)\n", inode_num); + goto close_attr_a; + } + + nab = ntfs_attr_open (ni, AT_BITMAP, I30, 4); + if (!nab) { + Vprintf ("Couldn't open $BITMAP\n"); + Eprintf ("damaged fs: $INDEX_ALLOCATION is present, " + "but we can't open $BITMAP with same " + "name (inode %lld)\n", inode_num); + goto close_attr_a; + } + + s64 wiped = wipe_index_allocation (vol, byte, act, naa, nab); + if (wiped == -1) { + Eprintf (" (inode %lld)\n", inode_num); + goto close_attr_b; + } + + if (wiped) { + Vprintf ("Wiped %llu bytes\n", wiped); + total += wiped; + } else + Vprintf ("Nothing to wipe\n"); +close_attr_b: + ntfs_attr_close (nab); +close_attr_a: + ntfs_attr_close (naa); +close_inode: + ntfs_inode_close (ni); + } + + Qprintf ("wipe_directory 0x%02x, %lld bytes\n", byte, total); + return total; } /** * wipe_logfile - Wipe the logfile (journal) * @vol: An ntfs volume obtained from ntfs_mount * @byte: Overwrite with this value + * @act: Wipe, test or info * * The logfile journals the metadata to give the volume fault-tolerance. If the * volume is in a consistant state, then this information can be erased. @@ -878,6 +1083,7 @@ error_exit: * wipe_pagefile - Wipe the pagefile (swap space) * @vol: An ntfs volume obtained from ntfs_mount * @byte: Overwrite with this value + * @act: Wipe, test or info * * pagefile.sys is used by Windows as extra virtual memory (swap space). * Windows recreates the file at bootup, so it can be wiped without harm. @@ -960,186 +1166,6 @@ error_exit: return -1; } -/** - * ntfs_info - Display information about the NTFS Volume - * @vol: An ntfs volume obtained from ntfs_mount - * - * Tell the user how much could be cleaned up. List the number of free - * clusters, MFT records, etc. - * - * Return: 1 Success, displayed some info - * 0 Error, something went wrong - */ -#if 0 -static int ntfs_info (ntfs_volume *vol) -{ - u8 *buffer; - - if (!vol) - return 0; - - Qprintf ("ntfs_info\n"); - - Qprintf ("\n"); - - Qprintf ("Cluster size = %u\n", (unsigned int)vol->cluster_size); - Qprintf ("Volume size = %lld clusters\n", (long long)vol->nr_clusters); - Qprintf ("Volume size = %lld bytes\n", - (long long)vol->nr_clusters * vol->cluster_size); - Qprintf ("Volume size = %lld MiB\n", (long long)vol->nr_clusters * - vol->cluster_size / (1024*1024)); /* round up? */ - - Qprintf ("\n"); - - // move back bufsize - buffer = malloc (vol->mft_record_size); - if (!buffer) - return 0; - - Qprintf ("cluster\n"); - //Qprintf ("allocated_size = %lld\n", vol->lcnbmp_na->allocated_size); - Qprintf ("data_size = %lld\n", (long long)vol->lcnbmp_na->data_size); - //Qprintf ("initialized_size = %lld\n", vol->lcnbmp_na->initialized_size); - - { - s64 offset; - s64 size = vol->lcnbmp_na->allocated_size; - int bufsize = vol->mft_record_size; - s64 use = 0; - s64 not = 0; - int i, j; - - for (offset = 0; offset < size; offset += bufsize) { - - if ((offset + bufsize) > size) - bufsize = size - offset; - - if (ntfs_attr_pread (vol->lcnbmp_na, offset, bufsize, buffer) < bufsize) { - Eprintf ("error\n"); - return 0; - } - - for (i = 0; i < bufsize; i++) { - for (j = 0; j < 8; j++) { - if ((((offset+i)*8) + j) >= vol->nr_clusters) - goto done; - if (buffer[i] & (1 << j)) { - //printf ("*"); - use++; - } else { - //printf ("."); - not++; - } - } - } - } -done: - - Qprintf ("cluster use %lld, not %lld, total %lld\n", (long long)use, - (long long)not, (long long)(use + not)); - Qprintf ("\n"); - - } - - { - u8 *bitmap; - s64 bmpoff; - s64 bmpsize = vol->mftbmp_na->data_size; - int bmpbufsize = 512; - int i, j; - s64 use = 0, not = 0; - - bitmap = malloc (bmpbufsize); - if (!bitmap) - return 0; - - printf ("mft has %lld records\n", (long long)vol->nr_mft_records); - - //Qprintf ("allocated_size = %lld\n", vol->mftbmp_na->allocated_size); - Qprintf ("data_size = %lld\n", (long long)vol->mftbmp_na->data_size); - //Qprintf ("initialized_size = %lld\n", vol->mftbmp_na->initialized_size); - - printf ("bmpsize = %lld\n", (long long)bmpsize); - for (bmpoff = 0; bmpoff < bmpsize; bmpoff += bmpbufsize) { - if ((bmpoff + bmpbufsize) > bmpsize) - bmpbufsize = bmpsize - bmpoff; - - //printf ("bmpbufsize = %d\n", bmpbufsize); - - if (ntfs_attr_pread (vol->mftbmp_na, bmpoff, bmpbufsize, bitmap) < bmpbufsize) { - Eprintf ("error\n"); - return 0; - } - - for (i = 0; i < bmpbufsize; i++) { - for (j = 0; j < 8; j++) { - if ((((bmpoff+i)*8) + j) >= vol->nr_mft_records) - goto bmpdone; - if (bitmap[i] & (1 << j)) { - //printf ("*"); - use++; - } else { - //printf ("."); - not++; - } - } - } - } - -bmpdone: - printf ("mft\n"); - printf ("use %lld, not %lld, total %lld\n", (long long)use, - (long long)not, (long long)(use + not)); - - free (bitmap); - } - - /* - * wipe_unused - volume = n clusters, u unused (%age & MB) - * $Bitmap - * vol->lcnbmp_na - * - * wipe_tails - volume = n files, total tail slack space - * $MFT, $DATA - * vol->mft_na - * - * wipe_mft - volume = n mft records, u unused, s total slack space - * $MFT, $BITMAP - * vol->mftbmp_na - * - * wipe_directory - volume has d dirs, t total slack space - * $MFT, $INDEX_ROOT, $INDEX_ALLOC, $BITMAP - * - * wipe_logfile - logfile is - * $MFT, $DATA - * - * wipe_pagefile - pagefile is - * $MFT, $DATA - */ - - free (buffer); -#if 0 - ntfs_inode *inode; - ntfs_attr *attr; - - inode = ntfs_inode_open (vol, 6); /* $Bitmap */ - if (!inode) - return 0; - - attr = ntfs_attr_open (inode, AT_DATA, NULL, 0); - if (!attr) - return 0; - - ntfs_attr_pread - - ntfs_attr_close (attr); - ntfs_inode_close (inode); -#endif - - return 1; -} -#endif - /** * print_summary - Tell the user what we are about to do * @@ -1231,22 +1257,6 @@ int main (int argc, char *argv[]) sleep (5); } -#if 0 - { - int i = 0; - runlist_element *rl = vol->mft_na->rl; - printf ("________________________________________________________________________________\n\n"); - for (; rl->length > 0; rl++, i++) { - printf ("%4d %lld,%lld,%lld\n", i, (long long)rl->vcn, - (long long)rl->lcn, - (long long)rl->length); - } - printf ("%4d %lld,%lld,%lld\n", i, (long long)rl->vcn, - (long long)rl->lcn, (long long)rl->length); - return 0; - } -#endif - printf ("\n"); for (i = 0; i < opts.count; i++) { int byte; @@ -1310,12 +1320,21 @@ int main (int argc, char *argv[]) printf ("%lld bytes were wiped\n", (long long)total); } - if (opts.logfile && (opts.bytes[j - 1] != 0xFF) && (act != act_info)) { - printf ("Fixing logfile: "); + /* + * We can't wipe logfile with something different from 0xFF on some volume + * versions, because chdsk doesn't like this. But on NTFS v3.1 chkdsk looks + * normal on logfile full of something different from 0xFF. + * + * FIXME: We need to determine on which versions beside 3.1 we can also + * ignore contents of logfile. + */ + if (opts.logfile && (opts.bytes[j - 1] != 0xFF) && (act != act_info) && + !NTFS_V3_1(vol->major_ver, vol->minor_ver)) { + printf ("Fixing logfile (because NTFS v%d.%d): ", + vol->major_ver, vol->minor_ver); wipe_logfile (vol, 0xFF, act); } - if (ntfs_volume_set_flags (vol, VOLUME_IS_DIRTY) < 0) { Eprintf ("Couldn't mark volume dirty\n"); } From b8c2ec25b6cb17f0c5987ab852eef7d4e14abc48 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 6 Jul 2004 19:53:05 +0000 Subject: [PATCH 1564/2994] fix comment (Logical change 1.446) --- libntfs/mst.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libntfs/mst.c b/libntfs/mst.c index 8c539028..f9f93e11 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -31,7 +31,8 @@ * * Perform the necessary post read multi sector transfer fixups and detect the * presence of incomplete multi sector transfers. - In that case, overwrite the - * magic of the ntfs record header being processed with "BAAD" (in memory only!) * and abort processing. + * magic of the ntfs record header being processed with "BAAD" (in memory only!) + * and abort processing. * * Return 0 on success and -1 on error, with errno set to the error code. The * following error codes are defined: From 3145f17897a89e9af811e4c8000699bfa85689b7 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 6 Jul 2004 19:53:05 +0000 Subject: [PATCH 1565/2994] update for wipe_directory (Logical change 1.446) --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2f47eab9..3fd5b83e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,7 +21,7 @@ xx/xx/2004 - 1.9.3-WIP - Undelete: add ability to recover ranges of inodes. (Holger Ohmacht) - Lots of updates to ntfsinfo, see "bk changes". (Yuval) - Fix crash in ntfsinfo for non-resident Security Info. (Yura) - - ntfswipe - wipe file tails (Yura) + - ntfswipe - wipe file tails and directory indexes (Yura) - Bugfix in ntfs_rl_pread,pwrite for pos > 0. (Yura) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. From 2ff36e86347a7d39067e3efac46879b5774fe5ea Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 6 Jul 2004 19:53:05 +0000 Subject: [PATCH 1566/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/07/06 21:46:22+03:00 (none)!yura ntfswipe: * wipe_directory implementation * don't force overwrite logfile with 0xFF for ntfs v3.1 * bugfix in wipe_tails * cleanups ntfswipe and ntfsinfo: * endian fixes * indention fixes BKrev: 40eb0321Dbr8VlYY1kzajoFrbO1XzA From 82a284b4abca14ac59909c1839f37dc7cb644057 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 7 Jul 2004 12:49:45 +0000 Subject: [PATCH 1567/2994] Use libntfs/volume.c::ntfs_logfile_reset() instead of wipe_logfile() at the end of ntfswipe.c. Also, always do the reset (unless act == act_info) to ensure windows can boot and so journal replay does not cause corruption. (Logical change 1.447) --- ntfsprogs/ntfswipe.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 1e4b280d..d9e2d933 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -1319,22 +1319,14 @@ int main (int argc, char *argv[]) printf ("%lld bytes were wiped\n", (long long)total); } - /* - * We can't wipe logfile with something different from 0xFF on some volume - * versions, because chdsk doesn't like this. But on NTFS v3.1 chkdsk looks - * normal on logfile full of something different from 0xFF. - * - * FIXME: We need to determine on which versions beside 3.1 we can also - * ignore contents of logfile. + * We need to reset the logfile so Windows can boot and so journal + * replay does not cause corruption. */ - if (opts.logfile && (opts.bytes[j - 1] != 0xFF) && (act != act_info) && - !NTFS_V3_1(vol->major_ver, vol->minor_ver)) { - printf ("Fixing logfile (because NTFS v%d.%d): ", - vol->major_ver, vol->minor_ver); - wipe_logfile (vol, 0xFF, act); + if (act != act_info) { + printf ("Resetting logfile.\n"); + ntfs_logfile_reset(vol); } - if (ntfs_volume_set_flags (vol, VOLUME_IS_DIRTY) < 0) { Eprintf ("Couldn't mark volume dirty\n"); } From 4ea006cda2d8ea83f01e4d16edc5864ec30d067a Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 7 Jul 2004 12:49:45 +0000 Subject: [PATCH 1568/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/07/07 09:25:39+01:00 cantab.net!aia21 Fix potential corruption due to journal replay in ntfswipe.c by always calling libntfs/volume.c::ntfs_logfile_reset() (unless act == act_info) at the end of ntfswipe.c. This also ensures Windows is able to boot this partition. BKrev: 40ebf169zTpbWwoYaiqOhzNr8yBuJg From 631668c253dc8bdf994c6db6b519ea5dcf78e392 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 8 Jul 2004 20:19:52 +0000 Subject: [PATCH 1569/2994] Added code to determine INDX record size from $INDEX_ROOT (Logical change 1.448) --- ntfsprogs/ntfswipe.c | 84 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 16 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index d9e2d933..034e5bba 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -763,19 +763,19 @@ free: /** * wipe_index_allocation - Wipe $INDEX_ALLOCATION attribute - * @vol: An ntfs volume obtained from ntfs_mount - * @byte: Overwrite with this value - * @act: Wipe, test or info - * @naa: Opened ntfs $INDEX_ALLOCATION attribute - * @nab: Opened ntfs $BIMTAP attribute + * @vol: An ntfs volume obtained from ntfs_mount + * @byte: Overwrite with this value + * @act: Wipe, test or info + * @naa: Opened ntfs $INDEX_ALLOCATION attribute + * @nab: Opened ntfs $BIMTAP attribute + * @indx_record_size: Size of INDX record * * Return: >0 Success, the clusters were wiped * 0 Nothing to wipe * -1 Error, something went wrong */ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act, - ntfs_attr *naa, ntfs_attr *nab) { - const u32 indx_record_size = 4096; + ntfs_attr *naa, ntfs_attr *nab, u32 indx_record_size) { s64 total = 0; s64 wiped = 0; s64 offset = 0; @@ -832,7 +832,8 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act, if ((le32_to_cpu(indx->index.allocated_size) + 0x18) != indx_record_size) { Vprintf ("Internal error\n"); - Eprintf ("INDX record should be 4096 bytes"); + Eprintf ("INDX record should be %u bytes", + indx_record_size); total = -1; goto free_buf; } @@ -877,6 +878,31 @@ free_bitmap: return total; } +/** + * get_indx_record_size - determine size of INDX record from $INDEX_ROOT + * @nar: Opened ntfs $INDEX_ROOT attribute + * + * Return: >0 Success, return INDX record size + * 0 Error, something went wrong + */ +static u32 get_indx_record_size (ntfs_attr *nar) +{ + u32 indx_record_size; + + if (ntfs_attr_pread (nar, 8, 4, &indx_record_size) != 4) { + Vprintf ("Couldn't determine size of INDX record\n"); + Eprintf ("ntfs_attr_pread failed"); + return 0; + } + + indx_record_size = le32_to_cpu (indx_record_size); + if (!indx_record_size) { + Vprintf ("Internal error\n"); + Eprintf ("INDX record should be 0"); + } + return indx_record_size; +} + /** * wipe_directory - Wipe the directory indexes * @vol: An ntfs volume obtained from ntfs_mount @@ -897,6 +923,7 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) ntfs_inode *ni; ntfs_attr *naa; ntfs_attr *nab; + ntfs_attr *nar; if (!vol || (byte < 0)) return -1; @@ -933,29 +960,52 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) Vprintf ("Resident $INDEX_ALLOCATION\n"); Eprintf ("damaged fs: Resident $INDEX_ALLOCATION " "(inode %lld)\n", inode_num); - goto close_attr_a; + goto close_attr_allocation; } if (ntfs_attr_map_whole_runlist(naa)) { Vprintf ("Internal error\n"); Eprintf ("Can't map runlist for $INDEX_ALLOCATION " "(inode %lld)\n", inode_num); - goto close_attr_a; + goto close_attr_allocation; } - + nab = ntfs_attr_open (ni, AT_BITMAP, I30, 4); if (!nab) { Vprintf ("Couldn't open $BITMAP\n"); Eprintf ("damaged fs: $INDEX_ALLOCATION is present, " "but we can't open $BITMAP with same " "name (inode %lld)\n", inode_num); - goto close_attr_a; + goto close_attr_allocation; } - s64 wiped = wipe_index_allocation (vol, byte, act, naa, nab); + nar = ntfs_attr_open (ni, AT_INDEX_ROOT, I30, 4); + if (!nar) { + Vprintf ("Couldn't open $INDEX_ROOT\n"); + Eprintf ("damaged fs: $INDEX_ALLOCATION is present, but " + "we can't open $INDEX_ROOT with same name" + " (inode %lld)\n", inode_num); + goto close_attr_bitmap; + } + + if (NAttrNonResident(nar)) { + Vprintf ("Not resident $INDEX_ROOT\n"); + Eprintf ("damaged fs: Not resident $INDEX_ROOT " + "(inode %lld)\n", inode_num); + goto close_attr_root; + } + + u32 indx_record_size = get_indx_record_size (nar); + if (!indx_record_size) { + Eprintf (" (inode %lld)\n", inode_num); + goto close_attr_root; + } + + s64 wiped = wipe_index_allocation (vol, byte, act, + naa, nab, indx_record_size); if (wiped == -1) { Eprintf (" (inode %lld)\n", inode_num); - goto close_attr_b; + goto close_attr_root; } if (wiped) { @@ -963,9 +1013,11 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) total += wiped; } else Vprintf ("Nothing to wipe\n"); -close_attr_b: +close_attr_root: + ntfs_attr_close (nar); +close_attr_bitmap: ntfs_attr_close (nab); -close_attr_a: +close_attr_allocation: ntfs_attr_close (naa); close_inode: ntfs_inode_close (ni); From 5d43e167d5769b3956a07d7cc47548161101537f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 8 Jul 2004 20:19:52 +0000 Subject: [PATCH 1570/2994] Fixed bug that cause ntfs_attr_p{read,write} fail on resident encrypted attribute (Logical change 1.448) --- libntfs/attrib.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 81502626..1a39689f 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -713,10 +713,10 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) if (NAttrCompressed(na) && NAttrNonResident(na)) return ntfs_compressed_attr_pread(na, pos, count, b); /* - * Encrypted attributes are not supported. We return access denied, - * which is what Windows NT4 does, too. + * Encrypted non-resident attributes are not supported. We return + * access denied, which is what Windows NT4 does, too. */ - if (NAttrEncrypted(na)) { + if (NAttrEncrypted(na) && NAttrNonResident(na)) { errno = EACCES; return -1; } @@ -878,10 +878,10 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) } vol = na->ni->vol; /* - * Encrypted attributes are not supported. We return access denied, - * which is what Windows NT4 does, too. + * Encrypted non-resident attributes are not supported. We return + * access denied, which is what Windows NT4 does, too. */ - if (NAttrEncrypted(na)) { + if (NAttrEncrypted(na) && NAttrNonResident(na)) { errno = EACCES; return -1; } From 9576429f7ff53a80dcbc6dbeea934bc1ae23c538 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 8 Jul 2004 20:19:52 +0000 Subject: [PATCH 1571/2994] ntfs_rl_p{read,write}: "* vol->cluster_size" replaced with faster and more compatible "<< vol->cluster_size_bits" (Logical change 1.448) --- libntfs/runlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 0e6b2c75..7b8968fe 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1035,7 +1035,7 @@ s64 ntfs_rl_pread(const ntfs_volume *vol, const runlist_element *rl, /* Seek in @rl to the run containing @pos. */ for (ofs = 0; rl->length && (ofs + (rl->length << vol->cluster_size_bits) <= pos); rl++) - ofs += rl->length * vol->cluster_size; + ofs += (rl->length << vol->cluster_size_bits); /* Offset in the run at which to begin reading. */ ofs = pos - ofs; for (total = 0LL; count; rl++, ofs = 0) { @@ -1119,7 +1119,7 @@ s64 ntfs_rl_pwrite(const ntfs_volume *vol, const runlist_element *rl, /* Seek in @rl to the run containing @pos. */ for (ofs = 0; rl->length && (ofs + (rl->length << vol->cluster_size_bits) <= pos); rl++) - ofs += rl->length * vol->cluster_size; + ofs += (rl->length << vol->cluster_size_bits); /* Offset in the run at which to begin writing. */ ofs = pos - ofs; for (total = 0LL; count; rl++, ofs = 0) { From 8e0635f403ae564fdbc59e47c2850410e1c36122 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 8 Jul 2004 20:19:52 +0000 Subject: [PATCH 1572/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/07/08 14:39:16+03:00 (none)!yura fixes to ntfs_attr_p{read,write} and ntfs_rl_p{read,write} 2004/07/08 12:25:16+03:00 (none)!yura ntfswipe: Added code to determine INDX record size from $INDEX_ROOT BKrev: 40edac68ZLTHCGIRDg8U9IA77omIug From 31b8e1ecd431c4b09739be6b7e4cc0f39c8a3872 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 8 Jul 2004 23:47:42 +0000 Subject: [PATCH 1573/2994] fix root_replace finish off remove (Logical change 1.449) --- ntfsprogs/ntfsrm.c | 358 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 316 insertions(+), 42 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 2faeaf6f..28413e36 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -200,6 +200,18 @@ static void ntfs_ie_dump (INDEX_ENTRY *ie); static VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie); static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype); +#define RED "" +#define GREEN "" +#define YELLOW "" +#define BLUE "" +#define MAGENTA "" +#define CYAN "" +#define BOLD "" +#define END "" + +#define ROUND_UP(num,bound) (((num)+((bound)-1)) & ~((bound)-1)) +#define ATTR_SIZE(s) ROUND_UP(s,8) + /** * struct ntfs_bmp * a cache for either dir/$BITMAP, $MFT/$BITMAP or $Bitmap/$DATA @@ -220,9 +232,9 @@ struct ntfs_dt { struct ntfs_dt *parent; u8 *data; int data_len; - struct ntfs_dt **sub_nodes; int child_count; INDEX_ENTRY **children; + struct ntfs_dt **sub_nodes; INDEX_HEADER *header; VCN vcn; }; @@ -255,9 +267,13 @@ static void ntfs_name_print (ntfschar *name, int name_len) { char *buffer = NULL; - ntfs_ucstombs (name, name_len, (char**) &buffer, 0); - printf ("%s", buffer); - free (buffer); + if (name_len) { + ntfs_ucstombs (name, name_len, (char**) &buffer, 0); + printf ("%s", buffer); + free (buffer); + } else { + printf ("!"); + } } /** @@ -394,7 +410,7 @@ static u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn) int i; VCN begin; VCN end; - + if (!bmp) return NULL; @@ -450,7 +466,6 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, u64 length, int va #if 0 memset (buffer, 0xFF, 512); value = 0; -#else memset (buffer, 0x00, 512); value = 1; #endif @@ -512,7 +527,7 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, u64 length, int va //utils_dump_mem (buffer, 0, 16, DM_DEFAULTS); } - printf ("Modified: inode %lld, ", bmp->attr->ni->mft_no); + printf (GREEN "Modified: inode %lld, " END, bmp->attr->ni->mft_no); switch (bmp->attr->type) { case AT_BITMAP: printf ("$BITMAP"); break; case AT_DATA: printf ("$DATA"); break; @@ -522,6 +537,26 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, u64 length, int va return 1; } +/** + * ntfs_bmp_commit + */ +static int ntfs_bmp_commit (struct ntfs_bmp *bmp) +{ + if (!bmp) + return -1; + return 0; +} + +/** + * ntfs_bmp_rollback + */ +static int ntfs_bmp_rollback (struct ntfs_bmp *bmp) +{ + if (!bmp) + return -1; + return 0; +} + /** * ntfs_dt_alloc_children @@ -685,7 +720,6 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) return dt->child_count; } - /** * ntfs_dt_alloc */ @@ -1061,6 +1095,58 @@ static struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int n return res; } +/** + * ntfs_dt_commit + */ +static int ntfs_dt_commit (struct ntfs_dt *dt) +{ + if (!dt) + return -1; + return 0; +} + +/** + * ntfs_dt_rollback + */ +static int ntfs_dt_rollback (struct ntfs_dt *dt) +{ + if (!dt) + return -1; + return 0; +} + +/** + * ntfs_dt_find_parent + */ +static int ntfs_dt_find_parent (struct ntfs_dt *dt) +{ + int i; + struct ntfs_dt *parent; + + if (!dt) + return -1; + + parent = dt->parent; + if (!parent) + return -1; + + for (i = 0; i < parent->child_count; i++) + if (parent->sub_nodes[i] == dt) + return i; + + return -1; +} + +/** + * ntfs_dt_root + */ +static BOOL ntfs_dt_root (struct ntfs_dt *dt) +{ + if (!dt) + return FALSE; + return (dt->parent == NULL); +} + /** * ntfs_dir_alloc @@ -1194,6 +1280,34 @@ static void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) parent->children[parent->child_count-1] = child; } +/** + * ntfs_dir_commit + */ +static int ntfs_dir_commit (struct ntfs_dir *dir) +{ + if (!dir) + return -1; + + if (0) ntfs_dt_commit (NULL); + if (0) ntfs_bmp_commit (NULL); + + return 0; +} + +/** + * ntfs_dir_rollback + */ +static int ntfs_dir_rollback (struct ntfs_dir *dir) +{ + if (!dir) + return -1; + + if (0) ntfs_dt_rollback (NULL); + if (0) ntfs_bmp_rollback (NULL); + + return 0; +} + /** * utils_pathname_to_mftref @@ -1381,7 +1495,7 @@ static int utils_mftrec_mark_free4 (ntfs_inode *inode) //printf ("\n"); //utils_dump_mem (buffer, 0, 1024, DM_DEFAULTS); - printf ("Modified: inode %lld MFT_RECORD header\n", inode->mft_no); + printf (GREEN "Modified: inode %lld MFT_RECORD header\n" END, inode->mft_no); return 0; } @@ -1734,6 +1848,22 @@ static int ntfs_dt_add (struct ntfs_dt *parent, INDEX_ENTRY *ie) return 0; } +/** + * ntfs_dt_add2 + */ +static int ntfs_dt_add2 (INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs_dt *ded) +{ + if (!ie || !suc) + return -1; + + if (ntfs_dt_root (suc)) + ntfs_dt_add_root (suc, suc_num, ie); + else + ntfs_dt_add_alloc (suc, suc_num, ie); + + return 0; +} + /** * ntfs_dt_remove_alloc @@ -1973,10 +2103,10 @@ static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) if ((index_num < 0) || (index_num >= dt->child_count)) return 1; - if (dt->parent) - return ntfs_dt_remove_alloc (dt, index_num); - else + if (ntfs_dt_root (dt)) return ntfs_dt_remove_root (dt, index_num); + else + return ntfs_dt_remove_alloc (dt, index_num); } /** @@ -2140,8 +2270,6 @@ static int ntfsrm (ntfs_volume *vol, char *name) } -#define ATTR_SIZE(s) (((s)+7) & ~7) - /** * ntfsinfo_time_to_str() - * @sle_ntfs_clock: on disk time format in 100ns units since 1st jan 1601 @@ -2279,9 +2407,9 @@ static INDEX_ENTRY * ntfs_ie_set_vcn (INDEX_ENTRY *ie, VCN vcn) } /** - * ntfs_ie_remove_child + * ntfs_ie_remove_vcn */ -static INDEX_ENTRY * ntfs_ie_remove_child (INDEX_ENTRY *ie) +static INDEX_ENTRY * ntfs_ie_remove_vcn (INDEX_ENTRY *ie) { if (!ie) return NULL; @@ -2291,7 +2419,7 @@ static INDEX_ENTRY * ntfs_ie_remove_child (INDEX_ENTRY *ie) ie->length -= 8; ie->flags &= ~INDEX_ENTRY_NODE; ie = realloc (ie, ie->length); - return NULL; + return ie; } /** @@ -2438,7 +2566,7 @@ static int ntfs_ie_test (void) } if (1) { - ie1 = ntfs_ie_remove_child (ie1); + ie1 = ntfs_ie_remove_vcn (ie1); ntfs_ie_dump (ie1); } @@ -2605,6 +2733,9 @@ static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY * memcpy (dst, src, len); + src = (u8*) del->data; + dst = attr; + len = del->data_len + suc_ie->length - del_ie->length; free (del->data); del->data = attr; @@ -2614,24 +2745,29 @@ static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY * //utils_dump_mem (attr, 0, del->data_len, DM_DEFAULTS); + //printf ("\n"); + //printf (BOLD YELLOW "Adjust children\n" END); //for (i = 0; i < del->child_count; i++) - // printf ("Child %d %p\n", i, del->children[i]); + // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); //printf ("\n"); - len = suc_ie->length - del_ie->length + 8; - //printf ("len = %d\n", len); + len = suc_ie->length - del_ie->length; + //printf ("src = %p, dst = %p, len = %d\n", src, dst, len); fflush (stdout); + + for (i = 0; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) (dst + ((u8*) del->children[i] - src)); for (i = del_num+1; i < del->child_count; i++) del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); //for (i = 0; i < del->child_count; i++) - // printf ("Child %d %p\n", i, del->children[i]); + // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); //printf ("\n"); //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); //printf ("\n"); - printf ("Modified: inode %lld MFT_RECORD, attribute 0x90\n", del->dir->inode->mft_no); + printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); return TRUE; } @@ -2691,7 +2827,7 @@ static BOOL ntfs_dt_alloc_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - printf ("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", del->dir->inode->mft_no, del->vcn, del->vcn + 4); + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + 4); return TRUE; } @@ -2804,7 +2940,7 @@ static BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - printf ("Modified: inode %lld MFT_RECORD, attribute 0x90\n", del->dir->inode->mft_no); + printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); return TRUE; } @@ -2918,7 +3054,7 @@ static BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) printf ("\n"); #endif - printf ("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", del->dir->inode->mft_no, del->vcn, del->vcn + 4); + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + 4); return TRUE; } @@ -2993,7 +3129,7 @@ static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); //printf ("\n"); - printf ("Modified: inode %lld MFT_RECORD, attribute 0x90\n", add->dir->inode->mft_no); + printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, add->dir->inode->mft_no); return 0; } @@ -3059,7 +3195,7 @@ static int ntfs_dt_alloc_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); //printf ("\n"); - printf ("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", add->dir->inode->mft_no, add->vcn, add->vcn + 4); + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, add->dir->inode->mft_no, add->vcn, add->vcn + 4); return 0; } @@ -3151,15 +3287,23 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) struct ntfs_dir *find_dir = NULL; struct ntfs_dt *del = NULL; struct ntfs_dt *suc = NULL; + struct ntfs_dt *old = NULL; + struct ntfs_dt *par = NULL; + struct ntfs_dt *ded = NULL; MFT_REF mft_num; ntfschar *uname = NULL; int name_len; int del_num = 0; int suc_num = 0; + int par_num = -1; INDEX_ENTRY *del_ie = NULL; INDEX_ENTRY *suc_ie = NULL; + INDEX_ENTRY *par_ie = NULL; + INDEX_ENTRY *add_ie = NULL; int res; VCN vcn; + FILE_NAME_ATTR *file = NULL; + //int i; root_dir = ntfs_dir_alloc (vol, FILE_root); if (!root_dir) @@ -3195,6 +3339,8 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) */ if (del->header->flags & INDEX_NODE) { + printf (BOLD YELLOW "Replace key with its successor:\n" END); + vcn = ntfs_ie_get_vcn (del_ie); //printf ("vcn = %lld\n", vcn); @@ -3203,17 +3349,23 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) //printf ("\n"); suc_ie = ntfs_ie_copy (suc->children[suc_num]); - //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, DM_DEFAULTS); + //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); //printf ("\n"); suc_ie = ntfs_ie_set_vcn (suc_ie, vcn); - //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, DM_DEFAULTS); + //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); //printf ("\n"); - if (del->parent) - res = ntfs_dt_alloc_replace (del, del_num, del_ie, suc_ie); - else + file = &del_ie->key.file_name; printf ("\trep name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + file = &suc_ie->key.file_name; printf ("\tsuc name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + + //utils_dump_mem (del->data, 0, del->data_len, DM_BLUE|DM_GREEN|DM_INDENT); + if (ntfs_dt_root (del)) res = ntfs_dt_root_replace (del, del_num, del_ie, suc_ie); + else + res = ntfs_dt_alloc_replace (del, del_num, del_ie, suc_ie); + //printf ("\n"); + //utils_dump_mem (del->data, 0, del->data_len, DM_BLUE|DM_GREEN|DM_INDENT); free (suc_ie); @@ -3226,14 +3378,24 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) } /* - * Now we have the simple case of deleting from a leaf node. + * Now we have the simpler case of deleting from a leaf node. * If this step creates an empty node, we have more to do. */ - if (del->parent) - ntfs_dt_alloc_remove (del, del_num); - else + printf ("\n"); + printf (BOLD YELLOW "Delete key:\n" END); + + file = &del->children[del_num]->key.file_name; printf ("\tdel name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + + //utils_dump_mem (del->data, 0, del->header->index_length+24, DM_BLUE|DM_GREEN|DM_INDENT); + // XXX if del->child_count == 2, we could skip this step + // no, if we combine with another node, we'll have to remember + if (ntfs_dt_root (del)) ntfs_dt_root_remove (del, del_num); + else + ntfs_dt_alloc_remove (del, del_num); + //printf ("\n"); + //utils_dump_mem (del->data, 0, del->header->index_length+24, DM_BLUE|DM_GREEN|DM_INDENT); if (del->child_count > 1) // XXX ntfs_dt_empty (dt), ntfs_dt_full (dt, new) goto commit; @@ -3245,17 +3407,129 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) * successor. */ - // find the key which has no descendents - // unhook and hold onto the dt's - // unhook the key - // find successor + // find the key nearest the root which has no descendents + printf ("\n"); + printf (BOLD YELLOW "Find childless parent:\n" END); + for (par = del->parent, old = par; par; old = par, par = par->parent) { + if (par->child_count > 1) + break; + par_num = ntfs_dt_find_parent (par); + } + + //utils_dump_mem (par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); + + file = &par->children[par_num]->key.file_name; printf ("\tpar name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + + if (par == NULL) { + // unhook everything + printf ("whole dir is empty\n"); + goto freedts; + } + + printf ("\n"); + + //utils_dump_mem (par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); + //printf ("\n"); + + // find if parent has left siblings + if (par->children[par_num]->flags & INDEX_ENTRY_END) { + printf (BOLD YELLOW "Swap the children of the parent and its left sibling\n" END); + + par_ie = par->children[par_num]; + vcn = ntfs_ie_get_vcn (par_ie); + //printf ("\toffset = %d\n", (u8*)par_ie - par->data); printf ("\tflags = %d\n", par_ie->flags); printf ("\tvcn = %lld\n", vcn); printf ("\tlength = %d\n", par_ie->length); + //utils_dump_mem ((u8*)par_ie, 0, par_ie->length, DM_DEFAULTS); + //printf ("\n"); + + //printf ("\toffset = %d\n", (u8*)par_ie - par->data); printf ("\tflags = %d\n", par_ie->flags); printf ("\tvcn = %lld\n", vcn); printf ("\tlength = %d\n", par_ie->length); + //utils_dump_mem ((u8*)par_ie, 0, par_ie->length, DM_DEFAULTS); + //printf ("\n"); + + file = &par->children[par_num] ->key.file_name; printf ("\tpar name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + file = &par->children[par_num-1]->key.file_name; printf ("\tsib name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + + old = par->sub_nodes[par_num]; + par->sub_nodes[par_num] = par->sub_nodes[par_num-1]; + par->sub_nodes[par_num-1] = old; + + par_ie = par->children[par_num-1]; + vcn = ntfs_ie_get_vcn (par_ie); + + par_ie = par->children[par_num]; + ntfs_ie_set_vcn (par_ie, vcn); + + par_num--; + + if (ntfs_dt_root (par)) + printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, par->dir->inode->mft_no); + else + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, par->dir->inode->mft_no, par->vcn, par->vcn + 4); + } + + //printf ("\n"); + //utils_dump_mem (par->data, 0, par->data_len, DM_DEFAULTS); + + // unhook and hold onto the ded dt's + printf ("\n"); + printf (BOLD YELLOW "Remove parent\n" END); + + file = &par->children[par_num]->key.file_name; printf ("\tpar name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + + add_ie = ntfs_ie_copy (par->children[par_num]); + add_ie = ntfs_ie_remove_vcn (add_ie); + if (!add_ie) + goto done; + + //printf ("\n"); + //utils_dump_mem ((u8*)add_ie, 0, add_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); + + ded = par->sub_nodes[par_num]; + par->sub_nodes[par_num] = NULL; + //ntfs_dt_print (ded, 8); + + if (ntfs_dt_root (par)) + ntfs_dt_root_remove (par, par_num); + else + ntfs_dt_alloc_remove (par, par_num); + + printf ("\n"); + + file = &add_ie->key.file_name; + + suc = NULL; + suc_num = -1; + suc = ntfs_dt_find4 (find_dir->index, file->file_name, file->file_name_length, &suc_num); + + printf ("%p, %d\n", suc, suc_num); + + if (!suc) + goto done; + + file = &suc->children[suc_num]->key.file_name; printf ("\tsuc name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + // insert key into successor // if any new nodes are needed, reuse the preserved nodes + if (!ntfs_dt_add2 (del_ie, suc, suc_num, ded)) + goto done; + // remove any unused nodes + // XXX mark dts, dirs and inodes dirty + // XXX attach bmp to dir and volume + // XXX attach root dir to volume + // XXX add freed dts to a list for immediate reuse (attach to dir?) + // XXX commit will free list of spare dts + // XXX reduce size of alloc + + if (0) ntfs_dt_add2 (del_ie, suc, suc_num, ded); + if (0) ntfs_dir_commit (find_dir); + if (0) ntfs_dir_rollback (find_dir); + printf ("empty\n"); goto done; +freedts: + commit: printf ("commit\n"); @@ -3265,6 +3539,7 @@ done: return 0; } + /** * ntfs_test_bmp */ @@ -3297,7 +3572,6 @@ static int ntfs_test_bmp (ntfs_volume *vol, ntfs_inode *inode) return 0; } - /** * main - Begin here * From e58d93fac0d880b9a508230c2dd7002df17aa4fd Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 8 Jul 2004 23:47:42 +0000 Subject: [PATCH 1574/2994] ntfsrm: finish off remove BKrev: 40eddd1epcj6wt703yQ7f_AB4jF1ng From d47c77cd32e8f48ecc95630fde602716f9a30b35 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 9 Jul 2004 14:48:47 +0000 Subject: [PATCH 1575/2994] More quietly cluster_find (Logical change 1.450) --- ntfsprogs/cluster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c index fc281dfe..49a0d6a4 100644 --- a/ntfsprogs/cluster.c +++ b/ntfsprogs/cluster.c @@ -73,7 +73,7 @@ int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void m_ctx->flags_search = FEMR_IN_USE | FEMR_BASE_RECORD; while (mft_next_record (m_ctx) == 0) { - printf (RED "Inode: %llu\n" NORM, (unsigned long long) + Qprintf (RED "Inode: %llu\n" NORM, (unsigned long long) m_ctx->inode->mft_no); if (!(m_ctx->flags_match & FEMR_BASE_RECORD)) From b22fc80ae437376f92f1bcab5066e93dc6fa6c5c Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 9 Jul 2004 14:48:47 +0000 Subject: [PATCH 1576/2994] ntfsprogs/cluster.c More quietly cluster_find BKrev: 40eeb04fCq8_tJ-JD3K8PlQKVWT-ng From 50395bd8812d947f77174e519e852e876f0fabfb Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 10 Jul 2004 20:01:17 +0000 Subject: [PATCH 1577/2994] Auto merged 2004/07/10 17:40:52+03:00 elisa-laajakaista.fi!szaka ntfsclone: added special image format support (Per Olofsson) (Logical change 1.451) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 3fd5b83e..f10f185d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ xx/xx/2004 - 1.9.3-WIP - Fix crash in ntfsinfo for non-resident Security Info. (Yura) - ntfswipe - wipe file tails and directory indexes (Yura) - Bugfix in ntfs_rl_pread,pwrite for pos > 0. (Yura) + - Added special image format support in ntfsclone. (Per Olofsson) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From c329cb8c65098b909df3e5556140f331af116d50 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 10 Jul 2004 20:01:17 +0000 Subject: [PATCH 1578/2994] Enhancements, fixes, emphasize new imaging feature better 2004/07/10 17:40:52+03:00 elisa-laajakaista.fi!szaka added special image format support (Per Olofsson) (Logical change 1.451) --- ntfsprogs/ntfsclone.8.in | 97 +++++++++++++++++++++++++++++----------- 1 file changed, 71 insertions(+), 26 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index c1209ae1..5ee1b143 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -1,39 +1,37 @@ .\" -*- nroff -*- .\" Copyright (c) 2003 Richard Russon .\" Copyright (c) 2003-2004 Szabolcs Szakacsits +.\" Copyright (c) 2004 Per Olofsson .\" All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLONE 8 "Mar 2004" "ntfsprogs version @VERSION@" +.TH NTFSCLONE 8 "Jul 2004" "ntfsprogs version @VERSION@" .SH NAME -ntfsclone \- Efficiently clone an NTFS filesystem +ntfsclone \- Efficiently clone, image or restore an NTFS filesystem .SH SYNOPSIS .B ntfsclone -[ -.B \-fhm -] -.B \-\-output -[ -.I FILE -| -.B \- -] -.B device +[\fBOPTIONS\fR] +.I source .br -.B ntfsclone -[ -.B \-fhm -] -.B \-\-overwrite -.I FILE -.B device +.B ntfsclone \-\-save-image +[\fBOPTIONS\fR] +.I source +.br +.B ntfsclone \-\-restore-image +[\fBOPTIONS\fR] +.I source +.br +.B ntfsclone \-\-metadata +[\fBOPTIONS\fR] +.I source .SH DESCRIPTION .B ntfsclone will efficiently clone (copy, save, backup, restore) an NTFS filesystem to a -sparse file, device (partition) or standard output. +sparse file, image, device (partition) or standard output. It works at disk sector level and copies only the used data. Unused disk space becomes zero (cloning to -sparse file), left unchanged (cloning to a disk/partition) or +sparse file), encoded with control codes (cloning to an image), +left unchanged (cloning to a disk/partition) or filled with zeros (cloning to standard output). .B ntfsclone @@ -42,7 +40,7 @@ and restore it later on, or for developers to test NTFS read/write functionality, troubleshot/investigate users' issues using the clone without the risk of destroying the original filesystem. -The clone is an exact copy of the original +The clone (if not using the image format) is an exact copy of the original NTFS filesystem from sector to sector thus it can be also mounted just like the original NTFS filesystem. For example if you clone to a file and the kernel has loopback device and @@ -97,6 +95,28 @@ can't create an archive from the standard input, you can't do this in-place by just reading .BR ntfsclone standard output. +.SH THE SPECIAL IMAGE FORMAT +It is also possible to clone an NTFS filesystem to a special image +format. Instead of representing unallocated blocks as holes, they are +encoded using control codes. Thus, the image saves space without +requiring sparse file support. The image format is ideal for streaming +filesystem images over the network and similar, and can be used as a +replacement for Ghost or Partition Image if it is combined with other +tools. The downside is that you can't mount the image directly, you +need to restore it first. + +To save an image using the special image format, use the +.B \-s +or the +.B \-\-save\-image +option. To restore an image, use the +.B \-r +or the +.B \-\-restore\-image +option. Note that you can restore images from standard input by +using '\-' as the +.I source +file. .SH METADATA-ONLY CLONING One of the features of .BR ntfsclone @@ -151,12 +171,21 @@ Clone NTFS to Clone .B ONLY METADATA (for NTFS experts). Moreover only cloning to a file is allowed. -You can't metadata-only clone to a device or standard output. +You can't metadata-only clone to a device, image or standard output. +.TP +.B \-s, \-\-save\-image +Save to the special image format. +.TP +.B \-r, \-\-restore\-image +Restore from the special image format specified by +.I source\fR. +If the +.I source +is '\-' then the image is read from the standard input. .TP .B \-f, \-\-force -Forces ntfsclone to proceed, overriding some safety checks. -You can use this parameter multiply times if you want -to overcome every single safety checks. +Forces ntfsclone to proceed if the filesystem is marked +"dirty" for consistency check. .TP .B \-h, \-\-help Show a list of options with a brief description of each one. @@ -214,6 +243,20 @@ Restore an NTFS volume from a remote host via ssh. .B ssh host 'cat ntfs.img.bz2' | bunzip2 | dd of=/dev/hda1 bs=8192 .sp .RE +Save a filesystem to a file in the special image format +.RS +.sp +.B ntfsclone \-\-save\-image \-\-output ntfs.img /dev/hda1 +.sp +.RE +Stream an image from a web server and restore it to a partition +.RS +.sp +.B wget \-qO \- http://server/ntfs.img | \\\\ +.br +.B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \- +.sp +.RE Pack NTFS metadata for NTFS experts .RS .sp @@ -235,6 +278,8 @@ XFS, JFS and ext3 don't have this problem. .SH AUTHOR .B ntfsclone was written by Szabolcs Szakacsits . + +Special image format support was added by Per Olofsson . .SH AVAILABILITY .B ntfsclone is part of the ntfsprogs package and is available from From 3b20fca911f8763d1c01aed9f9ce228a9979c508 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 10 Jul 2004 20:01:17 +0000 Subject: [PATCH 1579/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into a80-186-119-178.elisa-laajakaista.fi:/home/szaka/ntfs/bk/ntfsprogs 2004/07/10 23:00:28+03:00 elisa-laajakaista.fi!szaka ntfsclone manual: enhancements, fixes, emphasize new imaging feature better 2004/07/10 17:40:52+03:00 elisa-laajakaista.fi!szaka ntfsclone: added special image format support (Per Olofsson) BKrev: 40f04b0dmMY8xPiYFH0hHw2NqKRk_A From 87a2d1bfef501bf3992b38122c946ba68598b04f Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 10 Jul 2004 20:01:17 +0000 Subject: [PATCH 1580/2994] added special image format support (Per Olofsson) (Logical change 1.451) --- ntfsprogs/ntfsclone.c | 305 +++++++++++++++++++++++++++++++++++------- 1 file changed, 256 insertions(+), 49 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 6bcefa51..fd795939 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -3,8 +3,9 @@ * * Copyright (c) 2003-2004 Szabolcs Szakacsits * Copyright (c) 2004 Anton Altaparmakov + * Special image format support copyright (c) 2004 Per Olofsson * - * Clone NTFS data and/or metadata to a sparse file, device or stdout. + * Clone NTFS data and/or metadata to a sparse file, image, device or stdout. * * 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 @@ -61,6 +62,8 @@ struct { int std_out; int blkdev_out; /* output file is block device */ int metadata_only; + int save_image; + int restore_image; char *output; char *volume; struct statfs stfs; @@ -95,6 +98,7 @@ struct ntfs_walk_cluster { ntfs_volume *vol = NULL; struct bitmap lcn_bitmap; +int fd_in; int fd_out; FILE *msg_out = NULL; @@ -105,6 +109,19 @@ int wiped_unused_mft = 0; int wiped_resident_data = 0; int wiped_timestamp_data = 0; +#define IMAGE_MAGIC "\0ntfsclone-image" +#define IMAGE_MAGIC_SIZE 16 + +struct { + char magic[IMAGE_MAGIC_SIZE]; + u8 major_ver; + u8 minor_ver; + u32 cluster_size; + s64 device_size; + s64 nr_clusters; + s64 inuse; +} __attribute__ ((__packed__)) image_hdr; + #define NTFS_MBYTE (1000 * 1000) #define ERR_PREFIX "ERROR" @@ -180,12 +197,14 @@ static int perr_exit(const char *fmt, ...) static void usage(void) { - Eprintf("\nUsage: %s [options] device\n" - " Efficiently clone NTFS to a sparse file, device or standard output.\n" + Eprintf("\nUsage: %s [options] source\n" + " Efficiently clone NTFS to a sparse file, image, device or standard output.\n" "\n" " -o, --output FILE Clone NTFS to the non-existent FILE\n" " -O, --overwrite FILE Clone NTFS to FILE, overwriting if exists\n" " -m, --metadata Clone *only* metadata (for NTFS experts)\n" + " -s, --save-image Save to the special image format\n" + " -r, --restore-image Restore from the special image format\n" " -f, --force Force to progress (DANGEROUS)\n" " -h, --help Display this help\n" #ifdef DEBUG @@ -202,16 +221,18 @@ static void usage(void) static void parse_options(int argc, char **argv) { - static const char *sopt = "-dfhmo:O:"; + static const char *sopt = "-dfhmo:O:rs"; static const struct option lopt[] = { #ifdef DEBUG - { "debug", no_argument, NULL, 'd' }, + { "debug", no_argument, NULL, 'd' }, #endif - { "force", no_argument, NULL, 'f' }, - { "help", no_argument, NULL, 'h' }, - { "metadata", no_argument, NULL, 'm' }, - { "output", required_argument, NULL, 'o' }, - { "overwrite", required_argument, NULL, 'O' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "metadata", no_argument, NULL, 'm' }, + { "output", required_argument, NULL, 'o' }, + { "overwrite", required_argument, NULL, 'O' }, + { "restore-image", no_argument, NULL, 'r' }, + { "save-image", no_argument, NULL, 's' }, { NULL, 0, NULL, 0 } }; @@ -245,6 +266,12 @@ static void parse_options(int argc, char **argv) usage(); opt.output = optarg; break; + case 'r': + opt.restore_image++; + break; + case 's': + opt.save_image++; + break; default: err_printf("Unknown option '%s'.\n", argv[optind-1]); usage(); @@ -264,9 +291,21 @@ static void parse_options(int argc, char **argv) usage(); } + if (opt.metadata_only && opt.save_image) + err_exit("Saving only metadata to an image is not " + "supported!\n"); + + if (opt.metadata_only && opt.restore_image) + err_exit("Restoring only metadata from an image is not " + "supported!\n"); + if (opt.metadata_only && opt.std_out) err_exit("Cloning only metadata to stdout isn't supported!\n"); + if (opt.save_image && opt.restore_image) + err_exit("Saving and restoring an image at the same time " + "is not supported!\n"); + if (!opt.std_out) { struct stat st; @@ -378,6 +417,8 @@ static int io_all(void *fd, void *buf, int count, int do_write) while (count > 0) { if (do_write) i = write(*(int *)fd, buf, count); + else if (opt.restore_image) + i = read(*(int *)fd, buf, count); else i = dev->d_ops->read(dev, buf, count); if (i < 0) { @@ -395,11 +436,20 @@ static int io_all(void *fd, void *buf, int count, int do_write) static void copy_cluster(void) { char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ + u32 csize = opt.restore_image ? image_hdr.cluster_size + : vol->cluster_size; - if (read_all(vol->dev, buff, vol->cluster_size) == -1) + if (read_all(opt.restore_image ? (void *)&fd_in : vol->dev, buff, + csize) == -1) perr_exit("read_all"); - if (write_all(&fd_out, buff, vol->cluster_size) == -1) { + if (opt.save_image) { + char cmd = 1; + if (write_all(&fd_out, &cmd, sizeof(cmd)) == -1) + perr_exit("write_all"); + } + + if (write_all(&fd_out, buff, csize) == -1) { int err = errno; perr_printf("Write failed"); if (err == EIO && opt.stfs.f_type == 0x517b) @@ -420,13 +470,26 @@ static void lseek_to_cluster(s64 lcn) if (vol->dev->d_ops->seek(vol->dev, pos, SEEK_SET) == (off_t)-1) perr_exit("lseek input"); - if (opt.std_out) + if (opt.std_out || opt.save_image) return; if (lseek(fd_out, pos, SEEK_SET) == (off_t)-1) perr_exit("lseek output"); } +static void image_skip_clusters(s64 count) +{ + if (opt.save_image && count > 0) { + char buff[1 + sizeof(count)]; + + buff[0] = 0; + memcpy(buff + 1, &count, sizeof(count)); + + if (write_all(&fd_out, buff, sizeof(buff)) == -1) + perr_exit("write_all"); + } +} + static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) { s64 i, len; /* number of clusters to copy */ @@ -446,45 +509,62 @@ static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) static void clone_ntfs(u64 nr_clusters) { - s64 i, pos, count; + s64 i, pos, count, last_cl; u8 bm[NTFS_BUF_SIZE]; void *buf; u32 csize = vol->cluster_size; u64 p_counter = 0; struct progress_bar progress; - Printf("Cloning NTFS ...\n"); - + if (opt.save_image) + Printf("Saving NTFS to image ...\n"); + else + Printf("Cloning NTFS ...\n"); + if ((buf = calloc(1, csize)) == NULL) perr_exit("dump_to_stdout"); - + progress_init(&progress, p_counter, nr_clusters, 100); + + if (opt.save_image) { + if (write_all(&fd_out, &image_hdr, sizeof(image_hdr)) + == -1) + perr_exit("write_all"); + } pos = 0; + last_cl = 0; while (1) { count = ntfs_attr_pread(vol->lcnbmp_na, pos, NTFS_BUF_SIZE, bm); if (count == -1) perr_exit("Couldn't read $Bitmap (pos = %lld)\n", pos); - if (count == 0) + if (count == 0) { + image_skip_clusters(pos * 8 - last_cl - 1); return; + } for (i = 0; i < count; i++, pos++) { s64 cl; /* current cluster */ for (cl = pos * 8; cl < (pos + 1) * 8; cl++) { - if (cl > vol->nr_clusters - 1) + if (cl > vol->nr_clusters - 1) { + image_skip_clusters(cl - last_cl - 1); return; + } if (ntfs_bit_get(bm, i * 8 + cl % 8)) { progress_update(&progress, ++p_counter); lseek_to_cluster(cl); + image_skip_clusters(cl - last_cl - 1); + copy_cluster(); + last_cl = cl; continue; } - if (opt.std_out) { + if (opt.std_out && !opt.save_image) { progress_update(&progress, ++p_counter); if (write_all(&fd_out, buf, csize) == -1) perr_exit("write_all"); @@ -494,6 +574,59 @@ static void clone_ntfs(u64 nr_clusters) } } +static void write_empty_clusters(s32 csize, s64 count, + struct progress_bar *progress, u64 *p_counter) +{ + s64 i; + char buff[NTFS_MAX_CLUSTER_SIZE]; + + memset(buff, 0, csize); + + for (i = 0; i < count; i++) { + if (write_all(&fd_out, buff, csize) == -1) + perr_exit("write_all"); + progress_update(progress, ++(*p_counter)); + } +} + +static void restore_image(void) +{ + s64 pos = 0, count; + s32 csize = image_hdr.cluster_size; + char cmd; + u64 p_counter = 0; + struct progress_bar progress; + + Printf("Restoring NTFS from image ...\n"); + + progress_init(&progress, p_counter, opt.std_out ? + image_hdr.nr_clusters : image_hdr.inuse, 100); + + while (pos < image_hdr.nr_clusters) { + if (read_all(&fd_in, &cmd, sizeof(cmd)) == -1) + perr_exit("read_all"); + + if (cmd == 0) { + if (read_all(&fd_in, &count, sizeof(count)) == -1) + perr_exit("read_all"); + if (opt.std_out) + write_empty_clusters(csize, count, + &progress, &p_counter); + else { + if (lseek(fd_out, count * csize, SEEK_CUR) + == (off_t)-1) + perr_exit("lseek output"); + } + pos += count; + } else if (cmd == 1) { + copy_cluster(); + pos++; + progress_update(&progress, ++p_counter); + } else + err_exit("Invalid command code in image\n"); + } +} + #define WIPE_TIMESTAMPS(atype, attr) \ do { \ atype *ats; \ @@ -845,12 +978,12 @@ static void print_volume_size(const char *str, s64 bytes) } -static void print_disk_usage(ntfs_walk_clusters_ctx *image) +static void print_disk_usage(u32 cluster_size, s64 nr_clusters, s64 inuse) { s64 total, used; - total = vol->nr_clusters * vol->cluster_size; - used = image->inuse * vol->cluster_size; + total = nr_clusters * cluster_size; + used = inuse * cluster_size; Printf("Space in use : %lld MB (%.1f%%) ", (long long)rounded_up_division(used, NTFS_MBYTE), @@ -859,6 +992,22 @@ static void print_disk_usage(ntfs_walk_clusters_ctx *image) Printf("\n"); } +static void print_image_info(void) +{ + Printf("NTFS volume version: %d.%d\n", + image_hdr.major_ver, image_hdr.minor_ver); + Printf("Cluster size : %u bytes\n", + image_hdr.cluster_size); + print_volume_size("Image volume size ", + image_hdr.cluster_size + * image_hdr.nr_clusters); + Printf("Image device size : %lld bytes\n", + image_hdr.device_size); + print_disk_usage(image_hdr.cluster_size, + image_hdr.nr_clusters, + image_hdr.inuse); +} + static void check_if_mounted(const char *device, unsigned long new_mntflag) { unsigned long mntflag; @@ -1019,7 +1168,71 @@ static void set_filesize(s64 filesize) exit(1); } } + +static s64 open_image(void) +{ + if (strcmp(opt.volume, "-") == 0) { + if ((fd_in = fileno(stdin)) == -1) + perr_exit("fileno for stdout failed"); + } else { + if ((fd_in = open(opt.volume, O_RDONLY)) == -1) + perr_exit("failed to open image"); + } + + if (read_all(&fd_in, &image_hdr, sizeof(image_hdr)) == -1) + perr_exit("read_all"); + + if (memcmp(image_hdr.magic, IMAGE_MAGIC, IMAGE_MAGIC_SIZE) != 0) + err_exit("Input file is not an image! (invalid magic)\n"); + + return image_hdr.device_size; +} + +static s64 open_volume(void) +{ + s64 device_size; + mount_volume(MS_RDONLY); + + device_size = ntfs_device_size_get(vol->dev, 1); + if (device_size <= 0) + err_exit("Couldn't get device size (%lld)!\n", device_size); + + print_volume_size("Current device size", device_size); + + if (device_size < vol->nr_clusters * vol->cluster_size) + err_exit("Current NTFS volume size is bigger than the device " + "size (%lld)!\nCorrupt partition table or incorrect " + "device partitioning?\n", device_size); + + return device_size; +} + +static void initialise_image_hdr(s64 device_size, s64 inuse) +{ + memcpy(image_hdr.magic, IMAGE_MAGIC, IMAGE_MAGIC_SIZE); + image_hdr.major_ver = vol->major_ver; + image_hdr.minor_ver = vol->minor_ver; + image_hdr.cluster_size = vol->cluster_size; + image_hdr.device_size = device_size; + image_hdr.nr_clusters = vol->nr_clusters; + image_hdr.inuse = inuse; +} + +static void check_output_filesize(s64 device_size) +{ + if (opt.blkdev_out) { + s64 dest_size = device_size_get(fd_out); + s64 ntfs_size = vol->nr_clusters * vol->cluster_size; + ntfs_size += 512; /* add backup boot sector */ + if (dest_size < ntfs_size) + err_exit("Output device size (%lld) is too small" + " to fit the NTFS image.\n", dest_size); + + check_if_mounted(opt.output, 0); + } else + set_filesize(device_size); +} int main(int argc, char **argv) { @@ -1035,18 +1248,10 @@ int main(int argc, char **argv) utils_set_locale(); - mount_volume(MS_RDONLY); - - device_size = ntfs_device_size_get(vol->dev, 1); - if (device_size <= 0) - err_exit("Couldn't get device size (%lld)!\n", device_size); - - print_volume_size("Current device size", device_size); - - if (device_size < vol->nr_clusters * vol->cluster_size) - err_exit("Current NTFS volume size is bigger than the device " - "size (%lld)!\nCorrupt partition table or incorrect " - "device partitioning?\n", device_size); + if (opt.restore_image) + device_size = open_image(); + else + device_size = open_volume(); if (opt.std_out) { if ((fd_out = fileno(stdout)) == -1) @@ -1063,34 +1268,36 @@ int main(int argc, char **argv) if ((fd_out = open(opt.output, flags, S_IRWXU)) == -1) perr_exit("Opening file '%s' failed", opt.output); - - if (opt.blkdev_out) { - s64 dest_size = device_size_get(fd_out); - s64 ntfs_size = vol->nr_clusters * vol->cluster_size; - ntfs_size += 512; /* add backup boot sector */ - if (dest_size < ntfs_size) - err_exit("Output device size (%lld) is too small" - " to fit the NTFS image.\n", dest_size); - - check_if_mounted(opt.output, 0); - } else - set_filesize(device_size); + + if (!opt.save_image) + check_output_filesize(device_size); } + if (opt.restore_image) { + print_image_info(); + restore_image(); + fsync_clone(fd_out); + exit(0); + } + setup_lcn_bitmap(); memset(&image, 0, sizeof(image)); backup_clusters.image = ℑ walk_clusters(vol, &backup_clusters); compare_bitmaps(&lcn_bitmap); - print_disk_usage(&image); + print_disk_usage(vol->cluster_size, vol->nr_clusters, image.inuse); free(lcn_bitmap.bm); + + if (opt.save_image) + initialise_image_hdr(device_size, image.inuse); /* FIXME: save backup boot sector */ if (opt.std_out || !opt.metadata_only) { - s64 nr_clusters = opt.std_out ? vol->nr_clusters : image.inuse; + s64 nr_clusters = (opt.std_out && !opt.save_image) + ? vol->nr_clusters : image.inuse; clone_ntfs(nr_clusters); fsync_clone(fd_out); From ca998f6fc58fb901328ac46f62decbdcbc954f0d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jul 2004 13:01:42 +0000 Subject: [PATCH 1581/2994] Update (Logical change 1.452) --- AUTHORS | 2 -- CREDITS | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 55de56ac..b3cd2cb0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,8 +4,6 @@ ntfsprogs is written and maintained by Anton Altaparmakov . Current active developers on the project are (in alphabetical order): Anton Altaparmakov -Jan Kratochvil -Matthew J. Fanto Yuval Fledel (no email address on request) Lode Leroy Leonard NorrgĂĄrd diff --git a/CREDITS b/CREDITS index 653aeea5..53bc2e44 100644 --- a/CREDITS +++ b/CREDITS @@ -23,6 +23,7 @@ Lode Leroy David MartĂ­nez Moreno Leonard NorrgĂĄrd Holger Ohmacht +Per Olofsson Yura Pakhuchiy Yuri Per Richard Russon From c649d2b5708868ac77cf3eaef0bd6d5e43400225 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jul 2004 13:01:42 +0000 Subject: [PATCH 1582/2994] Update CREDITS and AUTHORS. BKrev: 40f3dd36bnyP43RPFTBg3W3H1QvT8A From dfde7adfd41ac9be5c0415ca02bc0adeff62411f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jul 2004 13:04:02 +0000 Subject: [PATCH 1583/2994] Add noreturn attribute to err_exit function. (Yuval) (Logical change 1.453) --- ntfsprogs/mkntfs.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 05f545db..caf34c48 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -247,6 +247,7 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * err_exit - error output and terminate; ignores quiet (-q) */ +static void err_exit(const char *fmt, ...) __attribute__((noreturn)); static void err_exit(const char *fmt, ...) { va_list ap; @@ -430,6 +431,8 @@ static void parse_options(int argc, char *argv[]) /** * append_to_bad_blocks + * + * Note: Might not return. */ static void append_to_bad_blocks(unsigned long block) { @@ -492,6 +495,8 @@ static __inline__ long long mkntfs_write(struct ntfs_device *dev, * * Return the number of bytes written (minus padding) or -1 on error. Errno * will be set to the error code. + * + * Note: Might not return. */ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, const char *val, const s64 val_len, s64 *inited_size) @@ -628,6 +633,8 @@ static int stoucs(ntfschar *dest, const char *src, int maxlen) /** * dump_resident_attr_val + * + * Note: Might not return. */ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) { @@ -2536,6 +2543,8 @@ static void mkntfs_exit(void) /** * mkntfs_open_partition - + * + * Note: Might not return. */ static void mkntfs_open_partition(void) { @@ -2620,6 +2629,8 @@ static void mkntfs_open_partition(void) /** * mkntfs_override_phys_params - + * + * Note: Might not return. */ static void mkntfs_override_phys_params(void) { @@ -2829,6 +2840,8 @@ static void mkntfs_override_phys_params(void) /** * mkntfs_initialize_bitmaps - + * + * Note: Might not return. */ static void mkntfs_initialize_bitmaps(void) { @@ -2893,6 +2906,8 @@ static void mkntfs_initialize_bitmaps(void) /** * mkntfs_initialize_rl_mft - + * + * Note: Might not return. */ static void mkntfs_initialize_rl_mft(void) { @@ -2979,6 +2994,8 @@ static void mkntfs_initialize_rl_mft(void) /** * mkntfs_initialize_rl_logfile - + * + * Note: Might not return. */ static void mkntfs_initialize_rl_logfile(void) { @@ -3037,6 +3054,8 @@ static void mkntfs_initialize_rl_logfile(void) /** * mkntfs_initialize_rl_boot - + * + * Note: Might not return. */ static void mkntfs_initialize_rl_boot(void) { @@ -3063,6 +3082,8 @@ static void mkntfs_initialize_rl_boot(void) /** * mkntfs_initialize_rl_bad - + * + * Note: Might not return. */ static void mkntfs_initialize_rl_bad(void) { @@ -3086,6 +3107,8 @@ static void mkntfs_initialize_rl_bad(void) /** * mkntfs_fill_device_with_zeroes - + * + * Note: Might not return. */ static void mkntfs_fill_device_with_zeroes(void) { @@ -3160,6 +3183,8 @@ static void mkntfs_fill_device_with_zeroes(void) /** * mkntfs_create_root_structures - + * + * Note: Might not return. */ static void mkntfs_create_root_structures(void) { From 315c8b395eda20262e537077cd7b191caf343eb9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jul 2004 13:04:02 +0000 Subject: [PATCH 1584/2994] Add noreturn attribute to mkntfs.c::err_exit function. (Yuval) BKrev: 40f3ddc2b9iEp7OUY_0XOtP9Pr9FSg From be1c64d294290895cb0e270cdaac400ef503c8de Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jul 2004 13:06:05 +0000 Subject: [PATCH 1585/2994] Fix compiler warning in ntfsundelete. (Yuval) BKrev: 40f3de3dbPCmd1IDAxo292xi7xzQ_Q From 38314bb49921b55e8c63fbfba89e194d5bd0090e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jul 2004 13:06:05 +0000 Subject: [PATCH 1586/2994] Fix compiler warning. (Yuval) (Logical change 1.454) --- ntfsprogs/ntfsundelete.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index b91e70d3..0e4f2864 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -1827,7 +1827,9 @@ int main (int argc, char *argv[]) { result = !undelete_file (vol, inode); if (result) - Vprintf ("ERROR: Failed to undelete inode %d\n!", inode); + Vprintf ("ERROR: Failed to undelete " + "inode %u\n!", + (unsigned int)inode); } } break; From ae0653cc187f34c22a3cf191544b6533f368d4ee Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jul 2004 15:05:15 +0000 Subject: [PATCH 1587/2994] Include attrib.h before debug.h as debug.h no longer includes attrib.h. (Yuval) (Logical change 1.455) --- libntfs/debug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/debug.c b/libntfs/debug.c index dd4df2fa..8e3f4208 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -21,6 +21,7 @@ #include "config.h" +#include "attrib.h" #include "debug.h" #ifdef DEBUG From a93c3f954964883629a1386b10b90b3bd353d364 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jul 2004 15:05:15 +0000 Subject: [PATCH 1588/2994] Include debug.h and remove duplicated code. (Yuval) (Logical change 1.455) --- libntfs/win32_io.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 4d09a76a..b02c8dc5 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -43,6 +43,7 @@ struct ntfs_volume; typedef struct ntfs_volume ntfs_volume; #include "config.h" +#include "debug.h" /* Need device, but prevent ../include/types.h to be loaded. */ #define _NTFS_TYPES_H @@ -59,19 +60,6 @@ typedef struct win32_fd { LARGE_INTEGER current_pos; } win32_fd; -#ifdef DEBUG -static __inline__ void Dprintf(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); -} -#else -static __inline__ void Dprintf(const char *fmt, ...) {} -#endif - #define perror(msg) win32_perror(__FILE__,__LINE__,__FUNCTION__,msg) static int win32_perror(const char *file, int line, const char *func, From 41121112e5eab62c5171c057a4c509c9bd1ac565 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jul 2004 15:05:15 +0000 Subject: [PATCH 1589/2994] Remote attrib.h include so win32_io.c can include debug.h. (Yuval) (Logical change 1.455) --- include/ntfs/debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ntfs/debug.h b/include/ntfs/debug.h index 1f96e621..6003e7b4 100644 --- a/include/ntfs/debug.h +++ b/include/ntfs/debug.h @@ -30,7 +30,7 @@ # include #endif -#include "attrib.h" +struct runlist_element; #ifdef DEBUG From 2198f29e895e191ca57a827064cab7bb21db6f34 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jul 2004 15:05:15 +0000 Subject: [PATCH 1590/2994] include/ntfs/debug.h Remote attrib.h include so win32_io.c can include debug.h. (Yuval) libntfs/debug.c Include attrib.h before debug.h as debug.h no longer includes attrib.h. (Yuval) libntfs/win32_io.c Include debug.h and remove duplicated code. (Yuval) BKrev: 40f3fa2bfK8Ztgw7LQX8xD6Kptf63Q From aa4542d8f4be4dc230c231de6de211c6bbc3d75e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jul 2004 15:16:57 +0000 Subject: [PATCH 1591/2994] Fix Yuval's last patch: runlist_element is not a struct it is a typedef so renamed it to the struct name which is _runlist_element. (Logical change 1.456) --- include/ntfs/debug.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ntfs/debug.h b/include/ntfs/debug.h index 6003e7b4..13bed18b 100644 --- a/include/ntfs/debug.h +++ b/include/ntfs/debug.h @@ -30,7 +30,7 @@ # include #endif -struct runlist_element; +struct _runlist_element; #ifdef DEBUG @@ -66,14 +66,14 @@ static __inline__ void Dperror(const char *s) errno = eo; } -extern void ntfs_debug_runlist_dump(const runlist_element *rl); +extern void ntfs_debug_runlist_dump(const struct _runlist_element *rl); #else /* if !DEBUG */ static __inline__ void Dprintf(const char *fmt __attribute__((unused)), ...) {} static __inline__ void Dputs(const char *s __attribute__((unused))) {} static __inline__ void Dperror(const char *s __attribute__((unused))) {} -static __inline__ void ntfs_debug_runlist_dump(const runlist_element *rl __attribute__((unused))) {} +static __inline__ void ntfs_debug_runlist_dump(const struct _runlist_element *rl __attribute__((unused))) {} #endif /* !DEBUG */ From 47d78b71974083fd6ad3aee15cae48ee7efa360f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 13 Jul 2004 15:16:57 +0000 Subject: [PATCH 1592/2994] Fix Yuval's last patch: runlist_element is not a struct it is a typedef so renamed it to the struct name which is _runlist_element. (Anton) BKrev: 40f3fce98cr9Bx9kKnLFaGFVqi4S8Q From 3b3ac7b23479fda6f08f8e72b83cbe8a5810af90 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:29:13 +0000 Subject: [PATCH 1593/2994] Implement ntfs_device_win32_ioctl(). (Logical change 1.457) --- include/ntfs/device_io.h | 19 +++++ libntfs/win32_io.c | 178 +++++++++++++++++++++++++++++++++++---- 2 files changed, 182 insertions(+), 15 deletions(-) diff --git a/include/ntfs/device_io.h b/include/ntfs/device_io.h index b6f0d810..8737b871 100644 --- a/include/ntfs/device_io.h +++ b/include/ntfs/device_io.h @@ -35,6 +35,25 @@ #else /* __CYGWIN32__ */ +#ifndef HDIO_GETGEO +# define HDIO_GETGEO 0x10000301 +struct hd_geometry { + unsigned char heads; + unsigned char sectors; + unsigned short cylinders; + unsigned long start; +}; +#endif +#ifndef BLKGETSIZE +# define BLKGETSIZE 0x10001260 +#endif +#ifndef BLKSSZGET +# define BLKSSZGET 0x10001268 +#endif +#ifndef BLKGETSIZE64 +# define BLKGETSIZE64 0x10001272 +#endif + /* On Cygwin; use Win32 low level device operations. */ #define ntfs_device_default_io_ops ntfs_device_win32_io_ops diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index b02c8dc5..0d3b3862 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -55,9 +55,10 @@ typedef struct ntfs_volume ntfs_volume; typedef struct win32_fd { HANDLE handle; - LARGE_INTEGER part_start; - LARGE_INTEGER part_end; + s64 part_start; + s64 part_end; LARGE_INTEGER current_pos; + int part_hidden_sectors; } win32_fd; #define perror(msg) win32_perror(__FILE__,__LINE__,__FUNCTION__,msg) @@ -93,6 +94,47 @@ static BOOL WINAPI SetFilePointerEx(HANDLE hFile, } #endif +/** + * ntfs_w32error_to_errno - Convert a win32 error code to the unix one + * @w32error The win32 error code. + * + * Limited to a reletevly small but useful number of codes + */ +static int ntfs_w32error_to_errno(DWORD w32error) +{ + switch (w32error) { + case ERROR_FILE_NOT_FOUND: + case ERROR_PATH_NOT_FOUND: + return ENOENT; + case ERROR_TOO_MANY_OPEN_FILES: + return EMFILE; + case ERROR_ACCESS_DENIED: + return EACCES; + case ERROR_INVALID_HANDLE: + return EBADF; + case ERROR_NOT_ENOUGH_MEMORY: + return ENOMEM; + case ERROR_OUTOFMEMORY: + return ENOSPC; + case ERROR_INVALID_DRIVE: + case ERROR_BAD_UNIT: + return ENODEV; + case ERROR_WRITE_PROTECT: + return EROFS; + case ERROR_NOT_READY: + return EBUSY; + case ERROR_BAD_COMMAND: + return EINVAL; + case ERROR_SEEK: + return ESPIPE; + case ERROR_NOT_SUPPORTED: + return ENOTSUP; + default: + /* generic message */ + return ENOMSG; + } +} + /** * ntfs_device_win32_open - open a device * @dev: ntfs device to open @@ -139,8 +181,8 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) if (numparams == 1) { fd.handle = handle; - fd.part_start.QuadPart = 0; - fd.part_end.QuadPart = -1; + fd.part_start = 0; + fd.part_end = -1; fd.current_pos.QuadPart = 0; } else { char buffer[10240]; @@ -169,8 +211,8 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) fd.handle = handle; fd.part_start = drive_layout-> PartitionEntry[i]. - StartingOffset; - fd.part_end.QuadPart = drive_layout-> + StartingOffset.QuadPart; + fd.part_end = drive_layout-> PartitionEntry[i]. StartingOffset. QuadPart + @@ -210,8 +252,8 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) } fd.handle = handle; - fd.part_start.QuadPart = 0; - fd.part_end.QuadPart = (((s64) info.nFileSizeHigh) << 32) + + fd.part_start = 0; + fd.part_end = (((s64) info.nFileSizeHigh) << 32) + ((s64) info.nFileSizeLow); fd.current_pos.QuadPart = 0; } @@ -238,7 +280,7 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, switch (whence) { case SEEK_SET: disp = FILE_BEGIN; - abs_offset.QuadPart = fd->part_start.QuadPart + offset; + abs_offset.QuadPart = fd->part_start + offset; break; case SEEK_CUR: disp = FILE_CURRENT; @@ -247,13 +289,13 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, case SEEK_END: /* end of partition != end of disk */ disp = FILE_BEGIN; - if (fd->part_end.QuadPart == -1) { + if (fd->part_end == -1) { fprintf(stderr, "win32_seek: position relative to end " "of disk not implemented\n"); errno = ENOTSUP; return -1; } - abs_offset.QuadPart = fd->part_end.QuadPart + offset; + abs_offset.QuadPart = fd->part_end + offset; break; default: printf("win32_seek() wrong mode %d\n", whence); @@ -380,7 +422,7 @@ static s64 win32_bias(struct ntfs_device *dev) { struct win32_fd *fd = (win32_fd *)dev->d_private; - return fd->part_start.QuadPart; + return fd->part_start; } static s64 win32_filepos(struct ntfs_device *dev) @@ -412,12 +454,118 @@ static int ntfs_device_win32_stat(struct ntfs_device *dev, struct stat *buf) return -1; } +/** + * ntfs_win32_hdio_getgeo - Get drive geometry. + * @dev: An NTFS_DEVICE obtained via the open command. + * @argp: A pointer to where to put the output. + * + * Requires windows NT/2k/XP only + * + * Currently only the 'start' field is filled + * + * Return 0 if o.k. + * -errno if not, in this case handle is trashed. + */ +static __inline__ int ntfs_win32_hdio_getgeo(struct ntfs_device *dev, + struct hd_geometry *argp) +{ + win32_fd *fd; + + fd = (win32_fd *)dev->d_private; + + if (fd->part_hidden_sectors==-1) { + /* not a partition */ + Dprintf("ntfs_win32_hdio_getgeo(): error: not a partition"); + fprintf(stderr, "ntfs_win32_hdio_getgeo(): unimplemented\n"); + errno = ENOTSUP; + return -1; + } else { + /* only fake the 'start' value, others are unsupported */ + /* heads are returned by disk_int13_info on winXP only */ + argp->heads = -1; + argp->sectors = -1; + argp->cylinders = -1; + argp->start = fd->part_hidden_sectors; + return 0; + } +} + +/** + * ntfs_win32_blksszget - Get block device sector size. + * @dev: An NTFS_DEVICE obtained via the open command. + * @argp: A pointer to where to put the output. + * + * Works on windows NT/2k/XP only + * + * Return 0 if o.k. + * -errno if not, in this case handle is trashed. + */ +static __inline__ int ntfs_win32_blksszget(struct ntfs_device *dev,int *argp) +{ + win32_fd *fd; + DISK_GEOMETRY dg; + DWORD bytesReturned; + + fd = (win32_fd *)dev->d_private; + + if (DeviceIoControl(fd->handle, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, + &dg, sizeof(DISK_GEOMETRY), &bytesReturned, NULL)) { + /* success */ + *argp=dg.BytesPerSector; + return 0; + } else { + perror("ntfs_win32_blksszget(): FAILED!"); + errno = ntfs_w32error_to_errno(GetLastError()); + return -errno; + } +} + static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, void *argp) { - fprintf(stderr, "win32_ioctl() unimplemented\n"); - errno = ENOTSUP; - return -1; + win32_fd *fd = (win32_fd *)dev->d_private; + + fprintf(stderr, "win32_ioctl(%d) called\n",request); + + switch (request) { +#if defined(BLKGETSIZE) + case BLKGETSIZE: + Dprintf("win32_ioctl: BLKGETSIZE detected"); + if ((fd->part_end>=0) && (fd->part_start>=0)) { + *(int *)argp = (int)((fd->part_end - fd->part_start) / 512); + return 0; + } else { + errno = ENOTSUP; + return -ENOTSUP; + } +#endif +#if defined(BLKGETSIZE64) + case BLKGETSIZE64: + Dprintf("win32_ioctl: BLKGETSIZE64 detected"); + if ((fd->part_end>=0) && (fd->part_start>=0)) { + *(s64 *)argp = (s64)(fd->part_end - fd->part_start); + return 0; + } else { + errno = ENOTSUP; + return -ENOTSUP; + } +#endif +#ifdef HDIO_GETGEO + case HDIO_GETGEO: + Dprintf("win32_ioctl: HDIO_GETGEO detected"); + return ntfs_win32_hdio_getgeo(dev,(struct hd_geometry *)argp); +#endif +#ifdef BLKSSZGET + case BLKSSZGET: + Dprintf("win32_ioctl: BLKSSZGET detected"); + return ntfs_win32_blksszget(dev,(int *)argp); + break; +#endif + default: + fprintf(stderr, "win32_ioctl(): unimplemented ioctl %d\n",request); + errno = ENOTSUP; + return -1; + } } static s64 ntfs_device_win32_pread(struct ntfs_device *dev, void *buf, From 8b5ea751ef6bb58284227b353eff9daad2867db0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:29:13 +0000 Subject: [PATCH 1594/2994] Implement ntfs_device_win32_ioctl(). (Yuval) BKrev: 40f64e69VLLHdZ7_i-b8AHMcTd-duw From 0dfe86e663c17ec773dcdc6f18645d362be8decc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:35:10 +0000 Subject: [PATCH 1595/2994] Re-factor the existing ntfs_device_win32_open(). (Logical change 1.458) --- libntfs/win32_io.c | 343 +++++++++++++++++++++++++++++++-------------- 1 file changed, 237 insertions(+), 106 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 0d3b3862..0e4b9195 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -30,6 +30,7 @@ #include #include #include +#include /* * Cannot use "../include/types.h" since it conflicts with "wintypes.h". @@ -136,9 +137,217 @@ static int ntfs_w32error_to_errno(DWORD w32error) } /** - * ntfs_device_win32_open - open a device - * @dev: ntfs device to open - * @flags: open flags + * ntfs_device_win32_simple_open_file - Just open a file via win32 API + * @filename: Name of the file to open. + * @handle: Pointer the a HADNLE in which to put the result. + * @flags: Unix open status flags. + * + * Supported flags are O_RDONLY, O_WRONLY and O_RDWR. + * + * Return 0 if o.k. + * -errno if not, in this case handle is trashed. + */ +static int ntfs_device_win32_simple_open_file(char *filename, + HANDLE *handle, int flags) +{ + int win32flags; + + switch (flags && O_ACCMODE) { + case O_RDONLY: + win32flags = FILE_READ_DATA; + break; + case O_WRONLY: +/* win32flags = FILE_WRITE_DATA; + break; */ + case O_RDWR: +/* win32flags = FILE_READ_DATA || FILE_WRITE_DATA; + break; */ + errno = ENOTSUP; + return -errno; + default: + /* error */ + return -EINVAL; + } + + *handle = CreateFile(filename, win32flags, FILE_SHARE_READ, + NULL, OPEN_EXISTING, 0, NULL); + + if (*handle == INVALID_HANDLE_VALUE) { + char msg[1024]; + + sprintf(msg, "CreateFile(%s) failed", filename); + perror(msg); + errno = ntfs_w32error_to_errno(GetLastError()); + + return -errno; + } else { + return 0; + } +} + +/** + * ntfs_win32_getsize - Get file size via win32 API + * @handle: Pointer the file HADNLE obtained via open. + * @argp: Pointer to result buffer. + * + * Return 0 if o.k. + * -errno if not, in this case handle is trashed. + */ +static int ntfs_win32_getsize(HANDLE handle,s64 *argp) +{ + DWORD loword, hiword; + + loword = GetFileSize(handle, &hiword); + if (loword==INVALID_FILE_SIZE) { + perror("ntfs_win32_getblksize(): FAILED!"); + errno = ntfs_w32error_to_errno(GetLastError()); + return -errno; + } + *argp=((s64)hiword << 32) + (s64)loword; + return 0; +} + +/** + * ntfs_device_win32_open_file - Open a file via win32 API + * @filename: Name of the file to open. + * @fd: Pointer to win32 file device in which to put the result. + * @flags: Unix open status flags. + * + * Return 0 if o.k. + * -errno if not + */ +static __inline__ int ntfs_device_win32_open_file(char *filename, win32_fd *fd, + int flags) +{ + HANDLE handle; + s64 size; + int err; + + if ((err = ntfs_device_win32_simple_open_file(filename, &handle, flags))) { + /* open error */ + return err; + } + + if ((err = ntfs_win32_getsize(handle, &size))) { + /* error while getting the information */ + perror("ioctl failed"); + errno = err; + return -err; + } else { + /* success */ + fd->handle = handle; + fd->part_start = 0; + fd->part_end = size; + fd->current_pos.QuadPart = 0; + fd->part_hidden_sectors = -1; + return 0; + } +} + +/** + * ntfs_device_win32_open_drive - Open a drive via win32 API + * @dev: NTFS_DEVICE to open + * @handle: Win32 file handle to return + * @flags: Unix open status flags. + * + * return 0 if o.k. + * -errno if not + */ +static __inline__ int ntfs_device_win32_open_drive(int drive_id, win32_fd *fd, + int flags) +{ + char filename[256]; + HANDLE handle; + s64 size; + int err; + + sprintf(filename, "\\\\.\\PhysicalDrive%d", drive_id); + + if ((err = ntfs_device_win32_simple_open_file(filename, &handle, flags))) { + /* open error */ + return err; + } + + if ((err = ntfs_win32_getsize(handle, &size))) { + /* error while getting the information */ + perror("ioctl failed"); + errno = err; + return -err; + } else { + /* success */ + fd->handle = handle; + fd->part_start = 0; + fd->part_end = size; + fd->current_pos.QuadPart = 0; + fd->part_hidden_sectors = -1; + return 0; + } +} + +/** + * ntfs_device_win32_open_partition - Open a partition via win32 API + * @dev: NTFS_DEVICE to open + * @fd: Win32 file device to return + * @flags: Unix open status flags. + * + * Return 0 if o.k. + * -errno if not + * + * When fails, fd contents may have not been preserved. + */ +static __inline__ int ntfs_device_win32_open_partition(int drive_id, + unsigned int partition_id, win32_fd *fd, int flags) +{ + DRIVE_LAYOUT_INFORMATION *drive_layout; + char buffer[10240]; + unsigned int i; + DWORD numread; + HANDLE handle; + int err; + + sprintf(buffer, "\\\\.\\PhysicalDrive%d", drive_id); + + if ((err = ntfs_device_win32_simple_open_file(buffer, &handle, flags))) { + /* error */ + return err; + } + + if (!DeviceIoControl(handle, IOCTL_DISK_GET_DRIVE_LAYOUT, NULL, 0, + &buffer, sizeof (buffer), &numread, NULL)) { + perror("ioctl failed"); + errno = ntfs_w32error_to_errno(GetLastError()); + return -errno; + } + + drive_layout = (DRIVE_LAYOUT_INFORMATION *)buffer; + for (i = 0; i < drive_layout->PartitionCount; i++) { + if (drive_layout->PartitionEntry[i].PartitionNumber == partition_id) { + fd->handle = handle; + fd->part_start = + drive_layout->PartitionEntry[i].StartingOffset.QuadPart; + fd->part_end = + drive_layout->PartitionEntry[i].StartingOffset.QuadPart + + drive_layout->PartitionEntry[i].PartitionLength.QuadPart; + fd->current_pos.QuadPart = 0; + fd->part_hidden_sectors = + drive_layout->PartitionEntry[i].HiddenSectors; + return 0; + } + } + + fprintf(stderr,"partition %u not found on drive %d\n", + partition_id, drive_id); + errno = ENODEV; + return -ENODEV; +} + +/** + * ntfs_device_win32_open - Open a device + * @dev: A pointer to the NTFS_DEVICE to open + * dev->d_name must hold the device name, the rest is ignored. + * @flags: Unix open status flags. + * + * Supported flags are O_RDONLY, O_WRONLY and O_RDWR. * * If name is in format "(hd[0-9],[0-9])" then open a partition. * If name is in format "(hd[0-9])" then open a volume. @@ -146,116 +355,38 @@ static int ntfs_w32error_to_errno(DWORD w32error) */ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) { - int drive = 0, numparams; + int drive_id = 0, numparams; unsigned int part = 0; - HANDLE handle; + char drive_char; win32_fd fd; - char drive_char, filename[256]; + int err; numparams = sscanf(dev->d_name, "/dev/hd%c%u", &drive_char, &part); - drive = toupper(drive_char) - 'A'; + drive_id = toupper(drive_char) - 'A'; - if (numparams >= 1) { - if (numparams == 2) + switch (numparams) { + case 0: + Dprintf("win32_open(%s) -> file\n", dev->d_name); + err = ntfs_device_win32_open_file(dev->d_name,&fd,flags); + break; + case 1: + Dprintf("win32_open(%s) -> drive %d\n", dev->d_name, drive_id); + err = ntfs_device_win32_open_drive(drive_id,&fd,flags); + break; + case 2: Dprintf("win32_open(%s) -> drive %d, part %u\n", - dev->d_name, drive, part); - else - Dprintf("win32_open(%s) -> drive %d\n", dev->d_name, - drive); + dev->d_name, drive_id, part); + err = ntfs_device_win32_open_partition(drive_id,part,&fd,flags); + break; + default: + Dprintf("win32_open(%s) -> unknwon file format\n", dev->d_name); + err = -1; + break; + } - sprintf(filename, "\\\\.\\PhysicalDrive%d", drive); - - handle = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM, - NULL); - - if (handle == INVALID_HANDLE_VALUE) { - char msg[1024]; - int err = errno; - - sprintf(msg, "CreateFile(%s) failed", filename); - perror(msg); - errno = err; - return -1; - } - - if (numparams == 1) { - fd.handle = handle; - fd.part_start = 0; - fd.part_end = -1; - fd.current_pos.QuadPart = 0; - } else { - char buffer[10240]; - DWORD numread; - DRIVE_LAYOUT_INFORMATION *drive_layout; - BOOL rvl; - unsigned int i; - int found = 0; - - rvl = DeviceIoControl(handle, - IOCTL_DISK_GET_DRIVE_LAYOUT, NULL, 0, - &buffer, sizeof (buffer), &numread, - NULL); - if (!rvl) { - int err = errno; - perror("ioctl failed"); - errno = err; - return -1; - } - - drive_layout = (DRIVE_LAYOUT_INFORMATION *)buffer; - - for (i = 0; i < drive_layout->PartitionCount; i++) { - if (drive_layout->PartitionEntry[i]. - PartitionNumber == part) { - fd.handle = handle; - fd.part_start = drive_layout-> - PartitionEntry[i]. - StartingOffset.QuadPart; - fd.part_end = drive_layout-> - PartitionEntry[i]. - StartingOffset. - QuadPart + - drive_layout-> - PartitionEntry[i]. - PartitionLength. - QuadPart; - fd.current_pos.QuadPart = 0; - found = 1; - break; - } - } - - if (!found) { - int err = errno; - fprintf(stderr, "partition %u not found on " - "drive %d\n", part, drive); - errno = err; - return -1; - } - } - } else { - BY_HANDLE_FILE_INFORMATION info; - BOOL rvl; - - Dprintf("win32_open(%s) -> file\n", dev->d_name); - - handle = CreateFile(dev->d_name, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, 0, NULL); - - rvl = GetFileInformationByHandle(handle, &info); - if (!rvl) { - int err = errno; - perror("ioctl failed"); - errno = err; - return -1; - } - - fd.handle = handle; - fd.part_start = 0; - fd.part_end = (((s64) info.nFileSizeHigh) << 32) + - ((s64) info.nFileSizeLow); - fd.current_pos.QuadPart = 0; + if (err) { + /* error */ + return err; } Dprintf("win32_open(%s) -> %p, offset 0x%llx\n", dev->d_name, dev, From 0d5f1fdb3e8769357997b103073a307223eb09c0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:35:10 +0000 Subject: [PATCH 1596/2994] Re-factor the existing ntfs_device_win32_open(). (Yuval) BKrev: 40f64fceuQ22VqwuFd2azoFK3yjgtA From 40d73718128a3de5ebf9758411eeba091fe2c58a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:37:03 +0000 Subject: [PATCH 1597/2994] Implement ntfs_device_win32_sync(). (Logical change 1.459) --- libntfs/win32_io.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 0e4b9195..dcff0bbc 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -563,11 +563,21 @@ static s64 win32_filepos(struct ntfs_device *dev) return fd->current_pos.QuadPart; } +/** + * ntfs_device_win32_sync - Flush write buffers to disk. + * @dev: An NTFS_DEVICE obtained via the open command. + * + * Return 0 if o.k. + * -errno if not, in this case handle is trashed. + */ static int ntfs_device_win32_sync(struct ntfs_device *dev) { - fprintf(stderr, "win32_fsync() unimplemented\n"); - errno = ENOTSUP; - return -1; + if (FlushFileBuffers(((win32_fd *)dev->d_private)->handle)) { + return 0; + } else { + errno = ntfs_w32error_to_errno(GetLastError()); + return -errno; + } } static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buffer, From 09ffab42247a88b41025c95be2ef8ee797716677 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:37:03 +0000 Subject: [PATCH 1598/2994] Implement ntfs_device_win32_sync(). (Yuval) BKrev: 40f6503fWhRVQKdnM9a8qiThOT56Bg From 2604474716029cb470e186b5dbcbdfdefaf7037e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:40:34 +0000 Subject: [PATCH 1599/2994] Implement ntfs_device_win32_stat(). (Logical change 1.460) --- libntfs/win32_io.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index dcff0bbc..bab90228 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -588,11 +588,42 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buffer, return -1; } +/** + * ntfs_device_win32_stat - Get a Unix-like stat structure for the file. + * @dev: An NTFS_DEVICE obtained via the open command. + * @argp: A pointer to where to put the output. + * + * Only st_mode & st_size are filled. + * + * Return 0 if o.k. + * -errno if not, in this case handle is trashed. + */ static int ntfs_device_win32_stat(struct ntfs_device *dev, struct stat *buf) { - fprintf(stderr, "win32_fstat() unimplemented\n"); - errno = ENOTSUP; - return -1; + mode_t st_mode; + s64 st_size = 0; + int ret; + + switch (GetFileType(((win32_fd *)dev->d_private)->handle)) { + case FILE_TYPE_CHAR: + st_mode = S_IFCHR; + case FILE_TYPE_DISK: + st_mode = S_IFBLK; + case FILE_TYPE_PIPE: + st_mode = S_IFIFO; + default: + st_mode = 0; + } + + ret = ntfs_win32_getsize(dev,&st_size); + if (ret) + Dprintf("ntfs_device_win32_stat(): getsize failed"); + + memset(buf,0,sizeof (struct stat)); + buf->st_mode = st_mode; + buf->st_size = st_size; + + return 0; } /** From e2b3e1c7e2d2ff145249d2075181842a55cd8ad2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:40:34 +0000 Subject: [PATCH 1600/2994] Implement ntfs_device_win32_stat(). (Yuval) BKrev: 40f65112kzadGJ_BNlusLftSdMvvNg From 203365d140b5315ad67671af1cbc465f58f9b700 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:41:47 +0000 Subject: [PATCH 1601/2994] Add nice comments to functions (libntfs/win32_io.c). (Yuval) BKrev: 40f6515bNFnQbSXIq8-3D1RzbGMoVA From d3007d554230727dfd0c14e57c2cf584867b32f9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:41:47 +0000 Subject: [PATCH 1602/2994] Add nice comments to functions. (Logical change 1.461) --- libntfs/win32_io.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index bab90228..950dadef 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -398,6 +398,18 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) return 0; } +/** + * ntfs_device_win32_seek - Change current file position. + * @handle: Pointer the file HADNLE obtained via open. + * @offset: Required offset from the whence anchor. + * @whence: May be one of the following: + * SEEK_SET Offset is relative to file start. + * SEEK_CUR Offset is relative to current position. + * SEEK_END Offset is relative to end of file. + * + * Return 0 if o.k. + * -errno if not, in this case handle is trashed. + */ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, int whence) { @@ -445,6 +457,15 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, return offset; } +/** + * ntfs_device_win32_read - Read 'count' bytes from 'dev' into 'buf'. + * @dev: An NTFS_DEVICE obtained via the open command. + * @buf: A pointer to where to put the contents. + * @count: How many bytes should be read. + * + * On success returns the amount of bytes actually read. + * On fail returns -errno. + */ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) { struct win32_fd *fd = (win32_fd *)dev->d_private; @@ -527,6 +548,14 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) return numread; } +/** + * ntfs_device_win32_close - Close an open NTFS_DEVICE and + * free internal buffers. + * @dev: An NTFS_DEVICE obtained via the open command. + * + * Return 0 if o.k. + * -errno if not, in this case handle is trashed. + */ static int ntfs_device_win32_close(struct ntfs_device *dev) { struct win32_fd *fd = (win32_fd *)dev->d_private; @@ -580,6 +609,15 @@ static int ntfs_device_win32_sync(struct ntfs_device *dev) } } +/** + * ntfs_device_win32_write - Write 'count' bytes from 'buf' into 'dev'. + * @dev: An NTFS_DEVICE obtained via the open command. + * @buf: A pointer to the contents. + * @count: How many bytes should be written. + * + * On success returns the amount of bytes actually written. + * On fail returns -errno. + */ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buffer, s64 count) { From 51c0cb5fcddffb7086bb7733c00bbc2ca3d243a2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:43:09 +0000 Subject: [PATCH 1603/2994] Remove 2 unused functions (libntfs/win32_io.c). (Yuval) BKrev: 40f651adkTKbejCDRqQyXl-Ea41k2A From faa7f82c0cd5187d33eb986b2474eaed03492f31 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:43:09 +0000 Subject: [PATCH 1604/2994] Remove 2 unused functions. (Logical change 1.462) --- libntfs/win32_io.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 950dadef..8a0cd605 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -578,20 +578,6 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) return 0; } -static s64 win32_bias(struct ntfs_device *dev) -{ - struct win32_fd *fd = (win32_fd *)dev->d_private; - - return fd->part_start; -} - -static s64 win32_filepos(struct ntfs_device *dev) -{ - struct win32_fd *fd = (win32_fd *)dev->d_private; - - return fd->current_pos.QuadPart; -} - /** * ntfs_device_win32_sync - Flush write buffers to disk. * @dev: An NTFS_DEVICE obtained via the open command. From 3297e348b14c593e7be952fc61bb11f27bac5dc2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:50:08 +0000 Subject: [PATCH 1605/2994] Update ChangeLog for Yuval's win32 changes. BKrev: 40f65350NKnTsE3Pjtb1qytVuZIE0g From bb757d90120ca6097c090f0a3e9d5417f39ebb7f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 15 Jul 2004 09:50:08 +0000 Subject: [PATCH 1606/2994] Update for Yuval's win32 changes. (Logical change 1.463) --- ChangeLog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index f10f185d..c04fbca9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,16 @@ xx/xx/2004 - 1.9.3-WIP - ntfswipe - wipe file tails and directory indexes (Yura) - Bugfix in ntfs_rl_pread,pwrite for pos > 0. (Yura) - Added special image format support in ntfsclone. (Per Olofsson) + - Major win32_io.c update implementing ->ioctl, ->sync, and ->stat. + Should compile on any machine with NT/2k/XP compatible include files. + That means EVERY cygwin/mingw32 compiler, possibly even + Intel/Microsoft. Will probably not work on djgpp. All external DLL + imports exist on any Windows 9x/NT+, so it should work on any Windows + PC. Tested only on Windows XP. The write code is trivial now, but I + would wait with it until I figure out how to find if a volume is + mounted or not in Windows. Also mkntfs still has no chance of + working as getting the head-count is NT specific and as such wasn't + implemented. (Yuval) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From 387bb6c5cdfaa59f9218cd2af45583d55622dfa5 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 15 Jul 2004 18:28:05 +0000 Subject: [PATCH 1607/2994] Merge 2004/07/15 19:21:58+01:00 flatcap.org!ntfs ntfsundelete: Thanks to mabs. If undelete is confident about the size of a deleted file, the "--truncate" option will recover exactly that amount of data. The default is to round up the size to the nearest cluster. BKrev: 40f6ccb5SCzucLc1iVaA_LGMf1eQiw From f76bf5b5faeabf0bdca8f8b3240f164c81538a5b Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 15 Jul 2004 18:28:05 +0000 Subject: [PATCH 1608/2994] SCCS merged 2004/07/15 19:21:58+01:00 flatcap.org!ntfs ntfsundelete truncate option (Logical change 1.464) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index c04fbca9..ff461873 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,6 +34,7 @@ xx/xx/2004 - 1.9.3-WIP mounted or not in Windows. Also mkntfs still has no chance of working as getting the head-count is NT specific and as such wasn't implemented. (Yuval) + - Added truncate option to ntfsundelete (mabs) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From 6968c5bc66593069bd540f4f59044f5d2560d4cb Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 15 Jul 2004 18:28:05 +0000 Subject: [PATCH 1609/2994] truncate option (Logical change 1.464) --- ntfsprogs/ntfsundelete.8.in | 11 ++++++ ntfsprogs/ntfsundelete.c | 77 ++++++++++++++++++++++++++----------- ntfsprogs/ntfsundelete.h | 1 + 3 files changed, 67 insertions(+), 22 deletions(-) diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index b35c2e40..a4e2b3f8 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -264,6 +264,17 @@ option. Only match files that have been altered since this time. The time must be given as number using a suffix of d, w, m, y for days, weeks, months or years ago. .TP +.BI \-T +.br +.ns +.TP +.BI \-\-truncate +If +.BR ntfsundelete +is confident about the size of a deleted file, then it will restore the file to +exactly that size. The default behaviour is to round up the size to the nearest +cluster (which will be a multiple of 512 bytes). +.TP .BI "\-u " nums .br .ns diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 0e4f2864..5d479b57 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -223,6 +223,7 @@ static void usage (void) " -o file --output file Save with this filename\n" " -d dir --destination dir Destination directory\n" " -b num --byte num Fill missing parts with this byte\n" + " -T --truncate Truncate 100%% recoverable file to exact size.\n" "\n" " -c range --copy range Write a range of MFT records to a file\n" "\n" @@ -389,7 +390,7 @@ static int parse_time (const char *value, time_t *since) */ static int parse_options (int argc, char *argv[]) { - static const char *sopt = "-b:Cc:d:fh?m:o:p:sS:t:u:qvV"; + static const char *sopt = "-b:Cc:d:fh?m:o:p:sS:t:Tu:qvV"; static const struct option lopt[] = { { "byte", required_argument, NULL, 'b' }, { "case", no_argument, NULL, 'C' }, @@ -403,6 +404,7 @@ static int parse_options (int argc, char *argv[]) { "scan", no_argument, NULL, 's' }, { "size", required_argument, NULL, 'S' }, { "time", required_argument, NULL, 't' }, + { "truncate", no_argument, NULL, 'T' }, { "undelete", required_argument, NULL, 'u' }, { "quiet", no_argument, NULL, 'q' }, { "verbose", no_argument, NULL, 'v' }, @@ -518,6 +520,9 @@ static int parse_options (int argc, char *argv[]) err++; } break; + case 'T': + opts.truncate++; + break; case 'u': if (opts.mode == MODE_NONE) { @@ -568,7 +573,7 @@ static int parse_options (int argc, char *argv[]) switch (opts.mode) { case MODE_SCAN: - if (opts.output || opts.dest || + if (opts.output || opts.dest || opts.truncate || (opts.fillbyte != (char)-1)) { Eprintf ("Scan can only be used with --percent, " "--match, --ignore-case, --size and --time.\n"); @@ -583,16 +588,16 @@ static int parse_options (int argc, char *argv[]) if ((opts.percent != -1) || opts.match || opts.match_case || (opts.size_begin > 0) || (opts.size_end > 0)) { Eprintf ("Undelete can only be used with " - "--output, --destination and --byte.\n"); + "--output, --destination, --byte and --truncate.\n"); err++; } break; case MODE_COPY: - if ((opts.fillbyte != (char)-1) || - (opts.percent != -1) || - opts.match || opts.match_case || - (opts.size_begin > 0) || - (opts.size_end > 0)) { + if ((opts.fillbyte != (char)-1) || opts.truncate || + (opts.percent != -1) || + opts.match || opts.match_case || + (opts.size_begin > 0) || + (opts.size_end > 0)) { Eprintf ("Copy can only be used with --output and --destination.\n"); err++; } @@ -1522,6 +1527,7 @@ static int undelete_file (ntfs_volume *vol, long long inode) long long k; int result = 0; char *name; + long long cluster_count; /* I'll need this variable (see below). +mabs */ if (!vol) return 0; @@ -1537,6 +1543,20 @@ static int undelete_file (ntfs_volume *vol, long long inode) if (!buffer) goto free; + if (file->mft->flags & MFT_RECORD_IN_USE) { /* These two statement blocks were */ + Eprintf ("Record is in use by the mft\n"); /* relocated from below because */ + if (!opts.force) { /* calc_percentage() must be called */ + free_file (file); /* before dump_record() or list_record(). */ + return 0; /* Otherwise, when undeleting, a file */ + } /* will always be listed as 0% recoverable */ + Vprintf ("Forced to continue.\n"); /* even if successfully undeleted. +mabs */ + } + + if (calc_percentage (file, vol) == 0) { + Qprintf ("File has no recoverable data.\n"); + goto free; + } + if (opts.verbose) { dump_record (file); } else { @@ -1546,20 +1566,6 @@ static int undelete_file (ntfs_volume *vol, long long inode) Qprintf ("\n"); } - if (file->mft->flags & MFT_RECORD_IN_USE) { - Eprintf ("Record is in use by the mft\n"); - if (!opts.force) { - free_file (file); - return 0; - } - Vprintf ("Forced to continue.\n"); - } - - if (calc_percentage (file, vol) == 0) { - Qprintf ("File has no recoverable data.\n"); - goto free; - } - if (list_empty (&file->data)) { Qprintf ("File has no data. There is nothing to recover.\n"); goto free; @@ -1624,6 +1630,7 @@ static int undelete_file (ntfs_volume *vol, long long inode) } } + cluster_count = 0LL; for (i = 0; rl[i].length > 0; i++) { if (rl[i].lcn == LCN_RL_NOT_MAPPED) { @@ -1637,6 +1644,7 @@ static int undelete_file (ntfs_volume *vol, long long inode) close (fd); goto free; } + cluster_count++; } continue; } @@ -1676,10 +1684,35 @@ static int undelete_file (ntfs_volume *vol, long long inode) close (fd); goto free; } + cluster_count++; } } } Qprintf ("\n"); + + /* The following block of code implements the --truncate option. */ + /* Its semantics are as follows: */ + /* IF opts.truncate is set AND data stream currently being recovered is */ + /* non-resident AND data stream has no holes (100% recoverability) AND */ + /* 0 <= (data->size_alloc - data->size_data) <= vol->cluster_size AND */ + /* cluster_count * vol->cluster_size == data->size_alloc THEN file */ + /* currently being written is truncated to data->size_data bytes before */ + /* it's closed. */ + /* This multiple checks try to ensure that only files with consistent */ + /* values of size/occupied clusters are eligible for truncation. Note */ + /* that resident streams need not be truncated, since the original code */ + /* already recovers their exact length. +mabs */ + + if (opts.truncate) { + if (d->percent == 100 && d->size_alloc >= d->size_data && + (d->size_alloc - d->size_data) <= (long long)vol->cluster_size && + cluster_count * (long long)vol->cluster_size == d->size_alloc) { + if (ftruncate(fd, (off_t)d->size_data)) + Eprintf("Truncation failed: %s\n", strerror(errno)); + } else Qprintf("Truncation not performed because file has an " + "inconsistent $MFT record.\n"); + } + if (close (fd) < 0) { Eprintf ("Close failed: %s\n", strerror (errno)); } diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index d2cb4c66..2e0a2189 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -46,6 +46,7 @@ struct options { char fillbyte; /* Use for unrecoverable sections */ char *match; /* Pattern for filename matching */ int match_case; /* Case sensitive matching */ + int truncate; /* Truncate files to exact size. */ int quiet; /* Less output */ int verbose; /* Extra output */ int force; /* Override common sense */ From 6c711382945cf80bc7a7227ebf7a40da74b0b4a1 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 30 Jul 2004 13:00:24 +0000 Subject: [PATCH 1610/2994] (Logical change 1.465) --- ntfsprogs/ntfscp.c | 308 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 308 insertions(+) create mode 100644 ntfsprogs/ntfscp.c diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c new file mode 100644 index 00000000..d2e2eb2c --- /dev/null +++ b/ntfsprogs/ntfscp.c @@ -0,0 +1,308 @@ +/** + * ntfscp - Part of the Linux-NTFS project. + * + * Copyright (c) 2004 Yura Pakhuchiy + * + * This utility will overwrite files on ntfs volume + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "types.h" +#include "attrib.h" +#include "utils.h" +#include "volume.h" +#include "debug.h" + +struct options { + char *device; /* Device/File to work with */ + char *src_file; /* Source file */ + char *dest_file; /* Destination file */ + int force; /* Override common sense */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int noaction; /* Do not write to disk */ +}; + +static const char *EXEC_NAME = "ntfscp"; +static struct options opts; + +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) +GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) +static GEN_PRINTF (Printf, stderr, NULL, FALSE) + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +static void version (void) +{ + Printf ("\n%s v%s - Overwrite files on NTFS volume.\n\n", + EXEC_NAME, VERSION); + Printf ("Copyright (c) 2004 Yura Pakhuchiy\n"); + Printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +static void usage (void) +{ + Printf ("\nUsage: %s [options] device src_file dest_file\n\n" + " -f --force Use less caution\n" + " -h --help Print this help\n" + " -n --no-action Do not write to disk\n" + " -q --quiet Less output\n" + " -V --version Version information\n" + " -v --verbose More output\n\n", + EXEC_NAME); + Printf ("%s%s\n", ntfs_bugs, ntfs_home); +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +static int parse_options (int argc, char **argv) +{ + static const char *sopt = "-fh?nqVv"; + static const struct option lopt[] = { + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "no-action", no_argument, NULL, 'n' }, + { "quiet", no_argument, NULL, 'q' }, + { "version", no_argument, NULL, 'V' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + int err = 0; + int ver = 0; + int help = 0; + + opts.device = 0; + opts.src_file = 0; + opts.dest_file = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else if (!opts.src_file) { + opts.src_file = argv[optind-1]; + } else if (!opts.dest_file) { + opts.dest_file = argv[optind-1]; + } else { + Eprintf("You must specify exactly two files.\n"); + err++; + } + break; + case 'f': + opts.force++; + break; + case 'h': + case '?': + help++; + break; + case 'n': + opts.noaction++; + break; + case 'q': + opts.quiet++; + break; + case 'V': + ver++; + break; + case 'v': + opts.verbose++; + break; + default: + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if (!opts.device) { + Eprintf ("You must specify a device.\n"); + err++; + } else if (!opts.src_file) { + Eprintf ("You must specify a source file.\n"); + err++; + } else if (!opts.dest_file) { + Eprintf ("You must specify a destination file.\n"); + err++; + } + + if (opts.quiet && opts.verbose) { + Eprintf("You may not use --quiet and --verbose at the " + "same time.\n"); + err++; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main (int argc, char *argv[]) +{ + FILE *in; + ntfs_volume *vol; + ntfs_inode *out; + ntfs_attr *na; + int flags = 0; + int result = 1; + s64 new_size; + int need_logfile_reset = 0; + u64 offset; + char *buf; + s64 br, bw; + + if (!parse_options (argc, argv)) + return 1; + + utils_set_locale(); + + if (opts.noaction) + flags = MS_RDONLY; + + vol = utils_mount_volume (opts.device, flags, opts.force); + if (!vol) { + perror("ERROR: couldn't mount volume"); + return 1; + } + + if ((vol->flags & VOLUME_IS_DIRTY) && (!opts.force)) + goto umount; + + { + struct stat fst; + if (stat (opts.src_file, &fst) == -1) { + perror ("ERROR: Couldn't star source file\n"); + goto umount; + } + new_size = fst.st_size; + } + Vprintf ("New file size: %lld\n", new_size); + + in = fopen (opts.src_file, "r"); + if (!in) { + perror ("ERROR: Couldn't open source file"); + goto umount; + } + + out = utils_pathname_to_inode (vol, NULL, opts.dest_file); + if (!out) { + perror ("ERROR: Couldn't open destination file"); + goto close_src; + } + + na = ntfs_attr_open (out, AT_DATA, 0, 0); + if (!na) { + perror ("ERROR: Couldn't open $DATA attribute"); + goto close_dst; + } + + Vprintf ("Old file size: %lld\n", na->data_size); + if (na->data_size != new_size) { + if (ntfs_attr_truncate (na, new_size)) { + perror ("ERROR: Couldn't resize $DATA attribute"); + goto close_attr; + } + need_logfile_reset = 1; + } + + buf = malloc (NTFS_BUF_SIZE); + if (!buf) { + perror ("ERROR: malloc failed"); + goto close_attr; + } + + offset = 0; + while (!feof (in)) { + br = fread (buf, 1, NTFS_BUF_SIZE, in); + if (!br) { + if (!feof (in)) perror ("ERROR: fread failed"); + break; + } + + bw = ntfs_attr_pwrite (na, offset, br, buf); + if (bw != br) { + perror ("ERROR: ntfs_attr_pwrite failed"); + break; + } + offset += bw; + } + need_logfile_reset = 1; + + free (buf); +close_attr: + ntfs_attr_close (na); +close_dst: + ntfs_inode_close (out); + + if (need_logfile_reset) { + printf ("Resetting logfile.\n"); + ntfs_logfile_reset (vol); + } + +close_src: + fclose (in); +umount: + ntfs_umount (vol, FALSE); + + return result; +} From d2fd32b48176f73cf2d134d229d1ac4ea676df93 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 30 Jul 2004 13:00:24 +0000 Subject: [PATCH 1611/2994] Fix bug in ntfs_attr_size_bounds_check that caused it always fail if no maximum limit for attribute size (Logical change 1.465) --- libntfs/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 1a39689f..387b0d34 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2127,7 +2127,7 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type, /* We found the attribute. - Do the bounds check. */ if ((sle64_to_cpu(ad->min_size) && size < sle64_to_cpu(ad->min_size)) || - (sle64_to_cpu(ad->max_size) && size > + ((sle64_to_cpu(ad->max_size) > 0) && size > sle64_to_cpu(ad->max_size))) { /* @size is out of range! */ errno = ERANGE; From 1ce46a27b1c23492e5b253ed147e1330d1c67d5d Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 30 Jul 2004 13:00:24 +0000 Subject: [PATCH 1612/2994] Initial revision --- ntfsprogs/ntfscp.c | 308 --------------------------------------------- 1 file changed, 308 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index d2e2eb2c..e69de29b 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -1,308 +0,0 @@ -/** - * ntfscp - Part of the Linux-NTFS project. - * - * Copyright (c) 2004 Yura Pakhuchiy - * - * This utility will overwrite files on ntfs volume - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include -#include -#include -#include - -#include "types.h" -#include "attrib.h" -#include "utils.h" -#include "volume.h" -#include "debug.h" - -struct options { - char *device; /* Device/File to work with */ - char *src_file; /* Source file */ - char *dest_file; /* Destination file */ - int force; /* Override common sense */ - int quiet; /* Less output */ - int verbose; /* Extra output */ - int noaction; /* Do not write to disk */ -}; - -static const char *EXEC_NAME = "ntfscp"; -static struct options opts; - -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) -static GEN_PRINTF (Printf, stderr, NULL, FALSE) - -/** - * version - Print version information about the program - * - * Print a copyright statement and a brief description of the program. - * - * Return: none - */ -static void version (void) -{ - Printf ("\n%s v%s - Overwrite files on NTFS volume.\n\n", - EXEC_NAME, VERSION); - Printf ("Copyright (c) 2004 Yura Pakhuchiy\n"); - Printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); -} - -/** - * usage - Print a list of the parameters to the program - * - * Print a list of the parameters and options for the program. - * - * Return: none - */ -static void usage (void) -{ - Printf ("\nUsage: %s [options] device src_file dest_file\n\n" - " -f --force Use less caution\n" - " -h --help Print this help\n" - " -n --no-action Do not write to disk\n" - " -q --quiet Less output\n" - " -V --version Version information\n" - " -v --verbose More output\n\n", - EXEC_NAME); - Printf ("%s%s\n", ntfs_bugs, ntfs_home); -} - -/** - * parse_options - Read and validate the programs command line - * - * Read the command line, verify the syntax and parse the options. - * This function is very long, but quite simple. - * - * Return: 1 Success - * 0 Error, one or more problems - */ -static int parse_options (int argc, char **argv) -{ - static const char *sopt = "-fh?nqVv"; - static const struct option lopt[] = { - { "force", no_argument, NULL, 'f' }, - { "help", no_argument, NULL, 'h' }, - { "no-action", no_argument, NULL, 'n' }, - { "quiet", no_argument, NULL, 'q' }, - { "version", no_argument, NULL, 'V' }, - { "verbose", no_argument, NULL, 'v' }, - { NULL, 0, NULL, 0 } - }; - - char c = -1; - int err = 0; - int ver = 0; - int help = 0; - - opts.device = 0; - opts.src_file = 0; - opts.dest_file = 0; - - opterr = 0; /* We'll handle the errors, thank you. */ - - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { - switch (c) { - case 1: /* A non-option argument */ - if (!opts.device) { - opts.device = argv[optind-1]; - } else if (!opts.src_file) { - opts.src_file = argv[optind-1]; - } else if (!opts.dest_file) { - opts.dest_file = argv[optind-1]; - } else { - Eprintf("You must specify exactly two files.\n"); - err++; - } - break; - case 'f': - opts.force++; - break; - case 'h': - case '?': - help++; - break; - case 'n': - opts.noaction++; - break; - case 'q': - opts.quiet++; - break; - case 'V': - ver++; - break; - case 'v': - opts.verbose++; - break; - default: - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); - err++; - break; - } - } - - if (help || ver) { - opts.quiet = 0; - } else { - if (!opts.device) { - Eprintf ("You must specify a device.\n"); - err++; - } else if (!opts.src_file) { - Eprintf ("You must specify a source file.\n"); - err++; - } else if (!opts.dest_file) { - Eprintf ("You must specify a destination file.\n"); - err++; - } - - if (opts.quiet && opts.verbose) { - Eprintf("You may not use --quiet and --verbose at the " - "same time.\n"); - err++; - } - } - - if (ver) - version(); - if (help || err) - usage(); - - return (!err && !help && !ver); -} - -/** - * main - Begin here - * - * Start from here. - * - * Return: 0 Success, the program worked - * 1 Error, something went wrong - */ -int main (int argc, char *argv[]) -{ - FILE *in; - ntfs_volume *vol; - ntfs_inode *out; - ntfs_attr *na; - int flags = 0; - int result = 1; - s64 new_size; - int need_logfile_reset = 0; - u64 offset; - char *buf; - s64 br, bw; - - if (!parse_options (argc, argv)) - return 1; - - utils_set_locale(); - - if (opts.noaction) - flags = MS_RDONLY; - - vol = utils_mount_volume (opts.device, flags, opts.force); - if (!vol) { - perror("ERROR: couldn't mount volume"); - return 1; - } - - if ((vol->flags & VOLUME_IS_DIRTY) && (!opts.force)) - goto umount; - - { - struct stat fst; - if (stat (opts.src_file, &fst) == -1) { - perror ("ERROR: Couldn't star source file\n"); - goto umount; - } - new_size = fst.st_size; - } - Vprintf ("New file size: %lld\n", new_size); - - in = fopen (opts.src_file, "r"); - if (!in) { - perror ("ERROR: Couldn't open source file"); - goto umount; - } - - out = utils_pathname_to_inode (vol, NULL, opts.dest_file); - if (!out) { - perror ("ERROR: Couldn't open destination file"); - goto close_src; - } - - na = ntfs_attr_open (out, AT_DATA, 0, 0); - if (!na) { - perror ("ERROR: Couldn't open $DATA attribute"); - goto close_dst; - } - - Vprintf ("Old file size: %lld\n", na->data_size); - if (na->data_size != new_size) { - if (ntfs_attr_truncate (na, new_size)) { - perror ("ERROR: Couldn't resize $DATA attribute"); - goto close_attr; - } - need_logfile_reset = 1; - } - - buf = malloc (NTFS_BUF_SIZE); - if (!buf) { - perror ("ERROR: malloc failed"); - goto close_attr; - } - - offset = 0; - while (!feof (in)) { - br = fread (buf, 1, NTFS_BUF_SIZE, in); - if (!br) { - if (!feof (in)) perror ("ERROR: fread failed"); - break; - } - - bw = ntfs_attr_pwrite (na, offset, br, buf); - if (bw != br) { - perror ("ERROR: ntfs_attr_pwrite failed"); - break; - } - offset += bw; - } - need_logfile_reset = 1; - - free (buf); -close_attr: - ntfs_attr_close (na); -close_dst: - ntfs_inode_close (out); - - if (need_logfile_reset) { - printf ("Resetting logfile.\n"); - ntfs_logfile_reset (vol); - } - -close_src: - fclose (in); -umount: - ntfs_umount (vol, FALSE); - - return result; -} From b92c24f0aef5085b2760a3adc8a661846fbc50f2 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 30 Jul 2004 13:00:24 +0000 Subject: [PATCH 1613/2994] New utility - ntfscp. libntfs/attrib.c: bugfix for ntfs_attr_size_bounds_check BKrev: 410a4668fcSXLpwrIJvgGhdNXGsEYQ From ebeac904ba658bb341ab3226e316b276bfc63b82 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 30 Jul 2004 13:00:24 +0000 Subject: [PATCH 1614/2994] add ntfscp to ignore list (Logical change 1.465) --- BitKeeper/etc/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 71a53422..debc6144 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -55,4 +55,5 @@ ntfsprogs/ntfsrm ntfsprogs/ntfstruncate ntfsprogs/ntfsundelete ntfsprogs/ntfswipe +ntfsprogs/ntfscp From 50b90266289be418e7dd3d833903253988157a2a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 1 Aug 2004 11:05:46 +0000 Subject: [PATCH 1615/2994] Add a @start_vcn parameter to lcnalloc.[ch]::ntfs_cluster_alloc (Logical change 1.466) --- include/ntfs/lcnalloc.h | 2 +- libntfs/lcnalloc.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/ntfs/lcnalloc.h b/include/ntfs/lcnalloc.h index 94774c72..b0dded9a 100644 --- a/include/ntfs/lcnalloc.h +++ b/include/ntfs/lcnalloc.h @@ -35,7 +35,7 @@ typedef enum { } NTFS_CLUSTER_ALLOCATION_ZONES; extern runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, - const NTFS_CLUSTER_ALLOCATION_ZONES zone); + const NTFS_CLUSTER_ALLOCATION_ZONES zone, VCN start_vcn); extern int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count); diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index a616e8af..a6c8501f 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -87,13 +87,9 @@ * removing the duplicate logic requires _very_ careful consideration of _all_ * possible code paths. So at least for now, I am leaving the double logic - * better safe than sorry... (AIA) - * - * FIXME: Add a start_vcn parameter if we need it and then instead of setting - * rl[rlpos].vcn = 0; for the first run, add a sparse start element (LCN_HOLE), - * and make rl[rlpos].vcn = start_vcn; for the first non-sparse run. (AIA) */ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, - const NTFS_CLUSTER_ALLOCATION_ZONES zone) + const NTFS_CLUSTER_ALLOCATION_ZONES zone, VCN start_vcn) { LCN zone_start, zone_end, bmp_pos, bmp_initial_pos, last_read_pos, lcn; LCN prev_lcn = 0, prev_run_len = 0, mft_zone_size; @@ -330,6 +326,12 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, "first run.\n", __FUNCTION__); rl[rlpos].vcn = 0; + if (start_vcn) { + rl[0].lcn = LCN_RL_NOT_MAPPED; + rl[0].length = start_vcn; + rl[1].vcn = start_vcn; + rlpos = 1; + } } rl[rlpos].lcn = prev_lcn = lcn + bmp_pos; rl[rlpos].length = prev_run_len = 1; From 70bfea10803680b4d78bab75fa2e2ead806a44b0 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 1 Aug 2004 11:05:46 +0000 Subject: [PATCH 1616/2994] Add new function attrib.c::ntfs_non_resident_attr_expand, thus we can expand non resident attributes (Logical change 1.466) --- libntfs/attrib.c | 243 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 233 insertions(+), 10 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 387b0d34..7df7a3e2 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3,6 +3,7 @@ * * Copyright (c) 2000-2004 Anton Altaparmakov * Copyright (c) 2002 Richard Russon + * Copyright (c) 2004 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -42,6 +43,7 @@ #include "lcnalloc.h" #include "dir.h" #include "compress.h" +#include "bitmap.h" ntfschar AT_UNNAMED[] = { const_cpu_to_le16('\0') }; @@ -2378,7 +2380,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, /* Start by allocating clusters to hold the attribute value. */ rl = ntfs_cluster_alloc(vol, new_allocated_size >> - vol->cluster_size_bits, -1, DATA_ZONE); + vol->cluster_size_bits, -1, DATA_ZONE, 0); if (!rl) { if (errno != ENOSPC) { int eo = errno; @@ -3102,6 +3104,228 @@ put_err_out: return -1; } +/** + * ntfs_non_resident_attr_expand - expand a non-resident, open ntfs attribute + * @na: non-resident ntfs attribute to expand + * @newsize: new size (in bytes) to which to expand the attribute + * + * Expand the size of a non-resident, open ntfs attribute @na to @newsize bytes, + * by allocating new clusters. + * + * On success return 0 and on error return -1 with errno set to the error code. + * The following error codes are defined: + * ENOTSUP - The desired resize is not implemented yet. + * ENOMEM - Not enough memory to complete operation. + * ERANGE - @newsize is not valid for the attribute type of @na. + */ +static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) +{ + ntfs_volume *vol; + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + MFT_RECORD *m; + VCN first_free_vcn; + s64 nr_need_allocate; + u32 new_alen, new_muse; + int err, mp_size, cur_max_mp_size, exp_max_mp_size; + runlist *rl, *rln; + LCN lcn_seek_from = 0; + + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, + (unsigned long long)na->ni->mft_no, na->type); + + vol = na->ni->vol; + + /* Get the first attribute record that needs modification. */ + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); + if (!ctx) + return -1; + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, + NULL, 0, ctx)) { + err = errno; + if (err == ENOENT) + err = EIO; + goto put_err_out; + } + a = ctx->attr; + m = ctx->mrec; + /* + * Check the attribute type and the corresponding maximum size + * against @newsize and fail if @newsize is too big. + */ + if (ntfs_attr_size_bounds_check(vol, na->type, newsize) < 0) { + err = errno; + if (err == ERANGE) { + fprintf(stderr, "%s(): Eeek! Size bounds check " + "failed. Aborting...\n", __FUNCTION__); + } else if (err == ENOENT) + err = EIO; + goto put_err_out; + } + + if (NInoAttrList(na->ni)) { + err = ENOTSUP; + goto put_err_out; + } + + /* The first cluster outside the new allocation. */ + first_free_vcn = (newsize + vol->cluster_size - 1) >> + vol->cluster_size_bits; + /* + * Compare the new allocation with the old one and only deallocate + * clusters if there is a change. + */ + if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { + nr_need_allocate = first_free_vcn - + (na->allocated_size >> vol->cluster_size_bits); + + if (ntfs_attr_map_whole_runlist (na)) { + err = EIO; + fprintf(stderr, "%s(): Eeek! " + "ntfs_attr_map_whole_runlist failed.\n", + __FUNCTION__); + goto put_err_out; + } + + /* + * Determine first after last LCN of attribute. We will start + * seek clusters from this LCN to avoid fragmentation. + */ + if (na->rl->length) { + for (rl = na->rl; (rl + 1)->length; rl++) + ; + lcn_seek_from = rl->lcn + rl->length; + } + + rl = ntfs_cluster_alloc(vol, nr_need_allocate, lcn_seek_from, + DATA_ZONE, na->allocated_size >> + vol->cluster_size_bits); + if (!rl) { + err = errno; + fprintf(stderr, "%s(): Eeek! Cluster allocation " + "failed.\n", __FUNCTION__); + goto put_err_out; + } + + /* Append new clusters to attribute runlist */ + rln = ntfs_runlists_merge (na->rl, rl); + if (!rln) { + /* Failed, free just allocated clusters */ + err = errno; + fprintf(stderr, "%s(): Eeek! Run list merge " + "failed.\n", __FUNCTION__); + rln = rl; + if (rln->lcn == LCN_RL_NOT_MAPPED) rln++; + while (rln->length) { + if (ntfs_bitmap_clear_run(vol->lcnbmp_na, + rln->lcn, rln->length)) + fprintf(stderr, "%s(): Eeek! " + "Deallocation of just " + "allocated clusters " + "failed.\n", __FUNCTION__); + rln++; + } + free (rl); + goto put_err_out; + } + na->rl = rln; + + /* Get the size for the new mapping pairs array. */ + mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); + /* + * Determine maximum possible length of mapping pairs, + * if we shall *not* expand space for mapping pairs + */ + cur_max_mp_size = le32_to_cpu(a->length) - + le16_to_cpu(a->mapping_pairs_offset); + /* + * Determine maximum possible length of mapping pairs, + * if we shall expand space for mapping pairs + */ + exp_max_mp_size = le32_to_cpu(m->bytes_allocated) + - le32_to_cpu(m->bytes_in_use) + cur_max_mp_size; + + if (mp_size > exp_max_mp_size) { + err = ENOTSUP; + fprintf(stderr, "%s(): Eeek! Maping pairs size is" + " too big.\n", __FUNCTION__); + ntfs_cluster_free (vol, na, na->allocated_size >> + vol->cluster_size_bits, -1); + goto put_err_out; + } + + /* Expand space for mapping pairs if we need this*/ + if (mp_size > cur_max_mp_size) { + /* + * Calculate the new attribute length and mft record + * bytes used. + */ + new_alen = (le16_to_cpu(a->mapping_pairs_offset) + + mp_size + 7) & ~7; + new_muse = le32_to_cpu(m->bytes_in_use) - + le32_to_cpu(a->length) + new_alen; + if (new_muse > le32_to_cpu(m->bytes_allocated)) { + fprintf(stderr, "%s(): BUG! Ran out of space in" + " mft record. Please report to " + "linux-ntfs-dev@lists.sf.net\n", + __FUNCTION__); + ntfs_cluster_free (vol, na, na->allocated_size + >> vol->cluster_size_bits, -1); + err = EIO; + goto put_err_out; + } + /* Move the following attributes forward. */ + memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu( + a->length), le32_to_cpu(m->bytes_in_use) + - ((u8*)a - (u8*)m) - le32_to_cpu( + a->length)); + /* Update the sizes of the attribute and mft records. */ + a->length = cpu_to_le32(new_alen); + m->bytes_in_use = cpu_to_le32(new_muse); + } + + if (mp_size <= 0) { + err = errno; + fprintf(stderr, "%s(): Eeek! Get size for mapping " + "pairs failed.\n", __FUNCTION__); + ntfs_cluster_free (vol, na, na->allocated_size >> + vol->cluster_size_bits, -1); + goto put_err_out; + } + /* + * Generate the new mapping pairs array directly into the + * correct destination, i.e. the attribute record itself. + */ + if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( + a->mapping_pairs_offset), mp_size, na->rl)) { + err = errno; + fprintf(stderr, "%s(): Eeek! Mapping pairs build " + "failed.\n", __FUNCTION__); + ntfs_cluster_free (vol, na, na->allocated_size >> + vol->cluster_size_bits, -1); + goto put_err_out; + } + + /* Update the attribute record and the ntfs_attr structure. */ + na->allocated_size = first_free_vcn << vol->cluster_size_bits; + a->allocated_size = scpu_to_le64(na->allocated_size); + if (a->highest_vcn) + a->highest_vcn = scpu_to_le64(first_free_vcn - 1); + } + /* Update the attribute record and the ntfs attribute structure. */ + na->data_size = newsize; + a->data_size = scpu_to_le64(newsize); + /* Set the inode dirty so it is written out later. */ + ntfs_inode_mark_dirty(ctx->ntfs_ino); + /* Done! */ + ntfs_attr_put_search_ctx(ctx); + return 0; +put_err_out: + ntfs_attr_put_search_ctx(ctx); + errno = err; + return -1; +} + /** * ntfs_attr_truncate - resize an ntfs attribute * @na: open ntfs attribute to resize @@ -3130,9 +3354,6 @@ put_err_out: * The following error codes are defined: * EINVAL - Invalid arguments were passed to the function. * ENOTSUP - The desired resize is not implemented yet. - * - * NOTE: At present attributes can only be made smaller using this function, - * never bigger. */ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) { @@ -3149,15 +3370,17 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) return -1; } /* - * TODO: Implement making non-resident attributes bigger/filling in of - * uninitialized holes as well as handling of compressed attributes. + * TODO: Implement making handling of compressed attributes. */ - if ((NAttrNonResident(na) && newsize > na->initialized_size) || - NAttrCompressed(na)) { + if (NAttrCompressed(na)) { errno = ENOTSUP; return -1; } - if (NAttrNonResident(na)) - return ntfs_non_resident_attr_shrink(na, newsize); + if (NAttrNonResident(na)) { + if (newsize > na->initialized_size) + return ntfs_non_resident_attr_expand(na, newsize); + else + return ntfs_non_resident_attr_shrink(na, newsize); + } return ntfs_resident_attr_resize(na, newsize); } From d1ecde1e2deacc7d60d5df26fb560fc8e1f276f8 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 1 Aug 2004 11:05:46 +0000 Subject: [PATCH 1617/2994] Fix spelling (Logical change 1.466) --- ntfsprogs/ntfscp.c | 314 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 314 insertions(+) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index e69de29b..39a2d349 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -0,0 +1,314 @@ +/** + * ntfscp - Part of the Linux-NTFS project. + * + * Copyright (c) 2004 Yura Pakhuchiy + * + * This utility will overwrite files on ntfs volume + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "types.h" +#include "attrib.h" +#include "utils.h" +#include "volume.h" +#include "debug.h" + +struct options { + char *device; /* Device/File to work with */ + char *src_file; /* Source file */ + char *dest_file; /* Destination file */ + int force; /* Override common sense */ + int quiet; /* Less output */ + int verbose; /* Extra output */ + int noaction; /* Do not write to disk */ +}; + +static const char *EXEC_NAME = "ntfscp"; +static struct options opts; + +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) +GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) +static GEN_PRINTF (Printf, stderr, NULL, FALSE) + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +static void version (void) +{ + Printf ("\n%s v%s - Overwrite files on NTFS volume.\n\n", + EXEC_NAME, VERSION); + Printf ("Copyright (c) 2004 Yura Pakhuchiy\n"); + Printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +static void usage (void) +{ + Printf ("\nUsage: %s [options] device src_file dest_file\n\n" + " -f --force Use less caution\n" + " -h --help Print this help\n" + " -n --no-action Do not write to disk\n" + " -q --quiet Less output\n" + " -V --version Version information\n" + " -v --verbose More output\n\n", + EXEC_NAME); + Printf ("%s%s\n", ntfs_bugs, ntfs_home); +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +static int parse_options (int argc, char **argv) +{ + static const char *sopt = "-fh?nqVv"; + static const struct option lopt[] = { + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "no-action", no_argument, NULL, 'n' }, + { "quiet", no_argument, NULL, 'q' }, + { "version", no_argument, NULL, 'V' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + int err = 0; + int ver = 0; + int help = 0; + + opts.device = 0; + opts.src_file = 0; + opts.dest_file = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else if (!opts.src_file) { + opts.src_file = argv[optind-1]; + } else if (!opts.dest_file) { + opts.dest_file = argv[optind-1]; + } else { + Eprintf("You must specify exactly two files.\n"); + err++; + } + break; + case 'f': + opts.force++; + break; + case 'h': + case '?': + help++; + break; + case 'n': + opts.noaction++; + break; + case 'q': + opts.quiet++; + break; + case 'V': + ver++; + break; + case 'v': + opts.verbose++; + break; + default: + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if (!opts.device) { + Eprintf ("You must specify a device.\n"); + err++; + } else if (!opts.src_file) { + Eprintf ("You must specify a source file.\n"); + err++; + } else if (!opts.dest_file) { + Eprintf ("You must specify a destination file.\n"); + err++; + } + + if (opts.quiet && opts.verbose) { + Eprintf("You may not use --quiet and --verbose at the " + "same time.\n"); + err++; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main (int argc, char *argv[]) +{ + FILE *in; + ntfs_volume *vol; + ntfs_inode *out; + ntfs_attr *na; + int flags = 0; + int result = 1; + s64 new_size; + int need_logfile_reset = 0; + u64 offset; + char *buf; + s64 br, bw; + + if (!parse_options (argc, argv)) + return 1; + + utils_set_locale(); + + if (opts.noaction) + flags = MS_RDONLY; + + vol = utils_mount_volume (opts.device, flags, opts.force); + if (!vol) { + perror("ERROR: couldn't mount volume"); + return 1; + } + + if ((vol->flags & VOLUME_IS_DIRTY) && (!opts.force)) + goto umount; + + { + struct stat fst; + if (stat (opts.src_file, &fst) == -1) { + perror ("ERROR: Couldn't stat source file\n"); + goto umount; + } + new_size = fst.st_size; + } + Vprintf ("New file size: %lld\n", new_size); + + in = fopen (opts.src_file, "r"); + if (!in) { + perror ("ERROR: Couldn't open source file"); + goto umount; + } + + out = utils_pathname_to_inode (vol, NULL, opts.dest_file); + if (!out) { + perror ("ERROR: Couldn't open destination file"); + goto close_src; + } + + na = ntfs_attr_open (out, AT_DATA, 0, 0); + if (!na) { + perror ("ERROR: Couldn't open $DATA attribute"); + goto close_dst; + } + + Vprintf ("Old file size: %lld\n", na->data_size); +// utils_dump_mem ((u8 *) out->mrec, 0, +// le32_to_cpu(out->mrec->bytes_in_use), DM_INDENT | DM_GREEN); + if (na->data_size != new_size) { + if (ntfs_attr_truncate (na, new_size)) { +// utils_dump_mem ((u8 *) out->mrec, 0, le32_to_cpu( +// out->mrec->bytes_in_use), DM_INDENT | DM_RED); + perror ("ERROR: Couldn't resize $DATA attribute"); + goto close_attr; + } + need_logfile_reset = 1; + } +// utils_dump_mem ((u8 *) out->mrec, 0, +// le32_to_cpu(out->mrec->bytes_in_use), DM_INDENT | DM_RED); + + buf = malloc (NTFS_BUF_SIZE); + if (!buf) { + perror ("ERROR: malloc failed"); + goto close_attr; + } + + offset = 0; + while (!feof (in)) { + br = fread (buf, 1, NTFS_BUF_SIZE, in); + if (!br) { + if (!feof (in)) perror ("ERROR: fread failed"); + break; + } + + bw = ntfs_attr_pwrite (na, offset, br, buf); + if (bw != br) { + perror ("ERROR: ntfs_attr_pwrite failed"); + break; + } + offset += bw; + } + need_logfile_reset = 1; + + free (buf); +close_attr: + ntfs_attr_close (na); +close_dst: + ntfs_inode_close (out); + + if (need_logfile_reset) { + printf ("Resetting logfile.\n"); + ntfs_logfile_reset (vol); + } + +close_src: + fclose (in); +umount: + ntfs_umount (vol, FALSE); + + return result; +} From f81543dbc973d5f229e92a408a847cd324a5a759 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 1 Aug 2004 11:05:46 +0000 Subject: [PATCH 1618/2994] Update (Logical change 1.466) --- ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index ff461873..1621046d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,13 @@ xx/xx/2004 - 1.9.3-WIP working as getting the head-count is NT specific and as such wasn't implemented. (Yuval) - Added truncate option to ntfsundelete (mabs) + - Bugfix in ntfs_attr_size_bounds_check that caused it always fail, + if no maximum limit for attribute size (Yura) + - Add new function attrib.c::ntfs_non_resident_attr_expand, + thus we can expand non resident attributes (Yura) + - Add a @start_vcn parameter to lcnalloc.[ch]::ntfs_cluster_alloc (Yura) + - Add ntfscp utility, at present it can only overwrite files. It can + increment or decrease file size if $ATTRIBUTE_LIST not present (Yura) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From e6702c50e89ff8f815cbe6ae4cfcfde779e0a5a9 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 1 Aug 2004 11:05:46 +0000 Subject: [PATCH 1619/2994] include/ntfs/lcnalloc.[ch] Add a @start_vcn parameter to lcnalloc.[ch]::ntfs_cluster_alloc libntfs/attrib.c Add new function attrib.c::ntfs_non_resident_attr_expand, thus we can expand non resident attributes BKrev: 410cce8arlxZNdQ2OY5Oisg_nANE3w From 03f18392418a9916859a626ebd5723496ec0aeb7 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 2 Aug 2004 12:05:21 +0000 Subject: [PATCH 1620/2994] add ntfscp to build (Logical change 1.467) --- Makefile.in | 60 +- aclocal.m4 | 7477 +++++++----------- config.guess | 103 +- config.sub | 46 +- configure | 15697 ++++++------------------------------- depcomp | 34 +- doc/Makefile.in | 18 +- include/Makefile.in | 42 +- include/ntfs/Makefile.in | 36 +- install-sh | 132 +- libntfs/Makefile.in | 119 +- ltmain.sh | 2912 ++----- ntfsprogs/Makefile.am | 7 +- ntfsprogs/Makefile.in | 78 +- 14 files changed, 6151 insertions(+), 20610 deletions(-) diff --git a/Makefile.in b/Makefile.in index 5cca236d..e3db9903 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.9 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -75,7 +75,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -86,10 +85,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -101,8 +96,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -132,21 +125,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -325,14 +315,16 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ + empty_fix=.; \ else \ include_option=--include; \ + empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ + test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ @@ -342,9 +334,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -398,15 +392,17 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done - list='$(SUBDIRS)'; for subdir in $$list; do \ + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || mkdir "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="../$(top_distdir)" \ - distdir="../$(distdir)/$$subdir" \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ @@ -420,15 +416,15 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir - $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir - $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir @@ -441,7 +437,7 @@ dist-zip: distdir $(am__remove_distdir) dist dist-all: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then @@ -450,13 +446,13 @@ dist dist-all: distdir distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac @@ -535,7 +531,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -595,7 +591,7 @@ uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-libtool clean-recursive \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ - dist-shar dist-tarZ dist-zip distcheck distclean \ + dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ diff --git a/aclocal.m4 b/aclocal.m4 index bc9cb7db..5132886c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.8.3 -*- Autoconf -*- +# generated automatically by aclocal 1.9 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. @@ -11,63 +11,12 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- -# serial 47 AC_PROG_LIBTOOL +# serial 46 AC_PROG_LIBTOOL - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# 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 And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -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_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" @@ -78,13 +27,10 @@ AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL +]) - -# AC_LIBTOOL_SETUP -# ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)dnl +[AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl @@ -94,103 +40,15 @@ 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([LT_AC_PROG_SED])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 -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] - -# Same as above, but do not quote variable references. -[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -200,78 +58,341 @@ file_magic*) ;; esac -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default +# 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* + ;; -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_64bit_output=no + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *"ELF 64"*) + lt_cv_cc_64bit_output=yes + ;; + 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) -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl + # 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])]) -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} + 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 -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER +_LT_AC_LTCONFIG_HACK +]) -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX +# AC_LIBTOOL_HEADER_ASSERT +# ------------------------ +AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], +[AC_CACHE_CHECK([whether $CC supports assert without backlinking], + [lt_cv_func_assert_works], + [case $host in + *-*-solaris*) + if test "$GCC" = yes && test "$with_gnu_ld" != yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) lt_cv_func_assert_works=no ;; + *) lt_cv_func_assert_works=yes ;; + esac + fi + ;; + esac]) +if test "x$lt_cv_func_assert_works" = xyes; then + AC_CHECK_HEADERS(assert.h) +fi +])# AC_LIBTOOL_HEADER_ASSERT -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h) +])# _LT_AC_CHECK_DLFCN +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[[ABCDGISTW]]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AC_FD_CC + fi + else + echo "cannot find nm_test_var in $nlist" >&AC_FD_CC + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC + fi + else + echo "$progname: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + +# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +# --------------------------------- +AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], +[# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi +])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ +[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -289,7 +410,7 @@ if test "X[$]1" = X--no-reexec; then elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else @@ -301,7 +422,7 @@ if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -346,7 +466,7 @@ else break fi done - IFS="$lt_save_ifs" + IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -419,298 +539,17 @@ if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then fi AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - 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 - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - 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_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - 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 - ;; -AC_PROVIDE_IFELSE([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) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_REQUIRE([LT_AC_PROG_SED]) -AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - testring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ - = "XX$testring") >/dev/null 2>&1 && - new_result=`expr "X$testring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - testring=$testring$testring - done - testring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - +AC_DIVERT_POP +])# _LT_AC_PROG_ECHO_BACKSLASH # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ------------------------------------------------------------------ AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : +[if test "$cross_compiling" = yes; then : [$4] else + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext </dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext +# Same as above, but do not quote variable references. +double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" + +AC_MSG_CHECKING([for objdir]) +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +AC_MSG_RESULT($objdir) + + +AC_ARG_WITH(pic, +[ --with-pic try to use only PIC/non-PIC objects [default=use both]], +pic_mode="$withval", pic_mode=default) +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +AC_MSG_CHECKING([for $compiler option to produce PIC]) +AC_CACHE_VAL(lt_cv_prog_cc_pic, +[ lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6* | nonstopux*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi ]) -])# AC_LIBTOOL_PROG_CC_C_O +if test -z "$lt_cv_prog_cc_pic"; then + AC_MSG_RESULT([none]) +else + AC_MSG_RESULT([$lt_cv_prog_cc_pic]) + + # Check to make sure the pic_flag actually works. + AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) + AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + AC_TRY_COMPILE([], [], [dnl + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + ], [dnl + lt_cv_prog_cc_pic_works=no + ]) + CFLAGS="$save_CFLAGS" + ]) + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) + lt_cv_prog_cc_can_build_shared=no + fi +fi + +AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) +AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) + LDFLAGS="$save_LDFLAGS" +]) + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- +# Check to see if options -o and -c are simultaneously supported by compiler +AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) +AC_CACHE_VAL([lt_cv_compiler_c_o], [ +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&AC_FD_CC + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null +]) +compiler_c_o=$lt_cv_compiler_c_o +AC_MSG_RESULT([$compiler_c_o]) + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) + AC_CACHE_VAL([lt_cv_compiler_o_lo], [ + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + ]) + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + ]) + compiler_o_lo=$lt_cv_compiler_o_lo + AC_MSG_RESULT([$compiler_o_lo]) +else + compiler_o_lo=no +fi + # Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then +if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes @@ -972,77 +1131,764 @@ if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT([$compiler_rtti_exceptions]) -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR +# See if the linker supports building shared libraries. +AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \[$]# in + 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; + *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +AC_MSG_RESULT([$ld_shlibs]) +test "$ld_shlibs" = no && can_build_shared=no -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- # Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then +AC_MSG_CHECKING([how to hardcode library paths into programs]) +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then # We can hardcode non-existant directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink + hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate + hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported + hardcode_action=unsupported fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) +AC_MSG_RESULT([$hardcode_action]) -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= +striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then @@ -1050,33 +1896,17 @@ if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else AC_MSG_RESULT([no]) fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- # PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) +AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= -shrext=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -1085,36 +1915,17 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' ;; aix4* | aix5*) @@ -1124,7 +1935,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -1134,41 +1945,43 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' + soname_spec='${libname}${release}.so$major' fi shlibpath_var=LIBPATH fi + hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) - library_names_spec='${libname}${shared_ext}' + library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -1176,12 +1989,13 @@ beos*) bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -1189,55 +2003,29 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows - shrext=".dll" need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) + yes,cygwin*) library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac ;; - + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -1250,56 +2038,30 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac @@ -1308,11 +2070,7 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on + *) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -1323,8 +2081,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -1332,45 +2090,14 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. + dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -1378,29 +2105,21 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; + *) version_type=irix ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -1409,21 +2128,20 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. -linux*) +linux-gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -1432,11 +2150,12 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" - fi + case $host_cpu:$lt_cv_cc_64bit_output in + powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" + ;; + esac # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -1447,29 +2166,17 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -1479,17 +2186,7 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -1497,48 +2194,47 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=yes - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH + need_version=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case "$host_os" in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' - shrext=".dll" need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' + library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf - need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; @@ -1546,8 +2242,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -1557,7 +2253,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -1569,8 +2265,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -1591,933 +2287,39 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# 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_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# 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], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# 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_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# 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], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# 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_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# 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], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# 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_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# 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_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [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]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -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_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -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 - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_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_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$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_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl -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 $CC]) - 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. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname 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 - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - 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. - case `"$lt_cv_path_LD" -v 2>&1 &1 /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_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - 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_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - case $host_cpu in - alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - # this will be overridden with pass_all, but let us keep it just in case - 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` - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - 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 - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - 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*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the pathname to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - 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 - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - 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 - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_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* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL 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, lt_dlinit, - [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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) -])# _LT_AC_LANG_CXX - - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[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])])])])])]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# -------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -# Report which librarie types wil actually be built +# Report the final consequences. AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -2540,43 +2342,6 @@ aix4*) test "$enable_shared" = yes && enable_static=no fi ;; - darwin* | rhapsody*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; esac AC_MSG_RESULT([$enable_shared]) @@ -2585,1307 +2350,111 @@ AC_MSG_CHECKING([whether to build static libraries]) test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless fi -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no +AC_LIBTOOL_DLOPEN_SELF + +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + AC_CACHE_VAL([lt_cv_archive_cmds_need_lc], + [$rm conftest* + echo 'static int dummy;' > conftest.$ac_ext - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' + if AC_TRY_EVAL(ac_compile); then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_archive_cmds_need_lc=no else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi + lt_cv_archive_cmds_need_lc=yes fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + allow_undefined_flag=$save_allow_undefined_flag else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi + cat conftest.err 1>&5 + fi]) + AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < "${ofile}T" +#! $SHELL -ifelse([$1], [], - [cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - AC_MSG_NOTICE([creating $ofile])], - [cfgfile="$ofile"]) - - cat <<__EOF__ >> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: +# Copyright (C) 1996-2000 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -3941,21 +2493,17 @@ ifelse([$1], [], # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed program that does not truncate output. +# A sed that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="${SED} -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) +# ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -3969,10 +2517,7 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) +build_libtool_need_lc=$need_lc # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -3988,20 +2533,14 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) +# The default C compiler. +CC=$lt_CC # Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP +with_gcc=$GCC # The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) +LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S @@ -4010,7 +2549,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$lt_STRIP +STRIP=$STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -4022,7 +2561,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4032,7 +2571,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) +wl=$lt_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -4040,21 +2579,18 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" -# Shared library suffix (normally ".so"). -shrext='$shrext' - # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_flag=$lt_pic_flag pic_mode=$pic_mode -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - # Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -4075,19 +2611,19 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) +link_static_flag=$lt_link_static_flag # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) +no_builtin_flag=$lt_no_builtin_flag # Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) +whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) +thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type @@ -4104,50 +2640,26 @@ soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -4155,10 +2667,10 @@ deplibs_check_method=$lt_deplibs_check_method file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) +allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) +no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds @@ -4167,13 +2679,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe +global_symbol_pipe=$lt_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -4185,45 +2697,36 @@ shlibpath_var=$shlibpath_var shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) +hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) +hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) +hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) +hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) +hardcode_shlibpath_var=$hardcode_shlibpath_var # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) +link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec @@ -4232,33 +2735,30 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" +fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) +always_export_symbols=$always_export_symbols # The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) +export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) +exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) +include_expsyms=$lt_include_expsyms -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) +# ### END LIBTOOL CONFIG __EOF__ -ifelse([$1],[], [ case $host_os in aix3*) - cat <<\EOF >> "$cfgfile" + cat <<\EOF >> "${ofile}T" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -4271,1530 +2771,11 @@ EOF ;; esac - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDRT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - ccc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - linux*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi4*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include @@ -5828,13 +2809,748 @@ AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # return TRUE; # } # /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# 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 of the License, 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. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + +])# _LT_AC_LTCONFIG_HACK + +# 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)]) -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) +# 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 <&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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])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=$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_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 &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 dependent 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 +aix4* | aix5*) + 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # 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* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # 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 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) + 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 + ;; + +newos6*) + 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 + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +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 + 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*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + 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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +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=$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 LTDLINCL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and LTDLINCL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) @@ -5848,16 +3564,6 @@ AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # @@ -5871,51 +3577,79 @@ AC_DEFUN([LT_AC_PROG_SED], AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. +as_executable_p="test -f" as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do + for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" fi done done done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed + + # 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 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 40000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done done -done -SED=$lt_cv_path_SED + rm -rf "$tmp" ]) +if test "X$SED" != "X"; then + lt_cv_path_SED=$SED +else + SED=$lt_cv_path_SED +fi AC_MSG_RESULT([$SED]) ]) @@ -5923,7 +3657,7 @@ AC_MSG_RESULT([$SED]) dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ +AC_DEFUN(PKG_CHECK_MODULES, [ succeeded=no if test -z "$PKG_CONFIG"; then @@ -5999,14 +3733,14 @@ AC_DEFUN([PKG_CHECK_MODULES], [ # ---------------------------- # 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.8"]) +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # 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.8.3])]) + [AM_AUTOMAKE_VERSION([1.9])]) # AM_AUX_DIR_EXPAND @@ -6074,7 +3808,7 @@ am_aux_dir=`cd $ac_aux_dir && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc. +# Copyright (C) 1997, 2000, 2001, 2003, 2004 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 @@ -6111,8 +3845,8 @@ else 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.]) + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) fi])]) # serial 7 -*- Autoconf -*- @@ -6232,9 +3966,14 @@ AC_CACHE_CHECK([dependency style of $depcc], 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 + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi @@ -6280,7 +4019,8 @@ AC_SUBST([AMDEPBACKSLASH]) # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# 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 @@ -6316,27 +4056,21 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], else continue fi - grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //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 ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. 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 " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue @@ -6367,7 +4101,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # 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 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -6443,7 +4177,6 @@ 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 AC_REQUIRE([AM_PROG_MKDIR_P])dnl @@ -6452,7 +4185,9 @@ AC_REQUIRE([AM_PROG_MKDIR_P])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl - +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], @@ -6695,13 +4430,21 @@ fi # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -6867,3 +4610,111 @@ fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004 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 + + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/config.guess b/config.guess index 9b9789b1..a6d8a945 100755 --- a/config.guess +++ b/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-03-03' +timestamp='2004-06-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -136,16 +136,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -222,6 +212,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + luna88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -237,9 +230,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - pegasos:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -317,9 +307,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; - Alpha*:OpenVMS:*:*) - echo alpha-hp-vms - exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -774,7 +761,7 @@ EOF echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` @@ -797,21 +784,7 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - # GNU/KFreeBSD systems have a "k" prefix to indicate we are using - # FreeBSD's kernel, but not the complete OS. - case ${LIBC} in gnu) kernel_only='k' ;; esac - echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -855,16 +828,19 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux + echo cris-axis-linux-gnu exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -883,7 +859,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -902,13 +878,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux + echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux + echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -921,34 +897,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux + echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux + echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -963,18 +939,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" + echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" + echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linuxoldld) or + # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -1003,7 +979,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) @@ -1103,7 +1079,7 @@ EOF M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; - M68*:*:R3V[567]*:*) + M68*:*:R3V[5678]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) OS_REL='' @@ -1267,6 +1243,13 @@ EOF *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms && exit 0 ;; + I*) echo ia64-dec-vms && exit 0 ;; + V*) echo vax-dec-vms && exit 0 ;; + esac esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/config.sub b/config.sub index be933fde..ac6de986 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-02-23' +timestamp='2004-06-24' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -70,7 +70,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -145,7 +145,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -237,7 +237,7 @@ case $basic_machine in | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m68000 | m68k | m88k | mcore \ + | m32r | m32rle | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -262,7 +262,7 @@ case $basic_machine in | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ @@ -300,7 +300,7 @@ case $basic_machine in | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ @@ -308,7 +308,7 @@ case $basic_machine in | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | m32r-* \ + | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ @@ -326,8 +326,9 @@ case $basic_machine in | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ @@ -336,7 +337,7 @@ case $basic_machine in | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ @@ -445,6 +446,10 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; cr16c) basic_machine=cr16c-unknown os=-elf @@ -659,10 +664,6 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -743,10 +744,6 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -1059,6 +1056,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1081,7 +1081,7 @@ case $basic_machine in sh64) basic_machine=sh64-unknown ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) @@ -1161,7 +1161,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1194,6 +1194,9 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; @@ -1371,6 +1374,9 @@ case $basic_machine in *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; diff --git a/configure b/configure index 16fc9532..4d5401a8 100755 --- a/configure +++ b/configure @@ -243,6 +243,17 @@ IFS=" $as_nl" $as_unset CDPATH +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -261,7 +272,7 @@ if test "X$1" = X--no-reexec; then elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else @@ -273,7 +284,7 @@ if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -318,7 +328,7 @@ else break fi done - IFS="$lt_save_ifs" + IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -392,11 +402,6 @@ fi - -tagnames=${tagnames+${tagnames},}CXX - -tagnames=${tagnames+${tagnames},}F77 - # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. @@ -466,7 +471,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os 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 mkdir_p AWK SET_MAKE am__leading_dot REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 ECHO RANLIB ac_ct_RANLIB CPP EGREP LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -927,26 +932,6 @@ ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP -ac_env_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS -ac_env_CXXCPP_set=${CXXCPP+set} -ac_env_CXXCPP_value=$CXXCPP -ac_cv_env_CXXCPP_set=${CXXCPP+set} -ac_cv_env_CXXCPP_value=$CXXCPP -ac_env_F77_set=${F77+set} -ac_env_F77_value=$F77 -ac_cv_env_F77_set=${F77+set} -ac_cv_env_F77_value=$F77 -ac_env_FFLAGS_set=${FFLAGS+set} -ac_env_FFLAGS_value=$FFLAGS -ac_cv_env_FFLAGS_set=${FFLAGS+set} -ac_cv_env_FFLAGS_value=$FFLAGS # # Report the --help message. @@ -1029,10 +1014,8 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-shared[=PKGS] - build shared libraries [default=yes] - --enable-static[=PKGS] - build static libraries [default=yes] + --enable-shared=PKGS build shared libraries default=yes + --enable-static=PKGS build static libraries default=yes --enable-debug enable additional debugging code and output --disable-default-device-io-ops do not provide default device io operations @@ -1042,19 +1025,15 @@ Optional Features: --enable-warnings enable additional compiler warnings --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors - --enable-fast-install[=PKGS] - optimize for fast installation [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] - --with-tags[=TAGS] - include additional configurations [automatic] + --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 @@ -1064,11 +1043,6 @@ Some influential environment variables: CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CXXCPP C++ preprocessor - F77 Fortran 77 compiler command - FFLAGS Fortran 77 compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1629,7 +1603,7 @@ test -n "$target_alias" && ac_config_headers="$ac_config_headers config.h" -am__api_version="1.8" +am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -1781,13 +1755,21 @@ echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -1931,9 +1913,6 @@ 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"} # Installed binaries are usually stripped using `strip' when the user @@ -2026,6 +2005,13 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + @@ -2033,51 +2019,47 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" 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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +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; - # This is required to get past a stupid configure bug when making the rpm. # Basically it is broken to specify the host as a command line argument to # configure on its own, i.e. without giving --host=. It is supposed to work @@ -3240,9 +3222,14 @@ else 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 + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi @@ -3396,98 +3383,35 @@ fi 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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +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; - -echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -SED=$lt_cv_path_SED - +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator fi -echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6 - -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 - 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then @@ -3499,8 +3423,8 @@ 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 $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 + 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 @@ -3510,12 +3434,12 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 esac case $ac_prog in # Accept absolute paths. - [\\/]* | ?:[\\/]*) + [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + # 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%/%"` + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -3539,26 +3463,22 @@ if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do - IFS="$lt_save_ifs" 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. - case `"$lt_cv_path_LD" -v 2>&1 &1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break - ;; - *) + else test "$with_gnu_ld" != yes && break - ;; - esac + fi fi done - IFS="$lt_save_ifs" + IFS="$ac_save_ifs" else lt_cv_path_LD="$LD" # Let the user override the test with a path. fi @@ -3581,14 +3501,11 @@ 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. -case `$LD -v 2>&1 &1 &5; then lt_cv_prog_gnu_ld=yes - ;; -*) +else lt_cv_prog_gnu_ld=no - ;; -esac +fi fi echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 @@ -3605,11 +3522,7 @@ 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 -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' +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 @@ -3620,42 +3533,120 @@ else # Let the user override the test. lt_cv_path_NM="$NM" else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" 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 + 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 - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) + 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 - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - 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 - ;; - esac - esac + 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="$lt_save_ifs" + IFS="$ac_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi -echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 -echo "${ECHO_T}$lt_cv_path_NM" >&6 + NM="$lt_cv_path_NM" +echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_executable_p="test -f" +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_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + fi + done + done +done + + # 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 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break + fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 40000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done + done + rm -rf "$tmp" + +fi + +if test "X$SED" != "X"; then + lt_cv_path_SED=$SED +else + SED=$lt_cv_path_SED +fi +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 @@ -3672,7 +3663,7 @@ lt_cv_deplibs_check_method='unknown' # '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 extended regex. +# 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. @@ -3691,24 +3682,25 @@ bsdi4*) lt_cv_file_magic_test_file=/shlib/libc.so ;; -cygwin*) - # win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # win32_libid shell function, so use a weaker test based on 'objdump'. +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=pass_all + 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac ;; -freebsd* | kfreebsd*-gnu) +freebsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -3728,53 +3720,50 @@ gnu*) lt_cv_deplibs_check_method=pass_all ;; -hpux10.20* | hpux11*) +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 - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - 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_test_file=/usr/lib/libc.sl - ;; - esac + lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; + case $host_os in + irix5* | nonstopux*) + # 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*) +linux-gnu*) case $host_cpu in - alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64) + alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM - # this will be overridden with pass_all, but let us keep it just in case 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` - lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' fi ;; @@ -3784,10 +3773,6 @@ newos6*) lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - openbsd*) lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` @@ -3799,6 +3784,9 @@ openbsd*) ;; 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 ;; @@ -3807,6 +3795,11 @@ sco3.2v5*) ;; 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 ;; @@ -3833,10 +3826,6 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ;; esac ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; esac fi @@ -3844,210 +3833,211 @@ 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 -test -z "$deplibs_check_method" && deplibs_check_method=unknown -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -# 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 && enable_libtool_lock=yes -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > 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 - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 3890 "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 - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - 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 - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > 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.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - 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 +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output" >&5 +echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] -int -main () -{ +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' -lt_cv_cc_needs_belf=no -fi -rm -f conftest.err 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 +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' -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 +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' ;; - esac -need_locks="$enable_libtool_lock" +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + 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); } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4284,6 +4274,21 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 + 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + 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 @@ -4672,1353 +4677,150 @@ fi done -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC - 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_CXX+set}" = set; then + + + + + +# 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 - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # 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_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done + 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 <&2 -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi +*** 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 - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -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_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - - -# 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 &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -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_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cxx_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -for ac_declaration in \ - '' \ - '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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -depcc="$CXX" 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_CXX_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_CXX_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 - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch 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_CXX_dependencies_compiler_type=$depmode - break +EOF + fi ;; + esac fi + break fi done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac fi -fi -echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_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 -if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -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 - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -echo "$as_me:$LINENO: result: $CXXCPP" >&5 -echo "${ECHO_T}$CXXCPP" >&6 -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -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 \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran - 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_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$F77"; then - ac_cv_prog_F77="$F77" # 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_F77="$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 -F77=$ac_cv_prog_F77 -if test -n "$F77"; then - echo "$as_me:$LINENO: result: $F77" >&5 -echo "${ECHO_T}$F77" >&6 +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 - test -n "$F77" && break - done -fi -if test -z "$F77"; then - ac_ct_F77=$F77 - for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran -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_F77+set}" = set; then +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 - if test -n "$ac_ct_F77"; then - ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_F77=$ac_cv_prog_ac_ct_F77 -if test -n "$ac_ct_F77"; then - echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 -echo "${ECHO_T}$ac_ct_F77" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_F77" && break -done - - F77=$ac_ct_F77 -fi - - -# Provide some information about the compiler. -echo "$as_me:5457:" \ - "checking for Fortran 77 compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -rm -f a.out - -# If we don't use `.F' as extension, the preprocessor is not run on the -# input file. (Note that this only needs to work for GNU compilers.) -ac_save_ext=$ac_ext -ac_ext=F -echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 -if test "${ac_cv_f77_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF - program main -#ifndef __GNUC__ - choke me -#endif - - end -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext -ac_cv_f77_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 -ac_ext=$ac_save_ext -ac_test_FFLAGS=${FFLAGS+set} -ac_save_FFLAGS=$FFLAGS -FFLAGS= -echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 -echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_f77_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - FFLAGS=-g -cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_f77_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_f77_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 -echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 -if test "$ac_test_FFLAGS" = set; then - FFLAGS=$ac_save_FFLAGS -elif test $ac_cv_prog_f77_g = yes; then - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-g -O2" - else - FFLAGS="-g" - fi -else - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-O2" - else - FFLAGS= - fi -fi - -G77=`test $ac_compiler_gnu = yes && echo yes` -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 - - - -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - -# find the maximum length of command line arguments -echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 -echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 -if test "${lt_cv_sys_max_cmd_len+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - i=0 - testring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \ - = "XX$testring") >/dev/null 2>&1 && - new_result=`expr "X$testring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - testring=$testring$testring - done - testring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 -echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 -else - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 -fi - - - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 -echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' + case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris* | sysv5*) - symcode='[BDRT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac + *) + 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 <&2 -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac +*** 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 -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T + fi ;; + esac fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - 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); } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + 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 - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 + MAGIC_CMD=: fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - fi -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6 -else - echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6 -fi - -echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -if test "${lt_cv_objdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 -echo "${ECHO_T}$lt_cv_objdir" >&6 -objdir=$lt_cv_objdir - - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES fi ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; 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_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" - 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_AR" && ac_cv_prog_ac_ct_AR="false" -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -echo "${ECHO_T}$ac_ct_AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - AR=$ac_ct_AR -else - AR="$ac_cv_prog_AR" -fi - 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 @@ -6180,6 +4982,168 @@ else fi +enable_dlopen=no +enable_win32_dll=no + +# 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 && enable_libtool_lock=yes + +# 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 5000 "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* + ;; + +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_64bit_output=no + 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 + *"ELF 64"*) + lt_cv_cc_64bit_output=yes + ;; + 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 +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err 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 + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + old_CC="$CC" old_CFLAGS="$CFLAGS" @@ -6188,18 +5152,40 @@ test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm -test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' @@ -6217,150 +5203,24 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -# 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 +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs fi +rmdir .libs 2>/dev/null +echo "$as_me:$LINENO: result: $objdir" >&5 +echo "${ECHO_T}$objdir" >&6 -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_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_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 - -enable_dlopen=no -enable_win32_dll=no - -# 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 && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. @@ -6372,445 +5232,453 @@ else fi; test -z "$pic_mode" && pic_mode=default -# Use C for the default configuration in the libtool script -tagname= -lt_save_CC="$CC" -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 - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# -# Check for any special shared library compilation flags. -# -lt_prog_cc_shlib= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - lt_prog_cc_shlib='-belf' - ;; - esac -fi -if test -n "$lt_prog_cc_shlib"; then - { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 -if test "${lt_prog_compiler_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_prog_compiler_static" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - else - lt_prog_compiler_static_works=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 - -if test x"$lt_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' - - -echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6491: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:6495: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_pic+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" ;; - amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' + lt_cv_prog_cc_pic='-fno-common' ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' ;; - sysv4*MP*) if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic + lt_cv_prog_cc_pic=-Kconform_pic fi ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - *) - lt_prog_compiler_pic='-fPIC' + lt_cv_prog_cc_pic='-fPIC' ;; esac else - # PORTME Check for flag to pass linker flags through the system compiler. + # PORTME Check for PIC flags for the system compiler. case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_static='-Bstatic' else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' fi ;; - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' ;; irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' ;; newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - esac + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' ;; osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' ;; sco3.2v5*) - lt_prog_compiler_pic='-Kpic' - lt_prog_compiler_static='-dn' + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' ;; solaris*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' ;; sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' fi ;; - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - *) - lt_prog_compiler_can_build_shared=no + lt_cv_prog_cc_can_build_shared=no ;; esac fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic" >&6 +fi -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then +if test -z "$lt_cv_prog_cc_pic"; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +else + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works+set}" = set; then + # Check to make sure the pic_flag actually works. + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 + if test "${lt_cv_prog_cc_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6724: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:6728: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works=yes - fi - fi - $rm conftest* + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac -if test x"$lt_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_prog_cc_pic_works=no fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +fi + + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + +echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_prog_cc_static_works=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi + + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o+set}" = set; then +if test "${lt_cv_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_cv_prog_compiler_c_o=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6784: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:6788: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:5576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 +compiler_c_o=$lt_cv_compiler_c_o +echo "$as_me:$LINENO: result: $compiler_c_o" >&5 +echo "${ECHO_T}$compiler_c_o" >&6 +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 + if test "${lt_cv_compiler_o_lo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + +fi + + compiler_o_lo=$lt_cv_compiler_o_lo + echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 +echo "${ECHO_T}$compiler_o_lo" >&6 +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then +if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 @@ -6831,72 +5699,144 @@ else need_locks=no fi -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - runpath_var= - allow_undefined_flag= - enable_shared_with_static_runtimes=no - archive_cmds= - archive_expsym_cmds= - old_archive_From_new_cmds= - old_archive_from_expsyms_cmds= - export_dynamic_flag_spec= - whole_archive_flag_spec= - thread_safe_flag_spec= - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - link_all_deplibs=unknown - hardcode_automatic=no - module_cmds= - module_expsym_cmds= - always_export_symbols=no - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes fi - ;; - openbsd*) + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$compiler_rtti_exceptions" >&6 + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then with_gnu_ld=no - ;; - esac + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac - ld_shlibs=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <&2 + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. @@ -6905,73 +5845,125 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar *** so that a non-GNU linker is found, and then restart. EOF - fi - ;; + ;; - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs=no - ;; + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ ;; + esac - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool @@ -6981,781 +5973,553 @@ EOF *** used, and then restart. EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - linux*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds="$tmp_archive_cmds" - fi + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - - if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec=' ' - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - bsdi4*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='-all_load $convenience' - link_all_deplibs=yes + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - ia64*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=no - hardcode_shlibpath_var=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - *) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld='-rpath $libdir' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag=' -z text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - *) - ld_shlibs=no + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi ;; esac fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [12].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +# Check hardcoding attributes. +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 -echo "${ECHO_T}$archive_cmds_need_lc" >&6 - ;; - esac - fi - ;; -esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown +# PORTME Fill in your ld.so characteristics echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= -shrext=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -7764,36 +6528,17 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' ;; aix4* | aix5*) @@ -7803,7 +6548,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -7813,41 +6558,43 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' + soname_spec='${libname}${release}.so$major' fi shlibpath_var=LIBPATH fi + hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) - library_names_spec='${libname}${shared_ext}' + library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -7855,12 +6602,13 @@ beos*) bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -7868,55 +6616,29 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows - shrext=".dll" need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) + yes,cygwin*) library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac ;; - + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' + ;; *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -7929,56 +6651,30 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac @@ -7987,11 +6683,7 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on + *) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -8002,8 +6694,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -8011,45 +6703,14 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. + dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -8057,29 +6718,21 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; + *) version_type=irix ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -8088,21 +6741,20 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. -linux*) +linux-gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -8111,11 +6763,12 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" - fi + case $host_cpu:$lt_cv_cc_64bit_output in + powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" + ;; + esac # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -8126,29 +6779,17 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -8158,17 +6799,7 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -8176,48 +6807,47 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=yes - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH + need_version=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case "$host_os" in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' - shrext=".dll" need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' + library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf - need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; @@ -8225,8 +6855,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -8236,7 +6866,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -8248,8 +6878,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -8270,22 +6900,31 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - *) dynamic_linker=no ;; @@ -8294,33 +6933,42 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var " || \ - test "X$hardcode_automatic"="Xyes" ; then +# Report the final consequences. +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6 + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported @@ -8331,33 +6979,9 @@ elif test "$shlibpath_overrides_runpath" = yes || enable_fast_install=needless fi -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "x$enable_dlopen" != xyes; then @@ -8375,94 +6999,11 @@ else lt_cv_dlopen_self=yes ;; - mingw* | pw32*) + cygwin* | mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 @@ -8946,7 +7487,7 @@ fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" @@ -8962,10 +7503,10 @@ else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 fi -# Report which librarie types wil actually be built -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if test "$GCC" = yes; then - archive_cmds_need_lc=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - output_verbose_link_cmd='echo' - archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='-all_load $convenience' - link_all_deplibs=yes - else - ld_shlibs=no - fi +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + if test "${lt_cv_archive_cmds_need_lc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 + 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 + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi +fi -# The else clause should only fire when bootstrapping the + echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 +echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ + for var in echo old_CC old_CFLAGS SED \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler \ - CC \ - LD \ - lt_prog_compiler_wl \ - lt_prog_compiler_pic \ - lt_prog_compiler_static \ - lt_prog_compiler_no_builtin_flag \ - export_dynamic_flag_spec \ - thread_safe_flag_spec \ - whole_archive_flag_spec \ - enable_shared_with_static_runtimes \ - old_archive_cmds \ - old_archive_from_new_cmds \ - predep_objects \ - postdep_objects \ - predeps \ - postdeps \ - compiler_lib_search_path \ - archive_cmds \ - archive_expsym_cmds \ - postinstall_cmds \ - postuninstall_cmds \ - old_archive_from_expsyms_cmds \ - allow_undefined_flag \ - no_undefined_flag \ - export_symbols_cmds \ - hardcode_libdir_flag_spec \ - hardcode_libdir_flag_spec_ld \ - hardcode_libdir_separator \ - hardcode_automatic \ - module_cmds \ - module_expsym_cmds \ - lt_cv_prog_compiler_c_o \ - exclude_expsyms \ - include_expsyms; do + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do case $var in - old_archive_cmds | \ - old_archive_from_new_cmds | \ - archive_cmds | \ - archive_expsym_cmds | \ - module_cmds | \ - module_expsym_cmds | \ - old_archive_from_expsyms_cmds | \ - export_symbols_cmds | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -9321,29 +7820,14 @@ if test -f "$ltmain"; then esac done - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - { echo "$as_me:$LINENO: creating $ofile" >&5 -echo "$as_me: creating $ofile" >&6;} - - cat <<__EOF__ >> "$cfgfile" + cat <<__EOF__ > "${ofile}T" #! $SHELL -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: +# Copyright (C) 1996-2000 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -9365,19 +7849,16 @@ echo "$as_me: creating $ofile" >&6;} # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed program that does not truncate output. +# A sed that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="${SED} -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi -# The names of the tagged configurations supported by this script. -available_tags= - # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -9392,10 +7873,7 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes +build_libtool_need_lc=$need_lc # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -9411,18 +7889,12 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler +# The default C compiler. +CC=$lt_CC # Is the compiler the GNU C compiler? with_gcc=$GCC -# An ERE matcher. -EGREP=$lt_EGREP - # The linker used to build libraries. LD=$lt_LD @@ -9433,7 +7905,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$lt_STRIP +STRIP=$STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -9445,7 +7917,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9455,7 +7927,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl +wl=$lt_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -9463,21 +7935,18 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" -# Shared library suffix (normally ".so"). -shrext='$shrext' - # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic +pic_flag=$lt_pic_flag pic_mode=$pic_mode -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - # Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -9498,10 +7967,10 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static +link_static_flag=$lt_link_static_flag # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag +no_builtin_flag=$lt_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec @@ -9543,34 +8012,10 @@ archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -9590,13 +8035,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe +global_symbol_pipe=$lt_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -9617,15 +8062,10 @@ hardcode_into_libs=$hardcode_into_libs # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct @@ -9637,10 +8077,6 @@ hardcode_minus_L=$hardcode_minus_L # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic - # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" @@ -9676,10 +8112,9 @@ include_expsyms=$lt_include_expsyms __EOF__ - case $host_os in aix3*) - cat <<\EOF >> "$cfgfile" + cat <<\EOF >> "${ofile}T" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -9688,6 +8123,186 @@ if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# 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 of the License, 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. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1) - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") chmod +x "$ofile" - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - -# Check whether --with-tags or --without-tags was given. -if test "${with_tags+set}" = set; then - withval="$with_tags" - tagnames="$withval" -fi; - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} - else - { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 -echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in - "") ;; - *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 -echo "$as_me: error: invalid tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 -echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} - { (exit 1); exit 1; }; } - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_flag_spec_ld_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_automatic_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -compiler_CXX=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' -else - lt_prog_compiler_no_builtin_flag_CXX= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - -# 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 $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $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. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname 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 - 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 - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - 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. - case `"$lt_cv_path_LD" -v 2>&1 &5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -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. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 -ld_shlibs_CXX=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_CXX=yes - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_CXX=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_CXX='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' ${wl}-bernotok' - allow_undefined_flag_CXX=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_CXX=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX=' ' - archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs_CXX=no - fi - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes; then - archive_cmds_need_lc_CXX=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_CXX='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_CXX='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_CXX='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_CXX='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='-all_load $convenience' - link_all_deplibs_CXX=yes - else - ld_shlibs_CXX=no - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - freebsd12*) - # C++ shared libraries reported to be fairly broken before switch to ELF - ld_shlibs_CXX=no - ;; - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - gnu*) - ;; - hpux9*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC) - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_CXX='+b $libdir' - hardcode_libdir_separator_CXX=: - ;; - ia64*) - hardcode_libdir_flag_spec_CXX='-L$libdir' - ;; - *) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - archive_cmds_need_lc_CXX=no - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx) - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - sco*) - archive_cmds_need_lc_CXX=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.0-5 | solaris2.0-5.*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - no_undefined_flag_CXX=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - archive_cmds_need_lc_CXX=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; -esac -echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6 -test "$ld_shlibs_CXX" = no && can_build_shared=no - -GCC_CXX="$GXX" -LD_CXX="$LD" - - -cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - # The `*' in the case matches for architectures that use `case' in - # $output_verbose_cmd can trigger glob expansion during the loop - # eval without this substitution. - output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" - - for p in `eval $output_verbose_link_cmd`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" \ - || test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX="${prev}${p}" - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX="${prev}${p}" - else - postdeps_CXX="${postdeps_CXX} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX="$p" - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX="$p" - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$rm -f confest.$objext - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - -lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - icpc) - # Intel C++ - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11245: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:11249: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_CXX=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 - -if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11305: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:11309: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX="$ltdll_cmds" - ;; - cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - -echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6 -test "$ld_shlibs_CXX" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_CXX=no - else - archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=yes - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || \ - test -n "$runpath_var CXX" || \ - test "X$hardcode_automatic_CXX"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 -echo "${ECHO_T}$hardcode_action_CXX" >&6 - -if test "$hardcode_action_CXX" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* 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 shl_load (); -/* 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_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* 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 dlopen (); -/* 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_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_CXX \ - CC_CXX \ - LD_CXX \ - lt_prog_compiler_wl_CXX \ - lt_prog_compiler_pic_CXX \ - lt_prog_compiler_static_CXX \ - lt_prog_compiler_no_builtin_flag_CXX \ - export_dynamic_flag_spec_CXX \ - thread_safe_flag_spec_CXX \ - whole_archive_flag_spec_CXX \ - enable_shared_with_static_runtimes_CXX \ - old_archive_cmds_CXX \ - old_archive_from_new_cmds_CXX \ - predep_objects_CXX \ - postdep_objects_CXX \ - predeps_CXX \ - postdeps_CXX \ - compiler_lib_search_path_CXX \ - archive_cmds_CXX \ - archive_expsym_cmds_CXX \ - postinstall_cmds_CXX \ - postuninstall_cmds_CXX \ - old_archive_from_expsyms_cmds_CXX \ - allow_undefined_flag_CXX \ - no_undefined_flag_CXX \ - export_symbols_cmds_CXX \ - hardcode_libdir_flag_spec_CXX \ - hardcode_libdir_flag_spec_ld_CXX \ - hardcode_libdir_separator_CXX \ - hardcode_automatic_CXX \ - module_cmds_CXX \ - module_expsym_cmds_CXX \ - lt_cv_prog_compiler_c_o_CXX \ - exclude_expsyms_CXX \ - include_expsyms_CXX; do - - case $var in - old_archive_cmds_CXX | \ - old_archive_from_new_cmds_CXX | \ - archive_cmds_CXX | \ - archive_expsym_cmds_CXX | \ - module_cmds_CXX | \ - module_expsym_cmds_CXX | \ - old_archive_from_expsyms_cmds_CXX | \ - export_symbols_cmds_CXX | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_CXX - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_CXX -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_CXX - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_CXX" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld - - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu - - -archive_cmds_need_lc_F77=no -allow_undefined_flag_F77= -always_export_symbols_F77=no -archive_expsym_cmds_F77= -export_dynamic_flag_spec_F77= -hardcode_direct_F77=no -hardcode_libdir_flag_spec_F77= -hardcode_libdir_flag_spec_ld_F77= -hardcode_libdir_separator_F77= -hardcode_minus_L_F77=no -hardcode_automatic_F77=no -module_cmds_F77= -module_expsym_cmds_F77= -link_all_deplibs_F77=unknown -old_archive_cmds_F77=$old_archive_cmds -no_undefined_flag_F77= -whole_archive_flag_spec_F77= -enable_shared_with_static_runtimes_F77=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -objext_F77=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" - -# Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${F77-"f77"} -compiler=$CC -compiler_F77=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -aix4*) - test "$enable_shared" = yes && enable_static=no - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 - -test "$ld_shlibs_F77" = no && can_build_shared=no - -GCC_F77="$G77" -LD_F77="$LD" - -lt_prog_compiler_wl_F77= -lt_prog_compiler_pic_F77= -lt_prog_compiler_static_F77= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_static_F77='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_F77='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_F77=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_F77=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_F77='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - else - lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_F77='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_F77='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-static' - ;; - ccc*) - lt_prog_compiler_wl_F77='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_F77='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_F77='-Kpic' - lt_prog_compiler_static_F77='-dn' - ;; - - solaris*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl_F77='-Qoption ld ' - lt_prog_compiler_pic_F77='-PIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_F77='-Kconform_pic' - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - uts4*) - lt_prog_compiler_pic_F77='-pic' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_F77=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_F77"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_F77=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_F77" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13591: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:13595: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_F77=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 - -if test x"$lt_prog_compiler_pic_works_F77" = xyes; then - case $lt_prog_compiler_pic_F77 in - "" | " "*) ;; - *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; - esac -else - lt_prog_compiler_pic_F77= - lt_prog_compiler_can_build_shared_F77=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_F77= - ;; - *) - lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_F77=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13651: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:13655: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_F77=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag_F77= - enable_shared_with_static_runtimes_F77=no - archive_cmds_F77= - archive_expsym_cmds_F77= - old_archive_From_new_cmds_F77= - old_archive_from_expsyms_cmds_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= - thread_safe_flag_spec_F77= - hardcode_libdir_flag_spec_F77= - hardcode_libdir_flag_spec_ld_F77= - hardcode_libdir_separator_F77= - hardcode_direct_F77=no - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=unsupported - link_all_deplibs_F77=unknown - hardcode_automatic_F77=no - module_cmds_F77= - module_expsym_cmds_F77= - always_export_symbols_F77=no - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_F77= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_F77=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_F77=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_F77=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_F77='-L$libdir' - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=no - enable_shared_with_static_runtimes_F77=yes - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - sunos4*) - archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - linux*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds_F77="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_F77="$tmp_archive_cmds" - fi - else - ld_shlibs_F77=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - esac - - if test "$ld_shlibs_F77" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=yes - archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_F77=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_F77=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_F77='' - hardcode_direct_F77=yes - hardcode_libdir_separator_F77=':' - link_all_deplibs_F77=yes - - if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_F77=yes - else - # We have old collect2 - hardcode_direct_F77=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_F77=yes - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_libdir_separator_F77= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_F77=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_F77='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_F77="-z nodefs" - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_F77=' ${wl}-bernotok' - allow_undefined_flag_F77=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_F77=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_F77=' ' - archive_cmds_need_lc_F77=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_F77=no - ;; - - bsdi4*) - export_dynamic_flag_spec_F77=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_F77=' ' - allow_undefined_flag_F77=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_F77='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_F77=yes - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc_F77=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_F77='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_F77='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_F77='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_F77='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct_F77=no - hardcode_automatic_F77=yes - hardcode_shlibpath_var_F77=unsupported - whole_archive_flag_spec_F77='-all_load $convenience' - link_all_deplibs_F77=yes - else - ld_shlibs_F77=no - fi - ;; - - dgux*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - freebsd1*) - ld_shlibs_F77=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_F77='+b $libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - ;; - ia64*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - *) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - link_all_deplibs_F77=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - newsos6) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_shlibpath_var_F77=no - ;; - - openbsd*) - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - export_dynamic_flag_spec_F77='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - ;; - *) - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - allow_undefined_flag_F77=unsupported - archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_F77='-rpath $libdir' - fi - hardcode_libdir_separator_F77=: - ;; - - sco3.2v5*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_F77=' -z text' - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_shlibpath_var_F77=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs_F77=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_F77='$CC -r -o $output$reload_objs' - hardcode_direct_F77=no - ;; - motorola) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv4.3*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_F77=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_F77='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv5*) - no_undefined_flag_F77=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_F77= - hardcode_shlibpath_var_F77=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - *) - ld_shlibs_F77=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 -echo "${ECHO_T}$ld_shlibs_F77" >&6 -test "$ld_shlibs_F77" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_F77" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_F77=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_F77 in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_F77 - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_F77 - allow_undefined_flag_F77= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_F77=no - else - archive_cmds_need_lc_F77=yes - fi - allow_undefined_flag_F77=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=yes - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_F77= -if test -n "$hardcode_libdir_flag_spec_F77" || \ - test -n "$runpath_var F77" || \ - test "X$hardcode_automatic_F77"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_F77" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && - test "$hardcode_minus_L_F77" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_F77=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_F77=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_F77=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 -echo "${ECHO_T}$hardcode_action_F77" >&6 - -if test "$hardcode_action_F77" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_F77 \ - CC_F77 \ - LD_F77 \ - lt_prog_compiler_wl_F77 \ - lt_prog_compiler_pic_F77 \ - lt_prog_compiler_static_F77 \ - lt_prog_compiler_no_builtin_flag_F77 \ - export_dynamic_flag_spec_F77 \ - thread_safe_flag_spec_F77 \ - whole_archive_flag_spec_F77 \ - enable_shared_with_static_runtimes_F77 \ - old_archive_cmds_F77 \ - old_archive_from_new_cmds_F77 \ - predep_objects_F77 \ - postdep_objects_F77 \ - predeps_F77 \ - postdeps_F77 \ - compiler_lib_search_path_F77 \ - archive_cmds_F77 \ - archive_expsym_cmds_F77 \ - postinstall_cmds_F77 \ - postuninstall_cmds_F77 \ - old_archive_from_expsyms_cmds_F77 \ - allow_undefined_flag_F77 \ - no_undefined_flag_F77 \ - export_symbols_cmds_F77 \ - hardcode_libdir_flag_spec_F77 \ - hardcode_libdir_flag_spec_ld_F77 \ - hardcode_libdir_separator_F77 \ - hardcode_automatic_F77 \ - module_cmds_F77 \ - module_expsym_cmds_F77 \ - lt_cv_prog_compiler_c_o_F77 \ - exclude_expsyms_F77 \ - include_expsyms_F77; do - - case $var in - old_archive_cmds_F77 | \ - old_archive_from_new_cmds_F77 | \ - archive_cmds_F77 | \ - archive_expsym_cmds_F77 | \ - module_cmds_F77 | \ - module_expsym_cmds_F77 | \ - old_archive_from_expsyms_cmds_F77 | \ - export_symbols_cmds_F77 | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_F77 - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_F77 - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_F77 - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_F77 - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_F77 - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_F77 -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_F77 - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_F77 -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_F77 -archive_expsym_cmds=$lt_archive_expsym_cmds_F77 -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_F77 -module_expsym_cmds=$lt_module_expsym_cmds_F77 - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_F77 - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_F77 - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_F77 - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_F77 - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_F77 - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_F77 - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_F77 - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_F77 - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_F77 - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_F77 - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_F77" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_F77 - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_F77 - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_F77 - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_F77 - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - - - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -objext_GCJ=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -compiler_GCJ=$CC - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -archive_cmds_need_lc_GCJ=no - - -lt_prog_compiler_no_builtin_flag_GCJ= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' - - -echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15685: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:15689: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl_GCJ= -lt_prog_compiler_pic_GCJ= -lt_prog_compiler_static_GCJ= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_static_GCJ='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_GCJ='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_GCJ=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_GCJ=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_GCJ='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - else - lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-static' - ;; - ccc*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_GCJ='-Kpic' - lt_prog_compiler_static_GCJ='-dn' - ;; - - solaris*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl_GCJ='-Qoption ld ' - lt_prog_compiler_pic_GCJ='-PIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_GCJ='-Kconform_pic' - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - uts4*) - lt_prog_compiler_pic_GCJ='-pic' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_GCJ=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_GCJ"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_GCJ=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_GCJ" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15918: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:15922: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_GCJ=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 - -if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then - case $lt_prog_compiler_pic_GCJ in - "" | " "*) ;; - *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; - esac -else - lt_prog_compiler_pic_GCJ= - lt_prog_compiler_can_build_shared_GCJ=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_GCJ= - ;; - *) - lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_GCJ=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15978: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:15982: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_GCJ=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag_GCJ= - enable_shared_with_static_runtimes_GCJ=no - archive_cmds_GCJ= - archive_expsym_cmds_GCJ= - old_archive_From_new_cmds_GCJ= - old_archive_from_expsyms_cmds_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= - thread_safe_flag_spec_GCJ= - hardcode_libdir_flag_spec_GCJ= - hardcode_libdir_flag_spec_ld_GCJ= - hardcode_libdir_separator_GCJ= - hardcode_direct_GCJ=no - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=unsupported - link_all_deplibs_GCJ=unknown - hardcode_automatic_GCJ=no - module_cmds_GCJ= - module_expsym_cmds_GCJ= - always_export_symbols_GCJ=no - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_GCJ= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_GCJ=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_GCJ=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_GCJ=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_GCJ='-L$libdir' - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=no - enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - sunos4*) - archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - linux*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds_GCJ="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_GCJ="$tmp_archive_cmds" - fi - else - ld_shlibs_GCJ=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - esac - - if test "$ld_shlibs_GCJ" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=yes - archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_GCJ=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_GCJ=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_GCJ='' - hardcode_direct_GCJ=yes - hardcode_libdir_separator_GCJ=':' - link_all_deplibs_GCJ=yes - - if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_GCJ=yes - else - # We have old collect2 - hardcode_direct_GCJ=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_GCJ=yes - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_libdir_separator_GCJ= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_GCJ=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_GCJ='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_GCJ="-z nodefs" - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_GCJ=' ${wl}-bernotok' - allow_undefined_flag_GCJ=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_GCJ=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_GCJ=' ' - archive_cmds_need_lc_GCJ=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_GCJ=no - ;; - - bsdi4*) - export_dynamic_flag_spec_GCJ=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_GCJ=' ' - allow_undefined_flag_GCJ=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_GCJ='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_GCJ=yes - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc_GCJ=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_GCJ='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_GCJ='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct_GCJ=no - hardcode_automatic_GCJ=yes - hardcode_shlibpath_var_GCJ=unsupported - whole_archive_flag_spec_GCJ='-all_load $convenience' - link_all_deplibs_GCJ=yes - else - ld_shlibs_GCJ=no - fi - ;; - - dgux*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - freebsd1*) - ld_shlibs_GCJ=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - ;; - ia64*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - *) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - link_all_deplibs_GCJ=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - newsos6) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_shlibpath_var_GCJ=no - ;; - - openbsd*) - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - ;; - *) - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - allow_undefined_flag_GCJ=unsupported - archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_GCJ='-rpath $libdir' - fi - hardcode_libdir_separator_GCJ=: - ;; - - sco3.2v5*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_GCJ=' -z text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_shlibpath_var_GCJ=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs_GCJ=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_GCJ='$CC -r -o $output$reload_objs' - hardcode_direct_GCJ=no - ;; - motorola) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4.3*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_GCJ=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_GCJ='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv5*) - no_undefined_flag_GCJ=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_GCJ= - hardcode_shlibpath_var_GCJ=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - *) - ld_shlibs_GCJ=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 -echo "${ECHO_T}$ld_shlibs_GCJ" >&6 -test "$ld_shlibs_GCJ" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_GCJ" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_GCJ=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_GCJ in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_GCJ - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ - allow_undefined_flag_GCJ= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_GCJ=no - else - archive_cmds_need_lc_GCJ=yes - fi - allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=yes - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_GCJ= -if test -n "$hardcode_libdir_flag_spec_GCJ" || \ - test -n "$runpath_var GCJ" || \ - test "X$hardcode_automatic_GCJ"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_GCJ" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && - test "$hardcode_minus_L_GCJ" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_GCJ=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_GCJ=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_GCJ=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 -echo "${ECHO_T}$hardcode_action_GCJ" >&6 - -if test "$hardcode_action_GCJ" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* 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 shl_load (); -/* 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_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* 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 dlopen (); -/* 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_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - fi - ;; - esac - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_GCJ \ - CC_GCJ \ - LD_GCJ \ - lt_prog_compiler_wl_GCJ \ - lt_prog_compiler_pic_GCJ \ - lt_prog_compiler_static_GCJ \ - lt_prog_compiler_no_builtin_flag_GCJ \ - export_dynamic_flag_spec_GCJ \ - thread_safe_flag_spec_GCJ \ - whole_archive_flag_spec_GCJ \ - enable_shared_with_static_runtimes_GCJ \ - old_archive_cmds_GCJ \ - old_archive_from_new_cmds_GCJ \ - predep_objects_GCJ \ - postdep_objects_GCJ \ - predeps_GCJ \ - postdeps_GCJ \ - compiler_lib_search_path_GCJ \ - archive_cmds_GCJ \ - archive_expsym_cmds_GCJ \ - postinstall_cmds_GCJ \ - postuninstall_cmds_GCJ \ - old_archive_from_expsyms_cmds_GCJ \ - allow_undefined_flag_GCJ \ - no_undefined_flag_GCJ \ - export_symbols_cmds_GCJ \ - hardcode_libdir_flag_spec_GCJ \ - hardcode_libdir_flag_spec_ld_GCJ \ - hardcode_libdir_separator_GCJ \ - hardcode_automatic_GCJ \ - module_cmds_GCJ \ - module_expsym_cmds_GCJ \ - lt_cv_prog_compiler_c_o_GCJ \ - exclude_expsyms_GCJ \ - include_expsyms_GCJ; do - - case $var in - old_archive_cmds_GCJ | \ - old_archive_from_new_cmds_GCJ | \ - archive_cmds_GCJ | \ - archive_expsym_cmds_GCJ | \ - module_cmds_GCJ | \ - module_expsym_cmds_GCJ | \ - old_archive_from_expsyms_cmds_GCJ | \ - export_symbols_cmds_GCJ | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_GCJ - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_GCJ - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_GCJ - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_GCJ - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_GCJ - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_GCJ -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_GCJ - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_GCJ -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_GCJ -archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_GCJ -module_expsym_cmds=$lt_module_expsym_cmds_GCJ - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_GCJ - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_GCJ - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_GCJ - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_GCJ - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_GCJ - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_GCJ - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_GCJ - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_GCJ - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_GCJ - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_GCJ" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_GCJ - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_GCJ - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_GCJ - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_GCJ - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - RC) - - - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -objext_RC=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -compiler_RC=$CC -lt_cv_prog_compiler_c_o_RC=yes - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_RC \ - CC_RC \ - LD_RC \ - lt_prog_compiler_wl_RC \ - lt_prog_compiler_pic_RC \ - lt_prog_compiler_static_RC \ - lt_prog_compiler_no_builtin_flag_RC \ - export_dynamic_flag_spec_RC \ - thread_safe_flag_spec_RC \ - whole_archive_flag_spec_RC \ - enable_shared_with_static_runtimes_RC \ - old_archive_cmds_RC \ - old_archive_from_new_cmds_RC \ - predep_objects_RC \ - postdep_objects_RC \ - predeps_RC \ - postdeps_RC \ - compiler_lib_search_path_RC \ - archive_cmds_RC \ - archive_expsym_cmds_RC \ - postinstall_cmds_RC \ - postuninstall_cmds_RC \ - old_archive_from_expsyms_cmds_RC \ - allow_undefined_flag_RC \ - no_undefined_flag_RC \ - export_symbols_cmds_RC \ - hardcode_libdir_flag_spec_RC \ - hardcode_libdir_flag_spec_ld_RC \ - hardcode_libdir_separator_RC \ - hardcode_automatic_RC \ - module_cmds_RC \ - module_expsym_cmds_RC \ - lt_cv_prog_compiler_c_o_RC \ - exclude_expsyms_RC \ - include_expsyms_RC; do - - case $var in - old_archive_cmds_RC | \ - old_archive_from_new_cmds_RC | \ - archive_cmds_RC | \ - archive_expsym_cmds_RC | \ - module_cmds_RC | \ - module_expsym_cmds_RC | \ - old_archive_from_expsyms_cmds_RC | \ - export_symbols_cmds_RC | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_RC - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_RC - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_RC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_RC - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_RC - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_RC -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_RC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_RC -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_RC -archive_expsym_cmds=$lt_archive_expsym_cmds_RC -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_RC -module_expsym_cmds=$lt_module_expsym_cmds_RC - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_RC - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_RC - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_RC - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_RC - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_RC - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_RC - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_RC - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_RC - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_RC - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_RC - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_RC - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_RC" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_RC - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_RC - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_RC - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_RC - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - ;; - - *) - { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 -echo "$as_me: error: Unsupported tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 -echo "$as_me: error: unable to update list of available tagged configurations." >&2;} - { (exit 1); exit 1; }; } - fi -fi @@ -19253,24 +8331,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion - - - - - - - - - - - - - - - - - - # Enable large file support. # Check whether --enable-largefile or --disable-largefile was given. @@ -22742,13 +11802,6 @@ 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 -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -23330,7 +12383,6 @@ 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 @@ -23339,6 +12391,9 @@ s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t s,@REALLYSTATIC_TRUE@,$REALLYSTATIC_TRUE,;t t s,@REALLYSTATIC_FALSE@,$REALLYSTATIC_FALSE,;t t s,@CC@,$CC,;t t @@ -23358,23 +12413,11 @@ 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,@EGREP@,$EGREP,;t t s,@ECHO@,$ECHO,;t t -s,@AR@,$AR,;t t -s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;t t -s,@ac_ct_CXX@,$ac_ct_CXX,;t t -s,@CXXDEPMODE@,$CXXDEPMODE,;t t -s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t -s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t -s,@CXXCPP@,$CXXCPP,;t t -s,@F77@,$F77,;t t -s,@FFLAGS@,$FFLAGS,;t t -s,@ac_ct_F77@,$ac_ct_F77,;t t +s,@EGREP@,$EGREP,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t @@ -24008,27 +13051,21 @@ echo X"$mf" | else continue fi - grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //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 ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. 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 " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue diff --git a/depcomp b/depcomp index 9e5522d0..11e2d3bf 100755 --- a/depcomp +++ b/depcomp @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2003-11-08.23 +scriptversion=2004-05-31.23 -# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004 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 @@ -43,6 +43,7 @@ Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). @@ -61,18 +62,10 @@ if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi -# `libtool' can also be set to `yes' or `no'. - -if test -z "$depfile"; then - base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` - dir=`echo "$object" | sed 's,/.*$,/,'` - if test "$dir" = "$object"; then - dir= - fi - # FIXME: should be _deps on DOS. - depfile="$dir.deps/$base" -fi +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" @@ -294,26 +287,35 @@ tru64) base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then + # Dependencies are output in .lo.d with libtool 1.4. + # With libtool 1.5 they are output both in $dir.libs/$base.o.d + # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the + # latter, because the former will be cleaned when $dir.libs is + # erased. tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir.libs/$base.d" + tmpdepfile2="$dir$base.o.d" + tmpdepfile3="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" + tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" - else + elif test -f "$tmpdepfile2"; then tmpdepfile="$tmpdepfile2" + else + tmpdepfile="$tmpdepfile3" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" diff --git a/doc/Makefile.in b/doc/Makefile.in index 200d08e6..842ffe1e 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.9 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -50,7 +50,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -61,10 +60,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -76,8 +71,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -107,21 +100,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -264,7 +254,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/include/Makefile.in b/include/Makefile.in index f621ba46..0b913d4e 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.9 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -59,7 +59,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -70,10 +69,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -85,8 +80,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -116,21 +109,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -280,14 +270,16 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ + empty_fix=.; \ else \ include_option=--include; \ + empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ + test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ @@ -297,9 +289,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -350,15 +344,17 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done - list='$(SUBDIRS)'; for subdir in $$list; do \ + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || mkdir "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="../$(top_distdir)" \ - distdir="../$(distdir)/$$subdir" \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ @@ -387,7 +383,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index d6a59487..79b80117 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.9 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -47,6 +47,12 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(linux_ntfsincludedir)" linux_ntfsincludeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(linux_ntfsinclude_HEADERS) @@ -57,7 +63,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -68,10 +73,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -83,8 +84,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -114,21 +113,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -237,7 +233,7 @@ install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) test -z "$(linux_ntfsincludedir)" || $(mkdir_p) "$(DESTDIR)$(linux_ntfsincludedir)" @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " $(linux_ntfsincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(linux_ntfsincludedir)/$$f'"; \ $(linux_ntfsincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ done @@ -245,7 +241,7 @@ install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) uninstall-linux_ntfsincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(linux_ntfsincludedir)/$$f'"; \ rm -f "$(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ done @@ -270,9 +266,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -349,7 +347,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/install-sh b/install-sh index 77bc3814..b777f124 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-02-15.20 +scriptversion=2004-07-05.00 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -58,9 +58,6 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" -transformbasename= -transform_arg= -instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= @@ -70,23 +67,27 @@ mvcmd="$mvprog" src= dst= dir_arg= +dstarg= +no_target_directory= -usage="Usage: $0 [OPTION]... SRCFILE DSTFILE +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 -d DIRECTORIES... + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... -In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. -In the second, create the directory path DIR. +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. Options: --b=TRANSFORMBASENAME --c copy source (using $cpprog) instead of moving (using $mvprog). +-c (ignored) -d create directories instead of installing files. --g GROUP $chgrp installed files to GROUP. --m MODE $chmod installed files to MODE. --o USER $chown installed files to USER. --s strip installed files (using $stripprog). --t=TRANSFORM +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. @@ -96,12 +97,7 @@ Environment variables override the default commands: while test -n "$1"; do case $1 in - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - -c) instcmd=$cpprog - shift + -c) shift continue;; -d) dir_arg=true @@ -129,14 +125,20 @@ while test -n "$1"; do shift continue;; - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; --version) echo "$0 $scriptversion"; exit 0;; *) # When -d is used, all remaining arguments are directories to create. - test -n "$dir_arg" && break + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do @@ -174,13 +176,13 @@ do src= if test -d "$dst"; then - instcmd=: + mkdircmd=: chmodcmd= else - instcmd=$mkdirprog + mkdircmd=$mkdirprog fi else - # Waiting for this to be detected by the "$instcmd $src $dsttmp" command + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then @@ -202,6 +204,10 @@ do # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi dst=$dst/`basename "$src"` fi fi @@ -229,34 +235,25 @@ do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" || lasterr=$? + $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. - test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } + test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then - $doit $instcmd "$dst" \ + $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else - # If we're going to rename the final executable, determine the name now. - if test -z "$transformarg"; then - dstfile=`basename "$dst"` - else - dstfile=`basename "$dst" $transformbasename \ - | sed $transformarg`$transformbasename - fi - - # don't allow the sed command to completely eliminate the filename. - test -z "$dstfile" && dstfile=`basename "$dst"` + dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ @@ -266,40 +263,49 @@ do trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 - # Move or copy the file name to the temp name - $doit $instcmd "$src" "$dsttmp" && + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $instcmd $src $dsttmp" command. + # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - # Now remove or move aside any old file at destination location. We - # try this two ways since rm can't unlink itself on some systems and - # the destination file might be busy for other reasons. In this case, - # the final cleanup might fail but the new file should still install - # successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi - } && - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } fi || { (exit 1); exit; } done diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index df12cb16..9b98e65c 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.9 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -75,7 +75,15 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = libntfs.conf libntfs-gnomevfs.8 -am__installdirs = "$(DESTDIR)$(gnomevfsmoduleslibdir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(gnomevfsmodulesconfdir)" +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(gnomevfsmoduleslibdir)" \ + "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man8dir)" \ + "$(DESTDIR)$(gnomevfsmodulesconfdir)" gnomevfsmoduleslibLTLIBRARIES_INSTALL = $(INSTALL) libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(gnomevfsmoduleslib_LTLIBRARIES) $(lib_LTLIBRARIES) @@ -84,6 +92,8 @@ am_libntfs_gnomevfs_la_OBJECTS = \ libntfs_gnomevfs_la-gnome-vfs-method.lo \ libntfs_gnomevfs_la-gnome-vfs-module.lo libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) +@ENABLE_GNOME_VFS_TRUE@am_libntfs_gnomevfs_la_rpath = -rpath \ +@ENABLE_GNOME_VFS_TRUE@ $(gnomevfsmoduleslibdir) libntfs_la_LIBADD = am_libntfs_la_OBJECTS = attrib.lo attrlist.lo bitmap.lo bootsect.lo \ compat.lo compress.lo debug.lo device.lo device_io.lo dir.lo \ @@ -93,18 +103,6 @@ libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrib.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/attrlist.Plo ./$(DEPDIR)/bitmap.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/bootsect.Plo ./$(DEPDIR)/compat.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/compress.Plo ./$(DEPDIR)/debug.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/device.Plo ./$(DEPDIR)/device_io.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/dir.Plo ./$(DEPDIR)/inode.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/lcnalloc.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/mft.Plo ./$(DEPDIR)/mst.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/runlist.Plo ./$(DEPDIR)/security.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/unistr.Plo ./$(DEPDIR)/volume.Plo COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ @@ -127,7 +125,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -138,10 +135,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -153,8 +146,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -184,21 +175,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -313,7 +301,7 @@ install-gnomevfsmoduleslibLTLIBRARIES: $(gnomevfsmoduleslib_LTLIBRARIES) test -z "$(gnomevfsmoduleslibdir)" || $(mkdir_p) "$(DESTDIR)$(gnomevfsmoduleslibdir)" @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gnomevfsmoduleslibdir)/$$f'"; \ $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gnomevfsmoduleslibdir)/$$f"; \ else :; fi; \ @@ -321,8 +309,8 @@ install-gnomevfsmoduleslibLTLIBRARIES: $(gnomevfsmoduleslib_LTLIBRARIES) uninstall-gnomevfsmoduleslibLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ + @set -x; list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(gnomevfsmoduleslibdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(gnomevfsmoduleslibdir)/$$p"; \ done @@ -331,7 +319,7 @@ clean-gnomevfsmoduleslibLTLIBRARIES: -test -z "$(gnomevfsmoduleslib_LTLIBRARIES)" || rm -f $(gnomevfsmoduleslib_LTLIBRARIES) @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ + test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done @@ -340,7 +328,7 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ @@ -348,8 +336,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done @@ -358,12 +346,12 @@ clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ + test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libntfs-gnomevfs.la: $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_DEPENDENCIES) - $(LINK) -rpath $(gnomevfsmoduleslibdir) $(libntfs_gnomevfs_la_LDFLAGS) $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_LIBADD) $(LIBS) + $(LINK) $(am_libntfs_gnomevfs_la_rpath) $(libntfs_gnomevfs_la_LDFLAGS) $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_LIBADD) $(LIBS) libntfs.la: $(libntfs_la_OBJECTS) $(libntfs_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libntfs_la_LDFLAGS) $(libntfs_la_OBJECTS) $(libntfs_la_LIBADD) $(LIBS) @@ -398,72 +386,35 @@ distclean-compile: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< -libntfs_gnomevfs_la-gnome-vfs-method.o: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.o -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.o `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.o `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c - -libntfs_gnomevfs_la-gnome-vfs-method.obj: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.obj -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.obj `if test -f 'gnome-vfs-method.c'; then $(CYGPATH_W) 'gnome-vfs-method.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-method.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.obj `if test -f 'gnome-vfs-method.c'; then $(CYGPATH_W) 'gnome-vfs-method.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-method.c'; fi` - libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c -libntfs_gnomevfs_la-gnome-vfs-module.o: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.o -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.o `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.o `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c - -libntfs_gnomevfs_la-gnome-vfs-module.obj: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.obj -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.obj `if test -f 'gnome-vfs-module.c'; then $(CYGPATH_W) 'gnome-vfs-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-module.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.obj `if test -f 'gnome-vfs-module.c'; then $(CYGPATH_W) 'gnome-vfs-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-module.c'; fi` - libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c mostlyclean-libtool: @@ -525,7 +476,7 @@ install-gnomevfsmodulesconfDATA: $(gnomevfsmodulesconf_DATA) test -z "$(gnomevfsmodulesconfdir)" || $(mkdir_p) "$(DESTDIR)$(gnomevfsmodulesconfdir)" @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " $(gnomevfsmodulesconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f'"; \ $(gnomevfsmodulesconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ done @@ -533,7 +484,7 @@ install-gnomevfsmodulesconfDATA: $(gnomevfsmodulesconf_DATA) uninstall-gnomevfsmodulesconfDATA: @$(NORMAL_UNINSTALL) @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f'"; \ rm -f "$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ done @@ -558,9 +509,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -637,7 +590,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/ltmain.sh b/ltmain.sh index 5eb4c3a3..239bdefb 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -48,6 +48,9 @@ EOF exit 0 fi +# define SED for historic ltconfig's generated by Libtool 1.3 +test -z "$SED" && SED=sed + # The name of this program. progname=`$echo "$0" | ${SED} 's%^.*/%%'` modename="$progname" @@ -55,8 +58,8 @@ modename="$progname" # Constants. PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.2 -TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08)" +VERSION=1.4.3 +TIMESTAMP=" (1.922.2.110 2002/10/23 01:39:54)" default_mode= help="Try \`$progname --help' for more information." @@ -69,17 +72,17 @@ rm="rm -f" # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' -# test EBCDIC or ASCII -case `echo A|tr A '\301'` in - A) # EBCDIC based system - SP2NL="tr '\100' '\n'" - NL2SP="tr '\r\n' '\100\100'" - ;; - *) # Assume ASCII based system - SP2NL="tr '\040' '\012'" - NL2SP="tr '\015\012' '\040\040'" - ;; -esac +# test EBCDIC or ASCII +case `echo A|od -x` in + *[Cc]1*) # EBCDIC based system + SP2NL="tr '\100' '\n'" + NL2SP="tr '\r\n' '\100\100'" + ;; + *) # Assume ASCII based system + SP2NL="tr '\040' '\012'" + NL2SP="tr '\015\012' '\040\040'" + ;; +esac # NLS nuisances. # Only set LANG and LC_ALL to C if already set. @@ -94,12 +97,11 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -: ${IFS=" -"} +: ${IFS=" "} if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - $echo "$modename: not configured to build any kind of library" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi @@ -115,51 +117,8 @@ execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -win32_libid () { - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $echo $win32_libid_type -} - -# End of Shell function definitions -##################################### - # Parse our command line options once, thoroughly. -while test "$#" -gt 0 +while test $# -gt 0 do arg="$1" shift @@ -175,34 +134,6 @@ do execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; - tag) - tagname="$arg" - preserve_args="${preserve_args}=$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit 1 - ;; - esac - - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac - ;; *) eval "$prev=\$arg" ;; @@ -220,27 +151,18 @@ do ;; --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2003 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" exit 0 ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" - done exit 0 ;; --debug) - $echo "$progname: enabling shell trace mode" + echo "$progname: enabling shell trace mode" set -x - preserve_args="$preserve_args $arg" ;; --dry-run | -n) @@ -248,16 +170,16 @@ do ;; --features) - $echo "host: $host" + echo "host: $host" if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" + echo "enable shared libraries" else - $echo "disable shared libraries" + echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - $echo "enable static libraries" + echo "enable static libraries" else - $echo "disable static libraries" + echo "disable static libraries" fi exit 0 ;; @@ -271,15 +193,6 @@ do --quiet | --silent) show=: - preserve_args="$preserve_args $arg" - ;; - - --tag) prevopt="--tag" prev=tag ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - preserve_args="$preserve_args --tag" ;; -dlopen) @@ -306,6 +219,17 @@ if test -n "$prevopt"; then exit 1 fi +# Mandrake: (gc) It's bad to link C++ code with GCC, so we need to use the compiler name if provided +if test "$mode" = link && test -n "$archive_cmds" && test -x "/usr/bin/perl"; then + case $nonopt in + *cc | *++ | gcc* | *-gcc* | egcs*) + archive_cmds=`echo $archive_cmds | perl -pe 's/^\S+\s+//'` + archive_cmds="$nonopt $archive_cmds" + archive_expsym_cmds=`echo $archive_expsym_cmds | perl -pe 's/^\S+\s+//'` + archive_expsym_cmds="$nonopt $archive_expsym_cmds" + esac +fi + # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. @@ -315,10 +239,8 @@ if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + *cc | *++ | gcc* | *-gcc* | xlc*) mode=link for arg do @@ -373,193 +295,50 @@ if test -z "$show_help"; then modename="$modename: compile" # Get the compilation command and the source file. base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes + prev= + lastarg= + srcfile="$nonopt" suppress_output= - arg_mode=normal - libobj= - later= + user_target=no for arg do - case "$arg_mode" in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - target ) - libobj="$arg" - arg_mode=normal + case $arg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi continue ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - arg_mode=target - continue - ;; - - -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" - continue - ;; - - * ) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; esac - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit 1 - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - *) - # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit 1 - ;; - esac - - # Infer tagged configuration to use if any are available and - # if one wasn't chosen via the "--tag" command line option. - # Only attempt this if the compiler in the base compile - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case "$base_compile " in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi - - for arg in $later; do + # Accept any command-line options. case $arg in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + -static) build_old_libs=yes continue @@ -574,17 +353,122 @@ if test -z "$show_help"; then pic_mode=no continue ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; esac + + case $user_target in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi done - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi - lobj=${xdir}$objdir/$objname + case $user_target in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 @@ -594,9 +478,9 @@ if test -z "$show_help"; then # Delete any leftover library objects. if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" + removelist="$obj $libobj" else - removelist="$lobj $libobj ${libobj}T" + removelist="$libobj" fi $run $rm $removelist @@ -621,7 +505,6 @@ if test -z "$show_help"; then removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit 1" 1 2 15 else - output_obj= need_locks=no lockfile= fi @@ -635,7 +518,7 @@ if test -z "$show_help"; then done elif test "$need_locks" = warn; then if test -f "$lockfile"; then - $echo "\ + echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` @@ -649,55 +532,56 @@ compiler." $run $rm $removelist exit 1 fi - $echo $srcfile > "$lockfile" + echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -726,9 +610,9 @@ compiler." fi # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : else error=$? $run $rm $removelist @@ -736,23 +620,48 @@ compiler." fi fi - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -798,7 +709,7 @@ compiler." fi # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + if test x"$output_obj" != x"$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else @@ -808,25 +719,23 @@ compiler." fi fi - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T < $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi fi - $run $mv "${libobj}T" "${libobj}" - # Unlock the critical section if it was locked if test "$need_locks" != no; then $run $rm "$lockfile" @@ -843,7 +752,7 @@ EOF # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. + # flag for every libtool invokation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying @@ -858,7 +767,6 @@ EOF ;; esac libtool_args="$nonopt" - base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" @@ -889,8 +797,6 @@ EOF module=no no_install=no objs= - non_pic_objects= - precious_files_regex= prefer_static_libs=no preload=no prev= @@ -902,48 +808,6 @@ EOF temp_rpath= thread_safe=no vinfo= - vinfo_number=no - - # Infer tagged configuration to use if any are available and - # if one wasn't chosen via the "--tag" command line option. - # Only attempt this if the compiler in the base link - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case $base_compile in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in $compile_command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi # We need to know -static, to get the right output filenames. for arg @@ -974,7 +838,7 @@ EOF test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do + while test $# -gt 0; do arg="$1" shift case $arg in @@ -1049,128 +913,16 @@ EOF prev= continue ;; - inst_prefix) + inst_prefix) inst_prefix_dir="$arg" prev= continue ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; release) release="-$arg" prev= continue ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat $save_arg` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit 1 - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit 1 - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - done - else - $echo "$modename: link input file \`$save_arg' does not exist" - exit 1 - fi - arg=$save_arg - prev= - continue - ;; rpath | xrpath) # We need an absolute path. case $arg in @@ -1209,21 +961,13 @@ EOF finalize_command="$finalize_command $wl$qarg" continue ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac - fi # test -n "$prev" + fi # test -n $prev prevarg="$arg" @@ -1284,7 +1028,7 @@ EOF # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) + no/*-*-irix* | no/*-*-nonstopux*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; @@ -1339,61 +1083,24 @@ EOF # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs -framework System" - continue esac - elif test "X$arg" = "X-lc_r"; then - case $host in + elif test "X$arg" = "X-lc_r"; then + case $host in *-*-openbsd* | *-*-freebsd*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac fi deplibs="$deplibs $arg" continue ;; - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - deplibs="$deplibs $arg" - continue - ;; - -module) module=yes continue ;; - # gcc -m* arguments should be passed to the linker via $compiler_flags - # in order to pass architecture information to the linker - # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. - -m*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi - continue - ;; - - -shrext) - prev=shrext - continue - ;; - -no-fast-install) fast_install=no continue @@ -1418,18 +1125,8 @@ EOF continue ;; - -objectlist) - prev=objectlist - continue - ;; - -o) prev=output ;; - -precious-files-regex) - prev=precious_regex - continue - ;; - -release) prev=release continue @@ -1480,11 +1177,6 @@ EOF prev=vinfo continue ;; - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` @@ -1533,11 +1225,6 @@ EOF continue ;; - -XCClinker) - prev=xcclinker - continue - ;; - # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need @@ -1550,102 +1237,30 @@ EOF esac ;; - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit 1 - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit 1 + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + prev= + continue else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles fi fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + fi ;; *.$libext) @@ -1704,7 +1319,6 @@ EOF finalize_command="$finalize_command $arg" fi - oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" @@ -1725,11 +1339,11 @@ EOF output_objdir="$output_objdir/$objdir" fi # Create the object directory. - if test ! -d "$output_objdir"; then + if test ! -d $output_objdir; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then + if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi @@ -1747,17 +1361,7 @@ EOF *) linkmode=prog ;; # Anything else should be a program. esac - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplcations in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - esac specialdeplibs= - libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) @@ -1769,25 +1373,6 @@ EOF fi libs="$libs $deplib" done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - deplibs= newdependency_libs= newlib_search_path= @@ -1819,59 +1404,39 @@ EOF ;; esac for pass in $passes; do - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then + if test $linkmode = prog; then + # Determine which files to process case $pass in - dlopen) libs="$dlfiles" ;; + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi for deplib in $libs; do lib= found=no case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - fi - continue - ;; -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + if test $linkmode = oldlib && test $linkmode = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 continue fi - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - for search_ext in .la $shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi done if test "$found" != yes; then # deplib doesn't seem to be a libtool library @@ -1880,61 +1445,25 @@ EOF finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" fi continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - library_names= - old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" - test "$pass" = conv && continue + test $pass = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi - if test "$pass" = scan; then + if test $pass = scan; then deplibs="$deplib $deplibs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else @@ -1943,13 +1472,13 @@ EOF fi ;; *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 ;; esac # linkmode continue ;; # -L -R*) - if test "$pass" = link; then + if test $pass = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in @@ -1962,30 +1491,30 @@ EOF ;; *.la) lib="$deplib" ;; *.$libext) - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) if test "$deplibs_check_method" != pass_all; then - $echo - $echo "*** Warning: Trying to link with static lib archive $deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because the file extensions .$libext of this argument makes me believe" - $echo "*** that it is just a static archive that I should not used here." + echo + echo "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not used here." else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) - if test "$pass" != link; then + if test $pass != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -1996,18 +1525,14 @@ EOF esac # linkmode ;; # *.$libext *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi + if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" fi continue ;; @@ -2016,14 +1541,14 @@ EOF continue ;; esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : + if test $found = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 exit 1 fi # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 @@ -2039,9 +1564,8 @@ EOF library_names= old_library= # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink + # it will not redefine variable installed. installed=yes - shouldnotlink=no # Read the .la file case $lib in @@ -2051,12 +1575,13 @@ EOF if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then + { test $linkmode = oldlib && test $linkmode = obj; }; then + # Add dl[pre]opened files of deplib test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi - if test "$pass" = conv; then + if test $pass = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then @@ -2077,14 +1602,13 @@ EOF fi tmp_libs="$tmp_libs $deplib" done - elif test "$linkmode" != prog && test "$linkmode" != lib; then + elif test $linkmode != prog && test $linkmode != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit 1 fi continue fi # $pass = conv - # Get the name of the library we link against. linklib= for l in $old_library $library_names; do @@ -2096,17 +1620,15 @@ EOF fi # This library was specified with -dlopen. - if test "$pass" = dlopen; then + if test $pass = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit 1 fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" + # statically, we need to preload. + dlprefiles="$dlprefiles $lib" else newdlfiles="$newdlfiles $lib" fi @@ -2147,7 +1669,7 @@ EOF name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then + if test $pass = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit 1 @@ -2166,19 +1688,18 @@ EOF if test -z "$libdir"; then # Link the convenience library - if test "$linkmode" = lib; then + if test $linkmode = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else - deplibs="$lib $deplibs" # used for prog,scan pass + deplibs="$lib $deplibs" fi continue fi - - if test "$linkmode" = prog && test "$pass" != link; then + if test $linkmode = prog && test $pass != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" @@ -2194,7 +1715,7 @@ EOF -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then + if test $linkalldeplibs = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths @@ -2211,19 +1732,13 @@ EOF continue fi # $linkmode = prog... - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + if test "$linkmode,$pass" = "prog,link" || + { test $linkmode = lib && test $hardcode_into_libs = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. @@ -2245,6 +1760,17 @@ EOF esac ;; esac + if test $linkmode = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && @@ -2254,51 +1780,11 @@ EOF # We only need to search for static libraries continue fi - fi - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi - # This is a shared library - - # Warn about portability, can't link against -module's on some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then - $echo - if test "$linkmode" = prog; then - $echo "*** Warning: Linking the executable $output against the loadable module" - else - $echo "*** Warning: Linking the shared library $output against the loadable module" - fi - $echo "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname @@ -2312,7 +1798,7 @@ EOF elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin* | mingw*) + *cygwin*) major=`expr $current - $age` versuffix="-$major" ;; @@ -2324,18 +1810,17 @@ EOF # Make a new name for the extract_expsyms_cmds to use soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + soname=`echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' - cmds=$extract_expsyms_cmds + eval cmds=\"$extract_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -2346,10 +1831,9 @@ EOF if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' - cmds=$old_archive_from_expsyms_cmds + eval cmds=\"$old_archive_from_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -2358,9 +1842,9 @@ EOF # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" + fi # test -n $old_archive_from_expsyms_cmds - if test "$linkmode" = prog || test "$mode" != relink; then + if test $linkmode = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= @@ -2369,22 +1853,6 @@ EOF immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" - case $host in - *-*-sco3.2v5* ) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a module then we can not link against it, someone - # is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then - $echo "** Warning, lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $echo - $echo "** And there doesn't seem to be a static archive available" - $echo "** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - fi - esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; @@ -2403,14 +1871,6 @@ EOF add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" @@ -2433,7 +1893,7 @@ EOF *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi - if test "$linkmode" = prog; then + if test $linkmode = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else @@ -2450,8 +1910,9 @@ EOF fi fi - if test "$linkmode" = prog || test "$mode" = relink; then + if test $linkmode = prog || test "$mode" = relink; then add_shlibpath= + add_prefix_dir= add_dir= add= # Finalize command for both is simple: just hardcode it. @@ -2466,35 +1927,43 @@ EOF *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi add="-l$name" fi - if test "$linkmode" = prog; then + + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_prefix_dir="-L$inst_prefix_dir$libdir" + ;; + esac + fi + + # add_prefix_dir must be appended instead, otherwise it can + # possibly be overrided by any hardcoded -L/... path in deplibs + if test $linkmode = prog; then + test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir" test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else + test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir" test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi - elif test "$linkmode" = prog; then + elif test $linkmode = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + # Try to link the static library # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. @@ -2514,21 +1983,21 @@ EOF # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." + echo + echo "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -2545,10 +2014,10 @@ EOF fi fi # link shared/static library? - if test "$linkmode" = lib; then + if test $linkmode = lib; then if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || - test "$link_static" = yes; }; then + { test $hardcode_into_libs != yes || test $build_old_libs = yes || + test $link_static = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do @@ -2579,7 +2048,7 @@ EOF tmp_libs="$tmp_libs $deplib" done - if test "$link_all_deplibs" != no; then + if test $link_all_deplibs != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in @@ -2599,7 +2068,7 @@ EOF ;; esac if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" + path="-L$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then @@ -2609,57 +2078,12 @@ EOF if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi - path="$absdir" + path="-L$absdir" fi - depdepl= - case $host in - *-*-darwin*) - # we do not want to link against static libs, but need to link against shared - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$path/$depdepl" ; then - depdepl="$path/$depdepl" - fi - # do not add paths which are already there - case " $newlib_search_path " in - *" $path "*) ;; - *) newlib_search_path="$newlib_search_path $path";; - esac - fi - path="" - ;; - *) - path="-L$path" - ;; - esac - - ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac ;; *) continue ;; esac case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$deplibs $depdepl" ;; - esac - case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac @@ -2667,15 +2091,15 @@ EOF fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then + if test $pass = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then + if test $pass != dlopen; then + test $pass != scan && dependency_libs="$newdependency_libs" + if test $pass != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do @@ -2697,30 +2121,9 @@ EOF eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) @@ -2748,31 +2151,19 @@ EOF eval $var=\"$tmp_libs\" done # for var fi - # Last step: remove runtime libs from dependency_libs (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi done # for pass - if test "$linkmode" = prog; then + if test $linkmode = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi @@ -2786,7 +2177,7 @@ EOF fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 fi if test -n "$release"; then @@ -2808,7 +2199,6 @@ EOF case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext\" eval libname=\"$libname_spec\" ;; *) @@ -2820,7 +2210,6 @@ EOF if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` @@ -2833,9 +2222,9 @@ EOF $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit 1 else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi @@ -2845,7 +2234,7 @@ EOF fi set dummy $rpath - if test "$#" -gt 2; then + if test $# -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" @@ -2854,16 +2243,14 @@ EOF if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. + libext=al oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then @@ -2882,50 +2269,13 @@ EOF exit 1 fi - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$2" - number_minor="$3" - number_revision="$4" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows) - current=`expr $number_major + $number_minor` - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - current=`expr $number_major + $number_minor - 1` - age="$number_minor" - revision="$number_minor" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - esac + current="$2" + revision="$3" + age="$4" # Check that each of the things are valid numbers. case $current in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2934,7 +2284,7 @@ EOF esac case $revision in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2943,7 +2293,7 @@ EOF esac case $age in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2951,7 +2301,7 @@ EOF ;; esac - if test "$age" -gt "$current"; then + if test $age -gt $current; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 @@ -2995,7 +2345,7 @@ EOF # Add in all the interfaces that we are compatible with. loop=$revision - while test "$loop" -ne 0; do + while test $loop != 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" @@ -3018,7 +2368,7 @@ EOF # Add in all the interfaces that we are compatible with. loop=$age - while test "$loop" -ne 0; do + while test $loop != 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" @@ -3042,7 +2392,7 @@ EOF *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 ;; esac @@ -3050,11 +2400,12 @@ EOF # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= + verstring="0.0" case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely - verstring= + verstring="" ;; *) verstring="0.0" @@ -3088,28 +2439,9 @@ EOF fi if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$echo "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - removelist="$removelist $p" - ;; - *) ;; - esac - done - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi + # Remove our outputs. + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* fi # Now set the variables for building old libraries. @@ -3122,9 +2454,9 @@ EOF # Eliminate all temporary directories. for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then @@ -3137,7 +2469,7 @@ EOF *) finalize_rpath="$finalize_rpath $libdir" ;; esac done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + if test $hardcode_into_libs != yes || test $build_old_libs = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi @@ -3177,11 +2509,10 @@ EOF ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue ;; - *) + *) # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then + if test $build_libtool_need_lc = "yes"; then deplibs="$deplibs -lc" fi ;; @@ -3208,7 +2539,7 @@ EOF # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. + # implementing what was already the behaviour. newdeplibs=$deplibs ;; test_compile) @@ -3221,22 +2552,45 @@ EOF int main() { return 0; } EOF $rm conftest - $LTCC -o conftest conftest.c $deplibs - if test "$?" -eq 0 ; then + $CC -o conftest conftest.c $deplibs + if test $? -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do name="`expr $i : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" -ne "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + echo + echo "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which I believe you do not have" + echo "*** because a test_compile did reveal that the linker did not use it for" + echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occured in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + $rm conftest + $CC -o conftest conftest.c $i + # Did it work? + if test $? -eq 0 ; then + ldd_output=`ldd conftest` libname=`eval \\$echo \"$libname_spec\"` deplib_matches=`eval \\$echo \"$library_names_spec\"` set dummy $deplib_matches @@ -3245,64 +2599,21 @@ EOF newdeplibs="$newdeplibs $i" else droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which I believe you do not have" - $echo "*** because a test_compile did reveal that the linker did not use it for" - $echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occurred in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - $rm conftest - $LTCC -o conftest conftest.c $i - # Did it work? - if test "$?" -eq 0 ; then - ldd_output=`ldd conftest` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because a test_compile did reveal that the linker did not use this one" - $echo "*** as a dynamic dependency that programs can get resolved with at runtime." - fi + echo + echo "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because a test_compile did reveal that the linker did not use this one" + echo "*** as a dynamic dependency that programs can get resolved with at runtime." fi else droppeddeps=yes - $echo - $echo "*** Warning! Library $i is needed by this library but I was not able to" - $echo "*** make it link in! You will probably need to install it or some" - $echo "*** library that it depends on before this library will be fully" - $echo "*** functional. Installing it before continuing would be even better." + echo + echo "*** Warning! Library $i is needed by this library but I was not able to" + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." fi else newdeplibs="$newdeplibs $i" @@ -3316,20 +2627,11 @@ EOF for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then @@ -3348,29 +2650,35 @@ EOF *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done + # It is ok to link against an archive when + # building a shared library. + if $AR -t $potlib > /dev/null 2>&1; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then + | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi - done - done - fi + done + done if test -n "$a_deplib" ; then droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" + echo + echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" + echo "*** with $libname but no candidates were found. (...for file magic test)" else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a file magic. Last file checked: $potlib" fi fi else @@ -3386,43 +2694,33 @@ EOF name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval $echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check below in file_magic test + if eval echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | egrep "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi done - fi + done if test -n "$a_deplib" ; then droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" + echo + echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + echo "*** with $libname but no candidates were found. (...for regex pattern test)" else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a regex pattern. Last file checked: $potlib" fi fi else @@ -3433,23 +2731,16 @@ EOF ;; none | unknown | *) newdeplibs="" - tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` - done - fi - if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ - | grep . >/dev/null; then - $echo + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo if test "X$deplibs_check_method" = "Xnone"; then - $echo "*** Warning: inter-library dependencies are not supported in this platform." + echo "*** Warning: inter-library dependencies are not supported in this platform." else - $echo "*** Warning: inter-library dependencies are not known to be supported." + echo "*** Warning: inter-library dependencies are not known to be supported." fi - $echo "*** All declared inter-library dependencies are being dropped." + echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; @@ -3469,17 +2760,17 @@ EOF if test "$droppeddeps" = yes; then if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -3489,16 +2780,16 @@ EOF build_libtool_libs=no fi else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." - if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." + if test $allow_undefined = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -3520,7 +2811,7 @@ EOF # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then + if test $hardcode_into_libs = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= @@ -3556,11 +2847,7 @@ EOF if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi + eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. @@ -3580,7 +2867,6 @@ EOF fi # Get the real and link names of the library. - eval shared_ext=\"$shrext\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" @@ -3591,9 +2877,7 @@ EOF else soname="$realname" fi - if test -z "$dlname"; then - dlname=$soname - fi + test -z "$dlname" && dlname=$soname lib="$output_objdir/$realname" for link @@ -3601,6 +2885,23 @@ EOF linknames="$linknames $link" done + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -3610,26 +2911,17 @@ EOF $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols - cmds=$export_symbols_cmds + eval cmds=\"$export_symbols_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false - else - # The command line is too long to execute in one step. - $show "using reloadable object file for export list..." - skipped_export=: - fi + $show "$cmd" + $run eval "$cmd" || exit $? done IFS="$save_ifs" if test -n "$export_symbols_regex"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi @@ -3640,29 +2932,17 @@ EOF $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then + if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" @@ -3678,42 +2958,16 @@ EOF $show "${rm}r $xdir" $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then + if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi fi @@ -3729,148 +2983,25 @@ EOF fi # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds + eval cmds=\"$archive_expsym_cmds\" else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise. - $echo "creating reloadable object files..." - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - delfiles= - last_robj= - k=1 - output=$output_objdir/$save_output-${k}.$objext - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - eval test_cmds=\"$reload_cmds $objlist $last_robj\" - if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; }; then - objlist="$objlist $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" - else - # All subsequent reloadable object files will link in - # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + save_deplibs="$deplibs" + for conv in $convenience; do + tmp_deplibs= + for test_deplib in $deplibs; do + if test "$test_deplib" != "$conv"; then + tmp_deplibs="$tmp_deplibs $test_deplib" fi - last_robj=$output_objdir/$save_output-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$save_output-${k}.$objext - objlist=$obj - len=1 - fi + done + deplibs="$tmp_deplibs" done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" - - if ${skipped_export-false}; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - libobjs=$output - # Append the command to create the export file. - eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" - fi - - # Set up a command to remove the reloadale object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" - done - - $echo "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~\$rm $delfiles\" + eval cmds=\"$archive_cmds\" + deplibs="$save_deplibs" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3958,10 +3089,10 @@ EOF gentop="$output_objdir/${obj}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then + if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" @@ -3977,42 +3108,16 @@ EOF $show "${rm}r $xdir" $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then + if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` done fi fi @@ -4021,11 +3126,10 @@ EOF reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" - cmds=$reload_cmds + eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4049,8 +3153,8 @@ EOF # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? exit 0 fi @@ -4058,15 +3162,28 @@ EOF # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" - cmds=$reload_cmds + eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then @@ -4079,7 +3196,7 @@ EOF prog) case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 @@ -4101,19 +3218,16 @@ EOF # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + ;; + esac ;; esac - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - if test "$tagname" = CXX ; then - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - fi - ;; - esac - compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -4264,12 +3378,12 @@ extern \"C\" { done if test -n "$exclude_expsyms"; then - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi @@ -4287,8 +3401,8 @@ extern \"C\" { for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' + name=`echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done @@ -4297,7 +3411,7 @@ extern \"C\" { test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi @@ -4317,7 +3431,7 @@ extern \"C\" { if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" + echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ @@ -4369,18 +3483,18 @@ static const void *lt_preloaded_setup() { *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; esac esac # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" @@ -4405,7 +3519,7 @@ static const void *lt_preloaded_setup() { finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + if test $need_relink = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" @@ -4550,228 +3664,13 @@ static const void *lt_preloaded_setup() { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in - *cygwin*) - exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *cygwin*) exeext=.exe ;; *) exeext= ;; esac - case $host in - *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${output}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15 - - cat > $cwrappersource <> $cwrappersource<<"EOF" -#include -#include -#include -#include -#include -#include - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -#define HAVE_DOS_BASED_FILE_SYSTEM -#ifndef DIR_SEPARATOR_2 -#define DIR_SEPARATOR_2 '\\' -#endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup ((char *) basename (argv[0])); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" -} - -void * -xmalloc (size_t num) -{ - void * p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -; -} - -char * -basename (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return (char *) base; -} - -char * -fnqualify(const char *path) -{ - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; - - assert(path != NULL); - - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); -#endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); - - /* prepend the current directory */ - /* doesn't handle '~' */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; -} - -char * -strendzap(char *str, const char *pat) -{ - size_t len, patlen; - - assert(str != NULL); - assert(pat != NULL); - - len = strlen(str); - patlen = strlen(pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp(str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char * mode, - const char * message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC -s -o $cwrapper $cwrappersource - ;; - esac $rm $output trap "$rm $output; exit 1" 1 2 15 @@ -4789,7 +3688,7 @@ EOF # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' +Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout @@ -4849,7 +3748,7 @@ else " if test "$fast_install" = yes; then - $echo >> $output "\ + echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" @@ -4865,7 +3764,7 @@ else $rm \"\$progdir/\$file\" fi" - $echo >> $output "\ + echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then @@ -4883,13 +3782,13 @@ else $rm \"\$progdir/\$file\" fi" else - $echo >> $output "\ + echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi - $echo >> $output "\ + echo >> $output "\ if test -f \"\$progdir/\$program\"; then" @@ -4900,7 +3799,7 @@ else $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed + # The second colon is a workaround for a bug in BeOS R4 ${SED} $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var @@ -4920,6 +3819,14 @@ else # Run the actual program with our arguments. " case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ @@ -4929,7 +3836,11 @@ else *) $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} " ;; esac @@ -4941,7 +3852,7 @@ else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ @@ -4964,7 +3875,7 @@ fi\ oldobjs="$libobjs_save" build_libtool_libs=no else - oldobjs="$old_deplibs $non_pic_objects" + oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` fi addlibs="$old_convenience" fi @@ -4973,10 +3884,10 @@ fi\ gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then + if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" @@ -4993,40 +3904,14 @@ fi\ $show "${rm}r $xdir" $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then + if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` done @@ -5034,71 +3919,30 @@ fi\ # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds + eval cmds=\"$old_archive_from_new_cmds\" else - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - for obj in $save_oldobjs - do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; then - : + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= + xdir="$xdir" fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? fi - fi + done + + eval cmds=\"$old_archive_cmds\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do - eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? @@ -5130,11 +3974,9 @@ fi\ fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $0 $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi + # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do @@ -5182,31 +4024,12 @@ fi\ newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles="$newdlfiles $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles="$newdlprefiles $abs" - done - dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file @@ -5235,16 +4058,13 @@ revision=$revision # Is this an already installed library? installed=$installed -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then + if test "$installed" = no && test $need_relink = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi @@ -5380,7 +4200,7 @@ relink_command=\"$relink_command\"" # Not a directory, so check to see that there is only one file specified. set dummy $files - if test "$#" -gt 2; then + if test $# -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit 1 @@ -5420,7 +4240,7 @@ relink_command=\"$relink_command\"" *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 @@ -5456,14 +4276,11 @@ relink_command=\"$relink_command\"" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit 1 @@ -5471,9 +4288,9 @@ relink_command=\"$relink_command\"" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 @@ -5481,7 +4298,7 @@ relink_command=\"$relink_command\"" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit 1 + continue fi fi @@ -5503,7 +4320,7 @@ relink_command=\"$relink_command\"" $run eval "$striplib $destdir/$realname" || exit $? fi - if test "$#" -gt 0; then + if test $# -gt 0; then # Delete the old symlinks, and create new ones. for linkname do @@ -5516,11 +4333,10 @@ relink_command=\"$relink_command\"" # Do each command in the postinstall commands. lib="$destdir/$realname" - cmds=$postinstall_cmds + eval cmds=\"$postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -5590,43 +4406,23 @@ relink_command=\"$relink_command\"" destfile="$destdir/$destfile" fi - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + wrapper=`echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac # If there is no directory component, then add one. case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; esac # Check the variables that should have been set. @@ -5654,17 +4450,10 @@ relink_command=\"$relink_command\"" done relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac # If there is no directory component, then add one. case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; esac outputname= @@ -5672,16 +4461,17 @@ relink_command=\"$relink_command\"" if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" - if tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`; then : - else + tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` + if test $? = 0 ; then : + else tmpdir="$tmpdir/libtool-$$" - if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then : - else - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi + fi + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue fi - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` @@ -5699,14 +4489,14 @@ relink_command=\"$relink_command\"" fi else # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in - */usr/bin/install*,*cygwin*) + /usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok @@ -5715,7 +4505,7 @@ relink_command=\"$relink_command\"" destfile=$destfile.exe ;; *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; @@ -5736,17 +4526,16 @@ relink_command=\"$relink_command\"" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? - if test -n "$stripme" && test -n "$old_striplib"; then + if test -n "$stripme" && test -n "$striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. - cmds=$old_postinstall_cmds + eval cmds=\"$old_postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -5760,7 +4549,7 @@ relink_command=\"$relink_command\"" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $0 $preserve_args --finish$current_libdirs' + exec_cmd='$SHELL $0 --finish$current_libdirs' else exit 0 fi @@ -5781,11 +4570,10 @@ relink_command=\"$relink_command\"" for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. - cmds=$finish_cmds + eval cmds=\"$finish_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" @@ -5802,42 +4590,42 @@ relink_command=\"$relink_command\"" fi # Exit here if they wanted silent mode. - test "$show" = : && exit 0 + test "$show" = ":" && exit 0 - $echo "----------------------------------------------------------------------" - $echo "Libraries have been installed in:" + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" for libdir in $libdirs; do - $echo " $libdir" + echo " $libdir" done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" fi if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" - $echo " - use the \`$flag' linker flag" + echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" + echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" exit 0 ;; @@ -5865,7 +4653,7 @@ relink_command=\"$relink_command\"" case $file in *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 @@ -5936,7 +4724,7 @@ relink_command=\"$relink_command\"" -*) ;; *) # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; @@ -5959,7 +4747,7 @@ relink_command=\"$relink_command\"" eval "export $shlibpath_var" fi - # Restore saved environment variables + # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi @@ -5968,14 +4756,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\"\$cmd\"$args" + exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - eval \$echo \"\$cmd\"$args + $echo "$cmd$args" exit 0 fi ;; @@ -6009,20 +4797,19 @@ relink_command=\"$relink_command\"" rmdirs= - origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. - objdir="$origobjdir" + objdir="$objdir" else - objdir="$dir/$origobjdir" + objdir="$dir/$objdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" + test $mode = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then + if test $mode = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; @@ -6046,7 +4833,7 @@ relink_command=\"$relink_command\"" case $name in *.la) # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. @@ -6054,19 +4841,18 @@ relink_command=\"$relink_command\"" rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - if test "$mode" = uninstall; then + if test $mode = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. - cmds=$postuninstall_cmds + eval cmds=\"$postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then + if test $? != 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -6075,14 +4861,13 @@ relink_command=\"$relink_command\"" if test -n "$old_library"; then # Do each command in the old_postuninstall commands. - cmds=$old_postuninstall_cmds + eval cmds=\"$old_postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then + if test $? != 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -6094,52 +4879,22 @@ relink_command=\"$relink_command\"" ;; *.lo) - # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - - # Read the .lo file - . $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" \ - && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" \ - && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" fi ;; *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename + # Do a test to see if this is a libtool program. + if test $mode = clean && + (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" fi fi ;; @@ -6147,7 +4902,6 @@ relink_command=\"$relink_command\"" $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done - objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -6195,7 +4949,6 @@ Provide generalized library-building support services. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: @@ -6209,9 +4962,7 @@ MODE must be one of the following: uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to ." +a more detailed description of MODE." exit 0 ;; @@ -6323,9 +5074,6 @@ The following components of LINK-COMMAND are treated specially: -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries @@ -6371,31 +5119,11 @@ Otherwise, only FILE itself is deleted using RM." ;; esac -$echo +echo $echo "Try \`$modename --help' for more information about other modes." exit 0 -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - # Local Variables: # mode:shell-script # sh-indentation:2 diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 6865f0b6..50e13ee5 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -13,7 +13,8 @@ LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone -EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove ntfsrm +EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove \ + ntfsrm ntfscp man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ @@ -89,6 +90,10 @@ ntfsdump_logfile_SOURCES= ntfsdump_logfile.c ntfsdump_logfile_LDADD = $(AM_LIBS) ntfsdump_logfile_LDFLAGS= $(AM_LFLAGS) +ntfscp_SOURCES = ntfscp.c utils.c utils.h +ntfscp_LDADD = $(AM_LIBS) +ntfscp_LDFLAGS = $(AM_LFLAGS) + # Extra targets strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 49a5c6f5..36d04951 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.9 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -14,7 +14,7 @@ @SET_MAKE@ -SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) +SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -42,7 +42,8 @@ bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) ntfswipe$(EXEEXT) \ - ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) ntfsrm$(EXEEXT) + ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) ntfsrm$(EXEEXT) \ + ntfscp$(EXEEXT) subdir = ntfsprogs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/mkntfs.8.in $(srcdir)/ntfscat.8.in \ @@ -60,7 +61,8 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 \ ntfsresize.8 ntfsundelete.8 -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \ + "$(DESTDIR)$(man8dir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) @@ -82,6 +84,9 @@ am_ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) cluster.$(OBJEXT) \ utils.$(OBJEXT) ntfscluster_OBJECTS = $(am_ntfscluster_OBJECTS) ntfscluster_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfscp_OBJECTS = ntfscp.$(OBJEXT) utils.$(OBJEXT) +ntfscp_OBJECTS = $(am_ntfscp_OBJECTS) +ntfscp_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) ntfsdump_logfile_OBJECTS = $(am_ntfsdump_logfile_OBJECTS) ntfsdump_logfile_DEPENDENCIES = $(am__DEPENDENCIES_1) @@ -119,18 +124,6 @@ ntfswipe_DEPENDENCIES = $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrdef.Po ./$(DEPDIR)/boot.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/cluster.Po ./$(DEPDIR)/mkntfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfscat.Po ./$(DEPDIR)/ntfsclone.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfscluster.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsdump_logfile.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsfix.Po ./$(DEPDIR)/ntfsinfo.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfslabel.Po ./$(DEPDIR)/ntfsls.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsmove.Po ./$(DEPDIR)/ntfsresize.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsrm.Po ./$(DEPDIR)/ntfstruncate.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsundelete.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfswipe.Po ./$(DEPDIR)/sd.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/upcase.Po ./$(DEPDIR)/utils.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ @@ -138,13 +131,14 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) \ - $(ntfscluster_SOURCES) $(ntfsdump_logfile_SOURCES) \ - $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) \ - $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) \ - $(ntfsrm_SOURCES) $(ntfstruncate_SOURCES) \ - $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) + $(ntfscluster_SOURCES) $(ntfscp_SOURCES) \ + $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ + $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ + $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ + $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ + $(ntfswipe_SOURCES) DIST_SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ - $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) \ + $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) \ $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ @@ -160,7 +154,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -171,10 +164,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -186,8 +175,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -217,21 +204,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -330,6 +314,9 @@ ntfswipe_LDFLAGS = $(AM_LFLAGS) ntfsdump_logfile_SOURCES = ntfsdump_logfile.c ntfsdump_logfile_LDADD = $(AM_LIBS) ntfsdump_logfile_LDFLAGS = $(AM_LFLAGS) +ntfscp_SOURCES = ntfscp.c utils.c utils.h +ntfscp_LDADD = $(AM_LIBS) +ntfscp_LDFLAGS = $(AM_LFLAGS) all: all-am .SUFFIXES: @@ -453,6 +440,9 @@ ntfsclone$(EXEEXT): $(ntfsclone_OBJECTS) $(ntfsclone_DEPENDENCIES) ntfscluster$(EXEEXT): $(ntfscluster_OBJECTS) $(ntfscluster_DEPENDENCIES) @rm -f ntfscluster$(EXEEXT) $(LINK) $(ntfscluster_LDFLAGS) $(ntfscluster_OBJECTS) $(ntfscluster_LDADD) $(LIBS) +ntfscp$(EXEEXT): $(ntfscp_OBJECTS) $(ntfscp_DEPENDENCIES) + @rm -f ntfscp$(EXEEXT) + $(LINK) $(ntfscp_LDFLAGS) $(ntfscp_OBJECTS) $(ntfscp_LDADD) $(LIBS) ntfsdump_logfile$(EXEEXT): $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_DEPENDENCIES) @rm -f ntfsdump_logfile$(EXEEXT) $(LINK) $(ntfsdump_logfile_LDFLAGS) $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_LDADD) $(LIBS) @@ -500,6 +490,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsclone.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscluster.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsdump_logfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsfix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsinfo.Po@am__quote@ @@ -519,24 +510,21 @@ distclean-compile: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: @@ -614,9 +602,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -694,7 +684,7 @@ clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" From 931b78f491b6345f754b765f0330a854c3eff86d Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 2 Aug 2004 12:05:21 +0000 Subject: [PATCH 1621/2994] add ntfscp to build BKrev: 410e2e01FrtLB9jtLEOrAbifdUbXzw From 910855a174cfcb7cb123d482bfdb96fd97019a8d Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 2 Aug 2004 16:56:34 +0000 Subject: [PATCH 1622/2994] * bugfix for ntfs_cluster_alloc when @count = 0. * add ntfs_clster_free_from_rl and make ntfs_cluster_alloc use it (Logical change 1.468) --- libntfs/lcnalloc.c | 55 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index a6c8501f..f2911020 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -2,6 +2,7 @@ * lcnalloc.c - Cluster (de)allocation code. Part of the Linux-NTFS project. * * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2004 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -39,6 +40,7 @@ * @count: number of clusters to allocate * @start_lcn: starting lcn at which to allocate the clusters (or -1 if none) * @zone: zone from which to allocate the clusters + * @start_vcn: * * Allocate @count clusters preferably starting at cluster @start_lcn or at the * current allocator position if @start_lcn is -1, on the mounted ntfs volume @@ -109,6 +111,24 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, errno = EINVAL; return NULL; } + + /* Return empty runlist if @count == 0 */ + if (!count) { + rl = malloc (0x1000); + if (!rl) + return NULL; + rlpos = 0; + if (start_vcn) { + rl[0].vcn = 0; + rl[0].lcn = LCN_RL_NOT_MAPPED; + rl[0].length = start_vcn; + rlpos++; + } + rl[rlpos].vcn = start_vcn; + rl[rlpos].lcn = LCN_ENOENT; + rl[rlpos].length = 0; + return rl; + } /* Allocate memory. */ buf = (u8*)malloc(8192); @@ -754,16 +774,10 @@ err_ret: (long long)rl[0].lcn, (long long)count - clusters); } -//FIXME: We don't have an attribute just a run list here! Also rl is not -// terminated at this moment in time! (AIA) -#if 0 /* Deallocate all allocated clusters. */ Dprintf("%s(): Deallocating allocated clusters.\n", __FUNCTION__); - ntfs_cluster_free(vol, attrib_with_rl, 0, -1); -#endif - fprintf(stderr, "%s(): Eeek! Leaving inconsistent metadata.\n", - __FUNCTION__); + ntfs_cluster_free_from_rl (vol, rl); /* Free the runlist. */ free(rl); rl = NULL; @@ -779,6 +793,33 @@ err_ret: goto done_err_ret; } +/** + * ntfs_cluster_free_from_rl - free clusters from runlist + * @vol: mounted ntfs volume on which to free the clusters + * @rl: runlist from which deallocate clusters + * + * On success return 0 and on error return -1 with errno set to the error code. + */ +int ntfs_cluster_free_from_rl(ntfs_volume *vol, runlist *rl) +{ + while (rl->length) { + if (rl->lcn < 0) { + rl++; + continue; + } + if (ntfs_bitmap_clear_run(vol->lcnbmp_na, + rl->lcn, rl->length)) { + int eo = errno; + fprintf(stderr, "%s(): Eeek! Deallocation of " + "clusters failed.\n", __FUNCTION__); + errno = eo; + return -1; + } + rl++; + } + return 0; +} + /** * ntfs_cluster_free - free clusters on an ntfs volume * @vol: mounted ntfs volume on which to free the clusters From 3abf4879084a4237339dd270c0a117d424b762af Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 2 Aug 2004 16:56:34 +0000 Subject: [PATCH 1623/2994] add ntfs_clster_free_from_rl prototype (Logical change 1.468) --- include/ntfs/lcnalloc.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/ntfs/lcnalloc.h b/include/ntfs/lcnalloc.h index b0dded9a..ae3e1dfb 100644 --- a/include/ntfs/lcnalloc.h +++ b/include/ntfs/lcnalloc.h @@ -3,6 +3,7 @@ * project. * * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2004 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -37,6 +38,8 @@ typedef enum { extern runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, const NTFS_CLUSTER_ALLOCATION_ZONES zone, VCN start_vcn); +extern int ntfs_cluster_free_from_rl(ntfs_volume *vol, runlist *rl); + extern int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count); From bf6f920115dc1ad42aa15c3f2c9b4116be35a7cd Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 2 Aug 2004 16:56:34 +0000 Subject: [PATCH 1624/2994] libntfs/attrib.c * various updates and fixes libntfs/lcnalloc.c * bugfix for ntfs_cluster_alloc when @count = 0. * add ntfs_clster_free_from_rl and make ntfs_cluster_alloc use it BKrev: 410e7242eGKUorRYb_6nagFZRimo9A From ad91c15528c8ad38837e095a9f269a2690394d53 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 2 Aug 2004 16:56:34 +0000 Subject: [PATCH 1625/2994] various updates and fixes (Logical change 1.468) --- libntfs/attrib.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 7df7a3e2..8f656a96 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2605,13 +2605,17 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) /* Make the attribute non-resident if possible. */ if (!ntfs_attr_make_non_resident(na, ctx)) { - // TODO: Attribute is now non-resident. Resize it! - // goto resize_done; - fprintf(stderr, "%s(): TODO: Resize attribute now that " - "it is non-resident.\n", __FUNCTION__); - ntfs_inode_mark_dirty(ctx->ntfs_ino); - err = ENOTSUP; - goto put_err_out; + /* Resize non-resident attribute */ + if (ntfs_attr_truncate (na, newsize)) { + /* + * Resize failed, but mark inode dirty because we made + * it non-resident. + */ + err = errno; + ntfs_inode_mark_dirty(ctx->ntfs_ino); + goto put_err_out; + } + goto resize_done; } else if (errno != ENOSPC && errno != EPERM) { err = errno; // FIXME: Eeek! @@ -2734,7 +2738,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) } /* Read and cache the whole runlist if not already done. */ - if (ntfs_attr_map_whole_runlist(na)) + if (!na->rl && ntfs_attr_map_whole_runlist(na)) return -1; /* Move the attribute name if it exists and update the offset. */ @@ -3172,15 +3176,15 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) first_free_vcn = (newsize + vol->cluster_size - 1) >> vol->cluster_size_bits; /* - * Compare the new allocation with the old one and only deallocate + * Compare the new allocation with the old one and only allocate * clusters if there is a change. */ if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { nr_need_allocate = first_free_vcn - (na->allocated_size >> vol->cluster_size_bits); - if (ntfs_attr_map_whole_runlist (na)) { - err = EIO; + if (!na->rl && ntfs_attr_map_runlist (na, 0)) { + err = errno; fprintf(stderr, "%s(): Eeek! " "ntfs_attr_map_whole_runlist failed.\n", __FUNCTION__); @@ -3214,17 +3218,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) err = errno; fprintf(stderr, "%s(): Eeek! Run list merge " "failed.\n", __FUNCTION__); - rln = rl; - if (rln->lcn == LCN_RL_NOT_MAPPED) rln++; - while (rln->length) { - if (ntfs_bitmap_clear_run(vol->lcnbmp_na, - rln->lcn, rln->length)) - fprintf(stderr, "%s(): Eeek! " - "Deallocation of just " - "allocated clusters " - "failed.\n", __FUNCTION__); - rln++; - } + ntfs_cluster_free_from_rl (vol, rl); free (rl); goto put_err_out; } From d2743d421661461ebf55ee0524f169a92a2820ec Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 2 Aug 2004 17:09:20 +0000 Subject: [PATCH 1626/2994] update (Logical change 1.469) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1621046d..2277998b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,9 @@ xx/xx/2004 - 1.9.3-WIP - Add a @start_vcn parameter to lcnalloc.[ch]::ntfs_cluster_alloc (Yura) - Add ntfscp utility, at present it can only overwrite files. It can increment or decrease file size if $ATTRIBUTE_LIST not present (Yura) + - Added new API lcnalloc.[ch]::ntfs_cluster_free_from_rl, and made + ntfs_cluster_alloc use it (Yura) + - Bugfix in ntfs_cluster_alloc for count = 0 (Yura) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From 32f14d38a720f6c2cf32ca4b6de8488115339364 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 2 Aug 2004 17:09:20 +0000 Subject: [PATCH 1627/2994] update ChangeLog BKrev: 410e7540KrFfaWTKb9yoAL0NBusB3A From 73c333a6813ed1e17e2cb2f28151995fd36e4298 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 3 Aug 2004 17:53:48 +0000 Subject: [PATCH 1628/2994] bugfix in ntfs_attr_map{_whole_,_}runlist: make it not fail if runlist already mapped (Logical change 1.470) --- libntfs/attrib.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 8f656a96..2826dd95 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -419,6 +419,10 @@ int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn) Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, vcn 0x%llx.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type, (long long)vcn); + + LCN lcn = ntfs_rl_vcn_to_lcn(na->rl, vcn); + if (lcn >= 0 || lcn == LCN_HOLE || lcn == LCN_ENOENT) + return 0; ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) @@ -475,17 +479,27 @@ int ntfs_attr_map_whole_runlist(ntfs_attr *na) /* Map all attribute extents one by one. */ next_vcn = last_vcn = highest_vcn = 0; a = NULL; - while (!ntfs_attr_lookup(na->type, na->name, na->name_len, - CASE_SENSITIVE, next_vcn, NULL, 0, ctx)) { + while (1) { runlist_element *rl; + + int not_mapped = 0; + if (ntfs_rl_vcn_to_lcn(na->rl, next_vcn) == LCN_RL_NOT_MAPPED) + not_mapped = 1; + + if (ntfs_attr_lookup(na->type, na->name, na->name_len, + CASE_SENSITIVE, next_vcn, NULL, 0, ctx)) + break; a = ctx->attr; - /* Decode the runlist. */ - rl = ntfs_mapping_pairs_decompress(na->ni->vol, a, na->rl); - if (!rl) - goto err_out; - na->rl = rl; + if (not_mapped) { + /* Decode the runlist. */ + rl = ntfs_mapping_pairs_decompress(na->ni->vol, + a, na->rl); + if (!rl) + goto err_out; + na->rl = rl; + } /* Are we in the first extent? */ if (!next_vcn) { @@ -2738,7 +2752,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) } /* Read and cache the whole runlist if not already done. */ - if (!na->rl && ntfs_attr_map_whole_runlist(na)) + if (ntfs_attr_map_whole_runlist(na)) return -1; /* Move the attribute name if it exists and update the offset. */ @@ -3183,7 +3197,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) nr_need_allocate = first_free_vcn - (na->allocated_size >> vol->cluster_size_bits); - if (!na->rl && ntfs_attr_map_runlist (na, 0)) { + if (ntfs_attr_map_runlist (na, 0)) { err = errno; fprintf(stderr, "%s(): Eeek! " "ntfs_attr_map_whole_runlist failed.\n", From b996e483e333480f38ec7699afbc176dfce29963 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 3 Aug 2004 17:53:48 +0000 Subject: [PATCH 1629/2994] libntfs/attrib.c bugfix in ntfs_attr_map{_whole_,_}runlist: make it not fail if runlist already mapped libntfs/lcnalloc.c make ntfs_cluster_free not fail if ntfs_attr_find_vcn returned ENOENT BKrev: 410fd12cx3EaAt8BOE-J5zqvaGExBA From 0c92486d08cc15820aba10bd4f5ae0675380c634 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 3 Aug 2004 17:53:48 +0000 Subject: [PATCH 1630/2994] make ntfs_cluster_free not fail if ntfs_attr_find_vcn returned ENOENT (Logical change 1.470) --- libntfs/lcnalloc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index f2911020..1027f842 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -849,8 +849,12 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) } rl = ntfs_attr_find_vcn(na, start_vcn); - if (!rl) - return -1; + if (!rl) { + if (errno == ENOENT) + return 0; + else + return -1; + } if (rl->lcn < 0 && rl->lcn != LCN_HOLE) { errno = EIO; From ba508305e327d96d5c2c537b71c77eedd7202b23 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 3 Aug 2004 17:53:48 +0000 Subject: [PATCH 1631/2994] update (Logical change 1.470) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2277998b..308bb720 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,6 +45,8 @@ xx/xx/2004 - 1.9.3-WIP - Added new API lcnalloc.[ch]::ntfs_cluster_free_from_rl, and made ntfs_cluster_alloc use it (Yura) - Bugfix in ntfs_cluster_alloc for count = 0 (Yura) + - Bugfix in ntfs_attr_map{_whole_,_}runlist: make it not fail if runlist + already mapped (Yura) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From bb8ee06cadd7e339d9e0cf963a14df16d38361c7 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 4 Aug 2004 09:47:41 +0000 Subject: [PATCH 1632/2994] small updates (Logical change 1.471) --- libntfs/attrib.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 2826dd95..9fa5d6da 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3167,6 +3167,23 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) } a = ctx->attr; m = ctx->mrec; + + /* + * Check that the attribute name hasn't been placed after the mapping + * pairs array. If it has we need to move it. + * TODO: Implement the move, if someone will hit it. + */ + if (a->name_length) { + if (le16_to_cpu(a->name_offset) >= + le16_to_cpu(a->mapping_pairs_offset)) { + fprintf(stderr, "%s(): Eeek! Name is placed after the " + "mapping pairs array. Aborting...\n", + __FUNCTION__); + err = ENOTSUP; + goto put_err_out; + } + } + /* * Check the attribute type and the corresponding maximum size * against @newsize and fail if @newsize is too big. @@ -3274,9 +3291,12 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) le32_to_cpu(a->length) + new_alen; if (new_muse > le32_to_cpu(m->bytes_allocated)) { fprintf(stderr, "%s(): BUG! Ran out of space in" - " mft record. Please report to " - "linux-ntfs-dev@lists.sf.net\n", - __FUNCTION__); + " mft record. Please run chkdsk" + " and if that doesn't find any " + "errors please report you saw " + "this message to " + "linux-ntfs-dev@lists.sf.net." + "\n", __FUNCTION__); ntfs_cluster_free (vol, na, na->allocated_size >> vol->cluster_size_bits, -1); err = EIO; From 37350877c5331f671bedcf76159fb6431f6fcf19 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 4 Aug 2004 09:47:41 +0000 Subject: [PATCH 1633/2994] small updates to attrib.c BKrev: 4110b0bdCrpjAxyOBsm5mfUABJqv9w From c1427ce9c9fc82981433caa87fc482ce861e62d1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 4 Aug 2004 19:17:50 +0000 Subject: [PATCH 1634/2994] Move variable declaration to top of statement block. (Logical change 1.472) --- libntfs/attrib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 9fa5d6da..cb48ff0b 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -413,6 +413,7 @@ void ntfs_attr_close(ntfs_attr *na) */ int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn) { + LCN lcn; ntfs_attr_search_ctx *ctx; int err; @@ -420,7 +421,7 @@ int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn) __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type, (long long)vcn); - LCN lcn = ntfs_rl_vcn_to_lcn(na->rl, vcn); + lcn = ntfs_rl_vcn_to_lcn(na->rl, vcn); if (lcn >= 0 || lcn == LCN_HOLE || lcn == LCN_ENOENT) return 0; From 561e2958cb6d3dedcea70df741ebec5dd7933a5d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 4 Aug 2004 19:17:50 +0000 Subject: [PATCH 1635/2994] attrib.c: Move variable declaration to top of statement block. BKrev: 4111365eg2C5VznWtbJqwbo6SlDmTA From bde8048cac44cb9afa2fff5ee61f29db4a9280ea Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 4 Aug 2004 20:35:58 +0000 Subject: [PATCH 1636/2994] Fix error code paths in ntfs_non_resident_attr_expand() and also fix starting lcn determination and set it to -1 if there are no valid lcns in the attribute, i.e. let the allocator choose in this case. (Logical change 1.473) --- libntfs/attrib.c | 152 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 126 insertions(+), 26 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index cb48ff0b..b22d9643 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3139,16 +3139,16 @@ put_err_out: */ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) { + LCN lcn_seek_from; + VCN first_free_vcn; + s64 nr_need_allocate; ntfs_volume *vol; ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; MFT_RECORD *m; - VCN first_free_vcn; - s64 nr_need_allocate; + runlist *rl, *rln; u32 new_alen, new_muse; int err, mp_size, cur_max_mp_size, exp_max_mp_size; - runlist *rl, *rln; - LCN lcn_seek_from = 0; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type); @@ -3224,13 +3224,25 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) } /* - * Determine first after last LCN of attribute. We will start - * seek clusters from this LCN to avoid fragmentation. + * Determine first after last LCN of attribute. We will start + * seek clusters from this LCN to avoid fragmentation. If + * there are no valid LCNs in the attribute let the cluster + * allocator choose the starting LCN. */ + lcn_seek_from = -1; if (na->rl->length) { + /* Seek to the last run list element. */ for (rl = na->rl; (rl + 1)->length; rl++) ; - lcn_seek_from = rl->lcn + rl->length; + /* + * If the last LCN is a hole or simillar seek back to + * last valid LCN. + */ + while (rl->lcn < 0 && rl != na->rl) + rl--; + /* Only set lcn_seek_from it the LCN is valid. */ + if (rl->lcn >= 0) + lcn_seek_from = rl->lcn + rl->length; } rl = ntfs_cluster_alloc(vol, nr_need_allocate, lcn_seek_from, @@ -3258,6 +3270,32 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) /* Get the size for the new mapping pairs array. */ mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); + if (mp_size <= 0) { + err = errno; + fprintf(stderr, "%s(): Eeek! Get size for mapping " + "pairs failed.\n", __FUNCTION__); + if (ntfs_cluster_free(vol, na, na->allocated_size >> + vol->cluster_size_bits, -1) < 0) { + // FIXME: Eeek! Leaving inconsistent metadata! + // (AIA) + fprintf(stderr, "%s(): Eeek! Leaking " + "clusters. Run chkdsk!\n", + __FUNCTION__); + err = EIO; + } + /* Now, truncate the runlist itself. */ + if (ntfs_rl_truncate(&na->rl, na->allocated_size >> + vol->cluster_size_bits)) { + /* + * Failed to truncate the runlist, so just + * throw it away, it will be mapped afresh on + * next use. + */ + free(na->rl); + na->rl = NULL; + } + goto put_err_out; + } /* * Determine maximum possible length of mapping pairs, * if we shall *not* expand space for mapping pairs @@ -3275,12 +3313,30 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) err = ENOTSUP; fprintf(stderr, "%s(): Eeek! Maping pairs size is" " too big.\n", __FUNCTION__); - ntfs_cluster_free (vol, na, na->allocated_size >> - vol->cluster_size_bits, -1); + if (ntfs_cluster_free(vol, na, na->allocated_size >> + vol->cluster_size_bits, -1) < 0) { + // FIXME: Eeek! Leaving inconsistent metadata! + // (AIA) + fprintf(stderr, "%s(): Eeek! Leaking " + "clusters. Run chkdsk!\n", + __FUNCTION__); + err = EIO; + } + /* Now, truncate the runlist itself. */ + if (ntfs_rl_truncate(&na->rl, na->allocated_size >> + vol->cluster_size_bits)) { + /* + * Failed to truncate the runlist, so just + * throw it away, it will be mapped afresh on + * next use. + */ + free(na->rl); + na->rl = NULL; + } goto put_err_out; } - /* Expand space for mapping pairs if we need this*/ + /* Expand space for mapping pairs if we need this. */ if (mp_size > cur_max_mp_size) { /* * Calculate the new attribute length and mft record @@ -3298,12 +3354,33 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) "this message to " "linux-ntfs-dev@lists.sf.net." "\n", __FUNCTION__); - ntfs_cluster_free (vol, na, na->allocated_size - >> vol->cluster_size_bits, -1); + if (ntfs_cluster_free(vol, na, + na->allocated_size >> + vol->cluster_size_bits, -1) < + 0) { + // FIXME: Eeek! Leaving inconsistent + // metadata! (AIA) + fprintf(stderr, "%s(): Eeek! Leaking " + "clusters. Run " + "chkdsk!\n", + __FUNCTION__); + } + /* Now, truncate the runlist itself. */ + if (ntfs_rl_truncate(&na->rl, + na->allocated_size >> + vol->cluster_size_bits)) { + /* + * Failed to truncate the runlist, so + * just throw it away, it will be + * mapped afresh on next use. + */ + free(na->rl); + na->rl = NULL; + } err = EIO; goto put_err_out; } - /* Move the following attributes forward. */ + /* Move the following attributes making space. */ memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu( a->length), le32_to_cpu(m->bytes_in_use) - ((u8*)a - (u8*)m) - le32_to_cpu( @@ -3312,15 +3389,6 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) a->length = cpu_to_le32(new_alen); m->bytes_in_use = cpu_to_le32(new_muse); } - - if (mp_size <= 0) { - err = errno; - fprintf(stderr, "%s(): Eeek! Get size for mapping " - "pairs failed.\n", __FUNCTION__); - ntfs_cluster_free (vol, na, na->allocated_size >> - vol->cluster_size_bits, -1); - goto put_err_out; - } /* * Generate the new mapping pairs array directly into the * correct destination, i.e. the attribute record itself. @@ -3328,10 +3396,42 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( a->mapping_pairs_offset), mp_size, na->rl)) { err = errno; - fprintf(stderr, "%s(): Eeek! Mapping pairs build " - "failed.\n", __FUNCTION__); - ntfs_cluster_free (vol, na, na->allocated_size >> - vol->cluster_size_bits, -1); + fprintf(stderr, "%s(): BUG! Mapping pairs build " + "failed. Please run chkdsk and if " + "that doesn't find any errors please " + "report you saw this message to " + "linux-ntfs-dev@lists.sf.net.\n", + __FUNCTION__); + if (ntfs_cluster_free(vol, na, na->allocated_size >> + vol->cluster_size_bits, -1) < 0) { + // FIXME: Eeek! Leaving inconsistent metadata! + // (AIA) + fprintf(stderr, "%s(): Eeek! Leaking " + "clusters. Run chkdsk!\n", + __FUNCTION__); + err = EIO; + } + /* Now, truncate the runlist itself. */ + if (ntfs_rl_truncate(&na->rl, na->allocated_size >> + vol->cluster_size_bits)) { + /* + * Failed to truncate the runlist, so just + * throw it away, it will be mapped afresh on + * next use. + */ + free(na->rl); + na->rl = NULL; + } + // FIXME: Recovery is not complete yet here! Because + // the attributes have been moved and the attribute and + // mft records have been updated. We really should + // throw away the whole mft record and reload it from + // disk. But this might loose other changes... Might + // still be preferable to writing out a corrupt + // attribute... Or even better, we should save the old + // values and restore them here as well as moving the + // following attributes back to their old location. + // (AIA) goto put_err_out; } From 0be5a0a185058094ad75c677bce7be7612cfa0a3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 4 Aug 2004 20:35:58 +0000 Subject: [PATCH 1637/2994] attrib.c: Fix error code paths in ntfs_non_resident_attr_expand() and also fix starting lcn determination and set it to -1 if there are no valid lcns in the attribute, i.e. let the allocator choose in this case. BKrev: 411148aeLaS0UHZJlYx3McVAMakLSA From b2b13a1856a9d02fd491ec0a1b2cbe7a0cd0f82a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 5 Aug 2004 09:32:27 +0000 Subject: [PATCH 1638/2994] attrib.c::ntfs_non_resident_attr_expand added code to restore mft record, if we failed build mapping pairs (Logical change 1.474) --- libntfs/attrib.c | 58 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index b22d9643..104df2da 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3139,6 +3139,8 @@ put_err_out: */ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) { + u8 *mft_rec_copy = NULL; + u32 mft_rec_copy_size; LCN lcn_seek_from; VCN first_free_vcn; s64 nr_need_allocate; @@ -3214,7 +3216,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { nr_need_allocate = first_free_vcn - (na->allocated_size >> vol->cluster_size_bits); - + if (ntfs_attr_map_runlist (na, 0)) { err = errno; fprintf(stderr, "%s(): Eeek! " @@ -3222,7 +3224,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) __FUNCTION__); goto put_err_out; } - + /* * Determine first after last LCN of attribute. We will start * seek clusters from this LCN to avoid fragmentation. If @@ -3244,7 +3246,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (rl->lcn >= 0) lcn_seek_from = rl->lcn + rl->length; } - + rl = ntfs_cluster_alloc(vol, nr_need_allocate, lcn_seek_from, DATA_ZONE, na->allocated_size >> vol->cluster_size_bits); @@ -3267,7 +3269,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto put_err_out; } na->rl = rln; - + /* Get the size for the new mapping pairs array. */ mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); if (mp_size <= 0) { @@ -3336,6 +3338,38 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto put_err_out; } + /* Backup mft record. We need this for rollback. */ + mft_rec_copy_size = le32_to_cpu(m->bytes_in_use); + mft_rec_copy = malloc(mft_rec_copy_size); + if (!mft_rec_copy) { + err = ENOMEM; + fprintf(stderr, "%s(): Eeek! Not enough memory to " + "allocate %d bytes.\n", __FUNCTION__, + le32_to_cpu(m->bytes_in_use)); + if (ntfs_cluster_free(vol, na, na->allocated_size >> + vol->cluster_size_bits, -1) < 0) { + // FIXME: Eeek! Leaving inconsistent metadata! + // (AIA) + fprintf(stderr, "%s(): Eeek! Leaking " + "clusters. Run chkdsk!\n", + __FUNCTION__); + err = EIO; + } + /* Now, truncate the runlist itself. */ + if (ntfs_rl_truncate(&na->rl, na->allocated_size >> + vol->cluster_size_bits)) { + /* + * Failed to truncate the runlist, so just + * throw it away, it will be mapped afresh on + * next use. + */ + free(na->rl); + na->rl = NULL; + } + goto put_err_out; + } + memcpy(mft_rec_copy, m, mft_rec_copy_size); + /* Expand space for mapping pairs if we need this. */ if (mp_size > cur_max_mp_size) { /* @@ -3422,16 +3456,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) free(na->rl); na->rl = NULL; } - // FIXME: Recovery is not complete yet here! Because - // the attributes have been moved and the attribute and - // mft records have been updated. We really should - // throw away the whole mft record and reload it from - // disk. But this might loose other changes... Might - // still be preferable to writing out a corrupt - // attribute... Or even better, we should save the old - // values and restore them here as well as moving the - // following attributes back to their old location. - // (AIA) + /* Restote mft record. */ + memcpy(m, mft_rec_copy, mft_rec_copy_size); goto put_err_out; } @@ -3447,9 +3473,13 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) /* Set the inode dirty so it is written out later. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); /* Done! */ + if (mft_rec_copy) + free(mft_rec_copy); ntfs_attr_put_search_ctx(ctx); return 0; put_err_out: + if (mft_rec_copy) + free(mft_rec_copy); ntfs_attr_put_search_ctx(ctx); errno = err; return -1; From ff09004d56a3fb193e7bec08fb2669e93c712ed4 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 5 Aug 2004 09:32:27 +0000 Subject: [PATCH 1639/2994] attrib.c::ntfs_non_resident_attr_expand added code to restore mft record, if we failed build mapping pairs BKrev: 4111feabADwC3Ey0jZPA9USuK-MtJA From 5ece0477c82a7fb87ceaebc170943bb3c9e73596 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 5 Aug 2004 10:15:54 +0000 Subject: [PATCH 1640/2994] Fix a bug in the cluster allocator. Also several debug output bugs. (Logical change 1.475) --- libntfs/lcnalloc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 1027f842..860dee2a 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -255,10 +255,11 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, "*byte = 0x%x.\n", __FUNCTION__, buf_size, (long long)lcn, (long long)bmp_pos, need_writeback, - lcn >> 3, *byte); + (unsigned int)(lcn >> 3), + (unsigned int)*byte); /* Skip full bytes. */ if (*byte == 0xff) { - lcn += 8; + lcn = (lcn + 8) & ~7; Dprintf("%s(): continuing while loop 1.\n", __FUNCTION__); continue; @@ -277,7 +278,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, /* We need to write this bitmap buffer back to disk! */ need_writeback = 1; Dprintf("%s(): *byte = 0x%x, need_writeback is set.\n", - __FUNCTION__, *byte); + __FUNCTION__, (unsigned int)*byte); /* Reallocate memory if necessary. */ if ((rlpos + 2) * (int)sizeof(runlist) >= rlsize) { Dprintf("%s(): Reallocating space.\n", From 7187d79b3efd931d8155f886c01c310f9f12bcf8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 5 Aug 2004 10:15:54 +0000 Subject: [PATCH 1641/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into cantab.net:/home/src/ntfsprogs 2004/08/05 11:15:42+01:00 cantab.net!aia21 lcnalloc.c: Fix a bug in the cluster allocator. Also several debug output bugs. BKrev: 411208davNaKQTr7rT7HL93wATj-hQ From fc76c7e845aa51d45e31fd8ff4b02cf997cded11 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 5 Aug 2004 13:20:11 +0000 Subject: [PATCH 1642/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into chaos.(none):/home/yura/NTFS/ntfsprogs 2004/08/05 15:57:36+03:00 (none)!yura fixing bugs in ntfs_non_resident_attr_{shrink,expand} that caused not updating highest_vcn, if it was equal to 0 BKrev: 4112340bqNZehO9Yo83sZ21MLGmlug From d99c39d9805c7606b2c72e71f11291ce75766e54 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 5 Aug 2004 13:20:11 +0000 Subject: [PATCH 1643/2994] fixing bugs in ntfs_non_resident_attr_{shrink,expand} that caused not updating highest_vcn, if it was equal to 0 (Logical change 1.476) --- libntfs/attrib.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 104df2da..a3e4a7d3 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3018,8 +3018,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) * Reminder: It is ok for a->highest_vcn to be -1 for zero * length files. */ - if (a->highest_vcn) - a->highest_vcn = scpu_to_le64(first_free_vcn - 1); + a->highest_vcn = scpu_to_le64(first_free_vcn - 1); /* Get the size for the new mapping pairs array. */ mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); if (mp_size <= 0) { @@ -3112,6 +3111,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) __FUNCTION__); } } + /* Set the inode dirty so it is written out later. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); /* Done! */ @@ -3464,8 +3464,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) /* Update the attribute record and the ntfs_attr structure. */ na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = scpu_to_le64(na->allocated_size); - if (a->highest_vcn) - a->highest_vcn = scpu_to_le64(first_free_vcn - 1); + a->highest_vcn = scpu_to_le64(first_free_vcn - 1); } /* Update the attribute record and the ntfs attribute structure. */ na->data_size = newsize; From 9be1951a318ac77163018c018b9f01f80797238d Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 5 Aug 2004 18:41:19 +0000 Subject: [PATCH 1644/2994] Restructure of error handling in ntfs_non_resident_attr_expand Comments update (Logical change 1.477) --- libntfs/attrib.c | 149 ++++++++++++----------------------------------- 1 file changed, 37 insertions(+), 112 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index a3e4a7d3..f303d987 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3017,6 +3017,9 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) /* * Reminder: It is ok for a->highest_vcn to be -1 for zero * length files. + * FIXME: We may not update a->highest_vcn if it equal to 0. + * But bug in runlist mapping code prevent us from doing so. + * Find and remove this bug. */ a->highest_vcn = scpu_to_le64(first_free_vcn - 1); /* Get the size for the new mapping pairs array. */ @@ -3139,8 +3142,9 @@ put_err_out: */ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) { + int mft_changed = 0; u8 *mft_rec_copy = NULL; - u32 mft_rec_copy_size; + u32 mft_rec_copy_size = 0; LCN lcn_seek_from; VCN first_free_vcn; s64 nr_need_allocate; @@ -3276,27 +3280,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) err = errno; fprintf(stderr, "%s(): Eeek! Get size for mapping " "pairs failed.\n", __FUNCTION__); - if (ntfs_cluster_free(vol, na, na->allocated_size >> - vol->cluster_size_bits, -1) < 0) { - // FIXME: Eeek! Leaving inconsistent metadata! - // (AIA) - fprintf(stderr, "%s(): Eeek! Leaking " - "clusters. Run chkdsk!\n", - __FUNCTION__); - err = EIO; - } - /* Now, truncate the runlist itself. */ - if (ntfs_rl_truncate(&na->rl, na->allocated_size >> - vol->cluster_size_bits)) { - /* - * Failed to truncate the runlist, so just - * throw it away, it will be mapped afresh on - * next use. - */ - free(na->rl); - na->rl = NULL; - } - goto put_err_out; + goto rollback; } /* * Determine maximum possible length of mapping pairs, @@ -3315,27 +3299,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) err = ENOTSUP; fprintf(stderr, "%s(): Eeek! Maping pairs size is" " too big.\n", __FUNCTION__); - if (ntfs_cluster_free(vol, na, na->allocated_size >> - vol->cluster_size_bits, -1) < 0) { - // FIXME: Eeek! Leaving inconsistent metadata! - // (AIA) - fprintf(stderr, "%s(): Eeek! Leaking " - "clusters. Run chkdsk!\n", - __FUNCTION__); - err = EIO; - } - /* Now, truncate the runlist itself. */ - if (ntfs_rl_truncate(&na->rl, na->allocated_size >> - vol->cluster_size_bits)) { - /* - * Failed to truncate the runlist, so just - * throw it away, it will be mapped afresh on - * next use. - */ - free(na->rl); - na->rl = NULL; - } - goto put_err_out; + goto rollback; } /* Backup mft record. We need this for rollback. */ @@ -3346,27 +3310,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) fprintf(stderr, "%s(): Eeek! Not enough memory to " "allocate %d bytes.\n", __FUNCTION__, le32_to_cpu(m->bytes_in_use)); - if (ntfs_cluster_free(vol, na, na->allocated_size >> - vol->cluster_size_bits, -1) < 0) { - // FIXME: Eeek! Leaving inconsistent metadata! - // (AIA) - fprintf(stderr, "%s(): Eeek! Leaking " - "clusters. Run chkdsk!\n", - __FUNCTION__); - err = EIO; - } - /* Now, truncate the runlist itself. */ - if (ntfs_rl_truncate(&na->rl, na->allocated_size >> - vol->cluster_size_bits)) { - /* - * Failed to truncate the runlist, so just - * throw it away, it will be mapped afresh on - * next use. - */ - free(na->rl); - na->rl = NULL; - } - goto put_err_out; + goto rollback; } memcpy(mft_rec_copy, m, mft_rec_copy_size); @@ -3388,31 +3332,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) "this message to " "linux-ntfs-dev@lists.sf.net." "\n", __FUNCTION__); - if (ntfs_cluster_free(vol, na, - na->allocated_size >> - vol->cluster_size_bits, -1) < - 0) { - // FIXME: Eeek! Leaving inconsistent - // metadata! (AIA) - fprintf(stderr, "%s(): Eeek! Leaking " - "clusters. Run " - "chkdsk!\n", - __FUNCTION__); - } - /* Now, truncate the runlist itself. */ - if (ntfs_rl_truncate(&na->rl, - na->allocated_size >> - vol->cluster_size_bits)) { - /* - * Failed to truncate the runlist, so - * just throw it away, it will be - * mapped afresh on next use. - */ - free(na->rl); - na->rl = NULL; - } err = EIO; - goto put_err_out; + goto rollback; } /* Move the following attributes making space. */ memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu( @@ -3436,34 +3357,18 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) "report you saw this message to " "linux-ntfs-dev@lists.sf.net.\n", __FUNCTION__); - if (ntfs_cluster_free(vol, na, na->allocated_size >> - vol->cluster_size_bits, -1) < 0) { - // FIXME: Eeek! Leaving inconsistent metadata! - // (AIA) - fprintf(stderr, "%s(): Eeek! Leaking " - "clusters. Run chkdsk!\n", - __FUNCTION__); - err = EIO; - } - /* Now, truncate the runlist itself. */ - if (ntfs_rl_truncate(&na->rl, na->allocated_size >> - vol->cluster_size_bits)) { - /* - * Failed to truncate the runlist, so just - * throw it away, it will be mapped afresh on - * next use. - */ - free(na->rl); - na->rl = NULL; - } - /* Restote mft record. */ - memcpy(m, mft_rec_copy, mft_rec_copy_size); - goto put_err_out; + mft_changed = 1; + goto rollback; } /* Update the attribute record and the ntfs_attr structure. */ na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = scpu_to_le64(na->allocated_size); + /* + * FIXME: We may not update a->highest_vcn if it equal to 0. + * But bug in runlist mapping code prevent us from doing so. + * Find and remove this bug. + */ a->highest_vcn = scpu_to_le64(first_free_vcn - 1); } /* Update the attribute record and the ntfs attribute structure. */ @@ -3476,9 +3381,29 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) free(mft_rec_copy); ntfs_attr_put_search_ctx(ctx); return 0; -put_err_out: +rollback: + if (ntfs_cluster_free(vol, na, na->allocated_size >> + vol->cluster_size_bits, -1) < 0) { + fprintf(stderr, "%s(): Eeek! Leaking clusters. Run chkdsk!\n", + __FUNCTION__); + err = EIO; + } + /* Now, truncate the runlist itself. */ + if (ntfs_rl_truncate(&na->rl, na->allocated_size >> + vol->cluster_size_bits)) { + /* + * Failed to truncate the runlist, so just throw it away, it + * will be mapped afresh on next use. + */ + free(na->rl); + na->rl = NULL; + } + /* Restote mft record. */ + if (mft_changed) + memcpy(m, mft_rec_copy, mft_rec_copy_size); if (mft_rec_copy) free(mft_rec_copy); +put_err_out: ntfs_attr_put_search_ctx(ctx); errno = err; return -1; From 99517ab2b8cbc6910a08085ba3112fe5e7b25515 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 5 Aug 2004 18:41:19 +0000 Subject: [PATCH 1645/2994] attrib.c: Restructure of error handling in ntfs_non_resident_attr_expand Comments update BKrev: 41127f4fDBazJmYyQ1nxPm5vlgvIGA From a40f1c30b6b20ec3d054af8f3592ba57c55064b9 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 5 Aug 2004 19:35:51 +0000 Subject: [PATCH 1646/2994] * bugfix ntfs_attr_truncate: determine what we need to do with attribute (expand or shrink) from na->data_size not from na->initialized_size * revert code and comment update about highest in ntfs_non_resident_attr_{shrink,expand}, because I fixed that bug (Logical change 1.478) --- libntfs/attrib.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index f303d987..7951754b 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3017,11 +3017,10 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) /* * Reminder: It is ok for a->highest_vcn to be -1 for zero * length files. - * FIXME: We may not update a->highest_vcn if it equal to 0. - * But bug in runlist mapping code prevent us from doing so. - * Find and remove this bug. + * Reminder: We may not update a->highest_vcn if it equal to 0. */ - a->highest_vcn = scpu_to_le64(first_free_vcn - 1); + if (a->highest_vcn) + a->highest_vcn = scpu_to_le64(first_free_vcn - 1); /* Get the size for the new mapping pairs array. */ mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); if (mp_size <= 0) { @@ -3365,11 +3364,10 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = scpu_to_le64(na->allocated_size); /* - * FIXME: We may not update a->highest_vcn if it equal to 0. - * But bug in runlist mapping code prevent us from doing so. - * Find and remove this bug. + * Reminder: We may not update a->highest_vcn if it equal to 0. */ - a->highest_vcn = scpu_to_le64(first_free_vcn - 1); + if (a->highest_vcn) + a->highest_vcn = scpu_to_le64(first_free_vcn - 1); } /* Update the attribute record and the ntfs attribute structure. */ na->data_size = newsize; @@ -3460,7 +3458,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) return -1; } if (NAttrNonResident(na)) { - if (newsize > na->initialized_size) + if (newsize > na->data_size) return ntfs_non_resident_attr_expand(na, newsize); else return ntfs_non_resident_attr_shrink(na, newsize); From d3178859aa59242d191c5faa8a7ecfd55a16573a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 5 Aug 2004 19:35:51 +0000 Subject: [PATCH 1647/2994] bugfix for ntfs_mapping_pairs_decompress for highest_vcn == 0 (Logical change 1.478) --- libntfs/runlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 7b8968fe..a667882f 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -896,7 +896,7 @@ mpa_err: * highest cluster, the runlist is either corrupt or, more * likely, there are more extents following this one. */ - if (deltaxcn < --max_cluster) { + if (deltaxcn && deltaxcn < --max_cluster) { Dprintf("More extents to follow; deltaxcn = 0x%llx, " "max_cluster = 0x%llx\n", (long long)deltaxcn, From 4dce86efe3fecc8ac8d0e31280fa9450535903c2 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 5 Aug 2004 19:35:51 +0000 Subject: [PATCH 1648/2994] libntfs/attrib.c: * bugfix ntfs_attr_truncate: determine what we need to do with attribute (expand or shrink) from na->data_size not from na->initialized_size * revert code and comment update about highest in ntfs_non_resident_attr_{shrink,expand}, because I fixed that bug libntfs/runlist.c: * bugfix for ntfs_mapping_pairs_decompress for highest_vcn == 0 BKrev: 41128c175AdXDfELeiTnDXhk1Jgnyw From 01e060874bad27c93805c85b1e6830eb8566468c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 5 Aug 2004 21:28:14 +0000 Subject: [PATCH 1649/2994] ntfs_mapping_pairs_decompress for highest_vcn == 0. (Logical change 1.479) --- libntfs/runlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index a667882f..d8c3f7b4 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -885,7 +885,7 @@ mpa_err: goto err_out; } /* Setup not mapped runlist element if this is the base extent. */ - if (!attr->lowest_vcn) { + if (deltaxcn && !attr->lowest_vcn) { VCN max_cluster; max_cluster = (sle64_to_cpu(attr->allocated_size) + @@ -896,7 +896,7 @@ mpa_err: * highest cluster, the runlist is either corrupt or, more * likely, there are more extents following this one. */ - if (deltaxcn && deltaxcn < --max_cluster) { + if (deltaxcn < --max_cluster) { Dprintf("More extents to follow; deltaxcn = 0x%llx, " "max_cluster = 0x%llx\n", (long long)deltaxcn, From 9859b897ba482acc3df5692b3bf7b5d468264b77 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 5 Aug 2004 21:28:14 +0000 Subject: [PATCH 1650/2994] runlist.c: Improve fix for ntfs_mapping_pairs_decompress for highest_vcn == 0. BKrev: 4112a66e9-nGkEBiKGdoeghonacW7w From 82e5f43087210db4277fe6aefc9ebba11fa4879d Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 8 Aug 2004 22:47:46 +0000 Subject: [PATCH 1651/2994] Giang: Add a recursive option to ls (Logical change 1.480) --- ntfsprogs/ntfsls.c | 272 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 265 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 35072dfb..ca3421c3 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "types.h" #include "mft.h" @@ -40,6 +41,55 @@ static const char *EXEC_NAME = "ntfsls"; +/** + * To hold sub-directory information for recursive listing. + * @depth: the level of this dir relative to opts.path + */ +struct dir { + struct list_head list; + ntfs_inode *ni; + char name[MAX_PATH]; + int depth; +}; + +/** + * path_component - to store path component strings + * + * @name: string pointer + * + * NOTE: @name is not directly allocated memory. It simply points to the + * character array name in struct dir. + */ +struct path_component { + struct list_head list; + char *name; +}; + +/* The list of sub-dirs is like a "horizontal" tree. The root of + * the tree is opts.path, but it is not part of the list because + * that's not necessary. The rules of the list are (in order of + * precedence): + * 1. directories immediately follow their parent. + * 2. siblings are next to one another. + * + * For example, if: + * 1. opts.path is / + * 2. / has 2 sub-dirs: dir1 and dir2 + * 3. dir1 has 2 sub-dirs: dir11 and dir12 + * 4. dir2 has 0 sub-dirs + * then the list will be: + * dummy head -> dir1 -> dir11 -> dir12 -> dir2 + * + * dir_list_insert_pos keeps track of where to insert a sub-dir + * into the list. + */ +struct list_head *dir_list_insert_pos = NULL; + +/* The global depth relative to opts.path. + * ie: opts.path has depth 0, a sub-dir of opts.path has depth 1 + */ +int depth = 0; + static struct options { char *device; /* Device/File to work with */ int quiet; /* Less output */ @@ -51,6 +101,7 @@ static struct options { int lng; int inode; int classify; + int recursive; char *path; } opts; @@ -95,6 +146,7 @@ static void usage(void) " -l --long Display long info\n" " -p PATH --path PATH Directory whose contents to list\n" " -q --quiet Less output\n" + " -R --recursive Recursively list subdirectories\n" " -s --system Display system files\n" " -V --version Display version information\n" " -v --verbose More output\n" @@ -115,7 +167,7 @@ static void usage(void) */ static int parse_options(int argc, char *argv[]) { - static const char *sopt = "-ad:Ffh?ilp:qsVvx"; + static const char *sopt = "-ad:Ffh?ilp:qRsVvx"; static const struct option lopt[] = { { "all", no_argument, NULL, 'a' }, { "device", required_argument, NULL, 'd' }, @@ -125,6 +177,7 @@ static int parse_options(int argc, char *argv[]) { "inode", no_argument, NULL, 'i' }, { "long", no_argument, NULL, 'l' }, { "path", required_argument, NULL, 'p' }, + { "recursive", no_argument, NULL, 'R' }, { "quiet", no_argument, NULL, 'q' }, { "system", no_argument, NULL, 's' }, { "version", no_argument, NULL, 'V' }, @@ -186,6 +239,9 @@ static int parse_options(int argc, char *argv[]) case 's': opts.system++; break; + case 'R': + opts.recursive++; + break; default: Eprintf("Unknown option '%s'.\n", argv[optind - 1]); err++; @@ -222,17 +278,188 @@ typedef struct { ntfs_volume *vol; } ntfsls_dirent; +static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, + const int name_len, const int name_type, + const s64 pos, const MFT_REF mref, + const unsigned dt_type); + /** - * list_entry + * free_dir - free one dir + * @tofree: the dir to free + * + * Close the inode and then free the dir + */ +void free_dir(struct dir *tofree) +{ + if (tofree) { + if (tofree->ni) { + ntfs_inode_close(tofree->ni); + tofree->ni = NULL; + } + free(tofree); + } +} + +/** + * free_dirs - walk the list of dir's and free each of them + * @dir_list: the list_head of any entry in the list + * + * Iterate over @dir_list, calling free_dir on each entry + */ +void free_dirs(struct list_head *dir_list) +{ + struct dir *tofree = NULL; + struct list_head *walker = NULL; + + if (dir_list) { + list_for_each(walker, dir_list) { + free_dir(tofree); + tofree = list_entry(walker, struct dir, list); + } + + free_dir(tofree); + } +} + +/** + * readdir_recursive - list a directory and sub-directories encountered + * @ni: ntfs inode of the directory to list + * @pos: current position in directory + * @dirent: context for filldir callback supplied by the caller + * + * For each directory, print its path relative to opts.path. List a directory, + * then list each of its sub-directories. + * + * Returns 0 on success or -1 on error. + * + * NOTE: Assumes recursive option. Currently no limit on the depths of + * recursion. + */ +int readdir_recursive(ntfs_inode * ni, s64 * pos, ntfsls_dirent * dirent) +{ + /* list of dirs to "ls" recursively */ + static struct dir dirs = { + .list = LIST_HEAD_INIT(dirs.list), + .ni = NULL, + .name = {0}, + .depth = 0 + }; + + static struct path_component paths = { + .list = LIST_HEAD_INIT(paths.list), + .name = NULL + }; + + static struct path_component base_comp; + + struct dir *subdir = NULL; + struct dir *tofree = NULL; + struct path_component comp; + struct path_component *tempcomp = NULL; + struct list_head *dir_walker = NULL; + struct list_head *comp_walker = NULL; + s64 pos2 = 0; + int ni_depth = depth; + int result = 0; + + if (list_empty(&dirs.list)) { + base_comp.name = opts.path; + list_add(&base_comp.list, &paths.list); + dir_list_insert_pos = &dirs.list; + printf("%s:\n", opts.path); + } + + depth++; + + result = ntfs_readdir(ni, pos, dirent, (ntfs_filldir_t) list_dir_entry); + + if (result == 0) { + list_add_tail(&comp.list, &paths.list); + + /* for each of ni's sub-dirs: list in this iteration, then + free at the top of the next iteration or outside of loop */ + list_for_each(dir_walker, &dirs.list) { + if (tofree) { + free_dir(tofree); + tofree = NULL; + } + subdir = list_entry(dir_walker, struct dir, list); + + /* subdir is not a subdir of ni */ + if (subdir->depth != ni_depth + 1) + break; + + pos2 = 0; + dir_list_insert_pos = &dirs.list; + if (!subdir->ni) { + subdir->ni = + utils_pathname_to_inode(ni->vol, ni, + subdir->name); + + if (!subdir->ni) { + Eprintf + ("ntfsls::readdir_recursive(): cannot get inode from pathname.\n"); + result = -1; + break; + } + } + puts(""); + + comp.name = subdir->name; + + /* print relative path header */ + list_for_each(comp_walker, &paths.list) { + tempcomp = + list_entry(comp_walker, + struct path_component, list); + printf("%s", tempcomp->name); + if (tempcomp != &comp + && *tempcomp->name != PATH_SEP + && (!opts.classify + || tempcomp == &base_comp)) + putchar(PATH_SEP); + } + puts(":"); + + result = readdir_recursive(subdir->ni, &pos2, dirent); + + if (result) + break; + + tofree = subdir; + list_del(dir_walker); + } + + list_del(&comp.list); + } + + if (tofree) + free_dir(tofree); + + /* if at the outter-most readdir_recursive, then clean up */ + if (ni_depth == 0) { + free_dirs(&dirs.list); + } + + depth--; + + return result; +} + +/** + * list_dir_entry * FIXME: Should we print errors as we go along? (AIA) */ -static int list_entry(ntfsls_dirent *dirent, const ntfschar *name, - const int name_len, const int name_type, const s64 pos, - const MFT_REF mref, const unsigned dt_type) +static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, + const int name_len, const int name_type, + const s64 pos, const MFT_REF mref, + const unsigned dt_type) { char *filename = NULL; int result = 0; + struct dir *dir = NULL; + filename = calloc (1, MAX_PATH); if (!filename) return -1; @@ -256,6 +483,20 @@ static int list_entry(ntfsls_dirent *dirent, const ntfschar *name, if (dt_type == NTFS_DT_DIR && opts.classify) sprintf(filename + strlen(filename), "/"); + if (dt_type == NTFS_DT_DIR && opts.recursive) { + dir = (struct dir *)calloc(1, sizeof(struct dir)); + + if (!dir) { + Eprintf("Failed to allocate for subdir.\n"); + result = -1; + goto free; + } + + strcpy(dir->name, filename); + dir->ni = NULL; + dir->depth = depth; + } + if (!opts.lng) { if (!opts.inode) printf("%s\n", filename); @@ -313,6 +554,11 @@ static int list_entry(ntfsls_dirent *dirent, const ntfschar *name, printf("%8lld %s %s\n", (long long)filesize, t_buf + 4, filename); + if (dt_type == NTFS_DT_DIR && opts.recursive) { + dir->ni = ni; + ni = NULL; /* so release does not close inode */ + } + result = 0; release: /* Release atrtibute search context and close the inode. */ @@ -321,6 +567,13 @@ release: if (ni) ntfs_inode_close(ni); } + + /* add dir to list */ + if (dir && !result) { + list_add(&dir->list, dir_list_insert_pos); + dir_list_insert_pos = &dir->list; + } + free: free (filename); return result; @@ -372,7 +625,11 @@ int main(int argc, char **argv) memset(&dirent, 0, sizeof(dirent)); dirent.vol = vol; if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) { - ntfs_readdir(ni, &pos, &dirent, (ntfs_filldir_t)list_entry); + if (opts.recursive) + readdir_recursive(ni, &pos, &dirent); + else + ntfs_readdir(ni, &pos, &dirent, + (ntfs_filldir_t) list_dir_entry); // FIXME: error checking... (AIA) } else { ATTR_RECORD *rec; @@ -397,7 +654,8 @@ int main(int argc, char **argv) } } - list_entry(&dirent, name, name_len, space, pos, ni->mft_no, NTFS_DT_REG); + list_dir_entry(&dirent, name, name_len, space, pos, ni->mft_no, + NTFS_DT_REG); // FIXME: error checking... (AIA) ntfs_attr_put_search_ctx(ctx); From 6caaf1eb5098929f8f646c830e58c6baaad110a8 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sun, 8 Aug 2004 22:47:46 +0000 Subject: [PATCH 1652/2994] ntfsls: Add a recursive option to ntfsls (Giang Nguyen) BKrev: 4116ad92iCP4TXMgUOeCit9QFGWBDA From acc1ae3a46c269fe657b68f127aa5c93da257559 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 9 Aug 2004 11:01:35 +0000 Subject: [PATCH 1653/2994] minor code tidy up (Logical change 1.481) --- ntfsprogs/ntfsls.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index ca3421c3..d9ab8aea 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -62,7 +62,7 @@ struct dir { */ struct path_component { struct list_head list; - char *name; + const char *name; }; /* The list of sub-dirs is like a "horizontal" tree. The root of @@ -102,9 +102,13 @@ static struct options { int inode; int classify; int recursive; - char *path; + const char *path; } opts; +typedef struct { + ntfs_volume *vol; +} ntfsls_dirent; + GEN_PRINTF(Eprintf, stderr, NULL, FALSE) GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) @@ -274,10 +278,6 @@ static int parse_options(int argc, char *argv[]) return (!err && !help && !ver); } -typedef struct { - ntfs_volume *vol; -} ntfsls_dirent; - static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, const int name_len, const int name_type, const s64 pos, const MFT_REF mref, @@ -289,7 +289,7 @@ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, * * Close the inode and then free the dir */ -void free_dir(struct dir *tofree) +static void free_dir(struct dir *tofree) { if (tofree) { if (tofree->ni) { @@ -306,7 +306,7 @@ void free_dir(struct dir *tofree) * * Iterate over @dir_list, calling free_dir on each entry */ -void free_dirs(struct list_head *dir_list) +static void free_dirs(struct list_head *dir_list) { struct dir *tofree = NULL; struct list_head *walker = NULL; @@ -335,7 +335,7 @@ void free_dirs(struct list_head *dir_list) * NOTE: Assumes recursive option. Currently no limit on the depths of * recursion. */ -int readdir_recursive(ntfs_inode * ni, s64 * pos, ntfsls_dirent * dirent) +static int readdir_recursive(ntfs_inode * ni, s64 * pos, ntfsls_dirent * dirent) { /* list of dirs to "ls" recursively */ static struct dir dirs = { From 10bccd1eb503583da908621b7441ae64957d9b77 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 9 Aug 2004 11:01:35 +0000 Subject: [PATCH 1654/2994] ntfsls: minor code tidy up (Yuval) BKrev: 4117598fFx9fgXDXlFx1C28flnnukg From 95a799559c6a81cd854f7b6a49337c0caba384d8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Aug 2004 13:19:11 +0000 Subject: [PATCH 1655/2994] Change include from <> to "" for list.h (Logical change 1.482) --- ntfsprogs/ntfsls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index d9ab8aea..e1cd3958 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -29,7 +29,6 @@ #include #include #include -#include #include "types.h" #include "mft.h" @@ -38,6 +37,7 @@ #include "inode.h" #include "utils.h" #include "dir.h" +#include "list.h" static const char *EXEC_NAME = "ntfsls"; From 22166e0ac3233c98438cce0bec8957df6110fbd6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Aug 2004 13:19:11 +0000 Subject: [PATCH 1656/2994] ntfsls.c: Change include from <> to "" for list.h BKrev: 411779cfjxM3uZAuZtaqHWWMxpOG2w From c6d73395e47824cbad057fe2176cd865eeccd7a5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Aug 2004 13:31:10 +0000 Subject: [PATCH 1657/2994] Refix the fix to the fix in runlist.c highest_vcn == 0 handling. (Logical change 1.483) --- libntfs/runlist.c | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index d8c3f7b4..b1a09b46 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -885,32 +885,39 @@ mpa_err: goto err_out; } /* Setup not mapped runlist element if this is the base extent. */ - if (deltaxcn && !attr->lowest_vcn) { + if (!attr->lowest_vcn) { VCN max_cluster; max_cluster = (sle64_to_cpu(attr->allocated_size) + vol->cluster_size - 1) >> vol->cluster_size_bits; /* - * If there is a difference between the highest_vcn and the - * highest cluster, the runlist is either corrupt or, more - * likely, there are more extents following this one. + * A highest_vcn of zero means this is a single extent + * attribute so simply terminate the runlist with LCN_ENOENT). */ - if (deltaxcn < --max_cluster) { - Dprintf("More extents to follow; deltaxcn = 0x%llx, " - "max_cluster = 0x%llx\n", - (long long)deltaxcn, - (long long)max_cluster); - rl[rlpos].vcn = vcn; - vcn += rl[rlpos].length = max_cluster - deltaxcn; - rl[rlpos].lcn = (LCN)LCN_RL_NOT_MAPPED; - rlpos++; - } else if (deltaxcn > max_cluster) { - Dprintf("Corrupt attribute. deltaxcn = 0x%llx, " - "max_cluster = 0x%llx", - (long long)deltaxcn, - (long long)max_cluster); - goto mpa_err; + if (deltaxcn) { + /* + * If there is a difference between the highest_vcn and + * the highest cluster, the runlist is either corrupt + * or, more likely, there are more extents following + * this one. + */ + if (deltaxcn < max_cluster) { + Dprintf("More extents to follow; deltaxcn = 0x%llx, " + "max_cluster = 0x%llx\n", + (long long)deltaxcn, + (long long)max_cluster); + rl[rlpos].vcn = vcn; + vcn += rl[rlpos].length = max_cluster - deltaxcn; + rl[rlpos].lcn = (LCN)LCN_RL_NOT_MAPPED; + rlpos++; + } else if (deltaxcn > max_cluster) { + Dprintf("Corrupt attribute. deltaxcn = 0x%llx, " + "max_cluster = 0x%llx", + (long long)deltaxcn, + (long long)max_cluster); + goto mpa_err; + } } rl[rlpos].lcn = (LCN)LCN_ENOENT; } else /* Not the base extent. There may be more extents to follow. */ From c828da77d132fbc568a138184a79a6d8021e7248 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 9 Aug 2004 13:31:10 +0000 Subject: [PATCH 1658/2994] runlist.c: Refix the fix to the fix in runlist.c highest_vcn == 0 handling. BKrev: 41177c9es9wZxd3eCLNqH-4OG6oYbg From 3d1afab5623b219b83f922f7ee46f24943b9bd0d Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 9 Aug 2004 16:36:18 +0000 Subject: [PATCH 1659/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/09 17:36:05+01:00 flatcap.org!ntfs ntfsrm: reorganise code 2004/08/06 08:30:58+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/05 21:07:18+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/05 13:40:21+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/04 22:08:22+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/04 22:08:05+01:00 flatcap.org!ntfs ntfsrm: more add code 2004/08/02 20:43:31+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/01 10:11:07+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/07/17 01:09:43+01:00 flatcap.org!ntfs ntfsrm: split node if too full 2004/07/17 01:07:06+01:00 flatcap.org!ntfs ntfsrm: add file progress 2004/07/16 01:16:29+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/07/14 23:59:50+01:00 flatcap.org!ntfs ntfsrm: start add file 2004/07/14 23:48:30+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/07/14 23:48:17+01:00 flatcap.org!ntfs ntfsrm: fix corruption in root remove BKrev: 4117a802_0N9v03pTUQdwkgueVBKmQ From 62d954e92cfcc0fdb5609ae96e47f8f5fe12cf49 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 9 Aug 2004 16:36:18 +0000 Subject: [PATCH 1660/2994] move out structs regroup functions 2004/08/04 22:08:05+01:00 flatcap.org!ntfs rebuild children list after alloc/root add rearrange pointers and ascend in add2 2004/07/17 01:09:42+01:00 flatcap.org!ntfs split node 2004/07/17 01:07:06+01:00 flatcap.org!ntfs some add stuff: freespace, transfer 2004/07/14 23:59:50+01:00 flatcap.org!ntfs start add file 2004/07/14 23:48:16+01:00 flatcap.org!ntfs fix corruption in dt_root_remove (Logical change 1.484) --- ntfsprogs/ntfsrm.c | 2480 ++++++++++++++++++++++++++------------------ 1 file changed, 1475 insertions(+), 1005 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 28413e36..7106017c 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -195,71 +195,6 @@ static int parse_options (int argc, char **argv) } -struct ntfs_dir; -static void ntfs_ie_dump (INDEX_ENTRY *ie); -static VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie); -static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype); - -#define RED "" -#define GREEN "" -#define YELLOW "" -#define BLUE "" -#define MAGENTA "" -#define CYAN "" -#define BOLD "" -#define END "" - -#define ROUND_UP(num,bound) (((num)+((bound)-1)) & ~((bound)-1)) -#define ATTR_SIZE(s) ROUND_UP(s,8) - -/** - * struct ntfs_bmp - * a cache for either dir/$BITMAP, $MFT/$BITMAP or $Bitmap/$DATA - */ -struct ntfs_bmp { - ntfs_attr *attr; - u8 **data; - VCN *data_vcn; - int count; - //int cluster_size; -}; - -/** - * struct ntfs_dt - */ -struct ntfs_dt { - struct ntfs_dir *dir; - struct ntfs_dt *parent; - u8 *data; - int data_len; - int child_count; - INDEX_ENTRY **children; - struct ntfs_dt **sub_nodes; - INDEX_HEADER *header; - VCN vcn; -}; - -/** - * struct ntfs_dir - */ -struct ntfs_dir { - ntfs_volume *vol; - struct ntfs_dir *parent; - ntfschar *name; - int name_len; - struct ntfs_dt *index; - struct ntfs_dir **children; - int child_count; - MFT_REF mft_num; - struct mft_bitmap *bitmap; - ntfs_inode *inode; - ntfs_attr *iroot; - ntfs_attr *ialloc; - ntfs_attr *ibmp; - int index_size; -}; - - /** * ntfs_name_print */ @@ -312,6 +247,28 @@ static void ntfs_dt_print (struct ntfs_dt *dt, int indent) } } +/** + * ntfsinfo_time_to_str() - + * @sle_ntfs_clock: on disk time format in 100ns units since 1st jan 1601 + * in little-endian format + * + * Return char* in a format 'Thu Jan 1 00:00:00 1970'. + * No need to free the returned memory. + * + * Example of usage: + * char *time_str = ntfsinfo_time_to_str( + * sle64_to_cpu(standard_attr->creation_time)); + * printf("\tFile Creation Time:\t %s", time_str); + */ +static const char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) +{ + time_t unix_clock = ntfs2utc(sle64_to_cpu(sle_ntfs_clock)); + if (sle_ntfs_clock == 0) + return "none\n"; + else + return ctime(&unix_clock); +} + /** * ntfs_bmp_free @@ -558,6 +515,314 @@ static int ntfs_bmp_rollback (struct ntfs_bmp *bmp) } +/** + * ntfs_ie_get_vcn + */ +static VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie) +{ + if (!ie) + return -1; + if (!(ie->flags & INDEX_ENTRY_NODE)) + return -1; + + return *((VCN*) ((u8*) ie + ie->length - 8)); +} + +/** + * ntfs_ie_dump + */ +static void ntfs_ie_dump (INDEX_ENTRY *ie) +{ + if (!ie) + return; + + printf ("________________________________________________"); + printf ("\n"); + utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); + + printf ("MFT Ref: 0x%llx\n", ie->indexed_file); + printf ("length: %d\n", ie->length); + printf ("keylen: %d\n", ie->key_length); + printf ("flags: "); + if (ie->flags & INDEX_ENTRY_NODE) printf ("NODE "); + if (ie->flags & INDEX_ENTRY_END) printf ("END"); + if (!(ie->flags & (INDEX_ENTRY_NODE | INDEX_ENTRY_END))) printf ("none"); + printf ("\n"); + printf ("reserved 0x%04x\n", ie->reserved); + if (ie->key_length > 0) { + printf ("mft parent: 0x%llx\n", ie->key.file_name.parent_directory); + + printf ("ctime: %s", ntfsinfo_time_to_str(ie->key.file_name.creation_time)); + printf ("dtime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_data_change_time)); + printf ("mtime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_mft_change_time)); + printf ("atime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_access_time)); + printf ("alloc size: %lld\n", ie->key.file_name.allocated_size); + printf ("data size: %lld\n", ie->key.file_name.data_size); + printf ("file flags: 0x%04x\n", ie->key.file_name.file_attributes); + printf ("reserved: 0x%04x\n", ie->key.file_name.reserved); printf ("name len: %d\n", ie->key.file_name.file_name_length); + if (ie->key.file_name.file_name_length > 0) { + int i, r; + printf ("name type: %d\n", ie->key.file_name.file_name_type); + printf ("name: "); + ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); + printf ("\n"); + r = ATTR_SIZE (2 * (ie->key.file_name.file_name_length+1)) - (2 * (ie->key.file_name.file_name_length+1)); + if (r > 0) { + u8 *ptr; + printf ("padding: "); + ptr = (u8*) (ie->key.file_name.file_name + ie->key.file_name.file_name_length); + for (i = 0; i < r; i++, ptr++) + printf ("0x%02x ", *ptr); + printf ("\n"); + } + } + } + if (ie->flags == INDEX_ENTRY_NODE) { + printf ("child vcn = %lld\n", ntfs_ie_get_vcn (ie)); + } +} + +/** + * ntfs_ie_create + */ +static INDEX_ENTRY * ntfs_ie_create (void) +{ + int length; + INDEX_ENTRY *ie; + + length = 16; + ie = malloc (length); + if (!ie) + return NULL; + + ie->indexed_file = 0; + ie->length = length; + ie->key_length = 0; + ie->flags = INDEX_ENTRY_END; + ie->reserved = 0; + return ie; +} + +/** + * ntfs_ie_copy + */ +static INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie) +{ + INDEX_ENTRY *copy = NULL; + + if (!ie) + return NULL; + + copy = malloc (ie->length); + if (!copy) + return NULL; + memcpy (copy, ie, ie->length); + + return copy; +} + +/** + * ntfs_ie_set_vcn + */ +static INDEX_ENTRY * ntfs_ie_set_vcn (INDEX_ENTRY *ie, VCN vcn) +{ + if (!ie) + return 0; + + if (!(ie->flags & INDEX_ENTRY_NODE)) { + ie->length += 8; + ie = realloc (ie, ie->length); + if (!ie) + return NULL; + + ie->flags |= INDEX_ENTRY_NODE; + } + + *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; + return ie; +} + +/** + * ntfs_ie_remove_vcn + */ +static INDEX_ENTRY * ntfs_ie_remove_vcn (INDEX_ENTRY *ie) +{ + if (!ie) + return NULL; + if (!(ie->flags & INDEX_ENTRY_NODE)) + return ie; + + ie->length -= 8; + ie->flags &= ~INDEX_ENTRY_NODE; + ie = realloc (ie, ie->length); + return ie; +} + +/** + * ntfs_ie_set_name + */ +static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype) +{ + FILE_NAME_ATTR *file; + int klen; + int need; + VCN vcn = 0; + + if (!ie || !name) + return NULL; + + /* + * INDEX_ENTRY + * MFT_REF indexed_file; + * u16 length; + * u16 key_length; + * INDEX_ENTRY_FLAGS flags; + * u16 reserved; + * + * FILENAME + * MFT_REF parent_directory; + * s64 creation_time; + * s64 last_data_change_time; + * s64 last_mft_change_time; + * s64 last_access_time; + * s64 allocated_size; + * s64 data_size; + * FILE_ATTR_FLAGS file_attributes; + * u32 reserved; + * u8 file_name_length; + * FILE_NAME_TYPE_FLAGS file_name_type; + * ntfschar file_name[l]; + * u8 reserved[n] + * + * VCN vcn; + */ + + file = &ie->key.file_name; + + klen = ATTR_SIZE (ie->key_length); + need = ATTR_SIZE (sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar))); + + //printf ("ilen = %d\n", ie->length); + //printf ("klen = %d\n", klen); + //printf ("need = %d\n", need); + + if (ie->flags & INDEX_ENTRY_NODE) + vcn = ntfs_ie_get_vcn (ie); + + ie->length = 16 + need; + ie->key_length = sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar)); + ie = realloc (ie, ie->length + ie->key_length); + if (!ie) + return NULL; + + memcpy (ie->key.file_name.file_name, name, namelen * 2); + + if (ie->flags & INDEX_ENTRY_NODE) + ie = ntfs_ie_set_vcn (ie, vcn); + + ie->key.file_name.file_name_length = namelen; + ie->key.file_name.file_name_type = nametype; + ie->flags &= ~INDEX_ENTRY_END; + + return ie; +} + +/** + * ntfs_ie_remove_name + */ +static INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) +{ + VCN vcn; + + if (!ie) + return NULL; + if (ie->key_length == 0) + return ie; + + if (ie->flags & INDEX_ENTRY_NODE) + vcn = ntfs_ie_get_vcn (ie); + + ie->length -= ATTR_SIZE (ie->key_length); + ie->key_length = 0; + ie->flags |= INDEX_ENTRY_END; + + ie = realloc (ie, ie->length); + if (!ie) + return NULL; + + if (ie->flags & INDEX_ENTRY_NODE) + ie = ntfs_ie_set_vcn (ie, vcn); + return ie; +} + +/** + * ntfs_ie_test + */ +static int ntfs_ie_test (void) +{ + INDEX_ENTRY *ie1 = NULL; + INDEX_ENTRY *ie2 = NULL; + int namelen = 0; + ntfschar *name = NULL; + + if (1) { + ie1 = ntfs_ie_create(); + //ntfs_ie_dump (ie1); + } + + if (0) { + ie2 = ntfs_ie_copy (ie1); + ntfs_ie_dump (ie2); + } + + if (1) { + namelen = ntfs_mbstoucs("richard", &name, 0); + ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); + free (name); + name = NULL; + ntfs_ie_dump (ie1); + } + + if (1) { + namelen = ntfs_mbstoucs("richard2", &name, 0); + ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); + free (name); + name = NULL; + ntfs_ie_dump (ie1); + } + + if (1) { + ie1 = ntfs_ie_remove_name (ie1); + ntfs_ie_dump (ie1); + } + + if (1) { + ie1 = ntfs_ie_set_vcn (ie1, 1234); + ntfs_ie_dump (ie1); + } + + if (1) { + ie1 = ntfs_ie_remove_vcn (ie1); + ntfs_ie_dump (ie1); + } + + ie1->indexed_file = 1234; + ie1->key.file_name.parent_directory = 5; + ie1->key.file_name.creation_time = utc2ntfs (time(NULL)); + ie1->key.file_name.last_data_change_time = utc2ntfs (time(NULL)); + ie1->key.file_name.last_mft_change_time = utc2ntfs (time(NULL)); + ie1->key.file_name.last_access_time = utc2ntfs (time(NULL)); + ie1->key.file_name.allocated_size = 4096; + ie1->key.file_name.data_size = 3973; + + //ntfs_ie_dump (ie1); + free (name); + free (ie1); + free (ie2); + return 0; +} + + /** * ntfs_dt_alloc_children */ @@ -580,8 +845,8 @@ static BOOL ntfs_dt_alloc_children2 (struct ntfs_dt *dt, int count) { // XXX calculate for 2K and 4K indexes max and min filenames (inc/exc VCN) - int old = (count + 0x1e) & ~0x1f; - int new = (count + 0x1f) & ~0x1f; + int old = (dt->child_count + 0x1e) & ~0x1f; + int new = (count + 0x1f) & ~0x1f; if (old == new) return TRUE; @@ -589,6 +854,8 @@ static BOOL ntfs_dt_alloc_children2 (struct ntfs_dt *dt, int count) dt->children = realloc (dt->children, new * sizeof (*dt->children)); dt->sub_nodes = realloc (dt->sub_nodes, new * sizeof (*dt->sub_nodes)); + // XXX wipe new space + return (dt->children && dt->sub_nodes); } @@ -741,6 +1008,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par dt->child_count = 0; dt->sub_nodes = NULL; dt->vcn = vcn; + dt->changed = FALSE; if (parent) { //printf ("alloc a = %lld\n", dir->ialloc->allocated_size); @@ -1049,6 +1317,7 @@ static struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int n for (i = 0; i < dt->child_count; i++) { ie = dt->children[i]; + //printf ("ie->flags = %d\n", ie->flags); if (ie->flags & INDEX_ENTRY_END) { r = -1; } else { @@ -1095,6 +1364,32 @@ static struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int n return res; } +/** + * ntfs_dt_find_all + * maps all dt's into memory + */ +static void ntfs_dt_find_all (struct ntfs_dt *dt) +{ + INDEX_ENTRY *ie; + VCN vcn; + int i; + + if (!dt) + return; + + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + if (ie->flags & INDEX_ENTRY_NODE) { + if (!dt->sub_nodes[i]) { + vcn = ntfs_ie_get_vcn (ie); + dt->sub_nodes[i] = ntfs_dt_alloc (dt->dir, dt, vcn); + } + ntfs_dt_find_all (dt->sub_nodes[i]); + } + } +} + /** * ntfs_dt_commit */ @@ -1147,6 +1442,240 @@ static BOOL ntfs_dt_root (struct ntfs_dt *dt) return (dt->parent == NULL); } +/** + * ntfs_dt_freespace_root + */ +static int ntfs_dt_freespace_root (struct ntfs_dt *dt) +{ + int recsize; + int inuse; + MFT_RECORD *mrec; + + if (!dt) + return -1; + + recsize = dt->dir->inode->vol->mft_record_size; + + mrec = (MFT_RECORD*) dt->dir->inode->mrec; + inuse = mrec->bytes_in_use; + + return recsize - inuse; +} + +/** + * ntfs_dt_freespace_alloc + */ +static int ntfs_dt_freespace_alloc (struct ntfs_dt *dt) +{ + int recsize; + int inuse; + INDEX_BLOCK *block; + + if (!dt) + return -1; + + recsize = dt->dir->index_size; + + block = (INDEX_BLOCK*) dt->data; + inuse = block->index.index_length + 24; + + return recsize - inuse; +} + +/** + * ntfs_dt_initialise + */ +static int ntfs_dt_initialise (struct ntfs_dt *dt, VCN vcn) +{ + INDEX_BLOCK *block; + INDEX_ENTRY *ie; + + if (!dt || !dt->data) + return -1; + + memset (dt->data, 0, dt->data_len); + + // Ought to check these are empty + free (dt->children); + free (dt->sub_nodes); + + dt->children = NULL; + dt->sub_nodes = NULL; + + if (!ntfs_dt_alloc_children2 (dt, 1)) + return -1; + + block = (INDEX_BLOCK*) dt->data; + + block->magic = magic_INDX; + block->usa_ofs = 0x28; + block->usa_count = (dt->data_len >> 9) + 1; + block->index_block_vcn = vcn; + block->index.entries_offset = 0x28; + block->index.index_length = 0x38; + block->index.allocated_size = dt->data_len - 0x18; + + ie = (INDEX_ENTRY*) (dt->data + block->index.entries_offset + 0x18); + + ie->length = 0x10; + ie->flags = INDEX_ENTRY_END; + + dt->children[0] = ie; + dt->sub_nodes[0] = NULL; + + //utils_dump_mem (dt->data, 0, block->index.index_length+0x18, DM_DEFAULTS); + + return 0; +} + +/** + * ntfs_dt_transfer + */ +static int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start, int count) +{ + int i; + int need; + int space; + INDEX_ENTRY *mov_ie; + u8 *src; + u8 *dst; + int len; + int insert; + //FILE_NAME_ATTR *file; + + //XXX check len > 0 + + if (!old || !new) + return -1; + + if ((start < 0) || ((start+count) >= old->child_count)) + return -1; + + printf ("\n"); + printf (BOLD YELLOW "Transferring children\n" END); + + need = 0; + for (i = start; i < (start+count+1); i++) { + mov_ie = old->children[i]; + need += mov_ie->length; + //file = &mov_ie->key.file_name; printf ("\ttrn name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + } + + if (ntfs_dt_root (new)) + space = ntfs_dt_freespace_root (new); + else + space = ntfs_dt_freespace_alloc (new); + + // XXX if this is an index root, it'll go badly wrong + // restrict to allocs only? + + printf ("\tneed = %d\n", need); + printf ("\tspace = %d\n", space); + + if (space < need) + return -1; + + if (new->child_count == 1) { + i = -1; + } else { + ntfschar *n1, *n2; + int l1, l2; + + n1 = new->children[0]->key.file_name.file_name; + l1 = new->children[0]->key.file_name.file_name_length; + + n2 = old->children[start]->key.file_name.file_name; + l2 = old->children[start]->key.file_name.file_name_length; + + i = ntfs_names_collate (n1, l1, n2, l2, + 2, IGNORE_CASE, + old->dir->vol->upcase, + old->dir->vol->upcase_len); + } + + if ((i == 0) || (i == 2)) + return -1; + + // determine the insertion point + if (i == 1) + insert = 0; + else + insert = new->child_count-1; + + src = (u8*) new->children[insert]; + dst = src + need; + len = (u8*) new->children[new->child_count-1] + new->children[new->child_count-1]->length - src; + + //printf ("src = %d, dst = %d, len = %d\n", src - new->data, dst - new->data, len); + memmove (dst, src, len); + + dst = src; + src = (u8*) old->children[start]; + len = need; + + memcpy (dst, src, len); + + src = (u8*) old->children[start+count-1]; + dst = (u8*) old->children[start]; + len = (u8*) old->children[old->child_count-1] + old->children[old->child_count-1]->length - src; + + //printf ("src = %d, dst = %d, len = %d\n", src - old->data, dst - old->data, len); + memmove (dst, src, len); + + dst += len; + len = old->data + old->dir->index_size - dst; + + //printf ("dst = %d, len = %d\n", dst - old->data, len); + memset (dst, 0, len); + + new->child_count += count; + if (!ntfs_dt_alloc_children2 (new, new->child_count)) + return -1; + + src = (u8*) &old->sub_nodes[start+count-1]; + dst = (u8*) &old->sub_nodes[start]; + len = (old->child_count - start - count + 1) * sizeof (struct ntfs_dt*); + + memmove (dst, src, len); + + src = (u8*) &new->sub_nodes[insert]; + dst = (u8*) &new->sub_nodes[insert+count-1]; + len = (new->child_count - insert - count + 1) * sizeof (struct ntfs_dt*); + + memmove (dst, src, len); + + old->child_count -= count; + if (!ntfs_dt_alloc_children2 (old, old->child_count)) + return -1; + + src = (u8*) new->children[0]; + for (i = 0; i < new->child_count; i++) { + new->children[i] = (INDEX_ENTRY*) src; + src += new->children[i]->length; + } + + src = (u8*) old->children[0]; + for (i = 0; i < old->child_count; i++) { + old->children[i] = (INDEX_ENTRY*) src; + src += old->children[i]->length; + } + + old->header->index_length -= need; + new->header->index_length += need; + + // resize children and sub_nodes + // memmove keys in new + // memcpy old to new + // memmove keys in old + // rebuild old/new children/sub_nodes without destroying tree + // update old/new headers + + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); + + return 0; +} + /** * ntfs_dir_alloc @@ -1698,67 +2227,386 @@ static int ntfs_mft_free_space (struct ntfs_dir *dir) /** - * ntfs_dt_add_alloc + * ntfs_dt_root_replace */ -static int ntfs_dt_add_alloc (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie) +static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) +{ + u8 *src; + u8 *dst; + u8 *attr; + int len; + int i; + + if (!del || !del_ie || !suc_ie) + return FALSE; + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + //printf ("\n"); + + attr = malloc (del->data_len + suc_ie->length - del_ie->length); + + dst = attr; + src = del->data; + len = (u8*) del_ie - del->data; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) suc_ie; + len = suc_ie->length; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) del_ie + del_ie->length; + len = del->data_len + (del->data - (u8*) del_ie) - del_ie->length; + + memcpy (dst, src, len); + + src = (u8*) del->data; + dst = attr; + + len = del->data_len + suc_ie->length - del_ie->length; + free (del->data); + del->data = attr; + del->data_len = len; + + ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); + + //utils_dump_mem (attr, 0, del->data_len, DM_DEFAULTS); + + //printf ("\n"); + //printf (BOLD YELLOW "Adjust children\n" END); + //for (i = 0; i < del->child_count; i++) + // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); + //printf ("\n"); + + len = suc_ie->length - del_ie->length; + //printf ("src = %p, dst = %p, len = %d\n", src, dst, len); fflush (stdout); + + for (i = 0; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) (dst + ((u8*) del->children[i] - src)); + + for (i = del_num+1; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); + + //for (i = 0; i < del->child_count; i++) + // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); + //printf ("\n"); + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + //printf ("\n"); + + printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); + return TRUE; +} + +/** + * ntfs_dt_alloc_replace + */ +static BOOL ntfs_dt_alloc_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) { - INDEX_BLOCK *block; - int need; - int space; u8 *src; u8 *dst; int len; + int i; - if (!parent || !ie) - return 0; + if (!del || !del_ie || !suc_ie) + return FALSE; - block = (INDEX_BLOCK*) parent->data; + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - need = ie->length; - space = parent->data_len - block->index.index_length - 24; + src = (u8*) del_ie + del_ie->length; + dst = (u8*) del_ie + suc_ie->length; + len = del->header->index_length + 24 + (del->data - src); + //printf ("src = %d\n", src - del->data); + //printf ("dst = %d\n", dst - del->data); + //printf ("len = %d\n", len); - printf ("need %d, have %d\n", need, space); - if (need > space) { - printf ("no room"); - return 0; - } + if (src != dst) + memmove (dst, src, len); - //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); + src = (u8*) suc_ie; + dst = (u8*) del_ie; + len = suc_ie->length; + + memcpy (dst, src, len); + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + + del->header->index_length += suc_ie->length - del_ie->length; + + dst = del->data + del->header->index_length + 24; + len = del->data_len - del->header->index_length - 24; + + memset (dst, 0, len); + + //for (i = 0; i < del->child_count; i++) + // printf ("Child %d %p\n", i, del->children[i]); //printf ("\n"); - src = (u8*) parent->children[index_num]; - dst = src + need; - len = parent->data + parent->data_len - src - space; - //printf ("src = %d\n", src - parent->data); - //printf ("dst = %d\n", dst - parent->data); + len = suc_ie->length - del_ie->length; + //printf ("len = %d\n", len); + + for (i = del_num+1; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); + + //for (i = 0; i < del->child_count; i++) + // printf ("Child %d %p\n", i, del->children[i]); + //printf ("\n"); + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); + return TRUE; +} + +/** + * ntfs_dt_root_remove + */ +static BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) +{ + INDEX_ENTRY *del_ie = NULL; + u8 *src; + u8 *dst; + u8 *old; + int len; + int del_len; + int i; + //int off; + + if (!del) + return FALSE; + + //utils_dump_mem (del->data, 0, del->header->index_length+16, DM_RED); + //printf ("\n"); + +#if 0 + off = (u8*) del->children[0] - del->data; + for (i = 0; i < del->child_count; i++) { + del_ie = del->children[i]; + + printf ("%2d %4d ", i+1, off); + off += del_ie->length; + + if (del_ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", del_ie->length); + break; + } + + ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + printf (" (%d)\n", del_ie->length); + } + printf ("total = %d\n", off); +#endif + + del_ie = del->children[del_num]; + del_len = del_ie->length; + + src = (u8*) del_ie + del_len; + dst = (u8*) del_ie; + len = del->header->index_length + 16 - (src - del->data); + + //printf ("src = %d\n", src - del->data); + //printf ("dst = %d\n", dst - del->data); //printf ("len = %d\n", len); memmove (dst, src, len); - dst = src; - src = (u8*) ie; - len = need; + del->data_len -= del_len; + del->child_count--; - memcpy (dst, src, len); + del->header->index_length = del->data_len - 16; + del->header->allocated_size = del->data_len - 16; - block->index.index_length += len; + ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); + old = del->data; + del->data = realloc (del->data, del->data_len); + del->header = (INDEX_HEADER*) (del->data + 0x10); - dst = parent->data + block->index.index_length + 24; - len = parent->data_len - block->index.index_length - 24; + del->header->index_length -= del_len; + del->header->allocated_size -= del_len; - memset (dst, 0, len); + //utils_dump_mem (del->data, 0, del->data_len, DM_GREEN | DM_RED); - //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); - //printf ("\n"); - return 0; + src = (u8*) (&del->children[del_num+1]); + dst = (u8*) (&del->children[del_num]); + len = (del->child_count - del_num) * sizeof (INDEX_ENTRY*); + + //printf ("src = %d\n", src - (u8*) del->children); + //printf ("dst = %d\n", dst - (u8*) del->children); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + src = (u8*) (&del->sub_nodes[del_num+1]); + dst = (u8*) (&del->sub_nodes[del_num]); + len = (del->child_count - del_num) * sizeof (struct ntfs_dt*); + + //printf ("src = %d\n", src - (u8*) del->children); + //printf ("dst = %d\n", dst - (u8*) del->children); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + //printf ("del_num = %d\n", del_num); + for (i = 0; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - old + del->data); + for (i = del_num; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_len); + + if (!ntfs_dt_alloc_children2 (del, del->child_count)) + return FALSE; + +#if 0 + off = (u8*) del->children[0] - del->data; + for (i = 0; i < del->child_count; i++) { + del_ie = del->children[i]; + + printf ("%2d %4d ", i+1, off); + off += del_len; + + if (del_ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", del_len); + break; + } + + ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + printf (" (%d)\n", del_len); + } + printf ("total = %d\n", off); +#endif + + //utils_dump_mem (del->data, 0, del->header->index_length+16, DM_DEFAULTS); + + del->changed = TRUE; + printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); + return TRUE; } /** - * ntfs_dt_add_root + * ntfs_dt_alloc_remove */ -static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie) +static BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) { - INDEX_ROOT *root; + INDEX_ENTRY *del_ie = NULL; + u8 *dst; + u8 *src; + int len; + int i; + //int off; + + if (!del) + return FALSE; + +#if 0 + off = (u8*)del->children[0] - del->data; + for (i = 0; i < del->child_count; i++) { + del_ie = del->children[i]; + + printf ("%2d %4d ", i, off); + off += del_ie->length; + + if (del_ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", del_ie->length); + break; + } + + ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + printf (" (%d)\n", del_ie->length); + } + printf ("total = %d\n", off); + printf ("\n"); +#endif + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + //printf ("\n"); + + del_ie = del->children[del_num]; + + src = (u8*) del_ie + del_ie->length; + dst = (u8*) del_ie; + len = del->header->index_length + 24 - (src - del->data); + + //printf ("src = %d\n", src - del->data); + //printf ("dst = %d\n", dst - del->data); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + del->header->index_length -= src - dst; + del->child_count--; + + dst += len; + len = del->data_len - del->header->index_length - 24; + + //printf ("dst = %d\n", dst - del->data); + //printf ("len = %d\n", len); + + memset (dst, 0, len); + + src = (u8*) (&del->children[del_num+1]); + dst = (u8*) (&del->children[del_num]); + len = (del->child_count - del_num) * sizeof (INDEX_ENTRY*); + + //printf ("src = %d\n", src - (u8*) del->children); + //printf ("dst = %d\n", dst - (u8*) del->children); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + src = (u8*) (&del->sub_nodes[del_num+1]); + dst = (u8*) (&del->sub_nodes[del_num]); + len = (del->child_count - del_num) * sizeof (struct ntfs_dt*); + + //printf ("src = %d\n", src - (u8*) del->children); + //printf ("dst = %d\n", dst - (u8*) del->children); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + //printf ("del_num = %d\n", del_num); + for (i = del_num; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_ie->length); + + if (!ntfs_dt_alloc_children2 (del, del->child_count)) + return FALSE; + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + +#if 0 + off = (u8*)del->children[0] - del->data; + for (i = 0; i < del->child_count; i++) { + del_ie = del->children[i]; + + printf ("%2d %4d ", i, off); + off += del_ie->length; + + if (del_ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", del_ie->length); + break; + } + + ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + printf (" (%d)\n", del_ie->length); + } + printf ("total = %d\n", off); + printf ("\n"); +#endif + + del->changed = TRUE; + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); + return TRUE; +} + +/** + * ntfs_dt_root_add + */ +static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) +{ + FILE_NAME_ATTR *file; + struct ntfs_dt *suc; + int suc_num; int need; int space; u8 *attr; @@ -1766,16 +2614,22 @@ static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY u8 *dst; int len; - if (!parent || !ie) + if (!add || !add_ie) return 0; - root = (INDEX_ROOT*) parent->data; + //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); + //printf ("\n"); - utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); - printf ("\n"); + need = add_ie->length; + space = ntfs_mft_free_space (add->dir); - need = ie->length; - space = ntfs_mft_free_space (parent->dir); + file = &add_ie->key.file_name; + + suc = ntfs_dt_find3 (add, file->file_name, file->file_name_length, &suc_num); + if (!suc) + return 0; + + // hmm, suc == add printf ("need %d, have %d\n", need, space); if (need > space) { @@ -1783,88 +2637,108 @@ static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY return 0; } - attr = malloc (parent->data_len + need); + attr = malloc (add->data_len + need); - src = parent->data; + src = add->data; dst = attr; - len = root->index.entries_offset + 16; + len = add->header->entries_offset + 16; memcpy (dst, src, len); dst += len; - src = (u8*) ie; - len = ie->length; + src = (u8*) add_ie; + len = add_ie->length; memcpy (dst, src, len); dst += len; - src = (u8*) parent->children[index_num]; - len = parent->data + parent->data_len - src; + src = (u8*) suc->children[suc_num]; + len = add->data + add->data_len - src; memcpy (dst, src, len); - free (parent->data); - parent->data = attr; - parent->data_len += need; + free (add->data); + add->data = attr; + add->data_len += need; - root = (INDEX_ROOT*) parent->data; - root->index.index_length = parent->data_len - 16; - root->index.allocated_size = parent->data_len - 16; + add->header->index_length = add->data_len - 16; + add->header->allocated_size = add->data_len - 16; - utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); - printf ("\n"); + ntfs_mft_resize_resident (add->dir->inode, AT_INDEX_ROOT, I30, 4, add->data, add->data_len); - ntfs_mft_resize_resident (parent->dir->inode, AT_INDEX_ROOT, I30, 4, parent->data, parent->data_len); - - return 0; -} - -/** - * ntfs_dt_add - */ -static int ntfs_dt_add (struct ntfs_dt *parent, INDEX_ENTRY *ie) -{ - FILE_NAME_ATTR *file; - struct ntfs_dt *dt; - int index_num = -1; - - if (!ie) - return 0; - - file = &ie->key.file_name; - - dt = ntfs_dt_find3 (parent, file->file_name, file->file_name_length, &index_num); - if (!dt) - return 0; - - //printf ("dt = %p, index = %d\n", dt, index_num); - //ntfs_ie_dump (dt->children[index_num]); - //utils_dump_mem ((u8*)dt->children[index_num], 0, dt->children[index_num]->length, DM_DEFAULTS); + //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); //printf ("\n"); - if (0) ntfs_dt_add_alloc (dt, index_num, ie); - if (0) ntfs_dt_add_root (dt->dir->index, 0, ie); - + printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, add->dir->inode->mft_no); return 0; } /** - * ntfs_dt_add2 + * ntfs_dt_alloc_add */ -static int ntfs_dt_add2 (INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs_dt *ded) +static int ntfs_dt_alloc_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) { - if (!ie || !suc) - return -1; + FILE_NAME_ATTR *file; + struct ntfs_dt *suc_dt; + int suc_num; + int need; + int space; + u8 *src; + u8 *dst; + int len; - if (ntfs_dt_root (suc)) - ntfs_dt_add_root (suc, suc_num, ie); - else - ntfs_dt_add_alloc (suc, suc_num, ie); + if (!add || !add_ie) + return 0; + need = add_ie->length; + space = add->data_len - add->header->index_length - 24; + + file = &add_ie->key.file_name; + + suc_dt = ntfs_dt_find3 (add, file->file_name, file->file_name_length, &suc_num); + if (!suc_dt) + return 0; + + // hmm, suc_dt == add + + printf ("need %d, have %d\n", need, space); + if (need > space) { + printf ("no room"); + return 0; + } + + //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); + //printf ("\n"); + + src = (u8*) suc_dt->children[suc_num]; + dst = src + need; + len = add->data + add->data_len - src - space; + //printf ("src = %d\n", src - add->data); + //printf ("dst = %d\n", dst - add->data); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + dst = src; + src = (u8*) add_ie; + len = need; + + memcpy (dst, src, len); + + add->header->index_length += len; + + dst = add->data + add->header->index_length + 24; + len = add->data_len - add->header->index_length - 24; + + memset (dst, 0, len); + + //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); + //printf ("\n"); + + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, add->dir->inode->mft_no, add->vcn, add->vcn + (add->dir->index_size>>9) - 1); return 0; } - /** * ntfs_dt_remove_alloc */ @@ -2228,6 +3102,387 @@ close: return res; } +/** + * ntfs_dt_add_alloc + */ +static int ntfs_dt_add_alloc (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) +{ + INDEX_BLOCK *block; + INDEX_ENTRY *entry; + int need; + int space; + u8 *src; + u8 *dst; + int len; + + if (!parent || !ie) + return 0; + + block = (INDEX_BLOCK*) parent->data; + + need = ie->length; + space = parent->data_len - block->index.index_length - 24; + + printf ("need %d, have %d\n", need, space); + if (need > space) { + printf ("no room"); + return 0; + } + + //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); + //printf ("\n"); + + src = (u8*) parent->children[index_num]; + dst = src + need; + len = parent->data + parent->data_len - src - space; + //printf ("src = %d\n", src - parent->data); + //printf ("dst = %d\n", dst - parent->data); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + dst = src; + src = (u8*) ie; + len = need; + + memcpy (dst, src, len); + + block->index.index_length += len; + + dst = parent->data + block->index.index_length + 24; + len = parent->data_len - block->index.index_length - 24; + + memset (dst, 0, len); + + //realloc children, sub_nodes + ntfs_dt_alloc_children2 (parent, parent->child_count + 1); + + // regen children pointers + parent->child_count = 0; + + src = parent->data + 0x18 + parent->header->entries_offset; + len = parent->data_len - 0x18 - parent->header->entries_offset; + + while (src < (parent->data + parent->data_len)) { + entry = (INDEX_ENTRY*) src; + + parent->children[parent->child_count] = entry; + parent->child_count++; + + if (entry->flags & INDEX_ENTRY_END) + break; + + src += entry->length; + } + printf ("count = %d\n", parent->child_count); + + src = (u8*) &parent->sub_nodes[index_num+parent->child_count-1]; + dst = (u8*) &parent->sub_nodes[index_num]; + len = (parent->child_count - index_num - 1) * sizeof (struct ntfs_dt*); + + memmove (dst, src, len); + + //insert sub_node pointer + parent->sub_nodes[index_num] = child; + + //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); + //printf ("\n"); + return 0; +} + +/** + * ntfs_dt_add_root + */ +static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) +{ + INDEX_ROOT *root; + INDEX_ENTRY *entry; + int need; + int space; + u8 *attr; + u8 *src; + u8 *dst; + int len; + + if (!parent || !ie) + return 0; + + root = (INDEX_ROOT*) parent->data; + + utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); + printf ("\n"); + + need = ie->length; + space = ntfs_mft_free_space (parent->dir); + + printf ("need %d, have %d\n", need, space); + if (need > space) { + printf ("no room"); + return 0; + } + + attr = malloc (parent->data_len + need); + + src = parent->data; + dst = attr; + len = root->index.entries_offset + 16; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) ie; + len = ie->length; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) parent->children[index_num]; + len = parent->data + parent->data_len - src; + + memcpy (dst, src, len); + + free (parent->data); + parent->data = attr; + parent->data_len += need; + + root = (INDEX_ROOT*) parent->data; + root->index.index_length = parent->data_len - 16; + root->index.allocated_size = parent->data_len - 16; + + utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); + printf ("\n"); + + ntfs_mft_resize_resident (parent->dir->inode, AT_INDEX_ROOT, I30, 4, parent->data, parent->data_len); + + //realloc children, sub_nodes + ntfs_dt_alloc_children2 (parent, parent->child_count + 1); + + // regen children pointers + parent->child_count = 0; + + src = parent->data + 0x18 + parent->header->entries_offset; + len = parent->data_len - 0x18 - parent->header->entries_offset; + + while (src < (parent->data + parent->data_len)) { + entry = (INDEX_ENTRY*) src; + + parent->children[parent->child_count] = entry; + parent->child_count++; + + if (entry->flags & INDEX_ENTRY_END) + break; + + src += entry->length; + } + printf ("count = %d\n", parent->child_count); + + src = (u8*) &parent->sub_nodes[index_num+parent->child_count-1]; + dst = (u8*) &parent->sub_nodes[index_num]; + len = (parent->child_count - index_num - 1) * sizeof (struct ntfs_dt*); + + memmove (dst, src, len); + + //insert sub_node pointer + parent->sub_nodes[index_num] = child; + + return 0; +} + +/** + * ntfs_dt_add + */ +static int ntfs_dt_add (struct ntfs_dt *parent, INDEX_ENTRY *ie) +{ + FILE_NAME_ATTR *file; + struct ntfs_dt *dt; + int index_num = -1; + + if (!ie) + return 0; + + file = &ie->key.file_name; + + dt = ntfs_dt_find3 (parent, file->file_name, file->file_name_length, &index_num); + if (!dt) + return 0; + + //printf ("dt = %p, index = %d\n", dt, index_num); + //ntfs_ie_dump (dt->children[index_num]); + //utils_dump_mem ((u8*)dt->children[index_num], 0, dt->children[index_num]->length, DM_DEFAULTS); + //printf ("\n"); + + if (0) ntfs_dt_add_alloc (dt, index_num, ie, NULL); + if (0) ntfs_dt_add_root (dt->dir->index, 0, ie, NULL); + + return 0; +} + +/** + * ntfs_dt_add2 + */ +static int ntfs_dt_add2 (INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs_dt *ded) +{ + int need; + int space; + int median; + struct ntfs_dt *new; + struct ntfs_dt *chl; + INDEX_ENTRY *med_ie; + FILE_NAME_ATTR *file; + VCN vcn; + //int i; + + if (!ie || !suc) + return -1; + + printf ("\n"); + printf (BOLD YELLOW "Add key to leaf\n" END); + + //utils_dump_mem (suc->data, 0, suc->data_len, DM_DEFAULTS); + + chl = NULL; +ascend: + //XXX replace with while/break? + +#if 0 + for (; ded; ded = ded->sub_nodes[0]) { + printf ("\tded vcn = %lld\n", ded->vcn); + } +#endif + + /* + * ADD + * room in current node? + * yes, add, done + * no, split, ascend + */ + need = ie->length; + + if (ntfs_dt_root (suc)) + space = ntfs_dt_freespace_root (suc); + else + space = ntfs_dt_freespace_alloc (suc); + + printf ("\tneed %d\n", need); + printf ("\tspace %d\n", space); + + if (space >= need) { + if (ntfs_dt_root (suc)) + ntfs_dt_add_root (suc, suc_num, ie, chl); + else + ntfs_dt_add_alloc (suc, suc_num, ie, chl); + goto done; + } + + /* + * SPLIT + * any dead? + * yes reuse + * no alloc + */ + if (ded) { + new = ded; + vcn = ded->vcn; + ded = ded->sub_nodes[0]; + printf ("\treusing vcn %lld\n", new->vcn); + } else { + /* + * ALLOC + * any unused records? + * yes, enable first + * no, extend + */ + /* + * ENABLE + * modify bitmap + * init indx record + */ + /* + * EXTEND + * room in bitmap + * yes, do nothing + * no, extend bitmap + * extend alloc + */ + /* + * EXTEND BITMAP + * extend bitmap + * init bitmap + */ + } + + printf ("\tnode has %d children\n", suc->child_count); + + // initialise new node + ntfs_dt_initialise (new, vcn); + + // find median key + median = (suc->child_count+1) / 2; + med_ie = ntfs_ie_copy (suc->children[median]); + file = &med_ie->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + + //printf ("suc key count = %d\n", suc->child_count); + //printf ("new key count = %d\n", new->child_count); + + //printf ("median's child = %p\n", suc->sub_nodes[median]); + // need to pass the child when ascending + chl = suc->sub_nodes[median]; + + // transfer keys + if (ntfs_dt_transfer (suc, new, 0, median-1) < 0) + goto done; + + //printf ("suc key count = %d\n", suc->child_count); + //printf ("new key count = %d\n", new->child_count); + + //file = &suc->children[0]->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + + // can this be a root node? + if (ntfs_dt_root (suc)) + ntfs_dt_root_remove (suc, 0); + else + ntfs_dt_alloc_remove (suc, 0); + + //file = &suc->children[0]->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + //printf ("suc key count = %d\n", suc->child_count); + //printf ("new key count = %d\n", new->child_count); + + // remove the median key + + // split when median has children + // median child given to new ! + // median child is new + // ascend + + med_ie = ntfs_ie_set_vcn (med_ie, new->vcn); + if (!med_ie) + goto done; + + //printf ("median child = %lld\n", ntfs_ie_get_vcn (med_ie)); + //printf ("new's vcn = %lld\n", new->vcn); + + // adjust parents + // attach new to median + // escape clause for root node? + // goto ascend + + // ie = insert + // child = child + // suc = successor + // suc_num = insert point + + ie = med_ie; + suc = suc->parent; + suc_num = 0; + + printf ("\n"); + printf (BOLD YELLOW "Ascend\n" END); + goto ascend; +done: + return 0; +} + + /** * ntfsrm */ @@ -2269,335 +3524,6 @@ static int ntfsrm (ntfs_volume *vol, char *name) return 0; } - -/** - * ntfsinfo_time_to_str() - - * @sle_ntfs_clock: on disk time format in 100ns units since 1st jan 1601 - * in little-endian format - * - * Return char* in a format 'Thu Jan 1 00:00:00 1970'. - * No need to free the returned memory. - * - * Example of usage: - * char *time_str = ntfsinfo_time_to_str( - * sle64_to_cpu(standard_attr->creation_time)); - * printf("\tFile Creation Time:\t %s", time_str); - */ -static const char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) -{ - time_t unix_clock = ntfs2utc(sle64_to_cpu(sle_ntfs_clock)); - if (sle_ntfs_clock == 0) - return "none\n"; - else - return ctime(&unix_clock); -} - -/** - * ntfs_ie_dump - */ -static void ntfs_ie_dump (INDEX_ENTRY *ie) -{ - if (!ie) - return; - - printf ("________________________________________________"); - printf ("\n"); - utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); - - printf ("MFT Ref: 0x%llx\n", ie->indexed_file); - printf ("length: %d\n", ie->length); - printf ("keylen: %d\n", ie->key_length); - printf ("flags: "); - if (ie->flags & INDEX_ENTRY_NODE) printf ("NODE "); - if (ie->flags & INDEX_ENTRY_END) printf ("END"); - if (!(ie->flags & (INDEX_ENTRY_NODE | INDEX_ENTRY_END))) printf ("none"); - printf ("\n"); - printf ("reserved 0x%04x\n", ie->reserved); - if (ie->key_length > 0) { - printf ("mft parent: 0x%llx\n", ie->key.file_name.parent_directory); - - printf ("ctime: %s", ntfsinfo_time_to_str(ie->key.file_name.creation_time)); - printf ("dtime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_data_change_time)); - printf ("mtime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_mft_change_time)); - printf ("atime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_access_time)); - printf ("alloc size: %lld\n", ie->key.file_name.allocated_size); - printf ("data size: %lld\n", ie->key.file_name.data_size); - printf ("file flags: 0x%04x\n", ie->key.file_name.file_attributes); - printf ("reserved: 0x%04x\n", ie->key.file_name.reserved); printf ("name len: %d\n", ie->key.file_name.file_name_length); - if (ie->key.file_name.file_name_length > 0) { - int i, r; - printf ("name type: %d\n", ie->key.file_name.file_name_type); - printf ("name: "); - ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); - printf ("\n"); - r = ATTR_SIZE (2 * (ie->key.file_name.file_name_length+1)) - (2 * (ie->key.file_name.file_name_length+1)); - if (r > 0) { - u8 *ptr; - printf ("padding: "); - ptr = (u8*) (ie->key.file_name.file_name + ie->key.file_name.file_name_length); - for (i = 0; i < r; i++, ptr++) - printf ("0x%02x ", *ptr); - printf ("\n"); - } - } - } - if (ie->flags == INDEX_ENTRY_NODE) { - printf ("child vcn = %lld\n", ntfs_ie_get_vcn (ie)); - } -} - -/** - * ntfs_ie_create - */ -static INDEX_ENTRY * ntfs_ie_create (void) -{ - int length; - INDEX_ENTRY *ie; - - length = 16; - ie = malloc (length); - if (!ie) - return NULL; - - ie->indexed_file = 0; - ie->length = length; - ie->key_length = 0; - ie->flags = INDEX_ENTRY_END; - ie->reserved = 0; - return ie; -} - -/** - * ntfs_ie_copy - */ -static INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie) -{ - INDEX_ENTRY *copy = NULL; - - if (!ie) - return NULL; - - copy = malloc (ie->length); - if (!copy) - return NULL; - memcpy (copy, ie, ie->length); - - return copy; -} - -/** - * ntfs_ie_set_vcn - */ -static INDEX_ENTRY * ntfs_ie_set_vcn (INDEX_ENTRY *ie, VCN vcn) -{ - if (!ie) - return 0; - - if (!(ie->flags & INDEX_ENTRY_NODE)) { - ie->length += 8; - ie = realloc (ie, ie->length); - if (!ie) - return NULL; - - ie->flags |= INDEX_ENTRY_NODE; - } - - *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; - return ie; -} - -/** - * ntfs_ie_remove_vcn - */ -static INDEX_ENTRY * ntfs_ie_remove_vcn (INDEX_ENTRY *ie) -{ - if (!ie) - return NULL; - if (!(ie->flags & INDEX_ENTRY_NODE)) - return ie; - - ie->length -= 8; - ie->flags &= ~INDEX_ENTRY_NODE; - ie = realloc (ie, ie->length); - return ie; -} - -/** - * ntfs_ie_set_name - */ -static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype) -{ - FILE_NAME_ATTR *file; - int klen; - int need; - VCN vcn = 0; - - if (!ie || !name) - return NULL; - - /* - * INDEX_ENTRY - * MFT_REF indexed_file; - * u16 length; - * u16 key_length; - * INDEX_ENTRY_FLAGS flags; - * u16 reserved; - * - * FILENAME - * MFT_REF parent_directory; - * s64 creation_time; - * s64 last_data_change_time; - * s64 last_mft_change_time; - * s64 last_access_time; - * s64 allocated_size; - * s64 data_size; - * FILE_ATTR_FLAGS file_attributes; - * u32 reserved; - * u8 file_name_length; - * FILE_NAME_TYPE_FLAGS file_name_type; - * ntfschar file_name[l]; - * u8 reserved[n] - * - * VCN vcn; - */ - - file = &ie->key.file_name; - - klen = ATTR_SIZE (ie->key_length); - need = ATTR_SIZE (sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar))); - - //printf ("ilen = %d\n", ie->length); - //printf ("klen = %d\n", klen); - //printf ("need = %d\n", need); - - if (ie->flags & INDEX_ENTRY_NODE) - vcn = ntfs_ie_get_vcn (ie); - - ie->length = 16 + need; - ie->key_length = sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar)); - ie = realloc (ie, ie->length + ie->key_length); - if (!ie) - return NULL; - - memcpy (ie->key.file_name.file_name, name, namelen * 2); - - if (ie->flags & INDEX_ENTRY_NODE) - ie = ntfs_ie_set_vcn (ie, vcn); - - ie->key.file_name.file_name_length = namelen; - ie->key.file_name.file_name_type = nametype; - ie->flags &= ~INDEX_ENTRY_END; - - return ie; -} - -/** - * ntfs_ie_remove_name - */ -static INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) -{ - VCN vcn; - - if (!ie) - return NULL; - if (ie->key_length == 0) - return ie; - - if (ie->flags & INDEX_ENTRY_NODE) - vcn = ntfs_ie_get_vcn (ie); - - ie->length -= ATTR_SIZE (ie->key_length); - ie->key_length = 0; - ie->flags |= INDEX_ENTRY_END; - - ie = realloc (ie, ie->length); - if (!ie) - return NULL; - - if (ie->flags & INDEX_ENTRY_NODE) - ie = ntfs_ie_set_vcn (ie, vcn); - return ie; -} - -/** - * ntfs_ie_test - */ -static int ntfs_ie_test (void) -{ - INDEX_ENTRY *ie1 = NULL; - INDEX_ENTRY *ie2 = NULL; - int namelen = 0; - ntfschar *name = NULL; - - if (1) { - ie1 = ntfs_ie_create(); - //ntfs_ie_dump (ie1); - } - - if (0) { - ie2 = ntfs_ie_copy (ie1); - ntfs_ie_dump (ie2); - } - - if (1) { - namelen = ntfs_mbstoucs("richard", &name, 0); - ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); - free (name); - name = NULL; - ntfs_ie_dump (ie1); - } - - if (1) { - namelen = ntfs_mbstoucs("richard2", &name, 0); - ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); - free (name); - name = NULL; - ntfs_ie_dump (ie1); - } - - if (1) { - ie1 = ntfs_ie_remove_name (ie1); - ntfs_ie_dump (ie1); - } - - if (1) { - ie1 = ntfs_ie_set_vcn (ie1, 1234); - ntfs_ie_dump (ie1); - } - - if (1) { - ie1 = ntfs_ie_remove_vcn (ie1); - ntfs_ie_dump (ie1); - } - - ie1->indexed_file = 1234; - ie1->key.file_name.parent_directory = 5; - ie1->key.file_name.creation_time = utc2ntfs (time(NULL)); - ie1->key.file_name.last_data_change_time = utc2ntfs (time(NULL)); - ie1->key.file_name.last_mft_change_time = utc2ntfs (time(NULL)); - ie1->key.file_name.last_access_time = utc2ntfs (time(NULL)); - ie1->key.file_name.allocated_size = 4096; - ie1->key.file_name.data_size = 3973; - - //ntfs_ie_dump (ie1); - free (name); - free (ie1); - free (ie2); - return 0; -} - -/** - * ntfs_ie_get_vcn - */ -static VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie) -{ - if (!ie) - return -1; - - return *((VCN*) ((u8*) ie + ie->length - 8)); -} - - /** * ntfs_index_dump_alloc */ @@ -2695,511 +3621,6 @@ static int ntfs_index_dump (ntfs_inode *inode) return 0; } - -/** - * ntfs_dt_root_replace - */ -static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) -{ - u8 *src; - u8 *dst; - u8 *attr; - int len; - int i; - - if (!del || !del_ie || !suc_ie) - return FALSE; - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - //printf ("\n"); - - attr = malloc (del->data_len + suc_ie->length - del_ie->length); - - dst = attr; - src = del->data; - len = (u8*) del_ie - del->data; - - memcpy (dst, src, len); - - dst += len; - src = (u8*) suc_ie; - len = suc_ie->length; - - memcpy (dst, src, len); - - dst += len; - src = (u8*) del_ie + del_ie->length; - len = del->data_len + (del->data - (u8*) del_ie) - del_ie->length; - - memcpy (dst, src, len); - - src = (u8*) del->data; - dst = attr; - - len = del->data_len + suc_ie->length - del_ie->length; - free (del->data); - del->data = attr; - del->data_len = len; - - ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); - - //utils_dump_mem (attr, 0, del->data_len, DM_DEFAULTS); - - //printf ("\n"); - //printf (BOLD YELLOW "Adjust children\n" END); - //for (i = 0; i < del->child_count; i++) - // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); - //printf ("\n"); - - len = suc_ie->length - del_ie->length; - //printf ("src = %p, dst = %p, len = %d\n", src, dst, len); fflush (stdout); - - for (i = 0; i < del->child_count; i++) - del->children[i] = (INDEX_ENTRY*) (dst + ((u8*) del->children[i] - src)); - - for (i = del_num+1; i < del->child_count; i++) - del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); - - //for (i = 0; i < del->child_count; i++) - // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); - //printf ("\n"); - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - //printf ("\n"); - - printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); - return TRUE; -} - -/** - * ntfs_dt_alloc_replace - */ -static BOOL ntfs_dt_alloc_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) -{ - u8 *src; - u8 *dst; - int len; - int i; - - if (!del || !del_ie || !suc_ie) - return FALSE; - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - - src = (u8*) del_ie + del_ie->length; - dst = (u8*) del_ie + suc_ie->length; - len = del->header->index_length + 24 + (del->data - src); - //printf ("src = %d\n", src - del->data); - //printf ("dst = %d\n", dst - del->data); - //printf ("len = %d\n", len); - - if (src != dst) - memmove (dst, src, len); - - src = (u8*) suc_ie; - dst = (u8*) del_ie; - len = suc_ie->length; - - memcpy (dst, src, len); - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - - del->header->index_length += suc_ie->length - del_ie->length; - - dst = del->data + del->header->index_length + 24; - len = del->data_len - del->header->index_length - 24; - - memset (dst, 0, len); - - //for (i = 0; i < del->child_count; i++) - // printf ("Child %d %p\n", i, del->children[i]); - //printf ("\n"); - - len = suc_ie->length - del_ie->length; - //printf ("len = %d\n", len); - - for (i = del_num+1; i < del->child_count; i++) - del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); - - //for (i = 0; i < del->child_count; i++) - // printf ("Child %d %p\n", i, del->children[i]); - //printf ("\n"); - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + 4); - return TRUE; -} - - -/** - * ntfs_dt_root_remove - */ -static BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) -{ - INDEX_ENTRY *del_ie = NULL; - u8 *src; - u8 *dst; - int len; - int i; - //int off; - - if (!del) - return FALSE; - - //utils_dump_mem (del->data, 0, del->data_len, DM_RED); - //printf ("\n"); - -#if 0 - off = (u8*) del->children[0] - del->data; - for (i = 0; i < del->child_count; i++) { - del_ie = del->children[i]; - - printf ("%2d %4d ", i+1, off); - off += del_ie->length; - - if (del_ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", del_ie->length); - break; - } - - ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); - printf (" (%d)\n", del_ie->length); - } - printf ("total = %d\n", off); -#endif - - del_ie = del->children[del_num]; - - src = (u8*) del_ie + del_ie->length; - dst = (u8*) del_ie; - len = del->header->index_length + 16 - (src - del->data); - - //printf ("src = %d\n", src - del->data); - //printf ("dst = %d\n", dst - del->data); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - del->data_len -= del_ie->length; - del->child_count--; - - del->header->index_length = del->data_len - 16; - del->header->allocated_size = del->data_len - 16; - - ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); - del->data = realloc (del->data, del->data_len); - - //utils_dump_mem (del->data, 0, del->data_len, DM_GREEN | DM_RED); - - src = (u8*) (&del->children[del_num+1]); - dst = (u8*) (&del->children[del_num]); - len = (del->child_count - del_num) * sizeof (INDEX_ENTRY*); - - //printf ("src = %d\n", src - (u8*) del->children); - //printf ("dst = %d\n", dst - (u8*) del->children); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - src = (u8*) (&del->sub_nodes[del_num+1]); - dst = (u8*) (&del->sub_nodes[del_num]); - len = (del->child_count - del_num) * sizeof (struct ntfs_dt*); - - //printf ("src = %d\n", src - (u8*) del->children); - //printf ("dst = %d\n", dst - (u8*) del->children); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - //printf ("del_num = %d\n", del_num); - for (i = del_num; i < del->child_count; i++) - del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_ie->length); - - if (!ntfs_dt_alloc_children2 (del, del->child_count)) - return FALSE; - -#if 0 - off = (u8*) del->children[0] - del->data; - for (i = 0; i < del->child_count; i++) { - del_ie = del->children[i]; - - printf ("%2d %4d ", i+1, off); - off += del_ie->length; - - if (del_ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", del_ie->length); - break; - } - - ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); - printf (" (%d)\n", del_ie->length); - } - printf ("total = %d\n", off); -#endif - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - - printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); - return TRUE; -} - -/** - * ntfs_dt_alloc_remove - */ -static BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) -{ - INDEX_ENTRY *del_ie = NULL; - u8 *dst; - u8 *src; - int len; - int i; - //int off; - - if (!del) - return FALSE; - -#if 0 - off = (u8*)del->children[0] - del->data; - for (i = 0; i < del->child_count; i++) { - del_ie = del->children[i]; - - printf ("%2d %4d ", i, off); - off += del_ie->length; - - if (del_ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", del_ie->length); - break; - } - - ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); - printf (" (%d)\n", del_ie->length); - } - printf ("total = %d\n", off); - printf ("\n"); -#endif - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - //printf ("\n"); - - del_ie = del->children[del_num]; - - src = (u8*) del_ie + del_ie->length; - dst = (u8*) del_ie; - len = del->header->index_length + 24 - (src - del->data); - - //printf ("src = %d\n", src - del->data); - //printf ("dst = %d\n", dst - del->data); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - del->header->index_length -= src - dst; - del->child_count--; - - dst += len; - len = del->data_len - del->header->index_length - 24; - - //printf ("dst = %d\n", dst - del->data); - //printf ("len = %d\n", len); - - memset (dst, 0, len); - - src = (u8*) (&del->children[del_num+1]); - dst = (u8*) (&del->children[del_num]); - len = (del->child_count - del_num) * sizeof (INDEX_ENTRY*); - - //printf ("src = %d\n", src - (u8*) del->children); - //printf ("dst = %d\n", dst - (u8*) del->children); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - src = (u8*) (&del->sub_nodes[del_num+1]); - dst = (u8*) (&del->sub_nodes[del_num]); - len = (del->child_count - del_num) * sizeof (struct ntfs_dt*); - - //printf ("src = %d\n", src - (u8*) del->children); - //printf ("dst = %d\n", dst - (u8*) del->children); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - //printf ("del_num = %d\n", del_num); - for (i = del_num; i < del->child_count; i++) - del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_ie->length); - - if (!ntfs_dt_alloc_children2 (del, del->child_count)) - return FALSE; - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - -#if 0 - off = (u8*)del->children[0] - del->data; - for (i = 0; i < del->child_count; i++) { - del_ie = del->children[i]; - - printf ("%2d %4d ", i, off); - off += del_ie->length; - - if (del_ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", del_ie->length); - break; - } - - ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); - printf (" (%d)\n", del_ie->length); - } - printf ("total = %d\n", off); - printf ("\n"); -#endif - - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + 4); - return TRUE; -} - - -/** - * ntfs_dt_root_add - */ -static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) -{ - FILE_NAME_ATTR *file; - struct ntfs_dt *suc; - int suc_num; - int need; - int space; - u8 *attr; - u8 *src; - u8 *dst; - int len; - - if (!add || !add_ie) - return 0; - - //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); - //printf ("\n"); - - need = add_ie->length; - space = ntfs_mft_free_space (add->dir); - - file = &add_ie->key.file_name; - - suc = ntfs_dt_find3 (add, file->file_name, file->file_name_length, &suc_num); - if (!suc) - return 0; - - // hmm, suc == add - - printf ("need %d, have %d\n", need, space); - if (need > space) { - printf ("no room"); - return 0; - } - - attr = malloc (add->data_len + need); - - src = add->data; - dst = attr; - len = add->header->entries_offset + 16; - - memcpy (dst, src, len); - - dst += len; - src = (u8*) add_ie; - len = add_ie->length; - - memcpy (dst, src, len); - - dst += len; - src = (u8*) suc->children[suc_num]; - len = add->data + add->data_len - src; - - memcpy (dst, src, len); - - free (add->data); - add->data = attr; - add->data_len += need; - - add->header->index_length = add->data_len - 16; - add->header->allocated_size = add->data_len - 16; - - ntfs_mft_resize_resident (add->dir->inode, AT_INDEX_ROOT, I30, 4, add->data, add->data_len); - - //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); - //printf ("\n"); - - printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, add->dir->inode->mft_no); - return 0; -} - -/** - * ntfs_dt_alloc_add - */ -static int ntfs_dt_alloc_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) -{ - FILE_NAME_ATTR *file; - struct ntfs_dt *suc_dt; - int suc_num; - int need; - int space; - u8 *src; - u8 *dst; - int len; - - if (!add || !add_ie) - return 0; - - need = add_ie->length; - space = add->data_len - add->header->index_length - 24; - - file = &add_ie->key.file_name; - - suc_dt = ntfs_dt_find3 (add, file->file_name, file->file_name_length, &suc_num); - if (!suc_dt) - return 0; - - // hmm, suc_dt == add - - printf ("need %d, have %d\n", need, space); - if (need > space) { - printf ("no room"); - return 0; - } - - //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); - //printf ("\n"); - - src = (u8*) suc_dt->children[suc_num]; - dst = src + need; - len = add->data + add->data_len - src - space; - //printf ("src = %d\n", src - add->data); - //printf ("dst = %d\n", dst - add->data); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - dst = src; - src = (u8*) add_ie; - len = need; - - memcpy (dst, src, len); - - add->header->index_length += len; - - dst = add->data + add->header->index_length + 24; - len = add->data_len - add->header->index_length - 24; - - memset (dst, 0, len); - - //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); - //printf ("\n"); - - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, add->dir->inode->mft_no, add->vcn, add->vcn + 4); - return 0; -} - - /** * ntfs_file_add */ @@ -3285,6 +3706,7 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) struct ntfs_dir *root_dir = NULL; struct ntfs_dir *find_dir = NULL; + struct ntfs_dt *top = NULL; struct ntfs_dt *del = NULL; struct ntfs_dt *suc = NULL; struct ntfs_dt *old = NULL; @@ -3316,6 +3738,8 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) goto done; } + //ntfs_dt_print (find_dir->index, 0); + if (rindex (name, PATH_SEP)) name = rindex (name, PATH_SEP) + 1; @@ -3329,6 +3753,10 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) goto done; } + top = del->dir->index; + ntfs_dt_find_all (top); + //ntfs_dt_print (top, 0); + del_ie = del->children[del_num]; //utils_dump_mem ((u8*)del_ie, 0, del_ie->length, DM_DEFAULTS); //printf ("\n"); @@ -3338,6 +3766,14 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) * Continue the delete as if the successor had been deleted. */ + /* + for (i = 0; i < top->child_count; i++) { + par_ie = top->children[i]; + file = &par_ie->key.file_name; printf ("\ttop node, key %d: ", i); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + printf ("\tvcn = %lld\n", ntfs_ie_get_vcn (par_ie)); + } + */ + if (del->header->flags & INDEX_NODE) { printf (BOLD YELLOW "Replace key with its successor:\n" END); @@ -3377,6 +3813,8 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) del_ie = suc->children[suc_num]; } + //ntfs_dt_print (top, 0); + /* * Now we have the simpler case of deleting from a leaf node. * If this step creates an empty node, we have more to do. @@ -3426,11 +3864,20 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) goto freedts; } + //ntfs_dt_print (top, 0); printf ("\n"); //utils_dump_mem (par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); //printf ("\n"); + /* + for (i = 0; i < top->child_count; i++) { + par_ie = top->children[i]; + file = &par_ie->key.file_name; printf ("\ttop node, key %d: ", i); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + printf ("\tvcn = %lld\n", ntfs_ie_get_vcn (par_ie)); + } + */ + // find if parent has left siblings if (par->children[par_num]->flags & INDEX_ENTRY_END) { printf (BOLD YELLOW "Swap the children of the parent and its left sibling\n" END); @@ -3463,9 +3910,11 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) if (ntfs_dt_root (par)) printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, par->dir->inode->mft_no); else - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, par->dir->inode->mft_no, par->vcn, par->vcn + 4); + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, par->dir->inode->mft_no, par->vcn, par->vcn + (par->dir->index_size>>9) - 1); } + //ntfs_dt_print (top, 0); + //printf ("\n"); //utils_dump_mem (par->data, 0, par->data_len, DM_DEFAULTS); @@ -3487,20 +3936,42 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) par->sub_nodes[par_num] = NULL; //ntfs_dt_print (ded, 8); +#if 0 + for (i = 0; i < par->child_count; i++) { + par_ie = par->children[i]; + file = &par_ie->key.file_name; printf ("\tdel node, key %d: ", i); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + printf ("\tvcn = %lld\n", ntfs_ie_get_vcn (par_ie)); + } +#endif + +#if 1 + //printf ("PAR: %p,%d\n", par, par_num); if (ntfs_dt_root (par)) ntfs_dt_root_remove (par, par_num); else ntfs_dt_alloc_remove (par, par_num); +#endif + //printf ("count = %d\n", par->child_count); + //utils_dump_mem (par->data, 0, par->data_len, DM_DEFAULTS); + //printf ("0x%x\n", (u8*)par->children[0] - par->data); +#if 0 + for (i = 0; i < par->child_count; i++) { + par_ie = par->children[i]; + file = &par_ie->key.file_name; printf ("\tadd node, key %d: ", i); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + printf ("\tvcn = %lld\n", ntfs_ie_get_vcn (par_ie)); + } +#endif + + //ntfs_dt_print (top, 0); printf ("\n"); + printf (BOLD YELLOW "Add childless parent\n" END); - file = &add_ie->key.file_name; - + file = &add_ie->key.file_name; printf ("\tadd name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); suc = NULL; suc_num = -1; - suc = ntfs_dt_find4 (find_dir->index, file->file_name, file->file_name_length, &suc_num); - - printf ("%p, %d\n", suc, suc_num); + suc = ntfs_dt_find4 (top, file->file_name, file->file_name_length, &suc_num); + //printf ("SUC: %p, %d\n", suc, suc_num); if (!suc) goto done; @@ -3509,7 +3980,7 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) // insert key into successor // if any new nodes are needed, reuse the preserved nodes - if (!ntfs_dt_add2 (del_ie, suc, suc_num, ded)) + if (!ntfs_dt_add2 (add_ie, suc, suc_num, ded)) goto done; // remove any unused nodes @@ -3521,7 +3992,6 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) // XXX commit will free list of spare dts // XXX reduce size of alloc - if (0) ntfs_dt_add2 (del_ie, suc, suc_num, ded); if (0) ntfs_dir_commit (find_dir); if (0) ntfs_dir_rollback (find_dir); @@ -3539,7 +4009,6 @@ done: return 0; } - /** * ntfs_test_bmp */ @@ -3572,6 +4041,7 @@ static int ntfs_test_bmp (ntfs_volume *vol, ntfs_inode *inode) return 0; } + /** * main - Begin here * @@ -3618,7 +4088,7 @@ int main (int argc, char *argv[]) if (0) result = ntfsrm (vol, opts.file); if (0) result = ntfs_ie_test(); if (0) result = ntfs_file_add (vol, opts.file); - if (0) result = ntfs_file_remove (vol, opts.file); + if (1) result = ntfs_file_remove (vol, opts.file); if (0) result = ntfs_test_bmp (vol, inode); done: From 6646895a6383f2bd3f05f915e5fba440afe10948 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 9 Aug 2004 16:36:18 +0000 Subject: [PATCH 1661/2994] move structs from .c (Logical change 1.484) --- ntfsprogs/ntfsrm.h | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/ntfsprogs/ntfsrm.h b/ntfsprogs/ntfsrm.h index b8d25b96..5938621b 100644 --- a/ntfsprogs/ntfsrm.h +++ b/ntfsprogs/ntfsrm.h @@ -27,6 +27,9 @@ #include "types.h" #include "layout.h" +/** + * struct options + */ struct options { char *device; /* Device/File to work with */ char *file; /* File to delete */ @@ -39,5 +42,66 @@ struct options { int nodirty; /* Do not mark volume dirty */ }; +/** + * struct ntfs_bmp + * a cache for either dir/$BITMAP, $MFT/$BITMAP or $Bitmap/$DATA + */ +struct ntfs_bmp { + ntfs_attr *attr; + u8 **data; + VCN *data_vcn; + int count; + //int cluster_size; +}; + +/** + * struct ntfs_dt + */ +struct ntfs_dt { + struct ntfs_dir *dir; + struct ntfs_dt *parent; + u8 *data; + int data_len; + int child_count; + INDEX_ENTRY **children; + struct ntfs_dt **sub_nodes; + INDEX_HEADER *header; + VCN vcn; + BOOL changed; +}; + +/** + * struct ntfs_dir + */ +struct ntfs_dir { + ntfs_volume *vol; + struct ntfs_dir *parent; + ntfschar *name; + int name_len; + struct ntfs_dt *index; + struct ntfs_dir **children; + int child_count; + MFT_REF mft_num; + struct mft_bitmap *bitmap; + ntfs_inode *inode; + ntfs_attr *iroot; + ntfs_attr *ialloc; + ntfs_attr *ibmp; + int index_size; +}; + + +#define RED "" +#define GREEN "" +#define YELLOW "" +#define BLUE "" +#define MAGENTA "" +#define CYAN "" +#define BOLD "" +#define END "" + +#define ROUND_UP(num,bound) (((num)+((bound)-1)) & ~((bound)-1)) +#define ATTR_SIZE(s) ROUND_UP(s,8) + #endif /* _NTFSRM_H_ */ From 1be6deedaf15245627cbad591ae347203a5e73b0 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 10 Aug 2004 10:45:07 +0000 Subject: [PATCH 1662/2994] deltaxcn will only go as high as (max_cluster-1) so the comparisons below were off by one (Logical change 1.485) --- libntfs/runlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index b1a09b46..369ea3a6 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -888,9 +888,9 @@ mpa_err: if (!attr->lowest_vcn) { VCN max_cluster; - max_cluster = (sle64_to_cpu(attr->allocated_size) + + max_cluster = ((sle64_to_cpu(attr->allocated_size) + vol->cluster_size - 1) >> - vol->cluster_size_bits; + vol->cluster_size_bits) - 1; /* * A highest_vcn of zero means this is a single extent * attribute so simply terminate the runlist with LCN_ENOENT). From 5fa69ca6ebfd9ef6246ff55089b97a82c09ea93f Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Tue, 10 Aug 2004 10:45:07 +0000 Subject: [PATCH 1663/2994] runlist.c: another fix BKrev: 4118a733SAjbZc53SMzzw7a4V22Zsg From 3e205017a0fad25f779c7626c1c1ade23bd50b8d Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 11 Aug 2004 09:09:56 +0000 Subject: [PATCH 1664/2994] Add Carmelo and Giang: ntfsls (Logical change 1.486) --- CREDITS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CREDITS b/CREDITS index 53bc2e44..c81e77f4 100644 --- a/CREDITS +++ b/CREDITS @@ -18,9 +18,11 @@ Yuval Fledel (no email address on request) Marcin Gibuła Christophe Grenier Ian Jackson +Carmelo Kintana Jan Kratochvil Lode Leroy David Martínez Moreno +Giang Nguyen Leonard Norrgård Holger Ohmacht Per Olofsson From ac81ff1e9fcfdf658f37ad0f0d4178dfd37bf95c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 11 Aug 2004 09:09:56 +0000 Subject: [PATCH 1665/2994] fixes to recursion (Logical change 1.486) --- ntfsprogs/ntfsls.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index e1cd3958..c330c885 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -4,6 +4,8 @@ * Copyright (c) 2003 Lode Leroy * Copyright (c) 2003 Anton Altaparmakov * Copyright (c) 2003 Richard Russon + * Copyright (c) 2004 Carmelo Kintana + * Copyright (c) 2004 Giang Nguyen * * This utility will list a directory's files. * @@ -83,12 +85,12 @@ struct path_component { * dir_list_insert_pos keeps track of where to insert a sub-dir * into the list. */ -struct list_head *dir_list_insert_pos = NULL; +static struct list_head *dir_list_insert_pos = NULL; /* The global depth relative to opts.path. * ie: opts.path has depth 0, a sub-dir of opts.path has depth 1 */ -int depth = 0; +static int depth = 0; static struct options { char *device; /* Device/File to work with */ @@ -483,7 +485,10 @@ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, if (dt_type == NTFS_DT_DIR && opts.classify) sprintf(filename + strlen(filename), "/"); - if (dt_type == NTFS_DT_DIR && opts.recursive) { + if (dt_type == NTFS_DT_DIR && opts.recursive + && strcmp(filename, ".") && strcmp(filename, "./") + && strcmp(filename, "..") && strcmp(filename, "../")) + { dir = (struct dir *)calloc(1, sizeof(struct dir)); if (!dir) { @@ -554,7 +559,7 @@ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, printf("%8lld %s %s\n", (long long)filesize, t_buf + 4, filename); - if (dt_type == NTFS_DT_DIR && opts.recursive) { + if (dir) { dir->ni = ni; ni = NULL; /* so release does not close inode */ } @@ -568,10 +573,14 @@ release: ntfs_inode_close(ni); } - /* add dir to list */ - if (dir && !result) { - list_add(&dir->list, dir_list_insert_pos); - dir_list_insert_pos = &dir->list; + if (dir) { + if (result == 0) { + list_add(&dir->list, dir_list_insert_pos); + dir_list_insert_pos = &dir->list; + } else { + free(dir); + dir = NULL; + } } free: From 95fc34e1694cc877f52f7585a3efb20326d4f9ad Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 11 Aug 2004 09:09:56 +0000 Subject: [PATCH 1666/2994] ntfsls recursive option (Logical change 1.486) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 308bb720..41d25efd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -85,6 +85,7 @@ xx/xx/2004 - 1.9.3-WIP in two error code paths in ntfs_compressed_attr_pread(). (Anton) - Fix a bug where an uncompressed block could be misdetected as a compressed one if it was made up of multiple runs. (Anton) + - ntfsls: Add a -R recursive option (Giang, Carmelo) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From 0f45b52eb21b595d50b4d69a86030809ea0764ce Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 11 Aug 2004 09:09:56 +0000 Subject: [PATCH 1667/2994] ntfsls: fixes to recursive option BKrev: 4119e264yC9_p7aKp49fGEQVEHrVgg From 5038a7e1b9925585a696c09af743b2a77f6b733e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Aug 2004 07:58:38 +0000 Subject: [PATCH 1668/2994] Fix debug output issues in win32_io.c (Yuval) (Logical change 1.487) --- libntfs/win32_io.c | 82 +++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 49 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 8a0cd605..3e359f29 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -62,21 +62,6 @@ typedef struct win32_fd { int part_hidden_sectors; } win32_fd; -#define perror(msg) win32_perror(__FILE__,__LINE__,__FUNCTION__,msg) - -static int win32_perror(const char *file, int line, const char *func, - const char *msg) -{ - char buffer[1024] = ""; - DWORD err = GetLastError(); - - if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, buffer, - sizeof(buffer), NULL) <= 0) - sprintf(buffer, "HRESULT 0x%lx", err); - fprintf(stderr, "%s(%d): %s\t%s %s\n", file, line, func, buffer, msg); - return 0; -} - #ifdef EMULATE_SETFILEPOINTEREX static BOOL WINAPI SetFilePointerEx(HANDLE hFile, LARGE_INTEGER liDistanceToMove, @@ -103,9 +88,13 @@ static BOOL WINAPI SetFilePointerEx(HANDLE hFile, */ static int ntfs_w32error_to_errno(DWORD w32error) { + Dprintf("win32_w32error_to_errno(%d).\n",w32error); switch (w32error) { + case ERROR_INVALID_FUNCTION: + return ENOSYS; case ERROR_FILE_NOT_FOUND: case ERROR_PATH_NOT_FOUND: + case ERROR_INVALID_NAME: return ENOENT; case ERROR_TOO_MANY_OPEN_FILES: return EMFILE; @@ -130,6 +119,8 @@ static int ntfs_w32error_to_errno(DWORD w32error) return ESPIPE; case ERROR_NOT_SUPPORTED: return ENOTSUP; + case ERROR_BAD_NETPATH: + return ENOSHARE; default: /* generic message */ return ENOMSG; @@ -199,7 +190,7 @@ static int ntfs_win32_getsize(HANDLE handle,s64 *argp) loword = GetFileSize(handle, &hiword); if (loword==INVALID_FILE_SIZE) { - perror("ntfs_win32_getblksize(): FAILED!"); + Dputs("win32_getblksize(): FAILED!"); errno = ntfs_w32error_to_errno(GetLastError()); return -errno; } @@ -433,24 +424,23 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, /* end of partition != end of disk */ disp = FILE_BEGIN; if (fd->part_end == -1) { - fprintf(stderr, "win32_seek: position relative to end " - "of disk not implemented\n"); + Dputs("win32_seek: position relative to end " + "of disk not implemented."); errno = ENOTSUP; return -1; } abs_offset.QuadPart = fd->part_end + offset; break; default: - printf("win32_seek() wrong mode %d\n", whence); + printf("win32_seek() wrong mode %d.\n", whence); errno = EINVAL; return -1; } rvl = SetFilePointerEx(fd->handle, abs_offset, &fd->current_pos, disp); if (!rvl) { - int err = errno; - perror("SetFilePointer failed"); - errno = err; + Dputs("win32_seek(): SetFilePointer failed."); + errno = ntfs_w32error_to_errno(GetLastError()); return -1; } @@ -483,20 +473,19 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) #ifndef FORCE_ALIGNED_READ if (((((long)buf) & ((s64)0x1FF)) == 0) && ((count & ((s64)0x1FF)) == 0) && ((fd->current_pos.QuadPart & 0x1FF) == 0)) { - Dprintf("normal read\n"); + Dputs("normal read."); rvl = ReadFile(fd->handle, (LPVOID)buf, count, &numread, (LPOVERLAPPED)NULL); if (!rvl) { - int err = errno; - perror("ReadFile failed"); - errno = err; + Dputs("win32_read(): ReadFile failed."); + errno = ntfs_w32error_to_errno(GetLastError()); return -1; } } else { BYTE *alignedbuffer; - Dprintf("aligned read\n"); + Dputs("aligned read."); #else { BYTE *alignedbuffer; @@ -510,10 +499,9 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) rvl = SetFilePointerEx(fd->handle, base, NULL, FILE_BEGIN); if (!rvl) { - int err = errno; - fprintf(stderr, "SetFilePointerEx failed\n"); + Dputs("win32_read(): SetFilePointerEx failed."); + errno = ntfs_w32error_to_errno(GetLastError()); VirtualFree(alignedbuffer, 0, MEM_RELEASE); - errno = err; return -1; } @@ -521,10 +509,9 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) numtoread.QuadPart, &numread, (LPOVERLAPPED)NULL); if (!rvl) { - int err = errno; - fprintf(stderr, "ReadFile failed\n"); + Dputs("win32_read(): ReadFile failed."); + errno = ntfs_w32error_to_errno(GetLastError()); VirtualFree(alignedbuffer, 0, MEM_RELEASE); - errno = err; return -1; } new_pos.QuadPart = fd->current_pos.QuadPart + count; @@ -532,10 +519,9 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) rvl = SetFilePointerEx(fd->handle, new_pos, &fd->current_pos, FILE_BEGIN); if (!rvl) { - int err = errno; - fprintf(stderr, "SetFilePointerEx failed\n"); + Dputs("win32_read(): SetFilePointerEx failed."); + errno = ntfs_w32error_to_errno(GetLastError()); VirtualFree(alignedbuffer, 0, MEM_RELEASE); - errno = err; return -1; } @@ -569,9 +555,8 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) free(fd); if (!rvl) { - int err = errno; - perror("CloseHandle failed"); - errno = err; + Dputs("win32_close: CloseHandle failed."); + errno = ntfs_w32error_to_errno(GetLastError()); return -1; } @@ -641,7 +626,7 @@ static int ntfs_device_win32_stat(struct ntfs_device *dev, struct stat *buf) ret = ntfs_win32_getsize(dev,&st_size); if (ret) - Dprintf("ntfs_device_win32_stat(): getsize failed"); + Dputs("win32_stat(): getsize failed."); memset(buf,0,sizeof (struct stat)); buf->st_mode = st_mode; @@ -671,8 +656,7 @@ static __inline__ int ntfs_win32_hdio_getgeo(struct ntfs_device *dev, if (fd->part_hidden_sectors==-1) { /* not a partition */ - Dprintf("ntfs_win32_hdio_getgeo(): error: not a partition"); - fprintf(stderr, "ntfs_win32_hdio_getgeo(): unimplemented\n"); + Dputs("win32_hdio_getgeo(): Not a partition, unimplemented."); errno = ENOTSUP; return -1; } else { @@ -710,7 +694,7 @@ static __inline__ int ntfs_win32_blksszget(struct ntfs_device *dev,int *argp) *argp=dg.BytesPerSector; return 0; } else { - perror("ntfs_win32_blksszget(): FAILED!"); + Dputs("win32_blksszget(): FAILED!"); errno = ntfs_w32error_to_errno(GetLastError()); return -errno; } @@ -721,12 +705,12 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, { win32_fd *fd = (win32_fd *)dev->d_private; - fprintf(stderr, "win32_ioctl(%d) called\n",request); + Dprintf("win32_ioctl(%d) called.\n",request); switch (request) { #if defined(BLKGETSIZE) case BLKGETSIZE: - Dprintf("win32_ioctl: BLKGETSIZE detected"); + Dputs("win32_ioctl: BLKGETSIZE detected."); if ((fd->part_end>=0) && (fd->part_start>=0)) { *(int *)argp = (int)((fd->part_end - fd->part_start) / 512); return 0; @@ -737,7 +721,7 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, #endif #if defined(BLKGETSIZE64) case BLKGETSIZE64: - Dprintf("win32_ioctl: BLKGETSIZE64 detected"); + Dputs("win32_ioctl: BLKGETSIZE64 detected."); if ((fd->part_end>=0) && (fd->part_start>=0)) { *(s64 *)argp = (s64)(fd->part_end - fd->part_start); return 0; @@ -748,17 +732,17 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, #endif #ifdef HDIO_GETGEO case HDIO_GETGEO: - Dprintf("win32_ioctl: HDIO_GETGEO detected"); + Dputs("win32_ioctl: HDIO_GETGEO detected."); return ntfs_win32_hdio_getgeo(dev,(struct hd_geometry *)argp); #endif #ifdef BLKSSZGET case BLKSSZGET: - Dprintf("win32_ioctl: BLKSSZGET detected"); + Dputs("win32_ioctl: BLKSSZGET detected."); return ntfs_win32_blksszget(dev,(int *)argp); break; #endif default: - fprintf(stderr, "win32_ioctl(): unimplemented ioctl %d\n",request); + fprintf(stderr, "win32_ioctl(): unimplemented ioctl %d.\n",request); errno = ENOTSUP; return -1; } From 1329505fd20b22c58aa8185d2a9b3e88ae10fd20 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Aug 2004 07:58:38 +0000 Subject: [PATCH 1669/2994] win32_io.c: Fix debug output issues in win32_io.c (Yuval) BKrev: 411b232euvRzL1btwwOIenRU5-jGHg From 1fd33a13262dbcb551d54a222666e3c935f06266 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Aug 2004 08:06:25 +0000 Subject: [PATCH 1670/2994] Change the win32_open function to open volumes instead of partitions when possible, and use the windows volume locking/dismounting mechanism on R/W open to prevent data corruption. (Yuval) (Logical change 1.488) --- libntfs/win32_io.c | 388 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 302 insertions(+), 86 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 3e359f29..d61545e4 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -38,7 +38,6 @@ */ typedef long long int s64; typedef unsigned long int u32; -struct flock; struct stat; struct ntfs_volume; typedef struct ntfs_volume ntfs_volume; @@ -48,10 +47,26 @@ typedef struct ntfs_volume ntfs_volume; /* Need device, but prevent ../include/types.h to be loaded. */ #define _NTFS_TYPES_H -#define _NTFS_SUPPORT_H #define _NTFS_VOLUME_H #include "device.h" +#ifndef IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS +#define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS 5636096 +#endif + +/* windows 2k+ imports */ +typedef HANDLE (WINAPI *LPFN_FINDFIRSTVOLUME) (LPTSTR,DWORD); +typedef BOOL (WINAPI *LPFN_FINDNEXTVOLUME) (HANDLE,LPTSTR,DWORD); +typedef BOOL (WINAPI *LPFN_FINDVOLUMECLOSE) (HANDLE); +static LPFN_FINDFIRSTVOLUME fnFindFirstVolume = NULL; +static LPFN_FINDNEXTVOLUME fnFindNextVolume = NULL; +static LPFN_FINDVOLUMECLOSE fnFindVolumeClose = NULL; +#ifdef UNICODE +#define FUNCTIONPOSTFIX "W" +#else +#define FUNCTIONPOSTFIX "A" +#endif + #define FORCE_ALIGNED_READ typedef struct win32_fd { @@ -127,49 +142,55 @@ static int ntfs_w32error_to_errno(DWORD w32error) } } +/** + * ntfs_device_unix_status_flags_to_win32 - convert unix->win32 open flags + * @flags: Unix open status flags. + * + * Supported flags are O_RDONLY, O_WRONLY and O_RDWR. + */ +static __inline__ int ntfs_device_unix_status_flags_to_win32(int flags) +{ + switch (flags & O_ACCMODE) { + case O_RDONLY: + return FILE_READ_DATA; + break; + case O_WRONLY: + return FILE_WRITE_DATA; + break; + case O_RDWR: + return FILE_READ_DATA | FILE_WRITE_DATA; + break; + default: + /* error */ + Dputs("win32_unix_status_flags_to_win32: flags unknown"); + return 0; + } +} + + /** * ntfs_device_win32_simple_open_file - Just open a file via win32 API * @filename: Name of the file to open. * @handle: Pointer the a HADNLE in which to put the result. * @flags: Unix open status flags. + * @locking: will the function gain an exclusive lock on the file? * * Supported flags are O_RDONLY, O_WRONLY and O_RDWR. * * Return 0 if o.k. * -errno if not, in this case handle is trashed. */ -static int ntfs_device_win32_simple_open_file(char *filename, - HANDLE *handle, int flags) +static int ntfs_device_win32_simple_open_file(const char *filename, + HANDLE *handle, int flags, BOOL locking) { - int win32flags; - - switch (flags && O_ACCMODE) { - case O_RDONLY: - win32flags = FILE_READ_DATA; - break; - case O_WRONLY: -/* win32flags = FILE_WRITE_DATA; - break; */ - case O_RDWR: -/* win32flags = FILE_READ_DATA || FILE_WRITE_DATA; - break; */ - errno = ENOTSUP; - return -errno; - default: - /* error */ - return -EINVAL; - } - - *handle = CreateFile(filename, win32flags, FILE_SHARE_READ, - NULL, OPEN_EXISTING, 0, NULL); + *handle = CreateFile(filename, + ntfs_device_unix_status_flags_to_win32(flags), + locking ? 0 : (FILE_SHARE_WRITE | FILE_SHARE_READ), + NULL, OPEN_EXISTING, 0, NULL); if (*handle == INVALID_HANDLE_VALUE) { - char msg[1024]; - - sprintf(msg, "CreateFile(%s) failed", filename); - perror(msg); + Dprintf("CreateFile(%s) failed.\n", filename); errno = ntfs_w32error_to_errno(GetLastError()); - return -errno; } else { return 0; @@ -198,6 +219,30 @@ static int ntfs_win32_getsize(HANDLE handle,s64 *argp) return 0; } +/** + * ntfs_device_win32_init_imports - initialize the fnFind*Volume variables. + * + * The Find*Volume functions exist only on win2k+, as such we can't + * just staticly import it. + * This function initialize the imports if the function do exist. + * + * Note: The values are cached, do be afraid to run it more than once. + */ +static void ntfs_device_win32_init_imports(void) +{ + if (!fnFindFirstVolume) + fnFindFirstVolume = (LPFN_FINDFIRSTVOLUME) + GetProcAddress(GetModuleHandle("kernel32"), + "FindFirstVolume"FUNCTIONPOSTFIX); + if (!fnFindNextVolume) + fnFindNextVolume = (LPFN_FINDNEXTVOLUME) + GetProcAddress(GetModuleHandle("kernel32"), + "FindNextVolume"FUNCTIONPOSTFIX); + if (!fnFindVolumeClose) + fnFindVolumeClose = (LPFN_FINDVOLUMECLOSE) + GetProcAddress(GetModuleHandle("kernel32"), "FindVolumeClose"); +} + /** * ntfs_device_win32_open_file - Open a file via win32 API * @filename: Name of the file to open. @@ -214,25 +259,25 @@ static __inline__ int ntfs_device_win32_open_file(char *filename, win32_fd *fd, s64 size; int err; - if ((err = ntfs_device_win32_simple_open_file(filename, &handle, flags))) { + if ((err = ntfs_device_win32_simple_open_file(filename, &handle, flags, + TRUE))) { /* open error */ return err; } if ((err = ntfs_win32_getsize(handle, &size))) { /* error while getting the information */ - perror("ioctl failed"); - errno = err; - return -err; - } else { - /* success */ - fd->handle = handle; - fd->part_start = 0; - fd->part_end = size; - fd->current_pos.QuadPart = 0; - fd->part_hidden_sectors = -1; - return 0; + Dputs("win32_open_file(): getsize failed."); + size = -1; } + + /* fill fd */ + fd->handle = handle; + fd->part_start = 0; + fd->part_end = size; + fd->current_pos.QuadPart = 0; + fd->part_hidden_sectors = -1; + return 0; } /** @@ -254,25 +299,158 @@ static __inline__ int ntfs_device_win32_open_drive(int drive_id, win32_fd *fd, sprintf(filename, "\\\\.\\PhysicalDrive%d", drive_id); - if ((err = ntfs_device_win32_simple_open_file(filename, &handle, flags))) { + if ((err = ntfs_device_win32_simple_open_file(filename, &handle, flags, + TRUE))) { /* open error */ return err; } if ((err = ntfs_win32_getsize(handle, &size))) { /* error while getting the information */ - perror("ioctl failed"); - errno = err; - return -err; - } else { - /* success */ - fd->handle = handle; - fd->part_start = 0; - fd->part_end = size; - fd->current_pos.QuadPart = 0; - fd->part_hidden_sectors = -1; - return 0; + Dputs("win32_open_drive(): getsize failed."); + size = -1; } + + /* fill fd */ + fd->handle = handle; + fd->part_start = 0; + fd->part_end = size; + fd->current_pos.QuadPart = 0; + fd->part_hidden_sectors = -1; + return 0; +} + +/** + * ntfs_device_win32_open_volume_for_partition - find and open a volume. + * + * Windows NT/2k/XP handles volumes instead of partitions. + * This function gets the partition details and return an open volume handle. + * That volume is the one whose only physical location on disk is the described + * partition. + * + * The function required Windows 2k/XP, otherwise it fails (gracefully). + * + * Return success: a valid open volume handle. + * fail : INVALID_HANDLE_VALUE + */ +static HANDLE ntfs_device_win32_open_volume_for_partition(unsigned int drive_id, + s64 part_offset, s64 part_length, int flags) +{ + HANDLE vol_find_handle; + TCHAR vol_name[MAX_PATH]; + + ntfs_device_win32_init_imports(); + /* make sure all the required imports exist */ + if (!fnFindFirstVolume || !fnFindNextVolume || !fnFindVolumeClose) { + Dputs("win32_is_mounted: Imports not found."); + return INVALID_HANDLE_VALUE; + } + + /* start iterating through volumes. */ + Dprintf("win32_open_volume_for_partition: Start\n"); + vol_find_handle = fnFindFirstVolume(vol_name, MAX_PATH); + + /* if a valid handle could not be aquired, reply with "don't know" */ + if (vol_find_handle==INVALID_HANDLE_VALUE) { + Dprintf("win32_open_volume_for_partition: " + "FindFirstVolume failed."); + return INVALID_HANDLE_VALUE; + } + + do { + int vol_name_length; + HANDLE handle; + + /* remove trailing '/' from vol_name */ +#ifdef UNICODE + vol_name_length = wcslen(vol_name); +#else + vol_name_length = strlen(vol_name); +#endif + if (vol_name_length>0) + vol_name[vol_name_length-1]=0; + + Dprintf("win32_open_volume_for_partition: Processing %s\n", + vol_name); + + /* open the file */ + handle = CreateFile(vol_name, + ntfs_device_unix_status_flags_to_win32(flags), FILE_SHARE_READ | + FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + if (handle!=INVALID_HANDLE_VALUE) { +#define EXTENTS_SIZE sizeof(VOLUME_DISK_EXTENTS)+9*sizeof(DISK_EXTENT) + char extents[EXTENTS_SIZE]; + DWORD bytesReturned; + + /* check physical locations */ + if (DeviceIoControl(handle, + IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, extents, + EXTENTS_SIZE, &bytesReturned, NULL)) { + if (((VOLUME_DISK_EXTENTS *)extents)->NumberOfDiskExtents==1) { + DISK_EXTENT *extent = &((VOLUME_DISK_EXTENTS *)extents)-> + Extents[0]; + if ((extent->DiskNumber==drive_id) && + (extent->StartingOffset.QuadPart==part_offset) && + (extent->ExtentLength.QuadPart==part_length)) { + /* Eureka! (Archimedes, 287 BC, "I have found it!") */ + fnFindVolumeClose(vol_find_handle); + return handle; + } + } + } + } else + Dputs("win32_open_volume_for_partition: getExtents " + "Failed!" ); + } while (fnFindNextVolume(vol_find_handle, vol_name, MAX_PATH)); + + /* end of iteration through volumes */ + Dprintf("win32_open_volume_for_partition: Closing.\n"); + fnFindVolumeClose(vol_find_handle); + + return INVALID_HANDLE_VALUE; +} + +/** + * ntfs_device_win32_find_partition - locates partition details by id. + * @handle HANDLE to the PhysicalDrive + * @partition_id The partition number to locate. + * @part_offset Pointer to where to put the offset to the partition. + * @part_length Pointer to where to put the length of the partition. + * + * This function requires an open PhysicalDrive handle and a partition_id. + * If a partition with the required id is found on the supplied device, + * the partition attributes are returned back. + * + * Return TRUE if found, and sets the output parameters. + * FALSE if not. + */ +static BOOL ntfs_device_win32_find_partition(HANDLE handle,DWORD partition_id, + s64 *part_offset, s64 *part_length, int *hidden_sectors) +{ + char buf[sizeof(DRIVE_LAYOUT_INFORMATION)+9*sizeof(PARTITION_INFORMATION)]; + DRIVE_LAYOUT_INFORMATION *drive_layout; + DWORD bytesReturned, i; + + if (!DeviceIoControl(handle, IOCTL_DISK_GET_DRIVE_LAYOUT, NULL, 0, + &buf, sizeof (buf), &bytesReturned, NULL)) { + Dputs("win32_find_partition(): GetDriveLayout failed."); + errno = ntfs_w32error_to_errno(GetLastError()); + return FALSE; + } + + drive_layout = (DRIVE_LAYOUT_INFORMATION *)buf; + for (i = 0; i < drive_layout->PartitionCount; i++) { + if (drive_layout->PartitionEntry[i].PartitionNumber == partition_id) { + *part_offset = + drive_layout->PartitionEntry[i].StartingOffset.QuadPart; + *part_length = + drive_layout->PartitionEntry[i].PartitionLength.QuadPart; + *hidden_sectors = drive_layout->PartitionEntry[i].HiddenSectors; + return TRUE; + } + } + + return FALSE; } /** @@ -281,55 +459,93 @@ static __inline__ int ntfs_device_win32_open_drive(int drive_id, win32_fd *fd, * @fd: Win32 file device to return * @flags: Unix open status flags. * - * Return 0 if o.k. - * -errno if not + * Return 0 if o.k. + * -1 if not * * When fails, fd contents may have not been preserved. */ static __inline__ int ntfs_device_win32_open_partition(int drive_id, - unsigned int partition_id, win32_fd *fd, int flags) + DWORD partition_id, win32_fd *fd, int flags) { - DRIVE_LAYOUT_INFORMATION *drive_layout; - char buffer[10240]; - unsigned int i; - DWORD numread; + char drive_name[MAX_PATH]; HANDLE handle; int err; + s64 part_start, part_length; + int hidden_sectors; - sprintf(buffer, "\\\\.\\PhysicalDrive%d", drive_id); + sprintf(drive_name, "\\\\.\\PhysicalDrive%d", drive_id); - if ((err = ntfs_device_win32_simple_open_file(buffer, &handle, flags))) { - /* error */ + /* Open the entire device without locking, ask questions later */ + if ((err = ntfs_device_win32_simple_open_file(drive_name, &handle, flags, + FALSE))) { + /* error */ return err; } - if (!DeviceIoControl(handle, IOCTL_DISK_GET_DRIVE_LAYOUT, NULL, 0, - &buffer, sizeof (buffer), &numread, NULL)) { - perror("ioctl failed"); - errno = ntfs_w32error_to_errno(GetLastError()); - return -errno; - } + if (ntfs_device_win32_find_partition(handle, partition_id, &part_start, + &part_length, &hidden_sectors)) { + HANDLE vol_handle = ntfs_device_win32_open_volume_for_partition( + drive_id, part_start, part_length, flags); + if (vol_handle!=INVALID_HANDLE_VALUE) { + BOOL retVal; + DWORD bytesReturned; + + /* close the disk handle, we do not need it anymore */ + CloseHandle(handle); - drive_layout = (DRIVE_LAYOUT_INFORMATION *)buffer; - for (i = 0; i < drive_layout->PartitionCount; i++) { - if (drive_layout->PartitionEntry[i].PartitionNumber == partition_id) { - fd->handle = handle; - fd->part_start = - drive_layout->PartitionEntry[i].StartingOffset.QuadPart; - fd->part_end = - drive_layout->PartitionEntry[i].StartingOffset.QuadPart + - drive_layout->PartitionEntry[i].PartitionLength.QuadPart; + if ((flags & O_RDWR) == O_RDWR) { + /* lock the volume */ + Dputs("win32_open_partition: Locking volume"); + retVal = DeviceIoControl(vol_handle, FSCTL_LOCK_VOLUME, NULL, 0, + NULL, 0, &bytesReturned, NULL); + if (!retVal) { + Dputs("win32_open_partition: Couldn't lock volume"); + errno = ntfs_w32error_to_errno(GetLastError()); + return -1; + } else + Dputs("win32_open_partition: Lock O.k."); + + /* dismount volume */ + retVal = DeviceIoControl(vol_handle, FSCTL_DISMOUNT_VOLUME, + NULL, 0, NULL, 0, &bytesReturned, NULL); + if (!retVal) { + Dputs("win32_open_partition: Couldn't Dismount"); + errno = ntfs_w32error_to_errno(GetLastError()); + return -1; + } else + Dputs("win32_open_partition: Dismount O.k."); + } + + /* fill fd */ + fd->handle = vol_handle; + fd->part_start = 0; + fd->part_end = part_length; fd->current_pos.QuadPart = 0; - fd->part_hidden_sectors = - drive_layout->PartitionEntry[i].HiddenSectors; + fd->part_hidden_sectors = hidden_sectors; return 0; + } else { + if ((flags & O_RDWR) == O_RDWR) { + /* access if read-write, no volume found */ + Dputs("Partitions containing Spanned/Mirrored volumes are " + "not supported in R/W status yet"); + CloseHandle(handle); + return -1; + } else { + /* fill fd */ + fd->handle = handle; + fd->part_start = part_start; + fd->part_end = part_start + part_length; + fd->current_pos.QuadPart = 0; + fd->part_hidden_sectors = hidden_sectors; + return 0; + } } + } else { + Dprintf("partition %u not found on drive %d\n", partition_id, drive_id); + CloseHandle(handle); + errno = ENODEV; + return -1; } - - fprintf(stderr,"partition %u not found on drive %d\n", - partition_id, drive_id); - errno = ENODEV; - return -ENODEV; } /** From ed6cc32435f04124652437aabfad2e55a320e08c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Aug 2004 08:06:25 +0000 Subject: [PATCH 1671/2994] win32_io.c: Change the win32_open function to open volumes instead of partitions when possible, and use the windows volume locking/dismounting mechanism on R/W open to prevent data corruption. (Yuval) BKrev: 411b2501nK6U8EqDaO8GMsVOtXL1rg From 98b3b601cf7688ec4dcc0f9cb2c3e6099ba63436 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Aug 2004 08:08:25 +0000 Subject: [PATCH 1672/2994] Use the NDev* macros in win32_io.c too. (Yuval) (Logical change 1.489) --- libntfs/win32_io.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index d61545e4..679bd7c7 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -568,6 +568,11 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) win32_fd fd; int err; + if (NDevOpen(dev)) { + errno = EBUSY; + return -1; + } + numparams = sscanf(dev->d_name, "/dev/hd%c%u", &drive_char, &part); drive_id = toupper(drive_char) - 'A'; @@ -599,9 +604,16 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) Dprintf("win32_open(%s) -> %p, offset 0x%llx\n", dev->d_name, dev, fd.part_start); + /* Setup our read-only flag. */ + if ((flags & O_RDWR) != O_RDWR) + NDevSetReadOnly(dev); + dev->d_private = malloc(sizeof (win32_fd)); memcpy(dev->d_private, &fd, sizeof (win32_fd)); + NDevSetOpen(dev); + NDevClearDirty(dev); + return 0; } @@ -765,6 +777,11 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) Dprintf("win32_close(%p)\n", dev); + if (!NDevOpen(dev)) { + errno = EBADF; + return -errno; + } + rvl = CloseHandle(fd->handle); fd->handle = 0; @@ -788,11 +805,17 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) */ static int ntfs_device_win32_sync(struct ntfs_device *dev) { - if (FlushFileBuffers(((win32_fd *)dev->d_private)->handle)) { - return 0; + if (!NDevReadOnly(dev) && NDevDirty(dev)) { + if (FlushFileBuffers(((win32_fd *)dev->d_private)->handle)) { + NDevClearDirty(dev); + return 0; + } else { + errno = ntfs_w32error_to_errno(GetLastError()); + return -errno; + } } else { - errno = ntfs_w32error_to_errno(GetLastError()); - return -errno; + /* no need/ability for a sync(), just exit gracefully */ + return 0; } } From 133a40dc6114943286372650a2628857ea4d007f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Aug 2004 08:08:25 +0000 Subject: [PATCH 1673/2994] win32_io.c: Use the NDev* macros in win32_io.c too. (Yuval) BKrev: 411b2579qqd3b1_KsbvtsIej9TizsQ From 9df3149c48c0fc3e9e9a18ed17a9995262d9e263 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Aug 2004 08:15:25 +0000 Subject: [PATCH 1674/2994] Update (Logical change 1.490) --- ChangeLog | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41d25efd..c3acbd51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,19 +34,21 @@ xx/xx/2004 - 1.9.3-WIP mounted or not in Windows. Also mkntfs still has no chance of working as getting the head-count is NT specific and as such wasn't implemented. (Yuval) - - Added truncate option to ntfsundelete (mabs) + - Added truncate option to ntfsundelete. (mabs) - Bugfix in ntfs_attr_size_bounds_check that caused it always fail, - if no maximum limit for attribute size (Yura) + if no maximum limit for attribute size. (Yura) - Add new function attrib.c::ntfs_non_resident_attr_expand, - thus we can expand non resident attributes (Yura) - - Add a @start_vcn parameter to lcnalloc.[ch]::ntfs_cluster_alloc (Yura) - - Add ntfscp utility, at present it can only overwrite files. It can - increment or decrease file size if $ATTRIBUTE_LIST not present (Yura) + thus we can expand non resident attributes. (Yura) + - Add a @start_vcn parameter to + lcnalloc.[ch]::ntfs_cluster_alloc. (Yura) + - Add ntfscp utility, at present it can only overwrite files. It can + increment/decrease file size if $ATTRIBUTE_LIST not present. (Yura) - Added new API lcnalloc.[ch]::ntfs_cluster_free_from_rl, and made - ntfs_cluster_alloc use it (Yura) - - Bugfix in ntfs_cluster_alloc for count = 0 (Yura) + ntfs_cluster_alloc use it. (Yura) + - Bugfix in ntfs_cluster_alloc for count = 0. (Yura) - Bugfix in ntfs_attr_map{_whole_,_}runlist: make it not fail if runlist - already mapped (Yura) + already mapped. (Yura) + - Make ntfslabel pay attention to --no-action. (Yuval) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From 4da9583aadaa672a47b203b794277b9a15fb7cc0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Aug 2004 08:15:25 +0000 Subject: [PATCH 1675/2994] make ntfslabel pay attention to the --no-action command line switch. (Yuval) (Logical change 1.490) --- ntfsprogs/ntfslabel.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 51c5f7ea..32e98712 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -345,7 +345,8 @@ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, a->reservedR = 0; } memcpy((u8*)a + le16_to_cpu(a->value_offset), new_label, label_len); - if (ntfs_mft_record_write(vol, (MFT_REF)FILE_Volume, mrec)) { + if (!opts.noaction && + ntfs_mft_record_write(vol, (MFT_REF)FILE_Volume, mrec)) { perror("Error writing MFT Record to disk"); goto err_out; } @@ -377,8 +378,11 @@ int main(int argc, char **argv) utils_set_locale(); - //XXX need to set and get mount flags - vol = utils_mount_volume (opts.device, 0, opts.force); + if (!opts.label) + opts.noaction++; + + vol = utils_mount_volume (opts.device, opts.noaction ? MS_RDONLY : 0, + opts.force); if (!vol) return 1; From 96354474b0042be9a7eb34887c8f4b38e82c58ff Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Aug 2004 08:15:25 +0000 Subject: [PATCH 1676/2994] ntfslabel.c: make ntfslabel pay attention to the --no-action command line switch. (Yuval) ChangeLog: Update BKrev: 411b271d1itYZmirsQctsuYf6S8W-A From aa85d7a8b17193627d1517a2af17abfd72289260 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Aug 2004 08:21:50 +0000 Subject: [PATCH 1677/2994] The long waited device-level write support on windows. (Yuval) (Logical change 1.491) --- libntfs/win32_io.c | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 679bd7c7..d4e09f20 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -826,14 +826,44 @@ static int ntfs_device_win32_sync(struct ntfs_device *dev) * @count: How many bytes should be written. * * On success returns the amount of bytes actually written. - * On fail returns -errno. + * On fail returns -1 and errno set. */ -static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buffer, +static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buf, s64 count) { - fprintf(stderr, "win32_write() unimplemented\n"); - errno = ENOTSUP; - return -1; + s64 bytes_written = 0; + HANDLE handle = ((win32_fd *)dev->d_private)->handle; + + Dprintf("win32_write: Writing %ll bytes\n",count); + + if (NDevReadOnly(dev)) { + Dputs("win32_write: Device R/O, exiting."); + errno = EROFS; + return -1; + } + NDevSetDirty(dev); + + while (count>0) { + DWORD cur_written; + DWORD cur_count = (count>32768)?32768:count; + + if (WriteFile(handle, buf, cur_count, &cur_written, NULL) && + (cur_written==cur_count)) { + Dprintf("win32_write: Written %u bytes.",bytes_written); + bytes_written += cur_written; + count -= cur_written; + } else { + /* error */ + errno = ntfs_w32error_to_errno(GetLastError()); + return -1; + } + } + if (count) { + errno = EIO; + return -1; + } else { + return bytes_written; + } } /** From d85cb21fed75868b7e2802be62b2885171bb7702 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Aug 2004 08:21:50 +0000 Subject: [PATCH 1678/2994] Update (Logical change 1.491) --- ChangeLog | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3acbd51..96525119 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,16 +24,8 @@ xx/xx/2004 - 1.9.3-WIP - ntfswipe - wipe file tails and directory indexes (Yura) - Bugfix in ntfs_rl_pread,pwrite for pos > 0. (Yura) - Added special image format support in ntfsclone. (Per Olofsson) - - Major win32_io.c update implementing ->ioctl, ->sync, and ->stat. - Should compile on any machine with NT/2k/XP compatible include files. - That means EVERY cygwin/mingw32 compiler, possibly even - Intel/Microsoft. Will probably not work on djgpp. All external DLL - imports exist on any Windows 9x/NT+, so it should work on any Windows - PC. Tested only on Windows XP. The write code is trivial now, but I - would wait with it until I figure out how to find if a volume is - mounted or not in Windows. Also mkntfs still has no chance of - working as getting the head-count is NT specific and as such wasn't - implemented. (Yuval) + - Major win32_io.c update implementing ->ioctl, ->sync, ->stat, and + ->write. NOTE: This might break djgpp compatibility. (Yuval) - Added truncate option to ntfsundelete. (mabs) - Bugfix in ntfs_attr_size_bounds_check that caused it always fail, if no maximum limit for attribute size. (Yura) From 38cd3a05f1723336c1edbf6d1c10eacf3eb2a936 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 12 Aug 2004 08:21:50 +0000 Subject: [PATCH 1679/2994] win32_io.c: The long waited device-level write support on windows. (Yuval) ChangeLog: Update BKrev: 411b289eZ822m3BucdRHzIBM8182ag From 3353669e7edec3d8e9ea7fadbf24791ae5e80279 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 12 Aug 2004 09:22:54 +0000 Subject: [PATCH 1680/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into flatcap.org:/home/flatcap/ntfsprogs 2004/08/12 10:22:15+01:00 flatcap.org!ntfs ntfsls: default to -a so the user always gets some output (Giang,Carmelo) BKrev: 411b36eebNHBjcB_fQ7e9qyOESJzwg From 9b94d609cd1b296c85cce70584a0604ad84dda86 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 12 Aug 2004 09:22:54 +0000 Subject: [PATCH 1681/2994] default to -a so the user always gets some output (Logical change 1.492) --- ntfsprogs/ntfsls.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index c330c885..7eaf05a3 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -129,6 +129,8 @@ static void version(void) printf("Copyright (c) 2003 Lode Leroy\n"); printf("Copyright (c) 2003 Anton Altaparmakov\n"); printf("Copyright (c) 2003 Richard Russon\n"); + printf("Copyright (c) 2004 Carmelo Kintana\n"); + printf("Copyright (c) 2004 Giang Nguyen\n"); printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -159,6 +161,9 @@ static void usage(void) " -x --dos Use short (DOS 8.3) names\n" "\n", EXEC_NAME); + + printf("NOTE: If neither -a nor -s is specified, the program defaults to -a.\n\n"); + printf("%s%s\n", ntfs_bugs, ntfs_home); } @@ -255,6 +260,10 @@ static int parse_options(int argc, char *argv[]) } } + /* defaults to -a if -s is not specified */ + if (!opts.system) + opts.all++; + if (help || ver) opts.quiet = 0; else { From e8e0e163201ab09c285d7e4af9fb2b5dd87cd31a Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 12 Aug 2004 09:23:53 +0000 Subject: [PATCH 1682/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/11 15:50:44+01:00 flatcap.org!ntfs ref count inodes 2004/08/11 10:11:42+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/10 16:19:44+01:00 flatcap.org!ntfs start attaching directory handling to ntfs objects BKrev: 411b3729ege_TYjYm__n1l46scvHRg From d05efe5a7536d2b61aaee21451ec144a6e3d8652 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 12 Aug 2004 09:23:53 +0000 Subject: [PATCH 1683/2994] add private data to ntfs volume (Logical change 1.493) --- include/ntfs/volume.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 205d097d..97e111ef 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -168,6 +168,8 @@ struct _ntfs_volume { FILE_AttrDef. */ s32 attrdef_len; /* Size of the attribute definition table in bytes. */ + + void *private_data; /* Temp: for directory handling */ }; extern ntfs_volume *ntfs_volume_alloc(void); From bd8a6667cf1212ea20afa3a669f92e09fdaacdbb Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 12 Aug 2004 09:23:53 +0000 Subject: [PATCH 1684/2994] ref count inodes 2004/08/10 16:19:44+01:00 flatcap.org!ntfs add private data to ntfs inode (Logical change 1.493) --- include/ntfs/inode.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 24fc7bc4..c9130822 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -107,6 +107,9 @@ struct _ntfs_inode { ntfs_inode *base_ni; /* For nr_extents == -1, the ntfs inode of the base mft record. */ }; + + void *private_data; /* Temp: for directory handling */ + int ref_count; }; extern ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref); From a61808707f0fa9c7241194a17515654b87fa82c8 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 12 Aug 2004 13:33:25 +0000 Subject: [PATCH 1685/2994] minor build fix (Logical change 1.494) --- libntfs/attrlist.c | 2 +- ntfsprogs/ntfscat.c | 4 +++- ntfsprogs/ntfscluster.c | 2 +- ntfsprogs/ntfsls.c | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 98efe64a..4c7125b7 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -38,7 +38,7 @@ * * Return 0 on success and -1 on error with errno set to the error code. */ -int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) +int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx __attribute__((unused))) { errno = ENOTSUP; return -1; diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index bd2d8834..25382a24 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -210,7 +210,9 @@ static int parse_options (int argc, char **argv) /** * cat */ -static int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int namelen) +static int cat (ntfs_volume *vol __attribute__((unused)), ntfs_inode *inode, + ATTR_TYPES type, ntfschar *name __attribute__((unused)), + int namelen __attribute__((unused))) { /* increase 1024 only if you fix partial writes below */ const int bufsize = 1024; diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 777c142a..df5f0e05 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -398,7 +398,7 @@ static int dump_file (ntfs_volume *vol, ntfs_inode *ino) * print_match */ static int print_match (ntfs_inode *ino, ATTR_RECORD *attr, - runlist_element *run, void *data) + runlist_element *run, void *data __attribute__((unused))) { char *buffer; diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 7eaf05a3..8d77ea54 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -463,8 +463,8 @@ static int readdir_recursive(ntfs_inode * ni, s64 * pos, ntfsls_dirent * dirent) */ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, const int name_len, const int name_type, - const s64 pos, const MFT_REF mref, - const unsigned dt_type) + const s64 pos __attribute__((unused)), + const MFT_REF mref, const unsigned dt_type) { char *filename = NULL; int result = 0; From bd39196073cc63fa9829b5607adae87793ea62d5 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Thu, 12 Aug 2004 13:33:25 +0000 Subject: [PATCH 1686/2994] minor build fixes BKrev: 411b71a5FBfxr2wsHWzV_ZxGVzUHIA From d25fa0b7c14561482834d70922d2f64e29da2e07 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 13 Aug 2004 11:37:54 +0000 Subject: [PATCH 1687/2994] integrate ntfs_dir's into the volume and inodes (Logical change 1.495) --- ntfsprogs/ntfsrm.c | 483 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 439 insertions(+), 44 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 7106017c..a99a2875 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -38,12 +38,14 @@ static const char *EXEC_NAME = "ntfsrm"; static struct options opts; -static const char *space = " "; +static const char *space_line = " "; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +static int ntfs_inode_close2 (ntfs_inode *ni); + /** * version - Print version information about the program * @@ -220,7 +222,7 @@ static void ntfs_dir_print (struct ntfs_dir *dir, int indent) if (!dir) return; - printf ("%.*s%p ", indent, space, dir); + printf ("%.*s%p ", indent, space_line, dir); ntfs_name_print (dir->name, dir->name_len); printf ("\n"); @@ -240,7 +242,7 @@ static void ntfs_dt_print (struct ntfs_dt *dt, int indent) if (!dt) return; - printf ("%.*s%p (%d)\n", indent, space, dt, dt->child_count); + printf ("%.*s%p (%d)\n", indent, space_line, dt, dt->child_count); for (i = 0; i < dt->child_count; i++) { ntfs_dt_print (dt->sub_nodes[i], indent + 4); @@ -248,17 +250,7 @@ static void ntfs_dt_print (struct ntfs_dt *dt, int indent) } /** - * ntfsinfo_time_to_str() - - * @sle_ntfs_clock: on disk time format in 100ns units since 1st jan 1601 - * in little-endian format - * - * Return char* in a format 'Thu Jan 1 00:00:00 1970'. - * No need to free the returned memory. - * - * Example of usage: - * char *time_str = ntfsinfo_time_to_str( - * sle64_to_cpu(standard_attr->creation_time)); - * printf("\tFile Creation Time:\t %s", time_str); + * ntfsinfo_time_to_str */ static const char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) { @@ -398,16 +390,16 @@ static u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn) /** * ntfs_bmp_set_range */ -static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, u64 length, int value) +static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int value) { - u64 i; + s64 i; u8 *buffer; VCN begin; VCN end; int start; int finish; - u8 sta_part; - u8 fin_part; + u8 sta_part = 0; + u8 fin_part = 0; if (!bmp) return -1; @@ -732,7 +724,7 @@ static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int name */ static INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) { - VCN vcn; + VCN vcn = 0; if (!ie) return NULL; @@ -853,10 +845,11 @@ static BOOL ntfs_dt_alloc_children2 (struct ntfs_dt *dt, int count) dt->children = realloc (dt->children, new * sizeof (*dt->children)); dt->sub_nodes = realloc (dt->sub_nodes, new * sizeof (*dt->sub_nodes)); + dt->inodes = realloc (dt->sub_nodes, new * sizeof (*dt->inodes)); // XXX wipe new space - return (dt->children && dt->sub_nodes); + return (dt->children && dt->sub_nodes && dt->inodes); } /** @@ -920,6 +913,7 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt) if (dt->child_count > 0) { //printf ("%d subnodes\n", dt->child_count); dt->sub_nodes = calloc (dt->child_count, sizeof (struct ntfs_dt *)); + dt->inodes = calloc (dt->child_count, sizeof (struct ntfs_inode *)); } return dt->child_count; } @@ -982,6 +976,7 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) if (dt->child_count > 0) { //printf ("%d subnodes\n", dt->child_count); dt->sub_nodes = calloc (dt->child_count, sizeof (struct ntfs_dt *)); + dt->inodes = calloc (dt->child_count, sizeof (struct ntfs_inode *)); } return dt->child_count; @@ -1004,9 +999,10 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par dt->dir = dir; dt->parent = parent; - dt->children = NULL; dt->child_count = 0; + dt->children = NULL; dt->sub_nodes = NULL; + dt->inodes = NULL; dt->vcn = vcn; dt->changed = FALSE; @@ -1088,11 +1084,14 @@ static void ntfs_dt_free (struct ntfs_dt *dt) if (!dt) return; - for (i = 0; i < dt->child_count; i++) - ntfs_dt_free (dt->sub_nodes[i]); + for (i = 0; i < dt->child_count; i++) { + ntfs_dt_free (dt->sub_nodes[i]); + ntfs_inode_close2 (dt->inodes[i]); + } free (dt->sub_nodes); free (dt->children); + free (dt->inodes); free (dt->data); free (dt); } @@ -1181,12 +1180,15 @@ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int n { struct ntfs_dt *res = NULL; INDEX_ENTRY *ie; + VCN vcn; int i; int r; if (!dt || !name) return NULL; + // XXX default index_num to -1 + /* * State Children Action * ------------------------------------------- @@ -1226,6 +1228,11 @@ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int n *index_num = i; } else if (r == -1) { //printf ("recurse\n"); + if (!dt->sub_nodes[i]) { + vcn = ntfs_ie_get_vcn (ie); + //printf ("vcn = %lld\n", vcn); + dt->sub_nodes[i] = ntfs_dt_alloc (dt->dir, dt, vcn); + } res = ntfs_dt_find2 (dt->sub_nodes[i], name, name_len, index_num); } else { printf ("error collating name\n"); @@ -1677,6 +1684,108 @@ static int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start } +/** + * ntfs_inode_dir_map + */ +static void ntfs_inode_dir_map (ntfs_inode *ino) +{ + ATTR_RECORD *rec; + FILE_NAME_ATTR *fn; + ntfs_inode *parent; + + if (!ino) + return; + + printf ("open inode %lld\n", ino->mft_no); + + if (ino->mft_no == FILE_root) { + printf ("done\n"); + return; + } + + rec = find_first_attribute (AT_FILE_NAME, ino->mrec); + if (!rec) + return; + + fn = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); + + parent = ntfs_inode_open (ino->vol, fn->parent_directory); + if (parent) { + ntfs_inode_dir_map (parent); + ntfs_inode_close (parent); + } +} + +/** + * ntfs_inode_open2 + */ +static ntfs_inode *ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) +{ + ntfs_inode *ino = NULL; + struct ntfs_dt *dt; + + if (!vol) + return NULL; + + switch (mref) { + case FILE_Bitmap: ino = vol->lcnbmp_ni; break; + case FILE_MFT: ino = vol->mft_ni; break; + case FILE_MFTMirr: ino = vol->mftmirr_ni; break; + case FILE_root: + if (vol->private_data) { + dt = (struct ntfs_dt *) vol->private_data; + if (dt->dir) { + ino = dt->dir->inode; + } + } + break; + } + + if (ino) { + printf (BOLD YELLOW "inode reuse %lld\n" END, mref); + ino->ref_count++; + return ino; + } + + ino = ntfs_inode_open (vol, mref); + if (!ino) + return NULL; + + /* + if (mref != FILE_root) + ntfs_inode_dir_map (ino); + */ + + // link + // ino->private_data + + ino->ref_count = 1; + + printf (BOLD YELLOW "inode open %lld\n" END, mref); + return ino; +} + +/** + * ntfs_inode_close2 + */ +static int ntfs_inode_close2 (ntfs_inode *ni) +{ + if (!ni) + return 0; + + printf (BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); + + ni->ref_count--; + if (ni->ref_count > 0) + return 0; + + // unlink + // ino->private_data + + return ntfs_inode_close (ni); +} + + /** * ntfs_dir_alloc */ @@ -1690,13 +1799,13 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) if (!vol) return NULL; - inode = ntfs_inode_open (vol, mft_num); + inode = ntfs_inode_open2 (vol, mft_num); if (!inode) return NULL; dir = calloc (1, sizeof (*dir)); if (!dir) { - ntfs_inode_close (inode); + ntfs_inode_close2 (inode); return NULL; } @@ -1754,7 +1863,7 @@ static void ntfs_dir_free (struct ntfs_dir *dir) ntfs_attr_close (dir->iroot); ntfs_attr_close (dir->ialloc); ntfs_attr_close (dir->ibmp); - ntfs_inode_close (dir->inode); + ntfs_inode_close2 (dir->inode); for (i = 0; i < dir->child_count; i++) ntfs_dir_free (dir->children[i]); @@ -1838,6 +1947,165 @@ static int ntfs_dir_rollback (struct ntfs_dir *dir) } +/** + * ntfs_umount2 + */ +static int ntfs_umount2 (ntfs_volume *vol, const BOOL force) +{ + if (!vol) + return 0; + + // unlink + // vol->lcnbmp_ni->private_data + // vol->mft_ni->private_data + // vol->mftmirr_ni->private_data + + // ntfs_dir_free (vol->private_data); + // now dt_free + + return ntfs_umount (vol, force); +} + +/** + * utils_mount_volume2 + */ +static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flags, BOOL force) +{ + static ntfschar bmp[8] = { + const_cpu_to_le16('$'), + const_cpu_to_le16('B'), + const_cpu_to_le16('i'), + const_cpu_to_le16('t'), + const_cpu_to_le16('m'), + const_cpu_to_le16('a'), + const_cpu_to_le16('p'), + const_cpu_to_le16(0) + }; + + static ntfschar mft[5] = { + const_cpu_to_le16('$'), + const_cpu_to_le16('M'), + const_cpu_to_le16('F'), + const_cpu_to_le16('T'), + const_cpu_to_le16(0) + }; + + static ntfschar mftmirr[9] = { + const_cpu_to_le16('$'), + const_cpu_to_le16('M'), + const_cpu_to_le16('F'), + const_cpu_to_le16('T'), + const_cpu_to_le16('M'), + const_cpu_to_le16('i'), + const_cpu_to_le16('r'), + const_cpu_to_le16('r'), + const_cpu_to_le16(0) + }; + + static ntfschar dot[2] = { + const_cpu_to_le16('.'), + const_cpu_to_le16(0) + }; + + ntfs_volume *vol; + ntfs_inode *ni; + struct ntfs_dir *dir; + struct ntfs_dt *root; + struct ntfs_dt *found; + int num; + + vol = utils_mount_volume (device, flags, force); + if (!vol) + return NULL; + + vol->lcnbmp_ni ->ref_count = 1; + vol->mft_ni ->ref_count = 1; + vol->mftmirr_ni->ref_count = 1; + + vol->lcnbmp_ni ->private_data = NULL; + vol->mft_ni ->private_data = NULL; + vol->mftmirr_ni->private_data = NULL; + + dir = ntfs_dir_alloc (vol, FILE_root); + if (!dir) { + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + + dir->index = ntfs_dt_alloc (dir, NULL, -1); + + root = dir->index; + + //$Bitmap + num = -1; + found = ntfs_dt_find2 (root, bmp, 7, &num); + if ((!found) || (num < 0)) { + printf ("can't find $Bitmap\n"); + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + vol->lcnbmp_ni->ref_count++; + vol->lcnbmp_ni->private_data = found->dir; + found->inodes[num] = vol->lcnbmp_ni; + + //$MFT + num = -1; + found = ntfs_dt_find2 (root, mft, 4, &num); + if ((!found) || (num < 0)) { + printf ("can't find $MFT\n"); + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + vol->mft_ni->ref_count++; + vol->mft_ni->private_data = found->dir; + found->inodes[num] = vol->mft_ni; + + //$MFTMirr + num = -1; + found = ntfs_dt_find2 (root, mftmirr, 8, &num); + if ((!found) || (num < 0)) { + printf ("can't find $MFTMirr\n"); + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + vol->mftmirr_ni->ref_count++; + vol->mftmirr_ni->private_data = found->dir; + found->inodes[num] = vol->mftmirr_ni; + + ni = ntfs_inode_open (vol, FILE_root); + if (!ni) { + printf ("can't find root dir\n"); + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + + // root directory + num = -1; + found = ntfs_dt_find2 (root, dot, 1, &num); + if ((!found) || (num < 0)) { + printf ("can't find the root directory\n"); + ntfs_inode_close (ni); + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + + dir->inode = ni; + vol->private_data = found; + ni->private_data = found; + found->inodes[num] = ni; + ni->ref_count = 2; + +done: + return vol; +} + + /** * utils_pathname_to_mftref */ @@ -2015,7 +2283,36 @@ static int utils_mftrec_mark_free4 (ntfs_inode *inode) rec = (MFT_RECORD*) inode->mrec; if ((rec->flags & MFT_RECORD_IN_USE) == 0) { - Eprintf ("MFT record isn't in use (2).\n"); + Eprintf ("MFT record isn't in use (3).\n"); + return -1; + } + + rec->flags &= ~MFT_RECORD_IN_USE; + + //printf ("\n"); + //utils_dump_mem (buffer, 0, 1024, DM_DEFAULTS); + + printf (GREEN "Modified: inode %lld MFT_RECORD header\n" END, inode->mft_no); + return 0; +} + +/** + * utils_mftrec_mark_free5 + */ +static int utils_mftrec_mark_free5 (ntfs_inode *inode, struct ntfs_bmp *bmp, MFT_REF mref) +{ + MFT_RECORD *rec; + + if (!inode) + return -1; + + if (ntfs_bmp_set_range (bmp, (VCN) MREF (mref), 1, 0) < 0) + return -1; + + rec = (MFT_RECORD*) inode->mrec; + + if ((rec->flags & MFT_RECORD_IN_USE) == 0) { + Eprintf ("MFT record isn't in use (4).\n"); return -1; } @@ -2114,6 +2411,94 @@ static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) return 0; } +/** + * utils_pathname_to_inode2 + */ +static ntfs_inode * utils_pathname_to_inode2 (ntfs_volume *vol, ntfs_inode *parent, const char *pathname) +{ + u64 inum; + int len; + char *p, *q; + ntfs_inode *ni; + ntfs_inode *result = NULL; + ntfschar *unicode = NULL; + char *ascii = NULL; + + if (!vol || !pathname) { + errno = EINVAL; + return NULL; + } + + if (parent) { + ni = parent; + } else { + ni = ntfs_inode_open2 (vol, FILE_root); + if (!ni) { + Eprintf ("Couldn't open the inode of the root directory.\n"); + goto close; + } + } + + if (!ni->private_data) { + Eprintf ("Inode doesn't have directory information attached.\n"); + goto close; + } + + unicode = calloc (1, MAX_PATH); + ascii = strdup (pathname); // Work with a r/w copy + if (!unicode || !ascii) { + Eprintf ("Out of memory.\n"); + goto close; + } + + p = ascii; + while (p && *p && *p == PATH_SEP) // Remove leading /'s + p++; + while (p && *p) { + q = strchr (p, PATH_SEP); // Find the end of the first token + if (q != NULL) { + *q = '\0'; + q++; + } + + len = ntfs_mbstoucs (p, &unicode, MAX_PATH); + if (len < 0) { + Eprintf ("Couldn't convert name to Unicode: %s.\n", p); + goto close; + } + + inum = ntfs_inode_lookup_by_name (ni, unicode, len); + if (inum == (u64)-1) { + Eprintf ("Couldn't find name '%s' in pathname '%s'.\n", p, pathname); + goto close; + } + + if (ni != parent) + ntfs_inode_close2 (ni); + + inum = MREF (inum); + ni = ntfs_inode_open2 (vol, inum); + if (!ni) { + Eprintf ("Cannot open inode %llu: %s.\n", + (unsigned long long)inum, p); + goto close; + } + + p = q; + while (p && *p && *p == PATH_SEP) + p++; + } + + result = ni; + ni = NULL; +close: + if (ni && (ni != parent)) + ntfs_inode_close2 (ni); + free (ascii); + free (unicode); + return result; +} + /** * ntfs_mft_resize_resident @@ -3037,7 +3422,7 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) goto close; } - ichild = ntfs_inode_open (dt->dir->vol, MREF (ie->indexed_file)); + ichild = ntfs_inode_open2 (dt->dir->vol, MREF (ie->indexed_file)); if (!ichild) { printf ("can't open inode\n"); goto close; @@ -3071,7 +3456,7 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) goto close; } - iparent = ntfs_inode_open (dt->dir->vol, mft_num); + iparent = ntfs_inode_open2 (dt->dir->vol, mft_num); if (!iparent) { printf ("can't open parent directory\n"); goto close; @@ -3096,8 +3481,8 @@ static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) close: ntfs_attr_put_search_ctx (ctx); ntfs_attr_close (attr); - ntfs_inode_close (iparent); - ntfs_inode_close (ichild); + ntfs_inode_close2 (iparent); + ntfs_inode_close2 (ichild); return res; } @@ -3325,11 +3710,11 @@ static int ntfs_dt_add2 (INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, stru int need; int space; int median; - struct ntfs_dt *new; + struct ntfs_dt *new = NULL; struct ntfs_dt *chl; INDEX_ENTRY *med_ie; FILE_NAME_ATTR *file; - VCN vcn; + VCN vcn = 0; //int i; if (!ie || !suc) @@ -3534,7 +3919,7 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) INDEX_ENTRY *entry; u8 *ptr; int size; - VCN *newvcn; + VCN *newvcn = 0; ntfs_attr_mst_pread (attr, vcn*512, 1, sizeof (buffer), buffer); @@ -3549,7 +3934,7 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) ntfs_index_dump_alloc (attr, *newvcn, indent+4); } - printf ("%.*s", indent, space); + printf ("%.*s", indent, space_line); if (entry->flags & INDEX_ENTRY_END) { printf ("[END]"); @@ -3566,7 +3951,7 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) if (entry->flags & INDEX_ENTRY_END) break; } - printf ("%.*s", indent, space); + printf ("%.*s", indent, space_line); printf ("fill = %d/%d\n", block->index.index_length, block->index.allocated_size); return 0; } @@ -3583,7 +3968,7 @@ static int ntfs_index_dump (ntfs_inode *inode) INDEX_ENTRY *entry; u8 *ptr; int size; - VCN *vcn; + VCN *vcn = 0; if (!inode) return 0; @@ -3732,6 +4117,7 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) return 1; mft_num = utils_pathname_to_mftref (vol, root_dir, name, &find_dir); + // XXX mft_num not used if (!find_dir) { printf ("Couldn't find the index entry for %s\n", name); @@ -4009,6 +4395,16 @@ done: return 0; } +/** + * ntfs_file_remove2 + */ +static int ntfs_file_remove2 (ntfs_volume *vol, char *name) +{ + if (0) utils_mftrec_mark_free5 (NULL, NULL, 0); + + return ntfs_file_remove (vol, name); +} + /** * ntfs_test_bmp */ @@ -4020,7 +4416,7 @@ static int ntfs_test_bmp (ntfs_volume *vol, ntfs_inode *inode) //u8 *buffer; //int i; - volbmp = ntfs_inode_open (vol, FILE_Bitmap); + volbmp = ntfs_inode_open2 (vol, FILE_Bitmap); if (!volbmp) return 1; @@ -4072,13 +4468,13 @@ int main (int argc, char *argv[]) if (opts.noaction) flags |= MS_RDONLY; - vol = utils_mount_volume (opts.device, flags, opts.force); + vol = utils_mount_volume2 (opts.device, flags, opts.force); if (!vol) { printf ("!vol\n"); goto done; } - inode = utils_pathname_to_inode (vol, NULL, opts.file); + inode = utils_pathname_to_inode2 (vol, NULL, opts.file); if (!inode) { printf ("!inode\n"); goto done; @@ -4088,13 +4484,12 @@ int main (int argc, char *argv[]) if (0) result = ntfsrm (vol, opts.file); if (0) result = ntfs_ie_test(); if (0) result = ntfs_file_add (vol, opts.file); - if (1) result = ntfs_file_remove (vol, opts.file); + if (0) result = ntfs_file_remove2 (vol, opts.file); if (0) result = ntfs_test_bmp (vol, inode); done: - ntfs_inode_close (inode); - ntfs_umount (vol, FALSE); + ntfs_inode_close2 (inode); + ntfs_umount2 (vol, FALSE); return result; } - From 552a8e42bec8d672065ff7368d9664b6c51bdc5b Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 13 Aug 2004 11:37:54 +0000 Subject: [PATCH 1688/2994] keep track of inodes (Logical change 1.495) --- ntfsprogs/ntfsrm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/ntfsrm.h b/ntfsprogs/ntfsrm.h index 5938621b..035c8ca6 100644 --- a/ntfsprogs/ntfsrm.h +++ b/ntfsprogs/ntfsrm.h @@ -65,6 +65,7 @@ struct ntfs_dt { int child_count; INDEX_ENTRY **children; struct ntfs_dt **sub_nodes; + ntfs_inode **inodes; INDEX_HEADER *header; VCN vcn; BOOL changed; From ae162587c735489765398a89fc40451571d5f1e3 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 13 Aug 2004 11:37:54 +0000 Subject: [PATCH 1689/2994] ntfsrm: start integrating ntfs_dir, ntfs_volume and ntfs_inode BKrev: 411ca812qSAkPEyM4gOWgfXKeqkLaA From 7b752dceda78b28baa91b21429fa5607729dec15 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 13 Aug 2004 12:02:34 +0000 Subject: [PATCH 1690/2994] clear up everything on umount (Logical change 1.496) --- ntfsprogs/ntfsrm.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index a99a2875..da513ce8 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1092,7 +1092,7 @@ static void ntfs_dt_free (struct ntfs_dt *dt) free (dt->sub_nodes); free (dt->children); free (dt->inodes); - free (dt->data); + free (dt->data); // XXX is this always ours? free (dt); } @@ -1742,7 +1742,7 @@ static ntfs_inode *ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) } if (ino) { - printf (BOLD YELLOW "inode reuse %lld\n" END, mref); + //printf (BOLD YELLOW "inode reuse %lld\n" END, mref); ino->ref_count++; return ino; } @@ -1761,7 +1761,7 @@ static ntfs_inode *ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) ino->ref_count = 1; - printf (BOLD YELLOW "inode open %lld\n" END, mref); + //printf (BOLD YELLOW "inode open %lld\n" END, mref); return ino; } @@ -1773,7 +1773,7 @@ static int ntfs_inode_close2 (ntfs_inode *ni) if (!ni) return 0; - printf (BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); + //printf (BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); ni->ref_count--; if (ni->ref_count > 0) @@ -1860,17 +1860,17 @@ static void ntfs_dir_free (struct ntfs_dir *dir) } } - ntfs_attr_close (dir->iroot); - ntfs_attr_close (dir->ialloc); - ntfs_attr_close (dir->ibmp); + ntfs_attr_close (dir->iroot); + ntfs_attr_close (dir->ialloc); + ntfs_attr_close (dir->ibmp); ntfs_inode_close2 (dir->inode); + ntfs_dt_free (dir->index); + for (i = 0; i < dir->child_count; i++) ntfs_dir_free (dir->children[i]); free (dir->children); - - ntfs_dt_free (dir->index); free (dir); } @@ -1952,16 +1952,16 @@ static int ntfs_dir_rollback (struct ntfs_dir *dir) */ static int ntfs_umount2 (ntfs_volume *vol, const BOOL force) { + struct ntfs_dt *dt; + if (!vol) return 0; - // unlink - // vol->lcnbmp_ni->private_data - // vol->mft_ni->private_data - // vol->mftmirr_ni->private_data - - // ntfs_dir_free (vol->private_data); - // now dt_free + dt = (struct ntfs_dt *) vol->private_data; + if (dt) { + vol->private_data = NULL; + ntfs_dir_free (dt->dir); + } return ntfs_umount (vol, force); } From fd4d5985b3d8c23d1c719057ca98b8f928d34e95 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 13 Aug 2004 12:02:34 +0000 Subject: [PATCH 1691/2994] ntfsrm: clear up on umount BKrev: 411cadda9iP2vopE8GNHWB2UTVYo_w From 78e3bdfd76514060ad9cee9b72b64fb2263b190a Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 14 Aug 2004 15:27:00 +0000 Subject: [PATCH 1692/2994] find diverse objects (Logical change 1.497) --- ntfsprogs/ntfsrm.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ntfsprogs/ntfsrm.h b/ntfsprogs/ntfsrm.h index 035c8ca6..10b03825 100644 --- a/ntfsprogs/ntfsrm.h +++ b/ntfsprogs/ntfsrm.h @@ -91,6 +91,17 @@ struct ntfs_dir { int index_size; }; +/** + * struct ntfs_find + */ +struct ntfs_find { + ntfs_inode *inode; + struct ntfs_dir *dir; + struct ntfs_dt *dt; + int dt_index; + MFT_REF mref; +}; + #define RED "" #define GREEN "" From e5e3454756e1cc2146a784753a4922a5897d6bb5 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 14 Aug 2004 15:27:00 +0000 Subject: [PATCH 1693/2994] ntfsrm: find files using the directory objects BKrev: 411e2f44QF_CHFafkAjVH8dOgw2Dbw From a78b1c7b03141885c44b55d2e67813002a22b05c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 14 Aug 2004 15:27:00 +0000 Subject: [PATCH 1694/2994] use the directory objects to lookup files (Logical change 1.497) --- ntfsprogs/ntfsrm.c | 251 +++++++++++++++++++++++++++------------------ 1 file changed, 150 insertions(+), 101 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index da513ce8..a3ab1bf2 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1759,6 +1759,7 @@ static ntfs_inode *ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) // link // ino->private_data + ino->private_data = NULL; ino->ref_count = 1; //printf (BOLD YELLOW "inode open %lld\n" END, mref); @@ -1786,60 +1787,6 @@ static int ntfs_inode_close2 (ntfs_inode *ni) } -/** - * ntfs_dir_alloc - */ -static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) -{ - struct ntfs_dir *dir = NULL; - ntfs_inode *inode = NULL; - ATTR_RECORD *rec = NULL; - INDEX_ROOT *ir = NULL; - - if (!vol) - return NULL; - - inode = ntfs_inode_open2 (vol, mft_num); - if (!inode) - return NULL; - - dir = calloc (1, sizeof (*dir)); - if (!dir) { - ntfs_inode_close2 (inode); - return NULL; - } - - dir->inode = inode; - dir->iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); - dir->ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); - dir->ibmp = ntfs_attr_open (inode, AT_BITMAP, I30, 4); - - dir->vol = vol; - dir->parent = NULL; - dir->name = NULL; - dir->name_len = 0; - dir->index = NULL; - dir->children = NULL; - dir->child_count = 0; - dir->mft_num = mft_num; - dir->bitmap = NULL; - - if (dir->ialloc) { - rec = find_first_attribute (AT_INDEX_ROOT, inode->mrec); - ir = (INDEX_ROOT*) ((u8*)rec + rec->value_offset); - dir->index_size = ir->index_block_size; - } else { - dir->index_size = 0; - } - - if (!dir->iroot) { - free (dir); - return NULL; - } - - return dir; -} - /** * ntfs_dir_free */ @@ -1874,6 +1821,77 @@ static void ntfs_dir_free (struct ntfs_dir *dir) free (dir); } +/** + * ntfs_dir_alloc + */ +static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) +{ + struct ntfs_dir *dir = NULL; + ntfs_inode *inode = NULL; + ATTR_RECORD *rec = NULL; + INDEX_ROOT *ir = NULL; + + if (!vol) + return NULL; + + //printf ("ntfs_dir_alloc %lld\n", MREF (mft_num)); + inode = ntfs_inode_open2 (vol, mft_num); + if (!inode) + return NULL; + + dir = calloc (1, sizeof (*dir)); + if (!dir) { + ntfs_inode_close2 (inode); + return NULL; + } + + dir->inode = inode; + dir->iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); + dir->ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); + dir->ibmp = ntfs_attr_open (inode, AT_BITMAP, I30, 4); + + dir->vol = vol; + dir->parent = NULL; + dir->name = NULL; + dir->name_len = 0; + dir->index = NULL; + dir->children = NULL; + dir->child_count = 0; + dir->mft_num = mft_num; + dir->bitmap = NULL; + + if (dir->ialloc) { + rec = find_first_attribute (AT_INDEX_ROOT, inode->mrec); + ir = (INDEX_ROOT*) ((u8*)rec + rec->value_offset); + dir->index_size = ir->index_block_size; + } else { + dir->index_size = 0; + } + + if (!dir->iroot) { + ntfs_dir_free (dir); + return NULL; + } + + return dir; +} + +/** + * ntfs_dir_add + */ +static void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) +{ + if (!parent || !child) + return; + + parent->child_count++; + //printf ("child count = %d\n", parent->child_count); + parent->children = realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); + child->parent = parent; + + parent->children[parent->child_count-1] = child; +} + /** * ntfs_dir_find */ @@ -1903,19 +1921,51 @@ static MFT_REF ntfs_dir_find (struct ntfs_dir *dir, char *name) } /** - * ntfs_dir_add + * ntfs_dir_find2 */ -static void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) +static struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, int name_len) { - if (!parent || !child) - return; + int i; + struct ntfs_dir *child = NULL; + struct ntfs_dt *dt = NULL; + int dt_num = 0; + INDEX_ENTRY *ie; + MFT_REF mft_num; - parent->child_count++; - //printf ("child count = %d\n", parent->child_count); - parent->children = realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); - child->parent = parent; + if (!dir || !name) + return NULL; - parent->children[parent->child_count-1] = child; + if (!dir->index) { // XXX when will this happen? + printf ("ntfs_dir_find2 - directory has no index\n"); + return NULL; + } + + for (i = 0; i < dir->child_count; i++) { + if (0 == ntfs_names_collate (name, name_len, + dir->children[i]->name, + dir->children[i]->name_len, + 2, IGNORE_CASE, + dir->vol->upcase, + dir->vol->upcase_len)) + return dir->children[i]; + } + + dt = ntfs_dt_find2 (dir->index, name, name_len, &dt_num); + if (!dt) { + printf ("can't find name in dir\n"); + return NULL; + } + + ie = dt->children[dt_num]; + + mft_num = ie->indexed_file; + + child = ntfs_dir_alloc (dir->vol, mft_num); + child->index = ntfs_dt_alloc (child, NULL, -1); + + ntfs_dir_add (dir, child); + + return child; } /** @@ -2414,37 +2464,37 @@ static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) /** * utils_pathname_to_inode2 */ -static ntfs_inode * utils_pathname_to_inode2 (ntfs_volume *vol, ntfs_inode *parent, const char *pathname) +static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, const char *pathname, struct ntfs_find *found) { - u64 inum; int len; char *p, *q; - ntfs_inode *ni; - ntfs_inode *result = NULL; - ntfschar *unicode = NULL; - char *ascii = NULL; + ntfschar *unicode = NULL; + char *ascii = NULL; + struct ntfs_dir *dir = NULL; + struct ntfs_dir *child = NULL; + struct ntfs_dt *dt = NULL; + BOOL result = FALSE; - if (!vol || !pathname) { + if (!vol || !pathname || !found) { errno = EINVAL; - return NULL; + return FALSE; } + memset (found, 0, sizeof (*found)); + if (parent) { - ni = parent; + dir = parent; } else { - ni = ntfs_inode_open2 (vol, FILE_root); - if (!ni) { + dt = (struct ntfs_dt *) vol->private_data; + if (dt) + dir = dt->dir; + if (!dir) { Eprintf ("Couldn't open the inode of the root directory.\n"); goto close; } } - if (!ni->private_data) { - Eprintf ("Inode doesn't have directory information attached.\n"); - goto close; - } - - unicode = calloc (1, MAX_PATH); + unicode = malloc (MAX_PATH * sizeof (ntfschar)); ascii = strdup (pathname); // Work with a r/w copy if (!unicode || !ascii) { Eprintf ("Out of memory.\n"); @@ -2467,33 +2517,28 @@ static ntfs_inode * utils_pathname_to_inode2 (ntfs_volume *vol, ntfs_inode *pare goto close; } - inum = ntfs_inode_lookup_by_name (ni, unicode, len); - if (inum == (u64)-1) { - Eprintf ("Couldn't find name '%s' in pathname '%s'.\n", p, pathname); - goto close; - } - - if (ni != parent) - ntfs_inode_close2 (ni); - - inum = MREF (inum); - ni = ntfs_inode_open2 (vol, inum); - if (!ni) { - Eprintf ("Cannot open inode %llu: %s.\n", - (unsigned long long)inum, p); - goto close; + //printf ("looking for %s\n", p); + if (q) { + child = ntfs_dir_find2 (dir, unicode, len); + if (!child) { + printf ("can't find %s in %s\n", p, pathname); + break; + } + } else { + printf ("file: %s\n", p); + break; } + dir = child; + child = NULL; p = q; while (p && *p && *p == PATH_SEP) p++; } - result = ni; - ni = NULL; + found->dir = dir; + result = TRUE; close: - if (ni && (ni != parent)) - ntfs_inode_close2 (ni); free (ascii); free (unicode); return result; @@ -4452,6 +4497,7 @@ int main (int argc, char *argv[]) ntfs_inode *inode = NULL; int flags = 0; int result = 1; + struct ntfs_find find; if (!parse_options (argc, argv)) goto done; @@ -4474,12 +4520,15 @@ int main (int argc, char *argv[]) goto done; } - inode = utils_pathname_to_inode2 (vol, NULL, opts.file); - if (!inode) { + if (utils_pathname_to_inode2 (vol, NULL, opts.file, &find) == FALSE) { printf ("!inode\n"); goto done; } + inode = find.inode; + + //printf ("inode = %lld\n", inode->mft_no); + if (0) result = ntfs_index_dump (inode); if (0) result = ntfsrm (vol, opts.file); if (0) result = ntfs_ie_test(); From 24d811c68222f42eb241f2457dde88391dae90e0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 15 Aug 2004 21:04:22 +0000 Subject: [PATCH 1695/2994] Fix some bugs in error recovery code path (runlist unterminated and one bit was not recovered). (Logical change 1.498) --- libntfs/lcnalloc.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 860dee2a..de9a0cad 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -273,23 +273,16 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, __FUNCTION__); continue; } - /* Allocate the bitmap bit. */ - *byte |= bit; - /* We need to write this bitmap buffer back to disk! */ - need_writeback = 1; - Dprintf("%s(): *byte = 0x%x, need_writeback is set.\n", - __FUNCTION__, (unsigned int)*byte); /* Reallocate memory if necessary. */ - if ((rlpos + 2) * (int)sizeof(runlist) >= rlsize) { + if ((rlpos + 3) * (int)sizeof(runlist) >= rlsize) { Dprintf("%s(): Reallocating space.\n", __FUNCTION__); - /* Setup first free bit return value. */ - if (!rl) { - start_lcn = lcn + bmp_pos; - Dprintf("%s(): start_lcn = 0x%llx.\n", + if (!rl) + Dprintf("%s(): First free bit is at " + "LCN = 0x%llx.\n", __FUNCTION__, - (long long)start_lcn); - } + (long long)(lcn + + bmp_pos)); rlsize += 4096; trl = (runlist*)realloc(rl, rlsize); if (!trl) { @@ -305,6 +298,12 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, "0x%x.\n", __FUNCTION__, rlsize); } + /* Allocate the bitmap bit. */ + *byte |= bit; + /* We need to write this bitmap buffer back to disk! */ + need_writeback = 1; + Dprintf("%s(): *byte = 0x%x, need_writeback is set.\n", + __FUNCTION__, (unsigned int)*byte); /* * Coalesce with previous run if adjacent LCNs. * Otherwise, append a new run. @@ -775,6 +774,10 @@ err_ret: (long long)rl[0].lcn, (long long)count - clusters); } + /* Add runlist terminator element. */ + rl[rlpos].vcn = rl[rlpos - 1].vcn + rl[rlpos - 1].length; + rl[rlpos].lcn = LCN_ENOENT; + rl[rlpos].length = 0; /* Deallocate all allocated clusters. */ Dprintf("%s(): Deallocating allocated clusters.\n", __FUNCTION__); From ddd4ce768857e1299fb196a6628651a04d9f20d5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 15 Aug 2004 21:04:22 +0000 Subject: [PATCH 1696/2994] Update (Logical change 1.498) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 96525119..6110d685 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,6 +41,7 @@ xx/xx/2004 - 1.9.3-WIP - Bugfix in ntfs_attr_map{_whole_,_}runlist: make it not fail if runlist already mapped. (Yura) - Make ntfslabel pay attention to --no-action. (Yuval) + - Several bugfixes in ntfs_cluster_alloc. (Anton) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From 9b7a86bd3a9282260d472c8890fbd023234bd76d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sun, 15 Aug 2004 21:04:22 +0000 Subject: [PATCH 1697/2994] lcnalloc.c: Fix some bugs in error recovery code path of ntfs_cluster_alloc() (runlist unterminated and one bit was not recovered). (Anton) BKrev: 411fcfd6wPnfWQ29VNvZlJPWpdFVDQ From 9fd1edce61611ae85f29fc0f4d8a48ab931c47e4 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 16 Aug 2004 20:14:59 +0000 Subject: [PATCH 1698/2994] Undelete in-use clusters as well (Logical change 1.499) --- ntfsprogs/ntfsundelete.c | 13 +++++++++++-- ntfsprogs/ntfsundelete.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 5d479b57..96e37373 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -221,6 +221,7 @@ static void usage (void) "\n" " -u nums --undelete nums Undelete inodes\n" " -o file --output file Save with this filename\n" + " -O --optimistic Undelete in-use clusters as well\n" " -d dir --destination dir Destination directory\n" " -b num --byte num Fill missing parts with this byte\n" " -T --truncate Truncate 100%% recoverable file to exact size.\n" @@ -390,7 +391,7 @@ static int parse_time (const char *value, time_t *since) */ static int parse_options (int argc, char *argv[]) { - static const char *sopt = "-b:Cc:d:fh?m:o:p:sS:t:Tu:qvV"; + static const char *sopt = "-b:Cc:d:fh?m:o:Op:sS:t:Tu:qvV"; static const struct option lopt[] = { { "byte", required_argument, NULL, 'b' }, { "case", no_argument, NULL, 'C' }, @@ -400,6 +401,7 @@ static int parse_options (int argc, char *argv[]) { "help", no_argument, NULL, 'h' }, { "match", required_argument, NULL, 'm' }, { "output", required_argument, NULL, 'o' }, + { "optimistic", no_argument, NULL, 'O' }, { "percentage", required_argument, NULL, 'p' }, { "scan", no_argument, NULL, 's' }, { "size", required_argument, NULL, 'S' }, @@ -486,6 +488,13 @@ static int parse_options (int argc, char *argv[]) err++; } break; + case 'O': + if (!opts.optimistic) { + opts.optimistic++; + } else { + err++; + } + break; case 'p': if (opts.percent == -1) { end = NULL; @@ -1666,7 +1675,7 @@ static int undelete_file (ntfs_volume *vol, long long inode) end = rl[i].lcn + rl[i].length; for (j = start; j < end; j++) { - if (utils_cluster_in_use (vol, j)) { + if (utils_cluster_in_use (vol, j) && !opts.optimistic) { memset (buffer, opts.fillbyte, bufsize); if (write_data (fd, buffer, bufsize) < bufsize) { Eprintf ("Write failed: %s\n", strerror (errno)); diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index 2e0a2189..4a25af98 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -50,6 +50,7 @@ struct options { int quiet; /* Less output */ int verbose; /* Extra output */ int force; /* Override common sense */ + int optimistic; /* Undelete in-use clusters as well */ time_t since; /* Since this time */ s64 size_begin; /* Range for file size */ s64 size_end; From 7c9405a38838f036fe04a05c764e06f91c108b6b Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 16 Aug 2004 20:14:59 +0000 Subject: [PATCH 1699/2994] ntfsundelete: Recover in-use clusters as well (Giang,Carmelo) BKrev: 412115c3vasFNkvLcttTWHzyGCGW3Q From 129a7f0399aef5ce84849569361d0e1cda080235 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 17 Aug 2004 20:45:18 +0000 Subject: [PATCH 1700/2994] Fix ntfs_cluster_alloc() to use LCN_RL_NOT_MAPPED rather than LCN_ENOENT as runlist terminator. Also, make it not create a LCN_RL_NOT_MAPPED element at the beginning. (Logical change 1.500) --- libntfs/lcnalloc.c | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index de9a0cad..4859e93b 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -114,19 +114,12 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, /* Return empty runlist if @count == 0 */ if (!count) { - rl = malloc (0x1000); + rl = malloc(0x1000); if (!rl) return NULL; - rlpos = 0; - if (start_vcn) { - rl[0].vcn = 0; - rl[0].lcn = LCN_RL_NOT_MAPPED; - rl[0].length = start_vcn; - rlpos++; - } - rl[rlpos].vcn = start_vcn; - rl[rlpos].lcn = LCN_ENOENT; - rl[rlpos].length = 0; + rl[0].vcn = start_vcn; + rl[0].lcn = LCN_RL_NOT_MAPPED; + rl[0].length = 0; return rl; } @@ -345,13 +338,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, Dprintf("%s(): Adding new run, is " "first run.\n", __FUNCTION__); - rl[rlpos].vcn = 0; - if (start_vcn) { - rl[0].lcn = LCN_RL_NOT_MAPPED; - rl[0].length = start_vcn; - rl[1].vcn = start_vcn; - rlpos = 1; - } + rl[rlpos].vcn = start_vcn; } rl[rlpos].lcn = prev_lcn = lcn + bmp_pos; rl[rlpos].length = prev_run_len = 1; @@ -719,7 +706,7 @@ done_ret: Dprintf("%s(): At done_ret.\n"); /* Add runlist terminator element. */ rl[rlpos].vcn = rl[rlpos - 1].vcn + rl[rlpos - 1].length; - rl[rlpos].lcn = LCN_ENOENT; + rl[rlpos].lcn = LCN_RL_NOT_MAPPED; rl[rlpos].length = 0; if (need_writeback) { s64 bw; @@ -776,7 +763,7 @@ err_ret: } /* Add runlist terminator element. */ rl[rlpos].vcn = rl[rlpos - 1].vcn + rl[rlpos - 1].length; - rl[rlpos].lcn = LCN_ENOENT; + rl[rlpos].lcn = LCN_RL_NOT_MAPPED; rl[rlpos].length = 0; /* Deallocate all allocated clusters. */ Dprintf("%s(): Deallocating allocated clusters.\n", @@ -806,20 +793,15 @@ err_ret: */ int ntfs_cluster_free_from_rl(ntfs_volume *vol, runlist *rl) { - while (rl->length) { - if (rl->lcn < 0) { - rl++; - continue; - } - if (ntfs_bitmap_clear_run(vol->lcnbmp_na, - rl->lcn, rl->length)) { + for (; rl->length; rl++) { + if (rl->lcn >= 0 && ntfs_bitmap_clear_run(vol->lcnbmp_na, + rl->lcn, rl->length)) { int eo = errno; fprintf(stderr, "%s(): Eeek! Deallocation of " "clusters failed.\n", __FUNCTION__); errno = eo; return -1; } - rl++; } return 0; } From bd32a5f43a401e724935dd280e12feca72d5ba18 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 17 Aug 2004 20:45:18 +0000 Subject: [PATCH 1701/2994] lcnalloc.c: Fix ntfs_cluster_alloc() to use LCN_RL_NOT_MAPPED rather than LCN_ENOENT as runlist terminator. Also, make it not create a LCN_RL_NOT_MAPPED element at the beginning. BKrev: 41226e5el_B6t-KN0L2ScPvul_APng From 183985792c52537d397db65bf4b4d305d2995b46 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 17 Aug 2004 21:07:00 +0000 Subject: [PATCH 1702/2994] Only need two spare runlist elements when realocating memory, not three since we no longer add a starting element. (Logical change 1.501) --- libntfs/lcnalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 4859e93b..93876858 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -267,7 +267,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, continue; } /* Reallocate memory if necessary. */ - if ((rlpos + 3) * (int)sizeof(runlist) >= rlsize) { + if ((rlpos + 2) * (int)sizeof(runlist) >= rlsize) { Dprintf("%s(): Reallocating space.\n", __FUNCTION__); if (!rl) From 11fa3eb6a917b334e84b24dd91945f2cf7959157 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 17 Aug 2004 21:07:00 +0000 Subject: [PATCH 1703/2994] lcnalloc.c: Only need two spare runlist elements when realocating memory, not three since we no longer add a starting element. BKrev: 41227374ygcn71Q3qM3GOQLEmm6uAw From 5c8a6b2a03e0b91add7b27d5181b4d3e841f0c7e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 18 Aug 2004 10:27:49 +0000 Subject: [PATCH 1704/2994] - Fix some warnings. (Anton) - Make all of libntfs only output anything if configured with --enable-debug. The only exception is ntfs_boot_sector_is_ntfs() which now uses a new function Sprintf(), provided by debug.h which can be #ifdef-ed out if people want it to be truly silent. (Anton) BKrev: 41232f25oIqaTZeJo9wp522TvGh4SQ From df05fa02ef23ace6539b66e2fb10c2087a3f439e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 18 Aug 2004 10:27:49 +0000 Subject: [PATCH 1705/2994] Add Sprintf(). (Logical change 1.502) --- include/ntfs/debug.h | 46 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/include/ntfs/debug.h b/include/ntfs/debug.h index 13bed18b..e2429b45 100644 --- a/include/ntfs/debug.h +++ b/include/ntfs/debug.h @@ -25,21 +25,52 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - #ifdef HAVE_STDIO_H # include #endif - -struct _runlist_element; - -#ifdef DEBUG - #ifdef HAVE_STDARG_H # include #endif #include -/* Debug output to stderr. To get it run ./configure --enable-debug. */ +#include "types.h" + +struct _runlist_element; + +/** + * Sprintf - silencable output to stderr + * @silent: if false string is output to stderr + * @fmt: printf style format string + * @...: optional arguments for the printf style format string + * + * If @silent is false, output the string @fmt to stderror. + * + * This is basically a replacelment for: + * + * if (!silent) + * fprintf(stderr, fmt, ...); + * + * It is more convenient to use Sprintf instead of the above code and perhaps + * more importantly, Sprintf makes it much easier to turn it into a "do + * nothing" function with an #ifdef, thus removing the whole output completely. + */ +static __inline__ void Sprintf(const BOOL silent, const char *fmt, ...) +{ + int eo; + va_list ap; + + if (silent) + return; + eo = errno; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + errno = eo; +} + +#ifdef DEBUG + +/* Debug output to stderr. To get it run ./configure --enable-debug. */ static __inline__ void Dprintf(const char *fmt, ...) { @@ -86,4 +117,3 @@ static __inline__ void ntfs_debug_runlist_dump(const struct _runlist_element *rl } #endif /* defined _NTFS_DEBUG_H */ - From 4910ed561c54cbcb29dfb5b9ecb602a688c7a35a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 18 Aug 2004 10:27:49 +0000 Subject: [PATCH 1706/2994] Change all output to only appear if configure with --enable-debug by using Dputs/Dprintf instead of fprintf(stderr,. (Logical change 1.502) --- libntfs/attrib.c | 140 +++++++++++++++++++++------------------------ libntfs/bitmap.c | 16 +++--- libntfs/lcnalloc.c | 43 +++++++------- libntfs/mft.c | 13 ++--- libntfs/runlist.c | 17 +++--- libntfs/volume.c | 4 +- libntfs/win32_io.c | 5 +- 7 files changed, 114 insertions(+), 124 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 7951754b..f4b5cc3e 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -82,8 +82,8 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, } /* Complex attribute? */ if (a->flags) { - puts("Enountered non-zero attribute flags. Cannot handle this " - "yet."); + Dputs("Enountered non-zero attribute flags. Cannot handle " + "this yet."); errno = ENOTSUP; return 0; } @@ -179,12 +179,10 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, errno = eo; } else if (r < rl[i].length << vol->cluster_size_bits) { - fprintf(stderr, ESTR ": Ran out of " - "input data.\n"); + Dputs(ESTR ": Ran out of input data."); errno = EIO; } else { - fprintf(stderr, ESTR ": unknown " - "error\n"); + Dputs(ESTR ": unknown error"); errno = EIO; } #undef ESTR @@ -217,11 +215,10 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, perror(ESTR); errno = eo; } else if (r < rl[i].length << vol->cluster_size_bits) { - fprintf(stderr, ESTR ": Ran out of input " - "data.\n"); + Dputs(ESTR ": Ran out of input data."); errno = EIO; } else { - fprintf(stderr, ESTR ": unknown error\n"); + Dputs(ESTR ": unknown error"); errno = EIO; } #undef ESTR @@ -2301,8 +2298,8 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, } if (move_name) { // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Name is placed after the " - "%s. Aborting...\n", __FUNCTION__, + Dprintf("%s(): Eeek! Name is placed after the %s. " + "Aborting...\n", __FUNCTION__, a->non_resident ? "mapping pairs array": "attribute value"); errno = ENOTSUP; @@ -2315,8 +2312,8 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, if (errno != ENOSPC) { int eo = errno; // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Attribute record resize " - "failed. Aborting...\n", __FUNCTION__); + Dprintf("%s(): Eeek! Attribute record resize failed. " + "Aborting...\n", __FUNCTION__); errno = eo; } return -1; @@ -2365,9 +2362,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, /* Some preliminary sanity checking. */ if (NAttrNonResident(na)) { // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Trying to make non-resident " - "attribute non-resident. Aborting...\n", - __FUNCTION__); + Dprintf("%s(): Eeek! Trying to make non-resident attribute " + "non-resident. Aborting...\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -2384,8 +2380,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, if (a->name_length && le16_to_cpu(a->name_offset) >= le16_to_cpu(a->value_offset)) { // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Name is placed after the " - "attribute value. Aborting...\n", __FUNCTION__); + Dprintf("%s(): Eeek! Name is placed after the attribute " + "value. Aborting...\n", __FUNCTION__); errno = ENOTSUP; return -1; } @@ -2401,9 +2397,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, int eo = errno; // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Failed to allocate " - "cluster(s). Aborting...\n", - __FUNCTION__); + Dprintf("%s(): Eeek! Failed to allocate cluster(s). " + "Aborting...\n", __FUNCTION__); errno = eo; } return -1; @@ -2431,8 +2426,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, if (bw != le32_to_cpu(a->value_length)) { err = errno; // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Failed to write out attribute " - "value (bw = %lli, errno = %i). Aborting...\n", + Dprintf("%s(): Eeek! Failed to write out attribute value " + "(bw = %lli, errno = %i). Aborting...\n", __FUNCTION__, (long long)bw, err); if (bw >= 0) err = EIO; @@ -2444,8 +2439,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, if (mp_size < 0) { err = errno; // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Failed to get size for mapping " - "pairs array. Aborting...\n", __FUNCTION__); + Dprintf("%s(): Eeek! Failed to get size for mapping pairs " + "array. Aborting...\n", __FUNCTION__); goto cluster_free_err_out; } @@ -2464,8 +2459,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, if (a->name_length && (le16_to_cpu(a->name_offset) + a->name_length > arec_size)) { // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Name exceeds new record size! " - "Not supported. Aborting...\n", __FUNCTION__); + Dprintf("%s(): Eeek! Name exceeds new record size! " + "Not supported. Aborting...\n", __FUNCTION__); err = ENOTSUP; goto cluster_free_err_out; } @@ -2475,9 +2470,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, err = errno; if (err != ENOSPC) { // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Failed to resize " - "attribute record. Aborting...\n", - __FUNCTION__); + Dprintf("%s(): Eeek! Failed to resize attribute " + "record. Aborting...\n", __FUNCTION__); } goto cluster_free_err_out; } @@ -2519,10 +2513,10 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, rl) < 0) { err = errno; // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! Failed to build mapping pairs. " - "Leaving corrupt attribute record on disk. " - "In memory runlist is still intact! Error " - "code is %i. FIXME: Need to rollback " + Dprintf("%s(): Eeek! Failed to build mapping pairs. Leaving " + "corrupt attribute record on disk. " + "In memory runlist is still intact! Error " + "code is %i. FIXME: Need to rollback " "instead!\n", __FUNCTION__, err); errno = err; return -1; @@ -2533,8 +2527,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, cluster_free_err_out: if (ntfs_cluster_free(vol, na, 0, -1) < 0) - fprintf(stderr, "%s(): Eeek! Failed to release allocated " - "clusters in error code path. Leaving " + Dprintf("%s(): Eeek! Failed to release allocated " + "clusters in error code path. Leaving " "inconsistent metadata...\n", __FUNCTION__); NAttrClearNonResident(na); na->allocated_size = na->data_size; @@ -2583,8 +2577,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) err = errno; if (err == ERANGE) { // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Size bounds check " - "failed. Aborting...\n", __FUNCTION__); + Dprintf("%s(): Eeek! Size bounds check failed. " + "Aborting...\n", __FUNCTION__); } else if (err == ENOENT) err = EIO; goto put_err_out; @@ -2610,8 +2604,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) err = errno; // FIXME: Eeek! if (err != ENOTSUP) - fprintf(stderr, "%s(): Eeek! Failed to resize " - "resident part of attribute. " + Dprintf("%s(): Eeek! Failed to resize " + "resident part of attribute. " "Aborting...\n", __FUNCTION__); goto put_err_out; } @@ -2634,9 +2628,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) } else if (errno != ENOSPC && errno != EPERM) { err = errno; // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Failed to make attribute " - "non-resident. Aborting...\n", - __FUNCTION__); + Dprintf("%s(): Eeek! Failed to make attribute non-resident. " + "Aborting...\n", __FUNCTION__); goto put_err_out; } @@ -2692,9 +2685,8 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) /* Some preliminary sanity checking. */ if (!NAttrNonResident(na)) { // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Trying to make resident " - "attribute resident. Aborting...\n", - __FUNCTION__); + Dprintf("%s(): Eeek! Trying to make resident attribute " + "resident. Aborting...\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -2717,8 +2709,8 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) if (a->name_length && le16_to_cpu(a->name_offset) >= le16_to_cpu(a->mapping_pairs_offset)) { // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Name is placed after the mapping " - "pairs array. Aborting...\n", __FUNCTION__); + Dprintf("%s(): Eeek! Name is placed after the mapping " + "pairs array. Aborting...\n", __FUNCTION__); errno = ENOTSUP; return -1; } @@ -2726,14 +2718,14 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) // FIXME: For now we cheat and assume there is no attribute list // attribute present. (AIA) if (NInoAttrList(na->ni)) { - fprintf(stderr, "%s(): Working on files with attribute list " + Dprintf("%s(): Working on files with attribute list " "attribute is not implemented yet.\n", __FUNCTION__); errno = ENOTSUP; return -1; } if (NAttrCompressed(na) || NAttrEncrypted(na)) { - fprintf(stderr, "%s(): Making compressed or encrypted files " + Dprintf("%s(): Making compressed or encrypted files " "resident is not implemented yet.\n", __FUNCTION__); errno = ENOTSUP; @@ -2761,7 +2753,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) /* Sanity check. */ if (le16_to_cpu(a->name_offset) + a->name_length > arec_size) { // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Name exceeds new record " + Dprintf("%s(): Eeek! Name exceeds new record " "size! Not supported. Aborting...\n", __FUNCTION__); errno = ENOTSUP; @@ -2778,7 +2770,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) if (errno != ENOSPC) { err = errno; // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Failed to resize " + Dprintf("%s(): Eeek! Failed to resize " "attribute record. Aborting...\n", __FUNCTION__); errno = err; @@ -2813,7 +2805,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) if (bytes_read < 0) err = errno; // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Failed to read attribute data. " + Dprintf("%s(): Eeek! Failed to read attribute data. " "Aborting...\n", __FUNCTION__); errno = err; return -1; @@ -2834,7 +2826,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) if (ntfs_cluster_free(vol, na, 0, -1) < 0) { err = errno; // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Failed to release allocated " + Dprintf("%s(): Eeek! Failed to release allocated " "clusters (error: %s). Ignoring error and " "leaving behind wasted clusters.\n", __FUNCTION__, strerror(err)); @@ -2906,7 +2898,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) err = errno; if (err == ERANGE) { // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Size bounds check " + Dprintf("%s(): Eeek! Size bounds check " "failed. Aborting...\n", __FUNCTION__); } else if (err == ENOENT) err = EIO; @@ -2973,7 +2965,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) if (nr_freed_clusters < 0) { err = errno; // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Freeing of clusters " + Dprintf("%s(): Eeek! Freeing of clusters " "failed. Aborting...\n", __FUNCTION__); goto put_err_out; } @@ -2981,7 +2973,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) if (ntfs_rl_truncate(&na->rl, first_free_vcn)) { err = errno; // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! Run list truncation " + Dprintf("%s(): Eeek! Run list truncation " "failed. Leaving inconsistent " "metadata!\n", __FUNCTION__); goto put_err_out; @@ -2994,7 +2986,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) vol->cluster_size_bits; // FIXME: Bug catcher. Remove later... (AIA) if (!newsize && na->compressed_size) { - fprintf(stderr, "%s(): Eeek! !newsize but " + Dprintf("%s(): Eeek! !newsize but " "na->compressed_size not zero " "(= %lli)! Fixing up by hand!\n", __FUNCTION__, (long long) @@ -3006,7 +2998,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) // FIXME: Bug catcher. Remove later... (AIA) if (na->compressed_size < 0) { // FIXME: Eeek! BUG! - fprintf(stderr, "%s(): Eeek! Compressed size " + Dprintf("%s(): Eeek! Compressed size " "is negative. Leaving " "inconsistent metadata!\n", __FUNCTION__); @@ -3026,7 +3018,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) if (mp_size <= 0) { err = errno; // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! Get size for mapping " + Dprintf("%s(): Eeek! Get size for mapping " "pairs failed. Leaving inconsistent " "metadata!\n", __FUNCTION__); goto put_err_out; @@ -3039,7 +3031,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) a->mapping_pairs_offset), mp_size, na->rl)) { err = errno; // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! Mapping pairs build " + Dprintf("%s(): Eeek! Mapping pairs build " "failed. Leaving inconsistent " "metadata!\n", __FUNCTION__); goto put_err_out; @@ -3063,7 +3055,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) } if (move_name) { // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Name is placed " + Dprintf("%s(): Eeek! Name is placed " "after the %s. Aborting...\n", __FUNCTION__, a->non_resident ? "mapping pairs array": @@ -3082,7 +3074,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) le32_to_cpu(a->length) + new_alen; if (new_muse > le32_to_cpu(m->bytes_allocated)) { // FIXME: Eeek! BUG() - fprintf(stderr, "%s(): Eeek! Ran out of space in mft " + Dprintf("%s(): Eeek! Ran out of space in mft " "record. Leaving inconsistent " "metadata!\n", __FUNCTION__); err = EIO; @@ -3182,7 +3174,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (a->name_length) { if (le16_to_cpu(a->name_offset) >= le16_to_cpu(a->mapping_pairs_offset)) { - fprintf(stderr, "%s(): Eeek! Name is placed after the " + Dprintf("%s(): Eeek! Name is placed after the " "mapping pairs array. Aborting...\n", __FUNCTION__); err = ENOTSUP; @@ -3197,7 +3189,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (ntfs_attr_size_bounds_check(vol, na->type, newsize) < 0) { err = errno; if (err == ERANGE) { - fprintf(stderr, "%s(): Eeek! Size bounds check " + Dprintf("%s(): Eeek! Size bounds check " "failed. Aborting...\n", __FUNCTION__); } else if (err == ENOENT) err = EIO; @@ -3222,7 +3214,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (ntfs_attr_map_runlist (na, 0)) { err = errno; - fprintf(stderr, "%s(): Eeek! " + Dprintf("%s(): Eeek! " "ntfs_attr_map_whole_runlist failed.\n", __FUNCTION__); goto put_err_out; @@ -3255,7 +3247,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) vol->cluster_size_bits); if (!rl) { err = errno; - fprintf(stderr, "%s(): Eeek! Cluster allocation " + Dprintf("%s(): Eeek! Cluster allocation " "failed.\n", __FUNCTION__); goto put_err_out; } @@ -3265,7 +3257,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (!rln) { /* Failed, free just allocated clusters */ err = errno; - fprintf(stderr, "%s(): Eeek! Run list merge " + Dprintf("%s(): Eeek! Run list merge " "failed.\n", __FUNCTION__); ntfs_cluster_free_from_rl (vol, rl); free (rl); @@ -3277,7 +3269,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); if (mp_size <= 0) { err = errno; - fprintf(stderr, "%s(): Eeek! Get size for mapping " + Dprintf("%s(): Eeek! Get size for mapping " "pairs failed.\n", __FUNCTION__); goto rollback; } @@ -3296,7 +3288,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (mp_size > exp_max_mp_size) { err = ENOTSUP; - fprintf(stderr, "%s(): Eeek! Maping pairs size is" + Dprintf("%s(): Eeek! Maping pairs size is" " too big.\n", __FUNCTION__); goto rollback; } @@ -3306,7 +3298,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) mft_rec_copy = malloc(mft_rec_copy_size); if (!mft_rec_copy) { err = ENOMEM; - fprintf(stderr, "%s(): Eeek! Not enough memory to " + Dprintf("%s(): Eeek! Not enough memory to " "allocate %d bytes.\n", __FUNCTION__, le32_to_cpu(m->bytes_in_use)); goto rollback; @@ -3324,7 +3316,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + new_alen; if (new_muse > le32_to_cpu(m->bytes_allocated)) { - fprintf(stderr, "%s(): BUG! Ran out of space in" + Dprintf("%s(): BUG! Ran out of space in" " mft record. Please run chkdsk" " and if that doesn't find any " "errors please report you saw " @@ -3350,7 +3342,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( a->mapping_pairs_offset), mp_size, na->rl)) { err = errno; - fprintf(stderr, "%s(): BUG! Mapping pairs build " + Dprintf("%s(): BUG! Mapping pairs build " "failed. Please run chkdsk and if " "that doesn't find any errors please " "report you saw this message to " @@ -3382,7 +3374,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) rollback: if (ntfs_cluster_free(vol, na, na->allocated_size >> vol->cluster_size_bits, -1) < 0) { - fprintf(stderr, "%s(): Eeek! Leaking clusters. Run chkdsk!\n", + Dprintf("%s(): Eeek! Leaking clusters. Run chkdsk!\n", __FUNCTION__); err = EIO; } diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index 8eda13e0..6f9252d8 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -29,7 +29,7 @@ #include "types.h" #include "attrib.h" #include "bitmap.h" - +#include "debug.h" /** * ntfs_bitmap_set_bits_in_run - set a run of bits in a bitmap to a value @@ -103,7 +103,7 @@ static __inline__ int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, lastbyte_pos = ((count + 7) >> 3) + firstbyte; if (!lastbyte_pos) { // FIXME: Eeek! BUG! - fprintf(stderr, "%s(): Eeek! lastbyte is zero. " + Dprintf("%s(): Eeek! lastbyte is zero. " "Leaving inconsistent " "metadata.\n", __FUNCTION__); err = EIO; @@ -118,8 +118,8 @@ static __inline__ int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, 3, 1, lastbyte_buf); if (br != 1) { // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! Read of " - "last byte failed. " + Dprintf("%s(): Eeek! Read of last " + "byte failed. " "Leaving inconsistent " "metadata.\n", __FUNCTION__); @@ -145,8 +145,8 @@ static __inline__ int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, br = ntfs_attr_pwrite(na, tmp, bufsize, buf); if (br != bufsize) { // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! Failed to write buffer " - "to bitmap. Leaving inconsistent " + Dprintf("%s(): Eeek! Failed to write buffer to " + "bitmap. Leaving inconsistent " "metadata.\n", __FUNCTION__); err = EIO; goto free_err_out; @@ -162,8 +162,8 @@ static __inline__ int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, if (lastbyte && count != 0) { // FIXME: Eeek! BUG! - fprintf(stderr, "%s(): Eeek! Last buffer but count is " - "not zero (= %lli). Leaving " + Dprintf("%s(): Eeek! Last buffer but count is not " + "zero (= %lli). Leaving " "inconsistent metadata.\n", __FUNCTION__, (long long)count); err = EIO; diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 93876858..39a0bf0c 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -107,7 +107,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, zone == MFT_ZONE ? "MFT" : "DATA"); if (!vol || count < 0 || start_lcn < -1 || !vol->lcnbmp_na || (s8)zone < FIRST_ZONE || zone > LAST_ZONE) { - fprintf(stderr, "%s(): Invalid arguments!\n", __FUNCTION__); + Dprintf("%s(): Invalid arguments!\n", __FUNCTION__); errno = EINVAL; return NULL; } @@ -455,10 +455,10 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, err = errno; else err = EIO; - fprintf(stderr, "%s(): Bitmap writeback " - "failed in read next buffer " - "code path with error code " - "%i.\n", __FUNCTION__, err); + Dprintf("%s(): Bitmap writeback failed in " + "read next buffer code path " + "with error code %i.\n", + __FUNCTION__, err); goto err_ret; } } @@ -718,9 +718,9 @@ done_ret: err = errno; else err = EIO; - fprintf(stderr, "%s(): Bitmap writeback failed " - "in done code path with error code " - "%i.\n", __FUNCTION__, err); + Dprintf("%s(): Bitmap writeback failed in done code " + "path with error code %i.\n", + __FUNCTION__, err); goto err_ret; } } @@ -746,9 +746,9 @@ wb_err_ret: err = errno; else err = EIO; - fprintf(stderr, "%s(): Bitmap writeback failed " - "in error code path with error code " - "%i.\n", __FUNCTION__, err); + Dprintf("%s(): Bitmap writeback failed in error code " + "path with error code %i.\n", + __FUNCTION__, err); } } err_ret: @@ -797,8 +797,8 @@ int ntfs_cluster_free_from_rl(ntfs_volume *vol, runlist *rl) if (rl->lcn >= 0 && ntfs_bitmap_clear_run(vol->lcnbmp_na, rl->lcn, rl->length)) { int eo = errno; - fprintf(stderr, "%s(): Eeek! Deallocation of " - "clusters failed.\n", __FUNCTION__); + Dprintf("%s(): Eeek! Deallocation of clusters " + "failed.\n", __FUNCTION__); errno = eo; return -1; } @@ -829,7 +829,7 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) if (!vol || !vol->lcnbmp_na || !na || start_vcn < 0 || (count < 0 && count != -1)) { - fprintf(stderr, "%s(): Invalid arguments!\n", __FUNCTION__); + Dprintf("%s(): Invalid arguments!\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -881,8 +881,8 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) // list support! (AIA) if (rl->lcn < 0 && rl->lcn != LCN_HOLE) { // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! invalid lcn (= %lli). " - "Should attempt to map runlist! " + Dprintf("%s(): Eeek! invalid lcn (= %lli). Should " + "attempt to map runlist! " "Leaving inconsistent metadata!\n", __FUNCTION__, (long long)rl->lcn); errno = EIO; @@ -901,8 +901,8 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) int eo = errno; // FIXME: Eeek! We need rollback! (AIA) - fprintf(stderr, "%s(): Eeek! bitmap clear run " - "failed. Leaving inconsistent " + Dprintf("%s(): Eeek! bitmap clear run " + "failed. Leaving inconsistent " "metadata!\n", __FUNCTION__); errno = eo; return -1; @@ -917,9 +917,9 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) if (count != -1 && count != 0) { // FIXME: Eeek! BUG() - fprintf(stderr, "%s(): Eeek! count still not zero (= %lli). " - "Leaving inconsistent metadata!\n", - __FUNCTION__, (long long)count); + Dprintf("%s(): Eeek! count still not zero (= %lli). Leaving " + "inconsistent metadata!\n", __FUNCTION__, + (long long)count); errno = EIO; return -1; } @@ -927,4 +927,3 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) /* Done. Return the number of actual clusters that were freed. */ return nr_freed; } - diff --git a/libntfs/mft.c b/libntfs/mft.c index f42719b5..14e5cf5d 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -280,7 +280,7 @@ int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref, else { /* Abort if mref is > 32 bits. */ if (MREF(mref) & 0x0000ffff00000000ull) { - fprintf(stderr, "Mft reference exceeds 32 bits!"); + Dputs("Mft reference exceeds 32 bits!"); errno = ERANGE; return -1; } @@ -298,12 +298,12 @@ int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref, NTFS_SECTOR_SIZE + 1); else { m->usa_count = cpu_to_le16(1); - fprintf(stderr, "Sector size is bigger than MFT record size. " - "Setting usa_count to 1. If Windows\nchkdsk " + Dprintf("Sector size is bigger than MFT record size. " + "Setting usa_count to 1. If Windows\nchkdsk " "reports this as corruption, please email " "linux-ntfs-dev@lists.sf.net\nstating that " "you saw this message and that the file " - "system created was corrupt.\nThank you."); + "system created was corrupt.\nThank you.\n"); } /* Set the update sequence number to 1. */ *(u16*)((u8*)m + le16_to_cpu(m->usa_ofs)) = cpu_to_le16(1); @@ -452,9 +452,8 @@ int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni) /* Rollback what we did... */ bitmap_rollback: if (ntfs_bitmap_set_run(vol->mftbmp_na, mft_no, 1)) - fprintf(stderr, "Eeek! Rollback failed in " - "ntfs_mft_record_free(). Leaving inconsistent " - "metadata!"); + Dputs("Eeek! Rollback failed in ntfs_mft_record_free(). " + "Leaving inconsistent metadata!"); sync_rollback: ni->mrec->flags |= MFT_RECORD_IN_USE; ni->mrec->sequence_number = cpu_to_le16(old_seq_no); diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 369ea3a6..464faa0c 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1445,8 +1445,8 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) rl = *arl; if (start_vcn < rl->vcn) { // FIXME: Eeek! BUG() - fprintf(stderr, "%s(): Eeek! start_vcn lies outside front of " - "runlist! Aborting.\n", __FUNCTION__); + Dprintf("%s(): Eeek! start_vcn lies outside front of " + "runlist! Aborting.\n", __FUNCTION__); errno = EIO; return -1; } @@ -1458,14 +1458,14 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) } if (!rl->length) { // FIXME: Weird, probably a BUG()! - fprintf(stderr, "%s(): Weird! Asking to truncate already " - "truncated runlist?!? Abort.\n", __FUNCTION__); + Dprintf("%s(): Weird! Asking to truncate already truncated " + "runlist?!? Abort.\n", __FUNCTION__); errno = EIO; return -1; } if (start_vcn < rl->vcn) { // FIXME: Eeek! BUG() - fprintf(stderr, "%s(): Eeek! start_vcn < rl->vcn! Aborting.\n", + Dprintf("%s(): Eeek! start_vcn < rl->vcn! Aborting.\n", __FUNCTION__); errno = EIO; return -1; @@ -1499,10 +1499,9 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) *arl = NULL; else { // FIXME: Eeek! - fprintf(stderr, "%s(): Eeek! Failed to reallocate " - "runlist buffer! Continuing " - "regardless and returning success.\n", - __FUNCTION__); + Dprintf("%s(): Eeek! Failed to reallocate runlist " + "buffer! Continuing regardless and " + "returning success.\n", __FUNCTION__); } } /* Done! */ diff --git a/libntfs/volume.c b/libntfs/volume.c index e82fb056..3bac6683 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -92,8 +92,8 @@ static void __ntfs_volume_release(ntfs_volume *v) if (NDevDirty(dev)) dev->d_ops->sync(dev); if (dev->d_ops->close(dev)) - fprintf(stderr, "%s(): Eeek! Failed to close the " - "device. Error: %s\n", __FUNCTION__, + Dprintf("%s(): Eeek! Failed to close the device. " + "Error: %s\n", __FUNCTION__, strerror(errno)); } if (v->vol_name) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index d4e09f20..97121a76 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -660,7 +660,7 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, abs_offset.QuadPart = fd->part_end + offset; break; default: - printf("win32_seek() wrong mode %d.\n", whence); + Dprintf("win32_seek() wrong mode %d.\n", whence); errno = EINVAL; return -1; } @@ -1011,7 +1011,8 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, break; #endif default: - fprintf(stderr, "win32_ioctl(): unimplemented ioctl %d.\n",request); + Dprintf("win32_ioctl(): unimplemented ioctl %d.\n", + request); errno = ENOTSUP; return -1; } From 380f4f1ce14c34fd092bc7cf85b6b2c43c8f7203 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 18 Aug 2004 10:27:49 +0000 Subject: [PATCH 1707/2994] Silence compiler warnings. (Logical change 1.502) --- libntfs/debug.c | 8 ++--- ntfsprogs/mkntfs.c | 83 +++++++++++++++++++++++----------------------- 2 files changed, 45 insertions(+), 46 deletions(-) diff --git a/libntfs/debug.c b/libntfs/debug.c index 8e3f4208..bc8cfe34 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -45,12 +45,12 @@ void ntfs_debug_runlist_dump(const runlist_element *rl) LCN lcn = (rl + i)->lcn; if (lcn < (LCN)0) { - int index = -lcn - 1; + int idx = -lcn - 1; - if (index > -LCN_EINVAL - 1) - index = 4; + if (idx > -LCN_EINVAL - 1) + idx = 4; Dprintf("%-16llx %s %-16llx%s\n", rl[i].vcn, - lcn_str[index], rl[i].length, + lcn_str[idx], rl[i].length, rl[i].length ? "" : " (runlist end)"); } else Dprintf("%-16llx %-16llx %-16llx%s\n", rl[i].vcn, diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index caf34c48..2094a567 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -453,7 +453,7 @@ static void append_to_bad_blocks(unsigned long block) * mkntfs_write */ static __inline__ long long mkntfs_write(struct ntfs_device *dev, - const void *buf, long long count) + const void *b, long long count) { long long bytes_written, total; int retry; @@ -463,7 +463,7 @@ static __inline__ long long mkntfs_write(struct ntfs_device *dev, total = 0LL; retry = 0; do { - bytes_written = dev->d_ops->write(dev, buf, count); + bytes_written = dev->d_ops->write(dev, b, count); if (bytes_written == -1LL) { retry = errno; Eprintf("Error writing to %s: %s\n", vol->dev->d_name, @@ -554,12 +554,12 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, } } if (delta) { - char *buf = (char*)calloc(1, delta); - if (!buf) + char *b = (char*)calloc(1, delta); + if (!b) err_exit("Error allocating internal buffer: " "%s\n", strerror(errno)); - bytes_written = mkntfs_write(dev, buf, delta); - free(buf); + bytes_written = mkntfs_write(dev, b, delta); + free(b); if (bytes_written == -1LL) return bytes_written; } @@ -642,7 +642,7 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) "type yet."; const char *skip = "Skipping display of $%s attribute value.\n"; const char *todo = "This is still work in progress."; - char *buf; + char *b; int i, j; switch (type) { @@ -669,16 +669,16 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) case AT_VOLUME_NAME: printf("Volume name length = %i\n", (unsigned int)val_len); if (val_len) { - buf = calloc(1, val_len); - if (!buf) + b = calloc(1, val_len); + if (!b) err_exit("Failed to allocate internal buffer: " "%s\n", strerror(errno)); - i = ucstos(buf, (ntfschar*)val, val_len); + i = ucstos(b, (ntfschar*)val, val_len); if (i == -1) printf("Volume name contains non-displayable " "Unicode characters.\n"); - printf("Volume name = %s\n", buf); - free(buf); + printf("Volume name = %s\n", b); + free(b); } return; case AT_VOLUME_INFORMATION: @@ -1033,7 +1033,7 @@ static int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) pos + size > (char*)m + le32_to_cpu(m->bytes_allocated)) return -EINVAL; /* The -8 is for the attribute terminator. */ - if (pos - (char*)m > le32_to_cpu(m->bytes_in_use) - 8) + if (pos - (char*)m > (int)le32_to_cpu(m->bytes_in_use) - 8) return -EINVAL; #endif biu = le32_to_cpu(m->bytes_in_use); @@ -2053,7 +2053,7 @@ static int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, */ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, - INDEX_ALLOCATION **index) + INDEX_ALLOCATION **idx) { ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; @@ -2194,7 +2194,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, // Revert index root from index allocation. goto err_out; } - *index = ia_val; + *idx = ia_val; return 0; err_out: if (ctx) @@ -2206,11 +2206,11 @@ err_out: /** * make_room_for_index_entry_in_index_block - * Create space of @size bytes at position @pos inside the index block @index. + * Create space of @size bytes at position @pos inside the index block @idx. * * Return 0 on success or -errno on error. */ -static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *index, +static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *idx, INDEX_ENTRY *pos, u32 size) { u32 biu; @@ -2227,31 +2227,31 @@ static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *index, "non 8-byte aligned size.\n"); return -EINVAL; } - if (!index || !pos) + if (!idx || !pos) return -EINVAL; - if ((char*)pos < (char*)index || (char*)pos + size < (char*)index || - (char*)pos > (char*)index + sizeof(INDEX_BLOCK) - + if ((char*)pos < (char*)idx || (char*)pos + size < (char*)idx || + (char*)pos > (char*)idx + sizeof(INDEX_BLOCK) - sizeof(INDEX_HEADER) + - le32_to_cpu(index->index.allocated_size) || - (char*)pos + size > (char*)index + sizeof(INDEX_BLOCK) - + le32_to_cpu(idx->index.allocated_size) || + (char*)pos + size > (char*)idx + sizeof(INDEX_BLOCK) - sizeof(INDEX_HEADER) + - le32_to_cpu(index->index.allocated_size)) + le32_to_cpu(idx->index.allocated_size)) return -EINVAL; /* The - sizeof(INDEX_ENTRY_HEADER) is for the index terminator. */ - if ((char*)pos - (char*)&index->index > - le32_to_cpu(index->index.index_length) - - sizeof(INDEX_ENTRY_HEADER)) + if ((char*)pos - (char*)&idx->index > + (int)le32_to_cpu(idx->index.index_length) + - (int)sizeof(INDEX_ENTRY_HEADER)) return -EINVAL; #endif - biu = le32_to_cpu(index->index.index_length); + biu = le32_to_cpu(idx->index.index_length); /* Do we have enough space? */ - if (biu + size > le32_to_cpu(index->index.allocated_size)) + if (biu + size > le32_to_cpu(idx->index.allocated_size)) return -ENOSPC; /* Move everything after pos to pos + size. */ memmove((char*)pos + size, (char*)pos, biu - ((char*)pos - - (char*)&index->index)); + (char*)&idx->index)); /* Update index block. */ - index->index.index_length = cpu_to_le32(biu + size); + idx->index.index_length = cpu_to_le32(biu + size); return 0; } @@ -2259,11 +2259,11 @@ static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *index, * insert_file_link_in_dir_index * Insert the fully completed FILE_NAME_ATTR @file_name which is inside * the file with mft reference @file_ref into the index (allocation) block - * @index (which belongs to @file_ref's parent directory). + * @idx (which belongs to @file_ref's parent directory). * * Return 0 on success or -errno on error. */ -static int insert_file_link_in_dir_index(INDEX_BLOCK *index, MFT_REF file_ref, +static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, FILE_NAME_ATTR *file_name, u32 file_name_size) { int err, i; @@ -2271,15 +2271,14 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *index, MFT_REF file_ref, char *index_end; /* - * Lookup dir entry @file_name in dir @index to determine correct + * Lookup dir entry @file_name in dir @idx to determine correct * insertion location. FIXME: Using a very oversimplified lookup * method which is sufficient for mkntfs but no good whatsoever in * real world scenario. (AIA) */ - index_end = (char*)&index->index + - le32_to_cpu(index->index.index_length); - ie = (INDEX_ENTRY*)((char*)&index->index + - le32_to_cpu(index->index.entries_offset)); + index_end = (char*)&idx->index + le32_to_cpu(idx->index.index_length); + ie = (INDEX_ENTRY*)((char*)&idx->index + + le32_to_cpu(idx->index.entries_offset)); /* * Loop until we exceed valid memory (corruption case) or until we * reach the last entry. @@ -2367,7 +2366,7 @@ do_next: ie = (INDEX_ENTRY*)((char*)ie + le16_to_cpu(ie->length)); }; i = (sizeof(INDEX_ENTRY_HEADER) + file_name_size + 7) & ~7; - err = make_room_for_index_entry_in_index_block(index, ie, i); + err = make_room_for_index_entry_in_index_block(idx, ie, i); if (err) { Eprintf("make_room_for_index_entry_in_index_block failed: " "%s\n", strerror(-err)); @@ -2389,13 +2388,13 @@ do_next: * parent directory with mft reference @ref_parent. * * Then, insert an index entry with this file_name_attribute in the index - * block @index of the index allocation attribute of the parent directory. + * block @idx of the index allocation attribute of the parent directory. * * @ref_file is the mft reference of @m_file. * * Return 0 on success or -errno on error. */ -static int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, +static int create_hardlink(INDEX_BLOCK *idx, const MFT_REF ref_parent, MFT_RECORD *m_file, const MFT_REF ref_file, const s64 allocated_size, const s64 data_size, const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, @@ -2464,8 +2463,8 @@ static int create_hardlink(INDEX_BLOCK *index, const MFT_REF ref_parent, le16_to_cpu(m_file->link_count) - 1); return i; } - /* Insert the index entry for file_name in @index. */ - i = insert_file_link_in_dir_index(index, ref_file, fn, fn_size); + /* Insert the index entry for file_name in @idx. */ + i = insert_file_link_in_dir_index(idx, ref_file, fn, fn_size); if (i < 0) { Eprintf("create_hardlink failed inserting index entry: %s\n", strerror(-i)); From 3c32bde90ccfd4ff337484c6fa45e6d872a41b7b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 18 Aug 2004 10:27:49 +0000 Subject: [PATCH 1708/2994] Update (Logical change 1.502) --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6110d685..c6d36ab9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,10 @@ xx/xx/2004 - 1.9.3-WIP already mapped. (Yura) - Make ntfslabel pay attention to --no-action. (Yuval) - Several bugfixes in ntfs_cluster_alloc. (Anton) + - Make all of libntfs only output anything if configured with + --enable-debug. The only exception is ntfs_boot_sector_is_ntfs() + which now uses a new function Sprintf(), provided by debug.h which + can be #ifdef-ed out if people want it to be truly silent. (Anton) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From 930e056c024d0c755f4508077ab4b51300a42cbf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 18 Aug 2004 10:27:49 +0000 Subject: [PATCH 1709/2994] Use Sprintf instead of doing it by hand. (Logical change 1.502) --- libntfs/bootsect.c | 60 ++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index 7d7aa0b0..ea068899 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -49,8 +49,7 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) { u32 i; - if (!silent) - fprintf(stderr, "\nBeginning bootsector check...\n"); + Sprintf(silent, "\nBeginning bootsector check...\n"); /* Calculate the checksum. Note, this is just a simple addition of all u32 values in the bootsector starting at the beginning and @@ -60,38 +59,31 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) u32 *u = (u32 *)b; u32 *bi = (u32 *)(&b->checksum); - if (!silent) - fprintf(stderr, "Calculating bootsector checksum... "); + Sprintf(silent, "Calculating bootsector checksum... "); for (i = 0; u < bi; ++u) i += le32_to_cpup(u); if (le32_to_cpu(b->checksum) && le32_to_cpu(b->checksum) != i) goto not_ntfs; - if (!silent) - fprintf(stderr, "OK\n"); + Sprintf(silent, "OK\n"); } /* Check OEMidentifier is "NTFS " */ - if (!silent) - fprintf(stderr, "Checking OEMid... "); + Sprintf(silent, "Checking OEMid... "); if (b->oem_id != cpu_to_le64(0x202020205346544eULL)) /* "NTFS " */ goto not_ntfs; - if (!silent) - fprintf(stderr, "OK\n"); + Sprintf(silent, "OK\n"); /* Check bytes per sector value is between 256 and 4096. */ - if (!silent) - fprintf(stderr, "Checking bytes per sector... "); + Sprintf(silent, "Checking bytes per sector... "); if (le16_to_cpu(b->bpb.bytes_per_sector) < 0x100 || le16_to_cpu(b->bpb.bytes_per_sector) > 0x1000) goto not_ntfs; - if (!silent) - fprintf(stderr, "OK\n"); + Sprintf(silent, "OK\n"); /* Check sectors per cluster value is valid. */ - if (!silent) - fprintf(stderr, "Checking sectors per cluster... "); + Sprintf(silent, "Checking sectors per cluster... "); switch (b->bpb.sectors_per_cluster) { case 1: case 2: case 4: case 8: case 16: case 32: case 64: case 128: @@ -99,21 +91,17 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) default: goto not_ntfs; } - if (!silent) - fprintf(stderr, "OK\n"); + Sprintf(silent, "OK\n"); /* Check the cluster size is not above 65536 bytes. */ - if (!silent) - fprintf(stderr, "Checking cluster size... "); + Sprintf(silent, "Checking cluster size... "); if ((u32)le16_to_cpu(b->bpb.bytes_per_sector) * b->bpb.sectors_per_cluster > 0x10000) goto not_ntfs; - if (!silent) - fprintf(stderr, "OK\n"); + Sprintf(silent, "OK\n"); /* Check reserved/unused fields are really zero. */ - if (!silent) - fprintf(stderr, "Checking reserved fields are zero... "); + Sprintf(silent, "Checking reserved fields are zero... "); if (le16_to_cpu(b->bpb.reserved_sectors) || le16_to_cpu(b->bpb.root_entries) || le16_to_cpu(b->bpb.sectors) || @@ -121,12 +109,10 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) le32_to_cpu(b->bpb.large_sectors) || b->bpb.fats) goto not_ntfs; - if (!silent) - fprintf(stderr, "OK\n"); + Sprintf(silent, "OK\n"); /* Check clusters per file mft record value is valid. */ - if (!silent) - fprintf(stderr, "Checking clusters per mft record... "); + Sprintf(silent, "Checking clusters per mft record... "); if ((u8)b->clusters_per_mft_record < 0xe1 || (u8)b->clusters_per_mft_record > 0xf7) { switch (b->clusters_per_mft_record) { @@ -136,12 +122,10 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) goto not_ntfs; } } - if (!silent) - fprintf(stderr, "OK\n"); + Sprintf(silent, "OK\n"); /* Check clusters per index block value is valid. */ - if (!silent) - fprintf(stderr, "Checking clusters per index block... "); + Sprintf(silent, "Checking clusters per index block... "); if ((u8)b->clusters_per_index_record < 0xe1 || (u8)b->clusters_per_index_record > 0xf7) { switch (b->clusters_per_index_record) { @@ -151,21 +135,17 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) goto not_ntfs; } } - if (!silent) - fprintf(stderr, "OK\n"); + Sprintf(silent, "OK\n"); if (b->end_of_sector_marker != cpu_to_le16(0xaa55)) Dputs("Warning: Bootsector has invalid end of sector marker."); - if (!silent) - fprintf(stderr, "Bootsector check completed successfully.\n"); + Sprintf(silent, "Bootsector check completed successfully.\n"); return TRUE; not_ntfs: - if (!silent) { - fprintf(stderr, "FAILED\n"); - fprintf(stderr, "Bootsector check failed. Aborting...\n"); - } + Sprintf(silent, "FAILED\n"); + Sprintf(silent, "Bootsector check failed. Aborting...\n"); return FALSE; } From d33e7eaae43b6d2f6d1cba7e71208740ad65c274 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 19 Aug 2004 21:01:11 +0000 Subject: [PATCH 1710/2994] Fix fallout from previous error output changes. (Logical change 1.503) --- libntfs/device.c | 3 ++- libntfs/dir.c | 2 +- libntfs/lcnalloc.c | 14 +++++++------- libntfs/volume.c | 6 ++++-- ntfsprogs/ntfsundelete.c | 2 ++ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/libntfs/device.c b/libntfs/device.c index 3b4d8fe4..f11bbc38 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -495,7 +495,8 @@ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) if (dev->d_ops->ioctl(dev, FDGETPRM, &this_floppy) >= 0) { Dprintf("FDGETPRM nr 512 byte blocks = %lu (0x%lx)\n", - this_floppy.size, this_floppy.size); + (unsigned long)this_floppy.size, + (unsigned long)this_floppy.size); return (s64)this_floppy.size * 512 / block_size; } } diff --git a/libntfs/dir.c b/libntfs/dir.c index a1c09b87..2be99423 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -663,7 +663,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, parent_mref = ntfs_mft_get_parent_ref(dir_ni); if (parent_mref == ERR_MREF(-1)) { - Dprintf("Parent directory not found: %s\n", errno); + Dperror("Parent directory not found"); goto dir_err_out; } diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 39a0bf0c..4d78c440 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -303,8 +303,8 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, */ Dprintf("%s(): Adding run (lcn 0x%llx, len 0x%llx), " "prev_lcn = 0x%llx, lcn = 0x%llx, " - "bmp_pos = 0x%llx, prev_run_len = 0x%x, " - "rlpos = %i.\n", __FUNCTION__, + "bmp_pos = 0x%llx, prev_run_len = " + "0x%llx, rlpos = %i.\n", __FUNCTION__, (long long)(lcn + bmp_pos), 1LL, (long long)prev_lcn, (long long)lcn, (long long)bmp_pos, @@ -600,8 +600,8 @@ switch_to_data1_zone: search_zone = 2; } break; case 4: - Dprintf("%s(): Switching from data2 zone to " - "data1 zone.\n"); + Dputs("Switching from data2 zone to data1 " + "zone."); /* Update data2 zone position. */ if (rlpos) { LCN tc; @@ -701,9 +701,9 @@ switch_to_data1_zone: search_zone = 2; (long long)zone_end, (long long)vol->data1_zone_pos); } - Dprintf("%s(): After outer while loop.\n"); + Dputs("After outer while loop."); done_ret: - Dprintf("%s(): At done_ret.\n"); + Dputs("At done_ret."); /* Add runlist terminator element. */ rl[rlpos].vcn = rl[rlpos - 1].vcn + rl[rlpos - 1].length; rl[rlpos].lcn = LCN_RL_NOT_MAPPED; @@ -725,7 +725,7 @@ done_ret: } } done_err_ret: - Dprintf("%s(): At done_err_ret (follows done_ret).\n"); + Dputs("At done_err_ret (follows done_ret).n"); free(buf); /* Done! */ if (!err) diff --git a/libntfs/volume.c b/libntfs/volume.c index 3bac6683..66622eff 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -397,12 +397,12 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) { LCN mft_zone_size, mft_lcn; s64 br; - const char *OK = "OK"; - const char *FAILED = "FAILED"; ntfs_volume *vol; NTFS_BOOT_SECTOR *bs; int eo; #ifdef DEBUG + const char *OK = "OK"; + const char *FAILED = "FAILED"; BOOL debug = 1; #else BOOL debug = 0; @@ -585,8 +585,10 @@ error_exit: ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) { s64 l; +#ifdef DEBUG const char *OK = "OK"; const char *FAILED = "FAILED"; +#endif ntfs_volume *vol; u8 *m = NULL, *m2 = NULL; ntfs_attr_search_ctx *ctx = NULL; diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 96e37373..62a3bf3a 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -55,7 +55,9 @@ static const char *EXEC_NAME = "ntfsundelete"; static const char *MFTFILE = "mft"; +#ifdef DEBUG static const char *UNNAMED = ""; +#endif static const char *NONE = ""; static const char *UNKNOWN = "unknown"; static struct options opts; From 39b62e050ed50d545a8192debeccc216fa6b02d3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 19 Aug 2004 21:01:11 +0000 Subject: [PATCH 1711/2994] Move Sprintf,Dputs,Dprintf,Dperror to be defines and call proper non-inlined functions which are now in debug.c. (Logical change 1.503) --- include/ntfs/debug.h | 71 +++++++++----------------------------------- libntfs/debug.c | 62 +++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 58 deletions(-) diff --git a/include/ntfs/debug.h b/include/ntfs/debug.h index e2429b45..fc14333c 100644 --- a/include/ntfs/debug.h +++ b/include/ntfs/debug.h @@ -33,77 +33,34 @@ #endif #include -#include "types.h" - struct _runlist_element; -/** - * Sprintf - silencable output to stderr - * @silent: if false string is output to stderr - * @fmt: printf style format string - * @...: optional arguments for the printf style format string - * - * If @silent is false, output the string @fmt to stderror. - * - * This is basically a replacelment for: - * - * if (!silent) - * fprintf(stderr, fmt, ...); - * - * It is more convenient to use Sprintf instead of the above code and perhaps - * more importantly, Sprintf makes it much easier to turn it into a "do - * nothing" function with an #ifdef, thus removing the whole output completely. - */ -static __inline__ void Sprintf(const BOOL silent, const char *fmt, ...) -{ - int eo; - va_list ap; - - if (silent) - return; - eo = errno; - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - errno = eo; -} +extern void __Sprintf(const int silent, const char *fmt, ...) + __attribute__ ((format (printf, 2, 3))); +#define Sprintf(silent, f, a...) __Sprintf(silent, f, ##a) #ifdef DEBUG /* Debug output to stderr. To get it run ./configure --enable-debug. */ -static __inline__ void Dprintf(const char *fmt, ...) -{ - int eo = errno; - va_list ap; +extern void __Dprintf(const char *fmt, ...) + __attribute__ ((format (printf, 1, 2))); +#define Dprintf(f, a...) __Dprintf(f, ##a) - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - errno = eo; -} +extern void __Dputs(const char *s); +#define Dputs(s) __Dputs(s) -static __inline__ void Dputs(const char *s) -{ - int eo = errno; - fprintf(stderr, "%s\n", s); - errno = eo; -} - -static __inline__ void Dperror(const char *s) -{ - int eo = errno; - perror(s); - errno = eo; -} +extern void __Dperror(const char *s); +#define Dperror(s) __Dperror(s) extern void ntfs_debug_runlist_dump(const struct _runlist_element *rl); #else /* if !DEBUG */ -static __inline__ void Dprintf(const char *fmt __attribute__((unused)), ...) {} -static __inline__ void Dputs(const char *s __attribute__((unused))) {} -static __inline__ void Dperror(const char *s __attribute__((unused))) {} +#define Dprintf(f, a...) do {} while (0) +#define Dputs(s) do {} while (0) +#define Dperror(s) do {} while (0) + static __inline__ void ntfs_debug_runlist_dump(const struct _runlist_element *rl __attribute__((unused))) {} #endif /* !DEBUG */ diff --git a/libntfs/debug.c b/libntfs/debug.c index bc8cfe34..af355811 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -21,10 +21,71 @@ #include "config.h" +#include "types.h" #include "attrib.h" #include "debug.h" +/** + * Sprintf - silencable output to stderr + * @silent: if 0 string is output to stderr + * @fmt: printf style format string + * @...: optional arguments for the printf style format string + * + * If @silent is 0, output the string @fmt to stderr. + * + * This is basically a replacement for: + * + * if (!silent) + * fprintf(stderr, fmt, ...); + * + * It is more convenient to use Sprintf instead of the above code and perhaps + * more importantly, Sprintf makes it much easier to turn it into a "do + * nothing" function, by defining it to "do {} while (0)" in debug.h instead of + * to * __Sprintf, thus removing the whole output completely. + */ +void __Sprintf(const int silent, const char *fmt, ...) +{ + int eo; + va_list ap; + + if (silent) + return; + eo = errno; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + errno = eo; +} + #ifdef DEBUG + +/* Debug output to stderr. To get it run ./configure --enable-debug. */ + +void __Dprintf(const char *fmt, ...) +{ + int eo = errno; + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + errno = eo; +} + +void __Dputs(const char *s) +{ + int eo = errno; + fprintf(stderr, "%s\n", s); + errno = eo; +} + +void __Dperror(const char *s) +{ + int eo = errno; + perror(s); + errno = eo; +} + /** * ntfs_debug_runlist_dump - Dump a runlist. */ @@ -60,4 +121,3 @@ void ntfs_debug_runlist_dump(const runlist_element *rl) } #endif - From d0bae867a2719a64d37ccad88ab5c33a02995de1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 19 Aug 2004 21:01:11 +0000 Subject: [PATCH 1712/2994] Move Sprintf,Dputs,Dprintf,Dperror to be defines and call proper non-inlined functions which are now in debug.c. (Anton) BKrev: 41251517UtmWQKKDw-lgyaWFGJ-yFw From 27bf9c0ea0202b26493e146e842739564d16a650 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 11:58:24 +0000 Subject: [PATCH 1713/2994] Allow better compiler optimization/error checking. (Logical change 1.504) --- ntfsprogs/mkntfs.c | 5 ++++- ntfsprogs/ntfsclone.c | 13 +++++++++++-- ntfsprogs/ntfsresize.c | 11 +++++++++++ ntfsprogs/ntfstruncate.c | 4 ++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 2094a567..87583dc1 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -212,6 +212,7 @@ struct { /** * Dprintf - debugging output (-vv); overriden by quiet (-q) */ +static void Dprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); static void Dprintf(const char *fmt, ...) { va_list ap; @@ -247,7 +248,9 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * err_exit - error output and terminate; ignores quiet (-q) */ -static void err_exit(const char *fmt, ...) __attribute__((noreturn)); +static void err_exit(const char *fmt, ...) + __attribute__((noreturn)) + __attribute__((format(printf, 1, 2))); static void err_exit(const char *fmt, ...) { va_list ap; diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index fd795939..0cc3d3a0 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -142,7 +142,8 @@ GEN_PRINTF(Vprintf, msg_out, &opt.verbose, TRUE) GEN_PRINTF(Qprintf, msg_out, &opt.quiet, FALSE) static GEN_PRINTF(Printf, msg_out, NULL, FALSE) - +static void perr_printf(const char *fmt, ...) + __attribute__((format(printf, 1, 2))); static void perr_printf(const char *fmt, ...) { va_list ap; @@ -156,6 +157,8 @@ static void perr_printf(const char *fmt, ...) fflush(msg_out); } +static void err_printf(const char *fmt, ...) + __attribute__((format(printf, 1, 2))); static void err_printf(const char *fmt, ...) { va_list ap; @@ -167,6 +170,9 @@ static void err_printf(const char *fmt, ...) fflush(msg_out); } +static int err_exit(const char *fmt, ...) + __attribute__((noreturn)) + __attribute__((format(printf, 1, 2))); static int err_exit(const char *fmt, ...) { va_list ap; @@ -179,7 +185,9 @@ static int err_exit(const char *fmt, ...) exit(1); } - +static int perr_exit(const char *fmt, ...) + __attribute__((noreturn)) + __attribute__((format(printf, 1, 2))); static int perr_exit(const char *fmt, ...) { va_list ap; @@ -195,6 +203,7 @@ static int perr_exit(const char *fmt, ...) } +static void usage(void) __attribute__((noreturn)); static void usage(void) { Eprintf("\nUsage: %s [options] source\n" diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 6b1e8edb..430fca67 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -178,6 +178,8 @@ static s64 rounded_up_division(s64 numer, s64 denom) * * Print an error message. */ +static void perr_printf(const char *fmt, ...) + __attribute__((format(printf, 1, 2))); static void perr_printf(const char *fmt, ...) { va_list ap; @@ -192,6 +194,8 @@ static void perr_printf(const char *fmt, ...) fflush(stderr); } +static void err_printf(const char *fmt, ...) + __attribute__((format(printf, 1, 2))); static void err_printf(const char *fmt, ...) { va_list ap; @@ -209,6 +213,9 @@ static void err_printf(const char *fmt, ...) * * Print and error message and exit the program. */ +static int err_exit(const char *fmt, ...) + __attribute__((noreturn)) + __attribute__((format(printf, 1, 2))); static int err_exit(const char *fmt, ...) { va_list ap; @@ -227,6 +234,9 @@ static int err_exit(const char *fmt, ...) * * Print and error message and exit the program */ +static int perr_exit(const char *fmt, ...) + __attribute__((noreturn)) + __attribute__((format(printf, 1, 2))); static int perr_exit(const char *fmt, ...) { va_list ap; @@ -249,6 +259,7 @@ static int perr_exit(const char *fmt, ...) * * Return: none */ +static void usage(void) __attribute__((noreturn)); static void usage(void) { diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 6c4efa31..4c4d1d49 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -95,6 +95,7 @@ struct { /** * Dprintf - debugging output (-vv); overriden by quiet (-q) */ +static void Dprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); static void Dprintf(const char *fmt, ...) { va_list ap; @@ -130,6 +131,9 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * err_exit - error output and terminate; ignores quiet (-q) */ +static void err_exit(const char *fmt, ...) + __attribute__((noreturn)) + __attribute__((format(printf, 1, 2))); static void err_exit(const char *fmt, ...) { va_list ap; From c3f683c497ab09ea747972267ee56474209e5f4c Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 11:58:24 +0000 Subject: [PATCH 1714/2994] Allow better error checking. (Logical change 1.504) --- ntfsprogs/ntfsdump_logfile.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index b652170f..76e6e122 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -48,7 +48,8 @@ * device_err_exit - */ void device_err_exit(char *dev_name, ntfs_volume *vol, ntfs_inode *ni, - ntfs_attr *na, const char *fmt, ...) __attribute__ ((noreturn)); + ntfs_attr *na, const char *fmt, ...) __attribute__ ((noreturn)) + __attribute__((format(printf, 5, 6))); void device_err_exit(char *dev_name, ntfs_volume *vol, ntfs_inode *ni, ntfs_attr *na, const char *fmt, ...) { @@ -73,7 +74,8 @@ void device_err_exit(char *dev_name, ntfs_volume *vol, ntfs_inode *ni, /** * log_err_exit - */ -void log_err_exit(u8 *buf, const char *fmt, ...) __attribute__ ((noreturn)); +void log_err_exit(u8 *buf, const char *fmt, ...) __attribute__ ((noreturn)) + __attribute__((format(printf, 2, 3))); void log_err_exit(u8 *buf, const char *fmt, ...) { va_list ap; From c73b9f1c8faf5bcc78ef4f8555a83db16a496e81 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 11:58:24 +0000 Subject: [PATCH 1715/2994] Usr __attribute__((unused/format/noreturn)) when applicable. BKrev: 4125e760u6VXpLk2c2DwwJxLj1vinA From b15ad70b9921b537909ffcf55c9fd75d03990f01 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 11:58:24 +0000 Subject: [PATCH 1716/2994] When does not exist, some parameters may not be used. (Logical change 1.504) --- libntfs/volume.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index 66622eff..75bae327 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1122,7 +1122,8 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) * * On error return -1 with errno set to the error code. */ -int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags) +int ntfs_check_if_mounted(const char *file __attribute__((unused)), + unsigned long *mnt_flags) { *mnt_flags = 0; #ifdef HAVE_MNTENT_H From 97df12379365a81bd72a1e9a74d1a4c7edd47e33 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:01:17 +0000 Subject: [PATCH 1717/2994] Reorder struct members in order to align to 32 and 64 bit bounderies. (Logical change 1.505) --- libntfs/win32_io.c | 2 +- ntfsprogs/mkntfs.c | 22 +++++++++++----------- ntfsprogs/ntfscat.h | 2 +- ntfsprogs/utils.h | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 97121a76..01325a04 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -71,10 +71,10 @@ static LPFN_FINDVOLUMECLOSE fnFindVolumeClose = NULL; typedef struct win32_fd { HANDLE handle; + int part_hidden_sectors; s64 part_start; s64 part_end; LARGE_INTEGER current_pos; - int part_hidden_sectors; } win32_fd; #ifdef EMULATE_SETFILEPOINTEREX diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 87583dc1..341a313f 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -159,11 +159,6 @@ ntfs_volume *vol; char *dev_name; struct { - int sector_size; /* -s, in bytes, power of 2, default is - 512 bytes. */ - int sectors_per_track; /* number of sectors per track on - device */ - int heads; /* number of heads on device */ long long part_start_sect; /* start sector of partition on parent device */ long long nr_sectors; /* size of device in sectors */ @@ -179,27 +174,32 @@ struct { long long logfile_lcn; /* lcn of $LogFile, $DATA. */ int logfile_size; /* in bytes, determined from volume_size. */ - char mft_zone_multiplier; /* -z, value from 1 to 4. Default is + int mft_zone_multiplier; /* -z, value from 1 to 4. Default is 1. */ long long mft_zone_end; /* Determined from volume_size and mft_zone_multiplier, in clusters. */ - char no_action; /* -n, do not write to device, only - display what would be done. */ - char check_bad_blocks; /* read-only test for bad - clusters. */ - long long *bad_blocks; /* Array of bad clusters. */ long long nr_bad_blocks; /* Number of bad clusters. */ + long long *bad_blocks; /* Array of bad clusters. */ char *bad_blocks_filename; /* filename, file to read list of bad clusters from. */ ATTR_DEF *attr_defs; /* filename, attribute defs. */ int attr_defs_len; /* in bytes */ ntfschar *upcase; /* filename, upcase table. */ u32 upcase_len; /* Determined automatically. */ + int sector_size; /* -s, in bytes, power of 2, default is + 512 bytes. */ + int sectors_per_track; /* number of sectors per track on + device */ + int heads; /* number of heads on device */ int quiet; /* -q, quiet execution. */ int verbose; /* -v, verbose execution, given twice, * really verbose execution (debug * mode). */ int force; /* -F, force fs creation. */ + int no_action; /* -n, do not write to device, only + display what would be done. */ + char check_bad_blocks; /* read-only test for bad + clusters. */ char quick_format; /* -f or -Q, fast format, don't zero the volume first. */ char enable_compression; /* -C, enables compression of all files diff --git a/ntfsprogs/ntfscat.h b/ntfsprogs/ntfscat.h index f93b4691..a69df80c 100644 --- a/ntfsprogs/ntfscat.h +++ b/ntfsprogs/ntfscat.h @@ -31,8 +31,8 @@ struct options { char *device; /* Device/File to work with */ char *file; /* File to display */ - ATTR_TYPES attr; /* Attribute type to display */ s64 inode; /* Inode to work with */ + ATTR_TYPES attr; /* Attribute type to display */ int force; /* Override common sense */ int quiet; /* Less output */ int verbose; /* Extra output */ diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index ac8a8060..480b7538 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -125,8 +125,8 @@ struct mft_search_ctx { int flags_search; int flags_match; ntfs_inode *inode; - u64 mft_num; ntfs_volume *vol; + u64 mft_num; }; struct mft_search_ctx * mft_get_search_ctx (ntfs_volume *vol); From e7545d7e24ef0bb0e7eff9ead94c9c8e5d4381e2 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:01:17 +0000 Subject: [PATCH 1718/2994] Reorder/pad struct members in order to align to 32 and 64 bit bounderies. (Logical change 1.505) --- ntfsprogs/ntfsclone.c | 3 ++- ntfsprogs/ntfscluster.h | 7 ++++--- ntfsprogs/ntfsinfo.c | 5 +++-- ntfsprogs/ntfsmove.h | 3 ++- ntfsprogs/ntfsresize.c | 9 ++++++--- ntfsprogs/ntfsrm.h | 5 +++-- ntfsprogs/ntfsundelete.h | 12 ++++++++---- 7 files changed, 28 insertions(+), 16 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 0cc3d3a0..6d778cf7 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -70,8 +70,9 @@ struct { } opt; struct bitmap { - u8 *bm; s64 size; + u8 *bm; + u8 padding[4]; /* Unused: padding to 64 bit. */ }; struct progress_bar { diff --git a/ntfsprogs/ntfscluster.h b/ntfsprogs/ntfscluster.h index afba3f39..41747c2a 100644 --- a/ntfsprogs/ntfscluster.h +++ b/ntfsprogs/ntfscluster.h @@ -52,10 +52,11 @@ struct options { struct match { u64 inum; /* Inode number */ - ATTR_TYPES type; /* Attribute type */ - ntfschar *name; /* Attribute name */ - int name_len; /* Length of attribute name */ LCN lcn; /* Last cluster in use */ + ATTR_TYPES type; /* Attribute type */ + ntfschar *name; /* Attribute name */ + int name_len; /* Length of attribute name */ + u8 padding[4]; /* Unused: padding to 64 bit. */ }; #endif /* _NTFSCLUSTER_H_ */ diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 2a1d32de..783a8e02 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -68,14 +68,15 @@ static const char *EXEC_NAME = "ntfsinfo"; static struct options { - char *device; /* Device/File to work with */ + const char *device; /* Device/File to work with */ + const char *filename; /* Resolve this filename to mft number */ s64 inode; /* Info for this inode */ int quiet; /* Less output */ int verbose; /* Extra output */ int force; /* Override common sense */ int notime; /* Don't report timestamps at all */ int mft; /* Dump information about the volume as well */ - const char *filename; + u8 padding[4]; /* Unused: padding to 64 bit. */ } opts; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) diff --git a/ntfsprogs/ntfsmove.h b/ntfsprogs/ntfsmove.h index d5081ee5..f13dcdbf 100644 --- a/ntfsprogs/ntfsmove.h +++ b/ntfsprogs/ntfsmove.h @@ -33,12 +33,13 @@ struct options { char *device; /* Device/File to work with */ char *file; /* File to display */ + s64 location; /* Where to place the file */ int force; /* Override common sense */ int quiet; /* Less output */ int verbose; /* Extra output */ int noaction; /* Do not write to disk */ int nodirty; /* Do not mark volume dirty */ - s64 location; /* Where to place the file */ + u8 padding[4]; /* Unused: alignment to 64 bit. */ }; #endif /* _NTFSMOVE_H_ */ diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 430fca67..7b0d9f99 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -88,11 +88,13 @@ struct { int show_progress; s64 bytes; char *volume; + u8 padding[4]; /* Unused: padding to 64 bit. */ } opt; struct bitmap { - u8 *bm; s64 size; + u8 *bm; + u8 padding[4]; /* Unused: padding to 64 bit. */ }; #define NTFS_PROGBAR 0x0001 @@ -104,6 +106,7 @@ struct progress_bar { int resolution; int flags; float unit; + u8 padding[4]; /* Unused: padding to 64 bit. */ }; struct llcn_t { @@ -124,9 +127,8 @@ typedef struct { typedef struct { ntfs_volume *vol; - s64 new_volume_size; /* in clusters; 0 = --info w/o --size */ - int shrink; /* shrink = 1, enlarge = 0 */ ntfs_inode *ni; /* inode being processed */ + s64 new_volume_size; /* in clusters; 0 = --info w/o --size */ MFT_REF mref; /* mft reference */ MFT_RECORD *mrec; /* mft record */ ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ @@ -135,6 +137,7 @@ typedef struct { runlist mftmir_rl; /* $MFTMirr AT_DATA's new position */ s64 mftmir_old; /* $MFTMirr AT_DATA's old LCN */ int dirty_inode; /* some inode data got relocated */ + int shrink; /* shrink = 1, enlarge = 0 */ struct progress_bar progress; struct bitmap lcn_bitmap; /* Temporary statistics until all case is supported */ diff --git a/ntfsprogs/ntfsrm.h b/ntfsprogs/ntfsrm.h index 10b03825..8f75459f 100644 --- a/ntfsprogs/ntfsrm.h +++ b/ntfsprogs/ntfsrm.h @@ -66,8 +66,8 @@ struct ntfs_dt { INDEX_ENTRY **children; struct ntfs_dt **sub_nodes; ntfs_inode **inodes; - INDEX_HEADER *header; VCN vcn; + INDEX_HEADER *header; BOOL changed; }; @@ -79,16 +79,17 @@ struct ntfs_dir { struct ntfs_dir *parent; ntfschar *name; int name_len; + MFT_REF mft_num; struct ntfs_dt *index; struct ntfs_dir **children; int child_count; - MFT_REF mft_num; struct mft_bitmap *bitmap; ntfs_inode *inode; ntfs_attr *iroot; ntfs_attr *ialloc; ntfs_attr *ibmp; int index_size; + u8 padding[4]; /* Unused: padding to 64 bit. */ }; /** diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index 4a25af98..2239c4d9 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -43,7 +43,6 @@ struct options { int uinode; /* Undelete this inode */ char *dest; /* Save file to this directory */ char *output; /* With this filename */ - char fillbyte; /* Use for unrecoverable sections */ char *match; /* Pattern for filename matching */ int match_case; /* Case sensitive matching */ int truncate; /* Truncate files to exact size. */ @@ -56,13 +55,13 @@ struct options { s64 size_end; s64 mft_begin; /* Range for mft copy */ s64 mft_end; + char fillbyte; /* Use for unrecoverable sections */ + char padding[7]; /* Unused: padding to 64 bit. */ }; struct filename { struct list_head list; /* Previous/Next links */ - char *name; /* Filename in current locale */ - FILE_NAME_TYPE_FLAGS name_space; - ntfschar *uname; /* Filename in unicode */ + ntfschar *uname; /* Filename in unicode */ int uname_len; /* and its length */ long long size_alloc; /* Allocated size (multiple of cluster size) */ long long size_data; /* Actual size of data */ @@ -71,6 +70,9 @@ struct filename { time_t date_a; /* altered */ time_t date_m; /* mft record changed */ time_t date_r; /* read */ + char *name; /* Filename in current locale */ + FILE_NAME_TYPE_FLAGS name_space; + char padding[7]; /* Unused: padding to 64 bit. */ }; struct data { @@ -88,6 +90,7 @@ struct data { runlist_element *runlist; /* Decoded data runs */ int percent; /* Amont potentially recoverable */ void *data; /* If resident, a pointer to the data */ + char padding[4]; /* Unused: padding to 64 bit. */ }; struct ufile { @@ -100,6 +103,7 @@ struct ufile { int attr_list; /* MFT record may be one of many */ int directory; /* MFT record represents a directory */ MFT_RECORD *mft; /* Raw MFT record */ + char padding[4]; /* Unused: padding to 64 bit. */ }; #endif /* _NTFSUNDELETE_H_ */ From b96c23686930c4eb77f837a87c396047436eee44 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:01:17 +0000 Subject: [PATCH 1719/2994] Reorder/pad struct members in order to align to 32 and 64 bit bounderies. As long as the library ABI is left intact. BKrev: 4125e80d2nOicvgcLMFurHkoyPsXbA From 682b8dab6b2bc09e766ee3e614ed538397e2d913 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:01:17 +0000 Subject: [PATCH 1720/2994] Use simpler C syntax for aligning a struct. (Logical change 1.505) --- libntfs/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index f4b5cc3e..c29915c7 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -880,7 +880,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) runlist_element *rl; int eo; struct { - unsigned int initialized_size : 1; + char initialized_size; } need_to_undo = { 0 }; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, " From 86323fac66f6002198bc94b91feef0191f3bf7fd Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:04:47 +0000 Subject: [PATCH 1721/2994] Comment #includes by configure's #ifdef HAVE_* (Logical change 1.506) --- libntfs/dir.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libntfs/dir.c b/libntfs/dir.c index 2be99423..f75e708b 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -21,9 +21,15 @@ #include "config.h" -#include -#include -#include +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_ERRNO_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif #include "types.h" #include "debug.h" From b01733f10a06edd22e58eb6d60d4e353c88e8d2b Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:04:47 +0000 Subject: [PATCH 1722/2994] Comment unused code with #if 0 (Logical change 1.506) --- ntfsprogs/ntfsmove.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index d334b6ee..148f86aa 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -229,6 +229,7 @@ static int parse_options (int argc, char **argv) return (!err && !help && !ver); } +#if 0 /** * ntfs_debug_runlist_dump2 - Dump a runlist. @@ -288,6 +289,8 @@ static int ntfs_debug_runlist_dump2 (const runlist *rl, int abbr, char *prefix) return res; } +#endif /* if 0 */ + /** * resize_nonres_attr */ @@ -341,6 +344,8 @@ static int calc_attr_length (ATTR_RECORD *rec, int runlength) return size; } +#if 0 + /** * dump_runs */ @@ -355,6 +360,8 @@ static void dump_runs (u8 *buffer, int len) printf ("\n"); } +#endif /* if 0 */ + /** * find_unused */ From dc9c44c7981d364e77bd52d5ca04231540d3f61f Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:04:47 +0000 Subject: [PATCH 1723/2994] Reduce compile time dependencies. (Logical change 1.506) --- include/ntfs/device.h | 4 ++-- ntfsprogs/cluster.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/ntfs/device.h b/include/ntfs/device.h index 4ca66af7..d6080cf8 100644 --- a/include/ntfs/device.h +++ b/include/ntfs/device.h @@ -26,8 +26,6 @@ #include "config.h" #endif -#include - #include "device_io.h" #include "types.h" #include "support.h" @@ -70,6 +68,8 @@ struct ntfs_device { device operations. */ }; +struct stat; + /* * The ntfs device operations defining all operations that can be performed on * the low level device described by a ntfs device structure. diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c index 49a0d6a4..15a7895a 100644 --- a/ntfsprogs/cluster.c +++ b/ntfsprogs/cluster.c @@ -24,7 +24,6 @@ #include "config.h" #include -#include #include #include From 083aac380ca3807db1aaf8f6d7e263e0195a967e Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:04:47 +0000 Subject: [PATCH 1724/2994] Resolve #include collusions by using #ifndef. (Logical change 1.506) --- include/ntfs/types.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/ntfs/types.h b/include/ntfs/types.h index 8b1ac35f..58687d7d 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -59,6 +59,11 @@ typedef s64 LCN; */ typedef s64 LSN; +/* + * Cygwin has a collusion between our BOOL and 's + * As long as this file will be included after were fine. + */ +#ifndef _WINDEF_H /* * These are just to make the code more readable... */ @@ -70,6 +75,7 @@ typedef enum { YES = 1, ONE = 1, } BOOL; +#endif /* defined _WINDEF_H */ typedef enum { CASE_SENSITIVE = 0, From fee4dcb1454ab0f4273d99b33339da91c0757c98 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:04:47 +0000 Subject: [PATCH 1725/2994] Restore compile time dependencies at the appropriate level. (Logical change 1.506) --- ntfsprogs/ntfscp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 39a2d349..b0c8ab9b 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "types.h" #include "attrib.h" From 9db879431b428f1c5554c1b466ea722b6544fcac Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:04:47 +0000 Subject: [PATCH 1726/2994] Various fixes and enchancments using preprocessor directives. BKrev: 4125e8dfxH8Gj7E-MUVTJM7a6LA0QQ From 89fee719209d54bd4a02c2111366339e4f2733df Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:04:47 +0000 Subject: [PATCH 1727/2994] Wrap macro definition with matching #ifndef. (Logical change 1.506) --- ntfsprogs/utils.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 480b7538..b012ca0d 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -40,7 +40,9 @@ extern const char *ntfs_home; extern const char *ntfs_gpl; #define PATH_SEP '/' -#define MAX_PATH 1024 +#ifndef MAX_PATH +# define MAX_PATH 1024 +#endif #if !defined(REG_NOERROR) || (REG_NOERROR != 0) # define REG_NOERROR 0 From 868e8aa00212bd00aedf1d683be42976ebad57a7 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:18:22 +0000 Subject: [PATCH 1728/2994] A printf format fix and Variable type fixes. (Logical change 1.507) --- ntfsprogs/ntfswipe.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 034e5bba..10e5ef25 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -414,14 +414,11 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, enum action act, ntfs_attr *na) { unsigned char *buf; - s64 size; - u64 offset; + s64 size, offset, ret, wiped = 0; u16 block_size; - s64 ret; - u64 wiped = 0; VCN cur_vcn = 0; runlist *rlc = na->rl; - u64 cu_mask = na->compression_block_clusters - 1; + s64 cu_mask = na->compression_block_clusters - 1; while (rlc->length) { cur_vcn += rlc->length; @@ -805,7 +802,8 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act, buf = malloc (indx_record_size); if (!buf) { Vprintf ("malloc failed\n"); - Eprintf ("Couldn't allocate %d bytes", indx_record_size); + Eprintf ("Couldn't allocate %u bytes", + (unsigned int)indx_record_size); total = -1; goto free_bitmap; } From cb0479279357cc2e5895314b812b556351dd3381 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:18:22 +0000 Subject: [PATCH 1729/2994] A printf format fix and a warnning fix. (Logical change 1.507) --- ntfsprogs/ntfstruncate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 4c4d1d49..36273774 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -362,7 +362,7 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) printf("%s\n", todo); return; case AT_VOLUME_NAME: - printf("Volume name length = %i\n", val_len); + printf("Volume name length = %u\n", (unsigned int)val_len); if (val_len) { buf = calloc(1, val_len); if (!buf) From d9f119eef313c0f75e201a61ffc84308c7943b9d Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:18:22 +0000 Subject: [PATCH 1730/2994] Variable type fix. (Logical change 1.507) --- ntfsprogs/ntfsundelete.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 62a3bf3a..4eb654a0 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -337,7 +337,8 @@ static int transform (const char *pattern, char **regex) */ static int parse_time (const char *value, time_t *since) { - time_t result, now; + long long result; + time_t now; char *suffix = NULL; if (!value || !since) From b43a5b905178e238e0f3f9894fa488764e6959f3 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:18:22 +0000 Subject: [PATCH 1731/2994] Various bugfixes related to printf format and incorrect variable types. BKrev: 4125ec0eaPUcCp2J1JUn4O0JkY0x-g From 0106f54ff0ecb3c40e1d2232d39e42ca18adc803 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:18:22 +0000 Subject: [PATCH 1732/2994] printf format fix. (Logical change 1.507) --- libntfs/win32_io.c | 8 +++++--- ntfsprogs/ntfsclone.c | 4 ++-- ntfsprogs/ntfsresize.c | 8 +++++--- ntfsprogs/ntfsrm.c | 3 ++- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 01325a04..091aa44a 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -696,7 +696,8 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) numtoread.QuadPart = ((count + offset.QuadPart - 1) | 0x1FF) + 1; Dprintf("win32_read(fd=%p,b=%p,count=0x%llx)->(%llx+%llx:%llx)\n", fd, - buf, count, base, offset, numtoread); + buf, count, base.QuadPart, offset.QuadPart, + numtoread.QuadPart); #ifndef FORCE_ALIGNED_READ if (((((long)buf) & ((s64)0x1FF)) == 0) && ((count & ((s64)0x1FF)) == 0) @@ -834,7 +835,7 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buf, s64 bytes_written = 0; HANDLE handle = ((win32_fd *)dev->d_private)->handle; - Dprintf("win32_write: Writing %ll bytes\n",count); + Dprintf("win32_write: Writing %lld bytes\n",count); if (NDevReadOnly(dev)) { Dputs("win32_write: Device R/O, exiting."); @@ -849,7 +850,8 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buf, if (WriteFile(handle, buf, cur_count, &cur_written, NULL) && (cur_written==cur_count)) { - Dprintf("win32_write: Written %u bytes.",bytes_written); + Dprintf("win32_write: Written %lld bytes.\n", + bytes_written); bytes_written += cur_written; count -= cur_written; } else { diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 6d778cf7..33967ed8 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -731,9 +731,9 @@ static void walk_runs(struct ntfs_walk_cluster *walk) for (j = 0; j < lcn_length; j++) { u64 k = (u64)lcn + j; if (ntfs_bit_get_and_set(lcn_bitmap.bm, k, 1)) - err_exit("Cluster %lu referenced twice!\n" + err_exit("Cluster %llu referenced twice!\n" "You didn't shutdown your Windows" - "properly?\n", k); + "properly?\n", (unsigned long long)k); } walk->image->inuse += lcn_length; diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 7b0d9f99..8080dbd5 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1140,10 +1140,12 @@ static void replace_attribute_runlist(ntfs_volume *vol, if (le32_to_cpu(ctx->mrec->bytes_in_use) + l > le32_to_cpu(ctx->mrec->bytes_allocated)) - err_exit("Extended record needed (%d > %d), not yet " + err_exit("Extended record needed (%u > %u), not yet " "supported!\nPlease try to free less space.\n", - le32_to_cpu(ctx->mrec->bytes_in_use) + l, - le32_to_cpu(ctx->mrec->bytes_allocated)); + (unsigned int)le32_to_cpu(ctx->mrec-> + bytes_in_use) + l, + (unsigned int)le32_to_cpu(ctx->mrec-> + bytes_allocated)); memmove(next_attr + l, next_attr, remains_size); ctx->mrec->bytes_in_use = cpu_to_le32(l + diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index a3ab1bf2..6457e439 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -3997,7 +3997,8 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) break; } printf ("%.*s", indent, space_line); - printf ("fill = %d/%d\n", block->index.index_length, block->index.allocated_size); + printf ("fill = %u/%u\n", (unsigned int)block->index.index_length, + (unsigned int)block->index.allocated_size); return 0; } From ae80043076d5b508bb08b1c1bde50bda062721ab Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:18:22 +0000 Subject: [PATCH 1733/2994] printf format fix. Reformattion a recent debug output change into a common style. (Logical change 1.507) --- libntfs/lcnalloc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 4d78c440..2abac206 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -303,8 +303,8 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, */ Dprintf("%s(): Adding run (lcn 0x%llx, len 0x%llx), " "prev_lcn = 0x%llx, lcn = 0x%llx, " - "bmp_pos = 0x%llx, prev_run_len = " - "0x%llx, rlpos = %i.\n", __FUNCTION__, + "bmp_pos = 0x%llx, prev_run_len = 0x%x, " + "rlpos = %i.\n", __FUNCTION__, (long long)(lcn + bmp_pos), 1LL, (long long)prev_lcn, (long long)lcn, (long long)bmp_pos, @@ -600,8 +600,8 @@ switch_to_data1_zone: search_zone = 2; } break; case 4: - Dputs("Switching from data2 zone to data1 " - "zone."); + Dprintf("%s(): Switching from data2 zone to " + "data1 zone.\n", __FUNCTION__); /* Update data2 zone position. */ if (rlpos) { LCN tc; @@ -701,9 +701,9 @@ switch_to_data1_zone: search_zone = 2; (long long)zone_end, (long long)vol->data1_zone_pos); } - Dputs("After outer while loop."); + Dprintf("%s(): After outer while loop.\n", __FUNCTION__); done_ret: - Dputs("At done_ret."); + Dprintf("%s(): At done_ret.\n", __FUNCTION__); /* Add runlist terminator element. */ rl[rlpos].vcn = rl[rlpos - 1].vcn + rl[rlpos - 1].length; rl[rlpos].lcn = LCN_RL_NOT_MAPPED; @@ -725,7 +725,7 @@ done_ret: } } done_err_ret: - Dputs("At done_err_ret (follows done_ret).n"); + Dprintf("%s(): At done_err_ret (follows done_ret).\n", __FUNCTION__); free(buf); /* Done! */ if (!err) From 912044e09abe6ac6d44d7b82da4198525a571a5b Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:18:22 +0000 Subject: [PATCH 1734/2994] printf format fixes. (Logical change 1.507) --- ntfsprogs/mkntfs.c | 12 ++++++------ ntfsprogs/ntfsdump_logfile.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 341a313f..25e111d0 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2753,7 +2753,7 @@ static void mkntfs_override_phys_params(void) err_exit("volume_size is not a multiple of sector_size.\n"); /* Validate volume size. */ if (opts.volume_size < 1 << 20 /* 1MiB */) - err_exit("Device is too small (%ikiB). Minimum NTFS volume " + err_exit("Device is too small (%llikiB). Minimum NTFS volume " "size is 1MiB.\n", opts.volume_size / 1024); Dprintf("volume size = %llikiB\n", opts.volume_size / 1024); /* If user didn't specify the cluster size, determine it now. */ @@ -2793,7 +2793,7 @@ static void mkntfs_override_phys_params(void) "to fit inside eight bits. (We do not support larger " "cluster sizes yet.)\n"); vol->cluster_size_bits = ffs(vol->cluster_size) - 1; - Dprintf("cluster size = %i bytes\n", vol->cluster_size); + Dprintf("cluster size = %u bytes\n", (unsigned int)vol->cluster_size); if (vol->cluster_size > 4096) { if (opts.enable_compression) { if (!opts.force) @@ -2926,7 +2926,7 @@ static void mkntfs_initialize_rl_mft(void) opts.mft_lcn = (16 * 1024 + vol->cluster_size - 1) / vol->cluster_size; } - Dprintf("$MFT logical cluster number = 0x%x\n", opts.mft_lcn); + Dprintf("$MFT logical cluster number = 0x%llx\n", opts.mft_lcn); /* Determine MFT zone size. */ opts.mft_zone_end = opts.nr_clusters; switch (opts.mft_zone_multiplier) { /* % of volume size in clusters */ @@ -2944,7 +2944,7 @@ static void mkntfs_initialize_rl_mft(void) opts.mft_zone_end = opts.mft_zone_end >> 3; /* 12.5% */ break; } - Dprintf("MFT zone size = %lukiB\n", opts.mft_zone_end / 1024); + Dprintf("MFT zone size = %lldkiB\n", opts.mft_zone_end / 1024); /* * The mft zone begins with the mft data attribute, not at the beginning * of the device. @@ -2968,7 +2968,7 @@ static void mkntfs_initialize_rl_mft(void) /* Determine mftmirr_lcn (middle of volume). */ opts.mftmirr_lcn = (opts.nr_sectors * opts.sector_size >> 1) / vol->cluster_size; - Dprintf("$MFTMirr logical cluster number = 0x%x\n", opts.mftmirr_lcn); + Dprintf("$MFTMirr logical cluster number = 0x%llx\n", opts.mftmirr_lcn); /* Create runlist for mft mirror. */ rl_mftmirr = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_mftmirr) @@ -2991,7 +2991,7 @@ static void mkntfs_initialize_rl_mft(void) for (i = 0; i < j; i++) ntfs_bit_set(lcn_bitmap, opts.mftmirr_lcn + i, 1); opts.logfile_lcn = opts.mftmirr_lcn + j; - Dprintf("$LogFile logical cluster number = 0x%x\n", opts.logfile_lcn); + Dprintf("$LogFile logical cluster number = 0x%llx\n", opts.logfile_lcn); } /** diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 76e6e122..a9d63e6a 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -225,8 +225,8 @@ int main(int argc, char **argv) "file data: %s", strerror(errno)); fd = open(argv[2], O_RDONLY); if (fd == -1) - log_err_exit("Failed to open file %s: %s\n", argv[2], - strerror(errno)); + log_err_exit(NULL, "Failed to open file %s: %s\n", + argv[2], strerror(errno)); /* Read in the file into the buffer. */ br = read(fd, buf, buf_size); err = errno; From c9ff3e38e675b9cf741e5f01e7ae6b56803cf501 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:30:34 +0000 Subject: [PATCH 1735/2994] Janitor work: Various warning fixes all around the place. BKrev: 4125eeeaD80jP_6gGnVxxRkCaP7QNg From 43b262ad58fe8b267850b102b2628734c12fd986 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:30:34 +0000 Subject: [PATCH 1736/2994] Warning fix: shadowing a global variable. (Logical change 1.508) --- ntfsprogs/ntfscat.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 25382a24..73326724 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -218,7 +218,7 @@ static int cat (ntfs_volume *vol __attribute__((unused)), ntfs_inode *inode, const int bufsize = 1024; char *buffer; ntfs_attr *attr; - s64 read, written; + s64 bytes_read, written; s64 offset; buffer = malloc (bufsize); @@ -234,20 +234,20 @@ static int cat (ntfs_volume *vol __attribute__((unused)), ntfs_inode *inode, offset = 0; for (;;) { - read = ntfs_attr_pread (attr, offset, bufsize, buffer); - if (read == -1) { + bytes_read = ntfs_attr_pread (attr, offset, bufsize, buffer); + if (bytes_read == -1) { perror ("ERROR: Couldn't read file"); break; } - if (!read) + if (!bytes_read) break; - written = fwrite (buffer, 1, read, stdout); - if (written != read) { + written = fwrite (buffer, 1, bytes_read, stdout); + if (written != bytes_read) { perror ("ERROR: Couldn't output all data!"); break; } - offset += read; + offset += bytes_read; } ntfs_attr_close (attr); From c8dd7708178335ed490847d7d27d90b49a49e488 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:30:34 +0000 Subject: [PATCH 1737/2994] Warning fixes: change of variable type and no need to inline. (Logical change 1.508) --- libntfs/win32_io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 091aa44a..0ff66ecf 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -101,7 +101,7 @@ static BOOL WINAPI SetFilePointerEx(HANDLE hFile, * * Limited to a reletevly small but useful number of codes */ -static int ntfs_w32error_to_errno(DWORD w32error) +static int ntfs_w32error_to_errno(unsigned int w32error) { Dprintf("win32_w32error_to_errno(%d).\n",w32error); switch (w32error) { @@ -464,8 +464,8 @@ static BOOL ntfs_device_win32_find_partition(HANDLE handle,DWORD partition_id, * * When fails, fd contents may have not been preserved. */ -static __inline__ int ntfs_device_win32_open_partition(int drive_id, - DWORD partition_id, win32_fd *fd, int flags) +static int ntfs_device_win32_open_partition(int drive_id, + unsigned int partition_id, win32_fd *fd, int flags) { char drive_name[MAX_PATH]; HANDLE handle; From 7a64dc8159e51f1dca34b97873413839bfce98f3 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:30:34 +0000 Subject: [PATCH 1738/2994] Warning fixes: change variable to unsigned. (Logical change 1.508) --- ntfsprogs/ntfsdump_logfile.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index a9d63e6a..915514d6 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -123,7 +123,8 @@ int main(int argc, char **argv) LOG_CLIENT_RECORD *lcr; RECORD_PAGE_HEADER *rcrd; LOG_RECORD *lr; - int buf_size, err, i, page_size, usa_end_ofs, client, pass = 1; + int buf_size, err, client, pass = 1; + unsigned int page_size, usa_end_ofs, i; printf("\n"); if (argc < 2 || argc > 3) @@ -161,7 +162,8 @@ int main(int argc, char **argv) if (!na) device_err_exit(argv[1], vol, ni, NULL, "Failed to " "open $LogFile/$DATA (attribute " - "0x%x): %s\n", le32_to_cpu(AT_DATA), + "0x%x): %s\n", + (unsigned int)le32_to_cpu(AT_DATA), strerror(errno)); if (!na->data_size) device_err_exit(argv[1], vol, ni, na, "$LogFile has " From 2e082893fe78745b9a07f5c9ae38480d88066198 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:30:34 +0000 Subject: [PATCH 1739/2994] Warning fixes: missing const and mixing declerations with code. (Logical change 1.508) --- ntfsprogs/ntfswipe.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 10e5ef25..08d9f9e5 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -40,7 +40,7 @@ #include "dir.h" #include "mst.h" -static char *EXEC_NAME = "ntfswipe"; +static const char *EXEC_NAME = "ntfswipe"; static struct options opts; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) @@ -173,7 +173,7 @@ static int parse_list (char *list, int **result) */ static int parse_options (int argc, char *argv[]) { - static char *sopt = "-ab:c:dfh?ilmnpqtuvV"; + static const char *sopt = "-ab:c:dfh?ilmnpqtuvV"; static struct option lopt[] = { { "all", no_argument, NULL, 'a' }, { "bytes", required_argument, NULL, 'b' }, @@ -429,6 +429,8 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, } if (rlc->lcn == LCN_HOLE) { + runlist *rlt; + offset = cur_vcn - rlc->length; if (offset == (offset & (~cu_mask))) { rlc++; @@ -436,7 +438,7 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, } offset = (offset & (~cu_mask)) << vol->cluster_size_bits; - runlist *rlt = rlc; + rlt = rlc; while ((rlt - 1)->lcn == LCN_HOLE) rlt--; while (1) { ret = ntfs_rl_pread (vol, na->rl, @@ -572,6 +574,8 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) return -1; for (inode_num = 16; inode_num < vol->nr_mft_records; inode_num++) { + s64 wiped; + Vprintf ("Inode %lld - ", inode_num); ni = ntfs_inode_open (vol, inode_num); if (!ni) { @@ -601,7 +605,6 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) goto close_attr; } - s64 wiped; if (NAttrCompressed(na)) wiped = wipe_compressed_attribute (vol, byte, act, na); else @@ -831,7 +834,7 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act, indx_record_size) { Vprintf ("Internal error\n"); Eprintf ("INDX record should be %u bytes", - indx_record_size); + (unsigned int)indx_record_size); total = -1; goto free_buf; } @@ -927,6 +930,9 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) return -1; for (inode_num = 5; inode_num < vol->nr_mft_records; inode_num++) { + u32 indx_record_size; + s64 wiped; + Vprintf ("Inode %lld - ", inode_num); ni = ntfs_inode_open (vol, inode_num); if (!ni) { @@ -993,13 +999,13 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) goto close_attr_root; } - u32 indx_record_size = get_indx_record_size (nar); + indx_record_size = get_indx_record_size (nar); if (!indx_record_size) { Eprintf (" (inode %lld)\n", inode_num); goto close_attr_root; } - s64 wiped = wipe_index_allocation (vol, byte, act, + wiped = wipe_index_allocation (vol, byte, act, naa, nab, indx_record_size); if (wiped == -1) { Eprintf (" (inode %lld)\n", inode_num); From 5ffea94d8db86ecbaf06805d03a924138781ed8a Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:30:34 +0000 Subject: [PATCH 1740/2994] Warning fixes: mixing declerations with code. (Logical change 1.508) --- ntfsprogs/ntfsinfo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 783a8e02..13b544f1 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -676,9 +676,11 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v if (attr->non_resident) { runlist *rl = ntfs_mapping_pairs_decompress(vol, attr, 0); if (rl) { - s64 data_size = sle64_to_cpu(attr->data_size); + s64 data_size, bytes_read; + + data_size = sle64_to_cpu(attr->data_size); sec_desc_attr = malloc(data_size); - s64 bytes_read = ntfs_rl_pread(vol, rl, 0, + bytes_read = ntfs_rl_pread(vol, rl, 0, data_size, sec_desc_attr); if (bytes_read != data_size) { Eprintf("ntfsinfo error: could not " @@ -869,8 +871,8 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol) if (opts.verbose) { runlist *rl = ntfs_mapping_pairs_decompress(vol, attr, 0); if (rl) { - printf ("\tRunlist:\tVCN\t\tLCN\t\tLength\n"); runlist *rlc = rl; + printf ("\tRunlist:\tVCN\t\tLCN\t\tLength\n"); while (rlc->length) { printf ("\t\t\t%lld\t\t%lld\t\t%lld\n", rlc->vcn, rlc->lcn, rlc->length); From 9747580a05f87a01c9e5663e35febe9a979755cf Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:30:34 +0000 Subject: [PATCH 1741/2994] Warning fixes: printf complains, so add a cast. (Logical change 1.508) --- ntfsprogs/ntfsclone.c | 8 +++++--- ntfsprogs/ntfsresize.c | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 33967ed8..e5e847b5 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -723,7 +723,8 @@ static void walk_runs(struct ntfs_walk_cluster *walk) if (lcn < 0 || lcn_length < 0) err_exit("Corrupt runlist in inode %lld attr %x LCN " "%llx length %llx\n", ctx->ntfs_ino->mft_no, - le32_to_cpu (a->type), lcn, lcn_length); + (unsigned int)le32_to_cpu(a->type), lcn, + lcn_length); if (!wipe) dump_clusters(walk->image, rl + i); @@ -1007,7 +1008,7 @@ static void print_image_info(void) Printf("NTFS volume version: %d.%d\n", image_hdr.major_ver, image_hdr.minor_ver); Printf("Cluster size : %u bytes\n", - image_hdr.cluster_size); + (unsigned int)image_hdr.cluster_size); print_volume_size("Image volume size ", image_hdr.cluster_size * image_hdr.nr_clusters); @@ -1064,7 +1065,8 @@ static void mount_volume(unsigned long new_mntflag) "please try again (or see -f option).\n"); if (NTFS_MAX_CLUSTER_SIZE < vol->cluster_size) - err_exit("Cluster size %u is too large!\n", vol->cluster_size); + err_exit("Cluster size %u is too large!\n", + (unsigned int)vol->cluster_size); Printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); if (ntfs_version_is_supported(vol)) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 8080dbd5..2b580e7f 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -772,7 +772,8 @@ static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfsck_t *fsck) if (lcn < 0 || lcn_length <= 0) err_exit("Corrupt runlist in inode %lld attr %x LCN " "%llx length %llx\n", inode, - le32_to_cpu(a->type), lcn, lcn_length); + (unsigned int)le32_to_cpu(a->type), lcn, + lcn_length); for (j = 0; j < lcn_length; j++) { u64 k = (u64)lcn + j; @@ -1529,7 +1530,8 @@ static void relocate_attribute(ntfs_resize_t *resize) if (lcn < 0 || lcn_length <= 0) err_exit("Corrupt runlist in MTF %llu attr %x LCN " "%llx length %llx\n", resize->mref, - le32_to_cpu (a->type), lcn, lcn_length); + (unsigned int)le32_to_cpu(a->type), + lcn, lcn_length); relocate_run(resize, &rl, i); } @@ -2046,7 +2048,8 @@ static ntfs_volume *mount_volume(void) "please try again (or see -f option).\n"); if (NTFS_MAX_CLUSTER_SIZE < vol->cluster_size) - err_exit("Cluster size %u is too large!\n", vol->cluster_size); + err_exit("Cluster size %u is too large!\n", + (unsigned int)vol->cluster_size); printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); if (ntfs_version_is_supported(vol)) From d1b5859785f5e4244fc1401c1eca5c7deff97227 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:30:34 +0000 Subject: [PATCH 1742/2994] Warning fixes: shadowing variables. (Logical change 1.508) --- ntfsprogs/ntfsmove.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index 148f86aa..b969245a 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -271,14 +271,14 @@ static int ntfs_debug_runlist_dump2 (const runlist *rl, int abbr, char *prefix) res = -1; if (lcn < (LCN)0) { - int index = -lcn - 1; + int j = -lcn - 1; - if ((index < 0) || (index > 4)) { - index = 4; + if ((j < 0) || (j > 4)) { + j = 4; res = -1; } printf("%s%8lld %8s %8lld\n", prefix, - rl->vcn, lcn_str[index], rl->length); + rl->vcn, lcn_str[j], rl->length); } else printf("%s%8lld %8lld %8lld\n", prefix, rl->vcn, rl->lcn, rl->length); @@ -370,9 +370,7 @@ static runlist * find_unused (ntfs_volume *vol, s64 size, u64 loc, int flags) const int bufsize = 8192; u8 *buffer; int clus; - int read; int i; - int j; int curr = 0; int count = 0; s64 start = 0; @@ -392,8 +390,11 @@ static runlist * find_unused (ntfs_volume *vol, s64 size, u64 loc, int flags) //printf ("clus = %d\n", clus); for (i = 0; i < clus; i++) { - read = ntfs_attr_pread (vol->lcnbmp_na, i*bufsize, bufsize, buffer); - if (read != bufsize) { + int bytes_read, j; + + bytes_read = ntfs_attr_pread (vol->lcnbmp_na, i*bufsize, + bufsize, buffer); + if (bytes_read != bufsize) { printf ("!read\n"); return NULL; } From 067797a112757066656d3bdda5dc359bcc630f4a Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 12:30:34 +0000 Subject: [PATCH 1743/2994] Warning fixes: variable type changeses. (Logical change 1.508) --- ntfsprogs/ntfstruncate.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 36273774..c970ab2d 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -72,7 +72,7 @@ char *dev_name; s64 inode; u32 attr_type; ntfschar *attr_name = NULL; -u32 attr_name_len; +int attr_name_len; s64 new_len; ntfs_volume *vol; @@ -283,7 +283,7 @@ static void parse_options(int argc, char *argv[]) attr_name_len = 0; } } - Dprintf("attribute type = 0x%x\n", attr_type); + Dprintf("attribute type = 0x%x\n", (unsigned int)attr_type); if (attr_name == AT_UNNAMED) Dprintf("attribute name = \"\" (UNNAMED)\n"); else @@ -336,9 +336,9 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) "type yet."; const char *skip = "Skipping display of $%s attribute value.\n"; const char *todo = "This is still work in progress."; + unsigned int u; char *buf; int i, j; - u32 u; switch (type) { case AT_STANDARD_INFORMATION: @@ -558,7 +558,8 @@ static void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) printf("-- Beginning dump of attribute record at offset 0x%x. --\n", (unsigned)((u8*)a - (u8*)m)); if (a->type == AT_END) { - printf("Attribute type = 0x%x ($END)\n", le32_to_cpu(AT_END)); + printf("Attribute type = 0x%x ($END)\n", + (unsigned int)le32_to_cpu(AT_END)); u = le32_to_cpu(a->length); printf("Length of resident part = %u (0x%x)\n", u, u); return; @@ -785,8 +786,8 @@ int main(int argc, char **argv) /* Open the specified attribute. */ na = ntfs_attr_open(ni, attr_type, attr_name, attr_name_len); if (!na) - err_exit("Failed to open attribute 0x%x: %s\n", attr_type, - strerror(errno)); + err_exit("Failed to open attribute 0x%x: %s\n", + (unsigned int)attr_type, strerror(errno)); if (!opts.quiet && opts.verbose > 1) { Dprintf("Dumping mft record before calling " @@ -797,8 +798,8 @@ int main(int argc, char **argv) /* Truncate the attribute. */ err = ntfs_attr_truncate(na, new_len); if (err) - err_exit("Failed to truncate attribute 0x%x: %s\n", attr_type, - strerror(errno)); + err_exit("Failed to truncate attribute 0x%x: %s\n", + (unsigned int)attr_type, strerror(errno)); if (!opts.quiet && opts.verbose > 1) { Dprintf("Dumping mft record after calling " From 4341f051c4f3a4f2b0722413db23591f94b8cf23 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 20 Aug 2004 14:49:42 +0000 Subject: [PATCH 1744/2994] Revert a change from Yuval where a bitfield was converted to a char. (Logical change 1.509) --- libntfs/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index c29915c7..f4b5cc3e 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -880,7 +880,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) runlist_element *rl; int eo; struct { - char initialized_size; + unsigned int initialized_size : 1; } need_to_undo = { 0 }; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, " From ace60ce2067235fe015b2f8a370e6c61b42531fe Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 20 Aug 2004 14:49:42 +0000 Subject: [PATCH 1745/2994] Revert a change from Yuval where a bitfield was converted to a char. BKrev: 41260f86XYe5YNbsWcvb_-H1ek9HaA From 627bd9686f36d0110625d80080490a9f59c01f0a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 20 Aug 2004 15:16:21 +0000 Subject: [PATCH 1746/2994] Reapply changes that apparently got lost in Yuval's merge. (Logical change 1.510) --- libntfs/lcnalloc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 2abac206..d24f85e5 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -303,8 +303,8 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, */ Dprintf("%s(): Adding run (lcn 0x%llx, len 0x%llx), " "prev_lcn = 0x%llx, lcn = 0x%llx, " - "bmp_pos = 0x%llx, prev_run_len = 0x%x, " - "rlpos = %i.\n", __FUNCTION__, + "bmp_pos = 0x%llx, prev_run_len = " + "0x%llx, rlpos = %i.\n", __FUNCTION__, (long long)(lcn + bmp_pos), 1LL, (long long)prev_lcn, (long long)lcn, (long long)bmp_pos, @@ -600,8 +600,8 @@ switch_to_data1_zone: search_zone = 2; } break; case 4: - Dprintf("%s(): Switching from data2 zone to " - "data1 zone.\n", __FUNCTION__); + Dputs("Switching from data2 zone to data1 " + "zone."); /* Update data2 zone position. */ if (rlpos) { LCN tc; @@ -701,9 +701,9 @@ switch_to_data1_zone: search_zone = 2; (long long)zone_end, (long long)vol->data1_zone_pos); } - Dprintf("%s(): After outer while loop.\n", __FUNCTION__); + Dputs("After outer while loop."); done_ret: - Dprintf("%s(): At done_ret.\n", __FUNCTION__); + Dputs("At done_ret."); /* Add runlist terminator element. */ rl[rlpos].vcn = rl[rlpos - 1].vcn + rl[rlpos - 1].length; rl[rlpos].lcn = LCN_RL_NOT_MAPPED; @@ -725,7 +725,7 @@ done_ret: } } done_err_ret: - Dprintf("%s(): At done_err_ret (follows done_ret).\n", __FUNCTION__); + Dputs("At done_err_ret (follows done_ret)."); free(buf); /* Done! */ if (!err) From 8aafc99eef98bda27401961c13fa376932c73446 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 20 Aug 2004 15:16:21 +0000 Subject: [PATCH 1747/2994] Reapply changes that apparently got lost in Yuval's merge. BKrev: 412615c5ZmeUUOEahNkZ4Teg1u0Zfg From 388972a4bb32b91971e7d6b87667840d4bbfdb48 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 20 Aug 2004 15:26:18 +0000 Subject: [PATCH 1748/2994] Revert some of Yuval's changes and fix the putative warnings differently. (Logical change 1.511) --- ntfsprogs/ntfstruncate.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index c970ab2d..4bf5e8cc 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -72,7 +72,7 @@ char *dev_name; s64 inode; u32 attr_type; ntfschar *attr_name = NULL; -int attr_name_len; +u32 attr_name_len; s64 new_len; ntfs_volume *vol; @@ -268,7 +268,7 @@ static void parse_options(int argc, char *argv[]) if (optind != argc) { /* Convert the string to little endian Unicode. */ attr_name_len = ntfs_mbstoucs(s, &attr_name, 0); - if (attr_name_len < 0) + if ((int)attr_name_len < 0) err_exit("Invalid attribute name \"%s\": %s\n", s, strerror(errno)); @@ -287,8 +287,9 @@ static void parse_options(int argc, char *argv[]) if (attr_name == AT_UNNAMED) Dprintf("attribute name = \"\" (UNNAMED)\n"); else - Dprintf("attribute name = \"%s\" (length %i Unicode " - "characters)\n", s2, attr_name_len); + Dprintf("attribute name = \"%s\" (length %u Unicode " + "characters)\n", s2, + (unsigned int)attr_name_len); /* Get the new length. */ ll = strtoll(s, &s2, 0); @@ -336,9 +337,9 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) "type yet."; const char *skip = "Skipping display of $%s attribute value.\n"; const char *todo = "This is still work in progress."; - unsigned int u; char *buf; int i, j; + u32 u; switch (type) { case AT_STANDARD_INFORMATION: @@ -471,7 +472,7 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) printf("Cannot display unknown %s defined attribute type 0x%x" ".\n", u >= le32_to_cpu(AT_FIRST_USER_DEFINED_ATTRIBUTE) ? - "user" : "system", u); + "user" : "system", (unsigned int)u); } } From ec25948835b1cc03c5aee001d5a8cb69727d8904 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 20 Aug 2004 15:26:18 +0000 Subject: [PATCH 1749/2994] Revert some of Yuval's changes and fix the putative warnings differently. BKrev: 4126181adm8g6cikgmOs2SJIxIMz1A From f49c5bc704517a0c97df33466ac5f77b8d21d17f Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 20 Aug 2004 17:27:24 +0000 Subject: [PATCH 1750/2994] Auto merged 2004/08/18 19:59:42+01:00 flatcap.org!ntfs track memory usage 2004/08/18 19:58:56+01:00 flatcap.org!ntfs a cache for a non-altered bitmap 2004/08/15 23:53:28+01:00 flatcap.org!ntfs not needed 2004/08/15 21:12:15+01:00 flatcap.org!ntfs typo (Logical change 1.512) --- ntfsprogs/ntfsrm.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsrm.h b/ntfsprogs/ntfsrm.h index 8f75459f..9df72871 100644 --- a/ntfsprogs/ntfsrm.h +++ b/ntfsprogs/ntfsrm.h @@ -27,6 +27,11 @@ #include "types.h" #include "layout.h" +#define ntfs_malloc malloc +#define ntfs_realloc realloc +#define ntfs_calloc calloc +#define ntfs_free free + /** * struct options */ @@ -48,10 +53,11 @@ struct options { */ struct ntfs_bmp { ntfs_attr *attr; + int count; u8 **data; VCN *data_vcn; - int count; - //int cluster_size; + u8 *cache; + VCN cache_vcn; }; /** @@ -83,11 +89,10 @@ struct ntfs_dir { struct ntfs_dt *index; struct ntfs_dir **children; int child_count; - struct mft_bitmap *bitmap; + struct ntfs_bmp *bitmap; ntfs_inode *inode; ntfs_attr *iroot; ntfs_attr *ialloc; - ntfs_attr *ibmp; int index_size; u8 padding[4]; /* Unused: padding to 64 bit. */ }; From 813fd366870f371321cef02dec3da586df93cd52 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 20 Aug 2004 17:27:24 +0000 Subject: [PATCH 1751/2994] Auto merged 2004/08/18 19:59:42+01:00 flatcap.org!ntfs track memory usage 2004/08/18 19:58:56+01:00 flatcap.org!ntfs commit/rollback filled out a bit 2004/08/15 23:53:28+01:00 flatcap.org!ntfs start reassembling remove 2004/08/15 23:04:56+01:00 flatcap.org!ntfs keep the bitmap info on the volume 2004/08/15 21:12:15+01:00 flatcap.org!ntfs vol's private data now points to the root directory 2004/08/15 18:32:35+01:00 flatcap.org!ntfs fix memory leak 2004/08/14 17:03:01+01:00 flatcap.org!ntfs extract file details (Logical change 1.512) --- ntfsprogs/ntfsrm.c | 652 +++++++++++++++++++++++++++++---------------- 1 file changed, 429 insertions(+), 223 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 6457e439..02c003ad 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -205,9 +205,9 @@ static void ntfs_name_print (ntfschar *name, int name_len) char *buffer = NULL; if (name_len) { - ntfs_ucstombs (name, name_len, (char**) &buffer, 0); + ntfs_ucstombs (name, name_len, &buffer, 0); printf ("%s", buffer); - free (buffer); + ntfs_free (buffer); } else { printf ("!"); } @@ -262,24 +262,61 @@ static const char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) } +/** + * ntfs_bmp_commit + */ +static int ntfs_bmp_commit (ntfs_volume *vol, struct ntfs_bmp *bmp) +{ + if (!vol || !bmp) + return 0; + + printf ("commit bmp\n"); + vol = NULL; +#if 0 + ntfs_attr *attr; + u8 **data; + VCN *data_vcn; + int count; +#endif + return 0; +} + +/** + * ntfs_bmp_rollback + */ +static int ntfs_bmp_rollback (struct ntfs_bmp *bmp) +{ + int i; + + if ((!bmp) || (bmp->count == 0)) + return 0; + + printf ("rollback bmp\n"); + + for (i = 0; i < bmp->count; i++) + ntfs_free (bmp->data[i]); + + ntfs_free (bmp->data); + ntfs_free (bmp->data_vcn); + bmp->count = 0; + + return 0; +} + /** * ntfs_bmp_free */ static void ntfs_bmp_free (struct ntfs_bmp *bmp) { - int i; - if (!bmp) return; - for (i = 0; i < bmp->count; i++) - free (bmp->data[i]); + ntfs_bmp_rollback (bmp); ntfs_attr_close (bmp->attr); - free (bmp->data); - free (bmp->data_vcn); - free (bmp); + ntfs_free (bmp->cache); + ntfs_free (bmp); } /** @@ -297,14 +334,18 @@ static struct ntfs_bmp * ntfs_bmp_alloc (ntfs_inode *inode, ATTR_TYPES type, ntf if (!attr) return NULL; - bmp = calloc (1, sizeof (*bmp)); - if (!bmp) + bmp = ntfs_calloc (1, sizeof (*bmp)); + if (!bmp) { + ntfs_attr_close (attr); return NULL; + } bmp->attr = attr; - bmp->data = calloc (16, sizeof (*bmp->data)); - bmp->data_vcn = calloc (16, sizeof (*bmp->data_vcn)); + bmp->data = ntfs_calloc (16, sizeof (*bmp->data)); + bmp->data_vcn = ntfs_calloc (16, sizeof (*bmp->data_vcn)); bmp->count = 0; + bmp->cache = NULL; + bmp->cache_vcn = -1; if (!bmp->data || !bmp->data_vcn) { ntfs_bmp_free (bmp); @@ -331,8 +372,8 @@ static int ntfs_bmp_add_data (struct ntfs_bmp *bmp, VCN vcn, u8 *data) new = ((bmp->count + 15) & ~15); if (old != new) { - bmp->data = realloc (bmp->data, new * sizeof (*bmp->data)); - bmp->data_vcn = realloc (bmp->data_vcn , new * sizeof (*bmp->data_vcn)); + bmp->data = ntfs_realloc (bmp->data, new * sizeof (*bmp->data)); + bmp->data_vcn = ntfs_realloc (bmp->data_vcn , new * sizeof (*bmp->data_vcn)); } for (i = 0; i < bmp->count-1; i++) @@ -372,14 +413,14 @@ static u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn) } } - buffer = malloc (512); + buffer = ntfs_malloc (512); if (!buffer) return NULL; begin = (vcn>>3) & (~(512-1)); //printf ("loading from offset %lld\n", begin); if (ntfs_attr_pread (bmp->attr, begin, 512, buffer) < 0) { - free (buffer); + ntfs_free (buffer); return NULL; } @@ -486,26 +527,6 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va return 1; } -/** - * ntfs_bmp_commit - */ -static int ntfs_bmp_commit (struct ntfs_bmp *bmp) -{ - if (!bmp) - return -1; - return 0; -} - -/** - * ntfs_bmp_rollback - */ -static int ntfs_bmp_rollback (struct ntfs_bmp *bmp) -{ - if (!bmp) - return -1; - return 0; -} - /** * ntfs_ie_get_vcn @@ -583,7 +604,7 @@ static INDEX_ENTRY * ntfs_ie_create (void) INDEX_ENTRY *ie; length = 16; - ie = malloc (length); + ie = ntfs_malloc (length); if (!ie) return NULL; @@ -605,7 +626,7 @@ static INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie) if (!ie) return NULL; - copy = malloc (ie->length); + copy = ntfs_malloc (ie->length); if (!copy) return NULL; memcpy (copy, ie, ie->length); @@ -623,7 +644,7 @@ static INDEX_ENTRY * ntfs_ie_set_vcn (INDEX_ENTRY *ie, VCN vcn) if (!(ie->flags & INDEX_ENTRY_NODE)) { ie->length += 8; - ie = realloc (ie, ie->length); + ie = ntfs_realloc (ie, ie->length); if (!ie) return NULL; @@ -646,7 +667,7 @@ static INDEX_ENTRY * ntfs_ie_remove_vcn (INDEX_ENTRY *ie) ie->length -= 8; ie->flags &= ~INDEX_ENTRY_NODE; - ie = realloc (ie, ie->length); + ie = ntfs_realloc (ie, ie->length); return ie; } @@ -703,7 +724,7 @@ static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int name ie->length = 16 + need; ie->key_length = sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar)); - ie = realloc (ie, ie->length + ie->key_length); + ie = ntfs_realloc (ie, ie->length + ie->key_length); if (!ie) return NULL; @@ -738,7 +759,7 @@ static INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) ie->key_length = 0; ie->flags |= INDEX_ENTRY_END; - ie = realloc (ie, ie->length); + ie = ntfs_realloc (ie, ie->length); if (!ie) return NULL; @@ -770,7 +791,7 @@ static int ntfs_ie_test (void) if (1) { namelen = ntfs_mbstoucs("richard", &name, 0); ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); - free (name); + ntfs_free (name); name = NULL; ntfs_ie_dump (ie1); } @@ -778,7 +799,7 @@ static int ntfs_ie_test (void) if (1) { namelen = ntfs_mbstoucs("richard2", &name, 0); ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); - free (name); + ntfs_free (name); name = NULL; ntfs_ie_dump (ie1); } @@ -808,9 +829,9 @@ static int ntfs_ie_test (void) ie1->key.file_name.data_size = 3973; //ntfs_ie_dump (ie1); - free (name); - free (ie1); - free (ie2); + ntfs_free (name); + ntfs_free (ie1); + ntfs_free (ie2); return 0; } @@ -827,7 +848,7 @@ static INDEX_ENTRY ** ntfs_dt_alloc_children (INDEX_ENTRY **children, int count) if (old == new) return children; - return realloc (children, new * sizeof (INDEX_ENTRY*)); + return ntfs_realloc (children, new * sizeof (INDEX_ENTRY*)); } /** @@ -843,9 +864,9 @@ static BOOL ntfs_dt_alloc_children2 (struct ntfs_dt *dt, int count) if (old == new) return TRUE; - dt->children = realloc (dt->children, new * sizeof (*dt->children)); - dt->sub_nodes = realloc (dt->sub_nodes, new * sizeof (*dt->sub_nodes)); - dt->inodes = realloc (dt->sub_nodes, new * sizeof (*dt->inodes)); + dt->children = ntfs_realloc (dt->children, new * sizeof (*dt->children)); + dt->sub_nodes = ntfs_realloc (dt->sub_nodes, new * sizeof (*dt->sub_nodes)); + dt->inodes = ntfs_realloc (dt->sub_nodes, new * sizeof (*dt->inodes)); // XXX wipe new space @@ -898,7 +919,7 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt) if (!(entry->flags & INDEX_ENTRY_END)) { ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, entry->key.file_name.file_name_length); //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); - free (name); + ntfs_free (name); name = NULL; } @@ -912,8 +933,8 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt) if (dt->child_count > 0) { //printf ("%d subnodes\n", dt->child_count); - dt->sub_nodes = calloc (dt->child_count, sizeof (struct ntfs_dt *)); - dt->inodes = calloc (dt->child_count, sizeof (struct ntfs_inode *)); + dt->sub_nodes = ntfs_calloc (dt->child_count, sizeof (struct ntfs_dt *)); + dt->inodes = ntfs_calloc (dt->child_count, sizeof (struct ntfs_inode *)); } return dt->child_count; } @@ -965,7 +986,7 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) } else { ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, entry->key.file_name.file_name_length); //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); - free (name); + ntfs_free (name); name = NULL; } @@ -975,13 +996,92 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) if (dt->child_count > 0) { //printf ("%d subnodes\n", dt->child_count); - dt->sub_nodes = calloc (dt->child_count, sizeof (struct ntfs_dt *)); - dt->inodes = calloc (dt->child_count, sizeof (struct ntfs_inode *)); + dt->sub_nodes = ntfs_calloc (dt->child_count, sizeof (struct ntfs_dt *)); + dt->inodes = ntfs_calloc (dt->child_count, sizeof (struct ntfs_inode *)); } return dt->child_count; } +/** + * ntfs_dt_commit + */ +static int ntfs_dt_commit (struct ntfs_dt *dt) +{ + ntfs_volume *vol; + struct ntfs_dir *dir; + int i; + + if (!dt) + return 0; + + printf ("commit dt\n"); + dir = dt->dir; + if (!dir) + return -1; + + vol = dir->vol; // cluster size + if (dt->changed) { + printf ("dt changed\n"); + } +#if 0 + //dt + u8 *data; + int data_len; + ntfs_inode **inodes; + VCN vcn; + BOOL changed; + + //dir + struct ntfs_bmp *bitmap; + ntfs_attr *iroot; + ntfs_attr *ialloc; + int index_size; +#endif + + for (i = 0; i < dt->child_count; i++) { + if (ntfs_dt_commit (dt->sub_nodes[i]) < 0) + return -1; + } + + return 0; +} + +/** + * ntfs_dt_rollback + */ +static int ntfs_dt_rollback (struct ntfs_dt *dt) +{ + if (!dt) + return -1; + // inode rollback + return 0; +} + +/** + * ntfs_dt_free + */ +static void ntfs_dt_free (struct ntfs_dt *dt) +{ + int i; + + if (!dt) + return; + + ntfs_dt_rollback (dt); + + for (i = 0; i < dt->child_count; i++) { + ntfs_dt_free (dt->sub_nodes[i]); + ntfs_inode_close2 (dt->inodes[i]); + } + + ntfs_free (dt->sub_nodes); + ntfs_free (dt->children); + ntfs_free (dt->inodes); + ntfs_free (dt->data); // XXX is this always ours? + ntfs_free (dt); +} + /** * ntfs_dt_alloc */ @@ -993,7 +1093,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par if (!dir) return NULL; - dt = calloc (1, sizeof (*dt)); + dt = ntfs_calloc (1, sizeof (*dt)); if (!dt) return NULL; @@ -1014,7 +1114,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par dt->data_len = dt->dir->index_size; //printf ("parent size = %d\n", dt->data_len); - dt->data = malloc (dt->data_len); + dt->data = ntfs_malloc (dt->data_len); //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data)); ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data); //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); @@ -1044,7 +1144,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par //printf ("root i = %lld\n", dir->iroot->initialized_size); dt->data_len = dir->iroot->allocated_size; - dt->data = malloc (dt->data_len); + dt->data = ntfs_malloc (dt->data_len); //printf ("%lld\n", ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data)); ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data); //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); @@ -1074,28 +1174,6 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par return dt; } -/** - * ntfs_dt_free - */ -static void ntfs_dt_free (struct ntfs_dt *dt) -{ - int i; - - if (!dt) - return; - - for (i = 0; i < dt->child_count; i++) { - ntfs_dt_free (dt->sub_nodes[i]); - ntfs_inode_close2 (dt->inodes[i]); - } - - free (dt->sub_nodes); - free (dt->children); - free (dt->inodes); - free (dt->data); // XXX is this always ours? - free (dt); -} - /** * ntfs_dt_find * find dt by name, return MFT_REF @@ -1188,7 +1266,7 @@ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int n return NULL; // XXX default index_num to -1 - + /* * State Children Action * ------------------------------------------- @@ -1397,26 +1475,6 @@ static void ntfs_dt_find_all (struct ntfs_dt *dt) } } -/** - * ntfs_dt_commit - */ -static int ntfs_dt_commit (struct ntfs_dt *dt) -{ - if (!dt) - return -1; - return 0; -} - -/** - * ntfs_dt_rollback - */ -static int ntfs_dt_rollback (struct ntfs_dt *dt) -{ - if (!dt) - return -1; - return 0; -} - /** * ntfs_dt_find_parent */ @@ -1503,8 +1561,8 @@ static int ntfs_dt_initialise (struct ntfs_dt *dt, VCN vcn) memset (dt->data, 0, dt->data_len); // Ought to check these are empty - free (dt->children); - free (dt->sub_nodes); + ntfs_free (dt->children); + ntfs_free (dt->sub_nodes); dt->children = NULL; dt->sub_nodes = NULL; @@ -1677,6 +1735,9 @@ static int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start // rebuild old/new children/sub_nodes without destroying tree // update old/new headers + old->changed = TRUE; + new->changed = TRUE; + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); @@ -1722,7 +1783,7 @@ static void ntfs_inode_dir_map (ntfs_inode *ino) static ntfs_inode *ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) { ntfs_inode *ino = NULL; - struct ntfs_dt *dt; + struct ntfs_dir *dir; if (!vol) return NULL; @@ -1732,12 +1793,9 @@ static ntfs_inode *ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) case FILE_MFT: ino = vol->mft_ni; break; case FILE_MFTMirr: ino = vol->mftmirr_ni; break; case FILE_root: - if (vol->private_data) { - dt = (struct ntfs_dt *) vol->private_data; - if (dt->dir) { - ino = dt->dir->inode; - } - } + dir = vol->private_data; + if (dir) + ino = dir->inode; break; } @@ -1773,7 +1831,7 @@ static int ntfs_inode_close2 (ntfs_inode *ni) { if (!ni) return 0; - + //printf (BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); ni->ref_count--; @@ -1783,10 +1841,62 @@ static int ntfs_inode_close2 (ntfs_inode *ni) // unlink // ino->private_data + // XXX tempoarary until we have commit/rollback + NInoClearDirty(ni); + return ntfs_inode_close (ni); } +/** + * ntfs_dir_commit + */ +static int ntfs_dir_commit (struct ntfs_dir *dir) +{ + int i; + + if (!dir) + return 0; + + printf ("commit dir\n"); + if (ntfs_dt_commit (dir->index) < 0) + return -1; + + if (ntfs_bmp_commit (dir->vol, dir->bitmap) < 0) + return -1; + + for (i = 0; i < dir->child_count; i++) { + if (ntfs_dir_commit (dir->children[i]) < 0) + return -1; + } + + return 0; +} + +/** + * ntfs_dir_rollback + */ +static int ntfs_dir_rollback (struct ntfs_dir *dir) +{ + int i; + + if (!dir) + return -1; + + if (ntfs_dt_rollback (dir->index) < 0) + return -1; + + if (ntfs_bmp_rollback (dir->bitmap) < 0) + return -1; + + for (i = 0; i < dir->child_count; i++) { + if (ntfs_dir_rollback (dir->children[i]) < 0) + return -1; + } + + return 0; +} + /** * ntfs_dir_free */ @@ -1798,6 +1908,8 @@ static void ntfs_dir_free (struct ntfs_dir *dir) if (!dir) return; + ntfs_dir_rollback (dir); + parent = dir->parent; if (parent) { for (i = 0; i < parent->child_count; i++) { @@ -1809,16 +1921,16 @@ static void ntfs_dir_free (struct ntfs_dir *dir) ntfs_attr_close (dir->iroot); ntfs_attr_close (dir->ialloc); - ntfs_attr_close (dir->ibmp); ntfs_inode_close2 (dir->inode); - ntfs_dt_free (dir->index); + ntfs_dt_free (dir->index); + ntfs_bmp_free (dir->bitmap); for (i = 0; i < dir->child_count; i++) ntfs_dir_free (dir->children[i]); - free (dir->children); - free (dir); + ntfs_free (dir->children); + ntfs_free (dir); } /** @@ -1839,7 +1951,7 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) if (!inode) return NULL; - dir = calloc (1, sizeof (*dir)); + dir = ntfs_calloc (1, sizeof (*dir)); if (!dir) { ntfs_inode_close2 (inode); return NULL; @@ -1848,7 +1960,6 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) dir->inode = inode; dir->iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); dir->ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); - dir->ibmp = ntfs_attr_open (inode, AT_BITMAP, I30, 4); dir->vol = vol; dir->parent = NULL; @@ -1858,7 +1969,9 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) dir->children = NULL; dir->child_count = 0; dir->mft_num = mft_num; - dir->bitmap = NULL; + + // This may not exist + dir->bitmap = ntfs_bmp_alloc (inode, AT_BITMAP, I30, 4); if (dir->ialloc) { rec = find_first_attribute (AT_INDEX_ROOT, inode->mrec); @@ -1886,7 +1999,7 @@ static void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) parent->child_count++; //printf ("child count = %d\n", parent->child_count); - parent->children = realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); + parent->children = ntfs_realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); child->parent = parent; parent->children[parent->child_count-1] = child; @@ -1916,7 +2029,7 @@ static MFT_REF ntfs_dir_find (struct ntfs_dir *dir, char *name) //printf ("uname = %p\n", uname); mft_num = ntfs_dt_find (dir->index, uname, len); - free (uname); + ntfs_free (uname); return mft_num; } @@ -1961,6 +2074,9 @@ static struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, i mft_num = ie->indexed_file; child = ntfs_dir_alloc (dir->vol, mft_num); + if (!child) + return NULL; + child->index = ntfs_dt_alloc (child, NULL, -1); ntfs_dir_add (dir, child); @@ -1969,49 +2085,107 @@ static struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, i } /** - * ntfs_dir_commit + * ntfs_dir_truncate */ -static int ntfs_dir_commit (struct ntfs_dir *dir) +static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) { - if (!dir) + int i; + u8 *buffer; + + if (!vol || !dir) return -1; - if (0) ntfs_dt_commit (NULL); - if (0) ntfs_bmp_commit (NULL); + if ((dir->ialloc == NULL) || (dir->bitmap == NULL)) + return 0; + +#if 0 + printf ("alloc = %lld bytes\n", dir->ialloc->allocated_size); + printf ("alloc = %lld clusters\n", dir->ialloc->allocated_size >> vol->cluster_size_bits); + printf ("bitmap bytes 0 to %lld\n", ((dir->ialloc->allocated_size >> vol->cluster_size_bits)-1)>>3); + printf ("bitmap = %p\n", dir->bitmap); + printf ("bitmap = %lld bytes\n", dir->bitmap->attr->allocated_size); +#endif + + buffer = ntfs_bmp_get_data (dir->bitmap, 0); + if (!buffer) + return -1; + + utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); + for (i = 0; i < 1; i++) { + if (buffer[i]) { + //printf ("alloc in use\n"); + return 0; + } + } + + // /$BITMAP($I30) + // /$INDEX_ALLOCATION($I30) + // $Bitmap + + // Find the highest set bit in the directory bitmap + // can we free any clusters of the alloc? + // if yes, resize attribute + + return 0; +} + + +/** + * utils_volume_commit + */ +static int utils_volume_commit (ntfs_volume *vol) +{ + if (!vol) + return -1; + + printf ("commit volume\n"); + if (ntfs_bmp_commit (vol, vol->private_bmp1) < 0) + return -1; + + if (ntfs_bmp_commit (vol, vol->private_bmp2) < 0) + return -1; + + if (ntfs_dir_commit (vol->private_data) < 0) + return -1; return 0; } /** - * ntfs_dir_rollback + * utils_volume_rollback */ -static int ntfs_dir_rollback (struct ntfs_dir *dir) +static int utils_volume_rollback (ntfs_volume *vol) { - if (!dir) + if (!vol) return -1; - if (0) ntfs_dt_rollback (NULL); - if (0) ntfs_bmp_rollback (NULL); + if (ntfs_bmp_rollback (vol->private_bmp1) < 0) + return -1; + + if (ntfs_bmp_rollback (vol->private_bmp2) < 0) + return -1; + + if (ntfs_dir_rollback (vol->private_data) < 0) + return -1; return 0; } - /** * ntfs_umount2 */ static int ntfs_umount2 (ntfs_volume *vol, const BOOL force) { - struct ntfs_dt *dt; + struct ntfs_dir *dir; if (!vol) return 0; - dt = (struct ntfs_dt *) vol->private_data; - if (dt) { - vol->private_data = NULL; - ntfs_dir_free (dt->dir); - } + utils_volume_rollback (vol); + + dir = (struct ntfs_dir *) vol->private_data; + vol->private_data = NULL; + ntfs_dir_free (dir); return ntfs_umount (vol, force); } @@ -2021,6 +2195,7 @@ static int ntfs_umount2 (ntfs_volume *vol, const BOOL force) */ static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flags, BOOL force) { + // XXX can we replace these and search by mft number? Hmm... NO. static ntfschar bmp[8] = { const_cpu_to_le16('$'), const_cpu_to_le16('B'), @@ -2058,7 +2233,6 @@ static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flag }; ntfs_volume *vol; - ntfs_inode *ni; struct ntfs_dir *dir; struct ntfs_dt *root; struct ntfs_dt *found; @@ -2126,30 +2300,30 @@ static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flag vol->mftmirr_ni->private_data = found->dir; found->inodes[num] = vol->mftmirr_ni; - ni = ntfs_inode_open (vol, FILE_root); - if (!ni) { - printf ("can't find root dir\n"); - ntfs_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - // root directory num = -1; found = ntfs_dt_find2 (root, dot, 1, &num); if ((!found) || (num < 0)) { printf ("can't find the root directory\n"); - ntfs_inode_close (ni); ntfs_umount2 (vol, FALSE); vol = NULL; goto done; } - - dir->inode = ni; - vol->private_data = found; - ni->private_data = found; - found->inodes[num] = ni; - ni->ref_count = 2; + + vol->private_data = found->dir; + found->inodes[num] = dir->inode; + dir->inode->private_data = found; + dir->inode->ref_count = 2; + + vol->private_bmp1 = ntfs_bmp_alloc (vol->mft_ni, AT_BITMAP, NULL, 0); + vol->private_bmp2 = ntfs_bmp_alloc (vol->lcnbmp_ni, AT_DATA, NULL, 0); + + if (!vol->private_bmp1 || !vol->private_bmp2) { + printf ("can't find the bitmaps\n"); + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } done: return vol; @@ -2218,7 +2392,7 @@ static MFT_REF utils_pathname_to_mftref (ntfs_volume *vol, struct ntfs_dir *pare } close: - free (ascii); + free (ascii); // from strdup return result; } @@ -2361,12 +2535,14 @@ static int utils_mftrec_mark_free5 (ntfs_inode *inode, struct ntfs_bmp *bmp, MFT rec = (MFT_RECORD*) inode->mrec; + // XXX extent inodes? if ((rec->flags & MFT_RECORD_IN_USE) == 0) { Eprintf ("MFT record isn't in use (4).\n"); return -1; } rec->flags &= ~MFT_RECORD_IN_USE; + NInoSetDirty(inode); //printf ("\n"); //utils_dump_mem (buffer, 0, 1024, DM_DEFAULTS); @@ -2473,6 +2649,7 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, struct ntfs_dir *dir = NULL; struct ntfs_dir *child = NULL; struct ntfs_dt *dt = NULL; + int dt_num; BOOL result = FALSE; if (!vol || !pathname || !found) { @@ -2485,16 +2662,14 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, if (parent) { dir = parent; } else { - dt = (struct ntfs_dt *) vol->private_data; - if (dt) - dir = dt->dir; + dir = (struct ntfs_dir *) vol->private_data; if (!dir) { Eprintf ("Couldn't open the inode of the root directory.\n"); goto close; } } - unicode = malloc (MAX_PATH * sizeof (ntfschar)); + unicode = ntfs_malloc (MAX_PATH * sizeof (ntfschar)); ascii = strdup (pathname); // Work with a r/w copy if (!unicode || !ascii) { Eprintf ("Out of memory.\n"); @@ -2525,7 +2700,22 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, break; } } else { - printf ("file: %s\n", p); + //printf ("file: %s\n", p); + + dt = ntfs_dt_find2 (dir->index, unicode, len, &dt_num); + + if (dt->inodes[dt_num] == NULL) { + dt->inodes[dt_num] = ntfs_inode_open (dir->vol, dt->children[dt_num]->indexed_file); + if (!dt->inodes[dt_num]) { + printf ("Can't open inode %lld\n", dt->children[dt_num]->indexed_file); + goto close; + } + dt->inodes[dt_num]->ref_count = 2; + dt->inodes[dt_num]->private_data = dt; + } + + //printf ("dt = %p,%d\n", dt, dt_num); + break; } @@ -2536,11 +2726,16 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, p++; } - found->dir = dir; + found->dir = dir; + found->dt = dt; + found->dt_index = dt_num; + found->inode = dt->inodes[dt_num]; + found->mref = found->inode->mft_no; result = TRUE; + //printf ("dir %p, dt %p, num %d, ino %p, %lld\n", dir, dt, dt_num, dt->inodes[dt_num], MREF (found->inode->mft_no)); close: - free (ascii); - free (unicode); + free (ascii); // from strdup + ntfs_free (unicode); return result; } @@ -2564,6 +2759,8 @@ static int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfscha MFT_RECORD *mrec = NULL; int res = -1; + // XXX only works when attr is in base inode + if ((!inode) || (!inode->mrec)) return -1; if ((!data) || (data_len < 0)) @@ -2673,7 +2870,7 @@ static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY * //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); //printf ("\n"); - attr = malloc (del->data_len + suc_ie->length - del_ie->length); + attr = ntfs_malloc (del->data_len + suc_ie->length - del_ie->length); dst = attr; src = del->data; @@ -2697,7 +2894,7 @@ static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY * dst = attr; len = del->data_len + suc_ie->length - del_ie->length; - free (del->data); + ntfs_free (del->data); del->data = attr; del->data_len = len; @@ -2727,6 +2924,8 @@ static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY * //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); //printf ("\n"); + del->changed = TRUE; + printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); return TRUE; } @@ -2787,6 +2986,8 @@ static BOOL ntfs_dt_alloc_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + del->changed = TRUE; + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); return TRUE; } @@ -2851,7 +3052,7 @@ static BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); old = del->data; - del->data = realloc (del->data, del->data_len); + del->data = ntfs_realloc (del->data, del->data_len); del->header = (INDEX_HEADER*) (del->data + 0x10); del->header->index_length -= del_len; @@ -2910,6 +3111,7 @@ static BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) //utils_dump_mem (del->data, 0, del->header->index_length+16, DM_DEFAULTS); del->changed = TRUE; + printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); return TRUE; } @@ -3025,6 +3227,7 @@ static BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) #endif del->changed = TRUE; + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); return TRUE; } @@ -3067,7 +3270,7 @@ static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) return 0; } - attr = malloc (add->data_len + need); + attr = ntfs_malloc (add->data_len + need); src = add->data; dst = attr; @@ -3087,7 +3290,7 @@ static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) memcpy (dst, src, len); - free (add->data); + ntfs_free (add->data); add->data = attr; add->data_len += need; @@ -3099,6 +3302,8 @@ static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); //printf ("\n"); + add->changed = TRUE; + printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, add->dir->inode->mft_no); return 0; } @@ -3165,6 +3370,8 @@ static int ntfs_dt_alloc_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); //printf ("\n"); + add->changed = TRUE; + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, add->dir->inode->mft_no, add->vcn, add->vcn + (add->dir->index_size>>9) - 1); return 0; } @@ -3234,9 +3441,9 @@ static int ntfs_dt_remove_alloc (struct ntfs_dt *dt, int index_num) } } - free (dt->sub_nodes); + ntfs_free (dt->sub_nodes); dt->sub_nodes = NULL; - free (dt->children); + ntfs_free (dt->children); dt->children = NULL; dt->child_count = 0; @@ -3337,7 +3544,7 @@ static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) ir->index.allocated_size = dt->data_len - 16; ntfs_mft_resize_resident (dt->dir->inode, AT_INDEX_ROOT, I30, 4, dt->data, dt->data_len); - dt->data = realloc (dt->data, dt->data_len); + dt->data = ntfs_realloc (dt->data, dt->data_len); //printf ("ih->index_length = %d\n", ir->index.index_length); //printf ("ih->allocated_size = %d\n", ir->index.allocated_size); @@ -3353,9 +3560,9 @@ static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) } } - free (dt->sub_nodes); + ntfs_free (dt->sub_nodes); dt->sub_nodes = NULL; - free (dt->children); + ntfs_free (dt->children); dt->children = NULL; dt->child_count = 0; @@ -3651,7 +3858,7 @@ static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY return 0; } - attr = malloc (parent->data_len + need); + attr = ntfs_malloc (parent->data_len + need); src = parent->data; dst = attr; @@ -3671,7 +3878,7 @@ static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY memcpy (dst, src, len); - free (parent->data); + ntfs_free (parent->data); parent->data = attr; parent->data_len += need; @@ -3950,7 +4157,7 @@ static int ntfsrm (ntfs_volume *vol, char *name) ntfs_dt_del_child (finddir->index, uname, len); ntfs_dir_free (dir); - free (uname); + ntfs_free (uname); return 0; } @@ -4096,7 +4303,7 @@ static int ntfs_file_add (ntfs_volume *vol, char *name) if (!ie) goto done; - free (uname); + ntfs_free (uname); uname = NULL; len = ntfs_mbstoucs ("file26a", &uname, 0); @@ -4122,31 +4329,24 @@ static int ntfs_file_add (ntfs_volume *vol, char *name) done: ntfs_dir_free (dir); - free (uname); - free (ie); + ntfs_free (uname); + ntfs_free (ie); return 0; } /** * ntfs_file_remove */ -static int ntfs_file_remove (ntfs_volume *vol, char *name) +static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) { - // XXX work with inode - lookup name outside? - // how do I do the inode -> dt lookup? - - struct ntfs_dir *root_dir = NULL; struct ntfs_dir *find_dir = NULL; struct ntfs_dt *top = NULL; - struct ntfs_dt *del = NULL; struct ntfs_dt *suc = NULL; struct ntfs_dt *old = NULL; struct ntfs_dt *par = NULL; struct ntfs_dt *ded = NULL; - MFT_REF mft_num; - ntfschar *uname = NULL; + ntfschar *uname; int name_len; - int del_num = 0; int suc_num = 0; int par_num = -1; INDEX_ENTRY *del_ie = NULL; @@ -4158,35 +4358,17 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) FILE_NAME_ATTR *file = NULL; //int i; - root_dir = ntfs_dir_alloc (vol, FILE_root); - if (!root_dir) + if (!vol || !del) { return 1; - - mft_num = utils_pathname_to_mftref (vol, root_dir, name, &find_dir); - // XXX mft_num not used - - if (!find_dir) { - printf ("Couldn't find the index entry for %s\n", name); - goto done; } - //ntfs_dt_print (find_dir->index, 0); + find_dir = del->dir; - if (rindex (name, PATH_SEP)) - name = rindex (name, PATH_SEP) + 1; - - name_len = ntfs_mbstoucs (name, &uname, 0); - if (name_len < 0) - goto done; - - del = ntfs_dt_find2 (find_dir->index, uname, name_len, &del_num); - if (!del) { - printf ("can't find item to delete\n"); - goto done; - } + uname = del->children[del_num]->key.file_name.file_name; + name_len = del->children[del_num]->key.file_name.file_name_length; top = del->dir->index; - ntfs_dt_find_all (top); + //ntfs_dt_find_all (top); //ntfs_dt_print (top, 0); del_ie = del->children[del_num]; @@ -4235,7 +4417,7 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) //printf ("\n"); //utils_dump_mem (del->data, 0, del->data_len, DM_BLUE|DM_GREEN|DM_INDENT); - free (suc_ie); + ntfs_free (suc_ie); if (res == FALSE) goto done; @@ -4421,12 +4603,10 @@ static int ntfs_file_remove (ntfs_volume *vol, char *name) // XXX attach bmp to dir and volume // XXX attach root dir to volume // XXX add freed dts to a list for immediate reuse (attach to dir?) + // XXX any ded dts means we may need to adjust alloc // XXX commit will free list of spare dts // XXX reduce size of alloc - if (0) ntfs_dir_commit (find_dir); - if (0) ntfs_dir_rollback (find_dir); - printf ("empty\n"); goto done; @@ -4436,19 +4616,44 @@ commit: printf ("commit\n"); done: - ntfs_dir_free (root_dir); - free (uname); return 0; } /** * ntfs_file_remove2 */ -static int ntfs_file_remove2 (ntfs_volume *vol, char *name) +static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) { - if (0) utils_mftrec_mark_free5 (NULL, NULL, 0); + INDEX_ENTRY *ie; + ntfs_inode *ino; + struct ntfs_bmp *bmp_mft; + struct ntfs_bmp *bmp_vol; + struct ntfs_dir *dir; - return ntfs_file_remove (vol, name); + if (!vol || !dt) + return -1; + + ie = dt->children[dt_num]; + ino = dt->inodes[dt_num]; + dir = dt->dir; + + bmp_mft = (struct ntfs_bmp *) vol->private_bmp1; + bmp_vol = (struct ntfs_bmp *) vol->private_bmp2; + + utils_mftrec_mark_free5 (ino, bmp_mft, ie->indexed_file); + + utils_free_non_residents2 (ino, bmp_vol); + + ntfs_file_remove (vol, dt, dt_num); + + ntfs_dir_truncate (vol, dir); + + //commit volume + utils_volume_commit (vol); + + if (0) utils_volume_rollback (vol); + + return 0; } /** @@ -4534,7 +4739,7 @@ int main (int argc, char *argv[]) if (0) result = ntfsrm (vol, opts.file); if (0) result = ntfs_ie_test(); if (0) result = ntfs_file_add (vol, opts.file); - if (0) result = ntfs_file_remove2 (vol, opts.file); + if (1) result = ntfs_file_remove2 (vol, find.dt, find.dt_index); if (0) result = ntfs_test_bmp (vol, inode); done: @@ -4543,3 +4748,4 @@ done: return result; } + From ff87d56b5894381c3bb0bb3b914f8ea17e58a413 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 20 Aug 2004 17:27:24 +0000 Subject: [PATCH 1752/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/19 23:37:18+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/18 20:00:16+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/18 19:59:43+01:00 flatcap.org!ntfs ntfsrm: track memory usage 2004/08/18 19:58:56+01:00 flatcap.org!ntfs ntfsrm: commit/rollback started 2004/08/18 08:39:07+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/16 13:31:29+01:00 flatcap.org!ntfs Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfs.rm 2004/08/15 23:53:29+01:00 flatcap.org!ntfs ntfsrm: start reassembling 2004/08/15 23:04:56+01:00 flatcap.org!ntfs ntfsrm: change the owner of the bitmaps 2004/08/15 21:12:16+01:00 flatcap.org!ntfs ntfsrm: point vol at root directory 2004/08/15 18:32:36+01:00 flatcap.org!ntfs ntfsrm: fix memory leak 2004/08/14 17:03:02+01:00 flatcap.org!ntfs ntfsrm: extract file details from dir tree BKrev: 4126347cjrtb560Fkeux8OVIk4pQfg From 6de75e1f2b5235e421047e09cae967a320e2ef2e Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Fri, 20 Aug 2004 17:27:24 +0000 Subject: [PATCH 1753/2994] keep track of $Bitmap and $MFT/$BITMAP (Logical change 1.512) --- include/ntfs/volume.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 97e111ef..d78736d8 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -170,6 +170,8 @@ struct _ntfs_volume { bytes. */ void *private_data; /* Temp: for directory handling */ + void *private_bmp1; + void *private_bmp2; }; extern ntfs_volume *ntfs_volume_alloc(void); From 5a4b6c9eaaad23d3746196e17e771ba83d54b404 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 17:50:58 +0000 Subject: [PATCH 1754/2994] Refactor ntfsdump_logfile.c: split main() into multiple functions. (Logical change 1.513) --- ntfsprogs/ntfsdump_logfile.c | 681 +++++++++++++++++++++-------------- 1 file changed, 418 insertions(+), 263 deletions(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 915514d6..205711db 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -22,6 +22,13 @@ * in the file COPYING); if not, write to the Free Software Foundation, * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* TODO: + * - Remove the need for clipping at 64MiB. + * - Add normal command line switchs (use getopt_long()). + * - For a volume: allow dumping only uncommited records. + * - For a file: get an optional command line parameter for the last SN. + * - Sanity checks. + */ #include "config.h" @@ -43,14 +50,61 @@ #include "layout.h" #include "logfile.h" #include "mst.h" +#include "utils.h" + +typedef struct { + BOOL is_volume; + const char *filename; + s64 data_size; + union { + struct { + ntfs_volume *vol; + ntfs_inode *ni; + ntfs_attr *na; + }; + struct { + int fd; + }; + }; +} logfile_file; + +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) /** - * device_err_exit - + * logfile_close */ -void device_err_exit(char *dev_name, ntfs_volume *vol, ntfs_inode *ni, +static int logfile_close(logfile_file *logfile) +{ + if (logfile->is_volume) { + if (logfile->na) + ntfs_attr_close(logfile->na); + if (logfile->ni && ntfs_inode_close(logfile->ni)) + Eprintf("Warning: Failed to close $LogFile (inode %i):" + " %s\n", FILE_LogFile, strerror(errno)); + if (ntfs_umount(logfile->vol, 0)) + Eprintf("Warning: Failed to umount %s: %s\n", + logfile->filename, strerror(errno)); + } else { + if (close(logfile->fd)) + Eprintf("Warning: Failed to close file %s: %s\n", + logfile->filename, strerror(errno)); + } + return 0; +} + +/** + * device_err_exit - put an error message, cleanup and exit. + * @vol: volume to unmount. + * @ni: Inode to free. + * @na: Attribute to close. + * + * Use when you wish to exit and collate all the cleanups together. + * if you don't have some parameter to pass, just pass NULL. + */ +void device_err_exit(ntfs_volume *vol, ntfs_inode *ni, ntfs_attr *na, const char *fmt, ...) __attribute__ ((noreturn)) - __attribute__((format(printf, 5, 6))); -void device_err_exit(char *dev_name, ntfs_volume *vol, ntfs_inode *ni, + __attribute__ ((format(printf, 4, 5))); +void device_err_exit(ntfs_volume *vol, ntfs_inode *ni, ntfs_attr *na, const char *fmt, ...) { va_list ap; @@ -58,16 +112,17 @@ void device_err_exit(char *dev_name, ntfs_volume *vol, ntfs_inode *ni, if (na) ntfs_attr_close(na); if (ni && ntfs_inode_close(ni)) - fprintf(stderr, "Warning: Failed to close $LogFile (inode " - "%i): %s\n", FILE_LogFile, strerror(errno)); + Eprintf("Warning: Failed to close $LogFile (inode %i): %s\n", + FILE_LogFile, strerror(errno)); if (ntfs_umount(vol, 0)) - fprintf(stderr, "Warning: Failed to umount %s: %s\n", - dev_name, strerror(errno)); + Eprintf("Warning: Failed to umount: %s\n", strerror(errno)); + fprintf(stderr, "ERROR: "); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); - fprintf(stderr, "Aborting...\n"); + + Eprintf("Aborting...\n"); exit(1); } @@ -82,11 +137,13 @@ void log_err_exit(u8 *buf, const char *fmt, ...) if (buf) free(buf); + fprintf(stderr, "ERROR: "); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); - fprintf(stderr, "Aborting...\n"); + + Eprintf("Aborting...\n"); exit(1); } @@ -96,180 +153,122 @@ void log_err_exit(u8 *buf, const char *fmt, ...) void usage(const char *exec_name) __attribute__ ((noreturn)); void usage(const char *exec_name) { - fprintf(stderr, "%s v%s - Interpret and display information about the " - "journal\n($LogFile) of an NTFS volume.\n" - "Copyright (c) 2000-2004 Anton Altaparmakov.\n" - "%s is free software, released under the GNU General " - "Public License\nand you are welcome to redistribute " - "it under certain conditions.\n%s comes with " - "ABSOLUTELY NO WARRANTY; for details read the GNU\n" - "General Public License to be found in the file " - "COPYING in the main Linux-NTFS\ndistribution " - "directory.\nUsage: %s device\n e.g. %s /dev/hda6\n" - "Alternative usage: %s -f file\n e.g. %s -f " - "MyCopyOfTheLogFile\n", exec_name, VERSION, exec_name, - exec_name, exec_name, exec_name, exec_name, exec_name); + Eprintf("%s v%s - Interpret and display information about the " + "journal\n($LogFile) of an NTFS volume.\n" + "Copyright (c) 2000-2004 Anton Altaparmakov.\n" + "%s is free software, released under the GNU General " + "Public License\nand you are welcome to redistribute " + "it under certain conditions.\n%s comes with " + "ABSOLUTELY NO WARRANTY; for details read the GNU\n" + "General Public License to be found in the file " + "COPYING in the main Linux-NTFS\ndistribution " + "directory.\nUsage: %s device\n e.g. %s /dev/hda6\n" + "Alternative usage: %s -f file\n e.g. %s -f " + "MyCopyOfTheLogFile\n", exec_name, VERSION, exec_name, + exec_name, exec_name, exec_name, exec_name, exec_name); exit(1); } /** - * main - + * logfile_open */ -int main(int argc, char **argv) +static int logfile_open(BOOL is_volume, const char *filename, + logfile_file *logfile) { - u8 *buf; - RESTART_PAGE_HEADER *rstr; - RESTART_AREA *ra; - LOG_CLIENT_RECORD *lcr; - RECORD_PAGE_HEADER *rcrd; - LOG_RECORD *lr; - int buf_size, err, client, pass = 1; - unsigned int page_size, usa_end_ofs, i; - - printf("\n"); - if (argc < 2 || argc > 3) - usage(argv[0]); - /* - * If one argument, it is a device containing an NTFS volume which we - * need to mount and read the $LogFile from so we can dump its contents. - * - * If two arguments the first one must be "-f" and the second one is - * the path and name of the $LogFile (or copy thereof) which we need to - * read and dump the contents of. - */ - if (argc == 2) { - s64 br; + if (is_volume) { ntfs_volume *vol; ntfs_inode *ni; ntfs_attr *na; - vol = ntfs_mount(argv[1], MS_RDONLY); + vol = ntfs_mount(filename, MS_RDONLY); if (!vol) - log_err_exit(NULL, "Failed to mount %s: %s\n", argv[1], - strerror(errno)); - printf("\nMounted NTFS volume %s (NTFS v%i.%i) on device %s.\n", + log_err_exit(NULL, "Failed to mount %s: %s\n", + filename, strerror(errno)); + printf("Mounted NTFS volume %s (NTFS v%i.%i) on device %s.\n", vol->vol_name ? vol->vol_name : "", - vol->major_ver, vol->minor_ver, argv[1]); + vol->major_ver, vol->minor_ver, filename); if (ntfs_version_is_supported(vol)) - device_err_exit(argv[1], vol, NULL, NULL, + device_err_exit(vol, NULL, NULL, "Unsupported NTFS version.\n"); ni = ntfs_inode_open(vol, FILE_LogFile); if (!ni) - device_err_exit(argv[1], vol, NULL, NULL, "Failed to " + device_err_exit(vol, NULL, NULL, "Failed to " "open $LogFile (inode %i): %s\n", FILE_LogFile, strerror(errno)); na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); if (!na) - device_err_exit(argv[1], vol, ni, NULL, "Failed to " - "open $LogFile/$DATA (attribute " - "0x%x): %s\n", - (unsigned int)le32_to_cpu(AT_DATA), - strerror(errno)); + device_err_exit(vol, ni, NULL, "Failed to open " + "$LogFile/$DATA (attribute 0x%x):" + " %s\n", (unsigned int) + le32_to_cpu(AT_DATA), strerror(errno)); if (!na->data_size) - device_err_exit(argv[1], vol, ni, na, "$LogFile has " - "zero length. Run chkdsk /f to " - "correct this.\n"); - if (na->data_size <= 64 * 1024 * 1024) - buf_size = na->data_size; - else { - fprintf(stderr, "Warning: $LogFile is too big. Only " - "analysing the first 64MiB.\n"); - buf_size = 64 * 1024 * 1024; - } - /* For simplicity we read all of $LogFile/$DATA into memory. */ - buf = malloc(buf_size); - if (!buf) - device_err_exit(argv[1], vol, ni, na, "Failed to " - "allocate buffer for $LogFile/$DATA: " - "%s", strerror(errno)); - br = ntfs_attr_pread(na, 0, buf_size, buf); - if (br != buf_size) { - free(buf); - device_err_exit(argv[1], vol, ni, na, "Failed to read " - "$LogFile/$DATA: %s", br < 0 ? - strerror(errno) : "Partial read."); - } - ntfs_attr_close(na); - if (ntfs_inode_close(ni)) - fprintf(stderr, "Warning: Failed to close $LogFile " - "(inode %i): %s\n", FILE_LogFile, - strerror(errno)); - if (ntfs_umount(vol, 0)) - fprintf(stderr, "Warning: Failed to umount %s: %s\n", - argv[1], strerror(errno)); - } else /* if (argc == 3) */ { - ssize_t br; - int fd; + device_err_exit(vol, ni, na, "$LogFile has zero " + "length. Run chkdsk /f to correct " + "this.\n"); + logfile->data_size = na->data_size; + logfile->vol = vol; + logfile->ni = ni; + logfile->na = na; + } else { struct stat sbuf; + int fd; - if (strncmp(argv[1], "-f", strlen("-f"))) - usage(argv[0]); - if (stat(argv[2], &sbuf) == -1) { + if (stat(filename, &sbuf) == -1) { if (errno == ENOENT) log_err_exit(NULL, "The file %s does not " "exist. Did you specify it " - "correctly?\n", argv[2]); + "correctly?\n", filename); log_err_exit(NULL, "Error getting information about " - "%s: %s\n", argv[2], strerror(errno)); + "%s: %s\n", filename, strerror(errno)); } - if (sbuf.st_size <= 64 * 1024 * 1024) - buf_size = sbuf.st_size; - else { - fprintf(stderr, "Warning: File %s is too big. Only " - "analysing the first 64MiB.\n", - argv[2]); - buf_size = 64 * 1024 * 1024; - } - /* For simplicity we read all of the file into memory. */ - buf = malloc(buf_size); - if (!buf) - log_err_exit(NULL, "Failed to allocate buffer for " - "file data: %s", strerror(errno)); - fd = open(argv[2], O_RDONLY); + + fd = open(filename, O_RDONLY); if (fd == -1) log_err_exit(NULL, "Failed to open file %s: %s\n", - argv[2], strerror(errno)); - /* Read in the file into the buffer. */ - br = read(fd, buf, buf_size); - err = errno; - if (close(fd)) - fprintf(stderr, "Warning: Failed to close file %s: " - "%s\n", argv[2], strerror(errno)); - if (br != buf_size) - log_err_exit(buf, "Failed to read data from %s: %s", - argv[2], br < 0 ? strerror(err) : - "Partial read."); + filename, strerror(errno)); + logfile->data_size = sbuf.st_size; + logfile->fd = fd; } - /* - * We now have the entirety of the journal ($LogFile/$DATA or argv[2]) - * in the memory buffer buf and this has a size of buf_size. Note we - * apply a size capping at 64MiB, so if the journal is any bigger we - * only have the first 64MiB. This should not be a problem as I have - * never seen such a large $LogFile. Usually it is only a few MiB in - * size. - */ - rstr = (RESTART_PAGE_HEADER*)buf; - /* Check for presence of restart area signature. */ - if (!ntfs_is_rstr_record(rstr->magic) && - !ntfs_is_chkd_record(rstr->magic)) { - s8 *pos = (s8*)buf; - s8 *end = pos + buf_size; - while (pos < end && *pos == -1) - pos++; - if (pos != end) - log_err_exit(buf, "$LogFile contents are corrupt " - "(magic RSTR is missing). Cannot " - "handle this yet.\n"); - /* All bytes are -1. */ - free(buf); - puts("$LogFile is not initialized."); - return 0; + + logfile->is_volume = is_volume; + logfile->filename = filename; + + return 0; +} + +/** + * logfile_read + */ +static int logfile_pread(logfile_file *logfile, int ofs, int count, u8 *buf) +{ + int br; + + if (logfile->is_volume) { + br = (int)ntfs_attr_pread(logfile->na, ofs, count, buf); + } else { + if (lseek(logfile->fd, ofs, SEEK_SET)==-1) { + Eprintf("Could not seek to offset %u\n", ofs); + return 0; + } + br = read(logfile->fd, buf, count); } - /* - * First, verify the restart page header for consistency. - */ + if (br != count) { + Eprintf("Only %d out of %d bytes read starting at %d\n", + br, count, ofs); + } + return br; +} + +/** + * restart_header_sanity() + */ +static void restart_header_sanity(RESTART_PAGE_HEADER *rstr, u8 *buf) +{ + unsigned int usa_end_ofs, page_size; + /* Only CHKD records are allowed to have chkdsk_lsn set. */ - if (!ntfs_is_chkd_record(rstr->magic) && sle64_to_cpu(rstr->chkdsk_lsn)) + if (!ntfs_is_chkd_record(rstr->magic) && + sle64_to_cpu(rstr->chkdsk_lsn)) log_err_exit(buf, "$LogFile is corrupt: Restart page header " "magic is not CHKD but a chkdsk LSN is " "specified. Cannot handle this yet.\n"); @@ -321,68 +320,10 @@ int main(int argc, char **argv) "corrupt: Restart area offset is not aligned " "to 8-byte boundary. Cannot handle this " "yet.\n"); - /* - * Second, verify the restart area itself. - */ - // TODO: Implement this. - fprintf(stderr, "Warning: Sanity checking of restart area not " - "implemented yet.\n"); - /* - * Third and last, verify the array of log client records. - */ - // TODO: Implement this. - fprintf(stderr, "Warning: Sanity checking of array of log client " - "records not implemented yet.\n"); -rstr_pass_loc: - if (ntfs_is_chkd_record(rstr->magic)) - log_err_exit(buf, "The %s restart page header in $LogFile has " - "been modified by chkdsk. Do not know how to " - "handle this yet. Reboot into Windows to fix " - "this.\n", (u8*)rstr == buf ? "first" : - "second"); - if (ntfs_mst_post_read_fixup((NTFS_RECORD*)rstr, page_size) || - ntfs_is_baad_record(rstr->magic)) - log_err_exit(buf, "$LogFile incomplete multi sector transfer " - "detected in restart page header. Cannot " - "handle this yet.\n"); - if (pass == 1) - printf("$LogFile version %i.%i.\n", - sle16_to_cpu(rstr->major_ver), - sle16_to_cpu(rstr->minor_ver)); - else /* if (pass == 2) */ { - /* - * rstr is now the second restart page so we declare rstr1 - * as the first restart page as this one has been verified in - * the first pass so we can use all its members safely. - */ - RESTART_PAGE_HEADER *rstr1 = (RESTART_PAGE_HEADER*)buf; +} - /* Exclude the usa from the comparison. */ - ra = (RESTART_AREA*)((u8*)rstr1 + - le16_to_cpu(rstr1->restart_offset)); - if (!memcmp(rstr1, rstr, le16_to_cpu(rstr1->usa_ofs)) && - !memcmp((u8*)rstr1 + le16_to_cpu( - rstr1->restart_offset), (u8*)rstr + - le16_to_cpu(rstr->restart_offset), - le16_to_cpu(ra->restart_area_length))) { - puts("\nSkipping analysis of second restart page " - "because it fully matches the first " - "one."); - goto skip_rstr_pass; - } - /* - * The $LogFile versions specified in each of the two restart - * page headers must match. - */ - if (rstr1->major_ver != rstr->major_ver || - rstr1->minor_ver != rstr->minor_ver) - log_err_exit(buf, "Second restart area specifies " - "different $LogFile version to first " - "restart area. Cannot handle this " - "yet.\n"); - } - /* The restart page header is in rstr and it is mst deprotected. */ - printf("\n%s restart page:\n", pass == 1 ? "1st" : "2nd"); +static void dump_restart_areas_header(RESTART_PAGE_HEADER *rstr) +{ printf("\nRestart page header:\n"); printf("magic = %s\n", ntfs_is_rstr_record(rstr->magic) ? "RSTR" : "CHKD"); @@ -402,7 +343,14 @@ rstr_pass_loc: printf("restart_offset = %u (0x%x)\n", le16_to_cpu(rstr->restart_offset), le16_to_cpu(rstr->restart_offset)); - printf("\nRestart area:\n"); +} + +static void dump_restart_areas_area(RESTART_PAGE_HEADER *rstr) +{ + LOG_CLIENT_RECORD *lcr; + RESTART_AREA *ra; + int client; + ra = (RESTART_AREA*)((u8*)rstr + le16_to_cpu(rstr->restart_offset)); printf("current_lsn = %lli (0x%llx)\n", (long long)sle64_to_cpu(ra->current_lsn), @@ -481,55 +429,89 @@ rstr_pass_loc: */ lcr++; } +} + +/** + * dump_restart_areas() + */ +static void *dump_restart_areas(RESTART_PAGE_HEADER *rstr, u8 *buf, + unsigned int page_size) +{ + int pass = 1; + +rstr_pass_loc: + if (ntfs_is_chkd_record(rstr->magic)) + log_err_exit(buf, "The %s restart page header in $LogFile has " + "been modified by chkdsk. Do not know how to " + "handle this yet. Reboot into Windows to fix " + "this.\n", (u8*)rstr == buf ? "first" : + "second"); + if (ntfs_mst_post_read_fixup((NTFS_RECORD*)rstr, page_size) || + ntfs_is_baad_record(rstr->magic)) + log_err_exit(buf, "$LogFile incomplete multi sector transfer " + "detected in restart page header. Cannot " + "handle this yet.\n"); + if (pass == 1) + printf("$LogFile version %i.%i.\n", + sle16_to_cpu(rstr->major_ver), + sle16_to_cpu(rstr->minor_ver)); + else /* if (pass == 2) */ { + RESTART_AREA *ra; + + /* + * rstr is now the second restart page so we declare rstr1 + * as the first restart page as this one has been verified in + * the first pass so we can use all its members safely. + */ + RESTART_PAGE_HEADER *rstr1 = (RESTART_PAGE_HEADER*)buf; + + /* Exclude the usa from the comparison. */ + ra = (RESTART_AREA*)((u8*)rstr1 + + le16_to_cpu(rstr1->restart_offset)); + if (!memcmp(rstr1, rstr, le16_to_cpu(rstr1->usa_ofs)) && + !memcmp((u8*)rstr1 + le16_to_cpu( + rstr1->restart_offset), (u8*)rstr + + le16_to_cpu(rstr->restart_offset), + le16_to_cpu(ra->restart_area_length))) { + puts("\nSkipping analysis of second restart page " + "because it fully matches the first " + "one."); + goto skip_rstr_pass; + } + /* + * The $LogFile versions specified in each of the two restart + * page headers must match. + */ + if (rstr1->major_ver != rstr->major_ver || + rstr1->minor_ver != rstr->minor_ver) + log_err_exit(buf, "Second restart area specifies " + "different $LogFile version to first " + "restart area. Cannot handle this " + "yet.\n"); + } + /* The restart page header is in rstr and it is mst deprotected. */ + printf("\n%s restart page:\n", pass == 1 ? "1st" : "2nd"); + dump_restart_areas_header(rstr); + + printf("\nRestart area:\n"); + dump_restart_areas_area(rstr); + skip_rstr_pass: if (pass == 1) { rstr = (RESTART_PAGE_HEADER*)((u8*)rstr + page_size); ++pass; goto rstr_pass_loc; } - printf("\n\nFinished with restart pages. Beginning with log pages.\n"); - /* Reuse pass for log area. */ - pass = 0; - rcrd = (RECORD_PAGE_HEADER*)rstr; -rcrd_pass_loc: - rcrd = (RECORD_PAGE_HEADER*)((u8*)rcrd + page_size); - if ((u8*)rcrd + page_size > buf + buf_size) - goto end_of_rcrd_passes; - printf("\nLog record page number %i", pass); - if (!ntfs_is_rcrd_record(rcrd->magic) && - !ntfs_is_chkd_record(rcrd->magic)) { - for (i = 0; i < page_size; i++) - if (((u8*)rcrd)[i] != (u8)-1) - break; - if (i < page_size) - puts(" is corrupt (magic is not RCRD or CHKD)."); - else - puts(" is empty."); - pass++; - goto rcrd_pass_loc; - } else - puts(":"); - /* Dump log record page */ - printf("magic = %s\n", ntfs_is_rcrd_record(rcrd->magic) ? "RCRD" : - "CHKD"); -// TODO: I am here... (AIA) - printf("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long) - le64_to_cpu(rcrd->copy.last_lsn)); - printf("flags = 0x%x\n", (unsigned int)le32_to_cpu(rcrd->flags)); - printf("page count = %i\n", le16_to_cpu(rcrd->page_count)); - printf("page position = %i\n", le16_to_cpu(rcrd->page_position)); - printf("header.next_record_offset = 0x%llx\n", (unsigned long long) - le64_to_cpu(rcrd->header.packed.next_record_offset)); - printf("header.last_end_lsn = 0x%llx\n", (unsigned long long) - le64_to_cpu(rcrd->header.packed.last_end_lsn)); - /* - * Where does the 0x40 come from? Is it just usa_offset + - * usa_client * 2 + 7 & ~7 or is it derived from somewhere? - */ - lr = (LOG_RECORD*)((u8*)rcrd + 0x40); - client = 0; -log_record_pass: - printf("\nLog record %i:\n", client); + + return rstr; +} + +/** + * dump_log_records() + */ +static void dump_log_record(LOG_RECORD *lr) +{ + unsigned int i; printf("this lsn = 0x%llx\n", (unsigned long long)le64_to_cpu(lr->this_lsn)); printf("client previous lsn = 0x%llx\n", (unsigned long long) @@ -578,16 +560,189 @@ log_record_pass: if (le16_to_cpu(lr->lcns_to_follow) > 0) printf("Array of lcns:\n"); for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) - printf("lcn_list[%i].lcn = 0x%llx\n", i, (unsigned long long) + printf("lcn_list[%u].lcn = 0x%llx\n", i, (unsigned long long) sle64_to_cpu(lr->lcn_list[i].lcn)); - client++; - lr = (LOG_RECORD*)((u8*)lr + 0x70); - if (((u8*)lr + 0x70 <= (u8*)rcrd + - le64_to_cpu(rcrd->header.packed.next_record_offset))) - goto log_record_pass; +} + +/** + * dump_log_records() + */ +static void dump_log_records(RECORD_PAGE_HEADER *rcrd, u8 *buf, + int buf_size, unsigned int page_size) +{ + LOG_RECORD *lr; + int pass = 0; + int client; + + /* Reuse pass for log area. */ +rcrd_pass_loc: + rcrd = (RECORD_PAGE_HEADER*)((u8*)rcrd + page_size); + if ((u8*)rcrd + page_size > buf + buf_size) + return; + printf("\nLog record page number %i", pass); + if (!ntfs_is_rcrd_record(rcrd->magic) && + !ntfs_is_chkd_record(rcrd->magic)) { + unsigned int i; + for (i = 0; i < page_size; i++) + if (((u8*)rcrd)[i] != (u8)-1) + break; + if (i < page_size) + puts(" is corrupt (magic is not RCRD or CHKD)."); + else + puts(" is empty."); + pass++; + goto rcrd_pass_loc; + } else + puts(":"); + /* Dump log record page */ + printf("magic = %s\n", ntfs_is_rcrd_record(rcrd->magic) ? "RCRD" : + "CHKD"); +// TODO: I am here... (AIA) + printf("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long) + le64_to_cpu(rcrd->copy.last_lsn)); + printf("flags = 0x%x\n", (unsigned int)le32_to_cpu(rcrd->flags)); + printf("page count = %i\n", le16_to_cpu(rcrd->page_count)); + printf("page position = %i\n", le16_to_cpu(rcrd->page_position)); + printf("header.next_record_offset = 0x%llx\n", (unsigned long long) + le64_to_cpu(rcrd->header.packed.next_record_offset)); + printf("header.last_end_lsn = 0x%llx\n", (unsigned long long) + le64_to_cpu(rcrd->header.packed.last_end_lsn)); + /* + * Where does the 0x40 come from? Is it just usa_offset + + * usa_client * 2 + 7 & ~7 or is it derived from somewhere? + */ + lr = (LOG_RECORD*)((u8*)rcrd + 0x40); + client = 0; + do { + printf("\nLog record %i:\n", client); + dump_log_record(lr); + client++; + lr = (LOG_RECORD*)((u8*)lr + 0x70); + } while (((u8*)lr + 0x70 <= (u8*)rcrd + + le64_to_cpu(rcrd->header.packed.next_record_offset))); + pass++; goto rcrd_pass_loc; -end_of_rcrd_passes: +} + +/** + * main - + */ +int main(int argc, char **argv) +{ + RESTART_PAGE_HEADER *rstr; + RECORD_PAGE_HEADER *rcrd; + unsigned int page_size; + int buf_size, br, err; + logfile_file logfile; + u8 *buf; + + printf("\n"); + if (argc < 2 || argc > 3) + /* print usage and exit */ + usage(argv[0]); + /* + * If one argument, it is a device containing an NTFS volume which we + * need to mount and read the $LogFile from so we can dump its + * contents. + * + * If two arguments the first one must be "-f" and the second one is + * the path and name of the $LogFile (or copy thereof) which we need to + * read and dump the contents of. + */ + + if (argc == 2) { + logfile_open(TRUE, argv[1], &logfile); + } else /* if (argc == 3) */ { + if (strncmp(argv[1], "-f", strlen("-f"))) + usage(argv[0]); + + logfile_open(FALSE, argv[2], &logfile); + } + + buf_size = 64 * 1024 * 1024; + + if (logfile.data_size <= buf_size) + buf_size = logfile.data_size; + else + Eprintf("Warning: $LogFile is too big. " + "Only analysing the first 64MiB.\n"); + + /* For simplicity we read all of $LogFile/$DATA into memory. */ + buf = malloc(buf_size); + if (!buf) { + Eprintf("Failed to allocate buffer for file data: %s\n", + strerror(errno)); + logfile_close(&logfile); + exit(1); + } + + br = logfile_pread(&logfile, 0, buf_size, buf); + err = errno; + logfile_close(&logfile); + if (br != buf_size) { + log_err_exit(buf, "Failed to read $LogFile/$DATA: %s\n", + br < 0 ? strerror(err) : "Partial read."); + } + + /* + * We now have the entirety of the journal ($LogFile/$DATA or argv[2]) + * in the memory buffer buf and this has a size of buf_size. Note we + * apply a size capping at 64MiB, so if the journal is any bigger we + * only have the first 64MiB. This should not be a problem as I have + * never seen such a large $LogFile. Usually it is only a few MiB in + * size. + */ + rstr = (RESTART_PAGE_HEADER*)buf; + + /* Check for presence of restart area signature. */ + if (!ntfs_is_rstr_record(rstr->magic) && + !ntfs_is_chkd_record(rstr->magic)) { + s8 *pos = (s8*)buf; + s8 *end = pos + buf_size; + while (pos < end && *pos == -1) + pos++; + if (pos != end) + log_err_exit(buf, "$LogFile contents are corrupt " + "(magic RSTR is missing). Cannot " + "handle this yet.\n"); + /* All bytes are -1. */ + free(buf); + puts("$LogFile is not initialized."); + return 0; + } + + /* + * First, verify the restart page header for consistency. + */ + restart_header_sanity(rstr, buf); + page_size = le32_to_cpu(rstr->log_page_size); + + /* + * Second, verify the restart area itself. + */ + // TODO: Implement this. + Eprintf("Warning: Sanity checking of restart area not implemented " + "yet.\n"); + /* + * Third and last, verify the array of log client records. + */ + // TODO: Implement this. + Eprintf("Warning: Sanity checking of array of log client records not " + "implemented yet.\n"); + + /* + * Dump the restart headers & areas. + */ + rcrd = (RECORD_PAGE_HEADER*)dump_restart_areas(rstr, buf, page_size); + printf("\n\nFinished with restart pages. " + "Beginning with log pages.\n"); + + /* + * Dump the log areas. + */ + dump_log_records(rcrd, buf, buf_size, page_size); + free(buf); return 0; } From 60c6241ac8fb419365e581e42cc24df058764a08 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 20 Aug 2004 17:50:58 +0000 Subject: [PATCH 1755/2994] Refactor ntfsdump_logfile.c: split main() into multiple functions. BKrev: 41263a02PHvxMZ6pqzP7ppTZvEhblg From 02745a21f1893b25d9c060624881fce1c41a5182 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 23 Aug 2004 22:54:51 +0000 Subject: [PATCH 1756/2994] identify the deleted file's parent (Logical change 1.514) --- ntfsprogs/ntfsundelete.c | 156 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 151 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 4eb654a0..7c52bbd7 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -55,9 +55,7 @@ static const char *EXEC_NAME = "ntfsundelete"; static const char *MFTFILE = "mft"; -#ifdef DEBUG static const char *UNNAMED = ""; -#endif static const char *NONE = ""; static const char *UNKNOWN = "unknown"; static struct options opts; @@ -227,6 +225,7 @@ static void usage (void) " -d dir --destination dir Destination directory\n" " -b num --byte num Fill missing parts with this byte\n" " -T --truncate Truncate 100%% recoverable file to exact size.\n" + " -P --parent Show parent directory\n" "\n" " -c range --copy range Write a range of MFT records to a file\n" "\n" @@ -394,7 +393,7 @@ static int parse_time (const char *value, time_t *since) */ static int parse_options (int argc, char *argv[]) { - static const char *sopt = "-b:Cc:d:fh?m:o:Op:sS:t:Tu:qvV"; + static const char *sopt = "-b:Cc:d:fh?m:o:OPp:sS:t:Tu:qvV"; static const struct option lopt[] = { { "byte", required_argument, NULL, 'b' }, { "case", no_argument, NULL, 'C' }, @@ -408,6 +407,7 @@ static int parse_options (int argc, char *argv[]) { "percentage", required_argument, NULL, 'p' }, { "scan", no_argument, NULL, 's' }, { "size", required_argument, NULL, 'S' }, + { "parent", no_argument, NULL, 'P' }, { "time", required_argument, NULL, 't' }, { "truncate", no_argument, NULL, 'T' }, { "undelete", required_argument, NULL, 'u' }, @@ -498,6 +498,13 @@ static int parse_options (int argc, char *argv[]) err++; } break; + case 'P': + if (!opts.parent) { + opts.parent++; + } else { + err++; + } + break; case 'p': if (opts.percent == -1) { end = NULL; @@ -633,6 +640,11 @@ static int parse_options (int argc, char *argv[]) err++; } } + + if (opts.parent && !opts.verbose) { + Eprintf ("To use --parent, you must also use --verbose.\n"); + err++; + } } if (opts.fillbyte == (char)-1) @@ -668,6 +680,10 @@ static void free_file (struct ufile *file) Dprintf ("freeing filename '%s'\n", f->name ? f->name : NONE); if (f->name) free (f->name); + if (f->parent_name) { + Dprintf ("\tand parent filename '%s'\n", f->parent_name ? f->parent_name : NONE); + free (f->parent_name); + } free (f); } @@ -685,6 +701,122 @@ static void free_file (struct ufile *file) free (file); } +/** + * verify_parent - confirm a record is parent of a file + * @name: a filename of the file + * @rec: the mft record of the possible parent + * + * Check that @rec is the parent of the file represented by @name. + * If @rec is a directory, but it is created after @name, then we + * can't determine wheter @rec is really @name's parent. + * + * Return: @rec's filename, either same name space as @name or lowest space. + * NULL if can't determine parenthood or on error. + */ +static FILE_NAME_ATTR* verify_parent(struct filename* name, MFT_RECORD* rec) { + ATTR_RECORD *attr30; + FILE_NAME_ATTR *filename_attr = NULL, *lowest_space_name = NULL; + ntfs_attr_search_ctx *ctx; + int found_same_space = 1; + + if (!name || !rec) + return NULL; + + if (!(rec->flags & MFT_RECORD_IS_DIRECTORY)) { + return NULL; + } + + ctx = ntfs_attr_get_search_ctx(NULL, rec); + if (!ctx) { + Eprintf ("Couldn't create a search context.\n"); + return NULL; + } + + attr30 = find_attribute(AT_FILE_NAME, ctx); + if (!attr30) { + return NULL; + } + + filename_attr = (FILE_NAME_ATTR*)((char*)attr30 + le16_to_cpu(attr30->value_offset)); + /* if name is older than this dir -> can't determine */ + if (ntfs2utc(filename_attr->creation_time) > name->date_c) { + return NULL; + } + + if (filename_attr->file_name_type != name->name_space) { + found_same_space = 0; + lowest_space_name = filename_attr; + + while (!found_same_space && (attr30 = find_attribute(AT_FILE_NAME, ctx))) { + filename_attr = (FILE_NAME_ATTR*)((char*)attr30 + le16_to_cpu(attr30->value_offset)); + + if (filename_attr->file_name_type == name->name_space) { + found_same_space = 1; + } + else { + if (filename_attr->file_name_type < lowest_space_name->file_name_type) { + lowest_space_name = filename_attr; + } + } + } + } + + ntfs_attr_put_search_ctx(ctx); + + return (found_same_space ? filename_attr : lowest_space_name); +} + +/** + * get_parent_name - Find the name of a file's parent. + * @name: the filename whose parent's name to find + * + */ +static void get_parent_name(struct filename* name, ntfs_volume* vol) { + ntfs_attr* mft_data; + MFT_RECORD* rec; + FILE_NAME_ATTR* filename_attr; + long long inode_num; + + if (!name || !vol) + return; + + rec = calloc(1, vol->mft_record_size); + if (!rec) { + Eprintf ("Couldn't allocate memory in get_parent_name()\n"); + return; + } + + mft_data = ntfs_attr_open(vol->mft_ni, AT_DATA, NULL, 0); + if (!mft_data) { + Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); + } + else { + inode_num = MREF(name->parent_mref); + + if (ntfs_attr_pread(mft_data, vol->mft_record_size * inode_num, vol->mft_record_size, rec) < 1) { + Eprintf ("Couldn't read MFT Record %lld.\n", inode_num); + } + else { + if ((filename_attr = verify_parent(name, rec))) { + if (ntfs_ucstombs(filename_attr->file_name, filename_attr->file_name_length, &name->parent_name, 0) < 0) { + Dprintf ("Couldn't translate filename to current locale.\n"); + name->parent_name = NULL; + } + } + } + } + + if (mft_data) { + ntfs_attr_close(mft_data); + } + + if (rec) { + free(rec); + } + + return; +} + /** * get_filenames - Read an MFT Record's $FILENAME attributes * @file: The file object to work with @@ -704,7 +836,7 @@ static void free_file (struct ufile *file) * Return: n The number of $FILENAME attributes found * -1 Error */ -static int get_filenames (struct ufile *file) +static int get_filenames (struct ufile *file, ntfs_volume* vol) { ATTR_RECORD *rec; FILE_NAME_ATTR *attr; @@ -748,8 +880,16 @@ static int get_filenames (struct ufile *file) Dprintf ("Couldn't translate filename to current locale.\n"); } + name->parent_name = NULL; + + if (opts.parent) { + name->parent_mref = attr->parent_directory; + get_parent_name(name, vol); + } + if (name->name_space < space) { file->pref_name = name->name; + file->pref_pname = name->parent_name; space = name->name_space; } @@ -915,7 +1055,7 @@ static struct ufile * read_record (ntfs_volume *vol, long long record) if (attr90) file->directory = 1; - if (get_filenames (file) < 0) { + if (get_filenames (file, vol) < 0) { Eprintf ("Couldn't get filenames.\n"); } if (get_data (file, vol) < 0) { @@ -1105,7 +1245,13 @@ static void dump_record (struct ufile *file) FILE_ATTR_COMPRESSED | FILE_ATTR_ENCRYPTED))) { Qprintf (NONE); } + Qprintf ("\n"); + + if (opts.parent) { + Qprintf ("Parent: %s\n", f->parent_name ? f->parent_name : ""); + } + Qprintf ("Size alloc: %lld\n", f->size_alloc); Qprintf ("Size data: %lld\n", f->size_data); From 75c90dd7a0c7b3c1c61a51585e7f6a289f79181c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 23 Aug 2004 22:54:51 +0000 Subject: [PATCH 1757/2994] keep track of the deleted file's parent (Logical change 1.514) --- ntfsprogs/ntfsundelete.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index 2239c4d9..b02e178a 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -50,6 +50,7 @@ struct options { int verbose; /* Extra output */ int force; /* Override common sense */ int optimistic; /* Undelete in-use clusters as well */ + int parent; /* Show parent directory */ time_t since; /* Since this time */ s64 size_begin; /* Range for file size */ s64 size_end; @@ -72,6 +73,8 @@ struct filename { time_t date_r; /* read */ char *name; /* Filename in current locale */ FILE_NAME_TYPE_FLAGS name_space; + long long parent_mref; + char *parent_name; char padding[7]; /* Unused: padding to 64 bit. */ }; @@ -99,6 +102,7 @@ struct ufile { struct list_head name; /* A list of filenames */ struct list_head data; /* A list of data streams */ char *pref_name; /* Preferred filename */ + char *pref_pname; /* parent filename */ long long max_size; /* Largest size we find */ int attr_list; /* MFT record may be one of many */ int directory; /* MFT record represents a directory */ From c4b43727f0ec65e20026faabcbb142162444cbe6 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 23 Aug 2004 22:54:51 +0000 Subject: [PATCH 1758/2994] ntfsundelete: option to name the deleted file's parent (Giang) BKrev: 412a75bbJ-4RV1F6gvPQRrnJN86OEA From c8799644c2ebee5cc8658840068f91e9a70e6a53 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Aug 2004 21:26:52 +0000 Subject: [PATCH 1759/2994] Fix memory leak in libntfs/attrib.c. (Christophe Grenier) BKrev: 4130f89c5vX-b4ZUiyQQde-7-CW93w From 6fb1ec5e6be2544cfbcaa4bda15eef7bfbeb2b3b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Aug 2004 21:26:52 +0000 Subject: [PATCH 1760/2994] Fix memory leak. (Christophe Grenier) (Logical change 1.515) --- libntfs/attrib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index f4b5cc3e..ec71707f 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -187,6 +187,7 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, } #undef ESTR free(rl); + free(intbuf); return 0; } memcpy(b + total, intbuf, sle64_to_cpu(a->data_size) - From c41f53eeb35085a68f54e5984dccdc457045ab40 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 28 Aug 2004 21:26:52 +0000 Subject: [PATCH 1761/2994] Update (Logical change 1.515) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index c6d36ab9..2be6b6d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,6 +46,7 @@ xx/xx/2004 - 1.9.3-WIP --enable-debug. The only exception is ntfs_boot_sector_is_ntfs() which now uses a new function Sprintf(), provided by debug.h which can be #ifdef-ed out if people want it to be truly silent. (Anton) + - Fix memory leak in libntfs/attrib.c. (Christophe) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From 377ffc3311ff10fa2ab736959bfc856bb46e68d6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 30 Aug 2004 20:41:14 +0000 Subject: [PATCH 1762/2994] Fix memory leak. (Christophe) (Logical change 1.516) --- ntfsprogs/ntfsundelete.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 7c52bbd7..a2940cde 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -1704,6 +1704,7 @@ static int undelete_file (ntfs_volume *vol, long long inode) if (file->mft->flags & MFT_RECORD_IN_USE) { /* These two statement blocks were */ Eprintf ("Record is in use by the mft\n"); /* relocated from below because */ if (!opts.force) { /* calc_percentage() must be called */ + free(buffer); free_file (file); /* before dump_record() or list_record(). */ return 0; /* Otherwise, when undeleting, a file */ } /* will always be listed as 0% recoverable */ From abe69f19643e971385e49bfe65287f3fe73feb53 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 30 Aug 2004 20:41:14 +0000 Subject: [PATCH 1763/2994] Fix memory leaks (Christophe). (Logical change 1.516) --- ntfsprogs/mkntfs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 25e111d0..48ae7d2d 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1555,9 +1555,13 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, if (name_len) { i = (name_len + 1) * sizeof(ntfschar); uname = (ntfschar*)calloc(1, i); + if (!uname) + return -errno; name_len = stoucs(uname, name, i); - if (name_len > 0xff) + if (name_len > 0xff) { + free(uname); return -ENAMETOOLONG; + } } else uname = AT_UNNAMED; /* Check if the attribute is already there. */ @@ -2084,11 +2088,15 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { Eprintf("Failed to allocate attribute search context.\n"); + if (uname) + free(uname); return -ENOMEM; } if (ic == IGNORE_CASE) { Eprintf("FIXME: Hit unimplemented code path #4.\n"); err = -ENOTSUP; + if (uname) + free(uname); goto err_out; } err = ntfs_attr_lookup(AT_INDEX_ROOT, uname, name_len, ic, 0, NULL, 0, From 82b34f883a6e890fa2a104d176f5677f021d719c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 30 Aug 2004 20:41:14 +0000 Subject: [PATCH 1764/2994] Fix memory leaks in ntfsundelete.c and mkntfs.c. (Christophe) BKrev: 413390eahD2-vlpayecQSO7iMweeKw From b1aaf86adf96b94bde581da928729315d5f4a61b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 30 Aug 2004 20:41:14 +0000 Subject: [PATCH 1765/2994] Update (Logical change 1.516) --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2be6b6d2..6388a404 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,7 +46,8 @@ xx/xx/2004 - 1.9.3-WIP --enable-debug. The only exception is ntfs_boot_sector_is_ntfs() which now uses a new function Sprintf(), provided by debug.h which can be #ifdef-ed out if people want it to be truly silent. (Anton) - - Fix memory leak in libntfs/attrib.c. (Christophe) + - Fix memory leaks in libntfs/attrib.c, ntfsprogs/mkntfs.c and + ntfsprogs/ntfsundelete.c. (Christophe) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From eade09d2e5357ddb7fa6877130564f5402e8de0f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 31 Aug 2004 14:05:19 +0000 Subject: [PATCH 1766/2994] Update and move "ntfsls -R" changing to proper place. (Logical change 1.517) --- ChangeLog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6388a404..b397d5d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,12 +34,14 @@ xx/xx/2004 - 1.9.3-WIP - Add a @start_vcn parameter to lcnalloc.[ch]::ntfs_cluster_alloc. (Yura) - Add ntfscp utility, at present it can only overwrite files. It can - increment/decrease file size if $ATTRIBUTE_LIST not present. (Yura) + increment file size if we don't need allocate new mft records, + and decrease file size if $ATTRIBUTE_LIST not present. (Yura) - Added new API lcnalloc.[ch]::ntfs_cluster_free_from_rl, and made ntfs_cluster_alloc use it. (Yura) - Bugfix in ntfs_cluster_alloc for count = 0. (Yura) - Bugfix in ntfs_attr_map{_whole_,_}runlist: make it not fail if runlist already mapped. (Yura) + - ntfsls: Add a -R recursive option (Giang, Carmelo) - Make ntfslabel pay attention to --no-action. (Yuval) - Several bugfixes in ntfs_cluster_alloc. (Anton) - Make all of libntfs only output anything if configured with @@ -86,7 +88,6 @@ xx/xx/2004 - 1.9.3-WIP in two error code paths in ntfs_compressed_attr_pread(). (Anton) - Fix a bug where an uncompressed block could be misdetected as a compressed one if it was made up of multiple runs. (Anton) - - ntfsls: Add a -R recursive option (Giang, Carmelo) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From cd3f2379db9218a38642bdd32fd8b68f30e4eb54 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 31 Aug 2004 14:05:19 +0000 Subject: [PATCH 1767/2994] improvement to ntfs_non_resident_attr_expand: expand multi extent attributes if we don't need to allocate new mft records to perform this. (Logical change 1.517) --- libntfs/attrib.c | 159 ++++++++++++++++++++++++++++++----------------- 1 file changed, 102 insertions(+), 57 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index ec71707f..7fdf84d7 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3138,15 +3138,16 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) u8 *mft_rec_copy = NULL; u32 mft_rec_copy_size = 0; LCN lcn_seek_from; - VCN first_free_vcn; + VCN first_free_vcn, highest_vcn, cur_highest_vcn; s64 nr_need_allocate; ntfs_volume *vol; ntfs_attr_search_ctx *ctx; - ATTR_RECORD *a; - MFT_RECORD *m; + ATTR_RECORD *a, *a2; + MFT_RECORD *m, *m2; runlist *rl, *rln; u32 new_alen, new_muse; int err, mp_size, cur_max_mp_size, exp_max_mp_size; + ntfs_inode *ni; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type); @@ -3162,10 +3163,13 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) err = errno; if (err == ENOENT) err = EIO; + Dprintf("%s(): Eeek! Failed to find first extent of " + "attribute.\n", __FUNCTION__); goto put_err_out; } a = ctx->attr; m = ctx->mrec; + ni = ctx->ntfs_ino; /* * Check that the attribute name hasn't been placed after the mapping @@ -3197,29 +3201,44 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto put_err_out; } - if (NInoAttrList(na->ni)) { - err = ENOTSUP; - goto put_err_out; - } - /* The first cluster outside the new allocation. */ first_free_vcn = (newsize + vol->cluster_size - 1) >> vol->cluster_size_bits; + /* Highest VCN in the current allocation. */ + highest_vcn = (na->allocated_size >> vol->cluster_size_bits) - 1; /* * Compare the new allocation with the old one and only allocate * clusters if there is a change. */ - if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { - nr_need_allocate = first_free_vcn - - (na->allocated_size >> vol->cluster_size_bits); + if (highest_vcn + 1 != first_free_vcn) { + /* Highest VCN of current attribute extent. */ + cur_highest_vcn = sle64_to_cpu(a->highest_vcn); + + /* Find last extent of attribute, if already not finded. */ + if (cur_highest_vcn && highest_vcn != cur_highest_vcn) { + if (ntfs_attr_lookup(na->type, na->name, na->name_len, + 0, highest_vcn, NULL, 0, ctx)) { + err = errno; + if (err == ENOENT) + err = EIO; + Dprintf("%s(): Eeek! Failed to find last " + "extent of attribute.\n", __FUNCTION__); + goto put_err_out; + } + } + a2 = ctx->attr; + m2 = ctx->mrec; - if (ntfs_attr_map_runlist (na, 0)) { + /* Map runlist for it. */ + if (ntfs_attr_map_runlist(na, sle64_to_cpu(a2->lowest_vcn))) { err = errno; - Dprintf("%s(): Eeek! " - "ntfs_attr_map_whole_runlist failed.\n", - __FUNCTION__); + Dprintf("%s(): Eeek! ntfs_attr_map_runlist failed.\n", + __FUNCTION__); goto put_err_out; } + + /* Calculate how many clusters we need to allocate. */ + nr_need_allocate = first_free_vcn - (highest_vcn + 1); /* * Determine first after last LCN of attribute. We will start @@ -3244,8 +3263,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) } rl = ntfs_cluster_alloc(vol, nr_need_allocate, lcn_seek_from, - DATA_ZONE, na->allocated_size >> - vol->cluster_size_bits); + DATA_ZONE, highest_vcn + 1); if (!rl) { err = errno; Dprintf("%s(): Eeek! Cluster allocation " @@ -3253,21 +3271,36 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto put_err_out; } - /* Append new clusters to attribute runlist */ - rln = ntfs_runlists_merge (na->rl, rl); + /* Append new clusters to attribute runlist. */ + rln = ntfs_runlists_merge(na->rl, rl); if (!rln) { - /* Failed, free just allocated clusters */ + /* Failed, free just allocated clusters. */ err = errno; Dprintf("%s(): Eeek! Run list merge " "failed.\n", __FUNCTION__); - ntfs_cluster_free_from_rl (vol, rl); - free (rl); + ntfs_cluster_free_from_rl(vol, rl); + free(rl); goto put_err_out; } na->rl = rln; + /* + * We need to rebuild mapping only for last extent of attribute. + * Seek to correct position in runlist. + */ + rl = na->rl; + while(rl->vcn != sle64_to_cpu(a2->lowest_vcn)) { + rl++; + if (!rl->length) { + err = EIO; + Dprintf("%s(): Eeek! Failed to find required " + "VCN.\n", __FUNCTION__); + goto rollback; + } + } + /* Get the size for the new mapping pairs array. */ - mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); + mp_size = ntfs_get_size_for_mapping_pairs(vol, rl); if (mp_size <= 0) { err = errno; Dprintf("%s(): Eeek! Get size for mapping " @@ -3276,35 +3309,39 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) } /* * Determine maximum possible length of mapping pairs, - * if we shall *not* expand space for mapping pairs + * if we shall *not* expand space for mapping pairs. */ - cur_max_mp_size = le32_to_cpu(a->length) - - le16_to_cpu(a->mapping_pairs_offset); + cur_max_mp_size = le32_to_cpu(a2->length) - + le16_to_cpu(a2->mapping_pairs_offset); /* * Determine maximum possible length of mapping pairs, - * if we shall expand space for mapping pairs + * if we shall expand space for mapping pairs. */ - exp_max_mp_size = le32_to_cpu(m->bytes_allocated) - - le32_to_cpu(m->bytes_in_use) + cur_max_mp_size; + exp_max_mp_size = le32_to_cpu(m2->bytes_allocated) + - le32_to_cpu(m2->bytes_in_use) + cur_max_mp_size; + /* + * We need to allocate new mft records to perform resize. + * Not supported yet. + */ if (mp_size > exp_max_mp_size) { err = ENOTSUP; - Dprintf("%s(): Eeek! Maping pairs size is" - " too big.\n", __FUNCTION__); + Dprintf("%s(): Eeek! Maping pairs size is too big.\n", + __FUNCTION__); goto rollback; } /* Backup mft record. We need this for rollback. */ - mft_rec_copy_size = le32_to_cpu(m->bytes_in_use); + mft_rec_copy_size = le32_to_cpu(m2->bytes_in_use); mft_rec_copy = malloc(mft_rec_copy_size); if (!mft_rec_copy) { err = ENOMEM; Dprintf("%s(): Eeek! Not enough memory to " "allocate %d bytes.\n", __FUNCTION__, - le32_to_cpu(m->bytes_in_use)); + le32_to_cpu(m2->bytes_in_use)); goto rollback; } - memcpy(mft_rec_copy, m, mft_rec_copy_size); + memcpy(mft_rec_copy, m2, mft_rec_copy_size); /* Expand space for mapping pairs if we need this. */ if (mp_size > cur_max_mp_size) { @@ -3312,11 +3349,11 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) * Calculate the new attribute length and mft record * bytes used. */ - new_alen = (le16_to_cpu(a->mapping_pairs_offset) + new_alen = (le16_to_cpu(a2->mapping_pairs_offset) + mp_size + 7) & ~7; - new_muse = le32_to_cpu(m->bytes_in_use) - - le32_to_cpu(a->length) + new_alen; - if (new_muse > le32_to_cpu(m->bytes_allocated)) { + new_muse = le32_to_cpu(m2->bytes_in_use) - + le32_to_cpu(a2->length) + new_alen; + if (new_muse > le32_to_cpu(m2->bytes_allocated)) { Dprintf("%s(): BUG! Ran out of space in" " mft record. Please run chkdsk" " and if that doesn't find any " @@ -3328,20 +3365,20 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto rollback; } /* Move the following attributes making space. */ - memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu( - a->length), le32_to_cpu(m->bytes_in_use) - - ((u8*)a - (u8*)m) - le32_to_cpu( - a->length)); + memmove((u8*)a2 + new_alen, (u8*)a2 + le32_to_cpu( + a2->length), le32_to_cpu( + m2->bytes_in_use) - ((u8*)a2 - + (u8*)m2) - le32_to_cpu(a2->length)); /* Update the sizes of the attribute and mft records. */ - a->length = cpu_to_le32(new_alen); - m->bytes_in_use = cpu_to_le32(new_muse); + a2->length = cpu_to_le32(new_alen); + m2->bytes_in_use = cpu_to_le32(new_muse); } /* * Generate the new mapping pairs array directly into the * correct destination, i.e. the attribute record itself. */ - if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( - a->mapping_pairs_offset), mp_size, na->rl)) { + if (ntfs_mapping_pairs_build(vol, (u8*)a2 + le16_to_cpu( + a2->mapping_pairs_offset), mp_size, rl)) { err = errno; Dprintf("%s(): BUG! Mapping pairs build " "failed. Please run chkdsk and if " @@ -3353,35 +3390,39 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto rollback; } + /* + * Reminder: We may not update a->highest_vcn if it equal to 0 + * and our attribute is single extent. + */ + if (a2->highest_vcn) + a2->highest_vcn = scpu_to_le64(first_free_vcn - 1); + + /* Set the inode dirty so it is written out later. */ + if (ctx->ntfs_ino != ni) + ntfs_inode_mark_dirty(ctx->ntfs_ino); + /* Update the attribute record and the ntfs_attr structure. */ na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = scpu_to_le64(na->allocated_size); - /* - * Reminder: We may not update a->highest_vcn if it equal to 0. - */ - if (a->highest_vcn) - a->highest_vcn = scpu_to_le64(first_free_vcn - 1); } /* Update the attribute record and the ntfs attribute structure. */ na->data_size = newsize; a->data_size = scpu_to_le64(newsize); /* Set the inode dirty so it is written out later. */ - ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_inode_mark_dirty(ni); /* Done! */ if (mft_rec_copy) free(mft_rec_copy); ntfs_attr_put_search_ctx(ctx); return 0; rollback: - if (ntfs_cluster_free(vol, na, na->allocated_size >> - vol->cluster_size_bits, -1) < 0) { + if (ntfs_cluster_free(vol, na, highest_vcn + 1, -1) < 0) { Dprintf("%s(): Eeek! Leaking clusters. Run chkdsk!\n", __FUNCTION__); err = EIO; } /* Now, truncate the runlist itself. */ - if (ntfs_rl_truncate(&na->rl, na->allocated_size >> - vol->cluster_size_bits)) { + if (ntfs_rl_truncate(&na->rl, highest_vcn + 1)) { /* * Failed to truncate the runlist, so just throw it away, it * will be mapped afresh on next use. @@ -3391,7 +3432,7 @@ rollback: } /* Restote mft record. */ if (mft_changed) - memcpy(m, mft_rec_copy, mft_rec_copy_size); + memcpy(m2, mft_rec_copy, mft_rec_copy_size); if (mft_rec_copy) free(mft_rec_copy); put_err_out: @@ -3435,6 +3476,10 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) errno = EINVAL; return -1; } + + if (newsize == na->data_size) + return 0; + /* * Encrypted attributes are not supported. We return access denied, * which is what Windows NT4 does, too. From 1c505745957cbe8ff9e300d49412ab11c8abacfb Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 31 Aug 2004 14:05:19 +0000 Subject: [PATCH 1768/2994] libntfs/attrib.c improvement to ntfs_non_resident_attr_expand: expand multi extent attributes if we don't need to allocate new mft records to perform this. BKrev: 4134859f0ox7qtuKOA84xKqkC4LPCg From c562d1fdf5f0602dff466782781045c683854bea Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 31 Aug 2004 15:33:48 +0000 Subject: [PATCH 1769/2994] Cset exclude: yura@chaos.(none)|ChangeSet|20040831140519|18684 BKrev: 41349a5cUoYhLl-p3gdHTq9lQzcaaA From fcdb401959d791ab6c72e41041bed51eeb2ab107 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 31 Aug 2004 15:33:48 +0000 Subject: [PATCH 1770/2994] Exclude (Logical change 1.518) --- ChangeLog | 5 +- libntfs/attrib.c | 159 +++++++++++++++++------------------------------ 2 files changed, 59 insertions(+), 105 deletions(-) diff --git a/ChangeLog b/ChangeLog index b397d5d1..6388a404 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,14 +34,12 @@ xx/xx/2004 - 1.9.3-WIP - Add a @start_vcn parameter to lcnalloc.[ch]::ntfs_cluster_alloc. (Yura) - Add ntfscp utility, at present it can only overwrite files. It can - increment file size if we don't need allocate new mft records, - and decrease file size if $ATTRIBUTE_LIST not present. (Yura) + increment/decrease file size if $ATTRIBUTE_LIST not present. (Yura) - Added new API lcnalloc.[ch]::ntfs_cluster_free_from_rl, and made ntfs_cluster_alloc use it. (Yura) - Bugfix in ntfs_cluster_alloc for count = 0. (Yura) - Bugfix in ntfs_attr_map{_whole_,_}runlist: make it not fail if runlist already mapped. (Yura) - - ntfsls: Add a -R recursive option (Giang, Carmelo) - Make ntfslabel pay attention to --no-action. (Yuval) - Several bugfixes in ntfs_cluster_alloc. (Anton) - Make all of libntfs only output anything if configured with @@ -88,6 +86,7 @@ xx/xx/2004 - 1.9.3-WIP in two error code paths in ntfs_compressed_attr_pread(). (Anton) - Fix a bug where an uncompressed block could be misdetected as a compressed one if it was made up of multiple runs. (Anton) + - ntfsls: Add a -R recursive option (Giang, Carmelo) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 7fdf84d7..ec71707f 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3138,16 +3138,15 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) u8 *mft_rec_copy = NULL; u32 mft_rec_copy_size = 0; LCN lcn_seek_from; - VCN first_free_vcn, highest_vcn, cur_highest_vcn; + VCN first_free_vcn; s64 nr_need_allocate; ntfs_volume *vol; ntfs_attr_search_ctx *ctx; - ATTR_RECORD *a, *a2; - MFT_RECORD *m, *m2; + ATTR_RECORD *a; + MFT_RECORD *m; runlist *rl, *rln; u32 new_alen, new_muse; int err, mp_size, cur_max_mp_size, exp_max_mp_size; - ntfs_inode *ni; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type); @@ -3163,13 +3162,10 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) err = errno; if (err == ENOENT) err = EIO; - Dprintf("%s(): Eeek! Failed to find first extent of " - "attribute.\n", __FUNCTION__); goto put_err_out; } a = ctx->attr; m = ctx->mrec; - ni = ctx->ntfs_ino; /* * Check that the attribute name hasn't been placed after the mapping @@ -3201,44 +3197,29 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto put_err_out; } + if (NInoAttrList(na->ni)) { + err = ENOTSUP; + goto put_err_out; + } + /* The first cluster outside the new allocation. */ first_free_vcn = (newsize + vol->cluster_size - 1) >> vol->cluster_size_bits; - /* Highest VCN in the current allocation. */ - highest_vcn = (na->allocated_size >> vol->cluster_size_bits) - 1; /* * Compare the new allocation with the old one and only allocate * clusters if there is a change. */ - if (highest_vcn + 1 != first_free_vcn) { - /* Highest VCN of current attribute extent. */ - cur_highest_vcn = sle64_to_cpu(a->highest_vcn); - - /* Find last extent of attribute, if already not finded. */ - if (cur_highest_vcn && highest_vcn != cur_highest_vcn) { - if (ntfs_attr_lookup(na->type, na->name, na->name_len, - 0, highest_vcn, NULL, 0, ctx)) { - err = errno; - if (err == ENOENT) - err = EIO; - Dprintf("%s(): Eeek! Failed to find last " - "extent of attribute.\n", __FUNCTION__); - goto put_err_out; - } - } - a2 = ctx->attr; - m2 = ctx->mrec; + if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { + nr_need_allocate = first_free_vcn - + (na->allocated_size >> vol->cluster_size_bits); - /* Map runlist for it. */ - if (ntfs_attr_map_runlist(na, sle64_to_cpu(a2->lowest_vcn))) { + if (ntfs_attr_map_runlist (na, 0)) { err = errno; - Dprintf("%s(): Eeek! ntfs_attr_map_runlist failed.\n", - __FUNCTION__); + Dprintf("%s(): Eeek! " + "ntfs_attr_map_whole_runlist failed.\n", + __FUNCTION__); goto put_err_out; } - - /* Calculate how many clusters we need to allocate. */ - nr_need_allocate = first_free_vcn - (highest_vcn + 1); /* * Determine first after last LCN of attribute. We will start @@ -3263,7 +3244,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) } rl = ntfs_cluster_alloc(vol, nr_need_allocate, lcn_seek_from, - DATA_ZONE, highest_vcn + 1); + DATA_ZONE, na->allocated_size >> + vol->cluster_size_bits); if (!rl) { err = errno; Dprintf("%s(): Eeek! Cluster allocation " @@ -3271,36 +3253,21 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto put_err_out; } - /* Append new clusters to attribute runlist. */ - rln = ntfs_runlists_merge(na->rl, rl); + /* Append new clusters to attribute runlist */ + rln = ntfs_runlists_merge (na->rl, rl); if (!rln) { - /* Failed, free just allocated clusters. */ + /* Failed, free just allocated clusters */ err = errno; Dprintf("%s(): Eeek! Run list merge " "failed.\n", __FUNCTION__); - ntfs_cluster_free_from_rl(vol, rl); - free(rl); + ntfs_cluster_free_from_rl (vol, rl); + free (rl); goto put_err_out; } na->rl = rln; - /* - * We need to rebuild mapping only for last extent of attribute. - * Seek to correct position in runlist. - */ - rl = na->rl; - while(rl->vcn != sle64_to_cpu(a2->lowest_vcn)) { - rl++; - if (!rl->length) { - err = EIO; - Dprintf("%s(): Eeek! Failed to find required " - "VCN.\n", __FUNCTION__); - goto rollback; - } - } - /* Get the size for the new mapping pairs array. */ - mp_size = ntfs_get_size_for_mapping_pairs(vol, rl); + mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); if (mp_size <= 0) { err = errno; Dprintf("%s(): Eeek! Get size for mapping " @@ -3309,39 +3276,35 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) } /* * Determine maximum possible length of mapping pairs, - * if we shall *not* expand space for mapping pairs. + * if we shall *not* expand space for mapping pairs */ - cur_max_mp_size = le32_to_cpu(a2->length) - - le16_to_cpu(a2->mapping_pairs_offset); + cur_max_mp_size = le32_to_cpu(a->length) - + le16_to_cpu(a->mapping_pairs_offset); /* * Determine maximum possible length of mapping pairs, - * if we shall expand space for mapping pairs. + * if we shall expand space for mapping pairs */ - exp_max_mp_size = le32_to_cpu(m2->bytes_allocated) - - le32_to_cpu(m2->bytes_in_use) + cur_max_mp_size; + exp_max_mp_size = le32_to_cpu(m->bytes_allocated) + - le32_to_cpu(m->bytes_in_use) + cur_max_mp_size; - /* - * We need to allocate new mft records to perform resize. - * Not supported yet. - */ if (mp_size > exp_max_mp_size) { err = ENOTSUP; - Dprintf("%s(): Eeek! Maping pairs size is too big.\n", - __FUNCTION__); + Dprintf("%s(): Eeek! Maping pairs size is" + " too big.\n", __FUNCTION__); goto rollback; } /* Backup mft record. We need this for rollback. */ - mft_rec_copy_size = le32_to_cpu(m2->bytes_in_use); + mft_rec_copy_size = le32_to_cpu(m->bytes_in_use); mft_rec_copy = malloc(mft_rec_copy_size); if (!mft_rec_copy) { err = ENOMEM; Dprintf("%s(): Eeek! Not enough memory to " "allocate %d bytes.\n", __FUNCTION__, - le32_to_cpu(m2->bytes_in_use)); + le32_to_cpu(m->bytes_in_use)); goto rollback; } - memcpy(mft_rec_copy, m2, mft_rec_copy_size); + memcpy(mft_rec_copy, m, mft_rec_copy_size); /* Expand space for mapping pairs if we need this. */ if (mp_size > cur_max_mp_size) { @@ -3349,11 +3312,11 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) * Calculate the new attribute length and mft record * bytes used. */ - new_alen = (le16_to_cpu(a2->mapping_pairs_offset) + new_alen = (le16_to_cpu(a->mapping_pairs_offset) + mp_size + 7) & ~7; - new_muse = le32_to_cpu(m2->bytes_in_use) - - le32_to_cpu(a2->length) + new_alen; - if (new_muse > le32_to_cpu(m2->bytes_allocated)) { + new_muse = le32_to_cpu(m->bytes_in_use) - + le32_to_cpu(a->length) + new_alen; + if (new_muse > le32_to_cpu(m->bytes_allocated)) { Dprintf("%s(): BUG! Ran out of space in" " mft record. Please run chkdsk" " and if that doesn't find any " @@ -3365,20 +3328,20 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto rollback; } /* Move the following attributes making space. */ - memmove((u8*)a2 + new_alen, (u8*)a2 + le32_to_cpu( - a2->length), le32_to_cpu( - m2->bytes_in_use) - ((u8*)a2 - - (u8*)m2) - le32_to_cpu(a2->length)); + memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu( + a->length), le32_to_cpu(m->bytes_in_use) + - ((u8*)a - (u8*)m) - le32_to_cpu( + a->length)); /* Update the sizes of the attribute and mft records. */ - a2->length = cpu_to_le32(new_alen); - m2->bytes_in_use = cpu_to_le32(new_muse); + a->length = cpu_to_le32(new_alen); + m->bytes_in_use = cpu_to_le32(new_muse); } /* * Generate the new mapping pairs array directly into the * correct destination, i.e. the attribute record itself. */ - if (ntfs_mapping_pairs_build(vol, (u8*)a2 + le16_to_cpu( - a2->mapping_pairs_offset), mp_size, rl)) { + if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( + a->mapping_pairs_offset), mp_size, na->rl)) { err = errno; Dprintf("%s(): BUG! Mapping pairs build " "failed. Please run chkdsk and if " @@ -3390,39 +3353,35 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto rollback; } - /* - * Reminder: We may not update a->highest_vcn if it equal to 0 - * and our attribute is single extent. - */ - if (a2->highest_vcn) - a2->highest_vcn = scpu_to_le64(first_free_vcn - 1); - - /* Set the inode dirty so it is written out later. */ - if (ctx->ntfs_ino != ni) - ntfs_inode_mark_dirty(ctx->ntfs_ino); - /* Update the attribute record and the ntfs_attr structure. */ na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = scpu_to_le64(na->allocated_size); + /* + * Reminder: We may not update a->highest_vcn if it equal to 0. + */ + if (a->highest_vcn) + a->highest_vcn = scpu_to_le64(first_free_vcn - 1); } /* Update the attribute record and the ntfs attribute structure. */ na->data_size = newsize; a->data_size = scpu_to_le64(newsize); /* Set the inode dirty so it is written out later. */ - ntfs_inode_mark_dirty(ni); + ntfs_inode_mark_dirty(ctx->ntfs_ino); /* Done! */ if (mft_rec_copy) free(mft_rec_copy); ntfs_attr_put_search_ctx(ctx); return 0; rollback: - if (ntfs_cluster_free(vol, na, highest_vcn + 1, -1) < 0) { + if (ntfs_cluster_free(vol, na, na->allocated_size >> + vol->cluster_size_bits, -1) < 0) { Dprintf("%s(): Eeek! Leaking clusters. Run chkdsk!\n", __FUNCTION__); err = EIO; } /* Now, truncate the runlist itself. */ - if (ntfs_rl_truncate(&na->rl, highest_vcn + 1)) { + if (ntfs_rl_truncate(&na->rl, na->allocated_size >> + vol->cluster_size_bits)) { /* * Failed to truncate the runlist, so just throw it away, it * will be mapped afresh on next use. @@ -3432,7 +3391,7 @@ rollback: } /* Restote mft record. */ if (mft_changed) - memcpy(m2, mft_rec_copy, mft_rec_copy_size); + memcpy(m, mft_rec_copy, mft_rec_copy_size); if (mft_rec_copy) free(mft_rec_copy); put_err_out: @@ -3476,10 +3435,6 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) errno = EINVAL; return -1; } - - if (newsize == na->data_size) - return 0; - /* * Encrypted attributes are not supported. We return access denied, * which is what Windows NT4 does, too. From 128d9a100178ae2347df09be40bcb809b21a67de Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 31 Aug 2004 15:37:05 +0000 Subject: [PATCH 1771/2994] Auto merged 2004/08/31 16:12:21+01:00 cantab.net!aia21 - Change ntfs_attr_make_non_resident() to only allocate clusters and attempt to write out data if the attribute size is not zero. (Anton) - Fix ntfs_non_resident_attr_expand() to use ntfs_attr_map_whole_runlist() instead of ntfs_attr_map_runlist(). (Anton) (Logical change 1.519) --- libntfs/attrib.c | 71 +++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index ec71707f..4f0ddffe 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2390,21 +2390,24 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, new_allocated_size = (le32_to_cpu(a->value_length) + vol->cluster_size - 1) & ~(vol->cluster_size - 1); - /* Start by allocating clusters to hold the attribute value. */ - rl = ntfs_cluster_alloc(vol, new_allocated_size >> - vol->cluster_size_bits, -1, DATA_ZONE, 0); - if (!rl) { - if (errno != ENOSPC) { - int eo = errno; + if (new_allocated_size > 0) { + /* Start by allocating clusters to hold the attribute value. */ + rl = ntfs_cluster_alloc(vol, new_allocated_size >> + vol->cluster_size_bits, -1, DATA_ZONE, 0); + if (!rl) { + if (errno != ENOSPC) { + int eo = errno; - // FIXME: Eeek! - Dprintf("%s(): Eeek! Failed to allocate cluster(s). " - "Aborting...\n", __FUNCTION__); - errno = eo; + // FIXME: Eeek! + Dprintf("%s(): Eeek! Failed to allocate " + "cluster(s). Aborting...\n", + __FUNCTION__); + errno = eo; + } + return -1; } - return -1; - } - + } else + rl = NULL; /* * Setup the in-memory attribute structure to be non-resident so that * we can use ntfs_attr_pwrite(). @@ -2420,35 +2423,34 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, NAttrClearCompressed(na); NAttrClearSparse(na); NAttrClearEncrypted(na); - - /* Now copy the attribute value to the allocated cluster(s). */ - bw = ntfs_attr_pwrite(na, 0, le32_to_cpu(a->value_length), - (u8*)a + le16_to_cpu(a->value_offset)); - if (bw != le32_to_cpu(a->value_length)) { - err = errno; - // FIXME: Eeek! - Dprintf("%s(): Eeek! Failed to write out attribute value " - "(bw = %lli, errno = %i). Aborting...\n", - __FUNCTION__, (long long)bw, err); - if (bw >= 0) - err = EIO; - goto cluster_free_err_out; - } + if (rl) { + /* Now copy the attribute value to the allocated cluster(s). */ + bw = ntfs_attr_pwrite(na, 0, le32_to_cpu(a->value_length), + (u8*)a + le16_to_cpu(a->value_offset)); + if (bw != le32_to_cpu(a->value_length)) { + err = errno; + // FIXME: Eeek! + Dprintf("Eeek! Failed to write out attribute value " + "(bw = %lli, errno = %i). " + "Aborting...\n", (long long)bw, err); + if (bw >= 0) + err = EIO; + goto cluster_free_err_out; + } + } /* Determine the size of the mapping pairs array. */ mp_size = ntfs_get_size_for_mapping_pairs(vol, rl); if (mp_size < 0) { err = errno; // FIXME: Eeek! - Dprintf("%s(): Eeek! Failed to get size for mapping pairs " - "array. Aborting...\n", __FUNCTION__); + Dputs("Eeek! Failed to get size for mapping pairs array. " + "Aborting..."); goto cluster_free_err_out; } - /* Calculate new offsets for the name and the mapping pairs array. */ name_ofs = (sizeof(ATTR_REC) - sizeof(a->compressed_size) + 7) & ~7; mp_ofs = (name_ofs + a->name_length + 7) & ~7; - /* * Determine the size of the resident part of the non-resident * attribute record. (Not compressed thus no compressed_size element @@ -2527,14 +2529,15 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, return 0; cluster_free_err_out: - if (ntfs_cluster_free(vol, na, 0, -1) < 0) + if (rl && ntfs_cluster_free(vol, na, 0, -1) < 0) Dprintf("%s(): Eeek! Failed to release allocated " "clusters in error code path. Leaving " "inconsistent metadata...\n", __FUNCTION__); NAttrClearNonResident(na); na->allocated_size = na->data_size; na->rl = NULL; - free(rl); + if (rl) + free(rl); errno = err; return -1; } @@ -3213,7 +3216,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) nr_need_allocate = first_free_vcn - (na->allocated_size >> vol->cluster_size_bits); - if (ntfs_attr_map_runlist (na, 0)) { + if (ntfs_attr_map_whole_runlist(na)) { err = errno; Dprintf("%s(): Eeek! " "ntfs_attr_map_whole_runlist failed.\n", From f9209a456e82910854cce9451c731b308c7d34b9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 31 Aug 2004 15:37:05 +0000 Subject: [PATCH 1772/2994] Auto merged 2004/08/31 16:12:21+01:00 cantab.net!aia21 Update (Logical change 1.519) --- ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6388a404..c51b90af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -48,6 +48,15 @@ xx/xx/2004 - 1.9.3-WIP can be #ifdef-ed out if people want it to be truly silent. (Anton) - Fix memory leaks in libntfs/attrib.c, ntfsprogs/mkntfs.c and ntfsprogs/ntfsundelete.c. (Christophe) + - Change libntfs/attrib.c::ntfs_attr_make_non_resident() to only + allocate clusters and attempt to write out data if the attribute size + is not zero. (Anton) + - Fix libntfs/attrib.c::ntfs_non_resident_attr_expand() to use + libntfs/attrib.c::ntfs_attr_map_whole_runlist() instead of + libntfs/attrib.c::ntfs_attr_map_runlist(). (Anton) + - Change libntfs/runlist.c::ntfs_get_size_for_mapping_pairs() and + libntfs/runlist.c::ntfs_mapping_pairs_build() to treat a NULL runlist + to mean empty runlist. (Anton) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From 82b45caa4b5e69d7342f1fb049d8b30665827a3f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 31 Aug 2004 15:37:05 +0000 Subject: [PATCH 1773/2994] Change ntfs_get_size_for_mapping_pairs() and ntfs_mapping_pairs_build() to treat a NULL runlist to mean empty runlist. (Anton) (Logical change 1.519) --- libntfs/runlist.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 464faa0c..16a5d253 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1243,9 +1243,10 @@ __inline__ int ntfs_get_nr_significant_bytes(const s64 n) * array corresponding to the runlist @rl. This for example allows us to * allocate a buffer of the right size when building the mapping pairs array. * - * Return the calculated size in bytes on success. If @rl is NULL return 0. - * On error, return -1 with errno set to the error code. The following error - * codes are defined: + * If @rl is NULL, just return 1 (for the single terminator byte). + * + * Return the calculated size in bytes on success. On error, return -1 with + * errno set to the error code. The following error codes are defined: * EINVAL - Run list contains unmapped elements. Make sure to only pass * fully mapped runlists to this function. * EIO - The runlist is corrupt. @@ -1257,7 +1258,7 @@ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, int i, rls; if (!rl) - return 0; + return 1; /* Always need the termining zero byte. */ rls = 1; for (prev_lcn = i = 0; rl[i].length; i++) { @@ -1352,8 +1353,10 @@ err_out: * @dst. @dst_len is the size of @dst in bytes and it should be at least equal * to the value obtained by calling ntfs_get_size_for_mapping_pairs(). * - * Return 0 on success or when @rl is NULL. On error, return -1 with errno set - * to the error code. The following error codes are defined: + * If @rl is NULL, just write a single terminator byte to @dst. + * + * Return 0 on success. On error, return -1 with errno set to the error code. + * The following error codes are defined: * EINVAL - Run list contains unmapped elements. Make sure to only pass * fully mapped runlists to this function. * EIO - The runlist is corrupt. @@ -1367,8 +1370,13 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, int i; s8 len_len, lcn_len; - if (!rl) + if (!rl) { + if (dst_len < 1) + goto size_err; + /* Terminator byte. */ + *dst = 0; return 0; + } /* * @dst_max is used for bounds checking in * ntfs_write_significant_bytes(). From a8cd71cdd56282a743879432f9527476a266a605 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 31 Aug 2004 15:37:05 +0000 Subject: [PATCH 1774/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into cantab.net:/home/src/ntfsprogs 2004/08/31 16:12:22+01:00 cantab.net!aia21 - Change ntfs_attr_make_non_resident() to only allocate clusters and attempt to write out data if the attribute size is not zero. (Anton) - Fix ntfs_non_resident_attr_expand() to use ntfs_attr_map_whole_runlist() instead of ntfs_attr_map_runlist(). (Anton) - Change ntfs_get_size_for_mapping_pairs() ntfs_mapping_pairs_build() to treat a NULL runlist to mean empty runlist. (Anton) BKrev: 41349b21ktJHNZtUqgd35u-5FyqHjQ From 453d87b43ff8173356addbac39c577a0709ca3d9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 3 Sep 2004 09:30:16 +0000 Subject: [PATCH 1775/2994] Update for 1.9.3 release. (Logical change 1.520) --- ChangeLog | 2 +- Makefile.in | 60 +- aclocal.m4 | 7487 +++++++++++------- config.guess | 103 +- config.sub | 46 +- configure | 15661 +++++++++++++++++++++++++++++++------ configure.ac | 2 +- depcomp | 34 +- doc/Makefile.in | 18 +- include/Makefile.in | 42 +- include/ntfs/Makefile.in | 36 +- install-sh | 132 +- libntfs/Makefile.in | 119 +- ltmain.sh | 2916 +++++-- ntfsprogs/Makefile.in | 50 +- 15 files changed, 20592 insertions(+), 6116 deletions(-) diff --git a/ChangeLog b/ChangeLog index c51b90af..2f115073 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/2004 - 1.9.3-WIP +03/09/2004 - 1.9.3 - Lots of fixes and enhancements all over the place. - Fix access of MFT_RECORD->bytes_in_use to use le32_to_cpu() instead of le16_to_cpu() in libntfs/volume.c. (Pete Curran) diff --git a/Makefile.in b/Makefile.in index e3db9903..5cca236d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9 from Makefile.am. +# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -75,6 +75,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -85,6 +86,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -96,6 +101,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -125,18 +132,21 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -315,16 +325,14 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ - empty_fix=.; \ else \ include_option=--include; \ - empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ + test -f $$subdir/TAGS && \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ @@ -334,11 +342,9 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -392,17 +398,15 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ @@ -416,15 +420,15 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir @@ -437,7 +441,7 @@ dist-zip: distdir $(am__remove_distdir) dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then @@ -446,13 +450,13 @@ dist dist-all: distdir distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac @@ -531,7 +535,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -591,7 +595,7 @@ uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-libtool clean-recursive \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ - dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \ + dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ diff --git a/aclocal.m4 b/aclocal.m4 index 5132886c..bc9cb7db 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.9 -*- Autoconf -*- +# generated automatically by aclocal 1.8.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. @@ -11,12 +11,63 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# serial 46 AC_PROG_LIBTOOL +# serial 47 AC_PROG_LIBTOOL + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# 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 And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +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_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" @@ -27,10 +78,13 @@ AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) -]) +])# _AC_PROG_LIBTOOL + +# AC_LIBTOOL_SETUP +# ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.13)dnl +[AC_PREREQ(2.50)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl @@ -40,15 +94,103 @@ 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([LT_AC_PROG_SED])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 +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -58,341 +200,78 @@ file_magic*) ;; esac -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -# 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* - ;; +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default -*-*-linux*) - # Test if the compiler is 64bit - echo 'int i;' > conftest.$ac_ext - lt_cv_cc_64bit_output=no - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *"ELF 64"*) - lt_cv_cc_64bit_output=yes - ;; - 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 - ;; +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP -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])]) +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl - 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 +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} -_LT_AC_LTCONFIG_HACK +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER -]) -# AC_LIBTOOL_HEADER_ASSERT -# ------------------------ -AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], -[AC_CACHE_CHECK([whether $CC supports assert without backlinking], - [lt_cv_func_assert_works], - [case $host in - *-*-solaris*) - if test "$GCC" = yes && test "$with_gnu_ld" != yes; then - case `$CC --version 2>/dev/null` in - [[12]].*) lt_cv_func_assert_works=no ;; - *) lt_cv_func_assert_works=yes ;; - esac - fi - ;; - esac]) +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX -if test "x$lt_cv_func_assert_works" = xyes; then - AC_CHECK_HEADERS(assert.h) -fi -])# AC_LIBTOOL_HEADER_ASSERT -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h) -])# _LT_AC_CHECK_DLFCN +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $host_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[[ABCDGISTW]]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. -lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[[]] = -{ -EOF - sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AC_FD_CC - fi - else - echo "cannot find nm_test_var in $nlist" >&AC_FD_CC - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC - fi - else - echo "$progname: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" -if test -z "$lt_cv_sys_global_symbol_pipe"; then - global_symbol_to_cdecl= - global_symbol_to_c_name_address= -else - global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" - global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" -fi -if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; -then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - -# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR -# --------------------------------- -AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], -[# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi -])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR - +[_LT_AC_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -410,7 +289,7 @@ if test "X[$]1" = X--no-reexec; then elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else @@ -422,7 +301,7 @@ if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -466,7 +346,7 @@ else break fi done - IFS="$save_ifs" + IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -539,17 +419,298 @@ if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then fi AC_SUBST(ECHO) -AC_DIVERT_POP -])# _LT_AC_PROG_ECHO_BACKSLASH +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + 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 + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + 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_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + 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 + ;; +AC_PROVIDE_IFELSE([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) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ------------------------------------------------------------------ AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[if test "$cross_compiling" = yes; then : +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : [$4] else - AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext </dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" -need_locks="$enable_libtool_lock" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -if test x"$host" != x"$build"; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case $host_os in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="[$]2" - -AC_MSG_CHECKING([for objdir]) -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -AC_MSG_RESULT($objdir) - - -AC_ARG_WITH(pic, -[ --with-pic try to use only PIC/non-PIC objects [default=use both]], -pic_mode="$withval", pic_mode=default) -test -z "$pic_mode" && pic_mode=default - -# We assume here that the value for lt_cv_prog_cc_pic will not be cached -# in isolation, and that seeing it set (from the cache) indicates that -# the associated values are set (in the cache) correctly too. -AC_MSG_CHECKING([for $compiler option to produce PIC]) -AC_CACHE_VAL(lt_cv_prog_cc_pic, -[ lt_cv_prog_cc_pic= - lt_cv_prog_cc_shlib= - lt_cv_prog_cc_wl= - lt_cv_prog_cc_static= - lt_cv_prog_cc_no_builtin= - lt_cv_prog_cc_can_build_shared=$can_build_shared - - if test "$GCC" = yes; then - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-static' - - case $host_os in - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # not sure about C++ programs. - lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_cv_prog_cc_pic='-fno-common' - ;; - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_cv_prog_cc_pic=-Kconform_pic - fi - ;; - *) - lt_cv_prog_cc_pic='-fPIC' - ;; - esac - else - # PORTME Check for PIC flags for the system compiler. - case $host_os in - aix3* | aix4* | aix5*) - lt_cv_prog_cc_wl='-Wl,' - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_cv_prog_cc_static='-Bstatic' - else - lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - hpux9* | hpux10* | hpux11*) - # Is there a better lt_cv_prog_cc_static that works with the bundled CC? - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" - lt_cv_prog_cc_pic='+Z' - ;; - - irix5* | irix6* | nonstopux*) - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - - newsos6) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - ;; - - osf3* | osf4* | osf5*) - # All OSF/1 code is PIC. - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - ;; - - sco3.2v5*) - lt_cv_prog_cc_pic='-Kpic' - lt_cv_prog_cc_static='-dn' - lt_cv_prog_cc_shlib='-belf' - ;; - - solaris*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - sunos4*) - lt_cv_prog_cc_pic='-PIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Qoption ld ' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - uts4*) - lt_cv_prog_cc_pic='-pic' - lt_cv_prog_cc_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_cv_prog_cc_pic='-Kconform_pic' - lt_cv_prog_cc_static='-Bstatic' - fi - ;; - - *) - lt_cv_prog_cc_can_build_shared=no - ;; - esac - fi + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* ]) -if test -z "$lt_cv_prog_cc_pic"; then - AC_MSG_RESULT([none]) -else - AC_MSG_RESULT([$lt_cv_prog_cc_pic]) - - # Check to make sure the pic_flag actually works. - AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) - AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - AC_TRY_COMPILE([], [], [dnl - case $host_os in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then - # they create non-PIC objects. So, if there were any warnings, we - # assume that PIC is not supported. - if test -s conftest.err; then - lt_cv_prog_cc_pic_works=no - else - lt_cv_prog_cc_pic_works=yes - fi - ;; - *) - lt_cv_prog_cc_pic_works=yes - ;; - esac - ], [dnl - lt_cv_prog_cc_pic_works=no - ]) - CFLAGS="$save_CFLAGS" - ]) - - if test "X$lt_cv_prog_cc_pic_works" = Xno; then - lt_cv_prog_cc_pic= - lt_cv_prog_cc_can_build_shared=no - else - lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" - fi - - AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) -fi - -# Check for any special shared library compilation flags. -if test -n "$lt_cv_prog_cc_shlib"; then - AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) - lt_cv_prog_cc_can_build_shared=no - fi -fi - -AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) -AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl - lt_cv_prog_cc_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) - LDFLAGS="$save_LDFLAGS" -]) - -# Belt *and* braces to stop my trousers falling down: -test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) - -pic_flag="$lt_cv_prog_cc_pic" -special_shlib_compile_flags="$lt_cv_prog_cc_shlib" -wl="$lt_cv_prog_cc_wl" -link_static_flag="$lt_cv_prog_cc_static" -no_builtin_flag="$lt_cv_prog_cc_no_builtin" -can_build_shared="$lt_cv_prog_cc_can_build_shared" +])# AC_LIBTOOL_PROG_CC_C_O -# Check to see if options -o and -c are simultaneously supported by compiler -AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) -AC_CACHE_VAL([lt_cv_compiler_c_o], [ -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -echo "int some_variable = 0;" > conftest.$ac_ext -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" -compiler_c_o=no -if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - lt_cv_compiler_c_o=no - else - lt_cv_compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&AC_FD_CC - lt_cv_compiler_c_o=no -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null -]) -compiler_c_o=$lt_cv_compiler_c_o -AC_MSG_RESULT([$compiler_c_o]) - -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) - AC_CACHE_VAL([lt_cv_compiler_o_lo], [ - lt_cv_compiler_o_lo=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - save_objext="$ac_objext" - ac_objext=lo - AC_TRY_COMPILE([], [int some_variable = 0;], [dnl - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - lt_cv_compiler_o_lo=no - else - lt_cv_compiler_o_lo=yes - fi - ]) - ac_objext="$save_objext" - CFLAGS="$save_CFLAGS" - ]) - compiler_o_lo=$lt_cv_compiler_o_lo - AC_MSG_RESULT([$compiler_o_lo]) -else - compiler_o_lo=no -fi - +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- # Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes @@ -1131,764 +972,77 @@ if test "$compiler_c_o" = no && test "$need_locks" != no; then ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then - AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS -if test "$GCC" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) - echo "int some_variable = 0;" > conftest.$ac_ext - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" - compiler_rtti_exceptions=no - AC_TRY_COMPILE([], [int some_variable = 0;], [dnl - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - compiler_rtti_exceptions=no - else - compiler_rtti_exceptions=yes - fi - ]) - CFLAGS="$save_CFLAGS" - AC_MSG_RESULT([$compiler_rtti_exceptions]) - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi -fi - -# See if the linker supports building shared libraries. -AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) - -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -old_archive_from_expsyms_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_into_libs=no -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -link_all_deplibs=unknown -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. -extract_expsyms_cmds= - -case $host_os in -cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; -openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ - sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ - test -f $output_objdir/impgen.exe || (cd $output_objdir && \ - if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ - else $CC -o impgen impgen.c ; fi)~ - $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' - - old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' - - # cygwin and mingw dlls have different entry points and sets of symbols - # to exclude. - # FIXME: what about values for MSVC? - dll_entry=__cygwin_dll_entry@12 - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ - case $host_os in - mingw*) - # mingw values - dll_entry=_DllMainCRTStartup@12 - dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ - ;; - esac - - # mingw and cygwin differ, and it's simplest to just exclude the union - # of the two symbol sets. - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one (in ltdll.c) - if test "x$lt_cv_need_dllmain" = "xyes"; then - ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " - ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ - test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' - else - ltdll_obj= - ltdll_cmds= - fi - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left be newer dlltools. - export_symbols_cmds="$ltdll_cmds"' - $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' - - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is. - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname-def; - else - echo EXPORTS > $output_objdir/$soname-def; - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \[$]# in - 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; - 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; - *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done; - fi~ - '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw* | pw32*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - hardcode_direct=yes - archive_cmds='' - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - shared_flag='${wl}-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall can do strange things, so it is better to - # generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='${wl}-berok' - # This is a bit strange, but is similar to how AIX traditionally builds - # it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' - # We need to add '_' to the symbols in $export_symbols first - #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - hardcode_direct=yes - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load $convenience' - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case $host_os in - hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case "$host_os" in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - #Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - export_dynamic_flag_spec='${wl}-Bexport' - ;; - - solaris*) - # gcc --version < 3.0 without binutils cannot create self contained - # shared libraries reliably, requiring libgcc.a to resolve some of - # the object symbols generated in some cases. Libraries that use - # assert need libgcc.a to resolve __eprintf, for example. Linking - # a copy of libgcc.a into every shared library to guarantee resolving - # such symbols causes other problems: According to Tim Van Holder - # , C++ libraries end up with a separate - # (to the application) exception stack for one thing. - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - [[12]].*) - cat <&2 - -*** Warning: Releases of GCC earlier than version 3.0 cannot reliably -*** create self contained shared libraries on Solaris systems, without -*** introducing a dependency on libgcc.a. Therefore, libtool is disabling -*** -no-undefined support, which will at least allow you to build shared -*** libraries. However, you may find that when you link such libraries -*** into an application without using GCC, you have to manually add -*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to -*** upgrade to a newer version of GCC. Another option is to rebuild your -*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. - -EOF - no_undefined_flag= - ;; - esac - fi - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5uw7* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs fi -AC_MSG_RESULT([$ld_shlibs]) -test "$ld_shlibs" = no && can_build_shared=no +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- # Check hardcoding attributes. -AC_MSG_CHECKING([how to hardcode library paths into programs]) -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. - hardcode_action=relink + _LT_AC_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate + _LT_AC_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. - hardcode_action=unsupported + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported fi -AC_MSG_RESULT([$hardcode_action]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) -striplib= +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then @@ -1896,17 +1050,33 @@ if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else AC_MSG_RESULT([no]) fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP -reload_cmds='$LD$reload_flag -o $output$reload_objs' -test -z "$deplibs_check_method" && deplibs_check_method=unknown +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- # PORTME Fill in your ld.so characteristics -AC_MSG_CHECKING([dynamic linker characteristics]) +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= +shrext=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -1915,17 +1085,36 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) @@ -1935,7 +1124,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -1945,43 +1134,41 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can - # not hardcode correct soname into executable. Probably we can - # add versioning support to collect2, so additional links can - # be useful in future. + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}.so$major' + soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi - hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) - library_names_spec='${libname}.so' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -1989,13 +1176,12 @@ beos*) bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -2003,29 +1189,55 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows + shrext=".dll" need_version=no need_lib_prefix=no + case $GCC,$host_os in - yes,cygwin*) + yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog .libs/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac ;; - yes,mingw*) - library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` - ;; - yes,pw32*) - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - ;; + *) - library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -2038,30 +1250,56 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' - soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -2070,7 +1308,11 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - *) + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -2081,8 +1323,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -2090,14 +1332,45 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. - dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -2105,21 +1378,29 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) version_type=irix ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -2128,20 +1409,21 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) +linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. -linux-gnu*) +linux*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -2150,12 +1432,11 @@ linux-gnu*) # before this can be enabled. hardcode_into_libs=yes - case $host_cpu:$lt_cv_cc_64bit_output in - powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" - ;; - esac + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -2166,17 +1447,29 @@ linux-gnu*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -2186,7 +1479,17 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -2194,47 +1497,48 @@ newsos6) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case "$host_os" in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' + shrext=".dll" need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf + need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; @@ -2242,8 +1546,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -2253,7 +1557,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -2265,8 +1569,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -2287,39 +1591,933 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# Report the final consequences. + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# 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_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# 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], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# 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_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# 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], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# 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_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# 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], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# 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_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# 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_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [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]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +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_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +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 + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$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_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl +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 $CC]) + 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. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname 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 + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + 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. + case `"$lt_cv_path_LD" -v 2>&1 &1 /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_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + 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_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + case $host_cpu in + alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + # this will be overridden with pass_all, but let us keep it just in case + 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` + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + 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 + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + 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*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + 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 + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + 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 + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_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* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL 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, lt_dlinit, + [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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[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])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -2342,6 +2540,43 @@ aix4*) test "$enable_shared" = yes && enable_static=no fi ;; + darwin* | rhapsody*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; esac AC_MSG_RESULT([$enable_shared]) @@ -2350,111 +2585,1307 @@ AC_MSG_CHECKING([whether to build static libraries]) test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi +if test "$GXX" = yes; then + # Set up default GNU C++ configuration -AC_LIBTOOL_DLOPEN_SELF + AC_PROG_LD -if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - AC_CACHE_VAL([lt_cv_archive_cmds_need_lc], - [$rm conftest* - echo 'static int dummy;' > conftest.$ac_ext + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - if AC_TRY_EVAL(ac_compile); then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_cv_prog_cc_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$save_allow_undefined_flag + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else - cat conftest.err 1>&5 - fi]) - AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) - ;; - esac -fi -need_lc=${lt_cv_archive_cmds_need_lc-yes} + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= -# The second clause should only fire when bootstrapping the + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < "${ofile}T" -#! $SHELL + case $lt_echo in + *'\[$]0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` + ;; + esac -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +ifelse([$1], [], + [cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + AC_MSG_NOTICE([creating $ofile])], + [cfgfile="$ofile"]) + + cat <<__EOF__ >> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -2493,17 +3941,21 @@ if test -f "$ltmain"; then # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed that does not truncate output. +# A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="${SED} -e s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi -# ### BEGIN LIBTOOL CONFIG +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -2517,7 +3969,10 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$need_lc +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -2533,14 +3988,20 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# The default C compiler. -CC=$lt_CC +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) # Is the compiler the GNU C compiler? -with_gcc=$GCC +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP # The linker used to build libraries. -LD=$lt_LD +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) # Whether we need hard or soft links. LN_S=$lt_LN_S @@ -2549,7 +4010,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$STRIP +STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -2561,7 +4022,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -2571,7 +4032,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_wl +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) # Object file suffix (normally "o"). objext="$ac_objext" @@ -2579,18 +4040,21 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" +# Shared library suffix (normally ".so"). +shrext='$shrext' + # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_pic_flag +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) pic_mode=$pic_mode -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_compiler_c_o +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len -# Can we write directly to a .lo ? -compiler_o_lo=$lt_compiler_o_lo +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -2611,19 +4075,19 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_link_static_flag +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_no_builtin_flag +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) # Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) # Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) # Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) # Library versioning type. version_type=$version_type @@ -2640,26 +4104,50 @@ soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) # Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) # Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -2667,10 +4155,10 @@ deplibs_check_method=$lt_deplibs_check_method file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) # Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds @@ -2679,13 +4167,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_global_symbol_pipe +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -2697,36 +4185,45 @@ shlibpath_var=$shlibpath_var shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) # Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. -hardcode_direct=$hardcode_direct +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. -hardcode_minus_L=$hardcode_minus_L +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec @@ -2735,30 +4232,33 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" # Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) # The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) # Symbols that must always be exported. -include_expsyms=$lt_include_expsyms +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) -# ### END LIBTOOL CONFIG +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) __EOF__ +ifelse([$1],[], [ case $host_os in aix3*) - cat <<\EOF >> "${ofile}T" + cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -2771,11 +4271,1530 @@ EOF ;; esac + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDRT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in - cygwin* | mingw* | pw32* | os2*) - cat <<'EOF' >> "${ofile}T" - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi4*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include @@ -2809,748 +5828,13 @@ EOF # return TRUE; # } # /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# 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 of the License, 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. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# /* O_BINARY isn't required (or even defined sometimes) under Unix */ -# #ifndef O_BINARY -# #define O_BINARY 0 -# #endif -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (dll < 1) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) - - mv -f "${ofile}T" "$ofile" || \ - (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") - chmod +x "$ofile" -fi - -])# _LT_AC_LTCONFIG_HACK - -# 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)]) +])# _LT_AC_FILE_LTDLL_C -# 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 -]) +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) -# 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 <&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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])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=$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_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 &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 dependent 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 -aix4* | aix5*) - 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` - ;; - *) # 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* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # 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 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) - 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 - ;; - -newos6*) - 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 - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -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 - 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*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - 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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl -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=$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 LTDLINCL to the include flags for -# the libltdl header and adds --enable-ltdl-convenience to the -# configure arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library and LTDLINCL to the include flags for -# the libltdl header and adds --enable-ltdl-install to the configure -# arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) @@ -3564,6 +5848,16 @@ AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # @@ -3577,79 +5871,51 @@ AC_DEFUN([LT_AC_PROG_SED], AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. -as_executable_p="test -f" 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_prog in sed gsed; do + for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done - - # 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 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/sed$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - { (exit 1); exit 1; } -} - _max=0 - _count=0 - # Add /usr/xpg4/bin/sed as it is typically found on Solaris - # along with /bin/sed that truncates output. - for _sed in $_sed_list /usr/xpg4/bin/sed; do - test ! -f ${_sed} && break - cat /dev/null > "$tmp/sed.in" - _count=0 - echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" - # Check for GNU sed and select it if it is found. - if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then - lt_cv_path_SED=${_sed} - break +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed fi - while true; do - cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" - mv "$tmp/sed.tmp" "$tmp/sed.in" - cp "$tmp/sed.in" "$tmp/sed.nl" - echo >>"$tmp/sed.nl" - ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break - cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break - # 40000 chars as input seems more than enough - test $_count -gt 10 && break - _count=`expr $_count + 1` - if test $_count -gt $_max; then - _max=$_count - lt_cv_path_SED=$_sed - fi - done done - rm -rf "$tmp" +done +SED=$lt_cv_path_SED ]) -if test "X$SED" != "X"; then - lt_cv_path_SED=$SED -else - SED=$lt_cv_path_SED -fi AC_MSG_RESULT([$SED]) ]) @@ -3657,7 +5923,7 @@ AC_MSG_RESULT([$SED]) dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN(PKG_CHECK_MODULES, [ +AC_DEFUN([PKG_CHECK_MODULES], [ succeeded=no if test -z "$PKG_CONFIG"; then @@ -3733,14 +5999,14 @@ AC_DEFUN(PKG_CHECK_MODULES, [ # ---------------------------- # 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.9"]) +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"]) # 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.9])]) + [AM_AUTOMAKE_VERSION([1.8.3])]) # AM_AUX_DIR_EXPAND @@ -3808,7 +6074,7 @@ am_aux_dir=`cd $ac_aux_dir && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1997, 2000, 2001, 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 @@ -3845,8 +6111,8 @@ else 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.]]) + AC_MSG_ERROR([conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]) fi])]) # serial 7 -*- Autoconf -*- @@ -3966,14 +6232,9 @@ AC_CACHE_CHECK([dependency style of $depcc], 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 - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + # (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 @@ -4019,8 +6280,7 @@ AC_SUBST([AMDEPBACKSLASH]) # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 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 @@ -4056,21 +6316,27 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], else continue fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. 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 " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/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 ' + /^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 @@ -4101,7 +6367,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # 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, 2004 +# 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 @@ -4177,6 +6443,7 @@ 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 AC_REQUIRE([AM_PROG_MKDIR_P])dnl @@ -4185,9 +6452,7 @@ AC_REQUIRE([AM_PROG_MKDIR_P])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) + _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], @@ -4430,21 +6695,13 @@ fi # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in + # Keeping the `.' argument allows $(mkdir_p) to be used without + # argument. Indeed, we sometimes output rules like # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' + # where $(somedir) is conditionally defined. + # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more + # expensive solution, as it forces Make to start a sub-shell.) + mkdir_p='mkdir -p -- .' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -4610,111 +6867,3 @@ fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004 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 - - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) -m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - diff --git a/config.guess b/config.guess index a6d8a945..9b9789b1 100755 --- a/config.guess +++ b/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2004-06-24' +timestamp='2004-03-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -136,6 +136,16 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -212,9 +222,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - luna88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -230,6 +237,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + pegasos:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -307,6 +317,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; + Alpha*:OpenVMS:*:*) + echo alpha-hp-vms + exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -761,7 +774,7 @@ EOF echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` @@ -784,7 +797,21 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + # GNU/KFreeBSD systems have a "k" prefix to indicate we are using + # FreeBSD's kernel, but not the complete OS. + case ${LIBC} in gnu) kernel_only='k' ;; esac + echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -828,19 +855,16 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo cris-axis-linux exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -859,7 +883,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -878,13 +902,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-${VENDOR}-linux exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-${VENDOR}-linux exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -897,34 +921,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-${VENDOR}-linux ;; + PA8*) echo hppa2.0-${VENDOR}-linux ;; + *) echo hppa-${VENDOR}-linux ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-${VENDOR}-linux exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo x86_64-${VENDOR}-linux exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -939,18 +963,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" + echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" + echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or + # Either a pre-BFD a.out linker (linuxoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -979,7 +1003,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) @@ -1079,7 +1103,7 @@ EOF M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; - M68*:*:R3V[5678]*:*) + M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) OS_REL='' @@ -1243,13 +1267,6 @@ EOF *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms && exit 0 ;; - I*) echo ia64-dec-vms && exit 0 ;; - V*) echo vax-dec-vms && exit 0 ;; - esac esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/config.sub b/config.sub index ac6de986..be933fde 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2004-06-24' +timestamp='2004-02-23' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -70,7 +70,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -145,7 +145,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) + -apple | -axis) os= basic_machine=$1 ;; @@ -237,7 +237,7 @@ case $basic_machine in | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | mcore \ + | m32r | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -262,7 +262,7 @@ case $basic_machine in | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ @@ -300,7 +300,7 @@ case $basic_machine in | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ + | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ @@ -308,7 +308,7 @@ case $basic_machine in | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | m32r-* | m32rle-* \ + | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ @@ -326,9 +326,8 @@ case $basic_machine in | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ - | mmix-* \ | msp430-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ + | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ @@ -337,7 +336,7 @@ case $basic_machine in | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ @@ -446,10 +445,6 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; cr16c) basic_machine=cr16c-unknown os=-elf @@ -664,6 +659,10 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -744,6 +743,10 @@ case $basic_machine in np1) basic_machine=np1-gould ;; + nv1) + basic_machine=nv1-cray + os=-unicosmp + ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -1056,9 +1059,6 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; - mmix) - basic_machine=mmix-knuth - ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1081,7 +1081,7 @@ case $basic_machine in sh64) basic_machine=sh64-unknown ;; - sparc | sparcv8 | sparcv9 | sparcv9b) + sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) @@ -1161,7 +1161,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1194,9 +1194,6 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; @@ -1374,9 +1371,6 @@ case $basic_machine in *-ibm) os=-aix ;; - *-knuth) - os=-mmixware - ;; *-wec) os=-proelf ;; diff --git a/configure b/configure index 4d5401a8..de1009f1 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.3-WIP. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.3. # # Report bugs to . # @@ -243,17 +243,6 @@ IFS=" $as_nl" $as_unset CDPATH -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi - # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -272,7 +261,7 @@ if test "X$1" = X--no-reexec; then elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else @@ -284,7 +273,7 @@ if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -328,7 +318,7 @@ else break fi done - IFS="$save_ifs" + IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -402,6 +392,11 @@ fi + +tagnames=${tagnames+${tagnames},}CXX + +tagnames=${tagnames+${tagnames},}F77 + # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. @@ -428,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.9.3-WIP' -PACKAGE_STRING='ntfsprogs 1.9.3-WIP' +PACKAGE_VERSION='1.9.3' +PACKAGE_STRING='ntfsprogs 1.9.3' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -471,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 ECHO RANLIB ac_ct_RANLIB CPP EGREP LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os 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 mkdir_p AWK SET_MAKE am__leading_dot REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -932,6 +927,26 @@ ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +ac_env_CXXCPP_set=${CXXCPP+set} +ac_env_CXXCPP_value=$CXXCPP +ac_cv_env_CXXCPP_set=${CXXCPP+set} +ac_cv_env_CXXCPP_value=$CXXCPP +ac_env_F77_set=${F77+set} +ac_env_F77_value=$F77 +ac_cv_env_F77_set=${F77+set} +ac_cv_env_F77_value=$F77 +ac_env_FFLAGS_set=${FFLAGS+set} +ac_env_FFLAGS_value=$FFLAGS +ac_cv_env_FFLAGS_set=${FFLAGS+set} +ac_cv_env_FFLAGS_value=$FFLAGS # # Report the --help message. @@ -940,7 +955,7 @@ 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 ntfsprogs 1.9.3-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.9.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1007,15 +1022,17 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.9.3-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.9.3:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-shared=PKGS build shared libraries default=yes - --enable-static=PKGS build static libraries default=yes + --enable-shared[=PKGS] + build shared libraries [default=yes] + --enable-static[=PKGS] + build static libraries [default=yes] --enable-debug enable additional debugging code and output --disable-default-device-io-ops do not provide default device io operations @@ -1025,15 +1042,19 @@ Optional Features: --enable-warnings enable additional compiler warnings --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors - --enable-fast-install=PKGS optimize for fast installation 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 + --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] + --with-tags[=TAGS] + include additional configurations [automatic] Some influential environment variables: CC C compiler command @@ -1043,6 +1064,11 @@ Some influential environment variables: CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1143,7 +1169,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.9.3-WIP +ntfsprogs configure 1.9.3 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1157,7 +1183,7 @@ 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 ntfsprogs $as_me 1.9.3-WIP, which was +It was created by ntfsprogs $as_me 1.9.3, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1603,7 +1629,7 @@ test -n "$target_alias" && ac_config_headers="$ac_config_headers config.h" -am__api_version="1.9" +am__api_version="1.8" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -1755,21 +1781,13 @@ echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in + # Keeping the `.' argument allows $(mkdir_p) to be used without + # argument. Indeed, we sometimes output rules like # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' + # where $(somedir) is conditionally defined. + # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more + # expensive solution, as it forces Make to start a sub-shell.) + mkdir_p='mkdir -p -- .' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -1885,7 +1903,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.9.3-WIP' + VERSION='1.9.3' cat >>confdefs.h <<_ACEOF @@ -1913,6 +1931,9 @@ 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"} # Installed binaries are usually stripped using `strip' when the user @@ -2005,13 +2026,6 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - - @@ -2019,47 +2033,51 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' 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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else enable_static=yes fi; + # This is required to get past a stupid configure bug when making the rpm. # Basically it is broken to specify the host as a command line argument to # configure on its own, i.e. without giving --host=. It is supposed to work @@ -3222,14 +3240,9 @@ else 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 - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + # (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 @@ -3383,35 +3396,98 @@ fi 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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else enable_fast_install=yes fi; -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +SED=$lt_cv_path_SED + fi +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 + +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 + 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then @@ -3423,8 +3499,8 @@ 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 + echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -3434,12 +3510,12 @@ echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 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'` + # Canonicalize the pathname 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%/%"` + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -3463,22 +3539,26 @@ if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do + IFS="$lt_save_ifs" 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 + case `"$lt_cv_path_LD" -v 2>&1 &6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then +case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 @@ -3522,7 +3605,11 @@ 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" +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 @@ -3533,120 +3620,42 @@ else # Let the user override the test. lt_cv_path_NM="$NM" else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" 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 + 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 + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) 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 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + 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 + ;; + esac + esac fi done - IFS="$ac_save_ifs" + IFS="$lt_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi - +echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6 NM="$lt_cv_path_NM" -echo "$as_me:$LINENO: result: $NM" >&5 -echo "${ECHO_T}$NM" >&6 - -echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_executable_p="test -f" -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_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" - fi - done - done -done - - # 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 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/sed$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - { (exit 1); exit 1; } -} - _max=0 - _count=0 - # Add /usr/xpg4/bin/sed as it is typically found on Solaris - # along with /bin/sed that truncates output. - for _sed in $_sed_list /usr/xpg4/bin/sed; do - test ! -f ${_sed} && break - cat /dev/null > "$tmp/sed.in" - _count=0 - echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" - # Check for GNU sed and select it if it is found. - if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then - lt_cv_path_SED=${_sed} - break - fi - while true; do - cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" - mv "$tmp/sed.tmp" "$tmp/sed.in" - cp "$tmp/sed.in" "$tmp/sed.nl" - echo >>"$tmp/sed.nl" - ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break - cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break - # 40000 chars as input seems more than enough - test $_count -gt 10 && break - _count=`expr $_count + 1` - if test $_count -gt $_max; then - _max=$_count - lt_cv_path_SED=$_sed - fi - done - done - rm -rf "$tmp" - -fi - -if test "X$SED" != "X"; then - lt_cv_path_SED=$SED -else - SED=$lt_cv_path_SED -fi -echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6 echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 @@ -3663,7 +3672,7 @@ lt_cv_deplibs_check_method='unknown' # '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. +# which responds to the $file_magic_cmd with a given extended 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. @@ -3682,25 +3691,24 @@ bsdi4*) lt_cv_file_magic_test_file=/shlib/libc.so ;; -cygwin* | mingw* | pw32*) +cygwin*) + # win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # win32_libid shell function, so use a weaker test based on 'objdump'. 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac + lt_cv_deplibs_check_method=pass_all ;; -freebsd*) +freebsd* | kfreebsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -3720,50 +3728,53 @@ 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' +hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + 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_test_file=/usr/lib/libc.sl + ;; + esac ;; irix5* | irix6* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # 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" - ;; + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; 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*) +linux*) case $host_cpu in - alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) + alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM + # this will be overridden with pass_all, but let us keep it just in case 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` + lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; @@ -3773,6 +3784,10 @@ newos6*) lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + openbsd*) lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` @@ -3784,9 +3799,6 @@ openbsd*) ;; 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 ;; @@ -3795,11 +3807,6 @@ sco3.2v5*) ;; 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 ;; @@ -3826,6 +3833,10 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ;; esac ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; esac fi @@ -3833,211 +3844,210 @@ 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 +test -z "$deplibs_check_method" && deplibs_check_method=unknown +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +# 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 && enable_libtool_lock=yes -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo "$as_me:$LINENO: checking command to parse $NM output" >&5 -echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris* | sysv5*) - symcode='[BDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $host_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[ABCDGISTW]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. -lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext < 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 - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 3890 "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); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + 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 + fi + rm -rf conftest* + ;; - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > 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.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; -EOF - # Now generate the symbol file. - eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' +*-*-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 -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = +int +main () { -EOF - sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr) 0} -}; -#ifdef __cplusplus + ; + return 0; } -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); } && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" -if test -z "$lt_cv_sys_global_symbol_pipe"; then - global_symbol_to_cdecl= - global_symbol_to_c_name_address= + (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 - global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" - global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no fi -if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; -then - echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6 -else - echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6 +rm -f conftest.err 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 + +need_locks="$enable_libtool_lock" + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4274,21 +4284,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 - 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - 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 @@ -4677,150 +4672,1353 @@ fi done - - - - - -# 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 +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + 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_CXX+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 <&2 + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -*** 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 +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&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 + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +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_CXX+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 <&2 + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -*** 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 +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# 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 &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +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_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" else - MAGIC_CMD=: + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + '' \ + '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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err 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 + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +depcc="$CXX" 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_CXX_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_CXX_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 + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch 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_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_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 +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +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 + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6 +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +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 \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran + 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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # 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_F77="$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 +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran +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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +echo "${ECHO_T}$ac_ct_F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_F77" && break +done + + F77=$ac_ct_F77 +fi + + +# Provide some information about the compiler. +echo "$as_me:5457:" \ + "checking for Fortran 77 compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err conftest.$ac_objext conftest.$ac_ext +ac_cv_f77_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_f77_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_f77_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= fi fi +G77=`test $ac_compiler_gnu = yes && echo yes` +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 + + + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDRT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + 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); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6 +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES fi ;; esac +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" + 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_AR" && ac_cv_prog_ac_ct_AR="false" +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +fi + 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 @@ -4982,168 +6180,6 @@ else fi -enable_dlopen=no -enable_win32_dll=no - -# 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 && enable_libtool_lock=yes - -# 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 5000 "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* - ;; - -*-*-linux*) - # Test if the compiler is 64bit - echo 'int i;' > conftest.$ac_ext - lt_cv_cc_64bit_output=no - 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 - *"ELF 64"*) - lt_cv_cc_64bit_output=yes - ;; - 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 -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" -need_locks="$enable_libtool_lock" - old_CC="$CC" old_CFLAGS="$CFLAGS" @@ -5152,40 +6188,18 @@ test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm +test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o -if test x"$host" != x"$build"; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case $host_os in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' @@ -5203,24 +6217,150 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="$2" - -echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs +# 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 - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -echo "$as_me:$LINENO: result: $objdir" >&5 -echo "${ECHO_T}$objdir" >&6 + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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 + +enable_dlopen=no +enable_win32_dll=no + +# 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 && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. @@ -5232,453 +6372,445 @@ else fi; test -z "$pic_mode" && pic_mode=default -# We assume here that the value for lt_cv_prog_cc_pic will not be cached -# in isolation, and that seeing it set (from the cache) indicates that -# the associated values are set (in the cache) correctly too. -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 -if test "${lt_cv_prog_cc_pic+set}" = set; then +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +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 + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# +# Check for any special shared library compilation flags. +# +lt_prog_cc_shlib= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + lt_prog_cc_shlib='-belf' + ;; + esac +fi +if test -n "$lt_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 +if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_cv_prog_cc_pic= - lt_cv_prog_cc_shlib= - lt_cv_prog_cc_wl= - lt_cv_prog_cc_static= - lt_cv_prog_cc_no_builtin= - lt_cv_prog_cc_can_build_shared=$can_build_shared + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_prog_compiler_static" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 + +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6491: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6495: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-static' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' case $host_os in - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # not sure about C++ programs. - lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi ;; + amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. - lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - lt_cv_prog_cc_pic='-fno-common' + lt_prog_compiler_pic='-fno-common' ;; - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no ;; + sysv4*MP*) if test -d /usr/nec; then - lt_cv_prog_cc_pic=-Kconform_pic + lt_prog_compiler_pic=-Kconform_pic fi ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + *) - lt_cv_prog_cc_pic='-fPIC' + lt_prog_compiler_pic='-fPIC' ;; esac else - # PORTME Check for PIC flags for the system compiler. + # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in - aix3* | aix4* | aix5*) - lt_cv_prog_cc_wl='-Wl,' - # All AIX code is PIC. + aix*) + lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_static='-Bstatic' else - lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + hpux9* | hpux10* | hpux11*) - # Is there a better lt_cv_prog_cc_static that works with the bundled CC? - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" - lt_cv_prog_cc_pic='+Z' + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' + lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' + lt_prog_compiler_static='-non_shared' ;; newsos6) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + esac ;; osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' + lt_prog_compiler_static='-non_shared' ;; sco3.2v5*) - lt_cv_prog_cc_pic='-Kpic' - lt_cv_prog_cc_static='-dn' - lt_cv_prog_cc_shlib='-belf' + lt_prog_compiler_pic='-Kpic' + lt_prog_compiler_static='-dn' ;; solaris*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' ;; sunos4*) - lt_cv_prog_cc_pic='-PIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Qoption ld ' + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - uts4*) - lt_cv_prog_cc_pic='-pic' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then - lt_cv_prog_cc_pic='-Kconform_pic' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' fi ;; + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + *) - lt_cv_prog_cc_can_build_shared=no + lt_prog_compiler_can_build_shared=no ;; esac fi -fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic" >&6 -if test -z "$lt_cv_prog_cc_pic"; then - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 -else - echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then - # Check to make sure the pic_flag actually works. - echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 - if test "${lt_cv_prog_cc_pic_works+set}" = set; then +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6724: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6728: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works=yes + fi + fi + $rm conftest* -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - case $host_os in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then - # they create non-PIC objects. So, if there were any warnings, we - # assume that PIC is not supported. - if test -s conftest.err; then - lt_cv_prog_cc_pic_works=no - else - lt_cv_prog_cc_pic_works=yes - fi - ;; - *) - lt_cv_prog_cc_pic_works=yes - ;; - esac +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 +if test x"$lt_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - lt_cv_prog_cc_pic_works=no - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no fi - - if test "X$lt_cv_prog_cc_pic_works" = Xno; then - lt_cv_prog_cc_pic= - lt_cv_prog_cc_can_build_shared=no - else - lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" - fi - - echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac -# Check for any special shared library compilation flags. -if test -n "$lt_cv_prog_cc_shlib"; then - { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - -echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 -if test "${lt_cv_prog_cc_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_cc_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_prog_cc_static_works=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi - - -# Belt *and* braces to stop my trousers falling down: -test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 - -pic_flag="$lt_cv_prog_cc_pic" -special_shlib_compile_flags="$lt_cv_prog_cc_shlib" -wl="$lt_cv_prog_cc_wl" -link_static_flag="$lt_cv_prog_cc_static" -no_builtin_flag="$lt_cv_prog_cc_no_builtin" -can_build_shared="$lt_cv_prog_cc_can_build_shared" - - -# Check to see if options -o and -c are simultaneously supported by compiler echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_compiler_c_o+set}" = set; then +if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -echo "int some_variable = 0;" > conftest.$ac_ext -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" -compiler_c_o=no -if { (eval echo configure:5576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - lt_cv_compiler_c_o=no - else - lt_cv_compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&5 - lt_cv_compiler_c_o=no -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6784: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:6788: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 -compiler_c_o=$lt_cv_compiler_c_o -echo "$as_me:$LINENO: result: $compiler_c_o" >&5 -echo "${ECHO_T}$compiler_c_o" >&6 -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 - if test "${lt_cv_compiler_o_lo+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - lt_cv_compiler_o_lo=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - save_objext="$ac_objext" - ac_objext=lo - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -int some_variable = 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - lt_cv_compiler_o_lo=no - else - lt_cv_compiler_o_lo=yes - fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_objext="$save_objext" - CFLAGS="$save_CFLAGS" - -fi - - compiler_o_lo=$lt_cv_compiler_o_lo - echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 -echo "${ECHO_T}$compiler_o_lo" >&6 -else - compiler_o_lo=no -fi - -# Check to see if we can do hard links to lock some files if needed hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 @@ -5699,15 +6831,324 @@ else need_locks=no fi -if test "$GCC" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 - echo "int some_variable = 0;" > conftest.$ac_ext - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" - compiler_rtti_exceptions=no - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag= + enable_shared_with_static_runtimes=no + archive_cmds= + archive_expsym_cmds= + old_archive_From_new_cmds= + old_archive_from_expsyms_cmds= + export_dynamic_flag_spec= + whole_archive_flag_spec= + thread_safe_flag_spec= + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + link_all_deplibs=unknown + hardcode_automatic=no + module_cmds= + module_expsym_cmds= + always_export_symbols=no + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds="$tmp_archive_cmds" + fi + else + ld_shlibs=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5717,14 +7158,14 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -int some_variable = 0; + ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -5738,788 +7179,583 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { 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 - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - compiler_rtti_exceptions=no - else - compiler_rtti_exceptions=yes - fi +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$compiler_rtti_exceptions" >&6 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi -fi + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -# See if the linker supports building shared libraries. -echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 +int +main () +{ -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -old_archive_from_expsyms_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_into_libs=no -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -link_all_deplibs=unknown -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. -extract_expsyms_cmds= + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 -case $host_os in -cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; -openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ - sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ - test -f $output_objdir/impgen.exe || (cd $output_objdir && \ - if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ - else $CC -o impgen impgen.c ; fi)~ - $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' - - old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' - - # cygwin and mingw dlls have different entry points and sets of symbols - # to exclude. - # FIXME: what about values for MSVC? - dll_entry=__cygwin_dll_entry@12 - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ - case $host_os in - mingw*) - # mingw values - dll_entry=_DllMainCRTStartup@12 - dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ - ;; - esac - - # mingw and cygwin differ, and it's simplest to just exclude the union - # of the two symbol sets. - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one (in ltdll.c) - if test "x$lt_cv_need_dllmain" = "xyes"; then - ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " - ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ - test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' - else - ltdll_obj= - ltdll_cmds= - fi - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left be newer dlltools. - export_symbols_cmds="$ltdll_cmds"' - $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' - - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is. - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname-def; - else - echo EXPORTS > $output_objdir/$soname-def; - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \$# in - 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; - 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; - *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done; - fi~ - '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw* | pw32*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - hardcode_direct=yes - archive_cmds='' - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - shared_flag='${wl}-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec=' ' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi - fi - - # It seems that -bexpall can do strange things, so it is better to - # generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='${wl}-berok' - # This is a bit strange, but is similar to how AIX traditionally builds - # it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' ;; - *) # Darwin 1.3 on - allow_undefined_flag='-flat_namespace -undefined suppress' + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' - # We need to add '_' to the symbols in $export_symbols first - #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - hardcode_direct=yes - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load $convenience' - ;; - freebsd1*) - ld_shlibs=no - ;; + bsdi4*) + export_dynamic_flag_spec=-rdynamic + ;; - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case $host_os in - hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else + darwin* | rhapsody*) + if test "$GXX" = yes ; then + archive_cmds_need_lc=no case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - #Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - export_dynamic_flag_spec='${wl}-Bexport' - ;; - - solaris*) - # gcc --version < 3.0 without binutils cannot create self contained - # shared libraries reliably, requiring libgcc.a to resolve some of - # the object symbols generated in some cases. Libraries that use - # assert need libgcc.a to resolve __eprintf, for example. Linking - # a copy of libgcc.a into every shared library to guarantee resolving - # such symbols causes other problems: According to Tim Van Holder - # , C++ libraries end up with a separate - # (to the application) exception stack for one thing. - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - [12].*) - cat <&2 - -*** Warning: Releases of GCC earlier than version 3.0 cannot reliably -*** create self contained shared libraries on Solaris systems, without -*** introducing a dependency on libgcc.a. Therefore, libtool is disabling -*** -no-undefined support, which will at least allow you to build shared -*** libraries. However, you may find that when you link such libraries -*** into an application without using GCC, you have to manually add -*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to -*** upgrade to a newer version of GCC. Another option is to rebuild your -*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. - -EOF - no_undefined_flag= + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag='-undefined dynamic_lookup' + ;; + esac + fi ;; esac - fi - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='-all_load $convenience' + link_all_deplibs=yes else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + ld_shlibs=no fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; + ;; - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; + freebsd1*) + ld_shlibs=no + ;; - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - sysv4*MP*) - if test -d /usr/nec; then + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + ia64*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + hardcode_shlibpath_var=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + *) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld='-rpath $libdir' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no + export_dynamic_flag_spec='${wl}-Bexport' runpath_var=LD_RUN_PATH hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; + ;; - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; + solaris*) + no_undefined_flag=' -z text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; - sysv5uw7* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + fi - *) - ld_shlibs=no - ;; - esac -fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no -# Check hardcoding attributes. -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +echo "${ECHO_T}$archive_cmds_need_lc" >&6 + ;; + esac fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6 + ;; +esac -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -reload_cmds='$LD$reload_flag -o $output$reload_objs' -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -# PORTME Fill in your ld.so characteristics echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= +shrext=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -6528,17 +7764,36 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) @@ -6548,7 +7803,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -6558,43 +7813,41 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can - # not hardcode correct soname into executable. Probably we can - # add versioning support to collect2, so additional links can - # be useful in future. + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}.so$major' + soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi - hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) - library_names_spec='${libname}.so' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -6602,13 +7855,12 @@ beos*) bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -6616,29 +7868,55 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows + shrext=".dll" need_version=no need_lib_prefix=no + case $GCC,$host_os in - yes,cygwin*) + yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog .libs/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac ;; - yes,mingw*) - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` - ;; - yes,pw32*) - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' - ;; + *) - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -6651,30 +7929,56 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' - soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -6683,7 +7987,11 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - *) + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -6694,8 +8002,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -6703,14 +8011,45 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. - dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -6718,21 +8057,29 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) version_type=irix ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -6741,20 +8088,21 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) +linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. -linux-gnu*) +linux*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -6763,12 +8111,11 @@ linux-gnu*) # before this can be enabled. hardcode_into_libs=yes - case $host_cpu:$lt_cv_cc_64bit_output in - powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" - ;; - esac + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -6779,17 +8126,29 @@ linux-gnu*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -6799,7 +8158,17 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -6807,47 +8176,48 @@ newsos6) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case "$host_os" in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' + shrext=".dll" need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf + need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; @@ -6855,8 +8225,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -6866,7 +8236,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -6878,8 +8248,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -6900,31 +8270,22 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + *) dynamic_linker=no ;; @@ -6933,42 +8294,33 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no -# Report the final consequences. -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var " || \ + test "X$hardcode_automatic"="Xyes" ; then -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported @@ -6979,9 +8331,33 @@ elif test "$shlibpath_overrides_runpath" = yes || enable_fast_install=needless fi -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac fi if test "x$enable_dlopen" != xyes; then @@ -6999,11 +8375,94 @@ else lt_cv_dlopen_self=yes ;; - cygwin* | mingw* | pw32*) + mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 @@ -7487,7 +8946,7 @@ fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" @@ -7503,10 +8962,10 @@ else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 fi -if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - if test "${lt_cv_archive_cmds_need_lc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - $rm conftest* - echo 'static int dummy;' > conftest.$ac_ext +# Report which librarie types wil actually be built +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 - 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 - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_cv_prog_cc_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - lt_cv_archive_cmds_need_lc=no +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + darwin* | rhapsody*) + if test "$GCC" = yes; then + archive_cmds_need_lc=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='-flat_namespace -undefined suppress' else - lt_cv_archive_cmds_need_lc=yes + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag='-undefined dynamic_lookup' + ;; + esac fi - allow_undefined_flag=$save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi -fi - - echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 -echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac + output_verbose_link_cmd='echo' + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='-all_load $convenience' + link_all_deplibs=yes + else + ld_shlibs=no + fi ;; - esac -fi -need_lc=${lt_cv_archive_cmds_need_lc-yes} +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 -# The second clause should only fire when bootstrapping the +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +# The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - : -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi - -if test -f "$ltmain"; then - trap "$rm \"${ofile}T\"; exit 1" 1 2 15 - $rm -f "${ofile}T" - - echo creating $ofile - + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS SED \ - AR AR_FLAGS CC LD LN_S NM SHELL \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ - postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ - old_striplib striplib file_magic_cmd export_symbols_cmds \ - deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - global_symbol_to_c_name_address \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + old_postinstall_cmds old_postuninstall_cmds \ + compiler \ + CC \ + LD \ + lt_prog_compiler_wl \ + lt_prog_compiler_pic \ + lt_prog_compiler_static \ + lt_prog_compiler_no_builtin_flag \ + export_dynamic_flag_spec \ + thread_safe_flag_spec \ + whole_archive_flag_spec \ + enable_shared_with_static_runtimes \ + old_archive_cmds \ + old_archive_from_new_cmds \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + exclude_expsyms \ + include_expsyms; do case $var in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -7820,14 +9321,29 @@ if test -f "$ltmain"; then esac done - cat <<__EOF__ > "${ofile}T" + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" #! $SHELL -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -7849,16 +9365,19 @@ if test -f "$ltmain"; then # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed that does not truncate output. +# A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="${SED} -e s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +# The names of the tagged configurations supported by this script. +available_tags= + # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -7873,7 +9392,10 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$need_lc +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -7889,12 +9411,18 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# The default C compiler. -CC=$lt_CC +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC +# An ERE matcher. +EGREP=$lt_EGREP + # The linker used to build libraries. LD=$lt_LD @@ -7905,7 +9433,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$STRIP +STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -7917,7 +9445,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -7927,7 +9455,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_wl +wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -7935,18 +9463,21 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" +# Shared library suffix (normally ".so"). +shrext='$shrext' + # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_pic_flag +pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_compiler_c_o +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len -# Can we write directly to a .lo ? -compiler_o_lo=$lt_compiler_o_lo +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -7967,10 +9498,10 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_link_static_flag +link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_no_builtin_flag +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec @@ -8012,10 +9543,34 @@ archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -8035,13 +9590,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_global_symbol_pipe +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -8062,10 +9617,15 @@ hardcode_into_libs=$hardcode_into_libs # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct @@ -8077,6 +9637,10 @@ hardcode_minus_L=$hardcode_minus_L # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic + # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" @@ -8112,9 +9676,10 @@ include_expsyms=$lt_include_expsyms __EOF__ + case $host_os in aix3*) - cat <<\EOF >> "${ofile}T" + cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -8123,186 +9688,6 @@ if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi -EOF - ;; - esac - - case $host_os in - cygwin* | mingw* | pw32* | os2*) - cat <<'EOF' >> "${ofile}T" - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# 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 of the License, 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. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# /* O_BINARY isn't required (or even defined sometimes) under Unix */ -# #ifndef O_BINARY -# #define O_BINARY 0 -# #endif -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (dll < 1) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - mv -f "${ofile}T" "$ofile" || \ - (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi 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 + +CC="$lt_save_CC" + + +# Check whether --with-tags or --without-tags was given. +if test "${with_tags+set}" = set; then + withval="$with_tags" + tagnames="$withval" +fi; + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} + else + { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 +echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in + "") ;; + *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 +echo "$as_me: error: invalid tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 +echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} + { (exit 1); exit 1; }; } + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_flag_spec_ld_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_automatic_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +compiler_CXX=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +else + lt_prog_compiler_no_builtin_flag_CXX= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + +# 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 $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $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. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname 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 + 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 + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + 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. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +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. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 +ld_shlibs_CXX=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_CXX=yes + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_CXX=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX=' ' + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs_CXX=no + fi + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes; then + archive_cmds_need_lc_CXX=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag_CXX='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='-all_load $convenience' + link_all_deplibs_CXX=yes + else + ld_shlibs_CXX=no + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + freebsd12*) + # C++ shared libraries reported to be fairly broken before switch to ELF + ld_shlibs_CXX=no + ;; + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + gnu*) + ;; + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC) + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_CXX='+b $libdir' + hardcode_libdir_separator_CXX=: + ;; + ia64*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + *) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + archive_cmds_need_lc_CXX=no + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + sco*) + archive_cmds_need_lc_CXX=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.0-5 | solaris2.0-5.*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + archive_cmds_need_lc_CXX=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; +esac +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +GCC_CXX="$GXX" +LD_CXX="$LD" + + +cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + +lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + icpc) + # Intel C++ + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11245: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:11249: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 + +if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11305: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:11309: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_CXX=no + else + archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var CXX" || \ + test "X$hardcode_automatic_CXX"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 +echo "${ECHO_T}$hardcode_action_CXX" >&6 + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_CXX \ + CC_CXX \ + LD_CXX \ + lt_prog_compiler_wl_CXX \ + lt_prog_compiler_pic_CXX \ + lt_prog_compiler_static_CXX \ + lt_prog_compiler_no_builtin_flag_CXX \ + export_dynamic_flag_spec_CXX \ + thread_safe_flag_spec_CXX \ + whole_archive_flag_spec_CXX \ + enable_shared_with_static_runtimes_CXX \ + old_archive_cmds_CXX \ + old_archive_from_new_cmds_CXX \ + predep_objects_CXX \ + postdep_objects_CXX \ + predeps_CXX \ + postdeps_CXX \ + compiler_lib_search_path_CXX \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_CXX + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS=$lt_AS + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_CXX +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_CXX + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_CXX" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld + + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + +archive_cmds_need_lc_F77=no +allow_undefined_flag_F77= +always_export_symbols_F77=no +archive_expsym_cmds_F77= +export_dynamic_flag_spec_F77= +hardcode_direct_F77=no +hardcode_libdir_flag_spec_F77= +hardcode_libdir_flag_spec_ld_F77= +hardcode_libdir_separator_F77= +hardcode_minus_L_F77=no +hardcode_automatic_F77=no +module_cmds_F77= +module_expsym_cmds_F77= +link_all_deplibs_F77=unknown +old_archive_cmds_F77=$old_archive_cmds +no_undefined_flag_F77= +whole_archive_flag_spec_F77= +enable_shared_with_static_runtimes_F77=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +objext_F77=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code=" subroutine t\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +compiler_F77=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +test "$ld_shlibs_F77" = no && can_build_shared=no + +GCC_F77="$G77" +LD_F77="$LD" + +lt_prog_compiler_wl_F77= +lt_prog_compiler_pic_F77= +lt_prog_compiler_static_F77= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_static_F77='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_F77=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_F77=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_F77='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + else + lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-static' + ;; + ccc*) + lt_prog_compiler_wl_F77='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_F77='-Kpic' + lt_prog_compiler_static_F77='-dn' + ;; + + solaris*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl_F77='-Qoption ld ' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_F77='-Kconform_pic' + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic_F77='-pic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_F77"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13591: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:13595: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 + +if test x"$lt_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_F77=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13651: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:13655: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_F77=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_F77= + enable_shared_with_static_runtimes_F77=no + archive_cmds_F77= + archive_expsym_cmds_F77= + old_archive_From_new_cmds_F77= + old_archive_from_expsyms_cmds_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + thread_safe_flag_spec_F77= + hardcode_libdir_flag_spec_F77= + hardcode_libdir_flag_spec_ld_F77= + hardcode_libdir_separator_F77= + hardcode_direct_F77=no + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=unsupported + link_all_deplibs_F77=unknown + hardcode_automatic_F77=no + module_cmds_F77= + module_expsym_cmds_F77= + always_export_symbols_F77=no + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_F77= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_F77=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + sunos4*) + archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds_F77="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_F77="$tmp_archive_cmds" + fi + else + ld_shlibs_F77=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + + if test "$ld_shlibs_F77" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=yes + archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_F77=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_F77=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_F77=yes + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_F77=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_F77='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_F77="-z nodefs" + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_F77=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_F77=' ' + archive_cmds_need_lc_F77=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_F77=no + ;; + + bsdi4*) + export_dynamic_flag_spec_F77=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_F77=' ' + allow_undefined_flag_F77=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_F77='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_F77=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + archive_cmds_need_lc_F77=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag_F77='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_F77=no + hardcode_automatic_F77=yes + hardcode_shlibpath_var_F77=unsupported + whole_archive_flag_spec_F77='-all_load $convenience' + link_all_deplibs_F77=yes + else + ld_shlibs_F77=no + fi + ;; + + dgux*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + freebsd1*) + ld_shlibs_F77=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_F77='+b $libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + ;; + ia64*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + *) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + link_all_deplibs_F77=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_F77='-rpath $libdir' + fi + hardcode_libdir_separator_F77=: + ;; + + sco3.2v5*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_F77=' -z text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_shlibpath_var_F77=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs_F77=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_F77='$CC -r -o $output$reload_objs' + hardcode_direct_F77=no + ;; + motorola) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv4.3*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_F77=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_F77='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv5*) + no_undefined_flag_F77=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_F77= + hardcode_shlibpath_var_F77=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + *) + ld_shlibs_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 +echo "${ECHO_T}$ld_shlibs_F77" >&6 +test "$ld_shlibs_F77" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_F77" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_F77=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_F77 in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_F77 + allow_undefined_flag_F77= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_F77=no + else + archive_cmds_need_lc_F77=yes + fi + allow_undefined_flag_F77=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var F77" || \ + test "X$hardcode_automatic_F77"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 +echo "${ECHO_T}$hardcode_action_F77" >&6 + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_F77 \ + CC_F77 \ + LD_F77 \ + lt_prog_compiler_wl_F77 \ + lt_prog_compiler_pic_F77 \ + lt_prog_compiler_static_F77 \ + lt_prog_compiler_no_builtin_flag_F77 \ + export_dynamic_flag_spec_F77 \ + thread_safe_flag_spec_F77 \ + whole_archive_flag_spec_F77 \ + enable_shared_with_static_runtimes_F77 \ + old_archive_cmds_F77 \ + old_archive_from_new_cmds_F77 \ + predep_objects_F77 \ + postdep_objects_F77 \ + predeps_F77 \ + postdeps_F77 \ + compiler_lib_search_path_F77 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_F77 + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS=$lt_AS + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_F77 + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_F77 +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_F77 + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_F77 +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_F77 +archive_expsym_cmds=$lt_archive_expsym_cmds_F77 +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_F77 +module_expsym_cmds=$lt_module_expsym_cmds_F77 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_F77 + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_F77 + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_F77 + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_F77 + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_F77 + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_F77 + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_F77 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_F77 + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_F77" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + + + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +objext_GCJ=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +compiler_GCJ=$CC + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +archive_cmds_need_lc_GCJ=no + + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:15685: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:15689: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl_GCJ= +lt_prog_compiler_pic_GCJ= +lt_prog_compiler_static_GCJ= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_static_GCJ='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_GCJ=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_GCJ=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_GCJ='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + else + lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-static' + ;; + ccc*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_GCJ='-Kpic' + lt_prog_compiler_static_GCJ='-dn' + ;; + + solaris*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl_GCJ='-Qoption ld ' + lt_prog_compiler_pic_GCJ='-PIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_GCJ='-Kconform_pic' + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic_GCJ='-pic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_GCJ"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:15918: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:15922: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 + +if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_GCJ=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:15978: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:15982: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_GCJ=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_GCJ= + enable_shared_with_static_runtimes_GCJ=no + archive_cmds_GCJ= + archive_expsym_cmds_GCJ= + old_archive_From_new_cmds_GCJ= + old_archive_from_expsyms_cmds_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + thread_safe_flag_spec_GCJ= + hardcode_libdir_flag_spec_GCJ= + hardcode_libdir_flag_spec_ld_GCJ= + hardcode_libdir_separator_GCJ= + hardcode_direct_GCJ=no + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=unsupported + link_all_deplibs_GCJ=unknown + hardcode_automatic_GCJ=no + module_cmds_GCJ= + module_expsym_cmds_GCJ= + always_export_symbols_GCJ=no + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_GCJ= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_GCJ=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + sunos4*) + archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds_GCJ="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_GCJ="$tmp_archive_cmds" + fi + else + ld_shlibs_GCJ=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + + if test "$ld_shlibs_GCJ" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=yes + archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_GCJ=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_GCJ=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_GCJ=yes + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_GCJ=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_GCJ='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_GCJ="-z nodefs" + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_GCJ=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_GCJ=' ' + archive_cmds_need_lc_GCJ=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_GCJ=no + ;; + + bsdi4*) + export_dynamic_flag_spec_GCJ=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_GCJ=' ' + allow_undefined_flag_GCJ=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_GCJ='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_GCJ=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + archive_cmds_need_lc_GCJ=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_GCJ=no + hardcode_automatic_GCJ=yes + hardcode_shlibpath_var_GCJ=unsupported + whole_archive_flag_spec_GCJ='-all_load $convenience' + link_all_deplibs_GCJ=yes + else + ld_shlibs_GCJ=no + fi + ;; + + dgux*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + freebsd1*) + ld_shlibs_GCJ=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + ;; + ia64*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + *) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + link_all_deplibs_GCJ=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + allow_undefined_flag_GCJ=unsupported + archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_GCJ='-rpath $libdir' + fi + hardcode_libdir_separator_GCJ=: + ;; + + sco3.2v5*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_GCJ=' -z text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_shlibpath_var_GCJ=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs_GCJ=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_GCJ='$CC -r -o $output$reload_objs' + hardcode_direct_GCJ=no + ;; + motorola) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4.3*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_GCJ=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_GCJ='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv5*) + no_undefined_flag_GCJ=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_GCJ= + hardcode_shlibpath_var_GCJ=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + *) + ld_shlibs_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 +echo "${ECHO_T}$ld_shlibs_GCJ" >&6 +test "$ld_shlibs_GCJ" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_GCJ" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_GCJ=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_GCJ in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ + allow_undefined_flag_GCJ= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_GCJ=no + else + archive_cmds_need_lc_GCJ=yes + fi + allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var GCJ" || \ + test "X$hardcode_automatic_GCJ"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 +echo "${ECHO_T}$hardcode_action_GCJ" >&6 + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_GCJ \ + CC_GCJ \ + LD_GCJ \ + lt_prog_compiler_wl_GCJ \ + lt_prog_compiler_pic_GCJ \ + lt_prog_compiler_static_GCJ \ + lt_prog_compiler_no_builtin_flag_GCJ \ + export_dynamic_flag_spec_GCJ \ + thread_safe_flag_spec_GCJ \ + whole_archive_flag_spec_GCJ \ + enable_shared_with_static_runtimes_GCJ \ + old_archive_cmds_GCJ \ + old_archive_from_new_cmds_GCJ \ + predep_objects_GCJ \ + postdep_objects_GCJ \ + predeps_GCJ \ + postdeps_GCJ \ + compiler_lib_search_path_GCJ \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_GCJ + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_GCJ + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_GCJ + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS=$lt_AS + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_GCJ + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_GCJ +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_GCJ + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_GCJ +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_GCJ +archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_GCJ +module_expsym_cmds=$lt_module_expsym_cmds_GCJ + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_GCJ + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_GCJ + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_GCJ + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_GCJ + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_GCJ + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_GCJ + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_GCJ + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_GCJ + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_GCJ" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + RC) + + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +compiler_RC=$CC +lt_cv_prog_compiler_c_o_RC=yes + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_RC \ + CC_RC \ + LD_RC \ + lt_prog_compiler_wl_RC \ + lt_prog_compiler_pic_RC \ + lt_prog_compiler_static_RC \ + lt_prog_compiler_no_builtin_flag_RC \ + export_dynamic_flag_spec_RC \ + thread_safe_flag_spec_RC \ + whole_archive_flag_spec_RC \ + enable_shared_with_static_runtimes_RC \ + old_archive_cmds_RC \ + old_archive_from_new_cmds_RC \ + predep_objects_RC \ + postdep_objects_RC \ + predeps_RC \ + postdeps_RC \ + compiler_lib_search_path_RC \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_RC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_RC + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS=$lt_AS + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_RC +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_RC + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_RC + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_RC + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_RC" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + ;; + + *) + { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 +echo "$as_me: error: Unsupported tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 +echo "$as_me: error: unable to update list of available tagged configurations." >&2;} + { (exit 1); exit 1; }; } + fi +fi @@ -8331,6 +19253,24 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion + + + + + + + + + + + + + + + + + + # Enable large file support. # Check whether --enable-largefile or --disable-largefile was given. @@ -11802,6 +22742,13 @@ 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 +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -12080,7 +23027,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.9.3-WIP, which was +This file was extended by ntfsprogs $as_me 1.9.3, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12143,7 +23090,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.9.3-WIP +ntfsprogs config.status 1.9.3 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -12383,6 +23330,7 @@ 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 @@ -12391,9 +23339,6 @@ s,@mkdir_p@,$mkdir_p,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@am__leading_dot@,$am__leading_dot,;t t -s,@AMTAR@,$AMTAR,;t t -s,@am__tar@,$am__tar,;t t -s,@am__untar@,$am__untar,;t t s,@REALLYSTATIC_TRUE@,$REALLYSTATIC_TRUE,;t t s,@REALLYSTATIC_FALSE@,$REALLYSTATIC_FALSE,;t t s,@CC@,$CC,;t t @@ -12413,11 +23358,23 @@ 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,@EGREP@,$EGREP,;t t s,@ECHO@,$ECHO,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@CXXCPP@,$CXXCPP,;t t +s,@F77@,$F77,;t t +s,@FFLAGS@,$FFLAGS,;t t +s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t @@ -13051,21 +24008,27 @@ echo X"$mf" | else continue fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. 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 " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/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 ' + /^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 diff --git a/configure.ac b/configure.ac index a3084848..462ed2dd 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.9.3-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.9.3],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) diff --git a/depcomp b/depcomp index 11e2d3bf..9e5522d0 100755 --- a/depcomp +++ b/depcomp @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2004-05-31.23 +scriptversion=2003-11-08.23 -# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 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 @@ -43,7 +43,6 @@ Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). @@ -62,10 +61,18 @@ if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" @@ -287,35 +294,26 @@ tru64) base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then - # Dependencies are output in .lo.d with libtool 1.4. - # With libtool 1.5 they are output both in $dir.libs/$base.o.d - # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the - # latter, because the former will be cleaned when $dir.libs is - # erased. tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir$base.o.d" - tmpdepfile3="$dir.libs/$base.d" + tmpdepfile2="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" - tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" - elif test -f "$tmpdepfile2"; then - tmpdepfile="$tmpdepfile2" else - tmpdepfile="$tmpdepfile3" + tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" diff --git a/doc/Makefile.in b/doc/Makefile.in index 842ffe1e..200d08e6 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9 from Makefile.am. +# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -50,6 +50,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -60,6 +61,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -71,6 +76,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -100,18 +107,21 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -254,7 +264,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/include/Makefile.in b/include/Makefile.in index 0b913d4e..f621ba46 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9 from Makefile.am. +# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -59,6 +59,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -69,6 +70,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -80,6 +85,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -109,18 +116,21 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -270,16 +280,14 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + if (etags --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ - empty_fix=.; \ else \ include_option=--include; \ - empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ + test -f $$subdir/TAGS && \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ @@ -289,11 +297,9 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -344,17 +350,15 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ @@ -383,7 +387,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 79b80117..d6a59487 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9 from Makefile.am. +# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -47,12 +47,6 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(linux_ntfsincludedir)" linux_ntfsincludeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(linux_ntfsinclude_HEADERS) @@ -63,6 +57,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -73,6 +68,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -84,6 +83,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -113,18 +114,21 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -233,7 +237,7 @@ install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) test -z "$(linux_ntfsincludedir)" || $(mkdir_p) "$(DESTDIR)$(linux_ntfsincludedir)" @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(linux_ntfsincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(linux_ntfsincludedir)/$$f'"; \ $(linux_ntfsincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ done @@ -241,7 +245,7 @@ install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) uninstall-linux_ntfsincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(linux_ntfsincludedir)/$$f'"; \ rm -f "$(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ done @@ -266,11 +270,9 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -347,7 +349,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/install-sh b/install-sh index b777f124..77bc3814 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-07-05.00 +scriptversion=2004-02-15.20 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -58,6 +58,9 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" +transformbasename= +transform_arg= +instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= @@ -67,27 +70,23 @@ mvcmd="$mvprog" src= dst= dir_arg= -dstarg= -no_target_directory= -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE +usage="Usage: $0 [OPTION]... SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... + or: $0 -d DIRECTORIES... -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. +In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. +In the second, create the directory path DIR. Options: --c (ignored) +-b=TRANSFORMBASENAME +-c copy source (using $cpprog) instead of moving (using $mvprog). -d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. +-g GROUP $chgrp installed files to GROUP. +-m MODE $chmod installed files to MODE. +-o USER $chown installed files to USER. +-s strip installed files (using $stripprog). +-t=TRANSFORM --help display this help and exit. --version display version info and exit. @@ -97,7 +96,12 @@ Environment variables override the default commands: while test -n "$1"; do case $1 in - -c) shift + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + -c) instcmd=$cpprog + shift continue;; -d) dir_arg=true @@ -125,20 +129,14 @@ while test -n "$1"; do shift continue;; - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; --version) echo "$0 $scriptversion"; exit 0;; *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break + test -n "$dir_arg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do @@ -176,13 +174,13 @@ do src= if test -d "$dst"; then - mkdircmd=: + instcmd=: chmodcmd= else - mkdircmd=$mkdirprog + instcmd=$mkdirprog fi else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then @@ -204,10 +202,6 @@ do # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi dst=$dst/`basename "$src"` fi fi @@ -235,25 +229,34 @@ do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" + $mkdirprog "$pathcomp" || lasterr=$? # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. - test -d "$pathcomp" || exit + test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ + $doit $instcmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else - dstfile=`basename "$dst"` + # If we're going to rename the final executable, determine the name now. + if test -z "$transformarg"; then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename \ + | sed $transformarg`$transformbasename + fi + + # don't allow the sed command to completely eliminate the filename. + test -z "$dstfile" && dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ @@ -263,49 +266,40 @@ do trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && + # Move or copy the file name to the temp name + $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. + # errors from the above "$doit $instcmd $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + # Now remove or move aside any old file at destination location. We + # try this two ways since rm can't unlink itself on some systems and + # the destination file might be busy for other reasons. In this case, + # the final cleanup might fail but the new file should still install + # successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi + } && + # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" fi || { (exit 1); exit; } done diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 9b98e65c..df12cb16 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9 from Makefile.am. +# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -75,15 +75,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = libntfs.conf libntfs-gnomevfs.8 -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(gnomevfsmoduleslibdir)" \ - "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man8dir)" \ - "$(DESTDIR)$(gnomevfsmodulesconfdir)" +am__installdirs = "$(DESTDIR)$(gnomevfsmoduleslibdir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(gnomevfsmodulesconfdir)" gnomevfsmoduleslibLTLIBRARIES_INSTALL = $(INSTALL) libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(gnomevfsmoduleslib_LTLIBRARIES) $(lib_LTLIBRARIES) @@ -92,8 +84,6 @@ am_libntfs_gnomevfs_la_OBJECTS = \ libntfs_gnomevfs_la-gnome-vfs-method.lo \ libntfs_gnomevfs_la-gnome-vfs-module.lo libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) -@ENABLE_GNOME_VFS_TRUE@am_libntfs_gnomevfs_la_rpath = -rpath \ -@ENABLE_GNOME_VFS_TRUE@ $(gnomevfsmoduleslibdir) libntfs_la_LIBADD = am_libntfs_la_OBJECTS = attrib.lo attrlist.lo bitmap.lo bootsect.lo \ compat.lo compress.lo debug.lo device.lo device_io.lo dir.lo \ @@ -103,6 +93,18 @@ libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrib.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/attrlist.Plo ./$(DEPDIR)/bitmap.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/bootsect.Plo ./$(DEPDIR)/compat.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/compress.Plo ./$(DEPDIR)/debug.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/device.Plo ./$(DEPDIR)/device_io.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/dir.Plo ./$(DEPDIR)/inode.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/lcnalloc.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/mft.Plo ./$(DEPDIR)/mst.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/runlist.Plo ./$(DEPDIR)/security.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/unistr.Plo ./$(DEPDIR)/volume.Plo COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ @@ -125,6 +127,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -135,6 +138,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -146,6 +153,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -175,18 +184,21 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -301,7 +313,7 @@ install-gnomevfsmoduleslibLTLIBRARIES: $(gnomevfsmoduleslib_LTLIBRARIES) test -z "$(gnomevfsmoduleslibdir)" || $(mkdir_p) "$(DESTDIR)$(gnomevfsmoduleslibdir)" @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f=$(am__strip_dir) \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gnomevfsmoduleslibdir)/$$f'"; \ $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gnomevfsmoduleslibdir)/$$f"; \ else :; fi; \ @@ -309,8 +321,8 @@ install-gnomevfsmoduleslibLTLIBRARIES: $(gnomevfsmoduleslib_LTLIBRARIES) uninstall-gnomevfsmoduleslibLTLIBRARIES: @$(NORMAL_UNINSTALL) - @set -x; list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ + @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(gnomevfsmoduleslibdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(gnomevfsmoduleslibdir)/$$p"; \ done @@ -319,7 +331,7 @@ clean-gnomevfsmoduleslibLTLIBRARIES: -test -z "$(gnomevfsmoduleslib_LTLIBRARIES)" || rm -f $(gnomevfsmoduleslib_LTLIBRARIES) @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ + test "$$dir" = "$$p" && dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done @@ -328,7 +340,7 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f=$(am__strip_dir) \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ @@ -336,8 +348,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) - @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done @@ -346,12 +358,12 @@ clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ + test "$$dir" = "$$p" && dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libntfs-gnomevfs.la: $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_DEPENDENCIES) - $(LINK) $(am_libntfs_gnomevfs_la_rpath) $(libntfs_gnomevfs_la_LDFLAGS) $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_LIBADD) $(LIBS) + $(LINK) -rpath $(gnomevfsmoduleslibdir) $(libntfs_gnomevfs_la_LDFLAGS) $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_LIBADD) $(LIBS) libntfs.la: $(libntfs_la_OBJECTS) $(libntfs_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libntfs_la_LDFLAGS) $(libntfs_la_OBJECTS) $(libntfs_la_LIBADD) $(LIBS) @@ -386,35 +398,72 @@ distclean-compile: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +libntfs_gnomevfs_la-gnome-vfs-method.o: gnome-vfs-method.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.o -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.o `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.o `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c + +libntfs_gnomevfs_la-gnome-vfs-method.obj: gnome-vfs-method.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.obj -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.obj `if test -f 'gnome-vfs-method.c'; then $(CYGPATH_W) 'gnome-vfs-method.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-method.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.obj `if test -f 'gnome-vfs-method.c'; then $(CYGPATH_W) 'gnome-vfs-method.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-method.c'; fi` + libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c +libntfs_gnomevfs_la-gnome-vfs-module.o: gnome-vfs-module.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.o -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.o `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.o `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c + +libntfs_gnomevfs_la-gnome-vfs-module.obj: gnome-vfs-module.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.obj -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.obj `if test -f 'gnome-vfs-module.c'; then $(CYGPATH_W) 'gnome-vfs-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-module.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.obj `if test -f 'gnome-vfs-module.c'; then $(CYGPATH_W) 'gnome-vfs-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-module.c'; fi` + libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c mostlyclean-libtool: @@ -476,7 +525,7 @@ install-gnomevfsmodulesconfDATA: $(gnomevfsmodulesconf_DATA) test -z "$(gnomevfsmodulesconfdir)" || $(mkdir_p) "$(DESTDIR)$(gnomevfsmodulesconfdir)" @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(gnomevfsmodulesconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f'"; \ $(gnomevfsmodulesconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ done @@ -484,7 +533,7 @@ install-gnomevfsmodulesconfDATA: $(gnomevfsmodulesconf_DATA) uninstall-gnomevfsmodulesconfDATA: @$(NORMAL_UNINSTALL) @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f'"; \ rm -f "$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ done @@ -509,11 +558,9 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -590,7 +637,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/ltmain.sh b/ltmain.sh index 239bdefb..5eb4c3a3 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -48,9 +48,6 @@ EOF exit 0 fi -# define SED for historic ltconfig's generated by Libtool 1.3 -test -z "$SED" && SED=sed - # The name of this program. progname=`$echo "$0" | ${SED} 's%^.*/%%'` modename="$progname" @@ -58,8 +55,8 @@ modename="$progname" # Constants. PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.4.3 -TIMESTAMP=" (1.922.2.110 2002/10/23 01:39:54)" +VERSION=1.5.2 +TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08)" default_mode= help="Try \`$progname --help' for more information." @@ -72,17 +69,17 @@ rm="rm -f" # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' -# test EBCDIC or ASCII -case `echo A|od -x` in - *[Cc]1*) # EBCDIC based system - SP2NL="tr '\100' '\n'" - NL2SP="tr '\r\n' '\100\100'" - ;; - *) # Assume ASCII based system - SP2NL="tr '\040' '\012'" - NL2SP="tr '\015\012' '\040\040'" - ;; -esac +# test EBCDIC or ASCII +case `echo A|tr A '\301'` in + A) # EBCDIC based system + SP2NL="tr '\100' '\n'" + NL2SP="tr '\r\n' '\100\100'" + ;; + *) # Assume ASCII based system + SP2NL="tr '\040' '\012'" + NL2SP="tr '\015\012' '\040\040'" + ;; +esac # NLS nuisances. # Only set LANG and LC_ALL to C if already set. @@ -97,11 +94,12 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -: ${IFS=" "} +: ${IFS=" +"} if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - echo "$modename: not configured to build any kind of library" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + $echo "$modename: not configured to build any kind of library" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 fi @@ -117,8 +115,51 @@ execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +win32_libid () { + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` + if test "X$win32_nmres" = "Ximport" ; then + win32_libid_type="x86 archive import" + else + win32_libid_type="x86 archive static" + fi + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + +# End of Shell function definitions +##################################### + # Parse our command line options once, thoroughly. -while test $# -gt 0 +while test "$#" -gt 0 do arg="$1" shift @@ -134,6 +175,34 @@ do execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit 1 + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; *) eval "$prev=\$arg" ;; @@ -151,18 +220,27 @@ do ;; --version) - echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2003 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." exit 0 ;; --config) ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" + done exit 0 ;; --debug) - echo "$progname: enabling shell trace mode" + $echo "$progname: enabling shell trace mode" set -x + preserve_args="$preserve_args $arg" ;; --dry-run | -n) @@ -170,16 +248,16 @@ do ;; --features) - echo "host: $host" + $echo "host: $host" if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" + $echo "enable shared libraries" else - echo "disable shared libraries" + $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - echo "enable static libraries" + $echo "enable static libraries" else - echo "disable static libraries" + $echo "disable static libraries" fi exit 0 ;; @@ -193,6 +271,15 @@ do --quiet | --silent) show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) prevopt="--tag" prev=tag ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" ;; -dlopen) @@ -219,17 +306,6 @@ if test -n "$prevopt"; then exit 1 fi -# Mandrake: (gc) It's bad to link C++ code with GCC, so we need to use the compiler name if provided -if test "$mode" = link && test -n "$archive_cmds" && test -x "/usr/bin/perl"; then - case $nonopt in - *cc | *++ | gcc* | *-gcc* | egcs*) - archive_cmds=`echo $archive_cmds | perl -pe 's/^\S+\s+//'` - archive_cmds="$nonopt $archive_cmds" - archive_expsym_cmds=`echo $archive_expsym_cmds | perl -pe 's/^\S+\s+//'` - archive_expsym_cmds="$nonopt $archive_expsym_cmds" - esac -fi - # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. @@ -239,8 +315,10 @@ if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 case $nonopt in - *cc | *++ | gcc* | *-gcc* | xlc*) + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do @@ -295,50 +373,193 @@ if test -z "$show_help"; then modename="$modename: compile" # Get the compilation command and the source file. base_compile= - prev= - lastarg= - srcfile="$nonopt" + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes suppress_output= + arg_mode=normal + libobj= + later= - user_target=no for arg do - case $prev in - "") ;; - xcompiler) - # Aesthetically quote the previous argument. - prev= - lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg_mode" in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; - case $arg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi + target ) + libobj="$arg" + arg_mode=normal continue ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; esac - # Accept any command-line options. - case $arg in - -o) - if test "$user_target" != "no"; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - user_target=next - ;; + base_compile="$base_compile $lastarg" + done # for arg + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit 1 + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + # Infer tagged configuration to use if any are available and + # if one wasn't chosen via the "--tag" command line option. + # Only attempt this if the compiler in the base compile + # command doesn't match the default compiler. + if test -n "$available_tags" && test -z "$tagname"; then + case $base_compile in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" + case "$base_compile " in + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit 1 +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi + + for arg in $later; do + case $arg in -static) build_old_libs=yes continue @@ -353,122 +574,17 @@ if test -z "$show_help"; then pic_mode=no continue ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - continue - ;; esac - - case $user_target in - next) - # The next one is the -o target name - user_target=yes - continue - ;; - yes) - # We got the output file - user_target=set - libobj="$arg" - continue - ;; - esac - - # Accept the current argument as the source file. - lastarg="$srcfile" - srcfile="$arg" - - # Aesthetically quote the previous argument. - - # Backslashify any backslashes, double quotes, and dollar signs. - # These are the only characters that are still specially - # interpreted inside of double-quoted scrings. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $lastarg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi done - case $user_target in - set) - ;; - no) - # Get the name of the library object. - libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - *) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSfmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit 1 - ;; - esac + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 @@ -478,9 +594,9 @@ if test -z "$show_help"; then # Delete any leftover library objects. if test "$build_old_libs" = yes; then - removelist="$obj $libobj" + removelist="$obj $lobj $libobj ${libobj}T" else - removelist="$libobj" + removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist @@ -505,6 +621,7 @@ if test -z "$show_help"; then removelist="$removelist $output_obj $lockfile" trap "$run $rm $removelist; exit 1" 1 2 15 else + output_obj= need_locks=no lockfile= fi @@ -518,7 +635,7 @@ if test -z "$show_help"; then done elif test "$need_locks" = warn; then if test -f "$lockfile"; then - echo "\ + $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` @@ -532,56 +649,55 @@ compiler." $run $rm $removelist exit 1 fi - echo $srcfile > "$lockfile" + $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != x"$srcfile"; then - echo "\ + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -610,9 +726,9 @@ compiler." fi # Just move the object if needed, then go on to compile the next one - if test x"$output_obj" != x"$libobj"; then - $show "$mv $output_obj $libobj" - if $run $mv $output_obj $libobj; then : + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist @@ -620,48 +736,23 @@ compiler." fi fi - # If we have no pic_flag, then copy the object into place and finish. - if (test -z "$pic_flag" || test "$pic_mode" != default) && - test "$build_old_libs" = yes; then - # Rename the .lo from within objdir to obj - if test -f $obj; then - $show $rm $obj - $run $rm $obj - fi + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != x"$srcfile"; then - echo "\ + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -709,7 +798,7 @@ compiler." fi # Just move the object if needed - if test x"$output_obj" != x"$obj"; then + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else @@ -719,23 +808,25 @@ compiler." fi fi - # Create an invalid libtool object if no PIC, so that we do not - # accidentally link it into a program. - if test "$build_libtool_libs" != yes; then - $show "echo timestamp > $libobj" - $run eval "echo timestamp > \$libobj" || exit $? - else - # Move the .lo from within objdir - $show "$mv $libobj $lo_libobj" - if $run $mv $libobj $lo_libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T < /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" + case $base_compile in + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) + # The compiler in $compile_command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit 1 +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi # We need to know -static, to get the right output filenames. for arg @@ -838,7 +974,7 @@ compiler." test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. - while test $# -gt 0; do + while test "$#" -gt 0; do arg="$1" shift case $arg in @@ -913,16 +1049,128 @@ compiler." prev= continue ;; - inst_prefix) + inst_prefix) inst_prefix_dir="$arg" prev= continue ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; release) release="-$arg" prev= continue ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit 1 + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit 1 + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit 1 + fi + arg=$save_arg + prev= + continue + ;; rpath | xrpath) # We need an absolute path. case $arg in @@ -961,13 +1209,21 @@ compiler." finalize_command="$finalize_command $wl$qarg" continue ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac - fi # test -n $prev + fi # test -n "$prev" prevarg="$arg" @@ -1028,7 +1284,7 @@ compiler." # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in - no/*-*-irix* | no/*-*-nonstopux*) + no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; @@ -1083,24 +1339,61 @@ compiler." # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd*) - # Do not include libc_r directly, use -pthread flag. + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" continue - ;; esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac fi deplibs="$deplibs $arg" continue ;; + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + deplibs="$deplibs $arg" + continue + ;; + -module) module=yes continue ;; + # gcc -m* arguments should be passed to the linker via $compiler_flags + # in order to pass architecture information to the linker + # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo + # but this is not reliable with gcc because gcc may use -mfoo to + # select a different linker, different libraries, etc, while + # -Wl,-mfoo simply passes -mfoo to the linker. + -m*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + if test "$with_gcc" = "yes" ; then + compiler_flags="$compiler_flags $arg" + fi + continue + ;; + + -shrext) + prev=shrext + continue + ;; + -no-fast-install) fast_install=no continue @@ -1125,8 +1418,18 @@ compiler." continue ;; + -objectlist) + prev=objectlist + continue + ;; + -o) prev=output ;; + -precious-files-regex) + prev=precious_regex + continue + ;; + -release) prev=release continue @@ -1177,6 +1480,11 @@ compiler." prev=vinfo continue ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` @@ -1225,6 +1533,11 @@ compiler." continue ;; + -XCClinker) + prev=xcclinker + continue + ;; + # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need @@ -1237,29 +1550,101 @@ compiler." esac ;; - *.lo | *.$objext) - # A library or standard object. - if test "$prev" = dlfiles; then - # This file was specified with -dlopen. - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $arg" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi + *.$objext) + # A standard object. + objs="$objs $arg" + ;; - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` - prev= - else + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. case $arg in - *.lo) libobjs="$libobjs $arg" ;; - *) objs="$objs $arg" ;; + */* | *\\*) . $arg ;; + *) . ./$arg ;; esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit 1 + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit 1 + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi fi ;; @@ -1319,6 +1704,7 @@ compiler." finalize_command="$finalize_command $arg" fi + oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" @@ -1339,11 +1725,11 @@ compiler." output_objdir="$output_objdir/$objdir" fi # Create the object directory. - if test ! -d $output_objdir; then + if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? - if test $status -ne 0 && test ! -d $output_objdir; then + if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi @@ -1361,7 +1747,17 @@ compiler." *) linkmode=prog ;; # Anything else should be a program. esac + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplcations in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac specialdeplibs= + libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) @@ -1373,6 +1769,25 @@ compiler." fi libs="$libs $deplib" done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + deplibs= newdependency_libs= newlib_search_path= @@ -1404,39 +1819,59 @@ compiler." ;; esac for pass in $passes; do - if test $linkmode = prog; then - # Determine which files to process + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then case $pass in - dlopen) - libs="$dlfiles" - save_deplibs="$deplibs" # Collect dlpreopened libraries - deplibs= - ;; + dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi for deplib in $libs; do lib= found=no case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + fi + continue + ;; -l*) - if test $linkmode = oldlib && test $linkmode = obj; then - $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - # Search the libtool library - lib="$searchdir/lib${name}.la" - if test -f "$lib"; then - found=yes - break - fi + for search_ext in .la $shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library @@ -1445,25 +1880,61 @@ compiler." finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" - test $pass = conv && continue + test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi - if test $pass = scan; then + if test "$pass" = scan; then deplibs="$deplib $deplibs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else @@ -1472,13 +1943,13 @@ compiler." fi ;; *) - $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) - if test $pass = link; then + if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in @@ -1491,30 +1962,30 @@ compiler." ;; *.la) lib="$deplib" ;; *.$libext) - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) if test "$deplibs_check_method" != pass_all; then - echo - echo "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not used here." + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." else - echo - echo "*** Warning: Linking the shared library $output against the" - echo "*** static library $deplib is not portable!" + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) - if test $pass != link; then + if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -1525,14 +1996,18 @@ compiler." esac # linkmode ;; # *.$libext *.lo | *.$objext) - if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi fi continue ;; @@ -1541,14 +2016,14 @@ compiler." continue ;; esac # case $deplib - if test $found = yes || test -f "$lib"; then : + if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 exit 1 fi # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 @@ -1564,8 +2039,9 @@ compiler." library_names= old_library= # If the library was installed with an old release of libtool, - # it will not redefine variable installed. + # it will not redefine variables installed, or shouldnotlink installed=yes + shouldnotlink=no # Read the .la file case $lib in @@ -1575,13 +2051,12 @@ compiler." if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || - { test $linkmode = oldlib && test $linkmode = obj; }; then - # Add dl[pre]opened files of deplib + { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi - if test $pass = conv; then + if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then @@ -1602,13 +2077,14 @@ compiler." fi tmp_libs="$tmp_libs $deplib" done - elif test $linkmode != prog && test $linkmode != lib; then + elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 exit 1 fi continue fi # $pass = conv + # Get the name of the library we link against. linklib= for l in $old_library $library_names; do @@ -1620,15 +2096,17 @@ compiler." fi # This library was specified with -dlopen. - if test $pass = dlopen; then + if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 exit 1 fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. - dlprefiles="$dlprefiles $lib" + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi @@ -1669,7 +2147,7 @@ compiler." name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. - if test $pass = dlpreopen; then + if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 exit 1 @@ -1688,18 +2166,19 @@ compiler." if test -z "$libdir"; then # Link the convenience library - if test $linkmode = lib; then + if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else - deplibs="$lib $deplibs" + deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi - if test $linkmode = prog && test $pass != link; then + + if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" @@ -1715,7 +2194,7 @@ compiler." -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? - if test $linkalldeplibs = yes; then + if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths @@ -1732,13 +2211,19 @@ compiler." continue fi # $linkmode = prog... - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # Link against this shared library + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi - if test "$linkmode,$pass" = "prog,link" || - { test $linkmode = lib && test $hardcode_into_libs = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. @@ -1760,17 +2245,6 @@ compiler." esac ;; esac - if test $linkmode = prog; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - fi fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && @@ -1780,11 +2254,51 @@ compiler." # We only need to search for static libraries continue fi + fi + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi + # This is a shared library + + # Warn about portability, can't link against -module's on some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname @@ -1798,7 +2312,7 @@ compiler." elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin*) + *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; @@ -1810,17 +2324,18 @@ compiler." # Make a new name for the extract_expsyms_cmds to use soroot="$soname" - soname=`echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" + cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -1831,9 +2346,10 @@ compiler." if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" + cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -1842,9 +2358,9 @@ compiler." # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib - fi # test -n $old_archive_from_expsyms_cmds + fi # test -n "$old_archive_from_expsyms_cmds" - if test $linkmode = prog || test "$mode" != relink; then + if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= @@ -1853,6 +2369,22 @@ compiler." immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" + case $host in + *-*-sco3.2v5* ) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against it, someone + # is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; @@ -1871,6 +2403,14 @@ compiler." add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" @@ -1893,7 +2433,7 @@ compiler." *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi - if test $linkmode = prog; then + if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else @@ -1910,9 +2450,8 @@ compiler." fi fi - if test $linkmode = prog || test "$mode" = relink; then + if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= - add_prefix_dir= add_dir= add= # Finalize command for both is simple: just hardcode it. @@ -1927,43 +2466,35 @@ compiler." *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi add="-l$name" fi - - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_prefix_dir="-L$inst_prefix_dir$libdir" - ;; - esac - fi - - # add_prefix_dir must be appended instead, otherwise it can - # possibly be overrided by any hardcoded -L/... path in deplibs - if test $linkmode = prog; then - test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir" + if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else - test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir" test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi - elif test $linkmode = prog; then - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - - # Try to link the static library + elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. @@ -1983,21 +2514,21 @@ compiler." # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - echo - echo "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -2014,10 +2545,10 @@ compiler." fi fi # link shared/static library? - if test $linkmode = lib; then + if test "$linkmode" = lib; then if test -n "$dependency_libs" && - { test $hardcode_into_libs != yes || test $build_old_libs = yes || - test $link_static = yes; }; then + { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || + test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do @@ -2048,7 +2579,7 @@ compiler." tmp_libs="$tmp_libs $deplib" done - if test $link_all_deplibs != no; then + if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in @@ -2068,7 +2599,7 @@ compiler." ;; esac if grep "^installed=no" $deplib > /dev/null; then - path="-L$absdir/$objdir" + path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then @@ -2078,12 +2609,57 @@ compiler." if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi - path="-L$absdir" + path="$absdir" fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac ;; *) continue ;; esac case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$deplibs $depdepl" ;; + esac + case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac @@ -2091,15 +2667,15 @@ compiler." fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs - if test $pass = dlpreopen; then + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi - if test $pass != dlopen; then - test $pass != scan && dependency_libs="$newdependency_libs" - if test $pass != conv; then + if test "$pass" != dlopen; then + if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do @@ -2121,9 +2697,30 @@ compiler." eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) @@ -2151,19 +2748,31 @@ compiler." eval $var=\"$tmp_libs\" done # for var fi - if test "$pass" = "conv" && - { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then - libs="$deplibs" # reset libs - deplibs= - fi + # Last step: remove runtime libs from dependency_libs (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs done # for pass - if test $linkmode = prog; then + if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi @@ -2177,7 +2786,7 @@ compiler." fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then @@ -2199,6 +2808,7 @@ compiler." case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext\" eval libname=\"$libname_spec\" ;; *) @@ -2210,6 +2820,7 @@ compiler." if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` @@ -2222,9 +2833,9 @@ compiler." $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 exit 1 else - echo - echo "*** Warning: Linking the shared library $output against the non-libtool" - echo "*** objects $objs is not portable!" + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi @@ -2234,7 +2845,7 @@ compiler." fi set dummy $rpath - if test $# -gt 2; then + if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" @@ -2243,14 +2854,16 @@ compiler." if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. - libext=al + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then @@ -2269,13 +2882,50 @@ compiler." exit 1 fi - current="$2" - revision="$3" - age="$4" + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac # Check that each of the things are valid numbers. case $current in - [0-9]*) ;; + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2284,7 +2934,7 @@ compiler." esac case $revision in - [0-9]*) ;; + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2293,7 +2943,7 @@ compiler." esac case $age in - [0-9]*) ;; + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2301,7 +2951,7 @@ compiler." ;; esac - if test $age -gt $current; then + if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 @@ -2345,7 +2995,7 @@ compiler." # Add in all the interfaces that we are compatible with. loop=$revision - while test $loop != 0; do + while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" @@ -2368,7 +3018,7 @@ compiler." # Add in all the interfaces that we are compatible with. loop=$age - while test $loop != 0; do + while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" @@ -2392,7 +3042,7 @@ compiler." *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 exit 1 ;; esac @@ -2400,12 +3050,11 @@ compiler." # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= - verstring="0.0" case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely - verstring="" + verstring= ;; *) verstring="0.0" @@ -2439,9 +3088,28 @@ compiler." fi if test "$mode" != relink; then - # Remove our outputs. - $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" - $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi fi # Now set the variables for building old libraries. @@ -2454,9 +3122,9 @@ compiler." # Eliminate all temporary directories. for path in $notinst_path; do - lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then @@ -2469,7 +3137,7 @@ compiler." *) finalize_rpath="$finalize_rpath $libdir" ;; esac done - if test $hardcode_into_libs != yes || test $build_old_libs = yes; then + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi @@ -2509,10 +3177,11 @@ compiler." ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue ;; - *) + *) # Add libc to deplibs on all other systems if necessary. - if test $build_libtool_need_lc = "yes"; then + if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; @@ -2539,7 +3208,7 @@ compiler." # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behaviour. + # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) @@ -2552,45 +3221,22 @@ compiler." int main() { return 0; } EOF $rm conftest - $CC -o conftest conftest.c $deplibs - if test $? -eq 0 ; then + $LTCC -o conftest conftest.c $deplibs + if test "$?" -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do name="`expr $i : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - echo - echo "*** Warning: dynamic linker does not accept needed library $i." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which I believe you do not have" - echo "*** because a test_compile did reveal that the linker did not use it for" - echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occured in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - $rm conftest - $CC -o conftest conftest.c $i - # Did it work? - if test $? -eq 0 ; then - ldd_output=`ldd conftest` + if test "$name" != "" && test "$name" -ne "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then libname=`eval \\$echo \"$libname_spec\"` deplib_matches=`eval \\$echo \"$library_names_spec\"` set dummy $deplib_matches @@ -2599,21 +3245,64 @@ EOF newdeplibs="$newdeplibs $i" else droppeddeps=yes - echo - echo "*** Warning: dynamic linker does not accept needed library $i." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because a test_compile did reveal that the linker did not use this one" - echo "*** as a dynamic dependency that programs can get resolved with at runtime." + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which I believe you do not have" + $echo "*** because a test_compile did reveal that the linker did not use it for" + $echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occurred in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" != "0"; then + $rm conftest + $LTCC -o conftest conftest.c $i + # Did it work? + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because a test_compile did reveal that the linker did not use this one" + $echo "*** as a dynamic dependency that programs can get resolved with at runtime." + fi fi else droppeddeps=yes - echo - echo "*** Warning! Library $i is needed by this library but I was not able to" - echo "*** make it link in! You will probably need to install it or some" - echo "*** library that it depends on before this library will be fully" - echo "*** functional. Installing it before continuing would be even better." + $echo + $echo "*** Warning! Library $i is needed by this library but I was not able to" + $echo "*** make it link in! You will probably need to install it or some" + $echo "*** library that it depends on before this library will be fully" + $echo "*** functional. Installing it before continuing would be even better." fi else newdeplibs="$newdeplibs $i" @@ -2627,11 +3316,20 @@ EOF for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do + if test "$name" != "" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then @@ -2650,35 +3348,29 @@ EOF *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done - # It is ok to link against an archive when - # building a shared library. - if $AR -t $potlib > /dev/null 2>&1; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ - | egrep "$file_magic_regex" > /dev/null; then + | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi - done - done + done + done + fi if test -n "$a_deplib" ; then droppeddeps=yes - echo - echo "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - echo "*** with $libname but no candidates were found. (...for file magic test)" + $echo "*** with $libname but no candidates were found. (...for file magic test)" else - echo "*** with $libname and none of the candidates passed a file format test" - echo "*** using a file magic. Last file checked: $potlib" + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" fi fi else @@ -2694,33 +3386,43 @@ EOF name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check below in file_magic test - if eval echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | egrep "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done done - done + fi if test -n "$a_deplib" ; then droppeddeps=yes - echo - echo "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - echo "*** with $libname but no candidates were found. (...for regex pattern test)" + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else - echo "*** with $libname and none of the candidates passed a file format test" - echo "*** using a regex pattern. Last file checked: $potlib" + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else @@ -2731,16 +3433,23 @@ EOF ;; none | unknown | *) newdeplibs="" - if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | - grep . >/dev/null; then - echo + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." + $echo "*** Warning: inter-library dependencies are not supported in this platform." else - echo "*** Warning: inter-library dependencies are not known to be supported." + $echo "*** Warning: inter-library dependencies are not known to be supported." fi - echo "*** All declared inter-library dependencies are being dropped." + $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; @@ -2760,17 +3469,17 @@ EOF if test "$droppeddeps" = yes; then if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - echo "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -2780,16 +3489,16 @@ EOF build_libtool_libs=no fi else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." - if test $allow_undefined = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -2811,7 +3520,7 @@ EOF # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then - if test $hardcode_into_libs = yes; then + if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= @@ -2847,7 +3556,11 @@ EOF if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" - eval dep_rpath=\"$hardcode_libdir_flag_spec\" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. @@ -2867,6 +3580,7 @@ EOF fi # Get the real and link names of the library. + eval shared_ext=\"$shrext\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" @@ -2877,7 +3591,9 @@ EOF else soname="$realname" fi - test -z "$dlname" && dlname=$soname + if test -z "$dlname"; then + dlname=$soname + fi lib="$output_objdir/$realname" for link @@ -2885,23 +3601,6 @@ EOF linknames="$linknames $link" done - # Ensure that we have .o objects for linkers which dislike .lo - # (e.g. aix) in case we are running --disable-static - for obj in $libobjs; do - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - if test ! -f $xdir/$oldobj; then - $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" - $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? - fi - done - # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -2911,17 +3610,26 @@ EOF $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" + cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then - $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi @@ -2932,17 +3640,29 @@ EOF $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" status=$? - if test $status -ne 0 && test ! -d "$gentop"; then + if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" @@ -2958,16 +3678,42 @@ EOF $show "${rm}r $xdir" $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" status=$? - if test $status -ne 0 && test ! -d "$xdir"; then + if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi - libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done fi fi @@ -2983,25 +3729,148 @@ EOF fi # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi else - save_deplibs="$deplibs" - for conv in $convenience; do - tmp_deplibs= - for test_deplib in $deplibs; do - if test "$test_deplib" != "$conv"; then - tmp_deplibs="$tmp_deplibs $test_deplib" + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$save_output-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi - done - deplibs="$tmp_deplibs" + last_robj=$output_objdir/$save_output-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$save_output-${k}.$objext + objlist=$obj + len=1 + fi done - eval cmds=\"$archive_cmds\" - deplibs="$save_deplibs" + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadale object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3089,10 +3958,10 @@ EOF gentop="$output_objdir/${obj}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" status=$? - if test $status -ne 0 && test ! -d "$gentop"; then + if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" @@ -3108,16 +3977,42 @@ EOF $show "${rm}r $xdir" $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" status=$? - if test $status -ne 0 && test ! -d "$xdir"; then + if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi - reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done fi fi @@ -3126,10 +4021,11 @@ EOF reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" - eval cmds=\"$reload_cmds\" + cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3153,8 +4049,8 @@ EOF # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. - $show "echo timestamp > $libobj" - $run eval "echo timestamp > $libobj" || exit $? + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? exit 0 fi @@ -3162,28 +4058,15 @@ EOF # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" - eval cmds=\"$reload_cmds\" + cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" - else - # Just create a symlink. - $show $rm $libobj - $run $rm $libobj - xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$libobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - $show "(cd $xdir && $LN_S $oldobj $baseobj)" - $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then @@ -3196,7 +4079,7 @@ EOF prog) case $host in - *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 @@ -3218,16 +4101,19 @@ EOF # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - ;; - esac ;; esac + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -3378,12 +4264,12 @@ extern \"C\" { done if test -n "$exclude_expsyms"; then - $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then - $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi @@ -3401,8 +4287,8 @@ extern \"C\" { for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" - name=`echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval 'echo ": $name " >> "$nlist"' + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done @@ -3411,7 +4297,7 @@ extern \"C\" { test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then - egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi @@ -3431,7 +4317,7 @@ extern \"C\" { if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else - echo '/* NONE */' >> "$output_objdir/$dlsyms" + $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ @@ -3483,18 +4369,18 @@ static const void *lt_preloaded_setup() { *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC";; + *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" @@ -3519,7 +4405,7 @@ static const void *lt_preloaded_setup() { finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi - if test $need_relink = no || test "$build_libtool_libs" != yes; then + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" @@ -3664,13 +4550,228 @@ static const void *lt_preloaded_setup() { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in - *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in - *cygwin*) exeext=.exe ;; + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac + case $host in + *cygwin* | *mingw* ) + cwrappersource=`$echo ${objdir}/lt-${output}.c` + cwrapper=`$echo ${output}.exe` + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +#define DIR_SEPARATOR '/' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +#define HAVE_DOS_BASED_FILE_SYSTEM +#ifndef DIR_SEPARATOR_2 +#define DIR_SEPARATOR_2 '\\' +#endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +char * basename (const char *name); +char * fnqualify(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup ((char *) basename (argv[0])); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = fnqualify(argv[0]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +char * +basename (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha (name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return (char *) base; +} + +char * +fnqualify(const char *path) +{ + size_t size; + char *p; + char tmp[LT_PATHMAX + 1]; + + assert(path != NULL); + + /* Is it qualified already? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha (path[0]) && path[1] == ':') + return xstrdup (path); +#endif + if (IS_DIR_SEPARATOR (path[0])) + return xstrdup (path); + + /* prepend the current directory */ + /* doesn't handle '~' */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ + p = XMALLOC(char, size); + sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); + return p; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC -s -o $cwrapper $cwrappersource + ;; + esac $rm $output trap "$rm $output; exit 1" 1 2 15 @@ -3688,7 +4789,7 @@ static const void *lt_preloaded_setup() { # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' +Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout @@ -3748,7 +4849,7 @@ else " if test "$fast_install" = yes; then - echo >> $output "\ + $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" @@ -3764,7 +4865,7 @@ else $rm \"\$progdir/\$file\" fi" - echo >> $output "\ + $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then @@ -3782,13 +4883,13 @@ else $rm \"\$progdir/\$file\" fi" else - echo >> $output "\ + $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi - echo >> $output "\ + $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" @@ -3799,7 +4900,7 @@ else $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 ${SED} + # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var @@ -3819,14 +4920,6 @@ else # Run the actual program with our arguments. " case $host in - # win32 systems need to use the prog path for dll - # lookup to work - *-*-cygwin* | *-*-pw32*) - $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} -" - ;; - # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ @@ -3836,11 +4929,7 @@ else *) $echo >> $output "\ - # Export the path to the program. - PATH=\"\$progdir:\$PATH\" - export PATH - - exec \$program \${1+\"\$@\"} + exec \$progdir/\$program \${1+\"\$@\"} " ;; esac @@ -3852,7 +4941,7 @@ else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 - echo \"See the $PACKAGE documentation for more information.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ @@ -3875,7 +4964,7 @@ fi\ oldobjs="$libobjs_save" build_libtool_libs=no else - oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi @@ -3884,10 +4973,10 @@ fi\ gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" status=$? - if test $status -ne 0 && test ! -d "$gentop"; then + if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" @@ -3904,14 +4993,40 @@ fi\ $show "${rm}r $xdir" $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" status=$? - if test $status -ne 0 && test ! -d "$xdir"; then + if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` done @@ -3919,30 +5034,71 @@ fi\ # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" + cmds=$old_archive_from_new_cmds else - # Ensure that we have .o objects in place in case we decided - # not to build a shared library, and have fallen back to building - # static libs even though --disable-static was passed! - for oldobj in $oldobjs; do - if test ! -f $oldobj; then - xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$oldobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` - obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` - $show "(cd $xdir && ${LN_S} $obj $baseobj)" - $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? - fi - done - eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do + eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? @@ -3974,9 +5130,11 @@ fi\ fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command="(cd `pwd`; $SHELL $0 $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - + if test "$hardcode_automatic" = yes ; then + relink_command= + fi # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do @@ -4024,12 +5182,31 @@ fi\ newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file @@ -4058,13 +5235,16 @@ revision=$revision # Is this an already installed library? installed=$installed +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" - if test "$installed" = no && test $need_relink = yes; then + if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi @@ -4200,7 +5380,7 @@ relink_command=\"$relink_command\"" # Not a directory, so check to see that there is only one file specified. set dummy $files - if test $# -gt 2; then + if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 exit 1 @@ -4240,7 +5420,7 @@ relink_command=\"$relink_command\"" *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 @@ -4276,11 +5456,14 @@ relink_command=\"$relink_command\"" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 exit 1 @@ -4288,9 +5471,9 @@ relink_command=\"$relink_command\"" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 @@ -4298,7 +5481,7 @@ relink_command=\"$relink_command\"" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - continue + exit 1 fi fi @@ -4320,7 +5503,7 @@ relink_command=\"$relink_command\"" $run eval "$striplib $destdir/$realname" || exit $? fi - if test $# -gt 0; then + if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do @@ -4333,10 +5516,11 @@ relink_command=\"$relink_command\"" # Do each command in the postinstall commands. lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" + cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4406,23 +5590,43 @@ relink_command=\"$relink_command\"" destfile="$destdir/$destfile" fi + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) - wrapper=`echo $file | ${SED} -e 's,.exe$,,'` + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac - if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac # If there is no directory component, then add one. case $file in - */* | *\\*) . $wrapper ;; - *) . ./$wrapper ;; + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. @@ -4450,10 +5654,17 @@ relink_command=\"$relink_command\"" done relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac # If there is no directory component, then add one. case $file in - */* | *\\*) . $wrapper ;; - *) . ./$wrapper ;; + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; esac outputname= @@ -4461,17 +5672,16 @@ relink_command=\"$relink_command\"" if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` - if test $? = 0 ; then : - else - tmpdir="$tmpdir/libtool-$$" - fi - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + if tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`; then : else - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue + tmpdir="$tmpdir/libtool-$$" + if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi fi - file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` @@ -4489,14 +5699,14 @@ relink_command=\"$relink_command\"" fi else # Install the binary that we compiled earlier. - file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in - /usr/bin/install*,*cygwin*) + */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok @@ -4505,7 +5715,7 @@ relink_command=\"$relink_command\"" destfile=$destfile.exe ;; *:*.exe) - destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; @@ -4526,16 +5736,17 @@ relink_command=\"$relink_command\"" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? - if test -n "$stripme" && test -n "$striplib"; then + if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" + cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4549,7 +5760,7 @@ relink_command=\"$relink_command\"" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $0 --finish$current_libdirs' + exec_cmd='$SHELL $0 $preserve_args --finish$current_libdirs' else exit 0 fi @@ -4570,10 +5781,11 @@ relink_command=\"$relink_command\"" for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" + cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" @@ -4590,42 +5802,42 @@ relink_command=\"$relink_command\"" fi # Exit here if they wanted silent mode. - test "$show" = ":" && exit 0 + test "$show" = : && exit 0 - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" + $echo "----------------------------------------------------------------------" + $echo "Libraries have been installed in:" for libdir in $libdirs; do - echo " $libdir" + $echo " $libdir" done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" fi if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" - echo " - use the \`$flag' linker flag" + $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then - echo " - have your system administrator run these commands:$admincmds" + $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi - echo - echo "See any operating system documentation about shared libraries for" - echo "more information, such as the ld(1) and ld.so(8) manual pages." - echo "----------------------------------------------------------------------" + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "----------------------------------------------------------------------" exit 0 ;; @@ -4653,7 +5865,7 @@ relink_command=\"$relink_command\"" case $file in *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 @@ -4724,7 +5936,7 @@ relink_command=\"$relink_command\"" -*) ;; *) # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; @@ -4747,7 +5959,7 @@ relink_command=\"$relink_command\"" eval "export $shlibpath_var" fi - # Restore saved enviroment variables + # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi @@ -4756,14 +5968,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" + exec_cmd="\"\$cmd\"$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - $echo "$cmd$args" + eval \$echo \"\$cmd\"$args exit 0 fi ;; @@ -4797,19 +6009,20 @@ relink_command=\"$relink_command\"" rmdirs= + origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. - objdir="$objdir" + objdir="$origobjdir" else - objdir="$dir/$objdir" + objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test $mode = uninstall && objdir="$dir" + test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates - if test $mode = clean; then + if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; @@ -4833,7 +6046,7 @@ relink_command=\"$relink_command\"" case $name in *.la) # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. @@ -4841,18 +6054,19 @@ relink_command=\"$relink_command\"" rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - if test $mode = uninstall; then + if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" + cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test $? != 0 && test "$rmforce" != yes; then + if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -4861,13 +6075,14 @@ relink_command=\"$relink_command\"" if test -n "$old_library"; then # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" + cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test $? != 0 && test "$rmforce" != yes; then + if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -4879,22 +6094,52 @@ relink_command=\"$relink_command\"" ;; *.lo) - if test "$build_old_libs" = yes; then - oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` - rmfiles="$rmfiles $dir/$oldobj" + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi fi ;; *) - # Do a test to see if this is a libtool program. - if test $mode = clean && - (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$file + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi fi fi ;; @@ -4902,6 +6147,7 @@ relink_command=\"$relink_command\"" $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done + objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -4949,6 +6195,7 @@ Provide generalized library-building support services. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: @@ -4962,7 +6209,9 @@ MODE must be one of the following: uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE." +a more detailed description of MODE. + +Report bugs to ." exit 0 ;; @@ -5074,6 +6323,9 @@ The following components of LINK-COMMAND are treated specially: -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries @@ -5119,11 +6371,31 @@ Otherwise, only FILE itself is deleted using RM." ;; esac -echo +$echo $echo "Try \`$modename --help' for more information about other modes." exit 0 +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + # Local Variables: # mode:shell-script # sh-indentation:2 diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 36d04951..aebbb48b 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9 from Makefile.am. +# Makefile.in generated by automake 1.8.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -61,8 +61,7 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 \ ntfsresize.8 ntfsundelete.8 -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \ - "$(DESTDIR)$(man8dir)" +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) @@ -124,6 +123,18 @@ ntfswipe_DEPENDENCIES = $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrdef.Po ./$(DEPDIR)/boot.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/cluster.Po ./$(DEPDIR)/mkntfs.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfscat.Po ./$(DEPDIR)/ntfsclone.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfscluster.Po ./$(DEPDIR)/ntfscp.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsdump_logfile.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsfix.Po ./$(DEPDIR)/ntfsinfo.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfslabel.Po ./$(DEPDIR)/ntfsls.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsmove.Po ./$(DEPDIR)/ntfsresize.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsrm.Po ./$(DEPDIR)/ntfstruncate.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfsundelete.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/ntfswipe.Po ./$(DEPDIR)/sd.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/upcase.Po ./$(DEPDIR)/utils.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ @@ -154,6 +165,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -164,6 +176,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -175,6 +191,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -204,18 +222,21 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -510,21 +531,24 @@ distclean-compile: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: @@ -602,11 +626,9 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -684,7 +706,7 @@ clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" From aa6067c107e6a0665bc2c2c60a0bc8a467fb5166 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 3 Sep 2004 09:30:16 +0000 Subject: [PATCH 1776/2994] Updates for 1.9.3 release. BKrev: 413839a8TX_rg6uOgYhxKMrR7lU1fw From 434d799fc96554af5ae25667ceeefbac6dabd1d1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 3 Sep 2004 09:42:22 +0000 Subject: [PATCH 1777/2994] Bump libntfs version number. (Logical change 1.521) --- libntfs/Makefile.am | 2 +- libntfs/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 0e0816d3..3df2822c 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -25,7 +25,7 @@ # - If the interface is the same as the previous version, change to C:R+1:A # -LTVERSION_LIBNTFS = 5:0:0 +LTVERSION_LIBNTFS = 6:0:1 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index df12cb16..0f69a8b3 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -231,7 +231,7 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -LTVERSION_LIBNTFS = 5:0:0 +LTVERSION_LIBNTFS = 6:0:1 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs lib_LTLIBRARIES = libntfs.la From 3b51248789147d221c4fdaab27ba56716e4de37e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 3 Sep 2004 09:42:22 +0000 Subject: [PATCH 1778/2994] Bump libntfs version number. BKrev: 41383c7em-gK_WYeuG5nP8ApcBDpzQ From afa5afcb06ba5269fb5ac985caaa84758630b512 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 3 Sep 2004 12:09:09 +0000 Subject: [PATCH 1779/2994] Rewrite in order to overcome the following limitations: ReadFile/WriteFile/SetPointer require aligned inputs (sector/memort wise) A volume does not have to cover the entire partition. While a volume is locked, its contents are not accessible via the disk handle. (Logical change 1.522) --- libntfs/win32_io.c | 805 +++++++++++++++++++++++++++++++++------------ 1 file changed, 599 insertions(+), 206 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 0ff66ecf..1e36584c 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -54,6 +54,17 @@ typedef struct ntfs_volume ntfs_volume; #define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS 5636096 #endif +#ifndef DiskGeometryGetPartition +#define DiskGeometryGetPartition(Geometry) \ + ((PDISK_PARTITION_INFO)((Geometry) + 1)) +#endif + +#ifndef DiskGeometryGetDetect +#define DiskGeometryGetDetect(Geometry)\ + ((PDISK_DETECTION_INFO)(((PBYTE)DiskGeometryGetPartition(Geometry) + \ + DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo))) +#endif + /* windows 2k+ imports */ typedef HANDLE (WINAPI *LPFN_FINDFIRSTVOLUME) (LPTSTR,DWORD); typedef BOOL (WINAPI *LPFN_FINDNEXTVOLUME) (HANDLE,LPTSTR,DWORD); @@ -67,14 +78,15 @@ static LPFN_FINDVOLUMECLOSE fnFindVolumeClose = NULL; #define FUNCTIONPOSTFIX "A" #endif -#define FORCE_ALIGNED_READ - typedef struct win32_fd { HANDLE handle; int part_hidden_sectors; s64 part_start; - s64 part_end; + s64 part_length; LARGE_INTEGER current_pos; + s64 geo_size, geo_cylinders; + DWORD geo_sectors, geo_heads; + HANDLE vol_handle; } win32_fd; #ifdef EMULATE_SETFILEPOINTEREX @@ -106,7 +118,7 @@ static int ntfs_w32error_to_errno(unsigned int w32error) Dprintf("win32_w32error_to_errno(%d).\n",w32error); switch (w32error) { case ERROR_INVALID_FUNCTION: - return ENOSYS; + return EBADRQC; case ERROR_FILE_NOT_FOUND: case ERROR_PATH_NOT_FOUND: case ERROR_INVALID_NAME: @@ -127,10 +139,12 @@ static int ntfs_w32error_to_errno(unsigned int w32error) case ERROR_WRITE_PROTECT: return EROFS; case ERROR_NOT_READY: + case ERROR_SHARING_VIOLATION: return EBUSY; case ERROR_BAD_COMMAND: return EINVAL; case ERROR_SEEK: + case ERROR_NEGATIVE_SEEK: return ESPIPE; case ERROR_NOT_SUPPORTED: return ENOTSUP; @@ -178,7 +192,7 @@ static __inline__ int ntfs_device_unix_status_flags_to_win32(int flags) * Supported flags are O_RDONLY, O_WRONLY and O_RDWR. * * Return 0 if o.k. - * -errno if not, in this case handle is trashed. + * -1 if not, and errno set. in this case handle is trashed. */ static int ntfs_device_win32_simple_open_file(const char *filename, HANDLE *handle, int flags, BOOL locking) @@ -189,34 +203,235 @@ static int ntfs_device_win32_simple_open_file(const char *filename, NULL, OPEN_EXISTING, 0, NULL); if (*handle == INVALID_HANDLE_VALUE) { - Dprintf("CreateFile(%s) failed.\n", filename); errno = ntfs_w32error_to_errno(GetLastError()); - return -errno; + Dprintf("CreateFile(%s) failed.\n", filename); + return -1; + } + return 0; +} + +/** + * ntfs_device_win32_lock - Lock the volume + * @handle: A win32 HADNLE for a volume to lock. + * + * Locking a volume means no one can access its contents. + * Exiting the process automatically unlocks the volume, except in old NT4s. + * + * Return 0 if o.k. + * -1 if not, and errno set. + */ +static int ntfs_device_win32_lock(HANDLE handle) +{ + DWORD i; + if (!DeviceIoControl(handle, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &i, + NULL)) { + errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: Couldn't lock volume."); + return -1; + } + Dputs("Volume locked."); + return 0; +} + +/** + * ntfs_device_win32_unlock - Unlock the volume + * @handle: The win32 HADNLE which the volume was locked with. + * + * Return 0 if o.k. + * -1 if not, and errno set. + */ +static int ntfs_device_win32_unlock(HANDLE handle) +{ + DWORD i; + if (!DeviceIoControl(handle, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &i, + NULL)) { + errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: Couldn't unlock volume."); + return -1; + } + Dputs("Volume unlocked."); + return 0; +} + +/** + * ntfs_device_win32_dismount - Dismount a volume + * @handle: A win32 HADNLE for a volume to dismount. + * + * Dismounting means the system will refresh the volume in the first change + * it gets. Usefull after altering the file structures. + * The volume must be locked by the current process while dismounting. + * A side effect is that the volume is also unlocked, but you mustn't rely + * On this. + * + * Return 0 if o.k. + * -1 if not, and errno set. + */ +static int ntfs_device_win32_dismount(HANDLE handle) +{ + DWORD i; + if (!DeviceIoControl(handle, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, + &i, NULL)) { + errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: Couldn't dismount volume."); + return -1; } else { + Dputs("Volume dismounted."); return 0; } } /** - * ntfs_win32_getsize - Get file size via win32 API + * ntfs_device_win32_getsize - Get file size via win32 API * @handle: Pointer the file HADNLE obtained via open. - * @argp: Pointer to result buffer. * - * Return 0 if o.k. - * -errno if not, in this case handle is trashed. + * Only works on ordinary files. + * + * Return The file size if o.k. + * -1 if not, and errno set. */ -static int ntfs_win32_getsize(HANDLE handle,s64 *argp) +static s64 ntfs_device_win32_getsize(HANDLE handle) { DWORD loword, hiword; loword = GetFileSize(handle, &hiword); - if (loword==INVALID_FILE_SIZE) { - Dputs("win32_getblksize(): FAILED!"); + if (loword == INVALID_FILE_SIZE) { errno = ntfs_w32error_to_errno(GetLastError()); - return -errno; + Dputs("Error: Couldn't get file size."); + return -1; } - *argp=((s64)hiword << 32) + (s64)loword; - return 0; + return ((s64)hiword << 32) + (s64)loword; +} + +/** + * ntfs_device_win32_getdisklength - Get disk size via win32 API + * @handle: Pointer the file HADNLE obtained via open. + * @argp: Pointer to result buffer. + * + * Only works on PhysicalDriveX type handles. + * + * Return The disk size if o.k. + * -1 if not, and errno set. + */ +static s64 ntfs_device_win32_getdisklength(HANDLE handle) +{ + GET_LENGTH_INFORMATION buf; + DWORD i; + + if (!DeviceIoControl(handle, IOCTL_DISK_GET_LENGTH_INFO, NULL, 0, &buf, + sizeof(buf), &i, NULL)) { + errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: Couldn't get disk length."); + return -1; + } else { + Dprintf("Disk length: %lld\n", buf.Length.QuadPart); + return buf.Length.QuadPart; + } +} + +/** + * ntfs_device_win32_getntfssize - Get NTFS volume size via win32 API + * @handle: Pointer the file HADNLE obtained via open. + * @argp: Pointer to result buffer. + * + * Only works on NTFS volume handles. + * An annoying bug in windows is that a NTFS volume does not occupy the + * Entire partition, namely not the last sector (Which holds the backup + * Boot sector, and normally not interesting). + * Use this function to get the length of the accessible space through a + * given volume handle. + * + * Return The volume size if o.k. + * -1 if not, and errno set. + */ +static s64 ntfs_device_win32_getntfssize(HANDLE handle) +{ + NTFS_VOLUME_DATA_BUFFER buf; + DWORD i; + + if (!DeviceIoControl(handle, FSCTL_GET_NTFS_VOLUME_DATA, NULL, 0, &buf, + sizeof(buf), &i, NULL)) { + errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Warnning: Couldn't get NTFS volume length."); + return -1; + } else { + s64 rvl = buf.NumberSectors.QuadPart * buf.BytesPerSector; + Dprintf("NTFS volume length: 0x%llx\n", (long long)rvl); + return rvl; + } +} + +/** + * ntfs_device_win32_getgeo - Get CHS information of a drive. + * @handle: An open handle to the PhysicalDevice + * @fd: a win_fd structure that will be filled. + * + * Return 0 if o.k. + * -1 if not + * + * In Windows NT+: fills the members: size, sectors, cylinders + * and set heads to -1. + * In Windows XP+: fills the members: size, sectors, cylinders and heads. + * + * Note: in pre XP, this requires write permission, even though nothing is + * actuallt written. + * + * if fails, set sectors, cylinders and heads to -1. + */ +static int ntfs_device_win32_getgeo(HANDLE handle, win32_fd *fd) +{ + BYTE buf[sizeof(DISK_GEOMETRY) + sizeof(DISK_PARTITION_INFO) + + sizeof(DISK_DETECTION_INFO) + 512]; + DWORD i; + BOOL rvl; + + rvl = DeviceIoControl(handle,IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, + &buf, sizeof(buf), &i, NULL); + if (rvl) { + Dputs("GET_DRIVE_GEOMETRY_EX detected."); + DISK_DETECTION_INFO *ddi = DiskGeometryGetDetect( + (PDISK_GEOMETRY)buf); + fd->geo_cylinders = ((DISK_GEOMETRY*)&buf)->Cylinders.QuadPart; + fd->geo_sectors = ((DISK_GEOMETRY*)&buf)->SectorsPerTrack; + fd->geo_size = ((DISK_GEOMETRY_EX*)&buf)->DiskSize.QuadPart; + switch (ddi->DetectionType) { + case DetectInt13: + fd->geo_cylinders = ddi->Int13.MaxCylinders; + fd->geo_sectors = ddi->Int13.SectorsPerTrack; + fd->geo_heads = ddi->Int13.MaxHeads; + return 0; + case DetectExInt13: + fd->geo_cylinders = ddi->ExInt13.ExCylinders; + fd->geo_sectors = + ddi->ExInt13.ExSectorsPerTrack; + fd->geo_heads = ddi->ExInt13.ExHeads; + return 0; + case DetectNone: + default: + break; + } + } else + fd->geo_heads = -1; + + rvl = DeviceIoControl(handle,IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, + &buf, sizeof(buf), &i, NULL); + if (rvl) { + Dputs("GET_DRIVE_GEOMETRY detected."); + fd->geo_cylinders = ((DISK_GEOMETRY*)&buf)->Cylinders.QuadPart; + fd->geo_sectors = ((DISK_GEOMETRY*)&buf)->SectorsPerTrack; + fd->geo_size = fd->geo_cylinders * fd->geo_sectors * + ((DISK_GEOMETRY*)&buf)->TracksPerCylinder * + ((DISK_GEOMETRY*)&buf)->BytesPerSector; + return 0; + } + + errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: Couldn't retrieve disk geometry."); + + fd->geo_cylinders = -1; + fd->geo_sectors = -1; + fd->geo_size = -1; + + return -1; } /** @@ -250,33 +465,27 @@ static void ntfs_device_win32_init_imports(void) * @flags: Unix open status flags. * * Return 0 if o.k. - * -errno if not + * -1 if not, and errno set. */ static __inline__ int ntfs_device_win32_open_file(char *filename, win32_fd *fd, int flags) { HANDLE handle; - s64 size; - int err; - if ((err = ntfs_device_win32_simple_open_file(filename, &handle, flags, - TRUE))) { + if (ntfs_device_win32_simple_open_file(filename, &handle, flags, + FALSE)) { /* open error */ - return err; + return -1; } - if ((err = ntfs_win32_getsize(handle, &size))) { - /* error while getting the information */ - Dputs("win32_open_file(): getsize failed."); - size = -1; - } - /* fill fd */ fd->handle = handle; fd->part_start = 0; - fd->part_end = size; + fd->part_length = ntfs_device_win32_getsize(handle); fd->current_pos.QuadPart = 0; fd->part_hidden_sectors = -1; + fd->geo_size = -1; /* used as a marker that this is a file */ + fd->vol_handle = INVALID_HANDLE_VALUE; return 0; } @@ -294,7 +503,6 @@ static __inline__ int ntfs_device_win32_open_drive(int drive_id, win32_fd *fd, { char filename[256]; HANDLE handle; - s64 size; int err; sprintf(filename, "\\\\.\\PhysicalDrive%d", drive_id); @@ -305,18 +513,21 @@ static __inline__ int ntfs_device_win32_open_drive(int drive_id, win32_fd *fd, return err; } - if ((err = ntfs_win32_getsize(handle, &size))) { - /* error while getting the information */ - Dputs("win32_open_drive(): getsize failed."); - size = -1; - } + /* store the drive geometry */ + ntfs_device_win32_getgeo(handle, fd); + + /* Just to be sure */ + if (fd->geo_size == -1) + fd->geo_size = ntfs_device_win32_getdisklength(handle); /* fill fd */ fd->handle = handle; fd->part_start = 0; - fd->part_end = size; + fd->part_length = fd->geo_size; fd->current_pos.QuadPart = 0; fd->part_hidden_sectors = -1; + fd->vol_handle = INVALID_HANDLE_VALUE; + return 0; } @@ -429,12 +640,12 @@ static BOOL ntfs_device_win32_find_partition(HANDLE handle,DWORD partition_id, { char buf[sizeof(DRIVE_LAYOUT_INFORMATION)+9*sizeof(PARTITION_INFORMATION)]; DRIVE_LAYOUT_INFORMATION *drive_layout; - DWORD bytesReturned, i; + DWORD i; if (!DeviceIoControl(handle, IOCTL_DISK_GET_DRIVE_LAYOUT, NULL, 0, - &buf, sizeof (buf), &bytesReturned, NULL)) { - Dputs("win32_find_partition(): GetDriveLayout failed."); + &buf, sizeof(buf), &i, NULL)) { errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: GetDriveLayout failed."); return FALSE; } @@ -484,62 +695,45 @@ static int ntfs_device_win32_open_partition(int drive_id, if (ntfs_device_win32_find_partition(handle, partition_id, &part_start, &part_length, &hidden_sectors)) { + s64 tmp; HANDLE vol_handle = ntfs_device_win32_open_volume_for_partition( drive_id, part_start, part_length, flags); - if (vol_handle!=INVALID_HANDLE_VALUE) { - BOOL retVal; - DWORD bytesReturned; - - /* close the disk handle, we do not need it anymore */ - CloseHandle(handle); - if ((flags & O_RDWR) == O_RDWR) { - /* lock the volume */ - Dputs("win32_open_partition: Locking volume"); - retVal = DeviceIoControl(vol_handle, FSCTL_LOCK_VOLUME, NULL, 0, - NULL, 0, &bytesReturned, NULL); - if (!retVal) { - Dputs("win32_open_partition: Couldn't lock volume"); - errno = ntfs_w32error_to_errno(GetLastError()); - return -1; - } else - Dputs("win32_open_partition: Lock O.k."); + /* store the drive geometry */ + ntfs_device_win32_getgeo(handle, fd); - /* dismount volume */ - retVal = DeviceIoControl(vol_handle, FSCTL_DISMOUNT_VOLUME, - NULL, 0, NULL, 0, &bytesReturned, NULL); - if (!retVal) { - Dputs("win32_open_partition: Couldn't Dismount"); - errno = ntfs_w32error_to_errno(GetLastError()); - return -1; - } else - Dputs("win32_open_partition: Dismount O.k."); + fd->handle = handle; + fd->current_pos.QuadPart = 0; + fd->part_start = part_start; + fd->part_length = part_length; + fd->part_hidden_sectors = hidden_sectors; + + tmp = ntfs_device_win32_getntfssize(vol_handle); + if (tmp > 0) + fd->geo_size = tmp; + else + fd->geo_size = fd->part_length; + + if (vol_handle != INVALID_HANDLE_VALUE) { + if (((flags & O_RDWR) == O_RDWR) && + ntfs_device_win32_lock(vol_handle)) { + CloseHandle(vol_handle); + CloseHandle(handle); + return -1; } - - /* fill fd */ - fd->handle = vol_handle; - fd->part_start = 0; - fd->part_end = part_length; - fd->current_pos.QuadPart = 0; - fd->part_hidden_sectors = hidden_sectors; - return 0; + fd->vol_handle = vol_handle; } else { if ((flags & O_RDWR) == O_RDWR) { /* access if read-write, no volume found */ Dputs("Partitions containing Spanned/Mirrored volumes are " "not supported in R/W status yet"); CloseHandle(handle); + errno = ENOTSUP; return -1; - } else { - /* fill fd */ - fd->handle = handle; - fd->part_start = part_start; - fd->part_end = part_start + part_length; - fd->current_pos.QuadPart = 0; - fd->part_hidden_sectors = hidden_sectors; - return 0; } + fd->vol_handle = INVALID_HANDLE_VALUE; } + return 0; } else { Dprintf("partition %u not found on drive %d\n", partition_id, drive_id); CloseHandle(handle); @@ -593,7 +787,6 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) default: Dprintf("win32_open(%s) -> unknwon file format\n", dev->d_name); err = -1; - break; } if (err) { @@ -608,8 +801,8 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) if ((flags & O_RDWR) != O_RDWR) NDevSetReadOnly(dev); - dev->d_private = malloc(sizeof (win32_fd)); - memcpy(dev->d_private, &fd, sizeof (win32_fd)); + dev->d_private = malloc(sizeof(win32_fd)); + memcpy(dev->d_private, &fd, sizeof(win32_fd)); NDevSetOpen(dev); NDevClearDirty(dev); @@ -617,47 +810,86 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) return 0; } +/** + * ntfs_device_win32_seek - Change current file position. + * @handle: Pointer the file HADNLE obtained via open. + * @pos: Offset in the file relative to file start. + * + * Return Succeed: The new position in the file + * Fail: -1 and errno set. + */ +static s64 ntfs_device_win32_abs_seek(struct win32_fd *fd, LARGE_INTEGER pos) +{ + if ((pos.QuadPart < 0) || (pos.QuadPart > fd->part_length)) { + Dputs("Error: Seeking outsize seekable area."); + errno = EINVAL; + return -1; + } + + if (!(pos.QuadPart & 0x1FF)) { + LARGE_INTEGER pos2; + HANDLE handle; + + if ((fd->vol_handle != INVALID_HANDLE_VALUE) && + (pos.QuadPart < fd->geo_size)) { + Dputs("Seeking via vol_handle"); + handle = fd->vol_handle; + pos2.QuadPart = pos.QuadPart; + } else { + Dputs("Seeking via handle"); + handle = fd->handle; + pos2.QuadPart = pos.QuadPart + fd->part_start; + } + if (!SetFilePointerEx(handle, pos2, NULL, FILE_BEGIN)) { + errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: SetFilePointer failed."); + return -1; + } + } + + /* Notice: If the address is not alligned, we leave it for the + read/write operation. */ + fd->current_pos.QuadPart = pos.QuadPart; + + return pos.QuadPart; +} + /** * ntfs_device_win32_seek - Change current file position. * @handle: Pointer the file HADNLE obtained via open. * @offset: Required offset from the whence anchor. * @whence: May be one of the following: - * SEEK_SET Offset is relative to file start. - * SEEK_CUR Offset is relative to current position. - * SEEK_END Offset is relative to end of file. + * SEEK_SET Offset is relative to file start. + * SEEK_CUR Offset is relative to current position. + * SEEK_END Offset is relative to end of file. * * Return 0 if o.k. - * -errno if not, in this case handle is trashed. + * -1 if not and errno set. */ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, int whence) { LARGE_INTEGER abs_offset; struct win32_fd *fd = (win32_fd *)dev->d_private; - int disp; - BOOL rvl; Dprintf("win32_seek(%lld=0x%llx,%d)\n", offset, offset, whence); switch (whence) { case SEEK_SET: - disp = FILE_BEGIN; - abs_offset.QuadPart = fd->part_start + offset; + abs_offset.QuadPart = offset; break; case SEEK_CUR: - disp = FILE_CURRENT; - abs_offset.QuadPart = offset; + abs_offset.QuadPart = fd->current_pos.QuadPart + offset; break; case SEEK_END: /* end of partition != end of disk */ - disp = FILE_BEGIN; - if (fd->part_end == -1) { + if (fd->part_length == -1) { Dputs("win32_seek: position relative to end " "of disk not implemented."); errno = ENOTSUP; return -1; } - abs_offset.QuadPart = fd->part_end + offset; + abs_offset.QuadPart = fd->part_length + offset; break; default: Dprintf("win32_seek() wrong mode %d.\n", whence); @@ -665,14 +897,56 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, return -1; } - rvl = SetFilePointerEx(fd->handle, abs_offset, &fd->current_pos, disp); + return ntfs_device_win32_abs_seek(fd, abs_offset); +} + +/** + * ntfs_device_win32_read_simple - Positioned simple read. + * @fd: The private data of the NTFS_DEVICE. + * @pos: Absolute offset in the file. + * @buf: A pointer to where to put the contents. + * @count: How many bytes should be read. + * + * On success returns the number of bytes read (could be geo_size > fd->current_pos.QuadPart) && + (fd->vol_handle != INVALID_HANDLE_VALUE)) { + Dputs("Reading via vol_handle"); + handle = fd->vol_handle; + } else { + Dputs("Reading via handle"); + handle = fd->handle; + } + + rvl = ReadFile(handle, buf, count, &i, (LPOVERLAPPED)NULL); if (!rvl) { - Dputs("win32_seek(): SetFilePointer failed."); errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: ReadFile failed."); + return -1; + } else if (!i) { + errno = ENXIO; + Dputs("Error: ReadFile failed: EOF."); return -1; } - return offset; + return i; } /** @@ -682,14 +956,14 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, * @count: How many bytes should be read. * * On success returns the amount of bytes actually read. - * On fail returns -errno. + * On fail returns -1 and sets errno. */ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) { struct win32_fd *fd = (win32_fd *)dev->d_private; LARGE_INTEGER base, offset, numtoread; - DWORD numread = 0; - BOOL rvl; + BYTE *alignedbuffer; + DWORD i, numread = 0; offset.QuadPart = fd->current_pos.QuadPart & 0x1FF; base.QuadPart = fd->current_pos.QuadPart - offset.QuadPart; @@ -699,68 +973,66 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) buf, count, base.QuadPart, offset.QuadPart, numtoread.QuadPart); -#ifndef FORCE_ALIGNED_READ if (((((long)buf) & ((s64)0x1FF)) == 0) && ((count & ((s64)0x1FF)) == 0) && ((fd->current_pos.QuadPart & 0x1FF) == 0)) { - Dputs("normal read."); - - rvl = ReadFile(fd->handle, (LPVOID)buf, count, &numread, - (LPOVERLAPPED)NULL); - if (!rvl) { - Dputs("win32_read(): ReadFile failed."); - errno = ntfs_w32error_to_errno(GetLastError()); - return -1; - } + alignedbuffer = buf; } else { - BYTE *alignedbuffer; - - Dputs("aligned read."); -#else - { - BYTE *alignedbuffer; -#endif - LARGE_INTEGER new_pos; - - alignedbuffer = (BYTE *)VirtualAlloc(NULL, count, MEM_COMMIT, - PAGE_READWRITE); - - Dprintf("set SetFilePointerEx(%llx)\n", base.QuadPart); - - rvl = SetFilePointerEx(fd->handle, base, NULL, FILE_BEGIN); - if (!rvl) { - Dputs("win32_read(): SetFilePointerEx failed."); + alignedbuffer = (BYTE *)VirtualAlloc(NULL, numtoread.LowPart, + MEM_COMMIT, PAGE_READWRITE); + if (alignedbuffer == NULL) { errno = ntfs_w32error_to_errno(GetLastError()); - VirtualFree(alignedbuffer, 0, MEM_RELEASE); + Dputs("Error: VirtualAlloc failed for read."); return -1; } + } - rvl = ReadFile(fd->handle, (LPVOID) alignedbuffer, - numtoread.QuadPart, &numread, - (LPOVERLAPPED)NULL); - if (!rvl) { - Dputs("win32_read(): ReadFile failed."); - errno = ntfs_w32error_to_errno(GetLastError()); - VirtualFree(alignedbuffer, 0, MEM_RELEASE); - return -1; - } - new_pos.QuadPart = fd->current_pos.QuadPart + count; - Dprintf("reset SetFilePointerEx(%llx)\n", new_pos.QuadPart); - rvl = SetFilePointerEx(fd->handle, new_pos, &fd->current_pos, - FILE_BEGIN); - if (!rvl) { - Dputs("win32_read(): SetFilePointerEx failed."); - errno = ntfs_w32error_to_errno(GetLastError()); - VirtualFree(alignedbuffer, 0, MEM_RELEASE); - return -1; - } + /* seek to base, if we are not in place */ + if ((fd->current_pos.QuadPart & 0x1FF) && + (ntfs_device_win32_abs_seek(fd, base) == -1)) + goto read_error; - memcpy((void *)buf, alignedbuffer + offset.QuadPart, count); + if ((fd->vol_handle != INVALID_HANDLE_VALUE) && + (fd->current_pos.QuadPart < fd->geo_size)) { + s64 vol_numtoread = fd->geo_size - fd->current_pos.QuadPart; + if (count > vol_numtoread) { + numread = ntfs_device_win32_read_simple(fd, + (LPVOID)alignedbuffer, vol_numtoread); + if (numread==(DWORD)-1) + goto read_error; + if (numread!=vol_numtoread) + goto read_partial; + + base.QuadPart = fd->geo_size; + numtoread.QuadPart -= numread; + if (ntfs_device_win32_abs_seek(fd, base) == -1) + goto read_partial; + } + } + + if ((i = ntfs_device_win32_read_simple(fd, (LPVOID)(alignedbuffer + + numread), numtoread.QuadPart)) == (DWORD)-1) { + if (numread>0) + goto read_partial; + goto read_error; + } + numread += i; + +read_partial: + numread = (numread < offset.LowPart) ? 0 : ((numread - offset.LowPart > + count) ? count : (numread - offset.LowPart)); + fd->current_pos.QuadPart += numread; + + if (buf != alignedbuffer) { + memcpy((void *)buf, alignedbuffer + offset.QuadPart, numread); VirtualFree(alignedbuffer, 0, MEM_RELEASE); } - if (numread > count) - return count; return numread; + +read_error: + if (buf != alignedbuffer) + VirtualFree(alignedbuffer, 0, MEM_RELEASE); + return -1; } /** @@ -783,14 +1055,20 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) return -errno; } + if (fd->vol_handle != INVALID_HANDLE_VALUE) { + ntfs_device_win32_dismount(fd->vol_handle); + ntfs_device_win32_unlock(fd->vol_handle); + if (!CloseHandle(fd->vol_handle)) + Dputs("Error: CloseHandle failed for volume."); + } + rvl = CloseHandle(fd->handle); - fd->handle = 0; free(fd); if (!rvl) { - Dputs("win32_close: CloseHandle failed."); errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: CloseHandle failed."); return -1; } @@ -802,17 +1080,34 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) * @dev: An NTFS_DEVICE obtained via the open command. * * Return 0 if o.k. - * -errno if not, in this case handle is trashed. + * -1 if not and errno set. + * + * Note: Volume syncing works differently in windows. + * Disk can't be synced in windows. */ static int ntfs_device_win32_sync(struct ntfs_device *dev) { if (!NDevReadOnly(dev) && NDevDirty(dev)) { - if (FlushFileBuffers(((win32_fd *)dev->d_private)->handle)) { + struct win32_fd *fd = (win32_fd *)dev->d_private; + + if ((fd->vol_handle != INVALID_HANDLE_VALUE) && + FlushFileBuffers(fd->handle)) NDevClearDirty(dev); - return 0; + + if (FlushFileBuffers(fd->handle)) { + NDevClearDirty(dev); + return 0; } else { + /* We want to set errno even if we return 0 to + let the user to know about failure even in + the disk/volume case. */ errno = ntfs_w32error_to_errno(GetLastError()); - return -errno; + /* Don't fail in case of volume/disk */ + if (fd->geo_size != -1) + return 0; + /* fail on the other cases */ + Dputs("Error: Couldn't sync."); + return -1; } } else { /* no need/ability for a sync(), just exit gracefully */ @@ -820,6 +1115,40 @@ static int ntfs_device_win32_sync(struct ntfs_device *dev) } } +/** + * ntfs_device_win32_write_simple - Write 'count' bytes from 'buf' into 'dev'. + * @dev: An NTFS_DEVICE obtained via the open command. + * @buf: A pointer to the contents. + * @count: How many bytes should be written. + * + * On success returns the amount of bytes actually written. + * On fail returns -1 and errno set. + * + * Limitations: + * buf must be aligned to page boundery + * pos & count must be aligned to sector bounderies. + * When dealing with volumes, a single call must not span both volume and disk + * extents. + */ +static DWORD ntfs_device_win32_write_simple(win32_fd *fd, + const void *buf, DWORD count) +{ + DWORD rvl, i; + + if ((fd->geo_size > fd->current_pos.QuadPart) && + (fd->vol_handle != INVALID_HANDLE_VALUE)) + rvl = WriteFile(fd->vol_handle, buf, count, &i, NULL); + else + rvl = WriteFile(fd->handle, buf, count, &i, NULL); + + if (!rvl) { + errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: WriteFile failed."); + return (DWORD)-1; + } + return i; +} + /** * ntfs_device_win32_write - Write 'count' bytes from 'buf' into 'dev'. * @dev: An NTFS_DEVICE obtained via the open command. @@ -832,8 +1161,10 @@ static int ntfs_device_win32_sync(struct ntfs_device *dev) static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buf, s64 count) { - s64 bytes_written = 0; - HANDLE handle = ((win32_fd *)dev->d_private)->handle; + win32_fd *fd = (win32_fd *)dev->d_private; + LARGE_INTEGER base, offset, actual_count; + BYTE *alignedbuffer = NULL; + DWORD i; Dprintf("win32_write: Writing %lld bytes\n",count); @@ -842,30 +1173,99 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buf, errno = EROFS; return -1; } + + if (!count) + return 0; + NDevSetDirty(dev); - while (count>0) { - DWORD cur_written; - DWORD cur_count = (count>32768)?32768:count; + offset.QuadPart = fd->current_pos.QuadPart & 0x1FF; + base.QuadPart = fd->current_pos.QuadPart - offset.QuadPart; + actual_count.QuadPart = ((count + offset.QuadPart - 1) | 0x1FF) + 1; - if (WriteFile(handle, buf, cur_count, &cur_written, NULL) && - (cur_written==cur_count)) { - Dprintf("win32_write: Written %lld bytes.\n", - bytes_written); - bytes_written += cur_written; - count -= cur_written; - } else { - /* error */ + if ((actual_count.QuadPart != count) || (((long)buf) & 0x1FF) || + (fd->current_pos.QuadPart & 0x1FF)) { + alignedbuffer = (BYTE *)VirtualAlloc(NULL, + actual_count.QuadPart, MEM_COMMIT, PAGE_READWRITE); + if (alignedbuffer == NULL) { errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: VirtualAlloc failed for write."); return -1; } + + /* read last sector */ + if ((offset.QuadPart + count) & 0x1FF) { + LARGE_INTEGER pos; + pos.QuadPart = base.QuadPart + actual_count.QuadPart - + 512; + if (ntfs_device_win32_abs_seek(fd, pos) == -1) + goto write_error; + if (!ntfs_device_win32_read_simple(fd, + (LPVOID)(alignedbuffer + + actual_count.QuadPart - 512), 512)) + goto write_error; + } + + /* read first sector */ + if (offset.LowPart) { + if (ntfs_device_win32_abs_seek(fd, base) == -1) + goto write_error; + if (!ntfs_device_win32_read_simple(fd, + (LPVOID)(alignedbuffer), 512)) { + goto write_error; + } + } + + /* copy the rest of the contents */ + memcpy((void *)(alignedbuffer + offset.LowPart), buf, + (size_t)count); + + /* ReAligning */ + if (ntfs_device_win32_abs_seek(fd, base) == -1) + goto write_error; + + /* hack to share code */ + buf = (const void *)alignedbuffer; } - if (count) { - errno = EIO; - return -1; - } else { - return bytes_written; + + if ((fd->geo_size > base.QuadPart) && + (fd->vol_handle != INVALID_HANDLE_VALUE)) { + s64 tmp = min((fd->geo_size - base.QuadPart), + actual_count.QuadPart); + i = ntfs_device_win32_write_simple(fd, buf, tmp); + if (i == (DWORD)-1) + goto write_error; + if (i != tmp) + goto partial_write; + base.QuadPart -= i; + } else + i = 0; + + if (fd->geo_size <= base.QuadPart) { + const void *newp = (const void *)(((const BYTE *)buf) + i); + i += ntfs_device_win32_write_simple(fd, newp, + actual_count.LowPart - i); + if (!i || (i == (DWORD)-1)) + goto write_error; } +partial_write: + if (alignedbuffer) + VirtualFree(alignedbuffer, 0, MEM_RELEASE); + + actual_count.QuadPart = (s64)i - actual_count.QuadPart + count; + if (actual_count.QuadPart < 0) + return 0; + return actual_count.QuadPart; + +write_error: + if (alignedbuffer) + VirtualFree(alignedbuffer, 0, MEM_RELEASE); + + fd->current_pos.QuadPart = base.QuadPart + offset.QuadPart; + if (!(fd->current_pos.QuadPart & 512)) + ntfs_device_win32_abs_seek(fd, base); + + return -1; } /** @@ -876,32 +1276,34 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buf, * Only st_mode & st_size are filled. * * Return 0 if o.k. - * -errno if not, in this case handle is trashed. + * -1 if not and errno set. in this case handle is trashed. */ static int ntfs_device_win32_stat(struct ntfs_device *dev, struct stat *buf) { mode_t st_mode; - s64 st_size = 0; - int ret; + win32_fd *fd = (win32_fd *)dev->d_private; - switch (GetFileType(((win32_fd *)dev->d_private)->handle)) { + switch (GetFileType(fd->handle)) { case FILE_TYPE_CHAR: st_mode = S_IFCHR; + break; case FILE_TYPE_DISK: st_mode = S_IFBLK; + break; case FILE_TYPE_PIPE: st_mode = S_IFIFO; + break; default: st_mode = 0; } - ret = ntfs_win32_getsize(dev,&st_size); - if (ret) - Dputs("win32_stat(): getsize failed."); - memset(buf,0,sizeof (struct stat)); buf->st_mode = st_mode; - buf->st_size = st_size; + buf->st_size = fd->part_length; + if (buf->st_size != -1) + buf->st_blocks = buf->st_size >> 9; + else + buf->st_size = 0; return 0; } @@ -925,20 +1327,11 @@ static __inline__ int ntfs_win32_hdio_getgeo(struct ntfs_device *dev, fd = (win32_fd *)dev->d_private; - if (fd->part_hidden_sectors==-1) { - /* not a partition */ - Dputs("win32_hdio_getgeo(): Not a partition, unimplemented."); - errno = ENOTSUP; - return -1; - } else { - /* only fake the 'start' value, others are unsupported */ - /* heads are returned by disk_int13_info on winXP only */ - argp->heads = -1; - argp->sectors = -1; - argp->cylinders = -1; - argp->start = fd->part_hidden_sectors; - return 0; - } + argp->heads = fd->geo_heads; + argp->sectors = fd->geo_sectors; + argp->cylinders = fd->geo_cylinders; + argp->start = fd->part_hidden_sectors; + return 0; } /** @@ -965,8 +1358,8 @@ static __inline__ int ntfs_win32_blksszget(struct ntfs_device *dev,int *argp) *argp=dg.BytesPerSector; return 0; } else { - Dputs("win32_blksszget(): FAILED!"); errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: GET_DRIVE_GEOMETRY failed."); return -errno; } } @@ -982,8 +1375,8 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, #if defined(BLKGETSIZE) case BLKGETSIZE: Dputs("win32_ioctl: BLKGETSIZE detected."); - if ((fd->part_end>=0) && (fd->part_start>=0)) { - *(int *)argp = (int)((fd->part_end - fd->part_start) / 512); + if (fd->part_length>=0) { + *(int *)argp = (int)(fd->part_length / 512); return 0; } else { errno = ENOTSUP; @@ -993,8 +1386,8 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, #if defined(BLKGETSIZE64) case BLKGETSIZE64: Dputs("win32_ioctl: BLKGETSIZE64 detected."); - if ((fd->part_end>=0) && (fd->part_start>=0)) { - *(s64 *)argp = (s64)(fd->part_end - fd->part_start); + if (fd->part_length>=0) { + *(s64 *)argp = fd->part_length; return 0; } else { errno = ENOTSUP; From 56bb2ea35d36f53b6fdf7b133374a0461e5f113a Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 3 Sep 2004 12:09:09 +0000 Subject: [PATCH 1780/2994] Rewrite win32_io.c in order to allow device level write support. All utilities now work on file/volume/disk. BKrev: 41385ee5IGredfw4jYoNtaB7fY606g From 76236c59167e95db3dcb086ca530e63f1b31f2ee Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 3 Sep 2004 12:42:03 +0000 Subject: [PATCH 1781/2994] Fix a segfault that crept in to win32_io.c due to being too rush. (Logical change 1.523) --- libntfs/win32_io.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 1e36584c..32071e25 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -56,7 +56,7 @@ typedef struct ntfs_volume ntfs_volume; #ifndef DiskGeometryGetPartition #define DiskGeometryGetPartition(Geometry) \ - ((PDISK_PARTITION_INFO)((Geometry) + 1)) + ((PDISK_PARTITION_INFO)(&((PDISK_GEOMETRY_EX)buf)->Data)) #endif #ifndef DiskGeometryGetDetect @@ -1056,8 +1056,10 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) } if (fd->vol_handle != INVALID_HANDLE_VALUE) { - ntfs_device_win32_dismount(fd->vol_handle); - ntfs_device_win32_unlock(fd->vol_handle); + if (!NDevReadOnly(dev)) { + ntfs_device_win32_dismount(fd->vol_handle); + ntfs_device_win32_unlock(fd->vol_handle); + } if (!CloseHandle(fd->vol_handle)) Dputs("Error: CloseHandle failed for volume."); } From d8b93c47e14e1c7397473849653c937a677a89ad Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 3 Sep 2004 12:42:03 +0000 Subject: [PATCH 1782/2994] Fix a segfault that crept in to win32_io.c due to being too rush. BKrev: 4138669biw5Z_adTsaNlO8WFZr2IBg From da308fb631aded08876af9775c550bac4b24f4e2 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 3 Sep 2004 13:36:27 +0000 Subject: [PATCH 1783/2994] Inline macros that are only used once. (Logical change 1.524) --- libntfs/win32_io.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 32071e25..3a6026db 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -54,17 +54,6 @@ typedef struct ntfs_volume ntfs_volume; #define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS 5636096 #endif -#ifndef DiskGeometryGetPartition -#define DiskGeometryGetPartition(Geometry) \ - ((PDISK_PARTITION_INFO)(&((PDISK_GEOMETRY_EX)buf)->Data)) -#endif - -#ifndef DiskGeometryGetDetect -#define DiskGeometryGetDetect(Geometry)\ - ((PDISK_DETECTION_INFO)(((PBYTE)DiskGeometryGetPartition(Geometry) + \ - DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo))) -#endif - /* windows 2k+ imports */ typedef HANDLE (WINAPI *LPFN_FINDFIRSTVOLUME) (LPTSTR,DWORD); typedef BOOL (WINAPI *LPFN_FINDNEXTVOLUME) (HANDLE,LPTSTR,DWORD); @@ -388,8 +377,11 @@ static int ntfs_device_win32_getgeo(HANDLE handle, win32_fd *fd) &buf, sizeof(buf), &i, NULL); if (rvl) { Dputs("GET_DRIVE_GEOMETRY_EX detected."); - DISK_DETECTION_INFO *ddi = DiskGeometryGetDetect( - (PDISK_GEOMETRY)buf); + DISK_DETECTION_INFO *ddi = (PDISK_DETECTION_INFO) + (((PBYTE)(&((PDISK_GEOMETRY_EX)buf)->Data)) + + (((PDISK_PARTITION_INFO)(&((PDISK_GEOMETRY_EX)buf) + ->Data))->SizeOfPartitionInfo)); + fd->geo_cylinders = ((DISK_GEOMETRY*)&buf)->Cylinders.QuadPart; fd->geo_sectors = ((DISK_GEOMETRY*)&buf)->SectorsPerTrack; fd->geo_size = ((DISK_GEOMETRY_EX*)&buf)->DiskSize.QuadPart; From 93ea479ad6613ef64c455a5c080976d6ce9cbad6 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 3 Sep 2004 13:36:27 +0000 Subject: [PATCH 1784/2994] win32_io.c: Inline macros that are only used once. BKrev: 4138735ba4p56xcVpMrDeCDF1CWQCA From c89ab0033cfe6d6fb4d54cd65089702ee63881ab Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 3 Sep 2004 13:47:56 +0000 Subject: [PATCH 1785/2994] Update NEWS about the win32 rewrite. BKrev: 4138760coHV6PLTsUWWZP2B3dHXhHw From dfd3525124e037a064e1a3e00177a05ed359f29b Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 3 Sep 2004 13:47:56 +0000 Subject: [PATCH 1786/2994] Update about the win32 rewrite. (Logical change 1.525) --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 84dab551..9f41e35c 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ Current news ============ +ntfsprogs should now work completely on windows 2000 and XP (Cygwin). +mkntfs does not create bootable volumes when on windows. Volumes are locked +when using a R/W utility in order to prevent data corruption. (Yuval Fledel) ntfsinfo has been extended and now provides much more detailed information as well as being able to resolve a path/filename instead of requiring the inode From 9d954ff33b6c9afd4ff7611e164adb7dddd14185 Mon Sep 17 00:00:00 2001 From: !uv Date: Fri, 3 Sep 2004 13:48:30 +0000 Subject: [PATCH 1787/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into atlas.:D:/temp/ntfs/ntfsprogs 2004/09/03 13:07:15+01:00 cantab.net!aia21 Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into cantab.net:/home/src/ntfsprogs 2004/09/03 13:06:45+01:00 cantab.net!aia21 Fix a warning in ntfsundelete.c. BKrev: 4138762eZ4Y9GpbZ3OP2xjOhxoRfUg From 0647ddffc564dbe7b0f1537893ae4835890862de Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 3 Sep 2004 13:48:30 +0000 Subject: [PATCH 1788/2994] Fix a warning. (Logical change 1.526) --- ntfsprogs/ntfsundelete.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index a2940cde..7441f741 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -55,7 +55,9 @@ static const char *EXEC_NAME = "ntfsundelete"; static const char *MFTFILE = "mft"; +#ifdef DEBUG static const char *UNNAMED = ""; +#endif static const char *NONE = ""; static const char *UNKNOWN = "unknown"; static struct options opts; From cbb262f04746ed353bdcbc88fe53f7405ff52d01 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 3 Sep 2004 14:08:02 +0000 Subject: [PATCH 1789/2994] Move "ntfsls -R" change to proper place (mistakenly was placed to 1.9.2) (Logical change 1.527) --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2f115073..dab9cab8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,7 @@ - Bugfix in ntfs_cluster_alloc for count = 0. (Yura) - Bugfix in ntfs_attr_map{_whole_,_}runlist: make it not fail if runlist already mapped. (Yura) + - ntfsls: Add a -R recursive option. (Giang, Carmelo) - Make ntfslabel pay attention to --no-action. (Yuval) - Several bugfixes in ntfs_cluster_alloc. (Anton) - Make all of libntfs only output anything if configured with @@ -95,7 +96,6 @@ in two error code paths in ntfs_compressed_attr_pread(). (Anton) - Fix a bug where an uncompressed block could be misdetected as a compressed one if it was made up of multiple runs. (Anton) - - ntfsls: Add a -R recursive option (Giang, Carmelo) 05/04/2004 - 1.9.1 - Make mkntfs create bootable volumes and fixes/updates. - Update with SuSE 9.1 beta 1 versions of GNU build system. From 9dbc52edf84b7520c54ef21cd20060b25de6ed13 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 3 Sep 2004 14:08:02 +0000 Subject: [PATCH 1790/2994] Move "ntfsls -R" change to proper place (mistakenly was placed to 1.9.2) BKrev: 41387ac2KGbl_4d5O4zTCB_u1aqG5A From 52337e4d916bac824a39e6dc14ef822f879e9ddd Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 3 Sep 2004 14:47:33 +0000 Subject: [PATCH 1791/2994] Made ntfscp update file size in $FILE_NAME(0x30) attribute (Logical change 1.528) --- ntfsprogs/ntfscp.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index b0c8ab9b..b7cc2b3d 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -204,6 +204,8 @@ int main (int argc, char *argv[]) ntfs_volume *vol; ntfs_inode *out; ntfs_attr *na; + ntfs_attr_search_ctx *ctx; + FILE_NAME_ATTR *fna; int flags = 0; int result = 1; s64 new_size; @@ -258,19 +260,36 @@ int main (int argc, char *argv[]) } Vprintf ("Old file size: %lld\n", na->data_size); -// utils_dump_mem ((u8 *) out->mrec, 0, -// le32_to_cpu(out->mrec->bytes_in_use), DM_INDENT | DM_GREEN); if (na->data_size != new_size) { if (ntfs_attr_truncate (na, new_size)) { -// utils_dump_mem ((u8 *) out->mrec, 0, le32_to_cpu( -// out->mrec->bytes_in_use), DM_INDENT | DM_RED); perror ("ERROR: Couldn't resize $DATA attribute"); goto close_attr; } need_logfile_reset = 1; + + /* Update $FILE_NAME(0x30) attribute for new file size. */ + ctx = ntfs_attr_get_search_ctx(out, NULL); + if (!ctx) { + perror("ERROR: Couldn't get search context"); + goto close_attr; + } + if (ntfs_attr_lookup(AT_FILE_NAME, 0, 0, 0, 0, NULL, 0, ctx)) { + perror("ERROR: Couldn't find $FILE_NAME attribute"); + ntfs_attr_put_search_ctx(ctx); + goto close_attr; + } + fna = (FILE_NAME_ATTR *)((u8*)ctx->attr + + le16_to_cpu(ctx->attr->value_offset)); + if (NAttrNonResident(na)) { + fna->allocated_size = scpu_to_le64(na->allocated_size); + fna->data_size = scpu_to_le64(na->data_size); + } else { + fna->allocated_size = 0; + fna->data_size = 0; + } + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_attr_put_search_ctx(ctx); } -// utils_dump_mem ((u8 *) out->mrec, 0, -// le32_to_cpu(out->mrec->bytes_in_use), DM_INDENT | DM_RED); buf = malloc (NTFS_BUF_SIZE); if (!buf) { From 1c64629939e241bf0b6566e38c305fa3c696251c Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 3 Sep 2004 14:47:33 +0000 Subject: [PATCH 1792/2994] Made ntfscp update file size in $FILE_NAME(0x30) attribute BKrev: 41388405lGSjrUAMLBGnTGBbVfXCZg From 2d473b8b013b080da04a652891e88931a795b935 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Fri, 3 Sep 2004 20:00:47 +0000 Subject: [PATCH 1793/2994] - Fix ntfsclone crash when --restore-image was used for block device outputs (Masaru Kawashima, Szaka) - Changelog update - TODO.ntfsprogs update BKrev: 4138cd6fRHza2Zjo3e-LVMJ-S4d5sw From 0b2c6586d8e25fb3730bd24ee8d25c6c96a3f88f Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Fri, 3 Sep 2004 20:00:47 +0000 Subject: [PATCH 1794/2994] Fix ntfsclone crash when --restore-image was used for block device outputs (Masaru Kawashima, Szaka) (Logical change 1.529) --- ntfsprogs/ntfsclone.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index e5e847b5..bae0835e 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1010,10 +1010,8 @@ static void print_image_info(void) Printf("Cluster size : %u bytes\n", (unsigned int)image_hdr.cluster_size); print_volume_size("Image volume size ", - image_hdr.cluster_size - * image_hdr.nr_clusters); - Printf("Image device size : %lld bytes\n", - image_hdr.device_size); + image_hdr.nr_clusters * image_hdr.cluster_size); + Printf("Image device size : %lld bytes\n", image_hdr.device_size); print_disk_usage(image_hdr.cluster_size, image_hdr.nr_clusters, image_hdr.inuse); @@ -1231,25 +1229,24 @@ static void initialise_image_hdr(s64 device_size, s64 inuse) image_hdr.inuse = inuse; } -static void check_output_filesize(s64 device_size) +static void check_output_device(s64 input_size) { if (opt.blkdev_out) { s64 dest_size = device_size_get(fd_out); - s64 ntfs_size = vol->nr_clusters * vol->cluster_size; - ntfs_size += 512; /* add backup boot sector */ - if (dest_size < ntfs_size) - err_exit("Output device size (%lld) is too small" - " to fit the NTFS image.\n", dest_size); + if (dest_size < input_size) + err_exit("Output device is too small (%lld) to fit the " + "NTFS image (%lld).\n", dest_size, input_size); check_if_mounted(opt.output, 0); } else - set_filesize(device_size); + set_filesize(input_size); } int main(int argc, char **argv) { ntfs_walk_clusters_ctx image; - s64 device_size; /* in bytes */ + s64 device_size; /* input device size in bytes */ + s64 ntfs_size; int wiped_total = 0; /* print to stderr, stdout can be an NTFS image ... */ @@ -1260,10 +1257,14 @@ int main(int argc, char **argv) utils_set_locale(); - if (opt.restore_image) + if (opt.restore_image) { device_size = open_image(); - else + ntfs_size = image_hdr.nr_clusters * image_hdr.cluster_size; + } else { device_size = open_volume(); + ntfs_size = vol->nr_clusters * vol->cluster_size; + } + ntfs_size += 512; /* add backup boot sector */ if (opt.std_out) { if ((fd_out = fileno(stdout)) == -1) @@ -1282,7 +1283,7 @@ int main(int argc, char **argv) perr_exit("Opening file '%s' failed", opt.output); if (!opt.save_image) - check_output_filesize(device_size); + check_output_device(ntfs_size); } if (opt.restore_image) { From ecd038b30e04d648e2fa5c5063d7bada42bd0653 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Fri, 3 Sep 2004 20:00:47 +0000 Subject: [PATCH 1795/2994] Updated for 1.9.4 release (Logical change 1.529) --- ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index dab9cab8..0f3b7f6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +03/09/2004 - 1.9.4 - Urgent bug fixes. + - Rewrite win32_io.c to allow device level write support (Yuval) + - Make ntfscp update file size in $FILE_NAME(0x30) attribute (Yura) + - Fix ntfsclone crash when --restore-image was used for block device + outputs (Masaru Kawashima, Szaka) + 03/09/2004 - 1.9.3 - Lots of fixes and enhancements all over the place. - Fix access of MFT_RECORD->bytes_in_use to use le32_to_cpu() instead @@ -58,6 +64,7 @@ - Change libntfs/runlist.c::ntfs_get_size_for_mapping_pairs() and libntfs/runlist.c::ntfs_mapping_pairs_build() to treat a NULL runlist to mean empty runlist. (Anton) + - ntfsresize: some refactoring towards being able to reuse code (Szaka) 11/05/2004 - 1.9.2 - Decompression bug fixes, ntfsinfo enhancements, updates. - Hopefully fix the autogen.sh problems using the --force and touch From b37f1d99fbbc35d1e745eb8851fce7867b5c859d Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Fri, 3 Sep 2004 20:00:47 +0000 Subject: [PATCH 1796/2994] ntfsclone: special image format support was implemented for sparseness encoding/decoding (Per Olofsson) (Logical change 1.529) --- TODO.ntfsprogs | 1 - 1 file changed, 1 deletion(-) diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index f3dadd12..45c2a979 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -26,7 +26,6 @@ Thanks, - get rid of the unneeded lseek()'s during reads/writes - catch if source and dest are the same -- add sparse encoding/decoding, perhaps using Partimage image format? - consider badblock list - add dd's noerror option - disable consistency check for --metadata (e.g. if the check is crashing) From 088dce5f916f6f63b6c0ade0ab460937be4738df Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Fri, 3 Sep 2004 21:16:56 +0000 Subject: [PATCH 1797/2994] ntfsclone manual: rewrote most of the examples, minor corrections BKrev: 4138df48bLpqZAa29f1nkrKBRPAZLg From da2a82fbf2ed22e7246a698a5d0c3332767c61d4 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Fri, 3 Sep 2004 21:16:56 +0000 Subject: [PATCH 1798/2994] rewrote most of the examples, minor corrections (Logical change 1.530) --- ntfsprogs/ntfsclone.8.in | 74 ++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 5ee1b143..493a1539 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -5,7 +5,7 @@ .\" All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLONE 8 "Jul 2004" "ntfsprogs version @VERSION@" +.TH NTFSCLONE 8 "Sep 2004" "ntfsprogs version @VERSION@" .SH NAME ntfsclone \- Efficiently clone, image or restore an NTFS filesystem .SH SYNOPSIS @@ -30,7 +30,7 @@ will efficiently clone (copy, save, backup, restore) an NTFS filesystem to a sparse file, image, device (partition) or standard output. It works at disk sector level and copies only the used data. Unused disk space becomes zero (cloning to -sparse file), encoded with control codes (cloning to an image), +sparse file), encoded with control codes (saving in special image format), left unchanged (cloning to a disk/partition) or filled with zeros (cloning to standard output). @@ -40,7 +40,7 @@ and restore it later on, or for developers to test NTFS read/write functionality, troubleshot/investigate users' issues using the clone without the risk of destroying the original filesystem. -The clone (if not using the image format) is an exact copy of the original +The clone, if not using the special image format, is an exact copy of the original NTFS filesystem from sector to sector thus it can be also mounted just like the original NTFS filesystem. For example if you clone to a file and the kernel has loopback device and @@ -96,8 +96,9 @@ in-place by just reading .BR ntfsclone standard output. .SH THE SPECIAL IMAGE FORMAT -It is also possible to clone an NTFS filesystem to a special image -format. Instead of representing unallocated blocks as holes, they are +It's also possible, actually it's recommended, to save an NTFS filesystem +to a special image format. +Instead of representing unallocated blocks as holes, they are encoded using control codes. Thus, the image saves space without requiring sparse file support. The image format is ideal for streaming filesystem images over the network and similar, and can be used as a @@ -120,7 +121,7 @@ file. .SH METADATA-ONLY CLONING One of the features of .BR ntfsclone -is it can also save only the NTFS metadata using the option +is that, it can also save only the NTFS metadata using the option .B \-m or .B \-\-metadata @@ -190,63 +191,47 @@ Forces ntfsclone to proceed if the filesystem is marked .B \-h, \-\-help Show a list of options with a brief description of each one. .SH EXAMPLES -Clone (save, backup) an NTFS volume to a non-existent file +Save an NTFS to a file in the special image format .RS .sp -.B ntfsclone \-\-output ntfs.img /dev/hda1 +.B ntfsclone \-\-save\-image \-\-output ntfs-backup.img /dev/hda1 .sp .RE -Restore a clone image to its original partition +Restore an NTFS from a special image file to its original partition .RS .sp -.B ntfsclone \-\-overwrite /dev/hda1 ntfs.img +.B ntfsclone \-\-restore-image \-\-overwrite /dev/hda1 ntfs-backup.img .sp .RE -Space and speed-wise the most efficient way to compress a clone image +Save an NTFS into a compressed image. Note, gzip is faster usually +at least 2-4 times than bzip2 but it creates also bigger compressed files. .RS .sp -.B tar \-cjSf ntfs.img.tar.bz2 ntfs.img +.B ntfsclone \-\-save-image \-o \- /dev/hda1 | bzip2 \-c > ntfs.img.bz2 .sp .RE -Uncompressing a -.BR tar -archived clone image +Restore an NTFS volume from a compressed image file .RS .sp -.B tar \-xjSf ntfs.img.tar.bz2 +.B bunzip2 \-c ntfs.img.bz2 | \\\\ +.br +.B ntfsclone \-\-restore-image \-\-overwrite /dev/hda1 \- .sp .RE -In-place compressing an NTFS volume. Note, gzip is faster usually -at least 2-4 times but it creates also bigger compressed files. +Backup an NTFS volume to a remote host, using ssh. .RS .sp -.B ntfsclone \-\-output \- /dev/hda1 | bzip2 \-c > ntfs.img.bz2 -.sp -.RE -Restore an NTFS volume from a compressed image -.RS -.sp -.B bunzip2 \-c ntfs.img.bz2 | dd of=/dev/hda1 bs=8192 -.sp -.RE -Backup an NTFS volume to a remote host, using -.BR ssh -default compression. -.RS -.sp -.B ntfsclone \-o \- /dev/hda1 | ssh \-C host 'bzip \-c9 > ntfs.img.bz2' +.B ntfsclone \-\-save-image \-\-output \- /dev/hda1 | \\\\ +.br +.B gzip \-c | ssh host 'cat > ntfs.img.gz' .sp .RE Restore an NTFS volume from a remote host via ssh. .RS .sp -.B ssh host 'cat ntfs.img.bz2' | bunzip2 | dd of=/dev/hda1 bs=8192 -.sp -.RE -Save a filesystem to a file in the special image format -.RS -.sp -.B ntfsclone \-\-save\-image \-\-output ntfs.img /dev/hda1 +.B ssh host 'cat ntfs.img.gz' | gunzip -c | \\\\ +.br +.B ntfsclone \-\-restore-image \-\-overwrite /dev/hda1 \- .sp .RE Stream an image from a web server and restore it to a partition @@ -257,6 +242,12 @@ Stream an image from a web server and restore it to a partition .B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \- .sp .RE +Clone an NTFS volume to a non-existent file +.RS +.sp +.B ntfsclone \-\-output ntfs-clone.img /dev/hda1 +.sp +.RE Pack NTFS metadata for NTFS experts .RS .sp @@ -264,7 +255,8 @@ Pack NTFS metadata for NTFS experts .br .B tar \-cjSf ntfsmeta.img.tar.bz2 ntfsmeta.img .SH KNOWN ISSUES -This program has no known bugs. If you find one, please send an email to +This program has no known bugs. If you think you have found one then +please send an email to .nh . From 5590665329d6c4e5c9886a22a265b1bc586709f8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 4 Sep 2004 09:58:47 +0000 Subject: [PATCH 1799/2994] ChangeLog, NEWS: Update. BKrev: 413991d7EdGCuLK1QVcvITXZvMOZZw From 756e93cd894cf18ff92059212bc747af4304988d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 4 Sep 2004 09:58:47 +0000 Subject: [PATCH 1800/2994] Update. (Logical change 1.531) --- ChangeLog | 8 ++++---- NEWS | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f3b7f6e..ce695a03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,8 @@ -03/09/2004 - 1.9.4 - Urgent bug fixes. - - Rewrite win32_io.c to allow device level write support (Yuval) - - Make ntfscp update file size in $FILE_NAME(0x30) attribute (Yura) +04/09/2004 - 1.9.4 - Urgent bug fixes. + - Rewrite win32_io.c to allow device level write support. (Yuval) + - Make ntfscp update file size in $FILE_NAME(0x30) attribute. (Yura) - Fix ntfsclone crash when --restore-image was used for block device - outputs (Masaru Kawashima, Szaka) + outputs. (Masaru Kawashima, Szaka) 03/09/2004 - 1.9.3 - Lots of fixes and enhancements all over the place. diff --git a/NEWS b/NEWS index 9f41e35c..26271de4 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,8 @@ Current news ============ -ntfsprogs should now work completely on windows 2000 and XP (Cygwin). -mkntfs does not create bootable volumes when on windows. Volumes are locked + +ntfsprogs should now work completely on Windows 2000 and XP (Cygwin). +mkntfs does not create bootable volumes when on Windows. Volumes are locked when using a R/W utility in order to prevent data corruption. (Yuval Fledel) ntfsinfo has been extended and now provides much more detailed information as From 558b679d8c5a94435864e08f813ca8849a365bb2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 4 Sep 2004 10:13:59 +0000 Subject: [PATCH 1801/2994] Update version. (Logical change 1.532) --- configure | 20 ++++++++++---------- configure.ac | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/configure b/configure index de1009f1..002fe6aa 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.3. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.4. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.9.3' -PACKAGE_STRING='ntfsprogs 1.9.3' +PACKAGE_VERSION='1.9.4' +PACKAGE_STRING='ntfsprogs 1.9.4' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -955,7 +955,7 @@ 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 ntfsprogs 1.9.3 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.9.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1022,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.9.3:";; + short | recursive ) echo "Configuration of ntfsprogs 1.9.4:";; esac cat <<\_ACEOF @@ -1169,7 +1169,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.9.3 +ntfsprogs configure 1.9.4 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1183,7 +1183,7 @@ 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 ntfsprogs $as_me 1.9.3, which was +It was created by ntfsprogs $as_me 1.9.4, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1903,7 +1903,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.9.3' + VERSION='1.9.4' cat >>confdefs.h <<_ACEOF @@ -23027,7 +23027,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.9.3, which was +This file was extended by ntfsprogs $as_me 1.9.4, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23090,7 +23090,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.9.3 +ntfsprogs config.status 1.9.4 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 462ed2dd..ae50ba8c 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.9.3],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.9.4],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) From 3dc22bbae16d74fd6b79c7a5c75b1324f887c72e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 4 Sep 2004 10:13:59 +0000 Subject: [PATCH 1802/2994] configure.ac, configure: Update version. BKrev: 41399567ha0o5IztXvbqXpHspCXvHg From 06086ae5c7602331d6f0a6a94b1887d7689f8e50 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Sep 2004 09:27:16 +0000 Subject: [PATCH 1803/2994] Add start_vcn parameter to ntfs_get_size_for_mapping_pairs() and ntfs_mapping_pairs_build() and adapt all callers. (Logical change 1.533) --- include/ntfs/runlist.h | 5 +- libntfs/attrib.c | 12 +-- libntfs/runlist.c | 161 ++++++++++++++++++++++++++++++++++------- ntfsprogs/mkntfs.c | 8 +- ntfsprogs/ntfsmove.c | 7 +- ntfsprogs/ntfsresize.c | 4 +- 6 files changed, 152 insertions(+), 45 deletions(-) diff --git a/include/ntfs/runlist.h b/include/ntfs/runlist.h index b22b46dc..e79a1106 100644 --- a/include/ntfs/runlist.h +++ b/include/ntfs/runlist.h @@ -65,13 +65,14 @@ extern runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, extern int ntfs_get_nr_significant_bytes(const s64 n); extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, - const runlist_element *rl); + const runlist_element *rl, const VCN start_vcn); extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, const s64 n); extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, - const int dst_len, const runlist_element *rl); + const int dst_len, const runlist_element *rl, + const VCN start_vcn); extern int ntfs_rl_truncate(runlist **rl, const VCN start_vcn); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 4f0ddffe..fcb172b4 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2440,7 +2440,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, } } /* Determine the size of the mapping pairs array. */ - mp_size = ntfs_get_size_for_mapping_pairs(vol, rl); + mp_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0); if (mp_size < 0) { err = errno; // FIXME: Eeek! @@ -2513,7 +2513,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, /* Generate the mapping pairs array in the attribute record. */ if (ntfs_mapping_pairs_build(vol, (u8*)a + mp_ofs, arec_size - mp_ofs, - rl) < 0) { + rl, 0) < 0) { err = errno; // FIXME: Eeek! We need rollback! (AIA) Dprintf("%s(): Eeek! Failed to build mapping pairs. Leaving " @@ -3018,7 +3018,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) if (a->highest_vcn) a->highest_vcn = scpu_to_le64(first_free_vcn - 1); /* Get the size for the new mapping pairs array. */ - mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); + mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl, 0); if (mp_size <= 0) { err = errno; // FIXME: Eeek! We need rollback! (AIA) @@ -3032,7 +3032,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) * correct destination, i.e. the attribute record itself. */ if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( - a->mapping_pairs_offset), mp_size, na->rl)) { + a->mapping_pairs_offset), mp_size, na->rl, 0)) { err = errno; // FIXME: Eeek! We need rollback! (AIA) Dprintf("%s(): Eeek! Mapping pairs build " @@ -3270,7 +3270,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) na->rl = rln; /* Get the size for the new mapping pairs array. */ - mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl); + mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl, 0); if (mp_size <= 0) { err = errno; Dprintf("%s(): Eeek! Get size for mapping " @@ -3344,7 +3344,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) * correct destination, i.e. the attribute record itself. */ if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( - a->mapping_pairs_offset), mp_size, na->rl)) { + a->mapping_pairs_offset), mp_size, na->rl, 0)) { err = errno; Dprintf("%s(): BUG! Mapping pairs build " "failed. Please run chkdsk and if " diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 16a5d253..b2c7e8ac 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1238,10 +1238,12 @@ __inline__ int ntfs_get_nr_significant_bytes(const s64 n) * ntfs_get_size_for_mapping_pairs - get bytes needed for mapping pairs array * @vol: ntfs volume (needed for the ntfs version) * @rl: runlist for which to determine the size of the mapping pairs + * @start_vcn: vcn at which to start the mapping pairs array * * Walk the runlist @rl and calculate the size in bytes of the mapping pairs - * array corresponding to the runlist @rl. This for example allows us to - * allocate a buffer of the right size when building the mapping pairs array. + * array corresponding to the runlist @rl, starting at vcn @start_vcn. This + * for example allows us to allocate a buffer of the right size when building + * the mapping pairs array. * * If @rl is NULL, just return 1 (for the single terminator byte). * @@ -1249,41 +1251,86 @@ __inline__ int ntfs_get_nr_significant_bytes(const s64 n) * errno set to the error code. The following error codes are defined: * EINVAL - Run list contains unmapped elements. Make sure to only pass * fully mapped runlists to this function. + * - @start_vcn is invalid. * EIO - The runlist is corrupt. */ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, - const runlist_element *rl) + const runlist_element *rl, const VCN start_vcn) { LCN prev_lcn; - int i, rls; + int rls; - if (!rl) + if (start_vcn < 0) { + errno = EINVAL; + return -1; + } + if (!rl) { + if (start_vcn) { + errno = EINVAL; + return -1; + } return 1; + } + /* Skip to runlist element containing @start_vcn. */ + while (rl->length && start_vcn >= rl[1].vcn) + rl++; + if ((!rl->length && start_vcn > rl->vcn) || start_vcn < rl->vcn) { + errno = EINVAL; + return -1; + } + prev_lcn = 0; /* Always need the termining zero byte. */ rls = 1; - for (prev_lcn = i = 0; rl[i].length; i++) { - if (rl[i].length < 0 || rl[i].lcn < LCN_HOLE) + /* Do the first partial run if present. */ + if (start_vcn > rl->vcn) { + s64 delta; + + /* We know rl->length != 0 already. */ + if (rl->length < 0 || rl->lcn < LCN_HOLE) goto err_out; + delta = start_vcn - rl->vcn; /* Header byte + length. */ - rls += 1 + ntfs_get_nr_significant_bytes(rl[i].length); + rls += 1 + ntfs_get_nr_significant_bytes(rl->length - delta); /* * If the logical cluster number (lcn) denotes a hole and we * are on NTFS 3.0+, we don't store it at all, i.e. we need * zero space. On earlier NTFS versions we just store the lcn. + * Note: this assumes that on NTFS 1.2-, holes are stored with + * an lcn of -1 and not a delta_lcn of -1 (unless both are -1). */ - if (rl[i].lcn == LCN_HOLE && vol->major_ver >= 3) - continue; + if (rl->lcn >= 0 || vol->major_ver < 3) { + prev_lcn = rl->lcn; + if (rl->lcn >= 0) + prev_lcn += delta; + /* Change in lcn. */ + rls += ntfs_get_nr_significant_bytes(prev_lcn); + } + /* Go to next runlist element. */ + rl++; + } + /* Do the full runs. */ + for (; rl->length; rl++) { + if (rl->length < 0 || rl->lcn < LCN_HOLE) + goto err_out; + /* Header byte + length. */ + rls += 1 + ntfs_get_nr_significant_bytes(rl->length); /* - * Change in lcn. Note: this assumes that on NTFS 1.2-, holes - * are stored with an lcn of -1 and _not_ a delta_lcn of -1 - * (unless both are -1). + * If the logical cluster number (lcn) denotes a hole and we + * are on NTFS 3.0+, we don't store it at all, i.e. we need + * zero space. On earlier NTFS versions we just store the lcn. + * Note: this assumes that on NTFS 1.2-, holes are stored with + * an lcn of -1 and not a delta_lcn of -1 (unless both are -1). */ - rls += ntfs_get_nr_significant_bytes(rl[i].lcn - prev_lcn); - prev_lcn = rl[i].lcn; + if (rl->lcn >= 0 || vol->major_ver < 3) { + /* Change in lcn. */ + rls += ntfs_get_nr_significant_bytes(rl->lcn - + prev_lcn); + prev_lcn = rl->lcn; + } } return rls; err_out: - if (rl[i].lcn == LCN_RL_NOT_MAPPED) + if (rl->lcn == LCN_RL_NOT_MAPPED) errno = EINVAL; else errno = EIO; @@ -1348,10 +1395,12 @@ err_out: * @dst: destination buffer to which to write the mapping pairs array * @dst_len: size of destination buffer @dst in bytes * @rl: runlist for which to build the mapping pairs array + * @start_vcn: vcn at which to start the mapping pairs array * - * Create the mapping pairs array from the runlist @rl and save the array in - * @dst. @dst_len is the size of @dst in bytes and it should be at least equal - * to the value obtained by calling ntfs_get_size_for_mapping_pairs(). + * Create the mapping pairs array from the runlist @rl, starting at vcn + * @start_vcn and save the array in @dst. @dst_len is the size of @dst in + * bytes and it should be at least equal to the value obtained by calling + * ntfs_get_size_for_mapping_pairs(). * * If @rl is NULL, just write a single terminator byte to @dst. * @@ -1359,35 +1408,87 @@ err_out: * The following error codes are defined: * EINVAL - Run list contains unmapped elements. Make sure to only pass * fully mapped runlists to this function. + * - @start_vcn is invalid. * EIO - The runlist is corrupt. * ENOSPC - The destination buffer is too small. */ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, - const int dst_len, const runlist_element *rl) + const int dst_len, const runlist_element *rl, + const VCN start_vcn) { LCN prev_lcn; s8 *dst_max; - int i; s8 len_len, lcn_len; + if (start_vcn < 0) + goto val_err; if (!rl) { + if (start_vcn) + goto val_err; if (dst_len < 1) goto size_err; /* Terminator byte. */ *dst = 0; return 0; } + /* Skip to runlist element containing @start_vcn. */ + while (rl->length && start_vcn >= rl[1].vcn) + rl++; + if ((!rl->length && start_vcn > rl->vcn) || start_vcn < rl->vcn) + goto val_err; /* * @dst_max is used for bounds checking in * ntfs_write_significant_bytes(). */ dst_max = dst + dst_len - 1; - for (prev_lcn = i = 0; rl[i].length; i++) { - if (rl[i].length < 0 || rl[i].lcn < LCN_HOLE) + prev_lcn = 0; + /* Do the first partial run if present. */ + if (start_vcn > rl->vcn) { + s64 delta; + + /* We know rl->length != 0 already. */ + if (rl->length < 0 || rl->lcn < LCN_HOLE) + goto err_out; + delta = start_vcn - rl->vcn; + /* Write length. */ + len_len = ntfs_write_significant_bytes(dst + 1, dst_max, + rl->length - delta); + if (len_len < 0) + goto size_err; + /* + * If the logical cluster number (lcn) denotes a hole and we + * are on NTFS 3.0+, we don't store it at all, i.e. we need + * zero space. On earlier NTFS versions we just write the lcn + * change. FIXME: Do we need to write the lcn change or just + * the lcn in that case? Not sure as I have never seen this + * case on NT4. - We assume that we just need to write the lcn + * change until someone tells us otherwise... (AIA) + */ + if (rl->lcn >= 0 || vol->major_ver < 3) { + prev_lcn = rl->lcn; + if (rl->lcn >= 0) + prev_lcn += delta; + /* Write change in lcn. */ + lcn_len = ntfs_write_significant_bytes(dst + 1 + + len_len, dst_max, prev_lcn); + if (lcn_len < 0) + goto size_err; + } else + lcn_len = 0; + /* Update header byte. */ + *dst = lcn_len << 4 | len_len; + /* Position ourselves at next mapping pairs array element. */ + dst += 1 + len_len + lcn_len; + /* Go to next runlist element. */ + rl++; + } + /* Do the full runs. */ + for (; rl->length; rl++) { + if (rl->length < 0 || rl->lcn < LCN_HOLE) goto err_out; /* Write length. */ len_len = ntfs_write_significant_bytes(dst + 1, dst_max, - rl[i].length); + rl->length); if (len_len < 0) goto size_err; /* @@ -1399,12 +1500,13 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, * case on NT4. - We assume that we just need to write the lcn * change until someone tells us otherwise... (AIA) */ - if (rl[i].lcn != LCN_HOLE || vol->major_ver < 3) { + if (rl->lcn >= 0 || vol->major_ver < 3) { + /* Write change in lcn. */ lcn_len = ntfs_write_significant_bytes(dst + 1 + - len_len, dst_max, rl[i].lcn - prev_lcn); + len_len, dst_max, rl->lcn - prev_lcn); if (lcn_len < 0) goto size_err; - prev_lcn = rl[i].lcn; + prev_lcn = rl->lcn; } else lcn_len = 0; /* Update header byte. */ @@ -1420,8 +1522,11 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, size_err: errno = ENOSPC; return -1; +val_err: + errno = EINVAL; + return -1; err_out: - if (rl[i].lcn == LCN_RL_NOT_MAPPED) + if (rl->lcn == LCN_RL_NOT_MAPPED) errno = EINVAL; else errno = EIO; diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 48ae7d2d..b2e3a23e 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1235,7 +1235,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, } else { hdr_size = 64; if (val_len) { - mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl); + mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0); if (mpa_size < 0) { err = -errno; Eprintf("Failed to get size for mapping " @@ -1322,7 +1322,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, Eprintf("Error writing non-resident attribute value." "\n"); err = ntfs_mapping_pairs_build(vol, (s8*)a + hdr_size + - ((name_len + 7) & ~7), mpa_size, rl); + ((name_len + 7) & ~7), mpa_size, rl, 0); } a->initialized_size = cpu_to_le64(inited_size); if (err < 0 || bw != val_len) { @@ -1431,7 +1431,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, } else { hdr_size = 64; if (val_len) { - mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl); + mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0); if (mpa_size < 0) { err = -errno; Eprintf("Failed to get size for mapping " @@ -1512,7 +1512,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, Eprintf("Error writing non-resident attribute value." "\n"); err = ntfs_mapping_pairs_build(vol, (s8*)a + hdr_size + - ((name_len + 7) & ~7), mpa_size, rl); + ((name_len + 7) & ~7), mpa_size, rl, 0); } if (err < 0 || bw != val_len) { // FIXME: Handle error. diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index b969245a..d805a94f 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -669,7 +669,7 @@ static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, printf ("move %lld,%lld,%lld to %lld,%lld,%lld\n", run->vcn, run->lcn, run->length, to->vcn, to->lcn, to->length); - need_from = ntfs_get_size_for_mapping_pairs (vol, from); + need_from = ntfs_get_size_for_mapping_pairs(vol, from, 0); printf ("orig data run = %d bytes\n", need_from); //ntfs_debug_runlist_dump2 (from, 5, "\t"); @@ -683,7 +683,7 @@ static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, //ntfs_debug_runlist_dump2 (from, 5, "\t"); - need_to = ntfs_get_size_for_mapping_pairs (vol, from); + need_to = ntfs_get_size_for_mapping_pairs(vol, from, 0); printf ("new data run = %d bytes\n", need_to); need_from = calc_attr_length (rec, need_from); @@ -708,7 +708,8 @@ static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, memset (((u8*)rec) +rec->mapping_pairs_offset, 0, need_to - rec->mapping_pairs_offset); // update data runs - ntfs_mapping_pairs_build (vol, ((u8*)rec) + rec->mapping_pairs_offset, need_to, from); + ntfs_mapping_pairs_build(vol, ((u8*)rec) + rec->mapping_pairs_offset, + need_to, from, 0); // commit ntfs_inode_mark_dirty (ino); diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 2b580e7f..0de41876 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1097,7 +1097,7 @@ static void replace_attribute_runlist(ntfs_volume *vol, rl_fixup(&rl); - if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl)) == -1) + if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0)) == -1) perr_exit("ntfs_get_size_for_mapping_pairs"); if (a->name_length) { @@ -1157,7 +1157,7 @@ static void replace_attribute_runlist(ntfs_volume *vol, if (!(mp = calloc(1, mp_size))) perr_exit("Couldn't get memory"); - if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl)) + if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl, 0)) perr_exit("ntfs_mapping_pairs_build"); memmove((u8*)a + le16_to_cpu(a->mapping_pairs_offset), mp, mp_size); From f32afd249ee1736bba1e0261e3eec32a9f56843d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Sep 2004 09:27:16 +0000 Subject: [PATCH 1804/2994] Add start_vcn parameter to ntfs_get_size_for_mapping_pairs() and ntfs_mapping_pairs_build() and adapt all callers. BKrev: 413c2d74zrWuiQNUP4PbL7sodzPb-A From 338daf2d36bd355f1c4a60a5bd0b025cc0cb0379 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Sep 2004 09:44:16 +0000 Subject: [PATCH 1805/2994] - Update library version for source/binary incompatible API changes. - Start 2.0.0-WIP. BKrev: 413c3170UYNp9Tc5rzJJ0IJO-qce1Q From dcdc9a4b7a252b39a8180c1d3a4c84aea2846097 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Sep 2004 09:44:16 +0000 Subject: [PATCH 1806/2994] Start 2.0.0-WIP (Logical change 1.534) --- ChangeLog | 7 +++++++ configure | 20 ++++++++++---------- configure.ac | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce695a03..2ca52284 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ +xx/xx/2004 - 2.0.0-WIP + + - Add start_vcn parameter to ntfs_get_size_for_mapping_pairs() and + ntfs_mapping_pairs_build() and adapt all callers. + - Bump library version due to source level API change above. + 04/09/2004 - 1.9.4 - Urgent bug fixes. + - Rewrite win32_io.c to allow device level write support. (Yuval) - Make ntfscp update file size in $FILE_NAME(0x30) attribute. (Yura) - Fix ntfsclone crash when --restore-image was used for block device diff --git a/configure b/configure index 002fe6aa..8d06d2db 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.9.4. +# Generated by GNU Autoconf 2.59 for ntfsprogs 2.0.0-WIP. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.9.4' -PACKAGE_STRING='ntfsprogs 1.9.4' +PACKAGE_VERSION='2.0.0-WIP' +PACKAGE_STRING='ntfsprogs 2.0.0-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -955,7 +955,7 @@ 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 ntfsprogs 1.9.4 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 2.0.0-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1022,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.9.4:";; + short | recursive ) echo "Configuration of ntfsprogs 2.0.0-WIP:";; esac cat <<\_ACEOF @@ -1169,7 +1169,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.9.4 +ntfsprogs configure 2.0.0-WIP generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1183,7 +1183,7 @@ 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 ntfsprogs $as_me 1.9.4, which was +It was created by ntfsprogs $as_me 2.0.0-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1903,7 +1903,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.9.4' + VERSION='2.0.0-WIP' cat >>confdefs.h <<_ACEOF @@ -23027,7 +23027,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.9.4, which was +This file was extended by ntfsprogs $as_me 2.0.0-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23090,7 +23090,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.9.4 +ntfsprogs config.status 2.0.0-WIP configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index ae50ba8c..8262145e 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.9.4],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[2.0.0-WIP],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) From 27a017de703f9c1e7c1a94da9d753b9139011962 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 6 Sep 2004 09:44:16 +0000 Subject: [PATCH 1807/2994] Update library version for source/binary incompatible API changes. (Logical change 1.534) --- libntfs/Makefile.am | 2 +- libntfs/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 3df2822c..40b8c596 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -25,7 +25,7 @@ # - If the interface is the same as the previous version, change to C:R+1:A # -LTVERSION_LIBNTFS = 6:0:1 +LTVERSION_LIBNTFS = 7:0:0 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 0f69a8b3..2c1de395 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -231,7 +231,7 @@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ -LTVERSION_LIBNTFS = 6:0:1 +LTVERSION_LIBNTFS = 7:0:0 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs lib_LTLIBRARIES = libntfs.la From 38a92b52ae61c18ae138eb4974861fdd5bd0ef79 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 8 Sep 2004 11:39:55 +0000 Subject: [PATCH 1808/2994] Make ntfscp update all $FILE_NAME attributes, not only first (Logical change 1.535) --- ntfsprogs/ntfscp.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index b7cc2b3d..caefc17e 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -267,26 +267,26 @@ int main (int argc, char *argv[]) } need_logfile_reset = 1; - /* Update $FILE_NAME(0x30) attribute for new file size. */ + /* Update $FILE_NAME(0x30) attributes for new file size. */ ctx = ntfs_attr_get_search_ctx(out, NULL); if (!ctx) { perror("ERROR: Couldn't get search context"); goto close_attr; } - if (ntfs_attr_lookup(AT_FILE_NAME, 0, 0, 0, 0, NULL, 0, ctx)) { - perror("ERROR: Couldn't find $FILE_NAME attribute"); - ntfs_attr_put_search_ctx(ctx); - goto close_attr; - } - fna = (FILE_NAME_ATTR *)((u8*)ctx->attr + + while (!ntfs_attr_lookup(AT_FILE_NAME, 0, 0, 0, 0, NULL, 0, + ctx)) { + fna = (FILE_NAME_ATTR *)((u8*)ctx->attr + le16_to_cpu(ctx->attr->value_offset)); - if (NAttrNonResident(na)) { - fna->allocated_size = scpu_to_le64(na->allocated_size); - fna->data_size = scpu_to_le64(na->data_size); - } else { - fna->allocated_size = 0; - fna->data_size = 0; + if (sle64_to_cpu(fna->allocated_size) || + sle64_to_cpu(fna->data_size)) { + fna->allocated_size = scpu_to_le64( + na->allocated_size); + fna->data_size = scpu_to_le64(na->data_size); + } } + if (errno != ENOENT) + perror("ERROR: Attribute lookup failed"); + ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); } From 682a037a7f15600fd6a153590a6021f3973e0549 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 8 Sep 2004 11:39:55 +0000 Subject: [PATCH 1809/2994] Make ntfscp update all $FILE_NAME attributes, not only first BKrev: 413eef8bX2Usv96nigHTX27N5JZzOg From 3d8ff9eb4613d24b544fa16a4316e99d1405a12f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 8 Sep 2004 16:27:54 +0000 Subject: [PATCH 1810/2994] - Added dumping of index records from $INDEX_ROOT and $INDEX_ALLOCATION - Changed message for resident $INDEX_ALLOCION to print error, because it shouldn't be resident (Logical change 1.536) --- ntfsprogs/ntfsinfo.c | 235 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 228 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 13b544f1..e9b4c975 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -99,6 +99,7 @@ static void version (void) printf (" 2002-2004 Anton Altaparmakov\n"); printf (" 2002-2003 Richard Russon\n"); printf (" 2003 Leonard NorrgĂĄrd\n"); + printf (" 2004 Yura Pakhuchiy\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -894,6 +895,77 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol) } } +/** + * ntfs_dump_index_entries() + * + * dump sequence of index_entries and return number of entries dumped. + */ +static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) +{ + int numb_entries = 1; + char *name = NULL; + + Vprintf("\tDumping index entries:"); + while(1) { + if (!opts.verbose) { + if (entry->flags & INDEX_ENTRY_END) + break; + entry = (INDEX_ENTRY *)((u8 *)entry + + le16_to_cpu(entry->length)); + numb_entries++; + continue; + } + Vprintf("\n"); + Vprintf("\t\tEntry length:\t\t %u\n", + le16_to_cpu(entry->length)); + Vprintf("\t\tKey length:\t\t %u\n", + le16_to_cpu(entry->key_length)); + Vprintf("\t\tFlags:\t\t\t 0x%02x\n", le16_to_cpu(entry->flags)); + + if (entry->flags & INDEX_ENTRY_END) + break; + + switch(type) { + case(AT_FILE_NAME): + Vprintf("\t\tFILE record number:\t %llu\n", + MREF_LE(entry->indexed_file)); + Vprintf("\t\tFile attributes:\t 0x%02x\n", + le32_to_cpu( + entry->key.file_name.file_attributes)); + Vprintf("\t\tFile name namespace:\t 0x%02x\n", + entry->key.file_name.file_name_type); + ntfs_ucstombs(entry->key.file_name.file_name, + entry->key.file_name.file_name_length, + &name, 0); + Vprintf("\t\tName:\t\t\t %s\n", name); + free(name); + name = NULL; + Vprintf("\t\tParent directory:\t %lld\n", + MREF_LE(entry-> + key.file_name.parent_directory)); + Vprintf("\t\tData size:\t\t %lld\n", + sle64_to_cpu( + entry->key.file_name.data_size)); + Vprintf("\t\tAllocated size:\t\t %lld\n", + sle64_to_cpu( + entry->key.file_name.allocated_size)); + break; + default: + // TODO: determine more attribute types + Vprintf("\t\tData offset:\t\t %u\n", + le16_to_cpu(entry->data_offset)); + Vprintf("\t\tData length:\t\t %u\n", + le16_to_cpu(entry->data_length)); + break; + } + entry = (INDEX_ENTRY *)((u8 *)entry + + le16_to_cpu(entry->length)); + numb_entries++; + } + Vprintf("\tEnd of index block reached\n"); + return numb_entries; +} + /** * ntfs_dump_attr_index_root() * @@ -903,6 +975,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) { unsigned int type; INDEX_ROOT *index_root = NULL; + INDEX_ENTRY *entry; index_root = (INDEX_ROOT*)((u8*)attr + le16_to_cpu(attr->value_offset)); @@ -962,7 +1035,156 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) /* the flags are 8bit long, no need for byte-order handling */ printf("\tFlags:\t\t\t 0x%02x\n",index_root->index.flags); - /* printf("\tIndex Entries Following\t %u\n", ???? );*/ + + entry = (INDEX_ENTRY *)((u8 *)index_root + + le32_to_cpu(index_root->index.entries_offset) + 0x10); + printf("\tIndex entries total:\t %d\n", + ntfs_dump_index_entries(entry, index_root->type)); +} + +/** + * ntfs_dump_attr_index_allocation() + * + * determine size and type of INDX record + */ +static void get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, + ATTR_TYPES *type, u32 *size) +{ + ntfs_attr_search_ctx *ctx; + ntfschar *name = 0; + INDEX_ROOT *root; + + if (attr->name_length) { + name = malloc(attr->name_length * sizeof(ntfschar)); + if (!name) { + perror("malloc failed"); + return; + } + memcpy(name, (u8 *)attr + attr->name_offset, + attr->name_length * sizeof(ntfschar)); + } + ctx = ntfs_attr_get_search_ctx(ni, 0); + if (!ctx) { + perror("ntfs_get_search_ctx failed"); + free(name); + return; + } + if (ntfs_attr_lookup(AT_INDEX_ROOT, name, attr->name_length, 0, + 0, NULL, 0, ctx)) { + perror("ntfs_attr_lookup failed"); + ntfs_attr_put_search_ctx(ctx); + free(name); + return; + } + + root = (INDEX_ROOT*)((u8*)ctx->attr + + le16_to_cpu(ctx->attr->value_offset)); + *size = le32_to_cpu(root->index_block_size); + *type = root->type; + ntfs_attr_put_search_ctx(ctx); + free(name); +} + +/** + * ntfs_dump_attr_index_allocation() + * + * dump context of the index_allocation attribute + */ +static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) +{ + INDEX_ALLOCATION *allocation, *tmp_alloc; + INDEX_ENTRY *entry; + ATTR_TYPES type; + u32 indx_record_size; + int total_entries = 0; + int total_indx_blocks = 0; + ntfs_attr *na; + u8 *bitmap, *byte; + int bit; + ntfschar *name; + + get_type_and_size_of_indx(ni, attr, &type, &indx_record_size); + + name = malloc(attr->name_length * sizeof(ntfschar)); + if (!name) { + perror("malloc failed"); + return; + } + memcpy(name, (u8 *)attr + attr->name_offset, + attr->name_length * sizeof(ntfschar)); + na = ntfs_attr_open(ni, AT_BITMAP, name, attr->name_length); + if (!na) { + perror("ntfs_attr_open failed"); + free(name); + return; + } + bitmap = malloc(na->data_size); + if (!bitmap) { + perror("malloc failed"); + free(name); + return; + } + if (ntfs_attr_pread(na, 0, na->data_size, bitmap) != na->data_size) { + perror("ntfs_attr_pread failed"); + free(bitmap); + free(name); + return; + } + ntfs_attr_close(na); + byte = bitmap; + + name = malloc(attr->name_length * sizeof(ntfschar)); + if (!name) { + perror("malloc failed"); + return; + } + memcpy(name, (u8 *)attr + attr->name_offset, + attr->name_length * sizeof(ntfschar)); + na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, name, attr->name_length); + if (!na) { + perror("ntfs_attr_open failed"); + free(name); + free(bitmap); + return; + } + allocation = malloc(na->data_size); + if (!allocation) { + perror("malloc failed"); + free(name); + free(bitmap); + return; + } + if (ntfs_attr_pread(na, 0, na->data_size, allocation) + != na->data_size) { + perror("ntfs_attr_pread failed"); + free(name); + free(allocation); + free(bitmap); + return; + } + ntfs_attr_close(na); + tmp_alloc = allocation; + + bit = 0; + while((u8 *)tmp_alloc < (u8 *)allocation + na->data_size) { + if (*byte & (1 << bit)) { + entry = (INDEX_ENTRY *)((u8 *)tmp_alloc + le32_to_cpu( + tmp_alloc->index.entries_offset) + 0x18); + total_entries += ntfs_dump_index_entries(entry, type); + total_indx_blocks++; + } + tmp_alloc = (INDEX_ALLOCATION *)((u8 *)tmp_alloc + + indx_record_size); + bit++; + if (bit > 7) { + bit = 0; + byte++; + } + } + printf("\tIndex entries total:\t %d\n", total_entries); + printf("\tINDX blocks total:\t %d\n", total_indx_blocks); + free(allocation); + free(bitmap); } /** @@ -970,7 +1192,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) * * dump the index_allocation attribute */ -static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr) +static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) { printf("Dumping attribute $INDEX_ALLOCATION (0xA0)\n"); @@ -999,12 +1221,11 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr) printf("\tUsed data size:\t\t %llu\n", (unsigned long long)le64_to_cpu(attr->data_size)); } else { - /* print only the payload's size */ - printf("\tValue's size:\t\t %u\n", - (unsigned int)le32_to_cpu(attr->value_length)); + Eprintf("Invalid $INDEX_ALLOCTION attribute. Should be be" + " non-resident\n"); } - /* TODO: parse how many records does this B-*+/Tree contains */ + ntfs_dump_index_allocation(attr, ni); } /** @@ -1305,7 +1526,7 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) ntfs_dump_attr_index_root(ctx->attr); break; case AT_INDEX_ALLOCATION: - ntfs_dump_attr_index_allocation(ctx->attr); + ntfs_dump_attr_index_allocation(ctx->attr, inode); break; case AT_BITMAP: ntfs_dump_attr_bitmap(ctx->attr); From e252cfd1fb70cba04b96f439c2dddfceacc1b77f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 8 Sep 2004 16:27:54 +0000 Subject: [PATCH 1811/2994] - Added dumping of index records from $INDEX_ROOT and $INDEX_ALLOCATION - Changed message for resident $INDEX_ALLOCION to print error, because it shouldn't be resident BKrev: 413f330aNaPVFFoBGD1AKNClj5UZyg From 674fdcbc7ddcc73572ad576050153012b417f0d5 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 8 Sep 2004 16:35:01 +0000 Subject: [PATCH 1812/2994] update (Logical change 1.537) --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2ca52284..07cb406d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,11 @@ xx/xx/2004 - 2.0.0-WIP - Add start_vcn parameter to ntfs_get_size_for_mapping_pairs() and ntfs_mapping_pairs_build() and adapt all callers. - Bump library version due to source level API change above. + - ntfsinfo: Added dumping of index records from $INDEX_ROOT and + $INDEX_ALLOCATION. (Yura) + - ntfsinfo: Changed message for resident $INDEX_ALLOCATION to print + error, because $INDEX_ALLOCATION can't be resident. (Yura) + - ntfscp: Update all $FILE_NAME attributes, not only first. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 38cc93f5e732da9928a192fcf384dfcc6bf756e3 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 8 Sep 2004 16:35:01 +0000 Subject: [PATCH 1813/2994] update Changelog BKrev: 413f34b5oJ5NUxbIvCWEM0qqiix3wA From d6fc63d0b18bcc8da36b2fc1bba73349b83afe1f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 9 Sep 2004 07:54:06 +0000 Subject: [PATCH 1814/2994] Add ntfs_debug() and ntfs_error() to make kernel<->userspace porting easier. (Logical change 1.538) --- include/ntfs/debug.h | 12 ++++++++++++ libntfs/debug.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/include/ntfs/debug.h b/include/ntfs/debug.h index fc14333c..1652ba62 100644 --- a/include/ntfs/debug.h +++ b/include/ntfs/debug.h @@ -43,6 +43,15 @@ extern void __Sprintf(const int silent, const char *fmt, ...) /* Debug output to stderr. To get it run ./configure --enable-debug. */ +extern void __ntfs_debug (const char *file, int line, const char *function, + const char *format, ...) __attribute__((format(printf, 4, 5))); +#define ntfs_debug(f, a...) \ + __ntfs_debug(__FILE__, __LINE__, __FUNCTION__, f, ##a) + +extern void __ntfs_error(const char *function, + const char *fmt, ...) __attribute__((format(printf, 3, 4))); +#define ntfs_error(sb, f, a...) __ntfs_error(__FUNCTION__, f, ##a) + extern void __Dprintf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); #define Dprintf(f, a...) __Dprintf(f, ##a) @@ -57,6 +66,9 @@ extern void ntfs_debug_runlist_dump(const struct _runlist_element *rl); #else /* if !DEBUG */ +#define ntfs_debug(f, a...) do {} while (0) +#define ntfs_error(f, a...) do {} while (0) + #define Dprintf(f, a...) do {} while (0) #define Dputs(s) do {} while (0) #define Dperror(s) do {} while (0) diff --git a/libntfs/debug.c b/libntfs/debug.c index af355811..55008543 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -61,6 +61,41 @@ void __Sprintf(const int silent, const char *fmt, ...) /* Debug output to stderr. To get it run ./configure --enable-debug. */ +void __ntfs_error(const char *function, const char *fmt, ...) +{ + int eo = errno; + int flen = 0; + va_list args; + char err_buf[1024]; + + if (function) + flen = strlen(function); + va_start(args, fmt); + vsnprintf(err_buf, sizeof(err_buf), fmt, args); + va_end(args); + fprintf(stderr, "NTFS error: %s(): %s\n", flen ? function : "", + err_buf); + errno = eo; +} + +void __ntfs_debug (const char *file, int line, const char *function, + const char *fmt, ...) +{ + int eo = errno; + int flen = 0; + va_list args; + char err_buf[1024]; + + if (function) + flen = strlen(function); + va_start(args, fmt); + vsnprintf(err_buf, sizeof(err_buf), fmt, args); + va_end(args); + fprintf(stderr, "NTFS DEBUG (%s, %d): %s(): %s\n", file, line, + flen ? function : "", err_buf); + errno = eo; +} + void __Dprintf(const char *fmt, ...) { int eo = errno; From 44fa8df74bcbcc1126e964fe19e9df3f21575db2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 9 Sep 2004 07:54:06 +0000 Subject: [PATCH 1815/2994] Add ntfs_volume->sb pointer for kernel porting easyness (it is really only for benefit of being able to call ntfs_error(vol->sb, blah...); (Logical change 1.538) --- include/ntfs/volume.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index d78736d8..8191290c 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -102,7 +102,11 @@ typedef enum { * ntfs_volume - structure describing an open volume in memory */ struct _ntfs_volume { - struct ntfs_device *dev;/* NTFS device associated with the volume. */ + union { + struct ntfs_device *dev; /* NTFS device associated with + the volume. */ + void *sb; /* For kernel porting compatibility. */ + }; char *vol_name; /* Name of the volume. */ unsigned long state; /* NTFS specific flags describing this volume. See ntfs_volume_state_bits above. */ From 7deafa1bcb9df13c5600919ec2029bd8999a343f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 9 Sep 2004 07:54:06 +0000 Subject: [PATCH 1816/2994] Fix all warnings generated by --enable-warnings switch to configure. (Logical change 1.538) --- libntfs/gnome-vfs-method.c | 39 +++++++++++-------- libntfs/gnome-vfs-module.c | 77 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 15 deletions(-) diff --git a/libntfs/gnome-vfs-method.c b/libntfs/gnome-vfs-method.c index 07844fc7..462e5d2c 100644 --- a/libntfs/gnome-vfs-method.c +++ b/libntfs/gnome-vfs-method.c @@ -247,7 +247,8 @@ struct libntfs_directory { static GnomeVFSResult libntfs_gnomevfs_open_directory(GnomeVFSMethod *method, GnomeVFSMethodHandle **method_handle, GnomeVFSURI *uri, - GnomeVFSFileInfoOptions options, GnomeVFSContext *context) + GnomeVFSFileInfoOptions options __attribute__((unused)), + GnomeVFSContext *context __attribute__((unused))) { GnomeVFSResult errvfsresult; ntfs_volume *volume; @@ -276,7 +277,8 @@ static GnomeVFSResult libntfs_gnomevfs_open_directory(GnomeVFSMethod *method, } static GnomeVFSResult libntfs_gnomevfs_close_directory(GnomeVFSMethod *method, - GnomeVFSMethodHandle *method_handle, GnomeVFSContext *context) + GnomeVFSMethodHandle *method_handle, + GnomeVFSContext *context __attribute__((unused))) { struct libntfs_directory *libntfs_directory; int errint; @@ -331,7 +333,8 @@ static gchar *libntfs_ntfscharo_utf8(const ntfschar *name, const int name_len) */ static int libntfs_gnomevfs_read_directory_filldir( struct libntfs_directory *libntfs_directory /* dirent */, - const ntfschar *name, const int name_len, const int name_type, + const ntfschar *name, const int name_len, + const int name_type __attribute__((unused)), const s64 pos, const MFT_REF mref, const unsigned dt_type) { GnomeVFSFileInfo *file_info; @@ -413,7 +416,8 @@ static int libntfs_gnomevfs_read_directory_filldir( static GnomeVFSResult libntfs_gnomevfs_read_directory(GnomeVFSMethod *method, GnomeVFSMethodHandle *method_handle, - GnomeVFSFileInfo *file_info, GnomeVFSContext *context) + GnomeVFSFileInfo *file_info, + GnomeVFSContext *context __attribute__((unused))) { GnomeVFSResult errvfsresult; struct libntfs_directory *libntfs_directory; @@ -497,7 +501,8 @@ static GnomeVFSResult libntfs_open_attr(struct libntfs_file *libntfs_file) static GnomeVFSResult libntfs_gnomevfs_open(GnomeVFSMethod *method, GnomeVFSMethodHandle **method_handle_return, GnomeVFSURI *uri, - GnomeVFSOpenMode mode, GnomeVFSContext *context) + GnomeVFSOpenMode mode, + GnomeVFSContext *context __attribute__((unused))) { GnomeVFSResult errvfsresult; ntfs_volume *volume; @@ -530,8 +535,10 @@ static GnomeVFSResult libntfs_gnomevfs_open(GnomeVFSMethod *method, static GnomeVFSResult libntfs_gnomevfs_create(GnomeVFSMethod *method, GnomeVFSMethodHandle **method_handle_return, GnomeVFSURI *uri, - GnomeVFSOpenMode mode, gboolean exclusive, guint perm, - GnomeVFSContext *context) + GnomeVFSOpenMode mode __attribute__((unused)), + gboolean exclusive __attribute__((unused)), + guint perm __attribute__((unused)), + GnomeVFSContext *context __attribute__((unused))) { GnomeVFSResult errvfsresult; ntfs_volume *volume; @@ -549,7 +556,8 @@ static GnomeVFSResult libntfs_gnomevfs_create(GnomeVFSMethod *method, } static GnomeVFSResult libntfs_gnomevfs_close(GnomeVFSMethod *method, - GnomeVFSMethodHandle *method_handle, GnomeVFSContext *context) + GnomeVFSMethodHandle *method_handle, + GnomeVFSContext *context __attribute__((unused))) { struct libntfs_file *libntfs_file; int errint; @@ -579,7 +587,7 @@ static GnomeVFSResult libntfs_gnomevfs_close(GnomeVFSMethod *method, static GnomeVFSResult libntfs_gnomevfs_read(GnomeVFSMethod *method, GnomeVFSMethodHandle *method_handle, gpointer buffer, GnomeVFSFileSize num_bytes, GnomeVFSFileSize *bytes_read_return, - GnomeVFSContext *context) + GnomeVFSContext *context __attribute__((unused))) { GnomeVFSResult errvfsresult; struct libntfs_file *libntfs_file; @@ -616,7 +624,7 @@ static GnomeVFSResult libntfs_gnomevfs_read(GnomeVFSMethod *method, static GnomeVFSResult libntfs_gnomevfs_seek(GnomeVFSMethod *method, GnomeVFSMethodHandle *method_handle, GnomeVFSSeekPosition whence, GnomeVFSFileOffset offset, - GnomeVFSContext *context) + GnomeVFSContext *context __attribute__((unused))) { GnomeVFSResult errvfsresult; struct libntfs_file *libntfs_file; @@ -681,10 +689,11 @@ static gboolean libntfs_gnomevfs_is_local(GnomeVFSMethod *method, return gnome_vfs_uri_is_local(uri->parent); } -GnomeVFSResult libntfs_gnomevfs_get_file_info_from_handle( +static GnomeVFSResult libntfs_gnomevfs_get_file_info_from_handle( GnomeVFSMethod *method, GnomeVFSMethodHandle *method_handle, - GnomeVFSFileInfo *file_info, GnomeVFSFileInfoOptions options, - GnomeVFSContext *context) + GnomeVFSFileInfo *file_info, + GnomeVFSFileInfoOptions options __attribute__((unused)), + GnomeVFSContext *context __attribute__((unused))) { GnomeVFSResult errvfsresult; struct libntfs_file *libntfs_file; @@ -761,9 +770,9 @@ static GnomeVFSResult libntfs_gnomevfs_get_file_info(GnomeVFSMethod *method, return GNOME_VFS_OK; } -GnomeVFSResult libntfs_gnomevfs_check_same_fs(GnomeVFSMethod *method, +static GnomeVFSResult libntfs_gnomevfs_check_same_fs(GnomeVFSMethod *method, GnomeVFSURI *a, GnomeVFSURI *b, gboolean *same_fs_return, - GnomeVFSContext *context) + GnomeVFSContext *context __attribute__((unused))) { ntfs_volume *volume_a; ntfs_volume *volume_b; diff --git a/libntfs/gnome-vfs-module.c b/libntfs/gnome-vfs-module.c index e69de29b..ad789997 100644 --- a/libntfs/gnome-vfs-module.c +++ b/libntfs/gnome-vfs-module.c @@ -0,0 +1,77 @@ +/* + * gnome-vfs-module.c - Gnome-VFS init/shutdown implementation of interface to + * libntfs. Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Jan Kratochvil + * Copyright (c) 2003 Anton Altaparmakov + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include "gnome-vfs-method.h" +#include +#include +#include /* for g_atexit() */ + +/* Filesystem-module-scope lock for _any_ libntfs access. */ +G_LOCK_DEFINE(libntfs); + +static void vfs_module_shutdown_atexit(void); + +/** + * vfs_module_init: + * @method_name: FIXME + * @args: FIXME + * + * FIXME + * + * Returns: FIXME + */ +GnomeVFSMethod *vfs_module_init(const char *method_name, const char *args) +{ + GnomeVFSMethod *libntfs_gnomevfs_method_ptr; + + g_return_val_if_fail(method_name != NULL, NULL); + /* 'args' may be NULL if not supplied. */ + + libntfs_gnomevfs_method_ptr = libntfs_gnomevfs_method_init(method_name, + args); + + g_atexit(vfs_module_shutdown_atexit); + + return libntfs_gnomevfs_method_ptr; +} + +/** + * vfs_module_shutdown: + */ +void vfs_module_shutdown(GnomeVFSMethod *method __attribute__((unused))) +{ + /* + * 'method' may be NULL if we are called from + * vfs_module_shutdown_atexit(). + */ + + libntfs_gnomevfs_method_shutdown(); +} + +static void vfs_module_shutdown_atexit(void) +{ + vfs_module_shutdown(NULL); +} + From 3d754433c82ab98723e4633e9aa7c79a75e4530e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 9 Sep 2004 07:54:06 +0000 Subject: [PATCH 1817/2994] Merge 2004/09/06 11:16:23+01:00 cantab.net!aia21 Fix all warnings in gnome-vfs-method/module generated by --enable-warnings switch to configure. 2004/09/06 11:07:21+01:00 cantab.net!aia21 Add ntfs_debug() and ntfs_error() to make kernel<->userspace porting easier. BKrev: 41400c1efCaK8DxrxgwPG4p071sooA From 3da1cc0cb954d419d40e6a2f1eda9ba30b3ac1d0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 9 Sep 2004 07:54:06 +0000 Subject: [PATCH 1818/2994] Merge. 2004/09/06 11:07:20+01:00 cantab.net!aia21 Add ntfs_debug() and ntfs_error() to make kernel<->userspace porting easier. (Logical change 1.538) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 07cb406d..52103953 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ xx/xx/2004 - 2.0.0-WIP - Add start_vcn parameter to ntfs_get_size_for_mapping_pairs() and ntfs_mapping_pairs_build() and adapt all callers. - Bump library version due to source level API change above. + - Add ntfs_debug() and ntfs_error() to make kernel<->userspace porting + easier. - ntfsinfo: Added dumping of index records from $INDEX_ROOT and $INDEX_ALLOCATION. (Yura) - ntfsinfo: Changed message for resident $INDEX_ALLOCATION to print From cbbd254b20845ae621b8987cf4222db135a61d19 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 9 Sep 2004 13:56:46 +0000 Subject: [PATCH 1819/2994] Export ntfs_attr_record_resize. (Logical change 1.539) --- include/ntfs/attrib.h | 2 ++ libntfs/attrib.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index ca209b13..ccaceaca 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -273,6 +273,8 @@ extern int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, extern int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type); +extern int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size); + extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, const u32 newsize); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index fcb172b4..d6d17e5c 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2238,7 +2238,7 @@ int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type) * Warning: If you make a record smaller without having copied all the data you * are interested in the data may be overwritten! */ -static int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) +int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) { /* Align to 8 bytes, just in case the caller hasn't. */ new_size = (new_size + 7) & ~7; From 1bc8af5747adbadd7d394340ac27129ae5b24ac2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 9 Sep 2004 13:56:46 +0000 Subject: [PATCH 1820/2994] Export ntfs_attr_record_resize. BKrev: 4140611ebRiuo9Q-1bZjCS6aayFcNQ From e1249adc6c32113d58eb15bb29ecbb47e8de2f28 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 9 Sep 2004 13:56:46 +0000 Subject: [PATCH 1821/2994] Fix typo. (Logical change 1.539) --- libntfs/lcnalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index d24f85e5..dc561d80 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -429,7 +429,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, if (rl) free(rl); free(buf); - NTFS_BUG("switch(search_zone)"); + NTFS_BUG("switch(search_zone) 1"); return NULL; } Dprintf("%s(): Going to done_ret.\n", @@ -490,7 +490,7 @@ zone_pass_done: /* Finished with the current zone pass. */ zone_start = 0; break; default: - NTFS_BUG("switch(search_zone), 2"); + NTFS_BUG("switch(search_zone) 2"); } /* Sanity check. */ if (zone_end < zone_start) From a085e4b50131a1a28c16622a3b9e9466a8dd7bd0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 9 Sep 2004 13:57:31 +0000 Subject: [PATCH 1822/2994] Update build to SuSE 9.2 beta 1 tools (autoconf,automake,libtool,...). (Logical change 1.540) --- Makefile.in | 50 ++- aclocal.m4 | 561 +++++++++++++++--------- config.guess | 52 +-- config.sub | 41 +- configure | 792 +++++++++++++++++++--------------- depcomp | 34 +- doc/Makefile.in | 8 +- include/Makefile.in | 32 +- include/ntfs/Makefile.in | 26 +- install-sh | 132 +++--- libntfs/Makefile.in | 121 ++---- ltmain.sh | 898 +++++++++++++++++++-------------------- ntfsprogs/Makefile.in | 42 +- 13 files changed, 1517 insertions(+), 1272 deletions(-) diff --git a/Makefile.in b/Makefile.in index 5cca236d..7d7a0391 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -33,7 +33,9 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +target_triplet = @target@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/ntfsprogs.spec.in $(top_srcdir)/configure AUTHORS \ @@ -147,6 +149,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -325,14 +329,16 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ + empty_fix=.; \ else \ include_option=--include; \ + empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ + test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ @@ -342,9 +348,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -398,15 +406,17 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done - list='$(SUBDIRS)'; for subdir in $$list; do \ + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || mkdir "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="../$(top_distdir)" \ - distdir="../$(distdir)/$$subdir" \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ @@ -420,15 +430,15 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir - $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir - $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir @@ -441,7 +451,7 @@ dist-zip: distdir $(am__remove_distdir) dist dist-all: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then @@ -450,13 +460,13 @@ dist dist-all: distdir distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac @@ -535,7 +545,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -595,7 +605,7 @@ uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ check-am clean clean-generic clean-libtool clean-recursive \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ - dist-shar dist-tarZ dist-zip distcheck distclean \ + dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-recursive distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ diff --git a/aclocal.m4 b/aclocal.m4 index bc9cb7db..7310a0e3 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.8.3 -*- Autoconf -*- +# generated automatically by aclocal 1.9.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. @@ -191,6 +191,8 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -308,7 +310,7 @@ fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -632,7 +634,7 @@ AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 - testring="ABCD" + teststring="ABCD" case $build_os in msdosdjgpp*) @@ -667,20 +669,34 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=8192; ;; + netbsd* | freebsd* | openbsd* | darwin* ) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + ;; + *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ - = "XX$testring") >/dev/null 2>&1 && - new_result=`expr "X$testring" : ".*" 2>&1` && + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` - testring=$testring$testring + teststring=$teststring$teststring done - testring= + teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. @@ -1005,8 +1021,8 @@ AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_AC_TAGVAR(hardcode_action, $1)= if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then + test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existant directories. if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && @@ -1076,7 +1092,7 @@ AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], library_names_spec= libname_spec='lib$name' soname_spec= -shrext=".so" +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -1173,7 +1189,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -1189,7 +1205,7 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows - shrext=".dll" + shrext_cmds=".dll" need_version=no need_lib_prefix=no @@ -1254,7 +1270,7 @@ darwin* | rhapsody*) soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -1337,7 +1353,7 @@ hpux9* | hpux10* | hpux11*) need_version=no case "$host_cpu" in ia64*) - shrext='.so' + shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH @@ -1352,7 +1368,7 @@ hpux9* | hpux10* | hpux11*) sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) - shrext='.sl' + shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH @@ -1363,7 +1379,7 @@ hpux9* | hpux10* | hpux11*) sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) - shrext='.sl' + shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH @@ -1434,8 +1450,8 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -1497,7 +1513,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=yes + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -1517,7 +1533,7 @@ openbsd*) os2*) libname_spec='$name' - shrext=".dll" + shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' @@ -2068,6 +2084,15 @@ case $reload_flag in *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac ])# AC_PROG_LD_RELOAD_FLAG @@ -2101,21 +2126,21 @@ beos*) lt_cv_deplibs_check_method=pass_all ;; -bsdi4*) +bsdi[[45]]*) 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*) - # win32_libid is a shell function defined in ltmain.sh + # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='win32_libid' + lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by - # win32_libid shell function, so use a weaker test based on 'objdump'. + # func_win32_libid shell function, so use a weaker test based on 'objdump'. lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; @@ -2205,12 +2230,10 @@ nto-qnx*) ;; openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; @@ -2535,46 +2558,9 @@ aix3*) fi ;; -aix4*) +aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac @@ -2853,6 +2839,7 @@ case $host_os in esac ;; + cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. @@ -2876,57 +2863,68 @@ case $host_os in _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; - - darwin* | rhapsody*) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; dgux*) case $cc_basename in @@ -2983,7 +2981,7 @@ case $host_os in # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then @@ -3132,9 +3130,20 @@ case $host_os in icpc) # Intel C++ with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' @@ -3191,6 +3200,20 @@ case $host_os in # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; osf3*) case $cc_basename in KCC) @@ -3686,7 +3709,7 @@ aix3*) postinstall_cmds='$RANLIB $lib' fi ;; -aix4*) +aix4* | aix5*) test "$enable_shared" = yes && enable_static=no ;; esac @@ -3949,7 +3972,7 @@ Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= @@ -4041,7 +4064,7 @@ objext="$ac_objext" libext="$libext" # Shared library suffix (normally ".so"). -shrext='$shrext' +shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" @@ -4581,6 +4604,16 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; esac ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; dgux*) case $cc_basename in ec++) @@ -4834,6 +4867,16 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -5149,7 +5192,7 @@ EOF ;; linux*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" supports_anon_versioning=no @@ -5335,7 +5378,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - bsdi4*) + bsdi[[45]]*) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; @@ -5349,7 +5392,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext=".dll" + shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. @@ -5361,52 +5404,52 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - _LT_AC_TAGVAR(ld_shlibs, $1)=no + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac fi ;; @@ -5551,6 +5594,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else @@ -5914,8 +5958,8 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do fi done done -SED=$lt_cv_path_SED ]) +SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) @@ -5999,14 +6043,14 @@ AC_DEFUN([PKG_CHECK_MODULES], [ # ---------------------------- # 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.8"]) +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # 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.8.3])]) + [AM_AUTOMAKE_VERSION([1.9.1])]) # AM_AUX_DIR_EXPAND @@ -6074,7 +6118,7 @@ am_aux_dir=`cd $ac_aux_dir && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc. +# Copyright (C) 1997, 2000, 2001, 2003, 2004 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 @@ -6111,8 +6155,8 @@ else 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.]) + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) fi])]) # serial 7 -*- Autoconf -*- @@ -6232,9 +6276,14 @@ AC_CACHE_CHECK([dependency style of $depcc], 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 + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi @@ -6280,7 +6329,8 @@ AC_SUBST([AMDEPBACKSLASH]) # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# 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 @@ -6316,27 +6366,21 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], else continue fi - grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //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 ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. 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 " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue @@ -6367,7 +6411,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # 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 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -6443,7 +6487,6 @@ 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 AC_REQUIRE([AM_PROG_MKDIR_P])dnl @@ -6452,7 +6495,9 @@ AC_REQUIRE([AM_PROG_MKDIR_P])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl - +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], @@ -6695,13 +6740,21 @@ fi # this.) AC_DEFUN([AM_PROG_MKDIR_P], [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -6867,3 +6920,111 @@ fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004 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 + + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/config.guess b/config.guess index 9b9789b1..d949270a 100755 --- a/config.guess +++ b/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-03-03' +timestamp='2004-08-11' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -222,6 +222,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + luna88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -237,9 +240,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - pegasos:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -317,9 +317,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; - Alpha*:OpenVMS:*:*) - echo alpha-hp-vms - exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -774,7 +771,7 @@ EOF echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` @@ -797,21 +794,7 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - # GNU/KFreeBSD systems have a "k" prefix to indicate we are using - # FreeBSD's kernel, but not the complete OS. - case ${LIBC} in gnu) kernel_only='k' ;; esac - echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -863,6 +846,9 @@ EOF ia64:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR}-linux + exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; @@ -1103,9 +1089,9 @@ EOF M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; - M68*:*:R3V[567]*:*) + M68*:*:R3V[5678]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -1203,9 +1189,10 @@ EOF echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) - case `uname -p` in + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; + unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; @@ -1267,6 +1254,13 @@ EOF *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms && exit 0 ;; + I*) echo ia64-dec-vms && exit 0 ;; + V*) echo vax-dec-vms && exit 0 ;; + esac esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/config.sub b/config.sub index be933fde..236e424d 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-02-23' +timestamp='2004-06-24' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -70,7 +70,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -145,7 +145,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -237,7 +237,7 @@ case $basic_machine in | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m68000 | m68k | m88k | mcore \ + | m32r | m32rle | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -262,7 +262,7 @@ case $basic_machine in | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ @@ -300,7 +300,7 @@ case $basic_machine in | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ @@ -308,7 +308,7 @@ case $basic_machine in | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | m32r-* \ + | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ @@ -326,8 +326,9 @@ case $basic_machine in | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ @@ -336,7 +337,7 @@ case $basic_machine in | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ @@ -445,6 +446,10 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; cr16c) basic_machine=cr16c-unknown os=-elf @@ -659,10 +664,6 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -743,10 +744,6 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -1059,6 +1056,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1081,7 +1081,7 @@ case $basic_machine in sh64) basic_machine=sh64-unknown ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) @@ -1371,6 +1371,9 @@ case $basic_machine in *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; diff --git a/configure b/configure index 8d06d2db..ab8e1a33 100755 --- a/configure +++ b/configure @@ -280,7 +280,7 @@ fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os 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 mkdir_p AWK SET_MAKE am__leading_dot REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1629,7 +1629,7 @@ test -n "$target_alias" && ac_config_headers="$ac_config_headers config.h" -am__api_version="1.8" +am__api_version="1.9" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: @@ -1781,13 +1781,21 @@ echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' else # On NextStep and OpenStep, the `mkdir' command does not # recognize any option. It will interpret all options as @@ -1931,9 +1939,6 @@ 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"} # Installed binaries are usually stripped using `strip' when the user @@ -2026,6 +2031,13 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + @@ -3240,9 +3252,14 @@ else 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 + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi @@ -3466,10 +3483,10 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do fi done done -SED=$lt_cv_path_SED fi +SED=$lt_cv_path_SED echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 @@ -3610,6 +3627,15 @@ case $reload_flag in *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 @@ -3685,21 +3711,21 @@ beos*) lt_cv_deplibs_check_method=pass_all ;; -bsdi4*) +bsdi[45]*) 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*) - # win32_libid is a shell function defined in ltmain.sh + # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='win32_libid' + lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by - # win32_libid shell function, so use a weaker test based on 'objdump'. + # func_win32_libid shell function, so use a weaker test based on 'objdump'. lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; @@ -3789,12 +3815,10 @@ nto-qnx*) ;; openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; @@ -3887,7 +3911,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3890 "configure"' > conftest.$ac_ext + echo '#line 3914 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5098,9 +5122,14 @@ else 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 + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi @@ -5454,7 +5483,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5457:" \ +echo "$as_me:5486:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5609,7 +5638,7 @@ if test "${lt_cv_sys_max_cmd_len+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else i=0 - testring="ABCD" + teststring="ABCD" case $build_os in msdosdjgpp*) @@ -5644,20 +5673,34 @@ else lt_cv_sys_max_cmd_len=8192; ;; + netbsd* | freebsd* | openbsd* | darwin* ) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + ;; + *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \ - = "XX$testring") >/dev/null 2>&1 && - new_result=`expr "X$testring" : ".*" 2>&1` && + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` - testring=$testring$testring + teststring=$teststring$teststring done - testring= + teststring= # Add a significant safety factor because C++ compilers can tack on massive # amounts of additional arguments before passing them to the linker. # It appears as though 1/2 is a usable value. @@ -6217,6 +6260,8 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -6488,11 +6533,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6491: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6536: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6495: \$? = $ac_status" >&5 + echo "$as_me:6540: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6599,6 +6644,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + lt_prog_compiler_pic='-qnocommon' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -6721,11 +6776,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6724: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6779: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6728: \$? = $ac_status" >&5 + echo "$as_me:6783: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6781,11 +6836,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6784: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6839: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6788: \$? = $ac_status" >&5 + echo "$as_me:6843: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -6997,7 +7052,7 @@ EOF ;; linux*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_cmds="$tmp_archive_cmds" supports_anon_versioning=no @@ -7285,7 +7340,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs=no ;; - bsdi4*) + bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; @@ -7299,7 +7354,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext=".dll" + shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. @@ -7311,52 +7366,52 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc=no case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag='-undefined dynamic_lookup' - ;; - esac - fi - ;; + rhapsody* | darwin1.[012]) + allow_undefined_flag='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='-all_load $convenience' + whole_archive_flag_spec='' link_all_deplibs=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - ld_shlibs=no + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs=no + ;; + esac fi ;; @@ -7501,6 +7556,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else @@ -7755,7 +7811,7 @@ echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= -shrext=".so" +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -7852,7 +7908,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -7868,7 +7924,7 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows - shrext=".dll" + shrext_cmds=".dll" need_version=no need_lib_prefix=no @@ -7933,7 +7989,7 @@ darwin* | rhapsody*) soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -8016,7 +8072,7 @@ hpux9* | hpux10* | hpux11*) need_version=no case "$host_cpu" in ia64*) - shrext='.so' + shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH @@ -8031,7 +8087,7 @@ hpux9* | hpux10* | hpux11*) sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) - shrext='.sl' + shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH @@ -8042,7 +8098,7 @@ hpux9* | hpux10* | hpux11*) sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) - shrext='.sl' + shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH @@ -8113,8 +8169,8 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -8176,7 +8232,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=yes + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -8196,7 +8252,7 @@ openbsd*) os2*) libname_spec='$name' - shrext=".dll" + shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' @@ -8298,8 +8354,8 @@ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var " || \ - test "X$hardcode_automatic"="Xyes" ; then + test -n "$runpath_var" || \ + test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && @@ -8965,7 +9021,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext </dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= @@ -9464,7 +9483,7 @@ objext="$ac_objext" libext="$libext" # Shared library suffix (normally ".so"). -shrext='$shrext' +shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" @@ -10249,6 +10268,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac ;; + cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. @@ -10272,57 +10292,68 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs_CXX=no fi ;; - - darwin* | rhapsody*) - if test "$GXX" = yes; then - archive_cmds_need_lc_CXX=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_CXX='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_CXX='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_CXX='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_CXX='-undefined dynamic_lookup' - ;; + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='' + link_all_deplibs_CXX=yes - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='-all_load $convenience' - link_all_deplibs_CXX=yes - else - ld_shlibs_CXX=no - fi - ;; + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_CXX=no + ;; + esac + fi + ;; dgux*) case $cc_basename in @@ -10379,7 +10410,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then @@ -10528,9 +10559,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi icpc) # Intel C++ with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac archive_cmds_need_lc_CXX=no - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' @@ -10587,6 +10629,20 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + openbsd*) + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; osf3*) case $cc_basename in KCC) @@ -11042,6 +11098,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; esac ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + lt_prog_compiler_pic_CXX='-qnocommon' + lt_prog_compiler_wl_CXX='-Wl,' + ;; + esac + ;; dgux*) case $cc_basename in ec++) @@ -11242,11 +11308,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11245: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11311: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11249: \$? = $ac_status" >&5 + echo "$as_me:11315: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -11302,11 +11368,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11305: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11371: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11309: \$? = $ac_status" >&5 + echo "$as_me:11375: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11453,7 +11519,7 @@ echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= -shrext=".so" +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -11550,7 +11616,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -11566,7 +11632,7 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows - shrext=".dll" + shrext_cmds=".dll" need_version=no need_lib_prefix=no @@ -11631,7 +11697,7 @@ darwin* | rhapsody*) soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -11714,7 +11780,7 @@ hpux9* | hpux10* | hpux11*) need_version=no case "$host_cpu" in ia64*) - shrext='.so' + shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH @@ -11729,7 +11795,7 @@ hpux9* | hpux10* | hpux11*) sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) - shrext='.sl' + shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH @@ -11740,7 +11806,7 @@ hpux9* | hpux10* | hpux11*) sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) - shrext='.sl' + shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH @@ -11811,8 +11877,8 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -11874,7 +11940,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=yes + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -11894,7 +11960,7 @@ openbsd*) os2*) libname_spec='$name' - shrext=".dll" + shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' @@ -11996,8 +12062,8 @@ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || \ - test -n "$runpath_var CXX" || \ - test "X$hardcode_automatic_CXX"="Xyes" ; then + test -n "$runpath_var_CXX" || \ + test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_CXX" != no && @@ -12663,7 +12729,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' fi ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + lt_prog_compiler_pic_F77='-qnocommon' + lt_prog_compiler_wl_F77='-Wl,' + ;; + esac + ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -13588,11 +13664,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13591: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13667: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13595: \$? = $ac_status" >&5 + echo "$as_me:13671: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13648,11 +13724,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13651: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13727: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13655: \$? = $ac_status" >&5 + echo "$as_me:13731: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13864,7 +13940,7 @@ EOF ;; linux*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_cmds_F77="$tmp_archive_cmds" supports_anon_versioning=no @@ -14132,7 +14208,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs_F77=no ;; - bsdi4*) + bsdi[45]*) export_dynamic_flag_spec_F77=-rdynamic ;; @@ -14146,7 +14222,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext=".dll" + shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. @@ -14158,52 +14234,52 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc_F77=no case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_F77='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_F77='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_F77='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_F77='-undefined dynamic_lookup' - ;; - esac - fi - ;; + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_cmds_need_lc_F77=no hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported - whole_archive_flag_spec_F77='-all_load $convenience' + whole_archive_flag_spec_F77='' link_all_deplibs_F77=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - ld_shlibs_F77=no + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_F77=no + ;; + esac fi ;; @@ -14348,6 +14424,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' else @@ -14602,7 +14679,7 @@ echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= -shrext=".so" +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -14699,7 +14776,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -14715,7 +14792,7 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows - shrext=".dll" + shrext_cmds=".dll" need_version=no need_lib_prefix=no @@ -14780,7 +14857,7 @@ darwin* | rhapsody*) soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -14863,7 +14940,7 @@ hpux9* | hpux10* | hpux11*) need_version=no case "$host_cpu" in ia64*) - shrext='.so' + shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH @@ -14878,7 +14955,7 @@ hpux9* | hpux10* | hpux11*) sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) - shrext='.sl' + shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH @@ -14889,7 +14966,7 @@ hpux9* | hpux10* | hpux11*) sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) - shrext='.sl' + shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH @@ -14960,8 +15037,8 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -15023,7 +15100,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=yes + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15043,7 +15120,7 @@ openbsd*) os2*) libname_spec='$name' - shrext=".dll" + shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' @@ -15145,8 +15222,8 @@ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || \ - test -n "$runpath_var F77" || \ - test "X$hardcode_automatic_F77"="Xyes" ; then + test -n "$runpath_var_F77" || \ + test "X$hardcode_automatic_F77" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_F77" != no && @@ -15384,7 +15461,7 @@ objext="$ac_objext" libext="$libext" # Shared library suffix (normally ".so"). -shrext='$shrext' +shrext_cmds='$shrext_cmds' # Executable file suffix (normally ""). exeext="$exeext" @@ -15682,11 +15759,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15685: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15762: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15689: \$? = $ac_status" >&5 + echo "$as_me:15766: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15793,6 +15870,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' fi ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + lt_prog_compiler_pic_GCJ='-qnocommon' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + esac + ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -15915,11 +16002,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15918: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16005: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15922: \$? = $ac_status" >&5 + echo "$as_me:16009: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15975,11 +16062,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15978: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16065: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15982: \$? = $ac_status" >&5 + echo "$as_me:16069: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16191,7 +16278,7 @@ EOF ;; linux*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_cmds_GCJ="$tmp_archive_cmds" supports_anon_versioning=no @@ -16479,7 +16566,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs_GCJ=no ;; - bsdi4*) + bsdi[45]*) export_dynamic_flag_spec_GCJ=-rdynamic ;; @@ -16493,7 +16580,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext=".dll" + shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. @@ -16505,52 +16592,52 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc_GCJ=no case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_GCJ='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_GCJ='-undefined dynamic_lookup' - ;; - esac - fi - ;; + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_cmds_need_lc_GCJ=no hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported - whole_archive_flag_spec_GCJ='-all_load $convenience' + whole_archive_flag_spec_GCJ='' link_all_deplibs_GCJ=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - ld_shlibs_GCJ=no + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_GCJ=no + ;; + esac fi ;; @@ -16695,6 +16782,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' else @@ -16949,7 +17037,7 @@ echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= -shrext=".so" +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -17046,7 +17134,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -17062,7 +17150,7 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows - shrext=".dll" + shrext_cmds=".dll" need_version=no need_lib_prefix=no @@ -17127,7 +17215,7 @@ darwin* | rhapsody*) soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -17210,7 +17298,7 @@ hpux9* | hpux10* | hpux11*) need_version=no case "$host_cpu" in ia64*) - shrext='.so' + shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH @@ -17225,7 +17313,7 @@ hpux9* | hpux10* | hpux11*) sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) - shrext='.sl' + shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH @@ -17236,7 +17324,7 @@ hpux9* | hpux10* | hpux11*) sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) - shrext='.sl' + shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH @@ -17307,8 +17395,8 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` - sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -17370,7 +17458,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=yes + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -17390,7 +17478,7 @@ openbsd*) os2*) libname_spec='$name' - shrext=".dll" + shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' @@ -17492,8 +17580,8 @@ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_GCJ= if test -n "$hardcode_libdir_flag_spec_GCJ" || \ - test -n "$runpath_var GCJ" || \ - test "X$hardcode_automatic_GCJ"="Xyes" ; then + test -n "$runpath_var_GCJ" || \ + test "X$hardcode_automatic_GCJ" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_GCJ" != no && @@ -18159,7 +18247,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext < /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //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 ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. 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 " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue diff --git a/depcomp b/depcomp index 9e5522d0..11e2d3bf 100755 --- a/depcomp +++ b/depcomp @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2003-11-08.23 +scriptversion=2004-05-31.23 -# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004 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 @@ -43,6 +43,7 @@ Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). @@ -61,18 +62,10 @@ if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi -# `libtool' can also be set to `yes' or `no'. - -if test -z "$depfile"; then - base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` - dir=`echo "$object" | sed 's,/.*$,/,'` - if test "$dir" = "$object"; then - dir= - fi - # FIXME: should be _deps on DOS. - depfile="$dir.deps/$base" -fi +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" @@ -294,26 +287,35 @@ tru64) base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then + # Dependencies are output in .lo.d with libtool 1.4. + # With libtool 1.5 they are output both in $dir.libs/$base.o.d + # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the + # latter, because the former will be cleaned when $dir.libs is + # erased. tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir.libs/$base.d" + tmpdepfile2="$dir$base.o.d" + tmpdepfile3="$dir.libs/$base.d" "$@" -Wc,-MD else tmpdepfile1="$dir$base.o.d" tmpdepfile2="$dir$base.d" + tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" - else + elif test -f "$tmpdepfile2"; then tmpdepfile="$tmpdepfile2" + else + tmpdepfile="$tmpdepfile3" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" diff --git a/doc/Makefile.in b/doc/Makefile.in index 200d08e6..6e22c40d 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -33,7 +33,9 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +target_triplet = @target@ subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -122,6 +124,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -264,7 +268,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/include/Makefile.in b/include/Makefile.in index f621ba46..6910f183 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -33,7 +33,9 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +target_triplet = @target@ subdir = include DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -131,6 +133,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -280,14 +284,16 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ + empty_fix=.; \ else \ include_option=--include; \ + empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ + test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ @@ -297,9 +303,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -350,15 +358,17 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done - list='$(SUBDIRS)'; for subdir in $$list; do \ + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ - || mkdir "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="../$(top_distdir)" \ - distdir="../$(distdir)/$$subdir" \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ distdir) \ || exit 1; \ fi; \ @@ -387,7 +397,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index d6a59487..bbd4870e 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -34,7 +34,9 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +target_triplet = @target@ subdir = include/ntfs DIST_COMMON = $(linux_ntfsinclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in @@ -47,6 +49,12 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(linux_ntfsincludedir)" linux_ntfsincludeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(linux_ntfsinclude_HEADERS) @@ -129,6 +137,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -237,7 +247,7 @@ install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) test -z "$(linux_ntfsincludedir)" || $(mkdir_p) "$(DESTDIR)$(linux_ntfsincludedir)" @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " $(linux_ntfsincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(linux_ntfsincludedir)/$$f'"; \ $(linux_ntfsincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ done @@ -245,7 +255,7 @@ install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) uninstall-linux_ntfsincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(linux_ntfsincludedir)/$$f'"; \ rm -f "$(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ done @@ -270,9 +280,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -349,7 +361,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/install-sh b/install-sh index 77bc3814..b777f124 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-02-15.20 +scriptversion=2004-07-05.00 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -58,9 +58,6 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" -transformbasename= -transform_arg= -instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= @@ -70,23 +67,27 @@ mvcmd="$mvprog" src= dst= dir_arg= +dstarg= +no_target_directory= -usage="Usage: $0 [OPTION]... SRCFILE DSTFILE +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 -d DIRECTORIES... + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... -In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default. -In the second, create the directory path DIR. +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. Options: --b=TRANSFORMBASENAME --c copy source (using $cpprog) instead of moving (using $mvprog). +-c (ignored) -d create directories instead of installing files. --g GROUP $chgrp installed files to GROUP. --m MODE $chmod installed files to MODE. --o USER $chown installed files to USER. --s strip installed files (using $stripprog). --t=TRANSFORM +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. @@ -96,12 +97,7 @@ Environment variables override the default commands: while test -n "$1"; do case $1 in - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - -c) instcmd=$cpprog - shift + -c) shift continue;; -d) dir_arg=true @@ -129,14 +125,20 @@ while test -n "$1"; do shift continue;; - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; --version) echo "$0 $scriptversion"; exit 0;; *) # When -d is used, all remaining arguments are directories to create. - test -n "$dir_arg" && break + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do @@ -174,13 +176,13 @@ do src= if test -d "$dst"; then - instcmd=: + mkdircmd=: chmodcmd= else - instcmd=$mkdirprog + mkdircmd=$mkdirprog fi else - # Waiting for this to be detected by the "$instcmd $src $dsttmp" command + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then @@ -202,6 +204,10 @@ do # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi dst=$dst/`basename "$src"` fi fi @@ -229,34 +235,25 @@ do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" || lasterr=$? + $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. - test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; } + test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then - $doit $instcmd "$dst" \ + $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else - # If we're going to rename the final executable, determine the name now. - if test -z "$transformarg"; then - dstfile=`basename "$dst"` - else - dstfile=`basename "$dst" $transformbasename \ - | sed $transformarg`$transformbasename - fi - - # don't allow the sed command to completely eliminate the filename. - test -z "$dstfile" && dstfile=`basename "$dst"` + dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ @@ -266,40 +263,49 @@ do trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 - # Move or copy the file name to the temp name - $doit $instcmd "$src" "$dsttmp" && + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $instcmd $src $dsttmp" command. + # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - # Now remove or move aside any old file at destination location. We - # try this two ways since rm can't unlink itself on some systems and - # the destination file might be busy for other reasons. In this case, - # the final cleanup might fail but the new file should still install - # successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit - } - else - : - fi - } && - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } fi || { (exit 1); exit; } done diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 2c1de395..70d09650 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -64,7 +64,9 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +target_triplet = @target@ subdir = libntfs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/libntfs-gnomevfs.8.in $(srcdir)/libntfs.conf.in @@ -75,7 +77,15 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = libntfs.conf libntfs-gnomevfs.8 -am__installdirs = "$(DESTDIR)$(gnomevfsmoduleslibdir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(gnomevfsmodulesconfdir)" +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(gnomevfsmoduleslibdir)" \ + "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man8dir)" \ + "$(DESTDIR)$(gnomevfsmodulesconfdir)" gnomevfsmoduleslibLTLIBRARIES_INSTALL = $(INSTALL) libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(gnomevfsmoduleslib_LTLIBRARIES) $(lib_LTLIBRARIES) @@ -84,6 +94,8 @@ am_libntfs_gnomevfs_la_OBJECTS = \ libntfs_gnomevfs_la-gnome-vfs-method.lo \ libntfs_gnomevfs_la-gnome-vfs-module.lo libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) +@ENABLE_GNOME_VFS_TRUE@am_libntfs_gnomevfs_la_rpath = -rpath \ +@ENABLE_GNOME_VFS_TRUE@ $(gnomevfsmoduleslibdir) libntfs_la_LIBADD = am_libntfs_la_OBJECTS = attrib.lo attrlist.lo bitmap.lo bootsect.lo \ compat.lo compress.lo debug.lo device.lo device_io.lo dir.lo \ @@ -93,25 +105,13 @@ libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrib.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/attrlist.Plo ./$(DEPDIR)/bitmap.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/bootsect.Plo ./$(DEPDIR)/compat.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/compress.Plo ./$(DEPDIR)/debug.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/device.Plo ./$(DEPDIR)/device_io.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/dir.Plo ./$(DEPDIR)/inode.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/lcnalloc.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/mft.Plo ./$(DEPDIR)/mst.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/runlist.Plo ./$(DEPDIR)/security.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/unistr.Plo ./$(DEPDIR)/volume.Plo COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) @@ -199,6 +199,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -313,7 +315,7 @@ install-gnomevfsmoduleslibLTLIBRARIES: $(gnomevfsmoduleslib_LTLIBRARIES) test -z "$(gnomevfsmoduleslibdir)" || $(mkdir_p) "$(DESTDIR)$(gnomevfsmoduleslibdir)" @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gnomevfsmoduleslibdir)/$$f'"; \ $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gnomevfsmoduleslibdir)/$$f"; \ else :; fi; \ @@ -321,8 +323,8 @@ install-gnomevfsmoduleslibLTLIBRARIES: $(gnomevfsmoduleslib_LTLIBRARIES) uninstall-gnomevfsmoduleslibLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ + @set -x; list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(gnomevfsmoduleslibdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(gnomevfsmoduleslibdir)/$$p"; \ done @@ -331,7 +333,7 @@ clean-gnomevfsmoduleslibLTLIBRARIES: -test -z "$(gnomevfsmoduleslib_LTLIBRARIES)" || rm -f $(gnomevfsmoduleslib_LTLIBRARIES) @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ + test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done @@ -340,7 +342,7 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ else :; fi; \ @@ -348,8 +350,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ done @@ -358,12 +360,12 @@ clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ + test "$$dir" != "$$p" || dir=.; \ echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done libntfs-gnomevfs.la: $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_DEPENDENCIES) - $(LINK) -rpath $(gnomevfsmoduleslibdir) $(libntfs_gnomevfs_la_LDFLAGS) $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_LIBADD) $(LIBS) + $(LINK) $(am_libntfs_gnomevfs_la_rpath) $(libntfs_gnomevfs_la_LDFLAGS) $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_LIBADD) $(LIBS) libntfs.la: $(libntfs_la_OBJECTS) $(libntfs_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libntfs_la_LDFLAGS) $(libntfs_la_OBJECTS) $(libntfs_la_LIBADD) $(LIBS) @@ -398,73 +400,36 @@ distclean-compile: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< -libntfs_gnomevfs_la-gnome-vfs-method.o: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.o -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.o `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.o `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c - -libntfs_gnomevfs_la-gnome-vfs-method.obj: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.obj -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.obj `if test -f 'gnome-vfs-method.c'; then $(CYGPATH_W) 'gnome-vfs-method.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-method.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.obj `if test -f 'gnome-vfs-method.c'; then $(CYGPATH_W) 'gnome-vfs-method.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-method.c'; fi` - libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c - -libntfs_gnomevfs_la-gnome-vfs-module.o: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.o -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.o `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.o `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c - -libntfs_gnomevfs_la-gnome-vfs-module.obj: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.obj -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.obj `if test -f 'gnome-vfs-module.c'; then $(CYGPATH_W) 'gnome-vfs-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-module.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Po' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.obj `if test -f 'gnome-vfs-module.c'; then $(CYGPATH_W) 'gnome-vfs-module.c'; else $(CYGPATH_W) '$(srcdir)/gnome-vfs-module.c'; fi` +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo' tmpdepfile='$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c mostlyclean-libtool: -rm -f *.lo @@ -525,7 +490,7 @@ install-gnomevfsmodulesconfDATA: $(gnomevfsmodulesconf_DATA) test -z "$(gnomevfsmodulesconfdir)" || $(mkdir_p) "$(DESTDIR)$(gnomevfsmodulesconfdir)" @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " $(gnomevfsmodulesconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f'"; \ $(gnomevfsmodulesconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ done @@ -533,7 +498,7 @@ install-gnomevfsmodulesconfDATA: $(gnomevfsmodulesconf_DATA) uninstall-gnomevfsmodulesconfDATA: @$(NORMAL_UNINSTALL) @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ + f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f'"; \ rm -f "$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ done @@ -558,9 +523,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -637,7 +604,7 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/ltmain.sh b/ltmain.sh index 5eb4c3a3..a6d78e60 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -24,6 +24,34 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=1.5.8 +TIMESTAMP=" (1.1220.2.118 2004/08/07 12:24:38)" + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. @@ -36,7 +64,7 @@ elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : else # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$0" --no-reexec ${1+"$@"} + exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then @@ -45,19 +73,9 @@ if test "X$1" = X--fallback-echo; then cat <&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Global variables. @@ -119,10 +137,13 @@ o2lo="s/\\.${objext}\$/.lo/" # Shell function definitions: # This seems to be the best place for them +# func_win32_libid arg +# return the library type of file 'arg' +# # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. -win32_libid () { +func_win32_libid () { win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in @@ -131,7 +152,7 @@ win32_libid () { ;; *ar\ archive*) # could be an import, or static if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then win32_nmres=`eval $NM -f posix -A $1 | \ sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` if test "X$win32_nmres" = "Ximport" ; then @@ -141,7 +162,7 @@ win32_libid () { fi fi ;; - *DLL*) + *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... @@ -155,9 +176,192 @@ win32_libid () { $echo $win32_libid_type } + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () { + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () { + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$my_xdir"; then + exit $status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename $darwin_archive` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + # Remove the table of contents from the thin files. + $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true + $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $AR -xo "${darwin_base_archive}" + rm "${darwin_base_archive}" + cd "$darwin_curdir" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + rm -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + (cd $my_xdir && $AR x $my_xabs) || exit $? + fi # $darwin_arches + fi # $run + ;; + *) + # We will extract separately just the conflicting names and we will + # no longer touch any unique names. It is faster to leave these + # extract automatically by $AR in one run. + $show "(cd $my_xdir && $AR x $my_xabs)" + $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? + if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$my_xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} # End of Shell function definitions ##################################### +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" + # Parse our command line options once, thoroughly. while test "$#" -gt 0 do @@ -183,7 +387,7 @@ do case $tagname in *[!-_A-Za-z0-9,/]*) $echo "$progname: invalid tag name: $tagname" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac @@ -193,10 +397,10 @@ do # not specially marked. ;; *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then taglist="$taglist $tagname" # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" else $echo "$progname: ignoring unknown tag $tagname" 1>&2 fi @@ -225,16 +429,16 @@ do $echo "Copyright (C) 2003 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit 0 + exit $EXIT_SUCCESS ;; --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath # Now print the configurations for the tags. for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done - exit 0 + exit $EXIT_SUCCESS ;; --debug) @@ -259,7 +463,7 @@ do else $echo "disable static libraries" fi - exit 0 + exit $EXIT_SUCCESS ;; --finish) mode="finish" ;; @@ -290,7 +494,7 @@ do -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; *) @@ -303,7 +507,7 @@ done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # If this variable is set in any of the actions, the command in it @@ -359,7 +563,7 @@ if test -z "$show_help"; then if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. @@ -401,7 +605,7 @@ if test -z "$show_help"; then -o) if test -n "$libobj" ; then $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 + exit $EXIT_FAILURE fi arg_mode=target continue @@ -426,7 +630,7 @@ if test -z "$show_help"; then args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` lastarg= save_ifs="$IFS"; IFS=',' - for arg in $args; do + for arg in $args; do IFS="$save_ifs" # Double-quote args containing other shell metacharacters. @@ -476,11 +680,11 @@ if test -z "$show_help"; then case $arg_mode in arg) $echo "$modename: you must specify an argument for -Xcompile" - exit 1 + exit $EXIT_FAILURE ;; target) $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; *) # Get the name of the library object. @@ -513,50 +717,11 @@ if test -z "$show_help"; then *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; *) $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac - # Infer tagged configuration to use if any are available and - # if one wasn't chosen via the "--tag" command line option. - # Only attempt this if the compiler in the base compile - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case "$base_compile " in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi + func_infer_tag $base_compile for arg in $later; do case $arg in @@ -589,7 +754,7 @@ if test -z "$show_help"; then if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Delete any leftover library objects. @@ -600,7 +765,7 @@ if test -z "$show_help"; then fi $run $rm $removelist - trap "$run $rm $removelist; exit 1" 1 2 15 + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in @@ -619,7 +784,7 @@ if test -z "$show_help"; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit 1" 1 2 15 + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else output_obj= need_locks=no @@ -629,7 +794,7 @@ if test -z "$show_help"; then # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then - until $run ln "$0" "$lockfile" 2>/dev/null; do + until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done @@ -647,7 +812,7 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi $echo $srcfile > "$lockfile" fi @@ -702,7 +867,7 @@ EOF if $run eval "$command"; then : else test -n "$output_obj" && $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi if test "$need_locks" = warn && @@ -722,7 +887,7 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one @@ -774,7 +939,7 @@ EOF if $run eval "$command"; then : else $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi if test "$need_locks" = warn && @@ -794,7 +959,7 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi # Just move the object if needed @@ -832,7 +997,7 @@ EOF $run $rm "$lockfile" fi - exit 0 + exit $EXIT_SUCCESS ;; # libtool link mode @@ -904,46 +1069,7 @@ EOF vinfo= vinfo_number=no - # Infer tagged configuration to use if any are available and - # if one wasn't chosen via the "--tag" command line option. - # Only attempt this if the compiler in the base link - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case $base_compile in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in $compile_command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi + func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg @@ -1039,7 +1165,7 @@ EOF export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" - exit 1 + exit $EXIT_FAILURE fi prev= continue @@ -1091,7 +1217,7 @@ EOF test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Extract subdirectory from the argument. @@ -1144,7 +1270,7 @@ EOF # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit 1 + exit $EXIT_FAILURE else # Dry-run case. @@ -1165,7 +1291,7 @@ EOF done else $echo "$modename: link input file \`$save_arg' does not exist" - exit 1 + exit $EXIT_FAILURE fi arg=$save_arg prev= @@ -1177,7 +1303,7 @@ EOF [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then @@ -1217,6 +1343,11 @@ EOF finalize_command="$finalize_command $qarg" continue ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; *) eval "$prev=\"\$arg\"" prev= @@ -1265,7 +1396,7 @@ EOF -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" - exit 1 + exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms @@ -1301,7 +1432,7 @@ EOF absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi dir="$absdir" ;; @@ -1452,7 +1583,7 @@ EOF [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac case "$xrpath " in @@ -1575,7 +1706,7 @@ EOF test "$pic_object" = none && \ test "$non_pic_object" = none; then $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Extract subdirectory from the argument. @@ -1628,7 +1759,7 @@ EOF # Only an error if not doing a dry-run. if test -z "$run"; then $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit 1 + exit $EXIT_FAILURE else # Dry-run case. @@ -1695,7 +1826,7 @@ EOF if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then @@ -1739,7 +1870,7 @@ EOF "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; @@ -1749,7 +1880,7 @@ EOF case $host in *cygwin* | *mingw* | *pw32*) - # don't eliminate duplcations in $postdeps and $predeps + # don't eliminate duplications in $postdeps and $predeps duplicate_compiler_generated_deps=yes ;; *) @@ -1802,7 +1933,7 @@ EOF *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac done @@ -1860,7 +1991,7 @@ EOF fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - for search_ext in .la $shrext .so .a; do + for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then @@ -1936,11 +2067,11 @@ EOF fi if test "$pass" = scan; then deplibs="$deplib $deplibs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 @@ -1968,7 +2099,22 @@ EOF fi case $linkmode in lib) - if test "$deplibs_check_method" != pass_all; then + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" @@ -2019,14 +2165,14 @@ EOF if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` @@ -2062,7 +2208,7 @@ EOF if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" @@ -2079,12 +2225,12 @@ EOF done elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit 1 + exit $EXIT_FAILURE fi continue fi # $pass = conv - + # Get the name of the library we link against. linklib= for l in $old_library $library_names; do @@ -2092,16 +2238,18 @@ EOF done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi - if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't @@ -2139,10 +2287,17 @@ EOF absdir="$libdir" fi else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` @@ -2150,7 +2305,7 @@ EOF if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). @@ -2177,7 +2332,7 @@ EOF continue fi - + if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" @@ -2264,17 +2419,18 @@ EOF need_relink=yes fi # This is a shared library - - # Warn about portability, can't link against -module's on some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then $echo if test "$linkmode" = prog; then $echo "*** Warning: Linking the executable $output against the loadable module" else $echo "*** Warning: Linking the shared library $output against the loadable module" fi - $echo "*** $linklib is not portable!" - fi + $echo "*** $linklib is not portable!" + fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. @@ -2372,9 +2528,9 @@ EOF case $host in *-*-sco3.2v5* ) add_dir="-L$dir" ;; *-*-darwin* ) - # if the lib is a module then we can not link against it, someone - # is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then $echo "** Warning, lib $linklib is a module, not a shared library" if test -z "$old_library" ; then $echo @@ -2382,7 +2538,7 @@ EOF $echo "** The link will probably fail, sorry" else add="$dir/$old_library" - fi + fi fi esac elif test "$hardcode_minus_L" = no; then @@ -2424,7 +2580,7 @@ EOF if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 + exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then @@ -2467,7 +2623,8 @@ EOF esac add="-l$name" elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" @@ -2547,7 +2704,8 @@ EOF if test "$linkmode" = lib; then if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= @@ -2604,7 +2762,7 @@ EOF eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 @@ -2614,7 +2772,8 @@ EOF depdepl= case $host in *-*-darwin*) - # we do not want to link against static libs, but need to link against shared + # we do not want to link against static libs, + # but need to link against shared eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do @@ -2622,7 +2781,7 @@ EOF done if test -f "$path/$depdepl" ; then depdepl="$path/$depdepl" - fi + fi # do not add paths which are already there case " $newlib_search_path " in *" $path "*) ;; @@ -2632,33 +2791,32 @@ EOF path="" ;; *) - path="-L$path" + path="-L$path" + ;; + esac ;; - esac - - ;; - -l*) + -l*) case $host in *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" ;; *) continue ;; - esac + esac ;; *) continue ;; esac case " $deplibs " in *" $depdepl "*) ;; - *) deplibs="$deplibs $depdepl" ;; - esac + *) deplibs="$depdepl $deplibs" ;; + esac case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; @@ -2748,7 +2906,8 @@ EOF eval $var=\"$tmp_libs\" done # for var fi - # Last step: remove runtime libs from dependency_libs (they stay in deplibs) + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in @@ -2808,19 +2967,19 @@ EOF case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext\" + eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext\" + eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` @@ -2831,7 +2990,7 @@ EOF if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit 1 + exit $EXIT_FAILURE else $echo $echo "*** Warning: Linking the shared library $output against the non-libtool" @@ -2879,13 +3038,13 @@ EOF if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible - + case $vinfo_number in yes) number_major="$2" @@ -2929,7 +3088,7 @@ EOF *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac @@ -2938,7 +3097,7 @@ EOF *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac @@ -2947,14 +3106,14 @@ EOF *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Calculate the version variables. @@ -2971,7 +3130,7 @@ EOF versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) @@ -3043,7 +3202,7 @@ EOF *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac @@ -3097,9 +3256,11 @@ EOF *.$objext) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi fi removelist="$removelist $p" ;; @@ -3580,7 +3741,7 @@ EOF fi # Get the real and link names of the library. - eval shared_ext=\"$shrext\" + eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" @@ -3644,12 +3805,12 @@ EOF for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; - *) + *) tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done - deplibs="$tmp_deplibs" + deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then @@ -3657,67 +3818,13 @@ EOF eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" fi fi - + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" @@ -3832,7 +3939,6 @@ EOF save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3879,7 +3985,7 @@ EOF # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - exit 0 + exit $EXIT_SUCCESS fi # Create links to the real library. @@ -3927,7 +4033,7 @@ EOF *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit 1 + exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` @@ -3956,64 +4062,10 @@ EOF eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi @@ -4038,7 +4090,7 @@ EOF $run ${rm}r $gentop fi - exit 0 + exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then @@ -4051,7 +4103,7 @@ EOF # accidentally link it into a program. # $show "echo timestamp > $libobj" # $run eval "echo timestamp > $libobj" || exit $? - exit 0 + exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then @@ -4074,7 +4126,7 @@ EOF $run ${rm}r $gentop fi - exit 0 + exit $EXIT_SUCCESS ;; prog) @@ -4392,7 +4444,7 @@ static const void *lt_preloaded_setup() { ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac else @@ -4480,7 +4532,7 @@ static const void *lt_preloaded_setup() { # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? - exit 0 + exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then @@ -4535,10 +4587,10 @@ static const void *lt_preloaded_setup() { fi # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case $0 in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; - *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else @@ -4564,7 +4616,7 @@ static const void *lt_preloaded_setup() { cwrappersource=`$echo ${objdir}/lt-${output}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15 + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 cat > $cwrappersource < $output "\ #! $SHELL @@ -4794,7 +4846,7 @@ sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" @@ -4873,7 +4925,7 @@ else else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" - exit 1 + exit $EXIT_FAILURE fi fi @@ -4935,20 +4987,20 @@ else esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 + exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 + exit $EXIT_FAILURE fi fi\ " chmod +x $output fi - exit 0 + exit $EXIT_SUCCESS ;; esac @@ -4971,65 +5023,10 @@ fi\ if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. @@ -5067,7 +5064,7 @@ fi\ for obj in $save_oldobjs do last_oldobj=$obj - done + done for obj in $save_oldobjs do oldobjs="$objlist $obj" @@ -5081,7 +5078,7 @@ fi\ oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB - fi + fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= @@ -5130,11 +5127,13 @@ fi\ fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $0 $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then - relink_command= - fi + relink_command= + fi + + # Only create the output if not a dry run. if test -z "$run"; then for installed in no yes; do @@ -5152,7 +5151,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; @@ -5166,7 +5165,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done @@ -5177,7 +5176,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done @@ -5185,7 +5184,7 @@ fi\ else newdlfiles= for lib in $dlfiles; do - case $lib in + case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac @@ -5194,7 +5193,7 @@ fi\ dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do - case $lib in + case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac @@ -5257,7 +5256,7 @@ relink_command=\"$relink_command\"" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac - exit 0 + exit $EXIT_SUCCESS ;; # libtool install mode @@ -5346,13 +5345,13 @@ relink_command=\"$relink_command\"" if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test -z "$files"; then @@ -5362,7 +5361,7 @@ relink_command=\"$relink_command\"" $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. @@ -5383,7 +5382,7 @@ relink_command=\"$relink_command\"" if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi fi case $destdir in @@ -5395,7 +5394,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac done @@ -5424,7 +5423,7 @@ relink_command=\"$relink_command\"" else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi library_names= @@ -5466,7 +5465,7 @@ relink_command=\"$relink_command\"" # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then @@ -5481,7 +5480,7 @@ relink_command=\"$relink_command\"" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit 1 + exit $EXIT_FAILURE fi fi @@ -5560,7 +5559,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac @@ -5578,7 +5577,7 @@ relink_command=\"$relink_command\"" $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi - exit 0 + exit $EXIT_SUCCESS ;; *) @@ -5632,7 +5631,7 @@ relink_command=\"$relink_command\"" # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi finalize=yes @@ -5672,14 +5671,15 @@ relink_command=\"$relink_command\"" if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" - if tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`; then : + tmpdir="$tmpdir/libtool-$$" + save_umask=`umask` + umask 0077 + if $mkdir "$tmpdir"; then + umask $save_umask else - tmpdir="$tmpdir/libtool-$$" - if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then : - else - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi + umask $save_umask + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue fi file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" @@ -5760,9 +5760,9 @@ relink_command=\"$relink_command\"" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $0 $preserve_args --finish$current_libdirs' + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else - exit 0 + exit $EXIT_SUCCESS fi ;; @@ -5802,7 +5802,7 @@ relink_command=\"$relink_command\"" fi # Exit here if they wanted silent mode. - test "$show" = : && exit 0 + test "$show" = : && exit $EXIT_SUCCESS $echo "----------------------------------------------------------------------" $echo "Libraries have been installed in:" @@ -5838,7 +5838,7 @@ relink_command=\"$relink_command\"" $echo "See any operating system documentation about shared libraries for" $echo "more information, such as the ld(1) and ld.so(8) manual pages." $echo "----------------------------------------------------------------------" - exit 0 + exit $EXIT_SUCCESS ;; # libtool execute mode @@ -5850,7 +5850,7 @@ relink_command=\"$relink_command\"" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" - exit 1 + exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. @@ -5858,7 +5858,7 @@ relink_command=\"$relink_command\"" if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi dir= @@ -5869,7 +5869,7 @@ relink_command=\"$relink_command\"" else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Read the libtool library. @@ -5896,7 +5896,7 @@ relink_command=\"$relink_command\"" dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi ;; @@ -5976,7 +5976,7 @@ relink_command=\"$relink_command\"" $echo "export $shlibpath_var" fi eval \$echo \"\$cmd\"$args - exit 0 + exit $EXIT_SUCCESS fi ;; @@ -6004,7 +6004,7 @@ relink_command=\"$relink_command\"" if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi rmdirs= @@ -6118,7 +6118,7 @@ relink_command=\"$relink_command\"" if test "$mode" = clean ; then noexename=$name case $file in - *.exe) + *.exe) file=`$echo $file|${SED} 's,.exe$,,'` noexename=`$echo $name|${SED} 's,.exe$,,'` # $file with .exe has already been added to rmfiles, @@ -6163,20 +6163,20 @@ relink_command=\"$relink_command\"" "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd - exit 1 + exit $EXIT_FAILURE fi # We need to display help for each of the modes. @@ -6212,7 +6212,7 @@ MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for a more detailed description of MODE. Report bugs to ." - exit 0 + exit $EXIT_SUCCESS ;; clean) @@ -6367,14 +6367,14 @@ Otherwise, only FILE itself is deleted using RM." *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac $echo $echo "Try \`$modename --help' for more information about other modes." -exit 0 +exit $EXIT_SUCCESS # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index aebbb48b..d208f630 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -36,7 +36,9 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +target_triplet = @target@ bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ ntfsls$(EXEEXT) ntfscat$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ @@ -61,7 +63,8 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 \ ntfsresize.8 ntfsundelete.8 -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \ + "$(DESTDIR)$(man8dir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) @@ -123,21 +126,9 @@ ntfswipe_DEPENDENCIES = $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/attrdef.Po ./$(DEPDIR)/boot.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/cluster.Po ./$(DEPDIR)/mkntfs.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfscat.Po ./$(DEPDIR)/ntfsclone.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfscluster.Po ./$(DEPDIR)/ntfscp.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsdump_logfile.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsfix.Po ./$(DEPDIR)/ntfsinfo.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfslabel.Po ./$(DEPDIR)/ntfsls.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsmove.Po ./$(DEPDIR)/ntfsresize.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsrm.Po ./$(DEPDIR)/ntfstruncate.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfsundelete.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/ntfswipe.Po ./$(DEPDIR)/sd.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/upcase.Po ./$(DEPDIR)/utils.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -237,6 +228,8 @@ am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -531,24 +524,21 @@ distclean-compile: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: @@ -626,9 +616,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -706,7 +698,7 @@ clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" From cfb642de57f90485d752408fbe6b2afa8783e51d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 9 Sep 2004 13:57:31 +0000 Subject: [PATCH 1823/2994] Update build to SuSE 9.2 beta 1 tools (autoconf,automake,libtool,...). BKrev: 4140614b1uy5xffrxLeWI7Hu-Z7iRQ From c2fd1360e7ed593f6e0377c974c5954cc91fc066 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 9 Sep 2004 14:18:53 +0000 Subject: [PATCH 1824/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into chaos.(none):/home/yura/NTFS/ntfsprogs 2004/09/09 17:16:16+03:00 (none)!yura ntfscp: Not longer update $FILE_NAME attributes, because Windows doesn't update them unless a rename operation occur. BKrev: 4140664dMzZNBYMbtVds5GyGXtdTaQ From 64fd09d1bd3a8bf9165a50b222b3db8b5004e321 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 9 Sep 2004 14:18:53 +0000 Subject: [PATCH 1825/2994] ntfscp: Not longer update $FILE_NAME attributes, because Windows doesn't update them unless a rename operation occur. (Logical change 1.541) --- ntfsprogs/ntfscp.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index caefc17e..a3043da9 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -204,8 +204,8 @@ int main (int argc, char *argv[]) ntfs_volume *vol; ntfs_inode *out; ntfs_attr *na; - ntfs_attr_search_ctx *ctx; - FILE_NAME_ATTR *fna; +// ntfs_attr_search_ctx *ctx; +// FILE_NAME_ATTR *fna; int flags = 0; int result = 1; s64 new_size; @@ -267,7 +267,12 @@ int main (int argc, char *argv[]) } need_logfile_reset = 1; - /* Update $FILE_NAME(0x30) attributes for new file size. */ + /* + * Update $FILE_NAME(0x30) attributes for new file size. + * This code now commented, because Windows does not update + * them unless a rename operation occur. + */ + /* ctx = ntfs_attr_get_search_ctx(out, NULL); if (!ctx) { perror("ERROR: Couldn't get search context"); @@ -282,13 +287,13 @@ int main (int argc, char *argv[]) fna->allocated_size = scpu_to_le64( na->allocated_size); fna->data_size = scpu_to_le64(na->data_size); + ntfs_inode_mark_dirty(ctx->ntfs_ino); } } if (errno != ENOENT) perror("ERROR: Attribute lookup failed"); - - ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); + */ } buf = malloc (NTFS_BUF_SIZE); From 92492d6d911e1e1cce9598dc349cf43560e9c63f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 9 Sep 2004 14:18:53 +0000 Subject: [PATCH 1826/2994] update (Logical change 1.541) --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 52103953..dd360e8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,7 +9,8 @@ xx/xx/2004 - 2.0.0-WIP $INDEX_ALLOCATION. (Yura) - ntfsinfo: Changed message for resident $INDEX_ALLOCATION to print error, because $INDEX_ALLOCATION can't be resident. (Yura) - - ntfscp: Update all $FILE_NAME attributes, not only first. (Yura) + - ntfscp: Not longer update $FILE_NAME attributes, because Windows + doesn't update them unless a rename operation occur. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From fe4fd6b59e71180300c388f4fe4d59e28ad590f7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 9 Sep 2004 14:27:59 +0000 Subject: [PATCH 1827/2994] Fix silly porting typo. (Logical change 1.542) --- include/ntfs/debug.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/ntfs/debug.h b/include/ntfs/debug.h index 1652ba62..b8615571 100644 --- a/include/ntfs/debug.h +++ b/include/ntfs/debug.h @@ -31,6 +31,7 @@ #ifdef HAVE_STDARG_H # include #endif +#include #include struct _runlist_element; @@ -49,7 +50,7 @@ extern void __ntfs_debug (const char *file, int line, const char *function, __ntfs_debug(__FILE__, __LINE__, __FUNCTION__, f, ##a) extern void __ntfs_error(const char *function, - const char *fmt, ...) __attribute__((format(printf, 3, 4))); + const char *fmt, ...) __attribute__((format(printf, 2, 3))); #define ntfs_error(sb, f, a...) __ntfs_error(__FUNCTION__, f, ##a) extern void __Dprintf(const char *fmt, ...) From cb0ffbc3ecb65210f244a6431377eb0dba60de0a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 9 Sep 2004 14:27:59 +0000 Subject: [PATCH 1828/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into cantab.net:/home/src/ntfsprogs 2004/09/09 15:27:50+01:00 cantab.net!aia21 Fix silly porting typo in new debug output functions. BKrev: 4140686famFyf_sTpR2vN7x7RglrNg From b46a0cd23d7d9dff8e27a41c70b05b03424c3313 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 9 Sep 2004 17:21:40 +0000 Subject: [PATCH 1829/2994] Improvement to ntfs_non_resident_attr_expand: expand multi extent attributes if we don't need to allocate new mft records to perform this. (Logical change 1.543) --- libntfs/attrib.c | 141 +++++++++++++++++++++++++++++------------------ 1 file changed, 88 insertions(+), 53 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index d6d17e5c..3097cc42 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3142,7 +3142,6 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) u32 mft_rec_copy_size = 0; LCN lcn_seek_from; VCN first_free_vcn; - s64 nr_need_allocate; ntfs_volume *vol; ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; @@ -3156,35 +3155,9 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) vol = na->ni->vol; - /* Get the first attribute record that needs modification. */ ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) return -1; - if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, - NULL, 0, ctx)) { - err = errno; - if (err == ENOENT) - err = EIO; - goto put_err_out; - } - a = ctx->attr; - m = ctx->mrec; - - /* - * Check that the attribute name hasn't been placed after the mapping - * pairs array. If it has we need to move it. - * TODO: Implement the move, if someone will hit it. - */ - if (a->name_length) { - if (le16_to_cpu(a->name_offset) >= - le16_to_cpu(a->mapping_pairs_offset)) { - Dprintf("%s(): Eeek! Name is placed after the " - "mapping pairs array. Aborting...\n", - __FUNCTION__); - err = ENOTSUP; - goto put_err_out; - } - } /* * Check the attribute type and the corresponding maximum size @@ -3197,12 +3170,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) "failed. Aborting...\n", __FUNCTION__); } else if (err == ENOENT) err = EIO; - goto put_err_out; - } - - if (NInoAttrList(na->ni)) { - err = ENOTSUP; - goto put_err_out; + errno = err; + return -1; } /* The first cluster outside the new allocation. */ @@ -3213,14 +3182,38 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) * clusters if there is a change. */ if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { - nr_need_allocate = first_free_vcn - - (na->allocated_size >> vol->cluster_size_bits); - - if (ntfs_attr_map_whole_runlist(na)) { + /* Get the last extent of the attribute. */ + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, + (na->allocated_size >> vol->cluster_size_bits) - 1, + NULL, 0, ctx)) { err = errno; - Dprintf("%s(): Eeek! " - "ntfs_attr_map_whole_runlist failed.\n", - __FUNCTION__); + if (err == ENOENT) + err = EIO; + goto put_err_out; + } + a = ctx->attr; + m = ctx->mrec; + + /* + * Check that the attribute name hasn't been placed after the + * mapping pairs array. If it has we need to move it. + * TODO: Implement the move, if someone will hit it. + */ + if (a->name_length) { + if (le16_to_cpu(a->name_offset) >= + le16_to_cpu(a->mapping_pairs_offset)) { + Dprintf("%s(): Eeek! Name is placed after the " + "mapping pairs array. Aborting...\n", + __FUNCTION__); + err = ENOTSUP; + goto put_err_out; + } + } + + if (ntfs_attr_map_runlist(na, sle64_to_cpu(a->lowest_vcn))) { + err = errno; + Dprintf("%s(): Eeek! ntfs_attr_map_runlist failed.\n", + __FUNCTION__); goto put_err_out; } @@ -3246,7 +3239,9 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) lcn_seek_from = rl->lcn + rl->length; } - rl = ntfs_cluster_alloc(vol, nr_need_allocate, lcn_seek_from, + rl = ntfs_cluster_alloc(vol, first_free_vcn - + (na->allocated_size >> + vol->cluster_size_bits), lcn_seek_from, DATA_ZONE, na->allocated_size >> vol->cluster_size_bits); if (!rl) { @@ -3256,21 +3251,22 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto put_err_out; } - /* Append new clusters to attribute runlist */ - rln = ntfs_runlists_merge (na->rl, rl); + /* Append new clusters to attribute runlist. */ + rln = ntfs_runlists_merge(na->rl, rl); if (!rln) { - /* Failed, free just allocated clusters */ + /* Failed, free just allocated clusters. */ err = errno; Dprintf("%s(): Eeek! Run list merge " "failed.\n", __FUNCTION__); - ntfs_cluster_free_from_rl (vol, rl); - free (rl); + ntfs_cluster_free_from_rl(vol, rl); + free(rl); goto put_err_out; } na->rl = rln; /* Get the size for the new mapping pairs array. */ - mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl, 0); + mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl, + sle64_to_cpu(a->lowest_vcn)); if (mp_size <= 0) { err = errno; Dprintf("%s(): Eeek! Get size for mapping " @@ -3344,7 +3340,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) * correct destination, i.e. the attribute record itself. */ if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( - a->mapping_pairs_offset), mp_size, na->rl, 0)) { + a->mapping_pairs_offset), mp_size, + na->rl, sle64_to_cpu(a->lowest_vcn))) { err = errno; Dprintf("%s(): BUG! Mapping pairs build " "failed. Please run chkdsk and if " @@ -3356,14 +3353,52 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto rollback; } - /* Update the attribute record and the ntfs_attr structure. */ - na->allocated_size = first_free_vcn << vol->cluster_size_bits; - a->allocated_size = scpu_to_le64(na->allocated_size); /* - * Reminder: We may not update a->highest_vcn if it equal to 0. + * Reminder: We may not update a->highest_vcn if it equal to 0 + * and attribute is single-extent. */ if (a->highest_vcn) a->highest_vcn = scpu_to_le64(first_free_vcn - 1); + + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_attr_reinit_search_ctx(ctx); + } + + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, + 0, NULL, 0, ctx)) { + Dprintf("%s(): Eeek! Lookup of first attribute extent " + "failed.\n", __FUNCTION__); + err = errno; + if (err == ENOENT) + err = EIO; + if ((na->allocated_size >> vol->cluster_size_bits) != + first_free_vcn) { + Dprintf("%s(): Trying perform rollback.\n", + __FUNCTION__); + ntfs_attr_reinit_search_ctx(ctx); + if (ntfs_attr_lookup(na->type, na->name, na->name_len, + 0, (na->allocated_size >> + vol->cluster_size_bits) - 1, + NULL, 0, ctx)) { + Dprintf("%s(): Eeek! Rollback failed. " + "Run chkdsk.\n", __FUNCTION__); + err = errno; + if (err == ENOENT) + err = EIO; + goto put_err_out; + } + a = ctx->attr; + m = ctx->mrec; + goto rollback; + } else + goto put_err_out; + } + a = ctx->attr; + + if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { + /* Update the attribute record and the ntfs_attr structure. */ + na->allocated_size = first_free_vcn << vol->cluster_size_bits; + a->allocated_size = scpu_to_le64(na->allocated_size); } /* Update the attribute record and the ntfs attribute structure. */ na->data_size = newsize; @@ -3395,9 +3430,9 @@ rollback: /* Restote mft record. */ if (mft_changed) memcpy(m, mft_rec_copy, mft_rec_copy_size); +put_err_out: if (mft_rec_copy) free(mft_rec_copy); -put_err_out: ntfs_attr_put_search_ctx(ctx); errno = err; return -1; From 6e2b7ed68665e908e246e1607743af1d58a331cd Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 9 Sep 2004 17:21:40 +0000 Subject: [PATCH 1830/2994] Improvement to ntfs_non_resident_attr_expand: expand multi extent attributes if we don't need to allocate new mft records to perform this. BKrev: 414091241Goff10vbL-jmjKtITvsng From a5c2060597f6d02667066e74946ddd27353b0044 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 9 Sep 2004 17:21:40 +0000 Subject: [PATCH 1831/2994] update (Logical change 1.543) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index dd360e8a..2d594233 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,9 @@ xx/xx/2004 - 2.0.0-WIP error, because $INDEX_ALLOCATION can't be resident. (Yura) - ntfscp: Not longer update $FILE_NAME attributes, because Windows doesn't update them unless a rename operation occur. (Yura) + - Improvement to ntfs_non_resident_attr_expand: expand multi extent + attributes if we don't need to allocate new mft records to perform + this (Yura). 04/09/2004 - 1.9.4 - Urgent bug fixes. From 8ab5e7daf51b970fb8696df197169a8292b9f403 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 10 Sep 2004 13:55:47 +0000 Subject: [PATCH 1832/2994] Fix a potential memory leak (in error code path of ntfs_non_resident_attr_expand()). (Logical change 1.544) --- libntfs/attrib.c | 57 ++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 3097cc42..5e4b6b77 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3155,10 +3155,6 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) vol = na->ni->vol; - ctx = ntfs_attr_get_search_ctx(na->ni, NULL); - if (!ctx) - return -1; - /* * Check the attribute type and the corresponding maximum size * against @newsize and fail if @newsize is too big. @@ -3174,6 +3170,10 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) return -1; } + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); + if (!ctx) + return -1; + /* The first cluster outside the new allocation. */ first_free_vcn = (newsize + vol->cluster_size - 1) >> vol->cluster_size_bits; @@ -3183,9 +3183,9 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) */ if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { /* Get the last extent of the attribute. */ - if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, - (na->allocated_size >> vol->cluster_size_bits) - 1, - NULL, 0, ctx)) { + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, + (na->allocated_size >> + vol->cluster_size_bits) - 1, NULL, 0, ctx)) { err = errno; if (err == ENOENT) err = EIO; @@ -3266,7 +3266,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) /* Get the size for the new mapping pairs array. */ mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl, - sle64_to_cpu(a->lowest_vcn)); + sle64_to_cpu(a->lowest_vcn)); if (mp_size <= 0) { err = errno; Dprintf("%s(): Eeek! Get size for mapping " @@ -3278,18 +3278,18 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) * if we shall *not* expand space for mapping pairs */ cur_max_mp_size = le32_to_cpu(a->length) - - le16_to_cpu(a->mapping_pairs_offset); + le16_to_cpu(a->mapping_pairs_offset); /* * Determine maximum possible length of mapping pairs, * if we shall expand space for mapping pairs */ - exp_max_mp_size = le32_to_cpu(m->bytes_allocated) - - le32_to_cpu(m->bytes_in_use) + cur_max_mp_size; + exp_max_mp_size = le32_to_cpu(m->bytes_allocated) - + le32_to_cpu(m->bytes_in_use) + cur_max_mp_size; if (mp_size > exp_max_mp_size) { err = ENOTSUP; - Dprintf("%s(): Eeek! Maping pairs size is" - " too big.\n", __FUNCTION__); + Dprintf("%s(): Eeek! Maping pairs size is too big.\n", + __FUNCTION__); goto rollback; } @@ -3311,8 +3311,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) * Calculate the new attribute length and mft record * bytes used. */ - new_alen = (le16_to_cpu(a->mapping_pairs_offset) - + mp_size + 7) & ~7; + new_alen = (le16_to_cpu(a->mapping_pairs_offset) + + mp_size + 7) & ~7; new_muse = le32_to_cpu(m->bytes_in_use) - le32_to_cpu(a->length) + new_alen; if (new_muse > le32_to_cpu(m->bytes_allocated)) { @@ -3327,10 +3327,11 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto rollback; } /* Move the following attributes making space. */ - memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu( - a->length), le32_to_cpu(m->bytes_in_use) - - ((u8*)a - (u8*)m) - le32_to_cpu( - a->length)); + memmove((u8*)a + new_alen, (u8*)a + + le32_to_cpu(a->length), + le32_to_cpu(m->bytes_in_use) - + ((u8*)a - (u8*)m) - + le32_to_cpu(a->length)); /* Update the sizes of the attribute and mft records. */ a->length = cpu_to_le32(new_alen); m->bytes_in_use = cpu_to_le32(new_muse); @@ -3339,9 +3340,9 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) * Generate the new mapping pairs array directly into the * correct destination, i.e. the attribute record itself. */ - if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( - a->mapping_pairs_offset), mp_size, - na->rl, sle64_to_cpu(a->lowest_vcn))) { + if (ntfs_mapping_pairs_build(vol, (u8*)a + + le16_to_cpu(a->mapping_pairs_offset), mp_size, + na->rl, sle64_to_cpu(a->lowest_vcn))) { err = errno; Dprintf("%s(): BUG! Mapping pairs build " "failed. Please run chkdsk and if " @@ -3364,24 +3365,24 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) ntfs_attr_reinit_search_ctx(ctx); } - if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, - 0, NULL, 0, ctx)) { + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, + ctx)) { Dprintf("%s(): Eeek! Lookup of first attribute extent " - "failed.\n", __FUNCTION__); + "failed.\n", __FUNCTION__); err = errno; if (err == ENOENT) err = EIO; if ((na->allocated_size >> vol->cluster_size_bits) != - first_free_vcn) { + first_free_vcn) { Dprintf("%s(): Trying perform rollback.\n", - __FUNCTION__); + __FUNCTION__); ntfs_attr_reinit_search_ctx(ctx); if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, (na->allocated_size >> vol->cluster_size_bits) - 1, NULL, 0, ctx)) { Dprintf("%s(): Eeek! Rollback failed. " - "Run chkdsk.\n", __FUNCTION__); + "Run chkdsk.\n", __FUNCTION__); err = errno; if (err == ENOENT) err = EIO; From 9a79c9711ea1a2d9a605779f4b1f7816a3c08459 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 10 Sep 2004 13:55:47 +0000 Subject: [PATCH 1833/2994] Fix a potential memory leak (in error code path of ntfs_non_resident_attr_expand()). BKrev: 4141b263JdzoM6pPhwKvmFB0VIHggg From a7b9eefee82ec71e1301b20a9336d9c7a342211f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 11 Sep 2004 16:23:34 +0000 Subject: [PATCH 1834/2994] fixes for attribute list (Logical change 1.545) --- libntfs/attrib.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 5e4b6b77..133fef75 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2554,6 +2554,7 @@ cluster_free_err_out: * ENOTSUP - The desired resize is not implemented yet. * ENOMEM - Not enough memory to complete operation. * ERANGE - @newsize is not valid for the attribute type of @na. + * ENOSPC - There is no enogh space in base mft to resize $ATTRIBUTE_LIST. */ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) { @@ -2639,6 +2640,11 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) // TODO: Try to make other attributes non-resident and retry each time. + if (na->type == AT_ATTRIBUTE_LIST && errno == ENOSPC) { + err = errno; + goto put_err_out; + } + // TODO: Move the attribute to a new mft record, creating an attribute // list attribute or modifying it if it is already present. @@ -3134,6 +3140,7 @@ put_err_out: * ENOTSUP - The desired resize is not implemented yet. * ENOMEM - Not enough memory to complete operation. * ERANGE - @newsize is not valid for the attribute type of @na. + * ENOSPC - There is no enogh space in base mft to resize $ATTRIBUTE_LIST. */ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) { @@ -3287,9 +3294,13 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) le32_to_cpu(m->bytes_in_use) + cur_max_mp_size; if (mp_size > exp_max_mp_size) { - err = ENOTSUP; - Dprintf("%s(): Eeek! Maping pairs size is too big.\n", - __FUNCTION__); + if (na->type == AT_ATTRIBUTE_LIST) + err = ENOSPC; + else { + err = ENOTSUP; + Dprintf("%s(): Eeek! Maping pairs size is " + "too big.\n", __FUNCTION__); + } goto rollback; } From 822723518791ba05a7e378d4fcc755e573d30e4d Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 11 Sep 2004 16:23:34 +0000 Subject: [PATCH 1835/2994] libntfs/attrib.c fixes for attribute list ntfsprogs/ntfsinfo.c ntfsinfo: make it display attribute instance and dump attribute list entries in verbose mode BKrev: 41432686JHwH9Y7abtLYmq9IlTeqgg From 72b5b3c6fb2d150904b1ce4db10fbc4f758d99ab Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 11 Sep 2004 16:23:34 +0000 Subject: [PATCH 1836/2994] ntfsinfo: make it display attribute instance and dump attribute list entries in verbose mode (Logical change 1.545) --- ntfsprogs/ntfsinfo.c | 85 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index e9b4c975..28b689ca 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -402,6 +402,8 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) le16_to_cpu(attr->value_offset)); printf("Dumping attribute $STANDARD_INFORMATION (0x10)\n"); + + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* let's start with mandatory? fields */ @@ -454,10 +456,14 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) /** * ntfs_dump_attr_list() */ -static void ntfs_dump_attr_list(ATTR_RECORD *attr) +static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) { - printf("Dumping attribute AT_ATTRIBUTE_LIST (0x20)\n"); + ATTR_LIST_ENTRY *entry; + u8 *value; + s64 l; + printf("Dumping attribute AT_ATTRIBUTE_LIST (0x20)\n"); + /* Dump list's name */ if (attr->name_length) { char *stream_name = NULL; @@ -474,6 +480,8 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr) } else { printf("\tList name:\t\t unnamed\n"); } + + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* Dump list's size */ if (attr->non_resident) { @@ -488,6 +496,59 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr) printf("\tList's size:\t\t %u bytes\n", (unsigned int)le32_to_cpu(attr->value_length)); } + + if (!opts.verbose) + return; + + l = ntfs_get_attribute_value_length(attr); + if (!l) { + perror("ntfs_get_attribute_value_length failed"); + return; + } + value = malloc(l); + if (!value) { + perror("malloc failed"); + return; + } + l = ntfs_get_attribute_value(vol, attr, value); + if (!l) { + perror("ntfs_get_attribute_value failed"); + free(value); + return; + } + printf("\tDumping attribute list:"); + entry = (ATTR_LIST_ENTRY *) value; + for(;(u8 *)entry < (u8 *) value + l; entry = (ATTR_LIST_ENTRY *) + ((u8 *) entry + le16_to_cpu(entry->length))) { + printf("\n"); + printf("\t\tAtrribute type:\t0x%X\n", le32_to_cpu(entry->type)); + printf("\t\tRecord length:\t%u\n", + le16_to_cpu(entry->length)); + printf("\t\tName length:\t%u\n", entry->name_length); + printf("\t\tName offset:\t%u\n", entry->name_offset); + printf("\t\tStarting VCN:\t%lld\n", + sle64_to_cpu(entry->lowest_vcn)); + printf("\t\tMFT reference:\t%lld\n", + MREF_LE(entry->mft_reference)); + printf("\t\tInstance:\t%u\n", le16_to_cpu(entry->instance)); + printf("\t\tName:\t\t"); + if (entry->name_length) { + char *name = NULL; + int name_size; + + name_size = ntfs_ucstombs(entry->name, + entry->name_length, &name, 0); + + if (name_size > 0) { + printf("%s\n", name); + free(name); + } else + perror("ntfs_ucstombs failed"); + } else + printf("unnamed\n"); + } + free(value); + printf("\tEnd of attribute list reached.\n"); } /** @@ -527,6 +588,8 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) printf("\tFile Name:\t\t unnamed?!?\n"); } + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); + /* other basic stuff about the file */ printf("\tAllocated File Size:\t %lld\n", (long long)sle64_to_cpu(file_name_attr->allocated_size)); @@ -566,6 +629,8 @@ static void ntfs_dump_attr_object_id(ATTR_RECORD *attr,ntfs_volume *vol) le16_to_cpu(attr->value_offset)); printf("Dumping attribute $OBJECT_ID (0x40)\n"); + + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); if (vol->major_ver >= 3.0) { u32 value_length; @@ -673,6 +738,8 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v char *sid; printf("Dumping attribute $SECURITY_DESCRIPTOR (0x50)\n"); + + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); if (attr->non_resident) { runlist *rl = ntfs_mapping_pairs_decompress(vol, attr, 0); @@ -752,6 +819,8 @@ static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) ntfschar *ucs_vol_name = NULL; printf("Dumping attribute $VOLUME_NAME (0x60)\n"); + + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); if (attr->value_length>0) { char *mbs_vol_name = NULL; @@ -792,6 +861,8 @@ static void ntfs_dump_attr_volume_information(ATTR_RECORD *attr) le16_to_cpu(attr->value_offset)); printf("Dumping attribute $VOLUME_INFORMATION (0x70)\n"); + + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); printf("\tVolume Version:\t %d.%d\n", vol_information->major_ver, vol_information->minor_ver); @@ -845,6 +916,8 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol) } else { printf("\tStream name:\t\t unnamed\n"); } + + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* TODO: parse the flags */ printf("\tFlags:\t\t\t 0x%04hx\n",le16_to_cpu(attr->flags)); @@ -997,6 +1070,8 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) } else { printf("\tIndex name:\t\t unnamed\n"); } + + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* attr_type dumping */ printf("\tIndexed Attr Type:\t "); @@ -1212,6 +1287,8 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) } else { printf("\tIndex name:\t\t unnamed\n"); } + + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* dump index's size */ if (attr->non_resident) { @@ -1253,6 +1330,8 @@ static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) } else { printf("\tBitmap name:\t\t unnamed\n"); } + + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* dump bitmap size */ if (attr->non_resident) { @@ -1502,7 +1581,7 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) ntfs_dump_attr_standard_information(ctx->attr); break; case AT_ATTRIBUTE_LIST: - ntfs_dump_attr_list(ctx->attr); + ntfs_dump_attr_list(ctx->attr, inode->vol); break; case AT_FILE_NAME: ntfs_dump_attr_file_name(ctx->attr); From 8930729433ff6568589adba51c573af03b31fbb6 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 11 Sep 2004 16:23:34 +0000 Subject: [PATCH 1837/2994] update (Logical change 1.545) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2d594233..f1645085 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,8 @@ xx/xx/2004 - 2.0.0-WIP - Improvement to ntfs_non_resident_attr_expand: expand multi extent attributes if we don't need to allocate new mft records to perform this (Yura). + - ntfsinfo: dump attribute list entries in verbose mode and display + attribute instance of all attributes. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From d7f49f588086eeac05bf373b42498e7b1f6cbcb1 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 12 Sep 2004 11:00:06 +0000 Subject: [PATCH 1838/2994] added prototype for ntfs_attrlist_entry_add (Logical change 1.546) --- include/ntfs/attrlist.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/ntfs/attrlist.h b/include/ntfs/attrlist.h index fd3ed6c0..cb9c0702 100644 --- a/include/ntfs/attrlist.h +++ b/include/ntfs/attrlist.h @@ -3,6 +3,7 @@ * Linux-NTFS project. * * Copyright (c) 2004 Anton Altaparmakov + * Copyright (c) 2004 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -25,6 +26,9 @@ #include "attrib.h" +extern int ntfs_attrlist_entry_add(ntfs_inode *ni, MFT_REF mref, + ATTR_RECORD *attr); + extern int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx); #endif /* defined _NTFS_ATTRLIST_H */ From 893742e5c2764ff44331c9e7acc105a2185d5276 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 12 Sep 2004 11:00:06 +0000 Subject: [PATCH 1839/2994] libntfs/attrlist.c new API: ntfs_attrlist_entry_add - add an attribute list attribute entry libntfs/inode.c ntfs_inode_sync: write dirty attribute list to disk BKrev: 41442c36YT3aG199TQCym5eOhikRIg From 0819f472934e5ca190f88087108c8037c55fc4b9 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 12 Sep 2004 11:00:06 +0000 Subject: [PATCH 1840/2994] new API: ntfs_attrlist_entry_add - add an attribute list attribute entry (Logical change 1.546) --- libntfs/attrlist.c | 160 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 4c7125b7..3bd347fa 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -3,6 +3,7 @@ * project. * * Copyright (c) 2004 Anton Altaparmakov + * Copyright (c) 2004 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -22,12 +23,171 @@ #include "config.h" +#include #include #include "types.h" #include "layout.h" #include "attrib.h" #include "attrlist.h" +#include "debug.h" +#include "unistr.h" + +/** + * ntfs_attrlist_entry_add - add an attribute list attribute entry + * @ni: opened ntfs inode, to which attribute list add entry + * @mref: mft reference of record where new attribute placed + * @attr: attribute record to add to attribute list + * + * @mref should be in little endian, use MK_LE_MREF to build it. + * + * Return 0 on success and -1 on error with errno set to the error code. The + * following error codes are defined: + * EINVAL + * ENOMEM + * ENOTSUP + * EIO + */ +int ntfs_attrlist_entry_add(ntfs_inode *ni, MFT_REF mref, ATTR_RECORD *attr) +{ + ATTR_LIST_ENTRY *ale; + ntfs_attr *na = NULL; + u8 *new_al; + int new_al_len; + runlist *rl; + int rl_size; + int err; + + Dprintf("%s(): Entering for inode 0x%llx, mref 0x%llx, attr 0x%x.\n", + __FUNCTION__, ni->mft_no, mref, attr->type); + + if (!ni || !attr) { + errno = EINVAL; + return -1; + } + + if (ni->nr_extents == -1) + ni = ni->base_ni; + + new_al_len = (ni->attr_list_size + sizeof(ATTR_LIST_ENTRY) + + sizeof(ntfschar) * attr->name_length + 7) & ~7; + new_al = malloc(new_al_len); + if (!new_al) { + Dprintf("%s(): Not enough memory.\n", __FUNCTION__); + err = ENOMEM; + return -1; + } + + /* Find offset at which insert new entry. */ + ale = (ATTR_LIST_ENTRY *) ni->attr_list; + for(; (u8 *)ale < ni->attr_list + ni->attr_list_size; + ale = (ATTR_LIST_ENTRY *)((u8 *) ale + + le16_to_cpu(ale->length))) { + if (le32_to_cpu(ale->type) < le32_to_cpu(attr->type)) + continue; + if (le32_to_cpu(ale->type) > le32_to_cpu(attr->type)) + break; + err = ntfs_names_collate(ale->name, ale->name_length, + (ntfschar *)((u8 *)attr + attr->name_length), + attr->name_length, -2, CASE_SENSITIVE, 0, 0); + if (err == -2) { + err = EIO; + Dprintf("%s(): Corrupt attribute name. Run chkdsk.\n", + __FUNCTION__); + goto err_out; + } + if (err < 0) + continue; + if (err > 0) + break; + if (sle16_to_cpu(ale->lowest_vcn) < + sle16_to_cpu(attr->lowest_vcn)) + continue; + if (sle16_to_cpu(ale->lowest_vcn) == + sle16_to_cpu(attr->lowest_vcn)) { + err = EINVAL; + Dprintf("%s(): Attribute with same type, name and " + "lowest vcn already present in attribute " + "list.\n", __FUNCTION__); + goto err_out; + } + break; + } + + /* Copy entries from old attribute list to new. */ + memcpy(new_al, ni->attr_list, (u8 *)ale - ni->attr_list); + memcpy(new_al + new_al_len - ni->attr_list_size + ((u8 *)ale - + ni->attr_list), ale, ni->attr_list_size - + ((u8 *)ale - ni->attr_list)); + + /* Set pointer to new entry. */ + ale = (ATTR_LIST_ENTRY *)(new_al + ((u8 *)ale - ni->attr_list)); + + /* Fill new entry with values. */ + ale->type = attr->type; + ale->length = cpu_to_le16(new_al_len - ni->attr_list_size); + ale->name_length = attr->name_length; + ale->name_offset = (u8 *)ale->name - (u8 *)ale; + ale->lowest_vcn = attr->lowest_vcn; + ale->mft_reference = mref; + ale->instance = attr->instance; + memcpy(ale->name, (u8 *)attr + attr->name_length, attr->name_length); + + /* Resize $ATTRIBUTE_LIST attribute. */ + na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, 0, 0); + if (!na) { + err = errno; + Dprintf("%s(): Coudn't open $ATTRIBUTE_LIST.\n", __FUNCTION__); + goto err_out; + } + if (ntfs_attr_truncate(na, new_al_len)) { + if (errno == ENOSPC) { + // FIXME: Free space in mft record and try again. + err = ENOTSUP; + goto err_out; + } else { + err = errno; + Dprintf("%s(): $ATTRIBUTE_LIST resize failed.\n", + __FUNCTION__); + goto err_out; + } + } + + /* Update ntfs inode. */ + if (NAttrNonResident(na)) { + /* Get new runlist. */ + for (rl = na->rl, rl_size = 1; rl->length; rl++) + rl_size++; + rl_size = (rl_size * sizeof(runlist_element) + 0xfff) & ~0xfff; + rl = malloc(rl_size); + if (!rl) { + Dprintf("%s(): Not enough memory.\n", __FUNCTION__); + if (ntfs_attr_truncate(na, ni->attr_list_size)) + Dprintf("%s(): Rollback failed. Leaving " + "inconsist metadata.\n", __FUNCTION__); + err = ENOMEM; + goto err_out; + } + memcpy(rl, na->rl, rl_size); + free(ni->attr_list_rl); + ni->attr_list_rl = rl; + NInoSetAttrListNonResident(ni); + } else + NInoClearAttrListNonResident(ni); + + free(ni->attr_list); + ni->attr_list = new_al; + ni->attr_list_size = new_al_len; + NInoAttrListSetDirty(ni); + return 0; + +err_out: + free(new_al); + if (na) + ntfs_attr_close(na); + errno = err; + return -1; +} /** * ntfs_attrlist_entry_rm - remove an attribute list attribute entry From 64e1f672cf00e199bb34e5b7cb56beaece06daa0 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 12 Sep 2004 11:00:06 +0000 Subject: [PATCH 1841/2994] ntfs_inode_sync: write dirty attribute list to disk (Logical change 1.546) --- libntfs/inode.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index b5fc80da..061fb391 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -2,6 +2,7 @@ * inode.c - Inode handling code. Part of the Linux-NTFS project. * * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2004 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -384,10 +385,33 @@ int ntfs_inode_sync(ntfs_inode *ni) return -1; } - // TODO: Implement writing out of attribute list attribute. (AIA) + /* Write out attribute list from cache to disk. */ if (NInoAttrListDirty(ni)) { - errno = ENOTSUP; - return -1; + ntfs_attr *na; + + na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, 0, 0); + if (!na) { + if (!err || errno == EIO) { + err = errno; + if (err != EIO) + err = EBUSY; + } + } else { + if (na->data_size == ni->attr_list_size) { + if (ntfs_attr_pwrite(na, 0, ni->attr_list_size, + ni->attr_list) != + ni->attr_list_size) { + if (!err || errno == EIO) { + err = errno; + if (err != EIO) + err = EBUSY; + } + } else + NInoAttrListClearDirty(ni); + } else + err = EIO; + ntfs_attr_close(na); + } } /* Write this inode out to the $MFT (and $MFTMirr if applicable). */ From 27e0e7a0c7a37b7aa4995ae4d2a29d8ba623b98a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 12 Sep 2004 18:46:04 +0000 Subject: [PATCH 1842/2994] Add @stopped_at parameter to ntfs_mapping_pairs_build and adapt all callers. (Logical change 1.547) --- include/ntfs/runlist.h | 2 +- libntfs/attrib.c | 7 ++++--- libntfs/runlist.c | 39 +++++++++++++++++++++++++-------------- ntfsprogs/mkntfs.c | 4 ++-- ntfsprogs/ntfsmove.c | 2 +- ntfsprogs/ntfsresize.c | 2 +- 6 files changed, 34 insertions(+), 22 deletions(-) diff --git a/include/ntfs/runlist.h b/include/ntfs/runlist.h index e79a1106..7a36258f 100644 --- a/include/ntfs/runlist.h +++ b/include/ntfs/runlist.h @@ -72,7 +72,7 @@ extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, const int dst_len, const runlist_element *rl, - const VCN start_vcn); + const VCN start_vcn, VCN *stopped_at); extern int ntfs_rl_truncate(runlist **rl, const VCN start_vcn); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 133fef75..5b3c6a3f 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2513,7 +2513,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, /* Generate the mapping pairs array in the attribute record. */ if (ntfs_mapping_pairs_build(vol, (u8*)a + mp_ofs, arec_size - mp_ofs, - rl, 0) < 0) { + rl, 0, 0) < 0) { err = errno; // FIXME: Eeek! We need rollback! (AIA) Dprintf("%s(): Eeek! Failed to build mapping pairs. Leaving " @@ -3038,7 +3038,8 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) * correct destination, i.e. the attribute record itself. */ if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( - a->mapping_pairs_offset), mp_size, na->rl, 0)) { + a->mapping_pairs_offset), mp_size, + na->rl, 0, 0)) { err = errno; // FIXME: Eeek! We need rollback! (AIA) Dprintf("%s(): Eeek! Mapping pairs build " @@ -3353,7 +3354,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) */ if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu(a->mapping_pairs_offset), mp_size, - na->rl, sle64_to_cpu(a->lowest_vcn))) { + na->rl, sle64_to_cpu(a->lowest_vcn), 0)) { err = errno; Dprintf("%s(): BUG! Mapping pairs build " "failed. Please run chkdsk and if " diff --git a/libntfs/runlist.c b/libntfs/runlist.c index b2c7e8ac..f251e59a 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1396,6 +1396,8 @@ err_out: * @dst_len: size of destination buffer @dst in bytes * @rl: runlist for which to build the mapping pairs array * @start_vcn: vcn at which to start the mapping pairs array + * @stopped_at: if function failed with ENOSPC error code @stopped_at contain + * first vcn outside destination buffer. * * Create the mapping pairs array from the runlist @rl, starting at vcn * @start_vcn and save the array in @dst. @dst_len is the size of @dst in @@ -1404,6 +1406,8 @@ err_out: * * If @rl is NULL, just write a single terminator byte to @dst. * + * @stopped_at can be NULL in case such information is not required. + * * Return 0 on success. On error, return -1 with errno set to the error code. * The following error codes are defined: * EINVAL - Run list contains unmapped elements. Make sure to only pass @@ -1414,7 +1418,7 @@ err_out: */ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, const int dst_len, const runlist_element *rl, - const VCN start_vcn) + const VCN start_vcn, VCN *stopped_at) { LCN prev_lcn; s8 *dst_max; @@ -1475,10 +1479,13 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, goto size_err; } else lcn_len = 0; - /* Update header byte. */ - *dst = lcn_len << 4 | len_len; - /* Position ourselves at next mapping pairs array element. */ - dst += 1 + len_len + lcn_len; + if (dst + len_len + lcn_len + 1 <= dst_max) { + /* Update header byte. */ + *dst = lcn_len << 4 | len_len; + /* Position at next mapping pairs array element. */ + dst += 1 + len_len + lcn_len; + } else + goto size_err; /* Go to next runlist element. */ rl++; } @@ -1509,17 +1516,21 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, prev_lcn = rl->lcn; } else lcn_len = 0; - /* Update header byte. */ - *dst = lcn_len << 4 | len_len; - /* Position ourselves at next mapping pairs array element. */ - dst += 1 + len_len + lcn_len; - } - if (dst <= dst_max) { - /* Terminator byte. */ - *dst = 0; - return 0; + if (dst + len_len + lcn_len + 1 <= dst_max) { + /* Update header byte. */ + *dst = lcn_len << 4 | len_len; + /* Position at next mapping pairs array element. */ + dst += 1 + len_len + lcn_len; + } else + goto size_err; } + /* Terminator byte. */ + *dst = 0; + return 0; size_err: + if (stopped_at) + *stopped_at = rl->vcn; + *dst = 0; errno = ENOSPC; return -1; val_err: diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index b2e3a23e..faa51bc4 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1322,7 +1322,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, Eprintf("Error writing non-resident attribute value." "\n"); err = ntfs_mapping_pairs_build(vol, (s8*)a + hdr_size + - ((name_len + 7) & ~7), mpa_size, rl, 0); + ((name_len + 7) & ~7), mpa_size, rl, 0, 0); } a->initialized_size = cpu_to_le64(inited_size); if (err < 0 || bw != val_len) { @@ -1512,7 +1512,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, Eprintf("Error writing non-resident attribute value." "\n"); err = ntfs_mapping_pairs_build(vol, (s8*)a + hdr_size + - ((name_len + 7) & ~7), mpa_size, rl, 0); + ((name_len + 7) & ~7), mpa_size, rl, 0, 0); } if (err < 0 || bw != val_len) { // FIXME: Handle error. diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index d805a94f..b4bd34a3 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -709,7 +709,7 @@ static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, // update data runs ntfs_mapping_pairs_build(vol, ((u8*)rec) + rec->mapping_pairs_offset, - need_to, from, 0); + need_to, from, 0, 0); // commit ntfs_inode_mark_dirty (ino); diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 0de41876..73b42f2a 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1157,7 +1157,7 @@ static void replace_attribute_runlist(ntfs_volume *vol, if (!(mp = calloc(1, mp_size))) perr_exit("Couldn't get memory"); - if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl, 0)) + if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl, 0, 0)) perr_exit("ntfs_mapping_pairs_build"); memmove((u8*)a + le16_to_cpu(a->mapping_pairs_offset), mp, mp_size); From 88228c1e420cfcfaaa722246c595cb3e69d7b655 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 12 Sep 2004 18:46:04 +0000 Subject: [PATCH 1843/2994] Add @stopped_at parameter to ntfs_mapping_pairs_build and adapt all callers. BKrev: 4144996cMCQGevlUEAEKqnoCoJ6KgQ From a95cff840463f9aa1c71e0da188665e366ae4f3b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 12 Sep 2004 18:46:04 +0000 Subject: [PATCH 1844/2994] update (Logical change 1.547) --- ChangeLog | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f1645085..7e76b422 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,9 +13,15 @@ xx/xx/2004 - 2.0.0-WIP doesn't update them unless a rename operation occur. (Yura) - Improvement to ntfs_non_resident_attr_expand: expand multi extent attributes if we don't need to allocate new mft records to perform - this (Yura). + this. (Yura) - ntfsinfo: dump attribute list entries in verbose mode and display attribute instance of all attributes. (Yura) + - new API: attrlist.[ch]::ntfs_attrlist_entry_add add entry to attribute + list. (Yura) + - ntfs_inode_sync: write out dirty attribute list from cache to + disk. (Yura) + - Add @stopped_at parameter to ntfs_mapping_pairs_build() and adapt + all callers. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 1159ab36567da9177a70f4e3fe718ec5b7c7c00a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Sep 2004 09:31:42 +0000 Subject: [PATCH 1845/2994] Cleanup the ntfs_mapping_pairs_build enhancement. (Logical change 1.548) --- include/ntfs/runlist.h | 2 +- libntfs/attrib.c | 6 +++--- libntfs/runlist.c | 44 +++++++++++++++++++++++------------------- ntfsprogs/mkntfs.c | 4 ++-- ntfsprogs/ntfsmove.c | 2 +- ntfsprogs/ntfsresize.c | 2 +- 6 files changed, 32 insertions(+), 28 deletions(-) diff --git a/include/ntfs/runlist.h b/include/ntfs/runlist.h index 7a36258f..2c5df101 100644 --- a/include/ntfs/runlist.h +++ b/include/ntfs/runlist.h @@ -72,7 +72,7 @@ extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, const int dst_len, const runlist_element *rl, - const VCN start_vcn, VCN *stopped_at); + const VCN start_vcn, VCN *const stop_vcn); extern int ntfs_rl_truncate(runlist **rl, const VCN start_vcn); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 5b3c6a3f..f49c8ee1 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2513,7 +2513,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, /* Generate the mapping pairs array in the attribute record. */ if (ntfs_mapping_pairs_build(vol, (u8*)a + mp_ofs, arec_size - mp_ofs, - rl, 0, 0) < 0) { + rl, 0, NULL) < 0) { err = errno; // FIXME: Eeek! We need rollback! (AIA) Dprintf("%s(): Eeek! Failed to build mapping pairs. Leaving " @@ -3039,7 +3039,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) */ if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( a->mapping_pairs_offset), mp_size, - na->rl, 0, 0)) { + na->rl, 0, NULL)) { err = errno; // FIXME: Eeek! We need rollback! (AIA) Dprintf("%s(): Eeek! Mapping pairs build " @@ -3354,7 +3354,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) */ if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu(a->mapping_pairs_offset), mp_size, - na->rl, sle64_to_cpu(a->lowest_vcn), 0)) { + na->rl, sle64_to_cpu(a->lowest_vcn), NULL)) { err = errno; Dprintf("%s(): BUG! Mapping pairs build " "failed. Please run chkdsk and if " diff --git a/libntfs/runlist.c b/libntfs/runlist.c index f251e59a..2e7d3a32 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1396,8 +1396,7 @@ err_out: * @dst_len: size of destination buffer @dst in bytes * @rl: runlist for which to build the mapping pairs array * @start_vcn: vcn at which to start the mapping pairs array - * @stopped_at: if function failed with ENOSPC error code @stopped_at contain - * first vcn outside destination buffer. + * @stop_vcn: first vcn outside destination buffer on on ENOSPC error * * Create the mapping pairs array from the runlist @rl, starting at vcn * @start_vcn and save the array in @dst. @dst_len is the size of @dst in @@ -1406,7 +1405,12 @@ err_out: * * If @rl is NULL, just write a single terminator byte to @dst. * - * @stopped_at can be NULL in case such information is not required. + * On error ENOSPC, if @stop_vcn is not NULL, *@stop_vcn is set to the first + * vcn outside the destination buffer. Note that @dst has been filled with all + * the mapping pairs that will fit, thus it can be treated as partial success, + * in that a new attribute extent needs to be created or the next extent has to + * be used and the mapping pairs build has to be continued with @start_vcn set + * to *@stop_vcn. * * Return 0 on success. On error, return -1 with errno set to the error code. * The following error codes are defined: @@ -1418,10 +1422,10 @@ err_out: */ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, const int dst_len, const runlist_element *rl, - const VCN start_vcn, VCN *stopped_at) + const VCN start_vcn, VCN *const stop_vcn) { LCN prev_lcn; - s8 *dst_max; + s8 *dst_max, *dst_next; s8 len_len, lcn_len; if (start_vcn < 0) @@ -1479,13 +1483,13 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, goto size_err; } else lcn_len = 0; - if (dst + len_len + lcn_len + 1 <= dst_max) { - /* Update header byte. */ - *dst = lcn_len << 4 | len_len; - /* Position at next mapping pairs array element. */ - dst += 1 + len_len + lcn_len; - } else + dst_next = dst + len_len + lcn_len + 1; + if (dst_next > dst_max) goto size_err; + /* Update header byte. */ + *dst = lcn_len << 4 | len_len; + /* Position at next mapping pairs array element. */ + dst = dst_next; /* Go to next runlist element. */ rl++; } @@ -1516,20 +1520,20 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, prev_lcn = rl->lcn; } else lcn_len = 0; - if (dst + len_len + lcn_len + 1 <= dst_max) { - /* Update header byte. */ - *dst = lcn_len << 4 | len_len; - /* Position at next mapping pairs array element. */ - dst += 1 + len_len + lcn_len; - } else + dst_next = dst + len_len + lcn_len + 1; + if (dst_next > dst_max) goto size_err; + /* Update header byte. */ + *dst = lcn_len << 4 | len_len; + /* Position at next mapping pairs array element. */ + dst += 1 + len_len + lcn_len; } - /* Terminator byte. */ + /* Add terminator byte. */ *dst = 0; return 0; size_err: - if (stopped_at) - *stopped_at = rl->vcn; + if (stop_vcn) + *stop_vcn = rl->vcn; *dst = 0; errno = ENOSPC; return -1; diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index faa51bc4..2c544a3f 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1322,7 +1322,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, Eprintf("Error writing non-resident attribute value." "\n"); err = ntfs_mapping_pairs_build(vol, (s8*)a + hdr_size + - ((name_len + 7) & ~7), mpa_size, rl, 0, 0); + ((name_len + 7) & ~7), mpa_size, rl, 0, NULL); } a->initialized_size = cpu_to_le64(inited_size); if (err < 0 || bw != val_len) { @@ -1512,7 +1512,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, Eprintf("Error writing non-resident attribute value." "\n"); err = ntfs_mapping_pairs_build(vol, (s8*)a + hdr_size + - ((name_len + 7) & ~7), mpa_size, rl, 0, 0); + ((name_len + 7) & ~7), mpa_size, rl, 0, NULL); } if (err < 0 || bw != val_len) { // FIXME: Handle error. diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index b4bd34a3..309ba21f 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -709,7 +709,7 @@ static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, // update data runs ntfs_mapping_pairs_build(vol, ((u8*)rec) + rec->mapping_pairs_offset, - need_to, from, 0, 0); + need_to, from, 0, NULL); // commit ntfs_inode_mark_dirty (ino); diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 73b42f2a..320aa745 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1157,7 +1157,7 @@ static void replace_attribute_runlist(ntfs_volume *vol, if (!(mp = calloc(1, mp_size))) perr_exit("Couldn't get memory"); - if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl, 0, 0)) + if (ntfs_mapping_pairs_build(vol, mp, mp_size, rl, 0, NULL)) perr_exit("ntfs_mapping_pairs_build"); memmove((u8*)a + le16_to_cpu(a->mapping_pairs_offset), mp, mp_size); From dc4d7921e105a4613a1bba3c26edf2c30bb42c09 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Sep 2004 09:31:42 +0000 Subject: [PATCH 1846/2994] Cleanup the ntfs_mapping_pairs_build enhancement. BKrev: 414568feNrnD8KlGyp0pnPL1hN-Iow From a5b6b8945682a207c4ade009098a854c87e706d9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Sep 2004 09:31:42 +0000 Subject: [PATCH 1847/2994] Update (Logical change 1.548) --- ChangeLog | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e76b422..9ea4d171 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,8 +20,10 @@ xx/xx/2004 - 2.0.0-WIP list. (Yura) - ntfs_inode_sync: write out dirty attribute list from cache to disk. (Yura) - - Add @stopped_at parameter to ntfs_mapping_pairs_build() and adapt - all callers. (Yura) + - Add stop_vcn parameter to ntfs_mapping_pairs_build() and adapt + all callers. This allows filling an attribute extent with mapping + pairs and then continuing in a different extent once the first extent + is full. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From b82469ba50aff49d7b981310adece0aa78114b6f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Sep 2004 10:28:54 +0000 Subject: [PATCH 1848/2994] Remove vol->nr_mft_records and update all users. (Anton) (Logical change 1.549) --- ChangeLog | 1 + include/ntfs/volume.h | 3 -- libntfs/mft.c | 82 +++++++++++++++++++++++++++++++++++++--- libntfs/volume.c | 3 -- ntfsprogs/ntfsclone.c | 6 ++- ntfsprogs/ntfscluster.c | 2 +- ntfsprogs/ntfsinfo.c | 2 - ntfsprogs/ntfsresize.c | 22 ++++++++--- ntfsprogs/ntfsundelete.c | 20 ++++++++-- ntfsprogs/ntfswipe.c | 21 +++++++--- ntfsprogs/utils.c | 6 ++- 11 files changed, 134 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ea4d171..c356c2d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,7 @@ xx/xx/2004 - 2.0.0-WIP all callers. This allows filling an attribute extent with mapping pairs and then continuing in a different extent once the first extent is full. (Yura) + - Remove vol->nr_mft_records and update all users. (Anton) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 8191290c..6fb3be5d 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -140,9 +140,6 @@ struct _ntfs_volume { lcn 0 and so on. A set bit means that the cluster and vice versa. */ - s64 nr_mft_records; /* Number of initialized records in the mft, - equals the number of bits in mft_bitmap that - may be set. */ LCN mft_lcn; /* Logical cluster number of the data attribute for FILE_MFT. */ ntfs_inode *mft_ni; /* ntfs_inode structure for FILE_MFT. */ diff --git a/libntfs/mft.c b/libntfs/mft.c index 14e5cf5d..244e3e82 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -72,7 +72,8 @@ int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref, } m = MREF(mref); /* Refuse to read non-allocated mft records. */ - if (m + count > vol->nr_mft_records) { + if (m + count > vol->mft_na->initialized_size >> + vol->mft_record_size_bits) { errno = ESPIPE; return -1; } @@ -129,7 +130,8 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, } m = MREF(mref); /* Refuse to write non-allocated mft records. */ - if (m + count > vol->nr_mft_records) { + if (m + count > vol->mft_na->initialized_size >> + vol->mft_record_size_bits) { errno = ESPIPE; return -1; } @@ -375,20 +377,88 @@ int ntfs_mft_record_format(const ntfs_volume *vol, const MFT_REF mref) * @start: starting mft record at which to allocate (or -1 if none) * * Allocate an mft record in $MFT/$DATA starting to search for a free record - * at mft record number @start or at the current allocator position if - * @start_mref is -1, on the mounted ntfs volume @vol. + * at mft record number @start or at the current allocator position if @start + * is -1, on the mounted ntfs volume @vol. * * On success return the now opened ntfs inode of the mft record. * * On error return NULL with errno set to the error code. + * + * To find a free mft record, we scan the mft bitmap for a zero bit. To + * optimize this we start scanning at the place specified by @start or if + * @start is -1 we start where we last stopped and we perform wrap around when + * we reach the end. Note, we do not try to allocate mft records below number + * 24 because numbers 0 to 15 are the defined system files anyway and 16 to 24 + * are special in that they are used for storing extension mft records for the + * $DATA attribute of $MFT. This is required to avoid the possibility of + * creating a run list with a circular dependence which once written to disk + * can never be read in again. Windows will only use records 16 to 24 for + * normal files if the volume is completely out of space. We never use them + * which means that when the volume is really out of space we cannot create any + * more files while Windows can still create up to 8 small files. We can start + * doing this at some later time, it does not matter much for now. + * + * When scanning the mft bitmap, we only search up to the last allocated mft + * record. If there are no free records left in the range 24 to number of + * allocated mft records, then we extend the $MFT/$DATA attribute in order to + * create free mft records. We extend the allocated size of $MFT/$DATA by 16 + * records at a time or one cluster, if cluster size is above 16kiB. If there + * is not sufficient space to do this, we try to extend by a single mft record + * or one cluster, if cluster size is above the mft record size, but we only do + * this if there is enough free space, which we know from the values returned + * by the failed cluster allocation function when we tried to do the first + * allocation. + * + * No matter how many mft records we allocate, we initialize only the first + * allocated mft record, incrementing mft data size and initialized size + * accordingly, open an ntfs_inode for it and return it to the caller, unless + * there are less than 24 mft records, in which case we allocate and initialize + * mft records until we reach record 24 which we consider as the first free mft + * record for use by normal files. + * + * If during any stage we overflow the initialized data in the mft bitmap, we + * extend the initialized size (and data size) by 8 bytes, allocating another + * cluster if required. The bitmap data size has to be at least equal to the + * number of mft records in the mft, but it can be bigger, in which case the + * superflous bits are padded with zeroes. + * + * Thus, when we return successfully (return value non-zero), we will have: + * - initialized / extended the mft bitmap if necessary, + * - initialized / extended the mft data if necessary, + * - set the bit corresponding to the mft record being allocated in the + * mft bitmap, + * - open an ntfs_inode for the allocated mft record, and we will + * - return the ntfs_inode. + * + * On error (return value zero), nothing will have changed. If we had changed + * anything before the error occured, we will have reverted back to the + * starting state before returning to the caller. Thus, except for bugs, we + * should always leave the volume in a consistent state when returning from + * this function. + * + * Note, this function cannot make use of most of the normal functions, like + * for example for attribute resizing, etc, because when the run list overflows + * the base mft record and an attribute list is used, it is very important that + * the extension mft records used to store the $DATA attribute of $MFT can be + * reached without having to read the information contained inside them, as + * this would make it impossible to find them in the first place after the + * volume is dismounted. $MFT/$BITMAP probably does not need to follow this + * rule because the bitmap is not essential for finding the mft records, but on + * the other hand, handling the bitmap in this special way would make life + * easier because otherwise there might be circular invocations of functions + * when reading the bitmap but if we are careful, we should be able to avoid + * all problems. */ +#ifndef PAGE_SIZE +#define PAGE_SIZE 4096 +#endif ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, s64 start) { - if (!vol || !vol->mftbmp_na || start < -1) { + ntfs_debug("Entering (start 0x%llx).", (long long)start); + if (!vol || !vol->mft_na || !vol->mftbmp_na || start < -1) { errno = EINVAL; return NULL; } - errno = ENOTSUP; return NULL; } diff --git a/libntfs/volume.c b/libntfs/volume.c index 75bae327..95a00af3 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -217,9 +217,6 @@ mft_has_no_attr_list: Dperror("Failed to open ntfs attribute"); goto error_exit; } - /* Set the number of initialized mft records. */ - vol->nr_mft_records = vol->mft_na->initialized_size >> - vol->mft_record_size_bits; /* Read all extents from the $DATA attribute in $MFT. */ ntfs_attr_reinit_search_ctx(ctx); last_vcn = vol->mft_na->allocated_size >> vol->cluster_size_bits; diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index bae0835e..2b679e94 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -873,7 +873,8 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) Printf("Scanning volume ...\n"); - last_mft_rec = volume->nr_mft_records - 1; + last_mft_rec = (volume->mft_na->initialized_size >> + volume->mft_record_size_bits) - 1; progress_init(&progress, inode, last_mft_rec, 100); for (; inode <= last_mft_rec; inode++) { @@ -1331,7 +1332,8 @@ int main(int argc, char **argv) walk_clusters(vol, &backup_clusters); Printf("Num of MFT records = %8lld\n", - (long long)vol->nr_mft_records); + (long long)vol->mft_na->initialized_size >> + vol->mft_record_size_bits); Printf("Num of used MFT records = %8d\n", nr_used_mft_records); Printf("Wiped unused MFT data = %8d\n", wiped_unused_mft_data); diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index df5f0e05..194d79d4 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -311,7 +311,7 @@ static int info (ntfs_volume *vol) d = vol->nr_clusters << cb; e = vol->nr_clusters; f = vol->nr_clusters >> cps; - g = vol->nr_mft_records; + g = vol->mft_na->initialized_size >> vol->mft_record_size_bits; h = inuse; i = h * 100 / g; j = fc; diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 28b689ca..d30a0596 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -339,8 +339,6 @@ static void ntfs_dump_volume(ntfs_volume *vol) (long long)vol->data1_zone_pos); printf("\tCurrent Position in Second Data Zone: %lld\n", (long long)vol->data2_zone_pos); - printf("\tNumber of Initialized Records in MFT: %lld\n", - (long long)vol->nr_mft_records); printf("\tLCN of Data Attribute for FILE_MFT: %lld\n", (long long)vol->mft_lcn); printf("\tFILE_MFTMirr Size: %d\n", vol->mftmirr_size); diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 320aa745..a50f418b 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -953,7 +953,7 @@ static int inode_close(ntfs_inode *ni) */ static int build_allocation_bitmap(ntfs_volume *vol, ntfsck_t *fsck) { - s64 inode = 0; + s64 nr_mft_records, inode = 0; ntfs_inode *ni; struct progress_bar progress; int pb_flags = 0; /* progress bar flags */ @@ -964,9 +964,12 @@ static int build_allocation_bitmap(ntfs_volume *vol, ntfsck_t *fsck) if (fsck->flags & NTFSCK_PROGBAR) pb_flags |= NTFS_PROGBAR; - progress_init(&progress, inode, vol->nr_mft_records - 1, pb_flags); + nr_mft_records = vol->mft_na->initialized_size >> + vol->mft_record_size_bits; - for (; inode < vol->nr_mft_records; inode++) { + progress_init(&progress, inode, nr_mft_records - 1, pb_flags); + + for (; inode < nr_mft_records; inode++) { progress_update(&progress, inode); if ((ni = ntfs_inode_open(vol, (MFT_REF)inode)) == NULL) { @@ -1033,12 +1036,15 @@ static void resize_constrains_by_attributes(ntfs_resize_t *resize) static void set_resize_constrains(ntfs_resize_t *resize) { - s64 inode; + s64 nr_mft_records, inode; ntfs_inode *ni; printf("Collecting shrinkage constrains ...\n"); - for (inode = 0; inode < resize->vol->nr_mft_records; inode++) { + nr_mft_records = resize->vol->mft_na->initialized_size >> + resize->vol->mft_record_size_bits; + + for (inode = 0; inode < nr_mft_records; inode++) { ni = ntfs_inode_open(resize->vol, (MFT_REF)inode); if (ni == NULL) { @@ -1586,6 +1592,7 @@ static void relocate_inode(ntfs_resize_t *resize, MFT_REF mref) static void relocate_inodes(ntfs_resize_t *resize) { + s64 nr_mft_records; MFT_REF mref; printf("Relocating needed data ...\n"); @@ -1597,7 +1604,10 @@ static void relocate_inodes(ntfs_resize_t *resize) if (!resize->mrec) perr_exit("malloc failed"); - for (mref = 1; mref < (MFT_REF)resize->vol->nr_mft_records; mref++) + nr_mft_records = resize->vol->mft_na->initialized_size >> + resize->vol->mft_record_size_bits; + + for (mref = 1; mref < (MFT_REF)nr_mft_records; mref++) relocate_inode(resize, mref); relocate_inode(resize, 0); diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 7441f741..586207b9 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -1553,6 +1553,7 @@ static int set_date (const char *pathname, time_t date) */ static int scan_disk (ntfs_volume *vol) { + s64 nr_mft_records; const int BUFSIZE = 8192; char *buffer = NULL; int results = 0; @@ -1592,6 +1593,9 @@ static int scan_disk (ntfs_volume *vol) } } + nr_mft_records = vol->mft_na->initialized_size >> + vol->mft_record_size_bits; + Qprintf ("Inode Flags %%age Date Size Filename\n"); Qprintf ("---------------------------------------------------------------\n"); for (i = 0; i < bmpsize; i += BUFSIZE) { @@ -1603,7 +1607,7 @@ static int scan_disk (ntfs_volume *vol) for (j = 0; j < size; j++) { b = buffer[j]; for (k = 0; k < 8; k++, b>>=1) { - if (((i+j)*8+k) >= vol->nr_mft_records) + if (((i+j)*8+k) >= nr_mft_records) goto done; if (b & 1) continue; @@ -1907,6 +1911,7 @@ free: */ static int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) { + s64 nr_mft_records; char pathname[256]; ntfs_attr *mft; char *buffer; @@ -1948,10 +1953,13 @@ static int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) goto attr; } - mft_end = min (mft_end, vol->nr_mft_records - 1); + nr_mft_records = vol->mft_na->initialized_size >> + vol->mft_record_size_bits; + + mft_end = min (mft_end, nr_mft_records - 1); Dprintf ("MFT records\n"); - Dprintf (" Total: %8lld\n", vol->nr_mft_records); + Dprintf (" Total: %8lld\n", nr_mft_records); Dprintf (" Begin: %8lld\n", mft_begin); Dprintf (" End: %8lld\n", mft_end); @@ -1988,6 +1996,7 @@ free: */ int main (int argc, char *argv[]) { + s64 nr_mft_records; ntfs_volume *vol; int result = 1; int i; @@ -2028,10 +2037,13 @@ int main (int argc, char *argv[]) } break; case MODE_COPY: + nr_mft_records = vol->mft_na->initialized_size >> + vol->mft_record_size_bits; + result = !copy_mft (vol, opts.mft_begin, opts.mft_end); if (result) Vprintf ("Failed to read MFT blocks %lld-%lld.\n", - opts.mft_begin, min(vol->nr_mft_records, opts.mft_end)); + opts.mft_begin, min(nr_mft_records, opts.mft_end)); break; default: ; /* Cannot happen */ diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 08d9f9e5..1c94b093 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -566,14 +566,17 @@ static s64 wipe_attribute (ntfs_volume *vol, int byte, enum action act, static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) { s64 total = 0; - s64 inode_num; + s64 nr_mft_records, inode_num; ntfs_inode *ni; ntfs_attr *na; if (!vol || (byte < 0)) return -1; - for (inode_num = 16; inode_num < vol->nr_mft_records; inode_num++) { + nr_mft_records = vol->mft_na->initialized_size >> + vol->mft_record_size_bits; + + for (inode_num = 16; inode_num < nr_mft_records; inode_num++) { s64 wiped; Vprintf ("Inode %lld - ", inode_num); @@ -646,7 +649,7 @@ static s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) { // by considering the individual attributes we might be able to // wipe a few more bytes at the attr's tail. - s64 i; + s64 nr_mft_records, i; s64 total = 0; s64 result = 0; int size = 0; @@ -661,7 +664,10 @@ static s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) return -1; } - for (i = 0; i < vol->nr_mft_records; i++) { + nr_mft_records = vol->mft_na->initialized_size >> + vol->mft_record_size_bits; + + for (i = 0; i < nr_mft_records; i++) { if (utils_mftrec_in_use (vol, i)) { result = ntfs_attr_mst_pread (vol->mft_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); @@ -920,7 +926,7 @@ static u32 get_indx_record_size (ntfs_attr *nar) static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) { s64 total = 0; - s64 inode_num; + s64 nr_mft_records, inode_num; ntfs_inode *ni; ntfs_attr *naa; ntfs_attr *nab; @@ -929,7 +935,10 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) if (!vol || (byte < 0)) return -1; - for (inode_num = 5; inode_num < vol->nr_mft_records; inode_num++) { + nr_mft_records = vol->mft_na->initialized_size >> + vol->mft_record_size_bits; + + for (inode_num = 5; inode_num < nr_mft_records; inode_num++) { u32 indx_record_size; s64 wiped; diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 00830a67..8607c834 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -963,6 +963,7 @@ void mft_put_search_ctx (struct mft_search_ctx *ctx) */ int mft_next_record (struct mft_search_ctx *ctx) { + s64 nr_mft_records; ATTR_RECORD *attr10 = NULL; ATTR_RECORD *attr20 = NULL; ATTR_RECORD *attr80 = NULL; @@ -978,7 +979,10 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->inode = NULL; } - for (ctx->mft_num++; (s64)ctx->mft_num < ctx->vol->nr_mft_records; ctx->mft_num++) { + nr_mft_records = ctx->vol->mft_na->initialized_size >> + ctx->vol->mft_record_size_bits; + + for (ctx->mft_num++; (s64)ctx->mft_num < nr_mft_records; ctx->mft_num++) { int in_use; ctx->flags_match = 0; From 89306d3012d9d1a748c4a9c71d18121be86a9f49 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Sep 2004 10:28:54 +0000 Subject: [PATCH 1849/2994] Remove vol->nr_mft_records and update all users. (Anton) BKrev: 41457666lLrPSKGHfofyEGuWtqunEw From b766a979414165cd89d8c81a29577b3554a09dab Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Sep 2004 14:39:50 +0000 Subject: [PATCH 1850/2994] Export ntfs_inode_allocate(). (Logical change 1.550) --- include/ntfs/inode.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index c9130822..aeb8a85f 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -112,6 +112,8 @@ struct _ntfs_inode { int ref_count; }; +extern ntfs_inode *ntfs_inode_allocate(ntfs_volume *vol); + extern ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref); extern int ntfs_inode_close(ntfs_inode *ni); From 4f63b84653dfd0a33a12a20c9229cf36befe0589 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Sep 2004 14:39:50 +0000 Subject: [PATCH 1851/2994] Export ntfs_inode_allocate(). BKrev: 4145b136SFdgwIOifbl6Qr0m3mj-LA From ad7acfacc2c06f45c96a6c84e986a53547ea2e1d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Sep 2004 14:39:50 +0000 Subject: [PATCH 1852/2994] Remove no longer needed forward declaration. (Logical change 1.550) --- libntfs/inode.c | 2 -- libntfs/volume.c | 3 --- 2 files changed, 5 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 061fb391..1a91a2cf 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -50,8 +50,6 @@ static __inline__ ntfs_inode *__ntfs_inode_allocate(ntfs_volume *vol) return ni; } -extern ntfs_inode *ntfs_inode_allocate(ntfs_volume *vol); - /** * Internal: * diff --git a/libntfs/volume.c b/libntfs/volume.c index 95a00af3..15cf1124 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -105,9 +105,6 @@ static void __ntfs_volume_release(ntfs_volume *v) free(v); } -/* External declaration for internal function. */ -extern ntfs_inode *ntfs_inode_allocate(ntfs_volume *); - /** * Internal: * From 8fdb6981ffc8a996b258df11f8ce5db02d261b49 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Sep 2004 14:44:01 +0000 Subject: [PATCH 1853/2994] First cut of ntfs_mft_record_alloc() ported from my old ntfs allocator that I wrote several years ago. Note this is completely untested and there is no error handling at all yet. I will be porting/adding the error handling next. (Anton) (Logical change 1.551) --- libntfs/mft.c | 848 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 832 insertions(+), 16 deletions(-) diff --git a/libntfs/mft.c b/libntfs/mft.c index 244e3e82..7e6b133e 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -36,6 +36,7 @@ #include "inode.h" #include "volume.h" #include "layout.h" +#include "lcnalloc.h" #include "mft.h" /** @@ -371,27 +372,231 @@ int ntfs_mft_record_format(const ntfs_volume *vol, const MFT_REF mref) return 0; } +/** + * ntfs_mft_bitmap_extend_and_allocate_one - + * + * Extend the mft bitmap attribute by one cluster. + * + * Note: Only updates allocated_size, i.e. does not update initialized_size or + * data_size. + */ +static int ntfs_mft_bitmap_extend_by_one_cluster(ntfs_volume *vol, + u8 *have_allocated_mftbmp) +{ + LCN lcn; + s64 ll; + ntfs_attr *mftbmp_na, *lcnbmp_na; + runlist_element *rl, *rl2; + ntfs_attr_search_ctx *ctx; + MFT_RECORD *m; + ATTR_RECORD *a; + int err, mp_size; + u8 b; + + mftbmp_na = vol->mftbmp_na; + lcnbmp_na = vol->lcnbmp_na; + /* + * Determine the last lcn of the mft bitmap. The allocated size of the + * mft bitmap cannot be zero so we are ok to do this. + */ + rl = ntfs_attr_find_vcn(mftbmp_na, (mftbmp_na->allocated_size - 1) >> + vol->cluster_size); + if (!rl || !rl->length || rl->lcn < 0) { + ntfs_error(vol->sb, "Failed to determine last allocated " + "cluster of mft bitmap attribute."); + if (!rl->length || rl->lcn < 0) + errno = EIO; + return -1; + } + lcn = rl->lcn + rl->length; + /* + * Attempt to get the cluster following the last allocated cluster by + * hand as it may be in the MFT zone so the allocator would not give it + * to us. + */ + ll = ntfs_attr_pread(lcnbmp_na, lcn >> 3, 1, &b); + if (ll < 0) { + ntfs_error(vol->sb, "Failed to read from lcn bitmap."); + return -1; + } + ntfs_debug("Read %llu byte%s.", (long long)ll, ll == 1 ? "" : "s"); + *have_allocated_mftbmp = 0; + if (ll == 1 && b != 0xff) { + u8 tb = 1 << (lcn & 7ull); + if (!(b & tb)) { + /* Next cluster is free, allocate it. */ + b |= tb; + ll = ntfs_attr_pwrite(lcnbmp_na, lcn >> 3, 1, &b); + if (ll < 1) { + ntfs_error(vol->sb, "Failed to write to lcn " + "bitmap."); + if (!ll) + errno = EIO; + return -1; + } + /* Update the mft bitmap runlist. */ + rl->length++; + rl[1].vcn++; + *have_allocated_mftbmp |= 1; + ntfs_debug("Appending one cluster to mft bitmap."); + } + } + if (!have_allocated_mftbmp) { + /* Allocate a cluster from the DATA_ZONE. */ + rl2 = ntfs_cluster_alloc(vol, 1, lcn, DATA_ZONE, rl[1].vcn); + if (!rl2) { + ntfs_error(vol->sb, "Failed to allocate a cluster for " + "the mft bitmap."); + return -1; + } + rl = ntfs_runlists_merge(mftbmp_na->rl, rl2); + if (!rl) { + err = errno; + ntfs_error(vol->sb, "Failed to merge runlists for mft " + "bitmap."); + if (ntfs_cluster_free_from_rl(vol, rl2)) + ntfs_error(vol->sb, "Failed to dealocate " + "cluster. Run chkdsk."); + free(rl2); + errno = err; + return -1; + } + mftbmp_na->rl = rl; + *have_allocated_mftbmp |= 2; + ntfs_debug("Adding run to mft bitmap."); + rl = ntfs_attr_find_vcn(mftbmp_na, mftbmp_na->allocated_size >> + vol->cluster_size); + if (!rl || !rl->length) { + ntfs_error(vol->sb, "Failed to determine last " + "allocated cluster of mft bitmap " + "attribute."); + if (!rl->length) + errno = EIO; + return -1; + } + } + /* Update the attribute record as well. */ + ctx = ntfs_attr_get_search_ctx(mftbmp_na->ni, NULL); + if (!ctx) { + ntfs_error(vol->sb, "Failed to get search context."); + return -1; + } + if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, + mftbmp_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { + ntfs_error(vol->sb, "Failed to find last attribute extent of " + "mft bitmap attribute."); + goto put_err_out; + } + m = ctx->mrec; + a = ctx->attr; + ll = sle64_to_cpu(a->lowest_vcn); + rl2 = ntfs_attr_find_vcn(mftbmp_na, ll); + if (!rl2 || !rl2->length) { + ntfs_error(vol->sb, "Failed to determine previous last " + "allocated cluster of mft bitmap attribute."); + if (!rl2->length) + errno = EIO; + goto put_err_out; + } + /* Get the size for the new mapping pairs array for this extent. */ + mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll); + if (mp_size <= 0) { + ntfs_error(vol->sb, "Get size for mapping pairs failed for " + "mft bitmap attribute extent."); + goto put_err_out; + } + /* Expand the attribute record if necessary. */ + if (ntfs_attr_record_resize(m, a, mp_size + + le16_to_cpu(a->mapping_pairs_offset))) { + if (errno != ENOSPC) { + ntfs_error(vol->sb, "Failed to resize " + "attribute record for mft " + "bitmap attribute."); + goto put_err_out; + } + // TODO: Deal with this by moving this extent to a new mft + // record or by starting a new extent in a new mft record. + ntfs_error(vol->sb, "Not enough space in this mft record to " + "accomodate extended mft bitmap attribute " + "extent. Cannot handle this yet."); + errno = ENOTSUP; + goto put_err_out; + } + /* Generate the mapping pairs array directly into the attr record. */ + if (ntfs_mapping_pairs_build(vol, (u8*)a + + le16_to_cpu(a->mapping_pairs_offset), mp_size, rl2, + ll, NULL)) { + ntfs_error(vol->sb, "Failed to build mapping pairs. Run " + "chkdsk."); + errno = EIO; + goto put_err_out; + } + /* Update the highest_vcn. */ + a->highest_vcn = scpu_to_le64(rl[1].vcn - 1); + /* + * We now have extended the mft bitmap allocated_size by one cluster. + * Reflect this in the ntfs_attr structure and the attribute record. + * @rl is the last (non-terminator) runlist element of mft bitmap. + */ + mftbmp_na->allocated_size += vol->cluster_size; + if (a->lowest_vcn) { + /* + * We are not in the first attribute extent, switch to it, but + * first ensure the changes will make it to disk later. + */ + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_attr_reinit_search_ctx(ctx); + if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, + mftbmp_na->name_len, 0, 0, NULL, 0, ctx)) { + ntfs_error(vol->sb, "Failed to find first attribute " + "extent of mft bitmap attribute."); + goto put_err_out; + } + a = ctx->attr; + } + a->allocated_size = scpu_to_le64(mftbmp_na->allocated_size); + /* Ensure the changes make it to disk. */ + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_attr_put_search_ctx(ctx); + return 0; +put_err_out: + err = errno; + ntfs_attr_put_search_ctx(ctx); + errno = err; + return -1; +} + +static inline unsigned int ntfs_ffz(unsigned int word) +{ + return ffs(~word) - 1; +} + /** * ntfs_mft_record_alloc - allocate an mft record on an ntfs volume * @vol: volume on which to allocate the mft record - * @start: starting mft record at which to allocate (or -1 if none) + * @base_ni: open base inode if allocating an extent mft record or NULL * - * Allocate an mft record in $MFT/$DATA starting to search for a free record - * at mft record number @start or at the current allocator position if @start - * is -1, on the mounted ntfs volume @vol. + * Allocate an mft record in $MFT/$DATA of an open ntfs volume @vol. * - * On success return the now opened ntfs inode of the mft record. + * If @base_ni is NULL make the mft record a base mft record and allocate it at + * the default allocator position. + * + * If @base_ni is not NULL make the allocated mft record an extent record, + * allocate it starting at the mft record after the base mft record and attach + * the allocated and opened ntfs inode to the base inode @base_ni. + * + * On success return the now opened ntfs (extent) inode of the mft record. * * On error return NULL with errno set to the error code. * * To find a free mft record, we scan the mft bitmap for a zero bit. To - * optimize this we start scanning at the place specified by @start or if - * @start is -1 we start where we last stopped and we perform wrap around when - * we reach the end. Note, we do not try to allocate mft records below number - * 24 because numbers 0 to 15 are the defined system files anyway and 16 to 24 - * are special in that they are used for storing extension mft records for the - * $DATA attribute of $MFT. This is required to avoid the possibility of - * creating a run list with a circular dependence which once written to disk + * optimize this we start scanning at the place specified by @base_ni or if + * @base_ni is NULL we start where we last stopped and we perform wrap around + * when we reach the end. Note, we do not try to allocate mft records below + * number 24 because numbers 0 to 15 are the defined system files anyway and 16 + * to 24 are special in that they are used for storing extension mft records + * for the $DATA attribute of $MFT. This is required to avoid the possibility + * of creating a run list with a circular dependence which once written to disk * can never be read in again. Windows will only use records 16 to 24 for * normal files if the volume is completely out of space. We never use them * which means that when the volume is really out of space we cannot create any @@ -452,14 +657,625 @@ int ntfs_mft_record_format(const ntfs_volume *vol, const MFT_REF mref) #ifndef PAGE_SIZE #define PAGE_SIZE 4096 #endif -ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, s64 start) +ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) { - ntfs_debug("Entering (start 0x%llx).", (long long)start); - if (!vol || !vol->mft_na || !vol->mftbmp_na || start < -1) { + s64 nr_allocated_mft_records, pass_end, ll, ll2, buf_pos, pass_start; + s64 last_read_pos, bit; + LCN lcn; + ntfs_attr *mft_na, *mftbmp_na, *lcnbmp_na; + u8 *buf, *byte; + runlist_element *rl, *rl2; + ntfs_attr_search_ctx *ctx; + MFT_RECORD *m; + ATTR_RECORD *a; + ntfs_inode *ni; + unsigned long mft_rec_size; + unsigned int size, buf_size; + int err, mp_size; + u16 seq_no; + u8 pass, b, have_allocated_mftbmp = 0; + + if (base_ni) + ntfs_debug("Entering (allocating an extent mft record for " + "base mft record 0x%llx).", + (long long)base_ni->mft_no); + else + ntfs_debug("Entering (allocating a base mft record)."); + if (!vol || !vol->mft_na || !vol->mftbmp_na) { errno = EINVAL; return NULL; } - errno = ENOTSUP; + size = PAGE_SIZE; + if (size < vol->mft_record_size) + size = vol->mft_record_size; + buf = (u8*)malloc(size); + if (!buf) + return NULL; + mft_na = vol->mft_na; + mftbmp_na = vol->mftbmp_na; + lcnbmp_na = vol->lcnbmp_na; + /* Determine the number of allocated mft records in the mft. */ + pass_end = nr_allocated_mft_records = mft_na->allocated_size >> + vol->mft_record_size_bits; + ntfs_debug("nr_allocated_mft_records 0x%llx.", + (long long)nr_allocated_mft_records); + /* Make sure we do not overflow the mft bitmap. */ + ll = mftbmp_na->initialized_size << 3; + if (ll < nr_allocated_mft_records) { + // FIXME: It might be better to extend the bitmap instead. + pass_end = ll; + } + pass = 1; + if (!base_ni) + buf_pos = vol->mft_data_pos; + else + buf_pos = base_ni->mft_no + 1; + if (buf_pos >= pass_end) { + buf_pos = 24; + pass = 2; + } + pass_start = buf_pos; + ntfs_debug("Starting bitmap search: pass %u, pass_start 0x%llx, " + "pass_end = 0x%llx.", pass, (long long)pass_start, + (long long)pass_end); +#ifdef DEBUG + byte = NULL; + b = 0; +#endif + /* Loop until a free mft record is found. */ + size = PAGE_SIZE; + if (size > (ll = nr_allocated_mft_records >> 3)) + size = ll; + for (;; size = PAGE_SIZE) { + last_read_pos = buf_pos >> 3; + ntfs_debug("Before read: mftbmp: allocated_size 0x%llx, " + "data_size 0x%llx, initialized_size 0x%llx.", + (long long)mftbmp_na->allocated_size, + (long long)mftbmp_na->data_size, + (long long)mftbmp_na->initialized_size); + ll = ntfs_attr_pread(mftbmp_na, last_read_pos, size, buf); + if (ll < 0) { + ntfs_error(vol->sb, "Failed to read mft bitmap " + "attribute."); + goto err_out; + } + ntfs_debug("Read 0x%llx bytes.", (long long)ll); + ntfs_debug("After read: mftbmp: allocated_size 0x%llx, " + "data_size = 0x%llx, initialized_size 0x%llx.", + (long long)mftbmp_na->allocated_size, + (long long)mftbmp_na->data_size, + (long long)mftbmp_na->initialized_size); + if (!ll) + goto pass_done; + buf_size = ll << 3; + bit = buf_pos & 7; + buf_pos &= ~7ull; + ntfs_debug("Before for loop: buf_size 0x%x, buf_pos 0x%llx, " + "bit 0x%llx, *byte 0x%x, b %u.", buf_size, + (long long)buf_pos, (long long)bit, + byte ? *byte : -1, b); + for (; bit < buf_size && buf_pos + bit < pass_end; + bit &= ~7ull, bit += 8) { + byte = buf + (bit >> 3); + if (*byte == 0xff) + continue; + /* Note: ffz() result must be zero based. */ + b = ntfs_ffz((unsigned long)*byte); + if (b < 8 && b >= (bit & 7)) { + bit = buf_pos + (bit & ~7ull) + b; + ntfs_debug("Found free rec in for loop, " + "bit 0x%llx.", (long long)bit); + goto found_free_rec; + } + } + ntfs_debug("After for loop: buf_size 0x%x, buf_pos 0x%llx, " + "bit 0x%llx, *byte 0x%x, b %u.", buf_size, + (long long)buf_pos, (long long)bit, + byte ? *byte : -1, b); + buf_pos += buf_size; + if (buf_pos < pass_end) + continue; +pass_done: + /* Finished with the current pass. */ + ntfs_debug("At pass_done."); + if (pass == 1) { + /* + * Now do pass 2, scanning the first part of the zone + * we omitted in pass 1. + */ + ntfs_debug("Done pass 1, switching to pass 2."); + pass = 2; + pass_end = pass_start; + buf_pos = pass_start = 24; + ntfs_debug("pass %i, pass_start 0x%llx, " + "pass_end 0x%llx.", pass, + (long long)pass_start, + (long long)pass_end); + continue; + } /* pass == 2 */ + /* No free records left. */ + if (mftbmp_na->initialized_size << 3 > + nr_allocated_mft_records && + mftbmp_na->initialized_size > 3) { + /* + * The mft bitmap is already bigger but the space is + * not covered by mft records, this implies that the + * next records are all free, so we already have found + * a free record. + */ + bit = nr_allocated_mft_records; + if (bit < 24) + bit = 24; + ntfs_debug("Found free record bit (#1) 0x%llx.", + (long long)bit); + goto found_free_rec; + } + ntfs_debug("Done pass 2."); + ntfs_debug("Status of mftbmp: allocated_size 0x%llx, " + "data_size 0x%llx, initialized_size 0x%llx.", + (long long)mftbmp_na->allocated_size, + (long long)mftbmp_na->data_size, + (long long)mftbmp_na->initialized_size); + if (mftbmp_na->initialized_size + 8 > + mftbmp_na->allocated_size) { + /* Need to extend bitmap by one more cluster. */ + ntfs_debug("mftbmp: initialized_size + 8 > " + "allocated_size."); + if (ntfs_mft_bitmap_extend_by_one_cluster(vol, + &have_allocated_mftbmp)) + goto err_out; + ntfs_debug("New status of mftbmp: allocated_size " + "0x%llx, data_size 0x%llx, " + "initialized_size 0x%llx.", + (long long)mftbmp_na->allocated_size, + (long long)mftbmp_na->data_size, + (long long)mftbmp_na->initialized_size); + } + /* + * We now have sufficient allocated space, extend the + * initialized_size as well as the data_size if necessary. + */ + ctx = ntfs_attr_get_search_ctx(mftbmp_na->ni, NULL); + if (!ctx) { + ntfs_error(vol->sb, "Failed to get search context."); + goto err_out; + } + if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, + mftbmp_na->name_len, 0, 0, NULL, 0, ctx)) { + ntfs_error(vol->sb, "Failed to find first attribute " + "extent of mft bitmap attribute."); + goto put_err_out; + } + a = ctx->attr; + buf_pos = mftbmp_na->initialized_size; + mftbmp_na->initialized_size += 8; + a->initialized_size = scpu_to_le64(mftbmp_na->initialized_size); + if (mftbmp_na->initialized_size > mftbmp_na->data_size) { + mftbmp_na->data_size = mftbmp_na->initialized_size; + a->data_size = scpu_to_le64(mftbmp_na->data_size); + } + /* Ensure the changes make it to disk. */ + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_attr_put_search_ctx(ctx); + ntfs_debug("New status of mftbmp: allocated_size 0x%llx, " + "data_size 0x%llx, initialized_size 0x%llx.", + (long long)mftbmp_na->allocated_size, + (long long)mftbmp_na->data_size, + (long long)mftbmp_na->initialized_size); + have_allocated_mftbmp |= 4; + /* Initialize the mft bitmap attribute value with zeroes. */ + memset(buf, 0, 8); + ll = ntfs_attr_pwrite(mftbmp_na, buf_pos, 8, buf); + if (ll < 8) { + ntfs_error(vol->sb, "Failed to write to mft bitmap."); + if (ll >= 0) + errno = EIO; + goto shrink_mftbmp_err_out; + } + ntfs_debug("Wrote eight initialized bytes to mft bitmap."); + bit = buf_pos << 3; + ntfs_debug("Found free record bit (#2) 0x%llx.", + (long long)bit); + /* goto found_free_rec; */ + break; + } +found_free_rec: + /* @bit is the found free mft record, allocate it in the mft bitmap. */ + vol->mft_data_pos = bit; + ntfs_debug("At found_free_rec."); + ll = ntfs_attr_pread(mftbmp_na, bit >> 3, 1, buf); + if (ll < 1) { + ntfs_error(vol->sb, "Failed to read from mft bitmap."); + if (!ll) + errno = EIO; + goto shrink_mftbmp_err_out; + } + ntfs_debug("Read 1 byte from mft bitmap."); + /* Check our bit is really zero and set it. */ + b = 1 << (bit & 7); + //BUG_ON(*buf & b); + if (*buf & b) + NTFS_BUG("Bit in mft bitmap is not zero!"); + *buf |= b; + ll = ntfs_attr_pwrite(mftbmp_na, bit >> 3, 1, buf); + if (ll < 1) { + if (!ll) + errno = EIO; + goto shrink_mftbmp_err_out; + } + ntfs_debug("Wrote 1 byte to mft bitmap."); + /* The mft bitmap is now uptodate. Deal with mft data attribute now. */ + ll = (bit + 1) << vol->mft_record_size_bits; + if (ll <= mft_na->initialized_size) { + /* The allocated record is already initialized. We are done! */ + ntfs_debug("Allocated mft record already initialized!"); + goto mft_rec_already_initialized; + } + ntfs_debug("Allocated mft record needs to be initialized."); + /* The mft record is outside the initialized data. */ + mft_rec_size = vol->mft_record_size; + /* Preserve old values for undo purposes. */ +//FIXME: +// s64 old_data_allocated; +// LCN old_data_len; +// int old_data_rlen; +// old_data_allocated = mft_na->allocated_size; +// old_data_rlen = mft_na->d.r.len - 1; +// old_data_len = mft_na->d.r.runlist[old_data_rlen].len; + /* + * If necessary, extend the mft until it covers the allocated record. + * The loop is only actually used when a freshly formatted volume is + * first written to so it optimizes away nicely in the common case. + */ + while (ll > mft_na->allocated_size) { + s64 nr, min_nr; + + ntfs_debug("Extending mft data allocation, status of mft " + "data: allocated_size 0x%llx, " + "data_size 0x%llx, initialized_size 0x%llx.", + (long long)mft_na->allocated_size, + (long long)mft_na->data_size, + (long long)mft_na->initialized_size); + /* + * Determine the preferred allocation location, i.e. the last + * lcn of the mft data attribute. The allocated size of the + * mft data attribute cannot be zero so we are ok to do this. + */ + rl = ntfs_attr_find_vcn(mft_na, (mft_na->allocated_size - 1) >> + vol->cluster_size); + if (!rl || !rl->length || rl->lcn < 0) { + ntfs_error(vol->sb, "Failed to determine last " + "allocated cluster of mft data " + "attribute."); + if (!rl->length || rl->lcn < 0) + errno = EIO; + goto undo_mftbmp_alloc_err_out; + } + lcn = rl->lcn + rl->length; + ntfs_debug("Last lcn of mft data attribute is 0x%llx.", + (long long)lcn); + /* Minimum allocation is one mft record worth of clusters. */ + if (mft_rec_size <= vol->cluster_size) + min_nr = 1; + else + min_nr = mft_rec_size >> vol->cluster_size_bits; + /* Want to allocate 16 mft records worth of clusters. */ + nr = mft_rec_size << 4 >> vol->cluster_size_bits; + if (!nr) + nr = 1; + ntfs_debug("Trying mft data allocation with default " + "cluster count %lli.", (long long)nr); +retry_mft_data_allocation: + rl2 = ntfs_cluster_alloc(vol, nr, lcn, MFT_ZONE, rl[1].vcn); + if (!rl2) { + /* + * There is not enough space to do the allocation, but + * there might be enough space to do a minimal + * allocation so try that before failing. + */ + if (errno == ENOSPC && nr > min_nr) { + nr = min_nr; + ntfs_debug("Retrying mft data allocation with " + "minimal cluster count %lli.", + (long long)nr); + goto retry_mft_data_allocation; + } + ntfs_error(vol->sb, "Failed to allocate a cluster for " + "the mft data attribute."); + goto undo_mftbmp_alloc_err_out; + } + rl = ntfs_runlists_merge(mft_na->rl, rl2); + if (!rl) { + err = errno; + ntfs_error(vol->sb, "Failed to merge runlists for mft " + "data attribute."); + if (ntfs_cluster_free_from_rl(vol, rl2)) + ntfs_error(vol->sb, "Failed to dealocate " + "clusters. Run chkdsk."); + free(rl2); + errno = err; + goto undo_mftbmp_alloc_err_out; + } + mft_na->rl = rl; + ntfs_debug("Allocated %lli clusters starting.", nr); + /* Determine the last lcn of the mft data attribute. */ + rl = ntfs_attr_find_vcn(mft_na, (mft_na->allocated_size - 1) >> + vol->cluster_size); + if (!rl || !rl->length || rl->lcn < 0) { + ntfs_error(vol->sb, "Failed to determine last " + "allocated cluster of mft data " + "attribute."); + if (!rl->length || rl->lcn < 0) + errno = EIO; + // FIXME: Truncate mft_na->rl back to the old state and + // release the clusters. + goto undo_mftbmp_alloc_err_out; + } + lcn = rl->lcn + rl->length; + /* Update the attribute record as well. */ + ctx = ntfs_attr_get_search_ctx(mft_na->ni, NULL); + if (!ctx) { + ntfs_error(vol->sb, "Failed to get search context."); + goto trunc_mft_rl_shrink_mftbmp_alloc_err_out; + } + if (ntfs_attr_lookup(mft_na->type, mft_na->name, + mft_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { + ntfs_error(vol->sb, "Failed to find last attribute " + "extent of mft data attribute."); + goto put_err_out; + } + m = ctx->mrec; + a = ctx->attr; + ll2 = sle64_to_cpu(a->lowest_vcn); + rl2 = ntfs_attr_find_vcn(mft_na, ll2); + if (!rl2 || !rl2->length) { + ntfs_error(vol->sb, "Failed to determine previous " + "last allocated cluster of mft data " + "attribute."); + if (!rl2->length) + errno = EIO; + goto put_err_out; + } + /* + * Get the size for the new mapping pairs array for this + * extent. + */ + mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll2); + if (mp_size <= 0) { + ntfs_error(vol->sb, "Get size for mapping pairs " + "failed for mft bitmap attribute " + "extent."); + goto put_err_out; + } + /* Expand the attribute record if necessary. */ + if (ntfs_attr_record_resize(m, a, mp_size + + le16_to_cpu(a->mapping_pairs_offset))) { + if (errno != ENOSPC) { + ntfs_error(vol->sb, "Failed to resize " + "attribute record for mft " + "data attribute."); + goto put_err_out; + } + // TODO: Deal with this by moving this extent to a new + // mft record or by starting a new extent in a new mft + // record. Note: Use the special reserved mft records + // and ensure that this extent is not required to find + // the mft record in question. + ntfs_error(vol->sb, "Not enough space in this mft " + "record to accomodate extended mft " + "data attribute extent. Cannot " + "handle this yet."); + errno = ENOTSUP; + goto put_err_out; + } + /* + * Generate the mapping pairs array directly into the attribute + * record. + */ + if (ntfs_mapping_pairs_build(vol, (u8*)a + + le16_to_cpu(a->mapping_pairs_offset), mp_size, + rl2, ll2, NULL)) { + ntfs_error(vol->sb, "Failed to build mapping pairs. " + "Run chkdsk."); + errno = EIO; + goto put_err_out; + } + /* Update the highest_vcn. */ + a->highest_vcn = scpu_to_le64(rl[1].vcn - 1); + /* + * We now have extended the mft data allocated_size by nr + * clusters. Reflect this in the ntfs_attr structure and the + * attribute record. @rl is the last (non-terminator) runlist + * element of mft data attribute. + */ + mft_na->allocated_size += nr << vol->cluster_size_bits; + if (a->lowest_vcn) { + /* + * We are not in the first attribute extent, switch to + * it, but first ensure the changes will make it to + * disk later. + */ + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_attr_reinit_search_ctx(ctx); + if (ntfs_attr_lookup(mft_na->type, mft_na->name, + mft_na->name_len, 0, 0, NULL, 0, ctx)) { + ntfs_error(vol->sb, "Failed to find first " + "attribute extent of mft data " + "attribute."); + goto put_err_out; + } + a = ctx->attr; + } + a->allocated_size = scpu_to_le64(mft_na->allocated_size); + /* Ensure the changes make it to disk. */ + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_attr_put_search_ctx(ctx); + ntfs_debug("After extending mft data allocation, status of " + "mft data: allocated_size 0x%llx, " + "data_size 0x%llx, initialized_size 0x%llx.", + (long long)mft_na->allocated_size, + (long long)mft_na->data_size, + (long long)mft_na->initialized_size); + } +// s64 old_data_initialized, old_data_size; +// old_data_initialized = mft_na->initialized_size; +// old_data_size = mft_na->data_size; + /* + * Extend mft data initialized size (and data size of course) to reach + * the allocated mft record formatting the mft records allong the way. + */ + while (ll > mft_na->initialized_size) { + ll2 = mft_na->initialized_size >> vol->mft_record_size_bits; + mft_na->initialized_size += vol->mft_record_size; + if (mft_na->initialized_size > mft_na->data_size) + mft_na->data_size = mft_na->initialized_size; + ntfs_debug("Initializing mft record 0x%llx.", ll2); + err = ntfs_mft_record_format(vol, ll2); + if (err) { + ntfs_error(vol->sb, "Failed to format mft record."); + goto undo_data_init_err_out; + } + } + /* Update the mft data attribute record to reflect the new sizes. */ + ctx = ntfs_attr_get_search_ctx(mft_na->ni, NULL); + if (!ctx) { + ntfs_error(vol->sb, "Failed to get search context."); + goto undo_data_init_err_out; + } + if (ntfs_attr_lookup(mft_na->type, mft_na->name, mft_na->name_len, 0, + 0, NULL, 0, ctx)) { + ntfs_error(vol->sb, "Failed to find first attribute extent of " + "mft data attribute."); + goto put_undo_data_init_err_out; + } + a = ctx->attr; + a->initialized_size = scpu_to_le64(mft_na->initialized_size); + a->data_size = scpu_to_le64(mft_na->data_size); + /* Ensure the changes make it to disk. */ + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_attr_put_search_ctx(ctx); + ntfs_debug("After mft record initialization, status of mft data: " + "allocated_size 0x%llx, data_size 0x%llx, " + "initialized_size 0x%llx.", + (long long)mft_na->allocated_size, + (long long)mft_na->data_size, + (long long)mft_na->initialized_size); + /* Sanity checks. */ + if (mft_na->data_size > mft_na->allocated_size || + mft_na->initialized_size > mft_na->data_size) + NTFS_BUG("mft_na sanity checks failed"); + // BUG_ON(mft_na->initialized_size > mft_na->data_size); + // BUG_ON(mft_na->data_size > mft_na->allocated_size); +mft_rec_already_initialized: + /* + * We now have allocated and initialized the mft record. Need to read + * it from disk and re-format it. + */ + m = (MFT_RECORD*)malloc(vol->mft_record_size); + if (!m) { + ntfs_error(vol->sb, "Failed to allocate buffer for mft " + "record."); + goto undo_mrec_alloc_init_err_out; + } + if (ntfs_mft_record_read(vol, bit, m)) { + ntfs_error(vol->sb, "Failed to read mft record."); + goto undo_mrec_alloc_init_err_out; + } + /* Preserve the sequence number if it is not zero. */ + seq_no = m->sequence_number; + if (ntfs_mft_record_layout(vol, bit, m)) { + ntfs_error(vol->sb, "Failed to re-format mft record."); + goto undo_mrec_alloc_init_err_out; + } + if (le16_to_cpu(seq_no)) + m->sequence_number = seq_no; + /* Set the mft record itself in use. */ + m->flags |= MFT_RECORD_IN_USE; + /* Now need to open an ntfs inode for the mft record. */ + ni = ntfs_inode_allocate(vol); + if (!ni) { + ntfs_error(vol->sb, "Failed to allocate buffer for inode."); + goto undo_mrec_alloc_init_err_out; + } + ni->mft_no = bit; + ni->mrec = m; + /* + * If we are allocating an extent mft record, make the opened inode an + * extent inode and attach it to the base inode. + */ + if (base_ni) { + ni->nr_extents = -1; + ni->base_ni = base_ni; + /* + * Attach extent inode to base inode, reallocating memory if + * needed. + */ + if (!(base_ni->nr_extents & 3)) { + ntfs_inode **extent_nis; + int i; + + i = (base_ni->nr_extents + 4) * sizeof(ntfs_inode *); + extent_nis = (ntfs_inode**)malloc(i); + if (!extent_nis) + goto release_mrec_alloc_init_err_out; + if (base_ni->extent_nis) { + memcpy(extent_nis, base_ni->extent_nis, + i - 4 * sizeof(ntfs_inode *)); + free(base_ni->extent_nis); + } + base_ni->extent_nis = extent_nis; + } + base_ni->extent_nis[base_ni->nr_extents++] = ni; + } + /* Make sure the allocated inode is written out to disk. */ + ntfs_inode_mark_dirty(ni); + /* Update the default mft allocation position if it was used. */ + if (!base_ni) + vol->mft_data_pos = bit + 1; + /* Return the opened, allocated inode of the allocated mft record. */ + ntfs_debug("Returning opened, allocated %sinode 0x%llx.", + base_ni ? "extent " : "", (long long)bit); + free(buf); + return ni; + +release_mrec_alloc_init_err_out: + err = errno; + free(ni); + errno = err; + +undo_mrec_alloc_init_err_out: + err = errno; + free(m); + errno = err; + goto undo_data_init_err_out; + +put_undo_data_init_err_out: + err = errno; + ntfs_attr_put_search_ctx(ctx); + errno = err; + +undo_data_init_err_out: + goto trunc_mft_rl_shrink_mftbmp_alloc_err_out; + +put_err_out: + err = errno; + ntfs_attr_put_search_ctx(ctx); + errno = err; + + +trunc_mft_rl_shrink_mftbmp_alloc_err_out: + +undo_mftbmp_alloc_err_out: + +shrink_mftbmp_err_out: + +err_out: + err = errno; + free(buf); + if (err) + errno = err; + else + errno = EIO; return NULL; } From b627f802bd28e2626add877741c9e05192c2dbe2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Sep 2004 14:44:01 +0000 Subject: [PATCH 1854/2994] First cut of ntfs_mft_record_alloc() ported from my old ntfs allocator that I wrote several years ago. Note this is completely untested and there is no error handling at all yet. I will be porting/adding the error handling next. (Anton) BKrev: 4145b231iWDh2kpXUh1ulPv001Mm2w From e74eeb2c0b219259da0ecd5cec6d52d56c641442 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 13 Sep 2004 14:44:01 +0000 Subject: [PATCH 1855/2994] Update ntfs_mft_record_alloc() prototype to reflect reality. (Logical change 1.551) --- include/ntfs/mft.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ntfs/mft.h b/include/ntfs/mft.h index 0ece8c95..4d842949 100644 --- a/include/ntfs/mft.h +++ b/include/ntfs/mft.h @@ -106,7 +106,7 @@ extern int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref, extern int ntfs_mft_record_format(const ntfs_volume *vol, const MFT_REF mref); -extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, s64 start); +extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni); extern int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni); From 0de81b2f415f6bbb3a412bb2dbb26c4ef4fea365 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 14 Sep 2004 13:01:33 +0000 Subject: [PATCH 1856/2994] More work on ntfs_mft_record_alloc(): Factor out some code, start with some error handling and a bug fix here or there... (Logical change 1.552) --- libntfs/mft.c | 664 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 425 insertions(+), 239 deletions(-) diff --git a/libntfs/mft.c b/libntfs/mft.c index 7e6b133e..41a0af6f 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -372,26 +372,36 @@ int ntfs_mft_record_format(const ntfs_volume *vol, const MFT_REF mref) return 0; } +static const char *es = " Leaving inconsistent metadata. Run chkdsk."; + /** - * ntfs_mft_bitmap_extend_and_allocate_one - + * ntfs_mft_bitmap_extend_allocation - extend mft bitmap attribute by a cluster + * @vol: volume on which to extend the mft bitmap attribute * - * Extend the mft bitmap attribute by one cluster. + * Extend the mft bitmap attribute on the ntfs volume @vol by one cluster. * - * Note: Only updates allocated_size, i.e. does not update initialized_size or + * Note: Only changes allocated_size, i.e. does not touch initialized_size or * data_size. + * + * Return 0 on success and -1 on error with errno set to the error code. */ -static int ntfs_mft_bitmap_extend_by_one_cluster(ntfs_volume *vol, - u8 *have_allocated_mftbmp) +static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) { LCN lcn; - s64 ll; + s64 ll = 0; /* silence compiler warning */ ntfs_attr *mftbmp_na, *lcnbmp_na; - runlist_element *rl, *rl2; + runlist_element *rl, *rl2 = NULL; /* silence compiler warning */ ntfs_attr_search_ctx *ctx; - MFT_RECORD *m; - ATTR_RECORD *a; - int err, mp_size; - u8 b; + MFT_RECORD *m = NULL; /* silence compiler warning */ + ATTR_RECORD *a = NULL; /* silence compiler warning */ + int ret, mp_size; + u32 old_alen = 0; /* silence compiler warning */ + u8 b, tb; + struct { + u8 added_cluster:1; + u8 added_run:1; + u8 mp_rebuilt:1; + } status = { 0, 0, 0 }; mftbmp_na = vol->mftbmp_na; lcnbmp_na = vol->lcnbmp_na; @@ -404,7 +414,7 @@ static int ntfs_mft_bitmap_extend_by_one_cluster(ntfs_volume *vol, if (!rl || !rl->length || rl->lcn < 0) { ntfs_error(vol->sb, "Failed to determine last allocated " "cluster of mft bitmap attribute."); - if (!rl->length || rl->lcn < 0) + if (rl) errno = EIO; return -1; } @@ -414,34 +424,30 @@ static int ntfs_mft_bitmap_extend_by_one_cluster(ntfs_volume *vol, * hand as it may be in the MFT zone so the allocator would not give it * to us. */ - ll = ntfs_attr_pread(lcnbmp_na, lcn >> 3, 1, &b); - if (ll < 0) { + ret = (int)ntfs_attr_pread(lcnbmp_na, lcn >> 3, 1, &b); + if (ret < 0) { ntfs_error(vol->sb, "Failed to read from lcn bitmap."); return -1; } - ntfs_debug("Read %llu byte%s.", (long long)ll, ll == 1 ? "" : "s"); - *have_allocated_mftbmp = 0; - if (ll == 1 && b != 0xff) { - u8 tb = 1 << (lcn & 7ull); - if (!(b & tb)) { - /* Next cluster is free, allocate it. */ - b |= tb; - ll = ntfs_attr_pwrite(lcnbmp_na, lcn >> 3, 1, &b); - if (ll < 1) { - ntfs_error(vol->sb, "Failed to write to lcn " - "bitmap."); - if (!ll) - errno = EIO; - return -1; - } - /* Update the mft bitmap runlist. */ - rl->length++; - rl[1].vcn++; - *have_allocated_mftbmp |= 1; - ntfs_debug("Appending one cluster to mft bitmap."); + ntfs_debug("Read %i byte%s.", ret, ret == 1 ? "" : "s"); + tb = 1 << (lcn & 7ull); + if (ret == 1 && b != 0xff && !(b & tb)) { + /* Next cluster is free, allocate it. */ + b |= tb; + ret = (int)ntfs_attr_pwrite(lcnbmp_na, lcn >> 3, 1, &b); + if (ret < 1) { + ntfs_error(vol->sb, "Failed to write to lcn " + "bitmap."); + if (!ret) + errno = EIO; + return -1; } - } - if (!have_allocated_mftbmp) { + /* Update the mft bitmap runlist. */ + rl->length++; + rl[1].vcn++; + status.added_cluster = 1; + ntfs_debug("Appending one cluster to mft bitmap."); + } else { /* Allocate a cluster from the DATA_ZONE. */ rl2 = ntfs_cluster_alloc(vol, 1, lcn, DATA_ZONE, rl[1].vcn); if (!rl2) { @@ -451,41 +457,37 @@ static int ntfs_mft_bitmap_extend_by_one_cluster(ntfs_volume *vol, } rl = ntfs_runlists_merge(mftbmp_na->rl, rl2); if (!rl) { - err = errno; + ret = errno; ntfs_error(vol->sb, "Failed to merge runlists for mft " "bitmap."); if (ntfs_cluster_free_from_rl(vol, rl2)) ntfs_error(vol->sb, "Failed to dealocate " - "cluster. Run chkdsk."); + "cluster.%s", es); free(rl2); - errno = err; + errno = ret; return -1; } mftbmp_na->rl = rl; - *have_allocated_mftbmp |= 2; - ntfs_debug("Adding run to mft bitmap."); - rl = ntfs_attr_find_vcn(mftbmp_na, mftbmp_na->allocated_size >> - vol->cluster_size); - if (!rl || !rl->length) { - ntfs_error(vol->sb, "Failed to determine last " - "allocated cluster of mft bitmap " - "attribute."); - if (!rl->length) - errno = EIO; - return -1; - } + status.added_run = 1; + ntfs_debug("Adding one run to mft bitmap."); + /* Find the last run in the new runlist. */ + for (rl = mftbmp_na->rl; rl[1].length; rl++) + ; } - /* Update the attribute record as well. */ + /* + * Update the attribute record as well. Note: @rl is the last + * (non-terminator) runlist element of mft bitmap. + */ ctx = ntfs_attr_get_search_ctx(mftbmp_na->ni, NULL); if (!ctx) { ntfs_error(vol->sb, "Failed to get search context."); - return -1; + goto undo_alloc; } if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, mftbmp_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { ntfs_error(vol->sb, "Failed to find last attribute extent of " "mft bitmap attribute."); - goto put_err_out; + goto undo_alloc; } m = ctx->mrec; a = ctx->attr; @@ -494,25 +496,25 @@ static int ntfs_mft_bitmap_extend_by_one_cluster(ntfs_volume *vol, if (!rl2 || !rl2->length) { ntfs_error(vol->sb, "Failed to determine previous last " "allocated cluster of mft bitmap attribute."); - if (!rl2->length) + if (rl2) errno = EIO; - goto put_err_out; + goto undo_alloc; } /* Get the size for the new mapping pairs array for this extent. */ mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll); if (mp_size <= 0) { ntfs_error(vol->sb, "Get size for mapping pairs failed for " "mft bitmap attribute extent."); - goto put_err_out; + goto undo_alloc; } /* Expand the attribute record if necessary. */ + old_alen = le32_to_cpu(a->length); if (ntfs_attr_record_resize(m, a, mp_size + le16_to_cpu(a->mapping_pairs_offset))) { if (errno != ENOSPC) { - ntfs_error(vol->sb, "Failed to resize " - "attribute record for mft " - "bitmap attribute."); - goto put_err_out; + ntfs_error(vol->sb, "Failed to resize attribute " + "record for mft bitmap attribute."); + goto undo_alloc; } // TODO: Deal with this by moving this extent to a new mft // record or by starting a new extent in a new mft record. @@ -520,25 +522,23 @@ static int ntfs_mft_bitmap_extend_by_one_cluster(ntfs_volume *vol, "accomodate extended mft bitmap attribute " "extent. Cannot handle this yet."); errno = ENOTSUP; - goto put_err_out; + goto undo_alloc; } + status.mp_rebuilt = 1; /* Generate the mapping pairs array directly into the attr record. */ if (ntfs_mapping_pairs_build(vol, (u8*)a + - le16_to_cpu(a->mapping_pairs_offset), mp_size, rl2, - ll, NULL)) { - ntfs_error(vol->sb, "Failed to build mapping pairs. Run " - "chkdsk."); + le16_to_cpu(a->mapping_pairs_offset), mp_size, rl2, ll, + NULL)) { + ntfs_error(vol->sb, "Failed to build mapping pairs."); errno = EIO; - goto put_err_out; + goto undo_alloc; } /* Update the highest_vcn. */ a->highest_vcn = scpu_to_le64(rl[1].vcn - 1); /* * We now have extended the mft bitmap allocated_size by one cluster. * Reflect this in the ntfs_attr structure and the attribute record. - * @rl is the last (non-terminator) runlist element of mft bitmap. */ - mftbmp_na->allocated_size += vol->cluster_size; if (a->lowest_vcn) { /* * We are not in the first attribute extent, switch to it, but @@ -550,18 +550,155 @@ static int ntfs_mft_bitmap_extend_by_one_cluster(ntfs_volume *vol, mftbmp_na->name_len, 0, 0, NULL, 0, ctx)) { ntfs_error(vol->sb, "Failed to find first attribute " "extent of mft bitmap attribute."); - goto put_err_out; + goto restore_undo_alloc; } a = ctx->attr; } + mftbmp_na->allocated_size += vol->cluster_size; a->allocated_size = scpu_to_le64(mftbmp_na->allocated_size); /* Ensure the changes make it to disk. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); return 0; -put_err_out: - err = errno; +restore_undo_alloc: + ret = errno; + ntfs_attr_reinit_search_ctx(ctx); + if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, + mftbmp_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { + ntfs_error(vol->sb, "Failed to find last attribute extent of " + "mft bitmap attribute.%s", es); + ntfs_attr_put_search_ctx(ctx); + mftbmp_na->allocated_size += vol->cluster_size; + /* + * The only thing that is now wrong is ->allocated_size of the + * base attribute extent which chkdsk should be able to fix. + */ + errno = ret; + return -1; + } + m = ctx->mrec; + a = ctx->attr; + a->highest_vcn = scpu_to_le64(rl[1].vcn - 2); + errno = ret; +undo_alloc: + ret = errno; + if (status.added_cluster) { + /* Truncate the last run in the runlist by one cluster. */ + rl->length--; + rl[1].vcn--; + } else if (status.added_run) { + lcn = rl->lcn; + /* Remove the last run from the runlist. */ + rl->lcn = rl[1].lcn; + rl->length = 0; + } + /* Deallocate the cluster. */ + if (ntfs_bitmap_clear_bit(lcnbmp_na, lcn)) + ntfs_error(vol->sb, "Failed to free cluster.%s", es); + if (status.mp_rebuilt) { + if (ntfs_mapping_pairs_build(vol, (u8*)a + + le16_to_cpu(a->mapping_pairs_offset), + old_alen - le16_to_cpu(a->mapping_pairs_offset), + rl2, ll, NULL)) + ntfs_error(vol->sb, "Failed to restore mapping " + "pairs array.%s", es); + if (ntfs_attr_record_resize(m, a, old_alen)) + ntfs_error(vol->sb, "Failed to restore attribute " + "record.%s", + es); + ntfs_inode_mark_dirty(ctx->ntfs_ino); + } + if (ctx) + ntfs_attr_put_search_ctx(ctx); + errno = ret; + return -1; +} + +/** + * ntfs_mft_bitmap_extend_initialized - extend mft bitmap initialized data + * @vol: volume on which to extend the mft bitmap attribute + * + * Extend the initialized portion of the mft bitmap attribute on the ntfs + * volume @vol by 8 bytes. + * + * Note: Only changes initialized_size and data_size, i.e. requires that + * allocated_size is big enough to fit the new initialized_size. + * + * Return 0 on success and -1 on error with errno set to the error code. + */ +static int ntfs_mft_bitmap_extend_initialized(ntfs_volume *vol) +{ + s64 old_data_size, old_initialized_size, ll; + ntfs_attr *mftbmp_na; + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + int err; + + mftbmp_na = vol->mftbmp_na; + ctx = ntfs_attr_get_search_ctx(mftbmp_na->ni, NULL); + if (!ctx) { + ntfs_error(vol->sb, "Failed to get search context."); + return -1; + } + if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, + mftbmp_na->name_len, 0, 0, NULL, 0, ctx)) { + ntfs_error(vol->sb, "Failed to find first attribute extent of " + "mft bitmap attribute."); + err = errno; + goto put_err_out; + } + a = ctx->attr; + old_data_size = mftbmp_na->data_size; + old_initialized_size = mftbmp_na->initialized_size; + mftbmp_na->initialized_size += 8; + a->initialized_size = scpu_to_le64(mftbmp_na->initialized_size); + if (mftbmp_na->initialized_size > mftbmp_na->data_size) { + mftbmp_na->data_size = mftbmp_na->initialized_size; + a->data_size = scpu_to_le64(mftbmp_na->data_size); + } + /* Ensure the changes make it to disk. */ + ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); + /* Initialize the mft bitmap attribute value with zeroes. */ + ll = 0; + ll = ntfs_attr_pwrite(mftbmp_na, old_initialized_size, 8, &ll); + if (ll == 8) { + ntfs_debug("Wrote eight initialized bytes to mft bitmap."); + return 0; + } + ntfs_error(vol->sb, "Failed to write to mft bitmap."); + err = errno; + if (ll >= 0) + err = EIO; + /* Try to recover from the error. */ + ctx = ntfs_attr_get_search_ctx(mftbmp_na->ni, NULL); + if (!ctx) { + ntfs_error(vol->sb, "Failed to get search context.%s", es); + goto err_out; + } + if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, + mftbmp_na->name_len, 0, 0, NULL, 0, ctx)) { + ntfs_error(vol->sb, "Failed to find first attribute extent of " + "mft bitmap attribute.%s", es); +put_err_out: + ntfs_attr_put_search_ctx(ctx); + goto err_out; + } + a = ctx->attr; + mftbmp_na->initialized_size = old_initialized_size; + a->initialized_size = scpu_to_le64(old_initialized_size); + if (mftbmp_na->data_size != old_data_size) { + mftbmp_na->data_size = old_data_size; + a->data_size = scpu_to_le64(old_data_size); + } + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_attr_put_search_ctx(ctx); + ntfs_debug("Restored status of mftbmp: allocated_size 0x%llx, " + "data_size 0x%llx, initialized_size 0x%llx.", + (long long)mftbmp_na->allocated_size, + (long long)mftbmp_na->data_size, + (long long)mftbmp_na->initialized_size); +err_out: errno = err; return -1; } @@ -659,10 +796,10 @@ static inline unsigned int ntfs_ffz(unsigned int word) #endif ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) { - s64 nr_allocated_mft_records, pass_end, ll, ll2, buf_pos, pass_start; + s64 nr_allocated_mft_records, pass_end, ll, ll2, data_pos, pass_start; s64 last_read_pos, bit; LCN lcn; - ntfs_attr *mft_na, *mftbmp_na, *lcnbmp_na; + ntfs_attr *mft_na, *mftbmp_na; u8 *buf, *byte; runlist_element *rl, *rl2; ntfs_attr_search_ctx *ctx; @@ -673,7 +810,7 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) unsigned int size, buf_size; int err, mp_size; u16 seq_no; - u8 pass, b, have_allocated_mftbmp = 0; + u8 pass, b; if (base_ni) ntfs_debug("Entering (allocating an extent mft record for " @@ -693,192 +830,162 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) return NULL; mft_na = vol->mft_na; mftbmp_na = vol->mftbmp_na; - lcnbmp_na = vol->lcnbmp_na; /* Determine the number of allocated mft records in the mft. */ - pass_end = nr_allocated_mft_records = mft_na->allocated_size >> + nr_allocated_mft_records = mft_na->allocated_size >> vol->mft_record_size_bits; ntfs_debug("nr_allocated_mft_records 0x%llx.", (long long)nr_allocated_mft_records); - /* Make sure we do not overflow the mft bitmap. */ + /* + * Set the end of the pass making sure we do not overflow the mft + * bitmap. + */ + pass_end = nr_allocated_mft_records; ll = mftbmp_na->initialized_size << 3; - if (ll < nr_allocated_mft_records) { - // FIXME: It might be better to extend the bitmap instead. + if (pass_end > ll) pass_end = ll; - } pass = 1; if (!base_ni) - buf_pos = vol->mft_data_pos; + data_pos = vol->mft_data_pos; else - buf_pos = base_ni->mft_no + 1; - if (buf_pos >= pass_end) { - buf_pos = 24; + data_pos = base_ni->mft_no + 1; + if (data_pos >= pass_end) { + data_pos = 24; pass = 2; } - pass_start = buf_pos; + pass_start = data_pos; ntfs_debug("Starting bitmap search: pass %u, pass_start 0x%llx, " - "pass_end = 0x%llx.", pass, (long long)pass_start, - (long long)pass_end); + "pass_end 0x%llx, data_pos 0x%llx.", pass, + (long long)pass_start, (long long)pass_end, + (long long)data_pos); #ifdef DEBUG byte = NULL; b = 0; #endif /* Loop until a free mft record is found. */ size = PAGE_SIZE; - if (size > (ll = nr_allocated_mft_records >> 3)) + ll = nr_allocated_mft_records >> 3; + if (size > ll) size = ll; for (;; size = PAGE_SIZE) { - last_read_pos = buf_pos >> 3; - ntfs_debug("Before read: mftbmp: allocated_size 0x%llx, " - "data_size 0x%llx, initialized_size 0x%llx.", - (long long)mftbmp_na->allocated_size, - (long long)mftbmp_na->data_size, - (long long)mftbmp_na->initialized_size); + last_read_pos = data_pos >> 3; ll = ntfs_attr_pread(mftbmp_na, last_read_pos, size, buf); if (ll < 0) { ntfs_error(vol->sb, "Failed to read mft bitmap " - "attribute."); + "attribute, aborting."); goto err_out; } ntfs_debug("Read 0x%llx bytes.", (long long)ll); - ntfs_debug("After read: mftbmp: allocated_size 0x%llx, " - "data_size = 0x%llx, initialized_size 0x%llx.", - (long long)mftbmp_na->allocated_size, - (long long)mftbmp_na->data_size, - (long long)mftbmp_na->initialized_size); - if (!ll) - goto pass_done; - buf_size = ll << 3; - bit = buf_pos & 7; - buf_pos &= ~7ull; - ntfs_debug("Before for loop: buf_size 0x%x, buf_pos 0x%llx, " - "bit 0x%llx, *byte 0x%x, b %u.", buf_size, - (long long)buf_pos, (long long)bit, - byte ? *byte : -1, b); - for (; bit < buf_size && buf_pos + bit < pass_end; - bit &= ~7ull, bit += 8) { - byte = buf + (bit >> 3); - if (*byte == 0xff) - continue; - /* Note: ffz() result must be zero based. */ - b = ntfs_ffz((unsigned long)*byte); - if (b < 8 && b >= (bit & 7)) { - bit = buf_pos + (bit & ~7ull) + b; - ntfs_debug("Found free rec in for loop, " - "bit 0x%llx.", (long long)bit); - goto found_free_rec; + /* If we read at least one byte, search @buf for a zero bit. */ + if (ll) { + buf_size = ll << 3; + bit = data_pos & 7; + data_pos &= ~7ull; + ntfs_debug("Before inner for loop: buf_size 0x%x, " + "data_pos 0x%llx, bit 0x%llx, " + "*byte 0x%x, b %u.", buf_size, + (long long)data_pos, (long long)bit, + byte ? *byte : -1, b); + for (; bit < buf_size && data_pos + bit < pass_end; + bit &= ~7ull, bit += 8) { + byte = buf + (bit >> 3); + if (*byte == 0xff) + continue; + /* Note: ffz() result must be zero based. */ + b = ntfs_ffz((unsigned long)*byte); + if (b < 8 && b >= (bit & 7)) { + bit = data_pos + (bit & ~7ull) + b; + ntfs_debug("Found free record (#1), " + "bit 0x%llx.", + (long long)bit); + goto found_free_rec; + } } + ntfs_debug("After inner for loop: buf_size 0x%x, " + "data_pos 0x%llx, bit 0x%llx, " + "*byte 0x%x, b %u.", buf_size, + (long long)data_pos, (long long)bit, + byte ? *byte : -1, b); + data_pos += buf_size; + /* + * If the end of the pass has not been reached yet, + * continue searching the mft bitmap for a zero bit. + */ + if (data_pos < pass_end) + continue; } - ntfs_debug("After for loop: buf_size 0x%x, buf_pos 0x%llx, " - "bit 0x%llx, *byte 0x%x, b %u.", buf_size, - (long long)buf_pos, (long long)bit, - byte ? *byte : -1, b); - buf_pos += buf_size; - if (buf_pos < pass_end) - continue; -pass_done: /* Finished with the current pass. */ ntfs_debug("At pass_done."); - if (pass == 1) { - /* - * Now do pass 2, scanning the first part of the zone - * we omitted in pass 1. - */ - ntfs_debug("Done pass 1, switching to pass 2."); - pass = 2; - pass_end = pass_start; - buf_pos = pass_start = 24; - ntfs_debug("pass %i, pass_start 0x%llx, " - "pass_end 0x%llx.", pass, - (long long)pass_start, - (long long)pass_end); - continue; - } /* pass == 2 */ - /* No free records left. */ - if (mftbmp_na->initialized_size << 3 > - nr_allocated_mft_records && - mftbmp_na->initialized_size > 3) { - /* - * The mft bitmap is already bigger but the space is - * not covered by mft records, this implies that the - * next records are all free, so we already have found - * a free record. - */ - bit = nr_allocated_mft_records; - if (bit < 24) - bit = 24; - ntfs_debug("Found free record bit (#1) 0x%llx.", - (long long)bit); - goto found_free_rec; - } - ntfs_debug("Done pass 2."); - ntfs_debug("Status of mftbmp: allocated_size 0x%llx, " - "data_size 0x%llx, initialized_size 0x%llx.", - (long long)mftbmp_na->allocated_size, - (long long)mftbmp_na->data_size, - (long long)mftbmp_na->initialized_size); - if (mftbmp_na->initialized_size + 8 > - mftbmp_na->allocated_size) { - /* Need to extend bitmap by one more cluster. */ - ntfs_debug("mftbmp: initialized_size + 8 > " - "allocated_size."); - if (ntfs_mft_bitmap_extend_by_one_cluster(vol, - &have_allocated_mftbmp)) - goto err_out; - ntfs_debug("New status of mftbmp: allocated_size " - "0x%llx, data_size 0x%llx, " - "initialized_size 0x%llx.", - (long long)mftbmp_na->allocated_size, - (long long)mftbmp_na->data_size, - (long long)mftbmp_na->initialized_size); - } + /* If finished the second pass we are done searching. */ + if (pass == 2) + break; /* - * We now have sufficient allocated space, extend the - * initialized_size as well as the data_size if necessary. + * Finished with the first pass. Now do the second pass, in + * which we scan the first part of the zone we omitted earlier. */ - ctx = ntfs_attr_get_search_ctx(mftbmp_na->ni, NULL); - if (!ctx) { - ntfs_error(vol->sb, "Failed to get search context."); + ntfs_debug("Done pass 1, switching to pass 2."); + pass = 2; + pass_end = pass_start; + data_pos = pass_start = 24; + ntfs_debug("pass %i, pass_start 0x%llx, pass_end 0x%llx.", + pass, (long long)pass_start, + (long long)pass_end); + } + ntfs_debug("Done pass 2."); + /* + * No free mft records left. If the mft bitmap already covers more + * than the currently used mft records, the next records are all free, + * so we can simply allocate the first unused mft record. + * Note: We also have to make sure that the mft bitmap at least covers + * the first 24 mft records as they are special and whilst they may not + * be in use, we do not allocate from them. + */ + ll = mft_na->initialized_size >> vol->mft_record_size_bits; + if (mftbmp_na->initialized_size << 3 > ll && + mftbmp_na->initialized_size > 3) { + bit = ll; + if (bit < 24) + bit = 24; + ntfs_debug("Found free record (#2), bit 0x%llx.", + (long long)bit); + goto found_free_rec; + } + /* + * The mft bitmap needs to be expanded until it covers the first unused + * mft record that we can allocate. + * Note: The smallest mft record we allocate is mft record 24. + */ + ntfs_debug("Status of mftbmp before extension: allocated_size 0x%llx, " + "data_size 0x%llx, initialized_size 0x%llx.", + (long long)mftbmp_na->allocated_size, + (long long)mftbmp_na->data_size, + (long long)mftbmp_na->initialized_size); + if (mftbmp_na->initialized_size + 8 > mftbmp_na->allocated_size) { + /* Need to extend bitmap by one more cluster. */ + ntfs_debug("mftbmp: initialized_size + 8 > allocated_size."); + if (ntfs_mft_bitmap_extend_allocation(vol)) goto err_out; - } - if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, - mftbmp_na->name_len, 0, 0, NULL, 0, ctx)) { - ntfs_error(vol->sb, "Failed to find first attribute " - "extent of mft bitmap attribute."); - goto put_err_out; - } - a = ctx->attr; - buf_pos = mftbmp_na->initialized_size; - mftbmp_na->initialized_size += 8; - a->initialized_size = scpu_to_le64(mftbmp_na->initialized_size); - if (mftbmp_na->initialized_size > mftbmp_na->data_size) { - mftbmp_na->data_size = mftbmp_na->initialized_size; - a->data_size = scpu_to_le64(mftbmp_na->data_size); - } - /* Ensure the changes make it to disk. */ - ntfs_inode_mark_dirty(ctx->ntfs_ino); - ntfs_attr_put_search_ctx(ctx); - ntfs_debug("New status of mftbmp: allocated_size 0x%llx, " - "data_size 0x%llx, initialized_size 0x%llx.", + ntfs_debug("Status of mftbmp after allocation extension: " + "allocated_size 0x%llx, data_size 0x%llx, " + "initialized_size 0x%llx.", (long long)mftbmp_na->allocated_size, (long long)mftbmp_na->data_size, (long long)mftbmp_na->initialized_size); - have_allocated_mftbmp |= 4; - /* Initialize the mft bitmap attribute value with zeroes. */ - memset(buf, 0, 8); - ll = ntfs_attr_pwrite(mftbmp_na, buf_pos, 8, buf); - if (ll < 8) { - ntfs_error(vol->sb, "Failed to write to mft bitmap."); - if (ll >= 0) - errno = EIO; - goto shrink_mftbmp_err_out; - } - ntfs_debug("Wrote eight initialized bytes to mft bitmap."); - bit = buf_pos << 3; - ntfs_debug("Found free record bit (#2) 0x%llx.", - (long long)bit); - /* goto found_free_rec; */ - break; } + /* + * We now have sufficient allocated space, extend the initialized_size + * as well as the data_size if necessary and fill the new space with + * zeroes. + */ + bit = mftbmp_na->initialized_size << 3; + if (ntfs_mft_bitmap_extend_initialized(vol)) + goto err_out; + ntfs_debug("Status of mftbmp after initialized extention: " + "allocated_size 0x%llx, data_size 0x%llx, " + "initialized_size 0x%llx.", + (long long)mftbmp_na->allocated_size, + (long long)mftbmp_na->data_size, + (long long)mftbmp_na->initialized_size); + ntfs_debug("Found free record (#3), bit 0x%llx.", (long long)bit); found_free_rec: /* @bit is the found free mft record, allocate it in the mft bitmap. */ vol->mft_data_pos = bit; @@ -888,7 +995,7 @@ found_free_rec: ntfs_error(vol->sb, "Failed to read from mft bitmap."); if (!ll) errno = EIO; - goto shrink_mftbmp_err_out; + goto err_out; } ntfs_debug("Read 1 byte from mft bitmap."); /* Check our bit is really zero and set it. */ @@ -901,7 +1008,7 @@ found_free_rec: if (ll < 1) { if (!ll) errno = EIO; - goto shrink_mftbmp_err_out; + goto err_out; } ntfs_debug("Wrote 1 byte to mft bitmap."); /* The mft bitmap is now uptodate. Deal with mft data attribute now. */ @@ -1238,6 +1345,26 @@ mft_rec_already_initialized: free(buf); return ni; +put_err_out: + err = errno; + ntfs_attr_put_search_ctx(ctx); + errno = err; +err_out: + err = errno; + free(buf); + if (err) + errno = err; + else + errno = EIO; + return NULL; + + + + + + + + release_mrec_alloc_init_err_out: err = errno; free(ni); @@ -1257,26 +1384,85 @@ put_undo_data_init_err_out: undo_data_init_err_out: goto trunc_mft_rl_shrink_mftbmp_alloc_err_out; -put_err_out: - err = errno; - ntfs_attr_put_search_ctx(ctx); - errno = err; - - trunc_mft_rl_shrink_mftbmp_alloc_err_out: undo_mftbmp_alloc_err_out: + return NULL; -shrink_mftbmp_err_out: +#if 0 + unsigned long l; + int old_data_rlen; + s64 old_data_len; + s64 old_data_allocated; err_out: - err = errno; - free(buf); - if (err) - errno = err; + if (err != -ENOSPC) + ntfs_error(vol->sb, "Failed to allocate an mft " + "record. Returning error code %i.", -err); else - errno = EIO; - return NULL; + ntfs_debug(DEBUG_FILE3, __FUNCTION__ "(): Failed to allocate " + "an mft record due to lack of free space.\n"); + return err; +undo_data_init_err_out: + ntfs_debug(DEBUG_OTHER, __FUNCTION__ "(): At " + "undo_data_init_err_out.\n"); + mft_na->initialized = old_data_initialized; + mft_na->size = old_data_size; +undo_data_alloc_err_out: + ntfs_debug(DEBUG_OTHER, __FUNCTION__ "(): At undo_data_alloc_err_out." + "\n"); + mft_na->allocated = old_data_allocated; +undo_partial_data_alloc_err_out: + ntfs_debug(DEBUG_OTHER, __FUNCTION__ "(): At " + "undo_partial_data_alloc_err_out.\n"); + /* Deallocate the clusters. */ + if (ntfs_deallocate_clusters(vol, rl2, r2len)) + ntfs_error(vol->sb, "Error deallocating clusters in " + "error code path. You should run chkdsk."); + ntfs_vfree(rl2); + /* Revert the run list back to what it was before. */ + r2len = mft_na->d.r.len; + rl2 = mft_na->d.r.runlist; + rl2[old_data_rlen++].len = old_data_len; + rl2[old_data_rlen].lcn = (ntfs_cluster_t)-1; + rl2[old_data_rlen].len = (ntfs_cluster_t)0; + mft_na->d.r.len = old_data_rlen; + rl2_size = ((old_data_rlen + 1) * sizeof(ntfs_runlist) + PAGE_SIZE - + 1) & PAGE_MASK; + /* Reallocate memory freeing any extra memory allocated. */ + if (rl2_size < ((r2len * sizeof(ntfs_runlist) + PAGE_SIZE - 1) & + PAGE_MASK)) { + rl2 = ntfs_vmalloc(rl2_size); + if (rl2) { + ntfs_memcpy(rl2, mft_na->d.r.runlist, rl2_size); + ntfs_vfree(mft_na->d.r.runlist); + mft_na->d.r.runlist = rl2; + } else + ntfs_error(vol->sb, "Error reallocating " + "memory in error code path. This " + "should be harmless."); + } +undo_mftbmp_alloc_err_out: + ntfs_debug(DEBUG_OTHER, __FUNCTION__ "(): At " + "undo_mftbmp_alloc_err_out.\n"); + /* Deallocate the allocated bit in the mft bitmap. */ + io.param = buf; + io.size = 1; + io.do_read = 1; + err = ntfs_readwrite_attr(vol->mft_ino, mftbmp_na, bit >> 3, &io); + if (!err && io.size == 1) { + *buf &= ~(1 << (bit & 7)); + io.param = buf; + io.do_read = 0; + err = ntfs_readwrite_attr(vol->mft_ino, mftbmp_na, bit >> 3, &io); + } + if (err || io.size != 1) { + if (!err) + err = -EIO; + ntfs_error(vol->sb, "Error deallocating mft record in " + "error code path. You should run chkdsk."); + } +#endif } /** From f4af163c8396829d8cd3bd7b92a43d698863e183 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 14 Sep 2004 13:01:33 +0000 Subject: [PATCH 1857/2994] More work on ntfs_mft_record_alloc(): Factor out some code, start with some error handling and a bug fix here or there... BKrev: 4146ebad93IQRhTV0-qh5cm2_uMTFA From caf2f0ad972d2d1d56f6272d2c26d1acddb08bbe Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 15 Sep 2004 12:49:52 +0000 Subject: [PATCH 1858/2994] More code refactoring in ntfs_mft_record_alloc() together with more error recovery code. (Logical change 1.553) --- libntfs/mft.c | 749 +++++++++++++++++++++++++++----------------------- 1 file changed, 398 insertions(+), 351 deletions(-) diff --git a/libntfs/mft.c b/libntfs/mft.c index 41a0af6f..eeb296e8 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -374,6 +374,139 @@ int ntfs_mft_record_format(const ntfs_volume *vol, const MFT_REF mref) static const char *es = " Leaving inconsistent metadata. Run chkdsk."; +static inline unsigned int ntfs_ffz(unsigned int word) +{ + return ffs(~word) - 1; +} + +#ifndef PAGE_SIZE +#define PAGE_SIZE 4096 +#endif + +/** + * ntfs_mft_bitmap_find_free_rec - find a free mft record in the mft bitmap + * @vol: volume on which to search for a free mft record + * @base_ni: open base inode if allocating an extent mft record or NULL + * + * Search for a free mft record in the mft bitmap attribute on the ntfs volume + * @vol. + * + * If @base_ni is NULL start the search at the default allocator position. + * + * If @base_ni is not NULL start the search at the mft record after the base + * mft record @base_ni. + * + * Return the free mft record on success and -1 on error with errno set to the + * error code. An error code of ENOSPC means that there are no free mft + * records in the currently initialized mft bitmal. + */ +static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) +{ + s64 pass_end, ll, data_pos, pass_start, bit; + ntfs_attr *mftbmp_na; + u8 *buf, *byte; + unsigned int size; + u8 pass, b; + + buf = (u8*)malloc(PAGE_SIZE); + if (!buf) + return -1; + mftbmp_na = vol->mftbmp_na; + /* + * Set the end of the pass making sure we do not overflow the mft + * bitmap. + */ + size = PAGE_SIZE; + pass_end = vol->mft_na->allocated_size >> vol->mft_record_size_bits; + ll = pass_end >> 3; + if (size > ll) + size = ll; + ll = mftbmp_na->initialized_size << 3; + if (pass_end > ll) + pass_end = ll; + pass = 1; + if (!base_ni) + data_pos = vol->mft_data_pos; + else + data_pos = base_ni->mft_no + 1; + if (data_pos >= pass_end) { + data_pos = 24; + pass = 2; + } + pass_start = data_pos; + ntfs_debug("Starting bitmap search: pass %u, pass_start 0x%llx, " + "pass_end 0x%llx, data_pos 0x%llx.", pass, + (long long)pass_start, (long long)pass_end, + (long long)data_pos); +#ifdef DEBUG + byte = NULL; + b = 0; +#endif + /* Loop until a free mft record is found. */ + for (; pass <= 2; size = PAGE_SIZE) { + ll = ntfs_attr_pread(mftbmp_na, data_pos >> 3, size, buf); + if (ll < 0) { + ntfs_error(vol->sb, "Failed to read mft bitmap " + "attribute, aborting."); + free(buf); + return -1; + } + ntfs_debug("Read 0x%llx bytes.", (long long)ll); + /* If we read at least one byte, search @buf for a zero bit. */ + if (ll) { + size = ll << 3; + bit = data_pos & 7; + data_pos &= ~7ull; + ntfs_debug("Before inner for loop: size 0x%x, " + "data_pos 0x%llx, bit 0x%llx, " + "*byte 0x%x, b %u.", size, + (long long)data_pos, (long long)bit, + byte ? *byte : -1, b); + for (; bit < size && data_pos + bit < pass_end; + bit &= ~7ull, bit += 8) { + byte = buf + (bit >> 3); + if (*byte == 0xff) + continue; + /* Note: ffz() result must be zero based. */ + b = ntfs_ffz((unsigned long)*byte); + if (b < 8 && b >= (bit & 7)) { + free(buf); + return data_pos + (bit & ~7ull) + b; + } + } + ntfs_debug("After inner for loop: size 0x%x, " + "data_pos 0x%llx, bit 0x%llx, " + "*byte 0x%x, b %u.", size, + (long long)data_pos, (long long)bit, + byte ? *byte : -1, b); + data_pos += size; + /* + * If the end of the pass has not been reached yet, + * continue searching the mft bitmap for a zero bit. + */ + if (data_pos < pass_end) + continue; + } + /* Do the next pass. */ + pass++; + if (pass == 2) { + /* + * Starting the second pass, in which we scan the first + * part of the zone which we omitted earlier. + */ + pass_end = pass_start; + data_pos = pass_start = 24; + ntfs_debug("pass %i, pass_start 0x%llx, pass_end " + "0x%llx.", pass, (long long)pass_start, + (long long)pass_end); + } + } + /* No free mft records in currently initialized mft bitmap. */ + free(buf); + errno = ENOSPC; + return -1; +} + /** * ntfs_mft_bitmap_extend_allocation - extend mft bitmap attribute by a cluster * @vol: volume on which to extend the mft bitmap attribute @@ -471,7 +604,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) status.added_run = 1; ntfs_debug("Adding one run to mft bitmap."); /* Find the last run in the new runlist. */ - for (rl = mftbmp_na->rl; rl[1].length; rl++) + for (; rl[1].length; rl++) ; } /* @@ -529,7 +662,8 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu(a->mapping_pairs_offset), mp_size, rl2, ll, NULL)) { - ntfs_error(vol->sb, "Failed to build mapping pairs."); + ntfs_error(vol->sb, "Failed to build mapping pairs array for " + "mft bitmap attribute."); errno = EIO; goto undo_alloc; } @@ -703,9 +837,234 @@ err_out: return -1; } -static inline unsigned int ntfs_ffz(unsigned int word) +/** + * ntfs_mft_data_extend_allocation - extend mft data attribute + * @vol: volume on which to extend the mft data attribute + * + * Extend the mft data attribute on the ntfs volume @vol by 16 mft records + * worth of clusters or if not enough space for this by one mft record worth + * of clusters. + * + * Note: Only changes allocated_size, i.e. does not touch initialized_size or + * data_size. + * + * Return 0 on success and -1 on error with errno set to the error code. + */ +static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) { - return ffs(~word) - 1; + LCN lcn; + VCN old_last_vcn; + s64 min_nr, nr, ll = 0; /* silence compiler warning */ + ntfs_attr *mft_na; + runlist_element *rl, *rl2; + ntfs_attr_search_ctx *ctx; + MFT_RECORD *m = NULL; /* silence compiler warning */ + ATTR_RECORD *a = NULL; /* silence compiler warning */ + int err, mp_size; + u32 old_alen = 0; /* silence compiler warning */ + BOOL mp_rebuilt = FALSE; + + ntfs_debug("Extending mft data allocation."); + mft_na = vol->mft_na; + /* + * Determine the preferred allocation location, i.e. the last lcn of + * the mft data attribute. The allocated size of the mft data + * attribute cannot be zero so we are ok to do this. + */ + rl = ntfs_attr_find_vcn(mft_na, + (mft_na->allocated_size - 1) >> vol->cluster_size); + if (!rl || !rl->length || rl->lcn < 0) { + ntfs_error(vol->sb, "Failed to determine last allocated " + "cluster of mft data attribute."); + if (rl) + errno = EIO; + return -1; + } + lcn = rl->lcn + rl->length; + ntfs_debug("Last lcn of mft data attribute is 0x%llx.", (long long)lcn); + /* Minimum allocation is one mft record worth of clusters. */ + if (vol->mft_record_size <= vol->cluster_size) + min_nr = 1; + else + min_nr = vol->mft_record_size >> vol->cluster_size_bits; + /* Want to allocate 16 mft records worth of clusters. */ + nr = vol->mft_record_size << 4 >> vol->cluster_size_bits; + if (!nr) + nr = 1; + ntfs_debug("Trying mft data allocation with default cluster count " + "%lli.", (long long)nr); + old_last_vcn = rl[1].vcn; + do { + rl2 = ntfs_cluster_alloc(vol, nr, lcn, MFT_ZONE, old_last_vcn); + if (rl2) + break; + if (errno != ENOSPC || nr == min_nr) { + ntfs_error(vol->sb, "Failed to allocate the minimal " + "number of clusters (%lli) for the " + "mft data attribute.", (long long)nr); + return -1; + } + /* + * There is not enough space to do the allocation, but there + * might be enough space to do a minimal allocation so try that + * before failing. + */ + nr = min_nr; + ntfs_debug("Retrying mft data allocation with minimal cluster " + "count %lli.", (long long)nr); + } while (1); + rl = ntfs_runlists_merge(mft_na->rl, rl2); + if (!rl) { + err = errno; + ntfs_error(vol->sb, "Failed to merge runlists for mft data " + "attribute."); + if (ntfs_cluster_free_from_rl(vol, rl2)) + ntfs_error(vol->sb, "Failed to dealocate clusters " + "from the mft data attribute.%s", es); + free(rl2); + errno = err; + return -1; + } + mft_na->rl = rl; + ntfs_debug("Allocated %lli clusters.", nr); + /* Find the last run in the new runlist. */ + for (; rl[1].length; rl++) + ; + /* Update the attribute record as well. */ + ctx = ntfs_attr_get_search_ctx(mft_na->ni, NULL); + if (!ctx) { + ntfs_error(vol->sb, "Failed to get search context."); + goto undo_alloc; + } + if (ntfs_attr_lookup(mft_na->type, mft_na->name, mft_na->name_len, 0, + rl[1].vcn, NULL, 0, ctx)) { + ntfs_error(vol->sb, "Failed to find last attribute extent of " + "mft data attribute."); + goto undo_alloc; + } + m = ctx->mrec; + a = ctx->attr; + ll = sle64_to_cpu(a->lowest_vcn); + rl2 = ntfs_attr_find_vcn(mft_na, ll); + if (!rl2 || !rl2->length) { + ntfs_error(vol->sb, "Failed to determine previous last " + "allocated cluster of mft data attribute."); + if (rl2) + errno = EIO; + goto undo_alloc; + } + /* Get the size for the new mapping pairs array for this extent. */ + mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll); + if (mp_size <= 0) { + ntfs_error(vol->sb, "Get size for mapping pairs failed for " + "mft data attribute extent."); + goto undo_alloc; + } + /* Expand the attribute record if necessary. */ + old_alen = le32_to_cpu(a->length); + if (ntfs_attr_record_resize(m, a, + mp_size + le16_to_cpu(a->mapping_pairs_offset))) { + if (errno != ENOSPC) { + ntfs_error(vol->sb, "Failed to resize attribute " + "record for mft data attribute."); + goto undo_alloc; + } + // TODO: Deal with this by moving this extent to a new mft + // record or by starting a new extent in a new mft record. + // Note: Use the special reserved mft records and ensure that + // this extent is not required to find the mft record in + // question. + ntfs_error(vol->sb, "Not enough space in this mft record to " + "accomodate extended mft data attribute " + "extent. Cannot handle this yet."); + errno = ENOTSUP; + goto undo_alloc; + } + mp_rebuilt = TRUE; + /* + * Generate the mapping pairs array directly into the attribute record. + */ + if (ntfs_mapping_pairs_build(vol, + (u8*)a + le16_to_cpu(a->mapping_pairs_offset), mp_size, + rl2, ll, NULL)) { + ntfs_error(vol->sb, "Failed to build mapping pairs array of " + "mft data attribute."); + errno = EIO; + goto undo_alloc; + } + /* Update the highest_vcn. */ + a->highest_vcn = scpu_to_le64(rl[1].vcn - 1); + /* + * We now have extended the mft data allocated_size by nr clusters. + * Reflect this in the ntfs_attr structure and the attribute record. + * @rl is the last (non-terminator) runlist element of mft data + * attribute. + */ + if (a->lowest_vcn) { + /* + * We are not in the first attribute extent, switch to it, but + * first ensure the changes will make it to disk later. + */ + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_attr_reinit_search_ctx(ctx); + if (ntfs_attr_lookup(mft_na->type, mft_na->name, + mft_na->name_len, 0, 0, NULL, 0, ctx)) { + ntfs_error(vol->sb, "Failed to find first attribute " + "extent of mft data attribute."); + goto restore_undo_alloc; + } + a = ctx->attr; + } + mft_na->allocated_size += nr << vol->cluster_size_bits; + a->allocated_size = scpu_to_le64(mft_na->allocated_size); + /* Ensure the changes make it to disk. */ + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_attr_put_search_ctx(ctx); + return 0; +restore_undo_alloc: + err = errno; + ntfs_attr_reinit_search_ctx(ctx); + if (ntfs_attr_lookup(mft_na->type, mft_na->name, mft_na->name_len, 0, + rl[1].vcn, NULL, 0, ctx)) { + ntfs_error(vol->sb, "Failed to find last attribute extent of " + "mft data attribute.%s", es); + ntfs_attr_put_search_ctx(ctx); + mft_na->allocated_size += nr << vol->cluster_size_bits; + /* + * The only thing that is now wrong is ->allocated_size of the + * base attribute extent which chkdsk should be able to fix. + */ + errno = err; + return -1; + } + m = ctx->mrec; + a = ctx->attr; + a->highest_vcn = scpu_to_le64(old_last_vcn - 1); + errno = err; +undo_alloc: + err = errno; + if (ntfs_cluster_free(vol, mft_na, old_last_vcn, -1) < 0) + ntfs_error(vol->sb, "Failed to free clusters from mft data " + "attribute.%s", es); + if (ntfs_rl_truncate(&mft_na->rl, old_last_vcn)) + ntfs_error(vol->sb, "Failed to truncate mft data attribute " + "runlist.%s", es); + if (mp_rebuilt) { + if (ntfs_mapping_pairs_build(vol, (u8*)a + + le16_to_cpu(a->mapping_pairs_offset), + old_alen - le16_to_cpu(a->mapping_pairs_offset), + rl2, ll, NULL)) + ntfs_error(vol->sb, "Failed to restore mapping pairs " + "array.%s", es); + if (ntfs_attr_record_resize(m, a, old_alen)) + ntfs_error(vol->sb, "Failed to restore attribute " + "record.%s", es); + ntfs_inode_mark_dirty(ctx->ntfs_ino); + } + if (ctx) + ntfs_attr_put_search_ctx(ctx); + errno = err; + return -1; } /** @@ -791,26 +1150,17 @@ static inline unsigned int ntfs_ffz(unsigned int word) * when reading the bitmap but if we are careful, we should be able to avoid * all problems. */ -#ifndef PAGE_SIZE -#define PAGE_SIZE 4096 -#endif ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) { - s64 nr_allocated_mft_records, pass_end, ll, ll2, data_pos, pass_start; - s64 last_read_pos, bit; - LCN lcn; + s64 ll, ll2, bit; ntfs_attr *mft_na, *mftbmp_na; - u8 *buf, *byte; - runlist_element *rl, *rl2; ntfs_attr_search_ctx *ctx; MFT_RECORD *m; ATTR_RECORD *a; ntfs_inode *ni; unsigned long mft_rec_size; - unsigned int size, buf_size; - int err, mp_size; + int err; u16 seq_no; - u8 pass, b; if (base_ni) ntfs_debug("Entering (allocating an extent mft record for " @@ -822,115 +1172,16 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) errno = EINVAL; return NULL; } - size = PAGE_SIZE; - if (size < vol->mft_record_size) - size = vol->mft_record_size; - buf = (u8*)malloc(size); - if (!buf) - return NULL; mft_na = vol->mft_na; mftbmp_na = vol->mftbmp_na; - /* Determine the number of allocated mft records in the mft. */ - nr_allocated_mft_records = mft_na->allocated_size >> - vol->mft_record_size_bits; - ntfs_debug("nr_allocated_mft_records 0x%llx.", - (long long)nr_allocated_mft_records); - /* - * Set the end of the pass making sure we do not overflow the mft - * bitmap. - */ - pass_end = nr_allocated_mft_records; - ll = mftbmp_na->initialized_size << 3; - if (pass_end > ll) - pass_end = ll; - pass = 1; - if (!base_ni) - data_pos = vol->mft_data_pos; - else - data_pos = base_ni->mft_no + 1; - if (data_pos >= pass_end) { - data_pos = 24; - pass = 2; + bit = ntfs_mft_bitmap_find_free_rec(vol, base_ni); + if (bit >= 0) { + ntfs_debug("Found free record (#1), bit 0x%llx.", + (long long)bit); + goto found_free_rec; } - pass_start = data_pos; - ntfs_debug("Starting bitmap search: pass %u, pass_start 0x%llx, " - "pass_end 0x%llx, data_pos 0x%llx.", pass, - (long long)pass_start, (long long)pass_end, - (long long)data_pos); -#ifdef DEBUG - byte = NULL; - b = 0; -#endif - /* Loop until a free mft record is found. */ - size = PAGE_SIZE; - ll = nr_allocated_mft_records >> 3; - if (size > ll) - size = ll; - for (;; size = PAGE_SIZE) { - last_read_pos = data_pos >> 3; - ll = ntfs_attr_pread(mftbmp_na, last_read_pos, size, buf); - if (ll < 0) { - ntfs_error(vol->sb, "Failed to read mft bitmap " - "attribute, aborting."); - goto err_out; - } - ntfs_debug("Read 0x%llx bytes.", (long long)ll); - /* If we read at least one byte, search @buf for a zero bit. */ - if (ll) { - buf_size = ll << 3; - bit = data_pos & 7; - data_pos &= ~7ull; - ntfs_debug("Before inner for loop: buf_size 0x%x, " - "data_pos 0x%llx, bit 0x%llx, " - "*byte 0x%x, b %u.", buf_size, - (long long)data_pos, (long long)bit, - byte ? *byte : -1, b); - for (; bit < buf_size && data_pos + bit < pass_end; - bit &= ~7ull, bit += 8) { - byte = buf + (bit >> 3); - if (*byte == 0xff) - continue; - /* Note: ffz() result must be zero based. */ - b = ntfs_ffz((unsigned long)*byte); - if (b < 8 && b >= (bit & 7)) { - bit = data_pos + (bit & ~7ull) + b; - ntfs_debug("Found free record (#1), " - "bit 0x%llx.", - (long long)bit); - goto found_free_rec; - } - } - ntfs_debug("After inner for loop: buf_size 0x%x, " - "data_pos 0x%llx, bit 0x%llx, " - "*byte 0x%x, b %u.", buf_size, - (long long)data_pos, (long long)bit, - byte ? *byte : -1, b); - data_pos += buf_size; - /* - * If the end of the pass has not been reached yet, - * continue searching the mft bitmap for a zero bit. - */ - if (data_pos < pass_end) - continue; - } - /* Finished with the current pass. */ - ntfs_debug("At pass_done."); - /* If finished the second pass we are done searching. */ - if (pass == 2) - break; - /* - * Finished with the first pass. Now do the second pass, in - * which we scan the first part of the zone we omitted earlier. - */ - ntfs_debug("Done pass 1, switching to pass 2."); - pass = 2; - pass_end = pass_start; - data_pos = pass_start = 24; - ntfs_debug("pass %i, pass_start 0x%llx, pass_end 0x%llx.", - pass, (long long)pass_start, - (long long)pass_end); - } - ntfs_debug("Done pass 2."); + if (errno != ENOSPC) + return NULL; /* * No free mft records left. If the mft bitmap already covers more * than the currently used mft records, the next records are all free, @@ -988,238 +1239,39 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) ntfs_debug("Found free record (#3), bit 0x%llx.", (long long)bit); found_free_rec: /* @bit is the found free mft record, allocate it in the mft bitmap. */ - vol->mft_data_pos = bit; ntfs_debug("At found_free_rec."); - ll = ntfs_attr_pread(mftbmp_na, bit >> 3, 1, buf); - if (ll < 1) { - ntfs_error(vol->sb, "Failed to read from mft bitmap."); - if (!ll) - errno = EIO; + if (ntfs_bitmap_set_bit(mftbmp_na, bit)) { + ntfs_error(vol->sb, "Failed to allocate bit in mft bitmap."); goto err_out; } - ntfs_debug("Read 1 byte from mft bitmap."); - /* Check our bit is really zero and set it. */ - b = 1 << (bit & 7); - //BUG_ON(*buf & b); - if (*buf & b) - NTFS_BUG("Bit in mft bitmap is not zero!"); - *buf |= b; - ll = ntfs_attr_pwrite(mftbmp_na, bit >> 3, 1, buf); - if (ll < 1) { - if (!ll) - errno = EIO; - goto err_out; - } - ntfs_debug("Wrote 1 byte to mft bitmap."); + ntfs_debug("Set bit 0x%llx in mft bitmap.", (long long)bit); /* The mft bitmap is now uptodate. Deal with mft data attribute now. */ ll = (bit + 1) << vol->mft_record_size_bits; if (ll <= mft_na->initialized_size) { - /* The allocated record is already initialized. We are done! */ - ntfs_debug("Allocated mft record already initialized!"); + ntfs_debug("Allocated mft record already initialized."); goto mft_rec_already_initialized; } - ntfs_debug("Allocated mft record needs to be initialized."); + ntfs_debug("Initializing allocated mft record."); /* The mft record is outside the initialized data. */ mft_rec_size = vol->mft_record_size; - /* Preserve old values for undo purposes. */ -//FIXME: -// s64 old_data_allocated; -// LCN old_data_len; -// int old_data_rlen; -// old_data_allocated = mft_na->allocated_size; -// old_data_rlen = mft_na->d.r.len - 1; -// old_data_len = mft_na->d.r.runlist[old_data_rlen].len; /* - * If necessary, extend the mft until it covers the allocated record. - * The loop is only actually used when a freshly formatted volume is - * first written to so it optimizes away nicely in the common case. + * Extend the mft data attribute until it covers the allocated record. + * The loop is only actually traversed more than once when a freshly + * formatted volume is first written to so it optimizes away nicely in + * the common case. */ + ntfs_debug("Status of mft data before extension: " + "allocated_size 0x%llx, data_size 0x%llx, " + "initialized_size 0x%llx.", + (long long)mft_na->allocated_size, + (long long)mft_na->data_size, + (long long)mft_na->initialized_size); while (ll > mft_na->allocated_size) { - s64 nr, min_nr; - - ntfs_debug("Extending mft data allocation, status of mft " - "data: allocated_size 0x%llx, " - "data_size 0x%llx, initialized_size 0x%llx.", - (long long)mft_na->allocated_size, - (long long)mft_na->data_size, - (long long)mft_na->initialized_size); - /* - * Determine the preferred allocation location, i.e. the last - * lcn of the mft data attribute. The allocated size of the - * mft data attribute cannot be zero so we are ok to do this. - */ - rl = ntfs_attr_find_vcn(mft_na, (mft_na->allocated_size - 1) >> - vol->cluster_size); - if (!rl || !rl->length || rl->lcn < 0) { - ntfs_error(vol->sb, "Failed to determine last " - "allocated cluster of mft data " - "attribute."); - if (!rl->length || rl->lcn < 0) - errno = EIO; - goto undo_mftbmp_alloc_err_out; - } - lcn = rl->lcn + rl->length; - ntfs_debug("Last lcn of mft data attribute is 0x%llx.", - (long long)lcn); - /* Minimum allocation is one mft record worth of clusters. */ - if (mft_rec_size <= vol->cluster_size) - min_nr = 1; - else - min_nr = mft_rec_size >> vol->cluster_size_bits; - /* Want to allocate 16 mft records worth of clusters. */ - nr = mft_rec_size << 4 >> vol->cluster_size_bits; - if (!nr) - nr = 1; - ntfs_debug("Trying mft data allocation with default " - "cluster count %lli.", (long long)nr); -retry_mft_data_allocation: - rl2 = ntfs_cluster_alloc(vol, nr, lcn, MFT_ZONE, rl[1].vcn); - if (!rl2) { - /* - * There is not enough space to do the allocation, but - * there might be enough space to do a minimal - * allocation so try that before failing. - */ - if (errno == ENOSPC && nr > min_nr) { - nr = min_nr; - ntfs_debug("Retrying mft data allocation with " - "minimal cluster count %lli.", - (long long)nr); - goto retry_mft_data_allocation; - } - ntfs_error(vol->sb, "Failed to allocate a cluster for " - "the mft data attribute."); - goto undo_mftbmp_alloc_err_out; - } - rl = ntfs_runlists_merge(mft_na->rl, rl2); - if (!rl) { - err = errno; - ntfs_error(vol->sb, "Failed to merge runlists for mft " - "data attribute."); - if (ntfs_cluster_free_from_rl(vol, rl2)) - ntfs_error(vol->sb, "Failed to dealocate " - "clusters. Run chkdsk."); - free(rl2); - errno = err; - goto undo_mftbmp_alloc_err_out; - } - mft_na->rl = rl; - ntfs_debug("Allocated %lli clusters starting.", nr); - /* Determine the last lcn of the mft data attribute. */ - rl = ntfs_attr_find_vcn(mft_na, (mft_na->allocated_size - 1) >> - vol->cluster_size); - if (!rl || !rl->length || rl->lcn < 0) { - ntfs_error(vol->sb, "Failed to determine last " - "allocated cluster of mft data " - "attribute."); - if (!rl->length || rl->lcn < 0) - errno = EIO; - // FIXME: Truncate mft_na->rl back to the old state and - // release the clusters. - goto undo_mftbmp_alloc_err_out; - } - lcn = rl->lcn + rl->length; - /* Update the attribute record as well. */ - ctx = ntfs_attr_get_search_ctx(mft_na->ni, NULL); - if (!ctx) { - ntfs_error(vol->sb, "Failed to get search context."); - goto trunc_mft_rl_shrink_mftbmp_alloc_err_out; - } - if (ntfs_attr_lookup(mft_na->type, mft_na->name, - mft_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { - ntfs_error(vol->sb, "Failed to find last attribute " - "extent of mft data attribute."); - goto put_err_out; - } - m = ctx->mrec; - a = ctx->attr; - ll2 = sle64_to_cpu(a->lowest_vcn); - rl2 = ntfs_attr_find_vcn(mft_na, ll2); - if (!rl2 || !rl2->length) { - ntfs_error(vol->sb, "Failed to determine previous " - "last allocated cluster of mft data " - "attribute."); - if (!rl2->length) - errno = EIO; - goto put_err_out; - } - /* - * Get the size for the new mapping pairs array for this - * extent. - */ - mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll2); - if (mp_size <= 0) { - ntfs_error(vol->sb, "Get size for mapping pairs " - "failed for mft bitmap attribute " - "extent."); - goto put_err_out; - } - /* Expand the attribute record if necessary. */ - if (ntfs_attr_record_resize(m, a, mp_size + - le16_to_cpu(a->mapping_pairs_offset))) { - if (errno != ENOSPC) { - ntfs_error(vol->sb, "Failed to resize " - "attribute record for mft " - "data attribute."); - goto put_err_out; - } - // TODO: Deal with this by moving this extent to a new - // mft record or by starting a new extent in a new mft - // record. Note: Use the special reserved mft records - // and ensure that this extent is not required to find - // the mft record in question. - ntfs_error(vol->sb, "Not enough space in this mft " - "record to accomodate extended mft " - "data attribute extent. Cannot " - "handle this yet."); - errno = ENOTSUP; - goto put_err_out; - } - /* - * Generate the mapping pairs array directly into the attribute - * record. - */ - if (ntfs_mapping_pairs_build(vol, (u8*)a + - le16_to_cpu(a->mapping_pairs_offset), mp_size, - rl2, ll2, NULL)) { - ntfs_error(vol->sb, "Failed to build mapping pairs. " - "Run chkdsk."); - errno = EIO; - goto put_err_out; - } - /* Update the highest_vcn. */ - a->highest_vcn = scpu_to_le64(rl[1].vcn - 1); - /* - * We now have extended the mft data allocated_size by nr - * clusters. Reflect this in the ntfs_attr structure and the - * attribute record. @rl is the last (non-terminator) runlist - * element of mft data attribute. - */ - mft_na->allocated_size += nr << vol->cluster_size_bits; - if (a->lowest_vcn) { - /* - * We are not in the first attribute extent, switch to - * it, but first ensure the changes will make it to - * disk later. - */ - ntfs_inode_mark_dirty(ctx->ntfs_ino); - ntfs_attr_reinit_search_ctx(ctx); - if (ntfs_attr_lookup(mft_na->type, mft_na->name, - mft_na->name_len, 0, 0, NULL, 0, ctx)) { - ntfs_error(vol->sb, "Failed to find first " - "attribute extent of mft data " - "attribute."); - goto put_err_out; - } - a = ctx->attr; - } - a->allocated_size = scpu_to_le64(mft_na->allocated_size); - /* Ensure the changes make it to disk. */ - ntfs_inode_mark_dirty(ctx->ntfs_ino); - ntfs_attr_put_search_ctx(ctx); - ntfs_debug("After extending mft data allocation, status of " - "mft data: allocated_size 0x%llx, " - "data_size 0x%llx, initialized_size 0x%llx.", + if (ntfs_mft_data_extend_allocation(vol)) + goto undo_mftbmp_alloc; + ntfs_debug("Status of mft data after allocation extension: " + "allocated_size 0x%llx, data_size 0x%llx, " + "initialized_size 0x%llx.", (long long)mft_na->allocated_size, (long long)mft_na->data_size, (long long)mft_na->initialized_size); @@ -1229,7 +1281,7 @@ retry_mft_data_allocation: // old_data_size = mft_na->data_size; /* * Extend mft data initialized size (and data size of course) to reach - * the allocated mft record formatting the mft records allong the way. + * the allocated mft record, formatting the mft records allong the way. */ while (ll > mft_na->initialized_size) { ll2 = mft_na->initialized_size >> vol->mft_record_size_bits; @@ -1261,7 +1313,7 @@ retry_mft_data_allocation: /* Ensure the changes make it to disk. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); - ntfs_debug("After mft record initialization, status of mft data: " + ntfs_debug("Status of mft data after mft record initialization: " "allocated_size 0x%llx, data_size 0x%llx, " "initialized_size 0x%llx.", (long long)mft_na->allocated_size, @@ -1342,19 +1394,15 @@ mft_rec_already_initialized: /* Return the opened, allocated inode of the allocated mft record. */ ntfs_debug("Returning opened, allocated %sinode 0x%llx.", base_ni ? "extent " : "", (long long)bit); - free(buf); return ni; -put_err_out: +undo_mftbmp_alloc: err = errno; - ntfs_attr_put_search_ctx(ctx); + if (ntfs_bitmap_clear_bit(mftbmp_na, bit)) + ntfs_error(vol->sb, "Failed to clear bit in mft bitmap.%s", es); errno = err; err_out: - err = errno; - free(buf); - if (err) - errno = err; - else + if (!errno) errno = EIO; return NULL; @@ -1386,7 +1434,6 @@ undo_data_init_err_out: trunc_mft_rl_shrink_mftbmp_alloc_err_out: -undo_mftbmp_alloc_err_out: return NULL; #if 0 From 35d7e2b7f3cc1b2f4ee6929b906368c7cf6469f2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 15 Sep 2004 12:49:52 +0000 Subject: [PATCH 1859/2994] More code refactoring in ntfs_mft_record_alloc() together with more error recovery code. BKrev: 41483a70eUEA6m4YibD4f3LtUCXipw From 9656a23b5eb0dccd01585534e805750be1fb00de Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 15 Sep 2004 15:21:47 +0000 Subject: [PATCH 1860/2994] Finish off ntfs_mft_record_alloc() and its error handling. (Logical change 1.554) --- libntfs/mft.c | 187 +++++++++++++------------------------------------- 1 file changed, 49 insertions(+), 138 deletions(-) diff --git a/libntfs/mft.c b/libntfs/mft.c index eeb296e8..13baa56d 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -372,7 +372,9 @@ int ntfs_mft_record_format(const ntfs_volume *vol, const MFT_REF mref) return 0; } +#ifdef DEBUG static const char *es = " Leaving inconsistent metadata. Run chkdsk."; +#endif static inline unsigned int ntfs_ffz(unsigned int word) { @@ -1152,13 +1154,12 @@ undo_alloc: */ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) { - s64 ll, ll2, bit; + s64 ll, bit, old_data_initialized, old_data_size; ntfs_attr *mft_na, *mftbmp_na; ntfs_attr_search_ctx *ctx; MFT_RECORD *m; ATTR_RECORD *a; ntfs_inode *ni; - unsigned long mft_rec_size; int err; u16 seq_no; @@ -1252,13 +1253,11 @@ found_free_rec: goto mft_rec_already_initialized; } ntfs_debug("Initializing allocated mft record."); - /* The mft record is outside the initialized data. */ - mft_rec_size = vol->mft_record_size; /* - * Extend the mft data attribute until it covers the allocated record. - * The loop is only actually traversed more than once when a freshly - * formatted volume is first written to so it optimizes away nicely in - * the common case. + * The mft record is outside the initialized data. Extend the mft data + * attribute until it covers the allocated record. The loop is only + * actually traversed more than once when a freshly formatted volume is + * first written to so it optimizes away nicely in the common case. */ ntfs_debug("Status of mft data before extension: " "allocated_size 0x%llx, data_size 0x%llx, " @@ -1276,36 +1275,39 @@ found_free_rec: (long long)mft_na->data_size, (long long)mft_na->initialized_size); } -// s64 old_data_initialized, old_data_size; -// old_data_initialized = mft_na->initialized_size; -// old_data_size = mft_na->data_size; + old_data_initialized = mft_na->initialized_size; + old_data_size = mft_na->data_size; /* * Extend mft data initialized size (and data size of course) to reach * the allocated mft record, formatting the mft records allong the way. + * Note: We only modify the ntfs_attr structure as that is all that is + * needed by ntfs_mft_record_format(). We will update the attribute + * record itself in one fell swoop later on. */ while (ll > mft_na->initialized_size) { - ll2 = mft_na->initialized_size >> vol->mft_record_size_bits; + s64 ll2 = mft_na->initialized_size >> vol->mft_record_size_bits; mft_na->initialized_size += vol->mft_record_size; if (mft_na->initialized_size > mft_na->data_size) mft_na->data_size = mft_na->initialized_size; - ntfs_debug("Initializing mft record 0x%llx.", ll2); + ntfs_debug("Initializing mft record 0x%llx.", (long long)ll2); err = ntfs_mft_record_format(vol, ll2); if (err) { ntfs_error(vol->sb, "Failed to format mft record."); - goto undo_data_init_err_out; + goto undo_data_init; } } /* Update the mft data attribute record to reflect the new sizes. */ ctx = ntfs_attr_get_search_ctx(mft_na->ni, NULL); if (!ctx) { ntfs_error(vol->sb, "Failed to get search context."); - goto undo_data_init_err_out; + goto undo_data_init; } if (ntfs_attr_lookup(mft_na->type, mft_na->name, mft_na->name_len, 0, 0, NULL, 0, ctx)) { ntfs_error(vol->sb, "Failed to find first attribute extent of " "mft data attribute."); - goto put_undo_data_init_err_out; + ntfs_attr_put_search_ctx(ctx); + goto undo_data_init; } a = ctx->attr; a->initialized_size = scpu_to_le64(mft_na->initialized_size); @@ -1328,23 +1330,23 @@ found_free_rec: mft_rec_already_initialized: /* * We now have allocated and initialized the mft record. Need to read - * it from disk and re-format it. + * it from disk and re-format it, preserving the sequence number if it + * is not zero. */ m = (MFT_RECORD*)malloc(vol->mft_record_size); if (!m) { ntfs_error(vol->sb, "Failed to allocate buffer for mft " "record."); - goto undo_mrec_alloc_init_err_out; + goto undo_mftbmp_alloc; } if (ntfs_mft_record_read(vol, bit, m)) { ntfs_error(vol->sb, "Failed to read mft record."); - goto undo_mrec_alloc_init_err_out; + goto undo_mftbmp_alloc; } - /* Preserve the sequence number if it is not zero. */ seq_no = m->sequence_number; if (ntfs_mft_record_layout(vol, bit, m)) { ntfs_error(vol->sb, "Failed to re-format mft record."); - goto undo_mrec_alloc_init_err_out; + goto undo_mftbmp_alloc; } if (le16_to_cpu(seq_no)) m->sequence_number = seq_no; @@ -1353,8 +1355,11 @@ mft_rec_already_initialized: /* Now need to open an ntfs inode for the mft record. */ ni = ntfs_inode_allocate(vol); if (!ni) { + err = errno; ntfs_error(vol->sb, "Failed to allocate buffer for inode."); - goto undo_mrec_alloc_init_err_out; + free(m); + errno = err; + goto undo_mftbmp_alloc; } ni->mft_no = bit; ni->mrec = m; @@ -1366,8 +1371,8 @@ mft_rec_already_initialized: ni->nr_extents = -1; ni->base_ni = base_ni; /* - * Attach extent inode to base inode, reallocating memory if - * needed. + * Attach the extent inode to the base inode, reallocating + * memory if needed. */ if (!(base_ni->nr_extents & 3)) { ntfs_inode **extent_nis; @@ -1375,8 +1380,16 @@ mft_rec_already_initialized: i = (base_ni->nr_extents + 4) * sizeof(ntfs_inode *); extent_nis = (ntfs_inode**)malloc(i); - if (!extent_nis) - goto release_mrec_alloc_init_err_out; + if (!extent_nis) { + err = errno; + ntfs_error(vol->sb, "Failed to allocate " + "buffer for extent inodes " + "array."); + free(m); + free(ni); + errno = err; + goto undo_mftbmp_alloc; + } if (base_ni->extent_nis) { memcpy(extent_nis, base_ni->extent_nis, i - 4 * sizeof(ntfs_inode *)); @@ -1386,7 +1399,7 @@ mft_rec_already_initialized: } base_ni->extent_nis[base_ni->nr_extents++] = ni; } - /* Make sure the allocated inode is written out to disk. */ + /* Make sure the allocated inode is written out to disk later. */ ntfs_inode_mark_dirty(ni); /* Update the default mft allocation position if it was used. */ if (!base_ni) @@ -1395,7 +1408,9 @@ mft_rec_already_initialized: ntfs_debug("Returning opened, allocated %sinode 0x%llx.", base_ni ? "extent " : "", (long long)bit); return ni; - +undo_data_init: + mft_na->initialized_size = old_data_initialized; + mft_na->data_size = old_data_size; undo_mftbmp_alloc: err = errno; if (ntfs_bitmap_clear_bit(mftbmp_na, bit)) @@ -1405,111 +1420,6 @@ err_out: if (!errno) errno = EIO; return NULL; - - - - - - - - -release_mrec_alloc_init_err_out: - err = errno; - free(ni); - errno = err; - -undo_mrec_alloc_init_err_out: - err = errno; - free(m); - errno = err; - goto undo_data_init_err_out; - -put_undo_data_init_err_out: - err = errno; - ntfs_attr_put_search_ctx(ctx); - errno = err; - -undo_data_init_err_out: - goto trunc_mft_rl_shrink_mftbmp_alloc_err_out; - -trunc_mft_rl_shrink_mftbmp_alloc_err_out: - - return NULL; - -#if 0 - unsigned long l; - int old_data_rlen; - s64 old_data_len; - s64 old_data_allocated; - -err_out: - if (err != -ENOSPC) - ntfs_error(vol->sb, "Failed to allocate an mft " - "record. Returning error code %i.", -err); - else - ntfs_debug(DEBUG_FILE3, __FUNCTION__ "(): Failed to allocate " - "an mft record due to lack of free space.\n"); - return err; -undo_data_init_err_out: - ntfs_debug(DEBUG_OTHER, __FUNCTION__ "(): At " - "undo_data_init_err_out.\n"); - mft_na->initialized = old_data_initialized; - mft_na->size = old_data_size; -undo_data_alloc_err_out: - ntfs_debug(DEBUG_OTHER, __FUNCTION__ "(): At undo_data_alloc_err_out." - "\n"); - mft_na->allocated = old_data_allocated; -undo_partial_data_alloc_err_out: - ntfs_debug(DEBUG_OTHER, __FUNCTION__ "(): At " - "undo_partial_data_alloc_err_out.\n"); - /* Deallocate the clusters. */ - if (ntfs_deallocate_clusters(vol, rl2, r2len)) - ntfs_error(vol->sb, "Error deallocating clusters in " - "error code path. You should run chkdsk."); - ntfs_vfree(rl2); - /* Revert the run list back to what it was before. */ - r2len = mft_na->d.r.len; - rl2 = mft_na->d.r.runlist; - rl2[old_data_rlen++].len = old_data_len; - rl2[old_data_rlen].lcn = (ntfs_cluster_t)-1; - rl2[old_data_rlen].len = (ntfs_cluster_t)0; - mft_na->d.r.len = old_data_rlen; - rl2_size = ((old_data_rlen + 1) * sizeof(ntfs_runlist) + PAGE_SIZE - - 1) & PAGE_MASK; - /* Reallocate memory freeing any extra memory allocated. */ - if (rl2_size < ((r2len * sizeof(ntfs_runlist) + PAGE_SIZE - 1) & - PAGE_MASK)) { - rl2 = ntfs_vmalloc(rl2_size); - if (rl2) { - ntfs_memcpy(rl2, mft_na->d.r.runlist, rl2_size); - ntfs_vfree(mft_na->d.r.runlist); - mft_na->d.r.runlist = rl2; - } else - ntfs_error(vol->sb, "Error reallocating " - "memory in error code path. This " - "should be harmless."); - } -undo_mftbmp_alloc_err_out: - ntfs_debug(DEBUG_OTHER, __FUNCTION__ "(): At " - "undo_mftbmp_alloc_err_out.\n"); - /* Deallocate the allocated bit in the mft bitmap. */ - io.param = buf; - io.size = 1; - io.do_read = 1; - err = ntfs_readwrite_attr(vol->mft_ino, mftbmp_na, bit >> 3, &io); - if (!err && io.size == 1) { - *buf &= ~(1 << (bit & 7)); - io.param = buf; - io.do_read = 0; - err = ntfs_readwrite_attr(vol->mft_ino, mftbmp_na, bit >> 3, &io); - } - if (err || io.size != 1) { - if (!err) - err = -EIO; - ntfs_error(vol->sb, "Error deallocating mft record in " - "error code path. You should run chkdsk."); - } -#endif } /** @@ -1541,7 +1451,8 @@ int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni) ni->mrec->flags &= ~MFT_RECORD_IN_USE; /* Increment the sequence number, skipping zero, if it is not zero. */ - old_seq_no = seq_no = le16_to_cpu(ni->mrec->sequence_number); + old_seq_no = ni->mrec->sequence_number; + seq_no = le16_to_cpu(old_seq_no); if (seq_no == 0xffff) seq_no = 1; else if (seq_no) @@ -1556,9 +1467,9 @@ int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni) } /* Clear the bit in the $MFT/$BITMAP corresponding to this record. */ - if (ntfs_bitmap_clear_run(vol->mftbmp_na, mft_no, 1)) { + if (ntfs_bitmap_clear_bit(vol->mftbmp_na, mft_no)) { err = errno; - // FIXME: If ntfs_bitmap_clear_run() guarantees atomicity on + // FIXME: If ntfs_bitmap_clear_run() guarantees rollback on // error, this could be changed to goto sync_rollback; goto bitmap_rollback; } @@ -1570,12 +1481,12 @@ int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni) /* Rollback what we did... */ bitmap_rollback: - if (ntfs_bitmap_set_run(vol->mftbmp_na, mft_no, 1)) + if (ntfs_bitmap_set_bit(vol->mftbmp_na, mft_no)) Dputs("Eeek! Rollback failed in ntfs_mft_record_free(). " "Leaving inconsistent metadata!"); sync_rollback: ni->mrec->flags |= MFT_RECORD_IN_USE; - ni->mrec->sequence_number = cpu_to_le16(old_seq_no); + ni->mrec->sequence_number = old_seq_no; ntfs_inode_mark_dirty(ni); errno = err; return -1; From 154d44ded54060de3091ebda83f9ae59204677dc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 15 Sep 2004 15:21:47 +0000 Subject: [PATCH 1861/2994] Finish off ntfs_mft_record_alloc() and its error handling. BKrev: 41485e0bcRs9SyABvxabHxuN3S8How From 21248874a3774405a3dd57057f329495d8f96df3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 15 Sep 2004 15:21:47 +0000 Subject: [PATCH 1862/2994] Update. (Logical change 1.554) --- ChangeLog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c356c2d6..8b032186 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,8 +16,8 @@ xx/xx/2004 - 2.0.0-WIP this. (Yura) - ntfsinfo: dump attribute list entries in verbose mode and display attribute instance of all attributes. (Yura) - - new API: attrlist.[ch]::ntfs_attrlist_entry_add add entry to attribute - list. (Yura) + - new API: attrlist.[ch]::ntfs_attrlist_entry_add add entry to + attribute list. (Yura) - ntfs_inode_sync: write out dirty attribute list from cache to disk. (Yura) - Add stop_vcn parameter to ntfs_mapping_pairs_build() and adapt @@ -25,6 +25,7 @@ xx/xx/2004 - 2.0.0-WIP pairs and then continuing in a different extent once the first extent is full. (Yura) - Remove vol->nr_mft_records and update all users. (Anton) + - Add new API to mft.[hc]::ntfs_mft_record_{alloc,free}(). (Anton) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 93f80966734a65e24147e6f195a486a18b29f369 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 08:18:52 +0000 Subject: [PATCH 1863/2994] Need to sync inodes before closing attributes or the umount fails. (Logical change 1.555) --- libntfs/volume.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libntfs/volume.c b/libntfs/volume.c index 15cf1124..167894c6 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -72,16 +72,22 @@ ntfs_volume *ntfs_volume_alloc(void) */ static void __ntfs_volume_release(ntfs_volume *v) { + if (v->lcnbmp_ni && NInoDirty(v->lcnbmp_ni)) + ntfs_inode_sync(v->lcnbmp_ni); if (v->lcnbmp_na) ntfs_attr_close(v->lcnbmp_na); if (v->lcnbmp_ni) ntfs_inode_close(v->lcnbmp_ni); + if (v->mft_ni && NInoDirty(v->mft_ni)) + ntfs_inode_sync(v->mft_ni); if (v->mftbmp_na) ntfs_attr_close(v->mftbmp_na); if (v->mft_na) ntfs_attr_close(v->mft_na); if (v->mft_ni) ntfs_inode_close(v->mft_ni); + if (v->mftmirr_ni && NInoDirty(v->mftmirr_ni)) + ntfs_inode_sync(v->mftmirr_ni); if (v->mftmirr_na) ntfs_attr_close(v->mftmirr_na); if (v->mftmirr_ni) From ea45fe28cb78a7f101fdcc23d2fb649fcd9b65fb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 08:18:52 +0000 Subject: [PATCH 1864/2994] Need to sync inodes before closing attributes or the umount fails. BKrev: 41494c6cf3xZ6_T22478nJ8L--eDIA From ba4192c33c3c6870d72bd996b42ad292c2c6102a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 08:19:32 +0000 Subject: [PATCH 1865/2994] Final fixes for ntfs_mft_record_alloc() that fell out from extensive testing. (Logical change 1.556) --- libntfs/mft.c | 68 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/libntfs/mft.c b/libntfs/mft.c index 13baa56d..9776b02c 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -404,15 +404,12 @@ static inline unsigned int ntfs_ffz(unsigned int word) */ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) { - s64 pass_end, ll, data_pos, pass_start, bit; + s64 pass_end, ll, data_pos, pass_start, ofs, bit; ntfs_attr *mftbmp_na; u8 *buf, *byte; unsigned int size; u8 pass, b; - buf = (u8*)malloc(PAGE_SIZE); - if (!buf) - return -1; mftbmp_na = vol->mftbmp_na; /* * Set the end of the pass making sure we do not overflow the mft @@ -420,9 +417,6 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) */ size = PAGE_SIZE; pass_end = vol->mft_na->allocated_size >> vol->mft_record_size_bits; - ll = pass_end >> 3; - if (size > ll) - size = ll; ll = mftbmp_na->initialized_size << 3; if (pass_end > ll) pass_end = ll; @@ -434,8 +428,16 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) if (data_pos >= pass_end) { data_pos = 24; pass = 2; + /* This happens on a freshly formatted volume. */ + if (data_pos >= pass_end) { + errno = ENOSPC; + return -1; + } } pass_start = data_pos; + buf = (u8*)malloc(PAGE_SIZE); + if (!buf) + return -1; ntfs_debug("Starting bitmap search: pass %u, pass_start 0x%llx, " "pass_end 0x%llx, data_pos 0x%llx.", pass, (long long)pass_start, (long long)pass_end, @@ -446,7 +448,12 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) #endif /* Loop until a free mft record is found. */ for (; pass <= 2; size = PAGE_SIZE) { - ll = ntfs_attr_pread(mftbmp_na, data_pos >> 3, size, buf); + /* Cap size to pass_end. */ + ofs = data_pos >> 3; + ll = ((pass_end + 7) >> 3) - ofs; + if (size > ll) + size = ll; + ll = ntfs_attr_pread(mftbmp_na, ofs, size, buf); if (ll < 0) { ntfs_error(vol->sb, "Failed to read mft bitmap " "attribute, aborting."); @@ -461,7 +468,7 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) data_pos &= ~7ull; ntfs_debug("Before inner for loop: size 0x%x, " "data_pos 0x%llx, bit 0x%llx, " - "*byte 0x%x, b %u.", size, + "*byte 0x%hhx, b %u.", size, (long long)data_pos, (long long)bit, byte ? *byte : -1, b); for (; bit < size && data_pos + bit < pass_end; @@ -478,7 +485,7 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) } ntfs_debug("After inner for loop: size 0x%x, " "data_pos 0x%llx, bit 0x%llx, " - "*byte 0x%x, b %u.", size, + "*byte 0x%hhx, b %u.", size, (long long)data_pos, (long long)bit, byte ? *byte : -1, b); data_pos += size; @@ -501,6 +508,8 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) ntfs_debug("pass %i, pass_start 0x%llx, pass_end " "0x%llx.", pass, (long long)pass_start, (long long)pass_end); + if (data_pos >= pass_end) + break; } } /* No free mft records in currently initialized mft bitmap. */ @@ -874,7 +883,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) * attribute cannot be zero so we are ok to do this. */ rl = ntfs_attr_find_vcn(mft_na, - (mft_na->allocated_size - 1) >> vol->cluster_size); + (mft_na->allocated_size - 1) >> vol->cluster_size_bits); if (!rl || !rl->length || rl->lcn < 0) { ntfs_error(vol->sb, "Failed to determine last allocated " "cluster of mft data attribute."); @@ -885,14 +894,13 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) lcn = rl->lcn + rl->length; ntfs_debug("Last lcn of mft data attribute is 0x%llx.", (long long)lcn); /* Minimum allocation is one mft record worth of clusters. */ - if (vol->mft_record_size <= vol->cluster_size) + min_nr = vol->mft_record_size >> vol->cluster_size_bits; + if (!min_nr) min_nr = 1; - else - min_nr = vol->mft_record_size >> vol->cluster_size_bits; /* Want to allocate 16 mft records worth of clusters. */ nr = vol->mft_record_size << 4 >> vol->cluster_size_bits; if (!nr) - nr = 1; + nr = min_nr; ntfs_debug("Trying mft data allocation with default cluster count " "%lli.", (long long)nr); old_last_vcn = rl[1].vcn; @@ -1161,7 +1169,7 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) ATTR_RECORD *a; ntfs_inode *ni; int err; - u16 seq_no; + u16 seq_no, usn; if (base_ni) ntfs_debug("Entering (allocating an extent mft record for " @@ -1331,7 +1339,8 @@ mft_rec_already_initialized: /* * We now have allocated and initialized the mft record. Need to read * it from disk and re-format it, preserving the sequence number if it - * is not zero. + * is not zero as well as the update sequence number if it is not zero + * or -1 (0xffff). */ m = (MFT_RECORD*)malloc(vol->mft_record_size); if (!m) { @@ -1340,16 +1349,36 @@ mft_rec_already_initialized: goto undo_mftbmp_alloc; } if (ntfs_mft_record_read(vol, bit, m)) { + err = errno; ntfs_error(vol->sb, "Failed to read mft record."); + free(m); + errno = err; + goto undo_mftbmp_alloc; + } + /* Sanity check that the mft record is really not in use. */ + if (ntfs_is_file_record(m->magic) && (m->flags & MFT_RECORD_IN_USE)) { + ntfs_error(vol->sb, "Mft record 0x%llx was marked unused in " + "mft bitmap but is marked used itself. " + "Corrupt filesystem or driver bug! " + "Run chkdsk immediately!", (long long)bit); + free(m); + errno = EIO; goto undo_mftbmp_alloc; } seq_no = m->sequence_number; + usn = *(u16*)((u8*)m + le16_to_cpu(m->usa_ofs)); if (ntfs_mft_record_layout(vol, bit, m)) { + err = errno; ntfs_error(vol->sb, "Failed to re-format mft record."); + free(m); + errno = err; goto undo_mftbmp_alloc; } if (le16_to_cpu(seq_no)) m->sequence_number = seq_no; + seq_no = le16_to_cpu(usn); + if (seq_no && seq_no != 0xffff) + *(u16*)((u8*)m + le16_to_cpu(m->usa_ofs)) = usn; /* Set the mft record itself in use. */ m->flags |= MFT_RECORD_IN_USE; /* Now need to open an ntfs inode for the mft record. */ @@ -1365,11 +1394,14 @@ mft_rec_already_initialized: ni->mrec = m; /* * If we are allocating an extent mft record, make the opened inode an - * extent inode and attach it to the base inode. + * extent inode and attach it to the base inode. Also, set the base + * mft record reference in the extent inode. */ if (base_ni) { ni->nr_extents = -1; ni->base_ni = base_ni; + m->base_mft_record = MK_LE_MREF(base_ni->mft_no, + le16_to_cpu(base_ni->mrec->sequence_number)); /* * Attach the extent inode to the base inode, reallocating * memory if needed. From 11b4d56de283355c67672e2d9d54428ac46c7c01 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 08:19:32 +0000 Subject: [PATCH 1866/2994] Final fixes for ntfs_mft_record_alloc() that fell out from extensive testing. BKrev: 41494c94eB_nDWV1ZAq9mlWHYWZxKA From 2b745a3542932eb815997fe573f9568ed8f694f1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 09:29:58 +0000 Subject: [PATCH 1867/2994] Write out dirty extent inodes in ntfs_inode_close() when closing a base inode. (Logical change 1.557) --- libntfs/inode.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 1a91a2cf..f75eb131 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -217,11 +217,13 @@ int ntfs_inode_close(ntfs_inode *ni) } /* Is this a base inode with mapped extent inodes? */ if (ni->nr_extents > 0) { - int i; - - // FIXME: Handle dirty case for each extent inode! (AIA) - for (i = 0; i < ni->nr_extents; i++) - __ntfs_inode_release(ni->extent_nis[i]); + while (ni->nr_extents > 0) { + if (ntfs_inode_close(ni->extent_nis[0])) { + if (errno != EIO) + errno = EBUSY; + return -1; + } + } free(ni->extent_nis); } else if (ni->nr_extents == -1) { ntfs_inode **tmp_nis; From 592856a9321f8282a55f07760b7d31bbfa34aac9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 09:29:58 +0000 Subject: [PATCH 1868/2994] Write out dirty extent inodes in ntfs_inode_close() when closing a base inode. BKrev: 41495d163mAAQakZ-2RbNfUsYgIMNA From 7b1e701f4585efc778e56d56cee98e02be8c8780 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 09:32:23 +0000 Subject: [PATCH 1869/2994] Add ntfsmftalloc to BK ignore. (Logical change 1.558) --- BitKeeper/etc/ignore | 1 + 1 file changed, 1 insertion(+) diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index debc6144..2347e2fc 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -49,6 +49,7 @@ ntfsprogs/ntfsfix ntfsprogs/ntfsinfo ntfsprogs/ntfslabel ntfsprogs/ntfsls +ntfsprogs/ntfsmftalloc ntfsprogs/ntfsmove ntfsprogs/ntfsresize ntfsprogs/ntfsrm From abf32ee7081376116f74a01f890c134443aa69cf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 09:32:23 +0000 Subject: [PATCH 1870/2994] Add ntfsmftalloc to extra build. (Logical change 1.558) --- ntfsprogs/Makefile.am | 6 +++++- ntfsprogs/Makefile.in | 20 ++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 50e13ee5..cda0f9c7 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -14,7 +14,7 @@ LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove \ - ntfsrm ntfscp + ntfsrm ntfscp ntfsmftalloc man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ @@ -78,6 +78,10 @@ ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) +ntfsmftalloc_SOURCES = ntfsmftalloc.c utils.c utils.h +ntfsmftalloc_LDADD = $(AM_LIBS) +ntfsmftalloc_LDFLAGS = $(AM_LFLAGS) + ntfsmove_SOURCES = ntfsmove.c ntfsmove.h utils.c utils.h ntfsmove_LDADD = $(AM_LIBS) ntfsmove_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index d208f630..cb3d1627 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) +SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmftalloc_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -45,7 +45,7 @@ sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) ntfswipe$(EXEEXT) \ ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) ntfsrm$(EXEEXT) \ - ntfscp$(EXEEXT) + ntfscp$(EXEEXT) ntfsmftalloc$(EXEEXT) subdir = ntfsprogs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/mkntfs.8.in $(srcdir)/ntfscat.8.in \ @@ -104,6 +104,9 @@ ntfslabel_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfsls_OBJECTS = ntfsls.$(OBJEXT) utils.$(OBJEXT) ntfsls_OBJECTS = $(am_ntfsls_OBJECTS) ntfsls_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfsmftalloc_OBJECTS = ntfsmftalloc.$(OBJEXT) utils.$(OBJEXT) +ntfsmftalloc_OBJECTS = $(am_ntfsmftalloc_OBJECTS) +ntfsmftalloc_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfsmove_OBJECTS = ntfsmove.$(OBJEXT) utils.$(OBJEXT) ntfsmove_OBJECTS = $(am_ntfsmove_OBJECTS) ntfsmove_DEPENDENCIES = $(am__DEPENDENCIES_1) @@ -136,14 +139,16 @@ SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) \ $(ntfscluster_SOURCES) $(ntfscp_SOURCES) \ $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ - $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ + $(ntfsmftalloc_SOURCES) $(ntfsmove_SOURCES) \ + $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ $(ntfswipe_SOURCES) DIST_SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) \ $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ - $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ + $(ntfsmftalloc_SOURCES) $(ntfsmove_SOURCES) \ + $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ $(ntfswipe_SOURCES) man8dir = $(mandir)/man8 @@ -319,6 +324,9 @@ ntfsrm_LDFLAGS = $(AM_LFLAGS) ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) +ntfsmftalloc_SOURCES = ntfsmftalloc.c utils.c utils.h +ntfsmftalloc_LDADD = $(AM_LIBS) +ntfsmftalloc_LDFLAGS = $(AM_LFLAGS) ntfsmove_SOURCES = ntfsmove.c ntfsmove.h utils.c utils.h ntfsmove_LDADD = $(AM_LIBS) ntfsmove_LDFLAGS = $(AM_LFLAGS) @@ -472,6 +480,9 @@ ntfslabel$(EXEEXT): $(ntfslabel_OBJECTS) $(ntfslabel_DEPENDENCIES) ntfsls$(EXEEXT): $(ntfsls_OBJECTS) $(ntfsls_DEPENDENCIES) @rm -f ntfsls$(EXEEXT) $(LINK) $(ntfsls_LDFLAGS) $(ntfsls_OBJECTS) $(ntfsls_LDADD) $(LIBS) +ntfsmftalloc$(EXEEXT): $(ntfsmftalloc_OBJECTS) $(ntfsmftalloc_DEPENDENCIES) + @rm -f ntfsmftalloc$(EXEEXT) + $(LINK) $(ntfsmftalloc_LDFLAGS) $(ntfsmftalloc_OBJECTS) $(ntfsmftalloc_LDADD) $(LIBS) ntfsmove$(EXEEXT): $(ntfsmove_OBJECTS) $(ntfsmove_DEPENDENCIES) @rm -f ntfsmove$(EXEEXT) $(LINK) $(ntfsmove_LDFLAGS) $(ntfsmove_OBJECTS) $(ntfsmove_LDADD) $(LIBS) @@ -510,6 +521,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsinfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfslabel.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsls.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmftalloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmove.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsresize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsrm.Po@am__quote@ From 6070d2444d812419a055b61319e16c5240bf620d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 09:32:23 +0000 Subject: [PATCH 1871/2994] Add ntfsmftalloc utility to the extra utilities to help test the mft record allocator. (Anton) BKrev: 41495da7KaNsz8r71SASgz4NItVHqg From 5d703b96364a127142cb1c08c4a1de6dd7df4bd9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 09:32:23 +0000 Subject: [PATCH 1872/2994] Initial revision --- ntfsprogs/ntfsmftalloc.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ntfsprogs/ntfsmftalloc.c diff --git a/ntfsprogs/ntfsmftalloc.c b/ntfsprogs/ntfsmftalloc.c new file mode 100644 index 00000000..e69de29b From 9c86b21e879d82753c25df9f08b29635a14dd13d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 09:32:23 +0000 Subject: [PATCH 1873/2994] (Logical change 1.558) --- ntfsprogs/ntfsmftalloc.c | 392 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 392 insertions(+) diff --git a/ntfsprogs/ntfsmftalloc.c b/ntfsprogs/ntfsmftalloc.c index e69de29b..e00b14bd 100644 --- a/ntfsprogs/ntfsmftalloc.c +++ b/ntfsprogs/ntfsmftalloc.c @@ -0,0 +1,392 @@ +/** + * ntfsmftalloc - Part of the Linux-NTFS project. + * + * Copyright (c) 2002-2003 Anton Altaparmakov + * + * This utility will allocate and initialize an mft record. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS source + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDARG_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_ERRNO_H +# include +#endif +#include +#ifdef HAVE_GETOPT_H +# include +#else + extern int optind; +#endif +#include +#ifndef LLONG_MAX +# define LLONG_MAX 9223372036854775807LL +#endif + +#include "types.h" +#include "attrib.h" +#include "inode.h" +#include "layout.h" +#include "volume.h" +#include "mft.h" +#include "utils.h" + +static const char *EXEC_NAME = "ntfsmftalloc"; + +/* Need these global so ntfsmftalloc_exit can access them. */ +static BOOL success = FALSE; + +static char *dev_name; + +static ntfs_volume *vol; +static ntfs_inode *ni = NULL; +static ntfs_inode *base_ni = NULL; +static s64 base_mft_no = -1; + +static struct { + /* -h, print usage and exit. */ + int no_action; /* -n, do not write to device, only display + what would be done. */ + int quiet; /* -q, quiet execution. */ + int verbose; /* -v, verbose execution, given twice, really + verbose execution (debug mode). */ + int force; /* -f, force allocation. */ + /* -V, print version and exit. */ +} opts; + +/** + * Dprintf - debugging output (-vv); overriden by quiet (-q) + */ +static void Dprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); +static void Dprintf(const char *fmt, ...) +{ + va_list ap; + + if (!opts.quiet && opts.verbose > 1) { + printf("DEBUG: "); + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + } +} + +/** + * Eprintf - error output; ignores quiet (-q) + */ +int Eprintf(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + return 0; +} + +/* Generate code for Vprintf() function: Verbose output (-v). */ +GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) + +/* Generate code for Qprintf() function: Quietable output (if not -q). */ +GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) + +/** + * err_exit - error output and terminate; ignores quiet (-q) + */ +static void err_exit(const char *fmt, ...) __attribute__((noreturn)) + __attribute__((format(printf, 1, 2))); +static void err_exit(const char *fmt, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "Aborting...\n"); + exit(1); +} + +/** + * copyright - print copyright statements + */ +static void copyright(void) +{ + fprintf(stderr, "Copyright (c) 2004 Anton Altaparmakov\n" + "Allocate and initialize a base or an extent mft " + "record.\n" + "If a base mft record is not specified, a base record " + "is allocated and initialized.\n" + "If a base mft record is specified, an extent mft " + "record is allocated and\n" + "initialized to point to the specified base mft " + "record.\n"); +} + +/** + * license - print licese statement + */ +static void license(void) +{ + fprintf(stderr, "%s", ntfs_gpl); +} + +/** + * usage - print a list of the parameters to the program + */ +void usage(void) __attribute__ ((noreturn)); +void usage (void) +{ + copyright(); + fprintf(stderr, "Usage: %s [options] device [base-mft-record]\n" + " -n Do not write to disk\n" + " -f Force execution despite errors\n" + " -q Quiet execution\n" + " -v Verbose execution\n" + " -vv Very verbose execution\n" + " -V Display version information\n" + " -l Display licensing information\n" + " -h Display this help\n", EXEC_NAME); + fprintf(stderr, "%s%s", ntfs_bugs, ntfs_home); + exit(1); +} + +/** + * parse_options + */ +static void parse_options(int argc, char *argv[]) +{ + long long ll; + char *s; + int c; + + if (argc && *argv) + EXEC_NAME = *argv; + fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); + while ((c = getopt(argc, argv, "fh?nqvVl")) != EOF) + switch (c) { + case 'f': + opts.force = 1; + break; + case 'n': + opts.no_action = 1; + break; + case 'q': + opts.quiet = 1; + break; + case 'v': + opts.verbose++; + break; + case 'V': + /* Version number already printed, so just exit. */ + exit(0); + case 'l': + copyright(); + license(); + exit(0); + case 'h': + case '?': + default: + usage(); + } + if (optind == argc) + usage(); + /* Get the device. */ + dev_name = argv[optind++]; + Dprintf("device name = %s\n", dev_name); + if (optind != argc) { + /* Get the base mft record number. */ + ll = strtoll(argv[optind++], &s, 0); + if (*s || !ll || (ll >= LLONG_MAX && errno == ERANGE)) + err_exit("Invalid base mft record number: %s\n", + argv[optind - 1]); + base_mft_no = ll; + Dprintf("base mft record number = 0x%llx\n", (long long)ll); + } + if (optind != argc) + usage(); +} + +/** + * dump_mft_record + */ +static void dump_mft_record(MFT_RECORD *m) +{ + ATTR_RECORD *a; + unsigned int u; + MFT_REF r; + + printf("-- Beginning dump of mft record. --\n"); + u = le32_to_cpu(m->magic); + printf("Mft record signature (magic) = %c%c%c%c\n", u & 0xff, + u >> 8 & 0xff, u >> 16 & 0xff, u >> 24 & 0xff); + u = le16_to_cpu(m->usa_ofs); + printf("Update sequence array offset = %u (0x%x)\n", u, u); + printf("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); + printf("$LogFile sequence number (lsn) = %llu\n", + (unsigned long long)le64_to_cpu(m->lsn)); + printf("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); + printf("Reference (hard link) count = %u\n", + le16_to_cpu(m->link_count)); + u = le16_to_cpu(m->attrs_offset); + printf("First attribute offset = %u (0x%x)\n", u, u); + printf("Flags = %u: ", le16_to_cpu(m->flags)); + if (m->flags & MFT_RECORD_IN_USE) + printf("MFT_RECORD_IN_USE"); + else + printf("MFT_RECORD_NOT_IN_USE"); + if (m->flags & MFT_RECORD_IS_DIRECTORY) + printf(" | MFT_RECORD_IS_DIRECTORY"); + printf("\n"); + u = le32_to_cpu(m->bytes_in_use); + printf("Bytes in use = %u (0x%x)\n", u, u); + u = le32_to_cpu(m->bytes_allocated); + printf("Bytes allocated = %u (0x%x)\n", u, u); + r = le64_to_cpu(m->base_mft_record); + printf("Base mft record reference:\n\tMft record number = %llu\n\t" + "Sequence number = %u\n", + (unsigned long long)MREF(r), MSEQNO(r)); + printf("Next attribute instance = %u\n", + le16_to_cpu(m->next_attr_instance)); + a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); + printf("-- Beginning dump of attributes within mft record. --\n"); + while ((char*)a < (char*)m + le32_to_cpu(m->bytes_in_use)) { + if (a->type == AT_END) + break; + a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); + }; + printf("-- End of attributes. --\n"); +} + +/** + * ntfsmftalloc_exit + */ +static void ntfsmftalloc_exit(void) +{ + if (success) + return; + /* If there is a base inode, close that instead of the extent inode. */ + if (base_ni) + ni = base_ni; + /* Close the inode. */ + if (ni && ntfs_inode_close(ni)) { + fprintf(stderr, "Warning: Failed to close inode 0x%llx: %s\n", + (long long)ni->mft_no, strerror(errno)); + } + /* Unmount the volume. */ + if (ntfs_umount(vol, 0) == -1) + fprintf(stderr, "Warning: Could not umount %s: %s\n", dev_name, + strerror(errno)); +} + +/** + * main + */ +int main(int argc, char **argv) +{ + unsigned long mnt_flags, ul; + int err; + + /* Initialize opts to zero / required values. */ + memset(&opts, 0, sizeof(opts)); + /* Parse command line options. */ + parse_options(argc, argv); + utils_set_locale(); + /* Make sure the file system is not mounted. */ + if (ntfs_check_if_mounted(dev_name, &mnt_flags)) + Eprintf("Failed to determine whether %s is mounted: %s\n", + dev_name, strerror(errno)); + else if (mnt_flags & NTFS_MF_MOUNTED) { + Eprintf("%s is mounted.\n", dev_name); + if (!opts.force) + err_exit("Refusing to run!\n"); + fprintf(stderr, "ntfsmftalloc forced anyway. Hope /etc/mtab " + "is incorrect.\n"); + } + /* Mount the device. */ + if (opts.no_action) { + Qprintf("Running in READ-ONLY mode!\n"); + ul = MS_RDONLY; + } else + ul = 0; + vol = ntfs_mount(dev_name, ul); + if (!vol) + err_exit("Failed to mount %s: %s\n", dev_name, strerror(errno)); + /* Register our exit function which will unlock and close the device. */ + err = atexit(&ntfsmftalloc_exit); + if (err == -1) { + Eprintf("Could not set up exit() function because atexit() " + "failed: %s Aborting...\n", strerror(errno)); + ntfsmftalloc_exit(); + exit(1); + } + if (base_mft_no != -1) { + base_ni = ntfs_inode_open(vol, base_mft_no); + if (!base_ni) + err_exit("Failed to open base inode 0x%llx: %s\n", + (long long)base_mft_no, + strerror(errno)); + } + /* Open the specified inode. */ + ni = ntfs_mft_record_alloc(vol, base_ni); + if (!ni) + err_exit("Failed to allocate mft record: %s\n", + strerror(errno)); + printf("Allocated %s mft record 0x%llx", base_ni ? "extent" : "base", + (long long)ni->mft_no); + if (base_ni) + printf(" with base mft record 0x%llx", + (long long)base_mft_no); + printf(".\n"); + if (!opts.quiet && opts.verbose > 1) { + Dprintf("Dumping allocated mft record 0x%llx:\n", + (long long)ni->mft_no); + dump_mft_record(ni->mrec); + } + /* Close the (base) inode. */ + if (base_ni) + ni = base_ni; + err = ntfs_inode_close(ni); + if (err) + err_exit("Failed to close inode 0x%llx: %s\n", + (long long)ni->mft_no, strerror(errno)); + /* Unmount the volume. */ + err = ntfs_umount(vol, 0); + /* Disable our ntfsmftalloc_exit() handler. */ + success = TRUE; + if (err == -1) + fprintf(stderr, "Warning: Failed to umount %s: %s\n", dev_name, + strerror(errno)); + else + Qprintf("ntfsmftalloc completed successfully.\n"); + return 0; +} From fe587b2319f0ca74dbbcbadf3afc029d47cc0ff2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 09:32:23 +0000 Subject: [PATCH 1874/2994] Update (Logical change 1.558) --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8b032186..15f43ff9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,11 @@ xx/xx/2004 - 2.0.0-WIP is full. (Yura) - Remove vol->nr_mft_records and update all users. (Anton) - Add new API to mft.[hc]::ntfs_mft_record_{alloc,free}(). (Anton) + - Sync inodes before closing attributes or the umount fails. (Anton) + - Write out dirty extent inodes in ntfs_inode_close() when closing a + base inode. (Anton) + - Add ntfsmftalloc utility to the extra utilities to help test the mft + record allocator. (Anton) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 307c09774e7bc4702d24c4469b594279741ad300 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 10:10:20 +0000 Subject: [PATCH 1875/2994] Fix bugs in handling of ->extent_nis in base inodes. (Logical change 1.559) --- libntfs/inode.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index f75eb131..6bbbb819 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -224,7 +224,6 @@ int ntfs_inode_close(ntfs_inode *ni) return -1; } } - free(ni->extent_nis); } else if (ni->nr_extents == -1) { ntfs_inode **tmp_nis; ntfs_inode *base_ni; @@ -247,11 +246,12 @@ int ntfs_inode_close(ntfs_inode *ni) /* Resize the memory buffer. */ tmp_nis = realloc(tmp_nis, base_ni->nr_extents * sizeof(ntfs_inode *)); - /* Ignore errors, they don't really matter. */ + /* Ignore realloc errors, they don't really matter. */ if (tmp_nis) base_ni->extent_nis = tmp_nis; /* Allow for error checking. */ i = -1; + break; } if (i != -1) Dputs("Extent inode was not attached to base inode! " @@ -339,7 +339,7 @@ ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref) extent_nis = (ntfs_inode**)malloc(i); if (!extent_nis) goto err_out; - if (base_ni->extent_nis) { + if (base_ni->nr_extents) { memcpy(extent_nis, base_ni->extent_nis, i - 4 * sizeof(ntfs_inode *)); free(base_ni->extent_nis); @@ -453,4 +453,3 @@ int ntfs_inode_sync(ntfs_inode *ni) errno = err; return -1; } - From 1d433b4804c5399eee38f8552448552e579f3dd6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 10:10:20 +0000 Subject: [PATCH 1876/2994] Fix bugs in handling of ->extent_nis in base inodes. BKrev: 4149668cub46ApUQaDgnHkoNBtZrow From 75bc06b8c71c28a015ffe5dd10550c8572e4c6a9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 10:10:20 +0000 Subject: [PATCH 1877/2994] Make output fit on 80-column-wide screen. (Logical change 1.559) --- ntfsprogs/ntfsmftalloc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfsmftalloc.c b/ntfsprogs/ntfsmftalloc.c index e00b14bd..5da3bbbc 100644 --- a/ntfsprogs/ntfsmftalloc.c +++ b/ntfsprogs/ntfsmftalloc.c @@ -143,12 +143,10 @@ static void copyright(void) { fprintf(stderr, "Copyright (c) 2004 Anton Altaparmakov\n" "Allocate and initialize a base or an extent mft " - "record.\n" - "If a base mft record is not specified, a base record " - "is allocated and initialized.\n" - "If a base mft record is specified, an extent mft " - "record is allocated and\n" - "initialized to point to the specified base mft " + "record. If a base mft record\nis not specified, a " + "base mft record is allocated and initialized. " + "Otherwise,\nan extent mft record is allocated and " + "initialized to point to the specified\nbase mft " "record.\n"); } From 87a450573cddfc8cc96c20da2ba3a8384441b19a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 10:22:11 +0000 Subject: [PATCH 1878/2994] ChangeLog: Update BKrev: 41496953dmLfNhvicuTcWkfNP6zSPw From 50e082c5e7ac83fd971572f54e3a27b049019177 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 10:22:11 +0000 Subject: [PATCH 1879/2994] Update (Logical change 1.560) --- ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15f43ff9..5f97a70d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,8 +27,8 @@ xx/xx/2004 - 2.0.0-WIP - Remove vol->nr_mft_records and update all users. (Anton) - Add new API to mft.[hc]::ntfs_mft_record_{alloc,free}(). (Anton) - Sync inodes before closing attributes or the umount fails. (Anton) - - Write out dirty extent inodes in ntfs_inode_close() when closing a - base inode. (Anton) + - Close extent inodes in ntfs_inode_close() when closing a base inode + and fix handling of ->extent_nis for base inodes. (Anton) - Add ntfsmftalloc utility to the extra utilities to help test the mft record allocator. (Anton) From 07b1e1a36119174f0939dda50f009f2f8436088d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 22:43:10 +0000 Subject: [PATCH 1880/2994] Add check for new attribute size being large enough to store the attribute length in ntfs_attr_rec_resize(). (Logical change 1.561) --- libntfs/attrib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index f49c8ee1..0cf56b07 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2258,7 +2258,8 @@ int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) /* Adjust @m to reflect the change in used space. */ m->bytes_in_use = cpu_to_le32(new_muse); /* Adjust @a to reflect the new size. */ - a->length = cpu_to_le32(new_size); + if (new_size >= offsetof(ATTR_REC, length) + sizeof(a->length)) + a->length = cpu_to_le32(new_size); } return 0; } From 8dde1ae7ba1dba0243e7d48a9094dfeddb168e11 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 22:43:10 +0000 Subject: [PATCH 1881/2994] Add offsetof() macro. (Logical change 1.561) --- include/ntfs/support.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/ntfs/support.h b/include/ntfs/support.h index a9e92cf7..ade65e08 100644 --- a/include/ntfs/support.h +++ b/include/ntfs/support.h @@ -46,6 +46,11 @@ #define max(a,b) ((a) >= (b) ? (a) : (b)) #endif +/* + * Useful macro for determining the offset of a struct member. + */ +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + /* * Simple bit operation macros. NOTE: These are NOT atomic. */ From e4220d109aa58cdc5cb97b9d581589efe75dc0a4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 22:43:10 +0000 Subject: [PATCH 1882/2994] Update (Logical change 1.561) --- ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5f97a70d..a46b4b7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,12 @@ xx/xx/2004 - 2.0.0-WIP and fix handling of ->extent_nis for base inodes. (Anton) - Add ntfsmftalloc utility to the extra utilities to help test the mft record allocator. (Anton) + - Fix ntfs_attr_record_resize() to cope with a newsize < 8. This means + you can call ntfs_attr_record_resize() with newsize = 0 to delete an + attribute record from its mft record but you would still need to + update the attribute list attribute if present. (Anton) + - Add the useful offsetof() macro to ntfs/support.h which returns the + offset of a structure element. (Anton) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 56c34f1d843aee83a206f3ee69e1641d3b748899 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 16 Sep 2004 22:43:10 +0000 Subject: [PATCH 1883/2994] attrib.c: Add check for new attribute size being large enough to store the attribute length in ntfs_attr_rec_resize(). support.h: Add offsetof() macro. BKrev: 414a16fe-gHs80ssPQL93LI7mXvkrg From dc152cd323794fdde3e876fb17a9856f5ad6f88b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 17 Sep 2004 16:07:04 +0000 Subject: [PATCH 1884/2994] - remove mref from ntfs_attrlist_entry_add prototype (Logical change 1.562) --- include/ntfs/attrlist.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/ntfs/attrlist.h b/include/ntfs/attrlist.h index cb9c0702..be53f068 100644 --- a/include/ntfs/attrlist.h +++ b/include/ntfs/attrlist.h @@ -26,8 +26,7 @@ #include "attrib.h" -extern int ntfs_attrlist_entry_add(ntfs_inode *ni, MFT_REF mref, - ATTR_RECORD *attr); +extern int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr); extern int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx); From 5a428e00fcbe550c4a1ced085bcf407d3029c4ad Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 17 Sep 2004 16:07:04 +0000 Subject: [PATCH 1885/2994] - remove mref from ntfs_attrlist_entry_add prototype and adapt code - fix stupid bug with unmapped runlist in ntfs_attrlist_entry_add - one stupid bug in ntfs_attrlist_entry_add: vcn is 64bit long (Logical change 1.562) --- libntfs/attrlist.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 3bd347fa..bfed1114 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -35,8 +35,7 @@ /** * ntfs_attrlist_entry_add - add an attribute list attribute entry - * @ni: opened ntfs inode, to which attribute list add entry - * @mref: mft reference of record where new attribute placed + * @ni: opened ntfs inode, which contains that attribute * @attr: attribute record to add to attribute list * * @mref should be in little endian, use MK_LE_MREF to build it. @@ -48,9 +47,10 @@ * ENOTSUP * EIO */ -int ntfs_attrlist_entry_add(ntfs_inode *ni, MFT_REF mref, ATTR_RECORD *attr) +int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) { ATTR_LIST_ENTRY *ale; + MFT_REF mref; ntfs_attr *na = NULL; u8 *new_al; int new_al_len; @@ -58,13 +58,15 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, MFT_REF mref, ATTR_RECORD *attr) int rl_size; int err; - Dprintf("%s(): Entering for inode 0x%llx, mref 0x%llx, attr 0x%x.\n", - __FUNCTION__, ni->mft_no, mref, attr->type); + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", + __FUNCTION__, ni->mft_no, attr->type); if (!ni || !attr) { errno = EINVAL; return -1; } + + mref = MK_LE_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number)); if (ni->nr_extents == -1) ni = ni->base_ni; @@ -100,11 +102,11 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, MFT_REF mref, ATTR_RECORD *attr) continue; if (err > 0) break; - if (sle16_to_cpu(ale->lowest_vcn) < - sle16_to_cpu(attr->lowest_vcn)) + if (sle64_to_cpu(ale->lowest_vcn) < + sle64_to_cpu(attr->lowest_vcn)) continue; - if (sle16_to_cpu(ale->lowest_vcn) == - sle16_to_cpu(attr->lowest_vcn)) { + if (sle64_to_cpu(ale->lowest_vcn) == + sle64_to_cpu(attr->lowest_vcn)) { err = EINVAL; Dprintf("%s(): Attribute with same type, name and " "lowest vcn already present in attribute " @@ -155,7 +157,15 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, MFT_REF mref, ATTR_RECORD *attr) /* Update ntfs inode. */ if (NAttrNonResident(na)) { - /* Get new runlist. */ + /* Create copy of new runlist. */ + if (ntfs_attr_map_whole_runlist(na)) { + Dprintf("%s(): Failed to map runlist.\n", __FUNCTION__); + if (ntfs_attr_truncate(na, ni->attr_list_size)) + Dprintf("%s(): Rollback failed. Leaving " + "inconsist metadata.\n", __FUNCTION__); + err = EIO; + goto err_out; + } for (rl = na->rl, rl_size = 1; rl->length; rl++) rl_size++; rl_size = (rl_size * sizeof(runlist_element) + 0xfff) & ~0xfff; From 4c66b37c29fcda3995fa34c8dd4d961a46c99875 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 17 Sep 2004 16:07:04 +0000 Subject: [PATCH 1886/2994] Merge 2004/09/17 19:05:41+03:00 (none)!yura libntfs/attrib.c - port ntfs_make_room_for_attr from mkntfs - add new API: ntfs_not_resident_attr_record_add - make ntfs_not_resident_attr_expand allocate new extent records (warning: there is no rollback at present, old is obsolete, so I removed it. I will write new rollback as soon as possible) libntfs/attrlist.c - remove mref from ntfs_attrlist_entry_add prototype and adapt code - fix stupid bug with unmapped runlist in ntfs_attrlist_entry_add - one stupid bug in ntfs_attrlist_entry_add: vcn is 64bit long BKrev: 414b0ba8h8uT2wLqBHPo7wYbRB28SA From 70bdd48d07abe7ff66468c839ffc493a30d90ebf Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 17 Sep 2004 16:07:04 +0000 Subject: [PATCH 1887/2994] SCCS merged 2004/09/17 19:05:41+03:00 (none)!yura - port ntfs_make_room_for_attr from mkntfs - add new API: ntfs_not_resident_attr_record_add - make ntfs_not_resident_attr_expand allocate new extent records (warning: there is no rollback at present, old is obsolete, so I removed it. I will write new rollback as soon as possible) (Logical change 1.562) --- libntfs/attrib.c | 286 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 226 insertions(+), 60 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 0cf56b07..e52565c6 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -31,6 +31,7 @@ #include "compat.h" #include "attrib.h" +#include "attrlist.h" #include "device.h" #include "mft.h" #include "debug.h" @@ -2221,6 +2222,148 @@ int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type) return -1; } +/** + * ntfs_make_room_for_attr - make room for an attribute inside an mft record + * @m: mft record + * @pos: position at which to make space + * @size: byte size to make available at this position + * + * @pos points to the attribute in front of which we want to make space. + * + * Return 0 on success or -1 on error. On error the error code is stored in + * errno. Possible error codes are: + * ENOSPC - There is not enough space available to complete operation. The + * caller has to make space before calling this. + * EINVAL - Input parameters were faulty. + */ +static int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) +{ + u32 biu; + + Dprintf("%s(): Entering for pos 0x%d, size %u.\n", + __FUNCTION__, (int)(pos - (u8*)m), size); + + /* Make size 8-byte aligment. */ + size = (size + 7) & ~7; + + /* Rigorous consistency checks. */ + if (!m || !pos || size < 0 || pos < (u8*)m || pos + size > + (u8*)m + le32_to_cpu(m->bytes_allocated)) { + errno = EINVAL; + return -1; + } + /* The -8 is for the attribute terminator. */ + if (pos - (u8*)m > (int)le32_to_cpu(m->bytes_in_use) - 8) { + errno = EINVAL; + return -1; + } + /* Nothing to do. */ + if (!size) + return 0; + + biu = le32_to_cpu(m->bytes_in_use); + /* Do we have enough space? */ + if (biu + size > le32_to_cpu(m->bytes_allocated)) { + errno = ENOSPC; + return -1; + } + /* Move everything after pos to pos + size. */ + memmove(pos + size, pos, biu - (pos - (u8*)m)); + /* Update mft record. */ + m->bytes_in_use = cpu_to_le32(biu + size); + return 0; +} + +/** + * ntfs_not_resident_attr_record_add - + * @ni: + * @type: + * @name: + * @name_len: + * @lowest_vcn: + * @dataruns_size: + * @flags: + * + * Return offset to attribute from the beginning of the mft record on success + * and NULL on error. On error the error code is stored in errno. + * Possible error codes are: + * EINVAL - + * EEXIST - + * EIO - + */ +int ntfs_not_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, + ntfschar *name, u8 name_len, VCN lowest_vcn, int dataruns_size, + ATTR_FLAGS flags) +{ + ntfs_attr_search_ctx *ctx; + u32 length; + ATTR_RECORD *a; + MFT_RECORD *m; + int err, offset; + + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn %lld, " + "dataruns_size %d, flags 0x%x.\n", __FUNCTION__, ni->mft_no, + type, lowest_vcn, dataruns_size, flags); + + if (!ni || dataruns_size <= 0) { + errno = EINVAL; + return -1; + } + + ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); + if (!ctx) + return -1; + if (!ntfs_attr_lookup(type, name, name_len, CASE_SENSITIVE, + lowest_vcn, NULL, 0, ctx)) { + err = EEXIST; + Dprintf("%s(): Attribute already present.\n", __FUNCTION__); + goto put_err_out; + } + if (errno != ENOENT) { + err = EIO; + goto put_err_out; + } + length = 0x40 + sizeof(ntfschar) * name_len + dataruns_size; + if (flags & ATTR_COMPRESSION_MASK) + length += 8; + if (ntfs_make_room_for_attr(ctx->mrec, (u8*) ctx->attr, length)) { + err = errno; + Dprintf("%s(): Failed to make room for attribute.\n", + __FUNCTION__); + goto put_err_out; + } + a = ctx->attr; + m = ctx->mrec; + offset = ((u8*)a - (u8*)m); + a->type = type; + a->length = cpu_to_le32(length); + a->non_resident = 1; + a->name_length = name_len; + a->name_offset = cpu_to_le16(length - dataruns_size - + sizeof(ntfschar) * name_len); + a->flags = flags; + a->instance = m->next_attr_instance; + a->lowest_vcn = cpu_to_le64(lowest_vcn); + a->mapping_pairs_offset = cpu_to_le16(length - dataruns_size); + a->compression_unit = (flags & ATTR_COMPRESSION_MASK) ? 4 : 0; + m->next_attr_instance = + cpu_to_le16(le16_to_cpu(m->next_attr_instance) + 1); + if (ntfs_attrlist_entry_add(ni, a)) { + err = errno; + ntfs_attr_record_resize(m, a, 0); + Dprintf("%s(): Failed add attribute entry to ATTRIBUTE_LIST.\n", + __FUNCTION__); + goto put_err_out; + } + ntfs_inode_mark_dirty(ni); + ntfs_attr_put_search_ctx(ctx); + return offset; +put_err_out: + ntfs_attr_put_search_ctx(ctx); + errno = err; + return -1; +} + /** * ntfs_attr_record_resize - resize an attribute record * @m: mft record containing attribute record @@ -3146,17 +3289,14 @@ put_err_out: */ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) { - int mft_changed = 0; - u8 *mft_rec_copy = NULL; - u32 mft_rec_copy_size = 0; LCN lcn_seek_from; - VCN first_free_vcn; + VCN first_free_vcn, stop_vcn; ntfs_volume *vol; ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; MFT_RECORD *m; runlist *rl, *rln; - u32 new_alen, new_muse; + ntfs_inode *ni; int err, mp_size, cur_max_mp_size, exp_max_mp_size; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, @@ -3284,51 +3424,53 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) } /* * Determine maximum possible length of mapping pairs, - * if we shall *not* expand space for mapping pairs + * if we shall *not* expand space for mapping pairs. */ cur_max_mp_size = le32_to_cpu(a->length) - le16_to_cpu(a->mapping_pairs_offset); /* - * Determine maximum possible length of mapping pairs, - * if we shall expand space for mapping pairs + * Determine maximum possible length of mapping pairs in the + * current mft record, if we shall expand space for mapping + * pairs. */ exp_max_mp_size = le32_to_cpu(m->bytes_allocated) - le32_to_cpu(m->bytes_in_use) + cur_max_mp_size; + /* Test mapping pairs for fitting in the current mft record. */ if (mp_size > exp_max_mp_size) { - if (na->type == AT_ATTRIBUTE_LIST) + /* + * Mapping pairs of $ATTRIBUTE_LIST attribute must fit + * in the base mft record. + */ + if (na->type == AT_ATTRIBUTE_LIST) { err = ENOSPC; - else { - err = ENOTSUP; - Dprintf("%s(): Eeek! Maping pairs size is " - "too big.\n", __FUNCTION__); + goto rollback; + } else { + /* Add attribute list, if it is not present. */ + if (!NInoAttrList(na->ni)) { + // FIXME: Add attribute list and retry. + Dprintf("%s(): Eeek! Adding of " + "$ATTRIBUTE_LIST not supported " + "yet. Sorry.\n", __FUNCTION__); + err = ENOTSUP; + goto rollback; + } else { + /* + * Set mapping pairs size to maximum + * possible for this mft record. We + * shall allocate new mft records for + * rest of mapping pairs. + */ + mp_size = exp_max_mp_size; + } } - goto rollback; } - /* Backup mft record. We need this for rollback. */ - mft_rec_copy_size = le32_to_cpu(m->bytes_in_use); - mft_rec_copy = malloc(mft_rec_copy_size); - if (!mft_rec_copy) { - err = ENOMEM; - Dprintf("%s(): Eeek! Not enough memory to " - "allocate %d bytes.\n", __FUNCTION__, - le32_to_cpu(m->bytes_in_use)); - goto rollback; - } - memcpy(mft_rec_copy, m, mft_rec_copy_size); - /* Expand space for mapping pairs if we need this. */ if (mp_size > cur_max_mp_size) { - /* - * Calculate the new attribute length and mft record - * bytes used. - */ - new_alen = (le16_to_cpu(a->mapping_pairs_offset) + - mp_size + 7) & ~7; - new_muse = le32_to_cpu(m->bytes_in_use) - - le32_to_cpu(a->length) + new_alen; - if (new_muse > le32_to_cpu(m->bytes_allocated)) { + if (ntfs_attr_record_resize(m, a, + le16_to_cpu(a->mapping_pairs_offset) + + mp_size)) { Dprintf("%s(): BUG! Ran out of space in" " mft record. Please run chkdsk" " and if that doesn't find any " @@ -3339,42 +3481,73 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) err = EIO; goto rollback; } - /* Move the following attributes making space. */ - memmove((u8*)a + new_alen, (u8*)a + - le32_to_cpu(a->length), - le32_to_cpu(m->bytes_in_use) - - ((u8*)a - (u8*)m) - - le32_to_cpu(a->length)); - /* Update the sizes of the attribute and mft records. */ - a->length = cpu_to_le32(new_alen); - m->bytes_in_use = cpu_to_le32(new_muse); } /* * Generate the new mapping pairs array directly into the * correct destination, i.e. the attribute record itself. + * If we ran out of space than allocate new MFT record, add + * attribute extent to it and continue generation. */ - if (ntfs_mapping_pairs_build(vol, (u8*)a + - le16_to_cpu(a->mapping_pairs_offset), mp_size, - na->rl, sle64_to_cpu(a->lowest_vcn), NULL)) { - err = errno; - Dprintf("%s(): BUG! Mapping pairs build " + stop_vcn = sle64_to_cpu(a->lowest_vcn); + ni = ctx->ntfs_ino; + while(ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( + a->mapping_pairs_offset), mp_size, na->rl, + stop_vcn, &stop_vcn)) { + if (errno != ENOSPC) { + err = errno; + Dprintf("%s(): BUG! Mapping pairs build " "failed. Please run chkdsk and if " "that doesn't find any errors please " "report you saw this message to " "linux-ntfs-dev@lists.sf.net.\n", __FUNCTION__); - mft_changed = 1; - goto rollback; + goto rollback; + } + a->highest_vcn = scpu_to_le64(stop_vcn - 1); + ntfs_inode_mark_dirty(ni); + + /* Calculate size of rest mapping pairs. */ + mp_size = ntfs_get_size_for_mapping_pairs(vol, + na->rl, stop_vcn); + + /* Allocate new mft record. */ + ni = ntfs_mft_record_alloc(vol, na->ni); + if (!ni) { + err = errno; + Dprintf("%s(): Couldn't allocate new MFT " + "record.\n", __FUNCTION__); + goto rollback; + } + m = ni->mrec; + /* + * If mapping size exceed avaible space, set them to + * possible maximum. + */ + cur_max_mp_size = le32_to_cpu(m->bytes_allocated) - + le32_to_cpu(m->bytes_in_use) - 0x40 - + sizeof(ntfschar) * na->name_len; + if (mp_size > cur_max_mp_size) + mp_size = cur_max_mp_size; + /* Add atribute extent to new record. */ + err = ntfs_not_resident_attr_record_add(ni, na->type, + na->name, na->name_len, stop_vcn, mp_size, 0); + if (err == -1) { + err = errno; + Dprintf("%s(): Couldn't add attribute extent " + "into the MFT record.\n", __FUNCTION__); + goto rollback; + } + a = (ATTR_RECORD*)((u8*)m + err); } /* * Reminder: We may not update a->highest_vcn if it equal to 0 * and attribute is single-extent. */ - if (a->highest_vcn) + if (a->lowest_vcn || a->highest_vcn) a->highest_vcn = scpu_to_le64(first_free_vcn - 1); - ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_inode_mark_dirty(ni); ntfs_attr_reinit_search_ctx(ctx); } @@ -3420,8 +3593,6 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) /* Set the inode dirty so it is written out later. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); /* Done! */ - if (mft_rec_copy) - free(mft_rec_copy); ntfs_attr_put_search_ctx(ctx); return 0; rollback: @@ -3441,12 +3612,7 @@ rollback: free(na->rl); na->rl = NULL; } - /* Restote mft record. */ - if (mft_changed) - memcpy(m, mft_rec_copy, mft_rec_copy_size); put_err_out: - if (mft_rec_copy) - free(mft_rec_copy); ntfs_attr_put_search_ctx(ctx); errno = err; return -1; From 6f222626bd44b431bffe55a732c4f1fc0ebb5802 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 17 Sep 2004 16:34:45 +0000 Subject: [PATCH 1888/2994] rename: ntfs_not_resident_attr_record_add -> ntfs_non_resident_attr_record_add ntfs_non_resident_attr_record_add: - add cheking for attribute can be non-resident - fixed bug: forgot copy name to attribute BKrev: 414b1225MaMTJrbt8-xVWXsidXIBSA From 921a40e14b5178ed5e54a382ddce739ccadbd9fa Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 17 Sep 2004 16:34:45 +0000 Subject: [PATCH 1889/2994] rename: ntfs_not_resident_attr_record_add -> ntfs_non_resident_attr_record_add ntfs_non_resident_attr_record_add: - add cheking for attribute can be non-resident - fixed bug: forgot copy name to attribute (Logical change 1.563) --- libntfs/attrib.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e52565c6..b99a38ab 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2275,7 +2275,7 @@ static int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) } /** - * ntfs_not_resident_attr_record_add - + * ntfs_non_resident_attr_record_add - * @ni: * @type: * @name: @@ -2291,7 +2291,7 @@ static int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) * EEXIST - * EIO - */ -int ntfs_not_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, +int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ntfschar *name, u8 name_len, VCN lowest_vcn, int dataruns_size, ATTR_FLAGS flags) { @@ -2310,6 +2310,18 @@ int ntfs_not_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, return -1; } + if (ntfs_attr_can_be_non_resident(ni->vol, type)) { + err = errno; + if (errno == EPERM) + Dprintf("%s(): Attribute can't be resident.\n", + __FUNCTION__); + else + Dprintf("%s(): ntfs_attr_can_be_non_resident failed.\n", + __FUNCTION__); + errno = err; + return -1; + } + ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); if (!ctx) return -1; @@ -2346,6 +2358,8 @@ int ntfs_not_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, a->lowest_vcn = cpu_to_le64(lowest_vcn); a->mapping_pairs_offset = cpu_to_le16(length - dataruns_size); a->compression_unit = (flags & ATTR_COMPRESSION_MASK) ? 4 : 0; + memcpy((u8*)a + le16_to_cpu(a->name_offset), name, + sizeof(ntfschar) * name_len); m->next_attr_instance = cpu_to_le16(le16_to_cpu(m->next_attr_instance) + 1); if (ntfs_attrlist_entry_add(ni, a)) { @@ -3529,7 +3543,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (mp_size > cur_max_mp_size) mp_size = cur_max_mp_size; /* Add atribute extent to new record. */ - err = ntfs_not_resident_attr_record_add(ni, na->type, + err = ntfs_non_resident_attr_record_add(ni, na->type, na->name, na->name_len, stop_vcn, mp_size, 0); if (err == -1) { err = errno; From 9be64ab8c79784ad17fbe68b11351d79d70a8a97 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 17 Sep 2004 17:32:25 +0000 Subject: [PATCH 1890/2994] fix name copying in ntfs_attrlist_entry_add() (Logical change 1.564) --- libntfs/attrlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index bfed1114..86fa6c25 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -133,7 +133,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) ale->lowest_vcn = attr->lowest_vcn; ale->mft_reference = mref; ale->instance = attr->instance; - memcpy(ale->name, (u8 *)attr + attr->name_length, attr->name_length); + memcpy(ale->name, (u8 *)attr + attr->name_offset, attr->name_length); /* Resize $ATTRIBUTE_LIST attribute. */ na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, 0, 0); From aa2b031d57bcfc5e2e65410d076cd12c5983c09c Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 17 Sep 2004 17:32:25 +0000 Subject: [PATCH 1891/2994] fix name copying in ntfs_attrlist_entry_add() BKrev: 414b1fa9vjCEx_P4F3qlJsuk5lcxSA From 8d7e4f38478bb4dbbd4717ef1e9368a3960c6b39 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 18 Sep 2004 16:40:46 +0000 Subject: [PATCH 1892/2994] some fixes (Logical change 1.565) --- libntfs/attrib.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index b99a38ab..e98af6c1 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2322,6 +2322,8 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, return -1; } + dataruns_size = (dataruns_size + 7) & ~7; + ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); if (!ctx) return -1; @@ -2358,10 +2360,11 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, a->lowest_vcn = cpu_to_le64(lowest_vcn); a->mapping_pairs_offset = cpu_to_le16(length - dataruns_size); a->compression_unit = (flags & ATTR_COMPRESSION_MASK) ? 4 : 0; - memcpy((u8*)a + le16_to_cpu(a->name_offset), name, - sizeof(ntfschar) * name_len); + if (name_len) + memcpy((u8*)a + le16_to_cpu(a->name_offset), + name, sizeof(ntfschar) * name_len); m->next_attr_instance = - cpu_to_le16(le16_to_cpu(m->next_attr_instance) + 1); + cpu_to_le16((le16_to_cpu(m->next_attr_instance) + 1) & 0xffff); if (ntfs_attrlist_entry_add(ni, a)) { err = errno; ntfs_attr_record_resize(m, a, 0); @@ -2397,6 +2400,7 @@ put_err_out: */ int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) { + Dprintf("%s(): Entering for new_size %u.\n", __FUNCTION__, new_size); /* Align to 8 bytes, just in case the caller hasn't. */ new_size = (new_size + 7) & ~7; /* If the actual attribute length has changed, move things around. */ @@ -3533,6 +3537,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto rollback; } m = ni->mrec; + /* Clean directory flag. */ + m->flags &= ~MFT_RECORD_IS_DIRECTORY; /* * If mapping size exceed avaible space, set them to * possible maximum. From 5218c4086ac88633bf6e4a526e00715ec21a3578 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 18 Sep 2004 16:40:46 +0000 Subject: [PATCH 1893/2994] some fixes BKrev: 414c650eSTmaZ1wlZW8uWH9SckwkqQ From 02bda1c69a5b2bcdfa065796b2473969a787cd6c Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 19 Sep 2004 14:39:47 +0000 Subject: [PATCH 1894/2994] - add ntfs_attr_record_rm - add rollback to ntfs_non_resident_attr_expand (Logical change 1.566) --- libntfs/attrib.c | 150 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 134 insertions(+), 16 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e98af6c1..7aac0c16 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2037,7 +2037,6 @@ void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx) /** * ntfs_attr_get_search_ctx - allocate/initialize a new attribute search context - * @ctx: address of pointer in which to return the new search context * @ni: ntfs inode with which to initialize the search context * @mrec: mft record with which to initialize the search context * @@ -2285,7 +2284,7 @@ static int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) * @flags: * * Return offset to attribute from the beginning of the mft record on success - * and NULL on error. On error the error code is stored in errno. + * and -1 on error. On error the error code is stored in errno. * Possible error codes are: * EINVAL - * EEXIST - @@ -2381,6 +2380,86 @@ put_err_out: return -1; } +/** + * ntfs_attr_record_rm - + * @ctx: + * + * User should reinit search context after use of this function if he/she wants + * use it anymore. + * + * Return 0 on success and -1 on error. On error the error code is stored in + * errno. Possible error codes are: + * EINVAL - + * EIO - + */ +int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { + ntfs_inode *base_ni, *ni; + ATTR_TYPES type; + int err; + + if (!ctx || !ctx->ntfs_ino || !ctx->mrec || !ctx->attr) { + errno = EINVAL; + return -1; + } + + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn " + "%lld.\n", __FUNCTION__, ctx->ntfs_ino->mft_no, + le32_to_cpu(ctx->attr->type), + le64_to_cpu(ctx->attr->lowest_vcn)); + type = ctx->attr->type; + ni = ctx->ntfs_ino; + if (ctx->base_ntfs_ino) + base_ni = ctx->base_ntfs_ino; + else + base_ni = ctx->ntfs_ino; + /* + * Remove record from $ATTRIBUTE_LIST if present and we don't want + * delete $ATTRIBUTE_LIST itself. + */ + if (NInoAttrList(base_ni) && type != AT_ATTRIBUTE_LIST) { + if (ntfs_attrlist_entry_rm(ctx)) { + err = errno; + Dprintf("%s(): Coudn't delete record from " + "$ATTRIBUTE_LIST.\n", __FUNCTION__); + errno = err; + return -1; + } + } + if (ntfs_attr_record_resize(ctx->mrec, ctx->attr, 0)) { + Dprintf("%s(): Coudn't remove attribute record. Bug or " + "damaged MFT record.\n", __FUNCTION__); + if (NInoAttrList(base_ni) && type != AT_ATTRIBUTE_LIST) + if (ntfs_attrlist_entry_add(ni, ctx->attr)) + Dprintf("%s(): Rollback failed. Leaving " + "inconsist metadata.\n", __FUNCTION__); + err = EIO; + return -1; + } + ntfs_inode_mark_dirty(ni); + if (type == AT_ATTRIBUTE_LIST) { + NInoClearAttrList(base_ni); + free(base_ni->attr_list); + free(base_ni->attr_list_rl); + } + if (le32_to_cpu(ctx->mrec->bytes_in_use) - + le16_to_cpu(ctx->mrec->attrs_offset) == 8) { + if (ntfs_mft_record_free(ni->vol, ni)) { + // FIXME: We need rollback here. + Dprintf("%s(): Coudn't free MFT record.\n", + __FUNCTION__); + errno = EIO; + return -1; + } + /* Remove done if we freed base inode. */ + if (ni == base_ni) + return 0; + } + if (type == AT_ATTRIBUTE_LIST || !NInoAttrList(base_ni)) + return 0; + // FIXME: Remove $ATTRIBUTE_LIST if no extents left or it is size == 0. + return 0; +} + /** * ntfs_attr_record_resize - resize an attribute record * @m: mft record containing attribute record @@ -3582,20 +3661,6 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) first_free_vcn) { Dprintf("%s(): Trying perform rollback.\n", __FUNCTION__); - ntfs_attr_reinit_search_ctx(ctx); - if (ntfs_attr_lookup(na->type, na->name, na->name_len, - 0, (na->allocated_size >> - vol->cluster_size_bits) - 1, - NULL, 0, ctx)) { - Dprintf("%s(): Eeek! Rollback failed. " - "Run chkdsk.\n", __FUNCTION__); - err = errno; - if (err == ENOENT) - err = EIO; - goto put_err_out; - } - a = ctx->attr; - m = ctx->mrec; goto rollback; } else goto put_err_out; @@ -3610,6 +3675,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) /* Update the attribute record and the ntfs attribute structure. */ na->data_size = newsize; a->data_size = scpu_to_le64(newsize); + na->initialized_size = newsize; + a->initialized_size = scpu_to_le64(newsize); /* Set the inode dirty so it is written out later. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); /* Done! */ @@ -3632,6 +3699,57 @@ rollback: free(na->rl); na->rl = NULL; } + ntfs_attr_reinit_search_ctx(ctx); + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, + (na->allocated_size >> vol->cluster_size_bits) - 1, + NULL, 0, ctx)) { + Dprintf("%s(): Eeek! Rollback failed. Run chkdsk.\n", + __FUNCTION__); + goto put_err_out; + } + a = ctx->attr; + m = ctx->mrec; + mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl, + sle64_to_cpu(a->lowest_vcn)); + if (mp_size <= 0) { + Dprintf("%s(): Eeek! Get size for mapping pairs failed. " + "Rollback failed. Run chkdsk.\n", __FUNCTION__); + goto put_err_out; + } + if (ntfs_attr_record_resize(m, a, + le16_to_cpu(a->mapping_pairs_offset) + mp_size)) { + Dprintf("%s(): Eeek! Attribuite record resize failed. Rollback " + "failed. Run chkdsk.\n", __FUNCTION__); + goto put_err_out; + } + if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( + a->mapping_pairs_offset), mp_size, na->rl, + sle64_to_cpu(a->lowest_vcn), 0)) { + Dprintf("%s(): Eeek! Mapping pairs build failed. Rollback " + "failed. Run chkdsk.\n", __FUNCTION__); + goto put_err_out; + } + if (a->lowest_vcn || a->highest_vcn) + a->highest_vcn = scpu_to_le64((na->allocated_size >> + vol->cluster_size_bits) - 1); + stop_vcn = 0; + while(!ntfs_attr_lookup(na->type, na->name, + na->name_len, 0, 0, NULL, 0, ctx)) { + if (stop_vcn > le64_to_cpu(ctx->attr->highest_vcn)) + continue; + stop_vcn = le64_to_cpu(ctx->attr->highest_vcn) + 1; + if (ntfs_attr_record_rm(ctx)) { + Dprintf("%s(): Eeek! Removing attribute extent failed. " + "Rollback failed. Run chkdsk.\n", __FUNCTION__); + goto put_err_out; + } + ntfs_attr_reinit_search_ctx(ctx); + } + if (errno != ENOENT) { + Dprintf("%s(): Eeek! Attribute extent lookup failed. Rollback " + "failed. Run chkdsk.\n", __FUNCTION__); + } else + Dprintf("%s(): Rollback success.\n", __FUNCTION__); put_err_out: ntfs_attr_put_search_ctx(ctx); errno = err; From 3337c4f57f73a6e2b6c7c89a9bbcbff49e8221c7 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 19 Sep 2004 14:39:47 +0000 Subject: [PATCH 1895/2994] - implement ntfs_attrlist_entry_rm (Logical change 1.566) --- libntfs/attrlist.c | 85 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 2 deletions(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 86fa6c25..38b6d07b 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -208,8 +208,89 @@ err_out: * * Return 0 on success and -1 on error with errno set to the error code. */ -int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx __attribute__((unused))) +int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) { - errno = ENOTSUP; + u8 *new_al; + int new_al_len; + ntfs_inode *base_ni; + ntfs_attr *na; + ATTR_LIST_ENTRY *ale; + runlist *rl, *rln; + int err; + + if (!ctx || !ctx->ntfs_ino || !ctx->attr || !ctx->al_entry) { + errno = EINVAL; + return -1; + } + + if (ctx->base_ntfs_ino) + base_ni = ctx->base_ntfs_ino; + else + base_ni = ctx->ntfs_ino; + ale = ctx->al_entry; + + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn " + "%lld.\n", __FUNCTION__, ctx->ntfs_ino->mft_no, + le32_to_cpu(ctx->attr->type), + le64_to_cpu(ctx->attr->lowest_vcn)); + + new_al_len = base_ni->attr_list_size - le16_to_cpu(ale->length); + new_al = malloc(new_al_len); + if (!new_al) { + Dprintf("%s(): Not enough memory.\n", __FUNCTION__); + errno = ENOMEM; + return -1; + } + memcpy(new_al, base_ni->attr_list, (u8*)ale - base_ni->attr_list); + memcpy(new_al + ((u8*)ale - base_ni->attr_list), (u8*)ale + le16_to_cpu( + ale->length), new_al_len - ((u8*)ale - base_ni->attr_list)); + + /* Resize $ATTRIBUTE_LIST attribute. */ + na = ntfs_attr_open(base_ni, AT_ATTRIBUTE_LIST, 0, 0); + if (!na) { + err = errno; + Dprintf("%s(): Coudn't open $ATTRIBUTE_LIST.\n", __FUNCTION__); + goto err_out; + } + if (ntfs_attr_truncate(na, new_al_len)) { + err = errno; + Dprintf("%s(): $ATTRIBUTE_LIST resize failed.\n", __FUNCTION__); + goto err_out; + } + + /* Update ntfs inode. */ + if (NAttrNonResident(na)) { + /* Create copy of new runlist. */ + if (ntfs_attr_map_whole_runlist(na)) { + Dprintf("%s(): Failed to map runlist.\n", __FUNCTION__); + if (ntfs_attr_truncate(na, base_ni->attr_list_size)) + Dprintf("%s(): Rollback failed. Leaving " + "inconsist metadata.\n", __FUNCTION__); + err = EIO; + goto err_out; + } + /* Assume that runlist shoudn't grow after resize. */ + for (rl = na->rl, rln = base_ni->attr_list_rl;; rl++, rln++) { + rln->vcn = rl->vcn; + rln->lcn = rl->lcn; + rln->length = rl->length; + if (!rl->length) + break; + } + NInoSetAttrListNonResident(base_ni); + } else + NInoClearAttrListNonResident(base_ni); + + free(base_ni->attr_list); + base_ni->attr_list = new_al; + base_ni->attr_list_size = new_al_len; + NInoAttrListSetDirty(base_ni); + return 0; + +err_out: + free(new_al); + if (na) + ntfs_attr_close(na); + errno = err; return -1; } From c30049a41ef6ac4512a587b4a0c15610024201dd Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 19 Sep 2004 14:39:47 +0000 Subject: [PATCH 1896/2994] - more debug output (Logical change 1.566) --- libntfs/inode.c | 21 ++++++++++++++++++--- libntfs/mft.c | 2 ++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 6bbbb819..b54b5e19 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -379,14 +379,16 @@ err_out: int ntfs_inode_sync(ntfs_inode *ni) { int err = 0; - + if (!ni) { errno = EINVAL; return -1; } + + Dprintf("%s(): Entring for inode 0x%llx.\n", __FUNCTION__, ni->mft_no); /* Write out attribute list from cache to disk. */ - if (NInoAttrListDirty(ni)) { + if (ni->nr_extents != -1 && NInoAttrListDirty(ni)) { ntfs_attr *na; na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, 0, 0); @@ -395,6 +397,8 @@ int ntfs_inode_sync(ntfs_inode *ni) err = errno; if (err != EIO) err = EBUSY; + Dprintf("%s(): Attribute list sync failed " + "(open failed).\n", __FUNCTION__); } } else { if (na->data_size == ni->attr_list_size) { @@ -405,11 +409,18 @@ int ntfs_inode_sync(ntfs_inode *ni) err = errno; if (err != EIO) err = EBUSY; + Dprintf("%s(): Attribute list " + "sync failed (write failed).\n", + __FUNCTION__); + } } else NInoAttrListClearDirty(ni); - } else + } else { err = EIO; + Dprintf("%s(): Attribute list sync failed " + "(invalid size).\n", __FUNCTION__); + } ntfs_attr_close(na); } } @@ -423,6 +434,8 @@ int ntfs_inode_sync(ntfs_inode *ni) err = EBUSY; } NInoSetDirty(ni); + Dprintf("%s(): Base MFT record sync failed.\n", + __FUNCTION__); } } @@ -443,6 +456,8 @@ int ntfs_inode_sync(ntfs_inode *ni) err = EBUSY; } NInoSetDirty(eni); + Dprintf("%s(): Extent MFT record sync " + "failed.\n", __FUNCTION__); } } } diff --git a/libntfs/mft.c b/libntfs/mft.c index 9776b02c..e2f60950 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -1470,6 +1470,8 @@ int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni) u64 mft_no; int err; u16 seq_no, old_seq_no; + + Dprintf("%s(): Entring for inode 0x%llx.\n", __FUNCTION__, ni->mft_no); if (!vol || !vol->mftbmp_na || !ni) { errno = EINVAL; From 21a7090b0563c04f9cdea4743e8ded1c5f2cafe3 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 19 Sep 2004 14:39:47 +0000 Subject: [PATCH 1897/2994] libntfs/attrib.c - add ntfs_attr_record_rm - add rollback to ntfs_non_resident_attr_expand libntfs/attrlist.c - implement ntfs_attrlist_entry_rm BKrev: 414d9a334g7JdLWOwzZEpfPjLmSY2Q From 3c5e052974815986d2b6441a5d986c784331bbcc Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 19 Sep 2004 18:59:25 +0000 Subject: [PATCH 1898/2994] Fix highest_vcn updating for ATTRIBUTE_LIST and small endian fix. (Logical change 1.567) --- libntfs/attrib.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 7aac0c16..455413d4 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2356,7 +2356,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, sizeof(ntfschar) * name_len); a->flags = flags; a->instance = m->next_attr_instance; - a->lowest_vcn = cpu_to_le64(lowest_vcn); + a->lowest_vcn = scpu_to_le64(lowest_vcn); a->mapping_pairs_offset = cpu_to_le16(length - dataruns_size); a->compression_unit = (flags & ATTR_COMPRESSION_MASK) ? 4 : 0; if (name_len) @@ -2738,10 +2738,11 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, /* Setup the fields specific to non-resident attributes. */ a->lowest_vcn = scpu_to_le64(0); - if (na->data_size != 0) - a->highest_vcn = scpu_to_le64(0); + if (na->type == AT_ATTRIBUTE_LIST) + a->highest_vcn = scpu_to_le64((new_allocated_size - 1) >> + vol->cluster_size_bits); else - a->highest_vcn = scpu_to_le64(-1); + a->highest_vcn = scpu_to_le64(0); a->mapping_pairs_offset = cpu_to_le16(mp_ofs); @@ -3259,10 +3260,11 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) } /* * Reminder: It is ok for a->highest_vcn to be -1 for zero - * length files. - * Reminder: We may not update a->highest_vcn if it equal to 0. + * length files. We may not update a->highest_vcn if it equal + * to 0 and attribute isn't $ATTRIBUTE_LIST and it is + * single-extent. */ - if (a->highest_vcn) + if (a->highest_vcn || a->type == AT_ATTRIBUTE_LIST) a->highest_vcn = scpu_to_le64(first_free_vcn - 1); /* Get the size for the new mapping pairs array. */ mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl, 0); @@ -3641,9 +3643,10 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) /* * Reminder: We may not update a->highest_vcn if it equal to 0 - * and attribute is single-extent. + * and attribute isn't $ATTRIBUTE_LIST and it is single-extent. */ - if (a->lowest_vcn || a->highest_vcn) + if (a->lowest_vcn || a->highest_vcn || + a->type == AT_ATTRIBUTE_LIST) a->highest_vcn = scpu_to_le64(first_free_vcn - 1); ntfs_inode_mark_dirty(ni); @@ -3729,7 +3732,7 @@ rollback: "failed. Run chkdsk.\n", __FUNCTION__); goto put_err_out; } - if (a->lowest_vcn || a->highest_vcn) + if (a->lowest_vcn || a->highest_vcn || a->type == AT_ATTRIBUTE_LIST) a->highest_vcn = scpu_to_le64((na->allocated_size >> vol->cluster_size_bits) - 1); stop_vcn = 0; From 1eea8a75f14826b7f5a22eaaec47f76ff9d6e979 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 19 Sep 2004 18:59:25 +0000 Subject: [PATCH 1899/2994] Fix highest_vcn updating for ATTRIBUTE_LIST and small fixes. BKrev: 414dd70dNqcHy2BV_SuAnBaODDCQJw From 332be40f05edba2fb5d6af603d7ccec1cf041a2e Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 19 Sep 2004 18:59:25 +0000 Subject: [PATCH 1900/2994] remove trainling spaces (Logical change 1.567) --- libntfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index b54b5e19..bdb87171 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -379,7 +379,7 @@ err_out: int ntfs_inode_sync(ntfs_inode *ni) { int err = 0; - + if (!ni) { errno = EINVAL; return -1; From 1fc3ddd8f400198c036b69f89ad01b081f8bd75b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 19 Sep 2004 19:30:37 +0000 Subject: [PATCH 1901/2994] ChangeLog Update include/ntfs/attrib.h Export ntfs_make_room_for_attr, ntfs_non_resident_attr_record_add and ntfs_attr_record_rm. libntfs/attrib.c Small update BKrev: 414dde5dkXXw_RpbqUSlgeoKjhY80w From cc15a373322fa5f75f8e209a8086dc85673a831a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 19 Sep 2004 19:30:37 +0000 Subject: [PATCH 1902/2994] Export ntfs_make_room_for_attr, ntfs_non_resident_attr_record_add and ntfs_attr_record_rm. (Logical change 1.568) --- include/ntfs/attrib.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index ccaceaca..ffe18bee 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -2,6 +2,7 @@ * attrib.h - Exports for attribute handling. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2004 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -272,9 +273,17 @@ extern int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type); extern int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type); + +extern int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size); extern int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size); +extern int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, + ntfschar *name, u8 name_len, VCN lowest_vcn, int dataruns_size, + ATTR_FLAGS flags); + +extern int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx); + extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, const u32 newsize); From 3aa1acaa90b999aa12a0e1e100612b7d5015fecd Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 19 Sep 2004 19:30:37 +0000 Subject: [PATCH 1903/2994] Small update (Logical change 1.568) --- libntfs/attrib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 455413d4..4df89290 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2235,7 +2235,7 @@ int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type) * caller has to make space before calling this. * EINVAL - Input parameters were faulty. */ -static int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) +int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) { u32 biu; @@ -2274,7 +2274,7 @@ static int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) } /** - * ntfs_non_resident_attr_record_add - + * ntfs_non_resident_attr_record_add - add extent of non-resident attribute * @ni: * @type: * @name: @@ -2381,7 +2381,7 @@ put_err_out: } /** - * ntfs_attr_record_rm - + * ntfs_attr_record_rm - remove attribute extent. * @ctx: * * User should reinit search context after use of this function if he/she wants From eba2ebee2c19dff2b4e3f104d0cf3ebd24a114f9 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 19 Sep 2004 19:30:37 +0000 Subject: [PATCH 1904/2994] Update (Logical change 1.568) --- ChangeLog | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a46b4b7b..7d7be85a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,9 +11,6 @@ xx/xx/2004 - 2.0.0-WIP error, because $INDEX_ALLOCATION can't be resident. (Yura) - ntfscp: Not longer update $FILE_NAME attributes, because Windows doesn't update them unless a rename operation occur. (Yura) - - Improvement to ntfs_non_resident_attr_expand: expand multi extent - attributes if we don't need to allocate new mft records to perform - this. (Yura) - ntfsinfo: dump attribute list entries in verbose mode and display attribute instance of all attributes. (Yura) - new API: attrlist.[ch]::ntfs_attrlist_entry_add add entry to @@ -37,6 +34,15 @@ xx/xx/2004 - 2.0.0-WIP update the attribute list attribute if present. (Anton) - Add the useful offsetof() macro to ntfs/support.h which returns the offset of a structure element. (Anton) + - New API: attrib.[ch]::ntfs_make_room_for_attr (it is ported from + mkntfs). (Yura) + - New API: attrib.[ch]::ntfs_non_resident_attr_record_add() and + attrib.[ch]::ntfs_attr_record_rm(). This is low-level functions to + manipulate attribute extents. (Yura) + - Improvement to ntfs_non_resident_attr_expand: now it can expand multi + extent attributes and allocate new MFT records if mapping mapirs + doesn't fit current. (Yura) + - Implement attrlist.[ch]::ntfs_attrlist_entry_rm(). (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From f725bfae326e142620d32cc9789f95cb7fcf9a90 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 20 Sep 2004 11:31:28 +0000 Subject: [PATCH 1905/2994] Attribute handling functions always update highest_vcn, if it was modified. (Logical change 1.569) --- libntfs/attrib.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 4df89290..a368954a 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2738,11 +2738,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, /* Setup the fields specific to non-resident attributes. */ a->lowest_vcn = scpu_to_le64(0); - if (na->type == AT_ATTRIBUTE_LIST) - a->highest_vcn = scpu_to_le64((new_allocated_size - 1) >> + a->highest_vcn = scpu_to_le64((new_allocated_size - 1) >> vol->cluster_size_bits); - else - a->highest_vcn = scpu_to_le64(0); a->mapping_pairs_offset = cpu_to_le16(mp_ofs); @@ -3258,14 +3255,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) goto put_err_out; } } - /* - * Reminder: It is ok for a->highest_vcn to be -1 for zero - * length files. We may not update a->highest_vcn if it equal - * to 0 and attribute isn't $ATTRIBUTE_LIST and it is - * single-extent. - */ - if (a->highest_vcn || a->type == AT_ATTRIBUTE_LIST) - a->highest_vcn = scpu_to_le64(first_free_vcn - 1); + a->highest_vcn = scpu_to_le64(first_free_vcn - 1); /* Get the size for the new mapping pairs array. */ mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl, 0); if (mp_size <= 0) { @@ -3640,15 +3630,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) } a = (ATTR_RECORD*)((u8*)m + err); } - - /* - * Reminder: We may not update a->highest_vcn if it equal to 0 - * and attribute isn't $ATTRIBUTE_LIST and it is single-extent. - */ - if (a->lowest_vcn || a->highest_vcn || - a->type == AT_ATTRIBUTE_LIST) - a->highest_vcn = scpu_to_le64(first_free_vcn - 1); - + a->highest_vcn = scpu_to_le64(first_free_vcn - 1); ntfs_inode_mark_dirty(ni); ntfs_attr_reinit_search_ctx(ctx); } @@ -3732,8 +3714,7 @@ rollback: "failed. Run chkdsk.\n", __FUNCTION__); goto put_err_out; } - if (a->lowest_vcn || a->highest_vcn || a->type == AT_ATTRIBUTE_LIST) - a->highest_vcn = scpu_to_le64((na->allocated_size >> + a->highest_vcn = scpu_to_le64((na->allocated_size >> vol->cluster_size_bits) - 1); stop_vcn = 0; while(!ntfs_attr_lookup(na->type, na->name, From 6df8562e4d417d330cb0ae45e0c35130a463c4cd Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 20 Sep 2004 11:31:28 +0000 Subject: [PATCH 1906/2994] Attribute handling functions always update highest_vcn, if it was modified. BKrev: 414ebf903MzP7itu-K5cf3MX-T-QFQ From edc3e448349082dc0dd139191ac9388e5e37282b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 20 Sep 2004 11:31:28 +0000 Subject: [PATCH 1907/2994] Update (Logical change 1.569) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7d7be85a..b38b5584 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,8 @@ xx/xx/2004 - 2.0.0-WIP extent attributes and allocate new MFT records if mapping mapirs doesn't fit current. (Yura) - Implement attrlist.[ch]::ntfs_attrlist_entry_rm(). (Yura) + - Attribute handling functions always update highest_vcn, if it was + modified. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From a70e77062212759a1526f3e59307a3138fd6ff56 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 14:46:38 +0000 Subject: [PATCH 1908/2994] - Add new API unistr.[hc]::ntfs_ucsndup(). (Anton) (Logical change 1.570) --- include/ntfs/unistr.h | 2 ++ libntfs/unistr.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/include/ntfs/unistr.h b/include/ntfs/unistr.h index 5e4a1a56..6aba7dec 100644 --- a/include/ntfs/unistr.h +++ b/include/ntfs/unistr.h @@ -44,6 +44,8 @@ extern int ntfs_ucsncasecmp(const ntfschar *s1, const ntfschar *s2, size_t n, extern u32 ntfs_ucsnlen(const ntfschar *s, u32 maxlen); +extern ntfschar *ntfs_ucsndup(const ntfschar *s, u32 maxlen); + extern void ntfs_name_upcase(ntfschar *name, u32 name_len, const ntfschar *upcase, const u32 upcase_len); diff --git a/libntfs/unistr.c b/libntfs/unistr.c index f14c8af2..443f68bf 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -254,6 +254,37 @@ u32 ntfs_ucsnlen(const ntfschar *s, u32 maxlen) return i; } +/** + * ntfs_ucsndup - duplicate little endian Unicode string + * @s: pointer to Unicode string + * @maxlen: maximum length of string @s + * + * Return a pointer to a new little endian Unicode string which is a duplicate + * of the string s. Memory for the new string is obtained with malloc(3), and + * can be freed with free(3). + * + * A maximum of @maxlen Unicode characters are copied and a terminating + * (ntfschar)'\0' little endian Unicode character is added. + * + * This function never looks beyond @s + @maxlen. + * + * Return a pointer to the new little endian Unicode string on success and NULL + * on failure with errno set to the error code. + */ +ntfschar *ntfs_ucsndup(const ntfschar *s, u32 maxlen) +{ + ntfschar *dst; + u32 len; + + len = ntfs_ucsnlen(s, maxlen); + dst = malloc((len + 1) * sizeof(ntfschar)); + if (dst) { + memcpy(dst, s, len * sizeof(ntfschar)); + dst[len] = cpu_to_le16(L'\0'); + } + return dst; +} + /** * ntfs_name_upcase */ From 48c44604f1ae8a5264ec553003a8f13ad7724dd3 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 14:46:38 +0000 Subject: [PATCH 1909/2994] - Add new API unistr.[hc]::ntfs_ucsndup(). (Anton) - Make libntfs/attrib.c::ntfs_attr_open() make a copy of the attribute name unless it is one of the internal names. (Anton) BKrev: 414eed4e-b-WtoHDDYoiR7AtbpBDuQ From 9f2f8ad3179a2dc229b07def724913e1354b6be6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 14:46:38 +0000 Subject: [PATCH 1910/2994] - Make ntfs_attr_open() make a copy of the attribute name unless it is one of the internal names. (Anton) (Logical change 1.570) --- libntfs/attrib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index a368954a..14ceb04e 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -341,6 +341,15 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, na = calloc(sizeof(ntfs_attr), 1); if (!na) return NULL; + if (name && name != AT_UNNAMED && name != I30) { + name = ntfs_ucsndup(name, name_len); + if (!name) { + err = errno; + free(na); + errno = err; + return NULL; + } + } __ntfs_attr_init(na, ni, type, name, name_len); ctx = ntfs_attr_get_search_ctx(ni, NULL); From 4a7a060f86a3086e5f155862c36c32d1ea0e086b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 14:46:38 +0000 Subject: [PATCH 1911/2994] Update (Logical change 1.570) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index b38b5584..c77165eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,6 +45,9 @@ xx/xx/2004 - 2.0.0-WIP - Implement attrlist.[ch]::ntfs_attrlist_entry_rm(). (Yura) - Attribute handling functions always update highest_vcn, if it was modified. (Yura) + - Add new API unistr.[hc]::ntfs_ucsndup(). (Anton) + - Make libntfs/attrib.c::ntfs_attr_open() make a copy of the attribute + name unless it is one of the internal names. (Anton) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 76fd9217b7b1117b63c855441a7cb3ed2e506318 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 14:57:26 +0000 Subject: [PATCH 1912/2994] Remove clearing of directory flag. It is zero. (Logical change 1.571) --- libntfs/attrib.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 14ceb04e..5f2b2210 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3617,8 +3617,6 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto rollback; } m = ni->mrec; - /* Clean directory flag. */ - m->flags &= ~MFT_RECORD_IS_DIRECTORY; /* * If mapping size exceed avaible space, set them to * possible maximum. From 510238c99a52adb1c2ff3523cab454f0d41fcf76 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 14:57:26 +0000 Subject: [PATCH 1913/2994] Remove clearing of directory flag. It is zero. BKrev: 414eefd6sHJMzZPWbGOMXuYfrxERHA From b83b08ec7333f4eff891e4ed23861793f41950ab Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 15:14:07 +0000 Subject: [PATCH 1914/2994] Clear attribute list dirty when clearing attr list presence. (Logical change 1.572) --- libntfs/attrib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 5f2b2210..26d8784c 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2447,6 +2447,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { ntfs_inode_mark_dirty(ni); if (type == AT_ATTRIBUTE_LIST) { NInoClearAttrList(base_ni); + NInoClearAttrListDirty(base_ni); free(base_ni->attr_list); free(base_ni->attr_list_rl); } From a241e062ac92d7404ee7a82ecf80dbe5e6d300de Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 15:14:07 +0000 Subject: [PATCH 1915/2994] Clear attribute list dirty when clearing attr list presence. BKrev: 414ef3bfUub5iXZoT0IA26ZPfBPI4g From 5356fc247d70e1c034324324b55e8fe3c2a2db14 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 15:27:55 +0000 Subject: [PATCH 1916/2994] - Only write out dirty attribute list if such is present. - Use TestAndClearDirty and SetDirty on error for concurency fix. (Logical change 1.573) --- libntfs/inode.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index bdb87171..da842c9e 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -388,7 +388,8 @@ int ntfs_inode_sync(ntfs_inode *ni) Dprintf("%s(): Entring for inode 0x%llx.\n", __FUNCTION__, ni->mft_no); /* Write out attribute list from cache to disk. */ - if (ni->nr_extents != -1 && NInoAttrListDirty(ni)) { + if (ni->nr_extents != -1 && NInoAttrList(ni) && + NInoAttrListTestAndClearDirty(ni)) { ntfs_attr *na; na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, 0, 0); @@ -400,6 +401,7 @@ int ntfs_inode_sync(ntfs_inode *ni) Dprintf("%s(): Attribute list sync failed " "(open failed).\n", __FUNCTION__); } + NInoAttrListSetDirty(ni); } else { if (na->data_size == ni->attr_list_size) { if (ntfs_attr_pwrite(na, 0, ni->attr_list_size, @@ -414,12 +416,13 @@ int ntfs_inode_sync(ntfs_inode *ni) __FUNCTION__); } - } else - NInoAttrListClearDirty(ni); + NInoAttrListSetDirty(ni); + } } else { err = EIO; Dprintf("%s(): Attribute list sync failed " "(invalid size).\n", __FUNCTION__); + NInoAttrListSetDirty(ni); } ntfs_attr_close(na); } From 1446547a5baf7c3c12cf72e85f6704761496f671 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 15:27:55 +0000 Subject: [PATCH 1917/2994] - Only write out dirty attribute list if such is present. - Use TestAndClearDirty and SetDirty on error for concurency fix. BKrev: 414ef6fbfY7Uifjubp81QHek-9TZBA From 3415c47df1f6157d60e8da9a2f6de8236d598837 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 15:27:55 +0000 Subject: [PATCH 1918/2994] Add NInoAttrListTestAndSetDirty() and TestAndClearDirty(). (Logical change 1.573) --- include/ntfs/inode.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index aeb8a85f..e3280c08 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -68,13 +68,20 @@ typedef enum { #define set_nino_al_flag(ni, flag) set_nino_flag(ni, AttrList##flag) #define clear_nino_al_flag(ni, flag) clear_nino_flag(ni, AttrList##flag) +#define test_and_set_nino_al_flag(ni, flag) \ + test_and_set_nino_flag(ni, AttrList##flag) +#define test_and_clear_nino_al_flag(ni, flag) \ + test_and_clear_nino_flag(ni, AttrList##flag) + #define NInoAttrListNonResident(ni) test_nino_al_flag(ni, NonResident) #define NInoSetAttrListNonResident(ni) set_nino_al_flag(ni, NonResident) #define NInoClearAttrListNonResident(ni) clear_nino_al_flag(ni, NonResident) -#define NInoAttrListDirty(ni) test_nino_al_flag(ni, Dirty) -#define NInoAttrListSetDirty(ni) set_nino_al_flag(ni, Dirty) -#define NInoAttrListClearDirty(ni) clear_nino_al_flag(ni, Dirty) +#define NInoAttrListDirty(ni) test_nino_al_flag(ni, Dirty) +#define NInoAttrListSetDirty(ni) set_nino_al_flag(ni, Dirty) +#define NInoAttrListClearDirty(ni) clear_nino_al_flag(ni, Dirty) +#define NInoAttrListTestAndSetDirty(ni) test_and_set_nino_al_flag(ni, Dirty) +#define NInoAttrListTestAndClearDirty(ni) test_and_clear_nino_al_flag(ni, Dirty) /* * The NTFS in-memory inode structure. It is just used as an extension to the From 47cc459e5b8e1dc930bcbc78f71babc78f3e938e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 15:27:55 +0000 Subject: [PATCH 1919/2994] Fix typo. (Logical change 1.573) --- libntfs/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 26d8784c..e0daecbd 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2447,7 +2447,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { ntfs_inode_mark_dirty(ni); if (type == AT_ATTRIBUTE_LIST) { NInoClearAttrList(base_ni); - NInoClearAttrListDirty(base_ni); + NInoAttrListClearDirty(base_ni); free(base_ni->attr_list); free(base_ni->attr_list_rl); } From 2bf52eb259c120993c0f7ddd8d0ece626f211c83 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 15:32:41 +0000 Subject: [PATCH 1920/2994] Fix warnings and endianness conversion errors. (Logical change 1.574) --- libntfs/attrib.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e0daecbd..9fcebc4b 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2255,8 +2255,8 @@ int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) size = (size + 7) & ~7; /* Rigorous consistency checks. */ - if (!m || !pos || size < 0 || pos < (u8*)m || pos + size > - (u8*)m + le32_to_cpu(m->bytes_allocated)) { + if (!m || !pos || pos < (u8*)m || pos + size > + (u8*)m + le32_to_cpu(m->bytes_allocated)) { errno = EINVAL; return -1; } @@ -3725,11 +3725,11 @@ rollback: a->highest_vcn = scpu_to_le64((na->allocated_size >> vol->cluster_size_bits) - 1); stop_vcn = 0; - while(!ntfs_attr_lookup(na->type, na->name, + while (!ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, ctx)) { - if (stop_vcn > le64_to_cpu(ctx->attr->highest_vcn)) + if (stop_vcn > sle64_to_cpu(ctx->attr->highest_vcn)) continue; - stop_vcn = le64_to_cpu(ctx->attr->highest_vcn) + 1; + stop_vcn = sle64_to_cpu(ctx->attr->highest_vcn) + 1; if (ntfs_attr_record_rm(ctx)) { Dprintf("%s(): Eeek! Removing attribute extent failed. " "Rollback failed. Run chkdsk.\n", __FUNCTION__); From dcdc79fd71f1b58a5d7049b91b1562844015df7e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 20 Sep 2004 15:32:41 +0000 Subject: [PATCH 1921/2994] Fix warnings and endianness conversion errors. BKrev: 414ef819T-8EpHmwk8-u9rlHouaMeg From 7443484bdcf7392dc50fb9931935811ef4287fd4 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 20 Sep 2004 17:29:50 +0000 Subject: [PATCH 1922/2994] - fix compiler warnings (Logical change 1.575) --- libntfs/attrlist.c | 8 ++++---- libntfs/inode.c | 3 ++- libntfs/mft.c | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 38b6d07b..71d0cc5a 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -59,7 +59,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) int err; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", - __FUNCTION__, ni->mft_no, attr->type); + __FUNCTION__, (long long) ni->mft_no, (unsigned) attr->type); if (!ni || !attr) { errno = EINVAL; @@ -230,9 +230,9 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) ale = ctx->al_entry; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn " - "%lld.\n", __FUNCTION__, ctx->ntfs_ino->mft_no, - le32_to_cpu(ctx->attr->type), - le64_to_cpu(ctx->attr->lowest_vcn)); + "%lld.\n", __FUNCTION__, (long long) ctx->ntfs_ino->mft_no, + (unsigned) le32_to_cpu(ctx->attr->type), + (long long) le64_to_cpu(ctx->attr->lowest_vcn)); new_al_len = base_ni->attr_list_size - le16_to_cpu(ale->length); new_al = malloc(new_al_len); diff --git a/libntfs/inode.c b/libntfs/inode.c index da842c9e..32e08f08 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -385,7 +385,8 @@ int ntfs_inode_sync(ntfs_inode *ni) return -1; } - Dprintf("%s(): Entring for inode 0x%llx.\n", __FUNCTION__, ni->mft_no); + Dprintf("%s(): Entering for inode 0x%llx.\n", + __FUNCTION__, (long long) ni->mft_no); /* Write out attribute list from cache to disk. */ if (ni->nr_extents != -1 && NInoAttrList(ni) && diff --git a/libntfs/mft.c b/libntfs/mft.c index e2f60950..ce447dbf 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -1471,7 +1471,8 @@ int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni) int err; u16 seq_no, old_seq_no; - Dprintf("%s(): Entring for inode 0x%llx.\n", __FUNCTION__, ni->mft_no); + Dprintf("%s(): Entering for inode 0x%llx.\n", + __FUNCTION__, (long long) ni->mft_no); if (!vol || !vol->mftbmp_na || !ni) { errno = EINVAL; From 92f4878951435a37d4260460e49c795826b6a7be Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 20 Sep 2004 17:29:50 +0000 Subject: [PATCH 1923/2994] - not update initialized size in ntfs_non_resident_attr_expand - fix compiler warnings (Logical change 1.575) --- libntfs/attrib.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 9fcebc4b..3a05ecd1 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2249,7 +2249,7 @@ int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) u32 biu; Dprintf("%s(): Entering for pos 0x%d, size %u.\n", - __FUNCTION__, (int)(pos - (u8*)m), size); + __FUNCTION__, (int)(pos - (u8*)m), (unsigned) size); /* Make size 8-byte aligment. */ size = (size + 7) & ~7; @@ -2310,8 +2310,9 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, int err, offset; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn %lld, " - "dataruns_size %d, flags 0x%x.\n", __FUNCTION__, ni->mft_no, - type, lowest_vcn, dataruns_size, flags); + "dataruns_size %d, flags 0x%x.\n", __FUNCTION__, + (long long) ni->mft_no, (unsigned) type, (long long) lowest_vcn, + dataruns_size, (unsigned) flags); if (!ni || dataruns_size <= 0) { errno = EINVAL; @@ -2412,9 +2413,9 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { } Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn " - "%lld.\n", __FUNCTION__, ctx->ntfs_ino->mft_no, - le32_to_cpu(ctx->attr->type), - le64_to_cpu(ctx->attr->lowest_vcn)); + "%lld.\n", __FUNCTION__, (long long) ctx->ntfs_ino->mft_no, + (unsigned) le32_to_cpu(ctx->attr->type), + (long long) sle64_to_cpu(ctx->attr->lowest_vcn)); type = ctx->attr->type; ni = ctx->ntfs_ino; if (ctx->base_ntfs_ino) @@ -2489,7 +2490,8 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { */ int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) { - Dprintf("%s(): Entering for new_size %u.\n", __FUNCTION__, new_size); + Dprintf("%s(): Entering for new_size %u.\n", + __FUNCTION__, (unsigned) new_size); /* Align to 8 bytes, just in case the caller hasn't. */ new_size = (new_size + 7) & ~7; /* If the actual attribute length has changed, move things around. */ @@ -3668,8 +3670,6 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) /* Update the attribute record and the ntfs attribute structure. */ na->data_size = newsize; a->data_size = scpu_to_le64(newsize); - na->initialized_size = newsize; - a->initialized_size = scpu_to_le64(newsize); /* Set the inode dirty so it is written out later. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); /* Done! */ From da83a15a1c08b12e6d07ef15f3f4a8a37e9df033 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 20 Sep 2004 17:29:50 +0000 Subject: [PATCH 1924/2994] - not update initialized size in ntfs_non_resident_attr_expand - fix compiler warnings BKrev: 414f138ewxm4G0dfx0lyMpyZzwAVZA From e461268d28db0a17b17b662391a39015c2718667 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 21 Sep 2004 12:10:39 +0000 Subject: [PATCH 1925/2994] No need to allocate a copy of the attribute name to be passed to ntfs_attr_open(). (Logical change 1.576) --- ntfsprogs/ntfsinfo.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index d30a0596..1f16d2af 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1178,59 +1178,40 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) get_type_and_size_of_indx(ni, attr, &type, &indx_record_size); - name = malloc(attr->name_length * sizeof(ntfschar)); - if (!name) { - perror("malloc failed"); - return; - } - memcpy(name, (u8 *)attr + attr->name_offset, - attr->name_length * sizeof(ntfschar)); + name = (ntfschar*)((u8*)attr + attr->name_offset); na = ntfs_attr_open(ni, AT_BITMAP, name, attr->name_length); if (!na) { perror("ntfs_attr_open failed"); - free(name); return; } bitmap = malloc(na->data_size); if (!bitmap) { perror("malloc failed"); - free(name); return; } if (ntfs_attr_pread(na, 0, na->data_size, bitmap) != na->data_size) { perror("ntfs_attr_pread failed"); free(bitmap); - free(name); return; } ntfs_attr_close(na); byte = bitmap; - name = malloc(attr->name_length * sizeof(ntfschar)); - if (!name) { - perror("malloc failed"); - return; - } - memcpy(name, (u8 *)attr + attr->name_offset, - attr->name_length * sizeof(ntfschar)); na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, name, attr->name_length); if (!na) { perror("ntfs_attr_open failed"); - free(name); free(bitmap); return; } allocation = malloc(na->data_size); if (!allocation) { perror("malloc failed"); - free(name); free(bitmap); return; } if (ntfs_attr_pread(na, 0, na->data_size, allocation) != na->data_size) { perror("ntfs_attr_pread failed"); - free(name); free(allocation); free(bitmap); return; From a8b99bcc355abedf80020541d3cc6968ad1499a4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 21 Sep 2004 12:10:39 +0000 Subject: [PATCH 1926/2994] No need to allocate a copy of the attribute name to be passed to ntfs_attr_open(). BKrev: 41501a3fHnVUJMGglXL696y8gQiNuA From acff9f4c43fa46bae441eb91d1ed9750c3672a15 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 21 Sep 2004 14:25:12 +0000 Subject: [PATCH 1927/2994] Minor updates ntfs_external_attr_find(). (Logical change 1.577) --- libntfs/attrib.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 3a05ecd1..67488436 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1307,9 +1307,15 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, * ntfs_attr_find() takes a search context @ctx as parameter and searches the * mft record specified by @ctx->mrec, beginning at @ctx->attr, for an * attribute of @type, optionally @name and @val. If found, ntfs_attr_find() - * returns 0 and @ctx->attr will point to the found attribute. If not found, - * ntfs_attr_find() returns -1, with errno set to the error code and @ctx->attr - * is undefined (i.e. do not rely on it not changing). + * returns 0 and @ctx->attr will point to the found attribute. + * + * If not found, ntfs_attr_find() returns -1, with errno set to ENOENT and + * @ctx->attr will point to the attribute before which the attribute being + * searched for would need to be inserted if such an action were to be desired. + * + * On actual error, ntfs_attr_find() returns -1 with errno set to the error + * code but not to ENOENT. In this case @ctx->attr is undefined and in + * particular do not rely on it not changing. * * If @ctx->is_first is TRUE, the search begins with @ctx->attr itself. If it * is FALSE, the search begins after @ctx->attr. @@ -1393,7 +1399,6 @@ static int ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, le32_to_cpu(ctx->mrec->bytes_allocated)) break; ctx->attr = a; - /* We catch $END with this more general check, too... */ if (((type != AT_UNUSED) && (le32_to_cpu(a->type) > le32_to_cpu(type))) || (a->type == AT_END)) { @@ -1583,8 +1588,9 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const ntfschar *name, /* First call happens with the base mft record. */ base_ni = ctx->base_ntfs_ino = ctx->ntfs_ino; ctx->base_mrec = ctx->mrec; - ctx->base_attr = ctx->attr; } + if (ni == base_ni) + ctx->base_attr = ctx->attr; if (type == AT_END) goto not_found; vol = base_ni->vol; From 528dcd3401786e3cb367d1a97816a0fc8d32cbfa Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 21 Sep 2004 14:25:12 +0000 Subject: [PATCH 1928/2994] Minor updates ntfs_external_attr_find(). BKrev: 415039c84awHHCAMTIvzV4afH7U3hA From bff0f300ffd525b0a2068b2de49e6a81b6c864e6 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 22 Sep 2004 19:22:40 +0000 Subject: [PATCH 1929/2994] fixes for attribute list handling (Logical change 1.578) --- libntfs/attrib.c | 7 +++++-- libntfs/attrlist.c | 24 ++++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 67488436..58a25c26 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2453,10 +2453,13 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { } ntfs_inode_mark_dirty(ni); if (type == AT_ATTRIBUTE_LIST) { + if (NInoAttrList(base_ni) && base_ni->attr_list) + free(base_ni->attr_list); + if (NInoAttrListNonResident(base_ni) && base_ni->attr_list_rl) + free(base_ni->attr_list_rl); NInoClearAttrList(base_ni); + NInoClearAttrListNonResident(base_ni); NInoAttrListClearDirty(base_ni); - free(base_ni->attr_list); - free(base_ni->attr_list_rl); } if (le32_to_cpu(ctx->mrec->bytes_in_use) - le16_to_cpu(ctx->mrec->attrs_offset) == 8) { diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 71d0cc5a..1764e497 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -179,13 +179,20 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) goto err_out; } memcpy(rl, na->rl, rl_size); - free(ni->attr_list_rl); + if (NInoAttrListNonResident(ni) && ni->attr_list_rl) + free(ni->attr_list_rl); ni->attr_list_rl = rl; NInoSetAttrListNonResident(ni); - } else - NInoClearAttrListNonResident(ni); + } else { + if (NInoAttrListNonResident(ni)) { + if (ni->attr_list_rl) + free(ni->attr_list_rl); + NInoClearAttrListNonResident(ni); + } + } - free(ni->attr_list); + if (ni->attr_list) + free(ni->attr_list); ni->attr_list = new_al; ni->attr_list_size = new_al_len; NInoAttrListSetDirty(ni); @@ -278,8 +285,13 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) break; } NInoSetAttrListNonResident(base_ni); - } else - NInoClearAttrListNonResident(base_ni); + } else { + if (NInoAttrListNonResident(base_ni)) { + if (base_ni->attr_list_rl) + free(base_ni->attr_list_rl); + NInoClearAttrListNonResident(base_ni); + } + } free(base_ni->attr_list); base_ni->attr_list = new_al; From 5df65f81b4b5ed101a40664370f3ce31a992a2e1 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 22 Sep 2004 19:22:40 +0000 Subject: [PATCH 1930/2994] fixes for attribute list handling BKrev: 4151d100khiVVozIQDZ6mpBDs1O2pA From 0f462c337ce60e3d6a08317a09a4ec5c20cacd2a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 25 Sep 2004 20:10:16 +0000 Subject: [PATCH 1931/2994] - Move out common part of ntfs_attrlist_entry_{add,rm} to new API: attrlist.[ch]::ntfs_attrlist_set. - Fixes and cleanups. (Logical change 1.579) --- libntfs/attrlist.c | 286 ++++++++++++++++++++++++--------------------- 1 file changed, 150 insertions(+), 136 deletions(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 1764e497..ddea3fe8 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -34,106 +34,36 @@ #include "unistr.h" /** - * ntfs_attrlist_entry_add - add an attribute list attribute entry - * @ni: opened ntfs inode, which contains that attribute - * @attr: attribute record to add to attribute list + * ntfs_attrlist_set - set new attribute list for ntfs inode + * @ni: opened ntfs inode attribute list set for + * @new_al: new attribute list + * @new_al_len: length of new attribute list * - * @mref should be in little endian, use MK_LE_MREF to build it. - * * Return 0 on success and -1 on error with errno set to the error code. The * following error codes are defined: - * EINVAL - * ENOMEM - * ENOTSUP - * EIO + * EINVAL - Invalid argumets passed to function. + * ENOMEM - Not enough memory to allocate necessary buffers. + * ENOTSUP - Code that required for set is not implemented yet. + * EIO - I/O error occured or damaged filesystem. */ -int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) +int ntfs_attrlist_set(ntfs_inode *ni, u8 *new_al, int new_al_len) { - ATTR_LIST_ENTRY *ale; - MFT_REF mref; ntfs_attr *na = NULL; - u8 *new_al; - int new_al_len; runlist *rl; int rl_size; int err; - - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", - __FUNCTION__, (long long) ni->mft_no, (unsigned) attr->type); - - if (!ni || !attr) { + + if (!ni || !new_al || new_al_len < 1) { + Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); errno = EINVAL; return -1; } - mref = MK_LE_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number)); - - if (ni->nr_extents == -1) - ni = ni->base_ni; - - new_al_len = (ni->attr_list_size + sizeof(ATTR_LIST_ENTRY) + - sizeof(ntfschar) * attr->name_length + 7) & ~7; - new_al = malloc(new_al_len); - if (!new_al) { - Dprintf("%s(): Not enough memory.\n", __FUNCTION__); - err = ENOMEM; - return -1; - } - - /* Find offset at which insert new entry. */ - ale = (ATTR_LIST_ENTRY *) ni->attr_list; - for(; (u8 *)ale < ni->attr_list + ni->attr_list_size; - ale = (ATTR_LIST_ENTRY *)((u8 *) ale + - le16_to_cpu(ale->length))) { - if (le32_to_cpu(ale->type) < le32_to_cpu(attr->type)) - continue; - if (le32_to_cpu(ale->type) > le32_to_cpu(attr->type)) - break; - err = ntfs_names_collate(ale->name, ale->name_length, - (ntfschar *)((u8 *)attr + attr->name_length), - attr->name_length, -2, CASE_SENSITIVE, 0, 0); - if (err == -2) { - err = EIO; - Dprintf("%s(): Corrupt attribute name. Run chkdsk.\n", - __FUNCTION__); - goto err_out; - } - if (err < 0) - continue; - if (err > 0) - break; - if (sle64_to_cpu(ale->lowest_vcn) < - sle64_to_cpu(attr->lowest_vcn)) - continue; - if (sle64_to_cpu(ale->lowest_vcn) == - sle64_to_cpu(attr->lowest_vcn)) { - err = EINVAL; - Dprintf("%s(): Attribute with same type, name and " - "lowest vcn already present in attribute " - "list.\n", __FUNCTION__); - goto err_out; - } - break; - } - - /* Copy entries from old attribute list to new. */ - memcpy(new_al, ni->attr_list, (u8 *)ale - ni->attr_list); - memcpy(new_al + new_al_len - ni->attr_list_size + ((u8 *)ale - - ni->attr_list), ale, ni->attr_list_size - - ((u8 *)ale - ni->attr_list)); - - /* Set pointer to new entry. */ - ale = (ATTR_LIST_ENTRY *)(new_al + ((u8 *)ale - ni->attr_list)); - - /* Fill new entry with values. */ - ale->type = attr->type; - ale->length = cpu_to_le16(new_al_len - ni->attr_list_size); - ale->name_length = attr->name_length; - ale->name_offset = (u8 *)ale->name - (u8 *)ale; - ale->lowest_vcn = attr->lowest_vcn; - ale->mft_reference = mref; - ale->instance = attr->instance; - memcpy(ale->name, (u8 *)attr + attr->name_offset, attr->name_length); + Dprintf("%s(): Entering for inode 0x%llx, new_al_len %d.\n", + __FUNCTION__, (long long) ni->mft_no, new_al_len); + + /* Make attribute list length 8 byte aligment. */ + new_al_len = (new_al_len + 7) & ~7; /* Resize $ATTRIBUTE_LIST attribute. */ na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, 0, 0); @@ -195,17 +125,136 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) free(ni->attr_list); ni->attr_list = new_al; ni->attr_list_size = new_al_len; + NInoSetAttrList(ni); NInoAttrListSetDirty(ni); return 0; - err_out: - free(new_al); if (na) ntfs_attr_close(na); errno = err; return -1; } +/** + * ntfs_attrlist_entry_add - add an attribute list attribute entry + * @ni: opened ntfs inode, which contains that attribute + * @attr: attribute record to add to attribute list + * + * Return 0 on success and -1 on error with errno set to the error code. The + * following error codes are defined: + * EINVAL - Invalid argumets passed to function. + * ENOMEM - Not enough memory to allocate necessary buffers. + * ENOTSUP - Code that required for set is not implemented yet. + * EIO - I/O error occured or damaged filesystem. + */ +int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) +{ + ATTR_LIST_ENTRY *ale; + MFT_REF mref; + u8 *new_al; + int new_al_len; + int err; + + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", + __FUNCTION__, (long long) ni->mft_no, (unsigned) attr->type); + + if (!ni || !attr) { + Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + mref = MK_LE_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number)); + + if (ni->nr_extents == -1) + ni = ni->base_ni; + + if (!NInoAttrList(ni)) { + Dprintf("%s(): Attribute list isn't present.\n", __FUNCTION__); + errno = ENOENT; + return -1; + } + + new_al_len = (ni->attr_list_size + sizeof(ATTR_LIST_ENTRY) + + sizeof(ntfschar) * attr->name_length + 7) & ~7; + new_al = malloc(new_al_len); + if (!new_al) { + Dprintf("%s(): Not enough memory.\n", __FUNCTION__); + err = ENOMEM; + return -1; + } + + /* Find offset at which insert new entry. */ + ale = (ATTR_LIST_ENTRY *) ni->attr_list; + for(; (u8 *)ale < ni->attr_list + ni->attr_list_size; + ale = (ATTR_LIST_ENTRY *)((u8 *) ale + + le16_to_cpu(ale->length))) { + if (le32_to_cpu(ale->type) < le32_to_cpu(attr->type)) + continue; + if (le32_to_cpu(ale->type) > le32_to_cpu(attr->type)) + break; + err = ntfs_names_collate(ale->name, ale->name_length, + (ntfschar *)((u8 *)attr + attr->name_length), + attr->name_length, -2, CASE_SENSITIVE, 0, 0); + if (err == -2) { + err = EIO; + Dprintf("%s(): Corrupt attribute name. Run chkdsk.\n", + __FUNCTION__); + goto err_out; + } + if (err < 0) + continue; + if (err > 0) + break; + if (sle64_to_cpu(ale->lowest_vcn) < + sle64_to_cpu(attr->lowest_vcn)) + continue; + if (sle64_to_cpu(ale->lowest_vcn) == + sle64_to_cpu(attr->lowest_vcn)) { + err = EINVAL; + Dprintf("%s(): Attribute with same type, name and " + "lowest vcn already present in attribute " + "list.\n", __FUNCTION__); + goto err_out; + } + break; + } + + /* Copy entries from old attribute list to new. */ + memcpy(new_al, ni->attr_list, (u8 *)ale - ni->attr_list); + memcpy(new_al + new_al_len - ni->attr_list_size + ((u8 *)ale - + ni->attr_list), ale, ni->attr_list_size - + ((u8 *)ale - ni->attr_list)); + + /* Set pointer to new entry. */ + ale = (ATTR_LIST_ENTRY *)(new_al + ((u8 *)ale - ni->attr_list)); + + /* Fill new entry with values. */ + ale->type = attr->type; + ale->length = cpu_to_le16(new_al_len - ni->attr_list_size); + ale->name_length = attr->name_length; + ale->name_offset = (u8 *)ale->name - (u8 *)ale; + if (attr->non_resident) + ale->lowest_vcn = attr->lowest_vcn; + else + ale->lowest_vcn = 0; + ale->mft_reference = mref; + ale->instance = attr->instance; + memcpy(ale->name, (u8 *)attr + attr->name_offset, attr->name_length); + + /* Set new runlist. */ + if (ntfs_attrlist_set(ni, new_al, new_al_len)) { + err = errno; + goto err_out; + } + + return 0; +err_out: + free(new_al); + errno = err; + return -1; +} + /** * ntfs_attrlist_entry_rm - remove an attribute list attribute entry * @ctx: attribute search context describing the attrubute list entry @@ -220,12 +269,11 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) u8 *new_al; int new_al_len; ntfs_inode *base_ni; - ntfs_attr *na; ATTR_LIST_ENTRY *ale; - runlist *rl, *rln; int err; if (!ctx || !ctx->ntfs_ino || !ctx->attr || !ctx->al_entry) { + Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -241,6 +289,13 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) (unsigned) le32_to_cpu(ctx->attr->type), (long long) le64_to_cpu(ctx->attr->lowest_vcn)); + if (!NInoAttrList(base_ni)) { + Dprintf("%s(): Attribute list isn't present.\n", __FUNCTION__); + errno = ENOENT; + return -1; + } + + /* Allocate memory for new attribute list. */ new_al_len = base_ni->attr_list_size - le16_to_cpu(ale->length); new_al = malloc(new_al_len); if (!new_al) { @@ -248,61 +303,20 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) errno = ENOMEM; return -1; } + + /* Copy entries from old attribute list to new. */ memcpy(new_al, base_ni->attr_list, (u8*)ale - base_ni->attr_list); memcpy(new_al + ((u8*)ale - base_ni->attr_list), (u8*)ale + le16_to_cpu( ale->length), new_al_len - ((u8*)ale - base_ni->attr_list)); - /* Resize $ATTRIBUTE_LIST attribute. */ - na = ntfs_attr_open(base_ni, AT_ATTRIBUTE_LIST, 0, 0); - if (!na) { + /* Set new runlist. */ + if (ntfs_attrlist_set(base_ni, new_al, new_al_len)) { err = errno; - Dprintf("%s(): Coudn't open $ATTRIBUTE_LIST.\n", __FUNCTION__); goto err_out; } - if (ntfs_attr_truncate(na, new_al_len)) { - err = errno; - Dprintf("%s(): $ATTRIBUTE_LIST resize failed.\n", __FUNCTION__); - goto err_out; - } - - /* Update ntfs inode. */ - if (NAttrNonResident(na)) { - /* Create copy of new runlist. */ - if (ntfs_attr_map_whole_runlist(na)) { - Dprintf("%s(): Failed to map runlist.\n", __FUNCTION__); - if (ntfs_attr_truncate(na, base_ni->attr_list_size)) - Dprintf("%s(): Rollback failed. Leaving " - "inconsist metadata.\n", __FUNCTION__); - err = EIO; - goto err_out; - } - /* Assume that runlist shoudn't grow after resize. */ - for (rl = na->rl, rln = base_ni->attr_list_rl;; rl++, rln++) { - rln->vcn = rl->vcn; - rln->lcn = rl->lcn; - rln->length = rl->length; - if (!rl->length) - break; - } - NInoSetAttrListNonResident(base_ni); - } else { - if (NInoAttrListNonResident(base_ni)) { - if (base_ni->attr_list_rl) - free(base_ni->attr_list_rl); - NInoClearAttrListNonResident(base_ni); - } - } - - free(base_ni->attr_list); - base_ni->attr_list = new_al; - base_ni->attr_list_size = new_al_len; - NInoAttrListSetDirty(base_ni); return 0; - err_out: free(new_al); - if (na) - ntfs_attr_close(na); errno = err; return -1; } From 03e0ea814baeb2a3a68ea7351ddad8f719069988 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 25 Sep 2004 20:10:16 +0000 Subject: [PATCH 1932/2994] - Move out common part of ntfs_attrlist_entry_{add,rm} to new API: attrlist.[ch]::ntfs_attrlist_set. - New API: attrib.[ch]::ntfs_resident_attr_record_add. - New API: inode.[ch]::ntfs_inode_add_attrlist. - Update ntfs_non_resident_attr_expand to use ntfs_inode_add_attrlist. - Fixes and cleanups. BKrev: 4155d0a843h4sN5M00iw90cHNdqjGg From 7428b93f99a6c98cb04de117e5302b489b9c7484 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 25 Sep 2004 20:10:16 +0000 Subject: [PATCH 1933/2994] - New API: attrib.[ch]::ntfs_resident_attr_record_add. - Update ntfs_non_resident_attr_expand to use ntfs_inode_add_attrlist. - Fixes and cleanups. (Logical change 1.579) --- libntfs/attrib.c | 222 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 177 insertions(+), 45 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 58a25c26..f6695c48 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2246,9 +2246,9 @@ int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type) * * Return 0 on success or -1 on error. On error the error code is stored in * errno. Possible error codes are: - * ENOSPC - There is not enough space available to complete operation. The - * caller has to make space before calling this. - * EINVAL - Input parameters were faulty. + * ENOSPC - There is not enough space available to complete operation. The + * caller has to make space before calling this. + * EINVAL - Input parameters were faulty. */ int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) { @@ -2289,21 +2289,129 @@ int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) } /** - * ntfs_non_resident_attr_record_add - add extent of non-resident attribute - * @ni: - * @type: - * @name: - * @name_len: - * @lowest_vcn: - * @dataruns_size: - * @flags: + * ntfs_resident_attr_record_add - add resident attribute to inode + * @ni: opened ntfs inode to which MFT record add attribute + * @type: type of the new attribute + * @name: name of the new attribute + * @name_len: name length of the new attribute + * @flags: flags of the new attribute * * Return offset to attribute from the beginning of the mft record on success * and -1 on error. On error the error code is stored in errno. * Possible error codes are: - * EINVAL - - * EEXIST - - * EIO - + * EINVAL - Invalid argumets passed to function. + * EEXIST - Attribute of such type and with same name already exists. + * EIO - I/O error occured or damaged filesystem. + */ +int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, + ntfschar *name, u8 name_len, ATTR_FLAGS flags) +{ + ntfs_attr_search_ctx *ctx; + u32 length; + ATTR_RECORD *a; + MFT_RECORD *m; + int err, offset; + ntfs_inode *base_ni; + + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, flags 0x%x.\n", + __FUNCTION__, (long long) ni->mft_no, (unsigned) type, + (unsigned) flags); + + if (!ni || (!name && name_len)) { + errno = EINVAL; + return -1; + } + + if (ntfs_attr_can_be_resident(ni->vol, type)) { + err = errno; + if (errno == EPERM) + Dprintf("%s(): Attribute can't be resident.\n", + __FUNCTION__); + else + Dprintf("%s(): ntfs_attr_can_be_resident failed.\n", + __FUNCTION__); + errno = err; + return -1; + } + + ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); + if (!ctx) + return -1; + if (!ntfs_attr_lookup(type, name, name_len, + CASE_SENSITIVE, 0, NULL, 0, ctx)) { + err = EEXIST; + Dprintf("%s(): Attribute already present.\n", __FUNCTION__); + goto put_err_out; + } + if (errno != ENOENT) { + err = EIO; + goto put_err_out; + } + length = (0x18 + sizeof(ntfschar) * name_len + 7) & ~7; + if (ntfs_make_room_for_attr(ctx->mrec, (u8*) ctx->attr, length)) { + err = errno; + Dprintf("%s(): Failed to make room for attribute.\n", + __FUNCTION__); + goto put_err_out; + } + a = ctx->attr; + m = ctx->mrec; + offset = ((u8*)a - (u8*)m); + a->type = type; + a->length = cpu_to_le32(length); + a->non_resident = 0; + a->name_length = name_len; + a->name_offset = cpu_to_le16(0x18); + a->flags = flags; + a->instance = m->next_attr_instance; + a->value_length = 0; + a->value_offset = cpu_to_le16(length); + a->resident_flags = 0; + + if (name_len) + memcpy((u8*)a + le16_to_cpu(a->name_offset), + name, sizeof(ntfschar) * name_len); + m->next_attr_instance = + cpu_to_le16((le16_to_cpu(m->next_attr_instance) + 1) & 0xffff); + if (ni->nr_extents == -1) + base_ni = ni->base_ni; + else + base_ni = ni; + if (NInoAttrList(base_ni)) { + if (ntfs_attrlist_entry_add(ni, a)) { + err = errno; + ntfs_attr_record_resize(m, a, 0); + Dprintf("%s(): Failed add attribute entry to " + "ATTRIBUTE_LIST.\n", __FUNCTION__); + goto put_err_out; + } + } + ntfs_inode_mark_dirty(ni); + ntfs_attr_put_search_ctx(ctx); + return offset; +put_err_out: + ntfs_attr_put_search_ctx(ctx); + errno = err; + return -1; +} + +/** + * ntfs_non_resident_attr_record_add - add extent of non-resident attribute + * @ni: opened ntfs inode to which MFT record add attribute + * @type: type of the new attribute extent + * @name: name of the new attribute extent + * @name_len: name length of the new attribute extent + * @lowest_vcn: lowest vcn of the new attribute extent + * @dataruns_size: dataruns size of the new attribute extent + * @flags: flags of the new attribute extent + * + * Return offset to attribute from the beginning of the mft record on success + * and -1 on error. On error the error code is stored in errno. + * Possible error codes are: + * EINVAL - Invalid argumets passed to function. + * EEXIST - Attribute of such type, with same lowest vcn and with same + * name already exists. + * EIO - I/O error occured or damaged filesystem. */ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ntfschar *name, u8 name_len, VCN lowest_vcn, int dataruns_size, @@ -2313,6 +2421,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, u32 length; ATTR_RECORD *a; MFT_RECORD *m; + ntfs_inode *base_ni; int err, offset; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn %lld, " @@ -2320,7 +2429,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, (long long) ni->mft_no, (unsigned) type, (long long) lowest_vcn, dataruns_size, (unsigned) flags); - if (!ni || dataruns_size <= 0) { + if (!ni || dataruns_size <= 0 || (!name && name_len)) { errno = EINVAL; return -1; } @@ -2328,7 +2437,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, if (ntfs_attr_can_be_non_resident(ni->vol, type)) { err = errno; if (errno == EPERM) - Dprintf("%s(): Attribute can't be resident.\n", + Dprintf("%s(): Attribute can't be non resident.\n", __FUNCTION__); else Dprintf("%s(): ntfs_attr_can_be_non_resident failed.\n", @@ -2365,7 +2474,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, m = ctx->mrec; offset = ((u8*)a - (u8*)m); a->type = type; - a->length = cpu_to_le32(length); + a->length = cpu_to_le32((length + 7) & ~7); a->non_resident = 1; a->name_length = name_len; a->name_offset = cpu_to_le16(length - dataruns_size - @@ -2380,12 +2489,18 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, name, sizeof(ntfschar) * name_len); m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance) + 1) & 0xffff); - if (ntfs_attrlist_entry_add(ni, a)) { - err = errno; - ntfs_attr_record_resize(m, a, 0); - Dprintf("%s(): Failed add attribute entry to ATTRIBUTE_LIST.\n", - __FUNCTION__); - goto put_err_out; + if (ni->nr_extents == -1) + base_ni = ni->base_ni; + else + base_ni = ni; + if (NInoAttrList(base_ni)) { + if (ntfs_attrlist_entry_add(ni, a)) { + err = errno; + ntfs_attr_record_resize(m, a, 0); + Dprintf("%s(): Failed add attribute entry to " + "ATTRIBUTE_LIST.\n", __FUNCTION__); + goto put_err_out; + } } ntfs_inode_mark_dirty(ni); ntfs_attr_put_search_ctx(ctx); @@ -2397,16 +2512,16 @@ put_err_out: } /** - * ntfs_attr_record_rm - remove attribute extent. - * @ctx: + * ntfs_attr_record_rm - remove attribute extent + * @ctx: search context describing the attrubute which should be removed * * User should reinit search context after use of this function if he/she wants * use it anymore. * * Return 0 on success and -1 on error. On error the error code is stored in * errno. Possible error codes are: - * EINVAL - - * EIO - + * EINVAL - Invalid argumets passed to function. + * EIO - I/O error occured or damaged filesystem. */ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { ntfs_inode *base_ni, *ni; @@ -3408,6 +3523,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) runlist *rl, *rln; ntfs_inode *ni; int err, mp_size, cur_max_mp_size, exp_max_mp_size; + BOOL add_attr_list_and_retry = FALSE; + BOOL mft_records_changed = FALSE; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type); @@ -3555,25 +3672,20 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (na->type == AT_ATTRIBUTE_LIST) { err = ENOSPC; goto rollback; - } else { - /* Add attribute list, if it is not present. */ - if (!NInoAttrList(na->ni)) { - // FIXME: Add attribute list and retry. - Dprintf("%s(): Eeek! Adding of " - "$ATTRIBUTE_LIST not supported " - "yet. Sorry.\n", __FUNCTION__); - err = ENOTSUP; - goto rollback; - } else { - /* - * Set mapping pairs size to maximum - * possible for this mft record. We - * shall allocate new mft records for - * rest of mapping pairs. - */ - mp_size = exp_max_mp_size; - } } + + /* Add attribute list, if it isn't present and retry. */ + if (!NInoAttrList(na->ni)) { + add_attr_list_and_retry = TRUE; + goto rollback; + } + + /* + * Set mapping pairs size to maximum possible for this + * mft record. We shall allocate new mft records for + * rest of mapping pairs. + */ + mp_size = exp_max_mp_size; } /* Expand space for mapping pairs if we need this. */ @@ -3591,6 +3703,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) err = EIO; goto rollback; } + mft_records_changed = TRUE; } /* * Generate the new mapping pairs array directly into the @@ -3614,6 +3727,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto rollback; } a->highest_vcn = scpu_to_le64(stop_vcn - 1); + mft_records_changed = TRUE; ntfs_inode_mark_dirty(ni); /* Calculate size of rest mapping pairs. */ @@ -3650,6 +3764,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) a = (ATTR_RECORD*)((u8*)m + err); } a->highest_vcn = scpu_to_le64(first_free_vcn - 1); + mft_records_changed = TRUE; ntfs_inode_mark_dirty(ni); ntfs_attr_reinit_search_ctx(ctx); } @@ -3685,6 +3800,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) ntfs_attr_put_search_ctx(ctx); return 0; rollback: + /* Free allocated clusters. */ if (ntfs_cluster_free(vol, na, na->allocated_size >> vol->cluster_size_bits, -1) < 0) { Dprintf("%s(): Eeek! Leaking clusters. Run chkdsk!\n", @@ -3701,6 +3817,22 @@ rollback: free(na->rl); na->rl = NULL; } + /* Add attribute list and try again. */ + if (add_attr_list_and_retry) { + ntfs_attr_put_search_ctx(ctx); + if (ntfs_inode_add_attrlist(na->ni)) { + err = errno; + Dprintf("%s(): Eeek! Coudn't add attribute list.\n", + __FUNCTION__); + errno = err; + return -1; + } + return ntfs_non_resident_attr_expand(na, newsize); + } + /* Do we need rollback changes inside MFT records.*/ + if (!mft_records_changed) + goto put_err_out; + /* Rollback changes inside MFT records. */ ntfs_attr_reinit_search_ctx(ctx); if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, (na->allocated_size >> vol->cluster_size_bits) - 1, From 64bd37518da55403c4f7603195749b4b21f33634 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 25 Sep 2004 20:10:16 +0000 Subject: [PATCH 1934/2994] - New API: inode.[ch]::ntfs_inode_add_attrlist. (Logical change 1.579) --- libntfs/inode.c | 139 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/libntfs/inode.c b/libntfs/inode.c index 32e08f08..99d37ac4 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -33,6 +33,7 @@ #include "debug.h" #include "mft.h" #include "attrib.h" +#include "attrlist.h" #include "runlist.h" /** @@ -472,3 +473,141 @@ int ntfs_inode_sync(ntfs_inode *ni) errno = err; return -1; } + +/** + * ntfs_inode_add_attrlist - add attribute list to inode and fill it + * @ni - opened ntfs inode to which add attribute list + * + * Return 0 on success or -1 on error with errno set to the error code. + * The following error codes are defined: + * EINVAL - Invalid arguments were passed to the function. + * EEXIST - Attibute list already exist. + * EIO - Input/Ouput error occured. + * ENOTSUP - Add requires code that has not been imlemented yet. + * ENOMEM - Not enogh memory to perform add. + */ +int ntfs_inode_add_attrlist(ntfs_inode *ni) +{ + int err; + ntfs_attr_search_ctx *ctx; + u8 *al, *aln; + int al_len, al_allocated; + ATTR_LIST_ENTRY *ale; + + if (!ni) { + Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + Dprintf("%s(): Entering for inode 0x%llx.\n", + __FUNCTION__, (long long) ni->mft_no); + + if (NInoAttrList(ni) || ni->nr_extents) { + Dprintf("%s(): Inode already has got attribute list.\n", + __FUNCTION__); + errno = EEXIST; + return -1; + } + + al_allocated = 0x40; + al_len = 0; + al = malloc(al_allocated); + ale = (ATTR_LIST_ENTRY *) al; + if (!al) { + Dprintf("%s(): Not enough memory.\n", __FUNCTION__); + errno = ENOMEM; + return -1; + } + + /* Form attribute list. */ + ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); + if (!ctx) { + err = errno; + Dprintf("%s(): Coudn't get search context.\n", __FUNCTION__); + goto err_out; + } + /* Walk through all attributes. */ + while (!ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx)) { + if (ctx->attr->type == AT_ATTRIBUTE_LIST) { + err = EIO; + Dprintf("%s(): Eeek! Attribute list already present.\n", + __FUNCTION__); + goto put_err_out; + } + /* Calculate new length of attribute list. */ + al_len += (sizeof(ATTR_LIST_ENTRY) + sizeof(ntfschar) * + ctx->attr->name_length + 7) & ~7; + /* Allocate more memory if needed. */ + while (al_len > al_allocated) { + al_allocated += 0x40; + aln = realloc(al, al_allocated); + if (!aln) { + Dprintf("%s(): Not enough memory.\n", + __FUNCTION__); + errno = ENOMEM; + goto put_err_out; + } + ale = (ATTR_LIST_ENTRY *)(aln + ((u8 *)ale - al)); + al = aln; + } + /* Add attribute to attribute list. */ + ale->type = ctx->attr->type; + ale->length = cpu_to_le16((sizeof(ATTR_LIST_ENTRY) + + sizeof(ntfschar) * ctx->attr->name_length + 7) & ~7); + ale->name_length = ctx->attr->name_length; + ale->name_offset = (u8 *)ale->name - (u8 *)ale; + if (ctx->attr->non_resident) + ale->lowest_vcn = ctx->attr->lowest_vcn; + else + ale->lowest_vcn = 0; + ale->mft_reference = MK_LE_MREF(ni->mft_no, + le16_to_cpu(ni->mrec->sequence_number)); + ale->instance = ctx->attr->instance; + memcpy(ale->name, (u8 *)ctx->attr + + ctx->attr->name_offset, ctx->attr->name_length); + ale = (ATTR_LIST_ENTRY *)(al + al_len); + } + /* Check for real error occured. */ + if (errno != ENOENT) { + err = errno; + Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); + goto put_err_out; + } + /* Deallocate trailing memory. */ + aln = realloc(al, al_len); + if (!aln) { + err = errno; + Dprintf("%s(): realloc() failed.\n", __FUNCTION__); + goto put_err_out; + } + al = aln; + ntfs_attr_put_search_ctx(ctx); + + /* Add $ATTRIBUTE_LIST to mft record. */ + if (ntfs_resident_attr_record_add(ni, AT_ATTRIBUTE_LIST, 0, 0, 0) < 0) { + err = errno; + Dprintf("%s(): Couldn't add $ATTRIBUTE_LIST to MFT record.\n", + __FUNCTION__); + if (err == ENOSPC) { + //FIXME: Move out attributes and try once again. + err = ENOTSUP; + } + goto err_out; + } + + /* Set new attribute list. */ + if (ntfs_attrlist_set(ni, al, al_len)) { + err = errno; + Dprintf("%s(): Coudn't set attribute list.\n", __FUNCTION__); + goto err_out; + } + return 0; + +put_err_out: + ntfs_attr_put_search_ctx(ctx); +err_out: + free(al); + errno = err; + return -1; +} From 5dee14406327214c9d3a1d36cf9863633c07ad6a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 25 Sep 2004 20:10:16 +0000 Subject: [PATCH 1935/2994] - add ntfs_attrlist_set prototype. (Logical change 1.579) --- include/ntfs/attrlist.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/ntfs/attrlist.h b/include/ntfs/attrlist.h index be53f068..b6a11a72 100644 --- a/include/ntfs/attrlist.h +++ b/include/ntfs/attrlist.h @@ -26,6 +26,8 @@ #include "attrib.h" +extern int ntfs_attrlist_set(ntfs_inode *ni, u8 *new_al, int new_al_len); + extern int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr); extern int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx); From 756a0a84ca1e2421df9c3e32ff0187ecdd09b4e4 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 25 Sep 2004 20:10:16 +0000 Subject: [PATCH 1936/2994] - add ntfs_resident_attr_record_add prototype. (Logical change 1.579) --- include/ntfs/attrib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index ffe18bee..c1be8a59 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -278,10 +278,11 @@ extern int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size); extern int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size); +extern int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, + ntfschar *name, u8 name_len, ATTR_FLAGS flags); extern int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ntfschar *name, u8 name_len, VCN lowest_vcn, int dataruns_size, ATTR_FLAGS flags); - extern int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx); extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, From 52300dca77b6c93c7b8400950d0a8d9837076cc9 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 25 Sep 2004 20:10:16 +0000 Subject: [PATCH 1937/2994] - add tfs_inode_add_attrlist prototype. (Logical change 1.579) --- include/ntfs/inode.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index e3280c08..0364fd0c 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -2,6 +2,7 @@ * inode.h - Defines for NTFS inode handling. Part of the Linux-NTFS project. * * Copyright (c) 2001,2002 Anton Altaparmakov + * Copyright (c) 2004 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -146,5 +147,7 @@ static __inline__ void ntfs_inode_mark_dirty(ntfs_inode *ni) { extern int ntfs_inode_sync(ntfs_inode *ni); +extern int ntfs_inode_add_attrlist(ntfs_inode *ni); + #endif /* defined _NTFS_INODE_H */ From e418cf534504dafa91287f7ebc53ee992f671c3f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 25 Sep 2004 20:10:16 +0000 Subject: [PATCH 1938/2994] Update. (Logical change 1.579) --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index c77165eb..819531a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -48,6 +48,10 @@ xx/xx/2004 - 2.0.0-WIP - Add new API unistr.[hc]::ntfs_ucsndup(). (Anton) - Make libntfs/attrib.c::ntfs_attr_open() make a copy of the attribute name unless it is one of the internal names. (Anton) + - Move out common part of ntfs_attrlist_entry_{add,rm} to new API: + attrlist.[ch]::ntfs_attrlist_set. (Yura) + - New API: attrib.[ch]::ntfs_resident_attr_record_add. (Yura) + - New API: inode.[ch]::ntfs_inode_add_attrlist. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From a373b59fd3f7f67e7484eac5be2b838f0fd9bb81 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 26 Sep 2004 19:31:31 +0000 Subject: [PATCH 1939/2994] Add new API: ntfs_attrlist_need. (Logical change 1.580) --- libntfs/attrlist.c | 70 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 11 deletions(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index ddea3fe8..80a37aec 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -33,6 +33,54 @@ #include "debug.h" #include "unistr.h" +/** + * ntfs_attrlist_need - check whether attribute need attribute list + * @ni: opened ntfs inode for which perform check + * + * Check whether all are atributes belong to one MFT record, in that case + * attribute list is not needed. + * + * Return 1 if inode need attribute list, 0 if not, -1 on error with errno set + * to the error code. If function succeed errno set to 0. The following error + * codes are defined: + * EINVAL - Invalid argumets passed to function or attribute haven't got + * attribute list. + */ +int ntfs_attrlist_need(ntfs_inode *ni) { + ATTR_LIST_ENTRY *ale; + + if (!ni) { + Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + Dprintf("%s(): Entering for inode 0x%llx.\n", + __FUNCTION__, (long long) ni->mft_no); + + if (!NInoAttrList(ni)) { + Dprintf("%s(): Inode haven't got attribute list.\n", + __FUNCTION__); + errno = EINVAL; + return -1; + } + + if (!ni->attr_list) { + Dprintf("%s(): Corrput in-memory struct.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + errno = 0; + ale = (ATTR_LIST_ENTRY *)ni->attr_list; + while ((u8*)ale < ni->attr_list + ni->attr_list_size) { + if (MREF_LE(ale->mft_reference) != ni->mft_no) + return 1; + ale = (ATTR_LIST_ENTRY *)((u8*)ale + le16_to_cpu(ale->length)); + } + return 0; +} + /** * ntfs_attrlist_set - set new attribute list for ntfs inode * @ni: opened ntfs inode attribute list set for @@ -52,16 +100,16 @@ int ntfs_attrlist_set(ntfs_inode *ni, u8 *new_al, int new_al_len) runlist *rl; int rl_size; int err; - + if (!ni || !new_al || new_al_len < 1) { Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); errno = EINVAL; return -1; } - + Dprintf("%s(): Entering for inode 0x%llx, new_al_len %d.\n", __FUNCTION__, (long long) ni->mft_no, new_al_len); - + /* Make attribute list length 8 byte aligment. */ new_al_len = (new_al_len + 7) & ~7; @@ -163,12 +211,12 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) errno = EINVAL; return -1; } - + mref = MK_LE_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number)); if (ni->nr_extents == -1) ni = ni->base_ni; - + if (!NInoAttrList(ni)) { Dprintf("%s(): Attribute list isn't present.\n", __FUNCTION__); errno = ENOENT; @@ -241,7 +289,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) ale->mft_reference = mref; ale->instance = attr->instance; memcpy(ale->name, (u8 *)attr + attr->name_offset, attr->name_length); - + /* Set new runlist. */ if (ntfs_attrlist_set(ni, new_al, new_al_len)) { err = errno; @@ -271,19 +319,19 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) ntfs_inode *base_ni; ATTR_LIST_ENTRY *ale; int err; - + if (!ctx || !ctx->ntfs_ino || !ctx->attr || !ctx->al_entry) { Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); errno = EINVAL; return -1; } - + if (ctx->base_ntfs_ino) base_ni = ctx->base_ntfs_ino; else base_ni = ctx->ntfs_ino; ale = ctx->al_entry; - + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn " "%lld.\n", __FUNCTION__, (long long) ctx->ntfs_ino->mft_no, (unsigned) le32_to_cpu(ctx->attr->type), @@ -294,7 +342,7 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) errno = ENOENT; return -1; } - + /* Allocate memory for new attribute list. */ new_al_len = base_ni->attr_list_size - le16_to_cpu(ale->length); new_al = malloc(new_al_len); @@ -303,7 +351,7 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) errno = ENOMEM; return -1; } - + /* Copy entries from old attribute list to new. */ memcpy(new_al, base_ni->attr_list, (u8*)ale - base_ni->attr_list); memcpy(new_al + ((u8*)ale - base_ni->attr_list), (u8*)ale + le16_to_cpu( From c78630e1dd22751197bf7f07e9a3bc1ac16dae80 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 26 Sep 2004 19:31:31 +0000 Subject: [PATCH 1940/2994] Add prototype. (Logical change 1.580) --- include/ntfs/attrlist.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ntfs/attrlist.h b/include/ntfs/attrlist.h index b6a11a72..525cfebe 100644 --- a/include/ntfs/attrlist.h +++ b/include/ntfs/attrlist.h @@ -26,10 +26,10 @@ #include "attrib.h" +extern int ntfs_attrlist_need(ntfs_inode *ni); + extern int ntfs_attrlist_set(ntfs_inode *ni, u8 *new_al, int new_al_len); - extern int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr); - extern int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx); #endif /* defined _NTFS_ATTRLIST_H */ From b2f2facc29ef1a0a04048ca67b55ba58f9a97177 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 26 Sep 2004 19:31:31 +0000 Subject: [PATCH 1941/2994] Make ntfs_attr_record_rm use ntfs_attrlist_need and delete attribute list if it is doesn't need. (Logical change 1.580) --- libntfs/attrib.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index f6695c48..9d63e962 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2591,7 +2591,30 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { } if (type == AT_ATTRIBUTE_LIST || !NInoAttrList(base_ni)) return 0; - // FIXME: Remove $ATTRIBUTE_LIST if no extents left or it is size == 0. + if (!ntfs_attrlist_need(base_ni)) { + ntfs_attr_reinit_search_ctx(ctx); + if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, NULL, 0, IGNORE_CASE, + 0, NULL, 0, ctx)) { + /* + * FIXME: Should we succeed here? Definitely something + * goes wrong because NInoAttrList(base_ni) returned + * that we have got attribute list. + */ + Dprintf("%s(): Coudn't find attribute list. Succeed " + "anyway.\n", __FUNCTION__); + return 0; + } + if (ntfs_attr_record_rm(ctx)) { + /* + * FIXME: Should we succeed here? BTW, chkdsk doesn't + * complain if it find MFT record with attribute list, + * but wothout extents. + */ + Dprintf("%s(): Coudn't remove attribute list. Succeed " + "anyway.\n", __FUNCTION__); + return 0; + } + } return 0; } From 1e589f3db3a762f2899889d0041252cd43971755 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 26 Sep 2004 19:31:31 +0000 Subject: [PATCH 1942/2994] Update. (Logical change 1.580) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 819531a3..848db673 100644 --- a/ChangeLog +++ b/ChangeLog @@ -52,6 +52,7 @@ xx/xx/2004 - 2.0.0-WIP attrlist.[ch]::ntfs_attrlist_set. (Yura) - New API: attrib.[ch]::ntfs_resident_attr_record_add. (Yura) - New API: inode.[ch]::ntfs_inode_add_attrlist. (Yura) + - New API: attrlist.[ch]::ntfs_attrlist_need. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 442fcef5bf72fb6babf87ca7df80903d73fe4e2a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 26 Sep 2004 19:31:31 +0000 Subject: [PATCH 1943/2994] libntfs/attrib.c Make ntfs_attr_record_rm use ntfs_attrlist_need and delete attribute list if it is doesn't need. libntfs/attrlist.c Add new API: ntfs_attrlist_need. BKrev: 41571913K5_56FJcIFfiZdKO5TzzLA From f9ac10a85ee21dea83f6952e96c34c762ccc203a Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 28 Sep 2004 18:33:40 +0000 Subject: [PATCH 1944/2994] - fix err <-> errno typo that could cause bogus return value (Logical change 1.581) --- libntfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 99d37ac4..7a5bee5c 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -545,7 +545,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) if (!aln) { Dprintf("%s(): Not enough memory.\n", __FUNCTION__); - errno = ENOMEM; + err = ENOMEM; goto put_err_out; } ale = (ATTR_LIST_ENTRY *)(aln + ((u8 *)ale - al)); From 82efae551ef1deb9bc3bd523ee72dc8634e46d8b Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 28 Sep 2004 18:33:40 +0000 Subject: [PATCH 1945/2994] - suppress bogus gcc warning about uninitialized 'err' variable (Logical change 1.581) --- libntfs/attrib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 9d63e962..92580911 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3699,6 +3699,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) /* Add attribute list, if it isn't present and retry. */ if (!NInoAttrList(na->ni)) { + err = ENOTSUP; /* to suppress gcc complain */ add_attr_list_and_retry = TRUE; goto rollback; } From 6afc38f1799773ef468d6db7f7c623cbc7ff9da7 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 28 Sep 2004 18:33:40 +0000 Subject: [PATCH 1946/2994] libntfs/attrib.c - suppress bogus gcc warning about uninitialized 'err' variable libntfs/inode.c - fix err <-> errno typo that could cause bogus return value BKrev: 4159ae841VJpVyLgXynZsPdWhzT-sw From e68a61101a2106ad16403603415e1a19be4af740 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 28 Sep 2004 23:43:15 +0000 Subject: [PATCH 1947/2994] - ntfsclone: save by using our, not NTFS cluster allocation bitmap. This gives more control in the future what to save. (Logical change 1.582) --- ChangeLog | 2 ++ ntfsprogs/ntfsclone.c | 66 ++++++++++++++----------------------------- 2 files changed, 23 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index 848db673..7234ea4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -53,6 +53,8 @@ xx/xx/2004 - 2.0.0-WIP - New API: attrib.[ch]::ntfs_resident_attr_record_add. (Yura) - New API: inode.[ch]::ntfs_inode_add_attrlist. (Yura) - New API: attrlist.[ch]::ntfs_attrlist_need. (Yura) + - ntfsclone: save by using our, not NTFS cluster allocation bitmap. + This gives more control in the future what to save (Szaka) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 2b679e94..e3cad3f8 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -519,8 +519,7 @@ static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) static void clone_ntfs(u64 nr_clusters) { - s64 i, pos, count, last_cl; - u8 bm[NTFS_BUF_SIZE]; + u64 cl, last_cl; /* current and last used cluster */ void *buf; u32 csize = vol->cluster_size; u64 p_counter = 0; @@ -532,56 +531,34 @@ static void clone_ntfs(u64 nr_clusters) Printf("Cloning NTFS ...\n"); if ((buf = calloc(1, csize)) == NULL) - perr_exit("dump_to_stdout"); + perr_exit("clone_ntfs"); progress_init(&progress, p_counter, nr_clusters, 100); if (opt.save_image) { - if (write_all(&fd_out, &image_hdr, sizeof(image_hdr)) - == -1) + if (write_all(&fd_out, &image_hdr, sizeof(image_hdr)) == -1) perr_exit("write_all"); } - pos = 0; - last_cl = 0; - while (1) { - count = ntfs_attr_pread(vol->lcnbmp_na, pos, NTFS_BUF_SIZE, bm); - if (count == -1) - perr_exit("Couldn't read $Bitmap (pos = %lld)\n", pos); - - if (count == 0) { - image_skip_clusters(pos * 8 - last_cl - 1); - return; + for (last_cl = cl = 0; cl < vol->nr_clusters; cl++) { + + if (ntfs_bit_get(lcn_bitmap.bm, cl)) { + progress_update(&progress, ++p_counter); + lseek_to_cluster(cl); + image_skip_clusters(cl - last_cl - 1); + + copy_cluster(); + last_cl = cl; + continue; } - - for (i = 0; i < count; i++, pos++) { - s64 cl; /* current cluster */ - - for (cl = pos * 8; cl < (pos + 1) * 8; cl++) { - - if (cl > vol->nr_clusters - 1) { - image_skip_clusters(cl - last_cl - 1); - return; - } - - if (ntfs_bit_get(bm, i * 8 + cl % 8)) { - progress_update(&progress, ++p_counter); - lseek_to_cluster(cl); - image_skip_clusters(cl - last_cl - 1); - - copy_cluster(); - last_cl = cl; - continue; - } - - if (opt.std_out && !opt.save_image) { - progress_update(&progress, ++p_counter); - if (write_all(&fd_out, buf, csize) == -1) - perr_exit("write_all"); - } - } + + if (opt.std_out && !opt.save_image) { + progress_update(&progress, ++p_counter); + if (write_all(&fd_out, buf, csize) == -1) + perr_exit("write_all"); } } + image_skip_clusters(cl - last_cl - 1); } static void write_empty_clusters(s32 csize, s64 count, @@ -1302,8 +1279,6 @@ int main(int argc, char **argv) compare_bitmaps(&lcn_bitmap); print_disk_usage(vol->cluster_size, vol->nr_clusters, image.inuse); - free(lcn_bitmap.bm); - if (opt.save_image) initialise_image_hdr(device_size, image.inuse); @@ -1317,7 +1292,7 @@ int main(int argc, char **argv) fsync_clone(fd_out); exit(0); } - + wipe = 1; opt.volume = opt.output; /* 'force' again mount for dirty volumes (e.g. after resize). @@ -1325,6 +1300,7 @@ int main(int argc, char **argv) opt.force++; mount_volume(0); + free(lcn_bitmap.bm); setup_lcn_bitmap(); memset(&image, 0, sizeof(image)); backup_clusters.image = ℑ From b7d713c8f1d0beb3975d2364bc950522154acc65 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 28 Sep 2004 23:43:15 +0000 Subject: [PATCH 1948/2994] - ntfsclone: save by using our, not NTFS cluster allocation bitmap. This gives more control in the future what to save. BKrev: 4159f713A1Kny6AMt_QTXVbjQHuaJQ From 75c1ed8b5d48a4ca4cce44dc9dcb5b913868ad22 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Sep 2004 14:45:16 +0000 Subject: [PATCH 1949/2994] Always clear ctx->al_entry in ntfs_attr_reinit_search_ctx(). (Logical change 1.583) --- libntfs/attrib.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 92580911..6f7b38e4 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2044,6 +2044,11 @@ void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx) /* Sanity checks are performed elsewhere. */ ctx->attr = (ATTR_RECORD*)((u8*)ctx->mrec + le16_to_cpu(ctx->mrec->attrs_offset)); + /* + * This needs resetting due to ntfs_external_attr_find() which + * can leave it set despite having zeroed ctx->base_ntfs_ino. + */ + ctx->al_entry = NULL; return; } /* Attribute list. */ ntfs_attr_init_search_ctx(ctx, ctx->base_ntfs_ino, ctx->base_mrec); From e3c44c8ff616b8e2f1a6f35c4c11f382eff2308b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Sep 2004 14:45:16 +0000 Subject: [PATCH 1950/2994] Always clear ctx->al_entry in ntfs_attr_reinit_search_ctx(). BKrev: 415aca7cWCu3EBuiI-NQXNcdSEJJ1w From a18fb7244fae7a4332da430a4786b012588f8339 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 29 Sep 2004 14:45:16 +0000 Subject: [PATCH 1951/2994] Update (Logical change 1.583) --- ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7234ea4a..3ad32e63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -55,6 +55,12 @@ xx/xx/2004 - 2.0.0-WIP - New API: attrlist.[ch]::ntfs_attrlist_need. (Yura) - ntfsclone: save by using our, not NTFS cluster allocation bitmap. This gives more control in the future what to save (Szaka) + - Fix stupid bug in ntfs_attr_reinit_search_ctx() introduced during + changes to ntfs_external_attr_find(). This is because + ntfs_attr_lookup() intentionally does not clear ctx->al_entry but + does clear ctx->base_ntfs_ino which in turn means that + ntfs_attr_reinit_search_ctx() does not clear ctx->al_entry. Now, + ntfs_attr_reinit_search_ctx() always clears ctx->al_entry. 04/09/2004 - 1.9.4 - Urgent bug fixes. From 746c36a4beb3260745ee4d651dc754f0164a0721 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 29 Sep 2004 15:43:22 +0000 Subject: [PATCH 1952/2994] Add new helper ntfs_attrlist_mark_dirty. (Logical change 1.584) --- include/ntfs/attrlist.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/ntfs/attrlist.h b/include/ntfs/attrlist.h index 525cfebe..3c7259f9 100644 --- a/include/ntfs/attrlist.h +++ b/include/ntfs/attrlist.h @@ -32,4 +32,20 @@ extern int ntfs_attrlist_set(ntfs_inode *ni, u8 *new_al, int new_al_len); extern int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr); extern int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx); +/** + * ntfs_attrlist_mark_dirty - set the attribute list dirty + * @ni: ntfs inode which base inode contain dirty attribute list + * + * Set the attribute list dirty so it is written out later (at the latest at + * ntfs_inode_close() time). + * + * This function cannot fail. + */ +static __inline__ void ntfs_attrlist_mark_dirty(ntfs_inode *ni) { + if (ni->nr_extents == -1) + NInoAttrListSetDirty(ni->base_ni); + else + NInoAttrListSetDirty(ni); +} + #endif /* defined _NTFS_ATTRLIST_H */ From 4b95d5ce3e8af1d87d49eb409d6bef8efc8c44ae Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 29 Sep 2004 15:43:22 +0000 Subject: [PATCH 1953/2994] Add ntfs_attr_update_mapping_pairs prototype. (Logical change 1.584) --- include/ntfs/attrib.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index c1be8a59..937d77a4 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -288,6 +288,8 @@ extern int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx); extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, const u32 newsize); +extern int ntfs_attr_update_mapping_pairs(ntfs_attr *na); + extern int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize); // FIXME / TODO: Above here the file is cleaned up. (AIA) From bb9c8afe600ce35d8a1e931eb33b70e947519384 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 29 Sep 2004 15:43:22 +0000 Subject: [PATCH 1954/2994] Auto merged 2004/09/29 18:35:00+03:00 (none)!yura SCCS merged 2004/09/29 18:16:34+03:00 (none)!yura - Deallocate clusters when free atribute list. - Write ntfs_attr_update_mapping_pairs and make ntfs_non_resident_attr_{shrink,expand} use it. (Logical change 1.584) --- libntfs/attrib.c | 829 +++++++++++++++++++++++------------------------ 1 file changed, 414 insertions(+), 415 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 6f7b38e4..62f847e6 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2609,11 +2609,22 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { "anyway.\n", __FUNCTION__); return 0; } + /* Deallocate clusters. */ + if (NInoAttrListNonResident(base_ni)) { + if (ntfs_cluster_free_from_rl(base_ni->vol, + base_ni->attr_list_rl)) { + Dprintf("%s(): Leaking clusters! Run chkdsk. " + "Couldn't free clusters from attribute " + "list runlist. Succeed anyway.\n", + __FUNCTION__); + } + } + /* Remove attribute record itself. */ if (ntfs_attr_record_rm(ctx)) { /* * FIXME: Should we succeed here? BTW, chkdsk doesn't * complain if it find MFT record with attribute list, - * but wothout extents. + * but without extents. */ Dprintf("%s(): Coudn't remove attribute list. Succeed " "anyway.\n", __FUNCTION__); @@ -3261,6 +3272,311 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) return 0; } +#define NTFS_VCN_DELETE_MARK -2 +/** + * ntfs_attr_update_mapping_pairs - update mapping pairs for ntfs attribute + * @na: non-resident ntfs open attribute for which we need update + * + * Build mapping pairs from na->runlist and write them to the disk. + * + * On success return 0 and on error return -1 with errno set to the error code. + * The following error codes are defined: + * ENOTSUP - The desired resize is not implemented yet. + * ENOMEM - Not enough memory to complete operation. + * ENOSPC - There is no enogh space in base mft to resize $ATTRIBUTE_LIST. + */ +int ntfs_attr_update_mapping_pairs(ntfs_attr *na) +{ + ntfs_attr_search_ctx *ctx; + ntfs_inode *ni; + MFT_RECORD *m; + ATTR_RECORD *a; + VCN stop_vcn; + int err, mp_size, cur_max_mp_size, exp_max_mp_size; + BOOL finished_build = FALSE; + + if (!na || !na->rl) { + Dprintf("%s(): Invalid parameters passed.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + if (!NAttrNonResident(na)) { + Dprintf("%s(): Attribute should be non resident.\n", + __FUNCTION__); + errno = EINVAL; + return -1; + } + + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, + (unsigned long long)na->ni->mft_no, na->type); + + ctx = ntfs_attr_get_search_ctx(na->ni, 0); + if (!ctx) { + err = errno; + Dprintf("%s(): Couldn't get search context.\n", __FUNCTION__); + errno = err; + return -1; + } + + /* Fill attribute records with new mapping pairs. */ + stop_vcn = 0; + while (!ntfs_attr_lookup(na->type, na->name, na->name_len, + IGNORE_CASE, 0, NULL, 0, ctx)) { + a = ctx->attr; + m = ctx->mrec; + + /* + * Check whether we finished mapping pairs build, if so mark + * extent as need to delete (by setting highest vcn to -1, we + * shall check it later and delete extent) and continue search. + */ + if (finished_build) { + Dprintf("%s(): Marked attr 0x%x for delete in inode " + "0x%llx.\n", __FUNCTION__, le32_to_cpu(a->type), + ctx->ntfs_ino->mft_no); + a->highest_vcn = scpu_to_le64(NTFS_VCN_DELETE_MARK); + ntfs_inode_mark_dirty(ctx->ntfs_ino); + continue; + } + + /* + * Check that the attribute name hasn't been placed after the + * mapping pairs array. Windows account this as corruption. + */ + if (a->name_length) { + if (le16_to_cpu(a->name_offset) >= + le16_to_cpu(a->mapping_pairs_offset)) { + Dprintf("%s(): Eeek! Damaged attribute. Name is" + " placed after the mapping pairs array." + " Run chkdsk.\n", __FUNCTION__); + err = EIO; + goto put_err_out; + } + } + + /* Get the size for the rest of mapping pairs array. */ + mp_size = ntfs_get_size_for_mapping_pairs(na->ni->vol, na->rl, + stop_vcn); + if (mp_size <= 0) { + err = errno; + Dprintf("%s(): Eeek! Get size for mapping " + "pairs failed.\n", __FUNCTION__); + goto put_err_out; + } + /* + * Determine maximum possible length of mapping pairs, + * if we shall *not* expand space for mapping pairs. + */ + cur_max_mp_size = le32_to_cpu(a->length) - + le16_to_cpu(a->mapping_pairs_offset); + /* + * Determine maximum possible length of mapping pairs in the + * current mft record, if we shall expand space for mapping + * pairs. + */ + exp_max_mp_size = le32_to_cpu(m->bytes_allocated) - + le32_to_cpu(m->bytes_in_use) + cur_max_mp_size; + + /* Test mapping pairs for fitting in the current mft record. */ + if (mp_size > exp_max_mp_size) { + /* + * Mapping pairs of $ATTRIBUTE_LIST attribute must fit + * in the base mft record. + */ + if (na->type == AT_ATTRIBUTE_LIST) { + err = ENOSPC; + goto put_err_out; + } + + /* Add attribute list if it isn't present, and retry. */ + if (!NInoAttrList(na->ni)) { + ntfs_attr_put_search_ctx(ctx); + if (ntfs_inode_add_attrlist(na->ni)) { + err = errno; + Dprintf("%s(): Eeek! Coudn't add " + "attribute list.\n", + __FUNCTION__); + errno = err; + return -1; + } + return ntfs_attr_update_mapping_pairs(na); + } + + /* + * Set mapping pairs size to maximum possible for this + * mft record. We shall write the rest of mapping pairs + * to another MFT records. + */ + mp_size = exp_max_mp_size; + } + + /* Change space for mapping pairs if we need it. */ + if (((mp_size + 7) & ~7) != cur_max_mp_size) { + if (ntfs_attr_record_resize(m, a, + le16_to_cpu(a->mapping_pairs_offset) + + mp_size)) { + Dprintf("%s(): BUG! Ran out of space in" + " mft record. Please run chkdsk" + " and if that doesn't find any " + "errors please report you saw " + "this message to " + "linux-ntfs-dev@lists.sf.net." + "\n", __FUNCTION__); + err = EIO; + goto put_err_out; + } + } + + /* Update lowest vcn. */ + a->lowest_vcn = scpu_to_le64(stop_vcn); + ntfs_inode_mark_dirty(ctx->ntfs_ino); + if ((ctx->ntfs_ino->nr_extents == -1 || + NInoAttrList(ctx->ntfs_ino)) && + ctx->attr->type != AT_ATTRIBUTE_LIST) { + ctx->al_entry->lowest_vcn = scpu_to_le64(stop_vcn); + ntfs_attrlist_mark_dirty(ctx->ntfs_ino); + } + + /* + * Generate the new mapping pairs array directly into the + * correct destination, i.e. the attribute record itself. + */ + if (!ntfs_mapping_pairs_build(na->ni->vol, (u8*)a + le16_to_cpu( + a->mapping_pairs_offset), mp_size, na->rl, + stop_vcn, &stop_vcn)) + finished_build = TRUE; + if (!finished_build && errno != ENOSPC) { + err = errno; + Dprintf("%s(): BUG! Mapping pairs build failed. " + "Please run chkdsk and if that doesn't find " + "any errors please report you saw this message" + " to linux-ntfs-dev@lists.sf.net.\n", + __FUNCTION__); + goto put_err_out; + } + a->highest_vcn = scpu_to_le64(stop_vcn - 1); + } + /* Check wether error occured. */ + if (errno != ENOENT) { + err = errno; + Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); + goto put_err_out; + } + + /* Deallocate not used attribute extents and return with success. */ + if (finished_build) { + /* + * FIXME: We use ntfs_attr_init_search_ctx instead of + * ntfs_attr_reinit_search_ctx because last seems to be buggy. + */ + //ntfs_attr_reinit_search_ctx(ctx); + ntfs_attr_init_search_ctx(ctx, na->ni, NULL); + Dprintf("%s(): Deallocate marked extents.\n", __FUNCTION__); + while (!ntfs_attr_lookup(na->type, na->name, na->name_len, + IGNORE_CASE, 0, NULL, 0, ctx)) { + Dprintf("%s(): Found attr 0x%x in inode " + "0x%llx.\n", __FUNCTION__, le32_to_cpu(a->type), + ctx->ntfs_ino->mft_no); + if (sle64_to_cpu(ctx->attr->highest_vcn) != + NTFS_VCN_DELETE_MARK) + continue; + Dprintf("%s(): It is marked. Delete it.\n", + __FUNCTION__); + /* Remove unused attribute record. */ + if (ntfs_attr_record_rm(ctx)) { + err = errno; + Dprintf("%s(): Coudn't remove unused attribute " + "record.\n", __FUNCTION__); + goto put_err_out; + } + //ntfs_attr_init_search_ctx(ctx, na->ni, NULL); + ntfs_attr_reinit_search_ctx(ctx); + } + if (errno != ENOENT) { + err = errno; + Dprintf("%s(): Attribute lookup failed.\n", + __FUNCTION__); + goto put_err_out; + } + Dprintf("%s(): Deallocate done.\n", __FUNCTION__); + return 0; + } + + /* Allocate new MFT records for the rest of mapping pairs. */ + while (1) { + /* Calculate size of rest mapping pairs. */ + mp_size = ntfs_get_size_for_mapping_pairs(na->ni->vol, + na->rl, stop_vcn); + if (mp_size <= 0) { + err = errno; + Dprintf("%s(): Eeek! Get size for mapping " + "pairs failed.\n", __FUNCTION__); + goto put_err_out; + } + /* Allocate new mft record. */ + ni = ntfs_mft_record_alloc(na->ni->vol, na->ni); + if (!ni) { + err = errno; + Dprintf("%s(): Couldn't allocate new MFT record.\n", + __FUNCTION__); + goto put_err_out; + } + m = ni->mrec; + /* + * If mapping size exceed avaible space, set them to + * possible maximum. + */ + cur_max_mp_size = le32_to_cpu(m->bytes_allocated) - + le32_to_cpu(m->bytes_in_use) - 0x40 - + sizeof(ntfschar) * na->name_len; + if (mp_size > cur_max_mp_size) + mp_size = cur_max_mp_size; + /* Add atribute extent to new record. */ + err = ntfs_non_resident_attr_record_add(ni, na->type, + na->name, na->name_len, stop_vcn, mp_size, 0); + if (err == -1) { + err = errno; + Dprintf("%s(): Couldn't add attribute extent " + "into the MFT record.\n", __FUNCTION__); + if (ntfs_mft_record_free(na->ni->vol, ni)) { + Dprintf("%s(): Coudn't free MFT record.\n", + __FUNCTION__); + } + goto put_err_out; + } + a = (ATTR_RECORD*)((u8*)m + err); + + err = ntfs_mapping_pairs_build(na->ni->vol, (u8*)a + + le16_to_cpu(a->mapping_pairs_offset), mp_size, na->rl, + stop_vcn, &stop_vcn); + if (err < 0 && errno != ENOSPC) { + err = errno; + Dprintf("%s(): BUG! Mapping pairs build " + "failed. Please run chkdsk and if " + "that doesn't find any errors please " + "report you saw this message to " + "linux-ntfs-dev@lists.sf.net.\n", + __FUNCTION__); + if (ntfs_mft_record_free(na->ni->vol, ni)) + Dprintf("%s(): Coudn't free MFT record.\n", + __FUNCTION__); + goto put_err_out; + } + a->highest_vcn = scpu_to_le64(stop_vcn - 1); + ntfs_inode_mark_dirty(ni); + /* All mapping pairs are writed. */ + if (!err) + break; + } + return 0; +put_err_out: + ntfs_attr_put_search_ctx(ctx); + errno = err; + return -1; +} +#undef NTFS_VCN_DELETE_MARK + /** * ntfs_non_resident_attr_shrink - shrink a non-resident, open ntfs attribute * @na: non-resident ntfs attribute to shrink @@ -3279,30 +3595,15 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) ntfs_volume *vol; ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; - MFT_RECORD *m; VCN first_free_vcn; s64 nr_freed_clusters; - u32 new_alen, new_muse; - int err, mp_size; + int err; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type); vol = na->ni->vol; - /* Get the first attribute record that needs modification. */ - ctx = ntfs_attr_get_search_ctx(na->ni, NULL); - if (!ctx) - return -1; - if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, newsize >> - vol->cluster_size_bits, NULL, 0, ctx)) { - err = errno; - if (err == ENOENT) - err = EIO; - goto put_err_out; - } - a = ctx->attr; - m = ctx->mrec; /* * Check the attribute type and the corresponding minimum size * against @newsize and fail if @newsize is too small. @@ -3310,7 +3611,6 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) if (ntfs_attr_size_bounds_check(vol, na->type, newsize) < 0) { err = errno; if (err == ERANGE) { - // FIXME: Eeek! Dprintf("%s(): Eeek! Size bounds check " "failed. Aborting...\n", __FUNCTION__); } else if (err == ENOENT) @@ -3318,52 +3618,6 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) goto put_err_out; } - // When extents/an attribute list is/are present it is very complicated: - // TODO: For the current extent: - // TODO: free the required clusters - // FIXME: how do we deal with extents that haven't been loaded yet? - // do we just fault them in first so that the runlist is - // complete and we are done with deallocations in one go? - // TODO: update the run list in na->rl - // TODO: update the sizes, etc in the ntfs attribute structure na - // TODO: update the mapping pairs array - // TODO: mark the inode dirty - // TODO: For all subsequent extents: - // TODO: free all clusters specified by the extent (FIXME: unless - // already done above!) - // TODO: completely delete each extent attribute record from its - // mft record - // TODO: free the mft record if there are no attributes left in it - // (to do so update the $MFT/$Bitmap as well as the mft - // record header in use flag, etc) - // TODO: write the updated mft record to disk - // TODO: remove the extent inode from the list of loaded extent - // inodes in the base inode - // TODO: free all memory associated with the extent inode - // TODO: update the attribute list attribute in ni->attr_list, removing - // all entries corresponding to deleted attributes - // TODO: if the attribute list attribute is resident: - // TODO: update the actual attribute in the base mft - // record from ni->attr_list - // if the attribute list attribute is not resident: - // TODO: update the attribute list attribute run list in - // ni->attr_list_rl, freeing any no longer used - // clusters - // TODO: mark the inode attribute list as containing - // dirty data - // TODO: update the mapping pairs array from - // ni->attr_list_rl - // TODO: mark the base inode dirty - - // TODO: Implement attribute list support as desribed above. (AIA) - if (NInoAttrList(na->ni)) { - err = ENOTSUP; - goto put_err_out; - } - // FIXME: We now know that we don't have an attribute list. Thus we - // are in the base inode only and hence it is all easier, even - // if we are cheating for now... (AIA) - /* The first cluster outside the new allocation. */ first_free_vcn = (newsize + vol->cluster_size - 1) >> vol->cluster_size_bits; @@ -3372,145 +3626,95 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) * clusters if there is a change. */ if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { + if (ntfs_attr_map_whole_runlist(na)) { + err = errno; + Dprintf("%s(): Eeek! ntfs_attr_map_whole_runlist " + "failed.\n", __FUNCTION__); + errno = err; + return -1; + } /* Deallocate all clusters starting with the first free one. */ nr_freed_clusters = ntfs_cluster_free(vol, na, first_free_vcn, -1); if (nr_freed_clusters < 0) { err = errno; - // FIXME: Eeek! Dprintf("%s(): Eeek! Freeing of clusters " - "failed. Aborting...\n", __FUNCTION__); - goto put_err_out; + "failed. Aborting...\n", __FUNCTION__); + errno = err; + return -1; } + /* Truncate the runlist itself. */ if (ntfs_rl_truncate(&na->rl, first_free_vcn)) { err = errno; - // FIXME: Eeek! We need rollback! (AIA) - Dprintf("%s(): Eeek! Run list truncation " - "failed. Leaving inconsistent " - "metadata!\n", __FUNCTION__); - goto put_err_out; + /* + * Failed to truncate the runlist, so just throw it + * away, it will be mapped afresh on next use. + */ + free(na->rl); + na->rl = NULL; + Dprintf("%s(): Eeek! Run list truncation failed.\n", + __FUNCTION__); + errno = err; + return -1; } - /* Update the attribute record and the ntfs_attr structure. */ + + /* Write mapping pairs for new runlist. */ + if (ntfs_attr_update_mapping_pairs(na)) { + err = errno; + Dprintf("%s(): Eeek! Mapping pairs update failed. " + "Leaving inconsist metadata. Run chkdsk.\n", + __FUNCTION__); + errno = err; + return -1; + } + } + + /* Get the first attribute record. */ + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); + if (!ctx) { + if ((na->allocated_size >> vol->cluster_size_bits) + != first_free_vcn) + Dprintf("%s(): Coudn't get attribute search context. " + "Leaving inconsist metadata.\n", __FUNCTION__); + else + Dprintf("%s(): Coudn't get attribute search context.\n", + __FUNCTION__); + return -1; + } + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, + ctx)) { + err = errno; + if (err == ENOENT) + err = EIO; + Dprintf("%s(): Eeek! Lookup of first attribute extent failed. " + "Leaving inconsist metadata.\n", __FUNCTION__); + goto put_err_out; + } + a = ctx->attr; + + /* Update allocated size only if it is changed. */ + if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = scpu_to_le64(na->allocated_size); - if (NAttrCompressed(na) || NAttrSparse(na)) { - na->compressed_size -= nr_freed_clusters << - vol->cluster_size_bits; - // FIXME: Bug catcher. Remove later... (AIA) - if (!newsize && na->compressed_size) { - Dprintf("%s(): Eeek! !newsize but " - "na->compressed_size not zero " - "(= %lli)! Fixing up by hand!\n", - __FUNCTION__, (long long) - na->compressed_size); - na->compressed_size = 0; - } - a->compressed_size = scpu_to_le64(na->compressed_size); - - // FIXME: Bug catcher. Remove later... (AIA) - if (na->compressed_size < 0) { - // FIXME: Eeek! BUG! - Dprintf("%s(): Eeek! Compressed size " - "is negative. Leaving " - "inconsistent metadata!\n", - __FUNCTION__); - err = EIO; - goto put_err_out; - } - } - a->highest_vcn = scpu_to_le64(first_free_vcn - 1); - /* Get the size for the new mapping pairs array. */ - mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl, 0); - if (mp_size <= 0) { - err = errno; - // FIXME: Eeek! We need rollback! (AIA) - Dprintf("%s(): Eeek! Get size for mapping " - "pairs failed. Leaving inconsistent " - "metadata!\n", __FUNCTION__); - goto put_err_out; - } - /* - * Generate the new mapping pairs array directly into the - * correct destination, i.e. the attribute record itself. - */ - if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( - a->mapping_pairs_offset), mp_size, - na->rl, 0, NULL)) { - err = errno; - // FIXME: Eeek! We need rollback! (AIA) - Dprintf("%s(): Eeek! Mapping pairs build " - "failed. Leaving inconsistent " - "metadata!\n", __FUNCTION__); - goto put_err_out; - } - /* - * Check that the attribute name hasn't been placed after the - * attribute value/mapping pairs array. If it has we need to - * move it. TODO: Implement the move. For now just abort. (AIA) - */ - if (a->name_length) { - BOOL move_name = FALSE; - if (a->non_resident) { - if (le16_to_cpu(a->name_offset) >= le16_to_cpu( - a->mapping_pairs_offset)) - move_name = TRUE; - } else { - if (le16_to_cpu(a->name_offset) >= - le16_to_cpu(a->value_offset)) - move_name = TRUE; - - } - if (move_name) { - // FIXME: Eeek! - Dprintf("%s(): Eeek! Name is placed " - "after the %s. Aborting...\n", - __FUNCTION__, a->non_resident ? - "mapping pairs array": - "attribute value"); - err = ENOTSUP; - goto put_err_out; - } - } - /* - * Calculate the new attribute length and mft record bytes - * used. - */ - new_alen = (le16_to_cpu(a->mapping_pairs_offset) + mp_size + - 7) & ~7; - new_muse = le32_to_cpu(m->bytes_in_use) - - le32_to_cpu(a->length) + new_alen; - if (new_muse > le32_to_cpu(m->bytes_allocated)) { - // FIXME: Eeek! BUG() - Dprintf("%s(): Eeek! Ran out of space in mft " - "record. Leaving inconsistent " - "metadata!\n", __FUNCTION__); - err = EIO; - goto put_err_out; - } - /* Move the following attributes forward. */ - memmove((u8*)a + new_alen, (u8*)a + le32_to_cpu(a->length), - le32_to_cpu(m->bytes_in_use) - ((u8*)a - - (u8*)m) - le32_to_cpu(a->length)); - /* Update the sizes of the attribute and mft records. */ - a->length = cpu_to_le32(new_alen); - m->bytes_in_use = cpu_to_le32(new_muse); } - /* Update the attribute record and the ntfs attribute structure. */ + + /* Update data and initialized size. */ na->data_size = newsize; a->data_size = scpu_to_le64(newsize); if (newsize < na->initialized_size) { na->initialized_size = newsize; a->initialized_size = scpu_to_le64(newsize); } + /* If the attribute now has zero size, make it resident. */ if (!newsize) { if (ntfs_attr_make_resident(na, ctx)) { /* If couldn't make resident, just continue. */ if (errno != EPERM) Dprintf("%s(): Failed to make attribute " - "resident. Leaving as is...\n", - __FUNCTION__); + "resident. Leaving as is...\n", + __FUNCTION__); } } @@ -3543,16 +3747,12 @@ put_err_out: static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) { LCN lcn_seek_from; - VCN first_free_vcn, stop_vcn; + VCN first_free_vcn; + ATTR_RECORD *a; ntfs_volume *vol; ntfs_attr_search_ctx *ctx; - ATTR_RECORD *a; - MFT_RECORD *m; runlist *rl, *rln; - ntfs_inode *ni; - int err, mp_size, cur_max_mp_size, exp_max_mp_size; - BOOL add_attr_list_and_retry = FALSE; - BOOL mft_records_changed = FALSE; + int err; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type); @@ -3574,10 +3774,6 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) return -1; } - ctx = ntfs_attr_get_search_ctx(na->ni, NULL); - if (!ctx) - return -1; - /* The first cluster outside the new allocation. */ first_free_vcn = (newsize + vol->cluster_size - 1) >> vol->cluster_size_bits; @@ -3586,38 +3782,10 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) * clusters if there is a change. */ if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { - /* Get the last extent of the attribute. */ - if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, - (na->allocated_size >> - vol->cluster_size_bits) - 1, NULL, 0, ctx)) { + if (ntfs_attr_map_whole_runlist(na)) { err = errno; - if (err == ENOENT) - err = EIO; - goto put_err_out; - } - a = ctx->attr; - m = ctx->mrec; - - /* - * Check that the attribute name hasn't been placed after the - * mapping pairs array. If it has we need to move it. - * TODO: Implement the move, if someone will hit it. - */ - if (a->name_length) { - if (le16_to_cpu(a->name_offset) >= - le16_to_cpu(a->mapping_pairs_offset)) { - Dprintf("%s(): Eeek! Name is placed after the " - "mapping pairs array. Aborting...\n", - __FUNCTION__); - err = ENOTSUP; - goto put_err_out; - } - } - - if (ntfs_attr_map_runlist(na, sle64_to_cpu(a->lowest_vcn))) { - err = errno; - Dprintf("%s(): Eeek! ntfs_attr_map_runlist failed.\n", - __FUNCTION__); + Dprintf("%s(): Eeek! ntfs_attr_map_whole_runlist " + "failed.\n", __FUNCTION__); goto put_err_out; } @@ -3668,136 +3836,24 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) } na->rl = rln; - /* Get the size for the new mapping pairs array. */ - mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl, - sle64_to_cpu(a->lowest_vcn)); - if (mp_size <= 0) { + /* Write mapping pairs for new runlist. */ + if (ntfs_attr_update_mapping_pairs(na)) { err = errno; - Dprintf("%s(): Eeek! Get size for mapping " - "pairs failed.\n", __FUNCTION__); + Dprintf("%s(): Eeek! Mapping pairs update failed.\n", + __FUNCTION__); goto rollback; } - /* - * Determine maximum possible length of mapping pairs, - * if we shall *not* expand space for mapping pairs. - */ - cur_max_mp_size = le32_to_cpu(a->length) - - le16_to_cpu(a->mapping_pairs_offset); - /* - * Determine maximum possible length of mapping pairs in the - * current mft record, if we shall expand space for mapping - * pairs. - */ - exp_max_mp_size = le32_to_cpu(m->bytes_allocated) - - le32_to_cpu(m->bytes_in_use) + cur_max_mp_size; - - /* Test mapping pairs for fitting in the current mft record. */ - if (mp_size > exp_max_mp_size) { - /* - * Mapping pairs of $ATTRIBUTE_LIST attribute must fit - * in the base mft record. - */ - if (na->type == AT_ATTRIBUTE_LIST) { - err = ENOSPC; - goto rollback; - } - - /* Add attribute list, if it isn't present and retry. */ - if (!NInoAttrList(na->ni)) { - err = ENOTSUP; /* to suppress gcc complain */ - add_attr_list_and_retry = TRUE; - goto rollback; - } - - /* - * Set mapping pairs size to maximum possible for this - * mft record. We shall allocate new mft records for - * rest of mapping pairs. - */ - mp_size = exp_max_mp_size; - } - - /* Expand space for mapping pairs if we need this. */ - if (mp_size > cur_max_mp_size) { - if (ntfs_attr_record_resize(m, a, - le16_to_cpu(a->mapping_pairs_offset) + - mp_size)) { - Dprintf("%s(): BUG! Ran out of space in" - " mft record. Please run chkdsk" - " and if that doesn't find any " - "errors please report you saw " - "this message to " - "linux-ntfs-dev@lists.sf.net." - "\n", __FUNCTION__); - err = EIO; - goto rollback; - } - mft_records_changed = TRUE; - } - /* - * Generate the new mapping pairs array directly into the - * correct destination, i.e. the attribute record itself. - * If we ran out of space than allocate new MFT record, add - * attribute extent to it and continue generation. - */ - stop_vcn = sle64_to_cpu(a->lowest_vcn); - ni = ctx->ntfs_ino; - while(ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( - a->mapping_pairs_offset), mp_size, na->rl, - stop_vcn, &stop_vcn)) { - if (errno != ENOSPC) { - err = errno; - Dprintf("%s(): BUG! Mapping pairs build " - "failed. Please run chkdsk and if " - "that doesn't find any errors please " - "report you saw this message to " - "linux-ntfs-dev@lists.sf.net.\n", - __FUNCTION__); - goto rollback; - } - a->highest_vcn = scpu_to_le64(stop_vcn - 1); - mft_records_changed = TRUE; - ntfs_inode_mark_dirty(ni); - - /* Calculate size of rest mapping pairs. */ - mp_size = ntfs_get_size_for_mapping_pairs(vol, - na->rl, stop_vcn); - - /* Allocate new mft record. */ - ni = ntfs_mft_record_alloc(vol, na->ni); - if (!ni) { - err = errno; - Dprintf("%s(): Couldn't allocate new MFT " - "record.\n", __FUNCTION__); - goto rollback; - } - m = ni->mrec; - /* - * If mapping size exceed avaible space, set them to - * possible maximum. - */ - cur_max_mp_size = le32_to_cpu(m->bytes_allocated) - - le32_to_cpu(m->bytes_in_use) - 0x40 - - sizeof(ntfschar) * na->name_len; - if (mp_size > cur_max_mp_size) - mp_size = cur_max_mp_size; - /* Add atribute extent to new record. */ - err = ntfs_non_resident_attr_record_add(ni, na->type, - na->name, na->name_len, stop_vcn, mp_size, 0); - if (err == -1) { - err = errno; - Dprintf("%s(): Couldn't add attribute extent " - "into the MFT record.\n", __FUNCTION__); - goto rollback; - } - a = (ATTR_RECORD*)((u8*)m + err); - } - a->highest_vcn = scpu_to_le64(first_free_vcn - 1); - mft_records_changed = TRUE; - ntfs_inode_mark_dirty(ni); - ntfs_attr_reinit_search_ctx(ctx); } - + + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); + if (!ctx) { + if ((na->allocated_size >> vol->cluster_size_bits) != + first_free_vcn) + goto rollback; + else + goto put_err_out; + } + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, ctx)) { Dprintf("%s(): Eeek! Lookup of first attribute extent " @@ -3807,20 +3863,19 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) err = EIO; if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { - Dprintf("%s(): Trying perform rollback.\n", - __FUNCTION__); + ntfs_attr_put_search_ctx(ctx); goto rollback; } else goto put_err_out; } a = ctx->attr; - + + /* Update allocated size only if it is changed. */ if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { - /* Update the attribute record and the ntfs_attr structure. */ na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = scpu_to_le64(na->allocated_size); } - /* Update the attribute record and the ntfs attribute structure. */ + /* Update data size. */ na->data_size = newsize; a->data_size = scpu_to_le64(newsize); /* Set the inode dirty so it is written out later. */ @@ -3845,73 +3900,17 @@ rollback: */ free(na->rl); na->rl = NULL; - } - /* Add attribute list and try again. */ - if (add_attr_list_and_retry) { - ntfs_attr_put_search_ctx(ctx); - if (ntfs_inode_add_attrlist(na->ni)) { - err = errno; - Dprintf("%s(): Eeek! Coudn't add attribute list.\n", - __FUNCTION__); - errno = err; - return -1; + Dprintf("%s(): Eeek! Coudn't truncate runlist. Rollback " + "failed.\n", __FUNCTION__); + } else { + /* Retore mapping pairs. */ + if (ntfs_attr_update_mapping_pairs(na)) { + Dprintf("%s(): Eeek! Coudn't restore old mapping " + "pairs. Rollback failed.\n", __FUNCTION__); } - return ntfs_non_resident_attr_expand(na, newsize); } - /* Do we need rollback changes inside MFT records.*/ - if (!mft_records_changed) - goto put_err_out; - /* Rollback changes inside MFT records. */ - ntfs_attr_reinit_search_ctx(ctx); - if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, - (na->allocated_size >> vol->cluster_size_bits) - 1, - NULL, 0, ctx)) { - Dprintf("%s(): Eeek! Rollback failed. Run chkdsk.\n", - __FUNCTION__); - goto put_err_out; - } - a = ctx->attr; - m = ctx->mrec; - mp_size = ntfs_get_size_for_mapping_pairs(vol, na->rl, - sle64_to_cpu(a->lowest_vcn)); - if (mp_size <= 0) { - Dprintf("%s(): Eeek! Get size for mapping pairs failed. " - "Rollback failed. Run chkdsk.\n", __FUNCTION__); - goto put_err_out; - } - if (ntfs_attr_record_resize(m, a, - le16_to_cpu(a->mapping_pairs_offset) + mp_size)) { - Dprintf("%s(): Eeek! Attribuite record resize failed. Rollback " - "failed. Run chkdsk.\n", __FUNCTION__); - goto put_err_out; - } - if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( - a->mapping_pairs_offset), mp_size, na->rl, - sle64_to_cpu(a->lowest_vcn), 0)) { - Dprintf("%s(): Eeek! Mapping pairs build failed. Rollback " - "failed. Run chkdsk.\n", __FUNCTION__); - goto put_err_out; - } - a->highest_vcn = scpu_to_le64((na->allocated_size >> - vol->cluster_size_bits) - 1); - stop_vcn = 0; - while (!ntfs_attr_lookup(na->type, na->name, - na->name_len, 0, 0, NULL, 0, ctx)) { - if (stop_vcn > sle64_to_cpu(ctx->attr->highest_vcn)) - continue; - stop_vcn = sle64_to_cpu(ctx->attr->highest_vcn) + 1; - if (ntfs_attr_record_rm(ctx)) { - Dprintf("%s(): Eeek! Removing attribute extent failed. " - "Rollback failed. Run chkdsk.\n", __FUNCTION__); - goto put_err_out; - } - ntfs_attr_reinit_search_ctx(ctx); - } - if (errno != ENOENT) { - Dprintf("%s(): Eeek! Attribute extent lookup failed. Rollback " - "failed. Run chkdsk.\n", __FUNCTION__); - } else - Dprintf("%s(): Rollback success.\n", __FUNCTION__); + errno = err; + return -1; put_err_out: ntfs_attr_put_search_ctx(ctx); errno = err; From 6f27be95efba004b44fe08a610acd21cb6dadda5 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 29 Sep 2004 15:43:22 +0000 Subject: [PATCH 1955/2994] Merge 2004/09/29 18:35:01+03:00 (none)!yura Merge 2004/09/29 18:16:34+03:00 (none)!yura include/ntfs/attrlist.h Add new helper ntfs_attrlist_mark_dirty. libntfs/attrib.c - Deallocate clusters when free atribute list. - Write ntfs_attr_update_mapping_pairs and make ntfs_non_resident_attr_{shrink,expand} use it. libntfs/runlist.c ntfs_mapping_pairs_build: - Make it set stop vcn even function doesn't failed. - Minor bugfix. BKrev: 415ad81aQ8d6CL2cbK7X90Wi0br1bQ From 030e531012fc0d75587b9db106db8d4ad95fbd08 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 29 Sep 2004 15:43:22 +0000 Subject: [PATCH 1956/2994] SCCS merged 2004/09/29 18:21:24+03:00 (none)!yura SCCS merged 2004/09/29 18:16:34+03:00 (none)!yura Update. (Logical change 1.584) --- ChangeLog | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3ad32e63..c8f64777 100644 --- a/ChangeLog +++ b/ChangeLog @@ -54,7 +54,12 @@ xx/xx/2004 - 2.0.0-WIP - New API: inode.[ch]::ntfs_inode_add_attrlist. (Yura) - New API: attrlist.[ch]::ntfs_attrlist_need. (Yura) - ntfsclone: save by using our, not NTFS cluster allocation bitmap. - This gives more control in the future what to save (Szaka) + This gives more control in the future what to save. (Szaka) + - New helper: attrlist.h::ntfs_attrlist_mark_dirty. (Yura) + - New API: attrib.[ch]::ntfs_attr_update_mapping_pairs and made + ntfs_non_resident_attr_{shrink,expand} use it, thus attribute resize + functions is almost completed, but still very experemental and maybe + dangerous. (Yura) - Fix stupid bug in ntfs_attr_reinit_search_ctx() introduced during changes to ntfs_external_attr_find(). This is because ntfs_attr_lookup() intentionally does not clear ctx->al_entry but From 21613e7190e8044c2c4255a8e710b7fb097f722f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 29 Sep 2004 15:43:22 +0000 Subject: [PATCH 1957/2994] ntfs_mapping_pairs_build: - Make it set stop vcn even function doesn't failed. - Minor bugfix. (Logical change 1.584) --- libntfs/runlist.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 2e7d3a32..6d43ae4e 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1261,11 +1261,15 @@ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, int rls; if (start_vcn < 0) { + Dprintf("%s(): start_vcn %lld (should be >= 0)", + __FUNCTION__, (long long) start_vcn); errno = EINVAL; return -1; } if (!rl) { if (start_vcn) { + Dprintf("%s(): rl NULL, start_vcn %lld (should be > 0)", + __FUNCTION__, (long long) start_vcn); errno = EINVAL; return -1; } @@ -1396,7 +1400,7 @@ err_out: * @dst_len: size of destination buffer @dst in bytes * @rl: runlist for which to build the mapping pairs array * @start_vcn: vcn at which to start the mapping pairs array - * @stop_vcn: first vcn outside destination buffer on on ENOSPC error + * @stop_vcn: first vcn outside destination buffer on success or ENOSPC error * * Create the mapping pairs array from the runlist @rl, starting at vcn * @start_vcn and save the array in @dst. @dst_len is the size of @dst in @@ -1405,12 +1409,12 @@ err_out: * * If @rl is NULL, just write a single terminator byte to @dst. * - * On error ENOSPC, if @stop_vcn is not NULL, *@stop_vcn is set to the first - * vcn outside the destination buffer. Note that @dst has been filled with all - * the mapping pairs that will fit, thus it can be treated as partial success, - * in that a new attribute extent needs to be created or the next extent has to - * be used and the mapping pairs build has to be continued with @start_vcn set - * to *@stop_vcn. + * On success or ENOSPC error, if @stop_vcn is not NULL, *@stop_vcn is set to + * the first vcn outside the destination buffer. Note that on error @dst has + * been filled with all the mapping pairs that will fit, thus it can be treated + * as partial success, in that a new attribute extent needs to be created or the + * next extent has to be used and the mapping pairs build has to be continued + * with @start_vcn set to *@stop_vcn. * * Return 0 on success. On error, return -1 with errno set to the error code. * The following error codes are defined: @@ -1433,8 +1437,12 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, if (!rl) { if (start_vcn) goto val_err; - if (dst_len < 1) - goto size_err; + if (stop_vcn) + *stop_vcn = 0; + if (dst_len < 1) { + errno = ENOSPC; + return -1; + } /* Terminator byte. */ *dst = 0; return 0; @@ -1528,12 +1536,17 @@ int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, /* Position at next mapping pairs array element. */ dst += 1 + len_len + lcn_len; } + /* Set stop vcn. */ + if (stop_vcn) + *stop_vcn = rl->vcn; /* Add terminator byte. */ *dst = 0; return 0; size_err: + /* Set stop vcn. */ if (stop_vcn) *stop_vcn = rl->vcn; + /* Add terminator byte. */ *dst = 0; errno = ENOSPC; return -1; From 59ab6cdb333079d80d4aff87f087a4abc4cf69d0 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 29 Sep 2004 15:52:46 +0000 Subject: [PATCH 1958/2994] Use ntfs_attr_reinit_search_ctx instead ntfs_attr_init_search_ctx, because Anton fixed bug prevent us doing so. (Logical change 1.585) --- libntfs/attrib.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 62f847e6..8448342f 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3466,12 +3466,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) /* Deallocate not used attribute extents and return with success. */ if (finished_build) { - /* - * FIXME: We use ntfs_attr_init_search_ctx instead of - * ntfs_attr_reinit_search_ctx because last seems to be buggy. - */ - //ntfs_attr_reinit_search_ctx(ctx); - ntfs_attr_init_search_ctx(ctx, na->ni, NULL); + ntfs_attr_reinit_search_ctx(ctx); Dprintf("%s(): Deallocate marked extents.\n", __FUNCTION__); while (!ntfs_attr_lookup(na->type, na->name, na->name_len, IGNORE_CASE, 0, NULL, 0, ctx)) { From 67ca77c25cad52a83c61ff17eb07de424f98cf35 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 29 Sep 2004 15:52:46 +0000 Subject: [PATCH 1959/2994] Use ntfs_attr_reinit_search_ctx instead ntfs_attr_init_search_ctx, because Anton fixed bug prevent us doing so. BKrev: 415ada4enbsYCkE7_BGDvs3Pcp3UmA From 8b3c03e173599766d696a995b30baba0f442b099 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 30 Sep 2004 15:00:31 +0000 Subject: [PATCH 1960/2994] Rename scpu_to_le{16,32,64}() to cpu_to_sle{16,32,64}() to match the kernel. (Logical change 1.586) --- ChangeLog | 2 ++ include/ntfs/endians.h | 12 ++++++------ libntfs/attrib.c | 36 ++++++++++++++++++------------------ libntfs/mft.c | 24 ++++++++++++------------ ntfsprogs/mkntfs.c | 8 ++++---- ntfsprogs/ntfscp.c | 4 ++-- ntfsprogs/ntfsresize.c | 2 +- 7 files changed, 45 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8f64777..03e81cab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -66,6 +66,8 @@ xx/xx/2004 - 2.0.0-WIP does clear ctx->base_ntfs_ino which in turn means that ntfs_attr_reinit_search_ctx() does not clear ctx->al_entry. Now, ntfs_attr_reinit_search_ctx() always clears ctx->al_entry. + - Rename scpu_to_le{16,32,64}() to cpu_to_sle{16,32,64}() to match the + kernel. 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h index e716604e..e0b6d51a 100644 --- a/include/ntfs/endians.h +++ b/include/ntfs/endians.h @@ -180,13 +180,13 @@ /* Signed from CPU to LE conversion. */ -#define scpu_to_le16(x) (s16)__cpu_to_le16((s16)(x)) -#define scpu_to_le32(x) (s32)__cpu_to_le32((s32)(x)) -#define scpu_to_le64(x) (s64)__cpu_to_le64((s64)(x)) +#define cpu_to_sle16(x) (s16)__cpu_to_le16((s16)(x)) +#define cpu_to_sle32(x) (s32)__cpu_to_le32((s32)(x)) +#define cpu_to_sle64(x) (s64)__cpu_to_le64((s64)(x)) -#define scpu_to_le16p(x) (s16)__cpu_to_le16(*(s16*)(x)) -#define scpu_to_le32p(x) (s32)__cpu_to_le32(*(s32*)(x)) -#define scpu_to_le64p(x) (s64)__cpu_to_le64(*(s64*)(x)) +#define cpu_to_sle16p(x) (s16)__cpu_to_le16(*(s16*)(x)) +#define cpu_to_sle32p(x) (s32)__cpu_to_le32(*(s32*)(x)) +#define cpu_to_sle64p(x) (s64)__cpu_to_le64(*(s64*)(x)) /* Constant endianness conversion defines. */ diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 8448342f..1380ba27 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -997,7 +997,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) errno = ENOTSUP; goto err_out; } - ctx->attr->initialized_size = scpu_to_le64(pos + count); + ctx->attr->initialized_size = cpu_to_sle64(pos + count); if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec)) { /* @@ -1005,7 +1005,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) * back for writing. */ ctx->attr->initialized_size = - scpu_to_le64(old_initialized_size); + cpu_to_sle64(old_initialized_size); ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, ctx->mrec); goto err_out; @@ -1147,7 +1147,7 @@ err_out: na->name_len, 0, 0, NULL, 0, ctx); if (!err) { na->initialized_size = old_initialized_size; - ctx->attr->initialized_size = scpu_to_le64( + ctx->attr->initialized_size = cpu_to_sle64( old_initialized_size); err = ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, @@ -2486,7 +2486,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, sizeof(ntfschar) * name_len); a->flags = flags; a->instance = m->next_attr_instance; - a->lowest_vcn = scpu_to_le64(lowest_vcn); + a->lowest_vcn = cpu_to_sle64(lowest_vcn); a->mapping_pairs_offset = cpu_to_le16(length - dataruns_size); a->compression_unit = (flags & ATTR_COMPRESSION_MASK) ? 4 : 0; if (name_len) @@ -2912,8 +2912,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, ATTR_COMPRESSION_MASK); /* Setup the fields specific to non-resident attributes. */ - a->lowest_vcn = scpu_to_le64(0); - a->highest_vcn = scpu_to_le64((new_allocated_size - 1) >> + a->lowest_vcn = cpu_to_sle64(0); + a->highest_vcn = cpu_to_sle64((new_allocated_size - 1) >> vol->cluster_size_bits); a->mapping_pairs_offset = cpu_to_le16(mp_ofs); @@ -2922,8 +2922,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, memset(&a->reserved1, 0, sizeof(a->reserved1)); - a->allocated_size = scpu_to_le64(new_allocated_size); - a->data_size = a->initialized_size = scpu_to_le64(na->data_size); + a->allocated_size = cpu_to_sle64(new_allocated_size); + a->data_size = a->initialized_size = cpu_to_sle64(na->data_size); /* Generate the mapping pairs array in the attribute record. */ if (ntfs_mapping_pairs_build(vol, (u8*)a + mp_ofs, arec_size - mp_ofs, @@ -3335,7 +3335,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) Dprintf("%s(): Marked attr 0x%x for delete in inode " "0x%llx.\n", __FUNCTION__, le32_to_cpu(a->type), ctx->ntfs_ino->mft_no); - a->highest_vcn = scpu_to_le64(NTFS_VCN_DELETE_MARK); + a->highest_vcn = cpu_to_sle64(NTFS_VCN_DELETE_MARK); ntfs_inode_mark_dirty(ctx->ntfs_ino); continue; } @@ -3429,12 +3429,12 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) } /* Update lowest vcn. */ - a->lowest_vcn = scpu_to_le64(stop_vcn); + a->lowest_vcn = cpu_to_sle64(stop_vcn); ntfs_inode_mark_dirty(ctx->ntfs_ino); if ((ctx->ntfs_ino->nr_extents == -1 || NInoAttrList(ctx->ntfs_ino)) && ctx->attr->type != AT_ATTRIBUTE_LIST) { - ctx->al_entry->lowest_vcn = scpu_to_le64(stop_vcn); + ctx->al_entry->lowest_vcn = cpu_to_sle64(stop_vcn); ntfs_attrlist_mark_dirty(ctx->ntfs_ino); } @@ -3455,7 +3455,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) __FUNCTION__); goto put_err_out; } - a->highest_vcn = scpu_to_le64(stop_vcn - 1); + a->highest_vcn = cpu_to_sle64(stop_vcn - 1); } /* Check wether error occured. */ if (errno != ENOENT) { @@ -3558,7 +3558,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) __FUNCTION__); goto put_err_out; } - a->highest_vcn = scpu_to_le64(stop_vcn - 1); + a->highest_vcn = cpu_to_sle64(stop_vcn - 1); ntfs_inode_mark_dirty(ni); /* All mapping pairs are writed. */ if (!err) @@ -3691,15 +3691,15 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) /* Update allocated size only if it is changed. */ if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { na->allocated_size = first_free_vcn << vol->cluster_size_bits; - a->allocated_size = scpu_to_le64(na->allocated_size); + a->allocated_size = cpu_to_sle64(na->allocated_size); } /* Update data and initialized size. */ na->data_size = newsize; - a->data_size = scpu_to_le64(newsize); + a->data_size = cpu_to_sle64(newsize); if (newsize < na->initialized_size) { na->initialized_size = newsize; - a->initialized_size = scpu_to_le64(newsize); + a->initialized_size = cpu_to_sle64(newsize); } /* If the attribute now has zero size, make it resident. */ @@ -3868,11 +3868,11 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) /* Update allocated size only if it is changed. */ if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { na->allocated_size = first_free_vcn << vol->cluster_size_bits; - a->allocated_size = scpu_to_le64(na->allocated_size); + a->allocated_size = cpu_to_sle64(na->allocated_size); } /* Update data size. */ na->data_size = newsize; - a->data_size = scpu_to_le64(newsize); + a->data_size = cpu_to_sle64(newsize); /* Set the inode dirty so it is written out later. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); /* Done! */ diff --git a/libntfs/mft.c b/libntfs/mft.c index ce447dbf..67ce252f 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -679,7 +679,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) goto undo_alloc; } /* Update the highest_vcn. */ - a->highest_vcn = scpu_to_le64(rl[1].vcn - 1); + a->highest_vcn = cpu_to_sle64(rl[1].vcn - 1); /* * We now have extended the mft bitmap allocated_size by one cluster. * Reflect this in the ntfs_attr structure and the attribute record. @@ -700,7 +700,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) a = ctx->attr; } mftbmp_na->allocated_size += vol->cluster_size; - a->allocated_size = scpu_to_le64(mftbmp_na->allocated_size); + a->allocated_size = cpu_to_sle64(mftbmp_na->allocated_size); /* Ensure the changes make it to disk. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); @@ -723,7 +723,7 @@ restore_undo_alloc: } m = ctx->mrec; a = ctx->attr; - a->highest_vcn = scpu_to_le64(rl[1].vcn - 2); + a->highest_vcn = cpu_to_sle64(rl[1].vcn - 2); errno = ret; undo_alloc: ret = errno; @@ -796,10 +796,10 @@ static int ntfs_mft_bitmap_extend_initialized(ntfs_volume *vol) old_data_size = mftbmp_na->data_size; old_initialized_size = mftbmp_na->initialized_size; mftbmp_na->initialized_size += 8; - a->initialized_size = scpu_to_le64(mftbmp_na->initialized_size); + a->initialized_size = cpu_to_sle64(mftbmp_na->initialized_size); if (mftbmp_na->initialized_size > mftbmp_na->data_size) { mftbmp_na->data_size = mftbmp_na->initialized_size; - a->data_size = scpu_to_le64(mftbmp_na->data_size); + a->data_size = cpu_to_sle64(mftbmp_na->data_size); } /* Ensure the changes make it to disk. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); @@ -831,10 +831,10 @@ put_err_out: } a = ctx->attr; mftbmp_na->initialized_size = old_initialized_size; - a->initialized_size = scpu_to_le64(old_initialized_size); + a->initialized_size = cpu_to_sle64(old_initialized_size); if (mftbmp_na->data_size != old_data_size) { mftbmp_na->data_size = old_data_size; - a->data_size = scpu_to_le64(old_data_size); + a->data_size = cpu_to_sle64(old_data_size); } ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); @@ -1003,7 +1003,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) goto undo_alloc; } /* Update the highest_vcn. */ - a->highest_vcn = scpu_to_le64(rl[1].vcn - 1); + a->highest_vcn = cpu_to_sle64(rl[1].vcn - 1); /* * We now have extended the mft data allocated_size by nr clusters. * Reflect this in the ntfs_attr structure and the attribute record. @@ -1026,7 +1026,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) a = ctx->attr; } mft_na->allocated_size += nr << vol->cluster_size_bits; - a->allocated_size = scpu_to_le64(mft_na->allocated_size); + a->allocated_size = cpu_to_sle64(mft_na->allocated_size); /* Ensure the changes make it to disk. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); @@ -1049,7 +1049,7 @@ restore_undo_alloc: } m = ctx->mrec; a = ctx->attr; - a->highest_vcn = scpu_to_le64(old_last_vcn - 1); + a->highest_vcn = cpu_to_sle64(old_last_vcn - 1); errno = err; undo_alloc: err = errno; @@ -1318,8 +1318,8 @@ found_free_rec: goto undo_data_init; } a = ctx->attr; - a->initialized_size = scpu_to_le64(mft_na->initialized_size); - a->data_size = scpu_to_le64(mft_na->data_size); + a->initialized_size = cpu_to_sle64(mft_na->initialized_size); + a->data_size = cpu_to_sle64(mft_na->data_size); /* Ensure the changes make it to disk. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 2c544a3f..7fc56e0e 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3464,9 +3464,9 @@ static void mkntfs_create_root_structures(void) * If there are problems go back to bs->unused[0-3] and set them. See * ../include/layout.h for details. */ - bs->number_of_sectors = scpu_to_le64(opts.nr_sectors); - bs->mft_lcn = scpu_to_le64(opts.mft_lcn); - bs->mftmirr_lcn = scpu_to_le64(opts.mftmirr_lcn); + bs->number_of_sectors = cpu_to_sle64(opts.nr_sectors); + bs->mft_lcn = cpu_to_sle64(opts.mft_lcn); + bs->mftmirr_lcn = cpu_to_sle64(opts.mftmirr_lcn); if (vol->mft_record_size >= vol->cluster_size) bs->clusters_per_mft_record = vol->mft_record_size / vol->cluster_size; @@ -3496,7 +3496,7 @@ static void mkntfs_create_root_structures(void) bs->clusters_per_index_record, bs->clusters_per_index_record); /* Generate a 64-bit random number for the serial number. */ - bs->volume_serial_number = scpu_to_le64(((s64)random() << 32) | + bs->volume_serial_number = cpu_to_sle64(((s64)random() << 32) | ((s64)random() & 0xffffffff)); /* * Leave zero for now as NT4 leaves it zero, too. If want it later, see diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index a3043da9..69c30d7f 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -284,9 +284,9 @@ int main (int argc, char *argv[]) le16_to_cpu(ctx->attr->value_offset)); if (sle64_to_cpu(fna->allocated_size) || sle64_to_cpu(fna->data_size)) { - fna->allocated_size = scpu_to_le64( + fna->allocated_size = cpu_to_sle64( na->allocated_size); - fna->data_size = scpu_to_le64(na->data_size); + fna->data_size = cpu_to_sle64(na->data_size); ntfs_inode_mark_dirty(ctx->ntfs_ino); } } diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index a50f418b..0dedb155 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1947,7 +1947,7 @@ static void update_bootsector(ntfs_resize_t *r) if (vol->dev->d_ops->read(vol->dev, &bs, bs_size) == -1) perr_exit("read() error"); - bs.number_of_sectors = scpu_to_le64(r->new_volume_size * + bs.number_of_sectors = cpu_to_sle64(r->new_volume_size * bs.bpb.sectors_per_cluster); if (r->mftmir_old) { From 5d3b1b0f2b15ad83fc248aeaa3fd68f1d09d4c28 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 30 Sep 2004 15:00:31 +0000 Subject: [PATCH 1961/2994] Rename scpu_to_le{16,32,64}() to cpu_to_sle{16,32,64}() to match the kernel. BKrev: 415c1f8fCHgsWh4EEJdrb4uAQkKqcg From ec00d338cbf77ebec6c7e3d315b51f2a1d044b02 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Thu, 30 Sep 2004 18:16:48 +0000 Subject: [PATCH 1962/2994] honor bad clusters list ($BadClus:$Bad), known bad sectors aren't tried to be saved anymore (Szaka) (Logical change 1.587) --- ntfsprogs/ntfsclone.c | 107 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index e3cad3f8..e73fec08 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -396,6 +396,11 @@ static s64 is_critical_metadata(ntfs_walk_clusters_ctx *image, runlist *rl) s64 inode = image->ni->mft_no; if (inode <= LAST_METADATA_INODE) { + + /* Don't save bad sectors (both $Bad and unnamed are ignored */ + if (inode == FILE_BadClus && image->ctx->attr->type == AT_DATA) + return 0; + if (inode != FILE_LogFile) return rl->length; @@ -1220,6 +1225,97 @@ static void check_output_device(s64 input_size) set_filesize(input_size); } +static ntfs_attr_search_ctx *attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) +{ + ntfs_attr_search_ctx *ret; + + if ((ret = ntfs_attr_get_search_ctx(ni, mrec)) == NULL) + perr_printf("ntfs_attr_get_search_ctx"); + + return ret; +} + +static int str2unicode(const char *aname, ntfschar **ustr, int *len) +{ + if (aname && ((*len = ntfs_mbstoucs(aname, ustr, 0)) == -1)) { + perr_printf("Unable to convert '%s' to Unicode", aname); + return -1; + } + + if (!*ustr || !*len) { + *ustr = AT_UNNAMED; + *len = 0; + } + + return 0; +} + +/** + * lookup_data_attr + * + * Find the $DATA attribute (with or without a name) for the given ntfs inode. + */ +static ntfs_attr_search_ctx *lookup_data_attr(ntfs_inode *ni, const char *aname) +{ + ntfs_attr_search_ctx *ctx; + ntfschar *ustr = NULL; + int len = 0; + + if ((ctx = attr_get_search_ctx(ni, NULL)) == NULL) + return NULL; + + if (str2unicode(aname, &ustr, &len) == -1) + goto error_out; + + if (ntfs_attr_lookup(AT_DATA, ustr, len, 0, 0, NULL, 0, ctx)) { + perr_printf("ntfs_attr_lookup"); + goto error_out; + } + if (ustr != AT_UNNAMED) + free(ustr); + + return ctx; +error_out: + ntfs_attr_put_search_ctx(ctx); + return NULL; +} + +static void ignore_bad_clusters(ntfs_walk_clusters_ctx *image) +{ + ntfs_inode *ni; + ntfs_attr_search_ctx *ctx = NULL; + runlist *rl; + s64 nr_bad_clusters = 0; + + if (!(ni = ntfs_inode_open(vol, FILE_BadClus))) + perr_exit("ntfs_open_inode"); + + if ((ctx = lookup_data_attr(ni, "$Bad")) == NULL) + exit(1); + + if (!(rl = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL))) + perr_exit("ntfs_mapping_pairs_decompress"); + + for (; rl->length; rl++) { + s64 lcn = rl->lcn; + + if (lcn == LCN_HOLE || lcn < 0) + continue; + + for (; lcn < rl->lcn + rl->length; lcn++, nr_bad_clusters++) { + if (ntfs_bit_get_and_set(lcn_bitmap.bm, lcn, 0)) + image->inuse--; + } + } + if (nr_bad_clusters) + Printf("WARNING: The disk has %lld or more bad sectors" + " (hardware faults).\n", nr_bad_clusters); + + ntfs_attr_put_search_ctx(ctx); + if (ntfs_inode_close(ni)) + perr_exit("ntfs_inode_close failed for $BadClus"); +} + int main(int argc, char **argv) { ntfs_walk_clusters_ctx image; @@ -1279,16 +1375,19 @@ int main(int argc, char **argv) compare_bitmaps(&lcn_bitmap); print_disk_usage(vol->cluster_size, vol->nr_clusters, image.inuse); + ignore_bad_clusters(&image); + if (opt.save_image) initialise_image_hdr(device_size, image.inuse); /* FIXME: save backup boot sector */ if (opt.std_out || !opt.metadata_only) { - s64 nr_clusters = (opt.std_out && !opt.save_image) - ? vol->nr_clusters : image.inuse; - - clone_ntfs(nr_clusters); + s64 nr_clusters_to_save = image.inuse; + if (opt.std_out && !opt.save_image) + nr_clusters_to_save = vol->nr_clusters; + + clone_ntfs(nr_clusters_to_save); fsync_clone(fd_out); exit(0); } From 63b6f9ff3f775952761938590b0656143fd88994 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Thu, 30 Sep 2004 18:16:48 +0000 Subject: [PATCH 1963/2994] ntfsclone: honor bad clusters list ($BadClus:$Bad), known bad sectors aren't tried to be saved anymore (Szaka) (Logical change 1.587) --- ChangeLog | 2 ++ TODO.ntfsprogs | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 03e81cab..17570fcd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -68,6 +68,8 @@ xx/xx/2004 - 2.0.0-WIP ntfs_attr_reinit_search_ctx() always clears ctx->al_entry. - Rename scpu_to_le{16,32,64}() to cpu_to_sle{16,32,64}() to match the kernel. + - ntfsclone: honor bad clusters list ($BadClus:$Bad), known bad sectors + aren't tried to be saved anymore. (Szaka) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 45c2a979..7845f96e 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -26,7 +26,6 @@ Thanks, - get rid of the unneeded lseek()'s during reads/writes - catch if source and dest are the same -- consider badblock list - add dd's noerror option - disable consistency check for --metadata (e.g. if the check is crashing) - make "wiped", etc statistic variables long long From f7957bf3a6595dbd2070812e98bcdcee97fcbe6e Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Thu, 30 Sep 2004 18:16:48 +0000 Subject: [PATCH 1964/2994] ntfsclone: honor bad clusters list ($BadClus:$Bad), known bad sectors aren't tried to be saved anymore (Szaka) BKrev: 415c4d900JnOJDvMItDMUakPDPNXrw From 72025c9e741db911abe8c20150dec3386c43dd3e Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Thu, 30 Sep 2004 22:27:04 +0000 Subject: [PATCH 1965/2994] TODO.ntfsprogs: ntfsclone TODO update BKrev: 415c8838hG6eORtv1B3eQmENm1MjtA From 8dc76eeeb03d45b7b9e4e7c053878f7564674e55 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Thu, 30 Sep 2004 22:27:04 +0000 Subject: [PATCH 1966/2994] ntfsclone TODO update (Logical change 1.588) --- TODO.ntfsprogs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 7845f96e..24a9ec56 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -24,11 +24,27 @@ Thanks, * ntfsclone * ************* -- get rid of the unneeded lseek()'s during reads/writes +- get rid of the unneeded lseek()'s during reads/writes (probably it + doesn't improve performance much, or any at all) - catch if source and dest are the same - add dd's noerror option - disable consistency check for --metadata (e.g. if the check is crashing) +- ignore consistency check (different than "disabling" fsck) - make "wiped", etc statistic variables long long +- option: --inode +- option: --data +- metadata cloning: skip more non-needed inodes +- manual: document LFS issues (smbfs' lfs option, nfs) +- manual: mention optimized seeks +- manual: optimal backup if disks have bad sectors +- manual: ntfsclone guarantees the restored image works only + if one restores to the exactly same partition. For example, + one can not copy system partition to a different partition: + minimum "hidden sectors" field and BOOT.INI need modifications. + We could do these adjustments optionally. +- check if kernel block size = GCD(page size, device size) makes + effect on performance (Al Viro says no) +- check whether the O_WRONLY -> O_RDWR change made effect on performance *********** From b89f1ee8f69ca448a222d433e1d457752f23b57f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 1 Oct 2004 12:26:44 +0000 Subject: [PATCH 1967/2994] - Mapping pairs offset fixes. - Indent fixes. - ntfs_non_resident_attr_expand: fix some error code paths. (Logical change 1.589) --- libntfs/attrib.c | 72 +++++++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 1380ba27..af0c1bf1 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2317,16 +2317,16 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, MFT_RECORD *m; int err, offset; ntfs_inode *base_ni; - + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, flags 0x%x.\n", __FUNCTION__, (long long) ni->mft_no, (unsigned) type, (unsigned) flags); - + if (!ni || (!name && name_len)) { errno = EINVAL; return -1; } - + if (ntfs_attr_can_be_resident(ni->vol, type)) { err = errno; if (errno == EPERM) @@ -2338,7 +2338,8 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, errno = err; return -1; } - + + /* Locate place where record shoud be. */ ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); if (!ctx) return -1; @@ -2352,6 +2353,10 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, err = EIO; goto put_err_out; } + a = ctx->attr; + m = ctx->mrec; + + /* Make room for attribute. */ length = (0x18 + sizeof(ntfschar) * name_len + 7) & ~7; if (ntfs_make_room_for_attr(ctx->mrec, (u8*) ctx->attr, length)) { err = errno; @@ -2359,8 +2364,8 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, __FUNCTION__); goto put_err_out; } - a = ctx->attr; - m = ctx->mrec; + + /* Setup record fields. */ offset = ((u8*)a - (u8*)m); a->type = type; a->length = cpu_to_le32(length); @@ -2372,7 +2377,6 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, a->value_length = 0; a->value_offset = cpu_to_le16(length); a->resident_flags = 0; - if (name_len) memcpy((u8*)a + le16_to_cpu(a->name_offset), name, sizeof(ntfschar) * name_len); @@ -2428,17 +2432,17 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, MFT_RECORD *m; ntfs_inode *base_ni; int err, offset; - + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn %lld, " "dataruns_size %d, flags 0x%x.\n", __FUNCTION__, (long long) ni->mft_no, (unsigned) type, (long long) lowest_vcn, dataruns_size, (unsigned) flags); - + if (!ni || dataruns_size <= 0 || (!name && name_len)) { errno = EINVAL; return -1; } - + if (ntfs_attr_can_be_non_resident(ni->vol, type)) { err = errno; if (errno == EPERM) @@ -2450,9 +2454,8 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, errno = err; return -1; } - - dataruns_size = (dataruns_size + 7) & ~7; - + + /* Locate place where record shoud be. */ ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); if (!ctx) return -1; @@ -2466,29 +2469,36 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, err = EIO; goto put_err_out; } - length = 0x40 + sizeof(ntfschar) * name_len + dataruns_size; - if (flags & ATTR_COMPRESSION_MASK) - length += 8; + a = ctx->attr; + m = ctx->mrec; + + /* Make room for attribute. */ + dataruns_size = (dataruns_size + 7) & ~7; + length = offsetof(ATTR_RECORD, compressed_size) + ((sizeof(ntfschar) * + name_len + 7) & ~7) + dataruns_size + + (flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE)) ? + sizeof(a->compressed_size) : 0; if (ntfs_make_room_for_attr(ctx->mrec, (u8*) ctx->attr, length)) { err = errno; Dprintf("%s(): Failed to make room for attribute.\n", __FUNCTION__); goto put_err_out; } - a = ctx->attr; - m = ctx->mrec; + + /* Setup record fields. */ offset = ((u8*)a - (u8*)m); a->type = type; - a->length = cpu_to_le32((length + 7) & ~7); + a->length = cpu_to_le32(length); a->non_resident = 1; a->name_length = name_len; - a->name_offset = cpu_to_le16(length - dataruns_size - - sizeof(ntfschar) * name_len); + a->name_offset = cpu_to_le16(offsetof(ATTR_RECORD, compressed_size) + + (flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE)) ? + sizeof(a->compressed_size) : 0); a->flags = flags; a->instance = m->next_attr_instance; a->lowest_vcn = cpu_to_sle64(lowest_vcn); a->mapping_pairs_offset = cpu_to_le16(length - dataruns_size); - a->compression_unit = (flags & ATTR_COMPRESSION_MASK) ? 4 : 0; + a->compression_unit = (flags & ATTR_IS_COMPRESSED) ? 4 : 0; if (name_len) memcpy((u8*)a + le16_to_cpu(a->name_offset), name, sizeof(ntfschar) * name_len); @@ -2532,7 +2542,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { ntfs_inode *base_ni, *ni; ATTR_TYPES type; int err; - + if (!ctx || !ctx->ntfs_ino || !ctx->mrec || !ctx->attr) { errno = EINVAL; return -1; @@ -3523,8 +3533,11 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) * possible maximum. */ cur_max_mp_size = le32_to_cpu(m->bytes_allocated) - - le32_to_cpu(m->bytes_in_use) - 0x40 - - sizeof(ntfschar) * na->name_len; + le32_to_cpu(m->bytes_in_use) - + (offsetof(ATTR_RECORD, compressed_size) + + ((NAttrCompressed(na) || NAttrSparse(na)) ? + sizeof(a->compressed_size) : 0)) - + ((sizeof(ntfschar) * na->name_len + 7) & ~7); if (mp_size > cur_max_mp_size) mp_size = cur_max_mp_size; /* Add atribute extent to new record. */ @@ -3781,7 +3794,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) err = errno; Dprintf("%s(): Eeek! ntfs_attr_map_whole_runlist " "failed.\n", __FUNCTION__); - goto put_err_out; + errno = err; + return -1; } /* @@ -3815,7 +3829,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) err = errno; Dprintf("%s(): Eeek! Cluster allocation " "failed.\n", __FUNCTION__); - goto put_err_out; + errno = err; + return -1; } /* Append new clusters to attribute runlist. */ @@ -3827,7 +3842,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) "failed.\n", __FUNCTION__); ntfs_cluster_free_from_rl(vol, rl); free(rl); - goto put_err_out; + errno = err; + return -1; } na->rl = rln; From 83598b5e1de56f8e230359377e466c7b51e41c56 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 1 Oct 2004 12:26:44 +0000 Subject: [PATCH 1968/2994] libntfs/attrib.c - Mapping pairs offset fixes. - Indent fixes. - ntfs_non_resident_attr_expand: fix some error code paths. BKrev: 415d4d04vMDn9ENkB_Z6ugjj76cnKw From b81e3f8959d1ce4eea0f8d60dfeebabb242b9d71 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 1 Oct 2004 13:56:42 +0000 Subject: [PATCH 1969/2994] Fix stupid typo where I had >> vol->cluster_size instead of >> vol->cluster_size_bits. (Logical change 1.590) --- libntfs/mft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/mft.c b/libntfs/mft.c index 67ce252f..cf5d221c 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -554,7 +554,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) * mft bitmap cannot be zero so we are ok to do this. */ rl = ntfs_attr_find_vcn(mftbmp_na, (mftbmp_na->allocated_size - 1) >> - vol->cluster_size); + vol->cluster_size_bits); if (!rl || !rl->length || rl->lcn < 0) { ntfs_error(vol->sb, "Failed to determine last allocated " "cluster of mft bitmap attribute."); From 1dafa90ef7a3d5b35b98bc0573960e4d65787127 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 1 Oct 2004 13:56:42 +0000 Subject: [PATCH 1970/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into cantab.net:/home/src/ntfsprogs 2004/10/01 14:56:31+01:00 cantab.net!aia21 Fix stupid typo where I had >> vol->cluster_size instead of >> vol->cluster_size_bits. BKrev: 415d621aaIQOwfG2GYxE99Z3o4DfPQ From a4d40d673a80bc7f0a356215c05e358d28a5f71d Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 1 Oct 2004 17:04:45 +0000 Subject: [PATCH 1971/2994] fix to my previous fix (Logical change 1.591) --- libntfs/attrib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index af0c1bf1..9a9b3113 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2476,8 +2476,8 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, dataruns_size = (dataruns_size + 7) & ~7; length = offsetof(ATTR_RECORD, compressed_size) + ((sizeof(ntfschar) * name_len + 7) & ~7) + dataruns_size + - (flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE)) ? - sizeof(a->compressed_size) : 0; + ((flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE)) ? + sizeof(a->compressed_size) : 0); if (ntfs_make_room_for_attr(ctx->mrec, (u8*) ctx->attr, length)) { err = errno; Dprintf("%s(): Failed to make room for attribute.\n", From 988c84f887a051e11a14d3655a6edcf4bab29770 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 1 Oct 2004 17:04:45 +0000 Subject: [PATCH 1972/2994] fix to my previous fix BKrev: 415d8e2dnflzSZLbpMRzkP3gsIqDeQ From d4d69304ffa38de28a69206cdaed24aeed5d43e9 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 7 Oct 2004 14:04:09 +0000 Subject: [PATCH 1973/2994] - Add new API ntfs_attr_record_move_to and make ntfs_resident_attr_resize use it. - Cleanups. (Logical change 1.592) --- libntfs/attrib.c | 146 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 137 insertions(+), 9 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 9a9b3113..c231e31c 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2530,7 +2530,7 @@ put_err_out: * ntfs_attr_record_rm - remove attribute extent * @ctx: search context describing the attrubute which should be removed * - * User should reinit search context after use of this function if he/she wants + * If this function succeed, user should reinit search context if he/she wants * use it anymore. * * Return 0 on success and -1 on error. On error the error code is stored in @@ -2571,6 +2571,8 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { return -1; } } + + /* Remove attribute itself. */ if (ntfs_attr_record_resize(ctx->mrec, ctx->attr, 0)) { Dprintf("%s(): Coudn't remove attribute record. Bug or " "damaged MFT record.\n", __FUNCTION__); @@ -2582,6 +2584,8 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { return -1; } ntfs_inode_mark_dirty(ni); + + /* Post $ATTRIBUTE_LIST delete setup. */ if (type == AT_ATTRIBUTE_LIST) { if (NInoAttrList(base_ni) && base_ni->attr_list) free(base_ni->attr_list); @@ -2591,6 +2595,8 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { NInoClearAttrListNonResident(base_ni); NInoAttrListClearDirty(base_ni); } + + /* Free MFT record, if it isn't contain attributes. */ if (le32_to_cpu(ctx->mrec->bytes_in_use) - le16_to_cpu(ctx->mrec->attrs_offset) == 8) { if (ntfs_mft_record_free(ni->vol, ni)) { @@ -2604,8 +2610,11 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { if (ni == base_ni) return 0; } + if (type == AT_ATTRIBUTE_LIST || !NInoAttrList(base_ni)) return 0; + + /* Remove attribute list if we don't need it any more. */ if (!ntfs_attrlist_need(base_ni)) { ntfs_attr_reinit_search_ctx(ctx); if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, NULL, 0, IGNORE_CASE, @@ -2758,6 +2767,96 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, return 0; } +/** + * ntfs_attr_record_move_to - move attribute record to target inode + * @ctx: attribute search context describing the attrubute record + * @ni: opened ntfs inode to which move attribute record + * + * If this function succeed, user should reinit search context if he/she wants + * use it anymore. + * + * Return 0 on success and -1 on error with errno set to the error code. + */ +int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) +{ + ntfs_attr_search_ctx *nctx; + ATTR_RECORD *a; + int err; + + if (!ctx || !ctx->attr || !ctx->ntfs_ino || !ni) { + Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + Dprintf("%s(): Entering for ctx->attr->type 0x%x, ctx->ntfs_ino->mft_no" + " 0x%llx, ni->mft_no 0x%llx.\n", __FUNCTION__, ctx->attr->type, + (long long) ctx->ntfs_ino->mft_no, (long long) ni->mft_no); + + if (ctx->ntfs_ino == ni) + return 0; + + if (!ctx->al_entry) { + Dprintf("%s(): Inode should contain attribute list to use " + "this function.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + /* Find place in MFT record where attribute will be moved. */ + a = ctx->attr; + nctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); + if (!nctx) { + err = errno; + Dprintf("%s(): Couldn't obtain search context.\n", + __FUNCTION__); + errno = err; + return -1; + } + if (!ntfs_attr_lookup(a->type, (ntfschar*)((u8*)a + le16_to_cpu( + a->name_offset)), ctx->attr->name_length, + CASE_SENSITIVE, 0, NULL, 0, nctx)) { + Dprintf("%s(): Attribute of such type, with same name already " + "present in this MFT record.\n", __FUNCTION__); + err = EEXIST; + goto put_err_out; + } + if (errno != ENOENT) { + err = errno; + Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); + goto put_err_out; + } + + /* Make space and move attribute. */ + if (ntfs_make_room_for_attr(ni->mrec, (u8*) nctx->attr, + le32_to_cpu(a->length))) { + err = errno; + Dprintf("%s(): Couldn't make space for attribute.\n", + __FUNCTION__); + goto put_err_out; + } + memcpy(nctx->attr, a, le32_to_cpu(a->length)); + nctx->attr->instance = nctx->mrec->next_attr_instance; + nctx->mrec->next_attr_instance = cpu_to_le16( + (le16_to_cpu(nctx->mrec->next_attr_instance) + 1) & 0xffff); + ntfs_attr_record_resize(ctx->mrec, a, 0); + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_inode_mark_dirty(ni); + + /* Update attribute list. */ + ctx->al_entry->mft_reference = + MK_LE_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number)); + ctx->al_entry->instance = nctx->attr->instance; + ntfs_attrlist_mark_dirty(ni); + + ntfs_attr_put_search_ctx(nctx); + return 0; +put_err_out: + ntfs_attr_put_search_ctx(nctx); + errno = err; + return -1; +} + /** * ntfs_attr_make_non_resident - convert a resident to a non-resident attribute * @na: open ntfs attribute to make non-resident @@ -2984,6 +3083,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) { ntfs_attr_search_ctx *ctx; ntfs_volume *vol; + ntfs_inode *ni; int err; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, @@ -3064,19 +3164,47 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) // TODO: Try to make other attributes non-resident and retry each time. - if (na->type == AT_ATTRIBUTE_LIST && errno == ENOSPC) { + if (na->type == AT_ATTRIBUTE_LIST) { err = errno; goto put_err_out; } + + /* + * Move the attribute to a new mft record, creating an attribute list + * attribute or modifying it if it is already present. + */ - // TODO: Move the attribute to a new mft record, creating an attribute - // list attribute or modifying it if it is already present. + /* Add attribute list if not present. */ + if (na->ni->nr_extents == -1) + ni = na->ni->base_ni; + else + ni = na->ni; + if (!NInoAttrList(na->ni)) { + ntfs_inode_add_attrlist(ni); + ntfs_attr_put_search_ctx(ctx); + return ntfs_resident_attr_resize(na, newsize); + } + /* Allocate new mft record. */ + ni = ntfs_mft_record_alloc(vol, ni); + if (!ni) { + err = errno; + Dprintf("%s(): Couldn't allocate new MFT record.\n", + __FUNCTION__); + goto put_err_out; + } + /* Move attribute to it. */ + if (ntfs_attr_record_move_to(ctx, ni)) { + err = errno; + Dprintf("%s(): Couldn't move attribute to new MFT record.\n", + __FUNCTION__); + goto put_err_out; + } + /* Update ntfs attribute. */ + na->ni = ni; - // TODO: If that is still not enough, split the attribute into multiple - // extents and save them to several mft records. - - err = ENOTSUP; - goto put_err_out; + ntfs_attr_put_search_ctx(ctx); + /* Try to perform resize once again. */ + return ntfs_resident_attr_resize(na, newsize); resize_done: /* From ad7b4d8fc1dd70c116f58da3908d74cc9067aa14 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 7 Oct 2004 14:04:09 +0000 Subject: [PATCH 1974/2994] Add new API attrib.[ch]::ntfs_attr_record_move_to and make ntfs_resident_attr_resize use it. BKrev: 41654cd9yv0ylraU7X-ejcf6Xkw5PQ From a929f9f0ba97271fe1ccfac631c13c107216b52c Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 7 Oct 2004 14:04:09 +0000 Subject: [PATCH 1975/2994] Update. (Logical change 1.592) --- ChangeLog | 4 +++- include/ntfs/attrib.h | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17570fcd..e7f2e05d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -69,7 +69,9 @@ xx/xx/2004 - 2.0.0-WIP - Rename scpu_to_le{16,32,64}() to cpu_to_sle{16,32,64}() to match the kernel. - ntfsclone: honor bad clusters list ($BadClus:$Bad), known bad sectors - aren't tried to be saved anymore. (Szaka) + aren't tried to be saved anymore. (Szaka) + - Add new API attrib.[ch]::ntfs_attr_record_move_to and make + ntfs_resident_attr_resize use it. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 937d77a4..ad7f1c80 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -276,8 +276,6 @@ extern int ntfs_attr_can_be_resident(const ntfs_volume *vol, extern int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size); -extern int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size); - extern int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ntfschar *name, u8 name_len, ATTR_FLAGS flags); extern int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, @@ -285,8 +283,12 @@ extern int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ATTR_FLAGS flags); extern int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx); +extern int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size); + extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, const u32 newsize); + +extern int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni); extern int ntfs_attr_update_mapping_pairs(ntfs_attr *na); From 59407ac0ffd3cb57170a7028889050c810bb6d1c Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 7 Oct 2004 16:40:29 +0000 Subject: [PATCH 1976/2994] fix some stupid bugs (Logical change 1.593) --- libntfs/attrib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index c231e31c..6241387a 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3751,7 +3751,8 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) "failed. Aborting...\n", __FUNCTION__); } else if (err == ENOENT) err = EIO; - goto put_err_out; + errno = err; + return -1; } /* The first cluster outside the new allocation. */ @@ -3986,6 +3987,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) { + err = errno; if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) goto rollback; From a85cbd7bd304a80b3a94e1ee37479e668ff2fdba Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 7 Oct 2004 16:40:29 +0000 Subject: [PATCH 1977/2994] libntfs/attrib.c fix some stupid bugs BKrev: 4165717djPCbL1sKSjq_8_DTEs2faQ From 0f4bb99ea1e4966bd285b7e492d5527101cd8d7e Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 7 Oct 2004 16:46:16 +0000 Subject: [PATCH 1978/2994] libntfs/attrib.c one more fix BKrev: 416572d8LTKSfbQ8LJtMf2cQN32yGg From 94a479e0058343c34ae5cf97265efff851372594 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 7 Oct 2004 16:46:16 +0000 Subject: [PATCH 1979/2994] one more fix (Logical change 1.594) --- libntfs/attrib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 6241387a..8711782e 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3810,6 +3810,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) /* Get the first attribute record. */ ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) { + err = errno; if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) Dprintf("%s(): Coudn't get attribute search context. " @@ -3817,6 +3818,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) else Dprintf("%s(): Coudn't get attribute search context.\n", __FUNCTION__); + errno = err; return -1; } if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, From 14f9590053ccf3bed29b589a6fd2f48ffeaeee0b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 8 Oct 2004 15:48:03 +0000 Subject: [PATCH 1980/2994] libntfs/attrib.c small bugfix and cleanup BKrev: 4166b6b3uBaS3uZB5_Ht7IHOzYu2BQ From 100b892e5b377371c63e091e48f9d5530250d2a1 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 8 Oct 2004 15:48:03 +0000 Subject: [PATCH 1981/2994] small bugfix and cleanup (Logical change 1.595) --- libntfs/attrib.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 8711782e..1d7d442b 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3180,8 +3180,9 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) else ni = na->ni; if (!NInoAttrList(na->ni)) { - ntfs_inode_add_attrlist(ni); - ntfs_attr_put_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); + if (ntfs_inode_add_attrlist(ni)) + return -1; return ntfs_resident_attr_resize(na, newsize); } /* Allocate new mft record. */ @@ -3608,14 +3609,9 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) Dprintf("%s(): Deallocate marked extents.\n", __FUNCTION__); while (!ntfs_attr_lookup(na->type, na->name, na->name_len, IGNORE_CASE, 0, NULL, 0, ctx)) { - Dprintf("%s(): Found attr 0x%x in inode " - "0x%llx.\n", __FUNCTION__, le32_to_cpu(a->type), - ctx->ntfs_ino->mft_no); if (sle64_to_cpu(ctx->attr->highest_vcn) != NTFS_VCN_DELETE_MARK) continue; - Dprintf("%s(): It is marked. Delete it.\n", - __FUNCTION__); /* Remove unused attribute record. */ if (ntfs_attr_record_rm(ctx)) { err = errno; @@ -3623,7 +3619,6 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) "record.\n", __FUNCTION__); goto put_err_out; } - //ntfs_attr_init_search_ctx(ctx, na->ni, NULL); ntfs_attr_reinit_search_ctx(ctx); } if (errno != ENOENT) { From 1b5c000662783732b078bdc59df60c871285be9d Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 8 Oct 2004 16:50:36 +0000 Subject: [PATCH 1982/2994] Improve ntfs_resident_attr_resize to try make attributes non-resident when such convert is reasonable. (Logical change 1.596) --- libntfs/attrib.c | 61 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 1d7d442b..d881bbda 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3105,7 +3105,6 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) if (ntfs_attr_size_bounds_check(vol, na->type, newsize) < 0) { err = errno; if (err == ERANGE) { - // FIXME: Eeek! Dprintf("%s(): Eeek! Size bounds check failed. " "Aborting...\n", __FUNCTION__); } else if (err == ENOENT) @@ -3131,7 +3130,6 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) /* Error! If not enough space, just continue. */ if (errno != ENOSPC) { err = errno; - // FIXME: Eeek! if (err != ENOTSUP) Dprintf("%s(): Eeek! Failed to resize " "resident part of attribute. " @@ -3144,7 +3142,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) /* Make the attribute non-resident if possible. */ if (!ntfs_attr_make_non_resident(na, ctx)) { /* Resize non-resident attribute */ - if (ntfs_attr_truncate (na, newsize)) { + if (ntfs_attr_truncate(na, newsize)) { /* * Resize failed, but mark inode dirty because we made * it non-resident. @@ -3156,16 +3154,56 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) goto resize_done; } else if (errno != ENOSPC && errno != EPERM) { err = errno; - // FIXME: Eeek! Dprintf("%s(): Eeek! Failed to make attribute non-resident. " "Aborting...\n", __FUNCTION__); goto put_err_out; } - // TODO: Try to make other attributes non-resident and retry each time. + /* Try to make other attributes non-resident and retry each time. */ + ntfs_attr_init_search_ctx(ctx, 0, na->ni->mrec); + while (!ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx)) { + ntfs_attr *tna; + ATTR_RECORD *a; + + a = ctx->attr; + if (a->non_resident) + continue; - if (na->type == AT_ATTRIBUTE_LIST) { + /* + * Check out whether convert is reasonable. Assume that mapping + * pairs will take 8 bytes. + */ + if (le32_to_cpu(a->length) <= offsetof(ATTR_RECORD, + compressed_size) + ((a->name_length * + sizeof(ntfschar) + 7) & ~7) + 8) + continue; + + tna = ntfs_attr_open(na->ni, a->type, (ntfschar*)((u8*)a + + le16_to_cpu(a->name_offset)), a->name_length); + if (!tna) { + err = errno; + Dprintf("%s(): Couldn't open attribute.\n", + __FUNCTION__); + goto put_err_out; + } + if (ntfs_attr_make_non_resident(tna, ctx)) { + ntfs_attr_close(tna); + continue; + } + ntfs_attr_close(tna); + ntfs_attr_put_search_ctx(ctx); + return ntfs_resident_attr_resize(na, newsize); + } + /* Check whether error occured. */ + if (errno != ENOENT) { err = errno; + Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); + goto put_err_out; + } + + /* We can't move out attribute list. */ + if (na->type == AT_ATTRIBUTE_LIST) { + err = ENOSPC; goto put_err_out; } @@ -3174,6 +3212,15 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) * attribute or modifying it if it is already present. */ + /* Point search context back to attribute which we need resize. */ + ntfs_attr_init_search_ctx(ctx, na->ni, 0); + if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, + ctx)) { + Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); + err = errno; + goto put_err_out; + } + /* Add attribute list if not present. */ if (na->ni->nr_extents == -1) ni = na->ni->base_ni; @@ -3596,7 +3643,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) } a->highest_vcn = cpu_to_sle64(stop_vcn - 1); } - /* Check wether error occured. */ + /* Check whether error occured. */ if (errno != ENOENT) { err = errno; Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); From 48f70024ab6bdd90bdff33eaff5fd2601b963b65 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 8 Oct 2004 16:50:36 +0000 Subject: [PATCH 1983/2994] Improve ntfs_resident_attr_resize to try make attributes non-resident when such convert is reasonable. BKrev: 4166c55c5ZBRybysFdgaaov3Ek5WrA From f79110c80de8f4e7551d8135d0073fd9bb88e06c Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 8 Oct 2004 16:50:36 +0000 Subject: [PATCH 1984/2994] Update. (Logical change 1.596) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index e7f2e05d..e1094209 100644 --- a/ChangeLog +++ b/ChangeLog @@ -72,6 +72,8 @@ xx/xx/2004 - 2.0.0-WIP aren't tried to be saved anymore. (Szaka) - Add new API attrib.[ch]::ntfs_attr_record_move_to and make ntfs_resident_attr_resize use it. (Yura) + - Improve ntfs_resident_attr_resize to try make attributes non-resident + when such convert is reasonable. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From a5e9859b29350c64f24328098c90fa10d936d26a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 8 Oct 2004 17:07:08 +0000 Subject: [PATCH 1985/2994] fix to previous patch: forgot to mark inode dirty (Logical change 1.597) --- libntfs/attrib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index d881bbda..1dcdba66 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3164,7 +3164,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) while (!ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx)) { ntfs_attr *tna; ATTR_RECORD *a; - + a = ctx->attr; if (a->non_resident) continue; @@ -3190,6 +3190,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) ntfs_attr_close(tna); continue; } + ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_close(tna); ntfs_attr_put_search_ctx(ctx); return ntfs_resident_attr_resize(na, newsize); @@ -3200,13 +3201,13 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); goto put_err_out; } - + /* We can't move out attribute list. */ if (na->type == AT_ATTRIBUTE_LIST) { err = ENOSPC; goto put_err_out; } - + /* * Move the attribute to a new mft record, creating an attribute list * attribute or modifying it if it is already present. From 14c99d8ce79d45bf222db67316b474869abb9782 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 8 Oct 2004 17:07:08 +0000 Subject: [PATCH 1986/2994] fix to previous patch: forgot to mark inode dirty BKrev: 4166c93ci3E-odYulDRz9V9H22hYtw From 8152150f91d328e816afea29ece81aa919f80ea9 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 9 Oct 2004 11:21:49 +0000 Subject: [PATCH 1987/2994] commit dt and bmp (Logical change 1.598) --- ntfsprogs/ntfsrm.c | 152 ++++++++++++++++++++++++++++++--------------- ntfsprogs/ntfsrm.h | 3 +- 2 files changed, 103 insertions(+), 52 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 02c003ad..e6889880 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -265,19 +265,36 @@ static const char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) /** * ntfs_bmp_commit */ -static int ntfs_bmp_commit (ntfs_volume *vol, struct ntfs_bmp *bmp) +static int ntfs_bmp_commit (struct ntfs_bmp *bmp) { - if (!vol || !bmp) + int i; + + if (!bmp) + return 0; + if (bmp->count == 0) return 0; - printf ("commit bmp\n"); - vol = NULL; + printf ("commit bmp 0x%02X (%sresident)\n", bmp->attr->type, bmp->attr->rl ? "non-" : ""); + + printf ("\ta size = %lld\n", bmp->attr->allocated_size); + printf ("\td size = %lld\n", bmp->attr->data_size); + //printf ("\ti size = %lld\n", bmp->attr->initialized_size); + for (i = 0; i < bmp->count; i++) { + printf ("\tvcn = %lld\n", bmp->data_vcn[i]); + } #if 0 ntfs_attr *attr; u8 **data; VCN *data_vcn; int count; #endif + for (i = 0; i < bmp->count; i++) + ntfs_free (bmp->data[i]); + + ntfs_free (bmp->data); + ntfs_free (bmp->data_vcn); + bmp->count = 0; + return 0; } @@ -340,18 +357,14 @@ static struct ntfs_bmp * ntfs_bmp_alloc (ntfs_inode *inode, ATTR_TYPES type, ntf return NULL; } + bmp->vol = inode->vol; bmp->attr = attr; - bmp->data = ntfs_calloc (16, sizeof (*bmp->data)); - bmp->data_vcn = ntfs_calloc (16, sizeof (*bmp->data_vcn)); + bmp->data = NULL; + bmp->data_vcn = NULL; bmp->count = 0; bmp->cache = NULL; bmp->cache_vcn = -1; - if (!bmp->data || !bmp->data_vcn) { - ntfs_bmp_free (bmp); - return NULL; - } - return bmp; } @@ -367,9 +380,9 @@ static int ntfs_bmp_add_data (struct ntfs_bmp *bmp, VCN vcn, u8 *data) if (!bmp || !data) return -1; - old = ((bmp->count + 15) & ~15); + old = ROUND_UP (bmp->count, 16); bmp->count++; - new = ((bmp->count + 15) & ~15); + new = ROUND_UP (bmp->count, 16); if (old != new) { bmp->data = ntfs_realloc (bmp->data, new * sizeof (*bmp->data)); @@ -398,33 +411,38 @@ static u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn) { u8 *buffer; int i; - VCN begin; - VCN end; + int cs; + int cb; if (!bmp) return NULL; + cs = bmp->vol->cluster_size; + cb = bmp->vol->cluster_size_bits; + + // XXX range check against vol,attr + // never compressed, so data = init + + vcn >>= (cb + 3); // convert to bitmap clusters + for (i = 0; i < bmp->count; i++) { - begin = (bmp->data_vcn[i] >> 3) & (~(512-1)); - end = begin + (512 << 3); - if ((vcn >= begin) && (vcn < end)) { - //printf ("%lld, %lld, %lld\n", begin, vcn, end); + if (vcn == bmp->data_vcn[i]) { + //printf ("reusing bitmap cluster %lld\n", vcn); return bmp->data[i]; } } - buffer = ntfs_malloc (512); + buffer = ntfs_malloc (cs); // XXX could be smaller if attr size < cluster size if (!buffer) return NULL; - begin = (vcn>>3) & (~(512-1)); - //printf ("loading from offset %lld\n", begin); - if (ntfs_attr_pread (bmp->attr, begin, 512, buffer) < 0) { + //printf ("loading from bitmap cluster %lld\n", vcn); + if (ntfs_attr_pread (bmp->attr, vcn, cs, buffer) < 0) { ntfs_free (buffer); return NULL; } - ntfs_bmp_add_data (bmp, vcn, buffer); + ntfs_bmp_add_data (bmp, vcn, buffer); // XXX retval return buffer; } @@ -441,47 +459,57 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va int finish; u8 sta_part = 0; u8 fin_part = 0; + int cs; + int cb; + VCN a; + VCN b; if (!bmp) return -1; - //printf ("\n"); - //printf ("set range: %lld - %lld\n", vcn, vcn+length-1); + cs = bmp->vol->cluster_size; + cb = bmp->vol->cluster_size_bits; - for (i = vcn; i < (vcn+length); i += 4096) { + //printf ("\n"); + //printf ("set range: %lld - %lld (%d)\n", vcn, vcn+length-1, cs<<3); + + a = ROUND_DOWN (vcn, cs<<3); + b = ROUND_UP (vcn + length -1, cs<<3); + //printf ("vcn = %lld\n", vcn); + //printf ("a = %lld\n", a >> (cb+3)); + //printf ("b = %lld\n", b >> (cb+3)); + //printf ("count = %lld\n", (b-a)/(cs<<3)); + + for (i = a; i < b; i += (cs<<3)) { buffer = ntfs_bmp_get_data (bmp, i); if (!buffer) return -1; #if 0 - memset (buffer, 0xFF, 512); + memset (buffer, 0xFF, cs); value = 0; - memset (buffer, 0x00, 512); + memset (buffer, 0x00, cs); value = 1; #endif //utils_dump_mem (buffer, 0, 32, DM_DEFAULTS); //printf ("\n"); - begin = i & ~4095; - end = begin + 4095; + begin = i; + end = begin + (cs<<3) - 1; //printf ("begin = %lld, vcn = %lld,%lld end = %lld\n", begin, vcn, vcn+length-1, end); if ((vcn > begin) && (vcn < end)) { - //printf ("1\n"); - start = ((vcn+8) >> 3) & 511; + start = ((vcn+8) >> 3) & (cs-1); sta_part = 0xff << (vcn&7); } else { - //printf ("2\n"); start = 0; } if (((vcn+length-1) >= begin) && ((vcn+length-1) <= end)) { - //printf ("3\n"); - finish = ((vcn+length-1) >> 3) & 511; + finish = ((vcn+length-1) >> 3) & (cs-1); fin_part = 0xff >> (7-((vcn+length-1)&7)); } else { - //printf ("4\n"); - finish = 511; + finish = cs-1; } #if 0 @@ -495,7 +523,7 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va printf ("%d - %d", start, finish); - if (finish < 511) { + if (finish < (cs-1)) { printf (" (%02x)\n", fin_part); } else { printf (" \n"); @@ -517,12 +545,12 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va //utils_dump_mem (buffer, 0, 16, DM_DEFAULTS); } - printf (GREEN "Modified: inode %lld, " END, bmp->attr->ni->mft_no); + printf (GREEN "Modified: inode %lld, ", bmp->attr->ni->mft_no); switch (bmp->attr->type) { case AT_BITMAP: printf ("$BITMAP"); break; case AT_DATA: printf ("$DATA"); break; } - printf (" vcn %lld-%lld\n", vcn>>12, (vcn+length)>>12); + printf (" vcn %lld-%lld\n" END, vcn>>12, (vcn+length-1)>>12); return 1; } @@ -1009,21 +1037,33 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) static int ntfs_dt_commit (struct ntfs_dt *dt) { ntfs_volume *vol; + ntfs_attr *attr; struct ntfs_dir *dir; int i; if (!dt) return 0; - printf ("commit dt\n"); dir = dt->dir; if (!dir) return -1; vol = dir->vol; // cluster size + if (dt->changed) { - printf ("dt changed\n"); + printf ("commit dt "); + if (dt->parent) { + attr = dt->dir->ialloc; + } else { + attr = dt->dir->iroot; + } + + printf (BOLD RED "ntfs_attr_pwrite\n" END); + //WRITE printf ("%lld\n", ntfs_attr_pwrite (attr, dt->vcn * dt->dir->index_size, dt->dir->index_size, dt->data)); + + dt->changed = FALSE; } + #if 0 //dt u8 *data; @@ -1862,7 +1902,7 @@ static int ntfs_dir_commit (struct ntfs_dir *dir) if (ntfs_dt_commit (dir->index) < 0) return -1; - if (ntfs_bmp_commit (dir->vol, dir->bitmap) < 0) + if (ntfs_bmp_commit (dir->bitmap) < 0) return -1; for (i = 0; i < dir->child_count; i++) { @@ -2139,10 +2179,10 @@ static int utils_volume_commit (ntfs_volume *vol) return -1; printf ("commit volume\n"); - if (ntfs_bmp_commit (vol, vol->private_bmp1) < 0) + if (ntfs_bmp_commit (vol->private_bmp1) < 0) return -1; - if (ntfs_bmp_commit (vol, vol->private_bmp2) < 0) + if (ntfs_bmp_commit (vol->private_bmp2) < 0) return -1; if (ntfs_dir_commit (vol->private_data) < 0) @@ -2177,6 +2217,7 @@ static int utils_volume_rollback (ntfs_volume *vol) static int ntfs_umount2 (ntfs_volume *vol, const BOOL force) { struct ntfs_dir *dir; + struct ntfs_bmp *bmp; if (!vol) return 0; @@ -2187,6 +2228,14 @@ static int ntfs_umount2 (ntfs_volume *vol, const BOOL force) vol->private_data = NULL; ntfs_dir_free (dir); + bmp = (struct ntfs_bmp *) vol->private_bmp1; + vol->private_bmp1 = NULL; + ntfs_bmp_free (bmp); + + bmp = (struct ntfs_bmp *) vol->private_bmp2; + vol->private_bmp2 = NULL; + ntfs_bmp_free (bmp); + return ntfs_umount (vol, force); } @@ -2626,7 +2675,9 @@ static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) rl = na->rl; size = na->allocated_size >> inode->vol->cluster_size_bits; for (count = 0; count < size; count += rl->length, rl++) { - ntfs_bmp_set_range (bmp, rl->lcn, rl->length, 0); + if (ntfs_bmp_set_range (bmp, rl->lcn, rl->length, 0) < 0) { + printf (RED "set range : %lld - %lld FAILED\n" END, rl->lcn, rl->lcn+rl->length-1); + } } ntfs_attr_close (na); } @@ -4182,7 +4233,7 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) entry = (INDEX_ENTRY*) ptr; if (entry->flags & INDEX_ENTRY_NODE) { - newvcn = (VCN*) (ptr + ((entry->key_length + 0x17) & ~7)); + newvcn = (VCN*) (ptr + ROUND_UP(entry->key_length + 0x17, 8)); ntfs_index_dump_alloc (attr, *newvcn, indent+4); } @@ -4204,8 +4255,7 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) break; } printf ("%.*s", indent, space_line); - printf ("fill = %u/%u\n", (unsigned int)block->index.index_length, - (unsigned int)block->index.allocated_size); + printf ("fill = %u/%u\n", block->index.index_length, block->index.allocated_size); return 0; } @@ -4238,7 +4288,7 @@ static int ntfs_index_dump (ntfs_inode *inode) while (ptr < (buffer + size)) { entry = (INDEX_ENTRY*) ptr; if (entry->flags & INDEX_ENTRY_NODE) { - vcn = (VCN*) (ptr + ((entry->key_length + 0x17) & ~7)); + vcn = (VCN*) (ptr + ROUND_UP(entry->key_length + 0x17, 8)); ntfs_index_dump_alloc (ialloc, *vcn, 4); } diff --git a/ntfsprogs/ntfsrm.h b/ntfsprogs/ntfsrm.h index 9df72871..5bb0bbb3 100644 --- a/ntfsprogs/ntfsrm.h +++ b/ntfsprogs/ntfsrm.h @@ -52,6 +52,7 @@ struct options { * a cache for either dir/$BITMAP, $MFT/$BITMAP or $Bitmap/$DATA */ struct ntfs_bmp { + ntfs_volume *vol; ntfs_attr *attr; int count; u8 **data; @@ -94,7 +95,6 @@ struct ntfs_dir { ntfs_attr *iroot; ntfs_attr *ialloc; int index_size; - u8 padding[4]; /* Unused: padding to 64 bit. */ }; /** @@ -119,6 +119,7 @@ struct ntfs_find { #define END "" #define ROUND_UP(num,bound) (((num)+((bound)-1)) & ~((bound)-1)) +#define ROUND_DOWN(num,bound) ((num) & ~((bound)-1)) #define ATTR_SIZE(s) ROUND_UP(s,8) #endif /* _NTFSRM_H_ */ From 660c6015bc4108af2fa8c7b3ea141f8408bfc896 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Sat, 9 Oct 2004 11:21:49 +0000 Subject: [PATCH 1988/2994] commit dt and bmp BKrev: 4167c9cdLzvaKJCE85XpowXz8impjA From db92f7bfbf2982ad92135a690b5d7be5a1a5cfbf Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 10 Oct 2004 17:20:48 +0000 Subject: [PATCH 1989/2994] - add new 0 length fields to ATTR_RECORD, they can be used to get size of attribute (Logical change 1.599) --- include/ntfs/layout.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 26c8f81f..5e094496 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -709,6 +709,9 @@ typedef struct { /* 22 */ RESIDENT_ATTR_FLAGS resident_flags; /* See above. */ /* 23 */ s8 reservedR; /* Reserved/alignment to 8-byte boundary. */ +/* 24 */ void *resident_attr_end[0]; /* Use offsetof( + ATTR_RECORD, resident_attr_end) to + get size of resident attribute. */ } __attribute__ ((__packed__)); /* Non-resident attributes. */ struct { @@ -752,12 +755,19 @@ typedef struct { /* 56*/ s64 initialized_size; /* Byte size of initialized portion of the attribute value. Usually equals data_size. */ +/* 64 */ void *non_resident_attr_end[0]; /* Use offsetof( + ATTR_RECORD, non_resident_attr_end) to + get size of non resident attribute. */ /* sizeof(uncompressed attr) = 64*/ /* 64*/ s64 compressed_size; /* Byte size of the attribute value after compression. Only present when compressed. Always is a multiple of the cluster size. Represents the actual amount of disk space being used on the disk. */ +/* 72 */ void *compressed_non_resident_attr_end[0]; + /* Use offsetof(ATTR_RECORD, + compressed_non_resident_attr_end) to get size + of non resident compressed attribute. */ /* sizeof(compressed attr) = 72*/ } __attribute__ ((__packed__)); } __attribute__ ((__packed__)); From 3f9fac7647ad67cab7cefb39d20d18f94245da86 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 10 Oct 2004 17:20:48 +0000 Subject: [PATCH 1990/2994] - add ntfs_attr_record_move_away - make ntfs_attr_update_mapping_pairs use ntfs_inode_free_space - cleanups (Logical change 1.599) --- libntfs/attrib.c | 112 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 105 insertions(+), 7 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 1dcdba66..a2fbc020 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1668,7 +1668,7 @@ find_attr_list_attr: /* Not found?!? Absurd! Must be a bug... )-: */ Dprintf("%s(): BUG! Attribute list attribute not found " "but it exists! Returning error " - "(EINVAL).", __FUNCTION__); + "(EINVAL).\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -2636,6 +2636,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { "Couldn't free clusters from attribute " "list runlist. Succeed anyway.\n", __FUNCTION__); + return 0; } } /* Remove attribute record itself. */ @@ -2790,8 +2791,9 @@ int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) } Dprintf("%s(): Entering for ctx->attr->type 0x%x, ctx->ntfs_ino->mft_no" - " 0x%llx, ni->mft_no 0x%llx.\n", __FUNCTION__, ctx->attr->type, - (long long) ctx->ntfs_ino->mft_no, (long long) ni->mft_no); + " 0x%llx, ni->mft_no 0x%llx.\n", __FUNCTION__, (unsigned) + le32_to_cpu(ctx->attr->type), (long long) ctx->ntfs_ino->mft_no, + (long long) ni->mft_no); if (ctx->ntfs_ino == ni) return 0; @@ -2857,6 +2859,89 @@ put_err_out: return -1; } +/** + * ntfs_attr_record_move_away - move away attribute record from it's mft record + * @ctx: attribute search context describing the attrubute record + * + * If this function succeed, user should reinit search context if he/she wants + * use it anymore. + * + * Return 0 on success and -1 on error with errno set to the error code. + */ +int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx) +{ + ntfs_inode *base_ni, *ni; + MFT_RECORD *m; + int i, err; + + if (!ctx || !ctx->attr || !ctx->ntfs_ino) { + Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + Dprintf("%s(): Entering for attr 0x%x, inode 0x%llx.\n", __FUNCTION__, + (unsigned) le32_to_cpu(ctx->attr->type), + (long long) ctx->ntfs_ino->mft_no); + + if (ctx->ntfs_ino->nr_extents == -1) + base_ni = ctx->base_ntfs_ino; + else + base_ni = ctx->ntfs_ino; + + if (!NInoAttrList(base_ni)) { + Dprintf("%s(): Inode should contain attribute list to use " + "this function.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + if (ntfs_inode_attach_all_extents(ctx->ntfs_ino)) { + err = errno; + Dprintf("%s(): Couldn't attach extent inode.\n", __FUNCTION__); + errno = err; + return -1; + } + + /* Walk through all extents and try to move attribute to them. */ + for (i = 0; i < base_ni->nr_extents; i++) { + ni = base_ni->extent_nis[i]; + m = ni->mrec; + + if (ctx->ntfs_ino->mft_no == ni->mft_no) + continue; + + if (le32_to_cpu(m->bytes_allocated) - + le32_to_cpu(m->bytes_in_use) < + le32_to_cpu(ctx->attr->length)) + continue; + + if (!ntfs_attr_record_move_to(ctx, ni)) + return 0; + } + + /* + * Failed to move attribute to one of the current extents, so allocate + * new extent and move attribute to it. + */ + ni = ntfs_mft_record_alloc(base_ni->vol, base_ni); + if (!ni) { + err = errno; + Dprintf("%s(): Couldn't allocate new MFT record.\n", + __FUNCTION__); + errno = err; + return -1; + } + if (ntfs_attr_record_move_to(ctx, ni)) { + err = errno; + Dprintf("%s(): Couldn't move attribute to new MFT record.\n", + __FUNCTION__); + errno = err; + return -1; + } + return 0; +} + /** * ntfs_attr_make_non_resident - convert a resident to a non-resident attribute * @na: open ntfs attribute to make non-resident @@ -3227,7 +3312,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) ni = na->ni->base_ni; else ni = na->ni; - if (!NInoAttrList(na->ni)) { + if (!NInoAttrList(ni)) { ntfs_attr_put_search_ctx(ctx); if (ntfs_inode_add_attrlist(ni)) return -1; @@ -3569,11 +3654,24 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) if (mp_size > exp_max_mp_size) { /* * Mapping pairs of $ATTRIBUTE_LIST attribute must fit - * in the base mft record. + * in the base mft record. Try to move out other + * attibutes and try again. */ if (na->type == AT_ATTRIBUTE_LIST) { - err = ENOSPC; - goto put_err_out; + ntfs_attr_put_search_ctx(ctx); + if (ntfs_inode_free_space(na->ni, mp_size - + exp_max_mp_size)) { + if (errno != ENOSPC) + return -1; + Dprintf("%s(): Attribute list mapping " + "pairs size to big, can't fit " + "them in the base MFT record. " + "Defragment volume and try " + "once again.\n", __FUNCTION__); + errno = ENOSPC; + return -1; + } + return ntfs_attr_update_mapping_pairs(na); } /* Add attribute list if it isn't present, and retry. */ From 1154b815de4699f964fa535e3c21d3bd9d10ef0c Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 10 Oct 2004 17:20:48 +0000 Subject: [PATCH 1991/2994] - add ntfs_inode_free_space and ntfs_inode_attach_all_extents - update ntfs_inode_add_attrlist to use ntfs_inode_free_space (Logical change 1.599) --- libntfs/inode.c | 206 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 202 insertions(+), 4 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 7a5bee5c..f87bf184 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -357,6 +357,53 @@ err_out: return NULL; } +/** + * ntfs_inode_attach_all_extents - atach all extents for target inode + * @ni: opened ntfs inode for which perform atach + * + * Return 0 on success and -1 on error with errno set to the error code. + */ +int ntfs_inode_attach_all_extents(ntfs_inode *ni) +{ + ATTR_LIST_ENTRY *ale; + + if (!ni) { + Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + if (ni->nr_extents == -1) + ni = ni->base_ni; + + Dprintf("%s(): Entering for inode 0x%llx.\n", + __FUNCTION__, (long long) ni->mft_no); + + /* Inode haven't got attribute list, thus nothing to attach. */ + if (!NInoAttrList(ni)) + return 0; + + if (!ni->attr_list) { + Dprintf("%s(): Corrput in-memory struct.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + /* Walk thru attribute list and attach all extents. */ + errno = 0; + ale = (ATTR_LIST_ENTRY *)ni->attr_list; + while ((u8*)ale < ni->attr_list + ni->attr_list_size) { + if (!ntfs_extent_inode_open(ni, MREF_LE(ale->mft_reference))) { + Dprintf("%s(): Couldn't attach extent inode.\n", + __FUNCTION__); + return -1; + } + ale = (ATTR_LIST_ENTRY *)((u8*)ale + le16_to_cpu(ale->length)); + } + return 0; +} + + /** * ntfs_inode_sync - write the inode (and its dirty extents) to disk * @ni: ntfs inode to write @@ -584,15 +631,41 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) al = aln; ntfs_attr_put_search_ctx(ctx); + /* Free space if there is not enough it for $ATTRIBUTE_LIST. */ + if (le32_to_cpu(ni->mrec->bytes_allocated) - + le32_to_cpu(ni->mrec->bytes_in_use) < + offsetof(ATTR_RECORD, resident_attr_end)) { + /* + * Set temporary in-memory attribute list. We need this to be + * able perform attribute lookups and move out attributes. + */ + ni->attr_list = al; + ni->attr_list_size = al_len; + NInoSetAttrList(ni); + /* Free space. */ + if (ntfs_inode_free_space(ni, + offsetof(ATTR_RECORD, resident_attr_end))) { + /* + * Couldn't free space, unset temporary in-memory + * attribute list and fail. + */ + err = errno; + Dprintf("%s(): Failed to free space for " + "$ATTRIBUTE_LIST.\n", __FUNCTION__); + ni->attr_list = NULL; + NInoClearAttrList(ni); + goto err_out; + } + /* Unset temporary in-memory attribute list. */ + ni->attr_list = NULL; + NInoClearAttrList(ni); + } + /* Add $ATTRIBUTE_LIST to mft record. */ if (ntfs_resident_attr_record_add(ni, AT_ATTRIBUTE_LIST, 0, 0, 0) < 0) { err = errno; Dprintf("%s(): Couldn't add $ATTRIBUTE_LIST to MFT record.\n", __FUNCTION__); - if (err == ENOSPC) { - //FIXME: Move out attributes and try once again. - err = ENOTSUP; - } goto err_out; } @@ -611,3 +684,128 @@ err_out: errno = err; return -1; } + +/** + * ntfs_inode_free_space - free space in the MFT record of inode + * @ni: ntfs inode in which MFT record free space + * @size: amount of space needed to free + * + * Return 0 on success or -1 on error with errno set to the error code. + */ +int ntfs_inode_free_space(ntfs_inode *ni, int size) +{ + ntfs_attr_search_ctx *ctx; + int freed = 0, err; + + if (!ni || size < 0) { + Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + Dprintf("%s(): Entering for inode 0x%llx, size %d.\n", + __FUNCTION__, (long long) ni->mft_no, size); + + if (!size) + return 0; + + ctx = ntfs_attr_get_search_ctx(ni, 0); + if (!ctx) { + err = errno; + Dprintf("%s(): Failed to get attribute search context.\n", + __FUNCTION__); + errno = err; + return -1; + } + + /* + * Chkdsk complain if $STANDART_INFORMATION is not in the base MFT + * record. FIXME: I'm not sure in this, need to recheck. For now simply + * do not move $STANDART_INFORMATION at all. + * + * Also we can't move $ATTRIBUTE_LIST from base MFT_RECORD, so position + * search context on first attribute after $STANDARD_INFORMATION and + * $ATTRIBUTE_LIST. + * + * Why we reposition instead of simply skip this attributes during + * enumeration? Because in case we have got only in-memory attribute + * list ntfs_attr_lookup will fail when it will try to find + * $ATTRIBUTE_LIST. + */ + if (ntfs_attr_lookup(AT_FILE_NAME, NULL, 0, CASE_SENSITIVE, 0, NULL, + 0, ctx)) { + if (errno != ENOENT) { + err = errno; + Dprintf("%s(): Attribute lookup failed.\n", + __FUNCTION__); + goto put_err_out; + } + if (ctx->attr->type == AT_END) { + err = ENOSPC; + goto put_err_out; + } + } + + while (1) { + int record_size; + + /* + * Check whether attribute is from different MFT record. If so, + * find next, because we don't need such. + */ + while (ctx->ntfs_ino->mft_no != ni->mft_no) { + if (ntfs_attr_lookup(AT_UNUSED, NULL, 0, CASE_SENSITIVE, + 0, NULL, 0, ctx)) { + err = errno; + if (errno != ENOENT) { + Dprintf("%s(): Attribute lookup failed." + "\n", __FUNCTION__); + } + break; + } + } + + record_size = le32_to_cpu(ctx->attr->length); + + /* Move away attribute. */ + if (ntfs_attr_record_move_away(ctx)) { + err = errno; + Dprintf("%s(): Failed to move out attribute.\n", + __FUNCTION__); + break; + } + freed += record_size; + + /* Check whether we done. */ + if (size <= freed) { + ntfs_attr_put_search_ctx(ctx); + return 0; + } + + /* + * Repostion to first attribute after $STANDARD_INFORMATION and + * $ATTRIBUTE_LIST (see comments upwards). + */ + ntfs_attr_reinit_search_ctx(ctx); + if (ntfs_attr_lookup(AT_FILE_NAME, NULL, 0, CASE_SENSITIVE, 0, + NULL, 0, ctx)) { + if (errno != ENOENT) { + err = errno; + Dprintf("%s(): Attribute lookup failed.\n", + __FUNCTION__); + break; + } + if (ctx->attr->type == AT_END) { + err = ENOSPC; + break; + } + } + } +put_err_out: + ntfs_attr_put_search_ctx(ctx); + if (err == ENOSPC) + Dprintf("%s(): No attributes left that can be moved out.\n", + __FUNCTION__); + errno = err; + return -1; +} From daad6adcea3cf2bc32b6ddf1e5aadf4b2719c708 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 10 Oct 2004 17:20:48 +0000 Subject: [PATCH 1992/2994] - add prototype (Logical change 1.599) --- include/ntfs/attrib.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index ad7f1c80..e65c6e90 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -289,6 +289,7 @@ extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, const u32 newsize); extern int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni); +extern int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx); extern int ntfs_attr_update_mapping_pairs(ntfs_attr *na); From a9ba7534a146dae22cd2a5d7487bf076d81e1e8d Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 10 Oct 2004 17:20:48 +0000 Subject: [PATCH 1993/2994] - add prototypes (Logical change 1.599) --- include/ntfs/inode.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 0364fd0c..1ca6c201 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -128,6 +128,8 @@ extern int ntfs_inode_close(ntfs_inode *ni); extern ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref); + +extern int ntfs_inode_attach_all_extents(ntfs_inode *ni); /** * ntfs_inode_mark_dirty - set the inode (and its base inode if it exists) dirty @@ -149,5 +151,7 @@ extern int ntfs_inode_sync(ntfs_inode *ni); extern int ntfs_inode_add_attrlist(ntfs_inode *ni); +extern int ntfs_inode_free_space(ntfs_inode *ni, int size); + #endif /* defined _NTFS_INODE_H */ From d42a5b46f44bd6816ea262aa5954f929a809d22b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 10 Oct 2004 17:20:48 +0000 Subject: [PATCH 1994/2994] - update ntfs_attrlist_set (Logical change 1.599) --- libntfs/attrlist.c | 74 +++++++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 21 deletions(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 80a37aec..e8cd5938 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -46,7 +46,8 @@ * EINVAL - Invalid argumets passed to function or attribute haven't got * attribute list. */ -int ntfs_attrlist_need(ntfs_inode *ni) { +int ntfs_attrlist_need(ntfs_inode *ni) +{ ATTR_LIST_ENTRY *ale; if (!ni) { @@ -113,34 +114,57 @@ int ntfs_attrlist_set(ntfs_inode *ni, u8 *new_al, int new_al_len) /* Make attribute list length 8 byte aligment. */ new_al_len = (new_al_len + 7) & ~7; - /* Resize $ATTRIBUTE_LIST attribute. */ na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, 0, 0); if (!na) { err = errno; Dprintf("%s(): Coudn't open $ATTRIBUTE_LIST.\n", __FUNCTION__); goto err_out; } + /* + * Setup im-memory attribute list. We need this to perform attribute + * truncate (we need update attribute list in case other attributes + * will be moved away from their current MFT record). + */ + if (NInoAttrList(ni) && ni->attr_list) + free(ni->attr_list); + ni->attr_list = new_al; + ni->attr_list_size = new_al_len; + NInoSetAttrList(ni); + NInoAttrListSetDirty(ni); + /* Resize $ATTRIBUTE_LIST attribute. */ if (ntfs_attr_truncate(na, new_al_len)) { - if (errno == ENOSPC) { - // FIXME: Free space in mft record and try again. - err = ENOTSUP; - goto err_out; - } else { - err = errno; - Dprintf("%s(): $ATTRIBUTE_LIST resize failed.\n", - __FUNCTION__); - goto err_out; - } + /* + * FIXME: We leave new attribute list. But need to restore old + * and update in it records for moved attributes. Difficult to + * do if we haven't attribute list before truncate and records + * were moved. + */ + err = errno; + Dprintf("%s(): Eeek! $ATTRIBUTE_LIST resize failed. Probably " + "leaving inconsist metadata.\n", __FUNCTION__); + goto err_out; } - /* Update ntfs inode. */ + /* Update in-memory ntfs inode. */ if (NAttrNonResident(na)) { /* Create copy of new runlist. */ if (ntfs_attr_map_whole_runlist(na)) { - Dprintf("%s(): Failed to map runlist.\n", __FUNCTION__); + /* + * FIXME: Probably leaving inconsist na->attr_list_rl. + * What shall we do here? We can't simply restore old + * attribute list, because attributes maybe moved. But + * we can't get runlist for new attribute list so we + * can't update in-memory structs. + */ + Dprintf("%s(): Failed to map runlist. Probably leaving " + "inconsist na->attr_list_rl.\n", __FUNCTION__); if (ntfs_attr_truncate(na, ni->attr_list_size)) Dprintf("%s(): Rollback failed. Leaving " "inconsist metadata.\n", __FUNCTION__); + if (NAttrNonResident(na)) + NInoSetAttrListNonResident(ni); + else + NInoClearAttrListNonResident(ni); err = EIO; goto err_out; } @@ -149,10 +173,22 @@ int ntfs_attrlist_set(ntfs_inode *ni, u8 *new_al, int new_al_len) rl_size = (rl_size * sizeof(runlist_element) + 0xfff) & ~0xfff; rl = malloc(rl_size); if (!rl) { - Dprintf("%s(): Not enough memory.\n", __FUNCTION__); + /* + * FIXME: Probably leaving inconsist na->attr_list_rl. + * What shall we do here? We can't simply restore old + * attribute list, because attributes maybe moved. But + * we can't get runlist for new attribute list so we + * can't update in-memory structs. + */ + Dprintf("%s(): Not enough memory. Probably leaving " + "inconsist na->attr_list_rl.\n", __FUNCTION__); if (ntfs_attr_truncate(na, ni->attr_list_size)) Dprintf("%s(): Rollback failed. Leaving " "inconsist metadata.\n", __FUNCTION__); + if (NAttrNonResident(na)) + NInoSetAttrListNonResident(ni); + else + NInoClearAttrListNonResident(ni); err = ENOMEM; goto err_out; } @@ -169,12 +205,8 @@ int ntfs_attrlist_set(ntfs_inode *ni, u8 *new_al, int new_al_len) } } - if (ni->attr_list) - free(ni->attr_list); - ni->attr_list = new_al; - ni->attr_list_size = new_al_len; - NInoSetAttrList(ni); - NInoAttrListSetDirty(ni); + /* Done! */ + ntfs_attr_close(na); return 0; err_out: if (na) From d76664e9115d1eae7cb049ac0ec7a1bb19b56f3b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 10 Oct 2004 17:20:48 +0000 Subject: [PATCH 1995/2994] include/ntfs/layout.h - add new 0 length fields to ATTR_RECORD, they can be used to get size of attribute libntfs/attrib.c - add ntfs_attr_record_move_away - make ntfs_attr_update_mapping_pairs use ntfs_inode_free_space - cleanups libntfs/attrlist.c - update ntfs_attrlist_set libntfs/inode.c - add ntfs_inode_free_space and ntfs_inode_attach_all_extents - update ntfs_inode_add_attrlist to use ntfs_inode_free_space BKrev: 41696f70ou_XEXyBluVWUB8Eb9zooA From 07a8918a4cffb0bf4fbea88fb686003423913fc1 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 10 Oct 2004 17:20:48 +0000 Subject: [PATCH 1996/2994] update (Logical change 1.599) --- ChangeLog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index e1094209..1b86c93b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -74,6 +74,16 @@ xx/xx/2004 - 2.0.0-WIP ntfs_resident_attr_resize use it. (Yura) - Improve ntfs_resident_attr_resize to try make attributes non-resident when such convert is reasonable. (Yura) + - New API attrib.[ch]::ntfs_attr_record_move_away(). (Yura) + - New API inode.[ch]::ntfs_inode_attach_all_extents . (Yura) + - New API inode.[ch]::ntfs_inode_free_space. (Yura) + - Improved layout.h::ATTR_RECORD to have + {compressed_non_,non_,}resident_attr_end fields. Use + offsetof(ATTR_RECORD, *resident_attr_end) to get size of accordable + attribute. (Yura) + - Make ntfs_attr_update_mapping_pairs and ntfs_inode_add_attrlist use + ntfs_inode_free_space when there is no enough space for attribute + list. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 419e3ce8b7fef7d5256c89dbc63751a9036322fb Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 11 Oct 2004 09:16:35 +0000 Subject: [PATCH 1997/2994] Remove inode.h::NIno{Clear,Set,}AttrListNonResident and attr_list_rl field from inode.h::_ntfs_inode struct. Adapt all users. (Logical change 1.600) --- ChangeLog | 2 ++ include/ntfs/inode.h | 10 +------ libntfs/attrib.c | 24 ++++++++++------- libntfs/attrlist.c | 62 -------------------------------------------- libntfs/inode.c | 22 +++------------- libntfs/volume.c | 11 -------- 6 files changed, 21 insertions(+), 110 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b86c93b..7f2b3925 100644 --- a/ChangeLog +++ b/ChangeLog @@ -84,6 +84,8 @@ xx/xx/2004 - 2.0.0-WIP - Make ntfs_attr_update_mapping_pairs and ntfs_inode_add_attrlist use ntfs_inode_free_space when there is no enough space for attribute list. (Yura) + - Remove inode.h::NIno{Clear,Set,}AttrListNonResident and attr_list_rl + field from inode.h::_ntfs_inode struct. Adapt all users. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 1ca6c201..d5cb11b9 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -39,8 +39,6 @@ typedef enum { /* The NI_AttrList* tests only make sense for base inodes. */ NI_AttrList, /* 1: Mft record contains an attribute list. */ - NI_AttrListNonResident, /* 1: Attribute list is non-resident. Implies - NI_AttrList is set. */ NI_AttrListDirty, /* 1: Attribute list needs to be written to the mft record and then to disk. */ } ntfs_inode_state_bits; @@ -74,10 +72,6 @@ typedef enum { #define test_and_clear_nino_al_flag(ni, flag) \ test_and_clear_nino_flag(ni, AttrList##flag) -#define NInoAttrListNonResident(ni) test_nino_al_flag(ni, NonResident) -#define NInoSetAttrListNonResident(ni) set_nino_al_flag(ni, NonResident) -#define NInoClearAttrListNonResident(ni) clear_nino_al_flag(ni, NonResident) - #define NInoAttrListDirty(ni) test_nino_al_flag(ni, Dirty) #define NInoAttrListSetDirty(ni) set_nino_al_flag(ni, Dirty) #define NInoAttrListClearDirty(ni) clear_nino_al_flag(ni, Dirty) @@ -97,12 +91,10 @@ struct _ntfs_inode { /* * Attribute list support (for use by the attribute lookup functions). * Setup during ntfs_open_inode() for all inodes with attribute lists. - * Only valid if NI_AttrList is set in state, further attr_list_rl is - * only valid if NI_AttrListNonResident is set. + * Only valid if NI_AttrList is set in state. */ u32 attr_list_size; /* Length of attribute list value in bytes. */ u8 *attr_list; /* Attribute list value itself. */ - runlist *attr_list_rl; /* Run list for the attribute list value. */ /* Below fields are always valid. */ s32 nr_extents; /* For a base mft record, the number of attached extent inodes (0 if none), for diff --git a/libntfs/attrib.c b/libntfs/attrib.c index a2fbc020..bd903b3c 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2589,10 +2589,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { if (type == AT_ATTRIBUTE_LIST) { if (NInoAttrList(base_ni) && base_ni->attr_list) free(base_ni->attr_list); - if (NInoAttrListNonResident(base_ni) && base_ni->attr_list_rl) - free(base_ni->attr_list_rl); NInoClearAttrList(base_ni); - NInoClearAttrListNonResident(base_ni); NInoAttrListClearDirty(base_ni); } @@ -2629,15 +2626,24 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { return 0; } /* Deallocate clusters. */ - if (NInoAttrListNonResident(base_ni)) { - if (ntfs_cluster_free_from_rl(base_ni->vol, - base_ni->attr_list_rl)) { - Dprintf("%s(): Leaking clusters! Run chkdsk. " - "Couldn't free clusters from attribute " + if (ctx->attr->non_resident) { + runlist *al_rl; + + al_rl = ntfs_mapping_pairs_decompress(base_ni->vol, + ctx->attr, NULL); + if (!al_rl) { + Dprintf("%s(): Couldn't decompress attribute " "list runlist. Succeed anyway.\n", - __FUNCTION__); + __FUNCTION__); return 0; } + if (ntfs_cluster_free_from_rl(base_ni->vol, al_rl)) { + Dprintf("%s(): Leaking clusters! Run chkdsk. " + "Couldn't free clusters from attribute " + "list runlist.\n", + __FUNCTION__); + } + free(al_rl); } /* Remove attribute record itself. */ if (ntfs_attr_record_rm(ctx)) { diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index e8cd5938..0a67db05 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -98,8 +98,6 @@ int ntfs_attrlist_need(ntfs_inode *ni) int ntfs_attrlist_set(ntfs_inode *ni, u8 *new_al, int new_al_len) { ntfs_attr *na = NULL; - runlist *rl; - int rl_size; int err; if (!ni || !new_al || new_al_len < 1) { @@ -145,66 +143,6 @@ int ntfs_attrlist_set(ntfs_inode *ni, u8 *new_al, int new_al_len) goto err_out; } - /* Update in-memory ntfs inode. */ - if (NAttrNonResident(na)) { - /* Create copy of new runlist. */ - if (ntfs_attr_map_whole_runlist(na)) { - /* - * FIXME: Probably leaving inconsist na->attr_list_rl. - * What shall we do here? We can't simply restore old - * attribute list, because attributes maybe moved. But - * we can't get runlist for new attribute list so we - * can't update in-memory structs. - */ - Dprintf("%s(): Failed to map runlist. Probably leaving " - "inconsist na->attr_list_rl.\n", __FUNCTION__); - if (ntfs_attr_truncate(na, ni->attr_list_size)) - Dprintf("%s(): Rollback failed. Leaving " - "inconsist metadata.\n", __FUNCTION__); - if (NAttrNonResident(na)) - NInoSetAttrListNonResident(ni); - else - NInoClearAttrListNonResident(ni); - err = EIO; - goto err_out; - } - for (rl = na->rl, rl_size = 1; rl->length; rl++) - rl_size++; - rl_size = (rl_size * sizeof(runlist_element) + 0xfff) & ~0xfff; - rl = malloc(rl_size); - if (!rl) { - /* - * FIXME: Probably leaving inconsist na->attr_list_rl. - * What shall we do here? We can't simply restore old - * attribute list, because attributes maybe moved. But - * we can't get runlist for new attribute list so we - * can't update in-memory structs. - */ - Dprintf("%s(): Not enough memory. Probably leaving " - "inconsist na->attr_list_rl.\n", __FUNCTION__); - if (ntfs_attr_truncate(na, ni->attr_list_size)) - Dprintf("%s(): Rollback failed. Leaving " - "inconsist metadata.\n", __FUNCTION__); - if (NAttrNonResident(na)) - NInoSetAttrListNonResident(ni); - else - NInoClearAttrListNonResident(ni); - err = ENOMEM; - goto err_out; - } - memcpy(rl, na->rl, rl_size); - if (NInoAttrListNonResident(ni) && ni->attr_list_rl) - free(ni->attr_list_rl); - ni->attr_list_rl = rl; - NInoSetAttrListNonResident(ni); - } else { - if (NInoAttrListNonResident(ni)) { - if (ni->attr_list_rl) - free(ni->attr_list_rl); - NInoClearAttrListNonResident(ni); - } - } - /* Done! */ ntfs_attr_close(na); return 0; diff --git a/libntfs/inode.c b/libntfs/inode.c index f87bf184..0cec2be9 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -72,8 +72,6 @@ static __inline__ int __ntfs_inode_release(ntfs_inode *ni) Dputs("Eeek. Discarding dirty inode!"); if (NInoAttrList(ni) && ni->attr_list) free(ni->attr_list); - if (NInoAttrListNonResident(ni) && ni->attr_list_rl) - free(ni->attr_list_rl); if (ni->mrec) free(ni->mrec); free(ni); @@ -98,9 +96,7 @@ static __inline__ int __ntfs_inode_release(ntfs_inode *ni) * Finally, search for an attribute list attribute in the mft record and if one * is found, load the attribute list attribute value and attach it to the * ntfs_inode structure (->attr_list). Also set the NI_AttrList bit to indicate - * this as well as the NI_AttrListNonResident bit if the the attribute list is - * non-resident. In that case, also attach the decompressed runlist to the - * ntfs_inode structure (->attr_list_rl). + * this. * * Return a pointer to the ntfs_inode structure on success or NULL on error, * with errno set to the error code. @@ -155,20 +151,8 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) err = EIO; goto put_err_out; } - if (!ctx->attr->non_resident) { - /* Attribute list attribute is resident so we are done. */ - ntfs_attr_put_search_ctx(ctx); - return ni; - } - NInoSetAttrListNonResident(ni); - // FIXME: We are duplicating work here! (AIA) - ni->attr_list_rl = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL); - if (ni->attr_list_rl) { - /* We got the runlist, so we are done. */ - ntfs_attr_put_search_ctx(ctx); - return ni; - } - err = EIO; + ntfs_attr_put_search_ctx(ctx); + return ni; put_err_out: if (!err) err = errno; diff --git a/libntfs/volume.c b/libntfs/volume.c index 167894c6..cc664fae 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -200,17 +200,6 @@ static int ntfs_mft_load(ntfs_volume *vol) "$MFT/$ATTRIBUTE_LIST."); goto io_error_exit; } - if (ctx->attr->non_resident) { - NInoSetAttrListNonResident(vol->mft_ni); - // FIXME: We are duplicating work here! (AIA) - vol->mft_ni->attr_list_rl = ntfs_mapping_pairs_decompress(vol, - ctx->attr, NULL); - if (!vol->mft_ni->attr_list_rl) { - Dperror("Error: failed to get runlist for " - "$MFT/$ATTRIBUTE_LIST"); - goto error_exit; - } - } mft_has_no_attr_list: /* We now have a fully setup ntfs inode for $MFT in vol->mft_ni. */ From 0565e56f8f51896e684e21e91f3cc54f317aa299 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 11 Oct 2004 09:16:35 +0000 Subject: [PATCH 1998/2994] Remove inode.h::NIno{Clear,Set,}AttrListNonResident and attr_list_rl field from inode.h::_ntfs_inode struct. Adapt all users. BKrev: 416a4f73uSf8_X3yHhtIbxouc_yhKQ From b0d16735035a528b76de491a85b6f50436d9140d Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 11 Oct 2004 15:25:18 +0000 Subject: [PATCH 1999/2994] Auto merged 2004/10/11 16:21:37+01:00 flatcap.org!ntfs fix memleak on error path (Logical change 1.601) --- libntfs/volume.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/volume.c b/libntfs/volume.c index cc664fae..36582ae8 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -592,6 +592,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) vol = ntfs_volume_startup(dev, rwflag); if (!vol) { Dperror("Failed to startup volume"); + ntfs_device_free (dev); return NULL; } From d5457c0a2366d92722481413d21d6cc33ec792e5 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Mon, 11 Oct 2004 15:25:18 +0000 Subject: [PATCH 2000/2994] Merge flatcap.org:/home/flatcap/backup/bk/ntfsprogs into flatcap.org:/home/flatcap/ntfsprogs 2004/10/11 16:21:37+01:00 flatcap.org!ntfs libntfs: fix memleak on error path BKrev: 416aa5deipnrVgXH0idDbYgEJsG-KA From 84a4fd30bf1de600272931e3bf9f69836e2f3b34 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 11 Oct 2004 15:43:22 +0000 Subject: [PATCH 2001/2994] Refix the device memleak fix in error code path. (Logical change 1.602) --- libntfs/volume.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index 36582ae8..94b1e306 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -592,7 +592,6 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) vol = ntfs_volume_startup(dev, rwflag); if (!vol) { Dperror("Failed to startup volume"); - ntfs_device_free (dev); return NULL; } @@ -961,13 +960,20 @@ ntfs_volume *ntfs_mount(const char *name __attribute__((unused)), { #ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS struct ntfs_device *dev; + ntfs_volume *vol; /* Allocate an ntfs_device structure. */ dev = ntfs_device_alloc(name, 0, &ntfs_device_default_io_ops, NULL); if (!dev) return NULL; /* Call ntfs_device_mount() to do the actual mount. */ - return ntfs_device_mount(dev, rwflag); + vol = ntfs_device_mount(dev, rwflag); + if (!vol) { + int eo = errno; + ntfs_device_free(dev); + errno = eo; + } + return vol; #else /* * ntfs_mount() makes no sense if NO_NTFS_DEVICE_DEFAULT_IO_OPS is From f75629f67fbf41e3dc5b1caeea45489bf0527048 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 11 Oct 2004 15:43:22 +0000 Subject: [PATCH 2002/2994] Refix the device memleak fix in error code path. BKrev: 416aaa1awNAzg4nl8ngSYQ8obqOIPg From 9af64b54ffec9710c023fe553cfcac52f8d39e18 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 11 Oct 2004 16:26:16 +0000 Subject: [PATCH 2003/2994] - Add --attibute, --attr-name and --inode attribute to ntfscp. (Logical change 1.603) --- ntfsprogs/ntfscp.c | 171 ++++++++++++++++++++++++++------------------- 1 file changed, 100 insertions(+), 71 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 69c30d7f..b12b9ad2 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -39,10 +39,13 @@ struct options { char *device; /* Device/File to work with */ char *src_file; /* Source file */ char *dest_file; /* Destination file */ + char *attr_name; /* Write to attribute with this name. */ int force; /* Override common sense */ int quiet; /* Less output */ int verbose; /* Extra output */ int noaction; /* Do not write to disk */ + ATTR_TYPES attribute; /* Write to this attribute. */ + int inode; /* Treat dest_file as inode number. */ }; static const char *EXEC_NAME = "ntfscp"; @@ -78,8 +81,11 @@ static void version (void) static void usage (void) { Printf ("\nUsage: %s [options] device src_file dest_file\n\n" + " -a --attribute num Write to this attribute\n" + " -i --inode Treat dest_file as inode number\n" " -f --force Use less caution\n" " -h --help Print this help\n" + " -N --attr-name name Write to attribute with this name\n" " -n --no-action Do not write to disk\n" " -q --quiet Less output\n" " -V --version Version information\n" @@ -99,10 +105,13 @@ static void usage (void) */ static int parse_options (int argc, char **argv) { - static const char *sopt = "-fh?nqVv"; + static const char *sopt = "-a:ifh?N:nqVv"; static const struct option lopt[] = { + { "attribute", required_argument, NULL, 'a' }, + { "inode", no_argument, NULL, 'i' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, + { "attr-name", required_argument, NULL, 'N' }, { "no-action", no_argument, NULL, 'n' }, { "quiet", no_argument, NULL, 'q' }, { "version", no_argument, NULL, 'V' }, @@ -110,31 +119,53 @@ static int parse_options (int argc, char **argv) { NULL, 0, NULL, 0 } }; + char *s; char c = -1; int err = 0; int ver = 0; int help = 0; + s64 attr; - opts.device = 0; - opts.src_file = 0; - opts.dest_file = 0; + opts.device = NULL; + opts.src_file = NULL; + opts.dest_file = NULL; + opts.attr_name = NULL; + opts.inode = 0; + opts.attribute = AT_DATA; opterr = 0; /* We'll handle the errors, thank you. */ - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char) -1) { switch (c) { case 1: /* A non-option argument */ if (!opts.device) { - opts.device = argv[optind-1]; + opts.device = argv[optind - 1]; } else if (!opts.src_file) { - opts.src_file = argv[optind-1]; + opts.src_file = argv[optind - 1]; } else if (!opts.dest_file) { - opts.dest_file = argv[optind-1]; + opts.dest_file = argv[optind - 1]; } else { - Eprintf("You must specify exactly two files.\n"); + Eprintf("You must specify exactly 2 files.\n"); err++; } break; + case 'a': + if (opts.attribute != AT_DATA) { + Eprintf("You can specify only 1 attribute.\n"); + err++; + break; + } + + attr = strtol(optarg, &s, 0); + if (*s) { + Eprintf("Coudn't parse attribute.\n"); + err++; + } else + opts.attribute = (ATTR_TYPES)attr; + break; + case 'i': + opts.inode++; + break; case 'f': opts.force++; break; @@ -142,6 +173,14 @@ static int parse_options (int argc, char **argv) case '?': help++; break; + case 'N': + if (opts.attr_name) { + Eprintf("You can specify only one attribute " + "name.\n"); + err++; + } else + opts.attr_name = argv[optind - 1]; + break; case 'n': opts.noaction++; break; @@ -155,7 +194,7 @@ static int parse_options (int argc, char **argv) opts.verbose++; break; default: - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + Eprintf("Unknown option '%s'.\n", argv[optind - 1]); err++; break; } @@ -165,13 +204,13 @@ static int parse_options (int argc, char **argv) opts.quiet = 0; } else { if (!opts.device) { - Eprintf ("You must specify a device.\n"); + Eprintf("You must specify a device.\n"); err++; } else if (!opts.src_file) { - Eprintf ("You must specify a source file.\n"); + Eprintf("You must specify a source file.\n"); err++; } else if (!opts.dest_file) { - Eprintf ("You must specify a destination file.\n"); + Eprintf("You must specify a destination file.\n"); err++; } @@ -204,8 +243,6 @@ int main (int argc, char *argv[]) ntfs_volume *vol; ntfs_inode *out; ntfs_attr *na; -// ntfs_attr_search_ctx *ctx; -// FILE_NAME_ATTR *fna; int flags = 0; int result = 1; s64 new_size; @@ -213,8 +250,10 @@ int main (int argc, char *argv[]) u64 offset; char *buf; s64 br, bw; + ntfschar *attr_name = NULL; + int attr_name_len = 0; - if (!parse_options (argc, argv)) + if (!parse_options(argc, argv)) return 1; utils_set_locale(); @@ -222,7 +261,7 @@ int main (int argc, char *argv[]) if (opts.noaction) flags = MS_RDONLY; - vol = utils_mount_volume (opts.device, flags, opts.force); + vol = utils_mount_volume(opts.device, flags, opts.force); if (!vol) { perror("ERROR: couldn't mount volume"); return 1; @@ -232,101 +271,91 @@ int main (int argc, char *argv[]) goto umount; { - struct stat fst; - if (stat (opts.src_file, &fst) == -1) { - perror ("ERROR: Couldn't stat source file\n"); - goto umount; + struct stat fst; + if (stat (opts.src_file, &fst) == -1) { + perror("ERROR: Couldn't stat source file"); + goto umount; + } + new_size = fst.st_size; } - new_size = fst.st_size; - } - Vprintf ("New file size: %lld\n", new_size); + Vprintf("New file size: %lld\n", new_size); - in = fopen (opts.src_file, "r"); + in = fopen(opts.src_file, "r"); if (!in) { - perror ("ERROR: Couldn't open source file"); + perror("ERROR: Couldn't open source file"); goto umount; } - out = utils_pathname_to_inode (vol, NULL, opts.dest_file); + if (opts.inode) { + s64 inode_num; + char *s; + + inode_num = strtoll(opts.dest_file, &s, 0); + if (*s) { + Eprintf("ERROR: Couldn't parse inode number.\n"); + goto close_src; + } + out = ntfs_inode_open(vol, inode_num); + } else + out = utils_pathname_to_inode(vol, NULL, opts.dest_file); if (!out) { - perror ("ERROR: Couldn't open destination file"); + perror("ERROR: Couldn't open destination file"); goto close_src; } - na = ntfs_attr_open (out, AT_DATA, 0, 0); + if (opts.attr_name) { + attr_name_len = ntfs_mbstoucs(opts.attr_name, &attr_name, 0); + if (attr_name_len == -1) { + perror("ERROR: failed to parse attribute name"); + goto close_dst; + } + } + na = ntfs_attr_open(out, opts.attribute, attr_name, attr_name_len); if (!na) { - perror ("ERROR: Couldn't open $DATA attribute"); + perror("ERROR: Couldn't open attribute"); goto close_dst; } - Vprintf ("Old file size: %lld\n", na->data_size); + Vprintf("Old file size: %lld\n", na->data_size); if (na->data_size != new_size) { - if (ntfs_attr_truncate (na, new_size)) { - perror ("ERROR: Couldn't resize $DATA attribute"); + if (ntfs_attr_truncate(na, new_size)) { + perror("ERROR: Couldn't resize attribute"); goto close_attr; } need_logfile_reset = 1; - - /* - * Update $FILE_NAME(0x30) attributes for new file size. - * This code now commented, because Windows does not update - * them unless a rename operation occur. - */ - /* - ctx = ntfs_attr_get_search_ctx(out, NULL); - if (!ctx) { - perror("ERROR: Couldn't get search context"); - goto close_attr; - } - while (!ntfs_attr_lookup(AT_FILE_NAME, 0, 0, 0, 0, NULL, 0, - ctx)) { - fna = (FILE_NAME_ATTR *)((u8*)ctx->attr + - le16_to_cpu(ctx->attr->value_offset)); - if (sle64_to_cpu(fna->allocated_size) || - sle64_to_cpu(fna->data_size)) { - fna->allocated_size = cpu_to_sle64( - na->allocated_size); - fna->data_size = cpu_to_sle64(na->data_size); - ntfs_inode_mark_dirty(ctx->ntfs_ino); - } - } - if (errno != ENOENT) - perror("ERROR: Attribute lookup failed"); - ntfs_attr_put_search_ctx(ctx); - */ } - buf = malloc (NTFS_BUF_SIZE); + buf = malloc(NTFS_BUF_SIZE); if (!buf) { - perror ("ERROR: malloc failed"); + perror("ERROR: malloc failed"); goto close_attr; } offset = 0; while (!feof (in)) { - br = fread (buf, 1, NTFS_BUF_SIZE, in); + br = fread(buf, 1, NTFS_BUF_SIZE, in); if (!br) { - if (!feof (in)) perror ("ERROR: fread failed"); + if (!feof (in)) perror("ERROR: fread failed"); break; } - bw = ntfs_attr_pwrite (na, offset, br, buf); + bw = ntfs_attr_pwrite(na, offset, br, buf); if (bw != br) { - perror ("ERROR: ntfs_attr_pwrite failed"); + perror("ERROR: ntfs_attr_pwrite failed"); break; } offset += bw; } need_logfile_reset = 1; - free (buf); + free(buf); close_attr: - ntfs_attr_close (na); + ntfs_attr_close(na); close_dst: - ntfs_inode_close (out); + ntfs_inode_close(out); if (need_logfile_reset) { - printf ("Resetting logfile.\n"); + printf("Resetting logfile.\n"); ntfs_logfile_reset (vol); } From 8dd4f91c86c041b9a76a9a90849993d100afc42d Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 11 Oct 2004 16:26:16 +0000 Subject: [PATCH 2004/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into chaos.(none):/home/yura/NTFS/ntfsprogs 2004/10/11 19:24:16+03:00 (none)!yura libntfs/attrib.c ntfs_attr_truncate check if newsize is equal to na->data_size and don't do anything in this case ntfsprogs/ntfscp.c - Add --attibute, --attr-name and --inode attribute to ntfscp. BKrev: 416ab428Nm5JpqQ1SZiusTTohVl4UQ From 324ed328f575784a741a025f950faac49712fbab Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 11 Oct 2004 16:26:16 +0000 Subject: [PATCH 2005/2994] ntfs_attr_truncate check if newsize is equal to na->data_size and don't do anything in this case (Logical change 1.603) --- libntfs/attrib.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index bd903b3c..820bc1b0 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -4242,6 +4242,9 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) errno = EINVAL; return -1; } + + if (na->data_size == newsize) + return 0; /* * Encrypted attributes are not supported. We return access denied, * which is what Windows NT4 does, too. From 7c1b950052b6090b997079c1fff2aad7de4e863c Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 11 Oct 2004 16:26:16 +0000 Subject: [PATCH 2006/2994] update (Logical change 1.603) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 7f2b3925..4e57fce8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -86,6 +86,7 @@ xx/xx/2004 - 2.0.0-WIP list. (Yura) - Remove inode.h::NIno{Clear,Set,}AttrListNonResident and attr_list_rl field from inode.h::_ntfs_inode struct. Adapt all users. (Yura) + - Add --attibute, --attr-name and --inode attribute to ntfscp. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From e8dcfe2debb1ad9804f7b57732de87194a0a29f7 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 11 Oct 2004 18:34:48 +0000 Subject: [PATCH 2007/2994] fix stupid bugs in nammed attributes resize (Logical change 1.604) --- libntfs/attrib.c | 18 ++++++++++-------- libntfs/attrlist.c | 3 ++- libntfs/inode.c | 4 ++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 820bc1b0..5e3ec391 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2492,8 +2492,8 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, a->non_resident = 1; a->name_length = name_len; a->name_offset = cpu_to_le16(offsetof(ATTR_RECORD, compressed_size) + - (flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE)) ? - sizeof(a->compressed_size) : 0); + ((flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE)) ? + sizeof(a->compressed_size) : 0)); a->flags = flags; a->instance = m->next_attr_instance; a->lowest_vcn = cpu_to_sle64(lowest_vcn); @@ -3600,7 +3600,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) /* Fill attribute records with new mapping pairs. */ stop_vcn = 0; while (!ntfs_attr_lookup(na->type, na->name, na->name_len, - IGNORE_CASE, 0, NULL, 0, ctx)) { + CASE_SENSITIVE, 0, NULL, 0, ctx)) { a = ctx->attr; m = ctx->mrec; @@ -3760,7 +3760,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) ntfs_attr_reinit_search_ctx(ctx); Dprintf("%s(): Deallocate marked extents.\n", __FUNCTION__); while (!ntfs_attr_lookup(na->type, na->name, na->name_len, - IGNORE_CASE, 0, NULL, 0, ctx)) { + CASE_SENSITIVE, 0, NULL, 0, ctx)) { if (sle64_to_cpu(ctx->attr->highest_vcn) != NTFS_VCN_DELETE_MARK) continue; @@ -4137,11 +4137,13 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) { err = errno; - if ((na->allocated_size >> vol->cluster_size_bits) != - first_free_vcn) + Dprintf("%s(): Failed to get search context.\n", __FUNCTION__); + if ((na->allocated_size >> vol->cluster_size_bits) == + first_free_vcn) { + errno = err; + return -1; + } else goto rollback; - else - goto put_err_out; } if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 0a67db05..b1ab39ba 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -258,7 +258,8 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) ale->lowest_vcn = 0; ale->mft_reference = mref; ale->instance = attr->instance; - memcpy(ale->name, (u8 *)attr + attr->name_offset, attr->name_length); + memcpy(ale->name, (u8 *)attr + attr->name_offset, + attr->name_length * sizeof(ntfschar)); /* Set new runlist. */ if (ntfs_attrlist_set(ni, new_al, new_al_len)) { diff --git a/libntfs/inode.c b/libntfs/inode.c index 0cec2be9..57a029dd 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -595,8 +595,8 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) ale->mft_reference = MK_LE_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number)); ale->instance = ctx->attr->instance; - memcpy(ale->name, (u8 *)ctx->attr + - ctx->attr->name_offset, ctx->attr->name_length); + memcpy(ale->name, (u8 *)ctx->attr + ctx->attr->name_offset, + ctx->attr->name_length * sizeof(ntfschar)); ale = (ATTR_LIST_ENTRY *)(al + al_len); } /* Check for real error occured. */ From 1adc469856e884527165ab3a31c36b1299087811 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 11 Oct 2004 18:34:48 +0000 Subject: [PATCH 2008/2994] fix stupid bugs in nammed attributes resize BKrev: 416ad2480z_-FXKRX4MEoCFNyWkS3A From 48ab100d946850bdf373c67c4a532bcb54fa7253 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 11 Oct 2004 19:19:58 +0000 Subject: [PATCH 2009/2994] fix bug in ntfs_attr_make_non_resident (Logical change 1.605) --- libntfs/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 5e3ec391..a38e10d4 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3066,7 +3066,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, } /* Calculate new offsets for the name and the mapping pairs array. */ name_ofs = (sizeof(ATTR_REC) - sizeof(a->compressed_size) + 7) & ~7; - mp_ofs = (name_ofs + a->name_length + 7) & ~7; + mp_ofs = (name_ofs + a->name_length * sizeof(ntfschar) + 7) & ~7; /* * Determine the size of the resident part of the non-resident * attribute record. (Not compressed thus no compressed_size element From 253616b54925cbdb144699ce417a78f18fd0cf61 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 11 Oct 2004 19:19:58 +0000 Subject: [PATCH 2010/2994] fix bug in ntfs_attr_make_non_resident BKrev: 416adcdeoE0bhQ2bImr8M0Y2A9XO_g From 58bd93a1cda813d67e3cc59945ed4d26c9510347 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 12 Oct 2004 16:37:44 +0000 Subject: [PATCH 2011/2994] varios bug fixes (I hope the last) to attribute resize functions and cleanups (Logical change 1.606) --- libntfs/attrib.c | 75 +++++++++++++++++++++++++++------------------- libntfs/attrlist.c | 2 +- libntfs/inode.c | 3 +- 3 files changed, 48 insertions(+), 32 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index a38e10d4..211fc2af 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2486,7 +2486,6 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, } /* Setup record fields. */ - offset = ((u8*)a - (u8*)m); a->type = type; a->length = cpu_to_le32(length); a->non_resident = 1; @@ -2518,6 +2517,23 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, } } ntfs_inode_mark_dirty(ni); + /* + * Locate offset from start of the MFT record where new attribute is + * placed. We need relookup it, because record maybe moved during update + * of attribute list. + */ + ntfs_attr_reinit_search_ctx(ctx); + if (ntfs_attr_lookup(type, name, name_len, CASE_SENSITIVE, + lowest_vcn, NULL, 0, ctx)) { + err = errno; + Dprintf("%s(): Attribute lookup failed. Probably leaving " + "inconsist metadata.\n", __FUNCTION__); + ntfs_attr_put_search_ctx(ctx); + errno = err; + return -1; + + } + offset = (u8*)ctx->attr - (u8*)ctx->mrec; ntfs_attr_put_search_ctx(ctx); return offset; put_err_out: @@ -2614,7 +2630,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { /* Remove attribute list if we don't need it any more. */ if (!ntfs_attrlist_need(base_ni)) { ntfs_attr_reinit_search_ctx(ctx); - if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, NULL, 0, IGNORE_CASE, + if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, NULL, 0, CASE_SENSITIVE, 0, NULL, 0, ctx)) { /* * FIXME: Should we succeed here? Definitely something @@ -2822,8 +2838,8 @@ int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) return -1; } if (!ntfs_attr_lookup(a->type, (ntfschar*)((u8*)a + le16_to_cpu( - a->name_offset)), ctx->attr->name_length, - CASE_SENSITIVE, 0, NULL, 0, nctx)) { + a->name_offset)), a->name_length, CASE_SENSITIVE, + 0, NULL, 0, nctx)) { Dprintf("%s(): Attribute of such type, with same name already " "present in this MFT record.\n", __FUNCTION__); err = EEXIST; @@ -3075,8 +3091,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, arec_size = (mp_ofs + mp_size + 7) & ~7; /* Sanity check. */ - if (a->name_length && (le16_to_cpu(a->name_offset) + a->name_length > - arec_size)) { + if (a->name_length && ((le16_to_cpu(a->name_offset) + + a->name_length * sizeof(ntfschar)) > (u32) arec_size)) { // FIXME: Eeek! Dprintf("%s(): Eeek! Name exceeds new record size! " "Not supported. Aborting...\n", __FUNCTION__); @@ -3232,17 +3248,10 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) /* Make the attribute non-resident if possible. */ if (!ntfs_attr_make_non_resident(na, ctx)) { + ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_attr_put_search_ctx(ctx); /* Resize non-resident attribute */ - if (ntfs_attr_truncate(na, newsize)) { - /* - * Resize failed, but mark inode dirty because we made - * it non-resident. - */ - err = errno; - ntfs_inode_mark_dirty(ctx->ntfs_ino); - goto put_err_out; - } - goto resize_done; + return ntfs_attr_truncate(na, newsize); } else if (errno != ENOSPC && errno != EPERM) { err = errno; Dprintf("%s(): Eeek! Failed to make attribute non-resident. " @@ -3306,8 +3315,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) /* Point search context back to attribute which we need resize. */ ntfs_attr_init_search_ctx(ctx, na->ni, 0); - if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, - ctx)) { + if (ntfs_attr_lookup(na->type, na->name, na->name_len, CASE_SENSITIVE, + 0, NULL, 0, ctx)) { Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); err = errno; goto put_err_out; @@ -3453,7 +3462,8 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) /* Move the attribute name if it exists and update the offset. */ if (a->name_length) { /* Sanity check. */ - if (le16_to_cpu(a->name_offset) + a->name_length > arec_size) { + if (le16_to_cpu(a->name_offset) + + a->name_length * sizeof(ntfschar) > arec_size) { // FIXME: Eeek! Dprintf("%s(): Eeek! Name exceeds new record " "size! Not supported. Aborting...\n", @@ -3566,7 +3576,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) int ntfs_attr_update_mapping_pairs(ntfs_attr *na) { ntfs_attr_search_ctx *ctx; - ntfs_inode *ni; + ntfs_inode *ni, *base_ni; MFT_RECORD *m; ATTR_RECORD *a; VCN stop_vcn; @@ -3588,8 +3598,13 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type); + + if (na->ni->nr_extents == -1) + base_ni = na->ni->base_ni; + else + base_ni = na->ni; - ctx = ntfs_attr_get_search_ctx(na->ni, 0); + ctx = ntfs_attr_get_search_ctx(base_ni, 0); if (!ctx) { err = errno; Dprintf("%s(): Couldn't get search context.\n", __FUNCTION__); @@ -3681,9 +3696,9 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) } /* Add attribute list if it isn't present, and retry. */ - if (!NInoAttrList(na->ni)) { + if (!NInoAttrList(base_ni)) { ntfs_attr_put_search_ctx(ctx); - if (ntfs_inode_add_attrlist(na->ni)) { + if (ntfs_inode_add_attrlist(base_ni)) { err = errno; Dprintf("%s(): Eeek! Coudn't add " "attribute list.\n", @@ -3795,7 +3810,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) goto put_err_out; } /* Allocate new mft record. */ - ni = ntfs_mft_record_alloc(na->ni->vol, na->ni); + ni = ntfs_mft_record_alloc(na->ni->vol, base_ni); if (!ni) { err = errno; Dprintf("%s(): Couldn't allocate new MFT record.\n", @@ -3968,8 +3983,8 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) errno = err; return -1; } - if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, - ctx)) { + if (ntfs_attr_lookup(na->type, na->name, na->name_len, CASE_SENSITIVE, + 0, NULL, 0, ctx)) { err = errno; if (err == ENOENT) err = EIO; @@ -4067,7 +4082,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) * Compare the new allocation with the old one and only allocate * clusters if there is a change. */ - if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { + if ((na->allocated_size >> vol->cluster_size_bits) < first_free_vcn) { if (ntfs_attr_map_whole_runlist(na)) { err = errno; Dprintf("%s(): Eeek! ntfs_attr_map_whole_runlist " @@ -4146,8 +4161,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) goto rollback; } - if (ntfs_attr_lookup(na->type, na->name, na->name_len, 0, 0, NULL, 0, - ctx)) { + if (ntfs_attr_lookup(na->type, na->name, na->name_len, CASE_SENSITIVE, + 0, NULL, 0, ctx)) { Dprintf("%s(): Eeek! Lookup of first attribute extent " "failed.\n", __FUNCTION__); err = errno; @@ -4163,7 +4178,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) a = ctx->attr; /* Update allocated size only if it is changed. */ - if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { + if ((na->allocated_size >> vol->cluster_size_bits) < first_free_vcn) { na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = cpu_to_sle64(na->allocated_size); } diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index b1ab39ba..ac72fd05 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -212,7 +212,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) if (le32_to_cpu(ale->type) > le32_to_cpu(attr->type)) break; err = ntfs_names_collate(ale->name, ale->name_length, - (ntfschar *)((u8 *)attr + attr->name_length), + (ntfschar*)((u8*)attr + le16_to_cpu(attr->name_offset)), attr->name_length, -2, CASE_SENSITIVE, 0, 0); if (err == -2) { err = EIO; diff --git a/libntfs/inode.c b/libntfs/inode.c index 57a029dd..d02ea67f 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -595,7 +595,8 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) ale->mft_reference = MK_LE_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number)); ale->instance = ctx->attr->instance; - memcpy(ale->name, (u8 *)ctx->attr + ctx->attr->name_offset, + memcpy(ale->name, (u8 *)ctx->attr + + le16_to_cpu(ctx->attr->name_offset), ctx->attr->name_length * sizeof(ntfschar)); ale = (ATTR_LIST_ENTRY *)(al + al_len); } From 8294cf49187213dbeb024aa3dc5dd96c51bb7fc4 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 12 Oct 2004 16:37:44 +0000 Subject: [PATCH 2012/2994] varios bug fixes (I hope the last) to attribute resize functions and cleanups BKrev: 416c0858T8ftbtk4Pn2XHqXSDPHMpg From 240634b7ed33e777d9a848ccff6e6d644b66c7a3 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 12 Oct 2004 20:05:02 +0000 Subject: [PATCH 2013/2994] Initial revision --- ntfsprogs/ntfscp.8.in | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ntfsprogs/ntfscp.8.in diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in new file mode 100644 index 00000000..e69de29b From 8267fcedca1365a772e739930910b1a31d116429 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 12 Oct 2004 20:05:02 +0000 Subject: [PATCH 2014/2994] (Logical change 1.607) --- ntfsprogs/ntfscp.8.in | 94 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in index e69de29b..9dc0c93f 100644 --- a/ntfsprogs/ntfscp.8.in +++ b/ntfsprogs/ntfscp.8.in @@ -0,0 +1,94 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2004 Yura Pakhuchiy. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSCP 8 "October 2004" "ntfsprogs version @VERSION@" +.SH NAME +ntfscp \- overwrite file on an NTFS volume. +.SH SYNOPSIS +.B ntfscp +[ +.I options +] +.B device src_file dest_file +.SH DESCRIPTION +.B ntfscp +will overwrite file on an NTFS volume. At present +.B ntfscp +can't create new files. +.SH OPTIONS +Below is a summary of all the options that +.B ntfscp +accepts. All options have two equivalent names. The short name is preceded by +.BR \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.BR \-fv +is equivalent to +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. +.TP +.BI "\-a, \-\-attribute " number +Write to this attribute. +.TP +.B \-i, \-\-inode +Treat +.I dest_file +as inode number. +.TP +.BI "\-N, \-\-attr-name " name +Write to attribute with this name. +.TP +.B -n, --no-action +Use this option to make a test run before doing the real copy operation. +Volume will be opened read-only and no write will be done. +.TP +.B \-f, \-\-force +This will override some sensible defaults, such as not working with a mounted +volume. Use this option with caution. +.TP +.B \-h, \-\-help +Show a list of options with a brief description of each one. +.TP +.B \-q, \-\-quiet +Suppress some debug/warning/error messages. +.TP +.B \-V, \-\-version +Show the version number, copyright and license +.BR ntfscp . +.TP +.B \-v, \-\-vebose +Display more debug/warning/error messages. +.SH EXAMPLES +Copy boot.ini from /home/user to the root of an /dev/hda1 NTFS volume: +.RS +.sp +.B ntfscp /dev/hda1 /home/user/boot.ini boot.ini +.sp +.RE +Copy my_sii_index_root to attribute 0x90 ($INDEX_ROOT) with name $SII of inode 9 (file $Secure): +.RS +.sp +.B ntfscp -i -a 0x90 -N $SII /dev/hda1 my_sii_index_root 9 +.SH BUGS +No bugs are known at present. If you find any bugs, please send an email to +.nh +. +.hy +.SH AUTHOR +.B ntfscp +was written by Yura Pakhuchiy. +.B ntfscp +and this manual page is based on ntfscat and it's manaul page by Richard Russon, so many thanks to him. +.SH AVAILABILITY +.B ntfscp +is part of the ntfsprogs package and is available from +.br +.nh +http://linux\-ntfs.sourceforge.net/downloads.html. +.hy +.SH SEE ALSO +.BR ntfsprogs (8) + From 488e4b5d30b29a286f5a423a850e30e75d421508 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 12 Oct 2004 20:05:02 +0000 Subject: [PATCH 2015/2994] move ntfscp from extra to standard program set (Logical change 1.607) --- ChangeLog | 3 +- INSTALL | 52 +- Makefile.in | 14 +- aclocal.m4 | 7356 ++++++----------- compile | 84 +- config.guess | 79 +- config.sub | 10 +- configure | 15712 ++++++------------------------------- configure.ac | 1 + doc/Makefile.in | 14 +- include/Makefile.in | 14 +- include/ntfs/Makefile.in | 14 +- install-sh | 4 +- libntfs/Makefile.in | 26 +- ltmain.sh | 3256 +++----- missing | 77 +- ntfsprogs/Makefile.am | 15 +- ntfsprogs/Makefile.in | 41 +- 18 files changed, 6035 insertions(+), 20737 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e57fce8..1357db8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -86,7 +86,8 @@ xx/xx/2004 - 2.0.0-WIP list. (Yura) - Remove inode.h::NIno{Clear,Set,}AttrListNonResident and attr_list_rl field from inode.h::_ntfs_inode struct. Adapt all users. (Yura) - - Add --attibute, --attr-name and --inode attribute to ntfscp. (Yura) + - Add --attibute, --attr-name and --inode options to ntfscp. (Yura) + - ntfscp is moved from extra to standard program set. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/INSTALL b/INSTALL index 54caf7c1..095b1eb4 100644 --- a/INSTALL +++ b/INSTALL @@ -1,13 +1,16 @@ -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software -Foundation, Inc. +Installation Instructions +************************* - This file is free documentation; the Free Software Foundation gives +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== - These are generic installation instructions. +These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses @@ -67,9 +70,9 @@ The simplest way to compile this package is: Compilers and Options ===================== - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here @@ -82,7 +85,7 @@ is an example: Compiling For Multiple Architectures ==================================== - You can compile the package for more than one kind of computer at the +You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the @@ -99,19 +102,19 @@ for another architecture. Installation Names ================== - By default, `make install' will install the package's files in +By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. +option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. +give `configure' the option `--exec-prefix=PREFIX', the package will +use PREFIX as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular +options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. @@ -122,7 +125,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= - Some packages pay attention to `--enable-FEATURE' options to +Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The @@ -137,11 +140,11 @@ you can use the `configure' options `--x-includes=DIR' and Specifying the System Type ========================== - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: @@ -167,9 +170,9 @@ eventually be run) with `--host=TYPE'. Sharing Defaults ================ - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. @@ -178,7 +181,7 @@ A warning: not all `configure' scripts look for a site script. Defining Variables ================== - Variables not defined in a site shell script can be set in the +Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set @@ -192,8 +195,7 @@ overridden in the site shell script). `configure' Invocation ====================== - `configure' recognizes the following options to control how it -operates. +`configure' recognizes the following options to control how it operates. `--help' `-h' diff --git a/Makefile.in b/Makefile.in index 7d7a0391..c015bc8c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.1 from Makefile.am. +# Makefile.in generated by automake 1.9.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -77,7 +77,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -88,10 +87,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -103,8 +98,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -134,18 +127,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/aclocal.m4 b/aclocal.m4 index 7310a0e3..3fa265f2 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.9.1 -*- Autoconf -*- +# generated automatically by aclocal 1.9.2 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. @@ -11,63 +11,12 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- -# serial 47 AC_PROG_LIBTOOL +# serial 46 AC_PROG_LIBTOOL - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# 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 And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -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_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" @@ -78,13 +27,10 @@ AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL +]) - -# AC_LIBTOOL_SETUP -# ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)dnl +[AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl @@ -94,105 +40,15 @@ 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([LT_AC_PROG_SED])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 -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] - -# Same as above, but do not quote variable references. -[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -202,78 +58,341 @@ file_magic*) ;; esac -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default +# 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* + ;; -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_64bit_output=no + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *"ELF 64"*) + lt_cv_cc_64bit_output=yes + ;; + 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) -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl + # 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])]) -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} + 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 -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER +_LT_AC_LTCONFIG_HACK +]) -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX +# AC_LIBTOOL_HEADER_ASSERT +# ------------------------ +AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], +[AC_CACHE_CHECK([whether $CC supports assert without backlinking], + [lt_cv_func_assert_works], + [case $host in + *-*-solaris*) + if test "$GCC" = yes && test "$with_gnu_ld" != yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) lt_cv_func_assert_works=no ;; + *) lt_cv_func_assert_works=yes ;; + esac + fi + ;; + esac]) +if test "x$lt_cv_func_assert_works" = xyes; then + AC_CHECK_HEADERS(assert.h) +fi +])# AC_LIBTOOL_HEADER_ASSERT -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h) +])# _LT_AC_CHECK_DLFCN +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[[ABCDGISTW]]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AC_FD_CC + fi + else + echo "cannot find nm_test_var in $nlist" >&AC_FD_CC + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC + fi + else + echo "$progname: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + +# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +# --------------------------------- +AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], +[# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi +])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ +[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -291,7 +410,7 @@ if test "X[$]1" = X--no-reexec; then elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else @@ -303,14 +422,14 @@ if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -337,9 +456,8 @@ else # # So, first we look for a working echo in the user's PATH. - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -348,7 +466,7 @@ else break fi done - IFS="$lt_save_ifs" + IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -421,312 +539,17 @@ if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then fi AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - 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 - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - 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_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - 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 - ;; -AC_PROVIDE_IFELSE([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) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_REQUIRE([LT_AC_PROG_SED]) -AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* ) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for *BSD - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - +AC_DIVERT_POP +])# _LT_AC_PROG_ECHO_BACKSLASH # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ------------------------------------------------------------------ AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : +[if test "$cross_compiling" = yes; then : [$4] else + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext </dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext +# Same as above, but do not quote variable references. +double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" + +AC_MSG_CHECKING([for objdir]) +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +AC_MSG_RESULT($objdir) + + +AC_ARG_WITH(pic, +[ --with-pic try to use only PIC/non-PIC objects [default=use both]], +pic_mode="$withval", pic_mode=default) +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +AC_MSG_CHECKING([for $compiler option to produce PIC]) +AC_CACHE_VAL(lt_cv_prog_cc_pic, +[ lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6* | nonstopux*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi ]) -])# AC_LIBTOOL_PROG_CC_C_O +if test -z "$lt_cv_prog_cc_pic"; then + AC_MSG_RESULT([none]) +else + AC_MSG_RESULT([$lt_cv_prog_cc_pic]) + + # Check to make sure the pic_flag actually works. + AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) + AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + AC_TRY_COMPILE([], [], [dnl + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + ], [dnl + lt_cv_prog_cc_pic_works=no + ]) + CFLAGS="$save_CFLAGS" + ]) + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) + lt_cv_prog_cc_can_build_shared=no + fi +fi + +AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) +AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) + LDFLAGS="$save_LDFLAGS" +]) + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- +# Check to see if options -o and -c are simultaneously supported by compiler +AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) +AC_CACHE_VAL([lt_cv_compiler_c_o], [ +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&AC_FD_CC + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null +]) +compiler_c_o=$lt_cv_compiler_c_o +AC_MSG_RESULT([$compiler_c_o]) + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) + AC_CACHE_VAL([lt_cv_compiler_o_lo], [ + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + ]) + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + ]) + compiler_o_lo=$lt_cv_compiler_o_lo + AC_MSG_RESULT([$compiler_o_lo]) +else + compiler_o_lo=no +fi + # Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then +if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes @@ -988,77 +1131,764 @@ if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT([$compiler_rtti_exceptions]) -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR +# See if the linker supports building shared libraries. +AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \[$]# in + 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; + *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +AC_MSG_RESULT([$ld_shlibs]) +test "$ld_shlibs" = no && can_build_shared=no -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- # Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then +AC_MSG_CHECKING([how to hardcode library paths into programs]) +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then # We can hardcode non-existant directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink + hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate + hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported + hardcode_action=unsupported fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) +AC_MSG_RESULT([$hardcode_action]) -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= +striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then @@ -1066,33 +1896,17 @@ if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else AC_MSG_RESULT([no]) fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- # PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) +AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= -shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -1101,36 +1915,17 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' ;; aix4* | aix5*) @@ -1140,7 +1935,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -1150,54 +1945,57 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' + soname_spec='${libname}${release}.so$major' fi shlibpath_var=LIBPATH fi + hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) - library_names_spec='${libname}${shared_ext}' + library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; -bsdi[[45]]*) +bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -1205,55 +2003,29 @@ bsdi[[45]]*) cygwin* | mingw* | pw32*) version_type=windows - shrext_cmds=".dll" need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) + yes,cygwin*) library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac ;; - + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -1266,56 +2038,30 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac @@ -1324,11 +2070,7 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on + *) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -1339,8 +2081,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -1348,45 +2090,14 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. + dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -1394,29 +2105,21 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; + *) version_type=irix ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -1425,21 +2128,20 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. -linux*) +linux-gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -1448,11 +2150,12 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi + case $host_cpu:$lt_cv_cc_64bit_output in + powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" + ;; + esac # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -1463,29 +2166,17 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -1495,17 +2186,7 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -1514,47 +2195,46 @@ openbsd*) version_type=sunos need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case "$host_os" in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' - shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' + library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf - need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; @@ -1562,8 +2242,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -1573,7 +2253,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -1585,8 +2265,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -1607,940 +2287,39 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# 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_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# 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], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# 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_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# 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], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# 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_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# 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], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# 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_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# 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_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [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]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -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_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -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 - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_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_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$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_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl -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 $CC]) - 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. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname 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 - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - 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. - case `"$lt_cv_path_LD" -v 2>&1 &1 /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_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - 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_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - case $host_cpu in - alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - # this will be overridden with pass_all, but let us keep it just in case - 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` - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - 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 - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - 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*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the pathname to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - 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 - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - 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 - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_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* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL 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, lt_dlinit, - [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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) -])# _LT_AC_LANG_CXX - - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[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])])])])])]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# -------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -# Report which librarie types wil actually be built +# Report the final consequences. AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -2558,1159 +2337,10 @@ aix3*) fi ;; -aix4* | aix5*) +aix4*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - openbsd2*) - # C++ shared libraries are fairly broken - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - openbsd*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd='echo' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext -AC_LIBTOOL_CONFIG($1) + if AC_TRY_EVAL(ac_compile); then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi]) + AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_F77_CONFIG - - -# AC_LIBTOOL_LANG_GCJ_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) -AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], -[AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_RESTORE -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_GCJ_CONFIG - - -# AC_LIBTOOL_LANG_RC_CONFIG -# -------------------------- -# Ensure that the configuration vars for the Windows resource compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) -AC_DEFUN([_LT_AC_LANG_RC_CONFIG], -[AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_RESTORE -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_RC_CONFIG - - -# AC_LIBTOOL_CONFIG([TAGNAME]) -# ---------------------------- -# If TAGNAME is not passed, then create an initial libtool script -# with a default configuration from the untagged config vars. Otherwise -# add code to config.status for appending the configuration named by -# TAGNAME from the matching tagged config vars. -AC_DEFUN([AC_LIBTOOL_CONFIG], -[# The else clause should only fire when bootstrapping the +# The second clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ + for var in echo old_CC old_CFLAGS SED \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - _LT_AC_TAGVAR(compiler, $1) \ - _LT_AC_TAGVAR(CC, $1) \ - _LT_AC_TAGVAR(LD, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ - _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ - _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ - _LT_AC_TAGVAR(old_archive_cmds, $1) \ - _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ - _LT_AC_TAGVAR(predep_objects, $1) \ - _LT_AC_TAGVAR(postdep_objects, $1) \ - _LT_AC_TAGVAR(predeps, $1) \ - _LT_AC_TAGVAR(postdeps, $1) \ - _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ - _LT_AC_TAGVAR(archive_cmds, $1) \ - _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ - _LT_AC_TAGVAR(postinstall_cmds, $1) \ - _LT_AC_TAGVAR(postuninstall_cmds, $1) \ - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ - _LT_AC_TAGVAR(allow_undefined_flag, $1) \ - _LT_AC_TAGVAR(no_undefined_flag, $1) \ - _LT_AC_TAGVAR(export_symbols_cmds, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ - _LT_AC_TAGVAR(hardcode_automatic, $1) \ - _LT_AC_TAGVAR(module_cmds, $1) \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) \ - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ - _LT_AC_TAGVAR(exclude_expsyms, $1) \ - _LT_AC_TAGVAR(include_expsyms, $1); do + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do case $var in - _LT_AC_TAGVAR(old_archive_cmds, $1) | \ - _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ - _LT_AC_TAGVAR(archive_cmds, $1) | \ - _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ - _LT_AC_TAGVAR(module_cmds, $1) | \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ - _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -3918,31 +2464,14 @@ if test -f "$ltmain"; then esac done - case $lt_echo in - *'\[$]0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` - ;; - esac + cat <<__EOF__ > "${ofile}T" +#! $SHELL -ifelse([$1], [], - [cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - AC_MSG_NOTICE([creating $ofile])], - [cfgfile="$ofile"]) - - cat <<__EOF__ >> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: +# Copyright (C) 1996-2000 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -3964,21 +2493,17 @@ ifelse([$1], [], # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed program that does not truncate output. +# A sed that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="${SED} -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) +# ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -3992,10 +2517,7 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) +build_libtool_need_lc=$need_lc # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -4011,20 +2533,14 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) +# The default C compiler. +CC=$lt_CC # Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP +with_gcc=$GCC # The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) +LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S @@ -4033,7 +2549,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$lt_STRIP +STRIP=$STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -4045,7 +2561,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4055,7 +2571,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) +wl=$lt_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -4063,21 +2579,18 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_flag=$lt_pic_flag pic_mode=$pic_mode -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - # Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -4098,19 +2611,19 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) +link_static_flag=$lt_link_static_flag # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) +no_builtin_flag=$lt_no_builtin_flag # Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) +whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) +thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type @@ -4127,50 +2640,26 @@ soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -4178,10 +2667,10 @@ deplibs_check_method=$lt_deplibs_check_method file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) +allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) +no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds @@ -4190,13 +2679,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe +global_symbol_pipe=$lt_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -4208,45 +2697,36 @@ shlibpath_var=$shlibpath_var shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) +hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) +hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) +hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) +hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) +hardcode_shlibpath_var=$hardcode_shlibpath_var # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) +link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec @@ -4255,33 +2735,30 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" +fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) +always_export_symbols=$always_export_symbols # The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) +export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) +exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) +include_expsyms=$lt_include_expsyms -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) +# ### END LIBTOOL CONFIG __EOF__ -ifelse([$1],[], [ case $host_os in aix3*) - cat <<\EOF >> "$cfgfile" + cat <<\EOF >> "${ofile}T" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -4294,1551 +2771,11 @@ EOF ;; esac - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDRT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - ccc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi[[45]]*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include @@ -5872,13 +2809,748 @@ AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # return TRUE; # } # /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# 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 of the License, 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. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + +])# _LT_AC_LTCONFIG_HACK + +# 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)]) -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) +# 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 <&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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])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=$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_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 &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 dependent 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 +aix4* | aix5*) + 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # 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* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # 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 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) + 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 + ;; + +newos6*) + 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 + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +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 + 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*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + 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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +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=$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 LTDLINCL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and LTDLINCL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) @@ -5892,16 +3564,6 @@ AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # @@ -5915,51 +3577,79 @@ AC_DEFUN([LT_AC_PROG_SED], AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. +as_executable_p="test -f" as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do + for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" fi done done done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed + + # 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 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 40000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done done -done + rm -rf "$tmp" ]) -SED=$lt_cv_path_SED +if test "X$SED" != "X"; then + lt_cv_path_SED=$SED +else + SED=$lt_cv_path_SED +fi AC_MSG_RESULT([$SED]) ]) @@ -5967,7 +3657,7 @@ AC_MSG_RESULT([$SED]) dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ +AC_DEFUN(PKG_CHECK_MODULES, [ succeeded=no if test -z "$PKG_CONFIG"; then @@ -6050,7 +3740,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # 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.9.1])]) + [AM_AUTOMAKE_VERSION([1.9.2])]) # AM_AUX_DIR_EXPAND diff --git a/compile b/compile index a81e000a..80b645b0 100755 --- a/compile +++ b/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand `-c -o'. -scriptversion=2003-11-09.00 +scriptversion=2004-09-10.20 -# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -55,37 +55,41 @@ EOF ;; esac - -prog=$1 -shift - ofile= cfile= -args= -while test $# -gt 0; do - case "$1" in - -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we do something ugly here. - ofile=$2 - shift - case "$ofile" in - *.o | *.obj) - ;; - *) - args="$args -o $ofile" - ofile= - ;; - esac - ;; - *.c) - cfile=$1 - args="$args $1" - ;; - *) - args="$args $1" - ;; - esac +eat= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we strip `-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi shift done @@ -95,36 +99,36 @@ if test -z "$ofile" || test -z "$cfile"; then # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. - exec "$prog" $args + exec "$@" fi # Name of file we expect compiler to create. -cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` +cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` # Create the lock directory. # Note: use `[/.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. -lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d +lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d while true; do - if mkdir $lockdir > /dev/null 2>&1; then + if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir $lockdir; exit 1" 1 2 15 +trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. -"$prog" $args -status=$? +"$@" +ret=$? if test -f "$cofile"; then mv "$cofile" "$ofile" fi -rmdir $lockdir -exit $status +rmdir "$lockdir" +exit $ret # Local Variables: # mode: shell-script diff --git a/config.guess b/config.guess index d949270a..7d0185e0 100755 --- a/config.guess +++ b/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-08-11' +timestamp='2004-09-07' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -136,16 +136,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -213,9 +203,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -240,18 +227,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} + echo mips64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -838,19 +819,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux + echo cris-axis-linux-gnu + exit 0 ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit 0 ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -869,7 +856,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -888,13 +875,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux + echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux + echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -907,34 +894,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux + echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux + echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -949,18 +936,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" + echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" + echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linuxoldld) or + # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -989,7 +976,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.sub b/config.sub index 236e424d..edb6b663 100755 --- a/config.sub +++ b/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-06-24' +timestamp='2004-08-29' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -457,6 +457,9 @@ case $basic_machine in crds | unos) basic_machine=m68k-crds ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; @@ -1161,7 +1164,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1194,6 +1197,9 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index ab8e1a33..5c3c61c8 100755 --- a/configure +++ b/configure @@ -243,6 +243,17 @@ IFS=" $as_nl" $as_unset CDPATH +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -261,7 +272,7 @@ if test "X$1" = X--no-reexec; then elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else @@ -273,14 +284,14 @@ if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -307,9 +318,8 @@ else # # So, first we look for a working echo in the user's PATH. - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -318,7 +328,7 @@ else break fi done - IFS="$lt_save_ifs" + IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -392,11 +402,6 @@ fi - -tagnames=${tagnames+${tagnames},}CXX - -tagnames=${tagnames+${tagnames},}F77 - # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. @@ -466,7 +471,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 ECHO RANLIB ac_ct_RANLIB CPP EGREP LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -927,26 +932,6 @@ ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP -ac_env_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS -ac_env_CXXCPP_set=${CXXCPP+set} -ac_env_CXXCPP_value=$CXXCPP -ac_cv_env_CXXCPP_set=${CXXCPP+set} -ac_cv_env_CXXCPP_value=$CXXCPP -ac_env_F77_set=${F77+set} -ac_env_F77_value=$F77 -ac_cv_env_F77_set=${F77+set} -ac_cv_env_F77_value=$F77 -ac_env_FFLAGS_set=${FFLAGS+set} -ac_env_FFLAGS_value=$FFLAGS -ac_cv_env_FFLAGS_set=${FFLAGS+set} -ac_cv_env_FFLAGS_value=$FFLAGS # # Report the --help message. @@ -1029,10 +1014,8 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-shared[=PKGS] - build shared libraries [default=yes] - --enable-static[=PKGS] - build static libraries [default=yes] + --enable-shared=PKGS build shared libraries default=yes + --enable-static=PKGS build static libraries default=yes --enable-debug enable additional debugging code and output --disable-default-device-io-ops do not provide default device io operations @@ -1042,19 +1025,15 @@ Optional Features: --enable-warnings enable additional compiler warnings --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors - --enable-fast-install[=PKGS] - optimize for fast installation [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] - --with-tags[=TAGS] - include additional configurations [automatic] + --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 @@ -1064,11 +1043,6 @@ Some influential environment variables: CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CXXCPP C++ preprocessor - F77 Fortran 77 compiler command - FFLAGS Fortran 77 compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2045,51 +2019,47 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' 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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +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; - # This is required to get past a stupid configure bug when making the rpm. # Basically it is broken to specify the host as a command line argument to # configure on its own, i.e. without giving --host=. It is supposed to work @@ -3413,98 +3383,35 @@ fi 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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +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; - -echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done - +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator fi -SED=$lt_cv_path_SED -echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6 - -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 - 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then @@ -3516,8 +3423,8 @@ 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 $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 + 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 @@ -3527,12 +3434,12 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 esac case $ac_prog in # Accept absolute paths. - [\\/]* | ?:[\\/]*) + [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + # 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%/%"` + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -3556,26 +3463,22 @@ if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do - IFS="$lt_save_ifs" 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. - case `"$lt_cv_path_LD" -v 2>&1 &1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break - ;; - *) + else test "$with_gnu_ld" != yes && break - ;; - esac + fi fi done - IFS="$lt_save_ifs" + IFS="$ac_save_ifs" else lt_cv_path_LD="$LD" # Let the user override the test with a path. fi @@ -3598,14 +3501,11 @@ 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. -case `$LD -v 2>&1 &1 &5; then lt_cv_prog_gnu_ld=yes - ;; -*) +else lt_cv_prog_gnu_ld=no - ;; -esac +fi fi echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 @@ -3622,20 +3522,7 @@ 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 -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - darwin*) - if test "$GCC" = yes; then - reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac +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 @@ -3646,42 +3533,120 @@ else # Let the user override the test. lt_cv_path_NM="$NM" else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" 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 + 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 - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) + 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 - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - 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 - ;; - esac - esac + 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="$lt_save_ifs" + IFS="$ac_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi -echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 -echo "${ECHO_T}$lt_cv_path_NM" >&6 + NM="$lt_cv_path_NM" +echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_executable_p="test -f" +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_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + fi + done + done +done + + # 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 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break + fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 40000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done + done + rm -rf "$tmp" + +fi + +if test "X$SED" != "X"; then + lt_cv_path_SED=$SED +else + SED=$lt_cv_path_SED +fi +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 @@ -3698,7 +3663,7 @@ lt_cv_deplibs_check_method='unknown' # '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 extended regex. +# 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. @@ -3711,30 +3676,31 @@ beos*) lt_cv_deplibs_check_method=pass_all ;; -bsdi[45]*) +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*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump'. +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=pass_all + 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac ;; -freebsd* | kfreebsd*-gnu) +freebsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -3754,53 +3720,50 @@ gnu*) lt_cv_deplibs_check_method=pass_all ;; -hpux10.20* | hpux11*) +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 - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - 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_test_file=/usr/lib/libc.sl - ;; - esac + lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; + case $host_os in + irix5* | nonstopux*) + # 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*) +linux-gnu*) case $host_cpu in - alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64) + alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM - # this will be overridden with pass_all, but let us keep it just in case 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` - lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' fi ;; @@ -3810,19 +3773,20 @@ newos6*) lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' fi ;; 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 ;; @@ -3831,6 +3795,11 @@ sco3.2v5*) ;; 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 ;; @@ -3857,10 +3826,6 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ;; esac ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; esac fi @@ -3868,210 +3833,211 @@ 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 -test -z "$deplibs_check_method" && deplibs_check_method=unknown -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -# 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 && enable_libtool_lock=yes -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > 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 - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 3914 "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 - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - 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 - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > 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.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - 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 +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output" >&5 +echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] -int -main () -{ +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' -lt_cv_cc_needs_belf=no -fi -rm -f conftest.err 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 +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' -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 +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' ;; - esac -need_locks="$enable_libtool_lock" +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + 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); } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4308,6 +4274,21 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 + 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + 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 @@ -4696,1372 +4677,150 @@ fi done -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC - 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_CXX+set}" = set; then + + + + + +# 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 - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # 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_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done + 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 <&2 -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi +*** 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 - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -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_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - - -# 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 &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -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_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cxx_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -for ac_declaration in \ - '' \ - '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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -depcc="$CXX" 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_CXX_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_CXX_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 - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch 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 - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break +EOF + fi ;; + esac fi + break fi done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac fi -fi -echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_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 -if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -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 - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -echo "$as_me:$LINENO: result: $CXXCPP" >&5 -echo "${ECHO_T}$CXXCPP" >&6 -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -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 \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran - 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_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$F77"; then - ac_cv_prog_F77="$F77" # 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_F77="$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 -F77=$ac_cv_prog_F77 -if test -n "$F77"; then - echo "$as_me:$LINENO: result: $F77" >&5 -echo "${ECHO_T}$F77" >&6 +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 - test -n "$F77" && break +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 <&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 -if test -z "$F77"; then - ac_ct_F77=$F77 - for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran -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_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_F77"; then - ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -fi -fi -ac_ct_F77=$ac_cv_prog_ac_ct_F77 -if test -n "$ac_ct_F77"; then - echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 -echo "${ECHO_T}$ac_ct_F77" >&6 +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 - test -n "$ac_ct_F77" && break -done - - F77=$ac_ct_F77 -fi - - -# Provide some information about the compiler. -echo "$as_me:5486:" \ - "checking for Fortran 77 compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -rm -f a.out - -# If we don't use `.F' as extension, the preprocessor is not run on the -# input file. (Note that this only needs to work for GNU compilers.) -ac_save_ext=$ac_ext -ac_ext=F -echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 -if test "${ac_cv_f77_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF - program main -#ifndef __GNUC__ - choke me -#endif - - end -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext -ac_cv_f77_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 -ac_ext=$ac_save_ext -ac_test_FFLAGS=${FFLAGS+set} -ac_save_FFLAGS=$FFLAGS -FFLAGS= -echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 -echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_f77_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - FFLAGS=-g -cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_f77_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_f77_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 -echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 -if test "$ac_test_FFLAGS" = set; then - FFLAGS=$ac_save_FFLAGS -elif test $ac_cv_prog_f77_g = yes; then - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-g -O2" else - FFLAGS="-g" - fi -else - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-O2" - else - FFLAGS= + MAGIC_CMD=: fi fi -G77=`test $ac_compiler_gnu = yes && echo yes` -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 - - - -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - -# find the maximum length of command line arguments -echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 -echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 -if test "${lt_cv_sys_max_cmd_len+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* ) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for *BSD - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 -echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 -else - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 -fi - - - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 -echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris* | sysv5*) - symcode='[BDRT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - 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); } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6 -else - echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6 -fi - -echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -if test "${lt_cv_objdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 -echo "${ECHO_T}$lt_cv_objdir" >&6 -objdir=$lt_cv_objdir - - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES fi ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; 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_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" - 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_AR" && ac_cv_prog_ac_ct_AR="false" -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -echo "${ECHO_T}$ac_ct_AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - AR=$ac_ct_AR -else - AR="$ac_cv_prog_AR" -fi - 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 @@ -6223,6 +4982,168 @@ else fi +enable_dlopen=no +enable_win32_dll=no + +# 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 && enable_libtool_lock=yes + +# 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 5000 "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* + ;; + +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_64bit_output=no + 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 + *"ELF 64"*) + lt_cv_cc_64bit_output=yes + ;; + 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 +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err 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 + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + old_CC="$CC" old_CFLAGS="$CFLAGS" @@ -6231,18 +5152,40 @@ test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm -test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' @@ -6260,152 +5203,24 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" -# 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 +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs fi +rmdir .libs 2>/dev/null +echo "$as_me:$LINENO: result: $objdir" >&5 +echo "${ECHO_T}$objdir" >&6 -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_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_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 - -enable_dlopen=no -enable_win32_dll=no - -# 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 && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. @@ -6417,455 +5232,453 @@ else fi; test -z "$pic_mode" && pic_mode=default -# Use C for the default configuration in the libtool script -tagname= -lt_save_CC="$CC" -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 - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# -# Check for any special shared library compilation flags. -# -lt_prog_cc_shlib= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - lt_prog_cc_shlib='-belf' - ;; - esac -fi -if test -n "$lt_prog_cc_shlib"; then - { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 -if test "${lt_prog_compiler_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_prog_compiler_static" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - else - lt_prog_compiler_static_works=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 - -if test x"$lt_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' - - -echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6536: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:6540: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_pic+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" ;; - amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' + lt_cv_prog_cc_pic='-fno-common' ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' ;; - sysv4*MP*) if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic + lt_cv_prog_cc_pic=-Kconform_pic fi ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - *) - lt_prog_compiler_pic='-fPIC' + lt_cv_prog_cc_pic='-fPIC' ;; esac else - # PORTME Check for flag to pass linker flags through the system compiler. + # PORTME Check for PIC flags for the system compiler. case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_static='-Bstatic' else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' fi ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic='-qnocommon' - lt_prog_compiler_wl='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' ;; irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' ;; newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - esac + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' ;; osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' ;; sco3.2v5*) - lt_prog_compiler_pic='-Kpic' - lt_prog_compiler_static='-dn' + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' ;; solaris*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' ;; sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' fi ;; - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - *) - lt_prog_compiler_can_build_shared=no + lt_cv_prog_cc_can_build_shared=no ;; esac fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic" >&6 +fi -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then +if test -z "$lt_cv_prog_cc_pic"; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +else + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works+set}" = set; then + # Check to make sure the pic_flag actually works. + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 + if test "${lt_cv_prog_cc_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6779: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:6783: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works=yes - fi - fi - $rm conftest* + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac -if test x"$lt_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_prog_cc_pic_works=no fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +fi + + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + +echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_prog_cc_static_works=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi + + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o+set}" = set; then +if test "${lt_cv_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_cv_prog_compiler_c_o=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6839: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:6843: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:5576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 +compiler_c_o=$lt_cv_compiler_c_o +echo "$as_me:$LINENO: result: $compiler_c_o" >&5 +echo "${ECHO_T}$compiler_c_o" >&6 +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 + if test "${lt_cv_compiler_o_lo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + +fi + + compiler_o_lo=$lt_cv_compiler_o_lo + echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 +echo "${ECHO_T}$compiler_o_lo" >&6 +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then +if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 @@ -6886,72 +5699,144 @@ else need_locks=no fi -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - runpath_var= - allow_undefined_flag= - enable_shared_with_static_runtimes=no - archive_cmds= - archive_expsym_cmds= - old_archive_From_new_cmds= - old_archive_from_expsyms_cmds= - export_dynamic_flag_spec= - whole_archive_flag_spec= - thread_safe_flag_spec= - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - link_all_deplibs=unknown - hardcode_automatic=no - module_cmds= - module_expsym_cmds= - always_export_symbols=no - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes fi - ;; - openbsd*) + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$compiler_rtti_exceptions" >&6 + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then with_gnu_ld=no - ;; - esac + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac - ld_shlibs=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <&2 + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. @@ -6960,73 +5845,125 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar *** so that a non-GNU linker is found, and then restart. EOF - fi - ;; + ;; - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs=no - ;; + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ ;; + esac - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool @@ -7036,782 +5973,553 @@ EOF *** used, and then restart. EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds="$tmp_archive_cmds" - fi + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - - if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec=' ' - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' - link_all_deplibs=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs=no - ;; - esac + ld_shlibs=no fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - ia64*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=no - hardcode_shlibpath_var=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - *) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld='-rpath $libdir' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag=' -z text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - *) - ld_shlibs=no + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi ;; esac fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [12].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +# Check hardcoding attributes. +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 -echo "${ECHO_T}$archive_cmds_need_lc" >&6 - ;; - esac - fi - ;; -esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown +# PORTME Fill in your ld.so characteristics echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= -shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -7820,36 +6528,17 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' ;; aix4* | aix5*) @@ -7859,7 +6548,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -7869,54 +6558,57 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' + soname_spec='${libname}${release}.so$major' fi shlibpath_var=LIBPATH fi + hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) - library_names_spec='${libname}${shared_ext}' + library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; -bsdi[45]*) +bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -7924,55 +6616,29 @@ bsdi[45]*) cygwin* | mingw* | pw32*) version_type=windows - shrext_cmds=".dll" need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) + yes,cygwin*) library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac ;; - + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' + ;; *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -7985,56 +6651,30 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac @@ -8043,11 +6683,7 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on + *) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -8058,8 +6694,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -8067,45 +6703,14 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. + dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -8113,29 +6718,21 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; + *) version_type=irix ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -8144,21 +6741,20 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. -linux*) +linux-gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -8167,11 +6763,12 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi + case $host_cpu:$lt_cv_cc_64bit_output in + powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" + ;; + esac # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -8182,29 +6779,17 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -8214,17 +6799,7 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -8233,47 +6808,46 @@ openbsd*) version_type=sunos need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case "$host_os" in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' - shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' + library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf - need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; @@ -8281,8 +6855,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -8292,7 +6866,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -8304,8 +6878,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -8326,22 +6900,31 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - *) dynamic_linker=no ;; @@ -8350,33 +6933,42 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var" || \ - test "X$hardcode_automatic" = "Xyes" ; then +# Report the final consequences. +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6 + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported @@ -8387,33 +6979,9 @@ elif test "$shlibpath_overrides_runpath" = yes || enable_fast_install=needless fi -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "x$enable_dlopen" != xyes; then @@ -8431,94 +6999,11 @@ else lt_cv_dlopen_self=yes ;; - mingw* | pw32*) + cygwin* | mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 @@ -9002,7 +7487,7 @@ fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" @@ -9018,10 +7503,10 @@ else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 fi -# Report which librarie types wil actually be built -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + if test "${lt_cv_archive_cmds_need_lc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 + 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 + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi +fi -# The else clause should only fire when bootstrapping the + echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 +echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ + for var in echo old_CC old_CFLAGS SED \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler \ - CC \ - LD \ - lt_prog_compiler_wl \ - lt_prog_compiler_pic \ - lt_prog_compiler_static \ - lt_prog_compiler_no_builtin_flag \ - export_dynamic_flag_spec \ - thread_safe_flag_spec \ - whole_archive_flag_spec \ - enable_shared_with_static_runtimes \ - old_archive_cmds \ - old_archive_from_new_cmds \ - predep_objects \ - postdep_objects \ - predeps \ - postdeps \ - compiler_lib_search_path \ - archive_cmds \ - archive_expsym_cmds \ - postinstall_cmds \ - postuninstall_cmds \ - old_archive_from_expsyms_cmds \ - allow_undefined_flag \ - no_undefined_flag \ - export_symbols_cmds \ - hardcode_libdir_flag_spec \ - hardcode_libdir_flag_spec_ld \ - hardcode_libdir_separator \ - hardcode_automatic \ - module_cmds \ - module_expsym_cmds \ - lt_cv_prog_compiler_c_o \ - exclude_expsyms \ - include_expsyms; do + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do case $var in - old_archive_cmds | \ - old_archive_from_new_cmds | \ - archive_cmds | \ - archive_expsym_cmds | \ - module_cmds | \ - module_expsym_cmds | \ - old_archive_from_expsyms_cmds | \ - export_symbols_cmds | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -9340,29 +7820,14 @@ if test -f "$ltmain"; then esac done - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - { echo "$as_me:$LINENO: creating $ofile" >&5 -echo "$as_me: creating $ofile" >&6;} - - cat <<__EOF__ >> "$cfgfile" + cat <<__EOF__ > "${ofile}T" #! $SHELL -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: +# Copyright (C) 1996-2000 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -9384,18 +7849,15 @@ echo "$as_me: creating $ofile" >&6;} # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed program that does not truncate output. +# A sed that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="${SED} -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# The names of the tagged configurations supported by this script. -available_tags= +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi # ### BEGIN LIBTOOL CONFIG @@ -9411,10 +7873,7 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes +build_libtool_need_lc=$need_lc # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -9430,18 +7889,12 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler +# The default C compiler. +CC=$lt_CC # Is the compiler the GNU C compiler? with_gcc=$GCC -# An ERE matcher. -EGREP=$lt_EGREP - # The linker used to build libraries. LD=$lt_LD @@ -9452,7 +7905,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$lt_STRIP +STRIP=$STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -9464,7 +7917,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9474,7 +7927,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl +wl=$lt_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -9482,21 +7935,18 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic +pic_flag=$lt_pic_flag pic_mode=$pic_mode -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - # Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -9517,10 +7967,10 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static +link_static_flag=$lt_link_static_flag # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag +no_builtin_flag=$lt_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec @@ -9562,34 +8012,10 @@ archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -9609,13 +8035,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe +global_symbol_pipe=$lt_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -9636,15 +8062,10 @@ hardcode_into_libs=$hardcode_into_libs # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct @@ -9656,10 +8077,6 @@ hardcode_minus_L=$hardcode_minus_L # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic - # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" @@ -9695,10 +8112,9 @@ include_expsyms=$lt_include_expsyms __EOF__ - case $host_os in aix3*) - cat <<\EOF >> "$cfgfile" + cat <<\EOF >> "${ofile}T" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -9707,6 +8123,186 @@ if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# 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 of the License, 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. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1) - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") chmod +x "$ofile" - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - -# Check whether --with-tags or --without-tags was given. -if test "${with_tags+set}" = set; then - withval="$with_tags" - tagnames="$withval" -fi; - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} - else - { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 -echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in - "") ;; - *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 -echo "$as_me: error: invalid tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 -echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} - { (exit 1); exit 1; }; } - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_flag_spec_ld_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_automatic_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -compiler_CXX=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' -else - lt_prog_compiler_no_builtin_flag_CXX= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - -# 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 $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $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. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname 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 - 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 - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - 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. - case `"$lt_cv_path_LD" -v 2>&1 &5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -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. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 -ld_shlibs_CXX=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_CXX=yes - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_CXX=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_CXX='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' ${wl}-bernotok' - allow_undefined_flag_CXX=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_CXX=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX=' ' - archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs_CXX=no - fi - ;; - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_CXX=no - ;; - esac - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - freebsd12*) - # C++ shared libraries reported to be fairly broken before switch to ELF - ld_shlibs_CXX=no - ;; - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - gnu*) - ;; - hpux9*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC) - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_CXX='+b $libdir' - hardcode_libdir_separator_CXX=: - ;; - ia64*) - hardcode_libdir_flag_spec_CXX='-L$libdir' - ;; - *) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - openbsd2*) - # C++ shared libraries are fairly broken - ld_shlibs_CXX=no - ;; - openbsd*) - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='${wl}-E' - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd='echo' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx) - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - sco*) - archive_cmds_need_lc_CXX=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.0-5 | solaris2.0-5.*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - no_undefined_flag_CXX=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - archive_cmds_need_lc_CXX=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; -esac -echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6 -test "$ld_shlibs_CXX" = no && can_build_shared=no - -GCC_CXX="$GXX" -LD_CXX="$LD" - - -cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - # The `*' in the case matches for architectures that use `case' in - # $output_verbose_cmd can trigger glob expansion during the loop - # eval without this substitution. - output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" - - for p in `eval $output_verbose_link_cmd`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" \ - || test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX="${prev}${p}" - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX="${prev}${p}" - else - postdeps_CXX="${postdeps_CXX} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX="$p" - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX="$p" - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$rm -f confest.$objext - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - -lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic_CXX='-qnocommon' - lt_prog_compiler_wl_CXX='-Wl,' - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - icpc) - # Intel C++ - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11311: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:11315: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_CXX=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 - -if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11371: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:11375: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX="$ltdll_cmds" - ;; - cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - -echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6 -test "$ld_shlibs_CXX" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_CXX=no - else - archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || \ - test -n "$runpath_var_CXX" || \ - test "X$hardcode_automatic_CXX" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 -echo "${ECHO_T}$hardcode_action_CXX" >&6 - -if test "$hardcode_action_CXX" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* 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 shl_load (); -/* 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_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* 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 dlopen (); -/* 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_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_CXX \ - CC_CXX \ - LD_CXX \ - lt_prog_compiler_wl_CXX \ - lt_prog_compiler_pic_CXX \ - lt_prog_compiler_static_CXX \ - lt_prog_compiler_no_builtin_flag_CXX \ - export_dynamic_flag_spec_CXX \ - thread_safe_flag_spec_CXX \ - whole_archive_flag_spec_CXX \ - enable_shared_with_static_runtimes_CXX \ - old_archive_cmds_CXX \ - old_archive_from_new_cmds_CXX \ - predep_objects_CXX \ - postdep_objects_CXX \ - predeps_CXX \ - postdeps_CXX \ - compiler_lib_search_path_CXX \ - archive_cmds_CXX \ - archive_expsym_cmds_CXX \ - postinstall_cmds_CXX \ - postuninstall_cmds_CXX \ - old_archive_from_expsyms_cmds_CXX \ - allow_undefined_flag_CXX \ - no_undefined_flag_CXX \ - export_symbols_cmds_CXX \ - hardcode_libdir_flag_spec_CXX \ - hardcode_libdir_flag_spec_ld_CXX \ - hardcode_libdir_separator_CXX \ - hardcode_automatic_CXX \ - module_cmds_CXX \ - module_expsym_cmds_CXX \ - lt_cv_prog_compiler_c_o_CXX \ - exclude_expsyms_CXX \ - include_expsyms_CXX; do - - case $var in - old_archive_cmds_CXX | \ - old_archive_from_new_cmds_CXX | \ - archive_cmds_CXX | \ - archive_expsym_cmds_CXX | \ - module_cmds_CXX | \ - module_expsym_cmds_CXX | \ - old_archive_from_expsyms_cmds_CXX | \ - export_symbols_cmds_CXX | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_CXX - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_CXX -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_CXX - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_CXX" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld - - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu - - -archive_cmds_need_lc_F77=no -allow_undefined_flag_F77= -always_export_symbols_F77=no -archive_expsym_cmds_F77= -export_dynamic_flag_spec_F77= -hardcode_direct_F77=no -hardcode_libdir_flag_spec_F77= -hardcode_libdir_flag_spec_ld_F77= -hardcode_libdir_separator_F77= -hardcode_minus_L_F77=no -hardcode_automatic_F77=no -module_cmds_F77= -module_expsym_cmds_F77= -link_all_deplibs_F77=unknown -old_archive_cmds_F77=$old_archive_cmds -no_undefined_flag_F77= -whole_archive_flag_spec_F77= -enable_shared_with_static_runtimes_F77=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -objext_F77=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" - -# Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${F77-"f77"} -compiler=$CC -compiler_F77=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 - -test "$ld_shlibs_F77" = no && can_build_shared=no - -GCC_F77="$G77" -LD_F77="$LD" - -lt_prog_compiler_wl_F77= -lt_prog_compiler_pic_F77= -lt_prog_compiler_static_F77= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_static_F77='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_F77='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_F77=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_F77=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_F77='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - else - lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic_F77='-qnocommon' - lt_prog_compiler_wl_F77='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_F77='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_F77='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-static' - ;; - ccc*) - lt_prog_compiler_wl_F77='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_F77='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_F77='-Kpic' - lt_prog_compiler_static_F77='-dn' - ;; - - solaris*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl_F77='-Qoption ld ' - lt_prog_compiler_pic_F77='-PIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_F77='-Kconform_pic' - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - uts4*) - lt_prog_compiler_pic_F77='-pic' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_F77=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_F77"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_F77=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_F77" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13667: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:13671: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_F77=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 - -if test x"$lt_prog_compiler_pic_works_F77" = xyes; then - case $lt_prog_compiler_pic_F77 in - "" | " "*) ;; - *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; - esac -else - lt_prog_compiler_pic_F77= - lt_prog_compiler_can_build_shared_F77=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_F77= - ;; - *) - lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_F77=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13727: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:13731: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_F77=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag_F77= - enable_shared_with_static_runtimes_F77=no - archive_cmds_F77= - archive_expsym_cmds_F77= - old_archive_From_new_cmds_F77= - old_archive_from_expsyms_cmds_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= - thread_safe_flag_spec_F77= - hardcode_libdir_flag_spec_F77= - hardcode_libdir_flag_spec_ld_F77= - hardcode_libdir_separator_F77= - hardcode_direct_F77=no - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=unsupported - link_all_deplibs_F77=unknown - hardcode_automatic_F77=no - module_cmds_F77= - module_expsym_cmds_F77= - always_export_symbols_F77=no - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_F77= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_F77=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_F77=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_F77=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_F77='-L$libdir' - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=no - enable_shared_with_static_runtimes_F77=yes - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - sunos4*) - archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds_F77="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_F77="$tmp_archive_cmds" - fi - else - ld_shlibs_F77=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - esac - - if test "$ld_shlibs_F77" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=yes - archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_F77=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_F77=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_F77='' - hardcode_direct_F77=yes - hardcode_libdir_separator_F77=':' - link_all_deplibs_F77=yes - - if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_F77=yes - else - # We have old collect2 - hardcode_direct_F77=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_F77=yes - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_libdir_separator_F77= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_F77=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_F77='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_F77="-z nodefs" - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_F77=' ${wl}-bernotok' - allow_undefined_flag_F77=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_F77=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_F77=' ' - archive_cmds_need_lc_F77=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_F77=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_F77=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_F77=' ' - allow_undefined_flag_F77=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_F77='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_F77=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_F77=no - hardcode_direct_F77=no - hardcode_automatic_F77=yes - hardcode_shlibpath_var_F77=unsupported - whole_archive_flag_spec_F77='' - link_all_deplibs_F77=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_F77=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - freebsd1*) - ld_shlibs_F77=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_F77='+b $libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - ;; - ia64*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - *) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - link_all_deplibs_F77=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - newsos6) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_shlibpath_var_F77=no - ;; - - openbsd*) - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - export_dynamic_flag_spec_F77='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - ;; - *) - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - allow_undefined_flag_F77=unsupported - archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_F77='-rpath $libdir' - fi - hardcode_libdir_separator_F77=: - ;; - - sco3.2v5*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_F77=' -z text' - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_shlibpath_var_F77=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs_F77=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_F77='$CC -r -o $output$reload_objs' - hardcode_direct_F77=no - ;; - motorola) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv4.3*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_F77=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_F77='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv5*) - no_undefined_flag_F77=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_F77= - hardcode_shlibpath_var_F77=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - *) - ld_shlibs_F77=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 -echo "${ECHO_T}$ld_shlibs_F77" >&6 -test "$ld_shlibs_F77" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_F77" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_F77=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_F77 in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_F77 - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_F77 - allow_undefined_flag_F77= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_F77=no - else - archive_cmds_need_lc_F77=yes - fi - allow_undefined_flag_F77=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_F77= -if test -n "$hardcode_libdir_flag_spec_F77" || \ - test -n "$runpath_var_F77" || \ - test "X$hardcode_automatic_F77" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_F77" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && - test "$hardcode_minus_L_F77" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_F77=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_F77=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_F77=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 -echo "${ECHO_T}$hardcode_action_F77" >&6 - -if test "$hardcode_action_F77" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_F77 \ - CC_F77 \ - LD_F77 \ - lt_prog_compiler_wl_F77 \ - lt_prog_compiler_pic_F77 \ - lt_prog_compiler_static_F77 \ - lt_prog_compiler_no_builtin_flag_F77 \ - export_dynamic_flag_spec_F77 \ - thread_safe_flag_spec_F77 \ - whole_archive_flag_spec_F77 \ - enable_shared_with_static_runtimes_F77 \ - old_archive_cmds_F77 \ - old_archive_from_new_cmds_F77 \ - predep_objects_F77 \ - postdep_objects_F77 \ - predeps_F77 \ - postdeps_F77 \ - compiler_lib_search_path_F77 \ - archive_cmds_F77 \ - archive_expsym_cmds_F77 \ - postinstall_cmds_F77 \ - postuninstall_cmds_F77 \ - old_archive_from_expsyms_cmds_F77 \ - allow_undefined_flag_F77 \ - no_undefined_flag_F77 \ - export_symbols_cmds_F77 \ - hardcode_libdir_flag_spec_F77 \ - hardcode_libdir_flag_spec_ld_F77 \ - hardcode_libdir_separator_F77 \ - hardcode_automatic_F77 \ - module_cmds_F77 \ - module_expsym_cmds_F77 \ - lt_cv_prog_compiler_c_o_F77 \ - exclude_expsyms_F77 \ - include_expsyms_F77; do - - case $var in - old_archive_cmds_F77 | \ - old_archive_from_new_cmds_F77 | \ - archive_cmds_F77 | \ - archive_expsym_cmds_F77 | \ - module_cmds_F77 | \ - module_expsym_cmds_F77 | \ - old_archive_from_expsyms_cmds_F77 | \ - export_symbols_cmds_F77 | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_F77 - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_F77 - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_F77 - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_F77 - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_F77 - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_F77 -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_F77 - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_F77 -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_F77 -archive_expsym_cmds=$lt_archive_expsym_cmds_F77 -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_F77 -module_expsym_cmds=$lt_module_expsym_cmds_F77 - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_F77 - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_F77 - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_F77 - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_F77 - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_F77 - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_F77 - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_F77 - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_F77 - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_F77 - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_F77 - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_F77" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_F77 - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_F77 - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_F77 - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_F77 - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - - - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -objext_GCJ=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -compiler_GCJ=$CC - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -archive_cmds_need_lc_GCJ=no - - -lt_prog_compiler_no_builtin_flag_GCJ= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' - - -echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15762: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:15766: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl_GCJ= -lt_prog_compiler_pic_GCJ= -lt_prog_compiler_static_GCJ= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_static_GCJ='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_GCJ='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_GCJ=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_GCJ=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_GCJ='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - else - lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic_GCJ='-qnocommon' - lt_prog_compiler_wl_GCJ='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-static' - ;; - ccc*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_GCJ='-Kpic' - lt_prog_compiler_static_GCJ='-dn' - ;; - - solaris*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl_GCJ='-Qoption ld ' - lt_prog_compiler_pic_GCJ='-PIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_GCJ='-Kconform_pic' - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - uts4*) - lt_prog_compiler_pic_GCJ='-pic' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_GCJ=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_GCJ"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_GCJ=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_GCJ" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16005: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:16009: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_GCJ=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 - -if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then - case $lt_prog_compiler_pic_GCJ in - "" | " "*) ;; - *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; - esac -else - lt_prog_compiler_pic_GCJ= - lt_prog_compiler_can_build_shared_GCJ=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_GCJ= - ;; - *) - lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_GCJ=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16065: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:16069: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_GCJ=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag_GCJ= - enable_shared_with_static_runtimes_GCJ=no - archive_cmds_GCJ= - archive_expsym_cmds_GCJ= - old_archive_From_new_cmds_GCJ= - old_archive_from_expsyms_cmds_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= - thread_safe_flag_spec_GCJ= - hardcode_libdir_flag_spec_GCJ= - hardcode_libdir_flag_spec_ld_GCJ= - hardcode_libdir_separator_GCJ= - hardcode_direct_GCJ=no - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=unsupported - link_all_deplibs_GCJ=unknown - hardcode_automatic_GCJ=no - module_cmds_GCJ= - module_expsym_cmds_GCJ= - always_export_symbols_GCJ=no - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_GCJ= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_GCJ=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_GCJ=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_GCJ=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_GCJ='-L$libdir' - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=no - enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - sunos4*) - archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds_GCJ="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_GCJ="$tmp_archive_cmds" - fi - else - ld_shlibs_GCJ=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - esac - - if test "$ld_shlibs_GCJ" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=yes - archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_GCJ=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_GCJ=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_GCJ='' - hardcode_direct_GCJ=yes - hardcode_libdir_separator_GCJ=':' - link_all_deplibs_GCJ=yes - - if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_GCJ=yes - else - # We have old collect2 - hardcode_direct_GCJ=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_GCJ=yes - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_libdir_separator_GCJ= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_GCJ=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_GCJ='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_GCJ="-z nodefs" - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_GCJ=' ${wl}-bernotok' - allow_undefined_flag_GCJ=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_GCJ=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_GCJ=' ' - archive_cmds_need_lc_GCJ=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_GCJ=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_GCJ=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_GCJ=' ' - allow_undefined_flag_GCJ=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_GCJ='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_GCJ=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_GCJ=no - hardcode_direct_GCJ=no - hardcode_automatic_GCJ=yes - hardcode_shlibpath_var_GCJ=unsupported - whole_archive_flag_spec_GCJ='' - link_all_deplibs_GCJ=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_GCJ=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - freebsd1*) - ld_shlibs_GCJ=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - ;; - ia64*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - *) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - link_all_deplibs_GCJ=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - newsos6) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_shlibpath_var_GCJ=no - ;; - - openbsd*) - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - ;; - *) - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - allow_undefined_flag_GCJ=unsupported - archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_GCJ='-rpath $libdir' - fi - hardcode_libdir_separator_GCJ=: - ;; - - sco3.2v5*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_GCJ=' -z text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_shlibpath_var_GCJ=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs_GCJ=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_GCJ='$CC -r -o $output$reload_objs' - hardcode_direct_GCJ=no - ;; - motorola) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4.3*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_GCJ=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_GCJ='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv5*) - no_undefined_flag_GCJ=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_GCJ= - hardcode_shlibpath_var_GCJ=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - *) - ld_shlibs_GCJ=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 -echo "${ECHO_T}$ld_shlibs_GCJ" >&6 -test "$ld_shlibs_GCJ" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_GCJ" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_GCJ=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_GCJ in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_GCJ - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ - allow_undefined_flag_GCJ= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_GCJ=no - else - archive_cmds_need_lc_GCJ=yes - fi - allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_GCJ= -if test -n "$hardcode_libdir_flag_spec_GCJ" || \ - test -n "$runpath_var_GCJ" || \ - test "X$hardcode_automatic_GCJ" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_GCJ" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && - test "$hardcode_minus_L_GCJ" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_GCJ=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_GCJ=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_GCJ=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 -echo "${ECHO_T}$hardcode_action_GCJ" >&6 - -if test "$hardcode_action_GCJ" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* 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 shl_load (); -/* 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_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* 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 dlopen (); -/* 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_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - fi - ;; - esac - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_GCJ \ - CC_GCJ \ - LD_GCJ \ - lt_prog_compiler_wl_GCJ \ - lt_prog_compiler_pic_GCJ \ - lt_prog_compiler_static_GCJ \ - lt_prog_compiler_no_builtin_flag_GCJ \ - export_dynamic_flag_spec_GCJ \ - thread_safe_flag_spec_GCJ \ - whole_archive_flag_spec_GCJ \ - enable_shared_with_static_runtimes_GCJ \ - old_archive_cmds_GCJ \ - old_archive_from_new_cmds_GCJ \ - predep_objects_GCJ \ - postdep_objects_GCJ \ - predeps_GCJ \ - postdeps_GCJ \ - compiler_lib_search_path_GCJ \ - archive_cmds_GCJ \ - archive_expsym_cmds_GCJ \ - postinstall_cmds_GCJ \ - postuninstall_cmds_GCJ \ - old_archive_from_expsyms_cmds_GCJ \ - allow_undefined_flag_GCJ \ - no_undefined_flag_GCJ \ - export_symbols_cmds_GCJ \ - hardcode_libdir_flag_spec_GCJ \ - hardcode_libdir_flag_spec_ld_GCJ \ - hardcode_libdir_separator_GCJ \ - hardcode_automatic_GCJ \ - module_cmds_GCJ \ - module_expsym_cmds_GCJ \ - lt_cv_prog_compiler_c_o_GCJ \ - exclude_expsyms_GCJ \ - include_expsyms_GCJ; do - - case $var in - old_archive_cmds_GCJ | \ - old_archive_from_new_cmds_GCJ | \ - archive_cmds_GCJ | \ - archive_expsym_cmds_GCJ | \ - module_cmds_GCJ | \ - module_expsym_cmds_GCJ | \ - old_archive_from_expsyms_cmds_GCJ | \ - export_symbols_cmds_GCJ | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_GCJ - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_GCJ - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_GCJ - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_GCJ - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_GCJ - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_GCJ -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_GCJ - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_GCJ -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_GCJ -archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_GCJ -module_expsym_cmds=$lt_module_expsym_cmds_GCJ - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_GCJ - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_GCJ - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_GCJ - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_GCJ - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_GCJ - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_GCJ - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_GCJ - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_GCJ - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_GCJ - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_GCJ" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_GCJ - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_GCJ - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_GCJ - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_GCJ - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - RC) - - - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -objext_RC=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -compiler_RC=$CC -lt_cv_prog_compiler_c_o_RC=yes - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_RC \ - CC_RC \ - LD_RC \ - lt_prog_compiler_wl_RC \ - lt_prog_compiler_pic_RC \ - lt_prog_compiler_static_RC \ - lt_prog_compiler_no_builtin_flag_RC \ - export_dynamic_flag_spec_RC \ - thread_safe_flag_spec_RC \ - whole_archive_flag_spec_RC \ - enable_shared_with_static_runtimes_RC \ - old_archive_cmds_RC \ - old_archive_from_new_cmds_RC \ - predep_objects_RC \ - postdep_objects_RC \ - predeps_RC \ - postdeps_RC \ - compiler_lib_search_path_RC \ - archive_cmds_RC \ - archive_expsym_cmds_RC \ - postinstall_cmds_RC \ - postuninstall_cmds_RC \ - old_archive_from_expsyms_cmds_RC \ - allow_undefined_flag_RC \ - no_undefined_flag_RC \ - export_symbols_cmds_RC \ - hardcode_libdir_flag_spec_RC \ - hardcode_libdir_flag_spec_ld_RC \ - hardcode_libdir_separator_RC \ - hardcode_automatic_RC \ - module_cmds_RC \ - module_expsym_cmds_RC \ - lt_cv_prog_compiler_c_o_RC \ - exclude_expsyms_RC \ - include_expsyms_RC; do - - case $var in - old_archive_cmds_RC | \ - old_archive_from_new_cmds_RC | \ - archive_cmds_RC | \ - archive_expsym_cmds_RC | \ - module_cmds_RC | \ - module_expsym_cmds_RC | \ - old_archive_from_expsyms_cmds_RC | \ - export_symbols_cmds_RC | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_RC - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_RC - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_RC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_RC - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_RC - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_RC -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_RC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_RC -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_RC -archive_expsym_cmds=$lt_archive_expsym_cmds_RC -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_RC -module_expsym_cmds=$lt_module_expsym_cmds_RC - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_RC - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_RC - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_RC - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_RC - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_RC - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_RC - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_RC - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_RC - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_RC - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_RC - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_RC - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_RC" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_RC - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_RC - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_RC - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_RC - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - ;; - - *) - { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 -echo "$as_me: error: Unsupported tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 -echo "$as_me: error: unable to update list of available tagged configurations." >&2;} - { (exit 1); exit 1; }; } - fi -fi @@ -19341,24 +8331,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion - - - - - - - - - - - - - - - - - - # Enable large file support. # Check whether --enable-largefile or --disable-largefile was given. @@ -22716,7 +11688,7 @@ done # Makefiles to be created by configure. - ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile include/ntfs/Makefile libntfs/Makefile libntfs/libntfs.conf libntfs/libntfs-gnomevfs.8 ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" + ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile include/ntfs/Makefile libntfs/Makefile libntfs/libntfs.conf libntfs/libntfs-gnomevfs.8 ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfscp.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -22830,13 +11802,6 @@ 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 -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -23300,6 +12265,7 @@ do "ntfsprogs/ntfscat.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscat.8" ;; "ntfsprogs/ntfsclone.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsclone.8" ;; "ntfsprogs/ntfscluster.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscluster.8" ;; + "ntfsprogs/ntfscp.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscp.8" ;; "ntfsprogs/ntfsfix.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsfix.8" ;; "ntfsprogs/ntfsinfo.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsinfo.8" ;; "ntfsprogs/ntfslabel.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfslabel.8" ;; @@ -23448,23 +12414,11 @@ 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,@EGREP@,$EGREP,;t t s,@ECHO@,$ECHO,;t t -s,@AR@,$AR,;t t -s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;t t -s,@ac_ct_CXX@,$ac_ct_CXX,;t t -s,@CXXDEPMODE@,$CXXDEPMODE,;t t -s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t -s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t -s,@CXXCPP@,$CXXCPP,;t t -s,@F77@,$F77,;t t -s,@FFLAGS@,$FFLAGS,;t t -s,@ac_ct_F77@,$ac_ct_F77,;t t +s,@EGREP@,$EGREP,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t diff --git a/configure.ac b/configure.ac index 8262145e..e855e7b7 100644 --- a/configure.ac +++ b/configure.ac @@ -235,6 +235,7 @@ AC_CONFIG_FILES([ ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 + ntfsprogs/ntfscp.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 diff --git a/doc/Makefile.in b/doc/Makefile.in index 6e22c40d..97b0c337 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.1 from Makefile.am. +# Makefile.in generated by automake 1.9.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -52,7 +52,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -63,10 +62,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -78,8 +73,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -109,18 +102,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/include/Makefile.in b/include/Makefile.in index 6910f183..cfc18177 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.1 from Makefile.am. +# Makefile.in generated by automake 1.9.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -61,7 +61,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -72,10 +71,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -87,8 +82,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -118,18 +111,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index bbd4870e..c55eb7f4 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.1 from Makefile.am. +# Makefile.in generated by automake 1.9.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -65,7 +65,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -76,10 +75,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -91,8 +86,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -122,18 +115,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/install-sh b/install-sh index b777f124..dd97db7a 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-07-05.00 +scriptversion=2004-09-10.20 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -260,7 +260,7 @@ do rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. - trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 70d09650..de68987c 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.1 from Makefile.am. +# Makefile.in generated by automake 1.9.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -107,11 +107,11 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) @@ -127,7 +127,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -138,10 +137,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -153,8 +148,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -184,18 +177,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -418,18 +406,18 @@ distclean-compile: @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c mostlyclean-libtool: -rm -f *.lo diff --git a/ltmain.sh b/ltmain.sh index a6d78e60..239bdefb 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -24,34 +24,6 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -basename="s,^.*/,,g" - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - -# The name of this program: -progname=`echo "$progpath" | $SED $basename` -modename="$progname" - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.5.8 -TIMESTAMP=" (1.1220.2.118 2004/08/07 12:24:38)" - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes. -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. @@ -64,7 +36,7 @@ elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : else # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} + exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then @@ -73,9 +45,22 @@ if test "X$1" = X--fallback-echo; then cat <&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 fi # Global variables. @@ -133,237 +117,8 @@ execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -func_win32_libid () { - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $echo $win32_libid_type -} - - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () { - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case "$@ " in - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit $EXIT_FAILURE -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () { - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - my_status="" - - $show "${rm}r $my_gentop" - $run ${rm}r "$my_gentop" - $show "$mkdir $my_gentop" - $run $mkdir "$my_gentop" - my_status=$? - if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then - exit $my_status - fi - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` - my_xdir="$my_gentop/$my_xlib" - - $show "${rm}r $my_xdir" - $run ${rm}r "$my_xdir" - $show "$mkdir $my_xdir" - $run $mkdir "$my_xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$my_xdir"; then - exit $status - fi - case $host in - *-darwin*) - $show "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - if test -z "$run"; then - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename $darwin_archive` - darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` - if test -n "$darwin_arches"; then - darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - $show "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - # Remove the table of contents from the thin files. - $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true - $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $AR -xo "${darwin_base_archive}" - rm "${darwin_base_archive}" - cd "$darwin_curdir" - done # $darwin_arches - ## Okay now we have a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` - lipo -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - rm -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - (cd $my_xdir && $AR x $my_xabs) || exit $? - fi # $darwin_arches - fi # $run - ;; - *) - # We will extract separately just the conflicting names and we will - # no longer touch any unique names. It is faster to leave these - # extract automatically by $AR in one run. - $show "(cd $my_xdir && $AR x $my_xabs)" - $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? - if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$my_xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} -# End of Shell function definitions -##################################### - -# Darwin sucks -eval std_shrext=\"$shrext_cmds\" - # Parse our command line options once, thoroughly. -while test "$#" -gt 0 +while test $# -gt 0 do arg="$1" shift @@ -379,34 +134,6 @@ do execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; - tag) - tagname="$arg" - preserve_args="${preserve_args}=$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac - ;; *) eval "$prev=\$arg" ;; @@ -424,27 +151,18 @@ do ;; --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2003 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit $EXIT_SUCCESS + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 ;; --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" - done - exit $EXIT_SUCCESS + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + exit 0 ;; --debug) - $echo "$progname: enabling shell trace mode" + echo "$progname: enabling shell trace mode" set -x - preserve_args="$preserve_args $arg" ;; --dry-run | -n) @@ -452,18 +170,18 @@ do ;; --features) - $echo "host: $host" + echo "host: $host" if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" + echo "enable shared libraries" else - $echo "disable shared libraries" + echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - $echo "enable static libraries" + echo "enable static libraries" else - $echo "disable static libraries" + echo "disable static libraries" fi - exit $EXIT_SUCCESS + exit 0 ;; --finish) mode="finish" ;; @@ -475,15 +193,6 @@ do --quiet | --silent) show=: - preserve_args="$preserve_args $arg" - ;; - - --tag) prevopt="--tag" prev=tag ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - preserve_args="$preserve_args --tag" ;; -dlopen) @@ -494,7 +203,7 @@ do -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; *) @@ -507,7 +216,18 @@ done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 +fi + +# Mandrake: (gc) It's bad to link C++ code with GCC, so we need to use the compiler name if provided +if test "$mode" = link && test -n "$archive_cmds" && test -x "/usr/bin/perl"; then + case $nonopt in + *cc | *++ | gcc* | *-gcc* | egcs*) + archive_cmds=`echo $archive_cmds | perl -pe 's/^\S+\s+//'` + archive_cmds="$nonopt $archive_cmds" + archive_expsym_cmds=`echo $archive_expsym_cmds | perl -pe 's/^\S+\s+//'` + archive_expsym_cmds="$nonopt $archive_expsym_cmds" + esac fi # If this variable is set in any of the actions, the command in it @@ -519,10 +239,8 @@ if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + *cc | *++ | gcc* | *-gcc* | xlc*) mode=link for arg do @@ -563,7 +281,7 @@ if test -z "$show_help"; then if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Change the help message to a mode-specific one. @@ -577,154 +295,50 @@ if test -z "$show_help"; then modename="$modename: compile" # Get the compilation command and the source file. base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes + prev= + lastarg= + srcfile="$nonopt" suppress_output= - arg_mode=normal - libobj= - later= + user_target=no for arg do - case "$arg_mode" in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. case $arg in - -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit $EXIT_FAILURE - fi - arg_mode=target - continue + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" ;; + esac - -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else base_compile="$base_compile $lastarg" - continue - ;; - - * ) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" + fi + continue ;; esac - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit $EXIT_FAILURE - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit $EXIT_FAILURE - ;; - *) - # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do + # Accept any command-line options. case $arg in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + -static) build_old_libs=yes continue @@ -739,33 +353,138 @@ if test -z "$show_help"; then pic_mode=no continue ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; esac + + case $user_target in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi done - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi - lobj=${xdir}$objdir/$objname + case $user_target in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" + removelist="$obj $libobj" else - removelist="$lobj $libobj ${libobj}T" + removelist="$libobj" fi $run $rm $removelist - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + trap "$run $rm $removelist; exit 1" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in @@ -784,9 +503,8 @@ if test -z "$show_help"; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + trap "$run $rm $removelist; exit 1" 1 2 15 else - output_obj= need_locks=no lockfile= fi @@ -794,13 +512,13 @@ if test -z "$show_help"; then # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then - until $run ln "$progpath" "$lockfile" 2>/dev/null; do + until $run ln "$0" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then - $echo "\ + echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` @@ -812,67 +530,68 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit $EXIT_FAILURE + exit 1 fi - $echo $srcfile > "$lockfile" + echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -887,13 +606,13 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit $EXIT_FAILURE + exit 1 fi # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : else error=$? $run $rm $removelist @@ -901,23 +620,48 @@ compiler." fi fi - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -959,11 +705,11 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit $EXIT_FAILURE + exit 1 fi # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + if test x"$output_obj" != x"$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else @@ -973,31 +719,29 @@ compiler." fi fi - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T < $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi fi - $run $mv "${libobj}T" "${libobj}" - # Unlock the critical section if it was locked if test "$need_locks" != no; then $run $rm "$lockfile" fi - exit $EXIT_SUCCESS + exit 0 ;; # libtool link mode @@ -1008,7 +752,7 @@ EOF # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. + # flag for every libtool invokation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying @@ -1023,7 +767,6 @@ EOF ;; esac libtool_args="$nonopt" - base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" @@ -1054,8 +797,6 @@ EOF module=no no_install=no objs= - non_pic_objects= - precious_files_regex= prefer_static_libs=no preload=no prev= @@ -1067,9 +808,6 @@ EOF temp_rpath= thread_safe=no vinfo= - vinfo_number=no - - func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg @@ -1100,7 +838,7 @@ EOF test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do + while test $# -gt 0; do arg="$1" shift case $arg in @@ -1165,7 +903,7 @@ EOF export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" - exit $EXIT_FAILURE + exit 1 fi prev= continue @@ -1175,135 +913,23 @@ EOF prev= continue ;; - inst_prefix) + inst_prefix) inst_prefix_dir="$arg" prev= continue ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; release) release="-$arg" prev= continue ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat $save_arg` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - done - else - $echo "$modename: link input file \`$save_arg' does not exist" - exit $EXIT_FAILURE - fi - arg=$save_arg - prev= - continue - ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac if test "$prev" = rpath; then @@ -1335,26 +961,13 @@ EOF finalize_command="$finalize_command $wl$qarg" continue ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac - fi # test -n "$prev" + fi # test -n $prev prevarg="$arg" @@ -1396,7 +1009,7 @@ EOF -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" - exit $EXIT_FAILURE + exit 1 fi if test "X$arg" = "X-export-symbols"; then prev=expsyms @@ -1415,7 +1028,7 @@ EOF # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) + no/*-*-irix* | no/*-*-nonstopux*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; @@ -1432,7 +1045,7 @@ EOF absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi dir="$absdir" ;; @@ -1470,61 +1083,24 @@ EOF # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs -framework System" - continue esac - elif test "X$arg" = "X-lc_r"; then - case $host in + elif test "X$arg" = "X-lc_r"; then + case $host in *-*-openbsd* | *-*-freebsd*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac fi deplibs="$deplibs $arg" continue ;; - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - deplibs="$deplibs $arg" - continue - ;; - -module) module=yes continue ;; - # gcc -m* arguments should be passed to the linker via $compiler_flags - # in order to pass architecture information to the linker - # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. - -m*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi - continue - ;; - - -shrext) - prev=shrext - continue - ;; - -no-fast-install) fast_install=no continue @@ -1549,18 +1125,8 @@ EOF continue ;; - -objectlist) - prev=objectlist - continue - ;; - -o) prev=output ;; - -precious-files-regex) - prev=precious_regex - continue - ;; - -release) prev=release continue @@ -1583,7 +1149,7 @@ EOF [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac case "$xrpath " in @@ -1611,11 +1177,6 @@ EOF prev=vinfo continue ;; - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` @@ -1664,11 +1225,6 @@ EOF continue ;; - -XCClinker) - prev=xcclinker - continue - ;; - # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need @@ -1681,102 +1237,30 @@ EOF esac ;; - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + prev= + continue else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles fi fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + fi ;; *.$libext) @@ -1826,7 +1310,7 @@ EOF if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then @@ -1835,7 +1319,6 @@ EOF finalize_command="$finalize_command $arg" fi - oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" @@ -1856,11 +1339,11 @@ EOF output_objdir="$output_objdir/$objdir" fi # Create the object directory. - if test ! -d "$output_objdir"; then + if test ! -d $output_objdir; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then + if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi @@ -1870,7 +1353,7 @@ EOF "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; @@ -1878,17 +1361,7 @@ EOF *) linkmode=prog ;; # Anything else should be a program. esac - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplications in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - esac specialdeplibs= - libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) @@ -1900,25 +1373,6 @@ EOF fi libs="$libs $deplib" done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - deplibs= newdependency_libs= newlib_search_path= @@ -1933,7 +1387,7 @@ EOF *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac done @@ -1950,59 +1404,39 @@ EOF ;; esac for pass in $passes; do - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then + if test $linkmode = prog; then + # Determine which files to process case $pass in - dlopen) libs="$dlfiles" ;; + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi for deplib in $libs; do lib= found=no case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - fi - continue - ;; -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + if test $linkmode = oldlib && test $linkmode = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 continue fi - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi done if test "$found" != yes; then # deplib doesn't seem to be a libtool library @@ -2011,76 +1445,40 @@ EOF finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" fi continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - library_names= - old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" - test "$pass" = conv && continue + test $pass = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi - if test "$pass" = scan; then + if test $pass = scan; then deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 ;; esac # linkmode continue ;; # -L -R*) - if test "$pass" = link; then + if test $pass = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in @@ -2093,45 +1491,30 @@ EOF ;; *.la) lib="$deplib" ;; *.$libext) - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - if eval $echo \"$deplib\" 2>/dev/null \ - | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - $echo - $echo "*** Warning: Trying to link with static lib archive $deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because the file extensions .$libext of this argument makes me believe" - $echo "*** that it is just a static archive that I should not used here." + if test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not used here." else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) - if test "$pass" != link; then + if test $pass != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -2142,18 +1525,14 @@ EOF esac # linkmode ;; # *.$libext *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi + if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" fi continue ;; @@ -2162,17 +1541,17 @@ EOF continue ;; esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : + if test $found = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` @@ -2185,9 +1564,8 @@ EOF library_names= old_library= # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink + # it will not redefine variable installed. installed=yes - shouldnotlink=no # Read the .la file case $lib in @@ -2197,18 +1575,19 @@ EOF if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then + { test $linkmode = oldlib && test $linkmode = obj; }; then + # Add dl[pre]opened files of deplib test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi - if test "$pass" = conv; then + if test $pass = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" @@ -2223,14 +1602,13 @@ EOF fi tmp_libs="$tmp_libs $deplib" done - elif test "$linkmode" != prog && test "$linkmode" != lib; then + elif test $linkmode != prog && test $linkmode != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit $EXIT_FAILURE + exit 1 fi continue fi # $pass = conv - # Get the name of the library we link against. linklib= for l in $old_library $library_names; do @@ -2238,23 +1616,19 @@ EOF done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # This library was specified with -dlopen. - if test "$pass" = dlopen; then + if test $pass = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" + # statically, we need to preload. + dlprefiles="$dlprefiles $lib" else newdlfiles="$newdlfiles $lib" fi @@ -2287,25 +1661,18 @@ EOF absdir="$libdir" fi else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then + if test $pass = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). @@ -2321,19 +1688,18 @@ EOF if test -z "$libdir"; then # Link the convenience library - if test "$linkmode" = lib; then + if test $linkmode = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else - deplibs="$lib $deplibs" # used for prog,scan pass + deplibs="$lib $deplibs" fi continue fi - - if test "$linkmode" = prog && test "$pass" != link; then + if test $linkmode = prog && test $pass != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" @@ -2349,7 +1715,7 @@ EOF -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then + if test $linkalldeplibs = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths @@ -2366,19 +1732,13 @@ EOF continue fi # $linkmode = prog... - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + if test "$linkmode,$pass" = "prog,link" || + { test $linkmode = lib && test $hardcode_into_libs = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. @@ -2400,6 +1760,17 @@ EOF esac ;; esac + if test $linkmode = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && @@ -2409,52 +1780,11 @@ EOF # We only need to search for static libraries continue fi - fi - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi - # This is a shared library - - # Warn about portability, can't link against -module's on - # some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then - $echo - if test "$linkmode" = prog; then - $echo "*** Warning: Linking the executable $output against the loadable module" - else - $echo "*** Warning: Linking the shared library $output against the loadable module" - fi - $echo "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname @@ -2468,7 +1798,7 @@ EOF elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin* | mingw*) + *cygwin*) major=`expr $current - $age` versuffix="-$major" ;; @@ -2480,18 +1810,17 @@ EOF # Make a new name for the extract_expsyms_cmds to use soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + soname=`echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' - cmds=$extract_expsyms_cmds + eval cmds=\"$extract_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -2502,10 +1831,9 @@ EOF if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' - cmds=$old_archive_from_expsyms_cmds + eval cmds=\"$old_archive_from_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -2514,9 +1842,9 @@ EOF # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" + fi # test -n $old_archive_from_expsyms_cmds - if test "$linkmode" = prog || test "$mode" != relink; then + if test $linkmode = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= @@ -2525,22 +1853,6 @@ EOF immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" - case $host in - *-*-sco3.2v5* ) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a module then we can not link against - # it, someone is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then - $echo "** Warning, lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $echo - $echo "** And there doesn't seem to be a static archive available" - $echo "** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - fi - esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; @@ -2559,14 +1871,6 @@ EOF add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" @@ -2580,7 +1884,7 @@ EOF if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" - exit $EXIT_FAILURE + exit 1 fi if test -n "$add_shlibpath"; then @@ -2589,7 +1893,7 @@ EOF *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi - if test "$linkmode" = prog; then + if test $linkmode = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else @@ -2606,8 +1910,9 @@ EOF fi fi - if test "$linkmode" = prog || test "$mode" = relink; then + if test $linkmode = prog || test "$mode" = relink; then add_shlibpath= + add_prefix_dir= add_dir= add= # Finalize command for both is simple: just hardcode it. @@ -2622,36 +1927,43 @@ EOF *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi add="-l$name" fi - if test "$linkmode" = prog; then + + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_prefix_dir="-L$inst_prefix_dir$libdir" + ;; + esac + fi + + # add_prefix_dir must be appended instead, otherwise it can + # possibly be overrided by any hardcoded -L/... path in deplibs + if test $linkmode = prog; then + test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir" test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else + test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir" test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi - elif test "$linkmode" = prog; then + elif test $linkmode = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + # Try to link the static library # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. @@ -2671,21 +1983,21 @@ EOF # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." + echo + echo "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -2702,11 +2014,10 @@ EOF fi fi # link shared/static library? - if test "$linkmode" = lib; then + if test $linkmode = lib; then if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then + { test $hardcode_into_libs != yes || test $build_old_libs = yes || + test $link_static = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do @@ -2737,7 +2048,7 @@ EOF tmp_libs="$tmp_libs $deplib" done - if test "$link_all_deplibs" != no; then + if test $link_all_deplibs != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in @@ -2757,67 +2068,22 @@ EOF ;; esac if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" + path="-L$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi - path="$absdir" + path="-L$absdir" fi - depdepl= - case $host in - *-*-darwin*) - # we do not want to link against static libs, - # but need to link against shared - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$path/$depdepl" ; then - depdepl="$path/$depdepl" - fi - # do not add paths which are already there - case " $newlib_search_path " in - *" $path "*) ;; - *) newlib_search_path="$newlib_search_path $path";; - esac - fi - path="" - ;; - *) - path="-L$path" - ;; - esac - ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac ;; *) continue ;; esac case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; - esac - case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac @@ -2825,15 +2091,15 @@ EOF fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then + if test $pass = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then + if test $pass != dlopen; then + test $pass != scan && dependency_libs="$newdependency_libs" + if test $pass != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do @@ -2855,30 +2121,9 @@ EOF eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) @@ -2906,32 +2151,19 @@ EOF eval $var=\"$tmp_libs\" done # for var fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi done # for pass - if test "$linkmode" = prog; then + if test $linkmode = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi @@ -2945,7 +2177,7 @@ EOF fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 fi if test -n "$release"; then @@ -2967,19 +2199,17 @@ EOF case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` @@ -2990,11 +2220,11 @@ EOF if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit $EXIT_FAILURE + exit 1 else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi @@ -3004,7 +2234,7 @@ EOF fi set dummy $rpath - if test "$#" -gt 2; then + if test $# -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" @@ -3013,16 +2243,14 @@ EOF if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. + libext=al oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then @@ -3038,82 +2266,45 @@ EOF if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$2" - number_minor="$3" - number_revision="$4" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows) - current=`expr $number_major + $number_minor` - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - current=`expr $number_major + $number_minor - 1` - age="$number_minor" - revision="$number_minor" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - esac + current="$2" + revision="$3" + age="$4" # Check that each of the things are valid numbers. case $current in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac case $revision in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac case $age in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac - if test "$age" -gt "$current"; then + if test $age -gt $current; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Calculate the version variables. @@ -3130,7 +2321,7 @@ EOF versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` - verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) @@ -3154,7 +2345,7 @@ EOF # Add in all the interfaces that we are compatible with. loop=$revision - while test "$loop" -ne 0; do + while test $loop != 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" @@ -3177,7 +2368,7 @@ EOF # Add in all the interfaces that we are compatible with. loop=$age - while test "$loop" -ne 0; do + while test $loop != 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" @@ -3201,19 +2392,20 @@ EOF *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= + verstring="0.0" case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely - verstring= + verstring="" ;; *) verstring="0.0" @@ -3247,30 +2439,9 @@ EOF fi if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$echo "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - removelist="$removelist $p" - ;; - *) ;; - esac - done - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi + # Remove our outputs. + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* fi # Now set the variables for building old libraries. @@ -3283,9 +2454,9 @@ EOF # Eliminate all temporary directories. for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then @@ -3298,7 +2469,7 @@ EOF *) finalize_rpath="$finalize_rpath $libdir" ;; esac done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + if test $hardcode_into_libs != yes || test $build_old_libs = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi @@ -3338,11 +2509,10 @@ EOF ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue ;; - *) + *) # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then + if test $build_libtool_need_lc = "yes"; then deplibs="$deplibs -lc" fi ;; @@ -3369,7 +2539,7 @@ EOF # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. + # implementing what was already the behaviour. newdeplibs=$deplibs ;; test_compile) @@ -3382,22 +2552,45 @@ EOF int main() { return 0; } EOF $rm conftest - $LTCC -o conftest conftest.c $deplibs - if test "$?" -eq 0 ; then + $CC -o conftest conftest.c $deplibs + if test $? -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do name="`expr $i : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" -ne "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + echo + echo "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which I believe you do not have" + echo "*** because a test_compile did reveal that the linker did not use it for" + echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occured in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + $rm conftest + $CC -o conftest conftest.c $i + # Did it work? + if test $? -eq 0 ; then + ldd_output=`ldd conftest` libname=`eval \\$echo \"$libname_spec\"` deplib_matches=`eval \\$echo \"$library_names_spec\"` set dummy $deplib_matches @@ -3406,64 +2599,21 @@ EOF newdeplibs="$newdeplibs $i" else droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which I believe you do not have" - $echo "*** because a test_compile did reveal that the linker did not use it for" - $echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occurred in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - $rm conftest - $LTCC -o conftest conftest.c $i - # Did it work? - if test "$?" -eq 0 ; then - ldd_output=`ldd conftest` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because a test_compile did reveal that the linker did not use this one" - $echo "*** as a dynamic dependency that programs can get resolved with at runtime." - fi + echo + echo "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because a test_compile did reveal that the linker did not use this one" + echo "*** as a dynamic dependency that programs can get resolved with at runtime." fi else droppeddeps=yes - $echo - $echo "*** Warning! Library $i is needed by this library but I was not able to" - $echo "*** make it link in! You will probably need to install it or some" - $echo "*** library that it depends on before this library will be fully" - $echo "*** functional. Installing it before continuing would be even better." + echo + echo "*** Warning! Library $i is needed by this library but I was not able to" + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." fi else newdeplibs="$newdeplibs $i" @@ -3477,20 +2627,11 @@ EOF for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then @@ -3509,29 +2650,35 @@ EOF *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done + # It is ok to link against an archive when + # building a shared library. + if $AR -t $potlib > /dev/null 2>&1; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then + | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi - done - done - fi + done + done if test -n "$a_deplib" ; then droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" + echo + echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" + echo "*** with $libname but no candidates were found. (...for file magic test)" else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a file magic. Last file checked: $potlib" fi fi else @@ -3547,43 +2694,33 @@ EOF name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval $echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check below in file_magic test + if eval echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | egrep "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi done - fi + done if test -n "$a_deplib" ; then droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" + echo + echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + echo "*** with $libname but no candidates were found. (...for regex pattern test)" else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a regex pattern. Last file checked: $potlib" fi fi else @@ -3594,23 +2731,16 @@ EOF ;; none | unknown | *) newdeplibs="" - tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` - done - fi - if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ - | grep . >/dev/null; then - $echo + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo if test "X$deplibs_check_method" = "Xnone"; then - $echo "*** Warning: inter-library dependencies are not supported in this platform." + echo "*** Warning: inter-library dependencies are not supported in this platform." else - $echo "*** Warning: inter-library dependencies are not known to be supported." + echo "*** Warning: inter-library dependencies are not known to be supported." fi - $echo "*** All declared inter-library dependencies are being dropped." + echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; @@ -3630,17 +2760,17 @@ EOF if test "$droppeddeps" = yes; then if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -3650,16 +2780,16 @@ EOF build_libtool_libs=no fi else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." - if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." + if test $allow_undefined = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -3681,7 +2811,7 @@ EOF # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then + if test $hardcode_into_libs = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= @@ -3717,11 +2847,7 @@ EOF if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi + eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. @@ -3741,7 +2867,6 @@ EOF fi # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" @@ -3752,9 +2877,7 @@ EOF else soname="$realname" fi - if test -z "$dlname"; then - dlname=$soname - fi + test -z "$dlname" && dlname=$soname lib="$output_objdir/$realname" for link @@ -3762,6 +2885,23 @@ EOF linknames="$linknames $link" done + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -3771,26 +2911,17 @@ EOF $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols - cmds=$export_symbols_cmds + eval cmds=\"$export_symbols_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false - else - # The command line is too long to execute in one step. - $show "using reloadable object file for export list..." - skipped_export=: - fi + $show "$cmd" + $run eval "$cmd" || exit $? done IFS="$save_ifs" if test -n "$export_symbols_regex"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi @@ -3801,30 +2932,46 @@ EOF $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi generated="$generated $gentop" - func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done fi fi - + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" @@ -3836,147 +2983,25 @@ EOF fi # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds + eval cmds=\"$archive_expsym_cmds\" else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise. - $echo "creating reloadable object files..." - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - delfiles= - last_robj= - k=1 - output=$output_objdir/$save_output-${k}.$objext - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - eval test_cmds=\"$reload_cmds $objlist $last_robj\" - if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; }; then - objlist="$objlist $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" - else - # All subsequent reloadable object files will link in - # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + save_deplibs="$deplibs" + for conv in $convenience; do + tmp_deplibs= + for test_deplib in $deplibs; do + if test "$test_deplib" != "$conv"; then + tmp_deplibs="$tmp_deplibs $test_deplib" fi - last_robj=$output_objdir/$save_output-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$save_output-${k}.$objext - objlist=$obj - len=1 - fi + done + deplibs="$tmp_deplibs" done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" - - if ${skipped_export-false}; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - libobjs=$output - # Append the command to create the export file. - eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" - fi - - # Set up a command to remove the reloadale object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" - done - - $echo "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~\$rm $delfiles\" + eval cmds=\"$archive_cmds\" + deplibs="$save_deplibs" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3985,7 +3010,7 @@ EOF # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - exit $EXIT_SUCCESS + exit 0 fi # Create links to the real library. @@ -4033,7 +3058,7 @@ EOF *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit $EXIT_FAILURE + exit 1 fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` @@ -4062,10 +3087,38 @@ EOF eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi generated="$generated $gentop" - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done fi fi @@ -4073,11 +3126,10 @@ EOF reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" - cmds=$reload_cmds + eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4090,7 +3142,7 @@ EOF $run ${rm}r $gentop fi - exit $EXIT_SUCCESS + exit 0 fi if test "$build_libtool_libs" != yes; then @@ -4101,24 +3153,37 @@ EOF # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" - cmds=$reload_cmds + eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then @@ -4126,12 +3191,12 @@ EOF $run ${rm}r $gentop fi - exit $EXIT_SUCCESS + exit 0 ;; prog) case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 @@ -4153,19 +3218,16 @@ EOF # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + ;; + esac ;; esac - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - if test "$tagname" = CXX ; then - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - fi - ;; - esac - compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -4316,12 +3378,12 @@ extern \"C\" { done if test -n "$exclude_expsyms"; then - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi @@ -4339,8 +3401,8 @@ extern \"C\" { for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' + name=`echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done @@ -4349,7 +3411,7 @@ extern \"C\" { test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi @@ -4369,7 +3431,7 @@ extern \"C\" { if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" + echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ @@ -4421,18 +3483,18 @@ static const void *lt_preloaded_setup() { *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; esac esac # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" @@ -4444,7 +3506,7 @@ static const void *lt_preloaded_setup() { ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac else @@ -4457,7 +3519,7 @@ static const void *lt_preloaded_setup() { finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + if test $need_relink = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" @@ -4532,7 +3594,7 @@ static const void *lt_preloaded_setup() { # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? - exit $EXIT_SUCCESS + exit 0 fi if test "$hardcode_action" = relink; then @@ -4587,10 +3649,10 @@ static const void *lt_preloaded_setup() { fi # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case $0 in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else @@ -4602,230 +3664,15 @@ static const void *lt_preloaded_setup() { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in - *cygwin*) - exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *cygwin*) exeext=.exe ;; *) exeext= ;; esac - case $host in - *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${output}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - cat > $cwrappersource <> $cwrappersource<<"EOF" -#include -#include -#include -#include -#include -#include - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -#define HAVE_DOS_BASED_FILE_SYSTEM -#ifndef DIR_SEPARATOR_2 -#define DIR_SEPARATOR_2 '\\' -#endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup ((char *) basename (argv[0])); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" -} - -void * -xmalloc (size_t num) -{ - void * p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -; -} - -char * -basename (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return (char *) base; -} - -char * -fnqualify(const char *path) -{ - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; - - assert(path != NULL); - - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); -#endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); - - /* prepend the current directory */ - /* doesn't handle '~' */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; -} - -char * -strendzap(char *str, const char *pat) -{ - size_t len, patlen; - - assert(str != NULL); - assert(pat != NULL); - - len = strlen(str); - patlen = strlen(pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp(str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char * mode, - const char * message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC -s -o $cwrapper $cwrappersource - ;; - esac $rm $output - trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + trap "$rm $output; exit 1" 1 2 15 $echo > $output "\ #! $SHELL @@ -4841,12 +3688,12 @@ EOF # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' +Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi relink_command=\"$relink_command\" @@ -4901,7 +3748,7 @@ else " if test "$fast_install" = yes; then - $echo >> $output "\ + echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" @@ -4917,7 +3764,7 @@ else $rm \"\$progdir/\$file\" fi" - $echo >> $output "\ + echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then @@ -4925,7 +3772,7 @@ else else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" - exit $EXIT_FAILURE + exit 1 fi fi @@ -4935,13 +3782,13 @@ else $rm \"\$progdir/\$file\" fi" else - $echo >> $output "\ + echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi - $echo >> $output "\ + echo >> $output "\ if test -f \"\$progdir/\$program\"; then" @@ -4952,7 +3799,7 @@ else $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed + # The second colon is a workaround for a bug in BeOS R4 ${SED} $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var @@ -4972,6 +3819,14 @@ else # Run the actual program with our arguments. " case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ @@ -4981,26 +3836,30 @@ else *) $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit $EXIT_FAILURE + exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit $EXIT_FAILURE + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 fi fi\ " chmod +x $output fi - exit $EXIT_SUCCESS + exit 0 ;; esac @@ -5016,86 +3875,74 @@ fi\ oldobjs="$libobjs_save" build_libtool_libs=no else - oldobjs="$old_deplibs $non_pic_objects" + oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi generated="$generated $gentop" - func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds + eval cmds=\"$old_archive_from_new_cmds\" else - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - for obj in $save_oldobjs - do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; then - : + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= + xdir="$xdir" fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? fi - fi + done + + eval cmds=\"$old_archive_cmds\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do - eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? @@ -5127,12 +3974,8 @@ fi\ fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - # Only create the output if not a dry run. if test -z "$run"; then @@ -5151,7 +3994,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi newdependency_libs="$newdependency_libs $libdir/$name" ;; @@ -5165,7 +4008,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi newdlfiles="$newdlfiles $libdir/$name" done @@ -5176,36 +4019,17 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles="$newdlfiles $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles="$newdlprefiles $abs" - done - dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file @@ -5234,16 +4058,13 @@ revision=$revision # Is this an already installed library? installed=$installed -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then + if test "$installed" = no && test $need_relink = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi @@ -5256,7 +4077,7 @@ relink_command=\"$relink_command\"" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac - exit $EXIT_SUCCESS + exit 0 ;; # libtool install mode @@ -5345,13 +4166,13 @@ relink_command=\"$relink_command\"" if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test -z "$files"; then @@ -5361,7 +4182,7 @@ relink_command=\"$relink_command\"" $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Strip any trailing slash from the destination. @@ -5379,10 +4200,10 @@ relink_command=\"$relink_command\"" # Not a directory, so check to see that there is only one file specified. set dummy $files - if test "$#" -gt 2; then + if test $# -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi fi case $destdir in @@ -5394,7 +4215,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac done @@ -5419,11 +4240,11 @@ relink_command=\"$relink_command\"" *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi library_names= @@ -5455,24 +4276,21 @@ relink_command=\"$relink_command\"" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 @@ -5480,7 +4298,7 @@ relink_command=\"$relink_command\"" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit $EXIT_FAILURE + continue fi fi @@ -5502,7 +4320,7 @@ relink_command=\"$relink_command\"" $run eval "$striplib $destdir/$realname" || exit $? fi - if test "$#" -gt 0; then + if test $# -gt 0; then # Delete the old symlinks, and create new ones. for linkname do @@ -5515,11 +4333,10 @@ relink_command=\"$relink_command\"" # Do each command in the postinstall commands. lib="$destdir/$realname" - cmds=$postinstall_cmds + eval cmds=\"$postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -5559,7 +4376,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac @@ -5577,7 +4394,7 @@ relink_command=\"$relink_command\"" $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi - exit $EXIT_SUCCESS + exit 0 ;; *) @@ -5589,49 +4406,29 @@ relink_command=\"$relink_command\"" destfile="$destdir/$destfile" fi - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + wrapper=`echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac # If there is no directory component, then add one. case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi finalize=yes @@ -5653,17 +4450,10 @@ relink_command=\"$relink_command\"" done relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac # If there is no directory component, then add one. case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; esac outputname= @@ -5671,17 +4461,17 @@ relink_command=\"$relink_command\"" if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - save_umask=`umask` - umask 0077 - if $mkdir "$tmpdir"; then - umask $save_umask + tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` + if test $? = 0 ; then : + else + tmpdir="$tmpdir/libtool-$$" + fi + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : else - umask $save_umask $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` @@ -5699,14 +4489,14 @@ relink_command=\"$relink_command\"" fi else # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in - */usr/bin/install*,*cygwin*) + /usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok @@ -5715,7 +4505,7 @@ relink_command=\"$relink_command\"" destfile=$destfile.exe ;; *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; @@ -5736,17 +4526,16 @@ relink_command=\"$relink_command\"" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? - if test -n "$stripme" && test -n "$old_striplib"; then + if test -n "$stripme" && test -n "$striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. - cmds=$old_postinstall_cmds + eval cmds=\"$old_postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -5760,9 +4549,9 @@ relink_command=\"$relink_command\"" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + exec_cmd='$SHELL $0 --finish$current_libdirs' else - exit $EXIT_SUCCESS + exit 0 fi ;; @@ -5781,11 +4570,10 @@ relink_command=\"$relink_command\"" for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. - cmds=$finish_cmds + eval cmds=\"$finish_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" @@ -5802,43 +4590,43 @@ relink_command=\"$relink_command\"" fi # Exit here if they wanted silent mode. - test "$show" = : && exit $EXIT_SUCCESS + test "$show" = ":" && exit 0 - $echo "----------------------------------------------------------------------" - $echo "Libraries have been installed in:" + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" for libdir in $libdirs; do - $echo " $libdir" + echo " $libdir" done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" fi if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" - $echo " - use the \`$flag' linker flag" + echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" + echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" - exit $EXIT_SUCCESS + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 ;; # libtool execute mode @@ -5850,7 +4638,7 @@ relink_command=\"$relink_command\"" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" - exit $EXIT_FAILURE + exit 1 fi # Handle -dlopen flags immediately. @@ -5858,18 +4646,18 @@ relink_command=\"$relink_command\"" if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi dir= case $file in *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Read the libtool library. @@ -5896,7 +4684,7 @@ relink_command=\"$relink_command\"" dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi ;; @@ -5936,7 +4724,7 @@ relink_command=\"$relink_command\"" -*) ;; *) # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; @@ -5959,7 +4747,7 @@ relink_command=\"$relink_command\"" eval "export $shlibpath_var" fi - # Restore saved environment variables + # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi @@ -5968,15 +4756,15 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\"\$cmd\"$args" + exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - eval \$echo \"\$cmd\"$args - exit $EXIT_SUCCESS + $echo "$cmd$args" + exit 0 fi ;; @@ -6004,25 +4792,24 @@ relink_command=\"$relink_command\"" if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi rmdirs= - origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. - objdir="$origobjdir" + objdir="$objdir" else - objdir="$dir/$origobjdir" + objdir="$dir/$objdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" + test $mode = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then + if test $mode = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; @@ -6046,7 +4833,7 @@ relink_command=\"$relink_command\"" case $name in *.la) # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. @@ -6054,19 +4841,18 @@ relink_command=\"$relink_command\"" rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - if test "$mode" = uninstall; then + if test $mode = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. - cmds=$postuninstall_cmds + eval cmds=\"$postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then + if test $? != 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -6075,14 +4861,13 @@ relink_command=\"$relink_command\"" if test -n "$old_library"; then # Do each command in the old_postuninstall commands. - cmds=$old_postuninstall_cmds + eval cmds=\"$old_postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then + if test $? != 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -6094,52 +4879,22 @@ relink_command=\"$relink_command\"" ;; *.lo) - # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - - # Read the .lo file - . $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" \ - && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" \ - && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" fi ;; *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename + # Do a test to see if this is a libtool program. + if test $mode = clean && + (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" fi fi ;; @@ -6147,7 +4902,6 @@ relink_command=\"$relink_command\"" $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done - objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -6163,20 +4917,20 @@ relink_command=\"$relink_command\"" "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd - exit $EXIT_FAILURE + exit 1 fi # We need to display help for each of the modes. @@ -6195,7 +4949,6 @@ Provide generalized library-building support services. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: @@ -6209,10 +4962,8 @@ MODE must be one of the following: uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to ." - exit $EXIT_SUCCESS +a more detailed description of MODE." + exit 0 ;; clean) @@ -6323,9 +5074,6 @@ The following components of LINK-COMMAND are treated specially: -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries @@ -6367,34 +5115,14 @@ Otherwise, only FILE itself is deleted using RM." *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac -$echo +echo $echo "Try \`$modename --help' for more information about other modes." -exit $EXIT_SUCCESS - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static +exit 0 # Local Variables: # mode:shell-script diff --git a/missing b/missing index e7ef83a1..64b5f901 100755 --- a/missing +++ b/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2003-09-02.23 +scriptversion=2004-09-07.08 -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. @@ -60,11 +60,6 @@ case "$1" in msg="probably too old" fi ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in -h|--h|--he|--hel|--help) echo "\ @@ -92,10 +87,12 @@ Supported PROGRAM values: yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." + exit 0 ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" + exit 0 ;; -*) @@ -104,12 +101,42 @@ Send bug reports to ." exit 1 ;; - aclocal*) +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 fi + ;; +esac +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want @@ -119,11 +146,6 @@ WARNING: \`$1' is $msg. You should only need it if ;; autoconf) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the @@ -133,11 +155,6 @@ WARNING: \`$1' is $msg. You should only need it if ;; autoheader) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want @@ -157,11 +174,6 @@ WARNING: \`$1' is $msg. You should only need it if ;; automake*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. @@ -173,11 +185,6 @@ WARNING: \`$1' is $msg. You should only need it if ;; autom4te) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the @@ -254,11 +261,6 @@ WARNING: \`$1' is $msg. You should only need it if ;; help2man) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the @@ -279,11 +281,6 @@ WARNING: \`$1' is $msg. You should only need it if ;; makeinfo) - if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then - # We have makeinfo, but it failed. - exit 1 - fi - echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file @@ -301,10 +298,6 @@ WARNING: \`$1' is $msg. You should only need it if tar) shift - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index cda0f9c7..614fb8cc 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -12,13 +12,14 @@ endif LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat -sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone +sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone \ + ntfscp EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove \ - ntfsrm ntfscp ntfsmftalloc + ntfsrm ntfsmftalloc man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ - ntfsclone.8 ntfscluster.8 ntfscat.8 + ntfsclone.8 ntfscluster.8 ntfscat.8 ntfscp.8 EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) @@ -68,6 +69,10 @@ ntfscat_SOURCES = ntfscat.c ntfscat.h utils.c utils.h ntfscat_LDADD = $(AM_LIBS) ntfscat_LDFLAGS = $(AM_LFLAGS) +ntfscp_SOURCES = ntfscp.c utils.c utils.h +ntfscp_LDADD = $(AM_LIBS) +ntfscp_LDFLAGS = $(AM_LFLAGS) + # We don't distribute these ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h @@ -94,10 +99,6 @@ ntfsdump_logfile_SOURCES= ntfsdump_logfile.c ntfsdump_logfile_LDADD = $(AM_LIBS) ntfsdump_logfile_LDFLAGS= $(AM_LFLAGS) -ntfscp_SOURCES = ntfscp.c utils.c utils.h -ntfscp_LDADD = $(AM_LIBS) -ntfscp_LDFLAGS = $(AM_LFLAGS) - # Extra targets strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index cb3d1627..464c8bb1 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.1 from Makefile.am. +# Makefile.in generated by automake 1.9.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -42,18 +42,19 @@ target_triplet = @target@ bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ ntfsls$(EXEEXT) ntfscat$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ - ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) + ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) \ + ntfscp$(EXEEXT) EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) ntfswipe$(EXEEXT) \ ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) ntfsrm$(EXEEXT) \ - ntfscp$(EXEEXT) ntfsmftalloc$(EXEEXT) + ntfsmftalloc$(EXEEXT) subdir = ntfsprogs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/mkntfs.8.in $(srcdir)/ntfscat.8.in \ $(srcdir)/ntfsclone.8.in $(srcdir)/ntfscluster.8.in \ - $(srcdir)/ntfsfix.8.in $(srcdir)/ntfsinfo.8.in \ - $(srcdir)/ntfslabel.8.in $(srcdir)/ntfsls.8.in \ - $(srcdir)/ntfsprogs.8.in $(srcdir)/ntfsresize.8.in \ - $(srcdir)/ntfsundelete.8.in + $(srcdir)/ntfscp.8.in $(srcdir)/ntfsfix.8.in \ + $(srcdir)/ntfsinfo.8.in $(srcdir)/ntfslabel.8.in \ + $(srcdir)/ntfsls.8.in $(srcdir)/ntfsprogs.8.in \ + $(srcdir)/ntfsresize.8.in $(srcdir)/ntfsundelete.8.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -61,7 +62,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ - ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 \ + ntfscp.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 \ ntfsresize.8 ntfsundelete.8 am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \ "$(DESTDIR)$(man8dir)" @@ -131,7 +132,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -161,7 +162,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -172,10 +172,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -187,8 +183,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -218,18 +212,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -278,7 +267,7 @@ target_vendor = @target_vendor@ LINK = $(STATIC_LINK) $(LIBTOOL_LINK) man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ - ntfsclone.8 ntfscluster.8 ntfscat.8 + ntfsclone.8 ntfscluster.8 ntfscat.8 ntfscp.8 EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) @@ -316,6 +305,9 @@ ntfsls_LDFLAGS = $(AM_LFLAGS) ntfscat_SOURCES = ntfscat.c ntfscat.h utils.c utils.h ntfscat_LDADD = $(AM_LIBS) ntfscat_LDFLAGS = $(AM_LFLAGS) +ntfscp_SOURCES = ntfscp.c utils.c utils.h +ntfscp_LDADD = $(AM_LIBS) +ntfscp_LDFLAGS = $(AM_LFLAGS) # We don't distribute these ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h @@ -336,9 +328,6 @@ ntfswipe_LDFLAGS = $(AM_LFLAGS) ntfsdump_logfile_SOURCES = ntfsdump_logfile.c ntfsdump_logfile_LDADD = $(AM_LIBS) ntfsdump_logfile_LDFLAGS = $(AM_LFLAGS) -ntfscp_SOURCES = ntfscp.c utils.c utils.h -ntfscp_LDADD = $(AM_LIBS) -ntfscp_LDFLAGS = $(AM_LFLAGS) all: all-am .SUFFIXES: @@ -380,6 +369,8 @@ ntfsclone.8: $(top_builddir)/config.status $(srcdir)/ntfsclone.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfscluster.8: $(top_builddir)/config.status $(srcdir)/ntfscluster.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +ntfscp.8: $(top_builddir)/config.status $(srcdir)/ntfscp.8.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsfix.8: $(top_builddir)/config.status $(srcdir)/ntfsfix.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsinfo.8: $(top_builddir)/config.status $(srcdir)/ntfsinfo.8.in From 2c0c003bc26a2981cb7416f78d54b4c155e049b9 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 12 Oct 2004 20:05:02 +0000 Subject: [PATCH 2016/2994] move ntfscp from extra to standard program set BKrev: 416c38eexoaBvJwLf4g1CKNQMt1gQg From 09fe1580a3e5b5cd5480866c70996247056d19c8 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 13 Oct 2004 09:51:05 +0000 Subject: [PATCH 2017/2994] fixes and cleanup to attribute resize functions (Logical change 1.608) --- libntfs/attrib.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 211fc2af..bddd5dbd 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3290,7 +3290,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) ntfs_attr_close(tna); continue; } - ntfs_inode_mark_dirty(ctx->ntfs_ino); + ntfs_inode_mark_dirty(tna->ni); ntfs_attr_close(tna); ntfs_attr_put_search_ctx(ctx); return ntfs_resident_attr_resize(na, newsize); @@ -3321,6 +3321,17 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) err = errno; goto put_err_out; } + + /* + * Check whether attribute is already single in the this MFT record. + * 8 added for the attribute terminator. + */ + if (le32_to_cpu(ctx->mrec->bytes_in_use) == + le16_to_cpu(ctx->mrec->attrs_offset) + + le32_to_cpu(ctx->attr->length) + 8) { + err = ENOSPC; + goto put_err_out; + } /* Add attribute list if not present. */ if (na->ni->nr_extents == -1) @@ -3349,7 +3360,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) goto put_err_out; } /* Update ntfs attribute. */ - na->ni = ni; + if (na->ni->nr_extents == -1) + na->ni = ni; ntfs_attr_put_search_ctx(ctx); /* Try to perform resize once again. */ @@ -4255,7 +4267,7 @@ put_err_out: */ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) { - if (!na || newsize < 0) { + if (!na || newsize < 0 || (na->ni == FILE_MFT && na->type == AT_DATA)) { errno = EINVAL; return -1; } From a0dba650adf59783ed052891b03ef62af7e25455 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 13 Oct 2004 09:51:05 +0000 Subject: [PATCH 2018/2994] fixes and cleanup to attribute resize functions BKrev: 416cfa89PO2Jcma4ogMT4sIEoThfBw From d65e2dc5e820aabf55f70b44240e16615af55d32 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 13 Oct 2004 10:25:35 +0000 Subject: [PATCH 2019/2994] change example in ntfscp manual page (Logical change 1.609) --- ntfsprogs/ntfscp.8.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in index 9dc0c93f..66cb225c 100644 --- a/ntfsprogs/ntfscp.8.in +++ b/ntfsprogs/ntfscp.8.in @@ -68,10 +68,10 @@ Copy boot.ini from /home/user to the root of an /dev/hda1 NTFS volume: .B ntfscp /dev/hda1 /home/user/boot.ini boot.ini .sp .RE -Copy my_sii_index_root to attribute 0x90 ($INDEX_ROOT) with name $SII of inode 9 (file $Secure): +Copy myfile to C:\\some\\path\\file:stream (assume that /dev/hda1 letter in windows is C): .RS .sp -.B ntfscp -i -a 0x90 -N $SII /dev/hda1 my_sii_index_root 9 +.B ntfscp -N stream /dev/hda1 myfile /some/path/file .SH BUGS No bugs are known at present. If you find any bugs, please send an email to .nh From 34256e4de374f06b02491afb48468b9cacd1907f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 13 Oct 2004 10:25:35 +0000 Subject: [PATCH 2020/2994] change example in ntfscp manual page BKrev: 416d029ff6r7VejadliJYsZCxYXRxg From 3f58b75146bf1db6b65df21c30eea38f1fd47297 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 13 Oct 2004 10:56:24 +0000 Subject: [PATCH 2021/2994] Enforce minimum inode allocation 24 in ntfs_mft_bitmap_find_free_rec(). (Logical change 1.610) --- libntfs/mft.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libntfs/mft.c b/libntfs/mft.c index cf5d221c..a65efe80 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -425,6 +425,8 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) data_pos = vol->mft_data_pos; else data_pos = base_ni->mft_no + 1; + if (data_pos < 24) + data_pos = 24; if (data_pos >= pass_end) { data_pos = 24; pass = 2; From e837874f4d3946c9a1c3e5f72ebd4b8dd32cdc6e Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 13 Oct 2004 10:56:24 +0000 Subject: [PATCH 2022/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into cantab.net:/home/src/ntfsprogs 2004/10/13 11:56:11+01:00 cantab.net!aia21 Enforce minimum inode allocation 24 in ntfs_mft_bitmap_find_free_rec(). BKrev: 416d09d8cXUix_GqQSl2ZqRUV4WJrQ From 01161bc99be149502163328fa1796864c9bb343b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 13 Oct 2004 12:01:03 +0000 Subject: [PATCH 2023/2994] add check that $ATTRIBUTE_LIST should be <= 0x40000 to ntfs_attr_size_bounds_check (Logical change 1.611) --- libntfs/attrib.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index bddd5dbd..3b5dc560 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2156,6 +2156,16 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type, errno = EINVAL; return -1; } + + /* + * $ATTRIBUTE_LIST should be not greater than 0x40000, but this is not + * listed in the AttrDef. + */ + if (type == AT_ATTRIBUTE_LIST && size > 0x40000) { + errno = ERANGE; + return -1; + } + ad = ntfs_attr_find_in_attrdef(vol, type); if (!ad) return -1; From 1a9a051f31b2d010770e4fc0a78a022199100c40 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 13 Oct 2004 12:01:03 +0000 Subject: [PATCH 2024/2994] fix stupid bug in ntfs_inode_free_space (Logical change 1.611) --- libntfs/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index d02ea67f..c56dd958 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -745,8 +745,9 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) if (errno != ENOENT) { Dprintf("%s(): Attribute lookup failed." "\n", __FUNCTION__); - } - break; + } else + err = ENOSPC; + goto put_err_out; } } From bf1ae66f7a23dff7e0e4112c0999d999d7804046 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 13 Oct 2004 12:01:03 +0000 Subject: [PATCH 2025/2994] libntfs/attrib.c add check that $ATTRIBUTE_LIST should be <= 0x40000 to ntfs_attr_size_bounds_check libntfs/inode.c fix stupid bug in ntfs_inode_free_space BKrev: 416d18ffNrhuyxbcth6w8ds5JRh4Ng From c8e53dcdecc92bd40faefaaae9d6a1acfa3a5bb8 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 14 Oct 2004 18:23:21 +0000 Subject: [PATCH 2026/2994] add new high level API ntfs_inode_add_attr (Logical change 1.612) --- libntfs/inode.c | 173 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 173 insertions(+) diff --git a/libntfs/inode.c b/libntfs/inode.c index c56dd958..8fb8c78d 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -795,3 +795,176 @@ put_err_out: errno = err; return -1; } + +/** + * ntfs_inode_add_attr - add attribute to inode + * @ni: opened ntfs inode to which add attribute + * @type: type of the new attribute + * @name: name in unicode of the new attribute + * @name_len: name length in unicode charcters of the new attribute + * @size: size of the new attribute + * + * If inode haven't got enogh space to add attribute, add attribute to one of it + * extents, if no extents present or no one of them have enough space, than + * allocate new extent and add attribute to it. + * + * If on one of this steps attribute list is needed but not present, than it is + * added transparently to caller. So, this function should not be called with + * @type == AT_ATTRIBUTE_LIST, if you really need to add attribute list call + * ntfs_inode_add_attrlist instead. + * + * On success return opened new ntfs attribute. On error return NULL with errno + * set to the error code. + */ +ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, + ntfschar *name, u8 name_len, s64 size) { + int attr_rec_size, err, i, offset; + ntfs_inode *attr_ni; + ntfs_attr *na; + + if (!ni || size < 0 || type == AT_ATTRIBUTE_LIST) { + Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + errno = EINVAL; + return NULL; + } + + if (ni->nr_extents == -1) + ni = ni->base_ni; + + /* + * Determine resident or not will be new attribute. We add 8 to size in + * non resident case for mapping pairs. + */ + if (ntfs_attr_can_be_resident(ni->vol, type)) { + if (errno != EPERM) { + err = errno; + Dprintf("%s(): ntfs_attr_can_be resident failed.\n", + __FUNCTION__); + goto err_out; + } + /* Attribute can't be resident. */ + attr_rec_size = + offsetof(ATTR_RECORD, non_resident_attr_end) + 8; + } else { + if (size >= ni->vol->mft_record_size) + /* Attribute will not fit MFT record. */ + attr_rec_size = offsetof(ATTR_RECORD, + non_resident_attr_end) + 8; + else + /* Attribute can be resident. */ + attr_rec_size = + offsetof(ATTR_RECORD, resident_attr_end); + } + + if (le32_to_cpu(ni->mrec->bytes_allocated) - + le32_to_cpu(ni->mrec->bytes_in_use) >= attr_rec_size) { + attr_ni = ni; + goto add_attr_record; + } + + /* Try to add to extent inodes. */ + if (ntfs_inode_attach_all_extents(ni)) { + err = errno; + Dprintf("%s(): Failed to attach all extents to inode.\n", + __FUNCTION__); + goto err_out; + } + for (i = 0; i < ni->nr_extents; i++) { + attr_ni = ni->extent_nis[i]; + if (le32_to_cpu(attr_ni->mrec->bytes_allocated) - + le32_to_cpu(attr_ni->mrec->bytes_in_use) >= + attr_rec_size) + goto add_attr_record; + } + + /* There is no extent that contain enough space for new attribute. */ + if (!NInoAttrList(ni)) { + /* Add attribute list not present, add it and retry. */ + if (ntfs_inode_add_attrlist(ni)) { + err = errno; + Dprintf("%s(): Failed to add attribute list.\n", + __FUNCTION__); + goto err_out; + } + return ntfs_inode_add_attr(ni, type, name, name_len, size); + } + /* Allocate new extent. */ + attr_ni = ntfs_mft_record_alloc(ni->vol, ni); + if (!attr_ni) { + err = errno; + Dprintf("%s(): Failed to allocate extent record.\n", + __FUNCTION__); + goto err_out; + } + +add_attr_record: + if (attr_rec_size == offsetof(ATTR_RECORD, resident_attr_end)) { + /* Add resident attribute. */ + offset = ntfs_resident_attr_record_add(attr_ni, type, name, + name_len, 0); + if (offset < 0) { + err = errno; + Dprintf("%s(): Failed to add resident attribute.\n", + __FUNCTION__); + goto free_err_out; + } + } else { + /* Add non resident attribute. */ + offset = ntfs_non_resident_attr_record_add(attr_ni, type, name, + name_len, 0, 8, 0); + if (offset < 0) { + err = errno; + Dprintf("%s(): Failed to add non resident attribute.\n", + __FUNCTION__); + goto free_err_out; + } + } + + /* Open new attribute and resize it. */ + na = ntfs_attr_open(ni, type, name, name_len); + if (!na) { + err = errno; + Dprintf("%s(): Failed to open just added attribute.\n", + __FUNCTION__); + goto rm_attr_err_out; + } + if (!size) + return na; + if (ntfs_attr_truncate(na, size)) { + err = errno; + Dprintf("%s(): Failed to resize just added attribute. Probably " + "leaving inconsist metadata.\n", __FUNCTION__); + /* + * We can't goto rm_attr_err_out, because attribute maybe moved + * during attempt of resize. FIXME: Call ntfs_inode_rm_attr when + * it's will be implemented. + */ + // ntfs_inode_rm_attr(na); + // ntfs_attr_close(na); + // goto err_out; + ntfs_attr_close(na); + goto free_err_out; + } + /* Done !*/ + return na; + +rm_attr_err_out: + /* Remove just added attribute. */ + if (ntfs_attr_record_resize(attr_ni->mrec, + (ATTR_RECORD*)((u8*)attr_ni->mrec + offset), 0)) { + Dprintf("%s(): Failed to remove just added attribute.\n", + __FUNCTION__); + } +free_err_out: + /* Free MFT record, if it isn't contain attributes. */ + if (le32_to_cpu(attr_ni->mrec->bytes_in_use) - + le32_to_cpu(attr_ni->mrec->attrs_offset) == 8) { + if (ntfs_mft_record_free(attr_ni->vol, attr_ni)) { + Dprintf("%s(): Failed to free MFT record. Leaving " + "inconsist metadata.\n", __FUNCTION__); + } + } +err_out: + errno = err; + return NULL; +} From af2b917b4ca3db407a56a64ee4a03555611f007a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 14 Oct 2004 18:23:21 +0000 Subject: [PATCH 2027/2994] add prototype (Logical change 1.612) --- include/ntfs/inode.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index d5cb11b9..3c247d24 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -145,5 +145,8 @@ extern int ntfs_inode_add_attrlist(ntfs_inode *ni); extern int ntfs_inode_free_space(ntfs_inode *ni, int size); +extern ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, + ntfschar *name, u8 name_len, s64 size); + #endif /* defined _NTFS_INODE_H */ From 76cc3b3c6a9d339ee76ae479e8e3406eb3422f66 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 14 Oct 2004 18:23:21 +0000 Subject: [PATCH 2028/2994] improve ntfs_non_resident_attr_record_add (Logical change 1.612) --- libntfs/attrib.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 3b5dc560..f10876cd 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2508,6 +2508,15 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, a->lowest_vcn = cpu_to_sle64(lowest_vcn); a->mapping_pairs_offset = cpu_to_le16(length - dataruns_size); a->compression_unit = (flags & ATTR_IS_COMPRESSED) ? 4 : 0; + /* If @lowest_vcn == 0, than setup empty attribute. */ + if (!lowest_vcn) { + a->highest_vcn = cpu_to_sle64(-1); + a->allocated_size = 0; + a->data_size = 0; + a->initialized_size = 0; + /* Set empty mapping pairs. */ + *((u8*) a + (length - dataruns_size)) = 0; + } if (name_len) memcpy((u8*)a + le16_to_cpu(a->name_offset), name, sizeof(ntfschar) * name_len); From a3e26fc9437a7138ab3c0213429a8a3bf6d742ce Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 14 Oct 2004 18:23:21 +0000 Subject: [PATCH 2029/2994] libntfs/attrib.c improve ntfs_non_resident_attr_record_add libntfs/inode.c add new high level API ntfs_inode_add_attr ntfsprogs/ntfscp.c make it add attribute if it's not present BKrev: 416ec419HnAni3_E-QRUdjSqXIewVA From f548a3a6006fb95dfd71b6137fdd5c9c3fa52608 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 14 Oct 2004 18:23:21 +0000 Subject: [PATCH 2030/2994] make it add attribute if it's not present (Logical change 1.612) --- ntfsprogs/ntfscp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index b12b9ad2..d1329c8c 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -312,8 +312,18 @@ int main (int argc, char *argv[]) } na = ntfs_attr_open(out, opts.attribute, attr_name, attr_name_len); if (!na) { - perror("ERROR: Couldn't open attribute"); - goto close_dst; + if (errno != ENOENT) { + perror("ERROR: Couldn't open attribute"); + goto close_dst; + } + /* Requested attribute isn't present, add it. */ + na = ntfs_inode_add_attr(out, opts.attribute, attr_name, + attr_name_len, 0); + if (!na) { + perror("ERROR: Couldn't add attribute"); + goto close_dst; + } + need_logfile_reset = 1; } Vprintf("Old file size: %lld\n", na->data_size); From 5d5f6497e9990cd4e8e34efd5d7d07f76870a7cc Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 14 Oct 2004 18:23:21 +0000 Subject: [PATCH 2031/2994] update (Logical change 1.612) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1357db8a..6b91f931 100644 --- a/ChangeLog +++ b/ChangeLog @@ -88,6 +88,8 @@ xx/xx/2004 - 2.0.0-WIP field from inode.h::_ntfs_inode struct. Adapt all users. (Yura) - Add --attibute, --attr-name and --inode options to ntfscp. (Yura) - ntfscp is moved from extra to standard program set. (Yura) + - Add new high level API inode.[ch]::ntfs_inode_add_attr and make ntfscp + use it when requested attribute isn't exist. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 28cdf0d524615d97e604e948c60f429b6dcb85c8 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 15 Oct 2004 11:38:45 +0000 Subject: [PATCH 2032/2994] add new api ntfs_inode_rm_attr (Logical change 1.613) --- libntfs/inode.c | 86 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 73 insertions(+), 13 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 8fb8c78d..921ed711 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -35,6 +35,7 @@ #include "attrib.h" #include "attrlist.h" #include "runlist.h" +#include "lcnalloc.h" /** * Internal: @@ -817,7 +818,8 @@ put_err_out: * set to the error code. */ ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, - ntfschar *name, u8 name_len, s64 size) { + ntfschar *name, u8 name_len, s64 size) +{ int attr_rec_size, err, i, offset; ntfs_inode *attr_ni; ntfs_attr *na; @@ -828,6 +830,9 @@ ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, return NULL; } + Dprintf("%s(): Entering for inode 0x%llx, attr %x, size %lld.\n", + __FUNCTION__, (long long) ni->mft_no, type, size); + if (ni->nr_extents == -1) ni = ni->base_ni; @@ -932,18 +937,14 @@ add_attr_record: return na; if (ntfs_attr_truncate(na, size)) { err = errno; - Dprintf("%s(): Failed to resize just added attribute. Probably " - "leaving inconsist metadata.\n", __FUNCTION__); - /* - * We can't goto rm_attr_err_out, because attribute maybe moved - * during attempt of resize. FIXME: Call ntfs_inode_rm_attr when - * it's will be implemented. - */ - // ntfs_inode_rm_attr(na); - // ntfs_attr_close(na); - // goto err_out; - ntfs_attr_close(na); - goto free_err_out; + Dprintf("%s(): Failed to resize just added attribute.\n", + __FUNCTION__); + if (ntfs_inode_rm_attr(na)) { + Dprintf("%s(): Failed to remove just added attribute. " + "Probably leaving inconsist metadata.\n", + __FUNCTION__); + } + goto err_out; } /* Done !*/ return na; @@ -968,3 +969,62 @@ err_out: errno = err; return NULL; } + +/** + * ntfs_inode_rm_attr - remove attribute from ntfs inode + * @na: opened ntfs attribute to delete + * + * Remove attribute and all it's extents from ntfs inode. If attribute was non + * resident also free all clusters allocated by attribute. + * + * Return 0 on success or -1 on error with errno set to the error code. + */ +int ntfs_inode_rm_attr(ntfs_attr *na) +{ + ntfs_attr_search_ctx *ctx; + int ret = 0; + + if (!na) { + Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", + __FUNCTION__, (long long) na->ni->mft_no, na->type); + + /* Free cluster allocation. */ + if (NAttrNonResident(na)) { + if (ntfs_attr_map_whole_runlist(na)) + return -1; + if (ntfs_cluster_free(na->ni->vol, na, 0, -1) < 0) { + Dprintf("%s(): Failed to free cluster allocation. " + "Leaving inconsist metadata.\n", __FUNCTION__); + ret = -1; + } + } + + /* Search for attribute extents and remove them all. */ + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); + if (!ctx) + return -1; + while (!ntfs_attr_lookup(na->type, na->name, na->name_len, + CASE_SENSITIVE, 0, NULL, 0, ctx)) { + if (ntfs_attr_record_rm(ctx)) { + Dprintf("%s(): Failed to remove attribute extent. " + "Leaving inconsist metadata.\n", __FUNCTION__); + ret = -1; + } + ntfs_attr_reinit_search_ctx(ctx); + } + if (errno != ENOENT) { + Dprintf("%s(): Attribute lookup failed. Probably leaving " + "inconsist metadata.\n", __FUNCTION__); + ret = -1; + } + + /* Throw away now non-exist attribute. */ + ntfs_attr_close(na); + /* Done. */ + return ret; +} From 38c81c83f2947d2dc140ddfc5dbe3f56ad110d0b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 15 Oct 2004 11:38:45 +0000 Subject: [PATCH 2033/2994] add ntfs_inode_rm_attr prototype (Logical change 1.613) --- include/ntfs/inode.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 3c247d24..b251fc48 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -148,5 +148,7 @@ extern int ntfs_inode_free_space(ntfs_inode *ni, int size); extern ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, ntfschar *name, u8 name_len, s64 size); +extern int ntfs_inode_rm_attr(ntfs_attr *na); + #endif /* defined _NTFS_INODE_H */ From da44d62de543eace80abc7758537062d16a085ec Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 15 Oct 2004 11:38:45 +0000 Subject: [PATCH 2034/2994] libntfs/inode.c add new api ntfs_inode_rm_attr BKrev: 416fb6c5UJo6r-ccGM42THTliC4E7Q From 1ff0764a9a62a169c12f257bc0f8789f0525da88 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 15 Oct 2004 11:38:45 +0000 Subject: [PATCH 2035/2994] make a bit more beautiful assignment in ntfs_non_resident_attr_record_add (Logical change 1.613) --- libntfs/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index f10876cd..f89fdb0c 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2515,7 +2515,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, a->data_size = 0; a->initialized_size = 0; /* Set empty mapping pairs. */ - *((u8*) a + (length - dataruns_size)) = 0; + *((u8*)a + le16_to_cpu(a->mapping_pairs_offset)) = 0; } if (name_len) memcpy((u8*)a + le16_to_cpu(a->name_offset), From c59b032f7e5840839f6b6369ec9d280e86ebe7d1 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 15 Oct 2004 11:38:45 +0000 Subject: [PATCH 2036/2994] update (Logical change 1.613) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 6b91f931..7c687fd5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -90,6 +90,7 @@ xx/xx/2004 - 2.0.0-WIP - ntfscp is moved from extra to standard program set. (Yura) - Add new high level API inode.[ch]::ntfs_inode_add_attr and make ntfscp use it when requested attribute isn't exist. (Yura) + - Add new high level API inode.[ch]::ntfs_inode_rm_attr. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 827ed37ec368d7df6274382fdbccc64418398e51 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 17 Oct 2004 09:50:21 +0000 Subject: [PATCH 2037/2994] Validate attribute type in ntfs_inode_add_attr(). (Logical change 1.614) --- libntfs/inode.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libntfs/inode.c b/libntfs/inode.c index 921ed711..171d16c3 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -836,6 +836,22 @@ ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, if (ni->nr_extents == -1) ni = ni->base_ni; + /* Validate attribute type. */ + if (!ntfs_attr_find_in_attrdef(ni->vol, type)) { + if (errno == ENOENT) { + Dprintf("%s(): Invalid attribute type.\n", + __FUNCTION__); + errno = EINVAL; + return NULL; + } else { + err = errno; + Dprintf("%s(): ntfs_attr_find_in_attrdef failed.\n", + __FUNCTION__); + errno = err; + return NULL; + } + } + /* * Determine resident or not will be new attribute. We add 8 to size in * non resident case for mapping pairs. From 758dcd21ceef8bdbcdef33b264397612a02de62e Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 17 Oct 2004 09:50:21 +0000 Subject: [PATCH 2038/2994] Validate attribute type in ntfs_inode_add_attr(). BKrev: 4172405dY0oM8MxEI_-3zKcJoWh9Og From 3cb8b787bdb400109c74850283c2be2d4df38f98 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 17 Oct 2004 15:56:39 +0000 Subject: [PATCH 2039/2994] - Remove attrlist.[ch]::ntfs_attrlist_set because it was very bad idea to separate it from ntfs_attrlist_entry_{add,rm}. - Update ntfs_attrlist_entry_{add,rm} and ntfs_inode_add_attrlist to work without it. - Some other fixes, improvements and cleanups. (Logical change 1.615) --- ChangeLog | 2 - include/ntfs/attrlist.h | 1 - libntfs/attrib.c | 57 +++++++++------- libntfs/attrlist.c | 147 ++++++++++++++++------------------------ libntfs/inode.c | 72 +++++++++++--------- 5 files changed, 133 insertions(+), 146 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c687fd5..18e1e8af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -48,8 +48,6 @@ xx/xx/2004 - 2.0.0-WIP - Add new API unistr.[hc]::ntfs_ucsndup(). (Anton) - Make libntfs/attrib.c::ntfs_attr_open() make a copy of the attribute name unless it is one of the internal names. (Anton) - - Move out common part of ntfs_attrlist_entry_{add,rm} to new API: - attrlist.[ch]::ntfs_attrlist_set. (Yura) - New API: attrib.[ch]::ntfs_resident_attr_record_add. (Yura) - New API: inode.[ch]::ntfs_inode_add_attrlist. (Yura) - New API: attrlist.[ch]::ntfs_attrlist_need. (Yura) diff --git a/include/ntfs/attrlist.h b/include/ntfs/attrlist.h index 3c7259f9..9d34546e 100644 --- a/include/ntfs/attrlist.h +++ b/include/ntfs/attrlist.h @@ -28,7 +28,6 @@ extern int ntfs_attrlist_need(ntfs_inode *ni); -extern int ntfs_attrlist_set(ntfs_inode *ni, u8 *new_al, int new_al_len); extern int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr); extern int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index f89fdb0c..5f1fd789 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2396,7 +2396,7 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, base_ni = ni->base_ni; else base_ni = ni; - if (NInoAttrList(base_ni)) { + if (type != AT_ATTRIBUTE_LIST && NInoAttrList(base_ni)) { if (ntfs_attrlist_entry_add(ni, a)) { err = errno; ntfs_attr_record_resize(m, a, 0); @@ -2526,7 +2526,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, base_ni = ni->base_ni; else base_ni = ni; - if (NInoAttrList(base_ni)) { + if (type != AT_ATTRIBUTE_LIST && NInoAttrList(base_ni)) { if (ntfs_attrlist_entry_add(ni, a)) { err = errno; ntfs_attr_record_resize(m, a, 0); @@ -2583,29 +2583,15 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { return -1; } - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn " - "%lld.\n", __FUNCTION__, (long long) ctx->ntfs_ino->mft_no, - (unsigned) le32_to_cpu(ctx->attr->type), - (long long) sle64_to_cpu(ctx->attr->lowest_vcn)); + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", + __FUNCTION__, (long long) ctx->ntfs_ino->mft_no, + (unsigned) le32_to_cpu(ctx->attr->type)); type = ctx->attr->type; ni = ctx->ntfs_ino; if (ctx->base_ntfs_ino) base_ni = ctx->base_ntfs_ino; else base_ni = ctx->ntfs_ino; - /* - * Remove record from $ATTRIBUTE_LIST if present and we don't want - * delete $ATTRIBUTE_LIST itself. - */ - if (NInoAttrList(base_ni) && type != AT_ATTRIBUTE_LIST) { - if (ntfs_attrlist_entry_rm(ctx)) { - err = errno; - Dprintf("%s(): Coudn't delete record from " - "$ATTRIBUTE_LIST.\n", __FUNCTION__); - errno = err; - return -1; - } - } /* Remove attribute itself. */ if (ntfs_attr_record_resize(ctx->mrec, ctx->attr, 0)) { @@ -2620,10 +2606,25 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { } ntfs_inode_mark_dirty(ni); + /* + * Remove record from $ATTRIBUTE_LIST if present and we don't want + * delete $ATTRIBUTE_LIST itself. + */ + if (NInoAttrList(base_ni) && type != AT_ATTRIBUTE_LIST) { + if (ntfs_attrlist_entry_rm(ctx)) { + err = errno; + Dprintf("%s(): Coudn't delete record from " + "$ATTRIBUTE_LIST.\n", __FUNCTION__); + errno = err; + return -1; + } + } + /* Post $ATTRIBUTE_LIST delete setup. */ if (type == AT_ATTRIBUTE_LIST) { if (NInoAttrList(base_ni) && base_ni->attr_list) free(base_ni->attr_list); + base_ni->attr_list = NULL; NInoClearAttrList(base_ni); NInoAttrListClearDirty(base_ni); } @@ -3321,10 +3322,19 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) goto put_err_out; } - /* We can't move out attribute list. */ + /* We can't move out attribute list, thus move out others. */ if (na->type == AT_ATTRIBUTE_LIST) { - err = ENOSPC; - goto put_err_out; + ntfs_attr_put_search_ctx(ctx); + if (ntfs_inode_free_space(na->ni, offsetof(ATTR_RECORD, + non_resident_attr_end) + 8)) { + err = errno; + Dprintf("%s(): Couldn't free space in the MFT record " + "to make attribute list non resident.\n", + __FUNCTION__); + errno = err; + return -1; + } + return ntfs_resident_attr_resize(na, newsize); } /* @@ -3712,7 +3722,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) if (na->type == AT_ATTRIBUTE_LIST) { ntfs_attr_put_search_ctx(ctx); if (ntfs_inode_free_space(na->ni, mp_size - - exp_max_mp_size)) { + cur_max_mp_size)) { if (errno != ENOSPC) return -1; Dprintf("%s(): Attribute list mapping " @@ -4287,6 +4297,7 @@ put_err_out: int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) { if (!na || newsize < 0 || (na->ni == FILE_MFT && na->type == AT_DATA)) { + Dprintf("%s(): Invalid aruments passed.\n", __FUNCTION__); errno = EINVAL; return -1; } diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index ac72fd05..cbef17f1 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -82,77 +82,6 @@ int ntfs_attrlist_need(ntfs_inode *ni) return 0; } -/** - * ntfs_attrlist_set - set new attribute list for ntfs inode - * @ni: opened ntfs inode attribute list set for - * @new_al: new attribute list - * @new_al_len: length of new attribute list - * - * Return 0 on success and -1 on error with errno set to the error code. The - * following error codes are defined: - * EINVAL - Invalid argumets passed to function. - * ENOMEM - Not enough memory to allocate necessary buffers. - * ENOTSUP - Code that required for set is not implemented yet. - * EIO - I/O error occured or damaged filesystem. - */ -int ntfs_attrlist_set(ntfs_inode *ni, u8 *new_al, int new_al_len) -{ - ntfs_attr *na = NULL; - int err; - - if (!ni || !new_al || new_al_len < 1) { - Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); - errno = EINVAL; - return -1; - } - - Dprintf("%s(): Entering for inode 0x%llx, new_al_len %d.\n", - __FUNCTION__, (long long) ni->mft_no, new_al_len); - - /* Make attribute list length 8 byte aligment. */ - new_al_len = (new_al_len + 7) & ~7; - - na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, 0, 0); - if (!na) { - err = errno; - Dprintf("%s(): Coudn't open $ATTRIBUTE_LIST.\n", __FUNCTION__); - goto err_out; - } - /* - * Setup im-memory attribute list. We need this to perform attribute - * truncate (we need update attribute list in case other attributes - * will be moved away from their current MFT record). - */ - if (NInoAttrList(ni) && ni->attr_list) - free(ni->attr_list); - ni->attr_list = new_al; - ni->attr_list_size = new_al_len; - NInoSetAttrList(ni); - NInoAttrListSetDirty(ni); - /* Resize $ATTRIBUTE_LIST attribute. */ - if (ntfs_attr_truncate(na, new_al_len)) { - /* - * FIXME: We leave new attribute list. But need to restore old - * and update in it records for moved attributes. Difficult to - * do if we haven't attribute list before truncate and records - * were moved. - */ - err = errno; - Dprintf("%s(): Eeek! $ATTRIBUTE_LIST resize failed. Probably " - "leaving inconsist metadata.\n", __FUNCTION__); - goto err_out; - } - - /* Done! */ - ntfs_attr_close(na); - return 0; -err_out: - if (na) - ntfs_attr_close(na); - errno = err; - return -1; -} - /** * ntfs_attrlist_entry_add - add an attribute list attribute entry * @ni: opened ntfs inode, which contains that attribute @@ -169,6 +98,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) { ATTR_LIST_ENTRY *ale; MFT_REF mref; + ntfs_attr *na = NULL; u8 *new_al; int new_al_len; int err; @@ -193,6 +123,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) return -1; } + /* Determine size and allocate memory for new attribute list. */ new_al_len = (ni->attr_list_size + sizeof(ATTR_LIST_ENTRY) + sizeof(ntfschar) * attr->name_length + 7) & ~7; new_al = malloc(new_al_len); @@ -202,6 +133,20 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) return -1; } + /* Reisze $ATTRIBUTE_LIST to new length. */ + na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, NULL, 0); + if (!na) { + err = errno; + Dprintf("%s(): Failed to open $ATTRIBUTE_LIST attribute.\n", + __FUNCTION__); + goto err_out; + } + if (ntfs_attr_truncate(na, new_al_len)) { + err = errno; + Dprintf("%s(): $ATTRIBUTE_LIST resize failed.\n", __FUNCTION__); + goto err_out; + } + /* Find offset at which insert new entry. */ ale = (ATTR_LIST_ENTRY *) ni->attr_list; for(; (u8 *)ale < ni->attr_list + ni->attr_list_size; @@ -218,7 +163,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) err = EIO; Dprintf("%s(): Corrupt attribute name. Run chkdsk.\n", __FUNCTION__); - goto err_out; + goto rollback; } if (err < 0) continue; @@ -233,7 +178,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) Dprintf("%s(): Attribute with same type, name and " "lowest vcn already present in attribute " "list.\n", __FUNCTION__); - goto err_out; + goto rollback; } break; } @@ -262,13 +207,22 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) attr->name_length * sizeof(ntfschar)); /* Set new runlist. */ - if (ntfs_attrlist_set(ni, new_al, new_al_len)) { - err = errno; - goto err_out; - } - + if (ni->attr_list) + free(ni->attr_list); + ni->attr_list = new_al; + ni->attr_list_size = new_al_len; + NInoAttrListSetDirty(ni); + /* Done! */ + ntfs_attr_close(na); return 0; +rollback: + if (ntfs_attr_truncate(na, ni->attr_list_size)) { + Dprintf("%s(): $ATTRIBUTE_LIST resize failed. Rollback failed. " + "Leaving inconsist metadata.\n", __FUNCTION__); + } err_out: + if (na) + ntfs_attr_close(na); free(new_al); errno = err; return -1; @@ -278,8 +232,7 @@ err_out: * ntfs_attrlist_entry_rm - remove an attribute list attribute entry * @ctx: attribute search context describing the attrubute list entry * - * Remove the attribute list entry @ctx->al_entry from the attribute list - * attribute of the base mft record to which the attribute @ctx->attr belongs. + * Remove the attribute list entry @ctx->al_entry from the attribute list. * * Return 0 on success and -1 on error with errno set to the error code. */ @@ -288,10 +241,11 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) u8 *new_al; int new_al_len; ntfs_inode *base_ni; + ntfs_attr *na; ATTR_LIST_ENTRY *ale; int err; - if (!ctx || !ctx->ntfs_ino || !ctx->attr || !ctx->al_entry) { + if (!ctx || !ctx->ntfs_ino || !ctx->al_entry) { Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); errno = EINVAL; return -1; @@ -305,8 +259,8 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn " "%lld.\n", __FUNCTION__, (long long) ctx->ntfs_ino->mft_no, - (unsigned) le32_to_cpu(ctx->attr->type), - (long long) le64_to_cpu(ctx->attr->lowest_vcn)); + (unsigned) le32_to_cpu(ctx->al_entry->type), + (long long) le64_to_cpu(ctx->al_entry->lowest_vcn)); if (!NInoAttrList(base_ni)) { Dprintf("%s(): Attribute list isn't present.\n", __FUNCTION__); @@ -322,6 +276,20 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) errno = ENOMEM; return -1; } + + /* Reisze $ATTRIBUTE_LIST to new length. */ + na = ntfs_attr_open(base_ni, AT_ATTRIBUTE_LIST, NULL, 0); + if (!na) { + err = errno; + Dprintf("%s(): Failed to open $ATTRIBUTE_LIST attribute.\n", + __FUNCTION__); + goto err_out; + } + if (ntfs_attr_truncate(na, new_al_len)) { + err = errno; + Dprintf("%s(): $ATTRIBUTE_LIST resize failed.\n", __FUNCTION__); + goto err_out; + } /* Copy entries from old attribute list to new. */ memcpy(new_al, base_ni->attr_list, (u8*)ale - base_ni->attr_list); @@ -329,12 +297,17 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) ale->length), new_al_len - ((u8*)ale - base_ni->attr_list)); /* Set new runlist. */ - if (ntfs_attrlist_set(base_ni, new_al, new_al_len)) { - err = errno; - goto err_out; - } + if (base_ni->attr_list) + free(base_ni->attr_list); + base_ni->attr_list = new_al; + base_ni->attr_list_size = new_al_len; + NInoAttrListSetDirty(base_ni); + /* Done! */ + ntfs_attr_close(na); return 0; err_out: + if (na) + ntfs_attr_close(na); free(new_al); errno = err; return -1; diff --git a/libntfs/inode.c b/libntfs/inode.c index 171d16c3..4124cb35 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -525,6 +525,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) u8 *al, *aln; int al_len, al_allocated; ATTR_LIST_ENTRY *ale; + ntfs_attr *na; if (!ni) { Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); @@ -617,52 +618,47 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) al = aln; ntfs_attr_put_search_ctx(ctx); + /* Set in-memory attribute list. */ + ni->attr_list = al; + ni->attr_list_size = al_len; + NInoSetAttrList(ni); + /* Free space if there is not enough it for $ATTRIBUTE_LIST. */ if (le32_to_cpu(ni->mrec->bytes_allocated) - le32_to_cpu(ni->mrec->bytes_in_use) < offsetof(ATTR_RECORD, resident_attr_end)) { - /* - * Set temporary in-memory attribute list. We need this to be - * able perform attribute lookups and move out attributes. - */ - ni->attr_list = al; - ni->attr_list_size = al_len; - NInoSetAttrList(ni); - /* Free space. */ if (ntfs_inode_free_space(ni, offsetof(ATTR_RECORD, resident_attr_end))) { - /* - * Couldn't free space, unset temporary in-memory - * attribute list and fail. - */ + /* Failed to free space. */ err = errno; Dprintf("%s(): Failed to free space for " "$ATTRIBUTE_LIST.\n", __FUNCTION__); - ni->attr_list = NULL; - NInoClearAttrList(ni); - goto err_out; + free(al); + goto rollback; } - /* Unset temporary in-memory attribute list. */ - ni->attr_list = NULL; - NInoClearAttrList(ni); } /* Add $ATTRIBUTE_LIST to mft record. */ - if (ntfs_resident_attr_record_add(ni, AT_ATTRIBUTE_LIST, 0, 0, 0) < 0) { + na = ntfs_inode_add_attr(ni, AT_ATTRIBUTE_LIST, NULL, 0, al_len); + if (!na) { err = errno; - Dprintf("%s(): Couldn't add $ATTRIBUTE_LIST to MFT record.\n", - __FUNCTION__); - goto err_out; - } - - /* Set new attribute list. */ - if (ntfs_attrlist_set(ni, al, al_len)) { - err = errno; - Dprintf("%s(): Coudn't set attribute list.\n", __FUNCTION__); - goto err_out; + Dprintf("%s(): Failed to add $ATTRIBUTE_LIST.\n", __FUNCTION__); + goto rollback; } + /* Done! */ + ntfs_attr_close(na); return 0; +rollback: + /* + * FIXME: We should here scan attribute list for attributes that placed + * not in the base MFT record and move them to it. + */ + /* Unset in-memory attribute list. */ + ni->attr_list = NULL; + NInoClearAttrList(ni); + errno = err; + return -1; put_err_out: ntfs_attr_put_search_ctx(ctx); err_out: @@ -681,7 +677,7 @@ err_out: int ntfs_inode_free_space(ntfs_inode *ni, int size) { ntfs_attr_search_ctx *ctx; - int freed = 0, err; + int freed, err; if (!ni || size < 0) { Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); @@ -691,8 +687,11 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) Dprintf("%s(): Entering for inode 0x%llx, size %d.\n", __FUNCTION__, (long long) ni->mft_no, size); + + freed = (le32_to_cpu(ni->mrec->bytes_allocated) - + le32_to_cpu(ni->mrec->bytes_in_use)); - if (!size) + if (size <= freed) return 0; ctx = ntfs_attr_get_search_ctx(ni, 0); @@ -820,11 +819,12 @@ put_err_out: ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, ntfschar *name, u8 name_len, s64 size) { - int attr_rec_size, err, i, offset; + u32 attr_rec_size; + int err, i, offset; ntfs_inode *attr_ni; ntfs_attr *na; - if (!ni || size < 0 || type == AT_ATTRIBUTE_LIST) { + if (!ni || size < 0) { Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); errno = EINVAL; return NULL; @@ -883,6 +883,12 @@ ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, goto add_attr_record; } + /* Attribute list can be placed only in the base MFT record. */ + if (type == AT_ATTRIBUTE_LIST) { + err = ENOSPC; + goto err_out; + } + /* Try to add to extent inodes. */ if (ntfs_inode_attach_all_extents(ni)) { err = errno; From 111985f6408b9407817effbe31e55e042397048a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 17 Oct 2004 15:56:39 +0000 Subject: [PATCH 2040/2994] - Remove attrlist.[ch]::ntfs_attrlist_set because it was very bad idea to separate it from ntfs_attrlist_entry_{add,rm}. - Update ntfs_attrlist_entry_{add,rm} and ntfs_inode_add_attrlist to work without it. - Some other fixes, improvements and cleanups. BKrev: 41729637NPxuXPAjFk50pAF9xvH8wA From 135a0559c822cebfe62f60d3d160cba94b11a7e3 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 18 Oct 2004 10:00:09 +0000 Subject: [PATCH 2041/2994] replace 0 with NULL where applicable (Logical change 1.616) --- libntfs/attrib.c | 6 +++--- libntfs/attrlist.c | 2 +- libntfs/inode.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 5f1fd789..8e44ed85 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3280,7 +3280,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) } /* Try to make other attributes non-resident and retry each time. */ - ntfs_attr_init_search_ctx(ctx, 0, na->ni->mrec); + ntfs_attr_init_search_ctx(ctx, NULL, na->ni->mrec); while (!ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx)) { ntfs_attr *tna; ATTR_RECORD *a; @@ -3343,7 +3343,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) */ /* Point search context back to attribute which we need resize. */ - ntfs_attr_init_search_ctx(ctx, na->ni, 0); + ntfs_attr_init_search_ctx(ctx, na->ni, NULL); if (ntfs_attr_lookup(na->type, na->name, na->name_len, CASE_SENSITIVE, 0, NULL, 0, ctx)) { Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); @@ -3645,7 +3645,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) else base_ni = na->ni; - ctx = ntfs_attr_get_search_ctx(base_ni, 0); + ctx = ntfs_attr_get_search_ctx(base_ni, NULL); if (!ctx) { err = errno; Dprintf("%s(): Couldn't get search context.\n", __FUNCTION__); diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index cbef17f1..845760df 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -158,7 +158,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) break; err = ntfs_names_collate(ale->name, ale->name_length, (ntfschar*)((u8*)attr + le16_to_cpu(attr->name_offset)), - attr->name_length, -2, CASE_SENSITIVE, 0, 0); + attr->name_length, -2, CASE_SENSITIVE, NULL, 0); if (err == -2) { err = EIO; Dprintf("%s(): Corrupt attribute name. Run chkdsk.\n", diff --git a/libntfs/inode.c b/libntfs/inode.c index 4124cb35..f16d94b8 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -426,7 +426,7 @@ int ntfs_inode_sync(ntfs_inode *ni) NInoAttrListTestAndClearDirty(ni)) { ntfs_attr *na; - na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, 0, 0); + na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, NULL, 0); if (!na) { if (!err || errno == EIO) { err = errno; @@ -694,7 +694,7 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) if (size <= freed) return 0; - ctx = ntfs_attr_get_search_ctx(ni, 0); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { err = errno; Dprintf("%s(): Failed to get attribute search context.\n", From 359d4200f0e6b750e138ba32f4da1374768beb06 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 18 Oct 2004 10:00:09 +0000 Subject: [PATCH 2042/2994] replace 0 with NULL where applicable in the attrib.c, attrlist.c, inode.c BKrev: 41739429kLNSj8xDB3WSYAIs4lmr-A From 781e041a1f472b6e99f8aa537e1020272a897645 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 18 Oct 2004 10:24:25 +0000 Subject: [PATCH 2043/2994] Change block to from unsigned long to unsigned long long in append_to_bad_blocks() and mkntfs_fill_device_with_zeroes(). (Logical change 1.617) --- ntfsprogs/mkntfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 7fc56e0e..7ced1c7f 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -437,7 +437,7 @@ static void parse_options(int argc, char *argv[]) * * Note: Might not return. */ -static void append_to_bad_blocks(unsigned long block) +static void append_to_bad_blocks(unsigned long long block) { long long *new_buf; @@ -3128,14 +3128,14 @@ static void mkntfs_fill_device_with_zeroes(void) */ int i; ssize_t bw; - unsigned long position; - unsigned long mid_clust; + unsigned long long position, mid_clust; float progress_inc = (float)opts.nr_clusters / 100; Qprintf("Initialising device with zeroes: 0%%"); fflush(stdout); mid_clust = (opts.volume_size >> 1) / vol->cluster_size; - for (position = 0; position < opts.nr_clusters; position++) { + for (position = 0; position < (unsigned long long)opts.nr_clusters; + position++) { if (!(position % (int)(progress_inc+1))) { Qprintf("\b\b\b\b%3.0f%%", position / progress_inc); @@ -3158,7 +3158,7 @@ static void mkntfs_fill_device_with_zeroes(void) "file $Boot.\n"); /* Add the baddie to our bad blocks list. */ append_to_bad_blocks(position); - Qprintf("\nFound bad cluster (%ld). Adding to " + Qprintf("\nFound bad cluster (%lld). Adding to " "list of bad blocks.\nInitialising " "device with zeroes: %3.0f%%", position, position / progress_inc); @@ -3176,7 +3176,7 @@ static void mkntfs_fill_device_with_zeroes(void) if (bw != opts.sector_size) { if (bw != -1 || errno != EIO) err_exit("This should not happen.\n"); - else if (i + 1UL == position && + else if (i + 1ull == position && (vol->major_ver >= 2 || (vol->major_ver == 1 && vol->minor_ver >= 2))) From 3009ea72abae440d35d3df4935c338ac1fe60aed Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 18 Oct 2004 10:24:25 +0000 Subject: [PATCH 2044/2994] Fix compiler warning. (Logical change 1.617) --- ntfsprogs/ntfsclone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index e73fec08..024beeb9 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -545,7 +545,7 @@ static void clone_ntfs(u64 nr_clusters) perr_exit("write_all"); } - for (last_cl = cl = 0; cl < vol->nr_clusters; cl++) { + for (last_cl = cl = 0; cl < (u64)vol->nr_clusters; cl++) { if (ntfs_bit_get(lcn_bitmap.bm, cl)) { progress_update(&progress, ++p_counter); From a4da04e60132166ce87f898f4c3fc31b36b50936 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 18 Oct 2004 10:24:25 +0000 Subject: [PATCH 2045/2994] mkntfs.c: Change block to from unsigned long to unsigned long long in append_to_bad_blocks() and mkntfs_fill_device_with_zeroes(). ntfsclone: Fix compiler warning. BKrev: 417399d9oeRjVdMzFJsvAA9PiVndDA From 7df47f7703b9b6dbfe0a6b98f833e066526e7841 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 18 Oct 2004 16:34:01 +0000 Subject: [PATCH 2046/2994] add proper rollback to ntfs_inode_add_attrlist (Logical change 1.618) --- libntfs/inode.c | 93 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 71 insertions(+), 22 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index f16d94b8..6d95f51c 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -554,7 +554,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) } /* Form attribute list. */ - ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { err = errno; Dprintf("%s(): Coudn't get search context.\n", __FUNCTION__); @@ -616,12 +616,12 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) goto put_err_out; } al = aln; - ntfs_attr_put_search_ctx(ctx); /* Set in-memory attribute list. */ ni->attr_list = al; ni->attr_list_size = al_len; NInoSetAttrList(ni); + NInoAttrListSetDirty(ni); /* Free space if there is not enough it for $ATTRIBUTE_LIST. */ if (le32_to_cpu(ni->mrec->bytes_allocated) - @@ -633,32 +633,87 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) err = errno; Dprintf("%s(): Failed to free space for " "$ATTRIBUTE_LIST.\n", __FUNCTION__); - free(al); goto rollback; } } /* Add $ATTRIBUTE_LIST to mft record. */ - na = ntfs_inode_add_attr(ni, AT_ATTRIBUTE_LIST, NULL, 0, al_len); + if (ntfs_resident_attr_record_add(ni, + AT_ATTRIBUTE_LIST, NULL, 0, 0) < 0) { + err = errno; + Dprintf("%s(): Couldn't add $ATTRIBUTE_LIST to MFT record.\n", + __FUNCTION__); + goto rollback; + } + + /* Resize it. */ + na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, NULL, 0); if (!na) { err = errno; - Dprintf("%s(): Failed to add $ATTRIBUTE_LIST.\n", __FUNCTION__); - goto rollback; + Dprintf("%s(): Failed to open just added $ATTRIBUTE_LIST.\n", + __FUNCTION__); + goto remove_attrlist_record; + } + if (ntfs_attr_truncate(na, al_len)) { + err = errno; + Dprintf("%s(): Failed to resize just added $ATTRIBUTE_LIST.\n", + __FUNCTION__); + ntfs_attr_close(na); + goto remove_attrlist_record;; } /* Done! */ ntfs_attr_close(na); return 0; -rollback: - /* - * FIXME: We should here scan attribute list for attributes that placed - * not in the base MFT record and move them to it. - */ - - /* Unset in-memory attribute list. */ +remove_attrlist_record: + /* Prevent ntfs_attr_recorm_rm from freeing attribute list. */ ni->attr_list = NULL; NInoClearAttrList(ni); - errno = err; - return -1; + /* Remove $ATTRIBUTE_LIST record. */ + ntfs_attr_reinit_search_ctx(ctx); + if (!ntfs_attr_lookup(AT_ATTRIBUTE_LIST, NULL, 0, + CASE_SENSITIVE, 0, NULL, 0, ctx)) { + if (ntfs_attr_record_rm(ctx)) + Dprintf("%s(): Rollback failed. Failed to remove " + "attribute list record.\n", __FUNCTION__); + } else + Dprintf("%s(): Rollback failed. Coudn't find attribute list " + "record.\n", __FUNCTION__); + /* Setup back in-memory runlist. */ + ni->attr_list = al; + ni->attr_list_size = al_len; + NInoSetAttrList(ni); +rollback: + /* + * Scan attribute list for attributes that placed not in the base MFT + * record and move them to it. + */ + ntfs_attr_reinit_search_ctx(ctx); + ale = (ATTR_LIST_ENTRY*)al; + while ((u8*)ale < al + al_len) { + if (MREF_LE(ale->mft_reference) != ni->mft_no) { + if (!ntfs_attr_lookup(ale->type, ale->name, + ale->name_length, + CASE_SENSITIVE, + sle64_to_cpu(ale->lowest_vcn), + NULL, 0, ctx)) { + if (ntfs_attr_record_move_to(ctx, ni)) + Dprintf("%s(): Rollback failed. " + "Couldn't back attribute to " + "base MFT record.\n", + __FUNCTION__); + } else + Dprintf("%s(): Rollback failed. " + "ntfs_attr_lookup failed.\n", + __FUNCTION__); + ntfs_attr_reinit_search_ctx(ctx); + } + ale = (ATTR_LIST_ENTRY*)((u8*)ale + le16_to_cpu(ale->length)); + } + /* Remove in-memory attribute list. */ + ni->attr_list = NULL; + ni->attr_list_size = 0; + NInoClearAttrList(ni); + NInoAttrListClearDirty(ni); put_err_out: ntfs_attr_put_search_ctx(ctx); err_out: @@ -824,7 +879,7 @@ ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, ntfs_inode *attr_ni; ntfs_attr *na; - if (!ni || size < 0) { + if (!ni || size < 0 || type == AT_ATTRIBUTE_LIST) { Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); errno = EINVAL; return NULL; @@ -883,12 +938,6 @@ ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, goto add_attr_record; } - /* Attribute list can be placed only in the base MFT record. */ - if (type == AT_ATTRIBUTE_LIST) { - err = ENOSPC; - goto err_out; - } - /* Try to add to extent inodes. */ if (ntfs_inode_attach_all_extents(ni)) { err = errno; From 89e217987326a114aca6b558c202d58b2059a463 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 18 Oct 2004 16:34:01 +0000 Subject: [PATCH 2047/2994] add proper rollback to ntfs_inode_add_attrlist BKrev: 4173f079PUTHIaPQJeJcLxYSyORTrQ From fb156edd1ae8fa8308df96eac76f445e2dd9fce4 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 18 Oct 2004 19:35:46 +0000 Subject: [PATCH 2048/2994] fix stupid bug in ntfs_attr_truncate (Logical change 1.619) --- libntfs/attrib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 8e44ed85..4290406b 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -4296,7 +4296,8 @@ put_err_out: */ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) { - if (!na || newsize < 0 || (na->ni == FILE_MFT && na->type == AT_DATA)) { + if (!na || newsize < 0 || + (na->ni->mft_no == FILE_MFT && na->type == AT_DATA)) { Dprintf("%s(): Invalid aruments passed.\n", __FUNCTION__); errno = EINVAL; return -1; From ee0450214cef03a3005cf359a7bef2a476ceec2a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Mon, 18 Oct 2004 19:35:46 +0000 Subject: [PATCH 2049/2994] fix stupid bug in ntfs_attr_truncate BKrev: 41741b122DNVWax83-TEbjTn7liF0g From b47cb7aa815b1ab4d87e63152a16265b873d16ec Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 20 Oct 2004 17:42:20 +0000 Subject: [PATCH 2050/2994] remove unused code from ntfs_resident_attr_value_resize (Logical change 1.620) --- libntfs/attrib.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 4290406b..b9a3e767 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2764,23 +2764,12 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, * TODO: Implement the move. For now just abort. (AIA) */ if (a->name_length) { - BOOL move_name = FALSE; - if (a->non_resident) { - if (le16_to_cpu(a->name_offset) >= - le16_to_cpu(a->mapping_pairs_offset)) - move_name = TRUE; - } else { - if (le16_to_cpu(a->name_offset) >= - le16_to_cpu(a->value_offset)) - move_name = TRUE; - - } - if (move_name) { + if (le16_to_cpu(a->name_offset) >= + le16_to_cpu(a->value_offset)) { // FIXME: Eeek! - Dprintf("%s(): Eeek! Name is placed after the %s. " - "Aborting...\n", __FUNCTION__, - a->non_resident ? "mapping pairs array": - "attribute value"); + Dprintf("%s(): Eeek! Name is placed after the " + "attribute value. Aborting...\n", + __FUNCTION__); errno = ENOTSUP; return -1; } From 6e0d6ad83a47bda8067bef4879cd30befd249b67 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 20 Oct 2004 17:42:20 +0000 Subject: [PATCH 2051/2994] remove unused code from ntfs_resident_attr_value_resize BKrev: 4176a37cZ_r7R0Ln3gE60EIKfwZKCA From 415693011cdf43a19609f11ec136961a7f22d3bd Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 30 Oct 2004 12:47:27 +0000 Subject: [PATCH 2052/2994] Remove unused function ntfs_rl_merge. (Thanks to Adrian Bunk for spoting it) (Logical change 1.621) --- libntfs/runlist.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 6d43ae4e..1fe92da4 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -138,31 +138,6 @@ static __inline__ void __ntfs_rl_merge(runlist_element *dst, dst->length += src->length; } -/** - * Internal: - * - * ntfs_rl_merge - test if two runlists can be joined together and merge them - * @dst: original, destination runlist - * @src: new runlist to merge with @dst - * - * Test if two runlists can be joined together. For this, their VCNs and LCNs - * must be adjacent. If they can be merged, perform the merge, writing into - * the destination runlist @dst. - * - * Return: TRUE Success, the runlists have been merged. - * FALSE Failure, the runlists cannot be merged and have not been - * modified. - */ -static __inline__ BOOL ntfs_rl_merge(runlist_element *dst, - runlist_element *src) -{ - BOOL merge = ntfs_rl_are_mergeable(dst, src); - - if (merge) - __ntfs_rl_merge(dst, src); - return merge; -} - /** * Internal: * From acacc69673132244ed0d777e7869ecfda4c7c7c0 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 30 Oct 2004 12:47:27 +0000 Subject: [PATCH 2053/2994] Remove unused function ntfs_rl_merge. (Thanks to Adrian Bunk for spoting it) BKrev: 41838d5fYDusPYs9U9n0NfxXm37MwQ From a90e99ff953a86222789edfa719e1fa149d50c45 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 4 Nov 2004 15:39:50 +0000 Subject: [PATCH 2054/2994] Fix determine of resident or not should be new attribute in ntfs_inode_add_attr. (Logical change 1.622) --- libntfs/inode.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 6d95f51c..6e2aa006 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -919,17 +919,18 @@ ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, goto err_out; } /* Attribute can't be resident. */ - attr_rec_size = - offsetof(ATTR_RECORD, non_resident_attr_end) + 8; + attr_rec_size = offsetof(ATTR_RECORD, non_resident_attr_end) + + ((name_len * sizeof(ntfschar) + 7) & ~7) + 8; } else { - if (size >= ni->vol->mft_record_size) - /* Attribute will not fit MFT record. */ + /* Attribute can be resident. */ + attr_rec_size = offsetof(ATTR_RECORD, resident_attr_end) + + ((name_len * sizeof(ntfschar) + 7) & ~7); + /* Check whether attribute will fit into the MFT record. */ + if (size + attr_rec_size >= ni->vol->mft_record_size) + /* Will not fit, make it non resident. */ attr_rec_size = offsetof(ATTR_RECORD, - non_resident_attr_end) + 8; - else - /* Attribute can be resident. */ - attr_rec_size = - offsetof(ATTR_RECORD, resident_attr_end); + non_resident_attr_end) + ((name_len * + sizeof(ntfschar) + 7) & ~7) + 8; } if (le32_to_cpu(ni->mrec->bytes_allocated) - From 8b1c81fd6423cb093e44737ec808218c38206ffa Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 4 Nov 2004 15:39:50 +0000 Subject: [PATCH 2055/2994] Remove check that prevent attributes in inodes with attribute list become resident from ntfs_attr_make_resident. Bugfix and cleanups to ntfs_attr_make_resident. (Logical change 1.622) --- libntfs/attrib.c | 66 ++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 39 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index b9a3e767..509f538d 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3409,8 +3409,11 @@ put_err_out: * * Return 0 on success and -1 on error with errno set to the error code. The * following error codes are defined: + * EINVAL - Invalid arguments passed. * EPERM - The attribute is not allowed to be resident. - * TODO: others... + * EIO - I/O error, damaged inode or bug. + * ENOSPC - There is no enough space to perform conversion. + * ENOTSUP - Requested conversion is not supported yet. * * Warning: We do not set the inode dirty and we do not write out anything! * We expect the caller to do this as this is a fairly low level @@ -3423,9 +3426,16 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) int name_ofs, val_ofs, err = EIO; s64 arec_size, bytes_read; + /* Should be called for the first extent of the attribute. */ + if (sle64_to_cpu(a->lowest_vcn)) { + Dprintf("%s(): Eeek! Should be called for the first extent " + "of the attribute. Aborting...\n", __FUNCTION__); + err = EINVAL; + return -1; + } + /* Some preliminary sanity checking. */ if (!NAttrNonResident(na)) { - // FIXME: Eeek! Dprintf("%s(): Eeek! Trying to make resident attribute " "resident. Aborting...\n", __FUNCTION__); errno = EINVAL; @@ -3444,27 +3454,17 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) /* * Check that the attribute name hasn't been placed after the - * mapping pairs array. If it has we need to move it. - * TODO: Implement the move. For now just abort. (AIA) + * mapping pairs array. Chkdsk treat this as corruption. */ if (a->name_length && le16_to_cpu(a->name_offset) >= le16_to_cpu(a->mapping_pairs_offset)) { - // FIXME: Eeek! - Dprintf("%s(): Eeek! Name is placed after the mapping " - "pairs array. Aborting...\n", __FUNCTION__); - errno = ENOTSUP; + Dprintf("%s(): Eeek! Damaged attribute. Name is placed after " + "the mapping pairs array. Run chkdsk. " + "Aborting...\n", __FUNCTION__); + errno = EIO; return -1; } - // FIXME: For now we cheat and assume there is no attribute list - // attribute present. (AIA) - if (NInoAttrList(na->ni)) { - Dprintf("%s(): Working on files with attribute list " - "attribute is not implemented yet.\n", - __FUNCTION__); - errno = ENOTSUP; - return -1; - } if (NAttrCompressed(na) || NAttrEncrypted(na)) { Dprintf("%s(): Making compressed or encrypted files " "resident is not implemented yet.\n", @@ -3475,7 +3475,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) /* Work out offsets into and size of the resident attribute. */ name_ofs = 24; /* = sizeof(resident_ATTR_REC); */ - val_ofs = (name_ofs + a->name_length + 7) & ~7; + val_ofs = (name_ofs + a->name_length * sizeof(ntfschar) + 7) & ~7; arec_size = (val_ofs + na->data_size + 7) & ~7; /* Sanity check the size before we start modifying the attribute. */ @@ -3491,17 +3491,6 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) /* Move the attribute name if it exists and update the offset. */ if (a->name_length) { - /* Sanity check. */ - if (le16_to_cpu(a->name_offset) + - a->name_length * sizeof(ntfschar) > arec_size) { - // FIXME: Eeek! - Dprintf("%s(): Eeek! Name exceeds new record " - "size! Not supported. Aborting...\n", - __FUNCTION__); - errno = ENOTSUP; - return -1; - } - memmove((u8*)a + name_ofs, (u8*)a + le16_to_cpu(a->name_offset), a->name_length * sizeof(ntfschar)); } @@ -3509,14 +3498,14 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) /* Resize the resident part of the attribute record. */ if (ntfs_attr_record_resize(ctx->mrec, a, arec_size) < 0) { - if (errno != ENOSPC) { - err = errno; - // FIXME: Eeek! - Dprintf("%s(): Eeek! Failed to resize " - "attribute record. Aborting...\n", - __FUNCTION__); - errno = err; - } + /* + * Bug, because ntfs_attr_record_resize should not fail (we + * already checked that attribute fits MFT record). + */ + Dprintf("%s(): BUG! Failed to resize attribute record. " + "Please report to the linux-ntfs-dev@lists.sf.net. " + "Aborting...\n", __FUNCTION__); + errno = EIO; return -1; } @@ -3546,8 +3535,8 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) if (bytes_read != na->initialized_size) { if (bytes_read < 0) err = errno; - // FIXME: Eeek! Dprintf("%s(): Eeek! Failed to read attribute data. " + "Leaving inconsist metadata. Run chkdsk. " "Aborting...\n", __FUNCTION__); errno = err; return -1; @@ -3567,7 +3556,6 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) */ if (ntfs_cluster_free(vol, na, 0, -1) < 0) { err = errno; - // FIXME: Eeek! Dprintf("%s(): Eeek! Failed to release allocated " "clusters (error: %s). Ignoring error and " "leaving behind wasted clusters.\n", From c12b94b680b33709d4c4d7285470a5ce10273b17 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 4 Nov 2004 15:39:50 +0000 Subject: [PATCH 2056/2994] libntfs/attrib.c Remove check that prevent attributes in inodes with attribute list become resident from ntfs_attr_make_resident. Bugfix and cleanups for ntfs_attr_make_resident. libntfs/inode.c Fix determine of resident or not should be new attribute in ntfs_inode_add_attr. BKrev: 418a4d46ONTb_ji4e2MwdUXQK5YApQ From 104b710f207c0884bbfb0e02825400059ef53913 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 4 Nov 2004 15:52:13 +0000 Subject: [PATCH 2057/2994] cleanup to attrib.c (Logical change 1.623) --- libntfs/attrib.c | 47 +++++++++++++---------------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 509f538d..da4443fd 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2760,26 +2760,21 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, { /* * Check that the attribute name hasn't been placed after the - * attribute value/mapping pairs array. If it has we need to move it. - * TODO: Implement the move. For now just abort. (AIA) + * attribute valuy. Chkdsk treat this as corruption. */ - if (a->name_length) { - if (le16_to_cpu(a->name_offset) >= - le16_to_cpu(a->value_offset)) { - // FIXME: Eeek! - Dprintf("%s(): Eeek! Name is placed after the " - "attribute value. Aborting...\n", - __FUNCTION__); - errno = ENOTSUP; - return -1; - } + if (a->name_length && le16_to_cpu(a->name_offset) >= + le16_to_cpu(a->value_offset)) { + Dprintf("%s(): Eeek! Name is placed after the " + "attribute value. Corrupted inode. Run chkdsk. " + "Aborting...\n", __FUNCTION__); + errno = EIO; + return -1; } /* Resize the resident part of the attribute record. */ if (ntfs_attr_record_resize(m, a, (le16_to_cpu(a->value_offset) + new_size + 7) & ~7) < 0) { if (errno != ENOSPC) { int eo = errno; - // FIXME: Eeek! Dprintf("%s(): Eeek! Attribute record resize failed. " "Aborting...\n", __FUNCTION__); errno = eo; @@ -3003,7 +2998,6 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, /* Some preliminary sanity checking. */ if (NAttrNonResident(na)) { - // FIXME: Eeek! Dprintf("%s(): Eeek! Trying to make non-resident attribute " "non-resident. Aborting...\n", __FUNCTION__); errno = EINVAL; @@ -3016,15 +3010,14 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, /* * Check that the attribute name hasn't been placed after the - * attribute value. If it has we need to move it. - * TODO: Implement the move. For now just abort. (AIA) + * attribute valuy. Chkdsk treat this as corruption. */ if (a->name_length && le16_to_cpu(a->name_offset) >= le16_to_cpu(a->value_offset)) { - // FIXME: Eeek! - Dprintf("%s(): Eeek! Name is placed after the attribute " - "value. Aborting...\n", __FUNCTION__); - errno = ENOTSUP; + Dprintf("%s(): Eeek! Name is placed after the " + "attribute value. Corrupted inode. Run chkdsk. " + "Aborting...\n", __FUNCTION__); + errno = EIO; return -1; } @@ -3039,7 +3032,6 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, if (errno != ENOSPC) { int eo = errno; - // FIXME: Eeek! Dprintf("%s(): Eeek! Failed to allocate " "cluster(s). Aborting...\n", __FUNCTION__); @@ -3071,7 +3063,6 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, (u8*)a + le16_to_cpu(a->value_offset)); if (bw != le32_to_cpu(a->value_length)) { err = errno; - // FIXME: Eeek! Dprintf("Eeek! Failed to write out attribute value " "(bw = %lli, errno = %i). " "Aborting...\n", (long long)bw, err); @@ -3084,7 +3075,6 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, mp_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0); if (mp_size < 0) { err = errno; - // FIXME: Eeek! Dputs("Eeek! Failed to get size for mapping pairs array. " "Aborting..."); goto cluster_free_err_out; @@ -3099,21 +3089,10 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, */ arec_size = (mp_ofs + mp_size + 7) & ~7; - /* Sanity check. */ - if (a->name_length && ((le16_to_cpu(a->name_offset) + - a->name_length * sizeof(ntfschar)) > (u32) arec_size)) { - // FIXME: Eeek! - Dprintf("%s(): Eeek! Name exceeds new record size! " - "Not supported. Aborting...\n", __FUNCTION__); - err = ENOTSUP; - goto cluster_free_err_out; - } - /* Resize the resident part of the attribute record. */ if (ntfs_attr_record_resize(ctx->mrec, a, arec_size) < 0) { err = errno; if (err != ENOSPC) { - // FIXME: Eeek! Dprintf("%s(): Eeek! Failed to resize attribute " "record. Aborting...\n", __FUNCTION__); } From 65ae70558ff55776a032e2cabdff11340a242bef Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 4 Nov 2004 15:52:13 +0000 Subject: [PATCH 2058/2994] cleanup to attrib.c BKrev: 418a502dPJSc01KTwJVX-25nywiQ_g From 3bfc11a073fae98cd597c70ecec07c0ec925160b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 11:54:43 +0000 Subject: [PATCH 2059/2994] Implement writing beyond data_size in ntfs_attr_pwrite. (Logical change 1.624) --- libntfs/attrib.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index da4443fd..6c212d53 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -879,20 +879,18 @@ rl_err_out: * On error and nothing has been written, return -1 with errno set * appropriately to the return code of ntfs_pwrite(), or to EINVAL in case of * invalid arguments. - * - * NOTE: Currently changes in length of the attribute @na are not implemented. - * Thus if such a change is requested we return -1 with errno set to ENOTSUP. */ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) { - s64 written, to_write, ofs, total, old_initialized_size; + s64 written, to_write, ofs, total, old_initialized_size, old_data_size; ntfs_volume *vol; ntfs_attr_search_ctx *ctx = NULL; runlist_element *rl; int eo; struct { unsigned int initialized_size : 1; - } need_to_undo = { 0 }; + unsigned int data_size : 1; + } need_to_undo = { 0, 0 }; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, " "count 0x%llx.\n", __FUNCTION__, na->ni->mft_no, @@ -921,14 +919,15 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) if (!count) return 0; /* If the write reaches beyond the end, extend the attribute. */ + old_data_size = na->data_size; if (pos + count > na->data_size) { - // TODO: Need to extend the attribute. For now, just do a - // partial write or abort if completely out of bounds. (AIA) - if (pos >= na->data_size) { - errno = ENOTSUP; + if (ntfs_attr_truncate(na, pos + count)) { + eo = errno; + Dprintf("%s(): Attribute extend failed.", __FUNCTION__); + errno = eo; return -1; } - count = na->data_size - pos; + need_to_undo.data_size = 1; } old_initialized_size = na->initialized_size; /* If it is a resident attribute, write the data to the mft record. */ @@ -1165,6 +1164,9 @@ err_out: } if (ctx) ntfs_attr_put_search_ctx(ctx); + /* Restore original data_size if needed. */ + if (need_to_undo.data_size && ntfs_attr_truncate(na, old_data_size)) + Dprintf("%s(): Failed to restore data_size.\n", __FUNCTION__); errno = eo; return -1; } From 77dcf605854b7b588e443b7760033f3fc258fdcf Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 11:54:43 +0000 Subject: [PATCH 2060/2994] Implement writing beyond data_size in ntfs_attr_pwrite. BKrev: 418b6a03Nyjy4m8jNKZ70Qd-Q1N84A From 8073aaff7def56950f1164a123a998be13c3b778 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 13:54:34 +0000 Subject: [PATCH 2061/2994] ntfs_attr_pwrite: write zeros between initializes_size and @pos if needed. (Logical change 1.625) --- libntfs/attrib.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 6c212d53..b58c0740 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -977,6 +977,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) } /* Handle writes beyond initialized_size. */ if (pos + count > na->initialized_size) { + if (ntfs_attr_map_whole_runlist(na)) + goto err_out; /* Set initialized_size to @pos + @count. */ ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) @@ -986,15 +988,35 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) goto err_out; /* If write starts beyond initialized_size, zero the gap. */ if (pos > na->initialized_size) { - // TODO: Need to write zeroes in the region from - // na->initialized_size to @pos, then update the - // initialized size to equal @pos. If any sparse runs - // are encountered while filling the gap, need to - // honour them, i.e. do not instantiate them. Then can - // continue as if pos <= na->initialized_size, i.e. can - // just fall through and continue. (AIA) - errno = ENOTSUP; - goto err_out; + char *buf; + int err; + + buf = malloc(NTFS_BUF_SIZE); + if (!buf) { + err = errno; + Dprintf("%s(): Not enough memory.\n", + __FUNCTION__); + errno = err; + goto err_out; + } + memset(buf, 0, NTFS_BUF_SIZE); + ofs = na->initialized_size; + while (ofs < pos) { + to_write = min(pos - ofs, NTFS_BUF_SIZE); + written = ntfs_rl_pwrite(vol, na->rl, ofs, + to_write, buf); + if (written <= 0) { + err = errno; + Dprintf("%s(): Failed to zero space " + "between initialized size and " + "@pos.\n", __FUNCTION__); + free(buf); + errno = err; + goto err_out; + } + ofs += written; + } + free(buf); } ctx->attr->initialized_size = cpu_to_sle64(pos + count); if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no, From df4d60490ace37319bd68690e1b96ed5878d541d Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 13:54:34 +0000 Subject: [PATCH 2062/2994] ntfs_attr_pwrite: write zeros between initializes_size and @pos if needed. BKrev: 418b861a2TW-S8wn3PQCJK7qfVP4FQ From 377a40152c99d2a896f5f1dc11503f9b5eae4f8b Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 13:54:34 +0000 Subject: [PATCH 2063/2994] small cleanup (Logical change 1.625) --- ntfsprogs/ntfscp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index d1329c8c..fa0b557b 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -342,13 +342,12 @@ int main (int argc, char *argv[]) } offset = 0; - while (!feof (in)) { + while (!feof(in)) { br = fread(buf, 1, NTFS_BUF_SIZE, in); if (!br) { - if (!feof (in)) perror("ERROR: fread failed"); + if (!feof(in)) perror("ERROR: fread failed"); break; } - bw = ntfs_attr_pwrite(na, offset, br, buf); if (bw != br) { perror("ERROR: ntfs_attr_pwrite failed"); From e7f6573732625c64e2dcbf128b9644e6c416d4a3 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 14:31:00 +0000 Subject: [PATCH 2064/2994] Update outdated ENOTSUP return values. (Logical change 1.626) --- libntfs/attrib.c | 10 ++-------- libntfs/attrlist.c | 1 - libntfs/inode.c | 2 -- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index b58c0740..13165d4c 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3193,7 +3193,6 @@ cluster_free_err_out: * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: - * ENOTSUP - The desired resize is not implemented yet. * ENOMEM - Not enough memory to complete operation. * ERANGE - @newsize is not valid for the attribute type of @na. * ENOSPC - There is no enogh space in base mft to resize $ATTRIBUTE_LIST. @@ -3249,10 +3248,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) /* Error! If not enough space, just continue. */ if (errno != ENOSPC) { err = errno; - if (err != ENOTSUP) - Dprintf("%s(): Eeek! Failed to resize " - "resident part of attribute. " - "Aborting...\n", __FUNCTION__); + Dprintf("%s(): Eeek! Failed to resize resident part " + "of attribute. Aborting...\n", __FUNCTION__); goto put_err_out; } } @@ -3590,7 +3587,6 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: - * ENOTSUP - The desired resize is not implemented yet. * ENOMEM - Not enough memory to complete operation. * ENOSPC - There is no enogh space in base mft to resize $ATTRIBUTE_LIST. */ @@ -3905,7 +3901,6 @@ put_err_out: * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: - * ENOTSUP - The desired resize is not implemented yet. * ENOMEM - Not enough memory to complete operation. * ERANGE - @newsize is not valid for the attribute type of @na. */ @@ -4061,7 +4056,6 @@ put_err_out: * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: - * ENOTSUP - The desired resize is not implemented yet. * ENOMEM - Not enough memory to complete operation. * ERANGE - @newsize is not valid for the attribute type of @na. * ENOSPC - There is no enogh space in base mft to resize $ATTRIBUTE_LIST. diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 845760df..6375187e 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -91,7 +91,6 @@ int ntfs_attrlist_need(ntfs_inode *ni) * following error codes are defined: * EINVAL - Invalid argumets passed to function. * ENOMEM - Not enough memory to allocate necessary buffers. - * ENOTSUP - Code that required for set is not implemented yet. * EIO - I/O error occured or damaged filesystem. */ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) diff --git a/libntfs/inode.c b/libntfs/inode.c index 6e2aa006..ffe1dc9a 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -405,7 +405,6 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) * Return 0 on success or -1 on error with errno set to the error code. * The following error codes are defined: * EINVAL - Invalid arguments were passed to the function. - * ENOTSUP - Syncing requires code that has not been imlemented yet. * EBUSY - Inode and/or one of its extents is busy, try again later. * EIO - I/O error while writing the inode (or one of its extents). */ @@ -515,7 +514,6 @@ int ntfs_inode_sync(ntfs_inode *ni) * EINVAL - Invalid arguments were passed to the function. * EEXIST - Attibute list already exist. * EIO - Input/Ouput error occured. - * ENOTSUP - Add requires code that has not been imlemented yet. * ENOMEM - Not enogh memory to perform add. */ int ntfs_inode_add_attrlist(ntfs_inode *ni) From 4ae0866f349dba68f37d2968c9a0d30446e7f977 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 14:31:00 +0000 Subject: [PATCH 2065/2994] Update outdated ENOTSUP return values. BKrev: 418b8ea4B1JACzPBhKfPdRIblGRfUA From 93d9ed05aa51cbfde40c7b5de5654a493dde8e21 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 19:53:34 +0000 Subject: [PATCH 2066/2994] - ntfs_attr_pwrite now can instantiate holes - modify ntfs_non_resident_attr_expand to add sparse runs (Logical change 1.627) --- libntfs/attrib.c | 209 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 165 insertions(+), 44 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 13165d4c..87b190a6 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -888,9 +888,10 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) runlist_element *rl; int eo; struct { - unsigned int initialized_size : 1; - unsigned int data_size : 1; - } need_to_undo = { 0, 0 }; + unsigned int undo_initialized_size : 1; + unsigned int undo_data_size : 1; + unsigned int update_mapping_pairs : 1; + } need_to = { 0, 0, 0 }; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, " "count 0x%llx.\n", __FUNCTION__, na->ni->mft_no, @@ -927,7 +928,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) errno = eo; return -1; } - need_to_undo.data_size = 1; + need_to.undo_data_size = 1; } old_initialized_size = na->initialized_size; /* If it is a resident attribute, write the data to the mft record. */ @@ -1040,7 +1041,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) * we decide to abort, we MUST change the initialized_size * again. */ - need_to_undo.initialized_size = 1; + need_to.undo_initialized_size = 1; } /* * Scatter the data from the linear data buffer to the volume. Note, a @@ -1054,6 +1055,9 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) goto rl_err_out; } if (rl->lcn < (LCN)0) { + LCN lcn_seek_from = -1; + runlist *rlc; + VCN cur_vcn; s64 t; int cnt; @@ -1089,21 +1093,107 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) } } } - if (eo) { - // TODO: Need to instantiate the hole. Then get - // the runlist element again checking if it is - // ok and fall through to do the writing. (AIA) - errno = ENOTSUP; - goto rl_err_out; + if (!eo) { + /* + * The buffer region is zero, update progress + * counters and proceed with next run. + */ + total += to_write; + count -= to_write; + b = (u8*)b + to_write; + continue; } + /* The buffer is non zero, instantiate the hole. */ + cur_vcn = rl->vcn; + Dprintf("%s(): Isntantiate the hole with vcn 0x%llx.\n", + __FUNCTION__, cur_vcn); /* - * The buffer region is zero, update progress counters - * and proceed with next run. + * Search backwards to find the best lcn to start + * seek from. */ - total += to_write; - count -= to_write; - b = (u8*)b + to_write; - continue; + rlc = rl; + while (rlc->vcn) { + rlc--; + if (rlc->lcn >= 0) { + lcn_seek_from = rlc->lcn + + (rl->vcn - rlc->vcn); + break; + } + } + if (lcn_seek_from == -1) { + /* Backwards search failed, search forwards. */ + rlc = rl; + while (rlc->length) { + rlc++; + if (rlc->lcn >= 0) { + lcn_seek_from = rlc->lcn - + (rlc->vcn - rl->vcn); + break; + } + } + } + /* Allocate clusters to instantiate the hole. */ + rlc = ntfs_cluster_alloc(vol, ((ofs + to_write - 1) >> + vol->cluster_size_bits) + 1, + lcn_seek_from, DATA_ZONE, rl->vcn); + if (!rlc) { + eo = errno; + Dprintf("%s(): Failed to allocate clusters for " + "hole instantiating.\n", __FUNCTION__); + errno = eo; + goto err_out; + } + /* Merge runlists. */ + rl = ntfs_runlists_merge(na->rl, rlc); + if (!rl) { + eo = errno; + Dprintf("%s(): Failed to merge runlists.\n", + __FUNCTION__); + if (ntfs_cluster_free_from_rl(vol, rlc)) { + Dprintf("%s(): Failed to free just " + "allocated clusters. Leaving " + "inconsist metadata. " + "Run chkdsk", __FUNCTION__); + } + errno = eo; + goto err_out; + } + na->rl = rl; + need_to.update_mapping_pairs = 1; + rl = ntfs_attr_find_vcn(na, cur_vcn); + if (!rl) { + /* + * It's definitely a BUG, if we failed to find + * @cur_vcn, because we missed it during + * instatiating of the hole. + */ + Dprintf("%s(): BUG! Failed to find run after " + "instantiating. Please report to the " + "linux-ntfs-dev@lists.sf.net.\n", + __FUNCTION__); + errno = EIO; + goto err_out; + } + if (rl->lcn < 0) { + /* + * BUG! LCN shoudn't be lesser than 0, because + * we just instantiated the hole. + */ + Dprintf("%s(): BUG! LCN is lesser than 0. " + "Please report to the " + "linux-ntfs-dev@lists.sf.net." + "\n", __FUNCTION__); + errno = EIO; + goto err_out; + } + if (rl->vcn != cur_vcn) { + /* + * Clusters that replaced hole are merged with + * previous run, so we need to update offset. + */ + ofs += (cur_vcn - rl->vcn) << + vol->cluster_size_bits; + } } /* It is a real lcn, write it to the volume. */ to_write = min(count, (rl->length << vol->cluster_size_bits) - @@ -1135,12 +1225,15 @@ retry: done: if (ctx) ntfs_attr_put_search_ctx(ctx); + /* Update mapping pairs if needed. */ + if (need_to.update_mapping_pairs) + ntfs_attr_update_mapping_pairs(na); /* Finally, return the number of bytes written. */ return total; rl_err_out: eo = errno; if (total) { - if (need_to_undo.initialized_size) { + if (need_to.undo_initialized_size) { if (pos + total > na->initialized_size) goto done; // TODO: Need to try to change initialized_size. If it @@ -1153,7 +1246,7 @@ rl_err_out: errno = eo; err_out: eo = errno; - if (need_to_undo.initialized_size) { + if (need_to.undo_initialized_size) { int err; err = 0; @@ -1186,8 +1279,11 @@ err_out: } if (ctx) ntfs_attr_put_search_ctx(ctx); + /* Update mapping pairs if needed. */ + if (need_to.update_mapping_pairs) + ntfs_attr_update_mapping_pairs(na); /* Restore original data_size if needed. */ - if (need_to_undo.data_size && ntfs_attr_truncate(na, old_data_size)) + if (need_to.undo_data_size && ntfs_attr_truncate(na, old_data_size)) Dprintf("%s(): Failed to restore data_size.\n", __FUNCTION__); errno = eo; return -1; @@ -4107,38 +4203,63 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) } /* - * Determine first after last LCN of attribute. We will start - * seek clusters from this LCN to avoid fragmentation. If - * there are no valid LCNs in the attribute let the cluster - * allocator choose the starting LCN. + * If we extend $DATA attribute on NTFS 3+ volume, we can add + * sparse runs instead of real alloction of clusters. */ - lcn_seek_from = -1; - if (na->rl->length) { - /* Seek to the last run list element. */ - for (rl = na->rl; (rl + 1)->length; rl++) - ; + if (na->type == AT_DATA && vol->major_ver >= 3) { + rl = malloc(0x1000); + if (!rl) { + Dprintf("%s(): Not enough memory.\n", + __FUNCTION__); + err = ENOMEM; + return -1; + } + rl[0].vcn = (na->allocated_size >> + vol->cluster_size_bits); + rl[0].lcn = LCN_HOLE; + rl[0].length = first_free_vcn - + (na->allocated_size >> vol->cluster_size_bits); + rl[1].vcn = first_free_vcn; + rl[1].lcn = LCN_ENOENT; + rl[1].length = 0; + } else { /* - * If the last LCN is a hole or simillar seek back to - * last valid LCN. + * Determine first after last LCN of attribute. + * We will start seek clusters from this LCN to avoid + * fragmentation. If there are no valid LCNs in the + * attribute let the cluster allocator choose the + * starting LCN. */ - while (rl->lcn < 0 && rl != na->rl) - rl--; - /* Only set lcn_seek_from it the LCN is valid. */ - if (rl->lcn >= 0) - lcn_seek_from = rl->lcn + rl->length; - } + lcn_seek_from = -1; + if (na->rl->length) { + /* Seek to the last run list element. */ + for (rl = na->rl; (rl + 1)->length; rl++) + ; + /* + * If the last LCN is a hole or simillar seek + * back to last valid LCN. + */ + while (rl->lcn < 0 && rl != na->rl) + rl--; + /* + * Only set lcn_seek_from it the LCN is valid. + */ + if (rl->lcn >= 0) + lcn_seek_from = rl->lcn + rl->length; + } - rl = ntfs_cluster_alloc(vol, first_free_vcn - + rl = ntfs_cluster_alloc(vol, first_free_vcn - (na->allocated_size >> vol->cluster_size_bits), lcn_seek_from, DATA_ZONE, na->allocated_size >> vol->cluster_size_bits); - if (!rl) { - err = errno; - Dprintf("%s(): Eeek! Cluster allocation " - "failed.\n", __FUNCTION__); - errno = err; - return -1; + if (!rl) { + err = errno; + Dprintf("%s(): Eeek! Cluster allocation " + "failed.\n", __FUNCTION__); + errno = err; + return -1; + } } /* Append new clusters to attribute runlist. */ From 9d2f97b1a6e7b94d4d65e428905028ec2e6e68fa Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 19:53:34 +0000 Subject: [PATCH 2067/2994] - ntfs_attr_pwrite now can instantiate holes - modify ntfs_non_resident_attr_expand to add sparse runs BKrev: 418bda3eH2ZS7J2hnWNdlPI3lJiQPQ From 77802ca092b00d7e8f9eb833ca66d59b6adbfa3c Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 19:53:34 +0000 Subject: [PATCH 2068/2994] Update (Logical change 1.627) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 18e1e8af..1b400dca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -89,6 +89,8 @@ xx/xx/2004 - 2.0.0-WIP - Add new high level API inode.[ch]::ntfs_inode_add_attr and make ntfscp use it when requested attribute isn't exist. (Yura) - Add new high level API inode.[ch]::ntfs_inode_rm_attr. (Yura) + - Extend ntfs_attr_pwrite to cope with extending the attribute size + and with instantiating holes. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 1c283737c57af38f5cd3bb23e121d13a4429902a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 20:02:16 +0000 Subject: [PATCH 2069/2994] Change prototype of ntfs_cluster_alloc like in kernel driver. (Logical change 1.628) --- include/ntfs/lcnalloc.h | 4 ++-- libntfs/attrib.c | 17 +++++++++-------- libntfs/lcnalloc.c | 6 +++--- libntfs/mft.c | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/ntfs/lcnalloc.h b/include/ntfs/lcnalloc.h index ae3e1dfb..0063b575 100644 --- a/include/ntfs/lcnalloc.h +++ b/include/ntfs/lcnalloc.h @@ -35,8 +35,8 @@ typedef enum { LAST_ZONE = 1, /* For sanity checking. */ } NTFS_CLUSTER_ALLOCATION_ZONES; -extern runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, - const NTFS_CLUSTER_ALLOCATION_ZONES zone, VCN start_vcn); +extern runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, + LCN start_lcn, const NTFS_CLUSTER_ALLOCATION_ZONES zone); extern int ntfs_cluster_free_from_rl(ntfs_volume *vol, runlist *rl); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 87b190a6..73900b91 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1133,9 +1133,10 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) } } /* Allocate clusters to instantiate the hole. */ - rlc = ntfs_cluster_alloc(vol, ((ofs + to_write - 1) >> - vol->cluster_size_bits) + 1, - lcn_seek_from, DATA_ZONE, rl->vcn); + rlc = ntfs_cluster_alloc(vol, rl->vcn, + ((ofs + to_write - 1) >> + vol->cluster_size_bits) + 1, + lcn_seek_from, DATA_ZONE); if (!rlc) { eo = errno; Dprintf("%s(): Failed to allocate clusters for " @@ -3146,8 +3147,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, if (new_allocated_size > 0) { /* Start by allocating clusters to hold the attribute value. */ - rl = ntfs_cluster_alloc(vol, new_allocated_size >> - vol->cluster_size_bits, -1, DATA_ZONE, 0); + rl = ntfs_cluster_alloc(vol, 0, new_allocated_size >> + vol->cluster_size_bits, -1, DATA_ZONE); if (!rl) { if (errno != ENOSPC) { int eo = errno; @@ -4248,11 +4249,11 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) lcn_seek_from = rl->lcn + rl->length; } - rl = ntfs_cluster_alloc(vol, first_free_vcn - + rl = ntfs_cluster_alloc(vol, na->allocated_size >> + vol->cluster_size_bits, first_free_vcn - (na->allocated_size >> vol->cluster_size_bits), lcn_seek_from, - DATA_ZONE, na->allocated_size >> - vol->cluster_size_bits); + DATA_ZONE); if (!rl) { err = errno; Dprintf("%s(): Eeek! Cluster allocation " diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index dc561d80..e72383a5 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -37,10 +37,10 @@ /** * ntfs_cluster_alloc - allocate clusters on an ntfs volume * @vol: mounted ntfs volume on which to allocate the clusters + * @start_vcn: vcn to use for the first allocated cluster * @count: number of clusters to allocate * @start_lcn: starting lcn at which to allocate the clusters (or -1 if none) * @zone: zone from which to allocate the clusters - * @start_vcn: * * Allocate @count clusters preferably starting at cluster @start_lcn or at the * current allocator position if @start_lcn is -1, on the mounted ntfs volume @@ -90,8 +90,8 @@ * possible code paths. So at least for now, I am leaving the double logic - * better safe than sorry... (AIA) */ -runlist *ntfs_cluster_alloc(ntfs_volume *vol, s64 count, LCN start_lcn, - const NTFS_CLUSTER_ALLOCATION_ZONES zone, VCN start_vcn) +runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, + LCN start_lcn, const NTFS_CLUSTER_ALLOCATION_ZONES zone) { LCN zone_start, zone_end, bmp_pos, bmp_initial_pos, last_read_pos, lcn; LCN prev_lcn = 0, prev_run_len = 0, mft_zone_size; diff --git a/libntfs/mft.c b/libntfs/mft.c index a65efe80..f93829e9 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -595,7 +595,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) ntfs_debug("Appending one cluster to mft bitmap."); } else { /* Allocate a cluster from the DATA_ZONE. */ - rl2 = ntfs_cluster_alloc(vol, 1, lcn, DATA_ZONE, rl[1].vcn); + rl2 = ntfs_cluster_alloc(vol, rl[1].vcn, 1, lcn, DATA_ZONE); if (!rl2) { ntfs_error(vol->sb, "Failed to allocate a cluster for " "the mft bitmap."); @@ -907,7 +907,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) "%lli.", (long long)nr); old_last_vcn = rl[1].vcn; do { - rl2 = ntfs_cluster_alloc(vol, nr, lcn, MFT_ZONE, old_last_vcn); + rl2 = ntfs_cluster_alloc(vol, old_last_vcn, nr, lcn, MFT_ZONE); if (rl2) break; if (errno != ENOSPC || nr == min_nr) { From 162bfe84ead5c3d61eca875c143d3abadb77a6b0 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 20:02:16 +0000 Subject: [PATCH 2070/2994] Change prototype of ntfs_cluster_alloc like in kernel driver. BKrev: 418bdc48J4yw6vJL6qRVfoNUCsHDzA From c99889736e98fca603b48ec64e78e364ddeb451a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 21:43:48 +0000 Subject: [PATCH 2071/2994] fix some paths of attribute instantiating code (Logical change 1.629) --- libntfs/attrib.c | 61 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 73900b91..9e468707 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -924,7 +924,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) if (pos + count > na->data_size) { if (ntfs_attr_truncate(na, pos + count)) { eo = errno; - Dprintf("%s(): Attribute extend failed.", __FUNCTION__); + Dprintf("%s(): Attribute extend failed.\n", + __FUNCTION__); errno = eo; return -1; } @@ -1004,7 +1005,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) ofs = na->initialized_size; while (ofs < pos) { to_write = min(pos - ofs, NTFS_BUF_SIZE); - written = ntfs_rl_pwrite(vol, na->rl, ofs, + written = ntfs_rl_pwrite(vol, na->rl, ofs, to_write, buf); if (written <= 0) { err = errno; @@ -1057,7 +1058,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) if (rl->lcn < (LCN)0) { LCN lcn_seek_from = -1; runlist *rlc; - VCN cur_vcn; + VCN cur_vcn, from_vcn; s64 t; int cnt; @@ -1105,6 +1106,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) } /* The buffer is non zero, instantiate the hole. */ cur_vcn = rl->vcn; + from_vcn = rl->vcn + (ofs >> vol->cluster_size_bits); Dprintf("%s(): Isntantiate the hole with vcn 0x%llx.\n", __FUNCTION__, cur_vcn); /* @@ -1116,7 +1118,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) rlc--; if (rlc->lcn >= 0) { lcn_seek_from = rlc->lcn + - (rl->vcn - rlc->vcn); + (from_vcn - rlc->vcn); break; } } @@ -1127,15 +1129,16 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) rlc++; if (rlc->lcn >= 0) { lcn_seek_from = rlc->lcn - - (rlc->vcn - rl->vcn); + (rlc->vcn - from_vcn); break; } } } /* Allocate clusters to instantiate the hole. */ - rlc = ntfs_cluster_alloc(vol, rl->vcn, + rlc = ntfs_cluster_alloc(vol, from_vcn, ((ofs + to_write - 1) >> - vol->cluster_size_bits) + 1, + vol->cluster_size_bits) + 1 + + rl->vcn - from_vcn, lcn_seek_from, DATA_ZONE); if (!rlc) { eo = errno; @@ -1175,11 +1178,11 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) errno = EIO; goto err_out; } + /* If leaved part of the hole go to the next run. */ + if (rl->lcn < 0) + rl++; + /* Now LCN should shoudn't be lesser than 0. */ if (rl->lcn < 0) { - /* - * BUG! LCN shoudn't be lesser than 0, because - * we just instantiated the hole. - */ Dprintf("%s(): BUG! LCN is lesser than 0. " "Please report to the " "linux-ntfs-dev@lists.sf.net." @@ -1187,7 +1190,33 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) errno = EIO; goto err_out; } - if (rl->vcn != cur_vcn) { + if (ofs) { + /* + * Need to clear region between start of + * @cur_vcn cluster and @ofs. + */ + char *buf; + + buf = malloc(ofs); + if (!buf) { + Dprintf("%s(): Not enough memory to " + "allocate %lld bytes.\n", + __FUNCTION__, ofs); + errno = ENOMEM; + goto err_out; + } + memset(buf, 0, ofs); + if (ntfs_rl_pwrite(vol, na->rl, cur_vcn << + vol->cluster_size_bits, + ofs, buf) < 0) { + eo = errno; + Dprintf("%s(): Failed to zero area.\n", + __FUNCTION__); + errno = eo; + goto err_out; + } + } + if (rl->vcn < cur_vcn) { /* * Clusters that replaced hole are merged with * previous run, so we need to update offset. @@ -1195,6 +1224,14 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) ofs += (cur_vcn - rl->vcn) << vol->cluster_size_bits; } + if (rl->vcn > cur_vcn) { + /* + * We left part of the hole, so update we need + * to update offset + */ + ofs -= (rl->vcn - cur_vcn) << + vol->cluster_size_bits; + } } /* It is a real lcn, write it to the volume. */ to_write = min(count, (rl->length << vol->cluster_size_bits) - From eff8a17e3a402f5b6a1ad5094f9983704ad541b4 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 5 Nov 2004 21:43:48 +0000 Subject: [PATCH 2072/2994] fix some paths of attribute instantiating code BKrev: 418bf414UJJePYorUIy0Csa9zfpqsQ From ae2a0dcd67c4205fff6e8af454928acb2defbad9 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 6 Nov 2004 23:40:05 +0000 Subject: [PATCH 2073/2994] Update TODO.libntfs BKrev: 418d60d5od7UkKq7DTZz0Okf-Hn-Iw From 5e6279ea444c463bfaf0372477cfd6b143a0abe1 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 6 Nov 2004 23:40:05 +0000 Subject: [PATCH 2074/2994] update (Logical change 1.630) --- TODO.libntfs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/TODO.libntfs b/TODO.libntfs index 6175b40f..9d18a018 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -12,14 +12,11 @@ * HIGH priority * ***************** -- write attribute resize function (see mkntfs) +- complete the implementation of ntfs_attr_truncate() (for compressed files) -- complete the implementation of ntfs_attr_truncate() +- add write of compressed attributes -- write ntfs_mft_record_allocate() (see ntfs 2.4 driver in CVS) - -- extend ntfs_attr_pwrite to cope with extending the attribute size and with - instantiating holes +- write ntfs_index_{rm_from,add_to,create,rm}() ******************* * MEDIUM priority * @@ -28,12 +25,6 @@ - create API reference book template (cf. linux kernel) - enable automatic creation of API reference -- add write of compressed attributes - -- write ntfs_attr_{rm,create,add}() - -- write ntfs_index_{rm_from,add_to,create,rm}() - - write ntfs_file_name_{add,rm}_from_mft_record() or _from_ntfs_inode(?) - write ntfs_file_unlink() From 9afb49361733f981b4d08833e215a989fdeeef39 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 10 Nov 2004 16:10:10 +0000 Subject: [PATCH 2075/2994] Comments and message fixes in ntfs_attr_update_mapping_pairs. (Logical change 1.631) --- libntfs/attrib.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 9e468707..e51f996c 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3772,11 +3772,12 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) /* * Check whether we finished mapping pairs build, if so mark - * extent as need to delete (by setting highest vcn to -1, we - * shall check it later and delete extent) and continue search. + * extent as need to delete (by setting highest vcn to + * NTFS_VCN_DELETE_MARK (-2), we shall check it later and + * delete extent) and continue search. */ if (finished_build) { - Dprintf("%s(): Marked attr 0x%x for delete in inode " + Dprintf("%s(): Mark attr 0x%x for delete in inode " "0x%llx.\n", __FUNCTION__, le32_to_cpu(a->type), ctx->ntfs_ino->mft_no); a->highest_vcn = cpu_to_sle64(NTFS_VCN_DELETE_MARK); @@ -3786,7 +3787,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) /* * Check that the attribute name hasn't been placed after the - * mapping pairs array. Windows account this as corruption. + * mapping pairs array. Windows treat this as a corruption. */ if (a->name_length) { if (le16_to_cpu(a->name_offset) >= From a7e52eb84cd5e8e424e7d7a5e25351b3f5f10a6f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 10 Nov 2004 16:10:10 +0000 Subject: [PATCH 2076/2994] Comments and message fixes in ntfs_attr_update_mapping_pairs. BKrev: 41923d62hSjdSzc1dqBNcmzXQ46tJg From 9a7dd7f07bbd8292a3c8e67a6bd5550e5018c361 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 12 Nov 2004 17:09:24 +0000 Subject: [PATCH 2077/2994] Add prototypes. (Logical change 1.632) --- include/ntfs/runlist.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/ntfs/runlist.h b/include/ntfs/runlist.h index 2c5df101..29bdc752 100644 --- a/include/ntfs/runlist.h +++ b/include/ntfs/runlist.h @@ -76,5 +76,8 @@ extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, extern int ntfs_rl_truncate(runlist **rl, const VCN start_vcn); +extern int ntfs_rl_sparse(runlist *rl); +extern s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl); + #endif /* defined _NTFS_RUNLIST_H */ From 38be5f3e95689ce6041c726fb681eec817317db8 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 12 Nov 2004 17:09:24 +0000 Subject: [PATCH 2078/2994] New API's ntfs_runlist_sparse and ntfs_rl_get_compressed_size. (Logical change 1.632) --- libntfs/runlist.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 1fe92da4..4dc958cb 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1623,3 +1623,64 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) /* Done! */ return 0; } + +/** + * ntfs_runlist_sparse - check whether runlist have sparse regions or not. + * @rl: runlist to check + * + * Return 1 if have, 0 if not, -1 on error with errno set to the error code. + */ +int ntfs_rl_sparse(runlist *rl) +{ + runlist *rlc; + + if (!rl) { + Dprintf("%s(): Ivalid argument passed.\n"); + errno = EINVAL; + return -1; + } + + for (rlc = rl; rlc->length; rlc++) + if (rlc->lcn < 0) { + if (rlc->lcn != LCN_HOLE) { + Dprintf("%s(): Recevied unmapped runlist.\n", + __FUNCTION__); + errno = EINVAL; + return -1; + } + return 1; + } + return 0; +} + +/** + * ntfs_runlist_get_compressed_size - calculate length of non sparse regions + * @vol: ntfs volume (need for cluster size) + * @rl: runlist to calculate for + * + * Return compressed size or -1 on error with errno set to the error code. + */ +s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl) +{ + runlist *rlc; + s64 ret = 0; + + if (!rl) { + Dprintf("%s(): Ivalid argument passed.\n"); + errno = EINVAL; + return -1; + } + + for (rlc = rl; rlc->length; rlc++) { + if (rlc->lcn < 0) { + if (rlc->lcn != LCN_HOLE) { + Dprintf("%s(): Recevied unmapped runlist.\n", + __FUNCTION__); + errno = EINVAL; + return -1; + } + } else + ret = rlc->length << vol->cluster_size_bits; + } + return ret; +} From 5adfb1d47377c6a1f041e811961e23d2544ad8fe Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 12 Nov 2004 17:09:24 +0000 Subject: [PATCH 2079/2994] New API's ntfs_runlist_sparse and ntfs_rl_get_compressed_size. BKrev: 4194ee4441icGuSxPWAw60S_Ndw3sA From 2a2aecdb2a9deace7ddd090a15ebc6f680c0e794 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 12 Nov 2004 17:09:24 +0000 Subject: [PATCH 2080/2994] Update. (Logical change 1.632) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 1b400dca..b5c10b8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -91,6 +91,7 @@ xx/xx/2004 - 2.0.0-WIP - Add new high level API inode.[ch]::ntfs_inode_rm_attr. (Yura) - Extend ntfs_attr_pwrite to cope with extending the attribute size and with instantiating holes. (Yura) + - Add new API's ntfs_rl_sparse and ntfs_rl_get_copmressed_size. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 339c87da381dd4db3438101e5102f43ffbb6e808 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 12 Nov 2004 17:10:56 +0000 Subject: [PATCH 2081/2994] Endians fix in ntfs_attrlist_entry_add. (Logical change 1.633) --- libntfs/attrlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 6375187e..44a68d0a 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -202,7 +202,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) ale->lowest_vcn = 0; ale->mft_reference = mref; ale->instance = attr->instance; - memcpy(ale->name, (u8 *)attr + attr->name_offset, + memcpy(ale->name, (u8 *)attr + le16_to_cpu(attr->name_offset), attr->name_length * sizeof(ntfschar)); /* Set new runlist. */ From 73ea11fafe0efdf8ba471f22b60237b1cd9dbf86 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 12 Nov 2004 17:10:56 +0000 Subject: [PATCH 2082/2994] Endians fix in ntfs_attrlist_entry_add. BKrev: 4194eea06J3yMkpJJgvYMX_5eQobGA From 4ae8b449afb552a4f70c6c2d4d246bf48da89d69 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 12 Nov 2004 17:32:55 +0000 Subject: [PATCH 2083/2994] Implement code that set/clean sparse bit. But I have to disable it for now (look to the comment of the ntfs_attr_update_mapping_pairs). (Logical change 1.634) --- libntfs/attrib.c | 117 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 112 insertions(+), 5 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e51f996c..921ee183 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3717,7 +3717,18 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) * ntfs_attr_update_mapping_pairs - update mapping pairs for ntfs attribute * @na: non-resident ntfs open attribute for which we need update * - * Build mapping pairs from na->runlist and write them to the disk. + * Build mapping pairs from na->runlist and write them to the disk. Also, this + * function updates sparse bit and allocates/frees space for compressed_size, + * but doesn't change it, so caller should update it manually. + * + * NOTE: Code that set/clean sparse bit currently disabled, because chkdsk + * complain if we don't update index entry's for inode to which we set sparse + * bit. But it doesn't if attribute's runlist has lcn holes and sparse bit + * isn't set. So until we have no API for updating index entries it's the best + * choice. + * + * WARNING: Don't enable set/clean sparse bit code until complete attribute + * move out in case it have no spase for mapping pairs. * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: @@ -3769,7 +3780,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) CASE_SENSITIVE, 0, NULL, 0, ctx)) { a = ctx->attr; m = ctx->mrec; - + /* * Check whether we finished mapping pairs build, if so mark * extent as need to delete (by setting highest vcn to @@ -3784,7 +3795,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) ntfs_inode_mark_dirty(ctx->ntfs_ino); continue; } - + /* * Check that the attribute name hasn't been placed after the * mapping pairs array. Windows treat this as a corruption. @@ -3799,7 +3810,59 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) goto put_err_out; } } - +#if 0 + /* If we in the first extent, then set/clean sparse bit. */ + if (!a->lowest_vcn) { + int sparse; + + sparse = ntfs_rl_sparse(na->rl); + if (sparse == -1) { + Dprintf("%s(): Bad runlist."); + err = EIO; + goto put_err_out; + } + if (sparse && !(a->flags & (ATTR_IS_SPARSE | + ATTR_IS_COMPRESSED))) { + if (!(le32_to_cpu(a->length) - le16_to_cpu( + a->mapping_pairs_offset))) { + Dprintf("%s(): Size of the space " + "allocated for mapping pairs " + "should not be 0. " + "Aborting ...\n", __FUNCTION__); + err = EIO; + goto put_err_out; + } + NAttrSetSparse(na); + a->flags |= ATTR_IS_SPARSE; + a->compression_unit = 4; /* Windows set it so, + even if attribute + is not actually + compressed. */ + memmove((u8*)a + le16_to_cpu(a->name_offset) + + 8, (u8*)a + le16_to_cpu(a->name_offset), + a->name_length * sizeof(ntfschar)); + a->name_offset = cpu_to_le16(le16_to_cpu( + a->name_offset) + 8); + a->mapping_pairs_offset = + cpu_to_le16(le16_to_cpu( + a->mapping_pairs_offset) + 8); + } + if (!sparse && (a->flags & ATTR_IS_SPARSE) && + !(a->flags & ATTR_IS_COMPRESSED)) { + NAttrClearSparse(na); + a->flags &= ~ATTR_IS_SPARSE; + a->compression_unit = 0; + memmove((u8*)a + le16_to_cpu(a->name_offset) - + 8, (u8*)a + le16_to_cpu(a->name_offset), + a->name_length * sizeof(ntfschar)); + a->name_offset = cpu_to_le16(le16_to_cpu( + a->name_offset) - 8); + a->mapping_pairs_offset = + cpu_to_le16(le16_to_cpu( + a->mapping_pairs_offset) - 8); + } + } +#endif /* Get the size for the rest of mapping pairs array. */ mp_size = ntfs_get_size_for_mapping_pairs(na->ni->vol, na->rl, stop_vcn); @@ -3822,7 +3885,20 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) */ exp_max_mp_size = le32_to_cpu(m->bytes_allocated) - le32_to_cpu(m->bytes_in_use) + cur_max_mp_size; - +#if 0 + /* + * If we have no space for mapping pairs (we can receive such + * attribute after allocating spase for compressed_size) then + * move attribute to different mft record with more free space. + */ + if (!exp_max_mp_size) { + // TODO + Dprintf("%s(): Here we shall move attribute to the " + "another extent.\n", __FUNCTION__); + err = ENOTSUP; + goto put_err_out; + } +#endif /* Test mapping pairs for fitting in the current mft record. */ if (mp_size > exp_max_mp_size) { /* @@ -4150,7 +4226,22 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = cpu_to_sle64(na->allocated_size); } +#if 0 + /* Update compressed_size if present. */ + if (NAttrSparse(na) || NAttrCompressed(na)) { + s64 new_compr_size; + new_compr_size = ntfs_rl_get_compressed_size(vol, na->rl); + if (new_compr_size == -1) { + err = errno; + Dprintf("%s(): BUG! Leaving inconsist metadata.\n", + __FUNCTION__); + goto put_err_out; + } + na->compressed_size = new_compr_size; + a->compressed_size = cpu_to_sle64(new_compr_size); + } +#endif /* Update data and initialized size. */ na->data_size = newsize; a->data_size = cpu_to_sle64(newsize); @@ -4357,6 +4448,22 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = cpu_to_sle64(na->allocated_size); } +#if 0 + /* Update compressed_size if present. */ + if (NAttrSparse(na) || NAttrCompressed(na)) { + s64 new_compr_size; + + new_compr_size = ntfs_rl_get_compressed_size(vol, na->rl); + if (new_compr_size == -1) { + err = errno; + Dprintf("%s(): BUG! Leaving inconsist metadata.\n", + __FUNCTION__); + goto put_err_out; + } + na->compressed_size = new_compr_size; + a->compressed_size = cpu_to_sle64(new_compr_size); + } +#endif /* Update data size. */ na->data_size = newsize; a->data_size = cpu_to_sle64(newsize); From 44287b3105b9aa5dfc3995de1cedfa4f68b78afc Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Fri, 12 Nov 2004 17:32:55 +0000 Subject: [PATCH 2084/2994] Implement code that set/clean sparse bit. But I have to disable it for now (look to the comment of the ntfs_attr_update_mapping_pairs). BKrev: 4194f3c7Jt4ZLN9W3PTgygzllzTDLA From cdf56dbe79723d43ed14785f2c60569db85290a7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 13 Nov 2004 08:35:46 +0000 Subject: [PATCH 2085/2994] Fix bug in ntfs_rl_get_compressed_size() and optimize it a bit. (Logical change 1.635) --- libntfs/runlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 4dc958cb..32ec42a9 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1680,7 +1680,7 @@ s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl) return -1; } } else - ret = rlc->length << vol->cluster_size_bits; + ret += rlc->length; } - return ret; + return ret << vol->cluster_size_bits; } From 160532d4d4916368f94438a9fddb5eeea3594de4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Sat, 13 Nov 2004 08:35:46 +0000 Subject: [PATCH 2086/2994] runlist.c: Fix bug in ntfs_rl_get_compressed_size() and optimize it a bit. BKrev: 4195c762muNP0_1nHUpkjuegERrApw From 793120bfb62626099c70f60ce3ddb3d9248cf95f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 13 Nov 2004 20:59:44 +0000 Subject: [PATCH 2087/2994] fix ntfs_rl_sparse and ntfs_rl_get_compressed_size name in their comments (Logical change 1.636) --- libntfs/runlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 32ec42a9..89095988 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1625,7 +1625,7 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) } /** - * ntfs_runlist_sparse - check whether runlist have sparse regions or not. + * ntfs_rl_sparse - check whether runlist have sparse regions or not. * @rl: runlist to check * * Return 1 if have, 0 if not, -1 on error with errno set to the error code. @@ -1654,7 +1654,7 @@ int ntfs_rl_sparse(runlist *rl) } /** - * ntfs_runlist_get_compressed_size - calculate length of non sparse regions + * ntfs_rl_get_compressed_size - calculate length of non sparse regions * @vol: ntfs volume (need for cluster size) * @rl: runlist to calculate for * From 46f31618506cfd81fa949789b0cd4bf73c4342a6 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 13 Nov 2004 20:59:44 +0000 Subject: [PATCH 2088/2994] fix ntfs_rl_sparse and ntfs_rl_get_compressed_size name in their comments BKrev: 419675c0D20MWzCvwt_DdbcT2SV13w From a6258ef7364a19bfe2fe5c7946559c5b111104e7 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 21 Nov 2004 10:53:22 +0000 Subject: [PATCH 2089/2994] Rename layout.h::ATTR_RECORD::{compressed_non_,non_,}resident_attr_end to more shorter {non_,}resident_end and compressed_end. (Logical change 1.637) --- ChangeLog | 7 +++---- include/ntfs/layout.h | 20 ++++++++++---------- libntfs/attrib.c | 2 +- libntfs/inode.c | 12 ++++++------ 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index b5c10b8a..654dab1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -75,10 +75,9 @@ xx/xx/2004 - 2.0.0-WIP - New API attrib.[ch]::ntfs_attr_record_move_away(). (Yura) - New API inode.[ch]::ntfs_inode_attach_all_extents . (Yura) - New API inode.[ch]::ntfs_inode_free_space. (Yura) - - Improved layout.h::ATTR_RECORD to have - {compressed_non_,non_,}resident_attr_end fields. Use - offsetof(ATTR_RECORD, *resident_attr_end) to get size of accordable - attribute. (Yura) + - Improved layout.h::ATTR_RECORD to have {non_,}resident_end and + compressed_end fields. Use offsetof(ATTR_RECORD, *_end) to get size + of accordable attribute. (Yura) - Make ntfs_attr_update_mapping_pairs and ntfs_inode_add_attrlist use ntfs_inode_free_space when there is no enough space for attribute list. (Yura) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 5e094496..1b44191b 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -709,9 +709,9 @@ typedef struct { /* 22 */ RESIDENT_ATTR_FLAGS resident_flags; /* See above. */ /* 23 */ s8 reservedR; /* Reserved/alignment to 8-byte boundary. */ -/* 24 */ void *resident_attr_end[0]; /* Use offsetof( - ATTR_RECORD, resident_attr_end) to - get size of resident attribute. */ +/* 24 */ void *resident_end[0]; /* Use offsetof(ATTR_RECORD, + resident_end) to get size of + a resident attribute. */ } __attribute__ ((__packed__)); /* Non-resident attributes. */ struct { @@ -755,19 +755,19 @@ typedef struct { /* 56*/ s64 initialized_size; /* Byte size of initialized portion of the attribute value. Usually equals data_size. */ -/* 64 */ void *non_resident_attr_end[0]; /* Use offsetof( - ATTR_RECORD, non_resident_attr_end) to - get size of non resident attribute. */ +/* 64 */ void *non_resident_end[0]; /* Use offsetof(ATTR_RECORD, + non_resident_end) to get + size of a non resident + attribute. */ /* sizeof(uncompressed attr) = 64*/ /* 64*/ s64 compressed_size; /* Byte size of the attribute value after compression. Only present when compressed. Always is a multiple of the cluster size. Represents the actual amount of disk space being used on the disk. */ -/* 72 */ void *compressed_non_resident_attr_end[0]; - /* Use offsetof(ATTR_RECORD, - compressed_non_resident_attr_end) to get size - of non resident compressed attribute. */ +/* 72 */ void *compressed_end[0]; + /* Use offsetof(ATTR_RECORD, compressed_end) to + get size of a compressed attribute. */ /* sizeof(compressed attr) = 72*/ } __attribute__ ((__packed__)); } __attribute__ ((__packed__)); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 921ee183..584e9ded 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3449,7 +3449,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) if (na->type == AT_ATTRIBUTE_LIST) { ntfs_attr_put_search_ctx(ctx); if (ntfs_inode_free_space(na->ni, offsetof(ATTR_RECORD, - non_resident_attr_end) + 8)) { + non_resident_end) + 8)) { err = errno; Dprintf("%s(): Couldn't free space in the MFT record " "to make attribute list non resident.\n", diff --git a/libntfs/inode.c b/libntfs/inode.c index ffe1dc9a..07f65dd6 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -624,9 +624,9 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) /* Free space if there is not enough it for $ATTRIBUTE_LIST. */ if (le32_to_cpu(ni->mrec->bytes_allocated) - le32_to_cpu(ni->mrec->bytes_in_use) < - offsetof(ATTR_RECORD, resident_attr_end)) { + offsetof(ATTR_RECORD, resident_end)) { if (ntfs_inode_free_space(ni, - offsetof(ATTR_RECORD, resident_attr_end))) { + offsetof(ATTR_RECORD, resident_end))) { /* Failed to free space. */ err = errno; Dprintf("%s(): Failed to free space for " @@ -917,17 +917,17 @@ ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, goto err_out; } /* Attribute can't be resident. */ - attr_rec_size = offsetof(ATTR_RECORD, non_resident_attr_end) + + attr_rec_size = offsetof(ATTR_RECORD, non_resident_end) + ((name_len * sizeof(ntfschar) + 7) & ~7) + 8; } else { /* Attribute can be resident. */ - attr_rec_size = offsetof(ATTR_RECORD, resident_attr_end) + + attr_rec_size = offsetof(ATTR_RECORD, resident_end) + ((name_len * sizeof(ntfschar) + 7) & ~7); /* Check whether attribute will fit into the MFT record. */ if (size + attr_rec_size >= ni->vol->mft_record_size) /* Will not fit, make it non resident. */ attr_rec_size = offsetof(ATTR_RECORD, - non_resident_attr_end) + ((name_len * + non_resident_end) + ((name_len * sizeof(ntfschar) + 7) & ~7) + 8; } @@ -973,7 +973,7 @@ ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, } add_attr_record: - if (attr_rec_size == offsetof(ATTR_RECORD, resident_attr_end)) { + if (attr_rec_size == offsetof(ATTR_RECORD, resident_end)) { /* Add resident attribute. */ offset = ntfs_resident_attr_record_add(attr_ni, type, name, name_len, 0); From 502c6fec99d4619e73efd06b4e58f743903d8fa3 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 21 Nov 2004 10:53:22 +0000 Subject: [PATCH 2090/2994] Rename layout.h::ATTR_RECORD::{compressed_non_,non_,}resident_attr_end to more shorter {non_,}resident_end and compressed_end. BKrev: 41a073a252tDwjKVM6s63XUHqvNcSA From 0ba0971e01e40e9f18e24a01c63bbfb0912c9d82 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 21 Nov 2004 10:54:50 +0000 Subject: [PATCH 2091/2994] Minor fix to ntfscp manual. (Logical change 1.638) --- ntfsprogs/ntfscp.8.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in index 66cb225c..73cb6bda 100644 --- a/ntfsprogs/ntfscp.8.in +++ b/ntfsprogs/ntfscp.8.in @@ -81,7 +81,9 @@ No bugs are known at present. If you find any bugs, please send an email to .B ntfscp was written by Yura Pakhuchiy. .B ntfscp -and this manual page is based on ntfscat and it's manaul page by Richard Russon, so many thanks to him. +and this manual page is based on +.B ntfscat +and it's manaul page by Richard Russon, so many thanks to him. .SH AVAILABILITY .B ntfscp is part of the ntfsprogs package and is available from From b41f4cee48d1e32b66218c25c9f47eff0ea5879d Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 21 Nov 2004 10:54:50 +0000 Subject: [PATCH 2092/2994] Minor fix to ntfscp manual. BKrev: 41a073faMCe2qBZzDNeaZPeniq5L2A From e2ba16e3db9ea857522955f5937482e5bdcfb39c Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 21 Nov 2004 11:13:09 +0000 Subject: [PATCH 2093/2994] Add @extra parameter to ntfs_attr_record_move_away. New attribute record holder must have free @extra bytes after moving attribute record to it. (Logical change 1.639) --- include/ntfs/attrib.h | 2 +- libntfs/attrib.c | 10 +++++++--- libntfs/inode.c | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index e65c6e90..0918b0ce 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -289,7 +289,7 @@ extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, const u32 newsize); extern int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni); -extern int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx); +extern int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx, int extra); extern int ntfs_attr_update_mapping_pairs(ntfs_attr *na); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 584e9ded..ff62b77c 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3046,19 +3046,23 @@ put_err_out: /** * ntfs_attr_record_move_away - move away attribute record from it's mft record * @ctx: attribute search context describing the attrubute record + * @extra: minimum amount of free spase in the new holder of record * + * New attribute record holder must have free @extra bytes after moving + * attribute record to it. + * * If this function succeed, user should reinit search context if he/she wants * use it anymore. * * Return 0 on success and -1 on error with errno set to the error code. */ -int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx) +int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx, int extra) { ntfs_inode *base_ni, *ni; MFT_RECORD *m; int i, err; - if (!ctx || !ctx->attr || !ctx->ntfs_ino) { + if (!ctx || !ctx->attr || !ctx->ntfs_ino || extra < 0) { Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); errno = EINVAL; return -1; @@ -3097,7 +3101,7 @@ int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx) if (le32_to_cpu(m->bytes_allocated) - le32_to_cpu(m->bytes_in_use) < - le32_to_cpu(ctx->attr->length)) + le32_to_cpu(ctx->attr->length) + extra) continue; if (!ntfs_attr_record_move_to(ctx, ni)) diff --git a/libntfs/inode.c b/libntfs/inode.c index 07f65dd6..3ab66997 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -807,7 +807,7 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) record_size = le32_to_cpu(ctx->attr->length); /* Move away attribute. */ - if (ntfs_attr_record_move_away(ctx)) { + if (ntfs_attr_record_move_away(ctx, 0)) { err = errno; Dprintf("%s(): Failed to move out attribute.\n", __FUNCTION__); From a6ab2850c8b779c93f595e43f8759d8310ca8293 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 21 Nov 2004 11:13:09 +0000 Subject: [PATCH 2094/2994] Add @extra parameter to ntfs_attr_record_move_away. New attribute record holder must have free @extra bytes after moving attribute record to it. BKrev: 41a07845skJ0l_pdf42AEMl_Si5boQ From 2afeb1523dd843fcbdd3daca953643ddf236240f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 21 Nov 2004 12:30:53 +0000 Subject: [PATCH 2095/2994] Fix format string in ntfs_rl_sparse and ntfs_rl_get_compressed_size. (Logical change 1.640) --- libntfs/runlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 89095988..e6fb0ae0 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1635,7 +1635,7 @@ int ntfs_rl_sparse(runlist *rl) runlist *rlc; if (!rl) { - Dprintf("%s(): Ivalid argument passed.\n"); + Dprintf("%s(): Ivalid argument passed.\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -1666,7 +1666,7 @@ s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl) s64 ret = 0; if (!rl) { - Dprintf("%s(): Ivalid argument passed.\n"); + Dprintf("%s(): Ivalid argument passed.\n", __FUNCTION__); errno = EINVAL; return -1; } From 8b719cc3279255c07257d0bd5f0cbac613f311cd Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 21 Nov 2004 12:30:53 +0000 Subject: [PATCH 2096/2994] Fix format string in ntfs_rl_sparse and ntfs_rl_get_compressed_size. BKrev: 41a08a7dvbuXnY0ZiKG1i8FynnTz3Q From 9c6cce1bf2c897d0828ee47a21f3b818e6595c97 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 21 Nov 2004 12:31:51 +0000 Subject: [PATCH 2097/2994] Fix bug in ntfs_inode_add_attr. (Logical change 1.641) --- libntfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 3ab66997..841b873a 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -973,7 +973,8 @@ ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, } add_attr_record: - if (attr_rec_size == offsetof(ATTR_RECORD, resident_end)) { + if (attr_rec_size == offsetof(ATTR_RECORD, resident_end) + + ((name_len * sizeof(ntfschar) + 7) & ~7)) { /* Add resident attribute. */ offset = ntfs_resident_attr_record_add(attr_ni, type, name, name_len, 0); From 8dcb7e68521ea27d053d449826d7ee57f5641dfc Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 21 Nov 2004 12:31:51 +0000 Subject: [PATCH 2098/2994] Fix bug in ntfs_inode_add_attr. BKrev: 41a08ab7g4spRz9gpwxtXxFf5jSrKw From 173cbd1d548564cc8c1b4c6909df58eb4461619a Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 21 Nov 2004 13:39:13 +0000 Subject: [PATCH 2099/2994] Implement attribute move out in case attribute is to small to add compressed_size field to it and we have no free space in the current mft record. (Logical change 1.642) --- libntfs/attrib.c | 57 ++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index ff62b77c..a3e2767a 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3731,9 +3731,6 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) * isn't set. So until we have no API for updating index entries it's the best * choice. * - * WARNING: Don't enable set/clean sparse bit code until complete attribute - * move out in case it have no spase for mapping pairs. - * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: * ENOMEM - Not enough memory to complete operation. @@ -3747,8 +3744,9 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) ATTR_RECORD *a; VCN stop_vcn; int err, mp_size, cur_max_mp_size, exp_max_mp_size; - BOOL finished_build = FALSE; + BOOL finished_build; +retry: if (!na || !na->rl) { Dprintf("%s(): Invalid parameters passed.\n", __FUNCTION__); errno = EINVAL; @@ -3780,6 +3778,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) /* Fill attribute records with new mapping pairs. */ stop_vcn = 0; + finished_build = FALSE; while (!ntfs_attr_lookup(na->type, na->name, na->name_len, CASE_SENSITIVE, 0, NULL, 0, ctx)) { a = ctx->attr; @@ -3821,12 +3820,42 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) sparse = ntfs_rl_sparse(na->rl); if (sparse == -1) { - Dprintf("%s(): Bad runlist."); + Dprintf("%s(): Bad runlist.\n", __FUNCTION__); err = EIO; goto put_err_out; } if (sparse && !(a->flags & (ATTR_IS_SPARSE | ATTR_IS_COMPRESSED))) { + /* + * We need to move attribute to another mft + * record, if attribute is to small to add + * compressed_size field to it and we have no + * free space in the current mft record. + */ + if ((le32_to_cpu(a->length) - le16_to_cpu( + a->mapping_pairs_offset) + == 8) && !(le32_to_cpu( + m->bytes_allocated) - + le32_to_cpu(m->bytes_in_use))) { + if (!NInoAttrList(na->ni)) { + ntfs_attr_put_search_ctx(ctx); + if (ntfs_inode_add_attrlist( + na->ni)) + return -1; + goto retry; + } + if (ntfs_attr_record_move_away(ctx, + 8)) { + Dprintf("%s(): Failed to move " + "attribute to another " + "extent. Aborting...\n", + __FUNCTION__); + err = errno; + goto put_err_out; + } + ntfs_attr_put_search_ctx(ctx); + goto retry; + } if (!(le32_to_cpu(a->length) - le16_to_cpu( a->mapping_pairs_offset))) { Dprintf("%s(): Size of the space " @@ -3889,20 +3918,6 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) */ exp_max_mp_size = le32_to_cpu(m->bytes_allocated) - le32_to_cpu(m->bytes_in_use) + cur_max_mp_size; -#if 0 - /* - * If we have no space for mapping pairs (we can receive such - * attribute after allocating spase for compressed_size) then - * move attribute to different mft record with more free space. - */ - if (!exp_max_mp_size) { - // TODO - Dprintf("%s(): Here we shall move attribute to the " - "another extent.\n", __FUNCTION__); - err = ENOTSUP; - goto put_err_out; - } -#endif /* Test mapping pairs for fitting in the current mft record. */ if (mp_size > exp_max_mp_size) { /* @@ -3924,7 +3939,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) errno = ENOSPC; return -1; } - return ntfs_attr_update_mapping_pairs(na); + goto retry; } /* Add attribute list if it isn't present, and retry. */ @@ -3938,7 +3953,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) errno = err; return -1; } - return ntfs_attr_update_mapping_pairs(na); + goto retry; } /* From 96ff6fe9603eac850191a707b6fac349f7438a95 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sun, 21 Nov 2004 13:39:13 +0000 Subject: [PATCH 2100/2994] Implement attribute move out in case attribute is to small to add compressed_size field to it and we have no free space in the current mft record. BKrev: 41a09a81ODSa1CLrpjjK6e74PN2jnQ From ff195c0f84d02dc47ced38172a3dacbc3c6dfd51 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 27 Nov 2004 11:20:32 +0000 Subject: [PATCH 2101/2994] ntfsinfo: print "file attributes" field for $FILE_NAME attribute. (Logical change 1.643) --- ntfsprogs/ntfsinfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 1f16d2af..2596460c 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -593,6 +593,8 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) (long long)sle64_to_cpu(file_name_attr->allocated_size)); printf("\tReal File Size:\t\t %lld\n", (long long)sle64_to_cpu(file_name_attr->data_size)); + printf("\tFile attributes:\t %x\n", + le32_to_cpu(file_name_attr->file_attributes)); /* time stuff stuff */ if (!opts.notime) { From 48a398a6e6fe51d17b0f88e9269d82d61d772db4 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Sat, 27 Nov 2004 11:20:32 +0000 Subject: [PATCH 2102/2994] ntfsinfo: print "file attributes" field for $FILE_NAME attribute. BKrev: 41a86300PYEgxUP939fHbd_BBfyubA From 1c1a2f2af9277f14d63f6a5a85f7578ef89b032f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 17 Dec 2004 14:41:57 +0000 Subject: [PATCH 2103/2994] Add check for SetFilePointerEx. (Christophe) (Logical change 1.644) --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e855e7b7..84a941ef 100644 --- a/configure.ac +++ b/configure.ac @@ -219,7 +219,7 @@ AC_FUNC_STRFTIME AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \ - strcasecmp strchr strdup strerror strtol strtoul utime mbsinit]) + strcasecmp strchr strdup strerror strtol strtoul utime mbsinit SetFilePointerEx]) # Makefiles to be created by configure. AC_CONFIG_FILES([ From 725e19422ce0a66c105d881b77c538a310d730b5 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 17 Dec 2004 14:41:57 +0000 Subject: [PATCH 2104/2994] Patch for a better compilation under NT 4 that lacks SetFilePointerEx and FSCTL_GET_NTFS_VOLUME_DATA. (Christophe) (Logical change 1.644) --- libntfs/win32_io.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 3a6026db..4def6079 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -78,7 +78,7 @@ typedef struct win32_fd { HANDLE vol_handle; } win32_fd; -#ifdef EMULATE_SETFILEPOINTEREX +#ifndef HAVE_SETFILEPOINTEREX static BOOL WINAPI SetFilePointerEx(HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod) @@ -174,7 +174,7 @@ static __inline__ int ntfs_device_unix_status_flags_to_win32(int flags) /** * ntfs_device_win32_simple_open_file - Just open a file via win32 API * @filename: Name of the file to open. - * @handle: Pointer the a HADNLE in which to put the result. + * @handle: Pointer the a HANDLE in which to put the result. * @flags: Unix open status flags. * @locking: will the function gain an exclusive lock on the file? * @@ -201,7 +201,7 @@ static int ntfs_device_win32_simple_open_file(const char *filename, /** * ntfs_device_win32_lock - Lock the volume - * @handle: A win32 HADNLE for a volume to lock. + * @handle: A win32 HANDLE for a volume to lock. * * Locking a volume means no one can access its contents. * Exiting the process automatically unlocks the volume, except in old NT4s. @@ -224,7 +224,7 @@ static int ntfs_device_win32_lock(HANDLE handle) /** * ntfs_device_win32_unlock - Unlock the volume - * @handle: The win32 HADNLE which the volume was locked with. + * @handle: The win32 HANDLE which the volume was locked with. * * Return 0 if o.k. * -1 if not, and errno set. @@ -244,7 +244,7 @@ static int ntfs_device_win32_unlock(HANDLE handle) /** * ntfs_device_win32_dismount - Dismount a volume - * @handle: A win32 HADNLE for a volume to dismount. + * @handle: A win32 HANDLE for a volume to dismount. * * Dismounting means the system will refresh the volume in the first change * it gets. Usefull after altering the file structures. @@ -271,7 +271,7 @@ static int ntfs_device_win32_dismount(HANDLE handle) /** * ntfs_device_win32_getsize - Get file size via win32 API - * @handle: Pointer the file HADNLE obtained via open. + * @handle: Pointer the file HANDLE obtained via open. * * Only works on ordinary files. * @@ -293,7 +293,7 @@ static s64 ntfs_device_win32_getsize(HANDLE handle) /** * ntfs_device_win32_getdisklength - Get disk size via win32 API - * @handle: Pointer the file HADNLE obtained via open. + * @handle: Pointer the file HANDLE obtained via open. * @argp: Pointer to result buffer. * * Only works on PhysicalDriveX type handles. @@ -319,7 +319,7 @@ static s64 ntfs_device_win32_getdisklength(HANDLE handle) /** * ntfs_device_win32_getntfssize - Get NTFS volume size via win32 API - * @handle: Pointer the file HADNLE obtained via open. + * @handle: Pointer the file HANDLE obtained via open. * @argp: Pointer to result buffer. * * Only works on NTFS volume handles. @@ -334,6 +334,7 @@ static s64 ntfs_device_win32_getdisklength(HANDLE handle) */ static s64 ntfs_device_win32_getntfssize(HANDLE handle) { +#ifdef FSCTL_GET_NTFS_VOLUME_DATA NTFS_VOLUME_DATA_BUFFER buf; DWORD i; @@ -347,6 +348,9 @@ static s64 ntfs_device_win32_getntfssize(HANDLE handle) Dprintf("NTFS volume length: 0x%llx\n", (long long)rvl); return rvl; } +#else + return -1; +#endif } /** @@ -804,7 +808,7 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) /** * ntfs_device_win32_seek - Change current file position. - * @handle: Pointer the file HADNLE obtained via open. + * @handle: Pointer the file HANDLE obtained via open. * @pos: Offset in the file relative to file start. * * Return Succeed: The new position in the file @@ -848,7 +852,7 @@ static s64 ntfs_device_win32_abs_seek(struct win32_fd *fd, LARGE_INTEGER pos) /** * ntfs_device_win32_seek - Change current file position. - * @handle: Pointer the file HADNLE obtained via open. + * @handle: Pointer the file HANDLE obtained via open. * @offset: Required offset from the whence anchor. * @whence: May be one of the following: * SEEK_SET Offset is relative to file start. From 61f74f81f1f61e1139cc9088d4173f5a121ddef4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 17 Dec 2004 14:41:57 +0000 Subject: [PATCH 2105/2994] Patch for a better compilation under NT 4 that lacks SetFilePointerEx and FSCTL_GET_NTFS_VOLUME_DATA. (Christophe) BKrev: 41c2f035meU-oiQolFwOAFIV7OeCPQ From 003b867d711bbed26218ab8b7279a2a32ba3a9e9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 17 Dec 2004 14:41:57 +0000 Subject: [PATCH 2106/2994] Update build for change to configure.ac. (Logical change 1.644) --- INSTALL | 52 +- Makefile.in | 14 +- aclocal.m4 | 7356 +++++++++++------ compile | 84 +- config.guess | 79 +- config.h.in | 3 + config.sub | 10 +- configure | 15648 +++++++++++++++++++++++++++++++------ doc/Makefile.in | 14 +- include/Makefile.in | 14 +- include/ntfs/Makefile.in | 14 +- install-sh | 4 +- libntfs/Makefile.in | 26 +- ltmain.sh | 3266 +++++--- missing | 77 +- ntfsprogs/Makefile.in | 16 +- 16 files changed, 20695 insertions(+), 5982 deletions(-) diff --git a/INSTALL b/INSTALL index 095b1eb4..54caf7c1 100644 --- a/INSTALL +++ b/INSTALL @@ -1,16 +1,13 @@ -Installation Instructions -************************* +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free -Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives + This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== -These are generic installation instructions. + These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses @@ -70,9 +67,9 @@ The simplest way to compile this package is: Compilers and Options ===================== -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here @@ -85,7 +82,7 @@ is an example: Compiling For Multiple Architectures ==================================== -You can compile the package for more than one kind of computer at the + You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the @@ -102,19 +99,19 @@ for another architecture. Installation Names ================== -By default, `make install' will install the package's files in + By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PREFIX'. +option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PREFIX', the package will -use PREFIX as the prefix for installing programs and libraries. +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular +options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. @@ -125,7 +122,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= -Some packages pay attention to `--enable-FEATURE' options to + Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The @@ -140,11 +137,11 @@ you can use the `configure' options `--x-includes=DIR' and Specifying the System Type ========================== -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: @@ -170,9 +167,9 @@ eventually be run) with `--host=TYPE'. Sharing Defaults ================ -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. @@ -181,7 +178,7 @@ A warning: not all `configure' scripts look for a site script. Defining Variables ================== -Variables not defined in a site shell script can be set in the + Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set @@ -195,7 +192,8 @@ overridden in the site shell script). `configure' Invocation ====================== -`configure' recognizes the following options to control how it operates. + `configure' recognizes the following options to control how it +operates. `--help' `-h' diff --git a/Makefile.in b/Makefile.in index c015bc8c..7d7a0391 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -77,6 +77,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -87,6 +88,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -98,6 +103,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -127,13 +134,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/aclocal.m4 b/aclocal.m4 index 3fa265f2..7310a0e3 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.9.2 -*- Autoconf -*- +# generated automatically by aclocal 1.9.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. @@ -11,12 +11,63 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# serial 46 AC_PROG_LIBTOOL +# serial 47 AC_PROG_LIBTOOL + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# 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 And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +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_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" @@ -27,10 +78,13 @@ AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) -]) +])# _AC_PROG_LIBTOOL + +# AC_LIBTOOL_SETUP +# ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.13)dnl +[AC_PREREQ(2.50)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl @@ -40,15 +94,105 @@ 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([LT_AC_PROG_SED])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 +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -58,341 +202,78 @@ file_magic*) ;; esac -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -# 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* - ;; +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default -*-*-linux*) - # Test if the compiler is 64bit - echo 'int i;' > conftest.$ac_ext - lt_cv_cc_64bit_output=no - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *"ELF 64"*) - lt_cv_cc_64bit_output=yes - ;; - 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 - ;; +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP -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])]) +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl - 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 +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} -_LT_AC_LTCONFIG_HACK +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER -]) -# AC_LIBTOOL_HEADER_ASSERT -# ------------------------ -AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], -[AC_CACHE_CHECK([whether $CC supports assert without backlinking], - [lt_cv_func_assert_works], - [case $host in - *-*-solaris*) - if test "$GCC" = yes && test "$with_gnu_ld" != yes; then - case `$CC --version 2>/dev/null` in - [[12]].*) lt_cv_func_assert_works=no ;; - *) lt_cv_func_assert_works=yes ;; - esac - fi - ;; - esac]) +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX -if test "x$lt_cv_func_assert_works" = xyes; then - AC_CHECK_HEADERS(assert.h) -fi -])# AC_LIBTOOL_HEADER_ASSERT -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h) -])# _LT_AC_CHECK_DLFCN +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $host_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[[ABCDGISTW]]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. -lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[[]] = -{ -EOF - sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AC_FD_CC - fi - else - echo "cannot find nm_test_var in $nlist" >&AC_FD_CC - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC - fi - else - echo "$progname: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" -if test -z "$lt_cv_sys_global_symbol_pipe"; then - global_symbol_to_cdecl= - global_symbol_to_c_name_address= -else - global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" - global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" -fi -if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; -then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - -# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR -# --------------------------------- -AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], -[# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi -])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR - +[_LT_AC_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -410,7 +291,7 @@ if test "X[$]1" = X--no-reexec; then elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else @@ -422,14 +303,14 @@ if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -456,8 +337,9 @@ else # # So, first we look for a working echo in the user's PATH. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -466,7 +348,7 @@ else break fi done - IFS="$save_ifs" + IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -539,17 +421,312 @@ if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then fi AC_SUBST(ECHO) -AC_DIVERT_POP -])# _LT_AC_PROG_ECHO_BACKSLASH +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + 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 + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + 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_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + 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 + ;; +AC_PROVIDE_IFELSE([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) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* ) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ------------------------------------------------------------------ AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[if test "$cross_compiling" = yes; then : +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : [$4] else - AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext </dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" -need_locks="$enable_libtool_lock" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -if test x"$host" != x"$build"; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case $host_os in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="[$]2" - -AC_MSG_CHECKING([for objdir]) -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -AC_MSG_RESULT($objdir) - - -AC_ARG_WITH(pic, -[ --with-pic try to use only PIC/non-PIC objects [default=use both]], -pic_mode="$withval", pic_mode=default) -test -z "$pic_mode" && pic_mode=default - -# We assume here that the value for lt_cv_prog_cc_pic will not be cached -# in isolation, and that seeing it set (from the cache) indicates that -# the associated values are set (in the cache) correctly too. -AC_MSG_CHECKING([for $compiler option to produce PIC]) -AC_CACHE_VAL(lt_cv_prog_cc_pic, -[ lt_cv_prog_cc_pic= - lt_cv_prog_cc_shlib= - lt_cv_prog_cc_wl= - lt_cv_prog_cc_static= - lt_cv_prog_cc_no_builtin= - lt_cv_prog_cc_can_build_shared=$can_build_shared - - if test "$GCC" = yes; then - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-static' - - case $host_os in - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # not sure about C++ programs. - lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_cv_prog_cc_pic='-fno-common' - ;; - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_cv_prog_cc_pic=-Kconform_pic - fi - ;; - *) - lt_cv_prog_cc_pic='-fPIC' - ;; - esac - else - # PORTME Check for PIC flags for the system compiler. - case $host_os in - aix3* | aix4* | aix5*) - lt_cv_prog_cc_wl='-Wl,' - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_cv_prog_cc_static='-Bstatic' - else - lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - hpux9* | hpux10* | hpux11*) - # Is there a better lt_cv_prog_cc_static that works with the bundled CC? - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" - lt_cv_prog_cc_pic='+Z' - ;; - - irix5* | irix6* | nonstopux*) - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - - newsos6) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - ;; - - osf3* | osf4* | osf5*) - # All OSF/1 code is PIC. - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - ;; - - sco3.2v5*) - lt_cv_prog_cc_pic='-Kpic' - lt_cv_prog_cc_static='-dn' - lt_cv_prog_cc_shlib='-belf' - ;; - - solaris*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - sunos4*) - lt_cv_prog_cc_pic='-PIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Qoption ld ' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - uts4*) - lt_cv_prog_cc_pic='-pic' - lt_cv_prog_cc_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_cv_prog_cc_pic='-Kconform_pic' - lt_cv_prog_cc_static='-Bstatic' - fi - ;; - - *) - lt_cv_prog_cc_can_build_shared=no - ;; - esac - fi + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* ]) -if test -z "$lt_cv_prog_cc_pic"; then - AC_MSG_RESULT([none]) -else - AC_MSG_RESULT([$lt_cv_prog_cc_pic]) - - # Check to make sure the pic_flag actually works. - AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) - AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - AC_TRY_COMPILE([], [], [dnl - case $host_os in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then - # they create non-PIC objects. So, if there were any warnings, we - # assume that PIC is not supported. - if test -s conftest.err; then - lt_cv_prog_cc_pic_works=no - else - lt_cv_prog_cc_pic_works=yes - fi - ;; - *) - lt_cv_prog_cc_pic_works=yes - ;; - esac - ], [dnl - lt_cv_prog_cc_pic_works=no - ]) - CFLAGS="$save_CFLAGS" - ]) - - if test "X$lt_cv_prog_cc_pic_works" = Xno; then - lt_cv_prog_cc_pic= - lt_cv_prog_cc_can_build_shared=no - else - lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" - fi - - AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) -fi - -# Check for any special shared library compilation flags. -if test -n "$lt_cv_prog_cc_shlib"; then - AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) - lt_cv_prog_cc_can_build_shared=no - fi -fi - -AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) -AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl - lt_cv_prog_cc_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) - LDFLAGS="$save_LDFLAGS" -]) - -# Belt *and* braces to stop my trousers falling down: -test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) - -pic_flag="$lt_cv_prog_cc_pic" -special_shlib_compile_flags="$lt_cv_prog_cc_shlib" -wl="$lt_cv_prog_cc_wl" -link_static_flag="$lt_cv_prog_cc_static" -no_builtin_flag="$lt_cv_prog_cc_no_builtin" -can_build_shared="$lt_cv_prog_cc_can_build_shared" +])# AC_LIBTOOL_PROG_CC_C_O -# Check to see if options -o and -c are simultaneously supported by compiler -AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) -AC_CACHE_VAL([lt_cv_compiler_c_o], [ -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -echo "int some_variable = 0;" > conftest.$ac_ext -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" -compiler_c_o=no -if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - lt_cv_compiler_c_o=no - else - lt_cv_compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&AC_FD_CC - lt_cv_compiler_c_o=no -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null -]) -compiler_c_o=$lt_cv_compiler_c_o -AC_MSG_RESULT([$compiler_c_o]) - -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) - AC_CACHE_VAL([lt_cv_compiler_o_lo], [ - lt_cv_compiler_o_lo=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - save_objext="$ac_objext" - ac_objext=lo - AC_TRY_COMPILE([], [int some_variable = 0;], [dnl - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - lt_cv_compiler_o_lo=no - else - lt_cv_compiler_o_lo=yes - fi - ]) - ac_objext="$save_objext" - CFLAGS="$save_CFLAGS" - ]) - compiler_o_lo=$lt_cv_compiler_o_lo - AC_MSG_RESULT([$compiler_o_lo]) -else - compiler_o_lo=no -fi - +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- # Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes @@ -1131,764 +988,77 @@ if test "$compiler_c_o" = no && test "$need_locks" != no; then ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then - AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS -if test "$GCC" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) - echo "int some_variable = 0;" > conftest.$ac_ext - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" - compiler_rtti_exceptions=no - AC_TRY_COMPILE([], [int some_variable = 0;], [dnl - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - compiler_rtti_exceptions=no - else - compiler_rtti_exceptions=yes - fi - ]) - CFLAGS="$save_CFLAGS" - AC_MSG_RESULT([$compiler_rtti_exceptions]) - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi -fi - -# See if the linker supports building shared libraries. -AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) - -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -old_archive_from_expsyms_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_into_libs=no -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -link_all_deplibs=unknown -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. -extract_expsyms_cmds= - -case $host_os in -cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; -openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ - sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ - test -f $output_objdir/impgen.exe || (cd $output_objdir && \ - if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ - else $CC -o impgen impgen.c ; fi)~ - $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' - - old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' - - # cygwin and mingw dlls have different entry points and sets of symbols - # to exclude. - # FIXME: what about values for MSVC? - dll_entry=__cygwin_dll_entry@12 - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ - case $host_os in - mingw*) - # mingw values - dll_entry=_DllMainCRTStartup@12 - dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ - ;; - esac - - # mingw and cygwin differ, and it's simplest to just exclude the union - # of the two symbol sets. - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one (in ltdll.c) - if test "x$lt_cv_need_dllmain" = "xyes"; then - ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " - ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ - test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' - else - ltdll_obj= - ltdll_cmds= - fi - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left be newer dlltools. - export_symbols_cmds="$ltdll_cmds"' - $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' - - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is. - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname-def; - else - echo EXPORTS > $output_objdir/$soname-def; - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \[$]# in - 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; - 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; - *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done; - fi~ - '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw* | pw32*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - hardcode_direct=yes - archive_cmds='' - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - shared_flag='${wl}-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall can do strange things, so it is better to - # generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='${wl}-berok' - # This is a bit strange, but is similar to how AIX traditionally builds - # it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' - # We need to add '_' to the symbols in $export_symbols first - #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - hardcode_direct=yes - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load $convenience' - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case $host_os in - hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case "$host_os" in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - #Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - export_dynamic_flag_spec='${wl}-Bexport' - ;; - - solaris*) - # gcc --version < 3.0 without binutils cannot create self contained - # shared libraries reliably, requiring libgcc.a to resolve some of - # the object symbols generated in some cases. Libraries that use - # assert need libgcc.a to resolve __eprintf, for example. Linking - # a copy of libgcc.a into every shared library to guarantee resolving - # such symbols causes other problems: According to Tim Van Holder - # , C++ libraries end up with a separate - # (to the application) exception stack for one thing. - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - [[12]].*) - cat <&2 - -*** Warning: Releases of GCC earlier than version 3.0 cannot reliably -*** create self contained shared libraries on Solaris systems, without -*** introducing a dependency on libgcc.a. Therefore, libtool is disabling -*** -no-undefined support, which will at least allow you to build shared -*** libraries. However, you may find that when you link such libraries -*** into an application without using GCC, you have to manually add -*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to -*** upgrade to a newer version of GCC. Another option is to rebuild your -*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. - -EOF - no_undefined_flag= - ;; - esac - fi - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5uw7* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs fi -AC_MSG_RESULT([$ld_shlibs]) -test "$ld_shlibs" = no && can_build_shared=no +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- # Check hardcoding attributes. -AC_MSG_CHECKING([how to hardcode library paths into programs]) -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. - hardcode_action=relink + _LT_AC_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate + _LT_AC_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. - hardcode_action=unsupported + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported fi -AC_MSG_RESULT([$hardcode_action]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) -striplib= +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then @@ -1896,17 +1066,33 @@ if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else AC_MSG_RESULT([no]) fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP -reload_cmds='$LD$reload_flag -o $output$reload_objs' -test -z "$deplibs_check_method" && deplibs_check_method=unknown +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- # PORTME Fill in your ld.so characteristics -AC_MSG_CHECKING([dynamic linker characteristics]) +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -1915,17 +1101,36 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) @@ -1935,7 +1140,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -1945,57 +1150,54 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can - # not hardcode correct soname into executable. Probably we can - # add versioning support to collect2, so additional links can - # be useful in future. + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}.so$major' + soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi - hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) - library_names_spec='${libname}.so' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[[45]]*) version_type=linux need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -2003,29 +1205,55 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows + shrext_cmds=".dll" need_version=no need_lib_prefix=no + case $GCC,$host_os in - yes,cygwin*) + yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog .libs/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac ;; - yes,mingw*) - library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` - ;; - yes,pw32*) - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - ;; + *) - library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -2038,30 +1266,56 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' - soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -2070,7 +1324,11 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - *) + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -2081,8 +1339,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -2090,14 +1348,45 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. - dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -2105,21 +1394,29 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) version_type=irix ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -2128,20 +1425,21 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) +linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. -linux-gnu*) +linux*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -2150,12 +1448,11 @@ linux-gnu*) # before this can be enabled. hardcode_into_libs=yes - case $host_cpu:$lt_cv_cc_64bit_output in - powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" - ;; - esac + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -2166,17 +1463,29 @@ linux-gnu*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -2186,7 +1495,17 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -2195,46 +1514,47 @@ openbsd*) version_type=sunos need_lib_prefix=no need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case "$host_os" in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' + shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf + need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; @@ -2242,8 +1562,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -2253,7 +1573,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -2265,8 +1585,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -2287,39 +1607,940 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# Report the final consequences. + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# 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_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# 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], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# 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_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# 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], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# 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_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# 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], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# 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_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# 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_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [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]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +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_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +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 + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$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_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl +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 $CC]) + 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. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname 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 + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + 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. + case `"$lt_cv_path_LD" -v 2>&1 &1 /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_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + 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_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + case $host_cpu in + alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + # this will be overridden with pass_all, but let us keep it just in case + 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` + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + 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 + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + 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*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + 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 + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + 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 + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_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* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL 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, lt_dlinit, + [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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[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])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -2337,10 +2558,1159 @@ aix3*) fi ;; -aix4*) +aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_cv_prog_cc_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi]) - AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) - ;; - esac -fi -need_lc=${lt_cv_archive_cmds_need_lc-yes} +AC_LIBTOOL_CONFIG($1) -# The second clause should only fire when bootstrapping the +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_F77_CONFIG + + +# AC_LIBTOOL_LANG_GCJ_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) +AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], +[AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_GCJ_CONFIG + + +# AC_LIBTOOL_LANG_RC_CONFIG +# -------------------------- +# Ensure that the configuration vars for the Windows resource compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) +AC_DEFUN([_LT_AC_LANG_RC_CONFIG], +[AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_RC_CONFIG + + +# AC_LIBTOOL_CONFIG([TAGNAME]) +# ---------------------------- +# If TAGNAME is not passed, then create an initial libtool script +# with a default configuration from the untagged config vars. Otherwise +# add code to config.status for appending the configuration named by +# TAGNAME from the matching tagged config vars. +AC_DEFUN([AC_LIBTOOL_CONFIG], +[# The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - : -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi - -if test -f "$ltmain"; then - trap "$rm \"${ofile}T\"; exit 1" 1 2 15 - $rm -f "${ofile}T" - - echo creating $ofile - + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS SED \ - AR AR_FLAGS CC LD LN_S NM SHELL \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ - postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ - old_striplib striplib file_magic_cmd export_symbols_cmds \ - deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - global_symbol_to_c_name_address \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + old_postinstall_cmds old_postuninstall_cmds \ + _LT_AC_TAGVAR(compiler, $1) \ + _LT_AC_TAGVAR(CC, $1) \ + _LT_AC_TAGVAR(LD, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ + _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ + _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ + _LT_AC_TAGVAR(old_archive_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ + _LT_AC_TAGVAR(predep_objects, $1) \ + _LT_AC_TAGVAR(postdep_objects, $1) \ + _LT_AC_TAGVAR(predeps, $1) \ + _LT_AC_TAGVAR(postdeps, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ + _LT_AC_TAGVAR(archive_cmds, $1) \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ + _LT_AC_TAGVAR(postinstall_cmds, $1) \ + _LT_AC_TAGVAR(postuninstall_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ + _LT_AC_TAGVAR(allow_undefined_flag, $1) \ + _LT_AC_TAGVAR(no_undefined_flag, $1) \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ + _LT_AC_TAGVAR(hardcode_automatic, $1) \ + _LT_AC_TAGVAR(module_cmds, $1) \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) \ + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ + _LT_AC_TAGVAR(exclude_expsyms, $1) \ + _LT_AC_TAGVAR(include_expsyms, $1); do case $var in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + _LT_AC_TAGVAR(old_archive_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ + _LT_AC_TAGVAR(archive_cmds, $1) | \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(module_cmds, $1) | \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -2464,14 +3918,31 @@ if test -f "$ltmain"; then esac done - cat <<__EOF__ > "${ofile}T" -#! $SHELL + case $lt_echo in + *'\[$]0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` + ;; + esac -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +ifelse([$1], [], + [cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + AC_MSG_NOTICE([creating $ofile])], + [cfgfile="$ofile"]) + + cat <<__EOF__ >> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -2493,17 +3964,21 @@ if test -f "$ltmain"; then # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed that does not truncate output. +# A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="${SED} -e s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# ### BEGIN LIBTOOL CONFIG +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -2517,7 +3992,10 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$need_lc +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -2533,14 +4011,20 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# The default C compiler. -CC=$lt_CC +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) # Is the compiler the GNU C compiler? -with_gcc=$GCC +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP # The linker used to build libraries. -LD=$lt_LD +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) # Whether we need hard or soft links. LN_S=$lt_LN_S @@ -2549,7 +4033,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$STRIP +STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -2561,7 +4045,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -2571,7 +4055,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_wl +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) # Object file suffix (normally "o"). objext="$ac_objext" @@ -2579,18 +4063,21 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_pic_flag +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) pic_mode=$pic_mode -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_compiler_c_o +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len -# Can we write directly to a .lo ? -compiler_o_lo=$lt_compiler_o_lo +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -2611,19 +4098,19 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_link_static_flag +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_no_builtin_flag +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) # Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) # Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) # Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) # Library versioning type. version_type=$version_type @@ -2640,26 +4127,50 @@ soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) # Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) # Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -2667,10 +4178,10 @@ deplibs_check_method=$lt_deplibs_check_method file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) # Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds @@ -2679,13 +4190,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_global_symbol_pipe +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -2697,36 +4208,45 @@ shlibpath_var=$shlibpath_var shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) # Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. -hardcode_direct=$hardcode_direct +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. -hardcode_minus_L=$hardcode_minus_L +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec @@ -2735,30 +4255,33 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" # Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) # The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) # Symbols that must always be exported. -include_expsyms=$lt_include_expsyms +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) -# ### END LIBTOOL CONFIG +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) __EOF__ +ifelse([$1],[], [ case $host_os in aix3*) - cat <<\EOF >> "${ofile}T" + cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -2771,11 +4294,1551 @@ EOF ;; esac + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDRT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in - cygwin* | mingw* | pw32* | os2*) - cat <<'EOF' >> "${ofile}T" - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi[[45]]*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include @@ -2809,748 +5872,13 @@ EOF # return TRUE; # } # /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# 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 of the License, 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. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# /* O_BINARY isn't required (or even defined sometimes) under Unix */ -# #ifndef O_BINARY -# #define O_BINARY 0 -# #endif -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (dll < 1) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) - - mv -f "${ofile}T" "$ofile" || \ - (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") - chmod +x "$ofile" -fi - -])# _LT_AC_LTCONFIG_HACK - -# 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)]) +])# _LT_AC_FILE_LTDLL_C -# 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 -]) +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) -# 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 <&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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])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=$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_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 &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 dependent 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 -aix4* | aix5*) - 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` - ;; - *) # 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* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # 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 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) - 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 - ;; - -newos6*) - 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 - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -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 - 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*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - 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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl -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=$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 LTDLINCL to the include flags for -# the libltdl header and adds --enable-ltdl-convenience to the -# configure arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library and LTDLINCL to the include flags for -# the libltdl header and adds --enable-ltdl-install to the configure -# arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) @@ -3564,6 +5892,16 @@ AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # @@ -3577,79 +5915,51 @@ AC_DEFUN([LT_AC_PROG_SED], AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. -as_executable_p="test -f" 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_prog in sed gsed; do + for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done - - # 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 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/sed$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - { (exit 1); exit 1; } -} - _max=0 - _count=0 - # Add /usr/xpg4/bin/sed as it is typically found on Solaris - # along with /bin/sed that truncates output. - for _sed in $_sed_list /usr/xpg4/bin/sed; do - test ! -f ${_sed} && break - cat /dev/null > "$tmp/sed.in" - _count=0 - echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" - # Check for GNU sed and select it if it is found. - if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then - lt_cv_path_SED=${_sed} - break +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed fi - while true; do - cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" - mv "$tmp/sed.tmp" "$tmp/sed.in" - cp "$tmp/sed.in" "$tmp/sed.nl" - echo >>"$tmp/sed.nl" - ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break - cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break - # 40000 chars as input seems more than enough - test $_count -gt 10 && break - _count=`expr $_count + 1` - if test $_count -gt $_max; then - _max=$_count - lt_cv_path_SED=$_sed - fi - done done - rm -rf "$tmp" +done ]) -if test "X$SED" != "X"; then - lt_cv_path_SED=$SED -else - SED=$lt_cv_path_SED -fi +SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) @@ -3657,7 +5967,7 @@ AC_MSG_RESULT([$SED]) dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN(PKG_CHECK_MODULES, [ +AC_DEFUN([PKG_CHECK_MODULES], [ succeeded=no if test -z "$PKG_CONFIG"; then @@ -3740,7 +6050,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # 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.9.2])]) + [AM_AUTOMAKE_VERSION([1.9.1])]) # AM_AUX_DIR_EXPAND diff --git a/compile b/compile index 80b645b0..a81e000a 100755 --- a/compile +++ b/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand `-c -o'. -scriptversion=2004-09-10.20 +scriptversion=2003-11-09.00 -# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -55,41 +55,37 @@ EOF ;; esac + +prog=$1 +shift + ofile= cfile= -eat= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we strip `-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi +args= +while test $# -gt 0; do + case "$1" in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we do something ugly here. + ofile=$2 + shift + case "$ofile" in + *.o | *.obj) + ;; + *) + args="$args -o $ofile" + ofile= + ;; + esac + ;; + *.c) + cfile=$1 + args="$args $1" + ;; + *) + args="$args $1" + ;; + esac shift done @@ -99,36 +95,36 @@ if test -z "$ofile" || test -z "$cfile"; then # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. - exec "$@" + exec "$prog" $args fi # Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` +cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` # Create the lock directory. # Note: use `[/.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d +lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then + if mkdir $lockdir > /dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 +trap "rmdir $lockdir; exit 1" 1 2 15 # Run the compile. -"$@" -ret=$? +"$prog" $args +status=$? if test -f "$cofile"; then mv "$cofile" "$ofile" fi -rmdir "$lockdir" -exit $ret +rmdir $lockdir +exit $status # Local Variables: # mode: shell-script diff --git a/config.guess b/config.guess index 7d0185e0..d949270a 100755 --- a/config.guess +++ b/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-09-07' +timestamp='2004-08-11' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -136,6 +136,16 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -203,6 +213,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -227,12 +240,18 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; sgi:OpenBSD:*:*) - echo mips64-unknown-openbsd${UNAME_RELEASE} + echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -819,25 +838,19 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux-gnu - exit 0 ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit 0 ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo cris-axis-linux exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -856,7 +869,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -875,13 +888,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-${VENDOR}-linux exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-${VENDOR}-linux exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -894,34 +907,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-${VENDOR}-linux ;; + PA8*) echo hppa2.0-${VENDOR}-linux ;; + *) echo hppa-${VENDOR}-linux ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-${VENDOR}-linux exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo x86_64-${VENDOR}-linux exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -936,18 +949,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" + echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" + echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or + # Either a pre-BFD a.out linker (linuxoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -976,7 +989,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.h.in b/config.h.in index 8fd0f7b9..4e8af4c5 100644 --- a/config.h.in +++ b/config.h.in @@ -93,6 +93,9 @@ /* Define to 1 if you have the `regcomp' function. */ #undef HAVE_REGCOMP +/* Define to 1 if you have the `SetFilePointerEx' function. */ +#undef HAVE_SETFILEPOINTEREX + /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE diff --git a/config.sub b/config.sub index edb6b663..236e424d 100755 --- a/config.sub +++ b/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-08-29' +timestamp='2004-06-24' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -457,9 +457,6 @@ case $basic_machine in crds | unos) basic_machine=m68k-crds ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; @@ -1164,7 +1161,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1197,9 +1194,6 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index 5c3c61c8..05f061da 100755 --- a/configure +++ b/configure @@ -243,17 +243,6 @@ IFS=" $as_nl" $as_unset CDPATH -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi - # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -272,7 +261,7 @@ if test "X$1" = X--no-reexec; then elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else @@ -284,14 +273,14 @@ if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -318,8 +307,9 @@ else # # So, first we look for a working echo in the user's PATH. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -328,7 +318,7 @@ else break fi done - IFS="$save_ifs" + IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -402,6 +392,11 @@ fi + +tagnames=${tagnames+${tagnames},}CXX + +tagnames=${tagnames+${tagnames},}F77 + # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. @@ -471,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 ECHO RANLIB ac_ct_RANLIB CPP EGREP LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -932,6 +927,26 @@ ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +ac_env_CXXCPP_set=${CXXCPP+set} +ac_env_CXXCPP_value=$CXXCPP +ac_cv_env_CXXCPP_set=${CXXCPP+set} +ac_cv_env_CXXCPP_value=$CXXCPP +ac_env_F77_set=${F77+set} +ac_env_F77_value=$F77 +ac_cv_env_F77_set=${F77+set} +ac_cv_env_F77_value=$F77 +ac_env_FFLAGS_set=${FFLAGS+set} +ac_env_FFLAGS_value=$FFLAGS +ac_cv_env_FFLAGS_set=${FFLAGS+set} +ac_cv_env_FFLAGS_value=$FFLAGS # # Report the --help message. @@ -1014,8 +1029,10 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-shared=PKGS build shared libraries default=yes - --enable-static=PKGS build static libraries default=yes + --enable-shared[=PKGS] + build shared libraries [default=yes] + --enable-static[=PKGS] + build static libraries [default=yes] --enable-debug enable additional debugging code and output --disable-default-device-io-ops do not provide default device io operations @@ -1025,15 +1042,19 @@ Optional Features: --enable-warnings enable additional compiler warnings --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors - --enable-fast-install=PKGS optimize for fast installation 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 + --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] + --with-tags[=TAGS] + include additional configurations [automatic] Some influential environment variables: CC C compiler command @@ -1043,6 +1064,11 @@ Some influential environment variables: CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2019,47 +2045,51 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' 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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else enable_static=yes fi; + # This is required to get past a stupid configure bug when making the rpm. # Basically it is broken to specify the host as a command line argument to # configure on its own, i.e. without giving --host=. It is supposed to work @@ -3383,35 +3413,98 @@ fi 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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else enable_fast_install=yes fi; -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done + fi +SED=$lt_cv_path_SED +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 + +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 + 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then @@ -3423,8 +3516,8 @@ 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 + echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -3434,12 +3527,12 @@ echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 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'` + # Canonicalize the pathname 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%/%"` + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -3463,22 +3556,26 @@ if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do + IFS="$lt_save_ifs" 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 + case `"$lt_cv_path_LD" -v 2>&1 &6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then +case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 @@ -3522,7 +3622,20 @@ 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" +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 @@ -3533,120 +3646,42 @@ else # Let the user override the test. lt_cv_path_NM="$NM" else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" 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 + 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 + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) 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 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + 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 + ;; + esac + esac fi done - IFS="$ac_save_ifs" + IFS="$lt_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi - +echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6 NM="$lt_cv_path_NM" -echo "$as_me:$LINENO: result: $NM" >&5 -echo "${ECHO_T}$NM" >&6 - -echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_executable_p="test -f" -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_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" - fi - done - done -done - - # 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 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/sed$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - { (exit 1); exit 1; } -} - _max=0 - _count=0 - # Add /usr/xpg4/bin/sed as it is typically found on Solaris - # along with /bin/sed that truncates output. - for _sed in $_sed_list /usr/xpg4/bin/sed; do - test ! -f ${_sed} && break - cat /dev/null > "$tmp/sed.in" - _count=0 - echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" - # Check for GNU sed and select it if it is found. - if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then - lt_cv_path_SED=${_sed} - break - fi - while true; do - cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" - mv "$tmp/sed.tmp" "$tmp/sed.in" - cp "$tmp/sed.in" "$tmp/sed.nl" - echo >>"$tmp/sed.nl" - ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break - cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break - # 40000 chars as input seems more than enough - test $_count -gt 10 && break - _count=`expr $_count + 1` - if test $_count -gt $_max; then - _max=$_count - lt_cv_path_SED=$_sed - fi - done - done - rm -rf "$tmp" - -fi - -if test "X$SED" != "X"; then - lt_cv_path_SED=$SED -else - SED=$lt_cv_path_SED -fi -echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6 echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 @@ -3663,7 +3698,7 @@ lt_cv_deplibs_check_method='unknown' # '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. +# which responds to the $file_magic_cmd with a given extended 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. @@ -3676,31 +3711,30 @@ beos*) lt_cv_deplibs_check_method=pass_all ;; -bsdi4*) +bsdi[45]*) 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*) +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump'. 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac + lt_cv_deplibs_check_method=pass_all ;; -freebsd*) +freebsd* | kfreebsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -3720,50 +3754,53 @@ 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' +hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + 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_test_file=/usr/lib/libc.sl + ;; + esac ;; irix5* | irix6* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # 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" - ;; + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; 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*) +linux*) case $host_cpu in - alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) + alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM + # this will be overridden with pass_all, but let us keep it just in case 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` + lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; @@ -3773,20 +3810,19 @@ newos6*) lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; 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 ;; @@ -3795,11 +3831,6 @@ sco3.2v5*) ;; 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 ;; @@ -3826,6 +3857,10 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ;; esac ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; esac fi @@ -3833,211 +3868,210 @@ 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 +test -z "$deplibs_check_method" && deplibs_check_method=unknown +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +# 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 && enable_libtool_lock=yes -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo "$as_me:$LINENO: checking command to parse $NM output" >&5 -echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris* | sysv5*) - symcode='[BDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $host_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[ABCDGISTW]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. -lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext < 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 - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 3914 "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); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + 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 + fi + rm -rf conftest* + ;; - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > 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.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; -EOF - # Now generate the symbol file. - eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' +*-*-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 -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = +int +main () { -EOF - sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr) 0} -}; -#ifdef __cplusplus + ; + return 0; } -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); } && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" -if test -z "$lt_cv_sys_global_symbol_pipe"; then - global_symbol_to_cdecl= - global_symbol_to_c_name_address= + (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 - global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" - global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no fi -if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; -then - echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6 -else - echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6 +rm -f conftest.err 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 + +need_locks="$enable_libtool_lock" + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4274,21 +4308,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 - 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - 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 @@ -4677,150 +4696,1372 @@ fi done - - - - - -# 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 +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + 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_CXX+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 <&2 + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -*** 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 +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&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 + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +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_CXX+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 <&2 + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -*** 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 +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# 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 &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +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_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" else - MAGIC_CMD=: + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + '' \ + '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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err 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 + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +depcc="$CXX" 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_CXX_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_CXX_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 + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch 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 + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_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 +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +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 + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6 +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +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 \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran + 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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # 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_F77="$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 +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran +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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +echo "${ECHO_T}$ac_ct_F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_F77" && break +done + + F77=$ac_ct_F77 +fi + + +# Provide some information about the compiler. +echo "$as_me:5486:" \ + "checking for Fortran 77 compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err conftest.$ac_objext conftest.$ac_ext +ac_cv_f77_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_f77_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_f77_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= fi fi +G77=`test $ac_compiler_gnu = yes && echo yes` +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 + + + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* ) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDRT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + 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); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6 +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES fi ;; esac +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" + 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_AR" && ac_cv_prog_ac_ct_AR="false" +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +fi + 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 @@ -4982,168 +6223,6 @@ else fi -enable_dlopen=no -enable_win32_dll=no - -# 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 && enable_libtool_lock=yes - -# 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 5000 "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* - ;; - -*-*-linux*) - # Test if the compiler is 64bit - echo 'int i;' > conftest.$ac_ext - lt_cv_cc_64bit_output=no - 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 - *"ELF 64"*) - lt_cv_cc_64bit_output=yes - ;; - 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 -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" -need_locks="$enable_libtool_lock" - old_CC="$CC" old_CFLAGS="$CFLAGS" @@ -5152,40 +6231,18 @@ test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm +test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o -if test x"$host" != x"$build"; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case $host_os in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' @@ -5203,24 +6260,152 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="$2" +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` -echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs +# 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 - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -echo "$as_me:$LINENO: result: $objdir" >&5 -echo "${ECHO_T}$objdir" >&6 + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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 + +enable_dlopen=no +enable_win32_dll=no + +# 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 && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. @@ -5232,453 +6417,455 @@ else fi; test -z "$pic_mode" && pic_mode=default -# We assume here that the value for lt_cv_prog_cc_pic will not be cached -# in isolation, and that seeing it set (from the cache) indicates that -# the associated values are set (in the cache) correctly too. -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 -if test "${lt_cv_prog_cc_pic+set}" = set; then +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +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 + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# +# Check for any special shared library compilation flags. +# +lt_prog_cc_shlib= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + lt_prog_cc_shlib='-belf' + ;; + esac +fi +if test -n "$lt_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 +if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_cv_prog_cc_pic= - lt_cv_prog_cc_shlib= - lt_cv_prog_cc_wl= - lt_cv_prog_cc_static= - lt_cv_prog_cc_no_builtin= - lt_cv_prog_cc_can_build_shared=$can_build_shared + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_prog_compiler_static" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 + +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6536: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6540: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-static' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' case $host_os in - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # not sure about C++ programs. - lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi ;; + amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. - lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - lt_cv_prog_cc_pic='-fno-common' + lt_prog_compiler_pic='-fno-common' ;; - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no ;; + sysv4*MP*) if test -d /usr/nec; then - lt_cv_prog_cc_pic=-Kconform_pic + lt_prog_compiler_pic=-Kconform_pic fi ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + *) - lt_cv_prog_cc_pic='-fPIC' + lt_prog_compiler_pic='-fPIC' ;; esac else - # PORTME Check for PIC flags for the system compiler. + # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in - aix3* | aix4* | aix5*) - lt_cv_prog_cc_wl='-Wl,' - # All AIX code is PIC. + aix*) + lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_static='-Bstatic' else - lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + lt_prog_compiler_pic='-qnocommon' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; hpux9* | hpux10* | hpux11*) - # Is there a better lt_cv_prog_cc_static that works with the bundled CC? - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" - lt_cv_prog_cc_pic='+Z' + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' + lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' + lt_prog_compiler_static='-non_shared' ;; newsos6) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + esac ;; osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' + lt_prog_compiler_static='-non_shared' ;; sco3.2v5*) - lt_cv_prog_cc_pic='-Kpic' - lt_cv_prog_cc_static='-dn' - lt_cv_prog_cc_shlib='-belf' + lt_prog_compiler_pic='-Kpic' + lt_prog_compiler_static='-dn' ;; solaris*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' ;; sunos4*) - lt_cv_prog_cc_pic='-PIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Qoption ld ' + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - uts4*) - lt_cv_prog_cc_pic='-pic' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then - lt_cv_prog_cc_pic='-Kconform_pic' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' fi ;; + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + *) - lt_cv_prog_cc_can_build_shared=no + lt_prog_compiler_can_build_shared=no ;; esac fi -fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic" >&6 -if test -z "$lt_cv_prog_cc_pic"; then - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 -else - echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then - # Check to make sure the pic_flag actually works. - echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 - if test "${lt_cv_prog_cc_pic_works+set}" = set; then +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6779: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6783: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works=yes + fi + fi + $rm conftest* -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - case $host_os in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then - # they create non-PIC objects. So, if there were any warnings, we - # assume that PIC is not supported. - if test -s conftest.err; then - lt_cv_prog_cc_pic_works=no - else - lt_cv_prog_cc_pic_works=yes - fi - ;; - *) - lt_cv_prog_cc_pic_works=yes - ;; - esac +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 +if test x"$lt_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - lt_cv_prog_cc_pic_works=no - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no fi - - if test "X$lt_cv_prog_cc_pic_works" = Xno; then - lt_cv_prog_cc_pic= - lt_cv_prog_cc_can_build_shared=no - else - lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" - fi - - echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac -# Check for any special shared library compilation flags. -if test -n "$lt_cv_prog_cc_shlib"; then - { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - -echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 -if test "${lt_cv_prog_cc_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_cc_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_prog_cc_static_works=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi - - -# Belt *and* braces to stop my trousers falling down: -test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 - -pic_flag="$lt_cv_prog_cc_pic" -special_shlib_compile_flags="$lt_cv_prog_cc_shlib" -wl="$lt_cv_prog_cc_wl" -link_static_flag="$lt_cv_prog_cc_static" -no_builtin_flag="$lt_cv_prog_cc_no_builtin" -can_build_shared="$lt_cv_prog_cc_can_build_shared" - - -# Check to see if options -o and -c are simultaneously supported by compiler echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_compiler_c_o+set}" = set; then +if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -echo "int some_variable = 0;" > conftest.$ac_ext -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" -compiler_c_o=no -if { (eval echo configure:5576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - lt_cv_compiler_c_o=no - else - lt_cv_compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&5 - lt_cv_compiler_c_o=no -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6839: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:6843: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 -compiler_c_o=$lt_cv_compiler_c_o -echo "$as_me:$LINENO: result: $compiler_c_o" >&5 -echo "${ECHO_T}$compiler_c_o" >&6 -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 - if test "${lt_cv_compiler_o_lo+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - lt_cv_compiler_o_lo=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - save_objext="$ac_objext" - ac_objext=lo - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -int some_variable = 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - lt_cv_compiler_o_lo=no - else - lt_cv_compiler_o_lo=yes - fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_objext="$save_objext" - CFLAGS="$save_CFLAGS" - -fi - - compiler_o_lo=$lt_cv_compiler_o_lo - echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 -echo "${ECHO_T}$compiler_o_lo" >&6 -else - compiler_o_lo=no -fi - -# Check to see if we can do hard links to lock some files if needed hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 @@ -5699,15 +6886,324 @@ else need_locks=no fi -if test "$GCC" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 - echo "int some_variable = 0;" > conftest.$ac_ext - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" - compiler_rtti_exceptions=no - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag= + enable_shared_with_static_runtimes=no + archive_cmds= + archive_expsym_cmds= + old_archive_From_new_cmds= + old_archive_from_expsyms_cmds= + export_dynamic_flag_spec= + whole_archive_flag_spec= + thread_safe_flag_spec= + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + link_all_deplibs=unknown + hardcode_automatic=no + module_cmds= + module_expsym_cmds= + always_export_symbols=no + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds="$tmp_archive_cmds" + fi + else + ld_shlibs=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5717,14 +7213,14 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -int some_variable = 0; + ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -5738,788 +7234,584 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { 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 - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - compiler_rtti_exceptions=no - else - compiler_rtti_exceptions=yes - fi +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$compiler_rtti_exceptions" >&6 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi -fi + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -# See if the linker supports building shared libraries. -echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 +int +main () +{ -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -old_archive_from_expsyms_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_into_libs=no -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -link_all_deplibs=unknown -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. -extract_expsyms_cmds= + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 -case $host_os in -cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; -openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ - sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ - test -f $output_objdir/impgen.exe || (cd $output_objdir && \ - if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ - else $CC -o impgen impgen.c ; fi)~ - $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' - - old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' - - # cygwin and mingw dlls have different entry points and sets of symbols - # to exclude. - # FIXME: what about values for MSVC? - dll_entry=__cygwin_dll_entry@12 - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ - case $host_os in - mingw*) - # mingw values - dll_entry=_DllMainCRTStartup@12 - dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ - ;; - esac - - # mingw and cygwin differ, and it's simplest to just exclude the union - # of the two symbol sets. - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one (in ltdll.c) - if test "x$lt_cv_need_dllmain" = "xyes"; then - ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " - ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ - test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' - else - ltdll_obj= - ltdll_cmds= - fi - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left be newer dlltools. - export_symbols_cmds="$ltdll_cmds"' - $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' - - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is. - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname-def; - else - echo EXPORTS > $output_objdir/$soname-def; - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \$# in - 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; - 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; - *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done; - fi~ - '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw* | pw32*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - hardcode_direct=yes - archive_cmds='' - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - shared_flag='${wl}-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec=' ' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi - fi - - # It seems that -bexpall can do strange things, so it is better to - # generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='${wl}-berok' - # This is a bit strange, but is similar to how AIX traditionally builds - # it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' ;; - *) # Darwin 1.3 on - allow_undefined_flag='-flat_namespace -undefined suppress' + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' - # We need to add '_' to the symbols in $export_symbols first - #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - hardcode_direct=yes - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load $convenience' - ;; - freebsd1*) - ld_shlibs=no - ;; + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case $host_os in - hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else + darwin* | rhapsody*) case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; + rhapsody* | darwin1.[012]) + allow_undefined_flag='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs=no + ;; esac fi - ;; + ;; - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; + freebsd1*) + ld_shlibs=no + ;; - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + ia64*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + hardcode_shlibpath_var=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + *) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld='-rpath $libdir' + fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; - #Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - export_dynamic_flag_spec='${wl}-Bexport' - ;; + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; - solaris*) - # gcc --version < 3.0 without binutils cannot create self contained - # shared libraries reliably, requiring libgcc.a to resolve some of - # the object symbols generated in some cases. Libraries that use - # assert need libgcc.a to resolve __eprintf, for example. Linking - # a copy of libgcc.a into every shared library to guarantee resolving - # such symbols causes other problems: According to Tim Van Holder - # , C++ libraries end up with a separate - # (to the application) exception stack for one thing. - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - [12].*) - cat <&2 + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; -*** Warning: Releases of GCC earlier than version 3.0 cannot reliably -*** create self contained shared libraries on Solaris systems, without -*** introducing a dependency on libgcc.a. Therefore, libtool is disabling -*** -no-undefined support, which will at least allow you to build shared -*** libraries. However, you may find that when you link such libraries -*** into an application without using GCC, you have to manually add -*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to -*** upgrade to a newer version of GCC. Another option is to rebuild your -*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; -EOF - no_undefined_flag= - ;; - esac - fi - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then + sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no + export_dynamic_flag_spec='${wl}-Bexport' runpath_var=LD_RUN_PATH hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; + ;; - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; + solaris*) + no_undefined_flag=' -z text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; - sysv5uw7* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + fi - *) - ld_shlibs=no - ;; - esac -fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no -# Check hardcoding attributes. -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +echo "${ECHO_T}$archive_cmds_need_lc" >&6 + ;; + esac fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6 + ;; +esac -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -reload_cmds='$LD$reload_flag -o $output$reload_objs' -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -# PORTME Fill in your ld.so characteristics echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -6528,17 +7820,36 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) @@ -6548,7 +7859,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -6558,57 +7869,54 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can - # not hardcode correct soname into executable. Probably we can - # add versioning support to collect2, so additional links can - # be useful in future. + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}.so$major' + soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi - hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) - library_names_spec='${libname}.so' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -6616,29 +7924,55 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows + shrext_cmds=".dll" need_version=no need_lib_prefix=no + case $GCC,$host_os in - yes,cygwin*) + yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog .libs/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac ;; - yes,mingw*) - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` - ;; - yes,pw32*) - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' - ;; + *) - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -6651,30 +7985,56 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' - soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -6683,7 +8043,11 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - *) + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -6694,8 +8058,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -6703,14 +8067,45 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. - dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -6718,21 +8113,29 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) version_type=irix ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -6741,20 +8144,21 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) +linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. -linux-gnu*) +linux*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -6763,12 +8167,11 @@ linux-gnu*) # before this can be enabled. hardcode_into_libs=yes - case $host_cpu:$lt_cv_cc_64bit_output in - powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" - ;; - esac + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -6779,17 +8182,29 @@ linux-gnu*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -6799,7 +8214,17 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -6808,46 +8233,47 @@ openbsd*) version_type=sunos need_lib_prefix=no need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case "$host_os" in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' + shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf + need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; @@ -6855,8 +8281,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -6866,7 +8292,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -6878,8 +8304,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -6900,31 +8326,22 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + *) dynamic_linker=no ;; @@ -6933,42 +8350,33 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no -# Report the final consequences. -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var" || \ + test "X$hardcode_automatic" = "Xyes" ; then -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported @@ -6979,9 +8387,33 @@ elif test "$shlibpath_overrides_runpath" = yes || enable_fast_install=needless fi -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac fi if test "x$enable_dlopen" != xyes; then @@ -6999,11 +8431,94 @@ else lt_cv_dlopen_self=yes ;; - cygwin* | mingw* | pw32*) + mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 @@ -7487,7 +9002,7 @@ fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" @@ -7503,10 +9018,10 @@ else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 fi -if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. +# Report which librarie types wil actually be built +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - if test "${lt_cv_archive_cmds_need_lc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - $rm conftest* - echo 'static int dummy;' > conftest.$ac_ext +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 - 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 - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_cv_prog_cc_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi -fi +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 - echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 -echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 - ;; - esac -fi -need_lc=${lt_cv_archive_cmds_need_lc-yes} - -# The second clause should only fire when bootstrapping the +# The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - : -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi - -if test -f "$ltmain"; then - trap "$rm \"${ofile}T\"; exit 1" 1 2 15 - $rm -f "${ofile}T" - - echo creating $ofile - + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS SED \ - AR AR_FLAGS CC LD LN_S NM SHELL \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ - postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ - old_striplib striplib file_magic_cmd export_symbols_cmds \ - deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - global_symbol_to_c_name_address \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + old_postinstall_cmds old_postuninstall_cmds \ + compiler \ + CC \ + LD \ + lt_prog_compiler_wl \ + lt_prog_compiler_pic \ + lt_prog_compiler_static \ + lt_prog_compiler_no_builtin_flag \ + export_dynamic_flag_spec \ + thread_safe_flag_spec \ + whole_archive_flag_spec \ + enable_shared_with_static_runtimes \ + old_archive_cmds \ + old_archive_from_new_cmds \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + exclude_expsyms \ + include_expsyms; do case $var in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -7820,14 +9340,29 @@ if test -f "$ltmain"; then esac done - cat <<__EOF__ > "${ofile}T" + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" #! $SHELL -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -7849,15 +9384,18 @@ if test -f "$ltmain"; then # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed that does not truncate output. +# A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="${SED} -e s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= # ### BEGIN LIBTOOL CONFIG @@ -7873,7 +9411,10 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$need_lc +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -7889,12 +9430,18 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# The default C compiler. -CC=$lt_CC +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC +# An ERE matcher. +EGREP=$lt_EGREP + # The linker used to build libraries. LD=$lt_LD @@ -7905,7 +9452,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$STRIP +STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -7917,7 +9464,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -7927,7 +9474,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_wl +wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -7935,18 +9482,21 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_pic_flag +pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_compiler_c_o +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len -# Can we write directly to a .lo ? -compiler_o_lo=$lt_compiler_o_lo +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -7967,10 +9517,10 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_link_static_flag +link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_no_builtin_flag +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec @@ -8012,10 +9562,34 @@ archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -8035,13 +9609,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_global_symbol_pipe +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -8062,10 +9636,15 @@ hardcode_into_libs=$hardcode_into_libs # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct @@ -8077,6 +9656,10 @@ hardcode_minus_L=$hardcode_minus_L # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic + # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" @@ -8112,9 +9695,10 @@ include_expsyms=$lt_include_expsyms __EOF__ + case $host_os in aix3*) - cat <<\EOF >> "${ofile}T" + cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -8123,186 +9707,6 @@ if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi -EOF - ;; - esac - - case $host_os in - cygwin* | mingw* | pw32* | os2*) - cat <<'EOF' >> "${ofile}T" - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# 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 of the License, 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. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# /* O_BINARY isn't required (or even defined sometimes) under Unix */ -# #ifndef O_BINARY -# #define O_BINARY 0 -# #endif -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (dll < 1) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - mv -f "${ofile}T" "$ofile" || \ - (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi 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 + +CC="$lt_save_CC" + + +# Check whether --with-tags or --without-tags was given. +if test "${with_tags+set}" = set; then + withval="$with_tags" + tagnames="$withval" +fi; + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} + else + { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 +echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in + "") ;; + *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 +echo "$as_me: error: invalid tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 +echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} + { (exit 1); exit 1; }; } + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_flag_spec_ld_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_automatic_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +compiler_CXX=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +else + lt_prog_compiler_no_builtin_flag_CXX= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + +# 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 $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $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. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname 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 + 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 + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + 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. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +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. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 +ld_shlibs_CXX=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_CXX=yes + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_CXX=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX=' ' + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs_CXX=no + fi + ;; + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_CXX=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + freebsd12*) + # C++ shared libraries reported to be fairly broken before switch to ELF + ld_shlibs_CXX=no + ;; + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + gnu*) + ;; + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC) + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_CXX='+b $libdir' + hardcode_libdir_separator_CXX=: + ;; + ia64*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + *) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + openbsd*) + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + sco*) + archive_cmds_need_lc_CXX=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.0-5 | solaris2.0-5.*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + archive_cmds_need_lc_CXX=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; +esac +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +GCC_CXX="$GXX" +LD_CXX="$LD" + + +cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + +lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + lt_prog_compiler_pic_CXX='-qnocommon' + lt_prog_compiler_wl_CXX='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + icpc) + # Intel C++ + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11311: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:11315: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 + +if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11371: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:11375: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_CXX=no + else + archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var_CXX" || \ + test "X$hardcode_automatic_CXX" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 +echo "${ECHO_T}$hardcode_action_CXX" >&6 + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_CXX \ + CC_CXX \ + LD_CXX \ + lt_prog_compiler_wl_CXX \ + lt_prog_compiler_pic_CXX \ + lt_prog_compiler_static_CXX \ + lt_prog_compiler_no_builtin_flag_CXX \ + export_dynamic_flag_spec_CXX \ + thread_safe_flag_spec_CXX \ + whole_archive_flag_spec_CXX \ + enable_shared_with_static_runtimes_CXX \ + old_archive_cmds_CXX \ + old_archive_from_new_cmds_CXX \ + predep_objects_CXX \ + postdep_objects_CXX \ + predeps_CXX \ + postdeps_CXX \ + compiler_lib_search_path_CXX \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_CXX + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS=$lt_AS + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_CXX +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_CXX + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_CXX" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld + + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + +archive_cmds_need_lc_F77=no +allow_undefined_flag_F77= +always_export_symbols_F77=no +archive_expsym_cmds_F77= +export_dynamic_flag_spec_F77= +hardcode_direct_F77=no +hardcode_libdir_flag_spec_F77= +hardcode_libdir_flag_spec_ld_F77= +hardcode_libdir_separator_F77= +hardcode_minus_L_F77=no +hardcode_automatic_F77=no +module_cmds_F77= +module_expsym_cmds_F77= +link_all_deplibs_F77=unknown +old_archive_cmds_F77=$old_archive_cmds +no_undefined_flag_F77= +whole_archive_flag_spec_F77= +enable_shared_with_static_runtimes_F77=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +objext_F77=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code=" subroutine t\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +compiler_F77=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4* | aix5*) + test "$enable_shared" = yes && enable_static=no + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +test "$ld_shlibs_F77" = no && can_build_shared=no + +GCC_F77="$G77" +LD_F77="$LD" + +lt_prog_compiler_wl_F77= +lt_prog_compiler_pic_F77= +lt_prog_compiler_static_F77= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_static_F77='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_F77=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_F77=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_F77='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + else + lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + lt_prog_compiler_pic_F77='-qnocommon' + lt_prog_compiler_wl_F77='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-static' + ;; + ccc*) + lt_prog_compiler_wl_F77='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_F77='-Kpic' + lt_prog_compiler_static_F77='-dn' + ;; + + solaris*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl_F77='-Qoption ld ' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_F77='-Kconform_pic' + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic_F77='-pic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_F77"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13667: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:13671: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 + +if test x"$lt_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_F77=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13727: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:13731: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_F77=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_F77= + enable_shared_with_static_runtimes_F77=no + archive_cmds_F77= + archive_expsym_cmds_F77= + old_archive_From_new_cmds_F77= + old_archive_from_expsyms_cmds_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + thread_safe_flag_spec_F77= + hardcode_libdir_flag_spec_F77= + hardcode_libdir_flag_spec_ld_F77= + hardcode_libdir_separator_F77= + hardcode_direct_F77=no + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=unsupported + link_all_deplibs_F77=unknown + hardcode_automatic_F77=no + module_cmds_F77= + module_expsym_cmds_F77= + always_export_symbols_F77=no + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_F77= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_F77=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + sunos4*) + archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds_F77="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_F77="$tmp_archive_cmds" + fi + else + ld_shlibs_F77=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + + if test "$ld_shlibs_F77" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=yes + archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_F77=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_F77=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_F77=yes + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_F77=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_F77='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_F77="-z nodefs" + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_F77=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_F77=' ' + archive_cmds_need_lc_F77=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_F77=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_F77=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_F77=' ' + allow_undefined_flag_F77=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_F77='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_F77=yes + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_F77=no + hardcode_direct_F77=no + hardcode_automatic_F77=yes + hardcode_shlibpath_var_F77=unsupported + whole_archive_flag_spec_F77='' + link_all_deplibs_F77=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_F77=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + freebsd1*) + ld_shlibs_F77=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_F77='+b $libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + ;; + ia64*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + *) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + link_all_deplibs_F77=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_F77='-rpath $libdir' + fi + hardcode_libdir_separator_F77=: + ;; + + sco3.2v5*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_F77=' -z text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_shlibpath_var_F77=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs_F77=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_F77='$CC -r -o $output$reload_objs' + hardcode_direct_F77=no + ;; + motorola) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv4.3*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_F77=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_F77='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv5*) + no_undefined_flag_F77=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_F77= + hardcode_shlibpath_var_F77=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + *) + ld_shlibs_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 +echo "${ECHO_T}$ld_shlibs_F77" >&6 +test "$ld_shlibs_F77" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_F77" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_F77=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_F77 in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_F77 + allow_undefined_flag_F77= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_F77=no + else + archive_cmds_need_lc_F77=yes + fi + allow_undefined_flag_F77=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var_F77" || \ + test "X$hardcode_automatic_F77" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 +echo "${ECHO_T}$hardcode_action_F77" >&6 + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_F77 \ + CC_F77 \ + LD_F77 \ + lt_prog_compiler_wl_F77 \ + lt_prog_compiler_pic_F77 \ + lt_prog_compiler_static_F77 \ + lt_prog_compiler_no_builtin_flag_F77 \ + export_dynamic_flag_spec_F77 \ + thread_safe_flag_spec_F77 \ + whole_archive_flag_spec_F77 \ + enable_shared_with_static_runtimes_F77 \ + old_archive_cmds_F77 \ + old_archive_from_new_cmds_F77 \ + predep_objects_F77 \ + postdep_objects_F77 \ + predeps_F77 \ + postdeps_F77 \ + compiler_lib_search_path_F77 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_F77 + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS=$lt_AS + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_F77 + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_F77 +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_F77 + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_F77 +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_F77 +archive_expsym_cmds=$lt_archive_expsym_cmds_F77 +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_F77 +module_expsym_cmds=$lt_module_expsym_cmds_F77 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_F77 + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_F77 + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_F77 + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_F77 + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_F77 + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_F77 + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_F77 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_F77 + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_F77" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + + + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +objext_GCJ=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +compiler_GCJ=$CC + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +archive_cmds_need_lc_GCJ=no + + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:15762: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:15766: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl_GCJ= +lt_prog_compiler_pic_GCJ= +lt_prog_compiler_static_GCJ= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_static_GCJ='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_GCJ=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_GCJ=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_GCJ='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + else + lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + lt_prog_compiler_pic_GCJ='-qnocommon' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-static' + ;; + ccc*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_GCJ='-Kpic' + lt_prog_compiler_static_GCJ='-dn' + ;; + + solaris*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl_GCJ='-Qoption ld ' + lt_prog_compiler_pic_GCJ='-PIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_GCJ='-Kconform_pic' + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic_GCJ='-pic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_GCJ"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16005: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:16009: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 + +if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_GCJ=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16065: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:16069: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_GCJ=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_GCJ= + enable_shared_with_static_runtimes_GCJ=no + archive_cmds_GCJ= + archive_expsym_cmds_GCJ= + old_archive_From_new_cmds_GCJ= + old_archive_from_expsyms_cmds_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + thread_safe_flag_spec_GCJ= + hardcode_libdir_flag_spec_GCJ= + hardcode_libdir_flag_spec_ld_GCJ= + hardcode_libdir_separator_GCJ= + hardcode_direct_GCJ=no + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=unsupported + link_all_deplibs_GCJ=unknown + hardcode_automatic_GCJ=no + module_cmds_GCJ= + module_expsym_cmds_GCJ= + always_export_symbols_GCJ=no + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_GCJ= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_GCJ=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + sunos4*) + archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds_GCJ="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_GCJ="$tmp_archive_cmds" + fi + else + ld_shlibs_GCJ=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + + if test "$ld_shlibs_GCJ" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=yes + archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_GCJ=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_GCJ=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_GCJ=yes + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_GCJ=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_GCJ='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_GCJ="-z nodefs" + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_GCJ=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_GCJ=' ' + archive_cmds_need_lc_GCJ=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_GCJ=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_GCJ=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_GCJ=' ' + allow_undefined_flag_GCJ=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_GCJ='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_GCJ=yes + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_GCJ=no + hardcode_direct_GCJ=no + hardcode_automatic_GCJ=yes + hardcode_shlibpath_var_GCJ=unsupported + whole_archive_flag_spec_GCJ='' + link_all_deplibs_GCJ=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_GCJ=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + freebsd1*) + ld_shlibs_GCJ=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + ;; + ia64*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + *) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + link_all_deplibs_GCJ=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + allow_undefined_flag_GCJ=unsupported + archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_GCJ='-rpath $libdir' + fi + hardcode_libdir_separator_GCJ=: + ;; + + sco3.2v5*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_GCJ=' -z text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_shlibpath_var_GCJ=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs_GCJ=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_GCJ='$CC -r -o $output$reload_objs' + hardcode_direct_GCJ=no + ;; + motorola) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4.3*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_GCJ=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_GCJ='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv5*) + no_undefined_flag_GCJ=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_GCJ= + hardcode_shlibpath_var_GCJ=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + *) + ld_shlibs_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 +echo "${ECHO_T}$ld_shlibs_GCJ" >&6 +test "$ld_shlibs_GCJ" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_GCJ" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_GCJ=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_GCJ in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ + allow_undefined_flag_GCJ= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_GCJ=no + else + archive_cmds_need_lc_GCJ=yes + fi + allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var_GCJ" || \ + test "X$hardcode_automatic_GCJ" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 +echo "${ECHO_T}$hardcode_action_GCJ" >&6 + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_GCJ \ + CC_GCJ \ + LD_GCJ \ + lt_prog_compiler_wl_GCJ \ + lt_prog_compiler_pic_GCJ \ + lt_prog_compiler_static_GCJ \ + lt_prog_compiler_no_builtin_flag_GCJ \ + export_dynamic_flag_spec_GCJ \ + thread_safe_flag_spec_GCJ \ + whole_archive_flag_spec_GCJ \ + enable_shared_with_static_runtimes_GCJ \ + old_archive_cmds_GCJ \ + old_archive_from_new_cmds_GCJ \ + predep_objects_GCJ \ + postdep_objects_GCJ \ + predeps_GCJ \ + postdeps_GCJ \ + compiler_lib_search_path_GCJ \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_GCJ + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_GCJ + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_GCJ + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS=$lt_AS + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_GCJ + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_GCJ +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_GCJ + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_GCJ +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_GCJ +archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_GCJ +module_expsym_cmds=$lt_module_expsym_cmds_GCJ + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_GCJ + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_GCJ + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_GCJ + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_GCJ + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_GCJ + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_GCJ + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_GCJ + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_GCJ + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_GCJ" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + RC) + + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +compiler_RC=$CC +lt_cv_prog_compiler_c_o_RC=yes + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_RC \ + CC_RC \ + LD_RC \ + lt_prog_compiler_wl_RC \ + lt_prog_compiler_pic_RC \ + lt_prog_compiler_static_RC \ + lt_prog_compiler_no_builtin_flag_RC \ + export_dynamic_flag_spec_RC \ + thread_safe_flag_spec_RC \ + whole_archive_flag_spec_RC \ + enable_shared_with_static_runtimes_RC \ + old_archive_cmds_RC \ + old_archive_from_new_cmds_RC \ + predep_objects_RC \ + postdep_objects_RC \ + predeps_RC \ + postdeps_RC \ + compiler_lib_search_path_RC \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_RC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_RC + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS=$lt_AS + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_RC +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_RC + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_RC + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_RC + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_RC" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + ;; + + *) + { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 +echo "$as_me: error: Unsupported tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 +echo "$as_me: error: unable to update list of available tagged configurations." >&2;} + { (exit 1); exit 1; }; } + fi +fi @@ -8331,6 +19341,24 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion + + + + + + + + + + + + + + + + + + # Enable large file support. # Check whether --enable-largefile or --disable-largefile was given. @@ -11584,8 +22612,9 @@ done + for ac_func in atexit fdatasync hasmntopt memmove memset regcomp setlocale \ - strcasecmp strchr strdup strerror strtol strtoul utime mbsinit + strcasecmp strchr strdup strerror strtol strtoul utime mbsinit SetFilePointerEx do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -11802,6 +22831,13 @@ 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 +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -12414,11 +23450,23 @@ 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,@EGREP@,$EGREP,;t t s,@ECHO@,$ECHO,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@CXXCPP@,$CXXCPP,;t t +s,@F77@,$F77,;t t +s,@FFLAGS@,$FFLAGS,;t t +s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t diff --git a/doc/Makefile.in b/doc/Makefile.in index 97b0c337..6e22c40d 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -52,6 +52,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -62,6 +63,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -73,6 +78,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -102,13 +109,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/include/Makefile.in b/include/Makefile.in index cfc18177..6910f183 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -61,6 +61,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -71,6 +72,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -82,6 +87,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -111,13 +118,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index c55eb7f4..bbd4870e 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -65,6 +65,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -75,6 +76,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -86,6 +91,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -115,13 +122,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/install-sh b/install-sh index dd97db7a..b777f124 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-09-10.20 +scriptversion=2004-07-05.00 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -260,7 +260,7 @@ do rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index de68987c..70d09650 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -107,11 +107,11 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) @@ -127,6 +127,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -137,6 +138,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -148,6 +153,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -177,13 +184,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -406,18 +418,18 @@ distclean-compile: @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c mostlyclean-libtool: -rm -f *.lo diff --git a/ltmain.sh b/ltmain.sh index 239bdefb..a6d78e60 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -24,6 +24,34 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=1.5.8 +TIMESTAMP=" (1.1220.2.118 2004/08/07 12:24:38)" + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. @@ -36,7 +64,7 @@ elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : else # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$0" --no-reexec ${1+"$@"} + exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then @@ -45,22 +73,9 @@ if test "X$1" = X--fallback-echo; then cat <&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 + $echo "$modename: not configured to build any kind of library" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE fi # Global variables. @@ -117,8 +133,237 @@ execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () { + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` + if test "X$win32_nmres" = "Ximport" ; then + win32_libid_type="x86 archive import" + else + win32_libid_type="x86 archive static" + fi + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () { + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () { + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$my_xdir"; then + exit $status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename $darwin_archive` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + # Remove the table of contents from the thin files. + $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true + $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $AR -xo "${darwin_base_archive}" + rm "${darwin_base_archive}" + cd "$darwin_curdir" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + rm -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + (cd $my_xdir && $AR x $my_xabs) || exit $? + fi # $darwin_arches + fi # $run + ;; + *) + # We will extract separately just the conflicting names and we will + # no longer touch any unique names. It is faster to leave these + # extract automatically by $AR in one run. + $show "(cd $my_xdir && $AR x $my_xabs)" + $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? + if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$my_xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} +# End of Shell function definitions +##################################### + +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" + # Parse our command line options once, thoroughly. -while test $# -gt 0 +while test "$#" -gt 0 do arg="$1" shift @@ -134,6 +379,34 @@ do execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; *) eval "$prev=\$arg" ;; @@ -151,18 +424,27 @@ do ;; --version) - echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - exit 0 + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2003 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $EXIT_SUCCESS ;; --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 - exit 0 + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $EXIT_SUCCESS ;; --debug) - echo "$progname: enabling shell trace mode" + $echo "$progname: enabling shell trace mode" set -x + preserve_args="$preserve_args $arg" ;; --dry-run | -n) @@ -170,18 +452,18 @@ do ;; --features) - echo "host: $host" + $echo "host: $host" if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" + $echo "enable shared libraries" else - echo "disable shared libraries" + $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - echo "enable static libraries" + $echo "enable static libraries" else - echo "disable static libraries" + $echo "disable static libraries" fi - exit 0 + exit $EXIT_SUCCESS ;; --finish) mode="finish" ;; @@ -193,6 +475,15 @@ do --quiet | --silent) show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) prevopt="--tag" prev=tag ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" ;; -dlopen) @@ -203,7 +494,7 @@ do -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; *) @@ -216,18 +507,7 @@ done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 - exit 1 -fi - -# Mandrake: (gc) It's bad to link C++ code with GCC, so we need to use the compiler name if provided -if test "$mode" = link && test -n "$archive_cmds" && test -x "/usr/bin/perl"; then - case $nonopt in - *cc | *++ | gcc* | *-gcc* | egcs*) - archive_cmds=`echo $archive_cmds | perl -pe 's/^\S+\s+//'` - archive_cmds="$nonopt $archive_cmds" - archive_expsym_cmds=`echo $archive_expsym_cmds | perl -pe 's/^\S+\s+//'` - archive_expsym_cmds="$nonopt $archive_expsym_cmds" - esac + exit $EXIT_FAILURE fi # If this variable is set in any of the actions, the command in it @@ -239,8 +519,10 @@ if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 case $nonopt in - *cc | *++ | gcc* | *-gcc* | xlc*) + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do @@ -281,7 +563,7 @@ if test -z "$show_help"; then if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. @@ -295,50 +577,154 @@ if test -z "$show_help"; then modename="$modename: compile" # Get the compilation command and the source file. base_compile= - prev= - lastarg= - srcfile="$nonopt" + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes suppress_output= + arg_mode=normal + libobj= + later= - user_target=no for arg do - case $prev in - "") ;; - xcompiler) - # Aesthetically quote the previous argument. - prev= - lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg_mode" in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; - case $arg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi + target ) + libobj="$arg" + arg_mode=normal continue ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; esac - # Accept any command-line options. - case $arg in - -o) - if test "$user_target" != "no"; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - user_target=next - ;; + base_compile="$base_compile $lastarg" + done # for arg + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in -static) build_old_libs=yes continue @@ -353,138 +739,33 @@ if test -z "$show_help"; then pic_mode=no continue ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - continue - ;; esac - - case $user_target in - next) - # The next one is the -o target name - user_target=yes - continue - ;; - yes) - # We got the output file - user_target=set - libobj="$arg" - continue - ;; - esac - - # Accept the current argument as the source file. - lastarg="$srcfile" - srcfile="$arg" - - # Aesthetically quote the previous argument. - - # Backslashify any backslashes, double quotes, and dollar signs. - # These are the only characters that are still specially - # interpreted inside of double-quoted scrings. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $lastarg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi done - case $user_target in - set) - ;; - no) - # Get the name of the library object. - libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - *) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSfmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit 1 - ;; - esac + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then - removelist="$obj $libobj" + removelist="$obj $lobj $libobj ${libobj}T" else - removelist="$libobj" + removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist - trap "$run $rm $removelist; exit 1" 1 2 15 + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in @@ -503,8 +784,9 @@ if test -z "$show_help"; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit 1" 1 2 15 + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else + output_obj= need_locks=no lockfile= fi @@ -512,13 +794,13 @@ if test -z "$show_help"; then # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then - until $run ln "$0" "$lockfile" 2>/dev/null; do + until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then - echo "\ + $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` @@ -530,68 +812,67 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi - echo $srcfile > "$lockfile" + $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != x"$srcfile"; then - echo "\ + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -606,13 +887,13 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one - if test x"$output_obj" != x"$libobj"; then - $show "$mv $output_obj $libobj" - if $run $mv $output_obj $libobj; then : + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist @@ -620,48 +901,23 @@ compiler." fi fi - # If we have no pic_flag, then copy the object into place and finish. - if (test -z "$pic_flag" || test "$pic_mode" != default) && - test "$build_old_libs" = yes; then - # Rename the .lo from within objdir to obj - if test -f $obj; then - $show $rm $obj - $run $rm $obj - fi + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != x"$srcfile"; then - echo "\ + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -705,11 +959,11 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi # Just move the object if needed - if test x"$output_obj" != x"$obj"; then + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else @@ -719,29 +973,31 @@ compiler." fi fi - # Create an invalid libtool object if no PIC, so that we do not - # accidentally link it into a program. - if test "$build_libtool_libs" != yes; then - $show "echo timestamp > $libobj" - $run eval "echo timestamp > \$libobj" || exit $? - else - # Move the .lo from within objdir - $show "$mv $libobj $lo_libobj" - if $run $mv $libobj $lo_libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then @@ -961,13 +1335,26 @@ compiler." finalize_command="$finalize_command $wl$qarg" continue ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac - fi # test -n $prev + fi # test -n "$prev" prevarg="$arg" @@ -1009,7 +1396,7 @@ compiler." -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" - exit 1 + exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms @@ -1028,7 +1415,7 @@ compiler." # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in - no/*-*-irix* | no/*-*-nonstopux*) + no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; @@ -1045,7 +1432,7 @@ compiler." absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi dir="$absdir" ;; @@ -1083,24 +1470,61 @@ compiler." # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd*) - # Do not include libc_r directly, use -pthread flag. + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" continue - ;; esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac fi deplibs="$deplibs $arg" continue ;; + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + deplibs="$deplibs $arg" + continue + ;; + -module) module=yes continue ;; + # gcc -m* arguments should be passed to the linker via $compiler_flags + # in order to pass architecture information to the linker + # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo + # but this is not reliable with gcc because gcc may use -mfoo to + # select a different linker, different libraries, etc, while + # -Wl,-mfoo simply passes -mfoo to the linker. + -m*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + if test "$with_gcc" = "yes" ; then + compiler_flags="$compiler_flags $arg" + fi + continue + ;; + + -shrext) + prev=shrext + continue + ;; + -no-fast-install) fast_install=no continue @@ -1125,8 +1549,18 @@ compiler." continue ;; + -objectlist) + prev=objectlist + continue + ;; + -o) prev=output ;; + -precious-files-regex) + prev=precious_regex + continue + ;; + -release) prev=release continue @@ -1149,7 +1583,7 @@ compiler." [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac case "$xrpath " in @@ -1177,6 +1611,11 @@ compiler." prev=vinfo continue ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` @@ -1225,6 +1664,11 @@ compiler." continue ;; + -XCClinker) + prev=xcclinker + continue + ;; + # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need @@ -1237,29 +1681,101 @@ compiler." esac ;; - *.lo | *.$objext) - # A library or standard object. - if test "$prev" = dlfiles; then - # This file was specified with -dlopen. - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $arg" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi + *.$objext) + # A standard object. + objs="$objs $arg" + ;; - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` - prev= - else + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. case $arg in - *.lo) libobjs="$libobjs $arg" ;; - *) objs="$objs $arg" ;; + */* | *\\*) . $arg ;; + *) . ./$arg ;; esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi fi ;; @@ -1310,7 +1826,7 @@ compiler." if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then @@ -1319,6 +1835,7 @@ compiler." finalize_command="$finalize_command $arg" fi + oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" @@ -1339,11 +1856,11 @@ compiler." output_objdir="$output_objdir/$objdir" fi # Create the object directory. - if test ! -d $output_objdir; then + if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? - if test $status -ne 0 && test ! -d $output_objdir; then + if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi @@ -1353,7 +1870,7 @@ compiler." "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; @@ -1361,7 +1878,17 @@ compiler." *) linkmode=prog ;; # Anything else should be a program. esac + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac specialdeplibs= + libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) @@ -1373,6 +1900,25 @@ compiler." fi libs="$libs $deplib" done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + deplibs= newdependency_libs= newlib_search_path= @@ -1387,7 +1933,7 @@ compiler." *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac done @@ -1404,39 +1950,59 @@ compiler." ;; esac for pass in $passes; do - if test $linkmode = prog; then - # Determine which files to process + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then case $pass in - dlopen) - libs="$dlfiles" - save_deplibs="$deplibs" # Collect dlpreopened libraries - deplibs= - ;; + dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi for deplib in $libs; do lib= found=no case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + fi + continue + ;; -l*) - if test $linkmode = oldlib && test $linkmode = obj; then - $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - # Search the libtool library - lib="$searchdir/lib${name}.la" - if test -f "$lib"; then - found=yes - break - fi + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library @@ -1445,40 +2011,76 @@ compiler." finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" - test $pass = conv && continue + test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi - if test $pass = scan; then + if test "$pass" = scan; then deplibs="$deplib $deplibs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) - $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) - if test $pass = link; then + if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in @@ -1491,30 +2093,45 @@ compiler." ;; *.la) lib="$deplib" ;; *.$libext) - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) - if test "$deplibs_check_method" != pass_all; then - echo - echo "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not used here." + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." else - echo - echo "*** Warning: Linking the shared library $output against the" - echo "*** static library $deplib is not portable!" + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) - if test $pass != link; then + if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -1525,14 +2142,18 @@ compiler." esac # linkmode ;; # *.$libext *.lo | *.$objext) - if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi fi continue ;; @@ -1541,17 +2162,17 @@ compiler." continue ;; esac # case $deplib - if test $found = yes || test -f "$lib"; then : + if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` @@ -1564,8 +2185,9 @@ compiler." library_names= old_library= # If the library was installed with an old release of libtool, - # it will not redefine variable installed. + # it will not redefine variables installed, or shouldnotlink installed=yes + shouldnotlink=no # Read the .la file case $lib in @@ -1575,19 +2197,18 @@ compiler." if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || - { test $linkmode = oldlib && test $linkmode = obj; }; then - # Add dl[pre]opened files of deplib + { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi - if test $pass = conv; then + if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" @@ -1602,13 +2223,14 @@ compiler." fi tmp_libs="$tmp_libs $deplib" done - elif test $linkmode != prog && test $linkmode != lib; then + elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit 1 + exit $EXIT_FAILURE fi continue fi # $pass = conv + # Get the name of the library we link against. linklib= for l in $old_library $library_names; do @@ -1616,19 +2238,23 @@ compiler." done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # This library was specified with -dlopen. - if test $pass = dlopen; then + if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi - if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. - dlprefiles="$dlprefiles $lib" + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi @@ -1661,18 +2287,25 @@ compiler." absdir="$libdir" fi else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. - if test $pass = dlpreopen; then + if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). @@ -1688,18 +2321,19 @@ compiler." if test -z "$libdir"; then # Link the convenience library - if test $linkmode = lib; then + if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else - deplibs="$lib $deplibs" + deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi - if test $linkmode = prog && test $pass != link; then + + if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" @@ -1715,7 +2349,7 @@ compiler." -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? - if test $linkalldeplibs = yes; then + if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths @@ -1732,13 +2366,19 @@ compiler." continue fi # $linkmode = prog... - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # Link against this shared library + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi - if test "$linkmode,$pass" = "prog,link" || - { test $linkmode = lib && test $hardcode_into_libs = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. @@ -1760,17 +2400,6 @@ compiler." esac ;; esac - if test $linkmode = prog; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - fi fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && @@ -1780,11 +2409,52 @@ compiler." # We only need to search for static libraries continue fi + fi + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname @@ -1798,7 +2468,7 @@ compiler." elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin*) + *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; @@ -1810,17 +2480,18 @@ compiler." # Make a new name for the extract_expsyms_cmds to use soroot="$soname" - soname=`echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" + cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -1831,9 +2502,10 @@ compiler." if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" + cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -1842,9 +2514,9 @@ compiler." # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib - fi # test -n $old_archive_from_expsyms_cmds + fi # test -n "$old_archive_from_expsyms_cmds" - if test $linkmode = prog || test "$mode" != relink; then + if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= @@ -1853,6 +2525,22 @@ compiler." immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" + case $host in + *-*-sco3.2v5* ) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; @@ -1871,6 +2559,14 @@ compiler." add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" @@ -1884,7 +2580,7 @@ compiler." if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 + exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then @@ -1893,7 +2589,7 @@ compiler." *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi - if test $linkmode = prog; then + if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else @@ -1910,9 +2606,8 @@ compiler." fi fi - if test $linkmode = prog || test "$mode" = relink; then + if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= - add_prefix_dir= add_dir= add= # Finalize command for both is simple: just hardcode it. @@ -1927,43 +2622,36 @@ compiler." *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi add="-l$name" fi - - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_prefix_dir="-L$inst_prefix_dir$libdir" - ;; - esac - fi - - # add_prefix_dir must be appended instead, otherwise it can - # possibly be overrided by any hardcoded -L/... path in deplibs - if test $linkmode = prog; then - test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir" + if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else - test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir" test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi - elif test $linkmode = prog; then - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - - # Try to link the static library + elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. @@ -1983,21 +2671,21 @@ compiler." # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - echo - echo "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -2014,10 +2702,11 @@ compiler." fi fi # link shared/static library? - if test $linkmode = lib; then + if test "$linkmode" = lib; then if test -n "$dependency_libs" && - { test $hardcode_into_libs != yes || test $build_old_libs = yes || - test $link_static = yes; }; then + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do @@ -2048,7 +2737,7 @@ compiler." tmp_libs="$tmp_libs $deplib" done - if test $link_all_deplibs != no; then + if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in @@ -2068,22 +2757,67 @@ compiler." ;; esac if grep "^installed=no" $deplib > /dev/null; then - path="-L$absdir/$objdir" + path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi - path="-L$absdir" + path="$absdir" fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac ;; *) continue ;; esac case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac @@ -2091,15 +2825,15 @@ compiler." fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs - if test $pass = dlpreopen; then + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi - if test $pass != dlopen; then - test $pass != scan && dependency_libs="$newdependency_libs" - if test $pass != conv; then + if test "$pass" != dlopen; then + if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do @@ -2121,9 +2855,30 @@ compiler." eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) @@ -2151,19 +2906,32 @@ compiler." eval $var=\"$tmp_libs\" done # for var fi - if test "$pass" = "conv" && - { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then - libs="$deplibs" # reset libs - deplibs= - fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs done # for pass - if test $linkmode = prog; then + if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi @@ -2177,7 +2945,7 @@ compiler." fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then @@ -2199,17 +2967,19 @@ compiler." case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` @@ -2220,11 +2990,11 @@ compiler." if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit 1 + exit $EXIT_FAILURE else - echo - echo "*** Warning: Linking the shared library $output against the non-libtool" - echo "*** objects $objs is not portable!" + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi @@ -2234,7 +3004,7 @@ compiler." fi set dummy $rpath - if test $# -gt 2; then + if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" @@ -2243,14 +3013,16 @@ compiler." if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. - libext=al + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then @@ -2266,45 +3038,82 @@ compiler." if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi - current="$2" - revision="$3" - age="$4" + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac # Check that each of the things are valid numbers. case $current in - [0-9]*) ;; + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac case $revision in - [0-9]*) ;; + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac case $age in - [0-9]*) ;; + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac - if test $age -gt $current; then + if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Calculate the version variables. @@ -2321,7 +3130,7 @@ compiler." versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) @@ -2345,7 +3154,7 @@ compiler." # Add in all the interfaces that we are compatible with. loop=$revision - while test $loop != 0; do + while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" @@ -2368,7 +3177,7 @@ compiler." # Add in all the interfaces that we are compatible with. loop=$age - while test $loop != 0; do + while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" @@ -2392,20 +3201,19 @@ compiler." *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= - verstring="0.0" case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely - verstring="" + verstring= ;; *) verstring="0.0" @@ -2439,9 +3247,30 @@ compiler." fi if test "$mode" != relink; then - # Remove our outputs. - $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" - $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi fi # Now set the variables for building old libraries. @@ -2454,9 +3283,9 @@ compiler." # Eliminate all temporary directories. for path in $notinst_path; do - lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then @@ -2469,7 +3298,7 @@ compiler." *) finalize_rpath="$finalize_rpath $libdir" ;; esac done - if test $hardcode_into_libs != yes || test $build_old_libs = yes; then + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi @@ -2509,10 +3338,11 @@ compiler." ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue ;; - *) + *) # Add libc to deplibs on all other systems if necessary. - if test $build_libtool_need_lc = "yes"; then + if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; @@ -2539,7 +3369,7 @@ compiler." # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behaviour. + # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) @@ -2552,45 +3382,22 @@ compiler." int main() { return 0; } EOF $rm conftest - $CC -o conftest conftest.c $deplibs - if test $? -eq 0 ; then + $LTCC -o conftest conftest.c $deplibs + if test "$?" -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do name="`expr $i : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - echo - echo "*** Warning: dynamic linker does not accept needed library $i." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which I believe you do not have" - echo "*** because a test_compile did reveal that the linker did not use it for" - echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occured in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - $rm conftest - $CC -o conftest conftest.c $i - # Did it work? - if test $? -eq 0 ; then - ldd_output=`ldd conftest` + if test "$name" != "" && test "$name" -ne "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then libname=`eval \\$echo \"$libname_spec\"` deplib_matches=`eval \\$echo \"$library_names_spec\"` set dummy $deplib_matches @@ -2599,21 +3406,64 @@ EOF newdeplibs="$newdeplibs $i" else droppeddeps=yes - echo - echo "*** Warning: dynamic linker does not accept needed library $i." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because a test_compile did reveal that the linker did not use this one" - echo "*** as a dynamic dependency that programs can get resolved with at runtime." + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which I believe you do not have" + $echo "*** because a test_compile did reveal that the linker did not use it for" + $echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occurred in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" != "0"; then + $rm conftest + $LTCC -o conftest conftest.c $i + # Did it work? + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because a test_compile did reveal that the linker did not use this one" + $echo "*** as a dynamic dependency that programs can get resolved with at runtime." + fi fi else droppeddeps=yes - echo - echo "*** Warning! Library $i is needed by this library but I was not able to" - echo "*** make it link in! You will probably need to install it or some" - echo "*** library that it depends on before this library will be fully" - echo "*** functional. Installing it before continuing would be even better." + $echo + $echo "*** Warning! Library $i is needed by this library but I was not able to" + $echo "*** make it link in! You will probably need to install it or some" + $echo "*** library that it depends on before this library will be fully" + $echo "*** functional. Installing it before continuing would be even better." fi else newdeplibs="$newdeplibs $i" @@ -2627,11 +3477,20 @@ EOF for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do + if test "$name" != "" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then @@ -2650,35 +3509,29 @@ EOF *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done - # It is ok to link against an archive when - # building a shared library. - if $AR -t $potlib > /dev/null 2>&1; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ - | egrep "$file_magic_regex" > /dev/null; then + | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi - done - done + done + done + fi if test -n "$a_deplib" ; then droppeddeps=yes - echo - echo "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - echo "*** with $libname but no candidates were found. (...for file magic test)" + $echo "*** with $libname but no candidates were found. (...for file magic test)" else - echo "*** with $libname and none of the candidates passed a file format test" - echo "*** using a file magic. Last file checked: $potlib" + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" fi fi else @@ -2694,33 +3547,43 @@ EOF name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check below in file_magic test - if eval echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | egrep "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done done - done + fi if test -n "$a_deplib" ; then droppeddeps=yes - echo - echo "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - echo "*** with $libname but no candidates were found. (...for regex pattern test)" + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else - echo "*** with $libname and none of the candidates passed a file format test" - echo "*** using a regex pattern. Last file checked: $potlib" + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else @@ -2731,16 +3594,23 @@ EOF ;; none | unknown | *) newdeplibs="" - if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | - grep . >/dev/null; then - echo + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." + $echo "*** Warning: inter-library dependencies are not supported in this platform." else - echo "*** Warning: inter-library dependencies are not known to be supported." + $echo "*** Warning: inter-library dependencies are not known to be supported." fi - echo "*** All declared inter-library dependencies are being dropped." + $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; @@ -2760,17 +3630,17 @@ EOF if test "$droppeddeps" = yes; then if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - echo "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -2780,16 +3650,16 @@ EOF build_libtool_libs=no fi else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." - if test $allow_undefined = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -2811,7 +3681,7 @@ EOF # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then - if test $hardcode_into_libs = yes; then + if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= @@ -2847,7 +3717,11 @@ EOF if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" - eval dep_rpath=\"$hardcode_libdir_flag_spec\" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. @@ -2867,6 +3741,7 @@ EOF fi # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" @@ -2877,7 +3752,9 @@ EOF else soname="$realname" fi - test -z "$dlname" && dlname=$soname + if test -z "$dlname"; then + dlname=$soname + fi lib="$output_objdir/$realname" for link @@ -2885,23 +3762,6 @@ EOF linknames="$linknames $link" done - # Ensure that we have .o objects for linkers which dislike .lo - # (e.g. aix) in case we are running --disable-static - for obj in $libobjs; do - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - if test ! -f $xdir/$oldobj; then - $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" - $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? - fi - done - # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -2911,17 +3771,26 @@ EOF $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" + cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then - $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi @@ -2932,46 +3801,30 @@ EOF $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" fi fi - + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" @@ -2983,25 +3836,147 @@ EOF fi # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi else - save_deplibs="$deplibs" - for conv in $convenience; do - tmp_deplibs= - for test_deplib in $deplibs; do - if test "$test_deplib" != "$conv"; then - tmp_deplibs="$tmp_deplibs $test_deplib" + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$save_output-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi - done - deplibs="$tmp_deplibs" + last_robj=$output_objdir/$save_output-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$save_output-${k}.$objext + objlist=$obj + len=1 + fi done - eval cmds=\"$archive_cmds\" - deplibs="$save_deplibs" + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadale object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3010,7 +3985,7 @@ EOF # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - exit 0 + exit $EXIT_SUCCESS fi # Create links to the real library. @@ -3058,7 +4033,7 @@ EOF *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit 1 + exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` @@ -3087,38 +4062,10 @@ EOF eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi @@ -3126,10 +4073,11 @@ EOF reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" - eval cmds=\"$reload_cmds\" + cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3142,7 +4090,7 @@ EOF $run ${rm}r $gentop fi - exit 0 + exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then @@ -3153,37 +4101,24 @@ EOF # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. - $show "echo timestamp > $libobj" - $run eval "echo timestamp > $libobj" || exit $? - exit 0 + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" - eval cmds=\"$reload_cmds\" + cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" - else - # Just create a symlink. - $show $rm $libobj - $run $rm $libobj - xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$libobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - $show "(cd $xdir && $LN_S $oldobj $baseobj)" - $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then @@ -3191,12 +4126,12 @@ EOF $run ${rm}r $gentop fi - exit 0 + exit $EXIT_SUCCESS ;; prog) case $host in - *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 @@ -3218,16 +4153,19 @@ EOF # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - ;; - esac ;; esac + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -3378,12 +4316,12 @@ extern \"C\" { done if test -n "$exclude_expsyms"; then - $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then - $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi @@ -3401,8 +4339,8 @@ extern \"C\" { for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" - name=`echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval 'echo ": $name " >> "$nlist"' + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done @@ -3411,7 +4349,7 @@ extern \"C\" { test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then - egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi @@ -3431,7 +4369,7 @@ extern \"C\" { if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else - echo '/* NONE */' >> "$output_objdir/$dlsyms" + $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ @@ -3483,18 +4421,18 @@ static const void *lt_preloaded_setup() { *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC";; + *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" @@ -3506,7 +4444,7 @@ static const void *lt_preloaded_setup() { ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac else @@ -3519,7 +4457,7 @@ static const void *lt_preloaded_setup() { finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi - if test $need_relink = no || test "$build_libtool_libs" != yes; then + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" @@ -3594,7 +4532,7 @@ static const void *lt_preloaded_setup() { # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? - exit 0 + exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then @@ -3649,10 +4587,10 @@ static const void *lt_preloaded_setup() { fi # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case $0 in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; - *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else @@ -3664,15 +4602,230 @@ static const void *lt_preloaded_setup() { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in - *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in - *cygwin*) exeext=.exe ;; + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac + case $host in + *cygwin* | *mingw* ) + cwrappersource=`$echo ${objdir}/lt-${output}.c` + cwrapper=`$echo ${output}.exe` + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +#define DIR_SEPARATOR '/' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +#define HAVE_DOS_BASED_FILE_SYSTEM +#ifndef DIR_SEPARATOR_2 +#define DIR_SEPARATOR_2 '\\' +#endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +char * basename (const char *name); +char * fnqualify(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup ((char *) basename (argv[0])); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = fnqualify(argv[0]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +char * +basename (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha (name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return (char *) base; +} + +char * +fnqualify(const char *path) +{ + size_t size; + char *p; + char tmp[LT_PATHMAX + 1]; + + assert(path != NULL); + + /* Is it qualified already? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha (path[0]) && path[1] == ':') + return xstrdup (path); +#endif + if (IS_DIR_SEPARATOR (path[0])) + return xstrdup (path); + + /* prepend the current directory */ + /* doesn't handle '~' */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ + p = XMALLOC(char, size); + sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); + return p; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC -s -o $cwrapper $cwrappersource + ;; + esac $rm $output - trap "$rm $output; exit 1" 1 2 15 + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL @@ -3688,12 +4841,12 @@ static const void *lt_preloaded_setup() { # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' +Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" @@ -3748,7 +4901,7 @@ else " if test "$fast_install" = yes; then - echo >> $output "\ + $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" @@ -3764,7 +4917,7 @@ else $rm \"\$progdir/\$file\" fi" - echo >> $output "\ + $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then @@ -3772,7 +4925,7 @@ else else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" - exit 1 + exit $EXIT_FAILURE fi fi @@ -3782,13 +4935,13 @@ else $rm \"\$progdir/\$file\" fi" else - echo >> $output "\ + $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi - echo >> $output "\ + $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" @@ -3799,7 +4952,7 @@ else $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 ${SED} + # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var @@ -3819,14 +4972,6 @@ else # Run the actual program with our arguments. " case $host in - # win32 systems need to use the prog path for dll - # lookup to work - *-*-cygwin* | *-*-pw32*) - $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} -" - ;; - # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ @@ -3836,30 +4981,26 @@ else *) $echo >> $output "\ - # Export the path to the program. - PATH=\"\$progdir:\$PATH\" - export PATH - - exec \$program \${1+\"\$@\"} + exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 + exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 - echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE fi fi\ " chmod +x $output fi - exit 0 + exit $EXIT_SUCCESS ;; esac @@ -3875,74 +5016,86 @@ fi\ oldobjs="$libobjs_save" build_libtool_libs=no else - oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" + cmds=$old_archive_from_new_cmds else - # Ensure that we have .o objects in place in case we decided - # not to build a shared library, and have fallen back to building - # static libs even though --disable-static was passed! - for oldobj in $oldobjs; do - if test ! -f $oldobj; then - xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$oldobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` - obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` - $show "(cd $xdir && ${LN_S} $obj $baseobj)" - $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? - fi - done - eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do + eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? @@ -3974,8 +5127,12 @@ fi\ fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + # Only create the output if not a dry run. if test -z "$run"; then @@ -3994,7 +5151,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; @@ -4008,7 +5165,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done @@ -4019,17 +5176,36 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file @@ -4058,13 +5234,16 @@ revision=$revision # Is this an already installed library? installed=$installed +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" - if test "$installed" = no && test $need_relink = yes; then + if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi @@ -4077,7 +5256,7 @@ relink_command=\"$relink_command\"" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac - exit 0 + exit $EXIT_SUCCESS ;; # libtool install mode @@ -4166,13 +5345,13 @@ relink_command=\"$relink_command\"" if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test -z "$files"; then @@ -4182,7 +5361,7 @@ relink_command=\"$relink_command\"" $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. @@ -4200,10 +5379,10 @@ relink_command=\"$relink_command\"" # Not a directory, so check to see that there is only one file specified. set dummy $files - if test $# -gt 2; then + if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi fi case $destdir in @@ -4215,7 +5394,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac done @@ -4240,11 +5419,11 @@ relink_command=\"$relink_command\"" *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi library_names= @@ -4276,21 +5455,24 @@ relink_command=\"$relink_command\"" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 @@ -4298,7 +5480,7 @@ relink_command=\"$relink_command\"" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - continue + exit $EXIT_FAILURE fi fi @@ -4320,7 +5502,7 @@ relink_command=\"$relink_command\"" $run eval "$striplib $destdir/$realname" || exit $? fi - if test $# -gt 0; then + if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do @@ -4333,10 +5515,11 @@ relink_command=\"$relink_command\"" # Do each command in the postinstall commands. lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" + cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4376,7 +5559,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac @@ -4394,7 +5577,7 @@ relink_command=\"$relink_command\"" $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi - exit 0 + exit $EXIT_SUCCESS ;; *) @@ -4406,29 +5589,49 @@ relink_command=\"$relink_command\"" destfile="$destdir/$destfile" fi + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) - wrapper=`echo $file | ${SED} -e 's,.exe$,,'` + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac - if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac # If there is no directory component, then add one. case $file in - */* | *\\*) . $wrapper ;; - *) . ./$wrapper ;; + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi finalize=yes @@ -4450,10 +5653,17 @@ relink_command=\"$relink_command\"" done relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac # If there is no directory component, then add one. case $file in - */* | *\\*) . $wrapper ;; - *) . ./$wrapper ;; + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; esac outputname= @@ -4461,17 +5671,17 @@ relink_command=\"$relink_command\"" if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` - if test $? = 0 ; then : - else - tmpdir="$tmpdir/libtool-$$" - fi - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + tmpdir="$tmpdir/libtool-$$" + save_umask=`umask` + umask 0077 + if $mkdir "$tmpdir"; then + umask $save_umask else + umask $save_umask $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi - file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` @@ -4489,14 +5699,14 @@ relink_command=\"$relink_command\"" fi else # Install the binary that we compiled earlier. - file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in - /usr/bin/install*,*cygwin*) + */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok @@ -4505,7 +5715,7 @@ relink_command=\"$relink_command\"" destfile=$destfile.exe ;; *:*.exe) - destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; @@ -4526,16 +5736,17 @@ relink_command=\"$relink_command\"" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? - if test -n "$stripme" && test -n "$striplib"; then + if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" + cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4549,9 +5760,9 @@ relink_command=\"$relink_command\"" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $0 --finish$current_libdirs' + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else - exit 0 + exit $EXIT_SUCCESS fi ;; @@ -4570,10 +5781,11 @@ relink_command=\"$relink_command\"" for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" + cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" @@ -4590,43 +5802,43 @@ relink_command=\"$relink_command\"" fi # Exit here if they wanted silent mode. - test "$show" = ":" && exit 0 + test "$show" = : && exit $EXIT_SUCCESS - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" + $echo "----------------------------------------------------------------------" + $echo "Libraries have been installed in:" for libdir in $libdirs; do - echo " $libdir" + $echo " $libdir" done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" fi if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" - echo " - use the \`$flag' linker flag" + $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then - echo " - have your system administrator run these commands:$admincmds" + $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi - echo - echo "See any operating system documentation about shared libraries for" - echo "more information, such as the ld(1) and ld.so(8) manual pages." - echo "----------------------------------------------------------------------" - exit 0 + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "----------------------------------------------------------------------" + exit $EXIT_SUCCESS ;; # libtool execute mode @@ -4638,7 +5850,7 @@ relink_command=\"$relink_command\"" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" - exit 1 + exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. @@ -4646,18 +5858,18 @@ relink_command=\"$relink_command\"" if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Read the libtool library. @@ -4684,7 +5896,7 @@ relink_command=\"$relink_command\"" dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi ;; @@ -4724,7 +5936,7 @@ relink_command=\"$relink_command\"" -*) ;; *) # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; @@ -4747,7 +5959,7 @@ relink_command=\"$relink_command\"" eval "export $shlibpath_var" fi - # Restore saved enviroment variables + # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi @@ -4756,15 +5968,15 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" + exec_cmd="\"\$cmd\"$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - $echo "$cmd$args" - exit 0 + eval \$echo \"\$cmd\"$args + exit $EXIT_SUCCESS fi ;; @@ -4792,24 +6004,25 @@ relink_command=\"$relink_command\"" if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi rmdirs= + origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. - objdir="$objdir" + objdir="$origobjdir" else - objdir="$dir/$objdir" + objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test $mode = uninstall && objdir="$dir" + test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates - if test $mode = clean; then + if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; @@ -4833,7 +6046,7 @@ relink_command=\"$relink_command\"" case $name in *.la) # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. @@ -4841,18 +6054,19 @@ relink_command=\"$relink_command\"" rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - if test $mode = uninstall; then + if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" + cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test $? != 0 && test "$rmforce" != yes; then + if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -4861,13 +6075,14 @@ relink_command=\"$relink_command\"" if test -n "$old_library"; then # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" + cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test $? != 0 && test "$rmforce" != yes; then + if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -4879,22 +6094,52 @@ relink_command=\"$relink_command\"" ;; *.lo) - if test "$build_old_libs" = yes; then - oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` - rmfiles="$rmfiles $dir/$oldobj" + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi fi ;; *) - # Do a test to see if this is a libtool program. - if test $mode = clean && - (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$file + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi fi fi ;; @@ -4902,6 +6147,7 @@ relink_command=\"$relink_command\"" $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done + objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -4917,20 +6163,20 @@ relink_command=\"$relink_command\"" "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd - exit 1 + exit $EXIT_FAILURE fi # We need to display help for each of the modes. @@ -4949,6 +6195,7 @@ Provide generalized library-building support services. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: @@ -4962,8 +6209,10 @@ MODE must be one of the following: uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE." - exit 0 +a more detailed description of MODE. + +Report bugs to ." + exit $EXIT_SUCCESS ;; clean) @@ -5074,6 +6323,9 @@ The following components of LINK-COMMAND are treated specially: -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries @@ -5115,14 +6367,34 @@ Otherwise, only FILE itself is deleted using RM." *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac -echo +$echo $echo "Try \`$modename --help' for more information about other modes." -exit 0 +exit $EXIT_SUCCESS + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script diff --git a/missing b/missing index 64b5f901..e7ef83a1 100755 --- a/missing +++ b/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2004-09-07.08 +scriptversion=2003-09-02.23 -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. @@ -60,6 +60,11 @@ case "$1" in msg="probably too old" fi ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in -h|--h|--he|--hel|--help) echo "\ @@ -87,12 +92,10 @@ Supported PROGRAM values: yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." - exit 0 ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" - exit 0 ;; -*) @@ -101,42 +104,12 @@ Send bug reports to ." exit 1 ;; -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) + aclocal*) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 fi - ;; -esac -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want @@ -146,6 +119,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the @@ -155,6 +133,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want @@ -174,6 +157,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. @@ -185,6 +173,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the @@ -261,6 +254,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the @@ -281,6 +279,11 @@ WARNING: \`$1' is $msg. You should only need it if ;; makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file @@ -298,6 +301,10 @@ WARNING: \`$1' is $msg. You should only need it if tar) shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 464c8bb1..eed72ab1 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.9.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -132,7 +132,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -162,6 +162,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -172,6 +173,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -183,6 +188,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -212,13 +219,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ From db7c9da42ff34daa7f88dbf73d7f543b10802769 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 22 Dec 2004 14:04:41 +0000 Subject: [PATCH 2107/2994] Move NAttr{Sparse,Compressed,Encrypted} to inode struct preserving the previous interface. (Yura, with fixes from Anton) (Logical change 1.645) --- include/ntfs/attrib.h | 87 ++++++++------ include/ntfs/inode.h | 24 ++-- include/ntfs/volume.h | 3 +- libntfs/attrib.c | 251 ++++++++++++++++++++++++++++++++++++++ libntfs/inode.c | 253 +-------------------------------------- ntfsprogs/mkntfs.c | 72 +++++------ ntfsprogs/ntfsmftalloc.c | 13 +- ntfsprogs/ntfstruncate.c | 23 ++-- 8 files changed, 380 insertions(+), 346 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 0918b0ce..0597f493 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -28,9 +28,11 @@ typedef struct _ntfs_attr ntfs_attr; typedef struct _ntfs_attr_search_ctx ntfs_attr_search_ctx; #include "types.h" +#include "inode.h" #include "unistr.h" #include "runlist.h" #include "volume.h" +#include "debug.h" extern ntfschar AT_UNNAMED[]; @@ -122,41 +124,6 @@ static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx) NULL, 0, ctx); } -/** - * ntfs_attr_state_bits - bits for the state field in the ntfs_attr structure - */ -typedef enum { - NA_Initialized, /* 1: structure is initialized. */ - NA_NonResident, /* 1: Attribute is not resident. */ - NA_Compressed, /* 1: Attribute is compressed. */ - NA_Encrypted, /* 1: Attribute is encrypted. */ - NA_Sparse, /* 1: Attribute is sparse. */ -} ntfs_attr_state_bits; - -#define test_nattr_flag(na, flag) test_bit(NA_##flag, (na)->state) -#define set_nattr_flag(na, flag) set_bit(NA_##flag, (na)->state) -#define clear_nattr_flag(na, flag) clear_bit(NA_##flag, (na)->state) - -#define NAttrInitialized(na) test_nattr_flag(na, Initialized) -#define NAttrSetInitialized(na) set_nattr_flag(na, Initialized) -#define NAttrClearInitialized(na) clear_nattr_flag(na, Initialized) - -#define NAttrNonResident(na) test_nattr_flag(na, NonResident) -#define NAttrSetNonResident(na) set_nattr_flag(na, NonResident) -#define NAttrClearNonResident(na) clear_nattr_flag(na, NonResident) - -#define NAttrCompressed(na) test_nattr_flag(na, Compressed) -#define NAttrSetCompressed(na) set_nattr_flag(na, Compressed) -#define NAttrClearCompressed(na) clear_nattr_flag(na, Compressed) - -#define NAttrEncrypted(na) test_nattr_flag(na, Encrypted) -#define NAttrSetEncrypted(na) set_nattr_flag(na, Encrypted) -#define NAttrClearEncrypted(na) clear_nattr_flag(na, Encrypted) - -#define NAttrSparse(na) test_nattr_flag(na, Sparse) -#define NAttrSetSparse(na) set_nattr_flag(na, Sparse) -#define NAttrClearSparse(na) clear_nattr_flag(na, Sparse) - /** * ntfs_attr - ntfs in memory non-resident attribute structure * @rl: if not NULL, the decompressed runlist @@ -215,6 +182,51 @@ struct _ntfs_attr { u8 compression_block_clusters; }; +/** + * ntfs_attr_state_bits - bits for the state field in the ntfs_attr structure + */ +typedef enum { + NA_Initialized, /* 1: structure is initialized. */ + NA_NonResident, /* 1: Attribute is not resident. */ +} ntfs_attr_state_bits; + +#define test_nattr_flag(na, flag) test_bit(NA_##flag, (na)->state) +#define set_nattr_flag(na, flag) set_bit(NA_##flag, (na)->state) +#define clear_nattr_flag(na, flag) clear_bit(NA_##flag, (na)->state) + +#define NAttrInitialized(na) test_nattr_flag(na, Initialized) +#define NAttrSetInitialized(na) set_nattr_flag(na, Initialized) +#define NAttrClearInitialized(na) clear_nattr_flag(na, Initialized) + +#define NAttrNonResident(na) test_nattr_flag(na, NonResident) +#define NAttrSetNonResident(na) set_nattr_flag(na, NonResident) +#define NAttrClearNonResident(na) clear_nattr_flag(na, NonResident) + +#define GenNAttrIno(flag) \ +static inline int NAttr##flag(ntfs_attr *na) \ +{ \ + if (na->type == AT_DATA && na->name == AT_UNNAMED) \ + return NIno##flag(na->ni); \ + return 0; \ +} \ +static inline void NAttrSet##flag(ntfs_attr *na) \ +{ \ + if (na->type == AT_DATA && na->name == AT_UNNAMED) \ + NInoSet##flag(na->ni); \ + else \ + Dprintf("%s(): BUG! Called for named data " \ + "attribute.\n", __FUNCTION__); \ +} \ +static inline void NAttrClear##flag(ntfs_attr *na) \ +{ \ + if (na->type == AT_DATA && na->name == AT_UNNAMED) \ + NInoClear##flag(na->ni); \ +} + +GenNAttrIno(Compressed) +GenNAttrIno(Encrypted) +GenNAttrIno(Sparse) + /* * Union of all known attribute values. For convenience. Used in the attr * structure. @@ -295,6 +307,11 @@ extern int ntfs_attr_update_mapping_pairs(ntfs_attr *na); extern int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize); +extern ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, + ntfschar *name, u8 name_len, s64 size); + +extern int ntfs_inode_rm_attr(ntfs_attr *na); + // FIXME / TODO: Above here the file is cleaned up. (AIA) /** * get_attribute_value_length - return the length of the value of an attribute diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index b251fc48..4b9c2c48 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -27,8 +27,9 @@ typedef struct _ntfs_inode ntfs_inode; #include "types.h" +#include "layout.h" #include "support.h" -#include "runlist.h" +#include "volume.h" /* * Defined bits for the state field in the ntfs_inode structure. @@ -41,6 +42,9 @@ typedef enum { NI_AttrList, /* 1: Mft record contains an attribute list. */ NI_AttrListDirty, /* 1: Attribute list needs to be written to the mft record and then to disk. */ + NI_Compressed, /* 1: Inode is compressed. */ + NI_Encrypted, /* 1: Inode is encrypted. */ + NI_Sparse, /* 1: Inode is sparse. */ } ntfs_inode_state_bits; #define test_nino_flag(ni, flag) test_bit(NI_##flag, (ni)->state) @@ -78,6 +82,18 @@ typedef enum { #define NInoAttrListTestAndSetDirty(ni) test_and_set_nino_al_flag(ni, Dirty) #define NInoAttrListTestAndClearDirty(ni) test_and_clear_nino_al_flag(ni, Dirty) +#define NInoCompressed(ni) test_nino_flag(ni, Compressed) +#define NInoSetCompressed(ni) set_nino_flag(ni, Compressed) +#define NInoClearCompressed(ni) clear_nino_flag(ni, Compressed) + +#define NInoEncrypted(ni) test_nino_flag(ni, Encrypted) +#define NInoSetEncrypted(ni) set_nino_flag(ni, Encrypted) +#define NInoClearEncrypted(ni) clear_nino_flag(ni, Encrypted) + +#define NInoSparse(ni) test_nino_flag(ni, Sparse) +#define NInoSetSparse(ni) set_nino_flag(ni, Sparse) +#define NInoClearSparse(ni) clear_nino_flag(ni, Sparse) + /* * The NTFS in-memory inode structure. It is just used as an extension to the * fields already provided in the VFS inode. @@ -145,10 +161,4 @@ extern int ntfs_inode_add_attrlist(ntfs_inode *ni); extern int ntfs_inode_free_space(ntfs_inode *ni, int size); -extern ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, - ntfschar *name, u8 name_len, s64 size); - -extern int ntfs_inode_rm_attr(ntfs_attr *na); - #endif /* defined _NTFS_INODE_H */ - diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 6fb3be5d..23f57bec 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -49,8 +49,9 @@ typedef struct _ntfs_volume ntfs_volume; #include "types.h" #include "support.h" -#include "inode.h" #include "device.h" +#include "inode.h" +#include "attrib.h" /* * Flags returned by the ntfs_check_if_mounted() function. diff --git a/libntfs/attrib.c b/libntfs/attrib.c index a3e2767a..61be9484 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -4588,3 +4588,254 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) } return ntfs_resident_attr_resize(na, newsize); } + +/** + * ntfs_inode_add_attr - add attribute to inode + * @ni: opened ntfs inode to which add attribute + * @type: type of the new attribute + * @name: name in unicode of the new attribute + * @name_len: name length in unicode charcters of the new attribute + * @size: size of the new attribute + * + * If inode haven't got enogh space to add attribute, add attribute to one of it + * extents, if no extents present or no one of them have enough space, than + * allocate new extent and add attribute to it. + * + * If on one of this steps attribute list is needed but not present, than it is + * added transparently to caller. So, this function should not be called with + * @type == AT_ATTRIBUTE_LIST, if you really need to add attribute list call + * ntfs_inode_add_attrlist instead. + * + * On success return opened new ntfs attribute. On error return NULL with errno + * set to the error code. + */ +ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, + ntfschar *name, u8 name_len, s64 size) +{ + u32 attr_rec_size; + int err, i, offset; + ntfs_inode *attr_ni; + ntfs_attr *na; + + if (!ni || size < 0 || type == AT_ATTRIBUTE_LIST) { + Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + errno = EINVAL; + return NULL; + } + + Dprintf("%s(): Entering for inode 0x%llx, attr %x, size %lld.\n", + __FUNCTION__, (long long) ni->mft_no, type, size); + + if (ni->nr_extents == -1) + ni = ni->base_ni; + + /* Validate attribute type. */ + if (!ntfs_attr_find_in_attrdef(ni->vol, type)) { + if (errno == ENOENT) { + Dprintf("%s(): Invalid attribute type.\n", + __FUNCTION__); + errno = EINVAL; + return NULL; + } else { + err = errno; + Dprintf("%s(): ntfs_attr_find_in_attrdef failed.\n", + __FUNCTION__); + errno = err; + return NULL; + } + } + + /* + * Determine resident or not will be new attribute. We add 8 to size in + * non resident case for mapping pairs. + */ + if (ntfs_attr_can_be_resident(ni->vol, type)) { + if (errno != EPERM) { + err = errno; + Dprintf("%s(): ntfs_attr_can_be resident failed.\n", + __FUNCTION__); + goto err_out; + } + /* Attribute can't be resident. */ + attr_rec_size = offsetof(ATTR_RECORD, non_resident_end) + + ((name_len * sizeof(ntfschar) + 7) & ~7) + 8; + } else { + /* Attribute can be resident. */ + attr_rec_size = offsetof(ATTR_RECORD, resident_end) + + ((name_len * sizeof(ntfschar) + 7) & ~7); + /* Check whether attribute will fit into the MFT record. */ + if (size + attr_rec_size >= ni->vol->mft_record_size) + /* Will not fit, make it non resident. */ + attr_rec_size = offsetof(ATTR_RECORD, + non_resident_end) + ((name_len * + sizeof(ntfschar) + 7) & ~7) + 8; + } + + if (le32_to_cpu(ni->mrec->bytes_allocated) - + le32_to_cpu(ni->mrec->bytes_in_use) >= attr_rec_size) { + attr_ni = ni; + goto add_attr_record; + } + + /* Try to add to extent inodes. */ + if (ntfs_inode_attach_all_extents(ni)) { + err = errno; + Dprintf("%s(): Failed to attach all extents to inode.\n", + __FUNCTION__); + goto err_out; + } + for (i = 0; i < ni->nr_extents; i++) { + attr_ni = ni->extent_nis[i]; + if (le32_to_cpu(attr_ni->mrec->bytes_allocated) - + le32_to_cpu(attr_ni->mrec->bytes_in_use) >= + attr_rec_size) + goto add_attr_record; + } + + /* There is no extent that contain enough space for new attribute. */ + if (!NInoAttrList(ni)) { + /* Add attribute list not present, add it and retry. */ + if (ntfs_inode_add_attrlist(ni)) { + err = errno; + Dprintf("%s(): Failed to add attribute list.\n", + __FUNCTION__); + goto err_out; + } + return ntfs_inode_add_attr(ni, type, name, name_len, size); + } + /* Allocate new extent. */ + attr_ni = ntfs_mft_record_alloc(ni->vol, ni); + if (!attr_ni) { + err = errno; + Dprintf("%s(): Failed to allocate extent record.\n", + __FUNCTION__); + goto err_out; + } + +add_attr_record: + if (attr_rec_size == offsetof(ATTR_RECORD, resident_end) + + ((name_len * sizeof(ntfschar) + 7) & ~7)) { + /* Add resident attribute. */ + offset = ntfs_resident_attr_record_add(attr_ni, type, name, + name_len, 0); + if (offset < 0) { + err = errno; + Dprintf("%s(): Failed to add resident attribute.\n", + __FUNCTION__); + goto free_err_out; + } + } else { + /* Add non resident attribute. */ + offset = ntfs_non_resident_attr_record_add(attr_ni, type, name, + name_len, 0, 8, 0); + if (offset < 0) { + err = errno; + Dprintf("%s(): Failed to add non resident attribute.\n", + __FUNCTION__); + goto free_err_out; + } + } + + /* Open new attribute and resize it. */ + na = ntfs_attr_open(ni, type, name, name_len); + if (!na) { + err = errno; + Dprintf("%s(): Failed to open just added attribute.\n", + __FUNCTION__); + goto rm_attr_err_out; + } + if (!size) + return na; + if (ntfs_attr_truncate(na, size)) { + err = errno; + Dprintf("%s(): Failed to resize just added attribute.\n", + __FUNCTION__); + if (ntfs_inode_rm_attr(na)) { + Dprintf("%s(): Failed to remove just added attribute. " + "Probably leaving inconsist metadata.\n", + __FUNCTION__); + } + goto err_out; + } + /* Done !*/ + return na; + +rm_attr_err_out: + /* Remove just added attribute. */ + if (ntfs_attr_record_resize(attr_ni->mrec, + (ATTR_RECORD*)((u8*)attr_ni->mrec + offset), 0)) { + Dprintf("%s(): Failed to remove just added attribute.\n", + __FUNCTION__); + } +free_err_out: + /* Free MFT record, if it isn't contain attributes. */ + if (le32_to_cpu(attr_ni->mrec->bytes_in_use) - + le32_to_cpu(attr_ni->mrec->attrs_offset) == 8) { + if (ntfs_mft_record_free(attr_ni->vol, attr_ni)) { + Dprintf("%s(): Failed to free MFT record. Leaving " + "inconsist metadata.\n", __FUNCTION__); + } + } +err_out: + errno = err; + return NULL; +} + +/** + * ntfs_inode_rm_attr - remove attribute from ntfs inode + * @na: opened ntfs attribute to delete + * + * Remove attribute and all it's extents from ntfs inode. If attribute was non + * resident also free all clusters allocated by attribute. + * + * Return 0 on success or -1 on error with errno set to the error code. + */ +int ntfs_inode_rm_attr(ntfs_attr *na) +{ + ntfs_attr_search_ctx *ctx; + int ret = 0; + + if (!na) { + Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", + __FUNCTION__, (long long) na->ni->mft_no, na->type); + + /* Free cluster allocation. */ + if (NAttrNonResident(na)) { + if (ntfs_attr_map_whole_runlist(na)) + return -1; + if (ntfs_cluster_free(na->ni->vol, na, 0, -1) < 0) { + Dprintf("%s(): Failed to free cluster allocation. " + "Leaving inconsist metadata.\n", __FUNCTION__); + ret = -1; + } + } + + /* Search for attribute extents and remove them all. */ + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); + if (!ctx) + return -1; + while (!ntfs_attr_lookup(na->type, na->name, na->name_len, + CASE_SENSITIVE, 0, NULL, 0, ctx)) { + if (ntfs_attr_record_rm(ctx)) { + Dprintf("%s(): Failed to remove attribute extent. " + "Leaving inconsist metadata.\n", __FUNCTION__); + ret = -1; + } + ntfs_attr_reinit_search_ctx(ctx); + } + if (errno != ENOENT) { + Dprintf("%s(): Attribute lookup failed. Probably leaving " + "inconsist metadata.\n", __FUNCTION__); + ret = -1; + } + + /* Throw away now non-exist attribute. */ + ntfs_attr_close(na); + /* Done. */ + return ret; +} diff --git a/libntfs/inode.c b/libntfs/inode.c index 841b873a..89c506d5 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -29,10 +29,10 @@ #include "compat.h" #include "types.h" +#include "attrib.h" #include "inode.h" #include "debug.h" #include "mft.h" -#include "attrib.h" #include "attrlist.h" #include "runlist.h" #include "lcnalloc.h" @@ -848,254 +848,3 @@ put_err_out: errno = err; return -1; } - -/** - * ntfs_inode_add_attr - add attribute to inode - * @ni: opened ntfs inode to which add attribute - * @type: type of the new attribute - * @name: name in unicode of the new attribute - * @name_len: name length in unicode charcters of the new attribute - * @size: size of the new attribute - * - * If inode haven't got enogh space to add attribute, add attribute to one of it - * extents, if no extents present or no one of them have enough space, than - * allocate new extent and add attribute to it. - * - * If on one of this steps attribute list is needed but not present, than it is - * added transparently to caller. So, this function should not be called with - * @type == AT_ATTRIBUTE_LIST, if you really need to add attribute list call - * ntfs_inode_add_attrlist instead. - * - * On success return opened new ntfs attribute. On error return NULL with errno - * set to the error code. - */ -ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, - ntfschar *name, u8 name_len, s64 size) -{ - u32 attr_rec_size; - int err, i, offset; - ntfs_inode *attr_ni; - ntfs_attr *na; - - if (!ni || size < 0 || type == AT_ATTRIBUTE_LIST) { - Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); - errno = EINVAL; - return NULL; - } - - Dprintf("%s(): Entering for inode 0x%llx, attr %x, size %lld.\n", - __FUNCTION__, (long long) ni->mft_no, type, size); - - if (ni->nr_extents == -1) - ni = ni->base_ni; - - /* Validate attribute type. */ - if (!ntfs_attr_find_in_attrdef(ni->vol, type)) { - if (errno == ENOENT) { - Dprintf("%s(): Invalid attribute type.\n", - __FUNCTION__); - errno = EINVAL; - return NULL; - } else { - err = errno; - Dprintf("%s(): ntfs_attr_find_in_attrdef failed.\n", - __FUNCTION__); - errno = err; - return NULL; - } - } - - /* - * Determine resident or not will be new attribute. We add 8 to size in - * non resident case for mapping pairs. - */ - if (ntfs_attr_can_be_resident(ni->vol, type)) { - if (errno != EPERM) { - err = errno; - Dprintf("%s(): ntfs_attr_can_be resident failed.\n", - __FUNCTION__); - goto err_out; - } - /* Attribute can't be resident. */ - attr_rec_size = offsetof(ATTR_RECORD, non_resident_end) + - ((name_len * sizeof(ntfschar) + 7) & ~7) + 8; - } else { - /* Attribute can be resident. */ - attr_rec_size = offsetof(ATTR_RECORD, resident_end) + - ((name_len * sizeof(ntfschar) + 7) & ~7); - /* Check whether attribute will fit into the MFT record. */ - if (size + attr_rec_size >= ni->vol->mft_record_size) - /* Will not fit, make it non resident. */ - attr_rec_size = offsetof(ATTR_RECORD, - non_resident_end) + ((name_len * - sizeof(ntfschar) + 7) & ~7) + 8; - } - - if (le32_to_cpu(ni->mrec->bytes_allocated) - - le32_to_cpu(ni->mrec->bytes_in_use) >= attr_rec_size) { - attr_ni = ni; - goto add_attr_record; - } - - /* Try to add to extent inodes. */ - if (ntfs_inode_attach_all_extents(ni)) { - err = errno; - Dprintf("%s(): Failed to attach all extents to inode.\n", - __FUNCTION__); - goto err_out; - } - for (i = 0; i < ni->nr_extents; i++) { - attr_ni = ni->extent_nis[i]; - if (le32_to_cpu(attr_ni->mrec->bytes_allocated) - - le32_to_cpu(attr_ni->mrec->bytes_in_use) >= - attr_rec_size) - goto add_attr_record; - } - - /* There is no extent that contain enough space for new attribute. */ - if (!NInoAttrList(ni)) { - /* Add attribute list not present, add it and retry. */ - if (ntfs_inode_add_attrlist(ni)) { - err = errno; - Dprintf("%s(): Failed to add attribute list.\n", - __FUNCTION__); - goto err_out; - } - return ntfs_inode_add_attr(ni, type, name, name_len, size); - } - /* Allocate new extent. */ - attr_ni = ntfs_mft_record_alloc(ni->vol, ni); - if (!attr_ni) { - err = errno; - Dprintf("%s(): Failed to allocate extent record.\n", - __FUNCTION__); - goto err_out; - } - -add_attr_record: - if (attr_rec_size == offsetof(ATTR_RECORD, resident_end) + - ((name_len * sizeof(ntfschar) + 7) & ~7)) { - /* Add resident attribute. */ - offset = ntfs_resident_attr_record_add(attr_ni, type, name, - name_len, 0); - if (offset < 0) { - err = errno; - Dprintf("%s(): Failed to add resident attribute.\n", - __FUNCTION__); - goto free_err_out; - } - } else { - /* Add non resident attribute. */ - offset = ntfs_non_resident_attr_record_add(attr_ni, type, name, - name_len, 0, 8, 0); - if (offset < 0) { - err = errno; - Dprintf("%s(): Failed to add non resident attribute.\n", - __FUNCTION__); - goto free_err_out; - } - } - - /* Open new attribute and resize it. */ - na = ntfs_attr_open(ni, type, name, name_len); - if (!na) { - err = errno; - Dprintf("%s(): Failed to open just added attribute.\n", - __FUNCTION__); - goto rm_attr_err_out; - } - if (!size) - return na; - if (ntfs_attr_truncate(na, size)) { - err = errno; - Dprintf("%s(): Failed to resize just added attribute.\n", - __FUNCTION__); - if (ntfs_inode_rm_attr(na)) { - Dprintf("%s(): Failed to remove just added attribute. " - "Probably leaving inconsist metadata.\n", - __FUNCTION__); - } - goto err_out; - } - /* Done !*/ - return na; - -rm_attr_err_out: - /* Remove just added attribute. */ - if (ntfs_attr_record_resize(attr_ni->mrec, - (ATTR_RECORD*)((u8*)attr_ni->mrec + offset), 0)) { - Dprintf("%s(): Failed to remove just added attribute.\n", - __FUNCTION__); - } -free_err_out: - /* Free MFT record, if it isn't contain attributes. */ - if (le32_to_cpu(attr_ni->mrec->bytes_in_use) - - le32_to_cpu(attr_ni->mrec->attrs_offset) == 8) { - if (ntfs_mft_record_free(attr_ni->vol, attr_ni)) { - Dprintf("%s(): Failed to free MFT record. Leaving " - "inconsist metadata.\n", __FUNCTION__); - } - } -err_out: - errno = err; - return NULL; -} - -/** - * ntfs_inode_rm_attr - remove attribute from ntfs inode - * @na: opened ntfs attribute to delete - * - * Remove attribute and all it's extents from ntfs inode. If attribute was non - * resident also free all clusters allocated by attribute. - * - * Return 0 on success or -1 on error with errno set to the error code. - */ -int ntfs_inode_rm_attr(ntfs_attr *na) -{ - ntfs_attr_search_ctx *ctx; - int ret = 0; - - if (!na) { - Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); - errno = EINVAL; - return -1; - } - - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", - __FUNCTION__, (long long) na->ni->mft_no, na->type); - - /* Free cluster allocation. */ - if (NAttrNonResident(na)) { - if (ntfs_attr_map_whole_runlist(na)) - return -1; - if (ntfs_cluster_free(na->ni->vol, na, 0, -1) < 0) { - Dprintf("%s(): Failed to free cluster allocation. " - "Leaving inconsist metadata.\n", __FUNCTION__); - ret = -1; - } - } - - /* Search for attribute extents and remove them all. */ - ctx = ntfs_attr_get_search_ctx(na->ni, NULL); - if (!ctx) - return -1; - while (!ntfs_attr_lookup(na->type, na->name, na->name_len, - CASE_SENSITIVE, 0, NULL, 0, ctx)) { - if (ntfs_attr_record_rm(ctx)) { - Dprintf("%s(): Failed to remove attribute extent. " - "Leaving inconsist metadata.\n", __FUNCTION__); - ret = -1; - } - ntfs_attr_reinit_search_ctx(ctx); - } - if (errno != ENOENT) { - Dprintf("%s(): Attribute lookup failed. Probably leaving " - "inconsist metadata.\n", __FUNCTION__); - ret = -1; - } - - /* Throw away now non-exist attribute. */ - ntfs_attr_close(na); - /* Done. */ - return ret; -} diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 7ced1c7f..a58498c6 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -117,14 +117,14 @@ #endif #include "types.h" -#include "bootsect.h" -#include "device.h" #include "attrib.h" #include "bitmap.h" -#include "mst.h" +#include "bootsect.h" +#include "device.h" #include "dir.h" -#include "runlist.h" #include "mft.h" +#include "mst.h" +#include "runlist.h" #include "utils.h" #ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS @@ -210,10 +210,11 @@ struct { } opts; /** - * Dprintf - debugging output (-vv); overriden by quiet (-q) + * mkDprintf - debugging output (-vv); overriden by quiet (-q) */ -static void Dprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); -static void Dprintf(const char *fmt, ...) +static void mkDprintf(const char *fmt, ...) + __attribute__((format(printf, 1, 2))); +static void mkDprintf(const char *fmt, ...) { va_list ap; @@ -2297,7 +2298,7 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, while ((char*)ie < index_end && !(ie->flags & INDEX_ENTRY_END)) { /* #ifdef DEBUG - Dprintf("file_name_attr1->file_name_length = %i\n", + mkDprintf("file_name_attr1->file_name_length = %i\n", file_name->file_name_length); if (file_name->file_name_length) { char *__buf; @@ -2309,12 +2310,12 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, i = ucstos(__buf, (ntfschar*)&file_name->file_name, file_name->file_name_length + 1); if (i == -1) - Dprintf("Name contains non-displayable " + mkDprintf("Name contains non-displayable " "Unicode characters.\n"); - Dprintf("file_name_attr1->file_name = %s\n", __buf); + mkDprintf("file_name_attr1->file_name = %s\n", __buf); free(__buf); } - Dprintf("file_name_attr2->file_name_length = %i\n", + mkDprintf("file_name_attr2->file_name_length = %i\n", ie->key.file_name.file_name_length); if (ie->key.file_name.file_name_length) { char *__buf; @@ -2326,9 +2327,9 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, i = ucstos(__buf, ie->key.file_name.file_name, ie->key.file_name.file_name_length + 1); if (i == -1) - Dprintf("Name contains non-displayable " + mkDprintf("Name contains non-displayable " "Unicode characters.\n"); - Dprintf("file_name_attr2->file_name = %s\n", __buf); + mkDprintf("file_name_attr2->file_name = %s\n", __buf); free(__buf); } #endif @@ -2369,7 +2370,7 @@ do_next: #ifdef DEBUG /* Next entry. */ if (!ie->length) { - Dprintf("BUG: ie->length is zero, breaking out of " + mkDprintf("BUG: ie->length is zero, breaking out of " "loop.\n"); break; } @@ -2502,7 +2503,7 @@ static void init_options(void) opts.index_block_size = 4096; opts.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; opts.attr_defs_len = sizeof(attrdef_ntfs12_array); - //Dprintf("Attr_defs table length = %u\n", opts.attr_defs_len); + //mkDprintf("Attr_defs table length = %u\n", opts.attr_defs_len); } /** @@ -2668,7 +2669,7 @@ static void mkntfs_override_phys_params(void) err_exit("sector_size is invalid. It must be a power " "of two, and it must be\n greater or equal 256 and " "less than or equal 4096 bytes.\n"); - Dprintf("sector size = %i bytes\n", opts.sector_size); + mkDprintf("sector size = %i bytes\n", opts.sector_size); /* If user didn't specify the number of sectors, determine it now. */ if (!opts.nr_sectors) { opts.nr_sectors = ntfs_device_size_get(vol->dev, @@ -2678,7 +2679,7 @@ static void mkntfs_override_phys_params(void) "specify it manually.\n", vol->dev->d_name); } - Dprintf("number of sectors = %lld (0x%llx)\n", opts.nr_sectors, + mkDprintf("number of sectors = %lld (0x%llx)\n", opts.nr_sectors, opts.nr_sectors); /* Reserve the last sector for the backup boot sector. */ opts.nr_sectors--; @@ -2763,7 +2764,7 @@ static void mkntfs_override_phys_params(void) if (opts.volume_size < 1 << 20 /* 1MiB */) err_exit("Device is too small (%llikiB). Minimum NTFS volume " "size is 1MiB.\n", opts.volume_size / 1024); - Dprintf("volume size = %llikiB\n", opts.volume_size / 1024); + mkDprintf("volume size = %llikiB\n", opts.volume_size / 1024); /* If user didn't specify the cluster size, determine it now. */ if (!vol->cluster_size) { if (opts.volume_size <= 512LL << 20) /* <= 512MB */ @@ -2801,7 +2802,7 @@ static void mkntfs_override_phys_params(void) "to fit inside eight bits. (We do not support larger " "cluster sizes yet.)\n"); vol->cluster_size_bits = ffs(vol->cluster_size) - 1; - Dprintf("cluster size = %u bytes\n", (unsigned int)vol->cluster_size); + mkDprintf("cluster size = %u bytes\n", (unsigned int)vol->cluster_size); if (vol->cluster_size > 4096) { if (opts.enable_compression) { if (!opts.force) @@ -2833,7 +2834,7 @@ static void mkntfs_override_phys_params(void) opts.volume_size / vol->cluster_size != opts.nr_clusters) err_exit("Illegal combination of volume/cluster/sector size " "and/or cluster/sector number.\n"); - Dprintf("number of clusters = %llu (0x%llx)\n", opts.nr_clusters, + mkDprintf("number of clusters = %llu (0x%llx)\n", opts.nr_clusters, opts.nr_clusters); /* Number of clusters must fit within 32 bits (Win2k limitation). */ if (opts.nr_clusters >> 32) { @@ -2863,7 +2864,7 @@ static void mkntfs_initialize_bitmaps(void) lcn_bitmap_byte_size = (lcn_bitmap_byte_size + 7) & ~7; i = (lcn_bitmap_byte_size + vol->cluster_size - 1) & ~(vol->cluster_size - 1); - Dprintf("lcn_bitmap_byte_size = %i, allocated = %i\n", + mkDprintf("lcn_bitmap_byte_size = %i, allocated = %i\n", lcn_bitmap_byte_size, i); lcn_bitmap = (unsigned char *)calloc(1, lcn_bitmap_byte_size); if (!lcn_bitmap) @@ -2881,14 +2882,14 @@ static void mkntfs_initialize_bitmaps(void) */ opts.mft_size = (16 * vol->mft_record_size + vol->cluster_size - 1) & ~(vol->cluster_size - 1); - Dprintf("MFT size = %i (0x%x) bytes\n", opts.mft_size, opts.mft_size); + mkDprintf("MFT size = %i (0x%x) bytes\n", opts.mft_size, opts.mft_size); /* Determine mft bitmap size and allocate it. */ mft_bitmap_size = opts.mft_size / vol->mft_record_size; /* Convert to bytes, at least one. */ mft_bitmap_byte_size = (mft_bitmap_size + 7) >> 3; /* Mft bitmap is allocated in multiples of 8 bytes. */ mft_bitmap_byte_size = (mft_bitmap_byte_size + 7) & ~7; - Dprintf("mft_bitmap_size = %i, mft_bitmap_byte_size = %i\n", + mkDprintf("mft_bitmap_size = %i, mft_bitmap_byte_size = %i\n", mft_bitmap_size, mft_bitmap_byte_size); mft_bitmap = (unsigned char *)calloc(1, mft_bitmap_byte_size); if (!mft_bitmap) @@ -2934,7 +2935,7 @@ static void mkntfs_initialize_rl_mft(void) opts.mft_lcn = (16 * 1024 + vol->cluster_size - 1) / vol->cluster_size; } - Dprintf("$MFT logical cluster number = 0x%llx\n", opts.mft_lcn); + mkDprintf("$MFT logical cluster number = 0x%llx\n", opts.mft_lcn); /* Determine MFT zone size. */ opts.mft_zone_end = opts.nr_clusters; switch (opts.mft_zone_multiplier) { /* % of volume size in clusters */ @@ -2952,7 +2953,7 @@ static void mkntfs_initialize_rl_mft(void) opts.mft_zone_end = opts.mft_zone_end >> 3; /* 12.5% */ break; } - Dprintf("MFT zone size = %lldkiB\n", opts.mft_zone_end / 1024); + mkDprintf("MFT zone size = %lldkiB\n", opts.mft_zone_end / 1024); /* * The mft zone begins with the mft data attribute, not at the beginning * of the device. @@ -2975,8 +2976,9 @@ static void mkntfs_initialize_rl_mft(void) ntfs_bit_set(lcn_bitmap, opts.mft_lcn + i, 1); /* Determine mftmirr_lcn (middle of volume). */ opts.mftmirr_lcn = (opts.nr_sectors * opts.sector_size >> 1) - / vol->cluster_size; - Dprintf("$MFTMirr logical cluster number = 0x%llx\n", opts.mftmirr_lcn); + / vol->cluster_size; + mkDprintf("$MFTMirr logical cluster number = 0x%llx\n", + opts.mftmirr_lcn); /* Create runlist for mft mirror. */ rl_mftmirr = (runlist *)malloc(2 * sizeof(runlist)); if (!rl_mftmirr) @@ -2999,7 +3001,8 @@ static void mkntfs_initialize_rl_mft(void) for (i = 0; i < j; i++) ntfs_bit_set(lcn_bitmap, opts.mftmirr_lcn + i, 1); opts.logfile_lcn = opts.mftmirr_lcn + j; - Dprintf("$LogFile logical cluster number = 0x%llx\n", opts.logfile_lcn); + mkDprintf("$LogFile logical cluster number = 0x%llx\n", + opts.logfile_lcn); } /** @@ -3045,7 +3048,8 @@ static void mkntfs_initialize_rl_logfile(void) } opts.logfile_size = (opts.logfile_size + vol->cluster_size - 1) & ~(vol->cluster_size - 1); - Dprintf("$LogFile (journal) size = %ikiB\n", opts.logfile_size / 1024); + mkDprintf("$LogFile (journal) size = %ikiB\n", + opts.logfile_size / 1024); /* * FIXME: The 256kiB limit is arbitrary. Should find out what the real * minimum requirement for Windows is so it doesn't blue screen. @@ -3453,12 +3457,12 @@ static void mkntfs_create_root_structures(void) opts.sector_size); bs->bpb.media_type = 0xf8; /* hard disk */ bs->bpb.sectors_per_track = cpu_to_le16(opts.sectors_per_track); - Dprintf("sectors per track = %u (0x%x)\n", opts.sectors_per_track, + mkDprintf("sectors per track = %u (0x%x)\n", opts.sectors_per_track, opts.sectors_per_track); bs->bpb.heads = cpu_to_le16(opts.heads); - Dprintf("heads = %u (0x%x)\n", opts.heads, opts.heads); + mkDprintf("heads = %u (0x%x)\n", opts.heads, opts.heads); bs->bpb.hidden_sectors = cpu_to_le32(opts.part_start_sect); - Dprintf("hidden sectors = %llu (0x%llx)\n", opts.part_start_sect, + mkDprintf("hidden sectors = %llu (0x%llx)\n", opts.part_start_sect, opts.part_start_sect); /* * If there are problems go back to bs->unused[0-3] and set them. See @@ -3478,7 +3482,7 @@ static void mkntfs_create_root_structures(void) "is wrong (= 0x%x)\n", bs->clusters_per_mft_record); } - Dprintf("clusters per mft record = %i (0x%x)\n", + mkDprintf("clusters per mft record = %i (0x%x)\n", bs->clusters_per_mft_record, bs->clusters_per_mft_record); if (opts.index_block_size >= (int)vol->cluster_size) @@ -3492,7 +3496,7 @@ static void mkntfs_create_root_structures(void) "is wrong (= 0x%x)\n", bs->clusters_per_index_record); } - Dprintf("clusters per index block = %i (0x%x)\n", + mkDprintf("clusters per index block = %i (0x%x)\n", bs->clusters_per_index_record, bs->clusters_per_index_record); /* Generate a 64-bit random number for the serial number. */ diff --git a/ntfsprogs/ntfsmftalloc.c b/ntfsprogs/ntfsmftalloc.c index 5da3bbbc..6e75ed29 100644 --- a/ntfsprogs/ntfsmftalloc.c +++ b/ntfsprogs/ntfsmftalloc.c @@ -84,10 +84,11 @@ static struct { } opts; /** - * Dprintf - debugging output (-vv); overriden by quiet (-q) + * mkDprintf - debugging output (-vv); overriden by quiet (-q) */ -static void Dprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); -static void Dprintf(const char *fmt, ...) +static void mkDprintf(const char *fmt, ...) + __attribute__((format(printf, 1, 2))); +static void mkDprintf(const char *fmt, ...) { va_list ap; @@ -220,7 +221,7 @@ static void parse_options(int argc, char *argv[]) usage(); /* Get the device. */ dev_name = argv[optind++]; - Dprintf("device name = %s\n", dev_name); + mkDprintf("device name = %s\n", dev_name); if (optind != argc) { /* Get the base mft record number. */ ll = strtoll(argv[optind++], &s, 0); @@ -228,7 +229,7 @@ static void parse_options(int argc, char *argv[]) err_exit("Invalid base mft record number: %s\n", argv[optind - 1]); base_mft_no = ll; - Dprintf("base mft record number = 0x%llx\n", (long long)ll); + mkDprintf("base mft record number = 0x%llx\n", (long long)ll); } if (optind != argc) usage(); @@ -366,7 +367,7 @@ int main(int argc, char **argv) (long long)base_mft_no); printf(".\n"); if (!opts.quiet && opts.verbose > 1) { - Dprintf("Dumping allocated mft record 0x%llx:\n", + mkDprintf("Dumping allocated mft record 0x%llx:\n", (long long)ni->mft_no); dump_mft_record(ni->mrec); } diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 4bf5e8cc..f0e0ba0b 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -93,10 +93,11 @@ struct { } opts; /** - * Dprintf - debugging output (-vv); overriden by quiet (-q) + * mkDprintf - debugging output (-vv); overriden by quiet (-q) */ -static void Dprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); -static void Dprintf(const char *fmt, ...) +static void mkDprintf(const char *fmt, ...) + __attribute__((format(printf, 1, 2))); +static void mkDprintf(const char *fmt, ...) { va_list ap; @@ -233,7 +234,7 @@ static void parse_options(int argc, char *argv[]) /* Get the device. */ dev_name = argv[optind++]; - Dprintf("device name = %s\n", dev_name); + mkDprintf("device name = %s\n", dev_name); if (optind == argc) usage(); @@ -243,7 +244,7 @@ static void parse_options(int argc, char *argv[]) if (*s || !ll || (ll >= LLONG_MAX && errno == ERANGE)) err_exit("Invalid inode number: %s\n", argv[optind - 1]); inode = ll; - Dprintf("inode = %lli\n", (long long)inode); + mkDprintf("inode = %lli\n", (long long)inode); if (optind == argc) usage(); @@ -283,11 +284,11 @@ static void parse_options(int argc, char *argv[]) attr_name_len = 0; } } - Dprintf("attribute type = 0x%x\n", (unsigned int)attr_type); + mkDprintf("attribute type = 0x%x\n", (unsigned int)attr_type); if (attr_name == AT_UNNAMED) - Dprintf("attribute name = \"\" (UNNAMED)\n"); + mkDprintf("attribute name = \"\" (UNNAMED)\n"); else - Dprintf("attribute name = \"%s\" (length %u Unicode " + mkDprintf("attribute name = \"%s\" (length %u Unicode " "characters)\n", s2, (unsigned int)attr_name_len); @@ -296,7 +297,7 @@ static void parse_options(int argc, char *argv[]) if (*s2 || ll < 0 || (ll >= LLONG_MAX && errno == ERANGE)) err_exit("Invalid new length: %s\n", s); new_len = ll; - Dprintf("new length = %lli\n", new_len); + mkDprintf("new length = %lli\n", new_len); } /** @@ -791,7 +792,7 @@ int main(int argc, char **argv) (unsigned int)attr_type, strerror(errno)); if (!opts.quiet && opts.verbose > 1) { - Dprintf("Dumping mft record before calling " + mkDprintf("Dumping mft record before calling " "ntfs_attr_truncate():\n"); dump_mft_record(ni->mrec); } @@ -803,7 +804,7 @@ int main(int argc, char **argv) (unsigned int)attr_type, strerror(errno)); if (!opts.quiet && opts.verbose > 1) { - Dprintf("Dumping mft record after calling " + mkDprintf("Dumping mft record after calling " "ntfs_attr_truncate():\n"); dump_mft_record(ni->mrec); } From d1e57fd6339b4e99c5ec39f325f2b6c79c544de6 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 22 Dec 2004 14:04:41 +0000 Subject: [PATCH 2108/2994] Move NAttr{Sparse,Compressed,Encrypted} to inode struct preserving the previous interface. (Yura, with fixes from Anton) BKrev: 41c97ef9o2yO3PbIh3WejVzzMMIETg From b12041e518e5ff4aa6156f2bd738a8aba4e5fedb Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 22 Dec 2004 14:04:41 +0000 Subject: [PATCH 2109/2994] Update (Logical change 1.645) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 654dab1d..5857f3e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -91,6 +91,8 @@ xx/xx/2004 - 2.0.0-WIP - Extend ntfs_attr_pwrite to cope with extending the attribute size and with instantiating holes. (Yura) - Add new API's ntfs_rl_sparse and ntfs_rl_get_copmressed_size. (Yura) + - Move NAttr{Sparse,Compressed,Encrypted} to inode struct preserving + the previous interface. (Yura, with fixes from Anton) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 140a6d2479b903873bd026825b73296a7c2a6ab1 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 22 Dec 2004 14:22:09 +0000 Subject: [PATCH 2110/2994] Rename/move inode.[hc]::ntfs_inode_{add,rm}_attr() to attrib.[hc]::ntfs_attr_{add,rm}(), respectively. (Anton) (Logical change 1.646) --- include/ntfs/attrib.h | 9 +- libntfs/attrib.c | 502 +++++++++++++++++++++--------------------- ntfsprogs/ntfscp.c | 4 +- 3 files changed, 257 insertions(+), 258 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 0597f493..12048a93 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -295,6 +295,10 @@ extern int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ATTR_FLAGS flags); extern int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx); +extern ntfs_attr *ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, + ntfschar *name, u8 name_len, s64 size); +extern int ntfs_attr_rm(ntfs_attr *na); + extern int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size); extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, @@ -307,11 +311,6 @@ extern int ntfs_attr_update_mapping_pairs(ntfs_attr *na); extern int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize); -extern ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, - ntfschar *name, u8 name_len, s64 size); - -extern int ntfs_inode_rm_attr(ntfs_attr *na); - // FIXME / TODO: Above here the file is cleaned up. (AIA) /** * get_attribute_value_length - return the length of the value of an attribute diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 61be9484..daa43067 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2854,6 +2854,257 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { return 0; } +/** + * ntfs_attr_add - add attribute to inode + * @ni: opened ntfs inode to which add attribute + * @type: type of the new attribute + * @name: name in unicode of the new attribute + * @name_len: name length in unicode charcters of the new attribute + * @size: size of the new attribute + * + * If inode haven't got enogh space to add attribute, add attribute to one of it + * extents, if no extents present or no one of them have enough space, than + * allocate new extent and add attribute to it. + * + * If on one of this steps attribute list is needed but not present, than it is + * added transparently to caller. So, this function should not be called with + * @type == AT_ATTRIBUTE_LIST, if you really need to add attribute list call + * ntfs_inode_add_attrlist instead. + * + * On success return opened new ntfs attribute. On error return NULL with errno + * set to the error code. + */ +ntfs_attr *ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, + ntfschar *name, u8 name_len, s64 size) +{ + u32 attr_rec_size; + int err, i, offset; + ntfs_inode *attr_ni; + ntfs_attr *na; + + if (!ni || size < 0 || type == AT_ATTRIBUTE_LIST) { + Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + errno = EINVAL; + return NULL; + } + + Dprintf("%s(): Entering for inode 0x%llx, attr %x, size %lld.\n", + __FUNCTION__, (long long) ni->mft_no, type, size); + + if (ni->nr_extents == -1) + ni = ni->base_ni; + + /* Validate attribute type. */ + if (!ntfs_attr_find_in_attrdef(ni->vol, type)) { + if (errno == ENOENT) { + Dprintf("%s(): Invalid attribute type.\n", + __FUNCTION__); + errno = EINVAL; + return NULL; + } else { + err = errno; + Dprintf("%s(): ntfs_attr_find_in_attrdef failed.\n", + __FUNCTION__); + errno = err; + return NULL; + } + } + + /* + * Determine resident or not will be new attribute. We add 8 to size in + * non resident case for mapping pairs. + */ + if (ntfs_attr_can_be_resident(ni->vol, type)) { + if (errno != EPERM) { + err = errno; + Dprintf("%s(): ntfs_attr_can_be resident failed.\n", + __FUNCTION__); + goto err_out; + } + /* Attribute can't be resident. */ + attr_rec_size = offsetof(ATTR_RECORD, non_resident_end) + + ((name_len * sizeof(ntfschar) + 7) & ~7) + 8; + } else { + /* Attribute can be resident. */ + attr_rec_size = offsetof(ATTR_RECORD, resident_end) + + ((name_len * sizeof(ntfschar) + 7) & ~7); + /* Check whether attribute will fit into the MFT record. */ + if (size + attr_rec_size >= ni->vol->mft_record_size) + /* Will not fit, make it non resident. */ + attr_rec_size = offsetof(ATTR_RECORD, + non_resident_end) + ((name_len * + sizeof(ntfschar) + 7) & ~7) + 8; + } + + if (le32_to_cpu(ni->mrec->bytes_allocated) - + le32_to_cpu(ni->mrec->bytes_in_use) >= attr_rec_size) { + attr_ni = ni; + goto add_attr_record; + } + + /* Try to add to extent inodes. */ + if (ntfs_inode_attach_all_extents(ni)) { + err = errno; + Dprintf("%s(): Failed to attach all extents to inode.\n", + __FUNCTION__); + goto err_out; + } + for (i = 0; i < ni->nr_extents; i++) { + attr_ni = ni->extent_nis[i]; + if (le32_to_cpu(attr_ni->mrec->bytes_allocated) - + le32_to_cpu(attr_ni->mrec->bytes_in_use) >= + attr_rec_size) + goto add_attr_record; + } + + /* There is no extent that contain enough space for new attribute. */ + if (!NInoAttrList(ni)) { + /* Add attribute list not present, add it and retry. */ + if (ntfs_inode_add_attrlist(ni)) { + err = errno; + Dprintf("%s(): Failed to add attribute list.\n", + __FUNCTION__); + goto err_out; + } + return ntfs_attr_add(ni, type, name, name_len, size); + } + /* Allocate new extent. */ + attr_ni = ntfs_mft_record_alloc(ni->vol, ni); + if (!attr_ni) { + err = errno; + Dprintf("%s(): Failed to allocate extent record.\n", + __FUNCTION__); + goto err_out; + } + +add_attr_record: + if (attr_rec_size == offsetof(ATTR_RECORD, resident_end) + + ((name_len * sizeof(ntfschar) + 7) & ~7)) { + /* Add resident attribute. */ + offset = ntfs_resident_attr_record_add(attr_ni, type, name, + name_len, 0); + if (offset < 0) { + err = errno; + Dprintf("%s(): Failed to add resident attribute.\n", + __FUNCTION__); + goto free_err_out; + } + } else { + /* Add non resident attribute. */ + offset = ntfs_non_resident_attr_record_add(attr_ni, type, name, + name_len, 0, 8, 0); + if (offset < 0) { + err = errno; + Dprintf("%s(): Failed to add non resident attribute.\n", + __FUNCTION__); + goto free_err_out; + } + } + + /* Open new attribute and resize it. */ + na = ntfs_attr_open(ni, type, name, name_len); + if (!na) { + err = errno; + Dprintf("%s(): Failed to open just added attribute.\n", + __FUNCTION__); + goto rm_attr_err_out; + } + if (!size) + return na; + if (ntfs_attr_truncate(na, size)) { + err = errno; + Dprintf("%s(): Failed to resize just added attribute.\n", + __FUNCTION__); + if (ntfs_attr_rm(na)) { + Dprintf("%s(): Failed to remove just added attribute. " + "Probably leaving inconsist metadata.\n", + __FUNCTION__); + } + goto err_out; + } + /* Done !*/ + return na; + +rm_attr_err_out: + /* Remove just added attribute. */ + if (ntfs_attr_record_resize(attr_ni->mrec, + (ATTR_RECORD*)((u8*)attr_ni->mrec + offset), 0)) { + Dprintf("%s(): Failed to remove just added attribute.\n", + __FUNCTION__); + } +free_err_out: + /* Free MFT record, if it isn't contain attributes. */ + if (le32_to_cpu(attr_ni->mrec->bytes_in_use) - + le32_to_cpu(attr_ni->mrec->attrs_offset) == 8) { + if (ntfs_mft_record_free(attr_ni->vol, attr_ni)) { + Dprintf("%s(): Failed to free MFT record. Leaving " + "inconsist metadata.\n", __FUNCTION__); + } + } +err_out: + errno = err; + return NULL; +} + +/** + * ntfs_attr_rm - remove attribute from ntfs inode + * @na: opened ntfs attribute to delete + * + * Remove attribute and all it's extents from ntfs inode. If attribute was non + * resident also free all clusters allocated by attribute. + * + * Return 0 on success or -1 on error with errno set to the error code. + */ +int ntfs_attr_rm(ntfs_attr *na) +{ + ntfs_attr_search_ctx *ctx; + int ret = 0; + + if (!na) { + Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + + Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", + __FUNCTION__, (long long) na->ni->mft_no, na->type); + + /* Free cluster allocation. */ + if (NAttrNonResident(na)) { + if (ntfs_attr_map_whole_runlist(na)) + return -1; + if (ntfs_cluster_free(na->ni->vol, na, 0, -1) < 0) { + Dprintf("%s(): Failed to free cluster allocation. " + "Leaving inconsist metadata.\n", __FUNCTION__); + ret = -1; + } + } + + /* Search for attribute extents and remove them all. */ + ctx = ntfs_attr_get_search_ctx(na->ni, NULL); + if (!ctx) + return -1; + while (!ntfs_attr_lookup(na->type, na->name, na->name_len, + CASE_SENSITIVE, 0, NULL, 0, ctx)) { + if (ntfs_attr_record_rm(ctx)) { + Dprintf("%s(): Failed to remove attribute extent. " + "Leaving inconsist metadata.\n", __FUNCTION__); + ret = -1; + } + ntfs_attr_reinit_search_ctx(ctx); + } + if (errno != ENOENT) { + Dprintf("%s(): Attribute lookup failed. Probably leaving " + "inconsist metadata.\n", __FUNCTION__); + ret = -1; + } + + /* Throw away now non-exist attribute. */ + ntfs_attr_close(na); + /* Done. */ + return ret; +} + /** * ntfs_attr_record_resize - resize an attribute record * @m: mft record containing attribute record @@ -4588,254 +4839,3 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) } return ntfs_resident_attr_resize(na, newsize); } - -/** - * ntfs_inode_add_attr - add attribute to inode - * @ni: opened ntfs inode to which add attribute - * @type: type of the new attribute - * @name: name in unicode of the new attribute - * @name_len: name length in unicode charcters of the new attribute - * @size: size of the new attribute - * - * If inode haven't got enogh space to add attribute, add attribute to one of it - * extents, if no extents present or no one of them have enough space, than - * allocate new extent and add attribute to it. - * - * If on one of this steps attribute list is needed but not present, than it is - * added transparently to caller. So, this function should not be called with - * @type == AT_ATTRIBUTE_LIST, if you really need to add attribute list call - * ntfs_inode_add_attrlist instead. - * - * On success return opened new ntfs attribute. On error return NULL with errno - * set to the error code. - */ -ntfs_attr *ntfs_inode_add_attr(ntfs_inode *ni, ATTR_TYPES type, - ntfschar *name, u8 name_len, s64 size) -{ - u32 attr_rec_size; - int err, i, offset; - ntfs_inode *attr_ni; - ntfs_attr *na; - - if (!ni || size < 0 || type == AT_ATTRIBUTE_LIST) { - Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); - errno = EINVAL; - return NULL; - } - - Dprintf("%s(): Entering for inode 0x%llx, attr %x, size %lld.\n", - __FUNCTION__, (long long) ni->mft_no, type, size); - - if (ni->nr_extents == -1) - ni = ni->base_ni; - - /* Validate attribute type. */ - if (!ntfs_attr_find_in_attrdef(ni->vol, type)) { - if (errno == ENOENT) { - Dprintf("%s(): Invalid attribute type.\n", - __FUNCTION__); - errno = EINVAL; - return NULL; - } else { - err = errno; - Dprintf("%s(): ntfs_attr_find_in_attrdef failed.\n", - __FUNCTION__); - errno = err; - return NULL; - } - } - - /* - * Determine resident or not will be new attribute. We add 8 to size in - * non resident case for mapping pairs. - */ - if (ntfs_attr_can_be_resident(ni->vol, type)) { - if (errno != EPERM) { - err = errno; - Dprintf("%s(): ntfs_attr_can_be resident failed.\n", - __FUNCTION__); - goto err_out; - } - /* Attribute can't be resident. */ - attr_rec_size = offsetof(ATTR_RECORD, non_resident_end) + - ((name_len * sizeof(ntfschar) + 7) & ~7) + 8; - } else { - /* Attribute can be resident. */ - attr_rec_size = offsetof(ATTR_RECORD, resident_end) + - ((name_len * sizeof(ntfschar) + 7) & ~7); - /* Check whether attribute will fit into the MFT record. */ - if (size + attr_rec_size >= ni->vol->mft_record_size) - /* Will not fit, make it non resident. */ - attr_rec_size = offsetof(ATTR_RECORD, - non_resident_end) + ((name_len * - sizeof(ntfschar) + 7) & ~7) + 8; - } - - if (le32_to_cpu(ni->mrec->bytes_allocated) - - le32_to_cpu(ni->mrec->bytes_in_use) >= attr_rec_size) { - attr_ni = ni; - goto add_attr_record; - } - - /* Try to add to extent inodes. */ - if (ntfs_inode_attach_all_extents(ni)) { - err = errno; - Dprintf("%s(): Failed to attach all extents to inode.\n", - __FUNCTION__); - goto err_out; - } - for (i = 0; i < ni->nr_extents; i++) { - attr_ni = ni->extent_nis[i]; - if (le32_to_cpu(attr_ni->mrec->bytes_allocated) - - le32_to_cpu(attr_ni->mrec->bytes_in_use) >= - attr_rec_size) - goto add_attr_record; - } - - /* There is no extent that contain enough space for new attribute. */ - if (!NInoAttrList(ni)) { - /* Add attribute list not present, add it and retry. */ - if (ntfs_inode_add_attrlist(ni)) { - err = errno; - Dprintf("%s(): Failed to add attribute list.\n", - __FUNCTION__); - goto err_out; - } - return ntfs_inode_add_attr(ni, type, name, name_len, size); - } - /* Allocate new extent. */ - attr_ni = ntfs_mft_record_alloc(ni->vol, ni); - if (!attr_ni) { - err = errno; - Dprintf("%s(): Failed to allocate extent record.\n", - __FUNCTION__); - goto err_out; - } - -add_attr_record: - if (attr_rec_size == offsetof(ATTR_RECORD, resident_end) + - ((name_len * sizeof(ntfschar) + 7) & ~7)) { - /* Add resident attribute. */ - offset = ntfs_resident_attr_record_add(attr_ni, type, name, - name_len, 0); - if (offset < 0) { - err = errno; - Dprintf("%s(): Failed to add resident attribute.\n", - __FUNCTION__); - goto free_err_out; - } - } else { - /* Add non resident attribute. */ - offset = ntfs_non_resident_attr_record_add(attr_ni, type, name, - name_len, 0, 8, 0); - if (offset < 0) { - err = errno; - Dprintf("%s(): Failed to add non resident attribute.\n", - __FUNCTION__); - goto free_err_out; - } - } - - /* Open new attribute and resize it. */ - na = ntfs_attr_open(ni, type, name, name_len); - if (!na) { - err = errno; - Dprintf("%s(): Failed to open just added attribute.\n", - __FUNCTION__); - goto rm_attr_err_out; - } - if (!size) - return na; - if (ntfs_attr_truncate(na, size)) { - err = errno; - Dprintf("%s(): Failed to resize just added attribute.\n", - __FUNCTION__); - if (ntfs_inode_rm_attr(na)) { - Dprintf("%s(): Failed to remove just added attribute. " - "Probably leaving inconsist metadata.\n", - __FUNCTION__); - } - goto err_out; - } - /* Done !*/ - return na; - -rm_attr_err_out: - /* Remove just added attribute. */ - if (ntfs_attr_record_resize(attr_ni->mrec, - (ATTR_RECORD*)((u8*)attr_ni->mrec + offset), 0)) { - Dprintf("%s(): Failed to remove just added attribute.\n", - __FUNCTION__); - } -free_err_out: - /* Free MFT record, if it isn't contain attributes. */ - if (le32_to_cpu(attr_ni->mrec->bytes_in_use) - - le32_to_cpu(attr_ni->mrec->attrs_offset) == 8) { - if (ntfs_mft_record_free(attr_ni->vol, attr_ni)) { - Dprintf("%s(): Failed to free MFT record. Leaving " - "inconsist metadata.\n", __FUNCTION__); - } - } -err_out: - errno = err; - return NULL; -} - -/** - * ntfs_inode_rm_attr - remove attribute from ntfs inode - * @na: opened ntfs attribute to delete - * - * Remove attribute and all it's extents from ntfs inode. If attribute was non - * resident also free all clusters allocated by attribute. - * - * Return 0 on success or -1 on error with errno set to the error code. - */ -int ntfs_inode_rm_attr(ntfs_attr *na) -{ - ntfs_attr_search_ctx *ctx; - int ret = 0; - - if (!na) { - Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); - errno = EINVAL; - return -1; - } - - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", - __FUNCTION__, (long long) na->ni->mft_no, na->type); - - /* Free cluster allocation. */ - if (NAttrNonResident(na)) { - if (ntfs_attr_map_whole_runlist(na)) - return -1; - if (ntfs_cluster_free(na->ni->vol, na, 0, -1) < 0) { - Dprintf("%s(): Failed to free cluster allocation. " - "Leaving inconsist metadata.\n", __FUNCTION__); - ret = -1; - } - } - - /* Search for attribute extents and remove them all. */ - ctx = ntfs_attr_get_search_ctx(na->ni, NULL); - if (!ctx) - return -1; - while (!ntfs_attr_lookup(na->type, na->name, na->name_len, - CASE_SENSITIVE, 0, NULL, 0, ctx)) { - if (ntfs_attr_record_rm(ctx)) { - Dprintf("%s(): Failed to remove attribute extent. " - "Leaving inconsist metadata.\n", __FUNCTION__); - ret = -1; - } - ntfs_attr_reinit_search_ctx(ctx); - } - if (errno != ENOENT) { - Dprintf("%s(): Attribute lookup failed. Probably leaving " - "inconsist metadata.\n", __FUNCTION__); - ret = -1; - } - - /* Throw away now non-exist attribute. */ - ntfs_attr_close(na); - /* Done. */ - return ret; -} diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index fa0b557b..f3fdb8b0 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -317,8 +317,8 @@ int main (int argc, char *argv[]) goto close_dst; } /* Requested attribute isn't present, add it. */ - na = ntfs_inode_add_attr(out, opts.attribute, attr_name, - attr_name_len, 0); + na = ntfs_attr_add(out, opts.attribute, attr_name, + attr_name_len, 0); if (!na) { perror("ERROR: Couldn't add attribute"); goto close_dst; From 4a54f5e7147df8d152a03775f2ea8cb1e905ea8c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 22 Dec 2004 14:22:09 +0000 Subject: [PATCH 2111/2994] Rename/move inode.[hc]::ntfs_inode_{add,rm}_attr() to attrib.[hc]::ntfs_attr_{add,rm}(), respectively. (Anton) BKrev: 41c98311ZQbTDnqH0udx3c4vncCSig From 19fbf5b4907ea7151c009c0b1f4c356c23f561d2 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 22 Dec 2004 14:22:09 +0000 Subject: [PATCH 2112/2994] Update (Logical change 1.646) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5857f3e3..9323d46f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -93,6 +93,8 @@ xx/xx/2004 - 2.0.0-WIP - Add new API's ntfs_rl_sparse and ntfs_rl_get_copmressed_size. (Yura) - Move NAttr{Sparse,Compressed,Encrypted} to inode struct preserving the previous interface. (Yura, with fixes from Anton) + - Rename/move inode.[hc]::ntfs_inode_{add,rm}_attr() to + attrib.[hc]::ntfs_attr_{add,rm}(), respectively. (Anton) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 88f940caed3ede77679c4e13bb358f406bc544f0 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 22 Dec 2004 14:22:58 +0000 Subject: [PATCH 2113/2994] ntfsinfo: dump flags names for STANDARD_INFORMATION and FILE_NAME. (Logical change 1.647) --- ntfsprogs/ntfsinfo.c | 132 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 126 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 2596460c..8ca076da 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -394,7 +394,7 @@ static void ntfs_dump_volume(ntfs_volume *vol) static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) { STANDARD_INFORMATION *standard_attr = NULL; - u32 value_length; + u32 value_length, flags; standard_attr = (STANDARD_INFORMATION*)((char *)attr + le16_to_cpu(attr->value_offset)); @@ -424,8 +424,64 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) printf("\tLast Accessed Time:\t %s",ntfs_time_str); } - /* TODO: file_attributes - Flags describing the file. */ - + flags = standard_attr->file_attributes; + printf("\tFile attributes:\t"); + if (flags & FILE_ATTR_READONLY) { + printf(" READONLY"); + flags &= ~FILE_ATTR_READONLY; + } + if (flags & FILE_ATTR_HIDDEN) { + printf(" HIDDEN"); + flags &= ~FILE_ATTR_HIDDEN; + } + if (flags & FILE_ATTR_SYSTEM) { + printf(" SYSTEM"); + flags &= ~FILE_ATTR_SYSTEM; + } + if (flags & FILE_ATTR_ARCHIVE) { + printf(" ARCHIVE"); + flags &= ~FILE_ATTR_ARCHIVE; + } + if (flags & FILE_ATTR_DEVICE) { + printf(" DEVICE"); + flags &= ~FILE_ATTR_DEVICE; + } + if (flags & FILE_ATTR_NORMAL) { + printf(" NORMAL"); + flags &= ~FILE_ATTR_NORMAL; + } + if (flags & FILE_ATTR_TEMPORARY) { + printf(" TEMPORARY"); + flags &= ~FILE_ATTR_TEMPORARY; + } + if (flags & FILE_ATTR_SPARSE_FILE) { + printf(" SPARSE_FILE"); + flags &= ~FILE_ATTR_SPARSE_FILE; + } + if (flags & FILE_ATTR_REPARSE_POINT) { + printf(" REPARSE_POINT"); + flags &= ~FILE_ATTR_REPARSE_POINT; + } + if (flags & FILE_ATTR_COMPRESSED) { + printf(" COMPRESSED"); + flags &= ~FILE_ATTR_COMPRESSED; + } + if (flags & FILE_ATTR_OFFLINE) { + printf(" OFFLINE"); + flags &= ~FILE_ATTR_OFFLINE; + } + if (flags & FILE_ATTR_NOT_CONTENT_INDEXED) { + printf(" NOT_CONTENT_INDEXED"); + flags &= ~FILE_ATTR_NOT_CONTENT_INDEXED; + } + if (flags & FILE_ATTR_ENCRYPTED) { + printf(" ENCRYPTED"); + flags &= ~FILE_ATTR_ENCRYPTED; + } + if (flags) + printf(" UNKNOWN: 0x%x", le32_to_cpu(flags)); + printf("\n"); + printf("\tMax Number of Versions:\t %u \n", (unsigned int)le32_to_cpu(standard_attr->maximum_versions)); printf("\tVersion Number:\t\t %u \n", @@ -555,6 +611,7 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) { FILE_NAME_ATTR *file_name_attr = NULL; + u32 flags; file_name_attr = (FILE_NAME_ATTR*)((char *)attr + le16_to_cpu(attr->value_offset)); @@ -593,8 +650,71 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) (long long)sle64_to_cpu(file_name_attr->allocated_size)); printf("\tReal File Size:\t\t %lld\n", (long long)sle64_to_cpu(file_name_attr->data_size)); - printf("\tFile attributes:\t %x\n", - le32_to_cpu(file_name_attr->file_attributes)); + flags = file_name_attr->file_attributes; + printf("\tFile attributes:\t"); + if (flags & FILE_ATTR_READONLY) { + printf(" READONLY"); + flags &= ~FILE_ATTR_READONLY; + } + if (flags & FILE_ATTR_HIDDEN) { + printf(" HIDDEN"); + flags &= ~FILE_ATTR_HIDDEN; + } + if (flags & FILE_ATTR_SYSTEM) { + printf(" SYSTEM"); + flags &= ~FILE_ATTR_SYSTEM; + } + if (flags & FILE_ATTR_ARCHIVE) { + printf(" ARCHIVE"); + flags &= ~FILE_ATTR_ARCHIVE; + } + if (flags & FILE_ATTR_DEVICE) { + printf(" DEVICE"); + flags &= ~FILE_ATTR_DEVICE; + } + if (flags & FILE_ATTR_NORMAL) { + printf(" NORMAL"); + flags &= ~FILE_ATTR_NORMAL; + } + if (flags & FILE_ATTR_TEMPORARY) { + printf(" TEMPORARY"); + flags &= ~FILE_ATTR_TEMPORARY; + } + if (flags & FILE_ATTR_SPARSE_FILE) { + printf(" SPARSE_FILE"); + flags &= ~FILE_ATTR_SPARSE_FILE; + } + if (flags & FILE_ATTR_REPARSE_POINT) { + printf(" REPARSE_POINT"); + flags &= ~FILE_ATTR_REPARSE_POINT; + } + if (flags & FILE_ATTR_COMPRESSED) { + printf(" COMPRESSED"); + flags &= ~FILE_ATTR_COMPRESSED; + } + if (flags & FILE_ATTR_OFFLINE) { + printf(" OFFLINE"); + flags &= ~FILE_ATTR_OFFLINE; + } + if (flags & FILE_ATTR_NOT_CONTENT_INDEXED) { + printf(" NOT_CONTENT_INDEXED"); + flags &= ~FILE_ATTR_NOT_CONTENT_INDEXED; + } + if (flags & FILE_ATTR_ENCRYPTED) { + printf(" ENCRYPTED"); + flags &= ~FILE_ATTR_ENCRYPTED; + } + if (flags & FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) { + printf(" DIRECTORY"); + flags &= ~FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; + } + if (flags & FILE_ATTR_DUP_VIEW_INDEX_PRESENT) { + printf(" INDEX_VIEW"); + flags &= ~FILE_ATTR_DUP_VIEW_INDEX_PRESENT; + } + if (flags) + printf(" UNKNOWN: 0x%x", le32_to_cpu(flags)); + printf("\n"); /* time stuff stuff */ if (!opts.notime) { @@ -1268,7 +1388,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) } else { printf("\tIndex name:\t\t unnamed\n"); } - + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* dump index's size */ From cabfe8938655e45f0747b39dc48c73c690034720 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 22 Dec 2004 14:22:58 +0000 Subject: [PATCH 2114/2994] Manual merge 2004/12/22 12:40:19+02:00 (none)!yura Update. (Logical change 1.647) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9323d46f..3ac5b40f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -91,6 +91,8 @@ xx/xx/2004 - 2.0.0-WIP - Extend ntfs_attr_pwrite to cope with extending the attribute size and with instantiating holes. (Yura) - Add new API's ntfs_rl_sparse and ntfs_rl_get_copmressed_size. (Yura) + - ntfsinfo: Dump flags names for $STANDARD_INFORMATION and $FILE_NAME + attributes. (Yura) - Move NAttr{Sparse,Compressed,Encrypted} to inode struct preserving the previous interface. (Yura, with fixes from Anton) - Rename/move inode.[hc]::ntfs_inode_{add,rm}_attr() to From a49787860d3a5ad5490e5989814f187f9911210f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 22 Dec 2004 14:22:58 +0000 Subject: [PATCH 2115/2994] Manual merge 2004/12/22 12:40:19+02:00 (none)!yura ntfsinfo: dump flags names for STANDARD_INFORMATION and FILE_NAME. BKrev: 41c98342kN_XIzHVKErey7McLiNzzA From 5325a7c608d36c3dc4bd41fc705628f185bcf825 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 22 Dec 2004 16:17:07 +0000 Subject: [PATCH 2116/2994] Set NIno{Compressed,Sparse,Encrypted} during ntfs_inode_open (Logical change 1.648) --- libntfs/inode.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libntfs/inode.c b/libntfs/inode.c index 89c506d5..f2692341 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -108,6 +108,7 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) ntfs_inode *ni; ntfs_attr_search_ctx *ctx; int err = 0; + STANDARD_INFORMATION *std_info; Dprintf("%s(): Entering for inode 0x%llx.\n", __FUNCTION__, MREF(mref)); if (!vol) { @@ -125,6 +126,22 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) goto err_out; + /* Receive some basic information about inode. */ + if (ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, + 0, CASE_SENSITIVE, 0, NULL, 0, ctx)) { + err = errno; + Dprintf("%s(): Failed to receive STANDARD_INFORMATION " + "attribute.\n", __FUNCTION__); + goto put_err_out; + } + std_info = (STANDARD_INFORMATION *)((u8 *)ctx->attr + + le16_to_cpu(ctx->attr->value_offset)); + if (std_info->file_attributes & FILE_ATTR_COMPRESSED) + NInoSetCompressed(ni); + if (std_info->file_attributes & FILE_ATTR_ENCRYPTED) + NInoSetEncrypted(ni); + if (std_info->file_attributes & FILE_ATTR_SPARSE_FILE) + NInoSetSparse(ni); if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { if (errno != ENOENT) From a35819aceb8a917988538d2746453b7893c111d4 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 22 Dec 2004 16:17:07 +0000 Subject: [PATCH 2117/2994] Set NIno{Compressed,Sparse,Encrypted} during ntfs_inode_open BKrev: 41c99e03NjRVGmr9sydCgZU6DMqq9Q From 8d8b53331f7cd6fea8ddf81eae1e87e70fa7a719 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 22 Dec 2004 16:34:02 +0000 Subject: [PATCH 2118/2994] Fix error message in NAttrSet##flag: should not be called for not data attributes. (Logical change 1.649) --- include/ntfs/attrib.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 12048a93..3b4787e5 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -214,8 +214,9 @@ static inline void NAttrSet##flag(ntfs_attr *na) \ if (na->type == AT_DATA && na->name == AT_UNNAMED) \ NInoSet##flag(na->ni); \ else \ - Dprintf("%s(): BUG! Called for named data " \ - "attribute.\n", __FUNCTION__); \ + Dprintf("%s(): BUG! Should be called only for " \ + "unnamed data attribute.\n", \ + __FUNCTION__); \ } \ static inline void NAttrClear##flag(ntfs_attr *na) \ { \ From 29e21e6833bdf154d2f89e0419639f4d3700f86f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 22 Dec 2004 16:34:02 +0000 Subject: [PATCH 2119/2994] Fix error message in NAttrSet##flag: should not be called for not data attributes. BKrev: 41c9a1fa1DY9yWJzdou2x9g6dVCHDQ From 48dee17d12e927d9dbf01c8dfecb3e6b752e718f Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 22 Dec 2004 16:42:46 +0000 Subject: [PATCH 2120/2994] I understood that it's safe to uncomment some pieces of code. (Logical change 1.650) --- libntfs/attrib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index daa43067..9e9d9e0a 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -4496,7 +4496,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = cpu_to_sle64(na->allocated_size); } -#if 0 + /* Update compressed_size if present. */ if (NAttrSparse(na) || NAttrCompressed(na)) { s64 new_compr_size; @@ -4511,7 +4511,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) na->compressed_size = new_compr_size; a->compressed_size = cpu_to_sle64(new_compr_size); } -#endif + /* Update data and initialized size. */ na->data_size = newsize; a->data_size = cpu_to_sle64(newsize); @@ -4718,7 +4718,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = cpu_to_sle64(na->allocated_size); } -#if 0 + /* Update compressed_size if present. */ if (NAttrSparse(na) || NAttrCompressed(na)) { s64 new_compr_size; @@ -4733,7 +4733,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) na->compressed_size = new_compr_size; a->compressed_size = cpu_to_sle64(new_compr_size); } -#endif + /* Update data size. */ na->data_size = newsize; a->data_size = cpu_to_sle64(newsize); From be6b3c9bddf6b3232d2f535b586451e2f4ad3279 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 22 Dec 2004 16:42:46 +0000 Subject: [PATCH 2121/2994] attrib.c: I understood that it's safe to uncomment some pieces of code. BKrev: 41c9a406U4cuL4pvCIZaVzQ_Ck-YCg From 59a2803283df85fe465003ae07270816f2dcbff4 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 22 Dec 2004 18:06:07 +0000 Subject: [PATCH 2122/2994] Update standard information during inode sync. (Logical change 1.651) --- libntfs/inode.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index f2692341..f2559039 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -391,7 +391,7 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) return -1; } - /* Walk thru attribute list and attach all extents. */ + /* Walk though attribute list and attach all extents. */ errno = 0; ale = (ATTR_LIST_ENTRY *)ni->attr_list; while ((u8*)ale < ni->attr_list + ni->attr_list_size) { @@ -405,6 +405,47 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) return 0; } +/** + * ntfs_inode_sync_standard_information - update standard informaiton attribute + * @ni: ntfs inode to update standard information + * + * Return 0 on success or -1 on error with errno set to the error code. + */ +int ntfs_inode_sync_standard_information(ntfs_inode *ni) { + ntfs_attr_search_ctx *ctx; + STANDARD_INFORMATION *std_info; + int err; + + ctx = ntfs_attr_get_search_ctx(ni, NULL); + if (!ctx) + return -1; + if (ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, + 0, CASE_SENSITIVE, 0, NULL, 0, ctx)) { + err = errno; + Dprintf("%s(): Failed to receive STANDARD_INFORMATION " + "attribute.\n", __FUNCTION__); + ntfs_attr_put_search_ctx(ctx); + errno = err; + return -1; + } + std_info = (STANDARD_INFORMATION *)((u8 *)ctx->attr + + le16_to_cpu(ctx->attr->value_offset)); + if (NInoCompressed(ni)) + std_info->file_attributes |= FILE_ATTR_COMPRESSED; + else + std_info->file_attributes &= ~FILE_ATTR_COMPRESSED; + if (NInoEncrypted(ni)) + std_info->file_attributes |= FILE_ATTR_ENCRYPTED; + else + std_info->file_attributes &= ~FILE_ATTR_ENCRYPTED; + if (NInoSparse(ni)) + std_info->file_attributes |= FILE_ATTR_SPARSE_FILE; + else + std_info->file_attributes &= ~FILE_ATTR_SPARSE_FILE; + ntfs_attr_put_search_ctx(ctx); + ntfs_inode_mark_dirty(ni); + return 0; +} /** * ntfs_inode_sync - write the inode (and its dirty extents) to disk @@ -437,6 +478,17 @@ int ntfs_inode_sync(ntfs_inode *ni) Dprintf("%s(): Entering for inode 0x%llx.\n", __FUNCTION__, (long long) ni->mft_no); + /* Update STANDARD_INFORMATION. */ + if (ntfs_inode_sync_standard_information(ni)) { + if (!err || errno == EIO) { + err = errno; + if (err != EIO) + err = EBUSY; + } + Dprintf("%s(): Failed to sync standard information.\n", + __FUNCTION__); + } + /* Write out attribute list from cache to disk. */ if (ni->nr_extents != -1 && NInoAttrList(ni) && NInoAttrListTestAndClearDirty(ni)) { @@ -516,8 +568,10 @@ int ntfs_inode_sync(ntfs_inode *ni) } } + // TODO: Update FILE_NAME attribute in the index. + if (!err) - return err; + return 0; errno = err; return -1; } From f3d6f4c50910d30669cc916aa7f808cd5002b1b3 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 22 Dec 2004 18:06:07 +0000 Subject: [PATCH 2123/2994] Update standard information during inode sync. BKrev: 41c9b78fWhDoeYhhQ88S2erLCWWtGA From b86f85b7f18a468876765e989f83368bc8f370df Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Wed, 22 Dec 2004 18:06:07 +0000 Subject: [PATCH 2124/2994] Update. (Logical change 1.651) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3ac5b40f..8fec2b1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -97,6 +97,8 @@ xx/xx/2004 - 2.0.0-WIP the previous interface. (Yura, with fixes from Anton) - Rename/move inode.[hc]::ntfs_inode_{add,rm}_attr() to attrib.[hc]::ntfs_attr_{add,rm}(), respectively. (Anton) + - Update sparse/compressed/encrypted bits in STANDARD_INFORMATION + during inode sync. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 81fd8478ff01f195627a9ea62843eface5e81066 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 23 Dec 2004 11:27:38 +0000 Subject: [PATCH 2125/2994] Fix potential bug in ntfs_inode_sync_standard_information (potential, because standard information seems always to be in the base mft record) (Logical change 1.652) --- libntfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index f2559039..1da2d8e4 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -442,8 +442,8 @@ int ntfs_inode_sync_standard_information(ntfs_inode *ni) { std_info->file_attributes |= FILE_ATTR_SPARSE_FILE; else std_info->file_attributes &= ~FILE_ATTR_SPARSE_FILE; + ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); - ntfs_inode_mark_dirty(ni); return 0; } From eab699277f8eac10ff171fe5c8d577b147bbbf80 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 23 Dec 2004 11:27:38 +0000 Subject: [PATCH 2126/2994] Fix potential bug in ntfs_inode_sync_standard_information (potential, because standard information seems always to be in the base mft record) BKrev: 41caabaakKs29-8ja4gdzl-QNV_1EQ From 14db887f8e700dd3156c6ba737841050d6730771 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 11 Jan 2005 20:28:28 +0000 Subject: [PATCH 2127/2994] Rename NTFS_SECTOR_SIZE to NTFS_BLOCK_SIZE to keep in sync with kernel driver. (Logical change 1.653) --- ChangeLog | 2 ++ include/ntfs/layout.h | 9 +++------ libntfs/attrib.c | 4 ++-- libntfs/device.c | 4 ++-- libntfs/dir.c | 4 ++-- libntfs/mft.c | 4 ++-- libntfs/mst.c | 24 ++++++++++++------------ ntfsprogs/mkntfs.c | 4 ++-- ntfsprogs/ntfsdump_logfile.c | 4 ++-- 9 files changed, 29 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8fec2b1d..acdf636a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -99,6 +99,8 @@ xx/xx/2004 - 2.0.0-WIP attrib.[hc]::ntfs_attr_{add,rm}(), respectively. (Anton) - Update sparse/compressed/encrypted bits in STANDARD_INFORMATION during inode sync. (Yura) + - Rename NTFS_SECTOR_SIZE to NTFS_BLOCK_SIZE to keep in sync with + kernel driver. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 1b44191b..5bfe16f2 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -158,12 +158,9 @@ typedef enum { #define ntfs_is_empty_record(x) ( ntfs_is_magic (x, empty) ) #define ntfs_is_empty_recordp(p) ( ntfs_is_magicp(p, empty) ) -/* - * Defines for the NTFS filesystem. Don't want to use BLOCK_SIZE and - * BLOCK_SIZE_BITS from the kernel as that is 1024 and hence too high for us. - */ -#define NTFS_SECTOR_SIZE 512 -#define NTFS_SECTOR_SIZE_BITS 9 + +#define NTFS_BLOCK_SIZE 512 +#define NTFS_BLOCK_SIZE_BITS 9 /* * The Update Sequence Array (usa) is an array of the u16 values which belong diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 9e9d9e0a..ba2c2edc 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1365,7 +1365,7 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, Dprintf("%s(): Entering for inode 0x%llx, attr type 0x%x, pos 0x%llx.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type, (long long)pos); - if (bk_cnt < 0 || bk_size % NTFS_SECTOR_SIZE) { + if (bk_cnt < 0 || bk_size % NTFS_BLOCK_SIZE) { errno = EINVAL; return -1; } @@ -1417,7 +1417,7 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, Dprintf("%s(): Entering for inode 0x%llx, attr type 0x%x, pos 0x%llx.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type, (long long)pos); - if (bk_cnt < 0 || bk_size % NTFS_SECTOR_SIZE) { + if (bk_cnt < 0 || bk_size % NTFS_BLOCK_SIZE) { errno = EINVAL; return -1; } diff --git a/libntfs/device.c b/libntfs/device.c index f11bbc38..461fa6ac 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -272,7 +272,7 @@ s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count, { s64 br, i; - if (bksize & (bksize - 1) || bksize % NTFS_SECTOR_SIZE) { + if (bksize & (bksize - 1) || bksize % NTFS_BLOCK_SIZE) { errno = EINVAL; return -1; } @@ -329,7 +329,7 @@ s64 ntfs_mst_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, { s64 written, i; - if (count < 0 || bksize % NTFS_SECTOR_SIZE) { + if (count < 0 || bksize % NTFS_BLOCK_SIZE) { errno = EINVAL; return -1; } diff --git a/libntfs/dir.c b/libntfs/dir.c index f75e708b..d2354d44 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -109,7 +109,7 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname, ir = (INDEX_ROOT*)((u8*)ctx->attr + le16_to_cpu(ctx->attr->value_offset)); index_block_size = le32_to_cpu(ir->index_block_size); - if (index_block_size < NTFS_SECTOR_SIZE || + if (index_block_size < NTFS_BLOCK_SIZE || index_block_size & (index_block_size - 1)) { Dprintf("Index block size %u is invalid.\n", index_block_size); goto put_err_out; @@ -699,7 +699,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, /* Determine the size of a vcn in the directory index. */ index_block_size = le32_to_cpu(ir->index_block_size); - if (index_block_size < NTFS_SECTOR_SIZE || + if (index_block_size < NTFS_BLOCK_SIZE || index_block_size & (index_block_size - 1)) { Dprintf("Index block size %u is invalid.\n", index_block_size); goto dir_err_out; diff --git a/libntfs/mft.c b/libntfs/mft.c index f93829e9..21f5eede 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -296,9 +296,9 @@ int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref, m->mft_record_number = cpu_to_le32(MREF(mref)); } m->magic = magic_FILE; - if (vol->mft_record_size >= NTFS_SECTOR_SIZE) + if (vol->mft_record_size >= NTFS_BLOCK_SIZE) m->usa_count = cpu_to_le16(vol->mft_record_size / - NTFS_SECTOR_SIZE + 1); + NTFS_BLOCK_SIZE + 1); else { m->usa_count = cpu_to_le16(1); Dprintf("Sector size is bigger than MFT record size. " diff --git a/libntfs/mst.c b/libntfs/mst.c index f9f93e11..f2564ff0 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -50,9 +50,9 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size) /* Decrement usa_count to get number of fixups. */ usa_count = le16_to_cpu(b->usa_count) - 1; /* Size and alignment checks. */ - if (size & (NTFS_SECTOR_SIZE - 1) || usa_ofs & 1 || + if (size & (NTFS_BLOCK_SIZE - 1) || usa_ofs & 1 || (u32)(usa_ofs + (usa_count * 2)) > size || - (size >> NTFS_SECTOR_SIZE_BITS) != usa_count) { + (size >> NTFS_BLOCK_SIZE_BITS) != usa_count) { errno = EINVAL; return -1; } @@ -69,7 +69,7 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size) /* * Position in protected data of first u16 that needs fixing up. */ - data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1; + data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1; /* * Check for incomplete multi sector transfer(s). */ @@ -84,11 +84,11 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size) errno = EIO; return -1; } - data_pos += NTFS_SECTOR_SIZE/sizeof(u16); + data_pos += NTFS_BLOCK_SIZE/sizeof(u16); } /* Re-setup the variables. */ usa_count = le16_to_cpu(b->usa_count) - 1; - data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1; + data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1; /* Fixup all sectors. */ while (usa_count--) { /* @@ -97,7 +97,7 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size) */ *data_pos = *(++usa_pos); /* Increment position in data as well. */ - data_pos += NTFS_SECTOR_SIZE/sizeof(u16); + data_pos += NTFS_BLOCK_SIZE/sizeof(u16); } return 0; } @@ -138,9 +138,9 @@ int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size) /* Decrement usa_count to get number of fixups. */ usa_count = le16_to_cpu(b->usa_count) - 1; /* Size and alignment checks. */ - if (size & (NTFS_SECTOR_SIZE - 1) || usa_ofs & 1 || + if (size & (NTFS_BLOCK_SIZE - 1) || usa_ofs & 1 || (u32)(usa_ofs + (usa_count * 2)) > size || - (size >> NTFS_SECTOR_SIZE_BITS) != usa_count) { + (size >> NTFS_BLOCK_SIZE_BITS) != usa_count) { errno = EINVAL; return -1; } @@ -156,7 +156,7 @@ int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size) usn = cpu_to_le16(usn); *usa_pos = usn; /* Position in data of first u16 that needs fixing up. */ - data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1; + data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1; /* Fixup all sectors. */ while (usa_count--) { /* @@ -167,7 +167,7 @@ int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size) /* Apply fixup to data. */ *data_pos = usn; /* Increment position in data as well. */ - data_pos += NTFS_SECTOR_SIZE/sizeof(u16); + data_pos += NTFS_BLOCK_SIZE/sizeof(u16); } return 0; } @@ -192,7 +192,7 @@ void ntfs_mst_post_write_fixup(NTFS_RECORD *b) usa_pos = (u16*)b + usa_ofs/sizeof(u16); /* Position in protected data of first u16 that needs fixing up. */ - data_pos = (u16*)b + NTFS_SECTOR_SIZE/sizeof(u16) - 1; + data_pos = (u16*)b + NTFS_BLOCK_SIZE/sizeof(u16) - 1; /* Fixup all sectors. */ while (usa_count--) { @@ -203,7 +203,7 @@ void ntfs_mst_post_write_fixup(NTFS_RECORD *b) *data_pos = *(++usa_pos); /* Increment position in data as well. */ - data_pos += NTFS_SECTOR_SIZE/sizeof(u16); + data_pos += NTFS_BLOCK_SIZE/sizeof(u16); } } diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index a58498c6..b941fb12 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2132,9 +2132,9 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, /* Setup header. */ ia_val->magic = magic_INDX; ia_val->usa_ofs = cpu_to_le16(sizeof(INDEX_ALLOCATION)); - if (index_block_size >= NTFS_SECTOR_SIZE) + if (index_block_size >= NTFS_BLOCK_SIZE) ia_val->usa_count = cpu_to_le16(index_block_size / - NTFS_SECTOR_SIZE + 1); + NTFS_BLOCK_SIZE + 1); else { ia_val->usa_count = cpu_to_le16(1); Qprintf("Sector size is bigger than index block size. Setting " diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 205711db..379791db 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -295,7 +295,7 @@ static void restart_header_sanity(RESTART_PAGE_HEADER *rstr, u8 *buf) /* Verify the location and size of the update sequence array. */ usa_end_ofs = le16_to_cpu(rstr->usa_ofs) + le16_to_cpu(rstr->usa_count) * sizeof(u16); - if (page_size / NTFS_SECTOR_SIZE + 1 != le16_to_cpu(rstr->usa_count)) + if (page_size / NTFS_BLOCK_SIZE + 1 != le16_to_cpu(rstr->usa_count)) log_err_exit(buf, "Restart page header in $LogFile is " "corrupt: Update sequence array size is " "wrong. Cannot handle this yet.\n"); @@ -304,7 +304,7 @@ static void restart_header_sanity(RESTART_PAGE_HEADER *rstr, u8 *buf) "corrupt: Update sequence array overlaps " "restart page header. Cannot handle this " "yet.\n"); - if (usa_end_ofs > NTFS_SECTOR_SIZE - sizeof(u16)) + if (usa_end_ofs > NTFS_BLOCK_SIZE - sizeof(u16)) log_err_exit(buf, "Restart page header in $LogFile is " "corrupt: Update sequence array overlaps or " "is behind first protected sequence number. " From 08293a1a28ad0d88059b611d4b41fad894507219 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Tue, 11 Jan 2005 20:28:28 +0000 Subject: [PATCH 2128/2994] Rename NTFS_SECTOR_SIZE to NTFS_BLOCK_SIZE to keep in sync with kernel driver. BKrev: 41e436ecw_gRdvsNI5O_80WR0Gaizg From a05c3cc3e1e5fe7838019bd1be661d376f95db04 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 13 Jan 2005 09:56:56 +0000 Subject: [PATCH 2129/2994] Update to more recent build tools. (Logical change 1.654) --- INSTALL | 52 ++++++++++++------------ Makefile.in | 2 +- aclocal.m4 | 4 +- compile | 86 +++++++++++++++++++++------------------- config.guess | 26 ++++++------ config.sub | 5 ++- doc/Makefile.in | 2 +- include/Makefile.in | 2 +- include/ntfs/Makefile.in | 2 +- install-sh | 9 +++-- libntfs/Makefile.in | 14 +++---- missing | 77 ++++++++++++++++------------------- ntfsprogs/Makefile.in | 4 +- 13 files changed, 145 insertions(+), 140 deletions(-) diff --git a/INSTALL b/INSTALL index 54caf7c1..095b1eb4 100644 --- a/INSTALL +++ b/INSTALL @@ -1,13 +1,16 @@ -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software -Foundation, Inc. +Installation Instructions +************************* - This file is free documentation; the Free Software Foundation gives +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== - These are generic installation instructions. +These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses @@ -67,9 +70,9 @@ The simplest way to compile this package is: Compilers and Options ===================== - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here @@ -82,7 +85,7 @@ is an example: Compiling For Multiple Architectures ==================================== - You can compile the package for more than one kind of computer at the +You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the @@ -99,19 +102,19 @@ for another architecture. Installation Names ================== - By default, `make install' will install the package's files in +By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. +option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. +give `configure' the option `--exec-prefix=PREFIX', the package will +use PREFIX as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular +options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. @@ -122,7 +125,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= - Some packages pay attention to `--enable-FEATURE' options to +Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The @@ -137,11 +140,11 @@ you can use the `configure' options `--x-includes=DIR' and Specifying the System Type ========================== - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: @@ -167,9 +170,9 @@ eventually be run) with `--host=TYPE'. Sharing Defaults ================ - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. @@ -178,7 +181,7 @@ A warning: not all `configure' scripts look for a site script. Defining Variables ================== - Variables not defined in a site shell script can be set in the +Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set @@ -192,8 +195,7 @@ overridden in the site shell script). `configure' Invocation ====================== - `configure' recognizes the following options to control how it -operates. +`configure' recognizes the following options to control how it operates. `--help' `-h' diff --git a/Makefile.in b/Makefile.in index 7d7a0391..92efbf1a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.1 from Makefile.am. +# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/aclocal.m4 b/aclocal.m4 index 7310a0e3..9a7124af 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.9.1 -*- Autoconf -*- +# generated automatically by aclocal 1.9.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. @@ -6050,7 +6050,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # 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.9.1])]) + [AM_AUTOMAKE_VERSION([1.9.3])]) # AM_AUX_DIR_EXPAND diff --git a/compile b/compile index a81e000a..3d217032 100755 --- a/compile +++ b/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand `-c -o'. -scriptversion=2003-11-09.00 +scriptversion=2004-10-12.08 -# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -55,37 +55,41 @@ EOF ;; esac - -prog=$1 -shift - ofile= cfile= -args= -while test $# -gt 0; do - case "$1" in - -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we do something ugly here. - ofile=$2 - shift - case "$ofile" in - *.o | *.obj) - ;; - *) - args="$args -o $ofile" - ofile= - ;; - esac - ;; - *.c) - cfile=$1 - args="$args $1" - ;; - *) - args="$args $1" - ;; - esac +eat= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we strip `-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi shift done @@ -95,36 +99,38 @@ if test -z "$ofile" || test -z "$cfile"; then # normal compilation that the losing compiler can handle. If no # `.c' file was seen then we are probably linking. That is also # ok. - exec "$prog" $args + exec "$@" fi # Name of file we expect compiler to create. -cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` +cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` # Create the lock directory. # Note: use `[/.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. -lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d +lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d while true; do - if mkdir $lockdir > /dev/null 2>&1; then + if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir $lockdir; exit 1" 1 2 15 +trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. -"$prog" $args -status=$? +"$@" +ret=$? if test -f "$cofile"; then mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + mv "${cofile}bj" "$ofile" fi -rmdir $lockdir -exit $status +rmdir "$lockdir" +exit $ret # Local Variables: # mode: shell-script diff --git a/config.guess b/config.guess index d949270a..94bb5219 100755 --- a/config.guess +++ b/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-08-11' +timestamp='2004-10-25' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -213,9 +213,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -240,18 +237,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} + echo mips64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -361,7 +352,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; @@ -843,6 +834,12 @@ EOF cris:Linux:*:*) echo cris-axis-linux exit 0 ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux + exit 0 ;; + frv:Linux:*:*) + echo frv-${VENDOR}-linux + exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; @@ -1260,7 +1257,10 @@ EOF A*) echo alpha-dec-vms && exit 0 ;; I*) echo ia64-dec-vms && exit 0 ;; V*) echo vax-dec-vms && exit 0 ;; - esac + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/config.sub b/config.sub index 236e424d..a7e2762a 100755 --- a/config.sub +++ b/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-06-24' +timestamp='2004-08-29' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -457,6 +457,9 @@ case $basic_machine in crds | unos) basic_machine=m68k-crds ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; diff --git a/doc/Makefile.in b/doc/Makefile.in index 6e22c40d..3a3a27d1 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.1 from Makefile.am. +# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/include/Makefile.in b/include/Makefile.in index 6910f183..be3a902c 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.1 from Makefile.am. +# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index bbd4870e..5d26253c 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.1 from Makefile.am. +# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/install-sh b/install-sh index b777f124..0b65ee87 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-07-05.00 +scriptversion=2004-10-22.00 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -213,7 +213,7 @@ do fi # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. @@ -226,7 +226,8 @@ do oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' - set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift IFS=$oIFS pathcomp= @@ -260,7 +261,7 @@ do rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. - trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 70d09650..2ddd1df0 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.1 from Makefile.am. +# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -107,11 +107,11 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) @@ -418,18 +418,18 @@ distclean-compile: @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c mostlyclean-libtool: -rm -f *.lo diff --git a/missing b/missing index e7ef83a1..64b5f901 100755 --- a/missing +++ b/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2003-09-02.23 +scriptversion=2004-09-07.08 -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. @@ -60,11 +60,6 @@ case "$1" in msg="probably too old" fi ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in -h|--h|--he|--hel|--help) echo "\ @@ -92,10 +87,12 @@ Supported PROGRAM values: yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." + exit 0 ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" + exit 0 ;; -*) @@ -104,12 +101,42 @@ Send bug reports to ." exit 1 ;; - aclocal*) +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 fi + ;; +esac +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want @@ -119,11 +146,6 @@ WARNING: \`$1' is $msg. You should only need it if ;; autoconf) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the @@ -133,11 +155,6 @@ WARNING: \`$1' is $msg. You should only need it if ;; autoheader) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want @@ -157,11 +174,6 @@ WARNING: \`$1' is $msg. You should only need it if ;; automake*) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. @@ -173,11 +185,6 @@ WARNING: \`$1' is $msg. You should only need it if ;; autom4te) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the @@ -254,11 +261,6 @@ WARNING: \`$1' is $msg. You should only need it if ;; help2man) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - fi - echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the @@ -279,11 +281,6 @@ WARNING: \`$1' is $msg. You should only need it if ;; makeinfo) - if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then - # We have makeinfo, but it failed. - exit 1 - fi - echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file @@ -301,10 +298,6 @@ WARNING: \`$1' is $msg. You should only need it if tar) shift - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index eed72ab1..70a64c05 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.1 from Makefile.am. +# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -132,7 +132,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) From 3a159392e36505e958348fb9944e855fac7a908f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 13 Jan 2005 09:56:56 +0000 Subject: [PATCH 2130/2994] Update to more recent build tools. BKrev: 41e645e8dAeNqi46ZFzGbDvRRJGXYg From 925de23711a776c93c94bdb013c7da5bcdee3215 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 13 Jan 2005 15:32:14 +0000 Subject: [PATCH 2131/2994] add {s,}le{16,32,64} and le{VCN,LCN,LSN} to include/ntfs/types.h (Logical change 1.655) --- include/ntfs/types.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/ntfs/types.h b/include/ntfs/types.h index 58687d7d..f9383e22 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -42,6 +42,13 @@ typedef int16_t s16; typedef int32_t s32; typedef int64_t s64; +typedef u16 le16; +typedef u32 le32; +typedef u64 le64; +typedef s16 sle16; +typedef s32 sle32; +typedef s64 sle64; + typedef u16 ntfschar; /* 2-byte Unicode character type. */ #define UCHAR_T_SIZE_BITS 1 @@ -50,7 +57,9 @@ typedef u16 ntfschar; /* 2-byte Unicode character type. */ * and VCN, to allow for type checking and better code readability. */ typedef s64 VCN; +typedef sle64 leVCN; typedef s64 LCN; +typedef sle64 leLCN; /* * The NTFS journal $LogFile uses log sequence numbers which are signed 64-bit @@ -58,6 +67,7 @@ typedef s64 LCN; * code readability. */ typedef s64 LSN; +typedef sle64 leLSN; /* * Cygwin has a collusion between our BOOL and 's From fc903141f8aa2fa72a27f6b0ede5369c32893cc4 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 13 Jan 2005 15:32:14 +0000 Subject: [PATCH 2132/2994] add {s,}le{16,32,64} and le{VCN,LCN,LSN} to include/ntfs/types.h BKrev: 41e6947eaBR5d3hrshHMBBiadTpMvw From 1be3d9fe6608663b17228bb62d91fbeebf5f7a3d Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 13 Jan 2005 15:55:15 +0000 Subject: [PATCH 2133/2994] Update logfile.h to be sync with kernel. Update ntfsdump_logfile accordingly. (Logical change 1.656) --- include/ntfs/logfile.h | 285 +++++++++++++++++++++++------------ ntfsprogs/ntfsdump_logfile.c | 27 ++-- 2 files changed, 206 insertions(+), 106 deletions(-) diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index d5144d64..8ecf18e9 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -27,17 +27,19 @@ #include "layout.h" /* - * Log file organization: + * Journal ($LogFile) organization: * * Two restart areas present in the first two pages (restart pages, one restart - * area in each page). When the volume is unmounted they should be identical. + * area in each page). When the volume is dismounted they should be identical, + * except for the update sequence array which usually has a different update + * sequence number. * - * These are followed by log records organized in pages headed by a record - * header going up to log file size. Not all pages contain log records when a + * These are followed by log records organized in pages headed by a log record + * header going up to log file size. Not all pages contain log records when a * volume is first formatted, but as the volume ages, all records will be used. * When the log file fills up, the records at the beginning are purged (by * modifying the oldest_lsn to a higher value presumably) and writing begins - * at the beginning of the file. Effectively, the log file is viewed as a + * at the beginning of the file. Effectively, the log file is viewed as a * circular entity. * * NOTE: Windows NT, 2000, and XP all use log file version 1.1 but they accept @@ -49,6 +51,11 @@ * reinitialize the logfile and start again with version 1.1. */ +/* Some $LogFile related constants. */ +#define MaxLogFileSize 0x100000000ULL +#define DefaultLogPageSize 4096 +#define MinLogRecordPages 48 + /* * Log file restart page header (begins the restart area). */ @@ -56,112 +63,192 @@ typedef struct { /*Ofs*/ /* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ /* 0*/ NTFS_RECORD_TYPES magic;/* The magic is "RSTR". */ -/* 4*/ u16 usa_ofs; /* See NTFS_RECORD definition in layout.h. +/* 4*/ le16 usa_ofs; /* See NTFS_RECORD definition in layout.h. When creating, set this to be immediately after this header structure (without any alignment). */ -/* 6*/ u16 usa_count; /* See NTFS_RECORD definition in layout.h. */ +/* 6*/ le16 usa_count; /* See NTFS_RECORD definition in layout.h. */ -/* 8*/ LSN chkdsk_lsn; /* The last log file sequence number found by +/* 8*/ leLSN chkdsk_lsn; /* The last log file sequence number found by chkdsk. Only used when the magic is changed to "CHKD". Otherwise this is zero. */ -/* 16*/ u32 system_page_size; /* Byte size of system pages when the log file +/* 16*/ le32 system_page_size; /* Byte size of system pages when the log file was created, has to be >= 512 and a power of 2. Use this to calculate the required size of the usa (usa_count) and add it to usa_ofs. Then verify that the result is less than the - value of the restart_offset. */ -/* 20*/ u32 log_page_size; /* Byte size of log file pages, has to be >= - 512 and a power of 2. Usually is 4096 (or - is it just set to system_page_size?). */ -/* 24*/ u16 restart_offset; /* Byte offset from the start of this header to + value of the restart_area_offset. */ +/* 20*/ le32 log_page_size; /* Byte size of log file pages, has to be >= + 512 and a power of 2. The default is 4096 + and is used when the system page size is + between 4096 and 8192. Otherwise this is + set to the system page size instead. */ +/* 24*/ le16 restart_area_offset;/* Byte offset from the start of this header to the RESTART_AREA. Value has to be aligned to 8-byte boundary. When creating, set this to be after the usa. */ -/* 26*/ s16 minor_ver; /* Log file minor version. Only check if major +/* 26*/ sle16 minor_ver; /* Log file minor version. Only check if major version is 1. */ -/* 28*/ s16 major_ver; /* Log file major version. We only support +/* 28*/ sle16 major_ver; /* Log file major version. We only support version 1.1. */ /* sizeof() = 30 (0x1e) bytes */ } __attribute__ ((__packed__)) RESTART_PAGE_HEADER; +/* + * Constant for the log client indices meaning that there are no client records + * in this particular client array. Also inside the client records themselves, + * this means that there are no client records preceding or following this one. + */ +#define LOGFILE_NO_CLIENT const_cpu_to_le16(0xffff) +#define LOGFILE_NO_CLIENT_CPU 0xffff + +/* + * These are the so far known RESTART_AREA_* flags (16-bit) which contain + * information about the log file in which they are present. + */ +enum { + RESTART_VOLUME_IS_CLEAN = const_cpu_to_le16(0x0002), + RESTART_SPACE_FILLER = 0xffff, /* gcc: Force enum bit width to 16. */ +} __attribute__ ((__packed__)); + +typedef le16 RESTART_AREA_FLAGS; + /* * Log file restart area record. The offset of this record is found by adding - * the offset of the RESTART_PAGE_HEADER to the restart_offset value found in - * it. See notes at restart_offset above. + * the offset of the RESTART_PAGE_HEADER to the restart_area_offset value found + * in it. See notes at restart_area_offset above. */ typedef struct { /*Ofs*/ -/* 0*/ LSN current_lsn; /* The current LSN inside the log when the - restart area was last written. This happens - often but what is the interval? Is it just - fixed time or is it every time a check point - is written or somethine else? */ -/* 8*/ u16 log_clients; /* Number of log client records in the array of +/* 0*/ leLSN current_lsn; /* The current, i.e. last LSN inside the log + when the restart area was last written. + This happens often but what is the interval? + Is it just fixed time or is it every time a + check point is written or somethine else? + On create set to 0. */ +/* 8*/ le16 log_clients; /* Number of log client records in the array of log client records which follows this restart area. Must be 1. */ -/* 10*/ u16 client_free_list; /* The index of the first free log client record - in the array of log client records. 0xffff - means that there are no free log client - records in the array. If != 0xffff, check - that log_clients > client_free_list. On a - clean volume this is != 0xffff, should at - present always be 0. At present on dirty - volume this is 0xffff. */ -/* 12*/ u16 client_in_use_list; /* The index of the first in-use log client +/* 10*/ le16 client_free_list; /* The index of the first free log client record + in the array of log client records. + LOGFILE_NO_CLIENT means that there are no + free log client records in the array. + If != LOGFILE_NO_CLIENT, check that + log_clients > client_free_list. On Win2k + and presumably earlier, on a clean volume + this is != LOGFILE_NO_CLIENT, and it should + be 0, i.e. the first (and only) client + record is free and thus the logfile is + closed and hence clean. A dirty volume + would have left the logfile open and hence + this would be LOGFILE_NO_CLIENT. On WinXP + and presumably later, the logfile is always + open, even on clean shutdown so this should + always be LOGFILE_NO_CLIENT. */ +/* 12*/ le16 client_in_use_list;/* The index of the first in-use log client record in the array of log client records. - 0xffff means that there are no in-use log - client records in the array. If != 0xffff - check that log_clients > client_in_use_list. - On a clean volume this is 0xffff. On a - dirty volume this is != 0xffff. At present - on dirty volume this is 0. */ -/* 14*/ u16 flags; /* Flags modifying LFS behaviour. = 0 */ -/* 16*/ u32 seq_number_bits; /* How many bits to use for the sequence - number. I have seen 0x2c and 0x2d. */ -/* 20*/ u16 restart_area_length;/* Length of the restart area. Following - checks required if version matches. - Otherwise, skip them. restart_offset + - restart_area_length has to be <= - system_page_size. Also, restart_area_length - has to be >= client_array_offset + - (log_clients * sizeof(log client record)). */ -/* 22*/ u16 client_array_offset;/* Offset from the start of this record to + LOGFILE_NO_CLIENT means that there are no + in-use log client records in the array. If + != LOGFILE_NO_CLIENT check that log_clients + > client_in_use_list. On Win2k and + presumably earlier, on a clean volume this + is LOGFILE_NO_CLIENT, i.e. there are no + client records in use and thus the logfile + is closed and hence clean. A dirty volume + would have left the logfile open and hence + this would be != LOGFILE_NO_CLIENT, and it + should be 0, i.e. the first (and only) + client record is in use. On WinXP and + presumably later, the logfile is always + open, even on clean shutdown so this should + always be 0. */ +/* 14*/ RESTART_AREA_FLAGS flags;/* Flags modifying LFS behaviour. On Win2k + and presumably earlier this is always 0. On + WinXP and presumably later, if the logfile + was shutdown cleanly, the second bit, + RESTART_VOLUME_IS_CLEAN, is set. This bit + is cleared when the volume is mounted by + WinXP and set when the volume is dismounted, + thus if the logfile is dirty, this bit is + clear. Thus we don't need to check the + Windows version to determine if the logfile + is clean. Instead if the logfile is closed, + we know it must be clean. If it is open and + this bit is set, we also know it must be + clean. If on the other hand the logfile is + open and this bit is clear, we can be almost + certain that the logfile is dirty. */ +/* 16*/ le32 seq_number_bits; /* How many bits to use for the sequence + number. This is calculated as 67 - the + number of bits required to store the logfile + size in bytes and this can be used in with + the specified file_size as a consistency + check. */ +/* 20*/ le16 restart_area_length;/* Length of the restart area including the + client array. Following checks required if + version matches. Otherwise, skip them. + restart_area_offset + restart_area_length + has to be <= system_page_size. Also, + restart_area_length has to be >= + client_array_offset + (log_clients * + sizeof(log client record)). */ +/* 22*/ le16 client_array_offset;/* Offset from the start of this record to the first log client record if versions are matched. When creating, set this to be after this restart area structure, aligned to 8-bytes boundary. If the versions do not - match, the offset is otherwise assumed to be - (sizeof(RESTART_AREA) + 7) & ~7, i.e. - rounded up to first 8-byte boundary. Either - way, client_array_offset has to be aligned - to an 8-byte boundary. Also, restart_offset - + client_array_offset has to be <= 510. + match, this is ignored and the offset is + assumed to be (sizeof(RESTART_AREA) + 7) & + ~7, i.e. rounded up to first 8-byte + boundary. Either way, client_array_offset + has to be aligned to an 8-byte boundary. + Also, restart_area_offset + + client_array_offset has to be <= 510. Finally, client_array_offset + (log_clients * sizeof(log client record)) has to be <= - system_page_size. */ -/* 24*/ s64 file_size; /* Byte size of the log file. If the - restart_offset + the offset of the file_size - are > 510 then corruption has occured. This - is the very first check when starting with - the restart_area as if it fails it means - that some of the above values will be - corrupted by the multi sector transfer - protection! If the structure is deprotected - then these checks are futile of course. - Calculate the file_size bits and check that - seq_number_bits == 0x43 - file_size bits. - = 0x400000 */ -/* 32*/ u32 last_lsn_data_length;/* ??? = 0, 0x40 */ -/* 36*/ u16 record_length; /* Byte size of log records. If the version - matches then check that the value of - record_length is a multiple of 8, i.e. - (record_length + 7) & ~7 == record_length. - = 0x30 */ -/* 38*/ u16 log_page_data_offset;/* ??? = 0x40 */ -/* 40*/ u32 unknown; /* ??? It seems like it = 0 if clean and it != 0 - if dirty. */ -/* 44*/ u32 reserved; /* Reserved/alignment to 8-byte boundary. */ + system_page_size. On Win2k and presumably + earlier, this is 0x30, i.e. immediately + following this record. On WinXP and + presumably later, this is 0x40, i.e. there + are 16 extra bytes between this record and + the client array. This probably means that + the RESTART_AREA record is actually bigger + in WinXP and later. */ +/* 24*/ sle64 file_size; /* Usable byte size of the log file. If the + restart_area_offset + the offset of the + file_size are > 510 then corruption has + occured. This is the very first check when + starting with the restart_area as if it + fails it means that some of the above values + will be corrupted by the multi sector + transfer protection. The file_size has to + be rounded down to be a multiple of the + log_page_size in the RESTART_PAGE_HEADER and + then it has to be at least big enough to + store the two restart pages and 48 (0x30) + log record pages. */ +/* 32*/ le32 last_lsn_data_length;/* Length of data of last LSN, not including + the log record header. On create set to + 0. */ +/* 36*/ le16 log_record_header_length;/* Byte size of the log record header. + If the version matches then check that the + value of log_record_header_length is a + multiple of 8, i.e. + (log_record_header_length + 7) & ~7 == + log_record_header_length. When creating set + it to sizeof(LOG_RECORD_HEADER), aligned to + 8 bytes. */ +/* 38*/ le16 log_page_data_offset;/* Offset to the start of data in a log record + page. Must be a multiple of 8. On create + set it to immediately after the update + sequence array of the log record page. */ +/* 40*/ le32 restart_log_open_count;/* A counter that gets incremented every + time the logfile is restarted which happens + at mount time when the logfile is opened. + When creating set to a random value. Win2k + sets it to the low 32 bits of the current + system time in NTFS format (see time.h). */ +/* 44*/ le32 reserved; /* Reserved/alignment to 8-byte boundary. */ /* sizeof() = 48 (0x30) bytes */ } __attribute__ ((__packed__)) RESTART_AREA; @@ -171,26 +258,36 @@ typedef struct { */ typedef struct { /*Ofs*/ -/* 0*/ LSN oldest_lsn; /* Oldest LSN needed by this client. */ -/* 8*/ LSN client_restart_lsn; /* LSN at which this client needs to restart +/* 0*/ leLSN oldest_lsn; /* Oldest LSN needed by this client. On create + set to 0. */ +/* 8*/ leLSN client_restart_lsn;/* LSN at which this client needs to restart the volume, i.e. the current position within the log file. At present, if clean this should = current_lsn in restart area but it probably also = current_lsn when dirty most - of the time. */ -/* 16*/ u16 prev_client; /* The offset to the previous log client record - in the array of log client records. 0xffff - means there is no previous client record, - i.e. this is the first one. */ -/* 18*/ u16 next_client; /* The offset to the next log client record in - the array of log client records. 0xffff - means there are no next client records, i.e. - this is the last one. */ -/* 20*/ u16 seq_number; /* ??? It is 1 when clean and 0 when dirty, - but don't know if this is always the case. */ + of the time. At create set to 0. */ +/* 16*/ le16 prev_client; /* The offset to the previous log client record + in the array of log client records. + LOGFILE_NO_CLIENT means there is no previous + client record, i.e. this is the first one. + This is always LOGFILE_NO_CLIENT. */ +/* 18*/ le16 next_client; /* The offset to the next log client record in + the array of log client records. + LOGFILE_NO_CLIENT means there are no next + client records, i.e. this is the last one. + This is always LOGFILE_NO_CLIENT. */ +/* 20*/ le16 seq_number; /* On Win2k and presumably earlier, this is set + to zero every time the logfile is restarted + and it is incremented when the logfile is + closed at dismount time. Thus it is 0 when + dirty and 1 when clean. On WinXP and + presumably later, this is always 0. */ /* 22*/ u8 reserved[6]; /* Reserved/alignment. */ -/* 28*/ u32 client_name_length; /* Length of client name in bytes. = 8 */ -/* 32*/ ntfschar client_name[64];/* Name of the client in Unicode. = NTFS */ +/* 28*/ le32 client_name_length;/* Length of client name in bytes. Should + always be 8. */ +/* 32*/ ntfschar client_name[64];/* Name of the client in Unicode. Should + always be "NTFS" with the remaining bytes + set to 0. */ /* sizeof() = 160 (0xa0) bytes */ } __attribute__ ((__packed__)) LOG_CLIENT_RECORD; diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 379791db..2c52b6b3 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -309,13 +309,13 @@ static void restart_header_sanity(RESTART_PAGE_HEADER *rstr, u8 *buf) "corrupt: Update sequence array overlaps or " "is behind first protected sequence number. " "Cannot handle this yet.\n"); - if (usa_end_ofs > le16_to_cpu(rstr->restart_offset)) + if (usa_end_ofs > le16_to_cpu(rstr->restart_area_offset)) log_err_exit(buf, "Restart page header in $LogFile is " "corrupt: Update sequence array overlaps or " "is behind restart area. Cannot handle this " "yet.\n"); /* Finally, verify the offset of the restart area. */ - if (le16_to_cpu(rstr->restart_offset) & 7) + if (le16_to_cpu(rstr->restart_area_offset) & 7) log_err_exit(buf, "Restart page header in $LogFile is " "corrupt: Restart area offset is not aligned " "to 8-byte boundary. Cannot handle this " @@ -341,8 +341,8 @@ static void dump_restart_areas_header(RESTART_PAGE_HEADER *rstr) (unsigned int)le32_to_cpu(rstr->log_page_size), (unsigned int)le32_to_cpu(rstr->log_page_size)); printf("restart_offset = %u (0x%x)\n", - le16_to_cpu(rstr->restart_offset), - le16_to_cpu(rstr->restart_offset)); + le16_to_cpu(rstr->restart_area_offset), + le16_to_cpu(rstr->restart_area_offset)); } static void dump_restart_areas_area(RESTART_PAGE_HEADER *rstr) @@ -351,7 +351,8 @@ static void dump_restart_areas_area(RESTART_PAGE_HEADER *rstr) RESTART_AREA *ra; int client; - ra = (RESTART_AREA*)((u8*)rstr + le16_to_cpu(rstr->restart_offset)); + ra = (RESTART_AREA*)((u8*)rstr + + le16_to_cpu(rstr->restart_area_offset)); printf("current_lsn = %lli (0x%llx)\n", (long long)sle64_to_cpu(ra->current_lsn), (unsigned long long)sle64_to_cpu(ra->current_lsn)); @@ -379,13 +380,15 @@ static void dump_restart_areas_area(RESTART_PAGE_HEADER *rstr) printf("last_lsn_data_length = %u (0x%x)\n", (unsigned int)le32_to_cpu(ra->last_lsn_data_length), (unsigned int)le32_to_cpu(ra->last_lsn_data_length)); - printf("record_length = %u (0x%x)\n", le16_to_cpu(ra->record_length), - le16_to_cpu(ra->record_length)); + printf("log_record_header_length = %u (0x%x)\n", + le16_to_cpu(ra->log_record_header_length), + le16_to_cpu(ra->log_record_header_length)); printf("log_page_data_offset = %u (0x%x)\n", le16_to_cpu(ra->log_page_data_offset), le16_to_cpu(ra->log_page_data_offset)); - printf("unknown = %u (0x%x)\n", le16_to_cpu(ra->unknown), - le16_to_cpu(ra->unknown)); + printf("restart_log_open_count = %u (0x%x)\n", + le32_to_cpu(ra->restart_log_open_count), + le32_to_cpu(ra->restart_log_open_count)); lcr = (LOG_CLIENT_RECORD*)((u8*)ra + le16_to_cpu(ra->client_array_offset)); for (client = 0; client < le16_to_cpu(ra->log_clients); client++) { @@ -467,11 +470,11 @@ rstr_pass_loc: /* Exclude the usa from the comparison. */ ra = (RESTART_AREA*)((u8*)rstr1 + - le16_to_cpu(rstr1->restart_offset)); + le16_to_cpu(rstr1->restart_area_offset)); if (!memcmp(rstr1, rstr, le16_to_cpu(rstr1->usa_ofs)) && !memcmp((u8*)rstr1 + le16_to_cpu( - rstr1->restart_offset), (u8*)rstr + - le16_to_cpu(rstr->restart_offset), + rstr1->restart_area_offset), (u8*)rstr + + le16_to_cpu(rstr->restart_area_offset), le16_to_cpu(ra->restart_area_length))) { puts("\nSkipping analysis of second restart page " "because it fully matches the first " From d77c4c3f1ac670d3436709b5b0529da4c09b4534 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 13 Jan 2005 15:55:15 +0000 Subject: [PATCH 2134/2994] Update logfile.h to be sync with kernel. Update ntfsdump_logfile accordingly. BKrev: 41e699e30QMMtcmAeX1saJVCULGwoA From fdfb1ea71a5aa34685f85ccf6f69cf6949bfd5a7 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 13 Jan 2005 17:02:06 +0000 Subject: [PATCH 2135/2994] Fix bug that I introduced in changeset 1.495 sle{16,32,64} should be u{16,32,64} not s{16,32,64}. (Logical change 1.657) --- include/ntfs/types.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ntfs/types.h b/include/ntfs/types.h index f9383e22..f8f937c8 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -45,9 +45,9 @@ typedef int64_t s64; typedef u16 le16; typedef u32 le32; typedef u64 le64; -typedef s16 sle16; -typedef s32 sle32; -typedef s64 sle64; +typedef u16 sle16; +typedef u32 sle32; +typedef u64 sle64; typedef u16 ntfschar; /* 2-byte Unicode character type. */ #define UCHAR_T_SIZE_BITS 1 From 84fccf8a8b7cebd1ff0ac9215f8ad2bfb5798198 Mon Sep 17 00:00:00 2001 From: "(none)!yura" <(none)!yura> Date: Thu, 13 Jan 2005 17:02:06 +0000 Subject: [PATCH 2136/2994] Fix bug that I introduced in changeset 1.495 sle{16,32,64} should be u{16,32,64} not s{16,32,64}. BKrev: 41e6a98eTs0UY8wiH-gemb4Ft7owCA From a82280f235c4e55b3a9221cb7bc78b08465f1f50 Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 17 Jan 2005 11:46:32 +0000 Subject: [PATCH 2137/2994] offsetof already defined in stddef.h in gcc4, so add check to prevent redefinition. (Logical change 1.658) --- include/ntfs/support.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/ntfs/support.h b/include/ntfs/support.h index ade65e08..b02390bf 100644 --- a/include/ntfs/support.h +++ b/include/ntfs/support.h @@ -49,7 +49,9 @@ /* * Useful macro for determining the offset of a struct member. */ +#ifndef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif /* * Simple bit operation macros. NOTE: These are NOT atomic. From f4924c765565d85d0f7dc8b413a361e052af2711 Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 17 Jan 2005 11:46:32 +0000 Subject: [PATCH 2138/2994] offsetof already defined in stddef.h in gcc4, so add check to prevent redefinition. BKrev: 41eba598pDkLIlngKM_xFU-DD3sM1Q From 3dd3b08b070fe8f8015486dd43c9ef6d5b7c0cdb Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 17 Jan 2005 11:50:36 +0000 Subject: [PATCH 2139/2994] fix compiler warning about ntfs_inode_sync_standard_information (Logical change 1.659) --- libntfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 1da2d8e4..a03bee55 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -411,7 +411,7 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) * * Return 0 on success or -1 on error with errno set to the error code. */ -int ntfs_inode_sync_standard_information(ntfs_inode *ni) { +static int ntfs_inode_sync_standard_information(ntfs_inode *ni) { ntfs_attr_search_ctx *ctx; STANDARD_INFORMATION *std_info; int err; From 6853d9c4f3e4e959ad8343d5ef22ce479765eaa4 Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 17 Jan 2005 11:50:36 +0000 Subject: [PATCH 2140/2994] fix compiler warning about ntfs_inode_sync_standard_information BKrev: 41eba68c6ODPYdC8QMNOMW9ODpaf4A From 954c8d121e6b7c75335d310562f3507f1ac07f18 Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 17 Jan 2005 11:58:33 +0000 Subject: [PATCH 2141/2994] change prototypes of ntfs_write_significant_bytes and ntfs_mapping_pairs_build to fix a lot of compiler warnings. (Logical change 1.660) --- include/ntfs/runlist.h | 4 ++-- libntfs/runlist.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/ntfs/runlist.h b/include/ntfs/runlist.h index 29bdc752..995b51cb 100644 --- a/include/ntfs/runlist.h +++ b/include/ntfs/runlist.h @@ -67,10 +67,10 @@ extern int ntfs_get_nr_significant_bytes(const s64 n); extern int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, const runlist_element *rl, const VCN start_vcn); -extern int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, +extern int ntfs_write_significant_bytes(u8 *dst, const u8 *dst_max, const s64 n); -extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, +extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, u8 *dst, const int dst_len, const runlist_element *rl, const VCN start_vcn, VCN *const stop_vcn); diff --git a/libntfs/runlist.c b/libntfs/runlist.c index e6fb0ae0..d1f48181 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1334,7 +1334,7 @@ err_out: * Return the number of bytes written on success. On error, i.e. the * destination buffer @dst is too small, return -1 with errno set ENOSPC. */ -__inline__ int ntfs_write_significant_bytes(s8 *dst, const s8 *dst_max, +__inline__ int ntfs_write_significant_bytes(u8 *dst, const u8 *dst_max, const s64 n) { s64 l = n; @@ -1399,12 +1399,12 @@ err_out: * EIO - The runlist is corrupt. * ENOSPC - The destination buffer is too small. */ -int ntfs_mapping_pairs_build(const ntfs_volume *vol, s8 *dst, +int ntfs_mapping_pairs_build(const ntfs_volume *vol, u8 *dst, const int dst_len, const runlist_element *rl, const VCN start_vcn, VCN *const stop_vcn) { LCN prev_lcn; - s8 *dst_max, *dst_next; + u8 *dst_max, *dst_next; s8 len_len, lcn_len; if (start_vcn < 0) From cb9689d4214e4a6516cc9fea338bf3f0537eb91e Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 17 Jan 2005 11:58:33 +0000 Subject: [PATCH 2142/2994] change prototypes of ntfs_write_significant_bytes and ntfs_mapping_pairs_build to fix a lot of compiler warnings. BKrev: 41eba869TOtqC6gWYMfaBlcxOkAQ4A From 0a68326fc6e1b6f758ffa987e6070d7efbaafd99 Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 17 Jan 2005 12:04:37 +0000 Subject: [PATCH 2143/2994] fix bug spotted bug gcc4 in error handling of ntfsinfo (Logical change 1.661) --- ntfsprogs/ntfsinfo.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 8ca076da..b0289794 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1242,7 +1242,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) * * determine size and type of INDX record */ -static void get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, +static int get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, ATTR_TYPES *type, u32 *size) { ntfs_attr_search_ctx *ctx; @@ -1253,7 +1253,7 @@ static void get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, name = malloc(attr->name_length * sizeof(ntfschar)); if (!name) { perror("malloc failed"); - return; + return -1; } memcpy(name, (u8 *)attr + attr->name_offset, attr->name_length * sizeof(ntfschar)); @@ -1262,14 +1262,14 @@ static void get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, if (!ctx) { perror("ntfs_get_search_ctx failed"); free(name); - return; + return -1; } if (ntfs_attr_lookup(AT_INDEX_ROOT, name, attr->name_length, 0, 0, NULL, 0, ctx)) { perror("ntfs_attr_lookup failed"); ntfs_attr_put_search_ctx(ctx); free(name); - return; + return -1; } root = (INDEX_ROOT*)((u8*)ctx->attr + @@ -1278,6 +1278,7 @@ static void get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, *type = root->type; ntfs_attr_put_search_ctx(ctx); free(name); + return 0; } /** @@ -1298,7 +1299,8 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) int bit; ntfschar *name; - get_type_and_size_of_indx(ni, attr, &type, &indx_record_size); + if (get_type_and_size_of_indx(ni, attr, &type, &indx_record_size)) + return; name = (ntfschar*)((u8*)attr + attr->name_offset); na = ntfs_attr_open(ni, AT_BITMAP, name, attr->name_length); From baa43516ce28aa1fe51e3c694ea4dd2e3ced47ed Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 17 Jan 2005 12:04:37 +0000 Subject: [PATCH 2144/2994] fix bug spotted bug gcc4 in error handling of ntfsinfo BKrev: 41eba9d5TrJErKTr8O-5B1scjpl0ng From d162076f146a59b8ac86457cf2aa176710be0d75 Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 17 Jan 2005 14:59:52 +0000 Subject: [PATCH 2145/2994] fix some complier warning in mkntfs (Logical change 1.662) --- ntfsprogs/mkntfs.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index b941fb12..61df1976 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -804,7 +804,8 @@ static void dump_resident_attr(ATTR_RECORD *a) /** * dump_mapping_pairs_array */ -static void dump_mapping_pairs_array(char *b, unsigned int max_len) +static void dump_mapping_pairs_array(char *b __attribute__((unused)), + unsigned int max_len __attribute__((unused))) { // TODO return; @@ -1322,7 +1323,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, if (bw != val_len) Eprintf("Error writing non-resident attribute value." "\n"); - err = ntfs_mapping_pairs_build(vol, (s8*)a + hdr_size + + err = ntfs_mapping_pairs_build(vol, (u8*)a + hdr_size + ((name_len + 7) & ~7), mpa_size, rl, 0, NULL); } a->initialized_size = cpu_to_le64(inited_size); @@ -1512,7 +1513,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, if (bw != val_len) Eprintf("Error writing non-resident attribute value." "\n"); - err = ntfs_mapping_pairs_build(vol, (s8*)a + hdr_size + + err = ntfs_mapping_pairs_build(vol, (u8*)a + hdr_size + ((name_len + 7) & ~7), mpa_size, rl, 0, NULL); } if (err < 0 || bw != val_len) { From 59ef20eb7672120051a742e9579707df1c33212f Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 17 Jan 2005 14:59:52 +0000 Subject: [PATCH 2146/2994] fix some complier warning in mkntfs BKrev: 41ebd2e8SmcjY0GAm-qtPIHbwCot6g From 668403c146e220bb1e27344ebf1f364599432157 Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 17 Jan 2005 15:04:56 +0000 Subject: [PATCH 2147/2994] fix gcc4 warnings in attrib.c (Logical change 1.663) --- libntfs/attrib.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index ba2c2edc..e9e66fa5 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1732,7 +1732,7 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const ntfschar *name, ntfs_inode *base_ni, *ni; ntfs_volume *vol; ATTR_LIST_ENTRY *al_entry, *next_al_entry; - char *al_start, *al_end; + u8 *al_start, *al_end; ATTR_RECORD *a; ntfschar *al_name; u32 al_name_len; @@ -1834,18 +1834,18 @@ find_attr_list_attr: for (;; al_entry = next_al_entry) { /* Out of bounds check. */ if ((u8*)al_entry < base_ni->attr_list || - (char*)al_entry > al_end) + (u8*)al_entry > al_end) break; /* Inode is corrupt. */ ctx->al_entry = al_entry; /* Catch the end of the attribute list. */ - if ((char*)al_entry == al_end) + if ((u8*)al_entry == al_end) goto not_found; if (!al_entry->length) break; - if ((char*)al_entry + 6 > al_end || (char*)al_entry + + if ((u8*)al_entry + 6 > al_end || (u8*)al_entry + le16_to_cpu(al_entry->length) > al_end) break; - next_al_entry = (ATTR_LIST_ENTRY*)((char*)al_entry + + next_al_entry = (ATTR_LIST_ENTRY*)((u8*)al_entry + le16_to_cpu(al_entry->length)); if (type != AT_UNUSED) { if (le32_to_cpu(al_entry->type) > le32_to_cpu(type)) @@ -1854,7 +1854,7 @@ find_attr_list_attr: continue; } al_name_len = al_entry->name_length; - al_name = (ntfschar*)((char*)al_entry + al_entry->name_offset); + al_name = (ntfschar*)((u8*)al_entry + al_entry->name_offset); /* * If !@type we want the attribute represented by this * attribute list entry. @@ -1908,9 +1908,9 @@ find_attr_list_attr: * next attribute list entry still fits @lowest_vcn. Otherwise * we have reached the right one or the search has failed. */ - if (lowest_vcn && (char*)next_al_entry >= al_start && - (char*)next_al_entry + 6 < al_end && - (char*)next_al_entry + le16_to_cpu( + if (lowest_vcn && (u8*)next_al_entry >= al_start && + (u8*)next_al_entry + 6 < al_end && + (u8*)next_al_entry + le16_to_cpu( next_al_entry->length) <= al_end && sle64_to_cpu(next_al_entry->lowest_vcn) <= lowest_vcn && From cdbe8ff9cd7bd65646f7fe9844aa6e4f3f9fae6f Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 17 Jan 2005 15:04:56 +0000 Subject: [PATCH 2148/2994] fix gcc4 warnings in attrib.c BKrev: 41ebd418KvjyVtRX0RBqA4U86B4oKA From 9fca23feb2de9545ee4ba43649dcbc7df9b3e14f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 19 Jan 2005 10:31:46 +0000 Subject: [PATCH 2149/2994] Fix type casts after Yura's prototype changes. (Logical change 1.664) --- libntfs/runlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index d1f48181..3e7b1763 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1355,12 +1355,12 @@ __inline__ int ntfs_write_significant_bytes(u8 *dst, const u8 *dst_max, if (dst > dst_max) goto err_out; i++; - *dst = (s8)-1; + *dst = (u8)-1; } else if (n > 0LL && j < 0) { if (dst > dst_max) goto err_out; i++; - *dst = (s8)0; + *dst = 0; } return i; err_out: From db616a258be6c3b5ca6ce3abf4ebf47e037cf6c7 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Wed, 19 Jan 2005 10:31:46 +0000 Subject: [PATCH 2150/2994] Fix type casts after Yura's prototype changes. BKrev: 41ee3712inb3MBnjx8VQvosLYW6dmw From 39e6fa1339a626c55ea539dcca1700ba3eacafcf Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 25 Jan 2005 19:46:51 +0000 Subject: [PATCH 2151/2994] Add logfile.c to build (Logical change 1.665) --- Makefile.in | 14 +- aclocal.m4 | 7356 ++++++----------- config.guess | 69 +- config.sub | 24 +- configure | 15709 ++++++------------------------------- doc/Makefile.in | 14 +- include/Makefile.in | 14 +- include/ntfs/Makefile.in | 14 +- install-sh | 8 +- libntfs/Makefile.am | 1 + libntfs/Makefile.in | 32 +- ltmain.sh | 3256 +++----- ntfsprogs/Makefile.in | 16 +- 13 files changed, 5918 insertions(+), 20609 deletions(-) diff --git a/Makefile.in b/Makefile.in index 92efbf1a..8d3c19ed 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -77,7 +77,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -88,10 +87,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -103,8 +98,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -134,18 +127,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/aclocal.m4 b/aclocal.m4 index 9a7124af..d0da9422 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.9.3 -*- Autoconf -*- +# generated automatically by aclocal 1.9.4 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. @@ -11,63 +11,12 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- -# serial 47 AC_PROG_LIBTOOL +# serial 46 AC_PROG_LIBTOOL - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# 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 And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -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_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" @@ -78,13 +27,10 @@ AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL +]) - -# AC_LIBTOOL_SETUP -# ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)dnl +[AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl @@ -94,105 +40,15 @@ 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([LT_AC_PROG_SED])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 -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] - -# Same as above, but do not quote variable references. -[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -202,78 +58,341 @@ file_magic*) ;; esac -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default +# 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* + ;; -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_64bit_output=no + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *"ELF 64"*) + lt_cv_cc_64bit_output=yes + ;; + 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) -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl + # 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])]) -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} + 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 -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER +_LT_AC_LTCONFIG_HACK +]) -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX +# AC_LIBTOOL_HEADER_ASSERT +# ------------------------ +AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], +[AC_CACHE_CHECK([whether $CC supports assert without backlinking], + [lt_cv_func_assert_works], + [case $host in + *-*-solaris*) + if test "$GCC" = yes && test "$with_gnu_ld" != yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) lt_cv_func_assert_works=no ;; + *) lt_cv_func_assert_works=yes ;; + esac + fi + ;; + esac]) +if test "x$lt_cv_func_assert_works" = xyes; then + AC_CHECK_HEADERS(assert.h) +fi +])# AC_LIBTOOL_HEADER_ASSERT -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h) +])# _LT_AC_CHECK_DLFCN +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[[ABCDGISTW]]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AC_FD_CC + fi + else + echo "cannot find nm_test_var in $nlist" >&AC_FD_CC + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC + fi + else + echo "$progname: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + +# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +# --------------------------------- +AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], +[# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi +])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ +[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -291,7 +410,7 @@ if test "X[$]1" = X--no-reexec; then elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else @@ -303,14 +422,14 @@ if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -337,9 +456,8 @@ else # # So, first we look for a working echo in the user's PATH. - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -348,7 +466,7 @@ else break fi done - IFS="$lt_save_ifs" + IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -421,312 +539,17 @@ if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then fi AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - 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 - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - 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_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - 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 - ;; -AC_PROVIDE_IFELSE([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) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_REQUIRE([LT_AC_PROG_SED]) -AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* ) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for *BSD - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - +AC_DIVERT_POP +])# _LT_AC_PROG_ECHO_BACKSLASH # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ------------------------------------------------------------------ AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : +[if test "$cross_compiling" = yes; then : [$4] else + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext </dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext +# Same as above, but do not quote variable references. +double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" + +AC_MSG_CHECKING([for objdir]) +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +AC_MSG_RESULT($objdir) + + +AC_ARG_WITH(pic, +[ --with-pic try to use only PIC/non-PIC objects [default=use both]], +pic_mode="$withval", pic_mode=default) +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +AC_MSG_CHECKING([for $compiler option to produce PIC]) +AC_CACHE_VAL(lt_cv_prog_cc_pic, +[ lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6* | nonstopux*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi ]) -])# AC_LIBTOOL_PROG_CC_C_O +if test -z "$lt_cv_prog_cc_pic"; then + AC_MSG_RESULT([none]) +else + AC_MSG_RESULT([$lt_cv_prog_cc_pic]) + + # Check to make sure the pic_flag actually works. + AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) + AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + AC_TRY_COMPILE([], [], [dnl + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + ], [dnl + lt_cv_prog_cc_pic_works=no + ]) + CFLAGS="$save_CFLAGS" + ]) + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) + lt_cv_prog_cc_can_build_shared=no + fi +fi + +AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) +AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) + LDFLAGS="$save_LDFLAGS" +]) + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- +# Check to see if options -o and -c are simultaneously supported by compiler +AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) +AC_CACHE_VAL([lt_cv_compiler_c_o], [ +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&AC_FD_CC + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null +]) +compiler_c_o=$lt_cv_compiler_c_o +AC_MSG_RESULT([$compiler_c_o]) + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) + AC_CACHE_VAL([lt_cv_compiler_o_lo], [ + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + ]) + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + ]) + compiler_o_lo=$lt_cv_compiler_o_lo + AC_MSG_RESULT([$compiler_o_lo]) +else + compiler_o_lo=no +fi + # Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then +if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes @@ -988,77 +1131,764 @@ if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT([$compiler_rtti_exceptions]) -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR +# See if the linker supports building shared libraries. +AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \[$]# in + 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; + *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +AC_MSG_RESULT([$ld_shlibs]) +test "$ld_shlibs" = no && can_build_shared=no -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- # Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then +AC_MSG_CHECKING([how to hardcode library paths into programs]) +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then # We can hardcode non-existant directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink + hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate + hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported + hardcode_action=unsupported fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) +AC_MSG_RESULT([$hardcode_action]) -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= +striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then @@ -1066,33 +1896,17 @@ if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else AC_MSG_RESULT([no]) fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- # PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) +AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= -shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -1101,36 +1915,17 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' ;; aix4* | aix5*) @@ -1140,7 +1935,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -1150,54 +1945,57 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' + soname_spec='${libname}${release}.so$major' fi shlibpath_var=LIBPATH fi + hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) - library_names_spec='${libname}${shared_ext}' + library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; -bsdi[[45]]*) +bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -1205,55 +2003,29 @@ bsdi[[45]]*) cygwin* | mingw* | pw32*) version_type=windows - shrext_cmds=".dll" need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) + yes,cygwin*) library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac ;; - + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -1266,56 +2038,30 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac @@ -1324,11 +2070,7 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on + *) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -1339,8 +2081,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -1348,45 +2090,14 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. + dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -1394,29 +2105,21 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; + *) version_type=irix ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -1425,21 +2128,20 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. -linux*) +linux-gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -1448,11 +2150,12 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi + case $host_cpu:$lt_cv_cc_64bit_output in + powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" + ;; + esac # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -1463,29 +2166,17 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -1495,17 +2186,7 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -1514,47 +2195,46 @@ openbsd*) version_type=sunos need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case "$host_os" in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' - shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' + library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf - need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; @@ -1562,8 +2242,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -1573,7 +2253,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -1585,8 +2265,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -1607,940 +2287,39 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# 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_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# 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], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# 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_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# 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], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# 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_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# 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], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# 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_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# 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_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [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]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -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_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -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 - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_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_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$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_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl -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 $CC]) - 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. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname 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 - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - 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. - case `"$lt_cv_path_LD" -v 2>&1 &1 /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_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - 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_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - case $host_cpu in - alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - # this will be overridden with pass_all, but let us keep it just in case - 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` - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - 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 - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - 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*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the pathname to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - 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 - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - 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 - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_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* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL 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, lt_dlinit, - [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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) -])# _LT_AC_LANG_CXX - - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[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])])])])])]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# -------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -# Report which librarie types wil actually be built +# Report the final consequences. AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -2558,1159 +2337,10 @@ aix3*) fi ;; -aix4* | aix5*) +aix4*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - openbsd2*) - # C++ shared libraries are fairly broken - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - openbsd*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd='echo' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext -AC_LIBTOOL_CONFIG($1) + if AC_TRY_EVAL(ac_compile); then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi]) + AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_F77_CONFIG - - -# AC_LIBTOOL_LANG_GCJ_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) -AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], -[AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_RESTORE -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_GCJ_CONFIG - - -# AC_LIBTOOL_LANG_RC_CONFIG -# -------------------------- -# Ensure that the configuration vars for the Windows resource compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) -AC_DEFUN([_LT_AC_LANG_RC_CONFIG], -[AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_RESTORE -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_RC_CONFIG - - -# AC_LIBTOOL_CONFIG([TAGNAME]) -# ---------------------------- -# If TAGNAME is not passed, then create an initial libtool script -# with a default configuration from the untagged config vars. Otherwise -# add code to config.status for appending the configuration named by -# TAGNAME from the matching tagged config vars. -AC_DEFUN([AC_LIBTOOL_CONFIG], -[# The else clause should only fire when bootstrapping the +# The second clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ + for var in echo old_CC old_CFLAGS SED \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - _LT_AC_TAGVAR(compiler, $1) \ - _LT_AC_TAGVAR(CC, $1) \ - _LT_AC_TAGVAR(LD, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ - _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ - _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ - _LT_AC_TAGVAR(old_archive_cmds, $1) \ - _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ - _LT_AC_TAGVAR(predep_objects, $1) \ - _LT_AC_TAGVAR(postdep_objects, $1) \ - _LT_AC_TAGVAR(predeps, $1) \ - _LT_AC_TAGVAR(postdeps, $1) \ - _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ - _LT_AC_TAGVAR(archive_cmds, $1) \ - _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ - _LT_AC_TAGVAR(postinstall_cmds, $1) \ - _LT_AC_TAGVAR(postuninstall_cmds, $1) \ - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ - _LT_AC_TAGVAR(allow_undefined_flag, $1) \ - _LT_AC_TAGVAR(no_undefined_flag, $1) \ - _LT_AC_TAGVAR(export_symbols_cmds, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ - _LT_AC_TAGVAR(hardcode_automatic, $1) \ - _LT_AC_TAGVAR(module_cmds, $1) \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) \ - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ - _LT_AC_TAGVAR(exclude_expsyms, $1) \ - _LT_AC_TAGVAR(include_expsyms, $1); do + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do case $var in - _LT_AC_TAGVAR(old_archive_cmds, $1) | \ - _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ - _LT_AC_TAGVAR(archive_cmds, $1) | \ - _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ - _LT_AC_TAGVAR(module_cmds, $1) | \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ - _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -3918,31 +2464,14 @@ if test -f "$ltmain"; then esac done - case $lt_echo in - *'\[$]0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` - ;; - esac + cat <<__EOF__ > "${ofile}T" +#! $SHELL -ifelse([$1], [], - [cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - AC_MSG_NOTICE([creating $ofile])], - [cfgfile="$ofile"]) - - cat <<__EOF__ >> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: +# Copyright (C) 1996-2000 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -3964,21 +2493,17 @@ ifelse([$1], [], # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed program that does not truncate output. +# A sed that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="${SED} -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) +# ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -3992,10 +2517,7 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) +build_libtool_need_lc=$need_lc # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -4011,20 +2533,14 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) +# The default C compiler. +CC=$lt_CC # Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP +with_gcc=$GCC # The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) +LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S @@ -4033,7 +2549,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$lt_STRIP +STRIP=$STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -4045,7 +2561,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4055,7 +2571,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) +wl=$lt_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -4063,21 +2579,18 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_flag=$lt_pic_flag pic_mode=$pic_mode -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - # Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -4098,19 +2611,19 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) +link_static_flag=$lt_link_static_flag # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) +no_builtin_flag=$lt_no_builtin_flag # Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) +whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) +thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type @@ -4127,50 +2640,26 @@ soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -4178,10 +2667,10 @@ deplibs_check_method=$lt_deplibs_check_method file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) +allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) +no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds @@ -4190,13 +2679,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe +global_symbol_pipe=$lt_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -4208,45 +2697,36 @@ shlibpath_var=$shlibpath_var shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) +hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) +hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) +hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) +hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) +hardcode_shlibpath_var=$hardcode_shlibpath_var # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) +link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec @@ -4255,33 +2735,30 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" +fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) +always_export_symbols=$always_export_symbols # The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) +export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) +exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) +include_expsyms=$lt_include_expsyms -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) +# ### END LIBTOOL CONFIG __EOF__ -ifelse([$1],[], [ case $host_os in aix3*) - cat <<\EOF >> "$cfgfile" + cat <<\EOF >> "${ofile}T" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -4294,1551 +2771,11 @@ EOF ;; esac - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDRT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - ccc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi[[45]]*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include @@ -5872,13 +2809,748 @@ AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # return TRUE; # } # /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# 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 of the License, 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. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + +])# _LT_AC_LTCONFIG_HACK + +# 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)]) -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) +# 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 <&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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])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=$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_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 &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 dependent 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 +aix4* | aix5*) + 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # 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* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # 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 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) + 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 + ;; + +newos6*) + 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 + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +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 + 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*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + 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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +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=$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 LTDLINCL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and LTDLINCL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) @@ -5892,16 +3564,6 @@ AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # @@ -5915,51 +3577,79 @@ AC_DEFUN([LT_AC_PROG_SED], AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. +as_executable_p="test -f" as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do + for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" fi done done done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed + + # 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 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 40000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done done -done + rm -rf "$tmp" ]) -SED=$lt_cv_path_SED +if test "X$SED" != "X"; then + lt_cv_path_SED=$SED +else + SED=$lt_cv_path_SED +fi AC_MSG_RESULT([$SED]) ]) @@ -5967,7 +3657,7 @@ AC_MSG_RESULT([$SED]) dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ +AC_DEFUN(PKG_CHECK_MODULES, [ succeeded=no if test -z "$PKG_CONFIG"; then @@ -6050,7 +3740,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # 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.9.3])]) + [AM_AUTOMAKE_VERSION([1.9.4])]) # AM_AUX_DIR_EXPAND diff --git a/config.guess b/config.guess index 94bb5219..82294713 100755 --- a/config.guess +++ b/config.guess @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-10-25' +timestamp='2004-11-12' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -136,16 +136,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -329,6 +319,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit 0 ;; *:OS400:*:*) echo powerpc-ibm-os400 exit 0 ;; @@ -829,25 +822,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux + echo cris-axis-linux-gnu exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux + echo crisv32-axis-linux-gnu exit 0 ;; frv:Linux:*:*) - echo frv-${VENDOR}-linux + echo frv-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -866,7 +859,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -885,13 +878,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux + echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux + echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -904,34 +897,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux + echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux + echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -946,18 +939,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" + echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" + echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linuxoldld) or + # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -986,7 +979,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.sub b/config.sub index a7e2762a..0f84ac2c 100755 --- a/config.sub +++ b/config.sub @@ -3,7 +3,7 @@ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2004-08-29' +timestamp='2004-11-30' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -267,7 +267,7 @@ case $basic_machine in | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; @@ -343,8 +343,8 @@ case $basic_machine in | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; @@ -489,6 +489,10 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -1029,6 +1033,10 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; xps | xps100) basic_machine=xps100-honeywell ;; @@ -1164,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1197,6 +1205,9 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; @@ -1294,6 +1305,9 @@ case $os in -kaos*) os=-kaos ;; + -zvmoe) + os=-zvmoe + ;; -none) ;; *) diff --git a/configure b/configure index 05f061da..1599cf74 100755 --- a/configure +++ b/configure @@ -243,6 +243,17 @@ IFS=" $as_nl" $as_unset CDPATH +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -261,7 +272,7 @@ if test "X$1" = X--no-reexec; then elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else @@ -273,14 +284,14 @@ if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -307,9 +318,8 @@ else # # So, first we look for a working echo in the user's PATH. - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -318,7 +328,7 @@ else break fi done - IFS="$lt_save_ifs" + IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -392,11 +402,6 @@ fi - -tagnames=${tagnames+${tagnames},}CXX - -tagnames=${tagnames+${tagnames},}F77 - # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. @@ -466,7 +471,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 ECHO RANLIB ac_ct_RANLIB CPP EGREP LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -927,26 +932,6 @@ ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP -ac_env_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS -ac_env_CXXCPP_set=${CXXCPP+set} -ac_env_CXXCPP_value=$CXXCPP -ac_cv_env_CXXCPP_set=${CXXCPP+set} -ac_cv_env_CXXCPP_value=$CXXCPP -ac_env_F77_set=${F77+set} -ac_env_F77_value=$F77 -ac_cv_env_F77_set=${F77+set} -ac_cv_env_F77_value=$F77 -ac_env_FFLAGS_set=${FFLAGS+set} -ac_env_FFLAGS_value=$FFLAGS -ac_cv_env_FFLAGS_set=${FFLAGS+set} -ac_cv_env_FFLAGS_value=$FFLAGS # # Report the --help message. @@ -1029,10 +1014,8 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-shared[=PKGS] - build shared libraries [default=yes] - --enable-static[=PKGS] - build static libraries [default=yes] + --enable-shared=PKGS build shared libraries default=yes + --enable-static=PKGS build static libraries default=yes --enable-debug enable additional debugging code and output --disable-default-device-io-ops do not provide default device io operations @@ -1042,19 +1025,15 @@ Optional Features: --enable-warnings enable additional compiler warnings --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors - --enable-fast-install[=PKGS] - optimize for fast installation [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] - --with-tags[=TAGS] - include additional configurations [automatic] + --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 @@ -1064,11 +1043,6 @@ Some influential environment variables: CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CXXCPP C++ preprocessor - F77 Fortran 77 compiler command - FFLAGS Fortran 77 compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2045,51 +2019,47 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' 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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +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; - # This is required to get past a stupid configure bug when making the rpm. # Basically it is broken to specify the host as a command line argument to # configure on its own, i.e. without giving --host=. It is supposed to work @@ -3413,98 +3383,35 @@ fi 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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +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; - -echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done - +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator fi -SED=$lt_cv_path_SED -echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6 - -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 - 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then @@ -3516,8 +3423,8 @@ 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 $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 + 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 @@ -3527,12 +3434,12 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 esac case $ac_prog in # Accept absolute paths. - [\\/]* | ?:[\\/]*) + [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + # 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%/%"` + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -3556,26 +3463,22 @@ if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do - IFS="$lt_save_ifs" 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. - case `"$lt_cv_path_LD" -v 2>&1 &1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break - ;; - *) + else test "$with_gnu_ld" != yes && break - ;; - esac + fi fi done - IFS="$lt_save_ifs" + IFS="$ac_save_ifs" else lt_cv_path_LD="$LD" # Let the user override the test with a path. fi @@ -3598,14 +3501,11 @@ 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. -case `$LD -v 2>&1 &1 &5; then lt_cv_prog_gnu_ld=yes - ;; -*) +else lt_cv_prog_gnu_ld=no - ;; -esac +fi fi echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 @@ -3622,20 +3522,7 @@ 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 -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - darwin*) - if test "$GCC" = yes; then - reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac +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 @@ -3646,42 +3533,120 @@ else # Let the user override the test. lt_cv_path_NM="$NM" else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" 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 + 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 - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) + 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 - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - 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 - ;; - esac - esac + 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="$lt_save_ifs" + IFS="$ac_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi -echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 -echo "${ECHO_T}$lt_cv_path_NM" >&6 + NM="$lt_cv_path_NM" +echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_executable_p="test -f" +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_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + fi + done + done +done + + # 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 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break + fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 40000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done + done + rm -rf "$tmp" + +fi + +if test "X$SED" != "X"; then + lt_cv_path_SED=$SED +else + SED=$lt_cv_path_SED +fi +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 @@ -3698,7 +3663,7 @@ lt_cv_deplibs_check_method='unknown' # '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 extended regex. +# 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. @@ -3711,30 +3676,31 @@ beos*) lt_cv_deplibs_check_method=pass_all ;; -bsdi[45]*) +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*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump'. +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=pass_all + 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac ;; -freebsd* | kfreebsd*-gnu) +freebsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -3754,53 +3720,50 @@ gnu*) lt_cv_deplibs_check_method=pass_all ;; -hpux10.20* | hpux11*) +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 - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - 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_test_file=/usr/lib/libc.sl - ;; - esac + lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; + case $host_os in + irix5* | nonstopux*) + # 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*) +linux-gnu*) case $host_cpu in - alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64) + alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM - # this will be overridden with pass_all, but let us keep it just in case 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` - lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' fi ;; @@ -3810,19 +3773,20 @@ newos6*) lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' fi ;; 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 ;; @@ -3831,6 +3795,11 @@ sco3.2v5*) ;; 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 ;; @@ -3857,10 +3826,6 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ;; esac ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; esac fi @@ -3868,210 +3833,211 @@ 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 -test -z "$deplibs_check_method" && deplibs_check_method=unknown -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -# 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 && enable_libtool_lock=yes -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > 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 - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 3914 "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 - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - 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 - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > 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.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - 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 +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output" >&5 +echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] -int -main () -{ +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' -lt_cv_cc_needs_belf=no -fi -rm -f conftest.err 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 +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' -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 +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' ;; - esac -need_locks="$enable_libtool_lock" +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + 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); } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4308,6 +4274,21 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 + 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + 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 @@ -4696,1372 +4677,150 @@ fi done -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC - 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_CXX+set}" = set; then + + + + + +# 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 - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # 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_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done + 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 <&2 -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi +*** 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 - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -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_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - - -# 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 &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -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_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cxx_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -for ac_declaration in \ - '' \ - '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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -depcc="$CXX" 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_CXX_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_CXX_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 - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch 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 - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break +EOF + fi ;; + esac fi + break fi done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac fi -fi -echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_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 -if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -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 - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -echo "$as_me:$LINENO: result: $CXXCPP" >&5 -echo "${ECHO_T}$CXXCPP" >&6 -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -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 \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran - 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_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$F77"; then - ac_cv_prog_F77="$F77" # 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_F77="$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 -F77=$ac_cv_prog_F77 -if test -n "$F77"; then - echo "$as_me:$LINENO: result: $F77" >&5 -echo "${ECHO_T}$F77" >&6 +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 - test -n "$F77" && break +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 <&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 -if test -z "$F77"; then - ac_ct_F77=$F77 - for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran -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_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_F77"; then - ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -fi -fi -ac_ct_F77=$ac_cv_prog_ac_ct_F77 -if test -n "$ac_ct_F77"; then - echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 -echo "${ECHO_T}$ac_ct_F77" >&6 +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 - test -n "$ac_ct_F77" && break -done - - F77=$ac_ct_F77 -fi - - -# Provide some information about the compiler. -echo "$as_me:5486:" \ - "checking for Fortran 77 compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -rm -f a.out - -# If we don't use `.F' as extension, the preprocessor is not run on the -# input file. (Note that this only needs to work for GNU compilers.) -ac_save_ext=$ac_ext -ac_ext=F -echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 -if test "${ac_cv_f77_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF - program main -#ifndef __GNUC__ - choke me -#endif - - end -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext -ac_cv_f77_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 -ac_ext=$ac_save_ext -ac_test_FFLAGS=${FFLAGS+set} -ac_save_FFLAGS=$FFLAGS -FFLAGS= -echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 -echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_f77_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - FFLAGS=-g -cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_f77_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_f77_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 -echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 -if test "$ac_test_FFLAGS" = set; then - FFLAGS=$ac_save_FFLAGS -elif test $ac_cv_prog_f77_g = yes; then - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-g -O2" else - FFLAGS="-g" - fi -else - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-O2" - else - FFLAGS= + MAGIC_CMD=: fi fi -G77=`test $ac_compiler_gnu = yes && echo yes` -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 - - - -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - -# find the maximum length of command line arguments -echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 -echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 -if test "${lt_cv_sys_max_cmd_len+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* ) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for *BSD - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 -echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 -else - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 -fi - - - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 -echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris* | sysv5*) - symcode='[BDRT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - 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); } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6 -else - echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6 -fi - -echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -if test "${lt_cv_objdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 -echo "${ECHO_T}$lt_cv_objdir" >&6 -objdir=$lt_cv_objdir - - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES fi ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; 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_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" - 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_AR" && ac_cv_prog_ac_ct_AR="false" -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -echo "${ECHO_T}$ac_ct_AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - AR=$ac_ct_AR -else - AR="$ac_cv_prog_AR" -fi - 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 @@ -6223,6 +4982,168 @@ else fi +enable_dlopen=no +enable_win32_dll=no + +# 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 && enable_libtool_lock=yes + +# 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 5000 "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* + ;; + +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_64bit_output=no + 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 + *"ELF 64"*) + lt_cv_cc_64bit_output=yes + ;; + 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 +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err 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 + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + old_CC="$CC" old_CFLAGS="$CFLAGS" @@ -6231,18 +5152,40 @@ test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm -test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' @@ -6260,152 +5203,24 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" -# 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 +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs fi +rmdir .libs 2>/dev/null +echo "$as_me:$LINENO: result: $objdir" >&5 +echo "${ECHO_T}$objdir" >&6 -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_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_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 - -enable_dlopen=no -enable_win32_dll=no - -# 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 && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. @@ -6417,455 +5232,453 @@ else fi; test -z "$pic_mode" && pic_mode=default -# Use C for the default configuration in the libtool script -tagname= -lt_save_CC="$CC" -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 - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# -# Check for any special shared library compilation flags. -# -lt_prog_cc_shlib= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - lt_prog_cc_shlib='-belf' - ;; - esac -fi -if test -n "$lt_prog_cc_shlib"; then - { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 -if test "${lt_prog_compiler_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_prog_compiler_static" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - else - lt_prog_compiler_static_works=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 - -if test x"$lt_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' - - -echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6536: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:6540: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_pic+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" ;; - amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' + lt_cv_prog_cc_pic='-fno-common' ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' ;; - sysv4*MP*) if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic + lt_cv_prog_cc_pic=-Kconform_pic fi ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - *) - lt_prog_compiler_pic='-fPIC' + lt_cv_prog_cc_pic='-fPIC' ;; esac else - # PORTME Check for flag to pass linker flags through the system compiler. + # PORTME Check for PIC flags for the system compiler. case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_static='-Bstatic' else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' fi ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic='-qnocommon' - lt_prog_compiler_wl='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' ;; irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' ;; newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - esac + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' ;; osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' ;; sco3.2v5*) - lt_prog_compiler_pic='-Kpic' - lt_prog_compiler_static='-dn' + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' ;; solaris*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' ;; sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' fi ;; - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - *) - lt_prog_compiler_can_build_shared=no + lt_cv_prog_cc_can_build_shared=no ;; esac fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic" >&6 +fi -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then +if test -z "$lt_cv_prog_cc_pic"; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +else + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works+set}" = set; then + # Check to make sure the pic_flag actually works. + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 + if test "${lt_cv_prog_cc_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6779: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:6783: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works=yes - fi - fi - $rm conftest* + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac -if test x"$lt_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_prog_cc_pic_works=no fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +fi + + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + +echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_prog_cc_static_works=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi + + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o+set}" = set; then +if test "${lt_cv_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_cv_prog_compiler_c_o=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6839: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:6843: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:5576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 +compiler_c_o=$lt_cv_compiler_c_o +echo "$as_me:$LINENO: result: $compiler_c_o" >&5 +echo "${ECHO_T}$compiler_c_o" >&6 +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 + if test "${lt_cv_compiler_o_lo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + +fi + + compiler_o_lo=$lt_cv_compiler_o_lo + echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 +echo "${ECHO_T}$compiler_o_lo" >&6 +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then +if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 @@ -6886,72 +5699,144 @@ else need_locks=no fi -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - runpath_var= - allow_undefined_flag= - enable_shared_with_static_runtimes=no - archive_cmds= - archive_expsym_cmds= - old_archive_From_new_cmds= - old_archive_from_expsyms_cmds= - export_dynamic_flag_spec= - whole_archive_flag_spec= - thread_safe_flag_spec= - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - link_all_deplibs=unknown - hardcode_automatic=no - module_cmds= - module_expsym_cmds= - always_export_symbols=no - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes fi - ;; - openbsd*) + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$compiler_rtti_exceptions" >&6 + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then with_gnu_ld=no - ;; - esac + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac - ld_shlibs=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <&2 + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. @@ -6960,73 +5845,125 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar *** so that a non-GNU linker is found, and then restart. EOF - fi - ;; + ;; - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs=no - ;; + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ ;; + esac - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool @@ -7036,782 +5973,553 @@ EOF *** used, and then restart. EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds="$tmp_archive_cmds" - fi + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - - if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec=' ' - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' - link_all_deplibs=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs=no - ;; - esac + ld_shlibs=no fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - ia64*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=no - hardcode_shlibpath_var=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - *) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld='-rpath $libdir' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag=' -z text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - *) - ld_shlibs=no + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi ;; esac fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [12].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +# Check hardcoding attributes. +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 -echo "${ECHO_T}$archive_cmds_need_lc" >&6 - ;; - esac - fi - ;; -esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown +# PORTME Fill in your ld.so characteristics echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= -shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -7820,36 +6528,17 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' ;; aix4* | aix5*) @@ -7859,7 +6548,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -7869,54 +6558,57 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' + soname_spec='${libname}${release}.so$major' fi shlibpath_var=LIBPATH fi + hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) - library_names_spec='${libname}${shared_ext}' + library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; -bsdi[45]*) +bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -7924,55 +6616,29 @@ bsdi[45]*) cygwin* | mingw* | pw32*) version_type=windows - shrext_cmds=".dll" need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) + yes,cygwin*) library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac ;; - + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' + ;; *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -7985,56 +6651,30 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac @@ -8043,11 +6683,7 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on + *) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -8058,8 +6694,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -8067,45 +6703,14 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. + dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -8113,29 +6718,21 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; + *) version_type=irix ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -8144,21 +6741,20 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. -linux*) +linux-gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -8167,11 +6763,12 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi + case $host_cpu:$lt_cv_cc_64bit_output in + powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" + ;; + esac # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -8182,29 +6779,17 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -8214,17 +6799,7 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -8233,47 +6808,46 @@ openbsd*) version_type=sunos need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case "$host_os" in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' - shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' + library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf - need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; @@ -8281,8 +6855,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -8292,7 +6866,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -8304,8 +6878,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -8326,22 +6900,31 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - *) dynamic_linker=no ;; @@ -8350,33 +6933,42 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var" || \ - test "X$hardcode_automatic" = "Xyes" ; then +# Report the final consequences. +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6 + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported @@ -8387,33 +6979,9 @@ elif test "$shlibpath_overrides_runpath" = yes || enable_fast_install=needless fi -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "x$enable_dlopen" != xyes; then @@ -8431,94 +6999,11 @@ else lt_cv_dlopen_self=yes ;; - mingw* | pw32*) + cygwin* | mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 @@ -9002,7 +7487,7 @@ fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" @@ -9018,10 +7503,10 @@ else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 fi -# Report which librarie types wil actually be built -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + if test "${lt_cv_archive_cmds_need_lc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 + 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 + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi +fi -# The else clause should only fire when bootstrapping the + echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 +echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ + for var in echo old_CC old_CFLAGS SED \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler \ - CC \ - LD \ - lt_prog_compiler_wl \ - lt_prog_compiler_pic \ - lt_prog_compiler_static \ - lt_prog_compiler_no_builtin_flag \ - export_dynamic_flag_spec \ - thread_safe_flag_spec \ - whole_archive_flag_spec \ - enable_shared_with_static_runtimes \ - old_archive_cmds \ - old_archive_from_new_cmds \ - predep_objects \ - postdep_objects \ - predeps \ - postdeps \ - compiler_lib_search_path \ - archive_cmds \ - archive_expsym_cmds \ - postinstall_cmds \ - postuninstall_cmds \ - old_archive_from_expsyms_cmds \ - allow_undefined_flag \ - no_undefined_flag \ - export_symbols_cmds \ - hardcode_libdir_flag_spec \ - hardcode_libdir_flag_spec_ld \ - hardcode_libdir_separator \ - hardcode_automatic \ - module_cmds \ - module_expsym_cmds \ - lt_cv_prog_compiler_c_o \ - exclude_expsyms \ - include_expsyms; do + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do case $var in - old_archive_cmds | \ - old_archive_from_new_cmds | \ - archive_cmds | \ - archive_expsym_cmds | \ - module_cmds | \ - module_expsym_cmds | \ - old_archive_from_expsyms_cmds | \ - export_symbols_cmds | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -9340,29 +7820,14 @@ if test -f "$ltmain"; then esac done - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - { echo "$as_me:$LINENO: creating $ofile" >&5 -echo "$as_me: creating $ofile" >&6;} - - cat <<__EOF__ >> "$cfgfile" + cat <<__EOF__ > "${ofile}T" #! $SHELL -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: +# Copyright (C) 1996-2000 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -9384,18 +7849,15 @@ echo "$as_me: creating $ofile" >&6;} # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed program that does not truncate output. +# A sed that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="${SED} -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# The names of the tagged configurations supported by this script. -available_tags= +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi # ### BEGIN LIBTOOL CONFIG @@ -9411,10 +7873,7 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes +build_libtool_need_lc=$need_lc # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -9430,18 +7889,12 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler +# The default C compiler. +CC=$lt_CC # Is the compiler the GNU C compiler? with_gcc=$GCC -# An ERE matcher. -EGREP=$lt_EGREP - # The linker used to build libraries. LD=$lt_LD @@ -9452,7 +7905,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$lt_STRIP +STRIP=$STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -9464,7 +7917,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9474,7 +7927,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl +wl=$lt_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -9482,21 +7935,18 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic +pic_flag=$lt_pic_flag pic_mode=$pic_mode -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - # Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -9517,10 +7967,10 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static +link_static_flag=$lt_link_static_flag # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag +no_builtin_flag=$lt_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec @@ -9562,34 +8012,10 @@ archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -9609,13 +8035,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe +global_symbol_pipe=$lt_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -9636,15 +8062,10 @@ hardcode_into_libs=$hardcode_into_libs # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct @@ -9656,10 +8077,6 @@ hardcode_minus_L=$hardcode_minus_L # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic - # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" @@ -9695,10 +8112,9 @@ include_expsyms=$lt_include_expsyms __EOF__ - case $host_os in aix3*) - cat <<\EOF >> "$cfgfile" + cat <<\EOF >> "${ofile}T" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -9707,6 +8123,186 @@ if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# 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 of the License, 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. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1) - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") chmod +x "$ofile" - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - -# Check whether --with-tags or --without-tags was given. -if test "${with_tags+set}" = set; then - withval="$with_tags" - tagnames="$withval" -fi; - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} - else - { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 -echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in - "") ;; - *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 -echo "$as_me: error: invalid tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 -echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} - { (exit 1); exit 1; }; } - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_flag_spec_ld_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_automatic_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -compiler_CXX=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' -else - lt_prog_compiler_no_builtin_flag_CXX= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - -# 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 $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $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. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname 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 - 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 - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - 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. - case `"$lt_cv_path_LD" -v 2>&1 &5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -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. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 -ld_shlibs_CXX=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_CXX=yes - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_CXX=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_CXX='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' ${wl}-bernotok' - allow_undefined_flag_CXX=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_CXX=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX=' ' - archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs_CXX=no - fi - ;; - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_CXX=no - ;; - esac - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - freebsd12*) - # C++ shared libraries reported to be fairly broken before switch to ELF - ld_shlibs_CXX=no - ;; - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - gnu*) - ;; - hpux9*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC) - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_CXX='+b $libdir' - hardcode_libdir_separator_CXX=: - ;; - ia64*) - hardcode_libdir_flag_spec_CXX='-L$libdir' - ;; - *) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - openbsd2*) - # C++ shared libraries are fairly broken - ld_shlibs_CXX=no - ;; - openbsd*) - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='${wl}-E' - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd='echo' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx) - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - sco*) - archive_cmds_need_lc_CXX=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.0-5 | solaris2.0-5.*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - no_undefined_flag_CXX=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - archive_cmds_need_lc_CXX=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; -esac -echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6 -test "$ld_shlibs_CXX" = no && can_build_shared=no - -GCC_CXX="$GXX" -LD_CXX="$LD" - - -cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - # The `*' in the case matches for architectures that use `case' in - # $output_verbose_cmd can trigger glob expansion during the loop - # eval without this substitution. - output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" - - for p in `eval $output_verbose_link_cmd`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" \ - || test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX="${prev}${p}" - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX="${prev}${p}" - else - postdeps_CXX="${postdeps_CXX} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX="$p" - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX="$p" - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$rm -f confest.$objext - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - -lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic_CXX='-qnocommon' - lt_prog_compiler_wl_CXX='-Wl,' - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - icpc) - # Intel C++ - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11311: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:11315: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_CXX=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 - -if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11371: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:11375: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX="$ltdll_cmds" - ;; - cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - -echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6 -test "$ld_shlibs_CXX" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_CXX=no - else - archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || \ - test -n "$runpath_var_CXX" || \ - test "X$hardcode_automatic_CXX" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 -echo "${ECHO_T}$hardcode_action_CXX" >&6 - -if test "$hardcode_action_CXX" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* 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 shl_load (); -/* 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_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* 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 dlopen (); -/* 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_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_CXX \ - CC_CXX \ - LD_CXX \ - lt_prog_compiler_wl_CXX \ - lt_prog_compiler_pic_CXX \ - lt_prog_compiler_static_CXX \ - lt_prog_compiler_no_builtin_flag_CXX \ - export_dynamic_flag_spec_CXX \ - thread_safe_flag_spec_CXX \ - whole_archive_flag_spec_CXX \ - enable_shared_with_static_runtimes_CXX \ - old_archive_cmds_CXX \ - old_archive_from_new_cmds_CXX \ - predep_objects_CXX \ - postdep_objects_CXX \ - predeps_CXX \ - postdeps_CXX \ - compiler_lib_search_path_CXX \ - archive_cmds_CXX \ - archive_expsym_cmds_CXX \ - postinstall_cmds_CXX \ - postuninstall_cmds_CXX \ - old_archive_from_expsyms_cmds_CXX \ - allow_undefined_flag_CXX \ - no_undefined_flag_CXX \ - export_symbols_cmds_CXX \ - hardcode_libdir_flag_spec_CXX \ - hardcode_libdir_flag_spec_ld_CXX \ - hardcode_libdir_separator_CXX \ - hardcode_automatic_CXX \ - module_cmds_CXX \ - module_expsym_cmds_CXX \ - lt_cv_prog_compiler_c_o_CXX \ - exclude_expsyms_CXX \ - include_expsyms_CXX; do - - case $var in - old_archive_cmds_CXX | \ - old_archive_from_new_cmds_CXX | \ - archive_cmds_CXX | \ - archive_expsym_cmds_CXX | \ - module_cmds_CXX | \ - module_expsym_cmds_CXX | \ - old_archive_from_expsyms_cmds_CXX | \ - export_symbols_cmds_CXX | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_CXX - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_CXX -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_CXX - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_CXX" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld - - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu - - -archive_cmds_need_lc_F77=no -allow_undefined_flag_F77= -always_export_symbols_F77=no -archive_expsym_cmds_F77= -export_dynamic_flag_spec_F77= -hardcode_direct_F77=no -hardcode_libdir_flag_spec_F77= -hardcode_libdir_flag_spec_ld_F77= -hardcode_libdir_separator_F77= -hardcode_minus_L_F77=no -hardcode_automatic_F77=no -module_cmds_F77= -module_expsym_cmds_F77= -link_all_deplibs_F77=unknown -old_archive_cmds_F77=$old_archive_cmds -no_undefined_flag_F77= -whole_archive_flag_spec_F77= -enable_shared_with_static_runtimes_F77=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -objext_F77=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" - -# Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${F77-"f77"} -compiler=$CC -compiler_F77=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 - -test "$ld_shlibs_F77" = no && can_build_shared=no - -GCC_F77="$G77" -LD_F77="$LD" - -lt_prog_compiler_wl_F77= -lt_prog_compiler_pic_F77= -lt_prog_compiler_static_F77= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_static_F77='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_F77='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_F77=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_F77=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_F77='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - else - lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic_F77='-qnocommon' - lt_prog_compiler_wl_F77='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_F77='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_F77='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-static' - ;; - ccc*) - lt_prog_compiler_wl_F77='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_F77='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_F77='-Kpic' - lt_prog_compiler_static_F77='-dn' - ;; - - solaris*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl_F77='-Qoption ld ' - lt_prog_compiler_pic_F77='-PIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_F77='-Kconform_pic' - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - uts4*) - lt_prog_compiler_pic_F77='-pic' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_F77=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_F77"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_F77=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_F77" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13667: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:13671: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_F77=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 - -if test x"$lt_prog_compiler_pic_works_F77" = xyes; then - case $lt_prog_compiler_pic_F77 in - "" | " "*) ;; - *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; - esac -else - lt_prog_compiler_pic_F77= - lt_prog_compiler_can_build_shared_F77=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_F77= - ;; - *) - lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_F77=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13727: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:13731: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_F77=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag_F77= - enable_shared_with_static_runtimes_F77=no - archive_cmds_F77= - archive_expsym_cmds_F77= - old_archive_From_new_cmds_F77= - old_archive_from_expsyms_cmds_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= - thread_safe_flag_spec_F77= - hardcode_libdir_flag_spec_F77= - hardcode_libdir_flag_spec_ld_F77= - hardcode_libdir_separator_F77= - hardcode_direct_F77=no - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=unsupported - link_all_deplibs_F77=unknown - hardcode_automatic_F77=no - module_cmds_F77= - module_expsym_cmds_F77= - always_export_symbols_F77=no - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_F77= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_F77=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_F77=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_F77=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_F77='-L$libdir' - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=no - enable_shared_with_static_runtimes_F77=yes - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - sunos4*) - archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds_F77="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_F77="$tmp_archive_cmds" - fi - else - ld_shlibs_F77=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - esac - - if test "$ld_shlibs_F77" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=yes - archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_F77=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_F77=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_F77='' - hardcode_direct_F77=yes - hardcode_libdir_separator_F77=':' - link_all_deplibs_F77=yes - - if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_F77=yes - else - # We have old collect2 - hardcode_direct_F77=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_F77=yes - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_libdir_separator_F77= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_F77=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_F77='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_F77="-z nodefs" - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_F77=' ${wl}-bernotok' - allow_undefined_flag_F77=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_F77=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_F77=' ' - archive_cmds_need_lc_F77=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_F77=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_F77=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_F77=' ' - allow_undefined_flag_F77=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_F77='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_F77=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_F77=no - hardcode_direct_F77=no - hardcode_automatic_F77=yes - hardcode_shlibpath_var_F77=unsupported - whole_archive_flag_spec_F77='' - link_all_deplibs_F77=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_F77=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - freebsd1*) - ld_shlibs_F77=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_F77='+b $libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - ;; - ia64*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - *) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - link_all_deplibs_F77=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - newsos6) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_shlibpath_var_F77=no - ;; - - openbsd*) - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - export_dynamic_flag_spec_F77='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - ;; - *) - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - allow_undefined_flag_F77=unsupported - archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_F77='-rpath $libdir' - fi - hardcode_libdir_separator_F77=: - ;; - - sco3.2v5*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_F77=' -z text' - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_shlibpath_var_F77=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs_F77=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_F77='$CC -r -o $output$reload_objs' - hardcode_direct_F77=no - ;; - motorola) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv4.3*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_F77=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_F77='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv5*) - no_undefined_flag_F77=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_F77= - hardcode_shlibpath_var_F77=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - *) - ld_shlibs_F77=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 -echo "${ECHO_T}$ld_shlibs_F77" >&6 -test "$ld_shlibs_F77" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_F77" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_F77=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_F77 in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_F77 - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_F77 - allow_undefined_flag_F77= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_F77=no - else - archive_cmds_need_lc_F77=yes - fi - allow_undefined_flag_F77=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_F77= -if test -n "$hardcode_libdir_flag_spec_F77" || \ - test -n "$runpath_var_F77" || \ - test "X$hardcode_automatic_F77" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_F77" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && - test "$hardcode_minus_L_F77" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_F77=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_F77=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_F77=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 -echo "${ECHO_T}$hardcode_action_F77" >&6 - -if test "$hardcode_action_F77" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_F77 \ - CC_F77 \ - LD_F77 \ - lt_prog_compiler_wl_F77 \ - lt_prog_compiler_pic_F77 \ - lt_prog_compiler_static_F77 \ - lt_prog_compiler_no_builtin_flag_F77 \ - export_dynamic_flag_spec_F77 \ - thread_safe_flag_spec_F77 \ - whole_archive_flag_spec_F77 \ - enable_shared_with_static_runtimes_F77 \ - old_archive_cmds_F77 \ - old_archive_from_new_cmds_F77 \ - predep_objects_F77 \ - postdep_objects_F77 \ - predeps_F77 \ - postdeps_F77 \ - compiler_lib_search_path_F77 \ - archive_cmds_F77 \ - archive_expsym_cmds_F77 \ - postinstall_cmds_F77 \ - postuninstall_cmds_F77 \ - old_archive_from_expsyms_cmds_F77 \ - allow_undefined_flag_F77 \ - no_undefined_flag_F77 \ - export_symbols_cmds_F77 \ - hardcode_libdir_flag_spec_F77 \ - hardcode_libdir_flag_spec_ld_F77 \ - hardcode_libdir_separator_F77 \ - hardcode_automatic_F77 \ - module_cmds_F77 \ - module_expsym_cmds_F77 \ - lt_cv_prog_compiler_c_o_F77 \ - exclude_expsyms_F77 \ - include_expsyms_F77; do - - case $var in - old_archive_cmds_F77 | \ - old_archive_from_new_cmds_F77 | \ - archive_cmds_F77 | \ - archive_expsym_cmds_F77 | \ - module_cmds_F77 | \ - module_expsym_cmds_F77 | \ - old_archive_from_expsyms_cmds_F77 | \ - export_symbols_cmds_F77 | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_F77 - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_F77 - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_F77 - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_F77 - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_F77 - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_F77 -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_F77 - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_F77 -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_F77 -archive_expsym_cmds=$lt_archive_expsym_cmds_F77 -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_F77 -module_expsym_cmds=$lt_module_expsym_cmds_F77 - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_F77 - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_F77 - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_F77 - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_F77 - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_F77 - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_F77 - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_F77 - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_F77 - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_F77 - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_F77 - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_F77" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_F77 - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_F77 - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_F77 - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_F77 - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - - - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -objext_GCJ=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -compiler_GCJ=$CC - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -archive_cmds_need_lc_GCJ=no - - -lt_prog_compiler_no_builtin_flag_GCJ= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' - - -echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15762: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:15766: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl_GCJ= -lt_prog_compiler_pic_GCJ= -lt_prog_compiler_static_GCJ= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_static_GCJ='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_GCJ='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_GCJ=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_GCJ=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_GCJ='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - else - lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic_GCJ='-qnocommon' - lt_prog_compiler_wl_GCJ='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-static' - ;; - ccc*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_GCJ='-Kpic' - lt_prog_compiler_static_GCJ='-dn' - ;; - - solaris*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl_GCJ='-Qoption ld ' - lt_prog_compiler_pic_GCJ='-PIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_GCJ='-Kconform_pic' - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - uts4*) - lt_prog_compiler_pic_GCJ='-pic' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_GCJ=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_GCJ"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_GCJ=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_GCJ" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16005: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:16009: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_GCJ=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 - -if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then - case $lt_prog_compiler_pic_GCJ in - "" | " "*) ;; - *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; - esac -else - lt_prog_compiler_pic_GCJ= - lt_prog_compiler_can_build_shared_GCJ=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_GCJ= - ;; - *) - lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_GCJ=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16065: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:16069: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_GCJ=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag_GCJ= - enable_shared_with_static_runtimes_GCJ=no - archive_cmds_GCJ= - archive_expsym_cmds_GCJ= - old_archive_From_new_cmds_GCJ= - old_archive_from_expsyms_cmds_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= - thread_safe_flag_spec_GCJ= - hardcode_libdir_flag_spec_GCJ= - hardcode_libdir_flag_spec_ld_GCJ= - hardcode_libdir_separator_GCJ= - hardcode_direct_GCJ=no - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=unsupported - link_all_deplibs_GCJ=unknown - hardcode_automatic_GCJ=no - module_cmds_GCJ= - module_expsym_cmds_GCJ= - always_export_symbols_GCJ=no - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_GCJ= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_GCJ=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_GCJ=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_GCJ=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_GCJ='-L$libdir' - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=no - enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - sunos4*) - archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds_GCJ="$tmp_archive_cmds" - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_GCJ="$tmp_archive_cmds" - fi - else - ld_shlibs_GCJ=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - esac - - if test "$ld_shlibs_GCJ" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=yes - archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_GCJ=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_GCJ=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_GCJ='' - hardcode_direct_GCJ=yes - hardcode_libdir_separator_GCJ=':' - link_all_deplibs_GCJ=yes - - if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_GCJ=yes - else - # We have old collect2 - hardcode_direct_GCJ=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_GCJ=yes - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_libdir_separator_GCJ= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_GCJ=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_GCJ='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_GCJ="-z nodefs" - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_GCJ=' ${wl}-bernotok' - allow_undefined_flag_GCJ=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_GCJ=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_GCJ=' ' - archive_cmds_need_lc_GCJ=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_GCJ=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_GCJ=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_GCJ=' ' - allow_undefined_flag_GCJ=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_GCJ='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_GCJ=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_GCJ=no - hardcode_direct_GCJ=no - hardcode_automatic_GCJ=yes - hardcode_shlibpath_var_GCJ=unsupported - whole_archive_flag_spec_GCJ='' - link_all_deplibs_GCJ=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_GCJ=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - freebsd1*) - ld_shlibs_GCJ=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) - archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - ;; - ia64*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - *) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - link_all_deplibs_GCJ=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - newsos6) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_shlibpath_var_GCJ=no - ;; - - openbsd*) - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - ;; - *) - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - allow_undefined_flag_GCJ=unsupported - archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_GCJ='-rpath $libdir' - fi - hardcode_libdir_separator_GCJ=: - ;; - - sco3.2v5*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_GCJ=' -z text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_shlibpath_var_GCJ=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs_GCJ=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_GCJ='$CC -r -o $output$reload_objs' - hardcode_direct_GCJ=no - ;; - motorola) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4.3*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_GCJ=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_GCJ='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv5*) - no_undefined_flag_GCJ=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_GCJ= - hardcode_shlibpath_var_GCJ=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - *) - ld_shlibs_GCJ=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 -echo "${ECHO_T}$ld_shlibs_GCJ" >&6 -test "$ld_shlibs_GCJ" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_GCJ" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_GCJ=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_GCJ in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_GCJ - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ - allow_undefined_flag_GCJ= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_GCJ=no - else - archive_cmds_need_lc_GCJ=yes - fi - allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.01* | freebsdelf3.01*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_GCJ= -if test -n "$hardcode_libdir_flag_spec_GCJ" || \ - test -n "$runpath_var_GCJ" || \ - test "X$hardcode_automatic_GCJ" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_GCJ" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && - test "$hardcode_minus_L_GCJ" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_GCJ=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_GCJ=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_GCJ=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 -echo "${ECHO_T}$hardcode_action_GCJ" >&6 - -if test "$hardcode_action_GCJ" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* 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 shl_load (); -/* 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_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* 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 dlopen (); -/* 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_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - fi - ;; - esac - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_GCJ \ - CC_GCJ \ - LD_GCJ \ - lt_prog_compiler_wl_GCJ \ - lt_prog_compiler_pic_GCJ \ - lt_prog_compiler_static_GCJ \ - lt_prog_compiler_no_builtin_flag_GCJ \ - export_dynamic_flag_spec_GCJ \ - thread_safe_flag_spec_GCJ \ - whole_archive_flag_spec_GCJ \ - enable_shared_with_static_runtimes_GCJ \ - old_archive_cmds_GCJ \ - old_archive_from_new_cmds_GCJ \ - predep_objects_GCJ \ - postdep_objects_GCJ \ - predeps_GCJ \ - postdeps_GCJ \ - compiler_lib_search_path_GCJ \ - archive_cmds_GCJ \ - archive_expsym_cmds_GCJ \ - postinstall_cmds_GCJ \ - postuninstall_cmds_GCJ \ - old_archive_from_expsyms_cmds_GCJ \ - allow_undefined_flag_GCJ \ - no_undefined_flag_GCJ \ - export_symbols_cmds_GCJ \ - hardcode_libdir_flag_spec_GCJ \ - hardcode_libdir_flag_spec_ld_GCJ \ - hardcode_libdir_separator_GCJ \ - hardcode_automatic_GCJ \ - module_cmds_GCJ \ - module_expsym_cmds_GCJ \ - lt_cv_prog_compiler_c_o_GCJ \ - exclude_expsyms_GCJ \ - include_expsyms_GCJ; do - - case $var in - old_archive_cmds_GCJ | \ - old_archive_from_new_cmds_GCJ | \ - archive_cmds_GCJ | \ - archive_expsym_cmds_GCJ | \ - module_cmds_GCJ | \ - module_expsym_cmds_GCJ | \ - old_archive_from_expsyms_cmds_GCJ | \ - export_symbols_cmds_GCJ | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_GCJ - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_GCJ - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_GCJ - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_GCJ - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_GCJ - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_GCJ -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_GCJ - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_GCJ -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_GCJ -archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_GCJ -module_expsym_cmds=$lt_module_expsym_cmds_GCJ - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_GCJ - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_GCJ - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_GCJ - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_GCJ - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_GCJ - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_GCJ - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_GCJ - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_GCJ - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_GCJ - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_GCJ" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_GCJ - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_GCJ - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_GCJ - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_GCJ - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - RC) - - - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -objext_RC=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -compiler_RC=$CC -lt_cv_prog_compiler_c_o_RC=yes - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_RC \ - CC_RC \ - LD_RC \ - lt_prog_compiler_wl_RC \ - lt_prog_compiler_pic_RC \ - lt_prog_compiler_static_RC \ - lt_prog_compiler_no_builtin_flag_RC \ - export_dynamic_flag_spec_RC \ - thread_safe_flag_spec_RC \ - whole_archive_flag_spec_RC \ - enable_shared_with_static_runtimes_RC \ - old_archive_cmds_RC \ - old_archive_from_new_cmds_RC \ - predep_objects_RC \ - postdep_objects_RC \ - predeps_RC \ - postdeps_RC \ - compiler_lib_search_path_RC \ - archive_cmds_RC \ - archive_expsym_cmds_RC \ - postinstall_cmds_RC \ - postuninstall_cmds_RC \ - old_archive_from_expsyms_cmds_RC \ - allow_undefined_flag_RC \ - no_undefined_flag_RC \ - export_symbols_cmds_RC \ - hardcode_libdir_flag_spec_RC \ - hardcode_libdir_flag_spec_ld_RC \ - hardcode_libdir_separator_RC \ - hardcode_automatic_RC \ - module_cmds_RC \ - module_expsym_cmds_RC \ - lt_cv_prog_compiler_c_o_RC \ - exclude_expsyms_RC \ - include_expsyms_RC; do - - case $var in - old_archive_cmds_RC | \ - old_archive_from_new_cmds_RC | \ - archive_cmds_RC | \ - archive_expsym_cmds_RC | \ - module_cmds_RC | \ - module_expsym_cmds_RC | \ - old_archive_from_expsyms_cmds_RC | \ - export_symbols_cmds_RC | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_RC - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_RC - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_RC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_RC - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_RC - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_RC -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_RC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_RC -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_RC -archive_expsym_cmds=$lt_archive_expsym_cmds_RC -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_RC -module_expsym_cmds=$lt_module_expsym_cmds_RC - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_RC - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_RC - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_RC - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_RC - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_RC - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_RC - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_RC - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_RC - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_RC - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_RC - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_RC - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_RC" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_RC - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_RC - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_RC - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_RC - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - ;; - - *) - { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 -echo "$as_me: error: Unsupported tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 -echo "$as_me: error: unable to update list of available tagged configurations." >&2;} - { (exit 1); exit 1; }; } - fi -fi @@ -19341,24 +8331,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion - - - - - - - - - - - - - - - - - - # Enable large file support. # Check whether --enable-largefile or --disable-largefile was given. @@ -22831,13 +11803,6 @@ 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 -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -23450,23 +12415,11 @@ 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,@EGREP@,$EGREP,;t t s,@ECHO@,$ECHO,;t t -s,@AR@,$AR,;t t -s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;t t -s,@ac_ct_CXX@,$ac_ct_CXX,;t t -s,@CXXDEPMODE@,$CXXDEPMODE,;t t -s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t -s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t -s,@CXXCPP@,$CXXCPP,;t t -s,@F77@,$F77,;t t -s,@FFLAGS@,$FFLAGS,;t t -s,@ac_ct_F77@,$ac_ct_F77,;t t +s,@EGREP@,$EGREP,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t diff --git a/doc/Makefile.in b/doc/Makefile.in index 3a3a27d1..8c5f180f 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -52,7 +52,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -63,10 +62,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -78,8 +73,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -109,18 +102,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/include/Makefile.in b/include/Makefile.in index be3a902c..085ce4ee 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -61,7 +61,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -72,10 +71,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -87,8 +82,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -118,18 +111,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 5d26253c..a80d3671 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -65,7 +65,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -76,10 +75,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -91,8 +86,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -122,18 +115,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/install-sh b/install-sh index 0b65ee87..6ebe46de 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-10-22.00 +scriptversion=2004-12-17.09 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -296,7 +296,7 @@ do || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit + (exit 1); exit 1 } else : @@ -307,12 +307,12 @@ do $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } - fi || { (exit 1); exit; } + fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { - (exit 0); exit + (exit 0); exit 0 } # Local variables: diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 40b8c596..2720cf3f 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -46,6 +46,7 @@ libntfs_la_SOURCES = \ dir.c \ inode.c \ lcnalloc.c \ + logfile.c \ mft.c \ mst.c \ runlist.c \ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 2ddd1df0..962e313a 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -99,19 +99,19 @@ libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) libntfs_la_LIBADD = am_libntfs_la_OBJECTS = attrib.lo attrlist.lo bitmap.lo bootsect.lo \ compat.lo compress.lo debug.lo device.lo device_io.lo dir.lo \ - inode.lo lcnalloc.lo mft.lo mst.lo runlist.lo security.lo \ - unistr.lo volume.lo + inode.lo lcnalloc.lo logfile.lo mft.lo mst.lo runlist.lo \ + security.lo unistr.lo volume.lo libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) @@ -127,7 +127,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -138,10 +137,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -153,8 +148,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -184,18 +177,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -251,6 +239,7 @@ libntfs_la_SOURCES = \ dir.c \ inode.c \ lcnalloc.c \ + logfile.c \ mft.c \ mst.c \ runlist.c \ @@ -389,6 +378,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lcnalloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logfile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mft.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mst.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runlist.Plo@am__quote@ @@ -418,18 +408,18 @@ distclean-compile: @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c mostlyclean-libtool: -rm -f *.lo diff --git a/ltmain.sh b/ltmain.sh index a6d78e60..239bdefb 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -24,34 +24,6 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -basename="s,^.*/,,g" - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - -# The name of this program: -progname=`echo "$progpath" | $SED $basename` -modename="$progname" - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.5.8 -TIMESTAMP=" (1.1220.2.118 2004/08/07 12:24:38)" - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes. -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. @@ -64,7 +36,7 @@ elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : else # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} + exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then @@ -73,9 +45,22 @@ if test "X$1" = X--fallback-echo; then cat <&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 fi # Global variables. @@ -133,237 +117,8 @@ execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -func_win32_libid () { - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $echo $win32_libid_type -} - - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () { - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case "$@ " in - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit $EXIT_FAILURE -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () { - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - my_status="" - - $show "${rm}r $my_gentop" - $run ${rm}r "$my_gentop" - $show "$mkdir $my_gentop" - $run $mkdir "$my_gentop" - my_status=$? - if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then - exit $my_status - fi - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` - my_xdir="$my_gentop/$my_xlib" - - $show "${rm}r $my_xdir" - $run ${rm}r "$my_xdir" - $show "$mkdir $my_xdir" - $run $mkdir "$my_xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$my_xdir"; then - exit $status - fi - case $host in - *-darwin*) - $show "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - if test -z "$run"; then - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename $darwin_archive` - darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` - if test -n "$darwin_arches"; then - darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - $show "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - # Remove the table of contents from the thin files. - $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true - $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $AR -xo "${darwin_base_archive}" - rm "${darwin_base_archive}" - cd "$darwin_curdir" - done # $darwin_arches - ## Okay now we have a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` - lipo -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - rm -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - (cd $my_xdir && $AR x $my_xabs) || exit $? - fi # $darwin_arches - fi # $run - ;; - *) - # We will extract separately just the conflicting names and we will - # no longer touch any unique names. It is faster to leave these - # extract automatically by $AR in one run. - $show "(cd $my_xdir && $AR x $my_xabs)" - $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? - if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$my_xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} -# End of Shell function definitions -##################################### - -# Darwin sucks -eval std_shrext=\"$shrext_cmds\" - # Parse our command line options once, thoroughly. -while test "$#" -gt 0 +while test $# -gt 0 do arg="$1" shift @@ -379,34 +134,6 @@ do execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; - tag) - tagname="$arg" - preserve_args="${preserve_args}=$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac - ;; *) eval "$prev=\$arg" ;; @@ -424,27 +151,18 @@ do ;; --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2003 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit $EXIT_SUCCESS + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 ;; --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" - done - exit $EXIT_SUCCESS + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + exit 0 ;; --debug) - $echo "$progname: enabling shell trace mode" + echo "$progname: enabling shell trace mode" set -x - preserve_args="$preserve_args $arg" ;; --dry-run | -n) @@ -452,18 +170,18 @@ do ;; --features) - $echo "host: $host" + echo "host: $host" if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" + echo "enable shared libraries" else - $echo "disable shared libraries" + echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - $echo "enable static libraries" + echo "enable static libraries" else - $echo "disable static libraries" + echo "disable static libraries" fi - exit $EXIT_SUCCESS + exit 0 ;; --finish) mode="finish" ;; @@ -475,15 +193,6 @@ do --quiet | --silent) show=: - preserve_args="$preserve_args $arg" - ;; - - --tag) prevopt="--tag" prev=tag ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - preserve_args="$preserve_args --tag" ;; -dlopen) @@ -494,7 +203,7 @@ do -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; *) @@ -507,7 +216,18 @@ done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 +fi + +# Mandrake: (gc) It's bad to link C++ code with GCC, so we need to use the compiler name if provided +if test "$mode" = link && test -n "$archive_cmds" && test -x "/usr/bin/perl"; then + case $nonopt in + *cc | *++ | gcc* | *-gcc* | egcs*) + archive_cmds=`echo $archive_cmds | perl -pe 's/^\S+\s+//'` + archive_cmds="$nonopt $archive_cmds" + archive_expsym_cmds=`echo $archive_expsym_cmds | perl -pe 's/^\S+\s+//'` + archive_expsym_cmds="$nonopt $archive_expsym_cmds" + esac fi # If this variable is set in any of the actions, the command in it @@ -519,10 +239,8 @@ if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + *cc | *++ | gcc* | *-gcc* | xlc*) mode=link for arg do @@ -563,7 +281,7 @@ if test -z "$show_help"; then if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Change the help message to a mode-specific one. @@ -577,154 +295,50 @@ if test -z "$show_help"; then modename="$modename: compile" # Get the compilation command and the source file. base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes + prev= + lastarg= + srcfile="$nonopt" suppress_output= - arg_mode=normal - libobj= - later= + user_target=no for arg do - case "$arg_mode" in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. case $arg in - -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit $EXIT_FAILURE - fi - arg_mode=target - continue + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" ;; + esac - -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else base_compile="$base_compile $lastarg" - continue - ;; - - * ) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" + fi + continue ;; esac - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit $EXIT_FAILURE - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit $EXIT_FAILURE - ;; - *) - # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do + # Accept any command-line options. case $arg in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + -static) build_old_libs=yes continue @@ -739,33 +353,138 @@ if test -z "$show_help"; then pic_mode=no continue ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; esac + + case $user_target in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi done - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi - lobj=${xdir}$objdir/$objname + case $user_target in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" + removelist="$obj $libobj" else - removelist="$lobj $libobj ${libobj}T" + removelist="$libobj" fi $run $rm $removelist - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + trap "$run $rm $removelist; exit 1" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in @@ -784,9 +503,8 @@ if test -z "$show_help"; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + trap "$run $rm $removelist; exit 1" 1 2 15 else - output_obj= need_locks=no lockfile= fi @@ -794,13 +512,13 @@ if test -z "$show_help"; then # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then - until $run ln "$progpath" "$lockfile" 2>/dev/null; do + until $run ln "$0" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then - $echo "\ + echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` @@ -812,67 +530,68 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit $EXIT_FAILURE + exit 1 fi - $echo $srcfile > "$lockfile" + echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -887,13 +606,13 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit $EXIT_FAILURE + exit 1 fi # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : else error=$? $run $rm $removelist @@ -901,23 +620,48 @@ compiler." fi fi - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -959,11 +705,11 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit $EXIT_FAILURE + exit 1 fi # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + if test x"$output_obj" != x"$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else @@ -973,31 +719,29 @@ compiler." fi fi - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T < $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi fi - $run $mv "${libobj}T" "${libobj}" - # Unlock the critical section if it was locked if test "$need_locks" != no; then $run $rm "$lockfile" fi - exit $EXIT_SUCCESS + exit 0 ;; # libtool link mode @@ -1008,7 +752,7 @@ EOF # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. + # flag for every libtool invokation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying @@ -1023,7 +767,6 @@ EOF ;; esac libtool_args="$nonopt" - base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" @@ -1054,8 +797,6 @@ EOF module=no no_install=no objs= - non_pic_objects= - precious_files_regex= prefer_static_libs=no preload=no prev= @@ -1067,9 +808,6 @@ EOF temp_rpath= thread_safe=no vinfo= - vinfo_number=no - - func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg @@ -1100,7 +838,7 @@ EOF test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do + while test $# -gt 0; do arg="$1" shift case $arg in @@ -1165,7 +903,7 @@ EOF export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" - exit $EXIT_FAILURE + exit 1 fi prev= continue @@ -1175,135 +913,23 @@ EOF prev= continue ;; - inst_prefix) + inst_prefix) inst_prefix_dir="$arg" prev= continue ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; release) release="-$arg" prev= continue ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat $save_arg` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - done - else - $echo "$modename: link input file \`$save_arg' does not exist" - exit $EXIT_FAILURE - fi - arg=$save_arg - prev= - continue - ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac if test "$prev" = rpath; then @@ -1335,26 +961,13 @@ EOF finalize_command="$finalize_command $wl$qarg" continue ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac - fi # test -n "$prev" + fi # test -n $prev prevarg="$arg" @@ -1396,7 +1009,7 @@ EOF -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" - exit $EXIT_FAILURE + exit 1 fi if test "X$arg" = "X-export-symbols"; then prev=expsyms @@ -1415,7 +1028,7 @@ EOF # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) + no/*-*-irix* | no/*-*-nonstopux*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; @@ -1432,7 +1045,7 @@ EOF absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi dir="$absdir" ;; @@ -1470,61 +1083,24 @@ EOF # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs -framework System" - continue esac - elif test "X$arg" = "X-lc_r"; then - case $host in + elif test "X$arg" = "X-lc_r"; then + case $host in *-*-openbsd* | *-*-freebsd*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac fi deplibs="$deplibs $arg" continue ;; - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - deplibs="$deplibs $arg" - continue - ;; - -module) module=yes continue ;; - # gcc -m* arguments should be passed to the linker via $compiler_flags - # in order to pass architecture information to the linker - # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. - -m*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi - continue - ;; - - -shrext) - prev=shrext - continue - ;; - -no-fast-install) fast_install=no continue @@ -1549,18 +1125,8 @@ EOF continue ;; - -objectlist) - prev=objectlist - continue - ;; - -o) prev=output ;; - -precious-files-regex) - prev=precious_regex - continue - ;; - -release) prev=release continue @@ -1583,7 +1149,7 @@ EOF [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac case "$xrpath " in @@ -1611,11 +1177,6 @@ EOF prev=vinfo continue ;; - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` @@ -1664,11 +1225,6 @@ EOF continue ;; - -XCClinker) - prev=xcclinker - continue - ;; - # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need @@ -1681,102 +1237,30 @@ EOF esac ;; - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + prev= + continue else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles fi fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + fi ;; *.$libext) @@ -1826,7 +1310,7 @@ EOF if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then @@ -1835,7 +1319,6 @@ EOF finalize_command="$finalize_command $arg" fi - oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" @@ -1856,11 +1339,11 @@ EOF output_objdir="$output_objdir/$objdir" fi # Create the object directory. - if test ! -d "$output_objdir"; then + if test ! -d $output_objdir; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then + if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi @@ -1870,7 +1353,7 @@ EOF "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; @@ -1878,17 +1361,7 @@ EOF *) linkmode=prog ;; # Anything else should be a program. esac - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplications in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - esac specialdeplibs= - libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) @@ -1900,25 +1373,6 @@ EOF fi libs="$libs $deplib" done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - deplibs= newdependency_libs= newlib_search_path= @@ -1933,7 +1387,7 @@ EOF *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac done @@ -1950,59 +1404,39 @@ EOF ;; esac for pass in $passes; do - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then + if test $linkmode = prog; then + # Determine which files to process case $pass in - dlopen) libs="$dlfiles" ;; + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi for deplib in $libs; do lib= found=no case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - fi - continue - ;; -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + if test $linkmode = oldlib && test $linkmode = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 continue fi - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi done if test "$found" != yes; then # deplib doesn't seem to be a libtool library @@ -2011,76 +1445,40 @@ EOF finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" fi continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - library_names= - old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" - test "$pass" = conv && continue + test $pass = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi - if test "$pass" = scan; then + if test $pass = scan; then deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 ;; esac # linkmode continue ;; # -L -R*) - if test "$pass" = link; then + if test $pass = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in @@ -2093,45 +1491,30 @@ EOF ;; *.la) lib="$deplib" ;; *.$libext) - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - if eval $echo \"$deplib\" 2>/dev/null \ - | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - $echo - $echo "*** Warning: Trying to link with static lib archive $deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because the file extensions .$libext of this argument makes me believe" - $echo "*** that it is just a static archive that I should not used here." + if test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not used here." else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) - if test "$pass" != link; then + if test $pass != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -2142,18 +1525,14 @@ EOF esac # linkmode ;; # *.$libext *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi + if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" fi continue ;; @@ -2162,17 +1541,17 @@ EOF continue ;; esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : + if test $found = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` @@ -2185,9 +1564,8 @@ EOF library_names= old_library= # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink + # it will not redefine variable installed. installed=yes - shouldnotlink=no # Read the .la file case $lib in @@ -2197,18 +1575,19 @@ EOF if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then + { test $linkmode = oldlib && test $linkmode = obj; }; then + # Add dl[pre]opened files of deplib test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi - if test "$pass" = conv; then + if test $pass = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" @@ -2223,14 +1602,13 @@ EOF fi tmp_libs="$tmp_libs $deplib" done - elif test "$linkmode" != prog && test "$linkmode" != lib; then + elif test $linkmode != prog && test $linkmode != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit $EXIT_FAILURE + exit 1 fi continue fi # $pass = conv - # Get the name of the library we link against. linklib= for l in $old_library $library_names; do @@ -2238,23 +1616,19 @@ EOF done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # This library was specified with -dlopen. - if test "$pass" = dlopen; then + if test $pass = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" + # statically, we need to preload. + dlprefiles="$dlprefiles $lib" else newdlfiles="$newdlfiles $lib" fi @@ -2287,25 +1661,18 @@ EOF absdir="$libdir" fi else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then + if test $pass = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). @@ -2321,19 +1688,18 @@ EOF if test -z "$libdir"; then # Link the convenience library - if test "$linkmode" = lib; then + if test $linkmode = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else - deplibs="$lib $deplibs" # used for prog,scan pass + deplibs="$lib $deplibs" fi continue fi - - if test "$linkmode" = prog && test "$pass" != link; then + if test $linkmode = prog && test $pass != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" @@ -2349,7 +1715,7 @@ EOF -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then + if test $linkalldeplibs = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths @@ -2366,19 +1732,13 @@ EOF continue fi # $linkmode = prog... - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + if test "$linkmode,$pass" = "prog,link" || + { test $linkmode = lib && test $hardcode_into_libs = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. @@ -2400,6 +1760,17 @@ EOF esac ;; esac + if test $linkmode = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && @@ -2409,52 +1780,11 @@ EOF # We only need to search for static libraries continue fi - fi - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi - # This is a shared library - - # Warn about portability, can't link against -module's on - # some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then - $echo - if test "$linkmode" = prog; then - $echo "*** Warning: Linking the executable $output against the loadable module" - else - $echo "*** Warning: Linking the shared library $output against the loadable module" - fi - $echo "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname @@ -2468,7 +1798,7 @@ EOF elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin* | mingw*) + *cygwin*) major=`expr $current - $age` versuffix="-$major" ;; @@ -2480,18 +1810,17 @@ EOF # Make a new name for the extract_expsyms_cmds to use soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + soname=`echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' - cmds=$extract_expsyms_cmds + eval cmds=\"$extract_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -2502,10 +1831,9 @@ EOF if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' - cmds=$old_archive_from_expsyms_cmds + eval cmds=\"$old_archive_from_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -2514,9 +1842,9 @@ EOF # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" + fi # test -n $old_archive_from_expsyms_cmds - if test "$linkmode" = prog || test "$mode" != relink; then + if test $linkmode = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= @@ -2525,22 +1853,6 @@ EOF immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" - case $host in - *-*-sco3.2v5* ) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a module then we can not link against - # it, someone is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then - $echo "** Warning, lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $echo - $echo "** And there doesn't seem to be a static archive available" - $echo "** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - fi - esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; @@ -2559,14 +1871,6 @@ EOF add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" @@ -2580,7 +1884,7 @@ EOF if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" - exit $EXIT_FAILURE + exit 1 fi if test -n "$add_shlibpath"; then @@ -2589,7 +1893,7 @@ EOF *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi - if test "$linkmode" = prog; then + if test $linkmode = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else @@ -2606,8 +1910,9 @@ EOF fi fi - if test "$linkmode" = prog || test "$mode" = relink; then + if test $linkmode = prog || test "$mode" = relink; then add_shlibpath= + add_prefix_dir= add_dir= add= # Finalize command for both is simple: just hardcode it. @@ -2622,36 +1927,43 @@ EOF *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi add="-l$name" fi - if test "$linkmode" = prog; then + + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_prefix_dir="-L$inst_prefix_dir$libdir" + ;; + esac + fi + + # add_prefix_dir must be appended instead, otherwise it can + # possibly be overrided by any hardcoded -L/... path in deplibs + if test $linkmode = prog; then + test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir" test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else + test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir" test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi - elif test "$linkmode" = prog; then + elif test $linkmode = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + # Try to link the static library # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. @@ -2671,21 +1983,21 @@ EOF # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." + echo + echo "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -2702,11 +2014,10 @@ EOF fi fi # link shared/static library? - if test "$linkmode" = lib; then + if test $linkmode = lib; then if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then + { test $hardcode_into_libs != yes || test $build_old_libs = yes || + test $link_static = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do @@ -2737,7 +2048,7 @@ EOF tmp_libs="$tmp_libs $deplib" done - if test "$link_all_deplibs" != no; then + if test $link_all_deplibs != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in @@ -2757,67 +2068,22 @@ EOF ;; esac if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" + path="-L$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi - path="$absdir" + path="-L$absdir" fi - depdepl= - case $host in - *-*-darwin*) - # we do not want to link against static libs, - # but need to link against shared - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$path/$depdepl" ; then - depdepl="$path/$depdepl" - fi - # do not add paths which are already there - case " $newlib_search_path " in - *" $path "*) ;; - *) newlib_search_path="$newlib_search_path $path";; - esac - fi - path="" - ;; - *) - path="-L$path" - ;; - esac - ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac ;; *) continue ;; esac case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; - esac - case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac @@ -2825,15 +2091,15 @@ EOF fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then + if test $pass = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then + if test $pass != dlopen; then + test $pass != scan && dependency_libs="$newdependency_libs" + if test $pass != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do @@ -2855,30 +2121,9 @@ EOF eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) @@ -2906,32 +2151,19 @@ EOF eval $var=\"$tmp_libs\" done # for var fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi done # for pass - if test "$linkmode" = prog; then + if test $linkmode = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi @@ -2945,7 +2177,7 @@ EOF fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 fi if test -n "$release"; then @@ -2967,19 +2199,17 @@ EOF case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` @@ -2990,11 +2220,11 @@ EOF if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit $EXIT_FAILURE + exit 1 else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi @@ -3004,7 +2234,7 @@ EOF fi set dummy $rpath - if test "$#" -gt 2; then + if test $# -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" @@ -3013,16 +2243,14 @@ EOF if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. + libext=al oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then @@ -3038,82 +2266,45 @@ EOF if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$2" - number_minor="$3" - number_revision="$4" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows) - current=`expr $number_major + $number_minor` - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - current=`expr $number_major + $number_minor - 1` - age="$number_minor" - revision="$number_minor" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - esac + current="$2" + revision="$3" + age="$4" # Check that each of the things are valid numbers. case $current in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac case $revision in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac case $age in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac - if test "$age" -gt "$current"; then + if test $age -gt $current; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Calculate the version variables. @@ -3130,7 +2321,7 @@ EOF versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` - verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) @@ -3154,7 +2345,7 @@ EOF # Add in all the interfaces that we are compatible with. loop=$revision - while test "$loop" -ne 0; do + while test $loop != 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" @@ -3177,7 +2368,7 @@ EOF # Add in all the interfaces that we are compatible with. loop=$age - while test "$loop" -ne 0; do + while test $loop != 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" @@ -3201,19 +2392,20 @@ EOF *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= + verstring="0.0" case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely - verstring= + verstring="" ;; *) verstring="0.0" @@ -3247,30 +2439,9 @@ EOF fi if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$echo "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - removelist="$removelist $p" - ;; - *) ;; - esac - done - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi + # Remove our outputs. + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* fi # Now set the variables for building old libraries. @@ -3283,9 +2454,9 @@ EOF # Eliminate all temporary directories. for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then @@ -3298,7 +2469,7 @@ EOF *) finalize_rpath="$finalize_rpath $libdir" ;; esac done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + if test $hardcode_into_libs != yes || test $build_old_libs = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi @@ -3338,11 +2509,10 @@ EOF ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue ;; - *) + *) # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then + if test $build_libtool_need_lc = "yes"; then deplibs="$deplibs -lc" fi ;; @@ -3369,7 +2539,7 @@ EOF # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. + # implementing what was already the behaviour. newdeplibs=$deplibs ;; test_compile) @@ -3382,22 +2552,45 @@ EOF int main() { return 0; } EOF $rm conftest - $LTCC -o conftest conftest.c $deplibs - if test "$?" -eq 0 ; then + $CC -o conftest conftest.c $deplibs + if test $? -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do name="`expr $i : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" -ne "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + echo + echo "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which I believe you do not have" + echo "*** because a test_compile did reveal that the linker did not use it for" + echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occured in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + $rm conftest + $CC -o conftest conftest.c $i + # Did it work? + if test $? -eq 0 ; then + ldd_output=`ldd conftest` libname=`eval \\$echo \"$libname_spec\"` deplib_matches=`eval \\$echo \"$library_names_spec\"` set dummy $deplib_matches @@ -3406,64 +2599,21 @@ EOF newdeplibs="$newdeplibs $i" else droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which I believe you do not have" - $echo "*** because a test_compile did reveal that the linker did not use it for" - $echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occurred in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - $rm conftest - $LTCC -o conftest conftest.c $i - # Did it work? - if test "$?" -eq 0 ; then - ldd_output=`ldd conftest` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because a test_compile did reveal that the linker did not use this one" - $echo "*** as a dynamic dependency that programs can get resolved with at runtime." - fi + echo + echo "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because a test_compile did reveal that the linker did not use this one" + echo "*** as a dynamic dependency that programs can get resolved with at runtime." fi else droppeddeps=yes - $echo - $echo "*** Warning! Library $i is needed by this library but I was not able to" - $echo "*** make it link in! You will probably need to install it or some" - $echo "*** library that it depends on before this library will be fully" - $echo "*** functional. Installing it before continuing would be even better." + echo + echo "*** Warning! Library $i is needed by this library but I was not able to" + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." fi else newdeplibs="$newdeplibs $i" @@ -3477,20 +2627,11 @@ EOF for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then @@ -3509,29 +2650,35 @@ EOF *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done + # It is ok to link against an archive when + # building a shared library. + if $AR -t $potlib > /dev/null 2>&1; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then + | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi - done - done - fi + done + done if test -n "$a_deplib" ; then droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" + echo + echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" + echo "*** with $libname but no candidates were found. (...for file magic test)" else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a file magic. Last file checked: $potlib" fi fi else @@ -3547,43 +2694,33 @@ EOF name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval $echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check below in file_magic test + if eval echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | egrep "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi done - fi + done if test -n "$a_deplib" ; then droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" + echo + echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + echo "*** with $libname but no candidates were found. (...for regex pattern test)" else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a regex pattern. Last file checked: $potlib" fi fi else @@ -3594,23 +2731,16 @@ EOF ;; none | unknown | *) newdeplibs="" - tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` - done - fi - if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ - | grep . >/dev/null; then - $echo + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo if test "X$deplibs_check_method" = "Xnone"; then - $echo "*** Warning: inter-library dependencies are not supported in this platform." + echo "*** Warning: inter-library dependencies are not supported in this platform." else - $echo "*** Warning: inter-library dependencies are not known to be supported." + echo "*** Warning: inter-library dependencies are not known to be supported." fi - $echo "*** All declared inter-library dependencies are being dropped." + echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; @@ -3630,17 +2760,17 @@ EOF if test "$droppeddeps" = yes; then if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -3650,16 +2780,16 @@ EOF build_libtool_libs=no fi else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." - if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." + if test $allow_undefined = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -3681,7 +2811,7 @@ EOF # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then + if test $hardcode_into_libs = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= @@ -3717,11 +2847,7 @@ EOF if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi + eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. @@ -3741,7 +2867,6 @@ EOF fi # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" @@ -3752,9 +2877,7 @@ EOF else soname="$realname" fi - if test -z "$dlname"; then - dlname=$soname - fi + test -z "$dlname" && dlname=$soname lib="$output_objdir/$realname" for link @@ -3762,6 +2885,23 @@ EOF linknames="$linknames $link" done + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -3771,26 +2911,17 @@ EOF $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols - cmds=$export_symbols_cmds + eval cmds=\"$export_symbols_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false - else - # The command line is too long to execute in one step. - $show "using reloadable object file for export list..." - skipped_export=: - fi + $show "$cmd" + $run eval "$cmd" || exit $? done IFS="$save_ifs" if test -n "$export_symbols_regex"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi @@ -3801,30 +2932,46 @@ EOF $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi generated="$generated $gentop" - func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done fi fi - + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" @@ -3836,147 +2983,25 @@ EOF fi # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds + eval cmds=\"$archive_expsym_cmds\" else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise. - $echo "creating reloadable object files..." - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - delfiles= - last_robj= - k=1 - output=$output_objdir/$save_output-${k}.$objext - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - eval test_cmds=\"$reload_cmds $objlist $last_robj\" - if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; }; then - objlist="$objlist $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" - else - # All subsequent reloadable object files will link in - # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + save_deplibs="$deplibs" + for conv in $convenience; do + tmp_deplibs= + for test_deplib in $deplibs; do + if test "$test_deplib" != "$conv"; then + tmp_deplibs="$tmp_deplibs $test_deplib" fi - last_robj=$output_objdir/$save_output-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$save_output-${k}.$objext - objlist=$obj - len=1 - fi + done + deplibs="$tmp_deplibs" done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" - - if ${skipped_export-false}; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - libobjs=$output - # Append the command to create the export file. - eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" - fi - - # Set up a command to remove the reloadale object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" - done - - $echo "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~\$rm $delfiles\" + eval cmds=\"$archive_cmds\" + deplibs="$save_deplibs" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3985,7 +3010,7 @@ EOF # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - exit $EXIT_SUCCESS + exit 0 fi # Create links to the real library. @@ -4033,7 +3058,7 @@ EOF *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit $EXIT_FAILURE + exit 1 fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` @@ -4062,10 +3087,38 @@ EOF eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi generated="$generated $gentop" - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done fi fi @@ -4073,11 +3126,10 @@ EOF reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" - cmds=$reload_cmds + eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4090,7 +3142,7 @@ EOF $run ${rm}r $gentop fi - exit $EXIT_SUCCESS + exit 0 fi if test "$build_libtool_libs" != yes; then @@ -4101,24 +3153,37 @@ EOF # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" - cmds=$reload_cmds + eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then @@ -4126,12 +3191,12 @@ EOF $run ${rm}r $gentop fi - exit $EXIT_SUCCESS + exit 0 ;; prog) case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 @@ -4153,19 +3218,16 @@ EOF # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + ;; + esac ;; esac - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - if test "$tagname" = CXX ; then - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - fi - ;; - esac - compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -4316,12 +3378,12 @@ extern \"C\" { done if test -n "$exclude_expsyms"; then - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi @@ -4339,8 +3401,8 @@ extern \"C\" { for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' + name=`echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done @@ -4349,7 +3411,7 @@ extern \"C\" { test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi @@ -4369,7 +3431,7 @@ extern \"C\" { if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" + echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ @@ -4421,18 +3483,18 @@ static const void *lt_preloaded_setup() { *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; esac esac # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" @@ -4444,7 +3506,7 @@ static const void *lt_preloaded_setup() { ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac else @@ -4457,7 +3519,7 @@ static const void *lt_preloaded_setup() { finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + if test $need_relink = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" @@ -4532,7 +3594,7 @@ static const void *lt_preloaded_setup() { # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? - exit $EXIT_SUCCESS + exit 0 fi if test "$hardcode_action" = relink; then @@ -4587,10 +3649,10 @@ static const void *lt_preloaded_setup() { fi # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case $0 in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else @@ -4602,230 +3664,15 @@ static const void *lt_preloaded_setup() { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in - *cygwin*) - exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *cygwin*) exeext=.exe ;; *) exeext= ;; esac - case $host in - *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${output}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - cat > $cwrappersource <> $cwrappersource<<"EOF" -#include -#include -#include -#include -#include -#include - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -#define HAVE_DOS_BASED_FILE_SYSTEM -#ifndef DIR_SEPARATOR_2 -#define DIR_SEPARATOR_2 '\\' -#endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup ((char *) basename (argv[0])); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" -} - -void * -xmalloc (size_t num) -{ - void * p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -; -} - -char * -basename (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return (char *) base; -} - -char * -fnqualify(const char *path) -{ - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; - - assert(path != NULL); - - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); -#endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); - - /* prepend the current directory */ - /* doesn't handle '~' */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; -} - -char * -strendzap(char *str, const char *pat) -{ - size_t len, patlen; - - assert(str != NULL); - assert(pat != NULL); - - len = strlen(str); - patlen = strlen(pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp(str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char * mode, - const char * message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC -s -o $cwrapper $cwrappersource - ;; - esac $rm $output - trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + trap "$rm $output; exit 1" 1 2 15 $echo > $output "\ #! $SHELL @@ -4841,12 +3688,12 @@ EOF # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' +Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi relink_command=\"$relink_command\" @@ -4901,7 +3748,7 @@ else " if test "$fast_install" = yes; then - $echo >> $output "\ + echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" @@ -4917,7 +3764,7 @@ else $rm \"\$progdir/\$file\" fi" - $echo >> $output "\ + echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then @@ -4925,7 +3772,7 @@ else else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" - exit $EXIT_FAILURE + exit 1 fi fi @@ -4935,13 +3782,13 @@ else $rm \"\$progdir/\$file\" fi" else - $echo >> $output "\ + echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi - $echo >> $output "\ + echo >> $output "\ if test -f \"\$progdir/\$program\"; then" @@ -4952,7 +3799,7 @@ else $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed + # The second colon is a workaround for a bug in BeOS R4 ${SED} $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var @@ -4972,6 +3819,14 @@ else # Run the actual program with our arguments. " case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ @@ -4981,26 +3836,30 @@ else *) $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit $EXIT_FAILURE + exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit $EXIT_FAILURE + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 fi fi\ " chmod +x $output fi - exit $EXIT_SUCCESS + exit 0 ;; esac @@ -5016,86 +3875,74 @@ fi\ oldobjs="$libobjs_save" build_libtool_libs=no else - oldobjs="$old_deplibs $non_pic_objects" + oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi generated="$generated $gentop" - func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds + eval cmds=\"$old_archive_from_new_cmds\" else - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - for obj in $save_oldobjs - do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; then - : + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= + xdir="$xdir" fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? fi - fi + done + + eval cmds=\"$old_archive_cmds\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do - eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? @@ -5127,12 +3974,8 @@ fi\ fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - # Only create the output if not a dry run. if test -z "$run"; then @@ -5151,7 +3994,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi newdependency_libs="$newdependency_libs $libdir/$name" ;; @@ -5165,7 +4008,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi newdlfiles="$newdlfiles $libdir/$name" done @@ -5176,36 +4019,17 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles="$newdlfiles $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles="$newdlprefiles $abs" - done - dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file @@ -5234,16 +4058,13 @@ revision=$revision # Is this an already installed library? installed=$installed -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then + if test "$installed" = no && test $need_relink = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi @@ -5256,7 +4077,7 @@ relink_command=\"$relink_command\"" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac - exit $EXIT_SUCCESS + exit 0 ;; # libtool install mode @@ -5345,13 +4166,13 @@ relink_command=\"$relink_command\"" if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test -z "$files"; then @@ -5361,7 +4182,7 @@ relink_command=\"$relink_command\"" $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Strip any trailing slash from the destination. @@ -5379,10 +4200,10 @@ relink_command=\"$relink_command\"" # Not a directory, so check to see that there is only one file specified. set dummy $files - if test "$#" -gt 2; then + if test $# -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi fi case $destdir in @@ -5394,7 +4215,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac done @@ -5419,11 +4240,11 @@ relink_command=\"$relink_command\"" *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi library_names= @@ -5455,24 +4276,21 @@ relink_command=\"$relink_command\"" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 @@ -5480,7 +4298,7 @@ relink_command=\"$relink_command\"" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit $EXIT_FAILURE + continue fi fi @@ -5502,7 +4320,7 @@ relink_command=\"$relink_command\"" $run eval "$striplib $destdir/$realname" || exit $? fi - if test "$#" -gt 0; then + if test $# -gt 0; then # Delete the old symlinks, and create new ones. for linkname do @@ -5515,11 +4333,10 @@ relink_command=\"$relink_command\"" # Do each command in the postinstall commands. lib="$destdir/$realname" - cmds=$postinstall_cmds + eval cmds=\"$postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -5559,7 +4376,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac @@ -5577,7 +4394,7 @@ relink_command=\"$relink_command\"" $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi - exit $EXIT_SUCCESS + exit 0 ;; *) @@ -5589,49 +4406,29 @@ relink_command=\"$relink_command\"" destfile="$destdir/$destfile" fi - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + wrapper=`echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac # If there is no directory component, then add one. case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi finalize=yes @@ -5653,17 +4450,10 @@ relink_command=\"$relink_command\"" done relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac # If there is no directory component, then add one. case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; esac outputname= @@ -5671,17 +4461,17 @@ relink_command=\"$relink_command\"" if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - save_umask=`umask` - umask 0077 - if $mkdir "$tmpdir"; then - umask $save_umask + tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` + if test $? = 0 ; then : + else + tmpdir="$tmpdir/libtool-$$" + fi + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : else - umask $save_umask $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` @@ -5699,14 +4489,14 @@ relink_command=\"$relink_command\"" fi else # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in - */usr/bin/install*,*cygwin*) + /usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok @@ -5715,7 +4505,7 @@ relink_command=\"$relink_command\"" destfile=$destfile.exe ;; *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; @@ -5736,17 +4526,16 @@ relink_command=\"$relink_command\"" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? - if test -n "$stripme" && test -n "$old_striplib"; then + if test -n "$stripme" && test -n "$striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. - cmds=$old_postinstall_cmds + eval cmds=\"$old_postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -5760,9 +4549,9 @@ relink_command=\"$relink_command\"" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + exec_cmd='$SHELL $0 --finish$current_libdirs' else - exit $EXIT_SUCCESS + exit 0 fi ;; @@ -5781,11 +4570,10 @@ relink_command=\"$relink_command\"" for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. - cmds=$finish_cmds + eval cmds=\"$finish_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" @@ -5802,43 +4590,43 @@ relink_command=\"$relink_command\"" fi # Exit here if they wanted silent mode. - test "$show" = : && exit $EXIT_SUCCESS + test "$show" = ":" && exit 0 - $echo "----------------------------------------------------------------------" - $echo "Libraries have been installed in:" + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" for libdir in $libdirs; do - $echo " $libdir" + echo " $libdir" done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" fi if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" - $echo " - use the \`$flag' linker flag" + echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" + echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" - exit $EXIT_SUCCESS + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 ;; # libtool execute mode @@ -5850,7 +4638,7 @@ relink_command=\"$relink_command\"" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" - exit $EXIT_FAILURE + exit 1 fi # Handle -dlopen flags immediately. @@ -5858,18 +4646,18 @@ relink_command=\"$relink_command\"" if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi dir= case $file in *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Read the libtool library. @@ -5896,7 +4684,7 @@ relink_command=\"$relink_command\"" dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi ;; @@ -5936,7 +4724,7 @@ relink_command=\"$relink_command\"" -*) ;; *) # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; @@ -5959,7 +4747,7 @@ relink_command=\"$relink_command\"" eval "export $shlibpath_var" fi - # Restore saved environment variables + # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi @@ -5968,15 +4756,15 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\"\$cmd\"$args" + exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - eval \$echo \"\$cmd\"$args - exit $EXIT_SUCCESS + $echo "$cmd$args" + exit 0 fi ;; @@ -6004,25 +4792,24 @@ relink_command=\"$relink_command\"" if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi rmdirs= - origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. - objdir="$origobjdir" + objdir="$objdir" else - objdir="$dir/$origobjdir" + objdir="$dir/$objdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" + test $mode = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then + if test $mode = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; @@ -6046,7 +4833,7 @@ relink_command=\"$relink_command\"" case $name in *.la) # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. @@ -6054,19 +4841,18 @@ relink_command=\"$relink_command\"" rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - if test "$mode" = uninstall; then + if test $mode = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. - cmds=$postuninstall_cmds + eval cmds=\"$postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then + if test $? != 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -6075,14 +4861,13 @@ relink_command=\"$relink_command\"" if test -n "$old_library"; then # Do each command in the old_postuninstall commands. - cmds=$old_postuninstall_cmds + eval cmds=\"$old_postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then + if test $? != 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -6094,52 +4879,22 @@ relink_command=\"$relink_command\"" ;; *.lo) - # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - - # Read the .lo file - . $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" \ - && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" \ - && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" fi ;; *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename + # Do a test to see if this is a libtool program. + if test $mode = clean && + (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" fi fi ;; @@ -6147,7 +4902,6 @@ relink_command=\"$relink_command\"" $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done - objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -6163,20 +4917,20 @@ relink_command=\"$relink_command\"" "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd - exit $EXIT_FAILURE + exit 1 fi # We need to display help for each of the modes. @@ -6195,7 +4949,6 @@ Provide generalized library-building support services. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: @@ -6209,10 +4962,8 @@ MODE must be one of the following: uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to ." - exit $EXIT_SUCCESS +a more detailed description of MODE." + exit 0 ;; clean) @@ -6323,9 +5074,6 @@ The following components of LINK-COMMAND are treated specially: -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries @@ -6367,34 +5115,14 @@ Otherwise, only FILE itself is deleted using RM." *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac -$echo +echo $echo "Try \`$modename --help' for more information about other modes." -exit $EXIT_SUCCESS - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static +exit 0 # Local Variables: # mode:shell-script diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 70a64c05..199f2821 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -132,7 +132,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -162,7 +162,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -173,10 +172,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -188,8 +183,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -219,18 +212,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ From 28ece970414f1b8d7875213e4d220fdb062313e0 Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 25 Jan 2005 19:46:51 +0000 Subject: [PATCH 2152/2994] Add logfile.c to build BKrev: 41f6a22bNT0wqtIFbCtBzwnI5LYmkg From 0def64e9816db0be1d929b3308c64df83ca9a4e6 Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 25 Jan 2005 21:41:25 +0000 Subject: [PATCH 2153/2994] (Logical change 1.666) --- libntfs/logfile.c | 716 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 716 insertions(+) create mode 100644 libntfs/logfile.c diff --git a/libntfs/logfile.c b/libntfs/logfile.c new file mode 100644 index 00000000..125f49df --- /dev/null +++ b/libntfs/logfile.c @@ -0,0 +1,716 @@ +/* + * logfile.c - NTFS journal handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "attrib.h" +#include "debug.h" +#include "logfile.h" +#include "volume.h" +#include "mst.h" + +/** + * ntfs_check_restart_page_header - check the page header for consistency + * @rp: restart page header to check + * @pos: position in logfile at which the restart page header resides + * + * Check the restart page header @rp for consistency and return TRUE if it is + * consistent and FALSE otherwise. + * + * This function only needs NTFS_BLOCK_SIZE bytes in @rp, i.e. it does not + * require the full restart page. + */ +static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) +{ + u32 logfile_system_page_size, logfile_log_page_size; + u16 usa_count, usa_ofs, usa_end, ra_ofs; + + ntfs_debug("Entering."); + /* + * If the system or log page sizes are smaller than the ntfs block size + * or either is not a power of 2 we cannot handle this log file. + */ + logfile_system_page_size = le32_to_cpu(rp->system_page_size); + logfile_log_page_size = le32_to_cpu(rp->log_page_size); + if (logfile_system_page_size < NTFS_BLOCK_SIZE || + logfile_log_page_size < NTFS_BLOCK_SIZE || + logfile_system_page_size & + (logfile_system_page_size - 1) || + logfile_log_page_size & (logfile_log_page_size - 1)) { + ntfs_error(vi->i_sb, "$LogFile uses unsupported page size."); + return FALSE; + } + /* + * We must be either at !pos (1st restart page) or at pos = system page + * size (2nd restart page). + */ + if (pos && pos != logfile_system_page_size) { + ntfs_error(vi->i_sb, "Found restart area in incorrect " + "position in $LogFile."); + return FALSE; + } + /* We only know how to handle version 1.1. */ + if (sle16_to_cpu(rp->major_ver) != 1 || + sle16_to_cpu(rp->minor_ver) != 1) { + ntfs_error(vi->i_sb, "$LogFile version %i.%i is not " + "supported. (This driver supports version " + "1.1 only.)", (int)sle16_to_cpu(rp->major_ver), + (int)sle16_to_cpu(rp->minor_ver)); + return FALSE; + } + /* Verify the size of the update sequence array. */ + usa_count = 1 + (logfile_system_page_size >> NTFS_BLOCK_SIZE_BITS); + if (usa_count != le16_to_cpu(rp->usa_count)) { + ntfs_error(vi->i_sb, "$LogFile restart page specifies " + "inconsistent update sequence array count."); + return FALSE; + } + /* Verify the position of the update sequence array. */ + usa_ofs = le16_to_cpu(rp->usa_ofs); + usa_end = usa_ofs + usa_count * sizeof(u16); + if (usa_ofs < sizeof(RESTART_PAGE_HEADER) || + usa_end > NTFS_BLOCK_SIZE - sizeof(u16)) { + ntfs_error(vi->i_sb, "$LogFile restart page specifies " + "inconsistent update sequence array offset."); + return FALSE; + } + /* + * Verify the position of the restart area. It must be: + * - aligned to 8-byte boundary, + * - after the update sequence array, and + * - within the system page size. + */ + ra_ofs = le16_to_cpu(rp->restart_area_offset); + if (ra_ofs & 7 || ra_ofs < usa_end || + ra_ofs > logfile_system_page_size) { + ntfs_error(vi->i_sb, "$LogFile restart page specifies " + "inconsistent restart area offset."); + return FALSE; + } + /* + * Only restart pages modified by chkdsk are allowed to have chkdsk_lsn + * set. + */ + if (!ntfs_is_chkd_record(rp->magic) && sle64_to_cpu(rp->chkdsk_lsn)) { + ntfs_error(vi->i_sb, "$LogFile restart page is not modified " + "chkdsk but a chkdsk LSN is specified."); + return FALSE; + } + ntfs_debug("Done."); + return TRUE; +} + +/** + * ntfs_check_restart_area - check the restart area for consistency + * @rp: restart page whose restart area to check + * + * Check the restart area of the restart page @rp for consistency and return + * TRUE if it is consistent and FALSE otherwise. + * + * This function assumes that the restart page header has already been + * consistency checked. + * + * This function only needs NTFS_BLOCK_SIZE bytes in @rp, i.e. it does not + * require the full restart page. + */ +static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) +{ + u64 file_size; + RESTART_AREA *ra; + u16 ra_ofs, ra_len, ca_ofs; + u8 fs_bits; + + ntfs_debug("Entering."); + ra_ofs = le16_to_cpu(rp->restart_area_offset); + ra = (RESTART_AREA*)((u8*)rp + ra_ofs); + /* + * Everything before ra->file_size must be before the first word + * protected by an update sequence number. This ensures that it is + * safe to access ra->client_array_offset. + */ + if (ra_ofs + offsetof(RESTART_AREA, file_size) > + NTFS_BLOCK_SIZE - sizeof(u16)) { + ntfs_error(vi->i_sb, "$LogFile restart area specifies " + "inconsistent file offset."); + return FALSE; + } + /* + * Now that we can access ra->client_array_offset, make sure everything + * up to the log client array is before the first word protected by an + * update sequence number. This ensures we can access all of the + * restart area elements safely. Also, the client array offset must be + * aligned to an 8-byte boundary. + */ + ca_ofs = le16_to_cpu(ra->client_array_offset); + if (((ca_ofs + 7) & ~7) != ca_ofs || + ra_ofs + ca_ofs > NTFS_BLOCK_SIZE - sizeof(u16)) { + ntfs_error(vi->i_sb, "$LogFile restart area specifies " + "inconsistent client array offset."); + return FALSE; + } + /* + * The restart area must end within the system page size both when + * calculated manually and as specified by ra->restart_area_length. + * Also, the calculated length must not exceed the specified length. + */ + ra_len = ca_ofs + le16_to_cpu(ra->log_clients) * + sizeof(LOG_CLIENT_RECORD); + if (ra_ofs + ra_len > le32_to_cpu(rp->system_page_size) || + ra_ofs + le16_to_cpu(ra->restart_area_length) > + le32_to_cpu(rp->system_page_size) || + ra_len > le16_to_cpu(ra->restart_area_length)) { + ntfs_error(vi->i_sb, "$LogFile restart area is out of bounds " + "of the system page size specified by the " + "restart page header and/or the specified " + "restart area length is inconsistent."); + return FALSE; + } + /* + * The ra->client_free_list and ra->client_in_use_list must be either + * LOGFILE_NO_CLIENT or less than ra->log_clients or they are + * overflowing the client array. + */ + if ((ra->client_free_list != LOGFILE_NO_CLIENT && + le16_to_cpu(ra->client_free_list) >= + le16_to_cpu(ra->log_clients)) || + (ra->client_in_use_list != LOGFILE_NO_CLIENT && + le16_to_cpu(ra->client_in_use_list) >= + le16_to_cpu(ra->log_clients))) { + ntfs_error(vi->i_sb, "$LogFile restart area specifies " + "overflowing client free and/or in use lists."); + return FALSE; + } + /* + * Check ra->seq_number_bits against ra->file_size for consistency. + * We cannot just use ffs() because the file size is not a power of 2. + */ + file_size = (u64)sle64_to_cpu(ra->file_size); + fs_bits = 0; + while (file_size) { + file_size >>= 1; + fs_bits++; + } + if (le32_to_cpu(ra->seq_number_bits) != (u32)(67 - fs_bits)) { + ntfs_error(vi->i_sb, "$LogFile restart area specifies " + "inconsistent sequence number bits."); + return FALSE; + } + /* The log record header length must be a multiple of 8. */ + if (((le16_to_cpu(ra->log_record_header_length) + 7) & ~7) != + le16_to_cpu(ra->log_record_header_length)) { + ntfs_error(vi->i_sb, "$LogFile restart area specifies " + "inconsistent log record header length."); + return FALSE; + } + /* Dito for the log page data offset. */ + if (((le16_to_cpu(ra->log_page_data_offset) + 7) & ~7) != + le16_to_cpu(ra->log_page_data_offset)) { + ntfs_error(vi->i_sb, "$LogFile restart area specifies " + "inconsistent log page data offset."); + return FALSE; + } + ntfs_debug("Done."); + return TRUE; +} + +/** + * ntfs_check_log_client_array - check the log client array for consistency + * @rp: restart page whose log client array to check + * + * Check the log client array of the restart page @rp for consistency and + * return TRUE if it is consistent and FALSE otherwise. + * + * This function assumes that the restart page header and the restart area have + * already been consistency checked. + * + * Unlike ntfs_check_restart_page_header() and ntfs_check_restart_area(), this + * function needs @rp->system_page_size bytes in @rp, i.e. it requires the full + * restart page and the page must be multi sector transfer deprotected. + */ +static BOOL ntfs_check_log_client_array(RESTART_PAGE_HEADER *rp) +{ + RESTART_AREA *ra; + LOG_CLIENT_RECORD *ca, *cr; + u16 nr_clients, idx; + BOOL in_free_list, idx_is_first; + + ntfs_debug("Entering."); + ra = (RESTART_AREA*)((u8*)rp + le16_to_cpu(rp->restart_area_offset)); + ca = (LOG_CLIENT_RECORD*)((u8*)ra + + le16_to_cpu(ra->client_array_offset)); + /* + * Check the ra->client_free_list first and then check the + * ra->client_in_use_list. Check each of the log client records in + * each of the lists and check that the array does not overflow the + * ra->log_clients value. Also keep track of the number of records + * visited as there cannot be more than ra->log_clients records and + * that way we detect eventual loops in within a list. + */ + nr_clients = le16_to_cpu(ra->log_clients); + idx = le16_to_cpu(ra->client_free_list); + in_free_list = TRUE; +check_list: + for (idx_is_first = TRUE; idx != LOGFILE_NO_CLIENT_CPU; nr_clients--, + idx = le16_to_cpu(cr->next_client)) { + if (!nr_clients || idx >= le16_to_cpu(ra->log_clients)) + goto err_out; + /* Set @cr to the current log client record. */ + cr = ca + idx; + /* The first log client record must not have a prev_client. */ + if (idx_is_first) { + if (cr->prev_client != LOGFILE_NO_CLIENT) + goto err_out; + idx_is_first = FALSE; + } + } + /* Switch to and check the in use list if we just did the free list. */ + if (in_free_list) { + in_free_list = FALSE; + idx = le16_to_cpu(ra->client_in_use_list); + goto check_list; + } + ntfs_debug("Done."); + return TRUE; +err_out: + ntfs_error(vi->i_sb, "$LogFile log client array is corrupt."); + return FALSE; +} + +/** + * ntfs_check_and_load_restart_page - check the restart page for consistency + * @log_na: opened ntfs attribute for journal $LogFile + * @rp: restart page to check + * @pos: position in @log_na at which the restart page resides + * @wrp: copy of the multi sector transfer deprotected restart page + * + * Check the restart page @rp for consistency and return TRUE if it is + * consistent and FALSE otherwise. + * + * This function only needs NTFS_BLOCK_SIZE bytes in @rp, i.e. it does not + * require the full restart page. + * + * If @wrp is not NULL, on success, *@wrp will point to a buffer containing a + * copy of the complete multi sector transfer deprotected page. On failure, + * *@wrp is undefined. + */ +static BOOL ntfs_check_and_load_restart_page(ntfs_attr *log_na, + RESTART_PAGE_HEADER *rp, s64 pos, RESTART_PAGE_HEADER **wrp) +{ + RESTART_AREA *ra; + RESTART_PAGE_HEADER *trp; + BOOL ret; + + ntfs_debug("Entering."); + /* Check the restart page header for consistency. */ + if (!ntfs_check_restart_page_header(rp, pos)) { + /* Error output already done inside the function. */ + return FALSE; + } + /* Check the restart area for consistency. */ + if (!ntfs_check_restart_area(rp)) { + /* Error output already done inside the function. */ + return FALSE; + } + ra = (RESTART_AREA*)((u8*)rp + le16_to_cpu(rp->restart_area_offset)); + /* + * Allocate a buffer to store the whole restart page so we can multi + * sector transfer deprotect it. + */ + trp = malloc(le32_to_cpu(rp->system_page_size)); + if (!trp) { + ntfs_error(vi->i_sb, "Failed to allocate memory for $LogFile " + "restart page buffer."); + return FALSE; + } + /* + * Read the whole of the restart page into the buffer. If it fits + * completely inside @rp, just copy it from there. Otherwise read it + * from disk. + */ + if (le32_to_cpu(rp->system_page_size) <= NTFS_BLOCK_SIZE) + memcpy(trp, rp, le32_to_cpu(rp->system_page_size)); + else + if (ntfs_attr_pread(log_na, pos, le32_to_cpu( + rp->system_page_size), trp) != + le32_to_cpu(rp->system_page_size)) { + ntfs_error(, "Failed to read whole restart page into " + "the buffer."); + goto err_out; + } + /* Perform the multi sector transfer deprotection on the buffer. */ + if (ntfs_mst_post_read_fixup((NTFS_RECORD*)trp, + le32_to_cpu(rp->system_page_size))) { + ntfs_error(vi->i_sb, "Multi sector transfer error detected in " + "$LogFile restart page."); + goto err_out; + } + /* Check the log client records for consistency. */ + ret = ntfs_check_log_client_array(trp); + if (ret && wrp) + *wrp = trp; + else + free(trp); + ntfs_debug("Done."); + return ret; +err_out: + free(trp); + return FALSE; +} + +/** + * ntfs_ckeck_logfile - check in the journal if the volume is consistent + * @log_na: ntfs attribute of loaded journal $LogFile to check + * + * Check the $LogFile journal for consistency and return TRUE if it is + * consistent and FALSE if not. + * + * At present we only check the two restart pages and ignore the log record + * pages. + * + * Note that the MstProtected flag is not set on the $LogFile inode and hence + * when reading pages they are not deprotected. This is because we do not know + * if the $LogFile was created on a system with a different page size to ours + * yet and mst deprotection would fail if our page size is smaller. + */ +BOOL ntfs_check_logfile(ntfs_attr *log_na) +{ + s64 size, pos, rstr1_pos, rstr2_pos; + ntfs_volume *vol = log_na->ni->vol; + u8 *buf = NULL; + RESTART_PAGE_HEADER *rstr1_ph = NULL; + RESTART_PAGE_HEADER *rstr2_ph = NULL; + int log_page_size, log_page_mask, ofs; + BOOL logfile_is_empty = TRUE; + BOOL rstr1_found = FALSE; + BOOL rstr2_found = FALSE; + u8 log_page_bits; + + ntfs_debug("Entering."); + /* An empty $LogFile must have been clean before it got emptied. */ + if (NVolLogFileEmpty(vol)) + goto is_empty; + size = log_na->data_size; + /* Make sure the file doesn't exceed the maximum allowed size. */ + if (size > (s64)MaxLogFileSize) + size = MaxLogFileSize; + log_page_size = DefaultLogPageSize; + log_page_mask = log_page_size - 1; + /* + * Use generic_ffs() instead of ffs() to enable the compiler to + * optimize log_page_size and log_page_bits into constants. + */ + log_page_bits = ffs(log_page_size) - 1; + size &= ~(log_page_size - 1); + + /* + * Ensure the log file is big enough to store at least the two restart + * pages and the minimum number of log record pages. + */ + if (size < log_page_size * 2 || (size - log_page_size * 2) >> + log_page_bits < MinLogRecordPages) { + ntfs_error(vol->sb, "$LogFile is too small."); + return FALSE; + } + /* Allocate memory for restart page. */ + buf = malloc(NTFS_BLOCK_SIZE); + if (!buf) { + ntfs_error(, "Not enough memory."); + return FALSE; + } + /* + * Read through the file looking for a restart page. Since the restart + * page header is at the beginning of a page we only need to search at + * what could be the beginning of a page (for each page size) rather + * than scanning the whole file byte by byte. If all potential places + * contain empty and uninitialzed records, the log file can be assumed + * to be empty. + */ + for (pos = 0; pos < size; pos <<= 1) { + /* + * Read first NTFS_BLOCK_SIZE bytes of potential restart page. + */ + if (ntfs_attr_pread(log_na, pos, NTFS_BLOCK_SIZE, buf) != + NTFS_BLOCK_SIZE) { + ntfs_error(, "Failed to read first NTFS_BLOCK_SIZE " + "bytes of potential restart page."); + goto err_out; + } + + /* + * A non-empty block means the logfile is not empty while an + * empty block after a non-empty block has been encountered + * means we are done. + */ + if (!ntfs_is_empty_recordp((le32*)buf)) + logfile_is_empty = FALSE; + else if (!logfile_is_empty) + break; + /* + * A log record page means there cannot be a restart page after + * this so no need to continue searching. + */ + if (ntfs_is_rcrd_recordp((le32*)buf)) + break; + /* + * A modified by chkdsk restart page means we cannot handle + * this log file. + */ + if (ntfs_is_chkd_recordp((le32*)buf)) { + ntfs_error(vol->sb, "$LogFile has been modified by " + "chkdsk. Mount this volume in " + "Windows."); + goto err_out; + } + /* If not a restart page, continue. */ + if (!ntfs_is_rstr_recordp((le32*)buf)) { + /* Skip to the minimum page size for the next one. */ + if (!pos) + pos = NTFS_BLOCK_SIZE >> 1; + continue; + } + /* We now know we have a restart page. */ + if (!pos) { + rstr1_found = TRUE; + rstr1_pos = pos; + } else { + if (rstr2_found) { + ntfs_error(vol->sb, "Found more than two " + "restart pages in $LogFile."); + goto err_out; + } + rstr2_found = TRUE; + rstr2_pos = pos; + } + /* + * Check the restart page for consistency and get a copy of the + * complete multi sector transfer deprotected restart page. + */ + if (!ntfs_check_and_load_restart_page(log_na, + (RESTART_PAGE_HEADER*)buf, pos, + !pos ? &rstr1_ph : &rstr2_ph)) { + /* Error output already done inside the function. */ + goto err_out; + } + /* + * We have a valid restart page. The next one must be after + * a whole system page size as specified by the valid restart + * page. + */ + if (!pos) + pos = le32_to_cpu(rstr1_ph->system_page_size) >> 1; + } + if (buf) { + free(buf); + buf = NULL; + } + if (logfile_is_empty) { + NVolSetLogFileEmpty(vol); +is_empty: + ntfs_debug("Done. ($LogFile is empty.)"); + return TRUE; + } + if (!rstr1_found || !rstr2_found) { + ntfs_error(vol->sb, "Did not find two restart pages in " + "$LogFile."); + goto err_out; + } + /* + * The two restart areas must be identical except for the update + * sequence number. + */ + ofs = le16_to_cpu(rstr1_ph->usa_ofs); + if (memcmp(rstr1_ph, rstr2_ph, ofs) || (ofs += sizeof(u16), + memcmp((u8*)rstr1_ph + ofs, (u8*)rstr2_ph + ofs, + le32_to_cpu(rstr1_ph->system_page_size) - ofs))) { + ntfs_error(vol->sb, "The two restart pages in $LogFile do not " + "match."); + goto err_out; + } + free(rstr1_ph); + free(rstr2_ph); + /* All consistency checks passed. */ + ntfs_debug("Done."); + return TRUE; +err_out: + if (buf) + free(buf); + if (rstr1_ph) + free(rstr1_ph); + if (rstr2_ph) + free(rstr2_ph); + return FALSE; +} + +/** + * ntfs_is_logfile_clean - check in the journal if the volume is clean + * @log_na: ntfs attribute of loaded journal $LogFile to check + * + * Analyze the $LogFile journal and return TRUE if it indicates the volume was + * shutdown cleanly and FALSE if not. + * + * At present we only look at the two restart pages and ignore the log record + * pages. This is a little bit crude in that there will be a very small number + * of cases where we think that a volume is dirty when in fact it is clean. + * This should only affect volumes that have not been shutdown cleanly but did + * not have any pending, non-check-pointed i/o, i.e. they were completely idle + * at least for the five seconds preceeding the unclean shutdown. + * + * This function assumes that the $LogFile journal has already been consistency + * checked by a call to ntfs_check_logfile() and in particular if the $LogFile + * is empty this function requires that NVolLogFileEmpty() is true otherwise an + * empty volume will be reported as dirty. + */ +BOOL ntfs_is_logfile_clean(ntfs_attr *log_na) +{ + RESTART_PAGE_HEADER *rp; + RESTART_AREA *ra; + + ntfs_debug("Entering."); + /* An empty $LogFile must have been clean before it got emptied. */ + if (NVolLogFileEmpty(log_na->ni->vol)) { + ntfs_debug("Done. ($LogFile is empty.)"); + return TRUE; + } + /* Allocate memory. */ + rp = malloc(NTFS_BLOCK_SIZE); + if (!rp) { + ntfs_error(, "Not enough memory."); + return FALSE; + } + /* + * Read the first restart page. It will be possibly incomplete and + * will not be multi sector transfer deprotected but we only need the + * first NTFS_BLOCK_SIZE bytes so it does not matter. + */ + if (ntfs_attr_pread(log_na, 0, NTFS_BLOCK_SIZE, rp) != + NTFS_BLOCK_SIZE) { + ntfs_error(, "Failed to read first restart page."); + goto err_out; + } + if (!ntfs_is_rstr_record(rp->magic)) { + ntfs_error(vol->sb, "No restart page found at offset zero in " + "$LogFile. This is probably a bug in that " + "the $LogFile should have been consistency " + "checked before calling this function."); + goto err_out; + } + ra = (RESTART_AREA*)((u8*)rp + le16_to_cpu(rp->restart_area_offset)); + /* + * If the $LogFile has active clients, i.e. it is open, and we do not + * have the RESTART_VOLUME_IS_CLEAN bit set in the restart area flags, + * we assume there was an unclean shutdown. + */ + if (ra->client_in_use_list != LOGFILE_NO_CLIENT && + !(ra->flags & RESTART_VOLUME_IS_CLEAN)) { + ntfs_debug("Done. $LogFile indicates a dirty shutdown."); + goto err_out; + } + free(rp); + /* $LogFile indicates a clean shutdown. */ + ntfs_debug("Done. $LogFile indicates a clean shutdown."); + return TRUE; +err_out: + free(rp); + return FALSE; +} + +/** + * ntfs_empty_logfile - empty the contents of the $LogFile journal + * @na: ntfs attribute of journal $LogFile to empty + * + * Empty the contents of the $LogFile journal @na and return 0 on success and + * -1 on error. + * + * This function assumes that the $LogFile journal has already been consistency + * checked by a call to ntfs_check_logfile() and that ntfs_is_logfile_clean() + * has been used to ensure that the $LogFile is clean. + */ +int ntfs_empty_logfile(ntfs_attr *na) +{ + s64 len, pos, count; + char buf[NTFS_BUF_SIZE]; + int err; + + ntfs_debug("Entering."); + if (NVolLogFileEmpty(na->ni->vol)) + goto done; + + /* The $DATA attribute of the $LogFile has to be non-resident. */ + if (!NAttrNonResident(na)) { + err = EIO; + Dprintf("$LogFile $DATA attribute is resident!?!\n"); + goto io_error_exit; + } + + /* Get length of $LogFile contents. */ + len = na->data_size; + if (!len) { + Dprintf("$LogFile has zero length, no disk write needed.\n"); + return 0; + } + + /* Read $LogFile until its end. We do this as a check for correct + length thus making sure we are decompressing the mapping pairs + array correctly and hence writing below is safe as well. */ + pos = 0; + while ((count = ntfs_attr_pread(na, pos, NTFS_BUF_SIZE, buf)) > 0) + pos += count; + + if (count == -1 || pos != len) { + err = errno; + Dprintf("Amount of $LogFile data read does not " + "correspond to expected length!"); + if (count != -1) + err = EIO; + goto io_error_exit; + } + + /* Fill the buffer with 0xff's. */ + memset(buf, -1, NTFS_BUF_SIZE); + + /* Set the $DATA attribute. */ + pos = 0; + while ((count = len - pos) > 0) { + if (count > NTFS_BUF_SIZE) + count = NTFS_BUF_SIZE; + + if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { + err = errno; + Dprintf("Failed to set the $LogFile attribute value."); + if (count != -1) + err = EIO; + goto io_error_exit; + } + pos += count; + } + + /* Set the flag so we do not have to do it again on remount. */ + NVolSetLogFileEmpty(na->ni->vol); +done: + ntfs_debug("Done."); + return 0; +io_error_exit: + ntfs_attr_close(na); + ntfs_inode_close(na->ni); + errno = err; + return -1; +} From ce10af07a3d4e5321fa230b7972aac7dc688bc8c Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 25 Jan 2005 21:41:25 +0000 Subject: [PATCH 2154/2994] Add LogFileEmpty to volume flags. (Logical change 1.666) --- include/ntfs/volume.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 23f57bec..da395e27 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -70,6 +70,7 @@ extern int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags); typedef enum { NV_ReadOnly, /* 1: Volume is read-only. */ NV_CaseSensitive, /* 1: Volume is mounted case-sensitive. */ + NV_LogFileEmpty, /* 1: $logFile journal is empty. */ } ntfs_volume_state_bits; #define test_nvol_flag(nv, flag) test_bit(NV_##flag, (nv)->state) @@ -84,6 +85,10 @@ typedef enum { #define NVolSetCaseSensitive(nv) set_nvol_flag(nv, CaseSensitive) #define NVolClearCaseSensitive(nv) clear_nvol_flag(nv, CaseSensitive) +#define NVolLogFileEmpty(nv) test_nvol_flag(nv, LogFileEmpty) +#define NVolSetLogFileEmpty(nv) set_nvol_flag(nv, LogFileEmpty) +#define NVolClearLogFileEmpty(nv) clear_nvol_flag(nv, LogFileEmpty) + /* * NTFS version 1.1 and 1.2 are used by Windows NT4. * NTFS version 2.x is used by Windows 2000 Beta From 3b95cca52c5d9ed5a931127de11b054ca57444c8 Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 25 Jan 2005 21:41:25 +0000 Subject: [PATCH 2155/2994] Export functions from logfile.c. (Logical change 1.666) --- include/ntfs/logfile.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index 8ecf18e9..9282c6fb 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -376,5 +376,8 @@ typedef struct { } __attribute__((__packed__)) lcn_list[0]; } __attribute__ ((__packed__)) LOG_RECORD; -#endif /* defined _NTFS_LOGFILE_H */ +extern BOOL ntfs_check_logfile(ntfs_attr *log_na); +extern BOOL ntfs_is_logfile_clean(ntfs_attr *log_na); +extern int ntfs_empty_logfile(ntfs_attr *na); +#endif /* defined _NTFS_LOGFILE_H */ From e2ed469c8905063b3ec82e01059cc7118be18992 Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 25 Jan 2005 21:41:25 +0000 Subject: [PATCH 2156/2994] Initial revision --- libntfs/logfile.c | 716 ---------------------------------------------- 1 file changed, 716 deletions(-) diff --git a/libntfs/logfile.c b/libntfs/logfile.c index 125f49df..e69de29b 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -1,716 +0,0 @@ -/* - * logfile.c - NTFS journal handling. Part of the Linux-NTFS project. - * - * Copyright (c) 2002-2004 Anton Altaparmakov - * Copyright (c) 2005 Yura Pakhuchiy - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "attrib.h" -#include "debug.h" -#include "logfile.h" -#include "volume.h" -#include "mst.h" - -/** - * ntfs_check_restart_page_header - check the page header for consistency - * @rp: restart page header to check - * @pos: position in logfile at which the restart page header resides - * - * Check the restart page header @rp for consistency and return TRUE if it is - * consistent and FALSE otherwise. - * - * This function only needs NTFS_BLOCK_SIZE bytes in @rp, i.e. it does not - * require the full restart page. - */ -static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) -{ - u32 logfile_system_page_size, logfile_log_page_size; - u16 usa_count, usa_ofs, usa_end, ra_ofs; - - ntfs_debug("Entering."); - /* - * If the system or log page sizes are smaller than the ntfs block size - * or either is not a power of 2 we cannot handle this log file. - */ - logfile_system_page_size = le32_to_cpu(rp->system_page_size); - logfile_log_page_size = le32_to_cpu(rp->log_page_size); - if (logfile_system_page_size < NTFS_BLOCK_SIZE || - logfile_log_page_size < NTFS_BLOCK_SIZE || - logfile_system_page_size & - (logfile_system_page_size - 1) || - logfile_log_page_size & (logfile_log_page_size - 1)) { - ntfs_error(vi->i_sb, "$LogFile uses unsupported page size."); - return FALSE; - } - /* - * We must be either at !pos (1st restart page) or at pos = system page - * size (2nd restart page). - */ - if (pos && pos != logfile_system_page_size) { - ntfs_error(vi->i_sb, "Found restart area in incorrect " - "position in $LogFile."); - return FALSE; - } - /* We only know how to handle version 1.1. */ - if (sle16_to_cpu(rp->major_ver) != 1 || - sle16_to_cpu(rp->minor_ver) != 1) { - ntfs_error(vi->i_sb, "$LogFile version %i.%i is not " - "supported. (This driver supports version " - "1.1 only.)", (int)sle16_to_cpu(rp->major_ver), - (int)sle16_to_cpu(rp->minor_ver)); - return FALSE; - } - /* Verify the size of the update sequence array. */ - usa_count = 1 + (logfile_system_page_size >> NTFS_BLOCK_SIZE_BITS); - if (usa_count != le16_to_cpu(rp->usa_count)) { - ntfs_error(vi->i_sb, "$LogFile restart page specifies " - "inconsistent update sequence array count."); - return FALSE; - } - /* Verify the position of the update sequence array. */ - usa_ofs = le16_to_cpu(rp->usa_ofs); - usa_end = usa_ofs + usa_count * sizeof(u16); - if (usa_ofs < sizeof(RESTART_PAGE_HEADER) || - usa_end > NTFS_BLOCK_SIZE - sizeof(u16)) { - ntfs_error(vi->i_sb, "$LogFile restart page specifies " - "inconsistent update sequence array offset."); - return FALSE; - } - /* - * Verify the position of the restart area. It must be: - * - aligned to 8-byte boundary, - * - after the update sequence array, and - * - within the system page size. - */ - ra_ofs = le16_to_cpu(rp->restart_area_offset); - if (ra_ofs & 7 || ra_ofs < usa_end || - ra_ofs > logfile_system_page_size) { - ntfs_error(vi->i_sb, "$LogFile restart page specifies " - "inconsistent restart area offset."); - return FALSE; - } - /* - * Only restart pages modified by chkdsk are allowed to have chkdsk_lsn - * set. - */ - if (!ntfs_is_chkd_record(rp->magic) && sle64_to_cpu(rp->chkdsk_lsn)) { - ntfs_error(vi->i_sb, "$LogFile restart page is not modified " - "chkdsk but a chkdsk LSN is specified."); - return FALSE; - } - ntfs_debug("Done."); - return TRUE; -} - -/** - * ntfs_check_restart_area - check the restart area for consistency - * @rp: restart page whose restart area to check - * - * Check the restart area of the restart page @rp for consistency and return - * TRUE if it is consistent and FALSE otherwise. - * - * This function assumes that the restart page header has already been - * consistency checked. - * - * This function only needs NTFS_BLOCK_SIZE bytes in @rp, i.e. it does not - * require the full restart page. - */ -static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) -{ - u64 file_size; - RESTART_AREA *ra; - u16 ra_ofs, ra_len, ca_ofs; - u8 fs_bits; - - ntfs_debug("Entering."); - ra_ofs = le16_to_cpu(rp->restart_area_offset); - ra = (RESTART_AREA*)((u8*)rp + ra_ofs); - /* - * Everything before ra->file_size must be before the first word - * protected by an update sequence number. This ensures that it is - * safe to access ra->client_array_offset. - */ - if (ra_ofs + offsetof(RESTART_AREA, file_size) > - NTFS_BLOCK_SIZE - sizeof(u16)) { - ntfs_error(vi->i_sb, "$LogFile restart area specifies " - "inconsistent file offset."); - return FALSE; - } - /* - * Now that we can access ra->client_array_offset, make sure everything - * up to the log client array is before the first word protected by an - * update sequence number. This ensures we can access all of the - * restart area elements safely. Also, the client array offset must be - * aligned to an 8-byte boundary. - */ - ca_ofs = le16_to_cpu(ra->client_array_offset); - if (((ca_ofs + 7) & ~7) != ca_ofs || - ra_ofs + ca_ofs > NTFS_BLOCK_SIZE - sizeof(u16)) { - ntfs_error(vi->i_sb, "$LogFile restart area specifies " - "inconsistent client array offset."); - return FALSE; - } - /* - * The restart area must end within the system page size both when - * calculated manually and as specified by ra->restart_area_length. - * Also, the calculated length must not exceed the specified length. - */ - ra_len = ca_ofs + le16_to_cpu(ra->log_clients) * - sizeof(LOG_CLIENT_RECORD); - if (ra_ofs + ra_len > le32_to_cpu(rp->system_page_size) || - ra_ofs + le16_to_cpu(ra->restart_area_length) > - le32_to_cpu(rp->system_page_size) || - ra_len > le16_to_cpu(ra->restart_area_length)) { - ntfs_error(vi->i_sb, "$LogFile restart area is out of bounds " - "of the system page size specified by the " - "restart page header and/or the specified " - "restart area length is inconsistent."); - return FALSE; - } - /* - * The ra->client_free_list and ra->client_in_use_list must be either - * LOGFILE_NO_CLIENT or less than ra->log_clients or they are - * overflowing the client array. - */ - if ((ra->client_free_list != LOGFILE_NO_CLIENT && - le16_to_cpu(ra->client_free_list) >= - le16_to_cpu(ra->log_clients)) || - (ra->client_in_use_list != LOGFILE_NO_CLIENT && - le16_to_cpu(ra->client_in_use_list) >= - le16_to_cpu(ra->log_clients))) { - ntfs_error(vi->i_sb, "$LogFile restart area specifies " - "overflowing client free and/or in use lists."); - return FALSE; - } - /* - * Check ra->seq_number_bits against ra->file_size for consistency. - * We cannot just use ffs() because the file size is not a power of 2. - */ - file_size = (u64)sle64_to_cpu(ra->file_size); - fs_bits = 0; - while (file_size) { - file_size >>= 1; - fs_bits++; - } - if (le32_to_cpu(ra->seq_number_bits) != (u32)(67 - fs_bits)) { - ntfs_error(vi->i_sb, "$LogFile restart area specifies " - "inconsistent sequence number bits."); - return FALSE; - } - /* The log record header length must be a multiple of 8. */ - if (((le16_to_cpu(ra->log_record_header_length) + 7) & ~7) != - le16_to_cpu(ra->log_record_header_length)) { - ntfs_error(vi->i_sb, "$LogFile restart area specifies " - "inconsistent log record header length."); - return FALSE; - } - /* Dito for the log page data offset. */ - if (((le16_to_cpu(ra->log_page_data_offset) + 7) & ~7) != - le16_to_cpu(ra->log_page_data_offset)) { - ntfs_error(vi->i_sb, "$LogFile restart area specifies " - "inconsistent log page data offset."); - return FALSE; - } - ntfs_debug("Done."); - return TRUE; -} - -/** - * ntfs_check_log_client_array - check the log client array for consistency - * @rp: restart page whose log client array to check - * - * Check the log client array of the restart page @rp for consistency and - * return TRUE if it is consistent and FALSE otherwise. - * - * This function assumes that the restart page header and the restart area have - * already been consistency checked. - * - * Unlike ntfs_check_restart_page_header() and ntfs_check_restart_area(), this - * function needs @rp->system_page_size bytes in @rp, i.e. it requires the full - * restart page and the page must be multi sector transfer deprotected. - */ -static BOOL ntfs_check_log_client_array(RESTART_PAGE_HEADER *rp) -{ - RESTART_AREA *ra; - LOG_CLIENT_RECORD *ca, *cr; - u16 nr_clients, idx; - BOOL in_free_list, idx_is_first; - - ntfs_debug("Entering."); - ra = (RESTART_AREA*)((u8*)rp + le16_to_cpu(rp->restart_area_offset)); - ca = (LOG_CLIENT_RECORD*)((u8*)ra + - le16_to_cpu(ra->client_array_offset)); - /* - * Check the ra->client_free_list first and then check the - * ra->client_in_use_list. Check each of the log client records in - * each of the lists and check that the array does not overflow the - * ra->log_clients value. Also keep track of the number of records - * visited as there cannot be more than ra->log_clients records and - * that way we detect eventual loops in within a list. - */ - nr_clients = le16_to_cpu(ra->log_clients); - idx = le16_to_cpu(ra->client_free_list); - in_free_list = TRUE; -check_list: - for (idx_is_first = TRUE; idx != LOGFILE_NO_CLIENT_CPU; nr_clients--, - idx = le16_to_cpu(cr->next_client)) { - if (!nr_clients || idx >= le16_to_cpu(ra->log_clients)) - goto err_out; - /* Set @cr to the current log client record. */ - cr = ca + idx; - /* The first log client record must not have a prev_client. */ - if (idx_is_first) { - if (cr->prev_client != LOGFILE_NO_CLIENT) - goto err_out; - idx_is_first = FALSE; - } - } - /* Switch to and check the in use list if we just did the free list. */ - if (in_free_list) { - in_free_list = FALSE; - idx = le16_to_cpu(ra->client_in_use_list); - goto check_list; - } - ntfs_debug("Done."); - return TRUE; -err_out: - ntfs_error(vi->i_sb, "$LogFile log client array is corrupt."); - return FALSE; -} - -/** - * ntfs_check_and_load_restart_page - check the restart page for consistency - * @log_na: opened ntfs attribute for journal $LogFile - * @rp: restart page to check - * @pos: position in @log_na at which the restart page resides - * @wrp: copy of the multi sector transfer deprotected restart page - * - * Check the restart page @rp for consistency and return TRUE if it is - * consistent and FALSE otherwise. - * - * This function only needs NTFS_BLOCK_SIZE bytes in @rp, i.e. it does not - * require the full restart page. - * - * If @wrp is not NULL, on success, *@wrp will point to a buffer containing a - * copy of the complete multi sector transfer deprotected page. On failure, - * *@wrp is undefined. - */ -static BOOL ntfs_check_and_load_restart_page(ntfs_attr *log_na, - RESTART_PAGE_HEADER *rp, s64 pos, RESTART_PAGE_HEADER **wrp) -{ - RESTART_AREA *ra; - RESTART_PAGE_HEADER *trp; - BOOL ret; - - ntfs_debug("Entering."); - /* Check the restart page header for consistency. */ - if (!ntfs_check_restart_page_header(rp, pos)) { - /* Error output already done inside the function. */ - return FALSE; - } - /* Check the restart area for consistency. */ - if (!ntfs_check_restart_area(rp)) { - /* Error output already done inside the function. */ - return FALSE; - } - ra = (RESTART_AREA*)((u8*)rp + le16_to_cpu(rp->restart_area_offset)); - /* - * Allocate a buffer to store the whole restart page so we can multi - * sector transfer deprotect it. - */ - trp = malloc(le32_to_cpu(rp->system_page_size)); - if (!trp) { - ntfs_error(vi->i_sb, "Failed to allocate memory for $LogFile " - "restart page buffer."); - return FALSE; - } - /* - * Read the whole of the restart page into the buffer. If it fits - * completely inside @rp, just copy it from there. Otherwise read it - * from disk. - */ - if (le32_to_cpu(rp->system_page_size) <= NTFS_BLOCK_SIZE) - memcpy(trp, rp, le32_to_cpu(rp->system_page_size)); - else - if (ntfs_attr_pread(log_na, pos, le32_to_cpu( - rp->system_page_size), trp) != - le32_to_cpu(rp->system_page_size)) { - ntfs_error(, "Failed to read whole restart page into " - "the buffer."); - goto err_out; - } - /* Perform the multi sector transfer deprotection on the buffer. */ - if (ntfs_mst_post_read_fixup((NTFS_RECORD*)trp, - le32_to_cpu(rp->system_page_size))) { - ntfs_error(vi->i_sb, "Multi sector transfer error detected in " - "$LogFile restart page."); - goto err_out; - } - /* Check the log client records for consistency. */ - ret = ntfs_check_log_client_array(trp); - if (ret && wrp) - *wrp = trp; - else - free(trp); - ntfs_debug("Done."); - return ret; -err_out: - free(trp); - return FALSE; -} - -/** - * ntfs_ckeck_logfile - check in the journal if the volume is consistent - * @log_na: ntfs attribute of loaded journal $LogFile to check - * - * Check the $LogFile journal for consistency and return TRUE if it is - * consistent and FALSE if not. - * - * At present we only check the two restart pages and ignore the log record - * pages. - * - * Note that the MstProtected flag is not set on the $LogFile inode and hence - * when reading pages they are not deprotected. This is because we do not know - * if the $LogFile was created on a system with a different page size to ours - * yet and mst deprotection would fail if our page size is smaller. - */ -BOOL ntfs_check_logfile(ntfs_attr *log_na) -{ - s64 size, pos, rstr1_pos, rstr2_pos; - ntfs_volume *vol = log_na->ni->vol; - u8 *buf = NULL; - RESTART_PAGE_HEADER *rstr1_ph = NULL; - RESTART_PAGE_HEADER *rstr2_ph = NULL; - int log_page_size, log_page_mask, ofs; - BOOL logfile_is_empty = TRUE; - BOOL rstr1_found = FALSE; - BOOL rstr2_found = FALSE; - u8 log_page_bits; - - ntfs_debug("Entering."); - /* An empty $LogFile must have been clean before it got emptied. */ - if (NVolLogFileEmpty(vol)) - goto is_empty; - size = log_na->data_size; - /* Make sure the file doesn't exceed the maximum allowed size. */ - if (size > (s64)MaxLogFileSize) - size = MaxLogFileSize; - log_page_size = DefaultLogPageSize; - log_page_mask = log_page_size - 1; - /* - * Use generic_ffs() instead of ffs() to enable the compiler to - * optimize log_page_size and log_page_bits into constants. - */ - log_page_bits = ffs(log_page_size) - 1; - size &= ~(log_page_size - 1); - - /* - * Ensure the log file is big enough to store at least the two restart - * pages and the minimum number of log record pages. - */ - if (size < log_page_size * 2 || (size - log_page_size * 2) >> - log_page_bits < MinLogRecordPages) { - ntfs_error(vol->sb, "$LogFile is too small."); - return FALSE; - } - /* Allocate memory for restart page. */ - buf = malloc(NTFS_BLOCK_SIZE); - if (!buf) { - ntfs_error(, "Not enough memory."); - return FALSE; - } - /* - * Read through the file looking for a restart page. Since the restart - * page header is at the beginning of a page we only need to search at - * what could be the beginning of a page (for each page size) rather - * than scanning the whole file byte by byte. If all potential places - * contain empty and uninitialzed records, the log file can be assumed - * to be empty. - */ - for (pos = 0; pos < size; pos <<= 1) { - /* - * Read first NTFS_BLOCK_SIZE bytes of potential restart page. - */ - if (ntfs_attr_pread(log_na, pos, NTFS_BLOCK_SIZE, buf) != - NTFS_BLOCK_SIZE) { - ntfs_error(, "Failed to read first NTFS_BLOCK_SIZE " - "bytes of potential restart page."); - goto err_out; - } - - /* - * A non-empty block means the logfile is not empty while an - * empty block after a non-empty block has been encountered - * means we are done. - */ - if (!ntfs_is_empty_recordp((le32*)buf)) - logfile_is_empty = FALSE; - else if (!logfile_is_empty) - break; - /* - * A log record page means there cannot be a restart page after - * this so no need to continue searching. - */ - if (ntfs_is_rcrd_recordp((le32*)buf)) - break; - /* - * A modified by chkdsk restart page means we cannot handle - * this log file. - */ - if (ntfs_is_chkd_recordp((le32*)buf)) { - ntfs_error(vol->sb, "$LogFile has been modified by " - "chkdsk. Mount this volume in " - "Windows."); - goto err_out; - } - /* If not a restart page, continue. */ - if (!ntfs_is_rstr_recordp((le32*)buf)) { - /* Skip to the minimum page size for the next one. */ - if (!pos) - pos = NTFS_BLOCK_SIZE >> 1; - continue; - } - /* We now know we have a restart page. */ - if (!pos) { - rstr1_found = TRUE; - rstr1_pos = pos; - } else { - if (rstr2_found) { - ntfs_error(vol->sb, "Found more than two " - "restart pages in $LogFile."); - goto err_out; - } - rstr2_found = TRUE; - rstr2_pos = pos; - } - /* - * Check the restart page for consistency and get a copy of the - * complete multi sector transfer deprotected restart page. - */ - if (!ntfs_check_and_load_restart_page(log_na, - (RESTART_PAGE_HEADER*)buf, pos, - !pos ? &rstr1_ph : &rstr2_ph)) { - /* Error output already done inside the function. */ - goto err_out; - } - /* - * We have a valid restart page. The next one must be after - * a whole system page size as specified by the valid restart - * page. - */ - if (!pos) - pos = le32_to_cpu(rstr1_ph->system_page_size) >> 1; - } - if (buf) { - free(buf); - buf = NULL; - } - if (logfile_is_empty) { - NVolSetLogFileEmpty(vol); -is_empty: - ntfs_debug("Done. ($LogFile is empty.)"); - return TRUE; - } - if (!rstr1_found || !rstr2_found) { - ntfs_error(vol->sb, "Did not find two restart pages in " - "$LogFile."); - goto err_out; - } - /* - * The two restart areas must be identical except for the update - * sequence number. - */ - ofs = le16_to_cpu(rstr1_ph->usa_ofs); - if (memcmp(rstr1_ph, rstr2_ph, ofs) || (ofs += sizeof(u16), - memcmp((u8*)rstr1_ph + ofs, (u8*)rstr2_ph + ofs, - le32_to_cpu(rstr1_ph->system_page_size) - ofs))) { - ntfs_error(vol->sb, "The two restart pages in $LogFile do not " - "match."); - goto err_out; - } - free(rstr1_ph); - free(rstr2_ph); - /* All consistency checks passed. */ - ntfs_debug("Done."); - return TRUE; -err_out: - if (buf) - free(buf); - if (rstr1_ph) - free(rstr1_ph); - if (rstr2_ph) - free(rstr2_ph); - return FALSE; -} - -/** - * ntfs_is_logfile_clean - check in the journal if the volume is clean - * @log_na: ntfs attribute of loaded journal $LogFile to check - * - * Analyze the $LogFile journal and return TRUE if it indicates the volume was - * shutdown cleanly and FALSE if not. - * - * At present we only look at the two restart pages and ignore the log record - * pages. This is a little bit crude in that there will be a very small number - * of cases where we think that a volume is dirty when in fact it is clean. - * This should only affect volumes that have not been shutdown cleanly but did - * not have any pending, non-check-pointed i/o, i.e. they were completely idle - * at least for the five seconds preceeding the unclean shutdown. - * - * This function assumes that the $LogFile journal has already been consistency - * checked by a call to ntfs_check_logfile() and in particular if the $LogFile - * is empty this function requires that NVolLogFileEmpty() is true otherwise an - * empty volume will be reported as dirty. - */ -BOOL ntfs_is_logfile_clean(ntfs_attr *log_na) -{ - RESTART_PAGE_HEADER *rp; - RESTART_AREA *ra; - - ntfs_debug("Entering."); - /* An empty $LogFile must have been clean before it got emptied. */ - if (NVolLogFileEmpty(log_na->ni->vol)) { - ntfs_debug("Done. ($LogFile is empty.)"); - return TRUE; - } - /* Allocate memory. */ - rp = malloc(NTFS_BLOCK_SIZE); - if (!rp) { - ntfs_error(, "Not enough memory."); - return FALSE; - } - /* - * Read the first restart page. It will be possibly incomplete and - * will not be multi sector transfer deprotected but we only need the - * first NTFS_BLOCK_SIZE bytes so it does not matter. - */ - if (ntfs_attr_pread(log_na, 0, NTFS_BLOCK_SIZE, rp) != - NTFS_BLOCK_SIZE) { - ntfs_error(, "Failed to read first restart page."); - goto err_out; - } - if (!ntfs_is_rstr_record(rp->magic)) { - ntfs_error(vol->sb, "No restart page found at offset zero in " - "$LogFile. This is probably a bug in that " - "the $LogFile should have been consistency " - "checked before calling this function."); - goto err_out; - } - ra = (RESTART_AREA*)((u8*)rp + le16_to_cpu(rp->restart_area_offset)); - /* - * If the $LogFile has active clients, i.e. it is open, and we do not - * have the RESTART_VOLUME_IS_CLEAN bit set in the restart area flags, - * we assume there was an unclean shutdown. - */ - if (ra->client_in_use_list != LOGFILE_NO_CLIENT && - !(ra->flags & RESTART_VOLUME_IS_CLEAN)) { - ntfs_debug("Done. $LogFile indicates a dirty shutdown."); - goto err_out; - } - free(rp); - /* $LogFile indicates a clean shutdown. */ - ntfs_debug("Done. $LogFile indicates a clean shutdown."); - return TRUE; -err_out: - free(rp); - return FALSE; -} - -/** - * ntfs_empty_logfile - empty the contents of the $LogFile journal - * @na: ntfs attribute of journal $LogFile to empty - * - * Empty the contents of the $LogFile journal @na and return 0 on success and - * -1 on error. - * - * This function assumes that the $LogFile journal has already been consistency - * checked by a call to ntfs_check_logfile() and that ntfs_is_logfile_clean() - * has been used to ensure that the $LogFile is clean. - */ -int ntfs_empty_logfile(ntfs_attr *na) -{ - s64 len, pos, count; - char buf[NTFS_BUF_SIZE]; - int err; - - ntfs_debug("Entering."); - if (NVolLogFileEmpty(na->ni->vol)) - goto done; - - /* The $DATA attribute of the $LogFile has to be non-resident. */ - if (!NAttrNonResident(na)) { - err = EIO; - Dprintf("$LogFile $DATA attribute is resident!?!\n"); - goto io_error_exit; - } - - /* Get length of $LogFile contents. */ - len = na->data_size; - if (!len) { - Dprintf("$LogFile has zero length, no disk write needed.\n"); - return 0; - } - - /* Read $LogFile until its end. We do this as a check for correct - length thus making sure we are decompressing the mapping pairs - array correctly and hence writing below is safe as well. */ - pos = 0; - while ((count = ntfs_attr_pread(na, pos, NTFS_BUF_SIZE, buf)) > 0) - pos += count; - - if (count == -1 || pos != len) { - err = errno; - Dprintf("Amount of $LogFile data read does not " - "correspond to expected length!"); - if (count != -1) - err = EIO; - goto io_error_exit; - } - - /* Fill the buffer with 0xff's. */ - memset(buf, -1, NTFS_BUF_SIZE); - - /* Set the $DATA attribute. */ - pos = 0; - while ((count = len - pos) > 0) { - if (count > NTFS_BUF_SIZE) - count = NTFS_BUF_SIZE; - - if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { - err = errno; - Dprintf("Failed to set the $LogFile attribute value."); - if (count != -1) - err = EIO; - goto io_error_exit; - } - pos += count; - } - - /* Set the flag so we do not have to do it again on remount. */ - NVolSetLogFileEmpty(na->ni->vol); -done: - ntfs_debug("Done."); - return 0; -io_error_exit: - ntfs_attr_close(na); - ntfs_inode_close(na->ni); - errno = err; - return -1; -} From 317f6f4b62bb14697f58052f1d2596b5bf13ee4f Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 25 Jan 2005 21:41:25 +0000 Subject: [PATCH 2157/2994] Make ntfs_logfile_reset use ntfs_empty_logfile. (Logical change 1.666) --- libntfs/volume.c | 60 ++++++------------------------------------------ 1 file changed, 7 insertions(+), 53 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index 94b1e306..949a9951 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -38,6 +38,7 @@ #include "debug.h" #include "inode.h" #include "runlist.h" +#include "logfile.h" /** * ntfs_volume_alloc - @@ -1189,8 +1190,6 @@ int ntfs_logfile_reset(ntfs_volume *vol) { ntfs_inode *ni; ntfs_attr *na; - s64 len, pos, count; - char buf[NTFS_BUF_SIZE]; int eo; if (!vol) { @@ -1204,66 +1203,21 @@ int ntfs_logfile_reset(ntfs_volume *vol) } if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) { + eo = errno; Dperror("Failed to open $FILE_LogFile/$DATA\n"); goto error_exit; } - /* The $DATA attribute of the $LogFile has to be non-resident. */ - if (!NAttrNonResident(na)) { - Dprintf("$LogFile $DATA attribute is resident!?!\n"); - errno = EIO; - goto io_error_exit; + if (ntfs_empty_logfile(na)) { + eo = errno; + Dperror("Failed to empty $FILE_LogFile/$DATA\n"); + ntfs_attr_close(na); + goto error_exit; } - - /* Get length of $LogFile contents. */ - len = na->data_size; - if (!len) { - Dprintf("$LogFile has zero length, no disk write needed.\n"); - return 0; - } - - /* Read $LogFile until its end. We do this as a check for correct - length thus making sure we are decompressing the mapping pairs - array correctly and hence writing below is safe as well. */ - pos = 0; - while ((count = ntfs_attr_pread(na, pos, NTFS_BUF_SIZE, buf)) > 0) - pos += count; - - if (count == -1 || pos != len) { - Dprintf("Amount of $LogFile data read does not " - "correspond to expected length!"); - if (count != -1) - errno = EIO; - goto io_error_exit; - } - - /* Fill the buffer with 0xff's. */ - memset(buf, -1, NTFS_BUF_SIZE); - - /* Set the $DATA attribute. */ - pos = 0; - while ((count = len - pos) > 0) { - if (count > NTFS_BUF_SIZE) - count = NTFS_BUF_SIZE; - - if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { - Dprintf("Failed to set the $LogFile attribute value."); - if (count != -1) - errno = EIO; - goto io_error_exit; - } - pos += count; - } - ntfs_attr_close(na); return ntfs_inode_close(ni); -io_error_exit: - eo = errno; - ntfs_attr_close(na); - errno = eo; error_exit: - eo = errno; ntfs_inode_close(ni); errno = eo; return -1; From 1354e9b44606d6f6e65a3236c57805f6119eaed6 Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 25 Jan 2005 21:41:25 +0000 Subject: [PATCH 2158/2994] Update. (Logical change 1.666) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index acdf636a..b9d157ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -101,6 +101,7 @@ xx/xx/2004 - 2.0.0-WIP during inode sync. (Yura) - Rename NTFS_SECTOR_SIZE to NTFS_BLOCK_SIZE to keep in sync with kernel driver. (Yura) + - Port logfile checking routines from the kernel to the library. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 5a3d9dc1e7df0691296fba4eb54e1a031195ef45 Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 25 Jan 2005 21:41:25 +0000 Subject: [PATCH 2159/2994] include/ntfs/logfile.h Export functions from logfile.c. include/ntfs/volume.h Add LogFileEmpty to volume flags. libntfs/volume.c Make ntfs_logfile_reset use ntfs_empty_logfile. libntfs/logfile.c Port logfile cheking from kernel to library. BKrev: 41f6bd059nd7bi-4x4l68wcxmkToPg From e89f48810ae8fd3d9e6b16d4b8e80c236c4b9710 Mon Sep 17 00:00:00 2001 From: void!yura Date: Wed, 26 Jan 2005 23:37:25 +0000 Subject: [PATCH 2160/2994] Fix stupid bug trying to sync standard information for not base inode. (Logical change 1.667) --- libntfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index a03bee55..d29aa01a 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -479,7 +479,7 @@ int ntfs_inode_sync(ntfs_inode *ni) __FUNCTION__, (long long) ni->mft_no); /* Update STANDARD_INFORMATION. */ - if (ntfs_inode_sync_standard_information(ni)) { + if (ni->nr_extents != -1 && ntfs_inode_sync_standard_information(ni)) { if (!err || errno == EIO) { err = errno; if (err != EIO) From ec9d6fb6314f64856e2e3cf9a63ab49aca199655 Mon Sep 17 00:00:00 2001 From: void!yura Date: Wed, 26 Jan 2005 23:37:25 +0000 Subject: [PATCH 2161/2994] Fix stupid bug trying to sync standard information for not base inode. BKrev: 41f829b59clwRDNpWZQZSi9SCP7ANQ From b03f4a6ec7badc9614250241816a24234c03f6b3 Mon Sep 17 00:00:00 2001 From: void!yura Date: Thu, 27 Jan 2005 13:53:02 +0000 Subject: [PATCH 2162/2994] fix return value of ntfscp (Logical change 1.668) --- ntfsprogs/ntfscp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index f3fdb8b0..dc857e46 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -356,7 +356,7 @@ int main (int argc, char *argv[]) offset += bw; } need_logfile_reset = 1; - + result = 0; free(buf); close_attr: ntfs_attr_close(na); From 3d44967a5d62711e66ed08186d0d5701d5f9f0ab Mon Sep 17 00:00:00 2001 From: void!yura Date: Thu, 27 Jan 2005 13:53:02 +0000 Subject: [PATCH 2163/2994] fix return value of ntfscp BKrev: 41f8f23eUfbD4PZBBplD8MHSYBV_Hg From 98ac77e1152824e028faf63bf3637885acb4dba1 Mon Sep 17 00:00:00 2001 From: void!yura Date: Thu, 27 Jan 2005 18:31:08 +0000 Subject: [PATCH 2164/2994] ntfs_inode_attach_all_extents: don't try to attach base inode to itself and optimize algorithm a bit. (Logical change 1.669) --- libntfs/inode.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index d29aa01a..487eccf7 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -2,7 +2,7 @@ * inode.c - Inode handling code. Part of the Linux-NTFS project. * * Copyright (c) 2002-2004 Anton Altaparmakov - * Copyright (c) 2004 Yura Pakhuchiy + * Copyright (c) 2004-2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -368,6 +368,7 @@ err_out: int ntfs_inode_attach_all_extents(ntfs_inode *ni) { ATTR_LIST_ENTRY *ale; + u64 prev_attached = 0; if (!ni) { Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); @@ -391,14 +392,19 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) return -1; } - /* Walk though attribute list and attach all extents. */ + /* Walk through attribute list and attach all extents. */ errno = 0; ale = (ATTR_LIST_ENTRY *)ni->attr_list; while ((u8*)ale < ni->attr_list + ni->attr_list_size) { - if (!ntfs_extent_inode_open(ni, MREF_LE(ale->mft_reference))) { - Dprintf("%s(): Couldn't attach extent inode.\n", - __FUNCTION__); - return -1; + if (ni->mft_no != MREF_LE(ale->mft_reference) && + prev_attached != MREF_LE(ale->mft_reference)) { + if (!ntfs_extent_inode_open(ni, + MREF_LE(ale->mft_reference))) { + Dprintf("%s(): Couldn't attach extent inode.\n", + __FUNCTION__); + return -1; + } + prev_attached = MREF_LE(ale->mft_reference); } ale = (ATTR_LIST_ENTRY *)((u8*)ale + le16_to_cpu(ale->length)); } From bec7bec3fd3fb80c6babd5d08bf0b1d02d2caaf7 Mon Sep 17 00:00:00 2001 From: void!yura Date: Thu, 27 Jan 2005 18:31:08 +0000 Subject: [PATCH 2165/2994] ntfs_inode_attach_all_extents: don't try to attach base inode to itself and optimize algorithm a bit. BKrev: 41f9336ceOEH9Zh792NjnqZbQunoyw From 03dcb59a6b801f3786733cff158e5ea28b8215e1 Mon Sep 17 00:00:00 2001 From: void!yura Date: Thu, 27 Jan 2005 18:35:43 +0000 Subject: [PATCH 2166/2994] Fix rare occuring bug in ntfs_attrlist_entry_add. Read updated comment if interesting. (Logical change 1.670) --- libntfs/attrlist.c | 51 ++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 44a68d0a..8580070b 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -3,7 +3,7 @@ * project. * * Copyright (c) 2004 Anton Altaparmakov - * Copyright (c) 2004 Yura Pakhuchiy + * Copyright (c) 2004-2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -103,7 +103,8 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) int err; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", - __FUNCTION__, (long long) ni->mft_no, (unsigned) attr->type); + __FUNCTION__, (long long) ni->mft_no, + (unsigned) le32_to_cpu(attr->type)); if (!ni || !attr) { Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); @@ -122,7 +123,14 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) return -1; } - /* Determine size and allocate memory for new attribute list. */ + /* + * Determine size and allocate memory for new attribute list. We need + * to form new attribute list before on-disk atribute list truncate + * will be performed, because position of attribute for which we make + * attribute list entry can be changed inside mft record (but it can + * not be moved outside mft record, because we don't have attribute + * list entry for it yet) during on-disk atribute list truncate. + */ new_al_len = (ni->attr_list_size + sizeof(ATTR_LIST_ENTRY) + sizeof(ntfschar) * attr->name_length + 7) & ~7; new_al = malloc(new_al_len); @@ -132,20 +140,6 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) return -1; } - /* Reisze $ATTRIBUTE_LIST to new length. */ - na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, NULL, 0); - if (!na) { - err = errno; - Dprintf("%s(): Failed to open $ATTRIBUTE_LIST attribute.\n", - __FUNCTION__); - goto err_out; - } - if (ntfs_attr_truncate(na, new_al_len)) { - err = errno; - Dprintf("%s(): $ATTRIBUTE_LIST resize failed.\n", __FUNCTION__); - goto err_out; - } - /* Find offset at which insert new entry. */ ale = (ATTR_LIST_ENTRY *) ni->attr_list; for(; (u8 *)ale < ni->attr_list + ni->attr_list_size; @@ -162,7 +156,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) err = EIO; Dprintf("%s(): Corrupt attribute name. Run chkdsk.\n", __FUNCTION__); - goto rollback; + goto err_out; } if (err < 0) continue; @@ -177,7 +171,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) Dprintf("%s(): Attribute with same type, name and " "lowest vcn already present in attribute " "list.\n", __FUNCTION__); - goto rollback; + goto err_out; } break; } @@ -205,6 +199,20 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) memcpy(ale->name, (u8 *)attr + le16_to_cpu(attr->name_offset), attr->name_length * sizeof(ntfschar)); + /* Reisze $ATTRIBUTE_LIST to new length. */ + na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, NULL, 0); + if (!na) { + err = errno; + Dprintf("%s(): Failed to open $ATTRIBUTE_LIST attribute.\n", + __FUNCTION__); + goto err_out; + } + if (ntfs_attr_truncate(na, new_al_len)) { + err = errno; + Dprintf("%s(): $ATTRIBUTE_LIST resize failed.\n", __FUNCTION__); + goto err_out; + } + /* Set new runlist. */ if (ni->attr_list) free(ni->attr_list); @@ -214,11 +222,6 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) /* Done! */ ntfs_attr_close(na); return 0; -rollback: - if (ntfs_attr_truncate(na, ni->attr_list_size)) { - Dprintf("%s(): $ATTRIBUTE_LIST resize failed. Rollback failed. " - "Leaving inconsist metadata.\n", __FUNCTION__); - } err_out: if (na) ntfs_attr_close(na); From a40e33ca543bcb3e6fb8391ab79b40f7c75800fb Mon Sep 17 00:00:00 2001 From: void!yura Date: Thu, 27 Jan 2005 18:35:43 +0000 Subject: [PATCH 2167/2994] Fix rare occuring bug in ntfs_attrlist_entry_add. Read updated comment if interesting. BKrev: 41f9347fAv2hbWDbzN33FjccJQO2Wg From ed945d174c7f651d9833721e1d0dc88a467a3cf9 Mon Sep 17 00:00:00 2001 From: void!yura Date: Fri, 28 Jan 2005 13:48:19 +0000 Subject: [PATCH 2168/2994] I realized that my previous chanset fixed one bug, but introduced new one. This will fix both (I hope) and beautificaty function look a bit. (Logical change 1.671) --- libntfs/attrlist.c | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 8580070b..e197b3cc 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -99,8 +99,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) MFT_REF mref; ntfs_attr *na = NULL; u8 *new_al; - int new_al_len; - int err; + int entry_len, entry_offset, err; Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (long long) ni->mft_no, @@ -123,17 +122,10 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) return -1; } - /* - * Determine size and allocate memory for new attribute list. We need - * to form new attribute list before on-disk atribute list truncate - * will be performed, because position of attribute for which we make - * attribute list entry can be changed inside mft record (but it can - * not be moved outside mft record, because we don't have attribute - * list entry for it yet) during on-disk atribute list truncate. - */ - new_al_len = (ni->attr_list_size + sizeof(ATTR_LIST_ENTRY) + - sizeof(ntfschar) * attr->name_length + 7) & ~7; - new_al = malloc(new_al_len); + /* Determine size and allocate memory for new attribute list. */ + entry_len = (sizeof(ATTR_LIST_ENTRY) + sizeof(ntfschar) * + attr->name_length + 7) & ~7; + new_al = malloc(ni->attr_list_size + entry_len); if (!new_al) { Dprintf("%s(): Not enough memory.\n", __FUNCTION__); err = ENOMEM; @@ -176,20 +168,15 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) break; } - /* Copy entries from old attribute list to new. */ - memcpy(new_al, ni->attr_list, (u8 *)ale - ni->attr_list); - memcpy(new_al + new_al_len - ni->attr_list_size + ((u8 *)ale - - ni->attr_list), ale, ni->attr_list_size - - ((u8 *)ale - ni->attr_list)); - + /* Determine new entry offset. */ + entry_offset = ((u8 *)ale - ni->attr_list); /* Set pointer to new entry. */ - ale = (ATTR_LIST_ENTRY *)(new_al + ((u8 *)ale - ni->attr_list)); - - /* Fill new entry with values. */ + ale = (ATTR_LIST_ENTRY *)(new_al + entry_offset); + /* Form new entry. */ ale->type = attr->type; - ale->length = cpu_to_le16(new_al_len - ni->attr_list_size); + ale->length = cpu_to_le16(entry_len); ale->name_length = attr->name_length; - ale->name_offset = (u8 *)ale->name - (u8 *)ale; + ale->name_offset = offsetof(ATTR_LIST_ENTRY, name); if (attr->non_resident) ale->lowest_vcn = attr->lowest_vcn; else @@ -199,7 +186,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) memcpy(ale->name, (u8 *)attr + le16_to_cpu(attr->name_offset), attr->name_length * sizeof(ntfschar)); - /* Reisze $ATTRIBUTE_LIST to new length. */ + /* Resize $ATTRIBUTE_LIST to new length. */ na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, NULL, 0); if (!na) { err = errno; @@ -207,17 +194,22 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) __FUNCTION__); goto err_out; } - if (ntfs_attr_truncate(na, new_al_len)) { + if (ntfs_attr_truncate(na, ni->attr_list_size + entry_len)) { err = errno; Dprintf("%s(): $ATTRIBUTE_LIST resize failed.\n", __FUNCTION__); goto err_out; } + /* Copy entries from old attribute list to new. */ + memcpy(new_al, ni->attr_list, entry_offset); + memcpy(new_al + entry_offset + entry_len, ni->attr_list + + entry_offset, ni->attr_list_size - entry_offset); + /* Set new runlist. */ if (ni->attr_list) free(ni->attr_list); ni->attr_list = new_al; - ni->attr_list_size = new_al_len; + ni->attr_list_size = ni->attr_list_size + entry_len; NInoAttrListSetDirty(ni); /* Done! */ ntfs_attr_close(na); From 036213cece6397135d1bd1237bbf001aa5f05655 Mon Sep 17 00:00:00 2001 From: void!yura Date: Fri, 28 Jan 2005 13:48:19 +0000 Subject: [PATCH 2169/2994] I realized that my previous chanset fixed one bug, but introduced new one. This will fix both (I hope) and beautificaty function look a bit. BKrev: 41fa42a3oQCyXLav2cTUU_9dBinuqQ From 3ca5f1fc5d5dcf04d5071903aaec0b5a80e907c1 Mon Sep 17 00:00:00 2001 From: void!yura Date: Sun, 30 Jan 2005 18:13:25 +0000 Subject: [PATCH 2170/2994] integrate logfile checking with mount (Logical change 1.672) --- libntfs/volume.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/libntfs/volume.c b/libntfs/volume.c index 949a9951..6d04272d 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -550,6 +550,44 @@ error_exit: return NULL; } +/** + * ntfs_volume_check_logfile - check logfile on target volume + * @vol: volume on which to check logfile + * + * Return 0 on success and -1 on error with errno set error code. + */ +static int ntfs_volume_check_logfile(ntfs_volume *vol) +{ + ntfs_inode *ni; + ntfs_attr *na = NULL; + int ret, err = 0; + + if ((ni = ntfs_inode_open(vol, FILE_LogFile)) == NULL) { + Dprintf("Failed to open inode FILE_LogFile.\n"); + errno = EIO; + return -1; + } + if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) { + Dprintf("Failed to open $FILE_LogFile/$DATA\n"); + ret = -1; + err = EIO; + goto exit; + } + if (ntfs_check_logfile(na) && ntfs_is_logfile_clean(na)) + ret = 0; + else { + ret = -1; + err = EIO; + } +exit: + if (na) + ntfs_attr_close(na); + ntfs_inode_close(ni); + if (ret) + errno = err; + return ret; +} + /** * ntfs_device_mount - open ntfs volume * @dev: device to open @@ -915,6 +953,10 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) if (ntfs_inode_close(ni)) Dperror("Failed to close inode, leaking memory"); + /* Check logfile. */ + if (ntfs_volume_check_logfile(vol)) + goto error_exit; + return vol; io_error_exit: errno = EIO; From da9448455bdd1f3b322b49ba8f7d16fa847cd1d7 Mon Sep 17 00:00:00 2001 From: void!yura Date: Sun, 30 Jan 2005 18:13:25 +0000 Subject: [PATCH 2171/2994] integrate logfile checking with mount and remove logfile reset in ntfs{cp,wipe} BKrev: 41fd23c5jaIWucfAYQS-WvoWvD4yQg From 0a16746ca230f135ed8b933084165c18c03f795a Mon Sep 17 00:00:00 2001 From: void!yura Date: Sun, 30 Jan 2005 18:13:25 +0000 Subject: [PATCH 2172/2994] remove logfile reset (Logical change 1.672) --- ntfsprogs/ntfscp.c | 10 ---------- ntfsprogs/ntfswipe.c | 11 +++-------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index dc857e46..de7d61f4 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -246,7 +246,6 @@ int main (int argc, char *argv[]) int flags = 0; int result = 1; s64 new_size; - int need_logfile_reset = 0; u64 offset; char *buf; s64 br, bw; @@ -323,7 +322,6 @@ int main (int argc, char *argv[]) perror("ERROR: Couldn't add attribute"); goto close_dst; } - need_logfile_reset = 1; } Vprintf("Old file size: %lld\n", na->data_size); @@ -332,7 +330,6 @@ int main (int argc, char *argv[]) perror("ERROR: Couldn't resize attribute"); goto close_attr; } - need_logfile_reset = 1; } buf = malloc(NTFS_BUF_SIZE); @@ -355,19 +352,12 @@ int main (int argc, char *argv[]) } offset += bw; } - need_logfile_reset = 1; result = 0; free(buf); close_attr: ntfs_attr_close(na); close_dst: ntfs_inode_close(out); - - if (need_logfile_reset) { - printf("Resetting logfile.\n"); - ntfs_logfile_reset (vol); - } - close_src: fclose (in); umount: diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 1c94b093..14955268 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -1064,6 +1064,9 @@ static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act) s64 len, pos, count; char buf[NTFS_BUF_SIZE2]; int eo; + + /* We can wipe logfile only with 0xff. */ + byte = 0xff; if (!vol || (byte < 0)) return -1; @@ -1384,14 +1387,6 @@ int main (int argc, char *argv[]) printf ("%lld bytes were wiped\n", (long long)total); } - /* - * We need to reset the logfile so Windows can boot and so journal - * replay does not cause corruption. - */ - if (act != act_info) { - printf ("Resetting logfile.\n"); - ntfs_logfile_reset(vol); - } if (ntfs_volume_set_flags (vol, VOLUME_IS_DIRTY) < 0) { Eprintf ("Couldn't mark volume dirty\n"); } From d5eac44ab9560384266d9d952851853e8fba3361 Mon Sep 17 00:00:00 2001 From: void!yura Date: Sun, 30 Jan 2005 18:13:25 +0000 Subject: [PATCH 2173/2994] update (Logical change 1.672) --- ChangeLog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9d157ce..01b98021 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/2004 - 2.0.0-WIP +xx/xx/2005 - 2.0.0-WIP - Add start_vcn parameter to ntfs_get_size_for_mapping_pairs() and ntfs_mapping_pairs_build() and adapt all callers. @@ -101,7 +101,8 @@ xx/xx/2004 - 2.0.0-WIP during inode sync. (Yura) - Rename NTFS_SECTOR_SIZE to NTFS_BLOCK_SIZE to keep in sync with kernel driver. (Yura) - - Port logfile checking routines from the kernel to the library. (Yura) + - Port logfile checking routines from the kernel to the library and + integrate them with mount process. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 51a83b1699d9229712f35e3b65b90b371462c158 Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 1 Feb 2005 18:26:17 +0000 Subject: [PATCH 2174/2994] don't check logfile for readonly mounts (Logical change 1.673) --- libntfs/volume.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index 6d04272d..78d5d61b 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -953,8 +953,11 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) if (ntfs_inode_close(ni)) Dperror("Failed to close inode, leaking memory"); - /* Check logfile. */ - if (ntfs_volume_check_logfile(vol)) + /* + * Check logfile. We care about not clean logfile only during + * read-write mount, so for read-only mount don't check logfile at all. + */ + if (!(rwflag & MS_RDONLY) && ntfs_volume_check_logfile(vol)) goto error_exit; return vol; From 8e54c3eb91480d88fb41ad36079edc1260877f42 Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 1 Feb 2005 18:26:17 +0000 Subject: [PATCH 2175/2994] don't check logfile for readonly mounts BKrev: 41ffc9c9Kytrl_hpghI33W2lQp80aw From 3244499edb940469827c4ebaeff77bafc80b9db4 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Wed, 2 Feb 2005 22:40:59 +0000 Subject: [PATCH 2176/2994] document exit codes (Logical change 1.674) --- ntfsprogs/ntfsclone.8.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 493a1539..fd3878a8 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -1,11 +1,11 @@ .\" -*- nroff -*- .\" Copyright (c) 2003 Richard Russon -.\" Copyright (c) 2003-2004 Szabolcs Szakacsits +.\" Copyright (c) 2003-2005 Szabolcs Szakacsits .\" Copyright (c) 2004 Per Olofsson .\" All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLONE 8 "Sep 2004" "ntfsprogs version @VERSION@" +.TH NTFSCLONE 8 "Feb 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsclone \- Efficiently clone, image or restore an NTFS filesystem .SH SYNOPSIS @@ -190,6 +190,8 @@ Forces ntfsclone to proceed if the filesystem is marked .TP .B \-h, \-\-help Show a list of options with a brief description of each one. +.SH EXIT CODES +The exit code is 0 on success, non-zero otherwise. .SH EXAMPLES Save an NTFS to a file in the special image format .RS From 77e10d23f631c4d19bccccdb8ec1d8dfaed6ef31 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Wed, 2 Feb 2005 22:40:59 +0000 Subject: [PATCH 2177/2994] ntfsclone manual: exit codes are documented BKrev: 420156fbAdW-ZDk7dNjWn3-b1ciQXw From b8da6570e03eb22982366145b77030149bdd5242 Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 7 Feb 2005 20:44:07 +0000 Subject: [PATCH 2178/2994] ntfscp: Added SIGINT (Ctrl+C) handler, improved error handling in sync failed case. (Yura) (Logical change 1.675) --- ChangeLog | 2 ++ ntfsprogs/ntfscp.c | 46 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 01b98021..b2945e9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -103,6 +103,8 @@ xx/xx/2005 - 2.0.0-WIP kernel driver. (Yura) - Port logfile checking routines from the kernel to the library and integrate them with mount process. (Yura) + - ntfscp: Added SIGINT (Ctrl+C) handler, improved error handling in + sync failed case. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index de7d61f4..a8b93348 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -1,7 +1,7 @@ /** * ntfscp - Part of the Linux-NTFS project. * - * Copyright (c) 2004 Yura Pakhuchiy + * Copyright (c) 2004-2005 Yura Pakhuchiy * * This utility will overwrite files on ntfs volume * @@ -27,7 +27,9 @@ #include #include #include +#include #include +#include #include "types.h" #include "attrib.h" @@ -50,6 +52,7 @@ struct options { static const char *EXEC_NAME = "ntfscp"; static struct options opts; +static int caught_sigint = 0; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) @@ -229,6 +232,20 @@ static int parse_options (int argc, char **argv) return (!err && !help && !ver); } +/** + * sigint_handler - Handle SIGINT: abort write, sync and exit. + */ +static void sigint_handler(int arg __attribute__((unused))) +{ + caught_sigint++; + if (caught_sigint > 3) { + Eprintf("SIGTERM received more than 3 times. " + "Exit immediately.\n"); + exit(2); + } else + Eprintf("SIGTERM received. Aborting write.\n"); +} + /** * main - Begin here * @@ -257,6 +274,12 @@ int main (int argc, char *argv[]) utils_set_locale(); + /* Set SIGINT handler. */ + if (signal(SIGINT, sigint_handler) == SIG_ERR) { + perror("Failed to set SIGINT handler"); + return 1; + } + if (opts.noaction) flags = MS_RDONLY; @@ -338,11 +361,12 @@ int main (int argc, char *argv[]) goto close_attr; } + Vprintf("Starting write.\n"); offset = 0; - while (!feof(in)) { + while (!feof(in) && !caught_sigint) { br = fread(buf, 1, NTFS_BUF_SIZE, in); if (!br) { - if (!feof(in)) perror("ERROR: fread failed"); + if (!feof(in)) perror("ERROR: fread failed"); break; } bw = ntfs_attr_pwrite(na, offset, br, buf); @@ -352,16 +376,24 @@ int main (int argc, char *argv[]) } offset += bw; } + Vprintf("Syncing.\n"); result = 0; free(buf); close_attr: ntfs_attr_close(na); close_dst: - ntfs_inode_close(out); + while (ntfs_inode_close(out)) { + if (errno != EBUSY) { + Eprintf("Sync failed. Run chkdsk.\n"); + break; + } + Eprintf("Device busy. Will retry sync after 3 seconds.\n"); + sleep(3); + } close_src: - fclose (in); + fclose(in); umount: - ntfs_umount (vol, FALSE); - + ntfs_umount(vol, FALSE); + Vprintf("Done.\n"); return result; } From ba6a74ea79525d83806b583e4e2ebd0f093ba352 Mon Sep 17 00:00:00 2001 From: void!yura Date: Mon, 7 Feb 2005 20:44:07 +0000 Subject: [PATCH 2179/2994] ntfscp: Added SIGINT (Ctrl+C) handler, improved error handling in sync failed case. (Yura) BKrev: 4207d317Q2Kubdv8apElMfrJP4gonA From 5180f0527942d46d95f708a2eb57992e7464d9fb Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 8 Feb 2005 19:06:18 +0000 Subject: [PATCH 2180/2994] I completely forgot about mst protection when I was writing index dumping code. Fix this. (Logical change 1.676) --- ntfsprogs/ntfsinfo.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index b0289794..c271c9e5 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -4,7 +4,7 @@ * Copyright (c) 2002-2004 Matthew J. Fanto * Copyright (c) 2002-2004 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon - * Copyright (c) 2004 Yura Pakhuchiy + * Copyright (c) 2004-2005 Yura Pakhuchiy * * This utility will dump a file's attributes. * @@ -64,6 +64,7 @@ #include "inode.h" #include "utils.h" #include "security.h" +#include "mst.h" static const char *EXEC_NAME = "ntfsinfo"; @@ -1346,6 +1347,11 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) bit = 0; while((u8 *)tmp_alloc < (u8 *)allocation + na->data_size) { if (*byte & (1 << bit)) { + if (ntfs_mst_post_read_fixup((NTFS_RECORD *) tmp_alloc, + indx_record_size)) { + perror("Damaged INDX record"); + goto free; + } entry = (INDEX_ENTRY *)((u8 *)tmp_alloc + le32_to_cpu( tmp_alloc->index.entries_offset) + 0x18); total_entries += ntfs_dump_index_entries(entry, type); @@ -1361,6 +1367,7 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) } printf("\tIndex entries total:\t %d\n", total_entries); printf("\tINDX blocks total:\t %d\n", total_indx_blocks); +free: free(allocation); free(bitmap); } From 942f72b6554bb6ee99c56e24cce428d564b7072d Mon Sep 17 00:00:00 2001 From: void!yura Date: Tue, 8 Feb 2005 19:06:18 +0000 Subject: [PATCH 2181/2994] ntfsprogs/ntfsinfo.c I completely forgot about mst protection when I was writing index dumping code. Fix this. BKrev: 42090daa4A9PHd3jWSO20LUW-xKjkg From 9028469456c1ee6d18976a99151286d9084f9ebc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 17 Feb 2005 17:03:50 +0000 Subject: [PATCH 2182/2994] Fix a nasty runlist merge bug when merging two holes. (Anton) (Logical change 1.677) --- libntfs/runlist.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 3e7b1763..722505da 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -111,8 +111,11 @@ static __inline__ BOOL ntfs_rl_are_mergeable(runlist_element *dst, return FALSE; } - if ((dst->lcn < 0) || (src->lcn < 0)) /* Are we merging holes? */ + if ((dst->lcn < 0) || (src->lcn < 0)) { /* Are we merging holes? */ + if (dst->lcn == LCN_HOLE && src->lcn == LCN_HOLE) + return TRUE; return FALSE; + } if ((dst->lcn + dst->length) != src->lcn) /* Are the runs contiguous? */ return FALSE; if ((dst->vcn + dst->length) != src->vcn) /* Are the runs misaligned? */ From a4ffebf8cc5f0e6268f41e1f800c498e921f0924 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 17 Feb 2005 17:03:50 +0000 Subject: [PATCH 2183/2994] Fix a nasty runlist merge bug when merging two holes. (Anton) BKrev: 4214ce76fM5rgprlNMJANEjBqiYW5A From b6b7655c551998e89b004ff93ec71980b2dba6c4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 17 Feb 2005 17:03:50 +0000 Subject: [PATCH 2184/2994] Update (Logical change 1.677) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index b2945e9d..19d8e6cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -105,6 +105,7 @@ xx/xx/2005 - 2.0.0-WIP integrate them with mount process. (Yura) - ntfscp: Added SIGINT (Ctrl+C) handler, improved error handling in sync failed case. (Yura) + - Fix a nasty runlist merge bug when merging two holes. (Anton) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 03a03359a1413e6201415d9d3b1b6abd55c2f696 Mon Sep 17 00:00:00 2001 From: void!yura Date: Thu, 17 Feb 2005 18:01:56 +0000 Subject: [PATCH 2185/2994] Fix memleak in ntfs_attr_update_mapping_pairs (Logical change 1.678) --- libntfs/attrib.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e9e66fa5..a7414dac 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2004 Anton Altaparmakov * Copyright (c) 2002 Richard Russon - * Copyright (c) 2004 Yura Pakhuchiy + * Copyright (c) 2004-2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -4293,9 +4293,12 @@ retry: goto put_err_out; } Dprintf("%s(): Deallocate done.\n", __FUNCTION__); + ntfs_attr_put_search_ctx(ctx); return 0; } - + ntfs_attr_put_search_ctx(ctx); + ctx = NULL; + /* Allocate new MFT records for the rest of mapping pairs. */ while (1) { /* Calculate size of rest mapping pairs. */ @@ -4367,7 +4370,8 @@ retry: } return 0; put_err_out: - ntfs_attr_put_search_ctx(ctx); + if (ctx) + ntfs_attr_put_search_ctx(ctx); errno = err; return -1; } From 95880b7e7e489d8cd112cae2f65e4a32cc31220a Mon Sep 17 00:00:00 2001 From: void!yura Date: Thu, 17 Feb 2005 18:01:56 +0000 Subject: [PATCH 2186/2994] Fix memleak in ntfs_attr_update_mapping_pairs BKrev: 4214dc14MoItzDP41J0WsUdHOpxgpA From e9159478ea2f28e9b366c8a8c94dbbd84addeb46 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 19 Feb 2005 19:34:37 +0000 Subject: [PATCH 2187/2994] ntfsfix: use getopt, added --help and --version, some output cleanup (Logical change 1.679) --- Makefile.in | 14 +- aclocal.m4 | 7317 +++++++++++------ config.guess | 74 +- config.sub | 51 +- configure | 15598 +++++++++++++++++++++++++++++++------ doc/Makefile.in | 14 +- include/Makefile.in | 14 +- include/ntfs/Makefile.in | 14 +- install-sh | 8 +- libntfs/Makefile.in | 26 +- ltmain.sh | 3139 +++++--- ntfsprogs/Makefile.am | 2 +- ntfsprogs/Makefile.in | 20 +- 13 files changed, 20476 insertions(+), 5815 deletions(-) diff --git a/Makefile.in b/Makefile.in index 8d3c19ed..92efbf1a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -77,6 +77,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -87,6 +88,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -98,6 +103,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -127,13 +134,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/aclocal.m4 b/aclocal.m4 index d0da9422..d9d06614 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.9.4 -*- Autoconf -*- +# generated automatically by aclocal 1.9.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. @@ -11,12 +11,63 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# serial 46 AC_PROG_LIBTOOL +# serial 47 AC_PROG_LIBTOOL + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# 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 And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +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_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" @@ -27,10 +78,13 @@ AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) -]) +])# _AC_PROG_LIBTOOL + +# AC_LIBTOOL_SETUP +# ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.13)dnl +[AC_PREREQ(2.50)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl @@ -40,15 +94,103 @@ 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([LT_AC_PROG_SED])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 +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -58,341 +200,78 @@ file_magic*) ;; esac -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -# 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* - ;; +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default -*-*-linux*) - # Test if the compiler is 64bit - echo 'int i;' > conftest.$ac_ext - lt_cv_cc_64bit_output=no - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *"ELF 64"*) - lt_cv_cc_64bit_output=yes - ;; - 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 - ;; +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP -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])]) +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl - 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 +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} -_LT_AC_LTCONFIG_HACK +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER -]) -# AC_LIBTOOL_HEADER_ASSERT -# ------------------------ -AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], -[AC_CACHE_CHECK([whether $CC supports assert without backlinking], - [lt_cv_func_assert_works], - [case $host in - *-*-solaris*) - if test "$GCC" = yes && test "$with_gnu_ld" != yes; then - case `$CC --version 2>/dev/null` in - [[12]].*) lt_cv_func_assert_works=no ;; - *) lt_cv_func_assert_works=yes ;; - esac - fi - ;; - esac]) +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX -if test "x$lt_cv_func_assert_works" = xyes; then - AC_CHECK_HEADERS(assert.h) -fi -])# AC_LIBTOOL_HEADER_ASSERT -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h) -])# _LT_AC_CHECK_DLFCN +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $host_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[[ABCDGISTW]]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. -lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[[]] = -{ -EOF - sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AC_FD_CC - fi - else - echo "cannot find nm_test_var in $nlist" >&AC_FD_CC - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC - fi - else - echo "$progname: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" -if test -z "$lt_cv_sys_global_symbol_pipe"; then - global_symbol_to_cdecl= - global_symbol_to_c_name_address= -else - global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" - global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" -fi -if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; -then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - -# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR -# --------------------------------- -AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], -[# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi -])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR - +[_LT_AC_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -410,7 +289,7 @@ if test "X[$]1" = X--no-reexec; then elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else @@ -422,7 +301,7 @@ if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -466,7 +346,7 @@ else break fi done - IFS="$save_ifs" + IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -539,17 +419,303 @@ if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then fi AC_SUBST(ECHO) -AC_DIVERT_POP -])# _LT_AC_PROG_ECHO_BACKSLASH +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + 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 + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_lib64_suffix=no + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.$ac_objext`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + lt_cv_cc_lib64_suffix=yes + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + lt_cv_cc_lib64_suffix=yes + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + lt_cv_cc_lib64_suffix=yes + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + lt_cv_cc_lib64_suffix=yes + ;; + esac + ;; + 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_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + 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 + ;; +AC_PROVIDE_IFELSE([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) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ------------------------------------------------------------------ AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[if test "$cross_compiling" = yes; then : +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : [$4] else - AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext </dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" -need_locks="$enable_libtool_lock" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -if test x"$host" != x"$build"; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case $host_os in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="[$]2" - -AC_MSG_CHECKING([for objdir]) -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -AC_MSG_RESULT($objdir) - - -AC_ARG_WITH(pic, -[ --with-pic try to use only PIC/non-PIC objects [default=use both]], -pic_mode="$withval", pic_mode=default) -test -z "$pic_mode" && pic_mode=default - -# We assume here that the value for lt_cv_prog_cc_pic will not be cached -# in isolation, and that seeing it set (from the cache) indicates that -# the associated values are set (in the cache) correctly too. -AC_MSG_CHECKING([for $compiler option to produce PIC]) -AC_CACHE_VAL(lt_cv_prog_cc_pic, -[ lt_cv_prog_cc_pic= - lt_cv_prog_cc_shlib= - lt_cv_prog_cc_wl= - lt_cv_prog_cc_static= - lt_cv_prog_cc_no_builtin= - lt_cv_prog_cc_can_build_shared=$can_build_shared - - if test "$GCC" = yes; then - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-static' - - case $host_os in - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # not sure about C++ programs. - lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_cv_prog_cc_pic='-fno-common' - ;; - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_cv_prog_cc_pic=-Kconform_pic - fi - ;; - *) - lt_cv_prog_cc_pic='-fPIC' - ;; - esac - else - # PORTME Check for PIC flags for the system compiler. - case $host_os in - aix3* | aix4* | aix5*) - lt_cv_prog_cc_wl='-Wl,' - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_cv_prog_cc_static='-Bstatic' - else - lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - hpux9* | hpux10* | hpux11*) - # Is there a better lt_cv_prog_cc_static that works with the bundled CC? - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" - lt_cv_prog_cc_pic='+Z' - ;; - - irix5* | irix6* | nonstopux*) - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - - newsos6) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - ;; - - osf3* | osf4* | osf5*) - # All OSF/1 code is PIC. - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - ;; - - sco3.2v5*) - lt_cv_prog_cc_pic='-Kpic' - lt_cv_prog_cc_static='-dn' - lt_cv_prog_cc_shlib='-belf' - ;; - - solaris*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - sunos4*) - lt_cv_prog_cc_pic='-PIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Qoption ld ' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - uts4*) - lt_cv_prog_cc_pic='-pic' - lt_cv_prog_cc_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_cv_prog_cc_pic='-Kconform_pic' - lt_cv_prog_cc_static='-Bstatic' - fi - ;; - - *) - lt_cv_prog_cc_can_build_shared=no - ;; - esac - fi + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* ]) -if test -z "$lt_cv_prog_cc_pic"; then - AC_MSG_RESULT([none]) -else - AC_MSG_RESULT([$lt_cv_prog_cc_pic]) - - # Check to make sure the pic_flag actually works. - AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) - AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - AC_TRY_COMPILE([], [], [dnl - case $host_os in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then - # they create non-PIC objects. So, if there were any warnings, we - # assume that PIC is not supported. - if test -s conftest.err; then - lt_cv_prog_cc_pic_works=no - else - lt_cv_prog_cc_pic_works=yes - fi - ;; - *) - lt_cv_prog_cc_pic_works=yes - ;; - esac - ], [dnl - lt_cv_prog_cc_pic_works=no - ]) - CFLAGS="$save_CFLAGS" - ]) - - if test "X$lt_cv_prog_cc_pic_works" = Xno; then - lt_cv_prog_cc_pic= - lt_cv_prog_cc_can_build_shared=no - else - lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" - fi - - AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) -fi - -# Check for any special shared library compilation flags. -if test -n "$lt_cv_prog_cc_shlib"; then - AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) - lt_cv_prog_cc_can_build_shared=no - fi -fi - -AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) -AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl - lt_cv_prog_cc_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) - LDFLAGS="$save_LDFLAGS" -]) - -# Belt *and* braces to stop my trousers falling down: -test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) - -pic_flag="$lt_cv_prog_cc_pic" -special_shlib_compile_flags="$lt_cv_prog_cc_shlib" -wl="$lt_cv_prog_cc_wl" -link_static_flag="$lt_cv_prog_cc_static" -no_builtin_flag="$lt_cv_prog_cc_no_builtin" -can_build_shared="$lt_cv_prog_cc_can_build_shared" +])# AC_LIBTOOL_PROG_CC_C_O -# Check to see if options -o and -c are simultaneously supported by compiler -AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) -AC_CACHE_VAL([lt_cv_compiler_c_o], [ -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -echo "int some_variable = 0;" > conftest.$ac_ext -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" -compiler_c_o=no -if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - lt_cv_compiler_c_o=no - else - lt_cv_compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&AC_FD_CC - lt_cv_compiler_c_o=no -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null -]) -compiler_c_o=$lt_cv_compiler_c_o -AC_MSG_RESULT([$compiler_c_o]) - -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) - AC_CACHE_VAL([lt_cv_compiler_o_lo], [ - lt_cv_compiler_o_lo=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - save_objext="$ac_objext" - ac_objext=lo - AC_TRY_COMPILE([], [int some_variable = 0;], [dnl - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - lt_cv_compiler_o_lo=no - else - lt_cv_compiler_o_lo=yes - fi - ]) - ac_objext="$save_objext" - CFLAGS="$save_CFLAGS" - ]) - compiler_o_lo=$lt_cv_compiler_o_lo - AC_MSG_RESULT([$compiler_o_lo]) -else - compiler_o_lo=no -fi - +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- # Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes @@ -1131,764 +977,77 @@ if test "$compiler_c_o" = no && test "$need_locks" != no; then ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then - AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS -if test "$GCC" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) - echo "int some_variable = 0;" > conftest.$ac_ext - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" - compiler_rtti_exceptions=no - AC_TRY_COMPILE([], [int some_variable = 0;], [dnl - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - compiler_rtti_exceptions=no - else - compiler_rtti_exceptions=yes - fi - ]) - CFLAGS="$save_CFLAGS" - AC_MSG_RESULT([$compiler_rtti_exceptions]) - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi -fi - -# See if the linker supports building shared libraries. -AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) - -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -old_archive_from_expsyms_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_into_libs=no -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -link_all_deplibs=unknown -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. -extract_expsyms_cmds= - -case $host_os in -cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; -openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ - sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ - test -f $output_objdir/impgen.exe || (cd $output_objdir && \ - if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ - else $CC -o impgen impgen.c ; fi)~ - $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' - - old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' - - # cygwin and mingw dlls have different entry points and sets of symbols - # to exclude. - # FIXME: what about values for MSVC? - dll_entry=__cygwin_dll_entry@12 - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ - case $host_os in - mingw*) - # mingw values - dll_entry=_DllMainCRTStartup@12 - dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ - ;; - esac - - # mingw and cygwin differ, and it's simplest to just exclude the union - # of the two symbol sets. - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one (in ltdll.c) - if test "x$lt_cv_need_dllmain" = "xyes"; then - ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " - ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ - test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' - else - ltdll_obj= - ltdll_cmds= - fi - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left be newer dlltools. - export_symbols_cmds="$ltdll_cmds"' - $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' - - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is. - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname-def; - else - echo EXPORTS > $output_objdir/$soname-def; - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \[$]# in - 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; - 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; - *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done; - fi~ - '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw* | pw32*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - hardcode_direct=yes - archive_cmds='' - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - shared_flag='${wl}-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall can do strange things, so it is better to - # generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='${wl}-berok' - # This is a bit strange, but is similar to how AIX traditionally builds - # it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' - # We need to add '_' to the symbols in $export_symbols first - #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - hardcode_direct=yes - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load $convenience' - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case $host_os in - hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case "$host_os" in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - #Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - export_dynamic_flag_spec='${wl}-Bexport' - ;; - - solaris*) - # gcc --version < 3.0 without binutils cannot create self contained - # shared libraries reliably, requiring libgcc.a to resolve some of - # the object symbols generated in some cases. Libraries that use - # assert need libgcc.a to resolve __eprintf, for example. Linking - # a copy of libgcc.a into every shared library to guarantee resolving - # such symbols causes other problems: According to Tim Van Holder - # , C++ libraries end up with a separate - # (to the application) exception stack for one thing. - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - [[12]].*) - cat <&2 - -*** Warning: Releases of GCC earlier than version 3.0 cannot reliably -*** create self contained shared libraries on Solaris systems, without -*** introducing a dependency on libgcc.a. Therefore, libtool is disabling -*** -no-undefined support, which will at least allow you to build shared -*** libraries. However, you may find that when you link such libraries -*** into an application without using GCC, you have to manually add -*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to -*** upgrade to a newer version of GCC. Another option is to rebuild your -*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. - -EOF - no_undefined_flag= - ;; - esac - fi - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5uw7* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs fi -AC_MSG_RESULT([$ld_shlibs]) -test "$ld_shlibs" = no && can_build_shared=no +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- # Check hardcoding attributes. -AC_MSG_CHECKING([how to hardcode library paths into programs]) -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. - hardcode_action=relink + _LT_AC_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate + _LT_AC_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. - hardcode_action=unsupported + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported fi -AC_MSG_RESULT([$hardcode_action]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) -striplib= +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then @@ -1896,17 +1055,33 @@ if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else AC_MSG_RESULT([no]) fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP -reload_cmds='$LD$reload_flag -o $output$reload_objs' -test -z "$deplibs_check_method" && deplibs_check_method=unknown +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- # PORTME Fill in your ld.so characteristics -AC_MSG_CHECKING([dynamic linker characteristics]) +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -1915,17 +1090,36 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) @@ -1935,7 +1129,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -1945,43 +1139,41 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can - # not hardcode correct soname into executable. Probably we can - # add versioning support to collect2, so additional links can - # be useful in future. + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}.so$major' + soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi - hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) - library_names_spec='${libname}.so' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -1989,13 +1181,12 @@ beos*) bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -2003,29 +1194,55 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows + shrext_cmds=".dll" need_version=no need_lib_prefix=no + case $GCC,$host_os in - yes,cygwin*) + yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog .libs/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac ;; - yes,mingw*) - library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` - ;; - yes,pw32*) - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - ;; + *) - library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -2038,30 +1255,56 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' - soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -2070,7 +1313,11 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - *) + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -2081,8 +1328,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -2090,14 +1337,45 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. - dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -2105,21 +1383,29 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) version_type=irix ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -2128,20 +1414,21 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) +linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. -linux-gnu*) +linux*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -2150,12 +1437,17 @@ linux-gnu*) # before this can be enabled. hardcode_into_libs=yes - case $host_cpu:$lt_cv_cc_64bit_output in - powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" - ;; - esac + libsuff= + if test "$lt_cv_cc_lib64_suffix" = "yes"; then + libsuff=64 + fi + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} $lt_ld_extra" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} /usr/local/lib${libsuff} $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -2166,17 +1458,29 @@ linux-gnu*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -2186,7 +1490,17 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -2194,47 +1508,48 @@ newsos6) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case "$host_os" in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' + shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf + need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; @@ -2242,8 +1557,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -2253,7 +1568,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -2265,8 +1580,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -2287,39 +1602,933 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# Report the final consequences. + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# 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_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# 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], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# 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_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# 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], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# 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_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# 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], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# 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_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# 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_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [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]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +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_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +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 + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$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_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl +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 $CC]) + 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. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname 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 + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + 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. + case `"$lt_cv_path_LD" -v 2>&1 &1 /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_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + 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_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + case $host_cpu in + alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + # this will be overridden with pass_all, but let us keep it just in case + 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` + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + 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 + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + 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*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + 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 + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + 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 + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_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* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL 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, lt_dlinit, + [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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[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])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -2337,11 +2546,1160 @@ aix3*) fi ;; -aix4*) +aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; + darwin* | rhapsody*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_cv_prog_cc_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi]) - AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) - ;; - esac -fi -need_lc=${lt_cv_archive_cmds_need_lc-yes} +AC_LIBTOOL_CONFIG($1) -# The second clause should only fire when bootstrapping the +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_F77_CONFIG + + +# AC_LIBTOOL_LANG_GCJ_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) +AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], +[AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_GCJ_CONFIG + + +# AC_LIBTOOL_LANG_RC_CONFIG +# -------------------------- +# Ensure that the configuration vars for the Windows resource compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) +AC_DEFUN([_LT_AC_LANG_RC_CONFIG], +[AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_RC_CONFIG + + +# AC_LIBTOOL_CONFIG([TAGNAME]) +# ---------------------------- +# If TAGNAME is not passed, then create an initial libtool script +# with a default configuration from the untagged config vars. Otherwise +# add code to config.status for appending the configuration named by +# TAGNAME from the matching tagged config vars. +AC_DEFUN([AC_LIBTOOL_CONFIG], +[# The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - : -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi - -if test -f "$ltmain"; then - trap "$rm \"${ofile}T\"; exit 1" 1 2 15 - $rm -f "${ofile}T" - - echo creating $ofile - + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS SED \ - AR AR_FLAGS CC LD LN_S NM SHELL \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ - postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ - old_striplib striplib file_magic_cmd export_symbols_cmds \ - deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - global_symbol_to_c_name_address \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + old_postinstall_cmds old_postuninstall_cmds \ + _LT_AC_TAGVAR(compiler, $1) \ + _LT_AC_TAGVAR(CC, $1) \ + _LT_AC_TAGVAR(LD, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ + _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ + _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ + _LT_AC_TAGVAR(old_archive_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ + _LT_AC_TAGVAR(predep_objects, $1) \ + _LT_AC_TAGVAR(postdep_objects, $1) \ + _LT_AC_TAGVAR(predeps, $1) \ + _LT_AC_TAGVAR(postdeps, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ + _LT_AC_TAGVAR(archive_cmds, $1) \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ + _LT_AC_TAGVAR(postinstall_cmds, $1) \ + _LT_AC_TAGVAR(postuninstall_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ + _LT_AC_TAGVAR(allow_undefined_flag, $1) \ + _LT_AC_TAGVAR(no_undefined_flag, $1) \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ + _LT_AC_TAGVAR(hardcode_automatic, $1) \ + _LT_AC_TAGVAR(module_cmds, $1) \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) \ + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ + _LT_AC_TAGVAR(exclude_expsyms, $1) \ + _LT_AC_TAGVAR(include_expsyms, $1); do case $var in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + _LT_AC_TAGVAR(old_archive_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ + _LT_AC_TAGVAR(archive_cmds, $1) | \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(module_cmds, $1) | \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -2464,14 +3906,31 @@ if test -f "$ltmain"; then esac done - cat <<__EOF__ > "${ofile}T" -#! $SHELL + case $lt_echo in + *'\[$]0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` + ;; + esac -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +ifelse([$1], [], + [cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + AC_MSG_NOTICE([creating $ofile])], + [cfgfile="$ofile"]) + + cat <<__EOF__ >> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -2493,17 +3952,21 @@ if test -f "$ltmain"; then # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed that does not truncate output. +# A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="${SED} -e s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi -# ### BEGIN LIBTOOL CONFIG +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -2517,7 +3980,10 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$need_lc +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -2533,14 +3999,20 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# The default C compiler. -CC=$lt_CC +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) # Is the compiler the GNU C compiler? -with_gcc=$GCC +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP # The linker used to build libraries. -LD=$lt_LD +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) # Whether we need hard or soft links. LN_S=$lt_LN_S @@ -2549,7 +4021,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$STRIP +STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -2571,7 +4043,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_wl +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) # Object file suffix (normally "o"). objext="$ac_objext" @@ -2579,18 +4051,21 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_pic_flag +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) pic_mode=$pic_mode -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_compiler_c_o +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len -# Can we write directly to a .lo ? -compiler_o_lo=$lt_compiler_o_lo +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -2611,19 +4086,19 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_link_static_flag +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_no_builtin_flag +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) # Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) # Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) # Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) # Library versioning type. version_type=$version_type @@ -2640,26 +4115,50 @@ soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) # Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) # Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -2667,10 +4166,10 @@ deplibs_check_method=$lt_deplibs_check_method file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) # Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds @@ -2679,13 +4178,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_global_symbol_pipe +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -2697,36 +4196,45 @@ shlibpath_var=$shlibpath_var shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) # Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. -hardcode_direct=$hardcode_direct +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. -hardcode_minus_L=$hardcode_minus_L +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec @@ -2735,30 +4243,33 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" # Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) # The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) # Symbols that must always be exported. -include_expsyms=$lt_include_expsyms +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) -# ### END LIBTOOL CONFIG +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) __EOF__ +ifelse([$1],[], [ case $host_os in aix3*) - cat <<\EOF >> "${ofile}T" + cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -2771,11 +4282,1530 @@ EOF ;; esac + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDRT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in - cygwin* | mingw* | pw32* | os2*) - cat <<'EOF' >> "${ofile}T" - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi4*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include @@ -2809,748 +5839,13 @@ EOF # return TRUE; # } # /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# 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 of the License, 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. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# /* O_BINARY isn't required (or even defined sometimes) under Unix */ -# #ifndef O_BINARY -# #define O_BINARY 0 -# #endif -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (dll < 1) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) - - mv -f "${ofile}T" "$ofile" || \ - (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") - chmod +x "$ofile" -fi - -])# _LT_AC_LTCONFIG_HACK - -# 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)]) +])# _LT_AC_FILE_LTDLL_C -# 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 -]) +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) -# 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 <&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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])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=$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_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 &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 dependent 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 -aix4* | aix5*) - 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` - ;; - *) # 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* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # 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 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) - 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 - ;; - -newos6*) - 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 - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -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 - 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*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - 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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl -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=$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 LTDLINCL to the include flags for -# the libltdl header and adds --enable-ltdl-convenience to the -# configure arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library and LTDLINCL to the include flags for -# the libltdl header and adds --enable-ltdl-install to the configure -# arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) @@ -3564,6 +5859,16 @@ AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # @@ -3577,79 +5882,51 @@ AC_DEFUN([LT_AC_PROG_SED], AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. -as_executable_p="test -f" 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_prog in sed gsed; do + for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done - - # 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 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/sed$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - { (exit 1); exit 1; } -} - _max=0 - _count=0 - # Add /usr/xpg4/bin/sed as it is typically found on Solaris - # along with /bin/sed that truncates output. - for _sed in $_sed_list /usr/xpg4/bin/sed; do - test ! -f ${_sed} && break - cat /dev/null > "$tmp/sed.in" - _count=0 - echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" - # Check for GNU sed and select it if it is found. - if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then - lt_cv_path_SED=${_sed} - break +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed fi - while true; do - cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" - mv "$tmp/sed.tmp" "$tmp/sed.in" - cp "$tmp/sed.in" "$tmp/sed.nl" - echo >>"$tmp/sed.nl" - ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break - cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break - # 40000 chars as input seems more than enough - test $_count -gt 10 && break - _count=`expr $_count + 1` - if test $_count -gt $_max; then - _max=$_count - lt_cv_path_SED=$_sed - fi - done done - rm -rf "$tmp" +done +SED=$lt_cv_path_SED ]) -if test "X$SED" != "X"; then - lt_cv_path_SED=$SED -else - SED=$lt_cv_path_SED -fi AC_MSG_RESULT([$SED]) ]) @@ -3657,7 +5934,7 @@ AC_MSG_RESULT([$SED]) dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN(PKG_CHECK_MODULES, [ +AC_DEFUN([PKG_CHECK_MODULES], [ succeeded=no if test -z "$PKG_CONFIG"; then @@ -3740,7 +6017,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # 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.9.4])]) + [AM_AUTOMAKE_VERSION([1.9.3])]) # AM_AUX_DIR_EXPAND diff --git a/config.guess b/config.guess index 82294713..51fab477 100755 --- a/config.guess +++ b/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2004-11-12' +timestamp='2004-03-12' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -203,15 +203,15 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - luna88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -227,12 +227,21 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + pegasos:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; sgi:OpenBSD:*:*) - echo mips64-unknown-openbsd${UNAME_RELEASE} + echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -298,6 +307,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; + Alpha*:OpenVMS:*:*) + echo alpha-hp-vms + exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -319,9 +331,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit 0 ;; *:OS400:*:*) echo powerpc-ibm-os400 exit 0 ;; @@ -345,7 +354,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + DRS?6000:UNIX_SV:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; @@ -755,7 +764,7 @@ EOF echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` @@ -778,7 +787,21 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + # GNU/KFreeBSD systems have a "k" prefix to indicate we are using + # FreeBSD's kernel, but not the complete OS. + case ${LIBC} in gnu) kernel_only='k' ;; esac + echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -827,12 +850,6 @@ EOF cris:Linux:*:*) echo cris-axis-linux-gnu exit 0 ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit 0 ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; @@ -1079,9 +1096,9 @@ EOF M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; - M68*:*:R3V[5678]*:*) + M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -1179,10 +1196,9 @@ EOF echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in + case `uname -p` in *86) UNAME_PROCESSOR=i686 ;; - unknown) UNAME_PROCESSOR=powerpc ;; + powerpc) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; @@ -1244,16 +1260,6 @@ EOF *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms && exit 0 ;; - I*) echo ia64-dec-vms && exit 0 ;; - V*) echo vax-dec-vms && exit 0 ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/config.sub b/config.sub index 0f84ac2c..ba331039 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -timestamp='2004-11-30' +timestamp='2004-03-12' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -70,7 +70,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -145,7 +145,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) + -apple | -axis) os= basic_machine=$1 ;; @@ -267,7 +267,7 @@ case $basic_machine in | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; @@ -300,7 +300,7 @@ case $basic_machine in | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ + | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ @@ -326,9 +326,8 @@ case $basic_machine in | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ - | mmix-* \ | msp430-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ + | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ @@ -343,8 +342,8 @@ case $basic_machine in | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ | ymp-* \ | z8k-*) ;; @@ -446,10 +445,6 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; cr16c) basic_machine=cr16c-unknown os=-elf @@ -457,9 +452,6 @@ case $basic_machine in crds | unos) basic_machine=m68k-crds ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; @@ -489,10 +481,6 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -671,6 +659,10 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -751,6 +743,10 @@ case $basic_machine in np1) basic_machine=np1-gould ;; + nv1) + basic_machine=nv1-cray + os=-unicosmp + ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -1033,10 +1029,6 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; xps | xps100) basic_machine=xps100-honeywell ;; @@ -1067,9 +1059,6 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; - mmix) - basic_machine=mmix-knuth - ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1305,9 +1294,6 @@ case $os in -kaos*) os=-kaos ;; - -zvmoe) - os=-zvmoe - ;; -none) ;; *) @@ -1388,9 +1374,6 @@ case $basic_machine in *-ibm) os=-aix ;; - *-knuth) - os=-mmixware - ;; *-wec) os=-proelf ;; diff --git a/configure b/configure index 1599cf74..be39cf4a 100755 --- a/configure +++ b/configure @@ -243,17 +243,6 @@ IFS=" $as_nl" $as_unset CDPATH -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi - # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -272,7 +261,7 @@ if test "X$1" = X--no-reexec; then elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else @@ -284,7 +273,7 @@ if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -328,7 +318,7 @@ else break fi done - IFS="$save_ifs" + IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -402,6 +392,11 @@ fi + +tagnames=${tagnames+${tagnames},}CXX + +tagnames=${tagnames+${tagnames},}F77 + # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. @@ -471,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 ECHO RANLIB ac_ct_RANLIB CPP EGREP LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -932,6 +927,26 @@ ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +ac_env_CXXCPP_set=${CXXCPP+set} +ac_env_CXXCPP_value=$CXXCPP +ac_cv_env_CXXCPP_set=${CXXCPP+set} +ac_cv_env_CXXCPP_value=$CXXCPP +ac_env_F77_set=${F77+set} +ac_env_F77_value=$F77 +ac_cv_env_F77_set=${F77+set} +ac_cv_env_F77_value=$F77 +ac_env_FFLAGS_set=${FFLAGS+set} +ac_env_FFLAGS_value=$FFLAGS +ac_cv_env_FFLAGS_set=${FFLAGS+set} +ac_cv_env_FFLAGS_value=$FFLAGS # # Report the --help message. @@ -1014,8 +1029,10 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-shared=PKGS build shared libraries default=yes - --enable-static=PKGS build static libraries default=yes + --enable-shared[=PKGS] + build shared libraries [default=yes] + --enable-static[=PKGS] + build static libraries [default=yes] --enable-debug enable additional debugging code and output --disable-default-device-io-ops do not provide default device io operations @@ -1025,15 +1042,19 @@ Optional Features: --enable-warnings enable additional compiler warnings --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors - --enable-fast-install=PKGS optimize for fast installation 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 + --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] + --with-tags[=TAGS] + include additional configurations [automatic] Some influential environment variables: CC C compiler command @@ -1043,6 +1064,11 @@ Some influential environment variables: CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2019,47 +2045,51 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' 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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else enable_static=yes fi; + # This is required to get past a stupid configure bug when making the rpm. # Basically it is broken to specify the host as a command line argument to # configure on its own, i.e. without giving --host=. It is supposed to work @@ -3383,35 +3413,98 @@ fi 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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else enable_fast_install=yes fi; -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +SED=$lt_cv_path_SED + fi +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 + +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 + 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then @@ -3423,8 +3516,8 @@ 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 + echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -3434,12 +3527,12 @@ echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 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'` + # Canonicalize the pathname 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%/%"` + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -3463,22 +3556,26 @@ if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do + IFS="$lt_save_ifs" 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 + case `"$lt_cv_path_LD" -v 2>&1 &6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then +case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 @@ -3522,7 +3622,11 @@ 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" +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 @@ -3533,120 +3637,42 @@ else # Let the user override the test. lt_cv_path_NM="$NM" else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" 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 + 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 + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) 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 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + 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 + ;; + esac + esac fi done - IFS="$ac_save_ifs" + IFS="$lt_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi - +echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6 NM="$lt_cv_path_NM" -echo "$as_me:$LINENO: result: $NM" >&5 -echo "${ECHO_T}$NM" >&6 - -echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_executable_p="test -f" -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_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" - fi - done - done -done - - # 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 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/sed$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - { (exit 1); exit 1; } -} - _max=0 - _count=0 - # Add /usr/xpg4/bin/sed as it is typically found on Solaris - # along with /bin/sed that truncates output. - for _sed in $_sed_list /usr/xpg4/bin/sed; do - test ! -f ${_sed} && break - cat /dev/null > "$tmp/sed.in" - _count=0 - echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" - # Check for GNU sed and select it if it is found. - if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then - lt_cv_path_SED=${_sed} - break - fi - while true; do - cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" - mv "$tmp/sed.tmp" "$tmp/sed.in" - cp "$tmp/sed.in" "$tmp/sed.nl" - echo >>"$tmp/sed.nl" - ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break - cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break - # 40000 chars as input seems more than enough - test $_count -gt 10 && break - _count=`expr $_count + 1` - if test $_count -gt $_max; then - _max=$_count - lt_cv_path_SED=$_sed - fi - done - done - rm -rf "$tmp" - -fi - -if test "X$SED" != "X"; then - lt_cv_path_SED=$SED -else - SED=$lt_cv_path_SED -fi -echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6 echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 @@ -3663,7 +3689,7 @@ lt_cv_deplibs_check_method='unknown' # '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. +# which responds to the $file_magic_cmd with a given extended 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. @@ -3682,25 +3708,24 @@ bsdi4*) lt_cv_file_magic_test_file=/shlib/libc.so ;; -cygwin* | mingw* | pw32*) +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump'. 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac + lt_cv_deplibs_check_method=pass_all ;; -freebsd*) +freebsd* | kfreebsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then case $host_cpu in i*86 ) @@ -3720,50 +3745,53 @@ 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' +hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + 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_test_file=/usr/lib/libc.sl + ;; + esac ;; irix5* | irix6* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # 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" - ;; + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; 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*) +linux*) case $host_cpu in - alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) + alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM + # this will be overridden with pass_all, but let us keep it just in case 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` + lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; @@ -3773,6 +3801,10 @@ newos6*) lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + openbsd*) lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` @@ -3784,9 +3816,6 @@ openbsd*) ;; 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 ;; @@ -3795,11 +3824,6 @@ sco3.2v5*) ;; 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 ;; @@ -3826,6 +3850,10 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ;; esac ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; esac fi @@ -3833,211 +3861,215 @@ 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 +test -z "$deplibs_check_method" && deplibs_check_method=unknown +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +# 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 && enable_libtool_lock=yes -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo "$as_me:$LINENO: checking command to parse $NM output" >&5 -echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris* | sysv5*) - symcode='[BDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $host_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[ABCDGISTW]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. -lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext < 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 - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 3907 "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); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + 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 + fi + rm -rf conftest* + ;; - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_lib64_suffix=no + 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*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + lt_cv_cc_lib64_suffix=yes + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + lt_cv_cc_lib64_suffix=yes + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + lt_cv_cc_lib64_suffix=yes + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + lt_cv_cc_lib64_suffix=yes + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; -EOF - # Now generate the symbol file. - eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' +*-*-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 -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = +int +main () { -EOF - sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr) 0} -}; -#ifdef __cplusplus + ; + return 0; } -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); } && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" -if test -z "$lt_cv_sys_global_symbol_pipe"; then - global_symbol_to_cdecl= - global_symbol_to_c_name_address= + (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 - global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" - global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no fi -if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; -then - echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6 -else - echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6 +rm -f conftest.err 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 + +need_locks="$enable_libtool_lock" + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4274,21 +4306,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 - 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - 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 @@ -4677,150 +4694,1358 @@ fi done - - - - - -# 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 +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + 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_CXX+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 <&2 + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -*** 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 +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&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 + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +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_CXX+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 <&2 + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -*** 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 +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# 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 &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +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_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" else - MAGIC_CMD=: + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + '' \ + '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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err 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 + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +depcc="$CXX" 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_CXX_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_CXX_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 + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch 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 + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_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 +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +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 + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6 +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +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 \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran + 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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # 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_F77="$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 +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran +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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +echo "${ECHO_T}$ac_ct_F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_F77" && break +done + + F77=$ac_ct_F77 +fi + + +# Provide some information about the compiler. +echo "$as_me:5484:" \ + "checking for Fortran 77 compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err conftest.$ac_objext conftest.$ac_ext +ac_cv_f77_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_f77_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_f77_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= fi fi +G77=`test $ac_compiler_gnu = yes && echo yes` +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 + + + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDRT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + 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); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6 +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES fi ;; esac +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" + 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_AR" && ac_cv_prog_ac_ct_AR="false" +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +fi + 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 @@ -4982,168 +6207,6 @@ else fi -enable_dlopen=no -enable_win32_dll=no - -# 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 && enable_libtool_lock=yes - -# 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 5000 "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* - ;; - -*-*-linux*) - # Test if the compiler is 64bit - echo 'int i;' > conftest.$ac_ext - lt_cv_cc_64bit_output=no - 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 - *"ELF 64"*) - lt_cv_cc_64bit_output=yes - ;; - 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 -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" -need_locks="$enable_libtool_lock" - old_CC="$CC" old_CFLAGS="$CFLAGS" @@ -5152,40 +6215,18 @@ test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm +test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o -if test x"$host" != x"$build"; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case $host_os in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' @@ -5203,24 +6244,150 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="$2" - -echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs +# 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 - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -echo "$as_me:$LINENO: result: $objdir" >&5 -echo "${ECHO_T}$objdir" >&6 + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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 + +enable_dlopen=no +enable_win32_dll=no + +# 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 && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. @@ -5232,453 +6399,445 @@ else fi; test -z "$pic_mode" && pic_mode=default -# We assume here that the value for lt_cv_prog_cc_pic will not be cached -# in isolation, and that seeing it set (from the cache) indicates that -# the associated values are set (in the cache) correctly too. -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 -if test "${lt_cv_prog_cc_pic+set}" = set; then +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +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 + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# +# Check for any special shared library compilation flags. +# +lt_prog_cc_shlib= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + lt_prog_cc_shlib='-belf' + ;; + esac +fi +if test -n "$lt_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 +if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_cv_prog_cc_pic= - lt_cv_prog_cc_shlib= - lt_cv_prog_cc_wl= - lt_cv_prog_cc_static= - lt_cv_prog_cc_no_builtin= - lt_cv_prog_cc_can_build_shared=$can_build_shared + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_prog_compiler_static" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 + +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6518: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6522: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-static' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' case $host_os in - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # not sure about C++ programs. - lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi ;; + amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. - lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - lt_cv_prog_cc_pic='-fno-common' + lt_prog_compiler_pic='-fno-common' ;; - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no ;; + sysv4*MP*) if test -d /usr/nec; then - lt_cv_prog_cc_pic=-Kconform_pic + lt_prog_compiler_pic=-Kconform_pic fi ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + *) - lt_cv_prog_cc_pic='-fPIC' + lt_prog_compiler_pic='-fPIC' ;; esac else - # PORTME Check for PIC flags for the system compiler. + # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in - aix3* | aix4* | aix5*) - lt_cv_prog_cc_wl='-Wl,' - # All AIX code is PIC. + aix*) + lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_static='-Bstatic' else - lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + hpux9* | hpux10* | hpux11*) - # Is there a better lt_cv_prog_cc_static that works with the bundled CC? - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" - lt_cv_prog_cc_pic='+Z' + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' + lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' + lt_prog_compiler_static='-non_shared' ;; newsos6) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + esac ;; osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' + lt_prog_compiler_static='-non_shared' ;; sco3.2v5*) - lt_cv_prog_cc_pic='-Kpic' - lt_cv_prog_cc_static='-dn' - lt_cv_prog_cc_shlib='-belf' + lt_prog_compiler_pic='-Kpic' + lt_prog_compiler_static='-dn' ;; solaris*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' ;; sunos4*) - lt_cv_prog_cc_pic='-PIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Qoption ld ' + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - uts4*) - lt_cv_prog_cc_pic='-pic' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then - lt_cv_prog_cc_pic='-Kconform_pic' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' fi ;; + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + *) - lt_cv_prog_cc_can_build_shared=no + lt_prog_compiler_can_build_shared=no ;; esac fi -fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic" >&6 -if test -z "$lt_cv_prog_cc_pic"; then - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 -else - echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then - # Check to make sure the pic_flag actually works. - echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 - if test "${lt_cv_prog_cc_pic_works+set}" = set; then +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6751: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6755: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works=yes + fi + fi + $rm conftest* -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - case $host_os in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then - # they create non-PIC objects. So, if there were any warnings, we - # assume that PIC is not supported. - if test -s conftest.err; then - lt_cv_prog_cc_pic_works=no - else - lt_cv_prog_cc_pic_works=yes - fi - ;; - *) - lt_cv_prog_cc_pic_works=yes - ;; - esac +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 +if test x"$lt_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - lt_cv_prog_cc_pic_works=no - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no fi - - if test "X$lt_cv_prog_cc_pic_works" = Xno; then - lt_cv_prog_cc_pic= - lt_cv_prog_cc_can_build_shared=no - else - lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" - fi - - echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac -# Check for any special shared library compilation flags. -if test -n "$lt_cv_prog_cc_shlib"; then - { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - -echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 -if test "${lt_cv_prog_cc_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_cc_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_prog_cc_static_works=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi - - -# Belt *and* braces to stop my trousers falling down: -test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 - -pic_flag="$lt_cv_prog_cc_pic" -special_shlib_compile_flags="$lt_cv_prog_cc_shlib" -wl="$lt_cv_prog_cc_wl" -link_static_flag="$lt_cv_prog_cc_static" -no_builtin_flag="$lt_cv_prog_cc_no_builtin" -can_build_shared="$lt_cv_prog_cc_can_build_shared" - - -# Check to see if options -o and -c are simultaneously supported by compiler echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_compiler_c_o+set}" = set; then +if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -echo "int some_variable = 0;" > conftest.$ac_ext -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" -compiler_c_o=no -if { (eval echo configure:5576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - lt_cv_compiler_c_o=no - else - lt_cv_compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&5 - lt_cv_compiler_c_o=no -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6811: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:6815: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 -compiler_c_o=$lt_cv_compiler_c_o -echo "$as_me:$LINENO: result: $compiler_c_o" >&5 -echo "${ECHO_T}$compiler_c_o" >&6 -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 - if test "${lt_cv_compiler_o_lo+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - lt_cv_compiler_o_lo=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - save_objext="$ac_objext" - ac_objext=lo - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -int some_variable = 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - lt_cv_compiler_o_lo=no - else - lt_cv_compiler_o_lo=yes - fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_objext="$save_objext" - CFLAGS="$save_CFLAGS" - -fi - - compiler_o_lo=$lt_cv_compiler_o_lo - echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 -echo "${ECHO_T}$compiler_o_lo" >&6 -else - compiler_o_lo=no -fi - -# Check to see if we can do hard links to lock some files if needed hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 @@ -5699,15 +6858,324 @@ else need_locks=no fi -if test "$GCC" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 - echo "int some_variable = 0;" > conftest.$ac_ext - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" - compiler_rtti_exceptions=no - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag= + enable_shared_with_static_runtimes=no + archive_cmds= + archive_expsym_cmds= + old_archive_From_new_cmds= + old_archive_from_expsyms_cmds= + export_dynamic_flag_spec= + whole_archive_flag_spec= + thread_safe_flag_spec= + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + link_all_deplibs=unknown + hardcode_automatic=no + module_cmds= + module_expsym_cmds= + always_export_symbols=no + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds="$tmp_archive_cmds" + fi + else + ld_shlibs=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5717,14 +7185,14 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -int some_variable = 0; + ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -5738,788 +7206,583 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { 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 - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - compiler_rtti_exceptions=no - else - compiler_rtti_exceptions=yes - fi +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$compiler_rtti_exceptions" >&6 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi -fi + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -# See if the linker supports building shared libraries. -echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 +int +main () +{ -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -old_archive_from_expsyms_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_into_libs=no -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -link_all_deplibs=unknown -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. -extract_expsyms_cmds= + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 -case $host_os in -cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; -openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ - sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ - test -f $output_objdir/impgen.exe || (cd $output_objdir && \ - if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ - else $CC -o impgen impgen.c ; fi)~ - $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' - - old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' - - # cygwin and mingw dlls have different entry points and sets of symbols - # to exclude. - # FIXME: what about values for MSVC? - dll_entry=__cygwin_dll_entry@12 - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ - case $host_os in - mingw*) - # mingw values - dll_entry=_DllMainCRTStartup@12 - dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ - ;; - esac - - # mingw and cygwin differ, and it's simplest to just exclude the union - # of the two symbol sets. - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one (in ltdll.c) - if test "x$lt_cv_need_dllmain" = "xyes"; then - ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " - ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ - test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' - else - ltdll_obj= - ltdll_cmds= - fi - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left be newer dlltools. - export_symbols_cmds="$ltdll_cmds"' - $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' - - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is. - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname-def; - else - echo EXPORTS > $output_objdir/$soname-def; - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \$# in - 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; - 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; - *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done; - fi~ - '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw* | pw32*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - hardcode_direct=yes - archive_cmds='' - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - shared_flag='${wl}-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec=' ' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi - fi - - # It seems that -bexpall can do strange things, so it is better to - # generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='${wl}-berok' - # This is a bit strange, but is similar to how AIX traditionally builds - # it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' ;; - *) # Darwin 1.3 on - allow_undefined_flag='-flat_namespace -undefined suppress' + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' - # We need to add '_' to the symbols in $export_symbols first - #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - hardcode_direct=yes - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load $convenience' - ;; - freebsd1*) - ld_shlibs=no - ;; + bsdi4*) + export_dynamic_flag_spec=-rdynamic + ;; - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case $host_os in - hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else + darwin* | rhapsody*) + if test "$GXX" = yes ; then + archive_cmds_need_lc=no case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - #Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - export_dynamic_flag_spec='${wl}-Bexport' - ;; - - solaris*) - # gcc --version < 3.0 without binutils cannot create self contained - # shared libraries reliably, requiring libgcc.a to resolve some of - # the object symbols generated in some cases. Libraries that use - # assert need libgcc.a to resolve __eprintf, for example. Linking - # a copy of libgcc.a into every shared library to guarantee resolving - # such symbols causes other problems: According to Tim Van Holder - # , C++ libraries end up with a separate - # (to the application) exception stack for one thing. - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - [12].*) - cat <&2 - -*** Warning: Releases of GCC earlier than version 3.0 cannot reliably -*** create self contained shared libraries on Solaris systems, without -*** introducing a dependency on libgcc.a. Therefore, libtool is disabling -*** -no-undefined support, which will at least allow you to build shared -*** libraries. However, you may find that when you link such libraries -*** into an application without using GCC, you have to manually add -*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to -*** upgrade to a newer version of GCC. Another option is to rebuild your -*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. - -EOF - no_undefined_flag= + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag='-undefined dynamic_lookup' + ;; + esac + fi ;; esac - fi - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='-all_load $convenience' + link_all_deplibs=yes else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + ld_shlibs=no fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; + ;; - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; + freebsd1*) + ld_shlibs=no + ;; - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - sysv4*MP*) - if test -d /usr/nec; then + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + ia64*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + hardcode_shlibpath_var=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + *) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld='-rpath $libdir' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no + export_dynamic_flag_spec='${wl}-Bexport' runpath_var=LD_RUN_PATH hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; + ;; - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; + solaris*) + no_undefined_flag=' -z text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; - sysv5uw7* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + fi - *) - ld_shlibs=no - ;; - esac -fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no -# Check hardcoding attributes. -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +echo "${ECHO_T}$archive_cmds_need_lc" >&6 + ;; + esac fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6 + ;; +esac -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -reload_cmds='$LD$reload_flag -o $output$reload_objs' -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -# PORTME Fill in your ld.so characteristics echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -6528,17 +7791,36 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) @@ -6548,7 +7830,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -6558,43 +7840,41 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can - # not hardcode correct soname into executable. Probably we can - # add versioning support to collect2, so additional links can - # be useful in future. + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}.so$major' + soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi - hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) - library_names_spec='${libname}.so' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -6602,13 +7882,12 @@ beos*) bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -6616,29 +7895,55 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows + shrext_cmds=".dll" need_version=no need_lib_prefix=no + case $GCC,$host_os in - yes,cygwin*) + yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog .libs/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac ;; - yes,mingw*) - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` - ;; - yes,pw32*) - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' - ;; + *) - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -6651,30 +7956,56 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' - soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -6683,7 +8014,11 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - *) + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -6694,8 +8029,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -6703,14 +8038,45 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. - dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -6718,21 +8084,29 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) version_type=irix ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -6741,20 +8115,21 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) +linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. -linux-gnu*) +linux*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -6763,12 +8138,17 @@ linux-gnu*) # before this can be enabled. hardcode_into_libs=yes - case $host_cpu:$lt_cv_cc_64bit_output in - powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" - ;; - esac + libsuff= + if test "$lt_cv_cc_lib64_suffix" = "yes"; then + libsuff=64 + fi + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} $lt_ld_extra" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} /usr/local/lib${libsuff} $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -6779,17 +8159,29 @@ linux-gnu*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -6799,7 +8191,17 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -6807,47 +8209,48 @@ newsos6) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case "$host_os" in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' + shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf + need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; @@ -6855,8 +8258,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -6866,7 +8269,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -6878,8 +8281,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -6900,31 +8303,22 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + *) dynamic_linker=no ;; @@ -6933,42 +8327,33 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no -# Report the final consequences. -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var " || \ + test "X$hardcode_automatic"="Xyes" ; then -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported @@ -6979,9 +8364,33 @@ elif test "$shlibpath_overrides_runpath" = yes || enable_fast_install=needless fi -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac fi if test "x$enable_dlopen" != xyes; then @@ -6999,11 +8408,94 @@ else lt_cv_dlopen_self=yes ;; - cygwin* | mingw* | pw32*) + mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 @@ -7487,7 +8979,7 @@ fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" @@ -7503,10 +8995,10 @@ else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 fi -if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - if test "${lt_cv_archive_cmds_need_lc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - $rm conftest* - echo 'static int dummy;' > conftest.$ac_ext +# Report which librarie types wil actually be built +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 - 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 - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_cv_prog_cc_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - lt_cv_archive_cmds_need_lc=no +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + darwin* | rhapsody*) + if test "$GCC" = yes; then + archive_cmds_need_lc=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='-flat_namespace -undefined suppress' else - lt_cv_archive_cmds_need_lc=yes + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag='-undefined dynamic_lookup' + ;; + esac fi - allow_undefined_flag=$save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi -fi - - echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 -echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac + output_verbose_link_cmd='echo' + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='-all_load $convenience' + link_all_deplibs=yes + else + ld_shlibs=no + fi ;; - esac -fi -need_lc=${lt_cv_archive_cmds_need_lc-yes} +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 -# The second clause should only fire when bootstrapping the +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +# The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - : -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi - -if test -f "$ltmain"; then - trap "$rm \"${ofile}T\"; exit 1" 1 2 15 - $rm -f "${ofile}T" - - echo creating $ofile - + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS SED \ - AR AR_FLAGS CC LD LN_S NM SHELL \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ - postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ - old_striplib striplib file_magic_cmd export_symbols_cmds \ - deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - global_symbol_to_c_name_address \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + old_postinstall_cmds old_postuninstall_cmds \ + compiler \ + CC \ + LD \ + lt_prog_compiler_wl \ + lt_prog_compiler_pic \ + lt_prog_compiler_static \ + lt_prog_compiler_no_builtin_flag \ + export_dynamic_flag_spec \ + thread_safe_flag_spec \ + whole_archive_flag_spec \ + enable_shared_with_static_runtimes \ + old_archive_cmds \ + old_archive_from_new_cmds \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + exclude_expsyms \ + include_expsyms; do case $var in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -7820,14 +9354,29 @@ if test -f "$ltmain"; then esac done - cat <<__EOF__ > "${ofile}T" + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" #! $SHELL -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -7849,16 +9398,19 @@ if test -f "$ltmain"; then # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed that does not truncate output. +# A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="${SED} -e s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +# The names of the tagged configurations supported by this script. +available_tags= + # ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -7873,7 +9425,10 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$need_lc +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -7889,12 +9444,18 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# The default C compiler. -CC=$lt_CC +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC +# An ERE matcher. +EGREP=$lt_EGREP + # The linker used to build libraries. LD=$lt_LD @@ -7905,7 +9466,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$STRIP +STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -7927,7 +9488,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_wl +wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -7935,18 +9496,21 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_pic_flag +pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_compiler_c_o +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len -# Can we write directly to a .lo ? -compiler_o_lo=$lt_compiler_o_lo +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -7967,10 +9531,10 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_link_static_flag +link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_no_builtin_flag +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec @@ -8012,10 +9576,34 @@ archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -8035,13 +9623,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_global_symbol_pipe +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -8062,10 +9650,15 @@ hardcode_into_libs=$hardcode_into_libs # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct @@ -8077,6 +9670,10 @@ hardcode_minus_L=$hardcode_minus_L # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic + # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" @@ -8112,9 +9709,10 @@ include_expsyms=$lt_include_expsyms __EOF__ + case $host_os in aix3*) - cat <<\EOF >> "${ofile}T" + cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -8123,186 +9721,6 @@ if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi -EOF - ;; - esac - - case $host_os in - cygwin* | mingw* | pw32* | os2*) - cat <<'EOF' >> "${ofile}T" - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# 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 of the License, 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. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# /* O_BINARY isn't required (or even defined sometimes) under Unix */ -# #ifndef O_BINARY -# #define O_BINARY 0 -# #endif -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (dll < 1) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - mv -f "${ofile}T" "$ofile" || \ - (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi 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 + +CC="$lt_save_CC" + + +# Check whether --with-tags or --without-tags was given. +if test "${with_tags+set}" = set; then + withval="$with_tags" + tagnames="$withval" +fi; + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} + else + { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 +echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in + "") ;; + *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 +echo "$as_me: error: invalid tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 +echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} + { (exit 1); exit 1; }; } + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_flag_spec_ld_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_automatic_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +compiler_CXX=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +else + lt_prog_compiler_no_builtin_flag_CXX= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + +# 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 $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $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. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname 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 + 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 + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + 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. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +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. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 +ld_shlibs_CXX=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_CXX=yes + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_CXX=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX=' ' + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs_CXX=no + fi + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes; then + archive_cmds_need_lc_CXX=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag_CXX='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='-all_load $convenience' + link_all_deplibs_CXX=yes + else + ld_shlibs_CXX=no + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + freebsd12*) + # C++ shared libraries reported to be fairly broken before switch to ELF + ld_shlibs_CXX=no + ;; + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + gnu*) + ;; + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC) + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_CXX='+b $libdir' + hardcode_libdir_separator_CXX=: + ;; + ia64*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + *) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + archive_cmds_need_lc_CXX=no + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + sco*) + archive_cmds_need_lc_CXX=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.0-5 | solaris2.0-5.*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + archive_cmds_need_lc_CXX=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; +esac +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +GCC_CXX="$GXX" +LD_CXX="$LD" + + +cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + +lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + icpc) + # Intel C++ + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11278: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:11282: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 + +if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11338: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:11342: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_CXX=no + else + archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + libsuff= + if test "$lt_cv_cc_lib64_suffix" = "yes"; then + libsuff=64 + fi + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} $lt_ld_extra" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} /usr/local/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var CXX" || \ + test "X$hardcode_automatic_CXX"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 +echo "${ECHO_T}$hardcode_action_CXX" >&6 + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_CXX \ + CC_CXX \ + LD_CXX \ + lt_prog_compiler_wl_CXX \ + lt_prog_compiler_pic_CXX \ + lt_prog_compiler_static_CXX \ + lt_prog_compiler_no_builtin_flag_CXX \ + export_dynamic_flag_spec_CXX \ + thread_safe_flag_spec_CXX \ + whole_archive_flag_spec_CXX \ + enable_shared_with_static_runtimes_CXX \ + old_archive_cmds_CXX \ + old_archive_from_new_cmds_CXX \ + predep_objects_CXX \ + postdep_objects_CXX \ + predeps_CXX \ + postdeps_CXX \ + compiler_lib_search_path_CXX \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_CXX + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_CXX +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_CXX + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_CXX" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld + + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + +archive_cmds_need_lc_F77=no +allow_undefined_flag_F77= +always_export_symbols_F77=no +archive_expsym_cmds_F77= +export_dynamic_flag_spec_F77= +hardcode_direct_F77=no +hardcode_libdir_flag_spec_F77= +hardcode_libdir_flag_spec_ld_F77= +hardcode_libdir_separator_F77= +hardcode_minus_L_F77=no +hardcode_automatic_F77=no +module_cmds_F77= +module_expsym_cmds_F77= +link_all_deplibs_F77=unknown +old_archive_cmds_F77=$old_archive_cmds +no_undefined_flag_F77= +whole_archive_flag_spec_F77= +enable_shared_with_static_runtimes_F77=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +objext_F77=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code=" subroutine t\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +compiler_F77=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4* | aix5*) + test "$enable_shared" = yes && enable_static=no + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +test "$ld_shlibs_F77" = no && can_build_shared=no + +GCC_F77="$G77" +LD_F77="$LD" + +lt_prog_compiler_wl_F77= +lt_prog_compiler_pic_F77= +lt_prog_compiler_static_F77= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_static_F77='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_F77=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_F77=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_F77='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + else + lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-static' + ;; + ccc*) + lt_prog_compiler_wl_F77='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_F77='-Kpic' + lt_prog_compiler_static_F77='-dn' + ;; + + solaris*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl_F77='-Qoption ld ' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_F77='-Kconform_pic' + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic_F77='-pic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_F77"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13630: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:13634: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 + +if test x"$lt_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_F77=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13690: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:13694: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_F77=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_F77= + enable_shared_with_static_runtimes_F77=no + archive_cmds_F77= + archive_expsym_cmds_F77= + old_archive_From_new_cmds_F77= + old_archive_from_expsyms_cmds_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + thread_safe_flag_spec_F77= + hardcode_libdir_flag_spec_F77= + hardcode_libdir_flag_spec_ld_F77= + hardcode_libdir_separator_F77= + hardcode_direct_F77=no + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=unsupported + link_all_deplibs_F77=unknown + hardcode_automatic_F77=no + module_cmds_F77= + module_expsym_cmds_F77= + always_export_symbols_F77=no + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_F77= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_F77=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + sunos4*) + archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds_F77="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_F77="$tmp_archive_cmds" + fi + else + ld_shlibs_F77=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + + if test "$ld_shlibs_F77" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=yes + archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_F77=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_F77=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_F77=yes + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_F77=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_F77='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_F77="-z nodefs" + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_F77=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_F77=' ' + archive_cmds_need_lc_F77=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_F77=no + ;; + + bsdi4*) + export_dynamic_flag_spec_F77=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_F77=' ' + allow_undefined_flag_F77=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_F77='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_F77=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + archive_cmds_need_lc_F77=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag_F77='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_F77=no + hardcode_automatic_F77=yes + hardcode_shlibpath_var_F77=unsupported + whole_archive_flag_spec_F77='-all_load $convenience' + link_all_deplibs_F77=yes + else + ld_shlibs_F77=no + fi + ;; + + dgux*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + freebsd1*) + ld_shlibs_F77=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_F77='+b $libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + ;; + ia64*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + *) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + link_all_deplibs_F77=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_F77='-rpath $libdir' + fi + hardcode_libdir_separator_F77=: + ;; + + sco3.2v5*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_F77=' -z text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_shlibpath_var_F77=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs_F77=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_F77='$CC -r -o $output$reload_objs' + hardcode_direct_F77=no + ;; + motorola) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv4.3*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_F77=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_F77='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv5*) + no_undefined_flag_F77=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_F77= + hardcode_shlibpath_var_F77=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + *) + ld_shlibs_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 +echo "${ECHO_T}$ld_shlibs_F77" >&6 +test "$ld_shlibs_F77" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_F77" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_F77=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_F77 in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_F77 + allow_undefined_flag_F77= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_F77=no + else + archive_cmds_need_lc_F77=yes + fi + allow_undefined_flag_F77=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + libsuff= + if test "$lt_cv_cc_lib64_suffix" = "yes"; then + libsuff=64 + fi + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} $lt_ld_extra" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} /usr/local/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var F77" || \ + test "X$hardcode_automatic_F77"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 +echo "${ECHO_T}$hardcode_action_F77" >&6 + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_F77 \ + CC_F77 \ + LD_F77 \ + lt_prog_compiler_wl_F77 \ + lt_prog_compiler_pic_F77 \ + lt_prog_compiler_static_F77 \ + lt_prog_compiler_no_builtin_flag_F77 \ + export_dynamic_flag_spec_F77 \ + thread_safe_flag_spec_F77 \ + whole_archive_flag_spec_F77 \ + enable_shared_with_static_runtimes_F77 \ + old_archive_cmds_F77 \ + old_archive_from_new_cmds_F77 \ + predep_objects_F77 \ + postdep_objects_F77 \ + predeps_F77 \ + postdeps_F77 \ + compiler_lib_search_path_F77 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_F77 + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_F77 + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_F77 +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_F77 + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_F77 +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_F77 +archive_expsym_cmds=$lt_archive_expsym_cmds_F77 +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_F77 +module_expsym_cmds=$lt_module_expsym_cmds_F77 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_F77 + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_F77 + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_F77 + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_F77 + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_F77 + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_F77 + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_F77 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_F77 + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_F77" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + + + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +objext_GCJ=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +compiler_GCJ=$CC + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +archive_cmds_need_lc_GCJ=no + + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:15730: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:15734: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl_GCJ= +lt_prog_compiler_pic_GCJ= +lt_prog_compiler_static_GCJ= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_static_GCJ='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_GCJ=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_GCJ=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_GCJ='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + else + lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-static' + ;; + ccc*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_GCJ='-Kpic' + lt_prog_compiler_static_GCJ='-dn' + ;; + + solaris*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl_GCJ='-Qoption ld ' + lt_prog_compiler_pic_GCJ='-PIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_GCJ='-Kconform_pic' + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic_GCJ='-pic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_GCJ"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:15963: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:15967: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 + +if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_GCJ=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16023: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:16027: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_GCJ=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_GCJ= + enable_shared_with_static_runtimes_GCJ=no + archive_cmds_GCJ= + archive_expsym_cmds_GCJ= + old_archive_From_new_cmds_GCJ= + old_archive_from_expsyms_cmds_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + thread_safe_flag_spec_GCJ= + hardcode_libdir_flag_spec_GCJ= + hardcode_libdir_flag_spec_ld_GCJ= + hardcode_libdir_separator_GCJ= + hardcode_direct_GCJ=no + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=unsupported + link_all_deplibs_GCJ=unknown + hardcode_automatic_GCJ=no + module_cmds_GCJ= + module_expsym_cmds_GCJ= + always_export_symbols_GCJ=no + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_GCJ= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_GCJ=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + sunos4*) + archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds_GCJ="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_GCJ="$tmp_archive_cmds" + fi + else + ld_shlibs_GCJ=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + + if test "$ld_shlibs_GCJ" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=yes + archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_GCJ=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_GCJ=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_GCJ=yes + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_GCJ=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_GCJ='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_GCJ="-z nodefs" + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_GCJ=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_GCJ=' ' + archive_cmds_need_lc_GCJ=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_GCJ=no + ;; + + bsdi4*) + export_dynamic_flag_spec_GCJ=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_GCJ=' ' + allow_undefined_flag_GCJ=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_GCJ='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_GCJ=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + archive_cmds_need_lc_GCJ=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_GCJ=no + hardcode_automatic_GCJ=yes + hardcode_shlibpath_var_GCJ=unsupported + whole_archive_flag_spec_GCJ='-all_load $convenience' + link_all_deplibs_GCJ=yes + else + ld_shlibs_GCJ=no + fi + ;; + + dgux*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + freebsd1*) + ld_shlibs_GCJ=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + ;; + ia64*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + *) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + link_all_deplibs_GCJ=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + allow_undefined_flag_GCJ=unsupported + archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_GCJ='-rpath $libdir' + fi + hardcode_libdir_separator_GCJ=: + ;; + + sco3.2v5*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_GCJ=' -z text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_shlibpath_var_GCJ=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs_GCJ=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_GCJ='$CC -r -o $output$reload_objs' + hardcode_direct_GCJ=no + ;; + motorola) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4.3*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_GCJ=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_GCJ='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv5*) + no_undefined_flag_GCJ=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_GCJ= + hardcode_shlibpath_var_GCJ=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + *) + ld_shlibs_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 +echo "${ECHO_T}$ld_shlibs_GCJ" >&6 +test "$ld_shlibs_GCJ" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_GCJ" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_GCJ=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_GCJ in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ + allow_undefined_flag_GCJ= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_GCJ=no + else + archive_cmds_need_lc_GCJ=yes + fi + allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + libsuff= + if test "$lt_cv_cc_lib64_suffix" = "yes"; then + libsuff=64 + fi + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} $lt_ld_extra" + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} /usr/local/lib${libsuff} $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var GCJ" || \ + test "X$hardcode_automatic_GCJ"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 +echo "${ECHO_T}$hardcode_action_GCJ" >&6 + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_GCJ \ + CC_GCJ \ + LD_GCJ \ + lt_prog_compiler_wl_GCJ \ + lt_prog_compiler_pic_GCJ \ + lt_prog_compiler_static_GCJ \ + lt_prog_compiler_no_builtin_flag_GCJ \ + export_dynamic_flag_spec_GCJ \ + thread_safe_flag_spec_GCJ \ + whole_archive_flag_spec_GCJ \ + enable_shared_with_static_runtimes_GCJ \ + old_archive_cmds_GCJ \ + old_archive_from_new_cmds_GCJ \ + predep_objects_GCJ \ + postdep_objects_GCJ \ + predeps_GCJ \ + postdeps_GCJ \ + compiler_lib_search_path_GCJ \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_GCJ + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_GCJ + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_GCJ + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_GCJ + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_GCJ +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_GCJ + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_GCJ +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_GCJ +archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_GCJ +module_expsym_cmds=$lt_module_expsym_cmds_GCJ + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_GCJ + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_GCJ + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_GCJ + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_GCJ + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_GCJ + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_GCJ + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_GCJ + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_GCJ + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_GCJ" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + RC) + + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +compiler_RC=$CC +lt_cv_prog_compiler_c_o_RC=yes + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_RC \ + CC_RC \ + LD_RC \ + lt_prog_compiler_wl_RC \ + lt_prog_compiler_pic_RC \ + lt_prog_compiler_static_RC \ + lt_prog_compiler_no_builtin_flag_RC \ + export_dynamic_flag_spec_RC \ + thread_safe_flag_spec_RC \ + whole_archive_flag_spec_RC \ + enable_shared_with_static_runtimes_RC \ + old_archive_cmds_RC \ + old_archive_from_new_cmds_RC \ + predep_objects_RC \ + postdep_objects_RC \ + predeps_RC \ + postdeps_RC \ + compiler_lib_search_path_RC \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_RC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_RC + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_RC +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_RC + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_RC + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_RC + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_RC" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + ;; + + *) + { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 +echo "$as_me: error: Unsupported tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 +echo "$as_me: error: unable to update list of available tagged configurations." >&2;} + { (exit 1); exit 1; }; } + fi +fi @@ -8331,6 +19304,24 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion + + + + + + + + + + + + + + + + + + # Enable large file support. # Check whether --enable-largefile or --disable-largefile was given. @@ -11803,6 +22794,13 @@ 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 +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -12415,11 +23413,23 @@ 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,@EGREP@,$EGREP,;t t s,@ECHO@,$ECHO,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@CXXCPP@,$CXXCPP,;t t +s,@F77@,$F77,;t t +s,@FFLAGS@,$FFLAGS,;t t +s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t diff --git a/doc/Makefile.in b/doc/Makefile.in index 8c5f180f..3a3a27d1 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -52,6 +52,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -62,6 +63,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -73,6 +78,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -102,13 +109,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/include/Makefile.in b/include/Makefile.in index 085ce4ee..be3a902c 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -61,6 +61,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -71,6 +72,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -82,6 +87,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -111,13 +118,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index a80d3671..5d26253c 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -65,6 +65,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -75,6 +76,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -86,6 +91,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -115,13 +122,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/install-sh b/install-sh index 6ebe46de..0b65ee87 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-12-17.09 +scriptversion=2004-10-22.00 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -296,7 +296,7 @@ do || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 + (exit 1); exit } else : @@ -307,12 +307,12 @@ do $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } - fi || { (exit 1); exit 1; } + fi || { (exit 1); exit; } done # The final little trick to "correctly" pass the exit status to the exit trap. { - (exit 0); exit 0 + (exit 0); exit } # Local variables: diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 962e313a..ad75eb67 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -107,11 +107,11 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) @@ -127,6 +127,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -137,6 +138,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -148,6 +153,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -177,13 +184,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -408,18 +420,18 @@ distclean-compile: @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c mostlyclean-libtool: -rm -f *.lo diff --git a/ltmain.sh b/ltmain.sh index 239bdefb..6828dc0e 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -24,6 +24,32 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# define SED for historic ltconfig's generated by Libtool 1.3 +test -z "$SED" && SED=sed + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=1.5.6 +TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)" + + # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. @@ -36,7 +62,7 @@ elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : else # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$0" --no-reexec ${1+"$@"} + exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then @@ -45,22 +71,9 @@ if test "X$1" = X--fallback-echo; then cat <&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 + $echo "$modename: not configured to build any kind of library" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE fi # Global variables. @@ -117,8 +131,131 @@ execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () { + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` + if test "X$win32_nmres" = "Ximport" ; then + win32_libid_type="x86 archive import" + else + win32_libid_type="x86 archive static" + fi + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () { + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} +# End of Shell function definitions +##################################### + +# Darwin sucks +#eval std_shrext=\"$shrext_cmds\" + +# And fixing for Darwin sucks for everybody else +if test -z "$shrext_cmds" && test -n "$shrext"; then + eval shrext_cmds=\"$shrext\" +fi +eval std_shrext=\"$shrext_cmds\" + +# This value is evaluated to 32768, so place it here as a compatilibity hack +# because older libtool.m4 didn't define this variable +test -z "$max_cmd_len" && max_cmd_len=32768 + # Parse our command line options once, thoroughly. -while test $# -gt 0 +while test "$#" -gt 0 do arg="$1" shift @@ -134,6 +271,34 @@ do execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; *) eval "$prev=\$arg" ;; @@ -151,18 +316,27 @@ do ;; --version) - echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - exit 0 + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2003 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $EXIT_SUCCESS ;; --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 - exit 0 + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $EXIT_SUCCESS ;; --debug) - echo "$progname: enabling shell trace mode" + $echo "$progname: enabling shell trace mode" set -x + preserve_args="$preserve_args $arg" ;; --dry-run | -n) @@ -170,18 +344,18 @@ do ;; --features) - echo "host: $host" + $echo "host: $host" if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" + $echo "enable shared libraries" else - echo "disable shared libraries" + $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - echo "enable static libraries" + $echo "enable static libraries" else - echo "disable static libraries" + $echo "disable static libraries" fi - exit 0 + exit $EXIT_SUCCESS ;; --finish) mode="finish" ;; @@ -193,6 +367,15 @@ do --quiet | --silent) show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) prevopt="--tag" prev=tag ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" ;; -dlopen) @@ -203,7 +386,7 @@ do -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; *) @@ -216,18 +399,7 @@ done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 - exit 1 -fi - -# Mandrake: (gc) It's bad to link C++ code with GCC, so we need to use the compiler name if provided -if test "$mode" = link && test -n "$archive_cmds" && test -x "/usr/bin/perl"; then - case $nonopt in - *cc | *++ | gcc* | *-gcc* | egcs*) - archive_cmds=`echo $archive_cmds | perl -pe 's/^\S+\s+//'` - archive_cmds="$nonopt $archive_cmds" - archive_expsym_cmds=`echo $archive_expsym_cmds | perl -pe 's/^\S+\s+//'` - archive_expsym_cmds="$nonopt $archive_expsym_cmds" - esac + exit $EXIT_FAILURE fi # If this variable is set in any of the actions, the command in it @@ -239,8 +411,10 @@ if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 case $nonopt in - *cc | *++ | gcc* | *-gcc* | xlc*) + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do @@ -281,7 +455,7 @@ if test -z "$show_help"; then if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. @@ -295,50 +469,154 @@ if test -z "$show_help"; then modename="$modename: compile" # Get the compilation command and the source file. base_compile= - prev= - lastarg= - srcfile="$nonopt" + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes suppress_output= + arg_mode=normal + libobj= + later= - user_target=no for arg do - case $prev in - "") ;; - xcompiler) - # Aesthetically quote the previous argument. - prev= - lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg_mode" in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; - case $arg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi + target ) + libobj="$arg" + arg_mode=normal continue ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; esac - # Accept any command-line options. - case $arg in - -o) - if test "$user_target" != "no"; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - user_target=next - ;; + base_compile="$base_compile $lastarg" + done # for arg + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in -static) build_old_libs=yes continue @@ -353,138 +631,33 @@ if test -z "$show_help"; then pic_mode=no continue ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - continue - ;; esac - - case $user_target in - next) - # The next one is the -o target name - user_target=yes - continue - ;; - yes) - # We got the output file - user_target=set - libobj="$arg" - continue - ;; - esac - - # Accept the current argument as the source file. - lastarg="$srcfile" - srcfile="$arg" - - # Aesthetically quote the previous argument. - - # Backslashify any backslashes, double quotes, and dollar signs. - # These are the only characters that are still specially - # interpreted inside of double-quoted scrings. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $lastarg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi done - case $user_target in - set) - ;; - no) - # Get the name of the library object. - libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - *) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSfmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit 1 - ;; - esac + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then - removelist="$obj $libobj" + removelist="$obj $lobj $libobj ${libobj}T" else - removelist="$libobj" + removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist - trap "$run $rm $removelist; exit 1" 1 2 15 + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in @@ -503,8 +676,9 @@ if test -z "$show_help"; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit 1" 1 2 15 + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else + output_obj= need_locks=no lockfile= fi @@ -512,13 +686,13 @@ if test -z "$show_help"; then # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then - until $run ln "$0" "$lockfile" 2>/dev/null; do + until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then - echo "\ + $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` @@ -530,68 +704,67 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi - echo $srcfile > "$lockfile" + $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != x"$srcfile"; then - echo "\ + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -606,13 +779,13 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one - if test x"$output_obj" != x"$libobj"; then - $show "$mv $output_obj $libobj" - if $run $mv $output_obj $libobj; then : + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist @@ -620,48 +793,23 @@ compiler." fi fi - # If we have no pic_flag, then copy the object into place and finish. - if (test -z "$pic_flag" || test "$pic_mode" != default) && - test "$build_old_libs" = yes; then - # Rename the .lo from within objdir to obj - if test -f $obj; then - $show $rm $obj - $run $rm $obj - fi + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != x"$srcfile"; then - echo "\ + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -705,11 +851,11 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi # Just move the object if needed - if test x"$output_obj" != x"$obj"; then + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else @@ -719,29 +865,31 @@ compiler." fi fi - # Create an invalid libtool object if no PIC, so that we do not - # accidentally link it into a program. - if test "$build_libtool_libs" != yes; then - $show "echo timestamp > $libobj" - $run eval "echo timestamp > \$libobj" || exit $? - else - # Move the .lo from within objdir - $show "$mv $libobj $lo_libobj" - if $run $mv $libobj $lo_libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then @@ -961,13 +1227,26 @@ compiler." finalize_command="$finalize_command $wl$qarg" continue ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac - fi # test -n $prev + fi # test -n "$prev" prevarg="$arg" @@ -1009,7 +1288,7 @@ compiler." -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" - exit 1 + exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms @@ -1028,7 +1307,7 @@ compiler." # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in - no/*-*-irix* | no/*-*-nonstopux*) + no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; @@ -1045,7 +1324,7 @@ compiler." absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi dir="$absdir" ;; @@ -1083,24 +1362,61 @@ compiler." # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd*) - # Do not include libc_r directly, use -pthread flag. + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" continue - ;; esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac fi deplibs="$deplibs $arg" continue ;; + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + deplibs="$deplibs $arg" + continue + ;; + -module) module=yes continue ;; + # gcc -m* arguments should be passed to the linker via $compiler_flags + # in order to pass architecture information to the linker + # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo + # but this is not reliable with gcc because gcc may use -mfoo to + # select a different linker, different libraries, etc, while + # -Wl,-mfoo simply passes -mfoo to the linker. + -m*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + if test "$with_gcc" = "yes" ; then + compiler_flags="$compiler_flags $arg" + fi + continue + ;; + + -shrext) + prev=shrext + continue + ;; + -no-fast-install) fast_install=no continue @@ -1125,8 +1441,18 @@ compiler." continue ;; + -objectlist) + prev=objectlist + continue + ;; + -o) prev=output ;; + -precious-files-regex) + prev=precious_regex + continue + ;; + -release) prev=release continue @@ -1149,7 +1475,7 @@ compiler." [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac case "$xrpath " in @@ -1177,6 +1503,11 @@ compiler." prev=vinfo continue ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` @@ -1225,6 +1556,11 @@ compiler." continue ;; + -XCClinker) + prev=xcclinker + continue + ;; + # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need @@ -1237,29 +1573,101 @@ compiler." esac ;; - *.lo | *.$objext) - # A library or standard object. - if test "$prev" = dlfiles; then - # This file was specified with -dlopen. - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $arg" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi + *.$objext) + # A standard object. + objs="$objs $arg" + ;; - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` - prev= - else + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. case $arg in - *.lo) libobjs="$libobjs $arg" ;; - *) objs="$objs $arg" ;; + */* | *\\*) . $arg ;; + *) . ./$arg ;; esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi fi ;; @@ -1310,7 +1718,7 @@ compiler." if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then @@ -1319,6 +1727,7 @@ compiler." finalize_command="$finalize_command $arg" fi + oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" @@ -1339,11 +1748,11 @@ compiler." output_objdir="$output_objdir/$objdir" fi # Create the object directory. - if test ! -d $output_objdir; then + if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? - if test $status -ne 0 && test ! -d $output_objdir; then + if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi @@ -1353,7 +1762,7 @@ compiler." "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; @@ -1361,7 +1770,17 @@ compiler." *) linkmode=prog ;; # Anything else should be a program. esac + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac specialdeplibs= + libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) @@ -1373,6 +1792,25 @@ compiler." fi libs="$libs $deplib" done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + deplibs= newdependency_libs= newlib_search_path= @@ -1387,7 +1825,7 @@ compiler." *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac done @@ -1404,39 +1842,59 @@ compiler." ;; esac for pass in $passes; do - if test $linkmode = prog; then - # Determine which files to process + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then case $pass in - dlopen) - libs="$dlfiles" - save_deplibs="$deplibs" # Collect dlpreopened libraries - deplibs= - ;; + dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi for deplib in $libs; do lib= found=no case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + fi + continue + ;; -l*) - if test $linkmode = oldlib && test $linkmode = obj; then - $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - # Search the libtool library - lib="$searchdir/lib${name}.la" - if test -f "$lib"; then - found=yes - break - fi + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library @@ -1445,40 +1903,76 @@ compiler." finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" - test $pass = conv && continue + test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi - if test $pass = scan; then + if test "$pass" = scan; then deplibs="$deplib $deplibs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) - $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) - if test $pass = link; then + if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in @@ -1491,30 +1985,30 @@ compiler." ;; *.la) lib="$deplib" ;; *.$libext) - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) if test "$deplibs_check_method" != pass_all; then - echo - echo "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not used here." + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." else - echo - echo "*** Warning: Linking the shared library $output against the" - echo "*** static library $deplib is not portable!" + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) - if test $pass != link; then + if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -1525,14 +2019,18 @@ compiler." esac # linkmode ;; # *.$libext *.lo | *.$objext) - if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi fi continue ;; @@ -1541,17 +2039,17 @@ compiler." continue ;; esac # case $deplib - if test $found = yes || test -f "$lib"; then : + if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` @@ -1564,8 +2062,9 @@ compiler." library_names= old_library= # If the library was installed with an old release of libtool, - # it will not redefine variable installed. + # it will not redefine variables installed, or shouldnotlink installed=yes + shouldnotlink=no # Read the .la file case $lib in @@ -1575,19 +2074,18 @@ compiler." if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || - { test $linkmode = oldlib && test $linkmode = obj; }; then - # Add dl[pre]opened files of deplib + { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi - if test $pass = conv; then + if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" @@ -1602,13 +2100,14 @@ compiler." fi tmp_libs="$tmp_libs $deplib" done - elif test $linkmode != prog && test $linkmode != lib; then + elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit 1 + exit $EXIT_FAILURE fi continue fi # $pass = conv + # Get the name of the library we link against. linklib= for l in $old_library $library_names; do @@ -1616,19 +2115,23 @@ compiler." done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # This library was specified with -dlopen. - if test $pass = dlopen; then + if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi - if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. - dlprefiles="$dlprefiles $lib" + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi @@ -1669,10 +2172,10 @@ compiler." name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. - if test $pass = dlpreopen; then + if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). @@ -1688,18 +2191,19 @@ compiler." if test -z "$libdir"; then # Link the convenience library - if test $linkmode = lib; then + if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else - deplibs="$lib $deplibs" + deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi - if test $linkmode = prog && test $pass != link; then + + if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" @@ -1715,7 +2219,7 @@ compiler." -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? - if test $linkalldeplibs = yes; then + if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths @@ -1732,13 +2236,19 @@ compiler." continue fi # $linkmode = prog... - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # Link against this shared library + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi - if test "$linkmode,$pass" = "prog,link" || - { test $linkmode = lib && test $hardcode_into_libs = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. @@ -1760,17 +2270,6 @@ compiler." esac ;; esac - if test $linkmode = prog; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - fi fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && @@ -1780,11 +2279,52 @@ compiler." # We only need to search for static libraries continue fi + fi + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname @@ -1798,7 +2338,7 @@ compiler." elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin*) + *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; @@ -1810,17 +2350,18 @@ compiler." # Make a new name for the extract_expsyms_cmds to use soroot="$soname" - soname=`echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" + cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -1831,9 +2372,10 @@ compiler." if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" + cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -1842,9 +2384,9 @@ compiler." # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib - fi # test -n $old_archive_from_expsyms_cmds + fi # test -n "$old_archive_from_expsyms_cmds" - if test $linkmode = prog || test "$mode" != relink; then + if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= @@ -1853,6 +2395,22 @@ compiler." immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" + case $host in + *-*-sco3.2v5* ) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; @@ -1871,6 +2429,14 @@ compiler." add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" @@ -1884,7 +2450,7 @@ compiler." if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 + exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then @@ -1893,7 +2459,7 @@ compiler." *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi - if test $linkmode = prog; then + if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else @@ -1910,9 +2476,8 @@ compiler." fi fi - if test $linkmode = prog || test "$mode" = relink; then + if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= - add_prefix_dir= add_dir= add= # Finalize command for both is simple: just hardcode it. @@ -1927,43 +2492,36 @@ compiler." *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi add="-l$name" fi - - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_prefix_dir="-L$inst_prefix_dir$libdir" - ;; - esac - fi - - # add_prefix_dir must be appended instead, otherwise it can - # possibly be overrided by any hardcoded -L/... path in deplibs - if test $linkmode = prog; then - test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir" + if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else - test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir" test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi - elif test $linkmode = prog; then - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - - # Try to link the static library + elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. @@ -1983,21 +2541,21 @@ compiler." # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - echo - echo "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -2014,10 +2572,11 @@ compiler." fi fi # link shared/static library? - if test $linkmode = lib; then + if test "$linkmode" = lib; then if test -n "$dependency_libs" && - { test $hardcode_into_libs != yes || test $build_old_libs = yes || - test $link_static = yes; }; then + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do @@ -2048,7 +2607,7 @@ compiler." tmp_libs="$tmp_libs $deplib" done - if test $link_all_deplibs != no; then + if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in @@ -2068,22 +2627,67 @@ compiler." ;; esac if grep "^installed=no" $deplib > /dev/null; then - path="-L$absdir/$objdir" + path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi - path="-L$absdir" + path="$absdir" fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac ;; *) continue ;; esac case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac @@ -2091,15 +2695,15 @@ compiler." fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs - if test $pass = dlpreopen; then + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi - if test $pass != dlopen; then - test $pass != scan && dependency_libs="$newdependency_libs" - if test $pass != conv; then + if test "$pass" != dlopen; then + if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do @@ -2121,9 +2725,30 @@ compiler." eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) @@ -2151,19 +2776,32 @@ compiler." eval $var=\"$tmp_libs\" done # for var fi - if test "$pass" = "conv" && - { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then - libs="$deplibs" # reset libs - deplibs= - fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs done # for pass - if test $linkmode = prog; then + if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi @@ -2177,7 +2815,7 @@ compiler." fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then @@ -2199,17 +2837,19 @@ compiler." case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` @@ -2220,11 +2860,11 @@ compiler." if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit 1 + exit $EXIT_FAILURE else - echo - echo "*** Warning: Linking the shared library $output against the non-libtool" - echo "*** objects $objs is not portable!" + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi @@ -2234,7 +2874,7 @@ compiler." fi set dummy $rpath - if test $# -gt 2; then + if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" @@ -2243,14 +2883,16 @@ compiler." if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. - libext=al + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then @@ -2266,12 +2908,49 @@ compiler." if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi - current="$2" - revision="$3" - age="$4" + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac # Check that each of the things are valid numbers. case $current in @@ -2279,7 +2958,7 @@ compiler." *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac @@ -2288,7 +2967,7 @@ compiler." *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac @@ -2297,14 +2976,14 @@ compiler." *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac - if test $age -gt $current; then + if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Calculate the version variables. @@ -2345,7 +3024,7 @@ compiler." # Add in all the interfaces that we are compatible with. loop=$revision - while test $loop != 0; do + while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" @@ -2368,7 +3047,7 @@ compiler." # Add in all the interfaces that we are compatible with. loop=$age - while test $loop != 0; do + while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" @@ -2392,20 +3071,19 @@ compiler." *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= - verstring="0.0" case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely - verstring="" + verstring= ;; *) verstring="0.0" @@ -2439,9 +3117,30 @@ compiler." fi if test "$mode" != relink; then - # Remove our outputs. - $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" - $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi fi # Now set the variables for building old libraries. @@ -2454,9 +3153,9 @@ compiler." # Eliminate all temporary directories. for path in $notinst_path; do - lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then @@ -2469,7 +3168,7 @@ compiler." *) finalize_rpath="$finalize_rpath $libdir" ;; esac done - if test $hardcode_into_libs != yes || test $build_old_libs = yes; then + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi @@ -2509,10 +3208,11 @@ compiler." ;; *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue ;; - *) + *) # Add libc to deplibs on all other systems if necessary. - if test $build_libtool_need_lc = "yes"; then + if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; @@ -2539,7 +3239,7 @@ compiler." # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behaviour. + # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) @@ -2552,45 +3252,22 @@ compiler." int main() { return 0; } EOF $rm conftest - $CC -o conftest conftest.c $deplibs - if test $? -eq 0 ; then + $LTCC -o conftest conftest.c $deplibs + if test "$?" -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do name="`expr $i : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - echo - echo "*** Warning: dynamic linker does not accept needed library $i." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which I believe you do not have" - echo "*** because a test_compile did reveal that the linker did not use it for" - echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occured in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - $rm conftest - $CC -o conftest conftest.c $i - # Did it work? - if test $? -eq 0 ; then - ldd_output=`ldd conftest` + if test "$name" != "" && test "$name" -ne "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then libname=`eval \\$echo \"$libname_spec\"` deplib_matches=`eval \\$echo \"$library_names_spec\"` set dummy $deplib_matches @@ -2599,21 +3276,64 @@ EOF newdeplibs="$newdeplibs $i" else droppeddeps=yes - echo - echo "*** Warning: dynamic linker does not accept needed library $i." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because a test_compile did reveal that the linker did not use this one" - echo "*** as a dynamic dependency that programs can get resolved with at runtime." + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which I believe you do not have" + $echo "*** because a test_compile did reveal that the linker did not use it for" + $echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occurred in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" != "0"; then + $rm conftest + $LTCC -o conftest conftest.c $i + # Did it work? + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because a test_compile did reveal that the linker did not use this one" + $echo "*** as a dynamic dependency that programs can get resolved with at runtime." + fi fi else droppeddeps=yes - echo - echo "*** Warning! Library $i is needed by this library but I was not able to" - echo "*** make it link in! You will probably need to install it or some" - echo "*** library that it depends on before this library will be fully" - echo "*** functional. Installing it before continuing would be even better." + $echo + $echo "*** Warning! Library $i is needed by this library but I was not able to" + $echo "*** make it link in! You will probably need to install it or some" + $echo "*** library that it depends on before this library will be fully" + $echo "*** functional. Installing it before continuing would be even better." fi else newdeplibs="$newdeplibs $i" @@ -2627,11 +3347,20 @@ EOF for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do + if test "$name" != "" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then @@ -2650,35 +3379,29 @@ EOF *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done - # It is ok to link against an archive when - # building a shared library. - if $AR -t $potlib > /dev/null 2>&1; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ - | egrep "$file_magic_regex" > /dev/null; then + | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi - done - done + done + done + fi if test -n "$a_deplib" ; then droppeddeps=yes - echo - echo "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - echo "*** with $libname but no candidates were found. (...for file magic test)" + $echo "*** with $libname but no candidates were found. (...for file magic test)" else - echo "*** with $libname and none of the candidates passed a file format test" - echo "*** using a file magic. Last file checked: $potlib" + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" fi fi else @@ -2694,33 +3417,43 @@ EOF name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check below in file_magic test - if eval echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | egrep "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done done - done + fi if test -n "$a_deplib" ; then droppeddeps=yes - echo - echo "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - echo "*** with $libname but no candidates were found. (...for regex pattern test)" + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else - echo "*** with $libname and none of the candidates passed a file format test" - echo "*** using a regex pattern. Last file checked: $potlib" + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else @@ -2731,16 +3464,23 @@ EOF ;; none | unknown | *) newdeplibs="" - if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | - grep . >/dev/null; then - echo + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." + $echo "*** Warning: inter-library dependencies are not supported in this platform." else - echo "*** Warning: inter-library dependencies are not known to be supported." + $echo "*** Warning: inter-library dependencies are not known to be supported." fi - echo "*** All declared inter-library dependencies are being dropped." + $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; @@ -2760,17 +3500,17 @@ EOF if test "$droppeddeps" = yes; then if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - echo "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -2780,16 +3520,16 @@ EOF build_libtool_libs=no fi else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." - if test $allow_undefined = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -2811,7 +3551,7 @@ EOF # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then - if test $hardcode_into_libs = yes; then + if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= @@ -2847,7 +3587,11 @@ EOF if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" - eval dep_rpath=\"$hardcode_libdir_flag_spec\" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. @@ -2867,6 +3611,7 @@ EOF fi # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" @@ -2877,7 +3622,9 @@ EOF else soname="$realname" fi - test -z "$dlname" && dlname=$soname + if test -z "$dlname"; then + dlname=$soname + fi lib="$output_objdir/$realname" for link @@ -2885,23 +3632,6 @@ EOF linknames="$linknames $link" done - # Ensure that we have .o objects for linkers which dislike .lo - # (e.g. aix) in case we are running --disable-static - for obj in $libobjs; do - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - if test ! -f $xdir/$oldobj; then - $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" - $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? - fi - done - # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -2911,17 +3641,26 @@ EOF $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" + cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then - $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi @@ -2932,17 +3671,37 @@ EOF $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi + tmp_deplibs= + inst_prefix_arg= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + if test -n "$inst_prefix_dir" && (echo "$test_deplib" | grep -- "$inst_prefix_dir" >/dev/null); then + inst_prefix_arg="$test_deplib" + else + tmp_deplibs="$tmp_deplibs $test_deplib" + fi + ;; + esac + done + deplibs="$tmp_deplibs" + if test -n "$inst_prefix_arg"; then + deplibs="$inst_prefix_arg $deplibs" + fi + if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" status=$? - if test $status -ne 0 && test ! -d "$gentop"; then + if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" @@ -2958,16 +3717,42 @@ EOF $show "${rm}r $xdir" $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" status=$? - if test $status -ne 0 && test ! -d "$xdir"; then + if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi - libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done fi fi @@ -2983,25 +3768,147 @@ EOF fi # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi else - save_deplibs="$deplibs" - for conv in $convenience; do - tmp_deplibs= - for test_deplib in $deplibs; do - if test "$test_deplib" != "$conv"; then - tmp_deplibs="$tmp_deplibs $test_deplib" + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$save_output-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi - done - deplibs="$tmp_deplibs" + last_robj=$output_objdir/$save_output-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$save_output-${k}.$objext + objlist=$obj + len=1 + fi done - eval cmds=\"$archive_cmds\" - deplibs="$save_deplibs" + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadale object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3010,7 +3917,7 @@ EOF # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - exit 0 + exit $EXIT_SUCCESS fi # Create links to the real library. @@ -3058,7 +3965,7 @@ EOF *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit 1 + exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` @@ -3089,10 +3996,10 @@ EOF gentop="$output_objdir/${obj}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" status=$? - if test $status -ne 0 && test ! -d "$gentop"; then + if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" @@ -3108,16 +4015,42 @@ EOF $show "${rm}r $xdir" $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" status=$? - if test $status -ne 0 && test ! -d "$xdir"; then + if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi - reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` done fi fi @@ -3126,10 +4059,11 @@ EOF reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" - eval cmds=\"$reload_cmds\" + cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3142,7 +4076,7 @@ EOF $run ${rm}r $gentop fi - exit 0 + exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then @@ -3153,37 +4087,24 @@ EOF # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. - $show "echo timestamp > $libobj" - $run eval "echo timestamp > $libobj" || exit $? - exit 0 + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" - eval cmds=\"$reload_cmds\" + cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" - else - # Just create a symlink. - $show $rm $libobj - $run $rm $libobj - xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$libobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - $show "(cd $xdir && $LN_S $oldobj $baseobj)" - $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then @@ -3191,12 +4112,12 @@ EOF $run ${rm}r $gentop fi - exit 0 + exit $EXIT_SUCCESS ;; prog) case $host in - *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 @@ -3218,16 +4139,19 @@ EOF # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - ;; - esac ;; esac + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -3378,12 +4302,12 @@ extern \"C\" { done if test -n "$exclude_expsyms"; then - $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then - $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi @@ -3401,8 +4325,8 @@ extern \"C\" { for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" - name=`echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval 'echo ": $name " >> "$nlist"' + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done @@ -3411,7 +4335,7 @@ extern \"C\" { test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then - egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi @@ -3431,7 +4355,7 @@ extern \"C\" { if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else - echo '/* NONE */' >> "$output_objdir/$dlsyms" + $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ @@ -3483,18 +4407,18 @@ static const void *lt_preloaded_setup() { *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC";; + *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" @@ -3506,7 +4430,7 @@ static const void *lt_preloaded_setup() { ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac else @@ -3519,7 +4443,7 @@ static const void *lt_preloaded_setup() { finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi - if test $need_relink = no || test "$build_libtool_libs" != yes; then + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" @@ -3594,7 +4518,7 @@ static const void *lt_preloaded_setup() { # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? - exit 0 + exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then @@ -3649,10 +4573,10 @@ static const void *lt_preloaded_setup() { fi # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case $0 in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; - *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else @@ -3664,15 +4588,230 @@ static const void *lt_preloaded_setup() { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in - *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in - *cygwin*) exeext=.exe ;; + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac + case $host in + *cygwin* | *mingw* ) + cwrappersource=`$echo ${objdir}/lt-${output}.c` + cwrapper=`$echo ${output}.exe` + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +#define DIR_SEPARATOR '/' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +#define HAVE_DOS_BASED_FILE_SYSTEM +#ifndef DIR_SEPARATOR_2 +#define DIR_SEPARATOR_2 '\\' +#endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +char * basename (const char *name); +char * fnqualify(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup ((char *) basename (argv[0])); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = fnqualify(argv[0]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +char * +basename (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha (name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return (char *) base; +} + +char * +fnqualify(const char *path) +{ + size_t size; + char *p; + char tmp[LT_PATHMAX + 1]; + + assert(path != NULL); + + /* Is it qualified already? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha (path[0]) && path[1] == ':') + return xstrdup (path); +#endif + if (IS_DIR_SEPARATOR (path[0])) + return xstrdup (path); + + /* prepend the current directory */ + /* doesn't handle '~' */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ + p = XMALLOC(char, size); + sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); + return p; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC -s -o $cwrapper $cwrappersource + ;; + esac $rm $output - trap "$rm $output; exit 1" 1 2 15 + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL @@ -3688,7 +4827,7 @@ static const void *lt_preloaded_setup() { # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' +Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout @@ -3748,7 +4887,7 @@ else " if test "$fast_install" = yes; then - echo >> $output "\ + $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" @@ -3764,7 +4903,7 @@ else $rm \"\$progdir/\$file\" fi" - echo >> $output "\ + $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then @@ -3772,7 +4911,7 @@ else else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" - exit 1 + exit $EXIT_FAILURE fi fi @@ -3782,13 +4921,13 @@ else $rm \"\$progdir/\$file\" fi" else - echo >> $output "\ + $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi - echo >> $output "\ + $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" @@ -3799,7 +4938,7 @@ else $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 ${SED} + # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var @@ -3819,14 +4958,6 @@ else # Run the actual program with our arguments. " case $host in - # win32 systems need to use the prog path for dll - # lookup to work - *-*-cygwin* | *-*-pw32*) - $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} -" - ;; - # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ @@ -3836,30 +4967,26 @@ else *) $echo >> $output "\ - # Export the path to the program. - PATH=\"\$progdir:\$PATH\" - export PATH - - exec \$program \${1+\"\$@\"} + exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 + exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 - echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE fi fi\ " chmod +x $output fi - exit 0 + exit $EXIT_SUCCESS ;; esac @@ -3875,7 +5002,7 @@ fi\ oldobjs="$libobjs_save" build_libtool_libs=no else - oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi @@ -3884,10 +5011,10 @@ fi\ gentop="$output_objdir/${outputname}x" $show "${rm}r $gentop" $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" status=$? - if test $status -ne 0 && test ! -d "$gentop"; then + if test "$status" -ne 0 && test ! -d "$gentop"; then exit $status fi generated="$generated $gentop" @@ -3904,14 +5031,40 @@ fi\ $show "${rm}r $xdir" $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" status=$? - if test $status -ne 0 && test ! -d "$xdir"; then + if test "$status" -ne 0 && test ! -d "$xdir"; then exit $status fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. $show "(cd $xdir && $AR x $xabs)" $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` done @@ -3919,30 +5072,71 @@ fi\ # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" + cmds=$old_archive_from_new_cmds else - # Ensure that we have .o objects in place in case we decided - # not to build a shared library, and have fallen back to building - # static libs even though --disable-static was passed! - for oldobj in $oldobjs; do - if test ! -f $oldobj; then - xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$oldobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` - obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` - $show "(cd $xdir && ${LN_S} $obj $baseobj)" - $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? - fi - done - eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do + eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? @@ -3974,8 +5168,12 @@ fi\ fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + # Only create the output if not a dry run. if test -z "$run"; then @@ -3994,7 +5192,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; @@ -4008,7 +5206,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done @@ -4019,17 +5217,36 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file @@ -4058,13 +5275,16 @@ revision=$revision # Is this an already installed library? installed=$installed +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" - if test "$installed" = no && test $need_relink = yes; then + if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi @@ -4077,7 +5297,7 @@ relink_command=\"$relink_command\"" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac - exit 0 + exit $EXIT_SUCCESS ;; # libtool install mode @@ -4166,13 +5386,13 @@ relink_command=\"$relink_command\"" if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test -z "$files"; then @@ -4182,7 +5402,7 @@ relink_command=\"$relink_command\"" $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. @@ -4200,10 +5420,10 @@ relink_command=\"$relink_command\"" # Not a directory, so check to see that there is only one file specified. set dummy $files - if test $# -gt 2; then + if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi fi case $destdir in @@ -4215,7 +5435,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac done @@ -4240,11 +5460,11 @@ relink_command=\"$relink_command\"" *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi library_names= @@ -4276,21 +5496,24 @@ relink_command=\"$relink_command\"" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 @@ -4298,7 +5521,7 @@ relink_command=\"$relink_command\"" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - continue + exit $EXIT_FAILURE fi fi @@ -4320,7 +5543,7 @@ relink_command=\"$relink_command\"" $run eval "$striplib $destdir/$realname" || exit $? fi - if test $# -gt 0; then + if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do @@ -4333,10 +5556,11 @@ relink_command=\"$relink_command\"" # Do each command in the postinstall commands. lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" + cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4376,7 +5600,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac @@ -4394,7 +5618,7 @@ relink_command=\"$relink_command\"" $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi - exit 0 + exit $EXIT_SUCCESS ;; *) @@ -4406,29 +5630,49 @@ relink_command=\"$relink_command\"" destfile="$destdir/$destfile" fi + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) - wrapper=`echo $file | ${SED} -e 's,.exe$,,'` + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac - if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac # If there is no directory component, then add one. case $file in - */* | *\\*) . $wrapper ;; - *) . ./$wrapper ;; + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi finalize=yes @@ -4450,10 +5694,17 @@ relink_command=\"$relink_command\"" done relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac # If there is no directory component, then add one. case $file in - */* | *\\*) . $wrapper ;; - *) . ./$wrapper ;; + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; esac outputname= @@ -4461,17 +5712,17 @@ relink_command=\"$relink_command\"" if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` - if test $? = 0 ; then : - else - tmpdir="$tmpdir/libtool-$$" - fi - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + tmpdir="$tmpdir/libtool-$$" + save_umask=`umask` + umask 0077 + if $mkdir "$tmpdir"; then + umask $save_umask else + umask $save_umask $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi - file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` @@ -4489,14 +5740,14 @@ relink_command=\"$relink_command\"" fi else # Install the binary that we compiled earlier. - file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in - /usr/bin/install*,*cygwin*) + */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok @@ -4505,7 +5756,7 @@ relink_command=\"$relink_command\"" destfile=$destfile.exe ;; *:*.exe) - destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; @@ -4526,16 +5777,17 @@ relink_command=\"$relink_command\"" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? - if test -n "$stripme" && test -n "$striplib"; then + if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" + cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4549,9 +5801,9 @@ relink_command=\"$relink_command\"" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $0 --finish$current_libdirs' + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else - exit 0 + exit $EXIT_SUCCESS fi ;; @@ -4570,10 +5822,11 @@ relink_command=\"$relink_command\"" for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" + cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" @@ -4590,43 +5843,43 @@ relink_command=\"$relink_command\"" fi # Exit here if they wanted silent mode. - test "$show" = ":" && exit 0 + test "$show" = : && exit $EXIT_SUCCESS - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" + $echo "----------------------------------------------------------------------" + $echo "Libraries have been installed in:" for libdir in $libdirs; do - echo " $libdir" + $echo " $libdir" done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" fi if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" - echo " - use the \`$flag' linker flag" + $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then - echo " - have your system administrator run these commands:$admincmds" + $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi - echo - echo "See any operating system documentation about shared libraries for" - echo "more information, such as the ld(1) and ld.so(8) manual pages." - echo "----------------------------------------------------------------------" - exit 0 + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "----------------------------------------------------------------------" + exit $EXIT_SUCCESS ;; # libtool execute mode @@ -4638,7 +5891,7 @@ relink_command=\"$relink_command\"" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" - exit 1 + exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. @@ -4646,18 +5899,18 @@ relink_command=\"$relink_command\"" if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Read the libtool library. @@ -4684,7 +5937,7 @@ relink_command=\"$relink_command\"" dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi ;; @@ -4724,7 +5977,7 @@ relink_command=\"$relink_command\"" -*) ;; *) # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; @@ -4747,7 +6000,7 @@ relink_command=\"$relink_command\"" eval "export $shlibpath_var" fi - # Restore saved enviroment variables + # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi @@ -4764,7 +6017,7 @@ relink_command=\"$relink_command\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" - exit 0 + exit $EXIT_SUCCESS fi ;; @@ -4792,24 +6045,25 @@ relink_command=\"$relink_command\"" if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi rmdirs= + origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. - objdir="$objdir" + objdir="$origobjdir" else - objdir="$dir/$objdir" + objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test $mode = uninstall && objdir="$dir" + test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates - if test $mode = clean; then + if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; @@ -4833,7 +6087,7 @@ relink_command=\"$relink_command\"" case $name in *.la) # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. @@ -4841,18 +6095,19 @@ relink_command=\"$relink_command\"" rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - if test $mode = uninstall; then + if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" + cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test $? != 0 && test "$rmforce" != yes; then + if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -4861,13 +6116,14 @@ relink_command=\"$relink_command\"" if test -n "$old_library"; then # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" + cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test $? != 0 && test "$rmforce" != yes; then + if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -4879,22 +6135,52 @@ relink_command=\"$relink_command\"" ;; *.lo) - if test "$build_old_libs" = yes; then - oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` - rmfiles="$rmfiles $dir/$oldobj" + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi fi ;; *) - # Do a test to see if this is a libtool program. - if test $mode = clean && - (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$file + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi fi fi ;; @@ -4902,6 +6188,7 @@ relink_command=\"$relink_command\"" $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done + objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -4917,20 +6204,20 @@ relink_command=\"$relink_command\"" "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd - exit 1 + exit $EXIT_FAILURE fi # We need to display help for each of the modes. @@ -4949,6 +6236,7 @@ Provide generalized library-building support services. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: @@ -4962,8 +6250,10 @@ MODE must be one of the following: uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE." - exit 0 +a more detailed description of MODE. + +Report bugs to ." + exit $EXIT_SUCCESS ;; clean) @@ -5074,6 +6364,9 @@ The following components of LINK-COMMAND are treated specially: -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries @@ -5115,14 +6408,34 @@ Otherwise, only FILE itself is deleted using RM." *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac -echo +$echo $echo "Try \`$modename --help' for more information about other modes." -exit 0 +exit $EXIT_SUCCESS + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 614fb8cc..7449ed8e 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -29,7 +29,7 @@ linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs # Set the include path. AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs $(all_includes) -ntfsfix_SOURCES = ntfsfix.c +ntfsfix_SOURCES = ntfsfix.c utils.c utils.h ntfsfix_LDADD = $(AM_LIBS) ntfsfix_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 199f2821..bd7eb26b 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -93,7 +93,7 @@ ntfscp_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) ntfsdump_logfile_OBJECTS = $(am_ntfsdump_logfile_OBJECTS) ntfsdump_logfile_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) +am_ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) utils.$(OBJEXT) ntfsfix_OBJECTS = $(am_ntfsfix_OBJECTS) ntfsfix_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) utils.$(OBJEXT) @@ -132,7 +132,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -162,6 +162,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -172,6 +173,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -183,6 +188,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -212,13 +219,18 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -275,7 +287,7 @@ linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs # Set the include path. AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs $(all_includes) -ntfsfix_SOURCES = ntfsfix.c +ntfsfix_SOURCES = ntfsfix.c utils.c utils.h ntfsfix_LDADD = $(AM_LIBS) ntfsfix_LDFLAGS = $(AM_LFLAGS) mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c utils.c utils.h From 5a6cca21d65047c2db2901e2c07a627adc465287 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 19 Feb 2005 19:34:37 +0000 Subject: [PATCH 2188/2994] ntfsfix: use getopt, added --help and --version, some output cleanup BKrev: 421794cdiFigoKPnuBWmBZvI6fQZhg From f6a7caf21d88a72aaf112c4366106999c484ba30 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 19 Feb 2005 19:34:37 +0000 Subject: [PATCH 2189/2994] use getopt, added --help and --version, some output cleanup (Logical change 1.679) --- ntfsprogs/ntfsfix.c | 134 ++++++++++++++++++++++++++++++-------------- 1 file changed, 92 insertions(+), 42 deletions(-) diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 66550a01..ae2d10d6 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -51,12 +51,14 @@ #include #include #include +#include #include "types.h" #include "attrib.h" #include "mft.h" #include "device.h" #include "logfile.h" +#include "utils.h" #ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS # error "No default device io operations! Cannot build ntfsfix. \ @@ -64,13 +66,88 @@ You need to run ./configure without the --disable-default-device-io-ops \ switch if you want to be able to build the NTFS utilities." #endif +GEN_PRINTF(Eprintf, stdout, NULL, FALSE) +GEN_PRINTF(Vprintf, stdout, NULL, FALSE) +GEN_PRINTF(Qprintf, stdout, NULL, FALSE) + +const char *EXEC_NAME = "ntfsfix"; + +struct { + char *volume; +} opt; + +static int usage(void) +{ + + printf("%s v%s\n" + "\n" + "Usage: %s [options] device\n" + " Attempt to fix an NTFS partition.\n" + "\n" + " -h, --help Display this help\n" + " -V, --version Display version information\n" + "\n" + "For example: %s /dev/hda6\n\n", + EXEC_NAME, VERSION, EXEC_NAME, EXEC_NAME); + printf("%s%s", ntfs_bugs, ntfs_home); + exit(1); +} + +static void version (void) +{ + printf("%s v%s\n\n" + "Attempt to fix an NTFS partition.\n\n" + "Copyright (c) 2000-2003 Anton Altaparmakov.\n\n", + EXEC_NAME, VERSION); + printf("%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home); + exit(1); +} + +static void parse_options(int argc, char **argv) +{ + char c; + static const char *sopt = "-hV"; + static const struct option lopt[] = { + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + { NULL, 0, NULL, 0 } + }; + + memset(&opt, 0, sizeof(opt)); + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opt.volume) + opt.volume = argv[optind - 1]; + else { + printf("ERROR: Too many arguments.\n"); + usage(); + } + break; + case 'h': + case '?': + usage(); + case 'V': + version(); + default: + printf("ERROR: Unknown option '%s'.\n", argv[optind - 1]); + usage(); + } + } + + if (opt.volume == NULL) { + printf("ERROR: You must specify a device.\n"); + usage(); + } +} + /** * main */ int main(int argc, char **argv) { s64 l, br; - const char *EXEC_NAME = "NtfsFix"; const char *OK = "OK"; const char *FAILED = "FAILED"; unsigned char *m = NULL, *m2 = NULL; @@ -81,57 +158,32 @@ int main(int argc, char **argv) u16 flags; BOOL done, force = FALSE; - printf("\n"); - if (argc != 2 || !argv[1]) { - printf("%s v%s - Attempt to fix an NTFS partition that " - "has been damaged by the\nLinux NTFS driver. Note that " - "you should run it every time after you have used\nthe " - "Linux NTFS driver to write to an NTFS partition to " - "prevent massive data\ncorruption from happening when " - "Windows mounts the partition.\nIMPORTANT: Run this " - "only *after* unmounting the partition in Linux but " - "*before*\nrebooting into Windows NT/2000/XP or you " - "*will* suffer! - You have been warned!\n\n" - /* Generic copyright / disclaimer. */ - "Copyright (c) 2000-2003 Anton Altaparmakov.\n\n" - "%s is free software, released under the GNU " - "General Public License and you\nare welcome to " - "redistribute it under certain conditions.\n" - "%s comes with ABSOLUTELY NO WARRANTY; for details " - "read the file GNU\nGeneral Public License to be found " - "in the file COPYING in the main Linux-NTFS\n" - "distribution directory.\n\n" - /* Generic part ends here. */ - "Syntax: ntfsfix partition_or_file_name\n" - " e.g. ntfsfix /dev/hda6\n\n", EXEC_NAME, - VERSION, EXEC_NAME, EXEC_NAME); - fprintf(stderr, "Error: incorrect syntax\n"); - exit(1); - } - if (!ntfs_check_if_mounted(argv[1], &mnt_flags)) { + parse_options(argc, argv); + + if (!ntfs_check_if_mounted(opt.volume, &mnt_flags)) { if ((mnt_flags & NTFS_MF_MOUNTED) && !(mnt_flags & NTFS_MF_READONLY) && !force) { fprintf(stderr, "Refusing to operate on read-write " - "mounted device %s.\n", argv[1]); + "mounted device %s.\n", opt.volume); exit(1); } } else fprintf(stderr, "Failed to determine whether %s is mounted: " - "%s\n", argv[1], strerror(errno)); + "%s\n", opt.volume, strerror(errno)); /* Attempt a full mount first. */ printf("Mounting volume... "); - vol = ntfs_mount(argv[1], 0); + vol = ntfs_mount(opt.volume, 0); if (vol) { puts(OK); - printf("\nProcessing of $MFT and $MFTMirr completed " - "successfully.\n\n"); + printf("Processing of $MFT and $MFTMirr completed " + "successfully.\n"); goto mount_ok; } puts(FAILED); printf("Attempting to correct errors... "); - dev = ntfs_device_alloc(argv[1], 0, &ntfs_device_default_io_ops, NULL); + dev = ntfs_device_alloc(opt.volume, 0, &ntfs_device_default_io_ops, NULL); if (!dev) { puts(FAILED); perror("Failed to allocate device"); @@ -142,12 +194,12 @@ int main(int argc, char **argv) if (!vol) { puts(FAILED); perror("Failed to startup volume"); - fprintf(stderr, "Volume is corrupt. You should run chkdsk."); + fprintf(stderr, "Volume is corrupt. You should run chkdsk.\n"); ntfs_device_free(dev); goto error_exit; } - puts("Processing $MFT and $MFTMirr."); + puts("\nProcessing $MFT and $MFTMirr... "); /* Load data from $MFT and $MFTMirr and compare the contents. */ m = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); @@ -259,11 +311,11 @@ int main(int argc, char **argv) free(m2); m = m2 = NULL; - printf("Processing of $MFT and $MFTMirr completed successfully.\n\n"); + printf("Processing of $MFT and $MFTMirr completed successfully.\n"); /* ntfs_umount() will invoke ntfs_device_free() for us. */ if (ntfs_umount(vol, 0)) ntfs_umount(vol, 1); - vol = ntfs_mount(argv[1], 0); + vol = ntfs_mount(opt.volume, 0); if (!vol) { perror("Remount failed"); goto error_exit; @@ -272,7 +324,7 @@ mount_ok: m = NULL; /* Check NTFS version is ok for us (in $Volume) */ - printf("NTFS volume version is %i.%i.\n\n", vol->major_ver, + printf("NTFS volume version is %i.%i.\n", vol->major_ver, vol->minor_ver); if (ntfs_version_is_supported(vol)) { fprintf(stderr, "Error: Unknown NTFS version.\n"); @@ -294,7 +346,6 @@ mount_ok: goto error_exit; } puts(OK); - printf("\n"); printf("Going to empty the journal ($LogFile)... "); if (ntfs_logfile_reset(vol)) { @@ -303,7 +354,6 @@ mount_ok: goto error_exit; } puts(OK); - printf("\n"); if (vol->major_ver >= 3) { /* FIXME: If on NTFS 3.0+, check for presence of the usn journal and From bef59fbd6e2cdd3c37da413e2cbda2c3c989d9f9 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sun, 20 Feb 2005 22:20:54 +0000 Subject: [PATCH 2190/2994] Empty journal and mark volume dirty for chkdsk if ntfs_mount failed. This makes read-write mounting of NTFS metadata images possible by ntfsprogs and the kernel driver what were created by versions of ntfsclone previous than 2.0.0. (Logical change 1.680) --- ntfsprogs/ntfsfix.c | 80 +++++++++++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 24 deletions(-) diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index ae2d10d6..fd9fa76e 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -70,7 +70,11 @@ GEN_PRINTF(Eprintf, stdout, NULL, FALSE) GEN_PRINTF(Vprintf, stdout, NULL, FALSE) GEN_PRINTF(Qprintf, stdout, NULL, FALSE) -const char *EXEC_NAME = "ntfsfix"; +static const char *EXEC_NAME = "ntfsfix"; +static const char *OK = "OK"; +static const char *FAILED = "FAILED"; +static BOOL vol_is_dirty = FALSE; +static BOOL journal_is_empty = FALSE; struct { char *volume; @@ -142,20 +146,59 @@ static void parse_options(int argc, char **argv) } } +static int set_dirty_flag(ntfs_volume *vol) +{ + u16 flags; + + if (vol_is_dirty == TRUE) + return 0; + + printf("Setting required flags on partition... "); + /* + * Set chkdsk flag, i.e. mark the partition dirty so chkdsk will run + * and fix it for us. + */ + flags = vol->flags | VOLUME_IS_DIRTY; + /* If NTFS volume version >= 2.0 then set mounted on NT4 flag. */ + if (vol->major_ver >= 2) + flags |= VOLUME_MOUNTED_ON_NT4; + if (ntfs_volume_set_flags(vol, flags)) { + puts(FAILED); + fprintf(stderr, "Error setting volume flags.\n"); + return -1; + } + puts(OK); + vol_is_dirty = TRUE; + return 0; +} + +static int empty_journal(ntfs_volume *vol) +{ + if (journal_is_empty == TRUE) + return 0; + + printf("Going to empty the journal ($LogFile)... "); + if (ntfs_logfile_reset(vol)) { + puts(FAILED); + perror("Failed to reset $LogFile"); + return -1; + } + puts(OK); + journal_is_empty = TRUE; + return 0; +} + /** * main */ int main(int argc, char **argv) { s64 l, br; - const char *OK = "OK"; - const char *FAILED = "FAILED"; unsigned char *m = NULL, *m2 = NULL; ntfs_volume *vol; struct ntfs_device *dev; unsigned long mnt_flags; int i; - u16 flags; BOOL done, force = FALSE; parse_options(argc, argv); @@ -312,6 +355,13 @@ int main(int argc, char **argv) m = m2 = NULL; printf("Processing of $MFT and $MFTMirr completed successfully.\n"); + + if (set_dirty_flag(vol) < 0) + goto error_exit; + + if (empty_journal(vol) < 0) + goto error_exit; + /* ntfs_umount() will invoke ntfs_device_free() for us. */ if (ntfs_umount(vol, 0)) ntfs_umount(vol, 1); @@ -331,29 +381,11 @@ mount_ok: goto error_exit; } - printf("Setting required flags on partition... "); - /* - * Set chkdsk flag, i.e. mark the partition dirty so chkdsk will run - * and fix it for us. - */ - flags = vol->flags | VOLUME_IS_DIRTY; - /* If NTFS volume version >= 2.0 then set mounted on NT4 flag. */ - if (vol->major_ver >= 2) - flags |= VOLUME_MOUNTED_ON_NT4; - if (ntfs_volume_set_flags(vol, flags)) { - puts(FAILED); - fprintf(stderr, "Error setting volume flags.\n"); + if (set_dirty_flag(vol) < 0) goto error_exit; - } - puts(OK); - printf("Going to empty the journal ($LogFile)... "); - if (ntfs_logfile_reset(vol)) { - puts(FAILED); - perror("Failed to reset $LogFile"); + if (empty_journal(vol) < 0) goto error_exit; - } - puts(OK); if (vol->major_ver >= 3) { /* FIXME: If on NTFS 3.0+, check for presence of the usn journal and From c65b34b7098db54c7221528031979dde69e5a173 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sun, 20 Feb 2005 22:20:54 +0000 Subject: [PATCH 2191/2994] ntfsfix: empty journal and mark volume dirty for chkdsk if ntfs_mount failed. This makes read-write mounting of NTFS metadata images possible by ntfsprogs and the kernel driver what were created by versions of ntfsclone previous than 2.0.0. (Logical change 1.680) --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 19d8e6cb..dacc2b14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -106,6 +106,10 @@ xx/xx/2005 - 2.0.0-WIP - ntfscp: Added SIGINT (Ctrl+C) handler, improved error handling in sync failed case. (Yura) - Fix a nasty runlist merge bug when merging two holes. (Anton) + - ntfsfix: empty journal and mark volume dirty for chkdsk if ntfs_mount + failed. This makes read-write mounting of NTFS metadata images + possible by ntfsprogs and the kernel driver what were created by + versions of ntfsclone previous than 2.0.0. (Szaka) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 7124baccf9268d654611b720ea2d8d6dc4eb061b Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sun, 20 Feb 2005 22:20:54 +0000 Subject: [PATCH 2192/2994] ntfsfix: empty journal and mark volume dirty for chkdsk if ntfs_mount failed. This makes read-write mounting of NTFS metadata images possible by ntfsprogs and the kernel driver what were created by versions of ntfsclone previous than 2.0.0. BKrev: 42190d46Qu5r-ZIsesz9vi1f1qtyWg From 1d176ad7e068c112f998badd827bc1eba9926e62 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Mon, 28 Feb 2005 19:23:20 +0000 Subject: [PATCH 2193/2994] Added a new option, --ignore-fs-check. It can be used only with the --metadata option. The clusters causing the inconsistency are saved too. (Logical change 1.681) --- ntfsprogs/ntfsclone.c | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 024beeb9..2c6508c3 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -62,6 +62,7 @@ struct { int std_out; int blkdev_out; /* output file is block device */ int metadata_only; + int ignore_fs_check; int save_image; int restore_image; char *output; @@ -215,6 +216,7 @@ static void usage(void) " -m, --metadata Clone *only* metadata (for NTFS experts)\n" " -s, --save-image Save to the special image format\n" " -r, --restore-image Restore from the special image format\n" + " --ignore-fs-check Ignore the filesystem check\n" " -f, --force Force to progress (DANGEROUS)\n" " -h, --help Display this help\n" #ifdef DEBUG @@ -234,15 +236,16 @@ static void parse_options(int argc, char **argv) static const char *sopt = "-dfhmo:O:rs"; static const struct option lopt[] = { #ifdef DEBUG - { "debug", no_argument, NULL, 'd' }, + { "debug", no_argument, NULL, 'd' }, #endif - { "force", no_argument, NULL, 'f' }, - { "help", no_argument, NULL, 'h' }, - { "metadata", no_argument, NULL, 'm' }, - { "output", required_argument, NULL, 'o' }, - { "overwrite", required_argument, NULL, 'O' }, - { "restore-image", no_argument, NULL, 'r' }, - { "save-image", no_argument, NULL, 's' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "metadata", no_argument, NULL, 'm' }, + { "output", required_argument, NULL, 'o' }, + { "overwrite", required_argument, NULL, 'O' }, + { "restore-image", no_argument, NULL, 'r' }, + { "ignore-fs-check", no_argument, NULL, 'C' }, + { "save-image", no_argument, NULL, 's' }, { NULL, 0, NULL, 0 } }; @@ -279,6 +282,9 @@ static void parse_options(int argc, char **argv) case 'r': opt.restore_image++; break; + case 'C': + opt.ignore_fs_check++; + break; case 's': opt.save_image++; break; @@ -312,6 +318,10 @@ static void parse_options(int argc, char **argv) if (opt.metadata_only && opt.std_out) err_exit("Cloning only metadata to stdout isn't supported!\n"); + if (opt.ignore_fs_check && !opt.metadata_only) + err_exit("Filesystem check can be ignored only for metadata " + "cloning!\n"); + if (opt.save_image && opt.restore_image) err_exit("Saving and restoring an image at the same time " "is not supported!\n"); @@ -405,6 +415,7 @@ static s64 is_critical_metadata(ntfs_walk_clusters_ctx *image, runlist *rl) return rl->length; if (image->ctx->attr->type == AT_DATA) { + /* Save at least the first 8 KiB of FILE_LogFile */ s64 s = (s64)8192 - rl->vcn * vol->cluster_size; if (s > 0) { @@ -487,7 +498,7 @@ static void lseek_to_cluster(s64 lcn) if (opt.std_out || opt.save_image) return; - + if (lseek(fd_out, pos, SEEK_SET) == (off_t)-1) perr_exit("lseek output"); } @@ -780,6 +791,11 @@ static void compare_bitmaps(struct bitmap *a) bit = ntfs_bit_get(a->bm, cl); if (bit == ntfs_bit_get(bm, i * 8 + cl % 8)) continue; + + if (opt.ignore_fs_check) { + lseek_to_cluster(cl); + copy_cluster(); + } if (++mismatch > 10) continue; @@ -794,8 +810,12 @@ static void compare_bitmaps(struct bitmap *a) } if (mismatch) { - Printf("Totally %d cluster accounting mismatches.\n", - mismatch); + Printf("Totally %d cluster accounting mismatches.\n", mismatch); + if (opt.ignore_fs_check) { + Printf("WARNING: The NTFS inconsistency was overruled " + "by the --ignore-fs-check option.\n"); + return; + } err_exit("Filesystem check failed! Windows wasn't shutdown " "properly or inconsistent\nfilesystem. Please run " "chkdsk on Windows.\n"); From 5d86dff231e22a011615b6e045ee3f8d357b12d3 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Mon, 28 Feb 2005 19:23:20 +0000 Subject: [PATCH 2194/2994] ntfsclone: added a new option, --ignore-fs-check. It can be used only with the --metadata option. The clusters causing the inconsistency are saved too. (Logical change 1.681) --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index dacc2b14..771b520c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -110,6 +110,9 @@ xx/xx/2005 - 2.0.0-WIP failed. This makes read-write mounting of NTFS metadata images possible by ntfsprogs and the kernel driver what were created by versions of ntfsclone previous than 2.0.0. (Szaka) + - ntfsclone: added a new option, --ignore-fs-check. It can be used + only with the --metadata option. The clusters causing the + inconsistency are saved too. (Szaka) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 741f6c537de559e1ad371c6a8e1253d6961e3224 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Mon, 28 Feb 2005 19:23:20 +0000 Subject: [PATCH 2195/2994] ntfsclone: added a new option, --ignore-fs-check. It can be used only with the --metadata option. The clusters causing the inconsistency are saved too. BKrev: 42236fa8GQE3SOjV9ne1Sq-No6GQnA From f1780f9d648b68be4b57279dc59e006a0233172f Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 1 Mar 2005 21:48:00 +0000 Subject: [PATCH 2196/2994] Added a new option, --rescue. It ignores read errors so disks having bad sectors (dying disks) can be rescued. The content of the cluster having bad sectors is filled by character '2' and the start of the cluster is marked by "BadClusteR". (Logical change 1.682) --- ntfsprogs/ntfsclone.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 2c6508c3..52d7d33f 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -63,6 +63,7 @@ struct { int blkdev_out; /* output file is block device */ int metadata_only; int ignore_fs_check; + int rescue; int save_image; int restore_image; char *output; @@ -216,7 +217,8 @@ static void usage(void) " -m, --metadata Clone *only* metadata (for NTFS experts)\n" " -s, --save-image Save to the special image format\n" " -r, --restore-image Restore from the special image format\n" - " --ignore-fs-check Ignore the filesystem check\n" + " --ignore-fs-check Ignore the filesystem check result\n" + " --rescue Continue after disk read errors\n" " -f, --force Force to progress (DANGEROUS)\n" " -h, --help Display this help\n" #ifdef DEBUG @@ -245,6 +247,7 @@ static void parse_options(int argc, char **argv) { "overwrite", required_argument, NULL, 'O' }, { "restore-image", no_argument, NULL, 'r' }, { "ignore-fs-check", no_argument, NULL, 'C' }, + { "rescue", no_argument, NULL, 'R' }, { "save-image", no_argument, NULL, 's' }, { NULL, 0, NULL, 0 } }; @@ -285,6 +288,9 @@ static void parse_options(int argc, char **argv) case 'C': opt.ignore_fs_check++; break; + case 'R': + opt.rescue++; + break; case 's': opt.save_image++; break; @@ -466,8 +472,17 @@ static void copy_cluster(void) : vol->cluster_size; if (read_all(opt.restore_image ? (void *)&fd_in : vol->dev, buff, - csize) == -1) - perr_exit("read_all"); + csize) == -1) { + + const char *badcluster_magic = "BadClusteR"; + + if (!opt.rescue || errno != EIO) + perr_exit("read_all"); + + Printf("WARNING: Couldn't read a cluster, data is lost.\n"); + memset(buff, 2, csize); + memmove(buff, badcluster_magic, sizeof(badcluster_magic)); + } if (opt.save_image) { char cmd = 1; From cb2cd394b381d118a7536b1e0ec89813abe3e44e Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 1 Mar 2005 21:48:00 +0000 Subject: [PATCH 2197/2994] ntfsclone: added a new option, --rescue. It ignores read errors so disks having bad sectors (dying disks) can be rescued. The content of the cluster having bad sectors is filled by character '2' and the start of the cluster is marked by "BadClusteR". (Logical change 1.682) --- ChangeLog | 4 ++++ TODO.ntfsprogs | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 771b520c..464e3f5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -113,6 +113,10 @@ xx/xx/2005 - 2.0.0-WIP - ntfsclone: added a new option, --ignore-fs-check. It can be used only with the --metadata option. The clusters causing the inconsistency are saved too. (Szaka) + - ntfsclone: added a new option, --rescue. It ignores read errors + so disks having bad sectors (dying disks) can be rescued. The content + of the cluster having bad sectors is filled by character '2' and the + start of the cluster is marked by "BadClusteR". (Szaka) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 24a9ec56..e4a8e30e 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -27,9 +27,8 @@ Thanks, - get rid of the unneeded lseek()'s during reads/writes (probably it doesn't improve performance much, or any at all) - catch if source and dest are the same -- add dd's noerror option +- rescue: when reading a cluster fails then try rescue at the sector level - disable consistency check for --metadata (e.g. if the check is crashing) -- ignore consistency check (different than "disabling" fsck) - make "wiped", etc statistic variables long long - option: --inode - option: --data From 356c6a696a10b634f5f6c259d0f4dad05d1fb216 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 1 Mar 2005 21:48:00 +0000 Subject: [PATCH 2198/2994] ntfsclone: added a new option, --rescue. It ignores read errors so disks having bad sectors (dying disks) can be rescued. The content of the cluster having bad sectors is filled by character '2' and the start of the cluster is marked by "BadClusteR". BKrev: 4224e310P8YT4an8mcedLrCIP9tSCA From 52fa43efb847a61cab927f18a0ef1c2a872afb45 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 1 Mar 2005 23:11:20 +0000 Subject: [PATCH 2199/2994] Fix invalid mft records in $MFTMirr. (Logical change 1.683) --- ntfsprogs/ntfsfix.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index fd9fa76e..6eb34e1b 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -323,12 +323,6 @@ int main(int argc, char **argv) "sector transfer detected in %s.\n", s); goto error_exit; } - if (!ntfs_is_mft_recordp(m2 + i * vol->mft_record_size)) { - puts("FAILED"); - fprintf(stderr, "$MFTMirr error: Invalid mft record " - "for %s.\n", s); - goto error_exit; - } if (memcmp((u8*)m + i * vol->mft_record_size, (u8*)m2 + i * vol->mft_record_size, ntfs_mft_record_get_data_size((MFT_RECORD*)( @@ -336,8 +330,7 @@ int main(int argc, char **argv) if (!done) { done = TRUE; puts(FAILED); - printf("Correcting differences in " - "$MFTMirr... "); + printf("Correcting differences in $MFTMirr..."); } br = ntfs_mft_record_write(vol, i, (MFT_RECORD*)(m + i * vol->mft_record_size)); From 420c3cb6065de4742ef866b90ca22a9a40478238 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 1 Mar 2005 23:11:20 +0000 Subject: [PATCH 2200/2994] ntfsfix: fix invalid mft records in $MFTMirr. (Logical change 1.683) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 464e3f5d..8d940741 100644 --- a/ChangeLog +++ b/ChangeLog @@ -117,6 +117,7 @@ xx/xx/2005 - 2.0.0-WIP so disks having bad sectors (dying disks) can be rescued. The content of the cluster having bad sectors is filled by character '2' and the start of the cluster is marked by "BadClusteR". (Szaka) + - ntfsfix: fix invalid mft records in $MFTMirr. (Szaka) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 6ba06e46af5f1f77d4c6fc887c598986c769b39c Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Tue, 1 Mar 2005 23:11:20 +0000 Subject: [PATCH 2201/2994] ntfsfix: fix invalid mft records in $MFTMirr. BKrev: 4224f698endjkUqfVbh7JtpoyGL1EQ From 6728963c805371a5492c31303d247241f75b4d46 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 3 Mar 2005 11:40:20 +0000 Subject: [PATCH 2202/2994] Fix from Christophe Grenier: some versions of make do not accept -C switch. (Logical change 1.684) --- Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2f0ee189..9761f71d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,13 +14,13 @@ libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status --recheck strip: - $(MAKE) -C ntfsprogs strip + (cd ntfsprogs && $(MAKE) strip) || exit 1; extra: extras extras: - $(MAKE) -C ntfsprogs extras + (cd ntfsprogs && $(MAKE) extras) || exit 1; libs: - $(MAKE) -C libntfs libs + (cd libntfs && $(MAKE) libs) || exit 1; From 4710f9455631bfde8190b338238475f8c3e0f01a Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 3 Mar 2005 11:40:20 +0000 Subject: [PATCH 2203/2994] Merge ssh://linux-ntfs@bkbits.net/ntfsprogs into cantab.net:/home/src/ntfsprogs 2005/02/21 16:08:33+00:00 cantab.net!aia21 Makefile.am: Fix from Christophe Grenier: some versions of make do not accept -C switch. BKrev: 4226f7a4bxHFmOj7JovIaxsG6Cuk9g From 43c5886527fc2ca3bbc22e39de8676d8586ef409 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 3 Mar 2005 23:51:13 +0000 Subject: [PATCH 2204/2994] Initial revision --- BitKeeper/triggers/post-incoming.mail | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 BitKeeper/triggers/post-incoming.mail diff --git a/BitKeeper/triggers/post-incoming.mail b/BitKeeper/triggers/post-incoming.mail new file mode 100644 index 00000000..e69de29b From 156b2616847de4f3a1a41b77c80e9d51abb181bf Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 3 Mar 2005 23:51:13 +0000 Subject: [PATCH 2205/2994] (Logical change 1.685) --- BitKeeper/triggers/post-incoming.mail | 81 +++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/BitKeeper/triggers/post-incoming.mail b/BitKeeper/triggers/post-incoming.mail index e69de29b..6df1d183 100644 --- a/BitKeeper/triggers/post-incoming.mail +++ b/BitKeeper/triggers/post-incoming.mail @@ -0,0 +1,81 @@ +#!/bin/sh +# +# post-incoming.mail - A BitKeeper trigget to send incoming ChangeSets to the +# linux-ntfs-cvs mailing list, one ChangeSet per email. +# +# Copyright (c) 2005 Yura Pakhuchiy +# Copyright (c) 2005 Anton Altaparmakov +# +# 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 of the License, 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. +######################################################################### + +# This script should only be run on successful incoming pushes in the +# repository on bkbits.net. +if [ "x${BK_SIDE}" != "xserver" ]; then + exit 0 +fi +if [ "x${BK_EVENT}" != "xincoming push" ]; then + exit 0 +fi +if [ "x${BK_STATUS}" != "xOK" ]; then + exit 0 +fi +if [ -z "$(echo ${BKD_HOST} | grep bkbits.net)" ]; then + exit 0 +fi + +# For each ChangeSet, send an email. +bk changes -f -d'$unless(:MERGE:){:CSETREV:\n}' - < "${BK_CSETLIST}" 2>/dev/null | while read rev; do + +{ +cat < +To: ntfs-cvs +Subject: bk-$(echo ${BKD_ROOT} 2>/dev/null | sed "s#.*/##" 2>/dev/null): ChangeSet@${rev} by ${BK_USER}@${BK_HOST} + +EOT + +bk changes -f -d'$unless(:MERGE:){ChangeSet|:CSETREV:\n}' -r$rev 2>/dev/null | +bk -R prs -h -d'$unless(:MERGE:){ChangeSet@:I:, 20:Dy:-:Dm:-:Dd: :T::TZ:, :P:@:HOST:\n}' - 2>/dev/null + +cat </dev/null | diffstat -p1 2>/dev/null + +cat </dev/null + +cat </dev/null + +} | sendmail -ti + +done + +exit 0 From 6564e302227c85f2b1ac263fb397d528efcf6acd Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 3 Mar 2005 23:51:13 +0000 Subject: [PATCH 2206/2994] post-incoming.mail: A trigger script that will only work on bkbits.net and on a successful push to bkbits repository will email to the linux-ntfs-cvs list all the changesets that were pushed (one changeset per email). Lets hope bkbits.net will allow sending of email... BKrev: 4227a2f13rs39mKM8X7rXoigEfr1MA From 4c5e25dec68d6c777eb75f258f57f561d5429cf4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 3 Mar 2005 23:57:13 +0000 Subject: [PATCH 2207/2994] ChangeLog: Update BKrev: 4227a459SlEUu3hEtFrIh-6TGmERVA From 19b8d3c7d14a662749ddaea6c689310a80c6756b Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 3 Mar 2005 23:57:13 +0000 Subject: [PATCH 2208/2994] Update (Logical change 1.686) --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8d940741..53846972 100644 --- a/ChangeLog +++ b/ChangeLog @@ -118,6 +118,11 @@ xx/xx/2005 - 2.0.0-WIP of the cluster having bad sectors is filled by character '2' and the start of the cluster is marked by "BadClusteR". (Szaka) - ntfsfix: fix invalid mft records in $MFTMirr. (Szaka) + - Added a trigger script to the BK repository that will send an email + to linux-ntfs-cvs@lists.sourceforge.net mailing list when someone + pushes successfully to the ntfsprogs repository on bkbits.net. This + is done on the server side and is thus independent of whether the + client doing the push has got a correct email setup. (Yura, Anton) 04/09/2004 - 1.9.4 - Urgent bug fixes. From f31be4c723cb2327f85962c8166b87727c52f30d Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 4 Mar 2005 09:54:02 +0000 Subject: [PATCH 2209/2994] Update to use mail instead of sendmail and to not set the from address. Set the reply-to address instead. (Logical change 1.687) --- BitKeeper/triggers/post-incoming.mail | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/BitKeeper/triggers/post-incoming.mail b/BitKeeper/triggers/post-incoming.mail index 6df1d183..6006c3c5 100644 --- a/BitKeeper/triggers/post-incoming.mail +++ b/BitKeeper/triggers/post-incoming.mail @@ -37,17 +37,14 @@ if [ -z "$(echo ${BKD_HOST} | grep bkbits.net)" ]; then exit 0 fi +EMAIL="ntfs-cvs " +REPLYTO="Anton Altaparmakov " + +SUBJECT="Subject: bk-$(echo ${BKD_ROOT} 2>/dev/null | sed "s#.*/##" 2>/dev/null): ChangeSet@${rev} by ${BK_USER}@${BK_HOST}" + # For each ChangeSet, send an email. bk changes -f -d'$unless(:MERGE:){:CSETREV:\n}' - < "${BK_CSETLIST}" 2>/dev/null | while read rev; do - { -cat < -To: ntfs-cvs -Subject: bk-$(echo ${BKD_ROOT} 2>/dev/null | sed "s#.*/##" 2>/dev/null): ChangeSet@${rev} by ${BK_USER}@${BK_HOST} - -EOT - bk changes -f -d'$unless(:MERGE:){ChangeSet|:CSETREV:\n}' -r$rev 2>/dev/null | bk -R prs -h -d'$unless(:MERGE:){ChangeSet@:I:, 20:Dy:-:Dm:-:Dd: :T::TZ:, :P:@:HOST:\n}' - 2>/dev/null @@ -74,7 +71,7 @@ EOT bk export -tpatch -du -h -r$rev 2>/dev/null -} | sendmail -ti +} | mail -R "\"${REPLYTO}\"" -s "\"${SUBJECT}\"" "\"${EMAIL}\"" done From 818d28e9e0ec5f3a05e02d021942187aeffa43af Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 4 Mar 2005 09:54:02 +0000 Subject: [PATCH 2210/2994] post-incoming.mail: Update to use mail instead of sendmail and to not set the from address. Set the reply-to address instead. BKrev: 4228303aU1gillVzr6_TF4yxpitRlw From 304f2cb271c8b17be4e95d8f9d72abd1a725c2c9 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 4 Mar 2005 09:55:48 +0000 Subject: [PATCH 2211/2994] TODO.libntfs: Update for testing of mail trigger. BKrev: 422830a4jrPNQqy0AewDatkaVbvSpA From 5219ebb9d4e0e8db2329c7126628c240b566bee4 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 4 Mar 2005 09:55:48 +0000 Subject: [PATCH 2212/2994] Update for testing of mail trigger. (Logical change 1.688) --- TODO.libntfs | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO.libntfs b/TODO.libntfs index 9d18a018..d64fccfc 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -4,6 +4,7 @@ - be generic filter: provide ntfs_device_operations from parent GnomeVFSHandle + *********** * libntfs * *********** From fb8870b11043ee9622fc01cb90bab57680e60b58 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 4 Mar 2005 14:50:52 +0000 Subject: [PATCH 2213/2994] Change reply to to be ntfs-dev rather than me. Thanks to Yura for suggestion. (Logical change 1.689) --- BitKeeper/triggers/post-incoming.mail | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BitKeeper/triggers/post-incoming.mail b/BitKeeper/triggers/post-incoming.mail index 6006c3c5..518c560c 100644 --- a/BitKeeper/triggers/post-incoming.mail +++ b/BitKeeper/triggers/post-incoming.mail @@ -38,7 +38,7 @@ if [ -z "$(echo ${BKD_HOST} | grep bkbits.net)" ]; then fi EMAIL="ntfs-cvs " -REPLYTO="Anton Altaparmakov " +REPLYTO="ntfs-dev " SUBJECT="Subject: bk-$(echo ${BKD_ROOT} 2>/dev/null | sed "s#.*/##" 2>/dev/null): ChangeSet@${rev} by ${BK_USER}@${BK_HOST}" From 54feb7fd767d7a82c47f3d0999ed5fb9f6829349 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 4 Mar 2005 14:50:52 +0000 Subject: [PATCH 2214/2994] post-incoming.mail: Change reply to to be ntfs-dev rather than me. Thanks to Yura for suggestion. BKrev: 422875ccCILxnmh8RlaO2fwrhuEL2g From c84780235ae756f462c895dfe73370b4aead4f14 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 4 Mar 2005 19:43:38 +0000 Subject: [PATCH 2215/2994] Another fix. (thanks to Yura for spotting - $SUBJECT was broken as $rev was not set at the time $SUBJECT was set). (Logical change 1.690) --- BitKeeper/triggers/post-incoming.mail | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/BitKeeper/triggers/post-incoming.mail b/BitKeeper/triggers/post-incoming.mail index 518c560c..ca818c6a 100644 --- a/BitKeeper/triggers/post-incoming.mail +++ b/BitKeeper/triggers/post-incoming.mail @@ -40,10 +40,11 @@ fi EMAIL="ntfs-cvs " REPLYTO="ntfs-dev " -SUBJECT="Subject: bk-$(echo ${BKD_ROOT} 2>/dev/null | sed "s#.*/##" 2>/dev/null): ChangeSet@${rev} by ${BK_USER}@${BK_HOST}" - # For each ChangeSet, send an email. bk changes -f -d'$unless(:MERGE:){:CSETREV:\n}' - < "${BK_CSETLIST}" 2>/dev/null | while read rev; do + +SUBJECT="Subject: bk-$(echo ${BKD_ROOT} 2>/dev/null | sed "s#.*/##" 2>/dev/null): ChangeSet@${rev} by ${BK_USER}@${BK_HOST}" + { bk changes -f -d'$unless(:MERGE:){ChangeSet|:CSETREV:\n}' -r$rev 2>/dev/null | bk -R prs -h -d'$unless(:MERGE:){ChangeSet@:I:, 20:Dy:-:Dm:-:Dd: :T::TZ:, :P:@:HOST:\n}' - 2>/dev/null From defa17062cd4d70c4d4a83c68793d4a4944df6ae Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 4 Mar 2005 19:43:38 +0000 Subject: [PATCH 2216/2994] post-incoming.mail: Another fix. (thanks to Yura for spotting - $SUBJECT was broken as $rev was not set at the time $SUBJECT was set). BKrev: 4228ba6aUZSEBSCULwr8KSKdFrrnjg From c5f5dfb4c30b6a4dbb8f54f5edf9897c505ad971 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 5 Mar 2005 19:08:57 +0000 Subject: [PATCH 2217/2994] Make --metadata work with the new $Logfile checking code. Save at least the first 16 KiB of $Logfile (the two RSTR records should always be included if present). Save also records used for checking empty $Logfile. (Szaka) (Logical change 1.691) --- ntfsprogs/ntfsclone.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 52d7d33f..d270f96f 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -422,8 +422,8 @@ static s64 is_critical_metadata(ntfs_walk_clusters_ctx *image, runlist *rl) if (image->ctx->attr->type == AT_DATA) { - /* Save at least the first 8 KiB of FILE_LogFile */ - s64 s = (s64)8192 - rl->vcn * vol->cluster_size; + /* Save at least the first 16 KiB of FILE_LogFile */ + s64 s = (s64)16384 - rl->vcn * vol->cluster_size; if (s > 0) { s = rounded_up_division(s, vol->cluster_size); if (rl->length < s) @@ -699,6 +699,27 @@ static void wipe_resident_data(ntfs_walk_clusters_ctx *image) wiped_resident_data += n; } +static void clone_logfile_parts(ntfs_walk_clusters_ctx *image, runlist *rl) +{ + s64 offset = 0, lcn, vcn; + + while (1) { + + vcn = offset / image->ni->vol->cluster_size; + lcn = ntfs_rl_vcn_to_lcn(rl, vcn); + if (lcn < 0) + break; + + lseek_to_cluster(lcn); + copy_cluster(); + + if (offset == 0) + offset = NTFS_BLOCK_SIZE >> 1; + else + offset <<= 1; + } +} + static void walk_runs(struct ntfs_walk_cluster *walk) { int i, j; @@ -747,6 +768,10 @@ static void walk_runs(struct ntfs_walk_cluster *walk) walk->image->inuse += lcn_length; } + if (!wipe && !opt.std_out && opt.metadata_only && + walk->image->ni->mft_no == FILE_LogFile && + walk->image->ctx->attr->type == AT_DATA) + clone_logfile_parts(walk->image, rl); free(rl); } From da1b0e094bd827e5b0166012e81cab41389e9dd7 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 5 Mar 2005 19:08:57 +0000 Subject: [PATCH 2218/2994] ntfsclone: make --metadata work with the new $Logfile checking code. Save at least the first 16 KiB of $Logfile (the two RSTR records should always be included if present). Save also records used for checking empty $Logfile. (Logical change 1.691) --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 53846972..8fd11736 100644 --- a/ChangeLog +++ b/ChangeLog @@ -123,6 +123,10 @@ xx/xx/2005 - 2.0.0-WIP pushes successfully to the ntfsprogs repository on bkbits.net. This is done on the server side and is thus independent of whether the client doing the push has got a correct email setup. (Yura, Anton) + - ntfsclone: make --metadata work with the new $Logfile checking code. + Save at least the first 16 KiB of $Logfile (the two RSTR records + should always be included if present). Save also records used for + checking empty $Logfile. (Szaka) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 51351b843c4d9399e1b959d80cb71d8777bb3cf1 Mon Sep 17 00:00:00 2001 From: "elisa-laajakaista.fi!szaka" Date: Sat, 5 Mar 2005 19:08:57 +0000 Subject: [PATCH 2219/2994] ntfsclone: make --metadata work with the new $Logfile checking code. Save at least the first 16 KiB of $Logfile (the two RSTR records should always be included if present). Save also records used for checking empty $Logfile. BKrev: 422a03c9ItD874I8pN-jyUsdbOTlmA From 79a057d686cfc975e95e492473c7207aa14425fc Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 17 Mar 2005 14:29:55 +0000 Subject: [PATCH 2220/2994] Final updates - add bk patch at bottom. (Logical change 1.692) --- BitKeeper/triggers/post-incoming.mail | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/BitKeeper/triggers/post-incoming.mail b/BitKeeper/triggers/post-incoming.mail index ca818c6a..ef72ec4b 100644 --- a/BitKeeper/triggers/post-incoming.mail +++ b/BitKeeper/triggers/post-incoming.mail @@ -50,7 +50,6 @@ bk changes -f -d'$unless(:MERGE:){ChangeSet|:CSETREV:\n}' -r$rev 2>/dev/null | bk -R prs -h -d'$unless(:MERGE:){ChangeSet@:I:, 20:Dy:-:Dm:-:Dd: :T::TZ:, :P:@:HOST:\n}' - 2>/dev/null cat </dev/null cat </dev/null +cat </dev/null + } | mail -R "\"${REPLYTO}\"" -s "\"${SUBJECT}\"" "\"${EMAIL}\"" done From 1327ff636dee81e7f50d4b71d4610613b3913df0 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Thu, 17 Mar 2005 14:29:55 +0000 Subject: [PATCH 2221/2994] post-incoming.mail: Final updates - add bk patch at bottom. BKrev: 42399463IeMabVOIlym6OACBpx3P8A From 1173ab9c98d6c28a37f1b62b38195c4c9c88a60c Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 23 Mar 2005 13:01:27 +0000 Subject: [PATCH 2222/2994] Updates from Holger for regex undelete (Logical change 1.693) --- ntfsprogs/ntfsundelete.8.in | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index a4e2b3f8..3dac76a3 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -27,9 +27,10 @@ will print a list giving the inode number, name and size. .PP The .I undelete -mode takes the inode and recovers as much of the data as possible. It saves the -result to another location. Partly for safety, but mostly because NTFS write -support isn't finished. +mode takes the files either matching the regular expression (option -m) +or specified by the inode-expressions and recovers as much of the data +as possible. It saves the result to another location. Partly for +safety, but mostly because NTFS write support isn't finished. .SS Copy .PP This is a wizard's option. It will save a portion of the MFT to a file. This @@ -158,14 +159,20 @@ file. Use this option with caution. .B \-\-help Show a list of options with a brief description of each one. .TP +.B \-i +.br +.ns +.TP +.B \-\-interactive +Switches the interactive mode, meaning that for each undeleting of a file +the user will be asked. +.TP .BI "\-m " pattern .br .ns .TP .BI "\-\-match " pattern -Filter the output of the -.B \-\-scan -option, by only looking for matching filenames. The pattern can include the +Filter the output by only looking for matching filenames. The pattern can include the wildcards '?', match exactly one character or '*', match zero or more characters. By default the matching is case\-insensitive. To make the search case sensitive, use the @@ -275,14 +282,15 @@ is confident about the size of a deleted file, then it will restore the file to exactly that size. The default behaviour is to round up the size to the nearest cluster (which will be a multiple of 512 bytes). .TP -.BI "\-u " nums +.BI "\-u " [nums] .br .ns .TP -.BI "\-\-undelete " nums -Recover the files with these inode numbers. You can specify more than -one inode by separating with "," or a range of inodes by using -"-". This option can be combined with +.BI "\-\-undelete " [nums] +where is optional. Recover the files either by matching the +regular expression of option -m or by the given nums, which are the +inode numbers. You can specify more than one inode by separating with +"," or a range of inodes by using "-". This option can be combined with .BR \-\-output , .BR \-\-destination , and From 8bb191b3bca5be01abc1d3422003db3489c863ce Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 23 Mar 2005 13:01:27 +0000 Subject: [PATCH 2223/2994] Updates from Holger for regex undelete BKrev: 424168a7wTQkSHMpz1L2EZoJ0qf-0g From 14cd02ffc1d2086633ecf7856311ef6a367b16a8 Mon Sep 17 00:00:00 2001 From: "flatcap.org!ntfs" Date: Wed, 23 Mar 2005 13:01:27 +0000 Subject: [PATCH 2224/2994] Updates from Holger for regex undelete Fix up code formatting (Logical change 1.693) --- ntfsprogs/ntfsundelete.c | 245 +++++++++++++++++++++++---------------- 1 file changed, 143 insertions(+), 102 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 586207b9..990a5b06 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -1,8 +1,8 @@ /** * ntfsundelete - Part of the Linux-NTFS project. * - * Copyright (c) 2002-2004 Richard Russon - * Copyright (c) 2004 Holger Ohmacht + * Copyright (c) 2002-2005 Richard Russon + * Copyright (c) 2004-2005 Holger Ohmacht * * This utility will recover deleted files from an NTFS volume. * @@ -68,13 +68,17 @@ typedef struct u32 end; } range; -static range *ranges; -static long nr_entries; +static short with_regex; /* Flag Regular expression available */ +static short avoid_duplicate_printing; /* Flag No duplicate printing of file infos */ +static range *ranges; /* Array containing all Inode-Rages for undelete */ +static long nr_entries; /* Number of range entries */ GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +static int undelete_file (ntfs_volume *vol, long long inode); + #define _(S) gettext(S) /** @@ -97,43 +101,43 @@ static int parse_inode_arg (void) char *opt_arg_end1; char *opt_arg_end2; + /* Check whether optarg is available or not */ + nr_entries = 0; + if (optarg == NULL) + return (0); /* bailout if no optarg */ + /* init variables */ p = strlen (optarg); imax = p; opt_arg_ptr = optarg; opt_arg_end1 = optarg; opt_arg_end2 = &(optarg[p]); - nr_entries = 0; /* alloc mem for range table */ ranges = (range *) malloc ((p + 1) * sizeof (range)); - if (ranges == NULL) - { + if (ranges == NULL) { printf ("ERROR: Couldn't alloc mem for parsing inodes!\n"); return (-1); } /* loop */ - while ((opt_arg_end1 != opt_arg_end2) && (p > 0)) - { + while ((opt_arg_end1 != opt_arg_end2) && (p > 0)) { + /* Try to get inode */ inode = strtoul (opt_arg_ptr, &opt_arg_end1, 0); p--; /* invalid char at begin */ - if ((opt_arg_ptr == opt_arg_end1) || (opt_arg_ptr == opt_arg_end2)) - { + if ((opt_arg_ptr == opt_arg_end1) || (opt_arg_ptr == opt_arg_end2)) { printf ("ERROR: Invalid Number: %s\n", opt_arg_ptr); return (-1); } /* RANGE - Check for range */ - if (opt_arg_end1[0] == '-') - { + if (opt_arg_end1[0] == '-') { /* get range end */ opt_arg_temp = opt_arg_end1; opt_arg_end1 = & (opt_arg_temp[1]); - if (opt_arg_temp >= opt_arg_end2) - { + if (opt_arg_temp >= opt_arg_end2) { printf ("ERROR: Missing range end!\n"); return (-1); } @@ -141,15 +145,13 @@ static int parse_inode_arg (void) /* get count */ range_end = strtoul (opt_arg_end1, &opt_arg_temp, 0); - if (opt_arg_temp == opt_arg_end1) - { + if (opt_arg_temp == opt_arg_end1) { printf ("ERROR: Invalid Number: %s\n", opt_arg_temp); return (-1); } /* check for correct values */ - if (range_begin > range_end) - { + if (range_begin > range_end) { range_temp = range_end; range_end = range_begin; range_begin = range_temp; @@ -173,8 +175,7 @@ static int parse_inode_arg (void) /* Next inode */ opt_arg_ptr = & (opt_arg_end1[1]); - if (opt_arg_ptr >= opt_arg_end2) - { + if (opt_arg_ptr >= opt_arg_end2) { printf ("ERROR: Missing new value at end of input!\n"); return (-1); } @@ -199,8 +200,8 @@ static void version (void) { printf ("\n%s v%s - Recover deleted files from an NTFS Volume.\n\n", EXEC_NAME, VERSION); - printf ("Copyright (c)\n"); - printf (" 2002-2003 Richard Russon\n"); + printf ("Copyright (c) 2002-2005 Richard Russon\n" + "Copyright (c) 2004-2005 Holger Ohmacht\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -221,7 +222,8 @@ static void usage (void) " -S range --size range Match files of this size\n" " -t since --time since Last referenced since this time\n" "\n" - " -u nums --undelete nums Undelete inodes\n" + " -i --interactive Interactive mode\n" + " -u [nums] --undelete [nums] Undelete mode: if specified, so undelete these\n" " -o file --output file Save with this filename\n" " -O --optimistic Undelete in-use clusters as well\n" " -d dir --destination dir Destination directory\n" @@ -395,13 +397,14 @@ static int parse_time (const char *value, time_t *since) */ static int parse_options (int argc, char *argv[]) { - static const char *sopt = "-b:Cc:d:fh?m:o:OPp:sS:t:Tu:qvV"; + static const char *sopt = "-b:Cc:d:fhi?m:o:OPp:sS:t:Tu::qvV"; static const struct option lopt[] = { { "byte", required_argument, NULL, 'b' }, { "case", no_argument, NULL, 'C' }, { "copy", required_argument, NULL, 'c' }, { "destination", required_argument, NULL, 'd' }, { "force", no_argument, NULL, 'f' }, + { "interactive", no_argument, NULL, 'i' }, { "help", no_argument, NULL, 'h' }, { "match", required_argument, NULL, 'm' }, { "output", required_argument, NULL, 'o' }, @@ -412,7 +415,7 @@ static int parse_options (int argc, char *argv[]) { "parent", no_argument, NULL, 'P' }, { "time", required_argument, NULL, 't' }, { "truncate", no_argument, NULL, 'T' }, - { "undelete", required_argument, NULL, 'u' }, + { "undelete", optional_argument, NULL, 'u' }, { "quiet", no_argument, NULL, 'q' }, { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' }, @@ -431,8 +434,7 @@ static int parse_options (int argc, char *argv[]) opts.uinode = -1; opts.percent = -1; opts.fillbyte = -1; - - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!opts.device) { @@ -480,8 +482,12 @@ static int parse_options (int argc, char *argv[]) break; case 'm': if (!opts.match) { - if (!transform (optarg, &opts.match)) + if (!transform (optarg, &opts.match)) { err++; + } else { + /* set regex-flag on true ;) */ + with_regex= 1; + } } else { err++; } @@ -545,8 +551,7 @@ static int parse_options (int argc, char *argv[]) opts.truncate++; break; case 'u': - if (opts.mode == MODE_NONE) - { + if (opts.mode == MODE_NONE) { end = NULL; opts.mode = MODE_UNDELETE; /* parse inodes */ @@ -605,13 +610,13 @@ static int parse_options (int argc, char *argv[]) err++; } break; + case MODE_UNDELETE: - if ((opts.percent != -1) || opts.match || opts.match_case || - (opts.size_begin > 0) || (opts.size_end > 0)) { + /*if ((opts.percent != -1) || (opts.size_begin > 0) || (opts.size_end > 0)) { Eprintf ("Undelete can only be used with " "--output, --destination, --byte and --truncate.\n"); err++; - } + }*/ break; case MODE_COPY: if ((opts.fillbyte != (char)-1) || opts.truncate || @@ -730,7 +735,7 @@ static FILE_NAME_ATTR* verify_parent(struct filename* name, MFT_RECORD* rec) { ctx = ntfs_attr_get_search_ctx(NULL, rec); if (!ctx) { - Eprintf ("Couldn't create a search context.\n"); + Eprintf ("ERROR: Couldn't create a search context.\n"); return NULL; } @@ -754,15 +759,14 @@ static FILE_NAME_ATTR* verify_parent(struct filename* name, MFT_RECORD* rec) { if (filename_attr->file_name_type == name->name_space) { found_same_space = 1; - } - else { + } else { if (filename_attr->file_name_type < lowest_space_name->file_name_type) { lowest_space_name = filename_attr; } } } } - + ntfs_attr_put_search_ctx(ctx); return (found_same_space ? filename_attr : lowest_space_name); @@ -771,9 +775,9 @@ static FILE_NAME_ATTR* verify_parent(struct filename* name, MFT_RECORD* rec) { /** * get_parent_name - Find the name of a file's parent. * @name: the filename whose parent's name to find - * */ -static void get_parent_name(struct filename* name, ntfs_volume* vol) { +static void get_parent_name (struct filename* name, ntfs_volume* vol) +{ ntfs_attr* mft_data; MFT_RECORD* rec; FILE_NAME_ATTR* filename_attr; @@ -784,21 +788,19 @@ static void get_parent_name(struct filename* name, ntfs_volume* vol) { rec = calloc(1, vol->mft_record_size); if (!rec) { - Eprintf ("Couldn't allocate memory in get_parent_name()\n"); + Eprintf ("ERROR: Couldn't allocate memory in get_parent_name()\n"); return; } mft_data = ntfs_attr_open(vol->mft_ni, AT_DATA, NULL, 0); if (!mft_data) { - Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); - } - else { + Eprintf ("ERROR: Couldn't open $MFT/$DATA: %s\n", strerror (errno)); + } else { inode_num = MREF(name->parent_mref); if (ntfs_attr_pread(mft_data, vol->mft_record_size * inode_num, vol->mft_record_size, rec) < 1) { - Eprintf ("Couldn't read MFT Record %lld.\n", inode_num); - } - else { + Eprintf ("ERROR: Couldn't read MFT Record %lld.\n", inode_num); + } else { if ((filename_attr = verify_parent(name, rec))) { if (ntfs_ucstombs(filename_attr->file_name, filename_attr->file_name_length, &name->parent_name, 0) < 0) { Dprintf ("Couldn't translate filename to current locale.\n"); @@ -860,7 +862,7 @@ static int get_filenames (struct ufile *file, ntfs_volume* vol) name = calloc (1, sizeof (*name)); if (!name) { - Eprintf ("Couldn't allocate memory in get_filenames().\n"); + Eprintf ("ERROR: Couldn't allocate memory in get_filenames().\n"); count = -1; break; } @@ -879,7 +881,7 @@ static int get_filenames (struct ufile *file, ntfs_volume* vol) if (ntfs_ucstombs (name->uname, name->uname_len, &name->name, name->uname_len) < 0) { - Dprintf ("Couldn't translate filename to current locale.\n"); + Dprintf ("ERROR: Couldn't translate filename to current locale.\n"); } name->parent_name = NULL; @@ -939,7 +941,7 @@ static int get_data (struct ufile *file, ntfs_volume *vol) while ((rec = find_attribute (AT_DATA, ctx))) { data = calloc (1, sizeof (*data)); if (!data) { - Eprintf ("Couldn't allocate memory in get_data().\n"); + Eprintf ("ERROR: Couldn't allocate memory in get_data().\n"); count = -1; break; } @@ -954,7 +956,7 @@ static int get_data (struct ufile *file, ntfs_volume *vol) if (ntfs_ucstombs (data->uname, data->uname_len, &data->name, data->uname_len) < 0) { - Eprintf ("Cannot translate name into current locale.\n"); + Eprintf ("ERROR: Cannot translate name into current locale.\n"); } } @@ -1007,7 +1009,7 @@ static struct ufile * read_record (ntfs_volume *vol, long long record) file = calloc (1, sizeof (*file)); if (!file) { - Eprintf ("Couldn't allocate memory in read_record()\n"); + Eprintf ("ERROR: Couldn't allocate memory in read_record()\n"); return NULL; } @@ -1017,20 +1019,20 @@ static struct ufile * read_record (ntfs_volume *vol, long long record) file->mft = malloc (vol->mft_record_size); if (!file->mft) { - Eprintf ("Couldn't allocate memory in read_record()\n"); + Eprintf ("ERROR: Couldn't allocate memory in read_record()\n"); free_file (file); return NULL; } mft = ntfs_attr_open (vol->mft_ni, AT_DATA, NULL, 0); if (!mft) { - Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); + Eprintf ("ERROR: Couldn't open $MFT/$DATA: %s\n", strerror (errno)); free_file (file); return NULL; } if (ntfs_attr_mst_pread (mft, vol->mft_record_size * record, 1, vol->mft_record_size, file->mft) < 1) { - Eprintf ("Couldn't read MFT Record %lld.\n", record); + Eprintf ("ERROR: Couldn't read MFT Record %lld.\n", record); ntfs_attr_close (mft); free_file (file); return NULL; @@ -1045,8 +1047,7 @@ static struct ufile * read_record (ntfs_volume *vol, long long record) Dprintf ("Attributes present: %s %s %s\n", attr10?"0x10":"", attr20?"0x20":"", attr90?"0x90":""); - if (attr10) - { + if (attr10) { STANDARD_INFORMATION *si; si = (STANDARD_INFORMATION *) ((char *) attr10 + le16_to_cpu (attr10->value_offset)); file->date = ntfs2utc (sle64_to_cpu (si->last_data_change_time)); @@ -1058,10 +1059,10 @@ static struct ufile * read_record (ntfs_volume *vol, long long record) file->directory = 1; if (get_filenames (file, vol) < 0) { - Eprintf ("Couldn't get filenames.\n"); + Eprintf ("ERROR: Couldn't get filenames.\n"); } if (get_data (file, vol) < 0) { - Eprintf ("Couldn't get data streams.\n"); + Eprintf ("ERROR: Couldn't get data streams.\n"); } return file; @@ -1179,7 +1180,7 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) } if ((clusters_inuse + clusters_free) == 0) { - Eprintf ("Unexpected error whilst calculating percentage for inode %lld\n", file->inode); + Eprintf ("ERROR: Unexpected error whilst calculating percentage for inode %lld\n", file->inode); continue; } @@ -1369,6 +1370,7 @@ static void list_record (struct ufile *file) Qprintf ("%-8lld %c%c%c%c %3d%% %s %9lld %s\n", file->inode, flagd, flagr, flagc, flagx, percent, buffer, size, name); + } /** @@ -1533,7 +1535,7 @@ static int set_date (const char *pathname, time_t date) ut.actime = date; ut.modtime = date; if (utime (pathname, &ut)) { - Eprintf ("Couldn't set the file's date and time\n"); + Eprintf ("ERROR: Couldn't set the file's date and time\n"); return 0; } return 1; @@ -1570,14 +1572,14 @@ static int scan_disk (ntfs_volume *vol) attr = ntfs_attr_open (vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0); if (!attr) { - Eprintf ("Couldn't open $MFT/$BITMAP: %s\n", strerror (errno)); + Eprintf ("ERROR: Couldn't open $MFT/$BITMAP: %s\n", strerror (errno)); return -1; } bmpsize = attr->initialized_size; buffer = malloc (BUFSIZE); if (!buffer) { - Eprintf ("Couldn't allocate memory in scan_disk()\n"); + Eprintf ("ERROR: Couldn't allocate memory in scan_disk()\n"); results = -1; goto out; } @@ -1588,7 +1590,7 @@ static int scan_disk (ntfs_volume *vol) if (!opts.match_case) flags |= REG_ICASE; if (regcomp (&re, opts.match, flags)) { - Eprintf ("Couldn't create a regex.\n"); + Eprintf ("ERROR: Couldn't create a regex.\n"); goto out; } } @@ -1596,7 +1598,7 @@ static int scan_disk (ntfs_volume *vol) nr_mft_records = vol->mft_na->initialized_size >> vol->mft_record_size_bits; - Qprintf ("Inode Flags %%age Date Size Filename\n"); + Qprintf ("Inode Flags %%age Date Size Filename\n"); Qprintf ("---------------------------------------------------------------\n"); for (i = 0; i < bmpsize; i += BUFSIZE) { long long read_count = min ((bmpsize - i), BUFSIZE); @@ -1627,14 +1629,22 @@ static int scan_disk (ntfs_volume *vol) goto skip; percent = calc_percentage (file, vol); - if ((opts.percent == -1) || (percent >= opts.percent)) { if (opts.verbose) dump_record (file); else list_record (file); - } + /* Was -u specified with no inode + so undelete file by regex */ + if (opts.mode == MODE_UNDELETE) { + if (!undelete_file (vol, file->inode)) + Vprintf ("ERROR: Failed to undelete " + "inode %lli\n!", + file->inode); + printf ("\n"); + } + } if (((opts.percent == -1) && (percent > 0)) || ((opts.percent > 0) && (percent >= opts.percent))) { results++; @@ -1696,12 +1706,23 @@ static int undelete_file (ntfs_volume *vol, long long inode) if (!vol) return 0; + /* try to get record */ file = read_record (vol, inode); if (!file || !file->mft) { Eprintf ("Can't read info from mft record %lld.\n", inode); return 0; } + /* if flag was not set, print file informations */ + if (avoid_duplicate_printing == 0) { + if (opts.verbose) { + dump_record (file); + } else { + list_record (file); + //Qprintf ("\n"); + } + } + bufsize = vol->cluster_size; buffer = malloc (bufsize); if (!buffer) @@ -1722,15 +1743,6 @@ static int undelete_file (ntfs_volume *vol, long long inode) goto free; } - if (opts.verbose) { - dump_record (file); - } else { - Qprintf ("Inode Flags %%age Date Size Filename\n"); - Qprintf ("---------------------------------------------------------------\n"); - list_record (file); - Qprintf ("\n"); - } - if (list_empty (&file->data)) { Qprintf ("File has no data. There is nothing to recover.\n"); goto free; @@ -1986,6 +1998,46 @@ free: return result; } +/** + * handle_undelete + * Handles the undelete + */ +int handle_undelete (ntfs_volume *vol) +{ + int result = 1; + int i; + unsigned long long inode; + + /* Check whether (an) inode(s) was specified or at least a regex! */ + if (nr_entries == 0) { + if (with_regex == 0) { + printf ("ERROR: NO inode(s) AND NO match-regex specified!\n"); + } else { + avoid_duplicate_printing= 1; + result = !scan_disk (vol); + if (result) + Vprintf ("ERROR: Failed to scan device '%s'.\n", opts.device); + } + } else { + /* Normal undelete by specifying inode(s) */ + Qprintf ("Inode Flags %%age Date Size Filename\n"); + Qprintf ("---------------------------------------------------------------\n"); + + /* loop all given inodes */ + for (i = 0; i < nr_entries; i++) { + for (inode = ranges[i].begin; inode <= ranges[i].end; inode ++) { + /* Now undelete file */ + result = !undelete_file (vol, inode); + if (result) + Vprintf ("ERROR: Failed to undelete " + "inode %lli\n!", + inode); + } + } + } + return (result); +} + /** * main - Begin here * @@ -1996,11 +2048,11 @@ free: */ int main (int argc, char *argv[]) { - s64 nr_mft_records; ntfs_volume *vol; int result = 1; - int i; - u32 inode; + + with_regex = 0; + avoid_duplicate_printing = 0; if (!parse_options (argc, argv)) goto free; @@ -2011,39 +2063,28 @@ int main (int argc, char *argv[]) if (!vol) return 1; + /* handling of the different modes */ switch (opts.mode) { + /* Scanning */ case MODE_SCAN: result = !scan_disk (vol); if (result) - Vprintf ("Failed to scan device '%s'.\n", opts.device); + Vprintf ("ERROR: Failed to scan device '%s'.\n", opts.device); break; + + /* Undelete-handling */ case MODE_UNDELETE: - if (nr_entries == 0) - { - printf ("ERROR: No inode(s) specified!\n"); - break; - } - - for (i = 0; i < nr_entries; i++) - { - for (inode = ranges[i].begin; inode <= ranges[i].end; inode ++) - { - result = !undelete_file (vol, inode); - if (result) - Vprintf ("ERROR: Failed to undelete " - "inode %u\n!", - (unsigned int)inode); - } - } + result= handle_undelete (vol); break; - case MODE_COPY: - nr_mft_records = vol->mft_na->initialized_size >> - vol->mft_record_size_bits; + /* Handling of copy mft */ + case MODE_COPY: result = !copy_mft (vol, opts.mft_begin, opts.mft_end); if (result) - Vprintf ("Failed to read MFT blocks %lld-%lld.\n", - opts.mft_begin, min(nr_mft_records, opts.mft_end)); + Vprintf ("ERROR: Failed to read MFT blocks %lld-%lld.\n", + opts.mft_begin, + min((vol->mft_na->initialized_size >> + vol->mft_record_size_bits) , opts.mft_end)); break; default: ; /* Cannot happen */ From 1465436e8c623fc4bc81b57b2b4a87ddf4a3584c Mon Sep 17 00:00:00 2001 From: void!yura Date: Wed, 6 Apr 2005 15:47:43 +0000 Subject: [PATCH 2225/2994] nftscp: add ability to specify directory as destination file (Logical change 1.694) --- ntfsprogs/ntfscp.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index a8b93348..f459c237 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -324,11 +324,47 @@ int main (int argc, char *argv[]) perror("ERROR: Couldn't open destination file"); goto close_src; } - + if ((le16_to_cpu(out->mrec->flags) & MFT_RECORD_IS_DIRECTORY) && + !opts.inode){ + /* + * @out is directory and it was specified by pathname, add + * filename to path and reopen inode. + */ + char *filename, *new_dest_file; + + /* + * FIXME: There should exist more beautiful way to get filename. + * Not sure that it will work in windows, but I don't think that + * someone will use ntfscp under windows. + */ + filename = strrchr(opts.src_file, '/'); + if (filename) + filename++; + else + filename = opts.src_file; + /* Add 2 bytes for '/' and null-terminator. */ + new_dest_file = malloc(strlen(opts.dest_file) + + strlen(filename) + 2); + if (!new_dest_file) { + perror("ERROR: malloc() failed"); + goto close_dst; + } + strcpy(new_dest_file, opts.dest_file); + strcat(new_dest_file, "/"); + strcat(new_dest_file, filename); + ntfs_inode_close(out); + out = utils_pathname_to_inode(vol, NULL, new_dest_file); + free(new_dest_file); + if (!out) { + perror("ERROR: Failed to open destination file"); + goto close_src; + } + } + if (opts.attr_name) { attr_name_len = ntfs_mbstoucs(opts.attr_name, &attr_name, 0); if (attr_name_len == -1) { - perror("ERROR: failed to parse attribute name"); + perror("ERROR: Failed to parse attribute name"); goto close_dst; } } From 36f9acd20b3116b53da0c764cc30b7d7abddfb14 Mon Sep 17 00:00:00 2001 From: void!yura Date: Wed, 6 Apr 2005 15:47:43 +0000 Subject: [PATCH 2226/2994] nftscp: add ability to specify directory as destination file BKrev: 4254049fN7qBHuqVSWHfB2RW9JcUqA From 9b0a58972acd9fb4ac79a8576392d53ed8e8726b Mon Sep 17 00:00:00 2001 From: void!yura Date: Wed, 6 Apr 2005 15:47:43 +0000 Subject: [PATCH 2227/2994] update (Logical change 1.694) --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 8fd11736..7d527908 100644 --- a/ChangeLog +++ b/ChangeLog @@ -127,6 +127,7 @@ xx/xx/2005 - 2.0.0-WIP Save at least the first 16 KiB of $Logfile (the two RSTR records should always be included if present). Save also records used for checking empty $Logfile. (Szaka) + - ntfscp: add ability to specify directory as destination file. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 0ea4c16aa9ba8b58bee22f4e70fbfdbd2e21c793 Mon Sep 17 00:00:00 2001 From: void!yura Date: Wed, 6 Apr 2005 15:57:09 +0000 Subject: [PATCH 2228/2994] Update my email address (Logical change 1.695) --- CREDITS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CREDITS b/CREDITS index c81e77f4..1bfffcd5 100644 --- a/CREDITS +++ b/CREDITS @@ -26,7 +26,7 @@ Giang Nguyen Leonard NorrgĂĄrd Holger Ohmacht Per Olofsson -Yura Pakhuchiy +Yura Pakhuchiy Yuri Per Richard Russon Szakacsits Szabolcs From cef94e5b9f6cd51c013d1aefbce7642fd24899e0 Mon Sep 17 00:00:00 2001 From: void!yura Date: Wed, 6 Apr 2005 15:57:09 +0000 Subject: [PATCH 2229/2994] Update my email address BKrev: 425406d5nQblCrnOTOlfENExATIciQ From ac13794c541d33b6aebbedca696af26fb774ed96 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 19 Apr 2005 12:00:26 +0000 Subject: [PATCH 2230/2994] Update with SUSE 9.3 build tools. (Logical change 1.696) --- INSTALL | 11 +- Makefile.in | 30 +- aclocal.m4 | 900 +++++++++++++++++------------------- compile | 8 +- config.guess | 140 +++--- config.sub | 60 ++- configure | 956 +++++++++++++++++++++++---------------- depcomp | 53 ++- doc/Makefile.in | 4 +- include/Makefile.in | 24 +- include/ntfs/Makefile.in | 4 +- install-sh | 12 +- libntfs/Makefile.in | 4 +- ltmain.sh | 527 ++++++++++----------- missing | 16 +- mkinstalldirs | 6 +- ntfsprogs/Makefile.in | 4 +- 17 files changed, 1487 insertions(+), 1272 deletions(-) diff --git a/INSTALL b/INSTALL index 095b1eb4..56b077d6 100644 --- a/INSTALL +++ b/INSTALL @@ -1,7 +1,7 @@ Installation Instructions ************************* -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives @@ -189,8 +189,13 @@ them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc -will cause the specified gcc to be used as the C compiler (unless it is -overridden in the site shell script). +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. `configure' Invocation ====================== diff --git a/Makefile.in b/Makefile.in index 92efbf1a..ce793941 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 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. @@ -263,7 +263,13 @@ uninstall-info-am: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -275,7 +281,7 @@ $(RECURSIVE_TARGETS): local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ @@ -283,7 +289,13 @@ $(RECURSIVE_TARGETS): mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ @@ -304,7 +316,7 @@ maintainer-clean-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -625,15 +637,15 @@ libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status --recheck strip: - $(MAKE) -C ntfsprogs strip + (cd ntfsprogs && $(MAKE) strip) || exit 1; extra: extras extras: - $(MAKE) -C ntfsprogs extras + (cd ntfsprogs && $(MAKE) extras) || exit 1; libs: - $(MAKE) -C libntfs libs + (cd libntfs && $(MAKE) libs) || exit 1; # 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/aclocal.m4 b/aclocal.m4 index d9d06614..2b04da7c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.9.3 -*- Autoconf -*- +# generated automatically by aclocal 1.9.5 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 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. @@ -191,6 +191,8 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -308,7 +310,7 @@ fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -484,9 +486,8 @@ ia64-*-hpux*) x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - lt_cv_cc_lib64_suffix=no if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.$ac_objext`" in + case "`/usr/bin/file conftest.o`" in *32-bit*) case $host in x86_64-*linux*) @@ -507,19 +508,15 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" - lt_cv_cc_lib64_suffix=yes ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" - lt_cv_cc_lib64_suffix=yes ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" - lt_cv_cc_lib64_suffix=yes ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" - lt_cv_cc_lib64_suffix=yes ;; esac ;; @@ -672,11 +669,37 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=8192; ;; - *) + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + ;; + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && @@ -1010,8 +1033,8 @@ AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_AC_TAGVAR(hardcode_action, $1)= if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then + test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existant directories. if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && @@ -1178,7 +1201,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -1236,7 +1259,7 @@ cygwin* | mingw* | pw32*) ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac ;; @@ -1294,7 +1317,9 @@ kfreebsd*-gnu) dynamic_linker='GNU ld.so' ;; -freebsd*) +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in @@ -1313,7 +1338,7 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.[01]* | freebsdelf3.[01]*) + freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -1437,16 +1462,10 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - libsuff= - if test "$lt_cv_cc_lib64_suffix" = "yes"; then - libsuff=64 - fi - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} $lt_ld_extra" - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} /usr/local/lib${libsuff} $lt_ld_extra" + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -1508,7 +1527,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=yes + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -1674,7 +1693,9 @@ if test -f "$ltmain" && test -n "$tagnames"; then case $tagname in CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then AC_LIBTOOL_LANG_CXX_CONFIG else tagname="" @@ -2079,6 +2100,15 @@ case $reload_flag in *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac ])# AC_PROG_LD_RELOAD_FLAG @@ -2112,7 +2142,7 @@ beos*) lt_cv_deplibs_check_method=pass_all ;; -bsdi4*) +bsdi[[45]]*) 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 @@ -2135,13 +2165,13 @@ darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; -freebsd* | kfreebsd*-gnu) +freebsd* | kfreebsd*-gnu | dragonfly*) 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_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/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.*` ;; @@ -2185,15 +2215,6 @@ irix5* | irix6* | nonstopux*) # This must be Linux ELF. linux*) - case $host_cpu in - alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - # this will be overridden with pass_all, but let us keep it just in case - 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` lt_cv_deplibs_check_method=pass_all ;; @@ -2216,12 +2237,10 @@ nto-qnx*) ;; openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; @@ -2411,10 +2430,21 @@ AC_DEFUN([AC_LIBTOOL_CXX], # --------------- AC_DEFUN([_LT_AC_LANG_CXX], [AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) ])# _LT_AC_LANG_CXX +# _LT_AC_PROG_CXXCPP +# --------------- +AC_DEFUN([_LT_AC_PROG_CXXCPP], +[ +AC_REQUIRE([AC_PROG_CXX]) +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +fi +])# _LT_AC_PROG_CXXCPP # AC_LIBTOOL_F77 # -------------- @@ -2549,43 +2579,6 @@ aix3*) aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac @@ -2612,7 +2605,7 @@ AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], [AC_LANG_PUSH(C++) AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(allow_undefined_flag, $1)= @@ -2784,7 +2777,7 @@ case $host_os in _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) + case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` @@ -2805,6 +2798,9 @@ case $host_os in fi esac shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi else # not using gcc if test "$host_cpu" = ia64; then @@ -2864,6 +2860,7 @@ case $host_os in esac ;; + cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. @@ -2887,57 +2884,68 @@ case $host_os in _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; - - darwin* | rhapsody*) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; dgux*) case $cc_basename in @@ -2956,14 +2964,14 @@ case $host_os in ;; esac ;; - freebsd[12]*) + freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before switch to ELF _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;; - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_AC_TAGVAR(ld_shlibs, $1)=yes @@ -2994,7 +3002,7 @@ case $host_os in # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then @@ -3143,13 +3151,36 @@ case $host_os in icpc) # Intel C++ with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; + pgCC) + # Portland Group C++ compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + ;; cxx) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -3202,6 +3233,22 @@ case $host_os in # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; osf3*) case $cc_basename in KCC) @@ -3372,7 +3419,7 @@ case $host_os in _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system @@ -3749,7 +3796,7 @@ _LT_AC_TAGVAR(objext, $1)=$objext lt_simple_compile_test_code="class foo {}\n" # Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER @@ -3839,7 +3886,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -3960,7 +4007,7 @@ Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= @@ -3991,6 +4038,12 @@ fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo @@ -4033,7 +4086,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4341,9 +4394,6 @@ symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" @@ -4365,6 +4415,13 @@ hpux*) # Its linker distinguishes data from code symbols lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; +linux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDGIRSTW]]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; @@ -4396,8 +4453,11 @@ esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no @@ -4592,6 +4652,16 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; esac ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; dgux*) case $cc_basename in ec++) @@ -4605,7 +4675,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; esac ;; - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) @@ -4651,12 +4721,18 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; - icpc) + icpc* | ecpc*) # Intel C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; + pgCC) + # Portland Group C++ compiler. + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha @@ -4845,6 +4921,16 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -4880,12 +4966,19 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) - case $CC in + case $cc_basename in icc* | ecc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; + pgcc | pgf77 | pgf90) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; ccc*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. @@ -4930,6 +5023,11 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) fi ;; + unicos*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + uts4*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' @@ -4990,7 +5088,7 @@ ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' @@ -5103,7 +5201,7 @@ EOF _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' @@ -5117,7 +5215,7 @@ EOF fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' else - ld_shlibs=no + _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; @@ -5161,11 +5259,21 @@ EOF linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' supports_anon_versioning=no case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions @@ -5175,9 +5283,9 @@ EOF _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) fi else _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -5267,7 +5375,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) + case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` @@ -5288,6 +5396,9 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ fi esac shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi else # not using gcc if test "$host_cpu" = ia64; then @@ -5346,7 +5457,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - bsdi4*) + bsdi[[45]]*) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; @@ -5367,57 +5478,57 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_automatic, $1)=yes _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - _LT_AC_TAGVAR(ld_shlibs, $1)=no + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac fi ;; @@ -5451,7 +5562,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_AC_TAGVAR(hardcode_direct, $1)=yes @@ -5562,6 +5673,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else @@ -5639,7 +5751,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -5900,7 +6012,7 @@ lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break + test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in @@ -5925,8 +6037,8 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do fi done done -SED=$lt_cv_path_SED ]) +SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) @@ -5988,23 +6100,11 @@ AC_DEFUN([PKG_CHECK_MODULES], [ -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. - -# 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 +# Copyright (C) 2002, 2003, 2005 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. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- @@ -6017,26 +6117,15 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # 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.9.3])]) + [AM_AUTOMAKE_VERSION([1.9.5])]) -# AM_AUX_DIR_EXPAND +# AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 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. +# Copyright (C) 2001, 2003, 2005 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. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to @@ -6083,26 +6172,16 @@ AC_PREREQ([2.50])dnl am_aux_dir=`cd $ac_aux_dir && pwd` ]) -# AM_CONDITIONAL -*- Autoconf -*- +# AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# 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. -# 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 6 +# serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- @@ -6126,26 +6205,15 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# serial 7 -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # 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. -# 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 8 # 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, @@ -6154,7 +6222,6 @@ fi])]) # CC etc. in the Makefile, will ask for an AC_PROG_CC use... - # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. @@ -6294,27 +6361,16 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) -# Generate code to set up dependency tracking. -*- Autoconf -*- +# Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# 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. -# 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 +#serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ @@ -6373,30 +6429,19 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Do all the work for Automake. -*- Autoconf -*- +# 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, 2004 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # 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. -# 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. +# serial 12 -# 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 11 +# 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. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) @@ -6498,51 +6543,27 @@ for _am_header in $config_headers :; do done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +# Copyright (C) 2001, 2003, 2005 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. + # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. - -# Copyright (C) 2001, 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. - 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)]) -# -*- Autoconf -*- -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2005 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. -# 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 +# serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. @@ -6557,26 +6578,15 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) -# Check to see how 'make' treats includes. -*- Autoconf -*- +# Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005 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. -# 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 +# serial 3 # AM_MAKE_INCLUDE() # ----------------- @@ -6620,27 +6630,16 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) -# -*- Autoconf -*- +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# 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. -# Copyright (C) 1997, 1999, 2000, 2001, 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 3 +# serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -6666,27 +6665,16 @@ else fi ]) +# Copyright (C) 2003, 2004, 2005 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. + # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - -# Copyright (C) 2003, 2004 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. - +# # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). @@ -6740,26 +6728,15 @@ else fi AC_SUBST([mkdir_p])]) -# Helper functions for option handling. -*- Autoconf -*- +# Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005 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. -# 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 +# serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -6784,28 +6761,16 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. # -# Check to make sure that the build environment is sane. -# +# 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. -# Copyright (C) 1996, 1997, 2000, 2001, 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 3 +# serial 4 # AM_SANITY_CHECK # --------------- @@ -6848,25 +6813,14 @@ Check your system clock]) fi AC_MSG_RESULT(yes)]) +# Copyright (C) 2001, 2003, 2005 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. + # AM_PROG_INSTALL_STRIP - -# Copyright (C) 2001, 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. - +# --------------------- # 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 @@ -6889,25 +6843,13 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004 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 +# Copyright (C) 2004, 2005 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. +# serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- diff --git a/compile b/compile index 3d217032..ad57e2f6 100755 --- a/compile +++ b/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand `-c -o'. -scriptversion=2004-10-12.08 +scriptversion=2005-02-03.08 -# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -47,11 +47,11 @@ right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF - exit 0 + exit $? ;; -v | --v*) echo "compile $scriptversion" - exit 0 + exit $? ;; esac diff --git a/config.guess b/config.guess index 51fab477..44f30e6c 100755 --- a/config.guess +++ b/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2004-03-12' +timestamp='2005-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -136,6 +136,16 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -203,15 +213,15 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + luna88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -227,21 +237,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - pegasos:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} + echo mips64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -307,9 +308,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; - Alpha*:OpenVMS:*:*) - echo alpha-hp-vms - exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -331,6 +329,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit 0 ;; *:OS400:*:*) echo powerpc-ibm-os400 exit 0 ;; @@ -354,7 +355,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; @@ -764,7 +765,7 @@ EOF echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` @@ -787,21 +788,7 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - # GNU/KFreeBSD systems have a "k" prefix to indicate we are using - # FreeBSD's kernel, but not the complete OS. - case ${LIBC} in gnu) kernel_only='k' ;; esac - echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -827,6 +814,9 @@ EOF i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; + amd64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; @@ -845,19 +835,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo cris-axis-linux + exit 0 ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux + exit 0 ;; + frv:Linux:*:*) + echo frv-${VENDOR}-linux exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -876,7 +872,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -895,13 +891,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-${VENDOR}-linux exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-${VENDOR}-linux exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -914,34 +910,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-${VENDOR}-linux ;; + PA8*) echo hppa2.0-${VENDOR}-linux ;; + *) echo hppa-${VENDOR}-linux ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-${VENDOR}-linux exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo x86_64-${VENDOR}-linux exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -956,18 +952,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" + echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" + echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or + # Either a pre-BFD a.out linker (linuxoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -996,7 +992,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) @@ -1096,9 +1092,9 @@ EOF M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; - M68*:*:R3V[567]*:*) + M68*:*:R3V[5678]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -1196,9 +1192,10 @@ EOF echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) - case `uname -p` in + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; + unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; @@ -1213,6 +1210,9 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit 0 ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; @@ -1260,6 +1260,16 @@ EOF *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms && exit 0 ;; + I*) echo ia64-dec-vms && exit 0 ;; + V*) echo vax-dec-vms && exit 0 ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 diff --git a/config.sub b/config.sub index ba331039..c884ad4e 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2004-03-12' +timestamp='2005-02-10' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -70,7 +70,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -145,7 +145,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -237,7 +237,7 @@ case $basic_machine in | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | mcore \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -267,7 +267,7 @@ case $basic_machine in | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; @@ -300,7 +300,7 @@ case $basic_machine in | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ @@ -310,7 +310,7 @@ case $basic_machine in | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -326,8 +326,9 @@ case $basic_machine in | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ @@ -342,8 +343,8 @@ case $basic_machine in | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; @@ -445,6 +446,10 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; cr16c) basic_machine=cr16c-unknown os=-elf @@ -452,6 +457,9 @@ case $basic_machine in crds | unos) basic_machine=m68k-crds ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; @@ -481,6 +489,10 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -659,10 +671,6 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -743,10 +751,6 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -1029,6 +1033,10 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; xps | xps100) basic_machine=xps100-honeywell ;; @@ -1059,6 +1067,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1161,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1194,9 +1205,6 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; @@ -1294,6 +1302,9 @@ case $os in -kaos*) os=-kaos ;; + -zvmoe) + os=-zvmoe + ;; -none) ;; *) @@ -1374,6 +1385,9 @@ case $basic_machine in *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; diff --git a/configure b/configure index be39cf4a..a2321c15 100755 --- a/configure +++ b/configure @@ -280,7 +280,7 @@ fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -3458,7 +3458,7 @@ lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break + test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in @@ -3483,10 +3483,10 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do fi done done -SED=$lt_cv_path_SED fi +SED=$lt_cv_path_SED echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 @@ -3627,6 +3627,15 @@ case $reload_flag in *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 @@ -3702,7 +3711,7 @@ beos*) lt_cv_deplibs_check_method=pass_all ;; -bsdi4*) +bsdi[45]*) 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 @@ -3725,13 +3734,13 @@ darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; -freebsd* | kfreebsd*-gnu) +freebsd* | kfreebsd*-gnu | dragonfly*) 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_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/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.*` ;; @@ -3775,15 +3784,6 @@ irix5* | irix6* | nonstopux*) # This must be Linux ELF. linux*) - case $host_cpu in - alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - # this will be overridden with pass_all, but let us keep it just in case - 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` lt_cv_deplibs_check_method=pass_all ;; @@ -3806,12 +3806,10 @@ nto-qnx*) ;; openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; @@ -3904,7 +3902,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3907 "configure"' > conftest.$ac_ext + echo '#line 3905 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -3942,13 +3940,12 @@ ia64-*-hpux*) x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - lt_cv_cc_lib64_suffix=no 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 + case "`/usr/bin/file conftest.o`" in *32-bit*) case $host in x86_64-*linux*) @@ -3969,19 +3966,15 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) case $host in x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" - lt_cv_cc_lib64_suffix=yes ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" - lt_cv_cc_lib64_suffix=yes ;; s390*-*linux*) LD="${LD-ld} -m elf64_s390" - lt_cv_cc_lib64_suffix=yes ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" - lt_cv_cc_lib64_suffix=yes ;; esac ;; @@ -5158,7 +5151,12 @@ else fi -ac_ext=cc + + +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' @@ -5388,6 +5386,8 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +fi + ac_ext=f ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' @@ -5671,11 +5671,37 @@ else lt_cv_sys_max_cmd_len=8192; ;; - *) + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + ;; + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ = "XX$teststring") >/dev/null 2>&1 && new_result=`expr "X$teststring" : ".*" 2>&1` && lt_cv_sys_max_cmd_len=$new_result && @@ -5721,9 +5747,6 @@ symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" @@ -5745,6 +5768,13 @@ hpux*) # Its linker distinguishes data from code symbols lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; +linux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDGIRSTW]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; @@ -5776,8 +5806,11 @@ esac # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no @@ -6244,6 +6277,8 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -6515,11 +6550,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6518: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6553: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6522: \$? = $ac_status" >&5 + echo "$as_me:6557: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6626,6 +6661,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + lt_prog_compiler_pic='-qnocommon' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -6661,12 +6706,19 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) - case $CC in + case $cc_basename in icc* | ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; + pgcc | pgf77 | pgf90) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-static' + ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. @@ -6711,6 +6763,11 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 fi ;; + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' @@ -6748,11 +6805,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6751: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6808: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6755: \$? = $ac_status" >&5 + echo "$as_me:6812: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6808,11 +6865,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6811: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6868: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6815: \$? = $ac_status" >&5 + echo "$as_me:6872: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -6967,7 +7024,7 @@ EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' @@ -7025,11 +7082,21 @@ EOF linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds="$tmp_archive_cmds" + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' supports_anon_versioning=no case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions @@ -7039,9 +7106,9 @@ EOF archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' else - archive_expsym_cmds="$tmp_archive_cmds" + archive_expsym_cmds=$archive_cmds fi else ld_shlibs=no @@ -7131,7 +7198,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ link_all_deplibs=yes if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) + case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` @@ -7152,6 +7219,9 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ fi esac shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi else # not using gcc if test "$host_cpu" = ia64; then @@ -7312,7 +7382,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs=no ;; - bsdi4*) + bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; @@ -7338,52 +7408,52 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc=no case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag='-undefined dynamic_lookup' - ;; - esac - fi - ;; + rhapsody* | darwin1.[012]) + allow_undefined_flag='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='-all_load $convenience' + whole_archive_flag_spec='' link_all_deplibs=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - ld_shlibs=no + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs=no + ;; + esac fi ;; @@ -7417,7 +7487,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes @@ -7528,6 +7598,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else @@ -7605,7 +7676,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs=yes ;; @@ -7879,7 +7950,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -7937,7 +8008,7 @@ cygwin* | mingw* | pw32*) ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; @@ -7995,7 +8066,9 @@ kfreebsd*-gnu) dynamic_linker='GNU ld.so' ;; -freebsd*) +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in @@ -8014,7 +8087,7 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.01* | freebsdelf3.01*) + freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -8138,16 +8211,10 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - libsuff= - if test "$lt_cv_cc_lib64_suffix" = "yes"; then - libsuff=64 - fi - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} $lt_ld_extra" - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} /usr/local/lib${libsuff} $lt_ld_extra" + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -8209,7 +8276,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=yes + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -8331,8 +8398,8 @@ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action= if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var " || \ - test "X$hardcode_automatic"="Xyes" ; then + test -n "$runpath_var" || \ + test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && @@ -8998,7 +9065,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext </dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= @@ -9436,6 +9466,12 @@ fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo @@ -9478,7 +9514,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9807,7 +9843,9 @@ echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} case $tagname in CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -10100,7 +10138,7 @@ case $host_os in link_all_deplibs_CXX=yes if test "$GXX" = yes; then - case $host_os in aix4.012|aix4.012.*) + case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` @@ -10121,6 +10159,9 @@ case $host_os in fi esac shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi else # not using gcc if test "$host_cpu" = ia64; then @@ -10282,6 +10323,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac ;; + cygwin* | mingw* | pw32*) # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. @@ -10305,57 +10347,68 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs_CXX=no fi ;; - - darwin* | rhapsody*) - if test "$GXX" = yes; then - archive_cmds_need_lc_CXX=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_CXX='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_CXX='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_CXX='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_CXX='-undefined dynamic_lookup' - ;; + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='' + link_all_deplibs_CXX=yes - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='-all_load $convenience' - link_all_deplibs_CXX=yes - else - ld_shlibs_CXX=no - fi - ;; + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_CXX=no + ;; + esac + fi + ;; dgux*) case $cc_basename in @@ -10374,14 +10427,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; esac ;; - freebsd12*) + freebsd[12]*) # C++ shared libraries reported to be fairly broken before switch to ELF ld_shlibs_CXX=no ;; freebsd-elf*) archive_cmds_need_lc_CXX=no ;; - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes @@ -10412,7 +10465,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' ;; *) if test "$GXX" = yes; then @@ -10561,13 +10614,36 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi icpc) # Intel C++ with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac archive_cmds_need_lc_CXX=no - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; + pgCC) + # Portland Group C++ compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + ;; cxx) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -10620,6 +10696,22 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + openbsd*) + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; osf3*) case $cc_basename in KCC) @@ -10790,7 +10882,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no case $host_os in - solaris2.0-5 | solaris2.0-5.*) ;; + solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system @@ -11075,6 +11167,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; esac ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + lt_prog_compiler_pic_CXX='-qnocommon' + lt_prog_compiler_wl_CXX='-Wl,' + ;; + esac + ;; dgux*) case $cc_basename in ec++) @@ -11088,7 +11190,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; esac ;; - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) @@ -11134,12 +11236,18 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; - icpc) + icpc* | ecpc*) # Intel C++ lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; + pgCC) + # Portland Group C++ compiler. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-static' + ;; cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha @@ -11275,11 +11383,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11278: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11386: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11282: \$? = $ac_status" >&5 + echo "$as_me:11390: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -11335,11 +11443,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11338: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11446: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11342: \$? = $ac_status" >&5 + echo "$as_me:11450: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11403,7 +11511,7 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' @@ -11583,7 +11691,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -11641,7 +11749,7 @@ cygwin* | mingw* | pw32*) ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; @@ -11699,7 +11807,9 @@ kfreebsd*-gnu) dynamic_linker='GNU ld.so' ;; -freebsd*) +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in @@ -11718,7 +11828,7 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.01* | freebsdelf3.01*) + freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -11842,16 +11952,10 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - libsuff= - if test "$lt_cv_cc_lib64_suffix" = "yes"; then - libsuff=64 - fi - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} $lt_ld_extra" - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} /usr/local/lib${libsuff} $lt_ld_extra" + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -11913,7 +12017,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=yes + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -12035,8 +12139,8 @@ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || \ - test -n "$runpath_var CXX" || \ - test "X$hardcode_automatic_CXX"="Xyes" ; then + test -n "$runpath_var_CXX" || \ + test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_CXX" != no && @@ -12702,7 +12806,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' fi ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + lt_prog_compiler_pic_F77='-qnocommon' + lt_prog_compiler_wl_F77='-Wl,' + ;; + esac + ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -13540,12 +13660,19 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) - case $CC in + case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; + pgcc | pgf77 | pgf90) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-fpic' + lt_prog_compiler_static_F77='-static' + ;; ccc*) lt_prog_compiler_wl_F77='-Wl,' # All Alpha code is PIC. @@ -13590,6 +13717,11 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 fi ;; + unicos*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_can_build_shared_F77=no + ;; + uts4*) lt_prog_compiler_pic_F77='-pic' lt_prog_compiler_static_F77='-Bstatic' @@ -13627,11 +13759,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13630: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13762: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13634: \$? = $ac_status" >&5 + echo "$as_me:13766: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13687,11 +13819,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13690: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13822: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13694: \$? = $ac_status" >&5 + echo "$as_me:13826: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13846,7 +13978,7 @@ EOF allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' @@ -13860,7 +13992,7 @@ EOF fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' else - ld_shlibs=no + ld_shlibs_F77=no fi ;; @@ -13904,11 +14036,21 @@ EOF linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds_F77="$tmp_archive_cmds" + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' supports_anon_versioning=no case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions @@ -13918,9 +14060,9 @@ EOF archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' else - archive_expsym_cmds_F77="$tmp_archive_cmds" + archive_expsym_cmds_F77=$archive_cmds_F77 fi else ld_shlibs_F77=no @@ -14010,7 +14152,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ link_all_deplibs_F77=yes if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) + case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` @@ -14031,6 +14173,9 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ fi esac shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi else # not using gcc if test "$host_cpu" = ia64; then @@ -14171,7 +14316,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs_F77=no ;; - bsdi4*) + bsdi[45]*) export_dynamic_flag_spec_F77=-rdynamic ;; @@ -14192,57 +14337,57 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' + fix_srcfile_path_F77='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc_F77=no case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_F77='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_F77='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_F77='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_F77='-undefined dynamic_lookup' - ;; - esac - fi - ;; + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_cmds_need_lc_F77=no hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported - whole_archive_flag_spec_F77='-all_load $convenience' + whole_archive_flag_spec_F77='' link_all_deplibs_F77=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - ld_shlibs_F77=no + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_F77=no + ;; + esac fi ;; @@ -14276,7 +14421,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes @@ -14387,6 +14532,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' export_dynamic_flag_spec_F77='${wl}-E' else @@ -14464,7 +14610,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_F77=yes ;; @@ -14738,7 +14884,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -14796,7 +14942,7 @@ cygwin* | mingw* | pw32*) ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; @@ -14854,7 +15000,9 @@ kfreebsd*-gnu) dynamic_linker='GNU ld.so' ;; -freebsd*) +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in @@ -14873,7 +15021,7 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.01* | freebsdelf3.01*) + freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -14997,16 +15145,10 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - libsuff= - if test "$lt_cv_cc_lib64_suffix" = "yes"; then - libsuff=64 - fi - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} $lt_ld_extra" - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} /usr/local/lib${libsuff} $lt_ld_extra" + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -15068,7 +15210,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=yes + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15190,8 +15332,8 @@ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_F77= if test -n "$hardcode_libdir_flag_spec_F77" || \ - test -n "$runpath_var F77" || \ - test "X$hardcode_automatic_F77"="Xyes" ; then + test -n "$runpath_var_F77" || \ + test "X$hardcode_automatic_F77" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_F77" != no && @@ -15267,7 +15409,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -15368,6 +15510,12 @@ fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo @@ -15410,7 +15558,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -15682,7 +15830,7 @@ objext_GCJ=$objext lt_simple_compile_test_code="class foo {}\n" # Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. @@ -15727,11 +15875,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15730: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15878: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15734: \$? = $ac_status" >&5 + echo "$as_me:15882: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15838,6 +15986,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' fi ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case "$cc_basename" in + xlc*) + lt_prog_compiler_pic_GCJ='-qnocommon' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + esac + ;; mingw* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -15873,12 +16031,19 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) - case $CC in + case $cc_basename in icc* | ecc*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; + pgcc | pgf77 | pgf90) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-fpic' + lt_prog_compiler_static_GCJ='-static' + ;; ccc*) lt_prog_compiler_wl_GCJ='-Wl,' # All Alpha code is PIC. @@ -15923,6 +16088,11 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 fi ;; + unicos*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_can_build_shared_GCJ=no + ;; + uts4*) lt_prog_compiler_pic_GCJ='-pic' lt_prog_compiler_static_GCJ='-Bstatic' @@ -15960,11 +16130,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15963: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16133: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15967: \$? = $ac_status" >&5 + echo "$as_me:16137: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -16020,11 +16190,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16023: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16193: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16027: \$? = $ac_status" >&5 + echo "$as_me:16197: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16179,7 +16349,7 @@ EOF allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' @@ -16193,7 +16363,7 @@ EOF fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' else - ld_shlibs=no + ld_shlibs_GCJ=no fi ;; @@ -16237,11 +16407,21 @@ EOF linux*) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds_GCJ="$tmp_archive_cmds" + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' supports_anon_versioning=no case `$LD -v 2>/dev/null` in - *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions @@ -16251,9 +16431,9 @@ EOF archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' else - archive_expsym_cmds_GCJ="$tmp_archive_cmds" + archive_expsym_cmds_GCJ=$archive_cmds_GCJ fi else ld_shlibs_GCJ=no @@ -16343,7 +16523,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ link_all_deplibs_GCJ=yes if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) + case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` @@ -16364,6 +16544,9 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ fi esac shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi else # not using gcc if test "$host_cpu" = ia64; then @@ -16524,7 +16707,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs_GCJ=no ;; - bsdi4*) + bsdi[45]*) export_dynamic_flag_spec_GCJ=-rdynamic ;; @@ -16545,57 +16728,57 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' + fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc_GCJ=no case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_GCJ='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_GCJ='-undefined dynamic_lookup' - ;; - esac - fi - ;; + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_cmds_need_lc_GCJ=no hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported - whole_archive_flag_spec_GCJ='-all_load $convenience' + whole_archive_flag_spec_GCJ='' link_all_deplibs_GCJ=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - ld_shlibs_GCJ=no + case "$cc_basename" in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_GCJ=no + ;; + esac fi ;; @@ -16629,7 +16812,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes @@ -16740,6 +16923,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' export_dynamic_flag_spec_GCJ='${wl}-E' else @@ -16817,7 +17001,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_GCJ=yes ;; @@ -17091,7 +17275,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -17149,7 +17333,7 @@ cygwin* | mingw* | pw32*) ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; @@ -17207,7 +17391,9 @@ kfreebsd*-gnu) dynamic_linker='GNU ld.so' ;; -freebsd*) +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in @@ -17226,7 +17412,7 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.01* | freebsdelf3.01*) + freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; @@ -17350,16 +17536,10 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - libsuff= - if test "$lt_cv_cc_lib64_suffix" = "yes"; then - libsuff=64 - fi - # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} $lt_ld_extra" - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/X11R6/lib${libsuff} /usr/local/lib${libsuff} $lt_ld_extra" + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -17421,7 +17601,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=yes + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -17543,8 +17723,8 @@ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 hardcode_action_GCJ= if test -n "$hardcode_libdir_flag_spec_GCJ" || \ - test -n "$runpath_var GCJ" || \ - test "X$hardcode_automatic_GCJ"="Xyes" ; then + test -n "$runpath_var_GCJ" || \ + test "X$hardcode_automatic_GCJ" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_GCJ" != no && @@ -18210,7 +18390,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <. EOF - exit 0 + exit $? ;; -v | --v*) echo "depcomp $scriptversion" - exit 0 + exit $? ;; esac @@ -287,36 +287,43 @@ tru64) base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then - # Dependencies are output in .lo.d with libtool 1.4. - # With libtool 1.5 they are output both in $dir.libs/$base.o.d - # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the - # latter, because the former will be cleaned when $dir.libs is - # erased. - tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir$base.o.d" - tmpdepfile3="$dir.libs/$base.d" + # With Tru64 cc, shared objects can also be used to make a + # static library. This mecanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else - tmpdepfile1="$dir$base.o.d" - tmpdepfile2="$dir$base.d" - tmpdepfile3="$dir$base.d" + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - elif test -f "$tmpdepfile2"; then - tmpdepfile="$tmpdepfile2" - else - tmpdepfile="$tmpdepfile3" - fi + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. diff --git a/doc/Makefile.in b/doc/Makefile.in index 3a3a27d1..ef73e5d3 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 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. diff --git a/include/Makefile.in b/include/Makefile.in index be3a902c..33e9cdfd 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 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. @@ -218,7 +218,13 @@ uninstall-info-am: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -230,7 +236,7 @@ $(RECURSIVE_TARGETS): local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ @@ -238,7 +244,13 @@ $(RECURSIVE_TARGETS): mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ @@ -259,7 +271,7 @@ maintainer-clean-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 5d26253c..f6c979a3 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 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. diff --git a/install-sh b/install-sh index 0b65ee87..1a835340 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-10-22.00 +scriptversion=2005-02-02.21 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -109,7 +109,7 @@ while test -n "$1"; do shift continue;; - --help) echo "$usage"; exit 0;; + --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift @@ -134,7 +134,7 @@ while test -n "$1"; do shift continue;; - --version) echo "$0 $scriptversion"; exit 0;; + --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. @@ -296,7 +296,7 @@ do || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit + (exit 1); exit 1 } else : @@ -307,12 +307,12 @@ do $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } - fi || { (exit 1); exit; } + fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { - (exit 0); exit + (exit 0); exit 0 } # Local variables: diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index ad75eb67..2aa92a06 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 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. diff --git a/ltmain.sh b/ltmain.sh index 6828dc0e..3d071010 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -33,9 +33,6 @@ basename="s,^.*/,,g" # function. progpath="$0" -# define SED for historic ltconfig's generated by Libtool 1.3 -test -z "$SED" && SED=sed - # The name of this program: progname=`echo "$progpath" | $SED $basename` modename="$progname" @@ -46,9 +43,14 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.6 -TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)" +VERSION=1.5.14 +TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi # Check that we have a working $echo. if test "X$1" = X--no-reexec; then @@ -130,6 +132,7 @@ show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" +quote_scanset='[[~#^*{};<>?'"'"' ]' ##################################### # Shell function definitions: @@ -141,7 +144,8 @@ o2lo="s/\\.${objext}\$/.lo/" # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. -func_win32_libid () { +func_win32_libid () +{ win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in @@ -181,12 +185,13 @@ func_win32_libid () { # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' -func_infer_tag () { +func_infer_tag () +{ if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -207,7 +212,7 @@ func_infer_tag () { for arg in $CC; do # Double-quote args containing other shell metacharacters. case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -238,22 +243,137 @@ func_infer_tag () { esac fi } + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ + | $EGREP -v '^[ ]*1[ ]' | while read count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? + i=`expr $i + 1` + done + done + $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$my_xdir"; then + exit $status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} # End of Shell function definitions ##################################### # Darwin sucks -#eval std_shrext=\"$shrext_cmds\" - -# And fixing for Darwin sucks for everybody else -if test -z "$shrext_cmds" && test -n "$shrext"; then - eval shrext_cmds=\"$shrext\" -fi eval std_shrext=\"$shrext_cmds\" -# This value is evaluated to 32768, so place it here as a compatilibity hack -# because older libtool.m4 didn't define this variable -test -z "$max_cmd_len" && max_cmd_len=32768 - # Parse our command line options once, thoroughly. while test "$#" -gt 0 do @@ -318,10 +438,10 @@ do --version) $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" $echo - $echo "Copyright (C) 2003 Free Software Foundation, Inc." + $echo "Copyright (C) 2005 Free Software Foundation, Inc." $echo "This is free software; see the source for copying conditions. There is NO" $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit $EXIT_SUCCESS + exit $? ;; --config) @@ -330,7 +450,7 @@ do for tagname in $taglist; do ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" done - exit $EXIT_SUCCESS + exit $? ;; --debug) @@ -355,7 +475,7 @@ do else $echo "disable static libraries" fi - exit $EXIT_SUCCESS + exit $? ;; --finish) mode="finish" ;; @@ -412,7 +532,7 @@ if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link @@ -529,7 +649,7 @@ if test -z "$show_help"; then # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -560,8 +680,11 @@ if test -z "$show_help"; then case $lastarg in # Double-quote args containing other shell metacharacters. # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") lastarg="\"$lastarg\"" ;; esac @@ -996,7 +1119,7 @@ EOF arg="$1" shift case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; @@ -1240,6 +1363,11 @@ EOF prev= continue ;; + darwin_framework) + compiler_flags="$compiler_flags $arg" + prev= + continue + ;; *) eval "$prev=\"\$arg\"" prev= @@ -1298,6 +1426,12 @@ EOF continue ;; + -framework) + prev=darwin_framework + compiler_flags="$compiler_flags $arg" + continue + ;; + -inst-prefix-dir) prev=inst_prefix continue @@ -1358,7 +1492,7 @@ EOF # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; - *-*-openbsd* | *-*-freebsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; @@ -1369,7 +1503,7 @@ EOF esac elif test "X$arg" = "X-lc_r"; then case $host in - *-*-openbsd* | *-*-freebsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; @@ -1379,8 +1513,20 @@ EOF continue ;; + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - deplibs="$deplibs $arg" + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" continue ;; @@ -1389,18 +1535,19 @@ EOF continue ;; - # gcc -m* arguments should be passed to the linker via $compiler_flags - # in order to pass architecture information to the linker - # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo - # but this is not reliable with gcc because gcc may use -mfoo to - # select a different linker, different libraries, etc, while - # -Wl,-mfoo simply passes -mfoo to the linker. - -m*) + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*) + # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -1516,7 +1663,7 @@ EOF for flag in $args; do IFS="$save_ifs" case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") flag="\"$flag\"" ;; esac @@ -1534,7 +1681,7 @@ EOF for flag in $args; do IFS="$save_ifs" case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") flag="\"$flag\"" ;; esac @@ -1567,7 +1714,7 @@ EOF # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -1701,7 +1848,7 @@ EOF # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -1868,7 +2015,7 @@ EOF compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else - deplibs="$deplib $deplibs" + compiler_flags="$compiler_flags $deplib" fi continue ;; @@ -1877,10 +2024,6 @@ EOF $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do for search_ext in .la $std_shrext .so .a; do @@ -1991,7 +2134,22 @@ EOF fi case $linkmode in lib) - if test "$deplibs_check_method" != pass_all; then + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then $echo $echo "*** Warning: Trying to link with static lib archive $deplib." $echo "*** I have the capability to make that library automatically link in when" @@ -2065,6 +2223,8 @@ EOF # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no + avoidtemprpath= + # Read the .la file case $lib in @@ -2163,11 +2323,19 @@ EOF dir="$libdir" absdir="$libdir" fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` @@ -2240,7 +2408,7 @@ EOF if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then # We need to hardcode the library path - if test -n "$shlibpath_var"; then + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in *" $dir "*) ;; @@ -2954,7 +3122,7 @@ EOF # Check that each of the things are valid numbers. case $current in - [0-9]*) ;; + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2963,7 +3131,7 @@ EOF esac case $revision in - [0-9]*) ;; + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -2972,7 +3140,7 @@ EOF esac case $age in - [0-9]*) ;; + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 @@ -3000,7 +3168,7 @@ EOF versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) @@ -3206,7 +3374,7 @@ EOF *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; - *-*-openbsd* | *-*-freebsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; @@ -3672,23 +3840,15 @@ EOF fi tmp_deplibs= - inst_prefix_arg= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) - if test -n "$inst_prefix_dir" && (echo "$test_deplib" | grep -- "$inst_prefix_dir" >/dev/null); then - inst_prefix_arg="$test_deplib" - else - tmp_deplibs="$tmp_deplibs $test_deplib" - fi + tmp_deplibs="$tmp_deplibs $test_deplib" ;; esac done deplibs="$tmp_deplibs" - if test -n "$inst_prefix_arg"; then - deplibs="$inst_prefix_arg $deplibs" - fi if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then @@ -3696,67 +3856,13 @@ EOF eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" fi fi - + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" @@ -3805,6 +3911,7 @@ EOF save_libobjs=$libobjs fi save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` # Clear the reloadable object creation command queue and # initialize k to one. @@ -3814,7 +3921,7 @@ EOF delfiles= last_robj= k=1 - output=$output_objdir/$save_output-${k}.$objext + output=$output_objdir/$output_la-${k}.$objext # Loop over the list of objects to be linked. for obj in $save_libobjs do @@ -3834,9 +3941,9 @@ EOF # the last one created. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi - last_robj=$output_objdir/$save_output-${k}.$objext + last_robj=$output_objdir/$output_la-${k}.$objext k=`expr $k + 1` - output=$output_objdir/$save_output-${k}.$objext + output=$output_objdir/$output_la-${k}.$objext objlist=$obj len=1 fi @@ -3856,13 +3963,13 @@ EOF eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" fi - # Set up a command to remove the reloadale object files + # Set up a command to remove the reloadable object files # after they are used. i=0 while test "$i" -lt "$k" do i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" done $echo "creating a temporary reloadable object file: $output" @@ -3994,64 +4101,10 @@ EOF eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi @@ -4313,12 +4366,12 @@ extern \"C\" { # Prepare the list of exported symbols if test -z "$export_symbols"; then - export_symbols="$output_objdir/$output.exp" + export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else - $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' - $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi @@ -4370,7 +4423,26 @@ extern \"C\" { #endif /* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } @@ -4599,7 +4671,7 @@ static const void *lt_preloaded_setup() { esac case $host in *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${output}.c` + cwrappersource=`$echo ${objdir}/lt-${outputname}.c` cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 @@ -4832,7 +4904,7 @@ sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" @@ -5009,65 +5081,10 @@ fi\ if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "$mkdir $xdir" - $run $mkdir "$xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$xdir"; then - exit $status - fi - # We will extract separately just the conflicting names and we will no - # longer touch any unique names. It is faster to leave these extract - # automatically by $AR in one run. - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $AR t "$xabs" | sort | uniq -cd | while read -r count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? - i=`expr $i + 1` - done - done - fi - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. @@ -5312,7 +5329,7 @@ relink_command=\"$relink_command\"" # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -5328,7 +5345,7 @@ relink_command=\"$relink_command\"" # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -5376,7 +5393,7 @@ relink_command=\"$relink_command\"" # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -6009,14 +6026,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" + exec_cmd="\"\$cmd\"$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - $echo "$cmd$args" + eval \$echo \"\$cmd\"$args exit $EXIT_SUCCESS fi ;; @@ -6415,7 +6432,7 @@ esac $echo $echo "Try \`$modename --help' for more information about other modes." -exit $EXIT_SUCCESS +exit $? # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting diff --git a/missing b/missing index 64b5f901..09edd884 100755 --- a/missing +++ b/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2004-09-07.08 +scriptversion=2005-02-08.22 -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. @@ -87,12 +87,12 @@ Supported PROGRAM values: yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." - exit 0 + exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" - exit 0 + exit $? ;; -*) @@ -288,10 +288,14 @@ WARNING: \`$1' is $msg. You should only need it if call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi touch $file ;; diff --git a/mkinstalldirs b/mkinstalldirs index 6fbe5e11..5d26a485 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -1,7 +1,7 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -scriptversion=2004-02-15.20 +scriptversion=2005-02-02.21 # Original author: Noah Friedman # Created: 1993-05-16 @@ -27,7 +27,7 @@ while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" - exit 0 + exit $? ;; -m) # -m PERM arg shift @@ -37,7 +37,7 @@ while test $# -gt 0 ; do ;; --version) echo "$0 $scriptversion" - exit 0 + exit $? ;; --) # stop option processing shift diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index bd7eb26b..19de7246 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 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. From b64eacea30552da50b6d92ac4beb06e537090e10 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 19 Apr 2005 12:00:26 +0000 Subject: [PATCH 2231/2994] Update with SUSE 9.3 build tools. BKrev: 4264f2dajuzJzdLKdVen9MeMZL901w From 12d49f4972e5006f6fa2c4dcc7216b39b97a9144 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 19 Apr 2005 12:01:38 +0000 Subject: [PATCH 2232/2994] fix segfault during filesystem check if NTFS was corrupted in a way that clusters were referenced outside of the volume. (Szaka) (Logical change 1.697) --- ntfsprogs/ntfsresize.c | 48 ++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 0dedb155..7e293cfd 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1,7 +1,7 @@ /** * ntfsresize - Part of the Linux-NTFS project. * - * Copyright (c) 2002-2004 Szabolcs Szakacsits + * Copyright (c) 2002-2005 Szabolcs Szakacsits * Copyright (c) 2002-2004 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon * @@ -121,6 +121,8 @@ typedef struct { ntfs_attr_search_ctx *ctx; /* inode attribute being processed */ s64 inuse; /* num of clusters in use */ int multi_ref; /* num of clusters referenced many times */ + int outsider; /* num of clusters outside the volume */ + int show_outsider; /* controls showing the above information */ int flags; struct bitmap lcn_bitmap; } ntfsck_t; @@ -323,7 +325,7 @@ static void proceed_question(void) static void version (void) { printf ("\nResize an NTFS Volume, without data loss.\n\n"); - printf ("Copyright (c) 2002-2004 Szabolcs Szakacsits\n"); + printf ("Copyright (c) 2002-2005 Szabolcs Szakacsits\n"); printf ("Copyright (c) 2002-2004 Anton Altaparmakov\n"); printf ("Copyright (c) 2002-2003 Richard Russon\n"); printf ("\n%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home); @@ -776,16 +778,29 @@ static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfsck_t *fsck) lcn_length); for (j = 0; j < lcn_length; j++) { - u64 k = (u64)lcn + j; - if (ntfs_bit_get_and_set(lcn_bitmap->bm, k, 1)) { - - if (++fsck->multi_ref > 10) - continue; - printf("Cluster %llu (0x%llx) referenced " - "multiply times!\n", - (unsigned long long)k, - (unsigned long long)k); + u64 k = (u64)lcn + j; + + if (k >= (u64)vol->nr_clusters) { + + long long outsiders = lcn_length - j; + + fsck->outsider += outsiders; + + if (++fsck->show_outsider <= 10 || opt.verbose) + printf("Outside of the volume reference" + " for inode %lld at %lld:%lld\n", + inode, (long long)k, outsiders); + + break; + } + + if (ntfs_bit_get_and_set(lcn_bitmap->bm, k, 1)) { + if (++fsck->multi_ref <= 10 || opt.verbose) + printf("Cluster %lld is referenced " + "multiply times!\n", + (long long)k); + continue; } } fsck->inuse += lcn_length; @@ -2210,9 +2225,14 @@ int main(int argc, char **argv) perr_exit("Failed to setup allocation bitmap"); if (build_allocation_bitmap(vol, &fsck) != 0) exit(1); - if (fsck.multi_ref) { - err_printf("Filesystem check failed! Totally %d clusters " - "referenced multiply times.\n", fsck.multi_ref); + if (fsck.outsider || fsck.multi_ref) { + err_printf("Filesystem check failed!\n"); + if (fsck.outsider) + err_printf("%d clusters are referenced outside " + "of the volume.\n", fsck.outsider); + if (fsck.multi_ref) + err_printf("%d clusters are referenced multiply" + " times.\n", fsck.multi_ref); printf(corrupt_volume_msg); exit(1); } From caabc1a6e33258267b1a03f07abdc0e058ccfe2c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 19 Apr 2005 12:01:38 +0000 Subject: [PATCH 2233/2994] ntfsresize: fix segfault during filesystem check if NTFS was corrupted in a way that clusters were referenced outside of the volume. (Szaka) BKrev: 4264f322kLK1elKzmWbvyC038CZfdQ From ac492c10bba70ce514331fd5da10a050daaa3527 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Tue, 19 Apr 2005 12:01:38 +0000 Subject: [PATCH 2234/2994] update (Logical change 1.697) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7d527908..409f58d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -128,6 +128,8 @@ xx/xx/2005 - 2.0.0-WIP should always be included if present). Save also records used for checking empty $Logfile. (Szaka) - ntfscp: add ability to specify directory as destination file. (Yura) + - ntfsresize: fix segfault during filesystem check if NTFS was corrupted + in a way that clusters were referenced outside of the volume. (Szaka) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 032d26b4d4e76071ef98a09258d86e087e520867 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 22 Apr 2005 13:52:16 +0000 Subject: [PATCH 2235/2994] Major rewrite of libntfs/win32_io.c and in particular seek, read, and write related code. Thanks to Timur Amirkhanov for pointing out to me that the file position handling was fscked (e.g. mkntfs would create corrupt volumes as a consequence). Code is completely untested as I do not have Cygwin to compile it on... BKrev: 42690190Z588-jUGrwf4jrHM0KQn4Q From 307659837c27745ad8006964b3eb87c1b81c8505 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 22 Apr 2005 13:52:16 +0000 Subject: [PATCH 2236/2994] Major rewrite, in particular seek, read, and write related code. (Logical change 1.698) --- libntfs/win32_io.c | 497 +++++++++++++++++++++++---------------------- 1 file changed, 253 insertions(+), 244 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 4def6079..db0b79ab 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -4,7 +4,7 @@ * Part of the Linux-NTFS project. * * Copyright (c) 2003-2004 Lode Leroy - * Copyright (c) 2003-2004 Anton Altaparmakov + * Copyright (c) 2003-2005 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -36,8 +36,8 @@ * Cannot use "../include/types.h" since it conflicts with "wintypes.h". * define our own... */ -typedef long long int s64; -typedef unsigned long int u32; +typedef long long s64; +typedef unsigned long u32; struct stat; struct ntfs_volume; typedef struct ntfs_volume ntfs_volume; @@ -72,7 +72,8 @@ typedef struct win32_fd { int part_hidden_sectors; s64 part_start; s64 part_length; - LARGE_INTEGER current_pos; + s64 real_pos; + int real_ofs; s64 geo_size, geo_cylinders; DWORD geo_sectors, geo_heads; HANDLE vol_handle; @@ -366,7 +367,7 @@ static s64 ntfs_device_win32_getntfssize(HANDLE handle) * In Windows XP+: fills the members: size, sectors, cylinders and heads. * * Note: in pre XP, this requires write permission, even though nothing is - * actuallt written. + * actually written. * * if fails, set sectors, cylinders and heads to -1. */ @@ -478,7 +479,8 @@ static __inline__ int ntfs_device_win32_open_file(char *filename, win32_fd *fd, fd->handle = handle; fd->part_start = 0; fd->part_length = ntfs_device_win32_getsize(handle); - fd->current_pos.QuadPart = 0; + fd->real_pos = 0; + fd->real_ofs = 0; fd->part_hidden_sectors = -1; fd->geo_size = -1; /* used as a marker that this is a file */ fd->vol_handle = INVALID_HANDLE_VALUE; @@ -520,7 +522,8 @@ static __inline__ int ntfs_device_win32_open_drive(int drive_id, win32_fd *fd, fd->handle = handle; fd->part_start = 0; fd->part_length = fd->geo_size; - fd->current_pos.QuadPart = 0; + fd->real_pos = 0; + fd->real_ofs = 0; fd->part_hidden_sectors = -1; fd->vol_handle = INVALID_HANDLE_VALUE; @@ -699,7 +702,8 @@ static int ntfs_device_win32_open_partition(int drive_id, ntfs_device_win32_getgeo(handle, fd); fd->handle = handle; - fd->current_pos.QuadPart = 0; + fd->real_pos = 0; + fd->real_ofs = 0; fd->part_start = part_start; fd->part_length = part_length; fd->part_hidden_sectors = hidden_sectors; @@ -814,40 +818,38 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) * Return Succeed: The new position in the file * Fail: -1 and errno set. */ -static s64 ntfs_device_win32_abs_seek(struct win32_fd *fd, LARGE_INTEGER pos) +static s64 ntfs_device_win32_abs_seek(struct win32_fd *fd, s64 pos) { - if ((pos.QuadPart < 0) || (pos.QuadPart > fd->part_length)) { + LARGE_INTEGER li; + HANDLE handle; + + if (pos < 0 || pos > fd->part_length) { Dputs("Error: Seeking outsize seekable area."); errno = EINVAL; return -1; } - - if (!(pos.QuadPart & 0x1FF)) { - LARGE_INTEGER pos2; - HANDLE handle; - - if ((fd->vol_handle != INVALID_HANDLE_VALUE) && - (pos.QuadPart < fd->geo_size)) { - Dputs("Seeking via vol_handle"); - handle = fd->vol_handle; - pos2.QuadPart = pos.QuadPart; - } else { - Dputs("Seeking via handle"); - handle = fd->handle; - pos2.QuadPart = pos.QuadPart + fd->part_start; - } - if (!SetFilePointerEx(handle, pos2, NULL, FILE_BEGIN)) { + li.QuadPart = pos; + if (fd->vol_handle != INVALID_HANDLE_VALUE && pos < fd->geo_size) { + Dputs("Seeking via vol_handle"); + handle = fd->vol_handle; + } else { + Dputs("Seeking via handle"); + handle = fd->handle; + li.QuadPart += fd->part_start; + } + /* If the address is not alligned, we round down to nearest sector. */ + li.QuadPart &= ~(s64)(NTFS_BLOCK_SIZE - 1); + /* Only seek if we are not there already. */ + if (li.QuadPart != fd->real_pos) { + if (!SetFilePointerEx(handle, li, NULL, FILE_BEGIN)) { errno = ntfs_w32error_to_errno(GetLastError()); Dputs("Error: SetFilePointer failed."); return -1; } + fd->real_pos = li.QuadPart; } - - /* Notice: If the address is not alligned, we leave it for the - read/write operation. */ - fd->current_pos.QuadPart = pos.QuadPart; - - return pos.QuadPart; + fd->real_ofs = pos & (NTFS_BLOCK_SIZE - 1); + return pos; } /** @@ -865,17 +867,16 @@ static s64 ntfs_device_win32_abs_seek(struct win32_fd *fd, LARGE_INTEGER pos) static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, int whence) { - LARGE_INTEGER abs_offset; + s64 abs_ofs; struct win32_fd *fd = (win32_fd *)dev->d_private; Dprintf("win32_seek(%lld=0x%llx,%d)\n", offset, offset, whence); - switch (whence) { case SEEK_SET: - abs_offset.QuadPart = offset; + abs_ofs = offset; break; case SEEK_CUR: - abs_offset.QuadPart = fd->current_pos.QuadPart + offset; + abs_ofs = fd->real_pos + fd->real_ofs + offset; break; case SEEK_END: /* end of partition != end of disk */ @@ -885,64 +886,56 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, errno = ENOTSUP; return -1; } - abs_offset.QuadPart = fd->part_length + offset; + abs_ofs = fd->part_length + offset; break; default: Dprintf("win32_seek() wrong mode %d.\n", whence); errno = EINVAL; return -1; } - - return ntfs_device_win32_abs_seek(fd, abs_offset); + return ntfs_device_win32_abs_seek(fd, abs_ofs); } /** * ntfs_device_win32_read_simple - Positioned simple read. * @fd: The private data of the NTFS_DEVICE. - * @pos: Absolute offset in the file. * @buf: A pointer to where to put the contents. * @count: How many bytes should be read. * - * On success returns the number of bytes read (could be real_pos NOT considering fd->real_ofs. + * - Does NOT advance fd->real_pos and fd->real_ofs. + * - @buf must be aligned to page boundary. + * - @count must be a multiple of the sector size. + * - When dealing with volumes, a single call must not span both volume + * and disk extents. */ -static DWORD ntfs_device_win32_read_simple(win32_fd *fd, void *buf, - DWORD count) +static DWORD ntfs_device_win32_read_simple(win32_fd *fd, void *buf, DWORD count) { HANDLE handle; - DWORD rvl, i; + DWORD br; - if ((fd->geo_size > fd->current_pos.QuadPart) && - (fd->vol_handle != INVALID_HANDLE_VALUE)) { - Dputs("Reading via vol_handle"); + if (fd->real_pos + fd->real_ofs < fd->geo_size && + fd->vol_handle != INVALID_HANDLE_VALUE) { + Dputs("Reading via vol_handle."); handle = fd->vol_handle; } else { - Dputs("Reading via handle"); + Dputs("Reading via handle."); handle = fd->handle; } - - rvl = ReadFile(handle, buf, count, &i, (LPOVERLAPPED)NULL); - if (!rvl) { + if (!ReadFile(handle, buf, count, &br, NULL)) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: ReadFile failed."); - return -1; - } else if (!i) { - errno = ENXIO; - Dputs("Error: ReadFile failed: EOF."); - return -1; + Dputs("Error: ReadFile() failed."); + return (DWORD)-1; } - - return i; + /* + * NOTE: The caller *MUST* update fd->real_pos and fd->real_ofs!!! + * Alternatively, caller can call ntfs_device_win32_{,abs_}seek(). + */ + return br; } /** @@ -956,77 +949,80 @@ static DWORD ntfs_device_win32_read_simple(win32_fd *fd, void *buf, */ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) { + s64 pos, to_read; struct win32_fd *fd = (win32_fd *)dev->d_private; - LARGE_INTEGER base, offset, numtoread; BYTE *alignedbuffer; - DWORD i, numread = 0; + int old_ofs; + DWORD i, br = 0; - offset.QuadPart = fd->current_pos.QuadPart & 0x1FF; - base.QuadPart = fd->current_pos.QuadPart - offset.QuadPart; - numtoread.QuadPart = ((count + offset.QuadPart - 1) | 0x1FF) + 1; - - Dprintf("win32_read(fd=%p,b=%p,count=0x%llx)->(%llx+%llx:%llx)\n", fd, - buf, count, base.QuadPart, offset.QuadPart, - numtoread.QuadPart); - - if (((((long)buf) & ((s64)0x1FF)) == 0) && ((count & ((s64)0x1FF)) == 0) - && ((fd->current_pos.QuadPart & 0x1FF) == 0)) { + old_ofs = fd->real_ofs; + pos = fd->real_pos + old_ofs; + to_read = (old_ofs + count + NTFS_BLOCK_SIZE - 1) & + ~(s64)(NTFS_BLOCK_SIZE - 1); + /* Impose maximum of 2GB to be on the safe side. */ + if (to_read > 0x80000000) { + int delta = to_read - count; + to_read = 0x80000000; + count = to_read - delta; + } + Dprintf("win32_read(fd=%p,b=%p,count=0x%llx)->(%llx+%x:%llx)\n", fd, + buf, count, (long long)fd->real_pos, old_ofs, + (long long)to_read); + if (!((unsigned long)buf & (NTFS_BLOCK_SIZE - 1)) && !old_ofs && + !(count & (NTFS_BLOCK_SIZE - 1))) alignedbuffer = buf; - } else { - alignedbuffer = (BYTE *)VirtualAlloc(NULL, numtoread.LowPart, - MEM_COMMIT, PAGE_READWRITE); - if (alignedbuffer == NULL) { + else { + alignedbuffer = (BYTE *)VirtualAlloc(NULL, to_read, MEM_COMMIT, + PAGE_READWRITE); + if (!alignedbuffer) { errno = ntfs_w32error_to_errno(GetLastError()); Dputs("Error: VirtualAlloc failed for read."); return -1; } } - - /* seek to base, if we are not in place */ - if ((fd->current_pos.QuadPart & 0x1FF) && - (ntfs_device_win32_abs_seek(fd, base) == -1)) - goto read_error; - - if ((fd->vol_handle != INVALID_HANDLE_VALUE) && - (fd->current_pos.QuadPart < fd->geo_size)) { - s64 vol_numtoread = fd->geo_size - fd->current_pos.QuadPart; - if (count > vol_numtoread) { - numread = ntfs_device_win32_read_simple(fd, - (LPVOID)alignedbuffer, vol_numtoread); - if (numread==(DWORD)-1) + if (fd->vol_handle != INVALID_HANDLE_VALUE && pos < fd->geo_size) { + s64 vol_to_read = fd->geo_size - pos; + if (count > vol_to_read) { + br = ntfs_device_win32_read_simple(fd, + alignedbuffer, old_ofs + vol_to_read); + if (br == (DWORD)-1) goto read_error; - if (numread!=vol_numtoread) + to_read -= br; + if (br < old_ofs) { + br = 0; goto read_partial; - - base.QuadPart = fd->geo_size; - numtoread.QuadPart -= numread; - if (ntfs_device_win32_abs_seek(fd, base) == -1) + } + br -= old_ofs; + pos += br; + fd->real_pos = pos & ~(s64)(NTFS_BLOCK_SIZE - 1); + fd->real_ofs = pos & (NTFS_BLOCK_SIZE - 1); + if (br != vol_to_read) goto read_partial; } } - - if ((i = ntfs_device_win32_read_simple(fd, (LPVOID)(alignedbuffer + - numread), numtoread.QuadPart)) == (DWORD)-1) { - if (numread>0) + if ((i = ntfs_device_win32_read_simple(fd, alignedbuffer + br, + to_read)) == (DWORD)-1) { + if (br) goto read_partial; goto read_error; } - numread += i; - + if (i < fd->real_ofs) + goto read_partial; + i -= fd->real_ofs; + br += i; + if (br > count) + br = count; + pos += br; + fd->real_pos = pos & ~(s64)(NTFS_BLOCK_SIZE - 1); + fd->real_ofs = pos & (NTFS_BLOCK_SIZE - 1); read_partial: - numread = (numread < offset.LowPart) ? 0 : ((numread - offset.LowPart > - count) ? count : (numread - offset.LowPart)); - fd->current_pos.QuadPart += numread; - - if (buf != alignedbuffer) { - memcpy((void *)buf, alignedbuffer + offset.QuadPart, numread); + if (alignedbuffer != buf) { + memcpy((void*)buf, alignedbuffer + old_ofs, br); VirtualFree(alignedbuffer, 0, MEM_RELEASE); } - - return numread; - + return br; read_error: - if (buf != alignedbuffer) + if (alignedbuffer != buf) VirtualFree(alignedbuffer, 0, MEM_RELEASE); return -1; } @@ -1045,12 +1041,10 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) BOOL rvl; Dprintf("win32_close(%p)\n", dev); - if (!NDevOpen(dev)) { errno = EBADF; return -errno; } - if (fd->vol_handle != INVALID_HANDLE_VALUE) { if (!NDevReadOnly(dev)) { ntfs_device_win32_dismount(fd->vol_handle); @@ -1059,17 +1053,13 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) if (!CloseHandle(fd->vol_handle)) Dputs("Error: CloseHandle failed for volume."); } - rvl = CloseHandle(fd->handle); - free(fd); - if (!rvl) { errno = ntfs_w32error_to_errno(GetLastError()); Dputs("Error: CloseHandle failed."); return -1; } - return 0; } @@ -1085,32 +1075,30 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) */ static int ntfs_device_win32_sync(struct ntfs_device *dev) { + int err = 0; + BOOL to_clear = TRUE; + if (!NDevReadOnly(dev) && NDevDirty(dev)) { struct win32_fd *fd = (win32_fd *)dev->d_private; if ((fd->vol_handle != INVALID_HANDLE_VALUE) && - FlushFileBuffers(fd->handle)) - NDevClearDirty(dev); - - if (FlushFileBuffers(fd->handle)) { - NDevClearDirty(dev); - return 0; - } else { - /* We want to set errno even if we return 0 to - let the user to know about failure even in - the disk/volume case. */ - errno = ntfs_w32error_to_errno(GetLastError()); - /* Don't fail in case of volume/disk */ - if (fd->geo_size != -1) - return 0; - /* fail on the other cases */ - Dputs("Error: Couldn't sync."); + !FlushFileBuffers(fd->vol_handle)) { + to_clear = FALSE; + err = ntfs_w32error_to_errno(GetLastError()); + } + if (!FlushFileBuffers(fd->handle)) { + to_clear = FALSE; + if (!err) + err = ntfs_w32error_to_errno(GetLastError()); + } + if (!to_clear) { + errno = err; + Dputs("Error: Could not sync."); return -1; } - } else { - /* no need/ability for a sync(), just exit gracefully */ - return 0; + NDevClearDirty(dev); } + return 0; } /** @@ -1120,31 +1108,41 @@ static int ntfs_device_win32_sync(struct ntfs_device *dev) * @count: How many bytes should be written. * * On success returns the amount of bytes actually written. - * On fail returns -1 and errno set. + * On success returns the number of bytes written and on error returns + * (DWORD)-1 and errno set. * - * Limitations: - * buf must be aligned to page boundery - * pos & count must be aligned to sector bounderies. - * When dealing with volumes, a single call must not span both volume and disk - * extents. + * Notes: + * - Writes to fd->real_pos NOT considering fd->real_ofs. + * - Does NOT advance fd->real_pos and fd->real_ofs. + * - @buf must be aligned to page boundary. + * - @count must be a multiple of the sector size. + * - When dealing with volumes, a single call must not span both volume + * and disk extents. */ -static DWORD ntfs_device_win32_write_simple(win32_fd *fd, - const void *buf, DWORD count) +static DWORD ntfs_device_win32_write_simple(win32_fd *fd, const void *buf, + DWORD count) { - DWORD rvl, i; + HANDLE handle; + DWORD bw; - if ((fd->geo_size > fd->current_pos.QuadPart) && - (fd->vol_handle != INVALID_HANDLE_VALUE)) - rvl = WriteFile(fd->vol_handle, buf, count, &i, NULL); - else - rvl = WriteFile(fd->handle, buf, count, &i, NULL); - - if (!rvl) { + if (fd->real_pos + fd->real_ofs < fd->geo_size && + fd->vol_handle != INVALID_HANDLE_VALUE) { + Dputs("Writing via vol_handle"); + handle = fd->vol_handle; + } else { + Dputs("Writing via handle"); + handle = fd->handle; + } + if (!WriteFile(handle, buf, count, &bw, NULL)) { errno = ntfs_w32error_to_errno(GetLastError()); Dputs("Error: WriteFile failed."); return (DWORD)-1; } - return i; + /* + * NOTE: The caller *MUST* update fd->real_pos and fd->real_ofs!!! + * Alternatively, caller can call ntfs_device_win32_{,abs_}seek(). + */ + return bw; } /** @@ -1159,111 +1157,122 @@ static DWORD ntfs_device_win32_write_simple(win32_fd *fd, static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buf, s64 count) { + s64 pos, to_write; win32_fd *fd = (win32_fd *)dev->d_private; - LARGE_INTEGER base, offset, actual_count; - BYTE *alignedbuffer = NULL; - DWORD i; + BYTE *alignedbuffer; + int old_ofs; + DWORD i, bw = 0; - Dprintf("win32_write: Writing %lld bytes\n",count); - + Dprintf("win32_write: Writing %lld bytes\n", (long long)count); if (NDevReadOnly(dev)) { Dputs("win32_write: Device R/O, exiting."); errno = EROFS; return -1; } - if (!count) return 0; - NDevSetDirty(dev); - - offset.QuadPart = fd->current_pos.QuadPart & 0x1FF; - base.QuadPart = fd->current_pos.QuadPart - offset.QuadPart; - actual_count.QuadPart = ((count + offset.QuadPart - 1) | 0x1FF) + 1; - - if ((actual_count.QuadPart != count) || (((long)buf) & 0x1FF) || - (fd->current_pos.QuadPart & 0x1FF)) { - alignedbuffer = (BYTE *)VirtualAlloc(NULL, - actual_count.QuadPart, MEM_COMMIT, PAGE_READWRITE); - if (alignedbuffer == NULL) { + old_ofs = fd->real_ofs; + pos = fd->real_pos + old_ofs; + to_write = (old_ofs + count + NTFS_BLOCK_SIZE - 1) & + ~(s64)(NTFS_BLOCK_SIZE - 1); + /* Impose maximum of 2GB to be on the safe side. */ + if (to_write > 0x80000000) { + int delta = to_write - count; + to_write = 0x80000000; + count = to_write - delta; + } + if (!((unsigned long)buf & (NTFS_BLOCK_SIZE - 1)) && !old_ofs && + !(count & (NTFS_BLOCK_SIZE - 1))) + alignedbuffer = buf; + else { + alignedbuffer = (BYTE *)VirtualAlloc(NULL, to_write, + MEM_COMMIT, PAGE_READWRITE); + if (!alignedbuffer) { errno = ntfs_w32error_to_errno(GetLastError()); Dputs("Error: VirtualAlloc failed for write."); return -1; } - - /* read last sector */ - if ((offset.QuadPart + count) & 0x1FF) { - LARGE_INTEGER pos; - pos.QuadPart = base.QuadPart + actual_count.QuadPart - - 512; - if (ntfs_device_win32_abs_seek(fd, pos) == -1) - goto write_error; - if (!ntfs_device_win32_read_simple(fd, - (LPVOID)(alignedbuffer + - actual_count.QuadPart - 512), 512)) - goto write_error; - } - - /* read first sector */ - if (offset.LowPart) { - if (ntfs_device_win32_abs_seek(fd, base) == -1) - goto write_error; - if (!ntfs_device_win32_read_simple(fd, - (LPVOID)(alignedbuffer), 512)) { + /* Read first sector if start of write not sector aligned. */ + if (old_ofs) { + i = ntfs_device_win32_read_simple(fd, alignedbuffer, + NTFS_BLOCK_SIZE); + if (i != NTFS_BLOCK_SIZE) { + if (i >= 0) + errno = EIO; goto write_error; } } - - /* copy the rest of the contents */ - memcpy((void *)(alignedbuffer + offset.LowPart), buf, - (size_t)count); - - /* ReAligning */ - if (ntfs_device_win32_abs_seek(fd, base) == -1) + /* Read last sector if end of write not sector aligned. */ + if ((pos + count) & (NTFS_BLOCK_SIZE - 1)) { + if (ntfs_device_win32_abs_seek(fd, (pos + count) & + ~(NTFS_BLOCK_SIZE - 1)) == -1) + goto write_error; + i = ntfs_device_win32_read_simple(fd, alignedbuffer + + to_write - NTFS_BLOCK_SIZE, + NTFS_BLOCK_SIZE); + if (i != NTFS_BLOCK_SIZE) { + if (ntfs_device_win32_abs_seek(fd, pos) == -1) { + fd->real_pos = pos & ~(s64) + (NTFS_BLOCK_SIZE - 1); + fd->real_ofs = old_ofs; + } + if (i >= 0) + errno = EIO; + goto write_error; + } + } + /* Move the file position back so we can start writing. */ + if (ntfs_device_win32_abs_seek(fd, pos) == -1) { + fd->real_pos = pos & ~(s64)(NTFS_BLOCK_SIZE - 1); + fd->real_ofs = old_ofs; goto write_error; - - /* hack to share code */ - buf = (const void *)alignedbuffer; + } + /* Copy the data to be written into @alignedbuffer. */ + memcpy(alignedbuffer + old_ofs, buf, count); } - - if ((fd->geo_size > base.QuadPart) && - (fd->vol_handle != INVALID_HANDLE_VALUE)) { - s64 tmp = min((fd->geo_size - base.QuadPart), - actual_count.QuadPart); - i = ntfs_device_win32_write_simple(fd, buf, tmp); - if (i == (DWORD)-1) - goto write_error; - if (i != tmp) - goto partial_write; - base.QuadPart -= i; - } else - i = 0; - - if (fd->geo_size <= base.QuadPart) { - const void *newp = (const void *)(((const BYTE *)buf) + i); - i += ntfs_device_win32_write_simple(fd, newp, - actual_count.LowPart - i); - if (!i || (i == (DWORD)-1)) - goto write_error; + if (fd->vol_handle != INVALID_HANDLE_VALUE && pos < fd->geo_size) { + s64 vol_to_write = fd->geo_size - pos; + if (count > vol_to_read) { + bw = ntfs_device_win32_write_simple(fd, alignedbuffer, + old_ofs + vol_to_write); + if (bw == (DWORD)-1) + goto write_error; + to_write -= bw; + if (bw < old_ofs) { + bw = 0; + goto write_partial; + } + bw -= old_ofs; + pos += bw; + fd->real_pos = pos & ~(s64)(NTFS_BLOCK_SIZE - 1); + fd->real_ofs = pos & (NTFS_BLOCK_SIZE - 1); + if (bw != vol_to_write) + goto write_partial; + } } -partial_write: - if (alignedbuffer) + if ((i = ntfs_device_win32_write_simple(fd, alignedbuffer + bw, + to_write)) == (DWORD)-1) { + if (bw) + goto write_partial; + goto write_error; + } + if (i < fd->real_ofs) + goto write_partial; + i -= fd->real_ofs; + bw += i; + if (bw > count) + bw = count; + pos += bw; + fd->real_pos = pos & ~(s64)(NTFS_BLOCK_SIZE - 1); + fd->real_ofs = pos & (NTFS_BLOCK_SIZE - 1); +write_partial: + if (alignedbuffer != buf) VirtualFree(alignedbuffer, 0, MEM_RELEASE); - - actual_count.QuadPart = (s64)i - actual_count.QuadPart + count; - if (actual_count.QuadPart < 0) - return 0; - return actual_count.QuadPart; - + return bw; write_error: - if (alignedbuffer) - VirtualFree(alignedbuffer, 0, MEM_RELEASE); - - fd->current_pos.QuadPart = base.QuadPart + offset.QuadPart; - if (!(fd->current_pos.QuadPart & 512)) - ntfs_device_win32_abs_seek(fd, base); - - return -1; + bw = -1; + goto write_partial; } /** From b13242445a4c615d0e0b4f2bcb8393cd33b6104f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 22 Apr 2005 13:52:16 +0000 Subject: [PATCH 2237/2994] Update (Logical change 1.698) --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 409f58d2..603a8a2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -130,6 +130,8 @@ xx/xx/2005 - 2.0.0-WIP - ntfscp: add ability to specify directory as destination file. (Yura) - ntfsresize: fix segfault during filesystem check if NTFS was corrupted in a way that clusters were referenced outside of the volume. (Szaka) + - Major rewrite of libntfs/win32_io.c and in particular seek, read, and + write related code. 04/09/2004 - 1.9.4 - Urgent bug fixes. From 50bde6486048507b5a9c640b50e22b2c42fb7d1f Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 25 Apr 2005 07:26:08 +0000 Subject: [PATCH 2238/2994] For a long while asked feature. The attached patch should be against the latest ntfsprogs snapshot. Includes, - ntfsclone: --rescue works at the lowest, sector and not cluster level thus more data can be rescued. The contents of the unreadable sectors are filled by character '?' and the beginning of such sectors are marked as "BadSectoR\0". Thanks to Krishna Mohan Gundu for his help. - ntfsclone: fixed an off-by-one error during --metadata in function wipe_data(). Szaka (Logical change 1.699) --- ntfsprogs/ntfsclone.c | 81 ++++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 28 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index d270f96f..1ad8963e 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1,7 +1,7 @@ /** * ntfsclone - Part of the Linux-NTFS project. * - * Copyright (c) 2003-2004 Szabolcs Szakacsits + * Copyright (c) 2003-2005 Szabolcs Szakacsits * Copyright (c) 2004 Anton Altaparmakov * Special image format support copyright (c) 2004 Per Olofsson * @@ -134,6 +134,7 @@ struct { #define LAST_METADATA_INODE 11 #define NTFS_MAX_CLUSTER_SIZE 65536 +#define NTFS_SECTOR_SIZE 512 #define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) @@ -444,7 +445,7 @@ static s64 is_critical_metadata(ntfs_walk_clusters_ctx *image, runlist *rl) static int io_all(void *fd, void *buf, int count, int do_write) { int i; - struct ntfs_device *dev = (struct ntfs_device *)fd; + struct ntfs_device *dev = fd; while (count > 0) { if (do_write) @@ -465,23 +466,49 @@ static int io_all(void *fd, void *buf, int count, int do_write) } -static void copy_cluster(void) +static void rescue_sector(void *fd, off_t pos, void *buff) +{ + const char *badsector_magic = "BadSectoR\0"; + struct ntfs_device *dev = fd; + + if (opt.restore_image) { + if (lseek(*(int *)fd, pos, SEEK_SET) == (off_t)-1) + perr_exit("lseek"); + } else { + if (vol->dev->d_ops->seek(dev, pos, SEEK_SET) == (off_t)-1) + perr_exit("seek input"); + } + + if (read_all(fd, buff, NTFS_SECTOR_SIZE) == -1) { + Printf("WARNING: Can't read sector at %llu, lost data.\n", + (unsigned long long)pos); + memset(buff, '?', NTFS_SECTOR_SIZE); + memmove(buff, badsector_magic, sizeof(badsector_magic)); + } +} + + +static void copy_cluster(int rescue, off_t rescue_pos) { char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ - u32 csize = opt.restore_image ? image_hdr.cluster_size - : vol->cluster_size; + /* vol is NULL if opt.restore_image is set */ + u32 csize = image_hdr.cluster_size; + void *fd = (void *)&fd_in; + + if (!opt.restore_image) { + csize = vol->cluster_size; + fd = vol->dev; + } - if (read_all(opt.restore_image ? (void *)&fd_in : vol->dev, buff, - csize) == -1) { + if (read_all(fd, buff, csize) == -1) { - const char *badcluster_magic = "BadClusteR"; + u32 i; - if (!opt.rescue || errno != EIO) + if (!rescue || errno != EIO) perr_exit("read_all"); - Printf("WARNING: Couldn't read a cluster, data is lost.\n"); - memset(buff, 2, csize); - memmove(buff, badcluster_magic, sizeof(badcluster_magic)); + for (i = 0; i < csize; i += NTFS_SECTOR_SIZE) + rescue_sector(fd, rescue_pos + i, buff + i); } if (opt.save_image) { @@ -545,7 +572,7 @@ static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) /* FIXME: this could give pretty suboptimal performance */ for (i = 0; i < len; i++) - copy_cluster(); + copy_cluster(opt.rescue, rl->lcn + i); } static void clone_ntfs(u64 nr_clusters) @@ -578,7 +605,7 @@ static void clone_ntfs(u64 nr_clusters) lseek_to_cluster(cl); image_skip_clusters(cl - last_cl - 1); - copy_cluster(); + copy_cluster(opt.rescue, cl); last_cl = cl; continue; } @@ -633,11 +660,11 @@ static void restore_image(void) else { if (lseek(fd_out, count * csize, SEEK_CUR) == (off_t)-1) - perr_exit("lseek output"); + perr_exit("restore_image: lseek"); } pos += count; } else if (cmd == 1) { - copy_cluster(); + copy_cluster(0, 0); pos++; progress_update(&progress, ++p_counter); } else @@ -711,7 +738,7 @@ static void clone_logfile_parts(ntfs_walk_clusters_ctx *image, runlist *rl) break; lseek_to_cluster(lcn); - copy_cluster(); + copy_cluster(opt.rescue, lcn); if (offset == 0) offset = NTFS_BLOCK_SIZE >> 1; @@ -834,17 +861,16 @@ static void compare_bitmaps(struct bitmap *a) if (opt.ignore_fs_check) { lseek_to_cluster(cl); - copy_cluster(); + copy_cluster(opt.rescue, cl); } if (++mismatch > 10) continue; Printf("Cluster accounting failed at %lld " - "(0x%llx): %s cluster in " - "$Bitmap\n", (long long)cl, - (unsigned long long)cl, - bit ? "missing" : "extra"); + "(0x%llx): %s cluster in $Bitmap\n", + (long long)cl, (unsigned long long)cl, + bit ? "missing" : "extra"); } } } @@ -867,8 +893,7 @@ static int wipe_data(char *p, int pos, int len) { int wiped = 0; - p += pos; - for (; len > 0; len--) { + for (p += pos; --len >= 0;) { if (p[len]) { p[len] = 0; wiped++; @@ -1138,8 +1163,8 @@ static s64 device_size_get(int fd) if (ioctl(fd, BLKGETSIZE64, &size) >= 0) { Dprintf("BLKGETSIZE64 nr bytes = %llu (0x%llx)\n", - (unsigned long long)size, - (unsigned long long)size); + (unsigned long long)size, + (unsigned long long)size); return (s64)size; } } @@ -1149,7 +1174,7 @@ static s64 device_size_get(int fd) if (ioctl(fd, BLKGETSIZE, &size) >= 0) { Dprintf("BLKGETSIZE nr 512 byte blocks = %lu " - "(0x%lx)\n", size, size); + "(0x%lx)\n", size, size); return (s64)size * 512; } } @@ -1159,7 +1184,7 @@ static s64 device_size_get(int fd) if (ioctl(fd, FDGETPRM, &this_floppy) >= 0) { Dprintf("FDGETPRM nr 512 byte blocks = %lu (0x%lx)\n", - this_floppy.size, this_floppy.size); + this_floppy.size, this_floppy.size); return (s64)this_floppy.size * 512; } } From 4ec0dcd6274575a98286d27fb82ba844dee21db8 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 25 Apr 2005 07:26:08 +0000 Subject: [PATCH 2239/2994] For a long while asked feature. The attached patch should be against the latest ntfsprogs snapshot. Includes, - ntfsclone: --rescue works at the lowest, sector and not cluster level thus more data can be rescued. The contents of the unreadable sectors are filled by character '?' and the beginning of such sectors are marked as "BadSectoR\0". Thanks to Krishna Mohan Gundu for his help. - ntfsclone: fixed an off-by-one error during --metadata in function wipe_data(). Szaka BKrev: 426c9b90FNkcF-oy_jpYpC-q83TwMg From c4761f35bff024c4f4b451112cb5db0220738148 Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Mon, 25 Apr 2005 07:26:08 +0000 Subject: [PATCH 2240/2994] Update (Logical change 1.699) --- ChangeLog | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 603a8a2d..1367a725 100644 --- a/ChangeLog +++ b/ChangeLog @@ -113,10 +113,9 @@ xx/xx/2005 - 2.0.0-WIP - ntfsclone: added a new option, --ignore-fs-check. It can be used only with the --metadata option. The clusters causing the inconsistency are saved too. (Szaka) - - ntfsclone: added a new option, --rescue. It ignores read errors - so disks having bad sectors (dying disks) can be rescued. The content - of the cluster having bad sectors is filled by character '2' and the - start of the cluster is marked by "BadClusteR". (Szaka) + - ntfsclone: added a new option, --rescue. It ignores read errors so + disks having bad sectors (dying disks) can be rescued efficiently, + with minimal stress on them. (Szaka) - ntfsfix: fix invalid mft records in $MFTMirr. (Szaka) - Added a trigger script to the BK repository that will send an email to linux-ntfs-cvs@lists.sourceforge.net mailing list when someone @@ -132,6 +131,12 @@ xx/xx/2005 - 2.0.0-WIP in a way that clusters were referenced outside of the volume. (Szaka) - Major rewrite of libntfs/win32_io.c and in particular seek, read, and write related code. + - ntfsclone: --rescue works at the lowest, sector and not cluster level + thus more data can be rescued. The contents of the unreadable sectors + are filled by character '?' and the beginning of such sectors are + marked by "BadSectoR\0". (Krishna Mohan Gundu, Szaka) + - ntfsclone: fixed an off-by-one error during --metadata in function + wipe_data(). (Szaka) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 1a5e15bb5bbf3311bbb94b3c26e9bbe3d50c1877 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 10 May 2005 16:37:01 +0000 Subject: [PATCH 2241/2994] - fix handle_undelete() declaration (compiler warning) --- ntfsprogs/ntfsundelete.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 990a5b06..b0cbb45e 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -2002,7 +2002,7 @@ free: * handle_undelete * Handles the undelete */ -int handle_undelete (ntfs_volume *vol) +static int handle_undelete (ntfs_volume *vol) { int result = 1; int i; From 16ffe6063d0b27135c2a50ee325572badbcb2e4b Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 10 May 2005 16:44:58 +0000 Subject: [PATCH 2242/2994] - remark that Longhorn uses the same NTFS 3.1 format as XP and W2K3 --- include/ntfs/volume.h | 2 +- libntfs/volume.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index da395e27..a25ef156 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -93,7 +93,7 @@ typedef enum { * NTFS version 1.1 and 1.2 are used by Windows NT4. * NTFS version 2.x is used by Windows 2000 Beta * NTFS version 3.0 is used by Windows 2000. - * NTFS version 3.1 is used by Windows XP and Windows Server 2003. + * NTFS version 3.1 is used by Windows XP, Windows Server 2003 and Longhorn. */ #define NTFS_V1_1(major, minor) ((major) == 1 && (minor) == 1) diff --git a/libntfs/volume.c b/libntfs/volume.c index 78d5d61b..9c771362 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1183,7 +1183,7 @@ int ntfs_check_if_mounted(const char *file __attribute__((unused)), * Version 1.1 and 1.2 are used by Windows NT3.x and NT4. * Version 2.x is used by Windows 2000 Betas. * Version 3.0 is used by Windows 2000. - * Version 3.1 is used by Windows XP and Windows Server 2003. + * Version 3.1 is used by Windows XP, Windows Server 2003 and Longhorn. * * Return 0 if NTFS version is supported otherwise -1 with errno set. * From fbbefe0c703d4850b4a9ecf55b572889c3bf4b55 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 10 May 2005 16:53:48 +0000 Subject: [PATCH 2243/2994] - read-write ntfs_mount() returns EPERM if the partition is hibernated --- ChangeLog | 2 + libntfs/volume.c | 136 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 134 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1367a725..dd6b22ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -137,6 +137,8 @@ xx/xx/2005 - 2.0.0-WIP marked by "BadSectoR\0". (Krishna Mohan Gundu, Szaka) - ntfsclone: fixed an off-by-one error during --metadata in function wipe_data(). (Szaka) + - Detect and refuse to mount hibernated Windows during ntfs_mount() if + the volume is tried to be opened read-write. (Szaka) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/libntfs/volume.c b/libntfs/volume.c index 9c771362..0ecda611 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -2,6 +2,7 @@ * volume.c - NTFS volume handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2002-2005 Szabolcs Szakacsits * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -39,6 +40,7 @@ #include "inode.h" #include "runlist.h" #include "logfile.h" +#include "dir.h" /** * ntfs_volume_alloc - @@ -588,6 +590,128 @@ exit: return ret; } +/** + * ntfs_hiberfile_open - Find and open '/hiberfil.sys' + * @vol: An ntfs volume obtained from ntfs_mount + * + * Return: inode Success, hibefil.sys is valid + * NULL hibefil.sys doesn't exist or some other error occurred + */ +static ntfs_inode *ntfs_hiberfile_open(ntfs_volume *vol) +{ + u64 inode; + ntfs_inode *ni_root; + ntfs_inode *ni_hibr = NULL; + ntfschar *unicode = NULL; + int unicode_len; + const char *hiberfile = "hiberfil.sys"; + + if (!vol) { + errno = EINVAL; + return NULL; + } + + ni_root = ntfs_inode_open(vol, FILE_root); + if (!ni_root) { + Dprintf("Couldn't open the root directory.\n"); + return NULL; + } + + unicode_len = ntfs_mbstoucs(hiberfile, &unicode, 0); + if (unicode_len < 0) { + Dperror("Couldn't convert 'hiberfil.sys' to Unicode"); + goto out; + } + + inode = ntfs_inode_lookup_by_name(ni_root, unicode, unicode_len); + if (inode == (u64)-1) { + Dprintf("Couldn't find file '%s'.\n", hiberfile); + goto out; + } + + inode = MREF(inode); + ni_hibr = ntfs_inode_open(vol, inode); + if (!ni_hibr) { + Dprintf("Couldn't open inode %lld.\n", (long long)inode); + goto out; + } +out: + ntfs_inode_close(ni_root); + if (unicode) + free(unicode); + return ni_hibr; +} + + +#define NTFS_HIBERFILE_HEADER_SIZE 4096 + +/** + * ntfs_volume_check_hiberfile - check hiberfil.sys whether Windows is + * hibernated on the target volume + * @vol: volume on which to check hiberfil.sys + * + * Return: 0 if Windows isn't hibernated for sure + * -1 otherwise and errno is set to the appropriate value + */ +static int ntfs_volume_check_hiberfile(ntfs_volume *vol) +{ + ntfs_inode *ni; + ntfs_attr *na = NULL; + int i, bytes_read, ret = -1; + char *buf = NULL; + + ni = ntfs_hiberfile_open(vol); + if (!ni) { + if (errno == ENOENT) + return 0; + return -1; + } + + buf = malloc(NTFS_HIBERFILE_HEADER_SIZE); + if (!buf) { + Dperror("Error allocating memory for hiberfile.sys header"); + goto out; + } + + na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); + if (!na) { + Dperror("Failed to open hiberfil.sys data attribute"); + goto out; + } + + bytes_read = ntfs_attr_pread(na, 0, NTFS_HIBERFILE_HEADER_SIZE, buf); + if (bytes_read == -1) { + Dperror("Failed to read hiberfil.sys"); + goto out; + } + if (bytes_read < NTFS_HIBERFILE_HEADER_SIZE) { + Dprintf("Hibernated non-system partition, refused to mount!\n"); + errno = EPERM; + goto out; + } + if (memcmp(buf, "hibr", 4) == 0) { + Dprintf("Windows is hibernated, refused to mount!\n"); + errno = EPERM; + goto out; + } + for (i = 0; i < NTFS_HIBERFILE_HEADER_SIZE; i++) { + if (buf[i]) { + Dprintf("Windows is hibernated, won't mount!\n"); + errno = EPERM; + goto out; + } + } + /* All right, all header bytes are zero */ + ret = 0; +out: + if (na) + ntfs_attr_close(na); + if (buf) + free(buf); + ntfs_inode_close(ni); + return ret; +} + /** * ntfs_device_mount - open ntfs volume * @dev: device to open @@ -954,11 +1078,15 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) Dperror("Failed to close inode, leaking memory"); /* - * Check logfile. We care about not clean logfile only during - * read-write mount, so for read-only mount don't check logfile at all. + * Check for dirty logfile and hibernated Windows. + * We care only about read-write mounts. */ - if (!(rwflag & MS_RDONLY) && ntfs_volume_check_logfile(vol)) - goto error_exit; + if (!(rwflag & MS_RDONLY)) { + if (ntfs_volume_check_logfile(vol) < 0) + goto error_exit; + if (ntfs_volume_check_hiberfile(vol) < 0) + goto error_exit; + } return vol; io_error_exit: From 1cefeefd61a0dd859b432bdb7242b6bb723ffd0e Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 10 May 2005 17:00:03 +0000 Subject: [PATCH 2244/2994] - hint to the user what to do if the partition is hibernated --- ntfsprogs/ntfsresize.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 7e293cfd..adaf534c 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -79,6 +79,10 @@ static const char *corrupt_volume_msg = "it's important! You probably also need to reboot Windows to take effect.\n" "Then you can try ntfsresize again. No modification was made to your NTFS.\n"; +static const char *hibernated_volume_msg = +"Apparently the NTFS partition is hibernated. Windows must be resumed and\n" +"turned off properly, thus resizing will be possible later on.\n"; + struct { int verbose; int debug; @@ -2064,6 +2068,8 @@ static ntfs_volume *mount_volume(void) printf(invalid_ntfs_msg, opt.volume); else if (err == EIO) printf(corrupt_volume_msg); + else if (err == EPERM) + printf(hibernated_volume_msg); exit(1); } From 655bcdfa50f508d01e1640105e5c61595a27dfd5 Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 19 May 2005 20:47:09 +0000 Subject: [PATCH 2245/2994] Try to add the execute bit that was lost in the BK to CVS conversion. From 104d4e6d21d11d47b0edd0ff6a4f44e5bfbf420d Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 19 May 2005 21:27:30 +0000 Subject: [PATCH 2246/2994] Update copyright to include 2005. --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 58bc6d57..c23786d6 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ Linux-NTFS The Linux-NTFS project aims to bring full support for the NTFS filesystem to the Linux operating system. -Linux-NTFS is copyright (c) 2000-2004 Anton Altaparmakov. +Linux-NTFS is copyright (c) 2000-2005 Anton Altaparmakov. All of the contents of the Linux-NTFS project are free software, released under the GNU General Public License and you are welcome to redistribute them under From 1a76cc4821f920038a16edbc82e612eff5ada41f Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 19 May 2005 21:34:18 +0000 Subject: [PATCH 2247/2994] Change pointer to bkbits to cvs on SF.net. --- README | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README b/README index c23786d6..a3738a4b 100644 --- a/README +++ b/README @@ -27,9 +27,8 @@ The Linux-NTFS home page is at: The SourceForge.net Linux-NTFS project page is at: http://sourceforge.net/projects/linux-ntfs/ -The latest Linux-NTFS source code is available from our BitKeeper repositories -which can be found at: - http://linux-ntfs.bkbits.net/ +The latest Linux-NTFS source code is available from our CVS repositories which +can be found on our SourceForge.net project page. If you would like to take part in the development of Linux-NTFS, you are invited to subscribe to the development mailing list, From 56ca79a6d664976a4d3241af8b4b72a1df2d5df2 Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 19 May 2005 21:49:44 +0000 Subject: [PATCH 2248/2994] Force commits to fix permissions. From 4b0bc259ca438ef6aa15af95b3cfc8615d5157dd Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 19 May 2005 21:51:12 +0000 Subject: [PATCH 2249/2994] Minor update to NEWS and remove BK specific ChangeSet file. --- ChangeSet | 0 NEWS | 2 ++ 2 files changed, 2 insertions(+) delete mode 100644 ChangeSet diff --git a/ChangeSet b/ChangeSet deleted file mode 100644 index e69de29b..00000000 diff --git a/NEWS b/NEWS index 26271de4..4281c0c6 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ Current news ============ +Moved back from BitKeeper to CVS on SF.net. + ntfsprogs should now work completely on Windows 2000 and XP (Cygwin). mkntfs does not create bootable volumes when on Windows. Volumes are locked when using a R/W utility in order to prevent data corruption. (Yuval Fledel) From cf2646d60773efdbe1b0dcd42c6c20682bc6f064 Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 19 May 2005 21:54:59 +0000 Subject: [PATCH 2250/2994] Update --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index dd6b22ff..b6f37ffb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -139,6 +139,8 @@ xx/xx/2005 - 2.0.0-WIP wipe_data(). (Szaka) - Detect and refuse to mount hibernated Windows during ntfs_mount() if the volume is tried to be opened read-write. (Szaka) + - Move back from BitKeeper to CVS on SF.net and fix executable + permissions that got lost during the move. (Anton) 04/09/2004 - 1.9.4 - Urgent bug fixes. From 430c1c975d617737bb5cc6e454336f7c1d1b00ff Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 21 May 2005 13:05:24 +0000 Subject: [PATCH 2251/2994] Remove some BK specific files. --- BitKeeper/etc/config | 11 --- BitKeeper/etc/logging_ok | 1 - BitKeeper/triggers/post-incoming.mail | 88 ----------------------- BitKeeper/triggers/post-outgoing.ciabot | 96 ------------------------- 4 files changed, 196 deletions(-) delete mode 100644 BitKeeper/etc/config delete mode 100644 BitKeeper/etc/logging_ok delete mode 100644 BitKeeper/triggers/post-incoming.mail delete mode 100644 BitKeeper/triggers/post-outgoing.ciabot diff --git a/BitKeeper/etc/config b/BitKeeper/etc/config deleted file mode 100644 index d704163e..00000000 --- a/BitKeeper/etc/config +++ /dev/null @@ -1,11 +0,0 @@ -description: Developmental Linux NTFS userspace library and utilities -category: System Environment/Base -homepage: http://linux-ntfs.sf.net/ -bkweb: http://linux-ntfs.bkbits.net:8080/ntfsprogs-devel -contact: Anton Altaparmakov -email: aia21@cantab.net -logging: logging@openlogging.org -logging_ask: no -checkout: get -compression: gzip -autofix: yes diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok deleted file mode 100644 index 5e360a8c..00000000 --- a/BitKeeper/etc/logging_ok +++ /dev/null @@ -1 +0,0 @@ -aia21@cantab.net diff --git a/BitKeeper/triggers/post-incoming.mail b/BitKeeper/triggers/post-incoming.mail deleted file mode 100644 index ef72ec4b..00000000 --- a/BitKeeper/triggers/post-incoming.mail +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/sh -# -# post-incoming.mail - A BitKeeper trigget to send incoming ChangeSets to the -# linux-ntfs-cvs mailing list, one ChangeSet per email. -# -# Copyright (c) 2005 Yura Pakhuchiy -# Copyright (c) 2005 Anton Altaparmakov -# -# 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 of the License, 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. -######################################################################### - -# This script should only be run on successful incoming pushes in the -# repository on bkbits.net. -if [ "x${BK_SIDE}" != "xserver" ]; then - exit 0 -fi -if [ "x${BK_EVENT}" != "xincoming push" ]; then - exit 0 -fi -if [ "x${BK_STATUS}" != "xOK" ]; then - exit 0 -fi -if [ -z "$(echo ${BKD_HOST} | grep bkbits.net)" ]; then - exit 0 -fi - -EMAIL="ntfs-cvs " -REPLYTO="ntfs-dev " - -# For each ChangeSet, send an email. -bk changes -f -d'$unless(:MERGE:){:CSETREV:\n}' - < "${BK_CSETLIST}" 2>/dev/null | while read rev; do - -SUBJECT="Subject: bk-$(echo ${BKD_ROOT} 2>/dev/null | sed "s#.*/##" 2>/dev/null): ChangeSet@${rev} by ${BK_USER}@${BK_HOST}" - -{ -bk changes -f -d'$unless(:MERGE:){ChangeSet|:CSETREV:\n}' -r$rev 2>/dev/null | -bk -R prs -h -d'$unless(:MERGE:){ChangeSet@:I:, 20:Dy:-:Dm:-:Dd: :T::TZ:, :P:@:HOST:\n}' - 2>/dev/null - -cat </dev/null | diffstat -p1 2>/dev/null - -cat </dev/null - -cat </dev/null - -cat </dev/null - -} | mail -R "\"${REPLYTO}\"" -s "\"${SUBJECT}\"" "\"${EMAIL}\"" - -done - -exit 0 diff --git a/BitKeeper/triggers/post-outgoing.ciabot b/BitKeeper/triggers/post-outgoing.ciabot deleted file mode 100644 index 8fc70c1d..00000000 --- a/BitKeeper/triggers/post-outgoing.ciabot +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh -# -# post-outgoing -- catch and format BitKeeper repository events and mail them to the CIA bot. -# -# Copyright (C) 2003 Leonard Norrgard -# -# 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 of the License, 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. -######################################################################### - -# Submit bkbits.net repository changes to the CIA bot, who in turn -# forwards the messages to #commits on IRC and a project IRC channel, -# as configured below. If your project isn't on bkbits.net, you may need to -# make several changes in the script itself. See "bk help triggers" for the -# basic documentation to how this works. There's a trick: bkbits.net don't -# have triggers enabled, -# -# It tries to makes sure that only pushes to public repositories get broadcasted. -# -# 1) Edit the channel setting below. -# 2) Put this script in a file named post-outgoing.ciabot in -# BitKeeper/triggers/pre-apply.ciabot in your project. -# 3) Check it into your repository on bkbits.net -# 4) The next time anyone pulls the project, they'll get the script. -# From then on, BitKeeper does the rest. -# 4) ? -# 5) Profit! :^) - -# --- begin config section --- -# -# Note: irc network name ignored for now, but must be included. -# What you say here end up as a prefix on each row of your logs -# on #commits. You must use the name of your projects IRC channel in -# order to have the invite the bot there. -# -# example: -# IRCCHANNEL=irc.freenode.net/ourprojectchannel -IRCCHANNEL=irc.freenode.net/ntfs - -# The email address where we send the commit messages. -COMMITADDRESS=commits@picogui.org - -# -# --- end config section --- -# -###################################################################### - -if [ X$BK_STATUS = XDRYRUN -o X$BK_STATUS = XNOTHING ] -then exit 0 -fi - -# In order to make sure only pushes to public BitKeeper repositories -# are broadcasted to #commits, we check that a) the parent repository -# is on bkbits.net and b) we are the client. - -# Is parent a public BitKeeper repository at bkbits.net? -if [ -z "`bk parent|grep bkbits.net/`" ] -then exit 0 -fi - -if [ $BK_SIDE != client ] -then exit 0 -fi - -# Display info about incoming and outgoing csets. - -U=$BK_USER -H=$BK_HOST -R=$BK_ROOT - -( -U_OUT="user={light blue}${U}@${H}{normal}" -R_OUT=`echo $R | sed "s,.*/,,"` - -echo repository={green}${R_OUT}{normal} $U_OUT - -# See "bk help prs" for documentation on the formatting string. -if [ X$BK_CSETLIST != X ] -then ( - bk changes -v -d'$if(:GFILE:=ChangeSet){{orange}ChangeSet@:REV:{normal} tags=$if(:TAG:){{red}:TAG:{normal}} $if(:C:){:C:}\n}$unless(:GFILE:=ChangeSet){* :GFILE:$if(:C:){: $each(:C:){(:C:)}}\n}' - < $BK_CSETLIST - ) -fi -) | mail -s "Announce `echo -n $IRCCHANNEL | sed 's,.*/,,'`" $COMMITADDRESS -exit 0 From 0c72b6f242feabf5140320cfc49e5cb6eb1d8407 Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 23 May 2005 12:07:02 +0000 Subject: [PATCH 2252/2994] Giang Nguyen - remove redundancy --- ntfsprogs/ntfsundelete.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index b0cbb45e..7e91eeaf 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -688,7 +688,7 @@ static void free_file (struct ufile *file) if (f->name) free (f->name); if (f->parent_name) { - Dprintf ("\tand parent filename '%s'\n", f->parent_name ? f->parent_name : NONE); + Dprintf ("\tand parent filename '%s'\n", f->parent_name); free (f->parent_name); } free (f); From 6aa5cc17fed40491d237ac5823d11ac123327046 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 24 May 2005 21:13:51 +0000 Subject: [PATCH 2253/2994] ntfsresize: fix segfault during fsck if $Bitmap was larger than expected --- ChangeLog | 2 ++ ntfsprogs/ntfsresize.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index b6f37ffb..af975422 100644 --- a/ChangeLog +++ b/ChangeLog @@ -141,6 +141,8 @@ xx/xx/2005 - 2.0.0-WIP the volume is tried to be opened read-write. (Szaka) - Move back from BitKeeper to CVS on SF.net and fix executable permissions that got lost during the move. (Anton) + - ntfsresize: fix segfault during filesystem check if NTFS $Bitmap file + size was larger than it should have been. (Szaka) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index adaf534c..cccf34b1 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -873,6 +873,11 @@ static void compare_bitmaps(ntfs_volume *vol, struct bitmap *a) break; } + if (a->size < pos + count) + err_exit("$Bitmap file size is larger than " + "expected (%lld+ versus %lld)\n", + pos + count, a->size); + for (i = 0; i < count; i++, pos++) { s64 cl; /* current cluster */ From 683b707b43decdfe4d638b86ee21974cb009edc7 Mon Sep 17 00:00:00 2001 From: szaka Date: Thu, 2 Jun 2005 18:36:43 +0000 Subject: [PATCH 2254/2994] Don't mark NTFS dirty if the backup boot sector could be created --- ChangeLog | 2 + ntfsprogs/mkntfs.c | 137 +++++++++++++++++++++++++++------------------ 2 files changed, 86 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index af975422..c452c9c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -143,6 +143,8 @@ xx/xx/2005 - 2.0.0-WIP permissions that got lost during the move. (Anton) - ntfsresize: fix segfault during filesystem check if NTFS $Bitmap file size was larger than it should have been. (Szaka) + - mkntfs: don't mark NTFS dirty if the backup boot sector could be + successfully created (Szaka) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 61df1976..daefcfac 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3196,6 +3196,77 @@ static void mkntfs_fill_device_with_zeroes(void) Qprintf(" - Done.\n"); } +static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) +{ + int i, err; + char *sd; + + Vprintf("Creating $Volume (mft record 3)\n"); + m = (MFT_RECORD*)(buf + 3 * vol->mft_record_size); + err = create_hardlink(index_block, root_ref, m, + MK_LE_MREF(FILE_Volume, FILE_Volume), 0LL, 0LL, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, + "$Volume", FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_Volume, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (!err) + err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); + if (!err) + err = add_attr_vol_name(m, vol->vol_name, vol->vol_name ? + strlen(vol->vol_name) : 0); + if (!err) { + Qprintf("Setting the volume dirty so check disk runs on next " + "reboot into Windows.\n"); + err = add_attr_vol_info(m, fl, vol->major_ver, + vol->minor_ver); + } + if (err < 0) + err_exit("Couldn't create $Volume: %s\n", strerror(-err)); +} + +/** + * create_backup_boot_sector + * + * Return 0 on success or 1 if it couldn't be created. + */ +static int create_backup_boot_sector(char *buff, int size) +{ + ssize_t bw; + int _e = errno; + const char *_s; + + Vprintf("Creating backup boot sector.\n"); + /* + * Write the first max(512, opts.sector_size) bytes from buf to the + * last sector. + */ + if (vol->dev->d_ops->seek(vol->dev, (opts.nr_sectors + 1) * + opts.sector_size - size, SEEK_SET) == (off_t)-1) + goto bb_err; + + bw = mkntfs_write(vol->dev, buff, size); + if (bw == size) + return 0; + + if (bw == -1LL) + _s = strerror(_e); + else + _s = "unknown error"; + if (bw != -1LL || (bw == -1LL && _e != ENOSPC)) { + err_exit("Couldn't write backup boot sector: %s\n", _s); +bb_err: + Eprintf("Seek failed: %s\n", strerror(errno)); + } + Eprintf("Couldn't write backup boot sector. This is due to a " + "limitation in the\nLinux kernel. This is not " + "a major problem as Windows check disk will " + "create the\nbackup boot sector when it " + "is run on your next boot into Windows.\n"); + return 1; +} + /** * mkntfs_create_root_structures - * @@ -3207,9 +3278,9 @@ static void mkntfs_create_root_structures(void) ATTR_RECORD *a; MFT_RECORD *m; MFT_REF root_ref; - ssize_t bw; int i, j, err; char *sd; + VOLUME_FLAGS volume_flags = 0; Qprintf("Creating NTFS volume structures.\n"); /* @@ -3370,30 +3441,7 @@ static void mkntfs_create_root_structures(void) if (err < 0) err_exit("Couldn't create $LogFile: %s\n", strerror(-err)); //dump_mft_record(m); - Vprintf("Creating $Volume (mft record 3)\n"); - m = (MFT_RECORD*)(buf + 3 * vol->mft_record_size); - err = create_hardlink(index_block, root_ref, m, - MK_LE_MREF(FILE_Volume, FILE_Volume), 0LL, 0LL, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, - "$Volume", FILE_NAME_WIN32_AND_DOS); - if (!err) { - init_system_file_sd(FILE_Volume, &sd, &i); - err = add_attr_sd(m, sd, i); - } - if (!err) - err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); - if (!err) - err = add_attr_vol_name(m, vol->vol_name, vol->vol_name ? - strlen(vol->vol_name) : 0); - if (!err) { - Qprintf("Setting the volume dirty so check disk runs on next " - "reboot into Windows.\n"); - err = add_attr_vol_info(m, VOLUME_IS_DIRTY, vol->major_ver, - vol->minor_ver); - } - if (err < 0) - err_exit("Couldn't create $Volume: %s\n", strerror(-err)); - //dump_mft_record(m); + Vprintf("Creating $AttrDef (mft record 4)\n"); m = (MFT_RECORD*)(buf + 4 * vol->mft_record_size); if (vol->major_ver < 3) @@ -3525,37 +3573,20 @@ static void mkntfs_create_root_structures(void) } if (err < 0) err_exit("Couldn't create $Boot: %s\n", strerror(-err)); - Vprintf("Creating backup boot sector.\n"); - /* - * Write the first max(512, opts.sector_size) bytes from buf2 to the - * last sector. - */ - if (vol->dev->d_ops->seek(vol->dev, (opts.nr_sectors + 1) * - opts.sector_size - i, SEEK_SET) == (off_t)-1) - goto bb_err; - bw = mkntfs_write(vol->dev, buf2, i); + + if (create_backup_boot_sector(buf2, i) != 0) { + /* + * Pre-2.6 kernels couldn't access the last sector + * if it was odd hence we schedule chkdsk to create it. + */ + volume_flags |= VOLUME_IS_DIRTY; + } + free(buf2); buf2 = NULL; - if (bw != i) { - int _e = errno; - const char *_s; - if (bw == -1LL) - _s = strerror(_e); - else - _s = "unknown error"; - if (bw != -1LL || (bw == -1LL && _e != ENOSPC)) { - err_exit("Couldn't write backup boot sector: %s\n", _s); -bb_err: - Eprintf("Seek failed: %s\n", strerror(errno)); - } - Eprintf("Couldn't write backup boot sector. This is due to a " - "limitation in the\nLinux kernel. This is not " - "a major problem as Windows check disk will " - "create the\nbackup boot sector when it " - "is run on your next boot into Windows.\n"); - } - //dump_mft_record(m); + create_file_volume(m, root_ref, volume_flags); + Vprintf("Creating $BadClus (mft record 8)\n"); m = (MFT_RECORD*)(buf + 8 * vol->mft_record_size); // FIXME: This should be IGNORE_CASE From b8a543a27e17003fa6e1766fbd53e010a734677d Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 3 Jun 2005 10:27:32 +0000 Subject: [PATCH 2255/2994] Do dynamic run-time detection of SetFilePointerEx() instead of defunct autoconf crap. Also, fix a really stupid bug in the emulated SetFilePointerEx() which caused the segfaults. (It unconditionally wrote to a pointer even when it was NULL.) --- ChangeLog | 3 +- libntfs/win32_io.c | 195 +++++++++++++++++++++++++-------------------- 2 files changed, 112 insertions(+), 86 deletions(-) diff --git a/ChangeLog b/ChangeLog index c452c9c6..93575b4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -130,7 +130,8 @@ xx/xx/2005 - 2.0.0-WIP - ntfsresize: fix segfault during filesystem check if NTFS was corrupted in a way that clusters were referenced outside of the volume. (Szaka) - Major rewrite of libntfs/win32_io.c and in particular seek, read, and - write related code. + write related code. As part of this perform run-time detection of + presence of SetFilePointerEx() and if not present emulate it. - ntfsclone: --rescue works at the lowest, sector and not cluster level thus more data can be rescued. The contents of the unreadable sectors are filled by character '?' and the beginning of such sectors are diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index db0b79ab..44ee1afa 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -54,17 +54,22 @@ typedef struct ntfs_volume ntfs_volume; #define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS 5636096 #endif -/* windows 2k+ imports */ -typedef HANDLE (WINAPI *LPFN_FINDFIRSTVOLUME) (LPTSTR,DWORD); -typedef BOOL (WINAPI *LPFN_FINDNEXTVOLUME) (HANDLE,LPTSTR,DWORD); -typedef BOOL (WINAPI *LPFN_FINDVOLUMECLOSE) (HANDLE); +/* Windows 2k+ imports. */ +typedef HANDLE (WINAPI *LPFN_FINDFIRSTVOLUME)(LPTSTR, DWORD); +typedef BOOL (WINAPI *LPFN_FINDNEXTVOLUME)(HANDLE, LPTSTR, DWORD); +typedef BOOL (WINAPI *LPFN_FINDVOLUMECLOSE)(HANDLE); +typedef BOOL (WINAPI *LPFN_SETFILEPOINTEREX)(HANDLE, LARGE_INTEGER, + PLARGE_INTEGER, DWORD); + static LPFN_FINDFIRSTVOLUME fnFindFirstVolume = NULL; static LPFN_FINDNEXTVOLUME fnFindNextVolume = NULL; static LPFN_FINDVOLUMECLOSE fnFindVolumeClose = NULL; +static LPFN_SETFILEPOINTEREX fnSetFilePointerEx = NULL; + #ifdef UNICODE -#define FUNCTIONPOSTFIX "W" +#define FNPOSTFIX "W" #else -#define FUNCTIONPOSTFIX "A" +#define FNPOSTFIX "A" #endif typedef struct win32_fd { @@ -79,29 +84,11 @@ typedef struct win32_fd { HANDLE vol_handle; } win32_fd; -#ifndef HAVE_SETFILEPOINTEREX -static BOOL WINAPI SetFilePointerEx(HANDLE hFile, - LARGE_INTEGER liDistanceToMove, - PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod) -{ - liDistanceToMove.LowPart = SetFilePointer(hFile, - liDistanceToMove.LowPart, &liDistanceToMove.HighPart, - dwMoveMethod); - if (liDistanceToMove.LowPart == INVALID_SET_FILE_POINTER && - GetLastError() != NO_ERROR) { - lpNewFilePointer->QuadPart = -1; - return FALSE; - } - lpNewFilePointer->QuadPart = liDistanceToMove.QuadPart; - return TRUE; -} -#endif - /** * ntfs_w32error_to_errno - Convert a win32 error code to the unix one * @w32error The win32 error code. * - * Limited to a reletevly small but useful number of codes + * Limited to a relatively small but useful number of codes. */ static int ntfs_w32error_to_errno(unsigned int w32error) { @@ -146,6 +133,80 @@ static int ntfs_w32error_to_errno(unsigned int w32error) } } +/** + * libntfs_SetFilePointerEx - emulation for SetFilePointerEx() + * + * We use this to emulate SetFilePointerEx() when it is not present. This can + * happen since SetFilePointerEx() only exists in Win2k+. + */ +static BOOL WINAPI libntfs_SetFilePointerEx(HANDLE hFile, + LARGE_INTEGER liDistanceToMove, + PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod) +{ + liDistanceToMove.LowPart = SetFilePointer(hFile, + liDistanceToMove.LowPart, &liDistanceToMove.HighPart, + dwMoveMethod); + if (liDistanceToMove.LowPart == INVALID_SET_FILE_POINTER && + GetLastError() != NO_ERROR) { + if (lpNewFilePointer) + lpNewFilePointer->QuadPart = -1; + return FALSE; + } + if (lpNewFilePointer) + lpNewFilePointer->QuadPart = liDistanceToMove.QuadPart; + return TRUE; +} + +/** + * ntfs_device_win32_init_imports - initialize the function pointers. + * + * The Find*Volume and SetFilePointerEx functions exist only on win2k+, as such + * we cannot just staticly import them. + * + * This function initializes the imports if the functions do exist and in the + * SetFilePointerEx case, we emulate the function ourselves if it is not + * present. + * + * Note: The values are cached, do be afraid to run it more than once. + */ +static void ntfs_device_win32_init_imports(void) +{ + HMODULE kernel32 = GetModuleHandle("kernel32"); + if (!kernel32) { + errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: kernel32.dll not found in memory."); + } + if (!fnSetFilePointerEx) { + if (kernel32) + fnSetFilePointerEx = (LPFN_SETFILEPOINTEREX) + GetProcAddress(kernel32, + "SetFilePointerEx"); + /* + * If we did not get kernel32.dll or it is not Win2k+, emulate + * SetFilePointerEx(). + */ + if (!fnSetFilePointerEx) { + Dputs("SetFilePonterEx() not found in kernel32.dll: " + "Enabling emulation."); + fnSetFilePointerEx = libntfs_SetFilePointerEx; + } + } + /* Cannot do lookups if we could not get kernel32.dll... */ + if (!kernel32) + return; + if (!fnFindFirstVolume) + fnFindFirstVolume = (LPFN_FINDFIRSTVOLUME) + GetProcAddress(kernel32, "FindFirstVolume" + FNPOSTFIX); + if (!fnFindNextVolume) + fnFindNextVolume = (LPFN_FINDNEXTVOLUME) + GetProcAddress(kernel32, "FindNextVolume" + FNPOSTFIX); + if (!fnFindVolumeClose) + fnFindVolumeClose = (LPFN_FINDVOLUMECLOSE) + GetProcAddress(kernel32, "FindVolumeClose"); +} + /** * ntfs_device_unix_status_flags_to_win32 - convert unix->win32 open flags * @flags: Unix open status flags. @@ -431,30 +492,6 @@ static int ntfs_device_win32_getgeo(HANDLE handle, win32_fd *fd) return -1; } -/** - * ntfs_device_win32_init_imports - initialize the fnFind*Volume variables. - * - * The Find*Volume functions exist only on win2k+, as such we can't - * just staticly import it. - * This function initialize the imports if the function do exist. - * - * Note: The values are cached, do be afraid to run it more than once. - */ -static void ntfs_device_win32_init_imports(void) -{ - if (!fnFindFirstVolume) - fnFindFirstVolume = (LPFN_FINDFIRSTVOLUME) - GetProcAddress(GetModuleHandle("kernel32"), - "FindFirstVolume"FUNCTIONPOSTFIX); - if (!fnFindNextVolume) - fnFindNextVolume = (LPFN_FINDNEXTVOLUME) - GetProcAddress(GetModuleHandle("kernel32"), - "FindNextVolume"FUNCTIONPOSTFIX); - if (!fnFindVolumeClose) - fnFindVolumeClose = (LPFN_FINDVOLUMECLOSE) - GetProcAddress(GetModuleHandle("kernel32"), "FindVolumeClose"); -} - /** * ntfs_device_win32_open_file - Open a file via win32 API * @filename: Name of the file to open. @@ -549,24 +586,20 @@ static HANDLE ntfs_device_win32_open_volume_for_partition(unsigned int drive_id, HANDLE vol_find_handle; TCHAR vol_name[MAX_PATH]; - ntfs_device_win32_init_imports(); - /* make sure all the required imports exist */ + /* Make sure all the required imports exist. */ if (!fnFindFirstVolume || !fnFindNextVolume || !fnFindVolumeClose) { - Dputs("win32_is_mounted: Imports not found."); + Dputs("win32_is_mounted: Required dll imports not found."); return INVALID_HANDLE_VALUE; } - - /* start iterating through volumes. */ + /* Start iterating through volumes. */ Dprintf("win32_open_volume_for_partition: Start\n"); vol_find_handle = fnFindFirstVolume(vol_name, MAX_PATH); - - /* if a valid handle could not be aquired, reply with "don't know" */ - if (vol_find_handle==INVALID_HANDLE_VALUE) { + /* If a valid handle could not be aquired, reply with "don't know". */ + if (vol_find_handle == INVALID_HANDLE_VALUE) { Dprintf("win32_open_volume_for_partition: " "FindFirstVolume failed."); return INVALID_HANDLE_VALUE; } - do { int vol_name_length; HANDLE handle; @@ -766,47 +799,39 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) errno = EBUSY; return -1; } - + ntfs_device_win32_init_imports(); numparams = sscanf(dev->d_name, "/dev/hd%c%u", &drive_char, &part); drive_id = toupper(drive_char) - 'A'; - switch (numparams) { - case 0: - Dprintf("win32_open(%s) -> file\n", dev->d_name); - err = ntfs_device_win32_open_file(dev->d_name,&fd,flags); - break; - case 1: - Dprintf("win32_open(%s) -> drive %d\n", dev->d_name, drive_id); - err = ntfs_device_win32_open_drive(drive_id,&fd,flags); - break; - case 2: - Dprintf("win32_open(%s) -> drive %d, part %u\n", - dev->d_name, drive_id, part); - err = ntfs_device_win32_open_partition(drive_id,part,&fd,flags); - break; - default: - Dprintf("win32_open(%s) -> unknwon file format\n", dev->d_name); - err = -1; + case 0: + Dprintf("win32_open(%s) -> file\n", dev->d_name); + err = ntfs_device_win32_open_file(dev->d_name, &fd, flags); + break; + case 1: + Dprintf("win32_open(%s) -> drive %d\n", dev->d_name, drive_id); + err = ntfs_device_win32_open_drive(drive_id, &fd, flags); + break; + case 2: + Dprintf("win32_open(%s) -> drive %d, part %u\n", dev->d_name, + drive_id, part); + err = ntfs_device_win32_open_partition(drive_id, part, &fd, + flags); + break; + default: + Dprintf("win32_open(%s) -> unknwon file format\n", dev->d_name); + err = -1; } - - if (err) { - /* error */ + if (err) return err; - } - Dprintf("win32_open(%s) -> %p, offset 0x%llx\n", dev->d_name, dev, fd.part_start); - /* Setup our read-only flag. */ if ((flags & O_RDWR) != O_RDWR) NDevSetReadOnly(dev); - dev->d_private = malloc(sizeof(win32_fd)); memcpy(dev->d_private, &fd, sizeof(win32_fd)); - NDevSetOpen(dev); NDevClearDirty(dev); - return 0; } From d530c02e49d8df9db5e63fc47585c1a7c52dffd0 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 3 Jun 2005 10:33:35 +0000 Subject: [PATCH 2256/2994] Ooops. Forgot to actually use our fnSetFilePointerEx() instead of SetFilePointerEx() directly... --- libntfs/win32_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 44ee1afa..6efb19e5 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -866,7 +866,7 @@ static s64 ntfs_device_win32_abs_seek(struct win32_fd *fd, s64 pos) li.QuadPart &= ~(s64)(NTFS_BLOCK_SIZE - 1); /* Only seek if we are not there already. */ if (li.QuadPart != fd->real_pos) { - if (!SetFilePointerEx(handle, li, NULL, FILE_BEGIN)) { + if (!fnSetFilePointerEx(handle, li, NULL, FILE_BEGIN)) { errno = ntfs_w32error_to_errno(GetLastError()); Dputs("Error: SetFilePointer failed."); return -1; From 8f45d909c1598adff96dc515b8efa1ab23e705ed Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 3 Jun 2005 21:53:02 +0000 Subject: [PATCH 2257/2994] Only output message that volume is being set dirty if we are actually setting the dirty flag. Otherwise the message is pointless. --- ntfsprogs/mkntfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index daefcfac..077d0f45 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3217,10 +3217,10 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) err = add_attr_vol_name(m, vol->vol_name, vol->vol_name ? strlen(vol->vol_name) : 0); if (!err) { - Qprintf("Setting the volume dirty so check disk runs on next " - "reboot into Windows.\n"); - err = add_attr_vol_info(m, fl, vol->major_ver, - vol->minor_ver); + if (fl & VOLUME_IS_DIRTY) + Qprintf("Setting the volume dirty so check disk runs " + "on next reboot into Windows.\n"); + err = add_attr_vol_info(m, fl, vol->major_ver, vol->minor_ver); } if (err < 0) err_exit("Couldn't create $Volume: %s\n", strerror(-err)); From c4cb316418ad6318ba762c3c78e08aa5a6291e30 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 3 Jun 2005 22:22:12 +0000 Subject: [PATCH 2258/2994] mkntfs: Add new option -T which fakes the time to be 00:00:00 UTC, Jan 1, 1970 instead of the current system time. --- ChangeLog | 6 ++++-- ntfsprogs/mkntfs.8.in | 9 ++++++++- ntfsprogs/mkntfs.c | 25 +++++++++++++++++++++---- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 93575b4c..e6fe77f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -144,8 +144,10 @@ xx/xx/2005 - 2.0.0-WIP permissions that got lost during the move. (Anton) - ntfsresize: fix segfault during filesystem check if NTFS $Bitmap file size was larger than it should have been. (Szaka) - - mkntfs: don't mark NTFS dirty if the backup boot sector could be - successfully created (Szaka) + - mkntfs: Don't mark NTFS dirty if the backup boot sector could be + successfully created. (Szaka) + - mkntfs: Add new option -T which fakes the time to be 00:00:00 UTC, + Jan 1, 1970 instead of the current system time. 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index e1e84dec..dad6c3f9 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -3,7 +3,7 @@ .\" This file may be copied under the terms of the GNU Public License. .\" Adapted from e2fsprogs-1.19/misc/mke2fs.8.in by Theodore Ts'o. .\" -.TH MKNTFS 8 "March 2002" "ntfsprogs version @VERSION@" +.TH MKNTFS 8 "June 2005" "ntfsprogs version @VERSION@" .SH NAME mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system .SH SYNOPSIS @@ -60,6 +60,9 @@ mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system .B \-F ] [ +.B \-T +] +[ .B \-I ] [ @@ -213,6 +216,10 @@ to run, even if the specified .I device is not a block special device, or appears to be mounted. .TP +.B \-T +Fake the time to be 00:00:00 UTC, Jan 1, 1970 instead of the current system +time. This is only really useful for debugging purposes. +.TP .B \-I Disable content indexing on the volume. (This is only meaningful on Windows 2000 and later. Windows NT 4.0 and earlier ignore this as they do diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 077d0f45..58203b9b 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -207,6 +207,8 @@ struct { char disable_indexing; /* -I, disables indexing of file contents on the volume by default. */ /* -V, print version and exit. */ + char use_epoch_time; /* -T, fake the time to be + 00:00:00 UTC, Jan 1, 1970. */ } opts; /** @@ -315,6 +317,8 @@ static void usage(void) " -n Do not write to disk\n" " -F Force execution despite " "errors\n" + " -T Fake the time to be " + "00:00:00 UTC, Jan 1, 1970\n" " -q Quiet execution\n" " -v Verbose execution\n" " -vv Very verbose execution\n" @@ -343,7 +347,7 @@ static void parse_options(int argc, char *argv[]) if (argc && *argv) EXEC_NAME = *argv; fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); - while ((c = getopt(argc, argv, "c:fh?np:qs:vz:CFIL:QVl")) != EOF) + while ((c = getopt(argc, argv, "c:fh?np:qs:vz:CFTIL:QVl")) != EOF) switch (c) { case 'n': opts.no_action = 1; @@ -401,6 +405,9 @@ static void parse_options(int argc, char *argv[]) case 'F': opts.force = 1; break; + case 'T': + opts.use_epoch_time = 1; + break; case 'I': opts.disable_indexing = 1; break; @@ -433,6 +440,16 @@ static void parse_options(int argc, char *argv[]) usage(); } +/** + * mkntfs_time + */ +static time_t mkntfs_time(void) +{ + if (!opts.use_epoch_time) + return time(NULL); + return 0; +} + /** * append_to_bad_blocks * @@ -1652,7 +1669,7 @@ static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) STANDARD_INFORMATION si; int err; - si.creation_time = utc2ntfs(time(NULL)); + si.creation_time = utc2ntfs(mkntfs_time()); si.last_data_change_time = si.creation_time; si.last_mft_change_time = si.creation_time; si.last_access_time = si.creation_time; @@ -2426,7 +2443,7 @@ static int create_hardlink(INDEX_BLOCK *idx, const MFT_REF ref_parent, fn->parent_directory = ref_parent; // FIXME: Is this correct? Or do we have to copy the creation_time // from the std info? - fn->creation_time = utc2ntfs(time(NULL)); + fn->creation_time = utc2ntfs(mkntfs_time()); fn->last_data_change_time = fn->creation_time; fn->last_mft_change_time = fn->creation_time; fn->last_access_time = fn->creation_time; @@ -3672,7 +3689,7 @@ int main(int argc, char **argv) /* Setup the correct locale for string output and conversion. */ utils_set_locale(); /* Initialize the random number generator with the current time. */ - srandom(time(NULL)); + srandom(mkntfs_time()); /* Allocate and initialize ntfs_volume structure vol. */ vol = ntfs_volume_alloc(); if (!vol) From 2d8dc1736d16bcc278614de53350cabadf3d0b93 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 4 Jun 2005 00:57:58 +0000 Subject: [PATCH 2259/2994] - Port collate.[ch] from kernel to library and implement ntfs_collate_file_name. Thus we have new API's: ntfs_collate and ntfs_is_collation_rule_supported. (Yura) - Port index.[ch] from kernel to library. New API's: ntfs_index_lookup, ntfs_index_ctx_{get,put}, ntfs_index_entry_mark_dirty. (Yura) Just finished porting, it's 03:41 here, so this code should defenitely segfault or at least not work. Today after sleep I will integrate it to library and test it by the way. --- ChangeLog | 5 + INSTALL | 11 +- Makefile.in | 36 +- aclocal.m4 | 7823 +++++++----------- compile | 8 +- config.guess | 76 +- config.sub | 15 +- configure | 15896 ++++++------------------------------- depcomp | 53 +- doc/Makefile.in | 16 +- include/Makefile.in | 36 +- include/ntfs/Makefile.am | 2 + include/ntfs/Makefile.in | 18 +- include/ntfs/collate.h | 54 + include/ntfs/index.h | 114 + install-sh | 6 +- libntfs/Makefile.am | 2 + libntfs/Makefile.in | 38 +- libntfs/collate.c | 156 + libntfs/index.c | 410 + ltmain.sh | 3348 +++----- missing | 16 +- mkinstalldirs | 6 +- ntfsprogs/Makefile.in | 18 +- 24 files changed, 7018 insertions(+), 21145 deletions(-) create mode 100644 include/ntfs/collate.h create mode 100644 include/ntfs/index.h create mode 100644 libntfs/collate.c create mode 100644 libntfs/index.c diff --git a/ChangeLog b/ChangeLog index e6fe77f5..5a480dea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -148,6 +148,11 @@ xx/xx/2005 - 2.0.0-WIP successfully created. (Szaka) - mkntfs: Add new option -T which fakes the time to be 00:00:00 UTC, Jan 1, 1970 instead of the current system time. + - Port collate.[ch] from kernel to library and implement + ntfs_collate_file_name. Thus we have new API's: ntfs_collate and + ntfs_is_collation_rule_supported. (Yura) + - Port index.[ch] from kernel to library. New API's: ntfs_index_lookup, + ntfs_index_ctx_{get,put}, ntfs_index_entry_mark_dirty. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/INSTALL b/INSTALL index 56b077d6..095b1eb4 100644 --- a/INSTALL +++ b/INSTALL @@ -1,7 +1,7 @@ Installation Instructions ************************* -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives @@ -189,13 +189,8 @@ them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: - - /bin/bash ./configure CONFIG_SHELL=/bin/bash - -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). `configure' Invocation ====================== diff --git a/Makefile.in b/Makefile.in index ce793941..2cc9ac66 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004 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. @@ -77,7 +77,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -88,10 +87,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -103,8 +98,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -134,18 +127,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -263,13 +251,7 @@ uninstall-info-am: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ + @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -281,7 +263,7 @@ $(RECURSIVE_TARGETS): local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ @@ -289,13 +271,7 @@ $(RECURSIVE_TARGETS): mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ + @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ @@ -316,7 +292,7 @@ maintainer-clean-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ diff --git a/aclocal.m4 b/aclocal.m4 index 2b04da7c..d0da9422 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.9.5 -*- Autoconf -*- +# generated automatically by aclocal 1.9.4 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +# 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. @@ -11,63 +11,12 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- -# serial 47 AC_PROG_LIBTOOL +# serial 46 AC_PROG_LIBTOOL - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# 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 And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -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_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" @@ -78,13 +27,10 @@ AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL +]) - -# AC_LIBTOOL_SETUP -# ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)dnl +[AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl @@ -94,105 +40,15 @@ 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([LT_AC_PROG_SED])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 -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] - -# Same as above, but do not quote variable references. -[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -202,78 +58,341 @@ file_magic*) ;; esac -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default +# 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* + ;; -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_64bit_output=no + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *"ELF 64"*) + lt_cv_cc_64bit_output=yes + ;; + 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) -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl + # 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])]) -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} + 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 -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER +_LT_AC_LTCONFIG_HACK +]) -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX +# AC_LIBTOOL_HEADER_ASSERT +# ------------------------ +AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], +[AC_CACHE_CHECK([whether $CC supports assert without backlinking], + [lt_cv_func_assert_works], + [case $host in + *-*-solaris*) + if test "$GCC" = yes && test "$with_gnu_ld" != yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) lt_cv_func_assert_works=no ;; + *) lt_cv_func_assert_works=yes ;; + esac + fi + ;; + esac]) +if test "x$lt_cv_func_assert_works" = xyes; then + AC_CHECK_HEADERS(assert.h) +fi +])# AC_LIBTOOL_HEADER_ASSERT -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h) +])# _LT_AC_CHECK_DLFCN +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[[ABCDGISTW]]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AC_FD_CC + fi + else + echo "cannot find nm_test_var in $nlist" >&AC_FD_CC + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC + fi + else + echo "$progname: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + +# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR +# --------------------------------- +AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], +[# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi +])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ +[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -291,7 +410,7 @@ if test "X[$]1" = X--no-reexec; then elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else @@ -303,14 +422,14 @@ if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -337,9 +456,8 @@ else # # So, first we look for a working echo in the user's PATH. - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -348,7 +466,7 @@ else break fi done - IFS="$lt_save_ifs" + IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -421,324 +539,17 @@ if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then fi AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - 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 - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - 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_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - 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 - ;; -AC_PROVIDE_IFELSE([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) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_REQUIRE([LT_AC_PROG_SED]) -AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for *BSD - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - ;; - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - +AC_DIVERT_POP +])# _LT_AC_PROG_ECHO_BACKSLASH # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ------------------------------------------------------------------ AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : +[if test "$cross_compiling" = yes; then : [$4] else + AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext </dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext +# Same as above, but do not quote variable references. +double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" + +AC_MSG_CHECKING([for objdir]) +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +AC_MSG_RESULT($objdir) + + +AC_ARG_WITH(pic, +[ --with-pic try to use only PIC/non-PIC objects [default=use both]], +pic_mode="$withval", pic_mode=default) +test -z "$pic_mode" && pic_mode=default + +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. +AC_MSG_CHECKING([for $compiler option to produce PIC]) +AC_CACHE_VAL(lt_cv_prog_cc_pic, +[ lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared + + if test "$GCC" = yes; then + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' + + case $host_os in + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_cv_prog_cc_pic='-fno-common' + ;; + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_cv_prog_cc_pic=-Kconform_pic + fi + ;; + *) + lt_cv_prog_cc_pic='-fPIC' + ;; + esac + else + # PORTME Check for PIC flags for the system compiler. + case $host_os in + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_cv_prog_cc_static='-Bstatic' + else + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' + ;; + + irix5* | irix6* | nonstopux*) + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' + ;; + + newsos6) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' + ;; + + sco3.2v5*) + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' + ;; + + solaris*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + sunos4*) + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' + fi + ;; + + *) + lt_cv_prog_cc_can_build_shared=no + ;; + esac + fi ]) -])# AC_LIBTOOL_PROG_CC_C_O +if test -z "$lt_cv_prog_cc_pic"; then + AC_MSG_RESULT([none]) +else + AC_MSG_RESULT([$lt_cv_prog_cc_pic]) + + # Check to make sure the pic_flag actually works. + AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) + AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + AC_TRY_COMPILE([], [], [dnl + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac + ], [dnl + lt_cv_prog_cc_pic_works=no + ]) + CFLAGS="$save_CFLAGS" + ]) + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) + lt_cv_prog_cc_can_build_shared=no + fi +fi + +AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) +AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) + LDFLAGS="$save_LDFLAGS" +]) + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- +# Check to see if options -o and -c are simultaneously supported by compiler +AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) +AC_CACHE_VAL([lt_cv_compiler_c_o], [ +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&AC_FD_CC + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null +]) +compiler_c_o=$lt_cv_compiler_c_o +AC_MSG_RESULT([$compiler_c_o]) + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) + AC_CACHE_VAL([lt_cv_compiler_o_lo], [ + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + ]) + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + ]) + compiler_o_lo=$lt_cv_compiler_o_lo + AC_MSG_RESULT([$compiler_o_lo]) +else + compiler_o_lo=no +fi + # Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then +if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes @@ -1000,77 +1131,764 @@ if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + AC_TRY_COMPILE([], [int some_variable = 0;], [dnl + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes + fi + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT([$compiler_rtti_exceptions]) -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR +# See if the linker supports building shared libraries. +AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ + ;; + esac + + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; + else + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \[$]# in + 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; + *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +AC_MSG_RESULT([$ld_shlibs]) +test "$ld_shlibs" = no && can_build_shared=no -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- # Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then +AC_MSG_CHECKING([how to hardcode library paths into programs]) +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then # We can hardcode non-existant directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink + hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate + hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported + hardcode_action=unsupported fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) +AC_MSG_RESULT([$hardcode_action]) -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= +striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then @@ -1078,33 +1896,17 @@ if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else AC_MSG_RESULT([no]) fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- # PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) +AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= -shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -1113,36 +1915,17 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' ;; aix4* | aix5*) @@ -1152,7 +1935,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -1162,54 +1945,57 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' + soname_spec='${libname}${release}.so$major' fi shlibpath_var=LIBPATH fi + hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) - library_names_spec='${libname}${shared_ext}' + library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; -bsdi[[45]]*) +bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -1217,55 +2003,29 @@ bsdi[[45]]*) cygwin* | mingw* | pw32*) version_type=windows - shrext_cmds=".dll" need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) + yes,cygwin*) library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac ;; - + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -1278,58 +2038,30 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. +freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac @@ -1338,11 +2070,7 @@ freebsd* | dragonfly*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on + *) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -1353,8 +2081,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -1362,45 +2090,14 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. + dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -1408,29 +2105,21 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; + *) version_type=irix ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -1439,21 +2128,20 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. -linux*) +linux-gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -1462,11 +2150,12 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi + case $host_cpu:$lt_cv_cc_64bit_output in + powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" + ;; + esac # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -1477,29 +2166,17 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -1509,17 +2186,7 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -1528,47 +2195,46 @@ openbsd*) version_type=sunos need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case "$host_os" in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' - shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' + library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf - need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; @@ -1576,8 +2242,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -1587,7 +2253,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -1599,8 +2265,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -1621,944 +2287,39 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# 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_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# 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], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# 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_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# 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], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# 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_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# 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], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# 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_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# 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_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [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]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -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_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -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 - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_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_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$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_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl -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 $CC]) - 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. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname 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 - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - 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. - case `"$lt_cv_path_LD" -v 2>&1 &1 /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|DragonFly)/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_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - 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_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - 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 - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - 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*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the pathname to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - 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 - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - 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 - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_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* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL 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, lt_dlinit, - [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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([_LT_AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) -])# _LT_AC_LANG_CXX - -# _LT_AC_PROG_CXXCPP -# --------------- -AC_DEFUN([_LT_AC_PROG_CXXCPP], -[ -AC_REQUIRE([AC_PROG_CXX]) -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -fi -])# _LT_AC_PROG_CXXCPP - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[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])])])])])]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# -------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -# Report which librarie types wil actually be built +# Report the final consequences. AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -2576,1176 +2337,10 @@ aix3*) fi ;; -aix4* | aix5*) +aix4*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([_LT_AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[[12]]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC) - # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - ;; - cxx) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - openbsd2*) - # C++ shared libraries are fairly broken - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd='echo' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext -AC_LIBTOOL_CONFIG($1) + if AC_TRY_EVAL(ac_compile); then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi]) + AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_F77_CONFIG - - -# AC_LIBTOOL_LANG_GCJ_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) -AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], -[AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_RESTORE -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_GCJ_CONFIG - - -# AC_LIBTOOL_LANG_RC_CONFIG -# -------------------------- -# Ensure that the configuration vars for the Windows resource compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) -AC_DEFUN([_LT_AC_LANG_RC_CONFIG], -[AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_RESTORE -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_RC_CONFIG - - -# AC_LIBTOOL_CONFIG([TAGNAME]) -# ---------------------------- -# If TAGNAME is not passed, then create an initial libtool script -# with a default configuration from the untagged config vars. Otherwise -# add code to config.status for appending the configuration named by -# TAGNAME from the matching tagged config vars. -AC_DEFUN([AC_LIBTOOL_CONFIG], -[# The else clause should only fire when bootstrapping the +# The second clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ + for var in echo old_CC old_CFLAGS SED \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - _LT_AC_TAGVAR(compiler, $1) \ - _LT_AC_TAGVAR(CC, $1) \ - _LT_AC_TAGVAR(LD, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ - _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ - _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ - _LT_AC_TAGVAR(old_archive_cmds, $1) \ - _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ - _LT_AC_TAGVAR(predep_objects, $1) \ - _LT_AC_TAGVAR(postdep_objects, $1) \ - _LT_AC_TAGVAR(predeps, $1) \ - _LT_AC_TAGVAR(postdeps, $1) \ - _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ - _LT_AC_TAGVAR(archive_cmds, $1) \ - _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ - _LT_AC_TAGVAR(postinstall_cmds, $1) \ - _LT_AC_TAGVAR(postuninstall_cmds, $1) \ - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ - _LT_AC_TAGVAR(allow_undefined_flag, $1) \ - _LT_AC_TAGVAR(no_undefined_flag, $1) \ - _LT_AC_TAGVAR(export_symbols_cmds, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ - _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ - _LT_AC_TAGVAR(hardcode_automatic, $1) \ - _LT_AC_TAGVAR(module_cmds, $1) \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) \ - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ - _LT_AC_TAGVAR(exclude_expsyms, $1) \ - _LT_AC_TAGVAR(include_expsyms, $1); do + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do case $var in - _LT_AC_TAGVAR(old_archive_cmds, $1) | \ - _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ - _LT_AC_TAGVAR(archive_cmds, $1) | \ - _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ - _LT_AC_TAGVAR(module_cmds, $1) | \ - _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ - _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -3953,31 +2464,14 @@ if test -f "$ltmain"; then esac done - case $lt_echo in - *'\[$]0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` - ;; - esac + cat <<__EOF__ > "${ofile}T" +#! $SHELL -ifelse([$1], [], - [cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - AC_MSG_NOTICE([creating $ofile])], - [cfgfile="$ofile"]) - - cat <<__EOF__ >> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: +# Copyright (C) 1996-2000 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -3999,21 +2493,17 @@ ifelse([$1], [], # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed program that does not truncate output. +# A sed that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="${SED} -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) +# ### BEGIN LIBTOOL CONFIG # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -4027,10 +2517,7 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) +build_libtool_need_lc=$need_lc # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -4038,12 +2525,6 @@ fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo @@ -4052,20 +2533,14 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) +# The default C compiler. +CC=$lt_CC # Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP +with_gcc=$GCC # The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) +LD=$lt_LD # Whether we need hard or soft links. LN_S=$lt_LN_S @@ -4074,7 +2549,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$lt_STRIP +STRIP=$STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -4086,7 +2561,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4096,7 +2571,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) +wl=$lt_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -4104,21 +2579,18 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_flag=$lt_pic_flag pic_mode=$pic_mode -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - # Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -4139,19 +2611,19 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) +link_static_flag=$lt_link_static_flag # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) +no_builtin_flag=$lt_no_builtin_flag # Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) +whole_archive_flag_spec=$lt_whole_archive_flag_spec # Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) +thread_safe_flag_spec=$lt_thread_safe_flag_spec # Library versioning type. version_type=$version_type @@ -4168,50 +2640,26 @@ soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_archive_cmds=$lt_old_archive_cmds old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -4219,10 +2667,10 @@ deplibs_check_method=$lt_deplibs_check_method file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) +allow_undefined_flag=$lt_allow_undefined_flag # Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) +no_undefined_flag=$lt_no_undefined_flag # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds @@ -4231,13 +2679,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe +global_symbol_pipe=$lt_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -4249,45 +2697,36 @@ shlibpath_var=$shlibpath_var shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) +hardcode_action=$hardcode_action # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) +hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) +hardcode_direct=$hardcode_direct # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) +hardcode_minus_L=$hardcode_minus_L # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) +hardcode_shlibpath_var=$hardcode_shlibpath_var # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) +link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec @@ -4296,33 +2735,30 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" +fix_srcfile_path="$fix_srcfile_path" # Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) +always_export_symbols=$always_export_symbols # The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) +export_symbols_cmds=$lt_export_symbols_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) +exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) +include_expsyms=$lt_include_expsyms -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) +# ### END LIBTOOL CONFIG __EOF__ -ifelse([$1],[], [ case $host_os in aix3*) - cat <<\EOF >> "$cfgfile" + cat <<\EOF >> "${ofile}T" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -4335,1589 +2771,11 @@ EOF ;; esac - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -linux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDGIRSTW]]' - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDRT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc* | ecpc*) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC) - # Portland Group C++ compiler. - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgcc | pgf77 | pgf90) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - ccc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - unicos*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi[[45]]*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include @@ -5951,13 +2809,748 @@ AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # return TRUE; # } # /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# 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 of the License, 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. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + chmod +x "$ofile" +fi + +])# _LT_AC_LTCONFIG_HACK + +# 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)]) -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) +# 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 <&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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])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=$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_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 &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 dependent 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 +aix4* | aix5*) + 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # 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* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # 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 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) + 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 + ;; + +newos6*) + 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 + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +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 + 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*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + 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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl +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=$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 LTDLINCL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and LTDLINCL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) @@ -5971,16 +3564,6 @@ AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # @@ -5994,51 +3577,79 @@ AC_DEFUN([LT_AC_PROG_SED], AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. +as_executable_p="test -f" as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do + for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" fi done done done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed + + # 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 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 40000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done done -done + rm -rf "$tmp" ]) -SED=$lt_cv_path_SED +if test "X$SED" != "X"; then + lt_cv_path_SED=$SED +else + SED=$lt_cv_path_SED +fi AC_MSG_RESULT([$SED]) ]) @@ -6046,7 +3657,7 @@ AC_MSG_RESULT([$SED]) dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ +AC_DEFUN(PKG_CHECK_MODULES, [ succeeded=no if test -z "$PKG_CONFIG"; then @@ -6100,11 +3711,23 @@ AC_DEFUN([PKG_CHECK_MODULES], [ -# Copyright (C) 2002, 2003, 2005 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. +# -*- Autoconf -*- +# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Generated from amversion.in; do not edit by hand. + +# 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) # ---------------------------- @@ -6117,15 +3740,26 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # 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.9.5])]) + [AM_AUTOMAKE_VERSION([1.9.4])]) -# AM_AUX_DIR_EXPAND -*- Autoconf -*- +# AM_AUX_DIR_EXPAND -# Copyright (C) 2001, 2003, 2005 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. +# Copyright (C) 2001, 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. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to @@ -6172,16 +3806,26 @@ AC_PREREQ([2.50])dnl am_aux_dir=`cd $ac_aux_dir && pwd` ]) -# AM_CONDITIONAL -*- Autoconf -*- +# AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 -# 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. +# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. -# serial 7 +# 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 6 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- @@ -6205,15 +3849,26 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) +# serial 7 -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 # 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. -# serial 8 +# 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, @@ -6222,6 +3877,7 @@ fi])]) # CC etc. in the Makefile, will ask for an AC_PROG_CC use... + # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. @@ -6361,16 +4017,27 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) -# Generate code to set up dependency tracking. -*- Autoconf -*- +# Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# 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. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, Inc. -#serial 3 +# 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 # ------------------------------ @@ -6429,20 +4096,31 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Do all the work for Automake. -*- Autoconf -*- +# Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# 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. - -# serial 12 - -# This macro actually does too much. Some checks are only needed if +# 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, 2004 +# 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 11 + # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- @@ -6543,27 +4221,51 @@ for _am_header in $config_headers :; do done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001, 2003, 2005 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. - # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. + +# Copyright (C) 2001, 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. + 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)]) -# Copyright (C) 2003, 2005 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. +# -*- Autoconf -*- +# Copyright (C) 2003 Free Software Foundation, Inc. -# serial 2 +# 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. @@ -6578,15 +4280,26 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) -# Check to see how 'make' treats includes. -*- Autoconf -*- +# Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005 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. +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. -# serial 3 +# 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() # ----------------- @@ -6630,16 +4343,27 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- +# -*- Autoconf -*- -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 -# 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. -# serial 4 +# Copyright (C) 1997, 1999, 2000, 2001, 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 3 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -6665,16 +4389,27 @@ else fi ]) -# Copyright (C) 2003, 2004, 2005 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. - # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. -# + +# Copyright (C) 2003, 2004 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. + # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). @@ -6728,15 +4463,26 @@ else fi AC_SUBST([mkdir_p])]) -# Helper functions for option handling. -*- Autoconf -*- +# Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005 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. +# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. -# serial 3 +# 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) # ----------------------- @@ -6761,16 +4507,28 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# 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. +# Check to make sure that the build environment is sane. +# -# serial 4 +# Copyright (C) 1996, 1997, 2000, 2001, 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 3 # AM_SANITY_CHECK # --------------- @@ -6813,14 +4571,25 @@ Check your system clock]) fi AC_MSG_RESULT(yes)]) -# Copyright (C) 2001, 2003, 2005 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. - # AM_PROG_INSTALL_STRIP -# --------------------- + +# Copyright (C) 2001, 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. + # 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 @@ -6843,13 +4612,25 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004, 2005 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. +# Copyright (C) 2004 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 -# serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- diff --git a/compile b/compile index ad57e2f6..3d217032 100755 --- a/compile +++ b/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand `-c -o'. -scriptversion=2005-02-03.08 +scriptversion=2004-10-12.08 -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -47,11 +47,11 @@ right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF - exit $? + exit 0 ;; -v | --v*) echo "compile $scriptversion" - exit $? + exit 0 ;; esac diff --git a/config.guess b/config.guess index 44f30e6c..82294713 100755 --- a/config.guess +++ b/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2005-02-10' +timestamp='2004-11-12' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -136,16 +136,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -814,9 +804,6 @@ EOF i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; - amd64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; @@ -835,25 +822,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux + echo cris-axis-linux-gnu exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux + echo crisv32-axis-linux-gnu exit 0 ;; frv:Linux:*:*) - echo frv-${VENDOR}-linux + echo frv-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -872,7 +859,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -891,13 +878,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux + echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux + echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -910,34 +897,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux + echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux + echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -952,18 +939,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" + echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" + echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linuxoldld) or + # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -992,7 +979,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) @@ -1210,9 +1197,6 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit 0 ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; diff --git a/config.sub b/config.sub index c884ad4e..0f84ac2c 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -timestamp='2005-02-10' +timestamp='2004-11-30' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -70,7 +70,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -237,7 +237,7 @@ case $basic_machine in | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ + | m32r | m32rle | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -310,7 +310,7 @@ case $basic_machine in | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ + | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -1172,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1205,6 +1205,9 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index a2321c15..1599cf74 100755 --- a/configure +++ b/configure @@ -243,6 +243,17 @@ IFS=" $as_nl" $as_unset CDPATH +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator +fi + # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -261,7 +272,7 @@ if test "X$1" = X--no-reexec; then elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : else @@ -273,14 +284,14 @@ if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -307,9 +318,8 @@ else # # So, first we look for a working echo in the user's PATH. - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -318,7 +328,7 @@ else break fi done - IFS="$lt_save_ifs" + IFS="$save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -392,11 +402,6 @@ fi - -tagnames=${tagnames+${tagnames},}CXX - -tagnames=${tagnames+${tagnames},}F77 - # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. @@ -466,7 +471,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 ECHO RANLIB ac_ct_RANLIB CPP EGREP LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -927,26 +932,6 @@ ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP -ac_env_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS -ac_env_CXXCPP_set=${CXXCPP+set} -ac_env_CXXCPP_value=$CXXCPP -ac_cv_env_CXXCPP_set=${CXXCPP+set} -ac_cv_env_CXXCPP_value=$CXXCPP -ac_env_F77_set=${F77+set} -ac_env_F77_value=$F77 -ac_cv_env_F77_set=${F77+set} -ac_cv_env_F77_value=$F77 -ac_env_FFLAGS_set=${FFLAGS+set} -ac_env_FFLAGS_value=$FFLAGS -ac_cv_env_FFLAGS_set=${FFLAGS+set} -ac_cv_env_FFLAGS_value=$FFLAGS # # Report the --help message. @@ -1029,10 +1014,8 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-shared[=PKGS] - build shared libraries [default=yes] - --enable-static[=PKGS] - build static libraries [default=yes] + --enable-shared=PKGS build shared libraries default=yes + --enable-static=PKGS build static libraries default=yes --enable-debug enable additional debugging code and output --disable-default-device-io-ops do not provide default device io operations @@ -1042,19 +1025,15 @@ Optional Features: --enable-warnings enable additional compiler warnings --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors - --enable-fast-install[=PKGS] - optimize for fast installation [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] - --with-tags[=TAGS] - include additional configurations [automatic] + --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 @@ -1064,11 +1043,6 @@ Some influential environment variables: CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CXXCPP C++ preprocessor - F77 Fortran 77 compiler command - FFLAGS Fortran 77 compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2045,51 +2019,47 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' 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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +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; - # This is required to get past a stupid configure bug when making the rpm. # Basically it is broken to specify the host as a command line argument to # configure on its own, i.e. without giving --host=. It is supposed to work @@ -3413,98 +3383,35 @@ fi 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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac +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; - -echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done - +# Find the correct PATH separator. Usually this is `:', but +# DJGPP uses `;' like DOS. +if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; + esac + PATH_SEPARATOR=$lt_cv_sys_path_separator fi -SED=$lt_cv_path_SED -echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6 - -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 - 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then @@ -3516,8 +3423,8 @@ 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 $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 + 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 @@ -3527,12 +3434,12 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 esac case $ac_prog in # Accept absolute paths. - [\\/]* | ?:[\\/]*) + [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + # 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%/%"` + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -3556,26 +3463,22 @@ if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do - IFS="$lt_save_ifs" 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. - case `"$lt_cv_path_LD" -v 2>&1 &1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then test "$with_gnu_ld" != no && break - ;; - *) + else test "$with_gnu_ld" != yes && break - ;; - esac + fi fi done - IFS="$lt_save_ifs" + IFS="$ac_save_ifs" else lt_cv_path_LD="$LD" # Let the user override the test with a path. fi @@ -3598,14 +3501,11 @@ 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. -case `$LD -v 2>&1 &1 &5; then lt_cv_prog_gnu_ld=yes - ;; -*) +else lt_cv_prog_gnu_ld=no - ;; -esac +fi fi echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 @@ -3622,20 +3522,7 @@ 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 -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - darwin*) - if test "$GCC" = yes; then - reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac +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 @@ -3646,42 +3533,120 @@ else # Let the user override the test. lt_cv_path_NM="$NM" else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" 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 + 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 - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) + 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 - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - 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 - ;; - esac - esac + 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="$lt_save_ifs" + IFS="$ac_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi -echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 -echo "${ECHO_T}$lt_cv_path_NM" >&6 + NM="$lt_cv_path_NM" +echo "$as_me:$LINENO: result: $NM" >&5 +echo "${ECHO_T}$NM" >&6 + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_executable_p="test -f" +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_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + fi + done + done +done + + # 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 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/sed$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + _max=0 + _count=0 + # Add /usr/xpg4/bin/sed as it is typically found on Solaris + # along with /bin/sed that truncates output. + for _sed in $_sed_list /usr/xpg4/bin/sed; do + test ! -f ${_sed} && break + cat /dev/null > "$tmp/sed.in" + _count=0 + echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" + # Check for GNU sed and select it if it is found. + if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then + lt_cv_path_SED=${_sed} + break + fi + while true; do + cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" + mv "$tmp/sed.tmp" "$tmp/sed.in" + cp "$tmp/sed.in" "$tmp/sed.nl" + echo >>"$tmp/sed.nl" + ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break + cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break + # 40000 chars as input seems more than enough + test $_count -gt 10 && break + _count=`expr $_count + 1` + if test $_count -gt $_max; then + _max=$_count + lt_cv_path_SED=$_sed + fi + done + done + rm -rf "$tmp" + +fi + +if test "X$SED" != "X"; then + lt_cv_path_SED=$SED +else + SED=$lt_cv_path_SED +fi +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 @@ -3698,7 +3663,7 @@ lt_cv_deplibs_check_method='unknown' # '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 extended regex. +# 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. @@ -3711,36 +3676,37 @@ beos*) lt_cv_deplibs_check_method=pass_all ;; -bsdi[45]*) +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*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump'. +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=pass_all + 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac ;; -freebsd* | kfreebsd*-gnu | dragonfly*) +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|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + 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.*` ;; @@ -3754,44 +3720,50 @@ gnu*) lt_cv_deplibs_check_method=pass_all ;; -hpux10.20* | hpux11*) +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 - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - 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_test_file=/usr/lib/libc.sl - ;; - esac + lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; + case $host_os in + irix5* | nonstopux*) + # 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*) - lt_cv_deplibs_check_method=pass_all +linux-gnu*) + case $host_cpu in + alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) + 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]+|_pic\.a)$' + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' fi ;; @@ -3801,19 +3773,20 @@ newos6*) lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' fi ;; 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 ;; @@ -3822,6 +3795,11 @@ sco3.2v5*) ;; 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 ;; @@ -3848,10 +3826,6 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ;; esac ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; esac fi @@ -3859,210 +3833,211 @@ 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 -test -z "$deplibs_check_method" && deplibs_check_method=unknown -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -# 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 && enable_libtool_lock=yes -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > 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 - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 3905 "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 - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - 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 - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > 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.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - 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 +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output" >&5 +echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] -int -main () -{ +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' -lt_cv_cc_needs_belf=no -fi -rm -f conftest.err 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 +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' -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 +# Transform an extracted symbol line into a proper C declaration +lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' ;; - esac -need_locks="$enable_libtool_lock" +# Handle CRLF in mingw tool chain +opt_cr= +case $host_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. +lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$no_builtin_flag" + 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); } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" +if test -z "$lt_cv_sys_global_symbol_pipe"; then + global_symbol_to_cdecl= + global_symbol_to_c_name_address= +else + global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" +fi +if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; +then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4299,6 +4274,21 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 + 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + 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 @@ -4687,1398 +4677,150 @@ fi done -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC - 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_CXX+set}" = set; then + + + + + +# 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 - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # 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_CXX="$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 -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -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_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - - -# 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 &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -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_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cxx_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -for ac_declaration in \ - '' \ - '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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -depcc="$CXX" 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_CXX_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_CXX_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 - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch 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 - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - - - -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_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 -if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -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 - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -echo "$as_me:$LINENO: result: $CXXCPP" >&5 -echo "${ECHO_T}$CXXCPP" >&6 -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -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 \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -fi - - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran - 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_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$F77"; then - ac_cv_prog_F77="$F77" # 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_F77="$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 -F77=$ac_cv_prog_F77 -if test -n "$F77"; then - echo "$as_me:$LINENO: result: $F77" >&5 -echo "${ECHO_T}$F77" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$F77" && break - done -fi -if test -z "$F77"; then - ac_ct_F77=$F77 - for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran -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_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_F77"; then - ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_F77=$ac_cv_prog_ac_ct_F77 -if test -n "$ac_ct_F77"; then - echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 -echo "${ECHO_T}$ac_ct_F77" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_F77" && break -done - - F77=$ac_ct_F77 -fi - - -# Provide some information about the compiler. -echo "$as_me:5484:" \ - "checking for Fortran 77 compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -rm -f a.out - -# If we don't use `.F' as extension, the preprocessor is not run on the -# input file. (Note that this only needs to work for GNU compilers.) -ac_save_ext=$ac_ext -ac_ext=F -echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 -if test "${ac_cv_f77_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF - program main -#ifndef __GNUC__ - choke me -#endif - - end -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext -ac_cv_f77_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 -ac_ext=$ac_save_ext -ac_test_FFLAGS=${FFLAGS+set} -ac_save_FFLAGS=$FFLAGS -FFLAGS= -echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 -echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_f77_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - FFLAGS=-g -cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_f77_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_f77_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 -echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 -if test "$ac_test_FFLAGS" = set; then - FFLAGS=$ac_save_FFLAGS -elif test $ac_cv_prog_f77_g = yes; then - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-g -O2" - else - FFLAGS="-g" - fi -else - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-O2" - else - FFLAGS= - fi -fi - -G77=`test $ac_compiler_gnu = yes && echo yes` -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 - - - -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - -# find the maximum length of command line arguments -echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 -echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 -if test "${lt_cv_sys_max_cmd_len+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for *BSD - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - ;; - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; + 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. + ;; *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac + 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 <&2 -fi +*** 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 -if test -n $lt_cv_sys_max_cmd_len ; then - echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 -echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 -else - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 -fi - - - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 -echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -linux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDGIRSTW]' - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris* | sysv5*) - symcode='[BDRT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T + fi ;; + esac fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - 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); } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + break fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac fi -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6 +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: ok" >&5 -echo "${ECHO_T}ok" >&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -if test "${lt_cv_objdir+set}" = set; then +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 - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs + 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 <&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 - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -rmdir .libs 2>/dev/null + + else + MAGIC_CMD=: + fi fi -echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 -echo "${ECHO_T}$lt_cv_objdir" >&6 -objdir=$lt_cv_objdir - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES fi ;; esac -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; 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_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" - 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_AR" && ac_cv_prog_ac_ct_AR="false" -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -echo "${ECHO_T}$ac_ct_AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - AR=$ac_ct_AR -else - AR="$ac_cv_prog_AR" -fi - 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 @@ -6240,6 +4982,168 @@ else fi +enable_dlopen=no +enable_win32_dll=no + +# 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 && enable_libtool_lock=yes + +# 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 5000 "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* + ;; + +*-*-linux*) + # Test if the compiler is 64bit + echo 'int i;' > conftest.$ac_ext + lt_cv_cc_64bit_output=no + 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 + *"ELF 64"*) + lt_cv_cc_64bit_output=yes + ;; + 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 +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err 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 + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" +need_locks="$enable_libtool_lock" + old_CC="$CC" old_CFLAGS="$CFLAGS" @@ -6248,18 +5152,40 @@ test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm -test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o +if test x"$host" != x"$build"; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case $host_os in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' @@ -6277,152 +5203,24 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" -# 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 +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs fi +rmdir .libs 2>/dev/null +echo "$as_me:$LINENO: result: $objdir" >&5 +echo "${ECHO_T}$objdir" >&6 -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_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_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 - -enable_dlopen=no -enable_win32_dll=no - -# 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 && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. @@ -6434,467 +5232,453 @@ else fi; test -z "$pic_mode" && pic_mode=default -# Use C for the default configuration in the libtool script -tagname= -lt_save_CC="$CC" -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 - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# -# Check for any special shared library compilation flags. -# -lt_prog_cc_shlib= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - lt_prog_cc_shlib='-belf' - ;; - esac -fi -if test -n "$lt_prog_cc_shlib"; then - { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 -if test "${lt_prog_compiler_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_prog_compiler_static" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - else - lt_prog_compiler_static_works=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 - -if test x"$lt_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' - - -echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6553: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:6557: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - +# We assume here that the value for lt_cv_prog_cc_pic will not be cached +# in isolation, and that seeing it set (from the cache) indicates that +# the associated values are set (in the cache) correctly too. echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_pic+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_pic= + lt_cv_prog_cc_shlib= + lt_cv_prog_cc_wl= + lt_cv_prog_cc_static= + lt_cv_prog_cc_no_builtin= + lt_cv_prog_cc_can_build_shared=$can_build_shared if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-static' case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # not sure about C++ programs. + lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" ;; - amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' + lt_cv_prog_cc_pic='-fno-common' ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' ;; - sysv4*MP*) if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic + lt_cv_prog_cc_pic=-Kconform_pic fi ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - *) - lt_prog_compiler_pic='-fPIC' + lt_cv_prog_cc_pic='-fPIC' ;; esac else - # PORTME Check for flag to pass linker flags through the system compiler. + # PORTME Check for PIC flags for the system compiler. case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' + aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' + # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_static='-Bstatic' else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' fi ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic='-qnocommon' - lt_prog_compiler_wl='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' + # Is there a better lt_cv_prog_cc_static that works with the bundled CC? + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" + lt_cv_prog_cc_pic='+Z' ;; irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' + ;; + + cygwin* | mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_cv_prog_cc_pic='-DDLL_EXPORT' ;; newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - pgcc | pgf77 | pgf90) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-static' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - esac + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' ;; osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' + lt_cv_prog_cc_wl='-Wl,' + lt_cv_prog_cc_static='-non_shared' ;; sco3.2v5*) - lt_prog_compiler_pic='-Kpic' - lt_prog_compiler_static='-dn' + lt_cv_prog_cc_pic='-Kpic' + lt_cv_prog_cc_static='-dn' + lt_cv_prog_cc_shlib='-belf' ;; solaris*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' ;; sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-PIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-KPIC' + lt_cv_prog_cc_static='-Bstatic' + lt_cv_prog_cc_wl='-Wl,' + ;; + + uts4*) + lt_cv_prog_cc_pic='-pic' + lt_cv_prog_cc_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' + lt_cv_prog_cc_pic='-Kconform_pic' + lt_cv_prog_cc_static='-Bstatic' fi ;; - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - *) - lt_prog_compiler_can_build_shared=no + lt_cv_prog_cc_can_build_shared=no ;; esac fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic" >&6 +fi -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then +if test -z "$lt_cv_prog_cc_pic"; then + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +else + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works+set}" = set; then + # Check to make sure the pic_flag actually works. + echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 + if test "${lt_cv_prog_cc_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6808: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:6812: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works=yes - fi - fi - $rm conftest* + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + case $host_os in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then + # they create non-PIC objects. So, if there were any warnings, we + # assume that PIC is not supported. + if test -s conftest.err; then + lt_cv_prog_cc_pic_works=no + else + lt_cv_prog_cc_pic_works=yes + fi + ;; + *) + lt_cv_prog_cc_pic_works=yes + ;; + esac -if test x"$lt_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_prog_cc_pic_works=no fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +fi + + + if test "X$lt_cv_prog_cc_pic_works" = Xno; then + lt_cv_prog_cc_pic= + lt_cv_prog_cc_can_build_shared=no + else + lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" + fi + + echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 +fi + +# Check for any special shared library compilation flags. +if test -n "$lt_cv_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + +echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 +if test "${lt_cv_prog_cc_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_cc_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_prog_cc_static_works=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi + + +# Belt *and* braces to stop my trousers falling down: +test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= +echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 +echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 + +pic_flag="$lt_cv_prog_cc_pic" +special_shlib_compile_flags="$lt_cv_prog_cc_shlib" +wl="$lt_cv_prog_cc_wl" +link_static_flag="$lt_cv_prog_cc_static" +no_builtin_flag="$lt_cv_prog_cc_no_builtin" +can_build_shared="$lt_cv_prog_cc_can_build_shared" + + +# Check to see if options -o and -c are simultaneously supported by compiler echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o+set}" = set; then +if test "${lt_cv_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_cv_prog_compiler_c_o=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6868: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:6872: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +echo "int some_variable = 0;" > conftest.$ac_ext +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" +compiler_c_o=no +if { (eval echo configure:5576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + lt_cv_compiler_c_o=no + else + lt_cv_compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + lt_cv_compiler_c_o=no +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 +compiler_c_o=$lt_cv_compiler_c_o +echo "$as_me:$LINENO: result: $compiler_c_o" >&5 +echo "${ECHO_T}$compiler_c_o" >&6 +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 + if test "${lt_cv_compiler_o_lo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + lt_cv_compiler_o_lo=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + lt_cv_compiler_o_lo=no + else + lt_cv_compiler_o_lo=yes + fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + ac_objext="$save_objext" + CFLAGS="$save_CFLAGS" + +fi + + compiler_o_lo=$lt_cv_compiler_o_lo + echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 +echo "${ECHO_T}$compiler_o_lo" >&6 +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then +if test "$compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 @@ -6915,72 +5699,144 @@ else need_locks=no fi -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 +if test "$GCC" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 + echo "int some_variable = 0;" > conftest.$ac_ext + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" + compiler_rtti_exceptions=no + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ - runpath_var= - allow_undefined_flag= - enable_shared_with_static_runtimes=no - archive_cmds= - archive_expsym_cmds= - old_archive_From_new_cmds= - old_archive_from_expsyms_cmds= - export_dynamic_flag_spec= - whole_archive_flag_spec= - thread_safe_flag_spec= - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - link_all_deplibs=unknown - hardcode_automatic=no - module_cmds= - module_expsym_cmds= - always_export_symbols=no - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no +int +main () +{ +int some_variable = 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + compiler_rtti_exceptions=no + else + compiler_rtti_exceptions=yes fi - ;; - openbsd*) + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$compiler_rtti_exceptions" >&6 + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi +fi + +# See if the linker supports building shared libraries. +echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_into_libs=no +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +link_all_deplibs=unknown +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. +extract_expsyms_cmds= + +case $host_os in +cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then with_gnu_ld=no - ;; - esac + fi + ;; +openbsd*) + with_gnu_ld=no + ;; +esac - ld_shlibs=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <&2 + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. + ld_shlibs=no + cat <&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. @@ -6989,73 +5845,125 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar *** so that a non-GNU linker is found, and then restart. EOF - fi - ;; + ;; - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs=no - ;; + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=yes + + extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ + test -f $output_objdir/impgen.exe || (cd $output_objdir && \ + if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ + else $CC -o impgen impgen.c ; fi)~ + $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' + + # cygwin and mingw dlls have different entry points and sets of symbols + # to exclude. + # FIXME: what about values for MSVC? + dll_entry=__cygwin_dll_entry@12 + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ + case $host_os in + mingw*) + # mingw values + dll_entry=_DllMainCRTStartup@12 + dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ ;; + esac - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= + # mingw and cygwin differ, and it's simplest to just exclude the union + # of the two symbol sets. + dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one (in ltdll.c) + if test "x$lt_cv_need_dllmain" = "xyes"; then + ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " + ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ + test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' + else + ltdll_obj= + ltdll_cmds= + fi + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left be newer dlltools. + export_symbols_cmds="$ltdll_cmds"' + $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' + + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is. + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname-def; else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; + echo EXPORTS > $output_objdir/$soname-def; + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; + 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done; + fi~ + '"$ltdll_cmds"' + $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ + $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ + $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' + ;; - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool @@ -7065,795 +5973,553 @@ EOF *** used, and then restart. EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds=$archive_cmds - fi + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec=' ' - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' - link_all_deplibs=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs=no - ;; - esac + ld_shlibs=no fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw* | pw32*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - ia64*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=no - hardcode_shlibpath_var=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - *) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld='-rpath $libdir' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag=' -z text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - *) - ld_shlibs=no + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi ;; esac fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + hardcode_direct=yes + archive_cmds='' + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + shared_flag='${wl}-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall can do strange things, so it is better to + # generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='${wl}-berok' + # This is a bit strange, but is similar to how AIX traditionally builds + # it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + esac + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' + hardcode_direct=yes + hardcode_shlibpath_var=no + whole_archive_flag_spec='-all_load $convenience' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case $host_os in + hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + #Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' + ;; + + solaris*) + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # , C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [12].*) + cat <&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5uw7* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +# Check hardcoding attributes. +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 -echo "${ECHO_T}$archive_cmds_need_lc" >&6 - ;; - esac - fi - ;; -esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +test -z "$deplibs_check_method" && deplibs_check_method=unknown +# PORTME Fill in your ld.so characteristics echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= -shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -7862,36 +6528,17 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + library_names_spec='${libname}${release}.so$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' ;; aix4* | aix5*) @@ -7901,7 +6548,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -7911,54 +6558,57 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. + # AIX (on Power*) has no versioning support, so currently we can + # not hardcode correct soname into executable. Probably we can + # add versioning support to collect2, so additional links can + # be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' + soname_spec='${libname}${release}.so$major' fi shlibpath_var=LIBPATH fi + hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' ;; beos*) - library_names_spec='${libname}${shared_ext}' + library_names_spec='${libname}.so' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; -bsdi[45]*) +bsdi4*) version_type=linux need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -7966,55 +6616,29 @@ bsdi[45]*) cygwin* | mingw* | pw32*) version_type=windows - shrext_cmds=".dll" need_version=no need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) + yes,cygwin*) library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac ;; - + yes,mingw*) + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` + ;; + yes,pw32*) + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' + ;; *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -8027,58 +6651,30 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. +freebsd*) objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' need_version=yes ;; esac @@ -8087,11 +6683,7 @@ freebsd* | dragonfly*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on + *) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -8102,8 +6694,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -8111,45 +6703,14 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. + dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -8157,29 +6718,21 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; + *) version_type=irix ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -8188,21 +6741,20 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) dynamic_linker=no ;; # This must be Linux ELF. -linux*) +linux-gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -8211,11 +6763,12 @@ linux*) # before this can be enabled. hardcode_into_libs=yes - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi + case $host_cpu:$lt_cv_cc_64bit_output in + powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" + sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" + ;; + esac # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -8226,29 +6779,17 @@ linux*) dynamic_linker='GNU/Linux ld.so' ;; -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -8258,17 +6799,7 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -8277,47 +6808,46 @@ openbsd*) version_type=sunos need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case "$host_os" in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' - shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' + library_names_spec='$libname.dll $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf - need_lib_prefix=no need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' shlibpath_var=LD_LIBRARY_PATH ;; @@ -8325,8 +6855,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -8336,7 +6866,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -8348,8 +6878,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -8370,22 +6900,31 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - *) dynamic_linker=no ;; @@ -8394,33 +6933,42 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var" || \ - test "X$hardcode_automatic" = "Xyes" ; then +# Report the final consequences. +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6 + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported @@ -8431,33 +6979,9 @@ elif test "$shlibpath_overrides_runpath" = yes || enable_fast_install=needless fi -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "x$enable_dlopen" != xyes; then @@ -8475,94 +6999,11 @@ else lt_cv_dlopen_self=yes ;; - mingw* | pw32*) + cygwin* | mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 @@ -9046,7 +7487,7 @@ fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" @@ -9062,10 +7503,10 @@ else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 fi -# Report which librarie types wil actually be built -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + if test "${lt_cv_archive_cmds_need_lc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + $rm conftest* + echo 'static int dummy;' > conftest.$ac_ext -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 + 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 + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_cv_prog_cc_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi +fi -# The else clause should only fire when bootstrapping the + echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 +echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 + ;; + esac +fi +need_lc=${lt_cv_archive_cmds_need_lc-yes} + +# The second clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi + : +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi + +if test -f "$ltmain"; then + trap "$rm \"${ofile}T\"; exit 1" 1 2 15 + $rm -f "${ofile}T" + + echo creating $ofile + # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ + for var in echo old_CC old_CFLAGS SED \ + AR AR_FLAGS CC LD LN_S NM SHELL \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ + old_striplib striplib file_magic_cmd export_symbols_cmds \ + deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler \ - CC \ - LD \ - lt_prog_compiler_wl \ - lt_prog_compiler_pic \ - lt_prog_compiler_static \ - lt_prog_compiler_no_builtin_flag \ - export_dynamic_flag_spec \ - thread_safe_flag_spec \ - whole_archive_flag_spec \ - enable_shared_with_static_runtimes \ - old_archive_cmds \ - old_archive_from_new_cmds \ - predep_objects \ - postdep_objects \ - predeps \ - postdeps \ - compiler_lib_search_path \ - archive_cmds \ - archive_expsym_cmds \ - postinstall_cmds \ - postuninstall_cmds \ - old_archive_from_expsyms_cmds \ - allow_undefined_flag \ - no_undefined_flag \ - export_symbols_cmds \ - hardcode_libdir_flag_spec \ - hardcode_libdir_flag_spec_ld \ - hardcode_libdir_separator \ - hardcode_automatic \ - module_cmds \ - module_expsym_cmds \ - lt_cv_prog_compiler_c_o \ - exclude_expsyms \ - include_expsyms; do + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do case $var in - old_archive_cmds | \ - old_archive_from_new_cmds | \ - archive_cmds | \ - archive_expsym_cmds | \ - module_cmds | \ - module_expsym_cmds | \ - old_archive_from_expsyms_cmds | \ - export_symbols_cmds | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -9384,29 +7820,14 @@ if test -f "$ltmain"; then esac done - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - { echo "$as_me:$LINENO: creating $ofile" >&5 -echo "$as_me: creating $ofile" >&6;} - - cat <<__EOF__ >> "$cfgfile" + cat <<__EOF__ > "${ofile}T" #! $SHELL -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: +# Copyright (C) 1996-2000 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -9428,18 +7849,15 @@ echo "$as_me: creating $ofile" >&6;} # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed program that does not truncate output. +# A sed that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="${SED} -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# The names of the tagged configurations supported by this script. -available_tags= +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi # ### BEGIN LIBTOOL CONFIG @@ -9455,10 +7873,7 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes +build_libtool_need_lc=$need_lc # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -9466,12 +7881,6 @@ fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo @@ -9480,18 +7889,12 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler +# The default C compiler. +CC=$lt_CC # Is the compiler the GNU C compiler? with_gcc=$GCC -# An ERE matcher. -EGREP=$lt_EGREP - # The linker used to build libraries. LD=$lt_LD @@ -9502,7 +7905,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$lt_STRIP +STRIP=$STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -9514,7 +7917,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9524,7 +7927,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl +wl=$lt_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -9532,21 +7935,18 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic +pic_flag=$lt_pic_flag pic_mode=$pic_mode -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - # Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o +compiler_c_o=$lt_compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$lt_compiler_o_lo # Must we lock files when doing compilation ? need_locks=$lt_need_locks @@ -9567,10 +7967,10 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static +link_static_flag=$lt_link_static_flag # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag +no_builtin_flag=$lt_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec @@ -9612,34 +8012,10 @@ archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -9659,13 +8035,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe +global_symbol_pipe=$lt_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -9686,15 +8062,10 @@ hardcode_into_libs=$hardcode_into_libs # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct @@ -9706,10 +8077,6 @@ hardcode_minus_L=$hardcode_minus_L # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic - # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" @@ -9745,10 +8112,9 @@ include_expsyms=$lt_include_expsyms __EOF__ - case $host_os in aix3*) - cat <<\EOF >> "$cfgfile" + cat <<\EOF >> "${ofile}T" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -9757,6 +8123,186 @@ if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi +EOF + ;; + esac + + case $host_os in + cygwin* | mingw* | pw32* | os2*) + cat <<'EOF' >> "${ofile}T" + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# 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 of the License, 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. +# */ +# +# #include /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# /* O_BINARY isn't required (or even defined sometimes) under Unix */ +# #ifndef O_BINARY +# #define O_BINARY 0 +# #endif +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (dll < 1) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1) - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + mv -f "${ofile}T" "$ofile" || \ + (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") chmod +x "$ofile" - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - -# Check whether --with-tags or --without-tags was given. -if test "${with_tags+set}" = set; then - withval="$with_tags" - tagnames="$withval" -fi; - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} - else - { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 -echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in - "") ;; - *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 -echo "$as_me: error: invalid tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 -echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} - { (exit 1); exit 1; }; } - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_flag_spec_ld_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_automatic_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -compiler_CXX=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' -else - lt_prog_compiler_no_builtin_flag_CXX= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - -# 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 $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $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. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname 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 - 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 - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - 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. - case `"$lt_cv_path_LD" -v 2>&1 &5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -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. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 -ld_shlibs_CXX=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_CXX=yes - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_CXX=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_CXX='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' ${wl}-bernotok' - allow_undefined_flag_CXX=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_CXX=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX=' ' - archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs_CXX=no - fi - ;; - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_CXX=no - ;; - esac - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - ld_shlibs_CXX=no - ;; - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - gnu*) - ;; - hpux9*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC) - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_CXX='+b $libdir' - hardcode_libdir_separator_CXX=: - ;; - ia64*) - hardcode_libdir_flag_spec_CXX='-L$libdir' - ;; - *) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC) - # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - ;; - cxx) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - openbsd2*) - # C++ shared libraries are fairly broken - ld_shlibs_CXX=no - ;; - openbsd*) - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='${wl}-E' - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd='echo' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx) - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - sco*) - archive_cmds_need_lc_CXX=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - no_undefined_flag_CXX=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - archive_cmds_need_lc_CXX=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; -esac -echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6 -test "$ld_shlibs_CXX" = no && can_build_shared=no - -GCC_CXX="$GXX" -LD_CXX="$LD" - - -cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - # The `*' in the case matches for architectures that use `case' in - # $output_verbose_cmd can trigger glob expansion during the loop - # eval without this substitution. - output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" - - for p in `eval $output_verbose_link_cmd`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" \ - || test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX="${prev}${p}" - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX="${prev}${p}" - else - postdeps_CXX="${postdeps_CXX} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX="$p" - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX="$p" - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$rm -f confest.$objext - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - -lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic_CXX='-qnocommon' - lt_prog_compiler_wl_CXX='-Wl,' - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - icpc* | ecpc*) - # Intel C++ - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - pgCC) - # Portland Group C++ compiler. - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fpic' - lt_prog_compiler_static_CXX='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11386: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:11390: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_CXX=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 - -if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11446: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:11450: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX="$ltdll_cmds" - ;; - cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - -echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6 -test "$ld_shlibs_CXX" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_CXX=no - else - archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || \ - test -n "$runpath_var_CXX" || \ - test "X$hardcode_automatic_CXX" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 -echo "${ECHO_T}$hardcode_action_CXX" >&6 - -if test "$hardcode_action_CXX" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* 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 shl_load (); -/* 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_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* 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 dlopen (); -/* 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_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_CXX \ - CC_CXX \ - LD_CXX \ - lt_prog_compiler_wl_CXX \ - lt_prog_compiler_pic_CXX \ - lt_prog_compiler_static_CXX \ - lt_prog_compiler_no_builtin_flag_CXX \ - export_dynamic_flag_spec_CXX \ - thread_safe_flag_spec_CXX \ - whole_archive_flag_spec_CXX \ - enable_shared_with_static_runtimes_CXX \ - old_archive_cmds_CXX \ - old_archive_from_new_cmds_CXX \ - predep_objects_CXX \ - postdep_objects_CXX \ - predeps_CXX \ - postdeps_CXX \ - compiler_lib_search_path_CXX \ - archive_cmds_CXX \ - archive_expsym_cmds_CXX \ - postinstall_cmds_CXX \ - postuninstall_cmds_CXX \ - old_archive_from_expsyms_cmds_CXX \ - allow_undefined_flag_CXX \ - no_undefined_flag_CXX \ - export_symbols_cmds_CXX \ - hardcode_libdir_flag_spec_CXX \ - hardcode_libdir_flag_spec_ld_CXX \ - hardcode_libdir_separator_CXX \ - hardcode_automatic_CXX \ - module_cmds_CXX \ - module_expsym_cmds_CXX \ - lt_cv_prog_compiler_c_o_CXX \ - exclude_expsyms_CXX \ - include_expsyms_CXX; do - - case $var in - old_archive_cmds_CXX | \ - old_archive_from_new_cmds_CXX | \ - archive_cmds_CXX | \ - archive_expsym_cmds_CXX | \ - module_cmds_CXX | \ - module_expsym_cmds_CXX | \ - old_archive_from_expsyms_cmds_CXX | \ - export_symbols_cmds_CXX | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_CXX - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_CXX -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_CXX - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_CXX" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld - - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu - - -archive_cmds_need_lc_F77=no -allow_undefined_flag_F77= -always_export_symbols_F77=no -archive_expsym_cmds_F77= -export_dynamic_flag_spec_F77= -hardcode_direct_F77=no -hardcode_libdir_flag_spec_F77= -hardcode_libdir_flag_spec_ld_F77= -hardcode_libdir_separator_F77= -hardcode_minus_L_F77=no -hardcode_automatic_F77=no -module_cmds_F77= -module_expsym_cmds_F77= -link_all_deplibs_F77=unknown -old_archive_cmds_F77=$old_archive_cmds -no_undefined_flag_F77= -whole_archive_flag_spec_F77= -enable_shared_with_static_runtimes_F77=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -objext_F77=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" - -# Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${F77-"f77"} -compiler=$CC -compiler_F77=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 - -test "$ld_shlibs_F77" = no && can_build_shared=no - -GCC_F77="$G77" -LD_F77="$LD" - -lt_prog_compiler_wl_F77= -lt_prog_compiler_pic_F77= -lt_prog_compiler_static_F77= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_static_F77='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_F77='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_F77=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_F77=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_F77='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - else - lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic_F77='-qnocommon' - lt_prog_compiler_wl_F77='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_F77='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_F77='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-static' - ;; - pgcc | pgf77 | pgf90) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-fpic' - lt_prog_compiler_static_F77='-static' - ;; - ccc*) - lt_prog_compiler_wl_F77='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_F77='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_F77='-Kpic' - lt_prog_compiler_static_F77='-dn' - ;; - - solaris*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl_F77='-Qoption ld ' - lt_prog_compiler_pic_F77='-PIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_F77='-Kconform_pic' - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - unicos*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_can_build_shared_F77=no - ;; - - uts4*) - lt_prog_compiler_pic_F77='-pic' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_F77=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_F77"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_F77=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_F77" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13762: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:13766: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_F77=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 - -if test x"$lt_prog_compiler_pic_works_F77" = xyes; then - case $lt_prog_compiler_pic_F77 in - "" | " "*) ;; - *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; - esac -else - lt_prog_compiler_pic_F77= - lt_prog_compiler_can_build_shared_F77=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_F77= - ;; - *) - lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_F77=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13822: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:13826: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_F77=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag_F77= - enable_shared_with_static_runtimes_F77=no - archive_cmds_F77= - archive_expsym_cmds_F77= - old_archive_From_new_cmds_F77= - old_archive_from_expsyms_cmds_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= - thread_safe_flag_spec_F77= - hardcode_libdir_flag_spec_F77= - hardcode_libdir_flag_spec_ld_F77= - hardcode_libdir_separator_F77= - hardcode_direct_F77=no - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=unsupported - link_all_deplibs_F77=unknown - hardcode_automatic_F77=no - module_cmds_F77= - module_expsym_cmds_F77= - always_export_symbols_F77=no - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_F77= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_F77=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_F77=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_F77=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_F77='-L$libdir' - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=no - enable_shared_with_static_runtimes_F77=yes - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs_F77=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - sunos4*) - archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_F77=$archive_cmds_F77 - fi - else - ld_shlibs_F77=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - esac - - if test "$ld_shlibs_F77" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=yes - archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_F77=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_F77=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_F77='' - hardcode_direct_F77=yes - hardcode_libdir_separator_F77=':' - link_all_deplibs_F77=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_F77=yes - else - # We have old collect2 - hardcode_direct_F77=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_F77=yes - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_libdir_separator_F77= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_F77=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_F77='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_F77="-z nodefs" - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_F77=' ${wl}-bernotok' - allow_undefined_flag_F77=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_F77=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_F77=' ' - archive_cmds_need_lc_F77=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_F77=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_F77=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_F77=' ' - allow_undefined_flag_F77=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_F77='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path_F77='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_F77=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_F77=no - hardcode_direct_F77=no - hardcode_automatic_F77=yes - hardcode_shlibpath_var_F77=unsupported - whole_archive_flag_spec_F77='' - link_all_deplibs_F77=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_F77=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - freebsd1*) - ld_shlibs_F77=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) - archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_F77='+b $libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - ;; - ia64*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - *) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - link_all_deplibs_F77=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - newsos6) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_shlibpath_var_F77=no - ;; - - openbsd*) - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - export_dynamic_flag_spec_F77='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - ;; - *) - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - allow_undefined_flag_F77=unsupported - archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_F77='-rpath $libdir' - fi - hardcode_libdir_separator_F77=: - ;; - - sco3.2v5*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_F77=' -z text' - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_shlibpath_var_F77=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; - esac - link_all_deplibs_F77=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_F77='$CC -r -o $output$reload_objs' - hardcode_direct_F77=no - ;; - motorola) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv4.3*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_F77=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_F77='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv5*) - no_undefined_flag_F77=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_F77= - hardcode_shlibpath_var_F77=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - *) - ld_shlibs_F77=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 -echo "${ECHO_T}$ld_shlibs_F77" >&6 -test "$ld_shlibs_F77" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_F77" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_F77=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_F77 in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_F77 - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_F77 - allow_undefined_flag_F77= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_F77=no - else - archive_cmds_need_lc_F77=yes - fi - allow_undefined_flag_F77=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_F77= -if test -n "$hardcode_libdir_flag_spec_F77" || \ - test -n "$runpath_var_F77" || \ - test "X$hardcode_automatic_F77" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_F77" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && - test "$hardcode_minus_L_F77" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_F77=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_F77=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_F77=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 -echo "${ECHO_T}$hardcode_action_F77" >&6 - -if test "$hardcode_action_F77" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_F77 \ - CC_F77 \ - LD_F77 \ - lt_prog_compiler_wl_F77 \ - lt_prog_compiler_pic_F77 \ - lt_prog_compiler_static_F77 \ - lt_prog_compiler_no_builtin_flag_F77 \ - export_dynamic_flag_spec_F77 \ - thread_safe_flag_spec_F77 \ - whole_archive_flag_spec_F77 \ - enable_shared_with_static_runtimes_F77 \ - old_archive_cmds_F77 \ - old_archive_from_new_cmds_F77 \ - predep_objects_F77 \ - postdep_objects_F77 \ - predeps_F77 \ - postdeps_F77 \ - compiler_lib_search_path_F77 \ - archive_cmds_F77 \ - archive_expsym_cmds_F77 \ - postinstall_cmds_F77 \ - postuninstall_cmds_F77 \ - old_archive_from_expsyms_cmds_F77 \ - allow_undefined_flag_F77 \ - no_undefined_flag_F77 \ - export_symbols_cmds_F77 \ - hardcode_libdir_flag_spec_F77 \ - hardcode_libdir_flag_spec_ld_F77 \ - hardcode_libdir_separator_F77 \ - hardcode_automatic_F77 \ - module_cmds_F77 \ - module_expsym_cmds_F77 \ - lt_cv_prog_compiler_c_o_F77 \ - exclude_expsyms_F77 \ - include_expsyms_F77; do - - case $var in - old_archive_cmds_F77 | \ - old_archive_from_new_cmds_F77 | \ - archive_cmds_F77 | \ - archive_expsym_cmds_F77 | \ - module_cmds_F77 | \ - module_expsym_cmds_F77 | \ - old_archive_from_expsyms_cmds_F77 | \ - export_symbols_cmds_F77 | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_F77 - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_F77 - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_F77 - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_F77 - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_F77 - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_F77 -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_F77 - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_F77 -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_F77 -archive_expsym_cmds=$lt_archive_expsym_cmds_F77 -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_F77 -module_expsym_cmds=$lt_module_expsym_cmds_F77 - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_F77 - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_F77 - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_F77 - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_F77 - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_F77 - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_F77 - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_F77 - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_F77 - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_F77 - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_F77 - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_F77" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_F77 - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_F77 - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_F77 - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_F77 - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - - - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -objext_GCJ=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -compiler_GCJ=$CC - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -archive_cmds_need_lc_GCJ=no - - -lt_prog_compiler_no_builtin_flag_GCJ= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' - - -echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15878: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:15882: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl_GCJ= -lt_prog_compiler_pic_GCJ= -lt_prog_compiler_static_GCJ= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_static_GCJ='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_GCJ='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_GCJ=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_GCJ=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_GCJ='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - else - lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic_GCJ='-qnocommon' - lt_prog_compiler_wl_GCJ='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-static' - ;; - pgcc | pgf77 | pgf90) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-fpic' - lt_prog_compiler_static_GCJ='-static' - ;; - ccc*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_GCJ='-Kpic' - lt_prog_compiler_static_GCJ='-dn' - ;; - - solaris*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl_GCJ='-Qoption ld ' - lt_prog_compiler_pic_GCJ='-PIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_GCJ='-Kconform_pic' - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - unicos*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_can_build_shared_GCJ=no - ;; - - uts4*) - lt_prog_compiler_pic_GCJ='-pic' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_GCJ=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_GCJ"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_GCJ=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_GCJ" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16133: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:16137: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_GCJ=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 - -if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then - case $lt_prog_compiler_pic_GCJ in - "" | " "*) ;; - *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; - esac -else - lt_prog_compiler_pic_GCJ= - lt_prog_compiler_can_build_shared_GCJ=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_GCJ= - ;; - *) - lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_GCJ=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16193: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:16197: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_GCJ=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag_GCJ= - enable_shared_with_static_runtimes_GCJ=no - archive_cmds_GCJ= - archive_expsym_cmds_GCJ= - old_archive_From_new_cmds_GCJ= - old_archive_from_expsyms_cmds_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= - thread_safe_flag_spec_GCJ= - hardcode_libdir_flag_spec_GCJ= - hardcode_libdir_flag_spec_ld_GCJ= - hardcode_libdir_separator_GCJ= - hardcode_direct_GCJ=no - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=unsupported - link_all_deplibs_GCJ=unknown - hardcode_automatic_GCJ=no - module_cmds_GCJ= - module_expsym_cmds_GCJ= - always_export_symbols_GCJ=no - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_GCJ= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_GCJ=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_GCJ=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_GCJ=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_GCJ='-L$libdir' - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=no - enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs_GCJ=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - sunos4*) - archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_GCJ=$archive_cmds_GCJ - fi - else - ld_shlibs_GCJ=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - esac - - if test "$ld_shlibs_GCJ" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=yes - archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_GCJ=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_GCJ=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_GCJ='' - hardcode_direct_GCJ=yes - hardcode_libdir_separator_GCJ=':' - link_all_deplibs_GCJ=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_GCJ=yes - else - # We have old collect2 - hardcode_direct_GCJ=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_GCJ=yes - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_libdir_separator_GCJ= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_GCJ=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_GCJ='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_GCJ="-z nodefs" - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_GCJ=' ${wl}-bernotok' - allow_undefined_flag_GCJ=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_GCJ=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_GCJ=' ' - archive_cmds_need_lc_GCJ=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_GCJ=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_GCJ=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_GCJ=' ' - allow_undefined_flag_GCJ=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_GCJ='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_GCJ=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_GCJ=no - hardcode_direct_GCJ=no - hardcode_automatic_GCJ=yes - hardcode_shlibpath_var_GCJ=unsupported - whole_archive_flag_spec_GCJ='' - link_all_deplibs_GCJ=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_GCJ=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - freebsd1*) - ld_shlibs_GCJ=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) - archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - ;; - ia64*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - *) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - link_all_deplibs_GCJ=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - newsos6) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_shlibpath_var_GCJ=no - ;; - - openbsd*) - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - ;; - *) - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - allow_undefined_flag_GCJ=unsupported - archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_GCJ='-rpath $libdir' - fi - hardcode_libdir_separator_GCJ=: - ;; - - sco3.2v5*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_GCJ=' -z text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_shlibpath_var_GCJ=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; - esac - link_all_deplibs_GCJ=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_GCJ='$CC -r -o $output$reload_objs' - hardcode_direct_GCJ=no - ;; - motorola) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4.3*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_GCJ=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_GCJ='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv5*) - no_undefined_flag_GCJ=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_GCJ= - hardcode_shlibpath_var_GCJ=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - *) - ld_shlibs_GCJ=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 -echo "${ECHO_T}$ld_shlibs_GCJ" >&6 -test "$ld_shlibs_GCJ" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_GCJ" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_GCJ=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_GCJ in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_GCJ - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ - allow_undefined_flag_GCJ= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_GCJ=no - else - archive_cmds_need_lc_GCJ=yes - fi - allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_GCJ= -if test -n "$hardcode_libdir_flag_spec_GCJ" || \ - test -n "$runpath_var_GCJ" || \ - test "X$hardcode_automatic_GCJ" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_GCJ" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && - test "$hardcode_minus_L_GCJ" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_GCJ=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_GCJ=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_GCJ=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 -echo "${ECHO_T}$hardcode_action_GCJ" >&6 - -if test "$hardcode_action_GCJ" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* 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 shl_load (); -/* 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_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* 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 dlopen (); -/* 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_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_GCJ \ - CC_GCJ \ - LD_GCJ \ - lt_prog_compiler_wl_GCJ \ - lt_prog_compiler_pic_GCJ \ - lt_prog_compiler_static_GCJ \ - lt_prog_compiler_no_builtin_flag_GCJ \ - export_dynamic_flag_spec_GCJ \ - thread_safe_flag_spec_GCJ \ - whole_archive_flag_spec_GCJ \ - enable_shared_with_static_runtimes_GCJ \ - old_archive_cmds_GCJ \ - old_archive_from_new_cmds_GCJ \ - predep_objects_GCJ \ - postdep_objects_GCJ \ - predeps_GCJ \ - postdeps_GCJ \ - compiler_lib_search_path_GCJ \ - archive_cmds_GCJ \ - archive_expsym_cmds_GCJ \ - postinstall_cmds_GCJ \ - postuninstall_cmds_GCJ \ - old_archive_from_expsyms_cmds_GCJ \ - allow_undefined_flag_GCJ \ - no_undefined_flag_GCJ \ - export_symbols_cmds_GCJ \ - hardcode_libdir_flag_spec_GCJ \ - hardcode_libdir_flag_spec_ld_GCJ \ - hardcode_libdir_separator_GCJ \ - hardcode_automatic_GCJ \ - module_cmds_GCJ \ - module_expsym_cmds_GCJ \ - lt_cv_prog_compiler_c_o_GCJ \ - exclude_expsyms_GCJ \ - include_expsyms_GCJ; do - - case $var in - old_archive_cmds_GCJ | \ - old_archive_from_new_cmds_GCJ | \ - archive_cmds_GCJ | \ - archive_expsym_cmds_GCJ | \ - module_cmds_GCJ | \ - module_expsym_cmds_GCJ | \ - old_archive_from_expsyms_cmds_GCJ | \ - export_symbols_cmds_GCJ | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_GCJ - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_GCJ - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_GCJ - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_GCJ - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_GCJ - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_GCJ -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_GCJ - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_GCJ -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_GCJ -archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_GCJ -module_expsym_cmds=$lt_module_expsym_cmds_GCJ - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_GCJ - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_GCJ - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_GCJ - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_GCJ - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_GCJ - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_GCJ - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_GCJ - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_GCJ - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_GCJ - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_GCJ" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_GCJ - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_GCJ - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_GCJ - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_GCJ - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - RC) - - - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -objext_RC=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -compiler_RC=$CC -lt_cv_prog_compiler_c_o_RC=yes - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_RC \ - CC_RC \ - LD_RC \ - lt_prog_compiler_wl_RC \ - lt_prog_compiler_pic_RC \ - lt_prog_compiler_static_RC \ - lt_prog_compiler_no_builtin_flag_RC \ - export_dynamic_flag_spec_RC \ - thread_safe_flag_spec_RC \ - whole_archive_flag_spec_RC \ - enable_shared_with_static_runtimes_RC \ - old_archive_cmds_RC \ - old_archive_from_new_cmds_RC \ - predep_objects_RC \ - postdep_objects_RC \ - predeps_RC \ - postdeps_RC \ - compiler_lib_search_path_RC \ - archive_cmds_RC \ - archive_expsym_cmds_RC \ - postinstall_cmds_RC \ - postuninstall_cmds_RC \ - old_archive_from_expsyms_cmds_RC \ - allow_undefined_flag_RC \ - no_undefined_flag_RC \ - export_symbols_cmds_RC \ - hardcode_libdir_flag_spec_RC \ - hardcode_libdir_flag_spec_ld_RC \ - hardcode_libdir_separator_RC \ - hardcode_automatic_RC \ - module_cmds_RC \ - module_expsym_cmds_RC \ - lt_cv_prog_compiler_c_o_RC \ - exclude_expsyms_RC \ - include_expsyms_RC; do - - case $var in - old_archive_cmds_RC | \ - old_archive_from_new_cmds_RC | \ - archive_cmds_RC | \ - archive_expsym_cmds_RC | \ - module_cmds_RC | \ - module_expsym_cmds_RC | \ - old_archive_from_expsyms_cmds_RC | \ - export_symbols_cmds_RC | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_RC - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_RC - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_RC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_RC - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_RC - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_RC -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_RC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_RC -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_RC -archive_expsym_cmds=$lt_archive_expsym_cmds_RC -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_RC -module_expsym_cmds=$lt_module_expsym_cmds_RC - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_RC - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_RC - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_RC - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_RC - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_RC - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_RC - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_RC - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_RC - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_RC - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_RC - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_RC - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_RC" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_RC - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_RC - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_RC - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_RC - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi 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 - -CC="$lt_save_CC" - - ;; - - *) - { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 -echo "$as_me: error: Unsupported tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 -echo "$as_me: error: unable to update list of available tagged configurations." >&2;} - { (exit 1); exit 1; }; } - fi -fi @@ -19496,24 +8331,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion - - - - - - - - - - - - - - - - - - # Enable large file support. # Check whether --enable-largefile or --disable-largefile was given. @@ -22986,13 +11803,6 @@ 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 -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -23605,23 +12415,11 @@ 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,@EGREP@,$EGREP,;t t s,@ECHO@,$ECHO,;t t -s,@AR@,$AR,;t t -s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;t t -s,@ac_ct_CXX@,$ac_ct_CXX,;t t -s,@CXXDEPMODE@,$CXXDEPMODE,;t t -s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t -s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t -s,@CXXCPP@,$CXXCPP,;t t -s,@F77@,$F77,;t t -s,@FFLAGS@,$FFLAGS,;t t -s,@ac_ct_F77@,$ac_ct_F77,;t t +s,@EGREP@,$EGREP,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t diff --git a/depcomp b/depcomp index ffcd540c..11e2d3bf 100755 --- a/depcomp +++ b/depcomp @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2005-02-09.22 +scriptversion=2004-05-31.23 -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004 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 @@ -50,11 +50,11 @@ Environment variables: Report bugs to . EOF - exit $? + exit 0 ;; -v | --v*) echo "depcomp $scriptversion" - exit $? + exit 0 ;; esac @@ -287,43 +287,36 @@ tru64) base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mecanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + # Dependencies are output in .lo.d with libtool 1.4. + # With libtool 1.5 they are output both in $dir.libs/$base.o.d + # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the + # latter, because the former will be cleaned when $dir.libs is + # erased. + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir$base.o.d" + tmpdepfile3="$dir.libs/$base.d" "$@" -Wc,-MD else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + tmpdepfile3="$dir$base.d" "$@" -MD fi stat=$? if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + elif test -f "$tmpdepfile2"; then + tmpdepfile="$tmpdepfile2" + else + tmpdepfile="$tmpdepfile3" + fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. diff --git a/doc/Makefile.in b/doc/Makefile.in index ef73e5d3..8c5f180f 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004 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. @@ -52,7 +52,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -63,10 +62,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -78,8 +73,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -109,18 +102,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/include/Makefile.in b/include/Makefile.in index 33e9cdfd..085ce4ee 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004 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. @@ -61,7 +61,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -72,10 +71,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -87,8 +82,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -118,18 +111,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -218,13 +206,7 @@ uninstall-info-am: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ + @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -236,7 +218,7 @@ $(RECURSIVE_TARGETS): local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ @@ -244,13 +226,7 @@ $(RECURSIVE_TARGETS): mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ + @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ @@ -271,7 +247,7 @@ maintainer-clean-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ diff --git a/include/ntfs/Makefile.am b/include/ntfs/Makefile.am index 21ab13ba..a9de87ec 100644 --- a/include/ntfs/Makefile.am +++ b/include/ntfs/Makefile.am @@ -5,6 +5,7 @@ linux_ntfsinclude_HEADERS = \ attrlist.h \ bitmap.h \ bootsect.h \ + collate.h \ compat.h \ compress.h \ debug.h \ @@ -14,6 +15,7 @@ linux_ntfsinclude_HEADERS = \ endians.h \ gnome-vfs-method.h \ gnome-vfs-module.h \ + index.h \ inode.h \ layout.h \ lcnalloc.h \ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index f6c979a3..8c4138c9 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004 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. @@ -65,7 +65,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -76,10 +75,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -91,8 +86,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -122,18 +115,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -177,6 +165,7 @@ linux_ntfsinclude_HEADERS = \ attrlist.h \ bitmap.h \ bootsect.h \ + collate.h \ compat.h \ compress.h \ debug.h \ @@ -186,6 +175,7 @@ linux_ntfsinclude_HEADERS = \ endians.h \ gnome-vfs-method.h \ gnome-vfs-module.h \ + index.h \ inode.h \ layout.h \ lcnalloc.h \ diff --git a/include/ntfs/collate.h b/include/ntfs/collate.h new file mode 100644 index 00000000..10dae19d --- /dev/null +++ b/include/ntfs/collate.h @@ -0,0 +1,54 @@ +/* + * collate.h - Defines for NTFS kernel collation handling. Part of the + * Linux-NTFS project. + * + * Copyright (c) 2004 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_COLLATE_H +#define _NTFS_COLLATE_H + +#include "types.h" +#include "volume.h" + +#define NTFS_COLLATION_ERROR -2 + +static inline BOOL ntfs_is_collation_rule_supported(COLLATION_RULES cr) { + int i; + + /* + * FIXME: At the moment we only support COLLATION_BINARY, + * COLLATION_NTOFS_ULONG and COLLATION_FILE_NAME so we return false + * for everything else. + */ + if (cr != COLLATION_BINARY && cr != COLLATION_NTOFS_ULONG && + cr != COLLATION_FILE_NAME) + return FALSE; + i = le32_to_cpu(cr); + if (((i >= 0) && (i <= 0x02)) || + ((i >= 0x10) && (i <= 0x13))) + return TRUE; + return FALSE; +} + +extern int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr, + const void *data1, const int data1_len, + const void *data2, const int data2_len); + +#endif /* _NTFS_COLLATE_H */ diff --git a/include/ntfs/index.h b/include/ntfs/index.h new file mode 100644 index 00000000..27fcf719 --- /dev/null +++ b/include/ntfs/index.h @@ -0,0 +1,114 @@ +/* + * index.h - Defines for NTFS index handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2004 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_INDEX_H +#define _NTFS_INDEX_H + +#include "attrib.h" +#include "types.h" +#include "layout.h" +#include "inode.h" +#include "mft.h" + +/** + * @ni: inode containing the @entry described by this context + * @entry: index entry (points into @ir or @ia) + * @data: index entry data (points into @entry) + * @data_len: length in bytes of @data + * @is_in_root: TRUE if @entry is in @ir and FALSE if it is in @ia + * @ir: index root if @is_in_root and NULL otherwise + * @actx: attribute search context if @is_in_root and NULL otherwise + * @ia: index block if @is_in_root is FALSE and NULL otherwise + * @ia_na: opened INDEX_ALLOCATION attribute + * @ia_vcn: VCN from which @ia where read from + * @ia_dirty: TRUE if index block was changed + * @block_size: index block size + * + * @ni is the inode this context belongs to. + * + * @entry is the index entry described by this context. @data and @data_len + * are the index entry data and its length in bytes, respectively. @data + * simply points into @entry. This is probably what the user is interested in. + * + * If @is_in_root is TRUE, @entry is in the index root attribute @ir described + * by the attribute search context @actx and inode @ni. @ia, @ia_vcn and + * @ia_dirty are undifined in this case. + * + * If @is_in_root is FALSE, @entry is in the index allocation attribute and @ia + * and @ia_vcn point to the index allocation block and VCN where it's placed, + * respectively. @ir and @actx are NULL in this case. @ia_na is opened + * INDEX_ALLOCTAION attribute. @ia_dirty is TRUE if index block was changed and + * FALSE otherwise. + * + * To obtain a context call ntfs_index_ctx_get(). + * + * When finished with the @entry and its @data, call ntfs_index_ctx_put() to + * free the context and other associated resources. + * + * If the index entry was modified, call ntfs_index_entry_mark_dirty() before + * the call to ntfs_index_ctx_put() to ensure that the changes are written + * to disk. + */ +typedef struct { + ntfs_inode *ni; + INDEX_ENTRY *entry; + void *data; + u16 data_len; + BOOL is_in_root; + INDEX_ROOT *ir; + ntfs_attr_search_ctx *actx; + INDEX_ALLOCATION *ia; + ntfs_attr *ia_na; + VCN ia_vcn; + BOOL ia_dirty; + u32 block_size; +} ntfs_index_context; + +extern ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *ni); +extern void ntfs_index_ctx_put(ntfs_index_context *ictx); + +extern int ntfs_index_lookup(const void *key, const int key_len, + ntfs_index_context *ictx); + +/** + * ntfs_index_entry_mark_dirty - mark an index entry dirty + * @ictx: ntfs index context describing the index entry + * + * Mark the index entry described by the index entry context @ictx dirty. + * + * If the index entry is in the index root attribute, simply mark the inode + * containing the index root attribute dirty. This ensures the mftrecord, and + * hence the index root attribute, will be written out to disk later. + * + * If the index entry is in an index block belonging to the index allocation + * attribute, set ia_dirty to TRUE, thus index block will be updated during + * ntfs_index_ctx_put. + */ +static inline void ntfs_index_entry_mark_dirty(ntfs_index_context *ictx) +{ + if (ictx->is_in_root) + ntfs_inode_mark_dirty(ictx->actx->ntfs_ino); + else + ictx->ia_dirty = TRUE; +} +#endif /* _NTFS_INDEX_H */ + diff --git a/install-sh b/install-sh index 1a835340..6ebe46de 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2005-02-02.21 +scriptversion=2004-12-17.09 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -109,7 +109,7 @@ while test -n "$1"; do shift continue;; - --help) echo "$usage"; exit $?;; + --help) echo "$usage"; exit 0;; -m) chmodcmd="$chmodprog $2" shift @@ -134,7 +134,7 @@ while test -n "$1"; do shift continue;; - --version) echo "$0 $scriptversion"; exit $?;; + --version) echo "$0 $scriptversion"; exit 0;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 2720cf3f..d88a0d8e 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -38,12 +38,14 @@ libntfs_la_SOURCES = \ attrlist.c \ bitmap.c \ bootsect.c \ + collate.c \ compat.c \ compress.c \ debug.c \ device.c \ device_io.c \ dir.c \ + index.c \ inode.c \ lcnalloc.c \ logfile.c \ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 2aa92a06..ed964069 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004 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. @@ -98,20 +98,20 @@ libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) @ENABLE_GNOME_VFS_TRUE@ $(gnomevfsmoduleslibdir) libntfs_la_LIBADD = am_libntfs_la_OBJECTS = attrib.lo attrlist.lo bitmap.lo bootsect.lo \ - compat.lo compress.lo debug.lo device.lo device_io.lo dir.lo \ - inode.lo lcnalloc.lo logfile.lo mft.lo mst.lo runlist.lo \ - security.lo unistr.lo volume.lo + collate.lo compat.lo compress.lo debug.lo device.lo \ + device_io.lo dir.lo index.lo inode.lo lcnalloc.lo logfile.lo \ + mft.lo mst.lo runlist.lo security.lo unistr.lo volume.lo libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) @@ -127,7 +127,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -138,10 +137,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -153,8 +148,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -184,18 +177,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -243,12 +231,14 @@ libntfs_la_SOURCES = \ attrlist.c \ bitmap.c \ bootsect.c \ + collate.c \ compat.c \ compress.c \ debug.c \ device.c \ device_io.c \ dir.c \ + index.c \ inode.c \ lcnalloc.c \ logfile.c \ @@ -380,12 +370,14 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attrlist.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bootsect.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compress.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/index.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lcnalloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo@am__quote@ @@ -420,18 +412,18 @@ distclean-compile: @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c mostlyclean-libtool: -rm -f *.lo diff --git a/libntfs/collate.c b/libntfs/collate.c new file mode 100644 index 00000000..4da13ef4 --- /dev/null +++ b/libntfs/collate.c @@ -0,0 +1,156 @@ +/* + * collate.c - NTFS kernel collation handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2004 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "collate.h" +#include "debug.h" +#include "unistr.h" + +static int ntfs_collate_binary(ntfs_volume *vol, + const void *data1, const int data1_len, + const void *data2, const int data2_len) +{ + int rc; + + ntfs_debug("Entering."); + rc = memcmp(data1, data2, min(data1_len, data2_len)); + if (!rc && (data1_len != data2_len)) { + if (data1_len < data2_len) + rc = -1; + else + rc = 1; + } + ntfs_debug("Done, returning %i.", rc); + return rc; +} + +static int ntfs_collate_ntofs_ulong(ntfs_volume *vol, + const void *data1, const int data1_len, + const void *data2, const int data2_len) +{ + int rc; + u32 d1, d2; + + ntfs_debug("Entering."); + if (data1_len != data2_len || data1_len != 4) { + ntfs_error("data1_len or/and data2_len not equal to 4."); + return NTFS_COLLATION_ERROR; + } + d1 = le32_to_cpup(data1); + d2 = le32_to_cpup(data2); + if (d1 < d2) + rc = -1; + else { + if (d1 == d2) + rc = 0; + else + rc = 1; + } + ntfs_debug("Done, returning %i.", rc); + return rc; +} + +static int ntfs_collate_file_name(ntfs_volume *vol, + const void *data1, const int data1_len, + const void *data2, const int data2_len) { + int rc; + FILE_NAME_ATTR *fn1, *fn2; + + ntfs_debug("Entering."); + fn1 = (FILE_NAME_ATTR *)data1; + fn2 = (FILE_NAME_ATTR *)data2; + rc = ntfs_names_collate(fn1->file_name, fn1->file_name_length, + fn2->file_name, fn2->file_name_length, + NTFS_COLLATION_ERROR, CASE_SENSITIVE, vol->upcase, + vol->upcase_len); + ntfs_debug("Done, returning %i.", rc); + return rc; + +} + +typedef int (*ntfs_collate_func_t)(ntfs_volume *, const void *, const int, + const void *, const int); + +static ntfs_collate_func_t ntfs_do_collate0x0[3] = { + ntfs_collate_binary, + ntfs_collate_file_name, + NULL/*ntfs_collate_unicode_string*/, +}; + +static ntfs_collate_func_t ntfs_do_collate0x1[4] = { + ntfs_collate_ntofs_ulong, + NULL/*ntfs_collate_ntofs_sid*/, + NULL/*ntfs_collate_ntofs_security_hash*/, + NULL/*ntfs_collate_ntofs_ulongs*/, +}; + +/** + * ntfs_collate - collate two data items using a specified collation rule + * @vol: ntfs volume to which the data items belong + * @cr: collation rule to use when comparing the items + * @data1: first data item to collate + * @data1_len: length in bytes of @data1 + * @data2: second data item to collate + * @data2_len: length in bytes of @data2 + * + * Collate the two data items @data1 and @data2 using the collation rule @cr + * and return -1, 0, ir 1 if @data1 is found, respectively, to collate before, + * to match, or to collate after @data2. + * + * For speed we use the collation rule @cr as an index into two tables of + * function pointers to call the appropriate collation function. + * + * Return NTFS_COLLATION_ERROR if error occured. + */ +int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr, + const void *data1, const int data1_len, + const void *data2, const int data2_len) { + int i; + + ntfs_debug("Entering."); + if (!vol || !data1 || !data2 || data1_len < 0 || data2_len < 0) { + ntfs_error("Invalid arguments passed."); + return NTFS_COLLATION_ERROR; + } + /* + * FIXME: At the moment we only support COLLATION_BINARY, + * COLLATION_NTOFS_ULONG and COLLATION_FILE_NAME so we return error + * for everything else. + */ + if (cr != COLLATION_BINARY && cr != COLLATION_NTOFS_ULONG && + cr != COLLATION_FILE_NAME) + goto err; + i = le32_to_cpu(cr); + if (i < 0) + goto err; + if (i <= 0x02) + return ntfs_do_collate0x0[i](vol, data1, data1_len, + data2, data2_len); + if (i < 0x10) + goto err; + i -= 0x10; + if (i <= 3) + return ntfs_do_collate0x1[i](vol, data1, data1_len, + data2, data2_len); +err: + ntfs_error("Unknown collation rule."); + return NTFS_COLLATION_ERROR; +} diff --git a/libntfs/index.c b/libntfs/index.c new file mode 100644 index 00000000..7d6e0c55 --- /dev/null +++ b/libntfs/index.c @@ -0,0 +1,410 @@ +/* + * index.c - NTFS index handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2004 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "attrib.h" +#include "collate.h" +#include "debug.h" +#include "index.h" + +/** + * ntfs_index_ctx_get - allocate and initialize a new index context + * @idx_ni: ntfs inode with which to initialize the context + * + * Allocate a new index context, initialize it with @ni and return it. + * Return NULL if allocation failed. + */ +ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *ni) +{ + ntfs_index_context *ictx; + + if (!ni) { + errno = EINVAL; + return NULL; + } + if (ni->nr_extents == -1) + ni = ni->base_ni; + ictx = malloc(sizeof(ntfs_index_context)); + if (ictx) + *ictx = (ntfs_index_context) { + .ni = ni, + .ia_dirty = FALSE, + }; + return ictx; +} + +/** + * ntfs_index_ctx_put - release an index context + * @ictx: index context to free + * + * Release the index context @ictx, releasing all associated resources. + */ +void ntfs_index_ctx_put(ntfs_index_context *ictx) +{ + if (ictx->entry) { + if (ictx->is_in_root) { + if (ictx->actx) + ntfs_attr_put_search_ctx(ictx->actx); + } else { + /* Write out index block it it's dirty. */ + if (ictx->ia_dirty) + if (ntfs_attr_pwrite(ictx->ia_na, + ictx->ia_vcn << + ictx->ni->vol->cluster_size, + ictx->block_size, ictx->ia) != + ictx->block_size) + ntfs_error(, "Failed to write out " + "index block."); + /* Free resources. */ + free(ictx->ia); + ntfs_attr_close(ictx->ia_na); + } + } + free(ictx); + return; +} + +/** + * ntfs_index_lookup - find a key in an index and return its index entry + * @key: [IN] key for which to search in the index + * @key_len: [IN] length of @key in bytes + * @ictx: [IN/OUT] context describing the index and the returned entry + * + * Before calling ntfs_index_lookup(), @ictx must have been obtained from a + * call to ntfs_index_ctx_get(). + * + * Look for the @key in the index specified by the index lookup context @ictx. + * ntfs_index_lookup() walks the contents of the index looking for the @key. + * + * If the @key is found in the index, 0 is returned and @ictx is setup to + * describe the index entry containing the matching @key. @ictx->entry is the + * index entry and @ictx->data and @ictx->data_len are the index entry data and + * its length in bytes, respectively. + * + * If the @key is not found in the index, -1 is returned, errno = ENOENT and + * @ictx is setup to describe the index entry whose key collates immediately + * after the search @key, i.e. this is the position in the index at which + * an index entry with a key of @key would need to be inserted. + * + * If an error occurs return -1, set errno to error code and @ictx is left + * untouched. + * + * When finished with the entry and its data, call ntfs_index_ctx_put() to free + * the context and other associated resources. + * + * If the index entry was modified, call ntfs_index_entry_mark_dirty() before + * the call to ntfs_index_ctx_put() to ensure that the changes are written + * to disk. + */ +int ntfs_index_lookup(const void *key, const int key_len, + ntfs_index_context *ictx) +{ + COLLATION_RULES cr; + VCN vcn; + ntfs_inode *ni = ictx->ni; + ntfs_volume *vol = ni->vol; + INDEX_ROOT *ir; + INDEX_ENTRY *ie; + INDEX_ALLOCATION *ia = NULL; + u8 *index_end; + ntfs_attr_search_ctx *actx; + ntfs_attr *na = NULL; + int rc, err = 0; + + ntfs_debug("Entering."); + if (!key || key_len <= 0) { + errno = EINVAL; + return -1; + } + + actx = ntfs_attr_get_search_ctx(ni, NULL); + if (!actx) { + err = ENOMEM; + goto err_out; + } + + /* Find the index root attribute in the mft record. */ + err = ntfs_attr_lookup(AT_INDEX_ROOT, NULL, 0, + CASE_SENSITIVE, 0, NULL, 0, actx); + if (err) { + if (errno == ENOENT) { + ntfs_error(sb, "Index root attribute missing in inode " + "0x%lx.", ni->mft_no); + err = EIO; + } else + err = errno; + goto err_out; + } + /* Get to the index root value (it has been verified in read_inode). */ + ir = (INDEX_ROOT*)((u8*)actx->attr + + le16_to_cpu(actx->attr->value_offset)); + index_end = (u8*)&ir->index + le32_to_cpu(ir->index.index_length); + /* Save index block size for future use. */ + ictx->block_size = ir->index_block_size; + /* Get collation rule type and validate it. */ + cr = ir->collation_rule; + if (!ntfs_is_collation_rule_supported(cr)) { + ntfs_error(sb, "Index uses unsupported collation rule 0x%x. " + "Aborting lookup.", le32_to_cpu(cr)); + err = EOPNOTSUPP; + goto err_out; + } + /* The first index entry. */ + ie = (INDEX_ENTRY*)((u8*)&ir->index + + le32_to_cpu(ir->index.entries_offset)); + /* + * Loop until we exceed valid memory (corruption case) or until we + * reach the last entry. + */ + for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { + /* Bounds checks. */ + if ((u8*)ie < (u8*)actx->mrec || (u8*)ie + + sizeof(INDEX_ENTRY_HEADER) > index_end || + (u8*)ie + le16_to_cpu(ie->length) > index_end) + goto idx_err_out; + /* + * The last entry cannot contain a key. It can however contain + * a pointer to a child node in the B+tree so we just break out. + */ + if (ie->flags & INDEX_ENTRY_END) + break; + /* Further bounds checks. */ + if ((u32)sizeof(INDEX_ENTRY_HEADER) + + le16_to_cpu(ie->key_length) > + le16_to_cpu(ie->data_offset) || + (u32)le16_to_cpu(ie->data_offset) + + le16_to_cpu(ie->data_length) > + le16_to_cpu(ie->length)) + goto idx_err_out; + /* If the keys match perfectly, we setup @ictx and return 0. */ + if ((key_len == le16_to_cpu(ie->key_length)) && !memcmp(key, + &ie->key, key_len)) { +ir_done: + ictx->is_in_root = TRUE; + ictx->actx = actx; + ictx->ia = NULL; +done: + ictx->entry = ie; + ictx->data = (u8*)ie + + le16_to_cpu(ie->data_offset); + ictx->data_len = le16_to_cpu(ie->data_length); + ntfs_debug("Done."); + if (err) { + errno = err; + return -1; + } + return 0; + } + /* + * Not a perfect match, need to do full blown collation so we + * know which way in the B+tree we have to go. + */ + rc = ntfs_collate(vol, cr, key, key_len, &ie->key, + le16_to_cpu(ie->key_length)); + /* + * If @key collates before the key of the current entry, there + * is definitely no such key in this index but we might need to + * descend into the B+tree so we just break out of the loop. + */ + if (rc == -1) + break; + /* + * A match should never happen as the memcmp() call should have + * cought it, but we still treat it correctly. + */ + if (!rc) + goto ir_done; + /* The keys are not equal, continue the search. */ + } + /* + * We have finished with this index without success. Check for the + * presence of a child node and if not present setup @ictx and return + * -1 with errno ENOENT. + */ + if (!(ie->flags & INDEX_ENTRY_NODE)) { + ntfs_debug("Entry not found."); + err = ENOENT; + goto ir_done; + } /* Child node present, descend into it. */ + /* Get the starting vcn of the index_block holding the child node. */ + vcn = sle64_to_cpup((sle64*)((u8*)ie + le16_to_cpu(ie->length) - 8)); + /* We are done with the index root. Release attribute search ctx. */ + ntfs_attr_put_search_ctx(actx); + actx = NULL; + /* Open INDEX_ALLOCATION. */ + na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, AT_UNNAMED, 0); + if (!na) { + ntfs_error(sb, "No index allocation attribute but index entry " + "requires one. Inode 0x%lx is corrupt or " + "library bug.", ni->mft_no); + goto err_out; + } + /* Allocate memory to store index block. */ + ia = malloc(ictx->block_size); + if (!ia) { + ntfs_error(, "Not enough memory to allocate buffer for index" + " allocation."); + err = ENOMEM; + goto err_out; + } +descend_into_child_node: + /* Read index allocation block. */ + if (ntfs_attr_pread(na, vcn << vol->cluster_size_bits, ictx->block_size, + ia) != ictx->block_size) { + ntfs_error(, "Failed to read index allocation."); + goto err_out; + } + /* Catch multi sector transfer fixup errors. */ + if (!ntfs_is_indx_record(ia->magic)) { + ntfs_error(sb, "Index record with vcn 0x%llx is corrupt. " + "Corrupt inode 0x%lx. Run chkdsk.", + (long long)vcn, ni->mft_no); + goto err_out; + } + if (sle64_to_cpu(ia->index_block_vcn) != vcn) { + ntfs_error(sb, "Actual VCN (0x%llx) of index buffer is " + "different from expected VCN (0x%llx). Inode " + "0x%lx is corrupt or driver bug.", + (unsigned long long) + sle64_to_cpu(ia->index_block_vcn), + (unsigned long long)vcn, ni->mft_no); + goto err_out; + } + if (le32_to_cpu(ia->index.allocated_size) + 0x18 != ictx->block_size) { + ntfs_error(sb, "Index buffer (VCN 0x%llx) of inode 0x%lx has " + "a size (%u) differing from the index " + "specified size (%u). Inode is corrupt or " + "driver bug.", (unsigned long long)vcn, + ni->mft_no, + le32_to_cpu(ia->index.allocated_size) + 0x18, + ictx->block_size); + goto err_out; + } + index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); + if (index_end > (u8*)ia + ictx->block_size) { + ntfs_error(sb, "Size of index buffer (VCN 0x%llx) of inode " + "0x%lx exceeds maximum size.", + (unsigned long long)vcn, idx_ni->mft_no); + goto err_out; + } + /* The first index entry. */ + ie = (INDEX_ENTRY*)((u8*)&ia->index + + le32_to_cpu(ia->index.entries_offset)); + /* + * Iterate similar to above big loop but applied to index buffer, thus + * loop until we exceed valid memory (corruption case) or until we + * reach the last entry. + */ + for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { + /* Bounds checks. */ + if ((u8*)ie < (u8*)ia || (u8*)ie + + sizeof(INDEX_ENTRY_HEADER) > index_end || + (u8*)ie + le16_to_cpu(ie->length) > index_end) { + ntfs_error(sb, "Index entry out of bounds in inode " + "0x%lx.", ni->mft_no); + goto err_out; + } + /* + * The last entry cannot contain a key. It can however contain + * a pointer to a child node in the B+tree so we just break out. + */ + if (ie->flags & INDEX_ENTRY_END) + break; + /* Further bounds checks. */ + if ((u32)sizeof(INDEX_ENTRY_HEADER) + + le16_to_cpu(ie->key_length) > + le16_to_cpu(ie->data_offset) || + (u32)le16_to_cpu(ie->data_offset) + + le16_to_cpu(ie->data_length) > + le16_to_cpu(ie->length)) { + ntfs_error(sb, "Index entry out of bounds in inode " + "0x%lx.", ni->mft_no); + goto err_out; + } + /* If the keys match perfectly, we setup @ictx and return 0. */ + if ((key_len == le16_to_cpu(ie->key_length)) && !memcmp(key, + &ie->key, key_len)) { +ia_done: + ictx->is_in_root = FALSE; + ictx->actx = NULL; + ictx->ia = ia; + ictx->ia_vcn = vcn; + ictx->ia_na = na; + goto done; + } + /* + * Not a perfect match, need to do full blown collation so we + * know which way in the B+tree we have to go. + */ + rc = ntfs_collate(vol, cr, key, key_len, &ie->key, + le16_to_cpu(ie->key_length)); + /* + * If @key collates before the key of the current entry, there + * is definitely no such key in this index but we might need to + * descend into the B+tree so we just break out of the loop. + */ + if (rc == -1) + break; + /* + * A match should never happen as the memcmp() call should have + * cought it, but we still treat it correctly. + */ + if (!rc) + goto ia_done; + /* The keys are not equal, continue the search. */ + } + /* + * We have finished with this index buffer without success. Check for + * the presence of a child node and if not present return ENOENT. + */ + if (!(ie->flags & INDEX_ENTRY_NODE)) { + ntfs_debug("Entry not found."); + err = ENOENT; + goto ia_done; + } + if ((ia->index.flags & NODE_MASK) == LEAF_NODE) { + ntfs_error(sb, "Index entry with child node found in a leaf " + "node in inode 0x%lx.", idx_ni->mft_no); + goto err_out; + } + /* Child node present, descend into it. */ + vcn = sle64_to_cpup((sle64*)((u8*)ie + le16_to_cpu(ie->length) - 8)); + if (vcn >= 0) + goto descend_into_child_node; + ntfs_error(sb, "Negative child node vcn in inode 0x%lx.", ni->mft_no); +err_out: + if (na) + ntfs_attr_close(na); + if (ia) + free(ia); + if (!err) + err = EIO; + if (actx) + ntfs_attr_put_search_ctx(actx); + errno = err; + return -1; +idx_err_out: + ntfs_error(sb, "Corrupt index. Aborting lookup."); + goto err_out; +} + diff --git a/ltmain.sh b/ltmain.sh index 3d071010..239bdefb 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -24,34 +24,6 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -basename="s,^.*/,,g" - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - -# The name of this program: -progname=`echo "$progpath" | $SED $basename` -modename="$progname" - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.5.14 -TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes. -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. @@ -64,7 +36,7 @@ elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : else # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} + exec $SHELL "$0" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then @@ -73,9 +45,22 @@ if test "X$1" = X--fallback-echo; then cat <&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 fi # Global variables. @@ -132,250 +116,9 @@ show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" -quote_scanset='[[~#^*{};<>?'"'"' ]' - -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -func_win32_libid () -{ - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $echo $win32_libid_type -} - - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case "$@ " in - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit $EXIT_FAILURE -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi -} - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` - - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" - $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" - $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ - | $EGREP -v '^[ ]*1[ ]' | while read count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? - i=`expr $i + 1` - done - done - $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" - fi -} - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - my_status="" - - $show "${rm}r $my_gentop" - $run ${rm}r "$my_gentop" - $show "$mkdir $my_gentop" - $run $mkdir "$my_gentop" - my_status=$? - if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then - exit $my_status - fi - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` - my_xdir="$my_gentop/$my_xlib" - - $show "${rm}r $my_xdir" - $run ${rm}r "$my_xdir" - $show "$mkdir $my_xdir" - $run $mkdir "$my_xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$my_xdir"; then - exit $status - fi - case $host in - *-darwin*) - $show "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - if test -z "$run"; then - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` - darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` - if test -n "$darwin_arches"; then - darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - $show "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we have a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` - lipo -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - ${rm}r unfat-$$ - cd "$darwin_orig_dir" - else - cd "$darwin_orig_dir" - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - fi # $run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - func_extract_archives_result="$my_oldobjs" -} -# End of Shell function definitions -##################################### - -# Darwin sucks -eval std_shrext=\"$shrext_cmds\" # Parse our command line options once, thoroughly. -while test "$#" -gt 0 +while test $# -gt 0 do arg="$1" shift @@ -391,34 +134,6 @@ do execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; - tag) - tagname="$arg" - preserve_args="${preserve_args}=$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac - ;; *) eval "$prev=\$arg" ;; @@ -436,27 +151,18 @@ do ;; --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2005 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit $? + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 ;; --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" - done - exit $? + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + exit 0 ;; --debug) - $echo "$progname: enabling shell trace mode" + echo "$progname: enabling shell trace mode" set -x - preserve_args="$preserve_args $arg" ;; --dry-run | -n) @@ -464,18 +170,18 @@ do ;; --features) - $echo "host: $host" + echo "host: $host" if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" + echo "enable shared libraries" else - $echo "disable shared libraries" + echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - $echo "enable static libraries" + echo "enable static libraries" else - $echo "disable static libraries" + echo "disable static libraries" fi - exit $? + exit 0 ;; --finish) mode="finish" ;; @@ -487,15 +193,6 @@ do --quiet | --silent) show=: - preserve_args="$preserve_args $arg" - ;; - - --tag) prevopt="--tag" prev=tag ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - preserve_args="$preserve_args --tag" ;; -dlopen) @@ -506,7 +203,7 @@ do -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; *) @@ -519,7 +216,18 @@ done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 +fi + +# Mandrake: (gc) It's bad to link C++ code with GCC, so we need to use the compiler name if provided +if test "$mode" = link && test -n "$archive_cmds" && test -x "/usr/bin/perl"; then + case $nonopt in + *cc | *++ | gcc* | *-gcc* | egcs*) + archive_cmds=`echo $archive_cmds | perl -pe 's/^\S+\s+//'` + archive_cmds="$nonopt $archive_cmds" + archive_expsym_cmds=`echo $archive_expsym_cmds | perl -pe 's/^\S+\s+//'` + archive_expsym_cmds="$nonopt $archive_expsym_cmds" + esac fi # If this variable is set in any of the actions, the command in it @@ -531,10 +239,8 @@ if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + *cc | *++ | gcc* | *-gcc* | xlc*) mode=link for arg do @@ -575,7 +281,7 @@ if test -z "$show_help"; then if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Change the help message to a mode-specific one. @@ -589,157 +295,50 @@ if test -z "$show_help"; then modename="$modename: compile" # Get the compilation command and the source file. base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes + prev= + lastarg= + srcfile="$nonopt" suppress_output= - arg_mode=normal - libobj= - later= + user_target=no for arg do - case "$arg_mode" in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. case $arg in - -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit $EXIT_FAILURE - fi - arg_mode=target - continue + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" ;; + esac - -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else base_compile="$base_compile $lastarg" - continue - ;; - - * ) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, and some SunOS ksh mistreat backslash-escaping - # in scan sets (worked around with variable expansion), - # and furthermore cannot handle '|' '&' '(' ')' in scan sets - # at all, so we specify them separately. - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - lastarg="\"$lastarg\"" + fi + continue ;; esac - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit $EXIT_FAILURE - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit $EXIT_FAILURE - ;; - *) - # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do + # Accept any command-line options. case $arg in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + -static) build_old_libs=yes continue @@ -754,33 +353,138 @@ if test -z "$show_help"; then pic_mode=no continue ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; esac + + case $user_target in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi done - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi - lobj=${xdir}$objdir/$objname + case $user_target in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" + removelist="$obj $libobj" else - removelist="$lobj $libobj ${libobj}T" + removelist="$libobj" fi $run $rm $removelist - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + trap "$run $rm $removelist; exit 1" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in @@ -799,9 +503,8 @@ if test -z "$show_help"; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 + trap "$run $rm $removelist; exit 1" 1 2 15 else - output_obj= need_locks=no lockfile= fi @@ -809,13 +512,13 @@ if test -z "$show_help"; then # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then - until $run ln "$progpath" "$lockfile" 2>/dev/null; do + until $run ln "$0" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then - $echo "\ + echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` @@ -827,67 +530,68 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit $EXIT_FAILURE + exit 1 fi - $echo $srcfile > "$lockfile" + echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -902,13 +606,13 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit $EXIT_FAILURE + exit 1 fi # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : else error=$? $run $rm $removelist @@ -916,23 +620,48 @@ compiler." fi fi - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -974,11 +705,11 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit $EXIT_FAILURE + exit 1 fi # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + if test x"$output_obj" != x"$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else @@ -988,31 +719,29 @@ compiler." fi fi - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T < $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi fi - $run $mv "${libobj}T" "${libobj}" - # Unlock the critical section if it was locked if test "$need_locks" != no; then $run $rm "$lockfile" fi - exit $EXIT_SUCCESS + exit 0 ;; # libtool link mode @@ -1023,7 +752,7 @@ EOF # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. + # flag for every libtool invokation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying @@ -1038,7 +767,6 @@ EOF ;; esac libtool_args="$nonopt" - base_compile="$nonopt $@" compile_command="$nonopt" finalize_command="$nonopt" @@ -1069,8 +797,6 @@ EOF module=no no_install=no objs= - non_pic_objects= - precious_files_regex= prefer_static_libs=no preload=no prev= @@ -1082,9 +808,6 @@ EOF temp_rpath= thread_safe=no vinfo= - vinfo_number=no - - func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg @@ -1115,11 +838,11 @@ EOF test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do + while test $# -gt 0; do arg="$1" shift case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; @@ -1180,7 +903,7 @@ EOF export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" - exit $EXIT_FAILURE + exit 1 fi prev= continue @@ -1190,135 +913,23 @@ EOF prev= continue ;; - inst_prefix) + inst_prefix) inst_prefix_dir="$arg" prev= continue ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; release) release="-$arg" prev= continue ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat $save_arg` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - done - else - $echo "$modename: link input file \`$save_arg' does not exist" - exit $EXIT_FAILURE - fi - arg=$save_arg - prev= - continue - ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac if test "$prev" = rpath; then @@ -1350,31 +961,13 @@ EOF finalize_command="$finalize_command $wl$qarg" continue ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - darwin_framework) - compiler_flags="$compiler_flags $arg" - prev= - continue - ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac - fi # test -n "$prev" + fi # test -n $prev prevarg="$arg" @@ -1416,7 +1009,7 @@ EOF -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" - exit $EXIT_FAILURE + exit 1 fi if test "X$arg" = "X-export-symbols"; then prev=expsyms @@ -1426,12 +1019,6 @@ EOF continue ;; - -framework) - prev=darwin_framework - compiler_flags="$compiler_flags $arg" - continue - ;; - -inst-prefix-dir) prev=inst_prefix continue @@ -1441,7 +1028,7 @@ EOF # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) + no/*-*-irix* | no/*-*-nonstopux*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; @@ -1458,7 +1045,7 @@ EOF absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi dir="$absdir" ;; @@ -1492,78 +1079,28 @@ EOF # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs -framework System" - continue esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac fi deplibs="$deplibs $arg" continue ;; - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - -model) - compile_command="$compile_command $arg" - compiler_flags="$compiler_flags $arg" - finalize_command="$finalize_command $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - continue - ;; - -module) module=yes continue ;; - # -64, -mips[0-9] enable 64-bit mode on the SGI compiler - # -r[0-9][0-9]* specifies the processor on the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler - # +DA*, +DD* enable 64-bit mode on the HP compiler - # -q* pass through compiler args for the IBM compiler - # -m* pass through architecture-specific compiler args for GCC - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*) - - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi - continue - ;; - - -shrext) - prev=shrext - continue - ;; - -no-fast-install) fast_install=no continue @@ -1588,18 +1125,8 @@ EOF continue ;; - -objectlist) - prev=objectlist - continue - ;; - -o) prev=output ;; - -precious-files-regex) - prev=precious_regex - continue - ;; - -release) prev=release continue @@ -1622,7 +1149,7 @@ EOF [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac case "$xrpath " in @@ -1650,11 +1177,6 @@ EOF prev=vinfo continue ;; - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` @@ -1663,7 +1185,7 @@ EOF for flag in $args; do IFS="$save_ifs" case $flag in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac @@ -1681,7 +1203,7 @@ EOF for flag in $args; do IFS="$save_ifs" case $flag in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") flag="\"$flag\"" ;; esac @@ -1703,119 +1225,42 @@ EOF continue ;; - -XCClinker) - prev=xcclinker - continue - ;; - # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac ;; - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + prev= + continue else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles fi fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + fi ;; *.$libext) @@ -1848,7 +1293,7 @@ EOF # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") arg="\"$arg\"" ;; esac @@ -1865,7 +1310,7 @@ EOF if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then @@ -1874,7 +1319,6 @@ EOF finalize_command="$finalize_command $arg" fi - oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" @@ -1895,11 +1339,11 @@ EOF output_objdir="$output_objdir/$objdir" fi # Create the object directory. - if test ! -d "$output_objdir"; then + if test ! -d $output_objdir; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then + if test $status -ne 0 && test ! -d $output_objdir; then exit $status fi fi @@ -1909,7 +1353,7 @@ EOF "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; @@ -1917,17 +1361,7 @@ EOF *) linkmode=prog ;; # Anything else should be a program. esac - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplications in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - esac specialdeplibs= - libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) @@ -1939,25 +1373,6 @@ EOF fi libs="$libs $deplib" done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - deplibs= newdependency_libs= newlib_search_path= @@ -1972,7 +1387,7 @@ EOF *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac done @@ -1989,55 +1404,39 @@ EOF ;; esac for pass in $passes; do - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then + if test $linkmode = prog; then + # Determine which files to process case $pass in - dlopen) libs="$dlfiles" ;; + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi for deplib in $libs; do lib= found=no case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - compiler_flags="$compiler_flags $deplib" - fi - continue - ;; -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + if test $linkmode = oldlib && test $linkmode = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 + continue + fi + if test $pass = conv; then + deplibs="$deplib $deplibs" continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi done if test "$found" != yes; then # deplib doesn't seem to be a libtool library @@ -2046,76 +1445,40 @@ EOF finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" fi continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - library_names= - old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" - test "$pass" = conv && continue + test $pass = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi - if test "$pass" = scan; then + if test $pass = scan; then deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 ;; esac # linkmode continue ;; # -L -R*) - if test "$pass" = link; then + if test $pass = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in @@ -2128,45 +1491,30 @@ EOF ;; *.la) lib="$deplib" ;; *.$libext) - if test "$pass" = conv; then + if test $pass = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - if eval $echo \"$deplib\" 2>/dev/null \ - | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - $echo - $echo "*** Warning: Trying to link with static lib archive $deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because the file extensions .$libext of this argument makes me believe" - $echo "*** that it is just a static archive that I should not used here." + if test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not used here." else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) - if test "$pass" != link; then + if test $pass != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -2177,18 +1525,14 @@ EOF esac # linkmode ;; # *.$libext *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi + if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" fi continue ;; @@ -2197,17 +1541,17 @@ EOF continue ;; esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : + if test $found = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` @@ -2220,11 +1564,8 @@ EOF library_names= old_library= # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink + # it will not redefine variable installed. installed=yes - shouldnotlink=no - avoidtemprpath= - # Read the .la file case $lib in @@ -2234,18 +1575,19 @@ EOF if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then + { test $linkmode = oldlib && test $linkmode = obj; }; then + # Add dl[pre]opened files of deplib test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi - if test "$pass" = conv; then + if test $pass = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" @@ -2260,14 +1602,13 @@ EOF fi tmp_libs="$tmp_libs $deplib" done - elif test "$linkmode" != prog && test "$linkmode" != lib; then + elif test $linkmode != prog && test $linkmode != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit $EXIT_FAILURE + exit 1 fi continue fi # $pass = conv - # Get the name of the library we link against. linklib= for l in $old_library $library_names; do @@ -2275,23 +1616,19 @@ EOF done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # This library was specified with -dlopen. - if test "$pass" = dlopen; then + if test $pass = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" + # statically, we need to preload. + dlprefiles="$dlprefiles $lib" else newdlfiles="$newdlfiles $lib" fi @@ -2323,27 +1660,19 @@ EOF dir="$libdir" absdir="$libdir" fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then + if test $pass = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). @@ -2359,19 +1688,18 @@ EOF if test -z "$libdir"; then # Link the convenience library - if test "$linkmode" = lib; then + if test $linkmode = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else - deplibs="$lib $deplibs" # used for prog,scan pass + deplibs="$lib $deplibs" fi continue fi - - if test "$linkmode" = prog && test "$pass" != link; then + if test $linkmode = prog && test $pass != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" @@ -2387,7 +1715,7 @@ EOF -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then + if test $linkalldeplibs = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths @@ -2404,19 +1732,13 @@ EOF continue fi # $linkmode = prog... - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # Link against this shared library + if test "$linkmode,$pass" = "prog,link" || + { test $linkmode = lib && test $hardcode_into_libs = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. @@ -2438,6 +1760,17 @@ EOF esac ;; esac + if test $linkmode = prog; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + fi fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && @@ -2447,52 +1780,11 @@ EOF # We only need to search for static libraries continue fi - fi - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi - # This is a shared library - - # Warn about portability, can't link against -module's on - # some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then - $echo - if test "$linkmode" = prog; then - $echo "*** Warning: Linking the executable $output against the loadable module" - else - $echo "*** Warning: Linking the shared library $output against the loadable module" - fi - $echo "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname @@ -2506,7 +1798,7 @@ EOF elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin* | mingw*) + *cygwin*) major=`expr $current - $age` versuffix="-$major" ;; @@ -2518,18 +1810,17 @@ EOF # Make a new name for the extract_expsyms_cmds to use soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + soname=`echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' - cmds=$extract_expsyms_cmds + eval cmds=\"$extract_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -2540,10 +1831,9 @@ EOF if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' - cmds=$old_archive_from_expsyms_cmds + eval cmds=\"$old_archive_from_expsyms_cmds\" for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -2552,9 +1842,9 @@ EOF # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" + fi # test -n $old_archive_from_expsyms_cmds - if test "$linkmode" = prog || test "$mode" != relink; then + if test $linkmode = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= @@ -2563,22 +1853,6 @@ EOF immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" - case $host in - *-*-sco3.2v5* ) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a module then we can not link against - # it, someone is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then - $echo "** Warning, lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $echo - $echo "** And there doesn't seem to be a static archive available" - $echo "** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - fi - esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; @@ -2597,14 +1871,6 @@ EOF add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" @@ -2618,7 +1884,7 @@ EOF if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" - exit $EXIT_FAILURE + exit 1 fi if test -n "$add_shlibpath"; then @@ -2627,7 +1893,7 @@ EOF *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi - if test "$linkmode" = prog; then + if test $linkmode = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else @@ -2644,8 +1910,9 @@ EOF fi fi - if test "$linkmode" = prog || test "$mode" = relink; then + if test $linkmode = prog || test "$mode" = relink; then add_shlibpath= + add_prefix_dir= add_dir= add= # Finalize command for both is simple: just hardcode it. @@ -2660,36 +1927,43 @@ EOF *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi add="-l$name" fi - if test "$linkmode" = prog; then + + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_prefix_dir="-L$inst_prefix_dir$libdir" + ;; + esac + fi + + # add_prefix_dir must be appended instead, otherwise it can + # possibly be overrided by any hardcoded -L/... path in deplibs + if test $linkmode = prog; then + test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir" test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else + test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir" test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi - elif test "$linkmode" = prog; then + elif test $linkmode = prog; then + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + + # Try to link the static library # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. @@ -2709,21 +1983,21 @@ EOF # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." + echo + echo "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -2740,11 +2014,10 @@ EOF fi fi # link shared/static library? - if test "$linkmode" = lib; then + if test $linkmode = lib; then if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then + { test $hardcode_into_libs != yes || test $build_old_libs = yes || + test $link_static = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do @@ -2775,7 +2048,7 @@ EOF tmp_libs="$tmp_libs $deplib" done - if test "$link_all_deplibs" != no; then + if test $link_all_deplibs != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in @@ -2795,67 +2068,22 @@ EOF ;; esac if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" + path="-L$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi - path="$absdir" + path="-L$absdir" fi - depdepl= - case $host in - *-*-darwin*) - # we do not want to link against static libs, - # but need to link against shared - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$path/$depdepl" ; then - depdepl="$path/$depdepl" - fi - # do not add paths which are already there - case " $newlib_search_path " in - *" $path "*) ;; - *) newlib_search_path="$newlib_search_path $path";; - esac - fi - path="" - ;; - *) - path="-L$path" - ;; - esac - ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac ;; *) continue ;; esac case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; - esac - case " $deplibs " in *" $path "*) ;; *) deplibs="$deplibs $path" ;; esac @@ -2863,15 +2091,15 @@ EOF fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then + if test $pass = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then + if test $pass != dlopen; then + test $pass != scan && dependency_libs="$newdependency_libs" + if test $pass != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do @@ -2893,30 +2121,9 @@ EOF eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) @@ -2944,32 +2151,19 @@ EOF eval $var=\"$tmp_libs\" done # for var fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi done # for pass - if test "$linkmode" = prog; then + if test $linkmode = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi @@ -2983,7 +2177,7 @@ EOF fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 fi if test -n "$release"; then @@ -3005,19 +2199,17 @@ EOF case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` @@ -3028,11 +2220,11 @@ EOF if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit $EXIT_FAILURE + exit 1 else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi @@ -3042,7 +2234,7 @@ EOF fi set dummy $rpath - if test "$#" -gt 2; then + if test $# -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" @@ -3051,16 +2243,14 @@ EOF if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. + libext=al oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then @@ -3076,82 +2266,45 @@ EOF if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$2" - number_minor="$3" - number_revision="$4" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows) - current=`expr $number_major + $number_minor` - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - current=`expr $number_major + $number_minor - 1` - age="$number_minor" - revision="$number_minor" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - esac + current="$2" + revision="$3" + age="$4" # Check that each of the things are valid numbers. case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + [0-9]*) ;; *) $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac - if test "$age" -gt "$current"; then + if test $age -gt $current; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Calculate the version variables. @@ -3168,7 +2321,7 @@ EOF versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` - verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; freebsd-aout) @@ -3192,7 +2345,7 @@ EOF # Add in all the interfaces that we are compatible with. loop=$revision - while test "$loop" -ne 0; do + while test $loop != 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" @@ -3215,7 +2368,7 @@ EOF # Add in all the interfaces that we are compatible with. loop=$age - while test "$loop" -ne 0; do + while test $loop != 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" @@ -3239,19 +2392,20 @@ EOF *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= + verstring="0.0" case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely - verstring= + verstring="" ;; *) verstring="0.0" @@ -3285,30 +2439,9 @@ EOF fi if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$echo "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - removelist="$removelist $p" - ;; - *) ;; - esac - done - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi + # Remove our outputs. + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* fi # Now set the variables for building old libraries. @@ -3321,9 +2454,9 @@ EOF # Eliminate all temporary directories. for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then @@ -3336,7 +2469,7 @@ EOF *) finalize_rpath="$finalize_rpath $libdir" ;; esac done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + if test $hardcode_into_libs != yes || test $build_old_libs = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi @@ -3374,13 +2507,12 @@ EOF *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + *-*-openbsd* | *-*-freebsd*) # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue ;; - *) + *) # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then + if test $build_libtool_need_lc = "yes"; then deplibs="$deplibs -lc" fi ;; @@ -3407,7 +2539,7 @@ EOF # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. + # implementing what was already the behaviour. newdeplibs=$deplibs ;; test_compile) @@ -3420,22 +2552,45 @@ EOF int main() { return 0; } EOF $rm conftest - $LTCC -o conftest conftest.c $deplibs - if test "$?" -eq 0 ; then + $CC -o conftest conftest.c $deplibs + if test $? -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do name="`expr $i : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" -ne "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + echo + echo "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which I believe you do not have" + echo "*** because a test_compile did reveal that the linker did not use it for" + echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occured in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + $rm conftest + $CC -o conftest conftest.c $i + # Did it work? + if test $? -eq 0 ; then + ldd_output=`ldd conftest` libname=`eval \\$echo \"$libname_spec\"` deplib_matches=`eval \\$echo \"$library_names_spec\"` set dummy $deplib_matches @@ -3444,64 +2599,21 @@ EOF newdeplibs="$newdeplibs $i" else droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which I believe you do not have" - $echo "*** because a test_compile did reveal that the linker did not use it for" - $echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occurred in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - $rm conftest - $LTCC -o conftest conftest.c $i - # Did it work? - if test "$?" -eq 0 ; then - ldd_output=`ldd conftest` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $i "*) - newdeplibs="$newdeplibs $i" - i="" - ;; - esac - fi - if test -n "$i" ; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - $echo - $echo "*** Warning: dynamic linker does not accept needed library $i." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because a test_compile did reveal that the linker did not use this one" - $echo "*** as a dynamic dependency that programs can get resolved with at runtime." - fi + echo + echo "*** Warning: dynamic linker does not accept needed library $i." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because a test_compile did reveal that the linker did not use this one" + echo "*** as a dynamic dependency that programs can get resolved with at runtime." fi else droppeddeps=yes - $echo - $echo "*** Warning! Library $i is needed by this library but I was not able to" - $echo "*** make it link in! You will probably need to install it or some" - $echo "*** library that it depends on before this library will be fully" - $echo "*** functional. Installing it before continuing would be even better." + echo + echo "*** Warning! Library $i is needed by this library but I was not able to" + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." fi else newdeplibs="$newdeplibs $i" @@ -3515,20 +2627,11 @@ EOF for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test "$name" != "" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do + if test -n "$name" && test "$name" != "0"; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then @@ -3547,29 +2650,35 @@ EOF *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done + # It is ok to link against an archive when + # building a shared library. + if $AR -t $potlib > /dev/null 2>&1; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then + | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi - done - done - fi + done + done if test -n "$a_deplib" ; then droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" + echo + echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" + echo "*** with $libname but no candidates were found. (...for file magic test)" else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a file magic. Last file checked: $potlib" fi fi else @@ -3585,43 +2694,33 @@ EOF name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval $echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check below in file_magic test + if eval echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | egrep "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi done - fi + done if test -n "$a_deplib" ; then droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" + echo + echo "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + echo "*** with $libname but no candidates were found. (...for regex pattern test)" else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" + echo "*** with $libname and none of the candidates passed a file format test" + echo "*** using a regex pattern. Last file checked: $potlib" fi fi else @@ -3632,23 +2731,16 @@ EOF ;; none | unknown | *) newdeplibs="" - tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` - done - fi - if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ - | grep . >/dev/null; then - $echo + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo if test "X$deplibs_check_method" = "Xnone"; then - $echo "*** Warning: inter-library dependencies are not supported in this platform." + echo "*** Warning: inter-library dependencies are not supported in this platform." else - $echo "*** Warning: inter-library dependencies are not known to be supported." + echo "*** Warning: inter-library dependencies are not known to be supported." fi - $echo "*** All declared inter-library dependencies are being dropped." + echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; @@ -3668,17 +2760,17 @@ EOF if test "$droppeddeps" = yes; then if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -3688,16 +2780,16 @@ EOF build_libtool_libs=no fi else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." - if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." + if test $allow_undefined = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -3719,7 +2811,7 @@ EOF # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then + if test $hardcode_into_libs = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= @@ -3755,11 +2847,7 @@ EOF if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi + eval dep_rpath=\"$hardcode_libdir_flag_spec\" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. @@ -3779,7 +2867,6 @@ EOF fi # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" @@ -3790,9 +2877,7 @@ EOF else soname="$realname" fi - if test -z "$dlname"; then - dlname=$soname - fi + test -z "$dlname" && dlname=$soname lib="$output_objdir/$realname" for link @@ -3800,6 +2885,23 @@ EOF linknames="$linknames $link" done + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -3809,26 +2911,17 @@ EOF $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols - cmds=$export_symbols_cmds + eval cmds=\"$export_symbols_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false - else - # The command line is too long to execute in one step. - $show "using reloadable object file for export list..." - skipped_export=: - fi + $show "$cmd" + $run eval "$cmd" || exit $? done IFS="$save_ifs" if test -n "$export_symbols_regex"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi @@ -3839,30 +2932,46 @@ EOF $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi generated="$generated $gentop" - func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done fi fi - + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" @@ -3874,148 +2983,25 @@ EOF fi # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds + eval cmds=\"$archive_expsym_cmds\" else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise. - $echo "creating reloadable object files..." - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - output_la=`$echo "X$output" | $Xsed -e "$basename"` - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - delfiles= - last_robj= - k=1 - output=$output_objdir/$output_la-${k}.$objext - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - eval test_cmds=\"$reload_cmds $objlist $last_robj\" - if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; }; then - objlist="$objlist $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" - else - # All subsequent reloadable object files will link in - # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + save_deplibs="$deplibs" + for conv in $convenience; do + tmp_deplibs= + for test_deplib in $deplibs; do + if test "$test_deplib" != "$conv"; then + tmp_deplibs="$tmp_deplibs $test_deplib" fi - last_robj=$output_objdir/$output_la-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$output_la-${k}.$objext - objlist=$obj - len=1 - fi + done + deplibs="$tmp_deplibs" done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" - - if ${skipped_export-false}; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - libobjs=$output - # Append the command to create the export file. - eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" - fi - - # Set up a command to remove the reloadable object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" - done - - $echo "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~\$rm $delfiles\" + eval cmds=\"$archive_cmds\" + deplibs="$save_deplibs" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4024,7 +3010,7 @@ EOF # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - exit $EXIT_SUCCESS + exit 0 fi # Create links to the real library. @@ -4072,7 +3058,7 @@ EOF *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit $EXIT_FAILURE + exit 1 fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` @@ -4101,10 +3087,38 @@ EOF eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi generated="$generated $gentop" - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done fi fi @@ -4112,11 +3126,10 @@ EOF reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" - cmds=$reload_cmds + eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4129,7 +3142,7 @@ EOF $run ${rm}r $gentop fi - exit $EXIT_SUCCESS + exit 0 fi if test "$build_libtool_libs" != yes; then @@ -4140,24 +3153,37 @@ EOF # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" - cmds=$reload_cmds + eval cmds=\"$reload_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then @@ -4165,12 +3191,12 @@ EOF $run ${rm}r $gentop fi - exit $EXIT_SUCCESS + exit 0 ;; prog) case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 @@ -4192,19 +3218,16 @@ EOF # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + ;; + esac ;; esac - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - if test "$tagname" = CXX ; then - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - fi - ;; - esac - compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -4355,31 +3378,31 @@ extern \"C\" { done if test -n "$exclude_expsyms"; then - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" + export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else - $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' + name=`echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done @@ -4388,7 +3411,7 @@ extern \"C\" { test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi @@ -4408,7 +3431,7 @@ extern \"C\" { if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" + echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ @@ -4423,26 +3446,7 @@ extern \"C\" { #endif /* The mapping between symbol names and symbols. */ -" - - case $host in - *cygwin* | *mingw* ) - $echo >> "$output_objdir/$dlsyms" "\ -/* DATA imports from DLLs on WIN32 can't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs */ -struct { -" - ;; - * ) - $echo >> "$output_objdir/$dlsyms" "\ const struct { -" - ;; - esac - - - $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } @@ -4479,18 +3483,18 @@ static const void *lt_preloaded_setup() { *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; esac esac # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" @@ -4502,7 +3506,7 @@ static const void *lt_preloaded_setup() { ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac else @@ -4515,7 +3519,7 @@ static const void *lt_preloaded_setup() { finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + if test $need_relink = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" @@ -4590,7 +3594,7 @@ static const void *lt_preloaded_setup() { # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? - exit $EXIT_SUCCESS + exit 0 fi if test "$hardcode_action" = relink; then @@ -4645,10 +3649,10 @@ static const void *lt_preloaded_setup() { fi # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case $0 in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else @@ -4660,230 +3664,15 @@ static const void *lt_preloaded_setup() { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in - *cygwin*) - exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *cygwin*) exeext=.exe ;; *) exeext= ;; esac - case $host in - *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${outputname}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - cat > $cwrappersource <> $cwrappersource<<"EOF" -#include -#include -#include -#include -#include -#include - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -#define HAVE_DOS_BASED_FILE_SYSTEM -#ifndef DIR_SEPARATOR_2 -#define DIR_SEPARATOR_2 '\\' -#endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup ((char *) basename (argv[0])); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" -} - -void * -xmalloc (size_t num) -{ - void * p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -; -} - -char * -basename (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return (char *) base; -} - -char * -fnqualify(const char *path) -{ - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; - - assert(path != NULL); - - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); -#endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); - - /* prepend the current directory */ - /* doesn't handle '~' */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; -} - -char * -strendzap(char *str, const char *pat) -{ - size_t len, patlen; - - assert(str != NULL); - assert(pat != NULL); - - len = strlen(str); - patlen = strlen(pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp(str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char * mode, - const char * message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC -s -o $cwrapper $cwrappersource - ;; - esac $rm $output - trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 + trap "$rm $output; exit 1" 1 2 15 $echo > $output "\ #! $SHELL @@ -4899,12 +3688,12 @@ EOF # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' +Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi relink_command=\"$relink_command\" @@ -4959,7 +3748,7 @@ else " if test "$fast_install" = yes; then - $echo >> $output "\ + echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" @@ -4975,7 +3764,7 @@ else $rm \"\$progdir/\$file\" fi" - $echo >> $output "\ + echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then @@ -4983,7 +3772,7 @@ else else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" - exit $EXIT_FAILURE + exit 1 fi fi @@ -4993,13 +3782,13 @@ else $rm \"\$progdir/\$file\" fi" else - $echo >> $output "\ + echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi - $echo >> $output "\ + echo >> $output "\ if test -f \"\$progdir/\$program\"; then" @@ -5010,7 +3799,7 @@ else $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed + # The second colon is a workaround for a bug in BeOS R4 ${SED} $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var @@ -5030,6 +3819,14 @@ else # Run the actual program with our arguments. " case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ @@ -5039,26 +3836,30 @@ else *) $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit $EXIT_FAILURE + exit 1 fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit $EXIT_FAILURE + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 fi fi\ " chmod +x $output fi - exit $EXIT_SUCCESS + exit 0 ;; esac @@ -5074,86 +3875,74 @@ fi\ oldobjs="$libobjs_save" build_libtool_libs=no else - oldobjs="$old_deplibs $non_pic_objects" + oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi generated="$generated $gentop" - func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds + eval cmds=\"$old_archive_from_new_cmds\" else - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - for obj in $save_oldobjs - do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; then - : + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= + xdir="$xdir" fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? fi - fi + done + + eval cmds=\"$old_archive_cmds\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do - eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? @@ -5185,12 +3974,8 @@ fi\ fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - # Only create the output if not a dry run. if test -z "$run"; then @@ -5209,7 +3994,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi newdependency_libs="$newdependency_libs $libdir/$name" ;; @@ -5223,7 +4008,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi newdlfiles="$newdlfiles $libdir/$name" done @@ -5234,36 +4019,17 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE + exit 1 fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles="$newdlfiles $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles="$newdlprefiles $abs" - done - dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file @@ -5292,16 +4058,13 @@ revision=$revision # Is this an already installed library? installed=$installed -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then + if test "$installed" = no && test $need_relink = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi @@ -5314,7 +4077,7 @@ relink_command=\"$relink_command\"" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac - exit $EXIT_SUCCESS + exit 0 ;; # libtool install mode @@ -5329,7 +4092,7 @@ relink_command=\"$relink_command\"" # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac @@ -5345,7 +4108,7 @@ relink_command=\"$relink_command\"" # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac @@ -5393,7 +4156,7 @@ relink_command=\"$relink_command\"" # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) arg="\"$arg\"" ;; esac @@ -5403,13 +4166,13 @@ relink_command=\"$relink_command\"" if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test -z "$files"; then @@ -5419,7 +4182,7 @@ relink_command=\"$relink_command\"" $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Strip any trailing slash from the destination. @@ -5437,10 +4200,10 @@ relink_command=\"$relink_command\"" # Not a directory, so check to see that there is only one file specified. set dummy $files - if test "$#" -gt 2; then + if test $# -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi fi case $destdir in @@ -5452,7 +4215,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac done @@ -5477,11 +4240,11 @@ relink_command=\"$relink_command\"" *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi library_names= @@ -5513,24 +4276,21 @@ relink_command=\"$relink_command\"" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit $EXIT_FAILURE + exit 1 fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 @@ -5538,7 +4298,7 @@ relink_command=\"$relink_command\"" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit $EXIT_FAILURE + continue fi fi @@ -5560,7 +4320,7 @@ relink_command=\"$relink_command\"" $run eval "$striplib $destdir/$realname" || exit $? fi - if test "$#" -gt 0; then + if test $# -gt 0; then # Delete the old symlinks, and create new ones. for linkname do @@ -5573,11 +4333,10 @@ relink_command=\"$relink_command\"" # Do each command in the postinstall commands. lib="$destdir/$realname" - cmds=$postinstall_cmds + eval cmds=\"$postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -5617,7 +4376,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac @@ -5635,7 +4394,7 @@ relink_command=\"$relink_command\"" $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi - exit $EXIT_SUCCESS + exit 0 ;; *) @@ -5647,49 +4406,29 @@ relink_command=\"$relink_command\"" destfile="$destdir/$destfile" fi - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + wrapper=`echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac # If there is no directory component, then add one. case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi finalize=yes @@ -5711,17 +4450,10 @@ relink_command=\"$relink_command\"" done relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac # If there is no directory component, then add one. case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; esac outputname= @@ -5729,17 +4461,17 @@ relink_command=\"$relink_command\"" if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - save_umask=`umask` - umask 0077 - if $mkdir "$tmpdir"; then - umask $save_umask + tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` + if test $? = 0 ; then : + else + tmpdir="$tmpdir/libtool-$$" + fi + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : else - umask $save_umask $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` @@ -5757,14 +4489,14 @@ relink_command=\"$relink_command\"" fi else # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in - */usr/bin/install*,*cygwin*) + /usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok @@ -5773,7 +4505,7 @@ relink_command=\"$relink_command\"" destfile=$destfile.exe ;; *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; @@ -5794,17 +4526,16 @@ relink_command=\"$relink_command\"" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? - if test -n "$stripme" && test -n "$old_striplib"; then + if test -n "$stripme" && test -n "$striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. - cmds=$old_postinstall_cmds + eval cmds=\"$old_postinstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -5818,9 +4549,9 @@ relink_command=\"$relink_command\"" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + exec_cmd='$SHELL $0 --finish$current_libdirs' else - exit $EXIT_SUCCESS + exit 0 fi ;; @@ -5839,11 +4570,10 @@ relink_command=\"$relink_command\"" for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. - cmds=$finish_cmds + eval cmds=\"$finish_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" @@ -5860,43 +4590,43 @@ relink_command=\"$relink_command\"" fi # Exit here if they wanted silent mode. - test "$show" = : && exit $EXIT_SUCCESS + test "$show" = ":" && exit 0 - $echo "----------------------------------------------------------------------" - $echo "Libraries have been installed in:" + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" for libdir in $libdirs; do - $echo " $libdir" + echo " $libdir" done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" fi if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" - $echo " - use the \`$flag' linker flag" + echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" + echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" - exit $EXIT_SUCCESS + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 ;; # libtool execute mode @@ -5908,7 +4638,7 @@ relink_command=\"$relink_command\"" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" - exit $EXIT_FAILURE + exit 1 fi # Handle -dlopen flags immediately. @@ -5916,18 +4646,18 @@ relink_command=\"$relink_command\"" if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi dir= case $file in *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi # Read the libtool library. @@ -5954,7 +4684,7 @@ relink_command=\"$relink_command\"" dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit $EXIT_FAILURE + exit 1 fi ;; @@ -5994,7 +4724,7 @@ relink_command=\"$relink_command\"" -*) ;; *) # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; @@ -6017,7 +4747,7 @@ relink_command=\"$relink_command\"" eval "export $shlibpath_var" fi - # Restore saved environment variables + # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi @@ -6026,15 +4756,15 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\"\$cmd\"$args" + exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - eval \$echo \"\$cmd\"$args - exit $EXIT_SUCCESS + $echo "$cmd$args" + exit 0 fi ;; @@ -6062,25 +4792,24 @@ relink_command=\"$relink_command\"" if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi rmdirs= - origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. - objdir="$origobjdir" + objdir="$objdir" else - objdir="$dir/$origobjdir" + objdir="$dir/$objdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" + test $mode = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then + if test $mode = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; @@ -6104,7 +4833,7 @@ relink_command=\"$relink_command\"" case $name in *.la) # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. @@ -6112,19 +4841,18 @@ relink_command=\"$relink_command\"" rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - if test "$mode" = uninstall; then + if test $mode = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. - cmds=$postuninstall_cmds + eval cmds=\"$postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then + if test $? != 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -6133,14 +4861,13 @@ relink_command=\"$relink_command\"" if test -n "$old_library"; then # Do each command in the old_postuninstall commands. - cmds=$old_postuninstall_cmds + eval cmds=\"$old_postuninstall_cmds\" save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then + if test $? != 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -6152,52 +4879,22 @@ relink_command=\"$relink_command\"" ;; *.lo) - # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - - # Read the .lo file - . $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" \ - && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" \ - && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" fi ;; *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename + # Do a test to see if this is a libtool program. + if test $mode = clean && + (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" fi fi ;; @@ -6205,7 +4902,6 @@ relink_command=\"$relink_command\"" $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done - objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -6221,20 +4917,20 @@ relink_command=\"$relink_command\"" "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE + exit 1 fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd - exit $EXIT_FAILURE + exit 1 fi # We need to display help for each of the modes. @@ -6253,7 +4949,6 @@ Provide generalized library-building support services. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: @@ -6267,10 +4962,8 @@ MODE must be one of the following: uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to ." - exit $EXIT_SUCCESS +a more detailed description of MODE." + exit 0 ;; clean) @@ -6381,9 +5074,6 @@ The following components of LINK-COMMAND are treated specially: -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries @@ -6425,34 +5115,14 @@ Otherwise, only FILE itself is deleted using RM." *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 - exit $EXIT_FAILURE + exit 1 ;; esac -$echo +echo $echo "Try \`$modename --help' for more information about other modes." -exit $? - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static +exit 0 # Local Variables: # mode:shell-script diff --git a/missing b/missing index 09edd884..64b5f901 100755 --- a/missing +++ b/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2005-02-08.22 +scriptversion=2004-09-07.08 -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. @@ -87,12 +87,12 @@ Supported PROGRAM values: yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." - exit $? + exit 0 ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" - exit $? + exit 0 ;; -*) @@ -288,14 +288,10 @@ WARNING: \`$1' is $msg. You should only need it if call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; diff --git a/mkinstalldirs b/mkinstalldirs index 5d26a485..6fbe5e11 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -1,7 +1,7 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -scriptversion=2005-02-02.21 +scriptversion=2004-02-15.20 # Original author: Noah Friedman # Created: 1993-05-16 @@ -27,7 +27,7 @@ while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" - exit $? + exit 0 ;; -m) # -m PERM arg shift @@ -37,7 +37,7 @@ while test $# -gt 0 ; do ;; --version) echo "$0 $scriptversion" - exit $? + exit 0 ;; --) # stop option processing shift diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 19de7246..fb02f53d 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004 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. @@ -132,7 +132,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -162,7 +162,6 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -173,10 +172,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -188,8 +183,6 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -219,18 +212,13 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ From 048a1857be8a847821a603ad077c59a71c213317 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 4 Jun 2005 15:20:00 +0000 Subject: [PATCH 2260/2994] Fix some bugs and warnings in code that I commited tonight. --- include/ntfs/index.h | 7 +++++- libntfs/collate.c | 20 +++++++-------- libntfs/index.c | 60 ++++++++++++++++---------------------------- 3 files changed, 38 insertions(+), 49 deletions(-) diff --git a/include/ntfs/index.h b/include/ntfs/index.h index 27fcf719..2093e5c1 100644 --- a/include/ntfs/index.h +++ b/include/ntfs/index.h @@ -31,6 +31,8 @@ /** * @ni: inode containing the @entry described by this context + * @name: name of the which context describes + * @name_len: length of the index name * @entry: index entry (points into @ir or @ia) * @data: index entry data (points into @entry) * @data_len: length in bytes of @data @@ -70,6 +72,8 @@ */ typedef struct { ntfs_inode *ni; + ntfschar *name; + u32 name_len; INDEX_ENTRY *entry; void *data; u16 data_len; @@ -83,7 +87,8 @@ typedef struct { u32 block_size; } ntfs_index_context; -extern ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *ni); +extern ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *ni, + ntfschar *name, u32 name_len); extern void ntfs_index_ctx_put(ntfs_index_context *ictx); extern int ntfs_index_lookup(const void *key, const int key_len, diff --git a/libntfs/collate.c b/libntfs/collate.c index 4da13ef4..8a778ae7 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -24,7 +24,7 @@ #include "debug.h" #include "unistr.h" -static int ntfs_collate_binary(ntfs_volume *vol, +static int ntfs_collate_binary(ntfs_volume *vol __attribute__((unused)), const void *data1, const int data1_len, const void *data2, const int data2_len) { @@ -42,7 +42,7 @@ static int ntfs_collate_binary(ntfs_volume *vol, return rc; } -static int ntfs_collate_ntofs_ulong(ntfs_volume *vol, +static int ntfs_collate_ntofs_ulong(ntfs_volume *vol __attribute__((unused)), const void *data1, const int data1_len, const void *data2, const int data2_len) { @@ -51,7 +51,7 @@ static int ntfs_collate_ntofs_ulong(ntfs_volume *vol, ntfs_debug("Entering."); if (data1_len != data2_len || data1_len != 4) { - ntfs_error("data1_len or/and data2_len not equal to 4."); + ntfs_error(, "data1_len or/and data2_len not equal to 4."); return NTFS_COLLATION_ERROR; } d1 = le32_to_cpup(data1); @@ -69,14 +69,14 @@ static int ntfs_collate_ntofs_ulong(ntfs_volume *vol, } static int ntfs_collate_file_name(ntfs_volume *vol, - const void *data1, const int data1_len, - const void *data2, const int data2_len) { + const void *data1, const int data1_len __attribute__((unused)), + const void *data2, const int data2_len __attribute__((unused))){ int rc; - FILE_NAME_ATTR *fn1, *fn2; + const FILE_NAME_ATTR *fn1, *fn2; ntfs_debug("Entering."); - fn1 = (FILE_NAME_ATTR *)data1; - fn2 = (FILE_NAME_ATTR *)data2; + fn1 = (const FILE_NAME_ATTR *)data1; + fn2 = (const FILE_NAME_ATTR *)data2; rc = ntfs_names_collate(fn1->file_name, fn1->file_name_length, fn2->file_name, fn2->file_name_length, NTFS_COLLATION_ERROR, CASE_SENSITIVE, vol->upcase, @@ -127,7 +127,7 @@ int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr, ntfs_debug("Entering."); if (!vol || !data1 || !data2 || data1_len < 0 || data2_len < 0) { - ntfs_error("Invalid arguments passed."); + ntfs_error(, "Invalid arguments passed."); return NTFS_COLLATION_ERROR; } /* @@ -151,6 +151,6 @@ int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr, return ntfs_do_collate0x1[i](vol, data1, data1_len, data2, data2_len); err: - ntfs_error("Unknown collation rule."); + ntfs_error(, "Unknown collation rule."); return NTFS_COLLATION_ERROR; } diff --git a/libntfs/index.c b/libntfs/index.c index 7d6e0c55..9c4919cb 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -29,12 +29,15 @@ /** * ntfs_index_ctx_get - allocate and initialize a new index context - * @idx_ni: ntfs inode with which to initialize the context + * @ni: ntfs inode with which to initialize the context + * @name: name of the which context describes + * @name_len: length of the index name * * Allocate a new index context, initialize it with @ni and return it. * Return NULL if allocation failed. */ -ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *ni) +ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *ni, + ntfschar *name, u32 name_len) { ntfs_index_context *ictx; @@ -48,7 +51,8 @@ ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *ni) if (ictx) *ictx = (ntfs_index_context) { .ni = ni, - .ia_dirty = FALSE, + .name = name, + .name_len = name_len }; return ictx; } @@ -144,12 +148,12 @@ int ntfs_index_lookup(const void *key, const int key_len, } /* Find the index root attribute in the mft record. */ - err = ntfs_attr_lookup(AT_INDEX_ROOT, NULL, 0, + err = ntfs_attr_lookup(AT_INDEX_ROOT, ictx->name, ictx->name_len, CASE_SENSITIVE, 0, NULL, 0, actx); if (err) { if (errno == ENOENT) { ntfs_error(sb, "Index root attribute missing in inode " - "0x%lx.", ni->mft_no); + "0x%llx.", ni->mft_no); err = EIO; } else err = errno; @@ -188,14 +192,6 @@ int ntfs_index_lookup(const void *key, const int key_len, */ if (ie->flags & INDEX_ENTRY_END) break; - /* Further bounds checks. */ - if ((u32)sizeof(INDEX_ENTRY_HEADER) + - le16_to_cpu(ie->key_length) > - le16_to_cpu(ie->data_offset) || - (u32)le16_to_cpu(ie->data_offset) + - le16_to_cpu(ie->data_length) > - le16_to_cpu(ie->length)) - goto idx_err_out; /* If the keys match perfectly, we setup @ictx and return 0. */ if ((key_len == le16_to_cpu(ie->key_length)) && !memcmp(key, &ie->key, key_len)) { @@ -205,9 +201,8 @@ ir_done: ictx->ia = NULL; done: ictx->entry = ie; - ictx->data = (u8*)ie + - le16_to_cpu(ie->data_offset); - ictx->data_len = le16_to_cpu(ie->data_length); + ictx->data = (u8*)ie + offsetof(INDEX_ENTRY, key); + ictx->data_len = le16_to_cpu(ie->key_length); ntfs_debug("Done."); if (err) { errno = err; @@ -252,10 +247,11 @@ done: ntfs_attr_put_search_ctx(actx); actx = NULL; /* Open INDEX_ALLOCATION. */ - na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, AT_UNNAMED, 0); + na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, + ictx->name, ictx->name_len); if (!na) { ntfs_error(sb, "No index allocation attribute but index entry " - "requires one. Inode 0x%lx is corrupt or " + "requires one. Inode 0x%llx is corrupt or " "library bug.", ni->mft_no); goto err_out; } @@ -277,21 +273,21 @@ descend_into_child_node: /* Catch multi sector transfer fixup errors. */ if (!ntfs_is_indx_record(ia->magic)) { ntfs_error(sb, "Index record with vcn 0x%llx is corrupt. " - "Corrupt inode 0x%lx. Run chkdsk.", + "Corrupt inode 0x%llx. Run chkdsk.", (long long)vcn, ni->mft_no); goto err_out; } if (sle64_to_cpu(ia->index_block_vcn) != vcn) { ntfs_error(sb, "Actual VCN (0x%llx) of index buffer is " "different from expected VCN (0x%llx). Inode " - "0x%lx is corrupt or driver bug.", + "0x%llx is corrupt or driver bug.", (unsigned long long) sle64_to_cpu(ia->index_block_vcn), (unsigned long long)vcn, ni->mft_no); goto err_out; } if (le32_to_cpu(ia->index.allocated_size) + 0x18 != ictx->block_size) { - ntfs_error(sb, "Index buffer (VCN 0x%llx) of inode 0x%lx has " + ntfs_error(sb, "Index buffer (VCN 0x%llx) of inode 0x%llx has " "a size (%u) differing from the index " "specified size (%u). Inode is corrupt or " "driver bug.", (unsigned long long)vcn, @@ -303,8 +299,8 @@ descend_into_child_node: index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); if (index_end > (u8*)ia + ictx->block_size) { ntfs_error(sb, "Size of index buffer (VCN 0x%llx) of inode " - "0x%lx exceeds maximum size.", - (unsigned long long)vcn, idx_ni->mft_no); + "0x%llx exceeds maximum size.", + (unsigned long long)vcn, ni->mft_no); goto err_out; } /* The first index entry. */ @@ -321,7 +317,7 @@ descend_into_child_node: sizeof(INDEX_ENTRY_HEADER) > index_end || (u8*)ie + le16_to_cpu(ie->length) > index_end) { ntfs_error(sb, "Index entry out of bounds in inode " - "0x%lx.", ni->mft_no); + "0x%llx.", ni->mft_no); goto err_out; } /* @@ -330,17 +326,6 @@ descend_into_child_node: */ if (ie->flags & INDEX_ENTRY_END) break; - /* Further bounds checks. */ - if ((u32)sizeof(INDEX_ENTRY_HEADER) + - le16_to_cpu(ie->key_length) > - le16_to_cpu(ie->data_offset) || - (u32)le16_to_cpu(ie->data_offset) + - le16_to_cpu(ie->data_length) > - le16_to_cpu(ie->length)) { - ntfs_error(sb, "Index entry out of bounds in inode " - "0x%lx.", ni->mft_no); - goto err_out; - } /* If the keys match perfectly, we setup @ictx and return 0. */ if ((key_len == le16_to_cpu(ie->key_length)) && !memcmp(key, &ie->key, key_len)) { @@ -384,14 +369,14 @@ ia_done: } if ((ia->index.flags & NODE_MASK) == LEAF_NODE) { ntfs_error(sb, "Index entry with child node found in a leaf " - "node in inode 0x%lx.", idx_ni->mft_no); + "node in inode 0x%llx.", ni->mft_no); goto err_out; } /* Child node present, descend into it. */ vcn = sle64_to_cpup((sle64*)((u8*)ie + le16_to_cpu(ie->length) - 8)); if (vcn >= 0) goto descend_into_child_node; - ntfs_error(sb, "Negative child node vcn in inode 0x%lx.", ni->mft_no); + ntfs_error(sb, "Negative child node vcn in inode 0x%llx.", ni->mft_no); err_out: if (na) ntfs_attr_close(na); @@ -407,4 +392,3 @@ idx_err_out: ntfs_error(sb, "Corrupt index. Aborting lookup."); goto err_out; } - From 7cd9b6b22d29183bbd348fdc0535aaa7e4b1c5f6 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 4 Jun 2005 15:20:46 +0000 Subject: [PATCH 2261/2994] Small formating fix to ntfsinfo. --- ntfsprogs/ntfsinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index c271c9e5..7f0cd8ef 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1123,7 +1123,7 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) case(AT_FILE_NAME): Vprintf("\t\tFILE record number:\t %llu\n", MREF_LE(entry->indexed_file)); - Vprintf("\t\tFile attributes:\t 0x%02x\n", + Vprintf("\t\tFile attributes:\t 0x%08x\n", le32_to_cpu( entry->key.file_name.file_attributes)); Vprintf("\t\tFile name namespace:\t 0x%02x\n", From 4b000b3d138f44c9a842fb5cb2c08a1c8be464d8 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 5 Jun 2005 14:55:08 +0000 Subject: [PATCH 2262/2994] - Implement FILE_NAME attributes update in index during inode sync and enable code that set/clean sparse bit. Also add new inode state bit FileNameDirty to indicate that FILE_NAME attributes need update. At least after attribute resize we leave absolutely consist volume. - Bugfixes to collate.c and index.c. - Minor formating fixed to ntfscp and ntfsinfo. --- ChangeLog | 5 ++ include/ntfs/inode.h | 16 ++++++ libntfs/attrib.c | 45 +++++++++++---- libntfs/collate.c | 2 +- libntfs/index.c | 18 +++--- libntfs/inode.c | 129 +++++++++++++++++++++++++++++++++++++++++-- ntfsprogs/ntfscp.c | 6 +- ntfsprogs/ntfsinfo.c | 9 ++- 8 files changed, 201 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a480dea..c2caa5d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -153,6 +153,11 @@ xx/xx/2005 - 2.0.0-WIP ntfs_is_collation_rule_supported. (Yura) - Port index.[ch] from kernel to library. New API's: ntfs_index_lookup, ntfs_index_ctx_{get,put}, ntfs_index_entry_mark_dirty. (Yura) + - Implement FILE_NAME attributes update in index during inode sync and + enable code that set/clean sparse bit. Also add new inode state bit + FileNameDirty to indicate that FILE_NAME attributes need update. + At least after attribute resize we leave absolutely consist + volume. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 4b9c2c48..ddcff691 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -45,6 +45,8 @@ typedef enum { NI_Compressed, /* 1: Inode is compressed. */ NI_Encrypted, /* 1: Inode is encrypted. */ NI_Sparse, /* 1: Inode is sparse. */ + NI_FileNameDirty, /* 1: FILE_NAME attributes need to be updated + in the index. */ } ntfs_inode_state_bits; #define test_nino_flag(ni, flag) test_bit(NI_##flag, (ni)->state) @@ -94,6 +96,17 @@ typedef enum { #define NInoSetSparse(ni) set_nino_flag(ni, Sparse) #define NInoClearSparse(ni) clear_nino_flag(ni, Sparse) +#define NInoFileNameDirty(ni) \ + test_nino_flag(ni, FileNameDirty) +#define NInoFileNameSetDirty(ni) \ + set_nino_flag(ni, FileNameDirty) +#define NInoFileNameClearDirty(ni) \ + clear_nino_flag(ni, FileNameDirty) +#define NInoFileNameTestAndSetDirty(ni) \ + test_and_set_nino_flag(ni, FileNameDirty) +#define NInoFileNameTestAndClearDirty(ni) \ + test_and_clear_nino_flag(ni, FileNameDirty) + /* * The NTFS in-memory inode structure. It is just used as an extension to the * fields already provided in the VFS inode. @@ -126,6 +139,9 @@ struct _ntfs_inode { void *private_data; /* Temp: for directory handling */ int ref_count; + /* Belows fields needed to update indexes. They valid if != -1. */ + s64 data_size; + s64 allocated_size; }; extern ntfs_inode *ntfs_inode_allocate(ntfs_volume *vol); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index a7414dac..cf963d6e 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3976,12 +3976,6 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) * function updates sparse bit and allocates/frees space for compressed_size, * but doesn't change it, so caller should update it manually. * - * NOTE: Code that set/clean sparse bit currently disabled, because chkdsk - * complain if we don't update index entry's for inode to which we set sparse - * bit. But it doesn't if attribute's runlist has lcn holes and sparse bit - * isn't set. So until we have no API for updating index entries it's the best - * choice. - * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: * ENOMEM - Not enough memory to complete operation. @@ -4064,7 +4058,6 @@ retry: goto put_err_out; } } -#if 0 /* If we in the first extent, then set/clean sparse bit. */ if (!a->lowest_vcn) { int sparse; @@ -4130,6 +4123,13 @@ retry: a->mapping_pairs_offset = cpu_to_le16(le16_to_cpu( a->mapping_pairs_offset) + 8); + /* + * Set FILE_NAME dirty flag, to update + * sparse bit in the index. + */ + if (na->type == AT_DATA && + na->name == AT_UNNAMED) + NInoFileNameSetDirty(na->ni); } if (!sparse && (a->flags & ATTR_IS_SPARSE) && !(a->flags & ATTR_IS_COMPRESSED)) { @@ -4144,9 +4144,15 @@ retry: a->mapping_pairs_offset = cpu_to_le16(le16_to_cpu( a->mapping_pairs_offset) - 8); + /* + * Set FILE_NAME dirty flag, to update + * sparse bit in the index. + */ + if (na->type == AT_DATA && + na->name == AT_UNNAMED) + NInoFileNameSetDirty(na->ni); } } -#endif /* Get the size for the rest of mapping pairs array. */ mp_size = ntfs_get_size_for_mapping_pairs(na->ni->vol, na->rl, stop_vcn); @@ -4811,6 +4817,8 @@ put_err_out: */ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) { + int ret; + if (!na || newsize < 0 || (na->ni->mft_no == FILE_MFT && na->type == AT_DATA)) { Dprintf("%s(): Invalid aruments passed.\n", __FUNCTION__); @@ -4837,9 +4845,24 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) } if (NAttrNonResident(na)) { if (newsize > na->data_size) - return ntfs_non_resident_attr_expand(na, newsize); + ret = ntfs_non_resident_attr_expand(na, newsize); else - return ntfs_non_resident_attr_shrink(na, newsize); + ret = ntfs_non_resident_attr_shrink(na, newsize); + } else + ret = ntfs_resident_attr_resize(na, newsize); + /* Set FILE_NAME dirty flag, to update file length in the index. */ + if (na->type == AT_DATA && na->name == AT_UNNAMED) { + NInoFileNameSetDirty(na->ni); + na->ni->data_size = na->data_size; + /* + * If attribute sparse or commpreseed then allocated size in + * index should be euqal to compressed size, not to allocated + * size. + */ + if (NAttrCompressed(na) || NAttrSparse(na)) + na->ni->allocated_size = na->compressed_size; + else + na->ni->allocated_size = na->allocated_size; } - return ntfs_resident_attr_resize(na, newsize); + return ret; } diff --git a/libntfs/collate.c b/libntfs/collate.c index 8a778ae7..576930a8 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -79,7 +79,7 @@ static int ntfs_collate_file_name(ntfs_volume *vol, fn2 = (const FILE_NAME_ATTR *)data2; rc = ntfs_names_collate(fn1->file_name, fn1->file_name_length, fn2->file_name, fn2->file_name_length, - NTFS_COLLATION_ERROR, CASE_SENSITIVE, vol->upcase, + NTFS_COLLATION_ERROR, IGNORE_CASE, vol->upcase, vol->upcase_len); ntfs_debug("Done, returning %i.", rc); return rc; diff --git a/libntfs/index.c b/libntfs/index.c index 9c4919cb..14f8a5d0 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -26,6 +26,7 @@ #include "collate.h" #include "debug.h" #include "index.h" +#include "mst.h" /** * ntfs_index_ctx_get - allocate and initialize a new index context @@ -71,14 +72,15 @@ void ntfs_index_ctx_put(ntfs_index_context *ictx) ntfs_attr_put_search_ctx(ictx->actx); } else { /* Write out index block it it's dirty. */ - if (ictx->ia_dirty) - if (ntfs_attr_pwrite(ictx->ia_na, + if (ictx->ia_dirty) { + if (ntfs_attr_mst_pwrite(ictx->ia_na, ictx->ia_vcn << - ictx->ni->vol->cluster_size, + ictx->ni->vol->cluster_size, 1, ictx->block_size, ictx->ia) != - ictx->block_size) + 1) ntfs_error(, "Failed to write out " "index block."); + } /* Free resources. */ free(ictx->ia); ntfs_attr_close(ictx->ia_na); @@ -264,12 +266,13 @@ done: goto err_out; } descend_into_child_node: + ntfs_debug("Descend into node with VCN %lld.", vcn); /* Read index allocation block. */ - if (ntfs_attr_pread(na, vcn << vol->cluster_size_bits, ictx->block_size, - ia) != ictx->block_size) { + if (ntfs_attr_mst_pread(na, vcn << vol->cluster_size_bits, 1, + ictx->block_size, ia) != 1) { ntfs_error(, "Failed to read index allocation."); goto err_out; - } + } /* Catch multi sector transfer fixup errors. */ if (!ntfs_is_indx_record(ia->magic)) { ntfs_error(sb, "Index record with vcn 0x%llx is corrupt. " @@ -392,3 +395,4 @@ idx_err_out: ntfs_error(sb, "Corrupt index. Aborting lookup."); goto err_out; } + diff --git a/libntfs/inode.c b/libntfs/inode.c index 487eccf7..49b64320 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -36,6 +36,8 @@ #include "attrlist.h" #include "runlist.h" #include "lcnalloc.h" +#include "index.h" +#include "dir.h" /** * Internal: @@ -123,6 +125,8 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) if (!(ni->mrec->flags & MFT_RECORD_IN_USE)) goto err_out; ni->mft_no = MREF(mref); + ni->data_size = -1; + ni->allocated_size = -1; ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) goto err_out; @@ -453,6 +457,113 @@ static int ntfs_inode_sync_standard_information(ntfs_inode *ni) { return 0; } +/** + * ntfs_inode_sync_standard_information - update FILE_NAME attribute's + * @ni: ntfs inode to update FILE_NAME attribute's + * + * Update all FILE_NAME attribute's for inode @ni in the index. + * + * Return 0 on success or -1 on error with errno set to the error code. + */ +static int ntfs_inode_sync_file_name(ntfs_inode *ni) { + ntfs_attr_search_ctx *ctx = NULL; + ntfs_index_context *ictx; + ntfs_inode *index_ni; + FILE_NAME_ATTR *fn; + int err = 0; + + ctx = ntfs_attr_get_search_ctx(ni, NULL); + if (!ctx) { + err = errno; + Dprintf("%s(): Failed to get attribute search context.\n", + __FUNCTION__); + goto err_out; + } + /* Walk through all FILE_NAME attributes and update them. */ + while (!ntfs_attr_lookup(AT_FILE_NAME, NULL, 0, 0, 0, NULL, 0, ctx)) { + fn = (FILE_NAME_ATTR *)((u8 *)ctx->attr + + le16_to_cpu(ctx->attr->value_offset)); + if (MREF_LE(fn->parent_directory) == ni->mft_no) { + /* + * WARNING: We cheater here and obtain 2 attribute + * search contextes for one inode (first we obtained + * above, second will be obtained inside + * ntfs_index_lookup), it's acceptable for library, + * but will lock kernel. + */ + index_ni = ni; + } else + index_ni = ntfs_inode_open(ni->vol, + le64_to_cpu(fn->parent_directory)); + if (!index_ni) { + if (!err) + err = errno; + Dprintf("%s(): Failed to open inode with index.\n", + __FUNCTION__); + continue; + } + ictx = ntfs_index_ctx_get(index_ni, I30, 4); + if (!ictx) { + if (!err) + err = errno; + Dprintf("%s(): Failed to get index context.\n", + __FUNCTION__); + ntfs_inode_close(index_ni); + continue; + } + if (ntfs_index_lookup(fn, sizeof(FILE_NAME_ATTR), ictx)) { + if (!err) { + if (errno == ENOENT) + err = EIO; + else + err = errno; + } + Dprintf("%s(): Index lookup failed.\n", __FUNCTION__); + ntfs_index_ctx_put(ictx); + ntfs_inode_close(index_ni); + continue; + } + /* Update flags and file size. */ + fn = (FILE_NAME_ATTR *)ictx->data; + if (NInoCompressed(ni)) + fn->file_attributes |= FILE_ATTR_COMPRESSED; + else + fn->file_attributes &= ~FILE_ATTR_COMPRESSED; + if (NInoEncrypted(ni)) + fn->file_attributes |= FILE_ATTR_ENCRYPTED; + else + fn->file_attributes &= ~FILE_ATTR_ENCRYPTED; + if (NInoSparse(ni)) + fn->file_attributes |= FILE_ATTR_SPARSE_FILE; + else + fn->file_attributes &= ~FILE_ATTR_SPARSE_FILE; + if (ni->allocated_size != -1) + fn->allocated_size = cpu_to_sle64(ni->allocated_size); + if (ni->data_size != -1) + fn->data_size = cpu_to_sle64(ni->data_size); + ntfs_index_entry_mark_dirty(ictx); + ntfs_index_ctx_put(ictx); + ntfs_inode_close(index_ni); + } + /* Check for real error occured. */ + if (errno != ENOENT) { + err = errno; + Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); + goto err_out; + } + ntfs_attr_put_search_ctx(ctx); + if (err) { + errno = err; + return -1; + } + return 0; +err_out: + if (ctx) + ntfs_attr_put_search_ctx(ctx); + errno = err; + return -1; +} + /** * ntfs_inode_sync - write the inode (and its dirty extents) to disk * @ni: ntfs inode to write @@ -480,7 +591,7 @@ int ntfs_inode_sync(ntfs_inode *ni) errno = EINVAL; return -1; } - + Dprintf("%s(): Entering for inode 0x%llx.\n", __FUNCTION__, (long long) ni->mft_no); @@ -495,6 +606,19 @@ int ntfs_inode_sync(ntfs_inode *ni) __FUNCTION__); } + /* Update FILE_NAME's in the index. */ + if (ni->nr_extents != -1 && NInoFileNameTestAndClearDirty(ni) && + ntfs_inode_sync_file_name(ni)) { + if (!err || errno == EIO) { + err = errno; + if (err != EIO) + err = EBUSY; + } + Dprintf("%s(): Failed to sync FILE_NAME attributes.\n", + __FUNCTION__); + NInoFileNameSetDirty(ni); + } + /* Write out attribute list from cache to disk. */ if (ni->nr_extents != -1 && NInoAttrList(ni) && NInoAttrListTestAndClearDirty(ni)) { @@ -522,7 +646,6 @@ int ntfs_inode_sync(ntfs_inode *ni) Dprintf("%s(): Attribute list " "sync failed (write failed).\n", __FUNCTION__); - } NInoAttrListSetDirty(ni); } @@ -574,8 +697,6 @@ int ntfs_inode_sync(ntfs_inode *ni) } } - // TODO: Update FILE_NAME attribute in the index. - if (!err) return 0; errno = err; diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index f459c237..32afa639 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -273,7 +273,7 @@ int main (int argc, char *argv[]) return 1; utils_set_locale(); - + /* Set SIGINT handler. */ if (signal(SIGINT, sigint_handler) == SIG_ERR) { perror("Failed to set SIGINT handler"); @@ -288,7 +288,7 @@ int main (int argc, char *argv[]) perror("ERROR: couldn't mount volume"); return 1; } - + if ((vol->flags & VOLUME_IS_DIRTY) && (!opts.force)) goto umount; @@ -382,7 +382,7 @@ int main (int argc, char *argv[]) goto close_dst; } } - + Vprintf("Old file size: %lld\n", na->data_size); if (na->data_size != new_size) { if (ntfs_attr_truncate(na, new_size)) { diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 7f0cd8ef..4804d66e 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1390,9 +1390,12 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) printf("\tIndex name:\t\t '%s'\n",index_name); free(index_name); } else { - /* an error occured, errno holds the reason - notify the user */ - fprintf(stderr, "ntfsinfo error: could not parse index name: %s\n", - strerror(errno)); + /* + * An error occured, errno holds the reason - + * notify the user + */ + fprintf(stderr, "ntfsinfo error: could not parse " + "index name: %s\n", strerror(errno)); } } else { printf("\tIndex name:\t\t unnamed\n"); From 26945d1e81b87b75e0046de64bcc6e79d79f01a3 Mon Sep 17 00:00:00 2001 From: antona Date: Sun, 5 Jun 2005 20:06:45 +0000 Subject: [PATCH 2263/2994] Add some offset comments. --- include/ntfs/layout.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 5bfe16f2..f8d9f0f9 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -52,12 +52,12 @@ typedef struct { u16 sectors; /* zero */ u8 media_type; /* 0xf8 = hard disk */ u16 sectors_per_fat; /* zero */ - u16 sectors_per_track; /* Required to boot Windows. */ - u16 heads; /* Required to boot Windows. */ - u32 hidden_sectors; /* Offset to the start of the partition +/*0x0d*/u16 sectors_per_track; /* Required to boot Windows. */ +/*0x0f*/u16 heads; /* Required to boot Windows. */ +/*0x11*/u32 hidden_sectors; /* Offset to the start of the partition relative to the disk in sectors. Required to boot Windows. */ - u32 large_sectors; /* zero */ +/*0x15*/u32 large_sectors; /* zero */ /* sizeof() = 25 (0x19) bytes */ } __attribute__ ((__packed__)) BIOS_PARAMETER_BLOCK; @@ -67,7 +67,7 @@ typedef struct { typedef struct { u8 jump[3]; /* Irrelevant (jump to boot up code).*/ u64 oem_id; /* Magic "NTFS ". */ - BIOS_PARAMETER_BLOCK bpb; /* See BIOS_PARAMETER_BLOCK. */ +/*0x0b*/BIOS_PARAMETER_BLOCK bpb; /* See BIOS_PARAMETER_BLOCK. */ u8 unused[4]; /* zero, NTFS diskedit.exe states that this is actually: u8 physical_drive; // 0x80 From 410432bc9d9d74926fbcfe69b3db78dfd2de79bb Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 5 Jun 2005 23:48:55 +0000 Subject: [PATCH 2264/2994] - Fix bug in index.c pointed by Anton, many thanks to him. - Small updates all over the place: * NEWS * ntfscp manual page * ntfsinfo prints parent directory for FILE_NAME attribute * year in ntfscp copyright --- NEWS | 4 ++++ libntfs/index.c | 7 ++++--- ntfsprogs/ntfscp.8.in | 31 +++++++++++++++++++++++-------- ntfsprogs/ntfscp.c | 2 +- ntfsprogs/ntfsinfo.c | 2 ++ 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index 4281c0c6..e3a7ec37 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ Current news ============ +Attribute resize code for normal and sparse files is completed. Thus ntfscp +should always successfully overwrite any normal or sparse even if file size is +changed. + Moved back from BitKeeper to CVS on SF.net. ntfsprogs should now work completely on Windows 2000 and XP (Cygwin). diff --git a/libntfs/index.c b/libntfs/index.c index 14f8a5d0..5794bf06 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -75,9 +75,10 @@ void ntfs_index_ctx_put(ntfs_index_context *ictx) if (ictx->ia_dirty) { if (ntfs_attr_mst_pwrite(ictx->ia_na, ictx->ia_vcn << - ictx->ni->vol->cluster_size, 1, - ictx->block_size, ictx->ia) != - 1) + ictx->ni->vol-> + cluster_size_bits, + 1, ictx->block_size, + ictx->ia) != 1) ntfs_error(, "Failed to write out " "index block."); } diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in index 73cb6bda..b709c989 100644 --- a/ntfsprogs/ntfscp.8.in +++ b/ntfsprogs/ntfscp.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2004 Yura Pakhuchiy. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCP 8 "October 2004" "ntfsprogs version @VERSION@" +.TH NTFSCP 8 "June 2005" "ntfsprogs version @VERSION@" .SH NAME ntfscp \- overwrite file on an NTFS volume. .SH SYNOPSIS @@ -10,12 +10,22 @@ ntfscp \- overwrite file on an NTFS volume. [ .I options ] -.B device src_file dest_file +.B device source_file destination .SH DESCRIPTION .B ntfscp will overwrite file on an NTFS volume. At present .B ntfscp can't create new files. +.B destination +can be either file or directory. In case if +.B destination +is directory specified by name then +.B source_file +is copied into this directory, in case if +.B destination +is directory and specified by inode number then unnamed data attribute is created for this inode and +.B source_file +is copied into it (WARNING: it's unusual to have unnamed data streams in the directories, think twice before specifying directory by inode number). .SH OPTIONS Below is a summary of all the options that .B ntfscp @@ -35,7 +45,7 @@ Write to this attribute. .TP .B \-i, \-\-inode Treat -.I dest_file +.I destination as inode number. .TP .BI "\-N, \-\-attr-name " name @@ -61,17 +71,19 @@ Show the version number, copyright and license .TP .B \-v, \-\-vebose Display more debug/warning/error messages. +.SH DATA STREAMS +All data on NTFS is stored in streams, which can have names. A file can have more than one data streams, but exactly one must have no name. The size of a file is the size of its unnamed data stream. Usually when you don't specify stream name you are access to unnamed data stream. If you want access to named data stream you need to add ":stream_name" to the filename. For example: by opening "some.mp3:artist" you will open stream "artist" in "some.mp3". But windows usually prevent you from accessing to named data streams, so you need to use some program like FAR or utils from cygwin to access named data streams. .SH EXAMPLES -Copy boot.ini from /home/user to the root of an /dev/hda1 NTFS volume: +Copy new_boot.ini from /home/user as boot.ini to the root of an /dev/hda1 NTFS volume: .RS .sp -.B ntfscp /dev/hda1 /home/user/boot.ini boot.ini +.B ntfscp /dev/hda1 /home/user/new_boot.ini boot.ini .sp .RE -Copy myfile to C:\\some\\path\\file:stream (assume that /dev/hda1 letter in windows is C): +Copy myfile to C:\\some\\path\\myfile:stream (assume that /dev/hda1 letter in windows is C): .RS .sp -.B ntfscp -N stream /dev/hda1 myfile /some/path/file +.B ntfscp -N stream /dev/hda1 myfile /some/path .SH BUGS No bugs are known at present. If you find any bugs, please send an email to .nh @@ -83,7 +95,10 @@ was written by Yura Pakhuchiy. .B ntfscp and this manual page is based on .B ntfscat -and it's manaul page by Richard Russon, so many thanks to him. +and it's manaul page by Richard Russon, so many thanks to him. Information about named data streams was partly taken from +.B ntfsdoc. +.SH DEDICATION +With love to Marina Sapego. .SH AVAILABILITY .B ntfscp is part of the ntfsprogs package and is available from diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 32afa639..6f851f54 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -70,7 +70,7 @@ static void version (void) { Printf ("\n%s v%s - Overwrite files on NTFS volume.\n\n", EXEC_NAME, VERSION); - Printf ("Copyright (c) 2004 Yura Pakhuchiy\n"); + Printf ("Copyright (c) 2004-2005 Yura Pakhuchiy\n"); Printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 4804d66e..ebd84169 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -651,6 +651,8 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) (long long)sle64_to_cpu(file_name_attr->allocated_size)); printf("\tReal File Size:\t\t %lld\n", (long long)sle64_to_cpu(file_name_attr->data_size)); + printf("\tParent directory:\t %lld\n", + (long long)MREF_LE(file_name_attr->parent_directory)); flags = file_name_attr->file_attributes; printf("\tFile attributes:\t"); if (flags & FILE_ATTR_READONLY) { From d2ed58e6a2d7eb86dde7debe35a71cc968c0f723 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 6 Jun 2005 04:26:28 +0000 Subject: [PATCH 2265/2994] Anyway, this extra check will not harm anybody, but in case windows support such names it's will be useful. --- libntfs/collate.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libntfs/collate.c b/libntfs/collate.c index 576930a8..1735fba0 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -81,9 +81,14 @@ static int ntfs_collate_file_name(ntfs_volume *vol, fn2->file_name, fn2->file_name_length, NTFS_COLLATION_ERROR, IGNORE_CASE, vol->upcase, vol->upcase_len); + if (!rc) { + rc = ntfs_names_collate(fn1->file_name, fn1->file_name_length, + fn2->file_name, fn2->file_name_length, + NTFS_COLLATION_ERROR, CASE_SENSITIVE, + vol->upcase, vol->upcase_len); + } ntfs_debug("Done, returning %i.", rc); return rc; - } typedef int (*ntfs_collate_func_t)(ntfs_volume *, const void *, const int, From 01ac8414eac7d7dabbd655f32d1814806acf5f37 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 6 Jun 2005 09:18:33 +0000 Subject: [PATCH 2266/2994] Fix typo. --- NEWS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index e3a7ec37..f9ba6646 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,9 @@ Current news ============ -Attribute resize code for normal and sparse files is completed. Thus ntfscp -should always successfully overwrite any normal or sparse even if file size is -changed. +Attribute resize code for normal and sparse files is completed. Thus, ntfscp +should always successfully overwrite any normal or sparse file even if file +size is changed. Moved back from BitKeeper to CVS on SF.net. From 6bfbf20a197e16bab7bf7467d2231eb61390b5b2 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 6 Jun 2005 14:21:53 +0000 Subject: [PATCH 2267/2994] Fix warnings. (Yuval) --- ntfsprogs/ntfsinfo.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index ebd84169..e06e544f 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -480,7 +480,7 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) flags &= ~FILE_ATTR_ENCRYPTED; } if (flags) - printf(" UNKNOWN: 0x%x", le32_to_cpu(flags)); + printf(" UNKNOWN: 0x%x", (unsigned int)le32_to_cpu(flags)); printf("\n"); printf("\tMax Number of Versions:\t %u \n", @@ -576,7 +576,8 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) for(;(u8 *)entry < (u8 *) value + l; entry = (ATTR_LIST_ENTRY *) ((u8 *) entry + le16_to_cpu(entry->length))) { printf("\n"); - printf("\t\tAtrribute type:\t0x%X\n", le32_to_cpu(entry->type)); + printf("\t\tAtrribute type:\t0x%x\n", + (unsigned int)le32_to_cpu(entry->type)); printf("\t\tRecord length:\t%u\n", le16_to_cpu(entry->length)); printf("\t\tName length:\t%u\n", entry->name_length); @@ -716,7 +717,7 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) flags &= ~FILE_ATTR_DUP_VIEW_INDEX_PRESENT; } if (flags) - printf(" UNKNOWN: 0x%x", le32_to_cpu(flags)); + printf(" UNKNOWN: 0x%x", (unsigned int)le32_to_cpu(flags)); printf("\n"); /* time stuff stuff */ @@ -1126,7 +1127,7 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) Vprintf("\t\tFILE record number:\t %llu\n", MREF_LE(entry->indexed_file)); Vprintf("\t\tFile attributes:\t 0x%08x\n", - le32_to_cpu( + (unsigned int)le32_to_cpu( entry->key.file_name.file_attributes)); Vprintf("\t\tFile name namespace:\t 0x%02x\n", entry->key.file_name.file_name_type); From b10eb4cb2dbbc887e6bcd735eabf05edafb8f54a Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 6 Jun 2005 14:29:47 +0000 Subject: [PATCH 2268/2994] Minor cleanup --- ntfsprogs/mkntfs.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 58203b9b..a93957fc 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1,7 +1,7 @@ /** * mkntfs - Part of the Linux-NTFS project. * - * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2000-2005 Anton Altaparmakov * Copyright (c) 2001-2003 Richard Russon * * This utility will create an NTFS 1.2 (Windows NT 4.0) volume on a user @@ -540,16 +540,21 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, // TODO: Check that *val is really zero at pos and len. continue; } + /* + * Break up the write into the real data write and then a write + * of zeroes between the end of the real data and the end of + * the (last) run. + */ + if (total + length > val_len) { + delta = length; + length = val_len - total; + delta -= length; + } if (dev->d_ops->seek(dev, rl[i].lcn * vol->cluster_size, SEEK_SET) == (off_t)-1) return -1LL; retry = 0; do { - if (total + length > val_len) { - delta = length; - length = val_len - total; - delta -= length; - } bytes_written = dev->d_ops->write(dev, val + total, length); if (bytes_written == -1LL) { @@ -575,12 +580,15 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, } } if (delta) { + int eo; char *b = (char*)calloc(1, delta); if (!b) err_exit("Error allocating internal buffer: " "%s\n", strerror(errno)); bytes_written = mkntfs_write(dev, b, delta); + eo = errno; free(b); + errno = eo; if (bytes_written == -1LL) return bytes_written; } From 62a4484a94e95b29aa3b65b957ddce49c3f6f990 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 6 Jun 2005 14:30:38 +0000 Subject: [PATCH 2269/2994] Finally fix the win32 write support problems. --- libntfs/win32_io.c | 956 ++++++++++++++++++++++----------------------- 1 file changed, 459 insertions(+), 497 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 6efb19e5..26e77ac6 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -42,7 +42,11 @@ struct stat; struct ntfs_volume; typedef struct ntfs_volume ntfs_volume; -#include "config.h" +#ifndef NTFS_BLOCK_SIZE +#define NTFS_BLOCK_SIZE 512 +#define NTFS_BLOCK_SIZE_BITS 9 +#endif + #include "debug.h" /* Need device, but prevent ../include/types.h to be loaded. */ @@ -72,21 +76,20 @@ static LPFN_SETFILEPOINTEREX fnSetFilePointerEx = NULL; #define FNPOSTFIX "A" #endif -typedef struct win32_fd { +typedef struct { HANDLE handle; - int part_hidden_sectors; + s64 pos; /* Logical current position on the volume. */ s64 part_start; s64 part_length; - s64 real_pos; - int real_ofs; + int part_hidden_sectors; s64 geo_size, geo_cylinders; DWORD geo_sectors, geo_heads; HANDLE vol_handle; } win32_fd; /** - * ntfs_w32error_to_errno - Convert a win32 error code to the unix one - * @w32error The win32 error code. + * ntfs_w32error_to_errno - convert a win32 error code to the unix one + * @w32error: the win32 error code * * Limited to a relatively small but useful number of codes. */ @@ -158,7 +161,7 @@ static BOOL WINAPI libntfs_SetFilePointerEx(HANDLE hFile, } /** - * ntfs_device_win32_init_imports - initialize the function pointers. + * ntfs_device_win32_init_imports - initialize the function pointers * * The Find*Volume and SetFilePointerEx functions exist only on win2k+, as such * we cannot just staticly import them. @@ -209,41 +212,44 @@ static void ntfs_device_win32_init_imports(void) /** * ntfs_device_unix_status_flags_to_win32 - convert unix->win32 open flags - * @flags: Unix open status flags. + * @flags: unix open status flags * * Supported flags are O_RDONLY, O_WRONLY and O_RDWR. */ static __inline__ int ntfs_device_unix_status_flags_to_win32(int flags) { + int win_mode; + switch (flags & O_ACCMODE) { - case O_RDONLY: - return FILE_READ_DATA; - break; - case O_WRONLY: - return FILE_WRITE_DATA; - break; - case O_RDWR: - return FILE_READ_DATA | FILE_WRITE_DATA; - break; - default: - /* error */ - Dputs("win32_unix_status_flags_to_win32: flags unknown"); - return 0; + case O_RDONLY: + win_mode = FILE_READ_DATA; + break; + case O_WRONLY: + win_mode = FILE_WRITE_DATA; + break; + case O_RDWR: + win_mode = FILE_READ_DATA | FILE_WRITE_DATA; + break; + default: + /* error */ + Dputs("win32_unix_status_flags_to_win32: unknown flags"); + win_mode = 0; } + return win_mode; } /** - * ntfs_device_win32_simple_open_file - Just open a file via win32 API - * @filename: Name of the file to open. - * @handle: Pointer the a HANDLE in which to put the result. - * @flags: Unix open status flags. + * ntfs_device_win32_simple_open_file - just open a file via win32 API + * @filename: name of the file to open + * @handle: pointer the a HANDLE in which to put the result + * @flags: unix open status flags * @locking: will the function gain an exclusive lock on the file? * * Supported flags are O_RDONLY, O_WRONLY and O_RDWR. * * Return 0 if o.k. - * -1 if not, and errno set. in this case handle is trashed. + * -1 if not, and errno set. In this case handle is trashed. */ static int ntfs_device_win32_simple_open_file(const char *filename, HANDLE *handle, int flags, BOOL locking) @@ -252,7 +258,6 @@ static int ntfs_device_win32_simple_open_file(const char *filename, ntfs_device_unix_status_flags_to_win32(flags), locking ? 0 : (FILE_SHARE_WRITE | FILE_SHARE_READ), NULL, OPEN_EXISTING, 0, NULL); - if (*handle == INVALID_HANDLE_VALUE) { errno = ntfs_w32error_to_errno(GetLastError()); Dprintf("CreateFile(%s) failed.\n", filename); @@ -262,8 +267,8 @@ static int ntfs_device_win32_simple_open_file(const char *filename, } /** - * ntfs_device_win32_lock - Lock the volume - * @handle: A win32 HANDLE for a volume to lock. + * ntfs_device_win32_lock - lock the volume + * @handle: a win32 HANDLE for a volume to lock * * Locking a volume means no one can access its contents. * Exiting the process automatically unlocks the volume, except in old NT4s. @@ -274,6 +279,7 @@ static int ntfs_device_win32_simple_open_file(const char *filename, static int ntfs_device_win32_lock(HANDLE handle) { DWORD i; + if (!DeviceIoControl(handle, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &i, NULL)) { errno = ntfs_w32error_to_errno(GetLastError()); @@ -285,8 +291,8 @@ static int ntfs_device_win32_lock(HANDLE handle) } /** - * ntfs_device_win32_unlock - Unlock the volume - * @handle: The win32 HANDLE which the volume was locked with. + * ntfs_device_win32_unlock - unlock the volume + * @handle: the win32 HANDLE which the volume was locked with * * Return 0 if o.k. * -1 if not, and errno set. @@ -294,6 +300,7 @@ static int ntfs_device_win32_lock(HANDLE handle) static int ntfs_device_win32_unlock(HANDLE handle) { DWORD i; + if (!DeviceIoControl(handle, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &i, NULL)) { errno = ntfs_w32error_to_errno(GetLastError()); @@ -305,14 +312,14 @@ static int ntfs_device_win32_unlock(HANDLE handle) } /** - * ntfs_device_win32_dismount - Dismount a volume - * @handle: A win32 HANDLE for a volume to dismount. + * ntfs_device_win32_dismount - dismount a volume + * @handle: a win32 HANDLE for a volume to dismount * - * Dismounting means the system will refresh the volume in the first change - * it gets. Usefull after altering the file structures. + * Dismounting means the system will refresh the volume in the first change it + * gets. Usefull after altering the file structures. * The volume must be locked by the current process while dismounting. - * A side effect is that the volume is also unlocked, but you mustn't rely - * On this. + * A side effect is that the volume is also unlocked, but you must not rely om + * this. * * Return 0 if o.k. * -1 if not, and errno set. @@ -320,6 +327,7 @@ static int ntfs_device_win32_unlock(HANDLE handle) static int ntfs_device_win32_dismount(HANDLE handle) { DWORD i; + if (!DeviceIoControl(handle, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &i, NULL)) { errno = ntfs_w32error_to_errno(GetLastError()); @@ -332,8 +340,8 @@ static int ntfs_device_win32_dismount(HANDLE handle) } /** - * ntfs_device_win32_getsize - Get file size via win32 API - * @handle: Pointer the file HANDLE obtained via open. + * ntfs_device_win32_getsize - get file size via win32 API + * @handle: pointer the file HANDLE obtained via open * * Only works on ordinary files. * @@ -350,13 +358,13 @@ static s64 ntfs_device_win32_getsize(HANDLE handle) Dputs("Error: Couldn't get file size."); return -1; } - return ((s64)hiword << 32) + (s64)loword; + return ((s64)hiword << 32) + loword; } /** - * ntfs_device_win32_getdisklength - Get disk size via win32 API - * @handle: Pointer the file HANDLE obtained via open. - * @argp: Pointer to result buffer. + * ntfs_device_win32_getdisklength - get disk size via win32 API + * @handle: pointer the file HANDLE obtained via open + * @argp: pointer to result buffer * * Only works on PhysicalDriveX type handles. * @@ -380,16 +388,16 @@ static s64 ntfs_device_win32_getdisklength(HANDLE handle) } /** - * ntfs_device_win32_getntfssize - Get NTFS volume size via win32 API - * @handle: Pointer the file HANDLE obtained via open. - * @argp: Pointer to result buffer. + * ntfs_device_win32_getntfssize - get NTFS volume size via win32 API + * @handle: pointer the file HANDLE obtained via open + * @argp: pointer to result buffer * * Only works on NTFS volume handles. - * An annoying bug in windows is that a NTFS volume does not occupy the - * Entire partition, namely not the last sector (Which holds the backup - * Boot sector, and normally not interesting). - * Use this function to get the length of the accessible space through a - * given volume handle. + * An annoying bug in windows is that a NTFS volume does not occupy the entire + * partition, namely not the last sector (which holds the backup boot sector, + * and normally not interesting). + * Use this function to get the length of the accessible space through a given + * volume handle. * * Return The volume size if o.k. * -1 if not, and errno set. @@ -397,106 +405,101 @@ static s64 ntfs_device_win32_getdisklength(HANDLE handle) static s64 ntfs_device_win32_getntfssize(HANDLE handle) { #ifdef FSCTL_GET_NTFS_VOLUME_DATA - NTFS_VOLUME_DATA_BUFFER buf; + s64 rvl; DWORD i; + NTFS_VOLUME_DATA_BUFFER buf; if (!DeviceIoControl(handle, FSCTL_GET_NTFS_VOLUME_DATA, NULL, 0, &buf, sizeof(buf), &i, NULL)) { errno = ntfs_w32error_to_errno(GetLastError()); Dputs("Warnning: Couldn't get NTFS volume length."); return -1; - } else { - s64 rvl = buf.NumberSectors.QuadPart * buf.BytesPerSector; - Dprintf("NTFS volume length: 0x%llx\n", (long long)rvl); - return rvl; } + rvl = buf.NumberSectors.QuadPart * buf.BytesPerSector; + Dprintf("NTFS volume length: 0x%llx\n", (long long)rvl); #else - return -1; + errno = EINVAL; + rvl = -1; #endif + return rvl; } /** - * ntfs_device_win32_getgeo - Get CHS information of a drive. - * @handle: An open handle to the PhysicalDevice - * @fd: a win_fd structure that will be filled. + * ntfs_device_win32_getgeo - get CHS information of a drive + * @handle: an open handle to the PhysicalDevice + * @fd: a win_fd structure that will be filled * * Return 0 if o.k. - * -1 if not + * -1 if not, and errno set. * - * In Windows NT+: fills the members: size, sectors, cylinders - * and set heads to -1. - * In Windows XP+: fills the members: size, sectors, cylinders and heads. + * In Windows NT+: fills size, sectors, and cylinders and sets heads to -1. + * In Windows XP+: fills size, sectors, cylinders, and heads. * - * Note: in pre XP, this requires write permission, even though nothing is - * actually written. + * Note: In pre XP, this requires write permission, even though nothing is + * actually written. * - * if fails, set sectors, cylinders and heads to -1. + * If fails, sets sectors, cylinders, heads, and size to -1. */ static int ntfs_device_win32_getgeo(HANDLE handle, win32_fd *fd) { - BYTE buf[sizeof(DISK_GEOMETRY) + sizeof(DISK_PARTITION_INFO) + - sizeof(DISK_DETECTION_INFO) + 512]; DWORD i; BOOL rvl; + BYTE b[sizeof(DISK_GEOMETRY) + sizeof(DISK_PARTITION_INFO) + + sizeof(DISK_DETECTION_INFO) + 512]; - rvl = DeviceIoControl(handle,IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, - &buf, sizeof(buf), &i, NULL); + rvl = DeviceIoControl(handle, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, + 0, &b, sizeof(b), &i, NULL); if (rvl) { Dputs("GET_DRIVE_GEOMETRY_EX detected."); DISK_DETECTION_INFO *ddi = (PDISK_DETECTION_INFO) - (((PBYTE)(&((PDISK_GEOMETRY_EX)buf)->Data)) + - (((PDISK_PARTITION_INFO)(&((PDISK_GEOMETRY_EX)buf) - ->Data))->SizeOfPartitionInfo)); - - fd->geo_cylinders = ((DISK_GEOMETRY*)&buf)->Cylinders.QuadPart; - fd->geo_sectors = ((DISK_GEOMETRY*)&buf)->SectorsPerTrack; - fd->geo_size = ((DISK_GEOMETRY_EX*)&buf)->DiskSize.QuadPart; + (((PBYTE)(&((PDISK_GEOMETRY_EX)b)->Data)) + + (((PDISK_PARTITION_INFO) + (&((PDISK_GEOMETRY_EX)b)->Data))-> + SizeOfPartitionInfo)); + fd->geo_cylinders = ((DISK_GEOMETRY*)&b)->Cylinders.QuadPart; + fd->geo_sectors = ((DISK_GEOMETRY*)&b)->SectorsPerTrack; + fd->geo_size = ((DISK_GEOMETRY_EX*)&b)->DiskSize.QuadPart; switch (ddi->DetectionType) { - case DetectInt13: - fd->geo_cylinders = ddi->Int13.MaxCylinders; - fd->geo_sectors = ddi->Int13.SectorsPerTrack; - fd->geo_heads = ddi->Int13.MaxHeads; - return 0; - case DetectExInt13: - fd->geo_cylinders = ddi->ExInt13.ExCylinders; - fd->geo_sectors = - ddi->ExInt13.ExSectorsPerTrack; - fd->geo_heads = ddi->ExInt13.ExHeads; - return 0; - case DetectNone: - default: - break; + case DetectInt13: + fd->geo_cylinders = ddi->Int13.MaxCylinders; + fd->geo_sectors = ddi->Int13.SectorsPerTrack; + fd->geo_heads = ddi->Int13.MaxHeads; + return 0; + case DetectExInt13: + fd->geo_cylinders = ddi->ExInt13.ExCylinders; + fd->geo_sectors = ddi->ExInt13.ExSectorsPerTrack; + fd->geo_heads = ddi->ExInt13.ExHeads; + return 0; + case DetectNone: + default: + break; } } else fd->geo_heads = -1; - - rvl = DeviceIoControl(handle,IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, - &buf, sizeof(buf), &i, NULL); + rvl = DeviceIoControl(handle, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, + &b, sizeof(b), &i, NULL); if (rvl) { Dputs("GET_DRIVE_GEOMETRY detected."); - fd->geo_cylinders = ((DISK_GEOMETRY*)&buf)->Cylinders.QuadPart; - fd->geo_sectors = ((DISK_GEOMETRY*)&buf)->SectorsPerTrack; + fd->geo_cylinders = ((DISK_GEOMETRY*)&b)->Cylinders.QuadPart; + fd->geo_sectors = ((DISK_GEOMETRY*)&b)->SectorsPerTrack; fd->geo_size = fd->geo_cylinders * fd->geo_sectors * - ((DISK_GEOMETRY*)&buf)->TracksPerCylinder * - ((DISK_GEOMETRY*)&buf)->BytesPerSector; + ((DISK_GEOMETRY*)&b)->TracksPerCylinder * + ((DISK_GEOMETRY*)&b)->BytesPerSector; return 0; } - errno = ntfs_w32error_to_errno(GetLastError()); Dputs("Error: Couldn't retrieve disk geometry."); - fd->geo_cylinders = -1; fd->geo_sectors = -1; fd->geo_size = -1; - return -1; } /** - * ntfs_device_win32_open_file - Open a file via win32 API - * @filename: Name of the file to open. - * @fd: Pointer to win32 file device in which to put the result. - * @flags: Unix open status flags. + * ntfs_device_win32_open_file - open a file via win32 API + * @filename: name of the file to open + * @fd: pointer to win32 file device in which to put the result + * @flags: unix open status flags * * Return 0 if o.k. * -1 if not, and errno set. @@ -511,13 +514,11 @@ static __inline__ int ntfs_device_win32_open_file(char *filename, win32_fd *fd, /* open error */ return -1; } - /* fill fd */ fd->handle = handle; fd->part_start = 0; fd->part_length = ntfs_device_win32_getsize(handle); - fd->real_pos = 0; - fd->real_ofs = 0; + fd->pos = 0; fd->part_hidden_sectors = -1; fd->geo_size = -1; /* used as a marker that this is a file */ fd->vol_handle = INVALID_HANDLE_VALUE; @@ -525,50 +526,44 @@ static __inline__ int ntfs_device_win32_open_file(char *filename, win32_fd *fd, } /** - * ntfs_device_win32_open_drive - Open a drive via win32 API - * @dev: NTFS_DEVICE to open - * @handle: Win32 file handle to return - * @flags: Unix open status flags. + * ntfs_device_win32_open_drive - open a drive via win32 API + * @drive_id: drive to open + * @fd: pointer to win32 file device in which to put the result + * @flags: unix open status flags * * return 0 if o.k. - * -errno if not + * -1 if not, and errno set. */ static __inline__ int ntfs_device_win32_open_drive(int drive_id, win32_fd *fd, int flags) { - char filename[256]; HANDLE handle; int err; + char filename[MAX_PATH]; sprintf(filename, "\\\\.\\PhysicalDrive%d", drive_id); - if ((err = ntfs_device_win32_simple_open_file(filename, &handle, flags, TRUE))) { /* open error */ return err; } - /* store the drive geometry */ ntfs_device_win32_getgeo(handle, fd); - /* Just to be sure */ if (fd->geo_size == -1) fd->geo_size = ntfs_device_win32_getdisklength(handle); - /* fill fd */ fd->handle = handle; fd->part_start = 0; fd->part_length = fd->geo_size; - fd->real_pos = 0; - fd->real_ofs = 0; + fd->pos = 0; fd->part_hidden_sectors = -1; fd->vol_handle = INVALID_HANDLE_VALUE; - return 0; } /** - * ntfs_device_win32_open_volume_for_partition - find and open a volume. + * ntfs_device_win32_open_volume_for_partition - find and open a volume * * Windows NT/2k/XP handles volumes instead of partitions. * This function gets the partition details and return an open volume handle. @@ -615,28 +610,38 @@ static HANDLE ntfs_device_win32_open_volume_for_partition(unsigned int drive_id, Dprintf("win32_open_volume_for_partition: Processing %s\n", vol_name); - /* open the file */ handle = CreateFile(vol_name, - ntfs_device_unix_status_flags_to_win32(flags), FILE_SHARE_READ | - FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); - if (handle!=INVALID_HANDLE_VALUE) { -#define EXTENTS_SIZE sizeof(VOLUME_DISK_EXTENTS)+9*sizeof(DISK_EXTENT) - char extents[EXTENTS_SIZE]; + ntfs_device_unix_status_flags_to_win32(flags), + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, + OPEN_EXISTING, 0, NULL); + if (handle != INVALID_HANDLE_VALUE) { DWORD bytesReturned; +#define EXTENTS_SIZE sizeof(VOLUME_DISK_EXTENTS) + 9 * sizeof(DISK_EXTENT) + char extents[EXTENTS_SIZE]; - /* check physical locations */ + /* Check physical locations. */ if (DeviceIoControl(handle, - IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, extents, - EXTENTS_SIZE, &bytesReturned, NULL)) { - if (((VOLUME_DISK_EXTENTS *)extents)->NumberOfDiskExtents==1) { - DISK_EXTENT *extent = &((VOLUME_DISK_EXTENTS *)extents)-> - Extents[0]; + IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, + NULL, 0, extents, EXTENTS_SIZE, + &bytesReturned, NULL)) { + if (((VOLUME_DISK_EXTENTS *)extents)-> + NumberOfDiskExtents == 1) { + DISK_EXTENT *extent = &(( + VOLUME_DISK_EXTENTS *) + extents)->Extents[0]; if ((extent->DiskNumber==drive_id) && - (extent->StartingOffset.QuadPart==part_offset) && - (extent->ExtentLength.QuadPart==part_length)) { - /* Eureka! (Archimedes, 287 BC, "I have found it!") */ - fnFindVolumeClose(vol_find_handle); + (extent->StartingOffset. + QuadPart==part_offset) + && (extent-> + ExtentLength.QuadPart + == part_length)) { + /* + * Eureka! (Archimedes, 287 BC, + * "I have found it!") + */ + fnFindVolumeClose( + vol_find_handle); return handle; } } @@ -645,20 +650,19 @@ static HANDLE ntfs_device_win32_open_volume_for_partition(unsigned int drive_id, Dputs("win32_open_volume_for_partition: getExtents " "Failed!" ); } while (fnFindNextVolume(vol_find_handle, vol_name, MAX_PATH)); - - /* end of iteration through volumes */ + /* End of iteration through volumes. */ Dprintf("win32_open_volume_for_partition: Closing.\n"); fnFindVolumeClose(vol_find_handle); - return INVALID_HANDLE_VALUE; } /** - * ntfs_device_win32_find_partition - locates partition details by id. - * @handle HANDLE to the PhysicalDrive - * @partition_id The partition number to locate. - * @part_offset Pointer to where to put the offset to the partition. - * @part_length Pointer to where to put the length of the partition. + * ntfs_device_win32_find_partition - locates partition details by id + * @handle HANDLE to the PhysicalDrive + * @partition_id the partition number to locate + * @part_offset pointer to where to put the offset to the partition + * @part_length pointer to where to put the length of the partition + * @hidden_sectors pointer to where to put the hidden sectors * * This function requires an open PhysicalDrive handle and a partition_id. * If a partition with the required id is found on the supplied device, @@ -667,12 +671,13 @@ static HANDLE ntfs_device_win32_open_volume_for_partition(unsigned int drive_id, * Return TRUE if found, and sets the output parameters. * FALSE if not. */ -static BOOL ntfs_device_win32_find_partition(HANDLE handle,DWORD partition_id, +static BOOL ntfs_device_win32_find_partition(HANDLE handle, DWORD partition_id, s64 *part_offset, s64 *part_length, int *hidden_sectors) { - char buf[sizeof(DRIVE_LAYOUT_INFORMATION)+9*sizeof(PARTITION_INFORMATION)]; DRIVE_LAYOUT_INFORMATION *drive_layout; DWORD i; + char buf[sizeof(DRIVE_LAYOUT_INFORMATION) + + 9 * sizeof(PARTITION_INFORMATION)]; if (!DeviceIoControl(handle, IOCTL_DISK_GET_DRIVE_LAYOUT, NULL, 0, &buf, sizeof(buf), &i, NULL)) { @@ -680,73 +685,66 @@ static BOOL ntfs_device_win32_find_partition(HANDLE handle,DWORD partition_id, Dputs("Error: GetDriveLayout failed."); return FALSE; } - drive_layout = (DRIVE_LAYOUT_INFORMATION *)buf; for (i = 0; i < drive_layout->PartitionCount; i++) { - if (drive_layout->PartitionEntry[i].PartitionNumber == partition_id) { - *part_offset = - drive_layout->PartitionEntry[i].StartingOffset.QuadPart; - *part_length = - drive_layout->PartitionEntry[i].PartitionLength.QuadPart; - *hidden_sectors = drive_layout->PartitionEntry[i].HiddenSectors; + if (drive_layout->PartitionEntry[i].PartitionNumber == + partition_id) { + *part_offset = drive_layout->PartitionEntry[i]. + StartingOffset.QuadPart; + *part_length = drive_layout->PartitionEntry[i]. + PartitionLength.QuadPart; + *hidden_sectors = drive_layout->PartitionEntry[i]. + HiddenSectors; return TRUE; } } - return FALSE; } /** - * ntfs_device_win32_open_partition - Open a partition via win32 API - * @dev: NTFS_DEVICE to open - * @fd: Win32 file device to return - * @flags: Unix open status flags. + * ntfs_device_win32_open_partition - open a partition via win32 API + * @drive_id: drive to open + * @partition_id: partition to open + * @fd: win32 file device to return + * @flags: unix open status flags * * Return 0 if o.k. - * -1 if not + * -1 if not, and errno set. * * When fails, fd contents may have not been preserved. */ static int ntfs_device_win32_open_partition(int drive_id, unsigned int partition_id, win32_fd *fd, int flags) { - char drive_name[MAX_PATH]; - HANDLE handle; - int err; s64 part_start, part_length; - int hidden_sectors; + HANDLE handle; + int err, hidden_sectors; + char drive_name[MAX_PATH]; sprintf(drive_name, "\\\\.\\PhysicalDrive%d", drive_id); - /* Open the entire device without locking, ask questions later */ - if ((err = ntfs_device_win32_simple_open_file(drive_name, &handle, flags, - FALSE))) { - /* error */ + if ((err = ntfs_device_win32_simple_open_file(drive_name, &handle, + flags, FALSE))) { + /* error */ return err; } - if (ntfs_device_win32_find_partition(handle, partition_id, &part_start, &part_length, &hidden_sectors)) { s64 tmp; HANDLE vol_handle = ntfs_device_win32_open_volume_for_partition( drive_id, part_start, part_length, flags); - - /* store the drive geometry */ + /* Store the drive geometry. */ ntfs_device_win32_getgeo(handle, fd); - fd->handle = handle; - fd->real_pos = 0; - fd->real_ofs = 0; + fd->pos = 0; fd->part_start = part_start; fd->part_length = part_length; fd->part_hidden_sectors = hidden_sectors; - tmp = ntfs_device_win32_getntfssize(vol_handle); if (tmp > 0) fd->geo_size = tmp; else fd->geo_size = fd->part_length; - if (vol_handle != INVALID_HANDLE_VALUE) { if (((flags & O_RDWR) == O_RDWR) && ntfs_device_win32_lock(vol_handle)) { @@ -757,9 +755,10 @@ static int ntfs_device_win32_open_partition(int drive_id, fd->vol_handle = vol_handle; } else { if ((flags & O_RDWR) == O_RDWR) { - /* access if read-write, no volume found */ - Dputs("Partitions containing Spanned/Mirrored volumes are " - "not supported in R/W status yet"); + /* Access if read-write, no volume found. */ + Dputs("Partitions containing Spanned/Mirrored " + "volumes are not supported in " + "R/W status yet"); CloseHandle(handle); errno = ENOTSUP; return -1; @@ -768,7 +767,8 @@ static int ntfs_device_win32_open_partition(int drive_id, } return 0; } else { - Dprintf("partition %u not found on drive %d\n", partition_id, drive_id); + Dprintf("Partition %u not found on drive %d.\n", partition_id, + drive_id); CloseHandle(handle); errno = ENODEV; return -1; @@ -776,11 +776,11 @@ static int ntfs_device_win32_open_partition(int drive_id, } /** - * ntfs_device_win32_open - Open a device - * @dev: A pointer to the NTFS_DEVICE to open - * dev->d_name must hold the device name, the rest is ignored. - * @flags: Unix open status flags. + * ntfs_device_win32_open - open a device + * @dev: a pointer to the NTFS_DEVICE to open + * @flags: unix open status flags * + * @dev->d_name must hold the device name, the rest is ignored. * Supported flags are O_RDONLY, O_WRONLY and O_RDWR. * * If name is in format "(hd[0-9],[0-9])" then open a partition. @@ -836,77 +836,37 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) } /** - * ntfs_device_win32_seek - Change current file position. - * @handle: Pointer the file HANDLE obtained via open. - * @pos: Offset in the file relative to file start. + * ntfs_device_win32_seek - change current logical file position + * @dev: ntfs device obtained via ->open + * @offset: required offset from the whence anchor + * @whence: whence anchor specifying what @offset is relative to * - * Return Succeed: The new position in the file - * Fail: -1 and errno set. - */ -static s64 ntfs_device_win32_abs_seek(struct win32_fd *fd, s64 pos) -{ - LARGE_INTEGER li; - HANDLE handle; - - if (pos < 0 || pos > fd->part_length) { - Dputs("Error: Seeking outsize seekable area."); - errno = EINVAL; - return -1; - } - li.QuadPart = pos; - if (fd->vol_handle != INVALID_HANDLE_VALUE && pos < fd->geo_size) { - Dputs("Seeking via vol_handle"); - handle = fd->vol_handle; - } else { - Dputs("Seeking via handle"); - handle = fd->handle; - li.QuadPart += fd->part_start; - } - /* If the address is not alligned, we round down to nearest sector. */ - li.QuadPart &= ~(s64)(NTFS_BLOCK_SIZE - 1); - /* Only seek if we are not there already. */ - if (li.QuadPart != fd->real_pos) { - if (!fnSetFilePointerEx(handle, li, NULL, FILE_BEGIN)) { - errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: SetFilePointer failed."); - return -1; - } - fd->real_pos = li.QuadPart; - } - fd->real_ofs = pos & (NTFS_BLOCK_SIZE - 1); - return pos; -} - -/** - * ntfs_device_win32_seek - Change current file position. - * @handle: Pointer the file HANDLE obtained via open. - * @offset: Required offset from the whence anchor. - * @whence: May be one of the following: - * SEEK_SET Offset is relative to file start. - * SEEK_CUR Offset is relative to current position. - * SEEK_END Offset is relative to end of file. + * Return the new position on the volume on success and -1 on error with errno + * set to the error code. * - * Return 0 if o.k. - * -1 if not and errno set. + * @whence may be one of the following: + * SEEK_SET - Offset is relative to file start. + * SEEK_CUR - Offset is relative to current position. + * SEEK_END - Offset is relative to end of file. */ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, int whence) { s64 abs_ofs; - struct win32_fd *fd = (win32_fd *)dev->d_private; + win32_fd *fd = (win32_fd *)dev->d_private; - Dprintf("win32_seek(%lld=0x%llx,%d)\n", offset, offset, whence); + Dprintf("win32_seek(): offset = 0x%llx, whence = %d\n", offset, whence); switch (whence) { case SEEK_SET: abs_ofs = offset; break; case SEEK_CUR: - abs_ofs = fd->real_pos + fd->real_ofs + offset; + abs_ofs = fd->pos + offset; break; case SEEK_END: - /* end of partition != end of disk */ + /* End of partition != end of disk. */ if (fd->part_length == -1) { - Dputs("win32_seek: position relative to end " + Dputs("win32_seek(): Error: Position relative to end " "of disk not implemented."); errno = ENOTSUP; return -1; @@ -914,75 +874,114 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, abs_ofs = fd->part_length + offset; break; default: - Dprintf("win32_seek() wrong mode %d.\n", whence); + Dprintf("win32_seek(): Error: Wrong mode %d.\n", whence); errno = EINVAL; return -1; } - return ntfs_device_win32_abs_seek(fd, abs_ofs); + if (abs_ofs < 0 || abs_ofs > fd->part_length) { + Dputs("Error: Seeking outsize seekable area."); + errno = EINVAL; + return -1; + } + fd->pos = abs_ofs; + return abs_ofs; } /** - * ntfs_device_win32_read_simple - Positioned simple read. - * @fd: The private data of the NTFS_DEVICE. - * @buf: A pointer to where to put the contents. - * @count: How many bytes should be read. + * ntfs_device_win32_pio - positioned low level i/o + * @fd: win32 device descriptor obtained via ->open + * @pos: at which position to do i/o from/to + * @count: how many bytes should be transfered + * @b: source/destination buffer + * @write: TRUE if write transfer and FALSE if read transfer * - * On success returns the number of bytes read (can be < @count) and on error - * returns (DWORD)-1 and errno set. + * On success returns the number of bytes transfered (can be < @count) and on + * error returns -1 and errno set. Transfer starts from position @pos on @fd. * * Notes: - * - Reads from fd->real_pos NOT considering fd->real_ofs. - * - Does NOT advance fd->real_pos and fd->real_ofs. - * - @buf must be aligned to page boundary. - * - @count must be a multiple of the sector size. + * - @pos, @buf, and @count must be aligned to NTFS_BLOCK_SIZE. * - When dealing with volumes, a single call must not span both volume * and disk extents. + * - Does not use/set @fd->pos. */ -static DWORD ntfs_device_win32_read_simple(win32_fd *fd, void *buf, DWORD count) +static s64 ntfs_device_win32_pio(win32_fd *fd, const s64 pos, + const s64 count, void *b, const BOOL write) { + LARGE_INTEGER li; HANDLE handle; - DWORD br; + DWORD bt; + BOOL res; - if (fd->real_pos + fd->real_ofs < fd->geo_size && - fd->vol_handle != INVALID_HANDLE_VALUE) { - Dputs("Reading via vol_handle."); + Dprintf("win32_pio(): pos = 0x%llx, count = 0x%llx, direction = %s", + (long long)pos, (long long)count, write ? "write" : + "read"); + li.QuadPart = pos; + if (fd->vol_handle != INVALID_HANDLE_VALUE && pos < fd->geo_size) { + Dputs("Transfering via vol_handle."); handle = fd->vol_handle; } else { - Dputs("Reading via handle."); + Dputs("Transfering via handle."); handle = fd->handle; + li.QuadPart += fd->part_start; } - if (!ReadFile(handle, buf, count, &br, NULL)) { + if (!fnSetFilePointerEx(handle, li, NULL, FILE_BEGIN)) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: ReadFile() failed."); - return (DWORD)-1; + Dputs("Error: SetFilePointer failed."); + return -1; } - /* - * NOTE: The caller *MUST* update fd->real_pos and fd->real_ofs!!! - * Alternatively, caller can call ntfs_device_win32_{,abs_}seek(). - */ - return br; + if (write) + res = WriteFile(handle, b, count, &bt, NULL); + else + res = ReadFile(handle, b, count, &bt, NULL); + if (!res) { + errno = ntfs_w32error_to_errno(GetLastError()); + Dprintf("Error: %sFile() failed.\n", write ? "Write" : "Read"); + return -1; + } + return bt; } /** - * ntfs_device_win32_read - Read 'count' bytes from 'dev' into 'buf'. - * @dev: An NTFS_DEVICE obtained via the open command. - * @buf: A pointer to where to put the contents. - * @count: How many bytes should be read. + * ntfs_device_win32_pread_simple - positioned simple read + * @fd: win32 device descriptor obtained via ->open + * @pos: at which position to read from + * @count: how many bytes should be read + * @b: a pointer to where to put the contents * - * On success returns the amount of bytes actually read. - * On fail returns -1 and sets errno. + * On success returns the number of bytes read (can be < @count) and on error + * returns -1 and errno set. Read starts from position @pos. + * + * Notes: + * - @pos, @buf, and @count must be aligned to NTFS_BLOCK_SIZE. + * - When dealing with volumes, a single call must not span both volume + * and disk extents. + * - Does not use/set @fd->pos. */ -static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) +static inline s64 ntfs_device_win32_pread_simple(win32_fd *fd, const s64 pos, + const s64 count, void *b) { - s64 pos, to_read; - struct win32_fd *fd = (win32_fd *)dev->d_private; - BYTE *alignedbuffer; - int old_ofs; - DWORD i, br = 0; + return ntfs_device_win32_pio(fd, pos, count, b, FALSE); +} - old_ofs = fd->real_ofs; - pos = fd->real_pos + old_ofs; - to_read = (old_ofs + count + NTFS_BLOCK_SIZE - 1) & +/** + * ntfs_device_win32_read - read bytes from an ntfs device + * @dev: ntfs device obtained via ->open + * @b: pointer to where to put the contents + * @count: how many bytes should be read + * + * On success returns the number of bytes actually read (can be < @count). + * On error returns -1 with errno set. + */ +static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *b, s64 count) +{ + s64 old_pos, to_read, i, br = 0; + win32_fd *fd = (win32_fd *)dev->d_private; + BYTE *alignedbuffer; + int old_ofs, ofs; + + old_pos = fd->pos; + old_ofs = ofs = old_pos & (NTFS_BLOCK_SIZE - 1); + to_read = (ofs + count + NTFS_BLOCK_SIZE - 1) & ~(s64)(NTFS_BLOCK_SIZE - 1); /* Impose maximum of 2GB to be on the safe side. */ if (to_read > 0x80000000) { @@ -990,12 +989,13 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) to_read = 0x80000000; count = to_read - delta; } - Dprintf("win32_read(fd=%p,b=%p,count=0x%llx)->(%llx+%x:%llx)\n", fd, - buf, count, (long long)fd->real_pos, old_ofs, + Dprintf("win32_read(): fd = %p, b = %p, count = 0x%llx, pos = 0x%llx, " + "ofs = %i, to_read = 0x%llx\n", fd, b, + (long long)count, (long long)old_pos, ofs, (long long)to_read); - if (!((unsigned long)buf & (NTFS_BLOCK_SIZE - 1)) && !old_ofs && + if (!((unsigned long)b & (NTFS_BLOCK_SIZE - 1)) && !old_ofs && !(count & (NTFS_BLOCK_SIZE - 1))) - alignedbuffer = buf; + alignedbuffer = b; else { alignedbuffer = (BYTE *)VirtualAlloc(NULL, to_read, MEM_COMMIT, PAGE_READWRITE); @@ -1005,70 +1005,69 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *buf, s64 count) return -1; } } - if (fd->vol_handle != INVALID_HANDLE_VALUE && pos < fd->geo_size) { - s64 vol_to_read = fd->geo_size - pos; + if (fd->vol_handle != INVALID_HANDLE_VALUE && old_pos < fd->geo_size) { + s64 vol_to_read = fd->geo_size - old_pos; if (count > vol_to_read) { - br = ntfs_device_win32_read_simple(fd, - alignedbuffer, old_ofs + vol_to_read); - if (br == (DWORD)-1) + br = ntfs_device_win32_pread_simple(fd, + old_pos & ~(s64)(NTFS_BLOCK_SIZE - 1), + ofs + vol_to_read, alignedbuffer); + if (br == -1) goto read_error; to_read -= br; - if (br < old_ofs) { + if (br < ofs) { br = 0; goto read_partial; } - br -= old_ofs; - pos += br; - fd->real_pos = pos & ~(s64)(NTFS_BLOCK_SIZE - 1); - fd->real_ofs = pos & (NTFS_BLOCK_SIZE - 1); + br -= ofs; + fd->pos += br; + ofs = fd->pos & (NTFS_BLOCK_SIZE - 1); if (br != vol_to_read) goto read_partial; } } - if ((i = ntfs_device_win32_read_simple(fd, alignedbuffer + br, - to_read)) == (DWORD)-1) { + i = ntfs_device_win32_pread_simple(fd, + fd->pos & ~(s64)(NTFS_BLOCK_SIZE - 1), to_read, + alignedbuffer + br); + if (i == -1) { if (br) goto read_partial; goto read_error; } - if (i < fd->real_ofs) + if (i < ofs) goto read_partial; - i -= fd->real_ofs; + i -= ofs; br += i; if (br > count) br = count; - pos += br; - fd->real_pos = pos & ~(s64)(NTFS_BLOCK_SIZE - 1); - fd->real_ofs = pos & (NTFS_BLOCK_SIZE - 1); + fd->pos = old_pos + br; read_partial: - if (alignedbuffer != buf) { - memcpy((void*)buf, alignedbuffer + old_ofs, br); + if (alignedbuffer != b) { + memcpy((void*)b, alignedbuffer + old_ofs, br); VirtualFree(alignedbuffer, 0, MEM_RELEASE); } return br; read_error: - if (alignedbuffer != buf) + if (alignedbuffer != b) VirtualFree(alignedbuffer, 0, MEM_RELEASE); return -1; } /** - * ntfs_device_win32_close - Close an open NTFS_DEVICE and - * free internal buffers. - * @dev: An NTFS_DEVICE obtained via the open command. + * ntfs_device_win32_close - close an open ntfs deivce + * @dev: ntfs device obtained via ->open * * Return 0 if o.k. - * -errno if not, in this case handle is trashed. + * -1 if not, and errno set. Note if error fd->vol_handle is trashed. */ static int ntfs_device_win32_close(struct ntfs_device *dev) { - struct win32_fd *fd = (win32_fd *)dev->d_private; + win32_fd *fd = (win32_fd *)dev->d_private; BOOL rvl; Dprintf("win32_close(%p)\n", dev); if (!NDevOpen(dev)) { errno = EBADF; - return -errno; + return -1; } if (fd->vol_handle != INVALID_HANDLE_VALUE) { if (!NDevReadOnly(dev)) { @@ -1076,7 +1075,7 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) ntfs_device_win32_unlock(fd->vol_handle); } if (!CloseHandle(fd->vol_handle)) - Dputs("Error: CloseHandle failed for volume."); + Dputs("Error: CloseHandle() failed for volume."); } rvl = CloseHandle(fd->handle); free(fd); @@ -1089,14 +1088,14 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) } /** - * ntfs_device_win32_sync - Flush write buffers to disk. - * @dev: An NTFS_DEVICE obtained via the open command. + * ntfs_device_win32_sync - flush write buffers to disk + * @dev: ntfs device obtained via ->open * * Return 0 if o.k. - * -1 if not and errno set. + * -1 if not, and errno set. * * Note: Volume syncing works differently in windows. - * Disk can't be synced in windows. + * Disk cannot be synced in windows. */ static int ntfs_device_win32_sync(struct ntfs_device *dev) { @@ -1104,7 +1103,7 @@ static int ntfs_device_win32_sync(struct ntfs_device *dev) BOOL to_clear = TRUE; if (!NDevReadOnly(dev) && NDevDirty(dev)) { - struct win32_fd *fd = (win32_fd *)dev->d_private; + win32_fd *fd = (win32_fd *)dev->d_private; if ((fd->vol_handle != INVALID_HANDLE_VALUE) && !FlushFileBuffers(fd->vol_handle)) { @@ -1127,68 +1126,58 @@ static int ntfs_device_win32_sync(struct ntfs_device *dev) } /** - * ntfs_device_win32_write_simple - Write 'count' bytes from 'buf' into 'dev'. - * @dev: An NTFS_DEVICE obtained via the open command. - * @buf: A pointer to the contents. - * @count: How many bytes should be written. + * ntfs_device_win32_pwrite_simple - positioned simple write + * @fd: win32 device descriptor obtained via ->open + * @pos: at which position to write to + * @count: how many bytes should be written + * @b: a pointer to the data to write * - * On success returns the amount of bytes actually written. - * On success returns the number of bytes written and on error returns - * (DWORD)-1 and errno set. + * On success returns the number of bytes written and on error returns -1 and + * errno set. Write starts from position @pos. * * Notes: - * - Writes to fd->real_pos NOT considering fd->real_ofs. - * - Does NOT advance fd->real_pos and fd->real_ofs. - * - @buf must be aligned to page boundary. - * - @count must be a multiple of the sector size. + * - @pos, @buf, and @count must be aligned to NTFS_BLOCK_SIZE. * - When dealing with volumes, a single call must not span both volume * and disk extents. + * - Does not use/set @fd->pos. */ -static DWORD ntfs_device_win32_write_simple(win32_fd *fd, const void *buf, - DWORD count) +static inline s64 ntfs_device_win32_pwrite_simple(win32_fd *fd, const s64 pos, + const s64 count, const void *b) { - HANDLE handle; - DWORD bw; - - if (fd->real_pos + fd->real_ofs < fd->geo_size && - fd->vol_handle != INVALID_HANDLE_VALUE) { - Dputs("Writing via vol_handle"); - handle = fd->vol_handle; - } else { - Dputs("Writing via handle"); - handle = fd->handle; - } - if (!WriteFile(handle, buf, count, &bw, NULL)) { - errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: WriteFile failed."); - return (DWORD)-1; - } - /* - * NOTE: The caller *MUST* update fd->real_pos and fd->real_ofs!!! - * Alternatively, caller can call ntfs_device_win32_{,abs_}seek(). - */ - return bw; + return ntfs_device_win32_pio(fd, pos, count, (void *)b, TRUE); } /** - * ntfs_device_win32_write - Write 'count' bytes from 'buf' into 'dev'. - * @dev: An NTFS_DEVICE obtained via the open command. - * @buf: A pointer to the contents. - * @count: How many bytes should be written. + * ntfs_device_win32_write - write bytes to an ntfs device + * @dev: ntfs device obtained via ->open + * @b: pointer to the data to write + * @count: how many bytes should be written * - * On success returns the amount of bytes actually written. - * On fail returns -1 and errno set. + * On success returns the number of bytes actually written. + * On error returns -1 with errno set. */ -static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buf, +static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *b, s64 count) { - s64 pos, to_write; + s64 old_pos, to_write, i, bw = 0; win32_fd *fd = (win32_fd *)dev->d_private; BYTE *alignedbuffer; - int old_ofs; - DWORD i, bw = 0; + int old_ofs, ofs; - Dprintf("win32_write: Writing %lld bytes\n", (long long)count); + old_pos = fd->pos; + old_ofs = ofs = old_pos & (NTFS_BLOCK_SIZE - 1); + to_write = (ofs + count + NTFS_BLOCK_SIZE - 1) & + ~(s64)(NTFS_BLOCK_SIZE - 1); + /* Impose maximum of 2GB to be on the safe side. */ + if (to_write > 0x80000000) { + int delta = to_write - count; + to_write = 0x80000000; + count = to_write - delta; + } + Dprintf("win32_write(): fd = %p, b = %p, count = 0x%llx, " + "pos = 0x%llx, ofs = %i, to_write = 0x%llx\n", fd, b, + (long long)count, (long long)old_pos, ofs, + (long long)to_write); if (NDevReadOnly(dev)) { Dputs("win32_write: Device R/O, exiting."); errno = EROFS; @@ -1197,20 +1186,12 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buf, if (!count) return 0; NDevSetDirty(dev); - old_ofs = fd->real_ofs; - pos = fd->real_pos + old_ofs; - to_write = (old_ofs + count + NTFS_BLOCK_SIZE - 1) & - ~(s64)(NTFS_BLOCK_SIZE - 1); - /* Impose maximum of 2GB to be on the safe side. */ - if (to_write > 0x80000000) { - int delta = to_write - count; - to_write = 0x80000000; - count = to_write - delta; - } - if (!((unsigned long)buf & (NTFS_BLOCK_SIZE - 1)) && !old_ofs && + if (!((unsigned long)b & (NTFS_BLOCK_SIZE - 1)) && !old_ofs && !(count & (NTFS_BLOCK_SIZE - 1))) - alignedbuffer = buf; + alignedbuffer = (BYTE *)b; else { + s64 end; + alignedbuffer = (BYTE *)VirtualAlloc(NULL, to_write, MEM_COMMIT, PAGE_READWRITE); if (!alignedbuffer) { @@ -1219,80 +1200,75 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *buf, return -1; } /* Read first sector if start of write not sector aligned. */ - if (old_ofs) { - i = ntfs_device_win32_read_simple(fd, alignedbuffer, - NTFS_BLOCK_SIZE); + if (ofs) { + i = ntfs_device_win32_pread_simple(fd, + old_pos & ~(s64)(NTFS_BLOCK_SIZE - 1), + NTFS_BLOCK_SIZE, alignedbuffer); if (i != NTFS_BLOCK_SIZE) { if (i >= 0) errno = EIO; goto write_error; } } - /* Read last sector if end of write not sector aligned. */ - if ((pos + count) & (NTFS_BLOCK_SIZE - 1)) { - if (ntfs_device_win32_abs_seek(fd, (pos + count) & - ~(NTFS_BLOCK_SIZE - 1)) == -1) - goto write_error; - i = ntfs_device_win32_read_simple(fd, alignedbuffer + - to_write - NTFS_BLOCK_SIZE, - NTFS_BLOCK_SIZE); + /* + * Read last sector if end of write not sector aligned and last + * sector is either not the same as the first sector or it is + * the same as the first sector but this has not been read in + * yet, i.e. the start of the write is sector aligned. + */ + end = old_pos + count; + if ((end & (NTFS_BLOCK_SIZE - 1)) && + ((to_write > NTFS_BLOCK_SIZE) || !ofs)) { + i = ntfs_device_win32_pread_simple(fd, + end & ~(s64)(NTFS_BLOCK_SIZE - 1), + NTFS_BLOCK_SIZE, alignedbuffer + + to_write - NTFS_BLOCK_SIZE); if (i != NTFS_BLOCK_SIZE) { - if (ntfs_device_win32_abs_seek(fd, pos) == -1) { - fd->real_pos = pos & ~(s64) - (NTFS_BLOCK_SIZE - 1); - fd->real_ofs = old_ofs; - } if (i >= 0) errno = EIO; goto write_error; } } - /* Move the file position back so we can start writing. */ - if (ntfs_device_win32_abs_seek(fd, pos) == -1) { - fd->real_pos = pos & ~(s64)(NTFS_BLOCK_SIZE - 1); - fd->real_ofs = old_ofs; - goto write_error; - } /* Copy the data to be written into @alignedbuffer. */ - memcpy(alignedbuffer + old_ofs, buf, count); + memcpy(alignedbuffer + ofs, b, count); } - if (fd->vol_handle != INVALID_HANDLE_VALUE && pos < fd->geo_size) { - s64 vol_to_write = fd->geo_size - pos; - if (count > vol_to_read) { - bw = ntfs_device_win32_write_simple(fd, alignedbuffer, - old_ofs + vol_to_write); - if (bw == (DWORD)-1) + if (fd->vol_handle != INVALID_HANDLE_VALUE && old_pos < fd->geo_size) { + s64 vol_to_write = fd->geo_size - old_pos; + if (count > vol_to_write) { + bw = ntfs_device_win32_pwrite_simple(fd, + old_pos & ~(s64)(NTFS_BLOCK_SIZE - 1), + ofs + vol_to_write, alignedbuffer); + if (bw == -1) goto write_error; to_write -= bw; - if (bw < old_ofs) { + if (bw < ofs) { bw = 0; goto write_partial; } - bw -= old_ofs; - pos += bw; - fd->real_pos = pos & ~(s64)(NTFS_BLOCK_SIZE - 1); - fd->real_ofs = pos & (NTFS_BLOCK_SIZE - 1); + bw -= ofs; + fd->pos += bw; + ofs = fd->pos & (NTFS_BLOCK_SIZE - 1); if (bw != vol_to_write) goto write_partial; } } - if ((i = ntfs_device_win32_write_simple(fd, alignedbuffer + bw, - to_write)) == (DWORD)-1) { + i = ntfs_device_win32_pwrite_simple(fd, + fd->pos & ~(s64)(NTFS_BLOCK_SIZE - 1), to_write, + alignedbuffer + bw); + if (i == -1) { if (bw) goto write_partial; goto write_error; } - if (i < fd->real_ofs) + if (i < ofs) goto write_partial; - i -= fd->real_ofs; + i -= ofs; bw += i; if (bw > count) bw = count; - pos += bw; - fd->real_pos = pos & ~(s64)(NTFS_BLOCK_SIZE - 1); - fd->real_ofs = pos & (NTFS_BLOCK_SIZE - 1); + fd->pos = old_pos + bw; write_partial: - if (alignedbuffer != buf) + if (alignedbuffer != b) VirtualFree(alignedbuffer, 0, MEM_RELEASE); return bw; write_error: @@ -1301,63 +1277,57 @@ write_error: } /** - * ntfs_device_win32_stat - Get a Unix-like stat structure for the file. - * @dev: An NTFS_DEVICE obtained via the open command. - * @argp: A pointer to where to put the output. + * ntfs_device_win32_stat - get a unix-like stat structure for an ntfs device + * @dev: ntfs device obtained via ->open + * @buf: pointer to the stat structure to fill * - * Only st_mode & st_size are filled. + * Note: Only st_mode, st_size, and st_blocks are filled. * * Return 0 if o.k. * -1 if not and errno set. in this case handle is trashed. */ static int ntfs_device_win32_stat(struct ntfs_device *dev, struct stat *buf) { - mode_t st_mode; win32_fd *fd = (win32_fd *)dev->d_private; + mode_t st_mode; switch (GetFileType(fd->handle)) { - case FILE_TYPE_CHAR: - st_mode = S_IFCHR; - break; - case FILE_TYPE_DISK: - st_mode = S_IFBLK; - break; - case FILE_TYPE_PIPE: - st_mode = S_IFIFO; - break; - default: - st_mode = 0; + case FILE_TYPE_CHAR: + st_mode = S_IFCHR; + break; + case FILE_TYPE_DISK: + st_mode = S_IFBLK; + break; + case FILE_TYPE_PIPE: + st_mode = S_IFIFO; + break; + default: + st_mode = 0; } - - memset(buf,0,sizeof (struct stat)); + memset(buf, 0, sizeof(struct stat)); buf->st_mode = st_mode; buf->st_size = fd->part_length; if (buf->st_size != -1) buf->st_blocks = buf->st_size >> 9; else buf->st_size = 0; - return 0; } /** - * ntfs_win32_hdio_getgeo - Get drive geometry. - * @dev: An NTFS_DEVICE obtained via the open command. - * @argp: A pointer to where to put the output. + * ntfs_win32_hdio_getgeo - get drive geometry + * @dev: ntfs device obtained via ->open + * @argp: pointer to where to put the output * - * Requires windows NT/2k/XP only - * - * Currently only the 'start' field is filled + * Note: Works on windows NT/2k/XP only. * * Return 0 if o.k. - * -errno if not, in this case handle is trashed. + * -1 if not, and errno set. Note if error fd->handle is trashed. */ static __inline__ int ntfs_win32_hdio_getgeo(struct ntfs_device *dev, struct hd_geometry *argp) { - win32_fd *fd; - - fd = (win32_fd *)dev->d_private; + win32_fd *fd = (win32_fd *)dev->d_private; argp->heads = fd->geo_heads; argp->sectors = fd->geo_sectors; @@ -1367,33 +1337,30 @@ static __inline__ int ntfs_win32_hdio_getgeo(struct ntfs_device *dev, } /** - * ntfs_win32_blksszget - Get block device sector size. - * @dev: An NTFS_DEVICE obtained via the open command. - * @argp: A pointer to where to put the output. + * ntfs_win32_blksszget - get block device sector size + * @dev: ntfs device obtained via ->open + * @argp: pointer to where to put the output * - * Works on windows NT/2k/XP only + * Note: Works on windows NT/2k/XP only. * * Return 0 if o.k. - * -errno if not, in this case handle is trashed. + * -1 if not, and errno set. Note if error fd->handle is trashed. */ static __inline__ int ntfs_win32_blksszget(struct ntfs_device *dev,int *argp) { - win32_fd *fd; - DISK_GEOMETRY dg; + win32_fd *fd = (win32_fd *)dev->d_private; DWORD bytesReturned; - - fd = (win32_fd *)dev->d_private; + DISK_GEOMETRY dg; if (DeviceIoControl(fd->handle, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &dg, sizeof(DISK_GEOMETRY), &bytesReturned, NULL)) { /* success */ - *argp=dg.BytesPerSector; + *argp = dg.BytesPerSector; return 0; - } else { - errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: GET_DRIVE_GEOMETRY failed."); - return -errno; } + errno = ntfs_w32error_to_errno(GetLastError()); + Dputs("Error: GET_DRIVE_GEOMETRY failed."); + return -1; } static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, @@ -1401,60 +1368,55 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, { win32_fd *fd = (win32_fd *)dev->d_private; - Dprintf("win32_ioctl(%d) called.\n",request); - + Dprintf("win32_ioctl(%d) called.\n", request); switch (request) { #if defined(BLKGETSIZE) - case BLKGETSIZE: - Dputs("win32_ioctl: BLKGETSIZE detected."); - if (fd->part_length>=0) { - *(int *)argp = (int)(fd->part_length / 512); - return 0; - } else { - errno = ENOTSUP; - return -ENOTSUP; - } + case BLKGETSIZE: + Dputs("win32_ioctl(): BLKGETSIZE detected."); + if (fd->part_length >= 0) { + *(int *)argp = (int)(fd->part_length / 512); + return 0; + } + errno = ENOTSUP; + return -1; #endif #if defined(BLKGETSIZE64) - case BLKGETSIZE64: - Dputs("win32_ioctl: BLKGETSIZE64 detected."); - if (fd->part_length>=0) { - *(s64 *)argp = fd->part_length; - return 0; - } else { - errno = ENOTSUP; - return -ENOTSUP; - } + case BLKGETSIZE64: + Dputs("win32_ioctl(): BLKGETSIZE64 detected."); + if (fd->part_length >= 0) { + *(s64 *)argp = fd->part_length; + return 0; + } + errno = ENOTSUP; + return -1; #endif #ifdef HDIO_GETGEO - case HDIO_GETGEO: - Dputs("win32_ioctl: HDIO_GETGEO detected."); - return ntfs_win32_hdio_getgeo(dev,(struct hd_geometry *)argp); + case HDIO_GETGEO: + Dputs("win32_ioctl(): HDIO_GETGEO detected."); + return ntfs_win32_hdio_getgeo(dev, (struct hd_geometry *)argp); #endif #ifdef BLKSSZGET - case BLKSSZGET: - Dputs("win32_ioctl: BLKSSZGET detected."); - return ntfs_win32_blksszget(dev,(int *)argp); - break; + case BLKSSZGET: + Dputs("win32_ioctl(): BLKSSZGET detected."); + return ntfs_win32_blksszget(dev, (int *)argp); #endif - default: - Dprintf("win32_ioctl(): unimplemented ioctl %d.\n", - request); - errno = ENOTSUP; - return -1; + default: + Dprintf("win32_ioctl(): unimplemented ioctl %d.\n", request); + errno = ENOTSUP; + return -1; } } -static s64 ntfs_device_win32_pread(struct ntfs_device *dev, void *buf, +static s64 ntfs_device_win32_pread(struct ntfs_device *dev, void *b, s64 count, s64 offset) { - return ntfs_pread(dev, offset, count, buf); + return ntfs_pread(dev, offset, count, b); } -static s64 ntfs_device_win32_pwrite(struct ntfs_device *dev, const void *buf, +static s64 ntfs_device_win32_pwrite(struct ntfs_device *dev, const void *b, s64 count, s64 offset) { - return ntfs_pwrite(dev, offset, count, buf); + return ntfs_pwrite(dev, offset, count, b); } struct ntfs_device_operations ntfs_device_win32_io_ops = { From 1aeb91827cf278d5b24919308a2d6c32e56d9ae4 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 6 Jun 2005 14:31:37 +0000 Subject: [PATCH 2270/2994] Update build for changes to function detection in configure.ac. --- INSTALL | 11 +- Makefile.in | 37 +- aclocal.m4 | 8107 +++++++++++------- autogen.sh | 2 +- compile | 8 +- config.guess | 12 +- config.h.in | 6 +- config.sub | 10 +- configure | 16313 +++++++++++++++++++++++++++++++------ configure.ac | 12 +- depcomp | 53 +- doc/Makefile.in | 17 +- include/Makefile.in | 37 +- include/ntfs/Makefile.in | 17 +- install-sh | 6 +- libntfs/Makefile.in | 29 +- ltmain.sh | 3567 +++++--- missing | 16 +- mkinstalldirs | 6 +- ntfsprogs/Makefile.in | 19 +- 20 files changed, 21953 insertions(+), 6332 deletions(-) diff --git a/INSTALL b/INSTALL index 095b1eb4..56b077d6 100644 --- a/INSTALL +++ b/INSTALL @@ -1,7 +1,7 @@ Installation Instructions ************************* -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives @@ -189,8 +189,13 @@ them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc -will cause the specified gcc to be used as the C compiler (unless it is -overridden in the site shell script). +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. `configure' Invocation ====================== diff --git a/Makefile.in b/Makefile.in index 2cc9ac66..5cdc7e26 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 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. @@ -77,6 +77,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -87,6 +88,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -98,6 +103,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -127,13 +134,19 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -251,7 +264,13 @@ uninstall-info-am: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -263,7 +282,7 @@ $(RECURSIVE_TARGETS): local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ @@ -271,7 +290,13 @@ $(RECURSIVE_TARGETS): mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ @@ -292,7 +317,7 @@ maintainer-clean-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ diff --git a/aclocal.m4 b/aclocal.m4 index d0da9422..4ebc090e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.9.4 -*- Autoconf -*- +# generated automatically by aclocal 1.9.5 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 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. @@ -11,12 +11,63 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# serial 46 AC_PROG_LIBTOOL +# serial 47 AC_PROG_LIBTOOL + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# 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 And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +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_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" @@ -27,10 +78,13 @@ AC_SUBST(LIBTOOL)dnl # Prevent multiple expansion define([AC_PROG_LIBTOOL], []) -]) +])# _AC_PROG_LIBTOOL + +# AC_LIBTOOL_SETUP +# ---------------- AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.13)dnl +[AC_PREREQ(2.50)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl @@ -40,15 +94,105 @@ 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([LT_AC_PROG_SED])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 +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl _LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(AR, ar, false) +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +_LT_CC_BASENAME([$compiler]) + # Only perform the check for file, if the check method requires it case $deplibs_check_method in file_magic*) @@ -58,341 +202,120 @@ file_magic*) ;; esac -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], enable_win32_dll=yes, enable_win32_dll=no) -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes -# 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* - ;; +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default -*-*-linux*) - # Test if the compiler is 64bit - echo 'int i;' > conftest.$ac_ext - lt_cv_cc_64bit_output=no - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *"ELF 64"*) - lt_cv_cc_64bit_output=yes - ;; - 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 - ;; +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP -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])]) +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl - 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" ;; +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_AC_SYS_COMPILER + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; esac - ;; - ]) -esac - -_LT_AC_LTCONFIG_HACK - -]) - -# AC_LIBTOOL_HEADER_ASSERT -# ------------------------ -AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], -[AC_CACHE_CHECK([whether $CC supports assert without backlinking], - [lt_cv_func_assert_works], - [case $host in - *-*-solaris*) - if test "$GCC" = yes && test "$with_gnu_ld" != yes; then - case `$CC --version 2>/dev/null` in - [[12]].*) lt_cv_func_assert_works=no ;; - *) lt_cv_func_assert_works=yes ;; - esac - fi - ;; - esac]) - -if test "x$lt_cv_func_assert_works" = xyes; then - AC_CHECK_HEADERS(assert.h) -fi -])# AC_LIBTOOL_HEADER_ASSERT - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h) -])# _LT_AC_CHECK_DLFCN - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $host_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[[ABCDGISTW]]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. -lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[[]] = -{ -EOF - sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AC_FD_CC - fi - else - echo "cannot find nm_test_var in $nlist" >&AC_FD_CC - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC - fi - else - echo "$progname: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` ]) -global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" -if test -z "$lt_cv_sys_global_symbol_pipe"; then - global_symbol_to_cdecl= - global_symbol_to_c_name_address= -else - global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" - global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" -fi -if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; -then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR -# --------------------------------- -AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], -[# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi -])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_LINKER_BOILERPLATE + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + # _LT_AC_PROG_ECHO_BACKSLASH # -------------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR - +[_LT_AC_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -410,7 +333,7 @@ if test "X[$]1" = X--no-reexec; then elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else @@ -422,14 +345,14 @@ if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -456,8 +379,9 @@ else # # So, first we look for a working echo in the user's PATH. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -466,7 +390,7 @@ else break fi done - IFS="$save_ifs" + IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -539,17 +463,332 @@ if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then fi AC_SUBST(ECHO) -AC_DIVERT_POP -])# _LT_AC_PROG_ECHO_BACKSLASH +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + 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 + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + 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_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + 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 + ;; +AC_PROVIDE_IFELSE([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) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_REQUIRE([LT_AC_PROG_SED]) +AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + # _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ------------------------------------------------------------------ AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[if test "$cross_compiling" = yes; then : +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : [$4] else - AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext </dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" -need_locks="$enable_libtool_lock" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -if test x"$host" != x"$build"; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case $host_os in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="[$]2" - -AC_MSG_CHECKING([for objdir]) -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -AC_MSG_RESULT($objdir) - - -AC_ARG_WITH(pic, -[ --with-pic try to use only PIC/non-PIC objects [default=use both]], -pic_mode="$withval", pic_mode=default) -test -z "$pic_mode" && pic_mode=default - -# We assume here that the value for lt_cv_prog_cc_pic will not be cached -# in isolation, and that seeing it set (from the cache) indicates that -# the associated values are set (in the cache) correctly too. -AC_MSG_CHECKING([for $compiler option to produce PIC]) -AC_CACHE_VAL(lt_cv_prog_cc_pic, -[ lt_cv_prog_cc_pic= - lt_cv_prog_cc_shlib= - lt_cv_prog_cc_wl= - lt_cv_prog_cc_static= - lt_cv_prog_cc_no_builtin= - lt_cv_prog_cc_can_build_shared=$can_build_shared - - if test "$GCC" = yes; then - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-static' - - case $host_os in - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # not sure about C++ programs. - lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_cv_prog_cc_pic='-fno-common' - ;; - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_cv_prog_cc_pic=-Kconform_pic - fi - ;; - *) - lt_cv_prog_cc_pic='-fPIC' - ;; - esac - else - # PORTME Check for PIC flags for the system compiler. - case $host_os in - aix3* | aix4* | aix5*) - lt_cv_prog_cc_wl='-Wl,' - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_cv_prog_cc_static='-Bstatic' - else - lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - hpux9* | hpux10* | hpux11*) - # Is there a better lt_cv_prog_cc_static that works with the bundled CC? - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" - lt_cv_prog_cc_pic='+Z' - ;; - - irix5* | irix6* | nonstopux*) - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - - newsos6) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - ;; - - osf3* | osf4* | osf5*) - # All OSF/1 code is PIC. - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - ;; - - sco3.2v5*) - lt_cv_prog_cc_pic='-Kpic' - lt_cv_prog_cc_static='-dn' - lt_cv_prog_cc_shlib='-belf' - ;; - - solaris*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - sunos4*) - lt_cv_prog_cc_pic='-PIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Qoption ld ' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - uts4*) - lt_cv_prog_cc_pic='-pic' - lt_cv_prog_cc_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_cv_prog_cc_pic='-Kconform_pic' - lt_cv_prog_cc_static='-Bstatic' - fi - ;; - - *) - lt_cv_prog_cc_can_build_shared=no - ;; - esac - fi + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* ]) -if test -z "$lt_cv_prog_cc_pic"; then - AC_MSG_RESULT([none]) -else - AC_MSG_RESULT([$lt_cv_prog_cc_pic]) - - # Check to make sure the pic_flag actually works. - AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) - AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - AC_TRY_COMPILE([], [], [dnl - case $host_os in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then - # they create non-PIC objects. So, if there were any warnings, we - # assume that PIC is not supported. - if test -s conftest.err; then - lt_cv_prog_cc_pic_works=no - else - lt_cv_prog_cc_pic_works=yes - fi - ;; - *) - lt_cv_prog_cc_pic_works=yes - ;; - esac - ], [dnl - lt_cv_prog_cc_pic_works=no - ]) - CFLAGS="$save_CFLAGS" - ]) - - if test "X$lt_cv_prog_cc_pic_works" = Xno; then - lt_cv_prog_cc_pic= - lt_cv_prog_cc_can_build_shared=no - else - lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" - fi - - AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) -fi - -# Check for any special shared library compilation flags. -if test -n "$lt_cv_prog_cc_shlib"; then - AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) - lt_cv_prog_cc_can_build_shared=no - fi -fi - -AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) -AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl - lt_cv_prog_cc_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) - LDFLAGS="$save_LDFLAGS" -]) - -# Belt *and* braces to stop my trousers falling down: -test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) - -pic_flag="$lt_cv_prog_cc_pic" -special_shlib_compile_flags="$lt_cv_prog_cc_shlib" -wl="$lt_cv_prog_cc_wl" -link_static_flag="$lt_cv_prog_cc_static" -no_builtin_flag="$lt_cv_prog_cc_no_builtin" -can_build_shared="$lt_cv_prog_cc_can_build_shared" +])# AC_LIBTOOL_PROG_CC_C_O -# Check to see if options -o and -c are simultaneously supported by compiler -AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) -AC_CACHE_VAL([lt_cv_compiler_c_o], [ -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -echo "int some_variable = 0;" > conftest.$ac_ext -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" -compiler_c_o=no -if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - lt_cv_compiler_c_o=no - else - lt_cv_compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&AC_FD_CC - lt_cv_compiler_c_o=no -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null -]) -compiler_c_o=$lt_cv_compiler_c_o -AC_MSG_RESULT([$compiler_c_o]) - -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) - AC_CACHE_VAL([lt_cv_compiler_o_lo], [ - lt_cv_compiler_o_lo=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - save_objext="$ac_objext" - ac_objext=lo - AC_TRY_COMPILE([], [int some_variable = 0;], [dnl - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - lt_cv_compiler_o_lo=no - else - lt_cv_compiler_o_lo=yes - fi - ]) - ac_objext="$save_objext" - CFLAGS="$save_CFLAGS" - ]) - compiler_o_lo=$lt_cv_compiler_o_lo - AC_MSG_RESULT([$compiler_o_lo]) -else - compiler_o_lo=no -fi - +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- # Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes @@ -1131,764 +1052,77 @@ if test "$compiler_c_o" = no && test "$need_locks" != no; then ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then - AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS -if test "$GCC" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) - echo "int some_variable = 0;" > conftest.$ac_ext - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" - compiler_rtti_exceptions=no - AC_TRY_COMPILE([], [int some_variable = 0;], [dnl - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - compiler_rtti_exceptions=no - else - compiler_rtti_exceptions=yes - fi - ]) - CFLAGS="$save_CFLAGS" - AC_MSG_RESULT([$compiler_rtti_exceptions]) - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi -fi - -# See if the linker supports building shared libraries. -AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) - -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -old_archive_from_expsyms_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_into_libs=no -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -link_all_deplibs=unknown -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. -extract_expsyms_cmds= - -case $host_os in -cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; -openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ - sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ - test -f $output_objdir/impgen.exe || (cd $output_objdir && \ - if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ - else $CC -o impgen impgen.c ; fi)~ - $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' - - old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' - - # cygwin and mingw dlls have different entry points and sets of symbols - # to exclude. - # FIXME: what about values for MSVC? - dll_entry=__cygwin_dll_entry@12 - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ - case $host_os in - mingw*) - # mingw values - dll_entry=_DllMainCRTStartup@12 - dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ - ;; - esac - - # mingw and cygwin differ, and it's simplest to just exclude the union - # of the two symbol sets. - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one (in ltdll.c) - if test "x$lt_cv_need_dllmain" = "xyes"; then - ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " - ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ - test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' - else - ltdll_obj= - ltdll_cmds= - fi - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left be newer dlltools. - export_symbols_cmds="$ltdll_cmds"' - $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' - - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is. - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname-def; - else - echo EXPORTS > $output_objdir/$soname-def; - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \[$]# in - 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; - 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; - *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done; - fi~ - '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw* | pw32*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - hardcode_direct=yes - archive_cmds='' - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - shared_flag='${wl}-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall can do strange things, so it is better to - # generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='${wl}-berok' - # This is a bit strange, but is similar to how AIX traditionally builds - # it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' - # We need to add '_' to the symbols in $export_symbols first - #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - hardcode_direct=yes - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load $convenience' - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case $host_os in - hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case "$host_os" in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - #Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - export_dynamic_flag_spec='${wl}-Bexport' - ;; - - solaris*) - # gcc --version < 3.0 without binutils cannot create self contained - # shared libraries reliably, requiring libgcc.a to resolve some of - # the object symbols generated in some cases. Libraries that use - # assert need libgcc.a to resolve __eprintf, for example. Linking - # a copy of libgcc.a into every shared library to guarantee resolving - # such symbols causes other problems: According to Tim Van Holder - # , C++ libraries end up with a separate - # (to the application) exception stack for one thing. - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - [[12]].*) - cat <&2 - -*** Warning: Releases of GCC earlier than version 3.0 cannot reliably -*** create self contained shared libraries on Solaris systems, without -*** introducing a dependency on libgcc.a. Therefore, libtool is disabling -*** -no-undefined support, which will at least allow you to build shared -*** libraries. However, you may find that when you link such libraries -*** into an application without using GCC, you have to manually add -*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to -*** upgrade to a newer version of GCC. Another option is to rebuild your -*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. - -EOF - no_undefined_flag= - ;; - esac - fi - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5uw7* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs fi -AC_MSG_RESULT([$ld_shlibs]) -test "$ld_shlibs" = no && can_build_shared=no +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- # Check hardcoding attributes. -AC_MSG_CHECKING([how to hardcode library paths into programs]) -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ + test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. - hardcode_action=relink + _LT_AC_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate + _LT_AC_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. - hardcode_action=unsupported + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported fi -AC_MSG_RESULT([$hardcode_action]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) -striplib= +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then @@ -1896,17 +1130,33 @@ if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else AC_MSG_RESULT([no]) fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +])# AC_LIBTOOL_SYS_LIB_STRIP -reload_cmds='$LD$reload_flag -o $output$reload_objs' -test -z "$deplibs_check_method" && deplibs_check_method=unknown +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- # PORTME Fill in your ld.so characteristics -AC_MSG_CHECKING([dynamic linker characteristics]) +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) library_names_spec= libname_spec='lib$name' soname_spec= +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -1915,17 +1165,36 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) @@ -1935,7 +1204,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -1945,57 +1214,54 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can - # not hardcode correct soname into executable. Probably we can - # add versioning support to collect2, so additional links can - # be useful in future. + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}.so$major' + soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi - hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) - library_names_spec='${libname}.so' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[[45]]*) version_type=linux need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -2003,29 +1269,55 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows + shrext_cmds=".dll" need_version=no need_lib_prefix=no + case $GCC,$host_os in - yes,cygwin*) + yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog .libs/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac ;; - yes,mingw*) - library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` - ;; - yes,pw32*) - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - ;; + *) - library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -2038,30 +1330,58 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' - soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; -freebsd*) +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -2070,7 +1390,11 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - *) + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -2081,8 +1405,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -2090,14 +1414,45 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. - dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -2105,21 +1460,29 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) version_type=irix ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -2128,20 +1491,21 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) +linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. -linux-gnu*) +linux*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -2150,12 +1514,11 @@ linux-gnu*) # before this can be enabled. hardcode_into_libs=yes - case $host_cpu:$lt_cv_cc_64bit_output in - powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" - ;; - esac + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -2166,17 +1529,29 @@ linux-gnu*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -2186,7 +1561,17 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -2194,47 +1579,52 @@ newsos6) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case "$host_os" in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' + shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf + need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; @@ -2242,8 +1632,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -2253,7 +1643,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -2265,8 +1655,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -2287,39 +1677,948 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# Report the final consequences. + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_LIBTOOL_LANG_CXX_CONFIG + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + AC_LIBTOOL_LANG_F77_CONFIG + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + AC_LIBTOOL_LANG_GCJ_CONFIG + else + tagname="" + fi + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# 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_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# 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], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# 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_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# 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], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# 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_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# 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], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# 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_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# 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_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [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]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +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_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +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 + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$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_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl +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 $CC]) + 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. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname 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 + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + 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. + case `"$lt_cv_path_LD" -v 2>&1 &1 /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|DragonFly)/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_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + 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_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + 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 + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + 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*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the pathname to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + 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 + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + 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 + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_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* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL 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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL 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, lt_dlinit, + [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 + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +])# _LT_AC_LANG_CXX + +# _LT_AC_PROG_CXXCPP +# --------------- +AC_DEFUN([_LT_AC_PROG_CXXCPP], +[ +AC_REQUIRE([AC_PROG_CXX]) +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +fi +])# _LT_AC_PROG_CXXCPP + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[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])])])])])]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -2337,7 +2636,1188 @@ aix3*) fi ;; -aix4*) +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(hardcode_automatic, $1)=no +_LT_AC_TAGVAR(module_cmds, $1)= +_LT_AC_TAGVAR(module_expsym_cmds, $1)= +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + AC_PROG_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[[12]]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux9*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC*) + # Portland Group C++ compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_cv_prog_cc_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi]) - AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) - ;; - esac -fi -need_lc=${lt_cv_archive_cmds_need_lc-yes} +AC_LIBTOOL_CONFIG($1) -# The second clause should only fire when bootstrapping the +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_F77_CONFIG + + +# AC_LIBTOOL_LANG_GCJ_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)]) +AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG], +[AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_GCJ_CONFIG + + +# AC_LIBTOOL_LANG_RC_CONFIG +# -------------------------- +# Ensure that the configuration vars for the Windows resource compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)]) +AC_DEFUN([_LT_AC_LANG_RC_CONFIG], +[AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +_LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_RESTORE +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_RC_CONFIG + + +# AC_LIBTOOL_CONFIG([TAGNAME]) +# ---------------------------- +# If TAGNAME is not passed, then create an initial libtool script +# with a default configuration from the untagged config vars. Otherwise +# add code to config.status for appending the configuration named by +# TAGNAME from the matching tagged config vars. +AC_DEFUN([AC_LIBTOOL_CONFIG], +[# The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - : -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi - -if test -f "$ltmain"; then - trap "$rm \"${ofile}T\"; exit 1" 1 2 15 - $rm -f "${ofile}T" - - echo creating $ofile - + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS SED \ - AR AR_FLAGS CC LD LN_S NM SHELL \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ - postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ - old_striplib striplib file_magic_cmd export_symbols_cmds \ - deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - global_symbol_to_c_name_address \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + old_postinstall_cmds old_postuninstall_cmds \ + _LT_AC_TAGVAR(compiler, $1) \ + _LT_AC_TAGVAR(CC, $1) \ + _LT_AC_TAGVAR(LD, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \ + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \ + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \ + _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \ + _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \ + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \ + _LT_AC_TAGVAR(old_archive_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \ + _LT_AC_TAGVAR(predep_objects, $1) \ + _LT_AC_TAGVAR(postdep_objects, $1) \ + _LT_AC_TAGVAR(predeps, $1) \ + _LT_AC_TAGVAR(postdeps, $1) \ + _LT_AC_TAGVAR(compiler_lib_search_path, $1) \ + _LT_AC_TAGVAR(archive_cmds, $1) \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) \ + _LT_AC_TAGVAR(postinstall_cmds, $1) \ + _LT_AC_TAGVAR(postuninstall_cmds, $1) \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \ + _LT_AC_TAGVAR(allow_undefined_flag, $1) \ + _LT_AC_TAGVAR(no_undefined_flag, $1) \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \ + _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \ + _LT_AC_TAGVAR(hardcode_automatic, $1) \ + _LT_AC_TAGVAR(module_cmds, $1) \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) \ + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \ + _LT_AC_TAGVAR(exclude_expsyms, $1) \ + _LT_AC_TAGVAR(include_expsyms, $1); do case $var in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + _LT_AC_TAGVAR(old_archive_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \ + _LT_AC_TAGVAR(archive_cmds, $1) | \ + _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(module_cmds, $1) | \ + _LT_AC_TAGVAR(module_expsym_cmds, $1) | \ + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \ + _LT_AC_TAGVAR(export_symbols_cmds, $1) | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -2464,14 +4040,31 @@ if test -f "$ltmain"; then esac done - cat <<__EOF__ > "${ofile}T" -#! $SHELL + case $lt_echo in + *'\[$]0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'` + ;; + esac -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +ifelse([$1], [], + [cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + AC_MSG_NOTICE([creating $ofile])], + [cfgfile="$ofile"]) + + cat <<__EOF__ >> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -2486,24 +4079,28 @@ if test -f "$ltmain"; then # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed that does not truncate output. +# A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="${SED} -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# ### BEGIN LIBTOOL CONFIG +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: @@ -2517,7 +4114,10 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$need_lc +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -2525,6 +4125,12 @@ fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo @@ -2533,14 +4139,20 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# The default C compiler. -CC=$lt_CC +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) # Is the compiler the GNU C compiler? -with_gcc=$GCC +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP # The linker used to build libraries. -LD=$lt_LD +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) # Whether we need hard or soft links. LN_S=$lt_LN_S @@ -2549,7 +4161,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$STRIP +STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -2571,7 +4183,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_wl +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) # Object file suffix (normally "o"). objext="$ac_objext" @@ -2579,20 +4191,23 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_pic_flag +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) pic_mode=$pic_mode +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + # Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_compiler_c_o +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Can we write directly to a .lo ? -compiler_o_lo=$lt_compiler_o_lo - -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -2611,19 +4226,19 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_link_static_flag +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_no_builtin_flag +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) # Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) # Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) # Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) # Library versioning type. version_type=$version_type @@ -2640,26 +4255,50 @@ soname_spec=$lt_soname_spec # Commands used to build and install an old-style archive. RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) # Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) # Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) +module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) + # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -2667,10 +4306,10 @@ deplibs_check_method=$lt_deplibs_check_method file_magic_cmd=$lt_file_magic_cmd # Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) # Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds @@ -2679,13 +4318,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_global_symbol_pipe +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -2697,36 +4336,45 @@ shlibpath_var=$shlibpath_var shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) # Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. -hardcode_direct=$hardcode_direct +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) # Set to yes if using the -LDIR flag during linking hardcodes DIR into the # resulting binary. -hardcode_minus_L=$hardcode_minus_L +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" # Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) # Compile-time system search path for libraries sys_lib_search_path_spec=$lt_sys_lib_search_path_spec @@ -2735,30 +4383,33 @@ sys_lib_search_path_spec=$lt_sys_lib_search_path_spec sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" # Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) # The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) # Symbols that must always be exported. -include_expsyms=$lt_include_expsyms +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) -# ### END LIBTOOL CONFIG +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) __EOF__ +ifelse([$1],[], [ case $host_os in aix3*) - cat <<\EOF >> "${ofile}T" + cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -2771,11 +4422,1619 @@ EOF ;; esac + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDGIRSTW]]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDRT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC*) + # Portland Group C++ compiler. + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + ccc*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + unicos*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in - cygwin* | mingw* | pw32* | os2*) - cat <<'EOF' >> "${ofile}T" - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi[[45]]*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_automatic, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu | dragonfly*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + ia64*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + *) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ # /* ltdll.c starts here */ # #define WIN32_LEAN_AND_MEAN # #include @@ -2809,748 +6068,13 @@ EOF # return TRUE; # } # /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# 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 of the License, 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. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# /* O_BINARY isn't required (or even defined sometimes) under Unix */ -# #ifndef O_BINARY -# #define O_BINARY 0 -# #endif -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (dll < 1) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) - - mv -f "${ofile}T" "$ofile" || \ - (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") - chmod +x "$ofile" -fi - -])# _LT_AC_LTCONFIG_HACK - -# 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)]) +])# _LT_AC_FILE_LTDLL_C -# 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 -]) +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) -# 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 <&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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])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=$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_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 &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 dependent 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 -aix4* | aix5*) - 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` - ;; - *) # 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* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # 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 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) - 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 - ;; - -newos6*) - 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 - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -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 - 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*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - 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_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl -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=$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 LTDLINCL to the include flags for -# the libltdl header and adds --enable-ltdl-convenience to the -# configure arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library and LTDLINCL to the include flags for -# the libltdl header and adds --enable-ltdl-install to the configure -# arguments. Note that LIBLTDL and LTDLINCL 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 LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -]) # old names AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) @@ -3564,6 +6088,16 @@ AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) # This is just to silence aclocal about the macro not being used ifelse([AC_DISABLE_FAST_INSTALL]) +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # @@ -3577,157 +6111,174 @@ AC_DEFUN([LT_AC_PROG_SED], AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. -as_executable_p="test -f" 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_prog in sed gsed; do + for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done - - # 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 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/sed$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - { (exit 1); exit 1; } -} - _max=0 - _count=0 - # Add /usr/xpg4/bin/sed as it is typically found on Solaris - # along with /bin/sed that truncates output. - for _sed in $_sed_list /usr/xpg4/bin/sed; do - test ! -f ${_sed} && break - cat /dev/null > "$tmp/sed.in" - _count=0 - echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" - # Check for GNU sed and select it if it is found. - if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then - lt_cv_path_SED=${_sed} - break +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed fi - while true; do - cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" - mv "$tmp/sed.tmp" "$tmp/sed.in" - cp "$tmp/sed.in" "$tmp/sed.nl" - echo >>"$tmp/sed.nl" - ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break - cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break - # 40000 chars as input seems more than enough - test $_count -gt 10 && break - _count=`expr $_count + 1` - if test $_count -gt $_max; then - _max=$_count - lt_cv_path_SED=$_sed - fi - done done - rm -rf "$tmp" +done ]) -if test "X$SED" != "X"; then - lt_cv_path_SED=$SED -else - SED=$lt_cv_path_SED -fi +SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) - -dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN(PKG_CHECK_MODULES, [ - succeeded=no - - if test -z "$PKG_CONFIG"; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - fi - - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - AC_MSG_CHECKING(for $2) - - if $PKG_CONFIG --exists "$2" ; then - AC_MSG_RESULT(yes) - succeeded=yes - - AC_MSG_CHECKING($1_CFLAGS) - $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` - AC_MSG_RESULT($$1_CFLAGS) - - AC_MSG_CHECKING($1_LIBS) - $1_LIBS=`$PKG_CONFIG --libs "$2"` - AC_MSG_RESULT($$1_LIBS) - else - $1_CFLAGS="" - $1_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - ifelse([$4], ,echo $$1_PKG_ERRORS,) - fi - - AC_SUBST($1_CFLAGS) - AC_SUBST($1_LIBS) - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - ifelse([$3], , :, [$3]) - else - ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) - fi -]) - - - -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. - +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# # 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. - +# the Free Software Foundation; either version 2 of the License, 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 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then + pkg_cv_[]$1=$ac_cv_env_[]$1[]_value +elif test -n "$PKG_CONFIG"; then + if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then + pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.in +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], + [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) +AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], + [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) + +if test $pkg_failed = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met. +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details.])], + [$4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details. + +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES + +# Copyright (C) 2002, 2003, 2005 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. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- @@ -3740,26 +6291,15 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # 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.9.4])]) + [AM_AUTOMAKE_VERSION([1.9.5])]) -# AM_AUX_DIR_EXPAND +# AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 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. +# Copyright (C) 2001, 2003, 2005 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. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to @@ -3806,26 +6346,16 @@ AC_PREREQ([2.50])dnl am_aux_dir=`cd $ac_aux_dir && pwd` ]) -# AM_CONDITIONAL -*- Autoconf -*- +# AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# 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. -# 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 6 +# serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- @@ -3849,26 +6379,15 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# serial 7 -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # 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. -# 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 8 # 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, @@ -3877,7 +6396,6 @@ fi])]) # CC etc. in the Makefile, will ask for an AC_PROG_CC use... - # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. @@ -4017,27 +6535,16 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) -# Generate code to set up dependency tracking. -*- Autoconf -*- +# Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# 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. -# 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 +#serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ @@ -4096,30 +6603,19 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Do all the work for Automake. -*- Autoconf -*- +# 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, 2004 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # 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. -# 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. +# serial 12 -# 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 11 +# 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. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) @@ -4221,51 +6717,27 @@ for _am_header in $config_headers :; do done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +# Copyright (C) 2001, 2003, 2005 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. + # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. - -# Copyright (C) 2001, 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. - 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)]) -# -*- Autoconf -*- -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2005 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. -# 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 +# serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. @@ -4280,26 +6752,15 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) -# Check to see how 'make' treats includes. -*- Autoconf -*- +# Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005 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. -# 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 +# serial 3 # AM_MAKE_INCLUDE() # ----------------- @@ -4343,27 +6804,16 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) -# -*- Autoconf -*- +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# 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. -# Copyright (C) 1997, 1999, 2000, 2001, 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 3 +# serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -4389,27 +6839,16 @@ else fi ]) +# Copyright (C) 2003, 2004, 2005 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. + # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - -# Copyright (C) 2003, 2004 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. - +# # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). @@ -4463,26 +6902,15 @@ else fi AC_SUBST([mkdir_p])]) -# Helper functions for option handling. -*- Autoconf -*- +# Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005 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. -# 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 +# serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -4507,28 +6935,16 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. # -# Check to make sure that the build environment is sane. -# +# 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. -# Copyright (C) 1996, 1997, 2000, 2001, 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 3 +# serial 4 # AM_SANITY_CHECK # --------------- @@ -4571,25 +6987,14 @@ Check your system clock]) fi AC_MSG_RESULT(yes)]) +# Copyright (C) 2001, 2003, 2005 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. + # AM_PROG_INSTALL_STRIP - -# Copyright (C) 2001, 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. - +# --------------------- # 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 @@ -4612,25 +7017,13 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004 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 +# Copyright (C) 2004, 2005 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. +# serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- diff --git a/autogen.sh b/autogen.sh index dcdf42a8..252fecd1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Run this to generate all the initial makefiles, etc. if test "$srcdir" == ""; then diff --git a/compile b/compile index 3d217032..ad57e2f6 100755 --- a/compile +++ b/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand `-c -o'. -scriptversion=2004-10-12.08 +scriptversion=2005-02-03.08 -# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -47,11 +47,11 @@ right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF - exit 0 + exit $? ;; -v | --v*) echo "compile $scriptversion" - exit 0 + exit $? ;; esac diff --git a/config.guess b/config.guess index 82294713..892833f9 100755 --- a/config.guess +++ b/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2004-11-12' +timestamp='2005-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -804,6 +804,9 @@ EOF i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; + amd64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; @@ -1197,6 +1200,9 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit 0 ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; diff --git a/config.h.in b/config.h.in index 4e8af4c5..ac28e176 100644 --- a/config.h.in +++ b/config.h.in @@ -6,6 +6,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_BYTESWAP_H +/* Define to 1 if you have the header file. */ +#undef HAVE_CTYPE_H + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H @@ -93,9 +96,6 @@ /* Define to 1 if you have the `regcomp' function. */ #undef HAVE_REGCOMP -/* Define to 1 if you have the `SetFilePointerEx' function. */ -#undef HAVE_SETFILEPOINTEREX - /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE diff --git a/config.sub b/config.sub index 0f84ac2c..d8fd2f8f 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2004-11-30' +timestamp='2005-02-10' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -70,7 +70,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -237,7 +237,7 @@ case $basic_machine in | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | mcore \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -310,7 +310,7 @@ case $basic_machine in | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ diff --git a/configure b/configure index 1599cf74..303780b1 100755 --- a/configure +++ b/configure @@ -243,17 +243,6 @@ IFS=" $as_nl" $as_unset CDPATH -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi - # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -272,7 +261,7 @@ if test "X$1" = X--no-reexec; then elif test "X$1" = X--fallback-echo; then # Avoid inline document here, it may be left over : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then # Yippee, $echo works! : else @@ -284,14 +273,14 @@ if test "X$1" = X--fallback-echo; then # used as fallback echo shift cat </dev/null 2>&1 && unset CDPATH if test -z "$ECHO"; then if test "X${echo_test_string+set}" != Xset; then @@ -318,8 +307,9 @@ else # # So, first we look for a working echo in the user's PATH. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && @@ -328,7 +318,7 @@ else break fi done - IFS="$save_ifs" + IFS="$lt_save_ifs" if test "X$echo" = Xecho; then # We didn't find a better echo, so look for alternatives. @@ -402,6 +392,11 @@ fi + +tagnames=${tagnames+${tagnames},}CXX + +tagnames=${tagnames+${tagnames},}F77 + # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. @@ -471,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 ECHO RANLIB ac_ct_RANLIB CPP EGREP LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -932,6 +927,38 @@ ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +ac_env_CXXCPP_set=${CXXCPP+set} +ac_env_CXXCPP_value=$CXXCPP +ac_cv_env_CXXCPP_set=${CXXCPP+set} +ac_cv_env_CXXCPP_value=$CXXCPP +ac_env_F77_set=${F77+set} +ac_env_F77_value=$F77 +ac_cv_env_F77_set=${F77+set} +ac_cv_env_F77_value=$F77 +ac_env_FFLAGS_set=${FFLAGS+set} +ac_env_FFLAGS_value=$FFLAGS +ac_cv_env_FFLAGS_set=${FFLAGS+set} +ac_cv_env_FFLAGS_value=$FFLAGS +ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_env_PKG_CONFIG_value=$PKG_CONFIG +ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG +ac_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} +ac_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS +ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} +ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS +ac_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} +ac_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS +ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} +ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS # # Report the --help message. @@ -1014,8 +1041,10 @@ if test -n "$ac_init_help"; then Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-shared=PKGS build shared libraries default=yes - --enable-static=PKGS build static libraries default=yes + --enable-shared[=PKGS] + build shared libraries [default=yes] + --enable-static[=PKGS] + build static libraries [default=yes] --enable-debug enable additional debugging code and output --disable-default-device-io-ops do not provide default device io operations @@ -1025,15 +1054,19 @@ Optional Features: --enable-warnings enable additional compiler warnings --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors - --enable-fast-install=PKGS optimize for fast installation 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 + --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] + --with-tags[=TAGS] + include additional configurations [automatic] Some influential environment variables: CC C compiler command @@ -1043,6 +1076,16 @@ Some influential environment variables: CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags + PKG_CONFIG path to pkg-config utility + LIBNTFS_GNOMEVFS_CFLAGS + C compiler flags for LIBNTFS_GNOMEVFS, overriding pkg-config + LIBNTFS_GNOMEVFS_LIBS + linker flags for LIBNTFS_GNOMEVFS, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2019,47 +2062,51 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' 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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else enable_static=yes fi; + # This is required to get past a stupid configure bug when making the rpm. # Basically it is broken to specify the host as a command line argument to # configure on its own, i.e. without giving --host=. It is supposed to work @@ -3383,35 +3430,98 @@ fi 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 + 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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac else enable_fast_install=yes fi; -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done + fi +SED=$lt_cv_path_SED +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 + +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 + 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then @@ -3423,8 +3533,8 @@ 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 + echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw @@ -3434,12 +3544,12 @@ echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 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'` + # Canonicalize the pathname 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%/%"` + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -3463,22 +3573,26 @@ if test "${lt_cv_path_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do + IFS="$lt_save_ifs" 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 + case `"$lt_cv_path_LD" -v 2>&1 &6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then +case `$LD -v 2>&1 &5 echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 @@ -3522,7 +3639,20 @@ 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" +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 @@ -3533,120 +3663,42 @@ else # Let the user override the test. lt_cv_path_NM="$NM" else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" 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 + 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 + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) 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 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + 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 + ;; + esac + esac fi done - IFS="$ac_save_ifs" + IFS="$lt_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi - +echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6 NM="$lt_cv_path_NM" -echo "$as_me:$LINENO: result: $NM" >&5 -echo "${ECHO_T}$NM" >&6 - -echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_executable_p="test -f" -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_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext" - fi - done - done -done - - # 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 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/sed$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - { (exit 1); exit 1; } -} - _max=0 - _count=0 - # Add /usr/xpg4/bin/sed as it is typically found on Solaris - # along with /bin/sed that truncates output. - for _sed in $_sed_list /usr/xpg4/bin/sed; do - test ! -f ${_sed} && break - cat /dev/null > "$tmp/sed.in" - _count=0 - echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in" - # Check for GNU sed and select it if it is found. - if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then - lt_cv_path_SED=${_sed} - break - fi - while true; do - cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp" - mv "$tmp/sed.tmp" "$tmp/sed.in" - cp "$tmp/sed.in" "$tmp/sed.nl" - echo >>"$tmp/sed.nl" - ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break - cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break - # 40000 chars as input seems more than enough - test $_count -gt 10 && break - _count=`expr $_count + 1` - if test $_count -gt $_max; then - _max=$_count - lt_cv_path_SED=$_sed - fi - done - done - rm -rf "$tmp" - -fi - -if test "X$SED" != "X"; then - lt_cv_path_SED=$SED -else - SED=$lt_cv_path_SED -fi -echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6 echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 @@ -3663,7 +3715,7 @@ lt_cv_deplibs_check_method='unknown' # '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. +# which responds to the $file_magic_cmd with a given extended 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. @@ -3676,37 +3728,36 @@ beos*) lt_cv_deplibs_check_method=pass_all ;; -bsdi4*) +bsdi[45]*) 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*) +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump'. 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=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac + lt_cv_deplibs_check_method=pass_all ;; -freebsd*) +freebsd* | kfreebsd*-gnu | dragonfly*) 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_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/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.*` ;; @@ -3720,50 +3771,44 @@ 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' +hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + 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_test_file=/usr/lib/libc.sl + ;; + esac ;; irix5* | irix6* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # 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" - ;; + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; 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 | mips | mipsel | powerpc* | sparc* | ia64* | x86_64*) - 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` +linux*) + lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; @@ -3773,20 +3818,19 @@ newos6*) lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; 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 ;; @@ -3795,11 +3839,6 @@ sco3.2v5*) ;; 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 ;; @@ -3826,6 +3865,10 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ;; esac ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; esac fi @@ -3833,211 +3876,210 @@ 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 +test -z "$deplibs_check_method" && deplibs_check_method=unknown +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC +# 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 && enable_libtool_lock=yes -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo "$as_me:$LINENO: checking command to parse $NM output" >&5 -echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris* | sysv5*) - symcode='[BDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $host_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[ABCDGISTW]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. -lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext < 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 - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 3922 "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); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + 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 + fi + rm -rf conftest* + ;; - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > 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.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; -EOF - # Now generate the symbol file. - eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' +*-*-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 -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = +int +main () { -EOF - sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr) 0} -}; -#ifdef __cplusplus + ; + return 0; } -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); } && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" -if test -z "$lt_cv_sys_global_symbol_pipe"; then - global_symbol_to_cdecl= - global_symbol_to_c_name_address= + (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 - global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" - global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no fi -if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; -then - echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6 -else - echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6 +rm -f conftest.err 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 + +need_locks="$enable_libtool_lock" + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4274,21 +4316,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 - 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - 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 @@ -4677,150 +4704,1399 @@ fi done - - - - - -# 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 +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + 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_CXX+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 <&2 + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -*** 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 +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&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 + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +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_CXX+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 <&2 + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -*** 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 +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# 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 &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +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_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" else - MAGIC_CMD=: + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + '' \ + '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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err 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 + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +depcc="$CXX" 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_CXX_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_CXX_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 + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch 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 + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + + +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_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 +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +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 + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6 +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 +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 \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +fi + + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran + 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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # 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_F77="$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 +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran +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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +echo "${ECHO_T}$ac_ct_F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_F77" && break +done + + F77=$ac_ct_F77 +fi + + +# Provide some information about the compiler. +echo "$as_me:5501:" \ + "checking for Fortran 77 compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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.err conftest.$ac_objext conftest.$ac_ext +ac_cv_f77_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_f77_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_f77_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= fi fi +G77=`test $ac_compiler_gnu = yes && echo yes` +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 + + + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for *BSD + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + = "XX$teststring") >/dev/null 2>&1 && + new_result=`expr "X$teststring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + teststring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +linux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDGIRSTW]' + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDRT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + 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); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6 +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES fi ;; esac +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" + 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_AR" && ac_cv_prog_ac_ct_AR="false" +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +fi + 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 @@ -4982,168 +6258,6 @@ else fi -enable_dlopen=no -enable_win32_dll=no - -# 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 && enable_libtool_lock=yes - -# 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 5000 "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* - ;; - -*-*-linux*) - # Test if the compiler is 64bit - echo 'int i;' > conftest.$ac_ext - lt_cv_cc_64bit_output=no - 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 - *"ELF 64"*) - lt_cv_cc_64bit_output=yes - ;; - 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 -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" -need_locks="$enable_libtool_lock" - old_CC="$CC" old_CFLAGS="$CFLAGS" @@ -5152,40 +6266,18 @@ test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru test -z "$AS" && AS=as test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$LD" && LD=ld test -z "$LN_S" && LN_S="ln -s" test -z "$MAGIC_CMD" && MAGIC_CMD=file test -z "$NM" && NM=nm +test -z "$SED" && SED=sed test -z "$OBJDUMP" && OBJDUMP=objdump test -z "$RANLIB" && RANLIB=: test -z "$STRIP" && STRIP=: test -z "$ac_objext" && ac_objext=o -if test x"$host" != x"$build"; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case $host_os in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' old_postinstall_cmds='chmod 644 $oldlib' @@ -5203,24 +6295,161 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="$2" +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs + +# 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 - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -echo "$as_me:$LINENO: result: $objdir" >&5 -echo "${ECHO_T}$objdir" >&6 + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + 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 <&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="$lt_save_ifs" + MAGIC_CMD="$lt_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 + +enable_dlopen=no +enable_win32_dll=no + +# 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 && enable_libtool_lock=yes # Check whether --with-pic or --without-pic was given. @@ -5232,453 +6461,497 @@ else fi; test -z "$pic_mode" && pic_mode=default -# We assume here that the value for lt_cv_prog_cc_pic will not be cached -# in isolation, and that seeing it set (from the cache) indicates that -# the associated values are set (in the cache) correctly too. -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 -if test "${lt_cv_prog_cc_pic+set}" = set; then +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +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 + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# +# Check for any special shared library compilation flags. +# +lt_prog_cc_shlib= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + lt_prog_cc_shlib='-belf' + ;; + esac +fi +if test -n "$lt_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 +if test "${lt_prog_compiler_static_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - lt_cv_prog_cc_pic= - lt_cv_prog_cc_shlib= - lt_cv_prog_cc_wl= - lt_cv_prog_cc_static= - lt_cv_prog_cc_no_builtin= - lt_cv_prog_cc_can_build_shared=$can_build_shared + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_prog_compiler_static" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works=yes + fi + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 + +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6599: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6603: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 if test "$GCC" = yes; then - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-static' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' case $host_os in - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # not sure about C++ programs. - lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi ;; + amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. - lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - lt_cv_prog_cc_pic='-fno-common' + lt_prog_compiler_pic='-fno-common' ;; - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no ;; + sysv4*MP*) if test -d /usr/nec; then - lt_cv_prog_cc_pic=-Kconform_pic + lt_prog_compiler_pic=-Kconform_pic fi ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + *) - lt_cv_prog_cc_pic='-fPIC' + lt_prog_compiler_pic='-fPIC' ;; esac else - # PORTME Check for PIC flags for the system compiler. + # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in - aix3* | aix4* | aix5*) - lt_cv_prog_cc_wl='-Wl,' - # All AIX code is PIC. + aix*) + lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_static='-Bstatic' else - lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic='-qnocommon' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; hpux9* | hpux10* | hpux11*) - # Is there a better lt_cv_prog_cc_static that works with the bundled CC? - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" - lt_cv_prog_cc_pic='+Z' + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' + lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' + lt_prog_compiler_static='-non_shared' ;; newsos6) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-static' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + esac ;; osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' + lt_prog_compiler_static='-non_shared' ;; sco3.2v5*) - lt_cv_prog_cc_pic='-Kpic' - lt_cv_prog_cc_static='-dn' - lt_cv_prog_cc_shlib='-belf' + lt_prog_compiler_pic='-Kpic' + lt_prog_compiler_static='-dn' ;; solaris*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac ;; sunos4*) - lt_cv_prog_cc_pic='-PIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Qoption ld ' + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - uts4*) - lt_cv_prog_cc_pic='-pic' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then - lt_cv_prog_cc_pic='-Kconform_pic' - lt_cv_prog_cc_static='-Bstatic' + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' fi ;; + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + *) - lt_cv_prog_cc_can_build_shared=no + lt_prog_compiler_can_build_shared=no ;; esac fi -fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic" >&6 -if test -z "$lt_cv_prog_cc_pic"; then - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 -else - echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then - # Check to make sure the pic_flag actually works. - echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 - if test "${lt_cv_prog_cc_pic_works+set}" = set; then +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6861: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6865: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works=yes + fi + fi + $rm conftest* -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - case $host_os in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then - # they create non-PIC objects. So, if there were any warnings, we - # assume that PIC is not supported. - if test -s conftest.err; then - lt_cv_prog_cc_pic_works=no - else - lt_cv_prog_cc_pic_works=yes - fi - ;; - *) - lt_cv_prog_cc_pic_works=yes - ;; - esac +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 +if test x"$lt_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - lt_cv_prog_cc_pic_works=no - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no fi - - if test "X$lt_cv_prog_cc_pic_works" = Xno; then - lt_cv_prog_cc_pic= - lt_cv_prog_cc_can_build_shared=no - else - lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" - fi - - echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac -# Check for any special shared library compilation flags. -if test -n "$lt_cv_prog_cc_shlib"; then - { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - -echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 -if test "${lt_cv_prog_cc_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_cc_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_prog_cc_static_works=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi - - -# Belt *and* braces to stop my trousers falling down: -test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 - -pic_flag="$lt_cv_prog_cc_pic" -special_shlib_compile_flags="$lt_cv_prog_cc_shlib" -wl="$lt_cv_prog_cc_wl" -link_static_flag="$lt_cv_prog_cc_static" -no_builtin_flag="$lt_cv_prog_cc_no_builtin" -can_build_shared="$lt_cv_prog_cc_can_build_shared" - - -# Check to see if options -o and -c are simultaneously supported by compiler echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_compiler_c_o+set}" = set; then +if test "${lt_cv_prog_compiler_c_o+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -echo "int some_variable = 0;" > conftest.$ac_ext -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" -compiler_c_o=no -if { (eval echo configure:5576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - lt_cv_compiler_c_o=no - else - lt_cv_compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&5 - lt_cv_compiler_c_o=no -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6923: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:6927: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 -compiler_c_o=$lt_cv_compiler_c_o -echo "$as_me:$LINENO: result: $compiler_c_o" >&5 -echo "${ECHO_T}$compiler_c_o" >&6 -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 - if test "${lt_cv_compiler_o_lo+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - lt_cv_compiler_o_lo=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - save_objext="$ac_objext" - ac_objext=lo - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -int some_variable = 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - lt_cv_compiler_o_lo=no - else - lt_cv_compiler_o_lo=yes - fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_objext="$save_objext" - CFLAGS="$save_CFLAGS" - -fi - - compiler_o_lo=$lt_cv_compiler_o_lo - echo "$as_me:$LINENO: result: $compiler_o_lo" >&5 -echo "${ECHO_T}$compiler_o_lo" >&6 -else - compiler_o_lo=no -fi - -# Check to see if we can do hard links to lock some files if needed hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 @@ -5699,15 +6972,359 @@ else need_locks=no fi -if test "$GCC" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 - echo "int some_variable = 0;" > conftest.$ac_ext - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" - compiler_rtti_exceptions=no - cat >conftest.$ac_ext <<_ACEOF +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag= + enable_shared_with_static_runtimes=no + archive_cmds= + archive_expsym_cmds= + old_archive_From_new_cmds= + old_archive_from_expsyms_cmds= + export_dynamic_flag_spec= + whole_archive_flag_spec= + thread_safe_flag_spec= + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + link_all_deplibs=unknown + hardcode_automatic=no + module_cmds= + module_expsym_cmds= + always_export_symbols=no + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -5717,14 +7334,14 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -int some_variable = 0; + ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -5738,788 +7355,596 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' + { 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 - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - compiler_rtti_exceptions=no - else - compiler_rtti_exceptions=yes - fi +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$compiler_rtti_exceptions" >&6 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi -fi + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -# See if the linker supports building shared libraries. -echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 +int +main () +{ -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -old_archive_from_expsyms_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_into_libs=no -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -link_all_deplibs=unknown -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. -extract_expsyms_cmds= + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 -case $host_os in -cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; -openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ - sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ - test -f $output_objdir/impgen.exe || (cd $output_objdir && \ - if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ - else $CC -o impgen impgen.c ; fi)~ - $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' - - old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' - - # cygwin and mingw dlls have different entry points and sets of symbols - # to exclude. - # FIXME: what about values for MSVC? - dll_entry=__cygwin_dll_entry@12 - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ - case $host_os in - mingw*) - # mingw values - dll_entry=_DllMainCRTStartup@12 - dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ - ;; - esac - - # mingw and cygwin differ, and it's simplest to just exclude the union - # of the two symbol sets. - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one (in ltdll.c) - if test "x$lt_cv_need_dllmain" = "xyes"; then - ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " - ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ - test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' - else - ltdll_obj= - ltdll_cmds= - fi - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left be newer dlltools. - export_symbols_cmds="$ltdll_cmds"' - $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' - - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is. - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname-def; - else - echo EXPORTS > $output_objdir/$soname-def; - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \$# in - 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; - 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;; - *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done; - fi~ - '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw* | pw32*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - hardcode_direct=yes - archive_cmds='' - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - shared_flag='${wl}-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec=' ' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi - fi - - # It seems that -bexpall can do strange things, so it is better to - # generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='${wl}-berok' - # This is a bit strange, but is similar to how AIX traditionally builds - # it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' ;; - *) # Darwin 1.3 on - allow_undefined_flag='-flat_namespace -undefined suppress' + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' - # We need to add '_' to the symbols in $export_symbols first - #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - hardcode_direct=yes - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load $convenience' - ;; - freebsd1*) - ld_shlibs=no - ;; + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case $host_os in - hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else + darwin* | rhapsody*) case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; + rhapsody* | darwin1.[012]) + allow_undefined_flag='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs=no + ;; esac fi - ;; + ;; - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; + freebsd1*) + ld_shlibs=no + ;; - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu | dragonfly*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + ia64*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + hardcode_shlibpath_var=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + *) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld='-rpath $libdir' + fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; - #Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - export_dynamic_flag_spec='${wl}-Bexport' - ;; + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; - solaris*) - # gcc --version < 3.0 without binutils cannot create self contained - # shared libraries reliably, requiring libgcc.a to resolve some of - # the object symbols generated in some cases. Libraries that use - # assert need libgcc.a to resolve __eprintf, for example. Linking - # a copy of libgcc.a into every shared library to guarantee resolving - # such symbols causes other problems: According to Tim Van Holder - # , C++ libraries end up with a separate - # (to the application) exception stack for one thing. - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - [12].*) - cat <&2 + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; -*** Warning: Releases of GCC earlier than version 3.0 cannot reliably -*** create self contained shared libraries on Solaris systems, without -*** introducing a dependency on libgcc.a. Therefore, libtool is disabling -*** -no-undefined support, which will at least allow you to build shared -*** libraries. However, you may find that when you link such libraries -*** into an application without using GCC, you have to manually add -*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to -*** upgrade to a newer version of GCC. Another option is to rebuild your -*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; -EOF - no_undefined_flag= - ;; - esac - fi - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then + sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no + export_dynamic_flag_spec='${wl}-Bexport' runpath_var=LD_RUN_PATH hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; + ;; - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; + solaris*) + no_undefined_flag=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + link_all_deplibs=yes + ;; - sysv5uw7* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + fi - *) - ld_shlibs=no - ;; - esac -fi echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no -# Check hardcoding attributes. -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +echo "${ECHO_T}$archive_cmds_need_lc" >&6 + ;; + esac fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6 + ;; +esac -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -reload_cmds='$LD$reload_flag -o $output$reload_objs' -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -# PORTME Fill in your ld.so characteristics echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 library_names_spec= libname_spec='lib$name' soname_spec= +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -6528,17 +7953,36 @@ shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib /usr/X11R6/lib" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown case $host_os in aix3*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' ;; aix4* | aix5*) @@ -6548,7 +7992,7 @@ aix4* | aix5*) hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file @@ -6558,57 +8002,54 @@ aix4* | aix5*) # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; esac - # AIX (on Power*) has no versioning support, so currently we can - # not hardcode correct soname into executable. Probably we can - # add versioning support to collect2, so additional links can - # be useful in future. + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}.so$major' + soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi - hardcode_into_libs=yes ;; amigaos*) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; beos*) - library_names_spec='${libname}.so' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs @@ -6616,29 +8057,55 @@ bsdi4*) cygwin* | mingw* | pw32*) version_type=windows + shrext_cmds=".dll" need_version=no need_lib_prefix=no + case $GCC,$host_os in - yes,cygwin*) + yes,cygwin* | yes,mingw* | yes,pw32*) library_names_spec='$libname.dll.a' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ - $install_prog .libs/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac ;; - yes,mingw*) - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"` - ;; - yes,pw32*) - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' - ;; + *) - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' @@ -6651,30 +8118,58 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' - soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; -freebsd*) +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -6683,7 +8178,11 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - *) + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; @@ -6694,8 +8193,8 @@ gnu*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; @@ -6703,14 +8202,45 @@ gnu*) hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. - dynamic_linker="$host_os dld.sl" version_type=sunos need_lib_prefix=no need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; @@ -6718,21 +8248,29 @@ hpux9* | hpux10* | hpux11*) irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; - *) version_type=irix ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; esac need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; @@ -6741,20 +8279,21 @@ irix5* | irix6* | nonstopux*) shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) +linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. -linux-gnu*) +linux*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -6763,12 +8302,11 @@ linux-gnu*) # before this can be enabled. hardcode_into_libs=yes - case $host_cpu:$lt_cv_cc_64bit_output in - powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes) - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /usr/X11R6/lib64" - sys_lib_search_path_spec="/lib64 /usr/lib64 /usr/local/lib64 /usr/X11R6/lib64" - ;; - esac + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the @@ -6779,17 +8317,29 @@ linux-gnu*) dynamic_linker='GNU/Linux ld.so' ;; +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -6799,7 +8349,17 @@ netbsd*) newsos6) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -6807,47 +8367,52 @@ newsos6) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case "$host_os" in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac else shlibpath_overrides_runpath=yes fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH ;; os2*) libname_spec='$name' + shrext_cmds=".dll" need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf + need_lib_prefix=no need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - hardcode_into_libs=yes ;; sco3.2v5*) version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH ;; @@ -6855,8 +8420,8 @@ solaris*) version_type=linux need_lib_prefix=no need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -6866,7 +8431,7 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes @@ -6878,8 +8443,8 @@ sunos4*) sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -6900,31 +8465,22 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) esac ;; -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - sysv4*MP*) if test -d /usr/nec ;then version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + *) dynamic_linker=no ;; @@ -6933,42 +8489,33 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no -# Report the final consequences. -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var" || \ + test "X$hardcode_automatic" = "Xyes" ; then -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 if test "$hardcode_action" = relink; then # Fast installation is not supported @@ -6979,9 +8526,33 @@ elif test "$shlibpath_overrides_runpath" = yes || enable_fast_install=needless fi -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac fi if test "x$enable_dlopen" != xyes; then @@ -6999,11 +8570,94 @@ else lt_cv_dlopen_self=yes ;; - cygwin* | mingw* | pw32*) + mingw* | pw32*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + *) echo "$as_me:$LINENO: checking for shl_load" >&5 echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 @@ -7487,7 +9141,7 @@ fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" @@ -7503,10 +9157,10 @@ else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6 fi -if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. +# Report which librarie types wil actually be built +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - if test "${lt_cv_archive_cmds_need_lc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - $rm conftest* - echo 'static int dummy;' > conftest.$ac_ext +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 - 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 - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_cv_prog_cc_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi -fi +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 - echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5 -echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 - ;; - esac -fi -need_lc=${lt_cv_archive_cmds_need_lc-yes} - -# The second clause should only fire when bootstrapping the +# The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh # with your package, and you will get complaints that there are # no rules to generate ltmain.sh. if test -f "$ltmain"; then - : -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi - -if test -f "$ltmain"; then - trap "$rm \"${ofile}T\"; exit 1" 1 2 15 - $rm -f "${ofile}T" - - echo creating $ofile - + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS SED \ - AR AR_FLAGS CC LD LN_S NM SHELL \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ - postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ - old_striplib striplib file_magic_cmd export_symbols_cmds \ - deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - global_symbol_to_c_name_address \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + old_postinstall_cmds old_postuninstall_cmds \ + compiler \ + CC \ + LD \ + lt_prog_compiler_wl \ + lt_prog_compiler_pic \ + lt_prog_compiler_static \ + lt_prog_compiler_no_builtin_flag \ + export_dynamic_flag_spec \ + thread_safe_flag_spec \ + whole_archive_flag_spec \ + enable_shared_with_static_runtimes \ + old_archive_cmds \ + old_archive_from_new_cmds \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + exclude_expsyms \ + include_expsyms; do case $var in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" ;; @@ -7820,14 +9479,29 @@ if test -f "$ltmain"; then esac done - cat <<__EOF__ > "${ofile}T" + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" #! $SHELL -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) # NOTE: Changes made to this file will be lost: look at ltmain.sh. # -# Copyright (C) 1996-2000 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: # Originally by Gordon Matzigkeit , 1996 # # This program is free software; you can redistribute it and/or modify @@ -7842,22 +9516,25 @@ if test -f "$ltmain"; then # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. -# A sed that does not truncate output. +# A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="${SED} -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# The names of the tagged configurations supported by this script. +available_tags= # ### BEGIN LIBTOOL CONFIG @@ -7873,7 +9550,10 @@ build_libtool_libs=$enable_shared build_old_libs=$enable_static # Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$need_lc +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Whether or not to optimize for fast installation. fast_install=$enable_fast_install @@ -7881,6 +9561,12 @@ fast_install=$enable_fast_install # The host system. host_alias=$host_alias host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os # An echo program that does not interpret backslashes. echo=$lt_echo @@ -7889,12 +9575,18 @@ echo=$lt_echo AR=$lt_AR AR_FLAGS=$lt_AR_FLAGS -# The default C compiler. -CC=$lt_CC +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler # Is the compiler the GNU C compiler? with_gcc=$GCC +# An ERE matcher. +EGREP=$lt_EGREP + # The linker used to build libraries. LD=$lt_LD @@ -7905,7 +9597,7 @@ LN_S=$lt_LN_S NM=$lt_NM # A symbol stripping program -STRIP=$STRIP +STRIP=$lt_STRIP # Used to examine libraries when file_magic_cmd begins "file" MAGIC_CMD=$MAGIC_CMD @@ -7927,7 +9619,7 @@ reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # How to pass a linker flag through the compiler. -wl=$lt_wl +wl=$lt_lt_prog_compiler_wl # Object file suffix (normally "o"). objext="$ac_objext" @@ -7935,20 +9627,23 @@ objext="$ac_objext" # Old archive suffix (normally "a"). libext="$libext" +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + # Executable file suffix (normally ""). exeext="$exeext" # Additional compiler flags for building library objects. -pic_flag=$lt_pic_flag +pic_flag=$lt_lt_prog_compiler_pic pic_mode=$pic_mode +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + # Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_compiler_c_o +compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Can we write directly to a .lo ? -compiler_o_lo=$lt_compiler_o_lo - -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -7967,10 +9662,10 @@ dlopen_self=$enable_dlopen_self dlopen_self_static=$enable_dlopen_self_static # Compiler flag to prevent dynamic linking. -link_static_flag=$lt_link_static_flag +link_static_flag=$lt_lt_prog_compiler_static # Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_no_builtin_flag +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec @@ -8012,10 +9707,34 @@ archive_expsym_cmds=$lt_archive_expsym_cmds postinstall_cmds=$lt_postinstall_cmds postuninstall_cmds=$lt_postuninstall_cmds +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -8035,13 +9754,13 @@ finish_cmds=$lt_finish_cmds finish_eval=$lt_finish_eval # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_global_symbol_pipe +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_global_symbol_to_cdecl +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -8062,10 +9781,15 @@ hardcode_into_libs=$hardcode_into_libs # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + # Whether we need a single -rpath flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the # resulting binary. hardcode_direct=$hardcode_direct @@ -8077,6 +9801,10 @@ hardcode_minus_L=$hardcode_minus_L # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic + # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. variables_saved_for_relink="$variables_saved_for_relink" @@ -8112,9 +9840,10 @@ include_expsyms=$lt_include_expsyms __EOF__ + case $host_os in aix3*) - cat <<\EOF >> "${ofile}T" + cat <<\EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -8123,186 +9852,6 @@ if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi -EOF - ;; - esac - - case $host_os in - cygwin* | mingw* | pw32* | os2*) - cat <<'EOF' >> "${ofile}T" - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# 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 of the License, 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. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# /* O_BINARY isn't required (or even defined sometimes) under Unix */ -# #ifndef O_BINARY -# #define O_BINARY 0 -# #endif -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (dll < 1) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - mv -f "${ofile}T" "$ofile" || \ - (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi 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 + +CC="$lt_save_CC" + + +# Check whether --with-tags or --without-tags was given. +if test "${with_tags+set}" = set; then + withval="$with_tags" + tagnames="$withval" +fi; + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} + else + { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 +echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in + "") ;; + *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 +echo "$as_me: error: invalid tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 +echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} + { (exit 1); exit 1; }; } + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_flag_spec_ld_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_automatic_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +compiler_CXX=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +else + lt_prog_compiler_no_builtin_flag_CXX= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + +# 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 $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $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. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname 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 + 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 + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + 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. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +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. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 +ld_shlibs_CXX=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_CXX=yes + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_CXX=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX=' ' + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs_CXX=no + fi + ;; + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_CXX=no + ;; + esac + fi + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + ld_shlibs_CXX=no + ;; + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + gnu*) + ;; + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_CXX='+b $libdir' + hardcode_libdir_separator_CXX=: + ;; + ia64*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + *) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + ;; + linux*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc*) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC*) + # Portland Group C++ compiler + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + openbsd*) + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd='echo' + ;; + osf3*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + sco*) + archive_cmds_need_lc_CXX=no + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + archive_cmds_need_lc_CXX=no + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; +esac +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +GCC_CXX="$GXX" +LD_CXX="$LD" + + +cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + +lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_CXX='-qnocommon' + lt_prog_compiler_wl_CXX='-Wl,' + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + icpc* | ecpc*) + # Intel C++ + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC*) + # Portland Group C++ compiler. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-static' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC*) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11509: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:11513: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 + +if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11571: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:11575: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_CXX=no + else + archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var_CXX" || \ + test "X$hardcode_automatic_CXX" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 +echo "${ECHO_T}$hardcode_action_CXX" >&6 + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_CXX \ + CC_CXX \ + LD_CXX \ + lt_prog_compiler_wl_CXX \ + lt_prog_compiler_pic_CXX \ + lt_prog_compiler_static_CXX \ + lt_prog_compiler_no_builtin_flag_CXX \ + export_dynamic_flag_spec_CXX \ + thread_safe_flag_spec_CXX \ + whole_archive_flag_spec_CXX \ + enable_shared_with_static_runtimes_CXX \ + old_archive_cmds_CXX \ + old_archive_from_new_cmds_CXX \ + predep_objects_CXX \ + postdep_objects_CXX \ + predeps_CXX \ + postdeps_CXX \ + compiler_lib_search_path_CXX \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_CXX + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_CXX +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_CXX + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_CXX" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld + + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + +archive_cmds_need_lc_F77=no +allow_undefined_flag_F77= +always_export_symbols_F77=no +archive_expsym_cmds_F77= +export_dynamic_flag_spec_F77= +hardcode_direct_F77=no +hardcode_libdir_flag_spec_F77= +hardcode_libdir_flag_spec_ld_F77= +hardcode_libdir_separator_F77= +hardcode_minus_L_F77=no +hardcode_automatic_F77=no +module_cmds_F77= +module_expsym_cmds_F77= +link_all_deplibs_F77=unknown +old_archive_cmds_F77=$old_archive_cmds +no_undefined_flag_F77= +whole_archive_flag_spec_F77= +enable_shared_with_static_runtimes_F77=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +objext_F77=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code=" subroutine t\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +compiler_F77=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4* | aix5*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +test "$ld_shlibs_F77" = no && can_build_shared=no + +GCC_F77="$G77" +LD_F77="$LD" + +lt_prog_compiler_wl_F77= +lt_prog_compiler_pic_F77= +lt_prog_compiler_static_F77= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_static_F77='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_F77=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_F77=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_F77='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + else + lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_F77='-qnocommon' + lt_prog_compiler_wl_F77='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-static' + ;; + pgcc* | pgf77* | pgf90*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-fpic' + lt_prog_compiler_static_F77='-static' + ;; + ccc*) + lt_prog_compiler_wl_F77='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_F77='-Kpic' + lt_prog_compiler_static_F77='-dn' + ;; + + solaris*) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_F77='-Qoption ld ';; + *) + lt_prog_compiler_wl_F77='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl_F77='-Qoption ld ' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_F77='-Kconform_pic' + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + unicos*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_can_build_shared_F77=no + ;; + + uts4*) + lt_prog_compiler_pic_F77='-pic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_F77"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13923: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:13927: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 + +if test x"$lt_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_F77=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13985: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:13989: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_F77=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_F77= + enable_shared_with_static_runtimes_F77=no + archive_cmds_F77= + archive_expsym_cmds_F77= + old_archive_From_new_cmds_F77= + old_archive_from_expsyms_cmds_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + thread_safe_flag_spec_F77= + hardcode_libdir_flag_spec_F77= + hardcode_libdir_flag_spec_ld_F77= + hardcode_libdir_separator_F77= + hardcode_direct_F77=no + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=unsupported + link_all_deplibs_F77=unknown + hardcode_automatic_F77=no + module_cmds_F77= + module_expsym_cmds_F77= + always_export_symbols_F77=no + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_F77= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_F77=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs_F77=no + fi + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_F77=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + sunos4*) + archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + + if test "$ld_shlibs_F77" = no; then + runpath_var= + hardcode_libdir_flag_spec_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=yes + archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_F77=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_F77=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_F77=yes + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_F77=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_F77='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_F77="-z nodefs" + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_F77=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_F77=' ' + archive_cmds_need_lc_F77=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_F77=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_F77=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_F77=' ' + allow_undefined_flag_F77=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_F77='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path_F77='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_F77=yes + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_F77=no + hardcode_direct_F77=no + hardcode_automatic_F77=yes + hardcode_shlibpath_var_F77=unsupported + whole_archive_flag_spec_F77='' + link_all_deplibs_F77=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_F77=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + freebsd1*) + ld_shlibs_F77=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu | dragonfly*) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_F77='+b $libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + ;; + ia64*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + *) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + link_all_deplibs_F77=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_F77='-rpath $libdir' + fi + hardcode_libdir_separator_F77=: + ;; + + sco3.2v5*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_F77=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_shlibpath_var_F77=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + link_all_deplibs_F77=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_F77='$CC -r -o $output$reload_objs' + hardcode_direct_F77=no + ;; + motorola) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv4.3*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_F77=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_F77='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv5*) + no_undefined_flag_F77=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_F77= + hardcode_shlibpath_var_F77=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + *) + ld_shlibs_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 +echo "${ECHO_T}$ld_shlibs_F77" >&6 +test "$ld_shlibs_F77" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_F77" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_F77=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_F77 in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_F77 + allow_undefined_flag_F77= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_F77=no + else + archive_cmds_need_lc_F77=yes + fi + allow_undefined_flag_F77=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var_F77" || \ + test "X$hardcode_automatic_F77" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 +echo "${ECHO_T}$hardcode_action_F77" >&6 + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_F77 \ + CC_F77 \ + LD_F77 \ + lt_prog_compiler_wl_F77 \ + lt_prog_compiler_pic_F77 \ + lt_prog_compiler_static_F77 \ + lt_prog_compiler_no_builtin_flag_F77 \ + export_dynamic_flag_spec_F77 \ + thread_safe_flag_spec_F77 \ + whole_archive_flag_spec_F77 \ + enable_shared_with_static_runtimes_F77 \ + old_archive_cmds_F77 \ + old_archive_from_new_cmds_F77 \ + predep_objects_F77 \ + postdep_objects_F77 \ + predeps_F77 \ + postdeps_F77 \ + compiler_lib_search_path_F77 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_F77 + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_F77 + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_F77 +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_F77 + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_F77 +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_F77 +archive_expsym_cmds=$lt_archive_expsym_cmds_F77 +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_F77 +module_expsym_cmds=$lt_module_expsym_cmds_F77 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_F77 + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_F77 + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_F77 + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_F77 + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_F77 + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_F77 + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_F77 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_F77 + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_F77" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + + + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +objext_GCJ=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +compiler_GCJ=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +archive_cmds_need_lc_GCJ=no + +old_archive_cmds_GCJ=$old_archive_cmds + + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16107: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:16111: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl_GCJ= +lt_prog_compiler_pic_GCJ= +lt_prog_compiler_static_GCJ= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_static_GCJ='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_GCJ=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_GCJ=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_GCJ='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + else + lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' + fi + ;; + darwin*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + case $cc_basename in + xlc*) + lt_prog_compiler_pic_GCJ='-qnocommon' + lt_prog_compiler_wl_GCJ='-Wl,' + ;; + esac + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux*) + case $cc_basename in + icc* | ecc*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-static' + ;; + pgcc* | pgf77* | pgf90*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-fpic' + lt_prog_compiler_static_GCJ='-static' + ;; + ccc*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_GCJ='-Kpic' + lt_prog_compiler_static_GCJ='-dn' + ;; + + solaris*) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_GCJ='-Qoption ld ';; + *) + lt_prog_compiler_wl_GCJ='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl_GCJ='-Qoption ld ' + lt_prog_compiler_pic_GCJ='-PIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_GCJ='-Kconform_pic' + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + unicos*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_can_build_shared_GCJ=no + ;; + + uts4*) + lt_prog_compiler_pic_GCJ='-pic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_GCJ"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16369: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:16373: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 + +if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_GCJ=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:16431: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:16435: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_GCJ=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_GCJ= + enable_shared_with_static_runtimes_GCJ=no + archive_cmds_GCJ= + archive_expsym_cmds_GCJ= + old_archive_From_new_cmds_GCJ= + old_archive_from_expsyms_cmds_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + thread_safe_flag_spec_GCJ= + hardcode_libdir_flag_spec_GCJ= + hardcode_libdir_flag_spec_ld_GCJ= + hardcode_libdir_separator_GCJ= + hardcode_direct_GCJ=no + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=unsupported + link_all_deplibs_GCJ=unknown + hardcode_automatic_GCJ=no + module_cmds_GCJ= + module_expsym_cmds_GCJ= + always_export_symbols_GCJ=no + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_GCJ= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_GCJ=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs_GCJ=no + fi + ;; + + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_GCJ=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + sunos4*) + archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + + if test "$ld_shlibs_GCJ" = no; then + runpath_var= + hardcode_libdir_flag_spec_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=yes + archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_GCJ=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_GCJ=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_GCJ=yes + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_GCJ=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_GCJ='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_GCJ="-z nodefs" + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* 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>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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_GCJ=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_GCJ=' ' + archive_cmds_need_lc_GCJ=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_GCJ=no + ;; + + bsdi[45]*) + export_dynamic_flag_spec_GCJ=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_GCJ=' ' + allow_undefined_flag_GCJ=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_GCJ='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_GCJ=yes + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + archive_cmds_need_lc_GCJ=no + hardcode_direct_GCJ=no + hardcode_automatic_GCJ=yes + hardcode_shlibpath_var_GCJ=unsupported + whole_archive_flag_spec_GCJ='' + link_all_deplibs_GCJ=yes + if test "$GCC" = yes ; then + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + case $cc_basename in + xlc*) + output_verbose_link_cmd='echo' + archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' + module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs_GCJ=no + ;; + esac + fi + ;; + + dgux*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + freebsd1*) + ld_shlibs_GCJ=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu | dragonfly*) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + ;; + ia64*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + *) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + link_all_deplibs_GCJ=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + allow_undefined_flag_GCJ=unsupported + archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_GCJ='-rpath $libdir' + fi + hardcode_libdir_separator_GCJ=: + ;; + + sco3.2v5*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_GCJ=' -z text' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + wlarc='' + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_shlibpath_var_GCJ=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + esac + link_all_deplibs_GCJ=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_GCJ='$CC -r -o $output$reload_objs' + hardcode_direct_GCJ=no + ;; + motorola) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4.3*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_GCJ=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_GCJ='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv5*) + no_undefined_flag_GCJ=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_GCJ= + hardcode_shlibpath_var_GCJ=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + *) + ld_shlibs_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 +echo "${ECHO_T}$ld_shlibs_GCJ" >&6 +test "$ld_shlibs_GCJ" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_GCJ" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_GCJ=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_GCJ in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ + allow_undefined_flag_GCJ= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_GCJ=no + else + archive_cmds_need_lc_GCJ=yes + fi + allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var_GCJ" || \ + test "X$hardcode_automatic_GCJ" = "Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 +echo "${ECHO_T}$hardcode_action_GCJ" >&6 + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* 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 dlopen (); +/* 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_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* 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 dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_GCJ \ + CC_GCJ \ + LD_GCJ \ + lt_prog_compiler_wl_GCJ \ + lt_prog_compiler_pic_GCJ \ + lt_prog_compiler_static_GCJ \ + lt_prog_compiler_no_builtin_flag_GCJ \ + export_dynamic_flag_spec_GCJ \ + thread_safe_flag_spec_GCJ \ + whole_archive_flag_spec_GCJ \ + enable_shared_with_static_runtimes_GCJ \ + old_archive_cmds_GCJ \ + old_archive_from_new_cmds_GCJ \ + predep_objects_GCJ \ + postdep_objects_GCJ \ + predeps_GCJ \ + postdeps_GCJ \ + compiler_lib_search_path_GCJ \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_GCJ + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_GCJ + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_GCJ + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_GCJ + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_GCJ +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_GCJ + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_GCJ +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_GCJ +archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_GCJ +module_expsym_cmds=$lt_module_expsym_cmds_GCJ + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_GCJ + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_GCJ + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_GCJ + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_GCJ + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_GCJ + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_GCJ + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_GCJ + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_GCJ + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_GCJ" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + RC) + + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +compiler_RC=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + +lt_cv_prog_compiler_c_o_RC=yes + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_RC \ + CC_RC \ + LD_RC \ + lt_prog_compiler_wl_RC \ + lt_prog_compiler_pic_RC \ + lt_prog_compiler_static_RC \ + lt_prog_compiler_no_builtin_flag_RC \ + export_dynamic_flag_spec_RC \ + thread_safe_flag_spec_RC \ + whole_archive_flag_spec_RC \ + enable_shared_with_static_runtimes_RC \ + old_archive_cmds_RC \ + old_archive_from_new_cmds_RC \ + predep_objects_RC \ + postdep_objects_RC \ + predeps_RC \ + postdeps_RC \ + compiler_lib_search_path_RC \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_RC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_RC + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext_cmds='$shrext_cmds' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_RC +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_RC + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_RC + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_RC + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_RC" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + ;; + + *) + { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 +echo "$as_me: error: Unsupported tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 +echo "$as_me: error: unable to update list of available tagged configurations." >&2;} + { (exit 1); exit 1; }; } + fi +fi @@ -8331,6 +19798,24 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' # Prevent multiple expansion + + + + + + + + + + + + + + + + + + # Enable large file support. # Check whether --enable-largefile or --disable-largefile was given. @@ -8706,11 +20191,11 @@ if test "$enable_gnome_vfs" != "no"; then export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" fi - succeeded=no - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; 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_path_PKG_CONFIG+set}" = set; then @@ -8735,7 +20220,6 @@ do done done - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -8749,56 +20233,123 @@ else echo "${ECHO_T}no" >&6 fi +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done +done - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 -echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG - if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then - echo "$as_me:$LINENO: result: yes" >&5 +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + PKG_CONFIG=$ac_pt_PKG_CONFIG +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - succeeded=yes + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + PKG_CONFIG="" + fi - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 +fi - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 - else - LIBNTFS_GNOMEVFS_CFLAGS="" - LIBNTFS_GNOMEVFS_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` +pkg_failed=no +echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 +if test "${pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set" = "xset"; then + pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&6 +echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 +if test "${pkg_cv_LIBNTFS_GNOMEVFS_LIBS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set" = "xset"; then + pkg_cv_LIBNTFS_GNOMEVFS_LIBS=$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&6 - fi +if test $pkg_failed = yes; then + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + # Put the nasty error message in config.log where it belongs + echo "$LIBNTFS_GNOMEVFS_PKG_ERRORS" 1>&5 - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_gnome_vfs=true - else - if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} @@ -8808,8 +20359,22 @@ echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi - fi +elif test $pkg_failed = untried; then + if test "$enable_gnome_vfs" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} + fi + +else + LIBNTFS_GNOMEVFS_CFLAGS=$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS + LIBNTFS_GNOMEVFS_LIBS=$pkg_cv_LIBNTFS_GNOMEVFS_LIBS + compile_gnome_vfs=true +fi fi @@ -9089,11 +20654,12 @@ fi -for ac_header in fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ - stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ - unistd.h utime.h wchar.h getopt.h features.h endian.h byteswap.h \ - sys/byteorder.h sys/endian.h sys/param.h sys/ioctl.h sys/mount.h \ - sys/stat.h sys/types.h sys/vfs.h linux/major.h linux/fd.h \ + +for ac_header in ctype.h fcntl.h libintl.h limits.h locale.h mntent.h \ + stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h strings.h \ + errno.h time.h unistd.h utime.h wchar.h getopt.h features.h endian.h \ + byteswap.h sys/byteorder.h sys/endian.h sys/param.h sys/ioctl.h \ + sys/mount.h sys/stat.h sys/types.h sys/vfs.h linux/major.h linux/fd.h \ linux/hdreg.h machine/endian.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -11584,9 +23150,8 @@ done - for ac_func in atexit fdatasync hasmntopt memmove memset regcomp setlocale \ - strcasecmp strchr strdup strerror strtol strtoul utime mbsinit SetFilePointerEx + strcasecmp strchr strdup strerror strtol strtoul utime mbsinit do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -11803,6 +23368,13 @@ 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 +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -12415,13 +23987,26 @@ 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,@EGREP@,$EGREP,;t t s,@ECHO@,$ECHO,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@CXXCPP@,$CXXCPP,;t t +s,@F77@,$F77,;t t +s,@FFLAGS@,$FFLAGS,;t t +s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t diff --git a/configure.ac b/configure.ac index 84a941ef..e38dbf33 100644 --- a/configure.ac +++ b/configure.ac @@ -190,11 +190,11 @@ AC_SUBST(AUTODIRS) # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \ - stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \ - unistd.h utime.h wchar.h getopt.h features.h endian.h byteswap.h \ - sys/byteorder.h sys/endian.h sys/param.h sys/ioctl.h sys/mount.h \ - sys/stat.h sys/types.h sys/vfs.h linux/major.h linux/fd.h \ +AC_CHECK_HEADERS([ctype.h fcntl.h libintl.h limits.h locale.h mntent.h \ + stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h strings.h \ + errno.h time.h unistd.h utime.h wchar.h getopt.h features.h endian.h \ + byteswap.h sys/byteorder.h sys/endian.h sys/param.h sys/ioctl.h \ + sys/mount.h sys/stat.h sys/types.h sys/vfs.h linux/major.h linux/fd.h \ linux/hdreg.h machine/endian.h]) # Checks for typedefs, structures, and compiler characteristics. @@ -219,7 +219,7 @@ AC_FUNC_STRFTIME AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \ - strcasecmp strchr strdup strerror strtol strtoul utime mbsinit SetFilePointerEx]) + strcasecmp strchr strdup strerror strtol strtoul utime mbsinit]) # Makefiles to be created by configure. AC_CONFIG_FILES([ diff --git a/depcomp b/depcomp index 11e2d3bf..ffcd540c 100755 --- a/depcomp +++ b/depcomp @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2004-05-31.23 +scriptversion=2005-02-09.22 -# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005 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 @@ -50,11 +50,11 @@ Environment variables: Report bugs to . EOF - exit 0 + exit $? ;; -v | --v*) echo "depcomp $scriptversion" - exit 0 + exit $? ;; esac @@ -287,36 +287,43 @@ tru64) base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then - # Dependencies are output in .lo.d with libtool 1.4. - # With libtool 1.5 they are output both in $dir.libs/$base.o.d - # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the - # latter, because the former will be cleaned when $dir.libs is - # erased. - tmpdepfile1="$dir.libs/$base.lo.d" - tmpdepfile2="$dir$base.o.d" - tmpdepfile3="$dir.libs/$base.d" + # With Tru64 cc, shared objects can also be used to make a + # static library. This mecanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else - tmpdepfile1="$dir$base.o.d" - tmpdepfile2="$dir$base.d" - tmpdepfile3="$dir$base.d" + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - elif test -f "$tmpdepfile2"; then - tmpdepfile="$tmpdepfile2" - else - tmpdepfile="$tmpdepfile3" - fi + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. diff --git a/doc/Makefile.in b/doc/Makefile.in index 8c5f180f..f2046fca 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 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. @@ -52,6 +52,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -62,6 +63,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -73,6 +78,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -102,13 +109,19 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/include/Makefile.in b/include/Makefile.in index 085ce4ee..8d93c691 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 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. @@ -61,6 +61,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -71,6 +72,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -82,6 +87,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -111,13 +118,19 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -206,7 +219,13 @@ uninstall-info-am: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -218,7 +237,7 @@ $(RECURSIVE_TARGETS): local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ @@ -226,7 +245,13 @@ $(RECURSIVE_TARGETS): mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ @@ -247,7 +272,7 @@ maintainer-clean-recursive: local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 8c4138c9..5802f31b 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 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. @@ -65,6 +65,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -75,6 +76,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -86,6 +91,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -115,13 +122,19 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ diff --git a/install-sh b/install-sh index 6ebe46de..1a835340 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2004-12-17.09 +scriptversion=2005-02-02.21 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -109,7 +109,7 @@ while test -n "$1"; do shift continue;; - --help) echo "$usage"; exit 0;; + --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift @@ -134,7 +134,7 @@ while test -n "$1"; do shift continue;; - --version) echo "$0 $scriptversion"; exit 0;; + --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index ed964069..12e212ef 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 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. @@ -107,11 +107,11 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) @@ -127,6 +127,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -137,6 +138,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -148,6 +153,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -177,13 +184,19 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -412,18 +425,18 @@ distclean-compile: @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c mostlyclean-libtool: -rm -f *.lo diff --git a/ltmain.sh b/ltmain.sh index 239bdefb..abda7165 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,7 +1,7 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun configure. # -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Gordon Matzigkeit , 1996 # @@ -17,13 +17,41 @@ # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +basename="s,^.*/,,g" + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +progname=`echo "$progpath" | $SED $basename` +modename="$progname" + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION=1.5.18 +TIMESTAMP=" (1.1220.2.246 2005/05/16 10:00:18)" + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes. +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + # Check that we have a working $echo. if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. @@ -36,7 +64,7 @@ elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : else # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$0" --no-reexec ${1+"$@"} + exec $SHELL "$progpath" --no-reexec ${1+"$@"} fi if test "X$1" = X--fallback-echo; then @@ -45,22 +73,9 @@ if test "X$1" = X--fallback-echo; then cat <&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 + $echo "$modename: not configured to build any kind of library" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE fi # Global variables. @@ -116,9 +133,227 @@ show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" +quote_scanset='[[~#^*{};<>?'"'"' ]' + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` + if test "X$win32_nmres" = "Ximport" ; then + win32_libid_type="x86 archive import" + else + win32_libid_type="x86 archive static" + fi + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + CC_quoted="$CC_quoted $arg" + done + case "$@ " in + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit $EXIT_FAILURE +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE + fi +} + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + my_status="" + + $show "${rm}r $my_gentop" + $run ${rm}r "$my_gentop" + $show "$mkdir $my_gentop" + $run $mkdir "$my_gentop" + my_status=$? + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then + exit $my_status + fi + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` + my_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$my_xdir"; then + exit $status + fi + case $host in + *-darwin*) + $show "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + if test -z "$run"; then + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` + if test -n "$darwin_arches"; then + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + $show "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + lipo -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + ${rm}r unfat-$$ + cd "$darwin_orig_dir" + else + cd "$darwin_orig_dir" + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + fi # $run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + func_extract_archives_result="$my_oldobjs" +} +# End of Shell function definitions +##################################### + +# Darwin sucks +eval std_shrext=\"$shrext_cmds\" # Parse our command line options once, thoroughly. -while test $# -gt 0 +while test "$#" -gt 0 do arg="$1" shift @@ -134,6 +369,34 @@ do execute_dlfiles) execute_dlfiles="$execute_dlfiles $arg" ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; *) eval "$prev=\$arg" ;; @@ -151,18 +414,27 @@ do ;; --version) - echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - exit 0 + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2005 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $? ;; --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 - exit 0 + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" + done + exit $? ;; --debug) - echo "$progname: enabling shell trace mode" + $echo "$progname: enabling shell trace mode" set -x + preserve_args="$preserve_args $arg" ;; --dry-run | -n) @@ -170,18 +442,18 @@ do ;; --features) - echo "host: $host" + $echo "host: $host" if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" + $echo "enable shared libraries" else - echo "disable shared libraries" + $echo "disable shared libraries" fi if test "$build_old_libs" = yes; then - echo "enable static libraries" + $echo "enable static libraries" else - echo "disable static libraries" + $echo "disable static libraries" fi - exit 0 + exit $? ;; --finish) mode="finish" ;; @@ -193,6 +465,15 @@ do --quiet | --silent) show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) prevopt="--tag" prev=tag ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" ;; -dlopen) @@ -203,7 +484,7 @@ do -*) $echo "$modename: unrecognized option \`$arg'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; *) @@ -216,18 +497,7 @@ done if test -n "$prevopt"; then $echo "$modename: option \`$prevopt' requires an argument" 1>&2 $echo "$help" 1>&2 - exit 1 -fi - -# Mandrake: (gc) It's bad to link C++ code with GCC, so we need to use the compiler name if provided -if test "$mode" = link && test -n "$archive_cmds" && test -x "/usr/bin/perl"; then - case $nonopt in - *cc | *++ | gcc* | *-gcc* | egcs*) - archive_cmds=`echo $archive_cmds | perl -pe 's/^\S+\s+//'` - archive_cmds="$nonopt $archive_cmds" - archive_expsym_cmds=`echo $archive_expsym_cmds | perl -pe 's/^\S+\s+//'` - archive_expsym_cmds="$nonopt $archive_expsym_cmds" - esac + exit $EXIT_FAILURE fi # If this variable is set in any of the actions, the command in it @@ -239,8 +509,10 @@ if test -z "$show_help"; then # Infer the operation mode. if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 case $nonopt in - *cc | *++ | gcc* | *-gcc* | xlc*) + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) mode=link for arg do @@ -281,7 +553,7 @@ if test -z "$show_help"; then if test -n "$execute_dlfiles" && test "$mode" != execute; then $echo "$modename: unrecognized option \`-dlopen'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. @@ -295,50 +567,157 @@ if test -z "$show_help"; then modename="$modename: compile" # Get the compilation command and the source file. base_compile= - prev= - lastarg= - srcfile="$nonopt" + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes suppress_output= + arg_mode=normal + libobj= + later= - user_target=no for arg do - case $prev in - "") ;; - xcompiler) - # Aesthetically quote the previous argument. - prev= - lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg_mode" in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; - case $arg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi + target ) + libobj="$arg" + arg_mode=normal continue ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit $EXIT_FAILURE + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + lastarg="\"$lastarg\"" + ;; esac - # Accept any command-line options. - case $arg in - -o) - if test "$user_target" != "no"; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - user_target=next - ;; + base_compile="$base_compile $lastarg" + done # for arg + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $EXIT_FAILURE + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit $EXIT_FAILURE + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in -static) build_old_libs=yes continue @@ -353,138 +732,42 @@ if test -z "$show_help"; then pic_mode=no continue ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - continue - ;; esac - - case $user_target in - next) - # The next one is the -o target name - user_target=yes - continue - ;; - yes) - # We got the output file - user_target=set - libobj="$arg" - continue - ;; - esac - - # Accept the current argument as the source file. - lastarg="$srcfile" - srcfile="$arg" - - # Aesthetically quote the previous argument. - - # Backslashify any backslashes, double quotes, and dollar signs. - # These are the only characters that are still specially - # interpreted inside of double-quoted scrings. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $lastarg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi done - case $user_target in - set) - ;; - no) - # Get the name of the library object. - libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - *) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSfmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit 1 - ;; + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qlibobj="\"$qlibobj\"" ;; esac + if test "X$libobj" != "X$qlibobj"; then + $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + exit $EXIT_FAILURE + fi + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname if test -z "$base_compile"; then $echo "$modename: you must specify a compilation command" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Delete any leftover library objects. if test "$build_old_libs" = yes; then - removelist="$obj $libobj" + removelist="$obj $lobj $libobj ${libobj}T" else - removelist="$libobj" + removelist="$lobj $libobj ${libobj}T" fi $run $rm $removelist - trap "$run $rm $removelist; exit 1" 1 2 15 + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in @@ -503,8 +786,9 @@ if test -z "$show_help"; then output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit 1" 1 2 15 + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 else + output_obj= need_locks=no lockfile= fi @@ -512,13 +796,13 @@ if test -z "$show_help"; then # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then - until $run ln "$0" "$lockfile" 2>/dev/null; do + until $run ln "$progpath" "$lockfile" 2>/dev/null; do $show "Waiting for $lockfile to be removed" sleep 2 done elif test "$need_locks" = warn; then if test -f "$lockfile"; then - echo "\ + $echo "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` @@ -530,14 +814,33 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi - echo $srcfile > "$lockfile" + $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qsrcfile="\"$qsrcfile\"" ;; + esac + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != x"$srcfile"; then - echo "\ + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -606,13 +894,13 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one - if test x"$output_obj" != x"$libobj"; then - $show "$mv $output_obj $libobj" - if $run $mv $output_obj $libobj; then : + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : else error=$? $run $rm $removelist @@ -620,77 +908,50 @@ compiler." fi fi - # If we have no pic_flag, then copy the object into place and finish. - if (test -z "$pic_flag" || test "$pic_mode" != default) && - test "$build_old_libs" = yes; then - # Rename the .lo from within objdir to obj - if test -f $obj; then - $show $rm $obj - $run $rm $obj - fi + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != x"$srcfile"; then - echo "\ + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $echo "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` @@ -705,11 +966,11 @@ avoid parallel builds (make -j) in this platform, or get a better compiler." $run $rm $removelist - exit 1 + exit $EXIT_FAILURE fi # Just move the object if needed - if test x"$output_obj" != x"$obj"; then + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then $show "$mv $output_obj $obj" if $run $mv $output_obj $obj; then : else @@ -719,29 +980,31 @@ compiler." fi fi - # Create an invalid libtool object if no PIC, so that we do not - # accidentally link it into a program. - if test "$build_libtool_libs" != yes; then - $show "echo timestamp > $libobj" - $run eval "echo timestamp > \$libobj" || exit $? - else - # Move the .lo from within objdir - $show "$mv $libobj $lo_libobj" - if $run $mv $libobj $lo_libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T <\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test ;; *) qarg=$arg ;; @@ -903,7 +1172,7 @@ compiler." export_symbols="$arg" if test ! -f "$arg"; then $echo "$modename: symbol file \`$arg' does not exist" - exit 1 + exit $EXIT_FAILURE fi prev= continue @@ -913,23 +1182,135 @@ compiler." prev= continue ;; - inst_prefix) + inst_prefix) inst_prefix_dir="$arg" prev= continue ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; release) release="-$arg" prev= continue ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit $EXIT_FAILURE + fi + arg=$save_arg + prev= + continue + ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac if test "$prev" = rpath; then @@ -961,13 +1342,33 @@ compiler." finalize_command="$finalize_command $wl$qarg" continue ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + darwin_framework) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + prev= + continue + ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac - fi # test -n $prev + fi # test -n "$prev" prevarg="$arg" @@ -1009,7 +1410,7 @@ compiler." -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: more than one -exported-symbols argument is not allowed" - exit 1 + exit $EXIT_FAILURE fi if test "X$arg" = "X-export-symbols"; then prev=expsyms @@ -1019,6 +1420,14 @@ compiler." continue ;; + -framework) + prev=darwin_framework + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + -inst-prefix-dir) prev=inst_prefix continue @@ -1028,7 +1437,7 @@ compiler." # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in - no/*-*-irix* | no/*-*-nonstopux*) + no/*-*-irix* | /*-*-irix*) compile_command="$compile_command $arg" finalize_command="$finalize_command $arg" ;; @@ -1045,7 +1454,7 @@ compiler." absdir=`cd "$dir" && pwd` if test -z "$absdir"; then $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi dir="$absdir" ;; @@ -1079,28 +1488,78 @@ compiler." # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; - *-*-openbsd* | *-*-freebsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd*) - # Do not include libc_r directly, use -pthread flag. + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" continue - ;; esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac fi deplibs="$deplibs $arg" continue ;; + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + -model) + compile_command="$compile_command $arg" + compiler_flags="$compiler_flags $arg" + finalize_command="$finalize_command $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + continue + ;; + -module) module=yes continue ;; + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m* pass through architecture-specific compiler args for GCC + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*) + + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + if test "$with_gcc" = "yes" ; then + compiler_flags="$compiler_flags $arg" + fi + continue + ;; + + -shrext) + prev=shrext + continue + ;; + -no-fast-install) fast_install=no continue @@ -1125,8 +1584,18 @@ compiler." continue ;; + -objectlist) + prev=objectlist + continue + ;; + -o) prev=output ;; + -precious-files-regex) + prev=precious_regex + continue + ;; + -release) prev=release continue @@ -1149,7 +1618,7 @@ compiler." [\\/]* | [A-Za-z]:[\\/]*) ;; *) $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac case "$xrpath " in @@ -1177,6 +1646,11 @@ compiler." prev=vinfo continue ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` @@ -1185,7 +1659,7 @@ compiler." for flag in $args; do IFS="$save_ifs" case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") flag="\"$flag\"" ;; esac @@ -1203,7 +1677,7 @@ compiler." for flag in $args; do IFS="$save_ifs" case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") flag="\"$flag\"" ;; esac @@ -1225,41 +1699,118 @@ compiler." continue ;; + -XCClinker) + prev=xcclinker + continue + ;; + # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac ;; - *.lo | *.$objext) - # A library or standard object. - if test "$prev" = dlfiles; then - # This file was specified with -dlopen. - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $arg" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi + *.$objext) + # A standard object. + objs="$objs $arg" + ;; - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` - prev= - else + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. case $arg in - *.lo) libobjs="$libobjs $arg" ;; - *) objs="$objs $arg" ;; + */* | *\\*) . $arg ;; + *) . ./$arg ;; esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit $EXIT_FAILURE + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit $EXIT_FAILURE + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi fi ;; @@ -1293,7 +1844,7 @@ compiler." # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -1310,7 +1861,7 @@ compiler." if test -n "$prev"; then $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then @@ -1319,6 +1870,7 @@ compiler." finalize_command="$finalize_command $arg" fi + oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" @@ -1339,11 +1891,11 @@ compiler." output_objdir="$output_objdir/$objdir" fi # Create the object directory. - if test ! -d $output_objdir; then + if test ! -d "$output_objdir"; then $show "$mkdir $output_objdir" $run $mkdir $output_objdir status=$? - if test $status -ne 0 && test ! -d $output_objdir; then + if test "$status" -ne 0 && test ! -d "$output_objdir"; then exit $status fi fi @@ -1353,7 +1905,7 @@ compiler." "") $echo "$modename: you must specify an output file" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; @@ -1361,7 +1913,17 @@ compiler." *) linkmode=prog ;; # Anything else should be a program. esac + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplications in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac specialdeplibs= + libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) @@ -1373,6 +1935,25 @@ compiler." fi libs="$libs $deplib" done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + deplibs= newdependency_libs= newlib_search_path= @@ -1387,7 +1968,7 @@ compiler." *.la) ;; *) $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac done @@ -1404,39 +1985,55 @@ compiler." ;; esac for pass in $passes; do - if test $linkmode = prog; then - # Determine which files to process + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then case $pass in - dlopen) - libs="$dlfiles" - save_deplibs="$deplibs" # Collect dlpreopened libraries - deplibs= - ;; + dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi for deplib in $libs; do lib= found=no case $deplib in - -l*) - if test $linkmode = oldlib && test $linkmode = obj; then - $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 - continue + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" fi - if test $pass = conv; then - deplibs="$deplib $deplibs" + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 continue fi name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - # Search the libtool library - lib="$searchdir/lib${name}.la" - if test -f "$lib"; then - found=yes - break - fi + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library @@ -1445,40 +2042,76 @@ compiler." finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi fi ;; # -l -L*) case $linkmode in lib) deplibs="$deplib $deplibs" - test $pass = conv && continue + test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; prog) - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi - if test $pass = scan; then + if test "$pass" = scan; then deplibs="$deplib $deplibs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ;; *) - $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 ;; esac # linkmode continue ;; # -L -R*) - if test $pass = link; then + if test "$pass" = link; then dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` # Make sure the xrpath contains only unique directories. case "$xrpath " in @@ -1491,30 +2124,45 @@ compiler." ;; *.la) lib="$deplib" ;; *.$libext) - if test $pass = conv; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) - if test "$deplibs_check_method" != pass_all; then - echo - echo "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not used here." + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + if eval $echo \"$deplib\" 2>/dev/null \ + | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." else - echo - echo "*** Warning: Linking the shared library $output against the" - echo "*** static library $deplib is not portable!" + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi continue ;; prog) - if test $pass != link; then + if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -1525,14 +2173,18 @@ compiler." esac # linkmode ;; # *.$libext *.lo | *.$objext) - if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi fi continue ;; @@ -1541,17 +2193,17 @@ compiler." continue ;; esac # case $deplib - if test $found = yes || test -f "$lib"; then : + if test "$found" = yes || test -f "$lib"; then : else $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` @@ -1564,8 +2216,11 @@ compiler." library_names= old_library= # If the library was installed with an old release of libtool, - # it will not redefine variable installed. + # it will not redefine variables installed, or shouldnotlink installed=yes + shouldnotlink=no + avoidtemprpath= + # Read the .la file case $lib in @@ -1575,19 +2230,18 @@ compiler." if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || - { test $linkmode = oldlib && test $linkmode = obj; }; then - # Add dl[pre]opened files of deplib + { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && dlfiles="$dlfiles $dlopen" test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" fi - if test $pass = conv; then + if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # It is a libtool convenience library, so add in its objects. convenience="$convenience $ladir/$objdir/$old_library" @@ -1602,13 +2256,14 @@ compiler." fi tmp_libs="$tmp_libs $deplib" done - elif test $linkmode != prog && test $linkmode != lib; then + elif test "$linkmode" != prog && test "$linkmode" != lib; then $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit 1 + exit $EXIT_FAILURE fi continue fi # $pass = conv + # Get the name of the library we link against. linklib= for l in $old_library $library_names; do @@ -1616,19 +2271,23 @@ compiler." done if test -z "$linklib"; then $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # This library was specified with -dlopen. - if test $pass = dlopen; then + if test "$pass" = dlopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi - if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. - dlprefiles="$dlprefiles $lib" + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" else newdlfiles="$newdlfiles $lib" fi @@ -1660,19 +2319,27 @@ compiler." dir="$libdir" absdir="$libdir" fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi fi # $installed = yes name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` # This library was specified with -dlpreopen. - if test $pass = dlpreopen; then + if test "$pass" = dlpreopen; then if test -z "$libdir"; then $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). @@ -1688,18 +2355,19 @@ compiler." if test -z "$libdir"; then # Link the convenience library - if test $linkmode = lib; then + if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else - deplibs="$lib $deplibs" + deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi - if test $linkmode = prog && test $pass != link; then + + if test "$linkmode" = prog && test "$pass" != link; then newlib_search_path="$newlib_search_path $ladir" deplibs="$lib $deplibs" @@ -1715,7 +2383,7 @@ compiler." -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test esac # Need to link against all dependency_libs? - if test $linkalldeplibs = yes; then + if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths @@ -1732,13 +2400,19 @@ compiler." continue fi # $linkmode = prog... - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # Link against this shared library + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi - if test "$linkmode,$pass" = "prog,link" || - { test $linkmode = lib && test $hardcode_into_libs = yes; }; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. @@ -1760,17 +2434,6 @@ compiler." esac ;; esac - if test $linkmode = prog; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - fi fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && @@ -1780,11 +2443,52 @@ compiler." # We only need to search for static libraries continue fi + fi + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then if test "$installed" = no; then notinst_deplibs="$notinst_deplibs $lib" need_relink=yes fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname @@ -1798,7 +2502,7 @@ compiler." elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin*) + *cygwin* | mingw*) major=`expr $current - $age` versuffix="-$major" ;; @@ -1810,17 +2514,18 @@ compiler." # Make a new name for the extract_expsyms_cmds to use soroot="$soname" - soname=`echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else $show "extracting exported symbol list from \`$soname'" save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" + cmds=$extract_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -1831,9 +2536,10 @@ compiler." if test -f "$output_objdir/$newlib"; then :; else $show "generating import library for \`$soname'" save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" + cmds=$old_archive_from_expsyms_cmds for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -1842,9 +2548,9 @@ compiler." # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib - fi # test -n $old_archive_from_expsyms_cmds + fi # test -n "$old_archive_from_expsyms_cmds" - if test $linkmode = prog || test "$mode" != relink; then + if test "$linkmode" = prog || test "$mode" != relink; then add_shlibpath= add_dir= add= @@ -1853,6 +2559,22 @@ compiler." immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" + case $host in + *-*-sco3.2v5* ) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against + # it, someone is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; @@ -1871,6 +2593,14 @@ compiler." add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" @@ -1884,7 +2614,7 @@ compiler." if test "$lib_linked" != yes; then $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 + exit $EXIT_FAILURE fi if test -n "$add_shlibpath"; then @@ -1893,7 +2623,7 @@ compiler." *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; esac fi - if test $linkmode = prog; then + if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else @@ -1910,9 +2640,8 @@ compiler." fi fi - if test $linkmode = prog || test "$mode" = relink; then + if test "$linkmode" = prog || test "$mode" = relink; then add_shlibpath= - add_prefix_dir= add_dir= add= # Finalize command for both is simple: just hardcode it. @@ -1927,43 +2656,36 @@ compiler." *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; esac add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi add="-l$name" fi - - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_prefix_dir="-L$inst_prefix_dir$libdir" - ;; - esac - fi - - # add_prefix_dir must be appended instead, otherwise it can - # possibly be overrided by any hardcoded -L/... path in deplibs - if test $linkmode = prog; then - test -n "$add_prefix_dir" && finalize_deplibs="$finalize_deplibs $add_prefix_dir" + if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else - test -n "$add_prefix_dir" && deplibs="$deplibs $add_prefix_dir" test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi - elif test $linkmode = prog; then - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - - # Try to link the static library + elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. @@ -1983,21 +2705,21 @@ compiler." # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. - echo - echo "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module @@ -2014,10 +2736,11 @@ compiler." fi fi # link shared/static library? - if test $linkmode = lib; then + if test "$linkmode" = lib; then if test -n "$dependency_libs" && - { test $hardcode_into_libs != yes || test $build_old_libs = yes || - test $link_static = yes; }; then + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do @@ -2048,7 +2771,7 @@ compiler." tmp_libs="$tmp_libs $deplib" done - if test $link_all_deplibs != no; then + if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do case $deplib in @@ -2068,38 +2791,83 @@ compiler." ;; esac if grep "^installed=no" $deplib > /dev/null; then - path="-L$absdir/$objdir" + path="$absdir/$objdir" else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test "$absdir" != "$libdir"; then $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 fi - path="-L$absdir" + path="$absdir" fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, + # but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + fi + path="" + ;; + *) + path="-L$path" + ;; + esac + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac ;; *) continue ;; esac case " $deplibs " in *" $path "*) ;; - *) deplibs="$deplibs $path" ;; + *) deplibs="$path $deplibs" ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs - if test $pass = dlpreopen; then + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi - if test $pass != dlopen; then - test $pass != scan && dependency_libs="$newdependency_libs" - if test $pass != conv; then + if test "$pass" != dlopen; then + if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do @@ -2121,9 +2889,30 @@ compiler." eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) @@ -2151,19 +2940,32 @@ compiler." eval $var=\"$tmp_libs\" done # for var fi - if test "$pass" = "conv" && - { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then - libs="$deplibs" # reset libs - deplibs= - fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs done # for pass - if test $linkmode = prog; then + if test "$linkmode" = prog; then dlfiles="$newdlfiles" dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi @@ -2177,7 +2979,7 @@ compiler." fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then @@ -2199,17 +3001,19 @@ compiler." case $outputname in lib*) name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) if test "$module" = no; then $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` @@ -2220,11 +3024,11 @@ compiler." if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit 1 + exit $EXIT_FAILURE else - echo - echo "*** Warning: Linking the shared library $output against the non-libtool" - echo "*** objects $objs is not portable!" + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" libobjs="$libobjs $objs" fi fi @@ -2234,7 +3038,7 @@ compiler." fi set dummy $rpath - if test $# -gt 2; then + if test "$#" -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi install_libdir="$2" @@ -2243,14 +3047,16 @@ compiler." if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. - libext=al + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then @@ -2266,45 +3072,82 @@ compiler." if test -n "$8"; then $echo "$modename: too many parameters to \`-version-info'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi - current="$2" - revision="$3" - age="$4" + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac # Check that each of the things are valid numbers. case $current in - [0-9]*) ;; + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac case $revision in - [0-9]*) ;; + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac case $age in - [0-9]*) ;; + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac - if test $age -gt $current; then + if test "$age" -gt "$current"; then $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Calculate the version variables. @@ -2321,7 +3164,7 @@ compiler." versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... minor_current=`expr $current + 1` - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" ;; freebsd-aout) @@ -2345,7 +3188,7 @@ compiler." # Add in all the interfaces that we are compatible with. loop=$revision - while test $loop != 0; do + while test "$loop" -ne 0; do iface=`expr $revision - $loop` loop=`expr $loop - 1` verstring="$verstring_prefix$major.$iface:$verstring" @@ -2368,7 +3211,7 @@ compiler." # Add in all the interfaces that we are compatible with. loop=$age - while test $loop != 0; do + while test "$loop" -ne 0; do iface=`expr $current - $loop` loop=`expr $loop - 1` verstring="$verstring:${iface}.0" @@ -2392,20 +3235,19 @@ compiler." *) $echo "$modename: unknown library version type \`$version_type'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $EXIT_FAILURE ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= - verstring="0.0" case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely - verstring="" + verstring= ;; *) verstring="0.0" @@ -2439,9 +3281,30 @@ compiler." fi if test "$mode" != relink; then - # Remove our outputs. - $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" - $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi fi # Now set the variables for building old libraries. @@ -2454,9 +3317,9 @@ compiler." # Eliminate all temporary directories. for path in $notinst_path; do - lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` done if test -n "$xrpath"; then @@ -2469,7 +3332,7 @@ compiler." *) finalize_rpath="$finalize_rpath $libdir" ;; esac done - if test $hardcode_into_libs != yes || test $build_old_libs = yes; then + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi @@ -2507,12 +3370,13 @@ compiler." *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; - *-*-openbsd* | *-*-freebsd*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue ;; - *) + *) # Add libc to deplibs on all other systems if necessary. - if test $build_libtool_need_lc = "yes"; then + if test "$build_libtool_need_lc" = "yes"; then deplibs="$deplibs -lc" fi ;; @@ -2539,7 +3403,7 @@ compiler." # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behaviour. + # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) @@ -2552,45 +3416,22 @@ compiler." int main() { return 0; } EOF $rm conftest - $CC -o conftest conftest.c $deplibs - if test $? -eq 0 ; then + $LTCC -o conftest conftest.c $deplibs + if test "$?" -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do name="`expr $i : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - echo - echo "*** Warning: dynamic linker does not accept needed library $i." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which I believe you do not have" - echo "*** because a test_compile did reveal that the linker did not use it for" - echo "*** its dynamic dependency list that programs get resolved with at runtime." - fi - else - newdeplibs="$newdeplibs $i" - fi - done - else - # Error occured in the first compile. Let's try to salvage - # the situation: Compile a separate program for each library. - for i in $deplibs; do - name="`expr $i : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - $rm conftest - $CC -o conftest conftest.c $i - # Did it work? - if test $? -eq 0 ; then - ldd_output=`ldd conftest` + if test "$name" != "" && test "$name" -ne "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then libname=`eval \\$echo \"$libname_spec\"` deplib_matches=`eval \\$echo \"$library_names_spec\"` set dummy $deplib_matches @@ -2599,21 +3440,64 @@ EOF newdeplibs="$newdeplibs $i" else droppeddeps=yes - echo - echo "*** Warning: dynamic linker does not accept needed library $i." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because a test_compile did reveal that the linker did not use this one" - echo "*** as a dynamic dependency that programs can get resolved with at runtime." + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which I believe you do not have" + $echo "*** because a test_compile did reveal that the linker did not use it for" + $echo "*** its dynamic dependency list that programs get resolved with at runtime." + fi + fi + else + newdeplibs="$newdeplibs $i" + fi + done + else + # Error occurred in the first compile. Let's try to salvage + # the situation: Compile a separate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test "$name" != "" && test "$name" != "0"; then + $rm conftest + $LTCC -o conftest conftest.c $i + # Did it work? + if test "$?" -eq 0 ; then + ldd_output=`ldd conftest` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $i "*) + newdeplibs="$newdeplibs $i" + i="" + ;; + esac + fi + if test -n "$i" ; then + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + $echo + $echo "*** Warning: dynamic linker does not accept needed library $i." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because a test_compile did reveal that the linker did not use this one" + $echo "*** as a dynamic dependency that programs can get resolved with at runtime." + fi fi else droppeddeps=yes - echo - echo "*** Warning! Library $i is needed by this library but I was not able to" - echo "*** make it link in! You will probably need to install it or some" - echo "*** library that it depends on before this library will be fully" - echo "*** functional. Installing it before continuing would be even better." + $echo + $echo "*** Warning! Library $i is needed by this library but I was not able to" + $echo "*** make it link in! You will probably need to install it or some" + $echo "*** library that it depends on before this library will be fully" + $echo "*** functional. Installing it before continuing would be even better." fi else newdeplibs="$newdeplibs $i" @@ -2627,11 +3511,20 @@ EOF for a_deplib in $deplibs; do name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do + if test "$name" != "" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then @@ -2650,35 +3543,29 @@ EOF *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done - # It is ok to link against an archive when - # building a shared library. - if $AR -t $potlib > /dev/null 2>&1; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ${SED} 10q \ - | egrep "$file_magic_regex" > /dev/null; then + | $EGREP "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" break 2 fi - done - done + done + done + fi if test -n "$a_deplib" ; then droppeddeps=yes - echo - echo "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - echo "*** with $libname but no candidates were found. (...for file magic test)" + $echo "*** with $libname but no candidates were found. (...for file magic test)" else - echo "*** with $libname and none of the candidates passed a file format test" - echo "*** using a file magic. Last file checked: $potlib" + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" fi fi else @@ -2694,33 +3581,43 @@ EOF name="`expr $a_deplib : '-l\(.*\)'`" # If $name is empty we are operating on a -L argument. if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check below in file_magic test - if eval echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | egrep "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done done - done + fi if test -n "$a_deplib" ; then droppeddeps=yes - echo - echo "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then - echo "*** with $libname but no candidates were found. (...for regex pattern test)" + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" else - echo "*** with $libname and none of the candidates passed a file format test" - echo "*** using a regex pattern. Last file checked: $potlib" + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" fi fi else @@ -2731,16 +3628,23 @@ EOF ;; none | unknown | *) newdeplibs="" - if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | - grep . >/dev/null; then - echo + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." + $echo "*** Warning: inter-library dependencies are not supported in this platform." else - echo "*** Warning: inter-library dependencies are not known to be supported." + $echo "*** Warning: inter-library dependencies are not known to be supported." fi - echo "*** All declared inter-library dependencies are being dropped." + $echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes fi ;; @@ -2760,17 +3664,17 @@ EOF if test "$droppeddeps" = yes; then if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - echo "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" @@ -2780,16 +3684,16 @@ EOF build_libtool_libs=no fi else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." - if test $allow_undefined = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module @@ -2811,7 +3715,7 @@ EOF # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then - if test $hardcode_into_libs = yes; then + if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= @@ -2847,7 +3751,11 @@ EOF if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir="$hardcode_libdirs" - eval dep_rpath=\"$hardcode_libdir_flag_spec\" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. @@ -2867,6 +3775,7 @@ EOF fi # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names realname="$2" @@ -2877,7 +3786,9 @@ EOF else soname="$realname" fi - test -z "$dlname" && dlname=$soname + if test -z "$dlname"; then + dlname=$soname + fi lib="$output_objdir/$realname" for link @@ -2885,23 +3796,6 @@ EOF linknames="$linknames $link" done - # Ensure that we have .o objects for linkers which dislike .lo - # (e.g. aix) in case we are running --disable-static - for obj in $libobjs; do - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - if test ! -f $xdir/$oldobj; then - $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" - $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? - fi - done - # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -2911,17 +3805,26 @@ EOF $show "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" + cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? + eval cmd=\"$cmd\" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + fi done IFS="$save_ifs" if test -n "$export_symbols_regex"; then - $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' $show "$mv \"${export_symbols}T\" \"$export_symbols\"" $run eval '$mv "${export_symbols}T" "$export_symbols"' fi @@ -2932,46 +3835,30 @@ EOF $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" fi fi - + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" linker_flags="$linker_flags $flag" @@ -2983,25 +3870,148 @@ EOF fi # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi else - save_deplibs="$deplibs" - for conv in $convenience; do - tmp_deplibs= - for test_deplib in $deplibs; do - if test "$test_deplib" != "$conv"; then - tmp_deplibs="$tmp_deplibs $test_deplib" + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$echo "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$output_la-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" fi - done - deplibs="$tmp_deplibs" + last_robj=$output_objdir/$output_la-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + len=1 + fi done - eval cmds=\"$archive_cmds\" - deplibs="$save_deplibs" + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadable object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~\$rm $delfiles\" fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3010,7 +4020,7 @@ EOF # Restore the uninstalled library and exit if test "$mode" = relink; then $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - exit 0 + exit $EXIT_SUCCESS fi # Create links to the real library. @@ -3058,7 +4068,7 @@ EOF *.lo) if test -n "$objs$old_deplibs"; then $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit 1 + exit $EXIT_FAILURE fi libobj="$output" obj=`$echo "X$output" | $Xsed -e "$lo2o"` @@ -3087,38 +4097,10 @@ EOF eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi @@ -3126,10 +4108,11 @@ EOF reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" - eval cmds=\"$reload_cmds\" + cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -3142,7 +4125,7 @@ EOF $run ${rm}r $gentop fi - exit 0 + exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then @@ -3153,37 +4136,24 @@ EOF # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. - $show "echo timestamp > $libobj" - $run eval "echo timestamp > $libobj" || exit $? - exit 0 + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" - eval cmds=\"$reload_cmds\" + cmds=$reload_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done IFS="$save_ifs" - else - # Just create a symlink. - $show $rm $libobj - $run $rm $libobj - xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$libobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - $show "(cd $xdir && $LN_S $oldobj $baseobj)" - $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? fi if test -n "$gentop"; then @@ -3191,12 +4161,12 @@ EOF $run ${rm}r $gentop fi - exit 0 + exit $EXIT_SUCCESS ;; prog) case $host in - *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; esac if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 @@ -3218,16 +4188,19 @@ EOF # On Rhapsody replace the C library is the System framework compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - ;; - esac ;; esac + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + compile_command="$compile_command $compile_deplibs" finalize_command="$finalize_command $finalize_deplibs" @@ -3378,31 +4351,41 @@ extern \"C\" { done if test -n "$exclude_expsyms"; then - $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi if test -n "$export_symbols_regex"; then - $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' $run eval '$mv "$nlist"T "$nlist"' fi # Prepare the list of exported symbols if test -z "$export_symbols"; then - export_symbols="$output_objdir/$output.exp" + export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* ) + $run eval "${SED} -e '1iEXPORTS'"' < "$export_symbols" > "$output_objdir/$outputname.def"' + ;; + esac else - $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' - $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + case $host in + *cygwin* | *mingw* ) + $run eval "${SED} -e '1iEXPORTS'"' < "$output_objdir/$outputname.exp" > "$output_objdir/$outputname.def"' + ;; + esac + $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" - name=`echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval 'echo ": $name " >> "$nlist"' + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done @@ -3411,7 +4394,7 @@ extern \"C\" { test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then - egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $mv "$nlist"T "$nlist" fi @@ -3431,7 +4414,7 @@ extern \"C\" { if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else - echo '/* NONE */' >> "$output_objdir/$dlsyms" + $echo '/* NONE */' >> "$output_objdir/$dlsyms" fi $echo >> "$output_objdir/$dlsyms" "\ @@ -3446,7 +4429,26 @@ extern \"C\" { #endif /* The mapping between symbol names and symbols. */ +" + + case $host in + *cygwin* | *mingw* ) + $echo >> "$output_objdir/$dlsyms" "\ +/* DATA imports from DLLs on WIN32 can't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs */ +struct { +" + ;; + * ) + $echo >> "$output_objdir/$dlsyms" "\ const struct { +" + ;; + esac + + + $echo >> "$output_objdir/$dlsyms" "\ const char *name; lt_ptr address; } @@ -3483,30 +4485,43 @@ static const void *lt_preloaded_setup() { *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; esac;; *-*-hpux*) case "$compile_command " in *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC";; + *) pic_flag_for_symtable=" $pic_flag";; esac esac # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. - $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" - $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + #$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + #$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + case $host in + *cygwin* | *mingw* ) + if test -f "$output_objdir/${outputname}.def" ; then + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` + else + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + fi + ;; + * ) + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + esac ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac else @@ -3519,7 +4534,7 @@ static const void *lt_preloaded_setup() { finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi - if test $need_relink = no || test "$build_libtool_libs" != yes; then + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" @@ -3531,8 +4546,9 @@ static const void *lt_preloaded_setup() { # Delete the generated files. if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" + #$show "$rm $output_objdir/${outputname}S.${objext}" + #$run $rm "$output_objdir/${outputname}S.${objext}" + : fi exit $status @@ -3594,7 +4610,7 @@ static const void *lt_preloaded_setup() { # Link the executable and exit $show "$link_command" $run eval "$link_command" || exit $? - exit 0 + exit $EXIT_SUCCESS fi if test "$hardcode_action" = relink; then @@ -3649,10 +4665,10 @@ static const void *lt_preloaded_setup() { fi # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case $0 in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; - *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` else @@ -3664,15 +4680,355 @@ static const void *lt_preloaded_setup() { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in - *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;; + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in - *cygwin*) exeext=.exe ;; + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; *) exeext= ;; esac + case $host in + *cygwin* | *mingw* ) + output_path=`dirname $output` + cwrappersource=`$echo ${output_path}/${objdir}/lt-${outputname}.c` + cwrapper=`$echo ${output_path}/${outputname}.exe` + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#if defined DEBUGWRAPPER +# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) +#else +# define DEBUG(format, ...) +#endif + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +char * basename (const char *name); +char * find_executable(const char *wrapper); +int check_executable(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup ((char *) basename (argv[0])); + DEBUG("(main) argv[0] : %s\n",argv[0]); + DEBUG("(main) program_name : %s\n",program_name); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = find_executable(argv[0]); + if (newargz[1] == NULL) + lt_fatal("Couldn't find %s", argv[0]); + DEBUG("(main) found exe at : %s\n",newargz[1]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; + + for (i=0; i> $cwrappersource <> $cwrappersource <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +char * +basename (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha (name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return (char *) base; +} + +int +check_executable(const char * path) +{ + struct stat st; + + DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) && + (((st.st_mode & S_IXOTH) == S_IXOTH) || + ((st.st_mode & S_IXGRP) == S_IXGRP) || + ((st.st_mode & S_IXUSR) == S_IXUSR))) + return 1; + else + return 0; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise */ +char * +find_executable (const char* wrapper) +{ + int has_slash = 0; + const char* p; + const char* p_next; + struct stat st; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char* concat_name; + + DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha (wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) +} +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char* path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char* q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR(*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen(tmp); + concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable(concat_name)) + return concat_name; + XFREE(concat_name); + return NULL; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC -s -o $cwrapper $cwrappersource + ;; + esac $rm $output - trap "$rm $output; exit 1" 1 2 15 + trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 $echo > $output "\ #! $SHELL @@ -3688,12 +5044,12 @@ static const void *lt_preloaded_setup() { # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' +Xsed='${SED} -e 1s/^X//' sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" @@ -3748,7 +5104,7 @@ else " if test "$fast_install" = yes; then - echo >> $output "\ + $echo >> $output "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" @@ -3764,7 +5120,7 @@ else $rm \"\$progdir/\$file\" fi" - echo >> $output "\ + $echo >> $output "\ # relink executable if necessary if test -n \"\$relink_command\"; then @@ -3772,7 +5128,7 @@ else else $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" - exit 1 + exit $EXIT_FAILURE fi fi @@ -3782,13 +5138,13 @@ else $rm \"\$progdir/\$file\" fi" else - echo >> $output "\ + $echo >> $output "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi - echo >> $output "\ + $echo >> $output "\ if test -f \"\$progdir/\$program\"; then" @@ -3799,7 +5155,7 @@ else $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 ${SED} + # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` export $shlibpath_var @@ -3819,14 +5175,6 @@ else # Run the actual program with our arguments. " case $host in - # win32 systems need to use the prog path for dll - # lookup to work - *-*-cygwin* | *-*-pw32*) - $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} -" - ;; - # Backslashes separate directories on plain windows *-*-mingw | *-*-os2*) $echo >> $output "\ @@ -3836,30 +5184,26 @@ else *) $echo >> $output "\ - # Export the path to the program. - PATH=\"\$progdir:\$PATH\" - export PATH - - exec \$program \${1+\"\$@\"} + exec \$progdir/\$program \${1+\"\$@\"} " ;; esac $echo >> $output "\ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 + exit $EXIT_FAILURE fi else # The program doesn't exist. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 \$echo \"This script is just a wrapper for \$program.\" 1>&2 - echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit $EXIT_FAILURE fi fi\ " chmod +x $output fi - exit 0 + exit $EXIT_SUCCESS ;; esac @@ -3875,74 +5219,130 @@ fi\ oldobjs="$libobjs_save" build_libtool_libs=no else - oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + oldobjs="$old_deplibs $non_pic_objects" fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi generated="$generated $gentop" - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" + cmds=$old_archive_from_new_cmds else - # Ensure that we have .o objects in place in case we decided - # not to build a shared library, and have fallen back to building - # static libs even though --disable-static was passed! - for oldobj in $oldobjs; do - if test ! -f $oldobj; then - xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$oldobj"; then - xdir="." - else - xdir="$xdir" + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status fi - baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` - obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` - $show "(cd $xdir && ${LN_S} $obj $baseobj)" - $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? fi - done + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do + eval cmd=\"$cmd\" IFS="$save_ifs" $show "$cmd" $run eval "$cmd" || exit $? @@ -3974,8 +5374,12 @@ fi\ fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + # Only create the output if not a dry run. if test -z "$run"; then @@ -3994,7 +5398,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` if test -z "$libdir"; then $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi newdependency_libs="$newdependency_libs $libdir/$name" ;; @@ -4008,7 +5412,7 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi newdlfiles="$newdlfiles $libdir/$name" done @@ -4019,17 +5423,36 @@ fi\ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` if test -z "$libdir"; then $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 + exit $EXIT_FAILURE fi newdlprefiles="$newdlprefiles $libdir/$name" done dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" fi $rm $output # place dlname in correct position for cygwin tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; esac $echo > $output "\ # $outputname - a libtool library file @@ -4058,13 +5481,16 @@ revision=$revision # Is this an already installed library? installed=$installed +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" - if test "$installed" = no && test $need_relink = yes; then + if test "$installed" = no && test "$need_relink" = yes; then $echo >> $output "\ relink_command=\"$relink_command\"" fi @@ -4077,7 +5503,7 @@ relink_command=\"$relink_command\"" $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ;; esac - exit 0 + exit $EXIT_SUCCESS ;; # libtool install mode @@ -4092,7 +5518,7 @@ relink_command=\"$relink_command\"" # Aesthetically quote it. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -4108,7 +5534,7 @@ relink_command=\"$relink_command\"" # Aesthetically quote it. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -4156,7 +5582,7 @@ relink_command=\"$relink_command\"" # Aesthetically quote the argument. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") arg="\"$arg\"" ;; esac @@ -4166,13 +5592,13 @@ relink_command=\"$relink_command\"" if test -z "$install_prog"; then $echo "$modename: you must specify an install program" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test -n "$prev"; then $echo "$modename: the \`$prev' option requires an argument" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test -z "$files"; then @@ -4182,7 +5608,7 @@ relink_command=\"$relink_command\"" $echo "$modename: you must specify a destination" 1>&2 fi $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Strip any trailing slash from the destination. @@ -4200,10 +5626,10 @@ relink_command=\"$relink_command\"" # Not a directory, so check to see that there is only one file specified. set dummy $files - if test $# -gt 2; then + if test "$#" -gt 2; then $echo "$modename: \`$dest' is not a directory" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi fi case $destdir in @@ -4215,7 +5641,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac done @@ -4240,11 +5666,11 @@ relink_command=\"$relink_command\"" *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi library_names= @@ -4276,21 +5702,24 @@ relink_command=\"$relink_command\"" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. if test "$inst_prefix_dir" = "$destdir"; then $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit 1 + exit $EXIT_FAILURE fi if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else - relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi $echo "$modename: warning: relinking \`$file'" 1>&2 @@ -4298,7 +5727,7 @@ relink_command=\"$relink_command\"" if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - continue + exit $EXIT_FAILURE fi fi @@ -4320,7 +5749,7 @@ relink_command=\"$relink_command\"" $run eval "$striplib $destdir/$realname" || exit $? fi - if test $# -gt 0; then + if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. for linkname do @@ -4333,10 +5762,11 @@ relink_command=\"$relink_command\"" # Do each command in the postinstall commands. lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" + cmds=$postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4376,7 +5806,7 @@ relink_command=\"$relink_command\"" *) $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac @@ -4394,7 +5824,7 @@ relink_command=\"$relink_command\"" $show "$install_prog $staticobj $staticdest" $run eval "$install_prog \$staticobj \$staticdest" || exit $? fi - exit 0 + exit $EXIT_SUCCESS ;; *) @@ -4406,29 +5836,49 @@ relink_command=\"$relink_command\"" destfile="$destdir/$destfile" fi + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + # Do a test to see if this is really a libtool program. case $host in *cygwin*|*mingw*) - wrapper=`echo $file | ${SED} -e 's,.exe$,,'` + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` ;; *) wrapper=$file ;; esac - if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then notinst_deplibs= relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac # If there is no directory component, then add one. case $file in - */* | *\\*) . $wrapper ;; - *) . ./$wrapper ;; + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; esac # Check the variables that should have been set. if test -z "$notinst_deplibs"; then $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi finalize=yes @@ -4450,10 +5900,17 @@ relink_command=\"$relink_command\"" done relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac # If there is no directory component, then add one. case $file in - */* | *\\*) . $wrapper ;; - *) . ./$wrapper ;; + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; esac outputname= @@ -4461,17 +5918,17 @@ relink_command=\"$relink_command\"" if test "$finalize" = yes && test -z "$run"; then tmpdir="/tmp" test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null` - if test $? = 0 ; then : - else - tmpdir="$tmpdir/libtool-$$" - fi - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + tmpdir="$tmpdir/libtool-$$" + save_umask=`umask` + umask 0077 + if $mkdir "$tmpdir"; then + umask $save_umask else + umask $save_umask $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 continue fi - file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` @@ -4489,14 +5946,14 @@ relink_command=\"$relink_command\"" fi else # Install the binary that we compiled earlier. - file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyways case $install_prog,$host in - /usr/bin/install*,*cygwin*) + */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok @@ -4505,7 +5962,7 @@ relink_command=\"$relink_command\"" destfile=$destfile.exe ;; *:*.exe) - destfile=`echo $destfile | ${SED} -e 's,.exe$,,'` + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` ;; esac ;; @@ -4526,16 +5983,17 @@ relink_command=\"$relink_command\"" $show "$install_prog $file $oldlib" $run eval "$install_prog \$file \$oldlib" || exit $? - if test -n "$stripme" && test -n "$striplib"; then + if test -n "$stripme" && test -n "$old_striplib"; then $show "$old_striplib $oldlib" $run eval "$old_striplib $oldlib" || exit $? fi # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" + cmds=$old_postinstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || exit $? done @@ -4549,9 +6007,9 @@ relink_command=\"$relink_command\"" if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $0 --finish$current_libdirs' + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else - exit 0 + exit $EXIT_SUCCESS fi ;; @@ -4570,10 +6028,11 @@ relink_command=\"$relink_command\"" for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" + cmds=$finish_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" || admincmds="$admincmds $cmd" @@ -4590,43 +6049,43 @@ relink_command=\"$relink_command\"" fi # Exit here if they wanted silent mode. - test "$show" = ":" && exit 0 + test "$show" = : && exit $EXIT_SUCCESS - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" + $echo "----------------------------------------------------------------------" + $echo "Libraries have been installed in:" for libdir in $libdirs; do - echo " $libdir" + $echo " $libdir" done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" fi if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" - echo " - use the \`$flag' linker flag" + $echo " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then - echo " - have your system administrator run these commands:$admincmds" + $echo " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi - echo - echo "See any operating system documentation about shared libraries for" - echo "more information, such as the ld(1) and ld.so(8) manual pages." - echo "----------------------------------------------------------------------" - exit 0 + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "----------------------------------------------------------------------" + exit $EXIT_SUCCESS ;; # libtool execute mode @@ -4638,7 +6097,7 @@ relink_command=\"$relink_command\"" if test -z "$cmd"; then $echo "$modename: you must specify a COMMAND" 1>&2 $echo "$help" - exit 1 + exit $EXIT_FAILURE fi # Handle -dlopen flags immediately. @@ -4646,18 +6105,18 @@ relink_command=\"$relink_command\"" if test ! -f "$file"; then $echo "$modename: \`$file' is not a file" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi dir= case $file in *.la) # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi # Read the libtool library. @@ -4684,7 +6143,7 @@ relink_command=\"$relink_command\"" dir="$dir/$objdir" else $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 + exit $EXIT_FAILURE fi ;; @@ -4724,7 +6183,7 @@ relink_command=\"$relink_command\"" -*) ;; *) # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case $file in */* | *\\*) . $file ;; @@ -4747,7 +6206,7 @@ relink_command=\"$relink_command\"" eval "export $shlibpath_var" fi - # Restore saved enviroment variables + # Restore saved environment variables if test "${save_LC_ALL+set}" = set; then LC_ALL="$save_LC_ALL"; export LC_ALL fi @@ -4764,7 +6223,7 @@ relink_command=\"$relink_command\"" $echo "export $shlibpath_var" fi $echo "$cmd$args" - exit 0 + exit $EXIT_SUCCESS fi ;; @@ -4792,24 +6251,25 @@ relink_command=\"$relink_command\"" if test -z "$rm"; then $echo "$modename: you must specify an RM program" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi rmdirs= + origobjdir="$objdir" for file in $files; do dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` if test "X$dir" = "X$file"; then dir=. - objdir="$objdir" + objdir="$origobjdir" else - objdir="$dir/$objdir" + objdir="$dir/$origobjdir" fi name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test $mode = uninstall && objdir="$dir" + test "$mode" = uninstall && objdir="$dir" # Remember objdir for removal later, being careful to avoid duplicates - if test $mode = clean; then + if test "$mode" = clean; then case " $rmdirs " in *" $objdir "*) ;; *) rmdirs="$rmdirs $objdir" ;; @@ -4833,7 +6293,7 @@ relink_command=\"$relink_command\"" case $name in *.la) # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. @@ -4841,18 +6301,19 @@ relink_command=\"$relink_command\"" rmfiles="$rmfiles $objdir/$n" done test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - if test $mode = uninstall; then + if test "$mode" = uninstall; then if test -n "$library_names"; then # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" + cmds=$postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test $? != 0 && test "$rmforce" != yes; then + if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -4861,13 +6322,14 @@ relink_command=\"$relink_command\"" if test -n "$old_library"; then # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" + cmds=$old_postuninstall_cmds save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" + eval cmd=\"$cmd\" $show "$cmd" $run eval "$cmd" - if test $? != 0 && test "$rmforce" != yes; then + if test "$?" -ne 0 && test "$rmforce" != yes; then exit_status=1 fi done @@ -4879,22 +6341,52 @@ relink_command=\"$relink_command\"" ;; *.lo) - if test "$build_old_libs" = yes; then - oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` - rmfiles="$rmfiles $dir/$oldobj" + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi fi ;; *) - # Do a test to see if this is a libtool program. - if test $mode = clean && - (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$file + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi fi fi ;; @@ -4902,6 +6394,7 @@ relink_command=\"$relink_command\"" $show "$rm $rmfiles" $run $rm $rmfiles || exit_status=1 done + objdir="$origobjdir" # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do @@ -4917,20 +6410,20 @@ relink_command=\"$relink_command\"" "") $echo "$modename: you must specify a MODE" 1>&2 $echo "$generic_help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac if test -z "$exec_cmd"; then $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$generic_help" 1>&2 - exit 1 + exit $EXIT_FAILURE fi fi # test -z "$show_help" if test -n "$exec_cmd"; then eval exec $exec_cmd - exit 1 + exit $EXIT_FAILURE fi # We need to display help for each of the modes. @@ -4949,6 +6442,7 @@ Provide generalized library-building support services. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] --quiet same as \`--silent' --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG --version print version information MODE must be one of the following: @@ -4962,8 +6456,10 @@ MODE must be one of the following: uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE." - exit 0 +a more detailed description of MODE. + +Report bugs to ." + exit $EXIT_SUCCESS ;; clean) @@ -5074,6 +6570,9 @@ The following components of LINK-COMMAND are treated specially: -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries @@ -5115,14 +6614,34 @@ Otherwise, only FILE itself is deleted using RM." *) $echo "$modename: invalid operation mode \`$mode'" 1>&2 $echo "$help" 1>&2 - exit 1 + exit $EXIT_FAILURE ;; esac -echo +$echo $echo "Try \`$modename --help' for more information about other modes." -exit 0 +exit $? + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script diff --git a/missing b/missing index 64b5f901..09edd884 100755 --- a/missing +++ b/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -scriptversion=2004-09-07.08 +scriptversion=2005-02-08.22 -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. @@ -87,12 +87,12 @@ Supported PROGRAM values: yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." - exit 0 + exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" - exit 0 + exit $? ;; -*) @@ -288,10 +288,14 @@ WARNING: \`$1' is $msg. You should only need it if call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi touch $file ;; diff --git a/mkinstalldirs b/mkinstalldirs index 6fbe5e11..5d26a485 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -1,7 +1,7 @@ #! /bin/sh # mkinstalldirs --- make directory hierarchy -scriptversion=2004-02-15.20 +scriptversion=2005-02-02.21 # Original author: Noah Friedman # Created: 1993-05-16 @@ -27,7 +27,7 @@ while test $# -gt 0 ; do case $1 in -h | --help | --h*) # -h for help echo "$usage" - exit 0 + exit $? ;; -m) # -m PERM arg shift @@ -37,7 +37,7 @@ while test $# -gt 0 ; do ;; --version) echo "$0 $scriptversion" - exit 0 + exit $? ;; --) # stop option processing shift diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index fb02f53d..76735283 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.4 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 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. @@ -132,7 +132,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -162,6 +162,7 @@ ACLOCAL = @ACLOCAL@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AR = @AR@ AUTOCONF = @AUTOCONF@ AUTODIRS = @AUTODIRS@ AUTOHEADER = @AUTOHEADER@ @@ -172,6 +173,10 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -183,6 +188,8 @@ EGREP = @EGREP@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -212,13 +219,19 @@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ From dd52588aaefb75923c7656c03b3ef16157744522 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 6 Jun 2005 14:51:09 +0000 Subject: [PATCH 2271/2994] Use dynamic buffer in ntfs_device_win32_find_partition(). Based on patch from Yuval. --- libntfs/win32_io.c | 47 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 26e77ac6..0e4305ac 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -669,23 +669,47 @@ static HANDLE ntfs_device_win32_open_volume_for_partition(unsigned int drive_id, * the partition attributes are returned back. * * Return TRUE if found, and sets the output parameters. - * FALSE if not. + * FALSE if not and errno is set to the error code. */ static BOOL ntfs_device_win32_find_partition(HANDLE handle, DWORD partition_id, s64 *part_offset, s64 *part_length, int *hidden_sectors) { DRIVE_LAYOUT_INFORMATION *drive_layout; + unsigned int err, buf_size, part_count; DWORD i; - char buf[sizeof(DRIVE_LAYOUT_INFORMATION) + - 9 * sizeof(PARTITION_INFORMATION)]; - if (!DeviceIoControl(handle, IOCTL_DISK_GET_DRIVE_LAYOUT, NULL, 0, - &buf, sizeof(buf), &i, NULL)) { - errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: GetDriveLayout failed."); - return FALSE; - } - drive_layout = (DRIVE_LAYOUT_INFORMATION *)buf; + /* + * There is no way to know the required buffer, so if the ioctl fails, + * try doubling the buffer size each time until the ioctl succeeds. + */ + part_count = 8; + do { + buf_size = sizeof(DRIVE_LAYOUT_INFORMATION) + + part_count * sizeof(PARTITION_INFORMATION); + drive_layout = malloc(buf_size); + if (!drive_layout) { + errno = ENOMEM; + return FALSE; + } + if (DeviceIoControl(handle, IOCTL_DISK_GET_DRIVE_LAYOUT, NULL, + 0, (BYTE*)drive_layout, buf_size, &i, NULL)) + break; + err = GetLastError(); + free(drive_layout); + if (err != ERROR_INSUFFICIENT_BUFFER) { + Dputs("Error: GetDriveLayout failed."); + errno = ntfs_w32error_to_errno(err); + return FALSE; + } + Dprintf("More than %u partitions.\n", part_count); + part_count <<= 1; + if (part_count > 512) { + Dputs("Error: GetDriveLayout failed: More than 512 " + "partitions?"); + errno = ENOBUFS; + return FALSE; + } + } while (1); for (i = 0; i < drive_layout->PartitionCount; i++) { if (drive_layout->PartitionEntry[i].PartitionNumber == partition_id) { @@ -695,9 +719,12 @@ static BOOL ntfs_device_win32_find_partition(HANDLE handle, DWORD partition_id, PartitionLength.QuadPart; *hidden_sectors = drive_layout->PartitionEntry[i]. HiddenSectors; + free(drive_layout); return TRUE; } } + free(drive_layout); + errno = ENOENT; return FALSE; } From 94cc7ff15f0ea658f5ccb32934e1a17742332028 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 8 Jun 2005 18:01:46 +0000 Subject: [PATCH 2272/2994] Move flags dumping into the separate function. --- ntfsprogs/ntfsinfo.c | 167 +++++++++++++++---------------------------- 1 file changed, 59 insertions(+), 108 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index e06e544f..23773ed6 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -100,7 +100,7 @@ static void version (void) printf (" 2002-2004 Anton Altaparmakov\n"); printf (" 2002-2003 Richard Russon\n"); printf (" 2003 Leonard NorrgĂĄrd\n"); - printf (" 2004 Yura Pakhuchiy\n"); + printf (" 2004-2005 Yura Pakhuchiy\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -387,45 +387,13 @@ static void ntfs_dump_volume(ntfs_volume *vol) //TODO: Still need to add a few more attributes } - -/* *************** functions for dumping attributes ******************** */ /** - * ntfs_dump_standard_information + * ntfs_dump_flags - Dump flags for STANDARD_INFORMATION and FILE_NAME. + * @type: dump flags for this attribute type + * @flags: flags for dumping */ -static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) +static void ntfs_dump_flags(ATTR_TYPES type, u32 flags) { - STANDARD_INFORMATION *standard_attr = NULL; - u32 value_length, flags; - - standard_attr = (STANDARD_INFORMATION*)((char *)attr + - le16_to_cpu(attr->value_offset)); - - printf("Dumping attribute $STANDARD_INFORMATION (0x10)\n"); - - printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); - - /* let's start with mandatory? fields */ - - /* time conversion stuff */ - if (!opts.notime) { - char *ntfs_time_str = NULL; - - ntfs_time_str = ntfsinfo_time_to_str(standard_attr->creation_time); - printf("\tFile Creation Time:\t %s",ntfs_time_str); - - ntfs_time_str = ntfsinfo_time_to_str( - standard_attr->last_data_change_time); - printf("\tFile Altered Time:\t %s",ntfs_time_str); - - ntfs_time_str = ntfsinfo_time_to_str( - standard_attr->last_mft_change_time); - printf("\tMFT Changed Time:\t %s",ntfs_time_str); - - ntfs_time_str = ntfsinfo_time_to_str(standard_attr->last_access_time); - printf("\tLast Accessed Time:\t %s",ntfs_time_str); - } - - flags = standard_attr->file_attributes; printf("\tFile attributes:\t"); if (flags & FILE_ATTR_READONLY) { printf(" READONLY"); @@ -479,9 +447,58 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) printf(" ENCRYPTED"); flags &= ~FILE_ATTR_ENCRYPTED; } + if (type == AT_FILE_NAME) { + if (flags & FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) { + printf(" DIRECTORY"); + flags &= ~FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; + } + if (flags & FILE_ATTR_DUP_VIEW_INDEX_PRESENT) { + printf(" INDEX_VIEW"); + flags &= ~FILE_ATTR_DUP_VIEW_INDEX_PRESENT; + } + } if (flags) printf(" UNKNOWN: 0x%x", (unsigned int)le32_to_cpu(flags)); printf("\n"); +} + +/* *************** functions for dumping attributes ******************** */ +/** + * ntfs_dump_standard_information + */ +static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) +{ + STANDARD_INFORMATION *standard_attr = NULL; + u32 value_length; + + standard_attr = (STANDARD_INFORMATION*)((char *)attr + + le16_to_cpu(attr->value_offset)); + + printf("Dumping attribute $STANDARD_INFORMATION (0x10)\n"); + + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); + + /* let's start with mandatory? fields */ + + /* time conversion stuff */ + if (!opts.notime) { + char *ntfs_time_str = NULL; + + ntfs_time_str = ntfsinfo_time_to_str(standard_attr->creation_time); + printf("\tFile Creation Time:\t %s",ntfs_time_str); + + ntfs_time_str = ntfsinfo_time_to_str( + standard_attr->last_data_change_time); + printf("\tFile Altered Time:\t %s",ntfs_time_str); + + ntfs_time_str = ntfsinfo_time_to_str( + standard_attr->last_mft_change_time); + printf("\tMFT Changed Time:\t %s",ntfs_time_str); + + ntfs_time_str = ntfsinfo_time_to_str(standard_attr->last_access_time); + printf("\tLast Accessed Time:\t %s",ntfs_time_str); + } + ntfs_dump_flags(attr->type, standard_attr->file_attributes); printf("\tMax Number of Versions:\t %u \n", (unsigned int)le32_to_cpu(standard_attr->maximum_versions)); @@ -489,7 +506,6 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) (unsigned int)le32_to_cpu(standard_attr->version_number)); printf("\tClass ID:\t\t %u \n", (unsigned int)le32_to_cpu(standard_attr->class_id)); - value_length = le32_to_cpu(attr->value_length); if (value_length == 48) { @@ -505,7 +521,6 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) "either 72 or 48, something is wrong...\n", (unsigned int)value_length); } - } /** @@ -613,7 +628,6 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) { FILE_NAME_ATTR *file_name_attr = NULL; - u32 flags; file_name_attr = (FILE_NAME_ATTR*)((char *)attr + le16_to_cpu(attr->value_offset)); @@ -654,71 +668,7 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) (long long)sle64_to_cpu(file_name_attr->data_size)); printf("\tParent directory:\t %lld\n", (long long)MREF_LE(file_name_attr->parent_directory)); - flags = file_name_attr->file_attributes; - printf("\tFile attributes:\t"); - if (flags & FILE_ATTR_READONLY) { - printf(" READONLY"); - flags &= ~FILE_ATTR_READONLY; - } - if (flags & FILE_ATTR_HIDDEN) { - printf(" HIDDEN"); - flags &= ~FILE_ATTR_HIDDEN; - } - if (flags & FILE_ATTR_SYSTEM) { - printf(" SYSTEM"); - flags &= ~FILE_ATTR_SYSTEM; - } - if (flags & FILE_ATTR_ARCHIVE) { - printf(" ARCHIVE"); - flags &= ~FILE_ATTR_ARCHIVE; - } - if (flags & FILE_ATTR_DEVICE) { - printf(" DEVICE"); - flags &= ~FILE_ATTR_DEVICE; - } - if (flags & FILE_ATTR_NORMAL) { - printf(" NORMAL"); - flags &= ~FILE_ATTR_NORMAL; - } - if (flags & FILE_ATTR_TEMPORARY) { - printf(" TEMPORARY"); - flags &= ~FILE_ATTR_TEMPORARY; - } - if (flags & FILE_ATTR_SPARSE_FILE) { - printf(" SPARSE_FILE"); - flags &= ~FILE_ATTR_SPARSE_FILE; - } - if (flags & FILE_ATTR_REPARSE_POINT) { - printf(" REPARSE_POINT"); - flags &= ~FILE_ATTR_REPARSE_POINT; - } - if (flags & FILE_ATTR_COMPRESSED) { - printf(" COMPRESSED"); - flags &= ~FILE_ATTR_COMPRESSED; - } - if (flags & FILE_ATTR_OFFLINE) { - printf(" OFFLINE"); - flags &= ~FILE_ATTR_OFFLINE; - } - if (flags & FILE_ATTR_NOT_CONTENT_INDEXED) { - printf(" NOT_CONTENT_INDEXED"); - flags &= ~FILE_ATTR_NOT_CONTENT_INDEXED; - } - if (flags & FILE_ATTR_ENCRYPTED) { - printf(" ENCRYPTED"); - flags &= ~FILE_ATTR_ENCRYPTED; - } - if (flags & FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) { - printf(" DIRECTORY"); - flags &= ~FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; - } - if (flags & FILE_ATTR_DUP_VIEW_INDEX_PRESENT) { - printf(" INDEX_VIEW"); - flags &= ~FILE_ATTR_DUP_VIEW_INDEX_PRESENT; - } - if (flags) - printf(" UNKNOWN: 0x%x", (unsigned int)le32_to_cpu(flags)); - printf("\n"); + ntfs_dump_flags(attr->type, file_name_attr->file_attributes); /* time stuff stuff */ if (!opts.notime) { @@ -1126,9 +1076,10 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) case(AT_FILE_NAME): Vprintf("\t\tFILE record number:\t %llu\n", MREF_LE(entry->indexed_file)); - Vprintf("\t\tFile attributes:\t 0x%08x\n", - (unsigned int)le32_to_cpu( - entry->key.file_name.file_attributes)); + Vprintf("\t"); + if (opts.verbose) + ntfs_dump_flags(type, entry->key. + file_name.file_attributes); Vprintf("\t\tFile name namespace:\t 0x%02x\n", entry->key.file_name.file_name_type); ntfs_ucstombs(entry->key.file_name.file_name, From 373e47acb524537f2b4d106ae78f186c48e6a36c Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 8 Jun 2005 18:02:29 +0000 Subject: [PATCH 2273/2994] Fix coding style. --- libntfs/inode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 49b64320..bbe0f3b0 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -421,7 +421,8 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) * * Return 0 on success or -1 on error with errno set to the error code. */ -static int ntfs_inode_sync_standard_information(ntfs_inode *ni) { +static int ntfs_inode_sync_standard_information(ntfs_inode *ni) +{ ntfs_attr_search_ctx *ctx; STANDARD_INFORMATION *std_info; int err; @@ -465,7 +466,8 @@ static int ntfs_inode_sync_standard_information(ntfs_inode *ni) { * * Return 0 on success or -1 on error with errno set to the error code. */ -static int ntfs_inode_sync_file_name(ntfs_inode *ni) { +static int ntfs_inode_sync_file_name(ntfs_inode *ni) +{ ntfs_attr_search_ctx *ctx = NULL; ntfs_index_context *ictx; ntfs_inode *index_ni; From e5c8b9606eed3ca8e9eefc3fb1d175769321628b Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 9 Jun 2005 08:29:03 +0000 Subject: [PATCH 2274/2994] Cristi Klein - display the namespace of the file's name --- ntfsprogs/ntfsinfo.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 23773ed6..389a354c 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -3,8 +3,9 @@ * * Copyright (c) 2002-2004 Matthew J. Fanto * Copyright (c) 2002-2004 Anton Altaparmakov - * Copyright (c) 2002-2003 Richard Russon + * Copyright (c) 2002-2005 Richard Russon * Copyright (c) 2004-2005 Yura Pakhuchiy + * Copyright (c) 2005 Cristian Klein * * This utility will dump a file's attributes. * @@ -628,6 +629,7 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) { FILE_NAME_ATTR *file_name_attr = NULL; + const char *mbs_file_type = NULL; file_name_attr = (FILE_NAME_ATTR*)((char *)attr + le16_to_cpu(attr->value_offset)); @@ -659,6 +661,25 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) printf("\tFile Name:\t\t unnamed?!?\n"); } + /* name space */ + switch (file_name_attr->file_name_type) { + case FILE_NAME_POSIX: + mbs_file_type = "POSIX"; + break; + case FILE_NAME_WIN32: + mbs_file_type = "Win32"; + break; + case FILE_NAME_DOS: + mbs_file_type = "DOS"; + break; + case FILE_NAME_WIN32_AND_DOS: + mbs_file_type = "Win32 & DOS"; + break; + } + if (mbs_file_type == NULL) // should never happen + mbs_file_type = "(unknown)"; + printf("\tNamespace:\t\t %s\n", mbs_file_type); + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* other basic stuff about the file */ From 554b27dd47faac5c2c318a43fb4f58d34159363c Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 9 Jun 2005 09:05:30 +0000 Subject: [PATCH 2275/2994] ignore built/generated files --- doc/.cvsignore | 1 + include/.cvsignore | 1 + include/ntfs/.cvsignore | 1 + libntfs/.cvsignore | 7 +++++++ ntfsprogs/.cvsignore | 20 ++++++++++++++++++++ 5 files changed, 30 insertions(+) create mode 100644 doc/.cvsignore create mode 100644 include/.cvsignore create mode 100644 include/ntfs/.cvsignore create mode 100644 libntfs/.cvsignore create mode 100644 ntfsprogs/.cvsignore diff --git a/doc/.cvsignore b/doc/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/doc/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/include/.cvsignore b/include/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/include/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/include/ntfs/.cvsignore b/include/ntfs/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/include/ntfs/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/libntfs/.cvsignore b/libntfs/.cvsignore new file mode 100644 index 00000000..b3109419 --- /dev/null +++ b/libntfs/.cvsignore @@ -0,0 +1,7 @@ +.deps +.libs +Makefile +libntfs-gnomevfs.8 +libntfs.conf +libntfs.la +*.lo diff --git a/ntfsprogs/.cvsignore b/ntfsprogs/.cvsignore new file mode 100644 index 00000000..e740ab42 --- /dev/null +++ b/ntfsprogs/.cvsignore @@ -0,0 +1,20 @@ +.deps +Makefile +mkntfs +ntfscat +ntfsclone +ntfscluster +ntfscp +ntfsdump_logfile +ntfsfix +ntfsinfo +ntfslabel +ntfsls +ntfsmftalloc +ntfsmove +ntfsresize +ntfsrm +ntfstruncate +ntfsundelete +ntfswipe +*.8 From 95c2b79c45903b7554531bd151ad5a5aa80d0457 Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 9 Jun 2005 09:29:34 +0000 Subject: [PATCH 2276/2994] ignore built/generated files --- .cvsignore | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .cvsignore diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 00000000..c235cc7c --- /dev/null +++ b/.cvsignore @@ -0,0 +1,8 @@ +Makefile +autom4te.cache +config.h +config.log +config.status +libtool +ntfsprogs.spec +stamp-h1 From aae6371c9d7d3f34b2f3106d7321a6ee1fd04564 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 9 Jun 2005 13:08:23 +0000 Subject: [PATCH 2277/2994] Move namespace dumping into separate function and use it in attribute and index dumping. --- ntfsprogs/ntfsinfo.c | 56 +++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 389a354c..fc66549d 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -463,6 +463,30 @@ static void ntfs_dump_flags(ATTR_TYPES type, u32 flags) printf("\n"); } +static void ntfs_dump_namespace(u8 file_name_type) +{ + const char *mbs_file_type = NULL; + + /* name space */ + switch (file_name_type) { + case FILE_NAME_POSIX: + mbs_file_type = "POSIX"; + break; + case FILE_NAME_WIN32: + mbs_file_type = "Win32"; + break; + case FILE_NAME_DOS: + mbs_file_type = "DOS"; + break; + case FILE_NAME_WIN32_AND_DOS: + mbs_file_type = "Win32 & DOS"; + break; + } + if (mbs_file_type == NULL) /* should never happen */ + mbs_file_type = "(unknown)"; + printf("\tNamespace:\t\t %s\n", mbs_file_type); +} + /* *************** functions for dumping attributes ******************** */ /** * ntfs_dump_standard_information @@ -629,7 +653,6 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) { FILE_NAME_ATTR *file_name_attr = NULL; - const char *mbs_file_type = NULL; file_name_attr = (FILE_NAME_ATTR*)((char *)attr + le16_to_cpu(attr->value_offset)); @@ -660,25 +683,8 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) } else { printf("\tFile Name:\t\t unnamed?!?\n"); } - - /* name space */ - switch (file_name_attr->file_name_type) { - case FILE_NAME_POSIX: - mbs_file_type = "POSIX"; - break; - case FILE_NAME_WIN32: - mbs_file_type = "Win32"; - break; - case FILE_NAME_DOS: - mbs_file_type = "DOS"; - break; - case FILE_NAME_WIN32_AND_DOS: - mbs_file_type = "Win32 & DOS"; - break; - } - if (mbs_file_type == NULL) // should never happen - mbs_file_type = "(unknown)"; - printf("\tNamespace:\t\t %s\n", mbs_file_type); + + ntfs_dump_namespace(file_name_attr->file_name_type); printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); @@ -1097,12 +1103,14 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) case(AT_FILE_NAME): Vprintf("\t\tFILE record number:\t %llu\n", MREF_LE(entry->indexed_file)); - Vprintf("\t"); - if (opts.verbose) + if (opts.verbose) { + printf("\t"); ntfs_dump_flags(type, entry->key. file_name.file_attributes); - Vprintf("\t\tFile name namespace:\t 0x%02x\n", - entry->key.file_name.file_name_type); + printf("\t"); + ntfs_dump_namespace(entry->key. + file_name.file_name_type); + } ntfs_ucstombs(entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0); From 676d8782e8d7640c98c8a38a37e8e773eac2cc76 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 9 Jun 2005 22:09:39 +0000 Subject: [PATCH 2278/2994] - Update attribute definition handling. (Anton, Yura) --- ChangeLog | 1 + include/ntfs/layout.h | 40 +++++++++++++++++++++++++++++----------- libntfs/attrib.c | 15 +++++---------- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index c2caa5d9..cf161dd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -158,6 +158,7 @@ xx/xx/2005 - 2.0.0-WIP FileNameDirty to indicate that FILE_NAME attributes need update. At least after attribute resize we leave absolutely consist volume. (Yura) + - Update attribute definition handling. (Anton, Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index f8d9f0f9..f8652e06 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -539,19 +539,37 @@ typedef enum { /* * The flags (32-bit) describing attribute properties in the attribute - * definition structure. FIXME: This information is from Regis's information - * and, according to him, it is not certain and probably incomplete. - * The INDEXABLE flag is fairly certainly correct as only the file name - * attribute has this flag set and this is the only attribute indexed in NT4. + * definition structure. FIXME: This information is based on Regis's + * information and, according to him, it is not certain and probably + * incomplete. The INDEXABLE flag is fairly certainly correct as only the file + * name attribute has this flag set and this is the only attribute indexed in + * NT4. */ typedef enum { - INDEXABLE = const_cpu_to_le32(0x02), /* Attribute can be - indexed. */ - NEED_TO_REGENERATE = const_cpu_to_le32(0x40), /* Need to regenerate - during regeneration - phase. */ - CAN_BE_NON_RESIDENT = const_cpu_to_le32(0x80), /* Attribute can be - non-resident. */ + ATTR_DEF_INDEXABLE = const_cpu_to_le32(0x02), /* Attribute can be + indexed. */ + ATTR_DEF_MULTIPLE = const_cpu_to_le32(0x04), /* Attribute type + can be present multiple times in the + mft records of an inode. */ + ATTR_DEF_NOT_ZERO = const_cpu_to_le32(0x08), /* Attribute value + must contain at least one non-zero + byte. */ + ATTR_DEF_INDEXED_UNIQUE = const_cpu_to_le32(0x10), /* Attribute must be + indexed and the attribute value must be + unique for the attribute type in all of + the mft records of an inode. */ + ATTR_DEF_NAMED_UNIQUE = const_cpu_to_le32(0x20), /* Attribute must be + named and the name must be unique for + the attribute type in all of the mft + records of an inode. */ + ATTR_DEF_RESIDENT = const_cpu_to_le32(0x40), /* Attribute must be + resident. */ + ATTR_DEF_ALWAYS_LOG = const_cpu_to_le32(0x80), /* Always log + modifications to this attribute, + regardless of whether it is resident or + non-resident. Without this, only log + modifications if the attribute is + resident. */ } ATTR_DEF_FLAGS; /* diff --git a/libntfs/attrib.c b/libntfs/attrib.c index cf963d6e..c22a15de 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2358,21 +2358,16 @@ int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type) { ATTR_DEF *ad; - /* - * $DATA is always allowed to be non-resident even if $AttrDef does not - * specify this in the flags of the $DATA attribute definition record. - */ - if (type == AT_DATA) - return 0; /* Find the attribute definition record in $AttrDef. */ ad = ntfs_attr_find_in_attrdef(vol, type); if (!ad) return -1; /* Check the flags and return the result. */ - if (ad->flags & CAN_BE_NON_RESIDENT) - return 0; - errno = EPERM; - return -1; + if (ad->flags & ATTR_DEF_RESIDENT) { + errno = EPERM; + return -1; + } + return 0; } /** From dd0b3bdc7e5597969f00fd4b28ff28f70b24f936 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 11 Jun 2005 15:30:07 +0000 Subject: [PATCH 2279/2994] - Add descriptions for the new command line options --- ntfsprogs/ntfsclone.8.in | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index fd3878a8..3312a5fd 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -5,7 +5,7 @@ .\" All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLONE 8 "Feb 2005" "ntfsprogs version @VERSION@" +.TH NTFSCLONE 8 "Jun 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsclone \- Efficiently clone, image or restore an NTFS filesystem .SH SYNOPSIS @@ -168,14 +168,10 @@ standard output. Clone NTFS to .I FILE\fR, overwriting if exists. .TP -.B \-m, \-\-metadata -Clone -.B ONLY METADATA -(for NTFS experts). Moreover only cloning to a file is allowed. -You can't metadata-only clone to a device, image or standard output. -.TP .B \-s, \-\-save\-image -Save to the special image format. +Save to the special image format. This is the most efficient way space and +speed-wise if imaging is done to the standard output, e.g. for image +compression, encryption or streaming through a network. .TP .B \-r, \-\-restore\-image Restore from the special image format specified by @@ -184,6 +180,25 @@ If the .I source is '\-' then the image is read from the standard input. .TP +.B \-\-rescue +Ignore disk read errors so disks having bad sectors, e.g. dying disks, can be +rescued the most efficiently way, with minimal stress on them. Ntfsclone works +at the lowest, sector level in this mode too thus more data can be rescued. +The contents of the unreadable sectors are filled by character '?' and the +beginning of such sectors are marked by "BadSectoR\\0". +.TP +.B \-m, \-\-metadata +Clone +.B ONLY METADATA +(for NTFS experts). Moreover only cloning to a file is allowed. +You can't metadata-only clone to a device, image or standard output. +.TP +.B \-\-ignore\-fs\-check +Ignore the result of the filesystem consistency check. This option is allowed +to be used only with the +.BR --metadata +option, for the safety of user's data. +.TP .B \-f, \-\-force Forces ntfsclone to proceed if the filesystem is marked "dirty" for consistency check. From 954b728dbab9594f3a92c2332b75d066b37d8875 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 12 Jun 2005 09:24:11 +0000 Subject: [PATCH 2280/2994] - Rephrase ntfs_bugs: don't imply that tools have lots of bugs. That's not true and it unnecessary worries people (originally the ntfs_bugs idea was taken from the GNU coreutils that _DO_ have often bugs but they aren't so critical concerning user's data integrity) --- ntfsprogs/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 8607c834..2b3b03ca 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -47,7 +47,7 @@ #include "debug.h" #include "dir.h" -const char *ntfs_bugs = "Please report bugs to linux-ntfs-dev@lists.sourceforge.net\n"; +const char *ntfs_bugs = "Developers' email address: linux-ntfs-dev@lists.sourceforge.net\n"; const char *ntfs_home = "Linux NTFS homepage: http://linux-ntfs.sourceforge.net\n"; const char *ntfs_gpl = "This program is free software, released under the GNU " "General Public License\nand you are welcome to redistribute it under " From 8dae1da5628b4cea6b0ee78381bf96c6881caa3e Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 12 Jun 2005 09:55:45 +0000 Subject: [PATCH 2281/2994] - Revised ntfsclone's usage() message --- ntfsprogs/ntfsclone.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 1ad8963e..5090fdc0 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -210,26 +210,26 @@ static int perr_exit(const char *fmt, ...) static void usage(void) __attribute__((noreturn)); static void usage(void) { - Eprintf("\nUsage: %s [options] source\n" + Eprintf("\nUsage: %s [options] SOURCE\n" " Efficiently clone NTFS to a sparse file, image, device or standard output.\n" "\n" " -o, --output FILE Clone NTFS to the non-existent FILE\n" " -O, --overwrite FILE Clone NTFS to FILE, overwriting if exists\n" - " -m, --metadata Clone *only* metadata (for NTFS experts)\n" " -s, --save-image Save to the special image format\n" " -r, --restore-image Restore from the special image format\n" - " --ignore-fs-check Ignore the filesystem check result\n" " --rescue Continue after disk read errors\n" + " -m, --metadata Clone *only* metadata (for NTFS experts)\n" + " --ignore-fs-check Ignore the filesystem check result\n" " -f, --force Force to progress (DANGEROUS)\n" " -h, --help Display this help\n" #ifdef DEBUG " -d, --debug Show debug information\n" #endif "\n" - " If FILE is '-' then send NTFS data to stdout replacing non used\n" - " NTFS and partition space with zeros.\n" + " If FILE is '-' then send the image to the standard output. If SOURCE is '-'\n" + " and --restore-image is used then read the image from the standard input.\n" "\n", EXEC_NAME); - Eprintf("%s%s\n", ntfs_bugs, ntfs_home); + Eprintf("%s%s", ntfs_bugs, ntfs_home); exit(1); } From 4fcd676f6368a3955e0c831fc9f5de62d4e827e4 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 12 Jun 2005 10:15:21 +0000 Subject: [PATCH 2282/2994] - More explanatory error message about failing to open a volume --- ntfsprogs/ntfsclone.c | 6 +++--- ntfsprogs/ntfsresize.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 5090fdc0..4cc57314 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1094,10 +1094,10 @@ static void check_if_mounted(const char *device, unsigned long new_mntflag) if (mntflag & NTFS_MF_MOUNTED) { if (!(mntflag & NTFS_MF_READONLY)) - err_exit("Device %s is mounted read-write. " + err_exit("Device '%s' is mounted read-write. " "You must 'umount' it first.\n", device); if (!new_mntflag) - err_exit("Device %s is mounted. " + err_exit("Device '%s' is mounted. " "You must 'umount' it first.\n", device); } } @@ -1115,7 +1115,7 @@ static void mount_volume(unsigned long new_mntflag) int err = errno; - perr_printf("ntfs_mount failed"); + perr_printf("Opening '%s' as NTFS failed", opt.volume); if (err == EINVAL) { Printf("Apparently device '%s' doesn't have a " "valid NTFS. Maybe you selected\nthe whole " diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index cccf34b1..aa4ef0ca 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2057,10 +2057,10 @@ static ntfs_volume *mount_volume(void) } if (mntflag & NTFS_MF_MOUNTED) { if (!(mntflag & NTFS_MF_READONLY)) - err_exit("Device %s is mounted read-write. " + err_exit("Device '%s' is mounted read-write. " "You must 'umount' it first.\n", opt.volume); if (!opt.ro_flag) - err_exit("Device %s is mounted. " + err_exit("Device '%s' is mounted. " "You must 'umount' it first.\n", opt.volume); } @@ -2068,7 +2068,7 @@ static ntfs_volume *mount_volume(void) int err = errno; - perr_printf("ntfs_mount failed"); + perr_printf("Opening '%s' as NTFS failed", opt.volume); if (err == EINVAL) printf(invalid_ntfs_msg, opt.volume); else if (err == EIO) From b4a712b9e10ab93d03c6c71514197cd03c086951 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 12 Jun 2005 11:02:50 +0000 Subject: [PATCH 2283/2994] - Use consistent option and parameter naming convention --- ntfsprogs/ntfsclone.8.in | 22 +++++++++++----------- ntfsprogs/ntfsclone.c | 2 +- ntfsprogs/ntfsresize.8.in | 30 ++++++++++++++++-------------- ntfsprogs/ntfsresize.c | 8 ++++---- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 3312a5fd..cff0c187 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -10,20 +10,20 @@ ntfsclone \- Efficiently clone, image or restore an NTFS filesystem .SH SYNOPSIS .B ntfsclone -[\fBOPTIONS\fR] -.I source +[\fIOPTIONS\fR] +.I SOURCE .br .B ntfsclone \-\-save-image -[\fBOPTIONS\fR] -.I source +[\fIOPTIONS\fR] +.I SOURCE .br .B ntfsclone \-\-restore-image -[\fBOPTIONS\fR] -.I source +[\fIOPTIONS\fR] +.I SOURCE .br .B ntfsclone \-\-metadata -[\fBOPTIONS\fR] -.I source +[\fIOPTIONS\fR] +.I SOURCE .SH DESCRIPTION .B ntfsclone will efficiently clone (copy, save, backup, restore) an NTFS filesystem to a @@ -116,7 +116,7 @@ or the .B \-\-restore\-image option. Note that you can restore images from standard input by using '\-' as the -.I source +.I SOURCE file. .SH METADATA-ONLY CLONING One of the features of @@ -175,9 +175,9 @@ compression, encryption or streaming through a network. .TP .B \-r, \-\-restore\-image Restore from the special image format specified by -.I source\fR. +.I SOURCE\fR. If the -.I source +.I SOURCE is '\-' then the image is read from the standard input. .TP .B \-\-rescue diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 4cc57314..f48f52dc 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -210,7 +210,7 @@ static int perr_exit(const char *fmt, ...) static void usage(void) __attribute__((noreturn)); static void usage(void) { - Eprintf("\nUsage: %s [options] SOURCE\n" + Eprintf("\nUsage: %s [OPTIONS] SOURCE\n" " Efficiently clone NTFS to a sparse file, image, device or standard output.\n" "\n" " -o, --output FILE Clone NTFS to the non-existent FILE\n" diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 87395885..9c0b4e60 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -1,34 +1,34 @@ .\" -*- nroff -*- -.\" Copyright 2002-2004 by Szabolcs Szakacsits All Rights Reserved. +.\" Copyright 2002-2005 by Szabolcs Szakacsits All Rights Reserved. .\" -.TH NTFSRESIZE 8 "Mar 2004" "ntfsprogs version @VERSION@" +.TH NTFSRESIZE 8 "Jun 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsresize \- resize an NTFS filesystem without data loss .SH SYNOPSIS .B ntfsresize -[\fBOPTIONS\fR] +[\fIOPTIONS\fR] .B --info -.I device +.I DEVICE .br .B ntfsresize -[\fBOPTIONS\fR] -[\fB\-\-size \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR]] -.I device +[\fIOPTIONS\fR] +[\fB\-\-size \fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR]] +.I DEVICE .SH DESCRIPTION The .B ntfsresize program non-destructively resizes Windows XP/2000/NT4, Windows Server 2003 or Longhorn Beta NTFS filesystems. It can be used to shrink or enlarge any NTFS filesystem located on an unmounted -.I device +.I DEVICE (usually a disk partition). The new filesystem will have -.I size +.I SIZE bytes. The -.I size +.I SIZE parameter may have one of the optional modifiers \fBk\fR, \fBM\fR, \fBG\fR, which means the -.I size +.I SIZE parameter is given in kilo-, mega- or gigabytes respectively. .B ntfsresize conforms to the SI, ATA, IEEE standards and the disk manufacturers @@ -39,7 +39,9 @@ If both and .B --size are omitted then the -NTFS filesystem will be enlarged to the underlying device size. +NTFS filesystem will be enlarged to the underlying +.I DEVICE +size. .PP The .B ntfsresize @@ -114,10 +116,10 @@ that Windows might need about 50-100 MB free space left to boot safely. This option never causes any changes to the filesystem, the partition is opened read-only. .TP -.B -s, --size \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] +.B -s, --size \fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR] Resize filesystem to \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes. The optional modifiers \fBk\fR, \fBM\fR, \fBG\fR mean the -.I size +.I SIZE parameter is given in kilo-, mega- or gigabytes respectively. Conforming to standards, k=10^3, M=10^6 and G=10^9. Use this option with diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index aa4ef0ca..8402b5a8 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -272,10 +272,10 @@ static void usage(void) __attribute__((noreturn)); static void usage(void) { - printf ("\nUsage: %s [options] device\n" - " Resize an NTFS volume non-destructively.\n" + printf ("\nUsage: %s [OPTIONS] DEVICE\n" + " Resize an NTFS volume non-destructively, safely move any data if needed.\n" "\n" - " -i, --info Estimate the smallest shrunken size supported\n" + " -i, --info Estimate the smallest shrunken size possible\n" " -s, --size SIZE Resize volume to SIZE[k|M|G] bytes\n" "\n" " -n, --no-action Do not write to disk\n" @@ -289,7 +289,7 @@ static void usage(void) #endif "\n" " The options -i and -s are mutually exclusive. If both options are\n" - " omitted then the NTFS volume will be enlarged to the device size.\n" + " omitted then the NTFS volume will be enlarged to the DEVICE size.\n" "\n", EXEC_NAME); printf ("%s%s", ntfs_bugs, ntfs_home); printf ("Ntfsresize FAQ: http://linux-ntfs.sourceforge.net/info/ntfsresize.html\n"); From 351793635500e018a39f35bb6652086497f2201a Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 12 Jun 2005 13:39:23 +0000 Subject: [PATCH 2284/2994] - ntfsresize manual update --- ntfsprogs/ntfsresize.8.in | 80 +++++++++++++++++++++++++-------------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 9c0b4e60..dcd1aebe 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -17,9 +17,15 @@ ntfsresize \- resize an NTFS filesystem without data loss .SH DESCRIPTION The .B ntfsresize -program non-destructively resizes Windows XP/2000/NT4, Windows Server 2003 -or Longhorn Beta NTFS filesystems. It can be used to shrink or enlarge -any NTFS filesystem located on an unmounted +program safely resizes Windows XP, Windows Server 2003, Windows 2000, Windows +NT4 and Longhorn NTFS filesystems without data loss. All NTFS versions are +supported, used by 32-bit and 64-bit Windows. +.B Defragmentation is NOT required prior resizing +because the program can relocate any data if needed, without risking data +integrity. +.PP +Ntfsresize can be used to shrink or enlarge any NTFS filesystem located +on an unmounted .I DEVICE (usually a disk partition). The new filesystem will have .I SIZE @@ -30,7 +36,7 @@ parameter may have one of the optional modifiers \fBk\fR, \fBM\fR, \fBG\fR, which means the .I SIZE parameter is given in kilo-, mega- or gigabytes respectively. -.B ntfsresize +.B Ntfsresize conforms to the SI, ATA, IEEE standards and the disk manufacturers by using k=10^3, M=10^6 and G=10^9. @@ -43,30 +49,34 @@ NTFS filesystem will be enlarged to the underlying .I DEVICE size. .PP -The +To resize a filesystem on a partition, you must resize BOTH the filesystem +and the partition by editing the partition table on the disk. Similarly to +other command line filesystem resizers, .B ntfsresize -program doesn't manipulate the size of partitions. -To do that you have to use a disk partitioning tool, for example +doesn't manipulate the size of the partitions, hence +to do that you must use a disk partitioning tool as well, for example .BR fdisk (8). +Alternatively you could use one of the many user friendly partitioners that +uses +.B ntfsresize +internally, like Mandriva's DiskDrake, QTParted, SUSE/Novell's YaST Partitioner, +IBM's EVMS, GParted or Debian/Ubuntu's Partman. .PP .B IMPORTANT! -Generally it's a good practice making regular backups of your -valuable data, especially before using any partitioning tools. To do so -for NTFS, you could use -.BR ntfsclone (8). -It's also included in the -.BR ntfsprogs (8) -package. +It's a good practice making REGULAR BACKUPS of your valuable data, especially +before using ANY partitioning tools. To do so for NTFS, you could use +.BR ntfsclone (8). +Don't forget to save the partition table as well! .SH SHRINKAGE If you wish to shrink an NTFS partition, first use .B ntfsresize -to shrink the size of the filesystem. Then you may use +to shrink the size of the filesystem. Then you could use .BR fdisk (8) to shrink the size of the partition by deleting the partition and recreating it with the smaller size. -But be careful, do not make the partition smaller than the new size of -the NTFS filesystem otherwise you won't be able to boot and -you might lose your data. +Do not make the partition smaller than the new size of +NTFS otherwise you won't be able to boot. If you did so notwithstanding +then just recreate the partition to be as large as NTFS. .SH ENLARGEMENT To enlarge an NTFS filesystem, first you must enlarge the size of the underlying partition. This can be done using @@ -78,9 +88,9 @@ Then you may use to enlarge the size of the filesystem. .SH PARTITIONING When recreating the partition by a disk partitioning tool, -make sure you create it with the same -starting disk cylinder (sector) and partition type as before. -Otherwise you may lose your entire filesystem. +make sure you create it at the same +starting sector and with the same partition type as before. +Otherwise you won't be able to access your filesystem. Also make sure you set the bootable flag for the partition if it existed before. Failing to do so you might not be able to boot your @@ -155,11 +165,11 @@ Display help and exit. .SH EXIT CODES The exit code is 0 on success, non-zero otherwise. .SH KNOWN ISSUES -No reliability problems are known or has been reported. If you need -help please try the ntfsresize FAQ first (see below) and if you +No reliability problem is known. If you need +help please try the Ntfsresize FAQ first (see below) and if you don't find your answer then send your question, comment or bug report to . No subscription is needed -but the mailing list is moderated and it can take some time +but the mailing list is moderated and it can take a short time to approve your post. .PP There are some very rarely met limitations at present: filesystems having @@ -169,7 +179,7 @@ in some cases aren't supported yet. These cases are detected and resizing is refused, restricted to a safe size or the closest safe size is displayed. .PP -.B ntfsresize +.B Ntfsresize schedules an NTFS consistency check and after the first boot into Windows you must see .B chkdsk @@ -179,8 +189,19 @@ Moreover after repartitioning your disk and depending on the hardware configuration, the Windows message .B System Settings Change may also appear. Just acknowledge it and reboot again. +.PP +The disk geometry handling semantic (HDIO_GETGEO ioctl) has changed +in an incompatible way in Linux 2.6 kernels and this triggered multitudinous +partition table corruptions resulting unbootable Windows systems, even if +NTFS was consistent, if +.BR parted (8) +was involved in some way. This problem was often attributed to ntfsresize +but in fact it's completely independent of NTFS thus ntfsresize. Moreover +ntfsresize never touches the partition table at all. By changing +the 'Disk Access Mode' to LBA in the BIOS makes booting work +again, most of the time. .SH AUTHOR -.B ntfsresize +.B Ntfsresize has been written by Szabolcs Szakacsits . .SH ACKNOWLEDGEMENT @@ -194,12 +215,12 @@ for beta testing and to Theodore Ts'o whose .BR resize2fs (8) man page formed the basis of this page. .SH AVAILABILITY -.B ntfsresize +.B Ntfsresize is part of the .BR ntfsprogs (8) package and is available from http://linux-ntfs.sourceforge.net/ as source and precompiled binary. -.B ntfsresize +.B Ntfsresize related news, example of usage, troubleshooting, statically linked binary and FAQ (frequently asked questions) is maintained at .br @@ -209,7 +230,8 @@ http://mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html .BR cfdisk (8), .BR sfdisk (8), .BR parted (8), -.BR mkntfs (8), +.BR evms (8), .BR ntfsclone (8), +.BR mkntfs (8), .BR ntfsprogs (8) From 532e1b71cfa40c6bbbb9349d03bcd8b04c5aed1d Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 12 Jun 2005 13:44:34 +0000 Subject: [PATCH 2285/2994] - fix bogus extra error message in ntfsresize --- ntfsprogs/ntfsresize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 8402b5a8..1eddbb25 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1879,7 +1879,7 @@ static void lookup_data_attr(ntfs_volume *vol, perr_exit("ntfs_open_inode"); if (NInoAttrList(ni)) - perr_exit("Attribute list attribute not yet supported"); + err_exit("Attribute list attribute not yet supported"); if (!(*ctx = attr_get_search_ctx(ni, NULL))) exit(1); From 6e1106fc7941cc32ae3535bd7bda9028d69c74ce Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 12 Jun 2005 14:35:57 +0000 Subject: [PATCH 2286/2994] - fix mangled formatting in ntfsclone: use more space for wipe statistics --- TODO.ntfsprogs | 2 -- ntfsprogs/ntfsclone.c | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index e4a8e30e..0744e0ce 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -27,9 +27,7 @@ Thanks, - get rid of the unneeded lseek()'s during reads/writes (probably it doesn't improve performance much, or any at all) - catch if source and dest are the same -- rescue: when reading a cluster fails then try rescue at the sector level - disable consistency check for --metadata (e.g. if the check is crashing) -- make "wiped", etc statistic variables long long - option: --inode - option: --data - metadata cloning: skip more non-needed inodes diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index f48f52dc..bdc3a3cb 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -105,12 +105,12 @@ int fd_in; int fd_out; FILE *msg_out = NULL; -int nr_used_mft_records = 0; int wipe = 0; -int wiped_unused_mft_data = 0; -int wiped_unused_mft = 0; -int wiped_resident_data = 0; -int wiped_timestamp_data = 0; +unsigned int nr_used_mft_records = 0; +unsigned int wiped_unused_mft_data = 0; +unsigned int wiped_unused_mft = 0; +unsigned int wiped_resident_data = 0; +unsigned int wiped_timestamp_data = 0; #define IMAGE_MAGIC "\0ntfsclone-image" #define IMAGE_MAGIC_SIZE 16 @@ -1406,7 +1406,7 @@ int main(int argc, char **argv) ntfs_walk_clusters_ctx image; s64 device_size; /* input device size in bytes */ s64 ntfs_size; - int wiped_total = 0; + unsigned int wiped_total = 0; /* print to stderr, stdout can be an NTFS image ... */ Eprintf("%s v%s\n", EXEC_NAME, VERSION); @@ -1491,21 +1491,21 @@ int main(int argc, char **argv) walk_clusters(vol, &backup_clusters); - Printf("Num of MFT records = %8lld\n", + Printf("Num of MFT records = %10lld\n", (long long)vol->mft_na->initialized_size >> vol->mft_record_size_bits); - Printf("Num of used MFT records = %8d\n", nr_used_mft_records); + Printf("Num of used MFT records = %10u\n", nr_used_mft_records); - Printf("Wiped unused MFT data = %8d\n", wiped_unused_mft_data); - Printf("Wiped deleted MFT data = %8d\n", wiped_unused_mft); - Printf("Wiped resident user data = %8d\n", wiped_resident_data); - Printf("Wiped timestamp data = %8d\n", wiped_timestamp_data); + Printf("Wiped unused MFT data = %10u\n", wiped_unused_mft_data); + Printf("Wiped deleted MFT data = %10u\n", wiped_unused_mft); + Printf("Wiped resident user data = %10u\n", wiped_resident_data); + Printf("Wiped timestamp data = %10u\n", wiped_timestamp_data); wiped_total += wiped_unused_mft_data; wiped_total += wiped_unused_mft; wiped_total += wiped_resident_data; wiped_total += wiped_timestamp_data; - Printf("Wiped totally = %8d\n", wiped_total); + Printf("Wiped totally = %10u\n", wiped_total); fsync_clone(fd_out); exit(0); From b1dfa2b306c704d88c2586ff7a13cdebc0820426 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 12 Jun 2005 15:23:25 +0000 Subject: [PATCH 2287/2994] - Fix memleak in ntfs_attr_pwrite - Update layout.h a bit to be a kernel driver like. --- include/ntfs/layout.h | 5 +++-- libntfs/attrib.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index f8652e06..b2d7446f 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -27,7 +27,8 @@ #include "support.h" /* The NTFS oem_id */ -#define magicNTFS const_cpu_to_le64(0x202020205346544e) /* "NTFS " */ +#define magicNTFS const_cpu_to_le64(0x202020205346544e) /* "NTFS " */ +#define NTFS_SB_MAGIC 0x5346544e /* 'NTFS' */ /* * Location of bootsector on partition: @@ -1003,7 +1004,7 @@ typedef struct { /* * The maximum allowed length for a file name. */ -#define MAXIMUM_FILE_NAME_LENGTH 255 +#define NTFS_MAX_NAME_LEN 255 /* * Possible namespaces for filenames in ntfs (8-bit). diff --git a/libntfs/attrib.c b/libntfs/attrib.c index c22a15de..e59a512e 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1212,9 +1212,11 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) eo = errno; Dprintf("%s(): Failed to zero area.\n", __FUNCTION__); + free(buf); errno = eo; goto err_out; } + free(buf); } if (rl->vcn < cur_vcn) { /* From e323ed6a031683fbe50583c70c4a5d1d5f419527 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 12 Jun 2005 18:12:55 +0000 Subject: [PATCH 2288/2994] Move utils_pathname_to_inode from to library (dir.c), adapt it for library, rename it to ntfs_pathname_to_inode, update all users. --- ChangeLog | 3 ++ include/ntfs/dir.h | 9 ++++ libntfs/dir.c | 105 ++++++++++++++++++++++++++++++++++++++++ ntfsprogs/ntfscat.c | 2 +- ntfsprogs/ntfscluster.c | 2 +- ntfsprogs/ntfscp.c | 5 +- ntfsprogs/ntfsinfo.c | 3 +- ntfsprogs/ntfsls.c | 4 +- ntfsprogs/ntfsmove.c | 2 +- ntfsprogs/ntfswipe.c | 2 +- ntfsprogs/utils.c | 93 ----------------------------------- ntfsprogs/utils.h | 6 --- 12 files changed, 128 insertions(+), 108 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf161dd9..a5134fd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -159,6 +159,9 @@ xx/xx/2005 - 2.0.0-WIP At least after attribute resize we leave absolutely consist volume. (Yura) - Update attribute definition handling. (Anton, Yura) + - Move utils_pathname_to_inode from to library (dir.c), adapt it + for the library, rename it to ntfs_pathname_to_inode, update all + users. (Yura) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index 035de300..59835b5a 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -24,12 +24,21 @@ #include "types.h" +#define PATH_SEP '/' + +#ifndef MAX_PATH +#define MAX_PATH 1024 +#endif + /* The little endian Unicode string $I30 as a global constant. */ extern ntfschar I30[5]; extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname, const int uname_len); +extern ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent, + const char *pathname); + /* * File types (adapted from include ) */ diff --git a/libntfs/dir.c b/libntfs/dir.c index d2354d44..1b85dc45 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -459,6 +459,111 @@ close_err_out: goto eo_put_err_out; } +/** + * ntfs_pathname_to_inode - Find the inode which represents the given pathname + * @vol: An ntfs volume obtained from ntfs_mount + * @parent: A directory inode to begin the search (may be NULL) + * @pathname: Pathname to be located + * + * Take an ASCII pathname and find the inode that represents it. The function + * splits the path and then descends the directory tree. If @parent is NULL, + * then the root directory '.' will be used as the base for the search. + * + * Return: inode Success, the pathname was valid + * NULL Error, the pathname was invalid, or some other error occurred + */ +ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent, + const char *pathname) +{ + u64 inum; + int len, err = 0; + char *p, *q; + ntfs_inode *ni; + ntfs_inode *result = NULL; + ntfschar *unicode = NULL; + char *ascii = NULL; + + if (!vol || !pathname) { + errno = EINVAL; + return NULL; + } + + if (parent) { + ni = parent; + } else { + ni = ntfs_inode_open(vol, FILE_root); + if (!ni) { + Dprintf("Couldn't open the inode of the root " + "directory.\n"); + err = EIO; + goto close; + } + } + + unicode = calloc(1, MAX_PATH); + ascii = strdup(pathname); + if (!unicode || !ascii) { + Dprintf("Out of memory.\n"); + err = ENOMEM; + goto close; + } + + p = ascii; + /* Remove leading /'s. */ + while (p && *p && *p == PATH_SEP) + p++; + while (p && *p) { + /* Find the end of the first token. */ + q = strchr(p, PATH_SEP); + if (q != NULL) { + *q = '\0'; + q++; + } + + len = ntfs_mbstoucs(p, &unicode, MAX_PATH); + if (len < 0) { + Dprintf("Couldn't convert name to Unicode: %s.\n", p); + err = EILSEQ; + goto close; + } + + inum = ntfs_inode_lookup_by_name(ni, unicode, len); + if (inum == (u64) -1) { + Dprintf("Couldn't find name '%s' in " + "pathname '%s'.\n", p, pathname); + err = ENOENT; + goto close; + } + + if (ni != parent) + ntfs_inode_close(ni); + + inum = MREF(inum); + ni = ntfs_inode_open(vol, inum); + if (!ni) { + Dprintf("Cannot open inode %llu: %s.\n", + (unsigned long long)inum, p); + err = EIO; + goto close; + } + + p = q; + while (p && *p && *p == PATH_SEP) + p++; + } + + result = ni; + ni = NULL; +close: + if (ni && (ni != parent)) + ntfs_inode_close(ni); + free(ascii); + free(unicode); + if (err) + errno = err; + return result; +} + /* * The little endian Unicode string ".." for ntfs_readdir(). */ diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 73326724..0749addc 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -286,7 +286,7 @@ int main (int argc, char *argv[]) if (opts.inode != -1) inode = ntfs_inode_open (vol, opts.inode); else - inode = utils_pathname_to_inode (vol, NULL, opts.file); + inode = ntfs_pathname_to_inode (vol, NULL, opts.file); if (!inode) { perror("ERROR: Couldn't open inode"); diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 194d79d4..57ba5a2d 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -487,7 +487,7 @@ int main (int argc, char *argv[]) result = cluster_find (vol, opts.range_begin, opts.range_end, (cluster_cb*)&print_match, NULL); break; case act_file: - ino = utils_pathname_to_inode (vol, NULL, opts.filename); + ino = ntfs_pathname_to_inode(vol, NULL, opts.filename); if (ino) result = dump_file (vol, ino); break; diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 6f851f54..9d2a948f 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -35,6 +35,7 @@ #include "attrib.h" #include "utils.h" #include "volume.h" +#include "dir.h" #include "debug.h" struct options { @@ -319,7 +320,7 @@ int main (int argc, char *argv[]) } out = ntfs_inode_open(vol, inode_num); } else - out = utils_pathname_to_inode(vol, NULL, opts.dest_file); + out = ntfs_pathname_to_inode(vol, NULL, opts.dest_file); if (!out) { perror("ERROR: Couldn't open destination file"); goto close_src; @@ -353,7 +354,7 @@ int main (int argc, char *argv[]) strcat(new_dest_file, "/"); strcat(new_dest_file, filename); ntfs_inode_close(out); - out = utils_pathname_to_inode(vol, NULL, new_dest_file); + out = ntfs_pathname_to_inode(vol, NULL, new_dest_file); free(new_dest_file); if (!out) { perror("ERROR: Failed to open destination file"); diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index fc66549d..6c51b392 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -66,6 +66,7 @@ #include "utils.h" #include "security.h" #include "mst.h" +#include "dir.h" static const char *EXEC_NAME = "ntfsinfo"; @@ -1776,7 +1777,7 @@ int main(int argc, char **argv) ntfs_inode *inode; /* obtain the inode */ if (opts.filename) { - inode = utils_pathname_to_inode (vol, NULL, opts.filename); + inode = ntfs_pathname_to_inode(vol, NULL, opts.filename); } else { inode = ntfs_inode_open(vol, MK_LE_MREF(opts.inode, 0)); } diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 8d77ea54..3f8419b9 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -404,7 +404,7 @@ static int readdir_recursive(ntfs_inode * ni, s64 * pos, ntfsls_dirent * dirent) dir_list_insert_pos = &dirs.list; if (!subdir->ni) { subdir->ni = - utils_pathname_to_inode(ni->vol, ni, + ntfs_pathname_to_inode(ni->vol, ni, subdir->name); if (!subdir->ni) { @@ -628,7 +628,7 @@ int main(int argc, char **argv) return 2; } - ni = utils_pathname_to_inode (vol, NULL, opts.path); + ni = ntfs_pathname_to_inode (vol, NULL, opts.path); if (!ni) { // FIXME: Print error... (AIA) ntfs_umount(vol, FALSE); diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index 309ba21f..f25416fc 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -858,7 +858,7 @@ int main (int argc, char *argv[]) return 1; } - inode = utils_pathname_to_inode (vol, NULL, opts.file); + inode = ntfs_pathname_to_inode(vol, NULL, opts.file); if (!inode) { printf ("!inode\n"); return 1; diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 14955268..5184435d 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -1175,7 +1175,7 @@ static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act) //Qprintf ("wipe_pagefile (not implemented) 0x%02x\n", byte); - ni = utils_pathname_to_inode (vol, NULL, "pagefile.sys"); + ni = ntfs_pathname_to_inode(vol, NULL, "pagefile.sys"); if (!ni) { Dprintf("Failed to open inode of pagefile.sys.\n"); return 0; diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 2b3b03ca..db48be07 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -701,99 +701,6 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref) return (buffer[byte] & bit); } -/** - * utils_pathname_to_inode - Find the inode which represents the given pathname - * @vol: An ntfs volume obtained from ntfs_mount - * @parent: A directory inode to begin the search (may be NULL) - * @pathname: Pathname to be located - * - * Take an ASCII pathname and find the inode that represents it. The function - * splits the path and then descends the directory tree. If @parent is NULL, - * then the root directory '.' will be used as the base for the search. - * - * Return: inode Success, the pathname was valid - * NULL Error, the pathname was invalid, or some other error occurred - */ -ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, const char *pathname) -{ - u64 inum; - int len; - char *p, *q; - ntfs_inode *ni; - ntfs_inode *result = NULL; - ntfschar *unicode = NULL; - char *ascii = NULL; - - if (!vol || !pathname) { - errno = EINVAL; - return NULL; - } - - if (parent) { - ni = parent; - } else { - ni = ntfs_inode_open (vol, FILE_root); - if (!ni) { - Eprintf ("Couldn't open the inode of the root directory.\n"); - goto close; - } - } - - unicode = calloc (1, MAX_PATH); - ascii = strdup (pathname); // Work with a r/w copy - if (!unicode || !ascii) { - Eprintf ("Out of memory.\n"); - goto close; - } - - p = ascii; - while (p && *p && *p == PATH_SEP) // Remove leading /'s - p++; - while (p && *p) { - q = strchr (p, PATH_SEP); // Find the end of the first token - if (q != NULL) { - *q = '\0'; - q++; - } - - len = ntfs_mbstoucs (p, &unicode, MAX_PATH); - if (len < 0) { - Eprintf ("Couldn't convert name to Unicode: %s.\n", p); - goto close; - } - - inum = ntfs_inode_lookup_by_name (ni, unicode, len); - if (inum == (u64)-1) { - Eprintf ("Couldn't find name '%s' in pathname '%s'.\n", p, pathname); - goto close; - } - - if (ni != parent) - ntfs_inode_close (ni); - - inum = MREF (inum); - ni = ntfs_inode_open (vol, inum); - if (!ni) { - Eprintf ("Cannot open inode %llu: %s.\n", - (unsigned long long)inum, p); - goto close; - } - - p = q; - while (p && *p && *p == PATH_SEP) - p++; - } - - result = ni; - ni = NULL; -close: - if (ni && (ni != parent)) - ntfs_inode_close (ni); - free (ascii); - free (unicode); - return result; -} - /** * __metadata */ diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index b012ca0d..598d4763 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -39,11 +39,6 @@ extern const char *ntfs_bugs; extern const char *ntfs_home; extern const char *ntfs_gpl; -#define PATH_SEP '/' -#ifndef MAX_PATH -# define MAX_PATH 1024 -#endif - #if !defined(REG_NOERROR) || (REG_NOERROR != 0) # define REG_NOERROR 0 #endif @@ -97,7 +92,6 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int int utils_cluster_in_use (ntfs_volume *vol, long long lcn); int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref); int utils_is_metadata (ntfs_inode *inode); -ntfs_inode * utils_pathname_to_inode (ntfs_volume *vol, ntfs_inode *parent, const char *pathname); void utils_dump_mem (u8 *buf, int start, int length, int ascii); time_t ntfs2utc (s64 ntfs_time); From 5becfe6c303a0447ca2cd6cc69fc781a5e553232 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 16 Jun 2005 23:16:32 +0000 Subject: [PATCH 2289/2994] - Fix build without config.h. - Fix gcc4 very large warning in ntfsrm. --- include/ntfs/types.h | 2 +- ntfsprogs/ntfsrm.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/ntfs/types.h b/include/ntfs/types.h index f8f937c8..5a7bc85e 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -27,7 +27,7 @@ #include "config.h" #endif -#ifdef HAVE_STDINT_H +#if HAVE_STDINT_H || !HAVE_CONFIG_H #include #endif #include diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index e6889880..142a0333 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -547,8 +547,9 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va printf (GREEN "Modified: inode %lld, ", bmp->attr->ni->mft_no); switch (bmp->attr->type) { - case AT_BITMAP: printf ("$BITMAP"); break; - case AT_DATA: printf ("$DATA"); break; + case AT_BITMAP: printf("$BITMAP"); break; + case AT_DATA: printf("$DATA"); break; + default: printf("???"); break; } printf (" vcn %lld-%lld\n" END, vcn>>12, (vcn+length-1)>>12); From 3a421dc96c61ad3e81ceb0a45d261706c20241a5 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 17 Jun 2005 10:44:55 +0000 Subject: [PATCH 2290/2994] Remove BitKeeper/etc/ignore file as it is no longer in use. --- BitKeeper/etc/ignore | 60 -------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 BitKeeper/etc/ignore diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore deleted file mode 100644 index 2347e2fc..00000000 --- a/BitKeeper/etc/ignore +++ /dev/null @@ -1,60 +0,0 @@ -# Bitkeeper -BitKeeper/*/* -PENDING/* - -# configure -autom4te.cache/* -config.cache -config.h -config.h.in~ -config.log -config.status -libtool -Makefile -*/Makefile -ntfsprogs/*.8 -stamp-h -stamp-h1 - -# general build products -*/.deps/* -libntfs/*.8 -libntfs/*.l? -libntfs/libntfs.conf -*/.libs/* -*/*.o -tags -*/tags -TAGS -*/TAGS - -# other -*~ -*/*~ -*/*/~ -.*swp -*/.*swp -*/*/.*swp -ntfsprogs.spec -ntfsprogs-*.tar.gz - -# specific programs -ntfsprogs/dumplog -ntfsprogs/mkntfs -ntfsprogs/ntfscat -ntfsprogs/ntfsclone -ntfsprogs/ntfscluster -ntfsprogs/ntfsdump_logfile -ntfsprogs/ntfsfix -ntfsprogs/ntfsinfo -ntfsprogs/ntfslabel -ntfsprogs/ntfsls -ntfsprogs/ntfsmftalloc -ntfsprogs/ntfsmove -ntfsprogs/ntfsresize -ntfsprogs/ntfsrm -ntfsprogs/ntfstruncate -ntfsprogs/ntfsundelete -ntfsprogs/ntfswipe -ntfsprogs/ntfscp - From cc992ab0f65cc7fd2ba44d71990192402de523b2 Mon Sep 17 00:00:00 2001 From: antona Date: Sun, 19 Jun 2005 13:20:40 +0000 Subject: [PATCH 2291/2994] Add more things to .cvsignore files. --- libntfs/.cvsignore | 1 + ntfsprogs/.cvsignore | 1 + 2 files changed, 2 insertions(+) diff --git a/libntfs/.cvsignore b/libntfs/.cvsignore index b3109419..8480fb78 100644 --- a/libntfs/.cvsignore +++ b/libntfs/.cvsignore @@ -2,6 +2,7 @@ .libs Makefile libntfs-gnomevfs.8 +libntfs-gnomevfs.la libntfs.conf libntfs.la *.lo diff --git a/ntfsprogs/.cvsignore b/ntfsprogs/.cvsignore index e740ab42..049839c8 100644 --- a/ntfsprogs/.cvsignore +++ b/ntfsprogs/.cvsignore @@ -1,4 +1,5 @@ .deps +.libs Makefile mkntfs ntfscat From 949043ab363e79e77d2e26738aa6193d45d152b3 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 19 Jun 2005 21:09:40 +0000 Subject: [PATCH 2292/2994] Tidy whitespace: trailing space; at the beginning of lines Fix warnings about sign differences Fix warnings about unused parameters Tidy a few functions that didn't have { on a new line --- include/ntfs/attrib.h | 4 +- include/ntfs/attrlist.h | 3 +- include/ntfs/collate.h | 3 +- include/ntfs/endians.h | 6 +- include/ntfs/gnome-vfs-method.h | 2 +- include/ntfs/gnome-vfs-module.h | 2 +- include/ntfs/index.h | 2 +- include/ntfs/inode.h | 5 +- include/ntfs/layout.h | 2 +- libntfs/attrib.c | 52 +-- libntfs/attrlist.c | 6 +- libntfs/collate.c | 2 +- libntfs/gnome-vfs-method.c | 2 +- libntfs/gnome-vfs-module.c | 2 +- libntfs/index.c | 2 +- libntfs/inode.c | 12 +- libntfs/lcnalloc.c | 2 +- libntfs/logfile.c | 716 ++++++++++++++++++++++++++++++++ libntfs/mft.c | 2 +- libntfs/security.c | 2 +- libntfs/volume.c | 8 +- libntfs/win32_io.c | 18 +- ntfsprogs/mkntfs.c | 71 ++-- ntfsprogs/ntfscat.c | 24 +- ntfsprogs/ntfsclone.c | 190 ++++----- ntfsprogs/ntfscluster.c | 2 +- ntfsprogs/ntfscluster.h | 4 +- ntfsprogs/ntfscp.c | 12 +- ntfsprogs/ntfsdump_logfile.c | 6 +- ntfsprogs/ntfsfix.c | 4 +- ntfsprogs/ntfsinfo.c | 114 ++--- ntfsprogs/ntfsmove.c | 5 +- ntfsprogs/ntfsresize.c | 174 ++++---- ntfsprogs/ntfsrm.c | 235 ++++++----- ntfsprogs/ntfsrm.h | 5 - ntfsprogs/ntfstruncate.c | 3 +- ntfsprogs/ntfsundelete.c | 5 +- ntfsprogs/ntfswipe.c | 70 ++-- ntfsprogs/sd.c | 8 +- 39 files changed, 1263 insertions(+), 524 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 3b4787e5..d11b1217 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -286,7 +286,7 @@ extern int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type); extern int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type); - + extern int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size); extern int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, @@ -304,7 +304,7 @@ extern int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size); extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, const u32 newsize); - + extern int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni); extern int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx, int extra); diff --git a/include/ntfs/attrlist.h b/include/ntfs/attrlist.h index 9d34546e..10dc9724 100644 --- a/include/ntfs/attrlist.h +++ b/include/ntfs/attrlist.h @@ -40,7 +40,8 @@ extern int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx); * * This function cannot fail. */ -static __inline__ void ntfs_attrlist_mark_dirty(ntfs_inode *ni) { +static __inline__ void ntfs_attrlist_mark_dirty(ntfs_inode *ni) +{ if (ni->nr_extents == -1) NInoAttrListSetDirty(ni->base_ni); else diff --git a/include/ntfs/collate.h b/include/ntfs/collate.h index 10dae19d..e51eaa56 100644 --- a/include/ntfs/collate.h +++ b/include/ntfs/collate.h @@ -29,7 +29,8 @@ #define NTFS_COLLATION_ERROR -2 -static inline BOOL ntfs_is_collation_rule_supported(COLLATION_RULES cr) { +static inline BOOL ntfs_is_collation_rule_supported(COLLATION_RULES cr) +{ int i; /* diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h index e0b6d51a..a22fc198 100644 --- a/include/ntfs/endians.h +++ b/include/ntfs/endians.h @@ -154,9 +154,9 @@ #define le32_to_cpu(x) (u32)__le32_to_cpu((u32)(x)) #define le64_to_cpu(x) (u64)__le64_to_cpu((u64)(x)) -#define le16_to_cpup(x) (u16)__le16_to_cpu(*(u16*)(x)) -#define le32_to_cpup(x) (u32)__le32_to_cpu(*(u32*)(x)) -#define le64_to_cpup(x) (u64)__le64_to_cpu(*(u64*)(x)) +#define le16_to_cpup(x) (u16)__le16_to_cpu(*(const u16*)(x)) +#define le32_to_cpup(x) (u32)__le32_to_cpu(*(const u32*)(x)) +#define le64_to_cpup(x) (u64)__le64_to_cpu(*(const u64*)(x)) /* Signed from LE to CPU conversion. */ diff --git a/include/ntfs/gnome-vfs-method.h b/include/ntfs/gnome-vfs-method.h index c8069ab6..d83b86ff 100644 --- a/include/ntfs/gnome-vfs-method.h +++ b/include/ntfs/gnome-vfs-method.h @@ -4,7 +4,7 @@ * * Copyright (c) 2002-2003 Jan Kratochvil * Copyright (c) 2000-2004 Anton Altaparmakov - * + * * This program/include file 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 of the License, or diff --git a/include/ntfs/gnome-vfs-module.h b/include/ntfs/gnome-vfs-module.h index 7dddd5cc..bd27f713 100644 --- a/include/ntfs/gnome-vfs-module.h +++ b/include/ntfs/gnome-vfs-module.h @@ -4,7 +4,7 @@ * * Copyright (c) 2003 Jan Kratochvil * Copyright (c) 2000-2004 Anton Altaparmakov - * + * * This program/include file 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 of the License, or diff --git a/include/ntfs/index.h b/include/ntfs/index.h index 2093e5c1..ba99bc97 100644 --- a/include/ntfs/index.h +++ b/include/ntfs/index.h @@ -58,7 +58,7 @@ * If @is_in_root is FALSE, @entry is in the index allocation attribute and @ia * and @ia_vcn point to the index allocation block and VCN where it's placed, * respectively. @ir and @actx are NULL in this case. @ia_na is opened - * INDEX_ALLOCTAION attribute. @ia_dirty is TRUE if index block was changed and + * INDEX_ALLOCTAION attribute. @ia_dirty is TRUE if index block was changed and * FALSE otherwise. * * To obtain a context call ntfs_index_ctx_get(). diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index ddcff691..d5310cb3 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -152,7 +152,7 @@ extern int ntfs_inode_close(ntfs_inode *ni); extern ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref); - + extern int ntfs_inode_attach_all_extents(ntfs_inode *ni); /** @@ -165,7 +165,8 @@ extern int ntfs_inode_attach_all_extents(ntfs_inode *ni); * * This function cannot fail. */ -static __inline__ void ntfs_inode_mark_dirty(ntfs_inode *ni) { +static __inline__ void ntfs_inode_mark_dirty(ntfs_inode *ni) +{ NInoSetDirty(ni); if (ni->nr_extents == -1) NInoSetDirty(ni->base_ni); diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index b2d7446f..968c60de 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -2219,7 +2219,7 @@ typedef struct { // the key_length is zero, then the vcn immediately // follows the INDEX_ENTRY_HEADER. Regardless of // key_length, the address of the 8-byte boundary - // alligned vcn of INDEX_ENTRY{_HEADER} *ie is given by + // aligned vcn of INDEX_ENTRY{_HEADER} *ie is given by // (char*)ie + le16_to_cpu(ie*)->length) - sizeof(VCN), // where sizeof(VCN) can be hardcoded as 8 if wanted. */ } __attribute__ ((__packed__)) INDEX_ENTRY; diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e59a512e..336655b4 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -428,7 +428,7 @@ int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn) Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, vcn 0x%llx.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type, (long long)vcn); - + lcn = ntfs_rl_vcn_to_lcn(na->rl, vcn); if (lcn >= 0 || lcn == LCN_HOLE || lcn == LCN_ENOENT) return 0; @@ -490,7 +490,7 @@ int ntfs_attr_map_whole_runlist(ntfs_attr *na) a = NULL; while (1) { runlist_element *rl; - + int not_mapped = 0; if (ntfs_rl_vcn_to_lcn(na->rl, next_vcn) == LCN_RL_NOT_MAPPED) not_mapped = 1; @@ -1219,7 +1219,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) free(buf); } if (rl->vcn < cur_vcn) { - /* + /* * Clusters that replaced hole are merged with * previous run, so we need to update offset. */ @@ -2423,7 +2423,7 @@ int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type) int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) { u32 biu; - + Dprintf("%s(): Entering for pos 0x%d, size %u.\n", __FUNCTION__, (int)(pos - (u8*)m), (unsigned) size); @@ -2705,7 +2705,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ntfs_attr_put_search_ctx(ctx); errno = err; return -1; - + } offset = (u8*)ctx->attr - (u8*)ctx->mrec; ntfs_attr_put_search_ctx(ctx); @@ -2867,7 +2867,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { * added transparently to caller. So, this function should not be called with * @type == AT_ATTRIBUTE_LIST, if you really need to add attribute list call * ntfs_inode_add_attrlist instead. - * + * * On success return opened new ntfs attribute. On error return NULL with errno * set to the error code. */ @@ -2878,7 +2878,7 @@ ntfs_attr *ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, int err, i, offset; ntfs_inode *attr_ni; ntfs_attr *na; - + if (!ni || size < 0 || type == AT_ATTRIBUTE_LIST) { Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); errno = EINVAL; @@ -2908,7 +2908,7 @@ ntfs_attr *ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, } /* - * Determine resident or not will be new attribute. We add 8 to size in + * Determine resident or not will be new attribute. We add 8 to size in * non resident case for mapping pairs. */ if (ntfs_attr_can_be_resident(ni->vol, type)) { @@ -3056,7 +3056,7 @@ int ntfs_attr_rm(ntfs_attr *na) { ntfs_attr_search_ctx *ctx; int ret = 0; - + if (!na) { Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); errno = EINVAL; @@ -3262,7 +3262,7 @@ int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) } /* Make space and move attribute. */ - if (ntfs_make_room_for_attr(ni->mrec, (u8*) nctx->attr, + if (ntfs_make_room_for_attr(ni->mrec, (u8*) nctx->attr, le32_to_cpu(a->length))) { err = errno; Dprintf("%s(): Couldn't make space for attribute.\n", @@ -3298,7 +3298,7 @@ put_err_out: * * New attribute record holder must have free @extra bytes after moving * attribute record to it. - * + * * If this function succeed, user should reinit search context if he/she wants * use it anymore. * @@ -3319,7 +3319,7 @@ int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx, int extra) Dprintf("%s(): Entering for attr 0x%x, inode 0x%llx.\n", __FUNCTION__, (unsigned) le32_to_cpu(ctx->attr->type), (long long) ctx->ntfs_ino->mft_no); - + if (ctx->ntfs_ino->nr_extents == -1) base_ni = ctx->base_ntfs_ino; else @@ -3356,7 +3356,7 @@ int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx, int extra) return 0; } - /* + /* * Failed to move attribute to one of the current extents, so allocate * new extent and move attribute to it. */ @@ -3467,7 +3467,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, NAttrClearSparse(na); NAttrClearEncrypted(na); - if (rl) { + if (rl) { /* Now copy the attribute value to the allocated cluster(s). */ bw = ntfs_attr_pwrite(na, 0, le32_to_cpu(a->value_length), (u8*)a + le16_to_cpu(a->value_offset)); @@ -3736,14 +3736,14 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) err = ENOSPC; goto put_err_out; } - + /* Add attribute list if not present. */ if (na->ni->nr_extents == -1) ni = na->ni->base_ni; else ni = na->ni; if (!NInoAttrList(ni)) { - ntfs_attr_put_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); if (ntfs_inode_add_attrlist(ni)) return -1; return ntfs_resident_attr_resize(na, newsize); @@ -4004,8 +4004,8 @@ retry: Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, (unsigned long long)na->ni->mft_no, na->type); - - if (na->ni->nr_extents == -1) + + if (na->ni->nr_extents == -1) base_ni = na->ni->base_ni; else base_ni = na->ni; @@ -4058,7 +4058,7 @@ retry: /* If we in the first extent, then set/clean sparse bit. */ if (!a->lowest_vcn) { int sparse; - + sparse = ntfs_rl_sparse(na->rl); if (sparse == -1) { Dprintf("%s(): Bad runlist.\n", __FUNCTION__); @@ -4163,7 +4163,7 @@ retry: * Determine maximum possible length of mapping pairs, * if we shall *not* expand space for mapping pairs. */ - cur_max_mp_size = le32_to_cpu(a->length) - + cur_max_mp_size = le32_to_cpu(a->length) - le16_to_cpu(a->mapping_pairs_offset); /* * Determine maximum possible length of mapping pairs in the @@ -4270,7 +4270,7 @@ retry: Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); goto put_err_out; } - + /* Deallocate not used attribute extents and return with success. */ if (finished_build) { ntfs_attr_reinit_search_ctx(ctx); @@ -4446,7 +4446,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) errno = err; return -1; } - + /* Truncate the runlist itself. */ if (ntfs_rl_truncate(&na->rl, first_free_vcn)) { err = errno; @@ -4461,7 +4461,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) errno = err; return -1; } - + /* Write mapping pairs for new runlist. */ if (ntfs_attr_update_mapping_pairs(na)) { err = errno; @@ -4472,7 +4472,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) return -1; } } - + /* Get the first attribute record. */ ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) { @@ -4497,7 +4497,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) goto put_err_out; } a = ctx->attr; - + /* Update allocated size only if it is changed. */ if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { na->allocated_size = first_free_vcn << vol->cluster_size_bits; @@ -4822,7 +4822,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) errno = EINVAL; return -1; } - + if (na->data_size == newsize) return 0; /* diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index e197b3cc..89d3920e 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -65,7 +65,7 @@ int ntfs_attrlist_need(ntfs_inode *ni) errno = EINVAL; return -1; } - + if (!ni->attr_list) { Dprintf("%s(): Corrput in-memory struct.\n", __FUNCTION__); errno = EINVAL; @@ -255,7 +255,7 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) "%lld.\n", __FUNCTION__, (long long) ctx->ntfs_ino->mft_no, (unsigned) le32_to_cpu(ctx->al_entry->type), (long long) le64_to_cpu(ctx->al_entry->lowest_vcn)); - + if (!NInoAttrList(base_ni)) { Dprintf("%s(): Attribute list isn't present.\n", __FUNCTION__); errno = ENOENT; @@ -270,7 +270,7 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) errno = ENOMEM; return -1; } - + /* Reisze $ATTRIBUTE_LIST to new length. */ na = ntfs_attr_open(base_ni, AT_ATTRIBUTE_LIST, NULL, 0); if (!na) { diff --git a/libntfs/collate.c b/libntfs/collate.c index 1735fba0..3d99c859 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -73,7 +73,7 @@ static int ntfs_collate_file_name(ntfs_volume *vol, const void *data2, const int data2_len __attribute__((unused))){ int rc; const FILE_NAME_ATTR *fn1, *fn2; - + ntfs_debug("Entering."); fn1 = (const FILE_NAME_ATTR *)data1; fn2 = (const FILE_NAME_ATTR *)data2; diff --git a/libntfs/gnome-vfs-method.c b/libntfs/gnome-vfs-method.c index 462e5d2c..540a6d58 100644 --- a/libntfs/gnome-vfs-method.c +++ b/libntfs/gnome-vfs-method.c @@ -4,7 +4,7 @@ * * Copyright (c) 2003 Jan Kratochvil * Copyright (c) 2003 Anton Altaparmakov - * + * * This program/include file 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 of the License, or diff --git a/libntfs/gnome-vfs-module.c b/libntfs/gnome-vfs-module.c index ad789997..8f09563f 100644 --- a/libntfs/gnome-vfs-module.c +++ b/libntfs/gnome-vfs-module.c @@ -4,7 +4,7 @@ * * Copyright (c) 2003 Jan Kratochvil * Copyright (c) 2003 Anton Altaparmakov - * + * * This program/include file 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 of the License, or diff --git a/libntfs/index.c b/libntfs/index.c index 5794bf06..ef075732 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -269,7 +269,7 @@ done: descend_into_child_node: ntfs_debug("Descend into node with VCN %lld.", vcn); /* Read index allocation block. */ - if (ntfs_attr_mst_pread(na, vcn << vol->cluster_size_bits, 1, + if (ntfs_attr_mst_pread(na, vcn << vol->cluster_size_bits, 1, ictx->block_size, ia) != 1) { ntfs_error(, "Failed to read index allocation."); goto err_out; diff --git a/libntfs/inode.c b/libntfs/inode.c index bbe0f3b0..e483dc08 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -389,7 +389,7 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) /* Inode haven't got attribute list, thus nothing to attach. */ if (!NInoAttrList(ni)) return 0; - + if (!ni->attr_list) { Dprintf("%s(): Corrput in-memory struct.\n", __FUNCTION__); errno = EINVAL; @@ -681,7 +681,7 @@ int ntfs_inode_sync(ntfs_inode *ni) for (i = 0; i < ni->nr_extents; ++i) { ntfs_inode *eni; - + eni = ni->extent_nis[i]; if (NInoTestAndClearDirty(eni)) { if (ntfs_mft_record_write(eni->vol, eni->mft_no, @@ -740,7 +740,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) errno = EEXIST; return -1; } - + al_allocated = 0x40; al_len = 0; al = malloc(al_allocated); @@ -750,7 +750,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) errno = ENOMEM; return -1; } - + /* Form attribute list. */ ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { @@ -937,10 +937,10 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) errno = EINVAL; return -1; } - + Dprintf("%s(): Entering for inode 0x%llx, size %d.\n", __FUNCTION__, (long long) ni->mft_no, size); - + freed = (le32_to_cpu(ni->mrec->bytes_allocated) - le32_to_cpu(ni->mrec->bytes_in_use)); diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index e72383a5..92a9da18 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -111,7 +111,7 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, errno = EINVAL; return NULL; } - + /* Return empty runlist if @count == 0 */ if (!count) { rl = malloc(0x1000); diff --git a/libntfs/logfile.c b/libntfs/logfile.c index e69de29b..93353f52 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -0,0 +1,716 @@ +/* + * logfile.c - NTFS journal handling. Part of the Linux-NTFS project. + * + * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#include "attrib.h" +#include "debug.h" +#include "logfile.h" +#include "volume.h" +#include "mst.h" + +/** + * ntfs_check_restart_page_header - check the page header for consistency + * @rp: restart page header to check + * @pos: position in logfile at which the restart page header resides + * + * Check the restart page header @rp for consistency and return TRUE if it is + * consistent and FALSE otherwise. + * + * This function only needs NTFS_BLOCK_SIZE bytes in @rp, i.e. it does not + * require the full restart page. + */ +static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) +{ + u32 logfile_system_page_size, logfile_log_page_size; + u16 usa_count, usa_ofs, usa_end, ra_ofs; + + ntfs_debug("Entering."); + /* + * If the system or log page sizes are smaller than the ntfs block size + * or either is not a power of 2 we cannot handle this log file. + */ + logfile_system_page_size = le32_to_cpu(rp->system_page_size); + logfile_log_page_size = le32_to_cpu(rp->log_page_size); + if (logfile_system_page_size < NTFS_BLOCK_SIZE || + logfile_log_page_size < NTFS_BLOCK_SIZE || + logfile_system_page_size & + (logfile_system_page_size - 1) || + logfile_log_page_size & (logfile_log_page_size - 1)) { + ntfs_error(vi->i_sb, "$LogFile uses unsupported page size."); + return FALSE; + } + /* + * We must be either at !pos (1st restart page) or at pos = system page + * size (2nd restart page). + */ + if (pos && pos != logfile_system_page_size) { + ntfs_error(vi->i_sb, "Found restart area in incorrect " + "position in $LogFile."); + return FALSE; + } + /* We only know how to handle version 1.1. */ + if (sle16_to_cpu(rp->major_ver) != 1 || + sle16_to_cpu(rp->minor_ver) != 1) { + ntfs_error(vi->i_sb, "$LogFile version %i.%i is not " + "supported. (This driver supports version " + "1.1 only.)", (int)sle16_to_cpu(rp->major_ver), + (int)sle16_to_cpu(rp->minor_ver)); + return FALSE; + } + /* Verify the size of the update sequence array. */ + usa_count = 1 + (logfile_system_page_size >> NTFS_BLOCK_SIZE_BITS); + if (usa_count != le16_to_cpu(rp->usa_count)) { + ntfs_error(vi->i_sb, "$LogFile restart page specifies " + "inconsistent update sequence array count."); + return FALSE; + } + /* Verify the position of the update sequence array. */ + usa_ofs = le16_to_cpu(rp->usa_ofs); + usa_end = usa_ofs + usa_count * sizeof(u16); + if (usa_ofs < sizeof(RESTART_PAGE_HEADER) || + usa_end > NTFS_BLOCK_SIZE - sizeof(u16)) { + ntfs_error(vi->i_sb, "$LogFile restart page specifies " + "inconsistent update sequence array offset."); + return FALSE; + } + /* + * Verify the position of the restart area. It must be: + * - aligned to 8-byte boundary, + * - after the update sequence array, and + * - within the system page size. + */ + ra_ofs = le16_to_cpu(rp->restart_area_offset); + if (ra_ofs & 7 || ra_ofs < usa_end || + ra_ofs > logfile_system_page_size) { + ntfs_error(vi->i_sb, "$LogFile restart page specifies " + "inconsistent restart area offset."); + return FALSE; + } + /* + * Only restart pages modified by chkdsk are allowed to have chkdsk_lsn + * set. + */ + if (!ntfs_is_chkd_record(rp->magic) && sle64_to_cpu(rp->chkdsk_lsn)) { + ntfs_error(vi->i_sb, "$LogFile restart page is not modified " + "chkdsk but a chkdsk LSN is specified."); + return FALSE; + } + ntfs_debug("Done."); + return TRUE; +} + +/** + * ntfs_check_restart_area - check the restart area for consistency + * @rp: restart page whose restart area to check + * + * Check the restart area of the restart page @rp for consistency and return + * TRUE if it is consistent and FALSE otherwise. + * + * This function assumes that the restart page header has already been + * consistency checked. + * + * This function only needs NTFS_BLOCK_SIZE bytes in @rp, i.e. it does not + * require the full restart page. + */ +static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) +{ + u64 file_size; + RESTART_AREA *ra; + u16 ra_ofs, ra_len, ca_ofs; + u8 fs_bits; + + ntfs_debug("Entering."); + ra_ofs = le16_to_cpu(rp->restart_area_offset); + ra = (RESTART_AREA*)((u8*)rp + ra_ofs); + /* + * Everything before ra->file_size must be before the first word + * protected by an update sequence number. This ensures that it is + * safe to access ra->client_array_offset. + */ + if (ra_ofs + offsetof(RESTART_AREA, file_size) > + NTFS_BLOCK_SIZE - sizeof(u16)) { + ntfs_error(vi->i_sb, "$LogFile restart area specifies " + "inconsistent file offset."); + return FALSE; + } + /* + * Now that we can access ra->client_array_offset, make sure everything + * up to the log client array is before the first word protected by an + * update sequence number. This ensures we can access all of the + * restart area elements safely. Also, the client array offset must be + * aligned to an 8-byte boundary. + */ + ca_ofs = le16_to_cpu(ra->client_array_offset); + if (((ca_ofs + 7) & ~7) != ca_ofs || + ra_ofs + ca_ofs > NTFS_BLOCK_SIZE - sizeof(u16)) { + ntfs_error(vi->i_sb, "$LogFile restart area specifies " + "inconsistent client array offset."); + return FALSE; + } + /* + * The restart area must end within the system page size both when + * calculated manually and as specified by ra->restart_area_length. + * Also, the calculated length must not exceed the specified length. + */ + ra_len = ca_ofs + le16_to_cpu(ra->log_clients) * + sizeof(LOG_CLIENT_RECORD); + if (ra_ofs + ra_len > le32_to_cpu(rp->system_page_size) || + ra_ofs + le16_to_cpu(ra->restart_area_length) > + le32_to_cpu(rp->system_page_size) || + ra_len > le16_to_cpu(ra->restart_area_length)) { + ntfs_error(vi->i_sb, "$LogFile restart area is out of bounds " + "of the system page size specified by the " + "restart page header and/or the specified " + "restart area length is inconsistent."); + return FALSE; + } + /* + * The ra->client_free_list and ra->client_in_use_list must be either + * LOGFILE_NO_CLIENT or less than ra->log_clients or they are + * overflowing the client array. + */ + if ((ra->client_free_list != LOGFILE_NO_CLIENT && + le16_to_cpu(ra->client_free_list) >= + le16_to_cpu(ra->log_clients)) || + (ra->client_in_use_list != LOGFILE_NO_CLIENT && + le16_to_cpu(ra->client_in_use_list) >= + le16_to_cpu(ra->log_clients))) { + ntfs_error(vi->i_sb, "$LogFile restart area specifies " + "overflowing client free and/or in use lists."); + return FALSE; + } + /* + * Check ra->seq_number_bits against ra->file_size for consistency. + * We cannot just use ffs() because the file size is not a power of 2. + */ + file_size = (u64)sle64_to_cpu(ra->file_size); + fs_bits = 0; + while (file_size) { + file_size >>= 1; + fs_bits++; + } + if (le32_to_cpu(ra->seq_number_bits) != (u32)(67 - fs_bits)) { + ntfs_error(vi->i_sb, "$LogFile restart area specifies " + "inconsistent sequence number bits."); + return FALSE; + } + /* The log record header length must be a multiple of 8. */ + if (((le16_to_cpu(ra->log_record_header_length) + 7) & ~7) != + le16_to_cpu(ra->log_record_header_length)) { + ntfs_error(vi->i_sb, "$LogFile restart area specifies " + "inconsistent log record header length."); + return FALSE; + } + /* Dito for the log page data offset. */ + if (((le16_to_cpu(ra->log_page_data_offset) + 7) & ~7) != + le16_to_cpu(ra->log_page_data_offset)) { + ntfs_error(vi->i_sb, "$LogFile restart area specifies " + "inconsistent log page data offset."); + return FALSE; + } + ntfs_debug("Done."); + return TRUE; +} + +/** + * ntfs_check_log_client_array - check the log client array for consistency + * @rp: restart page whose log client array to check + * + * Check the log client array of the restart page @rp for consistency and + * return TRUE if it is consistent and FALSE otherwise. + * + * This function assumes that the restart page header and the restart area have + * already been consistency checked. + * + * Unlike ntfs_check_restart_page_header() and ntfs_check_restart_area(), this + * function needs @rp->system_page_size bytes in @rp, i.e. it requires the full + * restart page and the page must be multi sector transfer deprotected. + */ +static BOOL ntfs_check_log_client_array(RESTART_PAGE_HEADER *rp) +{ + RESTART_AREA *ra; + LOG_CLIENT_RECORD *ca, *cr; + u16 nr_clients, idx; + BOOL in_free_list, idx_is_first; + + ntfs_debug("Entering."); + ra = (RESTART_AREA*)((u8*)rp + le16_to_cpu(rp->restart_area_offset)); + ca = (LOG_CLIENT_RECORD*)((u8*)ra + + le16_to_cpu(ra->client_array_offset)); + /* + * Check the ra->client_free_list first and then check the + * ra->client_in_use_list. Check each of the log client records in + * each of the lists and check that the array does not overflow the + * ra->log_clients value. Also keep track of the number of records + * visited as there cannot be more than ra->log_clients records and + * that way we detect eventual loops in within a list. + */ + nr_clients = le16_to_cpu(ra->log_clients); + idx = le16_to_cpu(ra->client_free_list); + in_free_list = TRUE; +check_list: + for (idx_is_first = TRUE; idx != LOGFILE_NO_CLIENT_CPU; nr_clients--, + idx = le16_to_cpu(cr->next_client)) { + if (!nr_clients || idx >= le16_to_cpu(ra->log_clients)) + goto err_out; + /* Set @cr to the current log client record. */ + cr = ca + idx; + /* The first log client record must not have a prev_client. */ + if (idx_is_first) { + if (cr->prev_client != LOGFILE_NO_CLIENT) + goto err_out; + idx_is_first = FALSE; + } + } + /* Switch to and check the in use list if we just did the free list. */ + if (in_free_list) { + in_free_list = FALSE; + idx = le16_to_cpu(ra->client_in_use_list); + goto check_list; + } + ntfs_debug("Done."); + return TRUE; +err_out: + ntfs_error(vi->i_sb, "$LogFile log client array is corrupt."); + return FALSE; +} + +/** + * ntfs_check_and_load_restart_page - check the restart page for consistency + * @log_na: opened ntfs attribute for journal $LogFile + * @rp: restart page to check + * @pos: position in @log_na at which the restart page resides + * @wrp: copy of the multi sector transfer deprotected restart page + * + * Check the restart page @rp for consistency and return TRUE if it is + * consistent and FALSE otherwise. + * + * This function only needs NTFS_BLOCK_SIZE bytes in @rp, i.e. it does not + * require the full restart page. + * + * If @wrp is not NULL, on success, *@wrp will point to a buffer containing a + * copy of the complete multi sector transfer deprotected page. On failure, + * *@wrp is undefined. + */ +static BOOL ntfs_check_and_load_restart_page(ntfs_attr *log_na, + RESTART_PAGE_HEADER *rp, s64 pos, RESTART_PAGE_HEADER **wrp) +{ + RESTART_AREA *ra; + RESTART_PAGE_HEADER *trp; + BOOL ret; + + ntfs_debug("Entering."); + /* Check the restart page header for consistency. */ + if (!ntfs_check_restart_page_header(rp, pos)) { + /* Error output already done inside the function. */ + return FALSE; + } + /* Check the restart area for consistency. */ + if (!ntfs_check_restart_area(rp)) { + /* Error output already done inside the function. */ + return FALSE; + } + ra = (RESTART_AREA*)((u8*)rp + le16_to_cpu(rp->restart_area_offset)); + /* + * Allocate a buffer to store the whole restart page so we can multi + * sector transfer deprotect it. + */ + trp = malloc(le32_to_cpu(rp->system_page_size)); + if (!trp) { + ntfs_error(vi->i_sb, "Failed to allocate memory for $LogFile " + "restart page buffer."); + return FALSE; + } + /* + * Read the whole of the restart page into the buffer. If it fits + * completely inside @rp, just copy it from there. Otherwise read it + * from disk. + */ + if (le32_to_cpu(rp->system_page_size) <= NTFS_BLOCK_SIZE) + memcpy(trp, rp, le32_to_cpu(rp->system_page_size)); + else + if (ntfs_attr_pread(log_na, pos, le32_to_cpu( + rp->system_page_size), trp) != + le32_to_cpu(rp->system_page_size)) { + ntfs_error(, "Failed to read whole restart page into " + "the buffer."); + goto err_out; + } + /* Perform the multi sector transfer deprotection on the buffer. */ + if (ntfs_mst_post_read_fixup((NTFS_RECORD*)trp, + le32_to_cpu(rp->system_page_size))) { + ntfs_error(vi->i_sb, "Multi sector transfer error detected in " + "$LogFile restart page."); + goto err_out; + } + /* Check the log client records for consistency. */ + ret = ntfs_check_log_client_array(trp); + if (ret && wrp) + *wrp = trp; + else + free(trp); + ntfs_debug("Done."); + return ret; +err_out: + free(trp); + return FALSE; +} + +/** + * ntfs_ckeck_logfile - check in the journal if the volume is consistent + * @log_na: ntfs attribute of loaded journal $LogFile to check + * + * Check the $LogFile journal for consistency and return TRUE if it is + * consistent and FALSE if not. + * + * At present we only check the two restart pages and ignore the log record + * pages. + * + * Note that the MstProtected flag is not set on the $LogFile inode and hence + * when reading pages they are not deprotected. This is because we do not know + * if the $LogFile was created on a system with a different page size to ours + * yet and mst deprotection would fail if our page size is smaller. + */ +BOOL ntfs_check_logfile(ntfs_attr *log_na) +{ + s64 size, pos, rstr1_pos, rstr2_pos; + ntfs_volume *vol = log_na->ni->vol; + u8 *buf = NULL; + RESTART_PAGE_HEADER *rstr1_ph = NULL; + RESTART_PAGE_HEADER *rstr2_ph = NULL; + int log_page_size, log_page_mask, ofs; + BOOL logfile_is_empty = TRUE; + BOOL rstr1_found = FALSE; + BOOL rstr2_found = FALSE; + u8 log_page_bits; + + ntfs_debug("Entering."); + /* An empty $LogFile must have been clean before it got emptied. */ + if (NVolLogFileEmpty(vol)) + goto is_empty; + size = log_na->data_size; + /* Make sure the file doesn't exceed the maximum allowed size. */ + if (size > (s64)MaxLogFileSize) + size = MaxLogFileSize; + log_page_size = DefaultLogPageSize; + log_page_mask = log_page_size - 1; + /* + * Use generic_ffs() instead of ffs() to enable the compiler to + * optimize log_page_size and log_page_bits into constants. + */ + log_page_bits = ffs(log_page_size) - 1; + size &= ~(log_page_size - 1); + + /* + * Ensure the log file is big enough to store at least the two restart + * pages and the minimum number of log record pages. + */ + if (size < log_page_size * 2 || (size - log_page_size * 2) >> + log_page_bits < MinLogRecordPages) { + ntfs_error(vol->sb, "$LogFile is too small."); + return FALSE; + } + /* Allocate memory for restart page. */ + buf = malloc(NTFS_BLOCK_SIZE); + if (!buf) { + ntfs_error(, "Not enough memory."); + return FALSE; + } + /* + * Read through the file looking for a restart page. Since the restart + * page header is at the beginning of a page we only need to search at + * what could be the beginning of a page (for each page size) rather + * than scanning the whole file byte by byte. If all potential places + * contain empty and uninitialzed records, the log file can be assumed + * to be empty. + */ + for (pos = 0; pos < size; pos <<= 1) { + /* + * Read first NTFS_BLOCK_SIZE bytes of potential restart page. + */ + if (ntfs_attr_pread(log_na, pos, NTFS_BLOCK_SIZE, buf) != + NTFS_BLOCK_SIZE) { + ntfs_error(, "Failed to read first NTFS_BLOCK_SIZE " + "bytes of potential restart page."); + goto err_out; + } + + /* + * A non-empty block means the logfile is not empty while an + * empty block after a non-empty block has been encountered + * means we are done. + */ + if (!ntfs_is_empty_recordp((le32*)buf)) + logfile_is_empty = FALSE; + else if (!logfile_is_empty) + break; + /* + * A log record page means there cannot be a restart page after + * this so no need to continue searching. + */ + if (ntfs_is_rcrd_recordp((le32*)buf)) + break; + /* + * A modified by chkdsk restart page means we cannot handle + * this log file. + */ + if (ntfs_is_chkd_recordp((le32*)buf)) { + ntfs_error(vol->sb, "$LogFile has been modified by " + "chkdsk. Mount this volume in " + "Windows."); + goto err_out; + } + /* If not a restart page, continue. */ + if (!ntfs_is_rstr_recordp((le32*)buf)) { + /* Skip to the minimum page size for the next one. */ + if (!pos) + pos = NTFS_BLOCK_SIZE >> 1; + continue; + } + /* We now know we have a restart page. */ + if (!pos) { + rstr1_found = TRUE; + rstr1_pos = pos; + } else { + if (rstr2_found) { + ntfs_error(vol->sb, "Found more than two " + "restart pages in $LogFile."); + goto err_out; + } + rstr2_found = TRUE; + rstr2_pos = pos; + } + /* + * Check the restart page for consistency and get a copy of the + * complete multi sector transfer deprotected restart page. + */ + if (!ntfs_check_and_load_restart_page(log_na, + (RESTART_PAGE_HEADER*)buf, pos, + !pos ? &rstr1_ph : &rstr2_ph)) { + /* Error output already done inside the function. */ + goto err_out; + } + /* + * We have a valid restart page. The next one must be after + * a whole system page size as specified by the valid restart + * page. + */ + if (!pos) + pos = le32_to_cpu(rstr1_ph->system_page_size) >> 1; + } + if (buf) { + free(buf); + buf = NULL; + } + if (logfile_is_empty) { + NVolSetLogFileEmpty(vol); +is_empty: + ntfs_debug("Done. ($LogFile is empty.)"); + return TRUE; + } + if (!rstr1_found || !rstr2_found) { + ntfs_error(vol->sb, "Did not find two restart pages in " + "$LogFile."); + goto err_out; + } + /* + * The two restart areas must be identical except for the update + * sequence number. + */ + ofs = le16_to_cpu(rstr1_ph->usa_ofs); + if (memcmp(rstr1_ph, rstr2_ph, ofs) || (ofs += sizeof(u16), + memcmp((u8*)rstr1_ph + ofs, (u8*)rstr2_ph + ofs, + le32_to_cpu(rstr1_ph->system_page_size) - ofs))) { + ntfs_error(vol->sb, "The two restart pages in $LogFile do not " + "match."); + goto err_out; + } + free(rstr1_ph); + free(rstr2_ph); + /* All consistency checks passed. */ + ntfs_debug("Done."); + return TRUE; +err_out: + if (buf) + free(buf); + if (rstr1_ph) + free(rstr1_ph); + if (rstr2_ph) + free(rstr2_ph); + return FALSE; +} + +/** + * ntfs_is_logfile_clean - check in the journal if the volume is clean + * @log_na: ntfs attribute of loaded journal $LogFile to check + * + * Analyze the $LogFile journal and return TRUE if it indicates the volume was + * shutdown cleanly and FALSE if not. + * + * At present we only look at the two restart pages and ignore the log record + * pages. This is a little bit crude in that there will be a very small number + * of cases where we think that a volume is dirty when in fact it is clean. + * This should only affect volumes that have not been shutdown cleanly but did + * not have any pending, non-check-pointed i/o, i.e. they were completely idle + * at least for the five seconds preceeding the unclean shutdown. + * + * This function assumes that the $LogFile journal has already been consistency + * checked by a call to ntfs_check_logfile() and in particular if the $LogFile + * is empty this function requires that NVolLogFileEmpty() is true otherwise an + * empty volume will be reported as dirty. + */ +BOOL ntfs_is_logfile_clean(ntfs_attr *log_na) +{ + RESTART_PAGE_HEADER *rp; + RESTART_AREA *ra; + + ntfs_debug("Entering."); + /* An empty $LogFile must have been clean before it got emptied. */ + if (NVolLogFileEmpty(log_na->ni->vol)) { + ntfs_debug("Done. ($LogFile is empty.)"); + return TRUE; + } + /* Allocate memory. */ + rp = malloc(NTFS_BLOCK_SIZE); + if (!rp) { + ntfs_error(, "Not enough memory."); + return FALSE; + } + /* + * Read the first restart page. It will be possibly incomplete and + * will not be multi sector transfer deprotected but we only need the + * first NTFS_BLOCK_SIZE bytes so it does not matter. + */ + if (ntfs_attr_pread(log_na, 0, NTFS_BLOCK_SIZE, rp) != + NTFS_BLOCK_SIZE) { + ntfs_error(, "Failed to read first restart page."); + goto err_out; + } + if (!ntfs_is_rstr_record(rp->magic)) { + ntfs_error(vol->sb, "No restart page found at offset zero in " + "$LogFile. This is probably a bug in that " + "the $LogFile should have been consistency " + "checked before calling this function."); + goto err_out; + } + ra = (RESTART_AREA*)((u8*)rp + le16_to_cpu(rp->restart_area_offset)); + /* + * If the $LogFile has active clients, i.e. it is open, and we do not + * have the RESTART_VOLUME_IS_CLEAN bit set in the restart area flags, + * we assume there was an unclean shutdown. + */ + if (ra->client_in_use_list != LOGFILE_NO_CLIENT && + !(ra->flags & RESTART_VOLUME_IS_CLEAN)) { + ntfs_debug("Done. $LogFile indicates a dirty shutdown."); + goto err_out; + } + free(rp); + /* $LogFile indicates a clean shutdown. */ + ntfs_debug("Done. $LogFile indicates a clean shutdown."); + return TRUE; +err_out: + free(rp); + return FALSE; +} + +/** + * ntfs_empty_logfile - empty the contents of the $LogFile journal + * @na: ntfs attribute of journal $LogFile to empty + * + * Empty the contents of the $LogFile journal @na and return 0 on success and + * -1 on error. + * + * This function assumes that the $LogFile journal has already been consistency + * checked by a call to ntfs_check_logfile() and that ntfs_is_logfile_clean() + * has been used to ensure that the $LogFile is clean. + */ +int ntfs_empty_logfile(ntfs_attr *na) +{ + s64 len, pos, count; + char buf[NTFS_BUF_SIZE]; + int err; + + ntfs_debug("Entering."); + if (NVolLogFileEmpty(na->ni->vol)) + goto done; + + /* The $DATA attribute of the $LogFile has to be non-resident. */ + if (!NAttrNonResident(na)) { + err = EIO; + Dprintf("$LogFile $DATA attribute is resident!?!\n"); + goto io_error_exit; + } + + /* Get length of $LogFile contents. */ + len = na->data_size; + if (!len) { + Dprintf("$LogFile has zero length, no disk write needed.\n"); + return 0; + } + + /* Read $LogFile until its end. We do this as a check for correct + length thus making sure we are decompressing the mapping pairs + array correctly and hence writing below is safe as well. */ + pos = 0; + while ((count = ntfs_attr_pread(na, pos, NTFS_BUF_SIZE, buf)) > 0) + pos += count; + + if (count == -1 || pos != len) { + err = errno; + Dprintf("Amount of $LogFile data read does not " + "correspond to expected length!"); + if (count != -1) + err = EIO; + goto io_error_exit; + } + + /* Fill the buffer with 0xff's. */ + memset(buf, -1, NTFS_BUF_SIZE); + + /* Set the $DATA attribute. */ + pos = 0; + while ((count = len - pos) > 0) { + if (count > NTFS_BUF_SIZE) + count = NTFS_BUF_SIZE; + + if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { + err = errno; + Dprintf("Failed to set the $LogFile attribute value."); + if (count != -1) + err = EIO; + goto io_error_exit; + } + pos += count; + } + + /* Set the flag so we do not have to do it again on remount. */ + NVolSetLogFileEmpty(na->ni->vol); +done: + ntfs_debug("Done."); + return 0; +io_error_exit: + ntfs_attr_close(na); + ntfs_inode_close(na->ni); + errno = err; + return -1; +} diff --git a/libntfs/mft.c b/libntfs/mft.c index 21f5eede..47bebcda 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -1472,7 +1472,7 @@ int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni) u64 mft_no; int err; u16 seq_no, old_seq_no; - + Dprintf("%s(): Entering for inode 0x%llx.\n", __FUNCTION__, (long long) ni->mft_no); diff --git a/libntfs/security.c b/libntfs/security.c index 78fcae99..d04c563e 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -92,7 +92,7 @@ char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str) return _guid_str; if (!guid_str) free(_guid_str); - errno = EINVAL; + errno = EINVAL; return NULL; } diff --git a/libntfs/volume.c b/libntfs/volume.c index 0ecda611..01dee976 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -563,7 +563,7 @@ static int ntfs_volume_check_logfile(ntfs_volume *vol) ntfs_inode *ni; ntfs_attr *na = NULL; int ret, err = 0; - + if ((ni = ntfs_inode_open(vol, FILE_LogFile)) == NULL) { Dprintf("Failed to open inode FILE_LogFile.\n"); errno = EIO; @@ -610,13 +610,13 @@ static ntfs_inode *ntfs_hiberfile_open(ntfs_volume *vol) errno = EINVAL; return NULL; } - + ni_root = ntfs_inode_open(vol, FILE_root); if (!ni_root) { Dprintf("Couldn't open the root directory.\n"); return NULL; } - + unicode_len = ntfs_mbstoucs(hiberfile, &unicode, 0); if (unicode_len < 0) { Dperror("Couldn't convert 'hiberfil.sys' to Unicode"); @@ -659,7 +659,7 @@ static int ntfs_volume_check_hiberfile(ntfs_volume *vol) ntfs_attr *na = NULL; int i, bytes_read, ret = -1; char *buf = NULL; - + ni = ntfs_hiberfile_open(vol); if (!ni) { if (errno == ENOENT) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 0e4305ac..626917e0 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -165,7 +165,7 @@ static BOOL WINAPI libntfs_SetFilePointerEx(HANDLE hFile, * * The Find*Volume and SetFilePointerEx functions exist only on win2k+, as such * we cannot just staticly import them. - * + * * This function initializes the imports if the functions do exist and in the * SetFilePointerEx case, we emulate the function ourselves if it is not * present. @@ -257,11 +257,11 @@ static int ntfs_device_win32_simple_open_file(const char *filename, *handle = CreateFile(filename, ntfs_device_unix_status_flags_to_win32(flags), locking ? 0 : (FILE_SHARE_WRITE | FILE_SHARE_READ), - NULL, OPEN_EXISTING, 0, NULL); + NULL, OPEN_EXISTING, 0, NULL); if (*handle == INVALID_HANDLE_VALUE) { errno = ntfs_w32error_to_errno(GetLastError()); Dprintf("CreateFile(%s) failed.\n", filename); - return -1; + return -1; } return 0; } @@ -512,7 +512,7 @@ static __inline__ int ntfs_device_win32_open_file(char *filename, win32_fd *fd, if (ntfs_device_win32_simple_open_file(filename, &handle, flags, FALSE)) { /* open error */ - return -1; + return -1; } /* fill fd */ fd->handle = handle; @@ -545,7 +545,7 @@ static __inline__ int ntfs_device_win32_open_drive(int drive_id, win32_fd *fd, if ((err = ntfs_device_win32_simple_open_file(filename, &handle, flags, TRUE))) { /* open error */ - return err; + return err; } /* store the drive geometry */ ntfs_device_win32_getgeo(handle, fd); @@ -798,7 +798,7 @@ static int ntfs_device_win32_open_partition(int drive_id, drive_id); CloseHandle(handle); errno = ENODEV; - return -1; + return -1; } } @@ -1257,7 +1257,7 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *b, } } /* Copy the data to be written into @alignedbuffer. */ - memcpy(alignedbuffer + ofs, b, count); + memcpy(alignedbuffer + ofs, b, count); } if (fd->vol_handle != INVALID_HANDLE_VALUE && old_pos < fd->geo_size) { s64 vol_to_write = fd->geo_size - old_pos; @@ -1379,8 +1379,8 @@ static __inline__ int ntfs_win32_blksszget(struct ntfs_device *dev,int *argp) DWORD bytesReturned; DISK_GEOMETRY dg; - if (DeviceIoControl(fd->handle, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, - &dg, sizeof(DISK_GEOMETRY), &bytesReturned, NULL)) { + if (DeviceIoControl(fd->handle, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, + &dg, sizeof(DISK_GEOMETRY), &bytesReturned, NULL)) { /* success */ *argp = dg.BytesPerSector; return 0; diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index a93957fc..074ea0a3 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -135,8 +135,7 @@ switch if you want to be able to build the NTFS utilities." extern const unsigned char attrdef_ntfs12_array[2400]; extern const unsigned char boot_array[3429]; -extern void init_system_file_sd(int sys_file_no, char **sd_val, - int *sd_val_len); +extern void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len); extern void init_upcase_table(ntfschar *uc, u32 uc_len); /* Page size on ia32. Can change to 8192 on Alpha. */ @@ -145,13 +144,13 @@ extern void init_upcase_table(ntfschar *uc, u32 uc_len); const char *EXEC_NAME = "mkntfs"; /* Need these global so mkntfs_exit can access them. */ -char *buf = NULL; -char *buf2 = NULL; +u8 *buf = NULL; +u8 *buf2 = NULL; int buf2_size = 0; int mft_bitmap_size, mft_bitmap_byte_size; -unsigned char *mft_bitmap = NULL; +u8 *mft_bitmap = NULL; int lcn_bitmap_byte_size; -unsigned char *lcn_bitmap = NULL; +u8 *lcn_bitmap = NULL; runlist *rl_mft = NULL, *rl_mft_bmp = NULL, *rl_mftmirr = NULL; runlist *rl_logfile = NULL, *rl_boot = NULL, *rl_bad = NULL, *rl_index; INDEX_ALLOCATION *index_block = NULL; @@ -174,7 +173,7 @@ struct { long long logfile_lcn; /* lcn of $LogFile, $DATA. */ int logfile_size; /* in bytes, determined from volume_size. */ - int mft_zone_multiplier; /* -z, value from 1 to 4. Default is + int mft_zone_multiplier; /* -z, value from 1 to 4. Default is 1. */ long long mft_zone_end; /* Determined from volume_size and mft_zone_multiplier, in clusters. */ @@ -251,7 +250,7 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * err_exit - error output and terminate; ignores quiet (-q) */ -static void err_exit(const char *fmt, ...) +static void err_exit(const char *fmt, ...) __attribute__((noreturn)) __attribute__((format(printf, 1, 2))); static void err_exit(const char *fmt, ...) @@ -520,7 +519,7 @@ static __inline__ long long mkntfs_write(struct ntfs_device *dev, * Note: Might not return. */ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, - const char *val, const s64 val_len, s64 *inited_size) + const u8 *val, const s64 val_len, s64 *inited_size) { s64 bytes_written, total, length, delta; int retry, i; @@ -1191,7 +1190,7 @@ err_end: static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, - const runlist *rl, const char *val, const s64 val_len) + const runlist *rl, const u8 *val, const s64 val_len) { ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; @@ -1376,7 +1375,7 @@ err_out: static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, - const char *val, const s64 val_len) + const u8 *val, const s64 val_len) { ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; @@ -1568,7 +1567,7 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, const ATTR_TYPES type, const char *name, u32 name_len, const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, const RESIDENT_ATTR_FLAGS res_flags, - const char *val, const u32 val_len) + const u8 *val, const u32 val_len) { ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; @@ -1698,7 +1697,7 @@ static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) } /* NTFS 1.2: size of si = 48, NTFS 3.0: size of si = 72 */ err = insert_resident_attr_in_mft_record(m, AT_STANDARD_INFORMATION, - NULL, 0, 0, 0, 0, (char*)&si, + NULL, 0, 0, 0, 0, (u8*)&si, vol->major_ver < 3 ? 48 : 72); if (err < 0) Eprintf("add_attr_std_info failed: %s\n", strerror(-err)); @@ -1778,7 +1777,7 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, fn->file_name_length = i; fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(ntfschar); i = insert_resident_attr_in_mft_record(m, AT_FILE_NAME, NULL, 0, 0, - 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size); + 0, RESIDENT_ATTR_IS_INDEXED, (u8*)fn, fn_size); free(fn); if (i < 0) Eprintf("add_attr_file_name failed: %s\n", strerror(-i)); @@ -1792,7 +1791,7 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, * * Return 0 on success or -errno on error. */ -static int add_attr_sd(MFT_RECORD *m, const char *sd, const s64 sd_len) +static int add_attr_sd(MFT_RECORD *m, const u8 *sd, const s64 sd_len) { int err; @@ -1817,7 +1816,7 @@ static int add_attr_sd(MFT_RECORD *m, const char *sd, const s64 sd_len) */ static int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, - const char *val, const s64 val_len) + const u8 *val, const s64 val_len) { int err; @@ -1857,7 +1856,7 @@ static int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, static int add_attr_data_positioned(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags, const runlist *rl, - const char *val, const s64 val_len) + const u8 *val, const s64 val_len) { int err; @@ -1904,7 +1903,7 @@ static int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, len = 0; } i = insert_resident_attr_in_mft_record(m, AT_VOLUME_NAME, NULL, 0, 0, - 0, 0, (char*)uname, len); + 0, 0, (u8*)uname, len); if (uname) free(uname); if (i < 0) @@ -1927,7 +1926,7 @@ static int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags, vi.minor_ver = minor_ver; vi.flags = flags & VOLUME_FLAGS_MASK; err = insert_resident_attr_in_mft_record(m, AT_VOLUME_INFORMATION, NULL, - 0, 0, 0, 0, (char*)&vi, sizeof(vi)); + 0, 0, 0, 0, (u8*)&vi, sizeof(vi)); if (err < 0) Eprintf("add_attr_vol_info failed: %s\n", strerror(-err)); return err; @@ -2006,7 +2005,7 @@ static int add_attr_index_root(MFT_RECORD *m, const char *name, e->flags = INDEX_ENTRY_END; e->reserved = cpu_to_le16(0); err = insert_resident_attr_in_mft_record(m, AT_INDEX_ROOT, name, - name_len, ic, 0, 0, (char*)r, val_len); + name_len, ic, 0, 0, (u8*)r, val_len); free(r); if (err < 0) Eprintf("add_attr_index_root failed: %s\n", strerror(-err)); @@ -2019,7 +2018,7 @@ static int add_attr_index_root(MFT_RECORD *m, const char *name, */ static int add_attr_index_alloc(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, - const char *index_alloc_val, const u32 index_alloc_val_len) + const u8 *index_alloc_val, const u32 index_alloc_val_len) { int err; @@ -2036,7 +2035,7 @@ static int add_attr_index_alloc(MFT_RECORD *m, const char *name, * Return 0 on success or -errno on error. */ static int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, - const IGNORE_CASE_BOOL ic, const char *bitmap, + const IGNORE_CASE_BOOL ic, const u8 *bitmap, const u32 bitmap_len) { int err; @@ -2065,7 +2064,7 @@ static int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, */ static int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, const u32 name_len, const IGNORE_CASE_BOOL ic, - const runlist *rl, const char *bitmap, const u32 bitmap_len) + const runlist *rl, const u8 *bitmap, const u32 bitmap_len) { int err; @@ -2095,7 +2094,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, INDEX_ENTRY *re; INDEX_ALLOCATION *ia_val = NULL; ntfschar *uname; - char bmp[8]; + u8 bmp[8]; char *re_start, *re_end; int i, err, index_block_size; @@ -2147,7 +2146,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, memset(bmp, 0, sizeof(bmp)); ntfs_bit_set(bmp, 0ULL, 1); /* Bitmap has to be at least 8 bytes in size. */ - err = add_attr_bitmap(m, name, name_len, ic, (char*)&bmp, sizeof(bmp)); + err = add_attr_bitmap(m, name, name_len, ic, bmp, sizeof(bmp)); if (err) goto err_out; ia_val = calloc(1, index_block_size); @@ -2224,7 +2223,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, "upgrade_to_large_index.\n"); goto err_out; } - err = add_attr_index_alloc(m, name, name_len, ic, (char*)ia_val, + err = add_attr_index_alloc(m, name, name_len, ic, (u8*)ia_val, index_block_size); ntfs_mst_post_write_fixup((NTFS_RECORD*)ia_val); if (err) { @@ -2491,7 +2490,7 @@ static int create_hardlink(INDEX_BLOCK *idx, const MFT_REF ref_parent, m_file->link_count = cpu_to_le16(i + 1); /* Add the file_name to @m_file. */ i = insert_resident_attr_in_mft_record(m_file, AT_FILE_NAME, NULL, 0, 0, - 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size); + 0, RESIDENT_ATTR_IS_INDEXED, (u8*)fn, fn_size); if (i < 0) { Eprintf("create_hardlink failed adding file name attribute: " "%s\n", strerror(-i)); @@ -2883,7 +2882,7 @@ static void mkntfs_override_phys_params(void) static void mkntfs_initialize_bitmaps(void) { int i, j; - + /* Determine lcn bitmap byte size and allocate it. */ lcn_bitmap_byte_size = (opts.nr_clusters + 7) >> 3; /* Needs to be multiple of 8 bytes. */ @@ -2949,7 +2948,7 @@ static void mkntfs_initialize_bitmaps(void) static void mkntfs_initialize_rl_mft(void) { int i, j; - + /* If user didn't specify the mft lcn, determine it now. */ if (!opts.mft_lcn) { /* @@ -3224,7 +3223,7 @@ static void mkntfs_fill_device_with_zeroes(void) static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) { int i, err; - char *sd; + u8 *sd; Vprintf("Creating $Volume (mft record 3)\n"); m = (MFT_RECORD*)(buf + 3 * vol->mft_record_size); @@ -3256,7 +3255,7 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) * * Return 0 on success or 1 if it couldn't be created. */ -static int create_backup_boot_sector(char *buff, int size) +static int create_backup_boot_sector(u8 *buff, int size) { ssize_t bw; int _e = errno; @@ -3304,7 +3303,7 @@ static void mkntfs_create_root_structures(void) MFT_RECORD *m; MFT_REF root_ref; int i, j, err; - char *sd; + u8 *sd; VOLUME_FLAGS volume_flags = 0; Qprintf("Creating NTFS volume structures.\n"); @@ -3473,7 +3472,7 @@ static void mkntfs_create_root_structures(void) buf2_size = 36000; else buf2_size = opts.attr_defs_len; - buf2 = (char*)calloc(1, buf2_size); + buf2 = calloc(1, buf2_size); if (!buf2) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -3598,7 +3597,7 @@ static void mkntfs_create_root_structures(void) } if (err < 0) err_exit("Couldn't create $Boot: %s\n", strerror(-err)); - + if (create_backup_boot_sector(buf2, i) != 0) { /* * Pre-2.6 kernels couldn't access the last sector @@ -3651,7 +3650,7 @@ static void mkntfs_create_root_structures(void) //dump_mft_record(m); Vprintf("Creating $UpCase (mft record 0xa)\n"); m = (MFT_RECORD*)(buf + 0xa * vol->mft_record_size); - err = add_attr_data(m, NULL, 0, 0, 0, (char*)vol->upcase, + err = add_attr_data(m, NULL, 0, 0, 0, (u8*)vol->upcase, vol->upcase_len << 1); if (!err) err = create_hardlink(index_block, root_ref, m, @@ -3790,7 +3789,7 @@ int main(int argc, char **argv) if (err) err_exit("ntfs_mst_pre_write_fixup() failed while syncing " "root directory index block.\n"); - lw = ntfs_rlwrite(vol->dev, rl_index, (char*)index_block, i, NULL); + lw = ntfs_rlwrite(vol->dev, rl_index, (u8*)index_block, i, NULL); if (lw != i) err_exit("Error writing $INDEX_ALLOCATION.\n"); /* No more changes to @index_block below here so no need for fixup: */ diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 0749addc..5bae325f 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -215,7 +215,7 @@ static int cat (ntfs_volume *vol __attribute__((unused)), ntfs_inode *inode, int namelen __attribute__((unused))) { /* increase 1024 only if you fix partial writes below */ - const int bufsize = 1024; + const int bufsize = 1024; char *buffer; ntfs_attr *attr; s64 bytes_read, written; @@ -279,25 +279,25 @@ int main (int argc, char *argv[]) vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); if (!vol) { - perror("ERROR: couldn't mount volume"); + perror("ERROR: couldn't mount volume"); return 1; } - if (opts.inode != -1) - inode = ntfs_inode_open (vol, opts.inode); - else - inode = ntfs_pathname_to_inode (vol, NULL, opts.file); + if (opts.inode != -1) + inode = ntfs_inode_open (vol, opts.inode); + else + inode = ntfs_pathname_to_inode (vol, NULL, opts.file); if (!inode) { - perror("ERROR: Couldn't open inode"); + perror("ERROR: Couldn't open inode"); return 1; } - attr = AT_DATA; - if (opts.attr != (ATTR_TYPES)-1) - attr = opts.attr; - - result = cat (vol, inode, attr, NULL, 0); + attr = AT_DATA; + if (opts.attr != (ATTR_TYPES)-1) + attr = opts.attr; + + result = cat (vol, inode, attr, NULL, 0); ntfs_inode_close (inode); ntfs_umount (vol, FALSE); diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index bdc3a3cb..b8b34223 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -60,7 +60,7 @@ struct { int force; int overwrite; int std_out; - int blkdev_out; /* output file is block device */ + int blkdev_out; /* output file is block device */ int metadata_only; int ignore_fs_check; int rescue; @@ -300,7 +300,7 @@ static void parse_options(int argc, char **argv) usage(); } } - + if (opt.output == NULL) { err_printf("You must specify an output file.\n"); usage(); @@ -321,7 +321,7 @@ static void parse_options(int argc, char **argv) if (opt.metadata_only && opt.restore_image) err_exit("Restoring only metadata from an image is not " "supported!\n"); - + if (opt.metadata_only && opt.std_out) err_exit("Cloning only metadata to stdout isn't supported!\n"); @@ -332,13 +332,13 @@ static void parse_options(int argc, char **argv) if (opt.save_image && opt.restore_image) err_exit("Saving and restoring an image at the same time " "is not supported!\n"); - + if (!opt.std_out) { struct stat st; - + if (stat(opt.output, &st) == -1) { if (errno != ENOENT) - perr_exit("Couldn't access '%s'", opt.output); + perr_exit("Couldn't access '%s'", opt.output); } else { if (!opt.overwrite) err_exit("Output file '%s' already exists.\n" @@ -352,16 +352,16 @@ static void parse_options(int argc, char **argv) "block device isn't supported!\n"); } } - } - + } + msg_out = stdout; - + /* FIXME: this is a workaround for loosing debug info if stdout != stderr and for the uncontrollable verbose messages in libntfs. Ughhh. */ if (opt.std_out) msg_out = stderr; else if (opt.debug) - stderr = stdout; + stderr = stdout; else if (!(stderr = fopen("/dev/null", "rw"))) perr_exit("Couldn't open /dev/null"); @@ -413,7 +413,7 @@ static s64 is_critical_metadata(ntfs_walk_clusters_ctx *image, runlist *rl) s64 inode = image->ni->mft_no; if (inode <= LAST_METADATA_INODE) { - + /* Don't save bad sectors (both $Bad and unnamed are ignored */ if (inode == FILE_BadClus && image->ctx->attr->type == AT_DATA) return 0; @@ -434,7 +434,7 @@ static s64 is_critical_metadata(ntfs_walk_clusters_ctx *image, runlist *rl) return 0; } } - + if (image->ctx->attr->type != AT_DATA) return rl->length; @@ -446,7 +446,7 @@ static int io_all(void *fd, void *buf, int count, int do_write) { int i; struct ntfs_device *dev = fd; - + while (count > 0) { if (do_write) i = write(*(int *)fd, buf, count); @@ -494,7 +494,7 @@ static void copy_cluster(int rescue, off_t rescue_pos) /* vol is NULL if opt.restore_image is set */ u32 csize = image_hdr.cluster_size; void *fd = (void *)&fd_in; - + if (!opt.restore_image) { csize = vol->cluster_size; fd = vol->dev; @@ -516,7 +516,7 @@ static void copy_cluster(int rescue, off_t rescue_pos) if (write_all(&fd_out, &cmd, sizeof(cmd)) == -1) perr_exit("write_all"); } - + if (write_all(&fd_out, buff, csize) == -1) { int err = errno; perr_printf("Write failed"); @@ -532,9 +532,9 @@ static void copy_cluster(int rescue, off_t rescue_pos) static void lseek_to_cluster(s64 lcn) { off_t pos; - + pos = (off_t)(lcn * vol->cluster_size); - + if (vol->dev->d_ops->seek(vol->dev, pos, SEEK_SET) == (off_t)-1) perr_exit("lseek input"); @@ -552,7 +552,7 @@ static void image_skip_clusters(s64 count) buff[0] = 0; memcpy(buff + 1, &count, sizeof(count)); - + if (write_all(&fd_out, buff, sizeof(buff)) == -1) perr_exit("write_all"); } @@ -561,15 +561,15 @@ static void image_skip_clusters(s64 count) static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) { s64 i, len; /* number of clusters to copy */ - + if (opt.std_out || !opt.metadata_only) return; - + if (!(len = is_critical_metadata(image, rl))) return; - + lseek_to_cluster(rl->lcn); - + /* FIXME: this could give pretty suboptimal performance */ for (i = 0; i < len; i++) copy_cluster(opt.rescue, rl->lcn + i); @@ -597,19 +597,19 @@ static void clone_ntfs(u64 nr_clusters) if (write_all(&fd_out, &image_hdr, sizeof(image_hdr)) == -1) perr_exit("write_all"); } - + for (last_cl = cl = 0; cl < (u64)vol->nr_clusters; cl++) { - + if (ntfs_bit_get(lcn_bitmap.bm, cl)) { progress_update(&progress, ++p_counter); lseek_to_cluster(cl); image_skip_clusters(cl - last_cl - 1); - + copy_cluster(opt.rescue, cl); last_cl = cl; continue; } - + if (opt.std_out && !opt.save_image) { progress_update(&progress, ++p_counter); if (write_all(&fd_out, buf, csize) == -1) @@ -624,7 +624,7 @@ static void write_empty_clusters(s32 csize, s64 count, { s64 i; char buff[NTFS_MAX_CLUSTER_SIZE]; - + memset(buff, 0, csize); for (i = 0; i < count; i++) { @@ -689,14 +689,14 @@ do { \ static void wipe_timestamps(ntfs_walk_clusters_ctx *image) { ATTR_RECORD *a = image->ctx->attr; - + if (image->ni->mft_no <= LAST_METADATA_INODE) return; - if (a->type == AT_FILE_NAME) + if (a->type == AT_FILE_NAME) WIPE_TIMESTAMPS(FILE_NAME_ATTR, a); - else if (a->type == AT_STANDARD_INFORMATION) + else if (a->type == AT_STANDARD_INFORMATION) WIPE_TIMESTAMPS(STANDARD_INFORMATION, a); } @@ -709,27 +709,27 @@ static void wipe_resident_data(ntfs_walk_clusters_ctx *image) a = image->ctx->attr; p = (u8*)a + le16_to_cpu(a->value_offset); - + if (image->ni->mft_no <= LAST_METADATA_INODE) return; - + if (a->type != AT_DATA) return; - + for (i = 0; i < le32_to_cpu(a->value_length); i++) { if (p[i]) { p[i] = 0; n++; - } - } - + } + } + wiped_resident_data += n; } static void clone_logfile_parts(ntfs_walk_clusters_ctx *image, runlist *rl) { s64 offset = 0, lcn, vcn; - + while (1) { vcn = offset / image->ni->vol->cluster_size; @@ -781,10 +781,10 @@ static void walk_runs(struct ntfs_walk_cluster *walk) "%llx length %llx\n", ctx->ntfs_ino->mft_no, (unsigned int)le32_to_cpu(a->type), lcn, lcn_length); - + if (!wipe) dump_clusters(walk->image, rl + i); - + for (j = 0; j < lcn_length; j++) { u64 k = (u64)lcn + j; if (ntfs_bit_get_and_set(lcn_bitmap.bm, k, 1)) @@ -799,7 +799,7 @@ static void walk_runs(struct ntfs_walk_cluster *walk) walk->image->ni->mft_no == FILE_LogFile && walk->image->ctx->attr->type == AT_DATA) clone_logfile_parts(walk->image, rl); - + free(rl); } @@ -847,7 +847,7 @@ static void compare_bitmaps(struct bitmap *a) } for (i = 0; i < count; i++, pos++) { - s64 cl; /* current cluster */ + s64 cl; /* current cluster */ if (a->bm[pos] == bm[i]) continue; @@ -858,7 +858,7 @@ static void compare_bitmaps(struct bitmap *a) bit = ntfs_bit_get(a->bm, cl); if (bit == ntfs_bit_get(bm, i * 8 + cl % 8)) continue; - + if (opt.ignore_fs_check) { lseek_to_cluster(cl); copy_cluster(opt.rescue, cl); @@ -892,13 +892,13 @@ static void compare_bitmaps(struct bitmap *a) static int wipe_data(char *p, int pos, int len) { int wiped = 0; - + for (p += pos; --len >= 0;) { if (p[len]) { p[len] = 0; wiped++; - } - } + } + } return wiped; } @@ -907,11 +907,11 @@ static void wipe_unused_mft_data(ntfs_inode *ni) { int unused; MFT_RECORD *m = ni->mrec; - + /* FIXME: broken MFTMirr update was fixed in libntfs, check if OK now */ if (ni->mft_no <= LAST_METADATA_INODE) return; - + unused = le32_to_cpu(m->bytes_allocated) - le32_to_cpu(m->bytes_in_use); wiped_unused_mft_data += wipe_data((char *)m, le32_to_cpu(m->bytes_in_use), unused); @@ -921,11 +921,11 @@ static void wipe_unused_mft(ntfs_inode *ni) { int unused; MFT_RECORD *m = ni->mrec; - + /* FIXME: broken MFTMirr update was fixed in libntfs, check if OK now */ if (ni->mft_no <= LAST_METADATA_INODE) return; - + unused = le32_to_cpu(m->bytes_in_use) - sizeof(MFT_RECORD); wiped_unused_mft += wipe_data((char *)m, sizeof(MFT_RECORD), unused); } @@ -945,7 +945,7 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) progress_init(&progress, inode, last_mft_rec, 100); for (; inode <= last_mft_rec; inode++) { - + int err, deleted_inode; MFT_REF mref = (MFT_REF)inode; @@ -956,14 +956,14 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) ni = (ntfs_inode*)calloc(1, sizeof(ntfs_inode)); if (!ni) perr_exit("walk_clusters"); - + ni->vol = volume; err = ntfs_file_record_read(volume, mref, &ni->mrec, NULL); if (err == -1) { free(ni); continue; - } + } deleted_inode = !(ni->mrec->flags & MFT_RECORD_IN_USE); @@ -975,16 +975,16 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) wipe_unused_mft_data(ni); if (ntfs_mft_record_write(volume, ni->mft_no, ni->mrec)) perr_exit("ntfs_mft_record_write"); - } + } } if (ni->mrec) free(ni->mrec); free(ni); - if (deleted_inode) + if (deleted_inode) continue; - + if ((ni = ntfs_inode_open(volume, mref)) == NULL) { /* FIXME: continue only if it make sense, e.g. MFT record not in use based on $MFT bitmap */ @@ -1001,17 +1001,17 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) walk->image->ni = ni; walk_attributes(walk); -out: +out: if (wipe) { wipe_unused_mft_data(ni); if (ntfs_mft_record_write(volume, ni->mft_no, ni->mrec)) perr_exit("ntfs_mft_record_write"); - } + } if (ntfs_inode_close(ni)) perr_exit("ntfs_inode_close for inode %lld", inode); } - + return 0; } @@ -1088,7 +1088,7 @@ static void print_image_info(void) static void check_if_mounted(const char *device, unsigned long new_mntflag) { unsigned long mntflag; - + if (ntfs_check_if_mounted(device, &mntflag)) perr_exit("Failed to check '%s' mount state", device); @@ -1110,7 +1110,7 @@ static void check_if_mounted(const char *device, unsigned long new_mntflag) static void mount_volume(unsigned long new_mntflag) { check_if_mounted(opt.volume, new_mntflag); - + if (!(vol = ntfs_mount(opt.volume, new_mntflag))) { int err = errno; @@ -1129,7 +1129,7 @@ static void mount_volume(unsigned long new_mntflag) if (opt.force-- <= 0) err_exit("Volume is dirty. Run chkdsk and " "please try again (or see -f option).\n"); - + if (NTFS_MAX_CLUSTER_SIZE < vol->cluster_size) err_exit("Cluster size %u is too large!\n", (unsigned int)vol->cluster_size); @@ -1144,7 +1144,7 @@ static void mount_volume(unsigned long new_mntflag) volume_size(vol, vol->nr_clusters)); } -struct ntfs_walk_cluster backup_clusters = { NULL, NULL }; +struct ntfs_walk_cluster backup_clusters = { NULL, NULL }; static int device_offset_valid(int fd, s64 ofs) { @@ -1163,7 +1163,7 @@ static s64 device_size_get(int fd) if (ioctl(fd, BLKGETSIZE64, &size) >= 0) { Dprintf("BLKGETSIZE64 nr bytes = %llu (0x%llx)\n", - (unsigned long long)size, + (unsigned long long)size, (unsigned long long)size); return (s64)size; } @@ -1250,7 +1250,7 @@ static void set_filesize(s64 filesize) static s64 open_image(void) { if (strcmp(opt.volume, "-") == 0) { - if ((fd_in = fileno(stdin)) == -1) + if ((fd_in = fileno(stdin)) == -1) perr_exit("fileno for stdout failed"); } else { if ((fd_in = open(opt.volume, O_RDONLY)) == -1) @@ -1269,15 +1269,15 @@ static s64 open_image(void) static s64 open_volume(void) { s64 device_size; - + mount_volume(MS_RDONLY); - + device_size = ntfs_device_size_get(vol->dev, 1); if (device_size <= 0) err_exit("Couldn't get device size (%lld)!\n", device_size); - + print_volume_size("Current device size", device_size); - + if (device_size < vol->nr_clusters * vol->cluster_size) err_exit("Current NTFS volume size is bigger than the device " "size (%lld)!\nCorrupt partition table or incorrect " @@ -1304,7 +1304,7 @@ static void check_output_device(s64 input_size) if (dest_size < input_size) err_exit("Output device is too small (%lld) to fit the " "NTFS image (%lld).\n", dest_size, input_size); - + check_if_mounted(opt.output, 0); } else set_filesize(input_size); @@ -1331,7 +1331,7 @@ static int str2unicode(const char *aname, ntfschar **ustr, int *len) *ustr = AT_UNNAMED; *len = 0; } - + return 0; } @@ -1348,10 +1348,10 @@ static ntfs_attr_search_ctx *lookup_data_attr(ntfs_inode *ni, const char *aname) if ((ctx = attr_get_search_ctx(ni, NULL)) == NULL) return NULL; - + if (str2unicode(aname, &ustr, &len) == -1) goto error_out; - + if (ntfs_attr_lookup(AT_DATA, ustr, len, 0, 0, NULL, 0, ctx)) { perr_printf("ntfs_attr_lookup"); goto error_out; @@ -1364,14 +1364,14 @@ error_out: ntfs_attr_put_search_ctx(ctx); return NULL; } - + static void ignore_bad_clusters(ntfs_walk_clusters_ctx *image) { ntfs_inode *ni; ntfs_attr_search_ctx *ctx = NULL; runlist *rl; s64 nr_bad_clusters = 0; - + if (!(ni = ntfs_inode_open(vol, FILE_BadClus))) perr_exit("ntfs_open_inode"); @@ -1380,10 +1380,10 @@ static void ignore_bad_clusters(ntfs_walk_clusters_ctx *image) if (!(rl = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL))) perr_exit("ntfs_mapping_pairs_decompress"); - + for (; rl->length; rl++) { s64 lcn = rl->lcn; - + if (lcn == LCN_HOLE || lcn < 0) continue; @@ -1413,7 +1413,7 @@ int main(int argc, char **argv) msg_out = stderr; parse_options(argc, argv); - + utils_set_locale(); if (opt.restore_image) { @@ -1426,19 +1426,19 @@ int main(int argc, char **argv) ntfs_size += 512; /* add backup boot sector */ if (opt.std_out) { - if ((fd_out = fileno(stdout)) == -1) + if ((fd_out = fileno(stdout)) == -1) perr_exit("fileno for stdout failed"); } else { /* device_size_get() might need to read() */ int flags = O_RDWR; - + if (!opt.blkdev_out) { flags |= O_CREAT | O_TRUNC; if (!opt.overwrite) flags |= O_EXCL; } - if ((fd_out = open(opt.output, flags, S_IRWXU)) == -1) + if ((fd_out = open(opt.output, flags, S_IRWXU)) == -1) perr_exit("Opening file '%s' failed", opt.output); if (!opt.save_image) @@ -1451,20 +1451,20 @@ int main(int argc, char **argv) fsync_clone(fd_out); exit(0); } - + setup_lcn_bitmap(); memset(&image, 0, sizeof(image)); - backup_clusters.image = ℑ + backup_clusters.image = ℑ walk_clusters(vol, &backup_clusters); compare_bitmaps(&lcn_bitmap); print_disk_usage(vol->cluster_size, vol->nr_clusters, image.inuse); - + ignore_bad_clusters(&image); if (opt.save_image) initialise_image_hdr(device_size, image.inuse); - + /* FIXME: save backup boot sector */ if (opt.std_out || !opt.metadata_only) { @@ -1477,9 +1477,9 @@ int main(int argc, char **argv) exit(0); } - wipe = 1; + wipe = 1; opt.volume = opt.output; - /* 'force' again mount for dirty volumes (e.g. after resize). + /* 'force' again mount for dirty volumes (e.g. after resize). FIXME: use mount flags to avoid potential side-effects in future */ opt.force++; mount_volume(0); @@ -1487,26 +1487,26 @@ int main(int argc, char **argv) free(lcn_bitmap.bm); setup_lcn_bitmap(); memset(&image, 0, sizeof(image)); - backup_clusters.image = ℑ + backup_clusters.image = ℑ walk_clusters(vol, &backup_clusters); - + Printf("Num of MFT records = %10lld\n", (long long)vol->mft_na->initialized_size >> - vol->mft_record_size_bits); - Printf("Num of used MFT records = %10u\n", nr_used_mft_records); - - Printf("Wiped unused MFT data = %10u\n", wiped_unused_mft_data); - Printf("Wiped deleted MFT data = %10u\n", wiped_unused_mft); + vol->mft_record_size_bits); + Printf("Num of used MFT records = %10u\n", nr_used_mft_records); + + Printf("Wiped unused MFT data = %10u\n", wiped_unused_mft_data); + Printf("Wiped deleted MFT data = %10u\n", wiped_unused_mft); Printf("Wiped resident user data = %10u\n", wiped_resident_data); Printf("Wiped timestamp data = %10u\n", wiped_timestamp_data); - + wiped_total += wiped_unused_mft_data; wiped_total += wiped_unused_mft; wiped_total += wiped_resident_data; wiped_total += wiped_timestamp_data; Printf("Wiped totally = %10u\n", wiped_total); - + fsync_clone(fd_out); exit(0); } diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 57ba5a2d..35d54010 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -357,7 +357,7 @@ static int info (ntfs_volume *vol) */ static int dump_file (ntfs_volume *vol, ntfs_inode *ino) { - u8 buffer[1024]; + char buffer[1024]; ntfs_attr_search_ctx *ctx; ATTR_RECORD *rec; int i; diff --git a/ntfsprogs/ntfscluster.h b/ntfsprogs/ntfscluster.h index 41747c2a..fbc6c1d3 100644 --- a/ntfsprogs/ntfscluster.h +++ b/ntfsprogs/ntfscluster.h @@ -46,8 +46,8 @@ struct options { int force; /* Override common sense */ char *filename; /* File to examine */ u64 inode; /* Inode to examine */ - u64 range_begin; /* Look for objects in this range */ - u64 range_end; + s64 range_begin; /* Look for objects in this range */ + s64 range_end; }; struct match { diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 9d2a948f..8949e30d 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -115,7 +115,7 @@ static int parse_options (int argc, char **argv) { "inode", no_argument, NULL, 'i' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, - { "attr-name", required_argument, NULL, 'N' }, + { "attr-name", required_argument, NULL, 'N' }, { "no-action", no_argument, NULL, 'n' }, { "quiet", no_argument, NULL, 'q' }, { "version", no_argument, NULL, 'V' }, @@ -129,7 +129,7 @@ static int parse_options (int argc, char **argv) int ver = 0; int help = 0; s64 attr; - + opts.device = NULL; opts.src_file = NULL; opts.dest_file = NULL; @@ -182,7 +182,7 @@ static int parse_options (int argc, char **argv) Eprintf("You can specify only one attribute " "name.\n"); err++; - } else + } else opts.attr_name = argv[optind - 1]; break; case 'n': @@ -286,7 +286,7 @@ int main (int argc, char *argv[]) vol = utils_mount_volume(opts.device, flags, opts.force); if (!vol) { - perror("ERROR: couldn't mount volume"); + perror("ERROR: couldn't mount volume"); return 1; } @@ -322,7 +322,7 @@ int main (int argc, char *argv[]) } else out = ntfs_pathname_to_inode(vol, NULL, opts.dest_file); if (!out) { - perror("ERROR: Couldn't open destination file"); + perror("ERROR: Couldn't open destination file"); goto close_src; } if ((le16_to_cpu(out->mrec->flags) & MFT_RECORD_IS_DIRECTORY) && @@ -362,7 +362,7 @@ int main (int argc, char *argv[]) } } - if (opts.attr_name) { + if (opts.attr_name) { attr_name_len = ntfs_mbstoucs(opts.attr_name, &attr_name, 0); if (attr_name_len == -1) { perror("ERROR: Failed to parse attribute name"); diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 2c52b6b3..1e8cde3f 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -505,7 +505,7 @@ skip_rstr_pass: ++pass; goto rstr_pass_loc; } - + return rstr; } @@ -714,7 +714,7 @@ int main(int argc, char **argv) puts("$LogFile is not initialized."); return 0; } - + /* * First, verify the restart page header for consistency. */ @@ -739,7 +739,7 @@ int main(int argc, char **argv) */ rcrd = (RECORD_PAGE_HEADER*)dump_restart_areas(rstr, buf, page_size); printf("\n\nFinished with restart pages. " - "Beginning with log pages.\n"); + "Beginning with log pages.\n"); /* * Dump the log areas. diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 6eb34e1b..bf2e3e91 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -91,7 +91,7 @@ static int usage(void) " -h, --help Display this help\n" " -V, --version Display version information\n" "\n" - "For example: %s /dev/hda6\n\n", + "For example: %s /dev/hda6\n\n", EXEC_NAME, VERSION, EXEC_NAME, EXEC_NAME); printf("%s%s", ntfs_bugs, ntfs_home); exit(1); @@ -139,7 +139,7 @@ static void parse_options(int argc, char **argv) usage(); } } - + if (opt.volume == NULL) { printf("ERROR: You must specify a device.\n"); usage(); diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 6c51b392..1d69df09 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -300,7 +300,7 @@ static char *ntfs_attr_get_name(ATTR_RECORD *attr) ntfschar *ucs_attr_name; char *mbs_attr_name = NULL; int mbs_attr_name_size; - + /* calculate name position */ ucs_attr_name = (ntfschar *)((char *)attr + le16_to_cpu(attr->name_offset)); /* convert unicode to printable format */ @@ -330,7 +330,7 @@ static void ntfs_dump_volume(ntfs_volume *vol) printf("\tCluster Size: %u\n", (unsigned int)vol->cluster_size); printf("\tVolume Size in Clusters: %lld\n", (long long)vol->nr_clusters); - + printf("MFT Information \n"); printf("\tMFT Record Size: %u\n", (unsigned int)vol->mft_record_size); printf("\tMFT Zone Multiplier: %u\n", vol->mft_zone_multiplier); @@ -349,7 +349,7 @@ static void ntfs_dump_volume(ntfs_volume *vol) (long long)vol->mftmirr_lcn); printf("\tSize of Attribute Definition Table: %d\n", (int)vol->attrdef_len); - + printf("FILE_Bitmap Information \n"); printf("\tFILE_Bitmap MFT Record Number: %llu\n", (unsigned long long)vol->lcnbmp_ni->mft_no); @@ -361,7 +361,7 @@ static void ntfs_dump_volume(ntfs_volume *vol) (int)vol->lcnbmp_ni->nr_extents); /* FIXME: need to add code for the union if nr_extens != 0, but i dont know if it will ever != 0 with FILE_Bitmap */ - + printf("FILE_Bitmap Data Attribute Information\n"); printf("\tDecompressed Runlist: not done yet\n"); printf("\tBase Inode: %llu\n", @@ -385,7 +385,7 @@ static void ntfs_dump_volume(ntfs_volume *vol) vol->lcnbmp_na->compression_block_size_bits); printf("\tCompression Block Clusters: %u\n", vol->lcnbmp_na->compression_block_clusters); - + //TODO: Still need to add a few more attributes } @@ -501,7 +501,7 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) le16_to_cpu(attr->value_offset)); printf("Dumping attribute $STANDARD_INFORMATION (0x10)\n"); - + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* let's start with mandatory? fields */ @@ -509,18 +509,18 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) /* time conversion stuff */ if (!opts.notime) { char *ntfs_time_str = NULL; - + ntfs_time_str = ntfsinfo_time_to_str(standard_attr->creation_time); printf("\tFile Creation Time:\t %s",ntfs_time_str); - + ntfs_time_str = ntfsinfo_time_to_str( standard_attr->last_data_change_time); printf("\tFile Altered Time:\t %s",ntfs_time_str); - + ntfs_time_str = ntfsinfo_time_to_str( standard_attr->last_mft_change_time); printf("\tMFT Changed Time:\t %s",ntfs_time_str); - + ntfs_time_str = ntfsinfo_time_to_str(standard_attr->last_access_time); printf("\tLast Accessed Time:\t %s",ntfs_time_str); } @@ -532,7 +532,7 @@ static void ntfs_dump_attr_standard_information(ATTR_RECORD *attr) (unsigned int)le32_to_cpu(standard_attr->version_number)); printf("\tClass ID:\t\t %u \n", (unsigned int)le32_to_cpu(standard_attr->class_id)); - + value_length = le32_to_cpu(attr->value_length); if (value_length == 48) { /* printf("\t$STANDARD_INFORMATION fields owner_id, security_id, quota \n" @@ -559,7 +559,7 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) s64 l; printf("Dumping attribute AT_ATTRIBUTE_LIST (0x20)\n"); - + /* Dump list's name */ if (attr->name_length) { char *stream_name = NULL; @@ -576,7 +576,7 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) } else { printf("\tList name:\t\t unnamed\n"); } - + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* Dump list's size */ @@ -592,10 +592,10 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) printf("\tList's size:\t\t %u bytes\n", (unsigned int)le32_to_cpu(attr->value_length)); } - + if (!opts.verbose) return; - + l = ntfs_get_attribute_value_length(attr); if (!l) { perror("ntfs_get_attribute_value_length failed"); @@ -659,7 +659,7 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) le16_to_cpu(attr->value_offset)); printf("Dumping attribute $FILE_NAME (0x30)\n"); - + /* let's start with the obvious - file name */ if (file_name_attr->file_name_length>0) { @@ -688,7 +688,7 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) ntfs_dump_namespace(file_name_attr->file_name_type); printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); - + /* other basic stuff about the file */ printf("\tAllocated File Size:\t %lld\n", (long long)sle64_to_cpu(file_name_attr->allocated_size)); @@ -701,7 +701,7 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) /* time stuff stuff */ if (!opts.notime) { char *ntfs_time_str; - + ntfs_time_str = ntfsinfo_time_to_str(file_name_attr->creation_time); printf("\tFile Creation Time:\t %s",ntfs_time_str); @@ -731,7 +731,7 @@ static void ntfs_dump_attr_object_id(ATTR_RECORD *attr,ntfs_volume *vol) le16_to_cpu(attr->value_offset)); printf("Dumping attribute $OBJECT_ID (0x40)\n"); - + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); if (vol->major_ver >= 3.0) { @@ -786,7 +786,7 @@ static void ntfs_dump_acl(const char *prefix,ACL *acl) unsigned int i; u16 ace_count; ACCESS_ALLOWED_ACE *ace; - + printf("%sRevision\t %u\n",prefix,acl->revision); /* don't recalc le16_to_cpu every iteration (minor speedup on big-endians */ @@ -799,7 +799,7 @@ static void ntfs_dump_acl(const char *prefix,ACL *acl) for (i=0;iace_count;i++) { const char *ace_type; char *sid; - + /* set ace_type. */ switch (ace->type) { case ACCESS_ALLOWED_ACE_TYPE: @@ -815,7 +815,7 @@ static void ntfs_dump_acl(const char *prefix,ACL *acl) ace_type = "unknown"; break; } - + printf("%sACE:\t\t type:%s flags:0x%x access:0x%x\n",prefix,ace_type, (unsigned int)le16_to_cpu(ace->flags),(unsigned int)le32_to_cpu(ace->mask)); /* get a SID string */ @@ -823,7 +823,7 @@ static void ntfs_dump_acl(const char *prefix,ACL *acl) printf("%s\t\t SID: %s\n",prefix,sid); if (sid) free(sid); - + /* proceed to next ACE */ ace = (ACCESS_ALLOWED_ACE *)(((char *)ace) + le32_to_cpu(ace->size)); } @@ -838,9 +838,9 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v { SECURITY_DESCRIPTOR_ATTR *sec_desc_attr; char *sid; - + printf("Dumping attribute $SECURITY_DESCRIPTOR (0x50)\n"); - + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); if (attr->non_resident) { @@ -895,7 +895,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v } else { printf("missing\n"); } - + printf("\tDiscretionary ACL:\t\t "); if (sec_desc_attr->control & SE_DACL_PRESENT) { if (sec_desc_attr->control & SE_SACL_DEFAULTED) { @@ -907,7 +907,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v } else { printf("missing\n"); } - + if (attr->non_resident) free(sec_desc_attr); } @@ -921,7 +921,7 @@ static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) ntfschar *ucs_vol_name = NULL; printf("Dumping attribute $VOLUME_NAME (0x60)\n"); - + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); if (attr->value_length>0) { @@ -958,12 +958,12 @@ static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) static void ntfs_dump_attr_volume_information(ATTR_RECORD *attr) { VOLUME_INFORMATION *vol_information = NULL; - + vol_information = (VOLUME_INFORMATION*)((char *)attr+ le16_to_cpu(attr->value_offset)); printf("Dumping attribute $VOLUME_INFORMATION (0x70)\n"); - + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); printf("\tVolume Version:\t %d.%d\n", vol_information->major_ver, @@ -1018,12 +1018,12 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol) } else { printf("\tStream name:\t\t unnamed\n"); } - + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* TODO: parse the flags */ printf("\tFlags:\t\t\t 0x%04hx\n",le16_to_cpu(attr->flags)); - + /* fork by residence */ if (attr->non_resident) { /* VCN lowest_vcn; Lowest valid virtual cluster number @@ -1079,7 +1079,7 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) { int numb_entries = 1; char *name = NULL; - + Vprintf("\tDumping index entries:"); while(1) { if (!opts.verbose) { @@ -1099,7 +1099,7 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) if (entry->flags & INDEX_ENTRY_END) break; - + switch(type) { case(AT_FILE_NAME): Vprintf("\t\tFILE record number:\t %llu\n", @@ -1154,16 +1154,16 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) unsigned int type; INDEX_ROOT *index_root = NULL; INDEX_ENTRY *entry; - + index_root = (INDEX_ROOT*)((u8*)attr + le16_to_cpu(attr->value_offset)); - + printf("Dumping attribute $INDEX_ROOT (0x90)\n"); - + /* Dump index name */ if (attr->name_length) { char *index_name = NULL; index_name = ntfs_attr_get_name(attr); - + if (index_name) { printf("\tIndex name:\t\t '%s'\n",index_name); free(index_name); @@ -1175,7 +1175,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) } else { printf("\tIndex name:\t\t unnamed\n"); } - + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* attr_type dumping */ @@ -1206,7 +1206,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) (unsigned int)le32_to_cpu(index_root->index_block_size)); printf("\tClusters Per Block:\t %u\n", index_root->clusters_per_index_block); - + /* index header starts here */ printf("\tAllocated Size:\t\t %u\n", (unsigned int)le32_to_cpu(index_root->index.allocated_size)); @@ -1233,14 +1233,14 @@ static int get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, ntfs_attr_search_ctx *ctx; ntfschar *name = 0; INDEX_ROOT *root; - + if (attr->name_length) { name = malloc(attr->name_length * sizeof(ntfschar)); if (!name) { perror("malloc failed"); return -1; } - memcpy(name, (u8 *)attr + attr->name_offset, + memcpy(name, (u8 *)attr + attr->name_offset, attr->name_length * sizeof(ntfschar)); } ctx = ntfs_attr_get_search_ctx(ni, 0); @@ -1256,7 +1256,7 @@ static int get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, free(name); return -1; } - + root = (INDEX_ROOT*)((u8*)ctx->attr + le16_to_cpu(ctx->attr->value_offset)); *size = le32_to_cpu(root->index_block_size); @@ -1305,7 +1305,7 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) } ntfs_attr_close(na); byte = bitmap; - + na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, name, attr->name_length); if (!na) { perror("ntfs_attr_open failed"); @@ -1327,7 +1327,7 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) } ntfs_attr_close(na); tmp_alloc = allocation; - + bit = 0; while((u8 *)tmp_alloc < (u8 *)allocation + na->data_size) { if (*byte & (1 << bit)) { @@ -1369,7 +1369,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) if (attr->name_length) { char *index_name = NULL; index_name = ntfs_attr_get_name(attr); - + if (index_name) { printf("\tIndex name:\t\t '%s'\n",index_name); free(index_name); @@ -1398,7 +1398,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) Eprintf("Invalid $INDEX_ALLOCTION attribute. Should be be" " non-resident\n"); } - + ntfs_dump_index_allocation(attr, ni); } @@ -1415,7 +1415,7 @@ static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) if (attr->name_length) { char *bitmap_name = NULL; bitmap_name = ntfs_attr_get_name(attr); - + if (bitmap_name) { printf("\tBitmap name:\t\t '%s'\n",bitmap_name); free(bitmap_name); @@ -1427,7 +1427,7 @@ static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) } else { printf("\tBitmap name:\t\t unnamed\n"); } - + printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* dump bitmap size */ @@ -1518,12 +1518,12 @@ static void ntfs_hex_dump(void *buf,unsigned int length) unsigned char c = *((char *)buf + j); printf("%02hhX ",c); } - + /* realign */ for (;jmrec->flags; - + printf("Dumping Inode #%llu\n",(long long)inode->mft_no); - + printf("Update Sequence Array Count:\t %hu\n", le16_to_cpu(inode->mrec->usa_count)); printf("$LogFile seqNum for this Inode:\t 0x%llx\n", @@ -1649,7 +1649,7 @@ static void ntfs_dump_inode_general_info(ntfs_inode *inode) (unsigned int)le32_to_cpu(inode->mrec->bytes_in_use)); printf("Size - Allocated:\t\t %u bytes\n", (unsigned int)le32_to_cpu(inode->mrec->bytes_allocated)); - + if (inode->mrec->base_mft_record) { printf("base MFT record:\t\t %llu\n", MREF_LE(inode->mrec->base_mft_record)); @@ -1729,7 +1729,7 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) ntfs_dump_attr_unknown(ctx->attr); } } - + /* if we exited the loop before we're done - notify the user */ if (errno != ENOENT) { fprintf(stderr, "ntfsinfo error: stopped before finished " @@ -1741,7 +1741,7 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) /* close all data-structures we used */ ntfs_attr_put_search_ctx(ctx); ntfs_inode_close(inode); - + /* happily exit */ } diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index f25416fc..ab09ca3b 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -365,7 +365,8 @@ static void dump_runs (u8 *buffer, int len) /** * find_unused */ -static runlist * find_unused (ntfs_volume *vol, s64 size, u64 loc, int flags) +static runlist * find_unused (ntfs_volume *vol, s64 size, u64 loc + __attribute__((unused)), int flags __attribute__((unused))) { const int bufsize = 8192; u8 *buffer; @@ -703,7 +704,7 @@ static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, Eprintf ("!move_runlist\n"); return -1; } - + // wipe orig runs memset (((u8*)rec) +rec->mapping_pairs_offset, 0, need_to - rec->mapping_pairs_offset); diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 1eddbb25..8272319e 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -116,7 +116,7 @@ struct progress_bar { struct llcn_t { s64 lcn; /* last used LCN for a "special" file/attr type */ s64 inode; /* inode using it */ -}; +}; #define NTFSCK_PROGBAR 0x0001 @@ -508,7 +508,7 @@ static int parse_options(int argc, char **argv) static void print_advise(ntfs_volume *vol, s64 supp_lcn) { s64 old_b, new_b, freed_b, old_mb, new_mb, freed_mb; - + old_b = vol->nr_clusters * vol->cluster_size; old_mb = rounded_up_division(old_b, NTFS_MBYTE); @@ -539,7 +539,7 @@ static void print_advise(ntfs_volume *vol, s64 supp_lcn) else printf("%lld bytes", (long long)freed_b); printf(").\n"); - + printf("Please make a test run using both the -n and -s options " "before real resizing!\n"); } @@ -554,10 +554,10 @@ static void rl_set(runlist *rl, VCN vcn, LCN lcn, s64 len) static int rl_items(runlist *rl) { int i = 0; - + while (rl[i++].length) ; - + return i; } @@ -599,7 +599,7 @@ static int str2unicode(const char *aname, ntfschar **ustr, int *len) *ustr = AT_UNNAMED; *len = 0; } - + return 0; } @@ -608,7 +608,7 @@ static int has_bad_sectors(ntfs_resize_t *resize) int len, ret = 0; ntfschar *ustr = NULL; ATTR_RECORD *a = resize->ctx->attr; - + if (resize->ni->mft_no != FILE_BadClus) return 0; @@ -617,13 +617,13 @@ static int has_bad_sectors(ntfs_resize_t *resize) if (ustr && ntfs_names_are_equal(ustr, len, (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)), - a->name_length, 0, NULL, 0)) + a->name_length, 0, NULL, 0)) ret = 1; - + if (ustr != AT_UNNAMED) free(ustr); - return ret; + return ret; } static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) @@ -637,35 +637,35 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) inode = resize->ni->mft_no; flags = resize->ctx->attr->flags; - + if ((ret = has_bad_sectors(resize)) != 0) { if (ret == -1) perr_exit("Couldn't convert string to Unicode"); err_exit("Your disk has bad sectors (manufacturing faults or " "dying disk).\nThis situation isn't supported yet.\n"); - } + } if (NInoAttrList(resize->ni)) { llcn = &resize->last_multi_mft; if (inode != FILE_MFT && inode != FILE_MFTMirr) supported = 1; - + } else if (flags & ATTR_IS_SPARSE) { llcn = &resize->last_sparse; supported = 1; - + } else if (flags & ATTR_IS_COMPRESSED) { llcn = &resize->last_compressed; supported = 1; - + } else if (inode == FILE_MFT) { llcn = &resize->last_mft; /* First run of $MFT DATA attribute isn't supported yet */ if (resize->ctx->attr->type != AT_DATA || rl->vcn) supported = 1; - + } else if (inode == FILE_MFTMirr) { llcn = &resize->last_mftmir; supported = 1; @@ -678,11 +678,11 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) llcn = &resize->last_lcn; supported = 1; } - + if (llcn->lcn < last_lcn) { llcn->lcn = last_lcn; llcn->inode = inode; - } + } if (supported) return; @@ -696,12 +696,12 @@ static void collect_relocation_info(ntfs_resize_t *resize, runlist *rl) { s64 lcn, lcn_length, start, len, inode; s64 new_vol_size; /* (last LCN on the volume) + 1 */ - + lcn = rl->lcn; lcn_length = rl->length; inode = resize->ni->mft_no; new_vol_size = resize->new_volume_size; - + if (lcn + lcn_length <= new_vol_size) return; @@ -727,7 +727,7 @@ static void collect_relocation_info(ntfs_resize_t *resize, runlist *rl) if (!opt.info || !resize->new_volume_size) return; - + printf("Relocation needed for inode %8lld attr 0x%x LCN 0x%08llx " "length %6lld\n", (long long)inode, (unsigned int)le32_to_cpu(resize->ctx->attr->type), @@ -764,7 +764,7 @@ static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfsck_t *fsck) printf(corrupt_volume_msg); exit(1); } - + for (i = 0; rl[i].length; i++) { s64 lcn = rl[i].lcn; @@ -788,7 +788,7 @@ static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfsck_t *fsck) if (k >= (u64)vol->nr_clusters) { long long outsiders = lcn_length - j; - + fsck->outsider += outsiders; if (++fsck->show_outsider <= 10 || opt.verbose) @@ -802,7 +802,7 @@ static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfsck_t *fsck) if (ntfs_bit_get_and_set(lcn_bitmap->bm, k, 1)) { if (++fsck->multi_ref <= 10 || opt.verbose) printf("Cluster %lld is referenced " - "multiply times!\n", + "multiply times!\n", (long long)k); continue; } @@ -879,7 +879,7 @@ static void compare_bitmaps(ntfs_volume *vol, struct bitmap *a) pos + count, a->size); for (i = 0; i < count; i++, pos++) { - s64 cl; /* current cluster */ + s64 cl; /* current cluster */ if (a->bm[pos] == bm[i]) continue; @@ -891,14 +891,14 @@ static void compare_bitmaps(ntfs_volume *vol, struct bitmap *a) if (bit == ntfs_bit_get(bm, i * 8 + cl % 8)) continue; - if (!mismatch && !bit && !backup_boot && + if (!mismatch && !bit && !backup_boot && cl == vol->nr_clusters / 2) { /* FIXME: call also boot sector check */ backup_boot = 1; printf("Found backup boot sector in " "the middle of the volume.\n"); - continue; - } + continue; + } if (++mismatch > 10) continue; @@ -942,12 +942,12 @@ static void progress_init(struct progress_bar *p, u64 start, u64 stop, int flags static void progress_update(struct progress_bar *p, u64 current) { float percent; - + if (!(p->flags & NTFS_PROGBAR)) return; if (p->flags & NTFS_PROGBAR_SUPPRESS) return; - + /* WARNING: don't modify the texts, external tools grep for them */ percent = p->unit * current; if (current != p->stop) { @@ -1028,7 +1028,7 @@ static void build_resize_constrains(ntfs_resize_t *resize) if (!resize->ctx->attr->non_resident) return; - if (!(rl = ntfs_mapping_pairs_decompress(resize->vol, + if (!(rl = ntfs_mapping_pairs_decompress(resize->vol, resize->ctx->attr, NULL))) perr_exit("ntfs_decompress_mapping_pairs"); @@ -1036,7 +1036,7 @@ static void build_resize_constrains(ntfs_resize_t *resize) /* CHECKME: LCN_RL_NOT_MAPPED check isn't needed */ if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) continue; - + collect_resize_constraints(resize, rl + i); if (resize->shrink) collect_relocation_info(resize, rl + i); @@ -1117,19 +1117,19 @@ static void rl_fixup(runlist **rl) } } -static void replace_attribute_runlist(ntfs_volume *vol, - ntfs_attr_search_ctx *ctx, +static void replace_attribute_runlist(ntfs_volume *vol, + ntfs_attr_search_ctx *ctx, runlist *rl) { int mp_size, l; void *mp; ATTR_RECORD *a = ctx->attr; - + rl_fixup(&rl); if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0)) == -1) perr_exit("ntfs_get_size_for_mapping_pairs"); - + if (a->name_length) { u16 name_offs = le16_to_cpu(a->name_offset); u16 mp_offs = le16_to_cpu(a->mapping_pairs_offset); @@ -1147,17 +1147,17 @@ static void replace_attribute_runlist(ntfs_volume *vol, char *next_attr; Vprintf("Enlarging attribute header ...\n"); - + mp_size = (mp_size + 7) & ~7; - + Vprintf("Old mp size : %d\n", l); Vprintf("New mp size : %d\n", mp_size); Vprintf("Bytes in use : %u\n", (unsigned int) le32_to_cpu(ctx->mrec->bytes_in_use)); - + next_attr = (char *)a + le16_to_cpu(a->length); l = mp_size - l; - + Vprintf("Bytes in use new : %u\n", l + (unsigned int) le32_to_cpu(ctx->mrec->bytes_in_use)); Vprintf("Bytes allocated : %u\n", (unsigned int) @@ -1168,7 +1168,7 @@ static void replace_attribute_runlist(ntfs_volume *vol, Vprintf("increase : %d\n", l); Vprintf("shift : %lld\n", (long long)remains_size); - + if (le32_to_cpu(ctx->mrec->bytes_in_use) + l > le32_to_cpu(ctx->mrec->bytes_allocated)) err_exit("Extended record needed (%u > %u), not yet " @@ -1221,9 +1221,9 @@ static void set_max_free_zone(s64 length, s64 end, runlist_element *rle) } } -static int find_free_cluster(struct bitmap *bm, +static int find_free_cluster(struct bitmap *bm, runlist_element *rle, - s64 nr_vol_clusters, + s64 nr_vol_clusters, int hint) { /* FIXME: get rid of this 'static' variable */ @@ -1278,9 +1278,9 @@ static int find_free_cluster(struct bitmap *bm, return 0; } -static runlist *alloc_cluster(struct bitmap *bm, - s64 items, - s64 nr_vol_clusters, +static runlist *alloc_cluster(struct bitmap *bm, + s64 items, + s64 nr_vol_clusters, int hint) { runlist_element rle; @@ -1300,7 +1300,7 @@ static runlist *alloc_cluster(struct bitmap *bm, rle.length = items; if (find_free_cluster(bm, &rle, nr_vol_clusters, hint) == -1) return NULL; - + rl_size = (runs + 2) * sizeof(runlist_element); if (!(rl = (runlist *)realloc(rl, rl_size))) return NULL; @@ -1313,7 +1313,7 @@ static runlist *alloc_cluster(struct bitmap *bm, } rl_set(rl + runs, vcn, -1LL, 0LL); - + if (runs > 1) { Vprintf("Multi-run allocation: \n"); dump_runlist(rl); @@ -1324,9 +1324,9 @@ static runlist *alloc_cluster(struct bitmap *bm, static int read_all(struct ntfs_device *dev, void *buf, int count) { int i; - + while (count > 0) { - + i = count; if (!NDevReadOnly(dev)) i = dev->d_ops->read(dev, buf, count); @@ -1346,7 +1346,7 @@ static int read_all(struct ntfs_device *dev, void *buf, int count) static int write_all(struct ntfs_device *dev, void *buf, int count) { int i; - + while (count > 0) { i = count; @@ -1384,9 +1384,9 @@ static int write_mft_record(ntfs_volume *v, const MFT_REF mref, MFT_RECORD *buf) static void lseek_to_cluster(ntfs_volume *vol, s64 lcn) { off_t pos; - + pos = (off_t)(lcn * vol->cluster_size); - + if (vol->dev->d_ops->seek(vol->dev, pos, SEEK_SET) == (off_t)-1) perr_exit("seek failed to position %lld", lcn); } @@ -1400,15 +1400,15 @@ static void copy_clusters(ntfs_resize_t *resize, s64 dest, s64 src, s64 len) for (i = 0; i < len; i++) { lseek_to_cluster(vol, src + i); - + if (read_all(vol->dev, buff, vol->cluster_size) == -1) perr_exit("read_all"); - + lseek_to_cluster(vol, dest + i); - + if (write_all(vol->dev, buff, vol->cluster_size) == -1) perr_exit("write_all"); - + resize->relocations++; progress_update(&resize->progress, resize->relocations); } @@ -1429,13 +1429,13 @@ static void relocate_clusters(ntfs_resize_t *r, runlist *dest_rl, s64 src_lcn) for (; dest_rl->length; src_lcn += dest_rl->length, dest_rl++) copy_clusters(r, dest_rl->lcn, src_lcn, dest_rl->length); } - + static void rl_split_run(runlist **rl, int run, s64 pos) { runlist *rl_new, *rle_new, *rle; int items, new_size, size_head, size_tail; s64 len_head, len_tail; - + items = rl_items(*rl); new_size = (items + 1) * sizeof(runlist_element); size_head = run * sizeof(runlist_element); @@ -1452,10 +1452,10 @@ static void rl_split_run(runlist **rl, int run, s64 pos) len_tail = rle->length - (pos - rle->lcn); len_head = rle->length - len_tail; - + rl_set(rle_new, rle->vcn, rle->lcn, len_head); rl_set(rle_new + 1, rle->vcn + len_head, rle->lcn + len_head, len_tail); - + Vprintf("Splitting run at cluster %lld:\n", (long long)pos); dump_run(rle); dump_run(rle_new); dump_run(rle_new + 1); @@ -1503,7 +1503,7 @@ static void relocate_run(ntfs_resize_t *resize, runlist **rl, int run) lcn = (*rl + run)->lcn; lcn_length = (*rl + run)->length; new_vol_size = resize->new_volume_size; - + if (lcn + lcn_length <= new_vol_size) return; @@ -1513,11 +1513,11 @@ static void relocate_run(ntfs_resize_t *resize, runlist **rl, int run) } hint = (resize->mref == FILE_MFTMirr) ? 1 : 0; - if (!(relocate_rl = alloc_cluster(&resize->lcn_bitmap, lcn_length, + if (!(relocate_rl = alloc_cluster(&resize->lcn_bitmap, lcn_length, new_vol_size, hint))) perr_exit("Cluster allocation failed for %llu:%lld", resize->mref, lcn_length); - + /* FIXME: check $MFTMirr DATA isn't multi-run (or support it) */ Vprintf("Relocate inode %7llu:0x%x:%08lld:0x%08llx --> 0x%08llx\n", (unsigned long long)resize->mref, @@ -1620,10 +1620,10 @@ static void relocate_inodes(ntfs_resize_t *resize) MFT_REF mref; printf("Relocating needed data ...\n"); - + progress_init(&resize->progress, 0, resize->relocations, resize->progress.flags); resize->relocations = 0; - + resize->mrec = (MFT_RECORD *)malloc(resize->vol->mft_record_size); if (!resize->mrec) perr_exit("malloc failed"); @@ -1643,10 +1643,10 @@ static void relocate_inodes(ntfs_resize_t *resize) static void print_hint(ntfs_volume *vol, const char *s, struct llcn_t llcn) { s64 runs_b, runs_mb; - + if (llcn.lcn == 0) return; - + runs_b = llcn.lcn * vol->cluster_size; runs_mb = rounded_up_division(runs_b, NTFS_MBYTE); printf("%-19s: %9lld MB %8lld\n", s, (long long)runs_mb, @@ -1731,9 +1731,9 @@ static void truncate_badclust_bad_attr(ntfs_resize_t *resize) * Shrink the metadata file $Bitmap. It must be large enough for one bit per * cluster of the shrunken volume. Also it must be a of 8 bytes in size. */ -static void shrink_bitmap_data_attr(struct bitmap *bm, - runlist **rlist, - s64 nr_bm_clusters, +static void shrink_bitmap_data_attr(struct bitmap *bm, + runlist **rlist, + s64 nr_bm_clusters, s64 new_size) { runlist *rl = *rlist; @@ -1781,8 +1781,8 @@ static void shrink_bitmap_data_attr(struct bitmap *bm, */ static void enlarge_bitmap_data_attr(ntfs_volume *vol, struct bitmap *bm, - runlist **rl, - s64 nr_bm_clusters, + runlist **rl, + s64 nr_bm_clusters, s64 new_size) { s64 i; @@ -1831,17 +1831,17 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) /* NOTE: shrink could use enlarge_bitmap_data_attr() also. Advantages: less code, better code coverage. "Drawback": could be relocated */ if (resize->shrink) - shrink_bitmap_data_attr(&resize->lcn_bitmap, &rl, + shrink_bitmap_data_attr(&resize->lcn_bitmap, &rl, nr_bm_clusters, nr_clusters); else - enlarge_bitmap_data_attr(vol, &resize->lcn_bitmap, &rl, + enlarge_bitmap_data_attr(vol, &resize->lcn_bitmap, &rl, nr_bm_clusters, nr_clusters); a->highest_vcn = cpu_to_le64(nr_bm_clusters - 1LL); a->allocated_size = cpu_to_le64(nr_bm_clusters * vol->cluster_size); a->data_size = cpu_to_le64(bm_bsize); a->initialized_size = cpu_to_le64(bm_bsize); - + replace_attribute_runlist(vol, resize->ctx, rl); /* @@ -1867,8 +1867,8 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) * (inode number). */ static void lookup_data_attr(ntfs_volume *vol, - MFT_REF mref, - const char *aname, + MFT_REF mref, + const char *aname, ntfs_attr_search_ctx **ctx) { ntfs_inode *ni; @@ -1907,7 +1907,7 @@ static void truncate_badclust_file(ntfs_resize_t *resize) /* FIXME: sanity_check_attr(ctx->attr); */ truncate_badclust_bad_attr(resize); - if (write_mft_record(resize->vol, resize->ctx->ntfs_ino->mft_no, + if (write_mft_record(resize->vol, resize->ctx->ntfs_ino->mft_no, resize->ctx->mrec)) perr_exit("Couldn't update $BadClust"); @@ -1926,7 +1926,7 @@ static void truncate_bitmap_file(ntfs_resize_t *resize) lookup_data_attr(resize->vol, FILE_Bitmap, NULL, &resize->ctx); truncate_bitmap_data_attr(resize); - if (write_mft_record(resize->vol, resize->ctx->ntfs_ino->mft_no, + if (write_mft_record(resize->vol, resize->ctx->ntfs_ino->mft_no, resize->ctx->mrec)) perr_exit("Couldn't update $Bitmap"); @@ -1976,7 +1976,7 @@ static void update_bootsector(ntfs_resize_t *r) if (r->mftmir_old) { r->progress.flags |= NTFS_PROGBAR_SUPPRESS; - copy_clusters(r, r->mftmir_rl.lcn, r->mftmir_old, + copy_clusters(r, r->mftmir_rl.lcn, r->mftmir_old, r->mftmir_rl.length); bs.mftmirr_lcn = cpu_to_le64(r->mftmir_rl.lcn); r->progress.flags &= ~NTFS_PROGBAR_SUPPRESS; @@ -2031,7 +2031,7 @@ static void print_disk_usage(ntfs_volume *vol, s64 nr_used_clusters) static void print_num_of_relocations(ntfs_resize_t *resize) { s64 relocations = resize->relocations * resize->vol->cluster_size; - + printf("Needed relocations : %lld (%lld MB)\n", (long long)resize->relocations, (long long) rounded_up_division(relocations, NTFS_MBYTE)); @@ -2082,7 +2082,7 @@ static ntfs_volume *mount_volume(void) if (opt.force-- <= 0) err_exit("Volume is dirty. Run chkdsk /f and " "please try again (or see -f option).\n"); - + if (NTFS_MAX_CLUSTER_SIZE < vol->cluster_size) err_exit("Cluster size %u is too large!\n", (unsigned int)vol->cluster_size); @@ -2136,7 +2136,7 @@ static void set_disk_usage_constraint(ntfs_resize_t *resize) { /* last lcn for a filled up volume (no empty space) */ s64 last = resize->inuse - 1; - + if (resize->last_unsupp < last) resize->last_unsupp = last; } @@ -2152,7 +2152,7 @@ static void check_shrink_constraints(ntfs_resize_t *resize) if (resize->inuse == resize->vol->nr_clusters) err_exit("Volume is full. To shrink it, " "delete unused files.\n"); - + if (opt.info) return; @@ -2250,7 +2250,7 @@ int main(int argc, char **argv) compare_bitmaps(vol, &fsck.lcn_bitmap); print_disk_usage(vol, fsck.inuse); - + memset(&resize, 0, sizeof(resize)); resize.new_volume_size = new_size; resize.inuse = fsck.inuse; @@ -2258,7 +2258,7 @@ int main(int argc, char **argv) resize.vol = vol; if (opt.show_progress) resize.progress.flags |= NTFS_PROGBAR; - + /* This is also true if --info was used w/o --size (new_size = 0) */ if (new_size < vol->nr_clusters) resize.shrink = 1; diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 142a0333..6fe9994b 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" #include #include @@ -44,6 +43,8 @@ GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +//#define RM_WRITE 1 + static int ntfs_inode_close2 (ntfs_inode *ni); /** @@ -207,7 +208,7 @@ static void ntfs_name_print (ntfschar *name, int name_len) if (name_len) { ntfs_ucstombs (name, name_len, &buffer, 0); printf ("%s", buffer); - ntfs_free (buffer); + free (buffer); } else { printf ("!"); } @@ -268,31 +269,44 @@ static const char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) static int ntfs_bmp_commit (struct ntfs_bmp *bmp) { int i; + u32 cs; if (!bmp) return 0; if (bmp->count == 0) return 0; + //printf ("\ta size = %lld\n", bmp->attr->allocated_size); + //printf ("\td size = %lld\n", bmp->attr->data_size); + //printf ("\ti size = %lld\n", bmp->attr->initialized_size); + + cs = bmp->vol->cluster_size; + printf ("commit bmp 0x%02X (%sresident)\n", bmp->attr->type, bmp->attr->rl ? "non-" : ""); - printf ("\ta size = %lld\n", bmp->attr->allocated_size); - printf ("\td size = %lld\n", bmp->attr->data_size); - //printf ("\ti size = %lld\n", bmp->attr->initialized_size); - for (i = 0; i < bmp->count; i++) { - printf ("\tvcn = %lld\n", bmp->data_vcn[i]); - } -#if 0 - ntfs_attr *attr; - u8 **data; - VCN *data_vcn; - int count; + if (bmp->attr->rl) { + // non-resident + for (i = 0; i < bmp->count; i++) { +#ifdef RM_WRITE + ntfs_attr_pwrite (bmp->attr, bmp->data_vcn[i] * cs, cs, bmp->data[i]); // XXX retval +#else + printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, bmp->data_vcn[i]); #endif - for (i = 0; i < bmp->count; i++) - ntfs_free (bmp->data[i]); + } + } else { + // resident +#ifdef RM_WRITE + ntfs_attr_pwrite (bmp->attr, bmp->data_vcn[0], bmp->attr->data_size, bmp->data[0]); // XXX retval +#else + printf (RED "\tntfs_attr_pwrite resident\n" END); +#endif + } - ntfs_free (bmp->data); - ntfs_free (bmp->data_vcn); + for (i = 0; i < bmp->count; i++) + free (bmp->data[i]); + + free (bmp->data); // XXX wipe ->data and ->data_vcn + free (bmp->data_vcn); bmp->count = 0; return 0; @@ -311,10 +325,10 @@ static int ntfs_bmp_rollback (struct ntfs_bmp *bmp) printf ("rollback bmp\n"); for (i = 0; i < bmp->count; i++) - ntfs_free (bmp->data[i]); + free (bmp->data[i]); - ntfs_free (bmp->data); - ntfs_free (bmp->data_vcn); + free (bmp->data); + free (bmp->data_vcn); bmp->count = 0; return 0; @@ -332,8 +346,8 @@ static void ntfs_bmp_free (struct ntfs_bmp *bmp) ntfs_attr_close (bmp->attr); - ntfs_free (bmp->cache); - ntfs_free (bmp); + free (bmp->cache); + free (bmp); } /** @@ -351,7 +365,7 @@ static struct ntfs_bmp * ntfs_bmp_alloc (ntfs_inode *inode, ATTR_TYPES type, ntf if (!attr) return NULL; - bmp = ntfs_calloc (1, sizeof (*bmp)); + bmp = calloc (1, sizeof (*bmp)); if (!bmp) { ntfs_attr_close (attr); return NULL; @@ -385,8 +399,8 @@ static int ntfs_bmp_add_data (struct ntfs_bmp *bmp, VCN vcn, u8 *data) new = ROUND_UP (bmp->count, 16); if (old != new) { - bmp->data = ntfs_realloc (bmp->data, new * sizeof (*bmp->data)); - bmp->data_vcn = ntfs_realloc (bmp->data_vcn , new * sizeof (*bmp->data_vcn)); + bmp->data = realloc (bmp->data, new * sizeof (*bmp->data)); + bmp->data_vcn = realloc (bmp->data_vcn , new * sizeof (*bmp->data_vcn)); } for (i = 0; i < bmp->count-1; i++) @@ -432,13 +446,13 @@ static u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn) } } - buffer = ntfs_malloc (cs); // XXX could be smaller if attr size < cluster size + buffer = calloc (1, cs); // XXX could be smaller if attr size < cluster size if (!buffer) return NULL; //printf ("loading from bitmap cluster %lld\n", vcn); if (ntfs_attr_pread (bmp->attr, vcn, cs, buffer) < 0) { - ntfs_free (buffer); + free (buffer); return NULL; } @@ -547,9 +561,9 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va printf (GREEN "Modified: inode %lld, ", bmp->attr->ni->mft_no); switch (bmp->attr->type) { - case AT_BITMAP: printf("$BITMAP"); break; - case AT_DATA: printf("$DATA"); break; - default: printf("???"); break; + case AT_BITMAP: printf ("$BITMAP"); break; + case AT_DATA: printf ("$DATA"); break; + default: break; } printf (" vcn %lld-%lld\n" END, vcn>>12, (vcn+length-1)>>12); @@ -633,7 +647,7 @@ static INDEX_ENTRY * ntfs_ie_create (void) INDEX_ENTRY *ie; length = 16; - ie = ntfs_malloc (length); + ie = malloc (length); if (!ie) return NULL; @@ -655,7 +669,7 @@ static INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie) if (!ie) return NULL; - copy = ntfs_malloc (ie->length); + copy = malloc (ie->length); if (!copy) return NULL; memcpy (copy, ie, ie->length); @@ -673,7 +687,7 @@ static INDEX_ENTRY * ntfs_ie_set_vcn (INDEX_ENTRY *ie, VCN vcn) if (!(ie->flags & INDEX_ENTRY_NODE)) { ie->length += 8; - ie = ntfs_realloc (ie, ie->length); + ie = realloc (ie, ie->length); if (!ie) return NULL; @@ -696,7 +710,7 @@ static INDEX_ENTRY * ntfs_ie_remove_vcn (INDEX_ENTRY *ie) ie->length -= 8; ie->flags &= ~INDEX_ENTRY_NODE; - ie = ntfs_realloc (ie, ie->length); + ie = realloc (ie, ie->length); return ie; } @@ -753,7 +767,7 @@ static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int name ie->length = 16 + need; ie->key_length = sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar)); - ie = ntfs_realloc (ie, ie->length + ie->key_length); + ie = realloc (ie, ie->length + ie->key_length); if (!ie) return NULL; @@ -788,7 +802,7 @@ static INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) ie->key_length = 0; ie->flags |= INDEX_ENTRY_END; - ie = ntfs_realloc (ie, ie->length); + ie = realloc (ie, ie->length); if (!ie) return NULL; @@ -820,7 +834,7 @@ static int ntfs_ie_test (void) if (1) { namelen = ntfs_mbstoucs("richard", &name, 0); ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); - ntfs_free (name); + free (name); name = NULL; ntfs_ie_dump (ie1); } @@ -828,7 +842,7 @@ static int ntfs_ie_test (void) if (1) { namelen = ntfs_mbstoucs("richard2", &name, 0); ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); - ntfs_free (name); + free (name); name = NULL; ntfs_ie_dump (ie1); } @@ -858,9 +872,9 @@ static int ntfs_ie_test (void) ie1->key.file_name.data_size = 3973; //ntfs_ie_dump (ie1); - ntfs_free (name); - ntfs_free (ie1); - ntfs_free (ie2); + free (name); + free (ie1); + free (ie2); return 0; } @@ -877,7 +891,7 @@ static INDEX_ENTRY ** ntfs_dt_alloc_children (INDEX_ENTRY **children, int count) if (old == new) return children; - return ntfs_realloc (children, new * sizeof (INDEX_ENTRY*)); + return realloc (children, new * sizeof (INDEX_ENTRY*)); } /** @@ -893,9 +907,9 @@ static BOOL ntfs_dt_alloc_children2 (struct ntfs_dt *dt, int count) if (old == new) return TRUE; - dt->children = ntfs_realloc (dt->children, new * sizeof (*dt->children)); - dt->sub_nodes = ntfs_realloc (dt->sub_nodes, new * sizeof (*dt->sub_nodes)); - dt->inodes = ntfs_realloc (dt->sub_nodes, new * sizeof (*dt->inodes)); + dt->children = realloc (dt->children, new * sizeof (*dt->children)); + dt->sub_nodes = realloc (dt->sub_nodes, new * sizeof (*dt->sub_nodes)); + dt->inodes = realloc (dt->sub_nodes, new * sizeof (*dt->inodes)); // XXX wipe new space @@ -948,7 +962,7 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt) if (!(entry->flags & INDEX_ENTRY_END)) { ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, entry->key.file_name.file_name_length); //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); - ntfs_free (name); + free (name); name = NULL; } @@ -962,8 +976,8 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt) if (dt->child_count > 0) { //printf ("%d subnodes\n", dt->child_count); - dt->sub_nodes = ntfs_calloc (dt->child_count, sizeof (struct ntfs_dt *)); - dt->inodes = ntfs_calloc (dt->child_count, sizeof (struct ntfs_inode *)); + dt->sub_nodes = calloc (dt->child_count, sizeof (struct ntfs_dt *)); + dt->inodes = calloc (dt->child_count, sizeof (struct ntfs_inode *)); } return dt->child_count; } @@ -1015,7 +1029,7 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) } else { ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, entry->key.file_name.file_name_length); //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); - ntfs_free (name); + free (name); name = NULL; } @@ -1025,8 +1039,8 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) if (dt->child_count > 0) { //printf ("%d subnodes\n", dt->child_count); - dt->sub_nodes = ntfs_calloc (dt->child_count, sizeof (struct ntfs_dt *)); - dt->inodes = ntfs_calloc (dt->child_count, sizeof (struct ntfs_inode *)); + dt->sub_nodes = calloc (dt->child_count, sizeof (struct ntfs_dt *)); + dt->inodes = calloc (dt->child_count, sizeof (struct ntfs_inode *)); } return dt->child_count; @@ -1052,35 +1066,31 @@ static int ntfs_dt_commit (struct ntfs_dt *dt) vol = dir->vol; // cluster size if (dt->changed) { - printf ("commit dt "); + printf ("commit dt\n"); if (dt->parent) { attr = dt->dir->ialloc; } else { attr = dt->dir->iroot; } - printf (BOLD RED "ntfs_attr_pwrite\n" END); - //WRITE printf ("%lld\n", ntfs_attr_pwrite (attr, dt->vcn * dt->dir->index_size, dt->dir->index_size, dt->data)); +#ifdef RM_WRITE + ntfs_attr_pwrite (attr, dt->vcn * dt->dir->index_size, dt->dir->index_size, dt->data); +#else + printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, dt->vcn); +#endif dt->changed = FALSE; } -#if 0 - //dt - u8 *data; - int data_len; - ntfs_inode **inodes; - VCN vcn; - BOOL changed; - - //dir - struct ntfs_bmp *bitmap; - ntfs_attr *iroot; - ntfs_attr *ialloc; - int index_size; -#endif - for (i = 0; i < dt->child_count; i++) { + if ((dt->inodes[i]) && (NInoDirty (dt->inodes[i]))) { +#ifdef RM_WRITE + ntfs_inode_sync (dt->inodes[i]); +#else + printf (RED "\tntfs_inode_sync %llu\n" END, dt->inodes[i]->mft_no); +#endif + } + if (ntfs_dt_commit (dt->sub_nodes[i]) < 0) return -1; } @@ -1116,11 +1126,11 @@ static void ntfs_dt_free (struct ntfs_dt *dt) ntfs_inode_close2 (dt->inodes[i]); } - ntfs_free (dt->sub_nodes); - ntfs_free (dt->children); - ntfs_free (dt->inodes); - ntfs_free (dt->data); // XXX is this always ours? - ntfs_free (dt); + free (dt->sub_nodes); + free (dt->children); + free (dt->inodes); + free (dt->data); // XXX is this always ours? + free (dt); } /** @@ -1134,7 +1144,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par if (!dir) return NULL; - dt = ntfs_calloc (1, sizeof (*dt)); + dt = calloc (1, sizeof (*dt)); if (!dt) return NULL; @@ -1155,7 +1165,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par dt->data_len = dt->dir->index_size; //printf ("parent size = %d\n", dt->data_len); - dt->data = ntfs_malloc (dt->data_len); + dt->data = malloc (dt->data_len); //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data)); ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data); //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); @@ -1185,7 +1195,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par //printf ("root i = %lld\n", dir->iroot->initialized_size); dt->data_len = dir->iroot->allocated_size; - dt->data = ntfs_malloc (dt->data_len); + dt->data = malloc (dt->data_len); //printf ("%lld\n", ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data)); ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data); //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); @@ -1602,8 +1612,8 @@ static int ntfs_dt_initialise (struct ntfs_dt *dt, VCN vcn) memset (dt->data, 0, dt->data_len); // Ought to check these are empty - ntfs_free (dt->children); - ntfs_free (dt->sub_nodes); + free (dt->children); + free (dt->sub_nodes); dt->children = NULL; dt->sub_nodes = NULL; @@ -1899,7 +1909,15 @@ static int ntfs_dir_commit (struct ntfs_dir *dir) if (!dir) return 0; - printf ("commit dir\n"); + printf ("commit dir inode %llu\n", dir->inode->mft_no); + if (NInoDirty (dir->inode)) { +#ifdef RM_WRITE + ntfs_inode_sync (dir->inode); +#else + printf (RED "\tntfs_inode_sync %llu\n" END, dir->inode->mft_no); +#endif + } + if (ntfs_dt_commit (dir->index) < 0) return -1; @@ -1970,8 +1988,8 @@ static void ntfs_dir_free (struct ntfs_dir *dir) for (i = 0; i < dir->child_count; i++) ntfs_dir_free (dir->children[i]); - ntfs_free (dir->children); - ntfs_free (dir); + free (dir->children); + free (dir); } /** @@ -1992,7 +2010,7 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) if (!inode) return NULL; - dir = ntfs_calloc (1, sizeof (*dir)); + dir = calloc (1, sizeof (*dir)); if (!dir) { ntfs_inode_close2 (inode); return NULL; @@ -2040,7 +2058,7 @@ static void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) parent->child_count++; //printf ("child count = %d\n", parent->child_count); - parent->children = ntfs_realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); + parent->children = realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); child->parent = parent; parent->children[parent->child_count-1] = child; @@ -2070,7 +2088,7 @@ static MFT_REF ntfs_dir_find (struct ntfs_dir *dir, char *name) //printf ("uname = %p\n", uname); mft_num = ntfs_dt_find (dir->index, uname, len); - ntfs_free (uname); + free (uname); return mft_num; } @@ -2151,7 +2169,7 @@ static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) if (!buffer) return -1; - utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); + //utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); for (i = 0; i < 1; i++) { if (buffer[i]) { //printf ("alloc in use\n"); @@ -2592,7 +2610,9 @@ static int utils_mftrec_mark_free5 (ntfs_inode *inode, struct ntfs_bmp *bmp, MFT } rec->flags &= ~MFT_RECORD_IN_USE; + //printf ("inode %llu, %lu\n", inode->mft_no, inode->state); NInoSetDirty(inode); + //printf ("inode %llu, %lu\n", inode->mft_no, inode->state); //printf ("\n"); //utils_dump_mem (buffer, 0, 1024, DM_DEFAULTS); @@ -2721,7 +2741,7 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, } } - unicode = ntfs_malloc (MAX_PATH * sizeof (ntfschar)); + unicode = malloc (MAX_PATH * sizeof (ntfschar)); ascii = strdup (pathname); // Work with a r/w copy if (!unicode || !ascii) { Eprintf ("Out of memory.\n"); @@ -2759,7 +2779,7 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, if (dt->inodes[dt_num] == NULL) { dt->inodes[dt_num] = ntfs_inode_open (dir->vol, dt->children[dt_num]->indexed_file); if (!dt->inodes[dt_num]) { - printf ("Can't open inode %lld\n", dt->children[dt_num]->indexed_file); + printf ("Can't open inode %lld\n", MREF (dt->children[dt_num]->indexed_file)); goto close; } dt->inodes[dt_num]->ref_count = 2; @@ -2787,7 +2807,7 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, //printf ("dir %p, dt %p, num %d, ino %p, %lld\n", dir, dt, dt_num, dt->inodes[dt_num], MREF (found->inode->mft_no)); close: free (ascii); // from strdup - ntfs_free (unicode); + free (unicode); return result; } @@ -2922,7 +2942,7 @@ static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY * //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); //printf ("\n"); - attr = ntfs_malloc (del->data_len + suc_ie->length - del_ie->length); + attr = malloc (del->data_len + suc_ie->length - del_ie->length); dst = attr; src = del->data; @@ -2946,7 +2966,7 @@ static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY * dst = attr; len = del->data_len + suc_ie->length - del_ie->length; - ntfs_free (del->data); + free (del->data); del->data = attr; del->data_len = len; @@ -3104,7 +3124,7 @@ static BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); old = del->data; - del->data = ntfs_realloc (del->data, del->data_len); + del->data = realloc (del->data, del->data_len); del->header = (INDEX_HEADER*) (del->data + 0x10); del->header->index_length -= del_len; @@ -3322,7 +3342,7 @@ static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) return 0; } - attr = ntfs_malloc (add->data_len + need); + attr = malloc (add->data_len + need); src = add->data; dst = attr; @@ -3342,7 +3362,7 @@ static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) memcpy (dst, src, len); - ntfs_free (add->data); + free (add->data); add->data = attr; add->data_len += need; @@ -3493,9 +3513,9 @@ static int ntfs_dt_remove_alloc (struct ntfs_dt *dt, int index_num) } } - ntfs_free (dt->sub_nodes); + free (dt->sub_nodes); dt->sub_nodes = NULL; - ntfs_free (dt->children); + free (dt->children); dt->children = NULL; dt->child_count = 0; @@ -3596,7 +3616,7 @@ static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) ir->index.allocated_size = dt->data_len - 16; ntfs_mft_resize_resident (dt->dir->inode, AT_INDEX_ROOT, I30, 4, dt->data, dt->data_len); - dt->data = ntfs_realloc (dt->data, dt->data_len); + dt->data = realloc (dt->data, dt->data_len); //printf ("ih->index_length = %d\n", ir->index.index_length); //printf ("ih->allocated_size = %d\n", ir->index.allocated_size); @@ -3612,9 +3632,9 @@ static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) } } - ntfs_free (dt->sub_nodes); + free (dt->sub_nodes); dt->sub_nodes = NULL; - ntfs_free (dt->children); + free (dt->children); dt->children = NULL; dt->child_count = 0; @@ -3910,7 +3930,7 @@ static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY return 0; } - attr = ntfs_malloc (parent->data_len + need); + attr = malloc (parent->data_len + need); src = parent->data; dst = attr; @@ -3930,7 +3950,7 @@ static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY memcpy (dst, src, len); - ntfs_free (parent->data); + free (parent->data); parent->data = attr; parent->data_len += need; @@ -4209,7 +4229,7 @@ static int ntfsrm (ntfs_volume *vol, char *name) ntfs_dt_del_child (finddir->index, uname, len); ntfs_dir_free (dir); - ntfs_free (uname); + free (uname); return 0; } @@ -4354,7 +4374,7 @@ static int ntfs_file_add (ntfs_volume *vol, char *name) if (!ie) goto done; - ntfs_free (uname); + free (uname); uname = NULL; len = ntfs_mbstoucs ("file26a", &uname, 0); @@ -4380,8 +4400,8 @@ static int ntfs_file_add (ntfs_volume *vol, char *name) done: ntfs_dir_free (dir); - ntfs_free (uname); - ntfs_free (ie); + free (uname); + free (ie); return 0; } @@ -4468,7 +4488,7 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) //printf ("\n"); //utils_dump_mem (del->data, 0, del->data_len, DM_BLUE|DM_GREEN|DM_INDENT); - ntfs_free (suc_ie); + free (suc_ie); if (res == FALSE) goto done; @@ -4664,7 +4684,7 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) freedts: commit: - printf ("commit\n"); + //printf ("commit\n"); done: return 0; @@ -4799,4 +4819,3 @@ done: return result; } - diff --git a/ntfsprogs/ntfsrm.h b/ntfsprogs/ntfsrm.h index 5bb0bbb3..b700ca9b 100644 --- a/ntfsprogs/ntfsrm.h +++ b/ntfsprogs/ntfsrm.h @@ -27,11 +27,6 @@ #include "types.h" #include "layout.h" -#define ntfs_malloc malloc -#define ntfs_realloc realloc -#define ntfs_calloc calloc -#define ntfs_free free - /** * struct options */ diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index f0e0ba0b..1a0f54d5 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -503,7 +503,8 @@ static void dump_resident_attr(ATTR_RECORD *a) /** * dump_mapping_pairs_array */ -static void dump_mapping_pairs_array(char *b, unsigned int max_len) +static void dump_mapping_pairs_array(char *b __attribute__((unused)), + unsigned int max_len __attribute__((unused))) { // TODO return; diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 7e91eeaf..6830eeff 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -720,7 +720,8 @@ static void free_file (struct ufile *file) * Return: @rec's filename, either same name space as @name or lowest space. * NULL if can't determine parenthood or on error. */ -static FILE_NAME_ATTR* verify_parent(struct filename* name, MFT_RECORD* rec) { +static FILE_NAME_ATTR* verify_parent(struct filename* name, MFT_RECORD* rec) +{ ATTR_RECORD *attr30; FILE_NAME_ATTR *filename_attr = NULL, *lowest_space_name = NULL; ntfs_attr_search_ctx *ctx; @@ -785,7 +786,7 @@ static void get_parent_name (struct filename* name, ntfs_volume* vol) if (!name || !vol) return; - + rec = calloc(1, vol->mft_record_size); if (!rec) { Eprintf ("ERROR: Couldn't allocate memory in get_parent_name()\n"); diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 5184435d..35fe44fe 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -419,7 +419,7 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, VCN cur_vcn = 0; runlist *rlc = na->rl; s64 cu_mask = na->compression_block_clusters - 1; - + while (rlc->length) { cur_vcn += rlc->length; if ((cur_vcn & cu_mask) || @@ -465,20 +465,20 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, size = na->allocated_size - na->data_size; offset = (cur_vcn << vol->cluster_size_bits) - size; } - + if (size < 0) { Vprintf ("Internal error\n"); Eprintf ("bug or damaged fs: we want " "allocate buffer size %lld bytes", size); return -1; } - + if ((act == act_info) || (!size)) { wiped += size; rlc++; continue; } - + buf = malloc (size); if (!buf) { Vprintf ("Not enough memory\n"); @@ -487,7 +487,7 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, return -1; } memset (buf, byte, size); - + ret = ntfs_rl_pwrite (vol, na->rl, offset, size, buf); free (buf); if (ret != size) { @@ -500,7 +500,7 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, next: rlc++; } - + return wiped; } @@ -515,7 +515,7 @@ next: * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_attribute (ntfs_volume *vol, int byte, enum action act, +static s64 wipe_attribute (ntfs_volume *vol, int byte, enum action act, ntfs_attr *na) { unsigned char *buf; @@ -528,7 +528,7 @@ static s64 wipe_attribute (ntfs_volume *vol, int byte, enum action act, if (NAttrEncrypted(na)) offset = (((offset - 1) >> 10) + 1) << 10; size = (vol->cluster_size - offset) % vol->cluster_size; - + if (act == act_info) return size; @@ -617,7 +617,7 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) Eprintf (" (inode %lld)\n", inode_num); goto close_attr; } - + if (wiped) { Vprintf ("Wiped %llu bytes\n", wiped); total += wiped; @@ -780,8 +780,10 @@ free: * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act, - ntfs_attr *naa, ntfs_attr *nab, u32 indx_record_size) { +static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act + __attribute__((unused)), ntfs_attr *naa, ntfs_attr *nab, + u32 indx_record_size) +{ s64 total = 0; s64 wiped = 0; s64 offset = 0; @@ -792,14 +794,14 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act, u8 mask; u8 *bitmap; u8 *buf; - + bitmap = malloc (nab->data_size); if (!bitmap) { Vprintf ("malloc failed\n"); Eprintf ("Couldn't allocate %lld bytes", nab->data_size); return -1; } - + if (ntfs_attr_pread (nab, 0, nab->data_size, bitmap) != nab->data_size) { Vprintf ("Internal error\n"); @@ -807,7 +809,7 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act, total = -1; goto free_bitmap; } - + buf = malloc (indx_record_size); if (!buf) { Vprintf ("malloc failed\n"); @@ -816,12 +818,12 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act, total = -1; goto free_bitmap; } - + while (offset < naa->allocated_size) { mask = 1 << obit; if (bitmap[obyte] & mask) { INDEX_ALLOCATION *indx; - + s64 ret = ntfs_rl_pread (vol, naa->rl, offset, indx_record_size, buf); if (ret != indx_record_size) { @@ -830,13 +832,13 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act, total = -1; goto free_buf; } - + indx = (INDEX_ALLOCATION *) buf; if (ntfs_mst_post_read_fixup ((NTFS_RECORD *)buf, indx_record_size)) Eprintf ("damaged fs: mst_post_read_fixup failed"); - - if ((le32_to_cpu(indx->index.allocated_size) + 0x18) != + + if ((le32_to_cpu(indx->index.allocated_size) + 0x18) != indx_record_size) { Vprintf ("Internal error\n"); Eprintf ("INDX record should be %u bytes", @@ -844,7 +846,7 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act, total = -1; goto free_buf; } - + wipe_offset = le32_to_cpu(indx->index.index_length) + 0x18; wipe_size = indx_record_size - wipe_offset; memset (buf + wipe_offset, byte, wipe_size); @@ -859,7 +861,7 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act, if (opts.verbose > 1) Vprintf ("x"); } - + wiped = ntfs_rl_pwrite (vol, naa->rl, offset, indx_record_size, buf); if (wiped != indx_record_size) { Vprintf ("ntfs_rl_pwrite failed\n"); @@ -895,13 +897,13 @@ free_bitmap: static u32 get_indx_record_size (ntfs_attr *nar) { u32 indx_record_size; - + if (ntfs_attr_pread (nar, 8, 4, &indx_record_size) != 4) { Vprintf ("Couldn't determine size of INDX record\n"); Eprintf ("ntfs_attr_pread failed"); return 0; } - + indx_record_size = le32_to_cpu (indx_record_size); if (!indx_record_size) { Vprintf ("Internal error\n"); @@ -968,7 +970,7 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) Vprintf ("\r"); goto close_inode; } - + if (!NAttrNonResident(naa)) { Vprintf ("Resident $INDEX_ALLOCATION\n"); Eprintf ("damaged fs: Resident $INDEX_ALLOCATION " @@ -991,7 +993,7 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) "name (inode %lld)\n", inode_num); goto close_attr_allocation; } - + nar = ntfs_attr_open (ni, AT_INDEX_ROOT, I30, 4); if (!nar) { Vprintf ("Couldn't open $INDEX_ROOT\n"); @@ -1000,27 +1002,27 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) " (inode %lld)\n", inode_num); goto close_attr_bitmap; } - + if (NAttrNonResident(nar)) { Vprintf ("Not resident $INDEX_ROOT\n"); Eprintf ("damaged fs: Not resident $INDEX_ROOT " "(inode %lld)\n", inode_num); goto close_attr_root; } - + indx_record_size = get_indx_record_size (nar); if (!indx_record_size) { Eprintf (" (inode %lld)\n", inode_num); goto close_attr_root; } - + wiped = wipe_index_allocation (vol, byte, act, naa, nab, indx_record_size); if (wiped == -1) { Eprintf (" (inode %lld)\n", inode_num); goto close_attr_root; } - + if (wiped) { Vprintf ("Wiped %llu bytes\n", wiped); total += wiped; @@ -1053,7 +1055,8 @@ close_inode: * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act) +static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act + __attribute__((unused))) { const int NTFS_BUF_SIZE2 = 8192; //FIXME(?): We might need to zero the LSN field of every single mft @@ -1064,7 +1067,7 @@ static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act) s64 len, pos, count; char buf[NTFS_BUF_SIZE2]; int eo; - + /* We can wipe logfile only with 0xff. */ byte = 0xff; @@ -1160,7 +1163,8 @@ error_exit: * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act) +static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act + __attribute__((unused))) { // wipe completely, chkdsk doesn't do anything, booting writes header const int NTFS_BUF_SIZE2 = 4096; @@ -1174,7 +1178,7 @@ static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act) return -1; //Qprintf ("wipe_pagefile (not implemented) 0x%02x\n", byte); - + ni = ntfs_pathname_to_inode(vol, NULL, "pagefile.sys"); if (!ni) { Dprintf("Failed to open inode of pagefile.sys.\n"); diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c index 3a5e2f45..5f822aab 100644 --- a/ntfsprogs/sd.c +++ b/ntfsprogs/sd.c @@ -27,10 +27,10 @@ * Do NOT free *@sd_val as it is static memory. This also means that you can * only use *@sd_val until the next call to this function. */ -void init_system_file_sd(int sys_file_no, char **sd_val, int *sd_val_len); -void init_system_file_sd(int sys_file_no, char **sd_val, int *sd_val_len) +void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len); +void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) { - static char sd_array[0x68]; + static u8 sd_array[0x68]; SECURITY_DESCRIPTOR_RELATIVE *sd; ACL *acl; ACCESS_ALLOWED_ACE *aa_ace; @@ -41,7 +41,7 @@ void init_system_file_sd(int sys_file_no, char **sd_val, int *sd_val_len) *sd_val_len = 0; return; } - *sd_val = (char*)&sd_array; + *sd_val = sd_array; sd = (SECURITY_DESCRIPTOR_RELATIVE*)&sd_array; sd->revision = 1; sd->alignment = 0; From 086fd4cc0cb53fe764216ca866faf83a7c06bfb3 Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 20 Jun 2005 14:23:27 +0000 Subject: [PATCH 2293/2994] probably a bug in __ntfs_attr_init --- libntfs/attrib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 336655b4..4b114799 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -256,7 +256,7 @@ static __inline__ void __ntfs_attr_init(ntfs_attr *na, ntfs_inode *ni, na->name = name; na->name_len = name_len; } else { - na->name = AT_UNNAMED; + na->name = NULL; na->name_len = 0; } } @@ -2728,7 +2728,8 @@ put_err_out: * EINVAL - Invalid argumets passed to function. * EIO - I/O error occured or damaged filesystem. */ -int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { +int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) +{ ntfs_inode *base_ni, *ni; ATTR_TYPES type; int err; From 09936e5c229d23334eb70976db1727db30cd61ab Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 20 Jun 2005 14:23:50 +0000 Subject: [PATCH 2294/2994] typos --- libntfs/collate.c | 6 ++++-- libntfs/runlist.c | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libntfs/collate.c b/libntfs/collate.c index 3d99c859..a302a030 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -70,7 +70,8 @@ static int ntfs_collate_ntofs_ulong(ntfs_volume *vol __attribute__((unused)), static int ntfs_collate_file_name(ntfs_volume *vol, const void *data1, const int data1_len __attribute__((unused)), - const void *data2, const int data2_len __attribute__((unused))){ + const void *data2, const int data2_len __attribute__((unused))) +{ int rc; const FILE_NAME_ATTR *fn1, *fn2; @@ -127,7 +128,8 @@ static ntfs_collate_func_t ntfs_do_collate0x1[4] = { */ int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr, const void *data1, const int data1_len, - const void *data2, const int data2_len) { + const void *data2, const int data2_len) +{ int i; ntfs_debug("Entering."); diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 722505da..c383f8ab 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1638,7 +1638,7 @@ int ntfs_rl_sparse(runlist *rl) runlist *rlc; if (!rl) { - Dprintf("%s(): Ivalid argument passed.\n", __FUNCTION__); + Dprintf("%s(): Invalid argument passed.\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -1646,7 +1646,7 @@ int ntfs_rl_sparse(runlist *rl) for (rlc = rl; rlc->length; rlc++) if (rlc->lcn < 0) { if (rlc->lcn != LCN_HOLE) { - Dprintf("%s(): Recevied unmapped runlist.\n", + Dprintf("%s(): Received unmapped runlist.\n", __FUNCTION__); errno = EINVAL; return -1; @@ -1669,7 +1669,7 @@ s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl) s64 ret = 0; if (!rl) { - Dprintf("%s(): Ivalid argument passed.\n", __FUNCTION__); + Dprintf("%s(): Invalid argument passed.\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -1677,7 +1677,7 @@ s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl) for (rlc = rl; rlc->length; rlc++) { if (rlc->lcn < 0) { if (rlc->lcn != LCN_HOLE) { - Dprintf("%s(): Recevied unmapped runlist.\n", + Dprintf("%s(): Received unmapped runlist.\n", __FUNCTION__); errno = EINVAL; return -1; From 0e364b49aacd942b817a56a622d2282009c37df2 Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 20 Jun 2005 14:24:53 +0000 Subject: [PATCH 2295/2994] ntfscat now works with attribute names ntfscat now removes fixup from: $MFT/$DATA $MFTMirr/$DATA anydir/$INDEX_ALLOCATION --- ntfsprogs/ntfscat.8.in | 53 ++++++++++++++-- ntfsprogs/ntfscat.c | 133 +++++++++++++++++++++++++++++++++-------- 2 files changed, 157 insertions(+), 29 deletions(-) diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in index 5227beb5..253e4e34 100644 --- a/ntfsprogs/ntfscat.8.in +++ b/ntfsprogs/ntfscat.8.in @@ -32,13 +32,48 @@ is equivalent to .BR "\-f \-v" . Long named options can be abbreviated to any unique prefix of their name. .TP -.B \-f +.B "\-a " desc .br .ns .TP -.B \-\-force -This will override some sensible defaults, such as not working with a mounted -volume. Use this option with caution. +.B "\-\-attribute " desc +Display the contents of a particular attribute. By default, the unname $DATA +attribute will be shown. The attribute can be specified by number (in decimal +or hexadecimal), or by name. +.TS +lB lB lB +l l l. +Hex Decimal Name +0x10 16 "$STANDARD_INFORMATION", +0x20 32 "$ATTRIBUTE_LIST", +0x30 48 "$FILE_NAME", +0x40 64 "$OBJECT_ID", +0x50 80 "$SECURITY_DESCRIPTOR", +0x60 96 "$VOLUME_NAME", +0x70 112 "$VOLUME_INFORMATION", +0x80 128 "$DATA", +0x90 144 "$INDEX_ROOT", +0xA0 160 "$INDEX_ALLOCATION", +0xB0 176 "$BITMAP", +0xC0 192 "$REPARSE_POINT", +0xD0 208 "$EA_INFORMATION", +0xE0 224 "$EA", +0xF0 240 "$PROPERTY_SET", +0x100 256 "$LOGGED_UTILITY_STREAM", +.TE +.br +.B Notes +.br +The attribute names may be given without the leading $ symbol. +.br +If you use the $ symbol, you must escape it from the shell. +.TP +.B "\-i " num +.br +.ns +.TP +.B "\-\-inode " num +Specify a file by its inode number instead of its name. .TP .B \-h .br @@ -66,7 +101,7 @@ Show the version number, copyright and license .br .ns .TP -.B \-\-vebose +.B \-\-verbose Display more debug/warning/error messages. .SH EXAMPLES Display the contents of a file in the root of an NTFS volume. @@ -79,6 +114,14 @@ Display the contents of a file in a subdirectory of an NTFS volume. .RS .sp .B ntfscat /dev/hda1 /winnt/system32/drivers/etc/hosts +.RE +.sp +Display the contents of the $INDEX_ROOT attribute of the root directory (inode +5). +.RS +.sp +.B ntfscat /dev/hda1 \-a INDEX_ROOT \-i 5 | hexdump \-C +.RE .SH BUGS .B ntfscat was written in a short time, to get something "out there". It needs a lot more work. diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 5bae325f..6f977424 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -1,8 +1,8 @@ /** * ntfscat - Part of the Linux-NTFS project. * - * Copyright (c) 2003 Richard Russon - * Copyright (c) 2003 Anton Altaparmakov + * Copyright (c) 2003-2005 Richard Russon + * Copyright (c) 2003 Anton Altaparmakov * * This utility will concatenate files and print on the standard output. * @@ -70,7 +70,7 @@ static void version (void) static void usage (void) { Printf ("\nUsage: %s [options] device [file]\n\n" - " -a, --attribute num Display this attribute\n" + " -a, --attribute desc Display this attribute (name or number)\n" " -i, --inode num Display this inode\n\n" " -f --force Use less caution\n" " -h --help Print this help\n" @@ -84,6 +84,60 @@ static void usage (void) Printf ("%s%s\n", ntfs_bugs, ntfs_home); } +/** + * parse_attribute - Read an attribute name, or number + * @value: String to be parsed + * @attr: Resulting attribute id (on success) + * + * Read a string representing an attribute. It may be a decimal, octal or + * hexadecimal number, or the attribute name in full. The leading $ sign is + * optional. + * + * Return: 1 Success, a valid attribute name or number + * 0 Error, not an attribute name or number + */ +static int parse_attribute (const char *value, ATTR_TYPES *attr) +{ + static const char *attr_name[] = { + "$STANDARD_INFORMATION", + "$ATTRIBUTE_LIST", + "$FILE_NAME", + "$OBJECT_ID", + "$SECURITY_DESCRIPTOR", + "$VOLUME_NAME", + "$VOLUME_INFORMATION", + "$DATA", + "$INDEX_ROOT", + "$INDEX_ALLOCATION", + "$BITMAP", + "$REPARSE_POINT", + "$EA_INFORMATION", + "$EA", + "$PROPERTY_SET", + "$LOGGED_UTILITY_STREAM", + NULL + }; + + int i; + long num; + + for (i = 0; attr_name[i]; i++) { + if ((strcmp (value, attr_name[i]) == 0) || + (strcmp (value, attr_name[i]+1) == 0)) { + *attr = (ATTR_TYPES) ((i+1)*16); + return 1; + } + } + + num = strtol (value, NULL, 0); + if ((num > 0) && (num < 257)) { + *attr = (ATTR_TYPES) num; + return 1; + } + + return 0; +} + /** * parse_options - Read and validate the programs command line * @@ -113,7 +167,7 @@ static int parse_options (int argc, char **argv) int err = 0; int ver = 0; int help = 0; - s64 attr; + ATTR_TYPES attr = AT_UNUSED; opterr = 0; /* We'll handle the errors, thank you. */ @@ -133,16 +187,16 @@ static int parse_options (int argc, char **argv) } break; case 'a': - if (opts.attr != (ATTR_TYPES)-1) + if (opts.attr != (ATTR_TYPES)-1) { Eprintf("You must specify exactly one attribute.\n"); - else if (utils_parse_size(optarg, &attr, FALSE)) { - opts.attr = (ATTR_TYPES)attr; + } else if (parse_attribute (optarg, &attr) > 0) { + opts.attr = attr; break; - } else - Eprintf("Couldn't parse attribute number.\n"); + } else { + Eprintf("Couldn't parse attribute.\n"); + } err++; break; - case 'f': opts.force++; break; @@ -207,19 +261,42 @@ static int parse_options (int argc, char **argv) return (!err && !help && !ver); } +/** + * index_get_size - Find the INDX block size from the index root + * @inode: Inode of the directory to be checked + * + * Find the size of a directory's INDX block from the INDEX_ROOT attribute. + * + * Return: n Success, the INDX blocks are n bytes in size + * 0 Error, not a directory + */ +static int index_get_size (ntfs_inode *inode) +{ + ATTR_RECORD *attr90; + INDEX_ROOT *iroot; + + attr90 = find_first_attribute (AT_INDEX_ROOT, inode->mrec); + if (!attr90) + return 0; // not a directory + + iroot = (INDEX_ROOT*)((u8*)attr90 + le16_to_cpu(attr90->value_offset)); + + return iroot->index_block_size; +} + /** * cat */ -static int cat (ntfs_volume *vol __attribute__((unused)), ntfs_inode *inode, - ATTR_TYPES type, ntfschar *name __attribute__((unused)), +static int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, + ntfschar *name __attribute__((unused)), int namelen __attribute__((unused))) { - /* increase 1024 only if you fix partial writes below */ - const int bufsize = 1024; + const int bufsize = 4096; char *buffer; ntfs_attr *attr; s64 bytes_read, written; s64 offset; + u32 block_size; buffer = malloc (bufsize); if (!buffer) @@ -227,14 +304,28 @@ static int cat (ntfs_volume *vol __attribute__((unused)), ntfs_inode *inode, attr = ntfs_attr_open (inode, type, NULL, 0); if (!attr) { - Eprintf ("Cannot cat a directory.\n"); + Eprintf ("Cannot find attribute type 0x%lx.\n", (long) type); free (buffer); return 1; } + if ((inode->mft_no < 2) && (attr->type == AT_DATA)) + block_size = vol->mft_record_size; + else if (attr->type == AT_INDEX_ALLOCATION) + block_size = index_get_size (inode); + else + block_size = 0; + offset = 0; for (;;) { - bytes_read = ntfs_attr_pread (attr, offset, bufsize, buffer); + if (block_size > 0) { + // These types have fixup + bytes_read = ntfs_attr_mst_pread(attr, offset, 1, block_size, buffer); + bytes_read *= block_size; + } else { + bytes_read = ntfs_attr_pread (attr, offset, bufsize, buffer); + } + //fprintf (stderr, "read %lld bytes\n", bytes_read); if (bytes_read == -1) { perror ("ERROR: Couldn't read file"); break; @@ -275,8 +366,6 @@ int main (int argc, char *argv[]) utils_set_locale(); - //XXX quieten errors, temporarily - vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); if (!vol) { perror("ERROR: couldn't mount volume"); @@ -301,12 +390,8 @@ int main (int argc, char *argv[]) ntfs_inode_close (inode); ntfs_umount (vol, FALSE); -#if 0 - if (result) - Printf ("failed\n"); - else - Printf ("success\n"); -#endif + return result; } + From ca873f0474e8954ad956afca672870e1f0268ff7 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 20 Jun 2005 14:31:30 +0000 Subject: [PATCH 2296/2994] Eeek. Someone did a commit just as I was about to commit so the commit message was lost! )-: Now again... Monster commit from me due to lack of time. Sorry about that. Features: - Version to 1.10.0 - Update readme, etc ready for release. - Update build system to suse linux 9.3 versions. - Fix warnings appearing for me on suse 9.3 with --enable-warnings --enable-debug. - Set attr_name to NULL in libntfs/attrib.c::__ntfs_attr_init() and fixup all callers apropriately. Thanks to FlatCap/Rich for pointing this out. - Determine endianness in ./configure and use that in addition to existing mechanisms for determining endianness. --- AUTHORS | 3 +- ChangeLog | 7 +- Makefile.in | 1 - NEWS | 6 +- README | 2 + aclocal.m4 | 520 +++++--------- autogen.sh | 4 +- config.guess | 64 +- config.h.in | 12 +- config.sub | 5 +- configure | 1372 +++++++++++++++--------------------- configure.ac | 10 +- doc/Makefile.in | 1 - include/Makefile.in | 1 - include/ntfs/Makefile.in | 1 - include/ntfs/endians.h | 8 +- libntfs/Makefile.in | 1 - libntfs/attrib.c | 14 +- libntfs/attrlist.c | 6 +- libntfs/gnome-vfs-method.c | 8 +- libntfs/inode.c | 6 +- libntfs/logfile.c | 9 +- ltmain.sh | 365 +++------- ntfsprogs/Makefile.in | 1 - ntfsprogs/ntfscp.c | 3 +- ntfsprogs/ntfsundelete.c | 7 +- ntfsprogs/utils.c | 7 +- 27 files changed, 943 insertions(+), 1501 deletions(-) diff --git a/AUTHORS b/AUTHORS index b3cd2cb0..f507a1ab 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5,7 +5,6 @@ Current active developers on the project are (in alphabetical order): Anton Altaparmakov Yuval Fledel (no email address on request) -Lode Leroy -Leonard NorrgĂĄrd +Yura Pakhuchiy Richard Russon Szakacsits Szabolcs diff --git a/ChangeLog b/ChangeLog index a5134fd9..f96d5546 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/2005 - 2.0.0-WIP +20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. - Add start_vcn parameter to ntfs_get_size_for_mapping_pairs() and ntfs_mapping_pairs_build() and adapt all callers. @@ -162,6 +162,11 @@ xx/xx/2005 - 2.0.0-WIP - Move utils_pathname_to_inode from to library (dir.c), adapt it for the library, rename it to ntfs_pathname_to_inode, update all users. (Yura) + - Set attr_name to NULL in libntfs/attrib.c::__ntfs_attr_init() and + fixup all callers apropriately. Thanks to FlatCap/Rich for pointing + this out. (Anton) + - Determine endianness in ./configure and use that in addition to + existing mechanisms for determining endianness. (Anton) 04/09/2004 - 1.9.4 - Urgent bug fixes. diff --git a/Makefile.in b/Makefile.in index 5cdc7e26..ce793941 100644 --- a/Makefile.in +++ b/Makefile.in @@ -140,7 +140,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/NEWS b/NEWS index f9ba6646..fe267e43 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,8 @@ Moved back from BitKeeper to CVS on SF.net. ntfsprogs should now work completely on Windows 2000 and XP (Cygwin). mkntfs does not create bootable volumes when on Windows. Volumes are locked -when using a R/W utility in order to prevent data corruption. (Yuval Fledel) +when using a R/W utility in order to prevent data corruption. (Yuval Fledel, +Anton Altaparmakov) ntfsinfo has been extended and now provides much more detailed information as well as being able to resolve a path/filename instead of requiring the inode @@ -29,8 +30,7 @@ Linux. ntfsprogs ("make libs" only) now compiles on FreeBSD, NetBSD, Windows (Cygwin), and DOS (DJGPP). Thanks to Christophe Grenier for DOS and FreeBSD testing -and fixes and to Lode Leroy for Windows testing and fixes. Note, the Windows -version is read-only and has limited functionality at present. +and fixes and to Lode Leroy for Windows testing and fixes. Older news diff --git a/README b/README index a3738a4b..86e246f9 100644 --- a/README +++ b/README @@ -117,3 +117,5 @@ ntfsls - List information about files in a directory residing on an NTFS partition. See man 8 ntfsls for details. ntfscat - Concatenate files and print their contents on the standard output. + +ntfscp - Overwrite files on an NTFS partition. diff --git a/aclocal.m4 b/aclocal.m4 index 4ebc090e..2b04da7c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -123,7 +123,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed='sed -e s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -191,7 +191,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -238,48 +238,6 @@ compiler=$CC ])# _LT_AC_SYS_COMPILER -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -AC_DEFUN([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -]) - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -AC_DEFUN([_LT_COMPILER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -AC_DEFUN([_LT_LINKER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_LINKER_BOILERPLATE - - # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -621,10 +579,8 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then $2=yes fi fi @@ -655,11 +611,6 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi else $2=yes fi @@ -729,7 +680,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -1015,9 +965,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi @@ -1516,7 +1464,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1579,11 +1527,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -2573,10 +2517,6 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # # Check for any special shared library compilation flags. # @@ -2709,10 +2649,6 @@ lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -2734,7 +2670,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2995,7 +2931,7 @@ case $host_os in fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -3013,11 +2949,11 @@ case $host_os in dgux*) case $cc_basename in - ec++*) + ec++) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx*) + ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3052,11 +2988,11 @@ case $host_os in # location of the library. case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC*) + aCC) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -3117,11 +3053,11 @@ case $host_os in esac case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC*) + aCC) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -3161,9 +3097,9 @@ case $host_os in ;; irix5* | irix6*) case $cc_basename in - CC*) + CC) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -3174,7 +3110,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -3187,7 +3123,7 @@ case $host_os in ;; linux*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3212,7 +3148,7 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc*) + icpc) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -3237,16 +3173,15 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC) # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx*) + cxx) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -3277,7 +3212,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx*) + cxx) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3316,7 +3251,7 @@ case $host_os in ;; osf3*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3332,14 +3267,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx*) + cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3357,7 +3292,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3376,7 +3311,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3391,17 +3326,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx*) + cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3420,7 +3355,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3444,7 +3379,7 @@ case $host_os in sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3456,12 +3391,12 @@ case $host_os in ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc*) + lcc) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3474,7 +3409,7 @@ case $host_os in ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3488,13 +3423,9 @@ case $host_os in *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3515,7 +3446,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx*) + gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -3558,7 +3489,7 @@ case $host_os in ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3790,16 +3721,12 @@ lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3818,9 +3745,7 @@ aix3*) fi ;; aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi + test "$enable_shared" = yes && enable_static=no ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3876,22 +3801,15 @@ lt_simple_link_test_code='public class conftest { public static void main(String # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds - AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) @@ -3934,16 +3852,11 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) @@ -3973,7 +3886,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -4079,7 +3992,7 @@ ifelse([$1], [], # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -4090,7 +4003,7 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -4173,7 +4086,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4207,7 +4120,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4733,7 +4646,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68*) + cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -4742,7 +4655,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4751,10 +4664,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; dgux*) case $cc_basename in - ec++*) + ec++) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx*) + ghcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4767,14 +4680,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; - aCC*) + aCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -4792,7 +4705,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. @@ -4803,7 +4716,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) case $cc_basename in - KCC*) + KCC) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' @@ -4814,13 +4727,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC*) + pgCC) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - cxx*) + cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -4837,7 +4750,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx*) + cxx) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) @@ -4848,14 +4761,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC*) + KCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC*) + RCC) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx*) + cxx) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -4871,7 +4784,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sco*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) @@ -4880,13 +4793,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; - gcx*) + gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4896,12 +4809,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc*) + lcc) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4911,7 +4824,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -5011,7 +4924,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5059,7 +4972,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5086,14 +4999,9 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac ;; sunos4*) @@ -5223,8 +5131,7 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - _LT_CC_BASENAME([$compiler]) + case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time @@ -5243,28 +5150,7 @@ ifelse([$1],[CXX],[ if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -5333,37 +5219,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -5402,6 +5257,41 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -5412,11 +5302,16 @@ EOF ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -5621,7 +5516,7 @@ EOF _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -5824,7 +5719,7 @@ EOF _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5843,12 +5738,10 @@ EOF solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -5857,18 +5750,8 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - *) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6159,120 +6042,63 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# -# Copyright © 2004 Scott James Remnant . -# -# 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 of the License, 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi - -fi[]dnl -])# PKG_PROG_PKG_CONFIG +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN([PKG_CHECK_MODULES], [ + succeeded=no -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then - pkg_cv_[]$1=$ac_cv_env_[]$1[]_value -elif test -n "$PKG_CONFIG"; then - if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then - pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.in -# -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) -pkg_failed=no -AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], - [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) -AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], - [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes -if test $pkg_failed = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) - ifelse([$4], , [AC_MSG_ERROR(dnl -[Package requirements ($2) were not met. -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details.])], - [$4]) -elif test $pkg_failed = untried; then - ifelse([$4], , [AC_MSG_FAILURE(dnl -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details. -To get pkg-config, see .])], - [$4]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - ifelse([$3], , :, [$3]) -fi[]dnl -])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # diff --git a/autogen.sh b/autogen.sh index 252fecd1..b4d0a559 100755 --- a/autogen.sh +++ b/autogen.sh @@ -24,8 +24,8 @@ fi exit 1 } -echo Running autoreconf --verbose --install --warnings=all -autoreconf --force --verbose --install --warnings=all +echo Running autoreconf --verbose --install +autoreconf --force --verbose --install # This gets around the BitKeeper problem that it checks out files with the # current time stamp rather than the time stamp at check in time. diff --git a/config.guess b/config.guess index 892833f9..44f30e6c 100755 --- a/config.guess +++ b/config.guess @@ -136,6 +136,16 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -825,25 +835,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo cris-axis-linux exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo crisv32-axis-linux exit 0 ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo frv-${VENDOR}-linux exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -862,7 +872,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -881,13 +891,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-${VENDOR}-linux exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-${VENDOR}-linux exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -900,34 +910,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-${VENDOR}-linux ;; + PA8*) echo hppa2.0-${VENDOR}-linux ;; + *) echo hppa-${VENDOR}-linux ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-${VENDOR}-linux exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo x86_64-${VENDOR}-linux exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -942,18 +952,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" + echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" + echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or + # Either a pre-BFD a.out linker (linuxoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -982,7 +992,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.h.in b/config.h.in index ac28e176..86c9693e 100644 --- a/config.h.in +++ b/config.h.in @@ -60,10 +60,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H -/* Define to 1 if long double works and has more range or precision than - double. */ -#undef HAVE_LONG_DOUBLE - /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_ENDIAN_H @@ -239,6 +235,14 @@ /* Version number of package */ #undef VERSION +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Define to 1 if your processor stores words with the least significant byte + first (like Intel and VAX, unlike Motorola and SPARC). */ +#undef WORDS_LITTLEENDIAN + /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS diff --git a/config.sub b/config.sub index d8fd2f8f..c884ad4e 100755 --- a/config.sub +++ b/config.sub @@ -1172,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1205,9 +1205,6 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index 303780b1..1b84168a 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 2.0.0-WIP. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.10.0. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='2.0.0-WIP' -PACKAGE_STRING='ntfsprogs 2.0.0-WIP' +PACKAGE_VERSION='1.10.0' +PACKAGE_STRING='ntfsprogs 1.10.0' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -947,18 +947,6 @@ ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS -ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} -ac_env_PKG_CONFIG_value=$PKG_CONFIG -ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} -ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG -ac_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} -ac_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS -ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} -ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS -ac_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} -ac_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS -ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} -ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS # # Report the --help message. @@ -967,7 +955,7 @@ 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 ntfsprogs 2.0.0-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.10.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1034,7 +1022,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 2.0.0-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.10.0:";; esac cat <<\_ACEOF @@ -1081,11 +1069,6 @@ Some influential environment variables: CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags - PKG_CONFIG path to pkg-config utility - LIBNTFS_GNOMEVFS_CFLAGS - C compiler flags for LIBNTFS_GNOMEVFS, overriding pkg-config - LIBNTFS_GNOMEVFS_LIBS - linker flags for LIBNTFS_GNOMEVFS, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1186,7 +1169,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 2.0.0-WIP +ntfsprogs configure 1.10.0 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1200,7 +1183,7 @@ 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 ntfsprogs $as_me 2.0.0-WIP, which was +It was created by ntfsprogs $as_me 1.10.0, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1928,7 +1911,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='2.0.0-WIP' + VERSION='1.10.0' cat >>confdefs.h <<_ACEOF @@ -3919,7 +3902,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3922 "configure"' > conftest.$ac_ext + echo '#line 3905 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5498,7 +5481,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5501:" \ +echo "$as_me:5484:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5699,7 +5682,6 @@ else fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -5990,7 +5972,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed='sed -e s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. @@ -6295,16 +6277,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -6492,20 +6465,6 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # # Check for any special shared library compilation flags. # @@ -6547,11 +6506,6 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works=yes - fi else lt_prog_compiler_static_works=yes fi @@ -6596,17 +6550,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6599: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6553: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6603: \$? = $ac_status" >&5 + echo "$as_me:6557: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -6712,7 +6664,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' @@ -6760,7 +6712,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -6787,14 +6739,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac ;; sunos4*) @@ -6858,17 +6805,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6861: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6808: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6865: \$? = $ac_status" >&5 + echo "$as_me:6812: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works=yes fi fi @@ -6920,18 +6865,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6923: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6868: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6927: \$? = $ac_status" >&5 + echo "$as_me:6872: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o=yes fi fi @@ -7011,16 +6954,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -7041,27 +6974,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -7130,37 +7042,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -7199,6 +7080,41 @@ EOF hardcode_shlibpath_var=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds=$archive_cmds + fi + else + ld_shlibs=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -7209,11 +7125,16 @@ EOF ;; esac - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -7520,7 +7441,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -7723,7 +7644,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -7742,12 +7663,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -7756,18 +7675,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs=yes ;; @@ -8304,7 +8213,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -8367,11 +8276,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -9160,7 +9065,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6;} # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -9527,7 +9432,7 @@ echo "$as_me: creating $ofile" >&6;} SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -9609,7 +9514,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9643,7 +9548,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -9998,20 +9903,6 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -10033,16 +9924,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -10512,7 +10394,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -10530,11 +10412,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi dgux*) case $cc_basename in - ec++*) + ec++) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - ghcx*) + ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10569,11 +10451,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # location of the library. case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC*) + aCC) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -10634,11 +10516,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC*) + aCC) case "$host_cpu" in hppa*64*|ia64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -10678,9 +10560,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; irix5* | irix6*) case $cc_basename in - CC*) + CC) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -10691,7 +10573,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -10704,7 +10586,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; linux*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10729,7 +10611,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc*) + icpc) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -10754,16 +10636,15 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC) # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx*) + cxx) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -10794,7 +10675,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; mvs*) case $cc_basename in - cxx*) + cxx) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10833,7 +10714,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf3*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10849,14 +10730,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx*) + cxx) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10874,7 +10755,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10893,7 +10774,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf4* | osf5*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10908,17 +10789,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx*) + cxx) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -10937,7 +10818,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10961,7 +10842,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi sco*) archive_cmds_need_lc_CXX=no case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10973,12 +10854,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - lcc*) + lcc) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10991,7 +10872,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -11005,13 +10886,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -11032,7 +10909,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; - gcx*) + gcx) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -11075,7 +10952,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11284,7 +11161,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; chorus*) case $cc_basename in - cxch68*) + cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -11293,7 +11170,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' @@ -11302,10 +11179,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; dgux*) case $cc_basename in - ec++*) + ec++) lt_prog_compiler_pic_CXX='-KPIC' ;; - ghcx*) + ghcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; @@ -11318,14 +11195,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC*) + CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; - aCC*) + aCC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -11343,7 +11220,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC*) + CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. @@ -11354,7 +11231,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) case $cc_basename in - KCC*) + KCC) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' @@ -11365,13 +11242,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; - pgCC*) + pgCC) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-static' ;; - cxx*) + cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -11388,7 +11265,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; mvs*) case $cc_basename in - cxx*) + cxx) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) @@ -11399,14 +11276,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC*) + KCC) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; - RCC*) + RCC) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; - cxx*) + cxx) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -11422,7 +11299,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sco*) case $cc_basename in - CC*) + CC) lt_prog_compiler_pic_CXX='-fPIC' ;; *) @@ -11431,13 +11308,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; - gcx*) + gcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; @@ -11447,12 +11324,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; - lcc*) + lcc) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; @@ -11462,7 +11339,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; @@ -11506,17 +11383,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11509: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11386: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11513: \$? = $ac_status" >&5 + echo "$as_me:11390: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_CXX=yes fi fi @@ -11568,18 +11443,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11571: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11446: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11575: \$? = $ac_status" >&5 + echo "$as_me:11450: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_CXX=yes fi fi @@ -12081,7 +11954,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -12144,11 +12017,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -12937,7 +12806,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 @@ -13666,9 +13512,7 @@ aix3*) fi ;; aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi + test "$enable_shared" = yes && enable_static=no ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 @@ -13774,7 +13618,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' @@ -13822,7 +13666,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' @@ -13849,14 +13693,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_F77='-Qoption ld ';; - *) - lt_prog_compiler_wl_F77='-Wl,';; - esac ;; sunos4*) @@ -13920,17 +13759,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13923: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13762: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13927: \$? = $ac_status" >&5 + echo "$as_me:13766: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_F77=yes fi fi @@ -13982,18 +13819,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13985: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13822: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13989: \$? = $ac_status" >&5 + echo "$as_me:13826: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_F77=yes fi fi @@ -14073,16 +13908,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -14103,27 +13928,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -14192,37 +13996,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_F77=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -14261,6 +14034,41 @@ EOF hardcode_shlibpath_var_F77=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_F77=$archive_cmds_F77 + fi + else + ld_shlibs_F77=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -14271,11 +14079,16 @@ EOF ;; esac - if test "$ld_shlibs_F77" = no; then - runpath_var= - hardcode_libdir_flag_spec_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= + if test "$ld_shlibs_F77" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -14562,7 +14375,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -14765,7 +14578,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' @@ -14784,12 +14597,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -14798,18 +14609,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_F77=yes ;; @@ -15346,7 +15147,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -15409,11 +15210,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15612,7 +15409,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -15761,7 +15558,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -15795,7 +15592,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -16044,41 +15841,15 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no -old_archive_cmds_GCJ=$old_archive_cmds - lt_prog_compiler_no_builtin_flag_GCJ= @@ -16104,17 +15875,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16107: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15878: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16111: \$? = $ac_status" >&5 + echo "$as_me:15882: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -16220,7 +15989,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' @@ -16268,7 +16037,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16295,14 +16064,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_GCJ='-Qoption ld ';; - *) - lt_prog_compiler_wl_GCJ='-Wl,';; - esac ;; sunos4*) @@ -16366,17 +16130,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16369: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16133: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16373: \$? = $ac_status" >&5 + echo "$as_me:16137: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_GCJ=yes fi fi @@ -16428,18 +16190,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16431: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16193: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16435: \$? = $ac_status" >&5 + echo "$as_me:16197: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi @@ -16519,16 +16279,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -16549,27 +16299,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -16638,37 +16367,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_GCJ=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -16707,6 +16405,41 @@ EOF hardcode_shlibpath_var_GCJ=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_GCJ=$archive_cmds_GCJ + fi + else + ld_shlibs_GCJ=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -16717,11 +16450,16 @@ EOF ;; esac - if test "$ld_shlibs_GCJ" = no; then - runpath_var= - hardcode_libdir_flag_spec_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= + if test "$ld_shlibs_GCJ" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -17028,7 +16766,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -17231,7 +16969,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' @@ -17250,12 +16988,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -17264,18 +17000,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_GCJ=yes ;; @@ -17812,7 +17538,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -17875,11 +17601,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -18668,7 +18390,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the @@ -19358,7 +19056,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -19507,7 +19205,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -19541,7 +19239,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -20191,11 +19889,11 @@ if test "$enable_gnome_vfs" != "no"; then export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" fi + succeeded=no -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then @@ -20220,6 +19918,7 @@ do done done + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -20233,123 +19932,56 @@ else echo "${ECHO_T}no" >&6 fi -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 fi -done -done - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 +echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 -if test -n "$ac_pt_PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 -echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - PKG_CONFIG=$ac_pt_PKG_CONFIG -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 -echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - echo "$as_me:$LINENO: result: yes" >&5 + if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - PKG_CONFIG="" - fi + succeeded=yes -fi + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 -pkg_failed=no -echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 -if test "${pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set" = "xset"; then - pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&6 -echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 -if test "${pkg_cv_LIBNTFS_GNOMEVFS_LIBS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set" = "xset"; then - pkg_cv_LIBNTFS_GNOMEVFS_LIBS=$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&6 + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 + else + LIBNTFS_GNOMEVFS_CFLAGS="" + LIBNTFS_GNOMEVFS_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` -if test $pkg_failed = yes; then - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - # Put the nasty error message in config.log where it belongs - echo "$LIBNTFS_GNOMEVFS_PKG_ERRORS" 1>&5 + fi + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + compile_gnome_vfs=true + else + if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} @@ -20359,22 +19991,8 @@ echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi -elif test $pkg_failed = untried; then + fi - if test "$enable_gnome_vfs" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - fi - -else - LIBNTFS_GNOMEVFS_CFLAGS=$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS - LIBNTFS_GNOMEVFS_LIBS=$pkg_cv_LIBNTFS_GNOMEVFS_LIBS - compile_gnome_vfs=true -fi fi @@ -20969,6 +20587,241 @@ _ACEOF fi +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_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_bigendian=no +else + 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_bigendian=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_LITTLEENDIAN 1 +_ACEOF + + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + 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 @@ -21147,72 +21000,6 @@ _ACEOF ;; esac -echo "$as_me:$LINENO: checking for working long double with more range or precision than double" >&5 -echo $ECHO_N "checking for working long double with more range or precision than double... $ECHO_C" >&6 -if test "${ac_cv_c_long_double+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - long double foo = 0.0; -int -main () -{ -static int test_array [1 - 2 * !(/* Using '|' rather than '||' catches a GCC 2.95.2 x86 bug. */ - (DBL_MAX < LDBL_MAX) | (LDBL_EPSILON < DBL_EPSILON) - | (DBL_MAX_EXP < LDBL_MAX_EXP) | (DBL_MANT_DIG < LDBL_MANT_DIG))]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_long_double=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_c_long_double=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_c_long_double" >&5 -echo "${ECHO_T}$ac_cv_c_long_double" >&6 -if test $ac_cv_c_long_double = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LONG_DOUBLE 1 -_ACEOF - -fi - 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 @@ -23653,7 +23440,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 2.0.0-WIP, which was +This file was extended by ntfsprogs $as_me 1.10.0, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23716,7 +23503,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 2.0.0-WIP +ntfsprogs config.status 1.10.0 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -24006,7 +23793,6 @@ s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t -s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t diff --git a/configure.ac b/configure.ac index e38dbf33..359bd510 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # configure.ac - Source file to generate "./configure" to prepare package for # compilation. # -# Copyright (c) 2000-2004 Anton Altaparmakov +# Copyright (c) 2000-2005 Anton Altaparmakov # Copyright (c) 2003 Jan Kratochvil # # This program/include file is free software; you can redistribute it and/or @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[2.0.0-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.10.0],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) @@ -199,9 +199,13 @@ AC_CHECK_HEADERS([ctype.h fcntl.h libintl.h limits.h locale.h mntent.h \ # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL +AC_C_BIGENDIAN(, + [AC_DEFINE([WORDS_LITTLEENDIAN], 1, + [Define to 1 if your processor stores words with the least significant + byte first (like Intel and VAX, unlike Motorola and SPARC).])] + ,) AC_C_CONST AC_C_INLINE -AC_C_LONG_DOUBLE AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_STRUCT_ST_BLOCKS diff --git a/doc/Makefile.in b/doc/Makefile.in index f2046fca..ef73e5d3 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -115,7 +115,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/Makefile.in b/include/Makefile.in index 8d93c691..33e9cdfd 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -124,7 +124,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 5802f31b..32fd7ef0 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -128,7 +128,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h index a22fc198..27b30064 100644 --- a/include/ntfs/endians.h +++ b/include/ntfs/endians.h @@ -2,7 +2,7 @@ * endians.h - Definitions related to handling of byte ordering. Part of the * Linux-NTFS project. * - * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2000-2005 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -65,11 +65,13 @@ # define __BYTE_ORDER __BYTE_ORDER__ # define __LITTLE_ENDIAN __LITTLE_ENDIAN__ # define __BIG_ENDIAN __BIG_ENDIAN__ -# elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) +# elif (defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)) || \ + defined(WORDS_LITTLEENDIAN) # define __BYTE_ORDER 1 # define __LITTLE_ENDIAN 1 # define __BIG_ENDIAN 0 -# elif !defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN) +# elif (!defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)) || \ + defined(WORDS_BIGENDIAN) # define __BYTE_ORDER 0 # define __LITTLE_ENDIAN 1 # define __BIG_ENDIAN 0 diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 12e212ef..30898d42 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -190,7 +190,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 4b114799..6d1477c2 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1,7 +1,7 @@ /* * attrib.c - Attribute handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2000-2005 Anton Altaparmakov * Copyright (c) 2002 Richard Russon * Copyright (c) 2004-2005 Yura Pakhuchiy * @@ -252,13 +252,11 @@ static __inline__ void __ntfs_attr_init(ntfs_attr *na, ntfs_inode *ni, na->rl = NULL; na->ni = ni; na->type = type; - if (name) { - na->name = name; + na->name = name; + if (name) na->name_len = name_len; - } else { - na->name = NULL; + else na->name_len = 0; - } } /** @@ -2693,8 +2691,8 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ntfs_inode_mark_dirty(ni); /* * Locate offset from start of the MFT record where new attribute is - * placed. We need relookup it, because record maybe moved during update - * of attribute list. + * placed. We need relookup it, because record maybe moved during + * update of attribute list. */ ntfs_attr_reinit_search_ctx(ctx); if (ntfs_attr_lookup(type, name, name_len, CASE_SENSITIVE, diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 89d3920e..759a427c 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -2,7 +2,7 @@ * attrlist.c - Attribute list attribute handling code. Part of the Linux-NTFS * project. * - * Copyright (c) 2004 Anton Altaparmakov + * Copyright (c) 2004-2005 Anton Altaparmakov * Copyright (c) 2004-2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or @@ -187,7 +187,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) attr->name_length * sizeof(ntfschar)); /* Resize $ATTRIBUTE_LIST to new length. */ - na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, NULL, 0); + na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, AT_UNNAMED, 0); if (!na) { err = errno; Dprintf("%s(): Failed to open $ATTRIBUTE_LIST attribute.\n", @@ -272,7 +272,7 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) } /* Reisze $ATTRIBUTE_LIST to new length. */ - na = ntfs_attr_open(base_ni, AT_ATTRIBUTE_LIST, NULL, 0); + na = ntfs_attr_open(base_ni, AT_ATTRIBUTE_LIST, AT_UNNAMED, 0); if (!na) { err = errno; Dprintf("%s(): Failed to open $ATTRIBUTE_LIST attribute.\n", diff --git a/libntfs/gnome-vfs-method.c b/libntfs/gnome-vfs-method.c index 540a6d58..66839e66 100644 --- a/libntfs/gnome-vfs-method.c +++ b/libntfs/gnome-vfs-method.c @@ -3,7 +3,7 @@ * libntfs. Part of the Linux-NTFS project. * * Copyright (c) 2003 Jan Kratochvil - * Copyright (c) 2003 Anton Altaparmakov + * Copyright (c) 2003-2005 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -393,8 +393,8 @@ static int libntfs_gnomevfs_read_directory_filldir( attr = ntfs_attr_open(inode, /* ni */ AT_DATA, /* type */ - NULL, /* name */ - 0); /* name_len */ + AT_UNNAMED, /* name */ + 0); /* name_len */ /* FIXME: Check failed 'attr' open. */ if (attr) { /* FIXME: Is 'data_size' the right field? */ @@ -488,7 +488,7 @@ static GnomeVFSResult libntfs_open_attr(struct libntfs_file *libntfs_file) libntfs_file->attr = ntfs_attr_open( libntfs_file->inode, /* ni */ AT_DATA, /* type */ - NULL, /* name */ + AT_UNNAMED, /* name */ 0); /* name_len */ G_UNLOCK(libntfs); if (!libntfs_file->attr) diff --git a/libntfs/inode.c b/libntfs/inode.c index e483dc08..3fb21bbb 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -1,7 +1,7 @@ /* * inode.c - Inode handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2002-2005 Anton Altaparmakov * Copyright (c) 2004-2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or @@ -626,7 +626,7 @@ int ntfs_inode_sync(ntfs_inode *ni) NInoAttrListTestAndClearDirty(ni)) { ntfs_attr *na; - na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, NULL, 0); + na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, AT_UNNAMED, 0); if (!na) { if (!err || errno == EIO) { err = errno; @@ -845,7 +845,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) } /* Resize it. */ - na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, NULL, 0); + na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, AT_UNNAMED, 0); if (!na) { err = errno; Dprintf("%s(): Failed to open just added $ATTRIBUTE_LIST.\n", diff --git a/libntfs/logfile.c b/libntfs/logfile.c index 93353f52..acd0880c 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -1,7 +1,7 @@ /* * logfile.c - NTFS journal handling. Part of the Linux-NTFS project. * - * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2002-2005 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or @@ -162,7 +162,8 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) */ ca_ofs = le16_to_cpu(ra->client_array_offset); if (((ca_ofs + 7) & ~7) != ca_ofs || - ra_ofs + ca_ofs > NTFS_BLOCK_SIZE - sizeof(u16)) { + ra_ofs + ca_ofs > (u16)(NTFS_BLOCK_SIZE - + sizeof(u16))) { ntfs_error(vi->i_sb, "$LogFile restart area specifies " "inconsistent client array offset."); return FALSE; @@ -174,8 +175,8 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) */ ra_len = ca_ofs + le16_to_cpu(ra->log_clients) * sizeof(LOG_CLIENT_RECORD); - if (ra_ofs + ra_len > le32_to_cpu(rp->system_page_size) || - ra_ofs + le16_to_cpu(ra->restart_area_length) > + if ((u32)(ra_ofs + ra_len) > le32_to_cpu(rp->system_page_size) || + (u32)(ra_ofs + le16_to_cpu(ra->restart_area_length)) > le32_to_cpu(rp->system_page_size) || ra_len > le16_to_cpu(ra->restart_area_length)) { ntfs_error(vi->i_sb, "$LogFile restart area is out of bounds " diff --git a/ltmain.sh b/ltmain.sh index abda7165..3d071010 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -17,7 +17,7 @@ # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,8 +43,8 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.18 -TIMESTAMP=" (1.1220.2.246 2005/05/16 10:00:18)" +VERSION=1.5.14 +TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. @@ -112,9 +112,8 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" +: ${IFS=" +"} if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -251,14 +250,37 @@ func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" + f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else - $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 - exit $EXIT_FAILURE + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ + | $EGREP -v '^[ ]*1[ ]' | while read count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? + i=`expr $i + 1` + done + done + $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" fi } @@ -735,15 +757,6 @@ if test -z "$show_help"; then esac done - qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` - case $qlibobj in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qlibobj="\"$qlibobj\"" ;; - esac - if test "X$libobj" != "X$qlibobj"; then - $echo "$modename: libobj name \`$libobj' may not contain shell special characters." - exit $EXIT_FAILURE - fi objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -816,17 +829,12 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo "$srcfile" > "$lockfile" + $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi - qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` - case $qsrcfile in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qsrcfile="\"$qsrcfile\"" ;; - esac $run $rm "$libobj" "${libobj}T" @@ -848,10 +856,10 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" + command="$base_compile $srcfile $pic_flag" else # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $srcfile" fi if test ! -d "${xdir}$objdir"; then @@ -931,9 +939,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $srcfile" else - command="$base_compile $qsrcfile $pic_flag" + command="$base_compile $srcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -1357,8 +1365,6 @@ EOF ;; darwin_framework) compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" prev= continue ;; @@ -1423,8 +1429,6 @@ EOF -framework) prev=darwin_framework compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" continue ;; @@ -2848,13 +2852,13 @@ EOF *) continue ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac done fi # link_all_deplibs != no fi # linkmode = lib @@ -3120,7 +3124,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3129,7 +3133,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3138,7 +3142,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -4365,18 +4369,8 @@ extern \"C\" { export_symbols="$output_objdir/$outputname.exp" $run $rm $export_symbols $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* ) - $run eval "${SED} -e '1iEXPORTS'"' < "$export_symbols" > "$output_objdir/$outputname.def"' - ;; - esac else $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - case $host in - *cygwin* | *mingw* ) - $run eval "${SED} -e '1iEXPORTS'"' < "$output_objdir/$outputname.exp" > "$output_objdir/$outputname.def"' - ;; - esac $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi @@ -4499,25 +4493,12 @@ static const void *lt_preloaded_setup() { $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? # Clean up the generated files. - #$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" - #$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. - case $host in - *cygwin* | *mingw* ) - if test -f "$output_objdir/${outputname}.def" ; then - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"` - else - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - fi - ;; - * ) - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - esac + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 @@ -4546,9 +4527,8 @@ static const void *lt_preloaded_setup() { # Delete the generated files. if test -n "$dlsyms"; then - #$show "$rm $output_objdir/${outputname}S.${objext}" - #$run $rm "$output_objdir/${outputname}S.${objext}" - : + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" fi exit $status @@ -4691,9 +4671,8 @@ static const void *lt_preloaded_setup() { esac case $host in *cygwin* | *mingw* ) - output_path=`dirname $output` - cwrappersource=`$echo ${output_path}/${objdir}/lt-${outputname}.c` - cwrapper=`$echo ${output_path}/${outputname}.exe` + cwrappersource=`$echo ${objdir}/lt-${outputname}.c` + cwrapper=`$echo ${output}.exe` $rm $cwrappersource $cwrapper trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 @@ -4720,7 +4699,6 @@ EOF #include #include #include -#include #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX @@ -4731,19 +4709,15 @@ EOF #endif #ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' +#define DIR_SEPARATOR '/' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif +#define HAVE_DOS_BASED_FILE_SYSTEM +#ifndef DIR_SEPARATOR_2 +#define DIR_SEPARATOR_2 '\\' +#endif #endif #ifndef DIR_SEPARATOR_2 @@ -4753,30 +4727,17 @@ EOF (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) -#if defined DEBUGWRAPPER -# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) -#else -# define DEBUG(format, ...) -#endif - const char *program_name = NULL; void * xmalloc (size_t num); char * xstrdup (const char *string); char * basename (const char *name); -char * find_executable(const char *wrapper); -int check_executable(const char *path); +char * fnqualify(const char *path); char * strendzap(char *str, const char *pat); void lt_fatal (const char *message, ...); @@ -4787,8 +4748,6 @@ main (int argc, char *argv[]) int i; program_name = (char *) xstrdup ((char *) basename (argv[0])); - DEBUG("(main) argv[0] : %s\n",argv[0]); - DEBUG("(main) program_name : %s\n",program_name); newargz = XMALLOC(char *, argc+2); EOF @@ -4797,23 +4756,13 @@ EOF EOF cat >> $cwrappersource <<"EOF" - newargz[1] = find_executable(argv[0]); - if (newargz[1] == NULL) - lt_fatal("Couldn't find %s", argv[0]); - DEBUG("(main) found exe at : %s\n",newargz[1]); + newargz[1] = fnqualify(argv[0]); /* we know the script has the same name, without the .exe */ /* so make sure newargz[1] doesn't end in .exe */ strendzap(newargz[1],".exe"); for (i = 1; i < argc; i++) newargz[i+1] = xstrdup(argv[i]); newargz[argc+1] = NULL; - - for (i=0; i> $cwrappersource <= 0) && - (((st.st_mode & S_IXOTH) == S_IXOTH) || - ((st.st_mode & S_IXGRP) == S_IXGRP) || - ((st.st_mode & S_IXUSR) == S_IXUSR))) - return 1; - else - return 0; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise */ char * -find_executable (const char* wrapper) +fnqualify(const char *path) { - int has_slash = 0; - const char* p; - const char* p_next; - struct stat st; - /* static buffer for getcwd */ + size_t size; + char *p; char tmp[LT_PATHMAX + 1]; - int tmp_len; - char* concat_name; - DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; + assert(path != NULL); - /* Absolute path? */ + /* Is it qualified already? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) -} + if (isalpha (path[0]) && path[1] == ':') + return xstrdup (path); #endif + if (IS_DIR_SEPARATOR (path[0])) + return xstrdup (path); - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char* path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char* q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR(*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen(tmp); - concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ + /* prepend the current directory */ + /* doesn't handle '~' */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal ("getcwd failed"); - tmp_len = strlen(tmp); - concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable(concat_name)) - return concat_name; - XFREE(concat_name); - return NULL; + size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ + p = XMALLOC(char, size); + sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); + return p; } char * @@ -5236,63 +5091,6 @@ fi\ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "copying selected object files to avoid basename conflicts..." - - if test -z "$gentop"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - fi - - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - counter=`expr $counter + 1` - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - $run ln "$obj" "$gentop/$newobj" || - $run cp "$obj" "$gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5306,7 +5104,20 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -6215,14 +6026,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" + exec_cmd="\"\$cmd\"$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - $echo "$cmd$args" + eval \$echo \"\$cmd\"$args exit $EXIT_SUCCESS fi ;; diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 76735283..19de7246 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -225,7 +225,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 8949e30d..4b9b995e 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -2,6 +2,7 @@ * ntfscp - Part of the Linux-NTFS project. * * Copyright (c) 2004-2005 Yura Pakhuchiy + * Copyright (c) 2005 Anton Altaparmakov * * This utility will overwrite files on ntfs volume * @@ -267,7 +268,7 @@ int main (int argc, char *argv[]) u64 offset; char *buf; s64 br, bw; - ntfschar *attr_name = NULL; + ntfschar *attr_name = AT_UNNAMED; int attr_name_len = 0; if (!parse_options(argc, argv)) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 6830eeff..88d476dd 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -3,6 +3,7 @@ * * Copyright (c) 2002-2005 Richard Russon * Copyright (c) 2004-2005 Holger Ohmacht + * Copyright (c) 2005 Anton Altaparmakov * * This utility will recover deleted files from an NTFS volume. * @@ -793,7 +794,7 @@ static void get_parent_name (struct filename* name, ntfs_volume* vol) return; } - mft_data = ntfs_attr_open(vol->mft_ni, AT_DATA, NULL, 0); + mft_data = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0); if (!mft_data) { Eprintf ("ERROR: Couldn't open $MFT/$DATA: %s\n", strerror (errno)); } else { @@ -1025,7 +1026,7 @@ static struct ufile * read_record (ntfs_volume *vol, long long record) return NULL; } - mft = ntfs_attr_open (vol->mft_ni, AT_DATA, NULL, 0); + mft = ntfs_attr_open (vol->mft_ni, AT_DATA, AT_UNNAMED, 0); if (!mft) { Eprintf ("ERROR: Couldn't open $MFT/$DATA: %s\n", strerror (errno)); free_file (file); @@ -1947,7 +1948,7 @@ static int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) return 1; } - mft = ntfs_attr_open (vol->mft_ni, AT_DATA, NULL, 0); + mft = ntfs_attr_open (vol->mft_ni, AT_DATA, AT_UNNAMED, 0); if (!mft) { Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); goto free; diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index db48be07..615ffc98 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -2,7 +2,7 @@ * utils.c - Part of the Linux-NTFS project. * * Copyright (c) 2002-2004 Richard Russon - * Copyright (c) 2003-2004 Anton Altaparmakov + * Copyright (c) 2003-2005 Anton Altaparmakov * Copyright (c) 2003 Lode Leroy * * A set of shared functions for ntfs utilities @@ -619,7 +619,7 @@ int utils_cluster_in_use (ntfs_volume *vol, long long lcn) /* Does lcn lie in the section of $Bitmap we already have cached? */ if ((lcn < bmplcn) || (lcn >= (bmplcn + (sizeof (buffer) << 3)))) { Dprintf ("Bit lies outside cache.\n"); - attr = ntfs_attr_open (vol->lcnbmp_ni, AT_DATA, NULL, 0); + attr = ntfs_attr_open (vol->lcnbmp_ni, AT_DATA, AT_UNNAMED, 0); if (!attr) { Eprintf ("Couldn't open $Bitmap: %s\n", strerror (errno)); return -1; @@ -967,7 +967,8 @@ int mft_next_record (struct mft_search_ctx *ctx) return -1; } - mft = ntfs_attr_open (ctx->vol->mft_ni, AT_DATA, NULL, 0); + mft = ntfs_attr_open (ctx->vol->mft_ni, AT_DATA, + AT_UNNAMED, 0); if (!mft) { Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); // free / close From fb7586c5ac8f4fb67b783700eccf76eab074034a Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 20 Jun 2005 14:44:45 +0000 Subject: [PATCH 2297/2994] Update todo files with usnjrnl stuff. --- TODO.include | 4 ++++ TODO.libntfs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/TODO.include b/TODO.include index d9185bc9..b9f133a9 100644 --- a/TODO.include +++ b/TODO.include @@ -2,6 +2,10 @@ Finish layout.h: in particular, add: - more about EFS and the EFS attribute. +Add usnjrnl.h: + +- describe the $UsnJrnl on disk structures + Finish logfile.h: in particular, add: - more about the $LogFile on disk structures diff --git a/TODO.libntfs b/TODO.libntfs index d64fccfc..d20a6c8a 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -19,6 +19,9 @@ - write ntfs_index_{rm_from,add_to,create,rm}() +- detect presence of usnjrnl and if present and mounting rw, re-stamp it (see + current ntfs wip driver) + ******************* * MEDIUM priority * ******************* From 31a8750c4da35624f46fd044b86aadb52e7bb82f Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 21 Jun 2005 09:55:15 +0000 Subject: [PATCH 2298/2994] Fix compiler warnings in libntfs when compiling under cygwin. --- libntfs/attrib.c | 5 +++-- libntfs/bootsect.c | 6 +++--- libntfs/compress.c | 4 ++-- libntfs/dir.c | 16 +++++++++------- libntfs/index.c | 8 ++++---- libntfs/runlist.c | 4 ++-- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 6d1477c2..20aad66b 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -4033,8 +4033,9 @@ retry: */ if (finished_build) { Dprintf("%s(): Mark attr 0x%x for delete in inode " - "0x%llx.\n", __FUNCTION__, le32_to_cpu(a->type), - ctx->ntfs_ino->mft_no); + "0x%llx.\n", __FUNCTION__, + (unsigned)le32_to_cpu(a->type), + ctx->ntfs_ino->mft_no); a->highest_vcn = cpu_to_sle64(NTFS_VCN_DELETE_MARK); ntfs_inode_mark_dirty(ctx->ntfs_ino); continue; diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index ea068899..c6a1a36f 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -1,7 +1,7 @@ /* * bootsect.c - Boot sector handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2000-2005 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -213,7 +213,7 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) * illegal, thus signed char is actually ok! */ c = bs->clusters_per_mft_record; - Dprintf("ClusterSize = 0x%x\n", vol->cluster_size); + Dprintf("ClusterSize = 0x%x\n", (unsigned)vol->cluster_size); Dprintf("ClusterSizeBits = %u\n", vol->cluster_size_bits); Dprintf("ClustersPerMftRecord = 0x%x\n", c); /* @@ -233,7 +233,7 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) return -1; } vol->mft_record_size_bits = ffs(vol->mft_record_size) - 1; - Dprintf("MftRecordSize = 0x%x\n", vol->mft_record_size); + Dprintf("MftRecordSize = 0x%x\n", (unsigned)vol->mft_record_size); Dprintf("MftRecordSizeBits = %u\n", vol->mft_record_size_bits); /* * Work out the size of the MFT mirror in number of mft records. If the diff --git a/libntfs/compress.c b/libntfs/compress.c index e0f101a4..407d4d90 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -2,7 +2,7 @@ * compress.c - Compressed attribute handling code. Part of the Linux-NTFS * project. * - * Copyright (c) 2004 Anton Altaparmakov + * Copyright (c) 2004-2005 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -84,7 +84,7 @@ static int ntfs_decompress(u8 *dest, const u32 dest_size, u8 tag; /* Current tag. */ int token; /* Loop counter for the eight tokens in tag. */ - Dprintf("Entering, cb_size = 0x%x.\n", cb_size); + Dprintf("Entering, cb_size = 0x%x.\n", (unsigned)cb_size); do_next_sb: Dprintf("Beginning sub-block at offset = 0x%x in the cb.\n", cb - cb_start); diff --git a/libntfs/dir.c b/libntfs/dir.c index 1b85dc45..50e4a212 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1,7 +1,7 @@ /* * dir.c - Directory handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2002-2005 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -111,7 +111,8 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname, index_block_size = le32_to_cpu(ir->index_block_size); if (index_block_size < NTFS_BLOCK_SIZE || index_block_size & (index_block_size - 1)) { - Dprintf("Index block size %u is invalid.\n", index_block_size); + Dprintf("Index block size %u is invalid.\n", + (unsigned)index_block_size); goto put_err_out; } index_end = (u8*)&ir->index + le32_to_cpu(ir->index.index_length); @@ -286,9 +287,9 @@ descend_into_child_node: Dprintf("Index buffer (VCN 0x%llx) of directory inode 0x%llx " "has a size (%u) differing from the directory " "specified size (%u).\n", (long long)vcn, - (unsigned long long)dir_ni->mft_no, + (unsigned long long)dir_ni->mft_no, (unsigned) le32_to_cpu(ia->index.allocated_size) + 0x18, - index_block_size); + (unsigned)index_block_size); errno = EIO; goto close_err_out; } @@ -806,7 +807,8 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, index_block_size = le32_to_cpu(ir->index_block_size); if (index_block_size < NTFS_BLOCK_SIZE || index_block_size & (index_block_size - 1)) { - Dprintf("Index block size %u is invalid.\n", index_block_size); + Dprintf("Index block size %u is invalid.\n", + (unsigned)index_block_size); goto dir_err_out; } index_block_size_bits = ffs(index_block_size) - 1; @@ -963,9 +965,9 @@ find_next_index_buffer: "has a size (%u) differing from the directory " "specified size (%u).\n", (long long)ia_start >> index_vcn_size_bits, - (unsigned long long)dir_ni->mft_no, + (unsigned long long)dir_ni->mft_no, (unsigned) le32_to_cpu(ia->index.allocated_size) + 0x18, - index_block_size); + (unsigned)index_block_size); goto dir_err_out; } index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); diff --git a/libntfs/index.c b/libntfs/index.c index ef075732..e73e7a2d 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -1,7 +1,7 @@ /* * index.c - NTFS index handling. Part of the Linux-NTFS project. * - * Copyright (c) 2004 Anton Altaparmakov + * Copyright (c) 2004-2005 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or @@ -172,7 +172,7 @@ int ntfs_index_lookup(const void *key, const int key_len, cr = ir->collation_rule; if (!ntfs_is_collation_rule_supported(cr)) { ntfs_error(sb, "Index uses unsupported collation rule 0x%x. " - "Aborting lookup.", le32_to_cpu(cr)); + "Aborting lookup.", (unsigned)le32_to_cpu(cr)); err = EOPNOTSUPP; goto err_out; } @@ -295,9 +295,9 @@ descend_into_child_node: "a size (%u) differing from the index " "specified size (%u). Inode is corrupt or " "driver bug.", (unsigned long long)vcn, - ni->mft_no, + ni->mft_no, (unsigned) le32_to_cpu(ia->index.allocated_size) + 0x18, - ictx->block_size); + (unsigned)ictx->block_size); goto err_out; } index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); diff --git a/libntfs/runlist.c b/libntfs/runlist.c index c383f8ab..488ab2b8 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1,7 +1,7 @@ /* * runlist.c - Run list handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2002-2005 Anton Altaparmakov * Copyright (c) 2002 Richard Russon * Copyright (c) 2004 Yura Pakhuchiy * @@ -721,7 +721,7 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, u8 b; /* Current byte offset in buf. */ Dprintf("%s(): Entering for attr 0x%x.\n", __FUNCTION__, - le32_to_cpu(attr->type)); + (unsigned)le32_to_cpu(attr->type)); /* Make sure attr exists and is non-resident. */ if (!attr || !attr->non_resident || sle64_to_cpu(attr->lowest_vcn) < (VCN)0) { From 39b759ee99883e0ba12cd7e9557866be9985b8c1 Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 21 Jun 2005 09:57:22 +0000 Subject: [PATCH 2299/2994] Fix compiler warnings under cygwin. --- ntfsprogs/ntfsdump_logfile.c | 6 +++--- ntfsprogs/ntfsrm.c | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 1e8cde3f..88c40227 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -1,7 +1,7 @@ /** * ntfsdump_logfile - Part of the Linux-NTFS project. * - * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2000-2005 Anton Altaparmakov * * This utility will interpret the contents of the journal ($LogFile) of an * NTFS partition and display the results on stdout. Errors will be output to @@ -387,8 +387,8 @@ static void dump_restart_areas_area(RESTART_PAGE_HEADER *rstr) le16_to_cpu(ra->log_page_data_offset), le16_to_cpu(ra->log_page_data_offset)); printf("restart_log_open_count = %u (0x%x)\n", - le32_to_cpu(ra->restart_log_open_count), - le32_to_cpu(ra->restart_log_open_count)); + (unsigned)le32_to_cpu(ra->restart_log_open_count), + (unsigned)le32_to_cpu(ra->restart_log_open_count)); lcr = (LOG_CLIENT_RECORD*)((u8*)ra + le16_to_cpu(ra->client_array_offset)); for (client = 0; client < le16_to_cpu(ra->log_clients); client++) { diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 6fe9994b..72d64b69 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -2,6 +2,7 @@ * ntfsrm - Part of the Linux-NTFS project. * * Copyright (c) 2004 Richard Russon + * Copyright (c) 2005 Anton Altaparmakov * * This utility will delete files from an NTFS volume. * @@ -4276,7 +4277,8 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) break; } printf ("%.*s", indent, space_line); - printf ("fill = %u/%u\n", block->index.index_length, block->index.allocated_size); + printf ("fill = %u/%u\n", (unsigned)block->index.index_length, + (unsigned)block->index.allocated_size); return 0; } From e5a90b161bc4713442ef5c9c5aca0a747bb1fa70 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 21 Jun 2005 13:06:53 +0000 Subject: [PATCH 2300/2994] ntfscp: Fix signal handling. --- ntfsprogs/ntfscp.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 4b9b995e..bc37a116 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -54,7 +54,7 @@ struct options { static const char *EXEC_NAME = "ntfscp"; static struct options opts; -static int caught_sigint = 0; +static int caught_terminate = 0; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) @@ -235,17 +235,18 @@ static int parse_options (int argc, char **argv) } /** - * sigint_handler - Handle SIGINT: abort write, sync and exit. + * signal_handler - Handle SIGINT and SIGTERM: abort write, sync and exit. */ -static void sigint_handler(int arg __attribute__((unused))) +static void signal_handler(int arg) { - caught_sigint++; - if (caught_sigint > 3) { - Eprintf("SIGTERM received more than 3 times. " + caught_terminate++; + if (caught_terminate > 3) { + Eprintf("SIGTERM or SIGINT received more than 3 times. " "Exit immediately.\n"); exit(2); } else - Eprintf("SIGTERM received. Aborting write.\n"); + Eprintf("%s received. Aborting write.\n", + (arg == SIGINT) ? "SIGINT" : "SIGTERM"); } /** @@ -277,10 +278,15 @@ int main (int argc, char *argv[]) utils_set_locale(); /* Set SIGINT handler. */ - if (signal(SIGINT, sigint_handler) == SIG_ERR) { + if (signal(SIGINT, signal_handler) == SIG_ERR) { perror("Failed to set SIGINT handler"); return 1; } + /* Set SIGTERM handler. */ + if (signal(SIGTERM, signal_handler) == SIG_ERR) { + perror("Failed to set SIGTERM handler"); + return 1; + } if (opts.noaction) flags = MS_RDONLY; @@ -401,7 +407,7 @@ int main (int argc, char *argv[]) Vprintf("Starting write.\n"); offset = 0; - while (!feof(in) && !caught_sigint) { + while (!feof(in) && !caught_terminate) { br = fread(buf, 1, NTFS_BUF_SIZE, in); if (!br) { if (!feof(in)) perror("ERROR: fread failed"); From 31c31a244d3adbb70fa96af06a7acc071d50a3b2 Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 23 Jun 2005 18:55:03 +0000 Subject: [PATCH 2301/2994] ntfsrm: fix a couple of crashes slightly simplify bitmap logic wasn't using mst pwrite for INDX rm works again bmp commit was overwriting end of attr strip down bitmap set bitmaps: handle cluster boundaries correctly overhaul the bitmap code ntfs_binary_print --- ntfsprogs/ntfsrm.c | 194 ++++++++++++++++++++++----------------------- 1 file changed, 94 insertions(+), 100 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 72d64b69..05a024e8 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1,8 +1,7 @@ /** * ntfsrm - Part of the Linux-NTFS project. * - * Copyright (c) 2004 Richard Russon - * Copyright (c) 2005 Anton Altaparmakov + * Copyright (c) 2004-2005 Richard Russon * * This utility will delete files from an NTFS volume. * @@ -22,7 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include #include #include @@ -44,7 +42,7 @@ GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) -//#define RM_WRITE 1 +#define RM_WRITE 1 static int ntfs_inode_close2 (ntfs_inode *ni); @@ -251,6 +249,29 @@ static void ntfs_dt_print (struct ntfs_dt *dt, int indent) } } +/** + * ntfs_binary_print + */ +static void ntfs_binary_print (u8 num, BOOL backwards, BOOL colour) +{ + int i; + + if (backwards) + for (i = 1; i < 129; i<<=1) { + if (colour) + printf ("%s", (num&i) ? "1" : "0"); + else + printf ("%s", (num&i) ? "1" : "0"); + } + else + for (i = 128; i > 0; i>>=1) { + if (colour) + printf ("%s", (num&i) ? "1" : "0"); + else + printf ("%s", (num&i) ? "1" : "0"); + } +} + /** * ntfsinfo_time_to_str */ @@ -271,6 +292,7 @@ static int ntfs_bmp_commit (struct ntfs_bmp *bmp) { int i; u32 cs; + u32 ws; // write size if (!bmp) return 0; @@ -283,24 +305,27 @@ static int ntfs_bmp_commit (struct ntfs_bmp *bmp) cs = bmp->vol->cluster_size; - printf ("commit bmp 0x%02X (%sresident)\n", bmp->attr->type, bmp->attr->rl ? "non-" : ""); + printf ("commit bmp inode %lld, 0x%02X (%sresident)\n", bmp->attr->ni->mft_no, bmp->attr->type, NAttrNonResident (bmp->attr) ? "non-" : ""); - if (bmp->attr->rl) { + if (NAttrNonResident (bmp->attr)) { // non-resident for (i = 0; i < bmp->count; i++) { #ifdef RM_WRITE - ntfs_attr_pwrite (bmp->attr, bmp->data_vcn[i] * cs, cs, bmp->data[i]); // XXX retval -#else - printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, bmp->data_vcn[i]); + if (((bmp->data_vcn[i]+1) * cs) < bmp->attr->data_size) + ws = cs; + else + ws = bmp->attr->data_size & (cs - 1); + //printf ("writing %d bytes\n", ws); + ntfs_attr_pwrite (bmp->attr, bmp->data_vcn[i] * cs, ws, bmp->data[i]); // XXX retval #endif + printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, bmp->data_vcn[i]); } } else { // resident #ifdef RM_WRITE ntfs_attr_pwrite (bmp->attr, bmp->data_vcn[0], bmp->attr->data_size, bmp->data[0]); // XXX retval -#else - printf (RED "\tntfs_attr_pwrite resident\n" END); #endif + printf (RED "\tntfs_attr_pwrite resident (%lld)\n" END, bmp->attr->data_size); } for (i = 0; i < bmp->count; i++) @@ -452,7 +477,8 @@ static u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn) return NULL; //printf ("loading from bitmap cluster %lld\n", vcn); - if (ntfs_attr_pread (bmp->attr, vcn, cs, buffer) < 0) { + //printf ("loading from bitmap byte %lld\n", vcn<attr, vcn<vol->cluster_size; - cb = bmp->vol->cluster_size_bits; + if (value) + value = 0xFF; - //printf ("\n"); - //printf ("set range: %lld - %lld (%d)\n", vcn, vcn+length-1, cs<<3); + clust_size = bmp->vol->cluster_size; - a = ROUND_DOWN (vcn, cs<<3); - b = ROUND_UP (vcn + length -1, cs<<3); - //printf ("vcn = %lld\n", vcn); - //printf ("a = %lld\n", a >> (cb+3)); - //printf ("b = %lld\n", b >> (cb+3)); - //printf ("count = %lld\n", (b-a)/(cs<<3)); + vcn_start = vcn; + vcn_finish = vcn + length - 1; - for (i = a; i < b; i += (cs<<3)) { - buffer = ntfs_bmp_get_data (bmp, i); + for (i = vcn_start; i < ROUND_UP (vcn_finish, clust_size<<3); i += (clust_size<<3)) { + buffer = ntfs_bmp_get_data (bmp, ROUND_DOWN (i, clust_size<<3)); if (!buffer) return -1; -#if 0 - memset (buffer, 0xFF, cs); - value = 0; - memset (buffer, 0x00, cs); - value = 1; -#endif - //utils_dump_mem (buffer, 0, 32, DM_DEFAULTS); - //printf ("\n"); + block_start = ROUND_DOWN (i, clust_size<<3); + block_finish = block_start + (clust_size<<3) - 1; - begin = i; - end = begin + (cs<<3) - 1; - //printf ("begin = %lld, vcn = %lld,%lld end = %lld\n", begin, vcn, vcn+length-1, end); + mask_start = (0xFF << (vcn_start & 7)); + mask_finish = (0xFF >> (7 - (vcn_finish & 7))); - if ((vcn > begin) && (vcn < end)) { - start = ((vcn+8) >> 3) & (cs-1); - sta_part = 0xff << (vcn&7); + if ((vcn_start >= block_start) && (vcn_start <= block_finish)) { + byte_start = (vcn_start - block_start) >> 3; } else { - start = 0; + byte_start = 0; + mask_start = 0xFF; } - if (((vcn+length-1) >= begin) && ((vcn+length-1) <= end)) { - finish = ((vcn+length-1) >> 3) & (cs-1); - fin_part = 0xff >> (7-((vcn+length-1)&7)); + if ((vcn_finish >= block_start) && (vcn_finish <= block_finish)) { + byte_finish = (vcn_finish - block_start) >> 3; } else { - finish = cs-1; + byte_finish = clust_size - 1; + mask_finish = 0xFF; } -#if 0 - //printf ("\n"); - printf ("%lld) ", i>>12); - if (start > 0) { - printf ("(%02x) ", sta_part); - } else { - printf (" "); + if ((byte_finish - byte_start) > 1) { + memset (buffer+byte_start+1, value, byte_finish-byte_start-1); + } else if (byte_finish == byte_start) { + mask_start &= mask_finish; + mask_finish = value; } - printf ("%d - %d", start, finish); - - if (finish < (cs-1)) { - printf (" (%02x)\n", fin_part); - } else { - printf (" \n"); - } -#endif if (value) { - if (start != 0) - buffer[start-1] |= sta_part; - if ((finish - start) > 0) - memset (buffer+start, 0xff, finish-start); - buffer[finish] |= fin_part; + buffer[byte_start] |= mask_start; + buffer[byte_finish] |= mask_finish; } else { - if (start != 0) - buffer[start-1] &= ~sta_part; - if ((finish - start) > 0) - memset (buffer+start, 0x00, finish-start); - buffer[finish] &= ~fin_part; + buffer[byte_start] &= (~mask_start); + buffer[byte_finish] &= (~mask_finish); } - //utils_dump_mem (buffer, 0, 16, DM_DEFAULTS); } printf (GREEN "Modified: inode %lld, ", bmp->attr->ni->mft_no); @@ -910,7 +904,7 @@ static BOOL ntfs_dt_alloc_children2 (struct ntfs_dt *dt, int count) dt->children = realloc (dt->children, new * sizeof (*dt->children)); dt->sub_nodes = realloc (dt->sub_nodes, new * sizeof (*dt->sub_nodes)); - dt->inodes = realloc (dt->sub_nodes, new * sizeof (*dt->inodes)); + dt->inodes = realloc (dt->inodes, new * sizeof (*dt->inodes)); // XXX wipe new space @@ -1075,10 +1069,10 @@ static int ntfs_dt_commit (struct ntfs_dt *dt) } #ifdef RM_WRITE - ntfs_attr_pwrite (attr, dt->vcn * dt->dir->index_size, dt->dir->index_size, dt->data); -#else - printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, dt->vcn); + //utils_dump_mem (dt->data, 0, 16, DM_DEFAULTS); + ntfs_attr_mst_pwrite(attr, dt->vcn * dt->dir->index_size, 1, dt->dir->index_size, dt->data); // XXX retval #endif + printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, dt->vcn); dt->changed = FALSE; } @@ -1087,9 +1081,8 @@ static int ntfs_dt_commit (struct ntfs_dt *dt) if ((dt->inodes[i]) && (NInoDirty (dt->inodes[i]))) { #ifdef RM_WRITE ntfs_inode_sync (dt->inodes[i]); -#else - printf (RED "\tntfs_inode_sync %llu\n" END, dt->inodes[i]->mft_no); #endif + printf (RED "\tntfs_inode_sync %llu\n" END, dt->inodes[i]->mft_no); } if (ntfs_dt_commit (dt->sub_nodes[i]) < 0) @@ -1200,6 +1193,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par //printf ("%lld\n", ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data)); ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data); //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); + //printf ("\n"); ntfs_dt_count_root (dt); @@ -1914,9 +1908,8 @@ static int ntfs_dir_commit (struct ntfs_dir *dir) if (NInoDirty (dir->inode)) { #ifdef RM_WRITE ntfs_inode_sync (dir->inode); -#else - printf (RED "\tntfs_inode_sync %llu\n" END, dir->inode->mft_no); #endif + printf (RED "\tntfs_inode_sync %llu\n" END, dir->inode->mft_no); } if (ntfs_dt_commit (dir->index) < 0) @@ -4277,8 +4270,7 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) break; } printf ("%.*s", indent, space_line); - printf ("fill = %u/%u\n", (unsigned)block->index.index_length, - (unsigned)block->index.allocated_size); + printf ("fill = %u/%u\n", (unsigned)block->index.index_length, (unsigned)block->index.allocated_size); return 0; } @@ -4543,7 +4535,8 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) //utils_dump_mem (par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); - file = &par->children[par_num]->key.file_name; printf ("\tpar name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + if (par) + file = &par->children[par_num]->key.file_name; printf ("\tpar name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); if (par == NULL) { // unhook everything @@ -4710,19 +4703,18 @@ static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) ino = dt->inodes[dt_num]; dir = dt->dir; - bmp_mft = (struct ntfs_bmp *) vol->private_bmp1; - bmp_vol = (struct ntfs_bmp *) vol->private_bmp2; + bmp_mft = vol->private_bmp1; + bmp_vol = vol->private_bmp2; - utils_mftrec_mark_free5 (ino, bmp_mft, ie->indexed_file); + if (1) utils_mftrec_mark_free5 (ino, bmp_mft, ie->indexed_file); - utils_free_non_residents2 (ino, bmp_vol); + if (1) utils_free_non_residents2 (ino, bmp_vol); - ntfs_file_remove (vol, dt, dt_num); + if (1) ntfs_file_remove (vol, dt, dt_num); // remove name from index - ntfs_dir_truncate (vol, dir); + if (0) ntfs_dir_truncate (vol, dir); - //commit volume - utils_volume_commit (vol); + if (1) utils_volume_commit (vol); if (0) utils_volume_rollback (vol); @@ -4816,8 +4808,10 @@ int main (int argc, char *argv[]) if (0) result = ntfs_test_bmp (vol, inode); done: - ntfs_inode_close2 (inode); - ntfs_umount2 (vol, FALSE); + if (1) ntfs_inode_close2 (inode); + if (1) ntfs_umount2 (vol, FALSE); + + if (0) ntfs_binary_print (0, FALSE, FALSE); return result; } From d8dd64d425a9f9a67c7b9cbb651ca7c8e709d6fc Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 25 Jun 2005 13:15:12 +0000 Subject: [PATCH 2302/2994] Correct ntfs_inode_sync_file_name comment typos --- libntfs/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 3fb21bbb..c9e02760 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -459,10 +459,10 @@ static int ntfs_inode_sync_standard_information(ntfs_inode *ni) } /** - * ntfs_inode_sync_standard_information - update FILE_NAME attribute's - * @ni: ntfs inode to update FILE_NAME attribute's + * ntfs_inode_sync_file_name - update FILE_NAME attributes + * @ni: ntfs inode to update FILE_NAME attributes * - * Update all FILE_NAME attribute's for inode @ni in the index. + * Update all FILE_NAME attributes for inode @ni in the index. * * Return 0 on success or -1 on error with errno set to the error code. */ From 1dce9cf4eade59b9602a5f6e12fa5d91500b8e85 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 25 Jun 2005 16:37:50 +0000 Subject: [PATCH 2303/2994] NTFSCP: don't use printf inside signal handler. --- ntfsprogs/ntfscp.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index bc37a116..76dd9f6a 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -54,7 +54,7 @@ struct options { static const char *EXEC_NAME = "ntfscp"; static struct options opts; -static int caught_terminate = 0; +volatile sig_atomic_t caught_terminate = 0; GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) @@ -237,16 +237,9 @@ static int parse_options (int argc, char **argv) /** * signal_handler - Handle SIGINT and SIGTERM: abort write, sync and exit. */ -static void signal_handler(int arg) +static void signal_handler(int arg __attribute__((unused))) { caught_terminate++; - if (caught_terminate > 3) { - Eprintf("SIGTERM or SIGINT received more than 3 times. " - "Exit immediately.\n"); - exit(2); - } else - Eprintf("%s received. Aborting write.\n", - (arg == SIGINT) ? "SIGINT" : "SIGTERM"); } /** @@ -407,7 +400,11 @@ int main (int argc, char *argv[]) Vprintf("Starting write.\n"); offset = 0; - while (!feof(in) && !caught_terminate) { + while (!feof(in)) { + if (caught_terminate) { + printf("SIGTERM or SIGINT received. Aborting write.\n"); + break; + } br = fread(buf, 1, NTFS_BUF_SIZE, in); if (!br) { if (!feof(in)) perror("ERROR: fread failed"); From 2afa525533364d2c7fd0bed6f1048b24724597a1 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 26 Jun 2005 20:09:26 +0000 Subject: [PATCH 2304/2994] Added ntfscp Updated ntfsfix and ntfsclone Added Yuval Fledel and Yura Pakhuchiy to the list of authors --- ntfsprogs/ntfsprogs.8.in | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index a70b0ea4..033a4c5e 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -1,8 +1,9 @@ .\" Copyright (c) 2002 Richard Russon. All Rights Reserved. .\" Copyright (c) 2002-2003 Anton Altaparmakov. All Rights Reserved. +.\" Copyright (c) 2005 Szabolcs Szakacsits. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSPROGS 8 "August 2003" "ntfsprogs version @VERSION@" +.TH NTFSPROGS 8 "June 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsprogs \- several tools for doing neat things with NTFS partitions .SH OVERVIEW @@ -23,16 +24,20 @@ available for free and come with full source code. .SS ntfsclone .PP .BR ntfsclone (8) -: Efficiently create/restore an image of an NTFS partition. +: Efficiently clone, create, restore or rescue an image of an NTFS partition. .SS ntfscluster .PP .BR ntfscluster (8) : Locate the owner of any given sector or cluster on an NTFS partition. +.SS ntfscp +.PP +.BR ntfscp (8) +: Overwrite file on an NTFS partition. .SS ntfsfix .PP .BR ntfsfix (8) -: Clear the LogFile of a partition to make Windows perform a thorough -check next time it boots. +: Check and fix some common errors, clear the LogFile and make Windows +perform a thorough check next time it boots. .SS ntfsinfo .PP .BR ntfsinfo (8) @@ -57,7 +62,7 @@ or directories within it. .SH AUTHORS .PP -The tools have been written by Anton Altaparmakov, Richard Russon, Matthew Fanto, Szabolcs Szakacsits, and Lode Leroy. +The tools have been written by Anton Altaparmakov, Richard Russon, Matthew Fanto, Szabolcs Szakacsits, Lode Leroy, Yuval Fledel and Yura Pakhuchiy. .SH AVAILABILITY The From f8dad91b819a040f2fbc43e295318dc8da17131a Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 26 Jun 2005 20:11:03 +0000 Subject: [PATCH 2305/2994] Added ntfsclone's rescue capability --- ntfsprogs/ntfsclone.8.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index cff0c187..12ef101f 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -7,7 +7,7 @@ .\" .TH NTFSCLONE 8 "Jun 2005" "ntfsprogs version @VERSION@" .SH NAME -ntfsclone \- Efficiently clone, image or restore an NTFS filesystem +ntfsclone \- Efficiently clone, image, restore or rescue an NTFS .SH SYNOPSIS .B ntfsclone [\fIOPTIONS\fR] @@ -26,8 +26,8 @@ ntfsclone \- Efficiently clone, image or restore an NTFS filesystem .I SOURCE .SH DESCRIPTION .B ntfsclone -will efficiently clone (copy, save, backup, restore) an NTFS filesystem to a -sparse file, image, device (partition) or standard output. +will efficiently clone (copy, save, backup, restore) or rescue an NTFS +filesystem to a sparse file, image, device (partition) or standard output. It works at disk sector level and copies only the used data. Unused disk space becomes zero (cloning to sparse file), encoded with control codes (saving in special image format), From 666619ff85849b1f9e249edba21da4220046d92e Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 26 Jun 2005 20:43:21 +0000 Subject: [PATCH 2306/2994] Trying to better guide lost people to the solutions of the non-ntfs related partition table corruptions --- ntfsprogs/ntfsresize.8.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index dcd1aebe..b2174920 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -199,7 +199,8 @@ was involved in some way. This problem was often attributed to ntfsresize but in fact it's completely independent of NTFS thus ntfsresize. Moreover ntfsresize never touches the partition table at all. By changing the 'Disk Access Mode' to LBA in the BIOS makes booting work -again, most of the time. +again, most of the time. You can find more information about this issue +in the Troubleshooting section of the below referred Ntfsresize FAQ. .SH AUTHOR .B Ntfsresize has been written by @@ -223,7 +224,6 @@ http://linux-ntfs.sourceforge.net/ as source and precompiled binary. .B Ntfsresize related news, example of usage, troubleshooting, statically linked binary and FAQ (frequently asked questions) is maintained at -.br http://mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html .SH SEE ALSO .BR fdisk (8), From 70530ad551620100480c8cdef2654790fc524a02 Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 27 Jun 2005 20:30:09 +0000 Subject: [PATCH 2307/2994] ntfs_inode_close(): ElectricFence is unhappy with realloc(x,0) as free(x) thus we distinguish these two cases --- libntfs/inode.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index c9e02760..cbab29fe 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -249,13 +249,19 @@ int ntfs_inode_close(ntfs_inode *ni) memmove(tmp_nis + i, tmp_nis + i + 1, (base_ni->nr_extents - i - 1) * sizeof(ntfs_inode *)); - base_ni->nr_extents--; - /* Resize the memory buffer. */ - tmp_nis = realloc(tmp_nis, base_ni->nr_extents * - sizeof(ntfs_inode *)); - /* Ignore realloc errors, they don't really matter. */ - if (tmp_nis) - base_ni->extent_nis = tmp_nis; + /* + * ElectricFence is unhappy with realloc(x,0) as free(x) + * thus we explicitely separate these two cases. + */ + if (--base_ni->nr_extents) { + /* Resize the memory buffer. */ + tmp_nis = realloc(tmp_nis, base_ni->nr_extents * + sizeof(ntfs_inode *)); + /* Ignore errors, they don't really matter. */ + if (tmp_nis) + base_ni->extent_nis = tmp_nis; + } else if(tmp_nis) + free(tmp_nis); /* Allow for error checking. */ i = -1; break; From 60d0ed80a541f07b6162ebe0ce3996404a5cedb8 Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 27 Jun 2005 21:03:06 +0000 Subject: [PATCH 2308/2994] Detect and hint users if the destination fs doesn't support sparse files --- ntfsprogs/ntfsclone.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index b8b34223..60de9f23 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1217,15 +1217,20 @@ static void fsync_clone(int fd) static void set_filesize(s64 filesize) { + long fs_type = 0; /* Unknown filesystem type */ + if (fstatfs(fd_out, &opt.stfs) == -1) Printf("WARNING: Couldn't get filesystem type: " "%s\n", strerror(errno)); - else if (opt.stfs.f_type == 0x52654973) + else + fs_type = opt.stfs.f_type; + + if (fs_type == 0x52654973) Printf("WARNING: You're using ReiserFS, it has very poor " "performance creating\nlarge sparse files. The next " "operation might take a very long time!\n" "Creating sparse output file ...\n"); - else if (opt.stfs.f_type == 0x517b) + else if (fs_type == 0x517b) Printf("WARNING: You're using SMBFS and if the remote share " "isn't Samba but a Windows\ncomputer then the clone " "operation will be very inefficient and may fail!\n"); @@ -1233,15 +1238,24 @@ static void set_filesize(s64 filesize) if (ftruncate(fd_out, filesize) == -1) { int err = errno; perr_printf("ftruncate failed for file '%s'", opt.output); + if (fs_type) + Printf("Destination filesystem type is 0x%lx.\n", + (unsigned long)fs_type); if (err == E2BIG) { Printf("Your system or the destination filesystem " "doesn't support large files.\n"); - if (opt.stfs.f_type == 0x517b) { + if (fs_type == 0x517b) { Printf("SMBFS needs minimum Linux kernel " "version 2.4.25 and\n the 'lfs' option" "\nfor smbmount to have large " "file support.\n"); } + } else if (err == EPERM) { + Printf("Apparently the destination filesystem doesn't " + "support sparse files.\nYou can overcome this " + "by using the more efficient --save-image " + "option\nof ntfsclone. Use the --restore-image " + "option to restore the image.\n"); } exit(1); } From 307c9b43e208cafb3612c414c7dbb7d5caa32d3b Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 27 Jun 2005 21:18:40 +0000 Subject: [PATCH 2309/2994] ntfsresize: show device name -- useful for bug reports --- ntfsprogs/ntfsresize.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 8272319e..336012d0 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2087,6 +2087,7 @@ static ntfs_volume *mount_volume(void) err_exit("Cluster size %u is too large!\n", (unsigned int)vol->cluster_size); + printf("Device name : %s\n", opt.volume); printf("NTFS volume version: %d.%d\n", vol->major_ver, vol->minor_ver); if (ntfs_version_is_supported(vol)) perr_exit("Unknown NTFS version"); From 5e6227da65e324aa7387d3e942a3bdf6e3779c38 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 28 Jun 2005 20:53:13 +0000 Subject: [PATCH 2310/2994] Version is 1.10.1-WIP. Feel free to ./autogen.sh --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 359bd510..901c863b 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.10.0],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.10.1-WIP],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) From fa2e20b14bb8d680787b79b613e134058e470260 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 28 Jun 2005 21:09:35 +0000 Subject: [PATCH 2311/2994] ntfsclone man: examples use gzip instead of bzip2; some clarifications --- ntfsprogs/ntfsclone.8.in | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 12ef101f..0dfe30da 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -211,26 +211,25 @@ The exit code is 0 on success, non-zero otherwise. Save an NTFS to a file in the special image format .RS .sp -.B ntfsclone \-\-save\-image \-\-output ntfs-backup.img /dev/hda1 +.B ntfsclone \-\-save\-image \-\-output backup.img /dev/hda1 .sp .RE Restore an NTFS from a special image file to its original partition .RS .sp -.B ntfsclone \-\-restore-image \-\-overwrite /dev/hda1 ntfs-backup.img +.B ntfsclone \-\-restore-image \-\-overwrite /dev/hda1 backup.img .sp .RE -Save an NTFS into a compressed image. Note, gzip is faster usually -at least 2-4 times than bzip2 but it creates also bigger compressed files. +Save an NTFS into a compressed image. .RS .sp -.B ntfsclone \-\-save-image \-o \- /dev/hda1 | bzip2 \-c > ntfs.img.bz2 +.B ntfsclone \-\-save-image \-o \- /dev/hda1 | gzip \-c > backup.img.gz .sp .RE Restore an NTFS volume from a compressed image file .RS .sp -.B bunzip2 \-c ntfs.img.bz2 | \\\\ +.B gunzip \-c backup.img.gz | \\\\ .br .B ntfsclone \-\-restore-image \-\-overwrite /dev/hda1 \- .sp @@ -240,13 +239,13 @@ Backup an NTFS volume to a remote host, using ssh. .sp .B ntfsclone \-\-save-image \-\-output \- /dev/hda1 | \\\\ .br -.B gzip \-c | ssh host 'cat > ntfs.img.gz' +.B gzip \-c | ssh host 'cat > backup.img.gz' .sp .RE Restore an NTFS volume from a remote host via ssh. .RS .sp -.B ssh host 'cat ntfs.img.gz' | gunzip -c | \\\\ +.B ssh host 'cat backup.img.gz' | gunzip -c | \\\\ .br .B ntfsclone \-\-restore-image \-\-overwrite /dev/hda1 \- .sp @@ -254,7 +253,7 @@ Restore an NTFS volume from a remote host via ssh. Stream an image from a web server and restore it to a partition .RS .sp -.B wget \-qO \- http://server/ntfs.img | \\\\ +.B wget \-qO \- http://server/backup.img | \\\\ .br .B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \- .sp From 3f7c609ab24e407c7fe384f61edcea173ad8d3e2 Mon Sep 17 00:00:00 2001 From: szaka Date: Thu, 30 Jun 2005 21:13:34 +0000 Subject: [PATCH 2312/2994] truncate_bitmap_data_attr(): no need to distinguish shrinkage & enlargement --- ntfsprogs/ntfsresize.c | 66 ++++-------------------------------------- 1 file changed, 6 insertions(+), 60 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 336012d0..5ff9ddc9 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1726,60 +1726,12 @@ static void truncate_badclust_bad_attr(ntfs_resize_t *resize) } /** - * shrink_bitmap_data_attr + * realloc_bitmap_data_attr * - * Shrink the metadata file $Bitmap. It must be large enough for one bit per - * cluster of the shrunken volume. Also it must be a of 8 bytes in size. + * Reallocate the metadata file $Bitmap. It must be large enough for one bit + * per cluster of the shrunken volume. Also it must be a of 8 bytes in size. */ -static void shrink_bitmap_data_attr(struct bitmap *bm, - runlist **rlist, - s64 nr_bm_clusters, - s64 new_size) -{ - runlist *rl = *rlist; - int i, j; - s64 k; - int trunc_at = -1; /* FIXME: -1 means unset */ - - /* Unallocate truncated clusters in $Bitmap */ - for (i = 0; rl[i].length; i++) { - if (rl[i].vcn + rl[i].length <= nr_bm_clusters) - continue; - if (trunc_at == -1) - trunc_at = i; - if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) - continue; - for (j = 0; j < rl[i].length; j++) { - if (rl[i].vcn + j < nr_bm_clusters) - continue; - - k = rl[i].lcn + j; - if (k < new_size) { - ntfs_bit_set(bm->bm, k, 0); - Dprintf("Unallocate cluster: " - "%lld (%llx)\n", k, k); - } - } - } - - if (trunc_at != -1) { - /* NOTE: 'i' always > 0 */ - i = nr_bm_clusters - rl[trunc_at].vcn; - rl[trunc_at].length = i; - rl_set(rl + trunc_at + 1, nr_bm_clusters, -1LL, 0LL); - - Dprintf("Runlist truncated at index %d, " - "new cluster length %d\n", trunc_at, i); - } -} - -/** - * enlarge_bitmap_data_attr - * - * Enlarge the metadata file $Bitmap. It must be large enough for one bit per - * cluster of the shrunken volume. Also it must be a of 8 bytes in size. - */ -static void enlarge_bitmap_data_attr(ntfs_volume *vol, +static void realloc_bitmap_data_attr(ntfs_volume *vol, struct bitmap *bm, runlist **rl, s64 nr_bm_clusters, @@ -1828,14 +1780,8 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) perr_exit("ntfs_mapping_pairs_decompress"); - /* NOTE: shrink could use enlarge_bitmap_data_attr() also. Advantages: - less code, better code coverage. "Drawback": could be relocated */ - if (resize->shrink) - shrink_bitmap_data_attr(&resize->lcn_bitmap, &rl, - nr_bm_clusters, nr_clusters); - else - enlarge_bitmap_data_attr(vol, &resize->lcn_bitmap, &rl, - nr_bm_clusters, nr_clusters); + realloc_bitmap_data_attr(vol, &resize->lcn_bitmap, &rl, nr_bm_clusters, + nr_clusters); a->highest_vcn = cpu_to_le64(nr_bm_clusters - 1LL); a->allocated_size = cpu_to_le64(nr_bm_clusters * vol->cluster_size); From fbe45ebac67763f83718114a33faedba0b59c537 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 2 Jul 2005 13:47:29 +0000 Subject: [PATCH 2313/2994] Fix valgrind varning about writing unitialized buffer. --- libntfs/attrlist.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 759a427c..5833a009 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -172,6 +172,8 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) entry_offset = ((u8 *)ale - ni->attr_list); /* Set pointer to new entry. */ ale = (ATTR_LIST_ENTRY *)(new_al + entry_offset); + /* Zero it to fix valgrid warning. */ + memset(ale, 0, entry_len); /* Form new entry. */ ale->type = attr->type; ale->length = cpu_to_le16(entry_len); From b8e1188102f35fcd75d76f5c2ff707269787d95c Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 2 Jul 2005 13:58:02 +0000 Subject: [PATCH 2314/2994] Fix memory managament error in ntfs_inode_close. ntfs_extent_inode_open allocates buffer for up to 4 extent inodes, to prevent many reallocates. But ntfs_inode_close always reallocate buffer to store exactly @nr_extents inodes. Bug will arise in following scenario: 1) ntfs_extent_inode_open (1 extent, allocate buffer for 4) 2) ntfs_extent_inode_open (2 extents, use already allocated buffer) 3) ntfs_inode_close(extent_ni) (1 extent, reallocate buffer for 1 extent) 4) ntfs_extent_inode_open (2 extents, don't reallocate buffer because it should be for 4 elements, but really it's for 1, write to unitialized space, segfault) --- ChangeLog | 4 ++++ libntfs/inode.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f96d5546..e085112c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +xx/xx/xxxx - 1.10.1-WIP + + - Fix memory managament error in ntfs_inode_close. (Yura) + 20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. - Add start_vcn parameter to ntfs_get_size_for_mapping_pairs() and diff --git a/libntfs/inode.c b/libntfs/inode.c index cbab29fe..cc0ead1b 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -255,7 +255,8 @@ int ntfs_inode_close(ntfs_inode *ni) */ if (--base_ni->nr_extents) { /* Resize the memory buffer. */ - tmp_nis = realloc(tmp_nis, base_ni->nr_extents * + tmp_nis = realloc(tmp_nis, ((base_ni-> + nr_extents + 3) & ~3) * sizeof(ntfs_inode *)); /* Ignore errors, they don't really matter. */ if (tmp_nis) From 9deb743974d6fdb0f8ef292e5e81d898e78cef53 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 2 Jul 2005 17:48:59 +0000 Subject: [PATCH 2315/2994] Optimize a bit previous ntfs_inode_close fix. --- libntfs/inode.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index cc0ead1b..7ba92da5 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -249,14 +249,18 @@ int ntfs_inode_close(ntfs_inode *ni) memmove(tmp_nis + i, tmp_nis + i + 1, (base_ni->nr_extents - i - 1) * sizeof(ntfs_inode *)); + /* Buffer should be for multiple of four extents. */ + if ((--base_ni->nr_extents) & 3) { + i = -1; + break; + } /* * ElectricFence is unhappy with realloc(x,0) as free(x) * thus we explicitely separate these two cases. */ - if (--base_ni->nr_extents) { + if (base_ni->nr_extents) { /* Resize the memory buffer. */ - tmp_nis = realloc(tmp_nis, ((base_ni-> - nr_extents + 3) & ~3) * + tmp_nis = realloc(tmp_nis, base_ni->nr_extents * sizeof(ntfs_inode *)); /* Ignore errors, they don't really matter. */ if (tmp_nis) From 67731b14c8c88b4c7bc8266defddb6759ea2e9ae Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 2 Jul 2005 18:30:46 +0000 Subject: [PATCH 2316/2994] Update changelog for changes that were lost after 1.10.0 release. --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index e085112c..4315aa71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ xx/xx/xxxx - 1.10.1-WIP + - ntfscp: fix signal hanling: handle both SIGTERM and SIGINT, print + correct message. (Yura) + - Update manual pages for ntfsprogs, ntfsclone, ntfsresize. (Szaka) + - Detect and hint users if the destination fs doesn't support + sparse files. (Szaka) - Fix memory managament error in ntfs_inode_close. (Yura) 20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. From 3adc04030590b61e935727d66a886d28dac1745b Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 2 Jul 2005 19:16:18 +0000 Subject: [PATCH 2317/2994] Add change protype of ntfs_attr_pwrite: make @b const. --- include/ntfs/attrib.h | 2 +- libntfs/attrib.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index d11b1217..57980249 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -267,7 +267,7 @@ extern void ntfs_attr_close(ntfs_attr *na); extern s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b); extern s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, - void *b); + const void *b); extern s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, const u32 bk_size, void *dst); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 20aad66b..75867e35 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -878,7 +878,7 @@ rl_err_out: * appropriately to the return code of ntfs_pwrite(), or to EINVAL in case of * invalid arguments. */ -s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) +s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) { s64 written, to_write, ofs, total, old_initialized_size, old_data_size; ntfs_volume *vol; @@ -1073,7 +1073,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) written = to_write / sizeof(unsigned long); eo = 0; for (t = 0; t < written; t++) { - if (((unsigned long*)b)[t]) { + if (((const unsigned long*)b)[t]) { eo = 1; break; } @@ -1081,9 +1081,9 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) cnt = to_write & (sizeof(unsigned long) - 1); if (cnt && !eo) { int i; - u8 *b2; + const u8 *b2; - b2 = (u8*)b + (to_write & + b2 = (const u8*)b + (to_write & ~(sizeof(unsigned long) - 1)); for (i = 0; i < cnt; i++) { if (b2[i]) { @@ -1099,7 +1099,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, void *b) */ total += to_write; count -= to_write; - b = (u8*)b + to_write; + b = (const u8*)b + to_write; continue; } /* The buffer is non zero, instantiate the hole. */ @@ -1250,7 +1250,7 @@ retry: if (written > 0) { total += written; count -= written; - b = (u8*)b + written; + b = (const u8*)b + written; continue; } /* If the syscall was interrupted, try again. */ From 3727a729c241c05f140382e5d6f62c296bc2ee27 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 3 Jul 2005 00:18:37 +0000 Subject: [PATCH 2318/2994] - Add new utility - ntfsmount. It's a FUSE module that rely on libntfs. So, you need FUSE to compile it, xattr is also highly recommended. This module support file overwrite changing it size and can list/read/write/add/remove named data streams via xattr interface. - Update auto{make,conf} stuff respectively. --- ChangeLog | 4 +- Makefile.in | 5 + NEWS | 5 + aclocal.m4 | 520 ++++++++++------ config.guess | 64 +- config.h.in | 3 + config.sub | 5 +- configure | 1203 +++++++++++++++++++++++++++----------- configure.ac | 23 +- doc/Makefile.in | 5 + include/Makefile.in | 5 + include/ntfs/Makefile.in | 5 + libntfs/Makefile.in | 5 + ltmain.sh | 156 +++-- ntfsprogs/Makefile.am | 11 + ntfsprogs/Makefile.in | 49 +- 16 files changed, 1446 insertions(+), 622 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4315aa71..c4377809 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,9 +3,11 @@ xx/xx/xxxx - 1.10.1-WIP - ntfscp: fix signal hanling: handle both SIGTERM and SIGINT, print correct message. (Yura) - Update manual pages for ntfsprogs, ntfsclone, ntfsresize. (Szaka) - - Detect and hint users if the destination fs doesn't support + - ntfsclone: detect and hint users if the destination fs doesn't support sparse files. (Szaka) - Fix memory managament error in ntfs_inode_close. (Yura) + - Add new utility - ntfsmount. It's a FUSE module that + rely on libntfs. (Yura) 20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. diff --git a/Makefile.in b/Makefile.in index ce793941..553116e9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -100,11 +100,15 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_FUSE_MODULE_FALSE = @ENABLE_FUSE_MODULE_FALSE@ +ENABLE_FUSE_MODULE_TRUE = @ENABLE_FUSE_MODULE_TRUE@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ +FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@ +FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -140,6 +144,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/NEWS b/NEWS index fe267e43..29ce324a 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,11 @@ Current news ============ +Add new utility - ntfsmount. It's a FUSE module that rely on libntfs. So, +you need FUSE to compile it, xattr is also highly recommended. This module +support file overwrite changing it size and can list/read/write/add/remove +named data streams via xattr interface. (Yura) + Attribute resize code for normal and sparse files is completed. Thus, ntfscp should always successfully overwrite any normal or sparse file even if file size is changed. diff --git a/aclocal.m4 b/aclocal.m4 index 2b04da7c..4ebc090e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -123,7 +123,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -191,7 +191,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -238,6 +238,48 @@ compiler=$CC ])# _LT_AC_SYS_COMPILER +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_LINKER_BOILERPLATE + + # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -579,8 +621,10 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi @@ -611,6 +655,11 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi else $2=yes fi @@ -680,6 +729,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -965,7 +1015,9 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi @@ -1464,7 +1516,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1527,7 +1579,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -2517,6 +2573,10 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # # Check for any special shared library compilation flags. # @@ -2649,6 +2709,10 @@ lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -2670,7 +2734,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2931,7 +2995,7 @@ case $host_os in fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -2949,11 +3013,11 @@ case $host_os in dgux*) case $cc_basename in - ec++) + ec++*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -2988,11 +3052,11 @@ case $host_os in # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) + aCC*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -3053,11 +3117,11 @@ case $host_os in esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) + aCC*) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -3097,9 +3161,9 @@ case $host_os in ;; irix5* | irix6*) case $cc_basename in - CC) + CC*) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -3110,7 +3174,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -3123,7 +3187,7 @@ case $host_os in ;; linux*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3148,7 +3212,7 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -3173,15 +3237,16 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC) + pgCC*) # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx) + cxx*) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -3212,7 +3277,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3251,7 +3316,7 @@ case $host_os in ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3267,14 +3332,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3292,7 +3357,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3311,7 +3376,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3326,17 +3391,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3355,7 +3420,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3379,7 +3444,7 @@ case $host_os in sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3391,12 +3456,12 @@ case $host_os in ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3409,7 +3474,7 @@ case $host_os in ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3423,9 +3488,13 @@ case $host_os in *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3446,7 +3515,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -3489,7 +3558,7 @@ case $host_os in ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3721,12 +3790,16 @@ lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3745,7 +3818,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3801,15 +3876,22 @@ lt_simple_link_test_code='public class conftest { public static void main(String # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) @@ -3852,11 +3934,16 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) @@ -3886,7 +3973,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -3992,7 +4079,7 @@ ifelse([$1], [], # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -4003,7 +4090,7 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -4086,7 +4173,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4120,7 +4207,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4646,7 +4733,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68) + cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -4655,7 +4742,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4664,10 +4751,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; dgux*) case $cc_basename in - ec++) + ec++*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4680,14 +4767,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; - aCC) + aCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -4705,7 +4792,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. @@ -4716,7 +4803,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' @@ -4727,13 +4814,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC) + pgCC*) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - cxx) + cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -4750,7 +4837,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx) + cxx*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) @@ -4761,14 +4848,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx) + cxx*) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -4784,7 +4871,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sco*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) @@ -4793,13 +4880,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; - gcx) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4809,12 +4896,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc) + lcc*) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4824,7 +4911,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -4924,7 +5011,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4972,7 +5059,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4999,9 +5086,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac ;; sunos4*) @@ -5131,7 +5223,8 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time @@ -5150,7 +5243,28 @@ ifelse([$1],[CXX],[ if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -5219,6 +5333,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -5257,41 +5402,6 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -5302,16 +5412,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -5516,7 +5621,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -5719,7 +5824,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5738,10 +5843,12 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -5750,8 +5857,18 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6042,63 +6159,120 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# 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 of the License, 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. -dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ - succeeded=no +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG - if test -z "$PKG_CONFIG"; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - fi +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then + pkg_cv_[]$1=$ac_cv_env_[]$1[]_value +elif test -n "$PKG_CONFIG"; then + if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then + pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - AC_MSG_CHECKING(for $2) +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.in +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - if $PKG_CONFIG --exists "$2" ; then - AC_MSG_RESULT(yes) - succeeded=yes +pkg_failed=no +AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], + [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) +AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], + [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) - AC_MSG_CHECKING($1_CFLAGS) - $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` - AC_MSG_RESULT($$1_CFLAGS) +if test $pkg_failed = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD - AC_MSG_CHECKING($1_LIBS) - $1_LIBS=`$PKG_CONFIG --libs "$2"` - AC_MSG_RESULT($$1_LIBS) - else - $1_CFLAGS="" - $1_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - ifelse([$4], ,echo $$1_PKG_ERRORS,) - fi + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met. +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. - AC_SUBST($1_CFLAGS) - AC_SUBST($1_LIBS) - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - ifelse([$3], , :, [$3]) - else - ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) - fi -]) +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details.])], + [$4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details. +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # diff --git a/config.guess b/config.guess index 44f30e6c..892833f9 100755 --- a/config.guess +++ b/config.guess @@ -136,16 +136,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -835,25 +825,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux + echo cris-axis-linux-gnu exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux + echo crisv32-axis-linux-gnu exit 0 ;; frv:Linux:*:*) - echo frv-${VENDOR}-linux + echo frv-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -872,7 +862,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -891,13 +881,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux + echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux + echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -910,34 +900,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux + echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux + echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -952,18 +942,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" + echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" + echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linuxoldld) or + # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -992,7 +982,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.h.in b/config.h.in index 86c9693e..12231c16 100644 --- a/config.h.in +++ b/config.h.in @@ -95,6 +95,9 @@ /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE +/* Define to 1 if you have the `setxattr' function. */ +#undef HAVE_SETXATTR + /* Define to 1 if `stat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_STAT_EMPTY_STRING_BUG diff --git a/config.sub b/config.sub index c884ad4e..d8fd2f8f 100755 --- a/config.sub +++ b/config.sub @@ -1172,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1205,6 +1205,9 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index 1b84168a..32d7c4eb 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.10.0. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.10.1-WIP. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.10.0' -PACKAGE_STRING='ntfsprogs 1.10.0' +PACKAGE_VERSION='1.10.1-WIP' +PACKAGE_STRING='ntfsprogs 1.10.1-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -947,6 +947,26 @@ ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS +ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_env_PKG_CONFIG_value=$PKG_CONFIG +ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG +ac_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} +ac_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS +ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} +ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS +ac_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} +ac_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS +ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} +ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS +ac_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} +ac_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS +ac_cv_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} +ac_cv_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS +ac_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} +ac_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS +ac_cv_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} +ac_cv_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS # # Report the --help message. @@ -955,7 +975,7 @@ 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 ntfsprogs 1.10.0 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.10.1-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1042,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.10.0:";; + short | recursive ) echo "Configuration of ntfsprogs 1.10.1-WIP:";; esac cat <<\_ACEOF @@ -1038,6 +1058,7 @@ Optional Features: do not provide default device io operations --disable-gnome-vfs omit Gnome-VFS-2.0 'libntfs' interface (default=detect) + --disable-fuse-module omit FUSE 'libntfs' interface (default=detect) --enable-really-static create completely static binaries for the utilities --enable-warnings enable additional compiler warnings --disable-dependency-tracking speeds up one-time build @@ -1069,6 +1090,15 @@ Some influential environment variables: CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags + PKG_CONFIG path to pkg-config utility + LIBNTFS_GNOMEVFS_CFLAGS + C compiler flags for LIBNTFS_GNOMEVFS, overriding pkg-config + LIBNTFS_GNOMEVFS_LIBS + linker flags for LIBNTFS_GNOMEVFS, overriding pkg-config + FUSE_MODULE_CFLAGS + C compiler flags for FUSE_MODULE, overriding pkg-config + FUSE_MODULE_LIBS + linker flags for FUSE_MODULE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1169,7 +1199,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.10.0 +ntfsprogs configure 1.10.1-WIP generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1183,7 +1213,7 @@ 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 ntfsprogs $as_me 1.10.0, which was +It was created by ntfsprogs $as_me 1.10.1-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1911,7 +1941,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.10.0' + VERSION='1.10.1-WIP' cat >>confdefs.h <<_ACEOF @@ -2140,6 +2170,15 @@ else fi; +# Check whether --enable-fuse-module or --disable-fuse-module was given. +if test "${enable_fuse_module+set}" = set; then + enableval="$enable_fuse_module" + +else + enable_fuse_module=auto + +fi; + # Check whether --enable-really-static or --disable-really-static was given. if test "${enable_really_static+set}" = set; then enableval="$enable_really_static" @@ -3902,7 +3941,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3905 "configure"' > conftest.$ac_ext + echo '#line 3944 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5481,7 +5520,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5484:" \ +echo "$as_me:5523:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5682,6 +5721,7 @@ else fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -5972,7 +6012,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. @@ -6277,7 +6317,16 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -6465,6 +6514,20 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # # Check for any special shared library compilation flags. # @@ -6506,6 +6569,11 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works=yes + fi else lt_prog_compiler_static_works=yes fi @@ -6550,15 +6618,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6553: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6621: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6557: \$? = $ac_status" >&5 + echo "$as_me:6625: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -6664,7 +6734,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' @@ -6712,7 +6782,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -6739,9 +6809,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac ;; sunos4*) @@ -6805,15 +6880,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6808: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6883: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6812: \$? = $ac_status" >&5 + echo "$as_me:6887: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works=yes fi fi @@ -6865,16 +6942,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6868: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6945: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6872: \$? = $ac_status" >&5 + echo "$as_me:6949: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi @@ -6954,6 +7033,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -6974,6 +7063,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -7042,6 +7152,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -7080,41 +7221,6 @@ EOF hardcode_shlibpath_var=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds=$archive_cmds - fi - else - ld_shlibs=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -7125,16 +7231,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -7441,7 +7542,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -7644,7 +7745,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -7663,10 +7764,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -7675,8 +7778,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs=yes ;; @@ -8213,7 +8326,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -8276,7 +8389,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -9065,7 +9182,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6;} # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -9432,7 +9549,7 @@ echo "$as_me: creating $ofile" >&6;} SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -9514,7 +9631,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9548,7 +9665,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -9903,6 +10020,20 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -9924,7 +10055,16 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -10394,7 +10534,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -10412,11 +10552,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi dgux*) case $cc_basename in - ec++) + ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10451,11 +10591,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC) + aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -10516,11 +10656,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC) + aCC*) case "$host_cpu" in hppa*64*|ia64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -10560,9 +10700,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; irix5* | irix6*) case $cc_basename in - CC) + CC*) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -10573,7 +10713,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -10586,7 +10726,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; linux*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10611,7 +10751,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -10636,15 +10776,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC) + pgCC*) # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx) + cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -10675,7 +10816,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10714,7 +10855,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10730,14 +10871,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx) + cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10755,7 +10896,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10774,7 +10915,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10789,17 +10930,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx) + cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -10818,7 +10959,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10842,7 +10983,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi sco*) archive_cmds_need_lc_CXX=no case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10854,12 +10995,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10872,7 +11013,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -10886,9 +11027,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -10909,7 +11054,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -10952,7 +11097,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11161,7 +11306,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; chorus*) case $cc_basename in - cxch68) + cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -11170,7 +11315,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' @@ -11179,10 +11324,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; dgux*) case $cc_basename in - ec++) + ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; @@ -11195,14 +11340,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; - aCC) + aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -11220,7 +11365,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC) + CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. @@ -11231,7 +11376,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' @@ -11242,13 +11387,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; - pgCC) + pgCC*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-static' ;; - cxx) + cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -11265,7 +11410,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; mvs*) case $cc_basename in - cxx) + cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) @@ -11276,14 +11421,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; - cxx) + cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -11299,7 +11444,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sco*) case $cc_basename in - CC) + CC*) lt_prog_compiler_pic_CXX='-fPIC' ;; *) @@ -11308,13 +11453,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; - gcx) + gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; @@ -11324,12 +11469,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; - lcc) + lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; @@ -11339,7 +11484,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; @@ -11383,15 +11528,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11386: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11531: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11390: \$? = $ac_status" >&5 + echo "$as_me:11535: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_CXX=yes fi fi @@ -11443,16 +11590,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11446: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11593: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11450: \$? = $ac_status" >&5 + echo "$as_me:11597: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi @@ -11954,7 +12103,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -12017,7 +12166,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -12806,7 +12959,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 @@ -13512,7 +13688,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 @@ -13618,7 +13796,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' @@ -13666,7 +13844,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' @@ -13693,9 +13871,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_F77='-Qoption ld ';; + *) + lt_prog_compiler_wl_F77='-Wl,';; + esac ;; sunos4*) @@ -13759,15 +13942,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13762: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13945: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13766: \$? = $ac_status" >&5 + echo "$as_me:13949: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_F77=yes fi fi @@ -13819,16 +14004,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13822: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14007: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13826: \$? = $ac_status" >&5 + echo "$as_me:14011: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi @@ -13908,6 +14095,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -13928,6 +14125,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -13996,6 +14214,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_F77=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -14034,41 +14283,6 @@ EOF hardcode_shlibpath_var_F77=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_F77=$archive_cmds_F77 - fi - else - ld_shlibs_F77=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -14079,16 +14293,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs_F77" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi + if test "$ld_shlibs_F77" = no; then + runpath_var= + hardcode_libdir_flag_spec_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -14375,7 +14584,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -14578,7 +14787,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' @@ -14597,10 +14806,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -14609,8 +14820,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs_F77=yes ;; @@ -15147,7 +15368,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -15210,7 +15431,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15409,7 +15634,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -15558,7 +15783,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -15592,7 +15817,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -15841,15 +16066,41 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no +old_archive_cmds_GCJ=$old_archive_cmds + lt_prog_compiler_no_builtin_flag_GCJ= @@ -15875,15 +16126,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15878: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16129: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15882: \$? = $ac_status" >&5 + echo "$as_me:16133: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -15989,7 +16242,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' @@ -16037,7 +16290,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16064,9 +16317,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_GCJ='-Qoption ld ';; + *) + lt_prog_compiler_wl_GCJ='-Wl,';; + esac ;; sunos4*) @@ -16130,15 +16388,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16133: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16391: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16137: \$? = $ac_status" >&5 + echo "$as_me:16395: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_GCJ=yes fi fi @@ -16190,16 +16450,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16193: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16453: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16197: \$? = $ac_status" >&5 + echo "$as_me:16457: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi @@ -16279,6 +16541,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -16299,6 +16571,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -16367,6 +16660,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_GCJ=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -16405,41 +16729,6 @@ EOF hardcode_shlibpath_var_GCJ=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_GCJ=$archive_cmds_GCJ - fi - else - ld_shlibs_GCJ=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -16450,16 +16739,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs_GCJ" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi + if test "$ld_shlibs_GCJ" = no; then + runpath_var= + hardcode_libdir_flag_spec_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -16766,7 +17050,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -16969,7 +17253,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' @@ -16988,10 +17272,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -17000,8 +17286,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs_GCJ=yes ;; @@ -17538,7 +17834,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -17601,7 +17897,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -18390,7 +18690,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the @@ -19056,7 +19380,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -19205,7 +19529,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -19239,7 +19563,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -19889,11 +20213,11 @@ if test "$enable_gnome_vfs" != "no"; then export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" fi - succeeded=no - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; 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_path_PKG_CONFIG+set}" = set; then @@ -19918,7 +20242,6 @@ do done done - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -19932,56 +20255,123 @@ else echo "${ECHO_T}no" >&6 fi +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done +done - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 -echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG - if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then - echo "$as_me:$LINENO: result: yes" >&5 +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + PKG_CONFIG=$ac_pt_PKG_CONFIG +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - succeeded=yes + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + PKG_CONFIG="" + fi - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 +fi - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 - else - LIBNTFS_GNOMEVFS_CFLAGS="" - LIBNTFS_GNOMEVFS_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` +pkg_failed=no +echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 +if test "${pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set" = "xset"; then + pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&6 +echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 +if test "${pkg_cv_LIBNTFS_GNOMEVFS_LIBS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set" = "xset"; then + pkg_cv_LIBNTFS_GNOMEVFS_LIBS=$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&6 - fi +if test $pkg_failed = yes; then + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + # Put the nasty error message in config.log where it belongs + echo "$LIBNTFS_GNOMEVFS_PKG_ERRORS" 1>&5 - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_gnome_vfs=true - else - if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} @@ -19991,8 +20381,22 @@ echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi - fi +elif test $pkg_failed = untried; then + if test "$enable_gnome_vfs" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} + fi + +else + LIBNTFS_GNOMEVFS_CFLAGS=$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS + LIBNTFS_GNOMEVFS_LIBS=$pkg_cv_LIBNTFS_GNOMEVFS_LIBS + compile_gnome_vfs=true +fi fi @@ -20005,6 +20409,101 @@ else fi +# Autodetect whether to build FUSE module or not. +compile_fuse_module=false +if test "$enable_fuse_module" != "no"; then + +pkg_failed=no +echo "$as_me:$LINENO: checking for FUSE_MODULE_CFLAGS" >&5 +echo $ECHO_N "checking for FUSE_MODULE_CFLAGS... $ECHO_C" >&6 +if test "${pkg_cv_FUSE_MODULE_CFLAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_FUSE_MODULE_CFLAGS_set" = "xset"; then + pkg_cv_FUSE_MODULE_CFLAGS=$ac_cv_env_FUSE_MODULE_CFLAGS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "fuse" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_CFLAGS" >&5 +echo "${ECHO_T}$pkg_cv_FUSE_MODULE_CFLAGS" >&6 +echo "$as_me:$LINENO: checking for FUSE_MODULE_LIBS" >&5 +echo $ECHO_N "checking for FUSE_MODULE_LIBS... $ECHO_C" >&6 +if test "${pkg_cv_FUSE_MODULE_LIBS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_FUSE_MODULE_LIBS_set" = "xset"; then + pkg_cv_FUSE_MODULE_LIBS=$ac_cv_env_FUSE_MODULE_LIBS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "fuse" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_LIBS" >&5 +echo "${ECHO_T}$pkg_cv_FUSE_MODULE_LIBS" >&6 + +if test $pkg_failed = yes; then + FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse"` + # Put the nasty error message in config.log where it belongs + echo "$FUSE_MODULE_PKG_ERRORS" 1>&5 + + + if test "$enable_fuse_module" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires fuse library." >&5 +echo "$as_me: error: Linux-NTFS FUSE module requires fuse library." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires fuse library." >&5 +echo "$as_me: WARNING: Linux-NTFS FUSE module requires fuse library." >&2;} + fi + +elif test $pkg_failed = untried; then + + if test "$enable_fuse_module" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires fuse library." >&5 +echo "$as_me: error: Linux-NTFS FUSE module requires fuse library." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires fuse library." >&5 +echo "$as_me: WARNING: Linux-NTFS FUSE module requires fuse library." >&2;} + fi + +else + FUSE_MODULE_CFLAGS=$pkg_cv_FUSE_MODULE_CFLAGS + FUSE_MODULE_LIBS=$pkg_cv_FUSE_MODULE_LIBS + compile_fuse_module=true +fi +fi + + +if $compile_fuse_module; then + ENABLE_FUSE_MODULE_TRUE= + ENABLE_FUSE_MODULE_FALSE='#' +else + ENABLE_FUSE_MODULE_TRUE='#' + ENABLE_FUSE_MODULE_FALSE= +fi + + # add --with-extra-includes and --with-extra-libs switch to ./configure all_libraries="$all_libraries $USER_LDFLAGS" all_includes="$all_includes $USER_INCLUDES" @@ -22937,8 +23436,10 @@ done + for ac_func in atexit fdatasync hasmntopt memmove memset regcomp setlocale \ - strcasecmp strchr strdup strerror strtol strtoul utime mbsinit + strcasecmp strchr strdup strerror strtol strtoul utime mbsinit \ + setxattr do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -23169,6 +23670,13 @@ echo "$as_me: error: conditional \"ENABLE_GNOME_VFS\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${ENABLE_FUSE_MODULE_TRUE}" && test -z "${ENABLE_FUSE_MODULE_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"ENABLE_FUSE_MODULE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"ENABLE_FUSE_MODULE\" 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 @@ -23440,7 +23948,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.10.0, which was +This file was extended by ntfsprogs $as_me 1.10.1-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23503,7 +24011,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.10.0 +ntfsprogs config.status 1.10.1-WIP configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -23793,10 +24301,15 @@ s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t s,@ENABLE_GNOME_VFS_FALSE@,$ENABLE_GNOME_VFS_FALSE,;t t +s,@FUSE_MODULE_CFLAGS@,$FUSE_MODULE_CFLAGS,;t t +s,@FUSE_MODULE_LIBS@,$FUSE_MODULE_LIBS,;t t +s,@ENABLE_FUSE_MODULE_TRUE@,$ENABLE_FUSE_MODULE_TRUE,;t t +s,@ENABLE_FUSE_MODULE_FALSE@,$ENABLE_FUSE_MODULE_FALSE,;t t s,@all_includes@,$all_includes,;t t s,@all_libraries@,$all_libraries,;t t s,@AUTODIRS@,$AUTODIRS,;t t diff --git a/configure.ac b/configure.ac index 901c863b..c103a09e 100644 --- a/configure.ac +++ b/configure.ac @@ -75,6 +75,12 @@ AC_ARG_ENABLE(gnome-vfs, enable_gnome_vfs=auto ) +AC_ARG_ENABLE(fuse-module, + AS_HELP_STRING(--disable-fuse-module,omit FUSE 'libntfs' + interface (default=detect)), , + enable_fuse_module=auto +) + AC_ARG_ENABLE(really-static, AS_HELP_STRING(--enable-really-static,create completely static binaries for the utilities), , @@ -128,6 +134,20 @@ if test "$enable_gnome_vfs" != "no"; then fi AM_CONDITIONAL(ENABLE_GNOME_VFS, $compile_gnome_vfs) +# Autodetect whether to build FUSE module or not. +compile_fuse_module=false +if test "$enable_fuse_module" != "no"; then + PKG_CHECK_MODULES(FUSE_MODULE, [fuse], [ compile_fuse_module=true ], + [ + if test "$enable_fuse_module" = "yes"; then + AC_MSG_ERROR([Linux-NTFS FUSE module requires fuse library.]) + else + AC_MSG_WARN([Linux-NTFS FUSE module requires fuse library.]) + fi + ]) +fi +AM_CONDITIONAL(ENABLE_FUSE_MODULE, $compile_fuse_module) + # add --with-extra-includes and --with-extra-libs switch to ./configure all_libraries="$all_libraries $USER_LDFLAGS" all_includes="$all_includes $USER_INCLUDES" @@ -223,7 +243,8 @@ AC_FUNC_STRFTIME AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \ - strcasecmp strchr strdup strerror strtol strtoul utime mbsinit]) + strcasecmp strchr strdup strerror strtol strtoul utime mbsinit \ + setxattr]) # Makefiles to be created by configure. AC_CONFIG_FILES([ diff --git a/doc/Makefile.in b/doc/Makefile.in index ef73e5d3..e9a42652 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -75,11 +75,15 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_FUSE_MODULE_FALSE = @ENABLE_FUSE_MODULE_FALSE@ +ENABLE_FUSE_MODULE_TRUE = @ENABLE_FUSE_MODULE_TRUE@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ +FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@ +FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -115,6 +119,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/Makefile.in b/include/Makefile.in index 33e9cdfd..2202b27d 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -84,11 +84,15 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_FUSE_MODULE_FALSE = @ENABLE_FUSE_MODULE_FALSE@ +ENABLE_FUSE_MODULE_TRUE = @ENABLE_FUSE_MODULE_TRUE@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ +FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@ +FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -124,6 +128,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 32fd7ef0..2c384c38 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -88,11 +88,15 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_FUSE_MODULE_FALSE = @ENABLE_FUSE_MODULE_FALSE@ +ENABLE_FUSE_MODULE_TRUE = @ENABLE_FUSE_MODULE_TRUE@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ +FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@ +FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -128,6 +132,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 30898d42..37bab1b3 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -150,11 +150,15 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_FUSE_MODULE_FALSE = @ENABLE_FUSE_MODULE_FALSE@ +ENABLE_FUSE_MODULE_TRUE = @ENABLE_FUSE_MODULE_TRUE@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ +FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@ +FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -190,6 +194,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/ltmain.sh b/ltmain.sh index 3d071010..eecedf23 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -17,7 +17,7 @@ # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,8 +43,8 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.14 -TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" +VERSION=1.5.18 +TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. @@ -112,8 +112,9 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -: ${IFS=" -"} +lt_nl=' +' +IFS=" $lt_nl" if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -250,37 +251,14 @@ func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" - f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" - $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ - | $EGREP -v '^[ ]*1[ ]' | while read count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? - i=`expr $i + 1` - done - done - $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE fi } @@ -757,6 +735,15 @@ if test -z "$show_help"; then esac done + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qlibobj="\"$qlibobj\"" ;; + esac + if test "X$libobj" != "X$qlibobj"; then + $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + exit $EXIT_FAILURE + fi objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -829,12 +816,17 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo $srcfile > "$lockfile" + $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qsrcfile="\"$qsrcfile\"" ;; + esac $run $rm "$libobj" "${libobj}T" @@ -856,10 +848,10 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" fi if test ! -d "${xdir}$objdir"; then @@ -939,9 +931,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" else - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -1365,6 +1357,8 @@ EOF ;; darwin_framework) compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" prev= continue ;; @@ -1429,6 +1423,8 @@ EOF -framework) prev=darwin_framework compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" continue ;; @@ -2852,12 +2848,12 @@ EOF *) continue ;; esac case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no @@ -3124,7 +3120,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3133,7 +3129,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3142,7 +3138,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -5091,6 +5087,63 @@ fi\ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5104,20 +5157,7 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi + # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -6026,14 +6066,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\"\$cmd\"$args" + exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - eval \$echo \"\$cmd\"$args + $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 7449ed8e..5358a34e 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -26,6 +26,10 @@ CLEANFILES = $(EXTRA_PROGRAMS) linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs +if ENABLE_FUSE_MODULE +bin_PROGRAMS += ntfsmount +endif + # Set the include path. AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs $(all_includes) @@ -73,6 +77,13 @@ ntfscp_SOURCES = ntfscp.c utils.c utils.h ntfscp_LDADD = $(AM_LIBS) ntfscp_LDFLAGS = $(AM_LFLAGS) +if ENABLE_FUSE_MODULE +ntfsmount_SOURCES = ntfsmount.c +ntfsmount_LDADD = $(AM_LIBS) $(FUSE_MODULE_LIBS) +ntfsmount_LDFLAGS = $(AM_LFLAGS) +ntfsmount_CFLAGS = $(FUSE_MODULE_CFLAGS) -DFUSE_USE_VERSION=22 +endif + # We don't distribute these ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 19de7246..adb90dfe 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmftalloc_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) +SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmftalloc_SOURCES) $(ntfsmount_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -40,13 +40,14 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ - ntfsls$(EXEEXT) ntfscat$(EXEEXT) + ntfsls$(EXEEXT) ntfscat$(EXEEXT) $(am__EXEEXT_1) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) \ ntfscp$(EXEEXT) EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) ntfswipe$(EXEEXT) \ ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) ntfsrm$(EXEEXT) \ ntfsmftalloc$(EXEEXT) +@ENABLE_FUSE_MODULE_TRUE@am__append_1 = ntfsmount subdir = ntfsprogs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/mkntfs.8.in $(srcdir)/ntfscat.8.in \ @@ -64,6 +65,7 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ ntfscp.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 \ ntfsresize.8 ntfsundelete.8 +@ENABLE_FUSE_MODULE_TRUE@am__EXEEXT_1 = ntfsmount$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \ "$(DESTDIR)$(man8dir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) @@ -108,6 +110,14 @@ ntfsls_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfsmftalloc_OBJECTS = ntfsmftalloc.$(OBJEXT) utils.$(OBJEXT) ntfsmftalloc_OBJECTS = $(am_ntfsmftalloc_OBJECTS) ntfsmftalloc_DEPENDENCIES = $(am__DEPENDENCIES_1) +am__ntfsmount_SOURCES_DIST = ntfsmount.c +@ENABLE_FUSE_MODULE_TRUE@am_ntfsmount_OBJECTS = \ +@ENABLE_FUSE_MODULE_TRUE@ ntfsmount-ntfsmount.$(OBJEXT) +ntfsmount_OBJECTS = $(am_ntfsmount_OBJECTS) +am__DEPENDENCIES_2 = +@ENABLE_FUSE_MODULE_TRUE@ntfsmount_DEPENDENCIES = \ +@ENABLE_FUSE_MODULE_TRUE@ $(am__DEPENDENCIES_1) \ +@ENABLE_FUSE_MODULE_TRUE@ $(am__DEPENDENCIES_2) am_ntfsmove_OBJECTS = ntfsmove.$(OBJEXT) utils.$(OBJEXT) ntfsmove_OBJECTS = $(am_ntfsmove_OBJECTS) ntfsmove_DEPENDENCIES = $(am__DEPENDENCIES_1) @@ -140,16 +150,16 @@ SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) \ $(ntfscluster_SOURCES) $(ntfscp_SOURCES) \ $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ - $(ntfsmftalloc_SOURCES) $(ntfsmove_SOURCES) \ - $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ + $(ntfsmftalloc_SOURCES) $(ntfsmount_SOURCES) \ + $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ $(ntfswipe_SOURCES) DIST_SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) \ $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ - $(ntfsmftalloc_SOURCES) $(ntfsmove_SOURCES) \ - $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ + $(ntfsmftalloc_SOURCES) $(am__ntfsmount_SOURCES_DIST) \ + $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ $(ntfswipe_SOURCES) man8dir = $(mandir)/man8 @@ -185,11 +195,15 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_FUSE_MODULE_FALSE = @ENABLE_FUSE_MODULE_FALSE@ +ENABLE_FUSE_MODULE_TRUE = @ENABLE_FUSE_MODULE_TRUE@ ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ +FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@ +FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -225,6 +239,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ @@ -320,6 +335,10 @@ ntfscat_LDFLAGS = $(AM_LFLAGS) ntfscp_SOURCES = ntfscp.c utils.c utils.h ntfscp_LDADD = $(AM_LIBS) ntfscp_LDFLAGS = $(AM_LFLAGS) +@ENABLE_FUSE_MODULE_TRUE@ntfsmount_SOURCES = ntfsmount.c +@ENABLE_FUSE_MODULE_TRUE@ntfsmount_LDADD = $(AM_LIBS) $(FUSE_MODULE_LIBS) +@ENABLE_FUSE_MODULE_TRUE@ntfsmount_LDFLAGS = $(AM_LFLAGS) +@ENABLE_FUSE_MODULE_TRUE@ntfsmount_CFLAGS = $(FUSE_MODULE_CFLAGS) -DFUSE_USE_VERSION=22 # We don't distribute these ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h @@ -486,6 +505,9 @@ ntfsls$(EXEEXT): $(ntfsls_OBJECTS) $(ntfsls_DEPENDENCIES) ntfsmftalloc$(EXEEXT): $(ntfsmftalloc_OBJECTS) $(ntfsmftalloc_DEPENDENCIES) @rm -f ntfsmftalloc$(EXEEXT) $(LINK) $(ntfsmftalloc_LDFLAGS) $(ntfsmftalloc_OBJECTS) $(ntfsmftalloc_LDADD) $(LIBS) +ntfsmount$(EXEEXT): $(ntfsmount_OBJECTS) $(ntfsmount_DEPENDENCIES) + @rm -f ntfsmount$(EXEEXT) + $(LINK) $(ntfsmount_LDFLAGS) $(ntfsmount_OBJECTS) $(ntfsmount_LDADD) $(LIBS) ntfsmove$(EXEEXT): $(ntfsmove_OBJECTS) $(ntfsmove_DEPENDENCIES) @rm -f ntfsmove$(EXEEXT) $(LINK) $(ntfsmove_LDFLAGS) $(ntfsmove_OBJECTS) $(ntfsmove_LDADD) $(LIBS) @@ -525,6 +547,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfslabel.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsls.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmftalloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmount-ntfsmount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmove.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsresize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsrm.Po@am__quote@ @@ -556,6 +579,20 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +ntfsmount-ntfsmount.o: ntfsmount.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -MT ntfsmount-ntfsmount.o -MD -MP -MF "$(DEPDIR)/ntfsmount-ntfsmount.Tpo" -c -o ntfsmount-ntfsmount.o `test -f 'ntfsmount.c' || echo '$(srcdir)/'`ntfsmount.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ntfsmount-ntfsmount.Tpo" "$(DEPDIR)/ntfsmount-ntfsmount.Po"; else rm -f "$(DEPDIR)/ntfsmount-ntfsmount.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfsmount.c' object='ntfsmount-ntfsmount.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -c -o ntfsmount-ntfsmount.o `test -f 'ntfsmount.c' || echo '$(srcdir)/'`ntfsmount.c + +ntfsmount-ntfsmount.obj: ntfsmount.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -MT ntfsmount-ntfsmount.obj -MD -MP -MF "$(DEPDIR)/ntfsmount-ntfsmount.Tpo" -c -o ntfsmount-ntfsmount.obj `if test -f 'ntfsmount.c'; then $(CYGPATH_W) 'ntfsmount.c'; else $(CYGPATH_W) '$(srcdir)/ntfsmount.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ntfsmount-ntfsmount.Tpo" "$(DEPDIR)/ntfsmount-ntfsmount.Po"; else rm -f "$(DEPDIR)/ntfsmount-ntfsmount.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfsmount.c' object='ntfsmount-ntfsmount.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -c -o ntfsmount-ntfsmount.obj `if test -f 'ntfsmount.c'; then $(CYGPATH_W) 'ntfsmount.c'; else $(CYGPATH_W) '$(srcdir)/ntfsmount.c'; fi` + mostlyclean-libtool: -rm -f *.lo From 58f7b6b3452adc77bad78ae7a014264b20adea77 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 3 Jul 2005 00:35:48 +0000 Subject: [PATCH 2319/2994] Forgot to commit ntfsmount itself. :-) --- ntfsprogs/ntfsmount.c | 808 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 808 insertions(+) create mode 100644 ntfsprogs/ntfsmount.c diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c new file mode 100644 index 00000000..3b8de24c --- /dev/null +++ b/ntfsprogs/ntfsmount.c @@ -0,0 +1,808 @@ +/** + * ntfsfuse - Part of the Linux-NTFS project. + * + * Copyright (c) 2005 Yura Pakhuchiy + * + * NTFS module for FUSE. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SETXATTR +#include +#endif + +#include "attrib.h" +#include "inode.h" +#include "volume.h" +#include "dir.h" +#include "unistr.h" +#include "layout.h" + +typedef struct { + fuse_fill_dir_t filler; + void *buf; +} ntfs_fuse_fill_context_t; + +typedef struct { + ntfs_volume *vol; + int state; + long free_clusters; + long free_mft; + uid_t uid; + gid_t gid; + mode_t fmask; + mode_t dmask; + BOOL ro; + BOOL show_system_files; +} ntfs_fuse_context_t; + +typedef enum { + NF_FreeClustersOutdate = (1 << 0), /* Information about amount of + free clusters is outdated. */ + NF_FreeMFTOutdate = (1 << 1), /* Information about amount of + free MFT records is outdated. */ +} ntfs_fuse_state_bits; + +static const char *EXEC_NAME = "ntfsmount"; +static char def_opts[] = "default_permissions,kernel_cache,allow_other,"; +static ntfs_fuse_context_t *ctx; + +#define Eprintf(arg...) fprintf(stderr, ##arg) + +static long ntfs_fuse_get_nr_free_mft_records(ntfs_volume *vol) +{ + u8 *buf; + long nr_free = 0; + s64 br, total = 0; + + if (!(ctx->state & NF_FreeMFTOutdate)) + return ctx->free_mft; + buf = malloc(NTFS_BUF_SIZE); + if (!buf) + return -ENOMEM; + while (1) { + int i, j; + + br = ntfs_attr_pread(vol->mftbmp_na, total, + NTFS_BLOCK_SIZE, buf); + if (!br) + break; + total += br; + for (i = 0; i < NTFS_BLOCK_SIZE; i++) + for (j = 0; j < 8; j++) + if (!((buf[i] >> j) & 1)) + nr_free++; + } + free(buf); + if (!total) + return -errno; + ctx->free_mft = nr_free; + ctx->state &= ~(NF_FreeMFTOutdate); + return nr_free; +} + +static long ntfs_fuse_get_nr_free_clusters(ntfs_volume *vol) +{ + u8 *buf; + long nr_free = 0; + s64 br, total = 0; + + if (!(ctx->state & NF_FreeClustersOutdate)) + return ctx->free_clusters; + buf = malloc(NTFS_BUF_SIZE); + if (!buf) + return -ENOMEM; + while (1) { + int i, j; + + br = ntfs_attr_pread(vol->lcnbmp_na, total, + NTFS_BLOCK_SIZE, buf); + if (!br) + break; + total += br; + for (i = 0; i < NTFS_BLOCK_SIZE; i++) + for (j = 0; j < 8; j++) + if (!((buf[i] >> j) & 1)) + nr_free++; + } + free(buf); + if (!total) + return -errno; + ctx->free_clusters = nr_free; + ctx->state &= ~(NF_FreeClustersOutdate); + return nr_free; +} + +/** + * ntfs_fuse_statfs - return information about mounted NTFS volume + * @path: ignored (but fuse requires it) + * @sfs: statfs structure in which to return the information + * + * Return information about the mounted NTFS volume @sb in the statfs structure + * pointed to by @sfs (this is initialized with zeros before ntfs_statfs is + * called). We interpret the values to be correct of the moment in time at + * which we are called. Most values are variable otherwise and this isn't just + * the free values but the totals as well. For example we can increase the + * total number of file nodes if we run out and we can keep doing this until + * there is no more space on the volume left at all. + * + * This code based on ntfs_statfs from ntfs kernel driver. + * + * Return 0 on success or -errno on error. + */ +static int ntfs_fuse_statfs(const char *path __attribute__((unused)), + struct statfs *sfs) +{ + long size; + ntfs_volume *vol; + + vol = ctx->vol; + if (!vol) + return -ENODEV; + /* Type of filesystem. */ + sfs->f_type = NTFS_SB_MAGIC; + /* Optimal transfer block size. */ + sfs->f_bsize = NTFS_BLOCK_SIZE; + /* + * Total data blocks in file system in units of f_bsize and since + * inodes are also stored in data blocs ($MFT is a file) this is just + * the total clusters. + */ + sfs->f_blocks = vol->nr_clusters; + /* Free data blocks in file system in units of f_bsize. */ + size = ntfs_fuse_get_nr_free_clusters(vol); + if (size < 0) + size = 0; + /* Free blocks avail to non-superuser, same as above on NTFS. */ + sfs->f_bavail = sfs->f_bfree = size; + /* Number of inodes in file system (at this point in time). */ + sfs->f_files = vol->mft_na->data_size >> vol->mft_record_size_bits; + /* Free inodes in fs (based on current total count). */ + size = ntfs_fuse_get_nr_free_mft_records(vol); + if (size < 0) + size = 0; + sfs->f_ffree = size; + /* Maximum length of filenames. */ + sfs->f_namelen = NTFS_MAX_NAME_LEN; + return 0; +} + +static int ntfs_fuse_getattr(const char *path, struct stat *stbuf) +{ + int res = 0; + ntfs_inode *ni; + ntfs_attr *na; + ntfs_volume *vol; + + vol = ctx->vol; + memset(stbuf, 0, sizeof(struct stat)); + if ((ni = ntfs_pathname_to_inode(vol, NULL, path))) { + if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) { + stbuf->st_mode = S_IFDIR | (0777 & ~ctx->dmask); + na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, I30, 0); + if (na) { + stbuf->st_size = na->data_size; + stbuf->st_blocks = na->allocated_size >> + vol->sector_size_bits; + ntfs_attr_close(na); + } + } else { + stbuf->st_mode = S_IFREG | (0777 & ~ctx->fmask); + na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); + if (na) { + stbuf->st_size = na->data_size; + stbuf->st_blocks = na->allocated_size >> + vol->sector_size_bits; + ntfs_attr_close(na); + } else + res = -errno; + } + stbuf->st_uid = ctx->uid; + stbuf->st_gid = ctx->gid; + stbuf->st_ino = ni->mft_no; + stbuf->st_nlink = le16_to_cpu(ni->mrec->link_count); + /* + * TODO: Need support in libntfs for this. + * stbuf->st_atime = + * stbuf->st_ctime = + * stbuf->st_mtime = + */ + ntfs_inode_close(ni); + } else + res = -ENOENT; + return res; +} + +static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx, + const ntfschar *name, const int name_len, const int name_type, + const s64 pos __attribute__((unused)), const MFT_REF mref, + const unsigned dt_type __attribute__((unused))) +{ + char *filename; + int err = 0; + + if (name_type == FILE_NAME_DOS) + return 0; + filename = malloc(name_len + 1); + if (!filename) + return -errno; + if (ntfs_ucstombs(name, name_len, &filename, name_len + 1) < 0) { + err = -errno; + free(filename); + return err; + } + if (MREF(mref) >= FILE_first_user || ctx->show_system_files) + fill_ctx->filler(fill_ctx->buf, filename, NULL, 0); + free(filename); + return err; +} + +static int ntfs_fuse_readdir(const char *path, void *buf, + fuse_fill_dir_t filler, off_t offset __attribute__((unused)), + struct fuse_file_info *fi __attribute__((unused))) +{ + ntfs_fuse_fill_context_t fill_ctx; + ntfs_volume *vol; + ntfs_inode *ni; + s64 pos = 0; + + vol = ctx->vol; + if (!vol) + return -ENODEV; + fill_ctx.filler = filler; + fill_ctx.buf = buf; + ni = ntfs_pathname_to_inode(vol, NULL, path); + if (!ni) + return -errno; + ntfs_readdir(ni, &pos, &fill_ctx, (ntfs_filldir_t)ntfs_fuse_filler); + ntfs_inode_close(ni); + return 0; +} + +static int ntfs_fuse_open(const char *path, + struct fuse_file_info *fi __attribute__((unused))) +{ + ntfs_volume *vol; + ntfs_inode *ni; + + vol = ctx->vol; + if (!vol) + return -ENODEV; + ni = ntfs_pathname_to_inode(vol, NULL, path); + if (!ni) + return -errno; + ntfs_inode_close(ni); + return 0; +} + +static int ntfs_fuse_read(const char *path, char *buf, size_t size, + off_t offset, struct fuse_file_info *fi __attribute__((unused))) +{ + ntfs_volume *vol; + ntfs_inode *ni; + ntfs_attr *na; + int res; + + vol = ctx->vol; + if (!vol) + return -ENODEV; + ni = ntfs_pathname_to_inode(vol, NULL, path); + if (!ni) + return -errno; + na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); + if (!na) + return -errno; + res = ntfs_attr_pread(na, offset, size, buf); + ntfs_attr_close(na); + if (ntfs_inode_close(ni)) + perror("Failed to close inode"); + return res; +} + +static int ntfs_fuse_write(const char *path, const char *buf, size_t size, + off_t offset, struct fuse_file_info *fi __attribute__((unused))) +{ + ntfs_volume *vol; + ntfs_inode *ni; + ntfs_attr *na; + int res; + + vol = ctx->vol; + if (!vol) + return -ENODEV; + ni = ntfs_pathname_to_inode(vol, NULL, path); + if (!ni) + return -errno; + na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); + if (!na) + return -errno; + res = ntfs_attr_pwrite(na, offset, size, buf); + ntfs_attr_close(na); + if (ntfs_inode_close(ni)) + perror("Failed to close inode"); + ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + return res; +} + +static int ntfs_fuse_truncate(const char *path, off_t size) +{ + ntfs_volume *vol; + ntfs_inode *ni; + ntfs_attr *na; + int res; + + vol = ctx->vol; + if (!vol) + return -ENODEV; + ni = ntfs_pathname_to_inode(vol, NULL, path); + if (!ni) + return -errno; + na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); + if (!na) + return -errno; + res = ntfs_attr_truncate(na, size); + ntfs_attr_close(na); + if (ntfs_inode_close(ni)) + perror("Failed to close inode"); + ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + return res; +} + +static int ntfs_fuse_chmod(const char *path __attribute__((unused)), + mode_t mode __attribute__((unused))) +{ + return 0; +} + +#ifdef HAVE_SETXATTR +static int ntfs_fuse_listxattr(const char *path, char *list, size_t size) +{ + ntfs_attr_search_ctx *actx = NULL; + ntfs_volume *vol; + ntfs_inode *ni; + char *to = list; + int ret = 0; + + vol = ctx->vol; + if (!vol) + return -ENODEV; + ni = ntfs_pathname_to_inode(vol, NULL, path); + if (!ni) + return -errno; + actx = ntfs_attr_get_search_ctx(ni, NULL); + if (!actx) { + ret = -errno; + ntfs_inode_close(ni); + goto exit; + } + while (!ntfs_attr_lookup(AT_DATA, NULL, 0, CASE_SENSITIVE, + 0, NULL, 0, actx)) { + if (!actx->attr->name_length) + continue; + ret += actx->attr->name_length + 6; /* 5 bytes for 'user.', + 1 byte for terminator. */ + if (size && (size_t)ret <= size) { + strcpy(to, "user."); + to += 5; + if (ntfs_ucstombs((ntfschar *)((u8*)actx->attr + + le16_to_cpu(actx->attr->name_offset)), + actx->attr->name_length, &to, + actx->attr->name_length + 1) < 0) { + ret = -errno; + goto exit; + } + to += actx->attr->name_length + 1; + } + } + if (errno != ENOENT) + ret = -errno; +exit: + if (actx) + ntfs_attr_put_search_ctx(actx); + ntfs_inode_close(ni); + fprintf(stderr, "return %d\n", ret); + return ret; +} + +static int ntfs_fuse_getxattr(const char *path, const char *name, + char *value, size_t size) +{ + ntfs_volume *vol; + ntfs_inode *ni; + ntfs_attr *na = NULL; + int res; + ntfschar *lename = NULL; + + if (strncmp(name, "user.", 5)) + return -ENODATA; + vol = ctx->vol; + if (!vol) + return -ENODEV; + ni = ntfs_pathname_to_inode(vol, NULL, path); + if (!ni) + return -errno; + if (ntfs_mbstoucs(name + 5, &lename, 0) == -1) { + res = -errno; + goto exit; + } + na = ntfs_attr_open(ni, AT_DATA, lename, strlen(name) - 5); + if (!na) { + res = -ENODATA; + goto exit; + } + if (size) { + if (size >= na->data_size) { + res = ntfs_attr_pread(na, 0, na->data_size, value); + if (res != na->data_size) + res = -errno; + } else + res = -ERANGE; + } else + res = na->data_size; +exit: + if (na) + ntfs_attr_close(na); + if (lename) + free(lename); + if (ntfs_inode_close(ni)) + perror("Failed to close inode"); + return res; +} + +static int ntfs_fuse_setxattr(const char *path, const char *name, + const char *value, size_t size, int flags) +{ + ntfs_volume *vol; + ntfs_inode *ni; + ntfs_attr *na = NULL; + int res; + ntfschar *lename = NULL; + + if (strncmp(name, "user.", 5)) + return -EACCES; + vol = ctx->vol; + if (!vol) + return -ENODEV; + ni = ntfs_pathname_to_inode(vol, NULL, path); + if (!ni) + return -errno; + if (ntfs_mbstoucs(name + 5, &lename, 0) == -1) { + res = -errno; + goto exit; + } + na = ntfs_attr_open(ni, AT_DATA, lename, strlen(name) - 5); + if (na && flags == XATTR_CREATE) { + res = -EEXIST; + goto exit; + } + if (!na) { + if (flags == XATTR_REPLACE) { + res = -ENODATA; + goto exit; + } + na = ntfs_attr_add(ni, AT_DATA, lename, strlen(name) - 5, 0); + if (!na) { + res = -errno; + goto exit; + } + } + res = ntfs_attr_pwrite(na, 0, size, value); + if (res != (s64) size) + res = -errno; + else + res = 0; +exit: + if (na) + ntfs_attr_close(na); + if (lename) + free(lename); + if (ntfs_inode_close(ni)) + perror("Failed to close inode"); + return res; +} + +static int ntfs_fuse_removexattr(const char *path, const char *name) +{ + ntfs_volume *vol; + ntfs_inode *ni; + ntfs_attr *na = NULL; + int res = 0; + ntfschar *lename = NULL; + + if (strncmp(name, "user.", 5) || strlen(name) == 5) + return -ENODATA; + vol = ctx->vol; + if (!vol) + return -ENODEV; + ni = ntfs_pathname_to_inode(vol, NULL, path); + if (!ni) + return -errno; + if (ntfs_mbstoucs(name + 5, &lename, 0) == -1) { + res = -errno; + goto exit; + } + na = ntfs_attr_open(ni, AT_DATA, lename, strlen(name) - 5); + if (!na) { + res = -ENODATA; + goto exit; + } + if (ntfs_attr_rm(na)) + res = -errno; + else + na = NULL; +exit: + if (na) + ntfs_attr_close(na); + if (lename) + free(lename); + if (ntfs_inode_close(ni)) + perror("Failed to close inode"); + return res; +} +#endif + +static struct fuse_operations ntfs_fuse_oper = { + .getattr = ntfs_fuse_getattr, + .readdir = ntfs_fuse_readdir, + .open = ntfs_fuse_open, + .read = ntfs_fuse_read, + .write = ntfs_fuse_write, + .truncate = ntfs_fuse_truncate, + .statfs = ntfs_fuse_statfs, + .chmod = ntfs_fuse_chmod, +#ifdef HAVE_SETXATTR + .listxattr = ntfs_fuse_listxattr, + .getxattr = ntfs_fuse_getxattr, + .setxattr = ntfs_fuse_setxattr, + .removexattr = ntfs_fuse_removexattr, +#endif +}; + +static int ntfs_fuse_init(void) +{ + ctx = malloc(sizeof(ntfs_fuse_context_t)); + if (!ctx) { + perror("malloc failed"); + return -1; + } + *ctx = (ntfs_fuse_context_t) { + .state = NF_FreeClustersOutdate | NF_FreeMFTOutdate, + .uid = getuid(), + .gid = getgid(), + .fmask = 0111, + }; + return 0; +} + +static int ntfs_fuse_mount(const char *device) +{ + ntfs_volume *vol; + + vol = ntfs_mount(device, (ctx->ro) ? MS_RDONLY : 0); + if (!vol) { + perror("Mount failed"); + return -1; + } + ctx->vol = vol; + return 0; +} + +static void ntfs_fuse_destroy(void) +{ + if (ctx->vol) { + printf("Unmounting: %s\n", ctx->vol->vol_name); + if (ntfs_umount(ctx->vol, FALSE)) + perror("Failed to unmount volume"); + } + free(ctx); +} + +static void signal_handler(int arg __attribute__((unused))) +{ + fuse_exit((fuse_get_context())->fuse); +} + +static char *parse_options(char *options, char **device) +{ + char *opts, *s, *opt, *val, *ret; + BOOL no_def_opts = FALSE, no_fsname = FALSE; + + *device = NULL; + /* + * +10 for different in length of "fsname=... (ntfs)" and "dev=...". + * +1 for null-terminator. + * Total: +11 + */ + ret = malloc(strlen(def_opts) + strlen(options) + 11); + if (!ret) { + perror("malloc failed"); + return NULL; + } + *ret = 0; + opts = strdup(options); + if (!opts) { + perror("strdump failed"); + return NULL; + } + s = opts; + while ((val = strsep(&s, ","))) { + opt = strsep(&val, "="); + if (!strcmp(opt, "dev")) { /* Device to mount. */ + if (!val) { + Eprintf("dev option should have value.\n"); + goto err_exit; + } + *device = malloc(strlen(val) + 1); + strcpy(*device, val); + } else if (!strcmp(opt, "ro")) { /* Read-only mount. */ + ctx->ro =TRUE; + strcat(ret, "ro,"); + } else if (!strcmp(opt, "fsname")) { /* Filesystem name. */ + if (!val) { + Eprintf("fsname option should have value.\n"); + goto err_exit; + } + no_fsname = TRUE; + strcat(ret, "fsname="); + strcat(ret, val); + strcat(ret, ","); + } else if (!strcmp(opt, "no_def_opts")) { + no_def_opts = TRUE; /* Don't add default options. */ + } else if (!strcmp(opt, "umask")) { + sscanf(val, "%i", &ctx->fmask); + ctx->dmask = ctx->fmask; + } else if (!strcmp(opt, "fmask")) { + sscanf(val, "%i", &ctx->fmask); + } else if (!strcmp(opt, "dmask")) { + sscanf(val, "%i", &ctx->dmask); + } else if (!strcmp(opt, "uid")) { + sscanf(val, "%i", &ctx->uid); + } else if (!strcmp(opt, "gid")) { + sscanf(val, "%i", &ctx->gid); + } else if (!strcmp(opt, "show_system_files")) { + ctx->show_system_files = TRUE; + } else { /* Probably FUSE option. */ + strcat(ret, opt); + if (val) { + strcat(ret, "="); + strcat(ret, val); + } + strcat(ret, ","); + } + } + if (!no_def_opts) { + strcat(ret, def_opts); + if (!no_fsname) { + strcat(ret, "fsname="); + strcat(ret, *device); + strcat(ret, " (ntfs)"); + } + } +exit: + free(opts); + return ret; +err_exit: + free(ret); + ret = NULL; + goto exit; +} + +static void usage(void) +{ + Eprintf("\n%s v%s - NTFS module for FUSE.\n\n", + EXEC_NAME, VERSION); + Eprintf("Copyright (c) 2005 Yura Pakhuchiy\n\n"); + Eprintf("usage: %s mount_point -o dev=device[,other_options]\n\n", + EXEC_NAME); + Eprintf("Possible options are:\n\tdefault_permissions\n\tallow_other\n" + "\tkernel_cache\n\tlarge_read\n\tdirect_io\n\tmax_read\n\t" + "fsname\n\tro\n\tno_def_opts\n\tumask\n\tfmask\n\tdmask\n\t" + "uid\n\tgid\n\tshow_system_files\n\tdev\n\n"); + Eprintf("Default options are: \"%sfsname=device (ntfs)\".\n", def_opts); +} + +int main(int argc, char *argv[]) +{ + char *options, *parsed_options, *mnt_point, *device; + struct fuse *fh; + int ffd; + + setlocale(LC_ALL, ""); + signal(SIGINT, signal_handler); + signal(SIGTERM, signal_handler); + + /* Simple arguments parse code. */ + if (argc != 4) { + usage(); + return 1; + } + if (!strcmp(argv[1], "-o")) { + options = argv[2]; + mnt_point = argv[3]; + } else if (!strcmp(argv[2], "-o")) { + options = argv[3]; + mnt_point = argv[1]; + } else { + usage(); + return 1; + } + ntfs_fuse_init(); + /* Parse options. */ + parsed_options = parse_options(options, &device); + if (!parsed_options) { + ntfs_fuse_destroy(); + return 6; + } + if (!device) { + Eprintf("dev option is mandatory.\n"); + ntfs_fuse_destroy(); + return 5; + } + + /* Create filesystem. */ + ffd = fuse_mount(mnt_point, parsed_options); + if (ffd == -1) { + Eprintf("fuse_mount failed.\n"); + return 2; + } + free(parsed_options); +#ifndef DEBUG + fh = fuse_new(ffd, "use_ino", &ntfs_fuse_oper, sizeof(ntfs_fuse_oper)); +#else + fh = fuse_new(ffd, "debug,use_ino", &ntfs_fuse_oper, + sizeof(ntfs_fuse_oper)); +#endif + if (!fh) { + Eprintf("fuse_new failed.\n"); + close(ffd); + fuse_unmount(mnt_point); + return 3; + } + /* Mount volume. */ + if (ntfs_fuse_mount(device)) { + fuse_destroy(fh); + close(ffd); + fuse_unmount(mnt_point); + return 4; + } +#ifndef DEBUG + if (daemon(0, 0)) + Eprintf("Failed to daemonize.\n"); +#endif + printf("Mounted: %s\n", ctx->vol->vol_name); + /* Main loop. */ + if (fuse_loop(fh)) + Eprintf("fuse_loop failed.\n"); + /* Destroy. */ + fuse_destroy(fh); + close(ffd); + fuse_unmount(mnt_point); + ntfs_fuse_destroy(); + return 0; +} From 96f4a39aaf270c53fe64d3335e5087448f19add2 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 3 Jul 2005 01:49:17 +0000 Subject: [PATCH 2320/2994] ntfsmount: it's not a error when file didn't contain unnamed data attribute. E.g. $Secure. --- ntfsprogs/ntfsmount.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 3b8de24c..86ae6aed 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -211,6 +211,9 @@ static int ntfs_fuse_getattr(const char *path, struct stat *stbuf) stbuf->st_blocks = na->allocated_size >> vol->sector_size_bits; ntfs_attr_close(na); + } else { + stbuf->st_size = 0; + stbuf->st_blocks = 0; } } else { stbuf->st_mode = S_IFREG | (0777 & ~ctx->fmask); @@ -220,8 +223,10 @@ static int ntfs_fuse_getattr(const char *path, struct stat *stbuf) stbuf->st_blocks = na->allocated_size >> vol->sector_size_bits; ntfs_attr_close(na); - } else - res = -errno; + } else { + stbuf->st_size = 0; + stbuf->st_blocks = 0; + } } stbuf->st_uid = ctx->uid; stbuf->st_gid = ctx->gid; From 9276557d2853809a32bbc3a807f1d47867ca9db1 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 3 Jul 2005 12:14:57 +0000 Subject: [PATCH 2321/2994] - Change default fsname to "ntfs#device". (Suggested by Miklos Szeredi) - Fix error handling when no dev option given. --- ntfsprogs/ntfsmount.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 86ae6aed..716505b2 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -640,11 +640,12 @@ static char *parse_options(char *options, char **device) *device = NULL; /* - * +10 for different in length of "fsname=... (ntfs)" and "dev=...". + * +8 for different in length of "fsname=ntfs#..." and "dev=...". + * +1 for comma * +1 for null-terminator. - * Total: +11 + * Total: +10 */ - ret = malloc(strlen(def_opts) + strlen(options) + 11); + ret = malloc(strlen(def_opts) + strlen(options) + 10); if (!ret) { perror("malloc failed"); return NULL; @@ -701,12 +702,13 @@ static char *parse_options(char *options, char **device) strcat(ret, ","); } } + if (!*device) + goto err_exit; if (!no_def_opts) { strcat(ret, def_opts); if (!no_fsname) { - strcat(ret, "fsname="); + strcat(ret, "fsname=ntfs#"); strcat(ret, *device); - strcat(ret, " (ntfs)"); } } exit: @@ -729,7 +731,7 @@ static void usage(void) "\tkernel_cache\n\tlarge_read\n\tdirect_io\n\tmax_read\n\t" "fsname\n\tro\n\tno_def_opts\n\tumask\n\tfmask\n\tdmask\n\t" "uid\n\tgid\n\tshow_system_files\n\tdev\n\n"); - Eprintf("Default options are: \"%sfsname=device (ntfs)\".\n", def_opts); + Eprintf("Default options are: \"%sfsname=ntfs#device\".\n", def_opts); } int main(int argc, char *argv[]) @@ -760,15 +762,15 @@ int main(int argc, char *argv[]) ntfs_fuse_init(); /* Parse options. */ parsed_options = parse_options(options, &device); - if (!parsed_options) { - ntfs_fuse_destroy(); - return 6; - } if (!device) { Eprintf("dev option is mandatory.\n"); ntfs_fuse_destroy(); return 5; } + if (!parsed_options) { + ntfs_fuse_destroy(); + return 6; + } /* Create filesystem. */ ffd = fuse_mount(mnt_point, parsed_options); From d31a69bb23120f685b0319e61253cc6751015279 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 3 Jul 2005 13:07:15 +0000 Subject: [PATCH 2322/2994] Use gete{u,g}id instead of get{u,g}id. (Thanks to Anton for suggestion.) --- ntfsprogs/ntfsmount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 716505b2..022657d1 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -598,8 +598,8 @@ static int ntfs_fuse_init(void) } *ctx = (ntfs_fuse_context_t) { .state = NF_FreeClustersOutdate | NF_FreeMFTOutdate, - .uid = getuid(), - .gid = getgid(), + .uid = geteuid(), + .gid = getegid(), .fmask = 0111, }; return 0; From 23181e4d49c0532c5518ad526215425189bf9d91 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 3 Jul 2005 15:26:19 +0000 Subject: [PATCH 2323/2994] ../commit --- ntfsprogs/ntfsmount.c | 85 +++++++++++++++++++++++++++++++++---------- 1 file changed, 66 insertions(+), 19 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 022657d1..32d1956a 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -59,7 +59,7 @@ typedef struct { mode_t fmask; mode_t dmask; BOOL ro; - BOOL show_system_files; + BOOL show_sys_files; } ntfs_fuse_context_t; typedef enum { @@ -262,7 +262,7 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx, free(filename); return err; } - if (MREF(mref) >= FILE_first_user || ctx->show_system_files) + if (MREF(mref) >= FILE_first_user || ctx->show_sys_files) fill_ctx->filler(fill_ctx->buf, filename, NULL, 0); free(filename); return err; @@ -386,6 +386,13 @@ static int ntfs_fuse_chmod(const char *path __attribute__((unused)), } #ifdef HAVE_SETXATTR + +static const char nf_ns_streams[] = "user.stream."; +static const int nf_ns_streams_len = 12; + +static const char nf_ns_eas[] = "user.ea."; +static const int nf_ns_eas_len = 8; + static int ntfs_fuse_listxattr(const char *path, char *list, size_t size) { ntfs_attr_search_ctx *actx = NULL; @@ -410,11 +417,10 @@ static int ntfs_fuse_listxattr(const char *path, char *list, size_t size) 0, NULL, 0, actx)) { if (!actx->attr->name_length) continue; - ret += actx->attr->name_length + 6; /* 5 bytes for 'user.', - 1 byte for terminator. */ + ret += actx->attr->name_length + nf_ns_streams_len + 1; if (size && (size_t)ret <= size) { - strcpy(to, "user."); - to += 5; + strcpy(to, nf_ns_streams); + to += nf_ns_streams_len; if (ntfs_ucstombs((ntfschar *)((u8*)actx->attr + le16_to_cpu(actx->attr->name_offset)), actx->attr->name_length, &to, @@ -444,7 +450,8 @@ static int ntfs_fuse_getxattr(const char *path, const char *name, int res; ntfschar *lename = NULL; - if (strncmp(name, "user.", 5)) + if (strncmp(name, nf_ns_streams, nf_ns_streams_len) || + strlen(name) == nf_ns_streams_len) return -ENODATA; vol = ctx->vol; if (!vol) @@ -452,11 +459,12 @@ static int ntfs_fuse_getxattr(const char *path, const char *name, ni = ntfs_pathname_to_inode(vol, NULL, path); if (!ni) return -errno; - if (ntfs_mbstoucs(name + 5, &lename, 0) == -1) { + if (ntfs_mbstoucs(name + nf_ns_streams_len, &lename, 0) == -1) { res = -errno; goto exit; } - na = ntfs_attr_open(ni, AT_DATA, lename, strlen(name) - 5); + na = ntfs_attr_open(ni, AT_DATA, lename, + strlen(name) - nf_ns_streams_len); if (!na) { res = -ENODATA; goto exit; @@ -489,7 +497,8 @@ static int ntfs_fuse_setxattr(const char *path, const char *name, int res; ntfschar *lename = NULL; - if (strncmp(name, "user.", 5)) + if (strncmp(name, nf_ns_streams, nf_ns_streams_len) || + strlen(name) == nf_ns_streams_len) return -EACCES; vol = ctx->vol; if (!vol) @@ -497,11 +506,12 @@ static int ntfs_fuse_setxattr(const char *path, const char *name, ni = ntfs_pathname_to_inode(vol, NULL, path); if (!ni) return -errno; - if (ntfs_mbstoucs(name + 5, &lename, 0) == -1) { + if (ntfs_mbstoucs(name + nf_ns_streams_len, &lename, 0) == -1) { res = -errno; goto exit; } - na = ntfs_attr_open(ni, AT_DATA, lename, strlen(name) - 5); + na = ntfs_attr_open(ni, AT_DATA, lename, + strlen(name) - nf_ns_streams_len); if (na && flags == XATTR_CREATE) { res = -EEXIST; goto exit; @@ -511,7 +521,8 @@ static int ntfs_fuse_setxattr(const char *path, const char *name, res = -ENODATA; goto exit; } - na = ntfs_attr_add(ni, AT_DATA, lename, strlen(name) - 5, 0); + na = ntfs_attr_add(ni, AT_DATA, lename, strlen(name) - + nf_ns_streams_len, 0); if (!na) { res = -errno; goto exit; @@ -540,7 +551,8 @@ static int ntfs_fuse_removexattr(const char *path, const char *name) int res = 0; ntfschar *lename = NULL; - if (strncmp(name, "user.", 5) || strlen(name) == 5) + if (strncmp(name, nf_ns_streams, nf_ns_streams_len) || + strlen(name) == nf_ns_streams_len) return -ENODATA; vol = ctx->vol; if (!vol) @@ -548,11 +560,12 @@ static int ntfs_fuse_removexattr(const char *path, const char *name) ni = ntfs_pathname_to_inode(vol, NULL, path); if (!ni) return -errno; - if (ntfs_mbstoucs(name + 5, &lename, 0) == -1) { + if (ntfs_mbstoucs(name + nf_ns_streams_len, &lename, 0) == -1) { res = -errno; goto exit; } - na = ntfs_attr_open(ni, AT_DATA, lename, strlen(name) - 5); + na = ntfs_attr_open(ni, AT_DATA, lename, + strlen(name) - nf_ns_streams_len); if (!na) { res = -ENODATA; goto exit; @@ -667,6 +680,10 @@ static char *parse_options(char *options, char **device) *device = malloc(strlen(val) + 1); strcpy(*device, val); } else if (!strcmp(opt, "ro")) { /* Read-only mount. */ + if (val) { + Eprintf("ro option should not have value.\n"); + goto err_exit; + } ctx->ro =TRUE; strcat(ret, "ro,"); } else if (!strcmp(opt, "fsname")) { /* Filesystem name. */ @@ -679,20 +696,50 @@ static char *parse_options(char *options, char **device) strcat(ret, val); strcat(ret, ","); } else if (!strcmp(opt, "no_def_opts")) { + if (val) { + Eprintf("no_def_opts option should not have " + "value.\n"); + goto err_exit; + } no_def_opts = TRUE; /* Don't add default options. */ } else if (!strcmp(opt, "umask")) { + if (!val) { + Eprintf("umask option should have value.\n"); + goto err_exit; + } sscanf(val, "%i", &ctx->fmask); ctx->dmask = ctx->fmask; } else if (!strcmp(opt, "fmask")) { + if (!val) { + Eprintf("fmask option should have value.\n"); + goto err_exit; + } sscanf(val, "%i", &ctx->fmask); } else if (!strcmp(opt, "dmask")) { + if (!val) { + Eprintf("dmask option should have value.\n"); + goto err_exit; + } sscanf(val, "%i", &ctx->dmask); } else if (!strcmp(opt, "uid")) { + if (!val) { + Eprintf("uid option should have value.\n"); + goto err_exit; + } sscanf(val, "%i", &ctx->uid); } else if (!strcmp(opt, "gid")) { + if (!val) { + Eprintf("gid option should have value.\n"); + goto err_exit; + } sscanf(val, "%i", &ctx->gid); - } else if (!strcmp(opt, "show_system_files")) { - ctx->show_system_files = TRUE; + } else if (!strcmp(opt, "show_sys_files")) { + if (val) { + Eprintf("show_sys_files option should not " + "have value.\n"); + goto err_exit; + } + ctx->show_sys_files = TRUE; } else { /* Probably FUSE option. */ strcat(ret, opt); if (val) { @@ -730,7 +777,7 @@ static void usage(void) Eprintf("Possible options are:\n\tdefault_permissions\n\tallow_other\n" "\tkernel_cache\n\tlarge_read\n\tdirect_io\n\tmax_read\n\t" "fsname\n\tro\n\tno_def_opts\n\tumask\n\tfmask\n\tdmask\n\t" - "uid\n\tgid\n\tshow_system_files\n\tdev\n\n"); + "uid\n\tgid\n\tshow_sys_files\n\tdev\n\n"); Eprintf("Default options are: \"%sfsname=ntfs#device\".\n", def_opts); } From 2af728c6c46e8161261dd08a94d34700878ca78c Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 3 Jul 2005 23:21:01 +0000 Subject: [PATCH 2324/2994] ntfsresize: support bad clusters list ($BadClus:$Bad) --- ChangeLog | 2 + TODO.ntfsprogs | 2 +- ntfsprogs/ntfsresize.c | 129 +++++++++++++++++++++++++++++++++-------- 3 files changed, 109 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index c4377809..8adb452d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ xx/xx/xxxx - 1.10.1-WIP - Fix memory managament error in ntfs_inode_close. (Yura) - Add new utility - ntfsmount. It's a FUSE module that rely on libntfs. (Yura) + - ntfsresize: support bad clusters list ($BadClus:$Bad), a.k.a. disks + having bad sectors if the new --bad-sectors option is used. (Szaka) 20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 0744e0ce..25b5f811 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -75,12 +75,12 @@ High priority bad sectors, etc) Medium priority - - support disks having bad sectors - cope with the rare, unsupported cases, see man ntfsresize 'KNOWN ISSUES' - save $Bitmap if it was modified and an error occures (e.g. bad sector). - handle signals (^C, etc) Low priority + - fully support disks with bad sectors (attrlist attr, unknown bad sectors) - move volume start diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 5ff9ddc9..95158bcc 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -54,9 +54,9 @@ static const char *EXEC_NAME = "ntfsresize"; static const char *resize_warning_msg = -"WARNING: Every sanity check passed and only the DANGEROUS operations left.\n" -"Please make sure all your important data had been backed up in case of an\n" -"unexpected failure!\n"; +"WARNING: Every sanity check passed and only the dangerous operations left.\n" +"Make sure that important data has been backed up! Power outage or computer\n" +"crash may result major data loss!\n"; static const char *resize_important_msg = "You can go on to shrink the device e.g. with 'fdisk'.\n" @@ -83,6 +83,16 @@ static const char *hibernated_volume_msg = "Apparently the NTFS partition is hibernated. Windows must be resumed and\n" "turned off properly, thus resizing will be possible later on.\n"; +static const char *bad_sectors_warning_msg = +"****************************************************************************\n" +"* WARNING: The disk has bad sector. This means physical damage on the disk *\n" +"* surface caused by deterioration, manufacturing faults or other reason. *\n" +"* The reliability of the disk may stay stable or degrade fast. We suggest *\n" +"* making a full backup urgently by running 'ntfsclone --rescue ...' then *\n" +"* run 'chkdsk /f /r volume:' on Windows then you should be able to resize *\n" +"* safely by additionally using the --bad-sectors option to ntfsresize. *\n" +"****************************************************************************\n"; + struct { int verbose; int debug; @@ -90,9 +100,9 @@ struct { int force; int info; int show_progress; + int badsectors; s64 bytes; char *volume; - u8 padding[4]; /* Unused: padding to 64 bit. */ } opt; struct bitmap { @@ -144,6 +154,7 @@ typedef struct { s64 mftmir_old; /* $MFTMirr AT_DATA's old LCN */ int dirty_inode; /* some inode data got relocated */ int shrink; /* shrink = 1, enlarge = 0 */ + s64 badclusters; /* num of physically dead clusters */ struct progress_bar progress; struct bitmap lcn_bitmap; /* Temporary statistics until all case is supported */ @@ -279,7 +290,8 @@ static void usage(void) " -s, --size SIZE Resize volume to SIZE[k|M|G] bytes\n" "\n" " -n, --no-action Do not write to disk\n" - " -f, --force Force to progress (DANGEROUS)\n" + " -b, --bad-sectors Support disks having bad sectors\n" + " -f, --force Force to progress\n" " -P, --no-progress-bar Don't show progress bar\n" " -v, --verbose More output\n" " -V, --version Display version information\n" @@ -399,8 +411,9 @@ static s64 get_new_volume_size(char *s) */ static int parse_options(int argc, char **argv) { - static const char *sopt = "-dfhinPs:vV"; + static const char *sopt = "-bdfhinPs:vV"; static const struct option lopt[] = { + { "bad-sectors",no_argument, NULL, 'b' }, #ifdef DEBUG { "debug", no_argument, NULL, 'd' }, #endif @@ -431,6 +444,9 @@ static int parse_options(int argc, char **argv) else err++; break; + case 'b': + opt.badsectors++; + break; case 'd': opt.debug++; break; @@ -592,8 +608,10 @@ static s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) static int str2unicode(const char *aname, ntfschar **ustr, int *len) { - if (aname && ((*len = ntfs_mbstoucs(aname, ustr, 0)) == -1)) + if (aname && ((*len = ntfs_mbstoucs(aname, ustr, 0)) == -1)) { + perr_printf("Couldn't convert string to Unicode"); return -1; + } if (!*ustr || !*len) { *ustr = AT_UNNAMED; @@ -603,14 +621,19 @@ static int str2unicode(const char *aname, ntfschar **ustr, int *len) return 0; } -static int has_bad_sectors(ntfs_resize_t *resize) +static int has_bad_sectors(ntfs_resize_t *resize, int is_inode) { int len, ret = 0; ntfschar *ustr = NULL; ATTR_RECORD *a = resize->ctx->attr; - if (resize->ni->mft_no != FILE_BadClus) - return 0; + if (is_inode) { + if (resize->ni->mft_no != FILE_BadClus) + return 0; + } else { + if (resize->mref != FILE_BadClus) + return 0; + } if (str2unicode("$Bad", &ustr, &len) == -1) return -1; @@ -638,11 +661,17 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) inode = resize->ni->mft_no; flags = resize->ctx->attr->flags; - if ((ret = has_bad_sectors(resize)) != 0) { + if ((ret = has_bad_sectors(resize, 1)) != 0) { if (ret == -1) - perr_exit("Couldn't convert string to Unicode"); - err_exit("Your disk has bad sectors (manufacturing faults or " - "dying disk).\nThis situation isn't supported yet.\n"); + exit(1); + if (NInoAttrList(resize->ni)) + err_exit("Hopelessly many bad sectors! Not supported."); + if (resize->badclusters == 0) + printf("WARNING: The disk has bad sector! " + "This can cause reliability problems!\n"); + resize->badclusters += last_lcn - rl->lcn + 1; + Vprintf("Bad clusters: %8lld - %lld\n", rl->lcn, last_lcn); + return; } if (NInoAttrList(resize->ni)) { @@ -1576,12 +1605,21 @@ static void relocate_attribute(ntfs_resize_t *resize) static void relocate_attributes(ntfs_resize_t *resize) { + int ret; + if (!(resize->ctx = attr_get_search_ctx(NULL, resize->mrec))) exit(1); while (!ntfs_attrs_walk(resize->ctx)) { if (resize->ctx->attr->type == AT_END) break; + + ret = has_bad_sectors(resize, 0); + if (ret == -1) + exit(1); + else if (ret == 1) + return; + relocate_attribute(resize); } @@ -1679,6 +1717,36 @@ static void advise_on_resize(ntfs_resize_t *resize) print_advise(vol, resize->last_unsupp); } + +static void rl_expand(runlist **rl, const VCN last_vcn) +{ + int len; + runlist *p = *rl; + + len = rl_items(p); + if (len <= 1) + err_exit("ntfs_rl_expand: bad runlist length: %d\n", len); + + if (p[len - 2].lcn == LCN_HOLE) { + + p[len - 2].length += last_vcn - p[len - 1].vcn; + p[len - 1].vcn = last_vcn; + + } else if (p[len - 2].lcn >= 0) { + + p = realloc(*rl, ++len * sizeof(runlist_element)); + if (!p) + perr_exit("ntfs_rl_expand: realloc"); + + p[len - 2].lcn = LCN_HOLE; + p[len - 2].length = last_vcn - p[len - 2].vcn; + rl_set(p + len - 1, last_vcn, LCN_ENOENT, 0LL); + *rl = p; + + } else + err_exit("ntfs_rl_expand: bad LCN: %lld\n", p[len - 2].lcn); +} + /** * bitmap_file_data_fixup * @@ -1701,25 +1769,29 @@ static void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) */ static void truncate_badclust_bad_attr(ntfs_resize_t *resize) { + ATTR_RECORD *a; runlist *rl_bad; - ATTR_RECORD *a = resize->ctx->attr; s64 nr_clusters = resize->new_volume_size; ntfs_volume *vol = resize->vol; + a = resize->ctx->attr; if (!a->non_resident) /* FIXME: handle resident attribute value */ err_exit("Resident attribute in $BadClust isn't supported!\n"); - if (!(rl_bad = (runlist *)malloc(2 * sizeof(runlist_element)))) - perr_exit("Couldn't get memory"); + if (!(rl_bad = ntfs_mapping_pairs_decompress(vol, a, NULL))) + perr_exit("ntfs_mapping_pairs_decompress"); + + if (resize->shrink) { + if (ntfs_rl_truncate(&rl_bad, nr_clusters) == -1) + perr_exit("ntfs_rl_truncate"); + } else + rl_expand(&rl_bad, nr_clusters); a->highest_vcn = cpu_to_le64(nr_clusters - 1LL); a->allocated_size = cpu_to_le64(nr_clusters * vol->cluster_size); a->data_size = cpu_to_le64(nr_clusters * vol->cluster_size); - rl_set(rl_bad, 0LL, (LCN)LCN_HOLE, nr_clusters); - rl_set(rl_bad + 1, nr_clusters, -1LL, 0LL); - replace_attribute_runlist(vol, resize->ctx, rl_bad); free(rl_bad); @@ -1831,7 +1903,7 @@ static void lookup_data_attr(ntfs_volume *vol, exit(1); if (str2unicode(aname, &ustr, &len) == -1) - perr_exit("Unable to convert string to Unicode"); + exit(1); if (ntfs_attr_lookup(AT_DATA, ustr, len, 0, 0, NULL, 0, *ctx)) perr_exit("ntfs_lookup_attr"); @@ -2088,10 +2160,21 @@ static void set_disk_usage_constraint(ntfs_resize_t *resize) resize->last_unsupp = last; } -static void check_shrink_constraints(ntfs_resize_t *resize) +static void check_resize_constraints(ntfs_resize_t *resize) { s64 new_size = resize->new_volume_size; + if (resize->badclusters) { + printf("%sThe NTFS volume has at least %lld bad sector%s.\n", + !opt.badsectors ? NERR_PREFIX : "", + resize->badclusters, + resize->badclusters - 1 ? "s" : ""); + if (!opt.badsectors) { + printf(bad_sectors_warning_msg); + exit(1); + } + } + /* FIXME: resize.shrink true also if only -i is used */ if (!resize->shrink) return; @@ -2212,7 +2295,7 @@ int main(int argc, char **argv) set_resize_constrains(&resize); set_disk_usage_constraint(&resize); - check_shrink_constraints(&resize); + check_resize_constraints(&resize); if (opt.info) { advise_on_resize(&resize); From a32e3eca7ee1211ff841a6a8f29945aa7d275877 Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 4 Jul 2005 16:34:14 +0000 Subject: [PATCH 2325/2994] fix a few sign warnings --- ntfsprogs/ntfsmount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 32d1956a..26d144df 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -451,7 +451,7 @@ static int ntfs_fuse_getxattr(const char *path, const char *name, ntfschar *lename = NULL; if (strncmp(name, nf_ns_streams, nf_ns_streams_len) || - strlen(name) == nf_ns_streams_len) + strlen(name) == (size_t)nf_ns_streams_len) return -ENODATA; vol = ctx->vol; if (!vol) @@ -498,7 +498,7 @@ static int ntfs_fuse_setxattr(const char *path, const char *name, ntfschar *lename = NULL; if (strncmp(name, nf_ns_streams, nf_ns_streams_len) || - strlen(name) == nf_ns_streams_len) + strlen(name) == (size_t)nf_ns_streams_len) return -EACCES; vol = ctx->vol; if (!vol) @@ -552,7 +552,7 @@ static int ntfs_fuse_removexattr(const char *path, const char *name) ntfschar *lename = NULL; if (strncmp(name, nf_ns_streams, nf_ns_streams_len) || - strlen(name) == nf_ns_streams_len) + strlen(name) == (size_t)nf_ns_streams_len) return -ENODATA; vol = ctx->vol; if (!vol) From 7553a8da53c0ceaa6139bee92d5e80fcb2496ddc Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 5 Jul 2005 01:18:02 +0000 Subject: [PATCH 2326/2994] * ntfsmount: change default fmask and dmask to 0177 and 0077 respectively. * Update NEWS, ntfsprogs.8.in, .cvsignore * Update build system to install nftsmount man page. --- NEWS | 5 +++-- configure | 3 ++- configure.ac | 1 + ntfsprogs/.cvsignore | 1 + ntfsprogs/Makefile.am | 3 ++- ntfsprogs/Makefile.in | 14 +++++++++----- ntfsprogs/ntfsmount.c | 3 ++- ntfsprogs/ntfsprogs.8.in | 4 ++++ 8 files changed, 24 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 29ce324a..e6b1915f 100644 --- a/NEWS +++ b/NEWS @@ -3,8 +3,9 @@ Current news Add new utility - ntfsmount. It's a FUSE module that rely on libntfs. So, you need FUSE to compile it, xattr is also highly recommended. This module -support file overwrite changing it size and can list/read/write/add/remove -named data streams via xattr interface. (Yura) +support file overwrite changing it size and can read/write/add/remove +named data streams via "file:stream" interface and list them via +"ntfs.streams.list" extended attribute. (Yura) Attribute resize code for normal and sparse files is completed. Thus, ntfscp should always successfully overwrite any normal or sparse file even if file diff --git a/configure b/configure index 32d7c4eb..d9d9c3ae 100755 --- a/configure +++ b/configure @@ -23542,7 +23542,7 @@ done # Makefiles to be created by configure. - ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile include/ntfs/Makefile libntfs/Makefile libntfs/libntfs.conf libntfs/libntfs-gnomevfs.8 ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfscp.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" + ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile include/ntfs/Makefile libntfs/Makefile libntfs/libntfs.conf libntfs/libntfs-gnomevfs.8 ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfscp.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsmount.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -24138,6 +24138,7 @@ do "ntfsprogs/ntfsinfo.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsinfo.8" ;; "ntfsprogs/ntfslabel.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfslabel.8" ;; "ntfsprogs/ntfsls.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsls.8" ;; + "ntfsprogs/ntfsmount.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsmount.8" ;; "ntfsprogs/ntfsprogs.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsprogs.8" ;; "ntfsprogs/ntfsresize.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsresize.8" ;; "ntfsprogs/ntfsundelete.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsundelete.8" ;; diff --git a/configure.ac b/configure.ac index c103a09e..2a63edee 100644 --- a/configure.ac +++ b/configure.ac @@ -265,6 +265,7 @@ AC_CONFIG_FILES([ ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 + ntfsprogs/ntfsmount.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 diff --git a/ntfsprogs/.cvsignore b/ntfsprogs/.cvsignore index 049839c8..d3161032 100644 --- a/ntfsprogs/.cvsignore +++ b/ntfsprogs/.cvsignore @@ -12,6 +12,7 @@ ntfsinfo ntfslabel ntfsls ntfsmftalloc +ntfsmount ntfsmove ntfsresize ntfsrm diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 5358a34e..d8713bc6 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -19,7 +19,8 @@ EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove \ man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ - ntfsclone.8 ntfscluster.8 ntfscat.8 ntfscp.8 + ntfsclone.8 ntfscluster.8 ntfscat.8 ntfscp.8 \ + ntfsmount.8 EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index adb90dfe..43810251 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -54,8 +54,9 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/ntfsclone.8.in $(srcdir)/ntfscluster.8.in \ $(srcdir)/ntfscp.8.in $(srcdir)/ntfsfix.8.in \ $(srcdir)/ntfsinfo.8.in $(srcdir)/ntfslabel.8.in \ - $(srcdir)/ntfsls.8.in $(srcdir)/ntfsprogs.8.in \ - $(srcdir)/ntfsresize.8.in $(srcdir)/ntfsundelete.8.in + $(srcdir)/ntfsls.8.in $(srcdir)/ntfsmount.8.in \ + $(srcdir)/ntfsprogs.8.in $(srcdir)/ntfsresize.8.in \ + $(srcdir)/ntfsundelete.8.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -63,8 +64,8 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ - ntfscp.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsprogs.8 \ - ntfsresize.8 ntfsundelete.8 + ntfscp.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsmount.8 \ + ntfsprogs.8 ntfsresize.8 ntfsundelete.8 @ENABLE_FUSE_MODULE_TRUE@am__EXEEXT_1 = ntfsmount$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \ "$(DESTDIR)$(man8dir)" @@ -294,7 +295,8 @@ target_vendor = @target_vendor@ LINK = $(STATIC_LINK) $(LIBTOOL_LINK) man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ - ntfsclone.8 ntfscluster.8 ntfscat.8 ntfscp.8 + ntfsclone.8 ntfscluster.8 ntfscat.8 ntfscp.8 \ + ntfsmount.8 EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) @@ -410,6 +412,8 @@ ntfslabel.8: $(top_builddir)/config.status $(srcdir)/ntfslabel.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsls.8: $(top_builddir)/config.status $(srcdir)/ntfsls.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +ntfsmount.8: $(top_builddir)/config.status $(srcdir)/ntfsmount.8.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsprogs.8: $(top_builddir)/config.status $(srcdir)/ntfsprogs.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ntfsresize.8: $(top_builddir)/config.status $(srcdir)/ntfsresize.8.in diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 26d144df..63cac775 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -613,7 +613,8 @@ static int ntfs_fuse_init(void) .state = NF_FreeClustersOutdate | NF_FreeMFTOutdate, .uid = geteuid(), .gid = getegid(), - .fmask = 0111, + .fmask = 0177, + .dmask = 0077, }; return 0; } diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index 033a4c5e..502675df 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -51,6 +51,10 @@ or directories within it. .PP .BR ntfsls (8) : List information about files in a directory residing on an NTFS partition. +.SS ntfsmount +.PP +.BR ntfsmount (8) +: NTFS module for FUSE. .SS ntfsresize .PP .BR ntfsresize (8) From c3586d1d8cc5f8f38a6f49f02bf196041c71f082 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 5 Jul 2005 01:19:20 +0000 Subject: [PATCH 2327/2994] Submit ntfsmount manual page. As usual forgot "cvs new" before commit. :-) --- ntfsprogs/ntfsmount.8.in | 201 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 ntfsprogs/ntfsmount.8.in diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in new file mode 100644 index 00000000..b076b7b2 --- /dev/null +++ b/ntfsprogs/ntfsmount.8.in @@ -0,0 +1,201 @@ +.\" -*- nroff -*- +.\" Copyright (c) 2005 Yura Pakhuchiy. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH NTFSMOUNT 8 "July 2005" "ntfsprogs version @VERSION@" +.SH NAME +ntfsmount \- NTFS module for FUSE. +.SH SYNOPSIS +.BI "ntfsmount " mount_point " \-o " device "[," other_options "]" +.SH DESCRIPTION +.B ntfsmount +is a +.B FUSE +module that rely on +.B libntfs. +You need +.B FUSE +to compile it, +.B xattr +is also highly recommended. +.sp +.TP +.B NTFS FUSE features: + +* Full read/only access to normal, sparse and compressed files. + +* Can overwrite and change size of normal and sparse files. + +* Can list/read/write/add/remove named data streams. + +.SH OPTIONS +Below is a summary of all the options that +.B ntfsmount +accepts. + +.TP +.B uid=, gid=, umask= +Provide default owner, group, and access mode mask. +These options work as documented in mount(8). By +default, the files/directories are owned by user that mounted volume and +he/she has read and write permissions, as well as +browse permission for directories. No one else has any +access permissions. I.e. the mode on all files is by +default rw------- and for directories rwx------, a +consequence of the default fmask=0177 and dmask=0077. +Using a umask of zero will grant all permissions to +everyone, i.e. all files and directories will have mode +rwxrwxrwx. + +.TP +.B fmask=, dmask= +Instead of specifying umask which applies both to +files and directories, fmask applies only to files and +mask only to directories. + +.TP +.B show_sys_files +If show_sys_files is specified, show the system files +in directory listings. Otherwise the default behaviour +is to hide the system files. +Note that even when show_sys_files is specified, "$MFT" +may will not be visible due to bugs/mis-features in glibc. +Further, note that irrespective of show_sys_files, all +files are accessible by name, i.e. you can always do +"ls -l \$UpCase" for example to specifically show the +system file containing the Unicode upcase table. + +.TP +.B default_permissions +By default FUSE doesn't check file access permissions, the +filesystem is free to implement it's access policy or leave it to +the underlying file access mechanism (e.g. in case of network +filesystems). This option enables permission checking, restricting +access based on file mode. This is option is usually useful +together with the 'allow_other' mount option. + +.TP +.B allow_other +This option overrides the security measure restricting file access +to the user mounting the filesystem. This option is by default only +allowed to root, but this restriction can be removed with a +configuration option described in the previous section. + +.TP +.B kernel_cache +This option disables flushing the cache of the file contents on +every open(). This should only be enabled on filesystems, where the +file data is never changed externally (not through the mounted FUSE +filesystem). Thus it is not suitable for network filesystems and +other "intermediate" filesystems. + +NOTE: if this option is not specified (and neither 'direct_io') data +is still cached after the open(), so a read() system call will not +always initiate a read operation. + +.TP +.B large_read +Issue large read requests. This can improve performance for some +filesystems, but can also degrade performance. This option is only +useful on 2.4.X kernels, as on 2.6 kernels requests size is +automatically determined for optimum performance. + +.TP +.B direct_io +This option disables the use of page cache (file content cache) in +the kernel for this filesystem. This has several affects: + +- Each read() or write() system call will initiate one or more +read or write operations, data will not be cached in the +kernel. + +- The return value of the read() and write() system calls will +correspond to the return values of the read and write +operations. This is useful for example if the file size is not +known in advance (before reading it). + +.TP +.B max_read= +With this option the maximum size of read operations can be set. +The default is infinite. Note that the size of read requests is +limited anyway to 32 pages (which is 128kbyte on i386). + +.TP +.B fsname= +Sets the filesystem name. The default is the program name. + +.TP +.B ro +Mount filesystem read-only. + +.TP +.B no_def_opts +By default ntfsmount acts as "default_permissions,kernel_cache,allow_other,fsname=ntfs#device" was passed to it, this option cancel this behaviour. + +.TP +.B dev= +Mount this device. + +.SH DATA STREAMS +All data on NTFS is stored in streams, which can have names. A file can have more than one data streams, but exactly one must have no name. The size of a file is the size of its unnamed data stream. Usually when you don't specify stream name you are access to unnamed data stream. If you want access to named data stream you need to add ":stream_name" to the filename. For example: by opening "some.mp3:artist" you will open stream "artist" in "some.mp3". But windows usually prevent you from accessing to named data streams, so you need to use some program like FAR or utils from cygwin to access named data streams. +.sp +NTFS FUSE module don't prevent you from accessing to named data streams so you can use your preferred utils to access them. You can even delete them using +.B rm. +You can list all named data streams by getting "ntfs.streams.list" extended attribute. NOTE: The last feauture is unique for NTFS FUSE module and maybe will be never supported by kernel driver. +.SH EXAMPLES +Mount /dev/hda1 to /mnt/ntfs-fuse using NTFS FUSE module: +.RS +.sp +.B ntfsmount /mnt/ntfs-fuse -o dev=/dev/hda1 +.sp +.RE +Read-only mount /dev/hda5 to /home/user/tmp and make root to be owner of all files: +.RS +.sp +.B ntfsmount /home/user/tmp -o dev=/dev/hda5,ro,uid=0 +.sp +.RE +Cat "artist" named data of "some.mp3": +.RS +.sp +.B cat some.mp3:artist +.sp +.RE +Write "Sympho Black Metal" to "genre" named data stream of "some.mp3": +.RS +.sp +.B echo Sympho Black Metal > some.mp3:genre +.sp +.RE +Remove "album" named data stream from "some.mp3": +.RS +.sp +.B rm some.mp3:album +.sp +.RE +List all named data streams for "some.mp3": +.RS +.sp +.B getfattr -n ntfs.streams.list some.mp3 +.SH BUGS +No bugs are known at present. If you find any bugs, please send an email to +.nh +. +.hy +.SH AUTHOR +.B ntfsmount +was written by Yura Pakhuchiy. This manual page use information from Documentation/filesystems/ntfs.txt from linux kernel source, and from README from FUSE. +.SH DEDICATION +With love to Marina Sapego. +.SH THANKS +Many thanks to Miklos Szeredi for advices and answers about FUSE. +.SH AVAILABILITY +.B ntfsmount +is part of the ntfsprogs package and is available from +.br +.nh +http://linux\-ntfs.sourceforge.net/downloads.html. +.hy +.SH SEE ALSO +.BR "ntfsprogs" (8), " attr" (5), " getfattr" (1) + From eb3639e0be8b18255dd19c676feb690fa39c7dbb Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 5 Jul 2005 04:54:28 +0000 Subject: [PATCH 2328/2994] ntfsmount: * Fix named data streams access interface. * New option: succeed_chmod to avoid chmod errors. --- ntfsprogs/ntfsmount.8.in | 12 +- ntfsprogs/ntfsmount.c | 366 +++++++++++++++++++++++++++++++++------ 2 files changed, 321 insertions(+), 57 deletions(-) diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index b076b7b2..7739b1c5 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -132,6 +132,10 @@ Mount filesystem read-only. .B no_def_opts By default ntfsmount acts as "default_permissions,kernel_cache,allow_other,fsname=ntfs#device" was passed to it, this option cancel this behaviour. +.TP +.B succeed_chmod +Don't change any permissions and don't return error on chmod operation. + .TP .B dev= Mount this device. @@ -155,7 +159,13 @@ Read-only mount /dev/hda5 to /home/user/tmp and make root to be owner of all fil .B ntfsmount /home/user/tmp -o dev=/dev/hda5,ro,uid=0 .sp .RE -Cat "artist" named data of "some.mp3": +Umount /mnt/ntfs-fuse: +.RS +.sp +.B fusermount -u /mnt/ntfs-fuse +.sp +.RE +Cat "artist" named data stream of "some.mp3": .RS .sp .B cat some.mp3:artist diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 63cac775..1892c8fd 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -60,6 +60,7 @@ typedef struct { mode_t dmask; BOOL ro; BOOL show_sys_files; + BOOL succeed_chmod; } ntfs_fuse_context_t; typedef enum { @@ -193,17 +194,59 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), return 0; } -static int ntfs_fuse_getattr(const char *path, struct stat *stbuf) +/** + * ntfs_fuse_parse_path - split path to path and stream name. + * @org_path: path to split + * @path: pointer to buffer in which parsed path saved + * @stream_name: pointer to buffer where stream name in unicode saved + * + * This function allocates buffers for @*path and @*stream, user must free them + * after use. + * + * Return values: + * <0 Error occured, return -errno; + * 0 No stream name, @*stream is not allocated and set to AT_UNMAMED. + * >0 Stream name length in unicode characters. + */ +static int ntfs_fuse_parse_path(const char *org_path, char **path, + ntfschar **stream_name) +{ + char *stream_name_mbs; + int res; + + stream_name_mbs = strdup(org_path); + if (!stream_name_mbs) + return -errno; + *path = strsep(&stream_name_mbs, ":"); + if (stream_name_mbs) { + *stream_name = NULL; + res = ntfs_mbstoucs(stream_name_mbs, stream_name, 0); + if (res < 0) + return -errno; + return res; + } + *stream_name = AT_UNNAMED; + return 0; +} + +static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) { int res = 0; ntfs_inode *ni; ntfs_attr *na; ntfs_volume *vol; + char *path = NULL; + ntfschar *stream_name; + int stream_name_len; vol = ctx->vol; + stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); + if (stream_name_len < 0) + return stream_name_len; memset(stbuf, 0, sizeof(struct stat)); if ((ni = ntfs_pathname_to_inode(vol, NULL, path))) { - if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) { + if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY && + !stream_name_len) { stbuf->st_mode = S_IFDIR | (0777 & ~ctx->dmask); na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, I30, 0); if (na) { @@ -217,7 +260,8 @@ static int ntfs_fuse_getattr(const char *path, struct stat *stbuf) } } else { stbuf->st_mode = S_IFREG | (0777 & ~ctx->fmask); - na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); + na = ntfs_attr_open(ni, AT_DATA, stream_name, + stream_name_len); if (na) { stbuf->st_size = na->data_size; stbuf->st_blocks = na->allocated_size >> @@ -226,6 +270,8 @@ static int ntfs_fuse_getattr(const char *path, struct stat *stbuf) } else { stbuf->st_size = 0; stbuf->st_blocks = 0; + if (stream_name_len) + res = -ENOENT; } } stbuf->st_uid = ctx->uid; @@ -241,6 +287,9 @@ static int ntfs_fuse_getattr(const char *path, struct stat *stbuf) ntfs_inode_close(ni); } else res = -ENOENT; + free(path); + if (stream_name_len) + free(stream_name); return res; } @@ -278,8 +327,6 @@ static int ntfs_fuse_readdir(const char *path, void *buf, s64 pos = 0; vol = ctx->vol; - if (!vol) - return -ENODEV; fill_ctx.filler = filler; fill_ctx.buf = buf; ni = ntfs_pathname_to_inode(vol, NULL, path); @@ -290,103 +337,296 @@ static int ntfs_fuse_readdir(const char *path, void *buf, return 0; } -static int ntfs_fuse_open(const char *path, +static int ntfs_fuse_open(const char *org_path, struct fuse_file_info *fi __attribute__((unused))) { ntfs_volume *vol; ntfs_inode *ni; - + ntfs_attr *na; + int res = 0; + char *path = NULL; + ntfschar *stream_name; + int stream_name_len; + + stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); + if (stream_name_len < 0) + return stream_name_len; vol = ctx->vol; - if (!vol) - return -ENODEV; ni = ntfs_pathname_to_inode(vol, NULL, path); - if (!ni) - return -errno; - ntfs_inode_close(ni); - return 0; + if (ni) { + if (stream_name_len) { + na = ntfs_attr_open(ni, AT_DATA, stream_name, + stream_name_len); + if (na) + ntfs_attr_close(na); + else + res = -errno; + } + ntfs_inode_close(ni); + } else + res = -errno; + free(path); + if (stream_name_len) + free(stream_name); + return res; } -static int ntfs_fuse_read(const char *path, char *buf, size_t size, +static int ntfs_fuse_read(const char *org_path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi __attribute__((unused))) { ntfs_volume *vol; - ntfs_inode *ni; + ntfs_inode *ni = NULL; ntfs_attr *na; int res; - + char *path = NULL; + ntfschar *stream_name; + int stream_name_len; + + stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); + if (stream_name_len < 0) + return stream_name_len; vol = ctx->vol; - if (!vol) - return -ENODEV; ni = ntfs_pathname_to_inode(vol, NULL, path); - if (!ni) - return -errno; - na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); - if (!na) - return -errno; + if (!ni) { + res = -errno; + goto exit; + } + na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); + if (!na) { + res = -errno; + goto exit; + } res = ntfs_attr_pread(na, offset, size, buf); ntfs_attr_close(na); - if (ntfs_inode_close(ni)) +exit: + if (ni && ntfs_inode_close(ni)) perror("Failed to close inode"); + free(path); + if (stream_name_len) + free(stream_name); return res; } -static int ntfs_fuse_write(const char *path, const char *buf, size_t size, +static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, off_t offset, struct fuse_file_info *fi __attribute__((unused))) { ntfs_volume *vol; - ntfs_inode *ni; + ntfs_inode *ni = NULL; ntfs_attr *na; int res; - + char *path = NULL; + ntfschar *stream_name; + int stream_name_len; + + stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); + if (stream_name_len < 0) + return stream_name_len; vol = ctx->vol; - if (!vol) - return -ENODEV; ni = ntfs_pathname_to_inode(vol, NULL, path); - if (!ni) - return -errno; - na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); - if (!na) - return -errno; - res = ntfs_attr_pwrite(na, offset, size, buf); - ntfs_attr_close(na); - if (ntfs_inode_close(ni)) - perror("Failed to close inode"); + if (!ni) { + res = -errno; + goto exit; + } + na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); + if (!na) { + res = -errno; + goto exit; + } + res = ntfs_attr_pwrite(na, offset, size, buf); ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + ntfs_attr_close(na); +exit: + if (ni && ntfs_inode_close(ni)) + perror("Failed to close inode"); + free(path); + if (stream_name_len) + free(stream_name); return res; } -static int ntfs_fuse_truncate(const char *path, off_t size) +static int ntfs_fuse_truncate(const char *org_path, off_t size) { ntfs_volume *vol; - ntfs_inode *ni; + ntfs_inode *ni = NULL; ntfs_attr *na; int res; - + char *path = NULL; + ntfschar *stream_name; + int stream_name_len; + + stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); + if (stream_name_len < 0) + return stream_name_len; vol = ctx->vol; - if (!vol) - return -ENODEV; ni = ntfs_pathname_to_inode(vol, NULL, path); - if (!ni) - return -errno; - na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); - if (!na) - return -errno; + if (!ni) { + res = -errno; + goto exit; + } + na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); + if (!na) { + res = -errno; + goto exit; + } res = ntfs_attr_truncate(na, size); - ntfs_attr_close(na); - if (ntfs_inode_close(ni)) - perror("Failed to close inode"); ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + ntfs_attr_close(na); +exit: + if (ni && ntfs_inode_close(ni)) + perror("Failed to close inode"); + free(path); + if (stream_name_len) + free(stream_name); return res; } static int ntfs_fuse_chmod(const char *path __attribute__((unused)), mode_t mode __attribute__((unused))) { - return 0; + if (ctx->succeed_chmod) + return 0; + return -EOPNOTSUPP; +} + +static int ntfs_fuse_mknod(const char *org_path, mode_t mode, + dev_t dev __attribute__((unused))) +{ + ntfs_inode *ni = NULL; + ntfs_attr *na; + char *path = NULL; + ntfschar *stream_name; + int stream_name_len; + int res = 0; + + if (mode && !(mode & S_IFREG)) + return -EOPNOTSUPP; + stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); + if (stream_name_len < 0) + return stream_name_len; + if (!stream_name_len) { + res = -EOPNOTSUPP; + goto exit; + } + ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + if (!ni) { + res = -errno; + if (res == -ENOENT) + res = -EOPNOTSUPP; + goto exit; + } + na = ntfs_attr_add(ni, AT_DATA, stream_name, stream_name_len, 0); + if (na) + ntfs_attr_close(na); + else + res = -errno; +exit: + if (ni && ntfs_inode_close(ni)) + perror("Failed to close inode"); + free(path); + if (stream_name_len) + free(stream_name); + return res; +} + +static int ntfs_fuse_unlink(const char *org_path) +{ + ntfs_inode *ni = NULL; + ntfs_attr *na; + char *path = NULL; + ntfschar *stream_name; + int stream_name_len; + int res = 0; + + stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); + if (stream_name_len < 0) + return stream_name_len; + if (!stream_name_len) { + res = -EOPNOTSUPP; + goto exit; + } + ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + if (!ni) { + res = -errno; + if (res == -ENOENT) + res = -EOPNOTSUPP; + goto exit; + } + na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); + if (!na) { + res = -errno; + goto exit; + } + if (ntfs_attr_rm(na)) { + res = -errno; + ntfs_attr_close(na); + } +exit: + if (ni && ntfs_inode_close(ni)) + perror("Failed to close inode"); + free(path); + if (stream_name_len) + free(stream_name); + return res; } #ifdef HAVE_SETXATTR +static int ntfs_fuse_getxattr(const char *path, const char *name, + char *value, size_t size) +{ + ntfs_attr_search_ctx *actx = NULL; + ntfs_volume *vol; + ntfs_inode *ni; + char *to = value; + int ret = 0; + + if (strcmp(name, "ntfs.streams.list")) + return -EOPNOTSUPP; + vol = ctx->vol; + if (!vol) + return -ENODEV; + ni = ntfs_pathname_to_inode(vol, NULL, path); + if (!ni) + return -errno; + actx = ntfs_attr_get_search_ctx(ni, NULL); + if (!actx) { + ret = -errno; + ntfs_inode_close(ni); + goto exit; + } + while (!ntfs_attr_lookup(AT_DATA, NULL, 0, CASE_SENSITIVE, + 0, NULL, 0, actx)) { + if (!actx->attr->name_length) + continue; + if (ret) + ret++; + ret += actx->attr->name_length; + if ((size_t)ret <= size) { + if (to != value) { + *to = ' '; + to++; + } + if (ntfs_ucstombs((ntfschar *)((u8*)actx->attr + + le16_to_cpu(actx->attr->name_offset)), + actx->attr->name_length, &to, + actx->attr->name_length + 1) < 0) { + ret = -errno; + goto exit; + } + to += actx->attr->name_length; + } + } + if (errno != ENOENT) + ret = -errno; +exit: + if (actx) + ntfs_attr_put_search_ctx(actx); + ntfs_inode_close(ni); + return ret; +} + +#if 0 + static const char nf_ns_streams[] = "user.stream."; static const int nf_ns_streams_len = 12; @@ -583,7 +823,10 @@ exit: perror("Failed to close inode"); return res; } -#endif + +#endif /* 0 */ + +#endif /* HAVE_SETXATTR */ static struct fuse_operations ntfs_fuse_oper = { .getattr = ntfs_fuse_getattr, @@ -594,12 +837,16 @@ static struct fuse_operations ntfs_fuse_oper = { .truncate = ntfs_fuse_truncate, .statfs = ntfs_fuse_statfs, .chmod = ntfs_fuse_chmod, + .mknod = ntfs_fuse_mknod, + .unlink = ntfs_fuse_unlink, #ifdef HAVE_SETXATTR - .listxattr = ntfs_fuse_listxattr, .getxattr = ntfs_fuse_getxattr, +#if 0 .setxattr = ntfs_fuse_setxattr, .removexattr = ntfs_fuse_removexattr, -#endif + .listxattr = ntfs_fuse_listxattr, +#endif /* 0 */ +#endif /* HAVE_SETXATTR */ }; static int ntfs_fuse_init(void) @@ -741,6 +988,13 @@ static char *parse_options(char *options, char **device) goto err_exit; } ctx->show_sys_files = TRUE; + } else if (!strcmp(opt, "succeed_chmod")) { + if (val) { + Eprintf("succeed_chmod option should not " + "have value.\n"); + goto err_exit; + } + ctx->succeed_chmod = TRUE; } else { /* Probably FUSE option. */ strcat(ret, opt); if (val) { @@ -778,7 +1032,7 @@ static void usage(void) Eprintf("Possible options are:\n\tdefault_permissions\n\tallow_other\n" "\tkernel_cache\n\tlarge_read\n\tdirect_io\n\tmax_read\n\t" "fsname\n\tro\n\tno_def_opts\n\tumask\n\tfmask\n\tdmask\n\t" - "uid\n\tgid\n\tshow_sys_files\n\tdev\n\n"); + "uid\n\tgid\n\tshow_sys_files\n\tsucceed_chmod\n\tdev\n\n"); Eprintf("Default options are: \"%sfsname=ntfs#device\".\n", def_opts); } From 1a088a4fdf99a4f90fe9279747a9b99e232ed4d8 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 5 Jul 2005 05:04:31 +0000 Subject: [PATCH 2329/2994] NEWS: update my name to be in format similar to names in other news. --- NEWS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index e6b1915f..7065a20b 100644 --- a/NEWS +++ b/NEWS @@ -5,11 +5,11 @@ Add new utility - ntfsmount. It's a FUSE module that rely on libntfs. So, you need FUSE to compile it, xattr is also highly recommended. This module support file overwrite changing it size and can read/write/add/remove named data streams via "file:stream" interface and list them via -"ntfs.streams.list" extended attribute. (Yura) +"ntfs.streams.list" extended attribute. (Yura Pakhuchiy) Attribute resize code for normal and sparse files is completed. Thus, ntfscp should always successfully overwrite any normal or sparse file even if file -size is changed. +size is changed. (Yura Pakhuchiy) Moved back from BitKeeper to CVS on SF.net. From cb13f36956ff4c16703cdfed3ee45ef72535e84f Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 5 Jul 2005 16:34:15 +0000 Subject: [PATCH 2330/2994] Fix typos, patch from debian version of nftsprogs 1.9.4-2. --- include/ntfs/types.h | 2 +- libntfs/attrib.c | 2 +- ntfsprogs/ntfscluster.8.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ntfs/types.h b/include/ntfs/types.h index 5a7bc85e..29b62f25 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -70,7 +70,7 @@ typedef s64 LSN; typedef sle64 leLSN; /* - * Cygwin has a collusion between our BOOL and 's + * Cygwin has a collision between our BOOL and 's * As long as this file will be included after were fine. */ #ifndef _WINDEF_H diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 75867e35..dacb7412 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -83,7 +83,7 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, } /* Complex attribute? */ if (a->flags) { - Dputs("Enountered non-zero attribute flags. Cannot handle " + Dputs("Encountered non-zero attribute flags. Cannot handle " "this yet."); errno = ENOTSUP; return 0; diff --git a/ntfsprogs/ntfscluster.8.in b/ntfsprogs/ntfscluster.8.in index e9bac1bb..763e7b47 100644 --- a/ntfsprogs/ntfscluster.8.in +++ b/ntfsprogs/ntfscluster.8.in @@ -21,7 +21,7 @@ and .PP The default mode, .I info -is currently not implemented. It will display general infomation about the NTFS +is currently not implemented. It will display general information about the NTFS volume when it is working. .SS Sector .PP From 7a142ef54c3c02fbbb9e5e1b71b84767795e2436 Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 6 Jul 2005 22:47:01 +0000 Subject: [PATCH 2331/2994] got bored. don't read the diffs. --- include/ntfs/attrib.h | 10 +-- include/ntfs/compat.h | 2 +- include/ntfs/index.h | 4 +- include/ntfs/layout.h | 26 +++---- include/ntfs/logfile.h | 4 +- libntfs/attrib.c | 134 +++++++++++++++++------------------ libntfs/attrlist.c | 20 +++--- libntfs/collate.c | 2 +- libntfs/compat.c | 2 +- libntfs/device.c | 2 +- libntfs/dir.c | 4 +- libntfs/index.c | 4 +- libntfs/inode.c | 38 +++++----- libntfs/logfile.c | 8 +-- libntfs/mft.c | 18 ++--- libntfs/mst.c | 4 +- libntfs/runlist.c | 4 +- libntfs/unistr.c | 2 +- libntfs/unix_io.c | 6 +- libntfs/volume.c | 4 +- ntfsprogs/mkntfs.c | 8 +-- ntfsprogs/ntfscp.c | 2 +- ntfsprogs/ntfsdump_logfile.c | 2 +- ntfsprogs/ntfsinfo.c | 30 ++++---- ntfsprogs/ntfsls.c | 4 +- ntfsprogs/ntfsmftalloc.c | 4 +- ntfsprogs/ntfsmount.c | 4 +- ntfsprogs/ntfsmove.c | 2 +- ntfsprogs/ntfsresize.c | 16 ++--- ntfsprogs/ntfsrm.c | 4 +- ntfsprogs/ntfstruncate.c | 4 +- ntfsprogs/ntfsundelete.c | 2 +- ntfsprogs/ntfsundelete.h | 2 +- ntfsprogs/ntfswipe.c | 14 ++-- ntfsprogs/sd.c | 8 +-- 35 files changed, 202 insertions(+), 202 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 57980249..b9f93688 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -115,7 +115,7 @@ extern ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol, * // with it and then just continue with the while loop. * } * if (err && errno != ENOENT) - * // Ooops. An error occured! You should handle this case. + * // Ooops. An error occurred! You should handle this case. * // Now finished with all attributes in the inode. */ static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx) @@ -131,7 +131,7 @@ static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx) * @type: attribute type * @name: Unicode name of the attribute * @name_len: length of @name in Unicode characters - * @state: NTFS attribute specific flags descibing this attribute + * @state: NTFS attribute specific flags describing this attribute * @allocated_size: copy from the attribute record * @data_size: copy from the attribute record * @initialized_size: copy from the attribute record @@ -154,16 +154,16 @@ static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx) * * @rl is the decompressed runlist of the attribute described by this * structure. Obviously this only makes sense if the attribute is not resident, - * i.e. NAttrNonResident() is true. If the runlist hasn't been decomressed yet + * i.e. NAttrNonResident() is true. If the runlist hasn't been decompressed yet * @rl is NULL, so be prepared to cope with @rl == NULL. * * @ni is the base ntfs inode of the attribute described by this structure. * * @type is the attribute type (see layout.h for the definition of ATTR_TYPES), * @name and @name_len are the little endian Unicode name and the name length - * in Unicode characters of the attribute, respecitvely. + * in Unicode characters of the attribute, respectively. * - * @state contains NTFS attribute specific flags descibing this attribute + * @state contains NTFS attribute specific flags describing this attribute * structure. See ntfs_attr_state_bits above. */ struct _ntfs_attr { diff --git a/include/ntfs/compat.h b/include/ntfs/compat.h index 156cc515..29d4797a 100644 --- a/include/ntfs/compat.h +++ b/include/ntfs/compat.h @@ -1,5 +1,5 @@ /* - * compat.h - Tweaks for Windows compatability. + * compat.h - Tweaks for Windows compatibility. * * Copyright (c) 2002 Richard Russon * Copyright (c) 2002-2004 Anton Altaparmakov diff --git a/include/ntfs/index.h b/include/ntfs/index.h index ba99bc97..d7bfbc6f 100644 --- a/include/ntfs/index.h +++ b/include/ntfs/index.h @@ -53,12 +53,12 @@ * * If @is_in_root is TRUE, @entry is in the index root attribute @ir described * by the attribute search context @actx and inode @ni. @ia, @ia_vcn and - * @ia_dirty are undifined in this case. + * @ia_dirty are undefined in this case. * * If @is_in_root is FALSE, @entry is in the index allocation attribute and @ia * and @ia_vcn point to the index allocation block and VCN where it's placed, * respectively. @ir and @actx are NULL in this case. @ia_na is opened - * INDEX_ALLOCTAION attribute. @ia_dirty is TRUE if index block was changed and + * INDEX_ALLOCATION attribute. @ia_dirty is TRUE if index block was changed and * FALSE otherwise. * * To obtain a context call ntfs_index_ctx_get(). diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 968c60de..027a04d6 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -171,7 +171,7 @@ typedef enum { * been written to disk. The values 0 and -1 (ie. 0xffff) are not used. All * last u16's of each sector have to be equal to the usn (during reading) or * are set to it (during writing). If they are not, an incomplete multi sector - * transfer has occured when the data was written. + * transfer has occurred when the data was written. * The maximum size for the update sequence array is fixed to: * maximum size = usa_ofs + (usa_count * 2) = 510 bytes * The 510 bytes comes from the fact that the last u16 in the array has to @@ -279,7 +279,7 @@ typedef enum { * fragmented. Volume free space includes the empty part of the mft zone and * when the volume's free 88% are used up, the mft zone is shrunk by a factor * of 2, thus making more space available for more files/data. This process is - * repeated everytime there is no more free space except for the mft zone until + * repeated every time there is no more free space except for the mft zone until * there really is no more free space. */ @@ -951,7 +951,7 @@ typedef struct { * itself. The list is sorted: first by attribute type, second by attribute * name (if present), third by instance number. The extents of one * non-resident attribute (if present) immediately follow after the initial - * extent. They are ordered by lowest_vcn and have their instace set to zero. + * extent. They are ordered by lowest_vcn and have their instance set to zero. * It is not allowed to have two attributes with all sorting keys equal. * - Further restrictions: * - If not resident, the vcn to lcn mapping array has to fit inside the @@ -1522,7 +1522,7 @@ typedef enum { * Write access. For files, this maps onto: * FILE_APPEND_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_DATA | * FILE_WRITE_EA | STANDARD_RIGHTS_WRITE | SYNCHRONIZE - * For directories, the mapping has the same numberical value. See + * For directories, the mapping has the same numerical value. See * above for the descriptions of the rights granted. */ GENERIC_WRITE = const_cpu_to_le32(0x40000000), @@ -1531,7 +1531,7 @@ typedef enum { * Read access. For files, this maps onto: * FILE_READ_ATTRIBUTES | FILE_READ_DATA | FILE_READ_EA | * STANDARD_RIGHTS_READ | SYNCHRONIZE - * For directories, the mapping has the same numberical value. See + * For directories, the mapping has the same numerical value. See * above for the descriptions of the rights granted. */ GENERIC_READ = const_cpu_to_le32(0x80000000), @@ -1633,14 +1633,14 @@ typedef enum { * SID pointed to by the Owner field was provided by a * defaulting mechanism rather than explicitly provided by the * original provider of the security descriptor. This may - * affect the treatment of the SID with respect to inheritence + * affect the treatment of the SID with respect to inheritance * of an owner. * * SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the * SID in the Group field was provided by a defaulting mechanism * rather than explicitly provided by the original provider of * the security descriptor. This may affect the treatment of - * the SID with respect to inheritence of a primary group. + * the SID with respect to inheritance of a primary group. * * SE_DACL_PRESENT - This boolean flag, when set, indicates that the * security descriptor contains a discretionary ACL. If this @@ -1651,7 +1651,7 @@ typedef enum { * ACL pointed to by the Dacl field was provided by a defaulting * mechanism rather than explicitly provided by the original * provider of the security descriptor. This may affect the - * treatment of the ACL with respect to inheritence of an ACL. + * treatment of the ACL with respect to inheritance of an ACL. * This flag is ignored if the DaclPresent flag is not set. * * SE_SACL_PRESENT - This boolean flag, when set, indicates that the @@ -1664,7 +1664,7 @@ typedef enum { * ACL pointed to by the Sacl field was provided by a defaulting * mechanism rather than explicitly provided by the original * provider of the security descriptor. This may affect the - * treatment of the ACL with respect to inheritence of an ACL. + * treatment of the ACL with respect to inheritance of an ACL. * This flag is ignored if the SaclPresent flag is not set. * * SE_SELF_RELATIVE - This boolean flag, when set, indicates that the @@ -1791,7 +1791,7 @@ typedef SECURITY_DESCRIPTOR_RELATIVE SECURITY_DESCRIPTOR_ATTR; * matching hash is found, but the security descriptors do not match, the * search in the $SDH index is continued, searching for a next matching hash. * - * When a precise match is found, the security_id coresponding to the security + * When a precise match is found, the security_id corresponding to the security * descriptor in the $SDS attribute is read from the found $SDH index entry and * is stored in the $STANDARD_INFORMATION attribute of the file/directory to * which the security descriptor is being applied. The $STANDARD_INFORMATION @@ -1968,14 +1968,14 @@ typedef struct { * * When a directory is small enough to fit inside the index root then this * is the only attribute describing the directory. When the directory is too - * large to fit in the index root, on the other hand, two aditional attributes + * large to fit in the index root, on the other hand, two additional attributes * are present: an index allocation attribute, containing sub-nodes of the B+ * directory tree (see below), and a bitmap attribute, describing which virtual * cluster numbers (vcns) in the index allocation attribute are in use by an * index block. * * NOTE: The root directory (FILE_root) contains an entry for itself. Other - * dircetories do not contain entries for themselves, though. + * directories do not contain entries for themselves, though. */ typedef struct { ATTR_TYPES type; /* Type of the indexed attribute. Is @@ -2244,7 +2244,7 @@ typedef struct { * * The reparse point tag is an unsigned 32-bit value divided in three parts: * - * 1. The least significant 16 bits (i.e. bits 0 to 15) specifiy the type of + * 1. The least significant 16 bits (i.e. bits 0 to 15) specify the type of * the reparse point. * 2. The 13 bits after this (i.e. bits 16 to 28) are reserved for future use. * 3. The most significant three bits are flags describing the reparse point. diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index 9282c6fb..0fde8d13 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -124,7 +124,7 @@ typedef struct { when the restart area was last written. This happens often but what is the interval? Is it just fixed time or is it every time a - check point is written or somethine else? + check point is written or something else? On create set to 0. */ /* 8*/ le16 log_clients; /* Number of log client records in the array of log client records which follows this @@ -217,7 +217,7 @@ typedef struct { /* 24*/ sle64 file_size; /* Usable byte size of the log file. If the restart_area_offset + the offset of the file_size are > 510 then corruption has - occured. This is the very first check when + occurred. This is the very first check when starting with the restart_area as if it fails it means that some of the above values will be corrupted by the multi sector diff --git a/libntfs/attrib.c b/libntfs/attrib.c index dacb7412..5e037dd2 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -264,7 +264,7 @@ static __inline__ void __ntfs_attr_init(ntfs_attr *na, ntfs_inode *ni, * @na: * @non_resident: * @compressed: - * @ecnrypted: + * @encrypted: * @sparse: * @allocated_size: * @data_size: @@ -1105,7 +1105,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) /* The buffer is non zero, instantiate the hole. */ cur_vcn = rl->vcn; from_vcn = rl->vcn + (ofs >> vol->cluster_size_bits); - Dprintf("%s(): Isntantiate the hole with vcn 0x%llx.\n", + Dprintf("%s(): Instantiate the hole with vcn 0x%llx.\n", __FUNCTION__, cur_vcn); /* * Search backwards to find the best lcn to start @@ -1154,7 +1154,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) if (ntfs_cluster_free_from_rl(vol, rlc)) { Dprintf("%s(): Failed to free just " "allocated clusters. Leaving " - "inconsist metadata. " + "inconstant metadata. " "Run chkdsk", __FUNCTION__); } errno = eo; @@ -1167,7 +1167,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) /* * It's definitely a BUG, if we failed to find * @cur_vcn, because we missed it during - * instatiating of the hole. + * instantiating of the hole. */ Dprintf("%s(): BUG! Failed to find run after " "instantiating. Please report to the " @@ -1179,7 +1179,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) /* If leaved part of the hole go to the next run. */ if (rl->lcn < 0) rl++; - /* Now LCN should shoudn't be lesser than 0. */ + /* Now LCN shoudn't be less than 0. */ if (rl->lcn < 0) { Dprintf("%s(): BUG! LCN is lesser than 0. " "Please report to the " @@ -1494,7 +1494,7 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, * but not AT_UNNAMED search for a named attribute matching @name. Otherwise, * match both named and unnamed attributes. * - * If @ic is IGNORE_CASE, the @name comparisson is not case sensitive and + * If @ic is IGNORE_CASE, the @name comparison is not case sensitive and * @ctx->ntfs_ino must be set to the ntfs inode to which the mft record * @ctx->mrec belongs. This is so we can get at the ntfs volume and hence at * the upcase table. If @ic is CASE_SENSITIVE, the comparison is case @@ -2260,7 +2260,7 @@ void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) * @type in the $AttrDef system file. * * Return the attribute type definition record if found and NULL if not found - * or an error occured. On error the error code is stored in errno. The + * or an error occurred. On error the error code is stored in errno. The * following error codes are defined: * ENOENT - The attribute @type is not specified in $AttrDef. * EINVAL - Invalid parameters (e.g. @vol is not valid). @@ -2299,7 +2299,7 @@ ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol, * Check whether the @size in bytes is valid for an attribute of @type on the * ntfs volume @vol. This information is obtained from $AttrDef system file. * - * Return 0 if valid and -1 if not valid or an error occured. On error the + * Return 0 if valid and -1 if not valid or an error occurred. On error the * error code is stored in errno. The following error codes are defined: * ERANGE - @size is not valid for the attribute @type. * ENOENT - The attribute @type is not specified in $AttrDef. @@ -2348,7 +2348,7 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type, * be non-resident. This information is obtained from $AttrDef system file. * * Return 0 if the attribute is allowed to be non-resident and -1 if not or an - * error occured. On error the error code is stored in errno. The following + * error occurred. On error the error code is stored in errno. The following * error codes are defined: * EPERM - The attribute is not allowed to be non-resident. * ENOENT - The attribute @type is not specified in $AttrDef. @@ -2382,7 +2382,7 @@ int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type) * allocation and extended attribute attributes. * * Return 0 if the attribute is allowed to be resident and -1 if not or an - * error occured. On error the error code is stored in errno. The following + * error occurred. On error the error code is stored in errno. The following * error codes are defined: * EPERM - The attribute is not allowed to be resident. * EINVAL - Invalid parameters (e.g. @vol is not valid). @@ -2425,7 +2425,7 @@ int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) Dprintf("%s(): Entering for pos 0x%d, size %u.\n", __FUNCTION__, (int)(pos - (u8*)m), (unsigned) size); - /* Make size 8-byte aligment. */ + /* Make size 8-byte alignment. */ size = (size + 7) & ~7; /* Rigorous consistency checks. */ @@ -2467,9 +2467,9 @@ int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) * Return offset to attribute from the beginning of the mft record on success * and -1 on error. On error the error code is stored in errno. * Possible error codes are: - * EINVAL - Invalid argumets passed to function. + * EINVAL - Invalid arguments passed to function. * EEXIST - Attribute of such type and with same name already exists. - * EIO - I/O error occured or damaged filesystem. + * EIO - I/O error occurred or damaged filesystem. */ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ntfschar *name, u8 name_len, ATTR_FLAGS flags) @@ -2502,7 +2502,7 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, return -1; } - /* Locate place where record shoud be. */ + /* Locate place where record should be. */ ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); if (!ctx) return -1; @@ -2580,10 +2580,10 @@ put_err_out: * Return offset to attribute from the beginning of the mft record on success * and -1 on error. On error the error code is stored in errno. * Possible error codes are: - * EINVAL - Invalid argumets passed to function. + * EINVAL - Invalid arguments passed to function. * EEXIST - Attribute of such type, with same lowest vcn and with same * name already exists. - * EIO - I/O error occured or damaged filesystem. + * EIO - I/O error occurred or damaged filesystem. */ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ntfschar *name, u8 name_len, VCN lowest_vcn, int dataruns_size, @@ -2618,7 +2618,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, return -1; } - /* Locate place where record shoud be. */ + /* Locate place where record should be. */ ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); if (!ctx) return -1; @@ -2699,7 +2699,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, lowest_vcn, NULL, 0, ctx)) { err = errno; Dprintf("%s(): Attribute lookup failed. Probably leaving " - "inconsist metadata.\n", __FUNCTION__); + "inconstant metadata.\n", __FUNCTION__); ntfs_attr_put_search_ctx(ctx); errno = err; return -1; @@ -2716,15 +2716,15 @@ put_err_out: /** * ntfs_attr_record_rm - remove attribute extent - * @ctx: search context describing the attrubute which should be removed + * @ctx: search context describing the attribute which should be removed * * If this function succeed, user should reinit search context if he/she wants * use it anymore. * * Return 0 on success and -1 on error. On error the error code is stored in * errno. Possible error codes are: - * EINVAL - Invalid argumets passed to function. - * EIO - I/O error occured or damaged filesystem. + * EINVAL - Invalid arguments passed to function. + * EIO - I/O error occurred or damaged filesystem. */ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) { @@ -2749,12 +2749,12 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) /* Remove attribute itself. */ if (ntfs_attr_record_resize(ctx->mrec, ctx->attr, 0)) { - Dprintf("%s(): Coudn't remove attribute record. Bug or " + Dprintf("%s(): Couldn't remove attribute record. Bug or " "damaged MFT record.\n", __FUNCTION__); if (NInoAttrList(base_ni) && type != AT_ATTRIBUTE_LIST) if (ntfs_attrlist_entry_add(ni, ctx->attr)) Dprintf("%s(): Rollback failed. Leaving " - "inconsist metadata.\n", __FUNCTION__); + "inconstant metadata.\n", __FUNCTION__); err = EIO; return -1; } @@ -2767,7 +2767,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) if (NInoAttrList(base_ni) && type != AT_ATTRIBUTE_LIST) { if (ntfs_attrlist_entry_rm(ctx)) { err = errno; - Dprintf("%s(): Coudn't delete record from " + Dprintf("%s(): Couldn't delete record from " "$ATTRIBUTE_LIST.\n", __FUNCTION__); errno = err; return -1; @@ -2788,7 +2788,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) le16_to_cpu(ctx->mrec->attrs_offset) == 8) { if (ntfs_mft_record_free(ni->vol, ni)) { // FIXME: We need rollback here. - Dprintf("%s(): Coudn't free MFT record.\n", + Dprintf("%s(): Couldn't free MFT record.\n", __FUNCTION__); errno = EIO; return -1; @@ -2811,7 +2811,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) * goes wrong because NInoAttrList(base_ni) returned * that we have got attribute list. */ - Dprintf("%s(): Coudn't find attribute list. Succeed " + Dprintf("%s(): Couldn't find attribute list. Succeed " "anyway.\n", __FUNCTION__); return 0; } @@ -2842,7 +2842,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) * complain if it find MFT record with attribute list, * but without extents. */ - Dprintf("%s(): Coudn't remove attribute list. Succeed " + Dprintf("%s(): Couldn't remove attribute list. Succeed " "anyway.\n", __FUNCTION__); return 0; } @@ -2855,10 +2855,10 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) * @ni: opened ntfs inode to which add attribute * @type: type of the new attribute * @name: name in unicode of the new attribute - * @name_len: name length in unicode charcters of the new attribute + * @name_len: name length in unicode characters of the new attribute * @size: size of the new attribute * - * If inode haven't got enogh space to add attribute, add attribute to one of it + * If inode haven't got enough space to add attribute, add attribute to one of it * extents, if no extents present or no one of them have enough space, than * allocate new extent and add attribute to it. * @@ -3013,7 +3013,7 @@ add_attr_record: __FUNCTION__); if (ntfs_attr_rm(na)) { Dprintf("%s(): Failed to remove just added attribute. " - "Probably leaving inconsist metadata.\n", + "Probably leaving inconstant metadata.\n", __FUNCTION__); } goto err_out; @@ -3034,7 +3034,7 @@ free_err_out: le32_to_cpu(attr_ni->mrec->attrs_offset) == 8) { if (ntfs_mft_record_free(attr_ni->vol, attr_ni)) { Dprintf("%s(): Failed to free MFT record. Leaving " - "inconsist metadata.\n", __FUNCTION__); + "inconstant metadata.\n", __FUNCTION__); } } err_out: @@ -3071,7 +3071,7 @@ int ntfs_attr_rm(ntfs_attr *na) return -1; if (ntfs_cluster_free(na->ni->vol, na, 0, -1) < 0) { Dprintf("%s(): Failed to free cluster allocation. " - "Leaving inconsist metadata.\n", __FUNCTION__); + "Leaving inconstant metadata.\n", __FUNCTION__); ret = -1; } } @@ -3084,14 +3084,14 @@ int ntfs_attr_rm(ntfs_attr *na) CASE_SENSITIVE, 0, NULL, 0, ctx)) { if (ntfs_attr_record_rm(ctx)) { Dprintf("%s(): Failed to remove attribute extent. " - "Leaving inconsist metadata.\n", __FUNCTION__); + "Leaving inconstant metadata.\n", __FUNCTION__); ret = -1; } ntfs_attr_reinit_search_ctx(ctx); } if (errno != ENOENT) { Dprintf("%s(): Attribute lookup failed. Probably leaving " - "inconsist metadata.\n", __FUNCTION__); + "inconstant metadata.\n", __FUNCTION__); ret = -1; } @@ -3165,7 +3165,7 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, { /* * Check that the attribute name hasn't been placed after the - * attribute valuy. Chkdsk treat this as corruption. + * attribute value. Chkdsk treat this as corruption. */ if (a->name_length && le16_to_cpu(a->name_offset) >= le16_to_cpu(a->value_offset)) { @@ -3201,7 +3201,7 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, /** * ntfs_attr_record_move_to - move attribute record to target inode - * @ctx: attribute search context describing the attrubute record + * @ctx: attribute search context describing the attribute record * @ni: opened ntfs inode to which move attribute record * * If this function succeed, user should reinit search context if he/she wants @@ -3292,8 +3292,8 @@ put_err_out: /** * ntfs_attr_record_move_away - move away attribute record from it's mft record - * @ctx: attribute search context describing the attrubute record - * @extra: minimum amount of free spase in the new holder of record + * @ctx: attribute search context describing the attribute record + * @extra: minimum amount of free space in the new holder of record * * New attribute record holder must have free @extra bytes after moving * attribute record to it. @@ -3419,7 +3419,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, /* * Check that the attribute name hasn't been placed after the - * attribute valuy. Chkdsk treat this as corruption. + * attribute value. Chkdsk treat this as corruption. */ if (a->name_length && le16_to_cpu(a->name_offset) >= le16_to_cpu(a->value_offset)) { @@ -3580,7 +3580,7 @@ cluster_free_err_out: * The following error codes are defined: * ENOMEM - Not enough memory to complete operation. * ERANGE - @newsize is not valid for the attribute type of @na. - * ENOSPC - There is no enogh space in base mft to resize $ATTRIBUTE_LIST. + * ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST. */ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) { @@ -3689,7 +3689,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) ntfs_attr_put_search_ctx(ctx); return ntfs_resident_attr_resize(na, newsize); } - /* Check whether error occured. */ + /* Check whether error occurred. */ if (errno != ENOENT) { err = errno; Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); @@ -3921,7 +3921,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) if (bytes_read < 0) err = errno; Dprintf("%s(): Eeek! Failed to read attribute data. " - "Leaving inconsist metadata. Run chkdsk. " + "Leaving inconstant metadata. Run chkdsk. " "Aborting...\n", __FUNCTION__); errno = err; return -1; @@ -3975,7 +3975,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: * ENOMEM - Not enough memory to complete operation. - * ENOSPC - There is no enogh space in base mft to resize $ATTRIBUTE_LIST. + * ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST. */ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) { @@ -4177,7 +4177,7 @@ retry: /* * Mapping pairs of $ATTRIBUTE_LIST attribute must fit * in the base mft record. Try to move out other - * attibutes and try again. + * attributes and try again. */ if (na->type == AT_ATTRIBUTE_LIST) { ntfs_attr_put_search_ctx(ctx); @@ -4201,7 +4201,7 @@ retry: ntfs_attr_put_search_ctx(ctx); if (ntfs_inode_add_attrlist(base_ni)) { err = errno; - Dprintf("%s(): Eeek! Coudn't add " + Dprintf("%s(): Eeek! Couldn't add " "attribute list.\n", __FUNCTION__); errno = err; @@ -4264,7 +4264,7 @@ retry: } a->highest_vcn = cpu_to_sle64(stop_vcn - 1); } - /* Check whether error occured. */ + /* Check whether error occurred. */ if (errno != ENOENT) { err = errno; Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); @@ -4283,7 +4283,7 @@ retry: /* Remove unused attribute record. */ if (ntfs_attr_record_rm(ctx)) { err = errno; - Dprintf("%s(): Coudn't remove unused attribute " + Dprintf("%s(): Couldn't remove unused attribute " "record.\n", __FUNCTION__); goto put_err_out; } @@ -4323,7 +4323,7 @@ retry: } m = ni->mrec; /* - * If mapping size exceed avaible space, set them to + * If mapping size exceed available space, set them to * possible maximum. */ cur_max_mp_size = le32_to_cpu(m->bytes_allocated) - @@ -4334,7 +4334,7 @@ retry: ((sizeof(ntfschar) * na->name_len + 7) & ~7); if (mp_size > cur_max_mp_size) mp_size = cur_max_mp_size; - /* Add atribute extent to new record. */ + /* Add attribute extent to new record. */ err = ntfs_non_resident_attr_record_add(ni, na->type, na->name, na->name_len, stop_vcn, mp_size, 0); if (err == -1) { @@ -4342,7 +4342,7 @@ retry: Dprintf("%s(): Couldn't add attribute extent " "into the MFT record.\n", __FUNCTION__); if (ntfs_mft_record_free(na->ni->vol, ni)) { - Dprintf("%s(): Coudn't free MFT record.\n", + Dprintf("%s(): Couldn't free MFT record.\n", __FUNCTION__); } goto put_err_out; @@ -4361,7 +4361,7 @@ retry: "linux-ntfs-dev@lists.sf.net.\n", __FUNCTION__); if (ntfs_mft_record_free(na->ni->vol, ni)) - Dprintf("%s(): Coudn't free MFT record.\n", + Dprintf("%s(): Couldn't free MFT record.\n", __FUNCTION__); goto put_err_out; } @@ -4466,7 +4466,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) if (ntfs_attr_update_mapping_pairs(na)) { err = errno; Dprintf("%s(): Eeek! Mapping pairs update failed. " - "Leaving inconsist metadata. Run chkdsk.\n", + "Leaving inconstant metadata. Run chkdsk.\n", __FUNCTION__); errno = err; return -1; @@ -4479,10 +4479,10 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) err = errno; if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) - Dprintf("%s(): Coudn't get attribute search context. " - "Leaving inconsist metadata.\n", __FUNCTION__); + Dprintf("%s(): Couldn't get attribute search context. " + "Leaving inconstant metadata.\n", __FUNCTION__); else - Dprintf("%s(): Coudn't get attribute search context.\n", + Dprintf("%s(): Couldn't get attribute search context.\n", __FUNCTION__); errno = err; return -1; @@ -4493,7 +4493,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) if (err == ENOENT) err = EIO; Dprintf("%s(): Eeek! Lookup of first attribute extent failed. " - "Leaving inconsist metadata.\n", __FUNCTION__); + "Leaving inconstant metadata.\n", __FUNCTION__); goto put_err_out; } a = ctx->attr; @@ -4511,7 +4511,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) new_compr_size = ntfs_rl_get_compressed_size(vol, na->rl); if (new_compr_size == -1) { err = errno; - Dprintf("%s(): BUG! Leaving inconsist metadata.\n", + Dprintf("%s(): BUG! Leaving inconstant metadata.\n", __FUNCTION__); goto put_err_out; } @@ -4561,7 +4561,7 @@ put_err_out: * The following error codes are defined: * ENOMEM - Not enough memory to complete operation. * ERANGE - @newsize is not valid for the attribute type of @na. - * ENOSPC - There is no enogh space in base mft to resize $ATTRIBUTE_LIST. + * ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST. */ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) { @@ -4611,7 +4611,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) /* * If we extend $DATA attribute on NTFS 3+ volume, we can add - * sparse runs instead of real alloction of clusters. + * sparse runs instead of real allocation of clusters. */ if (na->type == AT_DATA && vol->major_ver >= 3) { rl = malloc(0x1000); @@ -4643,7 +4643,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) for (rl = na->rl; (rl + 1)->length; rl++) ; /* - * If the last LCN is a hole or simillar seek + * If the last LCN is a hole or similar seek * back to last valid LCN. */ while (rl->lcn < 0 && rl != na->rl) @@ -4733,7 +4733,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) new_compr_size = ntfs_rl_get_compressed_size(vol, na->rl); if (new_compr_size == -1) { err = errno; - Dprintf("%s(): BUG! Leaving inconsist metadata.\n", + Dprintf("%s(): BUG! Leaving inconstant metadata.\n", __FUNCTION__); goto put_err_out; } @@ -4766,12 +4766,12 @@ rollback: */ free(na->rl); na->rl = NULL; - Dprintf("%s(): Eeek! Coudn't truncate runlist. Rollback " + Dprintf("%s(): Eeek! Couldn't truncate runlist. Rollback " "failed.\n", __FUNCTION__); } else { - /* Retore mapping pairs. */ + /* Restore mapping pairs. */ if (ntfs_attr_update_mapping_pairs(na)) { - Dprintf("%s(): Eeek! Coudn't restore old mapping " + Dprintf("%s(): Eeek! Couldn't restore old mapping " "pairs. Rollback failed.\n", __FUNCTION__); } } @@ -4818,7 +4818,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) if (!na || newsize < 0 || (na->ni->mft_no == FILE_MFT && na->type == AT_DATA)) { - Dprintf("%s(): Invalid aruments passed.\n", __FUNCTION__); + Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -4852,8 +4852,8 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) NInoFileNameSetDirty(na->ni); na->ni->data_size = na->data_size; /* - * If attribute sparse or commpreseed then allocated size in - * index should be euqal to compressed size, not to allocated + * If attribute sparse or compressed then allocated size in + * index should be equal to compressed size, not to allocated * size. */ if (NAttrCompressed(na) || NAttrSparse(na)) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 5833a009..9c116531 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -37,13 +37,13 @@ * ntfs_attrlist_need - check whether attribute need attribute list * @ni: opened ntfs inode for which perform check * - * Check whether all are atributes belong to one MFT record, in that case + * Check whether all are attributes belong to one MFT record, in that case * attribute list is not needed. * * Return 1 if inode need attribute list, 0 if not, -1 on error with errno set * to the error code. If function succeed errno set to 0. The following error * codes are defined: - * EINVAL - Invalid argumets passed to function or attribute haven't got + * EINVAL - Invalid arguments passed to function or attribute haven't got * attribute list. */ int ntfs_attrlist_need(ntfs_inode *ni) @@ -51,7 +51,7 @@ int ntfs_attrlist_need(ntfs_inode *ni) ATTR_LIST_ENTRY *ale; if (!ni) { - Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); + Dprintf("%s(): Invalid arguments.\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -67,7 +67,7 @@ int ntfs_attrlist_need(ntfs_inode *ni) } if (!ni->attr_list) { - Dprintf("%s(): Corrput in-memory struct.\n", __FUNCTION__); + Dprintf("%s(): Corrupt in-memory struct.\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -89,9 +89,9 @@ int ntfs_attrlist_need(ntfs_inode *ni) * * Return 0 on success and -1 on error with errno set to the error code. The * following error codes are defined: - * EINVAL - Invalid argumets passed to function. + * EINVAL - Invalid arguments passed to function. * ENOMEM - Not enough memory to allocate necessary buffers. - * EIO - I/O error occured or damaged filesystem. + * EIO - I/O error occurred or damaged filesystem. */ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) { @@ -106,7 +106,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) (unsigned) le32_to_cpu(attr->type)); if (!ni || !attr) { - Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); + Dprintf("%s(): Invalid arguments.\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -172,7 +172,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) entry_offset = ((u8 *)ale - ni->attr_list); /* Set pointer to new entry. */ ale = (ATTR_LIST_ENTRY *)(new_al + entry_offset); - /* Zero it to fix valgrid warning. */ + /* Zero it to fix valgrind warning. */ memset(ale, 0, entry_len); /* Form new entry. */ ale->type = attr->type; @@ -226,7 +226,7 @@ err_out: /** * ntfs_attrlist_entry_rm - remove an attribute list attribute entry - * @ctx: attribute search context describing the attrubute list entry + * @ctx: attribute search context describing the attribute list entry * * Remove the attribute list entry @ctx->al_entry from the attribute list. * @@ -242,7 +242,7 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) int err; if (!ctx || !ctx->ntfs_ino || !ctx->al_entry) { - Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); + Dprintf("%s(): Invalid arguments.\n", __FUNCTION__); errno = EINVAL; return -1; } diff --git a/libntfs/collate.c b/libntfs/collate.c index a302a030..e478beb6 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -124,7 +124,7 @@ static ntfs_collate_func_t ntfs_do_collate0x1[4] = { * For speed we use the collation rule @cr as an index into two tables of * function pointers to call the appropriate collation function. * - * Return NTFS_COLLATION_ERROR if error occured. + * Return NTFS_COLLATION_ERROR if error occurred. */ int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr, const void *data1, const int data1_len, diff --git a/libntfs/compat.c b/libntfs/compat.c index 8dd258d6..0ea141dc 100644 --- a/libntfs/compat.c +++ b/libntfs/compat.c @@ -1,5 +1,5 @@ /* - * compat.c - Tweaks for Windows compatability + * compat.c - Tweaks for Windows compatibility * * Copyright (c) 2002 Richard Russon * Copyright (c) 2002-2004 Anton Altaparmakov diff --git a/libntfs/device.c b/libntfs/device.c index 461fa6ac..d545b4c9 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -307,7 +307,7 @@ s64 ntfs_mst_pread(struct ntfs_device *dev, const s64 pos, s64 count, * @dev at position @pos. * * On success, return the number of successfully written blocks. If this number - * is lower than @count this means that the write has been interrutped or that + * is lower than @count this means that the write has been interrupted or that * an error was encountered during the write so that the write is partial. 0 * means nothing was written (also return 0 when @count or @bksize are 0). * diff --git a/libntfs/dir.c b/libntfs/dir.c index 50e4a212..50d79358 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -910,7 +910,7 @@ skip_index_root: if (br != bmp_buf_size) { if (br != -1) errno = EIO; - Dperror("Failed to read from inde bitmap attribute"); + Dperror("Failed to read from index bitmap attribute"); goto err_out; } @@ -933,7 +933,7 @@ find_next_index_buffer: if (br != bmp_buf_size) { if (br != -1) errno = EIO; - Dperror("Failed to read from inde bitmap attribute"); + Dperror("Failed to read from index bitmap attribute"); goto err_out; } } diff --git a/libntfs/index.c b/libntfs/index.c index e73e7a2d..96019d5d 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -228,7 +228,7 @@ done: break; /* * A match should never happen as the memcmp() call should have - * cought it, but we still treat it correctly. + * caught it, but we still treat it correctly. */ if (!rc) goto ir_done; @@ -356,7 +356,7 @@ ia_done: break; /* * A match should never happen as the memcmp() call should have - * cought it, but we still treat it correctly. + * caught it, but we still treat it correctly. */ if (!rc) goto ia_done; diff --git a/libntfs/inode.c b/libntfs/inode.c index 7ba92da5..49a1f493 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -256,7 +256,7 @@ int ntfs_inode_close(ntfs_inode *ni) } /* * ElectricFence is unhappy with realloc(x,0) as free(x) - * thus we explicitely separate these two cases. + * thus we explicitly separate these two cases. */ if (base_ni->nr_extents) { /* Resize the memory buffer. */ @@ -375,8 +375,8 @@ err_out: } /** - * ntfs_inode_attach_all_extents - atach all extents for target inode - * @ni: opened ntfs inode for which perform atach + * ntfs_inode_attach_all_extents - attach all extents for target inode + * @ni: opened ntfs inode for which perform attach * * Return 0 on success and -1 on error with errno set to the error code. */ @@ -386,7 +386,7 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) u64 prev_attached = 0; if (!ni) { - Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); + Dprintf("%s(): Invalid arguments.\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -402,7 +402,7 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) return 0; if (!ni->attr_list) { - Dprintf("%s(): Corrput in-memory struct.\n", __FUNCTION__); + Dprintf("%s(): Corrupt in-memory struct.\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -427,7 +427,7 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) } /** - * ntfs_inode_sync_standard_information - update standard informaiton attribute + * ntfs_inode_sync_standard_information - update standard information attribute * @ni: ntfs inode to update standard information * * Return 0 on success or -1 on error with errno set to the error code. @@ -499,7 +499,7 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni) if (MREF_LE(fn->parent_directory) == ni->mft_no) { /* * WARNING: We cheater here and obtain 2 attribute - * search contextes for one inode (first we obtained + * search contexts for one inode (first we obtained * above, second will be obtained inside * ntfs_index_lookup), it's acceptable for library, * but will lock kernel. @@ -558,7 +558,7 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni) ntfs_index_ctx_put(ictx); ntfs_inode_close(index_ni); } - /* Check for real error occured. */ + /* Check for real error occurred. */ if (errno != ENOENT) { err = errno; Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); @@ -723,9 +723,9 @@ int ntfs_inode_sync(ntfs_inode *ni) * Return 0 on success or -1 on error with errno set to the error code. * The following error codes are defined: * EINVAL - Invalid arguments were passed to the function. - * EEXIST - Attibute list already exist. - * EIO - Input/Ouput error occured. - * ENOMEM - Not enogh memory to perform add. + * EEXIST - Attribute list already exist. + * EIO - Input/Ouput error occurred. + * ENOMEM - Not enough memory to perform add. */ int ntfs_inode_add_attrlist(ntfs_inode *ni) { @@ -737,7 +737,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) ntfs_attr *na; if (!ni) { - Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); + Dprintf("%s(): Invalid arguments.\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -766,7 +766,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { err = errno; - Dprintf("%s(): Coudn't get search context.\n", __FUNCTION__); + Dprintf("%s(): Couldn't get search context.\n", __FUNCTION__); goto err_out; } /* Walk through all attributes. */ @@ -811,7 +811,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) ctx->attr->name_length * sizeof(ntfschar)); ale = (ATTR_LIST_ENTRY *)(al + al_len); } - /* Check for real error occured. */ + /* Check for real error occurred. */ if (errno != ENOENT) { err = errno; Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); @@ -885,7 +885,7 @@ remove_attrlist_record: Dprintf("%s(): Rollback failed. Failed to remove " "attribute list record.\n", __FUNCTION__); } else - Dprintf("%s(): Rollback failed. Coudn't find attribute list " + Dprintf("%s(): Rollback failed. Couldn't find attribute list " "record.\n", __FUNCTION__); /* Setup back in-memory runlist. */ ni->attr_list = al; @@ -944,7 +944,7 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) int freed, err; if (!ni || size < 0) { - Dprintf("%s(): Invalid argumets.\n", __FUNCTION__); + Dprintf("%s(): Invalid arguments.\n", __FUNCTION__); errno = EINVAL; return -1; } @@ -968,9 +968,9 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) } /* - * Chkdsk complain if $STANDART_INFORMATION is not in the base MFT + * Chkdsk complain if $STANDARD_INFORMATION is not in the base MFT * record. FIXME: I'm not sure in this, need to recheck. For now simply - * do not move $STANDART_INFORMATION at all. + * do not move $STANDARD_INFORMATION at all. * * Also we can't move $ATTRIBUTE_LIST from base MFT_RECORD, so position * search context on first attribute after $STANDARD_INFORMATION and @@ -1033,7 +1033,7 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) } /* - * Repostion to first attribute after $STANDARD_INFORMATION and + * Reposition to first attribute after $STANDARD_INFORMATION and * $ATTRIBUTE_LIST (see comments upwards). */ ntfs_attr_reinit_search_ctx(ctx); diff --git a/libntfs/logfile.c b/libntfs/logfile.c index acd0880c..0c2a9112 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -222,7 +222,7 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) "inconsistent log record header length."); return FALSE; } - /* Dito for the log page data offset. */ + /* Ditto for the log page data offset. */ if (((le16_to_cpu(ra->log_page_data_offset) + 7) & ~7) != le16_to_cpu(ra->log_page_data_offset)) { ntfs_error(vi->i_sb, "$LogFile restart area specifies " @@ -378,7 +378,7 @@ err_out: } /** - * ntfs_ckeck_logfile - check in the journal if the volume is consistent + * ntfs_check_logfile - check in the journal if the volume is consistent * @log_na: ntfs attribute of loaded journal $LogFile to check * * Check the $LogFile journal for consistency and return TRUE if it is @@ -442,7 +442,7 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na) * page header is at the beginning of a page we only need to search at * what could be the beginning of a page (for each page size) rather * than scanning the whole file byte by byte. If all potential places - * contain empty and uninitialzed records, the log file can be assumed + * contain empty and uninitialized records, the log file can be assumed * to be empty. */ for (pos = 0; pos < size; pos <<= 1) { @@ -573,7 +573,7 @@ err_out: * of cases where we think that a volume is dirty when in fact it is clean. * This should only affect volumes that have not been shutdown cleanly but did * not have any pending, non-check-pointed i/o, i.e. they were completely idle - * at least for the five seconds preceeding the unclean shutdown. + * at least for the five seconds preceding the unclean shutdown. * * This function assumes that the $LogFile journal has already been consistency * checked by a call to ntfs_check_logfile() and in particular if the $LogFile diff --git a/libntfs/mft.c b/libntfs/mft.c index 47bebcda..625778db 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -400,7 +400,7 @@ static inline unsigned int ntfs_ffz(unsigned int word) * * Return the free mft record on success and -1 on error with errno set to the * error code. An error code of ENOSPC means that there are no free mft - * records in the currently initialized mft bitmal. + * records in the currently initialized mft bitmap. */ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) { @@ -607,7 +607,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) ntfs_error(vol->sb, "Failed to merge runlists for mft " "bitmap."); if (ntfs_cluster_free_from_rl(vol, rl2)) - ntfs_error(vol->sb, "Failed to dealocate " + ntfs_error(vol->sb, "Failed to deallocate " "cluster.%s", es); free(rl2); errno = ret; @@ -665,7 +665,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) // TODO: Deal with this by moving this extent to a new mft // record or by starting a new extent in a new mft record. ntfs_error(vol->sb, "Not enough space in this mft record to " - "accomodate extended mft bitmap attribute " + "accommodate extended mft bitmap attribute " "extent. Cannot handle this yet."); errno = ENOTSUP; goto undo_alloc; @@ -931,7 +931,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) ntfs_error(vol->sb, "Failed to merge runlists for mft data " "attribute."); if (ntfs_cluster_free_from_rl(vol, rl2)) - ntfs_error(vol->sb, "Failed to dealocate clusters " + ntfs_error(vol->sb, "Failed to deallocate clusters " "from the mft data attribute.%s", es); free(rl2); errno = err; @@ -987,7 +987,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) // this extent is not required to find the mft record in // question. ntfs_error(vol->sb, "Not enough space in this mft record to " - "accomodate extended mft data attribute " + "accommodate extended mft data attribute " "extent. Cannot handle this yet."); errno = ENOTSUP; goto undo_alloc; @@ -1133,7 +1133,7 @@ undo_alloc: * extend the initialized size (and data size) by 8 bytes, allocating another * cluster if required. The bitmap data size has to be at least equal to the * number of mft records in the mft, but it can be bigger, in which case the - * superflous bits are padded with zeroes. + * superfluous bits are padded with zeroes. * * Thus, when we return successfully (return value non-zero), we will have: * - initialized / extended the mft bitmap if necessary, @@ -1144,7 +1144,7 @@ undo_alloc: * - return the ntfs_inode. * * On error (return value zero), nothing will have changed. If we had changed - * anything before the error occured, we will have reverted back to the + * anything before the error occurred, we will have reverted back to the * starting state before returning to the caller. Thus, except for bugs, we * should always leave the volume in a consistent state when returning from * this function. @@ -1241,7 +1241,7 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) bit = mftbmp_na->initialized_size << 3; if (ntfs_mft_bitmap_extend_initialized(vol)) goto err_out; - ntfs_debug("Status of mftbmp after initialized extention: " + ntfs_debug("Status of mftbmp after initialized extension: " "allocated_size 0x%llx, data_size 0x%llx, " "initialized_size 0x%llx.", (long long)mftbmp_na->allocated_size, @@ -1289,7 +1289,7 @@ found_free_rec: old_data_size = mft_na->data_size; /* * Extend mft data initialized size (and data size of course) to reach - * the allocated mft record, formatting the mft records allong the way. + * the allocated mft record, formatting the mft records along the way. * Note: We only modify the ntfs_attr structure as that is all that is * needed by ntfs_mft_record_format(). We will update the attribute * record itself in one fell swoop later on. diff --git a/libntfs/mst.c b/libntfs/mst.c index f2564ff0..9b34cd34 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -37,7 +37,7 @@ * Return 0 on success and -1 on error, with errno set to the error code. The * following error codes are defined: * EINVAL Invalid arguments or invalid NTFS record in buffer @b. - * EIO Mulit sector transfer error was detected. Magic of the NTFS + * EIO Multi sector transfer error was detected. Magic of the NTFS * record in @b will have been set to "BAAD". */ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size) @@ -63,7 +63,7 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size) * u16 values before they are fixed up. Note no need to care for * endianness since we are comparing and moving data for on disk * structures which means the data is consistent. - If it is - * consistenty the wrong endianness it doesn't make any difference. + * consistency the wrong endianness it doesn't make any difference. */ usn = *usa_pos; /* diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 488ab2b8..5d5c879e 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1261,7 +1261,7 @@ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, return -1; } prev_lcn = 0; - /* Always need the termining zero byte. */ + /* Always need the terminating zero byte. */ rls = 1; /* Do the first partial run if present. */ if (start_vcn > rl->vcn) { @@ -1331,7 +1331,7 @@ err_out: * write. * * This is used when building the mapping pairs array of a runlist to compress - * a given logical cluster number (lcn) or a specific run length to the minumum + * a given logical cluster number (lcn) or a specific run length to the minimum * size possible. * * Return the number of bytes written on success. On error, i.e. the diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 443f68bf..e0c144b8 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -69,7 +69,7 @@ const u8 legal_ansi_char_array[0x40] = { * * Compare the names @s1 and @s2 and return TRUE (1) if the names are * identical, or FALSE (0) if they are not identical. If @ic is IGNORE_CASE, - * the @upcase table is used to performa a case insensitive comparison. + * the @upcase table is used to perform a case insensitive comparison. */ BOOL ntfs_names_are_equal(const ntfschar *s1, size_t s1_len, const ntfschar *s2, size_t s2_len, diff --git a/libntfs/unix_io.c b/libntfs/unix_io.c index 6b817bad..2e8fe5a8 100644 --- a/libntfs/unix_io.c +++ b/libntfs/unix_io.c @@ -1,5 +1,5 @@ /* - * unix_io.c - Unix stule disk io functions. Part of the Linux-NTFS project. + * unix_io.c - Unix style disk io functions. Part of the Linux-NTFS project. * * Copyright (c) 2000-2003 Anton Altaparmakov * @@ -64,7 +64,7 @@ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags) /* Setup our read-only flag. */ if ((flags & O_RDWR) != O_RDWR) NDevSetReadOnly(dev); - /* Acquire exlusive (mandatory) lock on the whole device. */ + /* Acquire exclusive (mandatory) lock on the whole device. */ memset(&flk, 0, sizeof(flk)); if (NDevReadOnly(dev)) flk.l_type = F_RDLCK; @@ -103,7 +103,7 @@ static int ntfs_device_unix_io_close(struct ntfs_device *dev) } if (NDevDirty(dev)) fsync(DEV_FD(dev)); - /* Release exlusive (mandatory) lock on the whole device. */ + /* Release exclusive (mandatory) lock on the whole device. */ memset(&flk, 0, sizeof(flk)); flk.l_type = F_UNLCK; flk.l_whence = SEEK_SET; diff --git a/libntfs/volume.c b/libntfs/volume.c index 01dee976..4412f749 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -199,7 +199,7 @@ static int ntfs_mft_load(ntfs_volume *vol) goto io_error_exit; } if (l != vol->mft_ni->attr_list_size) { - Dputs("Error: got unexepected amount of data when reading " + Dputs("Error: got unexpected amount of data when reading " "$MFT/$ATTRIBUTE_LIST."); goto io_error_exit; } @@ -1288,7 +1288,7 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) * Finally, check if the file system is mounted read-only, and if so set the * NTFS_MF_READONLY flag in *@mnt_flags. * - * On sucess return 0 with *@mnt_flags set to the ntfs mount flags. + * On success return 0 with *@mnt_flags set to the ntfs mount flags. * * On error return -1 with errno set to the error code. */ diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 074ea0a3..85ae0a6e 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -113,7 +113,7 @@ #include #if defined(linux) && defined(_IO) && !defined(BLKSSZGET) -# define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytse. */ +# define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytes. */ #endif #include "types.h" @@ -211,7 +211,7 @@ struct { } opts; /** - * mkDprintf - debugging output (-vv); overriden by quiet (-q) + * mkDprintf - debugging output (-vv); overridden by quiet (-q) */ static void mkDprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); @@ -3015,7 +3015,7 @@ static void mkntfs_initialize_rl_mft(void) * The mft mirror is either 4kb (the first four records) or one cluster * in size, which ever is bigger. In either case, it contains a * byte-for-byte identical copy of the beginning of the mft (i.e. either - * ther first four records (4kb) or the first cluster worth of records, + * the first four records (4kb) or the first cluster worth of records, * whichever is bigger). */ j = (4 * vol->mft_record_size + vol->cluster_size - 1) / vol->cluster_size; @@ -3731,7 +3731,7 @@ int main(int argc, char **argv) mkntfs_initialize_bitmaps(); /* Initialize MFT & set opts.logfile_lcn. */ mkntfs_initialize_rl_mft(); - /* Initlialize $LogFile. */ + /* Initialise $LogFile. */ mkntfs_initialize_rl_logfile(); /* Initialize $Boot. */ mkntfs_initialize_rl_boot(); diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 76dd9f6a..fd7b100f 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -163,7 +163,7 @@ static int parse_options (int argc, char **argv) attr = strtol(optarg, &s, 0); if (*s) { - Eprintf("Coudn't parse attribute.\n"); + Eprintf("Couldn't parse attribute.\n"); err++; } else opts.attribute = (ATTR_TYPES)attr; diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 88c40227..b6ef6802 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -25,7 +25,7 @@ /* TODO: * - Remove the need for clipping at 64MiB. * - Add normal command line switchs (use getopt_long()). - * - For a volume: allow dumping only uncommited records. + * - For a volume: allow dumping only uncommitted records. * - For a file: get an optional command line parameter for the last SN. * - Sanity checks. */ diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 1d69df09..dc5fb946 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -204,7 +204,7 @@ static int parse_options (int argc, char *argv[]) opts.notime++; break; case 'T': - /* 'T' is depreceted, notify */ + /* 'T' is deprecated, notify */ Eprintf ("Option 'T' is deprecated, it was replaced by 't'.\n"); err++; break; @@ -287,7 +287,7 @@ static char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) /** * ntfs_attr_get_name() - * @attr: a vaild attribute record + * @attr: a valid attribute record * * return multi-byte string containing the attribute name if exist. the user * is then responsible of freeing that memory. @@ -569,7 +569,7 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) printf("\tList name:\t\t '%s'\n",stream_name); free(stream_name); } else { - /* an error occured, errno holds the reason - notify the user */ + /* an error occurred, errno holds the reason - notify the user */ fprintf(stderr, "ntfsinfo error: could not parse stream name: %s\n", strerror(errno)); } @@ -617,7 +617,7 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) for(;(u8 *)entry < (u8 *) value + l; entry = (ATTR_LIST_ENTRY *) ((u8 *) entry + le16_to_cpu(entry->length))) { printf("\n"); - printf("\t\tAtrribute type:\t0x%x\n", + printf("\t\tAttribute type:\t0x%x\n", (unsigned int)le32_to_cpu(entry->type)); printf("\t\tRecord length:\t%u\n", le16_to_cpu(entry->length)); @@ -675,7 +675,7 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) printf("\tFile Name:\t\t '%s'\n", mbs_file_name); free(mbs_file_name); } else { - /* an error occured, errno holds the reason - notify the user */ + /* an error occurred, errno holds the reason - notify the user */ fprintf(stderr, "ntfsinfo error: could not parse file name: %s\n", strerror(errno)); } @@ -854,7 +854,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v data_size, sec_desc_attr); if (bytes_read != data_size) { Eprintf("ntfsinfo error: could not " - "read secutiry descriptor\n"); + "read security descriptor\n"); free(sec_desc_attr); return; } @@ -940,7 +940,7 @@ static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) printf("\tVolume Name:\t\t '%s'\n",mbs_vol_name); free(mbs_vol_name); } else { - /* an error occured, errno holds the reason - notify the user */ + /* an error occurred, errno holds the reason - notify the user */ fprintf(stderr,"ntfsinfo error: could not parse volume name: %s\n", strerror(errno)); } @@ -1011,7 +1011,7 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol) printf("\tStream name:\t\t '%s'\n",stream_name); free(stream_name); } else { - /* an error occured, errno holds the reason - notify the user */ + /* an error occurred, errno holds the reason - notify the user */ fprintf(stderr, "ntfsinfo error: could not parse stream name: %s\n", strerror(errno)); } @@ -1168,7 +1168,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) printf("\tIndex name:\t\t '%s'\n",index_name); free(index_name); } else { - /* an error occured, errno holds the reason - notify the user */ + /* an error occurred, errno holds the reason - notify the user */ fprintf(stderr, "ntfsinfo error: could not parse index name: %s\n", strerror(errno)); } @@ -1183,7 +1183,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) type = le32_to_cpu(index_root->type); if (type) { if (index_root->type != AT_FILE_NAME) { - /* wierd, this should be illgeal */ + /* weird, this should be illgeal */ printf("0x%0X\n", type); fprintf(stderr, "ntfsinfo error: Unknown Indexed Attr Type: 0x%0X\n", type); @@ -1375,7 +1375,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) free(index_name); } else { /* - * An error occured, errno holds the reason - + * An error occurred, errno holds the reason - * notify the user */ fprintf(stderr, "ntfsinfo error: could not parse " @@ -1395,7 +1395,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) printf("\tUsed data size:\t\t %llu\n", (unsigned long long)le64_to_cpu(attr->data_size)); } else { - Eprintf("Invalid $INDEX_ALLOCTION attribute. Should be be" + Eprintf("Invalid $INDEX_ALLOCATION attribute. Should be be" " non-resident\n"); } @@ -1420,7 +1420,7 @@ static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) printf("\tBitmap name:\t\t '%s'\n",bitmap_name); free(bitmap_name); } else { - /* an error occured, errno holds the reason - notify the user */ + /* an error occurred, errno holds the reason - notify the user */ fprintf(stderr, "ntfsinfo error: could not parse bitmap name: %s\n", strerror(errno)); } @@ -1567,7 +1567,7 @@ static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) printf("\tAttribute name:\t '%s'\n",attr_name); free(attr_name); } else { - /* an error occured, errno holds the reason - notify the user */ + /* an error occurred, errno holds the reason - notify the user */ fprintf(stderr, "ntfsinfo error: could not parse attribute name: %s\n", strerror(errno)); } @@ -1666,7 +1666,7 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) ntfs_attr_search_ctx *ctx = NULL; /* then start enumerating attributes - see ntfs_attr_lookup documentation for detailed explenation */ + see ntfs_attr_lookup documentation for detailed explanation */ ctx = ntfs_attr_get_search_ctx(inode, NULL); while (!ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx)) { switch (ctx->attr->type) { diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 3f8419b9..e61613c5 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -447,7 +447,7 @@ static int readdir_recursive(ntfs_inode * ni, s64 * pos, ntfsls_dirent * dirent) if (tofree) free_dir(tofree); - /* if at the outter-most readdir_recursive, then clean up */ + /* if at the outer-most readdir_recursive, then clean up */ if (ni_depth == 0) { free_dirs(&dirs.list); } @@ -575,7 +575,7 @@ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, result = 0; release: - /* Release atrtibute search context and close the inode. */ + /* Release attribute search context and close the inode. */ if (ctx) ntfs_attr_put_search_ctx(ctx); if (ni) diff --git a/ntfsprogs/ntfsmftalloc.c b/ntfsprogs/ntfsmftalloc.c index 6e75ed29..3723a309 100644 --- a/ntfsprogs/ntfsmftalloc.c +++ b/ntfsprogs/ntfsmftalloc.c @@ -84,7 +84,7 @@ static struct { } opts; /** - * mkDprintf - debugging output (-vv); overriden by quiet (-q) + * mkDprintf - debugging output (-vv); overridden by quiet (-q) */ static void mkDprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); @@ -152,7 +152,7 @@ static void copyright(void) } /** - * license - print licese statement + * license - print license statement */ static void license(void) { diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 1892c8fd..2392e1f4 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -204,8 +204,8 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), * after use. * * Return values: - * <0 Error occured, return -errno; - * 0 No stream name, @*stream is not allocated and set to AT_UNMAMED. + * <0 Error occurred, return -errno; + * 0 No stream name, @*stream is not allocated and set to AT_UNNAMED. * >0 Stream name length in unicode characters. */ static int ntfs_fuse_parse_path(const char *org_path, char **path, diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index ab09ca3b..742ad1fa 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -640,7 +640,7 @@ static s64 move_runlist (ntfs_volume *vol, runlist_element *from, // got to get the runlist out of this function // requires a mrec arg, not an ino (ino->mrec will do for now) -// check size of new runlist before allocting / moving +// check size of new runlist before allocating / moving // replace one datarun with another (by hand) static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, runlist_element *run, u64 loc, int flags) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 95158bcc..595ebf71 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1049,7 +1049,7 @@ close_inode: return 0; } -static void build_resize_constrains(ntfs_resize_t *resize) +static void build_resize_constraints(ntfs_resize_t *resize) { s64 i; runlist *rl; @@ -1073,7 +1073,7 @@ static void build_resize_constrains(ntfs_resize_t *resize) free(rl); } -static void resize_constrains_by_attributes(ntfs_resize_t *resize) +static void resize_constraints_by_attributes(ntfs_resize_t *resize) { if (!(resize->ctx = attr_get_search_ctx(resize->ni, NULL))) exit(1); @@ -1081,18 +1081,18 @@ static void resize_constrains_by_attributes(ntfs_resize_t *resize) while (!ntfs_attrs_walk(resize->ctx)) { if (resize->ctx->attr->type == AT_END) break; - build_resize_constrains(resize); + build_resize_constraints(resize); } ntfs_attr_put_search_ctx(resize->ctx); } -static void set_resize_constrains(ntfs_resize_t *resize) +static void set_resize_constraints(ntfs_resize_t *resize) { s64 nr_mft_records, inode; ntfs_inode *ni; - printf("Collecting shrinkage constrains ...\n"); + printf("Collecting shrinkage constraints ...\n"); nr_mft_records = resize->vol->mft_na->initialized_size >> resize->vol->mft_record_size_bits; @@ -1110,7 +1110,7 @@ static void set_resize_constrains(ntfs_resize_t *resize) goto close_inode; resize->ni = ni; - resize_constrains_by_attributes(resize); + resize_constraints_by_attributes(resize); close_inode: if (inode_close(ni) != 0) exit(1); @@ -1518,7 +1518,7 @@ static void rl_insert_at_run(runlist **rl, int run, runlist *ins) return; - /* FIXME: fastpath if ins_items = 1 */ + /* FIXME: fast path if ins_items = 1 */ // (*rl + run)->lcn = ins->lcn; } @@ -2293,7 +2293,7 @@ int main(int argc, char **argv) if (new_size < vol->nr_clusters) resize.shrink = 1; - set_resize_constrains(&resize); + set_resize_constraints(&resize); set_disk_usage_constraint(&resize); check_resize_constraints(&resize); diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 05a024e8..a1e34942 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1887,7 +1887,7 @@ static int ntfs_inode_close2 (ntfs_inode *ni) // unlink // ino->private_data - // XXX tempoarary until we have commit/rollback + // XXX temporary until we have commit/rollback NInoClearDirty(ni); return ntfs_inode_close (ni); @@ -4524,7 +4524,7 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) * successor. */ - // find the key nearest the root which has no descendents + // find the key nearest the root which has no descendants printf ("\n"); printf (BOLD YELLOW "Find childless parent:\n" END); for (par = del->parent, old = par; par; old = par, par = par->parent) { diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 1a0f54d5..e9942f16 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -93,7 +93,7 @@ struct { } opts; /** - * mkDprintf - debugging output (-vv); overriden by quiet (-q) + * mkDprintf - debugging output (-vv); overridden by quiet (-q) */ static void mkDprintf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); @@ -159,7 +159,7 @@ static void copyright(void) } /** - * license - print licese statement + * license - print license statement */ static void license(void) { diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 88d476dd..80d4d6af 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -716,7 +716,7 @@ static void free_file (struct ufile *file) * * Check that @rec is the parent of the file represented by @name. * If @rec is a directory, but it is created after @name, then we - * can't determine wheter @rec is really @name's parent. + * can't determine whether @rec is really @name's parent. * * Return: @rec's filename, either same name space as @name or lowest space. * NULL if can't determine parenthood or on error. diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index b02e178a..ace3341b 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -91,7 +91,7 @@ struct data { long long size_init; /* Initialised size, may be less than data size */ long long size_vcn; /* Highest VCN in the data runs */ runlist_element *runlist; /* Decoded data runs */ - int percent; /* Amont potentially recoverable */ + int percent; /* Amount potentially recoverable */ void *data; /* If resident, a pointer to the data */ char padding[4]; /* Unused: padding to 64 bit. */ }; diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 35fe44fe..facdc123 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -352,7 +352,7 @@ static int parse_options (int argc, char *argv[]) * * Read $Bitmap and wipe any clusters that are marked as not in use. * - * Return: >0 Success, the atrribute was wiped + * Return: >0 Success, the attribute was wiped * 0 Nothing to wipe * -1 Error, something went wrong */ @@ -406,7 +406,7 @@ free: * @act: Wipe, test or info * @na: Opened ntfs attribute * - * Return: >0 Success, the atrribute was wiped + * Return: >0 Success, the attribute was wiped * 0 Nothing to wipe * -1 Error, something went wrong */ @@ -511,7 +511,7 @@ next: * @act: Wipe, test or info * @na: Opened ntfs attribute * - * Return: >0 Success, the atrribute was wiped + * Return: >0 Success, the attribute was wiped * 0 Nothing to wipe * -1 Error, something went wrong */ @@ -598,7 +598,7 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) } if (!NAttrNonResident(na)) { - Vprintf ("Resident $DATA atrribute. Skipping.\n"); + Vprintf ("Resident $DATA attribute. Skipping.\n"); goto close_attr; } @@ -773,7 +773,7 @@ free: * @byte: Overwrite with this value * @act: Wipe, test or info * @naa: Opened ntfs $INDEX_ALLOCATION attribute - * @nab: Opened ntfs $BIMTAP attribute + * @nab: Opened ntfs $BITMAP attribute * @indx_record_size: Size of INDX record * * Return: >0 Success, the clusters were wiped @@ -1049,7 +1049,7 @@ close_inode: * @act: Wipe, test or info * * The logfile journals the metadata to give the volume fault-tolerance. If the - * volume is in a consistant state, then this information can be erased. + * volume is in a consistent state, then this information can be erased. * * Return: >0 Success, the clusters were wiped * 0 Nothing to wipe @@ -1197,7 +1197,7 @@ static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act goto io_error_exit; } - /* Get length of pagfile.sys contents. */ + /* Get length of pagefile.sys contents. */ len = na->data_size; if (!len) { Dprintf("pagefile.sys has zero length, no disk write needed.\n"); diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c index 5f822aab..90b4cd0c 100644 --- a/ntfsprogs/sd.c +++ b/ntfsprogs/sd.c @@ -4,7 +4,7 @@ /** * init_system_file_sd * - * NTFS 1.2 - System files security decriptors + * NTFS 1.2 - System files security descriptors * =========================================== * * Create the security descriptor for system file number @sys_file_no and @@ -15,14 +15,14 @@ * * $Volume, $Quota, and system files 0xb-0xf are the same. They are almost the * same as the above, the only difference being that the two SIDs present in - * the DACL grant GENERIC_WRITE and GENERIC_READ equivalent priviledges while - * the above only grant GENERIC_READ equivalent priviledges. (For some reason + * the DACL grant GENERIC_WRITE and GENERIC_READ equivalent privileges while + * the above only grant GENERIC_READ equivalent privileges. (For some reason * the flags for GENERIC_READ/GENERIC_WRITE are not set by NT4, even though * the permissions are equivalent, so we comply. * * Root directory system file (".") is different altogether. * - * The sd is recturned in *@sd_val and has length *@sd_val_len. + * The sd is returned in *@sd_val and has length *@sd_val_len. * * Do NOT free *@sd_val as it is static memory. This also means that you can * only use *@sd_val until the next call to this function. From 7145ab4b19650bba7894d828d7e3a2d6d542703f Mon Sep 17 00:00:00 2001 From: szaka Date: Thu, 7 Jul 2005 21:20:04 +0000 Subject: [PATCH 2332/2994] Document --bad-sectors of ntfsresize; update acknowledgement & known issues --- ntfsprogs/ntfsresize.8.in | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index b2174920..452bdfdf 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -154,6 +154,14 @@ Volume will be opened read-only and displays what it would do if it were to resize the filesystem. Continue with the real resizing only if the test run passed. .TP +.B -b, --bad-sectors +Support disks having physical errors, bad sectors. Make a backup by +.BR ntfsclone (8) +using option --rescue, then run from the command line 'chkdsk /f /r +volume:' on Windows prior using this option with ntfsresize. + +If the guarantee is still valid for the disk then replace it. It's defected. +.TP .B -P, --no-progress-bar Don't show progress bars. .TP @@ -173,7 +181,7 @@ but the mailing list is moderated and it can take a short time to approve your post. .PP There are some very rarely met limitations at present: filesystems having -bad sectors, highly fragmented Master File Table (MFT), relocation +unknown bad sectors, highly fragmented Master File Table (MFT), relocation of the first MFT extent and resizing in the middle of some metadata in some cases aren't supported yet. These cases are detected and resizing is refused, restricted to a safe size or the closest safe @@ -212,9 +220,11 @@ to Gergely Madarasz, Dewey M. Sasser and Miguel Lastra and his colleagues at the University of Granada for their continuous and highly valuable help, furthermore to Erik Meade, Martin Fick, Sandro Hawke, Dave Croal, Lorrin Nelson, Geert Hendrickx, Robert Bjorkman and Richard Burdick -for beta testing and to Theodore Ts'o whose +for beta testing the relocation support, to Florian Eyben, Fritz Oppliger, +Richard Ebling, Sid-Ahmed Touati, Jan Kiszka for the valued +contributions and to Theodore Ts'o whose .BR resize2fs (8) -man page formed the basis of this page. +man page originally formed the basis of this page. .SH AVAILABILITY .B Ntfsresize is part of the From 5693c1fcfb0245d98485cc7f122ade4e2144ca1c Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 8 Jul 2005 18:45:44 +0000 Subject: [PATCH 2333/2994] try removing the last entry in a dir (unsucessful, but close) --- ntfsprogs/ntfsrm.c | 394 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 359 insertions(+), 35 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index a1e34942..281ed69f 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -42,9 +42,10 @@ GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) -#define RM_WRITE 1 +//#define RM_WRITE 1 static int ntfs_inode_close2 (ntfs_inode *ni); +static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie); /** * version - Print version information about the program @@ -292,7 +293,9 @@ static int ntfs_bmp_commit (struct ntfs_bmp *bmp) { int i; u32 cs; +#ifdef RM_WRITE u32 ws; // write size +#endif if (!bmp) return 0; @@ -502,6 +505,8 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va int byte_start, byte_finish; // rename to b[sf] u8 mask_start, mask_finish; // rename to m[sf] + int a,b; + if (!bmp) return -1; @@ -513,7 +518,10 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va vcn_start = vcn; vcn_finish = vcn + length - 1; - for (i = vcn_start; i < ROUND_UP (vcn_finish, clust_size<<3); i += (clust_size<<3)) { + a = ROUND_DOWN (vcn_start, clust_size<<3); + b = ROUND_UP (vcn_finish, clust_size<<3) + 1; + + for (i = a; i < b; i += (clust_size<<3)) { buffer = ntfs_bmp_get_data (bmp, ROUND_DOWN (i, clust_size<<3)); if (!buffer) return -1; @@ -542,7 +550,7 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va memset (buffer+byte_start+1, value, byte_finish-byte_start-1); } else if (byte_finish == byte_start) { mask_start &= mask_finish; - mask_finish = value; + mask_finish = 0x00; } if (value) { @@ -554,6 +562,7 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va } } +#if 1 printf (GREEN "Modified: inode %lld, ", bmp->attr->ni->mft_no); switch (bmp->attr->type) { case AT_BITMAP: printf ("$BITMAP"); break; @@ -561,10 +570,74 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va default: break; } printf (" vcn %lld-%lld\n" END, vcn>>12, (vcn+length-1)>>12); +#endif return 1; } +/** + * ntfs_bmp_find_last_set + */ +static s64 ntfs_bmp_find_last_set (struct ntfs_bmp *bmp) +{ + s64 clust_count; + s64 byte_count; + s64 clust; + int byte; + int bit; + int note; + u8 *buffer; + + if (!bmp) + return -2; + + // find byte size of bmp + // find cluster size of bmp + + byte_count = bmp->attr->data_size; + clust_count = ROUND_UP (byte_count, bmp->vol->cluster_size) >> bmp->vol->cluster_size_bits; + + //printf ("bitmap = %lld bytes\n", byte_count); + //printf ("bitmap = %lld buffers\n", clust_count); + + // for each cluster backwards + for (clust = clust_count-1; clust >= 0; clust--) { + //printf ("cluster %lld\n", clust); + //printf ("get vcn %lld\n", clust << (bmp->vol->cluster_size_bits + 3)); + buffer = ntfs_bmp_get_data (bmp, clust << (bmp->vol->cluster_size_bits + 3)); + //utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); + if (!buffer) + return -2; + if ((clust == (clust_count-1) && ((byte_count % bmp->vol->cluster_size) != 0))) { + byte = byte_count % bmp->vol->cluster_size; + } else { + byte = bmp->vol->cluster_size; + } + //printf ("start byte = %d\n", byte); + // for each byte backward + for (byte--; byte >= 0; byte--) { + //printf ("\tbyte %d (%d)\n", byte, buffer[byte]); + // for each bit shift up + note = -1; + for (bit = 7; bit >= 0; bit--) { + //printf ("\t\tbit %d (%d)\n", (1<= 0) { + // if note, return value + //printf ("match %lld (c=%lld,b=%d,n=%d)\n", (((clust << bmp->vol->cluster_size_bits) + byte) << 3) + note, clust, byte, note); + return ((((clust << bmp->vol->cluster_size_bits) + byte) << 3) + note); + } + } + } + + return -1; +} + /** * ntfs_ie_get_vcn @@ -1097,9 +1170,28 @@ static int ntfs_dt_commit (struct ntfs_dt *dt) */ static int ntfs_dt_rollback (struct ntfs_dt *dt) { + int i; + if (!dt) return -1; - // inode rollback + + for (i = 0; i < dt->child_count; i++) { + if (dt->sub_nodes) + ntfs_dt_rollback (dt->sub_nodes[i]); + if (dt->inodes) + ntfs_inode_close2 (dt->inodes[i]); + } + + free (dt->data); + free (dt->children); + free (dt->sub_nodes); + free (dt->inodes); + + dt->data = NULL; + dt->children = NULL; + dt->sub_nodes = NULL; + dt->inodes = NULL; + return 0; } @@ -1116,8 +1208,10 @@ static void ntfs_dt_free (struct ntfs_dt *dt) ntfs_dt_rollback (dt); for (i = 0; i < dt->child_count; i++) { - ntfs_dt_free (dt->sub_nodes[i]); - ntfs_inode_close2 (dt->inodes[i]); + if (dt->sub_nodes) + ntfs_dt_rollback (dt->sub_nodes[i]); + if (dt->inodes) + ntfs_inode_close2 (dt->inodes[i]); } free (dt->sub_nodes); @@ -1894,6 +1988,101 @@ static int ntfs_inode_close2 (ntfs_inode *ni) } +/** + * utils_free_non_residents3 + */ +static int utils_free_non_residents3 (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECORD *attr) +{ + ntfs_attr *na; + runlist_element *rl; + LCN size; + LCN count; + + if (!bmp) + return 1; + if (!inode) + return 1; + if (!attr) + return 1; + if (!attr->non_resident) + return 0; + + na = ntfs_attr_open (inode, attr->type, NULL, 0); + if (!na) + return 1; + + ntfs_attr_map_whole_runlist (na); + rl = na->rl; + size = na->allocated_size >> inode->vol->cluster_size_bits; + for (count = 0; count < size; count += rl->length, rl++) { + if (ntfs_bmp_set_range (bmp, rl->lcn, rl->length, 0) < 0) { + printf (RED "set range : %lld - %lld FAILED\n" END, rl->lcn, rl->lcn+rl->length-1); + } + } + ntfs_attr_close (na); + + return 0; +} + +/** + * ntfs_mft_remove_attr + */ +static int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES type) +{ + ATTR_RECORD *attr20, *attrXX; + MFT_RECORD *mft; + u8 *src, *dst; + int len; + + if (!inode) + return 1; + + attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, inode->mrec); + if (attr20) + return 1; + + printf ("remove inode %lld, attr 0x%02X\n", inode->mft_no, type); + + attrXX = find_first_attribute (type, inode->mrec); + if (!attrXX) + return 1; + + if (utils_free_non_residents3 (bmp, inode, attrXX)) + return 1; + + // remove entry + // inode->mrec + + mft = inode->mrec; + //utils_dump_mem ((u8*)mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); + + //utils_dump_mem ((u8*)attrXX, 0, attrXX->length, DM_DEFAULTS); printf ("\n"); + + //printf ("mrec = %p, attr = %p, diff = %d (0x%02X)\n", mft, attrXX, (u8*)attrXX - (u8*)mft, (u8*)attrXX - (u8*)mft); + // memmove + + dst = (u8*) attrXX; + src = dst + attrXX->length; + len = (((u8*) mft + mft->bytes_in_use) - src); + + // fix mft header + mft->bytes_in_use -= attrXX->length; + +#if 0 + printf ("dst = 0x%02X, src = 0x%02X, len = 0x%02X\n", (dst - (u8*)mft), (src - (u8*)mft), len); + printf ("attr %02X, len = 0x%02X\n", attrXX->type, attrXX->length); + printf ("bytes in use = 0x%02X\n", mft->bytes_in_use); + printf ("\n"); +#endif + + memmove (dst, src, len); + //utils_dump_mem ((u8*)mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); + + NInoSetDirty(inode); + return 0; +} + + /** * ntfs_dir_commit */ @@ -2143,7 +2332,10 @@ static struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, i static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) { int i; - u8 *buffer; + //u8 *buffer; + //int buf_count; + s64 last_bit; + INDEX_ENTRY *ie; if (!vol || !dir) return -1; @@ -2152,24 +2344,109 @@ static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) return 0; #if 0 + buf_count = ROUND_UP (dir->bitmap->attr->allocated_size, vol->cluster_size) >> vol->cluster_size_bits; printf ("alloc = %lld bytes\n", dir->ialloc->allocated_size); printf ("alloc = %lld clusters\n", dir->ialloc->allocated_size >> vol->cluster_size_bits); printf ("bitmap bytes 0 to %lld\n", ((dir->ialloc->allocated_size >> vol->cluster_size_bits)-1)>>3); printf ("bitmap = %p\n", dir->bitmap); printf ("bitmap = %lld bytes\n", dir->bitmap->attr->allocated_size); + printf ("bitmap = %d buffers\n", buf_count); #endif + last_bit = ntfs_bmp_find_last_set (dir->bitmap); + if (dir->ialloc->allocated_size == (dir->index_size * (last_bit + 1))) { + //printf ("nothing to do\n"); + return 0; + } + + printf (BOLD YELLOW "Truncation needed\n" END); + + printf ("\tlast bit = %lld\n", last_bit); + printf ("\tactual IALLOC size = %lld\n", dir->ialloc->allocated_size); + printf ("\tshould IALLOC size = %lld\n", dir->index_size * (last_bit + 1)); + + if ((dir->index_size * (last_bit + 1)) == 0) { + printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); + //rollback all dts + //ntfs_dt_rollback (dir->index); + //dir->index = NULL; + // What about the ROOT dt? + + ie = ntfs_ie_copy (dir->index->children[0]); + if (!ie) { + printf (RED "IE copy failed\n" END); + return -1; + } + + ie = ntfs_ie_remove_vcn (ie); + if (!ie) { + printf (RED "IE remove vcn failed\n" END); + return -1; + } + + //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); + //utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); + ntfs_dt_root_replace (dir->index, 0, dir->index->children[0], ie); + //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); + printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); + + free (ie); + ie = NULL; + + //rollback dir's bmp + ntfs_bmp_rollback (dir->bitmap); + free (dir->bitmap); + dir->bitmap = NULL; + + for (i = 0; i < dir->index->child_count; i++) { + ntfs_dt_rollback (dir->index->sub_nodes[i]); + dir->index->sub_nodes[i] = NULL; + } + + //remove 0xA0 attribute + ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_INDEX_ALLOCATION); + + //remove 0xB0 attribute + ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_BITMAP); + } else { + printf (RED "Cannot shrink directory\n" END); + //ntfs_dir_shrink_alloc + //ntfs_dir_shrink_bitmap + //make bitmap resident? + } + + /* + * Remove + * dt -> dead + * bitmap updated + * rollback dead dts + * commit bitmap + * commit dts + * commit dir + */ + /* + * Reuse + * search for lowest dead + * update bitmap + * init dt + * remove from dead + * insert into tree + * init INDX + */ + +#if 0 buffer = ntfs_bmp_get_data (dir->bitmap, 0); if (!buffer) return -1; - //utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); - for (i = 0; i < 1; i++) { + utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); + for (i = buf_count-1; i >= 0; i--) { if (buffer[i]) { - //printf ("alloc in use\n"); + printf ("alloc in use\n"); return 0; } } +#endif // /$BITMAP($I30) // /$INDEX_ALLOCATION($I30) @@ -2179,6 +2456,9 @@ static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) // can we free any clusters of the alloc? // if yes, resize attribute + // Are *any* bits set? + // If not remove ialloc + return 0; } @@ -2666,11 +2946,11 @@ static int utils_free_non_residents (ntfs_inode *inode) static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) { ntfs_attr_search_ctx *ctx; - ntfs_attr *na; - ATTR_RECORD *arec; if (!inode) return -1; + if (!bmp) + return -1; ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); if (!ctx) { @@ -2679,24 +2959,7 @@ static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) } while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { - arec = ctx->attr; - if (arec->non_resident) { - na = ntfs_attr_open (inode, arec->type, NULL, 0); - if (na) { - runlist_element *rl; - LCN size; - LCN count; - ntfs_attr_map_whole_runlist (na); - rl = na->rl; - size = na->allocated_size >> inode->vol->cluster_size_bits; - for (count = 0; count < size; count += rl->length, rl++) { - if (ntfs_bmp_set_range (bmp, rl->lcn, rl->length, 0) < 0) { - printf (RED "set range : %lld - %lld FAILED\n" END, rl->lcn, rl->lcn+rl->length-1); - } - } - ntfs_attr_close (na); - } - } + utils_free_non_residents3 (bmp, inode, ctx->attr); } ntfs_attr_put_search_ctx (ctx); @@ -3295,6 +3558,12 @@ static BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) del->changed = TRUE; printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); + + if (del->child_count < 2) { + printf ("indx is empty\n"); + ntfs_bmp_set_range (del->dir->bitmap, del->vcn, 1, 0); + } + return TRUE; } @@ -4536,11 +4805,10 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) //utils_dump_mem (par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); if (par) - file = &par->children[par_num]->key.file_name; printf ("\tpar name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + file = &par->children[par_num]->key.file_name; printf ("\tpar name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); if (par == NULL) { // unhook everything - printf ("whole dir is empty\n"); goto freedts; } @@ -4666,17 +4934,17 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) // remove any unused nodes // XXX mark dts, dirs and inodes dirty - // XXX attach bmp to dir and volume - // XXX attach root dir to volume // XXX add freed dts to a list for immediate reuse (attach to dir?) // XXX any ded dts means we may need to adjust alloc // XXX commit will free list of spare dts // XXX reduce size of alloc + // XXX if ded, don't write it back, just update bitmap printf ("empty\n"); goto done; freedts: + printf ("\twhole dir is empty\n"); commit: //printf ("commit\n"); @@ -4712,12 +4980,15 @@ static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) if (1) ntfs_file_remove (vol, dt, dt_num); // remove name from index - if (0) ntfs_dir_truncate (vol, dir); + if (1) ntfs_dir_truncate (vol, dir); if (1) utils_volume_commit (vol); if (0) utils_volume_rollback (vol); + if (0) printf ("last mft = %lld\n", ntfs_bmp_find_last_set (bmp_mft)); + if (0) printf ("last vol = %lld\n", ntfs_bmp_find_last_set (bmp_vol)); + return 0; } @@ -4753,6 +5024,58 @@ static int ntfs_test_bmp (ntfs_volume *vol, ntfs_inode *inode) return 0; } +/** + * ntfs_test_bmp2 + */ +static int ntfs_test_bmp2 (ntfs_volume *vol) +{ + struct ntfs_bmp *bmp; + int i, j; + u8 value = 0x00; + + bmp = calloc (1, sizeof (*bmp)); + if (!bmp) + return 1; + + bmp->vol = vol; + bmp->attr = calloc (1, sizeof (*bmp->attr)); + bmp->attr->type = 0xB0; + bmp->attr->ni = calloc (1, sizeof (*bmp->attr->ni)); + bmp->count = 1; + bmp->data = calloc (4, sizeof (u8*)); + bmp->data[0] = calloc (1, vol->cluster_size); + bmp->data_vcn = calloc (4, sizeof (VCN)); + bmp->data_vcn[0] = 0; + + for (j = 0; j < 15; j++) { + memset (bmp->data[0], ~value, vol->cluster_size); + ntfs_bmp_set_range (bmp, j, 1, value); + for (i = 0; i < 8; i++) { ntfs_binary_print (bmp->data[0][i], TRUE, TRUE); printf (" "); } printf ("\n"); + } + + printf ("\n"); + for (j = 0; j < 15; j++) { + memset (bmp->data[0], ~value, vol->cluster_size); + ntfs_bmp_set_range (bmp, j, 2, value); + for (i = 0; i < 8; i++) { ntfs_binary_print (bmp->data[0][i], TRUE, TRUE); printf (" "); } printf ("\n"); + } + + printf ("\n"); + for (j = 0; j < 15; j++) { + memset (bmp->data[0], ~value, vol->cluster_size); + ntfs_bmp_set_range (bmp, j, 7, value); + for (i = 0; i < 8; i++) { ntfs_binary_print (bmp->data[0][i], TRUE, TRUE); printf (" "); } printf ("\n"); + } + + printf ("\n"); + for (j = 0; j < 15; j++) { + memset (bmp->data[0], ~value, vol->cluster_size); + ntfs_bmp_set_range (bmp, j, 8, value); + for (i = 0; i < 8; i++) { ntfs_binary_print (bmp->data[0][i], TRUE, TRUE); printf (" "); } printf ("\n"); + } + + return 0; +} /** * main - Begin here @@ -4806,6 +5129,7 @@ int main (int argc, char *argv[]) if (0) result = ntfs_file_add (vol, opts.file); if (1) result = ntfs_file_remove2 (vol, find.dt, find.dt_index); if (0) result = ntfs_test_bmp (vol, inode); + if (0) result = ntfs_test_bmp2 (vol); done: if (1) ntfs_inode_close2 (inode); From 0b060773f5dbf8570d9d76a95cd8d9bcef697f6f Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 9 Jul 2005 00:09:53 +0000 Subject: [PATCH 2334/2994] - layout.h: update info about EA's. - ntfsinfo: dump EA and EA_INFORMATION attributes. --- ChangeLog | 1 + include/ntfs/layout.h | 14 +++---- ntfsprogs/ntfsinfo.c | 90 +++++++++++++++++++++++++++++++++++++++---- 3 files changed, 90 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8adb452d..d74a275b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ xx/xx/xxxx - 1.10.1-WIP rely on libntfs. (Yura) - ntfsresize: support bad clusters list ($BadClus:$Bad), a.k.a. disks having bad sectors if the new --bad-sectors option is used. (Szaka) + - ntfsinfo: Dump $EA_INFORMATION and $EA attributes. (Yura) 20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 027a04d6..71d9c515 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -2,6 +2,7 @@ * layout.h - Ntfs on-disk layout structures. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -2294,7 +2295,7 @@ typedef struct { /* * Attribute: Extended attribute (EA) information (0xd0). * - * NOTE: Always resident. (Is this true???) + * NOTE: Always resident. */ typedef struct { u16 ea_length; /* Byte size of the packed extended @@ -2318,21 +2319,20 @@ typedef enum { /* * Attribute: Extended attribute (EA) (0xe0). * - * NOTE: Always non-resident. (Is this true?) - * * Like the attribute list and the index buffer list, the EA attribute value is * a sequence of EA_ATTR variable length records. * * FIXME: It appears weird that the EA name is not Unicode. Is it true? + * FIXME: It seems that name is always uppercased. Is it true? */ typedef struct { u32 next_entry_offset; /* Offset to the next EA_ATTR. */ EA_FLAGS flags; /* Flags describing the EA. */ - u8 ea_name_length; /* Length of the name of the extended + u8 name_length; /* Length of the name of the extended attribute in bytes. */ - u16 ea_value_length; /* Byte size of the EA's value. */ - u8 ea_name[0]; /* Name of the EA. */ - u8 ea_value[0]; /* The value of the EA. Immediately + u16 value_length; /* Byte size of the EA's value. */ + u8 name[0]; /* Name of the EA. */ + u8 value[0]; /* The value of the EA. Immediately follows the name. */ } __attribute__ ((__packed__)) EA_ATTR; diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index dc5fb946..cda2754b 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -40,8 +40,6 @@ * * Still need to do: * $REPARSE_POINT/$SYMBOLIC_LINK - * $EA_INFORMATION - * $EA * $PROPERTY_SET * $LOGGED_UTILITY_STREAM */ @@ -844,21 +842,28 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); if (attr->non_resident) { + /* FIXME: We don't handle fragmented mapping pairs case. */ runlist *rl = ntfs_mapping_pairs_decompress(vol, attr, 0); if (rl) { s64 data_size, bytes_read; data_size = sle64_to_cpu(attr->data_size); sec_desc_attr = malloc(data_size); + if (!sec_desc_attr) { + perror("malloc failed"); + free(rl); + return; + } bytes_read = ntfs_rl_pread(vol, rl, 0, data_size, sec_desc_attr); if (bytes_read != data_size) { Eprintf("ntfsinfo error: could not " "read security descriptor\n"); + free(rl); free(sec_desc_attr); return; } - free (rl); + free(rl); } else { Eprintf("ntfsinfo error: could not " "decompress runlist\n"); @@ -1462,10 +1467,18 @@ static void ntfs_dump_attr_reparse_point(ATTR_RECORD *attr __attribute__((unused * * dump the ea_information attribute */ -static void ntfs_dump_attr_ea_information(ATTR_RECORD *attr __attribute__((unused))) +static void ntfs_dump_attr_ea_information(ATTR_RECORD *attr) { + EA_INFORMATION *ea_info; + + ea_info = (EA_INFORMATION*)((u8*)attr + + le16_to_cpu(attr->value_offset)); printf("Dumping attribute $EA_INFORMATION (0xD0)\n"); - printf("\tTODO\n"); + printf("\tPacked EA length:\t %u\n", le16_to_cpu(ea_info->ea_length)); + printf("\tNEED_EA count:\t\t %u\n", + le16_to_cpu(ea_info->need_ea_count)); + printf("\tUnpacked EA length:\t %u\n", + le32_to_cpu(ea_info->ea_query_length)); } /** @@ -1473,10 +1486,71 @@ static void ntfs_dump_attr_ea_information(ATTR_RECORD *attr __attribute__((unuse * * dump the ea attribute */ -static void ntfs_dump_attr_ea(ATTR_RECORD *attr __attribute__((unused))) +static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol) { + EA_ATTR *ea; + u8 *buf = NULL; + printf("Dumping attribute $EA (0xE0)\n"); - printf("\tTODO\n"); + if (attr->non_resident) { + runlist *rl; + s64 data_size; + + data_size = sle64_to_cpu(attr->data_size); + printf("\tIs resident? \t\t No\n"); + printf("\tData size:\t\t %lld\n", data_size); + /* FIXME: We don't handle fragmented mapping pairs case. */ + rl = ntfs_mapping_pairs_decompress(vol, attr, 0); + if (rl) { + s64 bytes_read; + + buf = malloc(data_size); + if (!buf) { + perror("malloc failed"); + free(rl); + return; + } + bytes_read = ntfs_rl_pread(vol, rl, 0, data_size, buf); + if (bytes_read != data_size) { + perror("ntfs_rl_pread failed"); + free(buf); + free(rl); + return; + } + free(rl); + ea = (EA_ATTR*)buf; + } else { + perror("ntfs_mapping_pairs_decompress failed"); + return; + } + } else { + printf("\tIs resident? \t\t Yes\n"); + printf("\tAttribute value length:\t %u\n", + le32_to_cpu(attr->value_length)); + ea = (EA_ATTR*)((u8*)attr + le16_to_cpu(attr->value_offset)); + } + while (ea) { + printf("\n\tFlags:\t\t "); + if (ea->flags) { + if (ea->flags == NEED_EA) + printf("NEED_EA\n"); + else + printf("Unknown (0x%02x)\n", ea->flags); + } else + printf("\n"); + printf("\tName length:\t %d\n", ea->name_length); + printf("\tValue length:\t %d\n", + le16_to_cpu(ea->value_length)); + printf("\tName:\t\t '%s'\n", ea->name); + printf("\tValue:\t\t '%s'\n", ea->value + ea->name_length + 1); + if (ea->next_entry_offset) + ea = (EA_ATTR*)((u8*)ea + + le32_to_cpu(ea->next_entry_offset)); + else + ea = NULL; + } + if (buf) + free(buf); } /** @@ -1714,7 +1788,7 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) ntfs_dump_attr_ea_information(ctx->attr); break; case AT_EA: - ntfs_dump_attr_ea(ctx->attr); + ntfs_dump_attr_ea(ctx->attr, inode->vol); break; case AT_PROPERTY_SET: ntfs_dump_attr_property_set(ctx->attr); From bfbb32f0712ded26579924e2a51d47928012583e Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 9 Jul 2005 00:59:30 +0000 Subject: [PATCH 2335/2994] Dump every EA record only in verbose mode. --- ntfsprogs/ntfsinfo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index cda2754b..cb7df5af 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1499,6 +1499,8 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol) data_size = sle64_to_cpu(attr->data_size); printf("\tIs resident? \t\t No\n"); printf("\tData size:\t\t %lld\n", data_size); + if (!opts.verbose) + return; /* FIXME: We don't handle fragmented mapping pairs case. */ rl = ntfs_mapping_pairs_decompress(vol, attr, 0); if (rl) { @@ -1527,6 +1529,8 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol) printf("\tIs resident? \t\t Yes\n"); printf("\tAttribute value length:\t %u\n", le32_to_cpu(attr->value_length)); + if (!opts.verbose) + return; ea = (EA_ATTR*)((u8*)attr + le16_to_cpu(attr->value_offset)); } while (ea) { From 9b483d4f42467d381f09639a9fff06c172840fe0 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 9 Jul 2005 01:11:46 +0000 Subject: [PATCH 2336/2994] ntfsinfo: add range check in EA dumping ntfsmount: fix name in comment --- ntfsprogs/ntfsinfo.c | 12 +++++++----- ntfsprogs/ntfsmount.c | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index cb7df5af..500b53b6 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1490,11 +1490,11 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol) { EA_ATTR *ea; u8 *buf = NULL; + s64 data_size; printf("Dumping attribute $EA (0xE0)\n"); if (attr->non_resident) { runlist *rl; - s64 data_size; data_size = sle64_to_cpu(attr->data_size); printf("\tIs resident? \t\t No\n"); @@ -1526,14 +1526,14 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol) return; } } else { + data_size = le32_to_cpu(attr->value_length); printf("\tIs resident? \t\t Yes\n"); - printf("\tAttribute value length:\t %u\n", - le32_to_cpu(attr->value_length)); + printf("\tAttribute value length:\t %lld\n", data_size); if (!opts.verbose) return; ea = (EA_ATTR*)((u8*)attr + le16_to_cpu(attr->value_offset)); } - while (ea) { + while (1) { printf("\n\tFlags:\t\t "); if (ea->flags) { if (ea->flags == NEED_EA) @@ -1551,7 +1551,9 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol) ea = (EA_ATTR*)((u8*)ea + le32_to_cpu(ea->next_entry_offset)); else - ea = NULL; + break; + if ((u8*)ea - buf >= data_size) + break; } if (buf) free(buf); diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 2392e1f4..7b45c06f 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1,5 +1,5 @@ /** - * ntfsfuse - Part of the Linux-NTFS project. + * ntfsmount - Part of the Linux-NTFS project. * * Copyright (c) 2005 Yura Pakhuchiy * From 9cd8edce5f890d2b3565f373eef5fdd81526a056 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 9 Jul 2005 21:24:02 +0000 Subject: [PATCH 2337/2994] mkntfs: Fix backup bootsector creation. Thanks to Timur Amirkhanov for pointing this stupidity out. (We forgot to set the size before doing it.) (Anton) --- ChangeLog | 13 ++++++++----- ntfsprogs/mkntfs.c | 11 +++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index d74a275b..dd4e75fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,16 +1,19 @@ -xx/xx/xxxx - 1.10.1-WIP +xx/07/2005 - 1.10.1-WIP - ntfscp: fix signal hanling: handle both SIGTERM and SIGINT, print correct message. (Yura) - Update manual pages for ntfsprogs, ntfsclone, ntfsresize. (Szaka) - - ntfsclone: detect and hint users if the destination fs doesn't support - sparse files. (Szaka) + - ntfsclone: detect and hint users if the destination fs does not + support sparse files. (Szaka) - Fix memory managament error in ntfs_inode_close. (Yura) - - Add new utility - ntfsmount. It's a FUSE module that - rely on libntfs. (Yura) + - Add new utility - ntfsmount. It is a FUSE module that reles on + libntfs. (Yura) - ntfsresize: support bad clusters list ($BadClus:$Bad), a.k.a. disks having bad sectors if the new --bad-sectors option is used. (Szaka) - ntfsinfo: Dump $EA_INFORMATION and $EA attributes. (Yura) + - mkntfs: Fix backup bootsector creation. Thanks to Timur Amirkhanov + for pointing this stupidity out. (We forgot to set the size before + doing it.) (Anton) 20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 85ae0a6e..47ff8156 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3255,17 +3255,20 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) * * Return 0 on success or 1 if it couldn't be created. */ -static int create_backup_boot_sector(u8 *buff, int size) +static int create_backup_boot_sector(u8 *buff) { - ssize_t bw; - int _e = errno; const char *_s; + ssize_t bw; + int size, _e = errno; Vprintf("Creating backup boot sector.\n"); /* * Write the first max(512, opts.sector_size) bytes from buf to the * last sector. */ + size = 512; + if (size < opts.sector_size) + size = opts.sector_size; if (vol->dev->d_ops->seek(vol->dev, (opts.nr_sectors + 1) * opts.sector_size - size, SEEK_SET) == (off_t)-1) goto bb_err; @@ -3598,7 +3601,7 @@ static void mkntfs_create_root_structures(void) if (err < 0) err_exit("Couldn't create $Boot: %s\n", strerror(-err)); - if (create_backup_boot_sector(buf2, i) != 0) { + if (create_backup_boot_sector(buf2) != 0) { /* * Pre-2.6 kernels couldn't access the last sector * if it was odd hence we schedule chkdsk to create it. From b942e2c03a1150dac7db118deea73bb8c7c38982 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 9 Jul 2005 21:32:17 +0000 Subject: [PATCH 2338/2994] Move ntfsmount to extra programs as it doesn't even approximate being compilable! (At least on my machine which has fuse 2.2.1.) And I need a working snapshot for Timur. --- Makefile.in | 1 - aclocal.m4 | 520 ++++++---------- config.guess | 64 +- config.sub | 5 +- configure | 1216 +++++++++++++------------------------- doc/Makefile.in | 1 - include/Makefile.in | 1 - include/ntfs/Makefile.in | 1 - libntfs/Makefile.in | 1 - ltmain.sh | 156 ++--- ntfsprogs/Makefile.am | 2 +- ntfsprogs/Makefile.in | 5 +- 12 files changed, 695 insertions(+), 1278 deletions(-) diff --git a/Makefile.in b/Makefile.in index 553116e9..23ba5a81 100644 --- a/Makefile.in +++ b/Makefile.in @@ -144,7 +144,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/aclocal.m4 b/aclocal.m4 index 4ebc090e..2b04da7c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -123,7 +123,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed='sed -e s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -191,7 +191,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -238,48 +238,6 @@ compiler=$CC ])# _LT_AC_SYS_COMPILER -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -AC_DEFUN([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -]) - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -AC_DEFUN([_LT_COMPILER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -AC_DEFUN([_LT_LINKER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_LINKER_BOILERPLATE - - # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -621,10 +579,8 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then $2=yes fi fi @@ -655,11 +611,6 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi else $2=yes fi @@ -729,7 +680,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -1015,9 +965,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi @@ -1516,7 +1464,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1579,11 +1527,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -2573,10 +2517,6 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # # Check for any special shared library compilation flags. # @@ -2709,10 +2649,6 @@ lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -2734,7 +2670,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2995,7 +2931,7 @@ case $host_os in fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -3013,11 +2949,11 @@ case $host_os in dgux*) case $cc_basename in - ec++*) + ec++) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx*) + ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3052,11 +2988,11 @@ case $host_os in # location of the library. case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC*) + aCC) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -3117,11 +3053,11 @@ case $host_os in esac case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC*) + aCC) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -3161,9 +3097,9 @@ case $host_os in ;; irix5* | irix6*) case $cc_basename in - CC*) + CC) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -3174,7 +3110,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -3187,7 +3123,7 @@ case $host_os in ;; linux*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3212,7 +3148,7 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc*) + icpc) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -3237,16 +3173,15 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC) # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx*) + cxx) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -3277,7 +3212,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx*) + cxx) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3316,7 +3251,7 @@ case $host_os in ;; osf3*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3332,14 +3267,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx*) + cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3357,7 +3292,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3376,7 +3311,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3391,17 +3326,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx*) + cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3420,7 +3355,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3444,7 +3379,7 @@ case $host_os in sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3456,12 +3391,12 @@ case $host_os in ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc*) + lcc) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3474,7 +3409,7 @@ case $host_os in ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3488,13 +3423,9 @@ case $host_os in *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3515,7 +3446,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx*) + gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -3558,7 +3489,7 @@ case $host_os in ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3790,16 +3721,12 @@ lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3818,9 +3745,7 @@ aix3*) fi ;; aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi + test "$enable_shared" = yes && enable_static=no ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3876,22 +3801,15 @@ lt_simple_link_test_code='public class conftest { public static void main(String # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds - AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) @@ -3934,16 +3852,11 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) @@ -3973,7 +3886,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -4079,7 +3992,7 @@ ifelse([$1], [], # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -4090,7 +4003,7 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -4173,7 +4086,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4207,7 +4120,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4733,7 +4646,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68*) + cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -4742,7 +4655,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4751,10 +4664,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; dgux*) case $cc_basename in - ec++*) + ec++) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx*) + ghcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4767,14 +4680,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; - aCC*) + aCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -4792,7 +4705,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. @@ -4803,7 +4716,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) case $cc_basename in - KCC*) + KCC) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' @@ -4814,13 +4727,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC*) + pgCC) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - cxx*) + cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -4837,7 +4750,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx*) + cxx) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) @@ -4848,14 +4761,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC*) + KCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC*) + RCC) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx*) + cxx) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -4871,7 +4784,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sco*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) @@ -4880,13 +4793,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; - gcx*) + gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4896,12 +4809,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc*) + lcc) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4911,7 +4824,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -5011,7 +4924,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5059,7 +4972,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5086,14 +4999,9 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac ;; sunos4*) @@ -5223,8 +5131,7 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - _LT_CC_BASENAME([$compiler]) + case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time @@ -5243,28 +5150,7 @@ ifelse([$1],[CXX],[ if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -5333,37 +5219,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -5402,6 +5257,41 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -5412,11 +5302,16 @@ EOF ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -5621,7 +5516,7 @@ EOF _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -5824,7 +5719,7 @@ EOF _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5843,12 +5738,10 @@ EOF solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -5857,18 +5750,8 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - *) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6159,120 +6042,63 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# -# Copyright © 2004 Scott James Remnant . -# -# 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 of the License, 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi - -fi[]dnl -])# PKG_PROG_PKG_CONFIG +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN([PKG_CHECK_MODULES], [ + succeeded=no -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then - pkg_cv_[]$1=$ac_cv_env_[]$1[]_value -elif test -n "$PKG_CONFIG"; then - if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then - pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.in -# -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) -pkg_failed=no -AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], - [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) -AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], - [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes -if test $pkg_failed = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) - ifelse([$4], , [AC_MSG_ERROR(dnl -[Package requirements ($2) were not met. -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details.])], - [$4]) -elif test $pkg_failed = untried; then - ifelse([$4], , [AC_MSG_FAILURE(dnl -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details. -To get pkg-config, see .])], - [$4]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - ifelse([$3], , :, [$3]) -fi[]dnl -])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # diff --git a/config.guess b/config.guess index 892833f9..44f30e6c 100755 --- a/config.guess +++ b/config.guess @@ -136,6 +136,16 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -825,25 +835,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo cris-axis-linux exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo crisv32-axis-linux exit 0 ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo frv-${VENDOR}-linux exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -862,7 +872,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -881,13 +891,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-${VENDOR}-linux exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-${VENDOR}-linux exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -900,34 +910,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-${VENDOR}-linux ;; + PA8*) echo hppa2.0-${VENDOR}-linux ;; + *) echo hppa-${VENDOR}-linux ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-${VENDOR}-linux exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo x86_64-${VENDOR}-linux exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -942,18 +952,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" + echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" + echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or + # Either a pre-BFD a.out linker (linuxoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -982,7 +992,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.sub b/config.sub index d8fd2f8f..c884ad4e 100755 --- a/config.sub +++ b/config.sub @@ -1172,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1205,9 +1205,6 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index d9d9c3ae..ce7c29a8 100755 --- a/configure +++ b/configure @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -947,26 +947,6 @@ ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS -ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} -ac_env_PKG_CONFIG_value=$PKG_CONFIG -ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} -ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG -ac_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} -ac_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS -ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} -ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS -ac_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} -ac_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS -ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} -ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS -ac_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} -ac_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS -ac_cv_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} -ac_cv_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS -ac_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} -ac_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS -ac_cv_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} -ac_cv_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS # # Report the --help message. @@ -1090,15 +1070,6 @@ Some influential environment variables: CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags - PKG_CONFIG path to pkg-config utility - LIBNTFS_GNOMEVFS_CFLAGS - C compiler flags for LIBNTFS_GNOMEVFS, overriding pkg-config - LIBNTFS_GNOMEVFS_LIBS - linker flags for LIBNTFS_GNOMEVFS, overriding pkg-config - FUSE_MODULE_CFLAGS - C compiler flags for FUSE_MODULE, overriding pkg-config - FUSE_MODULE_LIBS - linker flags for FUSE_MODULE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -3941,7 +3912,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3944 "configure"' > conftest.$ac_ext + echo '#line 3915 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5520,7 +5491,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5523:" \ +echo "$as_me:5494:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5721,7 +5692,6 @@ else fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -6012,7 +5982,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed='sed -e s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. @@ -6317,16 +6287,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -6514,20 +6475,6 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # # Check for any special shared library compilation flags. # @@ -6569,11 +6516,6 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works=yes - fi else lt_prog_compiler_static_works=yes fi @@ -6618,17 +6560,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6621: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6563: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6625: \$? = $ac_status" >&5 + echo "$as_me:6567: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -6734,7 +6674,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' @@ -6782,7 +6722,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -6809,14 +6749,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac ;; sunos4*) @@ -6880,17 +6815,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6883: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6818: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6887: \$? = $ac_status" >&5 + echo "$as_me:6822: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works=yes fi fi @@ -6942,18 +6875,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6945: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6878: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6949: \$? = $ac_status" >&5 + echo "$as_me:6882: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o=yes fi fi @@ -7033,16 +6964,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -7063,27 +6984,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -7152,37 +7052,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -7221,6 +7090,41 @@ EOF hardcode_shlibpath_var=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds=$archive_cmds + fi + else + ld_shlibs=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -7231,11 +7135,16 @@ EOF ;; esac - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -7542,7 +7451,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -7745,7 +7654,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -7764,12 +7673,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -7778,18 +7685,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs=yes ;; @@ -8326,7 +8223,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -8389,11 +8286,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -9182,7 +9075,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6;} # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -9549,7 +9442,7 @@ echo "$as_me: creating $ofile" >&6;} SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -9631,7 +9524,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9665,7 +9558,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -10020,20 +9913,6 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -10055,16 +9934,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -10534,7 +10404,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -10552,11 +10422,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi dgux*) case $cc_basename in - ec++*) + ec++) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - ghcx*) + ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10591,11 +10461,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # location of the library. case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC*) + aCC) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -10656,11 +10526,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC*) + aCC) case "$host_cpu" in hppa*64*|ia64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -10700,9 +10570,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; irix5* | irix6*) case $cc_basename in - CC*) + CC) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -10713,7 +10583,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -10726,7 +10596,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; linux*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10751,7 +10621,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc*) + icpc) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -10776,16 +10646,15 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC) # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx*) + cxx) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -10816,7 +10685,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; mvs*) case $cc_basename in - cxx*) + cxx) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10855,7 +10724,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf3*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10871,14 +10740,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx*) + cxx) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10896,7 +10765,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10915,7 +10784,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf4* | osf5*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10930,17 +10799,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx*) + cxx) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -10959,7 +10828,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10983,7 +10852,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi sco*) archive_cmds_need_lc_CXX=no case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10995,12 +10864,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - lcc*) + lcc) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11013,7 +10882,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -11027,13 +10896,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -11054,7 +10919,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; - gcx*) + gcx) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -11097,7 +10962,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11306,7 +11171,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; chorus*) case $cc_basename in - cxch68*) + cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -11315,7 +11180,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' @@ -11324,10 +11189,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; dgux*) case $cc_basename in - ec++*) + ec++) lt_prog_compiler_pic_CXX='-KPIC' ;; - ghcx*) + ghcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; @@ -11340,14 +11205,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC*) + CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; - aCC*) + aCC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -11365,7 +11230,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC*) + CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. @@ -11376,7 +11241,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) case $cc_basename in - KCC*) + KCC) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' @@ -11387,13 +11252,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; - pgCC*) + pgCC) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-static' ;; - cxx*) + cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -11410,7 +11275,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; mvs*) case $cc_basename in - cxx*) + cxx) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) @@ -11421,14 +11286,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC*) + KCC) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; - RCC*) + RCC) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; - cxx*) + cxx) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -11444,7 +11309,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sco*) case $cc_basename in - CC*) + CC) lt_prog_compiler_pic_CXX='-fPIC' ;; *) @@ -11453,13 +11318,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; - gcx*) + gcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; @@ -11469,12 +11334,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; - lcc*) + lcc) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; @@ -11484,7 +11349,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; @@ -11528,17 +11393,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11531: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11396: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11535: \$? = $ac_status" >&5 + echo "$as_me:11400: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_CXX=yes fi fi @@ -11590,18 +11453,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11593: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11456: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11597: \$? = $ac_status" >&5 + echo "$as_me:11460: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_CXX=yes fi fi @@ -12103,7 +11964,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -12166,11 +12027,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -12959,7 +12816,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 @@ -13688,9 +13522,7 @@ aix3*) fi ;; aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi + test "$enable_shared" = yes && enable_static=no ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 @@ -13796,7 +13628,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' @@ -13844,7 +13676,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' @@ -13871,14 +13703,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_F77='-Qoption ld ';; - *) - lt_prog_compiler_wl_F77='-Wl,';; - esac ;; sunos4*) @@ -13942,17 +13769,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13945: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13772: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13949: \$? = $ac_status" >&5 + echo "$as_me:13776: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_F77=yes fi fi @@ -14004,18 +13829,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14007: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13832: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14011: \$? = $ac_status" >&5 + echo "$as_me:13836: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_F77=yes fi fi @@ -14095,16 +13918,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -14125,27 +13938,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -14214,37 +14006,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_F77=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -14283,6 +14044,41 @@ EOF hardcode_shlibpath_var_F77=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_F77=$archive_cmds_F77 + fi + else + ld_shlibs_F77=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -14293,11 +14089,16 @@ EOF ;; esac - if test "$ld_shlibs_F77" = no; then - runpath_var= - hardcode_libdir_flag_spec_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= + if test "$ld_shlibs_F77" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -14584,7 +14385,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -14787,7 +14588,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' @@ -14806,12 +14607,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -14820,18 +14619,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_F77=yes ;; @@ -15368,7 +15157,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -15431,11 +15220,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15634,7 +15419,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -15783,7 +15568,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -15817,7 +15602,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -16066,41 +15851,15 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no -old_archive_cmds_GCJ=$old_archive_cmds - lt_prog_compiler_no_builtin_flag_GCJ= @@ -16126,17 +15885,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16129: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15888: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16133: \$? = $ac_status" >&5 + echo "$as_me:15892: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -16242,7 +15999,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' @@ -16290,7 +16047,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16317,14 +16074,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_GCJ='-Qoption ld ';; - *) - lt_prog_compiler_wl_GCJ='-Wl,';; - esac ;; sunos4*) @@ -16388,17 +16140,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16391: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16143: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16395: \$? = $ac_status" >&5 + echo "$as_me:16147: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_GCJ=yes fi fi @@ -16450,18 +16200,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16453: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16203: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16457: \$? = $ac_status" >&5 + echo "$as_me:16207: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi @@ -16541,16 +16289,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -16571,27 +16309,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -16660,37 +16377,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_GCJ=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -16729,6 +16415,41 @@ EOF hardcode_shlibpath_var_GCJ=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_GCJ=$archive_cmds_GCJ + fi + else + ld_shlibs_GCJ=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -16739,11 +16460,16 @@ EOF ;; esac - if test "$ld_shlibs_GCJ" = no; then - runpath_var= - hardcode_libdir_flag_spec_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= + if test "$ld_shlibs_GCJ" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -17050,7 +16776,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -17253,7 +16979,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' @@ -17272,12 +16998,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -17286,18 +17010,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_GCJ=yes ;; @@ -17834,7 +17548,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -17897,11 +17611,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -18690,7 +18400,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the @@ -19380,7 +19066,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -19529,7 +19215,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -19563,7 +19249,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -20213,11 +19899,11 @@ if test "$enable_gnome_vfs" != "no"; then export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" fi + succeeded=no -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then @@ -20242,6 +19928,7 @@ do done done + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -20255,123 +19942,56 @@ else echo "${ECHO_T}no" >&6 fi -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 fi -done -done - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 +echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 -if test -n "$ac_pt_PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 -echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - PKG_CONFIG=$ac_pt_PKG_CONFIG -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 -echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - echo "$as_me:$LINENO: result: yes" >&5 + if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - PKG_CONFIG="" - fi + succeeded=yes -fi + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 -pkg_failed=no -echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 -if test "${pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set" = "xset"; then - pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&6 -echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 -if test "${pkg_cv_LIBNTFS_GNOMEVFS_LIBS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set" = "xset"; then - pkg_cv_LIBNTFS_GNOMEVFS_LIBS=$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&6 + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 + else + LIBNTFS_GNOMEVFS_CFLAGS="" + LIBNTFS_GNOMEVFS_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` -if test $pkg_failed = yes; then - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - # Put the nasty error message in config.log where it belongs - echo "$LIBNTFS_GNOMEVFS_PKG_ERRORS" 1>&5 + fi + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + compile_gnome_vfs=true + else + if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} @@ -20381,22 +20001,8 @@ echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi -elif test $pkg_failed = untried; then + fi - if test "$enable_gnome_vfs" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - fi - -else - LIBNTFS_GNOMEVFS_CFLAGS=$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS - LIBNTFS_GNOMEVFS_LIBS=$pkg_cv_LIBNTFS_GNOMEVFS_LIBS - compile_gnome_vfs=true -fi fi @@ -20413,59 +20019,98 @@ fi compile_fuse_module=false if test "$enable_fuse_module" != "no"; then -pkg_failed=no -echo "$as_me:$LINENO: checking for FUSE_MODULE_CFLAGS" >&5 -echo $ECHO_N "checking for FUSE_MODULE_CFLAGS... $ECHO_C" >&6 -if test "${pkg_cv_FUSE_MODULE_CFLAGS+set}" = set; then + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "x$ac_cv_env_FUSE_MODULE_CFLAGS_set" = "xset"; then - pkg_cv_FUSE_MODULE_CFLAGS=$ac_cv_env_FUSE_MODULE_CFLAGS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "fuse" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_CFLAGS" >&5 -echo "${ECHO_T}$pkg_cv_FUSE_MODULE_CFLAGS" >&6 -echo "$as_me:$LINENO: checking for FUSE_MODULE_LIBS" >&5 -echo $ECHO_N "checking for FUSE_MODULE_LIBS... $ECHO_C" >&6 -if test "${pkg_cv_FUSE_MODULE_LIBS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_FUSE_MODULE_LIBS_set" = "xset"; then - pkg_cv_FUSE_MODULE_LIBS=$ac_cv_env_FUSE_MODULE_LIBS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "fuse" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_LIBS" >&5 -echo "${ECHO_T}$pkg_cv_FUSE_MODULE_LIBS" >&6 + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -if test $pkg_failed = yes; then - FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse"` - # Put the nasty error message in config.log where it belongs - echo "$FUSE_MODULE_PKG_ERRORS" 1>&5 + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for fuse" >&5 +echo $ECHO_N "checking for fuse... $ECHO_C" >&6 + + if $PKG_CONFIG --exists "fuse" ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + succeeded=yes + + echo "$as_me:$LINENO: checking FUSE_MODULE_CFLAGS" >&5 +echo $ECHO_N "checking FUSE_MODULE_CFLAGS... $ECHO_C" >&6 + FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse"` + echo "$as_me:$LINENO: result: $FUSE_MODULE_CFLAGS" >&5 +echo "${ECHO_T}$FUSE_MODULE_CFLAGS" >&6 + + echo "$as_me:$LINENO: checking FUSE_MODULE_LIBS" >&5 +echo $ECHO_N "checking FUSE_MODULE_LIBS... $ECHO_C" >&6 + FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse"` + echo "$as_me:$LINENO: result: $FUSE_MODULE_LIBS" >&5 +echo "${ECHO_T}$FUSE_MODULE_LIBS" >&6 + else + FUSE_MODULE_CFLAGS="" + FUSE_MODULE_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse"` + + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + compile_fuse_module=true + else if test "$enable_fuse_module" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires fuse library." >&5 @@ -20476,22 +20121,8 @@ echo "$as_me: error: Linux-NTFS FUSE module requires fuse library." >&2;} echo "$as_me: WARNING: Linux-NTFS FUSE module requires fuse library." >&2;} fi -elif test $pkg_failed = untried; then + fi - if test "$enable_fuse_module" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires fuse library." >&5 -echo "$as_me: error: Linux-NTFS FUSE module requires fuse library." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires fuse library." >&5 -echo "$as_me: WARNING: Linux-NTFS FUSE module requires fuse library." >&2;} - fi - -else - FUSE_MODULE_CFLAGS=$pkg_cv_FUSE_MODULE_CFLAGS - FUSE_MODULE_LIBS=$pkg_cv_FUSE_MODULE_LIBS - compile_fuse_module=true -fi fi @@ -24302,7 +23933,6 @@ s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t -s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t diff --git a/doc/Makefile.in b/doc/Makefile.in index e9a42652..ab7029cb 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -119,7 +119,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/Makefile.in b/include/Makefile.in index 2202b27d..dbaff49f 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -128,7 +128,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 2c384c38..96473220 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -132,7 +132,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 37bab1b3..3b73331f 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -194,7 +194,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/ltmain.sh b/ltmain.sh index eecedf23..3d071010 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -17,7 +17,7 @@ # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,8 +43,8 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.18 -TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)" +VERSION=1.5.14 +TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. @@ -112,9 +112,8 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" +: ${IFS=" +"} if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -251,14 +250,37 @@ func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" + f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else - $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 - exit $EXIT_FAILURE + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ + | $EGREP -v '^[ ]*1[ ]' | while read count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? + i=`expr $i + 1` + done + done + $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" fi } @@ -735,15 +757,6 @@ if test -z "$show_help"; then esac done - qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` - case $qlibobj in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qlibobj="\"$qlibobj\"" ;; - esac - if test "X$libobj" != "X$qlibobj"; then - $echo "$modename: libobj name \`$libobj' may not contain shell special characters." - exit $EXIT_FAILURE - fi objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -816,17 +829,12 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo "$srcfile" > "$lockfile" + $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi - qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` - case $qsrcfile in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qsrcfile="\"$qsrcfile\"" ;; - esac $run $rm "$libobj" "${libobj}T" @@ -848,10 +856,10 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" + command="$base_compile $srcfile $pic_flag" else # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $srcfile" fi if test ! -d "${xdir}$objdir"; then @@ -931,9 +939,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $srcfile" else - command="$base_compile $qsrcfile $pic_flag" + command="$base_compile $srcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -1357,8 +1365,6 @@ EOF ;; darwin_framework) compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" prev= continue ;; @@ -1423,8 +1429,6 @@ EOF -framework) prev=darwin_framework compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" continue ;; @@ -2848,13 +2852,13 @@ EOF *) continue ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac done fi # link_all_deplibs != no fi # linkmode = lib @@ -3120,7 +3124,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3129,7 +3133,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3138,7 +3142,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -5087,63 +5091,6 @@ fi\ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "copying selected object files to avoid basename conflicts..." - - if test -z "$gentop"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - fi - - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - counter=`expr $counter + 1` - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - $run ln "$obj" "$gentop/$newobj" || - $run cp "$obj" "$gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5157,7 +5104,20 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -6066,14 +6026,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" + exec_cmd="\"\$cmd\"$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - $echo "$cmd$args" + eval \$echo \"\$cmd\"$args exit $EXIT_SUCCESS fi ;; diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index d8713bc6..db282e1b 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -28,7 +28,7 @@ CLEANFILES = $(EXTRA_PROGRAMS) linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs if ENABLE_FUSE_MODULE -bin_PROGRAMS += ntfsmount +EXTRA_PROGRAMS += ntfsmount endif # Set the include path. diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 43810251..90df7722 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -40,13 +40,13 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ - ntfsls$(EXEEXT) ntfscat$(EXEEXT) $(am__EXEEXT_1) + ntfsls$(EXEEXT) ntfscat$(EXEEXT) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) \ ntfscp$(EXEEXT) EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) ntfswipe$(EXEEXT) \ ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) ntfsrm$(EXEEXT) \ - ntfsmftalloc$(EXEEXT) + ntfsmftalloc$(EXEEXT) $(am__EXEEXT_1) @ENABLE_FUSE_MODULE_TRUE@am__append_1 = ntfsmount subdir = ntfsprogs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ @@ -240,7 +240,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ From 48af715f6081ae4d2267c8fe0f4a8deacfefce41 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 10 Jul 2005 12:38:46 +0000 Subject: [PATCH 2339/2994] * Add check to auto scripts for FUSE to be >= 2.3.0. * Move ntfsmount back to standard programs set. --- Makefile.in | 1 + aclocal.m4 | 520 ++++++++++------ config.guess | 64 +- config.sub | 5 +- configure | 1220 +++++++++++++++++++++++++------------- configure.ac | 6 +- doc/Makefile.in | 1 + include/Makefile.in | 1 + include/ntfs/Makefile.in | 1 + libntfs/Makefile.in | 1 + ltmain.sh | 156 +++-- ntfsprogs/Makefile.am | 2 +- ntfsprogs/Makefile.in | 5 +- 13 files changed, 1283 insertions(+), 700 deletions(-) diff --git a/Makefile.in b/Makefile.in index 23ba5a81..553116e9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -144,6 +144,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/aclocal.m4 b/aclocal.m4 index 2b04da7c..4ebc090e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -123,7 +123,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -191,7 +191,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -238,6 +238,48 @@ compiler=$CC ])# _LT_AC_SYS_COMPILER +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_LINKER_BOILERPLATE + + # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -579,8 +621,10 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi @@ -611,6 +655,11 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi else $2=yes fi @@ -680,6 +729,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -965,7 +1015,9 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi @@ -1464,7 +1516,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1527,7 +1579,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -2517,6 +2573,10 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # # Check for any special shared library compilation flags. # @@ -2649,6 +2709,10 @@ lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -2670,7 +2734,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2931,7 +2995,7 @@ case $host_os in fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -2949,11 +3013,11 @@ case $host_os in dgux*) case $cc_basename in - ec++) + ec++*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -2988,11 +3052,11 @@ case $host_os in # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) + aCC*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -3053,11 +3117,11 @@ case $host_os in esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) + aCC*) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -3097,9 +3161,9 @@ case $host_os in ;; irix5* | irix6*) case $cc_basename in - CC) + CC*) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -3110,7 +3174,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -3123,7 +3187,7 @@ case $host_os in ;; linux*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3148,7 +3212,7 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -3173,15 +3237,16 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC) + pgCC*) # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx) + cxx*) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -3212,7 +3277,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3251,7 +3316,7 @@ case $host_os in ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3267,14 +3332,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3292,7 +3357,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3311,7 +3376,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3326,17 +3391,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3355,7 +3420,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3379,7 +3444,7 @@ case $host_os in sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3391,12 +3456,12 @@ case $host_os in ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3409,7 +3474,7 @@ case $host_os in ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3423,9 +3488,13 @@ case $host_os in *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3446,7 +3515,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -3489,7 +3558,7 @@ case $host_os in ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3721,12 +3790,16 @@ lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3745,7 +3818,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3801,15 +3876,22 @@ lt_simple_link_test_code='public class conftest { public static void main(String # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) @@ -3852,11 +3934,16 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) @@ -3886,7 +3973,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -3992,7 +4079,7 @@ ifelse([$1], [], # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -4003,7 +4090,7 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -4086,7 +4173,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4120,7 +4207,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4646,7 +4733,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68) + cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -4655,7 +4742,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4664,10 +4751,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; dgux*) case $cc_basename in - ec++) + ec++*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4680,14 +4767,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; - aCC) + aCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -4705,7 +4792,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. @@ -4716,7 +4803,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' @@ -4727,13 +4814,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC) + pgCC*) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - cxx) + cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -4750,7 +4837,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx) + cxx*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) @@ -4761,14 +4848,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx) + cxx*) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -4784,7 +4871,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sco*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) @@ -4793,13 +4880,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; - gcx) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4809,12 +4896,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc) + lcc*) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4824,7 +4911,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -4924,7 +5011,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4972,7 +5059,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4999,9 +5086,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac ;; sunos4*) @@ -5131,7 +5223,8 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time @@ -5150,7 +5243,28 @@ ifelse([$1],[CXX],[ if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -5219,6 +5333,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -5257,41 +5402,6 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -5302,16 +5412,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -5516,7 +5621,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -5719,7 +5824,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5738,10 +5843,12 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -5750,8 +5857,18 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6042,63 +6159,120 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# 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 of the License, 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. -dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ - succeeded=no +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG - if test -z "$PKG_CONFIG"; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - fi +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then + pkg_cv_[]$1=$ac_cv_env_[]$1[]_value +elif test -n "$PKG_CONFIG"; then + if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then + pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - AC_MSG_CHECKING(for $2) +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.in +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - if $PKG_CONFIG --exists "$2" ; then - AC_MSG_RESULT(yes) - succeeded=yes +pkg_failed=no +AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], + [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) +AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], + [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) - AC_MSG_CHECKING($1_CFLAGS) - $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` - AC_MSG_RESULT($$1_CFLAGS) +if test $pkg_failed = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD - AC_MSG_CHECKING($1_LIBS) - $1_LIBS=`$PKG_CONFIG --libs "$2"` - AC_MSG_RESULT($$1_LIBS) - else - $1_CFLAGS="" - $1_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - ifelse([$4], ,echo $$1_PKG_ERRORS,) - fi + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met. +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. - AC_SUBST($1_CFLAGS) - AC_SUBST($1_LIBS) - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - ifelse([$3], , :, [$3]) - else - ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) - fi -]) +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details.])], + [$4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details. +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # diff --git a/config.guess b/config.guess index 44f30e6c..892833f9 100755 --- a/config.guess +++ b/config.guess @@ -136,16 +136,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -835,25 +825,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux + echo cris-axis-linux-gnu exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux + echo crisv32-axis-linux-gnu exit 0 ;; frv:Linux:*:*) - echo frv-${VENDOR}-linux + echo frv-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -872,7 +862,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -891,13 +881,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux + echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux + echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -910,34 +900,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux + echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux + echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -952,18 +942,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" + echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" + echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linuxoldld) or + # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -992,7 +982,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.sub b/config.sub index c884ad4e..d8fd2f8f 100755 --- a/config.sub +++ b/config.sub @@ -1172,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1205,6 +1205,9 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index ce7c29a8..0d1be1e7 100755 --- a/configure +++ b/configure @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -947,6 +947,26 @@ ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS +ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_env_PKG_CONFIG_value=$PKG_CONFIG +ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG +ac_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} +ac_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS +ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} +ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS +ac_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} +ac_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS +ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} +ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS +ac_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} +ac_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS +ac_cv_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} +ac_cv_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS +ac_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} +ac_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS +ac_cv_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} +ac_cv_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS # # Report the --help message. @@ -1070,6 +1090,15 @@ Some influential environment variables: CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags + PKG_CONFIG path to pkg-config utility + LIBNTFS_GNOMEVFS_CFLAGS + C compiler flags for LIBNTFS_GNOMEVFS, overriding pkg-config + LIBNTFS_GNOMEVFS_LIBS + linker flags for LIBNTFS_GNOMEVFS, overriding pkg-config + FUSE_MODULE_CFLAGS + C compiler flags for FUSE_MODULE, overriding pkg-config + FUSE_MODULE_LIBS + linker flags for FUSE_MODULE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -3912,7 +3941,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3915 "configure"' > conftest.$ac_ext + echo '#line 3944 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5491,7 +5520,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5494:" \ +echo "$as_me:5523:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5692,6 +5721,7 @@ else fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -5982,7 +6012,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. @@ -6287,7 +6317,16 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -6475,6 +6514,20 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # # Check for any special shared library compilation flags. # @@ -6516,6 +6569,11 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works=yes + fi else lt_prog_compiler_static_works=yes fi @@ -6560,15 +6618,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6563: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6621: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6567: \$? = $ac_status" >&5 + echo "$as_me:6625: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -6674,7 +6734,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' @@ -6722,7 +6782,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -6749,9 +6809,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac ;; sunos4*) @@ -6815,15 +6880,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6818: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6883: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6822: \$? = $ac_status" >&5 + echo "$as_me:6887: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works=yes fi fi @@ -6875,16 +6942,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6878: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6945: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6882: \$? = $ac_status" >&5 + echo "$as_me:6949: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi @@ -6964,6 +7033,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -6984,6 +7063,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -7052,6 +7152,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -7090,41 +7221,6 @@ EOF hardcode_shlibpath_var=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds=$archive_cmds - fi - else - ld_shlibs=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -7135,16 +7231,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -7451,7 +7542,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -7654,7 +7745,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -7673,10 +7764,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -7685,8 +7778,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs=yes ;; @@ -8223,7 +8326,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -8286,7 +8389,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -9075,7 +9182,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6;} # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -9442,7 +9549,7 @@ echo "$as_me: creating $ofile" >&6;} SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -9524,7 +9631,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9558,7 +9665,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -9913,6 +10020,20 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -9934,7 +10055,16 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -10404,7 +10534,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -10422,11 +10552,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi dgux*) case $cc_basename in - ec++) + ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10461,11 +10591,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC) + aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -10526,11 +10656,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC) + aCC*) case "$host_cpu" in hppa*64*|ia64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -10570,9 +10700,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; irix5* | irix6*) case $cc_basename in - CC) + CC*) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -10583,7 +10713,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -10596,7 +10726,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; linux*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10621,7 +10751,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -10646,15 +10776,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC) + pgCC*) # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx) + cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -10685,7 +10816,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10724,7 +10855,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10740,14 +10871,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx) + cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10765,7 +10896,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10784,7 +10915,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10799,17 +10930,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx) + cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -10828,7 +10959,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10852,7 +10983,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi sco*) archive_cmds_need_lc_CXX=no case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10864,12 +10995,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10882,7 +11013,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -10896,9 +11027,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -10919,7 +11054,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -10962,7 +11097,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11171,7 +11306,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; chorus*) case $cc_basename in - cxch68) + cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -11180,7 +11315,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' @@ -11189,10 +11324,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; dgux*) case $cc_basename in - ec++) + ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; @@ -11205,14 +11340,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; - aCC) + aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -11230,7 +11365,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC) + CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. @@ -11241,7 +11376,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' @@ -11252,13 +11387,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; - pgCC) + pgCC*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-static' ;; - cxx) + cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -11275,7 +11410,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; mvs*) case $cc_basename in - cxx) + cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) @@ -11286,14 +11421,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; - cxx) + cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -11309,7 +11444,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sco*) case $cc_basename in - CC) + CC*) lt_prog_compiler_pic_CXX='-fPIC' ;; *) @@ -11318,13 +11453,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; - gcx) + gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; @@ -11334,12 +11469,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; - lcc) + lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; @@ -11349,7 +11484,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; @@ -11393,15 +11528,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11396: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11531: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11400: \$? = $ac_status" >&5 + echo "$as_me:11535: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_CXX=yes fi fi @@ -11453,16 +11590,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11456: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11593: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11460: \$? = $ac_status" >&5 + echo "$as_me:11597: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi @@ -11964,7 +12103,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -12027,7 +12166,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -12816,7 +12959,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 @@ -13522,7 +13688,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 @@ -13628,7 +13796,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' @@ -13676,7 +13844,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' @@ -13703,9 +13871,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_F77='-Qoption ld ';; + *) + lt_prog_compiler_wl_F77='-Wl,';; + esac ;; sunos4*) @@ -13769,15 +13942,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13772: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13945: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13776: \$? = $ac_status" >&5 + echo "$as_me:13949: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_F77=yes fi fi @@ -13829,16 +14004,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13832: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14007: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13836: \$? = $ac_status" >&5 + echo "$as_me:14011: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi @@ -13918,6 +14095,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -13938,6 +14125,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -14006,6 +14214,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_F77=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -14044,41 +14283,6 @@ EOF hardcode_shlibpath_var_F77=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_F77=$archive_cmds_F77 - fi - else - ld_shlibs_F77=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -14089,16 +14293,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs_F77" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi + if test "$ld_shlibs_F77" = no; then + runpath_var= + hardcode_libdir_flag_spec_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -14385,7 +14584,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -14588,7 +14787,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' @@ -14607,10 +14806,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -14619,8 +14820,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs_F77=yes ;; @@ -15157,7 +15368,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -15220,7 +15431,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15419,7 +15634,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -15568,7 +15783,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -15602,7 +15817,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -15851,15 +16066,41 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no +old_archive_cmds_GCJ=$old_archive_cmds + lt_prog_compiler_no_builtin_flag_GCJ= @@ -15885,15 +16126,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15888: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16129: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15892: \$? = $ac_status" >&5 + echo "$as_me:16133: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -15999,7 +16242,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' @@ -16047,7 +16290,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16074,9 +16317,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_GCJ='-Qoption ld ';; + *) + lt_prog_compiler_wl_GCJ='-Wl,';; + esac ;; sunos4*) @@ -16140,15 +16388,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16143: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16391: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16147: \$? = $ac_status" >&5 + echo "$as_me:16395: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_GCJ=yes fi fi @@ -16200,16 +16450,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16203: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16453: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16207: \$? = $ac_status" >&5 + echo "$as_me:16457: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi @@ -16289,6 +16541,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -16309,6 +16571,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -16377,6 +16660,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_GCJ=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -16415,41 +16729,6 @@ EOF hardcode_shlibpath_var_GCJ=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_GCJ=$archive_cmds_GCJ - fi - else - ld_shlibs_GCJ=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -16460,16 +16739,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs_GCJ" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi + if test "$ld_shlibs_GCJ" = no; then + runpath_var= + hardcode_libdir_flag_spec_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -16776,7 +17050,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -16979,7 +17253,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' @@ -16998,10 +17272,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -17010,8 +17286,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs_GCJ=yes ;; @@ -17548,7 +17834,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -17611,7 +17897,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -18400,7 +18690,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the @@ -19066,7 +19380,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -19215,7 +19529,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -19249,7 +19563,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -19899,11 +20213,11 @@ if test "$enable_gnome_vfs" != "no"; then export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" fi - succeeded=no - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; 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_path_PKG_CONFIG+set}" = set; then @@ -19928,7 +20242,6 @@ do done done - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -19942,56 +20255,123 @@ else echo "${ECHO_T}no" >&6 fi +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done +done - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 -echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG - if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then - echo "$as_me:$LINENO: result: yes" >&5 +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + PKG_CONFIG=$ac_pt_PKG_CONFIG +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - succeeded=yes + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + PKG_CONFIG="" + fi - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 +fi - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 - else - LIBNTFS_GNOMEVFS_CFLAGS="" - LIBNTFS_GNOMEVFS_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` +pkg_failed=no +echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 +if test "${pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set" = "xset"; then + pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&6 +echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 +if test "${pkg_cv_LIBNTFS_GNOMEVFS_LIBS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set" = "xset"; then + pkg_cv_LIBNTFS_GNOMEVFS_LIBS=$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&6 - fi +if test $pkg_failed = yes; then + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + # Put the nasty error message in config.log where it belongs + echo "$LIBNTFS_GNOMEVFS_PKG_ERRORS" 1>&5 - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_gnome_vfs=true - else - if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} @@ -20001,8 +20381,22 @@ echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi - fi +elif test $pkg_failed = untried; then + if test "$enable_gnome_vfs" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} + fi + +else + LIBNTFS_GNOMEVFS_CFLAGS=$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS + LIBNTFS_GNOMEVFS_LIBS=$pkg_cv_LIBNTFS_GNOMEVFS_LIBS + compile_gnome_vfs=true +fi fi @@ -20019,110 +20413,85 @@ fi compile_fuse_module=false if test "$enable_fuse_module" != "no"; then - succeeded=no - - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then +pkg_failed=no +echo "$as_me:$LINENO: checking for FUSE_MODULE_CFLAGS" >&5 +echo $ECHO_N "checking for FUSE_MODULE_CFLAGS... $ECHO_C" >&6 +if test "${pkg_cv_FUSE_MODULE_CFLAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 + if test "x$ac_cv_env_FUSE_MODULE_CFLAGS_set" = "xset"; then + pkg_cv_FUSE_MODULE_CFLAGS=$ac_cv_env_FUSE_MODULE_CFLAGS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0" 2>/dev/null` + else + pkg_failed=yes + fi else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + pkg_failed=untried fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_CFLAGS" >&5 +echo "${ECHO_T}$pkg_cv_FUSE_MODULE_CFLAGS" >&6 +echo "$as_me:$LINENO: checking for FUSE_MODULE_LIBS" >&5 +echo $ECHO_N "checking for FUSE_MODULE_LIBS... $ECHO_C" >&6 +if test "${pkg_cv_FUSE_MODULE_LIBS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_FUSE_MODULE_LIBS_set" = "xset"; then + pkg_cv_FUSE_MODULE_LIBS=$ac_cv_env_FUSE_MODULE_LIBS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_LIBS" >&5 +echo "${ECHO_T}$pkg_cv_FUSE_MODULE_LIBS" >&6 - fi +if test $pkg_failed = yes; then + FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` + # Put the nasty error message in config.log where it belongs + echo "$FUSE_MODULE_PKG_ERRORS" 1>&5 - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for fuse" >&5 -echo $ECHO_N "checking for fuse... $ECHO_C" >&6 - - if $PKG_CONFIG --exists "fuse" ; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - succeeded=yes - - echo "$as_me:$LINENO: checking FUSE_MODULE_CFLAGS" >&5 -echo $ECHO_N "checking FUSE_MODULE_CFLAGS... $ECHO_C" >&6 - FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse"` - echo "$as_me:$LINENO: result: $FUSE_MODULE_CFLAGS" >&5 -echo "${ECHO_T}$FUSE_MODULE_CFLAGS" >&6 - - echo "$as_me:$LINENO: checking FUSE_MODULE_LIBS" >&5 -echo $ECHO_N "checking FUSE_MODULE_LIBS... $ECHO_C" >&6 - FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse"` - echo "$as_me:$LINENO: result: $FUSE_MODULE_LIBS" >&5 -echo "${ECHO_T}$FUSE_MODULE_LIBS" >&6 - else - FUSE_MODULE_CFLAGS="" - FUSE_MODULE_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse"` - - fi - - - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_fuse_module=true - else if test "$enable_fuse_module" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires fuse library." >&5 -echo "$as_me: error: Linux-NTFS FUSE module requires fuse library." >&2;} + { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 +echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} { (exit 1); exit 1; }; } else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires fuse library." >&5 -echo "$as_me: WARNING: Linux-NTFS FUSE module requires fuse library." >&2;} + { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 +echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} fi - fi +elif test $pkg_failed = untried; then + if test "$enable_fuse_module" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 +echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 +echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} + fi + +else + FUSE_MODULE_CFLAGS=$pkg_cv_FUSE_MODULE_CFLAGS + FUSE_MODULE_LIBS=$pkg_cv_FUSE_MODULE_LIBS + compile_fuse_module=true +fi fi @@ -23933,6 +24302,7 @@ s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t diff --git a/configure.ac b/configure.ac index 2a63edee..12275d18 100644 --- a/configure.ac +++ b/configure.ac @@ -137,12 +137,12 @@ AM_CONDITIONAL(ENABLE_GNOME_VFS, $compile_gnome_vfs) # Autodetect whether to build FUSE module or not. compile_fuse_module=false if test "$enable_fuse_module" != "no"; then - PKG_CHECK_MODULES(FUSE_MODULE, [fuse], [ compile_fuse_module=true ], + PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.3.0, [ compile_fuse_module=true ], [ if test "$enable_fuse_module" = "yes"; then - AC_MSG_ERROR([Linux-NTFS FUSE module requires fuse library.]) + AC_MSG_ERROR([Linux-NTFS FUSE module requires FUSE version >= 2.3.0.]) else - AC_MSG_WARN([Linux-NTFS FUSE module requires fuse library.]) + AC_MSG_WARN([Linux-NTFS FUSE module requires FUSE version >= 2.3.0.]) fi ]) fi diff --git a/doc/Makefile.in b/doc/Makefile.in index ab7029cb..e9a42652 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -119,6 +119,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/Makefile.in b/include/Makefile.in index dbaff49f..2202b27d 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -128,6 +128,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 96473220..2c384c38 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -132,6 +132,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 3b73331f..37bab1b3 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -194,6 +194,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/ltmain.sh b/ltmain.sh index 3d071010..eecedf23 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -17,7 +17,7 @@ # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,8 +43,8 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.14 -TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" +VERSION=1.5.18 +TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. @@ -112,8 +112,9 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -: ${IFS=" -"} +lt_nl=' +' +IFS=" $lt_nl" if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -250,37 +251,14 @@ func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" - f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" - $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ - | $EGREP -v '^[ ]*1[ ]' | while read count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? - i=`expr $i + 1` - done - done - $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE fi } @@ -757,6 +735,15 @@ if test -z "$show_help"; then esac done + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qlibobj="\"$qlibobj\"" ;; + esac + if test "X$libobj" != "X$qlibobj"; then + $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + exit $EXIT_FAILURE + fi objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -829,12 +816,17 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo $srcfile > "$lockfile" + $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qsrcfile="\"$qsrcfile\"" ;; + esac $run $rm "$libobj" "${libobj}T" @@ -856,10 +848,10 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" fi if test ! -d "${xdir}$objdir"; then @@ -939,9 +931,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" else - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -1365,6 +1357,8 @@ EOF ;; darwin_framework) compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" prev= continue ;; @@ -1429,6 +1423,8 @@ EOF -framework) prev=darwin_framework compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" continue ;; @@ -2852,12 +2848,12 @@ EOF *) continue ;; esac case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no @@ -3124,7 +3120,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3133,7 +3129,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3142,7 +3138,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -5091,6 +5087,63 @@ fi\ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5104,20 +5157,7 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi + # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -6026,14 +6066,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\"\$cmd\"$args" + exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - eval \$echo \"\$cmd\"$args + $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index db282e1b..d8713bc6 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -28,7 +28,7 @@ CLEANFILES = $(EXTRA_PROGRAMS) linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs if ENABLE_FUSE_MODULE -EXTRA_PROGRAMS += ntfsmount +bin_PROGRAMS += ntfsmount endif # Set the include path. diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 90df7722..43810251 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -40,13 +40,13 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ - ntfsls$(EXEEXT) ntfscat$(EXEEXT) + ntfsls$(EXEEXT) ntfscat$(EXEEXT) $(am__EXEEXT_1) sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) \ ntfscp$(EXEEXT) EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) ntfswipe$(EXEEXT) \ ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) ntfsrm$(EXEEXT) \ - ntfsmftalloc$(EXEEXT) $(am__EXEEXT_1) + ntfsmftalloc$(EXEEXT) @ENABLE_FUSE_MODULE_TRUE@am__append_1 = ntfsmount subdir = ntfsprogs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ @@ -240,6 +240,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ From 47b52b54e301171dccd8017c442061140401ee25 Mon Sep 17 00:00:00 2001 From: antona Date: Sun, 10 Jul 2005 21:42:39 +0000 Subject: [PATCH 2340/2994] Update changelog, fox more mkntfs bugs (thanks Timur!) and update build system to SuSE 9.3 again. --- ChangeLog | 9 +- Makefile.in | 1 - aclocal.m4 | 520 ++++++---------- configure | 1216 +++++++++++++------------------------- doc/Makefile.in | 1 - include/Makefile.in | 1 - include/ntfs/Makefile.in | 1 - libntfs/Makefile.in | 1 - ntfsprogs/Makefile.in | 1 - ntfsprogs/mkntfs.c | 20 +- 10 files changed, 617 insertions(+), 1154 deletions(-) diff --git a/ChangeLog b/ChangeLog index dd4e75fa..bf637cb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/07/2005 - 1.10.1-WIP +xx/07/2005 - 1.11.0-WIP - Fixes and a new utility ntfsmount, a FUSE ntfsmodule. - ntfscp: fix signal hanling: handle both SIGTERM and SIGINT, print correct message. (Yura) @@ -12,8 +12,11 @@ xx/07/2005 - 1.10.1-WIP having bad sectors if the new --bad-sectors option is used. (Szaka) - ntfsinfo: Dump $EA_INFORMATION and $EA attributes. (Yura) - mkntfs: Fix backup bootsector creation. Thanks to Timur Amirkhanov - for pointing this stupidity out. (We forgot to set the size before - doing it.) (Anton) + for pointing these stupidities out. (We forgot to set the size + before doing it and we wrote more bytes then there were in the buffer + if sector size was above 8kiB and we only reserved one sector even + when sector size was less than 512 bytes and then we wrote 512 bytes, + i.e. beyond the end of the device.) (Anton) 20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. diff --git a/Makefile.in b/Makefile.in index 553116e9..23ba5a81 100644 --- a/Makefile.in +++ b/Makefile.in @@ -144,7 +144,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/aclocal.m4 b/aclocal.m4 index 4ebc090e..2b04da7c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -123,7 +123,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed='sed -e s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -191,7 +191,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -238,48 +238,6 @@ compiler=$CC ])# _LT_AC_SYS_COMPILER -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -AC_DEFUN([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -]) - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -AC_DEFUN([_LT_COMPILER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -AC_DEFUN([_LT_LINKER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_LINKER_BOILERPLATE - - # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -621,10 +579,8 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then $2=yes fi fi @@ -655,11 +611,6 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi else $2=yes fi @@ -729,7 +680,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -1015,9 +965,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi @@ -1516,7 +1464,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1579,11 +1527,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -2573,10 +2517,6 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # # Check for any special shared library compilation flags. # @@ -2709,10 +2649,6 @@ lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -2734,7 +2670,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2995,7 +2931,7 @@ case $host_os in fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -3013,11 +2949,11 @@ case $host_os in dgux*) case $cc_basename in - ec++*) + ec++) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx*) + ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3052,11 +2988,11 @@ case $host_os in # location of the library. case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC*) + aCC) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -3117,11 +3053,11 @@ case $host_os in esac case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC*) + aCC) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -3161,9 +3097,9 @@ case $host_os in ;; irix5* | irix6*) case $cc_basename in - CC*) + CC) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -3174,7 +3110,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -3187,7 +3123,7 @@ case $host_os in ;; linux*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3212,7 +3148,7 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc*) + icpc) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -3237,16 +3173,15 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC) # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx*) + cxx) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -3277,7 +3212,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx*) + cxx) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3316,7 +3251,7 @@ case $host_os in ;; osf3*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3332,14 +3267,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx*) + cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3357,7 +3292,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3376,7 +3311,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3391,17 +3326,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx*) + cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3420,7 +3355,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3444,7 +3379,7 @@ case $host_os in sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3456,12 +3391,12 @@ case $host_os in ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc*) + lcc) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3474,7 +3409,7 @@ case $host_os in ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3488,13 +3423,9 @@ case $host_os in *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3515,7 +3446,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx*) + gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -3558,7 +3489,7 @@ case $host_os in ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3790,16 +3721,12 @@ lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3818,9 +3745,7 @@ aix3*) fi ;; aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi + test "$enable_shared" = yes && enable_static=no ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3876,22 +3801,15 @@ lt_simple_link_test_code='public class conftest { public static void main(String # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds - AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) @@ -3934,16 +3852,11 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) @@ -3973,7 +3886,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -4079,7 +3992,7 @@ ifelse([$1], [], # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -4090,7 +4003,7 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -4173,7 +4086,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4207,7 +4120,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4733,7 +4646,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68*) + cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -4742,7 +4655,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4751,10 +4664,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; dgux*) case $cc_basename in - ec++*) + ec++) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx*) + ghcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4767,14 +4680,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; - aCC*) + aCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -4792,7 +4705,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. @@ -4803,7 +4716,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) case $cc_basename in - KCC*) + KCC) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' @@ -4814,13 +4727,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC*) + pgCC) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - cxx*) + cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -4837,7 +4750,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx*) + cxx) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) @@ -4848,14 +4761,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC*) + KCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC*) + RCC) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx*) + cxx) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -4871,7 +4784,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sco*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) @@ -4880,13 +4793,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; - gcx*) + gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4896,12 +4809,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc*) + lcc) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4911,7 +4824,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -5011,7 +4924,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5059,7 +4972,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5086,14 +4999,9 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac ;; sunos4*) @@ -5223,8 +5131,7 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - _LT_CC_BASENAME([$compiler]) + case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time @@ -5243,28 +5150,7 @@ ifelse([$1],[CXX],[ if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -5333,37 +5219,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -5402,6 +5257,41 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -5412,11 +5302,16 @@ EOF ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -5621,7 +5516,7 @@ EOF _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -5824,7 +5719,7 @@ EOF _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5843,12 +5738,10 @@ EOF solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -5857,18 +5750,8 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - *) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6159,120 +6042,63 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# -# Copyright © 2004 Scott James Remnant . -# -# 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 of the License, 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi - -fi[]dnl -])# PKG_PROG_PKG_CONFIG +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN([PKG_CHECK_MODULES], [ + succeeded=no -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then - pkg_cv_[]$1=$ac_cv_env_[]$1[]_value -elif test -n "$PKG_CONFIG"; then - if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then - pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.in -# -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) -pkg_failed=no -AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], - [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) -AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], - [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes -if test $pkg_failed = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) - ifelse([$4], , [AC_MSG_ERROR(dnl -[Package requirements ($2) were not met. -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details.])], - [$4]) -elif test $pkg_failed = untried; then - ifelse([$4], , [AC_MSG_FAILURE(dnl -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details. -To get pkg-config, see .])], - [$4]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - ifelse([$3], , :, [$3]) -fi[]dnl -])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # diff --git a/configure b/configure index 0d1be1e7..44cd970e 100755 --- a/configure +++ b/configure @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -947,26 +947,6 @@ ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS -ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} -ac_env_PKG_CONFIG_value=$PKG_CONFIG -ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} -ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG -ac_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} -ac_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS -ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} -ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS -ac_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} -ac_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS -ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} -ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS -ac_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} -ac_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS -ac_cv_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} -ac_cv_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS -ac_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} -ac_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS -ac_cv_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} -ac_cv_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS # # Report the --help message. @@ -1090,15 +1070,6 @@ Some influential environment variables: CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags - PKG_CONFIG path to pkg-config utility - LIBNTFS_GNOMEVFS_CFLAGS - C compiler flags for LIBNTFS_GNOMEVFS, overriding pkg-config - LIBNTFS_GNOMEVFS_LIBS - linker flags for LIBNTFS_GNOMEVFS, overriding pkg-config - FUSE_MODULE_CFLAGS - C compiler flags for FUSE_MODULE, overriding pkg-config - FUSE_MODULE_LIBS - linker flags for FUSE_MODULE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -3941,7 +3912,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3944 "configure"' > conftest.$ac_ext + echo '#line 3915 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5520,7 +5491,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5523:" \ +echo "$as_me:5494:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5721,7 +5692,6 @@ else fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -6012,7 +5982,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed='sed -e s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. @@ -6317,16 +6287,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -6514,20 +6475,6 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # # Check for any special shared library compilation flags. # @@ -6569,11 +6516,6 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works=yes - fi else lt_prog_compiler_static_works=yes fi @@ -6618,17 +6560,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6621: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6563: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6625: \$? = $ac_status" >&5 + echo "$as_me:6567: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -6734,7 +6674,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' @@ -6782,7 +6722,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -6809,14 +6749,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac ;; sunos4*) @@ -6880,17 +6815,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6883: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6818: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6887: \$? = $ac_status" >&5 + echo "$as_me:6822: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works=yes fi fi @@ -6942,18 +6875,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6945: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6878: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6949: \$? = $ac_status" >&5 + echo "$as_me:6882: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o=yes fi fi @@ -7033,16 +6964,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -7063,27 +6984,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -7152,37 +7052,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -7221,6 +7090,41 @@ EOF hardcode_shlibpath_var=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds=$archive_cmds + fi + else + ld_shlibs=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -7231,11 +7135,16 @@ EOF ;; esac - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -7542,7 +7451,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -7745,7 +7654,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -7764,12 +7673,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -7778,18 +7685,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs=yes ;; @@ -8326,7 +8223,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -8389,11 +8286,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -9182,7 +9075,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6;} # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -9549,7 +9442,7 @@ echo "$as_me: creating $ofile" >&6;} SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -9631,7 +9524,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9665,7 +9558,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -10020,20 +9913,6 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -10055,16 +9934,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -10534,7 +10404,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -10552,11 +10422,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi dgux*) case $cc_basename in - ec++*) + ec++) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - ghcx*) + ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10591,11 +10461,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # location of the library. case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC*) + aCC) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -10656,11 +10526,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC*) + aCC) case "$host_cpu" in hppa*64*|ia64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -10700,9 +10570,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; irix5* | irix6*) case $cc_basename in - CC*) + CC) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -10713,7 +10583,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -10726,7 +10596,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; linux*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10751,7 +10621,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc*) + icpc) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -10776,16 +10646,15 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC) # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx*) + cxx) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -10816,7 +10685,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; mvs*) case $cc_basename in - cxx*) + cxx) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10855,7 +10724,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf3*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10871,14 +10740,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx*) + cxx) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10896,7 +10765,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10915,7 +10784,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf4* | osf5*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10930,17 +10799,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx*) + cxx) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -10959,7 +10828,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10983,7 +10852,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi sco*) archive_cmds_need_lc_CXX=no case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10995,12 +10864,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - lcc*) + lcc) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11013,7 +10882,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -11027,13 +10896,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -11054,7 +10919,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; - gcx*) + gcx) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -11097,7 +10962,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11306,7 +11171,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; chorus*) case $cc_basename in - cxch68*) + cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -11315,7 +11180,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' @@ -11324,10 +11189,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; dgux*) case $cc_basename in - ec++*) + ec++) lt_prog_compiler_pic_CXX='-KPIC' ;; - ghcx*) + ghcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; @@ -11340,14 +11205,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC*) + CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; - aCC*) + aCC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -11365,7 +11230,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC*) + CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. @@ -11376,7 +11241,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) case $cc_basename in - KCC*) + KCC) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' @@ -11387,13 +11252,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; - pgCC*) + pgCC) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-static' ;; - cxx*) + cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -11410,7 +11275,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; mvs*) case $cc_basename in - cxx*) + cxx) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) @@ -11421,14 +11286,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC*) + KCC) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; - RCC*) + RCC) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; - cxx*) + cxx) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -11444,7 +11309,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sco*) case $cc_basename in - CC*) + CC) lt_prog_compiler_pic_CXX='-fPIC' ;; *) @@ -11453,13 +11318,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; - gcx*) + gcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; @@ -11469,12 +11334,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; - lcc*) + lcc) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; @@ -11484,7 +11349,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; @@ -11528,17 +11393,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11531: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11396: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11535: \$? = $ac_status" >&5 + echo "$as_me:11400: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_CXX=yes fi fi @@ -11590,18 +11453,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11593: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11456: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11597: \$? = $ac_status" >&5 + echo "$as_me:11460: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_CXX=yes fi fi @@ -12103,7 +11964,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -12166,11 +12027,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -12959,7 +12816,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 @@ -13688,9 +13522,7 @@ aix3*) fi ;; aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi + test "$enable_shared" = yes && enable_static=no ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 @@ -13796,7 +13628,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' @@ -13844,7 +13676,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' @@ -13871,14 +13703,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_F77='-Qoption ld ';; - *) - lt_prog_compiler_wl_F77='-Wl,';; - esac ;; sunos4*) @@ -13942,17 +13769,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13945: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13772: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13949: \$? = $ac_status" >&5 + echo "$as_me:13776: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_F77=yes fi fi @@ -14004,18 +13829,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14007: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13832: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14011: \$? = $ac_status" >&5 + echo "$as_me:13836: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_F77=yes fi fi @@ -14095,16 +13918,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -14125,27 +13938,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -14214,37 +14006,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_F77=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -14283,6 +14044,41 @@ EOF hardcode_shlibpath_var_F77=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_F77=$archive_cmds_F77 + fi + else + ld_shlibs_F77=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -14293,11 +14089,16 @@ EOF ;; esac - if test "$ld_shlibs_F77" = no; then - runpath_var= - hardcode_libdir_flag_spec_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= + if test "$ld_shlibs_F77" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -14584,7 +14385,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -14787,7 +14588,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' @@ -14806,12 +14607,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -14820,18 +14619,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_F77=yes ;; @@ -15368,7 +15157,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -15431,11 +15220,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15634,7 +15419,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -15783,7 +15568,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -15817,7 +15602,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -16066,41 +15851,15 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no -old_archive_cmds_GCJ=$old_archive_cmds - lt_prog_compiler_no_builtin_flag_GCJ= @@ -16126,17 +15885,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16129: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15888: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16133: \$? = $ac_status" >&5 + echo "$as_me:15892: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -16242,7 +15999,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' @@ -16290,7 +16047,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16317,14 +16074,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_GCJ='-Qoption ld ';; - *) - lt_prog_compiler_wl_GCJ='-Wl,';; - esac ;; sunos4*) @@ -16388,17 +16140,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16391: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16143: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16395: \$? = $ac_status" >&5 + echo "$as_me:16147: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_GCJ=yes fi fi @@ -16450,18 +16200,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16453: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16203: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16457: \$? = $ac_status" >&5 + echo "$as_me:16207: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi @@ -16541,16 +16289,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -16571,27 +16309,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -16660,37 +16377,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_GCJ=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -16729,6 +16415,41 @@ EOF hardcode_shlibpath_var_GCJ=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_GCJ=$archive_cmds_GCJ + fi + else + ld_shlibs_GCJ=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -16739,11 +16460,16 @@ EOF ;; esac - if test "$ld_shlibs_GCJ" = no; then - runpath_var= - hardcode_libdir_flag_spec_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= + if test "$ld_shlibs_GCJ" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -17050,7 +16776,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -17253,7 +16979,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' @@ -17272,12 +16998,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -17286,18 +17010,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_GCJ=yes ;; @@ -17834,7 +17548,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -17897,11 +17611,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -18690,7 +18400,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the @@ -19380,7 +19066,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -19529,7 +19215,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -19563,7 +19249,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -20213,11 +19899,11 @@ if test "$enable_gnome_vfs" != "no"; then export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" fi + succeeded=no -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then @@ -20242,6 +19928,7 @@ do done done + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -20255,123 +19942,56 @@ else echo "${ECHO_T}no" >&6 fi -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 fi -done -done - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 +echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 -if test -n "$ac_pt_PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 -echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - PKG_CONFIG=$ac_pt_PKG_CONFIG -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 -echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - echo "$as_me:$LINENO: result: yes" >&5 + if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - PKG_CONFIG="" - fi + succeeded=yes -fi + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 -pkg_failed=no -echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 -if test "${pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set" = "xset"; then - pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&6 -echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 -if test "${pkg_cv_LIBNTFS_GNOMEVFS_LIBS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set" = "xset"; then - pkg_cv_LIBNTFS_GNOMEVFS_LIBS=$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&6 + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 + else + LIBNTFS_GNOMEVFS_CFLAGS="" + LIBNTFS_GNOMEVFS_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` -if test $pkg_failed = yes; then - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - # Put the nasty error message in config.log where it belongs - echo "$LIBNTFS_GNOMEVFS_PKG_ERRORS" 1>&5 + fi + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + compile_gnome_vfs=true + else + if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} @@ -20381,22 +20001,8 @@ echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi -elif test $pkg_failed = untried; then + fi - if test "$enable_gnome_vfs" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - fi - -else - LIBNTFS_GNOMEVFS_CFLAGS=$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS - LIBNTFS_GNOMEVFS_LIBS=$pkg_cv_LIBNTFS_GNOMEVFS_LIBS - compile_gnome_vfs=true -fi fi @@ -20413,59 +20019,98 @@ fi compile_fuse_module=false if test "$enable_fuse_module" != "no"; then -pkg_failed=no -echo "$as_me:$LINENO: checking for FUSE_MODULE_CFLAGS" >&5 -echo $ECHO_N "checking for FUSE_MODULE_CFLAGS... $ECHO_C" >&6 -if test "${pkg_cv_FUSE_MODULE_CFLAGS+set}" = set; then + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "x$ac_cv_env_FUSE_MODULE_CFLAGS_set" = "xset"; then - pkg_cv_FUSE_MODULE_CFLAGS=$ac_cv_env_FUSE_MODULE_CFLAGS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_CFLAGS" >&5 -echo "${ECHO_T}$pkg_cv_FUSE_MODULE_CFLAGS" >&6 -echo "$as_me:$LINENO: checking for FUSE_MODULE_LIBS" >&5 -echo $ECHO_N "checking for FUSE_MODULE_LIBS... $ECHO_C" >&6 -if test "${pkg_cv_FUSE_MODULE_LIBS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_FUSE_MODULE_LIBS_set" = "xset"; then - pkg_cv_FUSE_MODULE_LIBS=$ac_cv_env_FUSE_MODULE_LIBS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_LIBS" >&5 -echo "${ECHO_T}$pkg_cv_FUSE_MODULE_LIBS" >&6 + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -if test $pkg_failed = yes; then - FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` - # Put the nasty error message in config.log where it belongs - echo "$FUSE_MODULE_PKG_ERRORS" 1>&5 + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for fuse >= 2.3.0" >&5 +echo $ECHO_N "checking for fuse >= 2.3.0... $ECHO_C" >&6 + + if $PKG_CONFIG --exists "fuse >= 2.3.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + succeeded=yes + + echo "$as_me:$LINENO: checking FUSE_MODULE_CFLAGS" >&5 +echo $ECHO_N "checking FUSE_MODULE_CFLAGS... $ECHO_C" >&6 + FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0"` + echo "$as_me:$LINENO: result: $FUSE_MODULE_CFLAGS" >&5 +echo "${ECHO_T}$FUSE_MODULE_CFLAGS" >&6 + + echo "$as_me:$LINENO: checking FUSE_MODULE_LIBS" >&5 +echo $ECHO_N "checking FUSE_MODULE_LIBS... $ECHO_C" >&6 + FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0"` + echo "$as_me:$LINENO: result: $FUSE_MODULE_LIBS" >&5 +echo "${ECHO_T}$FUSE_MODULE_LIBS" >&6 + else + FUSE_MODULE_CFLAGS="" + FUSE_MODULE_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` + + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + compile_fuse_module=true + else if test "$enable_fuse_module" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 @@ -20476,22 +20121,8 @@ echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2 echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} fi -elif test $pkg_failed = untried; then + fi - if test "$enable_fuse_module" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 -echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 -echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} - fi - -else - FUSE_MODULE_CFLAGS=$pkg_cv_FUSE_MODULE_CFLAGS - FUSE_MODULE_LIBS=$pkg_cv_FUSE_MODULE_LIBS - compile_fuse_module=true -fi fi @@ -24302,7 +23933,6 @@ s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t -s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t diff --git a/doc/Makefile.in b/doc/Makefile.in index e9a42652..ab7029cb 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -119,7 +119,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/Makefile.in b/include/Makefile.in index 2202b27d..dbaff49f 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -128,7 +128,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 2c384c38..96473220 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -132,7 +132,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 37bab1b3..3b73331f 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -194,7 +194,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 43810251..dc616313 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -240,7 +240,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 47ff8156..cae40fb4 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2670,6 +2670,8 @@ static void mkntfs_open_partition(void) */ static void mkntfs_override_phys_params(void) { + int i; + /* If user didn't specify the sector size, determine it now. */ if (!opts.sector_size) { #ifdef BLKSSZGET @@ -2706,8 +2708,15 @@ static void mkntfs_override_phys_params(void) } mkDprintf("number of sectors = %lld (0x%llx)\n", opts.nr_sectors, opts.nr_sectors); - /* Reserve the last sector for the backup boot sector. */ - opts.nr_sectors--; + /* + * Reserve the last sector for the backup boot sector unless the + * sector size is less than 512 bytes in which case reserve 512 bytes + * worth of secstors. + */ + i = 1; + if (opts.sector_size < 512) + i = 512 / opts.sector_size; + opts.nr_sectors -= i; /* If user didn't specify the partition start sector, determine it. */ if (opts.part_start_sect < 0) { opts.part_start_sect = ntfs_device_partition_start_sector_get( @@ -3264,7 +3273,8 @@ static int create_backup_boot_sector(u8 *buff) Vprintf("Creating backup boot sector.\n"); /* * Write the first max(512, opts.sector_size) bytes from buf to the - * last sector. + * last sector, but limit that to 8192 bytes of written data since that + * is how big $Boot is (and how big our buffer is).. */ size = 512; if (size < opts.sector_size) @@ -3272,11 +3282,11 @@ static int create_backup_boot_sector(u8 *buff) if (vol->dev->d_ops->seek(vol->dev, (opts.nr_sectors + 1) * opts.sector_size - size, SEEK_SET) == (off_t)-1) goto bb_err; - + if (size > 8192) + size = 8192; bw = mkntfs_write(vol->dev, buff, size); if (bw == size) return 0; - if (bw == -1LL) _s = strerror(_e); else From f12ba9ab00666cc134d7a37653a5d0a02a0fb0a1 Mon Sep 17 00:00:00 2001 From: antona Date: Sun, 10 Jul 2005 21:47:23 +0000 Subject: [PATCH 2341/2994] I am a muppet. I forgot to update the version number in configure.ac before running autogen.sh last time. )-: --- config.guess | 64 ++++++++++++--------- config.sub | 5 +- configure | 20 +++---- configure.ac | 2 +- ltmain.sh | 156 +++++++++++++++++++-------------------------------- 5 files changed, 107 insertions(+), 140 deletions(-) diff --git a/config.guess b/config.guess index 892833f9..44f30e6c 100755 --- a/config.guess +++ b/config.guess @@ -136,6 +136,16 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -825,25 +835,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo cris-axis-linux exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo crisv32-axis-linux exit 0 ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo frv-${VENDOR}-linux exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -862,7 +872,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -881,13 +891,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-${VENDOR}-linux exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-${VENDOR}-linux exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -900,34 +910,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-${VENDOR}-linux ;; + PA8*) echo hppa2.0-${VENDOR}-linux ;; + *) echo hppa-${VENDOR}-linux ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-${VENDOR}-linux exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo x86_64-${VENDOR}-linux exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -942,18 +952,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" + echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" + echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or + # Either a pre-BFD a.out linker (linuxoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -982,7 +992,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.sub b/config.sub index d8fd2f8f..c884ad4e 100755 --- a/config.sub +++ b/config.sub @@ -1172,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1205,9 +1205,6 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index 44cd970e..9460fce0 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.10.1-WIP. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.11.0-WIP. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.10.1-WIP' -PACKAGE_STRING='ntfsprogs 1.10.1-WIP' +PACKAGE_VERSION='1.11.0-WIP' +PACKAGE_STRING='ntfsprogs 1.11.0-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -955,7 +955,7 @@ 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 ntfsprogs 1.10.1-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.11.0-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1022,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.10.1-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.11.0-WIP:";; esac cat <<\_ACEOF @@ -1170,7 +1170,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.10.1-WIP +ntfsprogs configure 1.11.0-WIP generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1184,7 +1184,7 @@ 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 ntfsprogs $as_me 1.10.1-WIP, which was +It was created by ntfsprogs $as_me 1.11.0-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1912,7 +1912,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.10.1-WIP' + VERSION='1.11.0-WIP' cat >>confdefs.h <<_ACEOF @@ -23579,7 +23579,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.10.1-WIP, which was +This file was extended by ntfsprogs $as_me 1.11.0-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23642,7 +23642,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.10.1-WIP +ntfsprogs config.status 1.11.0-WIP configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index 12275d18..7f702fac 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.10.1-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.11.0-WIP],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) diff --git a/ltmain.sh b/ltmain.sh index eecedf23..3d071010 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -17,7 +17,7 @@ # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,8 +43,8 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.18 -TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)" +VERSION=1.5.14 +TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. @@ -112,9 +112,8 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" +: ${IFS=" +"} if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -251,14 +250,37 @@ func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" + f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else - $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 - exit $EXIT_FAILURE + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ + | $EGREP -v '^[ ]*1[ ]' | while read count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? + i=`expr $i + 1` + done + done + $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" fi } @@ -735,15 +757,6 @@ if test -z "$show_help"; then esac done - qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` - case $qlibobj in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qlibobj="\"$qlibobj\"" ;; - esac - if test "X$libobj" != "X$qlibobj"; then - $echo "$modename: libobj name \`$libobj' may not contain shell special characters." - exit $EXIT_FAILURE - fi objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -816,17 +829,12 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo "$srcfile" > "$lockfile" + $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi - qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` - case $qsrcfile in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qsrcfile="\"$qsrcfile\"" ;; - esac $run $rm "$libobj" "${libobj}T" @@ -848,10 +856,10 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" + command="$base_compile $srcfile $pic_flag" else # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $srcfile" fi if test ! -d "${xdir}$objdir"; then @@ -931,9 +939,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $srcfile" else - command="$base_compile $qsrcfile $pic_flag" + command="$base_compile $srcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -1357,8 +1365,6 @@ EOF ;; darwin_framework) compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" prev= continue ;; @@ -1423,8 +1429,6 @@ EOF -framework) prev=darwin_framework compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" continue ;; @@ -2848,13 +2852,13 @@ EOF *) continue ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac done fi # link_all_deplibs != no fi # linkmode = lib @@ -3120,7 +3124,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3129,7 +3133,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3138,7 +3142,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -5087,63 +5091,6 @@ fi\ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "copying selected object files to avoid basename conflicts..." - - if test -z "$gentop"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - fi - - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - counter=`expr $counter + 1` - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - $run ln "$obj" "$gentop/$newobj" || - $run cp "$obj" "$gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5157,7 +5104,20 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -6066,14 +6026,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" + exec_cmd="\"\$cmd\"$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - $echo "$cmd$args" + eval \$echo \"\$cmd\"$args exit $EXIT_SUCCESS fi ;; From d37968ee84ec0120bef63109431c0d5a698757be Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 10 Jul 2005 22:44:00 +0000 Subject: [PATCH 2342/2994] Update ntfsfix manual --- ChangeLog | 3 ++- ntfsprogs/ntfsfix.8.in | 44 ++++++++++++++---------------------------- 2 files changed, 16 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf637cb0..95e452f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,8 @@ xx/07/2005 - 1.11.0-WIP - Fixes and a new utility ntfsmount, a FUSE ntfsmodule. - ntfscp: fix signal hanling: handle both SIGTERM and SIGINT, print correct message. (Yura) - - Update manual pages for ntfsprogs, ntfsclone, ntfsresize. (Szaka) + - Update manual pages for ntfsprogs, ntfsclone, ntfsresize and + ntfsfix. (Szaka) - ntfsclone: detect and hint users if the destination fs does not support sparse files. (Szaka) - Fix memory managament error in ntfs_inode_close. (Yura) diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index 04b323c7..b7d1466e 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH NTFSFIX 8 "March 2004" "ntfsprogs version @VERSION@" +.TH NTFSFIX 8 "July 2005" "ntfsprogs version @VERSION@" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -16,41 +16,25 @@ .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME -ntfsfix \- tool for fixing NTFS partitions altered by the Linux kernel NTFS driver. +ntfsfix \- fix common errors and force Windows to check NTFS .SH SYNOPSIS .B ntfsfix .I device .SH DESCRIPTION -This manual page documents briefly the -.B ntfsfix -command. -.PP -.\" TeX users may be more comfortable with the \fB\fP and -.\" \fI\fP escape sequences to invode bold face and italics, -.\" respectively. -\fBntfsfix\fP is a program that fixes NTFS partitions altered in any -manner with the Linux NTFS driver. \fBntfsfix\fP is \fBNOT\fP a Linux -version of chkdsk. It only tries to leave the NTFS partition in a -not-so-inconsistent state after the NTFS driver has written to it. +\fBntfsfix\fP is a utility that fixes some common NTFS problems. +\fBntfsfix\fP is \fBNOT\fP a Linux +version of chkdsk. It only repairs some fundamental NTFS inconsistencies, +resets the NTFS journal file and schedules an NTFS consistency check for +the first boot into Windows. .sp -\fBntfsfix\fP appeared because MS chkdsk is well known for its -stupidity when fixing altered partitions. Because the main problems -are journal files, \fBntfsfix\fP aims to fix those issues. -.sp -Running ntfsfix after mounting NTFS partitions read-write is recommended -for reducing the chance of severe data loss when NT/W2K/XP tries to remount -the affected partition(s). -.sp -In order to use \fBntfsfix\fP you must unmount the NTFS partition, and run -ntfsfix device, where device is the NTFS partition. After this, you can -safely reboot into NT/W2K/XP. Please note that \fBntfsfix\fP is not a -chkdsk-like tool, and so is not guaranteed that it could fix all the -alterations provoked by the NTFS driver. - +You may run +.B ntfsfix +on an NTFS volume if you think it's damaged and it can't be mounted. .SH AUTHOR -This manual page was written by David Martínez Moreno -, for Debian the GNU/Linux -system (but may be used by others). +The original ntfsfix manual page was written by David Martínez Moreno + and rewritten +by Szabolcs Szakacsits to reflect the current role of +.B ntfsfix. .SH AVAILABILITY .B ntfsfix is part of the ntfsprogs package and is available from From 4c2cfb25836464be8cf60af65c4baab2f863e0f4 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 10 Jul 2005 23:09:02 +0000 Subject: [PATCH 2343/2994] Rephrase mentioning "dirty" volumes so people hopefully won't think that Windows repairs what ntfsresize damaged. The real function of leaving the volume dirty is to make Windows create the backup boot sector because we can't know where the partitioner will exactly resizes (they optionally round to some cylinder boundary, defined by ad hoc, arbitrariy rules). --- ntfsprogs/ntfsresize.8.in | 7 ++++--- ntfsprogs/ntfsresize.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 452bdfdf..96b518a6 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -137,11 +137,12 @@ with first. .TP .B -f, --force -Forces ntfsresize to proceed with the resize operation if the filesystem -is marked "dirty" for consistency check. +Forces ntfsresize to proceed with the resize operation even if the filesystem +is marked for consistency check. Please note, ntfsresize always marks the filesystem -"dirty" before a real resize operation and it leaves that way for extra +for consistency check before a real resize operation +and it leaves that way for extra safety. Thus if NTFS was marked by ntfsresize then it's safe to use this option. If you need to resize several times without booting into Windows between each diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 595ebf71..0e32185f 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2098,8 +2098,8 @@ static ntfs_volume *mount_volume(void) if (vol->flags & VOLUME_IS_DIRTY) if (opt.force-- <= 0) - err_exit("Volume is dirty. Run chkdsk /f and " - "please try again (or see -f option).\n"); + err_exit("Volume is scheduled for check.\nRun chkdsk /f" + " and please try again, or see option -f.\n"); if (NTFS_MAX_CLUSTER_SIZE < vol->cluster_size) err_exit("Cluster size %u is too large!\n", From 40f00bd76bbe1cfe19b33e802b9209ac04ba6219 Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 11 Jul 2005 11:54:38 +0000 Subject: [PATCH 2344/2994] another bmp test fix bmp handling again fix dt commit for iroot fix dt root replace rm now cleanly removes last dir entry --- ntfsprogs/ntfsrm.c | 84 +++++++++++++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 23 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 281ed69f..fa5b0041 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -302,9 +302,13 @@ static int ntfs_bmp_commit (struct ntfs_bmp *bmp) if (bmp->count == 0) return 0; - //printf ("\ta size = %lld\n", bmp->attr->allocated_size); - //printf ("\td size = %lld\n", bmp->attr->data_size); - //printf ("\ti size = %lld\n", bmp->attr->initialized_size); +#if 0 + printf ("attr = 0x%02X\n", bmp->attr->type); + printf ("resident = %d\n", !NAttrNonResident (bmp->attr)); + printf ("\ta size = %lld\n", bmp->attr->allocated_size); + printf ("\td size = %lld\n", bmp->attr->data_size); + printf ("\ti size = %lld\n", bmp->attr->initialized_size); +#endif cs = bmp->vol->cluster_size; @@ -498,14 +502,14 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va // shouldn't all the vcns be lcns? s64 i; u8 *buffer; - int clust_size; + int csib; // cluster size in bits int block_start, block_finish; // rename to c[sf] (rename to clust_) int vcn_start, vcn_finish; // rename to v[sf] int byte_start, byte_finish; // rename to b[sf] u8 mask_start, mask_finish; // rename to m[sf] - int a,b; + s64 a,b; if (!bmp) return -1; @@ -513,21 +517,25 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va if (value) value = 0xFF; - clust_size = bmp->vol->cluster_size; + csib = bmp->vol->cluster_size << 3; vcn_start = vcn; vcn_finish = vcn + length - 1; - a = ROUND_DOWN (vcn_start, clust_size<<3); - b = ROUND_UP (vcn_finish, clust_size<<3) + 1; + //printf ("vcn_start = %d, vcn_finish = %d\n", vcn_start, vcn_finish); + a = ROUND_DOWN (vcn_start, csib); + b = ROUND_DOWN (vcn_finish, csib) + 1; - for (i = a; i < b; i += (clust_size<<3)) { - buffer = ntfs_bmp_get_data (bmp, ROUND_DOWN (i, clust_size<<3)); + //printf ("a = %lld, b = %lld\n", a, b); + + for (i = a; i < b; i += csib) { + //printf ("ntfs_bmp_get_data %lld\n", i); + buffer = ntfs_bmp_get_data (bmp, i); if (!buffer) return -1; - block_start = ROUND_DOWN (i, clust_size<<3); - block_finish = block_start + (clust_size<<3) - 1; + block_start = i; + block_finish = block_start + csib - 1; mask_start = (0xFF << (vcn_start & 7)); mask_finish = (0xFF >> (7 - (vcn_finish & 7))); @@ -542,7 +550,7 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va if ((vcn_finish >= block_start) && (vcn_finish <= block_finish)) { byte_finish = (vcn_finish - block_start) >> 3; } else { - byte_finish = clust_size - 1; + byte_finish = bmp->vol->cluster_size - 1; mask_finish = 0xFF; } @@ -571,7 +579,6 @@ static int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int va } printf (" vcn %lld-%lld\n" END, vcn>>12, (vcn+length-1)>>12); #endif - return 1; } @@ -1123,6 +1130,7 @@ static int ntfs_dt_commit (struct ntfs_dt *dt) ntfs_attr *attr; struct ntfs_dir *dir; int i; + int size; if (!dt) return 0; @@ -1134,17 +1142,24 @@ static int ntfs_dt_commit (struct ntfs_dt *dt) vol = dir->vol; // cluster size if (dt->changed) { - printf ("commit dt\n"); if (dt->parent) { + printf ("commit dt (alloc)\n"); attr = dt->dir->ialloc; + size = dt->dir->index_size; + //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); +#ifdef RM_WRITE + ntfs_attr_mst_pwrite(attr, dt->vcn * size, 1, size, dt->data); // XXX retval +#endif } else { + printf ("commit dt (root)\n"); attr = dt->dir->iroot; + size = dt->data_len; + //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); +#ifdef RM_WRITE + ntfs_attr_pwrite(attr, 0, size, dt->data); // XXX retval +#endif } -#ifdef RM_WRITE - //utils_dump_mem (dt->data, 0, 16, DM_DEFAULTS); - ntfs_attr_mst_pwrite(attr, dt->vcn * dt->dir->index_size, 1, dt->dir->index_size, dt->data); // XXX retval -#endif printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, dt->vcn); dt->changed = FALSE; @@ -2331,7 +2346,7 @@ static struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, i */ static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) { - int i; + //int i; //u8 *buffer; //int buf_count; s64 last_bit; @@ -2361,9 +2376,11 @@ static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) printf (BOLD YELLOW "Truncation needed\n" END); +#if 0 printf ("\tlast bit = %lld\n", last_bit); printf ("\tactual IALLOC size = %lld\n", dir->ialloc->allocated_size); printf ("\tshould IALLOC size = %lld\n", dir->index_size * (last_bit + 1)); +#endif if ((dir->index_size * (last_bit + 1)) == 0) { printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); @@ -2388,20 +2405,27 @@ static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) //utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); ntfs_dt_root_replace (dir->index, 0, dir->index->children[0], ie); //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); - printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); + //printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); free (ie); ie = NULL; + //index flags remove LARGE_INDEX + dir->index->header->flags = 0; + //rollback dir's bmp ntfs_bmp_rollback (dir->bitmap); free (dir->bitmap); dir->bitmap = NULL; + /* for (i = 0; i < dir->index->child_count; i++) { ntfs_dt_rollback (dir->index->sub_nodes[i]); dir->index->sub_nodes[i] = NULL; } + */ + + //printf ("dir->index->inodes[0] = %p\n", dir->index->inodes[0]); //remove 0xA0 attribute ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_INDEX_ALLOCATION); @@ -3226,6 +3250,9 @@ static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY * free (del->data); del->data = attr; del->data_len = len; + del->header = (INDEX_HEADER*) (del->data + 0x10); + del->header->index_length += (suc_ie->length - del_ie->length); + del->header->allocated_size += (suc_ie->length - del_ie->length); ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); @@ -5031,7 +5058,7 @@ static int ntfs_test_bmp2 (ntfs_volume *vol) { struct ntfs_bmp *bmp; int i, j; - u8 value = 0x00; + u8 value = 0xFF; bmp = calloc (1, sizeof (*bmp)); if (!bmp) @@ -5041,12 +5068,23 @@ static int ntfs_test_bmp2 (ntfs_volume *vol) bmp->attr = calloc (1, sizeof (*bmp->attr)); bmp->attr->type = 0xB0; bmp->attr->ni = calloc (1, sizeof (*bmp->attr->ni)); - bmp->count = 1; + bmp->count = 2; bmp->data = calloc (4, sizeof (u8*)); bmp->data[0] = calloc (1, vol->cluster_size); + bmp->data[1] = calloc (1, vol->cluster_size); bmp->data_vcn = calloc (4, sizeof (VCN)); bmp->data_vcn[0] = 0; + bmp->data_vcn[1] = 1; + for (j = 4090; j < 4103; j++) { + memset (bmp->data[0], ~value, vol->cluster_size); + memset (bmp->data[1], ~value, vol->cluster_size); + ntfs_bmp_set_range (bmp, j, 7, value); + for (i = 0; i < 4; i++) { ntfs_binary_print (bmp->data[0][508+i], TRUE, TRUE); printf (" "); } printf ("| "); + for (i = 0; i < 4; i++) { ntfs_binary_print (bmp->data[1][i], TRUE, TRUE); printf (" "); } printf ("\n"); + } + + printf ("\n"); for (j = 0; j < 15; j++) { memset (bmp->data[0], ~value, vol->cluster_size); ntfs_bmp_set_range (bmp, j, 1, value); From 9f50872ec29e54e8e2359f8d91f5b3aba6cc5d36 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 12 Jul 2005 16:18:10 +0000 Subject: [PATCH 2345/2994] Spelling typos, Debian bug #300073 --- ChangeLog | 2 +- TODO.libntfs | 2 +- include/ntfs/device.h | 2 +- libntfs/win32_io.c | 2 +- ntfsprogs/mkntfs.8.in | 4 ++-- ntfsprogs/ntfsfix.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 95e452f9..3044bdce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -609,7 +609,7 @@ xx/07/2005 - 1.11.0-WIP - Fixes and a new utility ntfsmount, a FUSE ntfsmodule. base inode and are cached there until the base inode is closed. - Cleanup/streamline include file dependencies. - Port attribute list merging code from ntfs tng driver. API to follow. - - Allocate a ntfs_volume in mkntfs and start initializing it instead + - Allocate an ntfs_volume in mkntfs and start initializing it instead of using the opt global structure. Necessary so can call the modified ntfs_mapping_pairs_decompress() from mkntfs.c. - Add libntfs/debug.c providing: diff --git a/TODO.libntfs b/TODO.libntfs index d20a6c8a..731163d9 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -39,7 +39,7 @@ - implement loads of utilities a-la ntcp, ntrm, ntcreat, etc... -- implement a ntfs shell where can use the above much faster with caching, +- implement an ntfs shell where can use the above much faster with caching, probably extending the library in the process **************** diff --git a/include/ntfs/device.h b/include/ntfs/device.h index d6080cf8..4d4b323c 100644 --- a/include/ntfs/device.h +++ b/include/ntfs/device.h @@ -72,7 +72,7 @@ struct stat; /* * The ntfs device operations defining all operations that can be performed on - * the low level device described by a ntfs device structure. + * the low level device described by an ntfs device structure. */ struct ntfs_device_operations { int (*open)(struct ntfs_device *dev, int flags); diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 626917e0..10d5cdd2 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -393,7 +393,7 @@ static s64 ntfs_device_win32_getdisklength(HANDLE handle) * @argp: pointer to result buffer * * Only works on NTFS volume handles. - * An annoying bug in windows is that a NTFS volume does not occupy the entire + * An annoying bug in windows is that an NTFS volume does not occupy the entire * partition, namely not the last sector (which holds the backup boot sector, * and normally not interesting). * Use this function to get the length of the accessible space through a given diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index dad6c3f9..600177e6 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -5,7 +5,7 @@ .\" .TH MKNTFS 8 "June 2005" "ntfsprogs version @VERSION@" .SH NAME -mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system +mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system .SH SYNOPSIS .B mkntfs [ @@ -80,7 +80,7 @@ mkntfs \- create a NTFS 1.2 (Windows NT/2000/XP) file system ] .SH DESCRIPTION .B mkntfs -is used to create a NTFS 1.2 (Windows NT 4.0) file system on a device (usually +is used to create an NTFS 1.2 (Windows NT 4.0) file system on a device (usually a disk partition). .I device is the special file corresponding to the device (e.g diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index bf2e3e91..49eab6c7 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -4,7 +4,7 @@ * Copyright (c) 2000-2003 Anton Altaparmakov. * * This utility will attempt to fix a partition that has been damaged by the - * current Linux-NTFS driver. It should be run after dismounting a NTFS + * current Linux-NTFS driver. It should be run after dismounting an NTFS * partition that has been mounted read-write under Linux and before rebooting * into Windows NT/2000. NtfsFix can be run even after Windows has had mounted * the partition, but it might be too late and irreversible damage to the data From 0fc1835e47b4c7ed080923d25ea78338099495e0 Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 12 Jul 2005 17:13:29 +0000 Subject: [PATCH 2346/2994] fix some sloppy memory management tidy up bmp handling --- ntfsprogs/ntfsrm.c | 93 ++++++++++++++++++++++------------------------ ntfsprogs/ntfsrm.h | 2 - 2 files changed, 45 insertions(+), 50 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index fa5b0041..1bbb20ea 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -46,6 +46,7 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) static int ntfs_inode_close2 (ntfs_inode *ni); static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie); +static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir); /** * version - Print version information about the program @@ -286,6 +287,28 @@ static const char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) } +/** + * ntfs_bmp_rollback + */ +static int ntfs_bmp_rollback (struct ntfs_bmp *bmp) +{ + int i; + + if ((!bmp) || (bmp->count == 0)) + return 0; + + for (i = 0; i < bmp->count; i++) + free (bmp->data[i]); + + free (bmp->data); + free (bmp->data_vcn); + bmp->data = NULL; + bmp->data_vcn = NULL; + bmp->count = 0; + + return 0; +} + /** * ntfs_bmp_commit */ @@ -310,11 +333,11 @@ static int ntfs_bmp_commit (struct ntfs_bmp *bmp) printf ("\ti size = %lld\n", bmp->attr->initialized_size); #endif - cs = bmp->vol->cluster_size; - - printf ("commit bmp inode %lld, 0x%02X (%sresident)\n", bmp->attr->ni->mft_no, bmp->attr->type, NAttrNonResident (bmp->attr) ? "non-" : ""); + //printf ("commit bmp inode %lld, 0x%02X (%sresident)\n", bmp->attr->ni->mft_no, bmp->attr->type, NAttrNonResident (bmp->attr) ? "non-" : ""); if (NAttrNonResident (bmp->attr)) { + cs = bmp->vol->cluster_size; + // non-resident for (i = 0; i < bmp->count; i++) { #ifdef RM_WRITE @@ -335,34 +358,7 @@ static int ntfs_bmp_commit (struct ntfs_bmp *bmp) printf (RED "\tntfs_attr_pwrite resident (%lld)\n" END, bmp->attr->data_size); } - for (i = 0; i < bmp->count; i++) - free (bmp->data[i]); - - free (bmp->data); // XXX wipe ->data and ->data_vcn - free (bmp->data_vcn); - bmp->count = 0; - - return 0; -} - -/** - * ntfs_bmp_rollback - */ -static int ntfs_bmp_rollback (struct ntfs_bmp *bmp) -{ - int i; - - if ((!bmp) || (bmp->count == 0)) - return 0; - - printf ("rollback bmp\n"); - - for (i = 0; i < bmp->count; i++) - free (bmp->data[i]); - - free (bmp->data); - free (bmp->data_vcn); - bmp->count = 0; + ntfs_bmp_rollback (bmp); return 0; } @@ -379,7 +375,6 @@ static void ntfs_bmp_free (struct ntfs_bmp *bmp) ntfs_attr_close (bmp->attr); - free (bmp->cache); free (bmp); } @@ -409,8 +404,6 @@ static struct ntfs_bmp * ntfs_bmp_alloc (ntfs_inode *inode, ATTR_TYPES type, ntf bmp->data = NULL; bmp->data_vcn = NULL; bmp->count = 0; - bmp->cache = NULL; - bmp->cache_vcn = -1; return bmp; } @@ -1190,6 +1183,8 @@ static int ntfs_dt_rollback (struct ntfs_dt *dt) if (!dt) return -1; + return 0; // TEMP + for (i = 0; i < dt->child_count; i++) { if (dt->sub_nodes) ntfs_dt_rollback (dt->sub_nodes[i]); @@ -1223,9 +1218,9 @@ static void ntfs_dt_free (struct ntfs_dt *dt) ntfs_dt_rollback (dt); for (i = 0; i < dt->child_count; i++) { - if (dt->sub_nodes) - ntfs_dt_rollback (dt->sub_nodes[i]); - if (dt->inodes) + //if (dt->sub_nodes) + ntfs_dt_free (dt->sub_nodes[i]); + //if (dt->inodes) ntfs_inode_close2 (dt->inodes[i]); } @@ -1459,7 +1454,7 @@ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int n //printf ("match %p\n", res); if (index_num) *index_num = i; - } else if (r == -1) { + } else if ((r == -1) && (ie->flags & INDEX_ENTRY_NODE)) { //printf ("recurse\n"); if (!dt->sub_nodes[i]) { vcn = ntfs_ie_get_vcn (ie); @@ -2116,6 +2111,8 @@ static int ntfs_dir_commit (struct ntfs_dir *dir) printf (RED "\tntfs_inode_sync %llu\n" END, dir->inode->mft_no); } + ntfs_dir_truncate (dir->vol, dir); + if (ntfs_dt_commit (dir->index) < 0) return -1; @@ -2414,8 +2411,7 @@ static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) dir->index->header->flags = 0; //rollback dir's bmp - ntfs_bmp_rollback (dir->bitmap); - free (dir->bitmap); + ntfs_bmp_free (dir->bitmap); dir->bitmap = NULL; /* @@ -3050,12 +3046,16 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, child = ntfs_dir_find2 (dir, unicode, len); if (!child) { printf ("can't find %s in %s\n", p, pathname); - break; + goto close; } } else { //printf ("file: %s\n", p); dt = ntfs_dt_find2 (dir->index, unicode, len, &dt_num); + if (!dt) { + printf ("can't find %s in %s (2)\n", p, pathname); + goto close; + } if (dt->inodes[dt_num] == NULL) { dt->inodes[dt_num] = ntfs_inode_open (dir->vol, dt->children[dt_num]->indexed_file); @@ -3246,13 +3246,13 @@ static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY * src = (u8*) del->data; dst = attr; - len = del->data_len + suc_ie->length - del_ie->length; + len = suc_ie->length - del_ie->length; free (del->data); del->data = attr; - del->data_len = len; + del->data_len += len; del->header = (INDEX_HEADER*) (del->data + 0x10); - del->header->index_length += (suc_ie->length - del_ie->length); - del->header->allocated_size += (suc_ie->length - del_ie->length); + del->header->index_length += len; + del->header->allocated_size += len; ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); @@ -3264,7 +3264,6 @@ static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY * // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); //printf ("\n"); - len = suc_ie->length - del_ie->length; //printf ("src = %p, dst = %p, len = %d\n", src, dst, len); fflush (stdout); for (i = 0; i < del->child_count; i++) @@ -5007,8 +5006,6 @@ static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) if (1) ntfs_file_remove (vol, dt, dt_num); // remove name from index - if (1) ntfs_dir_truncate (vol, dir); - if (1) utils_volume_commit (vol); if (0) utils_volume_rollback (vol); diff --git a/ntfsprogs/ntfsrm.h b/ntfsprogs/ntfsrm.h index b700ca9b..cd1186e0 100644 --- a/ntfsprogs/ntfsrm.h +++ b/ntfsprogs/ntfsrm.h @@ -52,8 +52,6 @@ struct ntfs_bmp { int count; u8 **data; VCN *data_vcn; - u8 *cache; - VCN cache_vcn; }; /** From 5bfce5ff737d8cc5c3618d30fde155aa0d8040fc Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 12 Jul 2005 17:58:47 +0000 Subject: [PATCH 2347/2994] no code changes, merely reordered some functions --- ntfsprogs/ntfsrm.c | 2162 ++++++++++++++++++++++---------------------- 1 file changed, 1079 insertions(+), 1083 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 1bbb20ea..55651471 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -44,10 +44,6 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) //#define RM_WRITE 1 -static int ntfs_inode_close2 (ntfs_inode *ni); -static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie); -static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir); - /** * version - Print version information about the program * @@ -286,6 +282,108 @@ static const char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) return ctime(&unix_clock); } +/** + * ntfs_inode_dir_map + */ +static void ntfs_inode_dir_map (ntfs_inode *ino) +{ + ATTR_RECORD *rec; + FILE_NAME_ATTR *fn; + ntfs_inode *parent; + + if (!ino) + return; + + printf ("open inode %lld\n", ino->mft_no); + + if (ino->mft_no == FILE_root) { + printf ("done\n"); + return; + } + + rec = find_first_attribute (AT_FILE_NAME, ino->mrec); + if (!rec) + return; + + fn = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); + + parent = ntfs_inode_open (ino->vol, fn->parent_directory); + if (parent) { + ntfs_inode_dir_map (parent); + ntfs_inode_close (parent); + } +} + +/** + * ntfs_inode_open2 + */ +static ntfs_inode *ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) +{ + ntfs_inode *ino = NULL; + struct ntfs_dir *dir; + + if (!vol) + return NULL; + + switch (mref) { + case FILE_Bitmap: ino = vol->lcnbmp_ni; break; + case FILE_MFT: ino = vol->mft_ni; break; + case FILE_MFTMirr: ino = vol->mftmirr_ni; break; + case FILE_root: + dir = vol->private_data; + if (dir) + ino = dir->inode; + break; + } + + if (ino) { + //printf (BOLD YELLOW "inode reuse %lld\n" END, mref); + ino->ref_count++; + return ino; + } + + ino = ntfs_inode_open (vol, mref); + if (!ino) + return NULL; + + /* + if (mref != FILE_root) + ntfs_inode_dir_map (ino); + */ + + // link + // ino->private_data + + ino->private_data = NULL; + ino->ref_count = 1; + + //printf (BOLD YELLOW "inode open %lld\n" END, mref); + return ino; +} + +/** + * ntfs_inode_close2 + */ +static int ntfs_inode_close2 (ntfs_inode *ni) +{ + if (!ni) + return 0; + + //printf (BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); + + ni->ref_count--; + if (ni->ref_count > 0) + return 0; + + // unlink + // ino->private_data + + // XXX temporary until we have commit/rollback + NInoClearDirty(ni); + + return ntfs_inode_close (ni); +} + /** * ntfs_bmp_rollback @@ -947,6 +1045,123 @@ static int ntfs_ie_test (void) } +/** + * ntfs_dt_rollback + */ +static int ntfs_dt_rollback (struct ntfs_dt *dt) +{ + int i; + + if (!dt) + return -1; + + return 0; // TEMP + + for (i = 0; i < dt->child_count; i++) { + if (dt->sub_nodes) + ntfs_dt_rollback (dt->sub_nodes[i]); + if (dt->inodes) + ntfs_inode_close2 (dt->inodes[i]); + } + + free (dt->data); + free (dt->children); + free (dt->sub_nodes); + free (dt->inodes); + + dt->data = NULL; + dt->children = NULL; + dt->sub_nodes = NULL; + dt->inodes = NULL; + + return 0; +} + +/** + * ntfs_dt_commit + */ +static int ntfs_dt_commit (struct ntfs_dt *dt) +{ + ntfs_volume *vol; + ntfs_attr *attr; + struct ntfs_dir *dir; + int i; + int size; + + if (!dt) + return 0; + + dir = dt->dir; + if (!dir) + return -1; + + vol = dir->vol; // cluster size + + if (dt->changed) { + if (dt->parent) { + printf ("commit dt (alloc)\n"); + attr = dt->dir->ialloc; + size = dt->dir->index_size; + //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); +#ifdef RM_WRITE + ntfs_attr_mst_pwrite(attr, dt->vcn * size, 1, size, dt->data); // XXX retval +#endif + } else { + printf ("commit dt (root)\n"); + attr = dt->dir->iroot; + size = dt->data_len; + //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); +#ifdef RM_WRITE + ntfs_attr_pwrite(attr, 0, size, dt->data); // XXX retval +#endif + } + + printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, dt->vcn); + + dt->changed = FALSE; + } + + for (i = 0; i < dt->child_count; i++) { + if ((dt->inodes[i]) && (NInoDirty (dt->inodes[i]))) { +#ifdef RM_WRITE + ntfs_inode_sync (dt->inodes[i]); +#endif + printf (RED "\tntfs_inode_sync %llu\n" END, dt->inodes[i]->mft_no); + } + + if (ntfs_dt_commit (dt->sub_nodes[i]) < 0) + return -1; + } + + return 0; +} + +/** + * ntfs_dt_free + */ +static void ntfs_dt_free (struct ntfs_dt *dt) +{ + int i; + + if (!dt) + return; + + ntfs_dt_rollback (dt); + + for (i = 0; i < dt->child_count; i++) { + //if (dt->sub_nodes) + ntfs_dt_free (dt->sub_nodes[i]); + //if (dt->inodes) + ntfs_inode_close2 (dt->inodes[i]); + } + + free (dt->sub_nodes); + free (dt->children); + free (dt->inodes); + free (dt->data); // XXX is this always ours? + free (dt); +} + /** * ntfs_dt_alloc_children */ @@ -1114,123 +1329,6 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) return dt->child_count; } -/** - * ntfs_dt_commit - */ -static int ntfs_dt_commit (struct ntfs_dt *dt) -{ - ntfs_volume *vol; - ntfs_attr *attr; - struct ntfs_dir *dir; - int i; - int size; - - if (!dt) - return 0; - - dir = dt->dir; - if (!dir) - return -1; - - vol = dir->vol; // cluster size - - if (dt->changed) { - if (dt->parent) { - printf ("commit dt (alloc)\n"); - attr = dt->dir->ialloc; - size = dt->dir->index_size; - //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); -#ifdef RM_WRITE - ntfs_attr_mst_pwrite(attr, dt->vcn * size, 1, size, dt->data); // XXX retval -#endif - } else { - printf ("commit dt (root)\n"); - attr = dt->dir->iroot; - size = dt->data_len; - //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); -#ifdef RM_WRITE - ntfs_attr_pwrite(attr, 0, size, dt->data); // XXX retval -#endif - } - - printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, dt->vcn); - - dt->changed = FALSE; - } - - for (i = 0; i < dt->child_count; i++) { - if ((dt->inodes[i]) && (NInoDirty (dt->inodes[i]))) { -#ifdef RM_WRITE - ntfs_inode_sync (dt->inodes[i]); -#endif - printf (RED "\tntfs_inode_sync %llu\n" END, dt->inodes[i]->mft_no); - } - - if (ntfs_dt_commit (dt->sub_nodes[i]) < 0) - return -1; - } - - return 0; -} - -/** - * ntfs_dt_rollback - */ -static int ntfs_dt_rollback (struct ntfs_dt *dt) -{ - int i; - - if (!dt) - return -1; - - return 0; // TEMP - - for (i = 0; i < dt->child_count; i++) { - if (dt->sub_nodes) - ntfs_dt_rollback (dt->sub_nodes[i]); - if (dt->inodes) - ntfs_inode_close2 (dt->inodes[i]); - } - - free (dt->data); - free (dt->children); - free (dt->sub_nodes); - free (dt->inodes); - - dt->data = NULL; - dt->children = NULL; - dt->sub_nodes = NULL; - dt->inodes = NULL; - - return 0; -} - -/** - * ntfs_dt_free - */ -static void ntfs_dt_free (struct ntfs_dt *dt) -{ - int i; - - if (!dt) - return; - - ntfs_dt_rollback (dt); - - for (i = 0; i < dt->child_count; i++) { - //if (dt->sub_nodes) - ntfs_dt_free (dt->sub_nodes[i]); - //if (dt->inodes) - ntfs_inode_close2 (dt->inodes[i]); - } - - free (dt->sub_nodes); - free (dt->children); - free (dt->inodes); - free (dt->data); // XXX is this always ours? - free (dt); -} - /** * ntfs_dt_alloc */ @@ -1896,108 +1994,50 @@ static int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start /** - * ntfs_inode_dir_map + * utils_free_non_residents */ -static void ntfs_inode_dir_map (ntfs_inode *ino) +static int utils_free_non_residents (ntfs_inode *inode) { - ATTR_RECORD *rec; - FILE_NAME_ATTR *fn; - ntfs_inode *parent; + // XXX need to do this in memory - if (!ino) - return; + ntfs_attr_search_ctx *ctx; + ntfs_attr *na; + ATTR_RECORD *arec; - printf ("open inode %lld\n", ino->mft_no); + if (!inode) + return -1; - if (ino->mft_no == FILE_root) { - printf ("done\n"); - return; + ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); + if (!ctx) { + printf ("can't create a search context\n"); + return -1; } - rec = find_first_attribute (AT_FILE_NAME, ino->mrec); - if (!rec) - return; - - fn = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); - - parent = ntfs_inode_open (ino->vol, fn->parent_directory); - if (parent) { - ntfs_inode_dir_map (parent); - ntfs_inode_close (parent); + while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { + arec = ctx->attr; + if (arec->non_resident) { + na = ntfs_attr_open (inode, arec->type, NULL, 0); + if (na) { + runlist_element *rl; + LCN size; + LCN count; + ntfs_attr_map_whole_runlist (na); + rl = na->rl; + size = na->allocated_size >> inode->vol->cluster_size_bits; + for (count = 0; count < size; count += rl->length, rl++) { + //printf ("rl(%llu,%llu,%lld)\n", rl->vcn, rl->lcn, rl->length); + //printf ("freed %d\n", ntfs_cluster_free (inode->vol, na, rl->vcn, rl->length)); + ntfs_cluster_free (inode->vol, na, rl->vcn, rl->length); + } + ntfs_attr_close (na); + } + } } + + ntfs_attr_put_search_ctx (ctx); + return 0; } -/** - * ntfs_inode_open2 - */ -static ntfs_inode *ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) -{ - ntfs_inode *ino = NULL; - struct ntfs_dir *dir; - - if (!vol) - return NULL; - - switch (mref) { - case FILE_Bitmap: ino = vol->lcnbmp_ni; break; - case FILE_MFT: ino = vol->mft_ni; break; - case FILE_MFTMirr: ino = vol->mftmirr_ni; break; - case FILE_root: - dir = vol->private_data; - if (dir) - ino = dir->inode; - break; - } - - if (ino) { - //printf (BOLD YELLOW "inode reuse %lld\n" END, mref); - ino->ref_count++; - return ino; - } - - ino = ntfs_inode_open (vol, mref); - if (!ino) - return NULL; - - /* - if (mref != FILE_root) - ntfs_inode_dir_map (ino); - */ - - // link - // ino->private_data - - ino->private_data = NULL; - ino->ref_count = 1; - - //printf (BOLD YELLOW "inode open %lld\n" END, mref); - return ino; -} - -/** - * ntfs_inode_close2 - */ -static int ntfs_inode_close2 (ntfs_inode *ni) -{ - if (!ni) - return 0; - - //printf (BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); - - ni->ref_count--; - if (ni->ref_count > 0) - return 0; - - // unlink - // ino->private_data - - // XXX temporary until we have commit/rollback - NInoClearDirty(ni); - - return ntfs_inode_close (ni); -} - - /** * utils_free_non_residents3 */ @@ -2035,729 +2075,32 @@ static int utils_free_non_residents3 (struct ntfs_bmp *bmp, ntfs_inode *inode, A } /** - * ntfs_mft_remove_attr + * utils_free_non_residents2 */ -static int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES type) +static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) { - ATTR_RECORD *attr20, *attrXX; - MFT_RECORD *mft; - u8 *src, *dst; - int len; + ntfs_attr_search_ctx *ctx; if (!inode) - return 1; + return -1; + if (!bmp) + return -1; - attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, inode->mrec); - if (attr20) - return 1; + ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); + if (!ctx) { + printf ("can't create a search context\n"); + return -1; + } - printf ("remove inode %lld, attr 0x%02X\n", inode->mft_no, type); + while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { + utils_free_non_residents3 (bmp, inode, ctx->attr); + } - attrXX = find_first_attribute (type, inode->mrec); - if (!attrXX) - return 1; - - if (utils_free_non_residents3 (bmp, inode, attrXX)) - return 1; - - // remove entry - // inode->mrec - - mft = inode->mrec; - //utils_dump_mem ((u8*)mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); - - //utils_dump_mem ((u8*)attrXX, 0, attrXX->length, DM_DEFAULTS); printf ("\n"); - - //printf ("mrec = %p, attr = %p, diff = %d (0x%02X)\n", mft, attrXX, (u8*)attrXX - (u8*)mft, (u8*)attrXX - (u8*)mft); - // memmove - - dst = (u8*) attrXX; - src = dst + attrXX->length; - len = (((u8*) mft + mft->bytes_in_use) - src); - - // fix mft header - mft->bytes_in_use -= attrXX->length; - -#if 0 - printf ("dst = 0x%02X, src = 0x%02X, len = 0x%02X\n", (dst - (u8*)mft), (src - (u8*)mft), len); - printf ("attr %02X, len = 0x%02X\n", attrXX->type, attrXX->length); - printf ("bytes in use = 0x%02X\n", mft->bytes_in_use); - printf ("\n"); -#endif - - memmove (dst, src, len); - //utils_dump_mem ((u8*)mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); - - NInoSetDirty(inode); + ntfs_attr_put_search_ctx (ctx); return 0; } -/** - * ntfs_dir_commit - */ -static int ntfs_dir_commit (struct ntfs_dir *dir) -{ - int i; - - if (!dir) - return 0; - - printf ("commit dir inode %llu\n", dir->inode->mft_no); - if (NInoDirty (dir->inode)) { -#ifdef RM_WRITE - ntfs_inode_sync (dir->inode); -#endif - printf (RED "\tntfs_inode_sync %llu\n" END, dir->inode->mft_no); - } - - ntfs_dir_truncate (dir->vol, dir); - - if (ntfs_dt_commit (dir->index) < 0) - return -1; - - if (ntfs_bmp_commit (dir->bitmap) < 0) - return -1; - - for (i = 0; i < dir->child_count; i++) { - if (ntfs_dir_commit (dir->children[i]) < 0) - return -1; - } - - return 0; -} - -/** - * ntfs_dir_rollback - */ -static int ntfs_dir_rollback (struct ntfs_dir *dir) -{ - int i; - - if (!dir) - return -1; - - if (ntfs_dt_rollback (dir->index) < 0) - return -1; - - if (ntfs_bmp_rollback (dir->bitmap) < 0) - return -1; - - for (i = 0; i < dir->child_count; i++) { - if (ntfs_dir_rollback (dir->children[i]) < 0) - return -1; - } - - return 0; -} - -/** - * ntfs_dir_free - */ -static void ntfs_dir_free (struct ntfs_dir *dir) -{ - struct ntfs_dir *parent; - int i; - - if (!dir) - return; - - ntfs_dir_rollback (dir); - - parent = dir->parent; - if (parent) { - for (i = 0; i < parent->child_count; i++) { - if (parent->children[i] == dir) { - parent->children[i] = NULL; - } - } - } - - ntfs_attr_close (dir->iroot); - ntfs_attr_close (dir->ialloc); - ntfs_inode_close2 (dir->inode); - - ntfs_dt_free (dir->index); - ntfs_bmp_free (dir->bitmap); - - for (i = 0; i < dir->child_count; i++) - ntfs_dir_free (dir->children[i]); - - free (dir->children); - free (dir); -} - -/** - * ntfs_dir_alloc - */ -static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) -{ - struct ntfs_dir *dir = NULL; - ntfs_inode *inode = NULL; - ATTR_RECORD *rec = NULL; - INDEX_ROOT *ir = NULL; - - if (!vol) - return NULL; - - //printf ("ntfs_dir_alloc %lld\n", MREF (mft_num)); - inode = ntfs_inode_open2 (vol, mft_num); - if (!inode) - return NULL; - - dir = calloc (1, sizeof (*dir)); - if (!dir) { - ntfs_inode_close2 (inode); - return NULL; - } - - dir->inode = inode; - dir->iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); - dir->ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); - - dir->vol = vol; - dir->parent = NULL; - dir->name = NULL; - dir->name_len = 0; - dir->index = NULL; - dir->children = NULL; - dir->child_count = 0; - dir->mft_num = mft_num; - - // This may not exist - dir->bitmap = ntfs_bmp_alloc (inode, AT_BITMAP, I30, 4); - - if (dir->ialloc) { - rec = find_first_attribute (AT_INDEX_ROOT, inode->mrec); - ir = (INDEX_ROOT*) ((u8*)rec + rec->value_offset); - dir->index_size = ir->index_block_size; - } else { - dir->index_size = 0; - } - - if (!dir->iroot) { - ntfs_dir_free (dir); - return NULL; - } - - return dir; -} - -/** - * ntfs_dir_add - */ -static void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) -{ - if (!parent || !child) - return; - - parent->child_count++; - //printf ("child count = %d\n", parent->child_count); - parent->children = realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); - child->parent = parent; - - parent->children[parent->child_count-1] = child; -} - -/** - * ntfs_dir_find - */ -static MFT_REF ntfs_dir_find (struct ntfs_dir *dir, char *name) -{ - MFT_REF mft_num; - ntfschar *uname = NULL; - int len; - - if (!dir || !name) - return -1; - - len = ntfs_mbstoucs (name, &uname, 0); - if (len < 0) - return -1; - - if (!dir->index) - dir->index = ntfs_dt_alloc (dir, NULL, -1); - - //printf ("dir->index = %p\n", dir->index); - //printf ("dir->child_count = %d\n", dir->child_count); - //printf ("uname = %p\n", uname); - mft_num = ntfs_dt_find (dir->index, uname, len); - - free (uname); - return mft_num; -} - -/** - * ntfs_dir_find2 - */ -static struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, int name_len) -{ - int i; - struct ntfs_dir *child = NULL; - struct ntfs_dt *dt = NULL; - int dt_num = 0; - INDEX_ENTRY *ie; - MFT_REF mft_num; - - if (!dir || !name) - return NULL; - - if (!dir->index) { // XXX when will this happen? - printf ("ntfs_dir_find2 - directory has no index\n"); - return NULL; - } - - for (i = 0; i < dir->child_count; i++) { - if (0 == ntfs_names_collate (name, name_len, - dir->children[i]->name, - dir->children[i]->name_len, - 2, IGNORE_CASE, - dir->vol->upcase, - dir->vol->upcase_len)) - return dir->children[i]; - } - - dt = ntfs_dt_find2 (dir->index, name, name_len, &dt_num); - if (!dt) { - printf ("can't find name in dir\n"); - return NULL; - } - - ie = dt->children[dt_num]; - - mft_num = ie->indexed_file; - - child = ntfs_dir_alloc (dir->vol, mft_num); - if (!child) - return NULL; - - child->index = ntfs_dt_alloc (child, NULL, -1); - - ntfs_dir_add (dir, child); - - return child; -} - -/** - * ntfs_dir_truncate - */ -static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) -{ - //int i; - //u8 *buffer; - //int buf_count; - s64 last_bit; - INDEX_ENTRY *ie; - - if (!vol || !dir) - return -1; - - if ((dir->ialloc == NULL) || (dir->bitmap == NULL)) - return 0; - -#if 0 - buf_count = ROUND_UP (dir->bitmap->attr->allocated_size, vol->cluster_size) >> vol->cluster_size_bits; - printf ("alloc = %lld bytes\n", dir->ialloc->allocated_size); - printf ("alloc = %lld clusters\n", dir->ialloc->allocated_size >> vol->cluster_size_bits); - printf ("bitmap bytes 0 to %lld\n", ((dir->ialloc->allocated_size >> vol->cluster_size_bits)-1)>>3); - printf ("bitmap = %p\n", dir->bitmap); - printf ("bitmap = %lld bytes\n", dir->bitmap->attr->allocated_size); - printf ("bitmap = %d buffers\n", buf_count); -#endif - - last_bit = ntfs_bmp_find_last_set (dir->bitmap); - if (dir->ialloc->allocated_size == (dir->index_size * (last_bit + 1))) { - //printf ("nothing to do\n"); - return 0; - } - - printf (BOLD YELLOW "Truncation needed\n" END); - -#if 0 - printf ("\tlast bit = %lld\n", last_bit); - printf ("\tactual IALLOC size = %lld\n", dir->ialloc->allocated_size); - printf ("\tshould IALLOC size = %lld\n", dir->index_size * (last_bit + 1)); -#endif - - if ((dir->index_size * (last_bit + 1)) == 0) { - printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); - //rollback all dts - //ntfs_dt_rollback (dir->index); - //dir->index = NULL; - // What about the ROOT dt? - - ie = ntfs_ie_copy (dir->index->children[0]); - if (!ie) { - printf (RED "IE copy failed\n" END); - return -1; - } - - ie = ntfs_ie_remove_vcn (ie); - if (!ie) { - printf (RED "IE remove vcn failed\n" END); - return -1; - } - - //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); - //utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); - ntfs_dt_root_replace (dir->index, 0, dir->index->children[0], ie); - //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); - //printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); - - free (ie); - ie = NULL; - - //index flags remove LARGE_INDEX - dir->index->header->flags = 0; - - //rollback dir's bmp - ntfs_bmp_free (dir->bitmap); - dir->bitmap = NULL; - - /* - for (i = 0; i < dir->index->child_count; i++) { - ntfs_dt_rollback (dir->index->sub_nodes[i]); - dir->index->sub_nodes[i] = NULL; - } - */ - - //printf ("dir->index->inodes[0] = %p\n", dir->index->inodes[0]); - - //remove 0xA0 attribute - ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_INDEX_ALLOCATION); - - //remove 0xB0 attribute - ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_BITMAP); - } else { - printf (RED "Cannot shrink directory\n" END); - //ntfs_dir_shrink_alloc - //ntfs_dir_shrink_bitmap - //make bitmap resident? - } - - /* - * Remove - * dt -> dead - * bitmap updated - * rollback dead dts - * commit bitmap - * commit dts - * commit dir - */ - /* - * Reuse - * search for lowest dead - * update bitmap - * init dt - * remove from dead - * insert into tree - * init INDX - */ - -#if 0 - buffer = ntfs_bmp_get_data (dir->bitmap, 0); - if (!buffer) - return -1; - - utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); - for (i = buf_count-1; i >= 0; i--) { - if (buffer[i]) { - printf ("alloc in use\n"); - return 0; - } - } -#endif - - // /$BITMAP($I30) - // /$INDEX_ALLOCATION($I30) - // $Bitmap - - // Find the highest set bit in the directory bitmap - // can we free any clusters of the alloc? - // if yes, resize attribute - - // Are *any* bits set? - // If not remove ialloc - - return 0; -} - - -/** - * utils_volume_commit - */ -static int utils_volume_commit (ntfs_volume *vol) -{ - if (!vol) - return -1; - - printf ("commit volume\n"); - if (ntfs_bmp_commit (vol->private_bmp1) < 0) - return -1; - - if (ntfs_bmp_commit (vol->private_bmp2) < 0) - return -1; - - if (ntfs_dir_commit (vol->private_data) < 0) - return -1; - - return 0; -} - -/** - * utils_volume_rollback - */ -static int utils_volume_rollback (ntfs_volume *vol) -{ - if (!vol) - return -1; - - if (ntfs_bmp_rollback (vol->private_bmp1) < 0) - return -1; - - if (ntfs_bmp_rollback (vol->private_bmp2) < 0) - return -1; - - if (ntfs_dir_rollback (vol->private_data) < 0) - return -1; - - return 0; -} - -/** - * ntfs_umount2 - */ -static int ntfs_umount2 (ntfs_volume *vol, const BOOL force) -{ - struct ntfs_dir *dir; - struct ntfs_bmp *bmp; - - if (!vol) - return 0; - - utils_volume_rollback (vol); - - dir = (struct ntfs_dir *) vol->private_data; - vol->private_data = NULL; - ntfs_dir_free (dir); - - bmp = (struct ntfs_bmp *) vol->private_bmp1; - vol->private_bmp1 = NULL; - ntfs_bmp_free (bmp); - - bmp = (struct ntfs_bmp *) vol->private_bmp2; - vol->private_bmp2 = NULL; - ntfs_bmp_free (bmp); - - return ntfs_umount (vol, force); -} - -/** - * utils_mount_volume2 - */ -static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flags, BOOL force) -{ - // XXX can we replace these and search by mft number? Hmm... NO. - static ntfschar bmp[8] = { - const_cpu_to_le16('$'), - const_cpu_to_le16('B'), - const_cpu_to_le16('i'), - const_cpu_to_le16('t'), - const_cpu_to_le16('m'), - const_cpu_to_le16('a'), - const_cpu_to_le16('p'), - const_cpu_to_le16(0) - }; - - static ntfschar mft[5] = { - const_cpu_to_le16('$'), - const_cpu_to_le16('M'), - const_cpu_to_le16('F'), - const_cpu_to_le16('T'), - const_cpu_to_le16(0) - }; - - static ntfschar mftmirr[9] = { - const_cpu_to_le16('$'), - const_cpu_to_le16('M'), - const_cpu_to_le16('F'), - const_cpu_to_le16('T'), - const_cpu_to_le16('M'), - const_cpu_to_le16('i'), - const_cpu_to_le16('r'), - const_cpu_to_le16('r'), - const_cpu_to_le16(0) - }; - - static ntfschar dot[2] = { - const_cpu_to_le16('.'), - const_cpu_to_le16(0) - }; - - ntfs_volume *vol; - struct ntfs_dir *dir; - struct ntfs_dt *root; - struct ntfs_dt *found; - int num; - - vol = utils_mount_volume (device, flags, force); - if (!vol) - return NULL; - - vol->lcnbmp_ni ->ref_count = 1; - vol->mft_ni ->ref_count = 1; - vol->mftmirr_ni->ref_count = 1; - - vol->lcnbmp_ni ->private_data = NULL; - vol->mft_ni ->private_data = NULL; - vol->mftmirr_ni->private_data = NULL; - - dir = ntfs_dir_alloc (vol, FILE_root); - if (!dir) { - ntfs_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - - dir->index = ntfs_dt_alloc (dir, NULL, -1); - - root = dir->index; - - //$Bitmap - num = -1; - found = ntfs_dt_find2 (root, bmp, 7, &num); - if ((!found) || (num < 0)) { - printf ("can't find $Bitmap\n"); - ntfs_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - vol->lcnbmp_ni->ref_count++; - vol->lcnbmp_ni->private_data = found->dir; - found->inodes[num] = vol->lcnbmp_ni; - - //$MFT - num = -1; - found = ntfs_dt_find2 (root, mft, 4, &num); - if ((!found) || (num < 0)) { - printf ("can't find $MFT\n"); - ntfs_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - vol->mft_ni->ref_count++; - vol->mft_ni->private_data = found->dir; - found->inodes[num] = vol->mft_ni; - - //$MFTMirr - num = -1; - found = ntfs_dt_find2 (root, mftmirr, 8, &num); - if ((!found) || (num < 0)) { - printf ("can't find $MFTMirr\n"); - ntfs_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - vol->mftmirr_ni->ref_count++; - vol->mftmirr_ni->private_data = found->dir; - found->inodes[num] = vol->mftmirr_ni; - - // root directory - num = -1; - found = ntfs_dt_find2 (root, dot, 1, &num); - if ((!found) || (num < 0)) { - printf ("can't find the root directory\n"); - ntfs_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - - vol->private_data = found->dir; - found->inodes[num] = dir->inode; - dir->inode->private_data = found; - dir->inode->ref_count = 2; - - vol->private_bmp1 = ntfs_bmp_alloc (vol->mft_ni, AT_BITMAP, NULL, 0); - vol->private_bmp2 = ntfs_bmp_alloc (vol->lcnbmp_ni, AT_DATA, NULL, 0); - - if (!vol->private_bmp1 || !vol->private_bmp2) { - printf ("can't find the bitmaps\n"); - ntfs_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - -done: - return vol; -} - - -/** - * utils_pathname_to_mftref - */ -static MFT_REF utils_pathname_to_mftref (ntfs_volume *vol, struct ntfs_dir *parent, const char *pathname, struct ntfs_dir **finddir) -{ - MFT_REF mft_num; - MFT_REF result = -1; - char *p, *q; - char *ascii = NULL; - struct ntfs_dir *dir = NULL; - - if (!vol || !parent || !pathname) { - errno = EINVAL; - return -1; - } - - ascii = strdup (pathname); // Work with a r/w copy - if (!ascii) { - Eprintf ("Out of memory.\n"); - goto close; - } - - p = ascii; - while (p && *p && *p == PATH_SEP) // Remove leading /'s - p++; - while (p && *p) { - q = strchr (p, PATH_SEP); // Find the end of the first token - if (q != NULL) { - *q = '\0'; - q++; - } - - //printf ("looking for %s in %p\n", p, parent); - mft_num = ntfs_dir_find (parent, p); - if (mft_num == (u64)-1) { - Eprintf ("Couldn't find name '%s' in pathname '%s'.\n", p, pathname); - goto close; - } - - if (q) { - dir = ntfs_dir_alloc (vol, mft_num); - if (!dir) { - Eprintf ("Couldn't allocate a new directory (%lld).\n", mft_num); - goto close; - } - - ntfs_dir_add (parent, dir); - parent = dir; - } else { - //printf ("file %s\n", p); - result = mft_num; - if (finddir) - *finddir = dir ? dir : parent; - break; - } - - p = q; - while (p && *p && *p == PATH_SEP) - p++; - } - -close: - free (ascii); // from strdup - return result; -} - /** * utils_mftrec_mark_free */ @@ -2915,184 +2258,65 @@ static int utils_mftrec_mark_free5 (ntfs_inode *inode, struct ntfs_bmp *bmp, MFT return 0; } -/** - * utils_free_non_residents - */ -static int utils_free_non_residents (ntfs_inode *inode) -{ - // XXX need to do this in memory - - ntfs_attr_search_ctx *ctx; - ntfs_attr *na; - ATTR_RECORD *arec; - - if (!inode) - return -1; - - ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); - if (!ctx) { - printf ("can't create a search context\n"); - return -1; - } - - while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { - arec = ctx->attr; - if (arec->non_resident) { - na = ntfs_attr_open (inode, arec->type, NULL, 0); - if (na) { - runlist_element *rl; - LCN size; - LCN count; - ntfs_attr_map_whole_runlist (na); - rl = na->rl; - size = na->allocated_size >> inode->vol->cluster_size_bits; - for (count = 0; count < size; count += rl->length, rl++) { - //printf ("rl(%llu,%llu,%lld)\n", rl->vcn, rl->lcn, rl->length); - //printf ("freed %d\n", ntfs_cluster_free (inode->vol, na, rl->vcn, rl->length)); - ntfs_cluster_free (inode->vol, na, rl->vcn, rl->length); - } - ntfs_attr_close (na); - } - } - } - - ntfs_attr_put_search_ctx (ctx); - return 0; -} /** - * utils_free_non_residents2 + * ntfs_mft_remove_attr */ -static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) -{ - ntfs_attr_search_ctx *ctx; - - if (!inode) - return -1; - if (!bmp) - return -1; - - ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); - if (!ctx) { - printf ("can't create a search context\n"); - return -1; - } - - while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { - utils_free_non_residents3 (bmp, inode, ctx->attr); - } - - ntfs_attr_put_search_ctx (ctx); - return 0; -} - -/** - * utils_pathname_to_inode2 - */ -static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, const char *pathname, struct ntfs_find *found) +static int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES type) { + ATTR_RECORD *attr20, *attrXX; + MFT_RECORD *mft; + u8 *src, *dst; int len; - char *p, *q; - ntfschar *unicode = NULL; - char *ascii = NULL; - struct ntfs_dir *dir = NULL; - struct ntfs_dir *child = NULL; - struct ntfs_dt *dt = NULL; - int dt_num; - BOOL result = FALSE; - if (!vol || !pathname || !found) { - errno = EINVAL; - return FALSE; - } + if (!inode) + return 1; - memset (found, 0, sizeof (*found)); + attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, inode->mrec); + if (attr20) + return 1; - if (parent) { - dir = parent; - } else { - dir = (struct ntfs_dir *) vol->private_data; - if (!dir) { - Eprintf ("Couldn't open the inode of the root directory.\n"); - goto close; - } - } + printf ("remove inode %lld, attr 0x%02X\n", inode->mft_no, type); - unicode = malloc (MAX_PATH * sizeof (ntfschar)); - ascii = strdup (pathname); // Work with a r/w copy - if (!unicode || !ascii) { - Eprintf ("Out of memory.\n"); - goto close; - } + attrXX = find_first_attribute (type, inode->mrec); + if (!attrXX) + return 1; - p = ascii; - while (p && *p && *p == PATH_SEP) // Remove leading /'s - p++; - while (p && *p) { - q = strchr (p, PATH_SEP); // Find the end of the first token - if (q != NULL) { - *q = '\0'; - q++; - } + if (utils_free_non_residents3 (bmp, inode, attrXX)) + return 1; - len = ntfs_mbstoucs (p, &unicode, MAX_PATH); - if (len < 0) { - Eprintf ("Couldn't convert name to Unicode: %s.\n", p); - goto close; - } + // remove entry + // inode->mrec - //printf ("looking for %s\n", p); - if (q) { - child = ntfs_dir_find2 (dir, unicode, len); - if (!child) { - printf ("can't find %s in %s\n", p, pathname); - goto close; - } - } else { - //printf ("file: %s\n", p); + mft = inode->mrec; + //utils_dump_mem ((u8*)mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); - dt = ntfs_dt_find2 (dir->index, unicode, len, &dt_num); - if (!dt) { - printf ("can't find %s in %s (2)\n", p, pathname); - goto close; - } + //utils_dump_mem ((u8*)attrXX, 0, attrXX->length, DM_DEFAULTS); printf ("\n"); - if (dt->inodes[dt_num] == NULL) { - dt->inodes[dt_num] = ntfs_inode_open (dir->vol, dt->children[dt_num]->indexed_file); - if (!dt->inodes[dt_num]) { - printf ("Can't open inode %lld\n", MREF (dt->children[dt_num]->indexed_file)); - goto close; - } - dt->inodes[dt_num]->ref_count = 2; - dt->inodes[dt_num]->private_data = dt; - } + //printf ("mrec = %p, attr = %p, diff = %d (0x%02X)\n", mft, attrXX, (u8*)attrXX - (u8*)mft, (u8*)attrXX - (u8*)mft); + // memmove - //printf ("dt = %p,%d\n", dt, dt_num); + dst = (u8*) attrXX; + src = dst + attrXX->length; + len = (((u8*) mft + mft->bytes_in_use) - src); - break; - } + // fix mft header + mft->bytes_in_use -= attrXX->length; - dir = child; - child = NULL; - p = q; - while (p && *p && *p == PATH_SEP) - p++; - } +#if 0 + printf ("dst = 0x%02X, src = 0x%02X, len = 0x%02X\n", (dst - (u8*)mft), (src - (u8*)mft), len); + printf ("attr %02X, len = 0x%02X\n", attrXX->type, attrXX->length); + printf ("bytes in use = 0x%02X\n", mft->bytes_in_use); + printf ("\n"); +#endif - found->dir = dir; - found->dt = dt; - found->dt_index = dt_num; - found->inode = dt->inodes[dt_num]; - found->mref = found->inode->mft_no; - result = TRUE; - //printf ("dir %p, dt %p, num %d, ino %p, %lld\n", dir, dt, dt_num, dt->inodes[dt_num], MREF (found->inode->mft_no)); -close: - free (ascii); // from strdup - free (unicode); - return result; + memmove (dst, src, len); + //utils_dump_mem ((u8*)mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); + + NInoSetDirty(inode); + return 0; } - /** * ntfs_mft_resize_resident */ @@ -4481,6 +3705,777 @@ done: } +/** + * ntfs_dir_rollback + */ +static int ntfs_dir_rollback (struct ntfs_dir *dir) +{ + int i; + + if (!dir) + return -1; + + if (ntfs_dt_rollback (dir->index) < 0) + return -1; + + if (ntfs_bmp_rollback (dir->bitmap) < 0) + return -1; + + for (i = 0; i < dir->child_count; i++) { + if (ntfs_dir_rollback (dir->children[i]) < 0) + return -1; + } + + return 0; +} + +/** + * ntfs_dir_truncate + */ +static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) +{ + //int i; + //u8 *buffer; + //int buf_count; + s64 last_bit; + INDEX_ENTRY *ie; + + if (!vol || !dir) + return -1; + + if ((dir->ialloc == NULL) || (dir->bitmap == NULL)) + return 0; + +#if 0 + buf_count = ROUND_UP (dir->bitmap->attr->allocated_size, vol->cluster_size) >> vol->cluster_size_bits; + printf ("alloc = %lld bytes\n", dir->ialloc->allocated_size); + printf ("alloc = %lld clusters\n", dir->ialloc->allocated_size >> vol->cluster_size_bits); + printf ("bitmap bytes 0 to %lld\n", ((dir->ialloc->allocated_size >> vol->cluster_size_bits)-1)>>3); + printf ("bitmap = %p\n", dir->bitmap); + printf ("bitmap = %lld bytes\n", dir->bitmap->attr->allocated_size); + printf ("bitmap = %d buffers\n", buf_count); +#endif + + last_bit = ntfs_bmp_find_last_set (dir->bitmap); + if (dir->ialloc->allocated_size == (dir->index_size * (last_bit + 1))) { + //printf ("nothing to do\n"); + return 0; + } + + printf (BOLD YELLOW "Truncation needed\n" END); + +#if 0 + printf ("\tlast bit = %lld\n", last_bit); + printf ("\tactual IALLOC size = %lld\n", dir->ialloc->allocated_size); + printf ("\tshould IALLOC size = %lld\n", dir->index_size * (last_bit + 1)); +#endif + + if ((dir->index_size * (last_bit + 1)) == 0) { + printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); + //rollback all dts + //ntfs_dt_rollback (dir->index); + //dir->index = NULL; + // What about the ROOT dt? + + ie = ntfs_ie_copy (dir->index->children[0]); + if (!ie) { + printf (RED "IE copy failed\n" END); + return -1; + } + + ie = ntfs_ie_remove_vcn (ie); + if (!ie) { + printf (RED "IE remove vcn failed\n" END); + return -1; + } + + //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); + //utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); + ntfs_dt_root_replace (dir->index, 0, dir->index->children[0], ie); + //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); + //printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); + + free (ie); + ie = NULL; + + //index flags remove LARGE_INDEX + dir->index->header->flags = 0; + + //rollback dir's bmp + ntfs_bmp_free (dir->bitmap); + dir->bitmap = NULL; + + /* + for (i = 0; i < dir->index->child_count; i++) { + ntfs_dt_rollback (dir->index->sub_nodes[i]); + dir->index->sub_nodes[i] = NULL; + } + */ + + //printf ("dir->index->inodes[0] = %p\n", dir->index->inodes[0]); + + //remove 0xA0 attribute + ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_INDEX_ALLOCATION); + + //remove 0xB0 attribute + ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_BITMAP); + } else { + printf (RED "Cannot shrink directory\n" END); + //ntfs_dir_shrink_alloc + //ntfs_dir_shrink_bitmap + //make bitmap resident? + } + + /* + * Remove + * dt -> dead + * bitmap updated + * rollback dead dts + * commit bitmap + * commit dts + * commit dir + */ + /* + * Reuse + * search for lowest dead + * update bitmap + * init dt + * remove from dead + * insert into tree + * init INDX + */ + +#if 0 + buffer = ntfs_bmp_get_data (dir->bitmap, 0); + if (!buffer) + return -1; + + utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); + for (i = buf_count-1; i >= 0; i--) { + if (buffer[i]) { + printf ("alloc in use\n"); + return 0; + } + } +#endif + + // /$BITMAP($I30) + // /$INDEX_ALLOCATION($I30) + // $Bitmap + + // Find the highest set bit in the directory bitmap + // can we free any clusters of the alloc? + // if yes, resize attribute + + // Are *any* bits set? + // If not remove ialloc + + return 0; +} + +/** + * ntfs_dir_commit + */ +static int ntfs_dir_commit (struct ntfs_dir *dir) +{ + int i; + + if (!dir) + return 0; + + printf ("commit dir inode %llu\n", dir->inode->mft_no); + if (NInoDirty (dir->inode)) { +#ifdef RM_WRITE + ntfs_inode_sync (dir->inode); +#endif + printf (RED "\tntfs_inode_sync %llu\n" END, dir->inode->mft_no); + } + + ntfs_dir_truncate (dir->vol, dir); + + if (ntfs_dt_commit (dir->index) < 0) + return -1; + + if (ntfs_bmp_commit (dir->bitmap) < 0) + return -1; + + for (i = 0; i < dir->child_count; i++) { + if (ntfs_dir_commit (dir->children[i]) < 0) + return -1; + } + + return 0; +} + +/** + * ntfs_dir_free + */ +static void ntfs_dir_free (struct ntfs_dir *dir) +{ + struct ntfs_dir *parent; + int i; + + if (!dir) + return; + + ntfs_dir_rollback (dir); + + parent = dir->parent; + if (parent) { + for (i = 0; i < parent->child_count; i++) { + if (parent->children[i] == dir) { + parent->children[i] = NULL; + } + } + } + + ntfs_attr_close (dir->iroot); + ntfs_attr_close (dir->ialloc); + ntfs_inode_close2 (dir->inode); + + ntfs_dt_free (dir->index); + ntfs_bmp_free (dir->bitmap); + + for (i = 0; i < dir->child_count; i++) + ntfs_dir_free (dir->children[i]); + + free (dir->children); + free (dir); +} + +/** + * ntfs_dir_alloc + */ +static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) +{ + struct ntfs_dir *dir = NULL; + ntfs_inode *inode = NULL; + ATTR_RECORD *rec = NULL; + INDEX_ROOT *ir = NULL; + + if (!vol) + return NULL; + + //printf ("ntfs_dir_alloc %lld\n", MREF (mft_num)); + inode = ntfs_inode_open2 (vol, mft_num); + if (!inode) + return NULL; + + dir = calloc (1, sizeof (*dir)); + if (!dir) { + ntfs_inode_close2 (inode); + return NULL; + } + + dir->inode = inode; + dir->iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); + dir->ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); + + dir->vol = vol; + dir->parent = NULL; + dir->name = NULL; + dir->name_len = 0; + dir->index = NULL; + dir->children = NULL; + dir->child_count = 0; + dir->mft_num = mft_num; + + // This may not exist + dir->bitmap = ntfs_bmp_alloc (inode, AT_BITMAP, I30, 4); + + if (dir->ialloc) { + rec = find_first_attribute (AT_INDEX_ROOT, inode->mrec); + ir = (INDEX_ROOT*) ((u8*)rec + rec->value_offset); + dir->index_size = ir->index_block_size; + } else { + dir->index_size = 0; + } + + if (!dir->iroot) { + ntfs_dir_free (dir); + return NULL; + } + + return dir; +} + +/** + * ntfs_dir_add + */ +static void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) +{ + if (!parent || !child) + return; + + parent->child_count++; + //printf ("child count = %d\n", parent->child_count); + parent->children = realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); + child->parent = parent; + + parent->children[parent->child_count-1] = child; +} + +/** + * ntfs_dir_find + */ +static MFT_REF ntfs_dir_find (struct ntfs_dir *dir, char *name) +{ + MFT_REF mft_num; + ntfschar *uname = NULL; + int len; + + if (!dir || !name) + return -1; + + len = ntfs_mbstoucs (name, &uname, 0); + if (len < 0) + return -1; + + if (!dir->index) + dir->index = ntfs_dt_alloc (dir, NULL, -1); + + //printf ("dir->index = %p\n", dir->index); + //printf ("dir->child_count = %d\n", dir->child_count); + //printf ("uname = %p\n", uname); + mft_num = ntfs_dt_find (dir->index, uname, len); + + free (uname); + return mft_num; +} + +/** + * ntfs_dir_find2 + */ +static struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, int name_len) +{ + int i; + struct ntfs_dir *child = NULL; + struct ntfs_dt *dt = NULL; + int dt_num = 0; + INDEX_ENTRY *ie; + MFT_REF mft_num; + + if (!dir || !name) + return NULL; + + if (!dir->index) { // XXX when will this happen? + printf ("ntfs_dir_find2 - directory has no index\n"); + return NULL; + } + + for (i = 0; i < dir->child_count; i++) { + if (0 == ntfs_names_collate (name, name_len, + dir->children[i]->name, + dir->children[i]->name_len, + 2, IGNORE_CASE, + dir->vol->upcase, + dir->vol->upcase_len)) + return dir->children[i]; + } + + dt = ntfs_dt_find2 (dir->index, name, name_len, &dt_num); + if (!dt) { + printf ("can't find name in dir\n"); + return NULL; + } + + ie = dt->children[dt_num]; + + mft_num = ie->indexed_file; + + child = ntfs_dir_alloc (dir->vol, mft_num); + if (!child) + return NULL; + + child->index = ntfs_dt_alloc (child, NULL, -1); + + ntfs_dir_add (dir, child); + + return child; +} + + +/** + * utils_volume_commit + */ +static int utils_volume_commit (ntfs_volume *vol) +{ + if (!vol) + return -1; + + printf ("commit volume\n"); + if (ntfs_bmp_commit (vol->private_bmp1) < 0) + return -1; + + if (ntfs_bmp_commit (vol->private_bmp2) < 0) + return -1; + + if (ntfs_dir_commit (vol->private_data) < 0) + return -1; + + return 0; +} + +/** + * utils_volume_rollback + */ +static int utils_volume_rollback (ntfs_volume *vol) +{ + if (!vol) + return -1; + + if (ntfs_bmp_rollback (vol->private_bmp1) < 0) + return -1; + + if (ntfs_bmp_rollback (vol->private_bmp2) < 0) + return -1; + + if (ntfs_dir_rollback (vol->private_data) < 0) + return -1; + + return 0; +} + +/** + * utils_pathname_to_mftref + */ +static MFT_REF utils_pathname_to_mftref (ntfs_volume *vol, struct ntfs_dir *parent, const char *pathname, struct ntfs_dir **finddir) +{ + MFT_REF mft_num; + MFT_REF result = -1; + char *p, *q; + char *ascii = NULL; + struct ntfs_dir *dir = NULL; + + if (!vol || !parent || !pathname) { + errno = EINVAL; + return -1; + } + + ascii = strdup (pathname); // Work with a r/w copy + if (!ascii) { + Eprintf ("Out of memory.\n"); + goto close; + } + + p = ascii; + while (p && *p && *p == PATH_SEP) // Remove leading /'s + p++; + while (p && *p) { + q = strchr (p, PATH_SEP); // Find the end of the first token + if (q != NULL) { + *q = '\0'; + q++; + } + + //printf ("looking for %s in %p\n", p, parent); + mft_num = ntfs_dir_find (parent, p); + if (mft_num == (u64)-1) { + Eprintf ("Couldn't find name '%s' in pathname '%s'.\n", p, pathname); + goto close; + } + + if (q) { + dir = ntfs_dir_alloc (vol, mft_num); + if (!dir) { + Eprintf ("Couldn't allocate a new directory (%lld).\n", mft_num); + goto close; + } + + ntfs_dir_add (parent, dir); + parent = dir; + } else { + //printf ("file %s\n", p); + result = mft_num; + if (finddir) + *finddir = dir ? dir : parent; + break; + } + + p = q; + while (p && *p && *p == PATH_SEP) + p++; + } + +close: + free (ascii); // from strdup + return result; +} + +/** + * ntfs_umount2 + */ +static int ntfs_umount2 (ntfs_volume *vol, const BOOL force) +{ + struct ntfs_dir *dir; + struct ntfs_bmp *bmp; + + if (!vol) + return 0; + + utils_volume_rollback (vol); + + dir = (struct ntfs_dir *) vol->private_data; + vol->private_data = NULL; + ntfs_dir_free (dir); + + bmp = (struct ntfs_bmp *) vol->private_bmp1; + vol->private_bmp1 = NULL; + ntfs_bmp_free (bmp); + + bmp = (struct ntfs_bmp *) vol->private_bmp2; + vol->private_bmp2 = NULL; + ntfs_bmp_free (bmp); + + return ntfs_umount (vol, force); +} + +/** + * utils_mount_volume2 + */ +static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flags, BOOL force) +{ + // XXX can we replace these and search by mft number? Hmm... NO. + static ntfschar bmp[8] = { + const_cpu_to_le16('$'), + const_cpu_to_le16('B'), + const_cpu_to_le16('i'), + const_cpu_to_le16('t'), + const_cpu_to_le16('m'), + const_cpu_to_le16('a'), + const_cpu_to_le16('p'), + const_cpu_to_le16(0) + }; + + static ntfschar mft[5] = { + const_cpu_to_le16('$'), + const_cpu_to_le16('M'), + const_cpu_to_le16('F'), + const_cpu_to_le16('T'), + const_cpu_to_le16(0) + }; + + static ntfschar mftmirr[9] = { + const_cpu_to_le16('$'), + const_cpu_to_le16('M'), + const_cpu_to_le16('F'), + const_cpu_to_le16('T'), + const_cpu_to_le16('M'), + const_cpu_to_le16('i'), + const_cpu_to_le16('r'), + const_cpu_to_le16('r'), + const_cpu_to_le16(0) + }; + + static ntfschar dot[2] = { + const_cpu_to_le16('.'), + const_cpu_to_le16(0) + }; + + ntfs_volume *vol; + struct ntfs_dir *dir; + struct ntfs_dt *root; + struct ntfs_dt *found; + int num; + + vol = utils_mount_volume (device, flags, force); + if (!vol) + return NULL; + + vol->lcnbmp_ni ->ref_count = 1; + vol->mft_ni ->ref_count = 1; + vol->mftmirr_ni->ref_count = 1; + + vol->lcnbmp_ni ->private_data = NULL; + vol->mft_ni ->private_data = NULL; + vol->mftmirr_ni->private_data = NULL; + + dir = ntfs_dir_alloc (vol, FILE_root); + if (!dir) { + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + + dir->index = ntfs_dt_alloc (dir, NULL, -1); + + root = dir->index; + + //$Bitmap + num = -1; + found = ntfs_dt_find2 (root, bmp, 7, &num); + if ((!found) || (num < 0)) { + printf ("can't find $Bitmap\n"); + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + vol->lcnbmp_ni->ref_count++; + vol->lcnbmp_ni->private_data = found->dir; + found->inodes[num] = vol->lcnbmp_ni; + + //$MFT + num = -1; + found = ntfs_dt_find2 (root, mft, 4, &num); + if ((!found) || (num < 0)) { + printf ("can't find $MFT\n"); + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + vol->mft_ni->ref_count++; + vol->mft_ni->private_data = found->dir; + found->inodes[num] = vol->mft_ni; + + //$MFTMirr + num = -1; + found = ntfs_dt_find2 (root, mftmirr, 8, &num); + if ((!found) || (num < 0)) { + printf ("can't find $MFTMirr\n"); + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + vol->mftmirr_ni->ref_count++; + vol->mftmirr_ni->private_data = found->dir; + found->inodes[num] = vol->mftmirr_ni; + + // root directory + num = -1; + found = ntfs_dt_find2 (root, dot, 1, &num); + if ((!found) || (num < 0)) { + printf ("can't find the root directory\n"); + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + + vol->private_data = found->dir; + found->inodes[num] = dir->inode; + dir->inode->private_data = found; + dir->inode->ref_count = 2; + + vol->private_bmp1 = ntfs_bmp_alloc (vol->mft_ni, AT_BITMAP, NULL, 0); + vol->private_bmp2 = ntfs_bmp_alloc (vol->lcnbmp_ni, AT_DATA, NULL, 0); + + if (!vol->private_bmp1 || !vol->private_bmp2) { + printf ("can't find the bitmaps\n"); + ntfs_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + +done: + return vol; +} + +/** + * utils_pathname_to_inode2 + */ +static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, const char *pathname, struct ntfs_find *found) +{ + int len; + char *p, *q; + ntfschar *unicode = NULL; + char *ascii = NULL; + struct ntfs_dir *dir = NULL; + struct ntfs_dir *child = NULL; + struct ntfs_dt *dt = NULL; + int dt_num; + BOOL result = FALSE; + + if (!vol || !pathname || !found) { + errno = EINVAL; + return FALSE; + } + + memset (found, 0, sizeof (*found)); + + if (parent) { + dir = parent; + } else { + dir = (struct ntfs_dir *) vol->private_data; + if (!dir) { + Eprintf ("Couldn't open the inode of the root directory.\n"); + goto close; + } + } + + unicode = malloc (MAX_PATH * sizeof (ntfschar)); + ascii = strdup (pathname); // Work with a r/w copy + if (!unicode || !ascii) { + Eprintf ("Out of memory.\n"); + goto close; + } + + p = ascii; + while (p && *p && *p == PATH_SEP) // Remove leading /'s + p++; + while (p && *p) { + q = strchr (p, PATH_SEP); // Find the end of the first token + if (q != NULL) { + *q = '\0'; + q++; + } + + len = ntfs_mbstoucs (p, &unicode, MAX_PATH); + if (len < 0) { + Eprintf ("Couldn't convert name to Unicode: %s.\n", p); + goto close; + } + + //printf ("looking for %s\n", p); + if (q) { + child = ntfs_dir_find2 (dir, unicode, len); + if (!child) { + printf ("can't find %s in %s\n", p, pathname); + goto close; + } + } else { + //printf ("file: %s\n", p); + + dt = ntfs_dt_find2 (dir->index, unicode, len, &dt_num); + if (!dt) { + printf ("can't find %s in %s (2)\n", p, pathname); + goto close; + } + + if (dt->inodes[dt_num] == NULL) { + dt->inodes[dt_num] = ntfs_inode_open (dir->vol, dt->children[dt_num]->indexed_file); + if (!dt->inodes[dt_num]) { + printf ("Can't open inode %lld\n", MREF (dt->children[dt_num]->indexed_file)); + goto close; + } + dt->inodes[dt_num]->ref_count = 2; + dt->inodes[dt_num]->private_data = dt; + } + + //printf ("dt = %p,%d\n", dt, dt_num); + + break; + } + + dir = child; + child = NULL; + p = q; + while (p && *p && *p == PATH_SEP) + p++; + } + + found->dir = dir; + found->dt = dt; + found->dt_index = dt_num; + found->inode = dt->inodes[dt_num]; + found->mref = found->inode->mft_no; + result = TRUE; + //printf ("dir %p, dt %p, num %d, ino %p, %lld\n", dir, dt, dt_num, dt->inodes[dt_num], MREF (found->inode->mft_no)); +close: + free (ascii); // from strdup + free (unicode); + return result; +} + + /** * ntfsrm */ @@ -5174,3 +5169,4 @@ done: return result; } + From 8be0570dabad3febebc02dea8280499d8decef14 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 12 Jul 2005 21:46:40 +0000 Subject: [PATCH 2348/2994] Prepare collect_resize_constraints() for $MFT with AT_ATTRIBUTE_LIST support --- ntfsprogs/ntfsresize.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 0e32185f..1b19af0a 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -673,11 +673,22 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) Vprintf("Bad clusters: %8lld - %lld\n", rl->lcn, last_lcn); return; } + + if (inode == FILE_MFT) { + llcn = &resize->last_mft; - if (NInoAttrList(resize->ni)) { + /* + * First run of $MFT AT_DATA and $MFT with AT_ATTRIBUTE_LIST + * isn't supported yet. + */ + if ((resize->ctx->attr->type != AT_DATA || rl->vcn) && + !NInoAttrList(resize->ni)) + supported = 1; + + } else if (NInoAttrList(resize->ni)) { llcn = &resize->last_multi_mft; - if (inode != FILE_MFT && inode != FILE_MFTMirr) + if (inode != FILE_MFTMirr) supported = 1; } else if (flags & ATTR_IS_SPARSE) { @@ -688,13 +699,6 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) llcn = &resize->last_compressed; supported = 1; - } else if (inode == FILE_MFT) { - llcn = &resize->last_mft; - - /* First run of $MFT DATA attribute isn't supported yet */ - if (resize->ctx->attr->type != AT_DATA || rl->vcn) - supported = 1; - } else if (inode == FILE_MFTMirr) { llcn = &resize->last_mftmir; supported = 1; From 8b148a061f01352f163a7b15f5ea90d075da6c97 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 12 Jul 2005 22:03:13 +0000 Subject: [PATCH 2349/2994] ntfsresize: give more hint if an $MFT run should be split. This will be the next most common restriction when $MFT with ATTRIBUTE_LIST will be supported --- ntfsprogs/ntfsresize.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 1b19af0a..45b4dceb 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -521,7 +521,7 @@ static int parse_options(int argc, char **argv) return (!err && !help && !ver); } -static void print_advise(ntfs_volume *vol, s64 supp_lcn) +static void __print_advise(ntfs_volume *vol, s64 supp_lcn) { s64 old_b, new_b, freed_b, old_mb, new_mb, freed_mb; @@ -555,7 +555,11 @@ static void print_advise(ntfs_volume *vol, s64 supp_lcn) else printf("%lld bytes", (long long)freed_b); printf(").\n"); +} +static void print_advise(ntfs_volume *vol, s64 supp_lcn) +{ + __print_advise(vol, supp_lcn); printf("Please make a test run using both the -n and -s options " "before real resizing!\n"); } @@ -751,6 +755,9 @@ static void collect_relocation_info(ntfs_resize_t *resize, runlist *rl) err_printf("$MFT%s can't be split up yet. Please try " "a different size.\n", inode ? "Mirr" : ""); last_lcn = lcn + lcn_length - 1; + if (!(inode == FILE_MFT && rl->vcn == 0) && + lcn - 1 >= resize->inuse) + __print_advise(resize->vol, lcn - 1); print_advise(resize->vol, last_lcn); exit(1); } From 60f27a9a8f1a32b5edb69b3fa82f3f029b4653d9 Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 13 Jul 2005 00:50:52 +0000 Subject: [PATCH 2350/2994] prevent a likely error from upsetting the info collection fix a few error messages --- ntfsprogs/utils.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 615ffc98..40fe9022 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -1,7 +1,7 @@ /** * utils.c - Part of the Linux-NTFS project. * - * Copyright (c) 2002-2004 Richard Russon + * Copyright (c) 2002-2005 Richard Russon * Copyright (c) 2003-2005 Anton Altaparmakov * Copyright (c) 2003 Lode Leroy * @@ -895,7 +895,7 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->flags_match = 0; in_use = utils_mftrec_in_use (ctx->vol, (MFT_REF) ctx->mft_num); if (in_use == -1) { - Eprintf ("Error reading inode %llu. Aborting.", + Eprintf ("Error reading inode %llu. Aborting.\n", (unsigned long long)ctx->mft_num); return -1; } @@ -905,9 +905,9 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->inode = ntfs_inode_open (ctx->vol, (MFT_REF) ctx->mft_num); if (ctx->inode == NULL) { - Eprintf ("Error reading inode %llu.", (unsigned + Eprintf ("Error reading inode %llu.\n", (unsigned long long) ctx->mft_num); - return -1; + continue; } attr10 = find_first_attribute (AT_STANDARD_INFORMATION, ctx->inode->mrec); @@ -943,7 +943,7 @@ int mft_next_record (struct mft_search_ctx *ctx) case 0: ctx->flags_match |= FEMR_NOT_METADATA; break; default: ctx->flags_match |= FEMR_NOT_METADATA; break; - //Eprintf ("Error reading inode %lld.", ctx->mft_num); + //Eprintf ("Error reading inode %lld.\n", ctx->mft_num); //return -1; } @@ -954,7 +954,7 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->inode = calloc (1, sizeof (*ctx->inode)); if (!ctx->inode) { - Eprintf ("Out of memory. Aborting."); + Eprintf ("Out of memory. Aborting.\n"); return -1; } @@ -963,7 +963,7 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->inode->mrec = malloc (ctx->vol->mft_record_size); if (!ctx->inode->mrec) { free (ctx->inode); // == ntfs_inode_close - Eprintf ("Out of memory. Aborting."); + Eprintf ("Out of memory. Aborting.\n"); return -1; } @@ -989,7 +989,7 @@ int mft_next_record (struct mft_search_ctx *ctx) } if (ntfs_inode_close (ctx->inode)) { - Eprintf ("Error closing inode %llu.", + Eprintf ("Error closing inode %llu.\n", (unsigned long long)ctx->mft_num); return -errno; } From c5e05165c9556bd3ce065365ef6c17eb88001bc8 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 13 Jul 2005 17:07:13 +0000 Subject: [PATCH 2351/2994] Fix memory leak in ignore_bad_clusters() --- ntfsprogs/ntfsclone.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 60de9f23..5dfac942 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1383,7 +1383,7 @@ static void ignore_bad_clusters(ntfs_walk_clusters_ctx *image) { ntfs_inode *ni; ntfs_attr_search_ctx *ctx = NULL; - runlist *rl; + runlist *rl, *rl_bad; s64 nr_bad_clusters = 0; if (!(ni = ntfs_inode_open(vol, FILE_BadClus))) @@ -1392,10 +1392,10 @@ static void ignore_bad_clusters(ntfs_walk_clusters_ctx *image) if ((ctx = lookup_data_attr(ni, "$Bad")) == NULL) exit(1); - if (!(rl = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL))) + if (!(rl_bad = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL))) perr_exit("ntfs_mapping_pairs_decompress"); - for (; rl->length; rl++) { + for (rl = rl_bad; rl->length; rl++) { s64 lcn = rl->lcn; if (lcn == LCN_HOLE || lcn < 0) @@ -1409,6 +1409,7 @@ static void ignore_bad_clusters(ntfs_walk_clusters_ctx *image) if (nr_bad_clusters) Printf("WARNING: The disk has %lld or more bad sectors" " (hardware faults).\n", nr_bad_clusters); + free(rl_bad); ntfs_attr_put_search_ctx(ctx); if (ntfs_inode_close(ni)) From 436b290d0397d3ca5449eeb21df3c5507f165774 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 13 Jul 2005 17:47:37 +0000 Subject: [PATCH 2352/2994] Fix one-time memory leak in relocate_attributes() --- ntfsprogs/ntfsresize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 45b4dceb..aae1c378 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1629,7 +1629,7 @@ static void relocate_attributes(ntfs_resize_t *resize) if (ret == -1) exit(1); else if (ret == 1) - return; + break; relocate_attribute(resize); } From 2b2e127d26ac889f8bec095ddbe3ed6a4ad230b0 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 13 Jul 2005 19:37:51 +0000 Subject: [PATCH 2353/2994] Fix segfault during $Bitmap shrinkage introduced very recently by not differentiating shrinkage and enlargement --- ntfsprogs/ntfsresize.c | 48 +++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index aae1c378..6f90dfeb 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1814,13 +1814,18 @@ static void truncate_badclust_bad_attr(ntfs_resize_t *resize) * Reallocate the metadata file $Bitmap. It must be large enough for one bit * per cluster of the shrunken volume. Also it must be a of 8 bytes in size. */ -static void realloc_bitmap_data_attr(ntfs_volume *vol, - struct bitmap *bm, +static void realloc_bitmap_data_attr(ntfs_resize_t *resize, runlist **rl, - s64 nr_bm_clusters, - s64 new_size) + s64 nr_bm_clusters) { s64 i; + ntfs_volume *vol = resize->vol; + ATTR_RECORD *a = resize->ctx->attr; + s64 new_size = resize->new_volume_size; + struct bitmap *bm = &resize->lcn_bitmap; + + if (!(*rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) + perr_exit("ntfs_mapping_pairs_decompress"); release_bitmap_clusters(bm, *rl); free(*rl); @@ -1832,6 +1837,18 @@ static void realloc_bitmap_data_attr(ntfs_volume *vol, perr_exit("Couldn't allocate $Bitmap clusters"); } +static void realloc_lcn_bitmap(ntfs_resize_t *resize, s64 bm_bsize) +{ + u8 *tmp; + + if (!(tmp = realloc(resize->lcn_bitmap.bm, bm_bsize))) + perr_exit("realloc"); + + resize->lcn_bitmap.bm = tmp; + resize->lcn_bitmap.size = bm_bsize; + bitmap_file_data_fixup(resize->new_volume_size, &resize->lcn_bitmap); +} + /** * truncate_bitmap_data_attr */ @@ -1841,8 +1858,6 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) runlist *rl; s64 bm_bsize, size; s64 nr_bm_clusters; - s64 nr_clusters; - u8 *tmp; ntfs_volume *vol = resize->vol; a = resize->ctx->attr; @@ -1850,21 +1865,16 @@ static void truncate_bitmap_data_attr(ntfs_resize_t *resize) /* FIXME: handle resident attribute value */ err_exit("Resident attribute in $Bitmap isn't supported!\n"); - nr_clusters = resize->new_volume_size; - bm_bsize = nr_clusters_to_bitmap_byte_size(nr_clusters); + bm_bsize = nr_clusters_to_bitmap_byte_size(resize->new_volume_size); nr_bm_clusters = rounded_up_division(bm_bsize, vol->cluster_size); - if (!(tmp = (u8 *)realloc(resize->lcn_bitmap.bm, bm_bsize))) - perr_exit("realloc"); - resize->lcn_bitmap.bm = tmp; - resize->lcn_bitmap.size = bm_bsize; - bitmap_file_data_fixup(nr_clusters, &resize->lcn_bitmap); - - if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) - perr_exit("ntfs_mapping_pairs_decompress"); - - realloc_bitmap_data_attr(vol, &resize->lcn_bitmap, &rl, nr_bm_clusters, - nr_clusters); + if (resize->shrink) { + realloc_bitmap_data_attr(resize, &rl, nr_bm_clusters); + realloc_lcn_bitmap(resize, bm_bsize); + } else { + realloc_lcn_bitmap(resize, bm_bsize); + realloc_bitmap_data_attr(resize, &rl, nr_bm_clusters); + } a->highest_vcn = cpu_to_le64(nr_bm_clusters - 1LL); a->allocated_size = cpu_to_le64(nr_bm_clusters * vol->cluster_size); From 2c942cb3f4464321e3e75a5fe838b81b9ca648ee Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 13 Jul 2005 22:55:01 +0000 Subject: [PATCH 2354/2994] tidy up dt rollback and commit --- ntfsprogs/ntfsrm.c | 97 +++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 44 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 55651471..b6e4384d 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1045,6 +1045,28 @@ static int ntfs_ie_test (void) } +/** + * ntfs_dt_free + */ +static void ntfs_dt_free (struct ntfs_dt *dt) +{ + int i; + + if (!dt) + return; + + for (i = 0; i < dt->child_count; i++) { + ntfs_dt_free (dt->sub_nodes[i]); + ntfs_inode_close2 (dt->inodes[i]); + } + + free (dt->sub_nodes); + free (dt->children); + free (dt->inodes); + free (dt->data); // XXX is this always ours? + free (dt); +} + /** * ntfs_dt_rollback */ @@ -1053,28 +1075,41 @@ static int ntfs_dt_rollback (struct ntfs_dt *dt) int i; if (!dt) - return -1; + return 0; + if (dt->child_count == 0) // No children or nothing mapped + return 0; - return 0; // TEMP - - for (i = 0; i < dt->child_count; i++) { - if (dt->sub_nodes) - ntfs_dt_rollback (dt->sub_nodes[i]); - if (dt->inodes) + if (dt->changed) { + // We can't trust anything below us in the tree + for (i = 0; i < dt->child_count; i++) { + ntfs_dt_free (dt->sub_nodes[i]); ntfs_inode_close2 (dt->inodes[i]); + } + + dt->child_count = 0; + + free (dt->data); + free (dt->children); + free (dt->sub_nodes); + free (dt->inodes); + + dt->data = NULL; + dt->children = NULL; + dt->sub_nodes = NULL; + dt->inodes = NULL; + } else { + // This node is OK, check the su-nodes + for (i = 0; i < dt->child_count; i++) { + if (ntfs_dt_rollback (dt->sub_nodes[i])) { + ntfs_inode_close2 (dt->inodes[i]); + // Child was changed so unmap it + dt->sub_nodes[i] = NULL; + dt->inodes[i] = NULL; + } + } } - free (dt->data); - free (dt->children); - free (dt->sub_nodes); - free (dt->inodes); - - dt->data = NULL; - dt->children = NULL; - dt->sub_nodes = NULL; - dt->inodes = NULL; - - return 0; + return (dt->child_count == 0); } /** @@ -1136,32 +1171,6 @@ static int ntfs_dt_commit (struct ntfs_dt *dt) return 0; } -/** - * ntfs_dt_free - */ -static void ntfs_dt_free (struct ntfs_dt *dt) -{ - int i; - - if (!dt) - return; - - ntfs_dt_rollback (dt); - - for (i = 0; i < dt->child_count; i++) { - //if (dt->sub_nodes) - ntfs_dt_free (dt->sub_nodes[i]); - //if (dt->inodes) - ntfs_inode_close2 (dt->inodes[i]); - } - - free (dt->sub_nodes); - free (dt->children); - free (dt->inodes); - free (dt->data); // XXX is this always ours? - free (dt); -} - /** * ntfs_dt_alloc_children */ From 0b75b12544da213552b4158d2630f740010cfeb3 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 15 Jul 2005 15:53:22 +0000 Subject: [PATCH 2355/2994] ntfsmount: * use mount function from utils.[ch] * remove fsname option (need to support if volume already mounted) * add force option to support mount from utils * update manual page * fix tiny memleak --- Makefile.in | 1 + aclocal.m4 | 520 ++++++++++------ config.guess | 64 +- config.sub | 5 +- configure | 1212 +++++++++++++++++++++++++------------- doc/Makefile.in | 1 + include/Makefile.in | 1 + include/ntfs/Makefile.in | 1 + libntfs/Makefile.in | 1 + ltmain.sh | 156 +++-- ntfsprogs/Makefile.am | 2 +- ntfsprogs/Makefile.in | 23 +- ntfsprogs/ntfsmount.8.in | 6 +- ntfsprogs/ntfsmount.c | 77 +-- 14 files changed, 1339 insertions(+), 731 deletions(-) diff --git a/Makefile.in b/Makefile.in index 23ba5a81..553116e9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -144,6 +144,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/aclocal.m4 b/aclocal.m4 index 2b04da7c..4ebc090e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -123,7 +123,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -191,7 +191,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -238,6 +238,48 @@ compiler=$CC ])# _LT_AC_SYS_COMPILER +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_LINKER_BOILERPLATE + + # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -579,8 +621,10 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi @@ -611,6 +655,11 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi else $2=yes fi @@ -680,6 +729,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -965,7 +1015,9 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi @@ -1464,7 +1516,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1527,7 +1579,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -2517,6 +2573,10 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # # Check for any special shared library compilation flags. # @@ -2649,6 +2709,10 @@ lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -2670,7 +2734,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2931,7 +2995,7 @@ case $host_os in fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -2949,11 +3013,11 @@ case $host_os in dgux*) case $cc_basename in - ec++) + ec++*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -2988,11 +3052,11 @@ case $host_os in # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) + aCC*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -3053,11 +3117,11 @@ case $host_os in esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) + aCC*) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -3097,9 +3161,9 @@ case $host_os in ;; irix5* | irix6*) case $cc_basename in - CC) + CC*) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -3110,7 +3174,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -3123,7 +3187,7 @@ case $host_os in ;; linux*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3148,7 +3212,7 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -3173,15 +3237,16 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC) + pgCC*) # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx) + cxx*) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -3212,7 +3277,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3251,7 +3316,7 @@ case $host_os in ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3267,14 +3332,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3292,7 +3357,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3311,7 +3376,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3326,17 +3391,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3355,7 +3420,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3379,7 +3444,7 @@ case $host_os in sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3391,12 +3456,12 @@ case $host_os in ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3409,7 +3474,7 @@ case $host_os in ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3423,9 +3488,13 @@ case $host_os in *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3446,7 +3515,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -3489,7 +3558,7 @@ case $host_os in ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3721,12 +3790,16 @@ lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3745,7 +3818,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3801,15 +3876,22 @@ lt_simple_link_test_code='public class conftest { public static void main(String # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) @@ -3852,11 +3934,16 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) @@ -3886,7 +3973,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -3992,7 +4079,7 @@ ifelse([$1], [], # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -4003,7 +4090,7 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -4086,7 +4173,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4120,7 +4207,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4646,7 +4733,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68) + cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -4655,7 +4742,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4664,10 +4751,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; dgux*) case $cc_basename in - ec++) + ec++*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4680,14 +4767,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; - aCC) + aCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -4705,7 +4792,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. @@ -4716,7 +4803,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' @@ -4727,13 +4814,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC) + pgCC*) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - cxx) + cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -4750,7 +4837,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx) + cxx*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) @@ -4761,14 +4848,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx) + cxx*) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -4784,7 +4871,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sco*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) @@ -4793,13 +4880,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; - gcx) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4809,12 +4896,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc) + lcc*) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4824,7 +4911,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -4924,7 +5011,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4972,7 +5059,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4999,9 +5086,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac ;; sunos4*) @@ -5131,7 +5223,8 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time @@ -5150,7 +5243,28 @@ ifelse([$1],[CXX],[ if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -5219,6 +5333,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -5257,41 +5402,6 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -5302,16 +5412,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -5516,7 +5621,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -5719,7 +5824,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5738,10 +5843,12 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -5750,8 +5857,18 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6042,63 +6159,120 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# 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 of the License, 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. -dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ - succeeded=no +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG - if test -z "$PKG_CONFIG"; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - fi +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then + pkg_cv_[]$1=$ac_cv_env_[]$1[]_value +elif test -n "$PKG_CONFIG"; then + if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then + pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - AC_MSG_CHECKING(for $2) +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.in +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - if $PKG_CONFIG --exists "$2" ; then - AC_MSG_RESULT(yes) - succeeded=yes +pkg_failed=no +AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], + [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) +AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], + [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) - AC_MSG_CHECKING($1_CFLAGS) - $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` - AC_MSG_RESULT($$1_CFLAGS) +if test $pkg_failed = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD - AC_MSG_CHECKING($1_LIBS) - $1_LIBS=`$PKG_CONFIG --libs "$2"` - AC_MSG_RESULT($$1_LIBS) - else - $1_CFLAGS="" - $1_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - ifelse([$4], ,echo $$1_PKG_ERRORS,) - fi + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met. +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. - AC_SUBST($1_CFLAGS) - AC_SUBST($1_LIBS) - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - ifelse([$3], , :, [$3]) - else - ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) - fi -]) +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details.])], + [$4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details. +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # diff --git a/config.guess b/config.guess index 44f30e6c..892833f9 100755 --- a/config.guess +++ b/config.guess @@ -136,16 +136,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -835,25 +825,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux + echo cris-axis-linux-gnu exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux + echo crisv32-axis-linux-gnu exit 0 ;; frv:Linux:*:*) - echo frv-${VENDOR}-linux + echo frv-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -872,7 +862,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -891,13 +881,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux + echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux + echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -910,34 +900,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux + echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux + echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -952,18 +942,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" + echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" + echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linuxoldld) or + # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -992,7 +982,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.sub b/config.sub index c884ad4e..d8fd2f8f 100755 --- a/config.sub +++ b/config.sub @@ -1172,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1205,6 +1205,9 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index 9460fce0..bc51bde2 100755 --- a/configure +++ b/configure @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -947,6 +947,26 @@ ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS +ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_env_PKG_CONFIG_value=$PKG_CONFIG +ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG +ac_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} +ac_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS +ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} +ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS +ac_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} +ac_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS +ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} +ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS +ac_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} +ac_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS +ac_cv_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} +ac_cv_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS +ac_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} +ac_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS +ac_cv_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} +ac_cv_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS # # Report the --help message. @@ -1070,6 +1090,15 @@ Some influential environment variables: CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags + PKG_CONFIG path to pkg-config utility + LIBNTFS_GNOMEVFS_CFLAGS + C compiler flags for LIBNTFS_GNOMEVFS, overriding pkg-config + LIBNTFS_GNOMEVFS_LIBS + linker flags for LIBNTFS_GNOMEVFS, overriding pkg-config + FUSE_MODULE_CFLAGS + C compiler flags for FUSE_MODULE, overriding pkg-config + FUSE_MODULE_LIBS + linker flags for FUSE_MODULE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -3912,7 +3941,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3915 "configure"' > conftest.$ac_ext + echo '#line 3944 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5491,7 +5520,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5494:" \ +echo "$as_me:5523:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5692,6 +5721,7 @@ else fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -5982,7 +6012,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. @@ -6287,7 +6317,16 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -6475,6 +6514,20 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # # Check for any special shared library compilation flags. # @@ -6516,6 +6569,11 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works=yes + fi else lt_prog_compiler_static_works=yes fi @@ -6560,15 +6618,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6563: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6621: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6567: \$? = $ac_status" >&5 + echo "$as_me:6625: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -6674,7 +6734,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' @@ -6722,7 +6782,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -6749,9 +6809,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac ;; sunos4*) @@ -6815,15 +6880,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6818: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6883: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6822: \$? = $ac_status" >&5 + echo "$as_me:6887: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works=yes fi fi @@ -6875,16 +6942,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6878: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6945: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6882: \$? = $ac_status" >&5 + echo "$as_me:6949: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi @@ -6964,6 +7033,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -6984,6 +7063,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -7052,6 +7152,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -7090,41 +7221,6 @@ EOF hardcode_shlibpath_var=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds=$archive_cmds - fi - else - ld_shlibs=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -7135,16 +7231,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -7451,7 +7542,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -7654,7 +7745,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -7673,10 +7764,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -7685,8 +7778,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs=yes ;; @@ -8223,7 +8326,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -8286,7 +8389,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -9075,7 +9182,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6;} # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -9442,7 +9549,7 @@ echo "$as_me: creating $ofile" >&6;} SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -9524,7 +9631,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9558,7 +9665,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -9913,6 +10020,20 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -9934,7 +10055,16 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -10404,7 +10534,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -10422,11 +10552,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi dgux*) case $cc_basename in - ec++) + ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10461,11 +10591,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC) + aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -10526,11 +10656,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC) + aCC*) case "$host_cpu" in hppa*64*|ia64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -10570,9 +10700,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; irix5* | irix6*) case $cc_basename in - CC) + CC*) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -10583,7 +10713,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -10596,7 +10726,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; linux*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10621,7 +10751,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -10646,15 +10776,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC) + pgCC*) # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx) + cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -10685,7 +10816,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10724,7 +10855,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10740,14 +10871,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx) + cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10765,7 +10896,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10784,7 +10915,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10799,17 +10930,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx) + cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -10828,7 +10959,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10852,7 +10983,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi sco*) archive_cmds_need_lc_CXX=no case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10864,12 +10995,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10882,7 +11013,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -10896,9 +11027,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -10919,7 +11054,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -10962,7 +11097,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11171,7 +11306,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; chorus*) case $cc_basename in - cxch68) + cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -11180,7 +11315,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' @@ -11189,10 +11324,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; dgux*) case $cc_basename in - ec++) + ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; @@ -11205,14 +11340,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; - aCC) + aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -11230,7 +11365,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC) + CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. @@ -11241,7 +11376,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' @@ -11252,13 +11387,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; - pgCC) + pgCC*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-static' ;; - cxx) + cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -11275,7 +11410,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; mvs*) case $cc_basename in - cxx) + cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) @@ -11286,14 +11421,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; - cxx) + cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -11309,7 +11444,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sco*) case $cc_basename in - CC) + CC*) lt_prog_compiler_pic_CXX='-fPIC' ;; *) @@ -11318,13 +11453,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; - gcx) + gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; @@ -11334,12 +11469,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; - lcc) + lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; @@ -11349,7 +11484,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; @@ -11393,15 +11528,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11396: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11531: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11400: \$? = $ac_status" >&5 + echo "$as_me:11535: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_CXX=yes fi fi @@ -11453,16 +11590,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11456: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11593: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11460: \$? = $ac_status" >&5 + echo "$as_me:11597: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi @@ -11964,7 +12103,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -12027,7 +12166,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -12816,7 +12959,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 @@ -13522,7 +13688,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 @@ -13628,7 +13796,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' @@ -13676,7 +13844,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' @@ -13703,9 +13871,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_F77='-Qoption ld ';; + *) + lt_prog_compiler_wl_F77='-Wl,';; + esac ;; sunos4*) @@ -13769,15 +13942,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13772: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13945: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13776: \$? = $ac_status" >&5 + echo "$as_me:13949: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_F77=yes fi fi @@ -13829,16 +14004,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13832: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14007: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13836: \$? = $ac_status" >&5 + echo "$as_me:14011: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi @@ -13918,6 +14095,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -13938,6 +14125,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -14006,6 +14214,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_F77=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -14044,41 +14283,6 @@ EOF hardcode_shlibpath_var_F77=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_F77=$archive_cmds_F77 - fi - else - ld_shlibs_F77=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -14089,16 +14293,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs_F77" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi + if test "$ld_shlibs_F77" = no; then + runpath_var= + hardcode_libdir_flag_spec_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -14385,7 +14584,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -14588,7 +14787,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' @@ -14607,10 +14806,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -14619,8 +14820,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs_F77=yes ;; @@ -15157,7 +15368,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -15220,7 +15431,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15419,7 +15634,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -15568,7 +15783,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -15602,7 +15817,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -15851,15 +16066,41 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no +old_archive_cmds_GCJ=$old_archive_cmds + lt_prog_compiler_no_builtin_flag_GCJ= @@ -15885,15 +16126,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15888: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16129: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15892: \$? = $ac_status" >&5 + echo "$as_me:16133: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -15999,7 +16242,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' @@ -16047,7 +16290,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16074,9 +16317,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_GCJ='-Qoption ld ';; + *) + lt_prog_compiler_wl_GCJ='-Wl,';; + esac ;; sunos4*) @@ -16140,15 +16388,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16143: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16391: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16147: \$? = $ac_status" >&5 + echo "$as_me:16395: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_GCJ=yes fi fi @@ -16200,16 +16450,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16203: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16453: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16207: \$? = $ac_status" >&5 + echo "$as_me:16457: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi @@ -16289,6 +16541,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -16309,6 +16571,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -16377,6 +16660,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_GCJ=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -16415,41 +16729,6 @@ EOF hardcode_shlibpath_var_GCJ=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_GCJ=$archive_cmds_GCJ - fi - else - ld_shlibs_GCJ=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -16460,16 +16739,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs_GCJ" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi + if test "$ld_shlibs_GCJ" = no; then + runpath_var= + hardcode_libdir_flag_spec_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -16776,7 +17050,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -16979,7 +17253,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' @@ -16998,10 +17272,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -17010,8 +17286,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs_GCJ=yes ;; @@ -17548,7 +17834,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -17611,7 +17897,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -18400,7 +18690,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the @@ -19066,7 +19380,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -19215,7 +19529,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -19249,7 +19563,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -19899,11 +20213,11 @@ if test "$enable_gnome_vfs" != "no"; then export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" fi - succeeded=no - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; 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_path_PKG_CONFIG+set}" = set; then @@ -19928,7 +20242,6 @@ do done done - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -19942,56 +20255,123 @@ else echo "${ECHO_T}no" >&6 fi +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done +done - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 -echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG - if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then - echo "$as_me:$LINENO: result: yes" >&5 +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + PKG_CONFIG=$ac_pt_PKG_CONFIG +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - succeeded=yes + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + PKG_CONFIG="" + fi - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 +fi - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 - else - LIBNTFS_GNOMEVFS_CFLAGS="" - LIBNTFS_GNOMEVFS_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` +pkg_failed=no +echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 +if test "${pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set" = "xset"; then + pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&6 +echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 +if test "${pkg_cv_LIBNTFS_GNOMEVFS_LIBS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set" = "xset"; then + pkg_cv_LIBNTFS_GNOMEVFS_LIBS=$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&6 - fi +if test $pkg_failed = yes; then + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + # Put the nasty error message in config.log where it belongs + echo "$LIBNTFS_GNOMEVFS_PKG_ERRORS" 1>&5 - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_gnome_vfs=true - else - if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} @@ -20001,8 +20381,22 @@ echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi - fi +elif test $pkg_failed = untried; then + if test "$enable_gnome_vfs" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} + fi + +else + LIBNTFS_GNOMEVFS_CFLAGS=$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS + LIBNTFS_GNOMEVFS_LIBS=$pkg_cv_LIBNTFS_GNOMEVFS_LIBS + compile_gnome_vfs=true +fi fi @@ -20019,98 +20413,59 @@ fi compile_fuse_module=false if test "$enable_fuse_module" != "no"; then - succeeded=no - - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then +pkg_failed=no +echo "$as_me:$LINENO: checking for FUSE_MODULE_CFLAGS" >&5 +echo $ECHO_N "checking for FUSE_MODULE_CFLAGS... $ECHO_C" >&6 +if test "${pkg_cv_FUSE_MODULE_CFLAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 + if test "x$ac_cv_env_FUSE_MODULE_CFLAGS_set" = "xset"; then + pkg_cv_FUSE_MODULE_CFLAGS=$ac_cv_env_FUSE_MODULE_CFLAGS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0" 2>/dev/null` + else + pkg_failed=yes + fi else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + pkg_failed=untried fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_CFLAGS" >&5 +echo "${ECHO_T}$pkg_cv_FUSE_MODULE_CFLAGS" >&6 +echo "$as_me:$LINENO: checking for FUSE_MODULE_LIBS" >&5 +echo $ECHO_N "checking for FUSE_MODULE_LIBS... $ECHO_C" >&6 +if test "${pkg_cv_FUSE_MODULE_LIBS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_FUSE_MODULE_LIBS_set" = "xset"; then + pkg_cv_FUSE_MODULE_LIBS=$ac_cv_env_FUSE_MODULE_LIBS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_LIBS" >&5 +echo "${ECHO_T}$pkg_cv_FUSE_MODULE_LIBS" >&6 - fi +if test $pkg_failed = yes; then + FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` + # Put the nasty error message in config.log where it belongs + echo "$FUSE_MODULE_PKG_ERRORS" 1>&5 - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for fuse >= 2.3.0" >&5 -echo $ECHO_N "checking for fuse >= 2.3.0... $ECHO_C" >&6 - - if $PKG_CONFIG --exists "fuse >= 2.3.0" ; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - succeeded=yes - - echo "$as_me:$LINENO: checking FUSE_MODULE_CFLAGS" >&5 -echo $ECHO_N "checking FUSE_MODULE_CFLAGS... $ECHO_C" >&6 - FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0"` - echo "$as_me:$LINENO: result: $FUSE_MODULE_CFLAGS" >&5 -echo "${ECHO_T}$FUSE_MODULE_CFLAGS" >&6 - - echo "$as_me:$LINENO: checking FUSE_MODULE_LIBS" >&5 -echo $ECHO_N "checking FUSE_MODULE_LIBS... $ECHO_C" >&6 - FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0"` - echo "$as_me:$LINENO: result: $FUSE_MODULE_LIBS" >&5 -echo "${ECHO_T}$FUSE_MODULE_LIBS" >&6 - else - FUSE_MODULE_CFLAGS="" - FUSE_MODULE_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` - - fi - - - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_fuse_module=true - else if test "$enable_fuse_module" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 @@ -20121,8 +20476,22 @@ echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2 echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} fi - fi +elif test $pkg_failed = untried; then + if test "$enable_fuse_module" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 +echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 +echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} + fi + +else + FUSE_MODULE_CFLAGS=$pkg_cv_FUSE_MODULE_CFLAGS + FUSE_MODULE_LIBS=$pkg_cv_FUSE_MODULE_LIBS + compile_fuse_module=true +fi fi @@ -23933,6 +24302,7 @@ s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t diff --git a/doc/Makefile.in b/doc/Makefile.in index ab7029cb..e9a42652 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -119,6 +119,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/Makefile.in b/include/Makefile.in index dbaff49f..2202b27d 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -128,6 +128,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 96473220..2c384c38 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -132,6 +132,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 3b73331f..37bab1b3 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -194,6 +194,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/ltmain.sh b/ltmain.sh index 3d071010..eecedf23 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -17,7 +17,7 @@ # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,8 +43,8 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.14 -TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" +VERSION=1.5.18 +TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. @@ -112,8 +112,9 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -: ${IFS=" -"} +lt_nl=' +' +IFS=" $lt_nl" if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -250,37 +251,14 @@ func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" - f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" - $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ - | $EGREP -v '^[ ]*1[ ]' | while read count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? - i=`expr $i + 1` - done - done - $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE fi } @@ -757,6 +735,15 @@ if test -z "$show_help"; then esac done + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qlibobj="\"$qlibobj\"" ;; + esac + if test "X$libobj" != "X$qlibobj"; then + $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + exit $EXIT_FAILURE + fi objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -829,12 +816,17 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo $srcfile > "$lockfile" + $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qsrcfile="\"$qsrcfile\"" ;; + esac $run $rm "$libobj" "${libobj}T" @@ -856,10 +848,10 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" fi if test ! -d "${xdir}$objdir"; then @@ -939,9 +931,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" else - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -1365,6 +1357,8 @@ EOF ;; darwin_framework) compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" prev= continue ;; @@ -1429,6 +1423,8 @@ EOF -framework) prev=darwin_framework compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" continue ;; @@ -2852,12 +2848,12 @@ EOF *) continue ;; esac case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no @@ -3124,7 +3120,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3133,7 +3129,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3142,7 +3138,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -5091,6 +5087,63 @@ fi\ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5104,20 +5157,7 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi + # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -6026,14 +6066,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\"\$cmd\"$args" + exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - eval \$echo \"\$cmd\"$args + $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index d8713bc6..e0510b1d 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -79,7 +79,7 @@ ntfscp_LDADD = $(AM_LIBS) ntfscp_LDFLAGS = $(AM_LFLAGS) if ENABLE_FUSE_MODULE -ntfsmount_SOURCES = ntfsmount.c +ntfsmount_SOURCES = ntfsmount.c utils.c utils.h ntfsmount_LDADD = $(AM_LIBS) $(FUSE_MODULE_LIBS) ntfsmount_LDFLAGS = $(AM_LFLAGS) ntfsmount_CFLAGS = $(FUSE_MODULE_CFLAGS) -DFUSE_USE_VERSION=22 diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index dc616313..d3c02042 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -111,9 +111,10 @@ ntfsls_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfsmftalloc_OBJECTS = ntfsmftalloc.$(OBJEXT) utils.$(OBJEXT) ntfsmftalloc_OBJECTS = $(am_ntfsmftalloc_OBJECTS) ntfsmftalloc_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__ntfsmount_SOURCES_DIST = ntfsmount.c +am__ntfsmount_SOURCES_DIST = ntfsmount.c utils.c utils.h @ENABLE_FUSE_MODULE_TRUE@am_ntfsmount_OBJECTS = \ -@ENABLE_FUSE_MODULE_TRUE@ ntfsmount-ntfsmount.$(OBJEXT) +@ENABLE_FUSE_MODULE_TRUE@ ntfsmount-ntfsmount.$(OBJEXT) \ +@ENABLE_FUSE_MODULE_TRUE@ ntfsmount-utils.$(OBJEXT) ntfsmount_OBJECTS = $(am_ntfsmount_OBJECTS) am__DEPENDENCIES_2 = @ENABLE_FUSE_MODULE_TRUE@ntfsmount_DEPENDENCIES = \ @@ -240,6 +241,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ @@ -336,7 +338,7 @@ ntfscat_LDFLAGS = $(AM_LFLAGS) ntfscp_SOURCES = ntfscp.c utils.c utils.h ntfscp_LDADD = $(AM_LIBS) ntfscp_LDFLAGS = $(AM_LFLAGS) -@ENABLE_FUSE_MODULE_TRUE@ntfsmount_SOURCES = ntfsmount.c +@ENABLE_FUSE_MODULE_TRUE@ntfsmount_SOURCES = ntfsmount.c utils.c utils.h @ENABLE_FUSE_MODULE_TRUE@ntfsmount_LDADD = $(AM_LIBS) $(FUSE_MODULE_LIBS) @ENABLE_FUSE_MODULE_TRUE@ntfsmount_LDFLAGS = $(AM_LFLAGS) @ENABLE_FUSE_MODULE_TRUE@ntfsmount_CFLAGS = $(FUSE_MODULE_CFLAGS) -DFUSE_USE_VERSION=22 @@ -551,6 +553,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsls.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmftalloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmount-ntfsmount.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmount-utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmove.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsresize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsrm.Po@am__quote@ @@ -596,6 +599,20 @@ ntfsmount-ntfsmount.obj: ntfsmount.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -c -o ntfsmount-ntfsmount.obj `if test -f 'ntfsmount.c'; then $(CYGPATH_W) 'ntfsmount.c'; else $(CYGPATH_W) '$(srcdir)/ntfsmount.c'; fi` +ntfsmount-utils.o: utils.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -MT ntfsmount-utils.o -MD -MP -MF "$(DEPDIR)/ntfsmount-utils.Tpo" -c -o ntfsmount-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ntfsmount-utils.Tpo" "$(DEPDIR)/ntfsmount-utils.Po"; else rm -f "$(DEPDIR)/ntfsmount-utils.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='ntfsmount-utils.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -c -o ntfsmount-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c + +ntfsmount-utils.obj: utils.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -MT ntfsmount-utils.obj -MD -MP -MF "$(DEPDIR)/ntfsmount-utils.Tpo" -c -o ntfsmount-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ntfsmount-utils.Tpo" "$(DEPDIR)/ntfsmount-utils.Po"; else rm -f "$(DEPDIR)/ntfsmount-utils.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='ntfsmount-utils.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -c -o ntfsmount-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi` + mostlyclean-libtool: -rm -f *.lo diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 7739b1c5..e689adce 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -121,8 +121,8 @@ The default is infinite. Note that the size of read requests is limited anyway to 32 pages (which is 128kbyte on i386). .TP -.B fsname= -Sets the filesystem name. The default is the program name. +.B force= +Force mount even if errors occured. Use this option only if you know what are you doing and don't cry about data loss. .TP .B ro @@ -130,7 +130,7 @@ Mount filesystem read-only. .TP .B no_def_opts -By default ntfsmount acts as "default_permissions,kernel_cache,allow_other,fsname=ntfs#device" was passed to it, this option cancel this behaviour. +By default ntfsmount acts as "default_permissions,kernel_cache,allow_other" was passed to it, this option cancel this behaviour. .TP .B succeed_chmod diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 7b45c06f..363d7d82 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -43,6 +43,7 @@ #include "dir.h" #include "unistr.h" #include "layout.h" +#include "utils.h" typedef struct { fuse_fill_dir_t filler; @@ -61,6 +62,7 @@ typedef struct { BOOL ro; BOOL show_sys_files; BOOL succeed_chmod; + BOOL force; } ntfs_fuse_context_t; typedef enum { @@ -74,7 +76,9 @@ static const char *EXEC_NAME = "ntfsmount"; static char def_opts[] = "default_permissions,kernel_cache,allow_other,"; static ntfs_fuse_context_t *ctx; -#define Eprintf(arg...) fprintf(stderr, ##arg) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stderr, NULL, TRUE) +GEN_PRINTF(Qprintf, stderr, NULL, FALSE) static long ntfs_fuse_get_nr_free_mft_records(ntfs_volume *vol) { @@ -870,9 +874,9 @@ static int ntfs_fuse_mount(const char *device) { ntfs_volume *vol; - vol = ntfs_mount(device, (ctx->ro) ? MS_RDONLY : 0); + vol = utils_mount_volume(device, (ctx->ro) ? MS_RDONLY : 0, ctx->force); if (!vol) { - perror("Mount failed"); + Eprintf("Mount failed.\n"); return -1; } ctx->vol = vol; @@ -897,16 +901,16 @@ static void signal_handler(int arg __attribute__((unused))) static char *parse_options(char *options, char **device) { char *opts, *s, *opt, *val, *ret; - BOOL no_def_opts = FALSE, no_fsname = FALSE; + BOOL no_def_opts = FALSE; *device = NULL; /* - * +8 for different in length of "fsname=ntfs#..." and "dev=...". + * +3 for different in length of "fsname=..." and "dev=...". * +1 for comma * +1 for null-terminator. - * Total: +10 + * Total: +5 */ - ret = malloc(strlen(def_opts) + strlen(options) + 10); + ret = malloc(strlen(def_opts) + strlen(options) + 5); if (!ret) { perror("malloc failed"); return NULL; @@ -935,14 +939,12 @@ static char *parse_options(char *options, char **device) ctx->ro =TRUE; strcat(ret, "ro,"); } else if (!strcmp(opt, "fsname")) { /* Filesystem name. */ - if (!val) { - Eprintf("fsname option should have value.\n"); - goto err_exit; - } - no_fsname = TRUE; - strcat(ret, "fsname="); - strcat(ret, val); - strcat(ret, ","); + /* + * We need this to be able to check whether filesystem + * mounted or not. + */ + Eprintf("fsname is unsupported option.\n"); + goto err_exit; } else if (!strcmp(opt, "no_def_opts")) { if (val) { Eprintf("no_def_opts option should not have " @@ -995,6 +997,13 @@ static char *parse_options(char *options, char **device) goto err_exit; } ctx->succeed_chmod = TRUE; + } else if (!strcmp(opt, "force")) { + if (val) { + Eprintf("force option should not " + "have value.\n"); + goto err_exit; + } + ctx->force = TRUE; } else { /* Probably FUSE option. */ strcat(ret, opt); if (val) { @@ -1006,13 +1015,10 @@ static char *parse_options(char *options, char **device) } if (!*device) goto err_exit; - if (!no_def_opts) { + if (!no_def_opts) strcat(ret, def_opts); - if (!no_fsname) { - strcat(ret, "fsname=ntfs#"); - strcat(ret, *device); - } - } + strcat(ret, "fsname="); + strcat(ret, *device); exit: free(opts); return ret; @@ -1031,9 +1037,9 @@ static void usage(void) EXEC_NAME); Eprintf("Possible options are:\n\tdefault_permissions\n\tallow_other\n" "\tkernel_cache\n\tlarge_read\n\tdirect_io\n\tmax_read\n\t" - "fsname\n\tro\n\tno_def_opts\n\tumask\n\tfmask\n\tdmask\n\t" + "force\n\tro\n\tno_def_opts\n\tumask\n\tfmask\n\tdmask\n\t" "uid\n\tgid\n\tshow_sys_files\n\tsucceed_chmod\n\tdev\n\n"); - Eprintf("Default options are: \"%sfsname=ntfs#device\".\n", def_opts); + Eprintf("Default options are: \"%s\".\n", def_opts); } int main(int argc, char *argv[]) @@ -1067,18 +1073,27 @@ int main(int argc, char *argv[]) if (!device) { Eprintf("dev option is mandatory.\n"); ntfs_fuse_destroy(); - return 5; + return 2; } if (!parsed_options) { + free(device); ntfs_fuse_destroy(); - return 6; + return 3; } + /* Mount volume. */ + if (ntfs_fuse_mount(device)) { + free(device); + ntfs_fuse_destroy(); + return 4; + } + free(device); /* Create filesystem. */ ffd = fuse_mount(mnt_point, parsed_options); if (ffd == -1) { Eprintf("fuse_mount failed.\n"); - return 2; + ntfs_fuse_destroy(); + return 5; } free(parsed_options); #ifndef DEBUG @@ -1091,14 +1106,8 @@ int main(int argc, char *argv[]) Eprintf("fuse_new failed.\n"); close(ffd); fuse_unmount(mnt_point); - return 3; - } - /* Mount volume. */ - if (ntfs_fuse_mount(device)) { - fuse_destroy(fh); - close(ffd); - fuse_unmount(mnt_point); - return 4; + ntfs_fuse_destroy(); + return 6; } #ifndef DEBUG if (daemon(0, 0)) From 4ed406e68e1166e6de294b6dd9ccaa3f29f8d1ff Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 16 Jul 2005 06:53:40 +0000 Subject: [PATCH 2356/2994] Add new utility (make extra) - ntfsdecrypt. (Yuval) --- ChangeLog | 1 + Makefile.in | 1 - aclocal.m4 | 520 ++++++---------- config.guess | 64 +- config.sub | 5 +- configure | 1216 +++++++++++++------------------------- doc/Makefile.in | 1 - include/Makefile.in | 1 - include/ntfs/Makefile.in | 1 - libntfs/Makefile.in | 1 - ltmain.sh | 156 ++--- ntfsprogs/Makefile.am | 6 +- ntfsprogs/Makefile.in | 32 +- ntfsprogs/decrypt.c | 532 +++++++++++++++++ ntfsprogs/decrypt.h | 42 ++ ntfsprogs/ntfsdecrypt.c | 415 +++++++++++++ 16 files changed, 1709 insertions(+), 1285 deletions(-) create mode 100644 ntfsprogs/decrypt.c create mode 100644 ntfsprogs/decrypt.h create mode 100644 ntfsprogs/ntfsdecrypt.c diff --git a/ChangeLog b/ChangeLog index 3044bdce..712100a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ xx/07/2005 - 1.11.0-WIP - Fixes and a new utility ntfsmount, a FUSE ntfsmodule. if sector size was above 8kiB and we only reserved one sector even when sector size was less than 512 bytes and then we wrote 512 bytes, i.e. beyond the end of the device.) (Anton) + - Add new utility (make extra) - ntfsdecrypt. (Yuval) 20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. diff --git a/Makefile.in b/Makefile.in index 553116e9..23ba5a81 100644 --- a/Makefile.in +++ b/Makefile.in @@ -144,7 +144,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/aclocal.m4 b/aclocal.m4 index 4ebc090e..2b04da7c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -123,7 +123,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed='sed -e s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -191,7 +191,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -238,48 +238,6 @@ compiler=$CC ])# _LT_AC_SYS_COMPILER -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -AC_DEFUN([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -]) - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -AC_DEFUN([_LT_COMPILER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -AC_DEFUN([_LT_LINKER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_LINKER_BOILERPLATE - - # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -621,10 +579,8 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then $2=yes fi fi @@ -655,11 +611,6 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi else $2=yes fi @@ -729,7 +680,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -1015,9 +965,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi @@ -1516,7 +1464,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1579,11 +1527,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -2573,10 +2517,6 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # # Check for any special shared library compilation flags. # @@ -2709,10 +2649,6 @@ lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -2734,7 +2670,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2995,7 +2931,7 @@ case $host_os in fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -3013,11 +2949,11 @@ case $host_os in dgux*) case $cc_basename in - ec++*) + ec++) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx*) + ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3052,11 +2988,11 @@ case $host_os in # location of the library. case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC*) + aCC) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -3117,11 +3053,11 @@ case $host_os in esac case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC*) + aCC) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -3161,9 +3097,9 @@ case $host_os in ;; irix5* | irix6*) case $cc_basename in - CC*) + CC) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -3174,7 +3110,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -3187,7 +3123,7 @@ case $host_os in ;; linux*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3212,7 +3148,7 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc*) + icpc) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -3237,16 +3173,15 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC) # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx*) + cxx) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -3277,7 +3212,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx*) + cxx) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3316,7 +3251,7 @@ case $host_os in ;; osf3*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3332,14 +3267,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx*) + cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3357,7 +3292,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3376,7 +3311,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3391,17 +3326,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx*) + cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3420,7 +3355,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3444,7 +3379,7 @@ case $host_os in sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3456,12 +3391,12 @@ case $host_os in ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc*) + lcc) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3474,7 +3409,7 @@ case $host_os in ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3488,13 +3423,9 @@ case $host_os in *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3515,7 +3446,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx*) + gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -3558,7 +3489,7 @@ case $host_os in ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3790,16 +3721,12 @@ lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3818,9 +3745,7 @@ aix3*) fi ;; aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi + test "$enable_shared" = yes && enable_static=no ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3876,22 +3801,15 @@ lt_simple_link_test_code='public class conftest { public static void main(String # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds - AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) @@ -3934,16 +3852,11 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) @@ -3973,7 +3886,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -4079,7 +3992,7 @@ ifelse([$1], [], # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -4090,7 +4003,7 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -4173,7 +4086,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4207,7 +4120,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4733,7 +4646,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68*) + cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -4742,7 +4655,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4751,10 +4664,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; dgux*) case $cc_basename in - ec++*) + ec++) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx*) + ghcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4767,14 +4680,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; - aCC*) + aCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -4792,7 +4705,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. @@ -4803,7 +4716,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) case $cc_basename in - KCC*) + KCC) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' @@ -4814,13 +4727,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC*) + pgCC) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - cxx*) + cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -4837,7 +4750,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx*) + cxx) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) @@ -4848,14 +4761,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC*) + KCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC*) + RCC) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx*) + cxx) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -4871,7 +4784,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sco*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) @@ -4880,13 +4793,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; - gcx*) + gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4896,12 +4809,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc*) + lcc) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4911,7 +4824,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -5011,7 +4924,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5059,7 +4972,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5086,14 +4999,9 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac ;; sunos4*) @@ -5223,8 +5131,7 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - _LT_CC_BASENAME([$compiler]) + case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time @@ -5243,28 +5150,7 @@ ifelse([$1],[CXX],[ if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -5333,37 +5219,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -5402,6 +5257,41 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -5412,11 +5302,16 @@ EOF ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -5621,7 +5516,7 @@ EOF _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -5824,7 +5719,7 @@ EOF _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5843,12 +5738,10 @@ EOF solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -5857,18 +5750,8 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - *) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6159,120 +6042,63 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# -# Copyright © 2004 Scott James Remnant . -# -# 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 of the License, 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi - -fi[]dnl -])# PKG_PROG_PKG_CONFIG +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN([PKG_CHECK_MODULES], [ + succeeded=no -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then - pkg_cv_[]$1=$ac_cv_env_[]$1[]_value -elif test -n "$PKG_CONFIG"; then - if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then - pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.in -# -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) -pkg_failed=no -AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], - [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) -AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], - [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes -if test $pkg_failed = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) - ifelse([$4], , [AC_MSG_ERROR(dnl -[Package requirements ($2) were not met. -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details.])], - [$4]) -elif test $pkg_failed = untried; then - ifelse([$4], , [AC_MSG_FAILURE(dnl -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details. -To get pkg-config, see .])], - [$4]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - ifelse([$3], , :, [$3]) -fi[]dnl -])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # diff --git a/config.guess b/config.guess index 892833f9..44f30e6c 100755 --- a/config.guess +++ b/config.guess @@ -136,6 +136,16 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -825,25 +835,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo cris-axis-linux exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo crisv32-axis-linux exit 0 ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo frv-${VENDOR}-linux exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -862,7 +872,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -881,13 +891,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-${VENDOR}-linux exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-${VENDOR}-linux exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -900,34 +910,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-${VENDOR}-linux ;; + PA8*) echo hppa2.0-${VENDOR}-linux ;; + *) echo hppa-${VENDOR}-linux ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-${VENDOR}-linux exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo x86_64-${VENDOR}-linux exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -942,18 +952,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" + echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" + echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or + # Either a pre-BFD a.out linker (linuxoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -982,7 +992,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.sub b/config.sub index d8fd2f8f..c884ad4e 100755 --- a/config.sub +++ b/config.sub @@ -1172,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1205,9 +1205,6 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index bc51bde2..9460fce0 100755 --- a/configure +++ b/configure @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -947,26 +947,6 @@ ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS -ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} -ac_env_PKG_CONFIG_value=$PKG_CONFIG -ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} -ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG -ac_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} -ac_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS -ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} -ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS -ac_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} -ac_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS -ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} -ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS -ac_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} -ac_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS -ac_cv_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} -ac_cv_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS -ac_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} -ac_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS -ac_cv_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} -ac_cv_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS # # Report the --help message. @@ -1090,15 +1070,6 @@ Some influential environment variables: CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags - PKG_CONFIG path to pkg-config utility - LIBNTFS_GNOMEVFS_CFLAGS - C compiler flags for LIBNTFS_GNOMEVFS, overriding pkg-config - LIBNTFS_GNOMEVFS_LIBS - linker flags for LIBNTFS_GNOMEVFS, overriding pkg-config - FUSE_MODULE_CFLAGS - C compiler flags for FUSE_MODULE, overriding pkg-config - FUSE_MODULE_LIBS - linker flags for FUSE_MODULE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -3941,7 +3912,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3944 "configure"' > conftest.$ac_ext + echo '#line 3915 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5520,7 +5491,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5523:" \ +echo "$as_me:5494:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5721,7 +5692,6 @@ else fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -6012,7 +5982,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed='sed -e s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. @@ -6317,16 +6287,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -6514,20 +6475,6 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # # Check for any special shared library compilation flags. # @@ -6569,11 +6516,6 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works=yes - fi else lt_prog_compiler_static_works=yes fi @@ -6618,17 +6560,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6621: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6563: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6625: \$? = $ac_status" >&5 + echo "$as_me:6567: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -6734,7 +6674,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' @@ -6782,7 +6722,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -6809,14 +6749,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac ;; sunos4*) @@ -6880,17 +6815,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6883: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6818: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6887: \$? = $ac_status" >&5 + echo "$as_me:6822: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works=yes fi fi @@ -6942,18 +6875,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6945: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6878: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6949: \$? = $ac_status" >&5 + echo "$as_me:6882: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o=yes fi fi @@ -7033,16 +6964,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -7063,27 +6984,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -7152,37 +7052,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -7221,6 +7090,41 @@ EOF hardcode_shlibpath_var=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds=$archive_cmds + fi + else + ld_shlibs=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -7231,11 +7135,16 @@ EOF ;; esac - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -7542,7 +7451,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -7745,7 +7654,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -7764,12 +7673,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -7778,18 +7685,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs=yes ;; @@ -8326,7 +8223,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -8389,11 +8286,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -9182,7 +9075,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6;} # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -9549,7 +9442,7 @@ echo "$as_me: creating $ofile" >&6;} SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -9631,7 +9524,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9665,7 +9558,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -10020,20 +9913,6 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -10055,16 +9934,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -10534,7 +10404,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -10552,11 +10422,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi dgux*) case $cc_basename in - ec++*) + ec++) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - ghcx*) + ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10591,11 +10461,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # location of the library. case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC*) + aCC) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -10656,11 +10526,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC*) + aCC) case "$host_cpu" in hppa*64*|ia64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -10700,9 +10570,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; irix5* | irix6*) case $cc_basename in - CC*) + CC) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -10713,7 +10583,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -10726,7 +10596,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; linux*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10751,7 +10621,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc*) + icpc) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -10776,16 +10646,15 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC) # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx*) + cxx) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -10816,7 +10685,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; mvs*) case $cc_basename in - cxx*) + cxx) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10855,7 +10724,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf3*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10871,14 +10740,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx*) + cxx) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10896,7 +10765,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10915,7 +10784,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf4* | osf5*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10930,17 +10799,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx*) + cxx) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -10959,7 +10828,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10983,7 +10852,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi sco*) archive_cmds_need_lc_CXX=no case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10995,12 +10864,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - lcc*) + lcc) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11013,7 +10882,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -11027,13 +10896,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -11054,7 +10919,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; - gcx*) + gcx) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -11097,7 +10962,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11306,7 +11171,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; chorus*) case $cc_basename in - cxch68*) + cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -11315,7 +11180,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' @@ -11324,10 +11189,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; dgux*) case $cc_basename in - ec++*) + ec++) lt_prog_compiler_pic_CXX='-KPIC' ;; - ghcx*) + ghcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; @@ -11340,14 +11205,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC*) + CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; - aCC*) + aCC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -11365,7 +11230,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC*) + CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. @@ -11376,7 +11241,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) case $cc_basename in - KCC*) + KCC) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' @@ -11387,13 +11252,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; - pgCC*) + pgCC) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-static' ;; - cxx*) + cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -11410,7 +11275,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; mvs*) case $cc_basename in - cxx*) + cxx) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) @@ -11421,14 +11286,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC*) + KCC) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; - RCC*) + RCC) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; - cxx*) + cxx) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -11444,7 +11309,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sco*) case $cc_basename in - CC*) + CC) lt_prog_compiler_pic_CXX='-fPIC' ;; *) @@ -11453,13 +11318,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; - gcx*) + gcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; @@ -11469,12 +11334,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; - lcc*) + lcc) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; @@ -11484,7 +11349,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; @@ -11528,17 +11393,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11531: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11396: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11535: \$? = $ac_status" >&5 + echo "$as_me:11400: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_CXX=yes fi fi @@ -11590,18 +11453,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11593: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11456: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11597: \$? = $ac_status" >&5 + echo "$as_me:11460: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_CXX=yes fi fi @@ -12103,7 +11964,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -12166,11 +12027,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -12959,7 +12816,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 @@ -13688,9 +13522,7 @@ aix3*) fi ;; aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi + test "$enable_shared" = yes && enable_static=no ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 @@ -13796,7 +13628,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' @@ -13844,7 +13676,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' @@ -13871,14 +13703,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_F77='-Qoption ld ';; - *) - lt_prog_compiler_wl_F77='-Wl,';; - esac ;; sunos4*) @@ -13942,17 +13769,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13945: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13772: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13949: \$? = $ac_status" >&5 + echo "$as_me:13776: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_F77=yes fi fi @@ -14004,18 +13829,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14007: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13832: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14011: \$? = $ac_status" >&5 + echo "$as_me:13836: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_F77=yes fi fi @@ -14095,16 +13918,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -14125,27 +13938,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -14214,37 +14006,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_F77=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -14283,6 +14044,41 @@ EOF hardcode_shlibpath_var_F77=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_F77=$archive_cmds_F77 + fi + else + ld_shlibs_F77=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -14293,11 +14089,16 @@ EOF ;; esac - if test "$ld_shlibs_F77" = no; then - runpath_var= - hardcode_libdir_flag_spec_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= + if test "$ld_shlibs_F77" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -14584,7 +14385,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -14787,7 +14588,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' @@ -14806,12 +14607,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -14820,18 +14619,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_F77=yes ;; @@ -15368,7 +15157,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -15431,11 +15220,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15634,7 +15419,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -15783,7 +15568,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -15817,7 +15602,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -16066,41 +15851,15 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no -old_archive_cmds_GCJ=$old_archive_cmds - lt_prog_compiler_no_builtin_flag_GCJ= @@ -16126,17 +15885,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16129: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15888: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16133: \$? = $ac_status" >&5 + echo "$as_me:15892: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -16242,7 +15999,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' @@ -16290,7 +16047,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16317,14 +16074,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_GCJ='-Qoption ld ';; - *) - lt_prog_compiler_wl_GCJ='-Wl,';; - esac ;; sunos4*) @@ -16388,17 +16140,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16391: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16143: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16395: \$? = $ac_status" >&5 + echo "$as_me:16147: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_GCJ=yes fi fi @@ -16450,18 +16200,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16453: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16203: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16457: \$? = $ac_status" >&5 + echo "$as_me:16207: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi @@ -16541,16 +16289,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -16571,27 +16309,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -16660,37 +16377,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_GCJ=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -16729,6 +16415,41 @@ EOF hardcode_shlibpath_var_GCJ=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_GCJ=$archive_cmds_GCJ + fi + else + ld_shlibs_GCJ=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -16739,11 +16460,16 @@ EOF ;; esac - if test "$ld_shlibs_GCJ" = no; then - runpath_var= - hardcode_libdir_flag_spec_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= + if test "$ld_shlibs_GCJ" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -17050,7 +16776,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -17253,7 +16979,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' @@ -17272,12 +16998,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -17286,18 +17010,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_GCJ=yes ;; @@ -17834,7 +17548,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -17897,11 +17611,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -18690,7 +18400,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the @@ -19380,7 +19066,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -19529,7 +19215,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -19563,7 +19249,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -20213,11 +19899,11 @@ if test "$enable_gnome_vfs" != "no"; then export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" fi + succeeded=no -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then @@ -20242,6 +19928,7 @@ do done done + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -20255,123 +19942,56 @@ else echo "${ECHO_T}no" >&6 fi -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 fi -done -done - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 +echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 -if test -n "$ac_pt_PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 -echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - PKG_CONFIG=$ac_pt_PKG_CONFIG -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 -echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - echo "$as_me:$LINENO: result: yes" >&5 + if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - PKG_CONFIG="" - fi + succeeded=yes -fi + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 -pkg_failed=no -echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 -if test "${pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set" = "xset"; then - pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&6 -echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 -if test "${pkg_cv_LIBNTFS_GNOMEVFS_LIBS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set" = "xset"; then - pkg_cv_LIBNTFS_GNOMEVFS_LIBS=$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&6 + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 + else + LIBNTFS_GNOMEVFS_CFLAGS="" + LIBNTFS_GNOMEVFS_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` -if test $pkg_failed = yes; then - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - # Put the nasty error message in config.log where it belongs - echo "$LIBNTFS_GNOMEVFS_PKG_ERRORS" 1>&5 + fi + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + compile_gnome_vfs=true + else + if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} @@ -20381,22 +20001,8 @@ echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi -elif test $pkg_failed = untried; then + fi - if test "$enable_gnome_vfs" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - fi - -else - LIBNTFS_GNOMEVFS_CFLAGS=$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS - LIBNTFS_GNOMEVFS_LIBS=$pkg_cv_LIBNTFS_GNOMEVFS_LIBS - compile_gnome_vfs=true -fi fi @@ -20413,59 +20019,98 @@ fi compile_fuse_module=false if test "$enable_fuse_module" != "no"; then -pkg_failed=no -echo "$as_me:$LINENO: checking for FUSE_MODULE_CFLAGS" >&5 -echo $ECHO_N "checking for FUSE_MODULE_CFLAGS... $ECHO_C" >&6 -if test "${pkg_cv_FUSE_MODULE_CFLAGS+set}" = set; then + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "x$ac_cv_env_FUSE_MODULE_CFLAGS_set" = "xset"; then - pkg_cv_FUSE_MODULE_CFLAGS=$ac_cv_env_FUSE_MODULE_CFLAGS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_CFLAGS" >&5 -echo "${ECHO_T}$pkg_cv_FUSE_MODULE_CFLAGS" >&6 -echo "$as_me:$LINENO: checking for FUSE_MODULE_LIBS" >&5 -echo $ECHO_N "checking for FUSE_MODULE_LIBS... $ECHO_C" >&6 -if test "${pkg_cv_FUSE_MODULE_LIBS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_FUSE_MODULE_LIBS_set" = "xset"; then - pkg_cv_FUSE_MODULE_LIBS=$ac_cv_env_FUSE_MODULE_LIBS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_LIBS" >&5 -echo "${ECHO_T}$pkg_cv_FUSE_MODULE_LIBS" >&6 + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -if test $pkg_failed = yes; then - FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` - # Put the nasty error message in config.log where it belongs - echo "$FUSE_MODULE_PKG_ERRORS" 1>&5 + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for fuse >= 2.3.0" >&5 +echo $ECHO_N "checking for fuse >= 2.3.0... $ECHO_C" >&6 + + if $PKG_CONFIG --exists "fuse >= 2.3.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + succeeded=yes + + echo "$as_me:$LINENO: checking FUSE_MODULE_CFLAGS" >&5 +echo $ECHO_N "checking FUSE_MODULE_CFLAGS... $ECHO_C" >&6 + FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0"` + echo "$as_me:$LINENO: result: $FUSE_MODULE_CFLAGS" >&5 +echo "${ECHO_T}$FUSE_MODULE_CFLAGS" >&6 + + echo "$as_me:$LINENO: checking FUSE_MODULE_LIBS" >&5 +echo $ECHO_N "checking FUSE_MODULE_LIBS... $ECHO_C" >&6 + FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0"` + echo "$as_me:$LINENO: result: $FUSE_MODULE_LIBS" >&5 +echo "${ECHO_T}$FUSE_MODULE_LIBS" >&6 + else + FUSE_MODULE_CFLAGS="" + FUSE_MODULE_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` + + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + compile_fuse_module=true + else if test "$enable_fuse_module" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 @@ -20476,22 +20121,8 @@ echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2 echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} fi -elif test $pkg_failed = untried; then + fi - if test "$enable_fuse_module" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 -echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 -echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} - fi - -else - FUSE_MODULE_CFLAGS=$pkg_cv_FUSE_MODULE_CFLAGS - FUSE_MODULE_LIBS=$pkg_cv_FUSE_MODULE_LIBS - compile_fuse_module=true -fi fi @@ -24302,7 +23933,6 @@ s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t -s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t diff --git a/doc/Makefile.in b/doc/Makefile.in index e9a42652..ab7029cb 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -119,7 +119,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/Makefile.in b/include/Makefile.in index 2202b27d..dbaff49f 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -128,7 +128,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 2c384c38..96473220 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -132,7 +132,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 37bab1b3..3b73331f 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -194,7 +194,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/ltmain.sh b/ltmain.sh index eecedf23..3d071010 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -17,7 +17,7 @@ # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,8 +43,8 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.18 -TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)" +VERSION=1.5.14 +TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. @@ -112,9 +112,8 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" +: ${IFS=" +"} if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -251,14 +250,37 @@ func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" + f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else - $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 - exit $EXIT_FAILURE + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ + | $EGREP -v '^[ ]*1[ ]' | while read count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? + i=`expr $i + 1` + done + done + $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" fi } @@ -735,15 +757,6 @@ if test -z "$show_help"; then esac done - qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` - case $qlibobj in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qlibobj="\"$qlibobj\"" ;; - esac - if test "X$libobj" != "X$qlibobj"; then - $echo "$modename: libobj name \`$libobj' may not contain shell special characters." - exit $EXIT_FAILURE - fi objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -816,17 +829,12 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo "$srcfile" > "$lockfile" + $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi - qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` - case $qsrcfile in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qsrcfile="\"$qsrcfile\"" ;; - esac $run $rm "$libobj" "${libobj}T" @@ -848,10 +856,10 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" + command="$base_compile $srcfile $pic_flag" else # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $srcfile" fi if test ! -d "${xdir}$objdir"; then @@ -931,9 +939,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $srcfile" else - command="$base_compile $qsrcfile $pic_flag" + command="$base_compile $srcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -1357,8 +1365,6 @@ EOF ;; darwin_framework) compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" prev= continue ;; @@ -1423,8 +1429,6 @@ EOF -framework) prev=darwin_framework compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" continue ;; @@ -2848,13 +2852,13 @@ EOF *) continue ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac done fi # link_all_deplibs != no fi # linkmode = lib @@ -3120,7 +3124,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3129,7 +3133,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3138,7 +3142,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -5087,63 +5091,6 @@ fi\ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "copying selected object files to avoid basename conflicts..." - - if test -z "$gentop"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - fi - - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - counter=`expr $counter + 1` - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - $run ln "$obj" "$gentop/$newobj" || - $run cp "$obj" "$gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5157,7 +5104,20 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -6066,14 +6026,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" + exec_cmd="\"\$cmd\"$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - $echo "$cmd$args" + eval \$echo \"\$cmd\"$args exit $EXIT_SUCCESS fi ;; diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index e0510b1d..8fac195a 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -15,7 +15,7 @@ bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone \ ntfscp EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove \ - ntfsrm ntfsmftalloc + ntfsrm ntfsmftalloc ntfsdecrypt man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ @@ -87,6 +87,10 @@ endif # We don't distribute these +ntfsdecrypt_SOURCES = ntfsdecrypt.c decrypt.c decrypt.h utils.c utils.h +ntfsdecrypt_LDADD = $(AM_LIBS) +ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt + ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h ntfsrm_LDADD = $(AM_LIBS) ntfsrm_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index d3c02042..d34ddafc 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -14,7 +14,7 @@ @SET_MAKE@ -SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmftalloc_SOURCES) $(ntfsmount_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) +SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) $(ntfsdecrypt_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmftalloc_SOURCES) $(ntfsmount_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -46,7 +46,7 @@ sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ ntfscp$(EXEEXT) EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) ntfswipe$(EXEEXT) \ ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) ntfsrm$(EXEEXT) \ - ntfsmftalloc$(EXEEXT) + ntfsmftalloc$(EXEEXT) ntfsdecrypt$(EXEEXT) @ENABLE_FUSE_MODULE_TRUE@am__append_1 = ntfsmount subdir = ntfsprogs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ @@ -93,6 +93,10 @@ ntfscluster_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfscp_OBJECTS = ntfscp.$(OBJEXT) utils.$(OBJEXT) ntfscp_OBJECTS = $(am_ntfscp_OBJECTS) ntfscp_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_ntfsdecrypt_OBJECTS = ntfsdecrypt.$(OBJEXT) decrypt.$(OBJEXT) \ + utils.$(OBJEXT) +ntfsdecrypt_OBJECTS = $(am_ntfsdecrypt_OBJECTS) +ntfsdecrypt_DEPENDENCIES = $(am__DEPENDENCIES_1) am_ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) ntfsdump_logfile_OBJECTS = $(am_ntfsdump_logfile_OBJECTS) ntfsdump_logfile_DEPENDENCIES = $(am__DEPENDENCIES_1) @@ -150,18 +154,19 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ CCLD = $(CC) SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) \ $(ntfscluster_SOURCES) $(ntfscp_SOURCES) \ - $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ - $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ - $(ntfsmftalloc_SOURCES) $(ntfsmount_SOURCES) \ + $(ntfsdecrypt_SOURCES) $(ntfsdump_logfile_SOURCES) \ + $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) \ + $(ntfsls_SOURCES) $(ntfsmftalloc_SOURCES) $(ntfsmount_SOURCES) \ $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ $(ntfswipe_SOURCES) DIST_SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) \ - $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \ - $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \ - $(ntfsmftalloc_SOURCES) $(am__ntfsmount_SOURCES_DIST) \ - $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ + $(ntfsdecrypt_SOURCES) $(ntfsdump_logfile_SOURCES) \ + $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) \ + $(ntfsls_SOURCES) $(ntfsmftalloc_SOURCES) \ + $(am__ntfsmount_SOURCES_DIST) $(ntfsmove_SOURCES) \ + $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ $(ntfswipe_SOURCES) man8dir = $(mandir)/man8 @@ -241,7 +246,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ @@ -344,6 +348,9 @@ ntfscp_LDFLAGS = $(AM_LFLAGS) @ENABLE_FUSE_MODULE_TRUE@ntfsmount_CFLAGS = $(FUSE_MODULE_CFLAGS) -DFUSE_USE_VERSION=22 # We don't distribute these +ntfsdecrypt_SOURCES = ntfsdecrypt.c decrypt.c decrypt.h utils.c utils.h +ntfsdecrypt_LDADD = $(AM_LIBS) +ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h ntfsrm_LDADD = $(AM_LIBS) ntfsrm_LDFLAGS = $(AM_LFLAGS) @@ -492,6 +499,9 @@ ntfscluster$(EXEEXT): $(ntfscluster_OBJECTS) $(ntfscluster_DEPENDENCIES) ntfscp$(EXEEXT): $(ntfscp_OBJECTS) $(ntfscp_DEPENDENCIES) @rm -f ntfscp$(EXEEXT) $(LINK) $(ntfscp_LDFLAGS) $(ntfscp_OBJECTS) $(ntfscp_LDADD) $(LIBS) +ntfsdecrypt$(EXEEXT): $(ntfsdecrypt_OBJECTS) $(ntfsdecrypt_DEPENDENCIES) + @rm -f ntfsdecrypt$(EXEEXT) + $(LINK) $(ntfsdecrypt_LDFLAGS) $(ntfsdecrypt_OBJECTS) $(ntfsdecrypt_LDADD) $(LIBS) ntfsdump_logfile$(EXEEXT): $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_DEPENDENCIES) @rm -f ntfsdump_logfile$(EXEEXT) $(LINK) $(ntfsdump_logfile_LDFLAGS) $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_LDADD) $(LIBS) @@ -541,11 +551,13 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attrdef.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boot.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cluster.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decrypt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkntfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsclone.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscluster.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsdecrypt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsdump_logfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsfix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsinfo.Po@am__quote@ diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c new file mode 100644 index 00000000..8fead17c --- /dev/null +++ b/ntfsprogs/decrypt.c @@ -0,0 +1,532 @@ +/* + * decrypt.c - Part of the Linux-NTFS project. + * + * Copyright (c) 2005 Yuval Fledel + * + * $EFS decryption routines. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS distribution + * in the file COPYING); if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include + +#include "decrypt.h" + +#ifdef __CYGWIN__ +//#define USE_CRYPTOAPI_RSA 1 +#define _WIN32_WINNT 0x501 +#define WINVER 0x501 + +#include +#include + +/* Missing cygwin macros */ +#ifndef CERT_SYSTEM_STORE_CURRENT_USER +#define CERT_SYSTEM_STORE_CURRENT_USER 0x00010000 +#endif + +#ifndef CERT_CLOSE_STORE_CHECK_FLAG +#define CERT_CLOSE_STORE_CHECK_FLAG 2 +#endif + +#ifndef CRYPT_ACQUIRE_CACHE_FLAG +#define CRYPT_ACQUIRE_CACHE_FLAG 1 +#endif + +/* windows 2k+ imports */ +typedef BOOL (WINAPI *LPFN_CryptAcquireCertificatePrivateKey) (PCCERT_CONTEXT, + DWORD, void *, HCRYPTPROV *, DWORD *, BOOL*); +typedef BOOL (WINAPI *LPFN_CertCloseStore) (HCERTSTORE, DWORD); +typedef PCCERT_CONTEXT (WINAPI *LPFN_CertFindCertificateInStore) (HCERTSTORE, + DWORD, DWORD, DWORD, const void*, PCCERT_CONTEXT); +typedef BOOL (WINAPI *LPFN_CertFreeCertificateContext) (PCCERT_CONTEXT); +typedef HCERTSTORE (WINAPI *LPFN_CertOpenStore) (LPCSTR, DWORD, HCRYPTPROV, + DWORD, const void*); + +// NT4SP3+ WINME or 95+ w/ IE5+ +static LPFN_CryptAcquireCertificatePrivateKey + fnCryptAcquireCertificatePrivateKey; +// osr2+ NT4SP3+ or NT4 w/ IE3.02: +static LPFN_CertCloseStore fnCertCloseStore; +static LPFN_CertFindCertificateInStore fnCertFindCertificateInStore; +static LPFN_CertFreeCertificateContext fnCertFreeCertificateContext; +static LPFN_CertOpenStore fnCertOpenStore; + +/* global variable: handle to crypt32.dll */ +static HMODULE hCrypt32 = INVALID_HANDLE_VALUE; + +#else /* defined(__CYGWIN__) */ + +#include +#include +#define CALG_DESX (0x6603) +#define CALG_3DES (0x6604) +#define CALG_AES_256 (0x6610) + +#endif /* defined(__CYGWIN__) */ + +typedef struct { +#ifdef __CYGWIN__ + HCERTSTORE hSystemStore; +#else + int nothing; /* unused */ +#endif /* defined(__CYGWIN__) */ +} DECRYPT_SESSION; + +typedef struct { + unsigned int gcry_algo; + char *key_data; + gcry_cipher_hd_t gcry_cipher_hd; // handle to the decrypted FEK. + gcry_sexp_t sexp_key; // the user's RSA key. +#ifdef USE_CRYPTOAPI_RSA + HCRYPTKEY hCryptKey; +#endif /* defined(__CYGWIN__) */ +} DECRYPT_KEY; + +#ifdef __CYGWIN__ + +static int cryptoAPI_init_imports(void) +{ + if (hCrypt32 == INVALID_HANDLE_VALUE) + hCrypt32 = LoadLibrary("crypt32.dll"); + + if (!fnCryptAcquireCertificatePrivateKey) + fnCryptAcquireCertificatePrivateKey = + (LPFN_CryptAcquireCertificatePrivateKey) + GetProcAddress(hCrypt32, + "CryptAcquireCertificatePrivateKey"); + if (!fnCertCloseStore) + fnCertCloseStore = (LPFN_CertCloseStore) + GetProcAddress(hCrypt32, "CertCloseStore"); + if (!fnCertFindCertificateInStore) + fnCertFindCertificateInStore = + (LPFN_CertFindCertificateInStore) + GetProcAddress(hCrypt32, "CertFindCertificateInStore"); + if (!fnCertFreeCertificateContext) + fnCertFreeCertificateContext = + (LPFN_CertFreeCertificateContext) + GetProcAddress(hCrypt32, "CertFreeCertificateContext"); + if (!fnCertOpenStore) + fnCertOpenStore = (LPFN_CertOpenStore) + GetProcAddress(hCrypt32, "CertOpenStore"); + + return fnCryptAcquireCertificatePrivateKey && fnCertCloseStore && + fnCertFindCertificateInStore && + fnCertFreeCertificateContext && fnCertOpenStore; +} +#endif /* defined(__CYGWIN__) */ + +decrypt_session *decrypt_open(void) { + decrypt_session *session; + + gcry_control(GCRYCTL_DISABLE_SECMEM, 0); + +#ifdef __CYGWIN__ + HCERTSTORE hSystemStore; + + if (!cryptoAPI_init_imports()) { + fprintf(stderr, "Some imports do not exist.\n"); + errno = -1; + return NULL; + } + + if (!(hSystemStore = fnCertOpenStore(((LPCSTR)CERT_STORE_PROV_SYSTEM), + 0, (HCRYPTPROV)NULL, CERT_SYSTEM_STORE_CURRENT_USER, + L"MY"))) { + fprintf(stderr, "Could not open system store.\n"); + errno = -1; + return NULL; + } +#endif /* defined(__CYGWIN__) */ + + session = (decrypt_session *)malloc(sizeof(DECRYPT_SESSION)); +#ifdef __CYGWIN__ + ((DECRYPT_SESSION *)session)->hSystemStore = hSystemStore; +#endif /* defined(__CYGWIN__) */ + return session; +} + +void decrypt_close(decrypt_session *session) { +#ifdef __CYGWIN__ + if (((DECRYPT_SESSION *)session)->hSystemStore) + fnCertCloseStore(((DECRYPT_SESSION *)session)->hSystemStore, + CERT_CLOSE_STORE_CHECK_FLAG); + /* fixme: racy */ + FreeLibrary(hCrypt32); + hCrypt32 = INVALID_HANDLE_VALUE; +#endif /* defined(__CYGWIN__) */ + + free(session); +} + +static inline void reverse_buffer(unsigned char *buf, unsigned int buf_size) { + unsigned char t; + unsigned int i; + + for (i=0; ihSystemStore, + (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING), + 0, CERT_FIND_HASH, &hash_blob, NULL))) { + fprintf(stderr, "Could not find cert in store.\n"); + goto decrypt_key_open_err; + } + + dwKeySpec = AT_KEYEXCHANGE; + if (!fnCryptAcquireCertificatePrivateKey(pCert, + CRYPT_ACQUIRE_CACHE_FLAG, NULL, + &hCryptProv, &dwKeySpec, + &fCallerFreeProv)) { + fprintf(stderr, "Could not aquire private key from cert.\n"); + goto decrypt_key_open_err; + } + + if (!CryptGetUserKey(hCryptProv, AT_KEYEXCHANGE, &hCryptKey)) { + fprintf(stderr, "Could not aquire user key.\n"); + goto decrypt_key_open_err; + } + + if (!CryptExportKey(hCryptKey, 0, PRIVATEKEYBLOB, 0, key_blob, &key_size)) { + fprintf(stderr, "Could not export key: Error 0x%x\n", + (unsigned int)GetLastError()); + errno = -1; + return NULL; + } + + if (!(key = (decrypt_key *)malloc(sizeof(DECRYPT_KEY)))) + goto decrypt_key_open_err; + +#ifdef USE_CRYPTOAPI_RSA + ((DECRYPT_KEY *)key)->hCryptKey = hCryptKey; +#else + RSAPUBKEY *rsa_pub_key = (RSAPUBKEY *)(key_blob + sizeof(PUBLICKEYSTRUC)); + gcry_ac_handle_t gcry_handle; + unsigned char *mpi_data; + gcry_mpi_t n,e,d,p,q,u; + gcry_sexp_t sexp_key; + gcry_error_t err; + size_t size; + int rc; + + CryptDestroyKey(hCryptKey); + + if ((err = gcry_ac_open(&gcry_handle, GCRY_AC_RSA, 0))) { + fprintf(stderr, "Could not init gcrypt handle\n"); + errno = -1; + return NULL; + } + + e = gcry_mpi_set_ui(NULL, rsa_pub_key->pubexp); + + mpi_data = (key_blob + 0x14); + size = rsa_pub_key->bitlen / 8; + reverse_buffer(mpi_data, size); + if ((rc = gcry_mpi_scan(&n, GCRYMPI_FMT_USG, mpi_data, size, &size))) { + fprintf(stderr, "error scanning n.\n"); + } + + mpi_data += (rsa_pub_key->bitlen / 8); + size = rsa_pub_key->bitlen / 16; + reverse_buffer(mpi_data, size); + if ((rc = gcry_mpi_scan(&q, GCRYMPI_FMT_USG, mpi_data, size, &size))) { + fprintf(stderr, "error scanning p.\n"); + } + + mpi_data += (rsa_pub_key->bitlen / 16); + size = rsa_pub_key->bitlen / 16; + reverse_buffer(mpi_data, size); + if ((rc = gcry_mpi_scan(&p, GCRYMPI_FMT_USG, mpi_data, size, &size))) { + fprintf(stderr, "error scanning q.\n"); + } + + mpi_data += (rsa_pub_key->bitlen / 16)*3; + size = rsa_pub_key->bitlen / 16; + reverse_buffer(mpi_data, size); + if ((rc = gcry_mpi_scan(&u, GCRYMPI_FMT_USG, mpi_data, size, &size))) { + fprintf(stderr, "error scanning u.\n"); + } + + mpi_data += (rsa_pub_key->bitlen / 16); + size = rsa_pub_key->bitlen / 8; + reverse_buffer(mpi_data, size); + if ((rc = gcry_mpi_scan(&d, GCRYMPI_FMT_USG, mpi_data, size, &size))) { + fprintf(stderr, "error scanning d.\n"); + } + + if ((rc = gcry_sexp_build(&sexp_key, NULL, + "(private-key (rsa (n %m) (e %m) (d %m) (p %m) (q %m) (u %m)))", + n, e, d, p, q, u))) { + fprintf(stderr, "Could build sexp from data, (error = 0x%x)\n", rc); + errno = -1; + return FALSE; + } + + ((DECRYPT_KEY *)key)->sexp_key = sexp_key; + + // todo: release all +#endif + return key; + +decrypt_key_open_err: + + if (hCryptKey) + CryptDestroyKey(hCryptKey); + if (pCert) + fnCertFreeCertificateContext(pCert); +#endif // defined(__CYGWIN__) + errno = ENOTSUP; + return NULL; +} + +void decrypt_user_key_close(decrypt_key *key) { + DECRYPT_KEY *dkey = (DECRYPT_KEY *)key; + if (dkey->gcry_cipher_hd) + gcry_cipher_close(dkey->gcry_cipher_hd); + + free(key); +} + +/** + * decrypt_decrypt + * + * warning: decrypting into the input buffer! + */ +unsigned int decrypt_decrypt(decrypt_key *key, unsigned int data_size, + unsigned char *data) +{ +#ifdef USE_CRYPTOAPI_RSA + DWORD size = data_size; + + if (!CryptDecrypt(((DECRYPT_KEY *)key)->hCryptKey, 0, + TRUE, 0, data, &size)) { + errno = -1; + return 0; + } + + return size; +#else + gcry_sexp_t sexp_plain_data, sexp_enc_data; + gcry_ac_handle_t gcry_handle; + gcry_mpi_t mpi_buf; + gcry_ac_data_t in; + gcry_error_t err; + unsigned int size, padding_length, i; + int rc; + + if ((err = gcry_ac_open(&gcry_handle, GCRY_AC_RSA, 0))) { + fprintf(stderr, "Could not init gcrypt handle\n"); + errno = -1; + return FALSE; + } + + if ((rc = gcry_ac_data_new(&in))) { + fprintf(stderr, "error allocating 'in'.\n"); + } + + reverse_buffer(data, data_size); + + size = data_size; + if ((rc = gcry_mpi_scan(&mpi_buf, GCRYMPI_FMT_USG, data, (size_t)data_size, &size))) { + fprintf(stderr, "error scanning 'in'.\n"); + } + + if ((rc = gcry_sexp_build(&sexp_enc_data, &size, "(enc-val (flags) (rsa (a %m)))", mpi_buf))) { + fprintf(stderr, "Could build sexp from data, (error = 0x%x)\n", rc); + errno = -1; + return FALSE; + } + + if ((rc = gcry_pk_decrypt(&sexp_plain_data, sexp_enc_data, ((DECRYPT_KEY *)key)->sexp_key))) { + fprintf(stderr, "Could not decrypt fek via s-exp, (error = 0x%x)\n", rc); + errno = -1; + return FALSE; + } + + sexp_plain_data = gcry_sexp_find_token(sexp_plain_data, "value", 0); + if (!mpi_buf) { + fprintf(stderr, "Could find value in s-exp, (error = 0x%x)\n", rc); + errno = -1; + return FALSE; + } + + mpi_buf = gcry_sexp_nth_mpi(sexp_plain_data, 1, GCRYMPI_FMT_USG); + + if ((rc = gcry_mpi_print(GCRYMPI_FMT_USG, data, data_size, &size, mpi_buf))) { + fprintf(stderr, "Could copy decrypted data back, (error = 0x%x)\n", rc); + errno = -1; + return FALSE; + } + + // remove the pkcs1 padding + for (padding_length = 1;(padding_lengthdata + // todo: release all + gcry_ac_data_destroy(in); + + return size - padding_length; +#endif // USER_CRYPTOAPI_RSA (else) +} + +unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, + unsigned long long offset) { + gcry_error_t gcry_error2; + DECRYPT_KEY *dkey = (DECRYPT_KEY *)key; + + if ((gcry_error2 = gcry_cipher_reset(dkey->gcry_cipher_hd))) { + fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); + } + + if (dkey->gcry_algo == GCRY_CIPHER_DES_SK) { + /* CALG_DESX */ + fprintf(stderr, "DESX is not supported yet.\n"); + errno = -1; + return 0; + } else { + if ((gcry_error2 = gcry_cipher_decrypt(dkey->gcry_cipher_hd, + data, 512, NULL, 0))) { + fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); + } + } + + switch (dkey->gcry_algo) { + case GCRY_CIPHER_DES_SK: + // don't know! + case GCRY_CIPHER_3DES: + ((unsigned long long *)data)[0] ^= + 0x169119629891ad13LL + offset; + break; + case GCRY_CIPHER_AES256: + ((unsigned long long *)data)[0] ^= + 0x5816657be9161312LL + offset; + ((unsigned long long *)data)[1] ^= + 0x1989adbe44918961LL + offset; + break; + default: + break; + } + + return 512; +} + +static decrypt_key *decrypt_make_gcry_key(char *key_data, int gcry_algo) { + int gcry_mode, gcry_length; + gcry_error_t gcry_error2; + DECRYPT_KEY *key; + + if (!(key = (DECRYPT_KEY *)malloc(sizeof(DECRYPT_KEY)))) { + errno = -1; + return NULL; + } + + switch (gcry_algo) { + case GCRY_CIPHER_DES_SK: + gcry_mode = GCRY_CIPHER_MODE_ECB; + gcry_length = 8; + break; + case GCRY_CIPHER_3DES: + gcry_mode = GCRY_CIPHER_MODE_CBC; + gcry_length = 24; + break; + case GCRY_CIPHER_AES256: + gcry_mode = GCRY_CIPHER_MODE_CBC; + gcry_length = 32; + break; + default: + errno = ENOTSUP; + return 0; + } + + if ((gcry_error2 = gcry_cipher_open(&key->gcry_cipher_hd, gcry_algo, + gcry_mode, 0))!=GPG_ERR_NO_ERROR) { + errno = -1; + return 0; + } + + if ((gcry_error2 = gcry_cipher_setkey(key->gcry_cipher_hd, key_data, + gcry_length))) { + fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); + } + + key->gcry_algo = gcry_algo; + + return (decrypt_key *)key; +} + +decrypt_key *decrypt_make_key( + decrypt_session *session __attribute__((unused)), + unsigned int data_size __attribute__((unused)), + void *data) { + unsigned int key_size, alg_id; + char *key_data; + + key_size = *((unsigned int *)data); + alg_id = *(((unsigned int *)data) + 2); + key_data = (((char *)data) + 16); + + switch (alg_id) { + case CALG_DESX: + //fprintf(stderr, "DESX key of %u bytes\n", key_size); + fprintf(stderr, "DESX is not supported yet.\n"); + errno = ENOTSUP; + return 0; + case CALG_3DES: + //fprintf(stderr, "3DES Key of %u bytes\n", key_size); + return decrypt_make_gcry_key(key_data, + GCRY_CIPHER_3DES); + case CALG_AES_256: + //fprintf(stderr, "AES Key of %u bytes\n", key_size); + return decrypt_make_gcry_key(key_data, + GCRY_CIPHER_AES256); + default: + fprintf(stderr, "Error: Unknown algorithm: 0x%x\n", + (unsigned int)alg_id); + errno = ENOTSUP; + return NULL; + } + +} diff --git a/ntfsprogs/decrypt.h b/ntfsprogs/decrypt.h new file mode 100644 index 00000000..bfd5e94b --- /dev/null +++ b/ntfsprogs/decrypt.h @@ -0,0 +1,42 @@ +/* + * decrypt.h - interface for decryption rutines. + * Part of the Linux-NTFS project. + * + * Copyright (c) 2005 Yuval Fledel + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_DECRYPT_H +#define _NTFS_DECRYPT_H + +typedef void *decrypt_session; +typedef void *decrypt_key; + +extern decrypt_session *decrypt_open(void); +extern void decrypt_close(decrypt_session *session); +extern decrypt_key *decrypt_user_key_open(decrypt_session *session, + int thumb_size, void *thumb_print); +extern void decrypt_user_key_close(decrypt_key *key); +extern unsigned int decrypt_decrypt(decrypt_key *key, unsigned int data_size, + unsigned char *data); +extern unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, + unsigned long long offset); +extern decrypt_key *decrypt_make_key(decrypt_session *session, + unsigned int data_size, void *data); +extern int decrypt_get_block_size(decrypt_key *key); + +#endif /* defined _NTFS_DECRYPT_H */ diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c new file mode 100644 index 00000000..f4352220 --- /dev/null +++ b/ntfsprogs/ntfsdecrypt.c @@ -0,0 +1,415 @@ +/** + * ntfsdecrypt - Part of the Linux-NTFS project. + * + * Copyright (c) 2003 Richard Russon + * Copyright (c) 2003 Anton Altaparmakov + * Copyright (c) 2005 Yuval Fledel + * + * This utility will decrypt files and print on the standard output. + * + * 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 of the License, 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include + +#include "types.h" +#include "attrib.h" +#include "utils.h" +#include "volume.h" +#include "debug.h" +#include "dir.h" +#include "layout.h" +#include "decrypt.h" + +struct options { + char *device; /* Device/File to work with */ + char *file; /* File to display */ + s64 inode; /* Inode to work with */ + ATTR_TYPES attr; /* Attribute type to display */ + int force; /* Override common sense */ + int quiet; /* Less output */ + int verbose; /* Extra output */ +}; + +static const char *EXEC_NAME = "ntfscat"; +static struct options opts; + +GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) +GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) +static GEN_PRINTF (Printf, stderr, NULL, FALSE) + +static const wchar_t *efs_name = L"$EFS"; +static const int efs_name_length = 4; + +/** + * version - Print version information about the program + * + * Print a copyright statement and a brief description of the program. + * + * Return: none + */ +static void version (void) +{ + Printf ("\n%s v%s - Concatenate files and print on the standard output.\n\n", + EXEC_NAME, VERSION); + Printf ("Copyright (c) 2003 Richard Russon\n"); + Printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +static void usage (void) +{ + Printf ("\nUsage: %s [options] device [file]\n\n" + " -a, --attribute num Display this attribute\n" + " -i, --inode num Display this inode\n\n" + " -f --force Use less caution\n" + " -h --help Print this help\n" + " -q --quiet Less output\n" + " -V --version Version information\n" + " -v --verbose More output\n\n", + //" -N --name Display this attribute name", + //" -F --file Display this file", + //" -r --raw Display the compressed or encrypted file", + EXEC_NAME); + Printf ("%s%s\n", ntfs_bugs, ntfs_home); +} + +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +static int parse_options (int argc, char **argv) +{ + static const char *sopt = "-a:fh?i:qVv"; // F:N: + static const struct option lopt[] = { + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "inode", required_argument, NULL, 'i' }, + { "quiet", no_argument, NULL, 'q' }, + { "version", no_argument, NULL, 'V' }, + { "verbose", no_argument, NULL, 'v' }, + // { "file", required_argument, NULL, 'F' }, + // { "name", required_argument, NULL, 'N' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + int err = 0; + int ver = 0; + int help = 0; + + opterr = 0; /* We'll handle the errors, thank you. */ + + opts.inode = -1; + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.device) { + opts.device = argv[optind-1]; + } else if (!opts.file) { + opts.file = argv[optind-1]; + } else { + Eprintf("You must specify exactly one file.\n"); + err++; + } + break; + case 'f': + opts.force++; + break; + case 'h': + case '?': + help++; + break; + case 'i': + if (opts.inode != -1) + Eprintf("You must specify exactly one inode.\n"); + else if (utils_parse_size(optarg, &opts.inode, FALSE)) + break; + else + Eprintf("Couldn't parse inode number.\n"); + err++; + break; + case 'q': + opts.quiet++; + break; + case 'V': + ver++; + break; + case 'v': + opts.verbose++; + break; + default: + Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + err++; + break; + } + } + + if (help || ver) { + opts.quiet = 0; + } else { + if (opts.device == NULL) { + Eprintf ("You must specify a device.\n"); + err++; + + } else if (opts.file == NULL && opts.inode == -1) { + Eprintf ("You must specify a file or inode " + "with the -i option.\n"); + err++; + + } else if (opts.file != NULL && opts.inode != -1) { + Eprintf ("You can't specify both a file and inode.\n"); + err++; + } + + if (opts.quiet && opts.verbose) { + Eprintf("You may not use --quiet and --verbose at the " + "same time.\n"); + err++; + } + } + + if (ver) + version(); + if (help || err) + usage(); + + return (!err && !help && !ver); +} + +/** + * cat + */ +static int cat_decrypt(ntfs_inode *inode, decrypt_key *fek) +{ + int bufsize = 512; + char *buffer; + ntfs_attr *attr; + s64 bytes_read, written, offset, total; + unsigned int i; + + buffer = malloc (bufsize); + if (!buffer) + return 1; + + attr = ntfs_attr_open (inode, AT_DATA, NULL, 0); + if (!attr) { + Eprintf ("Cannot cat a directory.\n"); + free (buffer); + return 1; + } + + total = attr->data_size; + + // hack: make sure attr will not be commited to disk if you use this. + // clear the encrypted bit, otherwise the library won't allow reading. + NAttrClearEncrypted(attr); + // extend the size, we may need to read past the end of the stream. + attr->data_size = attr->initialized_size = attr->allocated_size; + + offset = 0; + while (total>0) { + bytes_read = ntfs_attr_pread (attr, offset, 512, buffer); + if (bytes_read == -1) { + perror ("ERROR: Couldn't read file"); + break; + } + if (!bytes_read) + break; + + if ((i = decrypt_decrypt_sector(fek, buffer, offset)) + < bytes_read) { + perror ("ERROR: Couldn't decrypt all data!"); + Eprintf("%u/%lld/%lld/%lld\n", i, (long long)bytes_read, + (long long)offset, (long long)total); + break; + } + if (bytes_read > total) + bytes_read = total; + + written = fwrite (buffer, 1, bytes_read, stdout); + if (written != bytes_read) { + perror ("ERROR: Couldn't output all data!"); + break; + } + offset += bytes_read; + total -= bytes_read; + } + + ntfs_attr_close (attr); + free (buffer); + return 0; +} + +/** + * get_fek + */ +static decrypt_key *get_fek (ntfs_inode *inode) +{ + ntfs_attr *na; + char *efs_buffer, *ddf, *certificate, *hash_data, *fek_buf; + u32 ddf_count, hash_size, fek_size; + unsigned int i; + decrypt_session *session; + decrypt_key *key; + + /* obtain the $EFS contents */ + na = ntfs_attr_open (inode, AT_LOGGED_UTILITY_STREAM, + efs_name, efs_name_length); + if (!na) { + perror("Error"); + return NULL; + } + + efs_buffer = malloc(na->data_size); + if (!efs_buffer) { + perror("malloc failed"); + return NULL; + } + + if (ntfs_attr_pread(na, 0, na->data_size, efs_buffer) != + na->data_size) { + perror("ntfs_attr_pread failed"); + free(efs_buffer); + return NULL; + } + ntfs_attr_close(na); + + /* init the CryptoAPI */ + if(!(session = decrypt_open())) { + perror("Could not init the cryptoAPI."); + return NULL; + } + + /* iterate through the DDFs & DRFs until you obtain a key */ + + ddf = efs_buffer + le32_to_cpu(*(u32 *)(efs_buffer+0x40)); + ddf_count = le32_to_cpu(*(u32 *)ddf); + + ddf = ddf + 0x04; + for (i=0;i Date: Sat, 16 Jul 2005 07:00:57 +0000 Subject: [PATCH 2357/2994] Make ntfsdecrypt compile under Linux. --- ntfsprogs/decrypt.c | 2 ++ ntfsprogs/ntfsdecrypt.c | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 8fead17c..d9bd31da 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -29,6 +29,8 @@ #include "decrypt.h" +#include "types.h" + #ifdef __CYGWIN__ //#define USE_CRYPTOAPI_RSA 1 #define _WIN32_WINNT 0x501 diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index f4352220..8d952509 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -57,8 +57,10 @@ GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) static GEN_PRINTF (Printf, stderr, NULL, FALSE) -static const wchar_t *efs_name = L"$EFS"; -static const int efs_name_length = 4; +static ntfschar EFS[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('E'), + const_cpu_to_le16('F'), const_cpu_to_le16('S'), + const_cpu_to_le16('\0') }; +static const int EFS_name_length = 4; /** * version - Print version information about the program @@ -286,7 +288,7 @@ static decrypt_key *get_fek (ntfs_inode *inode) /* obtain the $EFS contents */ na = ntfs_attr_open (inode, AT_LOGGED_UTILITY_STREAM, - efs_name, efs_name_length); + EFS, EFS_name_length); if (!na) { perror("Error"); return NULL; @@ -386,7 +388,7 @@ int main (int argc, char *argv[]) if (opts.inode != -1) inode = ntfs_inode_open (vol, opts.inode); else - inode = utils_pathname_to_inode (vol, NULL, opts.file); + inode = ntfs_pathname_to_inode (vol, NULL, opts.file); if (!inode) { perror("ERROR: Couldn't open inode"); From d8b586c014c942cc7377ec848ce88393cf87730c Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 16 Jul 2005 18:19:17 +0000 Subject: [PATCH 2358/2994] Add ntfsdecrypt to .cvsignore. --- ntfsprogs/.cvsignore | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/.cvsignore b/ntfsprogs/.cvsignore index d3161032..118fb495 100644 --- a/ntfsprogs/.cvsignore +++ b/ntfsprogs/.cvsignore @@ -6,6 +6,7 @@ ntfscat ntfsclone ntfscluster ntfscp +ntfsdecrypt ntfsdump_logfile ntfsfix ntfsinfo From fc2382b7424189358459f2d87413edef698a2ea3 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 18 Jul 2005 02:09:43 +0000 Subject: [PATCH 2359/2994] libntfs/volume.c: fix ntfs_check_if_mounted to cope with dirrerent names of same file. ntfsprogs/ntfsmount.c: don't put relative path to /etc/mtab. --- ChangeLog | 1 + libntfs/volume.c | 36 ++++++++++++++++++++++++++++++++---- ntfsprogs/ntfsmount.c | 26 +++++++++++++++++++------- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 712100a7..710651b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,7 @@ xx/07/2005 - 1.11.0-WIP - Fixes and a new utility ntfsmount, a FUSE ntfsmodule. when sector size was less than 512 bytes and then we wrote 512 bytes, i.e. beyond the end of the device.) (Anton) - Add new utility (make extra) - ntfsdecrypt. (Yuval) + - Improve "already mounted" ckeck. (Yura) 20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. diff --git a/libntfs/volume.c b/libntfs/volume.c index 4412f749..7f8e0a39 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1246,16 +1246,35 @@ int ntfs_umount(ntfs_volume *vol, static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) { struct mntent *mnt; + char *real_file = NULL, *real_fsname = NULL; FILE *f; + int err = 0; - if (!(f = setmntent(MOUNTED, "r"))) + real_file = malloc(PATH_MAX + 1); + if (!real_file) return -1; - while ((mnt = getmntent(f))) - if (!strcmp(file, mnt->mnt_fsname)) + real_fsname = malloc(PATH_MAX + 1); + if (!real_fsname) { + err = errno; + goto exit; + } + if (!realpath(file, real_file)) { + err = errno; + goto exit; + } + if (!(f = setmntent(MOUNTED, "r"))) { + err = errno; + goto exit; + } + while ((mnt = getmntent(f))) { + if (!realpath(mnt->mnt_fsname, real_fsname)) + continue; + if (!strcmp(real_file, real_fsname)) break; + } endmntent(f); if (!mnt) - return 0; + goto exit; *mnt_flags = NTFS_MF_MOUNTED; if (!strcmp(mnt->mnt_dir, "/")) *mnt_flags |= NTFS_MF_ISROOT; @@ -1263,6 +1282,15 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) if (hasmntopt(mnt, "ro") && !hasmntopt(mnt, "rw")) *mnt_flags |= NTFS_MF_READONLY; #endif +exit: + if (real_file) + free(real_file); + if (real_fsname) + free(real_fsname); + if (err) { + errno = err; + return -1; + } return 0; } #endif /* HAVE_MNTENT_H */ diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 363d7d82..659f6424 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -32,6 +32,7 @@ #include #include #include +#include #ifdef HAVE_SETXATTR #include @@ -905,12 +906,12 @@ static char *parse_options(char *options, char **device) *device = NULL; /* - * +3 for different in length of "fsname=..." and "dev=...". - * +1 for comma - * +1 for null-terminator. - * Total: +5 + * +3 for different in length of "fsname=..." and "dev=...". + * +1 for comma. + * +1 for null-terminator. + * +PATH_MAX for resolved by realpath() device name */ - ret = malloc(strlen(def_opts) + strlen(options) + 5); + ret = malloc(strlen(def_opts) + strlen(options) + 5 + PATH_MAX); if (!ret) { perror("malloc failed"); return NULL; @@ -929,8 +930,19 @@ static char *parse_options(char *options, char **device) Eprintf("dev option should have value.\n"); goto err_exit; } - *device = malloc(strlen(val) + 1); - strcpy(*device, val); + *device = malloc(PATH_MAX + 1); + if (!*device) + goto err_exit; + /* We don't want relative path in /etc/mtab. */ + if (val[0] != '/') { + if (!realpath(val, *device)) { + perror(""); + free(*device); + *device = NULL; + goto err_exit; + } + } else + strcpy(*device, val); } else if (!strcmp(opt, "ro")) { /* Read-only mount. */ if (val) { Eprintf("ro option should not have value.\n"); From 2fbe1a701cd4e8f8c2d74278928eebe2186f3ddb Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 18 Jul 2005 13:51:16 +0000 Subject: [PATCH 2360/2994] - Remove AC_FUNC_MALLOC and AC_FUNC_REALLOC from configure.ac as we do not provide replacement functions for them and they break cross compilation. (Christophe) - Update everything for 1.11.0 release. --- ChangeLog | 5 +- NEWS | 41 +- TODO.include | 4 - TODO.ntfsprogs | 4 - config.h.in | 14 - configure | 1146 +++++++++++++++--------------------------------- configure.ac | 6 +- 7 files changed, 356 insertions(+), 864 deletions(-) diff --git a/ChangeLog b/ChangeLog index 710651b2..d6cf9a10 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/07/2005 - 1.11.0-WIP - Fixes and a new utility ntfsmount, a FUSE ntfsmodule. +18/07/2005 - 1.11.0 - Fixes and a new utility ntfsmount, a FUSE ntfs module. - ntfscp: fix signal hanling: handle both SIGTERM and SIGINT, print correct message. (Yura) @@ -20,6 +20,9 @@ xx/07/2005 - 1.11.0-WIP - Fixes and a new utility ntfsmount, a FUSE ntfsmodule. i.e. beyond the end of the device.) (Anton) - Add new utility (make extra) - ntfsdecrypt. (Yuval) - Improve "already mounted" ckeck. (Yura) + - Remove AC_FUNC_MALLOC and AC_FUNC_REALLOC from configure.ac as we + do not provide replacement functions for them and they break cross + compilation. (Christophe) 20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. diff --git a/NEWS b/NEWS index 7065a20b..64202d35 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,11 @@ Current news ============ -Add new utility - ntfsmount. It's a FUSE module that rely on libntfs. So, -you need FUSE to compile it, xattr is also highly recommended. This module -support file overwrite changing it size and can read/write/add/remove -named data streams via "file:stream" interface and list them via -"ntfs.streams.list" extended attribute. (Yura Pakhuchiy) +Add new utility: ntfsmount. It is a FUSE module that uses on libntfs. So, +you need FUSE 2.3 to compile it. This module supports file overwrite including +changing the file size and can read/write/add/remove named data streams via +"file:stream" interface and list them via "ntfs.streams.list" extended +attribute (this only if xattr support is enabled). (Yura Pakhuchiy) Attribute resize code for normal and sparse files is completed. Thus, ntfscp should always successfully overwrite any normal or sparse file even if file @@ -31,37 +31,12 @@ this modifies the command line options a little as well as the returned output so applications using ntfsresize might need modifications before they will work with the updated ntfsresize. (Szakacsits Szabolcs) +Older news +========== + ntfsprogs now should ./configure and compile cleanly on SuSE as well as RedHat Linux. ntfsprogs ("make libs" only) now compiles on FreeBSD, NetBSD, Windows (Cygwin), and DOS (DJGPP). Thanks to Christophe Grenier for DOS and FreeBSD testing and fixes and to Lode Leroy for Windows testing and fixes. - - -Older news -========== - -Merged the NTFS Gnome VFS module by Jan Kratochvil. - -Added new utilities: ntfsclone by Szakacsits Szabolcs, ntfscluster by Richard -Russon, ntfsinfo by Matthew Fanto, ntfsls originally by Lode Leroy, modified -by Anton Altaparmakov, and ntfscat by Richard Russon. - -Library internal enhancements and API additions. Of particular note is the -device io abstraction layer and the addition of the win32 device operations. -(Note the win32 device operations are read only and incomplete but should -allow running of simple read-only ntfs utilities under Cygwin.) Thanks to -Lode Leroy for the win32 code. - -Renamed ntfstools to ntfsprogs everywhere. - -Added new utility ntfslabel by Matthew Fanto. See man 8 ntfslabel for details. - -Added new utility ntfsundelete by Richard Russon. See man 8 ntfsundelete for -more details. - -Added new utility ntfsresize by Szakacsits Szabolcs. See man 8 ntfsresize for -details. - -Gcc 2.96 or above is required to compile. diff --git a/TODO.include b/TODO.include index b9f133a9..d9185bc9 100644 --- a/TODO.include +++ b/TODO.include @@ -2,10 +2,6 @@ Finish layout.h: in particular, add: - more about EFS and the EFS attribute. -Add usnjrnl.h: - -- describe the $UsnJrnl on disk structures - Finish logfile.h: in particular, add: - more about the $LogFile on disk structures diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 25b5f811..cd4dde39 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -9,10 +9,6 @@ Thanks, ********** - mkntfs should be hard linked with mkfs.ntfs for the mkfs utility. -- We don't know what the real last sector is, thus we mark the volume dirty - and the subsequent chkdsk (which will happen on reboot into Windows - automatically) recreates the backup boot sector if the Linux kernel lied to - us about the number of sectors. - Got a report that creating a floppy with mkntfs failed. Difference between this floppy and the floppy created by the special tool found on the net was said to be that the bitmap is 256kib on the special floppy while mkntfs will diff --git a/config.h.in b/config.h.in index 12231c16..c2b2d4c8 100644 --- a/config.h.in +++ b/config.h.in @@ -63,10 +63,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_ENDIAN_H -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - /* Define to 1 if mbrtowc and mbstate_t are properly declared. */ #undef HAVE_MBRTOWC @@ -85,10 +81,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MNTENT_H -/* Define to 1 if your system has a GNU libc compatible `realloc' function, - and to 0 otherwise. */ -#undef HAVE_REALLOC - /* Define to 1 if you have the `regcomp' function. */ #undef HAVE_REGCOMP @@ -266,14 +258,8 @@ #undef inline #endif -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc - /* Define to `long' if does not define. */ #undef off_t -/* Define to rpl_realloc if the replacement function should be used. */ -#undef realloc - /* Define to `unsigned' if does not define. */ #undef size_t diff --git a/configure b/configure index 9460fce0..bfe6fc59 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.11.0-WIP. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.11.0. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.11.0-WIP' -PACKAGE_STRING='ntfsprogs 1.11.0-WIP' +PACKAGE_VERSION='1.11.0' +PACKAGE_STRING='ntfsprogs 1.11.0' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 EGREP ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -955,7 +955,7 @@ 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 ntfsprogs 1.11.0-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.11.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1022,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.11.0-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.11.0:";; esac cat <<\_ACEOF @@ -1170,7 +1170,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.11.0-WIP +ntfsprogs configure 1.11.0 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1184,7 +1184,7 @@ 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 ntfsprogs $as_me 1.11.0-WIP, which was +It was created by ntfsprogs $as_me 1.11.0, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1912,7 +1912,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.11.0-WIP' + VERSION='1.11.0' cat >>confdefs.h <<_ACEOF @@ -3300,6 +3300,307 @@ else 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 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 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 to if __STDC__ is defined, since + # 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#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 + ac_cpp_err=$ac_cpp_err$ac_c_werror_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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 + ac_cpp_err=$ac_cpp_err$ac_c_werror_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 +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 + + 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 to if __STDC__ is defined, since + # 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#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 + ac_cpp_err=$ac_cpp_err$ac_c_werror_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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 + ac_cpp_err=$ac_cpp_err$ac_c_werror_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 +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 + 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_pattern="Autoconf.*'x'" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +else + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +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 # incompatible versions: @@ -3500,21 +3801,6 @@ SED=$lt_cv_path_SED echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 -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 - 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - # Check whether --with-gnu-ld or --without-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then @@ -3880,7 +4166,6 @@ LTCC=${LTCC-"$CC"} # Allow CC to be a program name with arguments. compiler=$CC - # Check whether --enable-libtool-lock or --disable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then enableval="$enable_libtool_lock" @@ -3912,7 +4197,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3915 "configure"' > conftest.$ac_ext + echo '#line 4200 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -4074,241 +4359,6 @@ esac need_locks="$enable_libtool_lock" -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 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 to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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 - ac_cpp_err=$ac_cpp_err$ac_c_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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 - ac_cpp_err=$ac_cpp_err$ac_c_werror_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 -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 - - 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 to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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 - ac_cpp_err=$ac_cpp_err$ac_c_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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 - ac_cpp_err=$ac_cpp_err$ac_c_werror_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 -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 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 @@ -5491,7 +5541,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5494:" \ +echo "$as_me:5544:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6560,11 +6610,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6563: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6613: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6567: \$? = $ac_status" >&5 + echo "$as_me:6617: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6815,11 +6865,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6818: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6868: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6822: \$? = $ac_status" >&5 + echo "$as_me:6872: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6875,11 +6925,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6878: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6928: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6882: \$? = $ac_status" >&5 + echo "$as_me:6932: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9075,7 +9125,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:11446: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11400: \$? = $ac_status" >&5 + echo "$as_me:11450: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -11453,11 +11503,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11456: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11506: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11460: \$? = $ac_status" >&5 + echo "$as_me:11510: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12816,7 +12866,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13822: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13776: \$? = $ac_status" >&5 + echo "$as_me:13826: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13829,11 +13879,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13832: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13882: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13836: \$? = $ac_status" >&5 + echo "$as_me:13886: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15885,11 +15935,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15888: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15938: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15892: \$? = $ac_status" >&5 + echo "$as_me:15942: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -16140,11 +16190,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16143: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16193: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16147: \$? = $ac_status" >&5 + echo "$as_me:16197: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -16200,11 +16250,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16203: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16253: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16207: \$? = $ac_status" >&5 + echo "$as_me:16257: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18400,7 +18450,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 -echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 -if test "${ac_cv_prog_gcc_traditional+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -Autoconf TIOCGETP -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then - ac_cv_prog_gcc_traditional=yes -else - ac_cv_prog_gcc_traditional=no -fi -rm -f conftest* - - - if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -Autoconf TCGETA -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then - ac_cv_prog_gcc_traditional=yes -fi -rm -f conftest* - - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 -echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 - if test $ac_cv_prog_gcc_traditional = yes; then - CC="$CC -traditional" - fi -fi - - -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 -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 -/* 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 - ac_cpp_err=$ac_cpp_err$ac_c_werror_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:$ac_c_preproc_warn_flag 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 compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - 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: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## --------------------------------------------------- ## -## Report this to linux-ntfs-dev@lists.sourceforge.net ## -## --------------------------------------------------- ## -_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 "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 -echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6 -if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_malloc_0_nonnull=no -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if STDC_HEADERS || HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif - -int -main () -{ -exit (malloc (0) ? 0 : 1); - ; - return 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 - ac_cv_func_malloc_0_nonnull=yes -else - 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_func_malloc_0_nonnull=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 -echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6 -if test $ac_cv_func_malloc_0_nonnull = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 1 -_ACEOF - -else - cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 0 -_ACEOF - - case $LIBOBJS in - "malloc.$ac_objext" | \ - *" malloc.$ac_objext" | \ - "malloc.$ac_objext "* | \ - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; -esac - - -cat >>confdefs.h <<\_ACEOF -#define malloc rpl_malloc -_ACEOF - -fi - - - echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6 @@ -22233,237 +22002,6 @@ test $ac_cv_func_memcmp_working = no && case $LIBOBJS in esac - -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 -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 -/* 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 - ac_cpp_err=$ac_cpp_err$ac_c_werror_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:$ac_c_preproc_warn_flag 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 compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - 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: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## --------------------------------------------------- ## -## Report this to linux-ntfs-dev@lists.sourceforge.net ## -## --------------------------------------------------- ## -_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 "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5 -echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6 -if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_realloc_0_nonnull=no -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if STDC_HEADERS || HAVE_STDLIB_H -# include -#else -char *realloc (); -#endif - -int -main () -{ -exit (realloc (0, 0) ? 0 : 1); - ; - return 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 - ac_cv_func_realloc_0_nonnull=yes -else - 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_func_realloc_0_nonnull=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5 -echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6 -if test $ac_cv_func_realloc_0_nonnull = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_REALLOC 1 -_ACEOF - -else - cat >>confdefs.h <<\_ACEOF -#define HAVE_REALLOC 0 -_ACEOF - - case $LIBOBJS in - "realloc.$ac_objext" | \ - *" realloc.$ac_objext" | \ - "realloc.$ac_objext "* | \ - *" realloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;; -esac - - -cat >>confdefs.h <<\_ACEOF -#define realloc rpl_realloc -_ACEOF - -fi - - - echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6 if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then @@ -23579,7 +23117,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.11.0-WIP, which was +This file was extended by ntfsprogs $as_me 1.11.0, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23642,7 +23180,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.11.0-WIP +ntfsprogs config.status 1.11.0 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -23913,14 +23451,14 @@ 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,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t +s,@LN_S@,$LN_S,;t t s,@ECHO@,$ECHO,;t t s,@AR@,$AR,;t t s,@ac_ct_AR@,$ac_ct_AR,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@CPP@,$CPP,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t diff --git a/configure.ac b/configure.ac index 7f702fac..a3497909 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.11.0-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.11.0],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) @@ -107,6 +107,7 @@ esac # Checks for programs. AC_PROG_CC +AC_PROG_GCC_TRADITIONAL AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET @@ -233,11 +234,8 @@ AC_CHECK_MEMBERS([struct stat.st_rdev]) # Checks for library functions. AC_FUNC_GETMNTENT -AC_PROG_GCC_TRADITIONAL -AC_FUNC_MALLOC AC_FUNC_MBRTOWC AC_FUNC_MEMCMP -AC_FUNC_REALLOC AC_FUNC_STAT AC_FUNC_STRFTIME AC_FUNC_UTIME_NULL From f2ff3915a5730b6fddef5d91e44e6110b0e8a42f Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 18 Jul 2005 15:59:38 +0000 Subject: [PATCH 2361/2994] Update spec file for ntfsmount utility to be in separate rpm ntfsprogs-fuse. --- TODO.include | 4 ++++ ntfsprogs.spec.in | 24 ++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/TODO.include b/TODO.include index d9185bc9..c6a7b0dc 100644 --- a/TODO.include +++ b/TODO.include @@ -2,6 +2,10 @@ Finish layout.h: in particular, add: - more about EFS and the EFS attribute. +Add usnjrnl.h (copy from kernel driver): + +- describe the $UsnJrnl on disk structures + Finish logfile.h: in particular, add: - more about the $LogFile on disk structures diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index 36a3b0eb..0acaee67 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -37,6 +37,18 @@ This package contains the NTFS GNOME virtual filesystem (VFS) module which allows GNOME VFS clients to seamlessly utilize the NTFS library (libntfs). +%package fuse +Summary : NTFS FUSE module (ntfsmount) +Group : System Environment/Base +Requires : ntfsprogs = %{ver}-%{rel} +Requires : fuse >= 2.3.0 +%description fuse +This package contains the ntfsmount utility which is an NTFS filesystem in +userspace (FUSE) module allowing users to mount an ntfs filesystem from +userspace and accessing it using the functionality provided by the NTFS +library (libntfs). + + %package devel Summary : files required to compile software that uses libntfs Group : Development/System @@ -51,7 +63,7 @@ with the NTFS library (libntfs). %build if [ -n "$LINGUAS" ]; then unset LINGUAS; fi -%configure --enable-gnome-vfs +%configure --enable-gnome-vfs --enable-fuse-module make @@ -75,7 +87,7 @@ rm -rf "$RPM_BUILD_ROOT" %files %defattr(-,root,root) %doc AUTHORS COPYING CREDITS ChangeLog INSTALL NEWS README TODO.include TODO.libntfs TODO.ntfsprogs doc/CodingStyle doc/attribute_definitions doc/attributes.txt doc/compression.txt doc/tunable_settings doc/template.c doc/template.h doc/system_files.txt doc/system_security_descriptors.txt -%{bindir}/* +%{bindir}/ntfs[^m][^o]* %{sbindir}/* %{mandir}/man8/mkntfs.8* %{mandir}/man8/ntfs*.8* @@ -87,6 +99,11 @@ rm -rf "$RPM_BUILD_ROOT" %{_libdir}/gnome-vfs-2.0/modules/libntfs-gnomevfs.*so* %config %{_sysconfdir}/gnome-vfs-2.0/modules/libntfs.conf +%files fuse +%defattr(-,root,root) +%{bindir}/ntfsmount* +%{mandir}/man8/ntfsmount.8* + %files devel %defattr(-,root,root) %{_includedir}/* @@ -94,6 +111,9 @@ rm -rf "$RPM_BUILD_ROOT" %{_libdir}/gnome-vfs-2.0/modules/libntfs-gnomevfs.*a* %changelog +* Mon Jul 18 2005 Anton Altaparmakov +- Add ntfsmount fuse module in separate rpm ntfsprogs-fuse. + * Wed Mar 10 2004 Anton Altaparmakov - Cleanup descriptions ready for 1.9.0 release. From 422b858af0dd1ff8e804f86451092e3aa27b0da0 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 18 Jul 2005 16:02:40 +0000 Subject: [PATCH 2362/2994] Oops. Made a cut and paste error when updating the spec file. Fix it. --- ntfsprogs.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index 0acaee67..74f8497c 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -90,7 +90,7 @@ rm -rf "$RPM_BUILD_ROOT" %{bindir}/ntfs[^m][^o]* %{sbindir}/* %{mandir}/man8/mkntfs.8* -%{mandir}/man8/ntfs*.8* +%{mandir}/man8/ntfs[^m][^o]*.8* %{_libdir}/libntfs.*so* %files gnomevfs From 50c4959f1e542bcf73e8189565554a8382ba59d1 Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 18 Jul 2005 16:10:05 +0000 Subject: [PATCH 2363/2994] root remove got size wrong a few typos --- ntfsprogs/ntfsrm.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index b6e4384d..d8d09fb4 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -273,7 +273,7 @@ static void ntfs_binary_print (u8 num, BOOL backwards, BOOL colour) /** * ntfsinfo_time_to_str */ -static const char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) +static const char * ntfsinfo_time_to_str(const s64 sle_ntfs_clock) { time_t unix_clock = ntfs2utc(sle64_to_cpu(sle_ntfs_clock)); if (sle_ntfs_clock == 0) @@ -317,7 +317,7 @@ static void ntfs_inode_dir_map (ntfs_inode *ino) /** * ntfs_inode_open2 */ -static ntfs_inode *ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) +static ntfs_inode * ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) { ntfs_inode *ino = NULL; struct ntfs_dir *dir; @@ -431,7 +431,7 @@ static int ntfs_bmp_commit (struct ntfs_bmp *bmp) printf ("\ti size = %lld\n", bmp->attr->initialized_size); #endif - //printf ("commit bmp inode %lld, 0x%02X (%sresident)\n", bmp->attr->ni->mft_no, bmp->attr->type, NAttrNonResident (bmp->attr) ? "non-" : ""); + printf ("commit bmp inode %lld, 0x%02X (%sresident)\n", bmp->attr->ni->mft_no, bmp->attr->type, NAttrNonResident (bmp->attr) ? "non-" : ""); if (NAttrNonResident (bmp->attr)) { cs = bmp->vol->cluster_size; @@ -2643,8 +2643,6 @@ static BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) del->data = realloc (del->data, del->data_len); del->header = (INDEX_HEADER*) (del->data + 0x10); - del->header->index_length -= del_len; - del->header->allocated_size -= del_len; //utils_dump_mem (del->data, 0, del->data_len, DM_GREEN | DM_RED); @@ -4834,8 +4832,12 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) //utils_dump_mem (par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); - if (par) - file = &par->children[par_num]->key.file_name; printf ("\tpar name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + if (par) { + file = &par->children[par_num]->key.file_name; + printf ("\tpar name: "); + ntfs_name_print (file->file_name, file->file_name_length); + printf ("\n"); + } if (par == NULL) { // unhook everything @@ -5010,6 +5012,7 @@ static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) if (1) ntfs_file_remove (vol, dt, dt_num); // remove name from index + if (1) utils_volume_commit (vol); if (1) utils_volume_commit (vol); if (0) utils_volume_rollback (vol); From a3ac693fcaf86f5c970032a7e8290b9aacb2e743 Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 18 Jul 2005 20:34:41 +0000 Subject: [PATCH 2364/2994] Move the check for $Bitmap AT_ATTRIBUTE_LIST into resize constraints --- ntfsprogs/ntfsresize.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 6f90dfeb..d7aa3a20 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -657,6 +657,7 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) { s64 inode, last_lcn; ATTR_FLAGS flags; + ATTR_TYPES atype; struct llcn_t *llcn = NULL; int ret, supported = 0; @@ -664,6 +665,7 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) inode = resize->ni->mft_no; flags = resize->ctx->attr->flags; + atype = resize->ctx->attr->type; if ((ret = has_bad_sectors(resize, 1)) != 0) { if (ret == -1) @@ -678,15 +680,21 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) return; } - if (inode == FILE_MFT) { + if (inode == FILE_Bitmap) { + llcn = &resize->last_lcn; + if (atype == AT_DATA && NInoAttrList(resize->ni)) + err_exit("Highly fragmented $Bitmap isn't supported yet."); + + supported = 1; + + } else if (inode == FILE_MFT) { llcn = &resize->last_mft; /* * First run of $MFT AT_DATA and $MFT with AT_ATTRIBUTE_LIST * isn't supported yet. */ - if ((resize->ctx->attr->type != AT_DATA || rl->vcn) && - !NInoAttrList(resize->ni)) + if ((atype != AT_DATA || rl->vcn) && !NInoAttrList(resize->ni)) supported = 1; } else if (NInoAttrList(resize->ni)) { @@ -708,7 +716,7 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) supported = 1; /* Fragmented $MFTMirr DATA attribute isn't supported yet */ - if (resize->ctx->attr->type == AT_DATA) + if (atype == AT_DATA) if (rl[1].length != 0 || rl->vcn) supported = 0; } else { @@ -1917,9 +1925,6 @@ static void lookup_data_attr(ntfs_volume *vol, if (!(ni = ntfs_inode_open(vol, mref))) perr_exit("ntfs_open_inode"); - if (NInoAttrList(ni)) - err_exit("Attribute list attribute not yet supported"); - if (!(*ctx = attr_get_search_ctx(ni, NULL))) exit(1); From 82fc3cd55702bb5d5fd3181d474ba50acf375485 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 18 Jul 2005 20:38:33 +0000 Subject: [PATCH 2365/2994] Fix compiler warning under Cygwin. --- ntfsprogs/ntfsinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 500b53b6..5cd08fa5 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1478,7 +1478,7 @@ static void ntfs_dump_attr_ea_information(ATTR_RECORD *attr) printf("\tNEED_EA count:\t\t %u\n", le16_to_cpu(ea_info->need_ea_count)); printf("\tUnpacked EA length:\t %u\n", - le32_to_cpu(ea_info->ea_query_length)); + (unsigned)le32_to_cpu(ea_info->ea_query_length)); } /** From 6292bc5d8fc5a93a8115ede18e69b3c9d88ab074 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 18 Jul 2005 20:47:48 +0000 Subject: [PATCH 2366/2994] Fix compilation under Cygwin (and make sure it still works on Linux). --- ntfsprogs/decrypt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index d9bd31da..1bbf8e07 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -29,8 +29,6 @@ #include "decrypt.h" -#include "types.h" - #ifdef __CYGWIN__ //#define USE_CRYPTOAPI_RSA 1 #define _WIN32_WINNT 0x501 @@ -84,6 +82,9 @@ static HMODULE hCrypt32 = INVALID_HANDLE_VALUE; #endif /* defined(__CYGWIN__) */ +/* This must be after windows.h include. */ +#include "types.h" + typedef struct { #ifdef __CYGWIN__ HCERTSTORE hSystemStore; From b3e4bbcd571af21b518f3e7dda1f982ab7ddc1d9 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 18 Jul 2005 21:14:26 +0000 Subject: [PATCH 2367/2994] Update TODOs for some things I probably will do someday. --- TODO.libntfs | 2 ++ TODO.ntfsprogs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/TODO.libntfs b/TODO.libntfs index 731163d9..a528dedb 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -42,6 +42,8 @@ - implement an ntfs shell where can use the above much faster with caching, probably extending the library in the process +- implement {a,m,r}time updates in the library. + **************** * LOW priority * **************** diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index cd4dde39..7f95de06 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -40,6 +40,13 @@ Thanks, - check whether the O_WRONLY -> O_RDWR change made effect on performance +********** +* ntfscp * +********** + +- add ability to copy multiply files at once. + + *********** * ntfsfix * *********** From 50075bb971750888c2d7824ccdb2d93983119fe1 Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 18 Jul 2005 21:45:08 +0000 Subject: [PATCH 2368/2994] fix some sloppy memory management tidy up ie handling --- ntfsprogs/ntfsrm.c | 91 +++++++++++++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 33 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index d8d09fb4..f1f25661 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -886,8 +886,8 @@ static INDEX_ENTRY * ntfs_ie_remove_vcn (INDEX_ENTRY *ie) static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype) { FILE_NAME_ATTR *file; - int klen; int need; + BOOL wipe = FALSE; VCN vcn = 0; if (!ie || !name) @@ -919,33 +919,51 @@ static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int name * VCN vcn; */ - file = &ie->key.file_name; + printf ("key length = 0x%02X\n", ie->key_length); + printf ("new name length = %d\n", namelen); + if (ie->key_length > 0) { + file = &ie->key.file_name; + printf ("filename, length %d\n", file->file_name_length); + need = ATTR_SIZE (namelen * sizeof (ntfschar) + 2) - + ATTR_SIZE (file->file_name_length * sizeof (ntfschar) + 2); + } else { + printf ("no filename\n"); + need = ATTR_SIZE (sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar))); + wipe = TRUE; + } - klen = ATTR_SIZE (ie->key_length); - need = ATTR_SIZE (sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar))); + printf ("need 0x%02X bytes\n", need); - //printf ("ilen = %d\n", ie->length); - //printf ("klen = %d\n", klen); - //printf ("need = %d\n", need); + if (need != 0) { + if (ie->flags & INDEX_ENTRY_NODE) + vcn = ntfs_ie_get_vcn (ie); - if (ie->flags & INDEX_ENTRY_NODE) - vcn = ntfs_ie_get_vcn (ie); + ie->length += need; + ie->key_length += need; - ie->length = 16 + need; - ie->key_length = sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar)); - ie = realloc (ie, ie->length + ie->key_length); - if (!ie) - return NULL; + printf ("realloc 0x%02X\n", ie->length); + ie = realloc (ie, ie->length); + if (!ie) + return NULL; - memcpy (ie->key.file_name.file_name, name, namelen * 2); + if (ie->flags & INDEX_ENTRY_NODE) + ie = ntfs_ie_set_vcn (ie, vcn); - if (ie->flags & INDEX_ENTRY_NODE) - ie = ntfs_ie_set_vcn (ie, vcn); + if (wipe) + memset (&ie->key.file_name, 0, sizeof (FILE_NAME_ATTR)); + if (need > 0) + memset ((u8*)ie + ie->length - need, 0, need); + } + + memcpy (ie->key.file_name.file_name, name, namelen * sizeof (ntfschar)); ie->key.file_name.file_name_length = namelen; ie->key.file_name.file_name_type = nametype; ie->flags &= ~INDEX_ENTRY_END; + //printf ("ie->length = 0x%02X\n", ie->length); + //printf ("ie->key_length = 0x%02X\n", ie->key_length); + return ie; } @@ -1013,11 +1031,6 @@ static int ntfs_ie_test (void) ntfs_ie_dump (ie1); } - if (1) { - ie1 = ntfs_ie_remove_name (ie1); - ntfs_ie_dump (ie1); - } - if (1) { ie1 = ntfs_ie_set_vcn (ie1, 1234); ntfs_ie_dump (ie1); @@ -1028,16 +1041,21 @@ static int ntfs_ie_test (void) ntfs_ie_dump (ie1); } - ie1->indexed_file = 1234; - ie1->key.file_name.parent_directory = 5; - ie1->key.file_name.creation_time = utc2ntfs (time(NULL)); - ie1->key.file_name.last_data_change_time = utc2ntfs (time(NULL)); - ie1->key.file_name.last_mft_change_time = utc2ntfs (time(NULL)); - ie1->key.file_name.last_access_time = utc2ntfs (time(NULL)); - ie1->key.file_name.allocated_size = 4096; - ie1->key.file_name.data_size = 3973; + if (0) { + ie1 = ntfs_ie_remove_name (ie1); + ntfs_ie_dump (ie1); + } else { + ie1->indexed_file = 1234; + ie1->key.file_name.parent_directory = 5; + ie1->key.file_name.creation_time = utc2ntfs (time(NULL)); + ie1->key.file_name.last_data_change_time = utc2ntfs (time(NULL)); + ie1->key.file_name.last_mft_change_time = utc2ntfs (time(NULL)); + ie1->key.file_name.last_access_time = utc2ntfs (time(NULL)); + ie1->key.file_name.allocated_size = 4096; + ie1->key.file_name.data_size = 3973; + } - //ntfs_ie_dump (ie1); + ntfs_ie_dump (ie1); free (name); free (ie1); free (ie2); @@ -4545,7 +4563,7 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) entry = (INDEX_ENTRY*) ptr; if (entry->flags & INDEX_ENTRY_NODE) { - newvcn = (VCN*) (ptr + ROUND_UP(entry->key_length + 0x17, 8)); + newvcn = (VCN*) (ptr + ROUND_UP(entry->length, 8) - 8); ntfs_index_dump_alloc (attr, *newvcn, indent+4); } @@ -4600,7 +4618,7 @@ static int ntfs_index_dump (ntfs_inode *inode) while (ptr < (buffer + size)) { entry = (INDEX_ENTRY*) ptr; if (entry->flags & INDEX_ENTRY_NODE) { - vcn = (VCN*) (ptr + ROUND_UP(entry->key_length + 0x17, 8)); + vcn = (VCN*) (ptr + ROUND_UP(entry->length, 8) - 8); ntfs_index_dump_alloc (ialloc, *vcn, 4); } @@ -4617,6 +4635,10 @@ static int ntfs_index_dump (ntfs_inode *inode) ptr += entry->length; } + + ntfs_attr_close (iroot); + ntfs_attr_close (ialloc); + printf ("fill = %d\n", ptr - buffer); return 0; } @@ -5116,6 +5138,9 @@ static int ntfs_test_bmp2 (ntfs_volume *vol) for (i = 0; i < 8; i++) { ntfs_binary_print (bmp->data[0][i], TRUE, TRUE); printf (" "); } printf ("\n"); } + free (bmp->attr->ni); + ntfs_bmp_free (bmp); + return 0; } From d016f808d52c577172db0a6057d5ab6850860b9f Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 18 Jul 2005 22:09:47 +0000 Subject: [PATCH 2369/2994] Fix read-only shrinkage failure if new size was too small by relocating and writing $Bitmap:$DATA only once. This also improves performance. --- ntfsprogs/ntfsresize.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index d7aa3a20..54098c63 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -750,6 +750,9 @@ static void collect_relocation_info(ntfs_resize_t *resize, runlist *rl) if (lcn + lcn_length <= new_vol_size) return; + if (inode == FILE_Bitmap && resize->ctx->attr->type == AT_DATA) + return; + start = lcn; len = lcn_length; @@ -1639,6 +1642,10 @@ static void relocate_attributes(ntfs_resize_t *resize) else if (ret == 1) break; + if (resize->mref == FILE_Bitmap && + resize->ctx->attr->type == AT_DATA) + break; + relocate_attribute(resize); } From a0580d00e16e88b5aac5133a664fb8efb603c028 Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 18 Jul 2005 22:32:37 +0000 Subject: [PATCH 2370/2994] Update ntfsresize TODO --- TODO.ntfsprogs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 7f95de06..72798b1a 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -73,6 +73,8 @@ Thanks, ************** High priority + - support $MFT with $ATTRIBUTE_LIST + - support splitting up $MFT runs - move ntfs consistency check to libntfs (for ntfsck, ntfsclone, etc) - use different exit codes (e.g. corrupt volume detected, unsupported case, bad sectors, etc) From 807e7e6dfc7945aa2b41bcd38542259e03eb7f9a Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 18 Jul 2005 23:42:40 +0000 Subject: [PATCH 2371/2994] remove some old code --- ntfsprogs/ntfsrm.c | 616 +-------------------------------------------- 1 file changed, 7 insertions(+), 609 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index f1f25661..526723d5 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -2020,51 +2020,6 @@ static int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start } -/** - * utils_free_non_residents - */ -static int utils_free_non_residents (ntfs_inode *inode) -{ - // XXX need to do this in memory - - ntfs_attr_search_ctx *ctx; - ntfs_attr *na; - ATTR_RECORD *arec; - - if (!inode) - return -1; - - ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); - if (!ctx) { - printf ("can't create a search context\n"); - return -1; - } - - while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { - arec = ctx->attr; - if (arec->non_resident) { - na = ntfs_attr_open (inode, arec->type, NULL, 0); - if (na) { - runlist_element *rl; - LCN size; - LCN count; - ntfs_attr_map_whole_runlist (na); - rl = na->rl; - size = na->allocated_size >> inode->vol->cluster_size_bits; - for (count = 0; count < size; count += rl->length, rl++) { - //printf ("rl(%llu,%llu,%lld)\n", rl->vcn, rl->lcn, rl->length); - //printf ("freed %d\n", ntfs_cluster_free (inode->vol, na, rl->vcn, rl->length)); - ntfs_cluster_free (inode->vol, na, rl->vcn, rl->length); - } - ntfs_attr_close (na); - } - } - } - - ntfs_attr_put_search_ctx (ctx); - return 0; -} - /** * utils_free_non_residents3 */ @@ -2128,130 +2083,6 @@ static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) } -/** - * utils_mftrec_mark_free - */ -static int utils_mftrec_mark_free (ntfs_volume *vol, MFT_REF mref) -{ - static u8 buffer[512]; - static s64 bmpmref = -sizeof (buffer) - 1; /* Which bit of $BITMAP is in the buffer */ - - int byte, bit; - - if (!vol) { - errno = EINVAL; - return -1; - } - - mref = MREF (mref); - //printf ("mref = %lld\n", mref); - /* Does mref lie in the section of $Bitmap we already have cached? */ - if (((s64)mref < bmpmref) || ((s64)mref >= (bmpmref + - (sizeof (buffer) << 3)))) { - Dprintf ("Bit lies outside cache.\n"); - - /* Mark the buffer as not in use, in case the read is shorter. */ - memset (buffer, 0, sizeof (buffer)); - bmpmref = mref & (~((sizeof (buffer) << 3) - 1)); - - if (ntfs_attr_pread (vol->mftbmp_na, (bmpmref>>3), sizeof (buffer), buffer) < 0) { - Eprintf ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno)); - return -1; - } - - Dprintf ("Reloaded bitmap buffer.\n"); - } - - bit = 1 << (mref & 7); - byte = (mref >> 3) & (sizeof (buffer) - 1); - Dprintf ("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", - mref, bmpmref, byte, bit, buffer[byte] & bit); - - if ((buffer[byte] & bit) == 0) { - Eprintf ("MFT record isn't in use (1).\n"); - return -1; - } - - //utils_dump_mem (buffer, byte, 1, DM_NO_ASCII); - buffer[byte] &= ~bit; - //utils_dump_mem (buffer, byte, 1, DM_NO_ASCII); - - if (ntfs_attr_pwrite (vol->mftbmp_na, (bmpmref>>3), sizeof (buffer), buffer) < 0) { - Eprintf ("Couldn't write $MFT/$BITMAP: %s\n", strerror (errno)); - return -1; - } - - return (buffer[byte] & bit); -} - -/** - * utils_mftrec_mark_free2 - */ -static int utils_mftrec_mark_free2 (ntfs_volume *vol, MFT_REF mref) -{ - u8 buffer[1024]; - s64 res; - MFT_RECORD *rec; - - if (!vol) - return -1; - - mref = MREF (mref); - rec = (MFT_RECORD*) buffer; - - res = ntfs_mft_record_read (vol, mref, rec); - printf ("res = %lld\n", res); - - if ((rec->flags & MFT_RECORD_IN_USE) == 0) { - Eprintf ("MFT record isn't in use (2).\n"); - return -1; - } - - rec->flags &= ~MFT_RECORD_IN_USE; - - //printf ("\n"); - //utils_dump_mem (buffer, 0, 1024, DM_DEFAULTS); - - res = ntfs_mft_record_write (vol, mref, rec); - printf ("res = %lld\n", res); - - return 0; -} - -/** - * utils_mftrec_mark_free3 - */ -static int utils_mftrec_mark_free3 (struct ntfs_bmp *bmp, MFT_REF mref) -{ - return ntfs_bmp_set_range (bmp, (VCN) MREF (mref), 1, 0); -} - -/** - * utils_mftrec_mark_free4 - */ -static int utils_mftrec_mark_free4 (ntfs_inode *inode) -{ - MFT_RECORD *rec; - - if (!inode) - return -1; - - rec = (MFT_RECORD*) inode->mrec; - - if ((rec->flags & MFT_RECORD_IN_USE) == 0) { - Eprintf ("MFT record isn't in use (3).\n"); - return -1; - } - - rec->flags &= ~MFT_RECORD_IN_USE; - - //printf ("\n"); - //utils_dump_mem (buffer, 0, 1024, DM_DEFAULTS); - - printf (GREEN "Modified: inode %lld MFT_RECORD header\n" END, inode->mft_no); - return 0; -} - /** * utils_mftrec_mark_free5 */ @@ -2986,369 +2817,6 @@ static int ntfs_dt_alloc_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) return 0; } -/** - * ntfs_dt_remove_alloc - */ -static int ntfs_dt_remove_alloc (struct ntfs_dt *dt, int index_num) -{ - INDEX_ENTRY *ie = NULL; - int i; - u8 *dst; - u8 *src; - u8 *end; - int off; - int len; - s64 res; - - //printf ("removing entry %d of %d\n", index_num+1, dt->child_count); - //printf ("index size = %d\n", dt->data_len); - //printf ("index use = %d\n", dt->header->index_length); - - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - - off = (u8*)dt->children[0] - dt->data; - for (i = 0; i < dt->child_count; i++) { - ie = dt->children[i]; - - //printf ("%2d %4d ", i, off); - off += ie->length; - - if (ie->flags & INDEX_ENTRY_END) { - //printf ("END (%d)\n", ie->length); - break; - } - - //ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); - //printf (" (%d)\n", ie->length); - } - //printf ("total = %d\n", off); - - ie = dt->children[index_num]; - dst = (u8*)ie; - - src = dst + ie->length; - - ie = dt->children[dt->child_count-1]; - end = (u8*)ie + ie->length; - - len = end - src; - - //printf ("move %d bytes\n", len); - //printf ("%d, %d, %d\n", dst - dt->data, src - dt->data, len); - memmove (dst, src, len); - - //printf ("clear %d bytes\n", dt->data_len - (dst - dt->data) - len); - //printf ("%d, %d, %d\n", dst - dt->data + len, 0, dt->data_len - (dst - dt->data) - len); - - //ntfs_dt_print (dt->dir->index, 0); - - memset (dst + len, 0, dt->data_len - (dst - dt->data) - len); - - for (i = 0; i < dt->child_count; i++) { - if (dt->sub_nodes[i]) { - printf ("this shouldn't happen %p\n", dt->sub_nodes[i]); - ntfs_dt_free (dt->sub_nodes[i]); // shouldn't be any, yet - } - } - - free (dt->sub_nodes); - dt->sub_nodes = NULL; - free (dt->children); - dt->children = NULL; - dt->child_count = 0; - - //printf ("before = %d\n", dt->header->index_length + 24); - dt->header->index_length -= src - dst; - //printf ("after = %d\n", dt->header->index_length + 24); - - ntfs_dt_count_alloc (dt); - - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - -#if 0 - //printf ("\n"); - //printf ("index size = %d\n", dt->data_len); - //printf ("index use = %d\n", dt->header.index_length); - - off = (u8*)dt->children[0] - dt->data; - for (i = 0; i < dt->child_count; i++) { - ie = dt->children[i]; - - printf ("%2d %4d ", i, off); - off += ie->length; - - if (ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", ie->length); - break; - } - - ntfs_name_print (ie->key.file_name.file_name, - ie->key.file_name.file_name_length); - printf (" (%d)\n", ie->length); - } -#endif - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - res = ntfs_attr_mst_pwrite (dt->dir->ialloc, dt->vcn*512, 1, dt->data_len, dt->data); - printf ("res = %lld\n", res); - - return 0; -} - -/** - * ntfs_dt_remove_root - */ -static int ntfs_dt_remove_root (struct ntfs_dt *dt, int index_num) -{ - INDEX_ENTRY *ie = NULL; - INDEX_ROOT *ir = NULL; - int i; - u8 *dst; - u8 *src; - u8 *end; - int off; - int len; - s64 res; - - //printf ("removing entry %d of %d\n", index_num+1, dt->child_count); - //printf ("index size = %d\n", dt->data_len); - //printf ("index use = %d\n", dt->header->index_length); - - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - - off = (u8*)dt->children[0] - dt->data; - for (i = 0; i < dt->child_count; i++) { - ie = dt->children[i]; - - //printf ("%2d %4d ", i+1, off); - off += ie->length; - - if (ie->flags & INDEX_ENTRY_END) { - //printf ("END (%d)\n", ie->length); - break; - } - - //ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); - //printf (" (%d)\n", ie->length); - } - //printf ("total = %d\n", off); - - ie = dt->children[index_num]; - dst = (u8*)ie; - - src = dst + ie->length; - - ie = dt->children[dt->child_count-1]; - end = (u8*)ie + ie->length; - - len = end - src; - - //printf ("move %d bytes\n", len); - //printf ("%d, %d, %d\n", dst - dt->data, src - dt->data, len); - memmove (dst, src, len); - - dt->data_len -= (src - dt->data - sizeof (INDEX_ROOT)); - dt->child_count--; - - ir = (INDEX_ROOT*) dt->data; - ir->index.index_length = dt->data_len - 16; - ir->index.allocated_size = dt->data_len - 16; - - ntfs_mft_resize_resident (dt->dir->inode, AT_INDEX_ROOT, I30, 4, dt->data, dt->data_len); - dt->data = realloc (dt->data, dt->data_len); - - //printf ("ih->index_length = %d\n", ir->index.index_length); - //printf ("ih->allocated_size = %d\n", ir->index.allocated_size); - //printf ("dt->data_len = %d\n", dt->data_len); - - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - //ntfs_dt_print (dt->dir->index, 0); -#if 1 - for (i = 0; i < dt->child_count; i++) { - if (dt->sub_nodes[i]) { - printf ("this shouldn't happen %p\n", dt->sub_nodes[i]); - ntfs_dt_free (dt->sub_nodes[i]); // shouldn't be any, yet - } - } - - free (dt->sub_nodes); - dt->sub_nodes = NULL; - free (dt->children); - dt->children = NULL; - dt->child_count = 0; - - //printf ("before = %d\n", dt->header->index_length + 24); - dt->header->index_length -= src - dst; - //printf ("after = %d\n", dt->header->index_length + 24); - - ntfs_dt_count_root (dt); -#endif - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - -#if 0 - //printf ("\n"); - //printf ("index size = %d\n", dt->data_len); - //printf ("index use = %d\n", dt->header.index_length); - - off = (u8*)dt->children[0] - dt->data; - for (i = 0; i < dt->child_count; i++) { - ie = dt->children[i]; - - printf ("%2d %4d ", i, off); - off += ie->length; - - if (ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", ie->length); - break; - } - - ntfs_name_print (ie->key.file_name.file_name, - ie->key.file_name.file_name_length); - printf (" (%d)\n", ie->length); - } -#endif - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - - res = ntfs_mft_record_write (dt->dir->inode->vol, dt->dir->inode->mft_no, dt->dir->inode->mrec); - printf ("res = %lld\n", res); - - return 0; -} - -/** - * ntfs_dt_remove - */ -static int ntfs_dt_remove (struct ntfs_dt *dt, int index_num) -{ - if (!dt) - return 1; - if ((index_num < 0) || (index_num >= dt->child_count)) - return 1; - - if (ntfs_dt_root (dt)) - return ntfs_dt_remove_root (dt, index_num); - else - return ntfs_dt_remove_alloc (dt, index_num); -} - -/** - * ntfs_dt_del_child - */ -static int ntfs_dt_del_child (struct ntfs_dt *dt, ntfschar *uname, int len) -{ - struct ntfs_dt *del; - INDEX_ENTRY *ie; - ntfs_inode *ichild = NULL; - ntfs_inode *iparent = NULL; - ntfs_attr *attr = NULL; - ntfs_attr_search_ctx *ctx = NULL; - int index_num = 0; - int res = 1; - ATTR_RECORD *arec = NULL; - MFT_REF mft_num = -1; - FILE_NAME_ATTR *file; - int filenames = 0; - - // compressed & encrypted files? - - del = ntfs_dt_find2 (dt, uname, len, &index_num); - if (!del) { - printf ("can't find item to delete\n"); - goto close; - } - - if ((index_num < 0) || (index_num >= del->child_count)) { - printf ("error in dt_find\n"); - goto close; - } - - if (del->header->flags & INDEX_NODE) { - printf ("can only delete leaf nodes\n"); - goto close; - } - - /* - if (!del->parent) { - printf ("has 0xA0, but isn't in use\n"); - goto close; - } - */ - - ie = del->children[index_num]; - if (ie->key.file_name.file_attributes & FILE_ATTR_DIRECTORY) { - printf ("can't delete directories\n"); - goto close; - } - - if (ie->key.file_name.file_attributes & FILE_ATTR_SYSTEM) { - printf ("can't delete system files\n"); - goto close; - } - - ichild = ntfs_inode_open2 (dt->dir->vol, MREF (ie->indexed_file)); - if (!ichild) { - printf ("can't open inode\n"); - goto close; - } - - ctx = ntfs_attr_get_search_ctx (NULL, ichild->mrec); - if (!ctx) { - printf ("can't create a search context\n"); - goto close; - } - - while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { - arec = ctx->attr; - if (arec->type == AT_ATTRIBUTE_LIST) { - printf ("can't delete files with an attribute list\n"); - goto close; - } - if (arec->type == AT_INDEX_ROOT) { - printf ("can't delete directories\n"); - goto close; - } - if (arec->type == AT_FILE_NAME) { - filenames++; - file = (FILE_NAME_ATTR*) ((u8*) arec + arec->value_offset); - mft_num = MREF (file->parent_directory); - } - } - - if (filenames != 1) { - printf ("file has more than one name\n"); - goto close; - } - - iparent = ntfs_inode_open2 (dt->dir->vol, mft_num); - if (!iparent) { - printf ("can't open parent directory\n"); - goto close; - } - - /* - attr = ntfs_attr_open (iparent, AT_INDEX_ALLOCATION, I30, 4); - if (!attr) { - printf ("parent doesn't have 0xA0\n"); - goto close; - } - */ - - //printf ("deleting file\n"); - //ntfs_dt_print (del->dir->index, 0); - - if (1) res = utils_free_non_residents (ichild); - if (1) res = utils_mftrec_mark_free (dt->dir->vol, del->children[index_num]->indexed_file); - if (1) res = utils_mftrec_mark_free2 (dt->dir->vol, del->children[index_num]->indexed_file); - if (1) res = ntfs_dt_remove (del, index_num); - -close: - ntfs_attr_put_search_ctx (ctx); - ntfs_attr_close (attr); - ntfs_inode_close2 (iparent); - ntfs_inode_close2 (ichild); - - return res; -} - /** * ntfs_dt_add_alloc */ @@ -4501,47 +3969,6 @@ close: } -/** - * ntfsrm - */ -static int ntfsrm (ntfs_volume *vol, char *name) -{ - struct ntfs_dir *dir = NULL; - struct ntfs_dir *finddir = NULL; - MFT_REF mft_num; - ntfschar *uname = NULL; - int len; - - dir = ntfs_dir_alloc (vol, FILE_root); - if (!dir) - return 1; - - //mft_num = ntfs_dir_find (dir, name); - //printf ("%s = %lld\n", name, mft_num); - - mft_num = utils_pathname_to_mftref (vol, dir, name, &finddir); - //printf ("mft_num = %lld\n", mft_num); - //ntfs_dir_print (finddir, 0); - - if (!finddir) { - printf ("Couldn't find the index entry for %s\n", name); - return 1; - } - - if (rindex (name, PATH_SEP)) - name = rindex (name, PATH_SEP) + 1; - - len = ntfs_mbstoucs (name, &uname, 0); - if (len < 0) - return 1; - - ntfs_dt_del_child (finddir->index, uname, len); - - ntfs_dir_free (dir); - free (uname); - return 0; -} - /** * ntfs_index_dump_alloc */ @@ -4607,6 +4034,11 @@ static int ntfs_index_dump (ntfs_inode *inode) return 0; iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); + if (!iroot) { + printf ("not a directory\n"); + return 0; + } + ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); size = (int) ntfs_attr_pread (iroot, 0, sizeof (buffer), buffer); @@ -5045,38 +4477,6 @@ static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) return 0; } -/** - * ntfs_test_bmp - */ -static int ntfs_test_bmp (ntfs_volume *vol, ntfs_inode *inode) -{ - ntfs_inode *volbmp; - struct ntfs_bmp *bmp; - struct ntfs_bmp *bmp2; - //u8 *buffer; - //int i; - - volbmp = ntfs_inode_open2 (vol, FILE_Bitmap); - if (!volbmp) - return 1; - - bmp = ntfs_bmp_alloc (volbmp, AT_DATA, NULL, 0); - if (!bmp) - return 1; - - bmp2 = ntfs_bmp_alloc (vol->mft_ni, AT_BITMAP, NULL, 0); - if (!bmp2) - return 1; - - if (0) ntfs_bmp_set_range (bmp, 0, 9, 1); - if (0) utils_free_non_residents2 (inode, bmp); - if (0) utils_mftrec_mark_free3 (bmp2, inode->mft_no); - if (0) utils_mftrec_mark_free4 (inode); - - ntfs_bmp_free (bmp); - return 0; -} - /** * ntfs_test_bmp2 */ @@ -5190,12 +4590,10 @@ int main (int argc, char *argv[]) //printf ("inode = %lld\n", inode->mft_no); - if (0) result = ntfs_index_dump (inode); - if (0) result = ntfsrm (vol, opts.file); + if (1) result = ntfs_index_dump (inode); if (0) result = ntfs_ie_test(); if (0) result = ntfs_file_add (vol, opts.file); - if (1) result = ntfs_file_remove2 (vol, find.dt, find.dt_index); - if (0) result = ntfs_test_bmp (vol, inode); + if (0) result = ntfs_file_remove2 (vol, find.dt, find.dt_index); if (0) result = ntfs_test_bmp2 (vol); done: From ad7821f45851d7e083c16eff37c577ac33bc4b6c Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 18 Jul 2005 23:53:14 +0000 Subject: [PATCH 2372/2994] remove some old code --- ntfsprogs/ntfsrm.c | 205 +-------------------------------------------- 1 file changed, 4 insertions(+), 201 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 526723d5..141e26ec 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -3003,35 +3003,6 @@ static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY return 0; } -/** - * ntfs_dt_add - */ -static int ntfs_dt_add (struct ntfs_dt *parent, INDEX_ENTRY *ie) -{ - FILE_NAME_ATTR *file; - struct ntfs_dt *dt; - int index_num = -1; - - if (!ie) - return 0; - - file = &ie->key.file_name; - - dt = ntfs_dt_find3 (parent, file->file_name, file->file_name_length, &index_num); - if (!dt) - return 0; - - //printf ("dt = %p, index = %d\n", dt, index_num); - //ntfs_ie_dump (dt->children[index_num]); - //utils_dump_mem ((u8*)dt->children[index_num], 0, dt->children[index_num]->length, DM_DEFAULTS); - //printf ("\n"); - - if (0) ntfs_dt_add_alloc (dt, index_num, ie, NULL); - if (0) ntfs_dt_add_root (dt->dir->index, 0, ie, NULL); - - return 0; -} - /** * ntfs_dt_add2 */ @@ -3508,34 +3479,6 @@ static void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) parent->children[parent->child_count-1] = child; } -/** - * ntfs_dir_find - */ -static MFT_REF ntfs_dir_find (struct ntfs_dir *dir, char *name) -{ - MFT_REF mft_num; - ntfschar *uname = NULL; - int len; - - if (!dir || !name) - return -1; - - len = ntfs_mbstoucs (name, &uname, 0); - if (len < 0) - return -1; - - if (!dir->index) - dir->index = ntfs_dt_alloc (dir, NULL, -1); - - //printf ("dir->index = %p\n", dir->index); - //printf ("dir->child_count = %d\n", dir->child_count); - //printf ("uname = %p\n", uname); - mft_num = ntfs_dt_find (dir->index, uname, len); - - free (uname); - return mft_num; -} - /** * ntfs_dir_find2 */ @@ -3629,72 +3572,6 @@ static int utils_volume_rollback (ntfs_volume *vol) return 0; } -/** - * utils_pathname_to_mftref - */ -static MFT_REF utils_pathname_to_mftref (ntfs_volume *vol, struct ntfs_dir *parent, const char *pathname, struct ntfs_dir **finddir) -{ - MFT_REF mft_num; - MFT_REF result = -1; - char *p, *q; - char *ascii = NULL; - struct ntfs_dir *dir = NULL; - - if (!vol || !parent || !pathname) { - errno = EINVAL; - return -1; - } - - ascii = strdup (pathname); // Work with a r/w copy - if (!ascii) { - Eprintf ("Out of memory.\n"); - goto close; - } - - p = ascii; - while (p && *p && *p == PATH_SEP) // Remove leading /'s - p++; - while (p && *p) { - q = strchr (p, PATH_SEP); // Find the end of the first token - if (q != NULL) { - *q = '\0'; - q++; - } - - //printf ("looking for %s in %p\n", p, parent); - mft_num = ntfs_dir_find (parent, p); - if (mft_num == (u64)-1) { - Eprintf ("Couldn't find name '%s' in pathname '%s'.\n", p, pathname); - goto close; - } - - if (q) { - dir = ntfs_dir_alloc (vol, mft_num); - if (!dir) { - Eprintf ("Couldn't allocate a new directory (%lld).\n", mft_num); - goto close; - } - - ntfs_dir_add (parent, dir); - parent = dir; - } else { - //printf ("file %s\n", p); - result = mft_num; - if (finddir) - *finddir = dir ? dir : parent; - break; - } - - p = q; - while (p && *p && *p == PATH_SEP) - p++; - } - -close: - free (ascii); // from strdup - return result; -} - /** * ntfs_umount2 */ @@ -4075,81 +3952,6 @@ static int ntfs_index_dump (ntfs_inode *inode) return 0; } -/** - * ntfs_file_add - */ -static int ntfs_file_add (ntfs_volume *vol, char *name) -{ - struct ntfs_dir *dir = NULL; - struct ntfs_dir *finddir = NULL; - struct ntfs_dt *del = NULL; - INDEX_ENTRY *ie = NULL; - MFT_REF mft_num; - ntfschar *uname = NULL; - int len; - int index_num = 0; - - dir = ntfs_dir_alloc (vol, FILE_root); - if (!dir) - return 1; - - mft_num = utils_pathname_to_mftref (vol, dir, name, &finddir); - //printf ("mft_num = %lld\n", mft_num); - //ntfs_dir_print (finddir, 0); - - if (!finddir) { - printf ("Couldn't find the index entry for %s\n", name); - return 1; - } - - if (rindex (name, PATH_SEP)) - name = rindex (name, PATH_SEP) + 1; - - len = ntfs_mbstoucs (name, &uname, 0); - if (len < 0) - return 1; - - del = ntfs_dt_find2 (finddir->index, uname, len, &index_num); - if (!del) { - printf ("can't find item to delete\n"); - goto done; - } - - ie = ntfs_ie_copy (del->children[index_num]); - if (!ie) - goto done; - - free (uname); - uname = NULL; - - len = ntfs_mbstoucs ("file26a", &uname, 0); - if (len < 0) - goto done; - - ie = ntfs_ie_set_name (ie, uname, len, FILE_NAME_WIN32); - if (!ie) - goto done; - - //utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); - //printf ("\n"); - //printf ("ie = %lld\n", MREF (ie->indexed_file)); - //ntfs_dt_del_child (finddir->index, uname, len); - - //ntfs_dt_print (finddir->index, 0); - ntfs_dt_add (finddir->index, ie); - - // test - if (0) ntfs_dt_alloc_add (del, ie); - if (0) ntfs_dt_root_add (del, ie); - // test - -done: - ntfs_dir_free (dir); - free (uname); - free (ie); - return 0; -} - /** * ntfs_file_remove */ @@ -4590,10 +4392,9 @@ int main (int argc, char *argv[]) //printf ("inode = %lld\n", inode->mft_no); - if (1) result = ntfs_index_dump (inode); + if (0) result = ntfs_index_dump (inode); if (0) result = ntfs_ie_test(); - if (0) result = ntfs_file_add (vol, opts.file); - if (0) result = ntfs_file_remove2 (vol, find.dt, find.dt_index); + if (1) result = ntfs_file_remove2 (vol, find.dt, find.dt_index); if (0) result = ntfs_test_bmp2 (vol); done: @@ -4601,6 +4402,8 @@ done: if (1) ntfs_umount2 (vol, FALSE); if (0) ntfs_binary_print (0, FALSE, FALSE); + if (0) ntfs_dt_root_add (NULL, NULL); + if (0) ntfs_dt_alloc_add (NULL, NULL); return result; } From cc1f72948b43da68f717b0f910ac8d757b5ef99d Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 19 Jul 2005 01:56:41 +0000 Subject: [PATCH 2373/2994] fix careless mst write move truncate out of the commit path --- ntfsprogs/ntfsrm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 141e26ec..70309183 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1157,7 +1157,7 @@ static int ntfs_dt_commit (struct ntfs_dt *dt) size = dt->dir->index_size; //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); #ifdef RM_WRITE - ntfs_attr_mst_pwrite(attr, dt->vcn * size, 1, size, dt->data); // XXX retval + ntfs_attr_mst_pwrite(attr, dt->vcn * vol->cluster_size, 1, size, dt->data); // XXX retval #endif } else { printf ("commit dt (root)\n"); @@ -3355,8 +3355,6 @@ static int ntfs_dir_commit (struct ntfs_dir *dir) printf (RED "\tntfs_inode_sync %llu\n" END, dir->inode->mft_no); } - ntfs_dir_truncate (dir->vol, dir); - if (ntfs_dt_commit (dir->index) < 0) return -1; @@ -4268,7 +4266,8 @@ static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) if (1) ntfs_file_remove (vol, dt, dt_num); // remove name from index - if (1) utils_volume_commit (vol); + if (1) ntfs_dir_truncate (vol, dt->dir); + if (1) utils_volume_commit (vol); if (0) utils_volume_rollback (vol); From 1fa9a39d9a29cf0da56823bbdae8f062b066b526 Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 19 Jul 2005 09:59:51 +0000 Subject: [PATCH 2374/2994] Do the 1.11.0 release. --- ChangeLog | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index d6cf9a10..fadf511c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -18/07/2005 - 1.11.0 - Fixes and a new utility ntfsmount, a FUSE ntfs module. +19/07/2005 - 1.11.0 - Fixes and a new utility ntfsmount, a FUSE ntfs module. - ntfscp: fix signal hanling: handle both SIGTERM and SIGINT, print correct message. (Yura) @@ -19,10 +19,10 @@ when sector size was less than 512 bytes and then we wrote 512 bytes, i.e. beyond the end of the device.) (Anton) - Add new utility (make extra) - ntfsdecrypt. (Yuval) - - Improve "already mounted" ckeck. (Yura) + - Improve "already mounted" check. (Yura) - Remove AC_FUNC_MALLOC and AC_FUNC_REALLOC from configure.ac as we - do not provide replacement functions for them and they break cross - compilation. (Christophe) + do not provide replacement functions for them and the checks break + cross compilation. (Christophe) 20/06/2005 - 1.10.0 - Lots of new features, enhancements, and bug fixes. From 37b4c63829df529f0c14c1f82e4deb9f14aeefda Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 19 Jul 2005 21:22:24 +0000 Subject: [PATCH 2375/2994] ntfsmount: * Fix bug in inside ntfs_fuse_filler, it's sometimes allocated to small buffer. (Thanks to Rich for finding this bug) * Fix bug in error handling of ntfs_fuse_readdir. ARGH, why we already had release? --- ntfsprogs/ntfsmount.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 659f6424..4d154bf9 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -303,23 +303,16 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx, const s64 pos __attribute__((unused)), const MFT_REF mref, const unsigned dt_type __attribute__((unused))) { - char *filename; - int err = 0; + char *filename = NULL; if (name_type == FILE_NAME_DOS) return 0; - filename = malloc(name_len + 1); - if (!filename) + if (ntfs_ucstombs(name, name_len, &filename, 0) < 0) return -errno; - if (ntfs_ucstombs(name, name_len, &filename, name_len + 1) < 0) { - err = -errno; - free(filename); - return err; - } if (MREF(mref) >= FILE_first_user || ctx->show_sys_files) fill_ctx->filler(fill_ctx->buf, filename, NULL, 0); free(filename); - return err; + return 0; } static int ntfs_fuse_readdir(const char *path, void *buf, @@ -330,6 +323,7 @@ static int ntfs_fuse_readdir(const char *path, void *buf, ntfs_volume *vol; ntfs_inode *ni; s64 pos = 0; + int err = 0; vol = ctx->vol; fill_ctx.filler = filler; @@ -337,9 +331,11 @@ static int ntfs_fuse_readdir(const char *path, void *buf, ni = ntfs_pathname_to_inode(vol, NULL, path); if (!ni) return -errno; - ntfs_readdir(ni, &pos, &fill_ctx, (ntfs_filldir_t)ntfs_fuse_filler); + if (ntfs_readdir(ni, &pos, &fill_ctx, + (ntfs_filldir_t)ntfs_fuse_filler)) + err = -errno; ntfs_inode_close(ni); - return 0; + return err; } static int ntfs_fuse_open(const char *org_path, From 7b9cac2912d9f7c9302f7c84b836bd85a3c5fe05 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 19 Jul 2005 21:36:07 +0000 Subject: [PATCH 2376/2994] Update ChangeLog and auto scripts. --- ChangeLog | 5 + Makefile.in | 1 + aclocal.m4 | 520 ++++++++++------ config.guess | 64 +- config.sub | 5 +- configure | 1232 +++++++++++++++++++++++++------------- configure.ac | 2 +- doc/Makefile.in | 1 + include/Makefile.in | 1 + include/ntfs/Makefile.in | 1 + libntfs/Makefile.in | 1 + ltmain.sh | 156 +++-- ntfsprogs/Makefile.in | 1 + 13 files changed, 1289 insertions(+), 701 deletions(-) diff --git a/ChangeLog b/ChangeLog index fadf511c..507a5570 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +xx/xx/2005 - 1.11.1-WIP + + - ntfsmount: fix buffer allocation in ntfs_fuse_filler. (Yura, thanks + to Rich for finding bug) + 19/07/2005 - 1.11.0 - Fixes and a new utility ntfsmount, a FUSE ntfs module. - ntfscp: fix signal hanling: handle both SIGTERM and SIGINT, print diff --git a/Makefile.in b/Makefile.in index 23ba5a81..553116e9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -144,6 +144,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/aclocal.m4 b/aclocal.m4 index 2b04da7c..4ebc090e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -123,7 +123,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -191,7 +191,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -238,6 +238,48 @@ compiler=$CC ])# _LT_AC_SYS_COMPILER +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_LINKER_BOILERPLATE + + # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -579,8 +621,10 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi @@ -611,6 +655,11 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi else $2=yes fi @@ -680,6 +729,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -965,7 +1015,9 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi @@ -1464,7 +1516,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1527,7 +1579,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -2517,6 +2573,10 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # # Check for any special shared library compilation flags. # @@ -2649,6 +2709,10 @@ lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -2670,7 +2734,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2931,7 +2995,7 @@ case $host_os in fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -2949,11 +3013,11 @@ case $host_os in dgux*) case $cc_basename in - ec++) + ec++*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -2988,11 +3052,11 @@ case $host_os in # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) + aCC*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -3053,11 +3117,11 @@ case $host_os in esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) + aCC*) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -3097,9 +3161,9 @@ case $host_os in ;; irix5* | irix6*) case $cc_basename in - CC) + CC*) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -3110,7 +3174,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -3123,7 +3187,7 @@ case $host_os in ;; linux*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3148,7 +3212,7 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -3173,15 +3237,16 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC) + pgCC*) # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx) + cxx*) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -3212,7 +3277,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3251,7 +3316,7 @@ case $host_os in ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3267,14 +3332,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3292,7 +3357,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3311,7 +3376,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3326,17 +3391,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3355,7 +3420,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3379,7 +3444,7 @@ case $host_os in sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3391,12 +3456,12 @@ case $host_os in ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3409,7 +3474,7 @@ case $host_os in ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3423,9 +3488,13 @@ case $host_os in *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3446,7 +3515,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -3489,7 +3558,7 @@ case $host_os in ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3721,12 +3790,16 @@ lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3745,7 +3818,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3801,15 +3876,22 @@ lt_simple_link_test_code='public class conftest { public static void main(String # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) @@ -3852,11 +3934,16 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) @@ -3886,7 +3973,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -3992,7 +4079,7 @@ ifelse([$1], [], # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -4003,7 +4090,7 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -4086,7 +4173,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4120,7 +4207,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4646,7 +4733,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68) + cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -4655,7 +4742,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4664,10 +4751,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; dgux*) case $cc_basename in - ec++) + ec++*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4680,14 +4767,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; - aCC) + aCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -4705,7 +4792,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. @@ -4716,7 +4803,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' @@ -4727,13 +4814,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC) + pgCC*) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - cxx) + cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -4750,7 +4837,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx) + cxx*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) @@ -4761,14 +4848,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx) + cxx*) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -4784,7 +4871,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sco*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) @@ -4793,13 +4880,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; - gcx) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4809,12 +4896,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc) + lcc*) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4824,7 +4911,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -4924,7 +5011,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4972,7 +5059,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4999,9 +5086,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac ;; sunos4*) @@ -5131,7 +5223,8 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time @@ -5150,7 +5243,28 @@ ifelse([$1],[CXX],[ if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -5219,6 +5333,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -5257,41 +5402,6 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -5302,16 +5412,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -5516,7 +5621,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -5719,7 +5824,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5738,10 +5843,12 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -5750,8 +5857,18 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6042,63 +6159,120 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# 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 of the License, 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. -dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ - succeeded=no +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG - if test -z "$PKG_CONFIG"; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - fi +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then + pkg_cv_[]$1=$ac_cv_env_[]$1[]_value +elif test -n "$PKG_CONFIG"; then + if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then + pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - AC_MSG_CHECKING(for $2) +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.in +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - if $PKG_CONFIG --exists "$2" ; then - AC_MSG_RESULT(yes) - succeeded=yes +pkg_failed=no +AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], + [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) +AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], + [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) - AC_MSG_CHECKING($1_CFLAGS) - $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` - AC_MSG_RESULT($$1_CFLAGS) +if test $pkg_failed = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD - AC_MSG_CHECKING($1_LIBS) - $1_LIBS=`$PKG_CONFIG --libs "$2"` - AC_MSG_RESULT($$1_LIBS) - else - $1_CFLAGS="" - $1_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - ifelse([$4], ,echo $$1_PKG_ERRORS,) - fi + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met. +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. - AC_SUBST($1_CFLAGS) - AC_SUBST($1_LIBS) - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - ifelse([$3], , :, [$3]) - else - ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) - fi -]) +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details.])], + [$4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details. +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # diff --git a/config.guess b/config.guess index 44f30e6c..892833f9 100755 --- a/config.guess +++ b/config.guess @@ -136,16 +136,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -835,25 +825,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux + echo cris-axis-linux-gnu exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux + echo crisv32-axis-linux-gnu exit 0 ;; frv:Linux:*:*) - echo frv-${VENDOR}-linux + echo frv-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -872,7 +862,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -891,13 +881,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux + echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux + echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -910,34 +900,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux + echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux + echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -952,18 +942,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" + echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" + echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linuxoldld) or + # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -992,7 +982,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.sub b/config.sub index c884ad4e..d8fd2f8f 100755 --- a/config.sub +++ b/config.sub @@ -1172,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1205,6 +1205,9 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index bfe6fc59..f548b2bb 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.11.0. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.11.1-WIP. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.11.0' -PACKAGE_STRING='ntfsprogs 1.11.0' +PACKAGE_VERSION='1.11.1-WIP' +PACKAGE_STRING='ntfsprogs 1.11.1-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -947,6 +947,26 @@ ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS +ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_env_PKG_CONFIG_value=$PKG_CONFIG +ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG +ac_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} +ac_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS +ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} +ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS +ac_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} +ac_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS +ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} +ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS +ac_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} +ac_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS +ac_cv_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} +ac_cv_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS +ac_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} +ac_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS +ac_cv_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} +ac_cv_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS # # Report the --help message. @@ -955,7 +975,7 @@ 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 ntfsprogs 1.11.0 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.11.1-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1042,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.11.0:";; + short | recursive ) echo "Configuration of ntfsprogs 1.11.1-WIP:";; esac cat <<\_ACEOF @@ -1070,6 +1090,15 @@ Some influential environment variables: CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags + PKG_CONFIG path to pkg-config utility + LIBNTFS_GNOMEVFS_CFLAGS + C compiler flags for LIBNTFS_GNOMEVFS, overriding pkg-config + LIBNTFS_GNOMEVFS_LIBS + linker flags for LIBNTFS_GNOMEVFS, overriding pkg-config + FUSE_MODULE_CFLAGS + C compiler flags for FUSE_MODULE, overriding pkg-config + FUSE_MODULE_LIBS + linker flags for FUSE_MODULE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1170,7 +1199,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.11.0 +ntfsprogs configure 1.11.1-WIP generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1184,7 +1213,7 @@ 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 ntfsprogs $as_me 1.11.0, which was +It was created by ntfsprogs $as_me 1.11.1-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1912,7 +1941,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.11.0' + VERSION='1.11.1-WIP' cat >>confdefs.h <<_ACEOF @@ -4197,7 +4226,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4200 "configure"' > conftest.$ac_ext + echo '#line 4229 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5541,7 +5570,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5544:" \ +echo "$as_me:5573:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5742,6 +5771,7 @@ else fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -6032,7 +6062,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. @@ -6337,7 +6367,16 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -6525,6 +6564,20 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # # Check for any special shared library compilation flags. # @@ -6566,6 +6619,11 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works=yes + fi else lt_prog_compiler_static_works=yes fi @@ -6610,15 +6668,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6613: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6671: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6617: \$? = $ac_status" >&5 + echo "$as_me:6675: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -6724,7 +6784,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' @@ -6772,7 +6832,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -6799,9 +6859,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac ;; sunos4*) @@ -6865,15 +6930,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6868: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6933: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6872: \$? = $ac_status" >&5 + echo "$as_me:6937: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works=yes fi fi @@ -6925,16 +6992,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6928: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6995: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6932: \$? = $ac_status" >&5 + echo "$as_me:6999: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi @@ -7014,6 +7083,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -7034,6 +7113,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -7102,6 +7202,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -7140,41 +7271,6 @@ EOF hardcode_shlibpath_var=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds=$archive_cmds - fi - else - ld_shlibs=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -7185,16 +7281,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -7501,7 +7592,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -7704,7 +7795,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -7723,10 +7814,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -7735,8 +7828,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs=yes ;; @@ -8273,7 +8376,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -8336,7 +8439,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -9125,7 +9232,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6;} # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -9492,7 +9599,7 @@ echo "$as_me: creating $ofile" >&6;} SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -9574,7 +9681,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9608,7 +9715,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -9963,6 +10070,20 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -9984,7 +10105,16 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -10454,7 +10584,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -10472,11 +10602,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi dgux*) case $cc_basename in - ec++) + ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10511,11 +10641,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC) + aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -10576,11 +10706,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC) + aCC*) case "$host_cpu" in hppa*64*|ia64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -10620,9 +10750,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; irix5* | irix6*) case $cc_basename in - CC) + CC*) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -10633,7 +10763,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -10646,7 +10776,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; linux*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10671,7 +10801,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -10696,15 +10826,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC) + pgCC*) # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx) + cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -10735,7 +10866,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10774,7 +10905,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10790,14 +10921,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx) + cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10815,7 +10946,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10834,7 +10965,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10849,17 +10980,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx) + cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -10878,7 +11009,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10902,7 +11033,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi sco*) archive_cmds_need_lc_CXX=no case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10914,12 +11045,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10932,7 +11063,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -10946,9 +11077,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -10969,7 +11104,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -11012,7 +11147,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11221,7 +11356,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; chorus*) case $cc_basename in - cxch68) + cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -11230,7 +11365,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' @@ -11239,10 +11374,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; dgux*) case $cc_basename in - ec++) + ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; @@ -11255,14 +11390,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; - aCC) + aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -11280,7 +11415,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC) + CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. @@ -11291,7 +11426,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' @@ -11302,13 +11437,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; - pgCC) + pgCC*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-static' ;; - cxx) + cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -11325,7 +11460,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; mvs*) case $cc_basename in - cxx) + cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) @@ -11336,14 +11471,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; - cxx) + cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -11359,7 +11494,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sco*) case $cc_basename in - CC) + CC*) lt_prog_compiler_pic_CXX='-fPIC' ;; *) @@ -11368,13 +11503,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; - gcx) + gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; @@ -11384,12 +11519,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; - lcc) + lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; @@ -11399,7 +11534,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; @@ -11443,15 +11578,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11446: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11581: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11450: \$? = $ac_status" >&5 + echo "$as_me:11585: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_CXX=yes fi fi @@ -11503,16 +11640,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11506: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11643: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11510: \$? = $ac_status" >&5 + echo "$as_me:11647: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi @@ -12014,7 +12153,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -12077,7 +12216,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -12866,7 +13009,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 @@ -13572,7 +13738,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 @@ -13678,7 +13846,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' @@ -13726,7 +13894,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' @@ -13753,9 +13921,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_F77='-Qoption ld ';; + *) + lt_prog_compiler_wl_F77='-Wl,';; + esac ;; sunos4*) @@ -13819,15 +13992,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13822: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13995: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13826: \$? = $ac_status" >&5 + echo "$as_me:13999: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_F77=yes fi fi @@ -13879,16 +14054,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13882: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14057: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13886: \$? = $ac_status" >&5 + echo "$as_me:14061: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi @@ -13968,6 +14145,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -13988,6 +14175,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -14056,6 +14264,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_F77=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -14094,41 +14333,6 @@ EOF hardcode_shlibpath_var_F77=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_F77=$archive_cmds_F77 - fi - else - ld_shlibs_F77=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -14139,16 +14343,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs_F77" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi + if test "$ld_shlibs_F77" = no; then + runpath_var= + hardcode_libdir_flag_spec_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -14435,7 +14634,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -14638,7 +14837,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' @@ -14657,10 +14856,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -14669,8 +14870,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs_F77=yes ;; @@ -15207,7 +15418,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -15270,7 +15481,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15469,7 +15684,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -15618,7 +15833,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -15652,7 +15867,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -15901,15 +16116,41 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no +old_archive_cmds_GCJ=$old_archive_cmds + lt_prog_compiler_no_builtin_flag_GCJ= @@ -15935,15 +16176,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15938: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16179: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15942: \$? = $ac_status" >&5 + echo "$as_me:16183: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -16049,7 +16292,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' @@ -16097,7 +16340,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16124,9 +16367,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_GCJ='-Qoption ld ';; + *) + lt_prog_compiler_wl_GCJ='-Wl,';; + esac ;; sunos4*) @@ -16190,15 +16438,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16193: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16441: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16197: \$? = $ac_status" >&5 + echo "$as_me:16445: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_GCJ=yes fi fi @@ -16250,16 +16500,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16253: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16503: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16257: \$? = $ac_status" >&5 + echo "$as_me:16507: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi @@ -16339,6 +16591,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -16359,6 +16621,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -16427,6 +16710,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_GCJ=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -16465,41 +16779,6 @@ EOF hardcode_shlibpath_var_GCJ=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_GCJ=$archive_cmds_GCJ - fi - else - ld_shlibs_GCJ=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -16510,16 +16789,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs_GCJ" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi + if test "$ld_shlibs_GCJ" = no; then + runpath_var= + hardcode_libdir_flag_spec_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -16826,7 +17100,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -17029,7 +17303,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' @@ -17048,10 +17322,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -17060,8 +17336,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs_GCJ=yes ;; @@ -17598,7 +17884,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -17661,7 +17947,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -18450,7 +18740,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the @@ -19116,7 +19430,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -19265,7 +19579,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -19299,7 +19613,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -19949,11 +20263,11 @@ if test "$enable_gnome_vfs" != "no"; then export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" fi - succeeded=no - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; 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_path_PKG_CONFIG+set}" = set; then @@ -19978,7 +20292,6 @@ do done done - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -19992,56 +20305,123 @@ else echo "${ECHO_T}no" >&6 fi +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done +done - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 -echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG - if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then - echo "$as_me:$LINENO: result: yes" >&5 +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + PKG_CONFIG=$ac_pt_PKG_CONFIG +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - succeeded=yes + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + PKG_CONFIG="" + fi - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 +fi - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 - else - LIBNTFS_GNOMEVFS_CFLAGS="" - LIBNTFS_GNOMEVFS_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` +pkg_failed=no +echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 +if test "${pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set" = "xset"; then + pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&6 +echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 +if test "${pkg_cv_LIBNTFS_GNOMEVFS_LIBS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set" = "xset"; then + pkg_cv_LIBNTFS_GNOMEVFS_LIBS=$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&6 - fi +if test $pkg_failed = yes; then + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + # Put the nasty error message in config.log where it belongs + echo "$LIBNTFS_GNOMEVFS_PKG_ERRORS" 1>&5 - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_gnome_vfs=true - else - if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} @@ -20051,8 +20431,22 @@ echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi - fi +elif test $pkg_failed = untried; then + if test "$enable_gnome_vfs" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} + fi + +else + LIBNTFS_GNOMEVFS_CFLAGS=$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS + LIBNTFS_GNOMEVFS_LIBS=$pkg_cv_LIBNTFS_GNOMEVFS_LIBS + compile_gnome_vfs=true +fi fi @@ -20069,98 +20463,59 @@ fi compile_fuse_module=false if test "$enable_fuse_module" != "no"; then - succeeded=no - - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then +pkg_failed=no +echo "$as_me:$LINENO: checking for FUSE_MODULE_CFLAGS" >&5 +echo $ECHO_N "checking for FUSE_MODULE_CFLAGS... $ECHO_C" >&6 +if test "${pkg_cv_FUSE_MODULE_CFLAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 + if test "x$ac_cv_env_FUSE_MODULE_CFLAGS_set" = "xset"; then + pkg_cv_FUSE_MODULE_CFLAGS=$ac_cv_env_FUSE_MODULE_CFLAGS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0" 2>/dev/null` + else + pkg_failed=yes + fi else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + pkg_failed=untried fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_CFLAGS" >&5 +echo "${ECHO_T}$pkg_cv_FUSE_MODULE_CFLAGS" >&6 +echo "$as_me:$LINENO: checking for FUSE_MODULE_LIBS" >&5 +echo $ECHO_N "checking for FUSE_MODULE_LIBS... $ECHO_C" >&6 +if test "${pkg_cv_FUSE_MODULE_LIBS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_FUSE_MODULE_LIBS_set" = "xset"; then + pkg_cv_FUSE_MODULE_LIBS=$ac_cv_env_FUSE_MODULE_LIBS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_LIBS" >&5 +echo "${ECHO_T}$pkg_cv_FUSE_MODULE_LIBS" >&6 - fi +if test $pkg_failed = yes; then + FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` + # Put the nasty error message in config.log where it belongs + echo "$FUSE_MODULE_PKG_ERRORS" 1>&5 - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for fuse >= 2.3.0" >&5 -echo $ECHO_N "checking for fuse >= 2.3.0... $ECHO_C" >&6 - - if $PKG_CONFIG --exists "fuse >= 2.3.0" ; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - succeeded=yes - - echo "$as_me:$LINENO: checking FUSE_MODULE_CFLAGS" >&5 -echo $ECHO_N "checking FUSE_MODULE_CFLAGS... $ECHO_C" >&6 - FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0"` - echo "$as_me:$LINENO: result: $FUSE_MODULE_CFLAGS" >&5 -echo "${ECHO_T}$FUSE_MODULE_CFLAGS" >&6 - - echo "$as_me:$LINENO: checking FUSE_MODULE_LIBS" >&5 -echo $ECHO_N "checking FUSE_MODULE_LIBS... $ECHO_C" >&6 - FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0"` - echo "$as_me:$LINENO: result: $FUSE_MODULE_LIBS" >&5 -echo "${ECHO_T}$FUSE_MODULE_LIBS" >&6 - else - FUSE_MODULE_CFLAGS="" - FUSE_MODULE_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` - - fi - - - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_fuse_module=true - else if test "$enable_fuse_module" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 @@ -20171,8 +20526,22 @@ echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2 echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} fi - fi +elif test $pkg_failed = untried; then + if test "$enable_fuse_module" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 +echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 +echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} + fi + +else + FUSE_MODULE_CFLAGS=$pkg_cv_FUSE_MODULE_CFLAGS + FUSE_MODULE_LIBS=$pkg_cv_FUSE_MODULE_LIBS + compile_fuse_module=true +fi fi @@ -23117,7 +23486,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.11.0, which was +This file was extended by ntfsprogs $as_me 1.11.1-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23180,7 +23549,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.11.0 +ntfsprogs config.status 1.11.1-WIP configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -23471,6 +23840,7 @@ s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t diff --git a/configure.ac b/configure.ac index a3497909..c03f6729 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.11.0],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.11.1-WIP],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) diff --git a/doc/Makefile.in b/doc/Makefile.in index ab7029cb..e9a42652 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -119,6 +119,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/Makefile.in b/include/Makefile.in index dbaff49f..2202b27d 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -128,6 +128,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 96473220..2c384c38 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -132,6 +132,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 3b73331f..37bab1b3 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -194,6 +194,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/ltmain.sh b/ltmain.sh index 3d071010..eecedf23 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -17,7 +17,7 @@ # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,8 +43,8 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.14 -TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" +VERSION=1.5.18 +TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. @@ -112,8 +112,9 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -: ${IFS=" -"} +lt_nl=' +' +IFS=" $lt_nl" if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -250,37 +251,14 @@ func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" - f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" - $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ - | $EGREP -v '^[ ]*1[ ]' | while read count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? - i=`expr $i + 1` - done - done - $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE fi } @@ -757,6 +735,15 @@ if test -z "$show_help"; then esac done + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qlibobj="\"$qlibobj\"" ;; + esac + if test "X$libobj" != "X$qlibobj"; then + $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + exit $EXIT_FAILURE + fi objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -829,12 +816,17 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo $srcfile > "$lockfile" + $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qsrcfile="\"$qsrcfile\"" ;; + esac $run $rm "$libobj" "${libobj}T" @@ -856,10 +848,10 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" fi if test ! -d "${xdir}$objdir"; then @@ -939,9 +931,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" else - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -1365,6 +1357,8 @@ EOF ;; darwin_framework) compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" prev= continue ;; @@ -1429,6 +1423,8 @@ EOF -framework) prev=darwin_framework compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" continue ;; @@ -2852,12 +2848,12 @@ EOF *) continue ;; esac case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no @@ -3124,7 +3120,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3133,7 +3129,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3142,7 +3138,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -5091,6 +5087,63 @@ fi\ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5104,20 +5157,7 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi + # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -6026,14 +6066,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\"\$cmd\"$args" + exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - eval \$echo \"\$cmd\"$args + $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index d34ddafc..88ee90a0 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -246,6 +246,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ From 53a1ae67f9a1255046ee5d069fbd8d9c2523f84a Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 19 Jul 2005 22:58:51 +0000 Subject: [PATCH 2377/2994] * Fix similar bug in ntfs_fuse_getxattr. * Update changelog. --- ChangeLog | 5 +++-- ntfsprogs/ntfsmount.c | 32 ++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 507a5570..b8636ee8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ xx/xx/2005 - 1.11.1-WIP - - ntfsmount: fix buffer allocation in ntfs_fuse_filler. (Yura, thanks - to Rich for finding bug) + - ntfsmount: Fix several bugs when too small buffer was allocated for + filenames on systems with utf8 locale. (Yura, many thanks to Rich + for finding bug) 19/07/2005 - 1.11.0 - Fixes and a new utility ntfsmount, a FUSE ntfs module. diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 4d154bf9..6d77f15d 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -597,25 +597,31 @@ static int ntfs_fuse_getxattr(const char *path, const char *name, } while (!ntfs_attr_lookup(AT_DATA, NULL, 0, CASE_SENSITIVE, 0, NULL, 0, actx)) { + char *tmp_name = NULL; + int tmp_name_len; + if (!actx->attr->name_length) continue; + tmp_name_len = ntfs_ucstombs((ntfschar *)((u8*)actx->attr + + le16_to_cpu(actx->attr->name_offset)), + actx->attr->name_length, &tmp_name, 0); + if (tmp_name_len < 0) { + ret = -errno; + goto exit; + } if (ret) - ret++; - ret += actx->attr->name_length; + ret++; /* For space delimiter .*/ + ret += tmp_name_len; if ((size_t)ret <= size) { + /* Don't add space to the beginning of line. */ if (to != value) { *to = ' '; to++; } - if (ntfs_ucstombs((ntfschar *)((u8*)actx->attr + - le16_to_cpu(actx->attr->name_offset)), - actx->attr->name_length, &to, - actx->attr->name_length + 1) < 0) { - ret = -errno; - goto exit; - } - to += actx->attr->name_length; + strncpy(to, tmp_name, tmp_name_len); + to += tmp_name_len; } + free(tmp_name); } if (errno != ENOENT) ret = -errno; @@ -627,6 +633,7 @@ exit: } #if 0 +/* If this will be enabled, need to fix bug before. (bug description below) */ static const char nf_ns_streams[] = "user.stream."; static const int nf_ns_streams_len = 12; @@ -662,6 +669,11 @@ static int ntfs_fuse_listxattr(const char *path, char *list, size_t size) if (size && (size_t)ret <= size) { strcpy(to, nf_ns_streams); to += nf_ns_streams_len; + /* + * BUG: destination buffer length can be bigger than + * actx->attr->name_length + 1. (eg. internatinal + * characters in utf8) + */ if (ntfs_ucstombs((ntfschar *)((u8*)actx->attr + le16_to_cpu(actx->attr->name_offset)), actx->attr->name_length, &to, From c8cb65fcd93e43bb733826b779fe6dca3827b3b4 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 19 Jul 2005 23:13:26 +0000 Subject: [PATCH 2378/2994] Make @outs_len to be 0 when @**outs NULL in ntfs_ucstombs calls. Previous code it correct since @outs_len is ingored when @**outs == NULL, but may confuse because it was equal to @ins_len what is incorrect (eg. international utf8 characters). --- ntfsprogs/ntfsrm.c | 4 ++-- ntfsprogs/ntfsundelete.c | 4 ++-- ntfsprogs/utils.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 70309183..6df0669b 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1270,7 +1270,7 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt) } if (!(entry->flags & INDEX_ENTRY_END)) { - ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, entry->key.file_name.file_name_length); + ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0); //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); free (name); name = NULL; @@ -1337,7 +1337,7 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) if (entry->flags & INDEX_ENTRY_END) { break; } else { - ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, entry->key.file_name.file_name_length); + ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0); //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); free (name); name = NULL; diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 80d4d6af..d2b7978c 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -882,7 +882,7 @@ static int get_filenames (struct ufile *file, ntfs_volume* vol) name->date_r = ntfs2utc (sle64_to_cpu (attr->last_access_time)); if (ntfs_ucstombs (name->uname, name->uname_len, &name->name, - name->uname_len) < 0) { + 0) < 0) { Dprintf ("ERROR: Couldn't translate filename to current locale.\n"); } @@ -957,7 +957,7 @@ static int get_data (struct ufile *file, ntfs_volume *vol) data->uname_len = rec->name_length; if (ntfs_ucstombs (data->uname, data->uname_len, &data->name, - data->uname_len) < 0) { + 0) < 0) { Eprintf ("ERROR: Cannot translate name into current locale.\n"); } } diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 40fe9022..c9caacbb 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -461,7 +461,7 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) } if (ntfs_ucstombs (attr->file_name, attr->file_name_length, - &names[i], attr->file_name_length) < 0) { + &names[i], 0) < 0) { char *temp; Eprintf ("Couldn't translate filename to current locale.\n"); temp = malloc (30); @@ -542,7 +542,7 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int if (attrdef) { name = NULL; namelen = ntfs_ucsnlen (attrdef->name, sizeof (attrdef->name)); - if (ntfs_ucstombs (attrdef->name, namelen, &name, namelen) < 0) { + if (ntfs_ucstombs (attrdef->name, namelen, &name, 0) < 0) { Eprintf ("Couldn't translate attribute type to current locale.\n"); // ? return 0; @@ -568,7 +568,7 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int name = NULL; namelen = attr->name_length; if (ntfs_ucstombs ((ntfschar *)((char *)attr + attr->name_offset), - namelen, &name, namelen) < 0) { + namelen, &name, 0) < 0) { Eprintf ("Couldn't translate attribute name to current locale.\n"); // ? len = snprintf (buffer, bufsize, ""); From 01946494c2687102128ec64ca68699c3f7fafb6e Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 19 Jul 2005 23:22:37 +0000 Subject: [PATCH 2379/2994] Fix typos in ChangeLog --- ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b8636ee8..7d100c42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,13 +6,13 @@ xx/xx/2005 - 1.11.1-WIP 19/07/2005 - 1.11.0 - Fixes and a new utility ntfsmount, a FUSE ntfs module. - - ntfscp: fix signal hanling: handle both SIGTERM and SIGINT, print + - ntfscp: fix signal handling: handle both SIGTERM and SIGINT, print correct message. (Yura) - Update manual pages for ntfsprogs, ntfsclone, ntfsresize and ntfsfix. (Szaka) - ntfsclone: detect and hint users if the destination fs does not support sparse files. (Szaka) - - Fix memory managament error in ntfs_inode_close. (Yura) + - Fix memory management error in ntfs_inode_close. (Yura) - Add new utility - ntfsmount. It is a FUSE module that reles on libntfs. (Yura) - ntfsresize: support bad clusters list ($BadClus:$Bad), a.k.a. disks From 0dac29a487b2e46b721c225d5941d65449cbd00c Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 20 Jul 2005 08:14:52 +0000 Subject: [PATCH 2380/2994] Update for 1.11.1 release. --- ChangeLog | 2 +- Makefile.in | 1 - aclocal.m4 | 520 ++++++---------- config.guess | 64 +- config.sub | 5 +- configure | 1236 +++++++++++++------------------------- configure.ac | 2 +- doc/Makefile.in | 1 - include/Makefile.in | 1 - include/ntfs/Makefile.in | 1 - libntfs/Makefile.in | 1 - ltmain.sh | 156 ++--- ntfsprogs/Makefile.in | 1 - 13 files changed, 704 insertions(+), 1287 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d100c42..c49a5aba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/2005 - 1.11.1-WIP +20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. - ntfsmount: Fix several bugs when too small buffer was allocated for filenames on systems with utf8 locale. (Yura, many thanks to Rich diff --git a/Makefile.in b/Makefile.in index 553116e9..23ba5a81 100644 --- a/Makefile.in +++ b/Makefile.in @@ -144,7 +144,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/aclocal.m4 b/aclocal.m4 index 4ebc090e..2b04da7c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -123,7 +123,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed='sed -e s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -191,7 +191,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -238,48 +238,6 @@ compiler=$CC ])# _LT_AC_SYS_COMPILER -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -AC_DEFUN([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -]) - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -AC_DEFUN([_LT_COMPILER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -AC_DEFUN([_LT_LINKER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_LINKER_BOILERPLATE - - # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -621,10 +579,8 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then $2=yes fi fi @@ -655,11 +611,6 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi else $2=yes fi @@ -729,7 +680,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -1015,9 +965,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi @@ -1516,7 +1464,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1579,11 +1527,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -2573,10 +2517,6 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # # Check for any special shared library compilation flags. # @@ -2709,10 +2649,6 @@ lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -2734,7 +2670,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2995,7 +2931,7 @@ case $host_os in fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -3013,11 +2949,11 @@ case $host_os in dgux*) case $cc_basename in - ec++*) + ec++) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx*) + ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3052,11 +2988,11 @@ case $host_os in # location of the library. case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC*) + aCC) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -3117,11 +3053,11 @@ case $host_os in esac case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC*) + aCC) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -3161,9 +3097,9 @@ case $host_os in ;; irix5* | irix6*) case $cc_basename in - CC*) + CC) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -3174,7 +3110,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -3187,7 +3123,7 @@ case $host_os in ;; linux*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3212,7 +3148,7 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc*) + icpc) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -3237,16 +3173,15 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC) # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx*) + cxx) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -3277,7 +3212,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx*) + cxx) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3316,7 +3251,7 @@ case $host_os in ;; osf3*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3332,14 +3267,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx*) + cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3357,7 +3292,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3376,7 +3311,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3391,17 +3326,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx*) + cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3420,7 +3355,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3444,7 +3379,7 @@ case $host_os in sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3456,12 +3391,12 @@ case $host_os in ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc*) + lcc) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3474,7 +3409,7 @@ case $host_os in ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3488,13 +3423,9 @@ case $host_os in *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3515,7 +3446,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx*) + gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -3558,7 +3489,7 @@ case $host_os in ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3790,16 +3721,12 @@ lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3818,9 +3745,7 @@ aix3*) fi ;; aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi + test "$enable_shared" = yes && enable_static=no ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3876,22 +3801,15 @@ lt_simple_link_test_code='public class conftest { public static void main(String # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds - AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) @@ -3934,16 +3852,11 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) @@ -3973,7 +3886,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -4079,7 +3992,7 @@ ifelse([$1], [], # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -4090,7 +4003,7 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -4173,7 +4086,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4207,7 +4120,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4733,7 +4646,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68*) + cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -4742,7 +4655,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4751,10 +4664,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; dgux*) case $cc_basename in - ec++*) + ec++) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx*) + ghcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4767,14 +4680,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; - aCC*) + aCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -4792,7 +4705,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. @@ -4803,7 +4716,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) case $cc_basename in - KCC*) + KCC) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' @@ -4814,13 +4727,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC*) + pgCC) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - cxx*) + cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -4837,7 +4750,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx*) + cxx) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) @@ -4848,14 +4761,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC*) + KCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC*) + RCC) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx*) + cxx) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -4871,7 +4784,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sco*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) @@ -4880,13 +4793,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; - gcx*) + gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4896,12 +4809,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc*) + lcc) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4911,7 +4824,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -5011,7 +4924,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5059,7 +4972,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5086,14 +4999,9 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac ;; sunos4*) @@ -5223,8 +5131,7 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - _LT_CC_BASENAME([$compiler]) + case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time @@ -5243,28 +5150,7 @@ ifelse([$1],[CXX],[ if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -5333,37 +5219,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -5402,6 +5257,41 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -5412,11 +5302,16 @@ EOF ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -5621,7 +5516,7 @@ EOF _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -5824,7 +5719,7 @@ EOF _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5843,12 +5738,10 @@ EOF solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -5857,18 +5750,8 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - *) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6159,120 +6042,63 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# -# Copyright © 2004 Scott James Remnant . -# -# 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 of the License, 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi - -fi[]dnl -])# PKG_PROG_PKG_CONFIG +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN([PKG_CHECK_MODULES], [ + succeeded=no -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then - pkg_cv_[]$1=$ac_cv_env_[]$1[]_value -elif test -n "$PKG_CONFIG"; then - if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then - pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.in -# -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) -pkg_failed=no -AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], - [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) -AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], - [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes -if test $pkg_failed = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) - ifelse([$4], , [AC_MSG_ERROR(dnl -[Package requirements ($2) were not met. -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details.])], - [$4]) -elif test $pkg_failed = untried; then - ifelse([$4], , [AC_MSG_FAILURE(dnl -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details. -To get pkg-config, see .])], - [$4]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - ifelse([$3], , :, [$3]) -fi[]dnl -])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # diff --git a/config.guess b/config.guess index 892833f9..44f30e6c 100755 --- a/config.guess +++ b/config.guess @@ -136,6 +136,16 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -825,25 +835,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo cris-axis-linux exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo crisv32-axis-linux exit 0 ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo frv-${VENDOR}-linux exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -862,7 +872,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -881,13 +891,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-${VENDOR}-linux exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-${VENDOR}-linux exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -900,34 +910,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-${VENDOR}-linux ;; + PA8*) echo hppa2.0-${VENDOR}-linux ;; + *) echo hppa-${VENDOR}-linux ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-${VENDOR}-linux exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo x86_64-${VENDOR}-linux exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -942,18 +952,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" + echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" + echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or + # Either a pre-BFD a.out linker (linuxoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -982,7 +992,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.sub b/config.sub index d8fd2f8f..c884ad4e 100755 --- a/config.sub +++ b/config.sub @@ -1172,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1205,9 +1205,6 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index f548b2bb..bad44d83 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.11.1-WIP. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.11.1. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.11.1-WIP' -PACKAGE_STRING='ntfsprogs 1.11.1-WIP' +PACKAGE_VERSION='1.11.1' +PACKAGE_STRING='ntfsprogs 1.11.1' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -947,26 +947,6 @@ ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS -ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} -ac_env_PKG_CONFIG_value=$PKG_CONFIG -ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} -ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG -ac_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} -ac_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS -ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} -ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS -ac_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} -ac_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS -ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} -ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS -ac_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} -ac_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS -ac_cv_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} -ac_cv_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS -ac_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} -ac_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS -ac_cv_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} -ac_cv_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS # # Report the --help message. @@ -975,7 +955,7 @@ 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 ntfsprogs 1.11.1-WIP to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.11.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1042,7 +1022,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.11.1-WIP:";; + short | recursive ) echo "Configuration of ntfsprogs 1.11.1:";; esac cat <<\_ACEOF @@ -1090,15 +1070,6 @@ Some influential environment variables: CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags - PKG_CONFIG path to pkg-config utility - LIBNTFS_GNOMEVFS_CFLAGS - C compiler flags for LIBNTFS_GNOMEVFS, overriding pkg-config - LIBNTFS_GNOMEVFS_LIBS - linker flags for LIBNTFS_GNOMEVFS, overriding pkg-config - FUSE_MODULE_CFLAGS - C compiler flags for FUSE_MODULE, overriding pkg-config - FUSE_MODULE_LIBS - linker flags for FUSE_MODULE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1199,7 +1170,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.11.1-WIP +ntfsprogs configure 1.11.1 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1213,7 +1184,7 @@ 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 ntfsprogs $as_me 1.11.1-WIP, which was +It was created by ntfsprogs $as_me 1.11.1, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1941,7 +1912,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.11.1-WIP' + VERSION='1.11.1' cat >>confdefs.h <<_ACEOF @@ -4226,7 +4197,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4229 "configure"' > conftest.$ac_ext + echo '#line 4200 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5570,7 +5541,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5573:" \ +echo "$as_me:5544:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5771,7 +5742,6 @@ else fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -6062,7 +6032,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed='sed -e s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. @@ -6367,16 +6337,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -6564,20 +6525,6 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # # Check for any special shared library compilation flags. # @@ -6619,11 +6566,6 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works=yes - fi else lt_prog_compiler_static_works=yes fi @@ -6668,17 +6610,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6671: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6613: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6675: \$? = $ac_status" >&5 + echo "$as_me:6617: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -6784,7 +6724,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' @@ -6832,7 +6772,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -6859,14 +6799,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac ;; sunos4*) @@ -6930,17 +6865,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6933: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6868: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6937: \$? = $ac_status" >&5 + echo "$as_me:6872: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works=yes fi fi @@ -6992,18 +6925,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6995: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6928: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6999: \$? = $ac_status" >&5 + echo "$as_me:6932: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o=yes fi fi @@ -7083,16 +7014,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -7113,27 +7034,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -7202,37 +7102,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -7271,6 +7140,41 @@ EOF hardcode_shlibpath_var=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds=$archive_cmds + fi + else + ld_shlibs=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -7281,11 +7185,16 @@ EOF ;; esac - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -7592,7 +7501,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -7795,7 +7704,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -7814,12 +7723,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -7828,18 +7735,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs=yes ;; @@ -8376,7 +8273,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -8439,11 +8336,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -9232,7 +9125,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6;} # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -9599,7 +9492,7 @@ echo "$as_me: creating $ofile" >&6;} SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -9681,7 +9574,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9715,7 +9608,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -10070,20 +9963,6 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -10105,16 +9984,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -10584,7 +10454,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -10602,11 +10472,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi dgux*) case $cc_basename in - ec++*) + ec++) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - ghcx*) + ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10641,11 +10511,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # location of the library. case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC*) + aCC) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -10706,11 +10576,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC*) + aCC) case "$host_cpu" in hppa*64*|ia64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -10750,9 +10620,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; irix5* | irix6*) case $cc_basename in - CC*) + CC) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -10763,7 +10633,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -10776,7 +10646,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; linux*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10801,7 +10671,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc*) + icpc) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -10826,16 +10696,15 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC) # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx*) + cxx) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -10866,7 +10735,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; mvs*) case $cc_basename in - cxx*) + cxx) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10905,7 +10774,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf3*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10921,14 +10790,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx*) + cxx) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10946,7 +10815,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10965,7 +10834,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf4* | osf5*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10980,17 +10849,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx*) + cxx) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -11009,7 +10878,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -11033,7 +10902,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi sco*) archive_cmds_need_lc_CXX=no case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -11045,12 +10914,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - lcc*) + lcc) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11063,7 +10932,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -11077,13 +10946,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -11104,7 +10969,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; - gcx*) + gcx) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -11147,7 +11012,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11356,7 +11221,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; chorus*) case $cc_basename in - cxch68*) + cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -11365,7 +11230,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' @@ -11374,10 +11239,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; dgux*) case $cc_basename in - ec++*) + ec++) lt_prog_compiler_pic_CXX='-KPIC' ;; - ghcx*) + ghcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; @@ -11390,14 +11255,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC*) + CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; - aCC*) + aCC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -11415,7 +11280,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC*) + CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. @@ -11426,7 +11291,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) case $cc_basename in - KCC*) + KCC) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' @@ -11437,13 +11302,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; - pgCC*) + pgCC) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-static' ;; - cxx*) + cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -11460,7 +11325,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; mvs*) case $cc_basename in - cxx*) + cxx) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) @@ -11471,14 +11336,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC*) + KCC) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; - RCC*) + RCC) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; - cxx*) + cxx) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -11494,7 +11359,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sco*) case $cc_basename in - CC*) + CC) lt_prog_compiler_pic_CXX='-fPIC' ;; *) @@ -11503,13 +11368,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; - gcx*) + gcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; @@ -11519,12 +11384,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; - lcc*) + lcc) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; @@ -11534,7 +11399,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; @@ -11578,17 +11443,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11581: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11446: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11585: \$? = $ac_status" >&5 + echo "$as_me:11450: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_CXX=yes fi fi @@ -11640,18 +11503,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11643: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11506: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11647: \$? = $ac_status" >&5 + echo "$as_me:11510: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_CXX=yes fi fi @@ -12153,7 +12014,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -12216,11 +12077,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -13009,7 +12866,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 @@ -13738,9 +13572,7 @@ aix3*) fi ;; aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi + test "$enable_shared" = yes && enable_static=no ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 @@ -13846,7 +13678,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' @@ -13894,7 +13726,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' @@ -13921,14 +13753,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_F77='-Qoption ld ';; - *) - lt_prog_compiler_wl_F77='-Wl,';; - esac ;; sunos4*) @@ -13992,17 +13819,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13995: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13822: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13999: \$? = $ac_status" >&5 + echo "$as_me:13826: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_F77=yes fi fi @@ -14054,18 +13879,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14057: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13882: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14061: \$? = $ac_status" >&5 + echo "$as_me:13886: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_F77=yes fi fi @@ -14145,16 +13968,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -14175,27 +13988,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -14264,37 +14056,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_F77=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -14333,6 +14094,41 @@ EOF hardcode_shlibpath_var_F77=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_F77=$archive_cmds_F77 + fi + else + ld_shlibs_F77=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -14343,11 +14139,16 @@ EOF ;; esac - if test "$ld_shlibs_F77" = no; then - runpath_var= - hardcode_libdir_flag_spec_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= + if test "$ld_shlibs_F77" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -14634,7 +14435,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -14837,7 +14638,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' @@ -14856,12 +14657,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -14870,18 +14669,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_F77=yes ;; @@ -15418,7 +15207,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -15481,11 +15270,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15684,7 +15469,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -15833,7 +15618,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -15867,7 +15652,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -16116,41 +15901,15 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no -old_archive_cmds_GCJ=$old_archive_cmds - lt_prog_compiler_no_builtin_flag_GCJ= @@ -16176,17 +15935,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16179: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15938: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16183: \$? = $ac_status" >&5 + echo "$as_me:15942: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -16292,7 +16049,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' @@ -16340,7 +16097,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16367,14 +16124,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_GCJ='-Qoption ld ';; - *) - lt_prog_compiler_wl_GCJ='-Wl,';; - esac ;; sunos4*) @@ -16438,17 +16190,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16441: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16193: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16445: \$? = $ac_status" >&5 + echo "$as_me:16197: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_GCJ=yes fi fi @@ -16500,18 +16250,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16503: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16253: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16507: \$? = $ac_status" >&5 + echo "$as_me:16257: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi @@ -16591,16 +16339,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -16621,27 +16359,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -16710,37 +16427,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_GCJ=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -16779,6 +16465,41 @@ EOF hardcode_shlibpath_var_GCJ=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_GCJ=$archive_cmds_GCJ + fi + else + ld_shlibs_GCJ=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -16789,11 +16510,16 @@ EOF ;; esac - if test "$ld_shlibs_GCJ" = no; then - runpath_var= - hardcode_libdir_flag_spec_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= + if test "$ld_shlibs_GCJ" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -17100,7 +16826,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -17303,7 +17029,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' @@ -17322,12 +17048,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -17336,18 +17060,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_GCJ=yes ;; @@ -17884,7 +17598,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -17947,11 +17661,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -18740,7 +18450,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the @@ -19430,7 +19116,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -19579,7 +19265,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -19613,7 +19299,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -20263,11 +19949,11 @@ if test "$enable_gnome_vfs" != "no"; then export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" fi + succeeded=no -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then @@ -20292,6 +19978,7 @@ do done done + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -20305,123 +19992,56 @@ else echo "${ECHO_T}no" >&6 fi -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 fi -done -done - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 +echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 -if test -n "$ac_pt_PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 -echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - PKG_CONFIG=$ac_pt_PKG_CONFIG -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 -echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - echo "$as_me:$LINENO: result: yes" >&5 + if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - PKG_CONFIG="" - fi + succeeded=yes -fi + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 -pkg_failed=no -echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 -if test "${pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set" = "xset"; then - pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&6 -echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 -if test "${pkg_cv_LIBNTFS_GNOMEVFS_LIBS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set" = "xset"; then - pkg_cv_LIBNTFS_GNOMEVFS_LIBS=$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&6 + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 + else + LIBNTFS_GNOMEVFS_CFLAGS="" + LIBNTFS_GNOMEVFS_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` -if test $pkg_failed = yes; then - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - # Put the nasty error message in config.log where it belongs - echo "$LIBNTFS_GNOMEVFS_PKG_ERRORS" 1>&5 + fi + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + compile_gnome_vfs=true + else + if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} @@ -20431,22 +20051,8 @@ echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi -elif test $pkg_failed = untried; then + fi - if test "$enable_gnome_vfs" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - fi - -else - LIBNTFS_GNOMEVFS_CFLAGS=$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS - LIBNTFS_GNOMEVFS_LIBS=$pkg_cv_LIBNTFS_GNOMEVFS_LIBS - compile_gnome_vfs=true -fi fi @@ -20463,59 +20069,98 @@ fi compile_fuse_module=false if test "$enable_fuse_module" != "no"; then -pkg_failed=no -echo "$as_me:$LINENO: checking for FUSE_MODULE_CFLAGS" >&5 -echo $ECHO_N "checking for FUSE_MODULE_CFLAGS... $ECHO_C" >&6 -if test "${pkg_cv_FUSE_MODULE_CFLAGS+set}" = set; then + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "x$ac_cv_env_FUSE_MODULE_CFLAGS_set" = "xset"; then - pkg_cv_FUSE_MODULE_CFLAGS=$ac_cv_env_FUSE_MODULE_CFLAGS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_CFLAGS" >&5 -echo "${ECHO_T}$pkg_cv_FUSE_MODULE_CFLAGS" >&6 -echo "$as_me:$LINENO: checking for FUSE_MODULE_LIBS" >&5 -echo $ECHO_N "checking for FUSE_MODULE_LIBS... $ECHO_C" >&6 -if test "${pkg_cv_FUSE_MODULE_LIBS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_FUSE_MODULE_LIBS_set" = "xset"; then - pkg_cv_FUSE_MODULE_LIBS=$ac_cv_env_FUSE_MODULE_LIBS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_LIBS" >&5 -echo "${ECHO_T}$pkg_cv_FUSE_MODULE_LIBS" >&6 + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -if test $pkg_failed = yes; then - FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` - # Put the nasty error message in config.log where it belongs - echo "$FUSE_MODULE_PKG_ERRORS" 1>&5 + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for fuse >= 2.3.0" >&5 +echo $ECHO_N "checking for fuse >= 2.3.0... $ECHO_C" >&6 + + if $PKG_CONFIG --exists "fuse >= 2.3.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + succeeded=yes + + echo "$as_me:$LINENO: checking FUSE_MODULE_CFLAGS" >&5 +echo $ECHO_N "checking FUSE_MODULE_CFLAGS... $ECHO_C" >&6 + FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0"` + echo "$as_me:$LINENO: result: $FUSE_MODULE_CFLAGS" >&5 +echo "${ECHO_T}$FUSE_MODULE_CFLAGS" >&6 + + echo "$as_me:$LINENO: checking FUSE_MODULE_LIBS" >&5 +echo $ECHO_N "checking FUSE_MODULE_LIBS... $ECHO_C" >&6 + FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0"` + echo "$as_me:$LINENO: result: $FUSE_MODULE_LIBS" >&5 +echo "${ECHO_T}$FUSE_MODULE_LIBS" >&6 + else + FUSE_MODULE_CFLAGS="" + FUSE_MODULE_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` + + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + compile_fuse_module=true + else if test "$enable_fuse_module" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 @@ -20526,22 +20171,8 @@ echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2 echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} fi -elif test $pkg_failed = untried; then + fi - if test "$enable_fuse_module" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 -echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 -echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} - fi - -else - FUSE_MODULE_CFLAGS=$pkg_cv_FUSE_MODULE_CFLAGS - FUSE_MODULE_LIBS=$pkg_cv_FUSE_MODULE_LIBS - compile_fuse_module=true -fi fi @@ -23486,7 +23117,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.11.1-WIP, which was +This file was extended by ntfsprogs $as_me 1.11.1, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23549,7 +23180,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.11.1-WIP +ntfsprogs config.status 1.11.1 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -23840,7 +23471,6 @@ s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t -s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t diff --git a/configure.ac b/configure.ac index c03f6729..e7a105e9 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.11.1-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.11.1],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) diff --git a/doc/Makefile.in b/doc/Makefile.in index e9a42652..ab7029cb 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -119,7 +119,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/Makefile.in b/include/Makefile.in index 2202b27d..dbaff49f 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -128,7 +128,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 2c384c38..96473220 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -132,7 +132,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 37bab1b3..3b73331f 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -194,7 +194,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/ltmain.sh b/ltmain.sh index eecedf23..3d071010 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -17,7 +17,7 @@ # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,8 +43,8 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.18 -TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)" +VERSION=1.5.14 +TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. @@ -112,9 +112,8 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" +: ${IFS=" +"} if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -251,14 +250,37 @@ func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" + f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else - $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 - exit $EXIT_FAILURE + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ + | $EGREP -v '^[ ]*1[ ]' | while read count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? + i=`expr $i + 1` + done + done + $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" fi } @@ -735,15 +757,6 @@ if test -z "$show_help"; then esac done - qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` - case $qlibobj in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qlibobj="\"$qlibobj\"" ;; - esac - if test "X$libobj" != "X$qlibobj"; then - $echo "$modename: libobj name \`$libobj' may not contain shell special characters." - exit $EXIT_FAILURE - fi objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -816,17 +829,12 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo "$srcfile" > "$lockfile" + $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi - qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` - case $qsrcfile in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qsrcfile="\"$qsrcfile\"" ;; - esac $run $rm "$libobj" "${libobj}T" @@ -848,10 +856,10 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" + command="$base_compile $srcfile $pic_flag" else # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $srcfile" fi if test ! -d "${xdir}$objdir"; then @@ -931,9 +939,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $srcfile" else - command="$base_compile $qsrcfile $pic_flag" + command="$base_compile $srcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -1357,8 +1365,6 @@ EOF ;; darwin_framework) compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" prev= continue ;; @@ -1423,8 +1429,6 @@ EOF -framework) prev=darwin_framework compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" continue ;; @@ -2848,13 +2852,13 @@ EOF *) continue ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac done fi # link_all_deplibs != no fi # linkmode = lib @@ -3120,7 +3124,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3129,7 +3133,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3138,7 +3142,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -5087,63 +5091,6 @@ fi\ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "copying selected object files to avoid basename conflicts..." - - if test -z "$gentop"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - fi - - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - counter=`expr $counter + 1` - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - $run ln "$obj" "$gentop/$newobj" || - $run cp "$obj" "$gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5157,7 +5104,20 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -6066,14 +6026,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" + exec_cmd="\"\$cmd\"$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - $echo "$cmd$args" + eval \$echo \"\$cmd\"$args exit $EXIT_SUCCESS fi ;; diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 88ee90a0..d34ddafc 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -246,7 +246,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ From e55c6769e1ab59b0e65a0c5eb862d300963df316 Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 20 Jul 2005 10:59:06 +0000 Subject: [PATCH 2381/2994] Apply some updates after doing some reverse engineering. --- ntfsprogs/decrypt.c | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 1bbf8e07..4431785b 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -76,8 +76,9 @@ static HMODULE hCrypt32 = INVALID_HANDLE_VALUE; #include #include -#define CALG_DESX (0x6603) -#define CALG_3DES (0x6604) +/* If not one of the below three, use standard Des. */ +#define CALG_3DES (0x6603) +#define CALG_DESX (0x6604) #define CALG_AES_256 (0x6610) #endif /* defined(__CYGWIN__) */ @@ -436,23 +437,16 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, } } - switch (dkey->gcry_algo) { - case GCRY_CIPHER_DES_SK: - // don't know! - case GCRY_CIPHER_3DES: - ((unsigned long long *)data)[0] ^= - 0x169119629891ad13LL + offset; - break; - case GCRY_CIPHER_AES256: - ((unsigned long long *)data)[0] ^= - 0x5816657be9161312LL + offset; - ((unsigned long long *)data)[1] ^= - 0x1989adbe44918961LL + offset; - break; - default: - break; + if (dkey->gcry_algo == GCRY_CIPHER_AES256) { + ((unsigned long long *)data)[0] ^= + 0x5816657be9161312LL + offset; + ((unsigned long long *)data)[1] ^= + 0x1989adbe44918961LL + offset; + } else { + /* All other algos (Des, 3Des, DesX) use the same IV. */ + ((unsigned long long *)data)[0] ^= + 0x169119629891ad13LL + offset; } - return 512; } @@ -468,6 +462,7 @@ static decrypt_key *decrypt_make_gcry_key(char *key_data, int gcry_algo) { switch (gcry_algo) { case GCRY_CIPHER_DES_SK: + /* FIXME: This should be MODE_CBC, no? */ gcry_mode = GCRY_CIPHER_MODE_ECB; gcry_length = 8; break; @@ -480,6 +475,7 @@ static decrypt_key *decrypt_make_gcry_key(char *key_data, int gcry_algo) { gcry_length = 32; break; default: + /* FIXME: This should use standard Des. */ errno = ENOTSUP; return 0; } @@ -501,9 +497,9 @@ static decrypt_key *decrypt_make_gcry_key(char *key_data, int gcry_algo) { } decrypt_key *decrypt_make_key( - decrypt_session *session __attribute__((unused)), - unsigned int data_size __attribute__((unused)), - void *data) { + decrypt_session *session __attribute__((unused)), + unsigned int data_size __attribute__((unused)), + void *data) { unsigned int key_size, alg_id; char *key_data; @@ -526,10 +522,9 @@ decrypt_key *decrypt_make_key( return decrypt_make_gcry_key(key_data, GCRY_CIPHER_AES256); default: - fprintf(stderr, "Error: Unknown algorithm: 0x%x\n", - (unsigned int)alg_id); + //fprintf(stderr, "DES key of %u bytes\n", key_size); + fprintf(stderr, "DES is not supported yet.\n"); errno = ENOTSUP; return NULL; } - } From 0f4d02e9e479c09821cc5e655ddbf8093b89af32 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 20 Jul 2005 16:04:40 +0000 Subject: [PATCH 2382/2994] ntfsls: not all files started with '$' are system files, check by inode number instead. --- ntfsprogs/ntfsls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index e61613c5..eb0ac93a 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -481,7 +481,7 @@ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, } result = 0; // These are successful - if ((filename[0] == '$') && (!opts.system)) + if ((MREF(mref) < FILE_first_user) && (!opts.system)) goto free; if (name_type == FILE_NAME_POSIX && !opts.all) goto free; From b39a2a401fc9a0c4c6fc4f3cafb2c2c729c74ee9 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 20 Jul 2005 19:06:28 +0000 Subject: [PATCH 2383/2994] - Move ntfs2utc and utc2ntfs from utils.[ch] to timeconv.h. - Add [acm]time fields to struct ntfs_inode and set them during ntfs_inode_open. Update ntfsmount to use them. - Bump version, update autoscripts. --- ChangeLog | 7 + Makefile.in | 1 + aclocal.m4 | 520 ++++++++++------ config.guess | 64 +- config.sub | 5 +- configure | 1232 +++++++++++++++++++++++++------------- configure.ac | 2 +- doc/Makefile.in | 1 + include/Makefile.in | 1 + include/ntfs/Makefile.am | 1 + include/ntfs/Makefile.in | 2 + include/ntfs/inode.h | 7 +- include/ntfs/timeconv.h | 64 ++ libntfs/Makefile.in | 1 + libntfs/inode.c | 5 + ltmain.sh | 156 +++-- ntfsprogs/Makefile.in | 1 + ntfsprogs/mkntfs.c | 1 + ntfsprogs/ntfsinfo.c | 1 + ntfsprogs/ntfsls.c | 1 + ntfsprogs/ntfsmount.c | 9 +- ntfsprogs/ntfsrm.c | 1 + ntfsprogs/ntfsundelete.c | 2 +- ntfsprogs/utils.c | 37 -- ntfsprogs/utils.h | 3 - 25 files changed, 1376 insertions(+), 749 deletions(-) create mode 100644 include/ntfs/timeconv.h diff --git a/ChangeLog b/ChangeLog index c49a5aba..69cf6b6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +xx/xx/xxxx - 1.12.0-WIP + + - ntfsls: fix showing not system files started with '$'. (Yura) + - Move ntfs2utc and utc2ntfs from utils.[ch] to timeconv.h. (Yura) + - Add [acm]time fields to struct ntfs_inode and set them during + ntfs_inode_open. Update ntfsmount to use them. (Yura) + 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. - ntfsmount: Fix several bugs when too small buffer was allocated for diff --git a/Makefile.in b/Makefile.in index 23ba5a81..553116e9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -144,6 +144,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/aclocal.m4 b/aclocal.m4 index 2b04da7c..4ebc090e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -123,7 +123,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -191,7 +191,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -238,6 +238,48 @@ compiler=$CC ])# _LT_AC_SYS_COMPILER +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +AC_DEFUN([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +AC_DEFUN([_LT_COMPILER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +AC_DEFUN([_LT_LINKER_BOILERPLATE], +[ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* +])# _LT_LINKER_BOILERPLATE + + # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -579,8 +621,10 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi @@ -611,6 +655,11 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi else $2=yes fi @@ -680,6 +729,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -965,7 +1015,9 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi @@ -1464,7 +1516,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1527,7 +1579,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -2517,6 +2573,10 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # # Check for any special shared library compilation flags. # @@ -2649,6 +2709,10 @@ lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -2670,7 +2734,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2931,7 +2995,7 @@ case $host_os in fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -2949,11 +3013,11 @@ case $host_os in dgux*) case $cc_basename in - ec++) + ec++*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -2988,11 +3052,11 @@ case $host_os in # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) + aCC*) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -3053,11 +3117,11 @@ case $host_os in esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) + aCC*) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -3097,9 +3161,9 @@ case $host_os in ;; irix5* | irix6*) case $cc_basename in - CC) + CC*) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -3110,7 +3174,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -3123,7 +3187,7 @@ case $host_os in ;; linux*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3148,7 +3212,7 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -3173,15 +3237,16 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC) + pgCC*) # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx) + cxx*) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -3212,7 +3277,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3251,7 +3316,7 @@ case $host_os in ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3267,14 +3332,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3292,7 +3357,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3311,7 +3376,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3326,17 +3391,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3355,7 +3420,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3379,7 +3444,7 @@ case $host_os in sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3391,12 +3456,12 @@ case $host_os in ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3409,7 +3474,7 @@ case $host_os in ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3423,9 +3488,13 @@ case $host_os in *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3446,7 +3515,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -3489,7 +3558,7 @@ case $host_os in ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3721,12 +3790,16 @@ lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3745,7 +3818,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3801,15 +3876,22 @@ lt_simple_link_test_code='public class conftest { public static void main(String # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) @@ -3852,11 +3934,16 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) @@ -3886,7 +3973,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -3992,7 +4079,7 @@ ifelse([$1], [], # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -4003,7 +4090,7 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -4086,7 +4173,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4120,7 +4207,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4646,7 +4733,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68) + cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -4655,7 +4742,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4664,10 +4751,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; dgux*) case $cc_basename in - ec++) + ec++*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4680,14 +4767,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; - aCC) + aCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -4705,7 +4792,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. @@ -4716,7 +4803,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' @@ -4727,13 +4814,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC) + pgCC*) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - cxx) + cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -4750,7 +4837,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx) + cxx*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) @@ -4761,14 +4848,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx) + cxx*) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -4784,7 +4871,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sco*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) @@ -4793,13 +4880,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; - gcx) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4809,12 +4896,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc) + lcc*) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4824,7 +4911,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -4924,7 +5011,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4972,7 +5059,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4999,9 +5086,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac ;; sunos4*) @@ -5131,7 +5223,8 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - + # Just being paranoid about ensuring that cc_basename is set. + _LT_CC_BASENAME([$compiler]) case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time @@ -5150,7 +5243,28 @@ ifelse([$1],[CXX],[ if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -5219,6 +5333,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -5257,41 +5402,6 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -5302,16 +5412,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -5516,7 +5621,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -5719,7 +5824,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5738,10 +5843,12 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -5750,8 +5857,18 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6042,63 +6159,120 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# 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 of the License, 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. -dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ - succeeded=no +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG - if test -z "$PKG_CONFIG"; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - fi +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then + pkg_cv_[]$1=$ac_cv_env_[]$1[]_value +elif test -n "$PKG_CONFIG"; then + if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then + pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - AC_MSG_CHECKING(for $2) +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.in +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - if $PKG_CONFIG --exists "$2" ; then - AC_MSG_RESULT(yes) - succeeded=yes +pkg_failed=no +AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], + [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) +AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], + [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) - AC_MSG_CHECKING($1_CFLAGS) - $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` - AC_MSG_RESULT($$1_CFLAGS) +if test $pkg_failed = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD - AC_MSG_CHECKING($1_LIBS) - $1_LIBS=`$PKG_CONFIG --libs "$2"` - AC_MSG_RESULT($$1_LIBS) - else - $1_CFLAGS="" - $1_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - ifelse([$4], ,echo $$1_PKG_ERRORS,) - fi + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met. +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. - AC_SUBST($1_CFLAGS) - AC_SUBST($1_LIBS) - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - ifelse([$3], , :, [$3]) - else - ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) - fi -]) +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details.])], + [$4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. +Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables +to avoid the need to call pkg-config. See the pkg-config man page for +more details. +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # diff --git a/config.guess b/config.guess index 44f30e6c..892833f9 100755 --- a/config.guess +++ b/config.guess @@ -136,16 +136,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -835,25 +825,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux + echo cris-axis-linux-gnu exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux + echo crisv32-axis-linux-gnu exit 0 ;; frv:Linux:*:*) - echo frv-${VENDOR}-linux + echo frv-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -872,7 +862,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -891,13 +881,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux + echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux + echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -910,34 +900,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux + echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux + echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux + echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -952,18 +942,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" + echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" + echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linuxoldld) or + # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -992,7 +982,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.sub b/config.sub index c884ad4e..d8fd2f8f 100755 --- a/config.sub +++ b/config.sub @@ -1172,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1205,6 +1205,9 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index bad44d83..e891f2e2 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.11.1. +# Generated by GNU Autoconf 2.59 for ntfsprogs 1.12.0-WIP. # # Report bugs to . # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ntfsprogs' PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.11.1' -PACKAGE_STRING='ntfsprogs 1.11.1' +PACKAGE_VERSION='1.12.0-WIP' +PACKAGE_STRING='ntfsprogs 1.12.0-WIP' PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' ac_unique_file="config.h.in" @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -947,6 +947,26 @@ ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS +ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_env_PKG_CONFIG_value=$PKG_CONFIG +ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG +ac_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} +ac_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS +ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} +ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS +ac_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} +ac_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS +ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} +ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS +ac_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} +ac_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS +ac_cv_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} +ac_cv_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS +ac_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} +ac_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS +ac_cv_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} +ac_cv_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS # # Report the --help message. @@ -955,7 +975,7 @@ 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 ntfsprogs 1.11.1 to adapt to many kinds of systems. +\`configure' configures ntfsprogs 1.12.0-WIP to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1022,7 +1042,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.11.1:";; + short | recursive ) echo "Configuration of ntfsprogs 1.12.0-WIP:";; esac cat <<\_ACEOF @@ -1070,6 +1090,15 @@ Some influential environment variables: CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags + PKG_CONFIG path to pkg-config utility + LIBNTFS_GNOMEVFS_CFLAGS + C compiler flags for LIBNTFS_GNOMEVFS, overriding pkg-config + LIBNTFS_GNOMEVFS_LIBS + linker flags for LIBNTFS_GNOMEVFS, overriding pkg-config + FUSE_MODULE_CFLAGS + C compiler flags for FUSE_MODULE, overriding pkg-config + FUSE_MODULE_LIBS + linker flags for FUSE_MODULE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1170,7 +1199,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -ntfsprogs configure 1.11.1 +ntfsprogs configure 1.12.0-WIP generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1184,7 +1213,7 @@ 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 ntfsprogs $as_me 1.11.1, which was +It was created by ntfsprogs $as_me 1.12.0-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1912,7 +1941,7 @@ fi # Define the identity of the package. PACKAGE='ntfsprogs' - VERSION='1.11.1' + VERSION='1.12.0-WIP' cat >>confdefs.h <<_ACEOF @@ -4197,7 +4226,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4200 "configure"' > conftest.$ac_ext + echo '#line 4229 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5541,7 +5570,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5544:" \ +echo "$as_me:5573:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5742,6 +5771,7 @@ else fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -6032,7 +6062,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. @@ -6337,7 +6367,16 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -6525,6 +6564,20 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # # Check for any special shared library compilation flags. # @@ -6566,6 +6619,11 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 + $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_prog_compiler_static_works=yes + fi else lt_prog_compiler_static_works=yes fi @@ -6610,15 +6668,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6613: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6671: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6617: \$? = $ac_status" >&5 + echo "$as_me:6675: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -6724,7 +6784,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' @@ -6772,7 +6832,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -6799,9 +6859,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac ;; sunos4*) @@ -6865,15 +6930,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6868: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6933: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6872: \$? = $ac_status" >&5 + echo "$as_me:6937: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works=yes fi fi @@ -6925,16 +6992,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6928: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6995: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6932: \$? = $ac_status" >&5 + echo "$as_me:6999: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi @@ -7014,6 +7083,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -7034,6 +7113,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -7102,6 +7202,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -7140,41 +7271,6 @@ EOF hardcode_shlibpath_var=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds=$archive_cmds - fi - else - ld_shlibs=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -7185,16 +7281,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -7501,7 +7592,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -7704,7 +7795,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -7723,10 +7814,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -7735,8 +7828,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs=yes ;; @@ -8273,7 +8376,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -8336,7 +8439,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -9125,7 +9232,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6;} # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -9492,7 +9599,7 @@ echo "$as_me: creating $ofile" >&6;} SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -9574,7 +9681,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9608,7 +9715,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -9963,6 +10070,20 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -9984,7 +10105,16 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -10454,7 +10584,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -10472,11 +10602,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi dgux*) case $cc_basename in - ec++) + ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10511,11 +10641,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC) + aCC*) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -10576,11 +10706,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC) + aCC*) case "$host_cpu" in hppa*64*|ia64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -10620,9 +10750,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; irix5* | irix6*) case $cc_basename in - CC) + CC*) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -10633,7 +10763,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -10646,7 +10776,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; linux*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10671,7 +10801,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + icpc*) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -10696,15 +10826,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC) + pgCC*) # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx) + cxx*) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -10735,7 +10866,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10774,7 +10905,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10790,14 +10921,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx) + cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10815,7 +10946,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10834,7 +10965,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10849,17 +10980,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx) + cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -10878,7 +11009,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10902,7 +11033,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi sco*) archive_cmds_need_lc_CXX=no case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10914,12 +11045,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10932,7 +11063,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -10946,9 +11077,13 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -10969,7 +11104,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -11012,7 +11147,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11221,7 +11356,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; chorus*) case $cc_basename in - cxch68) + cxch68*) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -11230,7 +11365,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' @@ -11239,10 +11374,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; dgux*) case $cc_basename in - ec++) + ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; @@ -11255,14 +11390,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; - aCC) + aCC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -11280,7 +11415,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC) + CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. @@ -11291,7 +11426,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' @@ -11302,13 +11437,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; - pgCC) + pgCC*) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-static' ;; - cxx) + cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -11325,7 +11460,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; mvs*) case $cc_basename in - cxx) + cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) @@ -11336,14 +11471,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; - cxx) + cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -11359,7 +11494,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sco*) case $cc_basename in - CC) + CC*) lt_prog_compiler_pic_CXX='-fPIC' ;; *) @@ -11368,13 +11503,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) case $cc_basename in - CC) + CC*) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; - gcx) + gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; @@ -11384,12 +11519,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; - lcc) + lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; @@ -11399,7 +11534,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; @@ -11443,15 +11578,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11446: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11581: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11450: \$? = $ac_status" >&5 + echo "$as_me:11585: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_CXX=yes fi fi @@ -11503,16 +11640,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11506: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11643: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11510: \$? = $ac_status" >&5 + echo "$as_me:11647: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_CXX=yes fi fi @@ -12014,7 +12153,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -12077,7 +12216,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -12866,7 +13009,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 @@ -13572,7 +13738,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 @@ -13678,7 +13846,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' @@ -13726,7 +13894,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' @@ -13753,9 +13921,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_F77='-Qoption ld ';; + *) + lt_prog_compiler_wl_F77='-Wl,';; + esac ;; sunos4*) @@ -13819,15 +13992,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13822: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13995: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13826: \$? = $ac_status" >&5 + echo "$as_me:13999: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_F77=yes fi fi @@ -13879,16 +14054,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13882: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14057: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13886: \$? = $ac_status" >&5 + echo "$as_me:14061: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_F77=yes fi fi @@ -13968,6 +14145,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -13988,6 +14175,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -14056,6 +14264,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_F77=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -14094,41 +14333,6 @@ EOF hardcode_shlibpath_var_F77=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_F77=$archive_cmds_F77 - fi - else - ld_shlibs_F77=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -14139,16 +14343,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs_F77" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi + if test "$ld_shlibs_F77" = no; then + runpath_var= + hardcode_libdir_flag_spec_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -14435,7 +14634,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -14638,7 +14837,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' @@ -14657,10 +14856,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -14669,8 +14870,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs_F77=yes ;; @@ -15207,7 +15418,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -15270,7 +15481,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15469,7 +15684,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -15618,7 +15833,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -15652,7 +15867,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -15901,15 +16116,41 @@ LTCC=${LTCC-"$CC"} compiler=$CC +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no +old_archive_cmds_GCJ=$old_archive_cmds + lt_prog_compiler_no_builtin_flag_GCJ= @@ -15935,15 +16176,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15938: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16179: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15942: \$? = $ac_status" >&5 + echo "$as_me:16183: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -16049,7 +16292,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in + case $cc_basename in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' @@ -16097,7 +16340,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - pgcc | pgf77 | pgf90) + pgcc* | pgf77* | pgf90*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16124,9 +16367,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) - lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_GCJ='-Qoption ld ';; + *) + lt_prog_compiler_wl_GCJ='-Wl,';; + esac ;; sunos4*) @@ -16190,15 +16438,17 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16193: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16441: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16197: \$? = $ac_status" >&5 + echo "$as_me:16445: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # So say no if there are warnings other than the usual output. + $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp + $SED '/^$/d' conftest.err >conftest.er2 + if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then lt_prog_compiler_pic_works_GCJ=yes fi fi @@ -16250,16 +16500,18 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16253: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16503: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16257: \$? = $ac_status" >&5 + echo "$as_me:16507: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp + $SED '/^$/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi @@ -16339,6 +16591,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= + # Just being paranoid about ensuring that cc_basename is set. + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -16359,6 +16621,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -16427,6 +16710,37 @@ EOF fi ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + $echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_GCJ=no + fi + ;; + netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -16465,41 +16779,6 @@ EOF hardcode_shlibpath_var_GCJ=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_GCJ=$archive_cmds_GCJ - fi - else - ld_shlibs_GCJ=no - fi - ;; - *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -16510,16 +16789,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs_GCJ" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi + if test "$ld_shlibs_GCJ" = no; then + runpath_var= + hardcode_libdir_flag_spec_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -16826,7 +17100,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case "$cc_basename" in + case $cc_basename in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -17029,7 +17303,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' @@ -17048,10 +17322,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then + wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else + wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -17060,8 +17336,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs_GCJ=yes ;; @@ -17598,7 +17884,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -17661,7 +17947,11 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - need_version=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -18450,7 +18740,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$rm conftest* + +ac_outfile=conftest.$ac_objext +printf "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$rm conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the @@ -19116,7 +19430,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -19265,7 +19579,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS=$lt_AS +AS="$AS" # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -19299,7 +19613,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -19949,11 +20263,11 @@ if test "$enable_gnome_vfs" != "no"; then export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" fi - succeeded=no - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; 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_path_PKG_CONFIG+set}" = set; then @@ -19978,7 +20292,6 @@ do done done - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -19992,56 +20305,123 @@ else echo "${ECHO_T}no" >&6 fi +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done +done - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 -echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG - if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then - echo "$as_me:$LINENO: result: yes" >&5 +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + PKG_CONFIG=$ac_pt_PKG_CONFIG +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - succeeded=yes + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + PKG_CONFIG="" + fi - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 +fi - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 - else - LIBNTFS_GNOMEVFS_CFLAGS="" - LIBNTFS_GNOMEVFS_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` +pkg_failed=no +echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 +if test "${pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set" = "xset"; then + pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&6 +echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 +if test "${pkg_cv_LIBNTFS_GNOMEVFS_LIBS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set" = "xset"; then + pkg_cv_LIBNTFS_GNOMEVFS_LIBS=$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&6 - fi +if test $pkg_failed = yes; then + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + # Put the nasty error message in config.log where it belongs + echo "$LIBNTFS_GNOMEVFS_PKG_ERRORS" 1>&5 - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_gnome_vfs=true - else - if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} @@ -20051,8 +20431,22 @@ echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi - fi +elif test $pkg_failed = untried; then + if test "$enable_gnome_vfs" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 +echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} + fi + +else + LIBNTFS_GNOMEVFS_CFLAGS=$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS + LIBNTFS_GNOMEVFS_LIBS=$pkg_cv_LIBNTFS_GNOMEVFS_LIBS + compile_gnome_vfs=true +fi fi @@ -20069,98 +20463,59 @@ fi compile_fuse_module=false if test "$enable_fuse_module" != "no"; then - succeeded=no - - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then +pkg_failed=no +echo "$as_me:$LINENO: checking for FUSE_MODULE_CFLAGS" >&5 +echo $ECHO_N "checking for FUSE_MODULE_CFLAGS... $ECHO_C" >&6 +if test "${pkg_cv_FUSE_MODULE_CFLAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 + if test "x$ac_cv_env_FUSE_MODULE_CFLAGS_set" = "xset"; then + pkg_cv_FUSE_MODULE_CFLAGS=$ac_cv_env_FUSE_MODULE_CFLAGS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0" 2>/dev/null` + else + pkg_failed=yes + fi else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + pkg_failed=untried fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_CFLAGS" >&5 +echo "${ECHO_T}$pkg_cv_FUSE_MODULE_CFLAGS" >&6 +echo "$as_me:$LINENO: checking for FUSE_MODULE_LIBS" >&5 +echo $ECHO_N "checking for FUSE_MODULE_LIBS... $ECHO_C" >&6 +if test "${pkg_cv_FUSE_MODULE_LIBS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$ac_cv_env_FUSE_MODULE_LIBS_set" = "xset"; then + pkg_cv_FUSE_MODULE_LIBS=$ac_cv_env_FUSE_MODULE_LIBS_value +elif test -n "$PKG_CONFIG"; then + if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 + ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0" 2>/dev/null` + else + pkg_failed=yes + fi +else + pkg_failed=untried +fi +fi +echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_LIBS" >&5 +echo "${ECHO_T}$pkg_cv_FUSE_MODULE_LIBS" >&6 - fi +if test $pkg_failed = yes; then + FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` + # Put the nasty error message in config.log where it belongs + echo "$FUSE_MODULE_PKG_ERRORS" 1>&5 - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for fuse >= 2.3.0" >&5 -echo $ECHO_N "checking for fuse >= 2.3.0... $ECHO_C" >&6 - - if $PKG_CONFIG --exists "fuse >= 2.3.0" ; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - succeeded=yes - - echo "$as_me:$LINENO: checking FUSE_MODULE_CFLAGS" >&5 -echo $ECHO_N "checking FUSE_MODULE_CFLAGS... $ECHO_C" >&6 - FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0"` - echo "$as_me:$LINENO: result: $FUSE_MODULE_CFLAGS" >&5 -echo "${ECHO_T}$FUSE_MODULE_CFLAGS" >&6 - - echo "$as_me:$LINENO: checking FUSE_MODULE_LIBS" >&5 -echo $ECHO_N "checking FUSE_MODULE_LIBS... $ECHO_C" >&6 - FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0"` - echo "$as_me:$LINENO: result: $FUSE_MODULE_LIBS" >&5 -echo "${ECHO_T}$FUSE_MODULE_LIBS" >&6 - else - FUSE_MODULE_CFLAGS="" - FUSE_MODULE_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` - - fi - - - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_fuse_module=true - else if test "$enable_fuse_module" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 @@ -20171,8 +20526,22 @@ echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2 echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} fi - fi +elif test $pkg_failed = untried; then + if test "$enable_fuse_module" = "yes"; then + { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 +echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 +echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} + fi + +else + FUSE_MODULE_CFLAGS=$pkg_cv_FUSE_MODULE_CFLAGS + FUSE_MODULE_LIBS=$pkg_cv_FUSE_MODULE_LIBS + compile_fuse_module=true +fi fi @@ -23117,7 +23486,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by ntfsprogs $as_me 1.11.1, which was +This file was extended by ntfsprogs $as_me 1.12.0-WIP, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -23180,7 +23549,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ntfsprogs config.status 1.11.1 +ntfsprogs config.status 1.12.0-WIP configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -23471,6 +23840,7 @@ s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t diff --git a/configure.ac b/configure.ac index e7a105e9..66169e74 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.11.1],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.12.0-WIP],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) diff --git a/doc/Makefile.in b/doc/Makefile.in index ab7029cb..e9a42652 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -119,6 +119,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/Makefile.in b/include/Makefile.in index dbaff49f..2202b27d 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -128,6 +128,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/ntfs/Makefile.am b/include/ntfs/Makefile.am index a9de87ec..48c565d4 100644 --- a/include/ntfs/Makefile.am +++ b/include/ntfs/Makefile.am @@ -26,6 +26,7 @@ linux_ntfsinclude_HEADERS = \ runlist.h \ security.h \ support.h \ + timeconv.h \ types.h \ unistr.h \ volume.h diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 96473220..42ae6fb4 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -132,6 +132,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ @@ -202,6 +203,7 @@ linux_ntfsinclude_HEADERS = \ runlist.h \ security.h \ support.h \ + timeconv.h \ types.h \ unistr.h \ volume.h diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index d5310cb3..4718a909 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -139,9 +139,14 @@ struct _ntfs_inode { void *private_data; /* Temp: for directory handling */ int ref_count; - /* Belows fields needed to update indexes. They valid if != -1. */ + + /* Below 2 fields needed to update indexes. They valid if != -1. */ s64 data_size; s64 allocated_size; + + time_t atime; /* Last access to the data within the file. */ + time_t mtime; /* Last change of the data within the file. */ + time_t ctime; /* Last change of the metadata of the file. */ }; extern ntfs_inode *ntfs_inode_allocate(ntfs_volume *vol); diff --git a/include/ntfs/timeconv.h b/include/ntfs/timeconv.h new file mode 100644 index 00000000..eba91504 --- /dev/null +++ b/include/ntfs/timeconv.h @@ -0,0 +1,64 @@ +/* + * timeconv.h - NTFS time conversion functions. Part of the Linux-NTFS project. + * + * Copyright (c) 2005 Yura Pakhuchiy + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_TIMECONV_H +#define _NTFS_TIMECONV_H + +#include + +#define NTFS_TIME_OFFSET ((s64)(369 * 365 + 89) * 24 * 3600 * 10000000) + +/** + * ntfs2utc - Convert an NTFS time to Unix time + * @ntfs_time: An NTFS time in 100ns units since 1601 + * + * NTFS stores times as the number of 100ns intervals since January 1st 1601 at + * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. + * + * Return: n A Unix time (number of seconds since 1970) + */ +static __inline__ time_t ntfs2utc(s64 ntfs_time) +{ + return (ntfs_time - (NTFS_TIME_OFFSET)) / 10000000; +} + +/** + * utc2ntfs - Convert Linux time to NTFS time + * @utc_time: Linux time to convert to NTFS + * + * Convert the Linux time @utc_time to its corresponding NTFS time. + * + * Linux stores time in a long at present and measures it as the number of + * 1-second intervals since 1st January 1970, 00:00:00 UTC. + * + * NTFS uses Microsoft's standard time format which is stored in a s64 and is + * measured as the number of 100 nano-second intervals since 1st January 1601, + * 00:00:00 UTC. + * + * Return: n An NTFS time (100ns units since Jan 1601) + */ +static __inline__ s64 utc2ntfs(time_t utc_time) +{ + /* Convert to 100ns intervals and then add the NTFS time offset. */ + return (s64)utc_time * 10000000 + NTFS_TIME_OFFSET; +} + +#endif /* _NTFS_TIMECONV_H */ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 3b73331f..37bab1b3 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -194,6 +194,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/libntfs/inode.c b/libntfs/inode.c index 49a1f493..26d2fcdc 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -38,6 +38,7 @@ #include "lcnalloc.h" #include "index.h" #include "dir.h" +#include "timeconv.h" /** * Internal: @@ -146,6 +147,10 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) NInoSetEncrypted(ni); if (std_info->file_attributes & FILE_ATTR_SPARSE_FILE) NInoSetSparse(ni); + ni->mtime = ntfs2utc(sle64_to_cpu(std_info->last_data_change_time)); + ni->ctime = ntfs2utc(sle64_to_cpu(std_info->last_mft_change_time)); + ni->atime = ntfs2utc(sle64_to_cpu(std_info->last_access_time)); + /* Set attribute list information. */ if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { if (errno != ENOENT) diff --git a/ltmain.sh b/ltmain.sh index 3d071010..eecedf23 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -17,7 +17,7 @@ # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,8 +43,8 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.14 -TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" +VERSION=1.5.18 +TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. @@ -112,8 +112,9 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -: ${IFS=" -"} +lt_nl=' +' +IFS=" $lt_nl" if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -250,37 +251,14 @@ func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" - f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" - $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ - | $EGREP -v '^[ ]*1[ ]' | while read count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? - i=`expr $i + 1` - done - done - $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 + exit $EXIT_FAILURE fi } @@ -757,6 +735,15 @@ if test -z "$show_help"; then esac done + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` + case $qlibobj in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qlibobj="\"$qlibobj\"" ;; + esac + if test "X$libobj" != "X$qlibobj"; then + $echo "$modename: libobj name \`$libobj' may not contain shell special characters." + exit $EXIT_FAILURE + fi objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -829,12 +816,17 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo $srcfile > "$lockfile" + $echo "$srcfile" > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` + case $qsrcfile in + *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") + qsrcfile="\"$qsrcfile\"" ;; + esac $run $rm "$libobj" "${libobj}T" @@ -856,10 +848,10 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" fi if test ! -d "${xdir}$objdir"; then @@ -939,9 +931,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $srcfile" + command="$base_compile $qsrcfile" else - command="$base_compile $srcfile $pic_flag" + command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -1365,6 +1357,8 @@ EOF ;; darwin_framework) compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" prev= continue ;; @@ -1429,6 +1423,8 @@ EOF -framework) prev=darwin_framework compiler_flags="$compiler_flags $arg" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" continue ;; @@ -2852,12 +2848,12 @@ EOF *) continue ;; esac case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; esac done fi # link_all_deplibs != no @@ -3124,7 +3120,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3133,7 +3129,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3142,7 +3138,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -5091,6 +5087,63 @@ fi\ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "copying selected object files to avoid basename conflicts..." + + if test -z "$gentop"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + fi + + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + counter=`expr $counter + 1` + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + $run ln "$obj" "$gentop/$newobj" || + $run cp "$obj" "$gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5104,20 +5157,7 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi + # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -6026,14 +6066,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\"\$cmd\"$args" + exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - eval \$echo \"\$cmd\"$args + $echo "$cmd$args" exit $EXIT_SUCCESS fi ;; diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index d34ddafc..88ee90a0 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -246,6 +246,7 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index cae40fb4..b1b55a28 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -126,6 +126,7 @@ #include "mst.h" #include "runlist.h" #include "utils.h" +#include "timeconv.h" #ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS # error "No default device io operations! Cannot build mkntfs. \ diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 5cd08fa5..833d897c 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -65,6 +65,7 @@ #include "security.h" #include "mst.h" #include "dir.h" +#include "timeconv.h" static const char *EXEC_NAME = "ntfsinfo"; diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index eb0ac93a..653cabe3 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -40,6 +40,7 @@ #include "utils.h" #include "dir.h" #include "list.h" +#include "timeconv.h" static const char *EXEC_NAME = "ntfsls"; diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 6d77f15d..65c90dde 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -283,12 +283,9 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) stbuf->st_gid = ctx->gid; stbuf->st_ino = ni->mft_no; stbuf->st_nlink = le16_to_cpu(ni->mrec->link_count); - /* - * TODO: Need support in libntfs for this. - * stbuf->st_atime = - * stbuf->st_ctime = - * stbuf->st_mtime = - */ + stbuf->st_atime = ni->atime; + stbuf->st_ctime = ni->ctime; + stbuf->st_mtime = ni->mtime; ntfs_inode_close(ni); } else res = -ENOENT; diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 6df0669b..7353adea 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -33,6 +33,7 @@ #include "dir.h" #include "lcnalloc.h" #include "mft.h" +#include "timeconv.h" static const char *EXEC_NAME = "ntfsrm"; static struct options opts; diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index d2b7978c..4f487281 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -53,6 +52,7 @@ #include "device.h" #include "utils.h" #include "debug.h" +#include "timeconv.h" static const char *EXEC_NAME = "ntfsundelete"; static const char *MFTFILE = "mft"; diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index c9caacbb..d3cdebad 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -56,8 +56,6 @@ const char *ntfs_gpl = "This program is free software, released under the GNU " "\"COPYING\" distributed with this program, or online at:\n" "http://www.gnu.org/copyleft/gpl.html\n"; -#define NTFS_TIME_OFFSET ((s64)(369 * 365 + 89) * 24 * 3600 * 10000000) - /** * utils_set_locale */ @@ -294,41 +292,6 @@ int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale) return 1; } -/** - * ntfs2utc - Convert an NTFS time to Unix time - * @ntfs_time: An NTFS time in 100ns units since 1601 - * - * NTFS stores times as the number of 100ns intervals since January 1st 1601 at - * 00:00 UTC. This system will not suffer from Y2K problems until ~57000AD. - * - * Return: n A Unix time (number of seconds since 1970) - */ -time_t ntfs2utc (s64 ntfs_time) -{ - return (ntfs_time - (NTFS_TIME_OFFSET)) / 10000000; -} - -/** - * utc2ntfs - Convert Linux time to NTFS time - * @utc_time: Linux time to convert to NTFS - * - * Convert the Linux time @utc_time to its corresponding NTFS time. - * - * Linux stores time in a long at present and measures it as the number of - * 1-second intervals since 1st January 1970, 00:00:00 UTC. - * - * NTFS uses Microsoft's standard time format which is stored in a s64 and is - * measured as the number of 100 nano-second intervals since 1st January 1601, - * 00:00:00 UTC. - * - * Return: n An NTFS time (100ns units since Jan 1601) - */ -s64 utc2ntfs (time_t utc_time) -{ - /* Convert to 100ns intervals and then add the NTFS time offset. */ - return (s64)utc_time * 10000000 + NTFS_TIME_OFFSET; -} - /** * find_attribute - Find an attribute of the given type * @type: An attribute type, e.g. AT_FILE_NAME diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 598d4763..45c60945 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -94,9 +94,6 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref); int utils_is_metadata (ntfs_inode *inode); void utils_dump_mem (u8 *buf, int start, int length, int ascii); -time_t ntfs2utc (s64 ntfs_time); -s64 utc2ntfs (time_t utc_time); - ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft); From 93194b37a0a56794f74348bd44721772bfc44247 Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 21 Jul 2005 12:12:37 +0000 Subject: [PATCH 2384/2994] Add a function to ntfsprogs/decrypt.c that expands an on-disk desx key from 128 bits to the needed 192 bits so it can be used for {en,de}cryption. Note I couldn't face using the completely insane libgcrypt api so I used openssl's libcrypto instead... Anyone feel free to swap once we have it working. --- Makefile.in | 1 - aclocal.m4 | 520 ++++++---------- config.guess | 64 +- config.sub | 5 +- configure | 1216 +++++++++++++------------------------- doc/Makefile.in | 1 - include/Makefile.in | 1 - include/ntfs/Makefile.in | 1 - libntfs/Makefile.in | 1 - ltmain.sh | 156 ++--- ntfsprogs/Makefile.am | 2 +- ntfsprogs/Makefile.in | 3 +- ntfsprogs/decrypt.c | 68 ++- ntfsprogs/ntfsdecrypt.c | 2 +- 14 files changed, 746 insertions(+), 1295 deletions(-) diff --git a/Makefile.in b/Makefile.in index 553116e9..23ba5a81 100644 --- a/Makefile.in +++ b/Makefile.in @@ -144,7 +144,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/aclocal.m4 b/aclocal.m4 index 4ebc090e..2b04da7c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -123,7 +123,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed='sed -e s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -191,7 +191,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -238,48 +238,6 @@ compiler=$CC ])# _LT_AC_SYS_COMPILER -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -AC_DEFUN([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -]) - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -AC_DEFUN([_LT_COMPILER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -AC_DEFUN([_LT_LINKER_BOILERPLATE], -[ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* -])# _LT_LINKER_BOILERPLATE - - # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -621,10 +579,8 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then $2=yes fi fi @@ -655,11 +611,6 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi else $2=yes fi @@ -729,7 +680,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -1015,9 +965,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi @@ -1516,7 +1464,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -1579,11 +1527,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -2573,10 +2517,6 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # # Check for any special shared library compilation flags. # @@ -2709,10 +2649,6 @@ lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -2734,7 +2670,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2995,7 +2931,7 @@ case $host_os in fi _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -3013,11 +2949,11 @@ case $host_os in dgux*) case $cc_basename in - ec++*) + ec++) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx*) + ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3052,11 +2988,11 @@ case $host_os in # location of the library. case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC*) + aCC) _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -3117,11 +3053,11 @@ case $host_os in esac case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC*) + aCC) case "$host_cpu" in hppa*64*|ia64*) _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -3161,9 +3097,9 @@ case $host_os in ;; irix5* | irix6*) case $cc_basename in - CC*) + CC) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -3174,7 +3110,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -3187,7 +3123,7 @@ case $host_os in ;; linux*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3212,7 +3148,7 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc*) + icpc) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -3237,16 +3173,15 @@ case $host_os in _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC) # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx*) + cxx) # Compaq C++ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -3277,7 +3212,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx*) + cxx) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3316,7 +3251,7 @@ case $host_os in ;; osf3*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3332,14 +3267,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx*) + cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3357,7 +3292,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3376,7 +3311,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3391,17 +3326,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx*) + cxx) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3420,7 +3355,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: @@ -3444,7 +3379,7 @@ case $host_os in sco*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3456,12 +3391,12 @@ case $host_os in ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc*) + lcc) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3474,7 +3409,7 @@ case $host_os in ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -3488,13 +3423,9 @@ case $host_os in *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes @@ -3515,7 +3446,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx*) + gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -3558,7 +3489,7 @@ case $host_os in ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3790,16 +3721,12 @@ lt_simple_link_test_code=" program t\n end\n" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3818,9 +3745,7 @@ aix3*) fi ;; aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi + test "$enable_shared" = yes && enable_static=no ;; esac AC_MSG_RESULT([$enable_shared]) @@ -3876,22 +3801,15 @@ lt_simple_link_test_code='public class conftest { public static void main(String # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds - AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) AC_LIBTOOL_PROG_COMPILER_PIC($1) AC_LIBTOOL_PROG_CC_C_O($1) @@ -3934,16 +3852,11 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes AC_LIBTOOL_CONFIG($1) @@ -3973,7 +3886,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -4079,7 +3992,7 @@ ifelse([$1], [], # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -4090,7 +4003,7 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -4173,7 +4086,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -4207,7 +4120,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4733,7 +4646,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68*) + cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -4742,7 +4655,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -4751,10 +4664,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; dgux*) case $cc_basename in - ec++*) + ec++) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx*) + ghcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4767,14 +4680,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; - aCC*) + aCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -4792,7 +4705,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. @@ -4803,7 +4716,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) case $cc_basename in - KCC*) + KCC) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' @@ -4814,13 +4727,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgCC*) + pgCC) # Portland Group C++ compiler. _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - cxx*) + cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -4837,7 +4750,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx*) + cxx) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) @@ -4848,14 +4761,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC*) + KCC) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC*) + RCC) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx*) + cxx) # Digital/Compaq C++ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -4871,7 +4784,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sco*) case $cc_basename in - CC*) + CC) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; *) @@ -4880,13 +4793,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; - gcx*) + gcx) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4896,12 +4809,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc*) + lcc) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4911,7 +4824,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -5011,7 +4924,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5059,7 +4972,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' @@ -5086,14 +4999,9 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac ;; sunos4*) @@ -5223,8 +5131,7 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - _LT_CC_BASENAME([$compiler]) + case $host_os in cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time @@ -5243,28 +5150,7 @@ ifelse([$1],[CXX],[ if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - + # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -5333,37 +5219,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -5402,6 +5257,41 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -5412,11 +5302,16 @@ EOF ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -5621,7 +5516,7 @@ EOF _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -5824,7 +5719,7 @@ EOF _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5843,12 +5738,10 @@ EOF solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -5857,18 +5750,8 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - *) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -6159,120 +6042,63 @@ SED=$lt_cv_path_SED AC_MSG_RESULT([$SED]) ]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# -# Copyright © 2004 Scott James Remnant . -# -# 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 of the License, 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. -# PKG_PROG_PKG_CONFIG([MIN-VERSION]) -# ---------------------------------- -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_ifval([$1], [$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi - -fi[]dnl -])# PKG_PROG_PKG_CONFIG +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN([PKG_CHECK_MODULES], [ + succeeded=no -# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -# --------------------------------------------- -m4_define([_PKG_CONFIG], -[if test "x$ac_cv_env_[]$1[]_set" = "xset"; then - pkg_cv_[]$1=$ac_cv_env_[]$1[]_value -elif test -n "$PKG_CONFIG"; then - if AC_RUN_LOG([$PKG_CONFIG --exists "$3" >/dev/null 2>&1]); then - pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi[]dnl -])# _PKG_CONFIG + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi -# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -# [ACTION-IF-NOT-FOUND]) -# -# -# Note that if there is a possibility the first call to -# PKG_CHECK_MODULES might not happen, you should be sure to include an -# explicit call to PKG_PROG_PKG_CONFIG in your configure.in -# -# -# -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) -pkg_failed=no -AC_CACHE_CHECK([for $1][_CFLAGS], [pkg_cv_][$1][_CFLAGS], - [_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])]) -AC_CACHE_CHECK([for $1][_LIBS], [pkg_cv_][$1][_LIBS], - [_PKG_CONFIG([$1][_LIBS], [libs], [$2])]) + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes -if test $pkg_failed = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" 1>&AS_MESSAGE_LOG_FD + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) - ifelse([$4], , [AC_MSG_ERROR(dnl -[Package requirements ($2) were not met. -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details.])], - [$4]) -elif test $pkg_failed = untried; then - ifelse([$4], , [AC_MSG_FAILURE(dnl -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) -Alternatively you may set the $1_CFLAGS and $1_LIBS environment variables -to avoid the need to call pkg-config. See the pkg-config man page for -more details. -To get pkg-config, see .])], - [$4]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - ifelse([$3], , :, [$3]) -fi[]dnl -])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. # diff --git a/config.guess b/config.guess index 892833f9..44f30e6c 100755 --- a/config.guess +++ b/config.guess @@ -136,6 +136,16 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_MACHINE}" in + i?86) + test -z "$VENDOR" && VENDOR=pc + ;; + *) + test -z "$VENDOR" && VENDOR=unknown + ;; +esac +test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -825,25 +835,25 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo cris-axis-linux exit 0 ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo crisv32-axis-linux exit 0 ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo frv-${VENDOR}-linux exit 0 ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build @@ -862,7 +872,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -881,13 +891,13 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-${VENDOR}-linux exit 0 ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-${VENDOR}-linux exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -900,34 +910,34 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-${VENDOR}-linux ;; + PA8*) echo hppa2.0-${VENDOR}-linux ;; + *) echo hppa-${VENDOR}-linux ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-${VENDOR}-linux exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-${VENDOR}-linux exit 0 ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo x86_64-${VENDOR}-linux exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -942,18 +952,18 @@ EOF p'` case "$ld_supported_targets" in elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" ;; a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" + echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" exit 0 ;; coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" + echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" exit 0 ;; "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or + # Either a pre-BFD a.out linker (linuxoldld) or # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf @@ -982,7 +992,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) diff --git a/config.sub b/config.sub index d8fd2f8f..c884ad4e 100755 --- a/config.sub +++ b/config.sub @@ -1172,7 +1172,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ @@ -1205,9 +1205,6 @@ case $os in -linux-dietlibc) os=-linux-dietlibc ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; diff --git a/configure b/configure index e891f2e2..e1b20dbf 100755 --- a/configure +++ b/configure @@ -466,7 +466,7 @@ ac_includes_default="\ # include #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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG ac_pt_PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' +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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -947,26 +947,6 @@ ac_env_FFLAGS_set=${FFLAGS+set} ac_env_FFLAGS_value=$FFLAGS ac_cv_env_FFLAGS_set=${FFLAGS+set} ac_cv_env_FFLAGS_value=$FFLAGS -ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} -ac_env_PKG_CONFIG_value=$PKG_CONFIG -ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} -ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG -ac_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} -ac_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS -ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set=${LIBNTFS_GNOMEVFS_CFLAGS+set} -ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value=$LIBNTFS_GNOMEVFS_CFLAGS -ac_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} -ac_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS -ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set=${LIBNTFS_GNOMEVFS_LIBS+set} -ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value=$LIBNTFS_GNOMEVFS_LIBS -ac_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} -ac_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS -ac_cv_env_FUSE_MODULE_CFLAGS_set=${FUSE_MODULE_CFLAGS+set} -ac_cv_env_FUSE_MODULE_CFLAGS_value=$FUSE_MODULE_CFLAGS -ac_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} -ac_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS -ac_cv_env_FUSE_MODULE_LIBS_set=${FUSE_MODULE_LIBS+set} -ac_cv_env_FUSE_MODULE_LIBS_value=$FUSE_MODULE_LIBS # # Report the --help message. @@ -1090,15 +1070,6 @@ Some influential environment variables: CXXCPP C++ preprocessor F77 Fortran 77 compiler command FFLAGS Fortran 77 compiler flags - PKG_CONFIG path to pkg-config utility - LIBNTFS_GNOMEVFS_CFLAGS - C compiler flags for LIBNTFS_GNOMEVFS, overriding pkg-config - LIBNTFS_GNOMEVFS_LIBS - linker flags for LIBNTFS_GNOMEVFS, overriding pkg-config - FUSE_MODULE_CFLAGS - C compiler flags for FUSE_MODULE, overriding pkg-config - FUSE_MODULE_LIBS - linker flags for FUSE_MODULE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -4226,7 +4197,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4229 "configure"' > conftest.$ac_ext + echo '#line 4200 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5570,7 +5541,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5573:" \ +echo "$as_me:5544:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5771,7 +5742,6 @@ else fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure @@ -6062,7 +6032,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' +Xsed='sed -e s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. @@ -6367,16 +6337,7 @@ if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # Only perform the check for file, if the check method requires it case $deplibs_check_method in @@ -6564,20 +6525,6 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # # Check for any special shared library compilation flags. # @@ -6619,11 +6566,6 @@ else if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 - $echo "X$_lt_linker_boilerplate" | $Xsed > conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_prog_compiler_static_works=yes - fi else lt_prog_compiler_static_works=yes fi @@ -6668,17 +6610,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6671: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6613: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6675: \$? = $ac_status" >&5 + echo "$as_me:6617: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -6784,7 +6724,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic='-qnocommon' lt_prog_compiler_wl='-Wl,' @@ -6832,7 +6772,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' @@ -6859,14 +6799,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac ;; sunos4*) @@ -6930,17 +6865,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6933: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6868: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6937: \$? = $ac_status" >&5 + echo "$as_me:6872: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works=yes fi fi @@ -6992,18 +6925,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6995: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6928: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6999: \$? = $ac_status" >&5 + echo "$as_me:6932: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o=yes fi fi @@ -7083,16 +7014,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -7113,27 +7034,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -7202,37 +7102,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -7271,6 +7140,41 @@ EOF hardcode_shlibpath_var=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds=$archive_cmds + fi + else + ld_shlibs=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -7281,11 +7185,16 @@ EOF ;; esac - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -7592,7 +7501,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -7795,7 +7704,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -7814,12 +7723,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -7828,18 +7735,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs=yes ;; @@ -8376,7 +8273,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -8439,11 +8336,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -9232,7 +9125,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&6;} # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -9599,7 +9492,7 @@ echo "$as_me: creating $ofile" >&6;} SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" +Xsed="$SED -e s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. @@ -9681,7 +9574,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -9715,7 +9608,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -10070,20 +9963,6 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -10105,16 +9984,7 @@ test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -10584,7 +10454,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -10602,11 +10472,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi dgux*) case $cc_basename in - ec++*) + ec++) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - ghcx*) + ghcx) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10641,11 +10511,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # location of the library. case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC*) + aCC) archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when @@ -10706,11 +10576,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC*) + aCC) case "$host_cpu" in hppa*64*|ia64*) archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' @@ -10750,9 +10620,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; irix5* | irix6*) case $cc_basename in - CC*) + CC) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -10763,7 +10633,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' fi @@ -10776,7 +10646,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; linux*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10801,7 +10671,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc*) + icpc) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols @@ -10826,16 +10696,15 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - pgCC*) + pgCC) # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' ;; - cxx*) + cxx) # Compaq C++ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' @@ -10866,7 +10735,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; mvs*) case $cc_basename in - cxx*) + cxx) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10905,7 +10774,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf3*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10921,14 +10790,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx*) + cxx) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10946,7 +10815,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -10965,7 +10834,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf4* | osf5*) case $cc_basename in - KCC*) + KCC) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10980,17 +10849,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - RCC*) + RCC) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx*) + cxx) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -11009,7 +10878,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: @@ -11033,7 +10902,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi sco*) archive_cmds_need_lc_CXX=no case $cc_basename in - CC*) + CC) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -11045,12 +10914,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - lcc*) + lcc) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11063,7 +10932,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ no_undefined_flag_CXX=' -zdefs' archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' @@ -11077,13 +10946,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. We must also pass each convience library through - # to the system linker between allextract/defaultextract. - # The C++ compiler will combine linker options so we - # cannot just pass the convience library names through - # without $wl. + # linker. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes @@ -11104,7 +10969,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; - gcx*) + gcx) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -11147,7 +11012,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -11356,7 +11221,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; chorus*) case $cc_basename in - cxch68*) + cxch68) # Green Hills C++ Compiler # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; @@ -11365,7 +11230,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_CXX='-qnocommon' lt_prog_compiler_wl_CXX='-Wl,' @@ -11374,10 +11239,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; dgux*) case $cc_basename in - ec++*) + ec++) lt_prog_compiler_pic_CXX='-KPIC' ;; - ghcx*) + ghcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; @@ -11390,14 +11255,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC*) + CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; - aCC*) + aCC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" case "$host_cpu" in @@ -11415,7 +11280,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; irix5* | irix6* | nonstopux*) case $cc_basename in - CC*) + CC) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. @@ -11426,7 +11291,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) case $cc_basename in - KCC*) + KCC) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' @@ -11437,13 +11302,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; - pgCC*) + pgCC) # Portland Group C++ compiler. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-fpic' lt_prog_compiler_static_CXX='-static' ;; - cxx*) + cxx) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. @@ -11460,7 +11325,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; mvs*) case $cc_basename in - cxx*) + cxx) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) @@ -11471,14 +11336,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC*) + KCC) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; - RCC*) + RCC) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; - cxx*) + cxx) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -11494,7 +11359,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sco*) case $cc_basename in - CC*) + CC) lt_prog_compiler_pic_CXX='-fPIC' ;; *) @@ -11503,13 +11368,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) case $cc_basename in - CC*) + CC) # Sun C++ 4.2, 5.x and Centerline C++ lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-Bstatic' lt_prog_compiler_wl_CXX='-Qoption ld ' ;; - gcx*) + gcx) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; @@ -11519,12 +11384,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sunos4*) case $cc_basename in - CC*) + CC) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; - lcc*) + lcc) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; @@ -11534,7 +11399,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; tandem*) case $cc_basename in - NCC*) + NCC) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; @@ -11578,17 +11443,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11581: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11446: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11585: \$? = $ac_status" >&5 + echo "$as_me:11450: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_CXX=yes fi fi @@ -11640,18 +11503,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11643: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11506: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11647: \$? = $ac_status" >&5 + echo "$as_me:11510: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_CXX=yes fi fi @@ -12153,7 +12014,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -12216,11 +12077,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -13009,7 +12866,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 @@ -13738,9 +13572,7 @@ aix3*) fi ;; aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi + test "$enable_shared" = yes && enable_static=no ;; esac echo "$as_me:$LINENO: result: $enable_shared" >&5 @@ -13846,7 +13678,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_F77='-qnocommon' lt_prog_compiler_wl_F77='-Wl,' @@ -13894,7 +13726,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_F77='-Wl,' @@ -13921,14 +13753,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_F77='-Qoption ld ';; - *) - lt_prog_compiler_wl_F77='-Wl,';; - esac ;; sunos4*) @@ -13992,17 +13819,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13995: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13822: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13999: \$? = $ac_status" >&5 + echo "$as_me:13826: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_F77=yes fi fi @@ -14054,18 +13879,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14057: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13882: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14061: \$? = $ac_status" >&5 + echo "$as_me:13886: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_F77=yes fi fi @@ -14145,16 +13968,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -14175,27 +13988,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -14264,37 +14056,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_F77='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_F77=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -14333,6 +14094,41 @@ EOF hardcode_shlibpath_var_F77=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_F77=$archive_cmds_F77 + fi + else + ld_shlibs_F77=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -14343,11 +14139,16 @@ EOF ;; esac - if test "$ld_shlibs_F77" = no; then - runpath_var= - hardcode_libdir_flag_spec_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= + if test "$ld_shlibs_F77" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -14634,7 +14435,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -14837,7 +14638,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_F77='-rpath $libdir' @@ -14856,12 +14657,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -14870,18 +14669,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_F77=yes ;; @@ -15418,7 +15207,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -15481,11 +15270,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -15684,7 +15469,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -15833,7 +15618,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -15867,7 +15652,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -16116,41 +15901,15 @@ LTCC=${LTCC-"$CC"} compiler=$CC -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -printf "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${GCJ-"gcj"} compiler=$CC compiler_GCJ=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - # GCJ did not exist at the time GCC didn't implicitly link libc in. archive_cmds_need_lc_GCJ=no -old_archive_cmds_GCJ=$old_archive_cmds - lt_prog_compiler_no_builtin_flag_GCJ= @@ -16176,17 +15935,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16179: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15938: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16183: \$? = $ac_status" >&5 + echo "$as_me:15942: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi @@ -16292,7 +16049,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 darwin*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files - case $cc_basename in + case "$cc_basename" in xlc*) lt_prog_compiler_pic_GCJ='-qnocommon' lt_prog_compiler_wl_GCJ='-Wl,' @@ -16340,7 +16097,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-static' ;; - pgcc* | pgf77* | pgf90*) + pgcc | pgf77 | pgf90) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl_GCJ='-Wl,' @@ -16367,14 +16124,9 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; solaris*) + lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_GCJ='-Qoption ld ';; - *) - lt_prog_compiler_wl_GCJ='-Wl,';; - esac ;; sunos4*) @@ -16438,17 +16190,15 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16441: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16193: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16445: \$? = $ac_status" >&5 + echo "$as_me:16197: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $echo "X$_lt_compiler_boilerplate" | $Xsed >conftest.exp - $SED '/^$/d' conftest.err >conftest.er2 - if test ! -s conftest.err || diff conftest.exp conftest.er2 >/dev/null; then + # So say no if there are warnings + if test ! -s conftest.err; then lt_prog_compiler_pic_works_GCJ=yes fi fi @@ -16500,18 +16250,16 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16503: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16253: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16507: \$? = $ac_status" >&5 + echo "$as_me:16257: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - $echo "X$_lt_compiler_boilerplate" | $Xsed > out/conftest.exp - $SED '/^$/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.err || diff out/conftest.exp out/conftest.er2 >/dev/null; then + if test ! -s out/conftest.err; then lt_cv_prog_compiler_c_o_GCJ=yes fi fi @@ -16591,16 +16339,6 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. extract_expsyms_cmds= - # Just being paranoid about ensuring that cc_basename is set. - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` case $host_os in cygwin* | mingw* | pw32*) @@ -16621,27 +16359,6 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) @@ -16710,37 +16427,6 @@ EOF fi ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - whole_archive_flag_spec_GCJ='${wl}--whole-archive,`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - $echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - else - ld_shlibs_GCJ=no - fi - ;; - netbsd*) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' @@ -16779,6 +16465,41 @@ EOF hardcode_shlibpath_var_GCJ=no ;; + linux*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + tmp_addflag= + case $CC,$host_cpu in + pgf77* | pgf90* ) # Portland Group f77 and f90 compilers + tmp_addflag=' -fpic' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + esac + archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_GCJ=$archive_cmds_GCJ + fi + else + ld_shlibs_GCJ=no + fi + ;; + *) if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' @@ -16789,11 +16510,16 @@ EOF ;; esac - if test "$ld_shlibs_GCJ" = no; then - runpath_var= - hardcode_libdir_flag_spec_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= + if test "$ld_shlibs_GCJ" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi fi else # PORTME fill in a description of your system's linker (not GNU ld) @@ -17100,7 +16826,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - case $cc_basename in + case "$cc_basename" in xlc*) output_verbose_link_cmd='echo' archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' @@ -17303,7 +17029,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp' + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec_GCJ='-rpath $libdir' @@ -17322,12 +17048,10 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then - wlarc='${wl}' archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else - wlarc='' archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' @@ -17336,18 +17060,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine linker options so we - # cannot just pass the convience library names through - # without $wl, iff we do not link with $LD. - # Luckily, gcc supports the same syntax we need for Sun Studio. - # Supported since Solaris 2.6 (maybe 2.5.1?) - case $wlarc in - '') - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; - *) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; - esac ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_GCJ=yes ;; @@ -17884,7 +17598,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi @@ -17947,11 +17661,7 @@ nto-qnx*) openbsd*) version_type=sunos need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac + need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH @@ -18740,7 +18450,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$rm conftest* - -ac_outfile=conftest.$ac_objext -printf "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$rm conftest* - - # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${RC-"windres"} compiler=$CC compiler_RC=$CC -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - lt_cv_prog_compiler_c_o_RC=yes # The else clause should only fire when bootstrapping the @@ -19430,7 +19116,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ SED SHELL STRIP \ libname_spec library_names_spec soname_spec extract_expsyms_cmds \ old_striplib striplib file_magic_cmd finish_cmds finish_eval \ @@ -19579,7 +19265,7 @@ DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" # Used on cygwin: assembler. -AS="$AS" +AS=$lt_AS # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -19613,7 +19299,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC -# Must we lock files when doing compilation? +# Must we lock files when doing compilation ? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -20263,11 +19949,11 @@ if test "$enable_gnome_vfs" != "no"; then export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" fi + succeeded=no -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then @@ -20292,6 +19978,7 @@ do done done + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -20305,123 +19992,56 @@ else echo "${ECHO_T}no" >&6 fi -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 fi -done -done - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 +echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 -if test -n "$ac_pt_PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 -echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - PKG_CONFIG=$ac_pt_PKG_CONFIG -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 -echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - echo "$as_me:$LINENO: result: yes" >&5 + if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - PKG_CONFIG="" - fi + succeeded=yes -fi + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 -pkg_failed=no -echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 -if test "${pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_set" = "xset"; then - pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=$ac_cv_env_LIBNTFS_GNOMEVFS_CFLAGS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS" >&6 -echo "$as_me:$LINENO: checking for LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking for LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 -if test "${pkg_cv_LIBNTFS_GNOMEVFS_LIBS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_set" = "xset"; then - pkg_cv_LIBNTFS_GNOMEVFS_LIBS=$ac_cv_env_LIBNTFS_GNOMEVFS_LIBS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"glib-2.0 gthread-2.0 gnome-vfs-module-2.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$pkg_cv_LIBNTFS_GNOMEVFS_LIBS" >&6 + echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 +echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 + LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` + echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 +echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 + else + LIBNTFS_GNOMEVFS_CFLAGS="" + LIBNTFS_GNOMEVFS_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` -if test $pkg_failed = yes; then - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - # Put the nasty error message in config.log where it belongs - echo "$LIBNTFS_GNOMEVFS_PKG_ERRORS" 1>&5 + fi + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + compile_gnome_vfs=true + else + if test "$enable_gnome_vfs" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} @@ -20431,22 +20051,8 @@ echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} fi -elif test $pkg_failed = untried; then + fi - if test "$enable_gnome_vfs" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - fi - -else - LIBNTFS_GNOMEVFS_CFLAGS=$pkg_cv_LIBNTFS_GNOMEVFS_CFLAGS - LIBNTFS_GNOMEVFS_LIBS=$pkg_cv_LIBNTFS_GNOMEVFS_LIBS - compile_gnome_vfs=true -fi fi @@ -20463,59 +20069,98 @@ fi compile_fuse_module=false if test "$enable_fuse_module" != "no"; then -pkg_failed=no -echo "$as_me:$LINENO: checking for FUSE_MODULE_CFLAGS" >&5 -echo $ECHO_N "checking for FUSE_MODULE_CFLAGS... $ECHO_C" >&6 -if test "${pkg_cv_FUSE_MODULE_CFLAGS+set}" = set; then + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "x$ac_cv_env_FUSE_MODULE_CFLAGS_set" = "xset"; then - pkg_cv_FUSE_MODULE_CFLAGS=$ac_cv_env_FUSE_MODULE_CFLAGS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_CFLAGS" >&5 -echo "${ECHO_T}$pkg_cv_FUSE_MODULE_CFLAGS" >&6 -echo "$as_me:$LINENO: checking for FUSE_MODULE_LIBS" >&5 -echo $ECHO_N "checking for FUSE_MODULE_LIBS... $ECHO_C" >&6 -if test "${pkg_cv_FUSE_MODULE_LIBS+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "x$ac_cv_env_FUSE_MODULE_LIBS_set" = "xset"; then - pkg_cv_FUSE_MODULE_LIBS=$ac_cv_env_FUSE_MODULE_LIBS_value -elif test -n "$PKG_CONFIG"; then - if { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists \"fuse >= 2.3.0\" >/dev/null 2>&1") >&5 - ($PKG_CONFIG --exists "fuse >= 2.3.0" >/dev/null 2>&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - pkg_cv_FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0" 2>/dev/null` - else - pkg_failed=yes - fi -else - pkg_failed=untried -fi -fi -echo "$as_me:$LINENO: result: $pkg_cv_FUSE_MODULE_LIBS" >&5 -echo "${ECHO_T}$pkg_cv_FUSE_MODULE_LIBS" >&6 + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -if test $pkg_failed = yes; then - FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` - # Put the nasty error message in config.log where it belongs - echo "$FUSE_MODULE_PKG_ERRORS" 1>&5 + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for fuse >= 2.3.0" >&5 +echo $ECHO_N "checking for fuse >= 2.3.0... $ECHO_C" >&6 + + if $PKG_CONFIG --exists "fuse >= 2.3.0" ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + succeeded=yes + + echo "$as_me:$LINENO: checking FUSE_MODULE_CFLAGS" >&5 +echo $ECHO_N "checking FUSE_MODULE_CFLAGS... $ECHO_C" >&6 + FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0"` + echo "$as_me:$LINENO: result: $FUSE_MODULE_CFLAGS" >&5 +echo "${ECHO_T}$FUSE_MODULE_CFLAGS" >&6 + + echo "$as_me:$LINENO: checking FUSE_MODULE_LIBS" >&5 +echo $ECHO_N "checking FUSE_MODULE_LIBS... $ECHO_C" >&6 + FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0"` + echo "$as_me:$LINENO: result: $FUSE_MODULE_LIBS" >&5 +echo "${ECHO_T}$FUSE_MODULE_LIBS" >&6 + else + FUSE_MODULE_CFLAGS="" + FUSE_MODULE_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` + + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + compile_fuse_module=true + else if test "$enable_fuse_module" = "yes"; then { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 @@ -20526,22 +20171,8 @@ echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2 echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} fi -elif test $pkg_failed = untried; then + fi - if test "$enable_fuse_module" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 -echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 -echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} - fi - -else - FUSE_MODULE_CFLAGS=$pkg_cv_FUSE_MODULE_CFLAGS - FUSE_MODULE_LIBS=$pkg_cv_FUSE_MODULE_LIBS - compile_fuse_module=true -fi fi @@ -23840,7 +23471,6 @@ s,@FFLAGS@,$FFLAGS,;t t s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@PKG_CONFIG@,$PKG_CONFIG,;t t -s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t diff --git a/doc/Makefile.in b/doc/Makefile.in index e9a42652..ab7029cb 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -119,7 +119,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/Makefile.in b/include/Makefile.in index 2202b27d..dbaff49f 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -128,7 +128,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 42ae6fb4..0ce4b7bd 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -132,7 +132,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 37bab1b3..3b73331f 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -194,7 +194,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ diff --git a/ltmain.sh b/ltmain.sh index eecedf23..3d071010 100755 --- a/ltmain.sh +++ b/ltmain.sh @@ -17,7 +17,7 @@ # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -43,8 +43,8 @@ EXIT_FAILURE=1 PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.5.18 -TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)" +VERSION=1.5.14 +TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. @@ -112,9 +112,8 @@ if test "${LANG+set}" = set; then fi # Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" +: ${IFS=" +"} if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then $echo "$modename: not configured to build any kind of library" 1>&2 @@ -251,14 +250,37 @@ func_extract_an_archive () { f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" + f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else - $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 - exit $EXIT_FAILURE + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" + $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ + | $EGREP -v '^[ ]*1[ ]' | while read count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? + i=`expr $i + 1` + done + done + $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" + $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" fi } @@ -735,15 +757,6 @@ if test -z "$show_help"; then esac done - qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` - case $qlibobj in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qlibobj="\"$qlibobj\"" ;; - esac - if test "X$libobj" != "X$qlibobj"; then - $echo "$modename: libobj name \`$libobj' may not contain shell special characters." - exit $EXIT_FAILURE - fi objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -816,17 +829,12 @@ compiler." $run $rm $removelist exit $EXIT_FAILURE fi - $echo "$srcfile" > "$lockfile" + $echo $srcfile > "$lockfile" fi if test -n "$fix_srcfile_path"; then eval srcfile=\"$fix_srcfile_path\" fi - qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` - case $qsrcfile in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qsrcfile="\"$qsrcfile\"" ;; - esac $run $rm "$libobj" "${libobj}T" @@ -848,10 +856,10 @@ EOF fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" + command="$base_compile $srcfile $pic_flag" else # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $srcfile" fi if test ! -d "${xdir}$objdir"; then @@ -931,9 +939,9 @@ EOF if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code - command="$base_compile $qsrcfile" + command="$base_compile $srcfile" else - command="$base_compile $qsrcfile $pic_flag" + command="$base_compile $srcfile $pic_flag" fi if test "$compiler_c_o" = yes; then command="$command -o $obj" @@ -1357,8 +1365,6 @@ EOF ;; darwin_framework) compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" prev= continue ;; @@ -1423,8 +1429,6 @@ EOF -framework) prev=darwin_framework compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" continue ;; @@ -2848,13 +2852,13 @@ EOF *) continue ;; esac case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - case " $deplibs " in *" $depdepl "*) ;; *) deplibs="$depdepl $deplibs" ;; esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac done fi # link_all_deplibs != no fi # linkmode = lib @@ -3120,7 +3124,7 @@ EOF case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3129,7 +3133,7 @@ EOF case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -3138,7 +3142,7 @@ EOF case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit $EXIT_FAILURE ;; @@ -5087,63 +5091,6 @@ fi\ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "copying selected object files to avoid basename conflicts..." - - if test -z "$gentop"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "$mkdir $gentop" - $run $mkdir "$gentop" - status=$? - if test "$status" -ne 0 && test ! -d "$gentop"; then - exit $status - fi - fi - - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - counter=`expr $counter + 1` - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - $run ln "$obj" "$gentop/$newobj" || - $run cp "$obj" "$gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - eval cmds=\"$old_archive_cmds\" if len=`expr "X$cmds" : ".*"` && @@ -5157,7 +5104,20 @@ fi\ objlist= concat_cmds= save_oldobjs=$oldobjs - + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do @@ -6066,14 +6026,14 @@ relink_command=\"$relink_command\"" fi # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" + exec_cmd="\"\$cmd\"$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" $echo "export $shlibpath_var" fi - $echo "$cmd$args" + eval \$echo \"\$cmd\"$args exit $EXIT_SUCCESS fi ;; diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 8fac195a..97b725cf 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -89,7 +89,7 @@ endif ntfsdecrypt_SOURCES = ntfsdecrypt.c decrypt.c decrypt.h utils.c utils.h ntfsdecrypt_LDADD = $(AM_LIBS) -ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt +ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt -lcrypto ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h ntfsrm_LDADD = $(AM_LIBS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 88ee90a0..354bf5d9 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -246,7 +246,6 @@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_F77 = @ac_ct_F77@ ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_STRIP = @ac_ct_STRIP@ -ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ all_includes = @all_includes@ all_libraries = @all_libraries@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ @@ -351,7 +350,7 @@ ntfscp_LDFLAGS = $(AM_LFLAGS) # We don't distribute these ntfsdecrypt_SOURCES = ntfsdecrypt.c decrypt.c decrypt.h utils.c utils.h ntfsdecrypt_LDADD = $(AM_LIBS) -ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt +ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt -lcrypto ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h ntfsrm_LDADD = $(AM_LIBS) ntfsrm_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 4431785b..b8d5cb76 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "decrypt.h" @@ -425,16 +426,12 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); } - if (dkey->gcry_algo == GCRY_CIPHER_DES_SK) { - /* CALG_DESX */ - fprintf(stderr, "DESX is not supported yet.\n"); - errno = -1; - return 0; - } else { - if ((gcry_error2 = gcry_cipher_decrypt(dkey->gcry_cipher_hd, - data, 512, NULL, 0))) { - fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); - } + // FIXME: Why are we not calling gcry_cipher_setiv() here instead of + // doing it by hand after the decryption? + + if ((gcry_error2 = gcry_cipher_decrypt(dkey->gcry_cipher_hd, + data, 512, NULL, 0))) { + fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); } if (dkey->gcry_algo == GCRY_CIPHER_AES256) { @@ -450,6 +447,43 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, return 512; } +/** + * desx_key_expand - expand a 128-bit desx key to the needed 192-bit key + * @src: source buffer containing 128-bit key + * @dst: destination buffer to write 192-bit key to + * + * Expands the on-disk 128-bit desx key to the needed full 192-bit desx key + * required to perform desx {de,en}cryption. + * + * FIXME: Is this endianness safe? I think so but I may be wrong... + */ +void desx_key_expand(u8 *src, u8* dst) { + static const int salt_len = 12; + static const u8 *salt1 = "Dan Simon "; + static const u8 *salt2 = "Scott Field"; + u8 md[16]; + MD5_CTX ctx1, ctx2; + + MD5_Init(&ctx1); + + /* Hash the on-disk key. */ + MD5_Update(&ctx1, src, 128 / 8); + memcpy(&ctx2, &ctx1, sizeof(ctx1)); + + /* Hash with the first salt and store the result. */ + MD5_Update(&ctx1, salt1, salt_len); + MD5_Final(md, &ctx1); + ((u32*)dst)[0] = ((u32*)md)[0] ^ ((u32*)md)[1]; + ((u32*)dst)[1] = ((u32*)md)[2] ^ ((u32*)md)[3]; + + /* Hash with the second salt and store the result. */ + MD5_Update(&ctx2, salt2, salt_len); + MD5_Final(md, &ctx2); + memcpy(dst + 8, md, sizeof(md)); + + return; +} + static decrypt_key *decrypt_make_gcry_key(char *key_data, int gcry_algo) { int gcry_mode, gcry_length; gcry_error_t gcry_error2; @@ -462,9 +496,8 @@ static decrypt_key *decrypt_make_gcry_key(char *key_data, int gcry_algo) { switch (gcry_algo) { case GCRY_CIPHER_DES_SK: - /* FIXME: This should be MODE_CBC, no? */ - gcry_mode = GCRY_CIPHER_MODE_ECB; - gcry_length = 8; + gcry_mode = GCRY_CIPHER_MODE_CBC; + gcry_length = 24; break; case GCRY_CIPHER_3DES: gcry_mode = GCRY_CIPHER_MODE_CBC; @@ -481,7 +514,7 @@ static decrypt_key *decrypt_make_gcry_key(char *key_data, int gcry_algo) { } if ((gcry_error2 = gcry_cipher_open(&key->gcry_cipher_hd, gcry_algo, - gcry_mode, 0))!=GPG_ERR_NO_ERROR) { + gcry_mode, 0)) != GPG_ERR_NO_ERROR) { errno = -1; return 0; } @@ -502,6 +535,7 @@ decrypt_key *decrypt_make_key( void *data) { unsigned int key_size, alg_id; char *key_data; + u8 desx_key[192 / 16]; key_size = *((unsigned int *)data); alg_id = *(((unsigned int *)data) + 2); @@ -509,10 +543,10 @@ decrypt_key *decrypt_make_key( switch (alg_id) { case CALG_DESX: + desx_key_expand(key_data, desx_key); //fprintf(stderr, "DESX key of %u bytes\n", key_size); - fprintf(stderr, "DESX is not supported yet.\n"); - errno = ENOTSUP; - return 0; + return decrypt_make_gcry_key(desx_key, + GCRY_CIPHER_DES_SK); case CALG_3DES: //fprintf(stderr, "3DES Key of %u bytes\n", key_size); return decrypt_make_gcry_key(key_data, diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 8d952509..2212a166 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -400,7 +400,7 @@ int main (int argc, char *argv[]) result = cat_decrypt (inode, fek); decrypt_user_key_close(fek); } else { - Eprintf("Could not obtain FEK."); + Eprintf("Could not obtain FEK.\n"); result = 1; } From 00c71275513ea30c8caaffd91da23105718a1bc5 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 22 Jul 2005 23:45:32 +0000 Subject: [PATCH 2385/2994] First attempts at DesX decryption (not working yet!). --- ntfsprogs/decrypt.c | 119 ++++++++++++++++++++++++++++---------------- 1 file changed, 77 insertions(+), 42 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index b8d5cb76..4bcd3394 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -97,6 +97,7 @@ typedef struct { typedef struct { unsigned int gcry_algo; + unsigned int gcry_mode; char *key_data; gcry_cipher_hd_t gcry_cipher_hd; // handle to the decrypted FEK. gcry_sexp_t sexp_key; // the user's RSA key. @@ -429,9 +430,39 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, // FIXME: Why are we not calling gcry_cipher_setiv() here instead of // doing it by hand after the decryption? - if ((gcry_error2 = gcry_cipher_decrypt(dkey->gcry_cipher_hd, - data, 512, NULL, 0))) { - fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); + if (dkey->gcry_mode == GCRY_CIPHER_MODE_CBC) { + if ((gcry_error2 = gcry_cipher_decrypt(dkey->gcry_cipher_hd, + data, 512, NULL, 0))) { + fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); + } + } else { + u64 *pos, *end; + u64 k2, k3; + + /* DesX is special. */ + // FIXME: Need to find out which 8 bytes are the DES key... + pos = data; + end = data + (512/8); + + k2 = *(u64*)dkey->key_data; + //k2 = *(u64*)(dkey->key_data + 8); + //k2 = *(u64*)(dkey->key_data + 16); + + //k3 = *(u64*)(dkey->key_data); + k3 = *(u64*)(dkey->key_data + 8); + //k3 = *(u64*)(dkey->key_data + 16); + + do { + *pos ^= k2; + if ((gcry_error2 = gcry_cipher_decrypt( + dkey->gcry_cipher_hd, + (unsigned char*)pos, 8, NULL, 0))) { + fprintf(stderr, "gcry_error2 is %u.\n", + gcry_error2); + break; + } + *pos ^= k3; + } while (++pos < end); } if (dkey->gcry_algo == GCRY_CIPHER_AES256) { @@ -485,7 +516,7 @@ void desx_key_expand(u8 *src, u8* dst) { } static decrypt_key *decrypt_make_gcry_key(char *key_data, int gcry_algo) { - int gcry_mode, gcry_length; + int gcry_length; gcry_error_t gcry_error2; DECRYPT_KEY *key; @@ -494,33 +525,42 @@ static decrypt_key *decrypt_make_gcry_key(char *key_data, int gcry_algo) { return NULL; } + key->key_data = key_data; + switch (gcry_algo) { - case GCRY_CIPHER_DES_SK: - gcry_mode = GCRY_CIPHER_MODE_CBC; - gcry_length = 24; - break; - case GCRY_CIPHER_3DES: - gcry_mode = GCRY_CIPHER_MODE_CBC; - gcry_length = 24; - break; - case GCRY_CIPHER_AES256: - gcry_mode = GCRY_CIPHER_MODE_CBC; - gcry_length = 32; - break; - default: - /* FIXME: This should use standard Des. */ - errno = ENOTSUP; - return 0; + case GCRY_CIPHER_DES_SK: + gcry_algo = GCRY_CIPHER_DES; + key->gcry_mode = GCRY_CIPHER_MODE_ECB; + gcry_length = 8; + //key_data += 8; + key_data += 16; + break; + case GCRY_CIPHER_3DES: + key->gcry_mode = GCRY_CIPHER_MODE_CBC; + gcry_length = 24; + break; + case GCRY_CIPHER_AES256: + key->gcry_mode = GCRY_CIPHER_MODE_CBC; + gcry_length = 32; + break; + case GCRY_CIPHER_DES: + key->gcry_mode = GCRY_CIPHER_MODE_CBC; + gcry_length = 8; + break; + default: + errno = ENOTSUP; + return 0; } if ((gcry_error2 = gcry_cipher_open(&key->gcry_cipher_hd, gcry_algo, - gcry_mode, 0)) != GPG_ERR_NO_ERROR) { + key->gcry_mode, 0)) != GPG_ERR_NO_ERROR) { + fprintf(stderr, "gcry_error1 is %u.\n", gcry_error2); errno = -1; return 0; } - if ((gcry_error2 = gcry_cipher_setkey(key->gcry_cipher_hd, key_data, - gcry_length))) { + if ((gcry_error2 = gcry_cipher_setkey(key->gcry_cipher_hd, + key_data, gcry_length))) { fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); } @@ -535,30 +575,25 @@ decrypt_key *decrypt_make_key( void *data) { unsigned int key_size, alg_id; char *key_data; - u8 desx_key[192 / 16]; + u8 desx_key[192 / 8]; key_size = *((unsigned int *)data); alg_id = *(((unsigned int *)data) + 2); key_data = (((char *)data) + 16); switch (alg_id) { - case CALG_DESX: - desx_key_expand(key_data, desx_key); - //fprintf(stderr, "DESX key of %u bytes\n", key_size); - return decrypt_make_gcry_key(desx_key, - GCRY_CIPHER_DES_SK); - case CALG_3DES: - //fprintf(stderr, "3DES Key of %u bytes\n", key_size); - return decrypt_make_gcry_key(key_data, - GCRY_CIPHER_3DES); - case CALG_AES_256: - //fprintf(stderr, "AES Key of %u bytes\n", key_size); - return decrypt_make_gcry_key(key_data, - GCRY_CIPHER_AES256); - default: - //fprintf(stderr, "DES key of %u bytes\n", key_size); - fprintf(stderr, "DES is not supported yet.\n"); - errno = ENOTSUP; - return NULL; + case CALG_DESX: + fprintf(stderr, "DESX key of %u bytes\n", key_size); + desx_key_expand(key_data, desx_key); + return decrypt_make_gcry_key(desx_key, GCRY_CIPHER_DES_SK); + case CALG_3DES: + fprintf(stderr, "3DES Key of %u bytes\n", key_size); + return decrypt_make_gcry_key(key_data, GCRY_CIPHER_3DES); + case CALG_AES_256: + fprintf(stderr, "AES Key of %u bytes\n", key_size); + return decrypt_make_gcry_key(key_data, GCRY_CIPHER_AES256); + default: + fprintf(stderr, "DES key of %u bytes\n", key_size); + return decrypt_make_gcry_key(key_data, GCRY_CIPHER_DES); } } From e48bd91bbf9fe35f25c6aaecabd92064b08b69e0 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 23 Jul 2005 00:50:31 +0000 Subject: [PATCH 2386/2994] * Fix bug in index.c (see Changelog). * Minor fixes to attr{ib,list}.c. --- ChangeLog | 4 +++- libntfs/attrib.c | 19 +++---------------- libntfs/attrlist.c | 3 ++- libntfs/index.c | 4 ++-- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 69cf6b6f..0bdd47a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,9 @@ xx/xx/xxxx - 1.12.0-WIP - ntfsls: fix showing not system files started with '$'. (Yura) - Move ntfs2utc and utc2ntfs from utils.[ch] to timeconv.h. (Yura) - Add [acm]time fields to struct ntfs_inode and set them during - ntfs_inode_open. Update ntfsmount to use them. (Yura) + ntfs_inode_open. Update ntfsmount to use them. (Yura) + - index.c::ntfs_index_lookup: fix bug when index context didn't point + on index root in which entry located. (Yura) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 5e037dd2..0e7d79d9 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2858,8 +2858,8 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) * @name_len: name length in unicode characters of the new attribute * @size: size of the new attribute * - * If inode haven't got enough space to add attribute, add attribute to one of it - * extents, if no extents present or no one of them have enough space, than + * If inode haven't got enough space to add attribute, add attribute to one of + * it extents, if no extents present or no one of them have enough space, than * allocate new extent and add attribute to it. * * If on one of this steps attribute list is needed but not present, than it is @@ -4792,20 +4792,7 @@ put_err_out: * attribute is made bigger and the attribute is resident the newly * "allocated" space is cleared and if the attribute is non-resident the * newly allocated space is marked as not initialised and no real allocation - * on disk is performed. FIXME: Do we have to create sparse runs or can we just - * leave the runlist to finish below data_size, i.e. can we have - * allocated_size < data_size? I guess that what we can't and thus we will have - * to set the sparse bit of the attribute and create sparse runs to ensure that - * allocated_size is >= data_size. We don't need to clear the partial run at - * the end of the real allocation because we leave initialized_size low enough. - * FIXME: Do we want that? Alternatively, we leave initialized_size = data_size - * and do clear the partial run. The latter approach would be more inline with - * what windows would do, even though windows wouldn't even make the attribute - * sparse, it would just allocate clusters instead. TODO: Check what happens on - * WinXP and 2003. FIXME: Make sure to check what NT4 does with an NTFS1.2 - * volume that has sparse files. I suspect it will blow up so we will need to - * perform allocations of clusters, like NT4 would do for NTFS1.2 while we can - * use sparse attributes on NTFS3.x. + * on disk is performed. * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 9c116531..a461cc97 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -92,6 +92,7 @@ int ntfs_attrlist_need(ntfs_inode *ni) * EINVAL - Invalid arguments passed to function. * ENOMEM - Not enough memory to allocate necessary buffers. * EIO - I/O error occurred or damaged filesystem. + * EEXIST - Such attribute already present in attribute list. */ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) { @@ -159,7 +160,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) continue; if (sle64_to_cpu(ale->lowest_vcn) == sle64_to_cpu(attr->lowest_vcn)) { - err = EINVAL; + err = EEXIST; Dprintf("%s(): Attribute with same type, name and " "lowest vcn already present in attribute " "list.\n", __FUNCTION__); diff --git a/libntfs/index.c b/libntfs/index.c index 96019d5d..444b4eac 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -53,7 +53,7 @@ ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *ni, *ictx = (ntfs_index_context) { .ni = ni, .name = name, - .name_len = name_len + .name_len = name_len, }; return ictx; } @@ -88,7 +88,6 @@ void ntfs_index_ctx_put(ntfs_index_context *ictx) } } free(ictx); - return; } /** @@ -202,6 +201,7 @@ ir_done: ictx->is_in_root = TRUE; ictx->actx = actx; ictx->ia = NULL; + ictx->ir = ir; done: ictx->entry = ie; ictx->data = (u8*)ie + offsetof(INDEX_ENTRY, key); From f6c47973796a00f445a75fd0d261bf0a5dfab1a6 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 24 Jul 2005 09:06:55 +0000 Subject: [PATCH 2387/2994] Fix in relocate_attributes(): don't stop processing of MFT record attributes at AT_DATA of $BadClus and $Bitmap. In practice, there aren't non-resident attributes after them so this recent bug shouldn't have caused data loss. --- ntfsprogs/ntfsresize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 54098c63..dd4ecb74 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1640,11 +1640,11 @@ static void relocate_attributes(ntfs_resize_t *resize) if (ret == -1) exit(1); else if (ret == 1) - break; + continue; if (resize->mref == FILE_Bitmap && resize->ctx->attr->type == AT_DATA) - break; + continue; relocate_attribute(resize); } From 6377902ed4d2727f795a74037856631baf153bbe Mon Sep 17 00:00:00 2001 From: antona Date: Sun, 24 Jul 2005 14:42:43 +0000 Subject: [PATCH 2388/2994] Update decryption for desx after more reverse engineering. Still doesn't work though. )-: --- ntfsprogs/decrypt.c | 151 ++++++++++++++++++-------------------------- ntfsprogs/decrypt.h | 2 +- 2 files changed, 62 insertions(+), 91 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 4bcd3394..9d3da02a 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -96,9 +96,9 @@ typedef struct { } DECRYPT_SESSION; typedef struct { - unsigned int gcry_algo; - unsigned int gcry_mode; - char *key_data; + u64 desx_key[3]; + u8 *key_data; + u32 alg_id; gcry_cipher_hd_t gcry_cipher_hd; // handle to the decrypted FEK. gcry_sexp_t sexp_key; // the user's RSA key. #ifdef USE_CRYPTOAPI_RSA @@ -430,49 +430,41 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, // FIXME: Why are we not calling gcry_cipher_setiv() here instead of // doing it by hand after the decryption? - if (dkey->gcry_mode == GCRY_CIPHER_MODE_CBC) { + if (dkey->alg_id != CALG_DESX) { if ((gcry_error2 = gcry_cipher_decrypt(dkey->gcry_cipher_hd, - data, 512, NULL, 0))) { + data, 512, NULL, 0))) fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); - } } else { - u64 *pos, *end; - u64 k2, k3; - - /* DesX is special. */ - // FIXME: Need to find out which 8 bytes are the DES key... - pos = data; - end = data + (512/8); - - k2 = *(u64*)dkey->key_data; - //k2 = *(u64*)(dkey->key_data + 8); - //k2 = *(u64*)(dkey->key_data + 16); - - //k3 = *(u64*)(dkey->key_data); - k3 = *(u64*)(dkey->key_data + 8); - //k3 = *(u64*)(dkey->key_data + 16); + u64 *pos; + /* Set @pos to last eight bytes of sector @data. */ + pos = (u64*)(data + 512 - 8); do { - *pos ^= k2; + /* Apply in-whitening. */ + *pos ^= dkey->desx_key[0]; + /* Apply DES decyption. */ if ((gcry_error2 = gcry_cipher_decrypt( - dkey->gcry_cipher_hd, - (unsigned char*)pos, 8, NULL, 0))) { + dkey->gcry_cipher_hd, (u8*)pos, 8, + NULL, 0))) fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); + /* Apply out-whitening. */ + *pos ^= dkey->desx_key[1]; + if (pos == (u64*)data) break; - } - *pos ^= k3; - } while (++pos < end); + *pos ^= *(pos - 1); + pos--; + } while (1); } - - if (dkey->gcry_algo == GCRY_CIPHER_AES256) { - ((unsigned long long *)data)[0] ^= + /* Apply the IV. */ + if (dkey->alg_id == CALG_AES) { + ((u64*)data)[0] ^= 0x5816657be9161312LL + offset; - ((unsigned long long *)data)[1] ^= + ((u64*)data)[1] ^= 0x1989adbe44918961LL + offset; } else { /* All other algos (Des, 3Des, DesX) use the same IV. */ - ((unsigned long long *)data)[0] ^= + ((u64*)data)[0] ^= 0x169119629891ad13LL + offset; } return 512; @@ -488,7 +480,7 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, * * FIXME: Is this endianness safe? I think so but I may be wrong... */ -void desx_key_expand(u8 *src, u8* dst) { +static void desx_key_expand(u8 *src, u8* dst) { static const int salt_len = 12; static const u8 *salt1 = "Dan Simon "; static const u8 *salt2 = "Scott Field"; @@ -515,85 +507,64 @@ void desx_key_expand(u8 *src, u8* dst) { return; } -static decrypt_key *decrypt_make_gcry_key(char *key_data, int gcry_algo) { - int gcry_length; - gcry_error_t gcry_error2; +decrypt_key *decrypt_make_key(decrypt_session *session __attribute__((unused)), + unsigned int data_size __attribute__((unused)), + unsigned char *data) { DECRYPT_KEY *key; + unsigned int key_size, gcry_algo; + int gcry_length, gcry_mode; + gcry_error_t gcry_error2; + + key_size = *(u32*)data; if (!(key = (DECRYPT_KEY *)malloc(sizeof(DECRYPT_KEY)))) { errno = -1; return NULL; } - key->key_data = key_data; + key->alg_id = *(u32*)(data + 8); + key->key_data = data + 16; + gcry_mode = GCRY_CIPHER_MODE_CBC; - switch (gcry_algo) { - case GCRY_CIPHER_DES_SK: + switch (key->alg_id) { + case CALG_DESX: + fprintf(stderr, "DESX key of %u bytes\n", key_size); + fprintf(stderr, "on-disk key (hex) = 0x%llx, 0x%llx\n", + *(u64*)key->key_data, *(u64*)(key->key_data+8)); + desx_key_expand(key->key_data, (u8*)&key->desx_key); + fprintf(stderr, "expanded keys (hex) = 0x%llx, 0x%llx, " + "0x%llx\n", key->desx_key[0], key->desx_key[1], + key->desx_key[2]); + key->key_data = (u8*)&key->desx_key[2]; + gcry_mode = GCRY_CIPHER_MODE_ECB; + gcry_length = 8; gcry_algo = GCRY_CIPHER_DES; - key->gcry_mode = GCRY_CIPHER_MODE_ECB; - gcry_length = 8; - //key_data += 8; - key_data += 16; break; - case GCRY_CIPHER_3DES: - key->gcry_mode = GCRY_CIPHER_MODE_CBC; + case CALG_3DES: + fprintf(stderr, "3DES Key of %u bytes\n", key_size); gcry_length = 24; + gcry_algo = GCRY_CIPHER_3DES; break; - case GCRY_CIPHER_AES256: - key->gcry_mode = GCRY_CIPHER_MODE_CBC; + case CALG_AES_256: + fprintf(stderr, "AES Key of %u bytes\n", key_size); gcry_length = 32; - break; - case GCRY_CIPHER_DES: - key->gcry_mode = GCRY_CIPHER_MODE_CBC; - gcry_length = 8; + gcry_algo = GCRY_CIPHER_AES256; break; default: - errno = ENOTSUP; - return 0; + fprintf(stderr, "DES key of %u bytes\n", key_size); + gcry_length = 8; + gcry_algo = GCRY_CIPHER_DES; + break; } - - if ((gcry_error2 = gcry_cipher_open(&key->gcry_cipher_hd, gcry_algo, - key->gcry_mode, 0)) != GPG_ERR_NO_ERROR) { + if ((gcry_error2 = gcry_cipher_open(&key->gcry_cipher_hd, + gcry_algo, gcry_mode, 0)) != GPG_ERR_NO_ERROR) { fprintf(stderr, "gcry_error1 is %u.\n", gcry_error2); errno = -1; return 0; } - if ((gcry_error2 = gcry_cipher_setkey(key->gcry_cipher_hd, - key_data, gcry_length))) { + key->key_data, gcry_length))) { fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); } - - key->gcry_algo = gcry_algo; - return (decrypt_key *)key; } - -decrypt_key *decrypt_make_key( - decrypt_session *session __attribute__((unused)), - unsigned int data_size __attribute__((unused)), - void *data) { - unsigned int key_size, alg_id; - char *key_data; - u8 desx_key[192 / 8]; - - key_size = *((unsigned int *)data); - alg_id = *(((unsigned int *)data) + 2); - key_data = (((char *)data) + 16); - - switch (alg_id) { - case CALG_DESX: - fprintf(stderr, "DESX key of %u bytes\n", key_size); - desx_key_expand(key_data, desx_key); - return decrypt_make_gcry_key(desx_key, GCRY_CIPHER_DES_SK); - case CALG_3DES: - fprintf(stderr, "3DES Key of %u bytes\n", key_size); - return decrypt_make_gcry_key(key_data, GCRY_CIPHER_3DES); - case CALG_AES_256: - fprintf(stderr, "AES Key of %u bytes\n", key_size); - return decrypt_make_gcry_key(key_data, GCRY_CIPHER_AES256); - default: - fprintf(stderr, "DES key of %u bytes\n", key_size); - return decrypt_make_gcry_key(key_data, GCRY_CIPHER_DES); - } -} diff --git a/ntfsprogs/decrypt.h b/ntfsprogs/decrypt.h index bfd5e94b..3d919ddc 100644 --- a/ntfsprogs/decrypt.h +++ b/ntfsprogs/decrypt.h @@ -36,7 +36,7 @@ extern unsigned int decrypt_decrypt(decrypt_key *key, unsigned int data_size, extern unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, unsigned long long offset); extern decrypt_key *decrypt_make_key(decrypt_session *session, - unsigned int data_size, void *data); + unsigned int data_size, unsigned char *data); extern int decrypt_get_block_size(decrypt_key *key); #endif /* defined _NTFS_DECRYPT_H */ From 34c676fad3961488aa8136805dc85b475bd0a94a Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 24 Jul 2005 22:34:36 +0000 Subject: [PATCH 2389/2994] Support relocation of $MFT with $ATTRIBUTE_LIST --- ChangeLog | 5 +++ TODO.ntfsprogs | 1 - ntfsprogs/ntfsresize.8.in | 13 +++--- ntfsprogs/ntfsresize.c | 84 ++++++++++++++++++++++++++++++++++----- 4 files changed, 86 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0bdd47a4..e9ef1810 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,11 @@ xx/xx/xxxx - 1.12.0-WIP ntfs_inode_open. Update ntfsmount to use them. (Yura) - index.c::ntfs_index_lookup: fix bug when index context didn't point on index root in which entry located. (Yura) + - ntfsresize: relocate_attributes(): don't stop processing of MFT + record attributes at AT_DATA of $BadClus and $Bitmap. In practice, + there aren't non-resident attributes after them so this bug, + introduced in 1.11.0, shouldn't have ever caused data loss. (Szaka) + - ntfsresize: support relocation of $MFT with $ATTRIBUTE_LIST. (Szaka) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 72798b1a..a5557154 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -73,7 +73,6 @@ Thanks, ************** High priority - - support $MFT with $ATTRIBUTE_LIST - support splitting up $MFT runs - move ntfs consistency check to libntfs (for ntfsck, ntfsclone, etc) - use different exit codes (e.g. corrupt volume detected, unsupported case, diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 96b518a6..cd191efd 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -1,7 +1,7 @@ .\" -*- nroff -*- .\" Copyright 2002-2005 by Szabolcs Szakacsits All Rights Reserved. .\" -.TH NTFSRESIZE 8 "Jun 2005" "ntfsprogs version @VERSION@" +.TH NTFSRESIZE 8 "Jul 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsresize \- resize an NTFS filesystem without data loss .SH SYNOPSIS @@ -159,7 +159,7 @@ Continue with the real resizing only if the test run passed. Support disks having physical errors, bad sectors. Make a backup by .BR ntfsclone (8) using option --rescue, then run from the command line 'chkdsk /f /r -volume:' on Windows prior using this option with ntfsresize. +volume:' on Windows prior using this option. If the guarantee is still valid for the disk then replace it. It's defected. .TP @@ -181,8 +181,8 @@ don't find your answer then send your question, comment or bug report to but the mailing list is moderated and it can take a short time to approve your post. .PP -There are some very rarely met limitations at present: filesystems having -unknown bad sectors, highly fragmented Master File Table (MFT), relocation +There are a few very rarely met restrictions at present: filesystems having +unknown bad sectors, relocation of the first MFT extent and resizing in the middle of some metadata in some cases aren't supported yet. These cases are detected and resizing is refused, restricted to a safe size or the closest safe @@ -192,7 +192,7 @@ size is displayed. schedules an NTFS consistency check and after the first boot into Windows you must see .B chkdsk -running on a blue background. This is intentional. +running on a blue background. This is intentional and no need to worry about it. Windows may force a quick reboot after the consistency check. Moreover after repartitioning your disk and depending on the hardware configuration, the Windows message @@ -222,7 +222,8 @@ at the University of Granada for their continuous and highly valuable help, furthermore to Erik Meade, Martin Fick, Sandro Hawke, Dave Croal, Lorrin Nelson, Geert Hendrickx, Robert Bjorkman and Richard Burdick for beta testing the relocation support, to Florian Eyben, Fritz Oppliger, -Richard Ebling, Sid-Ahmed Touati, Jan Kiszka for the valued +Richard Ebling, Sid-Ahmed Touati, Jan Kiszka, Benjamin Redelings, Christopher +Haney, Ryan Durk for the valued contributions and to Theodore Ts'o whose .BR resize2fs (8) man page originally formed the basis of this page. diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index dd4ecb74..4f614d31 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -155,6 +155,7 @@ typedef struct { int dirty_inode; /* some inode data got relocated */ int shrink; /* shrink = 1, enlarge = 0 */ s64 badclusters; /* num of physically dead clusters */ + VCN mft_highest_vcn; /* used for relocating the $MFT */ struct progress_bar progress; struct bitmap lcn_bitmap; /* Temporary statistics until all case is supported */ @@ -689,12 +690,10 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) } else if (inode == FILE_MFT) { llcn = &resize->last_mft; - /* - * First run of $MFT AT_DATA and $MFT with AT_ATTRIBUTE_LIST - * isn't supported yet. + * First run of $MFT AT_DATA isn't supported yet. */ - if ((atype != AT_DATA || rl->vcn) && !NInoAttrList(resize->ni)) + if (atype != AT_DATA || rl->vcn) supported = 1; } else if (NInoAttrList(resize->ni)) { @@ -1625,7 +1624,56 @@ static void relocate_attribute(ntfs_resize_t *resize) free(rl); } -static void relocate_attributes(ntfs_resize_t *resize) +static int is_mftdata(ntfs_resize_t *resize) +{ + if (resize->ctx->attr->type != AT_DATA) + return 0; + + if (resize->mref == 0) + return 1; + + if ( MREF(resize->mrec->base_mft_record) == 0 && + MSEQNO(resize->mrec->base_mft_record) != 0) + return 1; + + return 0; +} + +static int handle_mftdata(ntfs_resize_t *resize, int do_mftdata) +{ + ATTR_RECORD *attr = resize->ctx->attr; + VCN highest_vcn, lowest_vcn; + + if (do_mftdata) { + + if (!is_mftdata(resize)) + return 0; + + highest_vcn = sle64_to_cpu(attr->highest_vcn); + lowest_vcn = sle64_to_cpu(attr->lowest_vcn); + + if (resize->mft_highest_vcn != highest_vcn) + return 0; + + if (lowest_vcn == 0) + resize->mft_highest_vcn = lowest_vcn; + else + resize->mft_highest_vcn = lowest_vcn - 1; + + } else if (is_mftdata(resize)) { + + highest_vcn = sle64_to_cpu(attr->highest_vcn); + + if (resize->mft_highest_vcn < highest_vcn) + resize->mft_highest_vcn = highest_vcn; + + return 0; + } + + return 1; +} + +static void relocate_attributes(ntfs_resize_t *resize, int do_mftdata) { int ret; @@ -1636,6 +1684,9 @@ static void relocate_attributes(ntfs_resize_t *resize) if (resize->ctx->attr->type == AT_END) break; + if (handle_mftdata(resize, do_mftdata) == 0) + continue; + ret = has_bad_sectors(resize, 0); if (ret == -1) exit(1); @@ -1652,7 +1703,7 @@ static void relocate_attributes(ntfs_resize_t *resize) ntfs_attr_put_search_ctx(resize->ctx); } -static void relocate_inode(ntfs_resize_t *resize, MFT_REF mref) +static void relocate_inode(ntfs_resize_t *resize, MFT_REF mref, int do_mftdata) { if (ntfs_file_record_read(resize->vol, mref, &resize->mrec, NULL)) { /* FIXME: continue only if it make sense, e.g. @@ -1668,7 +1719,7 @@ static void relocate_inode(ntfs_resize_t *resize, MFT_REF mref) resize->mref = mref; resize->dirty_inode = DIRTY_NONE; - relocate_attributes(resize); + relocate_attributes(resize, do_mftdata); if (resize->dirty_inode == DIRTY_INODE) { // if (vol->dev->d_ops->sync(vol->dev) == -1) @@ -1682,6 +1733,7 @@ static void relocate_inodes(ntfs_resize_t *resize) { s64 nr_mft_records; MFT_REF mref; + VCN highest_vcn; printf("Relocating needed data ...\n"); @@ -1695,11 +1747,23 @@ static void relocate_inodes(ntfs_resize_t *resize) nr_mft_records = resize->vol->mft_na->initialized_size >> resize->vol->mft_record_size_bits; - for (mref = 1; mref < (MFT_REF)nr_mft_records; mref++) - relocate_inode(resize, mref); + for (mref = 0; mref < (MFT_REF)nr_mft_records; mref++) + relocate_inode(resize, mref, 0); - relocate_inode(resize, 0); + while(1) { + highest_vcn = resize->mft_highest_vcn; + mref = nr_mft_records; + do { + relocate_inode(resize, --mref, 1); + if (resize->mft_highest_vcn == 0) + goto done; + } while (mref); + if (highest_vcn == resize->mft_highest_vcn) + err_exit("Sanity check failed! Highest_vcn = %lld. " + "Please report!", highest_vcn); + } +done: if (resize->mrec) free(resize->mrec); } From 7943e71620769df6a4b1b9638c54ea73a563ba63 Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 25 Jul 2005 20:40:07 +0000 Subject: [PATCH 2390/2994] Support resizing into the middle of a $MFT $DATA extent --- ChangeLog | 4 +++- TODO.ntfsprogs | 1 - ntfsprogs/ntfsresize.8.in | 6 +++--- ntfsprogs/ntfsresize.c | 14 ++++---------- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9ef1810..507173f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,7 +10,9 @@ xx/xx/xxxx - 1.12.0-WIP record attributes at AT_DATA of $BadClus and $Bitmap. In practice, there aren't non-resident attributes after them so this bug, introduced in 1.11.0, shouldn't have ever caused data loss. (Szaka) - - ntfsresize: support relocation of $MFT with $ATTRIBUTE_LIST. (Szaka) + - ntfsresize: support relocation of $MFT with $ATTRIBUTE_LIST. (Szaka) + - ntfsresize: support resizing into the middle of a $MFT $DATA + extent. (Szaka) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index a5557154..7f95de06 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -73,7 +73,6 @@ Thanks, ************** High priority - - support splitting up $MFT runs - move ntfs consistency check to libntfs (for ntfsck, ntfsclone, etc) - use different exit codes (e.g. corrupt volume detected, unsupported case, bad sectors, etc) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index cd191efd..2024eea6 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -183,9 +183,9 @@ to approve your post. .PP There are a few very rarely met restrictions at present: filesystems having unknown bad sectors, relocation -of the first MFT extent and resizing in the middle of some metadata -in some cases aren't supported yet. These cases are detected and -resizing is refused, restricted to a safe size or the closest safe +of the first MFT extent and resizing into the middle of a $MFTMirr extent +aren't supported yet. These cases are detected and +resizing is restricted to a safe size or the closest safe size is displayed. .PP .B Ntfsresize diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 4f614d31..73798205 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -759,16 +759,10 @@ static void collect_relocation_info(ntfs_resize_t *resize, runlist *rl) start = new_vol_size; len = lcn_length - (new_vol_size - lcn); - if (!opt.info && (inode == FILE_MFT || inode == FILE_MFTMirr)) { - s64 last_lcn; - - err_printf("$MFT%s can't be split up yet. Please try " - "a different size.\n", inode ? "Mirr" : ""); - last_lcn = lcn + lcn_length - 1; - if (!(inode == FILE_MFT && rl->vcn == 0) && - lcn - 1 >= resize->inuse) - __print_advise(resize->vol, lcn - 1); - print_advise(resize->vol, last_lcn); + if (!opt.info && (inode == FILE_MFTMirr)) { + err_printf("$MFTMirr can't be split up yet. Please try " + "a different size.\n"); + print_advise(resize->vol, lcn + lcn_length - 1); exit(1); } } From 61ee94dfb218505ff161d21604a0e5108a2498c3 Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 25 Jul 2005 21:19:08 +0000 Subject: [PATCH 2391/2994] Don't show detailed resizing related info by default since the only real restriction to shrink to the smallest size possible is the relocation of the first $MFT $DATA extent, usually around 3 GB. --- ntfsprogs/ntfsresize.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 73798205..bc05ae3b 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -522,7 +522,7 @@ static int parse_options(int argc, char **argv) return (!err && !help && !ver); } -static void __print_advise(ntfs_volume *vol, s64 supp_lcn) +static void print_advise(ntfs_volume *vol, s64 supp_lcn) { s64 old_b, new_b, freed_b, old_mb, new_mb, freed_mb; @@ -556,11 +556,7 @@ static void __print_advise(ntfs_volume *vol, s64 supp_lcn) else printf("%lld bytes", (long long)freed_b); printf(").\n"); -} -static void print_advise(ntfs_volume *vol, s64 supp_lcn) -{ - __print_advise(vol, supp_lcn); printf("Please make a test run using both the -n and -s options " "before real resizing!\n"); } @@ -1107,7 +1103,7 @@ static void set_resize_constraints(ntfs_resize_t *resize) s64 nr_mft_records, inode; ntfs_inode *ni; - printf("Collecting shrinkage constraints ...\n"); + printf("Collecting resizing constraints ...\n"); nr_mft_records = resize->vol->mft_na->initialized_size >> resize->vol->mft_record_size_bits; @@ -1786,16 +1782,15 @@ static void advise_on_resize(ntfs_resize_t *resize) { ntfs_volume *vol = resize->vol; - printf("Estimating smallest shrunken size supported ...\n"); - - printf("File feature Last used at By inode\n"); - print_hint(vol, "$MFT", resize->last_mft); - print_hint(vol, "Multi-Record", resize->last_multi_mft); if (opt.verbose) { - print_hint(vol, "$MFTMirr", resize->last_mftmir); - print_hint(vol, "Compressed", resize->last_compressed); - print_hint(vol, "Sparse", resize->last_sparse); - print_hint(vol, "Ordinary", resize->last_lcn); + printf("Estimating smallest shrunken size supported ...\n"); + printf("File feature Last used at By inode\n"); + print_hint(vol, "$MFT", resize->last_mft); + print_hint(vol, "Multi-Record", resize->last_multi_mft); + print_hint(vol, "$MFTMirr", resize->last_mftmir); + print_hint(vol, "Compressed", resize->last_compressed); + print_hint(vol, "Sparse", resize->last_sparse); + print_hint(vol, "Ordinary", resize->last_lcn); } print_advise(vol, resize->last_unsupp); From 0de66be9c03cbc75b111269aca42fe0483092e1b Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 25 Jul 2005 22:05:27 +0000 Subject: [PATCH 2392/2994] ntfscp.c: fix bug intoduced by Anton in changeset 1.21 ntfsinfo: more info on index dumping dir.c, layout.h: minor fixes --- include/ntfs/layout.h | 2 +- libntfs/dir.c | 2 +- ntfsprogs/ntfscp.c | 8 ++++++-- ntfsprogs/ntfsinfo.c | 12 +++++++++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 71d9c515..44a131c2 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -2221,7 +2221,7 @@ typedef struct { // follows the INDEX_ENTRY_HEADER. Regardless of // key_length, the address of the 8-byte boundary // aligned vcn of INDEX_ENTRY{_HEADER} *ie is given by - // (char*)ie + le16_to_cpu(ie*)->length) - sizeof(VCN), + // (char*)ie + le16_to_cpu(ie->length) - sizeof(VCN), // where sizeof(VCN) can be hardcoded as 8 if wanted. */ } __attribute__ ((__packed__)) INDEX_ENTRY; diff --git a/libntfs/dir.c b/libntfs/dir.c index 50d79358..8dbc7723 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -938,7 +938,7 @@ find_next_index_buffer: } } - Dprintf("Handling index block 0x%llx.", (long long)bmp_pos); + Dprintf("Handling index block 0x%llx.\n", (long long)bmp_pos); /* Read the index block starting at bmp_pos. */ br = ntfs_attr_mst_pread(ia_na, bmp_pos << index_block_size_bits, 1, diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index fd7b100f..64e329de 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -262,7 +262,7 @@ int main (int argc, char *argv[]) u64 offset; char *buf; s64 br, bw; - ntfschar *attr_name = AT_UNNAMED; + ntfschar *attr_name; int attr_name_len = 0; if (!parse_options(argc, argv)) @@ -363,12 +363,14 @@ int main (int argc, char *argv[]) } if (opts.attr_name) { + attr_name = NULL; attr_name_len = ntfs_mbstoucs(opts.attr_name, &attr_name, 0); if (attr_name_len == -1) { perror("ERROR: Failed to parse attribute name"); goto close_dst; } - } + } else + attr_name = AT_UNNAMED; na = ntfs_attr_open(out, opts.attribute, attr_name, attr_name_len); if (!na) { if (errno != ENOENT) { @@ -383,6 +385,8 @@ int main (int argc, char *argv[]) goto close_dst; } } + if (attr_name != AT_UNNAMED) + free(attr_name); Vprintf("Old file size: %lld\n", na->data_size); if (na->data_size != new_size) { diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 833d897c..107b58a6 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1086,7 +1086,6 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) int numb_entries = 1; char *name = NULL; - Vprintf("\tDumping index entries:"); while(1) { if (!opts.verbose) { if (entry->flags & INDEX_ENTRY_END) @@ -1103,6 +1102,10 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) le16_to_cpu(entry->key_length)); Vprintf("\t\tFlags:\t\t\t 0x%02x\n", le16_to_cpu(entry->flags)); + if (entry->flags & INDEX_ENTRY_NODE) + Vprintf("\t\tSubnode VCN:\t\t %lld\n", le64_to_cpu( + *((u8*)entry + le16_to_cpu( + entry->length) - sizeof(VCN)))); if (entry->flags & INDEX_ENTRY_END) break; @@ -1224,6 +1227,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) entry = (INDEX_ENTRY *)((u8 *)index_root + le32_to_cpu(index_root->index.entries_offset) + 0x10); + Vprintf("\tDumping index block:"); printf("\tIndex entries total:\t %d\n", ntfs_dump_index_entries(entry, index_root->type)); } @@ -1344,6 +1348,12 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) } entry = (INDEX_ENTRY *)((u8 *)tmp_alloc + le32_to_cpu( tmp_alloc->index.entries_offset) + 0x18); + Vprintf("\tDumping index block " + "(VCN %lld, used %u/%u):", le64_to_cpu( + tmp_alloc->index_block_vcn), + le32_to_cpu(tmp_alloc->index. + index_length), le32_to_cpu(tmp_alloc-> + index.allocated_size)); total_entries += ntfs_dump_index_entries(entry, type); total_indx_blocks++; } From a70ca11003573787fa98d56c700efa0908e870fc Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 25 Jul 2005 22:08:42 +0000 Subject: [PATCH 2393/2994] update --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 507173f9..105dedea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,8 @@ xx/xx/xxxx - 1.12.0-WIP - ntfsresize: support relocation of $MFT with $ATTRIBUTE_LIST. (Szaka) - ntfsresize: support resizing into the middle of a $MFT $DATA extent. (Szaka) + - ntfscp: fix attribute name parsing bug introduced in 1.10.0. (Yura) + - ntfsinfo: dump more information for indexes. (Yura) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. From 261f059e3e8e79287b73b3775702271562eabcdc Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 25 Jul 2005 23:23:48 +0000 Subject: [PATCH 2394/2994] - Fix bug I introduced causing the IV to be wrong for AES decryption. - Fix a bug where we fail to supply the buffer size when exporting the key. Not sure how that ever worked... --- ntfsprogs/decrypt.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 9d3da02a..18d5e71a 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -232,6 +232,7 @@ decrypt_key *decrypt_user_key_open(decrypt_session *session goto decrypt_key_open_err; } + key_size = sizeof(key_blob); if (!CryptExportKey(hCryptKey, 0, PRIVATEKEYBLOB, 0, key_blob, &key_size)) { fprintf(stderr, "Could not export key: Error 0x%x\n", (unsigned int)GetLastError()); @@ -423,14 +424,12 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, gcry_error_t gcry_error2; DECRYPT_KEY *dkey = (DECRYPT_KEY *)key; - if ((gcry_error2 = gcry_cipher_reset(dkey->gcry_cipher_hd))) { - fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); - } - // FIXME: Why are we not calling gcry_cipher_setiv() here instead of // doing it by hand after the decryption? if (dkey->alg_id != CALG_DESX) { + if ((gcry_error2 = gcry_cipher_reset(dkey->gcry_cipher_hd))) + fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); if ((gcry_error2 = gcry_cipher_decrypt(dkey->gcry_cipher_hd, data, 512, NULL, 0))) fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); @@ -440,6 +439,10 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, /* Set @pos to last eight bytes of sector @data. */ pos = (u64*)(data + 512 - 8); do { + if ((gcry_error2 = gcry_cipher_reset( + dkey->gcry_cipher_hd))) + fprintf(stderr, "gcry_error2 is %u.\n", + gcry_error2); /* Apply in-whitening. */ *pos ^= dkey->desx_key[0]; /* Apply DES decyption. */ @@ -457,15 +460,12 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, } while (1); } /* Apply the IV. */ - if (dkey->alg_id == CALG_AES) { - ((u64*)data)[0] ^= - 0x5816657be9161312LL + offset; - ((u64*)data)[1] ^= - 0x1989adbe44918961LL + offset; + if (dkey->alg_id == CALG_AES_256) { + ((u64*)data)[0] ^= 0x5816657be9161312LL + offset; + ((u64*)data)[1] ^= 0x1989adbe44918961LL + offset; } else { /* All other algos (Des, 3Des, DesX) use the same IV. */ - ((u64*)data)[0] ^= - 0x169119629891ad13LL + offset; + ((u64*)data)[0] ^= 0x169119629891ad13LL + offset; } return 512; } From 54b65e2b3cb7011f8082456d144bfc8365c009b3 Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 26 Jul 2005 01:32:51 +0000 Subject: [PATCH 2395/2994] Fixes for key order for desx. Still doesn't work but now keys are correct. --- ntfsprogs/decrypt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 18d5e71a..a812043a 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -444,7 +444,7 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); /* Apply in-whitening. */ - *pos ^= dkey->desx_key[0]; + *pos ^= dkey->desx_key[2]; /* Apply DES decyption. */ if ((gcry_error2 = gcry_cipher_decrypt( dkey->gcry_cipher_hd, (u8*)pos, 8, @@ -535,7 +535,7 @@ decrypt_key *decrypt_make_key(decrypt_session *session __attribute__((unused)), fprintf(stderr, "expanded keys (hex) = 0x%llx, 0x%llx, " "0x%llx\n", key->desx_key[0], key->desx_key[1], key->desx_key[2]); - key->key_data = (u8*)&key->desx_key[2]; + key->key_data = (u8*)&key->desx_key[0]; gcry_mode = GCRY_CIPHER_MODE_ECB; gcry_length = 8; gcry_algo = GCRY_CIPHER_DES; From 7cd7b2416fa91c2166a2863af2208992a9d77248 Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 26 Jul 2005 16:35:00 +0000 Subject: [PATCH 2396/2994] finally have verified des key expansion to be correct and have test cases for it and des decryption. Currently the des test fails. It appears ntfs does not use standard des encryption. )-: Perhaps it uses the export non-restricted 40-bit des key instead of 56-bit des... --- ntfsprogs/decrypt.c | 133 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 128 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index a812043a..baca003f 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -419,6 +419,8 @@ unsigned int decrypt_decrypt(decrypt_key *key, unsigned int data_size, #endif // USER_CRYPTOAPI_RSA (else) } +static BOOL is_first = TRUE; + unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, unsigned long long offset) { gcry_error_t gcry_error2; @@ -426,6 +428,8 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, // FIXME: Why are we not calling gcry_cipher_setiv() here instead of // doing it by hand after the decryption? + // It wants iv length 8 but we give it 16 for AES256 so it does not + // like it... if (dkey->alg_id != CALG_DESX) { if ((gcry_error2 = gcry_cipher_reset(dkey->gcry_cipher_hd))) @@ -443,20 +447,45 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, dkey->gcry_cipher_hd))) fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); + if (is_first) { + fprintf(stderr, "encrypted data = 0x%llx\n", + *pos); + fprintf(stderr, "in-whitening = 0x%llx\n", + dkey->desx_key[1]); + } /* Apply in-whitening. */ - *pos ^= dkey->desx_key[2]; + *pos ^= dkey->desx_key[1]; + if (is_first) + fprintf(stderr, "whitened data = 0x%llx\n", + *pos); /* Apply DES decyption. */ if ((gcry_error2 = gcry_cipher_decrypt( dkey->gcry_cipher_hd, (u8*)pos, 8, NULL, 0))) fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); + if (is_first) { + fprintf(stderr, "data after des = 0x%llx\n", + *pos); + fprintf(stderr, "out-whitening = 0x%llx\n", + dkey->desx_key[2]); + } /* Apply out-whitening. */ - *pos ^= dkey->desx_key[1]; + *pos ^= dkey->desx_key[2]; + if (is_first) + fprintf(stderr, "out-whitened data = 0x%llx\n", + *pos); if (pos == (u64*)data) break; + if (is_first) + fprintf(stderr, "next encrypted data = " + "0x%llx\n", *(pos - 1)); *pos ^= *(pos - 1); + if (is_first) + fprintf(stderr, "decrypted data = 0x%llx\n", + *pos); pos--; + is_first = FALSE; } while (1); } /* Apply the IV. */ @@ -480,7 +509,7 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, * * FIXME: Is this endianness safe? I think so but I may be wrong... */ -static void desx_key_expand(u8 *src, u8* dst) { +static void desx_key_expand(const u8 *src, u8* dst) { static const int salt_len = 12; static const u8 *salt1 = "Dan Simon "; static const u8 *salt2 = "Scott Field"; @@ -507,6 +536,82 @@ static void desx_key_expand(u8 *src, u8* dst) { return; } +#define DO_CRYPTO_TESTS 1 + +#ifdef DO_CRYPTO_TESTS +/* Do not remove this test code from this file! AIA */ +static BOOL desx_key_expand_test(void) { + const u8 known_desx_on_disk_key[16] = { + 0xa1, 0xf9, 0xe0, 0xb2, 0x53, 0x23, 0x9e, 0x8f, + 0x0f, 0x91, 0x45, 0xd9, 0x8e, 0x20, 0xec, 0x30 }; + const u8 known_desx_expanded_key[24] = { + 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f, + 0xed, 0xda, 0x4c, 0x47, 0x60, 0x49, 0xdb, 0x8d, + 0x75, 0xf6, 0xa0, 0x1a, 0xc0, 0xca, 0x28, 0x1e }; + u8 test_desx_expanded_key[24]; + int res; + + desx_key_expand(known_desx_on_disk_key, test_desx_expanded_key); + res = !memcmp(test_desx_expanded_key, known_desx_expanded_key, + sizeof(known_desx_expanded_key)); + fprintf(stderr, "Testing whether desx_key_expand() works: %s\n", + res ? "SUCCESS" : "FAILED"); + return res; +} + +static BOOL des_test(void) { + const u8 known_des_key[8] = { + 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f }; + const u8 known_des_encrypted_data[8] = { + 0xdc, 0xf7, 0x68, 0x2a, 0xaf, 0x48, 0x53, 0x0f }; + const u8 known_decrypted_data[8] = { + 0xd8, 0xd9, 0x15, 0x23, 0x5b, 0x88, 0x0e, 0x09 }; + u8 test_decrypted_data[8]; + int res; + gcry_error_t gcry_error2; + gcry_cipher_hd_t gcry_cipher_hd; + + if ((gcry_error2 = gcry_cipher_open(&gcry_cipher_hd, GCRY_CIPHER_DES, + GCRY_CIPHER_MODE_ECB, 0)) != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to open des cipher (gcry_error2 is " + "%u).\n", gcry_error2); + return FALSE; + } + if ((gcry_error2 = gcry_cipher_setkey(gcry_cipher_hd, + known_des_key, sizeof(known_des_key)))) { + fprintf(stderr, "Failed to set des key (gcry_error2 is %u).\n", + gcry_error2); + gcry_cipher_close(gcry_cipher_hd); + return FALSE; + } + memcpy(test_decrypted_data, known_des_encrypted_data, + sizeof(known_des_encrypted_data)); + /* Apply DES decyption. */ + gcry_error2 = gcry_cipher_decrypt(gcry_cipher_hd, + test_decrypted_data, sizeof(test_decrypted_data), + NULL, 0); + gcry_cipher_close(gcry_cipher_hd); + if (gcry_error2) { + fprintf(stderr, "Failed to des decrypt test data (gcry_error2 " + "is %u).\n", gcry_error2); + return FALSE; + } + res = !memcmp(test_decrypted_data, known_decrypted_data, + sizeof(known_decrypted_data)); + fprintf(stderr, "Testing whether des decryption works: %s\n", + res ? "SUCCESS" : "FAILED"); + return res; +} + +#else +static inline BOOL desx_key_expand_test(void) { + return TRUE; +} +static inline BOOL des_test(void) { + return TRUE; +} +#endif + decrypt_key *decrypt_make_key(decrypt_session *session __attribute__((unused)), unsigned int data_size __attribute__((unused)), unsigned char *data) { @@ -528,17 +633,30 @@ decrypt_key *decrypt_make_key(decrypt_session *session __attribute__((unused)), switch (key->alg_id) { case CALG_DESX: + if (!desx_key_expand_test()) { + free(key); + errno = -1; + return NULL; + } fprintf(stderr, "DESX key of %u bytes\n", key_size); fprintf(stderr, "on-disk key (hex) = 0x%llx, 0x%llx\n", *(u64*)key->key_data, *(u64*)(key->key_data+8)); desx_key_expand(key->key_data, (u8*)&key->desx_key); - fprintf(stderr, "expanded keys (hex) = 0x%llx, 0x%llx, " - "0x%llx\n", key->desx_key[0], key->desx_key[1], + fprintf(stderr, "expanded keys (hex) =\n\t0x%llx (des)\n\t" + "0x%llx (in-whitening)\n\t" + "0x%llx (out-whitening)\n", key->desx_key[0], + key->desx_key[1], key->desx_key[2]); + if (!des_test()) { + free(key); + errno = -1; + return NULL; + } key->key_data = (u8*)&key->desx_key[0]; gcry_mode = GCRY_CIPHER_MODE_ECB; gcry_length = 8; gcry_algo = GCRY_CIPHER_DES; + is_first = TRUE; break; case CALG_3DES: fprintf(stderr, "3DES Key of %u bytes\n", key_size); @@ -552,6 +670,11 @@ decrypt_key *decrypt_make_key(decrypt_session *session __attribute__((unused)), break; default: fprintf(stderr, "DES key of %u bytes\n", key_size); + if (!des_test()) { + free(key); + errno = -1; + return NULL; + } gcry_length = 8; gcry_algo = GCRY_CIPHER_DES; break; From d723668d277e3a1e358be342fbbb7e5cd973f9d6 Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 27 Jul 2005 09:18:26 +0000 Subject: [PATCH 2397/2994] decrypt.c: - Finally working desx decryption thanks to Yuval figuring out that ntfs uses des encryption when decrypting!!! (Yuval) - Make it compile on Linux. (Anton) - Add CALG_DES constant for Linux. (Anton) --- ntfsprogs/decrypt.c | 437 +++++++++++++++++++++++--------------------- 1 file changed, 224 insertions(+), 213 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index baca003f..a29066e4 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -2,6 +2,7 @@ * decrypt.c - Part of the Linux-NTFS project. * * Copyright (c) 2005 Yuval Fledel + * Copyright (c) 2005 Anton Altaparmakov * * $EFS decryption routines. * @@ -77,7 +78,8 @@ static HMODULE hCrypt32 = INVALID_HANDLE_VALUE; #include #include -/* If not one of the below three, use standard Des. */ +#define CALG_DES (0x6601) +/* If not one of the below three, fall back to standard Des. */ #define CALG_3DES (0x6603) #define CALG_DESX (0x6604) #define CALG_AES_256 (0x6610) @@ -106,6 +108,117 @@ typedef struct { #endif /* defined(__CYGWIN__) */ } DECRYPT_KEY; +/* DESX-MS128 implementation for libgcrypt. */ +static gcry_module_t desx_module; +static int desx_algorithm_id = -1; + +typedef struct desx_ctx { + gcry_cipher_hd_t gcry_cipher_hd; + u8 in_whitening[8], out_whitening[8]; +} desx_ctx; + +/** + * desx_key_expand - expand a 128-bit desx key to the needed 192-bit key + * @src: source buffer containing 128-bit key + * @dst: destination buffer to write 192-bit key to + * + * Expands the on-disk 128-bit desx key to the needed full 192-bit desx key + * required to perform desx {de,en}cryption. + * + * FIXME: Is this endianness safe? I think so but I may be wrong... + */ +static void desx_key_expand(const u8 *src, u8 *in_whitening, u8 *out_whitening, + u8 *des_key) +{ + static const int salt_len = 12; + static const u8 *salt1 = "Dan Simon "; + static const u8 *salt2 = "Scott Field"; + u8 md[16]; + MD5_CTX ctx1, ctx2; + + MD5_Init(&ctx1); + + /* Hash the on-disk key. */ + MD5_Update(&ctx1, src, 128 / 8); + memcpy(&ctx2, &ctx1, sizeof(ctx1)); + + /* Hash with the first salt and store the result. */ + MD5_Update(&ctx1, salt1, salt_len); + MD5_Final(md, &ctx1); + ((u32*)des_key)[0] = ((u32*)md)[0] ^ ((u32*)md)[1]; + ((u32*)des_key)[1] = ((u32*)md)[2] ^ ((u32*)md)[3]; + + /* Hash with the second salt and store the result. */ + MD5_Update(&ctx2, salt2, salt_len); + MD5_Final(md, &ctx2); + memcpy(out_whitening, md, 8); + memcpy(in_whitening, md+8, 8); +} + +static gcry_err_code_t do_desx_setkey(void *context, const u8 *key, + unsigned keylen) +{ + struct desx_ctx *ctx = (desx_ctx *)context; + gcry_error_t err; + u8 des_key[8]; + + if (keylen != 16) { + fprintf(stderr, "not 16\n"); + return GPG_ERR_INV_KEYLEN; + } + + if ((err = gcry_cipher_open(&ctx->gcry_cipher_hd, GCRY_CIPHER_DES, + GCRY_CIPHER_MODE_ECB, 0)) != GPG_ERR_NO_ERROR) + return err; + + if ((err = gcry_cipher_reset(ctx->gcry_cipher_hd))) { + fprintf(stderr, "err is %u.\n", err); + } + + desx_key_expand(key, ctx->in_whitening, ctx->out_whitening, des_key); + +/* + fprintf(stderr, "expanded keys (hex) =\n\t0x%llx (des)\n\t" + "0x%llx (in-whitening)\n\t" + "0x%llx (out-whitening)\n", *(u64*)des_key, + *(u64*)ctx->in_whitening, *(u64*)ctx->out_whitening); +*/ + + if ((err = gcry_cipher_setkey(ctx->gcry_cipher_hd, des_key, 8))) { + fprintf(stderr, "do_desx_setkey: error %u.\n", err); + // TODO: destroy gcry_cipher_hd + } + + return GPG_ERR_NO_ERROR; +} + +static void do_desx_decrypt(void *context, u8 *outbuf, const u8 *inbuf) +{ + struct desx_ctx *ctx = (desx_ctx *)context; + gcry_error_t err; + u8 buf[8]; + + *((unsigned long long *)buf) = *((const unsigned long long *)inbuf) + ^ *(const unsigned long long *)ctx->out_whitening; + + if ((err = gcry_cipher_encrypt(ctx->gcry_cipher_hd, + outbuf, 8, buf, 8))) { + fprintf(stderr, "desx decryption failed: %u.\n", err); + } + + *((unsigned long long *)outbuf) ^= *(const unsigned long long *) + ctx->in_whitening; +} + +static gcry_cipher_spec_t cipher = { + .name = "DES-X-MS128", + .blocksize = 8, + .keylen = 128, + .contextsize = sizeof (struct desx_ctx), + .setkey = do_desx_setkey, + .decrypt = do_desx_decrypt, +}; + #ifdef __CYGWIN__ static int cryptoAPI_init_imports(void) @@ -139,9 +252,101 @@ static int cryptoAPI_init_imports(void) } #endif /* defined(__CYGWIN__) */ +//#define DO_CRYPTO_TESTS 1 + +#ifdef DO_CRYPTO_TESTS +/* Do not remove this test code from this file! AIA */ +static BOOL desx_key_expand_test(void) { + const u8 known_desx_on_disk_key[16] = { + 0xa1, 0xf9, 0xe0, 0xb2, 0x53, 0x23, 0x9e, 0x8f, + 0x0f, 0x91, 0x45, 0xd9, 0x8e, 0x20, 0xec, 0x30 }; + const u8 known_desx_expanded_key[24] = { + 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f, + 0xed, 0xda, 0x4c, 0x47, 0x60, 0x49, 0xdb, 0x8d, + 0x75, 0xf6, 0xa0, 0x1a, 0xc0, 0xca, 0x28, 0x1e }; + u8 test_desx_expanded_key[24]; + int res; + + desx_key_expand(known_desx_on_disk_key, test_desx_expanded_key); + res = !memcmp(test_desx_expanded_key, known_desx_expanded_key, + sizeof(known_desx_expanded_key)); + fprintf(stderr, "Testing whether desx_key_expand() works: %s\n", + res ? "SUCCESS" : "FAILED"); + return res; +} + +static BOOL des_test(void) { + const u8 known_des_key[8] = { + 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f }; + const u8 known_des_encrypted_data[8] = { + 0xdc, 0xf7, 0x68, 0x2a, 0xaf, 0x48, 0x53, 0x0f }; + const u8 known_decrypted_data[8] = { + 0xd8, 0xd9, 0x15, 0x23, 0x5b, 0x88, 0x0e, 0x09 }; + u8 test_decrypted_data[8]; + int res; + gcry_error_t gcry_error2; + gcry_cipher_hd_t gcry_cipher_hd; + + if ((gcry_error2 = gcry_cipher_open(&gcry_cipher_hd, GCRY_CIPHER_DES, + GCRY_CIPHER_MODE_ECB, 0)) != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to open des cipher (gcry_error2 is " + "%u).\n", gcry_error2); + return FALSE; + } + if ((gcry_error2 = gcry_cipher_setkey(gcry_cipher_hd, + known_des_key, sizeof(known_des_key)))) { + fprintf(stderr, "Failed to set des key (gcry_error2 is %u).\n", + gcry_error2); + gcry_cipher_close(gcry_cipher_hd); + return FALSE; + } + memcpy(test_decrypted_data, known_des_encrypted_data, + sizeof(known_des_encrypted_data)); + /* Apply DES decyption. */ + gcry_error2 = gcry_cipher_decrypt(gcry_cipher_hd, + test_decrypted_data, sizeof(test_decrypted_data), + NULL, 0); + gcry_cipher_close(gcry_cipher_hd); + if (gcry_error2) { + fprintf(stderr, "Failed to des decrypt test data (gcry_error2 " + "is %u).\n", gcry_error2); + return FALSE; + } + res = !memcmp(test_decrypted_data, known_decrypted_data, + sizeof(known_decrypted_data)); + fprintf(stderr, "Testing whether des decryption works: %s\n", + res ? "SUCCESS" : "FAILED"); + return res; +} + +#else + +static inline BOOL desx_key_expand_test(void) { + return TRUE; +} + +static inline BOOL des_test(void) { + return TRUE; +} + +#endif + decrypt_session *decrypt_open(void) { decrypt_session *session; + /* TODO: refcount 'module' */ + if (desx_algorithm_id==-1) { + if (!desx_key_expand_test()) + return NULL; + if (!des_test()) + return NULL; + if (gcry_cipher_register(&cipher, &desx_algorithm_id, + &desx_module)) + return NULL; + } + + //fprintf(stderr, "desx_algorithm_id: %d\n", desx_algorithm_id); + gcry_control(GCRYCTL_DISABLE_SECMEM, 0); #ifdef __CYGWIN__ @@ -419,75 +624,25 @@ unsigned int decrypt_decrypt(decrypt_key *key, unsigned int data_size, #endif // USER_CRYPTOAPI_RSA (else) } -static BOOL is_first = TRUE; - unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, unsigned long long offset) { - gcry_error_t gcry_error2; + gcry_error_t err; DECRYPT_KEY *dkey = (DECRYPT_KEY *)key; + if ((err = gcry_cipher_reset(dkey->gcry_cipher_hd))) { + fprintf(stderr, "sector_decrypt: error is %u.\n", err); + } + // FIXME: Why are we not calling gcry_cipher_setiv() here instead of // doing it by hand after the decryption? // It wants iv length 8 but we give it 16 for AES256 so it does not // like it... - if (dkey->alg_id != CALG_DESX) { - if ((gcry_error2 = gcry_cipher_reset(dkey->gcry_cipher_hd))) - fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); - if ((gcry_error2 = gcry_cipher_decrypt(dkey->gcry_cipher_hd, - data, 512, NULL, 0))) - fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); - } else { - u64 *pos; - - /* Set @pos to last eight bytes of sector @data. */ - pos = (u64*)(data + 512 - 8); - do { - if ((gcry_error2 = gcry_cipher_reset( - dkey->gcry_cipher_hd))) - fprintf(stderr, "gcry_error2 is %u.\n", - gcry_error2); - if (is_first) { - fprintf(stderr, "encrypted data = 0x%llx\n", - *pos); - fprintf(stderr, "in-whitening = 0x%llx\n", - dkey->desx_key[1]); - } - /* Apply in-whitening. */ - *pos ^= dkey->desx_key[1]; - if (is_first) - fprintf(stderr, "whitened data = 0x%llx\n", - *pos); - /* Apply DES decyption. */ - if ((gcry_error2 = gcry_cipher_decrypt( - dkey->gcry_cipher_hd, (u8*)pos, 8, - NULL, 0))) - fprintf(stderr, "gcry_error2 is %u.\n", - gcry_error2); - if (is_first) { - fprintf(stderr, "data after des = 0x%llx\n", - *pos); - fprintf(stderr, "out-whitening = 0x%llx\n", - dkey->desx_key[2]); - } - /* Apply out-whitening. */ - *pos ^= dkey->desx_key[2]; - if (is_first) - fprintf(stderr, "out-whitened data = 0x%llx\n", - *pos); - if (pos == (u64*)data) - break; - if (is_first) - fprintf(stderr, "next encrypted data = " - "0x%llx\n", *(pos - 1)); - *pos ^= *(pos - 1); - if (is_first) - fprintf(stderr, "decrypted data = 0x%llx\n", - *pos); - pos--; - is_first = FALSE; - } while (1); + if ((err = gcry_cipher_decrypt(dkey->gcry_cipher_hd, + data, 512, NULL, 0))) { + fprintf(stderr, "sector_decrypt: error is %u.\n", err); } + /* Apply the IV. */ if (dkey->alg_id == CALG_AES_256) { ((u64*)data)[0] ^= 0x5816657be9161312LL + offset; @@ -499,126 +654,12 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, return 512; } -/** - * desx_key_expand - expand a 128-bit desx key to the needed 192-bit key - * @src: source buffer containing 128-bit key - * @dst: destination buffer to write 192-bit key to - * - * Expands the on-disk 128-bit desx key to the needed full 192-bit desx key - * required to perform desx {de,en}cryption. - * - * FIXME: Is this endianness safe? I think so but I may be wrong... - */ -static void desx_key_expand(const u8 *src, u8* dst) { - static const int salt_len = 12; - static const u8 *salt1 = "Dan Simon "; - static const u8 *salt2 = "Scott Field"; - u8 md[16]; - MD5_CTX ctx1, ctx2; - - MD5_Init(&ctx1); - - /* Hash the on-disk key. */ - MD5_Update(&ctx1, src, 128 / 8); - memcpy(&ctx2, &ctx1, sizeof(ctx1)); - - /* Hash with the first salt and store the result. */ - MD5_Update(&ctx1, salt1, salt_len); - MD5_Final(md, &ctx1); - ((u32*)dst)[0] = ((u32*)md)[0] ^ ((u32*)md)[1]; - ((u32*)dst)[1] = ((u32*)md)[2] ^ ((u32*)md)[3]; - - /* Hash with the second salt and store the result. */ - MD5_Update(&ctx2, salt2, salt_len); - MD5_Final(md, &ctx2); - memcpy(dst + 8, md, sizeof(md)); - - return; -} - -#define DO_CRYPTO_TESTS 1 - -#ifdef DO_CRYPTO_TESTS -/* Do not remove this test code from this file! AIA */ -static BOOL desx_key_expand_test(void) { - const u8 known_desx_on_disk_key[16] = { - 0xa1, 0xf9, 0xe0, 0xb2, 0x53, 0x23, 0x9e, 0x8f, - 0x0f, 0x91, 0x45, 0xd9, 0x8e, 0x20, 0xec, 0x30 }; - const u8 known_desx_expanded_key[24] = { - 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f, - 0xed, 0xda, 0x4c, 0x47, 0x60, 0x49, 0xdb, 0x8d, - 0x75, 0xf6, 0xa0, 0x1a, 0xc0, 0xca, 0x28, 0x1e }; - u8 test_desx_expanded_key[24]; - int res; - - desx_key_expand(known_desx_on_disk_key, test_desx_expanded_key); - res = !memcmp(test_desx_expanded_key, known_desx_expanded_key, - sizeof(known_desx_expanded_key)); - fprintf(stderr, "Testing whether desx_key_expand() works: %s\n", - res ? "SUCCESS" : "FAILED"); - return res; -} - -static BOOL des_test(void) { - const u8 known_des_key[8] = { - 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f }; - const u8 known_des_encrypted_data[8] = { - 0xdc, 0xf7, 0x68, 0x2a, 0xaf, 0x48, 0x53, 0x0f }; - const u8 known_decrypted_data[8] = { - 0xd8, 0xd9, 0x15, 0x23, 0x5b, 0x88, 0x0e, 0x09 }; - u8 test_decrypted_data[8]; - int res; - gcry_error_t gcry_error2; - gcry_cipher_hd_t gcry_cipher_hd; - - if ((gcry_error2 = gcry_cipher_open(&gcry_cipher_hd, GCRY_CIPHER_DES, - GCRY_CIPHER_MODE_ECB, 0)) != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to open des cipher (gcry_error2 is " - "%u).\n", gcry_error2); - return FALSE; - } - if ((gcry_error2 = gcry_cipher_setkey(gcry_cipher_hd, - known_des_key, sizeof(known_des_key)))) { - fprintf(stderr, "Failed to set des key (gcry_error2 is %u).\n", - gcry_error2); - gcry_cipher_close(gcry_cipher_hd); - return FALSE; - } - memcpy(test_decrypted_data, known_des_encrypted_data, - sizeof(known_des_encrypted_data)); - /* Apply DES decyption. */ - gcry_error2 = gcry_cipher_decrypt(gcry_cipher_hd, - test_decrypted_data, sizeof(test_decrypted_data), - NULL, 0); - gcry_cipher_close(gcry_cipher_hd); - if (gcry_error2) { - fprintf(stderr, "Failed to des decrypt test data (gcry_error2 " - "is %u).\n", gcry_error2); - return FALSE; - } - res = !memcmp(test_decrypted_data, known_decrypted_data, - sizeof(known_decrypted_data)); - fprintf(stderr, "Testing whether des decryption works: %s\n", - res ? "SUCCESS" : "FAILED"); - return res; -} - -#else -static inline BOOL desx_key_expand_test(void) { - return TRUE; -} -static inline BOOL des_test(void) { - return TRUE; -} -#endif - decrypt_key *decrypt_make_key(decrypt_session *session __attribute__((unused)), unsigned int data_size __attribute__((unused)), unsigned char *data) { DECRYPT_KEY *key; unsigned int key_size, gcry_algo; - int gcry_length, gcry_mode; - gcry_error_t gcry_error2; + gcry_error_t err; key_size = *(u32*)data; @@ -627,67 +668,37 @@ decrypt_key *decrypt_make_key(decrypt_session *session __attribute__((unused)), return NULL; } + key_size = *(u32*)data; key->alg_id = *(u32*)(data + 8); key->key_data = data + 16; - gcry_mode = GCRY_CIPHER_MODE_CBC; switch (key->alg_id) { case CALG_DESX: - if (!desx_key_expand_test()) { - free(key); - errno = -1; - return NULL; - } fprintf(stderr, "DESX key of %u bytes\n", key_size); - fprintf(stderr, "on-disk key (hex) = 0x%llx, 0x%llx\n", - *(u64*)key->key_data, *(u64*)(key->key_data+8)); - desx_key_expand(key->key_data, (u8*)&key->desx_key); - fprintf(stderr, "expanded keys (hex) =\n\t0x%llx (des)\n\t" - "0x%llx (in-whitening)\n\t" - "0x%llx (out-whitening)\n", key->desx_key[0], - key->desx_key[1], - key->desx_key[2]); - if (!des_test()) { - free(key); - errno = -1; - return NULL; - } - key->key_data = (u8*)&key->desx_key[0]; - gcry_mode = GCRY_CIPHER_MODE_ECB; - gcry_length = 8; - gcry_algo = GCRY_CIPHER_DES; - is_first = TRUE; + gcry_algo = desx_algorithm_id; break; case CALG_3DES: fprintf(stderr, "3DES Key of %u bytes\n", key_size); - gcry_length = 24; gcry_algo = GCRY_CIPHER_3DES; break; case CALG_AES_256: fprintf(stderr, "AES Key of %u bytes\n", key_size); - gcry_length = 32; gcry_algo = GCRY_CIPHER_AES256; break; default: fprintf(stderr, "DES key of %u bytes\n", key_size); - if (!des_test()) { - free(key); - errno = -1; - return NULL; - } - gcry_length = 8; gcry_algo = GCRY_CIPHER_DES; break; } - if ((gcry_error2 = gcry_cipher_open(&key->gcry_cipher_hd, - gcry_algo, gcry_mode, 0)) != GPG_ERR_NO_ERROR) { - fprintf(stderr, "gcry_error1 is %u.\n", gcry_error2); + if ((err = gcry_cipher_open(&key->gcry_cipher_hd, gcry_algo, + GCRY_CIPHER_MODE_CBC, 0)) != GPG_ERR_NO_ERROR) { + fprintf(stderr, "gcry_cipher_open failed with 0x%x.\n", err); errno = -1; return 0; } - if ((gcry_error2 = gcry_cipher_setkey(key->gcry_cipher_hd, - key->key_data, gcry_length))) { - fprintf(stderr, "gcry_error2 is %u.\n", gcry_error2); + if ((err = gcry_cipher_setkey(key->gcry_cipher_hd, key->key_data, + key_size))) { + fprintf(stderr, "gcry_cipher_setkey failed with 0x%x.\n", err); } return (decrypt_key *)key; } From bb3c2172b8140fd2d09505a58a3d2dfe89f6ad02 Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 27 Jul 2005 10:30:57 +0000 Subject: [PATCH 2398/2994] Run through Lindent and some manual aftercleanups. --- ntfsprogs/decrypt.c | 444 ++++++++++++++++++---------------------- ntfsprogs/decrypt.h | 22 +- ntfsprogs/ntfsdecrypt.c | 218 ++++++++++---------- 3 files changed, 315 insertions(+), 369 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index a29066e4..467a737e 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -1,11 +1,9 @@ /* - * decrypt.c - Part of the Linux-NTFS project. + * decrypt.c - $EFS decryption routined. Part of the Linux-NTFS project. * * Copyright (c) 2005 Yuval Fledel * Copyright (c) 2005 Anton Altaparmakov * - * $EFS decryption routines. - * * 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 of the License, or @@ -32,7 +30,6 @@ #include "decrypt.h" #ifdef __CYGWIN__ -//#define USE_CRYPTOAPI_RSA 1 #define _WIN32_WINNT 0x501 #define WINVER 0x501 @@ -52,19 +49,19 @@ #define CRYPT_ACQUIRE_CACHE_FLAG 1 #endif -/* windows 2k+ imports */ -typedef BOOL (WINAPI *LPFN_CryptAcquireCertificatePrivateKey) (PCCERT_CONTEXT, - DWORD, void *, HCRYPTPROV *, DWORD *, BOOL*); -typedef BOOL (WINAPI *LPFN_CertCloseStore) (HCERTSTORE, DWORD); -typedef PCCERT_CONTEXT (WINAPI *LPFN_CertFindCertificateInStore) (HCERTSTORE, - DWORD, DWORD, DWORD, const void*, PCCERT_CONTEXT); -typedef BOOL (WINAPI *LPFN_CertFreeCertificateContext) (PCCERT_CONTEXT); -typedef HCERTSTORE (WINAPI *LPFN_CertOpenStore) (LPCSTR, DWORD, HCRYPTPROV, - DWORD, const void*); +/* Windows 2k+ imports. */ +typedef BOOL(WINAPI *LPFN_CryptAcquireCertificatePrivateKey)(PCCERT_CONTEXT, + DWORD, void *, HCRYPTPROV *, DWORD *, BOOL *); +typedef BOOL(WINAPI *LPFN_CertCloseStore)(HCERTSTORE, DWORD); +typedef PCCERT_CONTEXT(WINAPI *LPFN_CertFindCertificateInStore)(HCERTSTORE, + DWORD, DWORD, DWORD, const void *, PCCERT_CONTEXT); +typedef BOOL(WINAPI *LPFN_CertFreeCertificateContext)(PCCERT_CONTEXT); +typedef HCERTSTORE(WINAPI *LPFN_CertOpenStore)(LPCSTR, DWORD, HCRYPTPROV, + DWORD, const void *); // NT4SP3+ WINME or 95+ w/ IE5+ -static LPFN_CryptAcquireCertificatePrivateKey - fnCryptAcquireCertificatePrivateKey; +static LPFN_CryptAcquireCertificatePrivateKey + fnCryptAcquireCertificatePrivateKey; // osr2+ NT4SP3+ or NT4 w/ IE3.02: static LPFN_CertCloseStore fnCertCloseStore; static LPFN_CertFindCertificateInStore fnCertFindCertificateInStore; @@ -74,7 +71,7 @@ static LPFN_CertOpenStore fnCertOpenStore; /* global variable: handle to crypt32.dll */ static HMODULE hCrypt32 = INVALID_HANDLE_VALUE; -#else /* defined(__CYGWIN__) */ +#else /* !defined(__CYGWIN__) */ #include #include @@ -84,7 +81,7 @@ static HMODULE hCrypt32 = INVALID_HANDLE_VALUE; #define CALG_DESX (0x6604) #define CALG_AES_256 (0x6610) -#endif /* defined(__CYGWIN__) */ +#endif /* !defined(__CYGWIN__) */ /* This must be after windows.h include. */ #include "types.h" @@ -92,25 +89,22 @@ static HMODULE hCrypt32 = INVALID_HANDLE_VALUE; typedef struct { #ifdef __CYGWIN__ HCERTSTORE hSystemStore; -#else - int nothing; /* unused */ -#endif /* defined(__CYGWIN__) */ +#else /* !defined(__CYGWIN__) */ + int nothing; /* unused */ +#endif /* !defined(__CYGWIN__) */ } DECRYPT_SESSION; typedef struct { u64 desx_key[3]; u8 *key_data; u32 alg_id; - gcry_cipher_hd_t gcry_cipher_hd; // handle to the decrypted FEK. - gcry_sexp_t sexp_key; // the user's RSA key. -#ifdef USE_CRYPTOAPI_RSA - HCRYPTKEY hCryptKey; -#endif /* defined(__CYGWIN__) */ + gcry_cipher_hd_t gcry_cipher_hd; + gcry_sexp_t sexp_key; // the user's RSA key. } DECRYPT_KEY; /* DESX-MS128 implementation for libgcrypt. */ -static gcry_module_t desx_module; -static int desx_algorithm_id = -1; +static gcry_module_t desx_module; +static int desx_algorithm_id = -1; typedef struct desx_ctx { gcry_cipher_hd_t gcry_cipher_hd; @@ -152,13 +146,13 @@ static void desx_key_expand(const u8 *src, u8 *in_whitening, u8 *out_whitening, MD5_Update(&ctx2, salt2, salt_len); MD5_Final(md, &ctx2); memcpy(out_whitening, md, 8); - memcpy(in_whitening, md+8, 8); + memcpy(in_whitening, md + 8, 8); } static gcry_err_code_t do_desx_setkey(void *context, const u8 *key, unsigned keylen) { - struct desx_ctx *ctx = (desx_ctx *)context; + struct desx_ctx *ctx = (desx_ctx*)context; gcry_error_t err; u8 des_key[8]; @@ -166,89 +160,73 @@ static gcry_err_code_t do_desx_setkey(void *context, const u8 *key, fprintf(stderr, "not 16\n"); return GPG_ERR_INV_KEYLEN; } - if ((err = gcry_cipher_open(&ctx->gcry_cipher_hd, GCRY_CIPHER_DES, - GCRY_CIPHER_MODE_ECB, 0)) != GPG_ERR_NO_ERROR) + GCRY_CIPHER_MODE_ECB, 0)) != GPG_ERR_NO_ERROR) return err; - - if ((err = gcry_cipher_reset(ctx->gcry_cipher_hd))) { + if ((err = gcry_cipher_reset(ctx->gcry_cipher_hd))) fprintf(stderr, "err is %u.\n", err); - } - desx_key_expand(key, ctx->in_whitening, ctx->out_whitening, des_key); - -/* +#if 0 fprintf(stderr, "expanded keys (hex) =\n\t0x%llx (des)\n\t" "0x%llx (in-whitening)\n\t" "0x%llx (out-whitening)\n", *(u64*)des_key, *(u64*)ctx->in_whitening, *(u64*)ctx->out_whitening); -*/ - +#endif if ((err = gcry_cipher_setkey(ctx->gcry_cipher_hd, des_key, 8))) { fprintf(stderr, "do_desx_setkey: error %u.\n", err); // TODO: destroy gcry_cipher_hd } - return GPG_ERR_NO_ERROR; } static void do_desx_decrypt(void *context, u8 *outbuf, const u8 *inbuf) { - struct desx_ctx *ctx = (desx_ctx *)context; + struct desx_ctx *ctx = (desx_ctx*)context; gcry_error_t err; u8 buf[8]; - *((unsigned long long *)buf) = *((const unsigned long long *)inbuf) - ^ *(const unsigned long long *)ctx->out_whitening; - - if ((err = gcry_cipher_encrypt(ctx->gcry_cipher_hd, - outbuf, 8, buf, 8))) { + *((u64*)buf) = *((const u64*)inbuf) ^ *(const u64*)ctx->out_whitening; + if ((err = gcry_cipher_encrypt(ctx->gcry_cipher_hd, outbuf, 8, buf, 8))) fprintf(stderr, "desx decryption failed: %u.\n", err); - } - - *((unsigned long long *)outbuf) ^= *(const unsigned long long *) - ctx->in_whitening; + *((u64*)outbuf) ^= *(const u64*)ctx->in_whitening; } static gcry_cipher_spec_t cipher = { .name = "DES-X-MS128", .blocksize = 8, .keylen = 128, - .contextsize = sizeof (struct desx_ctx), + .contextsize = sizeof(struct desx_ctx), .setkey = do_desx_setkey, .decrypt = do_desx_decrypt, }; #ifdef __CYGWIN__ - static int cryptoAPI_init_imports(void) { if (hCrypt32 == INVALID_HANDLE_VALUE) hCrypt32 = LoadLibrary("crypt32.dll"); - if (!fnCryptAcquireCertificatePrivateKey) - fnCryptAcquireCertificatePrivateKey = - (LPFN_CryptAcquireCertificatePrivateKey) - GetProcAddress(hCrypt32, - "CryptAcquireCertificatePrivateKey"); + fnCryptAcquireCertificatePrivateKey = + (LPFN_CryptAcquireCertificatePrivateKey) + GetProcAddress(hCrypt32, + "CryptAcquireCertificatePrivateKey"); if (!fnCertCloseStore) fnCertCloseStore = (LPFN_CertCloseStore) - GetProcAddress(hCrypt32, "CertCloseStore"); + GetProcAddress(hCrypt32, "CertCloseStore"); if (!fnCertFindCertificateInStore) - fnCertFindCertificateInStore = - (LPFN_CertFindCertificateInStore) - GetProcAddress(hCrypt32, "CertFindCertificateInStore"); + fnCertFindCertificateInStore = (LPFN_CertFindCertificateInStore) + GetProcAddress(hCrypt32, + "CertFindCertificateInStore"); if (!fnCertFreeCertificateContext) - fnCertFreeCertificateContext = - (LPFN_CertFreeCertificateContext) - GetProcAddress(hCrypt32, "CertFreeCertificateContext"); + fnCertFreeCertificateContext = (LPFN_CertFreeCertificateContext) + GetProcAddress(hCrypt32, + "CertFreeCertificateContext"); if (!fnCertOpenStore) - fnCertOpenStore = (LPFN_CertOpenStore) - GetProcAddress(hCrypt32, "CertOpenStore"); - + fnCertOpenStore = (LPFN_CertOpenStore)GetProcAddress(hCrypt32, + "CertOpenStore"); return fnCryptAcquireCertificatePrivateKey && fnCertCloseStore && - fnCertFindCertificateInStore && - fnCertFreeCertificateContext && fnCertOpenStore; + fnCertFindCertificateInStore && fnCertFreeCertificateContext && + fnCertOpenStore; } #endif /* defined(__CYGWIN__) */ @@ -256,14 +234,17 @@ static int cryptoAPI_init_imports(void) #ifdef DO_CRYPTO_TESTS /* Do not remove this test code from this file! AIA */ -static BOOL desx_key_expand_test(void) { +static BOOL desx_key_expand_test(void) +{ const u8 known_desx_on_disk_key[16] = { - 0xa1, 0xf9, 0xe0, 0xb2, 0x53, 0x23, 0x9e, 0x8f, - 0x0f, 0x91, 0x45, 0xd9, 0x8e, 0x20, 0xec, 0x30 }; + 0xa1, 0xf9, 0xe0, 0xb2, 0x53, 0x23, 0x9e, 0x8f, + 0x0f, 0x91, 0x45, 0xd9, 0x8e, 0x20, 0xec, 0x30 + }; const u8 known_desx_expanded_key[24] = { - 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f, - 0xed, 0xda, 0x4c, 0x47, 0x60, 0x49, 0xdb, 0x8d, - 0x75, 0xf6, 0xa0, 0x1a, 0xc0, 0xca, 0x28, 0x1e }; + 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f, + 0xed, 0xda, 0x4c, 0x47, 0x60, 0x49, 0xdb, 0x8d, + 0x75, 0xf6, 0xa0, 0x1a, 0xc0, 0xca, 0x28, 0x1e + }; u8 test_desx_expanded_key[24]; int res; @@ -271,17 +252,21 @@ static BOOL desx_key_expand_test(void) { res = !memcmp(test_desx_expanded_key, known_desx_expanded_key, sizeof(known_desx_expanded_key)); fprintf(stderr, "Testing whether desx_key_expand() works: %s\n", - res ? "SUCCESS" : "FAILED"); + res ? "SUCCESS" : "FAILED"); return res; } -static BOOL des_test(void) { +static BOOL des_test(void) +{ const u8 known_des_key[8] = { - 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f }; + 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f + }; const u8 known_des_encrypted_data[8] = { - 0xdc, 0xf7, 0x68, 0x2a, 0xaf, 0x48, 0x53, 0x0f }; + 0xdc, 0xf7, 0x68, 0x2a, 0xaf, 0x48, 0x53, 0x0f + }; const u8 known_decrypted_data[8] = { - 0xd8, 0xd9, 0x15, 0x23, 0x5b, 0x88, 0x0e, 0x09 }; + 0xd8, 0xd9, 0x15, 0x23, 0x5b, 0x88, 0x0e, 0x09 + }; u8 test_decrypted_data[8]; int res; gcry_error_t gcry_error2; @@ -293,8 +278,8 @@ static BOOL des_test(void) { "%u).\n", gcry_error2); return FALSE; } - if ((gcry_error2 = gcry_cipher_setkey(gcry_cipher_hd, - known_des_key, sizeof(known_des_key)))) { + if ((gcry_error2 = gcry_cipher_setkey(gcry_cipher_hd, known_des_key, + sizeof(known_des_key)))) { fprintf(stderr, "Failed to set des key (gcry_error2 is %u).\n", gcry_error2); gcry_cipher_close(gcry_cipher_hd); @@ -302,10 +287,11 @@ static BOOL des_test(void) { } memcpy(test_decrypted_data, known_des_encrypted_data, sizeof(known_des_encrypted_data)); - /* Apply DES decyption. */ - gcry_error2 = gcry_cipher_decrypt(gcry_cipher_hd, - test_decrypted_data, sizeof(test_decrypted_data), - NULL, 0); + /* + * Apply DES decyption (ntfs actually uses encryption when decrypting). + */ + gcry_error2 = gcry_cipher_encrypt(gcry_cipher_hd, test_decrypted_data, + sizeof(test_decrypted_data), NULL, 0); gcry_cipher_close(gcry_cipher_hd); if (gcry_error2) { fprintf(stderr, "Failed to des decrypt test data (gcry_error2 " @@ -315,27 +301,30 @@ static BOOL des_test(void) { res = !memcmp(test_decrypted_data, known_decrypted_data, sizeof(known_decrypted_data)); fprintf(stderr, "Testing whether des decryption works: %s\n", - res ? "SUCCESS" : "FAILED"); + res ? "SUCCESS" : "FAILED"); return res; } -#else +#else /* !defined(DO_CRYPTO_TESTS) */ -static inline BOOL desx_key_expand_test(void) { +static inline BOOL desx_key_expand_test(void) +{ return TRUE; } -static inline BOOL des_test(void) { +static inline BOOL des_test(void) +{ return TRUE; } -#endif +#endif /* !defined(DO_CRYPTO_TESTS) */ -decrypt_session *decrypt_open(void) { +decrypt_session *decrypt_open(void) +{ decrypt_session *session; /* TODO: refcount 'module' */ - if (desx_algorithm_id==-1) { + if (desx_algorithm_id == -1) { if (!desx_key_expand_test()) return NULL; if (!des_test()) @@ -344,7 +333,6 @@ decrypt_session *decrypt_open(void) { &desx_module)) return NULL; } - //fprintf(stderr, "desx_algorithm_id: %d\n", desx_algorithm_id); gcry_control(GCRYCTL_DISABLE_SECMEM, 0); @@ -358,49 +346,50 @@ decrypt_session *decrypt_open(void) { return NULL; } - if (!(hSystemStore = fnCertOpenStore(((LPCSTR)CERT_STORE_PROV_SYSTEM), - 0, (HCRYPTPROV)NULL, CERT_SYSTEM_STORE_CURRENT_USER, + if (!(hSystemStore = fnCertOpenStore(((LPCSTR) CERT_STORE_PROV_SYSTEM), + 0, (HCRYPTPROV) NULL, CERT_SYSTEM_STORE_CURRENT_USER, L"MY"))) { fprintf(stderr, "Could not open system store.\n"); errno = -1; return NULL; } #endif /* defined(__CYGWIN__) */ - - session = (decrypt_session *)malloc(sizeof(DECRYPT_SESSION)); + session = (decrypt_session*)malloc(sizeof(DECRYPT_SESSION)); #ifdef __CYGWIN__ ((DECRYPT_SESSION *)session)->hSystemStore = hSystemStore; #endif /* defined(__CYGWIN__) */ return session; } -void decrypt_close(decrypt_session *session) { +void decrypt_close(decrypt_session *session) +{ #ifdef __CYGWIN__ - if (((DECRYPT_SESSION *)session)->hSystemStore) - fnCertCloseStore(((DECRYPT_SESSION *)session)->hSystemStore, - CERT_CLOSE_STORE_CHECK_FLAG); + if (((DECRYPT_SESSION*)session)->hSystemStore) + fnCertCloseStore(((DECRYPT_SESSION*)session)->hSystemStore, + CERT_CLOSE_STORE_CHECK_FLAG); /* fixme: racy */ FreeLibrary(hCrypt32); hCrypt32 = INVALID_HANDLE_VALUE; #endif /* defined(__CYGWIN__) */ - free(session); } -static inline void reverse_buffer(unsigned char *buf, unsigned int buf_size) { - unsigned char t; - unsigned int i; +static inline void reverse_buffer(unsigned char *buf, unsigned int buf_size) +{ + unsigned char t; + unsigned int i; - for (i=0; ihSystemStore, - (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING), - 0, CERT_FIND_HASH, &hash_blob, NULL))) { - fprintf(stderr, "Could not find cert in store.\n"); - goto decrypt_key_open_err; - } - - dwKeySpec = AT_KEYEXCHANGE; - if (!fnCryptAcquireCertificatePrivateKey(pCert, - CRYPT_ACQUIRE_CACHE_FLAG, NULL, - &hCryptProv, &dwKeySpec, - &fCallerFreeProv)) { - fprintf(stderr, "Could not aquire private key from cert.\n"); - goto decrypt_key_open_err; - } - - if (!CryptGetUserKey(hCryptProv, AT_KEYEXCHANGE, &hCryptKey)) { - fprintf(stderr, "Could not aquire user key.\n"); - goto decrypt_key_open_err; - } - - key_size = sizeof(key_blob); - if (!CryptExportKey(hCryptKey, 0, PRIVATEKEYBLOB, 0, key_blob, &key_size)) { - fprintf(stderr, "Could not export key: Error 0x%x\n", - (unsigned int)GetLastError()); - errno = -1; - return NULL; - } - - if (!(key = (decrypt_key *)malloc(sizeof(DECRYPT_KEY)))) - goto decrypt_key_open_err; - -#ifdef USE_CRYPTOAPI_RSA - ((DECRYPT_KEY *)key)->hCryptKey = hCryptKey; -#else - RSAPUBKEY *rsa_pub_key = (RSAPUBKEY *)(key_blob + sizeof(PUBLICKEYSTRUC)); + RSAPUBKEY *rsa_pub_key; gcry_ac_handle_t gcry_handle; unsigned char *mpi_data; - gcry_mpi_t n,e,d,p,q,u; + gcry_mpi_t n, e, d, p, q, u; gcry_sexp_t sexp_key; gcry_error_t err; size_t size; int rc; - CryptDestroyKey(hCryptKey); + hash_blob.cbData = thumb_size; + hash_blob.pbData = thumb_print; + if (!(pCert = fnCertFindCertificateInStore( + ((DECRYPT_SESSION*)session)->hSystemStore, + (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING), 0, + CERT_FIND_HASH, &hash_blob, NULL))) { + fprintf(stderr, "Could not find cert in store.\n"); + goto decrypt_key_open_err; + } + dwKeySpec = AT_KEYEXCHANGE; + if (!fnCryptAcquireCertificatePrivateKey(pCert, + CRYPT_ACQUIRE_CACHE_FLAG, NULL, &hCryptProv, + &dwKeySpec, &fCallerFreeProv)) { + fprintf(stderr, "Could not aquire private key from cert.\n"); + goto decrypt_key_open_err; + } + if (!CryptGetUserKey(hCryptProv, AT_KEYEXCHANGE, &hCryptKey)) { + fprintf(stderr, "Could not aquire user key.\n"); + goto decrypt_key_open_err; + } + key_size = sizeof(key_blob); + if (!CryptExportKey(hCryptKey, 0, PRIVATEKEYBLOB, 0, key_blob, + &key_size)) { + fprintf(stderr, "Could not export key: Error 0x%x\n", + (unsigned int)GetLastError()); + errno = -1; + return NULL; + } + if (!(key = (decrypt_key*)malloc(sizeof(DECRYPT_KEY)))) + goto decrypt_key_open_err; + CryptDestroyKey(hCryptKey); + rsa_pub_key = (RSAPUBKEY*)(key_blob + sizeof(PUBLICKEYSTRUC)); if ((err = gcry_ac_open(&gcry_handle, GCRY_AC_RSA, 0))) { fprintf(stderr, "Could not init gcrypt handle\n"); errno = -1; return NULL; } - e = gcry_mpi_set_ui(NULL, rsa_pub_key->pubexp); - mpi_data = (key_blob + 0x14); size = rsa_pub_key->bitlen / 8; reverse_buffer(mpi_data, size); - if ((rc = gcry_mpi_scan(&n, GCRYMPI_FMT_USG, mpi_data, size, &size))) { + if ((rc = gcry_mpi_scan(&n, GCRYMPI_FMT_USG, mpi_data, size, &size))) fprintf(stderr, "error scanning n.\n"); - } - mpi_data += (rsa_pub_key->bitlen / 8); size = rsa_pub_key->bitlen / 16; reverse_buffer(mpi_data, size); - if ((rc = gcry_mpi_scan(&q, GCRYMPI_FMT_USG, mpi_data, size, &size))) { + if ((rc = gcry_mpi_scan(&q, GCRYMPI_FMT_USG, mpi_data, size, &size))) fprintf(stderr, "error scanning p.\n"); - } - mpi_data += (rsa_pub_key->bitlen / 16); size = rsa_pub_key->bitlen / 16; reverse_buffer(mpi_data, size); - if ((rc = gcry_mpi_scan(&p, GCRYMPI_FMT_USG, mpi_data, size, &size))) { + if ((rc = gcry_mpi_scan(&p, GCRYMPI_FMT_USG, mpi_data, size, &size))) fprintf(stderr, "error scanning q.\n"); - } - - mpi_data += (rsa_pub_key->bitlen / 16)*3; + mpi_data += (rsa_pub_key->bitlen / 16) * 3; size = rsa_pub_key->bitlen / 16; reverse_buffer(mpi_data, size); - if ((rc = gcry_mpi_scan(&u, GCRYMPI_FMT_USG, mpi_data, size, &size))) { + if ((rc = gcry_mpi_scan(&u, GCRYMPI_FMT_USG, mpi_data, size, &size))) fprintf(stderr, "error scanning u.\n"); - } mpi_data += (rsa_pub_key->bitlen / 16); size = rsa_pub_key->bitlen / 8; reverse_buffer(mpi_data, size); - if ((rc = gcry_mpi_scan(&d, GCRYMPI_FMT_USG, mpi_data, size, &size))) { + if ((rc = gcry_mpi_scan(&d, GCRYMPI_FMT_USG, mpi_data, size, &size))) fprintf(stderr, "error scanning d.\n"); - } - - if ((rc = gcry_sexp_build(&sexp_key, NULL, - "(private-key (rsa (n %m) (e %m) (d %m) (p %m) (q %m) (u %m)))", - n, e, d, p, q, u))) { - fprintf(stderr, "Could build sexp from data, (error = 0x%x)\n", rc); + if ((rc = gcry_sexp_build(&sexp_key, NULL, "(private-key (rsa (n %m) " + "(e %m) (d %m) (p %m) (q %m) (u %m)))", n, e, d, p, q, + u))) { + fprintf(stderr, "Could build sexp from data, (error = 0x%x)\n", + rc); errno = -1; return FALSE; } - - ((DECRYPT_KEY *)key)->sexp_key = sexp_key; - + ((DECRYPT_KEY*)key)->sexp_key = sexp_key; // todo: release all -#endif return key; - -decrypt_key_open_err: - +decrypt_key_open_err: if (hCryptKey) CryptDestroyKey(hCryptKey); if (pCert) @@ -530,11 +495,11 @@ decrypt_key_open_err: return NULL; } -void decrypt_user_key_close(decrypt_key *key) { - DECRYPT_KEY *dkey = (DECRYPT_KEY *)key; +void decrypt_user_key_close(decrypt_key *key) +{ + DECRYPT_KEY *dkey = (DECRYPT_KEY*)key; if (dkey->gcry_cipher_hd) gcry_cipher_close(dkey->gcry_cipher_hd); - free(key); } @@ -543,20 +508,9 @@ void decrypt_user_key_close(decrypt_key *key) { * * warning: decrypting into the input buffer! */ -unsigned int decrypt_decrypt(decrypt_key *key, unsigned int data_size, - unsigned char *data) +unsigned int decrypt_decrypt(decrypt_key *key, unsigned int data_size, + unsigned char *data) { -#ifdef USE_CRYPTOAPI_RSA - DWORD size = data_size; - - if (!CryptDecrypt(((DECRYPT_KEY *)key)->hCryptKey, 0, - TRUE, 0, data, &size)) { - errno = -1; - return 0; - } - - return size; -#else gcry_sexp_t sexp_plain_data, sexp_enc_data; gcry_ac_handle_t gcry_handle; gcry_mpi_t mpi_buf; @@ -570,79 +524,74 @@ unsigned int decrypt_decrypt(decrypt_key *key, unsigned int data_size, errno = -1; return FALSE; } - - if ((rc = gcry_ac_data_new(&in))) { + if ((rc = gcry_ac_data_new(&in))) fprintf(stderr, "error allocating 'in'.\n"); - } reverse_buffer(data, data_size); size = data_size; - if ((rc = gcry_mpi_scan(&mpi_buf, GCRYMPI_FMT_USG, data, (size_t)data_size, &size))) { + if ((rc = gcry_mpi_scan(&mpi_buf, GCRYMPI_FMT_USG, data, + (size_t)data_size, &size))) fprintf(stderr, "error scanning 'in'.\n"); - } - - if ((rc = gcry_sexp_build(&sexp_enc_data, &size, "(enc-val (flags) (rsa (a %m)))", mpi_buf))) { - fprintf(stderr, "Could build sexp from data, (error = 0x%x)\n", rc); + if ((rc = gcry_sexp_build(&sexp_enc_data, &size, "(enc-val (flags) " + "(rsa (a %m)))", mpi_buf))) { + fprintf(stderr, "Could build sexp from data, (error = 0x%x)\n", + rc); errno = -1; return FALSE; } - - if ((rc = gcry_pk_decrypt(&sexp_plain_data, sexp_enc_data, ((DECRYPT_KEY *)key)->sexp_key))) { - fprintf(stderr, "Could not decrypt fek via s-exp, (error = 0x%x)\n", rc); + if ((rc = gcry_pk_decrypt(&sexp_plain_data, sexp_enc_data, + ((DECRYPT_KEY*)key)->sexp_key))) { + fprintf(stderr, "Could not decrypt fek via s-exp, (error = " + "0x%x)\n", rc); errno = -1; return FALSE; } - sexp_plain_data = gcry_sexp_find_token(sexp_plain_data, "value", 0); if (!mpi_buf) { - fprintf(stderr, "Could find value in s-exp, (error = 0x%x)\n", rc); + fprintf(stderr, "Could find value in s-exp, (error = 0x%x)\n", + rc); errno = -1; return FALSE; } - mpi_buf = gcry_sexp_nth_mpi(sexp_plain_data, 1, GCRYMPI_FMT_USG); - if ((rc = gcry_mpi_print(GCRYMPI_FMT_USG, data, data_size, &size, mpi_buf))) { - fprintf(stderr, "Could copy decrypted data back, (error = 0x%x)\n", rc); + if ((rc = gcry_mpi_print(GCRYMPI_FMT_USG, data, data_size, &size, + mpi_buf))) { + fprintf(stderr, "Could copy decrypted data back, (error = " + "0x%x)\n", rc); errno = -1; return FALSE; } - // remove the pkcs1 padding - for (padding_length = 1;(padding_lengthdata // todo: release all gcry_ac_data_destroy(in); - return size - padding_length; -#endif // USER_CRYPTOAPI_RSA (else) } unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, - unsigned long long offset) { + unsigned long long offset) +{ gcry_error_t err; - DECRYPT_KEY *dkey = (DECRYPT_KEY *)key; + DECRYPT_KEY *dkey = (DECRYPT_KEY*)key; - if ((err = gcry_cipher_reset(dkey->gcry_cipher_hd))) { + if ((err = gcry_cipher_reset(dkey->gcry_cipher_hd))) fprintf(stderr, "sector_decrypt: error is %u.\n", err); - } - // FIXME: Why are we not calling gcry_cipher_setiv() here instead of // doing it by hand after the decryption? // It wants iv length 8 but we give it 16 for AES256 so it does not // like it... - - if ((err = gcry_cipher_decrypt(dkey->gcry_cipher_hd, - data, 512, NULL, 0))) { + if ((err = gcry_cipher_decrypt(dkey->gcry_cipher_hd, data, 512, NULL, + 0))) fprintf(stderr, "sector_decrypt: error is %u.\n", err); - } - /* Apply the IV. */ if (dkey->alg_id == CALG_AES_256) { ((u64*)data)[0] ^= 0x5816657be9161312LL + offset; @@ -654,39 +603,41 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, return 512; } -decrypt_key *decrypt_make_key(decrypt_session *session __attribute__((unused)), - unsigned int data_size __attribute__((unused)), - unsigned char *data) { +decrypt_key *decrypt_make_key(decrypt_session *session __attribute__ ((unused)), + unsigned int data_size __attribute__ ((unused)), + unsigned char *data) +{ DECRYPT_KEY *key; unsigned int key_size, gcry_algo; gcry_error_t err; key_size = *(u32*)data; - if (!(key = (DECRYPT_KEY *)malloc(sizeof(DECRYPT_KEY)))) { + if (!(key = (DECRYPT_KEY*)malloc(sizeof(DECRYPT_KEY)))) { errno = -1; return NULL; } - key_size = *(u32*)data; key->alg_id = *(u32*)(data + 8); key->key_data = data + 16; switch (key->alg_id) { case CALG_DESX: - fprintf(stderr, "DESX key of %u bytes\n", key_size); + //fprintf(stderr, "DESX key of %u bytes\n", key_size); gcry_algo = desx_algorithm_id; break; case CALG_3DES: - fprintf(stderr, "3DES Key of %u bytes\n", key_size); - gcry_algo = GCRY_CIPHER_3DES; + //fprintf(stderr, "3DES Key of %u bytes\n", key_size); + gcry_algo = GCRY_CIPHER_3DES; break; case CALG_AES_256: - fprintf(stderr, "AES Key of %u bytes\n", key_size); + //fprintf(stderr, "AES Key of %u bytes\n", key_size); gcry_algo = GCRY_CIPHER_AES256; break; default: fprintf(stderr, "DES key of %u bytes\n", key_size); + fprintf(stderr, "This probably will not work... " + "It is completely untested.\n"); gcry_algo = GCRY_CIPHER_DES; break; } @@ -697,8 +648,7 @@ decrypt_key *decrypt_make_key(decrypt_session *session __attribute__((unused)), return 0; } if ((err = gcry_cipher_setkey(key->gcry_cipher_hd, key->key_data, - key_size))) { + key_size))) fprintf(stderr, "gcry_cipher_setkey failed with 0x%x.\n", err); - } - return (decrypt_key *)key; + return (decrypt_key*)key; } diff --git a/ntfsprogs/decrypt.h b/ntfsprogs/decrypt.h index 3d919ddc..c1cb8c80 100644 --- a/ntfsprogs/decrypt.h +++ b/ntfsprogs/decrypt.h @@ -27,16 +27,16 @@ typedef void *decrypt_session; typedef void *decrypt_key; extern decrypt_session *decrypt_open(void); -extern void decrypt_close(decrypt_session *session); -extern decrypt_key *decrypt_user_key_open(decrypt_session *session, - int thumb_size, void *thumb_print); -extern void decrypt_user_key_close(decrypt_key *key); -extern unsigned int decrypt_decrypt(decrypt_key *key, unsigned int data_size, - unsigned char *data); -extern unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, - unsigned long long offset); -extern decrypt_key *decrypt_make_key(decrypt_session *session, - unsigned int data_size, unsigned char *data); -extern int decrypt_get_block_size(decrypt_key *key); +extern void decrypt_close(decrypt_session * session); +extern decrypt_key *decrypt_user_key_open(decrypt_session * session, + int thumb_size, void *thumb_print); +extern void decrypt_user_key_close(decrypt_key * key); +extern unsigned int decrypt_decrypt(decrypt_key * key, unsigned int data_size, + unsigned char *data); +extern unsigned int decrypt_decrypt_sector(decrypt_key * key, void *data, + unsigned long long offset); +extern decrypt_key *decrypt_make_key(decrypt_session * session, + unsigned int data_size, unsigned char *data); +extern int decrypt_get_block_size(decrypt_key * key); #endif /* defined _NTFS_DECRYPT_H */ diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 2212a166..a97497ba 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -1,9 +1,8 @@ /** * ntfsdecrypt - Part of the Linux-NTFS project. * - * Copyright (c) 2003 Richard Russon - * Copyright (c) 2003 Anton Altaparmakov * Copyright (c) 2005 Yuval Fledel + * Copyright (c) 2005 Anton Altaparmakov * * This utility will decrypt files and print on the standard output. * @@ -40,26 +39,27 @@ #include "decrypt.h" struct options { - char *device; /* Device/File to work with */ - char *file; /* File to display */ - s64 inode; /* Inode to work with */ - ATTR_TYPES attr; /* Attribute type to display */ - int force; /* Override common sense */ - int quiet; /* Less output */ - int verbose; /* Extra output */ + char *device; /* Device/File to work with */ + char *file; /* File to display */ + s64 inode; /* Inode to work with */ + ATTR_TYPES attr; /* Attribute type to display */ + int force; /* Override common sense */ + int quiet; /* Less output */ + int verbose; /* Extra output */ }; -static const char *EXEC_NAME = "ntfscat"; +static const char *EXEC_NAME = "ntfsdecrypt"; static struct options opts; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) -static GEN_PRINTF (Printf, stderr, NULL, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stderr, &opts.verbose, TRUE) +GEN_PRINTF(Qprintf, stderr, &opts.quiet, FALSE) +static GEN_PRINTF(Printf, stderr, NULL, FALSE) static ntfschar EFS[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('E'), - const_cpu_to_le16('F'), const_cpu_to_le16('S'), - const_cpu_to_le16('\0') }; + const_cpu_to_le16('F'), const_cpu_to_le16('S'), + const_cpu_to_le16('\0') +}; static const int EFS_name_length = 4; /** @@ -69,12 +69,13 @@ static const int EFS_name_length = 4; * * Return: none */ -static void version (void) +static void version(void) { - Printf ("\n%s v%s - Concatenate files and print on the standard output.\n\n", - EXEC_NAME, VERSION); - Printf ("Copyright (c) 2003 Richard Russon\n"); - Printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + Printf("\n%s v%s - Decrypt and concatenate files and print on the " + "standard output.\n\n", EXEC_NAME, VERSION); + Printf("Copyright (c) 2005 Yuval Fledel\n"); + Printf("Copyright (c) 2005 Anton Altaparmakov\n"); + Printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -84,21 +85,18 @@ static void version (void) * * Return: none */ -static void usage (void) +static void usage(void) { - Printf ("\nUsage: %s [options] device [file]\n\n" - " -a, --attribute num Display this attribute\n" - " -i, --inode num Display this inode\n\n" - " -f --force Use less caution\n" - " -h --help Print this help\n" - " -q --quiet Less output\n" - " -V --version Version information\n" - " -v --verbose More output\n\n", - //" -N --name Display this attribute name", - //" -F --file Display this file", - //" -r --raw Display the compressed or encrypted file", - EXEC_NAME); - Printf ("%s%s\n", ntfs_bugs, ntfs_home); + Printf("\nUsage: %s [options] device [file]\n\n" + " -i, --inode num Display this inode\n\n" + " -f --force Use less caution\n" + " -h --help Print this help\n" + " -q --quiet Less output\n" + " -V --version Version information\n" + " -v --verbose More output\n\n", + //" -r --raw Display the compressed or encrypted file", + EXEC_NAME); + Printf("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -110,37 +108,35 @@ static void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -static int parse_options (int argc, char **argv) +static int parse_options(int argc, char **argv) { - static const char *sopt = "-a:fh?i:qVv"; // F:N: + static const char *sopt = "-fh?i:qVv"; // F:N: static const struct option lopt[] = { - { "force", no_argument, NULL, 'f' }, - { "help", no_argument, NULL, 'h' }, - { "inode", required_argument, NULL, 'i' }, - { "quiet", no_argument, NULL, 'q' }, - { "version", no_argument, NULL, 'V' }, - { "verbose", no_argument, NULL, 'v' }, - // { "file", required_argument, NULL, 'F' }, - // { "name", required_argument, NULL, 'N' }, - { NULL, 0, NULL, 0 } + {"force", no_argument, NULL, 'f'}, + {"help", no_argument, NULL, 'h'}, + {"inode", required_argument, NULL, 'i'}, + {"quiet", no_argument, NULL, 'q'}, + {"version", no_argument, NULL, 'V'}, + {"verbose", no_argument, NULL, 'v'}, + {NULL, 0, NULL, 0} }; char c = -1; - int err = 0; - int ver = 0; + int err = 0; + int ver = 0; int help = 0; - opterr = 0; /* We'll handle the errors, thank you. */ + opterr = 0; /* We'll handle the errors, thank you. */ opts.inode = -1; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!opts.device) { - opts.device = argv[optind-1]; + opts.device = argv[optind - 1]; } else if (!opts.file) { - opts.file = argv[optind-1]; + opts.file = argv[optind - 1]; } else { Eprintf("You must specify exactly one file.\n"); err++; @@ -155,7 +151,8 @@ static int parse_options (int argc, char **argv) break; case 'i': if (opts.inode != -1) - Eprintf("You must specify exactly one inode.\n"); + Eprintf + ("You must specify exactly one inode.\n"); else if (utils_parse_size(optarg, &opts.inode, FALSE)) break; else @@ -172,7 +169,7 @@ static int parse_options (int argc, char **argv) opts.verbose++; break; default: - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + Eprintf("Unknown option '%s'.\n", argv[optind - 1]); err++; break; } @@ -182,22 +179,22 @@ static int parse_options (int argc, char **argv) opts.quiet = 0; } else { if (opts.device == NULL) { - Eprintf ("You must specify a device.\n"); + Eprintf("You must specify a device.\n"); err++; } else if (opts.file == NULL && opts.inode == -1) { - Eprintf ("You must specify a file or inode " - "with the -i option.\n"); + Eprintf("You must specify a file or inode " + "with the -i option.\n"); err++; } else if (opts.file != NULL && opts.inode != -1) { - Eprintf ("You can't specify both a file and inode.\n"); + Eprintf("You can't specify both a file and inode.\n"); err++; } if (opts.quiet && opts.verbose) { Eprintf("You may not use --quiet and --verbose at the " - "same time.\n"); + "same time.\n"); err++; } } @@ -213,22 +210,22 @@ static int parse_options (int argc, char **argv) /** * cat */ -static int cat_decrypt(ntfs_inode *inode, decrypt_key *fek) +static int cat_decrypt(ntfs_inode * inode, decrypt_key * fek) { - int bufsize = 512; + int bufsize = 512; char *buffer; ntfs_attr *attr; s64 bytes_read, written, offset, total; unsigned int i; - buffer = malloc (bufsize); + buffer = malloc(bufsize); if (!buffer) return 1; - attr = ntfs_attr_open (inode, AT_DATA, NULL, 0); + attr = ntfs_attr_open(inode, AT_DATA, NULL, 0); if (!attr) { - Eprintf ("Cannot cat a directory.\n"); - free (buffer); + Eprintf("Cannot cat a directory.\n"); + free(buffer); return 1; } @@ -241,43 +238,43 @@ static int cat_decrypt(ntfs_inode *inode, decrypt_key *fek) attr->data_size = attr->initialized_size = attr->allocated_size; offset = 0; - while (total>0) { - bytes_read = ntfs_attr_pread (attr, offset, 512, buffer); + while (total > 0) { + bytes_read = ntfs_attr_pread(attr, offset, 512, buffer); if (bytes_read == -1) { - perror ("ERROR: Couldn't read file"); + perror("ERROR: Couldn't read file"); break; } if (!bytes_read) break; - if ((i = decrypt_decrypt_sector(fek, buffer, offset)) - < bytes_read) { - perror ("ERROR: Couldn't decrypt all data!"); + if ((i = decrypt_decrypt_sector(fek, buffer, offset)) < + bytes_read) { + perror("ERROR: Couldn't decrypt all data!"); Eprintf("%u/%lld/%lld/%lld\n", i, (long long)bytes_read, - (long long)offset, (long long)total); + (long long)offset, (long long)total); break; } if (bytes_read > total) bytes_read = total; - written = fwrite (buffer, 1, bytes_read, stdout); + written = fwrite(buffer, 1, bytes_read, stdout); if (written != bytes_read) { - perror ("ERROR: Couldn't output all data!"); + perror("ERROR: Couldn't output all data!"); break; } offset += bytes_read; total -= bytes_read; } - ntfs_attr_close (attr); - free (buffer); + ntfs_attr_close(attr); + free(buffer); return 0; } /** * get_fek */ -static decrypt_key *get_fek (ntfs_inode *inode) +static decrypt_key *get_fek(ntfs_inode * inode) { ntfs_attr *na; char *efs_buffer, *ddf, *certificate, *hash_data, *fek_buf; @@ -287,8 +284,8 @@ static decrypt_key *get_fek (ntfs_inode *inode) decrypt_key *key; /* obtain the $EFS contents */ - na = ntfs_attr_open (inode, AT_LOGGED_UTILITY_STREAM, - EFS, EFS_name_length); + na = ntfs_attr_open(inode, AT_LOGGED_UTILITY_STREAM, + EFS, EFS_name_length); if (!na) { perror("Error"); return NULL; @@ -300,8 +297,8 @@ static decrypt_key *get_fek (ntfs_inode *inode) return NULL; } - if (ntfs_attr_pread(na, 0, na->data_size, efs_buffer) != - na->data_size) { + if (ntfs_attr_pread(na, 0, na->data_size, efs_buffer) != + na->data_size) { perror("ntfs_attr_pread failed"); free(efs_buffer); return NULL; @@ -309,37 +306,37 @@ static decrypt_key *get_fek (ntfs_inode *inode) ntfs_attr_close(na); /* init the CryptoAPI */ - if(!(session = decrypt_open())) { + if (!(session = decrypt_open())) { perror("Could not init the cryptoAPI."); return NULL; } /* iterate through the DDFs & DRFs until you obtain a key */ - ddf = efs_buffer + le32_to_cpu(*(u32 *)(efs_buffer+0x40)); + ddf = efs_buffer + le32_to_cpu(*(u32 *)(efs_buffer + 0x40)); ddf_count = le32_to_cpu(*(u32 *)ddf); ddf = ddf + 0x04; - for (i=0;i Date: Wed, 27 Jul 2005 10:48:46 +0000 Subject: [PATCH 2399/2994] Some more cleanups I missed last time. --- ntfsprogs/decrypt.c | 2 +- ntfsprogs/ntfsdecrypt.c | 73 +++++++++++++++-------------------------- 2 files changed, 27 insertions(+), 48 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 467a737e..1d155f49 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -1,5 +1,5 @@ /* - * decrypt.c - $EFS decryption routined. Part of the Linux-NTFS project. + * decrypt.c - $EFS decryption routines. Part of the Linux-NTFS project. * * Copyright (c) 2005 Yuval Fledel * Copyright (c) 2005 Anton Altaparmakov diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index a97497ba..6cf3d618 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -56,9 +56,9 @@ GEN_PRINTF(Vprintf, stderr, &opts.verbose, TRUE) GEN_PRINTF(Qprintf, stderr, &opts.quiet, FALSE) static GEN_PRINTF(Printf, stderr, NULL, FALSE) -static ntfschar EFS[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('E'), - const_cpu_to_le16('F'), const_cpu_to_le16('S'), - const_cpu_to_le16('\0') +static ntfschar EFS[5] = { + const_cpu_to_le16('$'), const_cpu_to_le16('E'), const_cpu_to_le16('F'), + const_cpu_to_le16('S'), const_cpu_to_le16('\0') }; static const int EFS_name_length = 4; @@ -71,8 +71,8 @@ static const int EFS_name_length = 4; */ static void version(void) { - Printf("\n%s v%s - Decrypt and concatenate files and print on the " - "standard output.\n\n", EXEC_NAME, VERSION); + Printf("\n%s v%s - Decrypt files and print on the standard output.\n\n", + EXEC_NAME, VERSION); Printf("Copyright (c) 2005 Yuval Fledel\n"); Printf("Copyright (c) 2005 Anton Altaparmakov\n"); Printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); @@ -133,11 +133,11 @@ static int parse_options(int argc, char **argv) while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ - if (!opts.device) { + if (!opts.device) opts.device = argv[optind - 1]; - } else if (!opts.file) { + else if (!opts.file) opts.file = argv[optind - 1]; - } else { + else { Eprintf("You must specify exactly one file.\n"); err++; } @@ -151,8 +151,8 @@ static int parse_options(int argc, char **argv) break; case 'i': if (opts.inode != -1) - Eprintf - ("You must specify exactly one inode.\n"); + Eprintf("You must specify exactly one " + "inode.\n"); else if (utils_parse_size(optarg, &opts.inode, FALSE)) break; else @@ -183,8 +183,8 @@ static int parse_options(int argc, char **argv) err++; } else if (opts.file == NULL && opts.inode == -1) { - Eprintf("You must specify a file or inode " - "with the -i option.\n"); + Eprintf("You must specify a file or inode with the -i " + "option.\n"); err++; } else if (opts.file != NULL && opts.inode != -1) { @@ -194,7 +194,7 @@ static int parse_options(int argc, char **argv) if (opts.quiet && opts.verbose) { Eprintf("You may not use --quiet and --verbose at the " - "same time.\n"); + "same time.\n"); err++; } } @@ -210,7 +210,7 @@ static int parse_options(int argc, char **argv) /** * cat */ -static int cat_decrypt(ntfs_inode * inode, decrypt_key * fek) +static int cat_decrypt(ntfs_inode *inode, decrypt_key *fek) { int bufsize = 512; char *buffer; @@ -221,14 +221,12 @@ static int cat_decrypt(ntfs_inode * inode, decrypt_key * fek) buffer = malloc(bufsize); if (!buffer) return 1; - attr = ntfs_attr_open(inode, AT_DATA, NULL, 0); if (!attr) { Eprintf("Cannot cat a directory.\n"); free(buffer); return 1; } - total = attr->data_size; // hack: make sure attr will not be commited to disk if you use this. @@ -246,7 +244,6 @@ static int cat_decrypt(ntfs_inode * inode, decrypt_key * fek) } if (!bytes_read) break; - if ((i = decrypt_decrypt_sector(fek, buffer, offset)) < bytes_read) { perror("ERROR: Couldn't decrypt all data!"); @@ -256,7 +253,6 @@ static int cat_decrypt(ntfs_inode * inode, decrypt_key * fek) } if (bytes_read > total) bytes_read = total; - written = fwrite(buffer, 1, bytes_read, stdout); if (written != bytes_read) { perror("ERROR: Couldn't output all data!"); @@ -265,7 +261,6 @@ static int cat_decrypt(ntfs_inode * inode, decrypt_key * fek) offset += bytes_read; total -= bytes_read; } - ntfs_attr_close(attr); free(buffer); return 0; @@ -290,13 +285,11 @@ static decrypt_key *get_fek(ntfs_inode * inode) perror("Error"); return NULL; } - efs_buffer = malloc(na->data_size); if (!efs_buffer) { perror("malloc failed"); return NULL; } - if (ntfs_attr_pread(na, 0, na->data_size, efs_buffer) != na->data_size) { perror("ntfs_attr_pread failed"); @@ -305,31 +298,29 @@ static decrypt_key *get_fek(ntfs_inode * inode) } ntfs_attr_close(na); - /* init the CryptoAPI */ + /* Init the CryptoAPI. */ if (!(session = decrypt_open())) { perror("Could not init the cryptoAPI."); return NULL; } - - /* iterate through the DDFs & DRFs until you obtain a key */ - - ddf = efs_buffer + le32_to_cpu(*(u32 *)(efs_buffer + 0x40)); - ddf_count = le32_to_cpu(*(u32 *)ddf); + /* Iterate through the DDFs & DRFs until you obtain a key. */ + ddf = efs_buffer + le32_to_cpu(*(u32*)(efs_buffer + 0x40)); + ddf_count = le32_to_cpu(*(u32*)ddf); ddf = ddf + 0x04; for (i = 0; i < ddf_count; i++) { //Eprintf("ddf #%u.\n", i); - if (*(u32 *) (ddf + 0x18)) + if (*(u32*)(ddf + 0x18)) certificate = (ddf + 0x30 + - le32_to_cpu(*(u32 *)(ddf + 0x18))); + le32_to_cpu(*(u32*)(ddf + 0x18))); else certificate = (ddf + 0x30); - hash_size = (unsigned int)le32_to_cpu(*(u32 *)certificate); + hash_size = (unsigned int)le32_to_cpu(*(u32*)certificate); hash_data = certificate + (unsigned int) - le32_to_cpu(*(u32 *)(certificate + 0x04)); - fek_size = (unsigned int)le32_to_cpu(*(u32 *)(ddf + 0x08)); - fek_buf = ddf + (unsigned int)le32_to_cpu(*(u32 *)(ddf + 0x0c)); + le32_to_cpu(*(u32*)(certificate + 0x04)); + fek_size = (unsigned int)le32_to_cpu(*(u32*)(ddf + 0x08)); + fek_buf = ddf + (unsigned int)le32_to_cpu(*(u32*)(ddf + 0x0c)); if ((key = decrypt_user_key_open(session, hash_size, hash_data))) { @@ -346,10 +337,9 @@ static decrypt_key *get_fek(ntfs_inode * inode) } else Eprintf("Could not open key.\n"); - ddf = ddf + le32_to_cpu(*(u32 *)(ddf + 0x08)) + - le32_to_cpu(*(u32 *)(ddf + 0x0c)); + ddf = ddf + le32_to_cpu(*(u32*)(ddf + 0x08)) + + le32_to_cpu(*(u32*)(ddf + 0x0c)); } - decrypt_close(session); return NULL; } @@ -371,7 +361,6 @@ int main(int argc, char *argv[]) if (!parse_options(argc, argv)) return 1; - utils_set_locale(); //XXX quieten errors, temporarily @@ -381,17 +370,14 @@ int main(int argc, char *argv[]) perror("ERROR: couldn't mount volume"); return 1; } - if (opts.inode != -1) inode = ntfs_inode_open(vol, opts.inode); else inode = ntfs_pathname_to_inode(vol, NULL, opts.file); - if (!inode) { perror("ERROR: Couldn't open inode"); return 1; } - fek = get_fek(inode); if (fek) { result = cat_decrypt(inode, fek); @@ -400,14 +386,7 @@ int main(int argc, char *argv[]) Eprintf("Could not obtain FEK.\n"); result = 1; } - ntfs_inode_close(inode); ntfs_umount(vol, FALSE); -#if 0 - if (result) - Printf("failed\n"); - else - Printf("success\n"); -#endif return result; } From 8c54a0b1a91e4038b6fb0dad46543a8895679c61 Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 27 Jul 2005 15:55:42 +0000 Subject: [PATCH 2400/2994] First pass at massive cleanup of ntfsdectypt/decrypt. --- ntfsprogs/decrypt.c | 700 +++++++++++++++++++++------------------- ntfsprogs/decrypt.h | 40 ++- ntfsprogs/ntfsdecrypt.c | 85 ++--- 3 files changed, 447 insertions(+), 378 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 1d155f49..aa1bfcc1 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -68,7 +68,7 @@ static LPFN_CertFindCertificateInStore fnCertFindCertificateInStore; static LPFN_CertFreeCertificateContext fnCertFreeCertificateContext; static LPFN_CertOpenStore fnCertOpenStore; -/* global variable: handle to crypt32.dll */ +/* Global variable: Handle to crypt32.dll */ static HMODULE hCrypt32 = INVALID_HANDLE_VALUE; #else /* !defined(__CYGWIN__) */ @@ -92,113 +92,28 @@ typedef struct { #else /* !defined(__CYGWIN__) */ int nothing; /* unused */ #endif /* !defined(__CYGWIN__) */ -} DECRYPT_SESSION; +} NTFS_DECRYPT_USER_KEY_SESSION; + +typedef struct { + gcry_sexp_t sexp_key; // the user's RSA key. +} NTFS_DECRYPT_USER_KEY; typedef struct { - u64 desx_key[3]; u8 *key_data; u32 alg_id; gcry_cipher_hd_t gcry_cipher_hd; - gcry_sexp_t sexp_key; // the user's RSA key. -} DECRYPT_KEY; + gcry_cipher_hd_t *des_gcry_cipher_hd_ptr; +} NTFS_DECRYPT_DATA_KEY; /* DESX-MS128 implementation for libgcrypt. */ -static gcry_module_t desx_module; -static int desx_algorithm_id = -1; +static gcry_module_t ntfs_desx_module; +static int ntfs_desx_algorithm_id = -1; +static int ntfs_desx_module_count; -typedef struct desx_ctx { +typedef struct { + u64 in_whitening, out_whitening; gcry_cipher_hd_t gcry_cipher_hd; - u8 in_whitening[8], out_whitening[8]; -} desx_ctx; - -/** - * desx_key_expand - expand a 128-bit desx key to the needed 192-bit key - * @src: source buffer containing 128-bit key - * @dst: destination buffer to write 192-bit key to - * - * Expands the on-disk 128-bit desx key to the needed full 192-bit desx key - * required to perform desx {de,en}cryption. - * - * FIXME: Is this endianness safe? I think so but I may be wrong... - */ -static void desx_key_expand(const u8 *src, u8 *in_whitening, u8 *out_whitening, - u8 *des_key) -{ - static const int salt_len = 12; - static const u8 *salt1 = "Dan Simon "; - static const u8 *salt2 = "Scott Field"; - u8 md[16]; - MD5_CTX ctx1, ctx2; - - MD5_Init(&ctx1); - - /* Hash the on-disk key. */ - MD5_Update(&ctx1, src, 128 / 8); - memcpy(&ctx2, &ctx1, sizeof(ctx1)); - - /* Hash with the first salt and store the result. */ - MD5_Update(&ctx1, salt1, salt_len); - MD5_Final(md, &ctx1); - ((u32*)des_key)[0] = ((u32*)md)[0] ^ ((u32*)md)[1]; - ((u32*)des_key)[1] = ((u32*)md)[2] ^ ((u32*)md)[3]; - - /* Hash with the second salt and store the result. */ - MD5_Update(&ctx2, salt2, salt_len); - MD5_Final(md, &ctx2); - memcpy(out_whitening, md, 8); - memcpy(in_whitening, md + 8, 8); -} - -static gcry_err_code_t do_desx_setkey(void *context, const u8 *key, - unsigned keylen) -{ - struct desx_ctx *ctx = (desx_ctx*)context; - gcry_error_t err; - u8 des_key[8]; - - if (keylen != 16) { - fprintf(stderr, "not 16\n"); - return GPG_ERR_INV_KEYLEN; - } - if ((err = gcry_cipher_open(&ctx->gcry_cipher_hd, GCRY_CIPHER_DES, - GCRY_CIPHER_MODE_ECB, 0)) != GPG_ERR_NO_ERROR) - return err; - if ((err = gcry_cipher_reset(ctx->gcry_cipher_hd))) - fprintf(stderr, "err is %u.\n", err); - desx_key_expand(key, ctx->in_whitening, ctx->out_whitening, des_key); -#if 0 - fprintf(stderr, "expanded keys (hex) =\n\t0x%llx (des)\n\t" - "0x%llx (in-whitening)\n\t" - "0x%llx (out-whitening)\n", *(u64*)des_key, - *(u64*)ctx->in_whitening, *(u64*)ctx->out_whitening); -#endif - if ((err = gcry_cipher_setkey(ctx->gcry_cipher_hd, des_key, 8))) { - fprintf(stderr, "do_desx_setkey: error %u.\n", err); - // TODO: destroy gcry_cipher_hd - } - return GPG_ERR_NO_ERROR; -} - -static void do_desx_decrypt(void *context, u8 *outbuf, const u8 *inbuf) -{ - struct desx_ctx *ctx = (desx_ctx*)context; - gcry_error_t err; - u8 buf[8]; - - *((u64*)buf) = *((const u64*)inbuf) ^ *(const u64*)ctx->out_whitening; - if ((err = gcry_cipher_encrypt(ctx->gcry_cipher_hd, outbuf, 8, buf, 8))) - fprintf(stderr, "desx decryption failed: %u.\n", err); - *((u64*)outbuf) ^= *(const u64*)ctx->in_whitening; -} - -static gcry_cipher_spec_t cipher = { - .name = "DES-X-MS128", - .blocksize = 8, - .keylen = 128, - .contextsize = sizeof(struct desx_ctx), - .setkey = do_desx_setkey, - .decrypt = do_desx_decrypt, -}; +} ntfs_desx_ctx; #ifdef __CYGWIN__ static int cryptoAPI_init_imports(void) @@ -225,170 +140,62 @@ static int cryptoAPI_init_imports(void) fnCertOpenStore = (LPFN_CertOpenStore)GetProcAddress(hCrypt32, "CertOpenStore"); return fnCryptAcquireCertificatePrivateKey && fnCertCloseStore && - fnCertFindCertificateInStore && fnCertFreeCertificateContext && - fnCertOpenStore; + fnCertFindCertificateInStore && + fnCertFreeCertificateContext && fnCertOpenStore; } #endif /* defined(__CYGWIN__) */ -//#define DO_CRYPTO_TESTS 1 - -#ifdef DO_CRYPTO_TESTS -/* Do not remove this test code from this file! AIA */ -static BOOL desx_key_expand_test(void) +ntfs_decrypt_user_key_session *ntfs_decrypt_user_key_session_open(void) { - const u8 known_desx_on_disk_key[16] = { - 0xa1, 0xf9, 0xe0, 0xb2, 0x53, 0x23, 0x9e, 0x8f, - 0x0f, 0x91, 0x45, 0xd9, 0x8e, 0x20, 0xec, 0x30 - }; - const u8 known_desx_expanded_key[24] = { - 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f, - 0xed, 0xda, 0x4c, 0x47, 0x60, 0x49, 0xdb, 0x8d, - 0x75, 0xf6, 0xa0, 0x1a, 0xc0, 0xca, 0x28, 0x1e - }; - u8 test_desx_expanded_key[24]; - int res; - - desx_key_expand(known_desx_on_disk_key, test_desx_expanded_key); - res = !memcmp(test_desx_expanded_key, known_desx_expanded_key, - sizeof(known_desx_expanded_key)); - fprintf(stderr, "Testing whether desx_key_expand() works: %s\n", - res ? "SUCCESS" : "FAILED"); - return res; -} - -static BOOL des_test(void) -{ - const u8 known_des_key[8] = { - 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f - }; - const u8 known_des_encrypted_data[8] = { - 0xdc, 0xf7, 0x68, 0x2a, 0xaf, 0x48, 0x53, 0x0f - }; - const u8 known_decrypted_data[8] = { - 0xd8, 0xd9, 0x15, 0x23, 0x5b, 0x88, 0x0e, 0x09 - }; - u8 test_decrypted_data[8]; - int res; - gcry_error_t gcry_error2; - gcry_cipher_hd_t gcry_cipher_hd; - - if ((gcry_error2 = gcry_cipher_open(&gcry_cipher_hd, GCRY_CIPHER_DES, - GCRY_CIPHER_MODE_ECB, 0)) != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to open des cipher (gcry_error2 is " - "%u).\n", gcry_error2); - return FALSE; - } - if ((gcry_error2 = gcry_cipher_setkey(gcry_cipher_hd, known_des_key, - sizeof(known_des_key)))) { - fprintf(stderr, "Failed to set des key (gcry_error2 is %u).\n", - gcry_error2); - gcry_cipher_close(gcry_cipher_hd); - return FALSE; - } - memcpy(test_decrypted_data, known_des_encrypted_data, - sizeof(known_des_encrypted_data)); - /* - * Apply DES decyption (ntfs actually uses encryption when decrypting). - */ - gcry_error2 = gcry_cipher_encrypt(gcry_cipher_hd, test_decrypted_data, - sizeof(test_decrypted_data), NULL, 0); - gcry_cipher_close(gcry_cipher_hd); - if (gcry_error2) { - fprintf(stderr, "Failed to des decrypt test data (gcry_error2 " - "is %u).\n", gcry_error2); - return FALSE; - } - res = !memcmp(test_decrypted_data, known_decrypted_data, - sizeof(known_decrypted_data)); - fprintf(stderr, "Testing whether des decryption works: %s\n", - res ? "SUCCESS" : "FAILED"); - return res; -} - -#else /* !defined(DO_CRYPTO_TESTS) */ - -static inline BOOL desx_key_expand_test(void) -{ - return TRUE; -} - -static inline BOOL des_test(void) -{ - return TRUE; -} - -#endif /* !defined(DO_CRYPTO_TESTS) */ - -decrypt_session *decrypt_open(void) -{ - decrypt_session *session; - - /* TODO: refcount 'module' */ - if (desx_algorithm_id == -1) { - if (!desx_key_expand_test()) - return NULL; - if (!des_test()) - return NULL; - if (gcry_cipher_register(&cipher, &desx_algorithm_id, - &desx_module)) - return NULL; - } - //fprintf(stderr, "desx_algorithm_id: %d\n", desx_algorithm_id); - - gcry_control(GCRYCTL_DISABLE_SECMEM, 0); - + ntfs_decrypt_user_key_session *session; #ifdef __CYGWIN__ HCERTSTORE hSystemStore; + /* + * FIXME: This really needs locking and reference counting so it is + * safe from races. + */ if (!cryptoAPI_init_imports()) { fprintf(stderr, "Some imports do not exist.\n"); - errno = -1; + errno = EINVAL; return NULL; } - - if (!(hSystemStore = fnCertOpenStore(((LPCSTR) CERT_STORE_PROV_SYSTEM), - 0, (HCRYPTPROV) NULL, CERT_SYSTEM_STORE_CURRENT_USER, - L"MY"))) { + if (!(hSystemStore = fnCertOpenStore(((LPCSTR)CERT_STORE_PROV_SYSTEM), + 0, NULL, CERT_SYSTEM_STORE_CURRENT_USER, L"MY"))) { fprintf(stderr, "Could not open system store.\n"); - errno = -1; + errno = EINVAL; return NULL; } #endif /* defined(__CYGWIN__) */ - session = (decrypt_session*)malloc(sizeof(DECRYPT_SESSION)); + session = malloc(sizeof(NTFS_DECRYPT_USER_KEY_SESSION)); #ifdef __CYGWIN__ - ((DECRYPT_SESSION *)session)->hSystemStore = hSystemStore; + ((NTFS_DECRYPT_USER_KEY_SESSION*)session)->hSystemStore = hSystemStore; #endif /* defined(__CYGWIN__) */ return session; } -void decrypt_close(decrypt_session *session) +void ntfs_decrypt_user_key_session_close(ntfs_decrypt_user_key_session *session) { #ifdef __CYGWIN__ - if (((DECRYPT_SESSION*)session)->hSystemStore) - fnCertCloseStore(((DECRYPT_SESSION*)session)->hSystemStore, - CERT_CLOSE_STORE_CHECK_FLAG); - /* fixme: racy */ - FreeLibrary(hCrypt32); + HMODULE tmp; + + if (((NTFS_DECRYPT_USER_KEY_SESSION*)session)->hSystemStore) + fnCertCloseStore(((NTFS_DECRYPT_USER_KEY_SESSION*)session)-> + hSystemStore, CERT_CLOSE_STORE_CHECK_FLAG); + /* + * FIXME: This really needs locking and reference counting so it is + * safe from races. + */ + tmp = hCrypt32; hCrypt32 = INVALID_HANDLE_VALUE; + FreeLibrary(tmp); #endif /* defined(__CYGWIN__) */ free(session); } -static inline void reverse_buffer(unsigned char *buf, unsigned int buf_size) -{ - unsigned char t; - unsigned int i; - - for (i = 0; i < buf_size / 2; i++) { - t = buf[i]; - buf[i] = buf[buf_size - i - 1]; - buf[buf_size - i - 1] = t; - } -} - -decrypt_key *decrypt_user_key_open( - decrypt_session *session __attribute__ ((unused)), - int thumb_size, void *thumb_print) +ntfs_decrypt_user_key *ntfs_decrypt_user_key_open( + ntfs_decrypt_user_key_session *session __attribute__((unused)), + unsigned char *thumb_print, unsigned thumb_size) { #ifdef __CYGWIN__ CRYPT_HASH_BLOB hash_blob; @@ -396,7 +203,7 @@ decrypt_key *decrypt_user_key_open( PCCERT_CONTEXT pCert; BOOL fCallerFreeProv; HCRYPTKEY hCryptKey; - decrypt_key *key; + ntfs_decrypt_user_key *key; DWORD dwKeySpec; DWORD key_size; BYTE key_blob[1000]; @@ -434,12 +241,10 @@ decrypt_key *decrypt_user_key_open( if (!CryptExportKey(hCryptKey, 0, PRIVATEKEYBLOB, 0, key_blob, &key_size)) { fprintf(stderr, "Could not export key: Error 0x%x\n", - (unsigned int)GetLastError()); + (unsigned)GetLastError()); errno = -1; return NULL; } - if (!(key = (decrypt_key*)malloc(sizeof(DECRYPT_KEY)))) - goto decrypt_key_open_err; CryptDestroyKey(hCryptKey); rsa_pub_key = (RSAPUBKEY*)(key_blob + sizeof(PUBLICKEYSTRUC)); if ((err = gcry_ac_open(&gcry_handle, GCRY_AC_RSA, 0))) { @@ -468,21 +273,22 @@ decrypt_key *decrypt_user_key_open( reverse_buffer(mpi_data, size); if ((rc = gcry_mpi_scan(&u, GCRYMPI_FMT_USG, mpi_data, size, &size))) fprintf(stderr, "error scanning u.\n"); - mpi_data += (rsa_pub_key->bitlen / 16); size = rsa_pub_key->bitlen / 8; reverse_buffer(mpi_data, size); if ((rc = gcry_mpi_scan(&d, GCRYMPI_FMT_USG, mpi_data, size, &size))) fprintf(stderr, "error scanning d.\n"); + sexp_key = NULL; if ((rc = gcry_sexp_build(&sexp_key, NULL, "(private-key (rsa (n %m) " "(e %m) (d %m) (p %m) (q %m) (u %m)))", n, e, d, p, q, u))) { fprintf(stderr, "Could build sexp from data, (error = 0x%x)\n", rc); - errno = -1; - return FALSE; + errno = EINVAL; + return NULL; } - ((DECRYPT_KEY*)key)->sexp_key = sexp_key; + if ((key = (decrypt_key*)malloc(sizeof(NTFS_DECRYPT_USER_KEY)))) + ((NTFS_DECRYPT_USER_KEY*)key)->sexp_key = sexp_key; // todo: release all return key; decrypt_key_open_err: @@ -490,45 +296,51 @@ decrypt_key_open_err: CryptDestroyKey(hCryptKey); if (pCert) fnCertFreeCertificateContext(pCert); -#endif // defined(__CYGWIN__) +#endif /* defined(__CYGWIN__) */ errno = ENOTSUP; return NULL; } -void decrypt_user_key_close(decrypt_key *key) +void ntfs_decrypt_user_key_close(ntfs_decrypt_user_key *key) { - DECRYPT_KEY *dkey = (DECRYPT_KEY*)key; - if (dkey->gcry_cipher_hd) - gcry_cipher_close(dkey->gcry_cipher_hd); + gcry_sexp_release(((NTFS_DECRYPT_USER_KEY*)key)->sexp_key); free(key); } +static inline void reverse_buffer(unsigned char *buf, unsigned buf_size) +{ + unsigned char t; + unsigned i; + + for (i = 0; i < buf_size / 2; i++) { + t = buf[i]; + buf[i] = buf[buf_size - i - 1]; + buf[buf_size - i - 1] = t; + } +} + /** - * decrypt_decrypt - * * warning: decrypting into the input buffer! */ -unsigned int decrypt_decrypt(decrypt_key *key, unsigned int data_size, - unsigned char *data) +unsigned ntfs_decrypt_user_key_decrypt(ntfs_decrypt_user_key *key, + unsigned char *data, unsigned data_size) { gcry_sexp_t sexp_plain_data, sexp_enc_data; gcry_ac_handle_t gcry_handle; gcry_mpi_t mpi_buf; gcry_ac_data_t in; gcry_error_t err; - unsigned int size, padding_length, i; + unsigned size, padding_length, i; int rc; if ((err = gcry_ac_open(&gcry_handle, GCRY_AC_RSA, 0))) { fprintf(stderr, "Could not init gcrypt handle\n"); - errno = -1; - return FALSE; + errno = EINVAL; + return 0; } if ((rc = gcry_ac_data_new(&in))) fprintf(stderr, "error allocating 'in'.\n"); - reverse_buffer(data, data_size); - size = data_size; if ((rc = gcry_mpi_scan(&mpi_buf, GCRYMPI_FMT_USG, data, (size_t)data_size, &size))) @@ -537,31 +349,30 @@ unsigned int decrypt_decrypt(decrypt_key *key, unsigned int data_size, "(rsa (a %m)))", mpi_buf))) { fprintf(stderr, "Could build sexp from data, (error = 0x%x)\n", rc); - errno = -1; - return FALSE; + errno = EINVAL; + return 0; } if ((rc = gcry_pk_decrypt(&sexp_plain_data, sexp_enc_data, - ((DECRYPT_KEY*)key)->sexp_key))) { + ((NTFS_DECRYPT_USER_KEY*)key)->sexp_key))) { fprintf(stderr, "Could not decrypt fek via s-exp, (error = " "0x%x)\n", rc); - errno = -1; - return FALSE; + errno = EINVAL; + return 0; } sexp_plain_data = gcry_sexp_find_token(sexp_plain_data, "value", 0); if (!mpi_buf) { fprintf(stderr, "Could find value in s-exp, (error = 0x%x)\n", rc); - errno = -1; - return FALSE; + errno = EINVAL; + return 0; } mpi_buf = gcry_sexp_nth_mpi(sexp_plain_data, 1, GCRYMPI_FMT_USG); - if ((rc = gcry_mpi_print(GCRYMPI_FMT_USG, data, data_size, &size, mpi_buf))) { fprintf(stderr, "Could copy decrypted data back, (error = " "0x%x)\n", rc); - errno = -1; - return FALSE; + errno = EINVAL; + return 0; } // remove the pkcs1 padding for (padding_length = 1; (padding_length < size) && @@ -577,14 +388,305 @@ unsigned int decrypt_decrypt(decrypt_key *key, unsigned int data_size, return size - padding_length; } -unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, - unsigned long long offset) +/** + * ntfs_desx_key_expand - expand a 128-bit desx key to the needed 192-bit key + * @src: source buffer containing 128-bit key + * + * Expands the on-disk 128-bit desx key to the needed des key, the in-, and the + * out-whitening keys required to perform desx {de,en}cryption. + */ +static void ntfs_desx_key_expand(const u8 *src, u32 *des_key, + u64 *out_whitening, u64 *in_whitening) { - gcry_error_t err; - DECRYPT_KEY *dkey = (DECRYPT_KEY*)key; + static const int salt_len = 12; + static const u8 *salt1 = "Dan Simon "; + static const u8 *salt2 = "Scott Field"; + u32 md[4]; + MD5_CTX ctx1, ctx2; + + MD5_Init(&ctx1); + + /* Hash the on-disk key. */ + MD5_Update(&ctx1, src, 128 / 8); + memcpy(&ctx2, &ctx1, sizeof(ctx1)); + + /* Hash with the first salt and store the result. */ + MD5_Update(&ctx1, salt1, salt_len); + MD5_Final((u8*)md, &ctx1); + des_key[0] = md[0] ^ md[1]; + des_key[1] = md[2] ^ md[3]; + + /* Hash with the second salt and store the result. */ + MD5_Update(&ctx2, salt2, salt_len); + MD5_Final((u8*)md, &ctx2); + *out_whitening = *(u64*)md; + *in_whitening = *(u64*)(md + 2); +} + +static gcry_err_code_t ntfs_desx_setkey(void *context, const u8 *key, + unsigned keylen) +{ + ntfs_desx_ctx *ctx = context; + gcry_error_t err; + u8 des_key[8]; + + if (keylen != 16) { + fprintf(stderr, "Key length for desx must be 16.\n"); + return GPG_ERR_INV_KEYLEN; + } + err = gcry_cipher_open(&ctx->gcry_cipher_hd, GCRY_CIPHER_DES, + GCRY_CIPHER_MODE_ECB, 0); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to open des cipher (error 0x%x).\n", + err); + return err; + } + ntfs_desx_key_expand(key, (u32*)des_key, &ctx->out_whitening, + &ctx->in_whitening); + err = gcry_cipher_setkey(ctx->gcry_cipher_hd, des_key, sizeof(des_key)); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to set des key (error 0x%x.\n", err); + gcry_cipher_close(ctx->gcry_cipher_hd); + return err; + } + /* + * Take a note of the ctx->gcry_cipher_hd since we need to close it at + * ntfs_decrypt_data_key_close() time. + */ + *(gcry_cipher_hd_t*)(key + ((keylen + 7) & ~7)) = ctx->gcry_cipher_hd; + return GPG_ERR_NO_ERROR; +} + +static void ntfs_desx_decrypt(void *context, u8 *outbuf, const u8 *inbuf) +{ + ntfs_desx_ctx *ctx = context; + gcry_error_t err; + + *(u64*)outbuf = *(const u64*)inbuf ^ ctx->out_whitening; + err = gcry_cipher_encrypt(ctx->gcry_cipher_hd, outbuf, 8, NULL, 0); + if (err != GPG_ERR_NO_ERROR) + fprintf(stderr, "Des decryption failed (error 0x%x).\n", err); + *(u64*)outbuf ^= ctx->in_whitening; +} + +static gcry_cipher_spec_t ntfs_desx_cipher = { + .name = "DES-X-MS128", + .blocksize = 8, + .keylen = 128, + .contextsize = sizeof(ntfs_desx_ctx), + .setkey = ntfs_desx_setkey, + .decrypt = ntfs_desx_decrypt, +}; + +//#define DO_CRYPTO_TESTS 1 + +#ifdef DO_CRYPTO_TESTS +/* Do not remove this test code from this file! AIA */ +static BOOL desx_key_expand_test(void) +{ + const u8 known_desx_on_disk_key[16] = { + 0xa1, 0xf9, 0xe0, 0xb2, 0x53, 0x23, 0x9e, 0x8f, + 0x0f, 0x91, 0x45, 0xd9, 0x8e, 0x20, 0xec, 0x30 + }; + const u8 known_des_key[8] = { + 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f, + }; + const u8 known_out_whitening[8] = { + 0xed, 0xda, 0x4c, 0x47, 0x60, 0x49, 0xdb, 0x8d, + }; + const u8 known_in_whitening[8] = { + 0x75, 0xf6, 0xa0, 0x1a, 0xc0, 0xca, 0x28, 0x1e + }; + u64 test_des_key, test_out_whitening, test_in_whitening; + BOOL res; + + desx_key_expand(known_desx_on_disk_key, (u32*)test_des_key, + (u64*)test_out_whitening, (u64*)test_in_whitening); + res = test_des_key != *(u64*)known_des_key || + test_out_whitening != *(u64*)known_out_whitening || + test_in_whitening != *(u64*)known_in_whitening; + fprintf(stderr, "Testing whether ntfs_desx_key_expand() works: %s\n", + res ? "SUCCESS" : "FAILED"); + return res; +} + +static BOOL ntfs_des_test(void) +{ + const u8 known_des_key[8] = { + 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f + }; + const u8 known_des_encrypted_data[8] = { + 0xdc, 0xf7, 0x68, 0x2a, 0xaf, 0x48, 0x53, 0x0f + }; + const u8 known_decrypted_data[8] = { + 0xd8, 0xd9, 0x15, 0x23, 0x5b, 0x88, 0x0e, 0x09 + }; + u8 test_decrypted_data[8]; + int res; + gcry_error_t err; + gcry_cipher_hd_t gcry_cipher_hd; + + err = gcry_cipher_open(&gcry_cipher_hd, GCRY_CIPHER_DES, + GCRY_CIPHER_MODE_ECB, 0); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to open des cipher (error 0x%x).\n", + err); + return FALSE; + } + err = gcry_cipher_setkey(gcry_cipher_hd, known_des_key, + sizeof(known_des_key)); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to set des key (error 0x%x.\n", err); + gcry_cipher_close(gcry_cipher_hd); + return FALSE; + } + /* + * Apply DES decryption (ntfs actually uses encryption when decrypting). + */ + err = gcry_cipher_encrypt(gcry_cipher_hd, test_decrypted_data, + sizeof(test_decrypted_data), known_des_encrypted_data, + sizeof(known_des_encrypted_data)); + gcry_cipher_close(gcry_cipher_hd); + if (err) { + fprintf(stderr, "Failed to des decrypt test data (error " + "0x%x).\n", err); + return FALSE; + } + res = !memcmp(test_decrypted_data, known_decrypted_data, + sizeof(known_decrypted_data)); + fprintf(stderr, "Testing whether des decryption works: %s\n", + res ? "SUCCESS" : "FAILED"); + return res; +} + +#else /* !defined(DO_CRYPTO_TESTS) */ + +static inline BOOL desx_key_expand_test(void) +{ + return TRUE; +} + +static inline BOOL des_test(void) +{ + return TRUE; +} + +#endif /* !defined(DO_CRYPTO_TESTS) */ + +ntfs_decrypt_data_key *ntfs_decrypt_data_key_open(unsigned char *data, + unsigned data_size __attribute__((unused))) +{ + NTFS_DECRYPT_DATA_KEY *key; + unsigned key_size, wanted_key_size, gcry_algo; + gcry_error_t err; + + key_size = *(u32*)data; + key = (NTFS_DECRYPT_DATA_KEY*)malloc(((((sizeof(*key) + 7) & ~7) + + key_size + 7) & ~7) + sizeof(gcry_cipher_hd_t)); + if (!key) { + errno = ENOMEM; + return NULL; + } + key->alg_id = *(u32*)(data + 8); + key->key_data = (u8*)key + ((sizeof(*key) + 7) & ~7); + memcpy(key->key_data, data + 16, key_size); + key->des_gcry_cipher_hd_ptr = (gcry_cipher_hd_t*)(key->key_data + + ((key_size + 7) & ~7)); + *key->des_gcry_cipher_hd_ptr = NULL; + switch (key->alg_id) { + case CALG_DESX: + /* FIXME: This really needs locking so it is safe from races. */ + if (!ntfs_desx_module_count++) { + gcry_error_t err; + + if (!desx_key_expand_test() || !des_test()) { + errno = EINVAL; + return NULL; + } + err = gcry_cipher_register(&ntfs_desx_cipher, + &ntfs_desx_algorithm_id, + &ntfs_desx_module); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to register desx " + "cipher (error 0x%x).\n", err); + errno = EINVAL; + return NULL; + } + gcry_control(GCRYCTL_DISABLE_SECMEM, 0); + } + wanted_key_size = 16; + gcry_algo = ntfs_desx_algorithm_id; + break; + case CALG_3DES: + wanted_key_size = 24; + gcry_algo = GCRY_CIPHER_3DES; + break; + case CALG_AES_256: + wanted_key_size = 32; + gcry_algo = GCRY_CIPHER_AES256; + break; + default: + wanted_key_size = 8; + gcry_algo = GCRY_CIPHER_DES; + fprintf(stderr, "DES is not supported at present. Please " + "email linux-ntfs-dev@lists.sourceforge.net " + "and say that you saw this message. We will " + "then implement support for DES.\n"); + free(key); + errno = ENOTSUP; + return NULL; + } + if (key_size != wanted_key_size) { + fprintf(stderr, "%s key of %u bytes but needed size is %u " + "bytes, assuming corrupt key. Aborting.\n", + gcry_cipher_algo_name(gcry_algo), key_size, + wanted_key_size); + free(key); + errno = EIO; + return NULL; + } + err = gcry_cipher_open(&key->gcry_cipher_hd, gcry_algo, + GCRY_CIPHER_MODE_CBC, 0); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "gcry_cipher_open() failed with error 0x%x.\n", + err); + free(key); + errno = EINVAL; + return 0; + } + err = gcry_cipher_setkey(key->gcry_cipher_hd, key->key_data, key_size); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "gcry_cipher_setkey() failed with error " + "0x%x.\n", err); + gcry_cipher_close(key->gcry_cipher_hd); + free(key); + errno = EINVAL; + return NULL; + } + return (ntfs_decrypt_data_key*)key; +} + +void ntfs_decrypt_data_key_close(ntfs_decrypt_data_key *key) +{ + NTFS_DECRYPT_DATA_KEY *dkey = (NTFS_DECRYPT_DATA_KEY*)key; + if (*dkey->des_gcry_cipher_hd_ptr) + gcry_cipher_close(*dkey->des_gcry_cipher_hd_ptr); + gcry_cipher_close(dkey->gcry_cipher_hd); + free(key); + /* FIXME: This really needs locking so it is safe from races. */ + if (!--ntfs_desx_module_count) { + gcry_cipher_unregister(ntfs_desx_module); + ntfs_desx_module = NULL; + ntfs_desx_algorithm_id = -1; + } +} + +unsigned ntfs_decrypt_data_key_decrypt_sector(ntfs_decrypt_data_key *key, + unsigned char *data, unsigned long long offset) +{ + NTFS_DECRYPT_DATA_KEY *dkey = (NTFS_DECRYPT_DATA_KEY*)key; + gcry_error_t err; - if ((err = gcry_cipher_reset(dkey->gcry_cipher_hd))) - fprintf(stderr, "sector_decrypt: error is %u.\n", err); // FIXME: Why are we not calling gcry_cipher_setiv() here instead of // doing it by hand after the decryption? // It wants iv length 8 but we give it 16 for AES256 so it does not @@ -602,53 +704,3 @@ unsigned int decrypt_decrypt_sector(decrypt_key *key, void *data, } return 512; } - -decrypt_key *decrypt_make_key(decrypt_session *session __attribute__ ((unused)), - unsigned int data_size __attribute__ ((unused)), - unsigned char *data) -{ - DECRYPT_KEY *key; - unsigned int key_size, gcry_algo; - gcry_error_t err; - - key_size = *(u32*)data; - - if (!(key = (DECRYPT_KEY*)malloc(sizeof(DECRYPT_KEY)))) { - errno = -1; - return NULL; - } - key_size = *(u32*)data; - key->alg_id = *(u32*)(data + 8); - key->key_data = data + 16; - - switch (key->alg_id) { - case CALG_DESX: - //fprintf(stderr, "DESX key of %u bytes\n", key_size); - gcry_algo = desx_algorithm_id; - break; - case CALG_3DES: - //fprintf(stderr, "3DES Key of %u bytes\n", key_size); - gcry_algo = GCRY_CIPHER_3DES; - break; - case CALG_AES_256: - //fprintf(stderr, "AES Key of %u bytes\n", key_size); - gcry_algo = GCRY_CIPHER_AES256; - break; - default: - fprintf(stderr, "DES key of %u bytes\n", key_size); - fprintf(stderr, "This probably will not work... " - "It is completely untested.\n"); - gcry_algo = GCRY_CIPHER_DES; - break; - } - if ((err = gcry_cipher_open(&key->gcry_cipher_hd, gcry_algo, - GCRY_CIPHER_MODE_CBC, 0)) != GPG_ERR_NO_ERROR) { - fprintf(stderr, "gcry_cipher_open failed with 0x%x.\n", err); - errno = -1; - return 0; - } - if ((err = gcry_cipher_setkey(key->gcry_cipher_hd, key->key_data, - key_size))) - fprintf(stderr, "gcry_cipher_setkey failed with 0x%x.\n", err); - return (decrypt_key*)key; -} diff --git a/ntfsprogs/decrypt.h b/ntfsprogs/decrypt.h index c1cb8c80..56fe168d 100644 --- a/ntfsprogs/decrypt.h +++ b/ntfsprogs/decrypt.h @@ -1,8 +1,9 @@ /* - * decrypt.h - interface for decryption rutines. - * Part of the Linux-NTFS project. + * decrypt.h - Interface for decryption rutines. Part of the Linux-NTFS + * project. * * Copyright (c) 2005 Yuval Fledel + * Copyright (c) 2005 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -23,20 +24,27 @@ #ifndef _NTFS_DECRYPT_H #define _NTFS_DECRYPT_H -typedef void *decrypt_session; -typedef void *decrypt_key; +typedef void *ntfs_decrypt_user_key_session; +typedef void *ntfs_decrypt_user_key; +typedef void *ntfs_decrypt_data_key; -extern decrypt_session *decrypt_open(void); -extern void decrypt_close(decrypt_session * session); -extern decrypt_key *decrypt_user_key_open(decrypt_session * session, - int thumb_size, void *thumb_print); -extern void decrypt_user_key_close(decrypt_key * key); -extern unsigned int decrypt_decrypt(decrypt_key * key, unsigned int data_size, - unsigned char *data); -extern unsigned int decrypt_decrypt_sector(decrypt_key * key, void *data, - unsigned long long offset); -extern decrypt_key *decrypt_make_key(decrypt_session * session, - unsigned int data_size, unsigned char *data); -extern int decrypt_get_block_size(decrypt_key * key); +extern ntfs_decrypt_user_key_session *ntfs_decrypt_user_key_session_open(void); +extern void ntfs_decrypt_user_key_session_close( + ntfs_decrypt_user_key_session *session); + +extern ntfs_decrypt_user_key *ntfs_decrypt_user_key_open( + ntfs_decrypt_user_key_session *session, + unsigned char *thumb_print, unsigned thumb_size); +extern void ntfs_decrypt_user_key_close(ntfs_decrypt_user_key *key); + +extern unsigned ntfs_decrypt_user_key_decrypt(ntfs_decrypt_user_key *key, + unsigned char *data, unsigned data_size); + +extern ntfs_decrypt_data_key *ntfs_decrypt_data_key_open(unsigned char *data, + unsigned data_size); +extern void ntfs_decrypt_data_key_close(ntfs_decrypt_data_key *key); + +extern unsigned ntfs_decrypt_data_key_decrypt_sector(ntfs_decrypt_data_key *key, + unsigned char *data, unsigned long long offset); #endif /* defined _NTFS_DECRYPT_H */ diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 6cf3d618..3a7ec04c 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -210,13 +210,14 @@ static int parse_options(int argc, char **argv) /** * cat */ -static int cat_decrypt(ntfs_inode *inode, decrypt_key *fek) +static int cat_decrypt(ntfs_inode *inode, ntfs_decrypt_data_key *fek) { int bufsize = 512; char *buffer; ntfs_attr *attr; s64 bytes_read, written, offset, total; - unsigned int i; + s64 old_data_size, old_initialized_size; + unsigned i; buffer = malloc(bufsize); if (!buffer) @@ -233,6 +234,8 @@ static int cat_decrypt(ntfs_inode *inode, decrypt_key *fek) // clear the encrypted bit, otherwise the library won't allow reading. NAttrClearEncrypted(attr); // extend the size, we may need to read past the end of the stream. + old_data_size = attr->data_size; + old_initialized_size = attr->initialized_size; attr->data_size = attr->initialized_size = attr->allocated_size; offset = 0; @@ -244,8 +247,8 @@ static int cat_decrypt(ntfs_inode *inode, decrypt_key *fek) } if (!bytes_read) break; - if ((i = decrypt_decrypt_sector(fek, buffer, offset)) < - bytes_read) { + if ((i = ntfs_decrypt_data_key_decrypt_sector(fek, buffer, + offset)) < bytes_read) { perror("ERROR: Couldn't decrypt all data!"); Eprintf("%u/%lld/%lld/%lld\n", i, (long long)bytes_read, (long long)offset, (long long)total); @@ -261,6 +264,9 @@ static int cat_decrypt(ntfs_inode *inode, decrypt_key *fek) offset += bytes_read; total -= bytes_read; } + attr->data_size = old_data_size; + attr->initialized_size = old_initialized_size; + NAttrSetEncrypted(attr); ntfs_attr_close(attr); free(buffer); return 0; @@ -269,41 +275,44 @@ static int cat_decrypt(ntfs_inode *inode, decrypt_key *fek) /** * get_fek */ -static decrypt_key *get_fek(ntfs_inode * inode) +static ntfs_decrypt_data_key *get_fek(ntfs_inode *inode) { ntfs_attr *na; - char *efs_buffer, *ddf, *certificate, *hash_data, *fek_buf; + unsigned char *efs_buffer, *ddf, *certificate, *hash_data, *fek_buf; u32 ddf_count, hash_size, fek_size; - unsigned int i; - decrypt_session *session; - decrypt_key *key; + unsigned i; + ntfs_decrypt_user_key_session *session; + ntfs_decrypt_user_key *key; - /* obtain the $EFS contents */ + /* Obtain the $EFS contents. */ na = ntfs_attr_open(inode, AT_LOGGED_UTILITY_STREAM, EFS, EFS_name_length); if (!na) { - perror("Error"); + perror("Failed to open $EFS attribute"); return NULL; } efs_buffer = malloc(na->data_size); if (!efs_buffer) { - perror("malloc failed"); + perror("Failed to allocate internal buffer"); + ntfs_attr_close(na); return NULL; } if (ntfs_attr_pread(na, 0, na->data_size, efs_buffer) != na->data_size) { - perror("ntfs_attr_pread failed"); + perror("Failed to read $EFS attribute"); free(efs_buffer); + ntfs_attr_close(na); return NULL; } ntfs_attr_close(na); /* Init the CryptoAPI. */ - if (!(session = decrypt_open())) { - perror("Could not init the cryptoAPI."); + if (!(session = ntfs_decrypt_user_key_session_open())) { + perror("Failed to initialize the cryptoAPI"); + free(efs_buffer); return NULL; } - /* Iterate through the DDFs & DRFs until you obtain a key. */ + /* Iterate through the DDFs & DRFs until we obtain a key. */ ddf = efs_buffer + le32_to_cpu(*(u32*)(efs_buffer + 0x40)); ddf_count = le32_to_cpu(*(u32*)ddf); @@ -315,32 +324,32 @@ static decrypt_key *get_fek(ntfs_inode * inode) le32_to_cpu(*(u32*)(ddf + 0x18))); else certificate = (ddf + 0x30); - - hash_size = (unsigned int)le32_to_cpu(*(u32*)certificate); - hash_data = certificate + (unsigned int) + hash_size = (unsigned)le32_to_cpu(*(u32*)certificate); + hash_data = certificate + (unsigned) le32_to_cpu(*(u32*)(certificate + 0x04)); - fek_size = (unsigned int)le32_to_cpu(*(u32*)(ddf + 0x08)); - fek_buf = ddf + (unsigned int)le32_to_cpu(*(u32*)(ddf + 0x0c)); + fek_size = (unsigned)le32_to_cpu(*(u32*)(ddf + 0x08)); + fek_buf = ddf + (unsigned)le32_to_cpu(*(u32*)(ddf + 0x0c)); + if ((key = ntfs_decrypt_user_key_open(session, hash_data, + hash_size))) { + fek_size = ntfs_decrypt_user_key_decrypt(key, fek_buf, + fek_size); + ntfs_decrypt_user_key_close(key); + if (fek_size) { + ntfs_decrypt_data_key *fek; - if ((key = decrypt_user_key_open(session, hash_size, - hash_data))) { - if ((fek_size = decrypt_decrypt(key, fek_size, - fek_buf))) - return decrypt_make_key(session, fek_size, - fek_buf); - perror("error decrypting the FEK."); - decrypt_user_key_close(key); - decrypt_close(session); - errno = -1; - return NULL; - decrypt_user_key_close(key); + ntfs_decrypt_user_key_session_close(session); + fek = ntfs_decrypt_data_key_open(fek_buf, + fek_size); + free(efs_buffer); + return fek; + } + fprintf(stderr, "Failed to decrypt the FEK.\n"); } else - Eprintf("Could not open key.\n"); - + perror("Failed to open user key"); ddf = ddf + le32_to_cpu(*(u32*)(ddf + 0x08)) + le32_to_cpu(*(u32*)(ddf + 0x0c)); } - decrypt_close(session); + ntfs_decrypt_user_key_session_close(session); return NULL; } @@ -356,7 +365,7 @@ int main(int argc, char *argv[]) { ntfs_volume *vol; ntfs_inode *inode; - decrypt_key *fek; + ntfs_decrypt_data_key *fek; int result = 1; if (!parse_options(argc, argv)) @@ -381,7 +390,7 @@ int main(int argc, char *argv[]) fek = get_fek(inode); if (fek) { result = cat_decrypt(inode, fek); - decrypt_user_key_close(fek); + ntfs_decrypt_data_key_close(fek); } else { Eprintf("Could not obtain FEK.\n"); result = 1; From 997e23fb156badebed4874ca56f037ee8147d32f Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 27 Jul 2005 18:17:31 +0000 Subject: [PATCH 2401/2994] Fixes to last cleanup. --- ntfsprogs/decrypt.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index aa1bfcc1..09cb4ea8 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -161,7 +161,8 @@ ntfs_decrypt_user_key_session *ntfs_decrypt_user_key_session_open(void) return NULL; } if (!(hSystemStore = fnCertOpenStore(((LPCSTR)CERT_STORE_PROV_SYSTEM), - 0, NULL, CERT_SYSTEM_STORE_CURRENT_USER, L"MY"))) { + 0, (HCRYPTPROV)NULL, CERT_SYSTEM_STORE_CURRENT_USER, + L"MY"))) { fprintf(stderr, "Could not open system store.\n"); errno = EINVAL; return NULL; @@ -193,6 +194,18 @@ void ntfs_decrypt_user_key_session_close(ntfs_decrypt_user_key_session *session) free(session); } +static inline void reverse_buffer(unsigned char *buf, unsigned buf_size) +{ + unsigned char t; + unsigned i; + + for (i = 0; i < buf_size / 2; i++) { + t = buf[i]; + buf[i] = buf[buf_size - i - 1]; + buf[buf_size - i - 1] = t; + } +} + ntfs_decrypt_user_key *ntfs_decrypt_user_key_open( ntfs_decrypt_user_key_session *session __attribute__((unused)), unsigned char *thumb_print, unsigned thumb_size) @@ -220,7 +233,7 @@ ntfs_decrypt_user_key *ntfs_decrypt_user_key_open( hash_blob.pbData = thumb_print; if (!(pCert = fnCertFindCertificateInStore( - ((DECRYPT_SESSION*)session)->hSystemStore, + ((NTFS_DECRYPT_USER_KEY_SESSION*)session)->hSystemStore, (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING), 0, CERT_FIND_HASH, &hash_blob, NULL))) { fprintf(stderr, "Could not find cert in store.\n"); @@ -287,7 +300,8 @@ ntfs_decrypt_user_key *ntfs_decrypt_user_key_open( errno = EINVAL; return NULL; } - if ((key = (decrypt_key*)malloc(sizeof(NTFS_DECRYPT_USER_KEY)))) + if ((key = (ntfs_decrypt_user_key*)malloc( + sizeof(NTFS_DECRYPT_USER_KEY)))) ((NTFS_DECRYPT_USER_KEY*)key)->sexp_key = sexp_key; // todo: release all return key; @@ -307,18 +321,6 @@ void ntfs_decrypt_user_key_close(ntfs_decrypt_user_key *key) free(key); } -static inline void reverse_buffer(unsigned char *buf, unsigned buf_size) -{ - unsigned char t; - unsigned i; - - for (i = 0; i < buf_size / 2; i++) { - t = buf[i]; - buf[i] = buf[buf_size - i - 1]; - buf[buf_size - i - 1] = t; - } -} - /** * warning: decrypting into the input buffer! */ From 0a18d2fce7db0f04f49d65fe162f4623529401fa Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 27 Jul 2005 21:33:00 +0000 Subject: [PATCH 2402/2994] Fix some stupid mistakes from the cleanup. --- ntfsprogs/decrypt.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 09cb4ea8..0e3dff95 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -172,6 +172,7 @@ ntfs_decrypt_user_key_session *ntfs_decrypt_user_key_session_open(void) #ifdef __CYGWIN__ ((NTFS_DECRYPT_USER_KEY_SESSION*)session)->hSystemStore = hSystemStore; #endif /* defined(__CYGWIN__) */ + gcry_control(GCRYCTL_DISABLE_SECMEM, 0); return session; } @@ -265,6 +266,7 @@ ntfs_decrypt_user_key *ntfs_decrypt_user_key_open( errno = -1; return NULL; } + gcry_control(GCRYCTL_DISABLE_SECMEM, 0); e = gcry_mpi_set_ui(NULL, rsa_pub_key->pubexp); mpi_data = (key_blob + 0x14); size = rsa_pub_key->bitlen / 8; @@ -464,6 +466,10 @@ static void ntfs_desx_decrypt(void *context, u8 *outbuf, const u8 *inbuf) ntfs_desx_ctx *ctx = context; gcry_error_t err; + err = gcry_cipher_reset(ctx->gcry_cipher_hd); + if (err != GPG_ERR_NO_ERROR) + fprintf(stderr, "Failed to reset des cipher (error 0x%x).\n", + err); *(u64*)outbuf = *(const u64*)inbuf ^ ctx->out_whitening; err = gcry_cipher_encrypt(ctx->gcry_cipher_hd, outbuf, 8, NULL, 0); if (err != GPG_ERR_NO_ERROR) @@ -595,6 +601,7 @@ ntfs_decrypt_data_key *ntfs_decrypt_data_key_open(unsigned char *data, key->des_gcry_cipher_hd_ptr = (gcry_cipher_hd_t*)(key->key_data + ((key_size + 7) & ~7)); *key->des_gcry_cipher_hd_ptr = NULL; + gcry_control(GCRYCTL_DISABLE_SECMEM, 0); switch (key->alg_id) { case CALG_DESX: /* FIXME: This really needs locking so it is safe from races. */ @@ -614,7 +621,6 @@ ntfs_decrypt_data_key *ntfs_decrypt_data_key_open(unsigned char *data, errno = EINVAL; return NULL; } - gcry_control(GCRYCTL_DISABLE_SECMEM, 0); } wanted_key_size = 16; gcry_algo = ntfs_desx_algorithm_id; @@ -689,13 +695,16 @@ unsigned ntfs_decrypt_data_key_decrypt_sector(ntfs_decrypt_data_key *key, NTFS_DECRYPT_DATA_KEY *dkey = (NTFS_DECRYPT_DATA_KEY*)key; gcry_error_t err; + err = gcry_cipher_reset(dkey->gcry_cipher_hd); + if (err != GPG_ERR_NO_ERROR) + fprintf(stderr, "Failed to reset cipher (error 0x%x).\n", err); // FIXME: Why are we not calling gcry_cipher_setiv() here instead of // doing it by hand after the decryption? // It wants iv length 8 but we give it 16 for AES256 so it does not // like it... if ((err = gcry_cipher_decrypt(dkey->gcry_cipher_hd, data, 512, NULL, 0))) - fprintf(stderr, "sector_decrypt: error is %u.\n", err); + fprintf(stderr, "Decryption failed (error 0x%x).\n", err); /* Apply the IV. */ if (dkey->alg_id == CALG_AES_256) { ((u64*)data)[0] ^= 0x5816657be9161312LL + offset; From 2546690ee1f3e41fc79d0994c06ebcb29dd46299 Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 28 Jul 2005 10:36:31 +0000 Subject: [PATCH 2403/2994] Add EFS structure definitions to layout.h and adapt ntfsdecrypt for it. More fixes/cleanups to decrypt.c. This was all Yuval's work but I did some renaming afterwards and some whitespace cleanups. --- include/ntfs/attrib.h | 2 +- include/ntfs/layout.h | 98 ++++++++++++++++++++++++++++++++++++--- ntfsprogs/decrypt.c | 32 +++++++++---- ntfsprogs/ntfsdecrypt.c | 100 ++++++++++++++++++++++++---------------- 4 files changed, 174 insertions(+), 58 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index b9f93688..1785af1c 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -251,7 +251,7 @@ typedef union { EA_ATTR ea; PROPERTY_SET property_set; LOGGED_UTILITY_STREAM logged_util_stream; - EFS_ATTR efs; + EFS_ATTR_HEADER efs; } attr_val; extern void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident, diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 44a131c2..f1e31769 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1,8 +1,9 @@ /* * layout.h - Ntfs on-disk layout structures. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2000-2005 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2005 Yuval Fledel * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -2354,14 +2355,97 @@ typedef struct { * Operations on this attribute are logged to the journal ($LogFile) like * normal metadata changes. * - * Used by the Encrypting File System (EFS). All encrypted files have this - * attribute with the name $EFS. + * Used by the Encrypting File System (EFS). All encrypted files have this + * attribute with the name $EFS. See below for the relevant structures. */ typedef struct { /* Can be anything the creator chooses. */ - /* EFS uses it as follows: */ - // FIXME: Type this info, verifying it along the way. (AIA) -} __attribute__ ((__packed__)) LOGGED_UTILITY_STREAM, EFS_ATTR; +} __attribute__ ((__packed__)) LOGGED_UTILITY_STREAM; +/* + * $EFS Data Structure: + * + * The following information is about the data structures that are contained + * inside a logged utility stream (0x100) with a name of "$EFS". + * + * The stream starts with an instance of EFS_ATTR_HEADER. + * + * Next, at offsets offset_to_ddf_array and offset_to_drf_array (unless any of + * them is 0) there is a EFS_DF_ARRAY_HEADER immediately followed by a sequence + * of multiple data decryption/recovery fields. + * + * Each data decryption/recovery field starts with a EFS_DF_HEADER and the next + * one (if it exists) can be found by adding EFS_DF_HEADER->df_length bytes to + * the offset of the beginning of the current EFS_DF_HEADER. + * + * The data decryption/recovery field contains an EFS_DF_CERTIFICATE_HEADER, a + * SID, an optional GUID, an optional container name, a non-optional user name, + * and the encrypted FEK. + * + * Note all the below are best guesses so may have mistakes/inaccuracies. + * Corrections/clarifications/additions are always welcome! + */ + +/* The header of the 0x100 attribute named "$EFS". */ +typedef struct { +/* 0*/ u32 efs_length; /* Length of attribute in bytes. */ + u32 unknown1; /* always 0? */ + u32 unknown2; /* number of DDFs? */ + u32 unknown3; /* number of DRFs? */ +/* 16*/ u8 unknown4[16]; /* MD5 hash related to DDFs? */ +/* 32*/ u8 unknown5[16]; /* MD5 hash related to DRFs? */ +/* 48*/ u8 unknown6[16]; /* always 0? */ +/* 64*/ u32 offset_to_ddf_array;/* Offset in bytes to the array of data + decryption fields (DDF), see below. Zero if + no DDFs are present. */ + u32 offset_to_drf_array;/* Offset in bytes to the array of data + recovery fields (DRF), see below. Zero if + no DRFs are present. */ +} __attribute__ ((__packed__)) EFS_ATTR_HEADER; + +typedef struct { + u32 df_count; /* Number of data decryption/recovery fields in + the array. */ +} __attribute__ ((__packed__)) EFS_DF_ARRAY_HEADER; + +typedef struct { +/* 0*/ u32 df_length; /* Length of this data decryption/recovery + field in bytes. */ + u32 cred_header_offset; /* Offset in bytes to the credential header. */ + u32 fek_size; /* Size in bytes of the encrypted file + encryption key (FEK). */ + u32 fek_offset; /* Offset in bytes to the FEK from the start of + the data decryption/recovery field. */ +/* 16*/ u32 unknown1; /* always 0? */ +} __attribute__ ((__packed__)) EFS_DF_HEADER; + +typedef struct { +/* 0*/ u32 cred_length; /* Length of this credential in bytes. */ + u32 sid_offset; /* Offset in bytes to the user's sid from start + of this structure. */ + u32 cred_version; /* always 3? */ + u32 cert_header_size; /* Size in bytes of the certificate header. */ +/* 16*/ u32 cert_header_offset; /* Offset in bytes to the certificate header + from start of this structure. */ + u32 unknown1; /* always 0? */ + u32 unknown2; /* always 0? */ +} __attribute__ ((__packed__)) EFS_DF_CREDENTIAL_HEADER; + +typedef EFS_DF_CREDENTIAL_HEADER EFS_DF_CRED_HEADER; + +typedef struct { +/* 0*/ u32 thumbprint_offset; /* Offset in bytes to the thumbprint. */ + u32 thumbprint_size; /* Size of thumbprint in bytes. */ +/* 8*/ u32 guid_offset; /* Offset in bytes to GUID from start + if this structure or 0 if no GUID + present. */ + u32 container_name_offset; /* Offset in bytes to the name of the + container from start of this + structure or 0 if no name present. */ +/* 16*/ u32 user_name_offset; /* Offset in bytes to the user name + from start of this structure. */ +} __attribute__ ((__packed__)) EFS_DF_CERTIFICATE_HEADER; + +typedef EFS_DF_CERTIFICATE_HEADER EFS_DF_CERT_HEADER; + #endif /* defined _NTFS_LAYOUT_H */ - diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 0e3dff95..32f0dcc9 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -161,8 +161,7 @@ ntfs_decrypt_user_key_session *ntfs_decrypt_user_key_session_open(void) return NULL; } if (!(hSystemStore = fnCertOpenStore(((LPCSTR)CERT_STORE_PROV_SYSTEM), - 0, (HCRYPTPROV)NULL, CERT_SYSTEM_STORE_CURRENT_USER, - L"MY"))) { + 0, 0, CERT_SYSTEM_STORE_CURRENT_USER, L"MY"))) { fprintf(stderr, "Could not open system store.\n"); errno = EINVAL; return NULL; @@ -195,6 +194,13 @@ void ntfs_decrypt_user_key_session_close(ntfs_decrypt_user_key_session *session) free(session); } +/** + * reverse_buffer - + * + * This is a utility function for reversing the order of a buffer in place. + * Users of this function should be very careful not to sweep byte order + * problems under the rug. + */ static inline void reverse_buffer(unsigned char *buf, unsigned buf_size) { unsigned char t; @@ -256,14 +262,14 @@ ntfs_decrypt_user_key *ntfs_decrypt_user_key_open( &key_size)) { fprintf(stderr, "Could not export key: Error 0x%x\n", (unsigned)GetLastError()); - errno = -1; + errno = EINVAL; return NULL; } CryptDestroyKey(hCryptKey); rsa_pub_key = (RSAPUBKEY*)(key_blob + sizeof(PUBLICKEYSTRUC)); if ((err = gcry_ac_open(&gcry_handle, GCRY_AC_RSA, 0))) { fprintf(stderr, "Could not init gcrypt handle\n"); - errno = -1; + errno = EINVAL; return NULL; } gcry_control(GCRYCTL_DISABLE_SECMEM, 0); @@ -302,8 +308,8 @@ ntfs_decrypt_user_key *ntfs_decrypt_user_key_open( errno = EINVAL; return NULL; } - if ((key = (ntfs_decrypt_user_key*)malloc( - sizeof(NTFS_DECRYPT_USER_KEY)))) + if ((key = (ntfs_decrypt_user_key*) + malloc(sizeof(NTFS_DECRYPT_USER_KEY)))) ((NTFS_DECRYPT_USER_KEY*)key)->sexp_key = sexp_key; // todo: release all return key; @@ -312,8 +318,10 @@ decrypt_key_open_err: CryptDestroyKey(hCryptKey); if (pCert) fnCertFreeCertificateContext(pCert); -#endif /* defined(__CYGWIN__) */ + errno = EINVAL; +#else /* !defined(__CYGWIN__) */ errno = ENOTSUP; +#endif /* !defined(__CYGWIN__) */ return NULL; } @@ -427,6 +435,14 @@ static void ntfs_desx_key_expand(const u8 *src, u32 *des_key, *in_whitening = *(u64*)(md + 2); } +/** + * ntfs_desx_setkey - libgcrypt set_key implementation for DES-X-MS128 + * @context: pointer to a variable of type ntfs_desx_ctx + * @key: the 128 bit DES-X-MS128 key, concated with the DES handle + * @keylen: must always be 16 + * + * This is the libgcrypt set_key implementation for DES-X-MS128. + */ static gcry_err_code_t ntfs_desx_setkey(void *context, const u8 *key, unsigned keylen) { @@ -606,8 +622,6 @@ ntfs_decrypt_data_key *ntfs_decrypt_data_key_open(unsigned char *data, case CALG_DESX: /* FIXME: This really needs locking so it is safe from races. */ if (!ntfs_desx_module_count++) { - gcry_error_t err; - if (!desx_key_expand_test() || !des_test()) { errno = EINVAL; return NULL; diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 3a7ec04c..4c9f285f 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -272,17 +272,60 @@ static int cat_decrypt(ntfs_inode *inode, ntfs_decrypt_data_key *fek) return 0; } +static ntfs_decrypt_data_key *get_fek_from_df_array( + ntfs_decrypt_user_key_session *session, + EFS_DF_ARRAY_HEADER *efs_df_array) +{ + u32 ddf_count, hash_size, fek_size; + EFS_DF_CREDENTIAL_HEADER *efs_df_cred; + EFS_DF_CERTIFICATE_HEADER *efs_df_cert; + EFS_DF_HEADER *efs_df_header; + ntfs_decrypt_user_key *key; + u8 *hash_data, *fek_buf; + unsigned i; + + efs_df_header = (EFS_DF_HEADER*)(efs_df_array + 1); + ddf_count = le32_to_cpu(efs_df_array->df_count); + for (i = 0; i < ddf_count; i++) { + //Eprintf("ddf #%u.\n", i); + efs_df_cred = (EFS_DF_CREDENTIAL_HEADER*)((u8*)efs_df_header + + le32_to_cpu(efs_df_header->cred_header_offset)); + efs_df_cert = (EFS_DF_CERTIFICATE_HEADER*)((u8*)efs_df_cred + + le32_to_cpu(efs_df_cred->cert_header_offset)); + hash_size = le32_to_cpu(efs_df_cert->thumbprint_size); + hash_data = (u8*)efs_df_cert + + le32_to_cpu(efs_df_cert->thumbprint_offset); + fek_size = le32_to_cpu(efs_df_header->fek_size); + fek_buf = (u8*)efs_df_header + + le32_to_cpu(efs_df_header->fek_offset); + if ((key = ntfs_decrypt_user_key_open(session, hash_data, + hash_size))) { + fek_size = ntfs_decrypt_user_key_decrypt(key, fek_buf, + fek_size); + ntfs_decrypt_user_key_close(key); + if (fek_size) + return ntfs_decrypt_data_key_open(fek_buf, + fek_size); + fprintf(stderr, "Failed to decrypt the FEK.\n"); + } else + perror("Failed to open user key"); + efs_df_header = (EFS_DF_HEADER*)((u8*)efs_df_header + + le32_to_cpu(efs_df_header->df_length)); + } + return NULL; +} + /** * get_fek */ static ntfs_decrypt_data_key *get_fek(ntfs_inode *inode) { - ntfs_attr *na; - unsigned char *efs_buffer, *ddf, *certificate, *hash_data, *fek_buf; - u32 ddf_count, hash_size, fek_size; - unsigned i; ntfs_decrypt_user_key_session *session; - ntfs_decrypt_user_key *key; + EFS_DF_ARRAY_HEADER *efs_df_array; + ntfs_decrypt_data_key *fek; + EFS_ATTR_HEADER *efs_attr; + u8 *efs_buffer; + ntfs_attr *na; /* Obtain the $EFS contents. */ na = ntfs_attr_open(inode, AT_LOGGED_UTILITY_STREAM, @@ -313,44 +356,19 @@ static ntfs_decrypt_data_key *get_fek(ntfs_inode *inode) return NULL; } /* Iterate through the DDFs & DRFs until we obtain a key. */ - ddf = efs_buffer + le32_to_cpu(*(u32*)(efs_buffer + 0x40)); - ddf_count = le32_to_cpu(*(u32*)ddf); - - ddf = ddf + 0x04; - for (i = 0; i < ddf_count; i++) { - //Eprintf("ddf #%u.\n", i); - if (*(u32*)(ddf + 0x18)) - certificate = (ddf + 0x30 + - le32_to_cpu(*(u32*)(ddf + 0x18))); - else - certificate = (ddf + 0x30); - hash_size = (unsigned)le32_to_cpu(*(u32*)certificate); - hash_data = certificate + (unsigned) - le32_to_cpu(*(u32*)(certificate + 0x04)); - fek_size = (unsigned)le32_to_cpu(*(u32*)(ddf + 0x08)); - fek_buf = ddf + (unsigned)le32_to_cpu(*(u32*)(ddf + 0x0c)); - if ((key = ntfs_decrypt_user_key_open(session, hash_data, - hash_size))) { - fek_size = ntfs_decrypt_user_key_decrypt(key, fek_buf, - fek_size); - ntfs_decrypt_user_key_close(key); - if (fek_size) { - ntfs_decrypt_data_key *fek; - - ntfs_decrypt_user_key_session_close(session); - fek = ntfs_decrypt_data_key_open(fek_buf, - fek_size); - free(efs_buffer); - return fek; - } - fprintf(stderr, "Failed to decrypt the FEK.\n"); - } else - perror("Failed to open user key"); - ddf = ddf + le32_to_cpu(*(u32*)(ddf + 0x08)) + - le32_to_cpu(*(u32*)(ddf + 0x0c)); + efs_attr = (EFS_ATTR_HEADER*)efs_buffer; + efs_df_array = (EFS_DF_ARRAY_HEADER*)(efs_buffer + + le32_to_cpu(efs_attr->offset_to_ddf_array)); + fek = get_fek_from_df_array(session, efs_df_array); + if (!fek) { + efs_df_array = (EFS_DF_ARRAY_HEADER*)(efs_buffer + + le32_to_cpu(efs_attr->offset_to_drf_array)); + fek = get_fek_from_df_array(session, efs_df_array); } + /* Close all and return. */ ntfs_decrypt_user_key_session_close(session); - return NULL; + free(efs_buffer); + return fek; } /** From f67d8fcee1a5a854d90ea2c77dbb60f1d1e6d3f4 Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 28 Jul 2005 11:27:31 +0000 Subject: [PATCH 2404/2994] Use double indirection in case libgcrypt clones the key for you hack for closing the des cipher. --- ntfsprogs/decrypt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 32f0dcc9..cd74b884 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -473,7 +473,8 @@ static gcry_err_code_t ntfs_desx_setkey(void *context, const u8 *key, * Take a note of the ctx->gcry_cipher_hd since we need to close it at * ntfs_decrypt_data_key_close() time. */ - *(gcry_cipher_hd_t*)(key + ((keylen + 7) & ~7)) = ctx->gcry_cipher_hd; + **(gcry_cipher_hd_t***)(key + ((keylen + 7) & ~7)) = + &ctx->gcry_cipher_hd; return GPG_ERR_NO_ERROR; } @@ -614,9 +615,9 @@ ntfs_decrypt_data_key *ntfs_decrypt_data_key_open(unsigned char *data, key->alg_id = *(u32*)(data + 8); key->key_data = (u8*)key + ((sizeof(*key) + 7) & ~7); memcpy(key->key_data, data + 16, key_size); - key->des_gcry_cipher_hd_ptr = (gcry_cipher_hd_t*)(key->key_data + - ((key_size + 7) & ~7)); - *key->des_gcry_cipher_hd_ptr = NULL; + key->des_gcry_cipher_hd_ptr = NULL; + *(gcry_cipher_hd_t***)(key->key_data + ((key_size + 7) & ~7)) = + &key->des_gcry_cipher_hd_ptr; gcry_control(GCRYCTL_DISABLE_SECMEM, 0); switch (key->alg_id) { case CALG_DESX: @@ -691,7 +692,7 @@ ntfs_decrypt_data_key *ntfs_decrypt_data_key_open(unsigned char *data, void ntfs_decrypt_data_key_close(ntfs_decrypt_data_key *key) { NTFS_DECRYPT_DATA_KEY *dkey = (NTFS_DECRYPT_DATA_KEY*)key; - if (*dkey->des_gcry_cipher_hd_ptr) + if (dkey->des_gcry_cipher_hd_ptr) gcry_cipher_close(*dkey->des_gcry_cipher_hd_ptr); gcry_cipher_close(dkey->gcry_cipher_hd); free(key); From 5b087e6d8a31d29170106400afd60962ab2727dc Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 28 Jul 2005 15:14:40 +0000 Subject: [PATCH 2405/2994] Fix a core dump. --- ntfsprogs/decrypt.c | 47 +++++++++++++++++++++++++------------ ntfsprogs/ntfsdecrypt.c | 51 ++++++++++++++++++++++------------------- 2 files changed, 59 insertions(+), 39 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index cd74b884..acdbfbe5 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -145,6 +145,11 @@ static int cryptoAPI_init_imports(void) } #endif /* defined(__CYGWIN__) */ +static void ntfs_desx_key_expand(const u8 *src, u32 *des_key, + u64 *out_whitening, u64 *in_whitening); +static BOOL ntfs_desx_key_expand_test(void); +static BOOL ntfs_des_test(void); + ntfs_decrypt_user_key_session *ntfs_decrypt_user_key_session_open(void) { ntfs_decrypt_user_key_session *session; @@ -172,6 +177,11 @@ ntfs_decrypt_user_key_session *ntfs_decrypt_user_key_session_open(void) ((NTFS_DECRYPT_USER_KEY_SESSION*)session)->hSystemStore = hSystemStore; #endif /* defined(__CYGWIN__) */ gcry_control(GCRYCTL_DISABLE_SECMEM, 0); + if (!ntfs_desx_key_expand_test() || !ntfs_des_test()) { + free(session); + errno = EINVAL; + return NULL; + } return session; } @@ -503,11 +513,12 @@ static gcry_cipher_spec_t ntfs_desx_cipher = { .decrypt = ntfs_desx_decrypt, }; -//#define DO_CRYPTO_TESTS 1 +#define DO_CRYPTO_TESTS 1 #ifdef DO_CRYPTO_TESTS + /* Do not remove this test code from this file! AIA */ -static BOOL desx_key_expand_test(void) +static BOOL ntfs_desx_key_expand_test(void) { const u8 known_desx_on_disk_key[16] = { 0xa1, 0xf9, 0xe0, 0xb2, 0x53, 0x23, 0x9e, 0x8f, @@ -522,14 +533,18 @@ static BOOL desx_key_expand_test(void) const u8 known_in_whitening[8] = { 0x75, 0xf6, 0xa0, 0x1a, 0xc0, 0xca, 0x28, 0x1e }; - u64 test_des_key, test_out_whitening, test_in_whitening; + u64 test_out_whitening, test_in_whitening; + union { + u64 u64; + u32 u32[2]; + } test_des_key; BOOL res; - desx_key_expand(known_desx_on_disk_key, (u32*)test_des_key, - (u64*)test_out_whitening, (u64*)test_in_whitening); - res = test_des_key != *(u64*)known_des_key || - test_out_whitening != *(u64*)known_out_whitening || - test_in_whitening != *(u64*)known_in_whitening; + ntfs_desx_key_expand(known_desx_on_disk_key, test_des_key.u32, + &test_out_whitening, &test_in_whitening); + res = test_des_key.u64 == *(u64*)known_des_key && + test_out_whitening == *(u64*)known_out_whitening && + test_in_whitening == *(u64*)known_in_whitening; fprintf(stderr, "Testing whether ntfs_desx_key_expand() works: %s\n", res ? "SUCCESS" : "FAILED"); return res; @@ -586,12 +601,12 @@ static BOOL ntfs_des_test(void) #else /* !defined(DO_CRYPTO_TESTS) */ -static inline BOOL desx_key_expand_test(void) +static inline BOOL ntfs_desx_key_expand_test(void) { return TRUE; } -static inline BOOL des_test(void) +static inline BOOL ntfs_des_test(void) { return TRUE; } @@ -623,7 +638,7 @@ ntfs_decrypt_data_key *ntfs_decrypt_data_key_open(unsigned char *data, case CALG_DESX: /* FIXME: This really needs locking so it is safe from races. */ if (!ntfs_desx_module_count++) { - if (!desx_key_expand_test() || !des_test()) { + if (!ntfs_desx_key_expand_test() || !ntfs_des_test()) { errno = EINVAL; return NULL; } @@ -713,10 +728,12 @@ unsigned ntfs_decrypt_data_key_decrypt_sector(ntfs_decrypt_data_key *key, err = gcry_cipher_reset(dkey->gcry_cipher_hd); if (err != GPG_ERR_NO_ERROR) fprintf(stderr, "Failed to reset cipher (error 0x%x).\n", err); - // FIXME: Why are we not calling gcry_cipher_setiv() here instead of - // doing it by hand after the decryption? - // It wants iv length 8 but we give it 16 for AES256 so it does not - // like it... + /* + * Note: You may wonder why are we not calling gcry_cipher_setiv() here + * instead of doing it by hand after the decryption. The answer is + * that gcry_cipher_setiv() wants an iv of length 8 bytes but we give + * it a length of 16 for AES256 so it does not like it. + */ if ((err = gcry_cipher_decrypt(dkey->gcry_cipher_hd, data, 512, NULL, 0))) fprintf(stderr, "Decryption failed (error 0x%x).\n", err); diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 4c9f285f..63580c67 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -274,30 +274,30 @@ static int cat_decrypt(ntfs_inode *inode, ntfs_decrypt_data_key *fek) static ntfs_decrypt_data_key *get_fek_from_df_array( ntfs_decrypt_user_key_session *session, - EFS_DF_ARRAY_HEADER *efs_df_array) + EFS_DF_ARRAY_HEADER *df_array) { - u32 ddf_count, hash_size, fek_size; - EFS_DF_CREDENTIAL_HEADER *efs_df_cred; - EFS_DF_CERTIFICATE_HEADER *efs_df_cert; - EFS_DF_HEADER *efs_df_header; + u32 df_count, hash_size, fek_size; + EFS_DF_CREDENTIAL_HEADER *df_cred; + EFS_DF_CERTIFICATE_HEADER *df_cert; + EFS_DF_HEADER *df_header; ntfs_decrypt_user_key *key; u8 *hash_data, *fek_buf; unsigned i; - efs_df_header = (EFS_DF_HEADER*)(efs_df_array + 1); - ddf_count = le32_to_cpu(efs_df_array->df_count); - for (i = 0; i < ddf_count; i++) { - //Eprintf("ddf #%u.\n", i); - efs_df_cred = (EFS_DF_CREDENTIAL_HEADER*)((u8*)efs_df_header + - le32_to_cpu(efs_df_header->cred_header_offset)); - efs_df_cert = (EFS_DF_CERTIFICATE_HEADER*)((u8*)efs_df_cred + - le32_to_cpu(efs_df_cred->cert_header_offset)); - hash_size = le32_to_cpu(efs_df_cert->thumbprint_size); - hash_data = (u8*)efs_df_cert + - le32_to_cpu(efs_df_cert->thumbprint_offset); - fek_size = le32_to_cpu(efs_df_header->fek_size); - fek_buf = (u8*)efs_df_header + - le32_to_cpu(efs_df_header->fek_offset); + df_header = (EFS_DF_HEADER*)(df_array + 1); + df_count = le32_to_cpu(df_array->df_count); + //Eprintf("df_count 0x%x\n", df_count); + for (i = 0; i < df_count; i++) { + //Eprintf("ddf 0x%x\n", i); + df_cred = (EFS_DF_CREDENTIAL_HEADER*)((u8*)df_header + + le32_to_cpu(df_header->cred_header_offset)); + df_cert = (EFS_DF_CERTIFICATE_HEADER*)((u8*)df_cred + + le32_to_cpu(df_cred->cert_header_offset)); + hash_size = le32_to_cpu(df_cert->thumbprint_size); + hash_data = (u8*)df_cert + + le32_to_cpu(df_cert->thumbprint_offset); + fek_size = le32_to_cpu(df_header->fek_size); + fek_buf = (u8*)df_header + le32_to_cpu(df_header->fek_offset); if ((key = ntfs_decrypt_user_key_open(session, hash_data, hash_size))) { fek_size = ntfs_decrypt_user_key_decrypt(key, fek_buf, @@ -309,8 +309,8 @@ static ntfs_decrypt_data_key *get_fek_from_df_array( fprintf(stderr, "Failed to decrypt the FEK.\n"); } else perror("Failed to open user key"); - efs_df_header = (EFS_DF_HEADER*)((u8*)efs_df_header + - le32_to_cpu(efs_df_header->df_length)); + df_header = (EFS_DF_HEADER*)((u8*)df_header + + le32_to_cpu(df_header->df_length)); } return NULL; } @@ -357,10 +357,13 @@ static ntfs_decrypt_data_key *get_fek(ntfs_inode *inode) } /* Iterate through the DDFs & DRFs until we obtain a key. */ efs_attr = (EFS_ATTR_HEADER*)efs_buffer; - efs_df_array = (EFS_DF_ARRAY_HEADER*)(efs_buffer + + fek = NULL; + if (efs_attr->offset_to_ddf_array) { + efs_df_array = (EFS_DF_ARRAY_HEADER*)(efs_buffer + le32_to_cpu(efs_attr->offset_to_ddf_array)); - fek = get_fek_from_df_array(session, efs_df_array); - if (!fek) { + fek = get_fek_from_df_array(session, efs_df_array); + } + if (!fek && efs_attr->offset_to_drf_array) { efs_df_array = (EFS_DF_ARRAY_HEADER*)(efs_buffer + le32_to_cpu(efs_attr->offset_to_drf_array)); fek = get_fek_from_df_array(session, efs_df_array); From 79e9e30ee324f6302b7c7f7c87bdb62cc78b129c Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 28 Jul 2005 16:18:20 +0000 Subject: [PATCH 2406/2994] Use libgcrypt instead of openssl for desx_key_expand's MD5 hashing. --- ntfsprogs/decrypt.c | 85 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 17 deletions(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index acdbfbe5..0bb6ec42 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -145,11 +145,6 @@ static int cryptoAPI_init_imports(void) } #endif /* defined(__CYGWIN__) */ -static void ntfs_desx_key_expand(const u8 *src, u32 *des_key, - u64 *out_whitening, u64 *in_whitening); -static BOOL ntfs_desx_key_expand_test(void); -static BOOL ntfs_des_test(void); - ntfs_decrypt_user_key_session *ntfs_decrypt_user_key_session_open(void) { ntfs_decrypt_user_key_session *session; @@ -177,11 +172,6 @@ ntfs_decrypt_user_key_session *ntfs_decrypt_user_key_session_open(void) ((NTFS_DECRYPT_USER_KEY_SESSION*)session)->hSystemStore = hSystemStore; #endif /* defined(__CYGWIN__) */ gcry_control(GCRYCTL_DISABLE_SECMEM, 0); - if (!ntfs_desx_key_expand_test() || !ntfs_des_test()) { - free(session); - errno = EINVAL; - return NULL; - } return session; } @@ -410,6 +400,8 @@ unsigned ntfs_decrypt_user_key_decrypt(ntfs_decrypt_user_key *key, return size - padding_length; } +#if 0 +// This is the old code based on OpenSSL. Please do not remove it. AIA /** * ntfs_desx_key_expand - expand a 128-bit desx key to the needed 192-bit key * @src: source buffer containing 128-bit key @@ -444,6 +436,53 @@ static void ntfs_desx_key_expand(const u8 *src, u32 *des_key, *out_whitening = *(u64*)md; *in_whitening = *(u64*)(md + 2); } +#endif + +/** + * ntfs_desx_key_expand - expand a 128-bit desx key to the needed 192-bit key + * @src: source buffer containing 128-bit key + * + * Expands the on-disk 128-bit desx key to the needed des key, the in-, and the + * out-whitening keys required to perform desx {de,en}cryption. + */ +static gcry_error_t ntfs_desx_key_expand(const u8 *src, u32 *des_key, + u64 *out_whitening, u64 *in_whitening) +{ + static const u8 *salt1 = "Dan Simon "; + static const u8 *salt2 = "Scott Field"; + static const int salt_len = 12; + gcry_md_hd_t hd1, hd2; + u32 *md; + gcry_error_t err; + + err = gcry_md_open(&hd1, GCRY_MD_MD5, 0); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to open MD5 digest.\n"); + return err; + } + /* Hash the on-disk key. */ + gcry_md_write(hd1, src, 128 / 8); + /* Copy the current hash for efficiency. */ + err = gcry_md_copy(&hd2, hd1); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to copy MD5 digest object.\n"); + goto out; + } + /* Hash with the first salt and store the result. */ + gcry_md_write(hd1, salt1, salt_len); + md = (u32*)gcry_md_read(hd1, 0); + des_key[0] = md[0] ^ md[1]; + des_key[1] = md[2] ^ md[3]; + /* Hash with the second salt and store the result. */ + gcry_md_write(hd2, salt2, salt_len); + md = (u32*)gcry_md_read(hd2, 0); + *out_whitening = *(u64*)md; + *in_whitening = *(u64*)(md + 2); + gcry_md_close(hd2); +out: + gcry_md_close(hd1); + return err; +} /** * ntfs_desx_setkey - libgcrypt set_key implementation for DES-X-MS128 @@ -471,11 +510,17 @@ static gcry_err_code_t ntfs_desx_setkey(void *context, const u8 *key, err); return err; } - ntfs_desx_key_expand(key, (u32*)des_key, &ctx->out_whitening, + err = ntfs_desx_key_expand(key, (u32*)des_key, &ctx->out_whitening, &ctx->in_whitening); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to expand desx key (error 0x%x).\n", + err); + gcry_cipher_close(ctx->gcry_cipher_hd); + return err; + } err = gcry_cipher_setkey(ctx->gcry_cipher_hd, des_key, sizeof(des_key)); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to set des key (error 0x%x.\n", err); + fprintf(stderr, "Failed to set des key (error 0x%x).\n", err); gcry_cipher_close(ctx->gcry_cipher_hd); return err; } @@ -513,7 +558,7 @@ static gcry_cipher_spec_t ntfs_desx_cipher = { .decrypt = ntfs_desx_decrypt, }; -#define DO_CRYPTO_TESTS 1 +//#define DO_CRYPTO_TESTS 1 #ifdef DO_CRYPTO_TESTS @@ -538,13 +583,19 @@ static BOOL ntfs_desx_key_expand_test(void) u64 u64; u32 u32[2]; } test_des_key; + gcry_error_t err; BOOL res; - ntfs_desx_key_expand(known_desx_on_disk_key, test_des_key.u32, + err = ntfs_desx_key_expand(known_desx_on_disk_key, test_des_key.u32, &test_out_whitening, &test_in_whitening); - res = test_des_key.u64 == *(u64*)known_des_key && - test_out_whitening == *(u64*)known_out_whitening && - test_in_whitening == *(u64*)known_in_whitening; + if (err != GPG_ERR_NO_ERROR) + res = FALSE; + else + res = test_des_key.u64 == *(u64*)known_des_key && + test_out_whitening == + *(u64*)known_out_whitening && + test_in_whitening == + *(u64*)known_in_whitening; fprintf(stderr, "Testing whether ntfs_desx_key_expand() works: %s\n", res ? "SUCCESS" : "FAILED"); return res; From 1a029f788e6d705beaa23b2e96ed3fdc4004e38c Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 28 Jul 2005 16:24:27 +0000 Subject: [PATCH 2407/2994] Remove Openssl linking in for decrypt.c from Makefile.am and update build system. --- ntfsprogs/Makefile.am | 6 +++--- ntfsprogs/Makefile.in | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 97b725cf..61648e44 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -87,9 +87,9 @@ endif # We don't distribute these -ntfsdecrypt_SOURCES = ntfsdecrypt.c decrypt.c decrypt.h utils.c utils.h -ntfsdecrypt_LDADD = $(AM_LIBS) -ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt -lcrypto +ntfsdecrypt_SOURCES = ntfsdecrypt.c decrypt.c decrypt.h utils.c utils.h +ntfsdecrypt_LDADD = $(AM_LIBS) +ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h ntfsrm_LDADD = $(AM_LIBS) diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index 354bf5d9..d34ddafc 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -350,7 +350,7 @@ ntfscp_LDFLAGS = $(AM_LFLAGS) # We don't distribute these ntfsdecrypt_SOURCES = ntfsdecrypt.c decrypt.c decrypt.h utils.c utils.h ntfsdecrypt_LDADD = $(AM_LIBS) -ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt -lcrypto +ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h ntfsrm_LDADD = $(AM_LIBS) ntfsrm_LDFLAGS = $(AM_LFLAGS) From fb433d4ad3dbbba3fc8f10e136c154d23c413947 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 28 Jul 2005 21:20:23 +0000 Subject: [PATCH 2408/2994] Fix unistr.c::ntfs_mbstoucs on systems with utf8 locale. --- ChangeLog | 1 + libntfs/unistr.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 105dedea..9ee46dc7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ xx/xx/xxxx - 1.12.0-WIP extent. (Szaka) - ntfscp: fix attribute name parsing bug introduced in 1.10.0. (Yura) - ntfsinfo: dump more information for indexes. (Yura) + - Fix unistr.c::ntfs_mbstoucs on systems with utf8 locale. (Yura) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/libntfs/unistr.c b/libntfs/unistr.c index e0c144b8..afa206b0 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -467,7 +467,7 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs, int outs_len) ntfschar *ucs; const char *s; wchar_t wc; - int i, o, cnt, ins_len, ucs_len; + int i, o, cnt, ins_len, ucs_len, ins_size; #ifdef HAVE_MBSINIT mbstate_t mbstate; #endif @@ -482,6 +482,8 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs, int outs_len) errno = ENAMETOOLONG; return -1; } + /* Determine the size of the multi-byte string in bytes. */ + ins_size = strlen(ins); /* Determine the length of the multi-byte string. */ s = ins; #if defined(HAVE_MBSINIT) @@ -543,9 +545,9 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs, int outs_len) } /* Convert the multibyte character to a wide character. */ #ifdef HAVE_MBSINIT - cnt = mbrtowc(&wc, ins + i, ins_len - i, &mbstate); + cnt = mbrtowc(&wc, ins + i, ins_size - i, &mbstate); #else - cnt = mbtowc(&wc, ins + i, ins_len - i); + cnt = mbtowc(&wc, ins + i, ins_size - i); #endif if (!cnt) break; From f0ff698c2252065f8de1eb650252b0b1286d38f0 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 29 Jul 2005 09:54:02 +0000 Subject: [PATCH 2409/2994] Update some efs info (the 16byte fields in the header are md5 hashes of the decrypted fek, ddfs, and drfs. windows uses them as a sanity check and a check that the efs attribute has not been tampered with.) --- include/ntfs/layout.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index f1e31769..d70f8501 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -2392,9 +2392,9 @@ typedef struct { u32 unknown1; /* always 0? */ u32 unknown2; /* number of DDFs? */ u32 unknown3; /* number of DRFs? */ -/* 16*/ u8 unknown4[16]; /* MD5 hash related to DDFs? */ -/* 32*/ u8 unknown5[16]; /* MD5 hash related to DRFs? */ -/* 48*/ u8 unknown6[16]; /* always 0? */ +/* 16*/ u8 unknown4[16]; /* MD5 hash of decrypted FEK? */ +/* 32*/ u8 unknown5[16]; /* MD5 hash of DDFs? */ +/* 48*/ u8 unknown6[16]; /* MD5 hash of DRFs? */ /* 64*/ u32 offset_to_ddf_array;/* Offset in bytes to the array of data decryption fields (DDF), see below. Zero if no DDFs are present. */ From 4088de1017ca7881cefb3dfd5215c901367a43ca Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 29 Jul 2005 14:44:23 +0000 Subject: [PATCH 2410/2994] Change errno and print more verbose message in case if logfile check failed. --- ChangeLog | 2 ++ libntfs/volume.c | 17 +++++++---------- ntfsprogs/utils.c | 9 ++++++++- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ee46dc7..88ec652e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,8 @@ xx/xx/xxxx - 1.12.0-WIP - ntfscp: fix attribute name parsing bug introduced in 1.10.0. (Yura) - ntfsinfo: dump more information for indexes. (Yura) - Fix unistr.c::ntfs_mbstoucs on systems with utf8 locale. (Yura) + - Change errno and print more verbose message in case if logfile check + failed. (Yura) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/libntfs/volume.c b/libntfs/volume.c index 7f8e0a39..db786ef2 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -562,7 +562,7 @@ static int ntfs_volume_check_logfile(ntfs_volume *vol) { ntfs_inode *ni; ntfs_attr *na = NULL; - int ret, err = 0; + int err = 0; if ((ni = ntfs_inode_open(vol, FILE_LogFile)) == NULL) { Dprintf("Failed to open inode FILE_LogFile.\n"); @@ -571,23 +571,20 @@ static int ntfs_volume_check_logfile(ntfs_volume *vol) } if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) { Dprintf("Failed to open $FILE_LogFile/$DATA\n"); - ret = -1; err = EIO; goto exit; } - if (ntfs_check_logfile(na) && ntfs_is_logfile_clean(na)) - ret = 0; - else { - ret = -1; - err = EIO; - } + if (!ntfs_check_logfile(na) || !ntfs_is_logfile_clean(na)) + err = EOPNOTSUPP; exit: if (na) ntfs_attr_close(na); ntfs_inode_close(ni); - if (ret) + if (err) { errno = err; - return ret; + return -1; + } + return 0; } /** diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index d3cdebad..a9dc6a4c 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -154,7 +154,14 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL vol = ntfs_mount (device, flags); if (!vol) { - Eprintf ("Couldn't mount device '%s': %s\n", device, strerror (errno)); + int err; + + err = errno; + Eprintf("Couldn't mount device '%s': %s\n", device, + strerror(err)); + if (err == EOPNOTSUPP) + Eprintf("It's seems that logfile check failed. " + "Try to mount volume in windows.\n"); return NULL; } From 3ccd12241ad52653b4bb6e0134d21a17f3468587 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 29 Jul 2005 15:04:57 +0000 Subject: [PATCH 2411/2994] Start the build system cleanup. Add AM_MAINTAINER_MODE to configure.ac and remove configure and Makefile.in. Also add Makefile.in to .cvsignore. --- .cvsignore | 2 + Makefile.in | 655 - aclocal.m4 | 29 + configure | 24201 ------------------------------------- configure.ac | 1 + doc/Makefile.in | 9 +- include/Makefile.in | 9 +- include/ntfs/Makefile.in | 9 +- libntfs/Makefile.in | 9 +- ntfsprogs/Makefile.in | 9 +- 10 files changed, 62 insertions(+), 24871 deletions(-) delete mode 100644 Makefile.in delete mode 100755 configure diff --git a/.cvsignore b/.cvsignore index c235cc7c..7ad0fd15 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,8 +1,10 @@ Makefile +Makefile.in autom4te.cache config.h config.log config.status +configure libtool ntfsprogs.spec stamp-h1 diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 23ba5a81..00000000 --- a/Makefile.in +++ /dev/null @@ -1,655 +0,0 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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 = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(srcdir)/ntfsprogs.spec.in $(top_srcdir)/configure AUTHORS \ - COPYING ChangeLog INSTALL NEWS compile config.guess config.sub \ - depcomp install-sh ltconfig ltmain.sh missing mkinstalldirs -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno configure.status.lineno -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = ntfsprogs.spec -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTODIRS = @AUTODIRS@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_FUSE_MODULE_FALSE = @ENABLE_FUSE_MODULE_FALSE@ -ENABLE_FUSE_MODULE_TRUE = @ENABLE_FUSE_MODULE_TRUE@ -ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ -ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@ -FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ -LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -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@ -PKG_CONFIG = @PKG_CONFIG@ -RANLIB = @RANLIB@ -REALLYSTATIC_FALSE = @REALLYSTATIC_FALSE@ -REALLYSTATIC_TRUE = @REALLYSTATIC_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -all_includes = @all_includes@ -all_libraries = @all_libraries@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -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@ -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@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -SUBDIRS = doc include libntfs ntfsprogs -EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ - INSTALL NEWS README autogen.sh ntfsprogs.spec.in \ - TODO.ntfsprogs getgccver - -AUTOMAKE_OPTIONS = gnu -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -am--refresh: - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ - cd $(srcdir) && $(AUTOMAKE) --gnu \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: $(am__configure_deps) - cd $(top_srcdir) && $(AUTOHEADER) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 -ntfsprogs.spec: $(top_builddir)/config.status $(srcdir)/ntfsprogs.spec.in - cd $(top_builddir) && $(SHELL) ./config.status $@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - mkdir $(distdir) - $(mkdir_p) $(distdir)/. $(distdir)/libntfs $(distdir)/ntfsprogs - @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"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - 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 \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-hook - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_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 - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile config.h -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -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: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-hdr \ - distclean-libtool distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ - check-am clean clean-generic clean-libtool clean-recursive \ - ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ - dist-hook dist-shar dist-tarZ dist-zip distcheck distclean \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-recursive distclean-tags distcleancheck distdir \ - distuninstallcheck dvi dvi-am html html-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-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am uninstall-info-am - - -dist-hook: ntfsprogs.spec - cp ntfsprogs.spec $(distdir) - -libtool: $(LIBTOOL_DEPS) - $(SHELL) ./config.status --recheck - -strip: - (cd ntfsprogs && $(MAKE) strip) || exit 1; - -extra: extras - -extras: - (cd ntfsprogs && $(MAKE) extras) || exit 1; - -libs: - (cd libntfs && $(MAKE) libs) || exit 1; -# 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/aclocal.m4 b/aclocal.m4 index 2b04da7c..61f101aa 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -6578,6 +6578,35 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 +# 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. + +# serial 4 + +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]) + # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. diff --git a/configure b/configure deleted file mode 100755 index e1b20dbf..00000000 --- a/configure +++ /dev/null @@ -1,24201 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for ntfsprogs 1.12.0-WIP. -# -# Report bugs to . -# -# Copyright (C) 2003 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 -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/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 -z "`(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 - - # 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 - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval 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="eval 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 - - - -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -echo=${ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null 2>&1 && unset CDPATH - -if test -z "$ECHO"; then -if test "X${echo_test_string+set}" != Xset; then -# find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if (echo_test_string="`eval $cmd`") 2>/dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - - - - -tagnames=${tagnames+${tagnames},}CXX - -tagnames=${tagnames+${tagnames},}F77 - -# 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 -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='ntfsprogs' -PACKAGE_TARNAME='ntfsprogs' -PACKAGE_VERSION='1.12.0-WIP' -PACKAGE_STRING='ntfsprogs 1.12.0-WIP' -PACKAGE_BUGREPORT='linux-ntfs-dev@lists.sourceforge.net' - -ac_unique_file="config.h.in" -ac_default_prefix=/usr/local -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_STAT_H -# include -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar REALLYSTATIC_TRUE REALLYSTATIC_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 CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG LIBNTFS_GNOMEVFS_CFLAGS LIBNTFS_GNOMEVFS_LIBS ENABLE_GNOME_VFS_TRUE ENABLE_GNOME_VFS_FALSE FUSE_MODULE_CFLAGS FUSE_MODULE_LIBS ENABLE_FUSE_MODULE_TRUE ENABLE_FUSE_MODULE_FALSE all_includes all_libraries AUTODIRS 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. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -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' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -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" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - 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 ;; - - --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 ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - 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=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - 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'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -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_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - 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 ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - 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 ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - 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 | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - 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-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-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - 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 ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - 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 - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - 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. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - 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-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 ;; - - -*) { 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 ;; - - *) - # 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 - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# 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 - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - 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 - -# 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 - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# 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_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=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(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 -ac_env_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS -ac_env_CXXCPP_set=${CXXCPP+set} -ac_env_CXXCPP_value=$CXXCPP -ac_cv_env_CXXCPP_set=${CXXCPP+set} -ac_cv_env_CXXCPP_value=$CXXCPP -ac_env_F77_set=${F77+set} -ac_env_F77_value=$F77 -ac_cv_env_F77_set=${F77+set} -ac_cv_env_F77_value=$F77 -ac_env_FFLAGS_set=${FFLAGS+set} -ac_env_FFLAGS_value=$FFLAGS -ac_cv_env_FFLAGS_set=${FFLAGS+set} -ac_cv_env_FFLAGS_value=$FFLAGS - -# -# 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 ntfsprogs 1.12.0-WIP 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] - --target=TARGET configure for building compilers for TARGET [HOST] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of ntfsprogs 1.12.0-WIP:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-shared[=PKGS] - build shared libraries [default=yes] - --enable-static[=PKGS] - build static libraries [default=yes] - --enable-debug enable additional debugging code and output - --disable-default-device-io-ops - do not provide default device io operations - --disable-gnome-vfs omit Gnome-VFS-2.0 'libntfs' interface - (default=detect) - --disable-fuse-module omit FUSE 'libntfs' interface (default=detect) - --enable-really-static create completely static binaries for the utilities - --enable-warnings enable additional compiler warnings - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --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] - --with-tags[=TAGS] - include additional configurations [automatic] - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CXXCPP C++ preprocessor - F77 Fortran 77 compiler command - FFLAGS Fortran 77 compiler flags - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_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 - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - 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 -ntfsprogs configure 1.12.0-WIP -generated by GNU Autoconf 2.59 - -Copyright (C) 2003 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 ntfsprogs $as_me 1.12.0-WIP, which was -generated by GNU Autoconf 2.59. 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 && - 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 - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { 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 - # 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 - -# 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 -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 - - - - - - - - - - - - - - - - - - - - - - - - - - - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - 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 "$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="$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. - -# 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/'` - - -echo "$as_me:$LINENO: checking target system type" >&5 -echo $ECHO_N "checking target system type... $ECHO_C" >&6 -if test "${ac_cv_target+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_target_alias=$target_alias -test "x$ac_cv_target_alias" = "x" && - ac_cv_target_alias=$ac_cv_host_alias -ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_target" >&5 -echo "${ECHO_T}$ac_cv_target" >&6 -target=$ac_cv_target -target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- - - ac_config_headers="$ac_config_headers config.h" - -am__api_version="1.9" -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# 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" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -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 test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - 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/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /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 - done - ;; -esac -done - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$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}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -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 > 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 conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - 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 "$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" = conftest.file - ) -then - # Ok. - : -else - { { 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" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - 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 - -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -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 - -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 "$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 >conftest.make <<\_ACEOF -all: - @echo 'ac_maketemp="$(MAKE)"' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -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 conftest.make -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SET_MAKE= -else - 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 - -# 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 - -# 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 - - -# Define the identity of the package. - PACKAGE='ntfsprogs' - VERSION='1.12.0-WIP' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_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"} - -install_sh=${install_sh-"$am_aux_dir/install-sh"} - -# 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 - 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 - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - - - - - -# 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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi; - - -# This is required to get past a stupid configure bug when making the rpm. -# Basically it is broken to specify the host as a command line argument to -# configure on its own, i.e. without giving --host=. It is supposed to work -# but doesn't. So this sets host and erases nonopt effectively moving the -# standalone command line option into the --host= form. -if test "x$nonopt" != "xNONE"; then - host="$nonopt" - nonopt="NONE" -fi - - -if test "x$prefix" = "xNONE"; then - prefix=$ac_default_prefix - ac_configure_args="$ac_configure_args --prefix $prefix" -fi - -# Command-line options. -# Check whether --enable-debug or --disable-debug was given. -if test "${enable_debug+set}" = set; then - enableval="$enable_debug" - -else - enable_debug=no - -fi; - -# AH_TEMPLATE is needed here because we want to have a template in config.h -# regardless of whether the option is given or not. - - -# Check whether --enable-default-device-io-ops or --disable-default-device-io-ops was given. -if test "${enable_default_device_io_ops+set}" = set; then - enableval="$enable_default_device_io_ops" - if test "$enable_default_device_io_ops" == "no"; then - cat >>confdefs.h <<\_ACEOF -#define NO_NTFS_DEVICE_DEFAULT_IO_OPS 1 -_ACEOF - - fi -fi; - -# Check whether --enable-gnome-vfs or --disable-gnome-vfs was given. -if test "${enable_gnome_vfs+set}" = set; then - enableval="$enable_gnome_vfs" - -else - enable_gnome_vfs=auto - -fi; - -# Check whether --enable-fuse-module or --disable-fuse-module was given. -if test "${enable_fuse_module+set}" = set; then - enableval="$enable_fuse_module" - -else - enable_fuse_module=auto - -fi; - -# Check whether --enable-really-static or --disable-really-static was given. -if test "${enable_really_static+set}" = set; then - enableval="$enable_really_static" - -else - enable_really_static=no - -fi; - - -if test "$enable_really_static" = yes; then - REALLYSTATIC_TRUE= - REALLYSTATIC_FALSE='#' -else - REALLYSTATIC_TRUE='#' - REALLYSTATIC_FALSE= -fi - - -# Check whether --enable-warnings or --disable-warnings was given. -if test "${enable_warnings+set}" = set; then - enableval="$enable_warnings" - -else - enable_warnings=no - -fi; - -# Use GNU extensions if available. - -cat >>confdefs.h <<\_ACEOF -#define _GNU_SOURCE 1 -_ACEOF - - - -# For djgpp support. (Note: This needs to be before AC_PROG_CC.) -case "$target" in -*-*-*djgpp) - if test -z "$CC"; then CC=gcc; fi - if test -z "$AR"; then AR=ar; fi - if test -z "$LD"; then LD=ld; fi -;; -esac - -# Checks for programs. -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 "$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 -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 -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 "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 - 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 "$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 - ac_prog_rejected=no -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 $# != 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 - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -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 "$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 -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 -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 - - 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 - -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 - - test -n "$ac_ct_CC" && break -done - - 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 &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - 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 file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $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 - 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 -fi -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 - { { 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 -/* 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.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 - 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.err 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 -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* 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; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 \ - '' \ - '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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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.err 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 - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch 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 - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' 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 - - - -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 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 to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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 - ac_cpp_err=$ac_cpp_err$ac_c_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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 - ac_cpp_err=$ac_cpp_err$ac_c_werror_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 -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 - - 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 to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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 - ac_cpp_err=$ac_cpp_err$ac_c_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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 - ac_cpp_err=$ac_cpp_err$ac_c_werror_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 -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 - 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 "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - -if test $ac_cv_c_compiler_gnu = yes; then - echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 -echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 -if test "${ac_cv_prog_gcc_traditional+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -Autoconf TIOCGETP -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then - ac_cv_prog_gcc_traditional=yes -else - ac_cv_prog_gcc_traditional=no -fi -rm -f conftest* - - - if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -Autoconf TCGETA -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then - ac_cv_prog_gcc_traditional=yes -fi -rm -f conftest* - - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 -echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 - if test $ac_cv_prog_gcc_traditional = yes; then - CC="$CC -traditional" - fi -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 -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# 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" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -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 test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - 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/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /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 - done - ;; -esac -done - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$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}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -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 - -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 >conftest.make <<\_ACEOF -all: - @echo 'ac_maketemp="$(MAKE)"' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -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 conftest.make -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SET_MAKE= -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - SET_MAKE="MAKE=${MAKE-make}" -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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi; - -echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 -echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 -if test "${lt_cv_path_SED+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done - -fi - -SED=$lt_cv_path_SED -echo "$as_me:$LINENO: result: $SED" >&5 -echo "${ECHO_T}$SED" >&6 - - -# 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 $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $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. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname 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 - 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 - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - 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. - case `"$lt_cv_path_LD" -v 2>&1 &5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -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. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - - -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 -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - darwin*) - if test "$GCC" = yes; then - reload_cmds='$CC -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - -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 - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - 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 - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - 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 - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi -fi -echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 -echo "${ECHO_T}$lt_cv_path_NM" >&6 -NM="$lt_cv_path_NM" - -echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 -echo $ECHO_N "checking how to recognise dependent 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 extended 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 -aix4* | aix5*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - 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*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump'. - 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=pass_all - ;; - -freebsd* | kfreebsd*-gnu | dragonfly*) - 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|DragonFly)/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_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - 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_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - 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 - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - 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*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -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 -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# 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 && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > 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 - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 4200 "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 - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - 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 - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > 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.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - 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 -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -need_locks="$enable_libtool_lock" - - -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 <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f conftest.err 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 <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#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 - -#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 "$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 -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -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 <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# 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 -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - - - -for ac_header in dlfcn.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 -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 -/* 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 - ac_cpp_err=$ac_cpp_err$ac_c_werror_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:$ac_c_preproc_warn_flag 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 compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - 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: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## --------------------------------------------------- ## -## Report this to linux-ntfs-dev@lists.sourceforge.net ## -## --------------------------------------------------- ## -_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 - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC - 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_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # 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_CXX="$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 -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -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_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - - -# 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 &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -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_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cxx_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -for ac_declaration in \ - '' \ - '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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -depcc="$CXX" 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_CXX_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_CXX_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 - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch 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 - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 -CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then - am__fastdepCXX_TRUE= - am__fastdepCXX_FALSE='#' -else - am__fastdepCXX_TRUE='#' - am__fastdepCXX_FALSE= -fi - - - - -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_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 -if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -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 - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -echo "$as_me:$LINENO: result: $CXXCPP" >&5 -echo "${ECHO_T}$CXXCPP" >&6 -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # 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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_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_cxx_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_cxx_werror_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 -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 \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -fi - - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran - 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_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$F77"; then - ac_cv_prog_F77="$F77" # 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_F77="$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 -F77=$ac_cv_prog_F77 -if test -n "$F77"; then - echo "$as_me:$LINENO: result: $F77" >&5 -echo "${ECHO_T}$F77" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$F77" && break - done -fi -if test -z "$F77"; then - ac_ct_F77=$F77 - for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran -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_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_F77"; then - ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_F77=$ac_cv_prog_ac_ct_F77 -if test -n "$ac_ct_F77"; then - echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 -echo "${ECHO_T}$ac_ct_F77" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_F77" && break -done - - F77=$ac_ct_F77 -fi - - -# Provide some information about the compiler. -echo "$as_me:5544:" \ - "checking for Fortran 77 compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -rm -f a.out - -# If we don't use `.F' as extension, the preprocessor is not run on the -# input file. (Note that this only needs to work for GNU compilers.) -ac_save_ext=$ac_ext -ac_ext=F -echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 -if test "${ac_cv_f77_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF - program main -#ifndef __GNUC__ - choke me -#endif - - end -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext -ac_cv_f77_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 -ac_ext=$ac_save_ext -ac_test_FFLAGS=${FFLAGS+set} -ac_save_FFLAGS=$FFLAGS -FFLAGS= -echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 -echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_f77_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - FFLAGS=-g -cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_f77_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_f77_g=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 -echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 -if test "$ac_test_FFLAGS" = set; then - FFLAGS=$ac_save_FFLAGS -elif test $ac_cv_prog_f77_g = yes; then - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-g -O2" - else - FFLAGS="-g" - fi -else - if test "x$ac_cv_f77_compiler_gnu" = xyes; then - FFLAGS="-O2" - else - FFLAGS= - fi -fi - -G77=`test $ac_compiler_gnu = yes && echo yes` -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 - - - -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! - -# find the maximum length of command line arguments -echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 -echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 -if test "${lt_cv_sys_max_cmd_len+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for *BSD - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - ;; - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 -echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 -else - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 -fi - - - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 -echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -linux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDGIRSTW]' - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris* | sysv5*) - symcode='[BDRT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - 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); } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - echo "$as_me:$LINENO: result: failed" >&5 -echo "${ECHO_T}failed" >&6 -else - echo "$as_me:$LINENO: result: ok" >&5 -echo "${ECHO_T}ok" >&6 -fi - -echo "$as_me:$LINENO: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -if test "${lt_cv_objdir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 -echo "${ECHO_T}$lt_cv_objdir" >&6 -objdir=$lt_cv_objdir - - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; 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_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" - 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_AR" && ac_cv_prog_ac_ct_AR="false" -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -echo "${ECHO_T}$ac_ct_AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - AR=$ac_ct_AR -else - AR="$ac_cv_prog_AR" -fi - -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 - - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# 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_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_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_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_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 - -enable_dlopen=no -enable_win32_dll=no - -# 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 && enable_libtool_lock=yes - - -# 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 -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -lt_save_CC="$CC" -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 - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# -# Check for any special shared library compilation flags. -# -lt_prog_cc_shlib= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - lt_prog_cc_shlib='-belf' - ;; - esac -fi -if test -n "$lt_prog_cc_shlib"; then - { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 -if test "${lt_prog_compiler_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_prog_compiler_static" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - else - lt_prog_compiler_static_works=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 - -if test x"$lt_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' - - -echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6613: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:6617: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic='-qnocommon' - lt_prog_compiler_wl='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - pgcc | pgf77 | pgf90) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-static' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic='-Kpic' - lt_prog_compiler_static='-dn' - ;; - - solaris*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6868: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:6872: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 - -if test x"$lt_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6928: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:6932: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag= - enable_shared_with_static_runtimes=no - archive_cmds= - archive_expsym_cmds= - old_archive_From_new_cmds= - old_archive_from_expsyms_cmds= - export_dynamic_flag_spec= - whole_archive_flag_spec= - thread_safe_flag_spec= - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_direct=no - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - link_all_deplibs=unknown - hardcode_automatic=no - module_cmds= - module_expsym_cmds= - always_export_symbols=no - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds=$archive_cmds - fi - else - ld_shlibs=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec=' ' - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' - link_all_deplibs=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - ia64*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=no - hardcode_shlibpath_var=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - *) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld='-rpath $libdir' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag=' -z text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs" >&5 -echo "${ECHO_T}$ld_shlibs" >&6 -test "$ld_shlibs" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 -echo "${ECHO_T}$archive_cmds_need_lc" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var" || \ - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6 - -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* 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 shl_load (); -/* 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_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* 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 dlopen (); -/* 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_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# Report which librarie types wil actually be built -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler \ - CC \ - LD \ - lt_prog_compiler_wl \ - lt_prog_compiler_pic \ - lt_prog_compiler_static \ - lt_prog_compiler_no_builtin_flag \ - export_dynamic_flag_spec \ - thread_safe_flag_spec \ - whole_archive_flag_spec \ - enable_shared_with_static_runtimes \ - old_archive_cmds \ - old_archive_from_new_cmds \ - predep_objects \ - postdep_objects \ - predeps \ - postdeps \ - compiler_lib_search_path \ - archive_cmds \ - archive_expsym_cmds \ - postinstall_cmds \ - postuninstall_cmds \ - old_archive_from_expsyms_cmds \ - allow_undefined_flag \ - no_undefined_flag \ - export_symbols_cmds \ - hardcode_libdir_flag_spec \ - hardcode_libdir_flag_spec_ld \ - hardcode_libdir_separator \ - hardcode_automatic \ - module_cmds \ - module_expsym_cmds \ - lt_cv_prog_compiler_c_o \ - exclude_expsyms \ - include_expsyms; do - - case $var in - old_archive_cmds | \ - old_archive_from_new_cmds | \ - archive_cmds | \ - archive_expsym_cmds | \ - module_cmds | \ - module_expsym_cmds | \ - old_archive_from_expsyms_cmds | \ - export_symbols_cmds | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="${ofile}T" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - $rm -f "$cfgfile" - { echo "$as_me:$LINENO: creating $ofile" >&5 -echo "$as_me: creating $ofile" >&6;} - - cat <<__EOF__ >> "$cfgfile" -#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit , 1996 -# -# 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 of the License, 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU C compiler? -with_gcc=$GCC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# ### END LIBTOOL CONFIG - -__EOF__ - - - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - -# Check whether --with-tags or --without-tags was given. -if test "${with_tags+set}" = set; then - withval="$with_tags" - tagnames="$withval" -fi; - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 -echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} - else - { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 -echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in - "") ;; - *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 -echo "$as_me: error: invalid tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 -echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} - { (exit 1); exit 1; }; } - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_flag_spec_ld_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_automatic_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -compiler_CXX=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' -else - lt_prog_compiler_no_builtin_flag_CXX= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - -# 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 $CC" >&5 -echo $ECHO_N "checking for ld used by $CC... $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. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname 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 - 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 - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - 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. - case `"$lt_cv_path_LD" -v 2>&1 &5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -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. -case `$LD -v 2>&1 &5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 -ld_shlibs_CXX=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_CXX=yes - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_CXX=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_CXX='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' ${wl}-bernotok' - allow_undefined_flag_CXX=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_CXX=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX=' ' - archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs_CXX=no - fi - ;; - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='' - link_all_deplibs_CXX=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_CXX=no - ;; - esac - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - ld_shlibs_CXX=no - ;; - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - gnu*) - ;; - hpux9*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC) - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_CXX='+b $libdir' - hardcode_libdir_separator_CXX=: - ;; - ia64*) - hardcode_libdir_flag_spec_CXX='-L$libdir' - ;; - *) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC) - # Portland Group C++ compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - ;; - cxx) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - openbsd2*) - # C++ shared libraries are fairly broken - ld_shlibs_CXX=no - ;; - openbsd*) - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='${wl}-E' - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd='echo' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx) - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - sco*) - archive_cmds_need_lc_CXX=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - no_undefined_flag_CXX=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - archive_cmds_need_lc_CXX=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; -esac -echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6 -test "$ld_shlibs_CXX" = no && can_build_shared=no - -GCC_CXX="$GXX" -LD_CXX="$LD" - - -cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - # The `*' in the case matches for architectures that use `case' in - # $output_verbose_cmd can trigger glob expansion during the loop - # eval without this substitution. - output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" - - for p in `eval $output_verbose_link_cmd`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" \ - || test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX="${prev}${p}" - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX="${prev}${p}" - else - postdeps_CXX="${postdeps_CXX} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX="$p" - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX="$p" - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$rm -f confest.$objext - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - -lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic_CXX='-qnocommon' - lt_prog_compiler_wl_CXX='-Wl,' - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - icpc* | ecpc*) - # Intel C++ - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - pgCC) - # Portland Group C++ compiler. - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fpic' - lt_prog_compiler_static_CXX='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11446: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:11450: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_CXX=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 - -if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11506: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:11510: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX="$ltdll_cmds" - ;; - cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - -echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 -echo "${ECHO_T}$ld_shlibs_CXX" >&6 -test "$ld_shlibs_CXX" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_CXX=no - else - archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || \ - test -n "$runpath_var_CXX" || \ - test "X$hardcode_automatic_CXX" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 -echo "${ECHO_T}$hardcode_action_CXX" >&6 - -if test "$hardcode_action_CXX" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* 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 shl_load (); -/* 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_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* 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 dlopen (); -/* 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_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_CXX \ - CC_CXX \ - LD_CXX \ - lt_prog_compiler_wl_CXX \ - lt_prog_compiler_pic_CXX \ - lt_prog_compiler_static_CXX \ - lt_prog_compiler_no_builtin_flag_CXX \ - export_dynamic_flag_spec_CXX \ - thread_safe_flag_spec_CXX \ - whole_archive_flag_spec_CXX \ - enable_shared_with_static_runtimes_CXX \ - old_archive_cmds_CXX \ - old_archive_from_new_cmds_CXX \ - predep_objects_CXX \ - postdep_objects_CXX \ - predeps_CXX \ - postdeps_CXX \ - compiler_lib_search_path_CXX \ - archive_cmds_CXX \ - archive_expsym_cmds_CXX \ - postinstall_cmds_CXX \ - postuninstall_cmds_CXX \ - old_archive_from_expsyms_cmds_CXX \ - allow_undefined_flag_CXX \ - no_undefined_flag_CXX \ - export_symbols_cmds_CXX \ - hardcode_libdir_flag_spec_CXX \ - hardcode_libdir_flag_spec_ld_CXX \ - hardcode_libdir_separator_CXX \ - hardcode_automatic_CXX \ - module_cmds_CXX \ - module_expsym_cmds_CXX \ - lt_cv_prog_compiler_c_o_CXX \ - exclude_expsyms_CXX \ - include_expsyms_CXX; do - - case $var in - old_archive_cmds_CXX | \ - old_archive_from_new_cmds_CXX | \ - archive_cmds_CXX | \ - archive_expsym_cmds_CXX | \ - module_cmds_CXX | \ - module_expsym_cmds_CXX | \ - old_archive_from_expsyms_cmds_CXX | \ - export_symbols_cmds_CXX | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_CXX - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_CXX -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_CXX - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_CXX - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_CXX" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld - - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - -ac_ext=f -ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' -ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_f77_compiler_gnu - - -archive_cmds_need_lc_F77=no -allow_undefined_flag_F77= -always_export_symbols_F77=no -archive_expsym_cmds_F77= -export_dynamic_flag_spec_F77= -hardcode_direct_F77=no -hardcode_libdir_flag_spec_F77= -hardcode_libdir_flag_spec_ld_F77= -hardcode_libdir_separator_F77= -hardcode_minus_L_F77=no -hardcode_automatic_F77=no -module_cmds_F77= -module_expsym_cmds_F77= -link_all_deplibs_F77=unknown -old_archive_cmds_F77=$old_archive_cmds -no_undefined_flag_F77= -whole_archive_flag_spec_F77= -enable_shared_with_static_runtimes_F77=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -objext_F77=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code=" subroutine t\n return\n end\n" - -# Code to be used in simple link tests -lt_simple_link_test_code=" program t\n end\n" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${F77-"f77"} -compiler=$CC -compiler_F77=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; -aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no - ;; -esac -echo "$as_me:$LINENO: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:$LINENO: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:$LINENO: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 - -test "$ld_shlibs_F77" = no && can_build_shared=no - -GCC_F77="$G77" -LD_F77="$LD" - -lt_prog_compiler_wl_F77= -lt_prog_compiler_pic_F77= -lt_prog_compiler_static_F77= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_static_F77='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_F77='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_F77=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_F77=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_F77='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_F77='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_F77='-Bstatic' - else - lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic_F77='-qnocommon' - lt_prog_compiler_wl_F77='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_F77='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_F77='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_F77='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_F77='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_F77='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-static' - ;; - pgcc | pgf77 | pgf90) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-fpic' - lt_prog_compiler_static_F77='-static' - ;; - ccc*) - lt_prog_compiler_wl_F77='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_F77='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_F77='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_F77='-Kpic' - lt_prog_compiler_static_F77='-dn' - ;; - - solaris*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl_F77='-Qoption ld ' - lt_prog_compiler_pic_F77='-PIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_pic_F77='-KPIC' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_F77='-Kconform_pic' - lt_prog_compiler_static_F77='-Bstatic' - fi - ;; - - unicos*) - lt_prog_compiler_wl_F77='-Wl,' - lt_prog_compiler_can_build_shared_F77=no - ;; - - uts4*) - lt_prog_compiler_pic_F77='-pic' - lt_prog_compiler_static_F77='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_F77=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_F77"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_F77=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_F77" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13822: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:13826: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_F77=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 - -if test x"$lt_prog_compiler_pic_works_F77" = xyes; then - case $lt_prog_compiler_pic_F77 in - "" | " "*) ;; - *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; - esac -else - lt_prog_compiler_pic_F77= - lt_prog_compiler_can_build_shared_F77=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_F77= - ;; - *) - lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_F77=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13882: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:13886: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_F77=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag_F77= - enable_shared_with_static_runtimes_F77=no - archive_cmds_F77= - archive_expsym_cmds_F77= - old_archive_From_new_cmds_F77= - old_archive_from_expsyms_cmds_F77= - export_dynamic_flag_spec_F77= - whole_archive_flag_spec_F77= - thread_safe_flag_spec_F77= - hardcode_libdir_flag_spec_F77= - hardcode_libdir_flag_spec_ld_F77= - hardcode_libdir_separator_F77= - hardcode_direct_F77=no - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=unsupported - link_all_deplibs_F77=unknown - hardcode_automatic_F77=no - module_cmds_F77= - module_expsym_cmds_F77= - always_export_symbols_F77=no - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_F77= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_F77=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_F77=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_F77=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_F77='-L$libdir' - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=no - enable_shared_with_static_runtimes_F77=yes - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs_F77=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_F77=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - - sunos4*) - archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_F77='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_F77=$archive_cmds_F77 - fi - else - ld_shlibs_F77=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_F77=no - fi - ;; - esac - - if test "$ld_shlibs_F77" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_F77=unsupported - always_export_symbols_F77=yes - archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_F77=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_F77=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_F77='' - hardcode_direct_F77=yes - hardcode_libdir_separator_F77=':' - link_all_deplibs_F77=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_F77=yes - else - # We have old collect2 - hardcode_direct_F77=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_F77=yes - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_libdir_separator_F77= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_F77=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_F77='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_F77="-z nodefs" - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF - program main - - end -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_f77_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_F77=' ${wl}-bernotok' - allow_undefined_flag_F77=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_F77=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_F77=' ' - archive_cmds_need_lc_F77=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_F77=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_F77=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_F77=' ' - allow_undefined_flag_F77=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_F77='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path_F77='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_F77=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_F77='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_F77=no - hardcode_direct_F77=no - hardcode_automatic_F77=yes - hardcode_shlibpath_var_F77=unsupported - whole_archive_flag_spec_F77='' - link_all_deplibs_F77=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_F77=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - freebsd1*) - ld_shlibs_F77=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) - archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_F77='+b $libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - ;; - ia64*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - *) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=yes - export_dynamic_flag_spec_F77='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - link_all_deplibs_F77=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - newsos6) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - hardcode_shlibpath_var_F77=no - ;; - - openbsd*) - hardcode_direct_F77=yes - hardcode_shlibpath_var_F77=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - export_dynamic_flag_spec_F77='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-R$libdir' - ;; - *) - archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_minus_L_F77=yes - allow_undefined_flag_F77=unsupported - archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_F77=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_F77=' -expect_unresolved \*' - archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_F77='-rpath $libdir' - fi - hardcode_libdir_separator_F77=: - ;; - - sco3.2v5*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_F77=' -z text' - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_F77='-R$libdir' - hardcode_shlibpath_var_F77=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; - esac - link_all_deplibs_F77=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=yes - hardcode_minus_L_F77=yes - hardcode_shlibpath_var_F77=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_F77='$CC -r -o $output$reload_objs' - hardcode_direct_F77=no - ;; - motorola) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv4.3*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_F77=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=no - hardcode_shlibpath_var_F77=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_F77='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no - ;; - - sysv5*) - no_undefined_flag_F77=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_F77= - hardcode_shlibpath_var_F77=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_shlibpath_var_F77=no - ;; - - *) - ld_shlibs_F77=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 -echo "${ECHO_T}$ld_shlibs_F77" >&6 -test "$ld_shlibs_F77" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_F77" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_F77=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_F77 in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_F77 - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_F77 - allow_undefined_flag_F77= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_F77=no - else - archive_cmds_need_lc_F77=yes - fi - allow_undefined_flag_F77=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_F77= -if test -n "$hardcode_libdir_flag_spec_F77" || \ - test -n "$runpath_var_F77" || \ - test "X$hardcode_automatic_F77" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_F77" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && - test "$hardcode_minus_L_F77" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_F77=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_F77=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_F77=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 -echo "${ECHO_T}$hardcode_action_F77" >&6 - -if test "$hardcode_action_F77" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_F77 \ - CC_F77 \ - LD_F77 \ - lt_prog_compiler_wl_F77 \ - lt_prog_compiler_pic_F77 \ - lt_prog_compiler_static_F77 \ - lt_prog_compiler_no_builtin_flag_F77 \ - export_dynamic_flag_spec_F77 \ - thread_safe_flag_spec_F77 \ - whole_archive_flag_spec_F77 \ - enable_shared_with_static_runtimes_F77 \ - old_archive_cmds_F77 \ - old_archive_from_new_cmds_F77 \ - predep_objects_F77 \ - postdep_objects_F77 \ - predeps_F77 \ - postdeps_F77 \ - compiler_lib_search_path_F77 \ - archive_cmds_F77 \ - archive_expsym_cmds_F77 \ - postinstall_cmds_F77 \ - postuninstall_cmds_F77 \ - old_archive_from_expsyms_cmds_F77 \ - allow_undefined_flag_F77 \ - no_undefined_flag_F77 \ - export_symbols_cmds_F77 \ - hardcode_libdir_flag_spec_F77 \ - hardcode_libdir_flag_spec_ld_F77 \ - hardcode_libdir_separator_F77 \ - hardcode_automatic_F77 \ - module_cmds_F77 \ - module_expsym_cmds_F77 \ - lt_cv_prog_compiler_c_o_F77 \ - exclude_expsyms_F77 \ - include_expsyms_F77; do - - case $var in - old_archive_cmds_F77 | \ - old_archive_from_new_cmds_F77 | \ - archive_cmds_F77 | \ - archive_expsym_cmds_F77 | \ - module_cmds_F77 | \ - module_expsym_cmds_F77 | \ - old_archive_from_expsyms_cmds_F77 | \ - export_symbols_cmds_F77 | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_F77 - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_F77 - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_F77 - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_F77 - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_F77 - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_F77 -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_F77 - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_F77 -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_F77 -archive_expsym_cmds=$lt_archive_expsym_cmds_F77 -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_F77 -module_expsym_cmds=$lt_module_expsym_cmds_F77 - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_F77 - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_F77 - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_F77 - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_F77 - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_F77 - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_F77 - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_F77 - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_F77 - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_F77 - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_F77 - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_F77 - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_F77" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_F77 - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_F77 - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_F77 - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_F77 - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - - - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -objext_GCJ=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${GCJ-"gcj"} -compiler=$CC -compiler_GCJ=$CC - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -archive_cmds_need_lc_GCJ=no - - -lt_prog_compiler_no_builtin_flag_GCJ= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' - - -echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15938: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:15942: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" -else - : -fi - -fi - -lt_prog_compiler_wl_GCJ= -lt_prog_compiler_pic_GCJ= -lt_prog_compiler_static_GCJ= - -echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 - - if test "$GCC" = yes; then - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_static_GCJ='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_GCJ='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared_GCJ=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_GCJ=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - ;; - - *) - lt_prog_compiler_pic_GCJ='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl_GCJ='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GCJ='-Bstatic' - else - lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - lt_prog_compiler_pic_GCJ='-qnocommon' - lt_prog_compiler_wl_GCJ='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_GCJ='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_GCJ='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - newsos6) - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-static' - ;; - pgcc | pgf77 | pgf90) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-fpic' - lt_prog_compiler_static_GCJ='-static' - ;; - ccc*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_GCJ='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_GCJ='-non_shared' - ;; - - sco3.2v5*) - lt_prog_compiler_pic_GCJ='-Kpic' - lt_prog_compiler_static_GCJ='-dn' - ;; - - solaris*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sunos4*) - lt_prog_compiler_wl_GCJ='-Qoption ld ' - lt_prog_compiler_pic_GCJ='-PIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_pic_GCJ='-KPIC' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_GCJ='-Kconform_pic' - lt_prog_compiler_static_GCJ='-Bstatic' - fi - ;; - - unicos*) - lt_prog_compiler_wl_GCJ='-Wl,' - lt_prog_compiler_can_build_shared_GCJ=no - ;; - - uts4*) - lt_prog_compiler_pic_GCJ='-pic' - lt_prog_compiler_static_GCJ='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_GCJ=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_GCJ"; then - -echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 -if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_pic_works_GCJ=no - ac_outfile=conftest.$ac_objext - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_GCJ" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16193: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:16197: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - lt_prog_compiler_pic_works_GCJ=yes - fi - fi - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 -echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 - -if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then - case $lt_prog_compiler_pic_GCJ in - "" | " "*) ;; - *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; - esac -else - lt_prog_compiler_pic_GCJ= - lt_prog_compiler_can_build_shared_GCJ=no -fi - -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_GCJ= - ;; - *) - lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" - ;; -esac - -echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_compiler_c_o_GCJ=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16253: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:16257: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - lt_cv_prog_compiler_c_o_GCJ=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* - -fi -echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 -echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:$LINENO: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 - - runpath_var= - allow_undefined_flag_GCJ= - enable_shared_with_static_runtimes_GCJ=no - archive_cmds_GCJ= - archive_expsym_cmds_GCJ= - old_archive_From_new_cmds_GCJ= - old_archive_from_expsyms_cmds_GCJ= - export_dynamic_flag_spec_GCJ= - whole_archive_flag_spec_GCJ= - thread_safe_flag_spec_GCJ= - hardcode_libdir_flag_spec_GCJ= - hardcode_libdir_flag_spec_ld_GCJ= - hardcode_libdir_separator_GCJ= - hardcode_direct_GCJ=no - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=unsupported - link_all_deplibs_GCJ=unknown - hardcode_automatic_GCJ=no - module_cmds_GCJ= - module_expsym_cmds_GCJ= - always_export_symbols_GCJ=no - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_GCJ= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs_GCJ=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - ld_shlibs_GCJ=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_GCJ=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_GCJ='-L$libdir' - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=no - enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs_GCJ=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs_GCJ=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - - sunos4*) - archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - archive_cmds_GCJ='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_GCJ=$archive_cmds_GCJ - fi - else - ld_shlibs_GCJ=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GCJ=no - fi - ;; - esac - - if test "$ld_shlibs_GCJ" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_GCJ=unsupported - always_export_symbols_GCJ=yes - archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L_GCJ=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct_GCJ=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_GCJ='' - hardcode_direct_GCJ=yes - hardcode_libdir_separator_GCJ=':' - link_all_deplibs_GCJ=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct_GCJ=yes - else - # We have old collect2 - hardcode_direct_GCJ=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_GCJ=yes - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_libdir_separator_GCJ= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols_GCJ=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_GCJ='-berok' - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_GCJ="-z nodefs" - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - cat >conftest.$ac_ext <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_GCJ=' ${wl}-bernotok' - allow_undefined_flag_GCJ=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_GCJ=yes - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_GCJ=' ' - archive_cmds_need_lc_GCJ=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - # see comment about different semantics on the GNU ld section - ld_shlibs_GCJ=no - ;; - - bsdi[45]*) - export_dynamic_flag_spec_GCJ=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_GCJ=' ' - allow_undefined_flag_GCJ=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_From_new_cmds_GCJ='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_GCJ=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - archive_cmds_need_lc_GCJ=no - hardcode_direct_GCJ=no - hardcode_automatic_GCJ=yes - hardcode_shlibpath_var_GCJ=unsupported - whole_archive_flag_spec_GCJ='' - link_all_deplibs_GCJ=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - ld_shlibs_GCJ=no - ;; - esac - fi - ;; - - dgux*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - freebsd1*) - ld_shlibs_GCJ=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) - archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - ;; - ia64*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - *) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=yes - export_dynamic_flag_spec_GCJ='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - link_all_deplibs_GCJ=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - newsos6) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - hardcode_shlibpath_var_GCJ=no - ;; - - openbsd*) - hardcode_direct_GCJ=yes - hardcode_shlibpath_var_GCJ=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GCJ='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-R$libdir' - ;; - *) - archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_minus_L_GCJ=yes - allow_undefined_flag_GCJ=unsupported - archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GCJ=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_GCJ=' -expect_unresolved \*' - archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec_GCJ='-rpath $libdir' - fi - hardcode_libdir_separator_GCJ=: - ;; - - sco3.2v5*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag_GCJ=' -z text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - hardcode_libdir_flag_spec_GCJ='-R$libdir' - hardcode_shlibpath_var_GCJ=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; - esac - link_all_deplibs_GCJ=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=yes - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_GCJ='$CC -r -o $output$reload_objs' - hardcode_direct_GCJ=no - ;; - motorola) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv4.3*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_GCJ=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=no - hardcode_shlibpath_var_GCJ=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_GCJ='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no - ;; - - sysv5*) - no_undefined_flag_GCJ=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_GCJ= - hardcode_shlibpath_var_GCJ=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_shlibpath_var_GCJ=no - ;; - - *) - ld_shlibs_GCJ=no - ;; - esac - fi - -echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 -echo "${ECHO_T}$ld_shlibs_GCJ" >&6 -test "$ld_shlibs_GCJ" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_GCJ" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_GCJ=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_GCJ in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - $rm conftest* - printf "$lt_simple_compile_test_code" > 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); } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_GCJ - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ - allow_undefined_flag_GCJ= - if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - then - archive_cmds_need_lc_GCJ=no - else - archive_cmds_need_lc_GCJ=yes - fi - allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 -echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 - ;; - esac - fi - ;; -esac - -echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:$LINENO: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action_GCJ= -if test -n "$hardcode_libdir_flag_spec_GCJ" || \ - test -n "$runpath_var_GCJ" || \ - test "X$hardcode_automatic_GCJ" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct_GCJ" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && - test "$hardcode_minus_L_GCJ" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_GCJ=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_GCJ=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_GCJ=unsupported -fi -echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 -echo "${ECHO_T}$hardcode_action_GCJ" >&6 - -if test "$hardcode_action_GCJ" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* 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 shl_load (); -/* 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_shl_load) || defined (__stub___shl_load) -choke me -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* 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 dlopen (); -/* 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_dlopen) || defined (__stub___dlopen) -choke me -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - 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); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_GCJ \ - CC_GCJ \ - LD_GCJ \ - lt_prog_compiler_wl_GCJ \ - lt_prog_compiler_pic_GCJ \ - lt_prog_compiler_static_GCJ \ - lt_prog_compiler_no_builtin_flag_GCJ \ - export_dynamic_flag_spec_GCJ \ - thread_safe_flag_spec_GCJ \ - whole_archive_flag_spec_GCJ \ - enable_shared_with_static_runtimes_GCJ \ - old_archive_cmds_GCJ \ - old_archive_from_new_cmds_GCJ \ - predep_objects_GCJ \ - postdep_objects_GCJ \ - predeps_GCJ \ - postdeps_GCJ \ - compiler_lib_search_path_GCJ \ - archive_cmds_GCJ \ - archive_expsym_cmds_GCJ \ - postinstall_cmds_GCJ \ - postuninstall_cmds_GCJ \ - old_archive_from_expsyms_cmds_GCJ \ - allow_undefined_flag_GCJ \ - no_undefined_flag_GCJ \ - export_symbols_cmds_GCJ \ - hardcode_libdir_flag_spec_GCJ \ - hardcode_libdir_flag_spec_ld_GCJ \ - hardcode_libdir_separator_GCJ \ - hardcode_automatic_GCJ \ - module_cmds_GCJ \ - module_expsym_cmds_GCJ \ - lt_cv_prog_compiler_c_o_GCJ \ - exclude_expsyms_GCJ \ - include_expsyms_GCJ; do - - case $var in - old_archive_cmds_GCJ | \ - old_archive_from_new_cmds_GCJ | \ - archive_cmds_GCJ | \ - archive_expsym_cmds_GCJ | \ - module_cmds_GCJ | \ - module_expsym_cmds_GCJ | \ - old_archive_from_expsyms_cmds_GCJ | \ - export_symbols_cmds_GCJ | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_GCJ - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_GCJ - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_GCJ - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_GCJ - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_GCJ - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_GCJ -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_GCJ - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_GCJ -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_GCJ -archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_GCJ -module_expsym_cmds=$lt_module_expsym_cmds_GCJ - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_GCJ - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_GCJ - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_GCJ - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_GCJ - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_GCJ - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_GCJ - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_GCJ - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_GCJ - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_GCJ - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_GCJ - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_GCJ" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_GCJ - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_GCJ - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_GCJ - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_GCJ - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - else - tagname="" - fi - ;; - - RC) - - - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -objext_RC=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -CC=${RC-"windres"} -compiler=$CC -compiler_RC=$CC -lt_cv_prog_compiler_c_o_RC=yes - -# The else clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - # See if we are running on zsh, and set the options which allow our commands through - # without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS AS EGREP RANLIB LN_S LTCC NM \ - SED SHELL STRIP \ - libname_spec library_names_spec soname_spec extract_expsyms_cmds \ - old_striplib striplib file_magic_cmd finish_cmds finish_eval \ - deplibs_check_method reload_flag reload_cmds need_locks \ - lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ - lt_cv_sys_global_symbol_to_c_name_address \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - old_postinstall_cmds old_postuninstall_cmds \ - compiler_RC \ - CC_RC \ - LD_RC \ - lt_prog_compiler_wl_RC \ - lt_prog_compiler_pic_RC \ - lt_prog_compiler_static_RC \ - lt_prog_compiler_no_builtin_flag_RC \ - export_dynamic_flag_spec_RC \ - thread_safe_flag_spec_RC \ - whole_archive_flag_spec_RC \ - enable_shared_with_static_runtimes_RC \ - old_archive_cmds_RC \ - old_archive_from_new_cmds_RC \ - predep_objects_RC \ - postdep_objects_RC \ - predeps_RC \ - postdeps_RC \ - compiler_lib_search_path_RC \ - archive_cmds_RC \ - archive_expsym_cmds_RC \ - postinstall_cmds_RC \ - postuninstall_cmds_RC \ - old_archive_from_expsyms_cmds_RC \ - allow_undefined_flag_RC \ - no_undefined_flag_RC \ - export_symbols_cmds_RC \ - hardcode_libdir_flag_spec_RC \ - hardcode_libdir_flag_spec_ld_RC \ - hardcode_libdir_separator_RC \ - hardcode_automatic_RC \ - module_cmds_RC \ - module_expsym_cmds_RC \ - lt_cv_prog_compiler_c_o_RC \ - exclude_expsyms_RC \ - include_expsyms_RC; do - - case $var in - old_archive_cmds_RC | \ - old_archive_from_new_cmds_RC | \ - archive_cmds_RC | \ - archive_expsym_cmds_RC | \ - module_cmds_RC | \ - module_expsym_cmds_RC | \ - old_archive_from_expsyms_cmds_RC | \ - export_symbols_cmds_RC | \ - extract_expsyms_cmds | reload_cmds | finish_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case $lt_echo in - *'\$0 --fallback-echo"') - lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - -cfgfile="$ofile" - - cat <<__EOF__ >> "$cfgfile" -# ### BEGIN LIBTOOL TAG CONFIG: $tagname - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_RC - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_compiler_RC - -# Is the compiler the GNU C compiler? -with_gcc=$GCC_RC - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_LD_RC - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_RC - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_RC -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_RC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds_RC -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds_RC -archive_expsym_cmds=$lt_archive_expsym_cmds_RC -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_module_cmds_RC -module_expsym_cmds=$lt_module_expsym_cmds_RC - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_predep_objects_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_postdep_objects_RC - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_predeps_RC - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_postdeps_RC - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_RC - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_RC - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_RC - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_RC - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct_RC - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L_RC - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_RC - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$hardcode_automatic_RC - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_RC - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path_RC" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols_RC - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_RC - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_RC - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_RC - -# ### END LIBTOOL TAG CONFIG: $tagname - -__EOF__ - - -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -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 - -CC="$lt_save_CC" - - ;; - - *) - { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 -echo "$as_me: error: Unsupported tag name: $tagname" >&2;} - { (exit 1); exit 1; }; } - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 -echo "$as_me: error: unable to update list of available tagged configurations." >&2;} - { (exit 1); exit 1; }; } - fi -fi - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Prevent multiple expansion - - - - - - - - - - - - - - - - - - - - - -# Enable large file support. -# Check whether --enable-largefile or --disable-largefile was given. -if test "${enable_largefile+set}" = set; then - enableval="$enable_largefile" - -fi; -if test "$enable_largefile" != no; then - - echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 -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 - ac_save_CC=$CC - while :; do - # 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 <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext - CC="$CC -n32" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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'; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext - break - done - CC=$ac_save_CC - rm -f conftest.$ac_ext - fi -fi -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 "$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 - while :; do - ac_cv_sys_file_offset_bits=no - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define _FILE_OFFSET_BITS 64 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - break -done -fi -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 <<_ACEOF -#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits -_ACEOF - -fi -rm -f conftest* - 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 - while :; do - ac_cv_sys_large_files=no - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define _LARGE_FILES 1 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - break -done -fi -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 <<_ACEOF -#define _LARGE_FILES $ac_cv_sys_large_files -_ACEOF - -fi -rm -f conftest* -fi - - -# Autodetect whether to build Gnome VFS or not. -compile_gnome_vfs=false -if test "$enable_gnome_vfs" != "no"; then - # Make compilation work on SuSE 9.0. - if test -d "/opt/gnome"; then - export PKG_CONFIG_PATH="/opt/gnome/lib/pkgconfig" - fi - - succeeded=no - - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - fi - - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0" >&5 -echo $ECHO_N "checking for glib-2.0 gthread-2.0 gnome-vfs-module-2.0... $ECHO_C" >&6 - - if $PKG_CONFIG --exists "glib-2.0 gthread-2.0 gnome-vfs-module-2.0" ; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - succeeded=yes - - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_CFLAGS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_CFLAGS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_CFLAGS" >&6 - - echo "$as_me:$LINENO: checking LIBNTFS_GNOMEVFS_LIBS" >&5 -echo $ECHO_N "checking LIBNTFS_GNOMEVFS_LIBS... $ECHO_C" >&6 - LIBNTFS_GNOMEVFS_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - echo "$as_me:$LINENO: result: $LIBNTFS_GNOMEVFS_LIBS" >&5 -echo "${ECHO_T}$LIBNTFS_GNOMEVFS_LIBS" >&6 - else - LIBNTFS_GNOMEVFS_CFLAGS="" - LIBNTFS_GNOMEVFS_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - LIBNTFS_GNOMEVFS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "glib-2.0 gthread-2.0 gnome-vfs-module-2.0"` - - fi - - - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_gnome_vfs=true - else - - if test "$enable_gnome_vfs" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: error: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&5 -echo "$as_me: WARNING: Linux-NTFS Gnome VFS module requires glib-2.0 and gnome-vfs-module-2.0 libraries." >&2;} - fi - - fi - -fi - - -if $compile_gnome_vfs; then - ENABLE_GNOME_VFS_TRUE= - ENABLE_GNOME_VFS_FALSE='#' -else - ENABLE_GNOME_VFS_TRUE='#' - ENABLE_GNOME_VFS_FALSE= -fi - - -# Autodetect whether to build FUSE module or not. -compile_fuse_module=false -if test "$enable_fuse_module" != "no"; then - - succeeded=no - - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - 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_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - fi - - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for fuse >= 2.3.0" >&5 -echo $ECHO_N "checking for fuse >= 2.3.0... $ECHO_C" >&6 - - if $PKG_CONFIG --exists "fuse >= 2.3.0" ; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - succeeded=yes - - echo "$as_me:$LINENO: checking FUSE_MODULE_CFLAGS" >&5 -echo $ECHO_N "checking FUSE_MODULE_CFLAGS... $ECHO_C" >&6 - FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.3.0"` - echo "$as_me:$LINENO: result: $FUSE_MODULE_CFLAGS" >&5 -echo "${ECHO_T}$FUSE_MODULE_CFLAGS" >&6 - - echo "$as_me:$LINENO: checking FUSE_MODULE_LIBS" >&5 -echo $ECHO_N "checking FUSE_MODULE_LIBS... $ECHO_C" >&6 - FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.3.0"` - echo "$as_me:$LINENO: result: $FUSE_MODULE_LIBS" >&5 -echo "${ECHO_T}$FUSE_MODULE_LIBS" >&6 - else - FUSE_MODULE_CFLAGS="" - FUSE_MODULE_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fuse >= 2.3.0"` - - fi - - - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - compile_fuse_module=true - else - - if test "$enable_fuse_module" = "yes"; then - { { echo "$as_me:$LINENO: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 -echo "$as_me: error: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} - { (exit 1); exit 1; }; } - else - { echo "$as_me:$LINENO: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&5 -echo "$as_me: WARNING: Linux-NTFS FUSE module requires FUSE version >= 2.3.0." >&2;} - fi - - fi - -fi - - -if $compile_fuse_module; then - ENABLE_FUSE_MODULE_TRUE= - ENABLE_FUSE_MODULE_FALSE='#' -else - ENABLE_FUSE_MODULE_TRUE='#' - ENABLE_FUSE_MODULE_FALSE= -fi - - -# add --with-extra-includes and --with-extra-libs switch to ./configure -all_libraries="$all_libraries $USER_LDFLAGS" -all_includes="$all_includes $USER_INCLUDES" - - - -# Get compiler name -if test ! -z "$CC"; then - _cc="$CC" -else - _cc="gcc" -fi - -# Check for gcc version being >= 2.96. -echo "$as_me:$LINENO: checking version of $_cc" >&5 -echo $ECHO_N "checking version of $_cc... $ECHO_C" >&6 -cc_version=`$srcdir/getgccver $_cc` -cc_major=`echo $cc_version | cut -d'.' -f1` -cc_minor=`echo $cc_version | cut -d'.' -f2` -if test -z "$cc_version"; then - cc_version="v. ?.??" - cc_major=1 - cc_minor=1 -fi -if test $cc_major -lt 2 -o \( $cc_major -eq 2 -a $cc_minor -lt 96 \); then -cc_version="$cc_version, bad" -echo "$as_me:$LINENO: result: $cc_version" >&5 -echo "${ECHO_T}$cc_version" >&6 -{ { echo "$as_me:$LINENO: error: Please upgrade your gcc compiler to gcc-2.96+ or gcc-3+ version!\ - Earlier compiler versions will NOT work as these do not support \ -unnamed/annonymous structures and unions which are used heavily in linux-ntfs." >&5 -echo "$as_me: error: Please upgrade your gcc compiler to gcc-2.96+ or gcc-3+ version!\ - Earlier compiler versions will NOT work as these do not support \ -unnamed/annonymous structures and unions which are used heavily in linux-ntfs." >&2;} - { (exit 1); exit 1; }; } -fi -cc_version="$cc_version, ok" -echo "$as_me:$LINENO: result: $cc_version" >&5 -echo "${ECHO_T}$cc_version" >&6 - -# Add our compiler switches not discarding 'CFLAGS' as they may have been -# passed to us by rpmbuild(8). -# We add -Wall to enable some compiler warnings. -CFLAGS="$CFLAGS -Wall" - -# Add lots of extra warnings if --enable-warnings was specified. -if test "$enable_warnings" = "yes"; then - CFLAGS="$CFLAGS -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare" -fi - -# Add debugging switches if --enable-debug was specified. -if test "$enable_debug" = "yes"; then - CFLAGS="$CFLAGS -ggdb3 -DDEBUG" -fi - - - - - - - - - - - -# Checks for libraries. - -# Checks for header files. -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 <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f conftest.err 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 <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#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 - -#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 "$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 -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -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 <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -for ac_header in ctype.h fcntl.h libintl.h limits.h locale.h mntent.h \ - stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h strings.h \ - errno.h time.h unistd.h utime.h wchar.h getopt.h features.h endian.h \ - byteswap.h sys/byteorder.h sys/endian.h sys/param.h sys/ioctl.h \ - sys/mount.h sys/stat.h sys/types.h sys/vfs.h linux/major.h linux/fd.h \ - linux/hdreg.h machine/endian.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 -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 -/* 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 - ac_cpp_err=$ac_cpp_err$ac_c_werror_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:$ac_c_preproc_warn_flag 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 compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - 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: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## --------------------------------------------------- ## -## Report this to linux-ntfs-dev@lists.sourceforge.net ## -## --------------------------------------------------- ## -_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 - - -# Checks for typedefs, structures, and compiler characteristics. -echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 -echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6 -if test "${ac_cv_header_stdbool_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#ifndef bool -# error bool is not defined -#endif -#ifndef false -# error false is not defined -#endif -#if false -# error false is not 0 -#endif -#ifndef true -# error true is not defined -#endif -#if true != 1 -# error true is not 1 -#endif -#ifndef __bool_true_false_are_defined -# error __bool_true_false_are_defined is not defined -#endif - - struct s { _Bool s: 1; _Bool t; } s; - - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) -0.5 == true ? 1 : -1]; - bool e = &s; - char f[(_Bool) -0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; - -int -main () -{ - return !a + !b + !c + !d + !e + !f + !g + !h + !i; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_stdbool_h=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdbool_h=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 -echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6 -echo "$as_me:$LINENO: checking for _Bool" >&5 -echo $ECHO_N "checking for _Bool... $ECHO_C" >&6 -if test "${ac_cv_type__Bool+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((_Bool *) 0) - return 0; -if (sizeof (_Bool)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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__Bool=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type__Bool=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 -echo "${ECHO_T}$ac_cv_type__Bool" >&6 -if test $ac_cv_type__Bool = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE__BOOL 1 -_ACEOF - - -fi - -if test $ac_cv_header_stdbool_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_STDBOOL_H 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 -echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 -if test "${ac_cv_c_bigendian+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # See if sys/param.h defines the BYTE_ORDER macro. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN - bogus endian macros -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - # It does; now see whether it defined to BIG_ENDIAN or not. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_bigendian=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_c_bigendian=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -# It does not; compile a test program. -if test "$cross_compiling" = yes; then - # try to guess the endianness by grepping values into an object file - ac_cv_c_bigendian=unknown - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; -void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; -void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } -int -main () -{ - _ascii (); _ebcdic (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then - ac_cv_c_bigendian=yes -fi -if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi -fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -int -main () -{ - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long l; - char c[sizeof (long)]; - } u; - u.l = 1; - exit (u.c[sizeof (long) - 1] == 1); -} -_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_bigendian=no -else - 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_bigendian=yes -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 -echo "${ECHO_T}$ac_cv_c_bigendian" >&6 -case $ac_cv_c_bigendian in - yes) - -cat >>confdefs.h <<\_ACEOF -#define WORDS_BIGENDIAN 1 -_ACEOF - ;; - no) - -cat >>confdefs.h <<\_ACEOF -#define WORDS_LITTLEENDIAN 1 -_ACEOF - - ;; - *) - { { echo "$as_me:$LINENO: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&5 -echo "$as_me: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} - { (exit 1); exit 1; }; } ;; -esac - -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 <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -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 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_c_const=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -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 <<\_ACEOF -#define const -_ACEOF - -fi - -echo "$as_me:$LINENO: checking for inline" >&5 -echo $ECHO_N "checking for inline... $ECHO_C" >&6 -if test "${ac_cv_c_inline+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif - -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_inline=$ac_kw; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 -echo "${ECHO_T}$ac_cv_c_inline" >&6 - - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - -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 <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_off_t=no -fi -rm -f conftest.err 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 -_ACEOF - -fi - -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 <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_size_t=no -fi -rm -f conftest.err 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 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5 -echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6 -if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* 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_blocks) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_blocks=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -cat >conftest.$ac_ext <<_ACEOF -/* 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_blocks) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_blocks=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_member_struct_stat_st_blocks=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5 -echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6 -if test $ac_cv_member_struct_stat_st_blocks = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BLOCKS 1 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ST_BLOCKS 1 -_ACEOF - -else - case $LIBOBJS in - "fileblocks.$ac_objext" | \ - *" fileblocks.$ac_objext" | \ - "fileblocks.$ac_objext "* | \ - *" fileblocks.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext" ;; -esac - -fi - - -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 <<_ACEOF -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 -/* 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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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 - -ac_cv_member_struct_stat_st_rdev=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.err 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 - - -fi - - -# Checks for library functions. -# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware. -echo "$as_me:$LINENO: checking for getmntent in -lsun" >&5 -echo $ECHO_N "checking for getmntent in -lsun... $ECHO_C" >&6 -if test "${ac_cv_lib_sun_getmntent+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsun $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 getmntent (); -int -main () -{ -getmntent (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_sun_getmntent=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_sun_getmntent=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_sun_getmntent" >&5 -echo "${ECHO_T}$ac_cv_lib_sun_getmntent" >&6 -if test $ac_cv_lib_sun_getmntent = yes; then - LIBS="-lsun $LIBS" -else - echo "$as_me:$LINENO: checking for getmntent in -lseq" >&5 -echo $ECHO_N "checking for getmntent in -lseq... $ECHO_C" >&6 -if test "${ac_cv_lib_seq_getmntent+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lseq $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 getmntent (); -int -main () -{ -getmntent (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_seq_getmntent=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_seq_getmntent=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_seq_getmntent" >&5 -echo "${ECHO_T}$ac_cv_lib_seq_getmntent" >&6 -if test $ac_cv_lib_seq_getmntent = yes; then - LIBS="-lseq $LIBS" -else - echo "$as_me:$LINENO: checking for getmntent in -lgen" >&5 -echo $ECHO_N "checking for getmntent in -lgen... $ECHO_C" >&6 -if test "${ac_cv_lib_gen_getmntent+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgen $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 getmntent (); -int -main () -{ -getmntent (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_gen_getmntent=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_gen_getmntent=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_gen_getmntent" >&5 -echo "${ECHO_T}$ac_cv_lib_gen_getmntent" >&6 -if test $ac_cv_lib_gen_getmntent = yes; then - LIBS="-lgen $LIBS" -fi - -fi - -fi - - -for ac_func in getmntent -do -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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* 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 (); -/* 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 -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -fi -done - - - - echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5 -echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6 -if test "${ac_cv_func_mbrtowc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -mbstate_t state; return ! (sizeof state && mbrtowc); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func_mbrtowc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_mbrtowc=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_mbrtowc" >&5 -echo "${ECHO_T}$ac_cv_func_mbrtowc" >&6 - if test $ac_cv_func_mbrtowc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MBRTOWC 1 -_ACEOF - - fi - -echo "$as_me:$LINENO: checking for working memcmp" >&5 -echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 -if test "${ac_cv_func_memcmp_working+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_memcmp_working=no -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* Some versions of memcmp are not 8-bit clean. */ - char c0 = 0x40, c1 = 0x80, c2 = 0x81; - if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) - exit (1); - - /* The Next x86 OpenStep bug shows up only when comparing 16 bytes - or more and with at least one buffer not starting on a 4-byte boundary. - William Lewis provided this test program. */ - { - char foo[21]; - char bar[21]; - int i; - for (i = 0; i < 4; i++) - { - char *a = foo + i; - char *b = bar + i; - strcpy (a, "--------01111111"); - strcpy (b, "--------10000000"); - if (memcmp (a, b, 16) >= 0) - exit (1); - } - exit (0); - } - - ; - return 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 - ac_cv_func_memcmp_working=yes -else - 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_func_memcmp_working=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 -echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 -test $ac_cv_func_memcmp_working = no && case $LIBOBJS in - "memcmp.$ac_objext" | \ - *" memcmp.$ac_objext" | \ - "memcmp.$ac_objext "* | \ - *" memcmp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; -esac - - -echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 -echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6 -if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - rm -f conftest.sym conftest.file -echo >conftest.file -if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then - if test "$cross_compiling" = yes; then - ac_cv_func_lstat_dereferences_slashed_symlink=no -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -struct stat sbuf; - /* Linux will dereference the symlink and fail. - That is better in the sense that it means we will not - have to compile and use the lstat wrapper. */ - exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1); - ; - return 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 - ac_cv_func_lstat_dereferences_slashed_symlink=yes -else - 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_func_lstat_dereferences_slashed_symlink=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -else - # If the `ln -s' command failed, then we probably don't even - # have an lstat function. - ac_cv_func_lstat_dereferences_slashed_symlink=no -fi -rm -f conftest.sym conftest.file - -fi -echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 -echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6 - -test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && - -cat >>confdefs.h <<_ACEOF -#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 -_ACEOF - - -if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then - case $LIBOBJS in - "lstat.$ac_objext" | \ - *" lstat.$ac_objext" | \ - "lstat.$ac_objext "* | \ - *" lstat.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; -esac - -fi - -echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5 -echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6 -if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_stat_empty_string_bug=yes -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -struct stat sbuf; - exit (stat ("", &sbuf) ? 1 : 0); - ; - return 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 - ac_cv_func_stat_empty_string_bug=yes -else - 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_func_stat_empty_string_bug=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5 -echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6 -if test $ac_cv_func_stat_empty_string_bug = yes; then - case $LIBOBJS in - "stat.$ac_objext" | \ - *" stat.$ac_objext" | \ - "stat.$ac_objext "* | \ - *" stat.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; -esac - - -cat >>confdefs.h <<_ACEOF -#define HAVE_STAT_EMPTY_STRING_BUG 1 -_ACEOF - -fi - - -for ac_func in strftime -do -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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* 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 (); -/* 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 -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -else - # strftime is in -lintl on SCO UNIX. -echo "$as_me:$LINENO: checking for strftime in -lintl" >&5 -echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6 -if test "${ac_cv_lib_intl_strftime+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lintl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* 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 strftime (); -int -main () -{ -strftime (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_intl_strftime=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_intl_strftime=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5 -echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6 -if test $ac_cv_lib_intl_strftime = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_STRFTIME 1 -_ACEOF - -LIBS="-lintl $LIBS" -fi - -fi -done - -echo "$as_me:$LINENO: checking whether utime accepts a null argument" >&5 -echo $ECHO_N "checking whether utime accepts a null argument... $ECHO_C" >&6 -if test "${ac_cv_func_utime_null+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - rm -f conftest.data; >conftest.data -# Sequent interprets utime(file, 0) to mean use start of epoch. Wrong. -if test "$cross_compiling" = yes; then - ac_cv_func_utime_null=no -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -struct stat s, t; - exit (!(stat ("conftest.data", &s) == 0 - && utime ("conftest.data", (long *)0) == 0 - && stat ("conftest.data", &t) == 0 - && t.st_mtime >= s.st_mtime - && t.st_mtime - s.st_mtime < 120)); - ; - return 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 - ac_cv_func_utime_null=yes -else - 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_func_utime_null=no -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f core *.core -fi -echo "$as_me:$LINENO: result: $ac_cv_func_utime_null" >&5 -echo "${ECHO_T}$ac_cv_func_utime_null" >&6 -if test $ac_cv_func_utime_null = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_UTIME_NULL 1 -_ACEOF - -fi -rm -f conftest.data - - -for ac_func in vprintf -do -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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* 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 (); -/* 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 -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -echo "$as_me:$LINENO: checking for _doprnt" >&5 -echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 -if test "${ac_cv_func__doprnt+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define _doprnt to an innocuous variant, in case declares _doprnt. - For example, HP-UX 11i declares gettimeofday. */ -#define _doprnt innocuous__doprnt - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char _doprnt (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef _doprnt - -/* 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 _doprnt (); -/* 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__doprnt) || defined (__stub____doprnt) -choke me -#else -char (*f) () = _doprnt; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != _doprnt; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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_func__doprnt=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func__doprnt=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 -echo "${ECHO_T}$ac_cv_func__doprnt" >&6 -if test $ac_cv_func__doprnt = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_DOPRNT 1 -_ACEOF - -fi - -fi -done - - - - - - - - - - - - - - - - - - -for ac_func in atexit fdatasync hasmntopt memmove memset regcomp setlocale \ - strcasecmp strchr strdup strerror strtol strtoul utime mbsinit \ - setxattr -do -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 -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* 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 (); -/* 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 -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -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>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); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (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); }; } && - { 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.err 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 - -fi -done - - -# Makefiles to be created by configure. - ac_config_files="$ac_config_files Makefile doc/Makefile include/Makefile include/ntfs/Makefile libntfs/Makefile libntfs/libntfs.conf libntfs/libntfs-gnomevfs.8 ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfscp.8 ntfsprogs/ntfsfix.8 ntfsprogs/ntfsinfo.8 ntfsprogs/ntfslabel.8 ntfsprogs/ntfsls.8 ntfsprogs/ntfsmount.8 ntfsprogs/ntfsprogs.8 ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec" - -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 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# 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[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -DEFS=-DHAVE_CONFIG_H - -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 - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${REALLYSTATIC_TRUE}" && test -z "${REALLYSTATIC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"REALLYSTATIC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"REALLYSTATIC\" 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 -if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${ENABLE_GNOME_VFS_TRUE}" && test -z "${ENABLE_GNOME_VFS_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GNOME_VFS\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"ENABLE_GNOME_VFS\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${ENABLE_FUSE_MODULE_TRUE}" && test -z "${ENABLE_FUSE_MODULE_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"ENABLE_FUSE_MODULE\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"ENABLE_FUSE_MODULE\" 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. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -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 -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/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 -z "`(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:$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 - 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 - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval 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="eval 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 ntfsprogs $as_me 1.12.0-WIP, which was -generated by GNU Autoconf 2.59. 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 ." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -ntfsprogs config.status 1.12.0-WIP -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2003 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 - -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 - -_ACEOF - -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" ;; - "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; - "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; - "include/ntfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/ntfs/Makefile" ;; - "libntfs/Makefile" ) CONFIG_FILES="$CONFIG_FILES libntfs/Makefile" ;; - "libntfs/libntfs.conf" ) CONFIG_FILES="$CONFIG_FILES libntfs/libntfs.conf" ;; - "libntfs/libntfs-gnomevfs.8" ) CONFIG_FILES="$CONFIG_FILES libntfs/libntfs-gnomevfs.8" ;; - "ntfsprogs/Makefile" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/Makefile" ;; - "ntfsprogs/mkntfs.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/mkntfs.8" ;; - "ntfsprogs/ntfscat.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscat.8" ;; - "ntfsprogs/ntfsclone.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsclone.8" ;; - "ntfsprogs/ntfscluster.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscluster.8" ;; - "ntfsprogs/ntfscp.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscp.8" ;; - "ntfsprogs/ntfsfix.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsfix.8" ;; - "ntfsprogs/ntfsinfo.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsinfo.8" ;; - "ntfsprogs/ntfslabel.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfslabel.8" ;; - "ntfsprogs/ntfsls.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsls.8" ;; - "ntfsprogs/ntfsmount.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsmount.8" ;; - "ntfsprogs/ntfsprogs.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsprogs.8" ;; - "ntfsprogs/ntfsresize.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsresize.8" ;; - "ntfsprogs/ntfsundelete.8" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfsundelete.8" ;; - "ntfsprogs.spec" ) CONFIG_FILES="$CONFIG_FILES ntfsprogs.spec" ;; - "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 -} - -# Create a (secure) tmp directory for tmp files. - -{ - 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,@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,@target@,$target,;t t -s,@target_cpu@,$target_cpu,;t t -s,@target_vendor@,$target_vendor,;t t -s,@target_os@,$target_os,;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,@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,@mkdir_p@,$mkdir_p,;t t -s,@AWK@,$AWK,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@am__leading_dot@,$am__leading_dot,;t t -s,@AMTAR@,$AMTAR,;t t -s,@am__tar@,$am__tar,;t t -s,@am__untar@,$am__untar,;t t -s,@REALLYSTATIC_TRUE@,$REALLYSTATIC_TRUE,;t t -s,@REALLYSTATIC_FALSE@,$REALLYSTATIC_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,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@LN_S@,$LN_S,;t t -s,@ECHO@,$ECHO,;t t -s,@AR@,$AR,;t t -s,@ac_ct_AR@,$ac_ct_AR,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;t t -s,@ac_ct_CXX@,$ac_ct_CXX,;t t -s,@CXXDEPMODE@,$CXXDEPMODE,;t t -s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t -s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t -s,@CXXCPP@,$CXXCPP,;t t -s,@F77@,$F77,;t t -s,@FFLAGS@,$FFLAGS,;t t -s,@ac_ct_F77@,$ac_ct_F77,;t t -s,@LIBTOOL@,$LIBTOOL,;t t -s,@PKG_CONFIG@,$PKG_CONFIG,;t t -s,@LIBNTFS_GNOMEVFS_CFLAGS@,$LIBNTFS_GNOMEVFS_CFLAGS,;t t -s,@LIBNTFS_GNOMEVFS_LIBS@,$LIBNTFS_GNOMEVFS_LIBS,;t t -s,@ENABLE_GNOME_VFS_TRUE@,$ENABLE_GNOME_VFS_TRUE,;t t -s,@ENABLE_GNOME_VFS_FALSE@,$ENABLE_GNOME_VFS_FALSE,;t t -s,@FUSE_MODULE_CFLAGS@,$FUSE_MODULE_CFLAGS,;t t -s,@FUSE_MODULE_LIBS@,$FUSE_MODULE_LIBS,;t t -s,@ENABLE_FUSE_MODULE_TRUE@,$ENABLE_FUSE_MODULE_TRUE,;t t -s,@ENABLE_FUSE_MODULE_FALSE@,$ENABLE_FUSE_MODULE_FALSE,;t t -s,@all_includes@,$all_includes,;t t -s,@all_libraries@,$all_libraries,;t t -s,@AUTODIRS@,$AUTODIRS,;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" - -_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 - - # 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 - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - 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 - -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=' ' -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=',;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 - - | *:- | *:-:* ) # 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 - - 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; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - 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.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 <>$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 grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$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 $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 - 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 - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -# 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'` - { 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 - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac - - - { 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 - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. 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 " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/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 - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -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/configure.ac b/configure.ac index 66169e74..a0766ba5 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE +AM_MAINTAINER_MODE AM_ENABLE_SHARED AM_ENABLE_STATIC diff --git a/doc/Makefile.in b/doc/Makefile.in index ab7029cb..b2c97719 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -96,6 +96,9 @@ 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@ @@ -176,7 +179,7 @@ EXTRA_DIST = \ all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -201,9 +204,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh mostlyclean-libtool: diff --git a/include/Makefile.in b/include/Makefile.in index dbaff49f..c9b55559 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -105,6 +105,9 @@ 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@ @@ -175,7 +178,7 @@ SUBDIRS = ntfs all: all-recursive .SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -200,9 +203,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh mostlyclean-libtool: diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in index 0ce4b7bd..2c1cc5af 100644 --- a/include/ntfs/Makefile.in +++ b/include/ntfs/Makefile.in @@ -109,6 +109,9 @@ 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@ @@ -210,7 +213,7 @@ linux_ntfsinclude_HEADERS = \ all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -235,9 +238,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh mostlyclean-libtool: diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in index 3b73331f..4a8387d1 100644 --- a/libntfs/Makefile.in +++ b/libntfs/Makefile.in @@ -171,6 +171,9 @@ 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@ @@ -284,7 +287,7 @@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -309,9 +312,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh libntfs.conf: $(top_builddir)/config.status $(srcdir)/libntfs.conf.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in index d34ddafc..7380140c 100644 --- a/ntfsprogs/Makefile.in +++ b/ntfsprogs/Makefile.in @@ -223,6 +223,9 @@ 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@ @@ -373,7 +376,7 @@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -398,9 +401,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: $(am__configure_deps) +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh mkntfs.8: $(top_builddir)/config.status $(srcdir)/mkntfs.8.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ From 69f55f1ee55903b643e5d35e9cdda95ea3eb7282 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 29 Jul 2005 15:10:19 +0000 Subject: [PATCH 2412/2994] Remove all Makefile.in files and add them all to all .cvsignores. --- doc/.cvsignore | 1 + doc/Makefile.in | 341 --------------- include/.cvsignore | 1 + include/Makefile.in | 488 ---------------------- include/ntfs/.cvsignore | 1 + include/ntfs/Makefile.in | 440 -------------------- libntfs/.cvsignore | 1 + libntfs/Makefile.in | 702 ------------------------------- ntfsprogs/.cvsignore | 1 + ntfsprogs/Makefile.in | 872 --------------------------------------- 10 files changed, 5 insertions(+), 2843 deletions(-) delete mode 100644 doc/Makefile.in delete mode 100644 include/Makefile.in delete mode 100644 include/ntfs/Makefile.in delete mode 100644 libntfs/Makefile.in delete mode 100644 ntfsprogs/Makefile.in diff --git a/doc/.cvsignore b/doc/.cvsignore index f3c7a7c5..282522db 100644 --- a/doc/.cvsignore +++ b/doc/.cvsignore @@ -1 +1,2 @@ Makefile +Makefile.in diff --git a/doc/Makefile.in b/doc/Makefile.in deleted file mode 100644 index b2c97719..00000000 --- a/doc/Makefile.in +++ /dev/null @@ -1,341 +0,0 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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 = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = doc -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTODIRS = @AUTODIRS@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_FUSE_MODULE_FALSE = @ENABLE_FUSE_MODULE_FALSE@ -ENABLE_FUSE_MODULE_TRUE = @ENABLE_FUSE_MODULE_TRUE@ -ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ -ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@ -FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ -LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ -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@ -PKG_CONFIG = @PKG_CONFIG@ -RANLIB = @RANLIB@ -REALLYSTATIC_FALSE = @REALLYSTATIC_FALSE@ -REALLYSTATIC_TRUE = @REALLYSTATIC_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -all_includes = @all_includes@ -all_libraries = @all_libraries@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -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@ -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@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -EXTRA_DIST = \ - CodingStyle \ - attribute_definitions \ - attributes.txt \ - compression.txt \ - template.c \ - template.h \ - tunable_settings \ - system_files.txt \ - system_security_descriptors.txt - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu doc/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @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"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - 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 \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -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: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -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 - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-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-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 - -# 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/include/.cvsignore b/include/.cvsignore index f3c7a7c5..282522db 100644 --- a/include/.cvsignore +++ b/include/.cvsignore @@ -1 +1,2 @@ Makefile +Makefile.in diff --git a/include/Makefile.in b/include/Makefile.in deleted file mode 100644 index c9b55559..00000000 --- a/include/Makefile.in +++ /dev/null @@ -1,488 +0,0 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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 = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = include -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTODIRS = @AUTODIRS@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_FUSE_MODULE_FALSE = @ENABLE_FUSE_MODULE_FALSE@ -ENABLE_FUSE_MODULE_TRUE = @ENABLE_FUSE_MODULE_TRUE@ -ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ -ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@ -FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ -LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ -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@ -PKG_CONFIG = @PKG_CONFIG@ -RANLIB = @RANLIB@ -REALLYSTATIC_FALSE = @REALLYSTATIC_FALSE@ -REALLYSTATIC_TRUE = @REALLYSTATIC_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -all_includes = @all_includes@ -all_libraries = @all_libraries@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -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@ -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@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -SUBDIRS = ntfs -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu include/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @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"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - 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 \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -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: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ - clean clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am html \ - html-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-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive \ - mostlyclean mostlyclean-generic mostlyclean-libtool \ - mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am uninstall-info-am - -# 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/include/ntfs/.cvsignore b/include/ntfs/.cvsignore index f3c7a7c5..282522db 100644 --- a/include/ntfs/.cvsignore +++ b/include/ntfs/.cvsignore @@ -1 +1,2 @@ Makefile +Makefile.in diff --git a/include/ntfs/Makefile.in b/include/ntfs/Makefile.in deleted file mode 100644 index 2c1cc5af..00000000 --- a/include/ntfs/Makefile.in +++ /dev/null @@ -1,440 +0,0 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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 = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = include/ntfs -DIST_COMMON = $(linux_ntfsinclude_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(linux_ntfsincludedir)" -linux_ntfsincludeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(linux_ntfsinclude_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTODIRS = @AUTODIRS@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_FUSE_MODULE_FALSE = @ENABLE_FUSE_MODULE_FALSE@ -ENABLE_FUSE_MODULE_TRUE = @ENABLE_FUSE_MODULE_TRUE@ -ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ -ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@ -FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ -LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ -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@ -PKG_CONFIG = @PKG_CONFIG@ -RANLIB = @RANLIB@ -REALLYSTATIC_FALSE = @REALLYSTATIC_FALSE@ -REALLYSTATIC_TRUE = @REALLYSTATIC_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -all_includes = @all_includes@ -all_libraries = @all_libraries@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -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@ -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@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -linux_ntfsincludedir = $(includedir)/ntfs -linux_ntfsinclude_HEADERS = \ - attrib.h \ - attrlist.h \ - bitmap.h \ - bootsect.h \ - collate.h \ - compat.h \ - compress.h \ - debug.h \ - device.h \ - device_io.h \ - dir.h \ - endians.h \ - gnome-vfs-method.h \ - gnome-vfs-module.h \ - index.h \ - inode.h \ - layout.h \ - lcnalloc.h \ - list.h \ - logfile.h \ - mft.h \ - mst.h \ - runlist.h \ - security.h \ - support.h \ - timeconv.h \ - types.h \ - unistr.h \ - volume.h - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/ntfs/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu include/ntfs/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -install-linux_ntfsincludeHEADERS: $(linux_ntfsinclude_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(linux_ntfsincludedir)" || $(mkdir_p) "$(DESTDIR)$(linux_ntfsincludedir)" - @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(linux_ntfsincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(linux_ntfsincludedir)/$$f'"; \ - $(linux_ntfsincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ - done - -uninstall-linux_ntfsincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(linux_ntfsinclude_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(linux_ntfsincludedir)/$$f'"; \ - rm -f "$(DESTDIR)$(linux_ntfsincludedir)/$$f"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @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"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - 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 \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(linux_ntfsincludedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -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: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-linux_ntfsincludeHEADERS - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -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-linux_ntfsincludeHEADERS - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-linux_ntfsincludeHEADERS install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-linux_ntfsincludeHEADERS - -# 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/libntfs/.cvsignore b/libntfs/.cvsignore index 8480fb78..0843e907 100644 --- a/libntfs/.cvsignore +++ b/libntfs/.cvsignore @@ -1,6 +1,7 @@ .deps .libs Makefile +Makefile.in libntfs-gnomevfs.8 libntfs-gnomevfs.la libntfs.conf diff --git a/libntfs/Makefile.in b/libntfs/Makefile.in deleted file mode 100644 index 4a8387d1..00000000 --- a/libntfs/Makefile.in +++ /dev/null @@ -1,702 +0,0 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# -# Before making a release, the LTVERSION string should be modified. -# The string is of the form CURRENT:REVISION:AGE. -# -# CURRENT (C) -# The most recent interface number that this library implements. -# -# REVISION (R) -# The implementation number that this library implements. -# -# AGE (A) -# The difference between the newest and oldest interfaces that this -# library implements. In other works, the library implements all the -# interface numbers in the range from number 'CURRENT - AGE' to -# 'CURRENT'. -# -# This means that: -# -# - If interfaces have been changed or added, but binary compatibility has -# been preserved, change to C+1:0:A+1 -# -# - If binary compatibility has been broken (eg removed or changed -# interfaces) change to C+1:0:0 -# -# - If the interface is the same as the previous version, change to C:R+1:A -# - - -SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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 = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = libntfs -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/libntfs-gnomevfs.8.in $(srcdir)/libntfs.conf.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = libntfs.conf libntfs-gnomevfs.8 -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(gnomevfsmoduleslibdir)" \ - "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man8dir)" \ - "$(DESTDIR)$(gnomevfsmodulesconfdir)" -gnomevfsmoduleslibLTLIBRARIES_INSTALL = $(INSTALL) -libLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(gnomevfsmoduleslib_LTLIBRARIES) $(lib_LTLIBRARIES) -libntfs_gnomevfs_la_DEPENDENCIES = libntfs.la -am_libntfs_gnomevfs_la_OBJECTS = \ - libntfs_gnomevfs_la-gnome-vfs-method.lo \ - libntfs_gnomevfs_la-gnome-vfs-module.lo -libntfs_gnomevfs_la_OBJECTS = $(am_libntfs_gnomevfs_la_OBJECTS) -@ENABLE_GNOME_VFS_TRUE@am_libntfs_gnomevfs_la_rpath = -rpath \ -@ENABLE_GNOME_VFS_TRUE@ $(gnomevfsmoduleslibdir) -libntfs_la_LIBADD = -am_libntfs_la_OBJECTS = attrib.lo attrlist.lo bitmap.lo bootsect.lo \ - collate.lo compat.lo compress.lo debug.lo device.lo \ - device_io.lo dir.lo index.lo inode.lo lcnalloc.lo logfile.lo \ - mft.lo mst.lo runlist.lo security.lo unistr.lo volume.lo -libntfs_la_OBJECTS = $(am_libntfs_la_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) -DIST_SOURCES = $(libntfs_gnomevfs_la_SOURCES) $(libntfs_la_SOURCES) -man8dir = $(mandir)/man8 -NROFF = nroff -MANS = $(man_MANS) -gnomevfsmodulesconfDATA_INSTALL = $(INSTALL_DATA) -DATA = $(gnomevfsmodulesconf_DATA) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTODIRS = @AUTODIRS@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_FUSE_MODULE_FALSE = @ENABLE_FUSE_MODULE_FALSE@ -ENABLE_FUSE_MODULE_TRUE = @ENABLE_FUSE_MODULE_TRUE@ -ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ -ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@ -FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ -LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ -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@ -PKG_CONFIG = @PKG_CONFIG@ -RANLIB = @RANLIB@ -REALLYSTATIC_FALSE = @REALLYSTATIC_FALSE@ -REALLYSTATIC_TRUE = @REALLYSTATIC_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -all_includes = @all_includes@ -all_libraries = @all_libraries@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -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@ -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@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -LTVERSION_LIBNTFS = 7:0:0 -LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 -linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs -lib_LTLIBRARIES = libntfs.la -libntfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS) -libntfs_la_SOURCES = \ - attrib.c \ - attrlist.c \ - bitmap.c \ - bootsect.c \ - collate.c \ - compat.c \ - compress.c \ - debug.c \ - device.c \ - device_io.c \ - dir.c \ - index.c \ - inode.c \ - lcnalloc.c \ - logfile.c \ - mft.c \ - mst.c \ - runlist.c \ - security.c \ - unistr.c \ - volume.c - -@ENABLE_GNOME_VFS_TRUE@gnomevfsmoduleslibdir = $(libdir)/gnome-vfs-2.0/modules -@ENABLE_GNOME_VFS_TRUE@gnomevfsmoduleslib_LTLIBRARIES = libntfs-gnomevfs.la -@ENABLE_GNOME_VFS_TRUE@gnomevfsmodulesconfdir = $(sysconfdir)/gnome-vfs-2.0/modules -@ENABLE_GNOME_VFS_TRUE@gnomevfsmodulesconf_DATA = libntfs.conf -libntfs_gnomevfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS_GNOMEVFS) -libntfs_gnomevfs_la_LIBADD = libntfs.la -libntfs_gnomevfs_la_LIBS = $(LIBNTFS_GNOMEVFS_LIBS) -libntfs_gnomevfs_la_CFLAGS = $(LIBNTFS_GNOMEVFS_CFLAGS) -libntfs_gnomevfs_la_SOURCES = \ - gnome-vfs-method.c \ - gnome-vfs-module.c - -man_MANS = libntfs-gnomevfs.8 -AM_CPPFLAGS = $(linux_ntfsincludedir) $(all_includes) -EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libntfs/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu libntfs/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -libntfs.conf: $(top_builddir)/config.status $(srcdir)/libntfs.conf.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -libntfs-gnomevfs.8: $(top_builddir)/config.status $(srcdir)/libntfs-gnomevfs.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -install-gnomevfsmoduleslibLTLIBRARIES: $(gnomevfsmoduleslib_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(gnomevfsmoduleslibdir)" || $(mkdir_p) "$(DESTDIR)$(gnomevfsmoduleslibdir)" - @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gnomevfsmoduleslibdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(gnomevfsmoduleslibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gnomevfsmoduleslibdir)/$$f"; \ - else :; fi; \ - done - -uninstall-gnomevfsmoduleslibLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(gnomevfsmoduleslibdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(gnomevfsmoduleslibdir)/$$p"; \ - done - -clean-gnomevfsmoduleslibLTLIBRARIES: - -test -z "$(gnomevfsmoduleslib_LTLIBRARIES)" || rm -f $(gnomevfsmoduleslib_LTLIBRARIES) - @list='$(gnomevfsmoduleslib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libntfs-gnomevfs.la: $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_DEPENDENCIES) - $(LINK) $(am_libntfs_gnomevfs_la_rpath) $(libntfs_gnomevfs_la_LDFLAGS) $(libntfs_gnomevfs_la_OBJECTS) $(libntfs_gnomevfs_la_LIBADD) $(LIBS) -libntfs.la: $(libntfs_la_OBJECTS) $(libntfs_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libntfs_la_LDFLAGS) $(libntfs_la_OBJECTS) $(libntfs_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attrib.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attrlist.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bootsect.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/collate.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compat.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compress.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device_io.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/index.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inode.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lcnalloc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logfile.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mft.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mst.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runlist.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/security.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unistr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volume.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libntfs_gnomevfs_la-gnome-vfs-method.lo: gnome-vfs-method.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-method.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-method.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-method.c' object='libntfs_gnomevfs_la-gnome-vfs-method.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-method.lo `test -f 'gnome-vfs-method.c' || echo '$(srcdir)/'`gnome-vfs-method.c - -libntfs_gnomevfs_la-gnome-vfs-module.lo: gnome-vfs-module.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -MT libntfs_gnomevfs_la-gnome-vfs-module.lo -MD -MP -MF "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo" "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Plo"; else rm -f "$(DEPDIR)/libntfs_gnomevfs_la-gnome-vfs-module.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnome-vfs-module.c' object='libntfs_gnomevfs_la-gnome-vfs-module.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_gnomevfs_la_CFLAGS) $(CFLAGS) -c -o libntfs_gnomevfs_la-gnome-vfs-module.lo `test -f 'gnome-vfs-module.c' || echo '$(srcdir)/'`gnome-vfs-module.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -install-man8: $(man8_MANS) $(man_MANS) - @$(NORMAL_INSTALL) - test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)" - @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ - l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ - for i in $$l2; do \ - case "$$i" in \ - *.8*) 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/^.*\\.//'`; \ - case "$$ext" in \ - 8*) ;; \ - *) ext='8' ;; \ - esac; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed -e 's/^.*\///'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \ - done -uninstall-man8: - @$(NORMAL_UNINSTALL) - @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ - l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ - for i in $$l2; do \ - case "$$i" in \ - *.8*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 8*) ;; \ - *) ext='8' ;; \ - esac; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed -e 's/^.*\///'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \ - rm -f "$(DESTDIR)$(man8dir)/$$inst"; \ - done -install-gnomevfsmodulesconfDATA: $(gnomevfsmodulesconf_DATA) - @$(NORMAL_INSTALL) - test -z "$(gnomevfsmodulesconfdir)" || $(mkdir_p) "$(DESTDIR)$(gnomevfsmodulesconfdir)" - @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(gnomevfsmodulesconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f'"; \ - $(gnomevfsmodulesconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ - done - -uninstall-gnomevfsmodulesconfDATA: - @$(NORMAL_UNINSTALL) - @list='$(gnomevfsmodulesconf_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f'"; \ - rm -f "$(DESTDIR)$(gnomevfsmodulesconfdir)/$$f"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @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"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - 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 \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(MANS) $(DATA) -installdirs: - for dir in "$(DESTDIR)$(gnomevfsmoduleslibdir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(gnomevfsmodulesconfdir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -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: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-gnomevfsmoduleslibLTLIBRARIES \ - clean-libLTLIBRARIES clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-gnomevfsmodulesconfDATA \ - install-gnomevfsmoduleslibLTLIBRARIES install-man - -install-exec-am: install-libLTLIBRARIES - -install-info: install-info-am - -install-man: install-man8 - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-gnomevfsmodulesconfDATA \ - uninstall-gnomevfsmoduleslibLTLIBRARIES uninstall-info-am \ - uninstall-libLTLIBRARIES uninstall-man - -uninstall-man: uninstall-man8 - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-gnomevfsmoduleslibLTLIBRARIES clean-libLTLIBRARIES \ - clean-libtool ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-exec install-exec-am \ - install-gnomevfsmodulesconfDATA \ - install-gnomevfsmoduleslibLTLIBRARIES install-info \ - install-info-am install-libLTLIBRARIES install-man \ - install-man8 install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-gnomevfsmodulesconfDATA \ - uninstall-gnomevfsmoduleslibLTLIBRARIES uninstall-info-am \ - uninstall-libLTLIBRARIES uninstall-man uninstall-man8 - - -libs: $(lib_LTLIBRARIES) -# 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/ntfsprogs/.cvsignore b/ntfsprogs/.cvsignore index 118fb495..b3458673 100644 --- a/ntfsprogs/.cvsignore +++ b/ntfsprogs/.cvsignore @@ -1,6 +1,7 @@ .deps .libs Makefile +Makefile.in mkntfs ntfscat ntfsclone diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in deleted file mode 100644 index 7380140c..00000000 --- a/ntfsprogs/Makefile.in +++ /dev/null @@ -1,872 +0,0 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) $(ntfsdecrypt_SOURCES) $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) $(ntfsmftalloc_SOURCES) $(ntfsmount_SOURCES) $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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 = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \ - ntfsls$(EXEEXT) ntfscat$(EXEEXT) $(am__EXEEXT_1) -sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) \ - ntfsundelete$(EXEEXT) ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) \ - ntfscp$(EXEEXT) -EXTRA_PROGRAMS = ntfsdump_logfile$(EXEEXT) ntfswipe$(EXEEXT) \ - ntfstruncate$(EXEEXT) ntfsmove$(EXEEXT) ntfsrm$(EXEEXT) \ - ntfsmftalloc$(EXEEXT) ntfsdecrypt$(EXEEXT) -@ENABLE_FUSE_MODULE_TRUE@am__append_1 = ntfsmount -subdir = ntfsprogs -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/mkntfs.8.in $(srcdir)/ntfscat.8.in \ - $(srcdir)/ntfsclone.8.in $(srcdir)/ntfscluster.8.in \ - $(srcdir)/ntfscp.8.in $(srcdir)/ntfsfix.8.in \ - $(srcdir)/ntfsinfo.8.in $(srcdir)/ntfslabel.8.in \ - $(srcdir)/ntfsls.8.in $(srcdir)/ntfsmount.8.in \ - $(srcdir)/ntfsprogs.8.in $(srcdir)/ntfsresize.8.in \ - $(srcdir)/ntfsundelete.8.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \ - ntfscp.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 ntfsmount.8 \ - ntfsprogs.8 ntfsresize.8 ntfsundelete.8 -@ENABLE_FUSE_MODULE_TRUE@am__EXEEXT_1 = ntfsmount$(EXEEXT) -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \ - "$(DESTDIR)$(man8dir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS) -am_mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \ - sd.$(OBJEXT) mkntfs.$(OBJEXT) utils.$(OBJEXT) -mkntfs_OBJECTS = $(am_mkntfs_OBJECTS) -@REALLYSTATIC_FALSE@am__DEPENDENCIES_1 = \ -@REALLYSTATIC_FALSE@ $(top_builddir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@am__DEPENDENCIES_1 = \ -@REALLYSTATIC_TRUE@ $(top_builddir)/libntfs/.libs/libntfs.a -mkntfs_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfscat_OBJECTS = ntfscat.$(OBJEXT) utils.$(OBJEXT) -ntfscat_OBJECTS = $(am_ntfscat_OBJECTS) -ntfscat_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfsclone_OBJECTS = ntfsclone.$(OBJEXT) utils.$(OBJEXT) -ntfsclone_OBJECTS = $(am_ntfsclone_OBJECTS) -ntfsclone_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) cluster.$(OBJEXT) \ - utils.$(OBJEXT) -ntfscluster_OBJECTS = $(am_ntfscluster_OBJECTS) -ntfscluster_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfscp_OBJECTS = ntfscp.$(OBJEXT) utils.$(OBJEXT) -ntfscp_OBJECTS = $(am_ntfscp_OBJECTS) -ntfscp_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfsdecrypt_OBJECTS = ntfsdecrypt.$(OBJEXT) decrypt.$(OBJEXT) \ - utils.$(OBJEXT) -ntfsdecrypt_OBJECTS = $(am_ntfsdecrypt_OBJECTS) -ntfsdecrypt_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfsdump_logfile_OBJECTS = ntfsdump_logfile.$(OBJEXT) -ntfsdump_logfile_OBJECTS = $(am_ntfsdump_logfile_OBJECTS) -ntfsdump_logfile_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) utils.$(OBJEXT) -ntfsfix_OBJECTS = $(am_ntfsfix_OBJECTS) -ntfsfix_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) utils.$(OBJEXT) -ntfsinfo_OBJECTS = $(am_ntfsinfo_OBJECTS) -ntfsinfo_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) utils.$(OBJEXT) -ntfslabel_OBJECTS = $(am_ntfslabel_OBJECTS) -ntfslabel_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfsls_OBJECTS = ntfsls.$(OBJEXT) utils.$(OBJEXT) -ntfsls_OBJECTS = $(am_ntfsls_OBJECTS) -ntfsls_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfsmftalloc_OBJECTS = ntfsmftalloc.$(OBJEXT) utils.$(OBJEXT) -ntfsmftalloc_OBJECTS = $(am_ntfsmftalloc_OBJECTS) -ntfsmftalloc_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__ntfsmount_SOURCES_DIST = ntfsmount.c utils.c utils.h -@ENABLE_FUSE_MODULE_TRUE@am_ntfsmount_OBJECTS = \ -@ENABLE_FUSE_MODULE_TRUE@ ntfsmount-ntfsmount.$(OBJEXT) \ -@ENABLE_FUSE_MODULE_TRUE@ ntfsmount-utils.$(OBJEXT) -ntfsmount_OBJECTS = $(am_ntfsmount_OBJECTS) -am__DEPENDENCIES_2 = -@ENABLE_FUSE_MODULE_TRUE@ntfsmount_DEPENDENCIES = \ -@ENABLE_FUSE_MODULE_TRUE@ $(am__DEPENDENCIES_1) \ -@ENABLE_FUSE_MODULE_TRUE@ $(am__DEPENDENCIES_2) -am_ntfsmove_OBJECTS = ntfsmove.$(OBJEXT) utils.$(OBJEXT) -ntfsmove_OBJECTS = $(am_ntfsmove_OBJECTS) -ntfsmove_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) utils.$(OBJEXT) -ntfsresize_OBJECTS = $(am_ntfsresize_OBJECTS) -ntfsresize_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfsrm_OBJECTS = ntfsrm.$(OBJEXT) utils.$(OBJEXT) -ntfsrm_OBJECTS = $(am_ntfsrm_OBJECTS) -ntfsrm_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfstruncate_OBJECTS = attrdef.$(OBJEXT) ntfstruncate.$(OBJEXT) \ - utils.$(OBJEXT) -ntfstruncate_OBJECTS = $(am_ntfstruncate_OBJECTS) -ntfstruncate_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfsundelete_OBJECTS = ntfsundelete.$(OBJEXT) utils.$(OBJEXT) -ntfsundelete_OBJECTS = $(am_ntfsundelete_OBJECTS) -ntfsundelete_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) utils.$(OBJEXT) -ntfswipe_OBJECTS = $(am_ntfswipe_OBJECTS) -ntfswipe_DEPENDENCIES = $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsclone_SOURCES) \ - $(ntfscluster_SOURCES) $(ntfscp_SOURCES) \ - $(ntfsdecrypt_SOURCES) $(ntfsdump_logfile_SOURCES) \ - $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) \ - $(ntfsls_SOURCES) $(ntfsmftalloc_SOURCES) $(ntfsmount_SOURCES) \ - $(ntfsmove_SOURCES) $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ - $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ - $(ntfswipe_SOURCES) -DIST_SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) \ - $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscp_SOURCES) \ - $(ntfsdecrypt_SOURCES) $(ntfsdump_logfile_SOURCES) \ - $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) \ - $(ntfsls_SOURCES) $(ntfsmftalloc_SOURCES) \ - $(am__ntfsmount_SOURCES_DIST) $(ntfsmove_SOURCES) \ - $(ntfsresize_SOURCES) $(ntfsrm_SOURCES) \ - $(ntfstruncate_SOURCES) $(ntfsundelete_SOURCES) \ - $(ntfswipe_SOURCES) -man8dir = $(mandir)/man8 -NROFF = nroff -MANS = $(man_MANS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTODIRS = @AUTODIRS@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ENABLE_FUSE_MODULE_FALSE = @ENABLE_FUSE_MODULE_FALSE@ -ENABLE_FUSE_MODULE_TRUE = @ENABLE_FUSE_MODULE_TRUE@ -ENABLE_GNOME_VFS_FALSE = @ENABLE_GNOME_VFS_FALSE@ -ENABLE_GNOME_VFS_TRUE = @ENABLE_GNOME_VFS_TRUE@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@ -FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBNTFS_GNOMEVFS_CFLAGS = @LIBNTFS_GNOMEVFS_CFLAGS@ -LIBNTFS_GNOMEVFS_LIBS = @LIBNTFS_GNOMEVFS_LIBS@ -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@ -PKG_CONFIG = @PKG_CONFIG@ -RANLIB = @RANLIB@ -REALLYSTATIC_FALSE = @REALLYSTATIC_FALSE@ -REALLYSTATIC_TRUE = @REALLYSTATIC_TRUE@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -all_includes = @all_includes@ -all_libraries = @all_libraries@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -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@ -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@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -@REALLYSTATIC_FALSE@AM_LIBS = $(top_builddir)/libntfs/libntfs.la -@REALLYSTATIC_TRUE@AM_LIBS = $(top_builddir)/libntfs/.libs/libntfs.a -@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries) -@REALLYSTATIC_TRUE@AM_LFLAGS = -static -@REALLYSTATIC_TRUE@STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -@REALLYSTATIC_FALSE@LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ - -# Workaround to make REALLYSTATIC work with automake 1.5. -LINK = $(STATIC_LINK) $(LIBTOOL_LINK) -man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ - ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ - ntfsclone.8 ntfscluster.8 ntfscat.8 ntfscp.8 \ - ntfsmount.8 - -EXTRA_MANS = -CLEANFILES = $(EXTRA_PROGRAMS) -linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs - -# Set the include path. -AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs $(all_includes) -ntfsfix_SOURCES = ntfsfix.c utils.c utils.h -ntfsfix_LDADD = $(AM_LIBS) -ntfsfix_LDFLAGS = $(AM_LFLAGS) -mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c utils.c utils.h -mkntfs_LDADD = $(AM_LIBS) -mkntfs_LDFLAGS = $(AM_LFLAGS) -ntfslabel_SOURCES = ntfslabel.c utils.c utils.h -ntfslabel_LDADD = $(AM_LIBS) -ntfslabel_LDFLAGS = $(AM_LFLAGS) -ntfsinfo_SOURCES = ntfsinfo.c utils.c utils.h -ntfsinfo_LDADD = $(AM_LIBS) -ntfsinfo_LDFLAGS = $(AM_LFLAGS) -ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h utils.c utils.h -ntfsundelete_LDADD = $(AM_LIBS) -ntfsundelete_LDFLAGS = $(AM_LFLAGS) -ntfsresize_SOURCES = ntfsresize.c utils.c utils.h -ntfsresize_LDADD = $(AM_LIBS) -ntfsresize_LDFLAGS = $(AM_LFLAGS) -ntfsclone_SOURCES = ntfsclone.c utils.c utils.h -ntfsclone_LDADD = $(AM_LIBS) -ntfsclone_LDFLAGS = $(AM_LFLAGS) -ntfscluster_SOURCES = ntfscluster.c ntfscluster.h cluster.c cluster.h utils.c utils.h -ntfscluster_LDADD = $(AM_LIBS) -ntfscluster_LDFLAGS = $(AM_LFLAGS) -ntfsls_SOURCES = ntfsls.c utils.c utils.h -ntfsls_LDADD = $(AM_LIBS) -ntfsls_LDFLAGS = $(AM_LFLAGS) -ntfscat_SOURCES = ntfscat.c ntfscat.h utils.c utils.h -ntfscat_LDADD = $(AM_LIBS) -ntfscat_LDFLAGS = $(AM_LFLAGS) -ntfscp_SOURCES = ntfscp.c utils.c utils.h -ntfscp_LDADD = $(AM_LIBS) -ntfscp_LDFLAGS = $(AM_LFLAGS) -@ENABLE_FUSE_MODULE_TRUE@ntfsmount_SOURCES = ntfsmount.c utils.c utils.h -@ENABLE_FUSE_MODULE_TRUE@ntfsmount_LDADD = $(AM_LIBS) $(FUSE_MODULE_LIBS) -@ENABLE_FUSE_MODULE_TRUE@ntfsmount_LDFLAGS = $(AM_LFLAGS) -@ENABLE_FUSE_MODULE_TRUE@ntfsmount_CFLAGS = $(FUSE_MODULE_CFLAGS) -DFUSE_USE_VERSION=22 - -# We don't distribute these -ntfsdecrypt_SOURCES = ntfsdecrypt.c decrypt.c decrypt.h utils.c utils.h -ntfsdecrypt_LDADD = $(AM_LIBS) -ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt -ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h -ntfsrm_LDADD = $(AM_LIBS) -ntfsrm_LDFLAGS = $(AM_LFLAGS) -ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h -ntfstruncate_LDADD = $(AM_LIBS) -ntfstruncate_LDFLAGS = $(AM_LFLAGS) -ntfsmftalloc_SOURCES = ntfsmftalloc.c utils.c utils.h -ntfsmftalloc_LDADD = $(AM_LIBS) -ntfsmftalloc_LDFLAGS = $(AM_LFLAGS) -ntfsmove_SOURCES = ntfsmove.c ntfsmove.h utils.c utils.h -ntfsmove_LDADD = $(AM_LIBS) -ntfsmove_LDFLAGS = $(AM_LFLAGS) -ntfswipe_SOURCES = ntfswipe.c ntfswipe.h utils.c utils.h -ntfswipe_LDADD = $(AM_LIBS) -ntfswipe_LDFLAGS = $(AM_LFLAGS) -ntfsdump_logfile_SOURCES = ntfsdump_logfile.c -ntfsdump_logfile_LDADD = $(AM_LIBS) -ntfsdump_logfile_LDFLAGS = $(AM_LFLAGS) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ntfsprogs/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu ntfsprogs/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -mkntfs.8: $(top_builddir)/config.status $(srcdir)/mkntfs.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfscat.8: $(top_builddir)/config.status $(srcdir)/ntfscat.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsclone.8: $(top_builddir)/config.status $(srcdir)/ntfsclone.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfscluster.8: $(top_builddir)/config.status $(srcdir)/ntfscluster.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfscp.8: $(top_builddir)/config.status $(srcdir)/ntfscp.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsfix.8: $(top_builddir)/config.status $(srcdir)/ntfsfix.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsinfo.8: $(top_builddir)/config.status $(srcdir)/ntfsinfo.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfslabel.8: $(top_builddir)/config.status $(srcdir)/ntfslabel.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsls.8: $(top_builddir)/config.status $(srcdir)/ntfsls.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsmount.8: $(top_builddir)/config.status $(srcdir)/ntfsmount.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsprogs.8: $(top_builddir)/config.status $(srcdir)/ntfsprogs.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsresize.8: $(top_builddir)/config.status $(srcdir)/ntfsresize.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -ntfsundelete.8: $(top_builddir)/config.status $(srcdir)/ntfsundelete.8.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -install-sbinPROGRAMS: $(sbin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)" - @list='$(sbin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-sbinPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(sbin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \ - rm -f "$(DESTDIR)$(sbindir)/$$f"; \ - done - -clean-sbinPROGRAMS: - @list='$(sbin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -mkntfs$(EXEEXT): $(mkntfs_OBJECTS) $(mkntfs_DEPENDENCIES) - @rm -f mkntfs$(EXEEXT) - $(LINK) $(mkntfs_LDFLAGS) $(mkntfs_OBJECTS) $(mkntfs_LDADD) $(LIBS) -ntfscat$(EXEEXT): $(ntfscat_OBJECTS) $(ntfscat_DEPENDENCIES) - @rm -f ntfscat$(EXEEXT) - $(LINK) $(ntfscat_LDFLAGS) $(ntfscat_OBJECTS) $(ntfscat_LDADD) $(LIBS) -ntfsclone$(EXEEXT): $(ntfsclone_OBJECTS) $(ntfsclone_DEPENDENCIES) - @rm -f ntfsclone$(EXEEXT) - $(LINK) $(ntfsclone_LDFLAGS) $(ntfsclone_OBJECTS) $(ntfsclone_LDADD) $(LIBS) -ntfscluster$(EXEEXT): $(ntfscluster_OBJECTS) $(ntfscluster_DEPENDENCIES) - @rm -f ntfscluster$(EXEEXT) - $(LINK) $(ntfscluster_LDFLAGS) $(ntfscluster_OBJECTS) $(ntfscluster_LDADD) $(LIBS) -ntfscp$(EXEEXT): $(ntfscp_OBJECTS) $(ntfscp_DEPENDENCIES) - @rm -f ntfscp$(EXEEXT) - $(LINK) $(ntfscp_LDFLAGS) $(ntfscp_OBJECTS) $(ntfscp_LDADD) $(LIBS) -ntfsdecrypt$(EXEEXT): $(ntfsdecrypt_OBJECTS) $(ntfsdecrypt_DEPENDENCIES) - @rm -f ntfsdecrypt$(EXEEXT) - $(LINK) $(ntfsdecrypt_LDFLAGS) $(ntfsdecrypt_OBJECTS) $(ntfsdecrypt_LDADD) $(LIBS) -ntfsdump_logfile$(EXEEXT): $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_DEPENDENCIES) - @rm -f ntfsdump_logfile$(EXEEXT) - $(LINK) $(ntfsdump_logfile_LDFLAGS) $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_LDADD) $(LIBS) -ntfsfix$(EXEEXT): $(ntfsfix_OBJECTS) $(ntfsfix_DEPENDENCIES) - @rm -f ntfsfix$(EXEEXT) - $(LINK) $(ntfsfix_LDFLAGS) $(ntfsfix_OBJECTS) $(ntfsfix_LDADD) $(LIBS) -ntfsinfo$(EXEEXT): $(ntfsinfo_OBJECTS) $(ntfsinfo_DEPENDENCIES) - @rm -f ntfsinfo$(EXEEXT) - $(LINK) $(ntfsinfo_LDFLAGS) $(ntfsinfo_OBJECTS) $(ntfsinfo_LDADD) $(LIBS) -ntfslabel$(EXEEXT): $(ntfslabel_OBJECTS) $(ntfslabel_DEPENDENCIES) - @rm -f ntfslabel$(EXEEXT) - $(LINK) $(ntfslabel_LDFLAGS) $(ntfslabel_OBJECTS) $(ntfslabel_LDADD) $(LIBS) -ntfsls$(EXEEXT): $(ntfsls_OBJECTS) $(ntfsls_DEPENDENCIES) - @rm -f ntfsls$(EXEEXT) - $(LINK) $(ntfsls_LDFLAGS) $(ntfsls_OBJECTS) $(ntfsls_LDADD) $(LIBS) -ntfsmftalloc$(EXEEXT): $(ntfsmftalloc_OBJECTS) $(ntfsmftalloc_DEPENDENCIES) - @rm -f ntfsmftalloc$(EXEEXT) - $(LINK) $(ntfsmftalloc_LDFLAGS) $(ntfsmftalloc_OBJECTS) $(ntfsmftalloc_LDADD) $(LIBS) -ntfsmount$(EXEEXT): $(ntfsmount_OBJECTS) $(ntfsmount_DEPENDENCIES) - @rm -f ntfsmount$(EXEEXT) - $(LINK) $(ntfsmount_LDFLAGS) $(ntfsmount_OBJECTS) $(ntfsmount_LDADD) $(LIBS) -ntfsmove$(EXEEXT): $(ntfsmove_OBJECTS) $(ntfsmove_DEPENDENCIES) - @rm -f ntfsmove$(EXEEXT) - $(LINK) $(ntfsmove_LDFLAGS) $(ntfsmove_OBJECTS) $(ntfsmove_LDADD) $(LIBS) -ntfsresize$(EXEEXT): $(ntfsresize_OBJECTS) $(ntfsresize_DEPENDENCIES) - @rm -f ntfsresize$(EXEEXT) - $(LINK) $(ntfsresize_LDFLAGS) $(ntfsresize_OBJECTS) $(ntfsresize_LDADD) $(LIBS) -ntfsrm$(EXEEXT): $(ntfsrm_OBJECTS) $(ntfsrm_DEPENDENCIES) - @rm -f ntfsrm$(EXEEXT) - $(LINK) $(ntfsrm_LDFLAGS) $(ntfsrm_OBJECTS) $(ntfsrm_LDADD) $(LIBS) -ntfstruncate$(EXEEXT): $(ntfstruncate_OBJECTS) $(ntfstruncate_DEPENDENCIES) - @rm -f ntfstruncate$(EXEEXT) - $(LINK) $(ntfstruncate_LDFLAGS) $(ntfstruncate_OBJECTS) $(ntfstruncate_LDADD) $(LIBS) -ntfsundelete$(EXEEXT): $(ntfsundelete_OBJECTS) $(ntfsundelete_DEPENDENCIES) - @rm -f ntfsundelete$(EXEEXT) - $(LINK) $(ntfsundelete_LDFLAGS) $(ntfsundelete_OBJECTS) $(ntfsundelete_LDADD) $(LIBS) -ntfswipe$(EXEEXT): $(ntfswipe_OBJECTS) $(ntfswipe_DEPENDENCIES) - @rm -f ntfswipe$(EXEEXT) - $(LINK) $(ntfswipe_LDFLAGS) $(ntfswipe_OBJECTS) $(ntfswipe_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attrdef.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boot.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cluster.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decrypt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkntfs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscat.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsclone.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscluster.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsdecrypt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsdump_logfile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsfix.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsinfo.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfslabel.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsls.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmftalloc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmount-ntfsmount.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmount-utils.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsmove.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsresize.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsrm.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfstruncate.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsundelete.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfswipe.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sd.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upcase.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -ntfsmount-ntfsmount.o: ntfsmount.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -MT ntfsmount-ntfsmount.o -MD -MP -MF "$(DEPDIR)/ntfsmount-ntfsmount.Tpo" -c -o ntfsmount-ntfsmount.o `test -f 'ntfsmount.c' || echo '$(srcdir)/'`ntfsmount.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ntfsmount-ntfsmount.Tpo" "$(DEPDIR)/ntfsmount-ntfsmount.Po"; else rm -f "$(DEPDIR)/ntfsmount-ntfsmount.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfsmount.c' object='ntfsmount-ntfsmount.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -c -o ntfsmount-ntfsmount.o `test -f 'ntfsmount.c' || echo '$(srcdir)/'`ntfsmount.c - -ntfsmount-ntfsmount.obj: ntfsmount.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -MT ntfsmount-ntfsmount.obj -MD -MP -MF "$(DEPDIR)/ntfsmount-ntfsmount.Tpo" -c -o ntfsmount-ntfsmount.obj `if test -f 'ntfsmount.c'; then $(CYGPATH_W) 'ntfsmount.c'; else $(CYGPATH_W) '$(srcdir)/ntfsmount.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ntfsmount-ntfsmount.Tpo" "$(DEPDIR)/ntfsmount-ntfsmount.Po"; else rm -f "$(DEPDIR)/ntfsmount-ntfsmount.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfsmount.c' object='ntfsmount-ntfsmount.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -c -o ntfsmount-ntfsmount.obj `if test -f 'ntfsmount.c'; then $(CYGPATH_W) 'ntfsmount.c'; else $(CYGPATH_W) '$(srcdir)/ntfsmount.c'; fi` - -ntfsmount-utils.o: utils.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -MT ntfsmount-utils.o -MD -MP -MF "$(DEPDIR)/ntfsmount-utils.Tpo" -c -o ntfsmount-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ntfsmount-utils.Tpo" "$(DEPDIR)/ntfsmount-utils.Po"; else rm -f "$(DEPDIR)/ntfsmount-utils.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='ntfsmount-utils.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -c -o ntfsmount-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c - -ntfsmount-utils.obj: utils.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -MT ntfsmount-utils.obj -MD -MP -MF "$(DEPDIR)/ntfsmount-utils.Tpo" -c -o ntfsmount-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ntfsmount-utils.Tpo" "$(DEPDIR)/ntfsmount-utils.Po"; else rm -f "$(DEPDIR)/ntfsmount-utils.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='ntfsmount-utils.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsmount_CFLAGS) $(CFLAGS) -c -o ntfsmount-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi` - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -install-man8: $(man8_MANS) $(man_MANS) - @$(NORMAL_INSTALL) - test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)" - @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ - l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ - for i in $$l2; do \ - case "$$i" in \ - *.8*) 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/^.*\\.//'`; \ - case "$$ext" in \ - 8*) ;; \ - *) ext='8' ;; \ - esac; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed -e 's/^.*\///'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \ - done -uninstall-man8: - @$(NORMAL_UNINSTALL) - @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ - l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ - for i in $$l2; do \ - case "$$i" in \ - *.8*) list="$$list $$i" ;; \ - esac; \ - done; \ - for i in $$list; do \ - ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 8*) ;; \ - *) ext='8' ;; \ - esac; \ - inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ - inst=`echo $$inst | sed -e 's/^.*\///'`; \ - inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \ - rm -f "$(DESTDIR)$(man8dir)/$$inst"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @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"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - 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 \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) $(MANS) -installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -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: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic clean-libtool \ - clean-sbinPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-man - -install-exec-am: install-binPROGRAMS install-sbinPROGRAMS - -install-info: install-info-am - -install-man: install-man8 - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man \ - uninstall-sbinPROGRAMS - -uninstall-man: uninstall-man8 - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool clean-sbinPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-binPROGRAMS install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-man8 install-sbinPROGRAMS \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-info-am uninstall-man \ - uninstall-man8 uninstall-sbinPROGRAMS - - -# Extra targets - -strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) - $(STRIP) $^ - -extra: extras - -extras: $(EXTRA_PROGRAMS) -# 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: From 62f87128ad0341b0e45d4a1dd5b15fba9177c51f Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 29 Jul 2005 15:35:55 +0000 Subject: [PATCH 2413/2994] Remove Makefile.in and configure with make maintainer-clean. --- Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.am b/Makefile.am index 9761f71d..2bdea771 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,6 +7,8 @@ EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ AUTOMAKE_OPTIONS = gnu +MAINTAINERCLEANFILES = configure Makefile.in + dist-hook: ntfsprogs.spec cp ntfsprogs.spec $(distdir) From 304f060a763f1bb00b1380f8aac4e35fa9bdb5d4 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 29 Jul 2005 15:51:49 +0000 Subject: [PATCH 2414/2994] Add all Makefile.in to maintainer-clean target. --- doc/Makefile.am | 1 + include/Makefile.am | 2 ++ include/ntfs/Makefile.am | 1 + libntfs/Makefile.am | 2 ++ ntfsprogs/Makefile.am | 2 ++ 5 files changed, 8 insertions(+) diff --git a/doc/Makefile.am b/doc/Makefile.am index e7f51f0d..725ac632 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -9,3 +9,4 @@ EXTRA_DIST = \ system_files.txt \ system_security_descriptors.txt +MAINTAINERCLEANFILES = Makefile.in diff --git a/include/Makefile.am b/include/Makefile.am index 88bf3dd5..a1499a9a 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1 +1,3 @@ SUBDIRS = ntfs + +MAINTAINERCLEANFILES = Makefile.in diff --git a/include/ntfs/Makefile.am b/include/ntfs/Makefile.am index 48c565d4..2d8951c4 100644 --- a/include/ntfs/Makefile.am +++ b/include/ntfs/Makefile.am @@ -31,3 +31,4 @@ linux_ntfsinclude_HEADERS = \ unistr.h \ volume.h +MAINTAINERCLEANFILES = Makefile.in diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index d88a0d8e..04018d53 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -80,5 +80,7 @@ AM_CPPFLAGS = $(linux_ntfsincludedir) $(all_includes) EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in +MAINTAINERCLEANFILES = Makefile.in + libs: $(lib_LTLIBRARIES) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 61648e44..e74bf4de 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -25,6 +25,8 @@ EXTRA_MANS = CLEANFILES = $(EXTRA_PROGRAMS) +MAINTAINERCLEANFILES = Makefile.in + linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs if ENABLE_FUSE_MODULE From 49e3b9ac9ffccfb8f5e61d7864f304b9d9925a0f Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 29 Jul 2005 19:42:04 +0000 Subject: [PATCH 2415/2994] aclocal.m4 is autogenerated file too --- aclocal.m4 | 6968 ---------------------------------------------------- 1 file changed, 6968 deletions(-) delete mode 100644 aclocal.m4 diff --git a/aclocal.m4 b/aclocal.m4 deleted file mode 100644 index 61f101aa..00000000 --- a/aclocal.m4 +++ /dev/null @@ -1,6968 +0,0 @@ -# generated automatically by aclocal 1.9.5 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005 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. - -# 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. - -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- - -# serial 47 AC_PROG_LIBTOOL - - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# 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 And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -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_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Prevent multiple expansion -define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL - - -# AC_LIBTOOL_SETUP -# ---------------- -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)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 - -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -_LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] - -# Same as above, but do not quote variable references. -[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# 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_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -enable_win32_dll=yes, enable_win32_dll=no) - -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP - - -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER - - -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX - - -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT - - -# _LT_AC_PROG_ECHO_BACKSLASH -# -------------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -echo=${ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null 2>&1 && unset CDPATH - -if test -z "$ECHO"; then -if test "X${echo_test_string+set}" != Xset; then -# find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if (echo_test_string="`eval $cmd`") 2>/dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - 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 - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - 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_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - 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 - ;; -AC_PROVIDE_IFELSE([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) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_REQUIRE([LT_AC_PROG_SED]) -AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for *BSD - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - ;; - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ - = "XX$teststring") >/dev/null 2>&1 && - new_result=`expr "X$teststring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - teststring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - - -# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ------------------------------------------------------------------ -AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -}] -EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_unknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_AC_TRY_DLOPEN_SELF - - -# AC_LIBTOOL_DLOPEN_SELF -# ------------------- -AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -])# AC_LIBTOOL_DLOPEN_SELF - - -# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) -# --------------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler -AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . - $rm conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files - $rm out/* && rmdir out - cd .. - rmdir conftest - $rm conftest* -]) -])# AC_LIBTOOL_PROG_CC_C_O - - -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- -# Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - -hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS - - -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR - - -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- -# Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existant directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) -fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP - - -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- -# PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -knetbsd*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# 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_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# 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], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# 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_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# 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], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# 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_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# 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], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# 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_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# 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_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [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]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -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_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -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 - IFS="$lt_save_ifs" - 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 <&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="$lt_save_ifs" - MAGIC_CMD="$lt_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_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$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_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AC_HELP_STRING([--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([LT_AC_PROG_SED])dnl -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 $CC]) - 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. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname 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 - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - 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. - case `"$lt_cv_path_LD" -v 2>&1 &1 /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|DragonFly)/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_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - 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_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - 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 - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - 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*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the pathname to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - 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 - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - 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 - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_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* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL 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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL 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, lt_dlinit, - [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 - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([_LT_AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) -])# _LT_AC_LANG_CXX - -# _LT_AC_PROG_CXXCPP -# --------------- -AC_DEFUN([_LT_AC_PROG_CXXCPP], -[ -AC_REQUIRE([AC_PROG_CXX]) -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -fi -])# _LT_AC_PROG_CXXCPP - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[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])])])])])]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# -------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -# Report which librarie types wil actually be built -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([_LT_AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes ; then - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[[12]]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC) - # Portland Group C++ compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - ;; - cxx) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - openbsd2*) - # C++ shared libraries are fairly broken - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd='echo' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit , 1996 -# -# 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 of the License, 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) - -# Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$lt_STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS=$lt_AS - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext_cmds='$shrext_cmds' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) - -# Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" - -# Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) - -# The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) - -# Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) - -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) - -__EOF__ - -ifelse([$1],[], [ - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` - if test -f "$ltmain_in"; then - test -f Makefile && make "$ltmain" - fi -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -linux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDGIRSTW]]' - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDRT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc* | ecpc*) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC) - # Portland Group C++ compiler. - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - darwin*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - case "$cc_basename" in - xlc*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $cc_basename in - icc* | ecc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgcc | pgf77 | pgf90) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - ccc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - unicos*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_addflag= - case $CC,$host_cpu in - pgf77* | pgf90* ) # Portland Group f77 and f90 compilers - tmp_addflag=' -fpic' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - esac - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - supports_anon_versioning=no - case `$LD -v 2>/dev/null` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - if test $supports_anon_versioning = yes; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~ -cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ -$echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)=$_LT_AC_TAGVAR(archive_cmds, $1) - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi[[45]]*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup' - ;; - esac - fi - ;; - esac - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - if test "$GCC" = yes ; then - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - case "$cc_basename" in - xlc*) - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - ;; - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu | dragonfly*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C - - -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) - - -# 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]) - -# This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL]) - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -# LT_AC_PROG_SED -# -------------- -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -AC_DEFUN([LT_AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_MSG_RESULT([$SED]) -]) - - -dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) -dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page -dnl also defines GSTUFF_PKG_ERRORS on error -AC_DEFUN([PKG_CHECK_MODULES], [ - succeeded=no - - if test -z "$PKG_CONFIG"; then - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - fi - - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - AC_MSG_CHECKING(for $2) - - if $PKG_CONFIG --exists "$2" ; then - AC_MSG_RESULT(yes) - succeeded=yes - - AC_MSG_CHECKING($1_CFLAGS) - $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` - AC_MSG_RESULT($$1_CFLAGS) - - AC_MSG_CHECKING($1_LIBS) - $1_LIBS=`$PKG_CONFIG --libs "$2"` - AC_MSG_RESULT($$1_LIBS) - else - $1_CFLAGS="" - $1_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - ifelse([$4], ,echo $$1_PKG_ERRORS,) - fi - - AC_SUBST($1_CFLAGS) - AC_SUBST($1_LIBS) - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - ifelse([$3], , :, [$3]) - else - ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) - fi -]) - - - -# Copyright (C) 2002, 2003, 2005 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. - -# 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.9"]) - -# 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.9.5])]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001, 2003, 2005 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. - -# 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. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 -# 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. - -# serial 7 - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - 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])]) - - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# 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. - -# serial 8 - -# 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 - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch 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 - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' 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 build - --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 (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# 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. - -#serial 3 - -# _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 - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. 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 " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/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"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# 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. - -# serial 12 - -# 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. - -# 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_PREREQ([2.58])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -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 - -# 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_PROG_INSTALL_SH -AM_PROG_INSTALL_STRIP -AC_REQUIRE([AM_PROG_MKDIR_P])dnl -# 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([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_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 (C) 2001, 2003, 2005 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. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -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)]) - -# Copyright (C) 2003, 2005 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. - -# serial 2 - -# 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])]) - -# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- -# From Jim Meyering - -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 -# 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. - -# serial 4 - -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]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005 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. - -# serial 3 - -# 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 -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 -# 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. - -# serial 4 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[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 - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# Copyright (C) 2003, 2004, 2005 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. - -# AM_PROG_MKDIR_P -# --------------- -# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. -# -# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories -# created by `make install' are always world readable, even if the -# installer happens to have an overly restrictive umask (e.g. 077). -# This was a mistake. There are at least two reasons why we must not -# use `-m 0755': -# - it causes special bits like SGID to be ignored, -# - it may be too restrictive (some setups expect 775 directories). -# -# Do not use -m 0755 and let people choose whatever they expect by -# setting umask. -# -# We cannot accept any implementation of `mkdir' that recognizes `-p'. -# Some implementations (such as Solaris 8's) are not thread-safe: if a -# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' -# concurrently, both version can detect that a/ is missing, but only -# one can create it and the other will error out. Consequently we -# restrict ourselves to GNU make (using the --version option ensures -# this.) -AC_DEFUN([AM_PROG_MKDIR_P], -[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi -AC_SUBST([mkdir_p])]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005 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. - -# serial 3 - -# _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. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# 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. - -# serial 4 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -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 conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - 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". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# Copyright (C) 2001, 2003, 2005 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. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# 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])]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004, 2005 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. - -# serial 2 - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) -m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - From edac1701b6d770edd5b11197f727f441837c9a4a Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 29 Jul 2005 19:45:15 +0000 Subject: [PATCH 2416/2994] Update for aclocal.m4 remove --- .cvsignore | 1 + Makefile.am | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.cvsignore b/.cvsignore index 7ad0fd15..66ab2514 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,5 +1,6 @@ Makefile Makefile.in +aclocal.m4 autom4te.cache config.h config.log diff --git a/Makefile.am b/Makefile.am index 2bdea771..75caddc6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ AUTOMAKE_OPTIONS = gnu -MAINTAINERCLEANFILES = configure Makefile.in +MAINTAINERCLEANFILES = configure Makefile.in aclocal.m4 dist-hook: ntfsprogs.spec cp ntfsprogs.spec $(distdir) From db07edcf74854dac348fdc1b8d8217648093e150 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 29 Jul 2005 20:51:48 +0000 Subject: [PATCH 2417/2994] config.h.in and config.guess are autogenerated... --- .cvsignore | 2 + Makefile.am | 2 +- config.guess | 1469 -------------------------------------------------- config.h.in | 265 --------- 4 files changed, 3 insertions(+), 1735 deletions(-) delete mode 100755 config.guess delete mode 100644 config.h.in diff --git a/.cvsignore b/.cvsignore index 66ab2514..6b887292 100644 --- a/.cvsignore +++ b/.cvsignore @@ -2,7 +2,9 @@ Makefile Makefile.in aclocal.m4 autom4te.cache +config.guess config.h +config.h.in config.log config.status configure diff --git a/Makefile.am b/Makefile.am index 75caddc6..67b34db3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ AUTOMAKE_OPTIONS = gnu -MAINTAINERCLEANFILES = configure Makefile.in aclocal.m4 +MAINTAINERCLEANFILES = aclocal.m4 config.h.in config.sub configure Makefile.in dist-hook: ntfsprogs.spec cp ntfsprogs.spec $(distdir) diff --git a/config.guess b/config.guess deleted file mode 100755 index 44f30e6c..00000000 --- a/config.guess +++ /dev/null @@ -1,1469 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. - -timestamp='2005-02-10' - -# This file 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 of the License, 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case "${UNAME_MACHINE}" in - i?86) - test -z "$VENDOR" && VENDOR=pc - ;; - *) - test -z "$VENDOR" && VENDOR=unknown - ;; -esac -test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit 0 ;; - amd64:OpenBSD:*:*) - echo x86_64-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - cats:OpenBSD:*:*) - echo arm-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - luna88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips64-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit 0 ;; - macppc:MirBSD:*:*) - echo powerppc-unknown-mirbsd${UNAME_RELEASE} - exit 0 ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit 0 ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit 0;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit 0 ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit 0 ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:[34]*) - echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit 0 ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - amd64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit 0 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; - cris:Linux:*:*) - echo cris-axis-linux - exit 0 ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux - exit 0 ;; - frv:Linux:*:*) - echo frv-${VENDOR}-linux - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-${VENDOR}-linux" && exit 0 - ;; - ppc:Linux:*:*) - echo powerpc-${VENDOR}-linux - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-${VENDOR}-linux - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC} - exit 0 ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-${VENDOR}-linux ;; - PA8*) echo hppa2.0-${VENDOR}-linux ;; - *) echo hppa-${VENDOR}-linux ;; - esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-${VENDOR}-linux - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR}-linux - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-${VENDOR}-linux - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-${VENDOR}-linuxaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-${VENDOR}-linuxcoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linuxoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-${VENDOR}-linuxoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}" | sed 's/linux-gnu/linux/' && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit 0 ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit 0 ;; - i*86:*:5:[78]*) - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit 0 ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - *86) UNAME_PROCESSOR=i686 ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit 0 ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit 0 ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit 0 ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit 0 ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit 0 ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit 0 ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit 0 ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit 0 ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit 0 ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms && exit 0 ;; - I*) echo ia64-dec-vms && exit 0 ;; - V*) echo vax-dec-vms && exit 0 ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -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` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/config.h.in b/config.h.in deleted file mode 100644 index c2b2d4c8..00000000 --- a/config.h.in +++ /dev/null @@ -1,265 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the `atexit' function. */ -#undef HAVE_ATEXIT - -/* Define to 1 if you have the header file. */ -#undef HAVE_BYTESWAP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_CTYPE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT - -/* Define to 1 if you have the header file. */ -#undef HAVE_ENDIAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ERRNO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `fdatasync' function. */ -#undef HAVE_FDATASYNC - -/* Define to 1 if you have the header file. */ -#undef HAVE_FEATURES_H - -/* Define to 1 if you have the `getmntent' function. */ -#undef HAVE_GETMNTENT - -/* Define to 1 if you have the header file. */ -#undef HAVE_GETOPT_H - -/* Define to 1 if you have the `hasmntopt' function. */ -#undef HAVE_HASMNTOPT - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBINTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_FD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_HDREG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_MAJOR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACHINE_ENDIAN_H - -/* Define to 1 if mbrtowc and mbstate_t are properly declared. */ -#undef HAVE_MBRTOWC - -/* Define to 1 if you have the `mbsinit' function. */ -#undef HAVE_MBSINIT - -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if you have the header file. */ -#undef HAVE_MNTENT_H - -/* Define to 1 if you have the `regcomp' function. */ -#undef HAVE_REGCOMP - -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* Define to 1 if you have the `setxattr' function. */ -#undef HAVE_SETXATTR - -/* Define to 1 if `stat' has the bug that it succeeds when given the - zero-length file name argument. */ -#undef HAVE_STAT_EMPTY_STRING_BUG - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDARG_H - -/* Define to 1 if stdbool.h conforms to C99. */ -#undef HAVE_STDBOOL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDDEF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strcasecmp' function. */ -#undef HAVE_STRCASECMP - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the `strdup' function. */ -#undef HAVE_STRDUP - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the `strftime' function. */ -#undef HAVE_STRFTIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strtol' function. */ -#undef HAVE_STRTOL - -/* Define to 1 if you have the `strtoul' function. */ -#undef HAVE_STRTOUL - -/* Define to 1 if `st_blocks' is member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_BLOCKS - -/* Define to 1 if `st_rdev' is member of `struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_RDEV - -/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use - `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ -#undef HAVE_ST_BLOCKS - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_BYTEORDER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_ENDIAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_IOCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MOUNT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_VFS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `utime' function. */ -#undef HAVE_UTIME - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIME_H - -/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */ -#undef HAVE_UTIME_NULL - -/* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF - -/* Define to 1 if you have the header file. */ -#undef HAVE_WCHAR_H - -/* Define to 1 if the system has the type `_Bool'. */ -#undef HAVE__BOOL - -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -#undef LSTAT_FOLLOWS_SLASHED_SYMLINK - -/* Define this if you do not want the NTFS library to provide default device - io operations. This means that you cannot use ntfs_mount() but have to use - ntfs_device_mount() and provide your own device operations. */ -#undef NO_NTFS_DEVICE_DEFAULT_IO_OPS - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* 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 - -/* Version number of package */ -#undef VERSION - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -/* Define to 1 if your processor stores words with the least significant byte - first (like Intel and VAX, unlike Motorola and SPARC). */ -#undef WORDS_LITTLEENDIAN - -/* Number of bits in a file offset, on hosts where this is settable. */ -#undef _FILE_OFFSET_BITS - -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif - -/* 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 `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to `long' if does not define. */ -#undef off_t - -/* Define to `unsigned' if does not define. */ -#undef size_t From e195dadcd8d743ad985a854164bc5186bf0c8a90 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 29 Jul 2005 20:56:35 +0000 Subject: [PATCH 2418/2994] Remove more files. --- config.sub | 1563 ------------------------- ltconfig | 3114 ------------------------------------------------- mkinstalldirs | 150 --- stamp-h.in | 1 - 4 files changed, 4828 deletions(-) delete mode 100755 config.sub delete mode 100755 ltconfig delete mode 100755 mkinstalldirs delete mode 100644 stamp-h.in diff --git a/config.sub b/config.sub deleted file mode 100755 index c884ad4e..00000000 --- a/config.sub +++ /dev/null @@ -1,1563 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. - -timestamp='2005-02-10' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file 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 of the License, 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. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit 0;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ - kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | msp430 \ - | ns16k | ns32k \ - | openrisc | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | msp430-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16c) - basic_machine=cr16c-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - or32 | or32-*) - basic_machine=or32-unknown - os=-coff - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/ltconfig b/ltconfig deleted file mode 100755 index c14d83c1..00000000 --- a/ltconfig +++ /dev/null @@ -1,3114 +0,0 @@ -#! /bin/sh - -# ltconfig - Create a system-specific libtool. -# Copyright (C) 1996-1999 Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This file 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 of the License, 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A lot of this script is taken from autoconf-2.10. - -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} -echo=echo -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec "$SHELL" "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null`} - case X$UNAME in - *-DOS) PATH_SEPARATOR=';' ;; - *) PATH_SEPARATOR=':' ;; - esac -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if (echo_test_string="`eval $cmd`") 2>/dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || - test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH /usr/ucb; do - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running ltconfig again with it. - ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - echo='printf "%s\n"' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - # Cool, printf works - : - elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && - test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL $0 --fallback-echo" - elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && - test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then - echo="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# The name of this program. -progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` - -# Constants: -PROGRAM=ltconfig -PACKAGE=libtool -VERSION=1.3.5 -TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)" -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -rm="rm -f" - -help="Try \`$progname --help' for more information." - -# Global variables: -default_ofile=libtool -can_build_shared=yes -enable_shared=yes -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -enable_static=yes -enable_fast_install=yes -enable_dlopen=unknown -enable_win32_dll=no -ltmain= -silent= -srcdir= -ac_config_guess= -ac_config_sub= -host= -nonopt= -ofile="$default_ofile" -verify_host=yes -with_gcc=no -with_gnu_ld=no -need_locks=yes -ac_ext=c -objext=o -libext=a -exeext= -cache_file= - -old_AR="$AR" -old_CC="$CC" -old_CFLAGS="$CFLAGS" -old_CPPFLAGS="$CPPFLAGS" -old_LDFLAGS="$LDFLAGS" -old_LD="$LD" -old_LN_S="$LN_S" -old_LIBS="$LIBS" -old_NM="$NM" -old_RANLIB="$RANLIB" -old_DLLTOOL="$DLLTOOL" -old_OBJDUMP="$OBJDUMP" -old_AS="$AS" - -# Parse the command line options. -args= -prev= -for option -do - case "$option" in - -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - eval "$prev=\$option" - prev= - continue - fi - - case "$option" in - --help) cat <&2 - echo "$help" 1>&2 - exit 1 - ;; - - *) - if test -z "$ltmain"; then - ltmain="$option" - elif test -z "$host"; then -# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 -# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then -# echo "$progname: warning \`$option' is not a valid host type" 1>&2 -# fi - host="$option" - else - echo "$progname: too many arguments" 1>&2 - echo "$help" 1>&2 - exit 1 - fi ;; - esac -done - -if test -z "$ltmain"; then - echo "$progname: you must specify a LTMAIN file" 1>&2 - echo "$help" 1>&2 - exit 1 -fi - -if test ! -f "$ltmain"; then - echo "$progname: \`$ltmain' does not exist" 1>&2 - echo "$help" 1>&2 - exit 1 -fi - -# Quote any args containing shell metacharacters. -ltconfig_args= -for arg -do - case "$arg" in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ltconfig_args="$ltconfig_args '$arg'" ;; - *) ltconfig_args="$ltconfig_args $arg" ;; - esac -done - -# A relevant subset of AC_INIT. - -# 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 -# 5 compiler messages saved in config.log -# 6 checking for... messages and results -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>>./config.log - -# NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi -if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi - -if test -n "$cache_file" && test -r "$cache_file"; then - echo "loading cache $cache_file within ltconfig" - . $cache_file -fi - -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 - -if test -z "$srcdir"; then - # Assume the source directory is the same one as the path to LTMAIN. - srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` - test "$srcdir" = "$ltmain" && srcdir=. -fi - -trap "$rm conftest*; exit 1" 1 2 15 -if test "$verify_host" = yes; then - # Check for config.guess and config.sub. - ac_aux_dir= - for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/config.guess; then - ac_aux_dir=$ac_dir - break - fi - done - if test -z "$ac_aux_dir"; then - echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 - echo "$help" 1>&2 - exit 1 - fi - ac_config_guess=$ac_aux_dir/config.guess - ac_config_sub=$ac_aux_dir/config.sub - - # Make sure we can run config.sub. - if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : - else - echo "$progname: cannot run $ac_config_sub" 1>&2 - echo "$help" 1>&2 - exit 1 - fi - - echo $ac_n "checking host system type""... $ac_c" 1>&6 - - host_alias=$host - case "$host_alias" in - "") - if host_alias=`$SHELL $ac_config_guess`; then : - else - echo "$progname: cannot guess host type; you must specify one" 1>&2 - echo "$help" 1>&2 - exit 1 - fi ;; - esac - host=`$SHELL $ac_config_sub $host_alias` - echo "$ac_t$host" 1>&6 - - # Make sure the host verified. - test -z "$host" && exit 1 - -elif test -z "$host"; then - echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 - echo "$help" 1>&2 - exit 1 -else - host_alias=$host -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case "$host_os" in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - -case "$host_os" in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR cru $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -# Set a sane default for `AR'. -test -z "$AR" && AR=ar - -# Set a sane default for `OBJDUMP'. -test -z "$OBJDUMP" && OBJDUMP=objdump - -# If RANLIB is not set, then run the test. -if test "${RANLIB+set}" != "set"; then - result=no - - echo $ac_n "checking for ranlib... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then - RANLIB="ranlib" - result="ranlib" - break - fi - done - IFS="$save_ifs" - - echo "$ac_t$result" 1>&6 -fi - -if test -n "$RANLIB"; then - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" -fi - -# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$AS" && AS=as - -# Check to see if we are using GCC. -if test "$with_gcc" != yes || test -z "$CC"; then - # If CC is not set, then try to find GCC or a usable CC. - if test -z "$CC"; then - echo $ac_n "checking for gcc... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then - CC="gcc" - break - fi - done - IFS="$save_ifs" - - if test -n "$CC"; then - echo "$ac_t$CC" 1>&6 - else - echo "$ac_t"no 1>&6 - fi - fi - - # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". - if test -z "$CC"; then - echo $ac_n "checking for cc... $ac_c" 1>&6 - IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - cc_rejected=no - for dir in $PATH; do - test -z "$dir" && dir=. - if test -f $dir/cc || test -f $dir/cc$ac_exeext; then - if test "$dir/cc" = "/usr/ucb/cc"; then - cc_rejected=yes - continue - fi - CC="cc" - break - fi - done - IFS="$save_ifs" - if test $cc_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same name, so the bogon will be chosen - # first if we set CC to just the name; use the full file name. - shift - set dummy "$dir/cc" "$@" - shift - CC="$@" - fi - fi - - if test -n "$CC"; then - echo "$ac_t$CC" 1>&6 - else - echo "$ac_t"no 1>&6 - fi - - if test -z "$CC"; then - echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 - exit 1 - fi - fi - - # Now see if the compiler is really GCC. - with_gcc=no - echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 - echo "$progname:581: checking whether we are using GNU C" >&5 - - $rm conftest.c - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - with_gcc=yes - fi - $rm conftest.c - echo "$ac_t$with_gcc" 1>&6 -fi - -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="$2" - -echo $ac_n "checking for object suffix... $ac_c" 1>&6 -$rm conftest* -echo 'int i = 1;' > conftest.c -echo "$progname:603: checking for object suffix" >& 5 -if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - - for ac_file in conftest.*; do - case $ac_file in - *.c) ;; - *) objext=`echo $ac_file | sed -e s/conftest.//` ;; - esac - done -else - cat conftest.err 1>&5 - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 -fi -$rm conftest* -echo "$ac_t$objext" 1>&6 - -echo $ac_n "checking for executable suffix... $ac_c" 1>&6 -if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_cv_exeext="no" - $rm conftest* - echo 'main () { return 0; }' > conftest.c - echo "$progname:629: checking for executable suffix" >& 5 - if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - - for ac_file in conftest.*; do - case $ac_file in - *.c | *.err | *.$objext ) ;; - *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; - esac - done - else - cat conftest.err 1>&5 - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - $rm conftest* -fi -if test "X$ac_cv_exeext" = Xno; then - exeext="" -else - exeext="$ac_cv_exeext" -fi -echo "$ac_t$ac_cv_exeext" 1>&6 - -echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 -pic_flag= -special_shlib_compile_flags= -wl= -link_static_flag= -no_builtin_flag= - -if test "$with_gcc" = yes; then - wl='-Wl,' - link_static_flag='-static' - - case "$host_os" in - beos* | irix5* | irix6* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # we not sure about C++ programs. - link_static_flag="$link_static_flag ${wl}-lC" - ;; - cygwin* | mingw* | os2*) - # We can build DLLs from non-PIC. - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - pic_flag='-m68020 -resident32 -malways-restore-a4' - ;; - sysv4*MP*) - if test -d /usr/nec; then - pic_flag=-Kconform_pic - fi - ;; - *) - pic_flag='-fPIC' - ;; - esac -else - # PORTME Check for PIC flags for the system compiler. - case "$host_os" in - aix3* | aix4*) - # All AIX code is PIC. - link_static_flag='-bnso -bI:/lib/syscalls.exp' - ;; - - hpux9* | hpux10* | hpux11*) - # Is there a better link_static_flag that works with the bundled CC? - wl='-Wl,' - link_static_flag="${wl}-a ${wl}archive" - pic_flag='+Z' - ;; - - irix5* | irix6*) - wl='-Wl,' - link_static_flag='-non_shared' - # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | os2*) - # We can build DLLs from non-PIC. - ;; - - osf3* | osf4* | osf5*) - # All OSF/1 code is PIC. - wl='-Wl,' - link_static_flag='-non_shared' - ;; - - sco3.2v5*) - pic_flag='-Kpic' - link_static_flag='-dn' - special_shlib_compile_flags='-belf' - ;; - - solaris*) - pic_flag='-KPIC' - link_static_flag='-Bstatic' - wl='-Wl,' - ;; - - sunos4*) - pic_flag='-PIC' - link_static_flag='-Bstatic' - wl='-Qoption ld ' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - pic_flag='-KPIC' - link_static_flag='-Bstatic' - wl='-Wl,' - ;; - - uts4*) - pic_flag='-pic' - link_static_flag='-Bstatic' - ;; - sysv4*MP*) - if test -d /usr/nec ;then - pic_flag='-Kconform_pic' - link_static_flag='-Bstatic' - fi - ;; - *) - can_build_shared=no - ;; - esac -fi - -if test -n "$pic_flag"; then - echo "$ac_t$pic_flag" 1>&6 - - # Check to make sure the pic_flag actually works. - echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 - $rm conftest* - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $pic_flag -DPIC" - echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 - if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then - # Append any warnings to the config.log. - cat conftest.err 1>&5 - - case "$host_os" in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then they - # create non-PIC objects. So, if there were any warnings, we assume that - # PIC is not supported. - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - can_build_shared=no - pic_flag= - else - echo "$ac_t"yes 1>&6 - pic_flag=" $pic_flag" - fi - ;; - *) - echo "$ac_t"yes 1>&6 - pic_flag=" $pic_flag" - ;; - esac - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - can_build_shared=no - pic_flag= - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* -else - echo "$ac_t"none 1>&6 -fi - -# Check to see if options -o and -c are simultaneously supported by compiler -echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -$rm conftest* -echo "int some_variable = 0;" > conftest.c -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.o" -echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 -if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - echo "$ac_t"no 1>&6 - compiler_c_o=no - else - echo "$ac_t"yes 1>&6 - compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&5 - compiler_c_o=no - echo "$ac_t"no 1>&6 -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null - -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 - $rm conftest* - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 -if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - compiler_o_lo=no - else - echo "$ac_t"yes 1>&6 - compiler_o_lo=yes - fi - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - compiler_o_lo=no - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* -else - compiler_o_lo=no -fi - -# Check to see if we can do hard links to lock some files if needed -hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$ac_t$hard_links" 1>&6 - $rm conftest* - if test "$hard_links" = no; then - echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 - need_locks=warn - fi -else - need_locks=no -fi - -if test "$with_gcc" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 - $rm conftest* - echo "int some_variable = 0;" > conftest.c - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" - echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 - if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then - - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - echo "$ac_t"no 1>&6 - compiler_rtti_exceptions=no - else - echo "$ac_t"yes 1>&6 - compiler_rtti_exceptions=yes - fi - else - # Append any errors to the config.log. - cat conftest.err 1>&5 - compiler_rtti_exceptions=no - echo "$ac_t"no 1>&6 - fi - CFLAGS="$save_CFLAGS" - $rm conftest* - - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi - -fi - -# Check for any special shared library compilation flags. -if test -n "$special_shlib_compile_flags"; then - echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 - if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : - else - echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 - can_build_shared=no - fi -fi - -echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 -$rm conftest* -echo 'main(){return(0);}' > conftest.c -save_LDFLAGS="$LDFLAGS" -LDFLAGS="$LDFLAGS $link_static_flag" -echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 -if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - echo "$ac_t$link_static_flag" 1>&6 -else - echo "$ac_t"none 1>&6 - link_static_flag= -fi -LDFLAGS="$save_LDFLAGS" -$rm conftest* - -if test -z "$LN_S"; then - # Check to see if we can use ln -s, or we need hard links. - echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 - $rm conftest.dat - if ln -s X conftest.dat 2>/dev/null; then - $rm conftest.dat - LN_S="ln -s" - else - LN_S=ln - fi - if test "$LN_S" = "ln -s"; then - echo "$ac_t"yes 1>&6 - else - echo "$ac_t"no 1>&6 - fi -fi - -# Make sure LD is an absolute path. -if test -z "$LD"; then - ac_prog=ld - if test "$with_gcc" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 - echo "$progname:991: checking for ld used by GCC" >&5 - ac_prog=`($CC -print-prog-name=ld) 2>&5` - 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 are not 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 $ac_n "checking for GNU ld... $ac_c" 1>&6 - echo "$progname:1015: checking for GNU ld" >&5 - else - echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 - echo "$progname:1018: checking for non-GNU ld" >&5 - fi - - 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 - 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 "$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" - fi - - if test -n "$LD"; then - echo "$ac_t$LD" 1>&6 - else - echo "$ac_t"no 1>&6 - fi - - if test -z "$LD"; then - echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 - exit 1 - fi -fi - -# Check to see if it really is or is not GNU ld. -echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 -# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - with_gnu_ld=yes -else - with_gnu_ld=no -fi -echo "$ac_t$with_gnu_ld" 1>&6 - -# See if the linker supports building shared libraries. -echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 - -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. - -case "$host_os" in -cygwin* | mingw*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$with_gcc" != yes; then - with_gnu_ld=no - fi - ;; - -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case "$host_os" in - aix3* | aix4*) - # On AIX, the GNU linker is very broken - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left by newer dlltools. - export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ - test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ - $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols' - - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \$# in - 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;; - *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done~ - test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ - test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ - $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ - $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ - $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' - - old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' - # can we support soname and/or expsyms with a.out? -oliva - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi -else - # PORTME fill in a description of your system's linker (not GNU ld) - case "$host_os" in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$with_gcc" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4*) - hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' - hardcode_libdir_separator=':' - if test "$with_gcc" = yes; then - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - shared_flag='-shared' - else - shared_flag='${wl}-bM:SRE' - hardcode_direct=yes - fi - allow_undefined_flag=' ${wl}-berok' - archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' - archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' - case "$host_os" in aix4.[01]|aix4.[01].*) - # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on - always_export_symbols=yes ;; - esac - ;; - - amigaos*) - archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs' - fix_srcfile_path='`cygpath -w $srcfile`' - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case "$host_os" in - hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6*) - if test "$with_gcc" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF - fi - hardcode_libdir_flag_spec='${wl}-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - openbsd*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' - ;; - - osf3*) - if test "$with_gcc" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # As osf3* with the addition of the -msym flag - if test "$with_gcc" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - rhapsody*) - archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flags_spec='-L$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case "$host_os" in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts' - else - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - unixware7*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac -fi -echo "$ac_t$ld_shlibs" 1>&6 -test "$ld_shlibs" = no && can_build_shared=no - -if test -z "$NM"; then - echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 - case "$NM" in - [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. - *) - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" - for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/nm || test -f $ac_dir/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 - if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - NM="$ac_dir/nm -B" - break - elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - NM="$ac_dir/nm -p" - break - else - NM=${NM="$ac_dir/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 "$NM" && NM=nm - ;; - esac - echo "$ac_t$NM" 1>&6 -fi - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Define system-specific variables. -case "$host_os" in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" - ;; -irix*) - symcode='[BCDEGRST]' - ;; -solaris*) - symcode='[BDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[ABCDGISTW]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - $rm conftest* - cat > conftest.c <&5 - if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then - # Now try to grab the symbols. - nlist=conftest.nm - if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then - - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.c -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' - - cat <> conftest.c -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{ -EOF - sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c - cat <<\EOF >> conftest.c - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$objext conftstm.$objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - pipe_works=yes - else - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - LIBS="$save_LIBS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.c >&5 - fi - $rm conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - global_symbol_pipe= - fi -done -if test "$pipe_works" = yes; then - echo "${ac_t}ok" 1>&6 -else - echo "${ac_t}failed" 1>&6 -fi - -if test -z "$global_symbol_pipe"; then - global_symbol_to_cdecl= -fi - -# Check hardcoding attributes. -echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$ac_t$hardcode_action" 1>&6 - - -reload_flag= -reload_cmds='$LD$reload_flag -o $output$reload_objs' -echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 -# PORTME Some linkers may need a different reload flag. -reload_flag='-r' -echo "$ac_t$reload_flag" 1>&6 -test -n "$reload_flag" && reload_flag=" $reload_flag" - -# PORTME Fill in your ld.so characteristics -library_names_spec= -libname_spec='lib$name' -soname_spec= -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -file_magic_cmd= -file_magic_test_file= -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. -echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 -case "$host_os" in -aix3*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' - ;; - -aix4*) - version_type=linux - # AIX has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - # We preserve .a as extension for shared libraries though AIX4.2 - # and later linker supports .so - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' - shlibpath_var=LIBPATH - deplibs_check_method=pass_all - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}.so' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - deplibs_check_method=pass_all - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - file_magic_cmd=/usr/bin/file - file_magic_test_file=/shlib/libc.so - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw*) - version_type=windows - need_version=no - need_lib_prefix=no - if test "$with_gcc" = yes; then - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' - else - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' - fi - dynamic_linker='Win32 ld.exe' - deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - file_magic_cmd='${OBJDUMP} -f' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case "$version_type" in - freebsd-elf*) - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /usr/lib/libc.so*` - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - deplibs_check_method=unknown - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case "$host_os" in - freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - dynamic_linker="$host_os dld.sl" - version_type=sunos - need_lib_prefix=no - need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - case "$host_os" in - hpux10.20*) - # TODO: Does this work for hpux-11 too? - deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - file_magic_cmd=/usr/bin/file - file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6*) - version_type=irix - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}.so.$major' - library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' - case "$host_os" in - irix5*) - libsuff= shlibsuff= - # this will be overridden with pass_all, but let us keep it just in case - deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case "$LD" in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /lib${libsuff}/libc.so*` - deplibs_check_method='pass_all' - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux-gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - deplibs_check_method=pass_all - - if test -f /lib/ld.so.1; then - dynamic_linker='GNU ld.so' - else - # Only the GNU ld.so supports shared libraries on MkLinux. - case "$host_cpu" in - powerpc*) dynamic_linker=no ;; - *) dynamic_linker='Linux ld.so' ;; - esac - fi - ;; - -netbsd*) - version_type=sunos - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - ;; - -openbsd*) - version_type=sunos - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - need_version=no - fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - ;; - -os2*) - libname_spec='$name' - need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_version=no - soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - shlibpath_var=LD_LIBRARY_PATH - # this will be overridden with pass_all, but let us keep it just in case - deplibs_check_method='file_magic COFF format alpha shared library' - file_magic_cmd=/usr/bin/file - file_magic_test_file=/shlib/libc.so - deplibs_check_method='pass_all' - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rhapsody*) - version_type=sunos - library_names_spec='${libname}.so' - soname_spec='${libname}.so' - shlibpath_var=DYLD_LIBRARY_PATH - deplibs_check_method=pass_all - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" - file_magic_cmd=/usr/bin/file - file_magic_test_file=/lib/libc.so - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - case "$host_vendor" in - sequent) - file_magic_cmd='/bin/file' - deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - ncr) - deplibs_check_method='pass_all' - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - 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]' - file_magic_cmd=/usr/bin/file - file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - esac - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$ac_t$dynamic_linker" 1>&6 -test "$dynamic_linker" = no && can_build_shared=no - -# Report the final consequences. -echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 - -# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in -# configure.in, otherwise build static only libraries. -case "$host_os" in -cygwin* | mingw* | os2*) - if test x$can_build_shared = xyes; then - test x$enable_win32_dll = xno && can_build_shared=no - echo "checking if package supports dlls... $can_build_shared" 1>&6 - fi -;; -esac - -if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then - case "$deplibs_check_method" in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <&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 - -echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - test "$enable_shared" = yes && enable_static=no - ;; -esac - -echo "$ac_t$enable_shared" 1>&6 - -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes - -echo "checking whether to build static libraries... $enable_static" 1>&6 - -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -echo $ac_n "checking for objdir... $ac_c" 1>&6 -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -echo "$ac_t$objdir" 1>&6 - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else -if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then - lt_cv_dlopen=no lt_cv_dlopen_libs= -echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "$progname:2248: checking for dlopen in -ldl" >&5 -ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldl $LIBS" -cat > conftest.$ac_ext <&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 "$progname: 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 - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -echo "$progname:2288: checking for dlopen" >&5 -if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen(); - -int main() { - -/* 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_dlopen) || defined (__stub___dlopen) -choke me -#else -dlopen(); -#endif - -; return 0; } -EOF -if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_dlopen=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_dlopen=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="dlopen" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 -echo "$progname:2335: checking for dld_link in -ldld" >&5 -ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldld $LIBS" -cat > conftest.$ac_ext <&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 "$progname: 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 - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for shl_load""... $ac_c" 1>&6 -echo "$progname:2375: checking for shl_load" >&5 -if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load(); - -int main() { - -/* 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_shl_load) || defined (__stub___shl_load) -choke me -#else -shl_load(); -#endif - -; return 0; } -EOF -if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_shl_load=yes" -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_shl_load=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then - echo "$ac_t""yes" 1>&6 - lt_cv_dlopen="shl_load" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 -echo "$progname:2423: checking for shl_load in -ldld" >&5 -ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-ldld $LIBS" -cat > conftest.$ac_ext <&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 "$progname: 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 - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - echo "$ac_t""no" 1>&6 -fi - - -fi - - -fi - - -fi - - -fi - -fi - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - fi - - case "$lt_cv_dlopen" in - dlopen) -for ac_hdr in dlfcn.h; do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "$progname:2488: 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 < -int fnord = 0; -EOF -ac_try="$ac_compile >/dev/null 2>conftest.out" -{ (eval echo $progname:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi -done - - if test "x$ac_cv_header_dlfcn_h" = xyes; then - CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - fi - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 -echo "$progname:2526: checking whether a program can dlopen itself" >&5 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - lt_cv_dlopen_self=cross - else - cat > conftest.c < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LTDL_GLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LTDL_GLOBAL DL_GLOBAL -# else -# define LTDL_GLOBAL 0 -# endif -#endif - -/* We may have to define LTDL_LAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LTDL_LAZY_OR_NOW -# ifdef RTLD_LAZY -# define LTDL_LAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LTDL_LAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LTDL_LAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LTDL_LAZY_OR_NOW DL_NOW -# else -# define LTDL_LAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -fnord() { int i=42;} -main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); - if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); - if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } - -EOF -if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - lt_cv_dlopen_self=yes -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - lt_cv_dlopen_self=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$lt_cv_dlopen_self" 1>&6 - - if test "$lt_cv_dlopen_self" = yes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 -echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - lt_cv_dlopen_self_static=cross - else - cat > conftest.c < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LTDL_GLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LTDL_GLOBAL DL_GLOBAL -# else -# define LTDL_GLOBAL 0 -# endif -#endif - -/* We may have to define LTDL_LAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LTDL_LAZY_OR_NOW -# ifdef RTLD_LAZY -# define LTDL_LAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LTDL_LAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LTDL_LAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LTDL_LAZY_OR_NOW DL_NOW -# else -# define LTDL_LAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -fnord() { int i=42;} -main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); - if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); - if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } - -EOF -if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null -then - lt_cv_dlopen_self_static=yes -else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - lt_cv_dlopen_self_static=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 -fi - ;; - esac - - case "$lt_cv_dlopen_self" in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case "$lt_cv_dlopen_self_static" in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - -# Copy echo and quote the copy, instead of the original, because it is -# used later. -ltecho="$echo" -if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then - ltecho="$CONFIG_SHELL \$0 --fallback-echo" -fi -LTSHELL="$SHELL" - -LTCONFIG_VERSION="$VERSION" - -# Only quote variables if we're using ltmain.sh. -case "$ltmain" in -*.sh) - # Now quote all the things that may contain metacharacters. - for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ - old_LD old_LDFLAGS old_LIBS \ - old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ - AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ - file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do - - case "$var" in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - case "$ltecho" in - *'\$0 --fallback-echo"') - ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` - ;; - esac - - trap "$rm \"$ofile\"; exit 1" 1 2 15 - echo "creating $ofile" - $rm "$ofile" - cat < "$ofile" -#! $SHELL - -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. -# -# Copyright (C) 1996-1999 Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# 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 of the License, 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="sed -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -### BEGIN LIBTOOL CONFIG -EOF - cfgfile="$ofile" - ;; - -*) - # Double-quote the variables that need it (for aesthetics). - for var in old_CC old_CFLAGS old_CPPFLAGS \ - old_LD old_LDFLAGS old_LIBS \ - old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do - eval "$var=\\\"\$var\\\"" - done - - # Just create a config file. - cfgfile="$ofile.cfg" - trap "$rm \"$cfgfile\"; exit 1" 1 2 15 - echo "creating $cfgfile" - $rm "$cfgfile" - cat < "$cfgfile" -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -EOF - ;; -esac - -cat <> "$cfgfile" -# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ -# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ -# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ -# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ -# $0$ltconfig_args -# -# Compiler and other test output produced by $progname, useful for -# debugging $progname, is in ./config.log if it exists. - -# The version of $progname that generated this script. -LTCONFIG_VERSION=$LTCONFIG_VERSION - -# Shell to use when invoking shell scripts. -SHELL=$LTSHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$ltecho - -# The archiver. -AR=$AR - -# The default C compiler. -CC=$CC - -# The linker used to build libraries. -LD=$LD - -# Whether we need hard or soft links. -LN_S=$LN_S - -# A BSD-compatible nm program. -NM=$NM - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$reload_flag -reload_cmds=$reload_cmds - -# How to pass a linker flag through the compiler. -wl=$wl - -# Object file suffix (normally "o"). -objext="$objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$pic_flag - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$compiler_c_o - -# Can we write directly to a .lo ? -compiler_o_lo=$compiler_o_lo - -# Must we lock files when doing compilation ? -need_locks=$need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$link_static_flag - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$no_builtin_flag - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$whole_archive_flag_spec - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$thread_safe_flag_spec - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$RANLIB -old_archive_cmds=$old_archive_cmds -old_postinstall_cmds=$old_postinstall_cmds -old_postuninstall_cmds=$old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$old_archive_from_new_cmds - -# Commands used to build and install a shared archive. -archive_cmds=$archive_cmds -archive_expsym_cmds=$archive_expsym_cmds -postinstall_cmds=$postinstall_cmds -postuninstall_cmds=$postuninstall_cmds - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$allow_undefined_flag - -# Flag that forces no undefined symbols. -no_undefined_flag=$no_undefined_flag - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$global_symbol_to_cdecl - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$hardcode_libdir_separator - -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$include_expsyms - -EOF - -case "$ltmain" in -*.sh) - echo '### END LIBTOOL CONFIG' >> "$ofile" - echo >> "$ofile" - case "$host_os" in - aix3*) - cat <<\EOF >> "$ofile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # Append the ltmain.sh script. - sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - - chmod +x "$ofile" - ;; - -*) - # Compile the libtool program. - echo "FIXME: would compile $ltmain" - ;; -esac - -test -n "$cache_file" || exit 0 - -# AC_CACHE_SAVE -trap '' 1 2 15 -cat > confcache <<\EOF -# 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. -# -# 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. -# -EOF -# 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 - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -exit 0 - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/mkinstalldirs b/mkinstalldirs deleted file mode 100755 index 5d26a485..00000000 --- a/mkinstalldirs +++ /dev/null @@ -1,150 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy - -scriptversion=2005-02-02.21 - -# Original author: Noah Friedman -# Created: 1993-05-16 -# Public domain. -# -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -errstatus=0 -dirmode="" - -usage="\ -Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... - -Create each directory DIR (with mode MODE, if specified), including all -leading file name components. - -Report bugs to ." - -# process command line arguments -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) # -h for help - echo "$usage" - exit $? - ;; - -m) # -m PERM arg - shift - test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } - dirmode=$1 - shift - ;; - --version) - echo "$0 $scriptversion" - exit $? - ;; - --) # stop option processing - shift - break - ;; - -*) # unknown option - echo "$usage" 1>&2 - exit 1 - ;; - *) # first non-opt arg - break - ;; - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in - 0) exit 0 ;; -esac - -# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and -# mkdir -p a/c at the same time, both will detect that a is missing, -# one will create a, then the other will try to create a and die with -# a "File exists" error. This is a problem when calling mkinstalldirs -# from a parallel make. We use --version in the probe to restrict -# ourselves to GNU mkdir, which is thread-safe. -case $dirmode in - '') - if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - test -d ./-p && rmdir ./-p - test -d ./--version && rmdir ./--version - fi - ;; - *) - if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && - test ! -d ./--version; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - else - # Clean up after NextStep and OpenStep mkdir. - for d in ./-m ./-p ./--version "./$dirmode"; - do - test -d $d && rmdir $d - done - fi - ;; -esac - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case $pathcomp in - -*) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - lasterr="" - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/stamp-h.in b/stamp-h.in deleted file mode 100644 index 9788f702..00000000 --- a/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -timestamp From 46ff0a83a87129c50eaa8e13e307d040aeb525a1 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 29 Jul 2005 21:09:07 +0000 Subject: [PATCH 2419/2994] More removals... --- .cvsignore | 1 + Makefile.am | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.cvsignore b/.cvsignore index 6b887292..02b74193 100644 --- a/.cvsignore +++ b/.cvsignore @@ -7,6 +7,7 @@ config.h config.h.in config.log config.status +config.sub configure libtool ntfsprogs.spec diff --git a/Makefile.am b/Makefile.am index 67b34db3..22713d51 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,8 @@ EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ AUTOMAKE_OPTIONS = gnu -MAINTAINERCLEANFILES = aclocal.m4 config.h.in config.sub configure Makefile.in +MAINTAINERCLEANFILES = aclocal.m4 config.guess config.h.in config.sub \ + configure Makefile.in dist-hook: ntfsprogs.spec cp ntfsprogs.spec $(distdir) From 6c5775628f41a919820bb9b87e8728351be84a83 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 29 Jul 2005 21:16:27 +0000 Subject: [PATCH 2420/2994] Remove hope all autogenerated files --- .cvsignore | 8 + Makefile.am | 4 +- compile | 142 -- depcomp | 529 ----- install-sh | 323 --- ltmain.sh | 6460 --------------------------------------------------- missing | 357 --- 7 files changed, 10 insertions(+), 7813 deletions(-) delete mode 100755 compile delete mode 100755 depcomp delete mode 100755 install-sh delete mode 100755 ltmain.sh delete mode 100755 missing diff --git a/.cvsignore b/.cvsignore index 02b74193..6e23d7da 100644 --- a/.cvsignore +++ b/.cvsignore @@ -12,3 +12,11 @@ configure libtool ntfsprogs.spec stamp-h1 +depcomp +ltmain.sh +mkinstalldirs +compile +install-sh +stamp-h.in +ltconfig +missing diff --git a/Makefile.am b/Makefile.am index 22713d51..76f6450d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,8 +7,8 @@ EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ AUTOMAKE_OPTIONS = gnu -MAINTAINERCLEANFILES = aclocal.m4 config.guess config.h.in config.sub \ - configure Makefile.in +MAINTAINERCLEANFILES = configure Makefile.in aclocal.m4 compile depcomp \ + install-sh missing config.guess config.sub config.h.in dist-hook: ntfsprogs.spec cp ntfsprogs.spec $(distdir) diff --git a/compile b/compile deleted file mode 100755 index ad57e2f6..00000000 --- a/compile +++ /dev/null @@ -1,142 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand `-c -o'. - -scriptversion=2005-02-03.08 - -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. -# Written by Tom Tromey . -# -# 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. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand `-c -o'. -Remove `-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file `INSTALL'. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; -esac - -ofile= -cfile= -eat= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we strip `-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no `-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # `.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` - -# Create the lock directory. -# Note: use `[/.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/depcomp b/depcomp deleted file mode 100755 index ffcd540c..00000000 --- a/depcomp +++ /dev/null @@ -1,529 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2005-02-09.22 - -# Copyright (C) 1999, 2000, 2003, 2004, 2005 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. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputing dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - stat=$? - - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - outname="$stripped.o" - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mecanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/install-sh b/install-sh deleted file mode 100755 index 1a835340..00000000 --- a/install-sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2005-02-02.21 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit $?;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/ltmain.sh b/ltmain.sh deleted file mode 100755 index 3d071010..00000000 --- a/ltmain.sh +++ /dev/null @@ -1,6460 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun configure. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# 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 of the License, 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -basename="s,^.*/,,g" - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - -# The name of this program: -progname=`echo "$progpath" | $SED $basename` -modename="$progname" - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION=1.5.14 -TIMESTAMP=" (1.1220.2.195 2005/02/12 12:12:33)" - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes. -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -# Check that we have a working $echo. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" -quote_scanset='[[~#^*{};<>?'"'"' ]' - -##################################### -# Shell function definitions: -# This seems to be the best place for them - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -func_win32_libid () -{ - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ - $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | \ - sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` - if test "X$win32_nmres" = "Ximport" ; then - win32_libid_type="x86 archive import" - else - win32_libid_type="x86 archive static" - fi - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $echo $win32_libid_type -} - - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - CC_quoted="$CC_quoted $arg" - done - case "$@ " in - " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit $EXIT_FAILURE -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi -} - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'` - - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" - $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 - $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 - $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" - $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \ - | $EGREP -v '^[ ]*1[ ]' | while read count name - do - i=1 - while test "$i" -le "$count" - do - # Put our $i before any first dot (extension) - # Never overwrite any file - name_to="$name" - while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to" - do - name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` - done - $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')" - $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $? - i=`expr $i + 1` - done - done - $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib" - $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib" - fi -} - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - my_status="" - - $show "${rm}r $my_gentop" - $run ${rm}r "$my_gentop" - $show "$mkdir $my_gentop" - $run $mkdir "$my_gentop" - my_status=$? - if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then - exit $my_status - fi - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` - my_xdir="$my_gentop/$my_xlib" - - $show "${rm}r $my_xdir" - $run ${rm}r "$my_xdir" - $show "$mkdir $my_xdir" - $run $mkdir "$my_xdir" - status=$? - if test "$status" -ne 0 && test ! -d "$my_xdir"; then - exit $status - fi - case $host in - *-darwin*) - $show "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - if test -z "$run"; then - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` - darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` - if test -n "$darwin_arches"; then - darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - $show "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we have a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` - lipo -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - ${rm}r unfat-$$ - cd "$darwin_orig_dir" - else - cd "$darwin_orig_dir" - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - fi # $run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - func_extract_archives_result="$my_oldobjs" -} -# End of Shell function definitions -##################################### - -# Darwin sucks -eval std_shrext=\"$shrext_cmds\" - -# Parse our command line options once, thoroughly. -while test "$#" -gt 0 -do - arg="$1" - shift - - case $arg in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - execute_dlfiles) - execute_dlfiles="$execute_dlfiles $arg" - ;; - tag) - tagname="$arg" - preserve_args="${preserve_args}=$arg" - - # Check whether tagname contains only valid characters - case $tagname in - *[!-_A-Za-z0-9,/]*) - $echo "$progname: invalid tag name: $tagname" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $tagname in - CC) - # Don't test for the "default" C tag, as we know, it's there, but - # not specially marked. - ;; - *) - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then - taglist="$taglist $tagname" - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" - else - $echo "$progname: ignoring unknown tag $tagname" 1>&2 - fi - ;; - esac - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case $arg in - --help) - show_help=yes - ;; - - --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $echo - $echo "Copyright (C) 2005 Free Software Foundation, Inc." - $echo "This is free software; see the source for copying conditions. There is NO" - $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - exit $? - ;; - - --config) - ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath - # Now print the configurations for the tags. - for tagname in $taglist; do - ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" - done - exit $? - ;; - - --debug) - $echo "$progname: enabling shell trace mode" - set -x - preserve_args="$preserve_args $arg" - ;; - - --dry-run | -n) - run=: - ;; - - --features) - $echo "host: $host" - if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" - else - $echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - $echo "enable static libraries" - else - $echo "disable static libraries" - fi - exit $? - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --preserve-dup-deps) duplicate_deps="yes" ;; - - --quiet | --silent) - show=: - preserve_args="$preserve_args $arg" - ;; - - --tag) prevopt="--tag" prev=tag ;; - --tag=*) - set tag "$optarg" ${1+"$@"} - shift - prev=tag - preserve_args="$preserve_args --tag" - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE -fi - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 - $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 - case $nonopt in - *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) - mode=link - for arg - do - case $arg in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case $mode in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes - suppress_output= - arg_mode=normal - libobj= - later= - - for arg - do - case "$arg_mode" in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit $EXIT_FAILURE - fi - arg_mode=target - continue - ;; - - -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" - continue - ;; - - * ) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - case $lastarg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, and some SunOS ksh mistreat backslash-escaping - # in scan sets (worked around with variable expansion), - # and furthermore cannot handle '|' '&' '(' ')' in scan sets - # at all, so we specify them separately. - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - lastarg="\"$lastarg\"" - ;; - esac - - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit $EXIT_FAILURE - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit $EXIT_FAILURE - ;; - *) - # Get the name of the library object. - [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.ii) xform=ii ;; - *.class) xform=class ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - *.java) xform=java ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do - case $arg in - -static) - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - esac - done - - objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir= - else - xdir=$xdir/ - fi - lobj=${xdir}$objdir/$objname - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - $run $rm $removelist - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $run ln "$progpath" "$lockfile" 2>/dev/null; do - $show "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $echo "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - $echo $srcfile > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - - $run $rm "$libobj" "${libobj}T" - - # Create a libtool object file (analogous to a ".la" file), - # but don't create it if we're doing a dry run. - test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the PIC object to the libtool object file. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then - $echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Append the name of the non-PIC object the libtool object file. - # Only append if the libtool object file exists. - test -z "$run" && cat >> ${libobj}T <> ${libobj}T <&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - fi - build_libtool_libs=no - build_old_libs=yes - prefer_static_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test - ;; - *) qarg=$arg ;; - esac - libtool_args="$libtool_args $qarg" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case $prev in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit $EXIT_FAILURE - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat $save_arg` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - done - else - $echo "$modename: link input file \`$save_arg' does not exist" - exit $EXIT_FAILURE - fi - arg=$save_arg - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - compile_command="$compile_command $wl$qarg" - finalize_command="$finalize_command $wl$qarg" - continue - ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - darwin_framework) - compiler_flags="$compiler_flags $arg" - prev= - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: more than one -exported-symbols argument is not allowed" - exit $EXIT_FAILURE - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework) - prev=darwin_framework - compiler_flags="$compiler_flags $arg" - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - ;; - esac - continue - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit $EXIT_FAILURE - fi - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - case :$dllsearchpath: in - *":$dir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-pw32* | *-*-beos*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-mingw* | *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs -framework System" - continue - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - -model) - compile_command="$compile_command $arg" - compiler_flags="$compiler_flags $arg" - finalize_command="$finalize_command $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - compiler_flags="$compiler_flags $arg" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # -64, -mips[0-9] enable 64-bit mode on the SGI compiler - # -r[0-9][0-9]* specifies the processor on the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler - # +DA*, +DD* enable 64-bit mode on the HP compiler - # -q* pass through compiler args for the IBM compiler - # -m* pass through architecture-specific compiler args for GCC - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*) - - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - if test "$with_gcc" = "yes" ; then - compiler_flags="$compiler_flags $arg" - fi - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # The PATH hackery in wrapper scripts is required on Windows - # in order for the loader to find any dlls it needs. - $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 - $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Wl,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $wl$flag" - linker_flags="$linker_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - pic_object= - non_pic_object= - - # Read the .lo file - # If there is no directory component, then add one. - case $arg in - */* | *\\*) . $arg ;; - *) . ./$arg ;; - esac - - if test -z "$pic_object" || \ - test -z "$non_pic_object" || - test "$pic_object" = none && \ - test "$non_pic_object" = none; then - $echo "$modename: cannot find name of object for \`$arg'" 1>&2 - exit $EXIT_FAILURE - fi - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - libobjs="$libobjs $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects="$non_pic_objects $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - fi - else - # Only an error if not doing a dry-run. - if test -z "$run"; then - $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 - exit $EXIT_FAILURE - else - # Dry-run case. - - # Extract subdirectory from the argument. - xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$arg"; then - xdir= - else - xdir="$xdir/" - fi - - pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` - non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` - libobjs="$libobjs $pic_object" - non_pic_objects="$non_pic_objects $non_pic_object" - fi - fi - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done # argument parsing loop - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - # Create the object directory. - if test ! -d "$output_objdir"; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then - exit $status - fi - fi - - # Determine the type of output - case $output in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - case $host in - *cygwin* | *mingw* | *pw32*) - # don't eliminate duplications in $postdeps and $predeps - duplicate_compiler_generated_deps=yes - ;; - *) - duplicate_compiler_generated_deps=$duplicate_deps - ;; - esac - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if test "X$duplicate_deps" = "Xyes" ; then - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - libs="$libs $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - case $linkmode in - lib) - passes="conv link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit $EXIT_FAILURE - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - for pass in $passes; do - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - compiler_flags="$compiler_flags $deplib" - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 - continue - fi - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if (${SED} -e '2q' $lib | - grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - library_names= - old_library= - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - if eval $echo \"$deplib\" 2>/dev/null \ - | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - $echo - $echo "*** Warning: Trying to link with static lib archive $deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because the file extensions .$libext of this argument makes me believe" - $echo "*** that it is just a static archive that I should not used here." - else - $echo - $echo "*** Warning: Linking the shared library $output against the" - $echo "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit $EXIT_FAILURE - fi - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - abs_ladir="$ladir" - fi - ;; - esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - $echo "$modename: warning: library \`$lib' was moved." 1>&2 - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi - fi # $installed = yes - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - # This is a shared library - - # Warn about portability, can't link against -module's on - # some systems (darwin) - if test "$shouldnotlink" = yes && test "$pass" = link ; then - $echo - if test "$linkmode" = prog; then - $echo "*** Warning: Linking the executable $output against the loadable module" - else - $echo "*** Warning: Linking the shared library $output against the loadable module" - fi - $echo "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - realname="$2" - shift; shift - libname=`eval \\$echo \"$libname_spec\"` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw*) - major=`expr $current - $age` - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - soname=`$echo $soroot | ${SED} -e 's/^.*\///'` - newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - $show "extracting exported symbol list from \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$extract_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$old_archive_from_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5* ) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a module then we can not link against - # it, someone is ignoring the new warnings I added - if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then - $echo "** Warning, lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $echo - $echo "** And there doesn't seem to be a static archive available" - $echo "** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit $EXIT_FAILURE - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && \ - test "$hardcode_minus_L" != yes && \ - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case "$libdir" in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - case $deplib in - -L*) path="$deplib" ;; - *.la) - dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$deplib" && dir="." - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - fi - ;; - esac - if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - if test "$absdir" != "$libdir"; then - $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 - fi - path="$absdir" - fi - depdepl= - case $host in - *-*-darwin*) - # we do not want to link against static libs, - # but need to link against shared - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$path/$depdepl" ; then - depdepl="$path/$depdepl" - fi - # do not add paths which are already there - case " $newlib_search_path " in - *" $path "*) ;; - *) newlib_search_path="$newlib_search_path $path";; - esac - fi - path="" - ;; - *) - path="-L$path" - ;; - esac - ;; - -l*) - case $host in - *-*-darwin*) - # Again, we only want to link against shared libraries - eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` - for tmp in $newlib_search_path ; do - if test -f "$tmp/lib$tmp_libs.dylib" ; then - eval depdepl="$tmp/lib$tmp_libs.dylib" - break - fi - done - path="" - ;; - *) continue ;; - esac - ;; - *) continue ;; - esac - case " $deplibs " in - *" $depdepl "*) ;; - *) deplibs="$depdepl $deplibs" ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi - - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit $EXIT_FAILURE - else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - if test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 - fi - - set dummy $rpath - if test "$#" -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" - - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$2" - number_minor="$3" - number_revision="$4" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows) - current=`expr $number_major + $number_minor` - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - current=`expr $number_major + $number_minor - 1` - age="$number_minor" - revision="$number_minor" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - if test "$age" -gt "$current"; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - minor_current=`expr $current + 1` - verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - - irix | nonstopux) - major=`expr $current - $age + 1` - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - iface=`expr $revision - $loop` - loop=`expr $loop - 1` - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - major=.`expr $current - $age` - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - major=`expr $current - $age` - versuffix="-$major" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - fi - - if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$echo "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - removelist="$removelist $p" - ;; - *) ;; - esac - done - if test -n "$removelist"; then - $show "${rm}r $removelist" - $run ${rm}r $removelist - fi - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - for path in $notinst_path; do - lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` - deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` - dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` - done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs -framework System" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $rm conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name="`expr $a_deplib : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval $echo \"$potent_lib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` - done - fi - if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ - | grep . >/dev/null; then - $echo - if test "X$deplibs_check_method" = "Xnone"; then - $echo "*** Warning: inter-library dependencies are not supported in this platform." - else - $echo "*** Warning: inter-library dependencies are not known to be supported." - fi - $echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - if len=`expr "X$cmd" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - $show "$cmd" - $run eval "$cmd" || exit $? - skipped_export=false - else - # The command line is too long to execute in one step. - $show "using reloadable object file for export list..." - skipped_export=: - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex"; then - $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $show "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise. - $echo "creating reloadable object files..." - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - output_la=`$echo "X$output" | $Xsed -e "$basename"` - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - delfiles= - last_robj= - k=1 - output=$output_objdir/$output_la-${k}.$objext - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - eval test_cmds=\"$reload_cmds $objlist $last_robj\" - if test "X$objlist" = X || - { len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; }; then - objlist="$objlist $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" - else - # All subsequent reloadable object files will link in - # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - k=`expr $k + 1` - output=$output_objdir/$output_la-${k}.$objext - objlist=$obj - len=1 - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" - - if ${skipped_export-false}; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - libobjs=$output - # Append the command to create the export file. - eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" - fi - - # Set up a command to remove the reloadable object files - # after they are used. - i=0 - while test "$i" -lt "$k" - do - i=`expr $i + 1` - delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" - done - - $echo "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - - # Append the command to remove the reloadable object files - # to the just-reset $cmds. - eval cmds=\"\$cmds~\$rm $delfiles\" - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 - fi - - case $output in - *.lo) - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit $EXIT_FAILURE - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $run $rm $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - cmds=$reload_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; - esac - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 - fi - - if test "$preload" = yes; then - if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && - test "$dlopen_self_static" = unknown; then - $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - fi - fi - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - case $host in - *darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - if test "$tagname" = CXX ; then - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - fi - ;; - esac - - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - case :$dllsearchpath: in - *":$libdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - fi - - dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${outputname}S.c" - else - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - fi - fi - - if test -n "$dlsyms"; then - case $dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${outputname}.nm" - - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - - # Parse the name list into a source file. - $show "creating $output_objdir/$dlsyms" - - test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define lt_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - $show "generating symbol list for \`$output'" - - test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for arg in $progfiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else - $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` - $run eval '$echo ": $name " >> "$nlist"' - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -z "$run"; then - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if grep -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - grep -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - - $echo >> "$output_objdir/$dlsyms" "\ - -#undef lt_preloaded_symbols - -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -" - - case $host in - *cygwin* | *mingw* ) - $echo >> "$output_objdir/$dlsyms" "\ -/* DATA imports from DLLs on WIN32 can't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs */ -struct { -" - ;; - * ) - $echo >> "$output_objdir/$dlsyms" "\ -const struct { -" - ;; - esac - - - $echo >> "$output_objdir/$dlsyms" "\ - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = -{\ -" - - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" - - $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - fi - - pic_flag_for_symtable= - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; - esac - esac - - # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # Clean up the generated files. - $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" - $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" - - # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - status=$? - - # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" - fi - - exit $status - fi - - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $run $rm $output - # Link the executable and exit - $show "$link_command" - $run eval "$link_command" || exit $? - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 - $echo "$modename: \`$output' will be relinked during installation" 1>&2 - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname - - $show "$link_command" - $run eval "$link_command" || exit $? - - # Now create the wrapper script. - $show "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; - esac - qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - fi - - # Only actually do things if our run command is non-null. - if test -z "$run"; then - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - cwrappersource=`$echo ${objdir}/lt-${outputname}.c` - cwrapper=`$echo ${output}.exe` - $rm $cwrappersource $cwrapper - trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - cat > $cwrappersource <> $cwrappersource<<"EOF" -#include -#include -#include -#include -#include -#include - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef DIR_SEPARATOR -#define DIR_SEPARATOR '/' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -#define HAVE_DOS_BASED_FILE_SYSTEM -#ifndef DIR_SEPARATOR_2 -#define DIR_SEPARATOR_2 '\\' -#endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -const char *program_name = NULL; - -void * xmalloc (size_t num); -char * xstrdup (const char *string); -char * basename (const char *name); -char * fnqualify(const char *path); -char * strendzap(char *str, const char *pat); -void lt_fatal (const char *message, ...); - -int -main (int argc, char *argv[]) -{ - char **newargz; - int i; - - program_name = (char *) xstrdup ((char *) basename (argv[0])); - newargz = XMALLOC(char *, argc+2); -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" - newargz[1] = fnqualify(argv[0]); - /* we know the script has the same name, without the .exe */ - /* so make sure newargz[1] doesn't end in .exe */ - strendzap(newargz[1],".exe"); - for (i = 1; i < argc; i++) - newargz[i+1] = xstrdup(argv[i]); - newargz[argc+1] = NULL; -EOF - - cat >> $cwrappersource <> $cwrappersource <<"EOF" -} - -void * -xmalloc (size_t num) -{ - void * p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL -; -} - -char * -basename (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha (name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return (char *) base; -} - -char * -fnqualify(const char *path) -{ - size_t size; - char *p; - char tmp[LT_PATHMAX + 1]; - - assert(path != NULL); - - /* Is it qualified already? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha (path[0]) && path[1] == ':') - return xstrdup (path); -#endif - if (IS_DIR_SEPARATOR (path[0])) - return xstrdup (path); - - /* prepend the current directory */ - /* doesn't handle '~' */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ - p = XMALLOC(char, size); - sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); - return p; -} - -char * -strendzap(char *str, const char *pat) -{ - size_t len, patlen; - - assert(str != NULL); - assert(pat != NULL); - - len = strlen(str); - patlen = strlen(pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp(str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char * mode, - const char * message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} -EOF - # we should really use a build-platform specific compiler - # here, but OTOH, the wrappers (shell script and this C one) - # are only useful if you want to execute the "real" binary. - # Since the "real" binary is built for $host, then this - # wrapper might as well be built for $host, too. - $run $LTCC -s -o $cwrapper $cwrappersource - ;; - esac - $rm $output - trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - echo=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$echo works! - : - else - # Restart under the correct shell, and then maybe \$echo will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $echo >> $output "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $mkdir \"\$progdir\" - else - $rm \"\$progdir/\$file\" - fi" - - $echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $echo \"\$relink_command_output\" >&2 - $rm \"\$progdir/\$file\" - exit $EXIT_FAILURE - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - $echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2*) - $echo >> $output "\ - exec \$progdir\\\\\$program \${1+\"\$@\"} -" - ;; - - *) - $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit $EXIT_FAILURE - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit $EXIT_FAILURE - fi -fi\ -" - chmod +x $output - fi - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - eval cmds=\"$old_archive_cmds\" - - if len=`expr "X$cmds" : ".*"` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - $echo "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - # GNU ar 2.10+ was changed to match POSIX; thus no paths are - # encoded into archives. This makes 'ar r' malfunction in - # this piecewise linking case whenever conflicting object - # names appear in distinct ar calls; check, warn and compensate. - if (for obj in $save_oldobjs - do - $echo "X$obj" | $Xsed -e 's%^.*/%%' - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 - $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 - AR_FLAGS=cq - fi - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - for obj in $save_oldobjs - do - oldobjs="$objlist $obj" - objlist="$objlist $obj" - eval test_cmds=\"$old_archive_cmds\" - if len=`expr "X$test_cmds" : ".*"` && - test "$len" -le "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - eval cmd=\"$cmd\" - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - - # Only create the output if not a dry run. - if test -z "$run"; then - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - for lib in $dlfiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdlfiles="$newdlfiles $libdir/$name" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit $EXIT_FAILURE - fi - newdlprefiles="$newdlprefiles $libdir/$name" - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles="$newdlfiles $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles="$newdlprefiles $abs" - done - dlprefiles="$newdlprefiles" - fi - $rm $output - # place dlname in correct position for cygwin - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; - esac - $echo > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $echo >> $output "\ -relink_command=\"$relink_command\"" - fi - done - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? - ;; - esac - exit $EXIT_SUCCESS - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg="$nonopt" - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest="$arg" - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; - -s) - stripme=" -s" - continue - ;; - -*) ;; - - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest="$arg" - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "") - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test "$#" -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - library_names= - old_library= - relink_command= - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - if test "$inst_prefix_dir" = "$destdir"; then - $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - $echo "$modename: warning: relinking \`$file'" 1>&2 - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit $EXIT_FAILURE - fi - fi - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$srcname $destdir/$realname" - $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? - if test -n "$stripme" && test -n "$striplib"; then - $show "$striplib $destdir/$realname" - $run eval "$striplib $destdir/$realname" || exit $? - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - for linkname - do - if test "$linkname" != "$realname"; then - $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - cmds=$postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - file=`$echo $file|${SED} 's,.exe$,,'` - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin*|*mingw*) - wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` - ;; - *) - wrapper=$file - ;; - esac - if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then - notinst_deplibs= - relink_command= - - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac - # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; - esac - - # Check the variables that should have been set. - if test -z "$notinst_deplibs"; then - $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 - exit $EXIT_FAILURE - fi - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - relink_command= - # To insure that "foo" is sourced, and not "foo.exe", - # finese the cygwin/MSYS system by explicitly sourcing "foo." - # which disallows the automatic-append-.exe behavior. - case $build in - *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; - *) wrapperdot=${wrapper} ;; - esac - # If there is no directory component, then add one. - case $file in - */* | *\\*) . ${wrapperdot} ;; - *) . ./${wrapperdot} ;; - esac - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - save_umask=`umask` - umask 0077 - if $mkdir "$tmpdir"; then - umask $save_umask - else - umask $save_umask - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi - file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyways - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` - ;; - esac - ;; - esac - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - if test -n "$stripme" && test -n "$old_striplib"; then - $show "$old_striplib $oldlib" - $run eval "$old_striplib $oldlib" || exit $? - fi - - # Do each command in the postinstall commands. - cmds=$old_postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - cmds=$finish_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = : && exit $EXIT_SUCCESS - - $echo "----------------------------------------------------------------------" - $echo "Libraries have been installed in:" - for libdir in $libdirs; do - $echo " $libdir" - done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" - fi - if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" - exit $EXIT_SUCCESS - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit $EXIT_FAILURE - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit $EXIT_FAILURE - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # Now prepare to actually exec the command. - exec_cmd="\"\$cmd\"$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi - eval \$echo \"\$cmd\"$args - exit $EXIT_SUCCESS - fi - ;; - - # libtool clean and uninstall mode - clean | uninstall) - modename="$modename: $mode" - rm="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) rm="$rm $arg"; rmforce=yes ;; - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - rmdirs= - - origobjdir="$objdir" - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$file"; then - dir=. - objdir="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if (test -L "$file") >/dev/null 2>&1 \ - || (test -h "$file") >/dev/null 2>&1 \ - || test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - - if test "$mode" = uninstall; then - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - cmds=$postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - cmds=$old_postuninstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" - if test "$?" -ne 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - # FIXME: should reinstall the best remaining shared library. - fi - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - - # Read the .lo file - . $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" \ - && test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" \ - && test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - file=`$echo $file|${SED} 's,.exe$,,'` - noexename=`$echo $name|${SED} 's,.exe$,,'` - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$noexename - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - $show "$rm $rmfiles" - $run $rm $rmfiles || exit_status=1 - done - objdir="$origobjdir" - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - $show "rmdir $dir" - $run rmdir $dir >/dev/null 2>&1 - fi - done - - exit $exit_status - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - if test -z "$exec_cmd"; then - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - fi -fi # test -z "$show_help" - -if test -n "$exec_cmd"; then - eval exec $exec_cmd - exit $EXIT_FAILURE -fi - -# We need to display help for each of the modes. -case $mode in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - - --config show all configuration variables - --debug enable verbose shell tracing --n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG - --version print version information - -MODE must be one of the following: - - clean remove files from the build directory - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to ." - exit $EXIT_SUCCESS - ;; - -clean) - $echo \ -"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -static always build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - -uninstall) - $echo \ -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; -esac - -$echo -$echo "Try \`$modename --help' for more information about other modes." - -exit $? - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/missing b/missing deleted file mode 100755 index 09edd884..00000000 --- a/missing +++ /dev/null @@ -1,357 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2005-02-08.22 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# 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. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - touch $file - ;; - - tar) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: From 7aebba2e12f31e254cde40216ff16c2546459e33 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 29 Jul 2005 21:37:09 +0000 Subject: [PATCH 2421/2994] minor improvements to index.h and ntfsmount.c --- include/ntfs/index.h | 4 ++-- ntfsprogs/ntfsmount.c | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/ntfs/index.h b/include/ntfs/index.h index d7bfbc6f..5330a61e 100644 --- a/include/ntfs/index.h +++ b/include/ntfs/index.h @@ -31,7 +31,7 @@ /** * @ni: inode containing the @entry described by this context - * @name: name of the which context describes + * @name: name of the index described by this context * @name_len: length of the index name * @entry: index entry (points into @ir or @ia) * @data: index entry data (points into @entry) @@ -115,5 +115,5 @@ static inline void ntfs_index_entry_mark_dirty(ntfs_index_context *ictx) else ictx->ia_dirty = TRUE; } -#endif /* _NTFS_INDEX_H */ +#endif /* _NTFS_INDEX_H */ diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 65c90dde..0726480f 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -304,8 +304,11 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx, if (name_type == FILE_NAME_DOS) return 0; - if (ntfs_ucstombs(name, name_len, &filename, 0) < 0) - return -errno; + if (ntfs_ucstombs(name, name_len, &filename, 0) < 0) { + Eprintf("Skipping unrepresentable file (inode %lld): %s\n", + MREF(mref), strerror(errno)); + return 0; + } if (MREF(mref) >= FILE_first_user || ctx->show_sys_files) fill_ctx->filler(fill_ctx->buf, filename, NULL, 0); free(filename); @@ -955,6 +958,15 @@ static char *parse_options(char *options, char **device) } ctx->ro =TRUE; strcat(ret, "ro,"); +#ifdef DEBUG + } else if (!strcmp(opt, "fake_ro")) { + if (val) { + Eprintf("fake_ro option should not have " + "value.\n"); + goto err_exit; + } + ctx->ro =TRUE; +#endif } else if (!strcmp(opt, "fsname")) { /* Filesystem name. */ /* * We need this to be able to check whether filesystem From d292ae2d27170027381d9652485fdb98983ec157 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 30 Jul 2005 16:36:24 +0000 Subject: [PATCH 2422/2994] Fix random errno returned by ntfs_inode_open() if the MFT record wasn't in use --- ChangeLog | 2 ++ libntfs/inode.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 88ec652e..4e8d54bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,8 @@ xx/xx/xxxx - 1.12.0-WIP - Fix unistr.c::ntfs_mbstoucs on systems with utf8 locale. (Yura) - Change errno and print more verbose message in case if logfile check failed. (Yura) + - Fix random errno returned by ntfs_inode_open() if the MFT record + wasn't in use. (Szaka) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/libntfs/inode.c b/libntfs/inode.c index 26d2fcdc..f76c44a8 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -123,8 +123,10 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) return NULL; if (ntfs_file_record_read(vol, mref, &ni->mrec, NULL)) goto err_out; - if (!(ni->mrec->flags & MFT_RECORD_IN_USE)) + if (!(ni->mrec->flags & MFT_RECORD_IN_USE)) { + err = ENOENT; goto err_out; + } ni->mft_no = MREF(mref); ni->data_size = -1; ni->allocated_size = -1; From 03556cdd8b14282c3ef3a9d997f04306311aeee7 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 30 Jul 2005 17:00:00 +0000 Subject: [PATCH 2423/2994] Remove the last remained, autogenerated file --- .cvsignore | 1 + INSTALL | 236 ---------------------------------------------------- Makefile.am | 2 +- 3 files changed, 2 insertions(+), 237 deletions(-) delete mode 100644 INSTALL diff --git a/.cvsignore b/.cvsignore index 6e23d7da..037d4b19 100644 --- a/.cvsignore +++ b/.cvsignore @@ -20,3 +20,4 @@ install-sh stamp-h.in ltconfig missing +INSTALL diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 56b077d6..00000000 --- a/INSTALL +++ /dev/null @@ -1,236 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free -Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is -disabled by default to prevent problems with accidental use of stale -cache files.) - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. - -Installation Names -================== - -By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PREFIX', the package will -use PREFIX as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the `--target=TYPE' option to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: - - /bin/bash ./configure CONFIG_SHELL=/bin/bash - -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/Makefile.am b/Makefile.am index 76f6450d..222799c3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,7 +8,7 @@ EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ AUTOMAKE_OPTIONS = gnu MAINTAINERCLEANFILES = configure Makefile.in aclocal.m4 compile depcomp \ - install-sh missing config.guess config.sub config.h.in + install-sh missing config.guess config.sub config.h.in INSTALL dist-hook: ntfsprogs.spec cp ntfsprogs.spec $(distdir) From f7e5e1cc262f2eeb3ab3557145b30a7f8922c152 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 1 Aug 2005 13:40:51 +0000 Subject: [PATCH 2424/2994] * Fix ntfs_attr_p{read,write}. (see Changelog) * Minor fixes and some stubs for uncommitted code. * Update README about ./autogen.sh. --- ChangeLog | 2 ++ README | 1 + libntfs/attrib.c | 22 +++++++++++++-- ntfsprogs/ntfsmount.c | 65 ++++++++++++++++++++++++------------------- 4 files changed, 58 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e8d54bc..740e1f5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,8 @@ xx/xx/xxxx - 1.12.0-WIP failed. (Yura) - Fix random errno returned by ntfs_inode_open() if the MFT record wasn't in use. (Szaka) + - Fix ntfs_attr_p{read,write} to not return less bytes if trapped on + unmapped runlist region. (Yura) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/README b/README index 86e246f9..6beb234b 100644 --- a/README +++ b/README @@ -47,6 +47,7 @@ Quick Installation In most cases it should be sufficient to do: + ./autogen.sh <-- Only in case you received source from CVS. ./configure make make install <-- You usually need to be root for this one. diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 0e7d79d9..78c6baf7 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -810,6 +810,14 @@ res_err_out: */ ofs = pos - (rl->vcn << vol->cluster_size_bits); for (; count; rl++, ofs = 0) { + if (rl->lcn == LCN_RL_NOT_MAPPED) { + rl = ntfs_attr_find_vcn(na, rl->vcn); + if (!rl) { + if (errno == ENOENT) + errno = EIO; + goto rl_err_out; + } + } if (!rl->length) goto rl_err_out; if (rl->lcn < (LCN)0) { @@ -829,9 +837,9 @@ res_err_out: to_read = min(count, (rl->length << vol->cluster_size_bits) - ofs); retry: - Dprintf("%s(): Reading 0x%llx bytes from vcn 0x%llx, lcn 0x%llx, " - "ofs 0x%llx.\n", __FUNCTION__, to_read, - rl->vcn, rl->lcn, ofs); + Dprintf("%s(): Reading 0x%llx bytes from vcn 0x%llx, " + "lcn 0x%llx, ofs 0x%llx.\n", __FUNCTION__, + to_read, rl->vcn, rl->lcn, ofs); br = ntfs_pread(vol->dev, (rl->lcn << vol->cluster_size_bits) + ofs, to_read, b); /* If everything ok, update progress counters and continue. */ @@ -1049,6 +1057,14 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) */ ofs = pos - (rl->vcn << vol->cluster_size_bits); for (; count; rl++, ofs = 0) { + if (rl->lcn == LCN_RL_NOT_MAPPED) { + rl = ntfs_attr_find_vcn(na, rl->vcn); + if (!rl) { + if (errno == ENOENT) + errno = EIO; + goto rl_err_out; + } + } if (!rl->length) { errno = EIO; goto rl_err_out; diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 0726480f..b9754320 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -44,6 +44,7 @@ #include "dir.h" #include "unistr.h" #include "layout.h" +#include "index.h" #include "utils.h" typedef struct { @@ -253,7 +254,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY && !stream_name_len) { stbuf->st_mode = S_IFDIR | (0777 & ~ctx->dmask); - na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, I30, 0); + na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, I30, 4); if (na) { stbuf->st_size = na->data_size; stbuf->st_blocks = na->allocated_size >> @@ -355,14 +356,13 @@ static int ntfs_fuse_open(const char *org_path, vol = ctx->vol; ni = ntfs_pathname_to_inode(vol, NULL, path); if (ni) { - if (stream_name_len) { - na = ntfs_attr_open(ni, AT_DATA, stream_name, - stream_name_len); - if (na) - ntfs_attr_close(na); - else - res = -errno; - } + na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); + if (na) { + if (NAttrEncrypted(na)) + res = -EACCES; + ntfs_attr_close(na); + } else + res = -errno; ntfs_inode_close(ni); } else res = -errno; @@ -398,6 +398,8 @@ static int ntfs_fuse_read(const char *org_path, char *buf, size_t size, goto exit; } res = ntfs_attr_pread(na, offset, size, buf); + if (res == -1) + res = -errno; ntfs_attr_close(na); exit: if (ni && ntfs_inode_close(ni)) @@ -434,6 +436,10 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, goto exit; } res = ntfs_attr_pwrite(na, offset, size, buf); + if (res == -1) + res = -errno; + if (res < size) + perror("ntfs_attr_pwrite returned less than requested."); ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); ntfs_attr_close(na); exit: @@ -529,6 +535,11 @@ exit: return res; } +static int ntfs_fuse_rm_file(char *file) +{ + return -EOPNOTSUPP; +} + static int ntfs_fuse_unlink(const char *org_path) { ntfs_inode *ni = NULL; @@ -541,15 +552,11 @@ static int ntfs_fuse_unlink(const char *org_path) stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); if (stream_name_len < 0) return stream_name_len; - if (!stream_name_len) { - res = -EOPNOTSUPP; - goto exit; - } + if (!stream_name_len) + return ntfs_fuse_rm_file(path); ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); if (!ni) { res = -errno; - if (res == -ENOENT) - res = -EOPNOTSUPP; goto exit; } na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); @@ -935,7 +942,7 @@ static char *parse_options(char *options, char **device) opt = strsep(&val, "="); if (!strcmp(opt, "dev")) { /* Device to mount. */ if (!val) { - Eprintf("dev option should have value.\n"); + Eprintf("'dev' option should have value.\n"); goto err_exit; } *device = malloc(PATH_MAX + 1); @@ -953,7 +960,7 @@ static char *parse_options(char *options, char **device) strcpy(*device, val); } else if (!strcmp(opt, "ro")) { /* Read-only mount. */ if (val) { - Eprintf("ro option should not have value.\n"); + Eprintf("'ro' option should not have value.\n"); goto err_exit; } ctx->ro =TRUE; @@ -961,7 +968,7 @@ static char *parse_options(char *options, char **device) #ifdef DEBUG } else if (!strcmp(opt, "fake_ro")) { if (val) { - Eprintf("fake_ro option should not have " + Eprintf("'fake_ro' option should not have " "value.\n"); goto err_exit; } @@ -972,63 +979,63 @@ static char *parse_options(char *options, char **device) * We need this to be able to check whether filesystem * mounted or not. */ - Eprintf("fsname is unsupported option.\n"); + Eprintf("'fsname' is unsupported option.\n"); goto err_exit; } else if (!strcmp(opt, "no_def_opts")) { if (val) { - Eprintf("no_def_opts option should not have " + Eprintf("'no_def_opts' option should not have " "value.\n"); goto err_exit; } no_def_opts = TRUE; /* Don't add default options. */ } else if (!strcmp(opt, "umask")) { if (!val) { - Eprintf("umask option should have value.\n"); + Eprintf("'umask' option should have value.\n"); goto err_exit; } sscanf(val, "%i", &ctx->fmask); ctx->dmask = ctx->fmask; } else if (!strcmp(opt, "fmask")) { if (!val) { - Eprintf("fmask option should have value.\n"); + Eprintf("'fmask' option should have value.\n"); goto err_exit; } sscanf(val, "%i", &ctx->fmask); } else if (!strcmp(opt, "dmask")) { if (!val) { - Eprintf("dmask option should have value.\n"); + Eprintf("'dmask' option should have value.\n"); goto err_exit; } sscanf(val, "%i", &ctx->dmask); } else if (!strcmp(opt, "uid")) { if (!val) { - Eprintf("uid option should have value.\n"); + Eprintf("'uid' option should have value.\n"); goto err_exit; } sscanf(val, "%i", &ctx->uid); } else if (!strcmp(opt, "gid")) { if (!val) { - Eprintf("gid option should have value.\n"); + Eprintf("'gid' option should have value.\n"); goto err_exit; } sscanf(val, "%i", &ctx->gid); } else if (!strcmp(opt, "show_sys_files")) { if (val) { - Eprintf("show_sys_files option should not " + Eprintf("'show_sys_files' option should not " "have value.\n"); goto err_exit; } ctx->show_sys_files = TRUE; } else if (!strcmp(opt, "succeed_chmod")) { if (val) { - Eprintf("succeed_chmod option should not " + Eprintf("'succeed_chmod' option should not " "have value.\n"); goto err_exit; } ctx->succeed_chmod = TRUE; } else if (!strcmp(opt, "force")) { if (val) { - Eprintf("force option should not " + Eprintf("'force' option should not " "have value.\n"); goto err_exit; } @@ -1100,7 +1107,7 @@ int main(int argc, char *argv[]) /* Parse options. */ parsed_options = parse_options(options, &device); if (!device) { - Eprintf("dev option is mandatory.\n"); + Eprintf("'dev' option is mandatory.\n"); ntfs_fuse_destroy(); return 2; } From 78297900bd91aaeab95597f2a62758449c869ebe Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 1 Aug 2005 20:22:24 +0000 Subject: [PATCH 2425/2994] Let the user know if the journal file couldn't be checked or was unlean --- ntfsprogs/ntfsresize.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index bc05ae3b..88d2c6d2 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -83,6 +83,11 @@ static const char *hibernated_volume_msg = "Apparently the NTFS partition is hibernated. Windows must be resumed and\n" "turned off properly, thus resizing will be possible later on.\n"; +static const char *unclean_journal_msg = +"Apparently the NTFS journal file is unclean. Please shutdown Windows\n" +"properly before using this software. If it wouldn't help then please\n" +"report it to linux-ntfs-dev@lists.sf.net. Thank you.\n"; + static const char *bad_sectors_warning_msg = "****************************************************************************\n" "* WARNING: The disk has bad sector. This means physical damage on the disk *\n" @@ -2179,7 +2184,9 @@ static ntfs_volume *mount_volume(void) printf(corrupt_volume_msg); else if (err == EPERM) printf(hibernated_volume_msg); - exit(1); + else if (err == EOPNOTSUPP) /* NOTE: same as ENOTSUP !!! */ + printf(unclean_journal_msg); + exit(1); } if (vol->flags & VOLUME_IS_DIRTY) From cebd8ec1329a4a5b173d458dd994ed865e8edfba Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 1 Aug 2005 20:33:26 +0000 Subject: [PATCH 2426/2994] White space cleanup --- ntfsprogs/ntfsresize.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 88d2c6d2..10174831 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1688,7 +1688,7 @@ static void relocate_attributes(ntfs_resize_t *resize, int do_mftdata) else if (ret == 1) continue; - if (resize->mref == FILE_Bitmap && + if (resize->mref == FILE_Bitmap && resize->ctx->attr->type == AT_DATA) continue; @@ -1827,7 +1827,7 @@ static void rl_expand(runlist **rl, const VCN last_vcn) rl_set(p + len - 1, last_vcn, LCN_ENOENT, 0LL); *rl = p; - } else + } else err_exit("ntfs_rl_expand: bad LCN: %lld\n", p[len - 2].lcn); } @@ -2186,7 +2186,7 @@ static ntfs_volume *mount_volume(void) printf(hibernated_volume_msg); else if (err == EOPNOTSUPP) /* NOTE: same as ENOTSUP !!! */ printf(unclean_journal_msg); - exit(1); + exit(1); } if (vol->flags & VOLUME_IS_DIRTY) @@ -2260,7 +2260,7 @@ static void check_resize_constraints(ntfs_resize_t *resize) if (resize->badclusters) { printf("%sThe NTFS volume has at least %lld bad sector%s.\n", !opt.badsectors ? NERR_PREFIX : "", - resize->badclusters, + resize->badclusters, resize->badclusters - 1 ? "s" : ""); if (!opt.badsectors) { printf(bad_sectors_warning_msg); From fd2e6eb09d2d292414a895170369ca0650f4f647 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 1 Aug 2005 22:04:27 +0000 Subject: [PATCH 2427/2994] ntfsmount: fix nr_links for directories. --- ChangeLog | 1 + ntfsprogs/ntfsmount.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 740e1f5d..c5643dbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ xx/xx/xxxx - 1.12.0-WIP wasn't in use. (Szaka) - Fix ntfs_attr_p{read,write} to not return less bytes if trapped on unmapped runlist region. (Yura) + - Make find work correctly on volumes mounted by ntfsmount. (Yura) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index b9754320..aa2c96c9 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -264,6 +264,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) stbuf->st_size = 0; stbuf->st_blocks = 0; } + stbuf->st_nlink = 1; /* Needed for correct find work. */ } else { stbuf->st_mode = S_IFREG | (0777 & ~ctx->fmask); na = ntfs_attr_open(ni, AT_DATA, stream_name, @@ -279,11 +280,11 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) if (stream_name_len) res = -ENOENT; } + stbuf->st_nlink = le16_to_cpu(ni->mrec->link_count); } stbuf->st_uid = ctx->uid; stbuf->st_gid = ctx->gid; stbuf->st_ino = ni->mft_no; - stbuf->st_nlink = le16_to_cpu(ni->mrec->link_count); stbuf->st_atime = ni->atime; stbuf->st_ctime = ni->ctime; stbuf->st_mtime = ni->mtime; From 06052dafcfa5b4d178fafae67a4eab5ee9cd8a9c Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 1 Aug 2005 22:10:38 +0000 Subject: [PATCH 2428/2994] Replaced all occurances of ENOTSUP to EOPNOTSUPP to be in better harmony with the kernel driver --- ChangeLog | 11 +++++++---- libntfs/attrib.c | 24 ++++++++++++------------ libntfs/device.c | 12 ++++++------ libntfs/mft.c | 4 ++-- libntfs/volume.c | 8 ++++---- libntfs/win32_io.c | 12 ++++++------ ntfsprogs/decrypt.c | 4 ++-- ntfsprogs/mkntfs.c | 26 +++++++++++++------------- ntfsprogs/ntfsresize.c | 2 +- 9 files changed, 53 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5643dbb..e7da835c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,8 @@ xx/xx/xxxx - 1.12.0-WIP - Fix ntfs_attr_p{read,write} to not return less bytes if trapped on unmapped runlist region. (Yura) - Make find work correctly on volumes mounted by ntfsmount. (Yura) + - Replaced all occurances of ENOTSUP to EOPNOTSUPP to be in better + harmony with the kernel driver. (Szaka) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. @@ -475,10 +477,11 @@ xx/xx/xxxx - 1.12.0-WIP text and other little bits. - Add --disable-default-device-io-ops option to ./configure which makes for a smaller libntfs but results in ntfs_mount() always returning - error with errno set to ENOTSUP. You need to use ntfs_device_mount() - instead. This only makes sense with "make libs" and when an - application linking statically against libntfs provides its own - device io operations. (Feature requested by Christophe Grenier.) + error with errno set to EOPNOTSUPP. You need to use + ntfs_device_mount() instead. This only makes sense with "make libs" + and when an application linking statically against libntfs provides + its own device io operations. (Feature requested by + Christophe Grenier.) - Fix a duplicated free() in mkntfs. (Andras Erdei) - Fix option display in mkntfs. (Andras Erdei) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 78c6baf7..72606409 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -85,7 +85,7 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, if (a->flags) { Dputs("Encountered non-zero attribute flags. Cannot handle " "this yet."); - errno = ENOTSUP; + errno = EOPNOTSUPP; return 0; } if (!a->non_resident) { @@ -920,7 +920,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) // TODO: Implement writing compressed attributes! (AIA) // return ntfs_attr_pwrite_compressed(ntfs_attr *na, // const s64 pos, s64 count, void *b); - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } if (!count) @@ -1292,7 +1292,7 @@ rl_err_out: goto done; // TODO: Need to try to change initialized_size. If it // succeeds goto done, otherwise goto err_out. (AIA) - errno = ENOTSUP; + errno = EOPNOTSUPP; goto err_out; } goto done; @@ -3810,11 +3810,11 @@ put_err_out: * * Return 0 on success and -1 on error with errno set to the error code. The * following error codes are defined: - * EINVAL - Invalid arguments passed. - * EPERM - The attribute is not allowed to be resident. - * EIO - I/O error, damaged inode or bug. - * ENOSPC - There is no enough space to perform conversion. - * ENOTSUP - Requested conversion is not supported yet. + * EINVAL - Invalid arguments passed. + * EPERM - The attribute is not allowed to be resident. + * EIO - I/O error, damaged inode or bug. + * ENOSPC - There is no enough space to perform conversion. + * EOPNOTSUPP - Requested conversion is not supported yet. * * Warning: We do not set the inode dirty and we do not write out anything! * We expect the caller to do this as this is a fairly low level @@ -3870,7 +3870,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) Dprintf("%s(): Making compressed or encrypted files " "resident is not implemented yet.\n", __FUNCTION__); - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } @@ -4812,8 +4812,8 @@ put_err_out: * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: - * EINVAL - Invalid arguments were passed to the function. - * ENOTSUP - The desired resize is not implemented yet. + * EINVAL - Invalid arguments were passed to the function. + * EOPNOTSUPP - The desired resize is not implemented yet. */ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) { @@ -4840,7 +4840,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) * TODO: Implement making handling of compressed attributes. */ if (NAttrCompressed(na)) { - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } if (NAttrNonResident(na)) { diff --git a/libntfs/device.c b/libntfs/device.c index d545b4c9..2e95bb77 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -529,7 +529,7 @@ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) * * The following error codes are defined: * EINVAL Input parameter error - * ENOTSUP System does not support HDIO_GETGEO ioctl + * EOPNOTSUPP System does not support HDIO_GETGEO ioctl * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO */ s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev) @@ -548,7 +548,7 @@ s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev) } } #else - errno = ENOTSUP; + errno = EOPNOTSUPP; #endif return -1; } @@ -562,7 +562,7 @@ s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev) * * The following error codes are defined: * EINVAL Input parameter error - * ENOTSUP System does not support HDIO_GETGEO ioctl + * EOPNOTSUPP System does not support HDIO_GETGEO ioctl * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO */ int ntfs_device_heads_get(struct ntfs_device *dev) @@ -582,7 +582,7 @@ int ntfs_device_heads_get(struct ntfs_device *dev) } } #else - errno = ENOTSUP; + errno = EOPNOTSUPP; #endif return -1; } @@ -596,7 +596,7 @@ int ntfs_device_heads_get(struct ntfs_device *dev) * * The following error codes are defined: * EINVAL Input parameter error - * ENOTSUP System does not support HDIO_GETGEO ioctl + * EOPNOTSUPP System does not support HDIO_GETGEO ioctl * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO */ int ntfs_device_sectors_per_track_get(struct ntfs_device *dev) @@ -616,7 +616,7 @@ int ntfs_device_sectors_per_track_get(struct ntfs_device *dev) } } #else - errno = ENOTSUP; + errno = EOPNOTSUPP; #endif return -1; } diff --git a/libntfs/mft.c b/libntfs/mft.c index 625778db..055c581e 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -667,7 +667,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) ntfs_error(vol->sb, "Not enough space in this mft record to " "accommodate extended mft bitmap attribute " "extent. Cannot handle this yet."); - errno = ENOTSUP; + errno = EOPNOTSUPP; goto undo_alloc; } status.mp_rebuilt = 1; @@ -989,7 +989,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) ntfs_error(vol->sb, "Not enough space in this mft record to " "accommodate extended mft data attribute " "extent. Cannot handle this yet."); - errno = ENOTSUP; + errno = EOPNOTSUPP; goto undo_alloc; } mp_rebuilt = TRUE; diff --git a/libntfs/volume.c b/libntfs/volume.c index db786ef2..de62914d 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1151,7 +1151,7 @@ ntfs_volume *ntfs_mount(const char *name __attribute__((unused)), * defined as there are no device operations available in libntfs in * this case. */ - errno = ENOTSUP; + errno = EOPNOTSUPP; return NULL; #endif } @@ -1341,8 +1341,8 @@ int ntfs_check_if_mounted(const char *file __attribute__((unused)), * Return 0 if NTFS version is supported otherwise -1 with errno set. * * The following error codes are defined: - * ENOTSUP Unknown NTFS version - * EINVAL Invalid argument + * EOPNOTSUPP - Unknown NTFS version + * EINVAL - Invalid argument */ int ntfs_version_is_supported(ntfs_volume *vol) { @@ -1365,7 +1365,7 @@ int ntfs_version_is_supported(ntfs_volume *vol) if (NTFS_V3_0(major, minor) || NTFS_V3_1(major, minor)) return 0; - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 10d5cdd2..f6406416 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -127,7 +127,7 @@ static int ntfs_w32error_to_errno(unsigned int w32error) case ERROR_NEGATIVE_SEEK: return ESPIPE; case ERROR_NOT_SUPPORTED: - return ENOTSUP; + return EOPNOTSUPP; case ERROR_BAD_NETPATH: return ENOSHARE; default: @@ -787,7 +787,7 @@ static int ntfs_device_win32_open_partition(int drive_id, "volumes are not supported in " "R/W status yet"); CloseHandle(handle); - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } fd->vol_handle = INVALID_HANDLE_VALUE; @@ -895,7 +895,7 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, if (fd->part_length == -1) { Dputs("win32_seek(): Error: Position relative to end " "of disk not implemented."); - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } abs_ofs = fd->part_length + offset; @@ -1404,7 +1404,7 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, *(int *)argp = (int)(fd->part_length / 512); return 0; } - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; #endif #if defined(BLKGETSIZE64) @@ -1414,7 +1414,7 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, *(s64 *)argp = fd->part_length; return 0; } - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; #endif #ifdef HDIO_GETGEO @@ -1429,7 +1429,7 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, #endif default: Dprintf("win32_ioctl(): unimplemented ioctl %d.\n", request); - errno = ENOTSUP; + errno = EOPNOTSUPP; return -1; } } diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 0bb6ec42..416cb94b 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -320,7 +320,7 @@ decrypt_key_open_err: fnCertFreeCertificateContext(pCert); errno = EINVAL; #else /* !defined(__CYGWIN__) */ - errno = ENOTSUP; + errno = EOPNOTSUPP; #endif /* !defined(__CYGWIN__) */ return NULL; } @@ -722,7 +722,7 @@ ntfs_decrypt_data_key *ntfs_decrypt_data_key_open(unsigned char *data, "and say that you saw this message. We will " "then implement support for DES.\n"); free(key); - errno = ENOTSUP; + errno = EOPNOTSUPP; return NULL; } if (key_size != wanted_key_size) { diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index b1b55a28..13fe6745 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1226,7 +1226,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, } if (ic == IGNORE_CASE) { Eprintf("FIXME: Hit unimplemented code path #1.\n"); - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (!ntfs_attr_lookup(type, uname, name_len, ic, 0, NULL, 0, ctx)) { @@ -1243,12 +1243,12 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, Eprintf("Compressed attributes not supported yet.\n"); // FIXME: Compress attribute into a temporary buffer, set // val accordingly and save the compressed size. - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (flags & (ATTR_IS_ENCRYPTED || ATTR_IS_SPARSE)) { Eprintf("Encrypted/sparse attributes not supported yet.\n"); - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (flags & ATTR_COMPRESSION_MASK) { @@ -1299,7 +1299,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, // record. // FIXME: the check for needing extension records should be // earlier on as it is very quick: asize > m->bytes_allocated? - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } #ifdef DEBUG @@ -1341,7 +1341,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, a->compressed_size = cpu_to_le64(0); // FIXME: Write out the compressed data. // FIXME: err = build_mapping_pairs_compressed(); - err = -ENOTSUP; + err = -EOPNOTSUPP; } else { a->compression_unit = 0; bw = ntfs_rlwrite(vol->dev, rl, val, val_len, &inited_size); @@ -1411,7 +1411,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, } if (ic == IGNORE_CASE) { Eprintf("FIXME: Hit unimplemented code path #2.\n"); - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (!ntfs_attr_lookup(type, uname, name_len, ic, 0, NULL, 0, ctx)) { @@ -1428,12 +1428,12 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, Eprintf("Compressed attributes not supported yet.\n"); // FIXME: Compress attribute into a temporary buffer, set // val accordingly and save the compressed size. - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (flags & (ATTR_IS_ENCRYPTED || ATTR_IS_SPARSE)) { Eprintf("Encrypted/sparse attributes not supported yet.\n"); - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (val_len) { @@ -1486,7 +1486,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, // record. // FIXME: the check for needing extension records should be // earlier on as it is very quick: asize > m->bytes_allocated? - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } #ifdef DEBUG @@ -1531,7 +1531,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, a->compressed_size = cpu_to_le64(0); // FIXME: Write out the compressed data. // FIXME: err = build_mapping_pairs_compressed(); - err = -ENOTSUP; + err = -EOPNOTSUPP; } else { a->compression_unit = 0; bw = ntfs_rlwrite(vol->dev, rl, val, val_len, NULL); @@ -1600,7 +1600,7 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, } if (ic == IGNORE_CASE) { Eprintf("FIXME: Hit unimplemented code path #3.\n"); - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } if (!ntfs_attr_lookup(type, uname, name_len, ic, 0, val, val_len, @@ -1632,7 +1632,7 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, // record. // FIXME: the check for needing extension records should be // earlier on as it is very quick: asize > m->bytes_allocated? - err = -ENOTSUP; + err = -EOPNOTSUPP; goto err_out; } #ifdef DEBUG @@ -2121,7 +2121,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, } if (ic == IGNORE_CASE) { Eprintf("FIXME: Hit unimplemented code path #4.\n"); - err = -ENOTSUP; + err = -EOPNOTSUPP; if (uname) free(uname); goto err_out; diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 10174831..6c9c27e8 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2184,7 +2184,7 @@ static ntfs_volume *mount_volume(void) printf(corrupt_volume_msg); else if (err == EPERM) printf(hibernated_volume_msg); - else if (err == EOPNOTSUPP) /* NOTE: same as ENOTSUP !!! */ + else if (err == EOPNOTSUPP) printf(unclean_journal_msg); exit(1); } From fd68e4ed66a9a9dd54bb0b1661529f91385a7427 Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 2 Aug 2005 08:54:19 +0000 Subject: [PATCH 2429/2994] Update --- README | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README b/README index 6beb234b..600d6141 100644 --- a/README +++ b/README @@ -45,9 +45,13 @@ at: Quick Installation ================== - In most cases it should be sufficient to do: + If you obtained the source code from CVS all the autogenerated files will be + missing. To generate them you will need the autoconf, automake, and libtool + packages installed and you will need to run: ./autogen.sh + + If you obtained the source code from the tar ball or from a source package + like the .src.rpm for example, in most cases it should be sufficient to do: - ./autogen.sh <-- Only in case you received source from CVS. ./configure make make install <-- You usually need to be root for this one. From 7e53648b593b24382e279226530ee92ef1a12669 Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 2 Aug 2005 09:44:58 +0000 Subject: [PATCH 2430/2994] Fix a warning. --- ntfsprogs/decrypt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 416cb94b..876b33f8 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -215,7 +215,8 @@ static inline void reverse_buffer(unsigned char *buf, unsigned buf_size) ntfs_decrypt_user_key *ntfs_decrypt_user_key_open( ntfs_decrypt_user_key_session *session __attribute__((unused)), - unsigned char *thumb_print, unsigned thumb_size) + unsigned char *thumb_print __attribute__((unused)), + unsigned thumb_size __attribute__((unused))) { #ifdef __CYGWIN__ CRYPT_HASH_BLOB hash_blob; From 55760d93e8e8e0c333e7a9e3bf73d855efa2fdbd Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 2 Aug 2005 09:48:42 +0000 Subject: [PATCH 2431/2994] Remove include of openssl/md5.h as that is no longer used. --- ntfsprogs/decrypt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c index 876b33f8..0e8a8f4c 100644 --- a/ntfsprogs/decrypt.c +++ b/ntfsprogs/decrypt.c @@ -25,7 +25,6 @@ #include #include #include -#include #include "decrypt.h" @@ -403,6 +402,9 @@ unsigned ntfs_decrypt_user_key_decrypt(ntfs_decrypt_user_key *key, #if 0 // This is the old code based on OpenSSL. Please do not remove it. AIA + +#include + /** * ntfs_desx_key_expand - expand a 128-bit desx key to the needed 192-bit key * @src: source buffer containing 128-bit key From fe67916350c6571d335b63403d0f902cee2e2960 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 3 Aug 2005 13:52:50 +0000 Subject: [PATCH 2432/2994] * attrib.c: refix ntfs_attr_p{read,write} * ntfsmount.c: code that now not really needed, but for any case --- libntfs/attrib.c | 4 ++++ ntfsprogs/ntfsmount.c | 56 ++++++++++++++++++++++++++++++------------- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 72606409..8a68410d 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -817,6 +817,8 @@ res_err_out: errno = EIO; goto rl_err_out; } + /* Needed for case when runs merged. */ + ofs = pos + total - (rl->vcn << vol->cluster_size_bits); } if (!rl->length) goto rl_err_out; @@ -1064,6 +1066,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) errno = EIO; goto rl_err_out; } + /* Needed for case when runs merged. */ + ofs = pos + total - (rl->vcn << vol->cluster_size_bits); } if (!rl->length) { errno = EIO; diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index aa2c96c9..fe49ecd5 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -378,11 +378,10 @@ static int ntfs_fuse_read(const char *org_path, char *buf, size_t size, { ntfs_volume *vol; ntfs_inode *ni = NULL; - ntfs_attr *na; - int res; + ntfs_attr *na = NULL; char *path = NULL; ntfschar *stream_name; - int stream_name_len; + int stream_name_len, res, total = 0; stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); if (stream_name_len < 0) @@ -398,11 +397,25 @@ static int ntfs_fuse_read(const char *org_path, char *buf, size_t size, res = -errno; goto exit; } - res = ntfs_attr_pread(na, offset, size, buf); - if (res == -1) - res = -errno; - ntfs_attr_close(na); + if (offset + size > na->data_size) + size = na->data_size - offset; + while (size) { + res = ntfs_attr_pread(na, offset, size, buf); + if (res < size) + perror("ntfs_attr_pread returned less bytes than " + "requested."); + if (res <= 0) { + res = -errno; + goto exit; + } + size -= res; + offset += res; + total += res; + } + res = total; exit: + if (na) + ntfs_attr_close(na); if (ni && ntfs_inode_close(ni)) perror("Failed to close inode"); free(path); @@ -416,11 +429,10 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, { ntfs_volume *vol; ntfs_inode *ni = NULL; - ntfs_attr *na; - int res; + ntfs_attr *na = NULL; char *path = NULL; ntfschar *stream_name; - int stream_name_len; + int stream_name_len, res, total = 0; stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); if (stream_name_len < 0) @@ -436,14 +448,24 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, res = -errno; goto exit; } - res = ntfs_attr_pwrite(na, offset, size, buf); - if (res == -1) - res = -errno; - if (res < size) - perror("ntfs_attr_pwrite returned less than requested."); + while (size) { + res = ntfs_attr_pwrite(na, offset, size, buf); + if (res < size) + perror("ntfs_attr_pwrite returned less bytes than " + "requested."); + if (res <= 0) { + res = -errno; + goto exit; + } + size -= res; + offset += res; + total += res; + } + res = total; +exit: ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); - ntfs_attr_close(na); -exit: + if (na) + ntfs_attr_close(na); if (ni && ntfs_inode_close(ni)) perror("Failed to close inode"); free(path); From 39ec2a83477222d88c9bd83f0c9cd40428cefc92 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 3 Aug 2005 14:06:04 +0000 Subject: [PATCH 2433/2994] ntfsmount: perror => Eprintf on partial {read,write}. --- ntfsprogs/ntfsmount.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index fe49ecd5..02ef4b21 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -402,8 +402,8 @@ static int ntfs_fuse_read(const char *org_path, char *buf, size_t size, while (size) { res = ntfs_attr_pread(na, offset, size, buf); if (res < size) - perror("ntfs_attr_pread returned less bytes than " - "requested."); + Eprintf("ntfs_attr_pread returned less bytes than " + "requested.\n"); if (res <= 0) { res = -errno; goto exit; @@ -451,8 +451,8 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, while (size) { res = ntfs_attr_pwrite(na, offset, size, buf); if (res < size) - perror("ntfs_attr_pwrite returned less bytes than " - "requested."); + Eprintf("ntfs_attr_pwrite returned less bytes than " + "requested.\n"); if (res <= 0) { res = -errno; goto exit; From 0959ea990751b6604d0f65ca1f3c19621259b859 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 3 Aug 2005 21:25:42 +0000 Subject: [PATCH 2434/2994] Fix ntfs_is_cb_compressed for nasty runlist merging case in which compression block was incorrectly treated as not compressed. --- ChangeLog | 2 ++ libntfs/compress.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e7da835c..6290a151 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,8 @@ xx/xx/xxxx - 1.12.0-WIP - Make find work correctly on volumes mounted by ntfsmount. (Yura) - Replaced all occurances of ENOTSUP to EOPNOTSUPP to be in better harmony with the kernel driver. (Szaka) + - Fix ntfs_is_cb_compressed for nasty runlist merging case in which + compression block was incorrectly treated as not compressed. (Yura) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/libntfs/compress.c b/libntfs/compress.c index 407d4d90..f0cb164c 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -3,6 +3,7 @@ * project. * * Copyright (c) 2004-2005 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -265,9 +266,17 @@ static __inline__ BOOL ntfs_is_cb_compressed(ntfs_attr *na, rl++; /* Map the next runlist fragment if it is not mapped. */ if (rl->lcn < LCN_HOLE || !rl->length) { - rl = ntfs_attr_find_vcn(na, rl->vcn); + VCN tvcn; + + tvcn = rl->vcn; + rl = ntfs_attr_find_vcn(na, tvcn); if (!rl || rl->lcn < LCN_HOLE || !rl->length) return TRUE; + if (rl->vcn < tvcn) { + /* Runs merged. Need special handling. */ + cb_clusters -= rl->length - (tvcn - rl->vcn); + continue; + } } /* If the current run is sparse, the cb is compressed. */ if (rl->lcn == LCN_HOLE) From 22590fea7e0b5ff3f830782edbe04f3740dcfddc Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 3 Aug 2005 21:35:22 +0000 Subject: [PATCH 2435/2994] rl_expand(): check if new length isn't already more than requested --- ntfsprogs/ntfsresize.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 6c9c27e8..50841456 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1809,7 +1809,11 @@ static void rl_expand(runlist **rl, const VCN last_vcn) len = rl_items(p); if (len <= 1) - err_exit("ntfs_rl_expand: bad runlist length: %d\n", len); + err_exit("rl_expand: bad runlist length: %d\n", len); + + if (p[len - 1].vcn > last_vcn) + err_exit("rl_expand: length is already more than requested " + "(%lld > %lld)\n", p[len - 1].vcn, last_vcn); if (p[len - 2].lcn == LCN_HOLE) { @@ -1820,7 +1824,7 @@ static void rl_expand(runlist **rl, const VCN last_vcn) p = realloc(*rl, ++len * sizeof(runlist_element)); if (!p) - perr_exit("ntfs_rl_expand: realloc"); + perr_exit("rl_expand: realloc"); p[len - 2].lcn = LCN_HOLE; p[len - 2].length = last_vcn - p[len - 2].vcn; @@ -1828,7 +1832,7 @@ static void rl_expand(runlist **rl, const VCN last_vcn) *rl = p; } else - err_exit("ntfs_rl_expand: bad LCN: %lld\n", p[len - 2].lcn); + err_exit("rl_expand: bad LCN: %lld\n", p[len - 2].lcn); } /** From 26bedb9462cec36671b04e7310ed96b0c56756ba Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 3 Aug 2005 21:46:35 +0000 Subject: [PATCH 2436/2994] rl_expand(): make it a bit more readable --- ntfsprogs/ntfsresize.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 50841456..8c07ad4d 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1807,32 +1807,32 @@ static void rl_expand(runlist **rl, const VCN last_vcn) int len; runlist *p = *rl; - len = rl_items(p); - if (len <= 1) + len = rl_items(p) - 1; + if (len <= 0) err_exit("rl_expand: bad runlist length: %d\n", len); - if (p[len - 1].vcn > last_vcn) + if (p[len].vcn > last_vcn) err_exit("rl_expand: length is already more than requested " - "(%lld > %lld)\n", p[len - 1].vcn, last_vcn); + "(%lld > %lld)\n", p[len].vcn, last_vcn); - if (p[len - 2].lcn == LCN_HOLE) { + if (p[len - 1].lcn == LCN_HOLE) { - p[len - 2].length += last_vcn - p[len - 1].vcn; - p[len - 1].vcn = last_vcn; + p[len - 1].length += last_vcn - p[len].vcn; + p[len].vcn = last_vcn; - } else if (p[len - 2].lcn >= 0) { + } else if (p[len - 1].lcn >= 0) { - p = realloc(*rl, ++len * sizeof(runlist_element)); + p = realloc(*rl, (++len + 1) * sizeof(runlist_element)); if (!p) perr_exit("rl_expand: realloc"); - p[len - 2].lcn = LCN_HOLE; - p[len - 2].length = last_vcn - p[len - 2].vcn; - rl_set(p + len - 1, last_vcn, LCN_ENOENT, 0LL); + p[len - 1].lcn = LCN_HOLE; + p[len - 1].length = last_vcn - p[len - 1].vcn; + rl_set(p + len, last_vcn, LCN_ENOENT, 0LL); *rl = p; } else - err_exit("rl_expand: bad LCN: %lld\n", p[len - 2].lcn); + err_exit("rl_expand: bad LCN: %lld\n", p[len - 1].lcn); } /** From 36c5f89d134dffa6516a60d37ee8df6bc26ec040 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 3 Aug 2005 22:29:14 +0000 Subject: [PATCH 2437/2994] Fix ntfsmount warnings. --- ntfsprogs/ntfsmount.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 02ef4b21..04d5e6b8 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -401,7 +401,7 @@ static int ntfs_fuse_read(const char *org_path, char *buf, size_t size, size = na->data_size - offset; while (size) { res = ntfs_attr_pread(na, offset, size, buf); - if (res < size) + if (res < (s64)size) Eprintf("ntfs_attr_pread returned less bytes than " "requested.\n"); if (res <= 0) { @@ -450,7 +450,7 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, } while (size) { res = ntfs_attr_pwrite(na, offset, size, buf); - if (res < size) + if (res < (s64)size) Eprintf("ntfs_attr_pwrite returned less bytes than " "requested.\n"); if (res <= 0) { @@ -558,7 +558,7 @@ exit: return res; } -static int ntfs_fuse_rm_file(char *file) +static int ntfs_fuse_rm_file(char *file __attribute__((unused))) { return -EOPNOTSUPP; } @@ -640,7 +640,7 @@ static int ntfs_fuse_getxattr(const char *path, const char *name, goto exit; } if (ret) - ret++; /* For space delimiter .*/ + ret++; /* For space delimiter. */ ret += tmp_name_len; if ((size_t)ret <= size) { /* Don't add space to the beginning of line. */ From 4e8e7ae9fae121bd4dc914560e1c3c750b8ed484 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 3 Aug 2005 22:40:29 +0000 Subject: [PATCH 2438/2994] Fix for ntfs_rl_truncate() EIO: always set the correct size for $BadClus:$Bad, even if Windows set it incorrectly --- ChangeLog | 2 ++ ntfsprogs/ntfsresize.c | 25 ++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6290a151..b0237550 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,8 @@ xx/xx/xxxx - 1.12.0-WIP harmony with the kernel driver. (Szaka) - Fix ntfs_is_cb_compressed for nasty runlist merging case in which compression block was incorrectly treated as not compressed. (Yura) + - ntfsresize: fix for ntfs_rl_truncate() EIO: always set the correct + size for $BadClus:$Bad, even if Windows set it incorrectly. (Szaka) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 8c07ad4d..72581da6 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -1835,6 +1835,25 @@ static void rl_expand(runlist **rl, const VCN last_vcn) err_exit("rl_expand: bad LCN: %lld\n", p[len - 1].lcn); } +static void rl_truncate(runlist **rl, const VCN last_vcn) +{ + int len; + VCN vcn; + + len = rl_items(*rl) - 1; + if (len <= 0) + err_exit("rl_truncate: bad runlist length: %d\n", len); + + vcn = (*rl)[len].vcn; + + if (vcn < last_vcn) + rl_expand(rl, last_vcn); + + else if (vcn > last_vcn) + if (ntfs_rl_truncate(rl, last_vcn) == -1) + perr_exit("ntfs_rl_truncate"); +} + /** * bitmap_file_data_fixup * @@ -1870,11 +1889,7 @@ static void truncate_badclust_bad_attr(ntfs_resize_t *resize) if (!(rl_bad = ntfs_mapping_pairs_decompress(vol, a, NULL))) perr_exit("ntfs_mapping_pairs_decompress"); - if (resize->shrink) { - if (ntfs_rl_truncate(&rl_bad, nr_clusters) == -1) - perr_exit("ntfs_rl_truncate"); - } else - rl_expand(&rl_bad, nr_clusters); + rl_truncate(&rl_bad, nr_clusters); a->highest_vcn = cpu_to_le64(nr_clusters - 1LL); a->allocated_size = cpu_to_le64(nr_clusters * vol->cluster_size); From 6d4e6d9893a4e673881d7572e6be75e92418fd4a Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 4 Aug 2005 00:00:27 +0000 Subject: [PATCH 2439/2994] * fix ntfs_attr_open * update for 1.11.2 --- ChangeLog | 4 +++- configure.ac | 2 +- include/ntfs/attrib.h | 4 ++-- libntfs/attrib.c | 20 +++++++++++++++++--- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0237550..94819b73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/xxxx - 1.12.0-WIP +04/07/2005 - 1.11.2 - A lot of fixes and improvements. - ntfsls: fix showing not system files started with '$'. (Yura) - Move ntfs2utc and utc2ntfs from utils.[ch] to timeconv.h. (Yura) @@ -29,6 +29,8 @@ xx/xx/xxxx - 1.12.0-WIP compression block was incorrectly treated as not compressed. (Yura) - ntfsresize: fix for ntfs_rl_truncate() EIO: always set the correct size for $BadClus:$Bad, even if Windows set it incorrectly. (Szaka) + - Make ntfs_attr_open resolve attribute name for ntfs_attr struct + in case NULL passed instead of name. (Yura) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/configure.ac b/configure.ac index a0766ba5..65215d6d 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.12.0-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.11.2],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 1785af1c..e59bf0f5 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -2,7 +2,7 @@ * attrib.h - Exports for attribute handling. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov - * Copyright (c) 2004 Yura Pakhuchiy + * Copyright (c) 2004-2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -261,7 +261,7 @@ extern void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident, const u8 compression_unit); extern ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, - ntfschar *name, const u32 name_len); + ntfschar *name, u32 name_len); extern void ntfs_attr_close(ntfs_attr *na); extern s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 8a68410d..e594cfd2 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -322,7 +322,7 @@ void ntfs_attr_init(ntfs_attr *na, const BOOL non_resident, * both those cases @name_len is not used at all. */ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, - ntfschar *name, const u32 name_len) + ntfschar *name, u32 name_len) { ntfs_attr_search_ctx *ctx; ntfs_attr *na; @@ -348,20 +348,34 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, return NULL; } } - __ntfs_attr_init(na, ni, type, name, name_len); ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { err = errno; goto err_out; } - if (ntfs_attr_lookup(type, name, name_len, 0, 0, NULL, 0, ctx)) { err = errno; goto put_err_out; } + a = ctx->attr; cs = a->flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE); + if (!name) { + if (a->name_length) { + name = ntfs_ucsndup((ntfschar*)((u8*)a + le16_to_cpu( + a->name_offset)), a->name_length); + if (!name) { + err = errno; + goto put_err_out; + } + name_len = a->name_length; + } else { + name = AT_UNNAMED; + name_len = 0; + } + } + __ntfs_attr_init(na, ni, type, name, name_len); if (a->non_resident) { ntfs_attr_init(na, TRUE, a->flags & ATTR_IS_COMPRESSED, a->flags & ATTR_IS_ENCRYPTED, From 41d459b15c8a8675c2c8f81ec4ebb691a886ffd9 Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 4 Aug 2005 08:09:58 +0000 Subject: [PATCH 2440/2994] Improve on decompression fix from Yura. --- libntfs/compress.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/libntfs/compress.c b/libntfs/compress.c index f0cb164c..17d0981c 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -254,29 +254,27 @@ static __inline__ BOOL ntfs_is_cb_compressed(ntfs_attr *na, runlist_element *rl, VCN cb_start_vcn, int cb_clusters) { /* - * The simplest case: the run starting at @cb_start_vcn contains + * The simplest case: the run starting at @cb_start_vcn contains * @cb_clusters clusters which are all not sparse, thus the cb is not * compressed. */ - if (rl->length - (cb_start_vcn - rl->vcn) >= cb_clusters) - return FALSE; +restart: cb_clusters -= rl->length - (cb_start_vcn - rl->vcn); - do { + while (cb_clusters > 0) { /* Go to the next run. */ rl++; /* Map the next runlist fragment if it is not mapped. */ if (rl->lcn < LCN_HOLE || !rl->length) { - VCN tvcn; - - tvcn = rl->vcn; - rl = ntfs_attr_find_vcn(na, tvcn); + cb_start_vcn = rl->vcn; + rl = ntfs_attr_find_vcn(na, rl->vcn); if (!rl || rl->lcn < LCN_HOLE || !rl->length) return TRUE; - if (rl->vcn < tvcn) { - /* Runs merged. Need special handling. */ - cb_clusters -= rl->length - (tvcn - rl->vcn); - continue; - } + /* + * If the runs were merged need to deal with the + * resulting partial run so simply restart. + */ + if (rl->vcn < cb_start_vcn) + goto restart; } /* If the current run is sparse, the cb is compressed. */ if (rl->lcn == LCN_HOLE) @@ -285,7 +283,7 @@ static __inline__ BOOL ntfs_is_cb_compressed(ntfs_attr *na, if (rl->length >= cb_clusters) return FALSE; cb_clusters -= rl->length; - } while (cb_clusters > 0); + }; /* All cb_clusters were not sparse thus the cb is not compressed. */ return FALSE; } From 6124aafffb090fe5ed9fd58b1e33513aa61019ea Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 4 Aug 2005 09:59:39 +0000 Subject: [PATCH 2441/2994] Move timeconv to ntfstime, update changelog, and news for new release. --- ChangeLog | 61 ++++++++++++++----------- NEWS | 6 +-- include/ntfs/Makefile.am | 2 +- include/ntfs/{timeconv.h => ntfstime.h} | 11 +++-- libntfs/inode.c | 2 +- ntfsprogs/mkntfs.c | 2 +- ntfsprogs/ntfscat.c | 2 - ntfsprogs/ntfsinfo.c | 2 +- ntfsprogs/ntfsls.c | 2 +- ntfsprogs/ntfsrm.c | 2 +- ntfsprogs/ntfsundelete.c | 2 +- 11 files changed, 52 insertions(+), 42 deletions(-) rename include/ntfs/{timeconv.h => ntfstime.h} (90%) diff --git a/ChangeLog b/ChangeLog index 94819b73..a87cb166 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,36 +1,45 @@ -04/07/2005 - 1.11.2 - A lot of fixes and improvements. +04/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. - - ntfsls: fix showing not system files started with '$'. (Yura) - - Move ntfs2utc and utc2ntfs from utils.[ch] to timeconv.h. (Yura) + - ntfsls: Fix display of non-system files whose name begins with the + '$' character. (Yura) + - Move ntfs2utc and utc2ntfs from utils.[ch] to ntfstime.h. (Yura, + Anton) - Add [acm]time fields to struct ntfs_inode and set them during - ntfs_inode_open. Update ntfsmount to use them. (Yura) - - index.c::ntfs_index_lookup: fix bug when index context didn't point - on index root in which entry located. (Yura) - - ntfsresize: relocate_attributes(): don't stop processing of MFT - record attributes at AT_DATA of $BadClus and $Bitmap. In practice, - there aren't non-resident attributes after them so this bug, - introduced in 1.11.0, shouldn't have ever caused data loss. (Szaka) - - ntfsresize: support relocation of $MFT with $ATTRIBUTE_LIST. (Szaka) - - ntfsresize: support resizing into the middle of a $MFT $DATA + ntfs_inode_openi(). Update ntfsmount to use them. (Yura) + - index.c::ntfs_index_lookup(): Fix bug when index context did not + point to the index root in which the entry located. (Yura) + - ntfsresize: relocate_attributes(): Do not stop processing MFT record + attributes at AT_DATA of $BadClus and $Bitmap. In practice, there + are no non-resident attributes after them so this is a bug which was + introduced in 1.11.0 which should not have caused data loss. (Szaka) + - ntfsresize: Support relocation of $MFT with $ATTRIBUTE_LIST. (Szaka) + - ntfsresize: Support resizing into the middle of a $MFT $DATA extent. (Szaka) - - ntfscp: fix attribute name parsing bug introduced in 1.10.0. (Yura) - - ntfsinfo: dump more information for indexes. (Yura) - - Fix unistr.c::ntfs_mbstoucs on systems with utf8 locale. (Yura) - - Change errno and print more verbose message in case if logfile check - failed. (Yura) - - Fix random errno returned by ntfs_inode_open() if the MFT record - wasn't in use. (Szaka) - - Fix ntfs_attr_p{read,write} to not return less bytes if trapped on + - ntfscp: Fix attribute name parsing bug introduced in 1.10.0. (Yura) + - ntfsinfo: Dump more information about indexes. (Yura) + - Fix unistr.c::ntfs_mbstoucs() on systems with utf8 locale. (Yura) + - Change errno and print more verbose message in the case of a failing + logfile check. (Yura) + - Fix random errno returned by ntfs_inode_open() if the MFT record was + not in use. (Szaka) + - Fix ntfs_attr_p{read,write}() to not return less bytes if trapped on unmapped runlist region. (Yura) - Make find work correctly on volumes mounted by ntfsmount. (Yura) - - Replaced all occurances of ENOTSUP to EOPNOTSUPP to be in better + - Replaced all occurances of ENOTSUP with EOPNOTSUPP to be in better harmony with the kernel driver. (Szaka) - - Fix ntfs_is_cb_compressed for nasty runlist merging case in which - compression block was incorrectly treated as not compressed. (Yura) - - ntfsresize: fix for ntfs_rl_truncate() EIO: always set the correct - size for $BadClus:$Bad, even if Windows set it incorrectly. (Szaka) - - Make ntfs_attr_open resolve attribute name for ntfs_attr struct + - Fix ntfs_is_cb_compressed() for nasty runlist merging case in which + compression block was incorrectly treated as not compressed. (Yura, + Anton) + - ntfsresize: Fix for ntfs_rl_truncate() EIO: Always set the correct + size for $BadClus::$Bad, even if Windows set it incorrectly. (Szaka) + - Make ntfs_attr_open() resolve attribute name for ntfs_attr struct in case NULL passed instead of name. (Yura) + - ntfsdecrypt (make extra) is now fully functional under Windows/Cygwin + using libgcrypt. It decrypts all types of compressed files that ntfs + creates, i.e. DesX, AES-256, and 3Des. The only reason it only works + on Windows is that it needs the user's private key to be able to + decrypt the File Encryption Key so it can decrypt the file. (Yuval, + Anton) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/NEWS b/NEWS index 64202d35..9354b2f7 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,9 @@ changing the file size and can read/write/add/remove named data streams via "file:stream" interface and list them via "ntfs.streams.list" extended attribute (this only if xattr support is enabled). (Yura Pakhuchiy) +Older news +========== + Attribute resize code for normal and sparse files is completed. Thus, ntfscp should always successfully overwrite any normal or sparse file even if file size is changed. (Yura Pakhuchiy) @@ -31,9 +34,6 @@ this modifies the command line options a little as well as the returned output so applications using ntfsresize might need modifications before they will work with the updated ntfsresize. (Szakacsits Szabolcs) -Older news -========== - ntfsprogs now should ./configure and compile cleanly on SuSE as well as RedHat Linux. diff --git a/include/ntfs/Makefile.am b/include/ntfs/Makefile.am index 2d8951c4..918ceaf4 100644 --- a/include/ntfs/Makefile.am +++ b/include/ntfs/Makefile.am @@ -26,7 +26,7 @@ linux_ntfsinclude_HEADERS = \ runlist.h \ security.h \ support.h \ - timeconv.h \ + ntfstime.h \ types.h \ unistr.h \ volume.h diff --git a/include/ntfs/timeconv.h b/include/ntfs/ntfstime.h similarity index 90% rename from include/ntfs/timeconv.h rename to include/ntfs/ntfstime.h index eba91504..d6c9677f 100644 --- a/include/ntfs/timeconv.h +++ b/include/ntfs/ntfstime.h @@ -1,6 +1,7 @@ /* - * timeconv.h - NTFS time conversion functions. Part of the Linux-NTFS project. + * ntfstime.h - NTFS time related functions. Part of the Linux-NTFS project. * + * Copyright (c) 2005 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or @@ -19,11 +20,13 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _NTFS_TIMECONV_H -#define _NTFS_TIMECONV_H +#ifndef _NTFS_NTFSTIME_H +#define _NTFS_NTFSTIME_H #include +#include "types.h" + #define NTFS_TIME_OFFSET ((s64)(369 * 365 + 89) * 24 * 3600 * 10000000) /** @@ -61,4 +64,4 @@ static __inline__ s64 utc2ntfs(time_t utc_time) return (s64)utc_time * 10000000 + NTFS_TIME_OFFSET; } -#endif /* _NTFS_TIMECONV_H */ +#endif /* _NTFS_NTFSTIME_H */ diff --git a/libntfs/inode.c b/libntfs/inode.c index f76c44a8..68a8650f 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -38,7 +38,7 @@ #include "lcnalloc.h" #include "index.h" #include "dir.h" -#include "timeconv.h" +#include "ntfstime.h" /** * Internal: diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 13fe6745..f368a06e 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -126,7 +126,7 @@ #include "mst.h" #include "runlist.h" #include "utils.h" -#include "timeconv.h" +#include "ntfstime.h" #ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS # error "No default device io operations! Cannot build mkntfs. \ diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 6f977424..ceef7868 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -393,5 +393,3 @@ int main (int argc, char *argv[]) return result; } - - diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 107b58a6..af0a3fbe 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -65,7 +65,7 @@ #include "security.h" #include "mst.h" #include "dir.h" -#include "timeconv.h" +#include "ntfstime.h" static const char *EXEC_NAME = "ntfsinfo"; diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 653cabe3..6b6e0824 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -40,7 +40,7 @@ #include "utils.h" #include "dir.h" #include "list.h" -#include "timeconv.h" +#include "ntfstime.h" static const char *EXEC_NAME = "ntfsls"; diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 7353adea..decfdde8 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -33,7 +33,7 @@ #include "dir.h" #include "lcnalloc.h" #include "mft.h" -#include "timeconv.h" +#include "ntfstime.h" static const char *EXEC_NAME = "ntfsrm"; static struct options opts; diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 4f487281..110e17a6 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -52,7 +52,7 @@ #include "device.h" #include "utils.h" #include "debug.h" -#include "timeconv.h" +#include "ntfstime.h" static const char *EXEC_NAME = "ntfsundelete"; static const char *MFTFILE = "mft"; From d658b8f0197eaac65bb4e53fdfe3a3b5adaa5fda Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 4 Aug 2005 10:36:35 +0000 Subject: [PATCH 2442/2994] Fix typo in ChangeLog (thanks Szaka!). Do more detection in configure.ac and in particular check for getopt_long, windows.h, wincrypt.h, and gcrypt.h and most importantly (for now) give command line option to enable crypto stuff and autodetect if libgcrypt is present. And only build ntfsdecrypt (still make extra only) only if both --enable-crypto was specified AND libgcrypt was found. --- ChangeLog | 2 +- configure.ac | 34 +++++++++++++++++++++++++++------- ntfsprogs/Makefile.am | 17 +++++++++++------ 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index a87cb166..7dfa0f93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,7 @@ - Move ntfs2utc and utc2ntfs from utils.[ch] to ntfstime.h. (Yura, Anton) - Add [acm]time fields to struct ntfs_inode and set them during - ntfs_inode_openi(). Update ntfsmount to use them. (Yura) + ntfs_inode_open(). Update ntfsmount to use them. (Yura) - index.c::ntfs_index_lookup(): Fix bug when index context did not point to the index root in which the entry located. (Yura) - ntfsresize: relocate_attributes(): Do not stop processing MFT record diff --git a/configure.ac b/configure.ac index 65215d6d..1dcecde3 100644 --- a/configure.ac +++ b/configure.ac @@ -51,7 +51,7 @@ fi # Command-line options. AC_ARG_ENABLE(debug, AS_HELP_STRING(--enable-debug,enable additional debugging code and - output), , + output), , enable_debug=no ) @@ -77,14 +77,20 @@ AC_ARG_ENABLE(gnome-vfs, ) AC_ARG_ENABLE(fuse-module, - AS_HELP_STRING(--disable-fuse-module,omit FUSE 'libntfs' - interface (default=detect)), , + AS_HELP_STRING(--disable-fuse-module,omit FUSE 'libntfs' interface + (default=detect)), , enable_fuse_module=auto ) +AC_ARG_ENABLE(crypto, + AS_HELP_STRING(--enable-crypto,enable crypto related code and utilities + (default=no)), , + enable_crypto=no +) + AC_ARG_ENABLE(really-static, - AS_HELP_STRING(--enable-really-static,create completely static - binaries for the utilities), , + AS_HELP_STRING(--enable-really-static,create completely static binaries + for the utilities), , enable_really_static=no ) AM_CONDITIONAL(REALLYSTATIC, test "$enable_really_static" = yes) @@ -150,6 +156,20 @@ if test "$enable_fuse_module" != "no"; then fi AM_CONDITIONAL(ENABLE_FUSE_MODULE, $compile_fuse_module) +# Autodetect whether we can build crypto stuff or not. +compile_crypto=false +if test "$enable_crypto" != "no"; then + PKG_CHECK_MODULES(CRYPTO, [libgcrypt], [ compile_crypto=true ], + [ + if test "$enable_crypto" = "yes"; then + AC_MSG_ERROR([Linux-NTFS crypto code requires the gcrypt library.]) + else + AC_MSG_WARN([Linux-NTFS crypto code requires the gcrypt library.]) + fi + ]) +fi +AM_CONDITIONAL(ENABLE_CRYPTO, $compile_crypto) + # add --with-extra-includes and --with-extra-libs switch to ./configure all_libraries="$all_libraries $USER_LDFLAGS" all_includes="$all_includes $USER_INCLUDES" @@ -217,7 +237,7 @@ AC_CHECK_HEADERS([ctype.h fcntl.h libintl.h limits.h locale.h mntent.h \ errno.h time.h unistd.h utime.h wchar.h getopt.h features.h endian.h \ byteswap.h sys/byteorder.h sys/endian.h sys/param.h sys/ioctl.h \ sys/mount.h sys/stat.h sys/types.h sys/vfs.h linux/major.h linux/fd.h \ - linux/hdreg.h machine/endian.h]) + linux/hdreg.h machine/endian.h gcrypt.h windows.h wincrypt.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL @@ -243,7 +263,7 @@ AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \ strcasecmp strchr strdup strerror strtol strtoul utime mbsinit \ - setxattr]) + setxattr getopt_long ]) # Makefiles to be created by configure. AC_CONFIG_FILES([ diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index e74bf4de..99f2bd2d 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -15,7 +15,7 @@ bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone \ ntfscp EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove \ - ntfsrm ntfsmftalloc ntfsdecrypt + ntfsrm ntfsmftalloc man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ @@ -33,6 +33,10 @@ if ENABLE_FUSE_MODULE bin_PROGRAMS += ntfsmount endif +if ENABLE_CRYPTO +EXTRA_PROGRAMS += ntfsdecrypt +endif + # Set the include path. AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs $(all_includes) @@ -89,10 +93,6 @@ endif # We don't distribute these -ntfsdecrypt_SOURCES = ntfsdecrypt.c decrypt.c decrypt.h utils.c utils.h -ntfsdecrypt_LDADD = $(AM_LIBS) -ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt - ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h ntfsrm_LDADD = $(AM_LIBS) ntfsrm_LDFLAGS = $(AM_LFLAGS) @@ -117,6 +117,12 @@ ntfsdump_logfile_SOURCES= ntfsdump_logfile.c ntfsdump_logfile_LDADD = $(AM_LIBS) ntfsdump_logfile_LDFLAGS= $(AM_LFLAGS) +if ENABLE_CRYPTO +ntfsdecrypt_SOURCES = ntfsdecrypt.c decrypt.c decrypt.h utils.c utils.h +ntfsdecrypt_LDADD = $(AM_LIBS) +ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt +endif + # Extra targets strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) @@ -125,4 +131,3 @@ strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) extra: extras extras: $(EXTRA_PROGRAMS) - From 74650cc050df1c2f717f194b2b0bd5cde84c339e Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 4 Aug 2005 11:59:28 +0000 Subject: [PATCH 2443/2994] pkgconfig does not support libgcrypt. Use autoconf macro instead. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1dcecde3..2190f463 100644 --- a/configure.ac +++ b/configure.ac @@ -159,7 +159,7 @@ AM_CONDITIONAL(ENABLE_FUSE_MODULE, $compile_fuse_module) # Autodetect whether we can build crypto stuff or not. compile_crypto=false if test "$enable_crypto" != "no"; then - PKG_CHECK_MODULES(CRYPTO, [libgcrypt], [ compile_crypto=true ], + AM_PATH_LIBGCRYPT(, [ compile_crypto=true ], [ if test "$enable_crypto" = "yes"; then AC_MSG_ERROR([Linux-NTFS crypto code requires the gcrypt library.]) From 704f7ea214748cae923d9e8020f174805badd1fa Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 4 Aug 2005 12:21:23 +0000 Subject: [PATCH 2444/2994] Remove efs stuff from todo as it is now done. --- TODO.include | 4 ---- 1 file changed, 4 deletions(-) diff --git a/TODO.include b/TODO.include index c6a7b0dc..230e83f4 100644 --- a/TODO.include +++ b/TODO.include @@ -1,7 +1,3 @@ -Finish layout.h: in particular, add: - -- more about EFS and the EFS attribute. - Add usnjrnl.h (copy from kernel driver): - describe the $UsnJrnl on disk structures From 6d265e99ea5ccf9f9443933b96845524e33b9977 Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 4 Aug 2005 12:22:28 +0000 Subject: [PATCH 2445/2994] Update --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7dfa0f93..34c26718 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,8 @@ on Windows is that it needs the user's private key to be able to decrypt the File Encryption Key so it can decrypt the file. (Yuval, Anton) + - Add information about $EFS on-disk structures to layout.h. (Yuval, + Anton) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. From 8d86fdefeca78f13cf3f05912190a92e82ecba3d Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 4 Aug 2005 13:12:41 +0000 Subject: [PATCH 2446/2994] Fix make extra directly after ./configure. Thanks to Yuval for the bug report. --- ChangeLog | 4 ++++ Makefile.am | 9 ++++----- ntfsprogs/Makefile.am | 5 ++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 34c26718..380f3b4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,10 @@ Anton) - Add information about $EFS on-disk structures to layout.h. (Yuval, Anton) + - Fix build so that make extra directly after ./configure works. + Thanks to Yuval for the bug report. (Anton) + - Add ./configure option --enable-crypto and if enabled detect whether + libgcrypt is present or not. (Anton) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. diff --git a/Makefile.am b/Makefile.am index 222799c3..01e776a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,11 +19,10 @@ libtool: $(LIBTOOL_DEPS) strip: (cd ntfsprogs && $(MAKE) strip) || exit 1; -extra: extras - -extras: - (cd ntfsprogs && $(MAKE) extras) || exit 1; - libs: (cd libntfs && $(MAKE) libs) || exit 1; +extra: extras + +extras: libs + (cd ntfsprogs && $(MAKE) extras) || exit 1; diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 99f2bd2d..d2abe6b2 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -128,6 +128,9 @@ endif strip: $(bin_PROGRAMS) $(sbin_PROGRAMS) $(STRIP) $^ +libs: + (cd ../libntfs && $(MAKE) libs) || exit 1; + extra: extras -extras: $(EXTRA_PROGRAMS) +extras: libs $(EXTRA_PROGRAMS) From 490176db7b204c81b8dd628996c1db67a50e18bb Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 4 Aug 2005 19:49:38 +0000 Subject: [PATCH 2447/2994] update README about ntfsmount --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 600d6141..17ad7c1b 100644 --- a/README +++ b/README @@ -124,3 +124,5 @@ partition. See man 8 ntfsls for details. ntfscat - Concatenate files and print their contents on the standard output. ntfscp - Overwrite files on an NTFS partition. + +ntfsmount - Mount an NTFS partition from user-space using libntfs and FUSE. From a0adaafe382fa144807b4fe563057e364583647e Mon Sep 17 00:00:00 2001 From: szaka Date: Fri, 5 Aug 2005 17:28:41 +0000 Subject: [PATCH 2448/2994] Credit Ralf Beyer --- ntfsprogs/ntfsresize.8.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 2024eea6..faf4a6a1 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -1,7 +1,7 @@ .\" -*- nroff -*- .\" Copyright 2002-2005 by Szabolcs Szakacsits All Rights Reserved. .\" -.TH NTFSRESIZE 8 "Jul 2005" "ntfsprogs version @VERSION@" +.TH NTFSRESIZE 8 "Aug 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsresize \- resize an NTFS filesystem without data loss .SH SYNOPSIS @@ -223,7 +223,7 @@ furthermore to Erik Meade, Martin Fick, Sandro Hawke, Dave Croal, Lorrin Nelson, Geert Hendrickx, Robert Bjorkman and Richard Burdick for beta testing the relocation support, to Florian Eyben, Fritz Oppliger, Richard Ebling, Sid-Ahmed Touati, Jan Kiszka, Benjamin Redelings, Christopher -Haney, Ryan Durk for the valued +Haney, Ryan Durk, Ralf Beyer for the valued contributions and to Theodore Ts'o whose .BR resize2fs (8) man page originally formed the basis of this page. From 640573bf12e26e1c1d553b60e19c4073db620c18 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 5 Aug 2005 23:41:52 +0000 Subject: [PATCH 2449/2994] Finish next stage in ntfsdecrypt evolution. It is now almost finished in that it fully works to decrypt any ntfs enecrypted file both from Linux and Windows. All you need to supply is your private key in form of a .prx file as exported for example by the cypher command in XP SP2 or otherwise as exported by the management console's certificate manager plugin. --- ntfsprogs/Makefile.am | 4 +- ntfsprogs/decrypt.c | 803 ------------------------------ ntfsprogs/decrypt.h | 50 -- ntfsprogs/ntfsdecrypt.c | 1041 +++++++++++++++++++++++++++++++++------ 4 files changed, 906 insertions(+), 992 deletions(-) delete mode 100644 ntfsprogs/decrypt.c delete mode 100644 ntfsprogs/decrypt.h diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index d2abe6b2..f73d15a0 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -118,9 +118,9 @@ ntfsdump_logfile_LDADD = $(AM_LIBS) ntfsdump_logfile_LDFLAGS= $(AM_LFLAGS) if ENABLE_CRYPTO -ntfsdecrypt_SOURCES = ntfsdecrypt.c decrypt.c decrypt.h utils.c utils.h +ntfsdecrypt_SOURCES = ntfsdecrypt.c utils.c utils.h ntfsdecrypt_LDADD = $(AM_LIBS) -ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt +ntfsdecrypt_LDFLAGS = $(AM_LFLAGS) -lgcrypt -lgnutls endif # Extra targets diff --git a/ntfsprogs/decrypt.c b/ntfsprogs/decrypt.c deleted file mode 100644 index 0e8a8f4c..00000000 --- a/ntfsprogs/decrypt.c +++ /dev/null @@ -1,803 +0,0 @@ -/* - * decrypt.c - $EFS decryption routines. Part of the Linux-NTFS project. - * - * Copyright (c) 2005 Yuval Fledel - * Copyright (c) 2005 Anton Altaparmakov - * - * 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 of the License, 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 (in the main directory of the Linux-NTFS distribution - * in the file COPYING); if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include -#include -#include - -#include "decrypt.h" - -#ifdef __CYGWIN__ -#define _WIN32_WINNT 0x501 -#define WINVER 0x501 - -#include -#include - -/* Missing cygwin macros */ -#ifndef CERT_SYSTEM_STORE_CURRENT_USER -#define CERT_SYSTEM_STORE_CURRENT_USER 0x00010000 -#endif - -#ifndef CERT_CLOSE_STORE_CHECK_FLAG -#define CERT_CLOSE_STORE_CHECK_FLAG 2 -#endif - -#ifndef CRYPT_ACQUIRE_CACHE_FLAG -#define CRYPT_ACQUIRE_CACHE_FLAG 1 -#endif - -/* Windows 2k+ imports. */ -typedef BOOL(WINAPI *LPFN_CryptAcquireCertificatePrivateKey)(PCCERT_CONTEXT, - DWORD, void *, HCRYPTPROV *, DWORD *, BOOL *); -typedef BOOL(WINAPI *LPFN_CertCloseStore)(HCERTSTORE, DWORD); -typedef PCCERT_CONTEXT(WINAPI *LPFN_CertFindCertificateInStore)(HCERTSTORE, - DWORD, DWORD, DWORD, const void *, PCCERT_CONTEXT); -typedef BOOL(WINAPI *LPFN_CertFreeCertificateContext)(PCCERT_CONTEXT); -typedef HCERTSTORE(WINAPI *LPFN_CertOpenStore)(LPCSTR, DWORD, HCRYPTPROV, - DWORD, const void *); - -// NT4SP3+ WINME or 95+ w/ IE5+ -static LPFN_CryptAcquireCertificatePrivateKey - fnCryptAcquireCertificatePrivateKey; -// osr2+ NT4SP3+ or NT4 w/ IE3.02: -static LPFN_CertCloseStore fnCertCloseStore; -static LPFN_CertFindCertificateInStore fnCertFindCertificateInStore; -static LPFN_CertFreeCertificateContext fnCertFreeCertificateContext; -static LPFN_CertOpenStore fnCertOpenStore; - -/* Global variable: Handle to crypt32.dll */ -static HMODULE hCrypt32 = INVALID_HANDLE_VALUE; - -#else /* !defined(__CYGWIN__) */ - -#include -#include -#define CALG_DES (0x6601) -/* If not one of the below three, fall back to standard Des. */ -#define CALG_3DES (0x6603) -#define CALG_DESX (0x6604) -#define CALG_AES_256 (0x6610) - -#endif /* !defined(__CYGWIN__) */ - -/* This must be after windows.h include. */ -#include "types.h" - -typedef struct { -#ifdef __CYGWIN__ - HCERTSTORE hSystemStore; -#else /* !defined(__CYGWIN__) */ - int nothing; /* unused */ -#endif /* !defined(__CYGWIN__) */ -} NTFS_DECRYPT_USER_KEY_SESSION; - -typedef struct { - gcry_sexp_t sexp_key; // the user's RSA key. -} NTFS_DECRYPT_USER_KEY; - -typedef struct { - u8 *key_data; - u32 alg_id; - gcry_cipher_hd_t gcry_cipher_hd; - gcry_cipher_hd_t *des_gcry_cipher_hd_ptr; -} NTFS_DECRYPT_DATA_KEY; - -/* DESX-MS128 implementation for libgcrypt. */ -static gcry_module_t ntfs_desx_module; -static int ntfs_desx_algorithm_id = -1; -static int ntfs_desx_module_count; - -typedef struct { - u64 in_whitening, out_whitening; - gcry_cipher_hd_t gcry_cipher_hd; -} ntfs_desx_ctx; - -#ifdef __CYGWIN__ -static int cryptoAPI_init_imports(void) -{ - if (hCrypt32 == INVALID_HANDLE_VALUE) - hCrypt32 = LoadLibrary("crypt32.dll"); - if (!fnCryptAcquireCertificatePrivateKey) - fnCryptAcquireCertificatePrivateKey = - (LPFN_CryptAcquireCertificatePrivateKey) - GetProcAddress(hCrypt32, - "CryptAcquireCertificatePrivateKey"); - if (!fnCertCloseStore) - fnCertCloseStore = (LPFN_CertCloseStore) - GetProcAddress(hCrypt32, "CertCloseStore"); - if (!fnCertFindCertificateInStore) - fnCertFindCertificateInStore = (LPFN_CertFindCertificateInStore) - GetProcAddress(hCrypt32, - "CertFindCertificateInStore"); - if (!fnCertFreeCertificateContext) - fnCertFreeCertificateContext = (LPFN_CertFreeCertificateContext) - GetProcAddress(hCrypt32, - "CertFreeCertificateContext"); - if (!fnCertOpenStore) - fnCertOpenStore = (LPFN_CertOpenStore)GetProcAddress(hCrypt32, - "CertOpenStore"); - return fnCryptAcquireCertificatePrivateKey && fnCertCloseStore && - fnCertFindCertificateInStore && - fnCertFreeCertificateContext && fnCertOpenStore; -} -#endif /* defined(__CYGWIN__) */ - -ntfs_decrypt_user_key_session *ntfs_decrypt_user_key_session_open(void) -{ - ntfs_decrypt_user_key_session *session; -#ifdef __CYGWIN__ - HCERTSTORE hSystemStore; - - /* - * FIXME: This really needs locking and reference counting so it is - * safe from races. - */ - if (!cryptoAPI_init_imports()) { - fprintf(stderr, "Some imports do not exist.\n"); - errno = EINVAL; - return NULL; - } - if (!(hSystemStore = fnCertOpenStore(((LPCSTR)CERT_STORE_PROV_SYSTEM), - 0, 0, CERT_SYSTEM_STORE_CURRENT_USER, L"MY"))) { - fprintf(stderr, "Could not open system store.\n"); - errno = EINVAL; - return NULL; - } -#endif /* defined(__CYGWIN__) */ - session = malloc(sizeof(NTFS_DECRYPT_USER_KEY_SESSION)); -#ifdef __CYGWIN__ - ((NTFS_DECRYPT_USER_KEY_SESSION*)session)->hSystemStore = hSystemStore; -#endif /* defined(__CYGWIN__) */ - gcry_control(GCRYCTL_DISABLE_SECMEM, 0); - return session; -} - -void ntfs_decrypt_user_key_session_close(ntfs_decrypt_user_key_session *session) -{ -#ifdef __CYGWIN__ - HMODULE tmp; - - if (((NTFS_DECRYPT_USER_KEY_SESSION*)session)->hSystemStore) - fnCertCloseStore(((NTFS_DECRYPT_USER_KEY_SESSION*)session)-> - hSystemStore, CERT_CLOSE_STORE_CHECK_FLAG); - /* - * FIXME: This really needs locking and reference counting so it is - * safe from races. - */ - tmp = hCrypt32; - hCrypt32 = INVALID_HANDLE_VALUE; - FreeLibrary(tmp); -#endif /* defined(__CYGWIN__) */ - free(session); -} - -/** - * reverse_buffer - - * - * This is a utility function for reversing the order of a buffer in place. - * Users of this function should be very careful not to sweep byte order - * problems under the rug. - */ -static inline void reverse_buffer(unsigned char *buf, unsigned buf_size) -{ - unsigned char t; - unsigned i; - - for (i = 0; i < buf_size / 2; i++) { - t = buf[i]; - buf[i] = buf[buf_size - i - 1]; - buf[buf_size - i - 1] = t; - } -} - -ntfs_decrypt_user_key *ntfs_decrypt_user_key_open( - ntfs_decrypt_user_key_session *session __attribute__((unused)), - unsigned char *thumb_print __attribute__((unused)), - unsigned thumb_size __attribute__((unused))) -{ -#ifdef __CYGWIN__ - CRYPT_HASH_BLOB hash_blob; - HCRYPTPROV hCryptProv; - PCCERT_CONTEXT pCert; - BOOL fCallerFreeProv; - HCRYPTKEY hCryptKey; - ntfs_decrypt_user_key *key; - DWORD dwKeySpec; - DWORD key_size; - BYTE key_blob[1000]; - RSAPUBKEY *rsa_pub_key; - gcry_ac_handle_t gcry_handle; - unsigned char *mpi_data; - gcry_mpi_t n, e, d, p, q, u; - gcry_sexp_t sexp_key; - gcry_error_t err; - size_t size; - int rc; - - hash_blob.cbData = thumb_size; - hash_blob.pbData = thumb_print; - - if (!(pCert = fnCertFindCertificateInStore( - ((NTFS_DECRYPT_USER_KEY_SESSION*)session)->hSystemStore, - (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING), 0, - CERT_FIND_HASH, &hash_blob, NULL))) { - fprintf(stderr, "Could not find cert in store.\n"); - goto decrypt_key_open_err; - } - dwKeySpec = AT_KEYEXCHANGE; - if (!fnCryptAcquireCertificatePrivateKey(pCert, - CRYPT_ACQUIRE_CACHE_FLAG, NULL, &hCryptProv, - &dwKeySpec, &fCallerFreeProv)) { - fprintf(stderr, "Could not aquire private key from cert.\n"); - goto decrypt_key_open_err; - } - if (!CryptGetUserKey(hCryptProv, AT_KEYEXCHANGE, &hCryptKey)) { - fprintf(stderr, "Could not aquire user key.\n"); - goto decrypt_key_open_err; - } - key_size = sizeof(key_blob); - if (!CryptExportKey(hCryptKey, 0, PRIVATEKEYBLOB, 0, key_blob, - &key_size)) { - fprintf(stderr, "Could not export key: Error 0x%x\n", - (unsigned)GetLastError()); - errno = EINVAL; - return NULL; - } - CryptDestroyKey(hCryptKey); - rsa_pub_key = (RSAPUBKEY*)(key_blob + sizeof(PUBLICKEYSTRUC)); - if ((err = gcry_ac_open(&gcry_handle, GCRY_AC_RSA, 0))) { - fprintf(stderr, "Could not init gcrypt handle\n"); - errno = EINVAL; - return NULL; - } - gcry_control(GCRYCTL_DISABLE_SECMEM, 0); - e = gcry_mpi_set_ui(NULL, rsa_pub_key->pubexp); - mpi_data = (key_blob + 0x14); - size = rsa_pub_key->bitlen / 8; - reverse_buffer(mpi_data, size); - if ((rc = gcry_mpi_scan(&n, GCRYMPI_FMT_USG, mpi_data, size, &size))) - fprintf(stderr, "error scanning n.\n"); - mpi_data += (rsa_pub_key->bitlen / 8); - size = rsa_pub_key->bitlen / 16; - reverse_buffer(mpi_data, size); - if ((rc = gcry_mpi_scan(&q, GCRYMPI_FMT_USG, mpi_data, size, &size))) - fprintf(stderr, "error scanning p.\n"); - mpi_data += (rsa_pub_key->bitlen / 16); - size = rsa_pub_key->bitlen / 16; - reverse_buffer(mpi_data, size); - if ((rc = gcry_mpi_scan(&p, GCRYMPI_FMT_USG, mpi_data, size, &size))) - fprintf(stderr, "error scanning q.\n"); - mpi_data += (rsa_pub_key->bitlen / 16) * 3; - size = rsa_pub_key->bitlen / 16; - reverse_buffer(mpi_data, size); - if ((rc = gcry_mpi_scan(&u, GCRYMPI_FMT_USG, mpi_data, size, &size))) - fprintf(stderr, "error scanning u.\n"); - mpi_data += (rsa_pub_key->bitlen / 16); - size = rsa_pub_key->bitlen / 8; - reverse_buffer(mpi_data, size); - if ((rc = gcry_mpi_scan(&d, GCRYMPI_FMT_USG, mpi_data, size, &size))) - fprintf(stderr, "error scanning d.\n"); - sexp_key = NULL; - if ((rc = gcry_sexp_build(&sexp_key, NULL, "(private-key (rsa (n %m) " - "(e %m) (d %m) (p %m) (q %m) (u %m)))", n, e, d, p, q, - u))) { - fprintf(stderr, "Could build sexp from data, (error = 0x%x)\n", - rc); - errno = EINVAL; - return NULL; - } - if ((key = (ntfs_decrypt_user_key*) - malloc(sizeof(NTFS_DECRYPT_USER_KEY)))) - ((NTFS_DECRYPT_USER_KEY*)key)->sexp_key = sexp_key; - // todo: release all - return key; -decrypt_key_open_err: - if (hCryptKey) - CryptDestroyKey(hCryptKey); - if (pCert) - fnCertFreeCertificateContext(pCert); - errno = EINVAL; -#else /* !defined(__CYGWIN__) */ - errno = EOPNOTSUPP; -#endif /* !defined(__CYGWIN__) */ - return NULL; -} - -void ntfs_decrypt_user_key_close(ntfs_decrypt_user_key *key) -{ - gcry_sexp_release(((NTFS_DECRYPT_USER_KEY*)key)->sexp_key); - free(key); -} - -/** - * warning: decrypting into the input buffer! - */ -unsigned ntfs_decrypt_user_key_decrypt(ntfs_decrypt_user_key *key, - unsigned char *data, unsigned data_size) -{ - gcry_sexp_t sexp_plain_data, sexp_enc_data; - gcry_ac_handle_t gcry_handle; - gcry_mpi_t mpi_buf; - gcry_ac_data_t in; - gcry_error_t err; - unsigned size, padding_length, i; - int rc; - - if ((err = gcry_ac_open(&gcry_handle, GCRY_AC_RSA, 0))) { - fprintf(stderr, "Could not init gcrypt handle\n"); - errno = EINVAL; - return 0; - } - if ((rc = gcry_ac_data_new(&in))) - fprintf(stderr, "error allocating 'in'.\n"); - reverse_buffer(data, data_size); - size = data_size; - if ((rc = gcry_mpi_scan(&mpi_buf, GCRYMPI_FMT_USG, data, - (size_t)data_size, &size))) - fprintf(stderr, "error scanning 'in'.\n"); - if ((rc = gcry_sexp_build(&sexp_enc_data, &size, "(enc-val (flags) " - "(rsa (a %m)))", mpi_buf))) { - fprintf(stderr, "Could build sexp from data, (error = 0x%x)\n", - rc); - errno = EINVAL; - return 0; - } - if ((rc = gcry_pk_decrypt(&sexp_plain_data, sexp_enc_data, - ((NTFS_DECRYPT_USER_KEY*)key)->sexp_key))) { - fprintf(stderr, "Could not decrypt fek via s-exp, (error = " - "0x%x)\n", rc); - errno = EINVAL; - return 0; - } - sexp_plain_data = gcry_sexp_find_token(sexp_plain_data, "value", 0); - if (!mpi_buf) { - fprintf(stderr, "Could find value in s-exp, (error = 0x%x)\n", - rc); - errno = EINVAL; - return 0; - } - mpi_buf = gcry_sexp_nth_mpi(sexp_plain_data, 1, GCRYMPI_FMT_USG); - if ((rc = gcry_mpi_print(GCRYMPI_FMT_USG, data, data_size, &size, - mpi_buf))) { - fprintf(stderr, "Could copy decrypted data back, (error = " - "0x%x)\n", rc); - errno = EINVAL; - return 0; - } - // remove the pkcs1 padding - for (padding_length = 1; (padding_length < size) && - data[padding_length]; padding_length++) - ; - padding_length++; - // todo: should memcpy fit? (overlapping) - for (i = 0; i + padding_length < size; i++) - data[i] = data[padding_length + i]; - // todo: mpi_buf->data - // todo: release all - gcry_ac_data_destroy(in); - return size - padding_length; -} - -#if 0 -// This is the old code based on OpenSSL. Please do not remove it. AIA - -#include - -/** - * ntfs_desx_key_expand - expand a 128-bit desx key to the needed 192-bit key - * @src: source buffer containing 128-bit key - * - * Expands the on-disk 128-bit desx key to the needed des key, the in-, and the - * out-whitening keys required to perform desx {de,en}cryption. - */ -static void ntfs_desx_key_expand(const u8 *src, u32 *des_key, - u64 *out_whitening, u64 *in_whitening) -{ - static const int salt_len = 12; - static const u8 *salt1 = "Dan Simon "; - static const u8 *salt2 = "Scott Field"; - u32 md[4]; - MD5_CTX ctx1, ctx2; - - MD5_Init(&ctx1); - - /* Hash the on-disk key. */ - MD5_Update(&ctx1, src, 128 / 8); - memcpy(&ctx2, &ctx1, sizeof(ctx1)); - - /* Hash with the first salt and store the result. */ - MD5_Update(&ctx1, salt1, salt_len); - MD5_Final((u8*)md, &ctx1); - des_key[0] = md[0] ^ md[1]; - des_key[1] = md[2] ^ md[3]; - - /* Hash with the second salt and store the result. */ - MD5_Update(&ctx2, salt2, salt_len); - MD5_Final((u8*)md, &ctx2); - *out_whitening = *(u64*)md; - *in_whitening = *(u64*)(md + 2); -} -#endif - -/** - * ntfs_desx_key_expand - expand a 128-bit desx key to the needed 192-bit key - * @src: source buffer containing 128-bit key - * - * Expands the on-disk 128-bit desx key to the needed des key, the in-, and the - * out-whitening keys required to perform desx {de,en}cryption. - */ -static gcry_error_t ntfs_desx_key_expand(const u8 *src, u32 *des_key, - u64 *out_whitening, u64 *in_whitening) -{ - static const u8 *salt1 = "Dan Simon "; - static const u8 *salt2 = "Scott Field"; - static const int salt_len = 12; - gcry_md_hd_t hd1, hd2; - u32 *md; - gcry_error_t err; - - err = gcry_md_open(&hd1, GCRY_MD_MD5, 0); - if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to open MD5 digest.\n"); - return err; - } - /* Hash the on-disk key. */ - gcry_md_write(hd1, src, 128 / 8); - /* Copy the current hash for efficiency. */ - err = gcry_md_copy(&hd2, hd1); - if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to copy MD5 digest object.\n"); - goto out; - } - /* Hash with the first salt and store the result. */ - gcry_md_write(hd1, salt1, salt_len); - md = (u32*)gcry_md_read(hd1, 0); - des_key[0] = md[0] ^ md[1]; - des_key[1] = md[2] ^ md[3]; - /* Hash with the second salt and store the result. */ - gcry_md_write(hd2, salt2, salt_len); - md = (u32*)gcry_md_read(hd2, 0); - *out_whitening = *(u64*)md; - *in_whitening = *(u64*)(md + 2); - gcry_md_close(hd2); -out: - gcry_md_close(hd1); - return err; -} - -/** - * ntfs_desx_setkey - libgcrypt set_key implementation for DES-X-MS128 - * @context: pointer to a variable of type ntfs_desx_ctx - * @key: the 128 bit DES-X-MS128 key, concated with the DES handle - * @keylen: must always be 16 - * - * This is the libgcrypt set_key implementation for DES-X-MS128. - */ -static gcry_err_code_t ntfs_desx_setkey(void *context, const u8 *key, - unsigned keylen) -{ - ntfs_desx_ctx *ctx = context; - gcry_error_t err; - u8 des_key[8]; - - if (keylen != 16) { - fprintf(stderr, "Key length for desx must be 16.\n"); - return GPG_ERR_INV_KEYLEN; - } - err = gcry_cipher_open(&ctx->gcry_cipher_hd, GCRY_CIPHER_DES, - GCRY_CIPHER_MODE_ECB, 0); - if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to open des cipher (error 0x%x).\n", - err); - return err; - } - err = ntfs_desx_key_expand(key, (u32*)des_key, &ctx->out_whitening, - &ctx->in_whitening); - if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to expand desx key (error 0x%x).\n", - err); - gcry_cipher_close(ctx->gcry_cipher_hd); - return err; - } - err = gcry_cipher_setkey(ctx->gcry_cipher_hd, des_key, sizeof(des_key)); - if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to set des key (error 0x%x).\n", err); - gcry_cipher_close(ctx->gcry_cipher_hd); - return err; - } - /* - * Take a note of the ctx->gcry_cipher_hd since we need to close it at - * ntfs_decrypt_data_key_close() time. - */ - **(gcry_cipher_hd_t***)(key + ((keylen + 7) & ~7)) = - &ctx->gcry_cipher_hd; - return GPG_ERR_NO_ERROR; -} - -static void ntfs_desx_decrypt(void *context, u8 *outbuf, const u8 *inbuf) -{ - ntfs_desx_ctx *ctx = context; - gcry_error_t err; - - err = gcry_cipher_reset(ctx->gcry_cipher_hd); - if (err != GPG_ERR_NO_ERROR) - fprintf(stderr, "Failed to reset des cipher (error 0x%x).\n", - err); - *(u64*)outbuf = *(const u64*)inbuf ^ ctx->out_whitening; - err = gcry_cipher_encrypt(ctx->gcry_cipher_hd, outbuf, 8, NULL, 0); - if (err != GPG_ERR_NO_ERROR) - fprintf(stderr, "Des decryption failed (error 0x%x).\n", err); - *(u64*)outbuf ^= ctx->in_whitening; -} - -static gcry_cipher_spec_t ntfs_desx_cipher = { - .name = "DES-X-MS128", - .blocksize = 8, - .keylen = 128, - .contextsize = sizeof(ntfs_desx_ctx), - .setkey = ntfs_desx_setkey, - .decrypt = ntfs_desx_decrypt, -}; - -//#define DO_CRYPTO_TESTS 1 - -#ifdef DO_CRYPTO_TESTS - -/* Do not remove this test code from this file! AIA */ -static BOOL ntfs_desx_key_expand_test(void) -{ - const u8 known_desx_on_disk_key[16] = { - 0xa1, 0xf9, 0xe0, 0xb2, 0x53, 0x23, 0x9e, 0x8f, - 0x0f, 0x91, 0x45, 0xd9, 0x8e, 0x20, 0xec, 0x30 - }; - const u8 known_des_key[8] = { - 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f, - }; - const u8 known_out_whitening[8] = { - 0xed, 0xda, 0x4c, 0x47, 0x60, 0x49, 0xdb, 0x8d, - }; - const u8 known_in_whitening[8] = { - 0x75, 0xf6, 0xa0, 0x1a, 0xc0, 0xca, 0x28, 0x1e - }; - u64 test_out_whitening, test_in_whitening; - union { - u64 u64; - u32 u32[2]; - } test_des_key; - gcry_error_t err; - BOOL res; - - err = ntfs_desx_key_expand(known_desx_on_disk_key, test_des_key.u32, - &test_out_whitening, &test_in_whitening); - if (err != GPG_ERR_NO_ERROR) - res = FALSE; - else - res = test_des_key.u64 == *(u64*)known_des_key && - test_out_whitening == - *(u64*)known_out_whitening && - test_in_whitening == - *(u64*)known_in_whitening; - fprintf(stderr, "Testing whether ntfs_desx_key_expand() works: %s\n", - res ? "SUCCESS" : "FAILED"); - return res; -} - -static BOOL ntfs_des_test(void) -{ - const u8 known_des_key[8] = { - 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f - }; - const u8 known_des_encrypted_data[8] = { - 0xdc, 0xf7, 0x68, 0x2a, 0xaf, 0x48, 0x53, 0x0f - }; - const u8 known_decrypted_data[8] = { - 0xd8, 0xd9, 0x15, 0x23, 0x5b, 0x88, 0x0e, 0x09 - }; - u8 test_decrypted_data[8]; - int res; - gcry_error_t err; - gcry_cipher_hd_t gcry_cipher_hd; - - err = gcry_cipher_open(&gcry_cipher_hd, GCRY_CIPHER_DES, - GCRY_CIPHER_MODE_ECB, 0); - if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to open des cipher (error 0x%x).\n", - err); - return FALSE; - } - err = gcry_cipher_setkey(gcry_cipher_hd, known_des_key, - sizeof(known_des_key)); - if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to set des key (error 0x%x.\n", err); - gcry_cipher_close(gcry_cipher_hd); - return FALSE; - } - /* - * Apply DES decryption (ntfs actually uses encryption when decrypting). - */ - err = gcry_cipher_encrypt(gcry_cipher_hd, test_decrypted_data, - sizeof(test_decrypted_data), known_des_encrypted_data, - sizeof(known_des_encrypted_data)); - gcry_cipher_close(gcry_cipher_hd); - if (err) { - fprintf(stderr, "Failed to des decrypt test data (error " - "0x%x).\n", err); - return FALSE; - } - res = !memcmp(test_decrypted_data, known_decrypted_data, - sizeof(known_decrypted_data)); - fprintf(stderr, "Testing whether des decryption works: %s\n", - res ? "SUCCESS" : "FAILED"); - return res; -} - -#else /* !defined(DO_CRYPTO_TESTS) */ - -static inline BOOL ntfs_desx_key_expand_test(void) -{ - return TRUE; -} - -static inline BOOL ntfs_des_test(void) -{ - return TRUE; -} - -#endif /* !defined(DO_CRYPTO_TESTS) */ - -ntfs_decrypt_data_key *ntfs_decrypt_data_key_open(unsigned char *data, - unsigned data_size __attribute__((unused))) -{ - NTFS_DECRYPT_DATA_KEY *key; - unsigned key_size, wanted_key_size, gcry_algo; - gcry_error_t err; - - key_size = *(u32*)data; - key = (NTFS_DECRYPT_DATA_KEY*)malloc(((((sizeof(*key) + 7) & ~7) + - key_size + 7) & ~7) + sizeof(gcry_cipher_hd_t)); - if (!key) { - errno = ENOMEM; - return NULL; - } - key->alg_id = *(u32*)(data + 8); - key->key_data = (u8*)key + ((sizeof(*key) + 7) & ~7); - memcpy(key->key_data, data + 16, key_size); - key->des_gcry_cipher_hd_ptr = NULL; - *(gcry_cipher_hd_t***)(key->key_data + ((key_size + 7) & ~7)) = - &key->des_gcry_cipher_hd_ptr; - gcry_control(GCRYCTL_DISABLE_SECMEM, 0); - switch (key->alg_id) { - case CALG_DESX: - /* FIXME: This really needs locking so it is safe from races. */ - if (!ntfs_desx_module_count++) { - if (!ntfs_desx_key_expand_test() || !ntfs_des_test()) { - errno = EINVAL; - return NULL; - } - err = gcry_cipher_register(&ntfs_desx_cipher, - &ntfs_desx_algorithm_id, - &ntfs_desx_module); - if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to register desx " - "cipher (error 0x%x).\n", err); - errno = EINVAL; - return NULL; - } - } - wanted_key_size = 16; - gcry_algo = ntfs_desx_algorithm_id; - break; - case CALG_3DES: - wanted_key_size = 24; - gcry_algo = GCRY_CIPHER_3DES; - break; - case CALG_AES_256: - wanted_key_size = 32; - gcry_algo = GCRY_CIPHER_AES256; - break; - default: - wanted_key_size = 8; - gcry_algo = GCRY_CIPHER_DES; - fprintf(stderr, "DES is not supported at present. Please " - "email linux-ntfs-dev@lists.sourceforge.net " - "and say that you saw this message. We will " - "then implement support for DES.\n"); - free(key); - errno = EOPNOTSUPP; - return NULL; - } - if (key_size != wanted_key_size) { - fprintf(stderr, "%s key of %u bytes but needed size is %u " - "bytes, assuming corrupt key. Aborting.\n", - gcry_cipher_algo_name(gcry_algo), key_size, - wanted_key_size); - free(key); - errno = EIO; - return NULL; - } - err = gcry_cipher_open(&key->gcry_cipher_hd, gcry_algo, - GCRY_CIPHER_MODE_CBC, 0); - if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "gcry_cipher_open() failed with error 0x%x.\n", - err); - free(key); - errno = EINVAL; - return 0; - } - err = gcry_cipher_setkey(key->gcry_cipher_hd, key->key_data, key_size); - if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "gcry_cipher_setkey() failed with error " - "0x%x.\n", err); - gcry_cipher_close(key->gcry_cipher_hd); - free(key); - errno = EINVAL; - return NULL; - } - return (ntfs_decrypt_data_key*)key; -} - -void ntfs_decrypt_data_key_close(ntfs_decrypt_data_key *key) -{ - NTFS_DECRYPT_DATA_KEY *dkey = (NTFS_DECRYPT_DATA_KEY*)key; - if (dkey->des_gcry_cipher_hd_ptr) - gcry_cipher_close(*dkey->des_gcry_cipher_hd_ptr); - gcry_cipher_close(dkey->gcry_cipher_hd); - free(key); - /* FIXME: This really needs locking so it is safe from races. */ - if (!--ntfs_desx_module_count) { - gcry_cipher_unregister(ntfs_desx_module); - ntfs_desx_module = NULL; - ntfs_desx_algorithm_id = -1; - } -} - -unsigned ntfs_decrypt_data_key_decrypt_sector(ntfs_decrypt_data_key *key, - unsigned char *data, unsigned long long offset) -{ - NTFS_DECRYPT_DATA_KEY *dkey = (NTFS_DECRYPT_DATA_KEY*)key; - gcry_error_t err; - - err = gcry_cipher_reset(dkey->gcry_cipher_hd); - if (err != GPG_ERR_NO_ERROR) - fprintf(stderr, "Failed to reset cipher (error 0x%x).\n", err); - /* - * Note: You may wonder why are we not calling gcry_cipher_setiv() here - * instead of doing it by hand after the decryption. The answer is - * that gcry_cipher_setiv() wants an iv of length 8 bytes but we give - * it a length of 16 for AES256 so it does not like it. - */ - if ((err = gcry_cipher_decrypt(dkey->gcry_cipher_hd, data, 512, NULL, - 0))) - fprintf(stderr, "Decryption failed (error 0x%x).\n", err); - /* Apply the IV. */ - if (dkey->alg_id == CALG_AES_256) { - ((u64*)data)[0] ^= 0x5816657be9161312LL + offset; - ((u64*)data)[1] ^= 0x1989adbe44918961LL + offset; - } else { - /* All other algos (Des, 3Des, DesX) use the same IV. */ - ((u64*)data)[0] ^= 0x169119629891ad13LL + offset; - } - return 512; -} diff --git a/ntfsprogs/decrypt.h b/ntfsprogs/decrypt.h deleted file mode 100644 index 56fe168d..00000000 --- a/ntfsprogs/decrypt.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * decrypt.h - Interface for decryption rutines. Part of the Linux-NTFS - * project. - * - * Copyright (c) 2005 Yuval Fledel - * Copyright (c) 2005 Anton Altaparmakov - * - * This program/include file 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 of the License, or - * (at your option) any later version. - * - * This program/include file 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 (in the main directory of the Linux-NTFS - * distribution in the file COPYING); if not, write to the Free Software - * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _NTFS_DECRYPT_H -#define _NTFS_DECRYPT_H - -typedef void *ntfs_decrypt_user_key_session; -typedef void *ntfs_decrypt_user_key; -typedef void *ntfs_decrypt_data_key; - -extern ntfs_decrypt_user_key_session *ntfs_decrypt_user_key_session_open(void); -extern void ntfs_decrypt_user_key_session_close( - ntfs_decrypt_user_key_session *session); - -extern ntfs_decrypt_user_key *ntfs_decrypt_user_key_open( - ntfs_decrypt_user_key_session *session, - unsigned char *thumb_print, unsigned thumb_size); -extern void ntfs_decrypt_user_key_close(ntfs_decrypt_user_key *key); - -extern unsigned ntfs_decrypt_user_key_decrypt(ntfs_decrypt_user_key *key, - unsigned char *data, unsigned data_size); - -extern ntfs_decrypt_data_key *ntfs_decrypt_data_key_open(unsigned char *data, - unsigned data_size); -extern void ntfs_decrypt_data_key_close(ntfs_decrypt_data_key *key); - -extern unsigned ntfs_decrypt_data_key_decrypt_sector(ntfs_decrypt_data_key *key, - unsigned char *data, unsigned long long offset); - -#endif /* defined _NTFS_DECRYPT_H */ diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 63580c67..b08e6ff3 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -1,10 +1,11 @@ /** - * ntfsdecrypt - Part of the Linux-NTFS project. + * ntfsdecrypt - Decrypt ntfs encrypted files. Part of the Linux-NTFS project. * * Copyright (c) 2005 Yuval Fledel * Copyright (c) 2005 Anton Altaparmakov * - * This utility will decrypt files and print on the standard output. + * This utility will decrypt files and print the decrypted data on the standard + * output. * * 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 @@ -24,10 +25,17 @@ #include "config.h" +#include +#include +#include #include #include #include #include +#include +#include +#include +#include #include "types.h" #include "attrib.h" @@ -36,9 +44,33 @@ #include "debug.h" #include "dir.h" #include "layout.h" -#include "decrypt.h" + +typedef gcry_sexp_t ntfs_rsa_private_key; + +typedef struct { + u8 *key_data; + u32 alg_id; + gcry_cipher_hd_t gcry_cipher_hd; + gcry_cipher_hd_t *des_gcry_cipher_hd_ptr; +} ntfs_fek; + +#define CALG_DES (0x6601) +/* If not one of the below three, fall back to standard Des. */ +#define CALG_3DES (0x6603) +#define CALG_DESX (0x6604) +#define CALG_AES_256 (0x6610) + +/* DESX-MS128 implementation for libgcrypt. */ +static gcry_module_t ntfs_desx_module; +static int ntfs_desx_algorithm_id = -1; + +typedef struct { + u64 in_whitening, out_whitening; + gcry_cipher_hd_t gcry_cipher_hd; +} ntfs_desx_ctx; struct options { + char *keyfile; /* .pfx file containing the user's private key. */ char *device; /* Device/File to work with */ char *file; /* File to display */ s64 inode; /* Inode to work with */ @@ -60,7 +92,6 @@ static ntfschar EFS[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('E'), const_cpu_to_le16('F'), const_cpu_to_le16('S'), const_cpu_to_le16('\0') }; -static const int EFS_name_length = 4; /** * version - Print version information about the program @@ -87,14 +118,14 @@ static void version(void) */ static void usage(void) { - Printf("\nUsage: %s [options] device [file]\n\n" - " -i, --inode num Display this inode\n\n" - " -f --force Use less caution\n" - " -h --help Print this help\n" - " -q --quiet Less output\n" - " -V --version Version information\n" - " -v --verbose More output\n\n", - //" -r --raw Display the compressed or encrypted file", + Printf("\nUsage: %s [options] -k name.pfx device [file]\n\n" + " -i, --inode num Display this inode\n\n" + " -k --keyfile name.pfx Use file name as the user's private key file.\n" + " -f --force Use less caution\n" + " -h --help Print this help\n" + " -q --quiet Less output\n" + " -V --version Version information\n" + " -v --verbose More output\n\n", EXEC_NAME); Printf("%s%s\n", ntfs_bugs, ntfs_home); } @@ -110,11 +141,12 @@ static void usage(void) */ static int parse_options(int argc, char **argv) { - static const char *sopt = "-fh?i:qVv"; // F:N: + static const char *sopt = "-fh?i:k:qVv"; static const struct option lopt[] = { {"force", no_argument, NULL, 'f'}, {"help", no_argument, NULL, 'h'}, {"inode", required_argument, NULL, 'i'}, + {"keyfile", required_argument, NULL, 'k'}, {"quiet", no_argument, NULL, 'q'}, {"version", no_argument, NULL, 'V'}, {"verbose", no_argument, NULL, 'v'}, @@ -149,6 +181,15 @@ static int parse_options(int argc, char **argv) case '?': help++; break; + case 'k': + if (!opts.keyfile) + opts.keyfile = argv[optind - 1]; + else { + Eprintf("You must specify exactly one " + "key file.\n"); + err++; + } + break; case 'i': if (opts.inode != -1) Eprintf("You must specify exactly one " @@ -178,20 +219,20 @@ static int parse_options(int argc, char **argv) if (help || ver) { opts.quiet = 0; } else { - if (opts.device == NULL) { + if (!opts.keyfile) { + Eprintf("You must specify a key file.\n"); + err++; + } else if (opts.device == NULL) { Eprintf("You must specify a device.\n"); err++; - } else if (opts.file == NULL && opts.inode == -1) { Eprintf("You must specify a file or inode with the -i " "option.\n"); err++; - } else if (opts.file != NULL && opts.inode != -1) { Eprintf("You can't specify both a file and inode.\n"); err++; } - if (opts.quiet && opts.verbose) { Eprintf("You may not use --quiet and --verbose at the " "same time.\n"); @@ -207,17 +248,802 @@ static int parse_options(int argc, char **argv) return (!err && !help && !ver); } +static int ntfs_pkcs12_load_pfxfile(const char *keyfile, u8 **pfx, + unsigned *pfx_size) +{ + int f, to_read, total, attempts, br; + struct stat stat; + + if (!keyfile || !pfx || !pfx_size) { + fprintf(stderr, "You have to specify the key file, a pointer " + "to hold the key file contents, and a pointer " + "to hold the size of the key file contents."); + return -1; + } + f = open(keyfile, O_RDONLY); + if (f == -1) { + perror("Failed to open key file"); + return -1; + } + if (fstat(f, &stat) == -1) { + perror("Failed to stat key file"); + goto file_out; + } + if (!S_ISREG(stat.st_mode)) { + fprintf(stderr, "Key file is not a regular file, cannot read " + "it."); + goto file_out; + } + if (!stat.st_size) { + fprintf(stderr, "Key file has zero size."); + goto file_out; + } + *pfx = malloc(stat.st_size + 1); + if (!*pfx) { + perror("Failed to allocate buffer for key file contents"); + goto file_out; + } + to_read = stat.st_size; + total = attempts = 0; + do { + br = read(f, *pfx + total, to_read); + if (br == -1) { + perror("Failed to read from key file"); + goto free_out; + } + if (!br) + attempts++; + to_read -= br; + total += br; + } while (to_read > 0 && attempts < 3); + close(f); + /* Make sure it is zero terminated. */ + (*pfx)[stat.st_size] = 0; + *pfx_size = stat.st_size; + return 0; +free_out: + free(*pfx); +file_out: + close(f); + return -1; +} + +static int ntfs_crypto_init(void) +{ + int err; + + /* Initialize gcrypt library. Note: Must come before GNU TLS init. */ + if (gcry_control(GCRYCTL_DISABLE_SECMEM, 0) != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to initialize the gcrypt library.\n"); + return -1; + } + /* Initialize GNU TLS library. Note: Must come after libgcrypt init. */ + err = gnutls_global_init(); + if (err < 0) { + fprintf(stderr, "Failed to initialize GNU TLS library: %s\n", + gnutls_strerror(err)); + return -1; + } + return 0; +} + +static void ntfs_crypto_deinit(void) +{ + gnutls_global_deinit(); + if (ntfs_desx_module) { + gcry_cipher_unregister(ntfs_desx_module); + ntfs_desx_module = NULL; + ntfs_desx_algorithm_id = -1; + } +} + +static ntfs_rsa_private_key ntfs_rsa_private_key_import_from_gnutls( + gnutls_x509_privkey_t priv_key) +{ + int i, tmp_size; + gnutls_datum_t rd[6]; + gcry_mpi_t rm[6]; + gcry_sexp_t rsa_key; + + /* Extract the RSA parameters from the GNU TLS private key. */ + if (gnutls_x509_privkey_export_rsa_raw(priv_key, &rd[0], &rd[1], + &rd[2], &rd[3], &rd[4], &rd[5]) != 0) { + fprintf(stderr, "Failed to export rsa parameters. (Is the " + "key an RSA private key?)\n"); + return NULL; + } + /* Convert each RSA parameter to mpi format. */ + for (i = 0; i < 6; i++) { + if (gcry_mpi_scan(&rm[i], GCRYMPI_FMT_USG, rd[i].data, + rd[i].size, &tmp_size) !=0) { + fprintf(stderr, "Failed to convert RSA parameter %i " + "to mpi format (size %d)\n", i, + rd[i].size); + return NULL; + } + } + /* Build the gcrypt private key. */ + if (gcry_sexp_build(&rsa_key, NULL, + "(private-key(rsa((n%m)(e%m)(d%m)(p%m)(q%m)(u%m))))", + rm[0], rm[1], rm[2], rm[3], rm[4], rm[5]) != 0) { + fprintf(stderr, "Failed to build RSA private key s-exp.\n"); + return NULL; + } + return (ntfs_rsa_private_key)rsa_key; +} + +static ntfs_rsa_private_key ntfs_pkcs12_extract_rsa_key(u8 *pfx, int pfx_size, + char *password) +{ + int err, bag_index, flags; + gnutls_datum_t dpfx, dkey; + gnutls_pkcs12_t pkcs12; + gnutls_pkcs12_bag_t bag; + gnutls_x509_privkey_t pkey; + ntfs_rsa_private_key rsa_key = NULL; + + /* Create a pkcs12 structure. */ + err = gnutls_pkcs12_init(&pkcs12); + if (err < 0) { + fprintf(stderr, "Failed to initialize PKCS#12 structure: %s\n", + gnutls_strerror(err)); + return NULL; + } + /* Convert the PFX file (DER format) to native pkcs12 format. */ + dpfx.data = pfx; + dpfx.size = pfx_size; + err = gnutls_pkcs12_import(pkcs12, &dpfx, GNUTLS_X509_FMT_DER, 0); + if (err < 0) { + fprintf(stderr, "Failed to convert the PFX file from DER to " + "native PKCS#12 format: %s\n", + gnutls_strerror(err)); + goto out; + } + /* + * Verify that the password is correct and that the key file has not + * been tampered with. + */ + err = gnutls_pkcs12_verify_mac(pkcs12, password); + if (err < 0) { + fprintf(stderr, "Failed to verify the MAC (%s). Is the " + "password correct?\n", gnutls_strerror(err)); + goto out; + } + for (bag_index = 0; ; bag_index++) { + err = gnutls_pkcs12_bag_init(&bag); + if (err < 0) { + fprintf(stderr, "Failed to initialize PKCS#12 Bag " + "structure: %s\n", + gnutls_strerror(err)); + goto out; + } + err = gnutls_pkcs12_get_bag(pkcs12, bag_index, bag); + if (err < 0) { + if (err == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) + break; + fprintf(stderr, "Failed to obtain Bag from PKCS#12 " + "structure: %s\n", + gnutls_strerror(err)); + goto bag_out; + } +check_again: + err = gnutls_pkcs12_bag_get_count(bag); + if (err < 0) { + fprintf(stderr, "Failed to obtain Bag count: %s\n", + gnutls_strerror(err)); + goto bag_out; + } + err = gnutls_pkcs12_bag_get_type(bag, 0); + if (err < 0) { + fprintf(stderr, "Failed to determine Bag type: %s\n", + gnutls_strerror(err)); + goto bag_out; + } + flags = 0; + switch (err) { + case GNUTLS_BAG_PKCS8_KEY: + flags = GNUTLS_PKCS_PLAIN; + case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: + gnutls_x509_privkey_init(&pkey); + + err = gnutls_pkcs12_bag_get_data(bag, 0, &dkey); + if (err < 0) { + fprintf(stderr, "Failed to obtain Bag data: " + "%s\n", gnutls_strerror(err)); + goto bag_out; + } + /* Decrypt the private key into GNU TLS format. */ + err = gnutls_x509_privkey_import_pkcs8(pkey, &dkey, + GNUTLS_X509_FMT_DER, password, flags); + if (err < 0) { + fprintf(stderr, "Failed to convert private " + "key from DER to GNU TLS " + "format: %s\n", + gnutls_strerror(err)); + goto bag_out; + } + /* Convert the private key to our internal format. */ + rsa_key = ntfs_rsa_private_key_import_from_gnutls(pkey); + goto bag_out; + case GNUTLS_BAG_ENCRYPTED: + err = gnutls_pkcs12_bag_decrypt(bag, password); + if (err < 0) { + fprintf(stderr, "Failed to decrypt Bag: %s\n", + gnutls_strerror(err)); + goto bag_out; + } + goto check_again; + default: + /* We do not care about other types. */ + break; + } + gnutls_pkcs12_bag_deinit(bag); + } +bag_out: + gnutls_pkcs12_bag_deinit(bag); +out: + gnutls_pkcs12_deinit(pkcs12); + return rsa_key; +} + +static void ntfs_rsa_private_key_release(ntfs_rsa_private_key rsa_key) +{ + gcry_sexp_release((gcry_sexp_t)rsa_key); +} + +/** + * ntfs_buffer_reverse - + * + * This is a utility function for reversing the order of a buffer in place. + * Users of this function should be very careful not to sweep byte order + * problems under the rug. + */ +static inline void ntfs_buffer_reverse(u8 *buf, unsigned buf_size) +{ + unsigned i; + u8 t; + + for (i = 0; i < buf_size / 2; i++) { + t = buf[i]; + buf[i] = buf[buf_size - i - 1]; + buf[buf_size - i - 1] = t; + } +} + +/** + * ntfs_raw_fek_decrypt - + * + * Note: decrypting into the input buffer. + */ +static unsigned ntfs_raw_fek_decrypt(u8 *fek, u32 fek_size, + ntfs_rsa_private_key rsa_key) +{ + gcry_mpi_t fek_mpi; + gcry_sexp_t fek_sexp, fek_sexp2; + gcry_error_t err; + size_t size, padding; + + /* Reverse the raw FEK. */ + ntfs_buffer_reverse(fek, fek_size); + /* Convert the FEK to internal MPI format. */ + err = gcry_mpi_scan(&fek_mpi, GCRYMPI_FMT_USG, fek, fek_size, NULL); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to convert file encryption key to " + "internal MPI format: %s\n", + gcry_strerror(err)); + return 0; + } + /* Create an internal S-expression from the FEK. */ + err = gcry_sexp_build(&fek_sexp, NULL, + "(enc-val (flags) (rsa (a %m)))", fek_mpi); + gcry_mpi_release(fek_mpi); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to create internal S-expression of " + "the file encryption key: %s\n", + gcry_strerror(err)); + return 0; + } + /* Decrypt the FEK. */ + err = gcry_pk_decrypt(&fek_sexp2, fek_sexp, (gcry_sexp_t)rsa_key); + gcry_sexp_release(fek_sexp); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to decrypt the file encryption key: " + "%s\n", gcry_strerror(err)); + return 0; + } + /* Extract the actual FEK from the decrypted raw S-expression. */ + fek_sexp = gcry_sexp_find_token(fek_sexp2, "value", 0); + gcry_sexp_release(fek_sexp2); + if (!fek_sexp) { + fprintf(stderr, "Failed to find the decrypted file encryption " + "key in the internal S-expression.\n"); + return 0; + } + /* Convert the decrypted FEK S-expression into MPI format. */ + fek_mpi = gcry_sexp_nth_mpi(fek_sexp, 1, GCRYMPI_FMT_USG); + gcry_sexp_release(fek_sexp); + if (!fek_mpi) { + fprintf(stderr, "Failed to convert the decrypted file " + "encryption key S-expression to internal MPI " + "format.\n"); + return 0; + } + /* Convert the decrypted FEK from MPI format to binary data. */ + err = gcry_mpi_print(GCRYMPI_FMT_USG, fek, fek_size, &size, fek_mpi); + gcry_mpi_release(fek_mpi); + if (err != GPG_ERR_NO_ERROR || !size) { + fprintf(stderr, "Failed to convert decrypted file encryption " + "key from internal MPI format to binary data: " + "%s\n", gcry_strerror(err)); + return 0; + } + /* + * Finally, remove the PKCS#1 padding and return the size of the + * decrypted FEK. + */ + padding = strnlen(fek, size) + 1; + if (padding > size) { + fprintf(stderr, "Failed to remove PKCS#1 padding from " + "decrypted file encryption key.\n"); + return 0; + } + size -= padding; + memmove(fek, fek + padding, size); + return size; +} + +/** + * ntfs_desx_key_expand - expand a 128-bit desx key to the needed 192-bit key + * @src: source buffer containing 128-bit key + * + * Expands the on-disk 128-bit desx key to the needed des key, the in-, and the + * out-whitening keys required to perform desx {de,en}cryption. + */ +static gcry_error_t ntfs_desx_key_expand(const u8 *src, u32 *des_key, + u64 *out_whitening, u64 *in_whitening) +{ + static const u8 *salt1 = "Dan Simon "; + static const u8 *salt2 = "Scott Field"; + static const int salt_len = 12; + gcry_md_hd_t hd1, hd2; + u32 *md; + gcry_error_t err; + + err = gcry_md_open(&hd1, GCRY_MD_MD5, 0); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to open MD5 digest.\n"); + return err; + } + /* Hash the on-disk key. */ + gcry_md_write(hd1, src, 128 / 8); + /* Copy the current hash for efficiency. */ + err = gcry_md_copy(&hd2, hd1); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to copy MD5 digest object.\n"); + goto out; + } + /* Hash with the first salt and store the result. */ + gcry_md_write(hd1, salt1, salt_len); + md = (u32*)gcry_md_read(hd1, 0); + des_key[0] = md[0] ^ md[1]; + des_key[1] = md[2] ^ md[3]; + /* Hash with the second salt and store the result. */ + gcry_md_write(hd2, salt2, salt_len); + md = (u32*)gcry_md_read(hd2, 0); + *out_whitening = *(u64*)md; + *in_whitening = *(u64*)(md + 2); + gcry_md_close(hd2); +out: + gcry_md_close(hd1); + return err; +} + +/** + * ntfs_desx_setkey - libgcrypt set_key implementation for DES-X-MS128 + * @context: pointer to a variable of type ntfs_desx_ctx + * @key: the 128 bit DES-X-MS128 key, concated with the DES handle + * @keylen: must always be 16 + * + * This is the libgcrypt set_key implementation for DES-X-MS128. + */ +static gcry_err_code_t ntfs_desx_setkey(void *context, const u8 *key, + unsigned keylen) +{ + ntfs_desx_ctx *ctx = context; + gcry_error_t err; + u8 des_key[8]; + + if (keylen != 16) { + fprintf(stderr, "Key length for desx must be 16.\n"); + return GPG_ERR_INV_KEYLEN; + } + err = gcry_cipher_open(&ctx->gcry_cipher_hd, GCRY_CIPHER_DES, + GCRY_CIPHER_MODE_ECB, 0); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to open des cipher (error 0x%x).\n", + err); + return err; + } + err = ntfs_desx_key_expand(key, (u32*)des_key, &ctx->out_whitening, + &ctx->in_whitening); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to expand desx key (error 0x%x).\n", + err); + gcry_cipher_close(ctx->gcry_cipher_hd); + return err; + } + err = gcry_cipher_setkey(ctx->gcry_cipher_hd, des_key, sizeof(des_key)); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to set des key (error 0x%x).\n", err); + gcry_cipher_close(ctx->gcry_cipher_hd); + return err; + } + /* + * Take a note of the ctx->gcry_cipher_hd since we need to close it at + * ntfs_decrypt_data_key_close() time. + */ + **(gcry_cipher_hd_t***)(key + ((keylen + 7) & ~7)) = + &ctx->gcry_cipher_hd; + return GPG_ERR_NO_ERROR; +} + +static void ntfs_desx_decrypt(void *context, u8 *outbuf, const u8 *inbuf) +{ + ntfs_desx_ctx *ctx = context; + gcry_error_t err; + + err = gcry_cipher_reset(ctx->gcry_cipher_hd); + if (err != GPG_ERR_NO_ERROR) + fprintf(stderr, "Failed to reset des cipher (error 0x%x).\n", + err); + *(u64*)outbuf = *(const u64*)inbuf ^ ctx->out_whitening; + err = gcry_cipher_encrypt(ctx->gcry_cipher_hd, outbuf, 8, NULL, 0); + if (err != GPG_ERR_NO_ERROR) + fprintf(stderr, "Des decryption failed (error 0x%x).\n", err); + *(u64*)outbuf ^= ctx->in_whitening; +} + +static gcry_cipher_spec_t ntfs_desx_cipher = { + .name = "DES-X-MS128", + .blocksize = 8, + .keylen = 128, + .contextsize = sizeof(ntfs_desx_ctx), + .setkey = ntfs_desx_setkey, + .decrypt = ntfs_desx_decrypt, +}; + +//#define DO_CRYPTO_TESTS 1 + +#ifdef DO_CRYPTO_TESTS + +/* Do not remove this test code from this file! AIA */ +static BOOL ntfs_desx_key_expand_test(void) +{ + const u8 known_desx_on_disk_key[16] = { + 0xa1, 0xf9, 0xe0, 0xb2, 0x53, 0x23, 0x9e, 0x8f, + 0x0f, 0x91, 0x45, 0xd9, 0x8e, 0x20, 0xec, 0x30 + }; + const u8 known_des_key[8] = { + 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f, + }; + const u8 known_out_whitening[8] = { + 0xed, 0xda, 0x4c, 0x47, 0x60, 0x49, 0xdb, 0x8d, + }; + const u8 known_in_whitening[8] = { + 0x75, 0xf6, 0xa0, 0x1a, 0xc0, 0xca, 0x28, 0x1e + }; + u64 test_out_whitening, test_in_whitening; + union { + u64 u64; + u32 u32[2]; + } test_des_key; + gcry_error_t err; + BOOL res; + + err = ntfs_desx_key_expand(known_desx_on_disk_key, test_des_key.u32, + &test_out_whitening, &test_in_whitening); + if (err != GPG_ERR_NO_ERROR) + res = FALSE; + else + res = test_des_key.u64 == *(u64*)known_des_key && + test_out_whitening == + *(u64*)known_out_whitening && + test_in_whitening == + *(u64*)known_in_whitening; + fprintf(stderr, "Testing whether ntfs_desx_key_expand() works: %s\n", + res ? "SUCCESS" : "FAILED"); + return res; +} + +static BOOL ntfs_des_test(void) +{ + const u8 known_des_key[8] = { + 0x27, 0xd1, 0x93, 0x09, 0xcb, 0x78, 0x93, 0x1f + }; + const u8 known_des_encrypted_data[8] = { + 0xdc, 0xf7, 0x68, 0x2a, 0xaf, 0x48, 0x53, 0x0f + }; + const u8 known_decrypted_data[8] = { + 0xd8, 0xd9, 0x15, 0x23, 0x5b, 0x88, 0x0e, 0x09 + }; + u8 test_decrypted_data[8]; + int res; + gcry_error_t err; + gcry_cipher_hd_t gcry_cipher_hd; + + err = gcry_cipher_open(&gcry_cipher_hd, GCRY_CIPHER_DES, + GCRY_CIPHER_MODE_ECB, 0); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to open des cipher (error 0x%x).\n", + err); + return FALSE; + } + err = gcry_cipher_setkey(gcry_cipher_hd, known_des_key, + sizeof(known_des_key)); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to set des key (error 0x%x.\n", err); + gcry_cipher_close(gcry_cipher_hd); + return FALSE; + } + /* + * Apply DES decryption (ntfs actually uses encryption when decrypting). + */ + err = gcry_cipher_encrypt(gcry_cipher_hd, test_decrypted_data, + sizeof(test_decrypted_data), known_des_encrypted_data, + sizeof(known_des_encrypted_data)); + gcry_cipher_close(gcry_cipher_hd); + if (err) { + fprintf(stderr, "Failed to des decrypt test data (error " + "0x%x).\n", err); + return FALSE; + } + res = !memcmp(test_decrypted_data, known_decrypted_data, + sizeof(known_decrypted_data)); + fprintf(stderr, "Testing whether des decryption works: %s\n", + res ? "SUCCESS" : "FAILED"); + return res; +} + +#else /* !defined(DO_CRYPTO_TESTS) */ + +static inline BOOL ntfs_desx_key_expand_test(void) +{ + return TRUE; +} + +static inline BOOL ntfs_des_test(void) +{ + return TRUE; +} + +#endif /* !defined(DO_CRYPTO_TESTS) */ + +static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, + unsigned fek_size __attribute__((unused))) +{ + ntfs_fek *fek; + u32 key_size, wanted_key_size, gcry_algo; + gcry_error_t err; + + // TODO: Sanity checking of sizes and offsets. + key_size = *(u32*)fek_buf; + fek = malloc(((((sizeof(*fek) + 7) & ~7) + key_size + 7) & ~7) + + sizeof(gcry_cipher_hd_t)); + if (!fek) { + errno = ENOMEM; + return NULL; + } + fek->alg_id = *(u32*)(fek_buf + 8); + fek->key_data = (u8*)fek + ((sizeof(*fek) + 7) & ~7); + memcpy(fek->key_data, fek_buf + 16, key_size); + fek->des_gcry_cipher_hd_ptr = NULL; + *(gcry_cipher_hd_t***)(fek->key_data + ((key_size + 7) & ~7)) = + &fek->des_gcry_cipher_hd_ptr; + switch (fek->alg_id) { + case CALG_DESX: + if (!ntfs_desx_module) { + if (!ntfs_desx_key_expand_test() || !ntfs_des_test()) { + err = EINVAL; + goto out; + } + err = gcry_cipher_register(&ntfs_desx_cipher, + &ntfs_desx_algorithm_id, + &ntfs_desx_module); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to register desx " + "cipher: %s\n", + gcry_strerror(err)); + err = EINVAL; + goto out; + } + } + wanted_key_size = 16; + gcry_algo = ntfs_desx_algorithm_id; + break; + case CALG_3DES: + wanted_key_size = 24; + gcry_algo = GCRY_CIPHER_3DES; + break; + case CALG_AES_256: + wanted_key_size = 32; + gcry_algo = GCRY_CIPHER_AES256; + break; + default: + wanted_key_size = 8; + gcry_algo = GCRY_CIPHER_DES; + fprintf(stderr, "DES is not supported at present. Please " + "email linux-ntfs-dev@lists.sourceforge.net " + "and say that you saw this message. We will " + "then implement support for DES.\n"); + err = EOPNOTSUPP; + goto out; + } + if (key_size != wanted_key_size) { + fprintf(stderr, "%s key of %u bytes but needed size is %u " + "bytes, assuming corrupt key. Aborting.\n", + gcry_cipher_algo_name(gcry_algo), key_size, + wanted_key_size); + err = EIO; + goto out; + } + err = gcry_cipher_open(&fek->gcry_cipher_hd, gcry_algo, + GCRY_CIPHER_MODE_CBC, 0); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "gcry_cipher_open() failed: %s\n", + gcry_strerror(err)); + err = EINVAL; + goto out; + } + err = gcry_cipher_setkey(fek->gcry_cipher_hd, fek->key_data, key_size); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "gcry_cipher_setkey() failed: %s\n", + gcry_strerror(err)); + gcry_cipher_close(fek->gcry_cipher_hd); + err = EINVAL; + goto out; + } + return fek; +out: + free(fek); + errno = err; + return NULL; +} + +static void ntfs_fek_release(ntfs_fek *fek) +{ + if (fek->des_gcry_cipher_hd_ptr) + gcry_cipher_close(*fek->des_gcry_cipher_hd_ptr); + gcry_cipher_close(fek->gcry_cipher_hd); + free(fek); +} + +static ntfs_fek *ntfs_df_array_fek_get(EFS_DF_ARRAY_HEADER *df_array, + ntfs_rsa_private_key rsa_key) +{ + EFS_DF_HEADER *df_header; + EFS_DF_CREDENTIAL_HEADER *df_cred; + EFS_DF_CERTIFICATE_HEADER *df_cert; + u8 *fek_buf; + ntfs_fek *fek; + u32 df_count, fek_size; + unsigned i; + + df_header = (EFS_DF_HEADER*)(df_array + 1); + df_count = le32_to_cpu(df_array->df_count); + for (i = 0; i < df_count; i++) { + df_cred = (EFS_DF_CREDENTIAL_HEADER*)((u8*)df_header + + le32_to_cpu(df_header->cred_header_offset)); + df_cert = (EFS_DF_CERTIFICATE_HEADER*)((u8*)df_cred + + le32_to_cpu(df_cred->cert_header_offset)); + fek_size = le32_to_cpu(df_header->fek_size); + fek_buf = (u8*)df_header + le32_to_cpu(df_header->fek_offset); + /* Decrypt the FEK. Note: This is done in place. */ + fek_size = ntfs_raw_fek_decrypt(fek_buf, fek_size, rsa_key); + if (fek_size) { + /* Convert the FEK to our internal format. */ + fek = ntfs_fek_import_from_raw(fek_buf, fek_size); + if (fek) + return fek; + fprintf(stderr, "Failed to convert the decrypted file " + "encryption key to internal format.\n"); + } else + fprintf(stderr, "Failed to decrypt the file " + "encryption key.\n"); + df_header = (EFS_DF_HEADER*)((u8*)df_header + + le32_to_cpu(df_header->df_length)); + } + return NULL; +} + +/** + * ntfs_inode_fek_get - + */ +static ntfs_fek *ntfs_inode_fek_get(ntfs_inode *inode, + ntfs_rsa_private_key rsa_key) +{ + ntfs_attr *na; + EFS_ATTR_HEADER *efs; + EFS_DF_ARRAY_HEADER *df_array; + ntfs_fek *fek = NULL; + + /* Obtain the $EFS contents. */ + na = ntfs_attr_open(inode, AT_LOGGED_UTILITY_STREAM, EFS, 4); + if (!na) { + perror("Failed to open $EFS attribute"); + return NULL; + } + efs = malloc(na->data_size); + if (!efs) { + perror("Failed to allocate internal buffer"); + ntfs_attr_close(na); + return NULL; + } + if (ntfs_attr_pread(na, 0, na->data_size, efs) != na->data_size) { + perror("Failed to read $EFS attribute"); + free(efs); + ntfs_attr_close(na); + return NULL; + } + ntfs_attr_close(na); + /* Iterate through the DDFs & DRFs until we obtain a key. */ + if (efs->offset_to_ddf_array) { + df_array = (EFS_DF_ARRAY_HEADER*)((u8*)efs + + le32_to_cpu(efs->offset_to_ddf_array)); + fek = ntfs_df_array_fek_get(df_array, rsa_key); + } + if (!fek && efs->offset_to_drf_array) { + df_array = (EFS_DF_ARRAY_HEADER*)((u8*)efs + + le32_to_cpu(efs->offset_to_drf_array)); + fek = ntfs_df_array_fek_get(df_array, rsa_key); + } + free(efs); + return fek; +} + +int ntfs_fek_decrypt_sector(ntfs_fek *fek, u8 *data, const u64 offset) +{ + gcry_error_t err; + + err = gcry_cipher_reset(fek->gcry_cipher_hd); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to reset cipher: %s\n", + gcry_strerror(err)); + return -1; + } + /* + * Note: You may wonder why we are not calling gcry_cipher_setiv() here + * instead of doing it by hand after the decryption. The answer is + * that gcry_cipher_setiv() wants an iv of length 8 bytes but we give + * it a length of 16 for AES256 so it does not like it. + */ + err = gcry_cipher_decrypt(fek->gcry_cipher_hd, data, 512, NULL, 0); + if (err != GPG_ERR_NO_ERROR) { + fprintf(stderr, "Decryption failed: %s\n", gcry_strerror(err)); + return -1; + } + /* Apply the IV. */ + if (fek->alg_id == CALG_AES_256) { + ((u64*)data)[0] ^= 0x5816657be9161312ULL + offset; + ((u64*)data)[1] ^= 0x1989adbe44918961ULL + offset; + } else { + /* All other algos (Des, 3Des, DesX) use the same IV. */ + ((u64*)data)[0] ^= 0x169119629891ad13ULL + offset; + } + return 512; +} + /** * cat */ -static int cat_decrypt(ntfs_inode *inode, ntfs_decrypt_data_key *fek) +// TODO: +static int ntfs_cat_decrypt(ntfs_inode *inode, ntfs_fek *fek) { int bufsize = 512; char *buffer; ntfs_attr *attr; s64 bytes_read, written, offset, total; s64 old_data_size, old_initialized_size; - unsigned i; + int i; buffer = malloc(bufsize); if (!buffer) @@ -247,8 +1073,8 @@ static int cat_decrypt(ntfs_inode *inode, ntfs_decrypt_data_key *fek) } if (!bytes_read) break; - if ((i = ntfs_decrypt_data_key_decrypt_sector(fek, buffer, - offset)) < bytes_read) { + if ((i = ntfs_fek_decrypt_sector(fek, buffer, offset)) < + bytes_read) { perror("ERROR: Couldn't decrypt all data!"); Eprintf("%u/%lld/%lld/%lld\n", i, (long long)bytes_read, (long long)offset, (long long)total); @@ -272,108 +1098,6 @@ static int cat_decrypt(ntfs_inode *inode, ntfs_decrypt_data_key *fek) return 0; } -static ntfs_decrypt_data_key *get_fek_from_df_array( - ntfs_decrypt_user_key_session *session, - EFS_DF_ARRAY_HEADER *df_array) -{ - u32 df_count, hash_size, fek_size; - EFS_DF_CREDENTIAL_HEADER *df_cred; - EFS_DF_CERTIFICATE_HEADER *df_cert; - EFS_DF_HEADER *df_header; - ntfs_decrypt_user_key *key; - u8 *hash_data, *fek_buf; - unsigned i; - - df_header = (EFS_DF_HEADER*)(df_array + 1); - df_count = le32_to_cpu(df_array->df_count); - //Eprintf("df_count 0x%x\n", df_count); - for (i = 0; i < df_count; i++) { - //Eprintf("ddf 0x%x\n", i); - df_cred = (EFS_DF_CREDENTIAL_HEADER*)((u8*)df_header + - le32_to_cpu(df_header->cred_header_offset)); - df_cert = (EFS_DF_CERTIFICATE_HEADER*)((u8*)df_cred + - le32_to_cpu(df_cred->cert_header_offset)); - hash_size = le32_to_cpu(df_cert->thumbprint_size); - hash_data = (u8*)df_cert + - le32_to_cpu(df_cert->thumbprint_offset); - fek_size = le32_to_cpu(df_header->fek_size); - fek_buf = (u8*)df_header + le32_to_cpu(df_header->fek_offset); - if ((key = ntfs_decrypt_user_key_open(session, hash_data, - hash_size))) { - fek_size = ntfs_decrypt_user_key_decrypt(key, fek_buf, - fek_size); - ntfs_decrypt_user_key_close(key); - if (fek_size) - return ntfs_decrypt_data_key_open(fek_buf, - fek_size); - fprintf(stderr, "Failed to decrypt the FEK.\n"); - } else - perror("Failed to open user key"); - df_header = (EFS_DF_HEADER*)((u8*)df_header + - le32_to_cpu(df_header->df_length)); - } - return NULL; -} - -/** - * get_fek - */ -static ntfs_decrypt_data_key *get_fek(ntfs_inode *inode) -{ - ntfs_decrypt_user_key_session *session; - EFS_DF_ARRAY_HEADER *efs_df_array; - ntfs_decrypt_data_key *fek; - EFS_ATTR_HEADER *efs_attr; - u8 *efs_buffer; - ntfs_attr *na; - - /* Obtain the $EFS contents. */ - na = ntfs_attr_open(inode, AT_LOGGED_UTILITY_STREAM, - EFS, EFS_name_length); - if (!na) { - perror("Failed to open $EFS attribute"); - return NULL; - } - efs_buffer = malloc(na->data_size); - if (!efs_buffer) { - perror("Failed to allocate internal buffer"); - ntfs_attr_close(na); - return NULL; - } - if (ntfs_attr_pread(na, 0, na->data_size, efs_buffer) != - na->data_size) { - perror("Failed to read $EFS attribute"); - free(efs_buffer); - ntfs_attr_close(na); - return NULL; - } - ntfs_attr_close(na); - - /* Init the CryptoAPI. */ - if (!(session = ntfs_decrypt_user_key_session_open())) { - perror("Failed to initialize the cryptoAPI"); - free(efs_buffer); - return NULL; - } - /* Iterate through the DDFs & DRFs until we obtain a key. */ - efs_attr = (EFS_ATTR_HEADER*)efs_buffer; - fek = NULL; - if (efs_attr->offset_to_ddf_array) { - efs_df_array = (EFS_DF_ARRAY_HEADER*)(efs_buffer + - le32_to_cpu(efs_attr->offset_to_ddf_array)); - fek = get_fek_from_df_array(session, efs_df_array); - } - if (!fek && efs_attr->offset_to_drf_array) { - efs_df_array = (EFS_DF_ARRAY_HEADER*)(efs_buffer + - le32_to_cpu(efs_attr->offset_to_drf_array)); - fek = get_fek_from_df_array(session, efs_df_array); - } - /* Close all and return. */ - ntfs_decrypt_user_key_session_close(session); - free(efs_buffer); - return fek; -} - /** * main - Begin here * @@ -384,39 +1108,82 @@ static ntfs_decrypt_data_key *get_fek(ntfs_inode *inode) */ int main(int argc, char *argv[]) { + u8 *pfx_buf, *password; + ntfs_rsa_private_key rsa_key; ntfs_volume *vol; ntfs_inode *inode; - ntfs_decrypt_data_key *fek; - int result = 1; + ntfs_fek *fek; + int pfx_size, res; if (!parse_options(argc, argv)) return 1; utils_set_locale(); - //XXX quieten errors, temporarily - - vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); - if (!vol) { - perror("ERROR: couldn't mount volume"); + /* Initialize crypto in ntfs. */ + if (ntfs_crypto_init()) { + fprintf(stderr, "Failed to initialize crypto. Aborting.\n"); return 1; } + /* Load the PKCS#12 (.pfx) file containing the user's private key. */ + if (ntfs_pkcs12_load_pfxfile(opts.keyfile, &pfx_buf, &pfx_size)) { + fprintf(stderr, "Failed to load key file. Aborting.\n"); + ntfs_crypto_deinit(); + return 1; + } + /* Ask the user for their password. */ + password = getpass("Enter the password with which the private key was " + "encrypted: "); + if (!password) { + perror("Failed to obtain user password"); + free(pfx_buf); + ntfs_crypto_deinit(); + return 1; + } + /* Obtain the user's private RSA key from the key file. */ + rsa_key = ntfs_pkcs12_extract_rsa_key(pfx_buf, pfx_size, password); + /* Destroy the password. */ + memset(password, 0, strlen(password)); + /* No longer need the pfx file contents. */ + free(pfx_buf); + if (!rsa_key) { + fprintf(stderr, "Failed to extract the private RSA key. Did " + "you perhaps mistype the password?\n"); + ntfs_crypto_deinit(); + return 1; + } + /* Mount the ntfs volume. */ + vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); + if (!vol) { + fprintf(stderr, "Failed to mount ntfs volume. Aborting.\n"); + ntfs_rsa_private_key_release(rsa_key); + ntfs_crypto_deinit(); + return 1; + } + /* Open the encrypted ntfs file. */ if (opts.inode != -1) inode = ntfs_inode_open(vol, opts.inode); else inode = ntfs_pathname_to_inode(vol, NULL, opts.file); if (!inode) { - perror("ERROR: Couldn't open inode"); + fprintf(stderr, "Failed to open encrypted file. Aborting.\n"); + ntfs_umount(vol, FALSE); + ntfs_rsa_private_key_release(rsa_key); + ntfs_crypto_deinit(); return 1; } - fek = get_fek(inode); + /* Obtain the file encryption key of the encrypted file. */ + fek = ntfs_inode_fek_get(inode, rsa_key); + ntfs_rsa_private_key_release(rsa_key); if (fek) { - result = cat_decrypt(inode, fek); - ntfs_decrypt_data_key_close(fek); + res = ntfs_cat_decrypt(inode, fek); + ntfs_fek_release(fek); } else { - Eprintf("Could not obtain FEK.\n"); - result = 1; + fprintf(stderr, "Failed to obtain file encryption key. " + "Aborting.\n"); + res = 1; } ntfs_inode_close(inode); ntfs_umount(vol, FALSE); - return result; + ntfs_crypto_deinit(); + return res; } From 3b7afbc6f6d908c5d398a4bec4d7dc231083de13 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 5 Aug 2005 23:51:26 +0000 Subject: [PATCH 2450/2994] Ouch! Have been forgetting to bump libntfs version between releases. )))-: Now bump it for next release. --- libntfs/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 04018d53..5594e546 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -25,7 +25,7 @@ # - If the interface is the same as the previous version, change to C:R+1:A # -LTVERSION_LIBNTFS = 7:0:0 +LTVERSION_LIBNTFS = 7:1:0 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 From d0dd0374630db83322297b823169afd08c116b70 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 6 Aug 2005 06:11:56 +0000 Subject: [PATCH 2451/2994] Set password to NULL instead of empty string "" so GNU TLS assumes it is not encrypted. --- ntfsprogs/ntfsdecrypt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index b08e6ff3..214a7cd8 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -1139,10 +1139,14 @@ int main(int argc, char *argv[]) ntfs_crypto_deinit(); return 1; } + /* If password is empty string set it to NULL. */ + if (!strlen(password)) + password = NULL; /* Obtain the user's private RSA key from the key file. */ rsa_key = ntfs_pkcs12_extract_rsa_key(pfx_buf, pfx_size, password); /* Destroy the password. */ - memset(password, 0, strlen(password)); + if (password) + memset(password, 0, strlen(password)); /* No longer need the pfx file contents. */ free(pfx_buf); if (!rsa_key) { From 4b8ebe26bb716234dc64d243ca8e09a714f28149 Mon Sep 17 00:00:00 2001 From: uvman Date: Sat, 6 Aug 2005 12:37:30 +0000 Subject: [PATCH 2452/2994] Fix a nasty bug in unistr.c --- libntfs/unistr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/unistr.c b/libntfs/unistr.c index afa206b0..0a93d6a0 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -524,7 +524,7 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs, int outs_len) #else mbtowc(NULL, NULL, 0); #endif - for (i = o = cnt = 0; o < ins_len; i += cnt, o++) { + for (i = o = cnt = 0; i < ins_size; i += cnt, o++) { /* Reallocate memory if necessary or abort. */ if (o >= ucs_len) { ntfschar *tc; From cd37ed95275ce660742bddf40448a8f47015fe6a Mon Sep 17 00:00:00 2001 From: uvman Date: Sat, 6 Aug 2005 14:17:31 +0000 Subject: [PATCH 2453/2994] fix a few warnings in ntfsdecrypt and make it work. --- configure.ac | 2 +- ntfsprogs/ntfsdecrypt.c | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 2190f463..2a4be551 100644 --- a/configure.ac +++ b/configure.ac @@ -237,7 +237,7 @@ AC_CHECK_HEADERS([ctype.h fcntl.h libintl.h limits.h locale.h mntent.h \ errno.h time.h unistd.h utime.h wchar.h getopt.h features.h endian.h \ byteswap.h sys/byteorder.h sys/endian.h sys/param.h sys/ioctl.h \ sys/mount.h sys/stat.h sys/types.h sys/vfs.h linux/major.h linux/fd.h \ - linux/hdreg.h machine/endian.h gcrypt.h windows.h wincrypt.h]) + linux/hdreg.h machine/endian.h gcrypt.h windows.h gnutls/pkcs12.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 214a7cd8..e36acb5c 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -25,6 +25,10 @@ #include "config.h" +#if !defined(HAVE_GCRYPT_H) || !defined(HAVE_GNUTLS_PKCS12_H) +#error A required header file is missing. Aborting. +#endif + #include #include #include @@ -252,7 +256,7 @@ static int ntfs_pkcs12_load_pfxfile(const char *keyfile, u8 **pfx, unsigned *pfx_size) { int f, to_read, total, attempts, br; - struct stat stat; + struct stat key_stat; if (!keyfile || !pfx || !pfx_size) { fprintf(stderr, "You have to specify the key file, a pointer " @@ -265,25 +269,25 @@ static int ntfs_pkcs12_load_pfxfile(const char *keyfile, u8 **pfx, perror("Failed to open key file"); return -1; } - if (fstat(f, &stat) == -1) { + if (fstat(f, &key_stat) == -1) { perror("Failed to stat key file"); goto file_out; } - if (!S_ISREG(stat.st_mode)) { + if (!S_ISREG(key_stat.st_mode)) { fprintf(stderr, "Key file is not a regular file, cannot read " "it."); goto file_out; } - if (!stat.st_size) { + if (!key_stat.st_size) { fprintf(stderr, "Key file has zero size."); goto file_out; } - *pfx = malloc(stat.st_size + 1); + *pfx = malloc(key_stat.st_size + 1); if (!*pfx) { perror("Failed to allocate buffer for key file contents"); goto file_out; } - to_read = stat.st_size; + to_read = key_stat.st_size; total = attempts = 0; do { br = read(f, *pfx + total, to_read); @@ -298,8 +302,8 @@ static int ntfs_pkcs12_load_pfxfile(const char *keyfile, u8 **pfx, } while (to_read > 0 && attempts < 3); close(f); /* Make sure it is zero terminated. */ - (*pfx)[stat.st_size] = 0; - *pfx_size = stat.st_size; + (*pfx)[key_stat.st_size] = 0; + *pfx_size = key_stat.st_size; return 0; free_out: free(*pfx); @@ -364,7 +368,7 @@ static ntfs_rsa_private_key ntfs_rsa_private_key_import_from_gnutls( } /* Build the gcrypt private key. */ if (gcry_sexp_build(&rsa_key, NULL, - "(private-key(rsa((n%m)(e%m)(d%m)(p%m)(q%m)(u%m))))", + "(private-key(rsa(n%m)(e%m)(d%m)(q%m)(p%m)(u%m)))", rm[0], rm[1], rm[2], rm[3], rm[4], rm[5]) != 0) { fprintf(stderr, "Failed to build RSA private key s-exp.\n"); return NULL; @@ -881,8 +885,8 @@ static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, if (key_size != wanted_key_size) { fprintf(stderr, "%s key of %u bytes but needed size is %u " "bytes, assuming corrupt key. Aborting.\n", - gcry_cipher_algo_name(gcry_algo), key_size, - wanted_key_size); + gcry_cipher_algo_name(gcry_algo), + (unsigned)key_size, (unsigned)wanted_key_size); err = EIO; goto out; } @@ -1000,7 +1004,7 @@ static ntfs_fek *ntfs_inode_fek_get(ntfs_inode *inode, return fek; } -int ntfs_fek_decrypt_sector(ntfs_fek *fek, u8 *data, const u64 offset) +static int ntfs_fek_decrypt_sector(ntfs_fek *fek, u8 *data, const u64 offset) { gcry_error_t err; From 518c9d6fee805af0062d847aed973fb228d0eb3d Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 6 Aug 2005 14:37:31 +0000 Subject: [PATCH 2454/2994] Deal with non-password better. --- ntfsprogs/ntfsdecrypt.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index e36acb5c..63129e73 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -456,6 +456,8 @@ check_again: "%s\n", gnutls_strerror(err)); goto bag_out; } + if (password && !strlen(password)) + flags = GNUTLS_PKCS_PLAIN; /* Decrypt the private key into GNU TLS format. */ err = gnutls_x509_privkey_import_pkcs8(pkey, &dkey, GNUTLS_X509_FMT_DER, password, flags); @@ -1143,14 +1145,10 @@ int main(int argc, char *argv[]) ntfs_crypto_deinit(); return 1; } - /* If password is empty string set it to NULL. */ - if (!strlen(password)) - password = NULL; /* Obtain the user's private RSA key from the key file. */ rsa_key = ntfs_pkcs12_extract_rsa_key(pfx_buf, pfx_size, password); /* Destroy the password. */ - if (password) - memset(password, 0, strlen(password)); + memset(password, 0, strlen(password)); /* No longer need the pfx file contents. */ free(pfx_buf); if (!rsa_key) { From 16ed5a54b26be35d88d2e03de788a90480fcedc7 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 6 Aug 2005 14:46:42 +0000 Subject: [PATCH 2455/2994] Fix breakage introduced by Yuval. --- ntfsprogs/ntfsdecrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 63129e73..bd99a567 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -368,7 +368,7 @@ static ntfs_rsa_private_key ntfs_rsa_private_key_import_from_gnutls( } /* Build the gcrypt private key. */ if (gcry_sexp_build(&rsa_key, NULL, - "(private-key(rsa(n%m)(e%m)(d%m)(q%m)(p%m)(u%m)))", + "(private-key(rsa(n%m)(e%m)(d%m)(p%m)(q%m)(u%m)))", rm[0], rm[1], rm[2], rm[3], rm[4], rm[5]) != 0) { fprintf(stderr, "Failed to build RSA private key s-exp.\n"); return NULL; From 59e70eab49c5483e48a67ebd7eb243b5eea74d46 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 8 Aug 2005 09:17:22 +0000 Subject: [PATCH 2456/2994] Update for the next release. --- ChangeLog | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 380f3b4d..1c4a8f53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -04/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. +08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. - ntfsls: Fix display of non-system files whose name begins with the '$' character. (Yura) @@ -34,18 +34,22 @@ size for $BadClus::$Bad, even if Windows set it incorrectly. (Szaka) - Make ntfs_attr_open() resolve attribute name for ntfs_attr struct in case NULL passed instead of name. (Yura) - - ntfsdecrypt (make extra) is now fully functional under Windows/Cygwin - using libgcrypt. It decrypts all types of compressed files that ntfs - creates, i.e. DesX, AES-256, and 3Des. The only reason it only works - on Windows is that it needs the user's private key to be able to - decrypt the File Encryption Key so it can decrypt the file. (Yuval, - Anton) + - ntfsdecrypt (make extra) is now fully functional using libgcrypt and + gnutls 1.2.0 (not later, that is broken at present). It decrypts all + types of compressed files that ntfs creates, i.e. DesX, AES-256, and + 3Des. The only thing it requires is the user's private key which + needs to be supplied via a .pfx file (a PKCS#12 file). Such a file + can be created in windows XP SP2 by running cipher with the exporty + key option or in older windows versions by running the certificates + snap-in to the microsoft management console (mmc). Note that due to + a bug in gnutls you have to protect the .pfx file with a password. + An empty password will not work. (Yuval, Anton) - Add information about $EFS on-disk structures to layout.h. (Yuval, Anton) - Fix build so that make extra directly after ./configure works. Thanks to Yuval for the bug report. (Anton) - Add ./configure option --enable-crypto and if enabled detect whether - libgcrypt is present or not. (Anton) + libgcrypt is present or not and only then build ntfsdecrypt. (Anton) 20/07/2005 - 1.11.1 - Fix several ntfsmount bugs. From 6a9aca9a228929c760bd458ed9c78c828037c24d Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 8 Aug 2005 13:14:41 +0000 Subject: [PATCH 2457/2994] ntfsmount: fix small memleak --- ntfsprogs/ntfsmount.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 04d5e6b8..18d15d5e 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -558,8 +558,9 @@ exit: return res; } -static int ntfs_fuse_rm_file(char *file __attribute__((unused))) +static int ntfs_fuse_rm_file(char *file) { + free(file); return -EOPNOTSUPP; } From f0af821fd187309f0bfffbe6e096526a78aa9b33 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 8 Aug 2005 21:17:15 +0000 Subject: [PATCH 2458/2994] Add detection for gnutls and make minimum 1.2.3. Also make minimum for libgcrypt 1.2.0. Don't know if we work with earlier versions. --- ChangeLog | 7 +++++++ configure.ac | 19 +++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c4a8f53..6b9abdb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +xx/xx/2005 - 1.11.3-WIP + + - Add configure.ac detection for gnutls library and make minimum + version 1.2.3 which is the one that has the rsa key export fixed. + - Put in a minimum version for libgcrypt of 1.2.0 as I do not know if + our code works with earlier versions. + 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. - ntfsls: Fix display of non-system files whose name begins with the diff --git a/configure.ac b/configure.ac index 2a4be551..9319b687 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.11.2],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.11.3-WIP],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) @@ -159,7 +159,8 @@ AM_CONDITIONAL(ENABLE_FUSE_MODULE, $compile_fuse_module) # Autodetect whether we can build crypto stuff or not. compile_crypto=false if test "$enable_crypto" != "no"; then - AM_PATH_LIBGCRYPT(, [ compile_crypto=true ], + have_libgcrypt=false + AM_PATH_LIBGCRYPT(1.2.0, [ have_libgcrypt=true ], [ if test "$enable_crypto" = "yes"; then AC_MSG_ERROR([Linux-NTFS crypto code requires the gcrypt library.]) @@ -167,6 +168,20 @@ if test "$enable_crypto" != "no"; then AC_MSG_WARN([Linux-NTFS crypto code requires the gcrypt library.]) fi ]) + have_libgnutls=false + AM_PATH_LIBGNUTLS(1.2.3, [ have_libgnutls=true ], + [ + if test "$enable_crypto" = "yes"; then + AC_MSG_ERROR([Linux-NTFS crypto code requires the gnutls library.]) + else + AC_MSG_WARN([Linux-NTFS crypto code requires the gnutls library.]) + fi + ]) + if test "$have_libgcrypt" = "yes"; then + if test "$have_libgnutls" = "yes"; then + compile_crypto=true + fi + fi fi AM_CONDITIONAL(ENABLE_CRYPTO, $compile_crypto) From b98295d84f46177821e97fb40075b52cf6757c9e Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 8 Aug 2005 21:19:14 +0000 Subject: [PATCH 2459/2994] Add conf.libgnutlstest to .cvsignore --- .cvsignore | 1 + Makefile.am | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.cvsignore b/.cvsignore index 037d4b19..acc1a924 100644 --- a/.cvsignore +++ b/.cvsignore @@ -2,6 +2,7 @@ Makefile Makefile.in aclocal.m4 autom4te.cache +conf.libgnutlstest config.guess config.h config.h.in diff --git a/Makefile.am b/Makefile.am index 01e776a4..b160ae51 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,7 +8,7 @@ EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ AUTOMAKE_OPTIONS = gnu MAINTAINERCLEANFILES = configure Makefile.in aclocal.m4 compile depcomp \ - install-sh missing config.guess config.sub config.h.in INSTALL + install-sh missing config.guess config.sub config.h.in INSTALL \ dist-hook: ntfsprogs.spec cp ntfsprogs.spec $(distdir) From 497922351a3abd61ec7bf1042a7cf71a301a88bd Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 8 Aug 2005 21:20:06 +0000 Subject: [PATCH 2460/2994] Fix accidental damage. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index b160ae51..01e776a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,7 +8,7 @@ EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ AUTOMAKE_OPTIONS = gnu MAINTAINERCLEANFILES = configure Makefile.in aclocal.m4 compile depcomp \ - install-sh missing config.guess config.sub config.h.in INSTALL \ + install-sh missing config.guess config.sub config.h.in INSTALL dist-hook: ntfsprogs.spec cp ntfsprogs.spec $(distdir) From 9f71cc30e7e2aae8b40bd455cb9f126dd602d156 Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 9 Aug 2005 09:03:29 +0000 Subject: [PATCH 2461/2994] - Update for Yura's memleak fix. - Fix some typos. --- ChangeLog | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b9abdb3..0fb06e9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,10 @@ xx/xx/2005 - 1.11.3-WIP - - Add configure.ac detection for gnutls library and make minimum - version 1.2.3 which is the one that has the rsa key export fixed. + - ntfsmount: Fix small memleak. (Yura) + - Add ./configure detection for gnutls library and make minimum version + 1.2.3 which is the one that has the rsa key export fixed. (Anton) - Put in a minimum version for libgcrypt of 1.2.0 as I do not know if - our code works with earlier versions. + our code works with earlier versions. (Anton) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. @@ -46,7 +47,7 @@ xx/xx/2005 - 1.11.3-WIP types of compressed files that ntfs creates, i.e. DesX, AES-256, and 3Des. The only thing it requires is the user's private key which needs to be supplied via a .pfx file (a PKCS#12 file). Such a file - can be created in windows XP SP2 by running cipher with the exporty + can be created in windows XP SP2 by running cipher with the export key option or in older windows versions by running the certificates snap-in to the microsoft management console (mmc). Note that due to a bug in gnutls you have to protect the .pfx file with a password. From 5dd973f6835a3ee241952faa8d30ddf300baf377 Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 9 Aug 2005 10:57:40 +0000 Subject: [PATCH 2462/2994] Fix some memleaks in ntfsdecrypt and do some cleanups there. Fix testing whether to compile crypto code in configure.ac. --- ChangeLog | 1 + configure.ac | 4 +-- ntfsprogs/ntfsdecrypt.c | 74 ++++++++++++++++++++++++++++------------- 3 files changed, 54 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0fb06e9b..acea8fc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ xx/xx/2005 - 1.11.3-WIP 1.2.3 which is the one that has the rsa key export fixed. (Anton) - Put in a minimum version for libgcrypt of 1.2.0 as I do not know if our code works with earlier versions. (Anton) + - Fix some memory leaks in ntfsdecrypt and do some cleanups. (Anton) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/configure.ac b/configure.ac index 9319b687..274fca0e 100644 --- a/configure.ac +++ b/configure.ac @@ -177,8 +177,8 @@ if test "$enable_crypto" != "no"; then AC_MSG_WARN([Linux-NTFS crypto code requires the gnutls library.]) fi ]) - if test "$have_libgcrypt" = "yes"; then - if test "$have_libgnutls" = "yes"; then + if test "$have_libgcrypt" = "true"; then + if test "$have_libgnutls" = "true"; then compile_crypto=true fi fi diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index bd99a567..c8c64179 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -344,14 +344,14 @@ static void ntfs_crypto_deinit(void) static ntfs_rsa_private_key ntfs_rsa_private_key_import_from_gnutls( gnutls_x509_privkey_t priv_key) { - int i, tmp_size; + int i, j, tmp_size; gnutls_datum_t rd[6]; gcry_mpi_t rm[6]; gcry_sexp_t rsa_key; /* Extract the RSA parameters from the GNU TLS private key. */ if (gnutls_x509_privkey_export_rsa_raw(priv_key, &rd[0], &rd[1], - &rd[2], &rd[3], &rd[4], &rd[5]) != 0) { + &rd[2], &rd[3], &rd[4], &rd[5])) { fprintf(stderr, "Failed to export rsa parameters. (Is the " "key an RSA private key?)\n"); return NULL; @@ -359,20 +359,43 @@ static ntfs_rsa_private_key ntfs_rsa_private_key_import_from_gnutls( /* Convert each RSA parameter to mpi format. */ for (i = 0; i < 6; i++) { if (gcry_mpi_scan(&rm[i], GCRYMPI_FMT_USG, rd[i].data, - rd[i].size, &tmp_size) !=0) { + rd[i].size, &tmp_size) != GPG_ERR_NO_ERROR) { fprintf(stderr, "Failed to convert RSA parameter %i " "to mpi format (size %d)\n", i, rd[i].size); - return NULL; + rsa_key = NULL; + break; } } - /* Build the gcrypt private key. */ - if (gcry_sexp_build(&rsa_key, NULL, - "(private-key(rsa(n%m)(e%m)(d%m)(p%m)(q%m)(u%m)))", - rm[0], rm[1], rm[2], rm[3], rm[4], rm[5]) != 0) { - fprintf(stderr, "Failed to build RSA private key s-exp.\n"); - return NULL; + /* Release the no longer needed datum values. */ + for (j = 0; j < 6; j++) { + /* + * FIXME: _gnutls_free_datum() is not exported from libgnutls + * so we do it by hand... )-: Let us just hope the + * gnutls_datum_t structure does not change across versions of + * the gnutls library. + */ +#if 0 + _gnutls_free_datum(&rd[j]); +#else + if (rd[j].data && rd[j].size) + gnutls_free(rd[j].data); +#endif } + /* + * Build the gcrypt private key, note libgcrypt uses p and q inversed + * to what gnutls uses. + */ + if (i == 6 && gcry_sexp_build(&rsa_key, NULL, + "(private-key(rsa(n%m)(e%m)(d%m)(p%m)(q%m)(u%m)))", + rm[0], rm[1], rm[2], rm[4], rm[3], rm[5]) != + GPG_ERR_NO_ERROR) { + fprintf(stderr, "Failed to build RSA private key s-exp.\n"); + rsa_key = NULL; + } + /* Release the no longer needed mpi values. */ + for (j = 0; j < i; j++) + gcry_mpi_release(rm[j]); return (ntfs_rsa_private_key)rsa_key; } @@ -388,7 +411,7 @@ static ntfs_rsa_private_key ntfs_pkcs12_extract_rsa_key(u8 *pfx, int pfx_size, /* Create a pkcs12 structure. */ err = gnutls_pkcs12_init(&pkcs12); - if (err < 0) { + if (err) { fprintf(stderr, "Failed to initialize PKCS#12 structure: %s\n", gnutls_strerror(err)); return NULL; @@ -397,7 +420,7 @@ static ntfs_rsa_private_key ntfs_pkcs12_extract_rsa_key(u8 *pfx, int pfx_size, dpfx.data = pfx; dpfx.size = pfx_size; err = gnutls_pkcs12_import(pkcs12, &dpfx, GNUTLS_X509_FMT_DER, 0); - if (err < 0) { + if (err) { fprintf(stderr, "Failed to convert the PFX file from DER to " "native PKCS#12 format: %s\n", gnutls_strerror(err)); @@ -408,21 +431,21 @@ static ntfs_rsa_private_key ntfs_pkcs12_extract_rsa_key(u8 *pfx, int pfx_size, * been tampered with. */ err = gnutls_pkcs12_verify_mac(pkcs12, password); - if (err < 0) { + if (err) { fprintf(stderr, "Failed to verify the MAC (%s). Is the " "password correct?\n", gnutls_strerror(err)); goto out; } for (bag_index = 0; ; bag_index++) { err = gnutls_pkcs12_bag_init(&bag); - if (err < 0) { + if (err) { fprintf(stderr, "Failed to initialize PKCS#12 Bag " "structure: %s\n", gnutls_strerror(err)); goto out; } err = gnutls_pkcs12_get_bag(pkcs12, bag_index, bag); - if (err < 0) { + if (err) { if (err == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) break; fprintf(stderr, "Failed to obtain Bag from PKCS#12 " @@ -448,32 +471,35 @@ check_again: case GNUTLS_BAG_PKCS8_KEY: flags = GNUTLS_PKCS_PLAIN; case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: - gnutls_x509_privkey_init(&pkey); - err = gnutls_pkcs12_bag_get_data(bag, 0, &dkey); if (err < 0) { fprintf(stderr, "Failed to obtain Bag data: " "%s\n", gnutls_strerror(err)); goto bag_out; } - if (password && !strlen(password)) - flags = GNUTLS_PKCS_PLAIN; + err = gnutls_x509_privkey_init(&pkey); + if (err) { + fprintf(stderr, "Failed to initialized " + "private key structure: %s\n", + gnutls_strerror(err)); + goto bag_out; + } /* Decrypt the private key into GNU TLS format. */ err = gnutls_x509_privkey_import_pkcs8(pkey, &dkey, GNUTLS_X509_FMT_DER, password, flags); - if (err < 0) { + if (err) { fprintf(stderr, "Failed to convert private " "key from DER to GNU TLS " "format: %s\n", gnutls_strerror(err)); - goto bag_out; + goto key_out; } /* Convert the private key to our internal format. */ rsa_key = ntfs_rsa_private_key_import_from_gnutls(pkey); - goto bag_out; + goto key_out; case GNUTLS_BAG_ENCRYPTED: err = gnutls_pkcs12_bag_decrypt(bag, password); - if (err < 0) { + if (err) { fprintf(stderr, "Failed to decrypt Bag: %s\n", gnutls_strerror(err)); goto bag_out; @@ -485,6 +511,8 @@ check_again: } gnutls_pkcs12_bag_deinit(bag); } +key_out: + gnutls_x509_privkey_deinit(pkey); bag_out: gnutls_pkcs12_bag_deinit(bag); out: From 8ffbca582f0900b74b21757d2258623c56b5f49d Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 9 Aug 2005 11:07:26 +0000 Subject: [PATCH 2463/2994] Add comment about broken gnutls empty password handling. --- ntfsprogs/ntfsdecrypt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index c8c64179..1eea01dc 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -485,6 +485,8 @@ check_again: goto bag_out; } /* Decrypt the private key into GNU TLS format. */ + // FIXME: Due to bugs (?) in gnutls this fails when an + // empty password is used. err = gnutls_x509_privkey_import_pkcs8(pkey, &dkey, GNUTLS_X509_FMT_DER, password, flags); if (err) { From c9d112e9ea92cc51a43f273cdb67f97c2b9e1775 Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 10 Aug 2005 10:17:03 +0000 Subject: [PATCH 2464/2994] Fix ntfsdecrypt to also work with passwordless files. Note this requires a patched gnutls library or it still does not work. (Anton) --- ChangeLog | 2 ++ ntfsprogs/ntfsdecrypt.c | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index acea8fc4..12103a5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ xx/xx/2005 - 1.11.3-WIP - Put in a minimum version for libgcrypt of 1.2.0 as I do not know if our code works with earlier versions. (Anton) - Fix some memory leaks in ntfsdecrypt and do some cleanups. (Anton) + - Fix ntfsdecrypt to also work with passwordless files. Note this + requires a patched gnutls library or it still does not work. (Anton) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 1eea01dc..2e9ab238 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -428,12 +428,21 @@ static ntfs_rsa_private_key ntfs_pkcs12_extract_rsa_key(u8 *pfx, int pfx_size, } /* * Verify that the password is correct and that the key file has not - * been tampered with. + * been tampered with. Note if the password has zero length and the + * verification fails, retry with password set to NULL. This is needed + * to get passwordless .pfx files generated with Windows XP SP1 (and + * probably earlier versions of Windows) to work. */ +retry_verify: err = gnutls_pkcs12_verify_mac(pkcs12, password); if (err) { fprintf(stderr, "Failed to verify the MAC (%s). Is the " "password correct?\n", gnutls_strerror(err)); + if (err == GNUTLS_E_MAC_VERIFY_FAILED && + password && !strlen(password)) { + password = NULL; + goto retry_verify; + } goto out; } for (bag_index = 0; ; bag_index++) { @@ -485,8 +494,6 @@ check_again: goto bag_out; } /* Decrypt the private key into GNU TLS format. */ - // FIXME: Due to bugs (?) in gnutls this fails when an - // empty password is used. err = gnutls_x509_privkey_import_pkcs8(pkey, &dkey, GNUTLS_X509_FMT_DER, password, flags); if (err) { From 68aab0dacd013bd5eac61de8e3abd4e57d114d39 Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 10 Aug 2005 11:33:10 +0000 Subject: [PATCH 2465/2994] Minor cleanup. --- ntfsprogs/ntfsdecrypt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 2e9ab238..e893c001 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -436,13 +436,13 @@ static ntfs_rsa_private_key ntfs_pkcs12_extract_rsa_key(u8 *pfx, int pfx_size, retry_verify: err = gnutls_pkcs12_verify_mac(pkcs12, password); if (err) { - fprintf(stderr, "Failed to verify the MAC (%s). Is the " - "password correct?\n", gnutls_strerror(err)); if (err == GNUTLS_E_MAC_VERIFY_FAILED && password && !strlen(password)) { password = NULL; goto retry_verify; } + fprintf(stderr, "Failed to verify the MAC (%s). Is the " + "password correct?\n", gnutls_strerror(err)); goto out; } for (bag_index = 0; ; bag_index++) { From 8567df0b6d5eba0a56e066292b667f719c3a2868 Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 11 Aug 2005 13:53:08 +0000 Subject: [PATCH 2466/2994] display year in long listing --- ntfsprogs/ntfsls.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 6b6e0824..49dc3ef0 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -551,7 +551,8 @@ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, ntfs_time = ntfs2utc(sle64_to_cpu( file_name_attr->last_data_change_time)); strcpy(t_buf, ctime(&ntfs_time)); - t_buf[16] = '\0'; + memmove(t_buf+16, t_buf+19, 5); + t_buf[21] = '\0'; if (dt_type != NTFS_DT_DIR) { if (!ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, From fd54e7825621245381b20593ce8a173d9a9204cc Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 11 Aug 2005 13:59:08 +0000 Subject: [PATCH 2467/2994] more code to start testing add keep track of dir names --- ntfsprogs/ntfsrm.c | 392 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 371 insertions(+), 21 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index decfdde8..fdbb144d 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -362,6 +362,48 @@ static ntfs_inode * ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) return ino; } +/** + * ntfs_inode_open3 + * open a deleted inode + */ +static ntfs_inode * ntfs_inode_open3 (ntfs_volume *vol, const MFT_REF mref) +{ + ntfs_inode *ino = NULL; + + if (!vol) + return NULL; + + ino = calloc (1, sizeof (*ino)); + if (!ino) + return NULL; + + ino->mrec = malloc (vol->mft_record_size); + if (!ino->mrec) { + free (ino); + return NULL; + } + + ino->mft_no = mref; + ino->vol = vol; + ino->state = NI_Dirty; + + ino->data_size = -1; + ino->allocated_size = -1; + + ino->private_data = NULL; + ino->ref_count = 1; + + if (1 != ntfs_mst_pread (vol->dev, MREF(mref) * vol->mft_record_size, 1, vol->mft_record_size, ino->mrec)) { + printf ("mft record read failed\n"); + //ntfs_inode_close2 (ino); ??? + free (ino->mrec); + free (ino); + return NULL; + } + + return ino; +} + /** * ntfs_inode_close2 */ @@ -814,7 +856,7 @@ static INDEX_ENTRY * ntfs_ie_create (void) INDEX_ENTRY *ie; length = 16; - ie = malloc (length); + ie = calloc (1, length); if (!ie) return NULL; @@ -920,20 +962,20 @@ static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int name * VCN vcn; */ - printf ("key length = 0x%02X\n", ie->key_length); - printf ("new name length = %d\n", namelen); + //printf ("key length = 0x%02X\n", ie->key_length); + //printf ("new name length = %d\n", namelen); if (ie->key_length > 0) { file = &ie->key.file_name; - printf ("filename, length %d\n", file->file_name_length); + //printf ("filename, length %d\n", file->file_name_length); need = ATTR_SIZE (namelen * sizeof (ntfschar) + 2) - ATTR_SIZE (file->file_name_length * sizeof (ntfschar) + 2); } else { - printf ("no filename\n"); + //printf ("no filename\n"); need = ATTR_SIZE (sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar))); wipe = TRUE; } - printf ("need 0x%02X bytes\n", need); + //printf ("need 0x%02X bytes\n", need); if (need != 0) { if (ie->flags & INDEX_ENTRY_NODE) @@ -942,7 +984,7 @@ static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int name ie->length += need; ie->key_length += need; - printf ("realloc 0x%02X\n", ie->length); + //printf ("realloc 0x%02X\n", ie->length); ie = realloc (ie, ie->length); if (!ie) return NULL; @@ -2176,6 +2218,62 @@ static int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_T return 0; } +/** + * ntfs_mft_add_attr + */ +static int ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int data_len) +{ + MFT_RECORD *mrec; + ATTR_RECORD *attr; + u8 *ptr; + u8 *src; + u8 *dst; + int len; + + if (!inode) + return 1; + if (!data) + return 1; + + mrec = inode->mrec; + if (!mrec) + return 1; + + ptr = (u8*) inode->mrec + mrec->attrs_offset; + while (1) { + attr = (ATTR_RECORD*) ptr; + + if (type < attr->type) + break; + + ptr += attr->length; + } + + //printf ("insert before attr 0x%02X\n", attr->type); + + len = ((u8*) mrec + mrec->bytes_in_use) - ((u8*) attr); + src = (u8*) attr; + dst = src + data_len + 0x18; + + memmove (dst, src, len); + + src = data; + dst = (u8*) attr + 0x18; + len = data_len; + + memcpy (dst, src, len); + + mrec->bytes_in_use += data_len + 0x18; + + memset (attr, 0, 0x18); + *(u32*)((u8*) attr + 0x00) = type; + *(u32*)((u8*) attr + 0x04) = data_len + 0x18; + *(u32*)((u8*) attr + 0x10) = data_len; + *(u32*)((u8*) attr + 0x14) = 0x18; + + return 0; +} + /** * ntfs_mft_resize_resident */ @@ -2670,7 +2768,7 @@ static BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) printf ("indx is empty\n"); ntfs_bmp_set_range (del->dir->bitmap, del->vcn, 1, 0); } - + return TRUE; } @@ -3402,6 +3500,7 @@ static void ntfs_dir_free (struct ntfs_dir *dir) for (i = 0; i < dir->child_count; i++) ntfs_dir_free (dir->children[i]); + free (dir->name); free (dir->children); free (dir); } @@ -3413,8 +3512,9 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) { struct ntfs_dir *dir = NULL; ntfs_inode *inode = NULL; - ATTR_RECORD *rec = NULL; - INDEX_ROOT *ir = NULL; + ATTR_RECORD *rec = NULL; + INDEX_ROOT *ir = NULL; + FILE_NAME_ATTR *name = NULL; if (!vol) return NULL; @@ -3434,6 +3534,11 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) dir->iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); dir->ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); + if (!dir->iroot) { + ntfs_dir_free (dir); + return NULL; + } + dir->vol = vol; dir->parent = NULL; dir->name = NULL; @@ -3454,10 +3559,13 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) dir->index_size = 0; } - if (!dir->iroot) { - ntfs_dir_free (dir); - return NULL; - } + // Finally, find the dir's name + rec = find_first_attribute (AT_FILE_NAME, inode->mrec); + name = (FILE_NAME_ATTR*) ((u8*)rec + rec->value_offset); + + dir->name_len = name->file_name_length; + dir->name = malloc (sizeof (ntfschar) * dir->name_len); + memcpy (dir->name, name->file_name, sizeof (ntfschar) * dir->name_len); return dir; } @@ -3529,6 +3637,42 @@ static struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, i return child; } +/** + * ntfs_dir_map + */ +static int ntfs_dir_map (ntfs_volume *vol, struct ntfs_dir *dir) +{ + //struct ntfs_dt *dt; + + if (!vol) + return 1; + if (!dir) + return 1; + +#if 0 + printf ("dir = %p\n", dir); + printf ("vol = %p\n", dir->vol); + printf ("parent = %p\n", dir->parent); + printf ("name = "); ntfs_name_print (dir->name, dir->name_len); printf ("\n"); + printf ("mftnum = %lld\n", MREF (dir->mft_num)); + printf ("dt = %p\n", dir->index); + printf ("children = %p (%d)\n", dir->children, dir->child_count); + printf ("bitmap = %p\n", dir->bitmap); + printf ("inode = %p\n", dir->inode); + printf ("iroot = %p\n", dir->iroot); + printf ("ialloc = %p\n", dir->ialloc); + printf ("isize = %d\n", dir->index_size); +#endif + + //dt->data_len = dir->iroot->allocated_size; + //dt->data = malloc (dt->data_len); + //ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data); + + //ntfs_dt_count_root (dt); + + return 0; +} + /** * utils_volume_commit @@ -3793,7 +3937,9 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, goto close; } - //printf ("looking for %s\n", p); + //printf ("looking for %s in dir %lld\n", p, MREF (dir->mft_num)); + //printf ("dir: index = %p, children = %p, inode = %p, iroot = %p, ialloc = %p, count = %d\n", dir->index, dir->children, dir->inode, dir->iroot, dir->ialloc, dir->child_count); + //if (dir->parent) if (q) { child = ntfs_dir_find2 (dir, unicode, len); if (!child) { @@ -3809,6 +3955,18 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, goto close; } + //printf ("dt's flags = 0x%08x\n", dt->children[dt_num]->key.file_name.file_attributes); + if (dt->children[dt_num]->key.file_name.file_attributes == FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) { + //printf ("DIR\n"); + child = ntfs_dir_alloc (dir->vol, dt->children[dt_num]->indexed_file); + //printf ("child = %p (%lld)\n", child, MREF (dt->children[dt_num]->indexed_file)); + if (child) { + child->index = ntfs_dt_alloc (child, NULL, -1); + ntfs_dir_add (dir, child); + } + + } + if (dt->inodes[dt_num] == NULL) { dt->inodes[dt_num] = ntfs_inode_open (dir->vol, dt->children[dt_num]->indexed_file); if (!dt->inodes[dt_num]) { @@ -3820,7 +3978,6 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, } //printf ("dt = %p,%d\n", dt, dt_num); - break; } @@ -3844,6 +4001,26 @@ close: return result; } +/** + * utils_mft_find_free_entry + */ +static s64 utils_mft_find_free_entry (ntfs_volume *vol) +{ + MFT_REF i; + u64 recs; + + if (!vol) + return -1; + + recs = vol->mft_na->initialized_size >> vol->mft_record_size_bits; + //printf ("mft contains %lld records\n", recs); + for (i = 24; i < recs; i++) { + if (utils_mftrec_in_use (vol, i) == 0) + return i; + } + return -1; +} + /** * ntfs_index_dump_alloc @@ -3887,8 +4064,8 @@ static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) if (entry->flags & INDEX_ENTRY_END) break; } - printf ("%.*s", indent, space_line); - printf ("fill = %u/%u\n", (unsigned)block->index.index_length, (unsigned)block->index.allocated_size); + //printf ("%.*s", indent, space_line); + //printf ("fill = %u/%u\n", (unsigned)block->index.index_length, (unsigned)block->index.allocated_size); return 0; } @@ -3947,7 +4124,7 @@ static int ntfs_index_dump (ntfs_inode *inode) ntfs_attr_close (iroot); ntfs_attr_close (ialloc); - printf ("fill = %d\n", ptr - buffer); + //printf ("fill = %d\n", ptr - buffer); return 0; } @@ -4079,14 +4256,27 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) // find the key nearest the root which has no descendants printf ("\n"); printf (BOLD YELLOW "Find childless parent:\n" END); +#if 0 for (par = del->parent, old = par; par; old = par, par = par->parent) { + printf (CYAN "marker 1\n" END); if (par->child_count > 1) break; + printf (CYAN "marker 2\n" END); par_num = ntfs_dt_find_parent (par); } +#endif + + printf (CYAN "marker 3\n" END); fflush (stdout); + printf ("del = %p, parent = %p\n", del, del->parent); + par = del->parent; + par_num = ntfs_dt_find_parent (del); + printf (CYAN "marker 4\n" END); fflush (stdout); //utils_dump_mem (par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); + printf ("par = %p, par->parent = %p, num = %d\n", par, par->parent, par_num); + par_num = 0; // TEMP + if (par) { file = &par->children[par_num]->key.file_name; printf ("\tpar name: "); @@ -4279,6 +4469,160 @@ static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) return 0; } +/** + * ntfs_file_add2 + */ +static int ntfs_file_add2 (ntfs_volume *vol, char *filename) +{ + MFT_REF new_num; + char *ptr = NULL; + char *dirname = NULL; + struct ntfs_find find; + INDEX_ENTRY *ie; + ntfschar *uname = NULL; + int uname_len = 0; + ntfs_inode *ino = NULL; + ntfs_inode *ino2 = NULL; + u8 *tmp = NULL; + u8 *buffer = NULL; + s64 now = 0; + struct ntfs_dir *dir; + struct ntfs_dt *dt; + + new_num = utils_mft_find_free_entry (vol); + if (new_num == (MFT_REF) -1) + return 1; + + if (rindex (filename, PATH_SEP)) { + ptr = rindex (filename, PATH_SEP); + *ptr = 0; + dirname = filename; + filename = ptr + 1; + } + + if (utils_pathname_to_inode2 (vol, NULL, dirname, &find) == FALSE) { + printf ("!inode\n"); + return 0; + } + + dt = find.dt; + dir = find.dir; + + uname_len = ntfs_mbstoucs(filename, &uname, 0); + if (uname_len < 0) + goto close; + + ie = ntfs_ie_create(); + ie = ntfs_ie_set_name (ie, uname, uname_len, FILE_NAME_WIN32); + if (!ie) { + printf ("!ie\n"); + goto close; + } + + // These two NEED the sequence number in the top 8 bits + ie->indexed_file = new_num; // MFT Ref: new file + ie->key.file_name.parent_directory = find.mref; // MFT Ref: parent dir + + now = utc2ntfs (time(NULL)); + ie->key.file_name.creation_time = now; + ie->key.file_name.last_data_change_time = now; + ie->key.file_name.last_mft_change_time = now; + ie->key.file_name.last_access_time = now; + + // Need to be filled in later + ie->key.file_name.allocated_size = 0; + ie->key.file_name.data_size = 0; + + //ntfs_ie_dump (ie); + + ino = ntfs_inode_open3 (vol, new_num); + if (!ino) { + printf ("!ino\n"); + goto close; + } + + //printf ("attributes start at offset 0x%02X\n", ino->mrec->attrs_offset); + + tmp = (u8*) ino->mrec; + memset (tmp + ino->mrec->attrs_offset, 0, vol->mft_record_size - ino->mrec->attrs_offset); + + *(u32*) (tmp + ino->mrec->attrs_offset) = 0xFFFFFFFF; + + ino->mrec->bytes_in_use = ino->mrec->attrs_offset + 8; + + //utils_dump_mem ((u8*)ino->mrec, 0, ino->mrec->bytes_in_use, DM_DEFAULTS); + + buffer = malloc (128); + if (!buffer) + goto close; + + // Standard information + memset (buffer, 0, 128); + *(u64*)(buffer + 0x00) = now; // Time + *(u64*)(buffer + 0x08) = now; // Time + *(u64*)(buffer + 0x10) = now; // Time + *(u64*)(buffer + 0x18) = now; // Time + ntfs_mft_add_attr (ino, AT_STANDARD_INFORMATION, buffer, 0x48); + //utils_dump_mem (buffer, 0, 0x48, DM_DEFAULTS); + + // File name + memset (buffer, 0, 128); + *(u64*)(buffer + 0x00) = find.mref; // MFT Ref of parent dir + *(u64*)(buffer + 0x08) = now; // Time + *(u64*)(buffer + 0x10) = now; // Time + *(u64*)(buffer + 0x18) = now; // Time + *(u64*)(buffer + 0x20) = now; // Time + *(u64*)(buffer + 0x28) = 0; // Allocated size + *(u64*)(buffer + 0x30) = 0; // Initialised size + *(u32*)(buffer + 0x38) = 0; // Flags + *(u32*)(buffer + 0x3C) = 0; // Not relevant + *(u8* )(buffer + 0x40) = uname_len; // Filename length + *(u8* )(buffer + 0x41) = FILE_NAME_WIN32;// Filename namespace + memcpy (buffer + 0x42, uname, uname_len * sizeof (ntfschar)); + ntfs_mft_add_attr (ino, AT_FILE_NAME, buffer, ATTR_SIZE (0x42 + (uname_len * sizeof (ntfschar)))); + //utils_dump_mem (buffer, 0, 0x50, DM_DEFAULTS); + + // Data + memset (buffer, 0, 128); + ntfs_mft_add_attr (ino, AT_DATA, buffer, 0); + + //utils_dump_mem ((u8*)ino->mrec, 0, ino->mrec->bytes_in_use, DM_DEFAULTS); + + //printf ("orig inode = %p\n", find.inode); + dt = find.inode->private_data; + dir = dt->dir; + //printf ("dt = %p\n", dt); + //printf ("dir = %p\n", dir); + //printf ("num = %lld\n", dir->mft_num); + //printf ("\n"); + + ino2 = find.dt->inodes[find.dt_index]; + //printf ("num = %lld\n", ino2->mft_no); + //printf ("data = %p\n", ino2->private_data); + //printf ("children = %p\n", dir->children); + //printf ("child? = %p\n", dir->children[find.dt_index]); + + if (0) ntfs_dir_map (vol, dir); + + //printf ("\n"); + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); + //printf ("\n"); + + //ntfs_dt_root_add (dt, ie); + + //printf ("\n"); + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); + //printf ("\n"); + +close: + free (buffer); + ntfs_inode_close2 (ino); + free (ie); + free (uname); + ntfs_inode_close2 (find.inode); + return 0; +} + /** * ntfs_test_bmp2 */ @@ -4383,27 +4727,33 @@ int main (int argc, char *argv[]) goto done; } +#if 0 if (utils_pathname_to_inode2 (vol, NULL, opts.file, &find) == FALSE) { printf ("!inode\n"); goto done; } inode = find.inode; +#endif //printf ("inode = %lld\n", inode->mft_no); if (0) result = ntfs_index_dump (inode); if (0) result = ntfs_ie_test(); - if (1) result = ntfs_file_remove2 (vol, find.dt, find.dt_index); + if (0) result = ntfs_file_remove2 (vol, find.dt, find.dt_index); + if (1) result = ntfs_file_add2 (vol, opts.file); if (0) result = ntfs_test_bmp2 (vol); done: - if (1) ntfs_inode_close2 (inode); + if (1) utils_volume_commit (vol); + if (0) utils_volume_rollback (vol); + if (0) ntfs_inode_close2 (inode); if (1) ntfs_umount2 (vol, FALSE); if (0) ntfs_binary_print (0, FALSE, FALSE); if (0) ntfs_dt_root_add (NULL, NULL); if (0) ntfs_dt_alloc_add (NULL, NULL); + if (0) utils_pathname_to_inode2 (NULL, NULL, NULL, NULL); return result; } From 0152ddb1b2bb9c1f47539733208a3a0a0aaeb670 Mon Sep 17 00:00:00 2001 From: antona Date: Sun, 14 Aug 2005 06:16:35 +0000 Subject: [PATCH 2468/2994] Update for more correct EFS information. --- include/ntfs/layout.h | 69 +++++++++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 19 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index d70f8501..5d639d9b 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -2388,10 +2388,10 @@ typedef struct { /* The header of the 0x100 attribute named "$EFS". */ typedef struct { -/* 0*/ u32 efs_length; /* Length of attribute in bytes. */ - u32 unknown1; /* always 0? */ - u32 unknown2; /* number of DDFs? */ - u32 unknown3; /* number of DRFs? */ +/* 0*/ u32 length; /* Length of EFS attribute in bytes. */ + u32 state; /* Always 0? */ + u32 version; /* Efs version. Always 2? */ + u32 crypto_api_version; /* Always 0? */ /* 16*/ u8 unknown4[16]; /* MD5 hash of decrypted FEK? */ /* 32*/ u8 unknown5[16]; /* MD5 hash of DDFs? */ /* 48*/ u8 unknown6[16]; /* MD5 hash of DRFs? */ @@ -2401,6 +2401,7 @@ typedef struct { u32 offset_to_drf_array;/* Offset in bytes to the array of data recovery fields (DRF), see below. Zero if no DRFs are present. */ + u32 reserved; /* Reserved. */ } __attribute__ ((__packed__)) EFS_ATTR_HEADER; typedef struct { @@ -2416,19 +2417,46 @@ typedef struct { encryption key (FEK). */ u32 fek_offset; /* Offset in bytes to the FEK from the start of the data decryption/recovery field. */ -/* 16*/ u32 unknown1; /* always 0? */ +/* 16*/ u32 unknown1; /* always 0? Might be just padding. */ } __attribute__ ((__packed__)) EFS_DF_HEADER; typedef struct { /* 0*/ u32 cred_length; /* Length of this credential in bytes. */ u32 sid_offset; /* Offset in bytes to the user's sid from start - of this structure. */ - u32 cred_version; /* always 3? */ - u32 cert_header_size; /* Size in bytes of the certificate header. */ -/* 16*/ u32 cert_header_offset; /* Offset in bytes to the certificate header - from start of this structure. */ - u32 unknown1; /* always 0? */ - u32 unknown2; /* always 0? */ + of this structure. Zero if no sid is + present. */ +/* 8*/ u32 type; /* Type of this credential: + 1 = CryptoAPI container. + 2 = Unexpected type. + 3 = Certificate thumbprint. + other = Unknown type. */ + union { + /* CryptoAPI container. */ + struct { +/* 12*/ u32 container_name_offset; /* Offset in bytes to + the name of the container from start of this + structure (may not be zero). */ +/* 16*/ u32 provider_name_offset; /* Offset in bytes to + the name of the provider from start of this + structure (may not be zero). */ + u32 public_key_blob_offset; /* Offset in bytes to + the public key blob from start of this + structure. */ +/* 24*/ u32 public_key_blob_size; /* Size in bytes of + public key blob. */ + } __attribute__ ((__packed__)); + /* Certificate thumbprint. */ + struct { +/* 12*/ u32 cert_thumbprint_header_size; /* Size in + bytes of the header of the certificate + thumbprint. */ +/* 16*/ u32 cert_thumbprint_header_offset; /* Offset in + bytes to the header of the certificate + thumbprint from start of this structure. */ + u32 unknown1; /* Always 0? Might be padding... */ + u32 unknown2; /* Always 0? Might be padding... */ + } __attribute__ ((__packed__)); + } __attribute__ ((__packed__)); } __attribute__ ((__packed__)) EFS_DF_CREDENTIAL_HEADER; typedef EFS_DF_CREDENTIAL_HEADER EFS_DF_CRED_HEADER; @@ -2436,16 +2464,19 @@ typedef EFS_DF_CREDENTIAL_HEADER EFS_DF_CRED_HEADER; typedef struct { /* 0*/ u32 thumbprint_offset; /* Offset in bytes to the thumbprint. */ u32 thumbprint_size; /* Size of thumbprint in bytes. */ -/* 8*/ u32 guid_offset; /* Offset in bytes to GUID from start - if this structure or 0 if no GUID - present. */ - u32 container_name_offset; /* Offset in bytes to the name of the +/* 8*/ u32 container_name_offset; /* Offset in bytes to the name of the container from start of this structure or 0 if no name present. */ + u32 provider_name_offset; /* Offset in bytes to the name of the + cryptographic provider from start of + this structure or 0 if no name + present. */ /* 16*/ u32 user_name_offset; /* Offset in bytes to the user name - from start of this structure. */ -} __attribute__ ((__packed__)) EFS_DF_CERTIFICATE_HEADER; + from start of this structure or 0 if + no user name present. (This is also + known as lpDisplayInformation.) */ +} __attribute__ ((__packed__)) EFS_DF_CERTIFICATE_THUMBPRINT_HEADER; -typedef EFS_DF_CERTIFICATE_HEADER EFS_DF_CERT_HEADER; +typedef EFS_DF_CERTIFICATE_THUMBPRINT_HEADER EFS_DF_CERT_THUMBPRINT_HEADER; #endif /* defined _NTFS_LAYOUT_H */ From 4e292d96f119e24b2caa09ba29997f207b9cd193 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 14 Aug 2005 12:26:55 +0000 Subject: [PATCH 2469/2994] remove old version of dt_alloc_children clean up inode handling fix ridiculous mft reading bug mftrec mark free -> set inuse inc attrib instance ids successfully create a file --- ntfsprogs/ntfsrm.c | 137 +++++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 68 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index fdbb144d..0c355522 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -385,7 +385,6 @@ static ntfs_inode * ntfs_inode_open3 (ntfs_volume *vol, const MFT_REF mref) ino->mft_no = mref; ino->vol = vol; - ino->state = NI_Dirty; ino->data_size = -1; ino->allocated_size = -1; @@ -393,14 +392,14 @@ static ntfs_inode * ntfs_inode_open3 (ntfs_volume *vol, const MFT_REF mref) ino->private_data = NULL; ino->ref_count = 1; - if (1 != ntfs_mst_pread (vol->dev, MREF(mref) * vol->mft_record_size, 1, vol->mft_record_size, ino->mrec)) { - printf ("mft record read failed\n"); + if (1 != ntfs_attr_mst_pread (vol->mft_na, MREF(mref) * vol->mft_record_size, 1, vol->mft_record_size, ino->mrec)) { //ntfs_inode_close2 (ino); ??? free (ino->mrec); free (ino); return NULL; } + NInoSetDirty (ino); return ino; } @@ -1232,21 +1231,6 @@ static int ntfs_dt_commit (struct ntfs_dt *dt) return 0; } -/** - * ntfs_dt_alloc_children - */ -static INDEX_ENTRY ** ntfs_dt_alloc_children (INDEX_ENTRY **children, int count) -{ - // XXX calculate for 2K and 4K indexes max and min filenames (inc/exc VCN) - int old = (count + 0x1e) & ~0x1f; - int new = (count + 0x1f) & ~0x1f; - - if (old == new) - return children; - - return realloc (children, new * sizeof (INDEX_ENTRY*)); -} - /** * ntfs_dt_alloc_children2 */ @@ -1264,7 +1248,12 @@ static BOOL ntfs_dt_alloc_children2 (struct ntfs_dt *dt, int count) dt->sub_nodes = realloc (dt->sub_nodes, new * sizeof (*dt->sub_nodes)); dt->inodes = realloc (dt->inodes, new * sizeof (*dt->inodes)); - // XXX wipe new space + if (!dt->children || !dt->sub_nodes || !dt->inodes) + return FALSE; // dt->child_count = -1 ? + + memset ((u8*)dt->children + old, 0, (new - old) * sizeof (*dt->children)); + memset ((u8*)dt->sub_nodes + old, 0, (new - old) * sizeof (*dt->sub_nodes)); + memset ((u8*)dt->inodes + old, 0, (new - old) * sizeof (*dt->inodes)); return (dt->children && dt->sub_nodes && dt->inodes); } @@ -1303,9 +1292,9 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt) while (ptr < (buffer + size)) { entry = (INDEX_ENTRY*) ptr; - dt->child_count++; - dt->children = ntfs_dt_alloc_children (dt->children, dt->child_count); + dt->child_count++; + ntfs_dt_alloc_children2 (dt, dt->child_count); // XXX retval if (entry->flags & INDEX_ENTRY_NODE) { vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); @@ -1327,11 +1316,6 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt) //printf ("count = %d\n\n", dt->child_count); - if (dt->child_count > 0) { - //printf ("%d subnodes\n", dt->child_count); - dt->sub_nodes = calloc (dt->child_count, sizeof (struct ntfs_dt *)); - dt->inodes = calloc (dt->child_count, sizeof (struct ntfs_inode *)); - } return dt->child_count; } @@ -1366,9 +1350,9 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) dt->child_count = 0; while (ptr < (buffer + 0x18 + block->index.index_length)) { entry = (INDEX_ENTRY*) ptr; - dt->child_count++; - dt->children = ntfs_dt_alloc_children (dt->children, dt->child_count); + dt->child_count++; + ntfs_dt_alloc_children2 (dt, dt->child_count); // XXX retval if (entry->flags & INDEX_ENTRY_NODE) { vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); @@ -1390,12 +1374,6 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) } //printf ("count = %d\n", dt->child_count); - if (dt->child_count > 0) { - //printf ("%d subnodes\n", dt->child_count); - dt->sub_nodes = calloc (dt->child_count, sizeof (struct ntfs_dt *)); - dt->inodes = calloc (dt->child_count, sizeof (struct ntfs_inode *)); - } - return dt->child_count; } @@ -2127,33 +2105,39 @@ static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) /** - * utils_mftrec_mark_free5 + * utils_mftrec_mark_free6 */ -static int utils_mftrec_mark_free5 (ntfs_inode *inode, struct ntfs_bmp *bmp, MFT_REF mref) +static int utils_mftrec_set_inuse6 (ntfs_inode *inode, struct ntfs_bmp *bmp, BOOL inuse) { MFT_RECORD *rec; if (!inode) return -1; - if (ntfs_bmp_set_range (bmp, (VCN) MREF (mref), 1, 0) < 0) + if (ntfs_bmp_set_range (bmp, (VCN) MREF (inode->mft_no), 1, inuse) < 0) return -1; rec = (MFT_RECORD*) inode->mrec; // XXX extent inodes? - if ((rec->flags & MFT_RECORD_IN_USE) == 0) { - Eprintf ("MFT record isn't in use (4).\n"); - return -1; + + if (inuse) { + if ((rec->flags & MFT_RECORD_IN_USE) == 1) { + Eprintf ("MFT record is already in use.\n"); + return -1; + } + rec->flags |= MFT_RECORD_IN_USE; + } else { + if ((rec->flags & MFT_RECORD_IN_USE) == 0) { + Eprintf ("MFT record isn't in use.\n"); + return -1; + } + rec->flags &= ~MFT_RECORD_IN_USE; } - rec->flags &= ~MFT_RECORD_IN_USE; - //printf ("inode %llu, %lu\n", inode->mft_no, inode->state); - NInoSetDirty(inode); - //printf ("inode %llu, %lu\n", inode->mft_no, inode->state); + // XXX inc sequence number - //printf ("\n"); - //utils_dump_mem (buffer, 0, 1024, DM_DEFAULTS); + NInoSetDirty(inode); printf (GREEN "Modified: inode %lld MFT_RECORD header\n" END, inode->mft_no); return 0; @@ -2268,9 +2252,12 @@ static int ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int memset (attr, 0, 0x18); *(u32*)((u8*) attr + 0x00) = type; *(u32*)((u8*) attr + 0x04) = data_len + 0x18; + *(u16*)((u8*) attr + 0x0E) = mrec->next_attr_instance; *(u32*)((u8*) attr + 0x10) = data_len; *(u32*)((u8*) attr + 0x14) = 0x18; + mrec->next_attr_instance++; + return 0; } @@ -2834,6 +2821,7 @@ static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) add->data = attr; add->data_len += need; + add->header = (INDEX_HEADER*) (add->data + 0x10); add->header->index_length = add->data_len - 16; add->header->allocated_size = add->data_len - 16; @@ -4451,7 +4439,7 @@ static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) bmp_mft = vol->private_bmp1; bmp_vol = vol->private_bmp2; - if (1) utils_mftrec_mark_free5 (ino, bmp_mft, ie->indexed_file); + if (1) utils_mftrec_set_inuse6 (ino, bmp_mft, FALSE); if (1) utils_free_non_residents2 (ino, bmp_vol); @@ -4482,7 +4470,6 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) ntfschar *uname = NULL; int uname_len = 0; ntfs_inode *ino = NULL; - ntfs_inode *ino2 = NULL; u8 *tmp = NULL; u8 *buffer = NULL; s64 now = 0; @@ -4513,7 +4500,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) goto close; ie = ntfs_ie_create(); - ie = ntfs_ie_set_name (ie, uname, uname_len, FILE_NAME_WIN32); + ie = ntfs_ie_set_name (ie, uname, uname_len, FILE_NAME_POSIX); if (!ie) { printf ("!ie\n"); goto close; @@ -4521,7 +4508,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) // These two NEED the sequence number in the top 8 bits ie->indexed_file = new_num; // MFT Ref: new file - ie->key.file_name.parent_directory = find.mref; // MFT Ref: parent dir + ie->key.file_name.parent_directory = MK_MREF (find.mref, 2);// MFT Ref: parent dir now = utc2ntfs (time(NULL)); ie->key.file_name.creation_time = now; @@ -4535,6 +4522,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) //ntfs_ie_dump (ie); + //printf ("new inode %lld\n", new_num); ino = ntfs_inode_open3 (vol, new_num); if (!ino) { printf ("!ino\n"); @@ -4544,12 +4532,24 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) //printf ("attributes start at offset 0x%02X\n", ino->mrec->attrs_offset); tmp = (u8*) ino->mrec; + + // Wipe all the attributes memset (tmp + ino->mrec->attrs_offset, 0, vol->mft_record_size - ino->mrec->attrs_offset); + // Add new end marker *(u32*) (tmp + ino->mrec->attrs_offset) = 0xFFFFFFFF; - ino->mrec->bytes_in_use = ino->mrec->attrs_offset + 8; + // Reset headers... + ino->mrec->lsn = 0; + ino->mrec->link_count = 1; + ino->mrec->base_mft_record = 0; + ino->mrec->next_attr_instance = 0; + + utils_mftrec_set_inuse6 (ino, vol->private_bmp1, TRUE); + + ie->indexed_file = MK_MREF (new_num, ino->mrec->sequence_number); + //utils_dump_mem ((u8*)ino->mrec, 0, ino->mrec->bytes_in_use, DM_DEFAULTS); buffer = malloc (128); @@ -4567,7 +4567,9 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) // File name memset (buffer, 0, 128); - *(u64*)(buffer + 0x00) = find.mref; // MFT Ref of parent dir + printf ("parent = 0x%llX\n", find.mref); + printf ("ino mref = %lld\n", ino->mft_no); + *(u64*)(buffer + 0x00) = MK_MREF (find.mref, 2); // MFT Ref of parent dir *(u64*)(buffer + 0x08) = now; // Time *(u64*)(buffer + 0x10) = now; // Time *(u64*)(buffer + 0x18) = now; // Time @@ -4577,7 +4579,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) *(u32*)(buffer + 0x38) = 0; // Flags *(u32*)(buffer + 0x3C) = 0; // Not relevant *(u8* )(buffer + 0x40) = uname_len; // Filename length - *(u8* )(buffer + 0x41) = FILE_NAME_WIN32;// Filename namespace + *(u8* )(buffer + 0x41) = FILE_NAME_POSIX;// Filename namespace memcpy (buffer + 0x42, uname, uname_len * sizeof (ntfschar)); ntfs_mft_add_attr (ino, AT_FILE_NAME, buffer, ATTR_SIZE (0x42 + (uname_len * sizeof (ntfschar)))); //utils_dump_mem (buffer, 0, 0x50, DM_DEFAULTS); @@ -4589,26 +4591,24 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) //utils_dump_mem ((u8*)ino->mrec, 0, ino->mrec->bytes_in_use, DM_DEFAULTS); //printf ("orig inode = %p\n", find.inode); - dt = find.inode->private_data; - dir = dt->dir; - //printf ("dt = %p\n", dt); - //printf ("dir = %p\n", dir); - //printf ("num = %lld\n", dir->mft_num); - //printf ("\n"); - - ino2 = find.dt->inodes[find.dt_index]; - //printf ("num = %lld\n", ino2->mft_no); - //printf ("data = %p\n", ino2->private_data); - //printf ("children = %p\n", dir->children); - //printf ("child? = %p\n", dir->children[find.dt_index]); - - if (0) ntfs_dir_map (vol, dir); + dir = dt->dir->children[0]; + dt = dir->index; + printf ("dir = %p (%lld)\n", dir, MREF (dir->mft_num)); + printf ("dt = %p (%d)\n", dt, dt->child_count); + printf ("\n"); //printf ("\n"); //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); //printf ("\n"); - //ntfs_dt_root_add (dt, ie); + ntfs_dt_root_add (dt, ie); + ino->ref_count++; + dt->inodes[0] = ino; + + *(((u8*) ino->mrec) + 166) = RESIDENT_ATTR_IS_INDEXED; + *(((u8*) ino->mrec) + 154) = 0x18; // offset to name + + // add inode to dt's list //printf ("\n"); //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); @@ -4754,6 +4754,7 @@ done: if (0) ntfs_dt_root_add (NULL, NULL); if (0) ntfs_dt_alloc_add (NULL, NULL); if (0) utils_pathname_to_inode2 (NULL, NULL, NULL, NULL); + if (0) ntfs_dir_map (NULL, NULL); return result; } From 9028a53dfce881242b7e1c9e6956ba9288823102 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 14 Aug 2005 15:44:46 +0000 Subject: [PATCH 2470/2994] Sorry it's very large commit (46K of diffs between my local tree and CVS HEAD before commit), file and directory creation/deletion recursively requested many changes. See ChangeLog for description of all changes. --- ChangeLog | 29 +++- include/ntfs/dir.h | 6 + include/ntfs/index.h | 5 + include/ntfs/inode.h | 9 +- include/ntfs/layout.h | 18 +- include/ntfs/ntfstime.h | 4 +- include/ntfs/volume.h | 3 + libntfs/attrib.c | 5 +- libntfs/bootsect.c | 13 +- libntfs/dir.c | 358 +++++++++++++++++++++++++++++++++++++++ libntfs/index.c | 229 +++++++++++++++++++++++++ libntfs/inode.c | 25 ++- libntfs/mft.c | 9 +- ntfsprogs/ntfsinfo.c | 6 +- ntfsprogs/ntfsls.c | 3 +- ntfsprogs/ntfsmount.c | 241 +++++++++++++++++++++----- ntfsprogs/ntfsrm.c | 2 +- ntfsprogs/ntfsundelete.c | 10 +- 18 files changed, 895 insertions(+), 80 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12103a5f..b23c5506 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,5 @@ -xx/xx/2005 - 1.11.3-WIP +xx/xx/2005 - 1.12.0-WIP - - ntfsmount: Fix small memleak. (Yura) - Add ./configure detection for gnutls library and make minimum version 1.2.3 which is the one that has the rsa key export fixed. (Anton) - Put in a minimum version for libgcrypt of 1.2.0 as I do not know if @@ -8,6 +7,32 @@ xx/xx/2005 - 1.11.3-WIP - Fix some memory leaks in ntfsdecrypt and do some cleanups. (Anton) - Fix ntfsdecrypt to also work with passwordless files. Note this requires a patched gnutls library or it still does not work. (Anton) + - Add new APIs for index adding/remove: + index.[ch]::ntfs_index_add_filename and index.[ch]::ntfs_index_rm. + They support only basic cases, so can fail with EOPNOTSUPP. (Yura) + - Add new API for index context reinitialization: + ntfs_index_ctx_reinit. (Yura) + - Add new high-level APIs for file and directory creation/deletion that + rely on ntfs_index_{add_filename,rm}: + dir.[ch]::ntfs_create and dir.[ch]::ntfs_delete. (Yura) + - Add @creation_time field to struct ntfs_inode and rename [acm]time + fields to @last_{data_change,mft_change,access}_time. Update them in + STANDARD_INFORMATION and FILE_NAMEs during inode sync. (Yura) + - layout.h: Add @v1_end and @v3_end markers for offsetof to struct + FILE_NAME_ATTR. Change type of @clusters_per_index_block from u8 to + s8, fix error in comment. Simplify a bit INDEX_ENTRY struct. (Yura) + - ntfstime.h: Use cpu_to_sle64 and sle64_to_cpu in utc2ntfs and + ntfs2utc respectively. Update all users. (Yura) + - Add @indx_record_size and @inx_record_size_bits to struct ntfs_volume. + Set them during mount. (Yura) + - attrib.c: Set RESIDENT_ATTR_IS_INDEXED flag for FILE_NAME attribute in + ntfs_attr_add. (Yura) + - inode.c: Do not sync STANDARD_INFORMATION and FILE_NAMEs for + freed inodes. (Yura) + - mft.c: Set *time and *size fields of struct ntfs_inode in + ntfs_mft_record_alloc. (Yura) + - Make ntfsmount use new APIs for file and directory creation/deletion. + Implement utime operation. (Yura) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index 59835b5a..ddf624b3 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -2,6 +2,7 @@ * dir.h - Exports for directory handling. Part of the Linux-NTFS project. * * Copyright (c) 2002 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -39,6 +40,11 @@ extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, extern ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent, const char *pathname); +extern ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, + const unsigned type); +extern int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, + u8 name_len); + /* * File types (adapted from include ) */ diff --git a/include/ntfs/index.h b/include/ntfs/index.h index 5330a61e..c4a78375 100644 --- a/include/ntfs/index.h +++ b/include/ntfs/index.h @@ -90,10 +90,15 @@ typedef struct { extern ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *ni, ntfschar *name, u32 name_len); extern void ntfs_index_ctx_put(ntfs_index_context *ictx); +extern void ntfs_index_ctx_reinit(ntfs_index_context *ictx); extern int ntfs_index_lookup(const void *key, const int key_len, ntfs_index_context *ictx); +extern int ntfs_index_add_filename(ntfs_inode *ni, FILE_NAME_ATTR *fn, + MFT_REF mref); +extern int ntfs_index_rm(ntfs_index_context *ictx); + /** * ntfs_index_entry_mark_dirty - mark an index entry dirty * @ictx: ntfs index context describing the index entry diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 4718a909..05c4f07c 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -2,7 +2,7 @@ * inode.h - Defines for NTFS inode handling. Part of the Linux-NTFS project. * * Copyright (c) 2001,2002 Anton Altaparmakov - * Copyright (c) 2004 Yura Pakhuchiy + * Copyright (c) 2004-2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -144,9 +144,10 @@ struct _ntfs_inode { s64 data_size; s64 allocated_size; - time_t atime; /* Last access to the data within the file. */ - time_t mtime; /* Last change of the data within the file. */ - time_t ctime; /* Last change of the metadata of the file. */ + time_t creation_time; + time_t last_data_change_time; + time_t last_mft_change_time; + time_t last_access_time; }; extern ntfs_inode *ntfs_inode_allocate(ntfs_volume *vol); diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 5d639d9b..2d78b19b 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -883,8 +883,11 @@ typedef struct { /* 32*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */ /* 36*/ union { /* NTFS 1.2 (and previous, presumably) */ -/* 36 */ u8 reserved12[12]; /* Reserved/alignment to 8-byte - boundary. */ + struct { + /* 36 */ u8 reserved12[12]; /* Reserved/alignment to 8-byte + boundary. */ + /* 48 */ void *v1_end[0]; /* Marker for offsetof(). */ + } __attribute__ ((__packed__)); /* sizeof() = 48 bytes */ /* NTFS 3.0 */ struct { @@ -937,6 +940,7 @@ typedef struct { partition. This, in contrast to disabling the journal is a very fast process, so the user won't even notice it. */ + /* 72*/ void *v3_end[0]; /* Marker for offsetof(). */ } __attribute__ ((__packed__)); } __attribute__ ((__packed__)); /* sizeof() = 72 bytes (NTFS 3.0) */ @@ -1989,10 +1993,10 @@ typedef struct { this must be COLLATION_FILE_NAME. */ u32 index_block_size; /* Size of each index block in bytes (in the index allocation attribute). */ - u8 clusters_per_index_block; /* Cluster size of each index block (in + s8 clusters_per_index_block; /* Cluster size of each index block (in the index allocation attribute), when an index block is >= than a cluster, - otherwise this will be the log of + otherwise this will be the -log of the size (like how the encoding of the mft record size and the index record size found in the boot sector @@ -2168,13 +2172,11 @@ typedef struct { */ typedef struct { /* 0 INDEX_ENTRY_HEADER; -- Unfolded here as gcc dislikes unnamed structs. */ - union { - struct { /* Only valid when INDEX_ENTRY_END is not set. */ - MFT_REF indexed_file; /* The mft reference of the file + union { /* Only valid when INDEX_ENTRY_END is not set. */ + MFT_REF indexed_file; /* The mft reference of the file described by this index entry. Used for directory indexes. */ - } __attribute__ ((__packed__)); struct { /* Used for views/indexes to find the entry's data. */ u16 data_offset; /* Data byte offset from this INDEX_ENTRY. Follows the diff --git a/include/ntfs/ntfstime.h b/include/ntfs/ntfstime.h index d6c9677f..85d8a53c 100644 --- a/include/ntfs/ntfstime.h +++ b/include/ntfs/ntfstime.h @@ -40,7 +40,7 @@ */ static __inline__ time_t ntfs2utc(s64 ntfs_time) { - return (ntfs_time - (NTFS_TIME_OFFSET)) / 10000000; + return (sle64_to_cpu(ntfs_time) - (NTFS_TIME_OFFSET)) / 10000000; } /** @@ -61,7 +61,7 @@ static __inline__ time_t ntfs2utc(s64 ntfs_time) static __inline__ s64 utc2ntfs(time_t utc_time) { /* Convert to 100ns intervals and then add the NTFS time offset. */ - return (s64)utc_time * 10000000 + NTFS_TIME_OFFSET; + return cpu_to_sle64((s64)utc_time * 10000000 + NTFS_TIME_OFFSET); } #endif /* _NTFS_NTFSTIME_H */ diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index a25ef156..95593a6c 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -2,6 +2,7 @@ * volume.h - Exports for NTFS volume handling. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -124,8 +125,10 @@ struct _ntfs_volume { u8 sector_size_bits; /* Log(2) of the byte size of a sector. */ u32 cluster_size; /* Byte size of a cluster. */ u32 mft_record_size; /* Byte size of a mft record. */ + u32 indx_record_size; /* Byte size of a INDX record. */ u8 cluster_size_bits; /* Log(2) of the byte size of a cluster. */ u8 mft_record_size_bits;/* Log(2) of the byte size of a mft record. */ + u8 indx_record_size_bits;/* Log(2) of the byte size of a INDX record. */ /* Variables used by the cluster and mft allocators. */ u8 mft_zone_multiplier; /* Initial mft zone multiplier. */ diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e594cfd2..e366c6fb 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2573,7 +2573,10 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, a->instance = m->next_attr_instance; a->value_length = 0; a->value_offset = cpu_to_le16(length); - a->resident_flags = 0; + if (type == AT_FILE_NAME) + a->resident_flags = RESIDENT_ATTR_IS_INDEXED; + else + a->resident_flags = 0; if (name_len) memcpy((u8*)a + le16_to_cpu(a->name_offset), name, sizeof(ntfschar) * name_len); diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index c6a1a36f..4230bcad 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -2,6 +2,7 @@ * bootsect.c - Boot sector handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000-2005 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -225,7 +226,7 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) if (c < 0) vol->mft_record_size = 1 << -c; else - vol->mft_record_size = vol->cluster_size * c; + vol->mft_record_size = c << vol->cluster_size_bits; if (vol->mft_record_size & (vol->mft_record_size - 1)) { Dprintf("Error: %s is not a valid NTFS partition! " "mft_record_size is not a power of 2.\n", @@ -235,6 +236,16 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) vol->mft_record_size_bits = ffs(vol->mft_record_size) - 1; Dprintf("MftRecordSize = 0x%x\n", (unsigned)vol->mft_record_size); Dprintf("MftRecordSizeBits = %u\n", vol->mft_record_size_bits); + /* Same as above for INDX record. */ + c = bs->clusters_per_index_record; + Dprintf("ClustersPerINDXRecord = 0x%x\n", c); + if (c < 0) + vol->indx_record_size = 1 << -c; + else + vol->indx_record_size = c << vol->cluster_size_bits; + vol->indx_record_size_bits = ffs(vol->indx_record_size) - 1; + Dprintf("INDXRecordSize = 0x%x\n", (unsigned)vol->indx_record_size); + Dprintf("INDXRecordSizeBits = %u\n", vol->indx_record_size_bits); /* * Work out the size of the MFT mirror in number of mft records. If the * cluster size is less than or equal to the size taken by four mft diff --git a/libntfs/dir.c b/libntfs/dir.c index 8dbc7723..fdca85e4 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -2,6 +2,7 @@ * dir.c - Directory handling code. Part of the Linux-NTFS project. * * Copyright (c) 2002-2005 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -37,6 +38,10 @@ #include "inode.h" #include "dir.h" #include "volume.h" +#include "mft.h" +#include "index.h" +#include "ntfstime.h" +#include "lcnalloc.h" /* * The little endian Unicode string "$I30" as a global constant. @@ -1054,3 +1059,356 @@ err_out: return -1; } +/** + * ntfs_create - create file or directory on ntfs volume + * @dir_ni: ntfs inode for directory in which create new object + * @name: unicode name of new object + * @name_len: length of the name in unicode characters + * @type: type of the object to create + * + * @type can be either NTFS_DT_REG to create regular file or NTFS_DT_DIR to + * create directory, other valuer are invalid. + * + * Return opened ntfs inode that describes created file on success or NULL + * on error with errno set to the error code. + */ +ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, + const unsigned type) +{ + ntfs_inode *ni; + ntfs_attr *na; + FILE_NAME_ATTR *fn = NULL; + STANDARD_INFORMATION *si = NULL; + int err, fn_len, si_len; + + ntfs_debug("Entering."); + /* Sanity checks. */ + if (!dir_ni || !name || !name_len || + (type != NTFS_DT_REG && type != NTFS_DT_DIR)) { + ntfs_error(, "Invalid arguments."); + return NULL; + } + /* Allocate MFT record for new file. */ + ni = ntfs_mft_record_alloc(dir_ni->vol, NULL); + if (!ni) { + ntfs_error(, "Failed to allocate new MFT record."); + return NULL; + } + /* + * Create STANDARD_INFORMATION attribute. Write STANDARD_INFORMATION + * version 1.2, windows will upgrade it to version 3 if needed. + */ + si_len = offsetof(STANDARD_INFORMATION, v1_end); + si = calloc(1, si_len); + if (!si) { + err = errno; + ntfs_error(, "Not enough memory."); + goto err_out; + } + si->creation_time = utc2ntfs(ni->creation_time); + si->last_data_change_time = utc2ntfs(ni->last_data_change_time); + si->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); + si->last_access_time = utc2ntfs(ni->last_access_time); + /* Add STANDARD_INFORMATION to inode. */ + na = ntfs_attr_add(ni, AT_STANDARD_INFORMATION, AT_UNNAMED, 0, si_len); + if (!na) { + err = errno; + ntfs_error(, "Failed to add STANDARD_INFORMATION attribute."); + goto err_out; + } + if (ntfs_attr_pwrite(na, 0, si_len, si) != si_len) { + err = errno; + ntfs_error(, "Failed to initialize STANDARD_INFORMATION " + "attribute."); + goto err_out; + } + ntfs_attr_close(na); + if (type == NTFS_DT_DIR) { + INDEX_ROOT *ir = NULL; + INDEX_ENTRY *ie; + int ir_len, index_len; + + /* Create INDEX_ROOT attribute. */ + index_len = sizeof(INDEX_HEADER) + sizeof(INDEX_ENTRY_HEADER); + ir_len = offsetof(INDEX_ROOT, index) + index_len; + ir = calloc(1, ir_len); + if (!ir) { + err = errno; + ntfs_error(, "Not enough memory."); + goto err_out; + } + ir->type = AT_FILE_NAME; + ir->collation_rule = COLLATION_FILE_NAME; + ir->index_block_size = cpu_to_le32(ni->vol->indx_record_size); + if (ni->vol->cluster_size <= ni->vol->indx_record_size) + ir->clusters_per_index_block = + ni->vol->indx_record_size >> + ni->vol->cluster_size_bits; + else + ir->clusters_per_index_block = + -ni->vol->indx_record_size_bits; + ir->index.entries_offset = cpu_to_le32(sizeof(INDEX_HEADER)); + ir->index.index_length = cpu_to_le32(index_len); + ir->index.allocated_size = cpu_to_le32(index_len); + ie = (INDEX_ENTRY*)((u8*)ir + sizeof(INDEX_ROOT)); + ie->length = cpu_to_le16(sizeof(INDEX_ENTRY_HEADER)); + ie->key_length = 0; + ie->flags = INDEX_ENTRY_END; + /* Add INDEX_ROOT attribute to inode. */ + na = ntfs_attr_add(ni, AT_INDEX_ROOT, I30, 4, ir_len); + if (!na) { + err = errno; + free(ir); + ntfs_error(, "Failed to add INDEX_ROOT attribute."); + goto err_out; + } + if (ntfs_attr_pwrite(na, 0, ir_len, ir) != ir_len) { + err = errno; + free(ir); + ntfs_error(, "Failed to initialize INDEX_ROOT."); + goto err_out; + } + ntfs_attr_close(na); + } else { + /* Add DATA attribute to inode. */ + na = ntfs_attr_add(ni, AT_DATA, AT_UNNAMED, 0, 0); + if (!na) { + err = errno; + ntfs_error(, "Failed to add DATA attribute."); + goto err_out; + } + ntfs_attr_close(na); + } + /* Create FILE_NAME attribute. */ + fn_len = sizeof(FILE_NAME_ATTR) + name_len * sizeof(ntfschar); + fn = calloc(1, fn_len); + if (!fn) { + err = errno; + ntfs_error(, "Not enough memory."); + goto err_out; + } + fn->parent_directory = MK_LE_MREF(dir_ni->mft_no, + le16_to_cpu(dir_ni->mrec->sequence_number)); + fn->file_name_length = name_len; + fn->file_name_type = FILE_NAME_POSIX; + if (type == NTFS_DT_DIR) + fn->file_attributes = FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; + fn->creation_time = utc2ntfs(ni->creation_time); + fn->last_data_change_time = utc2ntfs(ni->last_data_change_time); + fn->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); + fn->last_access_time = utc2ntfs(ni->last_access_time); + memcpy(fn->file_name, name, name_len * sizeof(ntfschar)); + /* Add FILE_NAME attribute to inode. */ + na = ntfs_attr_add(ni, AT_FILE_NAME, AT_UNNAMED, 0, fn_len); + if (!na) { + err = errno; + ntfs_error(, "Failed to add FILE_NAME attribute."); + goto err_out; + } + if (ntfs_attr_pwrite(na, 0, fn_len, fn) != fn_len) { + err = errno; + ntfs_error(, "Failed to initialize FILE_NAME attribute."); + goto err_out; + } + ntfs_attr_close(na); + /* Add FILE_NAME attribute to index. */ + if (ntfs_index_add_filename(dir_ni, fn, MK_MREF(ni->mft_no, + le16_to_cpu(ni->mrec->sequence_number)))) { + err = errno; + ntfs_error(, "Failed to add entry to the index."); + goto err_out; + } + /* Set hard links count and directory flag. */ + ni->mrec->link_count = cpu_to_le16(1); + if (type == NTFS_DT_DIR) + ni->mrec->flags |= MFT_RECORD_IS_DIRECTORY; + ntfs_inode_mark_dirty(ni); + /* Done! */ + free(fn); + free(si); + ntfs_debug("Done."); + return ni; +err_out: + ntfs_debug("Failed."); + if (ntfs_mft_record_free(ni->vol, ni)) + ntfs_error(, "Failed to free MFT record. " + "Leaving inconsist metadata. Run chkdsk."); + if (fn) + free(fn); + if (si) + free(si); + errno = err; + return NULL; +} + +/** + * ntfs_delete - delete file or directory from ntfs volume + * @ni: ntfs inode for object to delte + * @dir_ni: ntfs inode for directory in which delete object + * @name: unicode name of the object to delete + * @name_len: length of the name in unicode characters + * + * @ni is always closed after using of this function (even if it failed), + * user do not need to call ntfs_inode_close himself. + * + * Return 0 on success or -1 on error with errno set to the error code. + */ +int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) +{ + ntfs_attr_search_ctx *actx = NULL; + ntfs_index_context *ictx = NULL; + FILE_NAME_ATTR *fn = NULL; + BOOL looking_for_dos_name = FALSE, looking_for_win32_name = FALSE; + int err = 0; + + ntfs_debug("Entering."); + if (!ni || !dir_ni || !name || !name_len) { + ntfs_error(, "Invalid arguments."); + errno = EINVAL; + goto err_out; + } + if (ni->nr_extents == -1) + ni = ni->base_ni; + if (dir_ni->nr_extents == -1) + dir_ni = dir_ni->base_ni; + /* + * Search for FILE_NAME attribute with such name. If it's in POSIX or + * WIN32_AND_DOS namespace, then simply remove it from index and inode. + * If filename in DOS or in WIN32 namespace, then remove DOS name first, + * only then remove WIN32 name. Mark WIN32 name as POSIX name to prevent + * chkdsk to complain about DOS name absentation, in case if DOS name + * had been successfully deleted, but WIN32 name removing failed. + */ + actx = ntfs_attr_get_search_ctx(ni, NULL); + if (!actx) + goto err_out; +search: + while (!ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, CASE_SENSITIVE, + 0, NULL, 0, actx)) { + errno = 0; + fn = (FILE_NAME_ATTR*)((u8*)actx->attr + + le16_to_cpu(actx->attr->value_offset)); + if (looking_for_dos_name && fn->file_name_type == FILE_NAME_DOS) + break; + if (looking_for_win32_name && + fn->file_name_type == FILE_NAME_WIN32) + break; + if (dir_ni->mft_no == MREF_LE(fn->parent_directory) && + ntfs_names_are_equal(fn->file_name, + fn->file_name_length, name, + name_len, (fn->file_name_type == + FILE_NAME_POSIX) ? CASE_SENSITIVE : IGNORE_CASE, + ni->vol->upcase, ni->vol->upcase_len)) { + if (fn->file_name_type == FILE_NAME_WIN32) { + looking_for_dos_name = TRUE; + ntfs_attr_reinit_search_ctx(actx); + continue; + } + if (fn->file_name_type == FILE_NAME_DOS) + looking_for_dos_name = TRUE; + break; + } + } + if (errno) + goto err_out; + /* Search for such FILE_NAME in index. */ + ictx = ntfs_index_ctx_get(dir_ni, I30, 4); + if (!ictx) + goto err_out; + if (ntfs_index_lookup(fn, le32_to_cpu(actx->attr->value_length), ictx)) + goto err_out; + /* Set namespace to POSIX for WIN32 name. */ + if (fn->file_name_type == FILE_NAME_WIN32) { + fn->file_name_type = FILE_NAME_POSIX; + ntfs_inode_mark_dirty(actx->ntfs_ino); + ((FILE_NAME_ATTR*)ictx->data)->file_name_type = FILE_NAME_POSIX; + ntfs_index_entry_mark_dirty(ictx); + } + /* Do not support reparse oint deletion yet. */ + if (((FILE_NAME_ATTR*)ictx->data)->file_attributes & + FILE_ATTR_REPARSE_POINT) { + errno = EOPNOTSUPP; + goto err_out; + } + /* Remove FILE_NAME from index. */ + if (ntfs_index_rm(ictx)) + goto err_out; + ictx = NULL; + /* Remove FILE_NAME from inode. */ + if (ntfs_attr_record_rm(actx)) + goto err_out; + /* Decerement hard link count. */ + ni->mrec->link_count = cpu_to_le16(le16_to_cpu( + ni->mrec->link_count) - 1); + ntfs_inode_mark_dirty(ni); + if (looking_for_dos_name) { + looking_for_dos_name = FALSE; + looking_for_win32_name = TRUE; + ntfs_attr_reinit_search_ctx(actx); + goto search; + } + /* + * If hard link count is not equal to zero then we are done. In other + * case there are no reference to this inode left, so we should free all + * non-resident atributes and mark inode as not in use. + */ + if (ni->mrec->link_count) + goto out; + ntfs_attr_reinit_search_ctx(actx); + while (!ntfs_attrs_walk(actx)) { + if (actx->attr->non_resident) { + runlist *rl; + + rl = ntfs_mapping_pairs_decompress(ni->vol, actx->attr, + NULL); + if (!rl) { + err = errno; + ntfs_error(, "Failed to decompress runlist. " + "Leaving inconsist metadata."); + continue; + } + if (ntfs_cluster_free_from_rl(ni->vol, rl)) { + err = errno; + ntfs_error(, "Failed to free clusters. " + "Leaving inconsist metadata."); + continue; + } + free(rl); + } + } + if (errno != ENOENT) { + err = errno; + ntfs_error(, "Atribute enumeration failed. " + "Probably leaving inconsist metadata."); + } + /* All extents should be attached after attribute walk. */ + while (ni->nr_extents) + if (ntfs_mft_record_free(ni->vol, *(ni->extent_nis))) { + err = errno; + ntfs_error(, "Failed to free extent MFT record. " + "Leaving inconsist metadata."); + } + if (ntfs_mft_record_free(ni->vol, ni)) { + err = errno; + ntfs_error(, "Failed to free base MFT record. " + "Leaving inconsist metadata."); + } + ni = NULL; +out: + if (actx) + ntfs_attr_put_search_ctx(actx); + if (ictx) + ntfs_index_ctx_put(ictx); + if (ni) + ntfs_inode_close(ni); + if (err) { + ntfs_error(, "Failed."); + errno = err; + return -1; + } + ntfs_debug("Done."); + return 0; +err_out: + err = errno; + goto out; +} diff --git a/libntfs/index.c b/libntfs/index.c index 444b4eac..7f85cc3c 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -27,6 +27,7 @@ #include "debug.h" #include "index.h" #include "mst.h" +#include "dir.h" /** * ntfs_index_ctx_get - allocate and initialize a new index context @@ -90,6 +91,42 @@ void ntfs_index_ctx_put(ntfs_index_context *ictx) free(ictx); } +/** + * ntfs_index_ctx_reinit - reinitialize an index context + * @ictx: index context to reinitialize + * + * Reintialize the index context @ictx so it can be used for ntfs_index_lookup. + */ +void ntfs_index_ctx_reinit(ntfs_index_context *ictx) +{ + if (ictx->entry) { + if (ictx->is_in_root) { + if (ictx->actx) + ntfs_attr_put_search_ctx(ictx->actx); + } else { + /* Write out index block it it's dirty. */ + if (ictx->ia_dirty) { + if (ntfs_attr_mst_pwrite(ictx->ia_na, + ictx->ia_vcn << + ictx->ni->vol-> + cluster_size_bits, + 1, ictx->block_size, + ictx->ia) != 1) + ntfs_error(, "Failed to write out " + "index block."); + } + /* Free resources. */ + free(ictx->ia); + ntfs_attr_close(ictx->ia_na); + } + } + *ictx = (ntfs_index_context) { + .ni = ictx->ni, + .name = ictx->name, + .name_len = ictx->name_len, + }; +} + /** * ntfs_index_lookup - find a key in an index and return its index entry * @key: [IN] key for which to search in the index @@ -397,3 +434,195 @@ idx_err_out: goto err_out; } +/** + * ntfs_index_add_filename - add filename to directory index + * @ni: ntfs inode describing directory to which index add filename + * @fn: FILE_NAME attribute to add + * @mref: reference of the inode which @fn describes + * + * NOTE: This function does not support all cases, so it can fail with + * EOPNOTSUPP error code. + * + * Return 0 on success or -1 on error with errno set to the error code. + */ +int ntfs_index_add_filename(ntfs_inode *ni, FILE_NAME_ATTR *fn, MFT_REF mref) +{ + ntfs_index_context *ictx; + INDEX_ENTRY *ie; + INDEX_HEADER *ih; + int err, fn_size, ie_size, allocated_size = 0; + + ntfs_debug("Entering."); + if (!ni || !fn) { + ntfs_error(, "Invalid arguments."); + err = EINVAL; + goto err_out; + } + ictx = ntfs_index_ctx_get(ni, I30, 4); + if (!ictx) + return -1; + fn_size = (fn->file_name_length * sizeof(ntfschar)) + + sizeof(FILE_NAME_ATTR); + ie_size = (sizeof(INDEX_ENTRY_HEADER) + fn_size + 7) & ~7; +retry: + /* Find place where insert new entry. */ + if (!ntfs_index_lookup(fn, fn_size, ictx)) { + err = EEXIST; + ntfs_error(, "Index already have such entry."); + goto err_out; + } + if (errno != ENOENT) { + err = errno; + ntfs_error(, "Failed to find place where to insert new entry."); + goto err_out; + } + /* Some setup. */ + if (ictx->is_in_root) + ih = &ictx->ir->index; + else + ih = &ictx->ia->index; + if (!allocated_size) + allocated_size = le16_to_cpu(ih->allocated_size); + /* Check whether we have enough space in the index. */ + if (le16_to_cpu(ih->index_length) + ie_size > allocated_size) { + /* If we in the index root try to resize it. */ + if (ictx->is_in_root) { + ntfs_attr *na; + + allocated_size = le16_to_cpu(ih->index_length) + + ie_size; + na = ntfs_attr_open(ictx->ni, AT_INDEX_ROOT, ictx->name, + ictx->name_len); + if (!na) { + err = errno; + ntfs_error(, "Failed to open INDEX_ROOT."); + goto err_out; + } + if (ntfs_attr_truncate(na, allocated_size + offsetof( + INDEX_ROOT, index))) { + err = EOPNOTSUPP; + ntfs_attr_close(na); + ntfs_error(, "Failed to truncate INDEX_ROOT."); + goto err_out; + } + ntfs_attr_close(na); + ntfs_index_ctx_reinit(ictx); + goto retry; + } + ntfs_debug("Not implemented case."); + err = EOPNOTSUPP; + goto err_out; + } + /* Update allocated size if we in INDEX_ROOT. */ + if (ictx->is_in_root) + ih->allocated_size = cpu_to_le16(allocated_size); + /* Create entry. */ + ie = calloc(1, ie_size); + if (!ie) { + err = errno; + goto err_out; + } + ie->indexed_file = cpu_to_le64(mref); + ie->length = cpu_to_le16(ie_size); + ie->key_length = cpu_to_le16(fn_size); + memcpy(&ie->key, fn, fn_size); + /* Update index length, move following entries forard and copy entry. */ + ih->index_length = cpu_to_le16(le16_to_cpu(ih->index_length) + ie_size); + memmove((u8*)ictx->entry + ie_size, ictx->entry, + le16_to_cpu(ih->index_length) - + ((u8*)ictx->entry - (u8*)ih) - ie_size); + memcpy(ictx->entry, ie, ie_size); + /* Done! */ + ntfs_index_entry_mark_dirty(ictx); + ntfs_index_ctx_put(ictx); + free(ie); + ntfs_debug("Done."); + return 0; +err_out: + ntfs_debug("Failed."); + ntfs_index_ctx_put(ictx); + errno = err; + return -1; +} + +/** + * ntfs_index_rm - remove entry from the index + * @ictx: index context describing entry to delete + * + * Delete entry described by @ictx from the index. NOTE: This function does not + * support all cases, so it can fail with EOPNOTSUPP error code. In any case + * index context is always reinitialized after use of this function, so it can + * be used for index lookup once again. + * + * Return 0 on success or -1 on error with errno set to the error code. + */ +int ntfs_index_rm(ntfs_index_context *ictx) +{ + INDEX_HEADER *ih; + u32 new_index_length; + int err; + + ntfs_debug("Entering."); + if (!ictx || (!ictx->ia && !ictx->ir) || + ictx->entry->flags & INDEX_ENTRY_END) { + ntfs_error(, "Invalid arguments."); + err = EINVAL; + goto err_out; + } + if (ictx->is_in_root) + ih = &ictx->ir->index; + else + ih = &ictx->ia->index; + /* Don't support deletion of entries with subnodes yet. */ + if (ictx->entry->flags & INDEX_ENTRY_NODE) { + err = EOPNOTSUPP; + goto err_out; + } + /* Calculate new length of the index. */ + new_index_length = le32_to_cpu(ih->index_length) - + le16_to_cpu(ictx->entry->length); + /* Don't support deletion of the last entry in the allocation block. */ + if (!ictx->is_in_root && (new_index_length <= + le32_to_cpu(ih->entries_offset) + + sizeof(INDEX_ENTRY_HEADER) + sizeof(VCN))) { + err = EOPNOTSUPP; + goto err_out; + } + /* Update index length and remove index entry. */ + ih->index_length = cpu_to_le32(new_index_length); + if (ictx->is_in_root) + ih->allocated_size = ih->index_length; + memmove(ictx->entry, (u8*)ictx->entry + le16_to_cpu( + ictx->entry->length), new_index_length - + ((u8*)ictx->entry - (u8*)ih)); + ntfs_index_entry_mark_dirty(ictx); + /* Resize INDEX_ROOT attribute. */ + if (ictx->is_in_root) { + ntfs_attr *na; + + na = ntfs_attr_open(ictx->ni, AT_INDEX_ROOT, ictx->name, + ictx->name_len); + if (!na) { + err = errno; + ntfs_error(, "Failed to open INDEX_ROOT attribute. " + "Leaving inconsist metadata."); + goto err_out; + } + if (ntfs_attr_truncate(na, new_index_length + offsetof( + INDEX_ROOT, index))) { + err = errno; + ntfs_error(, "Failed to truncate INDEX_ROOT attribute. " + " Leaving inconsist metadata."); + goto err_out; + } + ntfs_attr_close(na); + } + ntfs_index_ctx_reinit(ictx); + ntfs_debug("Done."); + return 0; +err_out: + ntfs_index_ctx_reinit(ictx); + ntfs_debug("Failed."); + errno = err; + return -1; +} diff --git a/libntfs/inode.c b/libntfs/inode.c index 68a8650f..4ceffbe4 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -149,9 +149,10 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) NInoSetEncrypted(ni); if (std_info->file_attributes & FILE_ATTR_SPARSE_FILE) NInoSetSparse(ni); - ni->mtime = ntfs2utc(sle64_to_cpu(std_info->last_data_change_time)); - ni->ctime = ntfs2utc(sle64_to_cpu(std_info->last_mft_change_time)); - ni->atime = ntfs2utc(sle64_to_cpu(std_info->last_access_time)); + ni->creation_time = ntfs2utc(std_info->creation_time); + ni->last_data_change_time = ntfs2utc(std_info->last_data_change_time); + ni->last_mft_change_time = ntfs2utc(std_info->last_mft_change_time); + ni->last_access_time = ntfs2utc(std_info->last_access_time); /* Set attribute list information. */ if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { @@ -471,6 +472,10 @@ static int ntfs_inode_sync_standard_information(ntfs_inode *ni) std_info->file_attributes |= FILE_ATTR_SPARSE_FILE; else std_info->file_attributes &= ~FILE_ATTR_SPARSE_FILE; + std_info->creation_time = utc2ntfs(ni->creation_time); + std_info->last_data_change_time = utc2ntfs(ni->last_data_change_time); + std_info->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); + std_info->last_access_time = utc2ntfs(ni->last_access_time); ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); return 0; @@ -561,6 +566,10 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni) fn->allocated_size = cpu_to_sle64(ni->allocated_size); if (ni->data_size != -1) fn->data_size = cpu_to_sle64(ni->data_size); + fn->creation_time = utc2ntfs(ni->creation_time); + fn->last_data_change_time = utc2ntfs(ni->last_data_change_time); + fn->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); + fn->last_access_time = utc2ntfs(ni->last_access_time); ntfs_index_entry_mark_dirty(ictx); ntfs_index_ctx_put(ictx); ntfs_inode_close(index_ni); @@ -616,7 +625,8 @@ int ntfs_inode_sync(ntfs_inode *ni) __FUNCTION__, (long long) ni->mft_no); /* Update STANDARD_INFORMATION. */ - if (ni->nr_extents != -1 && ntfs_inode_sync_standard_information(ni)) { + if ((ni->mrec->flags & MFT_RECORD_IN_USE) && ni->nr_extents != -1 && + ntfs_inode_sync_standard_information(ni)) { if (!err || errno == EIO) { err = errno; if (err != EIO) @@ -627,7 +637,8 @@ int ntfs_inode_sync(ntfs_inode *ni) } /* Update FILE_NAME's in the index. */ - if (ni->nr_extents != -1 && NInoFileNameTestAndClearDirty(ni) && + if ((ni->mrec->flags & MFT_RECORD_IN_USE) && ni->nr_extents != -1 && + NInoFileNameTestAndClearDirty(ni) && ntfs_inode_sync_file_name(ni)) { if (!err || errno == EIO) { err = errno; @@ -640,8 +651,8 @@ int ntfs_inode_sync(ntfs_inode *ni) } /* Write out attribute list from cache to disk. */ - if (ni->nr_extents != -1 && NInoAttrList(ni) && - NInoAttrListTestAndClearDirty(ni)) { + if ((ni->mrec->flags & MFT_RECORD_IN_USE) && ni->nr_extents != -1 && + NInoAttrList(ni) && NInoAttrListTestAndClearDirty(ni)) { ntfs_attr *na; na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, AT_UNNAMED, 0); diff --git a/libntfs/mft.c b/libntfs/mft.c index 055c581e..770868a6 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -2,6 +2,7 @@ * mft.c - Mft record handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -25,6 +26,7 @@ #include #include #include +#include #include "compat.h" @@ -1361,7 +1363,7 @@ mft_rec_already_initialized: if (ntfs_is_file_record(m->magic) && (m->flags & MFT_RECORD_IN_USE)) { ntfs_error(vol->sb, "Mft record 0x%llx was marked unused in " "mft bitmap but is marked used itself. " - "Corrupt filesystem or driver bug! " + "Corrupt filesystem or library bug! " "Run chkdsk immediately!", (long long)bit); free(m); errno = EIO; @@ -1435,6 +1437,11 @@ mft_rec_already_initialized: } /* Make sure the allocated inode is written out to disk later. */ ntfs_inode_mark_dirty(ni); + /* Initialize time, allocated and data size in ntfs_inode struct. */ + ni->data_size = ni->allocated_size = -1; + ni->creation_time = ni->last_data_change_time = + ni->last_mft_change_time = + ni->last_access_time = time(NULL); /* Update the default mft allocation position if it was used. */ if (!base_ni) vol->mft_data_pos = bit + 1; diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index af0a3fbe..c2744c68 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -280,7 +280,7 @@ static int parse_options (int argc, char *argv[]) */ static char *ntfsinfo_time_to_str(const s64 sle_ntfs_clock) { - time_t unix_clock = ntfs2utc(sle64_to_cpu(sle_ntfs_clock)); + time_t unix_clock = ntfs2utc(sle_ntfs_clock); return ctime(&unix_clock); } @@ -450,11 +450,11 @@ static void ntfs_dump_flags(ATTR_TYPES type, u32 flags) } if (type == AT_FILE_NAME) { if (flags & FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) { - printf(" DIRECTORY"); + printf(" FILE_NAME_INDEX"); flags &= ~FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; } if (flags & FILE_ATTR_DUP_VIEW_INDEX_PRESENT) { - printf(" INDEX_VIEW"); + printf(" VIEW_INDEX"); flags &= ~FILE_ATTR_DUP_VIEW_INDEX_PRESENT; } } diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 49dc3ef0..e51fa8f9 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -548,8 +548,7 @@ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, if (!file_name_attr) goto release; - ntfs_time = ntfs2utc(sle64_to_cpu( - file_name_attr->last_data_change_time)); + ntfs_time = ntfs2utc(file_name_attr->last_data_change_time); strcpy(t_buf, ctime(&ntfs_time)); memmove(t_buf+16, t_buf+19, 5); t_buf[21] = '\0'; diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 18d15d5e..94a25909 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -33,6 +33,7 @@ #include #include #include +#include #ifdef HAVE_SETXATTR #include @@ -285,9 +286,9 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) stbuf->st_uid = ctx->uid; stbuf->st_gid = ctx->gid; stbuf->st_ino = ni->mft_no; - stbuf->st_atime = ni->atime; - stbuf->st_ctime = ni->ctime; - stbuf->st_mtime = ni->mtime; + stbuf->st_atime = ni->last_access_time; + stbuf->st_ctime = ni->last_mft_change_time; + stbuf->st_mtime = ni->last_data_change_time; ntfs_inode_close(ni); } else res = -ENOENT; @@ -518,11 +519,86 @@ static int ntfs_fuse_chmod(const char *path __attribute__((unused)), return -EOPNOTSUPP; } +static int ntfs_fuse_create(const char *org_path, const unsigned type) +{ + char *name; + ntfschar *uname = NULL; + ntfs_inode *dir_ni = NULL, *ni; + char *path; + int res = 0, uname_len; + + path = strdup(org_path); + if (!path) + return -errno; + /* Generate unicode filename. */ + name = strrchr(path, '/'); + name++; + uname_len = ntfs_mbstoucs(name, &uname, 0); + if (uname_len < 0) { + res = -errno; + goto exit; + } + /* Open parent directory. */ + *name = 0; + dir_ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + if (!dir_ni) { + res = -errno; + if (res == -ENOENT) + res = -EIO; + goto exit; + } + /* Create object specified in @type. */ + ni = ntfs_create(dir_ni, uname, uname_len, type); + if (ni) + ntfs_inode_close(ni); + else + res = -errno; +exit: + if (uname) + free(uname); + if (dir_ni) + ntfs_inode_close(dir_ni); + free(path); + return res; +} + +static int ntfs_fuse_create_stream(const char *path, + ntfschar *stream_name, const int stream_name_len) +{ + ntfs_inode *ni; + ntfs_attr *na; + int res = 0; + + ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + if (!ni) { + res = -errno; + if (res == -ENOENT) { + /* + * If such file does not exist, create it and try once + * again to add stream to it. + */ + res = ntfs_fuse_create(path, NTFS_DT_REG); + if (!res) + return ntfs_fuse_create_stream(path, + stream_name, stream_name_len); + else + res = -errno; + } + return res; + } + na = ntfs_attr_add(ni, AT_DATA, stream_name, stream_name_len, 0); + if (na) + ntfs_attr_close(na); + else + res = -errno; + if (ntfs_inode_close(ni)) + perror("Failed to close inode"); + return res; +} + static int ntfs_fuse_mknod(const char *org_path, mode_t mode, dev_t dev __attribute__((unused))) { - ntfs_inode *ni = NULL; - ntfs_attr *na; char *path = NULL; ntfschar *stream_name; int stream_name_len; @@ -533,56 +609,76 @@ static int ntfs_fuse_mknod(const char *org_path, mode_t mode, stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); if (stream_name_len < 0) return stream_name_len; - if (!stream_name_len) { - res = -EOPNOTSUPP; - goto exit; - } - ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); - if (!ni) { - res = -errno; - if (res == -ENOENT) - res = -EOPNOTSUPP; - goto exit; - } - na = ntfs_attr_add(ni, AT_DATA, stream_name, stream_name_len, 0); - if (na) - ntfs_attr_close(na); + if (!stream_name_len) + res = ntfs_fuse_create(path, NTFS_DT_REG); else - res = -errno; -exit: - if (ni && ntfs_inode_close(ni)) - perror("Failed to close inode"); + res = ntfs_fuse_create_stream(path, stream_name, + stream_name_len); free(path); if (stream_name_len) free(stream_name); return res; } -static int ntfs_fuse_rm_file(char *file) +static int ntfs_fuse_rm(const char *org_path) { - free(file); - return -EOPNOTSUPP; -} + char *name; + ntfschar *uname = NULL; + ntfs_inode *dir_ni = NULL, *ni; + char *path; + int res = 0, uname_len; -static int ntfs_fuse_unlink(const char *org_path) -{ - ntfs_inode *ni = NULL; - ntfs_attr *na; - char *path = NULL; - ntfschar *stream_name; - int stream_name_len; - int res = 0; - - stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); - if (stream_name_len < 0) - return stream_name_len; - if (!stream_name_len) - return ntfs_fuse_rm_file(path); - ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + path = strdup(org_path); + if (!path) + return -errno; + /* Open object for delete. */ + ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); if (!ni) { res = -errno; goto exit; } + /* Generate unicode filename. */ + name = strrchr(path, '/'); + name++; + uname_len = ntfs_mbstoucs(name, &uname, 0); + if (uname_len < 0) { + res = -errno; + goto exit; + } + /* Open parent directory. */ + *name = 0; + dir_ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + if (!dir_ni) { + res = -errno; + if (res == -ENOENT) + res = -EIO; + goto exit; + } + /* Delete object. */ + if (ntfs_delete(ni, dir_ni, uname, uname_len)) + res = -errno; + ni = NULL; +exit: + if (ni) + ntfs_inode_close(ni); + if (uname) + free(uname); + if (dir_ni) + ntfs_inode_close(dir_ni); + free(path); + return res; +} + +static int ntfs_fuse_rm_stream(const char *path, ntfschar *stream_name, + const int stream_name_len) +{ + ntfs_inode *ni; + ntfs_attr *na; + int res = 0; + + ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + if (!ni) + return -errno; na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); if (!na) { res = -errno; @@ -593,14 +689,70 @@ static int ntfs_fuse_unlink(const char *org_path) ntfs_attr_close(na); } exit: - if (ni && ntfs_inode_close(ni)) + if (ntfs_inode_close(ni)) perror("Failed to close inode"); + return res; +} + +static int ntfs_fuse_unlink(const char *org_path) +{ + char *path = NULL; + ntfschar *stream_name; + int stream_name_len; + int res = 0; + + stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); + if (stream_name_len < 0) + return stream_name_len; + if (!stream_name_len) + res = ntfs_fuse_rm(path); + else + res = ntfs_fuse_rm_stream(path, stream_name, stream_name_len); free(path); if (stream_name_len) free(stream_name); return res; } +static int ntfs_fuse_mkdir(const char *path, + mode_t mode __attribute__((unused))) +{ + return ntfs_fuse_create(path, NTFS_DT_DIR); +} + +static int ntfs_fuse_rmdir(const char *path) +{ + return ntfs_fuse_rm(path); +} + +static int ntfs_fuse_utime(const char *path, struct utimbuf *buf) +{ + ntfs_inode *ni; + + if (strchr(path, ':')) + return 0; /* Unable to change time for named data streams. */ + ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + if (!ni) + return -errno; + if (buf) { + ni->last_access_time = buf->actime; + ni->last_data_change_time = buf->modtime; + ni->last_mft_change_time = buf->modtime; + } else { + time_t now; + + now = time(NULL); + ni->last_access_time = now; + ni->last_data_change_time = now; + ni->last_mft_change_time = now; + } + NInoFileNameSetDirty(ni); + NInoSetDirty(ni); + if (ntfs_inode_close(ni)) + perror("Failed to close inode"); + return 0; +} + #ifdef HAVE_SETXATTR static int ntfs_fuse_getxattr(const char *path, const char *name, @@ -883,6 +1035,9 @@ static struct fuse_operations ntfs_fuse_oper = { .chmod = ntfs_fuse_chmod, .mknod = ntfs_fuse_mknod, .unlink = ntfs_fuse_unlink, + .mkdir = ntfs_fuse_mkdir, + .rmdir = ntfs_fuse_rmdir, + .utime = ntfs_fuse_utime, #ifdef HAVE_SETXATTR .getxattr = ntfs_fuse_getxattr, #if 0 diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 0c355522..9771f33a 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -276,7 +276,7 @@ static void ntfs_binary_print (u8 num, BOOL backwards, BOOL colour) */ static const char * ntfsinfo_time_to_str(const s64 sle_ntfs_clock) { - time_t unix_clock = ntfs2utc(sle64_to_cpu(sle_ntfs_clock)); + time_t unix_clock = ntfs2utc(sle_ntfs_clock); if (sle_ntfs_clock == 0) return "none\n"; else diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 110e17a6..a0d0a72b 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -876,10 +876,10 @@ static int get_filenames (struct ufile *file, ntfs_volume* vol) name->size_data = sle64_to_cpu (attr->data_size); name->flags = attr->file_attributes; - name->date_c = ntfs2utc (sle64_to_cpu (attr->creation_time)); - name->date_a = ntfs2utc (sle64_to_cpu (attr->last_data_change_time)); - name->date_m = ntfs2utc (sle64_to_cpu (attr->last_mft_change_time)); - name->date_r = ntfs2utc (sle64_to_cpu (attr->last_access_time)); + name->date_c = ntfs2utc (attr->creation_time); + name->date_a = ntfs2utc (attr->last_data_change_time); + name->date_m = ntfs2utc (attr->last_mft_change_time); + name->date_r = ntfs2utc (attr->last_access_time); if (ntfs_ucstombs (name->uname, name->uname_len, &name->name, 0) < 0) { @@ -1052,7 +1052,7 @@ static struct ufile * read_record (ntfs_volume *vol, long long record) if (attr10) { STANDARD_INFORMATION *si; si = (STANDARD_INFORMATION *) ((char *) attr10 + le16_to_cpu (attr10->value_offset)); - file->date = ntfs2utc (sle64_to_cpu (si->last_data_change_time)); + file->date = ntfs2utc (si->last_data_change_time); } if (attr20 || !attr10) From a1ef87e393f7fe884b6d76da72d2ddf1a39da2d3 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 14 Aug 2005 15:56:31 +0000 Subject: [PATCH 2471/2994] tidy up error message --- ntfsprogs/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index a9dc6a4c..4eb4c82f 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -160,7 +160,7 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL Eprintf("Couldn't mount device '%s': %s\n", device, strerror(err)); if (err == EOPNOTSUPP) - Eprintf("It's seems that logfile check failed. " + Eprintf("It seems that the logfile check failed. " "Try to mount volume in windows.\n"); return NULL; } From 30263fb7498a78fdcb585774cc0408f39037ba1c Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 14 Aug 2005 16:06:33 +0000 Subject: [PATCH 2472/2994] fix stupidness introduced just before commit --- libntfs/index.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/index.c b/libntfs/index.c index 7f85cc3c..2fbe4ee2 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -455,8 +455,8 @@ int ntfs_index_add_filename(ntfs_inode *ni, FILE_NAME_ATTR *fn, MFT_REF mref) ntfs_debug("Entering."); if (!ni || !fn) { ntfs_error(, "Invalid arguments."); - err = EINVAL; - goto err_out; + errno = EINVAL; + return -1; } ictx = ntfs_index_ctx_get(ni, I30, 4); if (!ictx) From 14ab52fb231c01d3de6643d96726530698f03c65 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 14 Aug 2005 16:08:44 +0000 Subject: [PATCH 2473/2994] give the new file some dummy data --- ntfsprogs/ntfsrm.c | 50 ++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 9771f33a..7410846e 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -2213,12 +2213,15 @@ static int ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int u8 *src; u8 *dst; int len; + int attr_size; if (!inode) return 1; if (!data) return 1; + attr_size = ATTR_SIZE (data_len); + mrec = inode->mrec; if (!mrec) return 1; @@ -2237,7 +2240,7 @@ static int ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int len = ((u8*) mrec + mrec->bytes_in_use) - ((u8*) attr); src = (u8*) attr; - dst = src + data_len + 0x18; + dst = src + attr_size + 0x18; memmove (dst, src, len); @@ -2245,13 +2248,15 @@ static int ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int dst = (u8*) attr + 0x18; len = data_len; + // XXX wipe slack space after attr? + memcpy (dst, src, len); - mrec->bytes_in_use += data_len + 0x18; + mrec->bytes_in_use += attr_size + 0x18; memset (attr, 0, 0x18); *(u32*)((u8*) attr + 0x00) = type; - *(u32*)((u8*) attr + 0x04) = data_len + 0x18; + *(u32*)((u8*) attr + 0x04) = attr_size + 0x18; *(u16*)((u8*) attr + 0x0E) = mrec->next_attr_instance; *(u32*)((u8*) attr + 0x10) = data_len; *(u32*)((u8*) attr + 0x14) = 0x18; @@ -3235,7 +3240,7 @@ ascend: //printf ("new's vcn = %lld\n", new->vcn); // adjust parents - // attach new to median + // attach new to median // escape clause for root node? // goto ascend @@ -4475,6 +4480,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) s64 now = 0; struct ntfs_dir *dir; struct ntfs_dt *dt; + int data_len = 0; new_num = utils_mft_find_free_entry (vol); if (new_num == (MFT_REF) -1) @@ -4516,10 +4522,6 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) ie->key.file_name.last_mft_change_time = now; ie->key.file_name.last_access_time = now; - // Need to be filled in later - ie->key.file_name.allocated_size = 0; - ie->key.file_name.data_size = 0; - //ntfs_ie_dump (ie); //printf ("new inode %lld\n", new_num); @@ -4565,29 +4567,30 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) ntfs_mft_add_attr (ino, AT_STANDARD_INFORMATION, buffer, 0x48); //utils_dump_mem (buffer, 0, 0x48, DM_DEFAULTS); + // Data + memset (buffer, 0, 128); + data_len = sprintf ((char*)buffer, "Contents of file: %s\n", filename); + ntfs_mft_add_attr (ino, AT_DATA, buffer, data_len); + // File name memset (buffer, 0, 128); printf ("parent = 0x%llX\n", find.mref); printf ("ino mref = %lld\n", ino->mft_no); *(u64*)(buffer + 0x00) = MK_MREF (find.mref, 2); // MFT Ref of parent dir - *(u64*)(buffer + 0x08) = now; // Time - *(u64*)(buffer + 0x10) = now; // Time - *(u64*)(buffer + 0x18) = now; // Time - *(u64*)(buffer + 0x20) = now; // Time - *(u64*)(buffer + 0x28) = 0; // Allocated size - *(u64*)(buffer + 0x30) = 0; // Initialised size - *(u32*)(buffer + 0x38) = 0; // Flags - *(u32*)(buffer + 0x3C) = 0; // Not relevant - *(u8* )(buffer + 0x40) = uname_len; // Filename length - *(u8* )(buffer + 0x41) = FILE_NAME_POSIX;// Filename namespace + *(u64*)(buffer + 0x08) = now; // Time + *(u64*)(buffer + 0x10) = now; // Time + *(u64*)(buffer + 0x18) = now; // Time + *(u64*)(buffer + 0x20) = now; // Time + *(u64*)(buffer + 0x28) = ATTR_SIZE (data_len); // Allocated size + *(u64*)(buffer + 0x30) = data_len; // Initialised size + *(u32*)(buffer + 0x38) = 0; // Flags + *(u32*)(buffer + 0x3C) = 0; // Not relevant + *(u8* )(buffer + 0x40) = uname_len; // Filename length + *(u8* )(buffer + 0x41) = FILE_NAME_POSIX; // Filename namespace memcpy (buffer + 0x42, uname, uname_len * sizeof (ntfschar)); ntfs_mft_add_attr (ino, AT_FILE_NAME, buffer, ATTR_SIZE (0x42 + (uname_len * sizeof (ntfschar)))); //utils_dump_mem (buffer, 0, 0x50, DM_DEFAULTS); - // Data - memset (buffer, 0, 128); - ntfs_mft_add_attr (ino, AT_DATA, buffer, 0); - //utils_dump_mem ((u8*)ino->mrec, 0, ino->mrec->bytes_in_use, DM_DEFAULTS); //printf ("orig inode = %p\n", find.inode); @@ -4601,6 +4604,9 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); //printf ("\n"); + ie->key.file_name.allocated_size = ATTR_SIZE (data_len); + ie->key.file_name.data_size = data_len; + ntfs_dt_root_add (dt, ie); ino->ref_count++; dt->inodes[0] = ino; From 301c8bd331e6374d3fd10a7048b35be7d50a3f56 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 14 Aug 2005 22:22:06 +0000 Subject: [PATCH 2474/2994] tidy up complicated mft mess --- ntfsprogs/ntfsrm.c | 88 ++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 58 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 7410846e..3d007333 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -2205,7 +2205,7 @@ static int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_T /** * ntfs_mft_add_attr */ -static int ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int data_len) +static ATTR_RECORD * ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int data_len) { MFT_RECORD *mrec; ATTR_RECORD *attr; @@ -2216,15 +2216,15 @@ static int ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int int attr_size; if (!inode) - return 1; + return NULL; if (!data) - return 1; + return NULL; attr_size = ATTR_SIZE (data_len); mrec = inode->mrec; if (!mrec) - return 1; + return NULL; ptr = (u8*) inode->mrec + mrec->attrs_offset; while (1) { @@ -2263,7 +2263,7 @@ static int ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int mrec->next_attr_instance++; - return 0; + return attr; } /** @@ -2796,7 +2796,7 @@ static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) // hmm, suc == add - printf ("need %d, have %d\n", need, space); + //printf ("need %d, have %d\n", need, space); if (need > space) { printf ("no room"); return 0; @@ -4481,6 +4481,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) struct ntfs_dir *dir; struct ntfs_dt *dt; int data_len = 0; + ATTR_RECORD *attr; new_num = utils_mft_find_free_entry (vol); if (new_num == (MFT_REF) -1) @@ -4493,6 +4494,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) filename = ptr + 1; } + //printf ("looking for %s\n", dirname); if (utils_pathname_to_inode2 (vol, NULL, dirname, &find) == FALSE) { printf ("!inode\n"); return 0; @@ -4505,25 +4507,6 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) if (uname_len < 0) goto close; - ie = ntfs_ie_create(); - ie = ntfs_ie_set_name (ie, uname, uname_len, FILE_NAME_POSIX); - if (!ie) { - printf ("!ie\n"); - goto close; - } - - // These two NEED the sequence number in the top 8 bits - ie->indexed_file = new_num; // MFT Ref: new file - ie->key.file_name.parent_directory = MK_MREF (find.mref, 2);// MFT Ref: parent dir - - now = utc2ntfs (time(NULL)); - ie->key.file_name.creation_time = now; - ie->key.file_name.last_data_change_time = now; - ie->key.file_name.last_mft_change_time = now; - ie->key.file_name.last_access_time = now; - - //ntfs_ie_dump (ie); - //printf ("new inode %lld\n", new_num); ino = ntfs_inode_open3 (vol, new_num); if (!ino) { @@ -4531,9 +4514,8 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) goto close; } - //printf ("attributes start at offset 0x%02X\n", ino->mrec->attrs_offset); - tmp = (u8*) ino->mrec; + now = utc2ntfs (time(NULL)); // Wipe all the attributes memset (tmp + ino->mrec->attrs_offset, 0, vol->mft_record_size - ino->mrec->attrs_offset); @@ -4550,10 +4532,6 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) utils_mftrec_set_inuse6 (ino, vol->private_bmp1, TRUE); - ie->indexed_file = MK_MREF (new_num, ino->mrec->sequence_number); - - //utils_dump_mem ((u8*)ino->mrec, 0, ino->mrec->bytes_in_use, DM_DEFAULTS); - buffer = malloc (128); if (!buffer) goto close; @@ -4564,18 +4542,15 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) *(u64*)(buffer + 0x08) = now; // Time *(u64*)(buffer + 0x10) = now; // Time *(u64*)(buffer + 0x18) = now; // Time - ntfs_mft_add_attr (ino, AT_STANDARD_INFORMATION, buffer, 0x48); - //utils_dump_mem (buffer, 0, 0x48, DM_DEFAULTS); + attr = ntfs_mft_add_attr (ino, AT_STANDARD_INFORMATION, buffer, 0x48); // Data memset (buffer, 0, 128); data_len = sprintf ((char*)buffer, "Contents of file: %s\n", filename); - ntfs_mft_add_attr (ino, AT_DATA, buffer, data_len); + attr = ntfs_mft_add_attr (ino, AT_DATA, buffer, data_len); // File name memset (buffer, 0, 128); - printf ("parent = 0x%llX\n", find.mref); - printf ("ino mref = %lld\n", ino->mft_no); *(u64*)(buffer + 0x00) = MK_MREF (find.mref, 2); // MFT Ref of parent dir *(u64*)(buffer + 0x08) = now; // Time *(u64*)(buffer + 0x10) = now; // Time @@ -4588,38 +4563,35 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) *(u8* )(buffer + 0x40) = uname_len; // Filename length *(u8* )(buffer + 0x41) = FILE_NAME_POSIX; // Filename namespace memcpy (buffer + 0x42, uname, uname_len * sizeof (ntfschar)); - ntfs_mft_add_attr (ino, AT_FILE_NAME, buffer, ATTR_SIZE (0x42 + (uname_len * sizeof (ntfschar)))); - //utils_dump_mem (buffer, 0, 0x50, DM_DEFAULTS); + attr = ntfs_mft_add_attr (ino, AT_FILE_NAME, buffer, ATTR_SIZE (0x42 + (uname_len * sizeof (ntfschar)))); + attr->resident_flags = RESIDENT_ATTR_IS_INDEXED; + attr->name_offset = 0x18; - //utils_dump_mem ((u8*)ino->mrec, 0, ino->mrec->bytes_in_use, DM_DEFAULTS); + ie = ntfs_ie_create(); + ie = ntfs_ie_set_name (ie, uname, uname_len, FILE_NAME_POSIX); + if (!ie) { + printf ("!ie\n"); + goto close; + } - //printf ("orig inode = %p\n", find.inode); - dir = dt->dir->children[0]; - dt = dir->index; - printf ("dir = %p (%lld)\n", dir, MREF (dir->mft_num)); - printf ("dt = %p (%d)\n", dt, dt->child_count); - printf ("\n"); - - //printf ("\n"); - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - //printf ("\n"); + // These two NEED the sequence number in the top 8 bits + ie->key.file_name.parent_directory = MK_MREF (find.mref, 2);// MFT Ref: parent dir + ie->indexed_file = MK_MREF (new_num, ino->mrec->sequence_number); + ie->key.file_name.creation_time = now; + ie->key.file_name.last_data_change_time = now; + ie->key.file_name.last_mft_change_time = now; + ie->key.file_name.last_access_time = now; ie->key.file_name.allocated_size = ATTR_SIZE (data_len); ie->key.file_name.data_size = data_len; + dir = dt->dir->children[0]; + dt = dir->index; + ntfs_dt_root_add (dt, ie); ino->ref_count++; dt->inodes[0] = ino; - *(((u8*) ino->mrec) + 166) = RESIDENT_ATTR_IS_INDEXED; - *(((u8*) ino->mrec) + 154) = 0x18; // offset to name - - // add inode to dt's list - - //printf ("\n"); - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - //printf ("\n"); - close: free (buffer); ntfs_inode_close2 (ino); From 3c6381db2f85c010f9a392f1a693d78eed99b8a1 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 15 Aug 2005 00:50:19 +0000 Subject: [PATCH 2475/2994] Thoght that FUSE will check if directory is empty, it didn't. Add such check to ntfs_delete. --- libntfs/dir.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libntfs/dir.c b/libntfs/dir.c index fdca85e4..8973a999 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1271,6 +1271,25 @@ int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) ni = ni->base_ni; if (dir_ni->nr_extents == -1) dir_ni = dir_ni->base_ni; + /* If deleting directory check it to be empty. */ + if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) { + ntfs_attr *na; + + na = ntfs_attr_open(ni, AT_INDEX_ROOT, I30, 4); + if (!na) { + ntfs_error(, "Corrupt directory or library bug."); + errno = EIO; + goto err_out; + } + if (na->data_size != sizeof(INDEX_ROOT) + + sizeof(INDEX_ENTRY_HEADER)) { + ntfs_attr_close(na); + ntfs_error(, "Directory is not empty."); + errno = ENOTEMPTY; + goto err_out; + } + ntfs_attr_close(na); + } /* * Search for FILE_NAME attribute with such name. If it's in POSIX or * WIN32_AND_DOS namespace, then simply remove it from index and inode. From a9e02e768700ad3da3d49b70914debed93b72f63 Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 15 Aug 2005 20:48:48 +0000 Subject: [PATCH 2476/2994] Hard link mkfs.ntfs and mkfs.ntfs.8 with mkntfs and mkntfs.8 --- ChangeLog | 1 + TODO.ntfsprogs | 1 - configure.ac | 1 + ntfsprogs.spec.in | 4 ++++ ntfsprogs/Makefile.am | 13 +++++++++++++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b23c5506..6c632cc3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,7 @@ xx/xx/2005 - 1.12.0-WIP ntfs_mft_record_alloc. (Yura) - Make ntfsmount use new APIs for file and directory creation/deletion. Implement utime operation. (Yura) + - Hard link mkfs.ntfs and mkfs.ntfs.8 with mkntfs and mkntfs.8 (Szaka). 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 7f95de06..a802fb36 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -8,7 +8,6 @@ Thanks, * mkntfs * ********** -- mkntfs should be hard linked with mkfs.ntfs for the mkfs utility. - Got a report that creating a floppy with mkntfs failed. Difference between this floppy and the floppy created by the special tool found on the net was said to be that the bitmap is 256kib on the special floppy while mkntfs will diff --git a/configure.ac b/configure.ac index 274fca0e..1d924ee7 100644 --- a/configure.ac +++ b/configure.ac @@ -116,6 +116,7 @@ esac AC_PROG_CC AC_PROG_GCC_TRADITIONAL AC_PROG_INSTALL +AC_PATH_PROG(LN, ln, ln) AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_LIBTOOL diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index 74f8497c..3c95487c 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -90,6 +90,7 @@ rm -rf "$RPM_BUILD_ROOT" %{bindir}/ntfs[^m][^o]* %{sbindir}/* %{mandir}/man8/mkntfs.8* +%{mandir}/man8/mkfs.ntfs.8* %{mandir}/man8/ntfs[^m][^o]*.8* %{_libdir}/libntfs.*so* @@ -111,6 +112,9 @@ rm -rf "$RPM_BUILD_ROOT" %{_libdir}/gnome-vfs-2.0/modules/libntfs-gnomevfs.*a* %changelog +* Mon Aug 15 2005 Szabolcs Szakacsits +- Add mkfs.ntfs. + * Mon Jul 18 2005 Anton Altaparmakov - Add ntfsmount fuse module in separate rpm ntfsprogs-fuse. diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index f73d15a0..1b3b6f74 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -134,3 +134,16 @@ libs: extra: extras extras: libs $(EXTRA_PROGRAMS) + +# mkfs.ntfs[.8] hard links + +install-exec-hook: + $(LN) -f $(DESTDIR)$(sbindir)/mkntfs $(DESTDIR)$(sbindir)/mkfs.ntfs + +install-data-hook: + $(LN) -f $(DESTDIR)$(man8dir)/mkntfs.8 $(DESTDIR)$(man8dir)/mkfs.ntfs.8 + +uninstall-local: + rm -f $(DESTDIR)$(sbindir)/mkfs.ntfs + rm -f $(DESTDIR)$(man8dir)/mkfs.ntfs.8 + From 6d7ca452ff5c2347a97889bb3256a4176b46d662 Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 15 Aug 2005 21:44:10 +0000 Subject: [PATCH 2477/2994] Articulate --bad-sectors a bit better --- ntfsprogs/ntfsresize.8.in | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index faf4a6a1..73ea6d94 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -156,12 +156,19 @@ displays what it would do if it were to resize the filesystem. Continue with the real resizing only if the test run passed. .TP .B -b, --bad-sectors -Support disks having physical errors, bad sectors. Make a backup by -.BR ntfsclone (8) -using option --rescue, then run from the command line 'chkdsk /f /r -volume:' on Windows prior using this option. +Support disks having hardware errors, bad sectors with those +.B ntfsresize +would refuse to work by default. -If the guarantee is still valid for the disk then replace it. It's defected. +Prior using this option, it's strongly recommended to make a backup by +.BR ntfsclone (8) +using the --rescue option, then running 'chkdsk /f /r volume:' on Windows +from the command line. If the disk guarantee is still valid then replace it. +It's defected. Please also note, that no software can repair these type of +hardware errors. The most what they can do is to work around the permanent +defects. + +This option doesn't have any effect if the disk is flawless. .TP .B -P, --no-progress-bar Don't show progress bars. From b312a444839b02299d8e5e4285c145dab6350a98 Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 16 Aug 2005 13:25:15 +0000 Subject: [PATCH 2478/2994] change utils_dump_mem to take a void ptr update the comments a bit --- ntfsprogs/ntfsrm.c | 28 ++++++++++++++-------------- ntfsprogs/utils.c | 15 ++++++++++----- ntfsprogs/utils.h | 2 +- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 3d007333..f133bdc7 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -802,7 +802,7 @@ static void ntfs_ie_dump (INDEX_ENTRY *ie) printf ("________________________________________________"); printf ("\n"); - utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); + utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); printf ("MFT Ref: 0x%llx\n", ie->indexed_file); printf ("length: %d\n", ie->length); @@ -1429,7 +1429,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par printf ("IE (%d)\n", ie->length); else printf ("IE %lld (%d)\n", MREF (ie->key.file_name.parent_directory), ie->length); - utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); + utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); } #endif @@ -1460,7 +1460,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par printf ("IE (%d)\n", ie->length); else printf ("IE %lld (%d)\n", MREF (ie->key.file_name.parent_directory), ie->length); - utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); + utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); } #endif @@ -2174,9 +2174,9 @@ static int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_T // inode->mrec mft = inode->mrec; - //utils_dump_mem ((u8*)mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); + //utils_dump_mem (mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); - //utils_dump_mem ((u8*)attrXX, 0, attrXX->length, DM_DEFAULTS); printf ("\n"); + //utils_dump_mem (attrXX, 0, attrXX->length, DM_DEFAULTS); printf ("\n"); //printf ("mrec = %p, attr = %p, diff = %d (0x%02X)\n", mft, attrXX, (u8*)attrXX - (u8*)mft, (u8*)attrXX - (u8*)mft); // memmove @@ -2196,7 +2196,7 @@ static int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_T #endif memmove (dst, src, len); - //utils_dump_mem ((u8*)mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); + //utils_dump_mem (mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); NInoSetDirty(inode); return 0; @@ -2353,7 +2353,7 @@ static int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfscha memset ((u8*)mrec + mrec->bytes_in_use, 0, mft_size - mrec->bytes_in_use); mft_usage += (attr_new - attr_orig); - //utils_dump_mem ((u8*) mrec, 0, mft_size, DM_DEFAULTS); + //utils_dump_mem (mrec, 0, mft_size, DM_DEFAULTS); res = 0; done: ntfs_attr_put_search_ctx (ctx); @@ -3346,7 +3346,7 @@ static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) } //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); - //utils_dump_mem ((u8*)ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); + //utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); ntfs_dt_root_replace (dir->index, 0, dir->index->children[0], ie); //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); //printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); @@ -4159,7 +4159,7 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) //ntfs_dt_print (top, 0); del_ie = del->children[del_num]; - //utils_dump_mem ((u8*)del_ie, 0, del_ie->length, DM_DEFAULTS); + //utils_dump_mem (del_ie, 0, del_ie->length, DM_DEFAULTS); //printf ("\n"); /* @@ -4186,11 +4186,11 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) //printf ("\n"); suc_ie = ntfs_ie_copy (suc->children[suc_num]); - //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); + //utils_dump_mem (suc_ie, 0, suc_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); //printf ("\n"); suc_ie = ntfs_ie_set_vcn (suc_ie, vcn); - //utils_dump_mem ((u8*)suc_ie, 0, suc_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); + //utils_dump_mem (suc_ie, 0, suc_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); //printf ("\n"); file = &del_ie->key.file_name; printf ("\trep name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); @@ -4303,11 +4303,11 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) par_ie = par->children[par_num]; vcn = ntfs_ie_get_vcn (par_ie); //printf ("\toffset = %d\n", (u8*)par_ie - par->data); printf ("\tflags = %d\n", par_ie->flags); printf ("\tvcn = %lld\n", vcn); printf ("\tlength = %d\n", par_ie->length); - //utils_dump_mem ((u8*)par_ie, 0, par_ie->length, DM_DEFAULTS); + //utils_dump_mem (par_ie, 0, par_ie->length, DM_DEFAULTS); //printf ("\n"); //printf ("\toffset = %d\n", (u8*)par_ie - par->data); printf ("\tflags = %d\n", par_ie->flags); printf ("\tvcn = %lld\n", vcn); printf ("\tlength = %d\n", par_ie->length); - //utils_dump_mem ((u8*)par_ie, 0, par_ie->length, DM_DEFAULTS); + //utils_dump_mem (par_ie, 0, par_ie->length, DM_DEFAULTS); //printf ("\n"); file = &par->children[par_num] ->key.file_name; printf ("\tpar name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); @@ -4348,7 +4348,7 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) goto done; //printf ("\n"); - //utils_dump_mem ((u8*)add_ie, 0, add_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); + //utils_dump_mem (add_ie, 0, add_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); ded = par->sub_nodes[par_num]; par->sub_nodes[par_num] = NULL; diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 4eb4c82f..43db5fab 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -746,14 +746,19 @@ int utils_is_metadata (ntfs_inode *inode) * @buf: Buffer to be displayed * @start: Offset into @buf to start from * @length: Number of bytes to display - * @ascii: Whether or not to display the ascii values + * @flags: Options to change the style of the output * * Display a block of memory in a tradition hex-dump manner. * Optionally the ascii part can be turned off. + * + * The flags, described fully in utils.h, default to 0 (DM_DEFAULTS). + * Examples are: DM_INDENT (indent the output by one tab); DM_RED (colour the + * output); DM_NO_ASCII (only print the hex values). */ -void utils_dump_mem (u8 *buf, int start, int length, int flags) +void utils_dump_mem (void *buf, int start, int length, int flags) { int off, i, s, e, col; + u8 *mem = buf; s = start & ~15; // round down e = (start + length + 15) & ~15; // round up @@ -781,7 +786,7 @@ void utils_dump_mem (u8 *buf, int start, int length, int flags) if ((i == 8) && (!(flags & DM_NO_DIVIDER))) printf (" -"); if (((off+i) >= start) && ((off+i) < (start+length))) - printf (" %02X", buf[off+i]); + printf (" %02X", mem[off+i]); else printf (" "); } @@ -790,8 +795,8 @@ void utils_dump_mem (u8 *buf, int start, int length, int flags) for (i = 0; i < 16; i++) { if (((off+i) < start) || ((off+i) >= (start+length))) printf (" "); - else if (isprint (buf[off + i])) - printf ("%c", buf[off + i]); + else if (isprint (mem[off + i])) + printf ("%c", mem[off + i]); else printf ("."); } diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 45c60945..76ca7dce 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -92,7 +92,7 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int int utils_cluster_in_use (ntfs_volume *vol, long long lcn); int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref); int utils_is_metadata (ntfs_inode *inode); -void utils_dump_mem (u8 *buf, int start, int length, int ascii); +void utils_dump_mem (void *buf, int start, int length, int ascii); ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft); From 49a4f377f3ec9cf5b4f1a8543c3eec6e8a045689 Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 16 Aug 2005 13:33:12 +0000 Subject: [PATCH 2479/2994] fix up dt root add --- ntfsprogs/ntfsrm.c | 74 +++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index f133bdc7..01b3188a 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1218,6 +1218,7 @@ static int ntfs_dt_commit (struct ntfs_dt *dt) for (i = 0; i < dt->child_count; i++) { if ((dt->inodes[i]) && (NInoDirty (dt->inodes[i]))) { + //utils_dump_mem (dt->inodes[i]->mrec, 0, vol->mft_record_size, DM_DEFAULTS); #ifdef RM_WRITE ntfs_inode_sync (dt->inodes[i]); #endif @@ -2774,58 +2775,58 @@ static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) int suc_num; int need; int space; - u8 *attr; u8 *src; u8 *dst; int len; + u8 *new_data = NULL; + int i; if (!add || !add_ie) - return 0; - - //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); - //printf ("\n"); + return -1; need = add_ie->length; space = ntfs_mft_free_space (add->dir); + printf ("need %d, have %d\n", need, space); + if (need > space) { + printf ("no room"); + return -1; + } + + new_data = realloc (add->data, add->data_len + need); + if (!new_data) { + return -1; + } + + memset (new_data + add->data_len, 0, need); + + for (i = 0; i < add->child_count; i++) + add->children[i] = (INDEX_ENTRY*) ((long)add->children[i] + (long)new_data - (long)add->data); // rebase the children + + add->data = new_data; + new_data = NULL; + file = &add_ie->key.file_name; suc = ntfs_dt_find3 (add, file->file_name, file->file_name_length, &suc_num); if (!suc) - return 0; + return -1; - // hmm, suc == add + // hmm, suc == add (i.e. entry already exists) - //printf ("need %d, have %d\n", need, space); - if (need > space) { - printf ("no room"); - return 0; - } + src = (u8*) suc->children[suc_num]; + dst = src + need; + len = ((add->data + add->data_len) - src); - attr = malloc (add->data_len + need); + memmove (dst, src, len); - src = add->data; - dst = attr; - len = add->header->entries_offset + 16; - - memcpy (dst, src, len); - - dst += len; + dst = src; src = (u8*) add_ie; len = add_ie->length; memcpy (dst, src, len); - dst += len; - src = (u8*) suc->children[suc_num]; - len = add->data + add->data_len - src; - - memcpy (dst, src, len); - - free (add->data); - add->data = attr; add->data_len += need; - add->header = (INDEX_HEADER*) (add->data + 0x10); add->header->index_length = add->data_len - 16; add->header->allocated_size = add->data_len - 16; @@ -2838,7 +2839,7 @@ static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) add->changed = TRUE; printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, add->dir->inode->mft_no); - return 0; + return suc_num; } /** @@ -4480,6 +4481,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) s64 now = 0; struct ntfs_dir *dir; struct ntfs_dt *dt; + int dt_index = 0; int data_len = 0; ATTR_RECORD *attr; @@ -4494,7 +4496,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) filename = ptr + 1; } - //printf ("looking for %s\n", dirname); + printf ("looking for %s\n", dirname); if (utils_pathname_to_inode2 (vol, NULL, dirname, &find) == FALSE) { printf ("!inode\n"); return 0; @@ -4507,7 +4509,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) if (uname_len < 0) goto close; - //printf ("new inode %lld\n", new_num); + printf ("new inode %lld\n", new_num); ino = ntfs_inode_open3 (vol, new_num); if (!ino) { printf ("!ino\n"); @@ -4542,6 +4544,10 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) *(u64*)(buffer + 0x08) = now; // Time *(u64*)(buffer + 0x10) = now; // Time *(u64*)(buffer + 0x18) = now; // Time + ino->creation_time = time (NULL); + ino->last_data_change_time = time (NULL); + ino->last_mft_change_time = time (NULL); + ino->last_access_time = time (NULL); attr = ntfs_mft_add_attr (ino, AT_STANDARD_INFORMATION, buffer, 0x48); // Data @@ -4588,9 +4594,9 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) dir = dt->dir->children[0]; dt = dir->index; - ntfs_dt_root_add (dt, ie); + dt_index = ntfs_dt_root_add (dt, ie); + dt->inodes[dt_index] = ino; ino->ref_count++; - dt->inodes[0] = ino; close: free (buffer); From db1e9afb1fe76178c325ea4a92dd5afb41dc69ae Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 17 Aug 2005 14:33:16 +0000 Subject: [PATCH 2480/2994] create an index alloc (needs work) --- ntfsprogs/ntfsrm.c | 218 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 190 insertions(+), 28 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 01b3188a..041f9228 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -43,7 +43,7 @@ GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) -//#define RM_WRITE 1 +#define RM_WRITE 1 /** * version - Print version information about the program @@ -426,6 +426,46 @@ static int ntfs_inode_close2 (ntfs_inode *ni) return ntfs_inode_close (ni); } +/** + * utils_index_init + */ +static int utils_index_init (ntfs_volume *vol, u8 *buffer, int size) +{ + INDEX_ALLOCATION *alloc; + INDEX_ENTRY_HEADER *header; + + if (!vol) + return 1; + if (!buffer) + return 1; + if (size < 512) + return 1; + + memset (buffer, 0, size); + + alloc = (INDEX_ALLOCATION*) buffer; + + alloc->magic = magic_INDX; + alloc->usa_ofs = 0x28; + alloc->usa_count = (size >> vol->sector_size_bits) + 1; + alloc->lsn = 0; + alloc->index_block_vcn = 0; + + alloc->index.entries_offset = 0x40; + alloc->index.index_length = 0x10; + alloc->index.allocated_size = size - 0x18; + alloc->index.flags = 0; + + header = (INDEX_ENTRY_HEADER*) (buffer + 0x40); + + header->indexed_file = 0; + header->length = 0x10; + header->key_length = 0; + header->flags = INDEX_ENTRY_END; + + return 0; +} + /** * ntfs_bmp_rollback @@ -778,6 +818,26 @@ static s64 ntfs_bmp_find_last_set (struct ntfs_bmp *bmp) return -1; } +/** + * ntfs_bmp_find_space + */ +static int ntfs_bmp_find_space (struct ntfs_bmp *bmp, LCN start, long size) +{ + if (!bmp) + return 0; + + start = 0; + size = 0; + + /* + bmp find space - uncached bmp's + $Bitmap/$DATA free space on volume + dir/$BITMAP free index record + $MFT/$BITMAP free record in mft + */ + return 0; +} + /** * ntfs_ie_get_vcn @@ -1252,9 +1312,9 @@ static BOOL ntfs_dt_alloc_children2 (struct ntfs_dt *dt, int count) if (!dt->children || !dt->sub_nodes || !dt->inodes) return FALSE; // dt->child_count = -1 ? - memset ((u8*)dt->children + old, 0, (new - old) * sizeof (*dt->children)); - memset ((u8*)dt->sub_nodes + old, 0, (new - old) * sizeof (*dt->sub_nodes)); - memset ((u8*)dt->inodes + old, 0, (new - old) * sizeof (*dt->inodes)); + memset ((u8*)dt->children + old, 0, (new - old) * sizeof (*dt->children)); + memset ((u8*)dt->sub_nodes + old, 0, (new - old) * sizeof (*dt->sub_nodes)); + memset ((u8*)dt->inodes + old, 0, (new - old) * sizeof (*dt->inodes)); return (dt->children && dt->sub_nodes && dt->inodes); } @@ -1411,8 +1471,14 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par dt->data_len = dt->dir->index_size; //printf ("parent size = %d\n", dt->data_len); dt->data = malloc (dt->data_len); - //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data)); - ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data); + + if (vcn >= 0) { + //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data)); + ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data); + } else { + utils_index_init (dir->vol, dt->data, dt->data_len); + } + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); //printf ("\n"); @@ -2104,7 +2170,6 @@ static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) return 0; } - /** * utils_mftrec_mark_free6 */ @@ -2122,19 +2187,10 @@ static int utils_mftrec_set_inuse6 (ntfs_inode *inode, struct ntfs_bmp *bmp, BOO // XXX extent inodes? - if (inuse) { - if ((rec->flags & MFT_RECORD_IN_USE) == 1) { - Eprintf ("MFT record is already in use.\n"); - return -1; - } + if (inuse) rec->flags |= MFT_RECORD_IN_USE; - } else { - if ((rec->flags & MFT_RECORD_IN_USE) == 0) { - Eprintf ("MFT record isn't in use.\n"); - return -1; - } + else rec->flags &= ~MFT_RECORD_IN_USE; - } // XXX inc sequence number @@ -2227,6 +2283,11 @@ static ATTR_RECORD * ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 * if (!mrec) return NULL; + if ((mrec->bytes_in_use + attr_size + 0x18) > mrec->bytes_allocated) { + printf ("attribute is too big to fit in the record\n"); + return NULL; + } + ptr = (u8*) inode->mrec + mrec->attrs_offset; while (1) { attr = (ATTR_RECORD*) ptr; @@ -2379,6 +2440,91 @@ static int ntfs_mft_free_space (struct ntfs_dir *dir) return res; } +/** + * ntfs_mft_add_index + */ +static int ntfs_mft_add_index (struct ntfs_dir *dir) +{ + ntfs_volume *vol; + u8 *buffer = NULL; + ATTR_RECORD *attr = NULL; + struct ntfs_dt *dt = NULL; + INDEX_ENTRY *ie = NULL; + + if (!dir) + return 1; + if (dir->bitmap && dir->ialloc) + return 0; + if (dir->bitmap || dir->ialloc) + return 1; + if (dir->index_size < 512) + return 1; + + vol = dir->vol; + printf ("add two attrs to " YELLOW); ntfs_name_print (dir->name, dir->name_len); printf (END "\n"); + printf ("index size = %d\n", dir->index_size); + + buffer = malloc (dir->index_size); + if (!buffer) + return 1; + + dt = ntfs_dt_alloc (dir, dir->index, -1); + if (!dt) + return 1; + + dt->vcn = 0; // New alloc record + + ie = ntfs_ie_copy (dir->index->children[dir->index->child_count-1]); + ie = ntfs_ie_set_vcn (ie, dt->vcn); + + // can't replace ie yet, there may not be room + free (ie); + + //ntfs_dt_transfer (dir->index, dt, 0, 7); + + printf ("root has %d children\n", dir->index->child_count); + printf ("node has %d children\n", dt->child_count); + + ntfs_dt_free (dt); + //utils_index_init (vol, buffer, dir->index_size); + + // create a new dt + // attach dt to dir + // move entries into alloc + // shrink root + + // transfer keys to new node + // hook up root & alloc dts + + // need disk allocation before here + + // Index Allocation + memset (buffer, 0, 128); + attr = ntfs_mft_add_attr (dir->inode, AT_INDEX_ALLOCATION, buffer, 0x48); + + // Bitmap + memset (buffer, 0, 8); + buffer[0] = 0x01; + //printf ("inode = %p\n", dir->inode); + attr = ntfs_mft_add_attr (dir->inode, AT_BITMAP, buffer, 8); + + // attach alloc and bitmap to dir + // need to create ntfs_attr's for them + + // one indx record + // 8 bits of bitmap + + if (0) ntfs_bmp_find_space (NULL, 0, 0); + + //printf ("m1 = %lld\n", vol->mft_zone_start); + //printf ("m2 = %lld\n", vol->mft_zone_end); + //printf ("m3 = %lld\n", vol->mft_zone_pos); + //printf ("z1 = %lld\n", vol->data1_zone_pos); + //printf ("z2 = %lld\n", vol->data2_zone_pos); + + free (buffer); + return 0; +} /** * ntfs_dt_root_replace @@ -2789,7 +2935,7 @@ static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) printf ("need %d, have %d\n", need, space); if (need > space) { - printf ("no room"); + printf ("no room\n"); return -1; } @@ -2802,7 +2948,7 @@ static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) for (i = 0; i < add->child_count; i++) add->children[i] = (INDEX_ENTRY*) ((long)add->children[i] + (long)new_data - (long)add->data); // rebase the children - + add->data = new_data; new_data = NULL; @@ -3106,8 +3252,8 @@ static int ntfs_dt_add2 (INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, stru int median; struct ntfs_dt *new = NULL; struct ntfs_dt *chl; - INDEX_ENTRY *med_ie; - FILE_NAME_ATTR *file; + INDEX_ENTRY *med_ie = NULL; + //FILE_NAME_ATTR *file; VCN vcn = 0; //int i; @@ -3165,6 +3311,7 @@ ascend: ded = ded->sub_nodes[0]; printf ("\treusing vcn %lld\n", new->vcn); } else { + ntfs_mft_add_index (suc->dir); /* * ALLOC * any unused records? @@ -3190,7 +3337,7 @@ ascend: */ } - printf ("\tnode has %d children\n", suc->child_count); + //printf ("\tnode has %d children\n", suc->child_count); // initialise new node ntfs_dt_initialise (new, vcn); @@ -3198,7 +3345,10 @@ ascend: // find median key median = (suc->child_count+1) / 2; med_ie = ntfs_ie_copy (suc->children[median]); - file = &med_ie->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + //file = &med_ie->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + + free (med_ie); + med_ie = NULL; //printf ("suc key count = %d\n", suc->child_count); //printf ("new key count = %d\n", new->child_count); @@ -3545,11 +3695,12 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) // This may not exist dir->bitmap = ntfs_bmp_alloc (inode, AT_BITMAP, I30, 4); - if (dir->ialloc) { + if (dir->iroot) { rec = find_first_attribute (AT_INDEX_ROOT, inode->mrec); ir = (INDEX_ROOT*) ((u8*)rec + rec->value_offset); dir->index_size = ir->index_block_size; } else { + // XXX !iroot? dir->index_size = 0; } @@ -4481,9 +4632,11 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) s64 now = 0; struct ntfs_dir *dir; struct ntfs_dt *dt; - int dt_index = 0; + //int dt_index = 0; int data_len = 0; ATTR_RECORD *attr; + struct ntfs_dt *suc = NULL; + int suc_num = 0; new_num = utils_mft_find_free_entry (vol); if (new_num == (MFT_REF) -1) @@ -4531,6 +4684,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) ino->mrec->link_count = 1; ino->mrec->base_mft_record = 0; ino->mrec->next_attr_instance = 0; + ino->mrec->flags = MFT_RECORD_IN_USE; utils_mftrec_set_inuse6 (ino, vol->private_bmp1, TRUE); @@ -4594,9 +4748,17 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) dir = dt->dir->children[0]; dt = dir->index; + suc = ntfs_dt_find3 (dt, uname, uname_len, &suc_num); + + ntfs_dt_add2 (ie, suc, suc_num, NULL); + + /* dt_index = ntfs_dt_root_add (dt, ie); - dt->inodes[dt_index] = ino; - ino->ref_count++; + if (dt_index >= 0) { + dt->inodes[dt_index] = ino; + ino->ref_count++; + } + */ close: free (buffer); From 96e1f45319307552236db1390f662561fcdb9e9e Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 17 Aug 2005 14:53:07 +0000 Subject: [PATCH 2481/2994] housekeeping - no code changes --- ntfsprogs/ntfsrm.c | 294 ++++++++++++--------------------------------- 1 file changed, 78 insertions(+), 216 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 041f9228..fc979c28 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -559,9 +559,9 @@ static void ntfs_bmp_free (struct ntfs_bmp *bmp) } /** - * ntfs_bmp_alloc + * ntfs_bmp_create */ -static struct ntfs_bmp * ntfs_bmp_alloc (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len) +static struct ntfs_bmp * ntfs_bmp_create (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len) { struct ntfs_bmp *bmp; ntfs_attr *attr; @@ -839,6 +839,14 @@ static int ntfs_bmp_find_space (struct ntfs_bmp *bmp, LCN start, long size) } +/** + * ntfs_ie_free + */ +static void ntfs_ie_free (INDEX_ENTRY *ie) +{ + free (ie); +} + /** * ntfs_ie_get_vcn */ @@ -1159,8 +1167,8 @@ static int ntfs_ie_test (void) ntfs_ie_dump (ie1); free (name); - free (ie1); - free (ie2); + ntfs_ie_free (ie1); + ntfs_ie_free (ie2); return 0; } @@ -1293,9 +1301,9 @@ static int ntfs_dt_commit (struct ntfs_dt *dt) } /** - * ntfs_dt_alloc_children2 + * ntfs_dt_create_children2 */ -static BOOL ntfs_dt_alloc_children2 (struct ntfs_dt *dt, int count) +static BOOL ntfs_dt_create_children2 (struct ntfs_dt *dt, int count) { // XXX calculate for 2K and 4K indexes max and min filenames (inc/exc VCN) @@ -1320,9 +1328,9 @@ static BOOL ntfs_dt_alloc_children2 (struct ntfs_dt *dt, int count) } /** - * ntfs_dt_count_root + * ntfs_dt_root_count */ -static int ntfs_dt_count_root (struct ntfs_dt *dt) +static int ntfs_dt_root_count (struct ntfs_dt *dt) { u8 *buffer = NULL; u8 *ptr = NULL; @@ -1355,7 +1363,7 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt) entry = (INDEX_ENTRY*) ptr; dt->child_count++; - ntfs_dt_alloc_children2 (dt, dt->child_count); // XXX retval + ntfs_dt_create_children2 (dt, dt->child_count); // XXX retval if (entry->flags & INDEX_ENTRY_NODE) { vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); @@ -1381,9 +1389,9 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt) } /** - * ntfs_dt_count_alloc + * ntfs_dt_alloc_count */ -static int ntfs_dt_count_alloc (struct ntfs_dt *dt) +static int ntfs_dt_alloc_count (struct ntfs_dt *dt) { u8 *buffer = NULL; u8 *ptr = NULL; @@ -1413,7 +1421,7 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) entry = (INDEX_ENTRY*) ptr; dt->child_count++; - ntfs_dt_alloc_children2 (dt, dt->child_count); // XXX retval + ntfs_dt_create_children2 (dt, dt->child_count); // XXX retval if (entry->flags & INDEX_ENTRY_NODE) { vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); @@ -1439,9 +1447,9 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt) } /** - * ntfs_dt_alloc + * ntfs_dt_create */ -static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn) +static struct ntfs_dt * ntfs_dt_create (struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn) { struct ntfs_dt *dt = NULL; //int i; @@ -1482,7 +1490,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); //printf ("\n"); - ntfs_dt_count_alloc (dt); + ntfs_dt_alloc_count (dt); dt->header = &((INDEX_BLOCK*)dt->data)->index; //printf ("USA = %d\n", ((INDEX_BLOCK*)dt->data)->usa_count); @@ -1512,7 +1520,7 @@ static struct ntfs_dt * ntfs_dt_alloc (struct ntfs_dir *dir, struct ntfs_dt *par //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); //printf ("\n"); - ntfs_dt_count_root (dt); + ntfs_dt_root_count (dt); dt->header = &((INDEX_ROOT*)dt->data)->index; //dt->data_len = ((INDEX_ROOT*)dt->data)->index_block_size; @@ -1596,7 +1604,7 @@ static MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) if (!dt->sub_nodes[i]) { vcn = ntfs_ie_get_vcn (ie); //printf ("vcn = %lld\n", vcn); - sub = ntfs_dt_alloc (dt->dir, dt, vcn); + sub = ntfs_dt_create (dt->dir, dt, vcn); dt->sub_nodes[i] = sub; } res = ntfs_dt_find (dt->sub_nodes[i], name, name_len); @@ -1672,7 +1680,7 @@ static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int n if (!dt->sub_nodes[i]) { vcn = ntfs_ie_get_vcn (ie); //printf ("vcn = %lld\n", vcn); - dt->sub_nodes[i] = ntfs_dt_alloc (dt->dir, dt, vcn); + dt->sub_nodes[i] = ntfs_dt_create (dt->dir, dt, vcn); } res = ntfs_dt_find2 (dt->sub_nodes[i], name, name_len, index_num); } else { @@ -1792,7 +1800,7 @@ static struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int n if (!dt->sub_nodes[i]) { vcn = ntfs_ie_get_vcn (ie); //printf ("vcn = %lld\n", vcn); - sub = ntfs_dt_alloc (dt->dir, dt, vcn); + sub = ntfs_dt_create (dt->dir, dt, vcn); dt->sub_nodes[i] = sub; } res = ntfs_dt_find4 (dt->sub_nodes[i], name, name_len, index_num); @@ -1831,7 +1839,7 @@ static void ntfs_dt_find_all (struct ntfs_dt *dt) if (ie->flags & INDEX_ENTRY_NODE) { if (!dt->sub_nodes[i]) { vcn = ntfs_ie_get_vcn (ie); - dt->sub_nodes[i] = ntfs_dt_alloc (dt->dir, dt, vcn); + dt->sub_nodes[i] = ntfs_dt_create (dt->dir, dt, vcn); } ntfs_dt_find_all (dt->sub_nodes[i]); } @@ -1861,9 +1869,9 @@ static int ntfs_dt_find_parent (struct ntfs_dt *dt) } /** - * ntfs_dt_root + * ntfs_dt_isroot */ -static BOOL ntfs_dt_root (struct ntfs_dt *dt) +static BOOL ntfs_dt_isroot (struct ntfs_dt *dt) { if (!dt) return FALSE; @@ -1871,9 +1879,9 @@ static BOOL ntfs_dt_root (struct ntfs_dt *dt) } /** - * ntfs_dt_freespace_root + * ntfs_dt_root_freespace */ -static int ntfs_dt_freespace_root (struct ntfs_dt *dt) +static int ntfs_dt_root_freespace (struct ntfs_dt *dt) { int recsize; int inuse; @@ -1891,9 +1899,9 @@ static int ntfs_dt_freespace_root (struct ntfs_dt *dt) } /** - * ntfs_dt_freespace_alloc + * ntfs_dt_alloc_freespace */ -static int ntfs_dt_freespace_alloc (struct ntfs_dt *dt) +static int ntfs_dt_alloc_freespace (struct ntfs_dt *dt) { int recsize; int inuse; @@ -1930,7 +1938,7 @@ static int ntfs_dt_initialise (struct ntfs_dt *dt, VCN vcn) dt->children = NULL; dt->sub_nodes = NULL; - if (!ntfs_dt_alloc_children2 (dt, 1)) + if (!ntfs_dt_create_children2 (dt, 1)) return -1; block = (INDEX_BLOCK*) dt->data; @@ -1989,10 +1997,10 @@ static int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start //file = &mov_ie->key.file_name; printf ("\ttrn name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); } - if (ntfs_dt_root (new)) - space = ntfs_dt_freespace_root (new); + if (ntfs_dt_isroot (new)) + space = ntfs_dt_root_freespace (new); else - space = ntfs_dt_freespace_alloc (new); + space = ntfs_dt_alloc_freespace (new); // XXX if this is an index root, it'll go badly wrong // restrict to allocs only? @@ -2057,7 +2065,7 @@ static int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start memset (dst, 0, len); new->child_count += count; - if (!ntfs_dt_alloc_children2 (new, new->child_count)) + if (!ntfs_dt_create_children2 (new, new->child_count)) return -1; src = (u8*) &old->sub_nodes[start+count-1]; @@ -2073,7 +2081,7 @@ static int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start memmove (dst, src, len); old->child_count -= count; - if (!ntfs_dt_alloc_children2 (old, old->child_count)) + if (!ntfs_dt_create_children2 (old, old->child_count)) return -1; src = (u8*) new->children[0]; @@ -2468,7 +2476,7 @@ static int ntfs_mft_add_index (struct ntfs_dir *dir) if (!buffer) return 1; - dt = ntfs_dt_alloc (dir, dir->index, -1); + dt = ntfs_dt_create (dir, dir->index, -1); if (!dt) return 1; @@ -2478,7 +2486,7 @@ static int ntfs_mft_add_index (struct ntfs_dir *dir) ie = ntfs_ie_set_vcn (ie, dt->vcn); // can't replace ie yet, there may not be room - free (ie); + ntfs_ie_free (ie); //ntfs_dt_transfer (dir->index, dt, 0, 7); @@ -2526,6 +2534,7 @@ static int ntfs_mft_add_index (struct ntfs_dir *dir) return 0; } + /** * ntfs_dt_root_replace */ @@ -2759,7 +2768,7 @@ static BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) for (i = del_num; i < del->child_count; i++) del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_len); - if (!ntfs_dt_alloc_children2 (del, del->child_count)) + if (!ntfs_dt_create_children2 (del, del->child_count)) return FALSE; #if 0 @@ -2874,7 +2883,7 @@ static BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) for (i = del_num; i < del->child_count; i++) del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_ie->length); - if (!ntfs_dt_alloc_children2 (del, del->child_count)) + if (!ntfs_dt_create_children2 (del, del->child_count)) return FALSE; //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); @@ -2911,155 +2920,10 @@ static BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) return TRUE; } -/** - * ntfs_dt_root_add - */ -static int ntfs_dt_root_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) -{ - FILE_NAME_ATTR *file; - struct ntfs_dt *suc; - int suc_num; - int need; - int space; - u8 *src; - u8 *dst; - int len; - u8 *new_data = NULL; - int i; - - if (!add || !add_ie) - return -1; - - need = add_ie->length; - space = ntfs_mft_free_space (add->dir); - - printf ("need %d, have %d\n", need, space); - if (need > space) { - printf ("no room\n"); - return -1; - } - - new_data = realloc (add->data, add->data_len + need); - if (!new_data) { - return -1; - } - - memset (new_data + add->data_len, 0, need); - - for (i = 0; i < add->child_count; i++) - add->children[i] = (INDEX_ENTRY*) ((long)add->children[i] + (long)new_data - (long)add->data); // rebase the children - - add->data = new_data; - new_data = NULL; - - file = &add_ie->key.file_name; - - suc = ntfs_dt_find3 (add, file->file_name, file->file_name_length, &suc_num); - if (!suc) - return -1; - - // hmm, suc == add (i.e. entry already exists) - - src = (u8*) suc->children[suc_num]; - dst = src + need; - len = ((add->data + add->data_len) - src); - - memmove (dst, src, len); - - dst = src; - src = (u8*) add_ie; - len = add_ie->length; - - memcpy (dst, src, len); - - add->data_len += need; - add->header = (INDEX_HEADER*) (add->data + 0x10); - add->header->index_length = add->data_len - 16; - add->header->allocated_size = add->data_len - 16; - - ntfs_mft_resize_resident (add->dir->inode, AT_INDEX_ROOT, I30, 4, add->data, add->data_len); - - //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); - //printf ("\n"); - - add->changed = TRUE; - - printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, add->dir->inode->mft_no); - return suc_num; -} - /** * ntfs_dt_alloc_add */ -static int ntfs_dt_alloc_add (struct ntfs_dt *add, INDEX_ENTRY *add_ie) -{ - FILE_NAME_ATTR *file; - struct ntfs_dt *suc_dt; - int suc_num; - int need; - int space; - u8 *src; - u8 *dst; - int len; - - if (!add || !add_ie) - return 0; - - need = add_ie->length; - space = add->data_len - add->header->index_length - 24; - - file = &add_ie->key.file_name; - - suc_dt = ntfs_dt_find3 (add, file->file_name, file->file_name_length, &suc_num); - if (!suc_dt) - return 0; - - // hmm, suc_dt == add - - printf ("need %d, have %d\n", need, space); - if (need > space) { - printf ("no room"); - return 0; - } - - //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); - //printf ("\n"); - - src = (u8*) suc_dt->children[suc_num]; - dst = src + need; - len = add->data + add->data_len - src - space; - //printf ("src = %d\n", src - add->data); - //printf ("dst = %d\n", dst - add->data); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - dst = src; - src = (u8*) add_ie; - len = need; - - memcpy (dst, src, len); - - add->header->index_length += len; - - dst = add->data + add->header->index_length + 24; - len = add->data_len - add->header->index_length - 24; - - memset (dst, 0, len); - - //utils_dump_mem (add->data, 0, add->data_len, DM_DEFAULTS); - //printf ("\n"); - - add->changed = TRUE; - - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, add->dir->inode->mft_no, add->vcn, add->vcn + (add->dir->index_size>>9) - 1); - return 0; -} - -/** - * ntfs_dt_add_alloc - */ -static int ntfs_dt_add_alloc (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) +static int ntfs_dt_alloc_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) { INDEX_BLOCK *block; INDEX_ENTRY *entry; @@ -3109,7 +2973,7 @@ static int ntfs_dt_add_alloc (struct ntfs_dt *parent, int index_num, INDEX_ENTRY memset (dst, 0, len); //realloc children, sub_nodes - ntfs_dt_alloc_children2 (parent, parent->child_count + 1); + ntfs_dt_create_children2 (parent, parent->child_count + 1); // regen children pointers parent->child_count = 0; @@ -3145,9 +3009,9 @@ static int ntfs_dt_add_alloc (struct ntfs_dt *parent, int index_num, INDEX_ENTRY } /** - * ntfs_dt_add_root + * ntfs_dt_root_add */ -static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) +static int ntfs_dt_root_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) { INDEX_ROOT *root; INDEX_ENTRY *entry; @@ -3209,7 +3073,7 @@ static int ntfs_dt_add_root (struct ntfs_dt *parent, int index_num, INDEX_ENTRY ntfs_mft_resize_resident (parent->dir->inode, AT_INDEX_ROOT, I30, 4, parent->data, parent->data_len); //realloc children, sub_nodes - ntfs_dt_alloc_children2 (parent, parent->child_count + 1); + ntfs_dt_create_children2 (parent, parent->child_count + 1); // regen children pointers parent->child_count = 0; @@ -3283,19 +3147,19 @@ ascend: */ need = ie->length; - if (ntfs_dt_root (suc)) - space = ntfs_dt_freespace_root (suc); + if (ntfs_dt_isroot (suc)) + space = ntfs_dt_root_freespace (suc); else - space = ntfs_dt_freespace_alloc (suc); + space = ntfs_dt_alloc_freespace (suc); printf ("\tneed %d\n", need); printf ("\tspace %d\n", space); if (space >= need) { - if (ntfs_dt_root (suc)) - ntfs_dt_add_root (suc, suc_num, ie, chl); + if (ntfs_dt_isroot (suc)) + ntfs_dt_root_add (suc, suc_num, ie, chl); else - ntfs_dt_add_alloc (suc, suc_num, ie, chl); + ntfs_dt_alloc_add (suc, suc_num, ie, chl); goto done; } @@ -3347,7 +3211,7 @@ ascend: med_ie = ntfs_ie_copy (suc->children[median]); //file = &med_ie->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - free (med_ie); + ntfs_ie_free (med_ie); med_ie = NULL; //printf ("suc key count = %d\n", suc->child_count); @@ -3367,7 +3231,7 @@ ascend: //file = &suc->children[0]->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); // can this be a root node? - if (ntfs_dt_root (suc)) + if (ntfs_dt_isroot (suc)) ntfs_dt_root_remove (suc, 0); else ntfs_dt_alloc_remove (suc, 0); @@ -3502,7 +3366,7 @@ static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); //printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); - free (ie); + ntfs_ie_free (ie); ie = NULL; //index flags remove LARGE_INDEX @@ -3650,9 +3514,9 @@ static void ntfs_dir_free (struct ntfs_dir *dir) } /** - * ntfs_dir_alloc + * ntfs_dir_create */ -static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) +static struct ntfs_dir * ntfs_dir_create (ntfs_volume *vol, MFT_REF mft_num) { struct ntfs_dir *dir = NULL; ntfs_inode *inode = NULL; @@ -3663,7 +3527,7 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) if (!vol) return NULL; - //printf ("ntfs_dir_alloc %lld\n", MREF (mft_num)); + //printf ("ntfs_dir_create %lld\n", MREF (mft_num)); inode = ntfs_inode_open2 (vol, mft_num); if (!inode) return NULL; @@ -3693,7 +3557,7 @@ static struct ntfs_dir * ntfs_dir_alloc (ntfs_volume *vol, MFT_REF mft_num) dir->mft_num = mft_num; // This may not exist - dir->bitmap = ntfs_bmp_alloc (inode, AT_BITMAP, I30, 4); + dir->bitmap = ntfs_bmp_create (inode, AT_BITMAP, I30, 4); if (dir->iroot) { rec = find_first_attribute (AT_INDEX_ROOT, inode->mrec); @@ -3771,11 +3635,11 @@ static struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, i mft_num = ie->indexed_file; - child = ntfs_dir_alloc (dir->vol, mft_num); + child = ntfs_dir_create (dir->vol, mft_num); if (!child) return NULL; - child->index = ntfs_dt_alloc (child, NULL, -1); + child->index = ntfs_dt_create (child, NULL, -1); ntfs_dir_add (dir, child); @@ -3813,7 +3677,7 @@ static int ntfs_dir_map (ntfs_volume *vol, struct ntfs_dir *dir) //dt->data = malloc (dt->data_len); //ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data); - //ntfs_dt_count_root (dt); + //ntfs_dt_root_count (dt); return 0; } @@ -3948,14 +3812,14 @@ static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flag vol->mft_ni ->private_data = NULL; vol->mftmirr_ni->private_data = NULL; - dir = ntfs_dir_alloc (vol, FILE_root); + dir = ntfs_dir_create (vol, FILE_root); if (!dir) { ntfs_umount2 (vol, FALSE); vol = NULL; goto done; } - dir->index = ntfs_dt_alloc (dir, NULL, -1); + dir->index = ntfs_dt_create (dir, NULL, -1); root = dir->index; @@ -4013,8 +3877,8 @@ static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flag dir->inode->private_data = found; dir->inode->ref_count = 2; - vol->private_bmp1 = ntfs_bmp_alloc (vol->mft_ni, AT_BITMAP, NULL, 0); - vol->private_bmp2 = ntfs_bmp_alloc (vol->lcnbmp_ni, AT_DATA, NULL, 0); + vol->private_bmp1 = ntfs_bmp_create (vol->mft_ni, AT_BITMAP, NULL, 0); + vol->private_bmp2 = ntfs_bmp_create (vol->lcnbmp_ni, AT_DATA, NULL, 0); if (!vol->private_bmp1 || !vol->private_bmp2) { printf ("can't find the bitmaps\n"); @@ -4103,10 +3967,10 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, //printf ("dt's flags = 0x%08x\n", dt->children[dt_num]->key.file_name.file_attributes); if (dt->children[dt_num]->key.file_name.file_attributes == FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) { //printf ("DIR\n"); - child = ntfs_dir_alloc (dir->vol, dt->children[dt_num]->indexed_file); + child = ntfs_dir_create (dir->vol, dt->children[dt_num]->indexed_file); //printf ("child = %p (%lld)\n", child, MREF (dt->children[dt_num]->indexed_file)); if (child) { - child->index = ntfs_dt_alloc (child, NULL, -1); + child->index = ntfs_dt_create (child, NULL, -1); ntfs_dir_add (dir, child); } @@ -4349,14 +4213,14 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) file = &suc_ie->key.file_name; printf ("\tsuc name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); //utils_dump_mem (del->data, 0, del->data_len, DM_BLUE|DM_GREEN|DM_INDENT); - if (ntfs_dt_root (del)) + if (ntfs_dt_isroot (del)) res = ntfs_dt_root_replace (del, del_num, del_ie, suc_ie); else res = ntfs_dt_alloc_replace (del, del_num, del_ie, suc_ie); //printf ("\n"); //utils_dump_mem (del->data, 0, del->data_len, DM_BLUE|DM_GREEN|DM_INDENT); - free (suc_ie); + ntfs_ie_free (suc_ie); if (res == FALSE) goto done; @@ -4381,7 +4245,7 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) //utils_dump_mem (del->data, 0, del->header->index_length+24, DM_BLUE|DM_GREEN|DM_INDENT); // XXX if del->child_count == 2, we could skip this step // no, if we combine with another node, we'll have to remember - if (ntfs_dt_root (del)) + if (ntfs_dt_isroot (del)) ntfs_dt_root_remove (del, del_num); else ntfs_dt_alloc_remove (del, del_num); @@ -4477,7 +4341,7 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) par_num--; - if (ntfs_dt_root (par)) + if (ntfs_dt_isroot (par)) printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, par->dir->inode->mft_no); else printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, par->dir->inode->mft_no, par->vcn, par->vcn + (par->dir->index_size>>9) - 1); @@ -4516,7 +4380,7 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) #if 1 //printf ("PAR: %p,%d\n", par, par_num); - if (ntfs_dt_root (par)) + if (ntfs_dt_isroot (par)) ntfs_dt_root_remove (par, par_num); else ntfs_dt_alloc_remove (par, par_num); @@ -4763,7 +4627,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) close: free (buffer); ntfs_inode_close2 (ino); - free (ie); + ntfs_ie_free (ie); free (uname); ntfs_inode_close2 (find.inode); return 0; @@ -4897,8 +4761,6 @@ done: if (1) ntfs_umount2 (vol, FALSE); if (0) ntfs_binary_print (0, FALSE, FALSE); - if (0) ntfs_dt_root_add (NULL, NULL); - if (0) ntfs_dt_alloc_add (NULL, NULL); if (0) utils_pathname_to_inode2 (NULL, NULL, NULL, NULL); if (0) ntfs_dir_map (NULL, NULL); From fa99ae3d0fe7c1f82d823db9e2bd6cc824f86e4d Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 17 Aug 2005 15:59:27 +0000 Subject: [PATCH 2482/2994] more housekeeping - no code changes --- ntfsprogs/ntfsrm.c | 792 +++++++++++---------------------------------- 1 file changed, 197 insertions(+), 595 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index fc979c28..5534a492 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -248,224 +248,6 @@ static void ntfs_dt_print (struct ntfs_dt *dt, int indent) } } -/** - * ntfs_binary_print - */ -static void ntfs_binary_print (u8 num, BOOL backwards, BOOL colour) -{ - int i; - - if (backwards) - for (i = 1; i < 129; i<<=1) { - if (colour) - printf ("%s", (num&i) ? "1" : "0"); - else - printf ("%s", (num&i) ? "1" : "0"); - } - else - for (i = 128; i > 0; i>>=1) { - if (colour) - printf ("%s", (num&i) ? "1" : "0"); - else - printf ("%s", (num&i) ? "1" : "0"); - } -} - -/** - * ntfsinfo_time_to_str - */ -static const char * ntfsinfo_time_to_str(const s64 sle_ntfs_clock) -{ - time_t unix_clock = ntfs2utc(sle_ntfs_clock); - if (sle_ntfs_clock == 0) - return "none\n"; - else - return ctime(&unix_clock); -} - -/** - * ntfs_inode_dir_map - */ -static void ntfs_inode_dir_map (ntfs_inode *ino) -{ - ATTR_RECORD *rec; - FILE_NAME_ATTR *fn; - ntfs_inode *parent; - - if (!ino) - return; - - printf ("open inode %lld\n", ino->mft_no); - - if (ino->mft_no == FILE_root) { - printf ("done\n"); - return; - } - - rec = find_first_attribute (AT_FILE_NAME, ino->mrec); - if (!rec) - return; - - fn = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); - - parent = ntfs_inode_open (ino->vol, fn->parent_directory); - if (parent) { - ntfs_inode_dir_map (parent); - ntfs_inode_close (parent); - } -} - -/** - * ntfs_inode_open2 - */ -static ntfs_inode * ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) -{ - ntfs_inode *ino = NULL; - struct ntfs_dir *dir; - - if (!vol) - return NULL; - - switch (mref) { - case FILE_Bitmap: ino = vol->lcnbmp_ni; break; - case FILE_MFT: ino = vol->mft_ni; break; - case FILE_MFTMirr: ino = vol->mftmirr_ni; break; - case FILE_root: - dir = vol->private_data; - if (dir) - ino = dir->inode; - break; - } - - if (ino) { - //printf (BOLD YELLOW "inode reuse %lld\n" END, mref); - ino->ref_count++; - return ino; - } - - ino = ntfs_inode_open (vol, mref); - if (!ino) - return NULL; - - /* - if (mref != FILE_root) - ntfs_inode_dir_map (ino); - */ - - // link - // ino->private_data - - ino->private_data = NULL; - ino->ref_count = 1; - - //printf (BOLD YELLOW "inode open %lld\n" END, mref); - return ino; -} - -/** - * ntfs_inode_open3 - * open a deleted inode - */ -static ntfs_inode * ntfs_inode_open3 (ntfs_volume *vol, const MFT_REF mref) -{ - ntfs_inode *ino = NULL; - - if (!vol) - return NULL; - - ino = calloc (1, sizeof (*ino)); - if (!ino) - return NULL; - - ino->mrec = malloc (vol->mft_record_size); - if (!ino->mrec) { - free (ino); - return NULL; - } - - ino->mft_no = mref; - ino->vol = vol; - - ino->data_size = -1; - ino->allocated_size = -1; - - ino->private_data = NULL; - ino->ref_count = 1; - - if (1 != ntfs_attr_mst_pread (vol->mft_na, MREF(mref) * vol->mft_record_size, 1, vol->mft_record_size, ino->mrec)) { - //ntfs_inode_close2 (ino); ??? - free (ino->mrec); - free (ino); - return NULL; - } - - NInoSetDirty (ino); - return ino; -} - -/** - * ntfs_inode_close2 - */ -static int ntfs_inode_close2 (ntfs_inode *ni) -{ - if (!ni) - return 0; - - //printf (BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); - - ni->ref_count--; - if (ni->ref_count > 0) - return 0; - - // unlink - // ino->private_data - - // XXX temporary until we have commit/rollback - NInoClearDirty(ni); - - return ntfs_inode_close (ni); -} - -/** - * utils_index_init - */ -static int utils_index_init (ntfs_volume *vol, u8 *buffer, int size) -{ - INDEX_ALLOCATION *alloc; - INDEX_ENTRY_HEADER *header; - - if (!vol) - return 1; - if (!buffer) - return 1; - if (size < 512) - return 1; - - memset (buffer, 0, size); - - alloc = (INDEX_ALLOCATION*) buffer; - - alloc->magic = magic_INDX; - alloc->usa_ofs = 0x28; - alloc->usa_count = (size >> vol->sector_size_bits) + 1; - alloc->lsn = 0; - alloc->index_block_vcn = 0; - - alloc->index.entries_offset = 0x40; - alloc->index.index_length = 0x10; - alloc->index.allocated_size = size - 0x18; - alloc->index.flags = 0; - - header = (INDEX_ENTRY_HEADER*) (buffer + 0x40); - - header->indexed_file = 0; - header->length = 0x10; - header->key_length = 0; - header->flags = INDEX_ENTRY_END; - - return 0; -} - /** * ntfs_bmp_rollback @@ -847,73 +629,6 @@ static void ntfs_ie_free (INDEX_ENTRY *ie) free (ie); } -/** - * ntfs_ie_get_vcn - */ -static VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie) -{ - if (!ie) - return -1; - if (!(ie->flags & INDEX_ENTRY_NODE)) - return -1; - - return *((VCN*) ((u8*) ie + ie->length - 8)); -} - -/** - * ntfs_ie_dump - */ -static void ntfs_ie_dump (INDEX_ENTRY *ie) -{ - if (!ie) - return; - - printf ("________________________________________________"); - printf ("\n"); - utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); - - printf ("MFT Ref: 0x%llx\n", ie->indexed_file); - printf ("length: %d\n", ie->length); - printf ("keylen: %d\n", ie->key_length); - printf ("flags: "); - if (ie->flags & INDEX_ENTRY_NODE) printf ("NODE "); - if (ie->flags & INDEX_ENTRY_END) printf ("END"); - if (!(ie->flags & (INDEX_ENTRY_NODE | INDEX_ENTRY_END))) printf ("none"); - printf ("\n"); - printf ("reserved 0x%04x\n", ie->reserved); - if (ie->key_length > 0) { - printf ("mft parent: 0x%llx\n", ie->key.file_name.parent_directory); - - printf ("ctime: %s", ntfsinfo_time_to_str(ie->key.file_name.creation_time)); - printf ("dtime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_data_change_time)); - printf ("mtime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_mft_change_time)); - printf ("atime: %s", ntfsinfo_time_to_str(ie->key.file_name.last_access_time)); - printf ("alloc size: %lld\n", ie->key.file_name.allocated_size); - printf ("data size: %lld\n", ie->key.file_name.data_size); - printf ("file flags: 0x%04x\n", ie->key.file_name.file_attributes); - printf ("reserved: 0x%04x\n", ie->key.file_name.reserved); printf ("name len: %d\n", ie->key.file_name.file_name_length); - if (ie->key.file_name.file_name_length > 0) { - int i, r; - printf ("name type: %d\n", ie->key.file_name.file_name_type); - printf ("name: "); - ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); - printf ("\n"); - r = ATTR_SIZE (2 * (ie->key.file_name.file_name_length+1)) - (2 * (ie->key.file_name.file_name_length+1)); - if (r > 0) { - u8 *ptr; - printf ("padding: "); - ptr = (u8*) (ie->key.file_name.file_name + ie->key.file_name.file_name_length); - for (i = 0; i < r; i++, ptr++) - printf ("0x%02x ", *ptr); - printf ("\n"); - } - } - } - if (ie->flags == INDEX_ENTRY_NODE) { - printf ("child vcn = %lld\n", ntfs_ie_get_vcn (ie)); - } -} - /** * ntfs_ie_create */ @@ -935,6 +650,19 @@ static INDEX_ENTRY * ntfs_ie_create (void) return ie; } +/** + * ntfs_ie_get_vcn + */ +static VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie) +{ + if (!ie) + return -1; + if (!(ie->flags & INDEX_ENTRY_NODE)) + return -1; + + return *((VCN*) ((u8*) ie + ie->length - 8)); +} + /** * ntfs_ie_copy */ @@ -1105,70 +833,67 @@ static INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) return ie; } + /** - * ntfs_ie_test + * ntfs_inode_close2 */ -static int ntfs_ie_test (void) +static int ntfs_inode_close2 (ntfs_inode *ni) { - INDEX_ENTRY *ie1 = NULL; - INDEX_ENTRY *ie2 = NULL; - int namelen = 0; - ntfschar *name = NULL; + if (!ni) + return 0; - if (1) { - ie1 = ntfs_ie_create(); - //ntfs_ie_dump (ie1); - } + //printf (BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); - if (0) { - ie2 = ntfs_ie_copy (ie1); - ntfs_ie_dump (ie2); - } + ni->ref_count--; + if (ni->ref_count > 0) + return 0; - if (1) { - namelen = ntfs_mbstoucs("richard", &name, 0); - ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); - free (name); - name = NULL; - ntfs_ie_dump (ie1); - } + // unlink + // ino->private_data - if (1) { - namelen = ntfs_mbstoucs("richard2", &name, 0); - ie1 = ntfs_ie_set_name (ie1, name, namelen, FILE_NAME_WIN32); - free (name); - name = NULL; - ntfs_ie_dump (ie1); - } + // XXX temporary until we have commit/rollback + NInoClearDirty(ni); - if (1) { - ie1 = ntfs_ie_set_vcn (ie1, 1234); - ntfs_ie_dump (ie1); - } + return ntfs_inode_close (ni); +} - if (1) { - ie1 = ntfs_ie_remove_vcn (ie1); - ntfs_ie_dump (ie1); - } +/** + * utils_index_init + */ +static int utils_index_init (ntfs_volume *vol, u8 *buffer, int size) +{ + INDEX_ALLOCATION *alloc; + INDEX_ENTRY_HEADER *header; - if (0) { - ie1 = ntfs_ie_remove_name (ie1); - ntfs_ie_dump (ie1); - } else { - ie1->indexed_file = 1234; - ie1->key.file_name.parent_directory = 5; - ie1->key.file_name.creation_time = utc2ntfs (time(NULL)); - ie1->key.file_name.last_data_change_time = utc2ntfs (time(NULL)); - ie1->key.file_name.last_mft_change_time = utc2ntfs (time(NULL)); - ie1->key.file_name.last_access_time = utc2ntfs (time(NULL)); - ie1->key.file_name.allocated_size = 4096; - ie1->key.file_name.data_size = 3973; - } + if (!vol) + return 1; + if (!buffer) + return 1; + if (size < 512) + return 1; + + memset (buffer, 0, size); + + alloc = (INDEX_ALLOCATION*) buffer; + + alloc->magic = magic_INDX; + alloc->usa_ofs = 0x28; + alloc->usa_count = (size >> vol->sector_size_bits) + 1; + alloc->lsn = 0; + alloc->index_block_vcn = 0; + + alloc->index.entries_offset = 0x40; + alloc->index.index_length = 0x10; + alloc->index.allocated_size = size - 0x18; + alloc->index.flags = 0; + + header = (INDEX_ENTRY_HEADER*) (buffer + 0x40); + + header->indexed_file = 0; + header->length = 0x10; + header->key_length = 0; + header->flags = INDEX_ENTRY_END; - ntfs_ie_dump (ie1); - free (name); - ntfs_ie_free (ie1); - ntfs_ie_free (ie2); return 0; } @@ -2178,36 +1903,6 @@ static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) return 0; } -/** - * utils_mftrec_mark_free6 - */ -static int utils_mftrec_set_inuse6 (ntfs_inode *inode, struct ntfs_bmp *bmp, BOOL inuse) -{ - MFT_RECORD *rec; - - if (!inode) - return -1; - - if (ntfs_bmp_set_range (bmp, (VCN) MREF (inode->mft_no), 1, inuse) < 0) - return -1; - - rec = (MFT_RECORD*) inode->mrec; - - // XXX extent inodes? - - if (inuse) - rec->flags |= MFT_RECORD_IN_USE; - else - rec->flags &= ~MFT_RECORD_IN_USE; - - // XXX inc sequence number - - NInoSetDirty(inode); - - printf (GREEN "Modified: inode %lld MFT_RECORD header\n" END, inode->mft_no); - return 0; -} - /** * ntfs_mft_remove_attr @@ -2479,7 +2174,7 @@ static int ntfs_mft_add_index (struct ntfs_dir *dir) dt = ntfs_dt_create (dir, dir->index, -1); if (!dt) return 1; - + dt->vcn = 0; // New alloc record ie = ntfs_ie_copy (dir->index->children[dir->index->child_count-1]); @@ -2535,6 +2230,95 @@ static int ntfs_mft_add_index (struct ntfs_dir *dir) } +/** + * ntfs_inode_open2 + */ +static ntfs_inode * ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) +{ + ntfs_inode *ino = NULL; + struct ntfs_dir *dir; + + if (!vol) + return NULL; + + switch (mref) { + case FILE_Bitmap: ino = vol->lcnbmp_ni; break; + case FILE_MFT: ino = vol->mft_ni; break; + case FILE_MFTMirr: ino = vol->mftmirr_ni; break; + case FILE_root: + dir = vol->private_data; + if (dir) + ino = dir->inode; + break; + } + + if (ino) { + //printf (BOLD YELLOW "inode reuse %lld\n" END, mref); + ino->ref_count++; + return ino; + } + + ino = ntfs_inode_open (vol, mref); + if (!ino) + return NULL; + + /* + if (mref != FILE_root) + ntfs_inode_dir_map (ino); + */ + + // link + // ino->private_data + + ino->private_data = NULL; + ino->ref_count = 1; + + //printf (BOLD YELLOW "inode open %lld\n" END, mref); + return ino; +} + +/** + * ntfs_inode_open3 + * open a deleted inode + */ +static ntfs_inode * ntfs_inode_open3 (ntfs_volume *vol, const MFT_REF mref) +{ + ntfs_inode *ino = NULL; + + if (!vol) + return NULL; + + ino = calloc (1, sizeof (*ino)); + if (!ino) + return NULL; + + ino->mrec = malloc (vol->mft_record_size); + if (!ino->mrec) { + free (ino); + return NULL; + } + + ino->mft_no = mref; + ino->vol = vol; + + ino->data_size = -1; + ino->allocated_size = -1; + + ino->private_data = NULL; + ino->ref_count = 1; + + if (1 != ntfs_attr_mst_pread (vol->mft_na, MREF(mref) * vol->mft_record_size, 1, vol->mft_record_size, ino->mrec)) { + //ntfs_inode_close2 (ino); ??? + free (ino->mrec); + free (ino); + return NULL; + } + + NInoSetDirty (ino); + return ino; +} + + /** * ntfs_dt_root_replace */ @@ -3646,47 +3430,11 @@ static struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, i return child; } -/** - * ntfs_dir_map - */ -static int ntfs_dir_map (ntfs_volume *vol, struct ntfs_dir *dir) -{ - //struct ntfs_dt *dt; - - if (!vol) - return 1; - if (!dir) - return 1; - -#if 0 - printf ("dir = %p\n", dir); - printf ("vol = %p\n", dir->vol); - printf ("parent = %p\n", dir->parent); - printf ("name = "); ntfs_name_print (dir->name, dir->name_len); printf ("\n"); - printf ("mftnum = %lld\n", MREF (dir->mft_num)); - printf ("dt = %p\n", dir->index); - printf ("children = %p (%d)\n", dir->children, dir->child_count); - printf ("bitmap = %p\n", dir->bitmap); - printf ("inode = %p\n", dir->inode); - printf ("iroot = %p\n", dir->iroot); - printf ("ialloc = %p\n", dir->ialloc); - printf ("isize = %d\n", dir->index_size); -#endif - - //dt->data_len = dir->iroot->allocated_size; - //dt->data = malloc (dt->data_len); - //ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data); - - //ntfs_dt_root_count (dt); - - return 0; -} - /** - * utils_volume_commit + * ntfs_volume_commit */ -static int utils_volume_commit (ntfs_volume *vol) +static int ntfs_volume_commit (ntfs_volume *vol) { if (!vol) return -1; @@ -3705,9 +3453,9 @@ static int utils_volume_commit (ntfs_volume *vol) } /** - * utils_volume_rollback + * ntfs_volume_rollback */ -static int utils_volume_rollback (ntfs_volume *vol) +static int ntfs_volume_rollback (ntfs_volume *vol) { if (!vol) return -1; @@ -3725,9 +3473,9 @@ static int utils_volume_rollback (ntfs_volume *vol) } /** - * ntfs_umount2 + * ntfs_volume_umount2 */ -static int ntfs_umount2 (ntfs_volume *vol, const BOOL force) +static int ntfs_volume_umount2 (ntfs_volume *vol, const BOOL force) { struct ntfs_dir *dir; struct ntfs_bmp *bmp; @@ -3735,7 +3483,7 @@ static int ntfs_umount2 (ntfs_volume *vol, const BOOL force) if (!vol) return 0; - utils_volume_rollback (vol); + ntfs_volume_rollback (vol); dir = (struct ntfs_dir *) vol->private_data; vol->private_data = NULL; @@ -3753,9 +3501,9 @@ static int ntfs_umount2 (ntfs_volume *vol, const BOOL force) } /** - * utils_mount_volume2 + * ntfs_volume_mount2 */ -static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flags, BOOL force) +static ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL force) { // XXX can we replace these and search by mft number? Hmm... NO. static ntfschar bmp[8] = { @@ -3814,7 +3562,7 @@ static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flag dir = ntfs_dir_create (vol, FILE_root); if (!dir) { - ntfs_umount2 (vol, FALSE); + ntfs_volume_umount2 (vol, FALSE); vol = NULL; goto done; } @@ -3828,7 +3576,7 @@ static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flag found = ntfs_dt_find2 (root, bmp, 7, &num); if ((!found) || (num < 0)) { printf ("can't find $Bitmap\n"); - ntfs_umount2 (vol, FALSE); + ntfs_volume_umount2 (vol, FALSE); vol = NULL; goto done; } @@ -3841,7 +3589,7 @@ static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flag found = ntfs_dt_find2 (root, mft, 4, &num); if ((!found) || (num < 0)) { printf ("can't find $MFT\n"); - ntfs_umount2 (vol, FALSE); + ntfs_volume_umount2 (vol, FALSE); vol = NULL; goto done; } @@ -3854,7 +3602,7 @@ static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flag found = ntfs_dt_find2 (root, mftmirr, 8, &num); if ((!found) || (num < 0)) { printf ("can't find $MFTMirr\n"); - ntfs_umount2 (vol, FALSE); + ntfs_volume_umount2 (vol, FALSE); vol = NULL; goto done; } @@ -3867,7 +3615,7 @@ static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flag found = ntfs_dt_find2 (root, dot, 1, &num); if ((!found) || (num < 0)) { printf ("can't find the root directory\n"); - ntfs_umount2 (vol, FALSE); + ntfs_volume_umount2 (vol, FALSE); vol = NULL; goto done; } @@ -3882,7 +3630,7 @@ static ntfs_volume * utils_mount_volume2 (const char *device, unsigned long flag if (!vol->private_bmp1 || !vol->private_bmp2) { printf ("can't find the bitmaps\n"); - ntfs_umount2 (vol, FALSE); + ntfs_volume_umount2 (vol, FALSE); vol = NULL; goto done; } @@ -4010,10 +3758,11 @@ close: return result; } + /** - * utils_mft_find_free_entry + * ntfs_mft_find_free_entry */ -static s64 utils_mft_find_free_entry (ntfs_volume *vol) +static s64 ntfs_mft_find_free_entry (ntfs_volume *vol) { MFT_REF i; u64 recs; @@ -4030,113 +3779,37 @@ static s64 utils_mft_find_free_entry (ntfs_volume *vol) return -1; } - /** - * ntfs_index_dump_alloc + * ntfs_mft_set_inuse6 */ -static int ntfs_index_dump_alloc (ntfs_attr *attr, VCN vcn, int indent) +static int ntfs_mft_set_inuse6 (ntfs_inode *inode, struct ntfs_bmp *bmp, BOOL inuse) { - u8 buffer[4096]; - INDEX_BLOCK *block; - INDEX_ENTRY *entry; - u8 *ptr; - int size; - VCN *newvcn = 0; - - ntfs_attr_mst_pread (attr, vcn*512, 1, sizeof (buffer), buffer); - - block = (INDEX_BLOCK*) buffer; - size = block->index.allocated_size; - - for (ptr = buffer + 64; ptr < (buffer + size); ptr += entry->length) { - entry = (INDEX_ENTRY*) ptr; - - if (entry->flags & INDEX_ENTRY_NODE) { - newvcn = (VCN*) (ptr + ROUND_UP(entry->length, 8) - 8); - ntfs_index_dump_alloc (attr, *newvcn, indent+4); - } - - printf ("%.*s", indent, space_line); - - if (entry->flags & INDEX_ENTRY_END) { - printf ("[END]"); - } else { - ntfs_name_print (entry->key.file_name.file_name, entry->key.file_name.file_name_length); - } - - if (entry->flags & INDEX_ENTRY_NODE) { - printf (" (%lld)\n", *newvcn); - } else { - printf ("\n"); - } - - if (entry->flags & INDEX_ENTRY_END) - break; - } - //printf ("%.*s", indent, space_line); - //printf ("fill = %u/%u\n", (unsigned)block->index.index_length, (unsigned)block->index.allocated_size); - return 0; -} - -/** - * ntfs_index_dump - */ -static int ntfs_index_dump (ntfs_inode *inode) -{ - u8 buffer[1024]; - ntfs_attr *iroot; - ntfs_attr *ialloc; - INDEX_ROOT *root; - INDEX_ENTRY *entry; - u8 *ptr; - int size; - VCN *vcn = 0; + MFT_RECORD *rec; if (!inode) - return 0; + return -1; - iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); - if (!iroot) { - printf ("not a directory\n"); - return 0; - } + if (ntfs_bmp_set_range (bmp, (VCN) MREF (inode->mft_no), 1, inuse) < 0) + return -1; - ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); + rec = (MFT_RECORD*) inode->mrec; - size = (int) ntfs_attr_pread (iroot, 0, sizeof (buffer), buffer); + // XXX extent inodes? - root = (INDEX_ROOT*) buffer; + if (inuse) + rec->flags |= MFT_RECORD_IN_USE; + else + rec->flags &= ~MFT_RECORD_IN_USE; - ptr = buffer + root->index.entries_offset + 0x10; + // XXX inc sequence number - while (ptr < (buffer + size)) { - entry = (INDEX_ENTRY*) ptr; - if (entry->flags & INDEX_ENTRY_NODE) { - vcn = (VCN*) (ptr + ROUND_UP(entry->length, 8) - 8); - ntfs_index_dump_alloc (ialloc, *vcn, 4); - } + NInoSetDirty(inode); - if (entry->flags & INDEX_ENTRY_END) { - printf ("[END]"); - } else { - ntfs_name_print (entry->key.file_name.file_name, entry->key.file_name.file_name_length); - } - - if (entry->flags & INDEX_ENTRY_NODE) { - printf (" (%lld)", *vcn); - } - printf ("\n"); - - ptr += entry->length; - } - - ntfs_attr_close (iroot); - ntfs_attr_close (ialloc); - - //printf ("fill = %d\n", ptr - buffer); + printf (GREEN "Modified: inode %lld MFT_RECORD header\n" END, inode->mft_no); return 0; } + /** * ntfs_file_remove */ @@ -4460,7 +4133,7 @@ static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) bmp_mft = vol->private_bmp1; bmp_vol = vol->private_bmp2; - if (1) utils_mftrec_set_inuse6 (ino, bmp_mft, FALSE); + if (1) ntfs_mft_set_inuse6 (ino, bmp_mft, FALSE); if (1) utils_free_non_residents2 (ino, bmp_vol); @@ -4468,9 +4141,9 @@ static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) if (1) ntfs_dir_truncate (vol, dt->dir); - if (1) utils_volume_commit (vol); + if (1) ntfs_volume_commit (vol); - if (0) utils_volume_rollback (vol); + if (0) ntfs_volume_rollback (vol); if (0) printf ("last mft = %lld\n", ntfs_bmp_find_last_set (bmp_mft)); if (0) printf ("last vol = %lld\n", ntfs_bmp_find_last_set (bmp_vol)); @@ -4502,7 +4175,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) struct ntfs_dt *suc = NULL; int suc_num = 0; - new_num = utils_mft_find_free_entry (vol); + new_num = ntfs_mft_find_free_entry (vol); if (new_num == (MFT_REF) -1) return 1; @@ -4550,7 +4223,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) ino->mrec->next_attr_instance = 0; ino->mrec->flags = MFT_RECORD_IN_USE; - utils_mftrec_set_inuse6 (ino, vol->private_bmp1, TRUE); + ntfs_mft_set_inuse6 (ino, vol->private_bmp1, TRUE); buffer = malloc (128); if (!buffer) @@ -4633,73 +4306,6 @@ close: return 0; } -/** - * ntfs_test_bmp2 - */ -static int ntfs_test_bmp2 (ntfs_volume *vol) -{ - struct ntfs_bmp *bmp; - int i, j; - u8 value = 0xFF; - - bmp = calloc (1, sizeof (*bmp)); - if (!bmp) - return 1; - - bmp->vol = vol; - bmp->attr = calloc (1, sizeof (*bmp->attr)); - bmp->attr->type = 0xB0; - bmp->attr->ni = calloc (1, sizeof (*bmp->attr->ni)); - bmp->count = 2; - bmp->data = calloc (4, sizeof (u8*)); - bmp->data[0] = calloc (1, vol->cluster_size); - bmp->data[1] = calloc (1, vol->cluster_size); - bmp->data_vcn = calloc (4, sizeof (VCN)); - bmp->data_vcn[0] = 0; - bmp->data_vcn[1] = 1; - - for (j = 4090; j < 4103; j++) { - memset (bmp->data[0], ~value, vol->cluster_size); - memset (bmp->data[1], ~value, vol->cluster_size); - ntfs_bmp_set_range (bmp, j, 7, value); - for (i = 0; i < 4; i++) { ntfs_binary_print (bmp->data[0][508+i], TRUE, TRUE); printf (" "); } printf ("| "); - for (i = 0; i < 4; i++) { ntfs_binary_print (bmp->data[1][i], TRUE, TRUE); printf (" "); } printf ("\n"); - } - - printf ("\n"); - for (j = 0; j < 15; j++) { - memset (bmp->data[0], ~value, vol->cluster_size); - ntfs_bmp_set_range (bmp, j, 1, value); - for (i = 0; i < 8; i++) { ntfs_binary_print (bmp->data[0][i], TRUE, TRUE); printf (" "); } printf ("\n"); - } - - printf ("\n"); - for (j = 0; j < 15; j++) { - memset (bmp->data[0], ~value, vol->cluster_size); - ntfs_bmp_set_range (bmp, j, 2, value); - for (i = 0; i < 8; i++) { ntfs_binary_print (bmp->data[0][i], TRUE, TRUE); printf (" "); } printf ("\n"); - } - - printf ("\n"); - for (j = 0; j < 15; j++) { - memset (bmp->data[0], ~value, vol->cluster_size); - ntfs_bmp_set_range (bmp, j, 7, value); - for (i = 0; i < 8; i++) { ntfs_binary_print (bmp->data[0][i], TRUE, TRUE); printf (" "); } printf ("\n"); - } - - printf ("\n"); - for (j = 0; j < 15; j++) { - memset (bmp->data[0], ~value, vol->cluster_size); - ntfs_bmp_set_range (bmp, j, 8, value); - for (i = 0; i < 8; i++) { ntfs_binary_print (bmp->data[0][i], TRUE, TRUE); printf (" "); } printf ("\n"); - } - - free (bmp->attr->ni); - ntfs_bmp_free (bmp); - - return 0; -} - /** * main - Begin here * @@ -4731,7 +4337,7 @@ int main (int argc, char *argv[]) if (opts.noaction) flags |= MS_RDONLY; - vol = utils_mount_volume2 (opts.device, flags, opts.force); + vol = ntfs_volume_mount2 (opts.device, flags, opts.force); if (!vol) { printf ("!vol\n"); goto done; @@ -4748,21 +4354,17 @@ int main (int argc, char *argv[]) //printf ("inode = %lld\n", inode->mft_no); - if (0) result = ntfs_index_dump (inode); - if (0) result = ntfs_ie_test(); if (0) result = ntfs_file_remove2 (vol, find.dt, find.dt_index); if (1) result = ntfs_file_add2 (vol, opts.file); - if (0) result = ntfs_test_bmp2 (vol); done: - if (1) utils_volume_commit (vol); - if (0) utils_volume_rollback (vol); + if (1) ntfs_volume_commit (vol); + if (0) ntfs_volume_rollback (vol); if (0) ntfs_inode_close2 (inode); - if (1) ntfs_umount2 (vol, FALSE); + if (1) ntfs_volume_umount2 (vol, FALSE); - if (0) ntfs_binary_print (0, FALSE, FALSE); if (0) utils_pathname_to_inode2 (NULL, NULL, NULL, NULL); - if (0) ntfs_dir_map (NULL, NULL); + if (0) ntfs_ie_remove_name (NULL); return result; } From 0f3a85c8e32d634f031474038f57336332d5311e Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 19 Aug 2005 16:01:15 +0000 Subject: [PATCH 2483/2994] Only include sys/ioctl.h in libntfs/device.c if ./configure detected it to be present. (Christophe) --- ChangeLog | 4 +++- libntfs/device.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c632cc3..b246a510 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,7 +33,9 @@ xx/xx/2005 - 1.12.0-WIP ntfs_mft_record_alloc. (Yura) - Make ntfsmount use new APIs for file and directory creation/deletion. Implement utime operation. (Yura) - - Hard link mkfs.ntfs and mkfs.ntfs.8 with mkntfs and mkntfs.8 (Szaka). + - Hard link mkfs.ntfs and mkfs.ntfs.8 with mkntfs and mkntfs.8. (Szaka) + - Only include sys/ioctl.h in libntfs/device.c if ./configure detected + it to be present. (Christophe) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/libntfs/device.c b/libntfs/device.c index 2e95bb77..6439b942 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -29,7 +29,9 @@ #include #include #include -#include +#ifdef HAVE_SYS_IOCTL_H +# include +#endif #ifdef HAVE_LINUX_FD_H # include #endif From d29a3e9b9702bdc7c7acdd5b103ecb6c171e68bb Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 21 Aug 2005 00:50:14 +0000 Subject: [PATCH 2484/2994] Fix incorrect volume usage calculation --- ChangeLog | 1 + ntfsprogs/ntfscluster.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b246a510..2374936c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,6 +36,7 @@ xx/xx/2005 - 1.12.0-WIP - Hard link mkfs.ntfs and mkfs.ntfs.8 with mkntfs and mkntfs.8. (Szaka) - Only include sys/ioctl.h in libntfs/device.c if ./configure detected it to be present. (Christophe) + - ntfscluster: fix incorrect volume usage calculation. (Szaka) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 35d54010..9bc60ee9 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -269,7 +269,7 @@ static int info (ntfs_volume *vol) inuse++; - a_ctx = ntfs_attr_get_search_ctx (NULL, m_ctx->inode->mrec); + a_ctx = ntfs_attr_get_search_ctx (m_ctx->inode, NULL); while ((rec = find_attribute (AT_UNUSED, a_ctx))) { From dc284e1e10609521efa0c16251e99771769a04cb Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 21 Aug 2005 09:46:29 +0000 Subject: [PATCH 2485/2994] Fix gigaleak in ntfscluster, utils.c::mft_next_record() --- ChangeLog | 1 + ntfsprogs/utils.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2374936c..0d3e3117 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,7 @@ xx/xx/2005 - 1.12.0-WIP - Only include sys/ioctl.h in libntfs/device.c if ./configure detected it to be present. (Christophe) - ntfscluster: fix incorrect volume usage calculation. (Szaka) + - ntfscluster, utils.c::mft_next_record(): fix gigaleak. (Szaka) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 43db5fab..fd8e3dbe 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -955,8 +955,11 @@ int mft_next_record (struct mft_search_ctx *ctx) (unsigned long long) ctx->mft_num, strerror (errno)); // free / close + ntfs_attr_close(mft); return -1; } + + ntfs_attr_close(mft); } if (ctx->flags_match & ctx->flags_search) { From 2ea4ad30ec4805634625d3e499dfe9cce19e1b18 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 22 Aug 2005 08:30:38 +0000 Subject: [PATCH 2486/2994] Add comment about this being ntfs 1.2 acls. --- doc/system_security_descriptors.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/system_security_descriptors.txt b/doc/system_security_descriptors.txt index f8f4aef7..2003bb46 100644 --- a/doc/system_security_descriptors.txt +++ b/doc/system_security_descriptors.txt @@ -1,4 +1,4 @@ -$SD attribute value for the system files: +$SD attribute value for the system files on an NTFS 1.2 volume: $MFT, $MFTMirr, $LogFile, $AttrDef, $Bitmap, $Boot, $BadClus, and $UpCase: From c7eaee5a0fb29793a8ff23f860bf6c5fd65e90f0 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 22 Aug 2005 09:00:16 +0000 Subject: [PATCH 2487/2994] Some cleanups. --- libntfs/collate.c | 15 ++++----------- libntfs/unistr.c | 12 +++++++----- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/libntfs/collate.c b/libntfs/collate.c index e478beb6..885fa6d3 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -73,21 +73,14 @@ static int ntfs_collate_file_name(ntfs_volume *vol, const void *data2, const int data2_len __attribute__((unused))) { int rc; - const FILE_NAME_ATTR *fn1, *fn2; ntfs_debug("Entering."); - fn1 = (const FILE_NAME_ATTR *)data1; - fn2 = (const FILE_NAME_ATTR *)data2; - rc = ntfs_names_collate(fn1->file_name, fn1->file_name_length, - fn2->file_name, fn2->file_name_length, - NTFS_COLLATION_ERROR, IGNORE_CASE, vol->upcase, - vol->upcase_len); - if (!rc) { - rc = ntfs_names_collate(fn1->file_name, fn1->file_name_length, - fn2->file_name, fn2->file_name_length, + rc = ntfs_file_values_compare(data1, data2, NTFS_COLLATION_ERROR, + IGNORE_CASE, vol->upcase, vol->upcase_len); + if (!rc) + rc = ntfs_file_values_compare(data1, data2, NTFS_COLLATION_ERROR, CASE_SENSITIVE, vol->upcase, vol->upcase_len); - } ntfs_debug("Done, returning %i.", rc); return rc; } diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 0a93d6a0..f2254734 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -88,12 +88,14 @@ BOOL ntfs_names_are_equal(const ntfschar *s1, size_t s1_len, /** * ntfs_names_collate - collate two Unicode names + * @name1: first Unicode name to compare + * @name1_len: length of first Unicode name to compare + * @name2: second Unicode name to compare + * @name2_len: length of second Unicode name to compare + * @err_val: if @name1 contains an invalid character return this value + * @ic: either CASE_SENSITIVE or IGNORE_CASE * @upcase: upcase table (ignored if @ic is CASE_SENSITIVE) * @upcase_len: upcase table size (ignored if @ic is CASE_SENSITIVE) - * @name1: first Unicode name to compare - * @name2: second Unicode name to compare - * @ic: either CASE_SENSITIVE or IGNORE_CASE - * @err_val: if @name1 contains an invalid character return this value * * ntfs_names_collate() collates two Unicode names and returns: * @@ -113,7 +115,7 @@ int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, ntfschar c1, c2; #ifdef DEBUG - if (!name1 || !name2 || (ic && !upcase && upcase_len)) { + if (!name1 || !name2 || (ic && (!upcase || upcase_len))) { Dputs("ntfs_names_collate received NULL pointer!"); exit(1); } From 6f8cd6e5efa73e925a6d6450a123aaa645f4a38e Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 22 Aug 2005 21:33:07 +0000 Subject: [PATCH 2488/2994] Cleanups and memleak fix to error code paths of ntfs_create. --- include/ntfs/unistr.h | 4 ++-- libntfs/attrlist.c | 2 +- libntfs/dir.c | 3 +++ libntfs/unistr.c | 4 ++-- ntfsprogs/ntfsmount.c | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/ntfs/unistr.h b/include/ntfs/unistr.h index 6aba7dec..4dea192a 100644 --- a/include/ntfs/unistr.h +++ b/include/ntfs/unistr.h @@ -52,8 +52,8 @@ extern void ntfs_name_upcase(ntfschar *name, u32 name_len, extern void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, const ntfschar *upcase, const u32 upcase_len); -extern int ntfs_file_values_compare(FILE_NAME_ATTR *file_name_attr1, - FILE_NAME_ATTR *file_name_attr2, +extern int ntfs_file_values_compare(const FILE_NAME_ATTR *file_name_attr1, + const FILE_NAME_ATTR *file_name_attr2, const int err_val, const IGNORE_CASE_BOOL ic, const ntfschar *upcase, const u32 upcase_len); diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index a461cc97..168b69cc 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -34,7 +34,7 @@ #include "unistr.h" /** - * ntfs_attrlist_need - check whether attribute need attribute list + * ntfs_attrlist_need - check whether inode need attribute list * @ni: opened ntfs inode for which perform check * * Check whether all are attributes belong to one MFT record, in that case diff --git a/libntfs/dir.c b/libntfs/dir.c index 8973a999..1b049fed 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1118,6 +1118,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, } if (ntfs_attr_pwrite(na, 0, si_len, si) != si_len) { err = errno; + ntfs_attr_close(na); ntfs_error(, "Failed to initialize STANDARD_INFORMATION " "attribute."); goto err_out; @@ -1165,6 +1166,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, if (ntfs_attr_pwrite(na, 0, ir_len, ir) != ir_len) { err = errno; free(ir); + ntfs_attr_close(na); ntfs_error(, "Failed to initialize INDEX_ROOT."); goto err_out; } @@ -1207,6 +1209,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, } if (ntfs_attr_pwrite(na, 0, fn_len, fn) != fn_len) { err = errno; + ntfs_attr_close(na); ntfs_error(, "Failed to initialize FILE_NAME attribute."); goto err_out; } diff --git a/libntfs/unistr.c b/libntfs/unistr.c index f2254734..17775cc2 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -314,8 +314,8 @@ void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, /** * ntfs_file_values_compare */ -int ntfs_file_values_compare(FILE_NAME_ATTR *file_name_attr1, - FILE_NAME_ATTR *file_name_attr2, +int ntfs_file_values_compare(const FILE_NAME_ATTR *file_name_attr1, + const FILE_NAME_ATTR *file_name_attr2, const int err_val, const IGNORE_CASE_BOOL ic, const ntfschar *upcase, const u32 upcase_len) { diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 94a25909..bf25e9a6 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -632,7 +632,7 @@ static int ntfs_fuse_rm(const char *org_path) if (!path) return -errno; /* Open object for delete. */ - ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); if (!ni) { res = -errno; goto exit; From 1ed76a2d3ee1943f4ad5f77e99e3b9191d0a3d63 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 23 Aug 2005 12:07:26 +0000 Subject: [PATCH 2489/2994] small fix to ntfsmount man page --- ntfsprogs/ntfsmount.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index e689adce..f03d3b12 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -62,7 +62,7 @@ Note that even when show_sys_files is specified, "$MFT" may will not be visible due to bugs/mis-features in glibc. Further, note that irrespective of show_sys_files, all files are accessible by name, i.e. you can always do -"ls -l \$UpCase" for example to specifically show the +"ls -l $UpCase" for example to specifically show the system file containing the Unicode upcase table. .TP From ca83f4d63c0be48d70b91b34ddcab43301c3bd72 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 23 Aug 2005 12:17:39 +0000 Subject: [PATCH 2490/2994] fix brokeness introduced in the last Anton's cleanup --- libntfs/unistr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 17775cc2..7fc7f64f 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -115,7 +115,7 @@ int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, ntfschar c1, c2; #ifdef DEBUG - if (!name1 || !name2 || (ic && (!upcase || upcase_len))) { + if (!name1 || !name2 || (ic && (!upcase || !upcase_len))) { Dputs("ntfs_names_collate received NULL pointer!"); exit(1); } From 0835682401fa5bee2f1f50e74e2320f9a2e957b4 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 23 Aug 2005 12:38:37 +0000 Subject: [PATCH 2491/2994] refix previous fix to man page :) --- ntfsprogs/ntfsmount.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index f03d3b12..c27a84f7 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -62,7 +62,7 @@ Note that even when show_sys_files is specified, "$MFT" may will not be visible due to bugs/mis-features in glibc. Further, note that irrespective of show_sys_files, all files are accessible by name, i.e. you can always do -"ls -l $UpCase" for example to specifically show the +"ls -l '$UpCase'" for example to specifically show the system file containing the Unicode upcase table. .TP From 605726b340178c6570e7cd6fd7740708f1df2053 Mon Sep 17 00:00:00 2001 From: szaka Date: Thu, 25 Aug 2005 20:42:54 +0000 Subject: [PATCH 2492/2994] ntfscmp: new util for development, debugging, testing, etc. --- TODO.ntfsprogs | 13 + ntfsprogs/Makefile.am | 6 +- ntfsprogs/ntfscmp.c | 795 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 813 insertions(+), 1 deletion(-) create mode 100644 ntfsprogs/ntfscmp.c diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index a802fb36..25807171 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -39,6 +39,19 @@ Thanks, - check whether the O_WRONLY -> O_RDWR change made effect on performance +*********** +* ntfscmp * +*********** + +- more exact details about the differences +- unnamed resident attributes with same type are ignored +- special $BadClus:$Bad handling, now $BadClus is skipped +- new option: --metadata mode +- code cleanup, remove many cross-util duplicates +- write manual +- performance: perhaps special handling for sparse, compressed, encrypted + + ********** * ntfscp * ********** diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 1b3b6f74..fc2d5da7 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -15,7 +15,7 @@ bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone \ ntfscp EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove \ - ntfsrm ntfsmftalloc + ntfsrm ntfsmftalloc ntfscmp man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ @@ -101,6 +101,10 @@ ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) ntfstruncate_LDFLAGS = $(AM_LFLAGS) +ntfscmp_SOURCES = ntfscmp.c utils.c utils.h +ntfscmp_LDADD = $(AM_LIBS) +ntfscmp_LDFLAGS = $(AM_LFLAGS) + ntfsmftalloc_SOURCES = ntfsmftalloc.c utils.c utils.h ntfsmftalloc_LDADD = $(AM_LIBS) ntfsmftalloc_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c new file mode 100644 index 00000000..ba59af34 --- /dev/null +++ b/ntfsprogs/ntfscmp.c @@ -0,0 +1,795 @@ +/** + * ntfscmp - compare two NTFS volumes. + * + * Copyright (c) 2005 Szabolcs Szakacsits + * + * This utility is part of the Linux-NTFS project. + * + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "utils.h" + +static const char *EXEC_NAME = "ntfscmp"; + +static const char *invalid_ntfs_msg = +"Apparently device '%s' doesn't have a valid NTFS.\n" +"Maybe you selected the wrong partition? Or the whole disk instead of a\n" +"partition (e.g. /dev/hda, not /dev/hda1)?\n"; + +static const char *corrupt_volume_msg = +"Apparently you have a corrupted NTFS. Please run the filesystem checker\n" +"on Windows by invoking chkdsk /f. Don't forget the /f (force) parameter,\n" +"it's important! You probably also need to reboot Windows to take effect.\n"; + +static const char *hibernated_volume_msg = +"Apparently the NTFS partition is hibernated. Windows must be resumed and\n" +"turned off properly\n"; + + +struct { + int debug; + int show_progress; + int verbose; + char *vol1; + char *vol2; +} opt; + + +#define NTFS_PROGBAR 0x0001 +#define NTFS_PROGBAR_SUPPRESS 0x0002 + +struct progress_bar { + u64 start; + u64 stop; + int resolution; + int flags; + float unit; + u8 padding[4]; /* Unused: padding to 64 bit. */ +}; + +/* WARNING: don't modify the text, external tools grep for it */ +#define ERR_PREFIX "ERROR" +#define PERR_PREFIX ERR_PREFIX "(%d): " +#define NERR_PREFIX ERR_PREFIX ": " + +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stdout, &opt.verbose, TRUE) +GEN_PRINTF(Qprintf, stdout, NULL, FALSE) + +static void perr_printf(int newline, const char *fmt, ...) + __attribute__((format(printf, 2, 3))); +static void perr_printf(int newline, const char *fmt, ...) +{ + va_list ap; + int eo = errno; + + fprintf(stdout, PERR_PREFIX, eo); + va_start(ap, fmt); + vfprintf(stdout, fmt, ap); + va_end(ap); + fprintf(stdout, ": %s", strerror(eo)); + if (newline) + fprintf(stdout, "\n"); + fflush(stdout); + fflush(stderr); +} + +#define perr_print(...) perr_printf(0, __VA_ARGS__) +#define perr_println(...) perr_printf(1, __VA_ARGS__) + +static void err_printf(const char *fmt, ...) + __attribute__((format(printf, 1, 2))); +static void err_printf(const char *fmt, ...) +{ + va_list ap; + + fprintf(stdout, NERR_PREFIX); + va_start(ap, fmt); + vfprintf(stdout, fmt, ap); + va_end(ap); + fflush(stdout); + fflush(stderr); +} + +/** + * err_exit + * + * Print and error message and exit the program. + */ +static int err_exit(const char *fmt, ...) + __attribute__((noreturn)) + __attribute__((format(printf, 1, 2))); +static int err_exit(const char *fmt, ...) +{ + va_list ap; + + fprintf(stdout, NERR_PREFIX); + va_start(ap, fmt); + vfprintf(stdout, fmt, ap); + va_end(ap); + fflush(stdout); + fflush(stderr); + exit(1); +} + +/** + * perr_exit + * + * Print and error message and exit the program + */ +static int perr_exit(const char *fmt, ...) + __attribute__((noreturn)) + __attribute__((format(printf, 1, 2))); +static int perr_exit(const char *fmt, ...) +{ + va_list ap; + int eo = errno; + + fprintf(stdout, PERR_PREFIX, eo); + va_start(ap, fmt); + vfprintf(stdout, fmt, ap); + va_end(ap); + printf(": %s\n", strerror(eo)); + fflush(stdout); + fflush(stderr); + exit(1); +} + +/** + * usage - Print a list of the parameters to the program + * + * Print a list of the parameters and options for the program. + * + * Return: none + */ +static void usage(void) __attribute__((noreturn)); +static void usage(void) +{ + + printf ("\nUsage: %s [OPTIONS] DEVICE1 DEVICE2\n" + " Compare two NTFS volumes and tell the differences.\n" + "\n" + " -P, --no-progress-bar Don't show progress bar\n" + " -v, --verbose More output\n" + " -h, --help Display this help\n" +#ifdef DEBUG + " -d, --debug Show debug information\n" +#endif + "\n", EXEC_NAME); + printf ("%s%s", ntfs_bugs, ntfs_home); + exit(1); +} + + +static void parse_options(int argc, char **argv) +{ + static const char *sopt = "-dhPv"; + static const struct option lopt[] = { +#ifdef DEBUG + { "debug", no_argument, NULL, 'd' }, +#endif + { "help", no_argument, NULL, 'h' }, + { "no-progress-bar", no_argument, NULL, 'P' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 } + }; + + char c; + + memset(&opt, 0, sizeof(opt)); + opt.show_progress = 1; + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opt.vol1) { + opt.vol1 = argv[optind - 1]; + } else if (!opt.vol2) { + opt.vol2 = argv[optind - 1]; + } else { + err_printf("Too many arguments!\n"); + usage(); + } + break; +#ifdef DEBUG + case 'd': + opt.debug++; + break; +#endif + case 'h': + case '?': + usage(); + case 'P': + opt.show_progress = 0; + break; + case 'v': + opt.verbose++; + break; + default: + err_printf("Unknown option '%s'.\n", argv[optind - 1]); + usage(); + break; + } + } + + if (opt.vol1 == NULL || opt.vol2 == NULL) { + err_printf("You must specify exactly 2 volumes.\n"); + usage(); + } + + stderr = stdout; + +#ifdef DEBUG + if (!opt.debug) + if (!(stderr = fopen("/dev/null", "rw"))) + perr_exit("Couldn't open /dev/null"); + +#endif +} + +static ntfs_attr_search_ctx *attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) +{ + ntfs_attr_search_ctx *ret; + + if ((ret = ntfs_attr_get_search_ctx(ni, mrec)) == NULL) + perr_println("ntfs_attr_get_search_ctx"); + + return ret; +} + +static void progress_init(struct progress_bar *p, u64 start, u64 stop, int flags) +{ + p->start = start; + p->stop = stop; + p->unit = 100.0 / (stop - start); + p->resolution = 100; + p->flags = flags; +} + +static void progress_update(struct progress_bar *p, u64 current) +{ + float percent; + + if (!(p->flags & NTFS_PROGBAR)) + return; + if (p->flags & NTFS_PROGBAR_SUPPRESS) + return; + + /* WARNING: don't modify the texts, external tools grep for them */ + percent = p->unit * current; + if (current != p->stop) { + if ((current - p->start) % p->resolution) + return; + printf("%6.2f percent completed\r", percent); + } else + printf("100.00 percent completed\n"); + fflush(stdout); +} + +static u64 inumber(ntfs_inode *ni) +{ + if (ni->nr_extents >= 0) + return ni->mft_no; + + return ni->base_ni->mft_no; +} + +static int inode_close(ntfs_inode *ni) +{ + if (ni == NULL) + return 0; + + if (ntfs_inode_close(ni)) { + perr_println("ntfs_inode_close: inode %llu", inumber(ni)); + return -1; + } + return 0; +} + +static inline s64 get_nr_mft_records(ntfs_volume *vol) +{ + return vol->mft_na->initialized_size >> vol->mft_record_size_bits; +} + +#define NTFSCMP_OK 0 +#define NTFSCMP_INODE_OPEN_ERROR 1 +#define NTFSCMP_INODE_OPEN_IO_ERROR 2 +#define NTFSCMP_INODE_OPEN_ENOENT_ERROR 3 +#define NTFSCMP_EXTENSION_RECORD 4 +#define NTFSCMP_INODE_CLOSE_ERROR 5 + +const char *ntfscmp_errs[] = { + "OK", + "INODE_OPEN_ERROR", + "INODE_OPEN_IO_ERROR", + "INODE_OPEN_ENOENT_ERROR", + "EXTENSION_RECORD", + "INODE_CLOSE_ERROR", + "" +}; + + +static const char *err2string(int err) +{ + return ntfscmp_errs[err]; +} + +static const char *ret2string(int ret) +{ + if (ret == -1) + return "FAILED"; + else if (ret != 0) + err_exit("Unhandled return code: %d\n", ret); + return "OK"; +} + +static const char *pret2str(void *p) +{ + if (p == NULL) + return "FAILED"; + return "OK"; +} + +static int inode_open(ntfs_volume *vol, MFT_REF mref, ntfs_inode **ni) +{ + *ni = ntfs_inode_open(vol, mref); + if (*ni == NULL) { + if (errno == EIO) + return NTFSCMP_INODE_OPEN_IO_ERROR; + if (errno == ENOENT) + return NTFSCMP_INODE_OPEN_ENOENT_ERROR; + + perr_println("Reading inode %lld failed", mref); + return NTFSCMP_INODE_OPEN_ERROR; + } + + if ((*ni)->mrec->base_mft_record) { + + if (inode_close(*ni) != 0) + return NTFSCMP_INODE_CLOSE_ERROR; + + return NTFSCMP_EXTENSION_RECORD; + } + + return NTFSCMP_OK; +} + +static ntfs_inode *base_inode(ntfs_attr_search_ctx *ctx) +{ + if (ctx->base_ntfs_ino) + return ctx->base_ntfs_ino; + + return ctx->ntfs_ino; +} + +static void print_inode(u64 inum) +{ + printf("Inode %llu ", inum); +} + +static void print_inode_ni(ntfs_inode *ni) +{ + print_inode(inumber(ni)); +} + +static void print_attribute_type(ATTR_TYPES atype) +{ + printf("attribute 0x%x", atype); +} + +static void print_attribute_name(char *name) +{ + if (name) + printf(":%s", name); +} + +#define GET_ATTR_NAME(a) \ + ((ntfschar *)(((u8 *)(a)) + ((a)->name_offset))), ((a)->name_length) + +static char *get_attr_name(u64 mft_no, + ATTR_TYPES atype, + const ntfschar *uname, + const int uname_len) +{ + char *name = NULL; + int name_len; + + if (atype == AT_END) + return NULL; + + name_len = ntfs_ucstombs(uname, uname_len, &name, 0); + if (name_len < 0) { + perr_print("ntfs_ucstombs"); + print_inode(mft_no); + print_attribute_type(atype); + puts(""); + exit(1); + + } else if (name_len > 0) + return name; + + return NULL; +} + +static char *get_attr_name_na(ntfs_attr *na) +{ + return get_attr_name(inumber(na->ni), na->type, na->name, na->name_len); +} + +static char *get_attr_name_ctx(ntfs_attr_search_ctx *ctx) +{ + u64 mft_no = inumber(ctx->ntfs_ino); + ATTR_TYPES atype = ctx->attr->type; + + return get_attr_name(mft_no, atype, GET_ATTR_NAME(ctx->attr)); +} + +static void print_attribute(ATTR_TYPES atype, char *name) +{ + print_attribute_type(atype); + print_attribute_name(name); + printf(" "); +} + +static void print_na(ntfs_attr *na) +{ + print_inode_ni(na->ni); + print_attribute(na->type, get_attr_name_na(na)); +} + +static void print_attribute_ctx(ntfs_attr_search_ctx *ctx) +{ + print_attribute(ctx->attr->type, get_attr_name_ctx(ctx)); +} + +static void print_ctx(ntfs_attr_search_ctx *ctx) +{ + print_inode_ni(base_inode(ctx)); + print_attribute(ctx->attr->type, get_attr_name_ctx(ctx)); +} + +static void cmp_attribute_data(ntfs_attr *na1, ntfs_attr *na2) +{ + s64 pos; + s64 count1 = 0, count2; + u8 buf1[NTFS_BUF_SIZE]; + u8 buf2[NTFS_BUF_SIZE]; + + for (pos = 0; pos <= na1->data_size; pos += count1) { + + count1 = ntfs_attr_pread(na1, pos, NTFS_BUF_SIZE, buf1); + count2 = ntfs_attr_pread(na2, pos, NTFS_BUF_SIZE, buf2); + + if (count1 != count2) { + print_na(na1); + printf("abrupt length: %lld != %lld ", + na1->data_size, na2->data_size); + Vprintf("(count: %lld != %lld)", count1, count2); + puts(""); + return; + } + + if (count1 == -1) { + err_printf("%s read error: ", __FUNCTION__); + print_na(na1); + printf("len = %lld, pos = %lld\n", na1->data_size, pos); + exit(1); + } + + if (count1 == 0) { + + if (pos + count1 == na1->data_size) + return; /* we are ready */ + + err_printf("%s read error before EOF: ", __FUNCTION__); + print_na(na1); + printf("%lld != %lld\n", pos + count1, na1->data_size); + exit(1); + } + + if (memcmp(buf1, buf2, count1)) { + print_na(na1); + printf("content"); + Vprintf(" (len = %lld)", count1); + printf(": DIFFER\n"); + return; + } + } + + err_printf("%s read overrun: ", __FUNCTION__); + print_na(na1); + err_printf("(len = %lld, pos = %lld, count = %lld)\n", + na1->data_size, pos, count1); + exit(1); +} + +static void cmp_attribute(ntfs_attr_search_ctx *ctx1, + ntfs_attr_search_ctx *ctx2) +{ + ATTR_RECORD *a1 = ctx1->attr; + ATTR_RECORD *a2 = ctx2->attr; + ntfs_attr *na1, *na2; + + na1 = ntfs_attr_open(base_inode(ctx1), a1->type, GET_ATTR_NAME(a1)); + na2 = ntfs_attr_open(base_inode(ctx2), a2->type, GET_ATTR_NAME(a2)); + + if ((!na1 && na2) || (na1 && !na2)) { + print_ctx(ctx1); + printf("open: %s != %s\n", pret2str(na1), pret2str(na2)); + goto close_attribs; + } + + if (na1 == NULL) + goto close_attribs; + + if (na1->data_size != na2->data_size) { + print_na(na1); + printf("length: %lld != %lld\n", na1->data_size, na2->data_size); + goto close_attribs; + } + + cmp_attribute_data(na1, na2); + +close_attribs: + ntfs_attr_close(na1); + ntfs_attr_close(na2); +} + +static void vprint_attribute(ATTR_TYPES atype, char *name) +{ + Vprintf("0x%x", atype); + if (name) + Vprintf(":%s", name); + Vprintf(" "); +} + +static void print_attributes(ntfs_inode *ni, + ATTR_TYPES atype1, + ATTR_TYPES atype2, + char *name1, + char *name2) +{ + Vprintf("Walking inode %llu attributes: ", inumber(ni)); + vprint_attribute(atype1, name1); + vprint_attribute(atype2, name2); + Vprintf("\n"); +} + +static int new_attribute(ntfs_attr_search_ctx *ctx, + ATTR_TYPES prev_atype, + char *prev_name) +{ + char *name = get_attr_name_ctx(ctx); + + if (!ctx->attr->non_resident) + return 1; + + if (prev_atype != ctx->attr->type) + return 1; + + if (prev_name && name) { + if (strcmp(prev_name, name) != 0) + return 1; + } else if (prev_name || name) + return 1; + + print_inode(base_inode(ctx)->mft_no); + print_attribute_ctx(ctx); + Vprintf("extent %llu lowest_vcn %lld: SKIPPED\n", + ctx->ntfs_ino->mft_no, ctx->attr->lowest_vcn); + + return 0; +} + +static void set_prev(char **prev_name, char *name, char *name_unused, + ATTR_TYPES *prev_atype, ATTR_TYPES atype) +{ + if (*prev_name) + free(*prev_name); + *prev_name = name; + + free(name_unused); + + *prev_atype = atype; +} + +static int cmp_attributes(ntfs_inode *ni1, ntfs_inode *ni2) +{ + int ret = -1; + int ret1 = 0, ret2 = 0; + int prev_first = 1; + char *prev_name = NULL, *name1, *name2; + ATTR_TYPES prev_atype, atype1, atype2; + ntfs_attr_search_ctx *ctx1, *ctx2; + + if (!(ctx1 = attr_get_search_ctx(ni1, NULL))) + return -1; + if (!(ctx2 = attr_get_search_ctx(ni2, NULL))) + goto out; + + atype1 = ctx1->attr->type; + atype2 = ctx2->attr->type; + + while (1) { + if (atype1 <= atype2) + ret1 = ntfs_attrs_walk(ctx1); + if (atype1 >= atype2) + ret2 = ntfs_attrs_walk(ctx2); + + atype1 = ctx1->attr->type; + atype2 = ctx2->attr->type; + name1 = get_attr_name_ctx(ctx1); + name2 = get_attr_name_ctx(ctx2); + + print_attributes(ni1, atype1, atype2, name1, name2); + + if (atype1 != AT_END && atype2 != AT_END && ret1 != ret2) { + print_inode_ni(ni1); + printf("attribute_walk: %s != %s\n", + ret2string(ret1), ret2string(ret2)); + break; + } + + if (atype1 == atype2) { + + if (atype1 == AT_END) + break; + + if (prev_first || new_attribute(ctx1, prev_atype, prev_name)) { + prev_first = 0; + cmp_attribute(ctx1, ctx2); + set_prev(&prev_name, name1, name2, &prev_atype, atype1); + } + + } else if (atype2 == AT_END || atype1 < atype2) { + if (prev_first || new_attribute(ctx1, prev_atype, prev_name)) { + prev_first = 0; + print_ctx(ctx1); + printf("presence: EXISTS != MISSING\n"); + set_prev(&prev_name, name1, name2, &prev_atype, atype1); + } + + } else /* atype1 == AT_END || atype1 > atype2) */ { + if (prev_first || new_attribute(ctx2, prev_atype, prev_name)) { + prev_first = 0; + print_ctx(ctx2); + printf("presence: MISSING != EXISTS \n"); + set_prev(&prev_name, name2, name1, &prev_atype, atype2); + } + } + } + + ret = 0; + ntfs_attr_put_search_ctx(ctx2); +out: + ntfs_attr_put_search_ctx(ctx1); + return ret; +} + +static int cmp_inodes(ntfs_volume *vol1, ntfs_volume *vol2) +{ + u64 inode; + int ret1, ret2; + ntfs_inode *ni1, *ni2; + struct progress_bar progress; + int pb_flags = 0; /* progress bar flags */ + u64 nr_mft_records, nr_mft_records2; + + if (opt.show_progress) + pb_flags |= NTFS_PROGBAR; + + nr_mft_records = get_nr_mft_records(vol1); + nr_mft_records2 = get_nr_mft_records(vol2); + + if (nr_mft_records != nr_mft_records2) { + + printf("Number of mft records: %lld != %lld\n", + nr_mft_records, nr_mft_records2); + + if (nr_mft_records > nr_mft_records2) + nr_mft_records = nr_mft_records2; + } + + progress_init(&progress, 0, nr_mft_records - 1, pb_flags); + progress_update(&progress, 0); + + for (inode = 0; inode < nr_mft_records; inode++) { + + /* FIXME: needs special handling */ + if (inode == 8) + continue; + + ret1 = inode_open(vol1, (MFT_REF)inode, &ni1); + ret2 = inode_open(vol2, (MFT_REF)inode, &ni2); + + if (ret1 != ret2) { + print_inode(inode); + printf("open: %s != %s\n", + err2string(ret1), err2string(ret2)); + goto close_inodes; + } + + if (ret1 != NTFSCMP_OK) + goto close_inodes; + + if (cmp_attributes(ni1, ni2) != 0) { + inode_close(ni1); + inode_close(ni2); + return -1; + } +close_inodes: + if (inode_close(ni1) != 0) + return -1; + if (inode_close(ni2) != 0) + return -1; + + progress_update(&progress, inode); + } + return 0; +} + +static ntfs_volume *mount_volume(const char *volume) +{ + unsigned long mntflag; + ntfs_volume *vol = NULL; + + if (ntfs_check_if_mounted(volume, &mntflag)) { + perr_println("Failed to check '%s' mount state", volume); + printf("Probably /etc/mtab is missing. It's too risky to " + "continue. You might try\nan another Linux distro.\n"); + exit(1); + } + if (mntflag & NTFS_MF_MOUNTED) { + if (!(mntflag & NTFS_MF_READONLY)) + err_exit("Device '%s' is mounted read-write. " + "You must 'umount' it first.\n", volume); + } + + vol = ntfs_mount(volume, MS_RDONLY); + if (vol == NULL) { + + int err = errno; + + perr_println("Opening '%s' as NTFS failed", volume); + if (err == EINVAL) + printf(invalid_ntfs_msg, volume); + else if (err == EIO) + printf(corrupt_volume_msg); + else if (err == EPERM) + printf(hibernated_volume_msg); + exit(1); + } + + return vol; +} + +int main(int argc, char **argv) +{ + ntfs_volume *vol1; + ntfs_volume *vol2; + + printf("%s v%s\n", EXEC_NAME, VERSION); + + parse_options(argc, argv); + + utils_set_locale(); + + vol1 = mount_volume(opt.vol1); + vol2 = mount_volume(opt.vol2); + + if (cmp_inodes(vol1, vol2) != 0) + exit(1); + + exit(0); +} + From 190e59886f8d431d04e1a1cb0d621b505e77d6e1 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 26 Aug 2005 11:44:11 +0000 Subject: [PATCH 2493/2994] Define PATH_MAX if not defined in ntfsprogs/ntfsmount.c and libntfs/volume.c. Needed to compile on DOS with djgpp. (Christophe) --- ChangeLog | 2 ++ libntfs/volume.c | 4 ++++ ntfsprogs/ntfsmount.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0d3e3117..b1663149 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,6 +38,8 @@ xx/xx/2005 - 1.12.0-WIP it to be present. (Christophe) - ntfscluster: fix incorrect volume usage calculation. (Szaka) - ntfscluster, utils.c::mft_next_record(): fix gigaleak. (Szaka) + - Define PATH_MAX if not defined in ntfsprogs/ntfsmount.c and + libntfs/volume.c. Needed to compile on DOS with djgpp. (Christophe) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/libntfs/volume.c b/libntfs/volume.c index de62914d..2142ce44 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -42,6 +42,10 @@ #include "logfile.h" #include "dir.h" +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + /** * ntfs_volume_alloc - * diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index bf25e9a6..6171709b 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -48,6 +48,10 @@ #include "index.h" #include "utils.h" +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + typedef struct { fuse_fill_dir_t filler; void *buf; From 14702e50f21b578632d3dd052798783ce42e3114 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 26 Aug 2005 12:23:00 +0000 Subject: [PATCH 2494/2994] ntfsmount: Aplly patch from Yuval with minor fixes to it. Temporary remove kernel_cache from default options. --- ChangeLog | 1 + ntfsprogs/ntfsmount.c | 151 +++++++++++++++++++++++++++++++++--------- 2 files changed, 121 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1663149..a0f112a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,7 @@ xx/xx/2005 - 1.12.0-WIP - ntfscluster, utils.c::mft_next_record(): fix gigaleak. (Szaka) - Define PATH_MAX if not defined in ntfsprogs/ntfsmount.c and libntfs/volume.c. Needed to compile on DOS with djgpp. (Christophe) + - Switch ntfsmount to use getoptlong. (Yuval, minor fixes by Yura) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 6171709b..b97a0e7a 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #ifdef HAVE_SETXATTR @@ -79,13 +80,20 @@ typedef enum { free MFT records is outdated. */ } ntfs_fuse_state_bits; +static struct options { + char *mnt_point; /* Mount point */ + char *options; /* Mount options */ + int quiet; /* Less output */ + int verbose; /* Extra output */ +} opts; + static const char *EXEC_NAME = "ntfsmount"; -static char def_opts[] = "default_permissions,kernel_cache,allow_other,"; +static char def_opts[] = "default_permissions,allow_other,"; static ntfs_fuse_context_t *ctx; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stderr, NULL, TRUE) -GEN_PRINTF(Qprintf, stderr, NULL, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stderr, &opts.verbose, TRUE) +GEN_PRINTF(Qprintf, stderr, &opts.quiet, FALSE) static long ntfs_fuse_get_nr_free_mft_records(ntfs_volume *vol) { @@ -1097,11 +1105,11 @@ static void signal_handler(int arg __attribute__((unused))) fuse_exit((fuse_get_context())->fuse); } -static char *parse_options(char *options, char **device) +static char *parse_mount_options(char *org_options, char **device) { - char *opts, *s, *opt, *val, *ret; + char *options, *s, *opt, *val, *ret; BOOL no_def_opts = FALSE; - + *device = NULL; /* * +3 for different in length of "fsname=..." and "dev=...". @@ -1109,18 +1117,18 @@ static char *parse_options(char *options, char **device) * +1 for null-terminator. * +PATH_MAX for resolved by realpath() device name */ - ret = malloc(strlen(def_opts) + strlen(options) + 5 + PATH_MAX); + ret = malloc(strlen(def_opts) + strlen(org_options) + 5 + PATH_MAX); if (!ret) { perror("malloc failed"); return NULL; } *ret = 0; - opts = strdup(options); - if (!opts) { + options = strdup(org_options); + if (!options) { perror("strdump failed"); return NULL; } - s = opts; + s = options; while ((val = strsep(&s, ","))) { opt = strsep(&val, "="); if (!strcmp(opt, "dev")) { /* Device to mount. */ @@ -1239,7 +1247,7 @@ static char *parse_options(char *options, char **device) strcat(ret, "fsname="); strcat(ret, *device); exit: - free(opts); + free(options); return ret; err_exit: free(ret); @@ -1261,9 +1269,102 @@ static void usage(void) Eprintf("Default options are: \"%s\".\n", def_opts); } +/** + * parse_options - Read and validate the programs command line + * + * Read the command line, verify the syntax and parse the options. + * This function is very long, but quite simple. + * + * Return: 1 Success + * 0 Error, one or more problems + */ +static int parse_options (int argc, char *argv[]) +{ + int err = 0, help = 0; + char c = -1; + + static const char *sopt = "-o:h?qv"; + static const struct option lopt[] = { + { "options", required_argument, NULL, 'o' }, + { "help", no_argument, NULL, 'h' }, + { "quiet", no_argument, NULL, 'q' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 } + }; + + opterr = 0; /* We'll handle the errors, thank you. */ + + opts.mnt_point = NULL; + opts.options = NULL; + + while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + switch (c) { + case 1: /* A non-option argument */ + if (!opts.mnt_point) + opts.mnt_point = argv[optind - 1]; + else { + Eprintf("You must specify exactly one " + "mount point.\n"); + err++; + } + break; + case 'o': + if (!opts.options) + opts.options = argv[optind - 1]; + else { + Eprintf("You must specify exactly one " + "set of options.\n"); + err++; + } + break; + case 'h': + case '?': + help++; + break; + case 'q': + opts.quiet++; + break; + case 'v': + opts.verbose++; + break; + default: + Eprintf("Unknown option '%s'.\n", argv[optind-1]); + err++; + break; + } + } + + if (help) { + opts.quiet = 0; + } else { + if (!opts.options) { + Eprintf("No mount options passed, but 'dev' option is " + "mandatory.\n"); + err++; + } + + if (!opts.mnt_point) { + if (argc > 1) + Eprintf("No mount point specified.\n"); + err++; + } + + if (opts.quiet && opts.verbose) { + Eprintf("You may not use --quiet and --verbose at " + "the same time.\n"); + err++; + } + } + + if (help || err) + usage(); + + return (!help && !err); +} + int main(int argc, char *argv[]) { - char *options, *parsed_options, *mnt_point, *device; + char *parsed_options, *device; struct fuse *fh; int ffd; @@ -1271,24 +1372,12 @@ int main(int argc, char *argv[]) signal(SIGINT, signal_handler); signal(SIGTERM, signal_handler); - /* Simple arguments parse code. */ - if (argc != 4) { - usage(); + if (!parse_options(argc, argv)) return 1; - } - if (!strcmp(argv[1], "-o")) { - options = argv[2]; - mnt_point = argv[3]; - } else if (!strcmp(argv[2], "-o")) { - options = argv[3]; - mnt_point = argv[1]; - } else { - usage(); - return 1; - } + ntfs_fuse_init(); /* Parse options. */ - parsed_options = parse_options(options, &device); + parsed_options = parse_mount_options(opts.options, &device); if (!device) { Eprintf("'dev' option is mandatory.\n"); ntfs_fuse_destroy(); @@ -1308,7 +1397,7 @@ int main(int argc, char *argv[]) } free(device); /* Create filesystem. */ - ffd = fuse_mount(mnt_point, parsed_options); + ffd = fuse_mount(opts.mnt_point, parsed_options); if (ffd == -1) { Eprintf("fuse_mount failed.\n"); ntfs_fuse_destroy(); @@ -1324,7 +1413,7 @@ int main(int argc, char *argv[]) if (!fh) { Eprintf("fuse_new failed.\n"); close(ffd); - fuse_unmount(mnt_point); + fuse_unmount(opts.mnt_point); ntfs_fuse_destroy(); return 6; } @@ -1339,7 +1428,7 @@ int main(int argc, char *argv[]) /* Destroy. */ fuse_destroy(fh); close(ffd); - fuse_unmount(mnt_point); + fuse_unmount(opts.mnt_point); ntfs_fuse_destroy(); return 0; } From f80efa5e9a366f208b6fc16faeda0a2f5097e5cb Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 26 Aug 2005 12:25:13 +0000 Subject: [PATCH 2495/2994] Make ntfsdecrypt compile. --- ntfsprogs/ntfsdecrypt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index e893c001..b1bf40cc 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -965,7 +965,7 @@ static ntfs_fek *ntfs_df_array_fek_get(EFS_DF_ARRAY_HEADER *df_array, { EFS_DF_HEADER *df_header; EFS_DF_CREDENTIAL_HEADER *df_cred; - EFS_DF_CERTIFICATE_HEADER *df_cert; + EFS_DF_CERT_THUMBPRINT_HEADER *df_cert; u8 *fek_buf; ntfs_fek *fek; u32 df_count, fek_size; @@ -976,8 +976,9 @@ static ntfs_fek *ntfs_df_array_fek_get(EFS_DF_ARRAY_HEADER *df_array, for (i = 0; i < df_count; i++) { df_cred = (EFS_DF_CREDENTIAL_HEADER*)((u8*)df_header + le32_to_cpu(df_header->cred_header_offset)); - df_cert = (EFS_DF_CERTIFICATE_HEADER*)((u8*)df_cred + - le32_to_cpu(df_cred->cert_header_offset)); + df_cert = (EFS_DF_CERT_THUMBPRINT_HEADER*)((u8*)df_cred + + le32_to_cpu( + df_cred->cert_thumbprint_header_offset)); fek_size = le32_to_cpu(df_header->fek_size); fek_buf = (u8*)df_header + le32_to_cpu(df_header->fek_offset); /* Decrypt the FEK. Note: This is done in place. */ From c3727658cac142caaae3c97cb6870903edd8124d Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 26 Aug 2005 20:17:08 +0000 Subject: [PATCH 2496/2994] * Fix filenames collation. * Minor comment cleanup. --- include/ntfs/collate.h | 4 ++-- libntfs/collate.c | 2 +- libntfs/index.c | 12 ++++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/ntfs/collate.h b/include/ntfs/collate.h index e51eaa56..ee92e43d 100644 --- a/include/ntfs/collate.h +++ b/include/ntfs/collate.h @@ -1,6 +1,6 @@ /* - * collate.h - Defines for NTFS kernel collation handling. Part of the - * Linux-NTFS project. + * collate.h - Defines for NTFS collation handling. Part of the Linux-NTFS + * project. * * Copyright (c) 2004 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy diff --git a/libntfs/collate.c b/libntfs/collate.c index 885fa6d3..15251b09 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -1,5 +1,5 @@ /* - * collate.c - NTFS kernel collation handling. Part of the Linux-NTFS project. + * collate.c - NTFS collation handling. Part of the Linux-NTFS project. * * Copyright (c) 2004 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy diff --git a/libntfs/index.c b/libntfs/index.c index 2fbe4ee2..06cf70c1 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -256,6 +256,12 @@ done: */ rc = ntfs_collate(vol, cr, key, key_len, &ie->key, le16_to_cpu(ie->key_length)); + if (rc == NTFS_COLLATION_ERROR) { + ntfs_error(, "Collation error. Probably filename " + "contain invalid characters."); + err = ERANGE; + goto err_out; + } /* * If @key collates before the key of the current entry, there * is definitely no such key in this index but we might need to @@ -384,6 +390,12 @@ ia_done: */ rc = ntfs_collate(vol, cr, key, key_len, &ie->key, le16_to_cpu(ie->key_length)); + if (rc == NTFS_COLLATION_ERROR) { + ntfs_error(, "Collation error. Probably filename " + "contain invalid characters."); + err = ERANGE; + goto err_out; + } /* * If @key collates before the key of the current entry, there * is definitely no such key in this index but we might need to From 3164c705f7a27d6e9879d33f0a1cbd6c6fe3512d Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 31 Aug 2005 14:31:53 +0000 Subject: [PATCH 2497/2994] ntfsmount: Apply patch from Yuval to fix 'df' output. --- ChangeLog | 3 ++- ntfsprogs/ntfsmount.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a0f112a5..b024320d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,7 +40,8 @@ xx/xx/2005 - 1.12.0-WIP - ntfscluster, utils.c::mft_next_record(): fix gigaleak. (Szaka) - Define PATH_MAX if not defined in ntfsprogs/ntfsmount.c and libntfs/volume.c. Needed to compile on DOS with djgpp. (Christophe) - - Switch ntfsmount to use getoptlong. (Yuval, minor fixes by Yura) + - Switch ntfsmount to use getopt_long. (Yuval, minor fixes by Yura) + - ntfsmount: Fix 'df' output. (Yuval) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index b97a0e7a..4447c6ba 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -188,7 +188,7 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), /* Type of filesystem. */ sfs->f_type = NTFS_SB_MAGIC; /* Optimal transfer block size. */ - sfs->f_bsize = NTFS_BLOCK_SIZE; + sfs->f_bsize = vol->cluster_size; /* * Total data blocks in file system in units of f_bsize and since * inodes are also stored in data blocs ($MFT is a file) this is just From ea0202921d36807a463180ef4ece5ab9b9e84d27 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 10 Sep 2005 07:55:58 +0000 Subject: [PATCH 2498/2994] Clarify the logfile check/hibernation warning. (Yuval) --- ntfsprogs/utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index fd8e3dbe..c00bfcdb 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -160,8 +160,10 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL Eprintf("Couldn't mount device '%s': %s\n", device, strerror(err)); if (err == EOPNOTSUPP) - Eprintf("It seems that the logfile check failed. " - "Try to mount volume in windows.\n"); + Eprintf("Windows was either hibernated or did not " + "shut down properly. Try to mount " + "volume in windows, shut down and try " + "again.\n"); return NULL; } From 0ae7e885d1e1abda3eff09a6e9d1535948a4f29d Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 13 Sep 2005 12:51:34 +0000 Subject: [PATCH 2499/2994] bug fix - reading uninitialised memory --- libntfs/runlist.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 5d5c879e..399a74d0 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1,8 +1,8 @@ -/* +/** * runlist.c - Run list handling code. Part of the Linux-NTFS project. * * Copyright (c) 2002-2005 Anton Altaparmakov - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002-2005 Richard Russon * Copyright (c) 2004 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or @@ -52,7 +52,7 @@ static __inline__ void ntfs_rl_mm(runlist_element *base, int dst, int src, /** * Internal: * - * rl_mc - runlist memory copy + * ntfs_rl_mc - runlist memory copy */ static __inline__ void ntfs_rl_mc(runlist_element *dstbase, int dst, runlist_element *srcbase, int src, int size) @@ -381,7 +381,7 @@ static __inline__ runlist_element *ntfs_rl_replace(runlist_element *dst, ntfs_rl_mc(dst, loc, src, left, ssize - left); /* We may have changed the length of the file, so fix the end marker */ - if (dst[magic].lcn == LCN_ENOENT) + if (((dsize - loc - right - 1) > 0) && (dst[magic].lcn == LCN_ENOENT)) dst[magic].vcn = dst[magic - 1].vcn + dst[magic - 1].length; return dst; } From d75567112c820872d5eafa260ae1360991fa56b9 Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 13 Sep 2005 14:30:51 +0000 Subject: [PATCH 2500/2994] put the test code where it's more useful --- Makefile.am | 12 +- configure.ac | 10 + include/ntfs/runlist.h | 4 + libntfs/runlist.c | 372 ++++++ test/Makefile.am | 67 ++ test/runlist-data/attr1.bin | Bin 0 -> 976 bytes test/runlist-data/attr2.bin | Bin 0 -> 976 bytes test/runlist-data/attr3.bin | Bin 0 -> 976 bytes test/runlist-data/frag123 | 2213 +++++++++++++++++++++++++++++++++++ test/runlist-data/frag132 | 2061 ++++++++++++++++++++++++++++++++ test/runlist-data/frag213 | 2213 +++++++++++++++++++++++++++++++++++ test/runlist-data/frag231 | 2133 +++++++++++++++++++++++++++++++++ test/runlist-data/frag312 | 2061 ++++++++++++++++++++++++++++++++ test/runlist-data/frag321 | 2133 +++++++++++++++++++++++++++++++++ test/runlist-data/pure-cm | 551 +++++++++ test/runlist-data/pure-cs | 431 +++++++ test/runlist-data/pure-nm | 561 +++++++++ test/runlist-data/pure-ns | 441 +++++++ test/runlist-data/zero | 13 + test/runlist.c | 7 + 20 files changed, 15282 insertions(+), 1 deletion(-) create mode 100644 test/Makefile.am create mode 100644 test/runlist-data/attr1.bin create mode 100644 test/runlist-data/attr2.bin create mode 100644 test/runlist-data/attr3.bin create mode 100644 test/runlist-data/frag123 create mode 100644 test/runlist-data/frag132 create mode 100644 test/runlist-data/frag213 create mode 100644 test/runlist-data/frag231 create mode 100644 test/runlist-data/frag312 create mode 100644 test/runlist-data/frag321 create mode 100644 test/runlist-data/pure-cm create mode 100644 test/runlist-data/pure-cs create mode 100644 test/runlist-data/pure-nm create mode 100644 test/runlist-data/pure-ns create mode 100644 test/runlist-data/zero create mode 100644 test/runlist.c diff --git a/Makefile.am b/Makefile.am index 01e776a4..5744a1b5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS = doc include libntfs ntfsprogs +SUBDIRS = doc include libntfs ntfsprogs test EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ INSTALL NEWS README autogen.sh ntfsprogs.spec.in \ @@ -26,3 +26,13 @@ extra: extras extras: libs (cd ntfsprogs && $(MAKE) extras) || exit 1; + +if ENABLE_TEST +test: libs + (cd test && $(MAKE) all test) || exit 1; +else +test: + @echo The libntfs test code has been configured out of this release. + @echo "./configure --enable-test" and rebuild. +endif + diff --git a/configure.ac b/configure.ac index 1d924ee7..d626e6e6 100644 --- a/configure.ac +++ b/configure.ac @@ -100,6 +100,15 @@ AC_ARG_ENABLE(warnings, enable_warnings=no ) +AC_ARG_ENABLE(test, + AS_HELP_STRING(--enable-test,compile in test code for libntfs), , + enable_test=no +) +AM_CONDITIONAL(ENABLE_TEST, test "$enable_test" = yes) +if test "$enable_test" = "yes"; then + CFLAGS="$CFLAGS -DNTFS_TEST" +fi + # Use GNU extensions if available. AC_GNU_SOURCE @@ -305,5 +314,6 @@ AC_CONFIG_FILES([ ntfsprogs/ntfsresize.8 ntfsprogs/ntfsundelete.8 ntfsprogs.spec + test/Makefile ]) AC_OUTPUT diff --git a/include/ntfs/runlist.h b/include/ntfs/runlist.h index 995b51cb..1d48a433 100644 --- a/include/ntfs/runlist.h +++ b/include/ntfs/runlist.h @@ -79,5 +79,9 @@ extern int ntfs_rl_truncate(runlist **rl, const VCN start_vcn); extern int ntfs_rl_sparse(runlist *rl); extern s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl); +#ifdef NTFS_TEST +int test_rl_main (int argc, char *argv[]); +#endif + #endif /* defined _NTFS_RUNLIST_H */ diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 399a74d0..479ba77f 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1687,3 +1687,375 @@ s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl) } return ret << vol->cluster_size_bits; } + + +#ifdef NTFS_TEST +/** + * test_rl_helper + */ +#define MKRL(R,V,L,S) \ + (R)->vcn = V; \ + (R)->lcn = L; \ + (R)->length = S; +/* +} +*/ +/** + * test_rl_dump_runlist + */ +static void test_rl_dump_runlist (const runlist_element *rl) +{ + int abbr = 0; /* abbreviate long lists */ + int len = 0; + int i; + const char *lcn_str[5] = { "HOLE", "NOTMAP", "ENOENT", "XXXX" }; + + if (!rl) { + printf(" Run list not present.\n"); + return; + } + + if (abbr) + for (len = 0; rl[len].length; len++) ; + + printf(" VCN LCN len\n"); + for (i = 0; ; i++, rl++) { + LCN lcn = rl->lcn; + + if ((abbr) && (len > 20)) { + if (i == 4) + printf (" ...\n"); + if ((i > 3) && (i < (len - 3))) + continue; + } + + if (lcn < (LCN)0) { + int ind = -lcn - 1; + + if (ind > -LCN_ENOENT - 1) + ind = 3; + //printf("%8llx %8s %8llx\n", + printf("%8lld %8s %8lld\n", + rl->vcn, lcn_str[ind], rl->length); + } else + //printf("%8llx %8llx %8llx\n", + printf("%8lld %8lld %8lld\n", + rl->vcn, rl->lcn, rl->length); + if (!rl->length) + break; + } + if ((abbr) && (len > 20)) + printf (" (%d entries)\n", len+1); + printf ("\n"); +} + +/** + * test_rl_runlists_merge + */ +static runlist_element * test_rl_runlists_merge (runlist_element *drl, runlist_element *srl) +{ + runlist_element *res = NULL; + + printf ("dst:\n"); + test_rl_dump_runlist (drl); + printf ("src:\n"); + test_rl_dump_runlist (srl); + + res = ntfs_runlists_merge (drl, srl); + + printf ("res:\n"); + test_rl_dump_runlist (res); + + return res; +} + +/** + * test_rl_read_buffer + */ +static int test_rl_read_buffer (const char *file, u8 *buf, int bufsize) +{ + FILE *fptr; + + fptr = fopen (file, "r"); + if (!fptr) { + printf ("open %s\n", file); + return 0; + } + + memset (buf, 0, bufsize); + if (fread (buf, bufsize, 1, fptr) == 99) { + printf ("read %s\n", file); + return 0; + } + + fclose (fptr); + return 1; +} + +/** + * test_rl_pure_src + */ +static runlist_element * test_rl_pure_src (BOOL contig, BOOL multi, int vcn, int len) +{ + runlist_element *result; + int fudge; + + if (contig) + fudge = 0; + else + fudge = 999; + + result = malloc (4096); + memset (result, -7, 4096); + if (multi) { + MKRL (result+0, vcn + (0*len/4), fudge + vcn + 1000 + (0*len/4), len / 4) + MKRL (result+1, vcn + (1*len/4), fudge + vcn + 1000 + (1*len/4), len / 4) + MKRL (result+2, vcn + (2*len/4), fudge + vcn + 1000 + (2*len/4), len / 4) + MKRL (result+3, vcn + (3*len/4), fudge + vcn + 1000 + (3*len/4), len / 4) + MKRL (result+4, vcn + (4*len/4), LCN_RL_NOT_MAPPED, 0) + } else { + MKRL (result+0, vcn, fudge + vcn + 1000, len) + MKRL (result+1, vcn + len, LCN_RL_NOT_MAPPED, 0) + } + return result; +} + +/** + * test_rl_pure_test + */ +static void test_rl_pure_test (int test, BOOL contig, BOOL multi, int vcn, int len, runlist_element *file, int size) +{ + runlist_element *src; + runlist_element *dst; + runlist_element *res; + + src = test_rl_pure_src (contig, multi, vcn, len); + dst = malloc (4096); + + memset (dst, -7, 4096); + memcpy (dst, file, size); + + printf ("Test %2d ----------\n", test); + res = test_rl_runlists_merge (dst, src); + + free (res); + test = 0; +} + +/** + * test_rl_pure + */ +static void test_rl_pure (char *contig, char *multi) +{ + /* VCN, LCN, len */ + static runlist_element file1[] = { + { 0, -1, 100 }, /* HOLE */ + { 100, 1100, 100 }, /* DATA */ + { 200, -1, 100 }, /* HOLE */ + { 300, 1300, 100 }, /* DATA */ + { 400, -1, 100 }, /* HOLE */ + { 500, -3, 0 } /* NOENT */ + }; + static runlist_element file2[] = { + { 0, 1000, 100 }, /* DATA */ + { 100, -1, 100 }, /* HOLE */ + { 200, -3, 0 } /* NOENT */ + }; + static runlist_element file3[] = { + { 0, 1000, 100 }, /* DATA */ + { 100, -3, 0 } /* NOENT */ + }; + static runlist_element file4[] = { + { 0, -3, 0 } /* NOENT */ + }; +#if 0 + static runlist_element file5[] = { + { 0, -1, 100 }, /* HOLE */ + { 100, 1100, 100 }, /* DATA */ + { 200, -1, 100 }, /* HOLE */ + { 300, 1300, 100 }, /* DATA */ + { 400, -1, 100 }, /* HOLE */ + { 500, -2, 0 } /* NOT_MAPPED */ + }; + static runlist_element file6[] = { + { 0, 1000, 100 }, /* DATA */ + { 100, -1, 100 }, /* HOLE */ + { 200, -2, 0 } /* NOT_MAPPED */ + }; + static runlist_element file7[] = { + { 0, 1000, 100 }, /* DATA */ + { 100, -2, 0 } /* NOT_MAPPED */ + }; + static runlist_element file8[] = { + { 0, -2, 0 } /* NOT_MAPPED */ + }; +#endif + BOOL c, m; + + if (strcmp (contig, "contig") == 0) + c = TRUE; + else if (strcmp (contig, "noncontig") == 0) + c = FALSE; + else { + printf ("rl pure [contig|noncontig] [single|multi]\n"); + return; + } + if (strcmp (multi, "multi") == 0) + m = TRUE; + else if (strcmp (multi, "single") == 0) + m = FALSE; + else { + printf ("rl pure [contig|noncontig] [single|multi]\n"); + return; + } + + test_rl_pure_test (1, c, m, 0, 40, file1, sizeof (file1)); + test_rl_pure_test (2, c, m, 40, 40, file1, sizeof (file1)); + test_rl_pure_test (3, c, m, 60, 40, file1, sizeof (file1)); + test_rl_pure_test (4, c, m, 0, 100, file1, sizeof (file1)); + test_rl_pure_test (5, c, m, 200, 40, file1, sizeof (file1)); + test_rl_pure_test (6, c, m, 240, 40, file1, sizeof (file1)); + test_rl_pure_test (7, c, m, 260, 40, file1, sizeof (file1)); + test_rl_pure_test (8, c, m, 200, 100, file1, sizeof (file1)); + test_rl_pure_test (9, c, m, 400, 40, file1, sizeof (file1)); + test_rl_pure_test (10, c, m, 440, 40, file1, sizeof (file1)); + test_rl_pure_test (11, c, m, 460, 40, file1, sizeof (file1)); + test_rl_pure_test (12, c, m, 400, 100, file1, sizeof (file1)); + test_rl_pure_test (13, c, m, 160, 100, file2, sizeof (file2)); + test_rl_pure_test (14, c, m, 100, 140, file2, sizeof (file2)); + test_rl_pure_test (15, c, m, 200, 40, file2, sizeof (file2)); + test_rl_pure_test (16, c, m, 240, 40, file2, sizeof (file2)); + test_rl_pure_test (17, c, m, 100, 40, file3, sizeof (file3)); + test_rl_pure_test (18, c, m, 140, 40, file3, sizeof (file3)); + test_rl_pure_test (19, c, m, 0, 40, file4, sizeof (file4)); + test_rl_pure_test (20, c, m, 40, 40, file4, sizeof (file4)); + +#if 0 + test_rl_pure_test (21, c, m, 0, 40, file5, sizeof (file5)); + test_rl_pure_test (22, c, m, 40, 40, file5, sizeof (file5)); + test_rl_pure_test (23, c, m, 60, 40, file5, sizeof (file5)); + test_rl_pure_test (24, c, m, 0, 100, file5, sizeof (file5)); + test_rl_pure_test (25, c, m, 200, 40, file5, sizeof (file5)); + test_rl_pure_test (26, c, m, 240, 40, file5, sizeof (file5)); + test_rl_pure_test (27, c, m, 260, 40, file5, sizeof (file5)); + test_rl_pure_test (28, c, m, 200, 100, file5, sizeof (file5)); + test_rl_pure_test (29, c, m, 400, 40, file5, sizeof (file5)); + test_rl_pure_test (30, c, m, 440, 40, file5, sizeof (file5)); + test_rl_pure_test (31, c, m, 460, 40, file5, sizeof (file5)); + test_rl_pure_test (32, c, m, 400, 100, file5, sizeof (file5)); + test_rl_pure_test (33, c, m, 160, 100, file6, sizeof (file6)); + test_rl_pure_test (34, c, m, 100, 140, file6, sizeof (file6)); + test_rl_pure_test (35, c, m, 200, 40, file6, sizeof (file6)); + test_rl_pure_test (36, c, m, 240, 40, file6, sizeof (file6)); + test_rl_pure_test (37, c, m, 100, 40, file7, sizeof (file7)); + test_rl_pure_test (38, c, m, 140, 40, file7, sizeof (file7)); + test_rl_pure_test (39, c, m, 0, 40, file8, sizeof (file8)); + test_rl_pure_test (40, c, m, 40, 40, file8, sizeof (file8)); +#endif +} + +/** + * test_rl_zero + */ +static void test_rl_zero (void) +{ + runlist_element *jim = NULL; + runlist_element *bob = NULL; + + bob = calloc (3, sizeof (runlist_element)); + if (!bob) + return; + + MKRL(bob+0, 10, 99, 5) + MKRL(bob+1, 15, LCN_RL_NOT_MAPPED, 0) + + jim = test_rl_runlists_merge (jim, bob); + if (!jim) + return; + + free (jim); +} + +/** + * test_rl_frag_combine + */ +static void test_rl_frag_combine (ntfs_volume *vol, ATTR_RECORD *attr1, ATTR_RECORD *attr2, ATTR_RECORD *attr3) +{ + runlist_element *run1; + runlist_element *run2; + runlist_element *run3; + + run1 = ntfs_mapping_pairs_decompress (vol, attr1, NULL); + if (!run1) + return; + + run2 = ntfs_mapping_pairs_decompress (vol, attr2, NULL); + if (!run2) + return; + + run1 = test_rl_runlists_merge (run1, run2); + + run3 = ntfs_mapping_pairs_decompress (vol, attr3, NULL); + if (!run3) + return; + + run1 = test_rl_runlists_merge (run1, run3); + + free (run1); +} + +/** + * test_rl_frag + */ +static void test_rl_frag (char *test) +{ + ntfs_volume vol; + ATTR_RECORD *attr1 = malloc (1024); + ATTR_RECORD *attr2 = malloc (1024); + ATTR_RECORD *attr3 = malloc (1024); + + if (!attr1 || !attr2 || !attr3) + goto out; + + vol.sb = NULL; + vol.sector_size_bits = 9; + vol.cluster_size = 2048; + vol.cluster_size_bits = 11; + vol.major_ver = 3; + + if (!test_rl_read_buffer ("runlist-data/attr1.bin", (u8*) attr1, 1024)) + goto out; + if (!test_rl_read_buffer ("runlist-data/attr2.bin", (u8*) attr2, 1024)) + goto out; + if (!test_rl_read_buffer ("runlist-data/attr3.bin", (u8*) attr3, 1024)) + goto out; + + if (strcmp (test, "123") == 0) test_rl_frag_combine (&vol, attr1, attr2, attr3); + else if (strcmp (test, "132") == 0) test_rl_frag_combine (&vol, attr1, attr3, attr2); + else if (strcmp (test, "213") == 0) test_rl_frag_combine (&vol, attr2, attr1, attr3); + else if (strcmp (test, "231") == 0) test_rl_frag_combine (&vol, attr2, attr3, attr1); + else if (strcmp (test, "312") == 0) test_rl_frag_combine (&vol, attr3, attr1, attr2); + else if (strcmp (test, "321") == 0) test_rl_frag_combine (&vol, attr3, attr2, attr1); + else printf ("Frag: No such test '%s'\n", test); + +out: + free (attr1); + free (attr2); + free (attr3); +} + +/** + * test_rl_main + */ +int test_rl_main (int argc, char *argv[]) +{ + if ((argc == 2) && (strcmp (argv[1], "zero") == 0)) test_rl_zero(); + else if ((argc == 3) && (strcmp (argv[1], "frag") == 0)) test_rl_frag (argv[2]); + else if ((argc == 4) && (strcmp (argv[1], "pure") == 0)) test_rl_pure (argv[2], argv[3]); + else printf ("rl [zero|frag|pure] {args}\n"); + + return 0; +} + +#endif + diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 00000000..9c7f9daf --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,67 @@ +if REALLYSTATIC +AM_LIBS = $(top_builddir)/libntfs/.libs/libntfs.a +AM_LFLAGS = -static +STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +else +AM_LIBS = $(top_builddir)/libntfs/libntfs.la +AM_LFLAGS = $(all_libraries) +LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +endif + +# Workaround to make REALLYSTATIC work with automake 1.5. +LINK=$(STATIC_LINK) $(LIBTOOL_LINK) + +#TEST_VALGRIND = valgrind +TEST_RUNLIST = runlist + +bin_PROGRAMS = $(TEST_RUNLIST) + +CLEANFILES = attr[123].bin frag[123][123][123] pure-[cn][ms] zero +MAINTAINERCLEANFILES = Makefile.in + +linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs + +# Set the include path. +AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs $(all_includes) + +runlist_SOURCES = runlist.c +runlist_LDADD = $(AM_LIBS) +runlist_LDFLAGS = $(AM_LFLAGS) + +# Extra targets + +libs: + (cd ../libntfs && $(MAKE) libs) || exit 1; + +test: $(TEST_RUNLIST) testz testp testf + +testz: $(TEST_RUNLIST) + @$(TEST_VALGRIND) $(TEST_RUNLIST) zero > zero + @diff -qs {runlist-data/,}zero + @echo + @echo Success + @echo + +testp: $(TEST_RUNLIST) + @for i in contig noncontig; do \ + for j in single multi; do \ + L1=`echo $$i | cut -b1`; \ + L2=`echo $$j | cut -b1`; \ + FILE=pure-$$L1$$L2; \ + $(TEST_VALGRIND) $(TEST_RUNLIST) pure $$i $$j > $$FILE; \ + diff -qs {runlist-data/,}$$FILE; \ + done; \ + done + @echo + @echo Success + @echo + +testf: $(TEST_RUNLIST) + @for i in 123 132 213 231 312 321; do \ + $(TEST_VALGRIND) $(TEST_RUNLIST) frag $$i > frag$$i; \ + diff -qs {runlist-data/,}frag$$i; \ + done + @echo + @echo Success + @echo + diff --git a/test/runlist-data/attr1.bin b/test/runlist-data/attr1.bin new file mode 100644 index 0000000000000000000000000000000000000000..9ad042c347098bfad1d5ff209dae7ecdb83085de GIT binary patch literal 976 zcmYjQZ)lZe6n~!I^WNRRBWbp6@1*k$E(6ARL`=CnuDF0sVWK!%vUJWV$q&C*6{G{q-vDZ1$0 z4DHBv5b5)p>>ER@_)`N)e^lwESki|lD31|l%ms2=k-*jv@xP4f#9Mv2TQKv!p#B}f zQw4!Ku#-5m$g1q4O)$TnXzo(H#%4>qsavbLwAB&OrW^uM|6Cz)@J;RM%d0sYVxn8y z?R?coh$xGzT=t3&?K0F#eAqrEIQguPFwvFJLJt&akUCz!g#i7=%RcgHMo$@f;lZR} z;oJ0%);YoN^909>13%dkg!O!`g@y#bF@V11@^xz!8&mo2*5qDtk3}oTCTSZI9^DtC zGql5*Fx{T`l-T?23`P12Xt%#M%}`@ZrOCaPp6Su9)~pZFMWR;hiT%XG=hMX1lS=a& zw?VAdS-S3o4&qT~A>FmFr)XQ_iZJp+O6iPzrIIr{2vHDdq(ife1Tso-r`;K)@2mz+qD^bGsQ}KBAKF>*rc|e?{yTb z&KYffr(pGR;_OF;?%stY?b0e`Ah9?_?5#&+Wv@-mvd9abE>- zcf$;EXi~u+_GW@9wTf;*Jjnv>=+>0w22s9jYBy sO~;;9TJ9D4*x}<{-5fzijr+ptsZ?qIhjnrFS>yiu8k5yC`-|r8Cwq_NtN;K2 literal 0 HcmV?d00001 diff --git a/test/runlist-data/attr2.bin b/test/runlist-data/attr2.bin new file mode 100644 index 0000000000000000000000000000000000000000..d46fcc536a73623a152d7abb1bdae07e87fe0dd8 GIT binary patch literal 976 zcmZ{jOGs8x6ov1oqyxjC?7QbonsmA6z4qFBt$Xfp6h+eoQIug!pPLHf zNF2uYF#NYq^fp^;x*VD6VpG1rslv27XIjdbai;LjFe#44vM)A>NV15cTC zIjwf8^eK*}ML2EpeFyp=7)`%M66e1xB|5N%q~srKG;Ja3430LKX0ZPP+^|vOrwxAC zg}o%(gWKs9e1sjp3ca2jB;g7?KbdSv*svm}7g3uoB z5!aQFOMJ~YP)tz@pv@$2!Y?_m9-G>J!>ekU55RT7u(Ww!Ap3OV{2BHn|nr+o{b zdmg?4$~c@Fo?bXjPcAxbH@!H{3BcA`(-61ds1x#VVvcGL63z4~Esu{)rk3^5$0VH+lCBt|+P+%$+maH{Us@*f5NAZ5RrAWmTK2 z+TB{!dsfw&QmDg0OgX#lr0tYqC(};eOkWe3PI-&DH`o$ttC(ZDZVJ6QWD|WjYfjXn zc3~3e zB5zi7{y|Gralw*kuL)CBfVC_XJAr;b45rpZq12m-$t_#xk|%K5fZ|s@T&Z3{;jIYn zZ$b z!-yI+#GFrF5(@4^c1s6F&ntl$pNymrH4qbVFsDNhdjy1gFnz;U?ki^a0A`wcLSmi| zak4c!C~l5t08=-N{Tq*vV_pGbaSh+qBJrYH%nt>_ZcbTcp6R7K8{SMQ(2EI(enDKkW zf>3)9`1qKH?bF+ZY+f@$x3Pu_dW1fwfQ079 z;Jx4&)73jnM{!|ZmoAE`+6C9TP+%`Shch`jw3Zp^&vt@E$|IbEwkA)FEo~b ep!+M_Zb`!5i7Pk^M;KGzzo+EHTJzETN5@|sDB~dj literal 0 HcmV?d00001 diff --git a/test/runlist-data/frag123 b/test/runlist-data/frag123 new file mode 100644 index 00000000..5b660eb4 --- /dev/null +++ b/test/runlist-data/frag123 @@ -0,0 +1,2213 @@ +dst: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 NOTMAP 892 + 1548 ENOENT 0 + +src: + VCN LCN len + 0 NOTMAP 656 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 NOTMAP 0 + +res: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 NOTMAP 386 + 1548 ENOENT 0 + +dst: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 NOTMAP 386 + 1548 ENOENT 0 + +src: + VCN LCN len + 0 NOTMAP 1162 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 NOTMAP 0 + +res: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 ENOENT 0 + diff --git a/test/runlist-data/frag132 b/test/runlist-data/frag132 new file mode 100644 index 00000000..7056f330 --- /dev/null +++ b/test/runlist-data/frag132 @@ -0,0 +1,2061 @@ +dst: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 NOTMAP 892 + 1548 ENOENT 0 + +src: + VCN LCN len + 0 NOTMAP 1162 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 NOTMAP 0 + +res: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 NOTMAP 506 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 ENOENT 0 + +dst: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 NOTMAP 506 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 ENOENT 0 + +src: + VCN LCN len + 0 NOTMAP 656 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 NOTMAP 0 + +res: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 ENOENT 0 + diff --git a/test/runlist-data/frag213 b/test/runlist-data/frag213 new file mode 100644 index 00000000..6505a3f4 --- /dev/null +++ b/test/runlist-data/frag213 @@ -0,0 +1,2213 @@ +dst: + VCN LCN len + 0 NOTMAP 656 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 NOTMAP 0 + +src: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 NOTMAP 892 + 1548 ENOENT 0 + +res: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 NOTMAP 386 + 1548 ENOENT 0 + +dst: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 NOTMAP 386 + 1548 ENOENT 0 + +src: + VCN LCN len + 0 NOTMAP 1162 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 NOTMAP 0 + +res: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 ENOENT 0 + diff --git a/test/runlist-data/frag231 b/test/runlist-data/frag231 new file mode 100644 index 00000000..6abb9560 --- /dev/null +++ b/test/runlist-data/frag231 @@ -0,0 +1,2133 @@ +dst: + VCN LCN len + 0 NOTMAP 656 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 NOTMAP 0 + +src: + VCN LCN len + 0 NOTMAP 1162 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 656 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 NOTMAP 0 + +dst: + VCN LCN len + 0 NOTMAP 656 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 NOTMAP 0 + +src: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 NOTMAP 892 + 1548 ENOENT 0 + +res: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 ENOENT 0 + diff --git a/test/runlist-data/frag312 b/test/runlist-data/frag312 new file mode 100644 index 00000000..cc366705 --- /dev/null +++ b/test/runlist-data/frag312 @@ -0,0 +1,2061 @@ +dst: + VCN LCN len + 0 NOTMAP 1162 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 NOTMAP 0 + +src: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 NOTMAP 892 + 1548 ENOENT 0 + +res: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 NOTMAP 506 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 ENOENT 0 + +dst: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 NOTMAP 506 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 ENOENT 0 + +src: + VCN LCN len + 0 NOTMAP 656 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 NOTMAP 0 + +res: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 ENOENT 0 + diff --git a/test/runlist-data/frag321 b/test/runlist-data/frag321 new file mode 100644 index 00000000..c7ef3b26 --- /dev/null +++ b/test/runlist-data/frag321 @@ -0,0 +1,2133 @@ +dst: + VCN LCN len + 0 NOTMAP 1162 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 NOTMAP 0 + +src: + VCN LCN len + 0 NOTMAP 656 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 656 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 NOTMAP 0 + +dst: + VCN LCN len + 0 NOTMAP 656 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 NOTMAP 0 + +src: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 NOTMAP 892 + 1548 ENOENT 0 + +res: + VCN LCN len + 0 668369 202 + 202 5 3 + 205 88977 1 + 206 93277 2 + 208 700201 4 + 212 196949 2 + 214 91962 2 + 216 96039 2 + 218 510902 2 + 220 513930 2 + 222 382784 3 + 225 389236 1 + 226 200295 3 + 229 506471 1 + 230 583065 2 + 232 501093 2 + 234 159071 2 + 236 97603 3 + 239 699725 1 + 240 462560 2 + 242 388847 3 + 245 547008 1 + 246 463037 2 + 248 463213 2 + 250 588202 2 + 252 639680 2 + 254 119553 2 + 256 119557 2 + 258 123678 2 + 260 378398 2 + 262 378402 2 + 264 380803 2 + 266 393092 2 + 268 453617 2 + 270 453621 2 + 272 499548 2 + 274 499552 2 + 276 531547 2 + 278 558995 2 + 280 560544 2 + 282 560548 2 + 284 589923 2 + 286 665617 2 + 288 665621 2 + 290 665718 2 + 292 680081 2 + 294 450790 2 + 296 538154 3 + 299 440454 1 + 300 661832 2 + 302 159063 2 + 304 159067 2 + 306 692627 2 + 308 190492 2 + 310 440252 2 + 312 440256 2 + 314 539315 2 + 316 557874 2 + 318 557879 2 + 320 651343 2 + 322 669543 2 + 324 669549 2 + 326 693618 2 + 328 133878 2 + 330 143006 2 + 332 143013 2 + 334 185381 2 + 336 384428 2 + 338 384433 2 + 340 570243 2 + 342 570247 2 + 344 588378 2 + 346 588381 2 + 348 588385 2 + 350 632124 2 + 352 159043 4 + 356 185701 2 + 358 396021 4 + 362 401623 2 + 364 404847 2 + 366 404851 2 + 368 429204 2 + 370 429209 2 + 372 534835 2 + 374 534840 2 + 376 547606 2 + 378 547610 2 + 380 614127 2 + 382 614131 2 + 384 614135 2 + 386 678737 2 + 388 678741 2 + 390 691360 2 + 392 691364 2 + 394 691368 2 + 396 94182 9 + 405 398630 1 + 406 127172 3 + 409 651153 1 + 410 89356 3 + 413 119543 1 + 414 559361 5 + 419 185706 1 + 420 583086 5 + 425 680868 1 + 426 196004 4 + 430 544751 2 + 432 614137 3 + 435 583064 1 + 436 398727 2 + 438 507478 2 + 440 693671 2 + 442 190449 2 + 444 101747 3 + 447 658789 1 + 448 111669 3 + 451 401811 1 + 452 188516 3 + 455 193767 1 + 456 502571 2 + 458 517369 3 + 461 531443 1 + 462 591803 2 + 464 616659 3 + 467 669347 1 + 468 123684 2 + 470 126303 2 + 472 158876 2 + 474 187768 2 + 476 380764 4 + 480 388850 2 + 482 395980 2 + 484 401629 2 + 486 431111 4 + 490 561750 4 + 494 450831 2 + 496 650762 4 + 500 452271 2 + 502 541524 4 + 506 458990 2 + 508 505392 2 + 510 534798 2 + 512 549464 2 + 514 583689 2 + 516 106735 3 + 519 378397 1 + 520 127170 2 + 522 463158 2 + 524 501137 2 + 526 568046 2 + 528 568049 2 + 530 569317 3 + 533 571146 1 + 534 583081 2 + 536 590366 2 + 538 590369 2 + 540 632131 3 + 543 638545 1 + 544 642281 2 + 546 658810 2 + 548 658813 2 + 550 682162 3 + 553 95934 1 + 554 96446 2 + 556 96449 3 + 559 100722 1 + 560 106898 2 + 562 106901 3 + 565 112498 1 + 566 159053 2 + 568 159056 3 + 571 159084 1 + 572 189252 2 + 574 693634 2 + 576 693638 3 + 579 700985 1 + 580 396057 2 + 582 197027 2 + 584 111762 2 + 586 111767 2 + 588 185845 2 + 590 190485 2 + 592 521100 6 + 598 452201 2 + 600 452204 2 + 602 452208 2 + 604 452192 2 + 606 452236 2 + 608 452269 2 + 610 452712 2 + 612 452188 2 + 614 452715 2 + 616 452719 2 + 618 452834 2 + 620 452185 2 + 622 452849 2 + 624 452852 2 + 626 453619 2 + 628 455897 2 + 630 456008 2 + 632 456116 2 + 634 456123 2 + 636 457145 2 + 638 459068 2 + 640 459072 2 + 642 459290 2 + 644 460967 2 + 646 460975 2 + 648 460979 2 + 650 460987 2 + 652 460991 2 + 654 460999 2 + 656 461003 2 + 658 461136 2 + 660 462188 2 + 662 463150 2 + 664 463165 2 + 666 465534 2 + 668 466039 2 + 670 466304 2 + 672 466456 2 + 674 466702 2 + 676 466706 2 + 678 466718 2 + 680 466722 2 + 682 466767 2 + 684 467182 2 + 686 467455 2 + 688 467458 2 + 690 467471 2 + 692 467474 2 + 694 467610 2 + 696 469556 2 + 698 469564 2 + 700 469568 2 + 702 469576 2 + 704 469580 2 + 706 469594 2 + 708 469598 2 + 710 470581 2 + 712 470584 2 + 714 470604 2 + 716 470615 2 + 718 472161 2 + 720 472264 2 + 722 472317 2 + 724 472320 2 + 726 499209 2 + 728 499213 2 + 730 499230 2 + 732 499242 2 + 734 499550 2 + 736 500389 2 + 738 500396 2 + 740 500558 2 + 742 500565 2 + 744 500574 2 + 746 500581 2 + 748 500882 2 + 750 500932 2 + 752 500953 2 + 754 501091 2 + 756 501524 2 + 758 502235 2 + 760 502239 2 + 762 502601 2 + 764 502605 2 + 766 504799 2 + 768 504803 2 + 770 504813 2 + 772 504817 2 + 774 504830 2 + 776 504843 2 + 778 606218 4 + 782 504846 2 + 784 505846 2 + 786 506600 2 + 788 506682 2 + 790 506686 2 + 792 509203 2 + 794 509397 2 + 796 512916 2 + 798 513199 2 + 800 513732 2 + 802 513736 2 + 804 514918 2 + 806 514922 2 + 808 517616 2 + 810 517619 2 + 812 518092 2 + 814 518536 2 + 816 521342 2 + 818 521968 2 + 820 525657 2 + 822 525661 2 + 824 534520 2 + 826 534728 2 + 828 534796 2 + 830 534826 2 + 832 534945 2 + 834 536053 2 + 836 536932 2 + 838 536936 2 + 840 537064 2 + 842 538152 2 + 844 539313 2 + 846 539317 2 + 848 543513 2 + 850 543517 2 + 852 543530 2 + 854 543534 2 + 856 544573 2 + 858 546721 2 + 860 546728 2 + 862 546824 2 + 864 546951 2 + 866 546955 2 + 868 546983 2 + 870 546987 2 + 872 547001 2 + 874 547604 2 + 876 547612 2 + 878 547775 2 + 880 548897 2 + 882 549446 2 + 884 549466 2 + 886 553167 2 + 888 664000 4 + 892 553171 2 + 894 557877 2 + 896 558371 2 + 898 558378 2 + 900 558390 2 + 902 558951 2 + 904 558954 2 + 906 559319 2 + 908 559322 2 + 910 559351 2 + 912 559354 2 + 914 560495 2 + 916 560498 2 + 918 562981 2 + 920 562985 2 + 922 566029 2 + 924 566327 2 + 926 566334 2 + 928 567723 2 + 930 569315 2 + 932 569325 2 + 934 569332 2 + 936 569441 2 + 938 570191 2 + 940 570245 2 + 942 570338 2 + 944 570562 2 + 946 571144 2 + 948 571693 2 + 950 572607 2 + 952 572856 2 + 954 576073 2 + 956 577617 2 + 958 583639 2 + 960 583658 2 + 962 584802 2 + 964 584805 2 + 966 588191 2 + 968 588195 2 + 970 588293 2 + 972 588317 2 + 974 588335 2 + 976 588339 2 + 978 588936 2 + 980 588939 2 + 982 588982 2 + 984 588985 2 + 986 589053 2 + 988 589921 2 + 990 590318 2 + 992 590322 2 + 994 190644 4 + 998 590333 2 + 1000 590340 2 + 1002 599957 2 + 1004 606152 2 + 1006 606265 2 + 1008 614133 2 + 1010 616644 2 + 1012 622653 2 + 1014 622657 2 + 1016 622668 2 + 1018 632111 2 + 1020 632122 2 + 1022 635768 2 + 1024 635787 2 + 1026 638413 2 + 1028 638546 2 + 1030 640762 2 + 1032 642292 2 + 1034 642295 2 + 1036 643840 2 + 1038 643849 2 + 1040 643856 2 + 1042 644023 2 + 1044 644845 2 + 1046 645820 2 + 1048 650256 2 + 1050 651341 2 + 1052 653663 2 + 1054 658769 2 + 1056 658795 2 + 1058 658821 2 + 1060 658932 2 + 1062 660116 2 + 1064 661753 2 + 1066 663929 2 + 1068 665619 2 + 1070 665720 2 + 1072 668954 2 + 1074 668957 2 + 1076 669345 2 + 1078 669547 2 + 1080 675879 2 + 1082 675883 2 + 1084 678743 2 + 1086 680079 2 + 1088 680766 2 + 1090 681858 2 + 1092 684914 2 + 1094 499199 4 + 1098 684917 2 + 1100 505472 4 + 1104 684967 2 + 1106 684971 2 + 1108 691362 2 + 1110 691366 2 + 1112 692090 2 + 1114 692631 2 + 1116 693632 2 + 1118 693636 2 + 1120 694133 2 + 1122 698601 2 + 1124 700986 2 + 1126 700990 2 + 1128 701003 2 + 1130 88075 2 + 1132 88130 2 + 1134 111868 2 + 1136 112496 2 + 1138 119462 2 + 1140 123676 2 + 1142 123761 2 + 1144 123775 2 + 1146 123782 2 + 1148 126301 2 + 1150 127144 2 + 1152 127151 2 + 1154 129078 2 + 1156 133880 2 + 1158 133922 2 + 1160 142932 2 + 1162 143011 2 + 1164 158982 2 + 1166 158985 2 + 1168 159065 2 + 1170 159069 2 + 1172 159085 2 + 1174 178517 2 + 1176 182728 2 + 1178 584969 4 + 1182 95400 2 + 1184 96574 2 + 1186 642311 2 + 1188 142940 3 + 1191 471640 1 + 1192 463323 2 + 1194 303220 2 + 1196 320952 2 + 1198 345925 2 + 1200 284287 3 + 1203 265141 1 + 1204 692753 5 + 1209 694377 1 + 1210 696470 2 + 1212 459236 2 + 1214 691357 2 + 1216 388793 2 + 1218 391451 2 + 1220 696517 2 + 1222 133883 4 + 1226 547436 3 + 1229 380908 1 + 1230 701179 3 + 1233 571671 1 + 1234 105558 2 + 1236 105798 2 + 1238 125155 2 + 1240 231221 2 + 1242 256319 2 + 1244 391107 2 + 1246 392139 2 + 1248 429501 2 + 1250 433423 2 + 1252 342596 2 + 1254 120833 2 + 1256 230532 2 + 1258 538684 2 + 1260 523088 2 + 1262 56106 3 + 1265 525665 1 + 1266 466143 3 + 1269 432818 1 + 1270 505109 3 + 1273 505788 1 + 1274 520989 2 + 1276 376486 2 + 1278 398137 2 + 1280 424128 2 + 1282 466553 2 + 1284 536577 2 + 1286 602176 2 + 1288 50225 2 + 1290 112810 2 + 1292 540934 2 + 1294 294437 2 + 1296 576108 2 + 1298 693630 2 + 1300 696703 2 + 1302 118305 6 + 1308 190119 2 + 1310 554042 2 + 1312 21689 2 + 1314 307082 2 + 1316 693674 2 + 1318 694135 2 + 1320 694342 2 + 1322 517951 4 + 1326 303202 2 + 1328 541694 2 + 1330 378216 2 + 1332 463790 2 + 1334 565125 2 + 1336 386152 2 + 1338 462684 2 + 1340 463794 2 + 1342 463806 2 + 1344 467112 2 + 1346 472110 2 + 1348 391267 4 + 1352 569423 2 + 1354 514763 4 + 1358 499866 6 + 1364 548040 10 + 1374 469592 2 + 1376 318450 2 + 1378 32753 2 + 1380 17719 3 + 1383 29987 1 + 1384 168399 2 + 1386 174773 3 + 1389 178041 1 + 1390 320947 2 + 1392 38384 2 + 1394 42120 2 + 1396 44060 2 + 1398 47163 2 + 1400 49428 2 + 1402 54795 2 + 1404 61045 2 + 1406 65477 2 + 1408 49124 3 + 1411 38246 1 + 1412 59888 3 + 1415 39159 1 + 1416 185285 3 + 1419 185696 1 + 1420 59576 2 + 1422 63319 2 + 1424 165754 2 + 1426 375919 2 + 1428 381015 2 + 1430 382330 2 + 1432 68711 2 + 1434 470281 2 + 1436 688609 2 + 1438 699733 2 + 1440 48221 2 + 1442 386049 2 + 1444 695543 2 + 1446 317957 2 + 1448 388731 2 + 1450 470586 2 + 1452 182660 2 + 1454 185576 2 + 1456 187854 2 + 1458 168827 2 + 1460 386136 2 + 1462 235763 2 + 1464 260456 2 + 1466 238330 2 + 1468 263249 2 + 1470 34585 3 + 1473 246690 1 + 1474 389047 2 + 1476 92973 2 + 1478 290622 2 + 1480 406011 2 + 1482 499254 4 + 1486 508163 6 + 1492 247967 2 + 1494 263257 2 + 1496 294156 3 + 1499 394563 3 + 1502 30286 6 + 1508 289484 2 + 1510 394060 2 + 1512 73471 2 + 1514 285182 2 + 1516 375844 2 + 1518 336200 2 + 1520 500386 2 + 1522 308459 2 + 1524 278713 2 + 1526 289610 2 + 1528 395158 2 + 1530 324707 2 + 1532 323068 4 + 1536 276437 2 + 1538 324739 2 + 1540 278696 2 + 1542 380942 2 + 1544 394300 2 + 1546 394741 2 + 1548 ENOENT 0 + diff --git a/test/runlist-data/pure-cm b/test/runlist-data/pure-cm new file mode 100644 index 00000000..37c54557 --- /dev/null +++ b/test/runlist-data/pure-cm @@ -0,0 +1,551 @@ +Test 1 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1000 10 + 10 1010 10 + 20 1020 10 + 30 1030 10 + 40 NOTMAP 0 + +res: + VCN LCN len + 0 1000 10 + 10 1010 10 + 20 1020 10 + 30 1030 10 + 40 HOLE 60 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 2 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 40 1040 10 + 50 1050 10 + 60 1060 10 + 70 1070 10 + 80 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 40 + 40 1040 10 + 50 1050 10 + 60 1060 10 + 70 1070 10 + 80 HOLE 20 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 3 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 60 1060 10 + 70 1070 10 + 80 1080 10 + 90 1090 10 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 60 + 60 1060 10 + 70 1070 10 + 80 1080 10 + 90 1090 110 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 4 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1000 25 + 25 1025 25 + 50 1050 25 + 75 1075 25 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 1000 25 + 25 1025 25 + 50 1050 25 + 75 1075 125 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 5 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 1200 10 + 210 1210 10 + 220 1220 10 + 230 1230 10 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 110 + 210 1210 10 + 220 1220 10 + 230 1230 10 + 240 HOLE 60 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 6 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 240 1240 10 + 250 1250 10 + 260 1260 10 + 270 1270 10 + 280 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 40 + 240 1240 10 + 250 1250 10 + 260 1260 10 + 270 1270 10 + 280 HOLE 20 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 7 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 260 1260 10 + 270 1270 10 + 280 1280 10 + 290 1290 10 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 60 + 260 1260 10 + 270 1270 10 + 280 1280 10 + 290 1290 110 + 400 HOLE 100 + 500 ENOENT 0 + +Test 8 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 1200 25 + 225 1225 25 + 250 1250 25 + 275 1275 25 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 125 + 225 1225 25 + 250 1250 25 + 275 1275 125 + 400 HOLE 100 + 500 ENOENT 0 + +Test 9 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 1400 10 + 410 1410 10 + 420 1420 10 + 430 1430 10 + 440 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 110 + 410 1410 10 + 420 1420 10 + 430 1430 10 + 440 HOLE 60 + 500 ENOENT 0 + +Test 10 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 440 1440 10 + 450 1450 10 + 460 1460 10 + 470 1470 10 + 480 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 40 + 440 1440 10 + 450 1450 10 + 460 1460 10 + 470 1470 10 + 480 HOLE 20 + 500 ENOENT 0 + +Test 11 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 460 1460 10 + 470 1470 10 + 480 1480 10 + 490 1490 10 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 60 + 460 1460 10 + 470 1470 10 + 480 1480 10 + 490 1490 10 + 500 ENOENT 0 + +Test 12 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 1400 25 + 425 1425 25 + 450 1450 25 + 475 1475 25 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 125 + 425 1425 25 + 450 1450 25 + 475 1475 25 + 500 ENOENT 0 + +Test 13 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 160 1160 25 + 185 1185 25 + 210 1210 25 + 235 1235 25 + 260 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 HOLE 60 + 160 1160 25 + 185 1185 25 + 210 1210 25 + 235 1235 25 + 260 ENOENT 0 + +Test 14 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 100 1100 35 + 135 1135 35 + 170 1170 35 + 205 1205 35 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 1000 135 + 135 1135 35 + 170 1170 35 + 205 1205 35 + 240 ENOENT 0 + +Test 15 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 200 1200 10 + 210 1210 10 + 220 1220 10 + 230 1230 10 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 1200 10 + 210 1210 10 + 220 1220 10 + 230 1230 10 + 240 ENOENT 0 + +Test 16 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 240 1240 10 + 250 1250 10 + 260 1260 10 + 270 1270 10 + 280 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 HOLE 140 + 240 1240 10 + 250 1250 10 + 260 1260 10 + 270 1270 10 + 280 ENOENT 0 + +Test 17 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 ENOENT 0 + +src: + VCN LCN len + 100 1100 10 + 110 1110 10 + 120 1120 10 + 130 1130 10 + 140 NOTMAP 0 + +res: + VCN LCN len + 0 1000 110 + 110 1110 10 + 120 1120 10 + 130 1130 10 + 140 ENOENT 0 + +Test 18 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 ENOENT 0 + +src: + VCN LCN len + 140 1140 10 + 150 1150 10 + 160 1160 10 + 170 1170 10 + 180 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 NOTMAP 40 + 140 1140 10 + 150 1150 10 + 160 1160 10 + 170 1170 10 + 180 ENOENT 0 + +Test 19 ---------- +dst: + VCN LCN len + 0 ENOENT 0 + +src: + VCN LCN len + 0 1000 10 + 10 1010 10 + 20 1020 10 + 30 1030 10 + 40 NOTMAP 0 + +res: + VCN LCN len + 0 1000 10 + 10 1010 10 + 20 1020 10 + 30 1030 10 + 40 ENOENT 0 + +Test 20 ---------- +dst: + VCN LCN len + 0 ENOENT 0 + +src: + VCN LCN len + 40 1040 10 + 50 1050 10 + 60 1060 10 + 70 1070 10 + 80 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 40 + 40 1040 10 + 50 1050 10 + 60 1060 10 + 70 1070 10 + 80 ENOENT 0 + diff --git a/test/runlist-data/pure-cs b/test/runlist-data/pure-cs new file mode 100644 index 00000000..8007a84e --- /dev/null +++ b/test/runlist-data/pure-cs @@ -0,0 +1,431 @@ +Test 1 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1000 40 + 40 NOTMAP 0 + +res: + VCN LCN len + 0 1000 40 + 40 HOLE 60 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 2 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 40 1040 40 + 80 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 40 + 40 1040 40 + 80 HOLE 20 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 3 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 60 1060 40 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 60 + 60 1060 140 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 4 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1000 100 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 1000 200 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 5 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 1200 40 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 140 + 240 HOLE 60 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 6 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 240 1240 40 + 280 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 40 + 240 1240 40 + 280 HOLE 20 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 7 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 260 1260 40 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 60 + 260 1260 140 + 400 HOLE 100 + 500 ENOENT 0 + +Test 8 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 1200 100 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 300 + 400 HOLE 100 + 500 ENOENT 0 + +Test 9 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 1400 40 + 440 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 140 + 440 HOLE 60 + 500 ENOENT 0 + +Test 10 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 440 1440 40 + 480 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 40 + 440 1440 40 + 480 HOLE 20 + 500 ENOENT 0 + +Test 11 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 460 1460 40 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 60 + 460 1460 40 + 500 ENOENT 0 + +Test 12 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 1400 100 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 200 + 500 ENOENT 0 + +Test 13 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 160 1160 100 + 260 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 HOLE 60 + 160 1160 100 + 260 ENOENT 0 + +Test 14 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 100 1100 140 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 1000 240 + 240 ENOENT 0 + +Test 15 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 200 1200 40 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 1200 40 + 240 ENOENT 0 + +Test 16 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 240 1240 40 + 280 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 HOLE 140 + 240 1240 40 + 280 ENOENT 0 + +Test 17 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 ENOENT 0 + +src: + VCN LCN len + 100 1100 40 + 140 NOTMAP 0 + +res: + VCN LCN len + 0 1000 140 + 140 ENOENT 0 + +Test 18 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 ENOENT 0 + +src: + VCN LCN len + 140 1140 40 + 180 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 NOTMAP 40 + 140 1140 40 + 180 ENOENT 0 + +Test 19 ---------- +dst: + VCN LCN len + 0 ENOENT 0 + +src: + VCN LCN len + 0 1000 40 + 40 NOTMAP 0 + +res: + VCN LCN len + 0 1000 40 + 40 ENOENT 0 + +Test 20 ---------- +dst: + VCN LCN len + 0 ENOENT 0 + +src: + VCN LCN len + 40 1040 40 + 80 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 40 + 40 1040 40 + 80 ENOENT 0 + diff --git a/test/runlist-data/pure-nm b/test/runlist-data/pure-nm new file mode 100644 index 00000000..266ff22e --- /dev/null +++ b/test/runlist-data/pure-nm @@ -0,0 +1,561 @@ +Test 1 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1999 10 + 10 2009 10 + 20 2019 10 + 30 2029 10 + 40 NOTMAP 0 + +res: + VCN LCN len + 0 1999 10 + 10 2009 10 + 20 2019 10 + 30 2029 10 + 40 HOLE 60 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 2 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 40 2039 10 + 50 2049 10 + 60 2059 10 + 70 2069 10 + 80 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 40 + 40 2039 10 + 50 2049 10 + 60 2059 10 + 70 2069 10 + 80 HOLE 20 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 3 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 60 2059 10 + 70 2069 10 + 80 2079 10 + 90 2089 10 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 60 + 60 2059 10 + 70 2069 10 + 80 2079 10 + 90 2089 10 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 4 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1999 25 + 25 2024 25 + 50 2049 25 + 75 2074 25 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 1999 25 + 25 2024 25 + 50 2049 25 + 75 2074 25 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 5 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 2199 10 + 210 2209 10 + 220 2219 10 + 230 2229 10 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 2199 10 + 210 2209 10 + 220 2219 10 + 230 2229 10 + 240 HOLE 60 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 6 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 240 2239 10 + 250 2249 10 + 260 2259 10 + 270 2269 10 + 280 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 40 + 240 2239 10 + 250 2249 10 + 260 2259 10 + 270 2269 10 + 280 HOLE 20 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 7 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 260 2259 10 + 270 2269 10 + 280 2279 10 + 290 2289 10 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 60 + 260 2259 10 + 270 2269 10 + 280 2279 10 + 290 2289 10 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 8 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 2199 25 + 225 2224 25 + 250 2249 25 + 275 2274 25 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 2199 25 + 225 2224 25 + 250 2249 25 + 275 2274 25 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 9 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 2399 10 + 410 2409 10 + 420 2419 10 + 430 2429 10 + 440 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 2399 10 + 410 2409 10 + 420 2419 10 + 430 2429 10 + 440 HOLE 60 + 500 ENOENT 0 + +Test 10 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 440 2439 10 + 450 2449 10 + 460 2459 10 + 470 2469 10 + 480 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 40 + 440 2439 10 + 450 2449 10 + 460 2459 10 + 470 2469 10 + 480 HOLE 20 + 500 ENOENT 0 + +Test 11 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 460 2459 10 + 470 2469 10 + 480 2479 10 + 490 2489 10 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 60 + 460 2459 10 + 470 2469 10 + 480 2479 10 + 490 2489 10 + 500 ENOENT 0 + +Test 12 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 2399 25 + 425 2424 25 + 450 2449 25 + 475 2474 25 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 2399 25 + 425 2424 25 + 450 2449 25 + 475 2474 25 + 500 ENOENT 0 + +Test 13 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 160 2159 25 + 185 2184 25 + 210 2209 25 + 235 2234 25 + 260 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 HOLE 60 + 160 2159 25 + 185 2184 25 + 210 2209 25 + 235 2234 25 + 260 ENOENT 0 + +Test 14 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 100 2099 35 + 135 2134 35 + 170 2169 35 + 205 2204 35 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 2099 35 + 135 2134 35 + 170 2169 35 + 205 2204 35 + 240 ENOENT 0 + +Test 15 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 200 2199 10 + 210 2209 10 + 220 2219 10 + 230 2229 10 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 2199 10 + 210 2209 10 + 220 2219 10 + 230 2229 10 + 240 ENOENT 0 + +Test 16 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 240 2239 10 + 250 2249 10 + 260 2259 10 + 270 2269 10 + 280 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 HOLE 140 + 240 2239 10 + 250 2249 10 + 260 2259 10 + 270 2269 10 + 280 ENOENT 0 + +Test 17 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 ENOENT 0 + +src: + VCN LCN len + 100 2099 10 + 110 2109 10 + 120 2119 10 + 130 2129 10 + 140 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 2099 10 + 110 2109 10 + 120 2119 10 + 130 2129 10 + 140 ENOENT 0 + +Test 18 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 ENOENT 0 + +src: + VCN LCN len + 140 2139 10 + 150 2149 10 + 160 2159 10 + 170 2169 10 + 180 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 NOTMAP 40 + 140 2139 10 + 150 2149 10 + 160 2159 10 + 170 2169 10 + 180 ENOENT 0 + +Test 19 ---------- +dst: + VCN LCN len + 0 ENOENT 0 + +src: + VCN LCN len + 0 1999 10 + 10 2009 10 + 20 2019 10 + 30 2029 10 + 40 NOTMAP 0 + +res: + VCN LCN len + 0 1999 10 + 10 2009 10 + 20 2019 10 + 30 2029 10 + 40 ENOENT 0 + +Test 20 ---------- +dst: + VCN LCN len + 0 ENOENT 0 + +src: + VCN LCN len + 40 2039 10 + 50 2049 10 + 60 2059 10 + 70 2069 10 + 80 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 40 + 40 2039 10 + 50 2049 10 + 60 2059 10 + 70 2069 10 + 80 ENOENT 0 + diff --git a/test/runlist-data/pure-ns b/test/runlist-data/pure-ns new file mode 100644 index 00000000..fd3e2348 --- /dev/null +++ b/test/runlist-data/pure-ns @@ -0,0 +1,441 @@ +Test 1 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1999 40 + 40 NOTMAP 0 + +res: + VCN LCN len + 0 1999 40 + 40 HOLE 60 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 2 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 40 2039 40 + 80 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 40 + 40 2039 40 + 80 HOLE 20 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 3 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 60 2059 40 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 60 + 60 2059 40 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 4 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1999 100 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 1999 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 5 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 2199 40 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 2199 40 + 240 HOLE 60 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 6 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 240 2239 40 + 280 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 40 + 240 2239 40 + 280 HOLE 20 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 7 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 260 2259 40 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 60 + 260 2259 40 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 8 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 2199 100 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 2199 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +Test 9 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 2399 40 + 440 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 2399 40 + 440 HOLE 60 + 500 ENOENT 0 + +Test 10 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 440 2439 40 + 480 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 40 + 440 2439 40 + 480 HOLE 20 + 500 ENOENT 0 + +Test 11 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 460 2459 40 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 60 + 460 2459 40 + 500 ENOENT 0 + +Test 12 ---------- +dst: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 HOLE 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 2399 100 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 HOLE 100 + 100 1100 100 + 200 HOLE 100 + 300 1300 100 + 400 2399 100 + 500 ENOENT 0 + +Test 13 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 160 2159 100 + 260 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 HOLE 60 + 160 2159 100 + 260 ENOENT 0 + +Test 14 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 100 2099 140 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 2099 140 + 240 ENOENT 0 + +Test 15 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 200 2199 40 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 2199 40 + 240 ENOENT 0 + +Test 16 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 HOLE 100 + 200 ENOENT 0 + +src: + VCN LCN len + 240 2239 40 + 280 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 HOLE 140 + 240 2239 40 + 280 ENOENT 0 + +Test 17 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 ENOENT 0 + +src: + VCN LCN len + 100 2099 40 + 140 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 2099 40 + 140 ENOENT 0 + +Test 18 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 ENOENT 0 + +src: + VCN LCN len + 140 2139 40 + 180 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 NOTMAP 40 + 140 2139 40 + 180 ENOENT 0 + +Test 19 ---------- +dst: + VCN LCN len + 0 ENOENT 0 + +src: + VCN LCN len + 0 1999 40 + 40 NOTMAP 0 + +res: + VCN LCN len + 0 1999 40 + 40 ENOENT 0 + +Test 20 ---------- +dst: + VCN LCN len + 0 ENOENT 0 + +src: + VCN LCN len + 40 2039 40 + 80 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 40 + 40 2039 40 + 80 ENOENT 0 + diff --git a/test/runlist-data/zero b/test/runlist-data/zero new file mode 100644 index 00000000..26e436f3 --- /dev/null +++ b/test/runlist-data/zero @@ -0,0 +1,13 @@ +dst: + Run list not present. +src: + VCN LCN len + 10 99 5 + 15 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 10 + 10 99 5 + 0 0 0 + diff --git a/test/runlist.c b/test/runlist.c new file mode 100644 index 00000000..330751d0 --- /dev/null +++ b/test/runlist.c @@ -0,0 +1,7 @@ +#include +#include "runlist.h" + +int main (int argc, char *argv[]) +{ + return test_rl_main (argc, argv); +} From 01f648c952e78e617a960eb59905e5bea2a036c2 Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 13 Sep 2005 18:51:16 +0000 Subject: [PATCH 2501/2994] removing a few unnecessary memsets in the test code revealed a minor buffer overrun. create runlist tests working on unmapped regions (copies of tests 1-14) --- libntfs/runlist.c | 35 +--- test/runlist-data/pure-cm | 412 +++++++++++++++++++++++++++++++++++++ test/runlist-data/pure-cs | 328 +++++++++++++++++++++++++++++ test/runlist-data/pure-nm | 421 ++++++++++++++++++++++++++++++++++++++ test/runlist-data/pure-ns | 337 ++++++++++++++++++++++++++++++ 5 files changed, 1504 insertions(+), 29 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 479ba77f..ba7d3ad1 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -310,8 +310,6 @@ static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, dst[loc].lcn = LCN_RL_NOT_MAPPED; } - magic += hole; - if (dst[magic].lcn == LCN_ENOENT) dst[magic].vcn = dst[magic - 1].vcn + dst[magic - 1].length; @@ -1782,7 +1780,6 @@ static int test_rl_read_buffer (const char *file, u8 *buf, int bufsize) return 0; } - memset (buf, 0, bufsize); if (fread (buf, bufsize, 1, fptr) == 99) { printf ("read %s\n", file); return 0; @@ -1806,7 +1803,6 @@ static runlist_element * test_rl_pure_src (BOOL contig, BOOL multi, int vcn, int fudge = 999; result = malloc (4096); - memset (result, -7, 4096); if (multi) { MKRL (result+0, vcn + (0*len/4), fudge + vcn + 1000 + (0*len/4), len / 4) MKRL (result+1, vcn + (1*len/4), fudge + vcn + 1000 + (1*len/4), len / 4) @@ -1832,7 +1828,6 @@ static void test_rl_pure_test (int test, BOOL contig, BOOL multi, int vcn, int l src = test_rl_pure_src (contig, multi, vcn, len); dst = malloc (4096); - memset (dst, -7, 4096); memcpy (dst, file, size); printf ("Test %2d ----------\n", test); @@ -1868,28 +1863,19 @@ static void test_rl_pure (char *contig, char *multi) static runlist_element file4[] = { { 0, -3, 0 } /* NOENT */ }; -#if 0 static runlist_element file5[] = { - { 0, -1, 100 }, /* HOLE */ + { 0, -2, 100 }, /* NOTMAP */ { 100, 1100, 100 }, /* DATA */ - { 200, -1, 100 }, /* HOLE */ + { 200, -2, 100 }, /* NOTMAP */ { 300, 1300, 100 }, /* DATA */ - { 400, -1, 100 }, /* HOLE */ - { 500, -2, 0 } /* NOT_MAPPED */ + { 400, -2, 100 }, /* NOTMAP */ + { 500, -3, 0 } /* NOENT */ }; static runlist_element file6[] = { { 0, 1000, 100 }, /* DATA */ - { 100, -1, 100 }, /* HOLE */ - { 200, -2, 0 } /* NOT_MAPPED */ + { 100, -2, 100 }, /* NOTMAP */ + { 200, -3, 0 } /* NOENT */ }; - static runlist_element file7[] = { - { 0, 1000, 100 }, /* DATA */ - { 100, -2, 0 } /* NOT_MAPPED */ - }; - static runlist_element file8[] = { - { 0, -2, 0 } /* NOT_MAPPED */ - }; -#endif BOOL c, m; if (strcmp (contig, "contig") == 0) @@ -1929,8 +1915,6 @@ static void test_rl_pure (char *contig, char *multi) test_rl_pure_test (18, c, m, 140, 40, file3, sizeof (file3)); test_rl_pure_test (19, c, m, 0, 40, file4, sizeof (file4)); test_rl_pure_test (20, c, m, 40, 40, file4, sizeof (file4)); - -#if 0 test_rl_pure_test (21, c, m, 0, 40, file5, sizeof (file5)); test_rl_pure_test (22, c, m, 40, 40, file5, sizeof (file5)); test_rl_pure_test (23, c, m, 60, 40, file5, sizeof (file5)); @@ -1945,13 +1929,6 @@ static void test_rl_pure (char *contig, char *multi) test_rl_pure_test (32, c, m, 400, 100, file5, sizeof (file5)); test_rl_pure_test (33, c, m, 160, 100, file6, sizeof (file6)); test_rl_pure_test (34, c, m, 100, 140, file6, sizeof (file6)); - test_rl_pure_test (35, c, m, 200, 40, file6, sizeof (file6)); - test_rl_pure_test (36, c, m, 240, 40, file6, sizeof (file6)); - test_rl_pure_test (37, c, m, 100, 40, file7, sizeof (file7)); - test_rl_pure_test (38, c, m, 140, 40, file7, sizeof (file7)); - test_rl_pure_test (39, c, m, 0, 40, file8, sizeof (file8)); - test_rl_pure_test (40, c, m, 40, 40, file8, sizeof (file8)); -#endif } /** diff --git a/test/runlist-data/pure-cm b/test/runlist-data/pure-cm index 37c54557..71e21b5e 100644 --- a/test/runlist-data/pure-cm +++ b/test/runlist-data/pure-cm @@ -549,3 +549,415 @@ res: 70 1070 10 80 ENOENT 0 +Test 21 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1000 10 + 10 1010 10 + 20 1020 10 + 30 1030 10 + 40 NOTMAP 0 + +res: + VCN LCN len + 0 1000 10 + 10 1010 10 + 20 1020 10 + 30 1030 10 + 40 NOTMAP 60 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 22 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 40 1040 10 + 50 1050 10 + 60 1060 10 + 70 1070 10 + 80 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 40 + 40 1040 10 + 50 1050 10 + 60 1060 10 + 70 1070 10 + 80 NOTMAP 20 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 23 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 60 1060 10 + 70 1070 10 + 80 1080 10 + 90 1090 10 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 60 + 60 1060 10 + 70 1070 10 + 80 1080 10 + 90 1090 110 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 24 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1000 25 + 25 1025 25 + 50 1050 25 + 75 1075 25 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 1000 25 + 25 1025 25 + 50 1050 25 + 75 1075 125 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 25 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 1200 10 + 210 1210 10 + 220 1220 10 + 230 1230 10 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 110 + 210 1210 10 + 220 1220 10 + 230 1230 10 + 240 NOTMAP 60 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 26 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 240 1240 10 + 250 1250 10 + 260 1260 10 + 270 1270 10 + 280 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 40 + 240 1240 10 + 250 1250 10 + 260 1260 10 + 270 1270 10 + 280 NOTMAP 20 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 27 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 260 1260 10 + 270 1270 10 + 280 1280 10 + 290 1290 10 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 60 + 260 1260 10 + 270 1270 10 + 280 1280 10 + 290 1290 110 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 28 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 1200 25 + 225 1225 25 + 250 1250 25 + 275 1275 25 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 125 + 225 1225 25 + 250 1250 25 + 275 1275 125 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 29 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 1400 10 + 410 1410 10 + 420 1420 10 + 430 1430 10 + 440 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 110 + 410 1410 10 + 420 1420 10 + 430 1430 10 + 440 NOTMAP 60 + 500 ENOENT 0 + +Test 30 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 440 1440 10 + 450 1450 10 + 460 1460 10 + 470 1470 10 + 480 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 40 + 440 1440 10 + 450 1450 10 + 460 1460 10 + 470 1470 10 + 480 NOTMAP 20 + 500 ENOENT 0 + +Test 31 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 460 1460 10 + 470 1470 10 + 480 1480 10 + 490 1490 10 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 60 + 460 1460 10 + 470 1470 10 + 480 1480 10 + 490 1490 10 + 500 ENOENT 0 + +Test 32 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 1400 25 + 425 1425 25 + 450 1450 25 + 475 1475 25 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 125 + 425 1425 25 + 450 1450 25 + 475 1475 25 + 500 ENOENT 0 + +Test 33 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 NOTMAP 100 + 200 ENOENT 0 + +src: + VCN LCN len + 160 1160 25 + 185 1185 25 + 210 1210 25 + 235 1235 25 + 260 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 NOTMAP 60 + 160 1160 25 + 185 1185 25 + 210 1210 25 + 235 1235 25 + 260 ENOENT 0 + +Test 34 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 NOTMAP 100 + 200 ENOENT 0 + +src: + VCN LCN len + 100 1100 35 + 135 1135 35 + 170 1170 35 + 205 1205 35 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 1000 135 + 135 1135 35 + 170 1170 35 + 205 1205 35 + 240 ENOENT 0 + diff --git a/test/runlist-data/pure-cs b/test/runlist-data/pure-cs index 8007a84e..bfd7d461 100644 --- a/test/runlist-data/pure-cs +++ b/test/runlist-data/pure-cs @@ -429,3 +429,331 @@ res: 40 1040 40 80 ENOENT 0 +Test 21 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1000 40 + 40 NOTMAP 0 + +res: + VCN LCN len + 0 1000 40 + 40 NOTMAP 60 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 22 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 40 1040 40 + 80 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 40 + 40 1040 40 + 80 NOTMAP 20 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 23 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 60 1060 40 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 60 + 60 1060 140 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 24 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1000 100 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 1000 200 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 25 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 1200 40 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 140 + 240 NOTMAP 60 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 26 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 240 1240 40 + 280 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 40 + 240 1240 40 + 280 NOTMAP 20 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 27 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 260 1260 40 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 60 + 260 1260 140 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 28 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 1200 100 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 300 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 29 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 1400 40 + 440 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 140 + 440 NOTMAP 60 + 500 ENOENT 0 + +Test 30 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 440 1440 40 + 480 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 40 + 440 1440 40 + 480 NOTMAP 20 + 500 ENOENT 0 + +Test 31 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 460 1460 40 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 60 + 460 1460 40 + 500 ENOENT 0 + +Test 32 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 1400 100 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 200 + 500 ENOENT 0 + +Test 33 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 NOTMAP 100 + 200 ENOENT 0 + +src: + VCN LCN len + 160 1160 100 + 260 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 NOTMAP 60 + 160 1160 100 + 260 ENOENT 0 + +Test 34 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 NOTMAP 100 + 200 ENOENT 0 + +src: + VCN LCN len + 100 1100 140 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 1000 240 + 240 ENOENT 0 + diff --git a/test/runlist-data/pure-nm b/test/runlist-data/pure-nm index 266ff22e..b082e6e9 100644 --- a/test/runlist-data/pure-nm +++ b/test/runlist-data/pure-nm @@ -559,3 +559,424 @@ res: 70 2069 10 80 ENOENT 0 +Test 21 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1999 10 + 10 2009 10 + 20 2019 10 + 30 2029 10 + 40 NOTMAP 0 + +res: + VCN LCN len + 0 1999 10 + 10 2009 10 + 20 2019 10 + 30 2029 10 + 40 NOTMAP 60 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 22 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 40 2039 10 + 50 2049 10 + 60 2059 10 + 70 2069 10 + 80 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 40 + 40 2039 10 + 50 2049 10 + 60 2059 10 + 70 2069 10 + 80 NOTMAP 20 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 23 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 60 2059 10 + 70 2069 10 + 80 2079 10 + 90 2089 10 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 60 + 60 2059 10 + 70 2069 10 + 80 2079 10 + 90 2089 10 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 24 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1999 25 + 25 2024 25 + 50 2049 25 + 75 2074 25 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 1999 25 + 25 2024 25 + 50 2049 25 + 75 2074 25 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 25 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 2199 10 + 210 2209 10 + 220 2219 10 + 230 2229 10 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 2199 10 + 210 2209 10 + 220 2219 10 + 230 2229 10 + 240 NOTMAP 60 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 26 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 240 2239 10 + 250 2249 10 + 260 2259 10 + 270 2269 10 + 280 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 40 + 240 2239 10 + 250 2249 10 + 260 2259 10 + 270 2269 10 + 280 NOTMAP 20 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 27 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 260 2259 10 + 270 2269 10 + 280 2279 10 + 290 2289 10 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 60 + 260 2259 10 + 270 2269 10 + 280 2279 10 + 290 2289 10 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 28 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 2199 25 + 225 2224 25 + 250 2249 25 + 275 2274 25 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 2199 25 + 225 2224 25 + 250 2249 25 + 275 2274 25 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 29 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 2399 10 + 410 2409 10 + 420 2419 10 + 430 2429 10 + 440 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 2399 10 + 410 2409 10 + 420 2419 10 + 430 2429 10 + 440 NOTMAP 60 + 500 ENOENT 0 + +Test 30 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 440 2439 10 + 450 2449 10 + 460 2459 10 + 470 2469 10 + 480 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 40 + 440 2439 10 + 450 2449 10 + 460 2459 10 + 470 2469 10 + 480 NOTMAP 20 + 500 ENOENT 0 + +Test 31 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 460 2459 10 + 470 2469 10 + 480 2479 10 + 490 2489 10 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 60 + 460 2459 10 + 470 2469 10 + 480 2479 10 + 490 2489 10 + 500 ENOENT 0 + +Test 32 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 2399 25 + 425 2424 25 + 450 2449 25 + 475 2474 25 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 2399 25 + 425 2424 25 + 450 2449 25 + 475 2474 25 + 500 ENOENT 0 + +Test 33 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 NOTMAP 100 + 200 ENOENT 0 + +src: + VCN LCN len + 160 2159 25 + 185 2184 25 + 210 2209 25 + 235 2234 25 + 260 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 NOTMAP 60 + 160 2159 25 + 185 2184 25 + 210 2209 25 + 235 2234 25 + 260 ENOENT 0 + +Test 34 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 NOTMAP 100 + 200 ENOENT 0 + +src: + VCN LCN len + 100 2099 35 + 135 2134 35 + 170 2169 35 + 205 2204 35 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 2099 35 + 135 2134 35 + 170 2169 35 + 205 2204 35 + 240 ENOENT 0 + diff --git a/test/runlist-data/pure-ns b/test/runlist-data/pure-ns index fd3e2348..b6443114 100644 --- a/test/runlist-data/pure-ns +++ b/test/runlist-data/pure-ns @@ -439,3 +439,340 @@ res: 40 2039 40 80 ENOENT 0 +Test 21 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1999 40 + 40 NOTMAP 0 + +res: + VCN LCN len + 0 1999 40 + 40 NOTMAP 60 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 22 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 40 2039 40 + 80 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 40 + 40 2039 40 + 80 NOTMAP 20 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 23 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 60 2059 40 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 60 + 60 2059 40 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 24 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 0 1999 100 + 100 NOTMAP 0 + +res: + VCN LCN len + 0 1999 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 25 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 2199 40 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 2199 40 + 240 NOTMAP 60 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 26 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 240 2239 40 + 280 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 40 + 240 2239 40 + 280 NOTMAP 20 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 27 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 260 2259 40 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 60 + 260 2259 40 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 28 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 200 2199 100 + 300 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 2199 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +Test 29 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 2399 40 + 440 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 2399 40 + 440 NOTMAP 60 + 500 ENOENT 0 + +Test 30 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 440 2439 40 + 480 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 40 + 440 2439 40 + 480 NOTMAP 20 + 500 ENOENT 0 + +Test 31 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 460 2459 40 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 60 + 460 2459 40 + 500 ENOENT 0 + +Test 32 ---------- +dst: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 NOTMAP 100 + 500 ENOENT 0 + +src: + VCN LCN len + 400 2399 100 + 500 NOTMAP 0 + +res: + VCN LCN len + 0 NOTMAP 100 + 100 1100 100 + 200 NOTMAP 100 + 300 1300 100 + 400 2399 100 + 500 ENOENT 0 + +Test 33 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 NOTMAP 100 + 200 ENOENT 0 + +src: + VCN LCN len + 160 2159 100 + 260 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 NOTMAP 60 + 160 2159 100 + 260 ENOENT 0 + +Test 34 ---------- +dst: + VCN LCN len + 0 1000 100 + 100 NOTMAP 100 + 200 ENOENT 0 + +src: + VCN LCN len + 100 2099 140 + 240 NOTMAP 0 + +res: + VCN LCN len + 0 1000 100 + 100 2099 140 + 240 ENOENT 0 + From eb6b8d81599af31555df794759754f2d1b51c8e0 Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 14 Sep 2005 12:23:08 +0000 Subject: [PATCH 2502/2994] add a PHONY dependency to "test" target to make sure it's run --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 5744a1b5..dc4ee612 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,6 +31,7 @@ if ENABLE_TEST test: libs (cd test && $(MAKE) all test) || exit 1; else +.PHONY: test test: @echo The libntfs test code has been configured out of this release. @echo "./configure --enable-test" and rebuild. From ab9fb6a01ff7bd4ce648b968dc62babb6198ef51 Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 15 Sep 2005 23:42:02 +0000 Subject: [PATCH 2503/2994] runlist behaviour changed! please check your applications. test case 16, where a run is added beyond the end of a file, now behaves differently. the discontinuity (gap) is now filled with a "not mapped" run (before the preceding hole would have been extended). Anton's bugfix applied and tested minor code tidyups loads more comments in runlist_{insert,append,split,replace} test cases checked and updated where necessary valgrind happy --- libntfs/runlist.c | 110 ++++++++++++++++++-------------------- test/runlist-data/pure-cm | 3 +- test/runlist-data/pure-cs | 3 +- test/runlist-data/pure-nm | 3 +- test/runlist-data/pure-ns | 3 +- test/runlist-data/zero | 2 +- 6 files changed, 60 insertions(+), 64 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index ba7d3ad1..6fb40803 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -166,8 +166,8 @@ static __inline__ void __ntfs_rl_merge(runlist_element *dst, static __inline__ runlist_element *ntfs_rl_append(runlist_element *dst, int dsize, runlist_element *src, int ssize, int loc) { - BOOL right; - int magic; + BOOL right; /* Right end of @src needs merging */ + int marker; /* End of the inserted runs */ if (!dst || !src) { Dputs("Eeek. ntfs_rl_append() invoked with NULL pointer!"); @@ -181,7 +181,7 @@ static __inline__ runlist_element *ntfs_rl_append(runlist_element *dst, /* Space required: @dst size + @src size, less one if we merged. */ dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - right); if (!dst) - return dst; + return NULL; /* * We are guaranteed to succeed from here so can start modifying the * original runlists. @@ -191,19 +191,19 @@ static __inline__ runlist_element *ntfs_rl_append(runlist_element *dst, if (right) __ntfs_rl_merge(src + ssize - 1, dst + loc + 1); - /* FIXME: What does this mean? (AIA) */ - magic = loc + ssize; + /* marker - First run after the @src runs that have been inserted */ + marker = loc + ssize + 1; /* Move the tail of @dst out of the way, then copy in @src. */ - ntfs_rl_mm(dst, magic + 1, loc + 1 + right, dsize - loc - 1 - right); + ntfs_rl_mm(dst, marker, loc + 1 + right, dsize - loc - 1 - right); ntfs_rl_mc(dst, loc + 1, src, 0, ssize); /* Adjust the size of the preceding hole. */ dst[loc].length = dst[loc + 1].vcn - dst[loc].vcn; /* We may have changed the length of the file, so fix the end marker */ - if (dst[magic + 1].lcn == LCN_ENOENT) - dst[magic + 1].vcn = dst[magic].vcn + dst[magic].length; + if (dst[marker].lcn == LCN_ENOENT) + dst[marker].vcn = dst[marker-1].vcn + dst[marker-1].length; return dst; } @@ -233,10 +233,9 @@ static __inline__ runlist_element *ntfs_rl_append(runlist_element *dst, static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, int dsize, runlist_element *src, int ssize, int loc) { - BOOL left = FALSE; - BOOL disc = FALSE; /* Discontinuity */ - BOOL hole = FALSE; /* Following a hole */ - int magic; + BOOL left = FALSE; /* Left end of @src needs merging */ + BOOL disc = FALSE; /* Discontinuity between @dst and @src */ + int marker; /* End of the inserted runs */ if (!dst || !src) { Dputs("Eeek. ntfs_rl_insert() invoked with NULL pointer!"); @@ -245,9 +244,7 @@ static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, } /* disc => Discontinuity between the end of @dst and the start of @src. - * This means we might need to insert a hole. - * hole => @dst ends with a hole or an unmapped region which we can - * extend to match the discontinuity. + * This means we might need to insert a "notmapped" run. */ if (loc == 0) disc = (src[0].vcn > 0); @@ -261,16 +258,14 @@ static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, merged_length += src->length; disc = (src[0].vcn > dst[loc - 1].vcn + merged_length); - if (disc) - hole = (dst[loc - 1].lcn == LCN_HOLE); } /* Space required: @dst size + @src size, less one if we merged, plus - * one if there was a discontinuity, less one for a trailing hole. + * one if there was a discontinuity. */ - dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - left + disc - hole); + dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - left + disc); if (!dst) - return dst; + return NULL; /* * We are guaranteed to succeed from here so can start modifying the * original runlist. @@ -279,40 +274,34 @@ static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, if (left) __ntfs_rl_merge(dst + loc - 1, src); - /* FIXME: What does this mean? (AIA) */ - magic = loc + ssize - left + disc - hole; + /* + * marker - First run after the @src runs that have been inserted + * Nominally: marker = @loc + @ssize (location + number of runs in @src) + * If "left", then the first run in @src has been merged with one in @dst. + * If "disc", then @dst and @src don't meet and we need an extra run to fill the gap. + */ + marker = loc + ssize - left + disc; /* Move the tail of @dst out of the way, then copy in @src. */ - ntfs_rl_mm(dst, magic, loc, dsize - loc); - ntfs_rl_mc(dst, loc + disc - hole, src, left, ssize - left); + ntfs_rl_mm(dst, marker, loc, dsize - loc); + ntfs_rl_mc(dst, loc + disc, src, left, ssize - left); - /* Adjust the VCN of the last run ... */ - if (dst[magic].lcn <= LCN_HOLE) - dst[magic].vcn = dst[magic - 1].vcn + dst[magic - 1].length; + /* Adjust the VCN of the first run after the insertion ... */ + dst[marker].vcn = dst[marker - 1].vcn + dst[marker - 1].length; /* ... and the length. */ - if (dst[magic].lcn == LCN_HOLE || dst[magic].lcn == LCN_RL_NOT_MAPPED) - dst[magic].length = dst[magic + 1].vcn - dst[magic].vcn; + if (dst[marker].lcn == LCN_HOLE || dst[marker].lcn == LCN_RL_NOT_MAPPED) + dst[marker].length = dst[marker + 1].vcn - dst[marker].vcn; /* Writing beyond the end of the file and there's a discontinuity. */ if (disc) { - if (hole) - dst[loc - 1].length = dst[loc].vcn - dst[loc - 1].vcn; - else { - if (loc > 0) { - dst[loc].vcn = dst[loc - 1].vcn + - dst[loc - 1].length; - dst[loc].length = dst[loc + 1].vcn - - dst[loc].vcn; - } else { - dst[loc].vcn = 0; - dst[loc].length = dst[loc + 1].vcn; - } - dst[loc].lcn = LCN_RL_NOT_MAPPED; + if (loc > 0) { + dst[loc].vcn = dst[loc - 1].vcn + dst[loc - 1].length; + dst[loc].length = dst[loc + 1].vcn - dst[loc].vcn; + } else { + dst[loc].vcn = 0; + dst[loc].length = dst[loc + 1].vcn; } - - if (dst[magic].lcn == LCN_ENOENT) - dst[magic].vcn = dst[magic - 1].vcn + - dst[magic - 1].length; + dst[loc].lcn = LCN_RL_NOT_MAPPED; } return dst; } @@ -341,9 +330,9 @@ static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, static __inline__ runlist_element *ntfs_rl_replace(runlist_element *dst, int dsize, runlist_element *src, int ssize, int loc) { - BOOL left = FALSE; - BOOL right; - int magic; + BOOL left = FALSE; /* Left end of @src needs merging */ + BOOL right; /* Right end of @src needs merging */ + int marker; /* End of the inserted runs */ if (!dst || !src) { Dputs("Eeek. ntfs_rl_replace() invoked with NULL pointer!"); @@ -361,7 +350,7 @@ static __inline__ runlist_element *ntfs_rl_replace(runlist_element *dst, */ dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - left - right); if (!dst) - return dst; + return NULL; /* * We are guaranteed to succeed from here so can start modifying the * original runlists. @@ -371,16 +360,21 @@ static __inline__ runlist_element *ntfs_rl_replace(runlist_element *dst, if (left) __ntfs_rl_merge(dst + loc - 1, src); - /* FIXME: What does this mean? (AIA) */ - magic = loc + ssize - left; + /* + * marker - First run after the @src runs that have been inserted + * Nominally: marker = @loc + @ssize (location + number of runs in @src) + * If "left", then the first run in @src has been merged with one in @dst. + */ + marker = loc + ssize - left; /* Move the tail of @dst out of the way, then copy in @src. */ - ntfs_rl_mm(dst, magic, loc + right + 1, dsize - loc - right - 1); + ntfs_rl_mm(dst, marker, loc + right + 1, dsize - loc - right - 1); ntfs_rl_mc(dst, loc, src, left, ssize - left); /* We may have changed the length of the file, so fix the end marker */ - if (((dsize - loc - right - 1) > 0) && (dst[magic].lcn == LCN_ENOENT)) - dst[magic].vcn = dst[magic - 1].vcn + dst[magic - 1].length; + if (((dsize - loc - right - 1) > 0) && (dst[marker].lcn == LCN_ENOENT)) + dst[marker].vcn = dst[marker - 1].vcn + dst[marker - 1].length; + return dst; } @@ -498,6 +492,7 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, /* Scan to the end of the source runlist. */ for (dend = 0; drl[dend].length; dend++) ; + dend++; drl = ntfs_rl_realloc(drl, dend, dend + 1); if (!drl) return drl; @@ -574,7 +569,7 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, (srl[send - 1].vcn + srl[send - 1].length))); /* Or we'll lose an end marker */ - if (start && finish && (drl[dins].length == 0)) + if (finish && !drl[dins].length) ss++; if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn)) finish = FALSE; @@ -1732,11 +1727,9 @@ static void test_rl_dump_runlist (const runlist_element *rl) if (ind > -LCN_ENOENT - 1) ind = 3; - //printf("%8llx %8s %8llx\n", printf("%8lld %8s %8lld\n", rl->vcn, lcn_str[ind], rl->length); } else - //printf("%8llx %8llx %8llx\n", printf("%8lld %8lld %8lld\n", rl->vcn, rl->lcn, rl->length); if (!rl->length) @@ -1834,7 +1827,6 @@ static void test_rl_pure_test (int test, BOOL contig, BOOL multi, int vcn, int l res = test_rl_runlists_merge (dst, src); free (res); - test = 0; } /** diff --git a/test/runlist-data/pure-cm b/test/runlist-data/pure-cm index 71e21b5e..f09a7227 100644 --- a/test/runlist-data/pure-cm +++ b/test/runlist-data/pure-cm @@ -453,7 +453,8 @@ src: res: VCN LCN len 0 1000 100 - 100 HOLE 140 + 100 HOLE 100 + 200 NOTMAP 40 240 1240 10 250 1250 10 260 1260 10 diff --git a/test/runlist-data/pure-cs b/test/runlist-data/pure-cs index bfd7d461..2eb4ddbf 100644 --- a/test/runlist-data/pure-cs +++ b/test/runlist-data/pure-cs @@ -360,7 +360,8 @@ src: res: VCN LCN len 0 1000 100 - 100 HOLE 140 + 100 HOLE 100 + 200 NOTMAP 40 240 1240 40 280 ENOENT 0 diff --git a/test/runlist-data/pure-nm b/test/runlist-data/pure-nm index b082e6e9..ac6324b0 100644 --- a/test/runlist-data/pure-nm +++ b/test/runlist-data/pure-nm @@ -462,7 +462,8 @@ src: res: VCN LCN len 0 1000 100 - 100 HOLE 140 + 100 HOLE 100 + 200 NOTMAP 40 240 2239 10 250 2249 10 260 2259 10 diff --git a/test/runlist-data/pure-ns b/test/runlist-data/pure-ns index b6443114..3cd96283 100644 --- a/test/runlist-data/pure-ns +++ b/test/runlist-data/pure-ns @@ -369,7 +369,8 @@ src: res: VCN LCN len 0 1000 100 - 100 HOLE 140 + 100 HOLE 100 + 200 NOTMAP 40 240 2239 40 280 ENOENT 0 diff --git a/test/runlist-data/zero b/test/runlist-data/zero index 26e436f3..63ac7200 100644 --- a/test/runlist-data/zero +++ b/test/runlist-data/zero @@ -9,5 +9,5 @@ res: VCN LCN len 0 NOTMAP 10 10 99 5 - 0 0 0 + 15 NOTMAP 0 From 3629d931c636a00f80d8f8b9867ee4e92ab246cf Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 16 Sep 2005 14:28:18 +0000 Subject: [PATCH 2504/2994] Fix resident attribute adding: Add @val to ntfs_attr_add and @val and @size to ntfs_resident_attr_record_add. Still need to fix attribute lis entry adding. :-( --- include/ntfs/attrib.h | 7 +- libntfs/attrib.c | 165 ++++++++++++++++++++++++++++-------------- libntfs/dir.c | 38 ++-------- libntfs/inode.c | 2 +- ntfsprogs/ntfscp.c | 11 ++- ntfsprogs/ntfsmount.c | 6 +- 6 files changed, 128 insertions(+), 101 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index e59bf0f5..7d1f9f18 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -290,14 +290,15 @@ extern int ntfs_attr_can_be_resident(const ntfs_volume *vol, extern int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size); extern int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, - ntfschar *name, u8 name_len, ATTR_FLAGS flags); + ntfschar *name, u8 name_len, u8 *val, u32 size, + ATTR_FLAGS flags); extern int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ntfschar *name, u8 name_len, VCN lowest_vcn, int dataruns_size, ATTR_FLAGS flags); extern int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx); -extern ntfs_attr *ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, - ntfschar *name, u8 name_len, s64 size); +extern int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, + ntfschar *name, u8 name_len, u8 *val, s64 size); extern int ntfs_attr_rm(ntfs_attr *na); extern int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e366c6fb..07bc046e 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2496,6 +2496,8 @@ int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) * @type: type of the new attribute * @name: name of the new attribute * @name_len: name length of the new attribute + * @val: value of the new attribute + * @size: size of new attribute (length of @val, if @val != NULL) * @flags: flags of the new attribute * * Return offset to attribute from the beginning of the mft record on success @@ -2506,7 +2508,8 @@ int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) * EIO - I/O error occurred or damaged filesystem. */ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, - ntfschar *name, u8 name_len, ATTR_FLAGS flags) + ntfschar *name, u8 name_len, u8 *val, u32 size, + ATTR_FLAGS flags) { ntfs_attr_search_ctx *ctx; u32 length; @@ -2541,7 +2544,7 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, if (!ctx) return -1; if (!ntfs_attr_lookup(type, name, name_len, - CASE_SENSITIVE, 0, NULL, 0, ctx)) { + CASE_SENSITIVE, 0, val, size, ctx)) { err = EEXIST; Dprintf("%s(): Attribute already present.\n", __FUNCTION__); goto put_err_out; @@ -2554,7 +2557,9 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, m = ctx->mrec; /* Make room for attribute. */ - length = (0x18 + sizeof(ntfschar) * name_len + 7) & ~7; + length = offsetof(ATTR_RECORD, resident_end) + + ((name_len * sizeof(ntfschar) + 7) & ~7) + + ((size + 7) & ~7); if (ntfs_make_room_for_attr(ctx->mrec, (u8*) ctx->attr, length)) { err = errno; Dprintf("%s(): Failed to make room for attribute.\n", @@ -2568,11 +2573,15 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, a->length = cpu_to_le32(length); a->non_resident = 0; a->name_length = name_len; - a->name_offset = cpu_to_le16(0x18); + a->name_offset = cpu_to_le16(offsetof(ATTR_RECORD, resident_end)); a->flags = flags; a->instance = m->next_attr_instance; - a->value_length = 0; - a->value_offset = cpu_to_le16(length); + a->value_length = cpu_to_le32(size); + a->value_offset = cpu_to_le16(length - ((size + 7) & ~7)); + if (val) + memcpy((u8*)a + le16_to_cpu(a->value_offset), val, size); + else + memset((u8*)a + le16_to_cpu(a->value_offset), 0, size); if (type == AT_FILE_NAME) a->resident_flags = RESIDENT_ATTR_IS_INDEXED; else @@ -2893,7 +2902,14 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) * @type: type of the new attribute * @name: name in unicode of the new attribute * @name_len: name length in unicode characters of the new attribute - * @size: size of the new attribute + * @val: value of new attribute + * @size: size of the new attribute / length of @val (if specified) + * + * @val should always be specified for always resident attributes (eg. FILE_NAME + * attribute), for attributes that can become non-resident @val can be NULL + * (eg. DATA attribute). @size can be specified even if @val is NULL, in this + * case data size will be equal to @size and initialized size will be equal + * to 0. * * If inode haven't got enough space to add attribute, add attribute to one of * it extents, if no extents present or no one of them have enough space, than @@ -2904,21 +2920,21 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) * @type == AT_ATTRIBUTE_LIST, if you really need to add attribute list call * ntfs_inode_add_attrlist instead. * - * On success return opened new ntfs attribute. On error return NULL with errno - * set to the error code. + * On success return 0. On error return -1 with errno set to the error code. */ -ntfs_attr *ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, - ntfschar *name, u8 name_len, s64 size) +int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, + ntfschar *name, u8 name_len, u8 *val, s64 size) { u32 attr_rec_size; int err, i, offset; + BOOL is_resident; ntfs_inode *attr_ni; ntfs_attr *na; if (!ni || size < 0 || type == AT_ATTRIBUTE_LIST) { Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); errno = EINVAL; - return NULL; + return -1; } Dprintf("%s(): Entering for inode 0x%llx, attr %x, size %lld.\n", @@ -2927,19 +2943,40 @@ ntfs_attr *ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, if (ni->nr_extents == -1) ni = ni->base_ni; - /* Validate attribute type. */ - if (!ntfs_attr_find_in_attrdef(ni->vol, type)) { - if (errno == ENOENT) { - Dprintf("%s(): Invalid attribute type.\n", - __FUNCTION__); - errno = EINVAL; - return NULL; - } else { + /* Check the attribute type and the size. */ + if (ntfs_attr_size_bounds_check(ni->vol, type, size)) { + err = errno; + if (err == ERANGE) { + Dprintf("%s(): Size bounds check failed. " + "Aborting...\n", __FUNCTION__); + } else if (err == ENOENT) { + Dprintf("%s(): Invalid attribute type. " + "Aborting...\n", __FUNCTION__); + err = EIO; + } + errno = err; + return -1; + } + + /* Sanity checks for always resident attributes. */ + if (ntfs_attr_can_be_non_resident(ni->vol, type)) { + if (errno != EPERM) { err = errno; - Dprintf("%s(): ntfs_attr_find_in_attrdef failed.\n", + Dprintf("%s(): ntfs_attr_can_be_non_resident failed.\n", __FUNCTION__); - errno = err; - return NULL; + goto err_out; + } + /* @val is mandatory. */ + if (!val) { + Dprintf("%s(): @val is mandatory for always resident " + "atributes.\n", __FUNCTION__); + errno = EINVAL; + return -1; + } + if (size > ni->vol->mft_record_size) { + Dprintf("%s(): Attribute is too big.\n", __FUNCTION__); + errno = ERANGE; + return -1; } } @@ -2947,28 +2984,38 @@ ntfs_attr *ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, * Determine resident or not will be new attribute. We add 8 to size in * non resident case for mapping pairs. */ - if (ntfs_attr_can_be_resident(ni->vol, type)) { + if (!ntfs_attr_can_be_resident(ni->vol, type)) { + /* Attribute can be resident. */ + is_resident = TRUE; + /* Check if it is better to make attribute non resident. */ + if (!ntfs_attr_can_be_non_resident(ni->vol, type) && + offsetof(ATTR_RECORD, resident_end) + size >= + offsetof(ATTR_RECORD, non_resident_end) + 8) + /* Make it non resident. */ + is_resident = FALSE; + } else { if (errno != EPERM) { err = errno; - Dprintf("%s(): ntfs_attr_can_be resident failed.\n", + Dprintf("%s(): ntfs_attr_can_be_resident failed.\n", __FUNCTION__); goto err_out; } /* Attribute can't be resident. */ + is_resident = FALSE; + } + /* Calculate atribute record size. */ + if (is_resident) + attr_rec_size = offsetof(ATTR_RECORD, resident_end) + + ((name_len * sizeof(ntfschar) + 7) & ~7) + + ((size + 7) & ~7); + else attr_rec_size = offsetof(ATTR_RECORD, non_resident_end) + ((name_len * sizeof(ntfschar) + 7) & ~7) + 8; - } else { - /* Attribute can be resident. */ - attr_rec_size = offsetof(ATTR_RECORD, resident_end) + - ((name_len * sizeof(ntfschar) + 7) & ~7); - /* Check whether attribute will fit into the MFT record. */ - if (size + attr_rec_size >= ni->vol->mft_record_size) - /* Will not fit, make it non resident. */ - attr_rec_size = offsetof(ATTR_RECORD, - non_resident_end) + ((name_len * - sizeof(ntfschar) + 7) & ~7) + 8; - } + /* + * If we have enough free space for the new attribute in the base MFT + * record, then add attribute to it. + */ if (le32_to_cpu(ni->mrec->bytes_allocated) - le32_to_cpu(ni->mrec->bytes_in_use) >= attr_rec_size) { attr_ni = ni; @@ -2999,7 +3046,7 @@ ntfs_attr *ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, __FUNCTION__); goto err_out; } - return ntfs_attr_add(ni, type, name, name_len, size); + return ntfs_attr_add(ni, type, name, name_len, val, size); } /* Allocate new extent. */ attr_ni = ntfs_mft_record_alloc(ni->vol, ni); @@ -3011,29 +3058,33 @@ ntfs_attr *ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, } add_attr_record: - if (attr_rec_size == offsetof(ATTR_RECORD, resident_end) + - ((name_len * sizeof(ntfschar) + 7) & ~7)) { + if (is_resident) { /* Add resident attribute. */ offset = ntfs_resident_attr_record_add(attr_ni, type, name, - name_len, 0); + name_len, val, size, 0); if (offset < 0) { err = errno; Dprintf("%s(): Failed to add resident attribute.\n", __FUNCTION__); goto free_err_out; } - } else { - /* Add non resident attribute. */ - offset = ntfs_non_resident_attr_record_add(attr_ni, type, name, - name_len, 0, 8, 0); - if (offset < 0) { - err = errno; - Dprintf("%s(): Failed to add non resident attribute.\n", - __FUNCTION__); - goto free_err_out; - } + return 0; } + /* Add non resident attribute. */ + offset = ntfs_non_resident_attr_record_add(attr_ni, type, name, + name_len, 0, 8, 0); + if (offset < 0) { + err = errno; + Dprintf("%s(): Failed to add non resident attribute.\n", + __FUNCTION__); + goto free_err_out; + } + + /* If @size == 0, we are done. */ + if (!size) + return 0; + /* Open new attribute and resize it. */ na = ntfs_attr_open(ni, type, name, name_len); if (!na) { @@ -3042,21 +3093,23 @@ add_attr_record: __FUNCTION__); goto rm_attr_err_out; } - if (!size) - return na; - if (ntfs_attr_truncate(na, size)) { + /* Resize and set attribute value. */ + if (ntfs_attr_truncate(na, size) || + (val && (ntfs_attr_pwrite(na, 0, size, val) != size))) { err = errno; - Dprintf("%s(): Failed to resize just added attribute.\n", + Dprintf("%s(): Failed to initialize just added attribute.\n", __FUNCTION__); if (ntfs_attr_rm(na)) { Dprintf("%s(): Failed to remove just added attribute. " "Probably leaving inconstant metadata.\n", __FUNCTION__); + ntfs_attr_close(na); } goto err_out; } + ntfs_attr_close(na); /* Done !*/ - return na; + return 0; rm_attr_err_out: /* Remove just added attribute. */ @@ -3076,7 +3129,7 @@ free_err_out: } err_out: errno = err; - return NULL; + return -1; } /** diff --git a/libntfs/dir.c b/libntfs/dir.c index 1b049fed..5e8a7d12 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1076,7 +1076,6 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, const unsigned type) { ntfs_inode *ni; - ntfs_attr *na; FILE_NAME_ATTR *fn = NULL; STANDARD_INFORMATION *si = NULL; int err, fn_len, si_len; @@ -1110,20 +1109,12 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, si->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); si->last_access_time = utc2ntfs(ni->last_access_time); /* Add STANDARD_INFORMATION to inode. */ - na = ntfs_attr_add(ni, AT_STANDARD_INFORMATION, AT_UNNAMED, 0, si_len); - if (!na) { + if (ntfs_attr_add(ni, AT_STANDARD_INFORMATION, AT_UNNAMED, 0, + (u8*)si, si_len)) { err = errno; ntfs_error(, "Failed to add STANDARD_INFORMATION attribute."); goto err_out; } - if (ntfs_attr_pwrite(na, 0, si_len, si) != si_len) { - err = errno; - ntfs_attr_close(na); - ntfs_error(, "Failed to initialize STANDARD_INFORMATION " - "attribute."); - goto err_out; - } - ntfs_attr_close(na); if (type == NTFS_DT_DIR) { INDEX_ROOT *ir = NULL; INDEX_ENTRY *ie; @@ -1156,30 +1147,19 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, ie->key_length = 0; ie->flags = INDEX_ENTRY_END; /* Add INDEX_ROOT attribute to inode. */ - na = ntfs_attr_add(ni, AT_INDEX_ROOT, I30, 4, ir_len); - if (!na) { + if (ntfs_attr_add(ni, AT_INDEX_ROOT, I30, 4, (u8*)ir, ir_len)) { err = errno; free(ir); ntfs_error(, "Failed to add INDEX_ROOT attribute."); goto err_out; } - if (ntfs_attr_pwrite(na, 0, ir_len, ir) != ir_len) { - err = errno; - free(ir); - ntfs_attr_close(na); - ntfs_error(, "Failed to initialize INDEX_ROOT."); - goto err_out; - } - ntfs_attr_close(na); } else { /* Add DATA attribute to inode. */ - na = ntfs_attr_add(ni, AT_DATA, AT_UNNAMED, 0, 0); - if (!na) { + if (ntfs_attr_add(ni, AT_DATA, AT_UNNAMED, 0, NULL, 0)) { err = errno; ntfs_error(, "Failed to add DATA attribute."); goto err_out; } - ntfs_attr_close(na); } /* Create FILE_NAME attribute. */ fn_len = sizeof(FILE_NAME_ATTR) + name_len * sizeof(ntfschar); @@ -1201,19 +1181,11 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, fn->last_access_time = utc2ntfs(ni->last_access_time); memcpy(fn->file_name, name, name_len * sizeof(ntfschar)); /* Add FILE_NAME attribute to inode. */ - na = ntfs_attr_add(ni, AT_FILE_NAME, AT_UNNAMED, 0, fn_len); - if (!na) { + if (ntfs_attr_add(ni, AT_FILE_NAME, AT_UNNAMED, 0, (u8*)fn, fn_len)) { err = errno; ntfs_error(, "Failed to add FILE_NAME attribute."); goto err_out; } - if (ntfs_attr_pwrite(na, 0, fn_len, fn) != fn_len) { - err = errno; - ntfs_attr_close(na); - ntfs_error(, "Failed to initialize FILE_NAME attribute."); - goto err_out; - } - ntfs_attr_close(na); /* Add FILE_NAME attribute to index. */ if (ntfs_index_add_filename(dir_ni, fn, MK_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number)))) { diff --git a/libntfs/inode.c b/libntfs/inode.c index 4ceffbe4..b59a5216 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -866,7 +866,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) /* Add $ATTRIBUTE_LIST to mft record. */ if (ntfs_resident_attr_record_add(ni, - AT_ATTRIBUTE_LIST, NULL, 0, 0) < 0) { + AT_ATTRIBUTE_LIST, NULL, 0, NULL, 0, 0) < 0) { err = errno; Dprintf("%s(): Couldn't add $ATTRIBUTE_LIST to MFT record.\n", __FUNCTION__); diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 64e329de..35242ba2 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -378,12 +378,17 @@ int main (int argc, char *argv[]) goto close_dst; } /* Requested attribute isn't present, add it. */ - na = ntfs_attr_add(out, opts.attribute, attr_name, - attr_name_len, 0); - if (!na) { + if (ntfs_attr_add(out, opts.attribute, attr_name, + attr_name_len, NULL, 0)) { perror("ERROR: Couldn't add attribute"); goto close_dst; } + na = ntfs_attr_open(out, opts.attribute, attr_name, + attr_name_len); + if (!na) { + perror("ERROR: Couldn't open just added attribute"); + goto close_dst; + } } if (attr_name != AT_UNNAMED) free(attr_name); diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 4447c6ba..9b9e5a13 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -578,7 +578,6 @@ static int ntfs_fuse_create_stream(const char *path, ntfschar *stream_name, const int stream_name_len) { ntfs_inode *ni; - ntfs_attr *na; int res = 0; ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); @@ -598,10 +597,7 @@ static int ntfs_fuse_create_stream(const char *path, } return res; } - na = ntfs_attr_add(ni, AT_DATA, stream_name, stream_name_len, 0); - if (na) - ntfs_attr_close(na); - else + if (ntfs_attr_add(ni, AT_DATA, stream_name, stream_name_len, NULL, 0)) res = -errno; if (ntfs_inode_close(ni)) perror("Failed to close inode"); From 94be253f74be1968f2b77dc41c9c608a63098363 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 16 Sep 2005 14:30:08 +0000 Subject: [PATCH 2505/2994] minor ntfsmount cleanup --- ntfsprogs/ntfsmount.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 9b9e5a13..cca76cd8 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1150,16 +1150,16 @@ static char *parse_mount_options(char *org_options, char **device) Eprintf("'ro' option should not have value.\n"); goto err_exit; } - ctx->ro =TRUE; + ctx->ro = TRUE; strcat(ret, "ro,"); #ifdef DEBUG - } else if (!strcmp(opt, "fake_ro")) { + } else if (!strcmp(opt, "fake_rw")) { if (val) { - Eprintf("'fake_ro' option should not have " + Eprintf("'fake_rw' option should not have " "value.\n"); goto err_exit; } - ctx->ro =TRUE; + ctx->ro = TRUE; #endif } else if (!strcmp(opt, "fsname")) { /* Filesystem name. */ /* @@ -1274,7 +1274,7 @@ static void usage(void) * Return: 1 Success * 0 Error, one or more problems */ -static int parse_options (int argc, char *argv[]) +static int parse_options(int argc, char *argv[]) { int err = 0, help = 0; char c = -1; @@ -1293,7 +1293,7 @@ static int parse_options (int argc, char *argv[]) opts.mnt_point = NULL; opts.options = NULL; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!opts.mnt_point) From 459f98c2b21fdc0cb037260d4c062dbcde9aa39a Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 19 Sep 2005 20:50:01 +0000 Subject: [PATCH 2506/2994] fix a couple of range bugs (insert,replace) Anton: fix mergeable - use to merge non-adjacent holes Anton: factor out "tail" in replace - simplifying code comment and retest code --- libntfs/runlist.c | 60 +++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 6fb40803..bb2114af 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -111,17 +111,21 @@ static __inline__ BOOL ntfs_rl_are_mergeable(runlist_element *dst, return FALSE; } - if ((dst->lcn < 0) || (src->lcn < 0)) { /* Are we merging holes? */ - if (dst->lcn == LCN_HOLE && src->lcn == LCN_HOLE) - return TRUE; + /* We can merge unmapped regions even if they are misaligned. */ + if ((dst->lcn == LCN_RL_NOT_MAPPED) && (src->lcn == LCN_RL_NOT_MAPPED)) + return TRUE; + /* If the runs are misaligned, we cannot merge them. */ + if ((dst->vcn + dst->length) != src->vcn) return FALSE; - } - if ((dst->lcn + dst->length) != src->lcn) /* Are the runs contiguous? */ - return FALSE; - if ((dst->vcn + dst->length) != src->vcn) /* Are the runs misaligned? */ - return FALSE; - - return TRUE; + /* If both runs are non-sparse and contiguous, we can merge them. */ + if ((dst->lcn >= 0) && (src->lcn >= 0) && + ((dst->lcn + dst->length) == src->lcn)) + return TRUE; + /* If we are merging two holes, we can merge them. */ + if ((dst->lcn == LCN_HOLE) && (src->lcn == LCN_HOLE)) + return TRUE; + /* Cannot merge. */ + return FALSE; } /** @@ -166,7 +170,7 @@ static __inline__ void __ntfs_rl_merge(runlist_element *dst, static __inline__ runlist_element *ntfs_rl_append(runlist_element *dst, int dsize, runlist_element *src, int ssize, int loc) { - BOOL right; /* Right end of @src needs merging */ + BOOL right = FALSE; /* Right end of @src needs merging */ int marker; /* End of the inserted runs */ if (!dst || !src) { @@ -176,7 +180,8 @@ static __inline__ runlist_element *ntfs_rl_append(runlist_element *dst, } /* First, check if the right hand end needs merging. */ - right = ntfs_rl_are_mergeable(src + ssize - 1, dst + loc + 1); + if ((loc + 1) < dsize) + right = ntfs_rl_are_mergeable(src + ssize - 1, dst + loc + 1); /* Space required: @dst size + @src size, less one if we merged. */ dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - right); @@ -330,8 +335,9 @@ static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, static __inline__ runlist_element *ntfs_rl_replace(runlist_element *dst, int dsize, runlist_element *src, int ssize, int loc) { - BOOL left = FALSE; /* Left end of @src needs merging */ - BOOL right; /* Right end of @src needs merging */ + BOOL left = FALSE; /* Left end of @src needs merging */ + BOOL right = FALSE; /* Right end of @src needs merging */ + int tail; /* Start of tail of @dst */ int marker; /* End of the inserted runs */ if (!dst || !src) { @@ -340,13 +346,14 @@ static __inline__ runlist_element *ntfs_rl_replace(runlist_element *dst, return NULL; } - /* First, merge the left and right ends, if necessary. */ - right = ntfs_rl_are_mergeable(src + ssize - 1, dst + loc + 1); + /* First, see if the left and right ends need merging. */ + if ((loc + 1) < dsize) + right = ntfs_rl_are_mergeable(src + ssize - 1, dst + loc + 1); if (loc > 0) left = ntfs_rl_are_mergeable(dst + loc - 1, src); /* Allocate some space. We'll need less if the left, right, or both - * ends were merged. + * ends get merged. */ dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - left - right); if (!dst) @@ -355,24 +362,33 @@ static __inline__ runlist_element *ntfs_rl_replace(runlist_element *dst, * We are guaranteed to succeed from here so can start modifying the * original runlists. */ + + /* First, merge the left and right ends, if necessary. */ if (right) __ntfs_rl_merge(src + ssize - 1, dst + loc + 1); if (left) __ntfs_rl_merge(dst + loc - 1, src); + /* + * tail - Offset of the tail of @dst + * Nominally: @tail = @loc + 1 (location, skipping the replaced run) + * If "right", then one of @dst's runs is already merged into @src. + */ + tail = loc + right + 1; + /* * marker - First run after the @src runs that have been inserted - * Nominally: marker = @loc + @ssize (location + number of runs in @src) + * Nominally: @marker = @loc + @ssize (location + number of runs in @src) * If "left", then the first run in @src has been merged with one in @dst. */ marker = loc + ssize - left; /* Move the tail of @dst out of the way, then copy in @src. */ - ntfs_rl_mm(dst, marker, loc + right + 1, dsize - loc - right - 1); + ntfs_rl_mm(dst, marker, tail, dsize - tail); ntfs_rl_mc(dst, loc, src, left, ssize - left); /* We may have changed the length of the file, so fix the end marker */ - if (((dsize - loc - right - 1) > 0) && (dst[marker].lcn == LCN_ENOENT)) + if (((dsize - tail) > 0) && (dst[marker].lcn == LCN_ENOENT)) dst[marker].vcn = dst[marker - 1].vcn + dst[marker - 1].length; return dst; @@ -1855,6 +1871,7 @@ static void test_rl_pure (char *contig, char *multi) static runlist_element file4[] = { { 0, -3, 0 } /* NOENT */ }; +#if 0 static runlist_element file5[] = { { 0, -2, 100 }, /* NOTMAP */ { 100, 1100, 100 }, /* DATA */ @@ -1868,6 +1885,7 @@ static void test_rl_pure (char *contig, char *multi) { 100, -2, 100 }, /* NOTMAP */ { 200, -3, 0 } /* NOENT */ }; +#endif BOOL c, m; if (strcmp (contig, "contig") == 0) @@ -1907,6 +1925,7 @@ static void test_rl_pure (char *contig, char *multi) test_rl_pure_test (18, c, m, 140, 40, file3, sizeof (file3)); test_rl_pure_test (19, c, m, 0, 40, file4, sizeof (file4)); test_rl_pure_test (20, c, m, 40, 40, file4, sizeof (file4)); +#if 0 test_rl_pure_test (21, c, m, 0, 40, file5, sizeof (file5)); test_rl_pure_test (22, c, m, 40, 40, file5, sizeof (file5)); test_rl_pure_test (23, c, m, 60, 40, file5, sizeof (file5)); @@ -1921,6 +1940,7 @@ static void test_rl_pure (char *contig, char *multi) test_rl_pure_test (32, c, m, 400, 100, file5, sizeof (file5)); test_rl_pure_test (33, c, m, 160, 100, file6, sizeof (file6)); test_rl_pure_test (34, c, m, 100, 140, file6, sizeof (file6)); +#endif } /** From 374f5ac4f7e24427280c8a27cd90b2bff0aa63bd Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 19 Sep 2005 20:58:54 +0000 Subject: [PATCH 2507/2994] *cough* remove some debug #ifdefs --- libntfs/runlist.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index bb2114af..fe0ed0e9 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1871,7 +1871,6 @@ static void test_rl_pure (char *contig, char *multi) static runlist_element file4[] = { { 0, -3, 0 } /* NOENT */ }; -#if 0 static runlist_element file5[] = { { 0, -2, 100 }, /* NOTMAP */ { 100, 1100, 100 }, /* DATA */ @@ -1885,7 +1884,6 @@ static void test_rl_pure (char *contig, char *multi) { 100, -2, 100 }, /* NOTMAP */ { 200, -3, 0 } /* NOENT */ }; -#endif BOOL c, m; if (strcmp (contig, "contig") == 0) @@ -1925,7 +1923,6 @@ static void test_rl_pure (char *contig, char *multi) test_rl_pure_test (18, c, m, 140, 40, file3, sizeof (file3)); test_rl_pure_test (19, c, m, 0, 40, file4, sizeof (file4)); test_rl_pure_test (20, c, m, 40, 40, file4, sizeof (file4)); -#if 0 test_rl_pure_test (21, c, m, 0, 40, file5, sizeof (file5)); test_rl_pure_test (22, c, m, 40, 40, file5, sizeof (file5)); test_rl_pure_test (23, c, m, 60, 40, file5, sizeof (file5)); @@ -1940,7 +1937,6 @@ static void test_rl_pure (char *contig, char *multi) test_rl_pure_test (32, c, m, 400, 100, file5, sizeof (file5)); test_rl_pure_test (33, c, m, 160, 100, file6, sizeof (file6)); test_rl_pure_test (34, c, m, 100, 140, file6, sizeof (file6)); -#endif } /** From 7f8ad30c09aec3306bb3c6a018196340dffc2d90 Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 20 Sep 2005 00:05:49 +0000 Subject: [PATCH 2508/2994] more code juggling try and sort out transfer --- ntfsprogs/ntfsrm.c | 629 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 521 insertions(+), 108 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 5534a492..d4a23833 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -43,7 +43,7 @@ GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) -#define RM_WRITE 1 +#define RM_WRITE 0 /** * version - Print version information about the program @@ -857,46 +857,6 @@ static int ntfs_inode_close2 (ntfs_inode *ni) return ntfs_inode_close (ni); } -/** - * utils_index_init - */ -static int utils_index_init (ntfs_volume *vol, u8 *buffer, int size) -{ - INDEX_ALLOCATION *alloc; - INDEX_ENTRY_HEADER *header; - - if (!vol) - return 1; - if (!buffer) - return 1; - if (size < 512) - return 1; - - memset (buffer, 0, size); - - alloc = (INDEX_ALLOCATION*) buffer; - - alloc->magic = magic_INDX; - alloc->usa_ofs = 0x28; - alloc->usa_count = (size >> vol->sector_size_bits) + 1; - alloc->lsn = 0; - alloc->index_block_vcn = 0; - - alloc->index.entries_offset = 0x40; - alloc->index.index_length = 0x10; - alloc->index.allocated_size = size - 0x18; - alloc->index.flags = 0; - - header = (INDEX_ENTRY_HEADER*) (buffer + 0x40); - - header->indexed_file = 0; - header->length = 0x10; - header->key_length = 0; - header->flags = INDEX_ENTRY_END; - - return 0; -} - /** * ntfs_dt_free @@ -1049,7 +1009,46 @@ static BOOL ntfs_dt_create_children2 (struct ntfs_dt *dt, int count) memset ((u8*)dt->sub_nodes + old, 0, (new - old) * sizeof (*dt->sub_nodes)); memset ((u8*)dt->inodes + old, 0, (new - old) * sizeof (*dt->inodes)); - return (dt->children && dt->sub_nodes && dt->inodes); + return TRUE; +} + +/** + * ntfs_dt_resize_children3 + */ +static BOOL ntfs_dt_resize_children3 (struct ntfs_dt *dt, int new) +{ + int old; + + // XXX calculate for 2K and 4K indexes max and min filenames (inc/exc VCN) + // XXX assumption: sizeof (*dt->children) == sizeof (*dt->sub_nodes) == sizeof (*dt->inodes) + // XXX put back blocking factor + + if (!dt) + return FALSE; + + old = dt->child_count; + if (old == new) + return TRUE; + + dt->child_count = new; + + old *= sizeof (*dt->children); + new *= sizeof (*dt->children); + + dt->children = realloc (dt->children, new); + dt->sub_nodes = realloc (dt->sub_nodes, new); + dt->inodes = realloc (dt->inodes, new); + + if (!dt->children || !dt->sub_nodes || !dt->inodes) + return FALSE; + + if (new > old) { + memset ((u8*)dt->children + old, 0, (new - old)); + memset ((u8*)dt->sub_nodes + old, 0, (new - old)); + memset ((u8*)dt->inodes + old, 0, (new - old)); + } + + return TRUE; } /** @@ -1087,8 +1086,7 @@ static int ntfs_dt_root_count (struct ntfs_dt *dt) while (ptr < (buffer + size)) { entry = (INDEX_ENTRY*) ptr; - dt->child_count++; - ntfs_dt_create_children2 (dt, dt->child_count); // XXX retval + ntfs_dt_resize_children3 (dt, dt->child_count + 1); // XXX retval if (entry->flags & INDEX_ENTRY_NODE) { vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); @@ -1142,11 +1140,11 @@ static int ntfs_dt_alloc_count (struct ntfs_dt *dt) //printf ("block size %d\n", block->index.index_length); dt->child_count = 0; + //printf ("start = 0x%02X, end = 0x%02X\n", 0x18 + block->index.entries_offset, 0x18 + block->index.index_length); while (ptr < (buffer + 0x18 + block->index.index_length)) { entry = (INDEX_ENTRY*) ptr; - dt->child_count++; - ntfs_dt_create_children2 (dt, dt->child_count); // XXX retval + ntfs_dt_resize_children3 (dt, dt->child_count + 1); // XXX retval if (entry->flags & INDEX_ENTRY_NODE) { vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); @@ -1171,6 +1169,48 @@ static int ntfs_dt_alloc_count (struct ntfs_dt *dt) return dt->child_count; } +/** + * ntfs_dt_initialise2 + */ +static int ntfs_dt_initialise2 (ntfs_volume *vol, struct ntfs_dt *dt) +{ + INDEX_ALLOCATION *alloc; + INDEX_ENTRY *entry; + + if (!vol) + return 1; + if (!dt) + return 1; + + memset (dt->data, 0, dt->data_len); + + alloc = (INDEX_ALLOCATION*) dt->data; + + alloc->magic = magic_INDX; + alloc->usa_ofs = 0x28; + alloc->usa_count = (dt->data_len >> vol->sector_size_bits) + 1; + alloc->lsn = 0; + alloc->index_block_vcn = 0; + + alloc->index.entries_offset = 0x28; + alloc->index.index_length = 0x10 + 0x28; + alloc->index.allocated_size = dt->data_len - 0x18; + alloc->index.flags = 0; + + entry = (INDEX_ENTRY*) (dt->data + 0x40); + + entry->indexed_file = 0; + entry->length = 0x10; + entry->key_length = 0; + entry->flags = INDEX_ENTRY_END; + + ntfs_dt_resize_children3 (dt, 1); // XXX retval + + dt->children[0] = entry; + + return 0; +} + /** * ntfs_dt_create */ @@ -1209,7 +1249,7 @@ static struct ntfs_dt * ntfs_dt_create (struct ntfs_dir *dir, struct ntfs_dt *pa //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data)); ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data); } else { - utils_index_init (dir->vol, dt->data, dt->data_len); + ntfs_dt_initialise2 (dir->vol, dt); } //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); @@ -1643,52 +1683,6 @@ static int ntfs_dt_alloc_freespace (struct ntfs_dt *dt) return recsize - inuse; } -/** - * ntfs_dt_initialise - */ -static int ntfs_dt_initialise (struct ntfs_dt *dt, VCN vcn) -{ - INDEX_BLOCK *block; - INDEX_ENTRY *ie; - - if (!dt || !dt->data) - return -1; - - memset (dt->data, 0, dt->data_len); - - // Ought to check these are empty - free (dt->children); - free (dt->sub_nodes); - - dt->children = NULL; - dt->sub_nodes = NULL; - - if (!ntfs_dt_create_children2 (dt, 1)) - return -1; - - block = (INDEX_BLOCK*) dt->data; - - block->magic = magic_INDX; - block->usa_ofs = 0x28; - block->usa_count = (dt->data_len >> 9) + 1; - block->index_block_vcn = vcn; - block->index.entries_offset = 0x28; - block->index.index_length = 0x38; - block->index.allocated_size = dt->data_len - 0x18; - - ie = (INDEX_ENTRY*) (dt->data + block->index.entries_offset + 0x18); - - ie->length = 0x10; - ie->flags = INDEX_ENTRY_END; - - dt->children[0] = ie; - dt->sub_nodes[0] = NULL; - - //utils_dump_mem (dt->data, 0, block->index.index_length+0x18, DM_DEFAULTS); - - return 0; -} - /** * ntfs_dt_transfer */ @@ -1789,8 +1783,7 @@ static int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start //printf ("dst = %d, len = %d\n", dst - old->data, len); memset (dst, 0, len); - new->child_count += count; - if (!ntfs_dt_create_children2 (new, new->child_count)) + if (!ntfs_dt_resize_children3 (new, new->child_count + count)) return -1; src = (u8*) &old->sub_nodes[start+count-1]; @@ -1805,8 +1798,427 @@ static int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start memmove (dst, src, len); - old->child_count -= count; - if (!ntfs_dt_create_children2 (old, old->child_count)) + if (!ntfs_dt_resize_children3 (old, old->child_count - count)) + return -1; + + src = (u8*) new->children[0]; + for (i = 0; i < new->child_count; i++) { + new->children[i] = (INDEX_ENTRY*) src; + src += new->children[i]->length; + } + + src = (u8*) old->children[0]; + for (i = 0; i < old->child_count; i++) { + old->children[i] = (INDEX_ENTRY*) src; + src += old->children[i]->length; + } + + old->header->index_length -= need; + new->header->index_length += need; + + // resize children and sub_nodes + // memmove keys in new + // memcpy old to new + // memmove keys in old + // rebuild old/new children/sub_nodes without destroying tree + // update old/new headers + + old->changed = TRUE; + new->changed = TRUE; + + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); + + return 0; +} + + +/** + * ntfs_dt_alloc_insert + */ +static int ntfs_dt_alloc_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count) +{ + // XXX don't bother measuring, just subtract the children pointers + + int i; + int need; + INDEX_ENTRY *ie; + INDEX_ALLOCATION *alloc; + u8 *src; + u8 *dst; + int len; + + if (!dt) + return 1; + if (!first) + return 1; + + need = 0; + ie = first; + for (i = 0; i < count; i++) { + need += ie->length; + ie = (INDEX_ENTRY*) ((u8*)ie + ie->length); + } + + printf ("alloc insert %d bytes\n", need); + + alloc = (INDEX_ALLOCATION*) dt->data; + printf ("entries_offset = %d\n", alloc->index.entries_offset); + printf ("index_length = %d\n", alloc->index.index_length); + printf ("allocated_size = %d\n", alloc->index.allocated_size); + + printf ("insert has %d children\n", dt->child_count); + printf ("children = %p\n", dt->children); + //utils_dump_mem (dt->data, 0, 128, DM_DEFAULTS); + + ie = dt->children[dt->child_count-1]; + + printf ("last child = %p (%ld)\n", ie, (long)ie - (long)dt->data); + printf ("size = %d\n", ie->length); + + src = (u8*) ie; + dst = src + need; + len = ie->length; + + memmove (dst, src, len); + + src = (u8*) first; + dst = (u8*) ie; + len = need; + + memcpy (dst, src, len); + + // use create children + // measure need and update children list + // adjust headers + + utils_dump_mem (dt->data, 0, 256, DM_DEFAULTS); + return 0; +} + +/** + * ntfs_dt_alloc_insert2 + */ +static INDEX_ENTRY * ntfs_dt_alloc_insert2 (struct ntfs_dt *dt, int before, int count, int bytes) +{ + int space; + u8 *src; + u8 *dst; + int len; + + // XXX don't bother measuring, just subtract the children pointers + + if (!dt) + return NULL; + if (before < 0) + return NULL; + if (count < 1) + return NULL; + if (bytes < 1) + return NULL; + + // check alloc has enough space + space = ntfs_dt_alloc_freespace (dt); + if (bytes > space) + return NULL; + + // move data + src = (u8*) dt->children[before]; + dst = src + bytes; + len = dt->header->index_length - ((int)dt->children[before] - (int)dt->data) + 24; + + //printf ("%d, %d, %d\n", (int)src - (int)dt->data, (int)dst - (int)dt->data, len); + + memmove (dst, src, len); + memset (dst, 0, bytes); + + // resize arrays + ntfs_dt_resize_children3 (dt, dt->child_count + count); + + // move keys (children) + src = (u8*) (dt->children + before); + dst = src + (count * sizeof (u8*)); + len = (dt->child_count - count - before) * sizeof (u8*); + + memmove (dst, src, len); + memset (src, 0, count * sizeof (u8*)); + + // move keys (inodes) + src = (u8*) (dt->inodes + before); + dst = src + (count * sizeof (u8*)); + len = (dt->child_count - count - before) * sizeof (u8*); + + memmove (dst, src, len); + memset (src, 0, count * sizeof (u8*)); + + // move keys (sub_nodes) + src = (u8*) (dt->sub_nodes + before); + dst = src + (count * sizeof (u8*)); + len = (dt->child_count - count - before) * sizeof (u8*); + + memmove (dst, src, len); + memset (src, 0, count * sizeof (u8*)); + + return NULL; +} + +/** + * ntfs_dt_root_insert + */ +static int ntfs_dt_root_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count) +{ + if (!dt) + return 1; + if (!first) + return 1; + + return count; +} + + +/** + * utils_array_insert + */ +static int utils_array_insert (void *ptr, int asize, int before, int count) +{ + static int esize = sizeof (u8*); + u8 *src; + u8 *dst; + int len; + + if (!ptr) + return -1; + + src = (u8*) ptr + (before * esize); + dst = src + (count * esize); + len = (asize - before) * esize; + + // XXX what about realloc? + memmove (dst, src, len); + + len = count * esize; + + memset (src, 0, len); + + return 0; +} + +/** + * utils_array_remove + */ +static int utils_array_remove (void *ptr, int asize, int first, int count) +{ + static int esize = sizeof (u8*); + u8 *src; + u8 *dst; + int len; + + if (!ptr) + return -1; + + dst = (u8*) ptr + (first * esize); + src = dst + (count * esize); + len = (asize - first) * esize; + + memmove (dst, src, len); + + src = (u8*) ptr + ((asize - count) * esize); + len = count * esize; + + memset (src, 0, len); + // XXX don't want to memset, want to realloc + + return 0; +} + + +/** + * ntfs_dt_alloc_remove2 + */ +static int ntfs_dt_alloc_remove2 (struct ntfs_dt *dt, int start, int count) +{ + int i; + int size; + + if (!dt) + return 1; + + size = 0; + for (i = start; i < (start+count); i++) { + size += dt->children[i]->length; + } + + return start + count; +} + +/** + * ntfs_dt_root_remove2 + */ +static int ntfs_dt_root_remove2 (struct ntfs_dt *dt, int start, int count) +{ + int i; + int size; + + if (!dt) + return -1; + if ((start < 0) || (start >= dt->child_count)) + return -1; + if ((count < 1) || ((start + count - 1) >= dt->child_count)) + return -1; + + printf ("s c/t %d %d/%d\n", start, count, dt->child_count); + + size = 0; + for (i = start; i < (start + count); i++) + size += dt->children[i]->length; + printf ("size1 = %d\n", size); + + size = (int) dt->children[start+count] - (int) dt->children[start]; + printf ("size2 = %d\n", size); + + size = (int) dt->children[start+count-1] - (int) dt->children[start] + dt->children[start+count-1]->length; + printf ("size3 = %d\n", size); + + // XXX what shall we do with the inodes? + // transfer them to the dir (commit them for now) + // are they _our_ responsibility? probably not + + // rearrange arrays + // shrink attribute + + ntfs_dt_resize_children3 (dt, dt->child_count - count); + + printf ("ntfs_dt_root_remove2\n"); + return dt->child_count; +} + +/** + * ntfs_dt_transfer2 + */ +static int ntfs_dt_transfer2 (struct ntfs_dt *old, struct ntfs_dt *new, int start, int count) +{ + int i; + int need; + int space; + INDEX_ENTRY *mov_ie; + u8 *src; + u8 *dst; + int len; + int insert; + //FILE_NAME_ATTR *file; + + if (!old || !new) + return -1; + + if ((start < 0) || (count < 0)) + return -1; + + if ((start + count) >= old->child_count) + return -1; + + printf ("\n"); + printf (BOLD YELLOW "Transferring children\n" END); + + need = 0; + for (i = start; i < (start+count); i++) { + mov_ie = old->children[i]; + need += mov_ie->length; + //file = &mov_ie->key.file_name; printf ("\ttrn name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + } + + if (ntfs_dt_isroot (new)) + space = ntfs_dt_root_freespace (new); + else + space = ntfs_dt_alloc_freespace (new); + + printf ("\tneed = %d\n", need); + printf ("\tspace = %d\n", space); + + if (need > space) + return -1; + + if (ntfs_dt_isroot (new)) + ntfs_dt_root_insert (new, old->children[0], count); + else + ntfs_dt_alloc_insert2 (new, 0, count, need); + + if (ntfs_dt_isroot (old)) + ntfs_dt_root_remove2 (old, 0, count); + else + ntfs_dt_alloc_remove2 (old, 0, count); + + if (1) return -1; + if (0) ntfs_dt_alloc_insert (NULL, NULL, 0); + + if (new->child_count == 1) { + i = -1; + } else { + ntfschar *n1, *n2; + int l1, l2; + + n1 = new->children[0]->key.file_name.file_name; + l1 = new->children[0]->key.file_name.file_name_length; + + n2 = old->children[start]->key.file_name.file_name; + l2 = old->children[start]->key.file_name.file_name_length; + + i = ntfs_names_collate (n1, l1, n2, l2, + 2, IGNORE_CASE, + old->dir->vol->upcase, + old->dir->vol->upcase_len); + } + + if ((i == 0) || (i == 2)) + return -1; + + // determine the insertion point + if (i == 1) + insert = 0; + else + insert = new->child_count-1; + + src = (u8*) new->children[insert]; + dst = src + need; + len = (u8*) new->children[new->child_count-1] + new->children[new->child_count-1]->length - src; + + //printf ("src = %d, dst = %d, len = %d\n", src - new->data, dst - new->data, len); + memmove (dst, src, len); + + dst = src; + src = (u8*) old->children[start]; + len = need; + + memcpy (dst, src, len); + + src = (u8*) old->children[start+count-1]; + dst = (u8*) old->children[start]; + len = (u8*) old->children[old->child_count-1] + old->children[old->child_count-1]->length - src; + + //printf ("src = %d, dst = %d, len = %d\n", src - old->data, dst - old->data, len); + memmove (dst, src, len); + + dst += len; + len = old->data + old->dir->index_size - dst; + + //printf ("dst = %d, len = %d\n", dst - old->data, len); + memset (dst, 0, len); + + if (!ntfs_dt_resize_children3 (new, new->child_count + count)) + return -1; + + src = (u8*) &old->sub_nodes[start+count-1]; + dst = (u8*) &old->sub_nodes[start]; + len = (old->child_count - start - count + 1) * sizeof (struct ntfs_dt*); + + memmove (dst, src, len); + + src = (u8*) &new->sub_nodes[insert]; + dst = (u8*) &new->sub_nodes[insert+count-1]; + len = (new->child_count - insert - count + 1) * sizeof (struct ntfs_dt*); + + memmove (dst, src, len); + + if (!ntfs_dt_resize_children3 (old, old->child_count - count)) return -1; src = (u8*) new->children[0]; @@ -2183,13 +2595,12 @@ static int ntfs_mft_add_index (struct ntfs_dir *dir) // can't replace ie yet, there may not be room ntfs_ie_free (ie); - //ntfs_dt_transfer (dir->index, dt, 0, 7); + ntfs_dt_transfer2 (dir->index, dt, 0, dir->index->child_count - 1); printf ("root has %d children\n", dir->index->child_count); printf ("node has %d children\n", dt->child_count); ntfs_dt_free (dt); - //utils_index_init (vol, buffer, dir->index_size); // create a new dt // attach dt to dir @@ -2523,7 +2934,6 @@ static BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) del->data = realloc (del->data, del->data_len); del->header = (INDEX_HEADER*) (del->data + 0x10); - //utils_dump_mem (del->data, 0, del->data_len, DM_GREEN | DM_RED); src = (u8*) (&del->children[del_num+1]); @@ -2865,6 +3275,7 @@ static int ntfs_dt_root_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY src = parent->data + 0x18 + parent->header->entries_offset; len = parent->data_len - 0x18 - parent->header->entries_offset; + // XXX can we rebase the children more simply? (in alloc_add too) while (src < (parent->data + parent->data_len)) { entry = (INDEX_ENTRY*) src; @@ -2988,7 +3399,9 @@ ascend: //printf ("\tnode has %d children\n", suc->child_count); // initialise new node - ntfs_dt_initialise (new, vcn); + // XXX ntfs_dt_initialise (new, vcn); + + goto done; // find median key median = (suc->child_count+1) / 2; @@ -3506,6 +3919,7 @@ static int ntfs_volume_umount2 (ntfs_volume *vol, const BOOL force) static ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL force) { // XXX can we replace these and search by mft number? Hmm... NO. + // unless I have a recursive search for an MFT number static ntfschar bmp[8] = { const_cpu_to_le16('$'), const_cpu_to_le16('B'), @@ -3573,7 +3987,7 @@ static ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags //$Bitmap num = -1; - found = ntfs_dt_find2 (root, bmp, 7, &num); + found = ntfs_dt_find2 (root, bmp, sizeof (bmp) - 1, &num); if ((!found) || (num < 0)) { printf ("can't find $Bitmap\n"); ntfs_volume_umount2 (vol, FALSE); @@ -3586,7 +4000,7 @@ static ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags //$MFT num = -1; - found = ntfs_dt_find2 (root, mft, 4, &num); + found = ntfs_dt_find2 (root, mft, sizeof (mft) - 1, &num); if ((!found) || (num < 0)) { printf ("can't find $MFT\n"); ntfs_volume_umount2 (vol, FALSE); @@ -3599,7 +4013,7 @@ static ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags //$MFTMirr num = -1; - found = ntfs_dt_find2 (root, mftmirr, 8, &num); + found = ntfs_dt_find2 (root, mftmirr, sizeof (mftmirr) - 1, &num); if ((!found) || (num < 0)) { printf ("can't find $MFTMirr\n"); ntfs_volume_umount2 (vol, FALSE); @@ -3940,19 +4354,15 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) printf (BOLD YELLOW "Find childless parent:\n" END); #if 0 for (par = del->parent, old = par; par; old = par, par = par->parent) { - printf (CYAN "marker 1\n" END); if (par->child_count > 1) break; - printf (CYAN "marker 2\n" END); par_num = ntfs_dt_find_parent (par); } #endif - printf (CYAN "marker 3\n" END); fflush (stdout); printf ("del = %p, parent = %p\n", del, del->parent); par = del->parent; par_num = ntfs_dt_find_parent (del); - printf (CYAN "marker 4\n" END); fflush (stdout); //utils_dump_mem (par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); @@ -4365,6 +4775,9 @@ done: if (0) utils_pathname_to_inode2 (NULL, NULL, NULL, NULL); if (0) ntfs_ie_remove_name (NULL); + if (0) ntfs_dt_transfer2 (NULL, NULL, 0, 0); + if (0) utils_array_remove (NULL, 0, 0, 0); + if (0) utils_array_insert (NULL, 0, 0, 0); return result; } From 192348fa0ae5c716f6d9ba892da0cf31afcd5b48 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 20 Sep 2005 16:24:26 +0000 Subject: [PATCH 2509/2994] ntfsclone manual: update --ignore-fs-check option description --- ntfsprogs/ntfsclone.8.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 0dfe30da..5821e659 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -5,7 +5,7 @@ .\" All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLONE 8 "Jun 2005" "ntfsprogs version @VERSION@" +.TH NTFSCLONE 8 "Sep 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsclone \- Efficiently clone, image, restore or rescue an NTFS .SH SYNOPSIS @@ -197,7 +197,8 @@ You can't metadata-only clone to a device, image or standard output. Ignore the result of the filesystem consistency check. This option is allowed to be used only with the .BR --metadata -option, for the safety of user's data. +option, for the safety of user's data. The clusters which cause the +inconsistency are saved too. .TP .B \-f, \-\-force Forces ntfsclone to proceed if the filesystem is marked From 6effd0bc6f21849d6387cd89a0c0723fc31c7f92 Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 20 Sep 2005 19:24:09 +0000 Subject: [PATCH 2510/2994] minor improvements to test build --- Makefile.am | 5 +++-- test/Makefile.am | 13 ++----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Makefile.am b/Makefile.am index dc4ee612..beaf999f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS = doc include libntfs ntfsprogs test +SUBDIRS = doc include libntfs ntfsprogs EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ INSTALL NEWS README autogen.sh ntfsprogs.spec.in \ @@ -8,7 +8,7 @@ EXTRA_DIST = AUTHORS CREDITS COPYING TODO.include TODO.libntfs ChangeLog \ AUTOMAKE_OPTIONS = gnu MAINTAINERCLEANFILES = configure Makefile.in aclocal.m4 compile depcomp \ - install-sh missing config.guess config.sub config.h.in INSTALL + install-sh ltmain.sh missing config.guess config.sub config.h.in INSTALL dist-hook: ntfsprogs.spec cp ntfsprogs.spec $(distdir) @@ -30,6 +30,7 @@ extras: libs if ENABLE_TEST test: libs (cd test && $(MAKE) all test) || exit 1; +SUBDIRS += test else .PHONY: test test: diff --git a/test/Makefile.am b/test/Makefile.am index 9c7f9daf..ba3e615c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -38,9 +38,6 @@ test: $(TEST_RUNLIST) testz testp testf testz: $(TEST_RUNLIST) @$(TEST_VALGRIND) $(TEST_RUNLIST) zero > zero @diff -qs {runlist-data/,}zero - @echo - @echo Success - @echo testp: $(TEST_RUNLIST) @for i in contig noncontig; do \ @@ -49,19 +46,13 @@ testp: $(TEST_RUNLIST) L2=`echo $$j | cut -b1`; \ FILE=pure-$$L1$$L2; \ $(TEST_VALGRIND) $(TEST_RUNLIST) pure $$i $$j > $$FILE; \ - diff -qs {runlist-data/,}$$FILE; \ + diff -qs {runlist-data/,}$$FILE; \ done; \ done - @echo - @echo Success - @echo testf: $(TEST_RUNLIST) @for i in 123 132 213 231 312 321; do \ $(TEST_VALGRIND) $(TEST_RUNLIST) frag $$i > frag$$i; \ - diff -qs {runlist-data/,}frag$$i; \ + diff -qs {runlist-data/,}frag$$i; \ done - @echo - @echo Success - @echo From 531305cc1e43afe69c99fba45f0055b2bd6c6fb6 Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 22 Sep 2005 16:41:43 +0000 Subject: [PATCH 2511/2994] Christophe: add easily accessible version info to libntfs --- include/ntfs/Makefile.am | 1 + include/ntfs/version.h | 28 +++++++++++++++++++++++++++ libntfs/Makefile.am | 1 + libntfs/version.c | 41 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 include/ntfs/version.h create mode 100644 libntfs/version.c diff --git a/include/ntfs/Makefile.am b/include/ntfs/Makefile.am index 918ceaf4..89608d4b 100644 --- a/include/ntfs/Makefile.am +++ b/include/ntfs/Makefile.am @@ -29,6 +29,7 @@ linux_ntfsinclude_HEADERS = \ ntfstime.h \ types.h \ unistr.h \ + version.h \ volume.h MAINTAINERCLEANFILES = Makefile.in diff --git a/include/ntfs/version.h b/include/ntfs/version.h new file mode 100644 index 00000000..d9198b71 --- /dev/null +++ b/include/ntfs/version.h @@ -0,0 +1,28 @@ +/** + * version.h - Info about the NTFS library. Part of the Linux-NTFS project. + * + * Copyright (c) 2005 Richard Russon + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_VERSION_H_ +#define _NTFS_VERSION_H_ + +extern const char * ntfs_get_library_version (void); + +#endif /* _NTFS_VERSION_H_ */ + diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 5594e546..40cc0fd9 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -54,6 +54,7 @@ libntfs_la_SOURCES = \ runlist.c \ security.c \ unistr.c \ + version.c \ volume.c if ENABLE_GNOME_VFS diff --git a/libntfs/version.c b/libntfs/version.c new file mode 100644 index 00000000..6cfba869 --- /dev/null +++ b/libntfs/version.c @@ -0,0 +1,41 @@ +/** + * version.c - Info about the NTFS library. Part of the Linux-NTFS project. + * + * Copyright (c) 2005 Richard Russon + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "version.h" + +#ifndef VERSION +#define VERSION "unknown" +#endif + +/** + * ntfs_get_library_version - Version number of the library release + * + * Returns a text string representing the release of libntfs, e.g. "1.9.4". + */ +const char * ntfs_get_library_version (void) +{ + return VERSION; +} + From 48b8edc4644a96c5403a9df8a6b244f8cc14c7e0 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 24 Sep 2005 13:03:07 +0000 Subject: [PATCH 2512/2994] fix attribute list adding --- libntfs/attrlist.c | 74 +++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 168b69cc..c63bf8fc 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -99,6 +99,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) ATTR_LIST_ENTRY *ale; MFT_REF mref; ntfs_attr *na = NULL; + ntfs_attr_search_ctx *ctx; u8 *new_al; int entry_len, entry_offset, err; @@ -133,41 +134,46 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) return -1; } - /* Find offset at which insert new entry. */ - ale = (ATTR_LIST_ENTRY *) ni->attr_list; - for(; (u8 *)ale < ni->attr_list + ni->attr_list_size; - ale = (ATTR_LIST_ENTRY *)((u8 *) ale + - le16_to_cpu(ale->length))) { - if (le32_to_cpu(ale->type) < le32_to_cpu(attr->type)) - continue; - if (le32_to_cpu(ale->type) > le32_to_cpu(attr->type)) - break; - err = ntfs_names_collate(ale->name, ale->name_length, - (ntfschar*)((u8*)attr + le16_to_cpu(attr->name_offset)), - attr->name_length, -2, CASE_SENSITIVE, NULL, 0); - if (err == -2) { - err = EIO; - Dprintf("%s(): Corrupt attribute name. Run chkdsk.\n", - __FUNCTION__); - goto err_out; - } - if (err < 0) - continue; - if (err > 0) - break; - if (sle64_to_cpu(ale->lowest_vcn) < - sle64_to_cpu(attr->lowest_vcn)) - continue; - if (sle64_to_cpu(ale->lowest_vcn) == - sle64_to_cpu(attr->lowest_vcn)) { - err = EEXIST; - Dprintf("%s(): Attribute with same type, name and " - "lowest vcn already present in attribute " - "list.\n", __FUNCTION__); - goto err_out; - } - break; + /* Find place for the new entry. */ + ctx = ntfs_attr_get_search_ctx(ni, NULL); + if (!ctx) { + err = errno; + Dprintf("%s(): Failed to obtain attribute search context.\n", + __FUNCTION__); + goto err_out; } + if (!ntfs_attr_lookup(attr->type, (attr->name_length) ? (ntfschar*) + ((u8*)attr + le16_to_cpu(attr->name_offset)) : + AT_UNNAMED, attr->name_length, CASE_SENSITIVE, + (attr->non_resident) ? le64_to_cpu(attr->lowest_vcn) : + 0, (attr->non_resident) ? NULL : ((u8*)attr + + le16_to_cpu(attr->value_offset)), (attr->non_resident) ? + 0 : le32_to_cpu(attr->value_length), ctx)) { + /* Found some extent, check it to be before new extent. */ + if (ctx->al_entry->lowest_vcn == attr->lowest_vcn) { + err = EEXIST; + Dprintf("%s(): Such attribute already present in the " + "attribute list.\n", __FUNCTION__); + ntfs_attr_put_search_ctx(ctx); + goto err_out; + } + /* Add new entry after this extent. */ + ale = (ATTR_LIST_ENTRY*)((u8*)ctx->al_entry + + le16_to_cpu(ctx->al_entry->length)); + } else { + /* Check for real errors. */ + if (errno != ENOENT) { + err = errno; + Dprintf("%s(): Attribute lookup failed.\n", + __FUNCTION__); + ntfs_attr_put_search_ctx(ctx); + goto err_out; + } + /* No previous extents found. */ + ale = ctx->al_entry; + } + /* Don't need it anymore, @ctx->al_entry points to @ni->attr_list. */ + ntfs_attr_put_search_ctx(ctx); /* Determine new entry offset. */ entry_offset = ((u8 *)ale - ni->attr_list); From c9294cb7016ed35c63ecb885468ce1f75afa30af Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 24 Sep 2005 13:05:36 +0000 Subject: [PATCH 2513/2994] Remove 'use_ino' because I'm afraid I can not use it with "file:stream" nammed data stream access interface. :-( --- ntfsprogs/ntfsmount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index cca76cd8..9a720093 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1401,9 +1401,9 @@ int main(int argc, char *argv[]) } free(parsed_options); #ifndef DEBUG - fh = fuse_new(ffd, "use_ino", &ntfs_fuse_oper, sizeof(ntfs_fuse_oper)); + fh = fuse_new(ffd, NULL, &ntfs_fuse_oper, sizeof(ntfs_fuse_oper)); #else - fh = fuse_new(ffd, "debug,use_ino", &ntfs_fuse_oper, + fh = fuse_new(ffd, "debug", &ntfs_fuse_oper, sizeof(ntfs_fuse_oper)); #endif if (!fh) { From 7fee848c2688b551a4b70203ec811713144b954f Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 24 Sep 2005 13:06:59 +0000 Subject: [PATCH 2514/2994] attrib.c: fix line to be <=80 characters long --- libntfs/attrib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 07bc046e..d06d199c 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -4373,8 +4373,8 @@ retry: /* Remove unused attribute record. */ if (ntfs_attr_record_rm(ctx)) { err = errno; - Dprintf("%s(): Couldn't remove unused attribute " - "record.\n", __FUNCTION__); + Dprintf("%s(): Couldn't remove unused attribute" + " record.\n", __FUNCTION__); goto put_err_out; } ntfs_attr_reinit_search_ctx(ctx); From 464eab4178b5aa69727fedd3c9f19a1954849e56 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 24 Sep 2005 15:20:49 +0000 Subject: [PATCH 2515/2994] add ntfs_link, update ntfsmount to use it --- include/ntfs/dir.h | 2 + libntfs/dir.c | 93 +++++++++++++++++++++++++++++++++++++++++++ ntfsprogs/ntfsmount.c | 49 +++++++++++++++++++++++ 3 files changed, 144 insertions(+) diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index ddf624b3..98b1b256 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -44,6 +44,8 @@ extern ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, const unsigned type); extern int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len); +extern int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, + u8 name_len); /* * File types (adapted from include ) diff --git a/libntfs/dir.c b/libntfs/dir.c index 5e8a7d12..0393f69f 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1406,3 +1406,96 @@ err_out: err = errno; goto out; } + +/** + * ntfs_link - create hard link for file or directory + * @ni: ntfs inode for object to create hard link + * @dir_ni: ntfs inode for directory in which new link should be placed + * @name: unicode name of the new link + * @name_len: length of the name in unicode characters + * + * Return 0 on success or -1 on error with errno set to the error code. + */ +int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) +{ + FILE_NAME_ATTR *fn = NULL; + int fn_len, err; + + ntfs_debug("Entering."); + if (!ni || !dir_ni || !name || !name_len) { + err = errno; + ntfs_error(, "Invalid arguments."); + goto err_out; + } + /* Create FILE_NAME attribute. */ + fn_len = sizeof(FILE_NAME_ATTR) + name_len * sizeof(ntfschar); + fn = calloc(1, fn_len); + if (!fn) { + err = errno; + ntfs_error(, "Not enough memory."); + goto err_out; + } + fn->parent_directory = MK_LE_MREF(dir_ni->mft_no, + le16_to_cpu(dir_ni->mrec->sequence_number)); + fn->file_name_length = name_len; + fn->file_name_type = FILE_NAME_POSIX; + if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) + fn->file_attributes = FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; + fn->creation_time = utc2ntfs(ni->creation_time); + fn->last_data_change_time = utc2ntfs(ni->last_data_change_time); + fn->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); + fn->last_access_time = utc2ntfs(ni->last_access_time); + memcpy(fn->file_name, name, name_len * sizeof(ntfschar)); + /* Add FILE_NAME attribute to index. */ + if (ntfs_index_add_filename(dir_ni, fn, MK_MREF(ni->mft_no, + le16_to_cpu(ni->mrec->sequence_number)))) { + err = errno; + ntfs_error(, "Failed to add entry to the index."); + goto err_out; + } + /* Add FILE_NAME attribute to inode. */ + if (ntfs_attr_add(ni, AT_FILE_NAME, AT_UNNAMED, 0, (u8*)fn, fn_len)) { + ntfs_index_context *ictx; + + err = errno; + ntfs_error(, "Failed to add FILE_NAME attribute."); + /* Try to remove just added attribute from index. */ + ictx = ntfs_index_ctx_get(dir_ni, I30, 4); + if (!ictx) + goto rollback_failed; + if (ntfs_index_lookup(fn, fn_len, ictx)) { + ntfs_index_ctx_put(ictx); + goto rollback_failed; + } + if (ntfs_index_rm(ictx)) { + ntfs_index_ctx_put(ictx); + goto rollback_failed; + } + goto err_out; + } + /* Increment hard links count. */ + ni->mrec->link_count = cpu_to_le16(le16_to_cpu( + ni->mrec->link_count) + 1); + /* + * Do not set attributes and file size, instead of this mark filenames + * dirty to force attribute and size update during sync. + * NOTE: File size may will be not updated and not all attributes will + * be set, but it is acceptable since windows driver does not update + * all file names when one of the hard links changed. + * FIXME: It will be nice to update them all. + */ + NInoFileNameSetDirty(ni); + /* Done! */ + ntfs_inode_mark_dirty(ni); + free(fn); + ntfs_debug("Done."); + return 0; +rollback_failed: + ntfs_error(, "Rollback failed. Leaving inconsist metadata."); +err_out: + ntfs_error(, "Failed."); + if (fn) + free(fn); + errno = err; + return -1; +} diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 9a720093..622b58c7 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -628,6 +628,54 @@ static int ntfs_fuse_mknod(const char *org_path, mode_t mode, return res; } +static int ntfs_fuse_link(const char *old_path, const char *new_path) +{ + char *name; + ntfschar *uname = NULL; + ntfs_inode *dir_ni = NULL, *ni; + char *path; + int res = 0, uname_len; + + path = strdup(new_path); + if (!path) + return -errno; + /* Open file for which create hard link. */ + ni = ntfs_pathname_to_inode(ctx->vol, NULL, old_path); + if (!ni) { + res = -errno; + goto exit; + } + /* Generate unicode filename. */ + name = strrchr(path, '/'); + name++; + uname_len = ntfs_mbstoucs(name, &uname, 0); + if (uname_len < 0) { + res = -errno; + goto exit; + } + /* Open parent directory. */ + *name = 0; + dir_ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + if (!dir_ni) { + res = -errno; + if (res == -ENOENT) + res = -EIO; + goto exit; + } + /* Create hard link. */ + if (ntfs_link(ni, dir_ni, uname, uname_len)) + res = -errno; +exit: + if (ni) + ntfs_inode_close(ni); + if (uname) + free(uname); + if (dir_ni) + ntfs_inode_close(dir_ni); + free(path); + return res; +} + static int ntfs_fuse_rm(const char *org_path) { char *name; @@ -1042,6 +1090,7 @@ static struct fuse_operations ntfs_fuse_oper = { .statfs = ntfs_fuse_statfs, .chmod = ntfs_fuse_chmod, .mknod = ntfs_fuse_mknod, + .link = ntfs_fuse_link, .unlink = ntfs_fuse_unlink, .mkdir = ntfs_fuse_mkdir, .rmdir = ntfs_fuse_rmdir, From 054d6777d5dd1e5253485d96365f53ac0ed0ad32 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 24 Sep 2005 15:29:54 +0000 Subject: [PATCH 2516/2994] Fix ntfs_names_collate() input sanity check intrudoced in cleanups by reverting to the original one --- libntfs/unistr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 7fc7f64f..c488ba6d 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -115,7 +115,7 @@ int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, ntfschar c1, c2; #ifdef DEBUG - if (!name1 || !name2 || (ic && (!upcase || !upcase_len))) { + if (!name1 || !name2 || (ic && !upcase && upcase_len)) { Dputs("ntfs_names_collate received NULL pointer!"); exit(1); } From 24de91b8faa3b760a73a5cfa0910b242f65a9b44 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 24 Sep 2005 15:59:53 +0000 Subject: [PATCH 2517/2994] - Support journals which have been modified by chkdsk. (Anton, Szaka) - Support journals ($LogFile) with only one restart page as well as journals with two different restart pages. (Anton, Szaka) --- ChangeLog | 3 + include/ntfs/logfile.h | 6 +- libntfs/logfile.c | 267 +++++++++++++++++++++++------------------ libntfs/volume.c | 7 +- 4 files changed, 158 insertions(+), 125 deletions(-) diff --git a/ChangeLog b/ChangeLog index b024320d..788fb6b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,9 @@ xx/xx/2005 - 1.12.0-WIP libntfs/volume.c. Needed to compile on DOS with djgpp. (Christophe) - Switch ntfsmount to use getopt_long. (Yuval, minor fixes by Yura) - ntfsmount: Fix 'df' output. (Yuval) + - Support journals which have been modified by chkdsk. (Anton, Szaka) + - Support journals ($LogFile) with only one restart page as well as + journals with two different restart pages. (Anton, Szaka) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index 0fde8d13..4e361e2f 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -1,7 +1,7 @@ /* * logfile.h - Exports for $LogFile handling. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2000-2005 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -376,8 +376,8 @@ typedef struct { } __attribute__((__packed__)) lcn_list[0]; } __attribute__ ((__packed__)) LOG_RECORD; -extern BOOL ntfs_check_logfile(ntfs_attr *log_na); -extern BOOL ntfs_is_logfile_clean(ntfs_attr *log_na); +extern BOOL ntfs_check_logfile(ntfs_attr *log_na, RESTART_PAGE_HEADER **rp); +extern BOOL ntfs_is_logfile_clean(ntfs_attr *log_na, RESTART_PAGE_HEADER *rp); extern int ntfs_empty_logfile(ntfs_attr *na); #endif /* defined _NTFS_LOGFILE_H */ diff --git a/libntfs/logfile.c b/libntfs/logfile.c index 0c2a9112..94e156ad 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -112,7 +112,7 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) */ if (!ntfs_is_chkd_record(rp->magic) && sle64_to_cpu(rp->chkdsk_lsn)) { ntfs_error(vi->i_sb, "$LogFile restart page is not modified " - "chkdsk but a chkdsk LSN is specified."); + "by chkdsk but a chkdsk LSN is specified."); return FALSE; } ntfs_debug("Done."); @@ -301,10 +301,12 @@ err_out: * @log_na: opened ntfs attribute for journal $LogFile * @rp: restart page to check * @pos: position in @log_na at which the restart page resides - * @wrp: copy of the multi sector transfer deprotected restart page + * @wrp: [OUT] copy of the multi sector transfer deprotected restart page + * @lsn: [OUT] set to the current logfile lsn on success * - * Check the restart page @rp for consistency and return TRUE if it is - * consistent and FALSE otherwise. + * Check the restart page @rp for consistency and return 0 if it is consistent + * and errno otherwise. The restart page may have been modified by chkdsk in + * which case its magic is CHKD instead of RSTR. * * This function only needs NTFS_BLOCK_SIZE bytes in @rp, i.e. it does not * require the full restart page. @@ -312,24 +314,33 @@ err_out: * If @wrp is not NULL, on success, *@wrp will point to a buffer containing a * copy of the complete multi sector transfer deprotected page. On failure, * *@wrp is undefined. + * + * Simillarly, if @lsn is not NULL, on succes *@lsn will be set to the current + * logfile lsn according to this restart page. On failure, *@lsn is undefined. + * + * The following error codes are defined: + * EINVAL - The restart page is inconsistent. + * ENOMEM - Not enough memory to load the restart page. + * EIO - Failed to reading from $LogFile. */ -static BOOL ntfs_check_and_load_restart_page(ntfs_attr *log_na, - RESTART_PAGE_HEADER *rp, s64 pos, RESTART_PAGE_HEADER **wrp) +static int ntfs_check_and_load_restart_page(ntfs_attr *log_na, + RESTART_PAGE_HEADER *rp, s64 pos, RESTART_PAGE_HEADER **wrp, + LSN *lsn) { RESTART_AREA *ra; RESTART_PAGE_HEADER *trp; - BOOL ret; + int err; ntfs_debug("Entering."); /* Check the restart page header for consistency. */ if (!ntfs_check_restart_page_header(rp, pos)) { /* Error output already done inside the function. */ - return FALSE; + return EINVAL; } /* Check the restart area for consistency. */ if (!ntfs_check_restart_area(rp)) { /* Error output already done inside the function. */ - return FALSE; + return EINVAL; } ra = (RESTART_AREA*)((u8*)rp + le16_to_cpu(rp->restart_area_offset)); /* @@ -340,7 +351,7 @@ static BOOL ntfs_check_and_load_restart_page(ntfs_attr *log_na, if (!trp) { ntfs_error(vi->i_sb, "Failed to allocate memory for $LogFile " "restart page buffer."); - return FALSE; + return ENOMEM; } /* * Read the whole of the restart page into the buffer. If it fits @@ -353,36 +364,67 @@ static BOOL ntfs_check_and_load_restart_page(ntfs_attr *log_na, if (ntfs_attr_pread(log_na, pos, le32_to_cpu( rp->system_page_size), trp) != le32_to_cpu(rp->system_page_size)) { + err = errno; ntfs_error(, "Failed to read whole restart page into " "the buffer."); + if (err != ENOMEM) + err = EIO; goto err_out; } /* Perform the multi sector transfer deprotection on the buffer. */ if (ntfs_mst_post_read_fixup((NTFS_RECORD*)trp, le32_to_cpu(rp->system_page_size))) { - ntfs_error(vi->i_sb, "Multi sector transfer error detected in " - "$LogFile restart page."); - goto err_out; + /* + * A multi sector tranfer error was detected. We only need to + * abort if the restart page contents exceed the multi sector + * transfer fixup of the first sector. + */ + if (le16_to_cpu(rp->restart_area_offset) + + le16_to_cpu(ra->restart_area_length) > + NTFS_BLOCK_SIZE - sizeof(u16)) { + ntfs_error(vi->i_sb, "Multi sector transfer error " + "detected in $LogFile restart page."); + err = EINVAL; + goto err_out; + } + } + /* + * If the restart page is modified by chkdsk or there are no active + * logfile clients, the logfile is consistent. Otherwise, need to + * check the log client records for consistency, too. + */ + err = 0; + if (ntfs_is_rstr_record(rp->magic) && + ra->client_in_use_list != LOGFILE_NO_CLIENT) { + if (!ntfs_check_log_client_array(trp)) { + err = EINVAL; + goto err_out; + } + } + if (lsn) { + if (ntfs_is_rstr_record(rp->magic)) + *lsn = sle64_to_cpu(ra->current_lsn); + else /* if (ntfs_is_chkd_record(rp->magic)) */ + *lsn = sle64_to_cpu(rp->chkdsk_lsn); } - /* Check the log client records for consistency. */ - ret = ntfs_check_log_client_array(trp); - if (ret && wrp) - *wrp = trp; - else - free(trp); ntfs_debug("Done."); - return ret; + if (wrp) + *wrp = trp; + else { err_out: - free(trp); - return FALSE; + free(trp); + } + return err; } /** * ntfs_check_logfile - check in the journal if the volume is consistent * @log_na: ntfs attribute of loaded journal $LogFile to check + * @rp: [OUT] on success this is a copy of the current restart page * * Check the $LogFile journal for consistency and return TRUE if it is - * consistent and FALSE if not. + * consistent and FALSE if not. On success, the current restart page is + * returned in *@rp. Caller must call ntfs_free(*@rp) when finished with it. * * At present we only check the two restart pages and ignore the log record * pages. @@ -392,17 +434,16 @@ err_out: * if the $LogFile was created on a system with a different page size to ours * yet and mst deprotection would fail if our page size is smaller. */ -BOOL ntfs_check_logfile(ntfs_attr *log_na) +BOOL ntfs_check_logfile(ntfs_attr *log_na, RESTART_PAGE_HEADER **rp) { - s64 size, pos, rstr1_pos, rstr2_pos; + s64 size, pos; + LSN rstr1_lsn, rstr2_lsn; ntfs_volume *vol = log_na->ni->vol; - u8 *buf = NULL; + u8 *kaddr = NULL; RESTART_PAGE_HEADER *rstr1_ph = NULL; RESTART_PAGE_HEADER *rstr2_ph = NULL; - int log_page_size, log_page_mask, ofs; + int log_page_size, log_page_mask, err; BOOL logfile_is_empty = TRUE; - BOOL rstr1_found = FALSE; - BOOL rstr2_found = FALSE; u8 log_page_bits; ntfs_debug("Entering."); @@ -432,8 +473,8 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na) return FALSE; } /* Allocate memory for restart page. */ - buf = malloc(NTFS_BLOCK_SIZE); - if (!buf) { + kaddr = malloc(NTFS_BLOCK_SIZE); + if (!kaddr) { ntfs_error(, "Not enough memory."); return FALSE; } @@ -449,7 +490,7 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na) /* * Read first NTFS_BLOCK_SIZE bytes of potential restart page. */ - if (ntfs_attr_pread(log_na, pos, NTFS_BLOCK_SIZE, buf) != + if (ntfs_attr_pread(log_na, pos, NTFS_BLOCK_SIZE, kaddr) != NTFS_BLOCK_SIZE) { ntfs_error(, "Failed to read first NTFS_BLOCK_SIZE " "bytes of potential restart page."); @@ -461,7 +502,7 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na) * empty block after a non-empty block has been encountered * means we are done. */ - if (!ntfs_is_empty_recordp((le32*)buf)) + if (!ntfs_is_empty_recordp((le32*)kaddr)) logfile_is_empty = FALSE; else if (!logfile_is_empty) break; @@ -469,59 +510,53 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na) * A log record page means there cannot be a restart page after * this so no need to continue searching. */ - if (ntfs_is_rcrd_recordp((le32*)buf)) + if (ntfs_is_rcrd_recordp((le32*)kaddr)) break; - /* - * A modified by chkdsk restart page means we cannot handle - * this log file. - */ - if (ntfs_is_chkd_recordp((le32*)buf)) { - ntfs_error(vol->sb, "$LogFile has been modified by " - "chkdsk. Mount this volume in " - "Windows."); - goto err_out; - } - /* If not a restart page, continue. */ - if (!ntfs_is_rstr_recordp((le32*)buf)) { - /* Skip to the minimum page size for the next one. */ + /* If not a (modified by chkdsk) restart page, continue. */ + if (!ntfs_is_rstr_recordp((le32*)kaddr) && + !ntfs_is_chkd_recordp((le32*)kaddr)) { if (!pos) pos = NTFS_BLOCK_SIZE >> 1; continue; } - /* We now know we have a restart page. */ - if (!pos) { - rstr1_found = TRUE; - rstr1_pos = pos; - } else { - if (rstr2_found) { - ntfs_error(vol->sb, "Found more than two " - "restart pages in $LogFile."); - goto err_out; + /* + * Check the (modified by chkdsk) restart page for consistency + * and get a copy of the complete multi sector transfer + * deprotected restart page. + */ + err = ntfs_check_and_load_restart_page(log_na, + (RESTART_PAGE_HEADER*)kaddr, pos, + !rstr1_ph ? &rstr1_ph : &rstr2_ph, + !rstr1_ph ? &rstr1_lsn : &rstr2_lsn); + if (!err) { + /* + * If we have now found the first (modified by chkdsk) + * restart page, continue looking for the second one. + */ + if (!pos) { + pos = NTFS_BLOCK_SIZE >> 1; + continue; } - rstr2_found = TRUE; - rstr2_pos = pos; + /* + * We have now found the second (modified by chkdsk) + * restart page, so we can stop looking. + */ + break; } /* - * Check the restart page for consistency and get a copy of the - * complete multi sector transfer deprotected restart page. - */ - if (!ntfs_check_and_load_restart_page(log_na, - (RESTART_PAGE_HEADER*)buf, pos, - !pos ? &rstr1_ph : &rstr2_ph)) { - /* Error output already done inside the function. */ - goto err_out; - } - /* - * We have a valid restart page. The next one must be after - * a whole system page size as specified by the valid restart - * page. + * Error output already done inside the function. Note, we do + * not abort if the restart page was invalid as we might still + * find a valid one further in the file. */ + if (err != EINVAL) + goto err_out; + /* Continue looking. */ if (!pos) - pos = le32_to_cpu(rstr1_ph->system_page_size) >> 1; + pos = NTFS_BLOCK_SIZE >> 1; } - if (buf) { - free(buf); - buf = NULL; + if (kaddr) { + free(kaddr); + kaddr = NULL; } if (logfile_is_empty) { NVolSetLogFileEmpty(vol); @@ -529,31 +564,37 @@ is_empty: ntfs_debug("Done. ($LogFile is empty.)"); return TRUE; } - if (!rstr1_found || !rstr2_found) { - ntfs_error(vol->sb, "Did not find two restart pages in " - "$LogFile."); - goto err_out; + if (!rstr1_ph) { + if (rstr2_ph) + ntfs_error(vol->sb, "BUG: rstr2_ph isn't NULL!"); + ntfs_error(vol->sb, "Did not find any restart pages in " + "$LogFile and it was not empty."); + return FALSE; } - /* - * The two restart areas must be identical except for the update - * sequence number. - */ - ofs = le16_to_cpu(rstr1_ph->usa_ofs); - if (memcmp(rstr1_ph, rstr2_ph, ofs) || (ofs += sizeof(u16), - memcmp((u8*)rstr1_ph + ofs, (u8*)rstr2_ph + ofs, - le32_to_cpu(rstr1_ph->system_page_size) - ofs))) { - ntfs_error(vol->sb, "The two restart pages in $LogFile do not " - "match."); - goto err_out; + /* If both restart pages were found, use the more recent one. */ + if (rstr2_ph) { + /* + * If the second restart area is more recent, switch to it. + * Otherwise just throw it away. + */ + if (rstr2_lsn > rstr1_lsn) { + free(rstr1_ph); + rstr1_ph = rstr2_ph; + /* rstr1_lsn = rstr2_lsn; */ + } else + free(rstr2_ph); + rstr2_ph = NULL; } - free(rstr1_ph); - free(rstr2_ph); /* All consistency checks passed. */ + if (rp) + *rp = rstr1_ph; + else + free(rstr1_ph); ntfs_debug("Done."); return TRUE; err_out: - if (buf) - free(buf); + if (kaddr) + free(kaddr); if (rstr1_ph) free(rstr1_ph); if (rstr2_ph) @@ -564,6 +605,7 @@ err_out: /** * ntfs_is_logfile_clean - check in the journal if the volume is clean * @log_na: ntfs attribute of loaded journal $LogFile to check + * @rp: copy of the current restart page * * Analyze the $LogFile journal and return TRUE if it indicates the volume was * shutdown cleanly and FALSE if not. @@ -580,9 +622,8 @@ err_out: * is empty this function requires that NVolLogFileEmpty() is true otherwise an * empty volume will be reported as dirty. */ -BOOL ntfs_is_logfile_clean(ntfs_attr *log_na) +BOOL ntfs_is_logfile_clean(ntfs_attr *log_na, RESTART_PAGE_HEADER *rp) { - RESTART_PAGE_HEADER *rp; RESTART_AREA *ra; ntfs_debug("Entering."); @@ -591,29 +632,19 @@ BOOL ntfs_is_logfile_clean(ntfs_attr *log_na) ntfs_debug("Done. ($LogFile is empty.)"); return TRUE; } - /* Allocate memory. */ - rp = malloc(NTFS_BLOCK_SIZE); if (!rp) { - ntfs_error(, "Not enough memory."); + ntfs_error(, "Restart page header is NULL."); return FALSE; } - /* - * Read the first restart page. It will be possibly incomplete and - * will not be multi sector transfer deprotected but we only need the - * first NTFS_BLOCK_SIZE bytes so it does not matter. - */ - if (ntfs_attr_pread(log_na, 0, NTFS_BLOCK_SIZE, rp) != - NTFS_BLOCK_SIZE) { - ntfs_error(, "Failed to read first restart page."); - goto err_out; - } - if (!ntfs_is_rstr_record(rp->magic)) { - ntfs_error(vol->sb, "No restart page found at offset zero in " - "$LogFile. This is probably a bug in that " - "the $LogFile should have been consistency " - "checked before calling this function."); - goto err_out; + if (!ntfs_is_rstr_record(rp->magic) && + !ntfs_is_chkd_record(rp->magic)) { + ntfs_error(vol->sb, "Restart page buffer is invalid. This is " + "probably a bug in that the $LogFile should " + "have been consistency checked before calling " + "this function."); + return FALSE; } + ra = (RESTART_AREA*)((u8*)rp + le16_to_cpu(rp->restart_area_offset)); /* * If the $LogFile has active clients, i.e. it is open, and we do not @@ -623,15 +654,11 @@ BOOL ntfs_is_logfile_clean(ntfs_attr *log_na) if (ra->client_in_use_list != LOGFILE_NO_CLIENT && !(ra->flags & RESTART_VOLUME_IS_CLEAN)) { ntfs_debug("Done. $LogFile indicates a dirty shutdown."); - goto err_out; + return FALSE; } - free(rp); /* $LogFile indicates a clean shutdown. */ ntfs_debug("Done. $LogFile indicates a clean shutdown."); return TRUE; -err_out: - free(rp); - return FALSE; } /** diff --git a/libntfs/volume.c b/libntfs/volume.c index 2142ce44..f5ddff7a 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1,7 +1,7 @@ /* * volume.c - NTFS volume handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2000-2005 Anton Altaparmakov * Copyright (c) 2002-2005 Szabolcs Szakacsits * * This program/include file is free software; you can redistribute it and/or @@ -566,6 +566,7 @@ static int ntfs_volume_check_logfile(ntfs_volume *vol) { ntfs_inode *ni; ntfs_attr *na = NULL; + RESTART_PAGE_HEADER *rp = NULL; int err = 0; if ((ni = ntfs_inode_open(vol, FILE_LogFile)) == NULL) { @@ -578,8 +579,10 @@ static int ntfs_volume_check_logfile(ntfs_volume *vol) err = EIO; goto exit; } - if (!ntfs_check_logfile(na) || !ntfs_is_logfile_clean(na)) + if (!ntfs_check_logfile(na, &rp) || !ntfs_is_logfile_clean(na, rp)) err = EOPNOTSUPP; + if (rp) + free(rp); exit: if (na) ntfs_attr_close(na); From cba53f8895976953d1e6d623f80ebde8993ff84c Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 24 Sep 2005 16:19:29 +0000 Subject: [PATCH 2518/2994] * ntfsmount: implement rename * update man page for ntfsmount --- ntfsprogs/ntfsmount.8.in | 54 ++++++++++++++++++++++++++++++++-------- ntfsprogs/ntfsmount.c | 14 +++++++++++ 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index c27a84f7..14431a46 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2005 Yura Pakhuchiy. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSMOUNT 8 "July 2005" "ntfsprogs version @VERSION@" +.TH NTFSMOUNT 8 "September 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsmount \- NTFS module for FUSE. .SH SYNOPSIS @@ -20,13 +20,20 @@ to compile it, is also highly recommended. .sp .TP -.B NTFS FUSE features: +.B Fully implemented ntfsmount features are: -* Full read/only access to normal, sparse and compressed files. +* Read-only access to normal, sparse and compressed files. -* Can overwrite and change size of normal and sparse files. +* Overwrite normal and sparse files *with* changes to size. -* Can list/read/write/add/remove named data streams. +* List/Read/Write/Add/Remove named data streams. + +.TP +.B Partly implented features: + +* Create/Delete/Move files and directories. + +* Hard link files. .SH OPTIONS Below is a summary of all the options that @@ -83,6 +90,7 @@ configuration option described in the previous section. .TP .B kernel_cache +(NOTE: Work only with FUSE-2.3.0) This option disables flushing the cache of the file contents on every open(). This should only be enabled on filesystems, where the file data is never changed externally (not through the mounted FUSE @@ -122,7 +130,8 @@ limited anyway to 32 pages (which is 128kbyte on i386). .TP .B force= -Force mount even if errors occured. Use this option only if you know what are you doing and don't cry about data loss. +Force mount even if errors occured. Use this option only if you know what +are you doing and don't cry about data loss. .TP .B ro @@ -130,7 +139,8 @@ Mount filesystem read-only. .TP .B no_def_opts -By default ntfsmount acts as "default_permissions,kernel_cache,allow_other" was passed to it, this option cancel this behaviour. +By default ntfsmount acts as "default_permissions,allow_other" was passed to it, +this option cancel this behaviour. .TP .B succeed_chmod @@ -141,11 +151,25 @@ Don't change any permissions and don't return error on chmod operation. Mount this device. .SH DATA STREAMS -All data on NTFS is stored in streams, which can have names. A file can have more than one data streams, but exactly one must have no name. The size of a file is the size of its unnamed data stream. Usually when you don't specify stream name you are access to unnamed data stream. If you want access to named data stream you need to add ":stream_name" to the filename. For example: by opening "some.mp3:artist" you will open stream "artist" in "some.mp3". But windows usually prevent you from accessing to named data streams, so you need to use some program like FAR or utils from cygwin to access named data streams. +All data on NTFS is stored in streams, which can have names. +A file can have more than one data streams, but exactly one must have no name. +The size of a file is the size of its unnamed data stream. +Usually when you don't specify stream name you are access to the unnamed data +stream. +If you want access to named data stream you need to add ":stream_name" to the +filename. For example: by opening "some.mp3:artist" you will open stream +"artist" in "some.mp3". +But windows usually prevent you from accessing to named data streams, +so you need to use some program like FAR or utils from cygwin to access named +data streams. .sp -NTFS FUSE module don't prevent you from accessing to named data streams so you can use your preferred utils to access them. You can even delete them using +NTFS FUSE module don't prevent you from accessing to named data streams so you +can use your preferred utils to access them. You can even delete them using .B rm. -You can list all named data streams by getting "ntfs.streams.list" extended attribute. NOTE: The last feauture is unique for NTFS FUSE module and maybe will be never supported by kernel driver. +You can list all named data streams by getting "ntfs.streams.list" extended +attribute. NOTE: The last feauture is unique for NTFS FUSE module and maybe +will be never supported by kernel driver. + .SH EXAMPLES Mount /dev/hda1 to /mnt/ntfs-fuse using NTFS FUSE module: .RS @@ -153,40 +177,48 @@ Mount /dev/hda1 to /mnt/ntfs-fuse using NTFS FUSE module: .B ntfsmount /mnt/ntfs-fuse -o dev=/dev/hda1 .sp .RE -Read-only mount /dev/hda5 to /home/user/tmp and make root to be owner of all files: + +Read-only mount /dev/hda5 to /home/user/tmp and make root to be owner of all +files: .RS .sp .B ntfsmount /home/user/tmp -o dev=/dev/hda5,ro,uid=0 .sp .RE + Umount /mnt/ntfs-fuse: .RS .sp .B fusermount -u /mnt/ntfs-fuse .sp .RE + Cat "artist" named data stream of "some.mp3": .RS .sp .B cat some.mp3:artist .sp .RE + Write "Sympho Black Metal" to "genre" named data stream of "some.mp3": .RS .sp .B echo Sympho Black Metal > some.mp3:genre .sp .RE + Remove "album" named data stream from "some.mp3": .RS .sp .B rm some.mp3:album .sp .RE + List all named data streams for "some.mp3": .RS .sp .B getfattr -n ntfs.streams.list some.mp3 + .SH BUGS No bugs are known at present. If you find any bugs, please send an email to .nh diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 622b58c7..a1682542 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -770,6 +770,19 @@ static int ntfs_fuse_unlink(const char *org_path) return res; } +static int ntfs_fuse_rename(const char *old_path, const char *new_path) +{ + int ret; + + if ((ret = ntfs_fuse_link(old_path, new_path))) + return ret; + if ((ret = ntfs_fuse_unlink(old_path))) { + ntfs_fuse_unlink(new_path); + return ret; + } + return 0; +} + static int ntfs_fuse_mkdir(const char *path, mode_t mode __attribute__((unused))) { @@ -1092,6 +1105,7 @@ static struct fuse_operations ntfs_fuse_oper = { .mknod = ntfs_fuse_mknod, .link = ntfs_fuse_link, .unlink = ntfs_fuse_unlink, + .rename = ntfs_fuse_rename, .mkdir = ntfs_fuse_mkdir, .rmdir = ntfs_fuse_rmdir, .utime = ntfs_fuse_utime, From d8daee604f12a69fc39e9818b638b7ff9ce077aa Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 24 Sep 2005 17:00:26 +0000 Subject: [PATCH 2519/2994] Update NEWS and ChangeLog --- ChangeLog | 4 ++++ NEWS | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 788fb6b4..64d4a202 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,6 +45,10 @@ xx/xx/2005 - 1.12.0-WIP - Support journals which have been modified by chkdsk. (Anton, Szaka) - Support journals ($LogFile) with only one restart page as well as journals with two different restart pages. (Anton, Szaka) + - Add @val parameter to ntfs_attr_add and @val and @size parameters to + ntfs_resident_attr_record_add. (Yura) + - Fix attribute list adding for always resident attributes. (Yura) + - New API for hard link creating: dir.[ch]::ntfs_link. (Yura) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/NEWS b/NEWS index 9354b2f7..75f2eaf4 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ Current news ============ +ntfsmount can create/delete/move files and directories! It's not full +implementation, thus sometimes it will say 'Operation is not supported', +nothing bad will happen to user data in this case. (Yura Pakhuchiy) + Add new utility: ntfsmount. It is a FUSE module that uses on libntfs. So, you need FUSE 2.3 to compile it. This module supports file overwrite including changing the file size and can read/write/add/remove named data streams via From 53ffb793521b869af4722de3899929c9ad53aa6c Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 24 Sep 2005 17:06:35 +0000 Subject: [PATCH 2520/2994] fix potential bug --- ntfsprogs/ntfsmount.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index a1682542..3b658781 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -103,18 +103,18 @@ static long ntfs_fuse_get_nr_free_mft_records(ntfs_volume *vol) if (!(ctx->state & NF_FreeMFTOutdate)) return ctx->free_mft; - buf = malloc(NTFS_BUF_SIZE); + buf = malloc(vol->cluster_size); if (!buf) return -ENOMEM; while (1) { int i, j; br = ntfs_attr_pread(vol->mftbmp_na, total, - NTFS_BLOCK_SIZE, buf); + vol->cluster_size, buf); if (!br) break; total += br; - for (i = 0; i < NTFS_BLOCK_SIZE; i++) + for (i = 0; i < br; i++) for (j = 0; j < 8; j++) if (!((buf[i] >> j) & 1)) nr_free++; @@ -135,18 +135,18 @@ static long ntfs_fuse_get_nr_free_clusters(ntfs_volume *vol) if (!(ctx->state & NF_FreeClustersOutdate)) return ctx->free_clusters; - buf = malloc(NTFS_BUF_SIZE); + buf = malloc(vol->cluster_size); if (!buf) return -ENOMEM; while (1) { int i, j; br = ntfs_attr_pread(vol->lcnbmp_na, total, - NTFS_BLOCK_SIZE, buf); + vol->cluster_size, buf); if (!br) break; total += br; - for (i = 0; i < NTFS_BLOCK_SIZE; i++) + for (i = 0; i < br; i++) for (j = 0; j < 8; j++) if (!((buf[i] >> j) & 1)) nr_free++; From eb51c61ba4b52bacfa792ac5cc32969f5407e234 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 24 Sep 2005 20:12:36 +0000 Subject: [PATCH 2521/2994] Emphasize that disk partitioning must use sector as the unit instead of cylinder to avoid shifting of the partition --- ChangeLog | 2 ++ ntfsprogs/ntfsresize.8.in | 8 +++++--- ntfsprogs/ntfsresize.c | 10 ++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64d4a202..86aa397d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -49,6 +49,8 @@ xx/xx/2005 - 1.12.0-WIP ntfs_resident_attr_record_add. (Yura) - Fix attribute list adding for always resident attributes. (Yura) - New API for hard link creating: dir.[ch]::ntfs_link. (Yura) + - ntfsresize: emphasize that disk partitioning must use sector as the + unit instead of cylinder to avoid shifting of the partition. (Szaka) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 73ea6d94..2a59953c 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -1,7 +1,7 @@ .\" -*- nroff -*- .\" Copyright 2002-2005 by Szabolcs Szakacsits All Rights Reserved. .\" -.TH NTFSRESIZE 8 "Aug 2005" "ntfsprogs version @VERSION@" +.TH NTFSRESIZE 8 "Sep 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsresize \- resize an NTFS filesystem without data loss .SH SYNOPSIS @@ -89,8 +89,10 @@ to enlarge the size of the filesystem. .SH PARTITIONING When recreating the partition by a disk partitioning tool, make sure you create it at the same -starting sector and with the same partition type as before. -Otherwise you won't be able to access your filesystem. +starting sector and with the same partition type as before. +Otherwise you won't be able to access your filesystem. Use the 'u' +fdisk command to switch to the reliable sector unit from the +default cylinder one. Also make sure you set the bootable flag for the partition if it existed before. Failing to do so you might not be able to boot your diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 72581da6..10b2c993 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -59,13 +59,15 @@ static const char *resize_warning_msg = "crash may result major data loss!\n"; static const char *resize_important_msg = -"You can go on to shrink the device e.g. with 'fdisk'.\n" -"IMPORTANT: When recreating the partition, make sure you\n" -" 1) create it with the same starting disk cylinder\n" +"You can go on to shrink the device for example with Linux fdisk.\n" +"IMPORTANT: When recreating the partition, make sure that you\n" +" 1) create it at the same disk sector (use sector as the unit!)\n" " 2) create it with the same partition type (usually 7, HPFS/NTFS)\n" " 3) do not make it smaller than the new NTFS filesystem size\n" " 4) set the bootable flag for the partition if it existed before\n" -"Otherwise you may lose your data or can't boot your computer from the disk!\n"; +"Otherwise you won't be able to access NTFS or can't boot from the disk!\n" +"If you make a mistake and don't have a partition table backup then you\n" +"can recover the partition table by TestDisk or Parted's rescue mode.\n"; static const char *invalid_ntfs_msg = "Apparently device '%s' doesn't have a valid NTFS.\n" From 3a50e66a59343d2d187f8d33ce1e7d45171a6269 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 24 Sep 2005 20:28:23 +0000 Subject: [PATCH 2522/2994] Fix a very(!) longstanding bug in ntfs_attr_find() and co. Also reapply fix to unistr.c name collation. --- libntfs/attrib.c | 24 +++++++----------------- libntfs/unistr.c | 2 +- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index d06d199c..3c04870c 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1559,23 +1559,10 @@ static int ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) { ATTR_RECORD *a; - ntfs_volume *vol; - ntfschar *upcase; - u32 upcase_len; + ntfs_volume *vol = ctx->ntfs_ino->vol; + ntfschar *upcase = vol->upcase; + u32 upcase_len = vol->upcase_len; - if (!ctx || !ctx->mrec || !ctx->attr) { - errno = EINVAL; - return -1; - } - if (ic == IGNORE_CASE) { - vol = ctx->ntfs_ino->vol; - upcase = vol->upcase; - upcase_len = vol->upcase_len; - } else { - vol = NULL; - upcase = NULL; - upcase_len = 0; - } /* * Iterate over attributes in mft record starting at @ctx->attr, or the * attribute following that, if @ctx->is_first is TRUE. @@ -2176,9 +2163,12 @@ int ntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name, const VCN lowest_vcn, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) { + ntfs_volume *vol; ntfs_inode *base_ni; - if (!ctx || !ctx->mrec || !ctx->attr) { + if (!ctx || !ctx->mrec || !ctx->attr || (name && (!ctx->ntfs_ino || + !(vol = ctx->ntfs_ino->vol) || !vol->upcase || + !vol->upcase_len))) { errno = EINVAL; return -1; } diff --git a/libntfs/unistr.c b/libntfs/unistr.c index c488ba6d..7fc7f64f 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -115,7 +115,7 @@ int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, ntfschar c1, c2; #ifdef DEBUG - if (!name1 || !name2 || (ic && !upcase && upcase_len)) { + if (!name1 || !name2 || (ic && (!upcase || !upcase_len))) { Dputs("ntfs_names_collate received NULL pointer!"); exit(1); } From 99e18269b732cec4cac1ffa3cbe4048aaebfd444 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 24 Sep 2005 21:36:51 +0000 Subject: [PATCH 2523/2994] Hint user the --rescue option if they have bad sectors --- ntfsprogs/ntfsclone.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 5dfac942..722616a3 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -53,6 +53,14 @@ static const char *EXEC_NAME = "ntfsclone"; +static const char *bad_sectors_warning_msg = +"*************************************************************************\n" +"* WARNING: The disk has bad sector. This means physical damage on the *\n" +"* disk surface caused by deterioration, manufacturing faults or other *\n" +"* reason. The reliability of the disk may stay stable or degrade fast. *\n" +"* Use the --rescue option to efficiently save as much data as possible! *\n" +"*************************************************************************\n"; + struct { int verbose; int quiet; @@ -502,13 +510,16 @@ static void copy_cluster(int rescue, off_t rescue_pos) if (read_all(fd, buff, csize) == -1) { - u32 i; - - if (!rescue || errno != EIO) + if (errno != EIO) perr_exit("read_all"); - - for (i = 0; i < csize; i += NTFS_SECTOR_SIZE) - rescue_sector(fd, rescue_pos + i, buff + i); + else if (rescue){ + u32 i; + for (i = 0; i < csize; i += NTFS_SECTOR_SIZE) + rescue_sector(fd, rescue_pos + i, buff + i); + } else { + Printf(bad_sectors_warning_msg); + err_exit("Disk is faulty, can't make full backup!"); + } } if (opt.save_image) { From 2a104d8eda4aaf6b9b589bf58d5f164c13f0cb5e Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 24 Sep 2005 22:54:55 +0000 Subject: [PATCH 2524/2994] Megapatch!!! Check evecrything!!! I probably broke everything!!! --- ChangeLog | 11 +- include/ntfs/unistr.h | 2 + include/ntfs/volume.h | 5 +- libntfs/Makefile.am | 2 +- libntfs/attrib.c | 48 ++++--- libntfs/unistr.c | 66 +++++++++ libntfs/volume.c | 92 ++++++------ ntfsprogs/cluster.c | 2 +- ntfsprogs/mkntfs.c | 309 +++++++++++++++++++++++++++++++++++++++-- ntfsprogs/ntfsclone.c | 6 +- ntfsprogs/ntfscmp.c | 8 +- ntfsprogs/ntfsfix.8.in | 7 +- ntfsprogs/ntfsfix.c | 33 ----- ntfsprogs/ntfsinfo.c | 2 +- ntfsprogs/ntfslabel.c | 36 ++--- ntfsprogs/ntfsls.c | 4 +- ntfsprogs/ntfsmove.c | 4 +- ntfsprogs/ntfsresize.c | 2 +- ntfsprogs/ntfsrm.c | 4 +- ntfsprogs/ntfswipe.c | 5 - ntfsprogs/utils.c | 2 +- 21 files changed, 488 insertions(+), 162 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86aa397d..e33b3424 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,13 +44,22 @@ xx/xx/2005 - 1.12.0-WIP - ntfsmount: Fix 'df' output. (Yuval) - Support journals which have been modified by chkdsk. (Anton, Szaka) - Support journals ($LogFile) with only one restart page as well as - journals with two different restart pages. (Anton, Szaka) + journals with two different restart pages. (Anton, Szaka) - Add @val parameter to ntfs_attr_add and @val and @size parameters to ntfs_resident_attr_record_add. (Yura) - Fix attribute list adding for always resident attributes. (Yura) - New API for hard link creating: dir.[ch]::ntfs_link. (Yura) - ntfsresize: emphasize that disk partitioning must use sector as the unit instead of cylinder to avoid shifting of the partition. (Szaka) + - Rename API: ntfs_volume_set_flags() as it is misleading. It does not + set a flag, it overwrites the flags! Rename it to + ntfs_volume_write_flags() and clean it up a lot. Update all + callers. (Anton) + - Change ntfsfix to no longer set the volume dirty. + - Change everything to supply an ntfs_inode and NULL for mft record + when calling ntfs_attr_get_search_ctx() except a very few cases which + genuinely need this functionality as they work on a too low level. + Make sure all those cases are ok. 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/include/ntfs/unistr.h b/include/ntfs/unistr.h index 4dea192a..7fdbc678 100644 --- a/include/ntfs/unistr.h +++ b/include/ntfs/unistr.h @@ -61,5 +61,7 @@ extern int ntfs_ucstombs(const ntfschar *ins, const int ins_len, char **outs, int outs_len); extern int ntfs_mbstoucs(const char *ins, ntfschar **outs, int outs_len); +extern void ntfs_upcase_table_build(ntfschar *uc, u32 uc_len); + #endif /* defined _NTFS_UNISTR_H */ diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 95593a6c..3c126732 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -117,6 +117,8 @@ struct _ntfs_volume { char *vol_name; /* Name of the volume. */ unsigned long state; /* NTFS specific flags describing this volume. See ntfs_volume_state_bits above. */ + + ntfs_inode *vol_ni; /* ntfs_inode structure for FILE_Volume. */ u8 major_ver; /* Ntfs major version of volume. */ u8 minor_ver; /* Ntfs minor version of volume. */ u16 flags; /* Bit array of VOLUME_* flags. */ @@ -198,7 +200,8 @@ extern int ntfs_umount(ntfs_volume *vol, const BOOL force); extern int ntfs_version_is_supported(ntfs_volume *vol); extern int ntfs_logfile_reset(ntfs_volume *vol); -extern int ntfs_volume_set_flags(ntfs_volume *v, const u16 flags); + +extern int ntfs_volume_write_flags(ntfs_volume *v, const u16 flags); #endif /* defined _NTFS_VOLUME_H */ diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 40cc0fd9..12282845 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -25,7 +25,7 @@ # - If the interface is the same as the previous version, change to C:R+1:A # -LTVERSION_LIBNTFS = 7:1:0 +LTVERSION_LIBNTFS = 8:0:0 LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 3c04870c..4e6f2bf0 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1559,10 +1559,23 @@ static int ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) { ATTR_RECORD *a; - ntfs_volume *vol = ctx->ntfs_ino->vol; - ntfschar *upcase = vol->upcase; - u32 upcase_len = vol->upcase_len; + ntfs_volume *vol; + ntfschar *upcase; + u32 upcase_len; + if (ctx->ntfs_ino) { + vol = ctx->ntfs_ino->vol; + upcase = vol->upcase; + upcase_len = vol->upcase_len; + } else { + if (name) { + errno = EINVAL; + return -1; + } + vol = NULL; + upcase = NULL; + upcase_len = 0; + } /* * Iterate over attributes in mft record starting at @ctx->attr, or the * attribute following that, if @ctx->is_first is TRUE. @@ -2196,7 +2209,7 @@ int ntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name, static __inline__ void ntfs_attr_init_search_ctx(ntfs_attr_search_ctx *ctx, ntfs_inode *ni, MFT_RECORD *mrec) { - if (ni && !mrec) + if (!mrec) mrec = ni->mrec; ctx->mrec = mrec; /* Sanity checks are performed elsewhere. */ @@ -2245,19 +2258,22 @@ void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx) * Allocate a new attribute search context, initialize it with @ni and @mrec, * and return it. Return NULL on error with errno set to ENOMEM. * - * @ni can be NULL if the search context is only going to be used for searching - * for the attribute list attribute and for searches ignoring the contents of - * the attribute list attribute. + * @mrec can be NULL, in which case the mft record is taken from @ni. * - * If @ni is specified, @mrec can be NULL, in which case the mft record is - * taken from @ni. - * - * If both @ni and @mrec are specified, the mft record is taken from @mrec and - * the value of @ni->mrec is ignored. + * Note: For low level utilities which know what they are doing we allow @ni to + * be NULL and @mrec to be set. Do NOT do this unless you understand the + * implications!!! For example it is no longer safe to call ntfs_attr_lookup() + * if you */ ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) { - ntfs_attr_search_ctx *ctx = malloc(sizeof(ntfs_attr_search_ctx)); + ntfs_attr_search_ctx *ctx; + + if (!ni && !mrec) { + errno = EINVAL; + return NULL; + } + ctx = malloc(sizeof(ntfs_attr_search_ctx)); if (ctx) ntfs_attr_init_search_ctx(ctx, ni, mrec); return ctx; @@ -2530,7 +2546,7 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, } /* Locate place where record should be. */ - ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) return -1; if (!ntfs_attr_lookup(type, name, name_len, @@ -2655,7 +2671,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, } /* Locate place where record should be. */ - ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) return -1; if (!ntfs_attr_lookup(type, name, name_len, CASE_SENSITIVE, @@ -3318,7 +3334,7 @@ int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) /* Find place in MFT record where attribute will be moved. */ a = ctx->attr; - nctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); + nctx = ntfs_attr_get_search_ctx(ni, NULL); if (!nctx) { err = errno; Dprintf("%s(): Couldn't obtain search context.\n", diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 7fc7f64f..cb46dd2e 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -591,3 +591,69 @@ err_out: } return -1; } + +/** + * ntfs_upcase_table_build - build the default upcase table for NTFS + * @uc: destination buffer where to store the built table + * @uc_len: size of destination buffer in bytes + * + * ntfs_upcase_table_build() builds the default upcase table for NTFS and + * stores it in the caller supplied buffer @uc of size @uc_len. + * + * Note, @uc_len must be at least 128kiB in size or bad things will happen! + */ +void ntfs_upcase_table_build(ntfschar *uc, u32 uc_len) +{ + static int uc_run_table[][3] = { /* Start, End, Add */ + {0x0061, 0x007B, -32}, {0x0451, 0x045D, -80}, {0x1F70, 0x1F72, 74}, + {0x00E0, 0x00F7, -32}, {0x045E, 0x0460, -80}, {0x1F72, 0x1F76, 86}, + {0x00F8, 0x00FF, -32}, {0x0561, 0x0587, -48}, {0x1F76, 0x1F78, 100}, + {0x0256, 0x0258, -205}, {0x1F00, 0x1F08, 8}, {0x1F78, 0x1F7A, 128}, + {0x028A, 0x028C, -217}, {0x1F10, 0x1F16, 8}, {0x1F7A, 0x1F7C, 112}, + {0x03AC, 0x03AD, -38}, {0x1F20, 0x1F28, 8}, {0x1F7C, 0x1F7E, 126}, + {0x03AD, 0x03B0, -37}, {0x1F30, 0x1F38, 8}, {0x1FB0, 0x1FB2, 8}, + {0x03B1, 0x03C2, -32}, {0x1F40, 0x1F46, 8}, {0x1FD0, 0x1FD2, 8}, + {0x03C2, 0x03C3, -31}, {0x1F51, 0x1F52, 8}, {0x1FE0, 0x1FE2, 8}, + {0x03C3, 0x03CC, -32}, {0x1F53, 0x1F54, 8}, {0x1FE5, 0x1FE6, 7}, + {0x03CC, 0x03CD, -64}, {0x1F55, 0x1F56, 8}, {0x2170, 0x2180, -16}, + {0x03CD, 0x03CF, -63}, {0x1F57, 0x1F58, 8}, {0x24D0, 0x24EA, -26}, + {0x0430, 0x0450, -32}, {0x1F60, 0x1F68, 8}, {0xFF41, 0xFF5B, -32}, + {0} + }; + static int uc_dup_table[][2] = { /* Start, End */ + {0x0100, 0x012F}, {0x01A0, 0x01A6}, {0x03E2, 0x03EF}, {0x04CB, 0x04CC}, + {0x0132, 0x0137}, {0x01B3, 0x01B7}, {0x0460, 0x0481}, {0x04D0, 0x04EB}, + {0x0139, 0x0149}, {0x01CD, 0x01DD}, {0x0490, 0x04BF}, {0x04EE, 0x04F5}, + {0x014A, 0x0178}, {0x01DE, 0x01EF}, {0x04BF, 0x04BF}, {0x04F8, 0x04F9}, + {0x0179, 0x017E}, {0x01F4, 0x01F5}, {0x04C1, 0x04C4}, {0x1E00, 0x1E95}, + {0x018B, 0x018B}, {0x01FA, 0x0218}, {0x04C7, 0x04C8}, {0x1EA0, 0x1EF9}, + {0} + }; + static int uc_byte_table[][2] = { /* Offset, Value */ + {0x00FF, 0x0178}, {0x01AD, 0x01AC}, {0x01F3, 0x01F1}, {0x0269, 0x0196}, + {0x0183, 0x0182}, {0x01B0, 0x01AF}, {0x0253, 0x0181}, {0x026F, 0x019C}, + {0x0185, 0x0184}, {0x01B9, 0x01B8}, {0x0254, 0x0186}, {0x0272, 0x019D}, + {0x0188, 0x0187}, {0x01BD, 0x01BC}, {0x0259, 0x018F}, {0x0275, 0x019F}, + {0x018C, 0x018B}, {0x01C6, 0x01C4}, {0x025B, 0x0190}, {0x0283, 0x01A9}, + {0x0192, 0x0191}, {0x01C9, 0x01C7}, {0x0260, 0x0193}, {0x0288, 0x01AE}, + {0x0199, 0x0198}, {0x01CC, 0x01CA}, {0x0263, 0x0194}, {0x0292, 0x01B7}, + {0x01A8, 0x01A7}, {0x01DD, 0x018E}, {0x0268, 0x0197}, + {0} + }; + int i, r; + + memset((char*)uc, 0, uc_len); + uc_len >>= 1; + if (uc_len > 65536) + uc_len = 65536; + for (i = 0; (u32)i < uc_len; i++) + uc[i] = i; + for (r = 0; uc_run_table[r][0]; r++) + for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) + uc[i] += uc_run_table[r][2]; + for (r = 0; uc_dup_table[r][0]; r++) + for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) + uc[i + 1]--; + for (r = 0; uc_byte_table[r][0]; r++) + uc[uc_byte_table[r][0]] = uc_byte_table[r][1]; +} diff --git a/libntfs/volume.c b/libntfs/volume.c index f5ddff7a..ceb75af8 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -79,6 +79,8 @@ ntfs_volume *ntfs_volume_alloc(void) */ static void __ntfs_volume_release(ntfs_volume *v) { + if (v->vol_ni && NInoDirty(v->vol_ni)) + ntfs_inode_close(v->vol_ni); if (v->lcnbmp_ni && NInoDirty(v->lcnbmp_ni)) ntfs_inode_sync(v->lcnbmp_ni); if (v->lcnbmp_na) @@ -166,7 +168,7 @@ static int ntfs_mft_load(ntfs_volume *vol) Dputs("Error: $MFT has invalid magic."); goto io_error_exit; } - ctx = ntfs_attr_get_search_ctx(vol->mft_ni, mb); + ctx = ntfs_attr_get_search_ctx(vol->mft_ni, NULL); if (!ctx) { Dperror("Failed to allocate attribute search context"); goto error_exit; @@ -416,6 +418,15 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) vol = ntfs_volume_alloc(); if (!vol) goto error_exit; + /* Create the default upcase table. */ + vol->upcase_len = 65536; + vol->upcase = (ntfschar*)malloc(vol->upcase_len * sizeof(ntfschar)); + if (!vol->upcase) { + Dperror("Error allocating memory for upcase table."); + goto error_exit; + } + ntfs_upcase_table_build(vol->upcase, + vol->upcase_len * sizeof(ntfschar)); if ((rwflag & MS_RDONLY) == MS_RDONLY) NVolSetReadOnly(vol); Dprintf("Reading bootsector... "); @@ -889,12 +900,16 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) errno = EINVAL; goto error_exit; } - vol->upcase_len = na->data_size >> 1; - vol->upcase = (ntfschar*)malloc(na->data_size); - if (!vol->upcase) { - Dputs(FAILED); - Dputs("Not enough memory to load $UpCase."); - goto error_exit; + if (vol->upcase_len != na->data_size >> 1) { + vol->upcase_len = na->data_size >> 1; + /* Throw away default table. */ + free(vol->upcase); + vol->upcase = (ntfschar*)malloc(na->data_size); + if (!vol->upcase) { + Dputs(FAILED); + Dputs("Not enough memory to load $UpCase."); + goto error_exit; + } } /* Read in the $DATA attribute value into the buffer. */ l = ntfs_attr_pread(na, 0, na->data_size, vol->upcase); @@ -916,14 +931,14 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) * vol structure accordingly. */ Dprintf("Loading $Volume... "); - ni = ntfs_inode_open(vol, FILE_Volume); - if (!ni) { + vol->vol_ni = ntfs_inode_open(vol, FILE_Volume); + if (!vol->vol_ni) { Dputs(FAILED); Dperror("Failed to open inode"); goto error_exit; } /* Get a search context for the $Volume/$VOLUME_INFORMATION lookup. */ - ctx = ntfs_attr_get_search_ctx(ni, NULL); + ctx = ntfs_attr_get_search_ctx(vol->vol_ni, NULL); if (!ctx) { Dputs(FAILED); Dperror("Failed to allocate attribute search context"); @@ -1033,9 +1048,6 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) Dputs(OK); ntfs_attr_put_search_ctx(ctx); ctx = NULL; - if (ntfs_inode_close(ni)) - Dperror("Failed to close inode, leaking memory"); - /* Now load the attribute definitions from $AttrDef. */ Dprintf("Loading $AttrDef... "); ni = ntfs_inode_open(vol, FILE_AttrDef); @@ -1080,7 +1092,6 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) ntfs_attr_close(na); if (ntfs_inode_close(ni)) Dperror("Failed to close inode, leaking memory"); - /* * Check for dirty logfile and hibernated Windows. * We care only about read-write mounts. @@ -1429,7 +1440,7 @@ error_exit: } /** - * ntfs_volume_set_flags - set the flags of an ntfs volume + * ntfs_volume_write_flags - set the flags of an ntfs volume * @vol: ntfs volume where we set the volume flags * @flags: new flags * @@ -1438,37 +1449,22 @@ error_exit: * * Return 0 if successful and -1 if not with errno set to the error code. */ -int ntfs_volume_set_flags(ntfs_volume *vol, const u16 flags) +int ntfs_volume_write_flags(ntfs_volume *vol, const u16 flags) { - MFT_RECORD *m = NULL; - ATTR_RECORD *r; + ATTR_RECORD *a; VOLUME_INFORMATION *c; ntfs_attr_search_ctx *ctx; int ret = -1; /* failure */ - if (!vol) { + if (!vol || !vol->vol_ni) { errno = EINVAL; return -1; } - - if (ntfs_file_record_read(vol, FILE_Volume, &m, NULL)) { - Dperror("Failed to read $Volume"); - return -1; - } - - /* Sanity check */ - if (!(m->flags & MFT_RECORD_IN_USE)) { - Dprintf("Error: $Volume has been deleted. Cannot " - "handle this yet. Run chkdsk to fix this.\n"); - errno = EIO; - goto err_exit; - } - /* Get a pointer to the volume information attribute. */ - ctx = ntfs_attr_get_search_ctx(NULL, m); + ctx = ntfs_attr_get_search_ctx(vol->vol_ni, NULL); if (!ctx) { Dperror("Failed to allocate attribute search context"); - goto err_exit; + return -1; } if (ntfs_attr_lookup(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { @@ -1476,40 +1472,36 @@ int ntfs_volume_set_flags(ntfs_volume *vol, const u16 flags) "$Volume!"); goto err_out; } - r = ctx->attr; + a = ctx->attr; /* Sanity check. */ - if (r->non_resident) { + if (a->non_resident) { Dputs("Error: Attribute $VOLUME_INFORMATION must be resident " "(and it isn't)!"); errno = EIO; goto err_out; } /* Get a pointer to the value of the attribute. */ - c = (VOLUME_INFORMATION*)(le16_to_cpu(r->value_offset) + (char*)r); + c = (VOLUME_INFORMATION*)(le16_to_cpu(a->value_offset) + (char*)a); /* Sanity checks. */ - if ((char*)c + le32_to_cpu(r->value_length) > - le16_to_cpu(m->bytes_in_use) + (char*)m || - le16_to_cpu(r->value_offset) + - le32_to_cpu(r->value_length) > le32_to_cpu(r->length)) { + if ((char*)c + le32_to_cpu(a->value_length) > + le16_to_cpu(ctx->mrec->bytes_in_use) + + (char*)ctx->mrec || le16_to_cpu(a->value_offset) + + le32_to_cpu(a->value_length) > le32_to_cpu(a->length)) { Dputs("Error: Attribute $VOLUME_INFORMATION in $Volume is " "corrupt!"); errno = EIO; goto err_out; } /* Set the volume flags. */ - vol->flags = c->flags = cpu_to_le16(flags); - - if (ntfs_mft_record_write(vol, FILE_Volume, m)) { + vol->flags = c->flags = flags & VOLUME_FLAGS_MASK; + /* Write them to disk. */ + ntfs_inode_mark_dirty(vol->vol_ni); + if (ntfs_inode_sync(vol->vol_ni)) { Dperror("Error writing $Volume"); goto err_out; } - ret = 0; /* success */ err_out: ntfs_attr_put_search_ctx(ctx); -err_exit: - if (m) - free(m); return ret; } - diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c index 15a7895a..ce83aa0d 100644 --- a/ntfsprogs/cluster.c +++ b/ntfsprogs/cluster.c @@ -81,7 +81,7 @@ int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void Vprintf ("Inode: %llu\n", (unsigned long long) m_ctx->inode->mft_no); - a_ctx = ntfs_attr_get_search_ctx (NULL, m_ctx->inode->mrec); + a_ctx = ntfs_attr_get_search_ctx (m_ctx->inode, NULL); while ((rec = find_attribute (AT_UNUSED, a_ctx))) { diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index f368a06e..d5e50db5 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1180,6 +1180,297 @@ err_end: return NULL; } +/** + * Internal: + * + * ntfs_attr_find - find (next) attribute in mft record + * @type: attribute type to find + * @name: attribute name to find (optional, i.e. NULL means don't care) + * @name_len: attribute name length (only needed if @name present) + * @ic: IGNORE_CASE or CASE_SENSITIVE (ignored if @name not present) + * @val: attribute value to find (optional, resident attributes only) + * @val_len: attribute value length + * @ctx: search context with mft record and attribute to search from + * + * You shouldn't need to call this function directly. Use lookup_attr() instead. + * + * ntfs_attr_find() takes a search context @ctx as parameter and searches the + * mft record specified by @ctx->mrec, beginning at @ctx->attr, for an + * attribute of @type, optionally @name and @val. If found, ntfs_attr_find() + * returns 0 and @ctx->attr will point to the found attribute. + * + * If not found, ntfs_attr_find() returns -1, with errno set to ENOENT and + * @ctx->attr will point to the attribute before which the attribute being + * searched for would need to be inserted if such an action were to be desired. + * + * On actual error, ntfs_attr_find() returns -1 with errno set to the error + * code but not to ENOENT. In this case @ctx->attr is undefined and in + * particular do not rely on it not changing. + * + * If @ctx->is_first is TRUE, the search begins with @ctx->attr itself. If it + * is FALSE, the search begins after @ctx->attr. + * + * If @type is AT_UNUSED, return the first found attribute, i.e. one can + * enumerate all attributes by setting @type to AT_UNUSED and then calling + * ntfs_attr_find() repeatedly until it returns -1 with errno set to ENOENT to + * indicate that there are no more entries. During the enumeration, each + * successful call of ntfs_attr_find() will return the next attribute in the + * mft record @ctx->mrec. + * + * If @type is AT_END, seek to the end and return -1 with errno set to ENOENT. + * AT_END is not a valid attribute, its length is zero for example, thus it is + * safer to return error instead of success in this case. This also allows us + * to interoperate cleanly with ntfs_external_attr_find(). + * + * If @name is AT_UNNAMED search for an unnamed attribute. If @name is present + * but not AT_UNNAMED search for a named attribute matching @name. Otherwise, + * match both named and unnamed attributes. + * + * If @ic is IGNORE_CASE, the @name comparison is not case sensitive and + * @ctx->ntfs_ino must be set to the ntfs inode to which the mft record + * @ctx->mrec belongs. This is so we can get at the ntfs volume and hence at + * the upcase table. If @ic is CASE_SENSITIVE, the comparison is case + * sensitive. When @name is present, @name_len is the @name length in Unicode + * characters. + * + * If @name is not present (NULL), we assume that the unnamed attribute is + * being searched for. + * + * Finally, the resident attribute value @val is looked for, if present. + * If @val is not present (NULL), @val_len is ignored. + * + * ntfs_attr_find() only searches the specified mft record and it ignores the + * presence of an attribute list attribute (unless it is the one being searched + * for, obviously). If you need to take attribute lists into consideration, use + * ntfs_attr_lookup() instead (see below). This also means that you cannot use + * ntfs_attr_find() to search for extent records of non-resident attributes, as + * extents with lowest_vcn != 0 are usually described by the attribute list + * attribute only. - Note that it is possible that the first extent is only in + * the attribute list while the last extent is in the base mft record, so don't + * rely on being able to find the first extent in the base mft record. + * + * Warning: Never use @val when looking for attribute types which can be + * non-resident as this most likely will result in a crash! + */ +static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) +{ + ATTR_RECORD *a; + ntfschar *upcase = vol->upcase; + u32 upcase_len = vol->upcase_len; + + /* + * Iterate over attributes in mft record starting at @ctx->attr, or the + * attribute following that, if @ctx->is_first is TRUE. + */ + if (ctx->is_first) { + a = ctx->attr; + ctx->is_first = FALSE; + } else + a = (ATTR_RECORD*)((char*)ctx->attr + + le32_to_cpu(ctx->attr->length)); + for (;; a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length))) { + if (p2n(a) < p2n(ctx->mrec) || (char*)a > (char*)ctx->mrec + + le32_to_cpu(ctx->mrec->bytes_allocated)) + break; + ctx->attr = a; + if (((type != AT_UNUSED) && (le32_to_cpu(a->type) > + le32_to_cpu(type))) || + (a->type == AT_END)) { + errno = ENOENT; + return -1; + } + if (!a->length) + break; + /* If this is an enumeration return this attribute. */ + if (type == AT_UNUSED) + return 0; + if (a->type != type) + continue; + /* + * If @name is AT_UNNAMED we want an unnamed attribute. + * If @name is present, compare the two names. + * Otherwise, match any attribute. + */ + if (name == AT_UNNAMED) { + /* The search failed if the found attribute is named. */ + if (a->name_length) { + errno = ENOENT; + return -1; + } + } else if (name && !ntfs_names_are_equal(name, name_len, + (ntfschar*)((char*)a + le16_to_cpu(a->name_offset)), + a->name_length, ic, upcase, upcase_len)) { + register int rc; + + rc = ntfs_names_collate(name, name_len, + (ntfschar*)((char*)a + + le16_to_cpu(a->name_offset)), + a->name_length, 1, IGNORE_CASE, + upcase, upcase_len); + /* + * If @name collates before a->name, there is no + * matching attribute. + */ + if (rc == -1) { + errno = ENOENT; + return -1; + } + /* If the strings are not equal, continue search. */ + if (rc) + continue; + rc = ntfs_names_collate(name, name_len, + (ntfschar*)((char*)a + + le16_to_cpu(a->name_offset)), + a->name_length, 1, CASE_SENSITIVE, + upcase, upcase_len); + if (rc == -1) { + errno = ENOENT; + return -1; + } + if (rc) + continue; + } + /* + * The names match or @name not present and attribute is + * unnamed. If no @val specified, we have found the attribute + * and are done. + */ + if (!val) + return 0; + /* @val is present; compare values. */ + else { + register int rc; + + rc = memcmp(val, (char*)a +le16_to_cpu(a->value_offset), + min(val_len, + le32_to_cpu(a->value_length))); + /* + * If @val collates before the current attribute's + * value, there is no matching attribute. + */ + if (!rc) { + register u32 avl; + avl = le32_to_cpu(a->value_length); + if (val_len == avl) + return 0; + if (val_len < avl) { + errno = ENOENT; + return -1; + } + } else if (rc < 0) { + errno = ENOENT; + return -1; + } + } + } + Dputs("mkntfs_attr_find(): File is corrupt. Run chkdsk."); + errno = EIO; + return -1; +} + +/** + * ntfs_attr_lookup - find an attribute in an ntfs inode + * @type: attribute type to find + * @name: attribute name to find (optional, i.e. NULL means don't care) + * @name_len: attribute name length (only needed if @name present) + * @ic: IGNORE_CASE or CASE_SENSITIVE (ignored if @name not present) + * @lowest_vcn: lowest vcn to find (optional, non-resident attributes only) + * @val: attribute value to find (optional, resident attributes only) + * @val_len: attribute value length + * @ctx: search context with mft record and attribute to search from + * + * Find an attribute in an ntfs inode. On first search @ctx->ntfs_ino must + * be the base mft record and @ctx must have been obtained from a call to + * ntfs_attr_get_search_ctx(). + * + * This function transparently handles attribute lists and @ctx is used to + * continue searches where they were left off at. + * + * If @type is AT_UNUSED, return the first found attribute, i.e. one can + * enumerate all attributes by setting @type to AT_UNUSED and then calling + * ntfs_attr_lookup() repeatedly until it returns -1 with errno set to ENOENT + * to indicate that there are no more entries. During the enumeration, each + * successful call of ntfs_attr_lookup() will return the next attribute, with + * the current attribute being described by the search context @ctx. + * + * If @type is AT_END, seek to the end of the base mft record ignoring the + * attribute list completely and return -1 with errno set to ENOENT. AT_END is + * not a valid attribute, its length is zero for example, thus it is safer to + * return error instead of success in this case. It should never ne needed to + * do this, but we implement the functionality because it allows for simpler + * code inside ntfs_external_attr_find(). + * + * If @name is AT_UNNAMED search for an unnamed attribute. If @name is present + * but not AT_UNNAMED search for a named attribute matching @name. Otherwise, + * match both named and unnamed attributes. + * + * After finishing with the attribute/mft record you need to call + * ntfs_attr_put_search_ctx() to cleanup the search context (unmapping any + * mapped extent inodes, etc). + * + * Return 0 if the search was successful and -1 if not, with errno set to the + * error code. + * + * On success, @ctx->attr is the found attribute, it is in mft record + * @ctx->mrec, and @ctx->al_entry is the attribute list entry for this + * attribute with @ctx->base_* being the base mft record to which @ctx->attr + * belongs. If no attribute list attribute is present @ctx->al_entry and + * @ctx->base_* are NULL. + * + * On error ENOENT, i.e. attribute not found, @ctx->attr is set to the + * attribute which collates just after the attribute being searched for in the + * base ntfs inode, i.e. if one wants to add the attribute to the mft record + * this is the correct place to insert it into, and if there is not enough + * space, the attribute should be placed in an extent mft record. + * @ctx->al_entry points to the position within @ctx->base_ntfs_ino->attr_list + * at which the new attribute's attribute list entry should be inserted. The + * other @ctx fields, base_ntfs_ino, base_mrec, and base_attr are set to NULL. + * The only exception to this is when @type is AT_END, in which case + * @ctx->al_entry is set to NULL also (see above). + * + * + * The following error codes are defined: + * ENOENT Attribute not found, not an error as such. + * EINVAL Invalid arguments. + * EIO I/O error or corrupt data structures found. + * ENOMEM Not enough memory to allocate necessary buffers. + */ +int mkntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name, + const u32 name_len, const IGNORE_CASE_BOOL ic, + const VCN lowest_vcn, const u8 *val, const u32 val_len, + ntfs_attr_search_ctx *ctx) +{ + ntfs_inode *base_ni; + + if (!ctx || !ctx->mrec || !ctx->attr) { + errno = EINVAL; + return -1; + } + if (ctx->base_ntfs_ino) + base_ni = ctx->base_ntfs_ino; + else + base_ni = ctx->ntfs_ino; + if (!base_ni || !NInoAttrList(base_ni) || type == AT_ATTRIBUTE_LIST) + return mkntfs_attr_find(type, name, name_len, ic, val, val_len, + ctx); + errno = EOPNOTSUPP; + return -1; +} + +/** + * ntfs_attr_put_search_ctx - release an attribute search context + * @ctx: attribute search context to free + * + * Release the attribute search context @ctx. + */ +void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) +{ + free(ctx); + return; +} + /** * insert_positioned_attr_in_mft_record * Create a non-resident attribute with a predefined on disk location @@ -1229,7 +1520,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, err = -EOPNOTSUPP; goto err_out; } - if (!ntfs_attr_lookup(type, uname, name_len, ic, 0, NULL, 0, ctx)) { + if (!mkntfs_attr_lookup(type, uname, name_len, ic, 0, NULL, 0, ctx)) { err = -EEXIST; goto err_out; } @@ -1414,7 +1705,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, err = -EOPNOTSUPP; goto err_out; } - if (!ntfs_attr_lookup(type, uname, name_len, ic, 0, NULL, 0, ctx)) { + if (!mkntfs_attr_lookup(type, uname, name_len, ic, 0, NULL, 0, ctx)) { err = -EEXIST; goto err_out; } @@ -1576,7 +1867,7 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, ntfschar *uname; /* if (base record) - ntfs_attr_lookup(); + mkntfs_attr_lookup(); else */ if (name_len) { @@ -1603,7 +1894,7 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, err = -EOPNOTSUPP; goto err_out; } - if (!ntfs_attr_lookup(type, uname, name_len, ic, 0, val, val_len, + if (!mkntfs_attr_lookup(type, uname, name_len, ic, 0, val, val_len, ctx)) { err = -EEXIST; goto err_out; @@ -1726,7 +2017,7 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, Eprintf("Failed to allocate attribute search context.\n"); return -ENOMEM; } - if (ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, + if (mkntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { int eo = errno; Eprintf("BUG: Standard information attribute not present in " @@ -2126,7 +2417,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, free(uname); goto err_out; } - err = ntfs_attr_lookup(AT_INDEX_ROOT, uname, name_len, ic, 0, NULL, 0, + err = mkntfs_attr_lookup(AT_INDEX_ROOT, uname, name_len, ic, 0, NULL, 0, ctx); if (uname) free(uname); @@ -3399,7 +3690,7 @@ static void mkntfs_create_root_structures(void) err_exit("Failed to allocate attribute search " "context: %s\n", strerror(errno)); /* There is exactly one file name so this is ok. */ - if (ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, + if (mkntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { ntfs_attr_put_search_ctx(ctx); err_exit("BUG: $FILE_NAME attribute not found.\n"); @@ -3780,7 +4071,7 @@ int main(int argc, char **argv) err_exit("Failed to allocate attribute search context: %s\n", strerror(errno)); // FIXME: This should be IGNORE_CASE! - if (ntfs_attr_lookup(AT_INDEX_ALLOCATION, I30, 4, 0, 0, + if (mkntfs_attr_lookup(AT_INDEX_ALLOCATION, I30, 4, 0, 0, NULL, 0, ctx)) { ntfs_attr_put_search_ctx(ctx); err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n"); @@ -3814,7 +4105,7 @@ int main(int argc, char **argv) if (!ctx) err_exit("Failed to allocate attribute search context: %s\n", strerror(errno)); - if (ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (mkntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { ntfs_attr_put_search_ctx(ctx); err_exit("BUG: $DATA attribute not found.\n"); } diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 722616a3..6e929e43 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1335,11 +1335,11 @@ static void check_output_device(s64 input_size) set_filesize(input_size); } -static ntfs_attr_search_ctx *attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) +static ntfs_attr_search_ctx *attr_get_search_ctx(ntfs_inode *ni) { ntfs_attr_search_ctx *ret; - if ((ret = ntfs_attr_get_search_ctx(ni, mrec)) == NULL) + if ((ret = ntfs_attr_get_search_ctx(ni, NULL)) == NULL) perr_printf("ntfs_attr_get_search_ctx"); return ret; @@ -1371,7 +1371,7 @@ static ntfs_attr_search_ctx *lookup_data_attr(ntfs_inode *ni, const char *aname) ntfschar *ustr = NULL; int len = 0; - if ((ctx = attr_get_search_ctx(ni, NULL)) == NULL) + if ((ctx = attr_get_search_ctx(ni)) == NULL) return NULL; if (str2unicode(aname, &ustr, &len) == -1) diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index ba59af34..2463d308 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -237,11 +237,11 @@ static void parse_options(int argc, char **argv) #endif } -static ntfs_attr_search_ctx *attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) +static ntfs_attr_search_ctx *attr_get_search_ctx(ntfs_inode *ni) { ntfs_attr_search_ctx *ret; - if ((ret = ntfs_attr_get_search_ctx(ni, mrec)) == NULL) + if ((ret = ntfs_attr_get_search_ctx(ni, NULL)) == NULL) perr_println("ntfs_attr_get_search_ctx"); return ret; @@ -612,9 +612,9 @@ static int cmp_attributes(ntfs_inode *ni1, ntfs_inode *ni2) ATTR_TYPES prev_atype, atype1, atype2; ntfs_attr_search_ctx *ctx1, *ctx2; - if (!(ctx1 = attr_get_search_ctx(ni1, NULL))) + if (!(ctx1 = attr_get_search_ctx(ni1))) return -1; - if (!(ctx2 = attr_get_search_ctx(ni2, NULL))) + if (!(ctx2 = attr_get_search_ctx(ni2))) goto out; atype1 = ctx1->attr->type; diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index b7d1466e..af5a79b4 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -16,16 +16,15 @@ .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME -ntfsfix \- fix common errors and force Windows to check NTFS +ntfsfix \- fix common errors .SH SYNOPSIS .B ntfsfix .I device .SH DESCRIPTION \fBntfsfix\fP is a utility that fixes some common NTFS problems. \fBntfsfix\fP is \fBNOT\fP a Linux -version of chkdsk. It only repairs some fundamental NTFS inconsistencies, -resets the NTFS journal file and schedules an NTFS consistency check for -the first boot into Windows. +version of chkdsk. It only repairs some fundamental NTFS inconsistencies and +resets the NTFS journal file. .sp You may run .B ntfsfix diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 49eab6c7..cdc99c2f 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -73,7 +73,6 @@ GEN_PRINTF(Qprintf, stdout, NULL, FALSE) static const char *EXEC_NAME = "ntfsfix"; static const char *OK = "OK"; static const char *FAILED = "FAILED"; -static BOOL vol_is_dirty = FALSE; static BOOL journal_is_empty = FALSE; struct { @@ -146,32 +145,6 @@ static void parse_options(int argc, char **argv) } } -static int set_dirty_flag(ntfs_volume *vol) -{ - u16 flags; - - if (vol_is_dirty == TRUE) - return 0; - - printf("Setting required flags on partition... "); - /* - * Set chkdsk flag, i.e. mark the partition dirty so chkdsk will run - * and fix it for us. - */ - flags = vol->flags | VOLUME_IS_DIRTY; - /* If NTFS volume version >= 2.0 then set mounted on NT4 flag. */ - if (vol->major_ver >= 2) - flags |= VOLUME_MOUNTED_ON_NT4; - if (ntfs_volume_set_flags(vol, flags)) { - puts(FAILED); - fprintf(stderr, "Error setting volume flags.\n"); - return -1; - } - puts(OK); - vol_is_dirty = TRUE; - return 0; -} - static int empty_journal(ntfs_volume *vol) { if (journal_is_empty == TRUE) @@ -349,9 +322,6 @@ int main(int argc, char **argv) printf("Processing of $MFT and $MFTMirr completed successfully.\n"); - if (set_dirty_flag(vol) < 0) - goto error_exit; - if (empty_journal(vol) < 0) goto error_exit; @@ -374,9 +344,6 @@ mount_ok: goto error_exit; } - if (set_dirty_flag(vol) < 0) - goto error_exit; - if (empty_journal(vol) < 0) goto error_exit; diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index c2744c68..bef1d302 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1253,7 +1253,7 @@ static int get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, memcpy(name, (u8 *)attr + attr->name_offset, attr->name_length * sizeof(ntfschar)); } - ctx = ntfs_attr_get_search_ctx(ni, 0); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { perror("ntfs_get_search_ctx failed"); free(name); diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 32e98712..c4bc7e82 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -248,9 +248,8 @@ static int resize_resident_attribute_value(MFT_RECORD *m, ATTR_RECORD *a, */ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, BOOL force) { - ntfs_attr_search_ctx *ctx = NULL; + ntfs_attr_search_ctx *ctx; ntfschar *new_label = NULL; - MFT_RECORD *mrec = NULL; ATTR_RECORD *a; int label_len; int result = 0; @@ -269,17 +268,7 @@ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, } } } - - if (ntfs_file_record_read(vol, (MFT_REF)FILE_Volume, &mrec, NULL)) { - perror("Error reading file record"); - goto err_out; - } - if (!(mrec->flags & MFT_RECORD_IN_USE)) { - fprintf(stderr, "Error: $Volume has been deleted. Run " - "chkdsk to fix this.\n"); - goto err_out; - } - ctx = ntfs_attr_get_search_ctx(NULL, mrec); + ctx = ntfs_attr_get_search_ctx(vol->vol_ni, NULL); if (!ctx) { perror("Failed to get attribute search context"); goto err_out; @@ -314,39 +303,38 @@ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, new_label[label_len / sizeof(ntfschar)] = cpu_to_le16(L'\0'); } if (a) { - if (resize_resident_attribute_value(mrec, a, label_len)) { + if (resize_resident_attribute_value(ctx->mrec, a, label_len)) { perror("Error resizing resident attribute"); goto err_out; } } else { /* sizeof(resident attribute record header) == 24 */ int asize = (24 + label_len + 7) & ~7; - u32 biu = le32_to_cpu(mrec->bytes_in_use); - if (biu + asize > le32_to_cpu(mrec->bytes_allocated)) { + u32 biu = le32_to_cpu(ctx->mrec->bytes_in_use); + if (biu + asize > le32_to_cpu(ctx->mrec->bytes_allocated)) { errno = ENOSPC; perror("Error adding resident attribute"); goto err_out; } a = ctx->attr; - memmove((u8*)a + asize, a, biu - ((u8*)a - (u8*)mrec)); - mrec->bytes_in_use = cpu_to_le32(biu + asize); + memmove((u8*)a + asize, a, biu - ((u8*)a - (u8*)ctx->mrec)); + ctx->mrec->bytes_in_use = cpu_to_le32(biu + asize); a->type = AT_VOLUME_NAME; a->length = cpu_to_le32(asize); a->non_resident = 0; a->name_length = 0; a->name_offset = cpu_to_le16(24); a->flags = cpu_to_le16(0); - a->instance = mrec->next_attr_instance; - mrec->next_attr_instance = cpu_to_le16((le16_to_cpu( - mrec->next_attr_instance) + 1) & 0xffff); + a->instance = ctx->mrec->next_attr_instance; + ctx->mrec->next_attr_instance = cpu_to_le16((le16_to_cpu( + ctx->mrec->next_attr_instance) + 1) & 0xffff); a->value_length = cpu_to_le32(label_len); a->value_offset = a->name_offset; a->resident_flags = 0; a->reservedR = 0; } memcpy((u8*)a + le16_to_cpu(a->value_offset), new_label, label_len); - if (!opts.noaction && - ntfs_mft_record_write(vol, (MFT_REF)FILE_Volume, mrec)) { + if (!opts.noaction && ntfs_inode_sync(vol->vol_ni)) { perror("Error writing MFT Record to disk"); goto err_out; } @@ -354,8 +342,6 @@ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, err_out: if (new_label) free(new_label); - if (mrec) - free(mrec); return result; } diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index e51fa8f9..230ad3b7 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -534,7 +534,7 @@ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, if (!ni) goto release; - ctx = ntfs_attr_get_search_ctx(ni, ni->mrec); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) goto release; @@ -658,7 +658,7 @@ int main(int argc, char **argv) ntfschar *name = NULL; int name_len = 0;; - ctx = ntfs_attr_get_search_ctx (NULL, ni->mrec); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) return -1; diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index 742ad1fa..b6c81a18 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -867,7 +867,8 @@ int main (int argc, char *argv[]) count = move_file (vol, inode, opts.location, 0); if ((count > 0) && (!opts.nodirty)) { - if (ntfs_volume_set_flags (vol, VOLUME_IS_DIRTY) < 0) { + if (ntfs_volume_set_flags (vol, vol->flags | VOLUME_IS_DIRTY) < + 0) { Eprintf ("Couldn't mark volume dirty\n"); } printf ("Relocated %lld bytes\n", count); @@ -884,4 +885,3 @@ int main (int argc, char *argv[]) ntfs_umount (vol, FALSE); return result; } - diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 10b2c993..e97cd35c 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2249,7 +2249,7 @@ static void prepare_volume_fixup(ntfs_volume *vol) printf("Schedule chkdsk for NTFS consistency check at Windows " "boot time ...\n"); - if (ntfs_volume_set_flags(vol, flags)) + if (ntfs_volume_write_flags(vol, flags)) perr_exit("Failed to set $Volume dirty"); if (vol->dev->d_ops->sync(vol->dev) == -1) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index d4a23833..8ba0167b 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -2301,7 +2301,7 @@ static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) if (!bmp) return -1; - ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); + ctx = ntfs_attr_get_search_ctx (inode, NULL); if (!ctx) { printf ("can't create a search context\n"); return -1; @@ -2480,7 +2480,7 @@ static int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfscha //printf ("mft_free = %d\n", mft_free); //printf ("\n"); - ctx = ntfs_attr_get_search_ctx (NULL, mrec); + ctx = ntfs_attr_get_search_ctx (inode, NULL); if (!ctx) goto done; diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index facdc123..0557690d 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -1391,10 +1391,6 @@ int main (int argc, char *argv[]) printf ("%lld bytes were wiped\n", (long long)total); } - if (ntfs_volume_set_flags (vol, VOLUME_IS_DIRTY) < 0) { - Eprintf ("Couldn't mark volume dirty\n"); - } - result = 0; umount: ntfs_umount (vol, FALSE); @@ -1403,4 +1399,3 @@ free: free (opts.bytes); return result; } - diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index c00bfcdb..363cfa5c 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -903,7 +903,7 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->flags_match |= FEMR_FILE; if (ctx->flags_search & FEMR_DIR) { - attr_ctx = ntfs_attr_get_search_ctx (NULL, ctx->inode->mrec); + attr_ctx = ntfs_attr_get_search_ctx (ctx->inode, NULL); if (attr_ctx) { if (ntfs_attr_lookup (AT_INDEX_ROOT, I30, 4, 0, 0, NULL, 0, attr_ctx) == 0) ctx->flags_match |= FEMR_DIR; From 44e60c37c426f1fb546b505de25e66a5e9045987 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 24 Sep 2005 23:46:54 +0000 Subject: [PATCH 2525/2994] Fix 'make extra' (ntfsmove) compilation --- ntfsprogs/ntfsmove.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index b6c81a18..be52e0ec 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -867,7 +867,7 @@ int main (int argc, char *argv[]) count = move_file (vol, inode, opts.location, 0); if ((count > 0) && (!opts.nodirty)) { - if (ntfs_volume_set_flags (vol, vol->flags | VOLUME_IS_DIRTY) < + if (ntfs_volume_write_flags (vol, vol->flags | VOLUME_IS_DIRTY) < 0) { Eprintf ("Couldn't mark volume dirty\n"); } From 8afb8a0daae42c842fa3072b089e7a27dee5f9d4 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 25 Sep 2005 11:42:26 +0000 Subject: [PATCH 2526/2994] minor cleanup --- ntfsprogs/ntfsmount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 3b658781..0218a03e 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -773,7 +773,7 @@ static int ntfs_fuse_unlink(const char *org_path) static int ntfs_fuse_rename(const char *old_path, const char *new_path) { int ret; - + if ((ret = ntfs_fuse_link(old_path, new_path))) return ret; if ((ret = ntfs_fuse_unlink(old_path))) { @@ -1427,7 +1427,7 @@ int main(int argc, char *argv[]) struct fuse *fh; int ffd; - setlocale(LC_ALL, ""); + utils_set_locale(); signal(SIGINT, signal_handler); signal(SIGTERM, signal_handler); From 5ca19a130bd3d4a5c647720c9aa6da96e8ea89e9 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 25 Sep 2005 14:12:44 +0000 Subject: [PATCH 2527/2994] fix stupid bug in ntfs_delete, optimize it a bit --- libntfs/dir.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libntfs/dir.c b/libntfs/dir.c index 0393f69f..f4750f4a 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1282,11 +1282,18 @@ search: errno = 0; fn = (FILE_NAME_ATTR*)((u8*)actx->attr + le16_to_cpu(actx->attr->value_offset)); - if (looking_for_dos_name && fn->file_name_type == FILE_NAME_DOS) - break; - if (looking_for_win32_name && - fn->file_name_type == FILE_NAME_WIN32) - break; + if (looking_for_dos_name) { + if (fn->file_name_type == FILE_NAME_DOS) + break; + else + continue; + } + if (looking_for_win32_name) { + if (fn->file_name_type == FILE_NAME_WIN32) + break; + else + continue; + } if (dir_ni->mft_no == MREF_LE(fn->parent_directory) && ntfs_names_are_equal(fn->file_name, fn->file_name_length, name, @@ -1295,7 +1302,6 @@ search: ni->vol->upcase, ni->vol->upcase_len)) { if (fn->file_name_type == FILE_NAME_WIN32) { looking_for_dos_name = TRUE; - ntfs_attr_reinit_search_ctx(actx); continue; } if (fn->file_name_type == FILE_NAME_DOS) From 660b44f3edddcdd1add247b74fb3fa124c07558a Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 25 Sep 2005 19:22:11 +0000 Subject: [PATCH 2528/2994] Fix --enable-really-statici: mkntfs redefined ntfs_attr_put_search_ctx() --- ntfsprogs/mkntfs.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index d5e50db5..595163a8 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1459,18 +1459,6 @@ int mkntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name, return -1; } -/** - * ntfs_attr_put_search_ctx - release an attribute search context - * @ctx: attribute search context to free - * - * Release the attribute search context @ctx. - */ -void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) -{ - free(ctx); - return; -} - /** * insert_positioned_attr_in_mft_record * Create a non-resident attribute with a predefined on disk location From a0338ab9b2a0d86b00646700c953e1379191a962 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 25 Sep 2005 19:35:56 +0000 Subject: [PATCH 2529/2994] Fix uninteded output and typo --- ntfsprogs/ntfscmp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index 2463d308..72580d7f 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -583,10 +583,12 @@ static int new_attribute(ntfs_attr_search_ctx *ctx, } else if (prev_name || name) return 1; - print_inode(base_inode(ctx)->mft_no); - print_attribute_ctx(ctx); - Vprintf("extent %llu lowest_vcn %lld: SKIPPED\n", - ctx->ntfs_ino->mft_no, ctx->attr->lowest_vcn); + if (opt.verbose) { + print_inode(base_inode(ctx)->mft_no); + print_attribute_ctx(ctx); + printf("record %llu lowest_vcn %lld: SKIPPED\n", + ctx->ntfs_ino->mft_no, ctx->attr->lowest_vcn); + } return 0; } From 431258997d1f3101dcd04ae8922edb22424872ef Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 25 Sep 2005 21:42:47 +0000 Subject: [PATCH 2530/2994] Fix saving by sectors during --rescue --- ChangeLog | 1 + ntfsprogs/ntfsclone.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e33b3424..5cd6163e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -60,6 +60,7 @@ xx/xx/2005 - 1.12.0-WIP when calling ntfs_attr_get_search_ctx() except a very few cases which genuinely need this functionality as they work on a too low level. Make sure all those cases are ok. + - ntfsclone: fix saving by sectors during --rescue (Scott Hansen, Szaka) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 6e929e43..190dd7c2 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -496,18 +496,21 @@ static void rescue_sector(void *fd, off_t pos, void *buff) } -static void copy_cluster(int rescue, off_t rescue_pos) +static void copy_cluster(int rescue, u64 rescue_lcn) { char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */ /* vol is NULL if opt.restore_image is set */ u32 csize = image_hdr.cluster_size; void *fd = (void *)&fd_in; + off_t rescue_pos; if (!opt.restore_image) { csize = vol->cluster_size; fd = vol->dev; } + rescue_pos = (off_t)(rescue_lcn * csize); + if (read_all(fd, buff, csize) == -1) { if (errno != EIO) From 4b1b89109da36178fab358851ee91a457a96c98f Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 26 Sep 2005 13:11:00 +0000 Subject: [PATCH 2531/2994] Fix the definition of the CHKD ntfs record magic. It had an off by two error causing it to be CHKB instead of CHKD. --- ChangeLog | 2 ++ include/ntfs/layout.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5cd6163e..3d315c1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -61,6 +61,8 @@ xx/xx/2005 - 1.12.0-WIP genuinely need this functionality as they work on a too low level. Make sure all those cases are ok. - ntfsclone: fix saving by sectors during --rescue (Scott Hansen, Szaka) + - Fix the definition of the CHKD ntfs record magic. It had an off by + two error causing it to be CHKB instead of CHKD. 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 2d78b19b..b77b7b97 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -112,7 +112,7 @@ typedef enum { magic_RCRD = const_cpu_to_le32(0x44524352), /* Log record page. */ /* Found in $LogFile/$DATA. (May be found in $MFT/$DATA, also?) */ - magic_CHKD = const_cpu_to_le32(0x424b4843), /* Modified by chkdsk. */ + magic_CHKD = const_cpu_to_le32(0x444b4843), /* Modified by chkdsk. */ /* Found in all ntfs record containing records. */ magic_BAAD = const_cpu_to_le32(0x44414142), /* Failed multi sector From 339abc36b4bd7c278b34963eb02cab153fe067e2 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 26 Sep 2005 13:18:29 +0000 Subject: [PATCH 2532/2994] More $LogFile handling fixes: when chkdsk has been run, it can leave the restart pages in the journal without multi sector transfer protection fixups (i.e. the update sequence array is empty and in fact does not exist). --- ChangeLog | 6 +++--- libntfs/logfile.c | 51 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3d315c1c..ef5d7081 100644 --- a/ChangeLog +++ b/ChangeLog @@ -55,14 +55,14 @@ xx/xx/2005 - 1.12.0-WIP set a flag, it overwrites the flags! Rename it to ntfs_volume_write_flags() and clean it up a lot. Update all callers. (Anton) - - Change ntfsfix to no longer set the volume dirty. + - Change ntfsfix to no longer set the volume dirty. (Anton) - Change everything to supply an ntfs_inode and NULL for mft record when calling ntfs_attr_get_search_ctx() except a very few cases which genuinely need this functionality as they work on a too low level. - Make sure all those cases are ok. + Make sure all those cases are ok. (Anton) - ntfsclone: fix saving by sectors during --rescue (Scott Hansen, Szaka) - Fix the definition of the CHKD ntfs record magic. It had an off by - two error causing it to be CHKB instead of CHKD. + two error causing it to be CHKB instead of CHKD. (Anton) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/libntfs/logfile.c b/libntfs/logfile.c index 94e156ad..bfd67c06 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -42,7 +42,8 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) { u32 logfile_system_page_size, logfile_log_page_size; - u16 usa_count, usa_ofs, usa_end, ra_ofs; + u16 ra_ofs, usa_count, usa_ofs, usa_end = 0; + BOOL have_usa = TRUE; ntfs_debug("Entering."); /* @@ -77,6 +78,14 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) (int)sle16_to_cpu(rp->minor_ver)); return FALSE; } + /* + * If chkdsk has been run the restart page may not be protected by an + * update sequence array. + */ + if (ntfs_is_chkd_record(rp->magic) && !le16_to_cpu(rp->usa_count)) { + have_usa = FALSE; + goto skip_usa_checks; + } /* Verify the size of the update sequence array. */ usa_count = 1 + (logfile_system_page_size >> NTFS_BLOCK_SIZE_BITS); if (usa_count != le16_to_cpu(rp->usa_count)) { @@ -93,6 +102,7 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) "inconsistent update sequence array offset."); return FALSE; } +skip_usa_checks: /* * Verify the position of the restart area. It must be: * - aligned to 8-byte boundary, @@ -100,7 +110,8 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) * - within the system page size. */ ra_ofs = le16_to_cpu(rp->restart_area_offset); - if (ra_ofs & 7 || ra_ofs < usa_end || + if (ra_ofs & 7 || (have_usa ? ra_ofs < usa_end : + ra_ofs < sizeof(RESTART_PAGE_HEADER)) || ra_ofs > logfile_system_page_size) { ntfs_error(vi->i_sb, "$LogFile restart page specifies " "inconsistent restart area offset."); @@ -360,19 +371,22 @@ static int ntfs_check_and_load_restart_page(ntfs_attr *log_na, */ if (le32_to_cpu(rp->system_page_size) <= NTFS_BLOCK_SIZE) memcpy(trp, rp, le32_to_cpu(rp->system_page_size)); - else - if (ntfs_attr_pread(log_na, pos, le32_to_cpu( - rp->system_page_size), trp) != - le32_to_cpu(rp->system_page_size)) { - err = errno; - ntfs_error(, "Failed to read whole restart page into " - "the buffer."); - if (err != ENOMEM) - err = EIO; - goto err_out; - } - /* Perform the multi sector transfer deprotection on the buffer. */ - if (ntfs_mst_post_read_fixup((NTFS_RECORD*)trp, + else if (ntfs_attr_pread(log_na, pos, + le32_to_cpu(rp->system_page_size), trp) != + le32_to_cpu(rp->system_page_size)) { + err = errno; + ntfs_error(, "Failed to read whole restart page into the " + "buffer."); + if (err != ENOMEM) + err = EIO; + goto err_out; + } + /* + * Perform the multi sector transfer deprotection on the buffer if the + * restart page is protected. + */ + if ((!ntfs_is_chkd_record(trp->magic) || le16_to_cpu(trp->usa_count)) + && ntfs_mst_post_read_fixup((NTFS_RECORD*)trp, le32_to_cpu(rp->system_page_size))) { /* * A multi sector tranfer error was detected. We only need to @@ -578,11 +592,16 @@ is_empty: * Otherwise just throw it away. */ if (rstr2_lsn > rstr1_lsn) { + ntfs_debug("Using second restart page as it is more " + "recent."); free(rstr1_ph); rstr1_ph = rstr2_ph; /* rstr1_lsn = rstr2_lsn; */ - } else + } else { + ntfs_debug("Using first restart page as it is more " + "recent."); free(rstr2_ph); + } rstr2_ph = NULL; } /* All consistency checks passed. */ From 2aa1cfe3d9a92780e37934a5b02eca7003310681 Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 27 Sep 2005 15:25:19 +0000 Subject: [PATCH 2533/2994] fix a build warning --- ntfsprogs/mkntfs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 595163a8..69574b65 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1437,10 +1437,10 @@ static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, * EIO I/O error or corrupt data structures found. * ENOMEM Not enough memory to allocate necessary buffers. */ -int mkntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name, +static int mkntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name, const u32 name_len, const IGNORE_CASE_BOOL ic, - const VCN lowest_vcn, const u8 *val, const u32 val_len, - ntfs_attr_search_ctx *ctx) + const VCN lowest_vcn __attribute__ ((unused)), const u8 *val, + const u32 val_len, ntfs_attr_search_ctx *ctx) { ntfs_inode *base_ni; @@ -3509,6 +3509,9 @@ static void mkntfs_fill_device_with_zeroes(void) Qprintf(" - Done.\n"); } +/** + * create_file_volume - + */ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) { int i, err; From 6691212129c35b21e80d50e772df4e137962800b Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 27 Sep 2005 17:11:30 +0000 Subject: [PATCH 2534/2994] fix a memory leak - vol->vol_ni --- libntfs/volume.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libntfs/volume.c b/libntfs/volume.c index ceb75af8..dadff700 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -101,6 +101,8 @@ static void __ntfs_volume_release(ntfs_volume *v) ntfs_attr_close(v->mftmirr_na); if (v->mftmirr_ni) ntfs_inode_close(v->mftmirr_ni); + if (v->vol_ni) + ntfs_inode_close(v->vol_ni); if (v->dev) { struct ntfs_device *dev = v->dev; From 151d0ecb61e8112e678be050283ea34c5cff5624 Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 27 Sep 2005 18:03:00 +0000 Subject: [PATCH 2535/2994] Fix the double free that just got added. There was only half a memory leak... It was a cut and paste error, not a real memory leak. --- libntfs/volume.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index dadff700..9d06d695 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -79,10 +79,10 @@ ntfs_volume *ntfs_volume_alloc(void) */ static void __ntfs_volume_release(ntfs_volume *v) { - if (v->vol_ni && NInoDirty(v->vol_ni)) - ntfs_inode_close(v->vol_ni); if (v->lcnbmp_ni && NInoDirty(v->lcnbmp_ni)) ntfs_inode_sync(v->lcnbmp_ni); + if (v->vol_ni) + ntfs_inode_close(v->vol_ni); if (v->lcnbmp_na) ntfs_attr_close(v->lcnbmp_na); if (v->lcnbmp_ni) @@ -101,8 +101,6 @@ static void __ntfs_volume_release(ntfs_volume *v) ntfs_attr_close(v->mftmirr_na); if (v->mftmirr_ni) ntfs_inode_close(v->mftmirr_ni); - if (v->vol_ni) - ntfs_inode_close(v->vol_ni); if (v->dev) { struct ntfs_device *dev = v->dev; From 8db479a6b1b6e95d44631996d38653589d025677 Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 28 Sep 2005 13:47:47 +0000 Subject: [PATCH 2536/2994] Patch from Christophe: A lot of headers are checked by autoconf (AC_CHECK_HEADERS in configure.ac). Please find a patch that add the missing "#ifdef" to the source code. --- libntfs/attrib.c | 8 ++++++++ libntfs/attrlist.c | 4 ++++ libntfs/bitmap.c | 8 ++++++++ libntfs/bootsect.c | 8 ++++++++ libntfs/compress.c | 8 ++++++++ libntfs/device.c | 16 ++++++++++++++++ libntfs/gnome-vfs-method.c | 2 ++ libntfs/index.c | 2 ++ libntfs/inode.c | 6 ++++++ libntfs/lcnalloc.c | 6 ++++++ libntfs/logfile.c | 2 ++ libntfs/mft.c | 8 ++++++++ libntfs/mst.c | 2 ++ libntfs/runlist.c | 8 ++++++++ libntfs/security.c | 8 ++++++++ libntfs/unistr.c | 10 ++++++++++ libntfs/unix_io.c | 18 ++++++++++++++++++ libntfs/volume.c | 16 ++++++++++++++++ libntfs/win32_io.c | 10 ++++++++++ ntfsprogs/cluster.c | 6 ++++++ ntfsprogs/mkntfs.c | 10 ++++++++++ ntfsprogs/ntfscat.c | 8 ++++++++ ntfsprogs/ntfsclone.c | 22 ++++++++++++++++++++++ ntfsprogs/ntfscluster.c | 10 ++++++++++ ntfsprogs/ntfscp.c | 12 ++++++++++++ ntfsprogs/ntfsdecrypt.c | 22 ++++++++++++++++++++++ ntfsprogs/ntfsdump_logfile.c | 18 ++++++++++++++++++ ntfsprogs/ntfsfix.c | 14 ++++++++++++++ ntfsprogs/ntfsinfo.c | 10 ++++++++++ ntfsprogs/ntfslabel.c | 12 ++++++++++++ ntfsprogs/ntfsls.c | 10 ++++++++++ ntfsprogs/ntfsmftalloc.c | 4 ++++ ntfsprogs/ntfsmount.c | 16 ++++++++++++++++ ntfsprogs/ntfsmove.c | 8 ++++++++ ntfsprogs/ntfsresize.c | 14 ++++++++++++++ ntfsprogs/ntfsrm.c | 10 ++++++++++ ntfsprogs/ntfstruncate.c | 4 ++++ ntfsprogs/ntfsundelete.c | 26 ++++++++++++++++++++++++++ ntfsprogs/ntfswipe.c | 14 ++++++++++++++ ntfsprogs/upcase.c | 2 ++ ntfsprogs/utils.c | 22 ++++++++++++++++++++++ 41 files changed, 424 insertions(+) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 4e6f2bf0..536a7471 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -23,10 +23,18 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif #include "compat.h" diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index c63bf8fc..530a0a36 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -23,8 +23,12 @@ #include "config.h" +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif #include "types.h" #include "layout.h" diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index 6f9252d8..9bae43eb 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -21,10 +21,18 @@ #include "config.h" +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif #include "types.h" #include "attrib.h" diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index 4230bcad..e9fb56f9 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -22,10 +22,18 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif #include "compat.h" diff --git a/libntfs/compress.c b/libntfs/compress.c index 17d0981c..869e8de0 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -23,10 +23,18 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif #include "attrib.h" #include "debug.h" diff --git a/libntfs/device.c b/libntfs/device.c index 6439b942..83da11c3 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -21,14 +21,30 @@ #include "config.h" +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_SYS_TYPES_H #include +#endif +#ifdef HAVE_SYS_STAT_H #include +#endif +#ifdef HAVE_FCNTL_H #include +#endif #ifdef HAVE_SYS_IOCTL_H # include #endif diff --git a/libntfs/gnome-vfs-method.c b/libntfs/gnome-vfs-method.c index 66839e66..49def0a7 100644 --- a/libntfs/gnome-vfs-method.c +++ b/libntfs/gnome-vfs-method.c @@ -34,7 +34,9 @@ #include #include "gnome-vfs-module.h" #include +#ifdef HAVE_STRING_H #include +#endif #include #include "volume.h" diff --git a/libntfs/index.c b/libntfs/index.c index 06cf70c1..c93b8047 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -20,7 +20,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_STDLIB_H #include +#endif #include "attrib.h" #include "collate.h" diff --git a/libntfs/inode.c b/libntfs/inode.c index b59a5216..352bc127 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -22,9 +22,15 @@ #include "config.h" +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif #include "compat.h" diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 92a9da18..807e6537 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -22,9 +22,15 @@ #include "config.h" +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif #include "types.h" #include "attrib.h" diff --git a/libntfs/logfile.c b/libntfs/logfile.c index bfd67c06..703ea296 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -20,7 +20,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_STDLIB_H #include +#endif #include "attrib.h" #include "debug.h" diff --git a/libntfs/mft.c b/libntfs/mft.c index 770868a6..ce4ed5fb 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -22,10 +22,18 @@ #include "config.h" +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif #include #include "compat.h" diff --git a/libntfs/mst.c b/libntfs/mst.c index 9b34cd34..72587d4c 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -22,7 +22,9 @@ #include "config.h" #include "mst.h" +#ifdef HAVE_ERRNO_H #include +#endif /** * ntfs_mst_post_read_fixup - deprotect multi sector transfer protected data diff --git a/libntfs/runlist.c b/libntfs/runlist.c index fe0ed0e9..a6885314 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -23,10 +23,18 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif #include "compat.h" diff --git a/libntfs/security.c b/libntfs/security.c index d04c563e..64f228a8 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -22,10 +22,18 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif #include "types.h" #include "layout.h" diff --git a/libntfs/unistr.c b/libntfs/unistr.c index cb46dd2e..79103627 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -21,11 +21,21 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_WCHAR_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif #include "types.h" #include "unistr.h" diff --git a/libntfs/unix_io.c b/libntfs/unix_io.c index 2e8fe5a8..196d6160 100644 --- a/libntfs/unix_io.c +++ b/libntfs/unix_io.c @@ -21,15 +21,33 @@ #include "config.h" +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_SYS_TYPES_H #include +#endif +#ifdef HAVE_SYS_STAT_H #include +#endif +#ifdef HAVE_FCNTL_H #include +#endif +#ifdef HAVE_SYS_IOCTL_H #include +#endif #ifdef HAVE_LINUX_FD_H # include #endif diff --git a/libntfs/volume.c b/libntfs/volume.c index 9d06d695..984a06ae 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -22,14 +22,30 @@ #include "config.h" +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_FCNTL_H #include +#endif +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_SYS_STAT_H #include +#endif +#ifdef HAVE_LIMITS_H #include +#endif #include "volume.h" #include "attrib.h" diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index f6406416..50d65efb 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -24,13 +24,23 @@ #include "config.h" +#ifdef HAVE_WINDOWS_H #include +#endif #include +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_CTYPE_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_FCNTL_H #include +#endif /* * Cannot use "../include/types.h" since it conflicts with "wintypes.h". diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c index ce83aa0d..775151f1 100644 --- a/ntfsprogs/cluster.c +++ b/ntfsprogs/cluster.c @@ -23,9 +23,15 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif #include "cluster.h" #include "utils.h" diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 69574b65..4097a1b4 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -62,16 +62,24 @@ #ifdef HAVE_ERRNO_H # include #endif +#ifdef HAVE_TIME_H #include +#endif #ifdef HAVE_GETOPT_H # include #else extern char *optarg; extern int optind; #endif +#ifdef HAVE_SYS_STAT_H #include +#endif +#ifdef HAVE_SYS_IOCTL_H #include +#endif +#ifdef HAVE_FCNTL_H #include +#endif #ifdef HAVE_LINUX_MAJOR_H # include # ifndef MAJOR @@ -110,7 +118,9 @@ (M) <= SCSI_DISK7_MAJOR)) # endif #endif +#ifdef HAVE_LIMITS_H #include +#endif #if defined(linux) && defined(_IO) && !defined(BLKSSZGET) # define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytes. */ diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index ceef7868..809b17b2 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -24,10 +24,18 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif #include "types.h" #include "attrib.h" diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 190dd7c2..db40b4d4 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -15,20 +15,42 @@ #include "config.h" +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_SYS_TYPES_H #include +#endif +#ifdef HAVE_SYS_STAT_H #include +#endif +#ifdef HAVE_SYS_IOCTL_H #include +#endif #ifdef HAVE_SYS_VFS_H # include #endif +#ifdef HAVE_FCNTL_H #include +#endif +#ifdef HAVE_STDARG_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif #include "debug.h" #include "types.h" diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 9bc60ee9..0c7b86f1 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -23,11 +23,21 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_LIMITS_H #include +#endif #include "ntfscluster.h" #include "types.h" diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 35242ba2..676ae152 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -24,13 +24,25 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif #include +#ifdef HAVE_SYS_STAT_H #include +#endif +#ifdef HAVE_UNISTD_H #include +#endif #include "types.h" #include "attrib.h" diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index b1bf40cc..72ce32e6 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -29,17 +29,39 @@ #error A required header file is missing. Aborting. #endif +#ifdef HAVE_SYS_TYPES_H #include +#endif +#ifdef HAVE_SYS_STAT_H #include +#endif +#ifdef HAVE_FCNTL_H #include +#endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_GCRYPT_H #include +#endif +#ifdef HAVE_GNUTLS_PKCS12_H #include +#endif #include "types.h" #include "attrib.h" diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index b6ef6802..38d7d7ba 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -32,15 +32,33 @@ #include "config.h" +#ifdef HAVE_SYS_TYPES_H #include +#endif +#ifdef HAVE_SYS_STAT_H #include +#endif +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_STDARG_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_FCNTL_H #include +#endif #include "types.h" #include "endians.h" diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index cdc99c2f..835b07d1 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -45,13 +45,27 @@ #include "config.h" +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_FCNTL_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif #include "types.h" #include "attrib.h" diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index bef1d302..f1ada6ce 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -46,11 +46,21 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_TIME_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif #ifdef HAVE_ERRNO_H #include diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index c4bc7e82..e8747cb5 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -25,12 +25,24 @@ #include "config.h" +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_LOCALE_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif #include "debug.h" #include "mft.h" diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 230ad3b7..d5cada66 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -26,11 +26,21 @@ */ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_TIME_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif #include "types.h" #include "mft.h" diff --git a/ntfsprogs/ntfsmftalloc.c b/ntfsprogs/ntfsmftalloc.c index 3723a309..8ecb10b2 100644 --- a/ntfsprogs/ntfsmftalloc.c +++ b/ntfsprogs/ntfsmftalloc.c @@ -41,13 +41,17 @@ #ifdef HAVE_ERRNO_H # include #endif +#ifdef HAVE_TIME_H #include +#endif #ifdef HAVE_GETOPT_H # include #else extern int optind; #endif +#ifdef HAVE_LIMITS_H #include +#endif #ifndef LLONG_MAX # define LLONG_MAX 9223372036854775807LL #endif diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 0218a03e..3a73fcd6 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -24,15 +24,31 @@ #include "config.h" #include +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_FCNTL_H #include +#endif +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_LOCALE_H #include +#endif #include +#ifdef HAVE_LIMITS_H #include +#endif #include #include diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index be52e0ec..ab05c0e2 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -24,10 +24,18 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif #include "types.h" #include "attrib.h" diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index e97cd35c..b4dbb7bd 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -29,13 +29,27 @@ #include "config.h" +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STDARG_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif #include "debug.h" #include "types.h" diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 8ba0167b..68a3070f 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -21,11 +21,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_TIME_H #include +#endif #include "utils.h" #include "ntfsrm.h" diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index e9942f16..75663989 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -42,14 +42,18 @@ #ifdef HAVE_ERRNO_H # include #endif +#ifdef HAVE_TIME_H #include +#endif #ifdef HAVE_GETOPT_H # include #else extern char *optarg; extern int optind; #endif +#ifdef HAVE_LIMITS_H #include +#endif #ifndef LLONG_MAX # define LLONG_MAX 9223372036854775807LL #endif diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index a0d0a72b..acc12661 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -28,20 +28,46 @@ #ifdef HAVE_FEATURES_H # include #endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_SYS_TYPES_H #include +#endif +#ifdef HAVE_SYS_STAT_H #include +#endif +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_FCNTL_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif +#ifdef HAVE_TIME_H #include +#endif +#ifdef HAVE_LIMITS_H #include +#endif #include +#ifdef HAVE_STDARG_H #include +#endif +#ifdef HAVE_UTIME_H #include +#endif #include "ntfsundelete.h" #include "bootsect.h" diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 0557690d..07f34e97 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -24,13 +24,27 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_STDARG_H #include +#endif +#ifdef HAVE_GETOPT_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_UNISTD_H #include +#endif #include "ntfswipe.h" #include "types.h" diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c index ec02a64b..08cdb0bb 100644 --- a/ntfsprogs/upcase.c +++ b/ntfsprogs/upcase.c @@ -24,7 +24,9 @@ #include "config.h" +#ifdef HAVE_STRING_H #include +#endif #include "types.h" diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 363cfa5c..4218fb3d 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -25,20 +25,42 @@ #include "config.h" +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STDARG_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_SYS_TYPES_H #include +#endif +#ifdef HAVE_SYS_STAT_H #include +#endif +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_LOCALE_H #include +#endif #ifdef HAVE_LIBINTL_H # include #endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_LIMITS_H #include +#endif +#ifdef HAVE_CTYPE_H #include +#endif #include "config.h" #include "utils.h" From 1b5ee7b7a3515df4da7fba081bac501b7f95614a Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 29 Sep 2005 12:44:42 +0000 Subject: [PATCH 2537/2994] need config.h for the autoconf #ifdefs --- libntfs/index.c | 2 ++ libntfs/logfile.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libntfs/index.c b/libntfs/index.c index c93b8047..36dcdc91 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -20,6 +20,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #ifdef HAVE_STDLIB_H #include #endif diff --git a/libntfs/logfile.c b/libntfs/logfile.c index 703ea296..e963f5c9 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -20,6 +20,8 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #ifdef HAVE_STDLIB_H #include #endif From 9ee916bbd0b644da11d5b323dbd90b6156374228 Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 29 Sep 2005 12:50:39 +0000 Subject: [PATCH 2538/2994] need config.h for the autoconf #ifdefs --- ntfsprogs/ntfsrm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 68a3070f..6a0a6e21 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -21,6 +21,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #ifdef HAVE_STDIO_H #include #endif From ab2ad80ae76532c41428f16101111709fb3ffaa1 Mon Sep 17 00:00:00 2001 From: szaka Date: Thu, 29 Sep 2005 23:30:15 +0000 Subject: [PATCH 2539/2994] Accept incorrect $Bitmap size if it covers the entire volume --- ChangeLog | 5 +++++ ntfsprogs/ntfsclone.c | 33 ++++++++------------------------- ntfsprogs/ntfsresize.c | 21 +++++++++------------ 3 files changed, 22 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef5d7081..6b58971c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -63,6 +63,11 @@ xx/xx/2005 - 1.12.0-WIP - ntfsclone: fix saving by sectors during --rescue (Scott Hansen, Szaka) - Fix the definition of the CHKD ntfs record magic. It had an off by two error causing it to be CHKB instead of CHKD. (Anton) + - Add new utility ntfscmp (make extra) which compares two NTFS volumes + and tell the differences. It's used for development, debugging, + testing, etc. (Szaka) + - ntfsresize, ntfsclone: accept incorrect $Bitmap size if it covers + the entire volume. (Szaka) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index db40b4d4..bce0403b 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -419,25 +419,6 @@ static void progress_update(struct progress_bar *p, u64 current) fflush(msg_out); } -/** - * nr_clusters_to_bitmap_byte_size - * - * Take the number of clusters in the volume and calculate the size of $Bitmap. - * The size will always be a multiple of 8 bytes. - */ -static s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) -{ - s64 bm_bsize; - - bm_bsize = rounded_up_division(nr_clusters, 8); - - bm_bsize = (bm_bsize + 7) & ~7; - Dprintf("Bitmap byte size : %lld (%lld clusters)\n", - bm_bsize, rounded_up_division(bm_bsize, vol->cluster_size)); - - return bm_bsize; -} - static s64 is_critical_metadata(ntfs_walk_clusters_ctx *image, runlist *rl) { s64 inode = image->ni->mft_no; @@ -875,16 +856,18 @@ static void compare_bitmaps(struct bitmap *a) perr_exit("Couldn't get $Bitmap $DATA"); if (count == 0) { - if (a->size != pos) - err_exit("$Bitmap file size doesn't match " - "calculated size (%lld != %lld)\n", - a->size, pos); + if (a->size > pos) + err_exit("$Bitmap size is smaller than expected" + " (%lld != %lld)\n", a->size, pos); break; } for (i = 0; i < count; i++, pos++) { s64 cl; /* current cluster */ + if (a->size <= pos) + goto done; + if (a->bm[pos] == bm[i]) continue; @@ -910,7 +893,7 @@ static void compare_bitmaps(struct bitmap *a) } } } - +done: if (mismatch) { Printf("Totally %d cluster accounting mismatches.\n", mismatch); if (opt.ignore_fs_check) { @@ -1071,7 +1054,7 @@ static void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm) static void setup_lcn_bitmap(void) { /* Determine lcn bitmap byte size and allocate it. */ - lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters); + lcn_bitmap.size = rounded_up_division(vol->nr_clusters, 8); if (!(lcn_bitmap.bm = (unsigned char *)calloc(1, lcn_bitmap.size))) perr_exit("Failed to allocate internal buffer"); diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index b4dbb7bd..6c16efe0 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -616,7 +616,7 @@ static void dump_runlist(runlist *rl) * nr_clusters_to_bitmap_byte_size * * Take the number of clusters in the volume and calculate the size of $Bitmap. - * The size will always be a multiple of 8 bytes. + * The size must be always a multiple of 8 bytes. */ static s64 nr_clusters_to_bitmap_byte_size(s64 nr_clusters) { @@ -927,21 +927,18 @@ static void compare_bitmaps(ntfs_volume *vol, struct bitmap *a) perr_exit("Couldn't get $Bitmap $DATA"); if (count == 0) { - if (a->size != pos) - err_exit("$Bitmap file size doesn't match " - "calculated size (%lld != %lld)\n", - a->size, pos); + if (a->size > pos) + err_exit("$Bitmap size is smaller than expected" + " (%lld != %lld)\n", a->size, pos); break; } - if (a->size < pos + count) - err_exit("$Bitmap file size is larger than " - "expected (%lld+ versus %lld)\n", - pos + count, a->size); - for (i = 0; i < count; i++, pos++) { s64 cl; /* current cluster */ + if (a->size <= pos) + goto done; + if (a->bm[pos] == bm[i]) continue; @@ -972,7 +969,7 @@ static void compare_bitmaps(ntfs_volume *vol, struct bitmap *a) } } } - +done: if (mismatch) { err_printf("Filesystem check failed! Totally %d cluster " "accounting mismatches.\n", mismatch); @@ -2087,7 +2084,7 @@ static void truncate_bitmap_file(ntfs_resize_t *resize) static int setup_lcn_bitmap(struct bitmap *bm, s64 nr_clusters) { /* Determine lcn bitmap byte size and allocate it. */ - bm->size = nr_clusters_to_bitmap_byte_size(nr_clusters); + bm->size = rounded_up_division(nr_clusters, 8); if (!(bm->bm = (unsigned char *)calloc(1, bm->size))) return -1; From 27d923bffb3efded0ffc8fcbd284d9218a2dcaba Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 30 Sep 2005 09:45:54 +0000 Subject: [PATCH 2540/2994] typo fix --- libntfs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/dir.c b/libntfs/dir.c index f4750f4a..4f55c565 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1324,7 +1324,7 @@ search: ((FILE_NAME_ATTR*)ictx->data)->file_name_type = FILE_NAME_POSIX; ntfs_index_entry_mark_dirty(ictx); } - /* Do not support reparse oint deletion yet. */ + /* Do not support reparse point deletion yet. */ if (((FILE_NAME_ATTR*)ictx->data)->file_attributes & FILE_ATTR_REPARSE_POINT) { errno = EOPNOTSUPP; From 7aeed859b9d16f21431f919e508bba4951510638 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 30 Sep 2005 09:52:05 +0000 Subject: [PATCH 2541/2994] Revert Anton's code that breaks functions needed for attribute resize. --- libntfs/attrib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 536a7471..5bc7ac6d 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2554,7 +2554,7 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, } /* Locate place where record should be. */ - ctx = ntfs_attr_get_search_ctx(ni, NULL); + ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); if (!ctx) return -1; if (!ntfs_attr_lookup(type, name, name_len, @@ -2679,7 +2679,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, } /* Locate place where record should be. */ - ctx = ntfs_attr_get_search_ctx(ni, NULL); + ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); if (!ctx) return -1; if (!ntfs_attr_lookup(type, name, name_len, CASE_SENSITIVE, @@ -3342,7 +3342,7 @@ int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) /* Find place in MFT record where attribute will be moved. */ a = ctx->attr; - nctx = ntfs_attr_get_search_ctx(ni, NULL); + nctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); if (!nctx) { err = errno; Dprintf("%s(): Couldn't obtain search context.\n", From ad2e6baf35406840f0a5b94a2fd65833cd01579f Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 30 Sep 2005 13:13:38 +0000 Subject: [PATCH 2542/2994] Refix my previous fix to fix. :-) Comment thinks better. --- libntfs/attrib.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 5bc7ac6d..7bc442c8 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2554,11 +2554,16 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, } /* Locate place where record should be. */ - ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) return -1; - if (!ntfs_attr_lookup(type, name, name_len, - CASE_SENSITIVE, 0, val, size, ctx)) { + /* + * Use ntfs_attr_find instead of ntfs_attr_lookup to find place for + * attribute in @ni->mrec, not any extent inode in case if @ni is base + * file record. + */ + if (!ntfs_attr_find(type, name, name_len, CASE_SENSITIVE, val, size, + ctx)) { err = EEXIST; Dprintf("%s(): Attribute already present.\n", __FUNCTION__); goto put_err_out; @@ -2679,11 +2684,16 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, } /* Locate place where record should be. */ - ctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); + ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) return -1; - if (!ntfs_attr_lookup(type, name, name_len, CASE_SENSITIVE, - lowest_vcn, NULL, 0, ctx)) { + /* + * Use ntfs_attr_find instead of ntfs_attr_lookup to find place for + * attribute in @ni->mrec, not any extent inode in case if @ni is base + * file record. + */ + if (!ntfs_attr_find(type, name, name_len, CASE_SENSITIVE, NULL, 0, + ctx)) { err = EEXIST; Dprintf("%s(): Attribute already present.\n", __FUNCTION__); goto put_err_out; @@ -3342,7 +3352,7 @@ int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) /* Find place in MFT record where attribute will be moved. */ a = ctx->attr; - nctx = ntfs_attr_get_search_ctx(NULL, ni->mrec); + nctx = ntfs_attr_get_search_ctx(ni, NULL); if (!nctx) { err = errno; Dprintf("%s(): Couldn't obtain search context.\n", @@ -3350,9 +3360,14 @@ int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) errno = err; return -1; } + /* + * Use ntfs_attr_find instead of ntfs_attr_lookup to find place for + * attribute in @ni->mrec, not any extent inode in case if @ni is base + * file record. + */ if (!ntfs_attr_lookup(a->type, (ntfschar*)((u8*)a + le16_to_cpu( - a->name_offset)), a->name_length, CASE_SENSITIVE, - 0, NULL, 0, nctx)) { + a->name_offset)), a->name_length, CASE_SENSITIVE, NULL, + 0, nctx)) { Dprintf("%s(): Attribute of such type, with same name already " "present in this MFT record.\n", __FUNCTION__); err = EEXIST; @@ -3455,6 +3470,11 @@ int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx, int extra) le32_to_cpu(ctx->attr->length) + extra) continue; + /* + * ntfs_attr_record_move_to can fail if extent with other lowest + * VCN already present in inode we trying move record to. So, + * do not return error. + */ if (!ntfs_attr_record_move_to(ctx, ni)) return 0; } From 519d68eb530e7ebc4f61fdbde3d78b820dbf70c9 Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 30 Sep 2005 16:58:20 +0000 Subject: [PATCH 2543/2994] remove some junk --- ntfsprogs/utils.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 76ca7dce..3aaa11bf 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -77,11 +77,6 @@ extern DEC_PRINTF(Eprintf) extern DEC_PRINTF(Vprintf) extern DEC_PRINTF(Qprintf) -struct _IO_FILE; - -int ntfs_printf (struct _IO_FILE *stream, int *control, BOOL trigger, - const char *format, ...) __attribute__ ((format (printf, 4, 5))); - int utils_valid_device (const char *name, int force); int utils_set_locale (void); ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force); From dff50dc5ba11fe14369bc4c76a7bddc7cb8a057d Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 30 Sep 2005 18:57:00 +0000 Subject: [PATCH 2544/2994] oops, forgot one s/_lookup/_find --- libntfs/attrib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 7bc442c8..7dc79568 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -3365,7 +3365,7 @@ int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) * attribute in @ni->mrec, not any extent inode in case if @ni is base * file record. */ - if (!ntfs_attr_lookup(a->type, (ntfschar*)((u8*)a + le16_to_cpu( + if (!ntfs_attr_find(a->type, (ntfschar*)((u8*)a + le16_to_cpu( a->name_offset)), a->name_length, CASE_SENSITIVE, NULL, 0, nctx)) { Dprintf("%s(): Attribute of such type, with same name already " From 813354f56d24c18e33fcc8775dbaa9bb25f08530 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 30 Sep 2005 19:24:13 +0000 Subject: [PATCH 2545/2994] Add missing options to mkntfs' getopt() parsing string. (What a silly bug!) Fix a compile warning in ntfscmp. --- ntfsprogs/mkntfs.c | 10 +++++----- ntfsprogs/ntfscmp.c | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 4097a1b4..ab32a1fc 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -169,8 +169,8 @@ ntfs_volume *vol; char *dev_name; struct { - long long part_start_sect; /* start sector of partition on parent - device */ + long long part_start_sect; /* -p, start sector of partition on + parent device */ long long nr_sectors; /* size of device in sectors */ long long nr_clusters; /* Note: Win2k treats clusters as 32-bit entities! */ @@ -198,9 +198,9 @@ struct { u32 upcase_len; /* Determined automatically. */ int sector_size; /* -s, in bytes, power of 2, default is 512 bytes. */ - int sectors_per_track; /* number of sectors per track on + int sectors_per_track; /* -S, number of sectors per track on device */ - int heads; /* number of heads on device */ + int heads; /* -H, number of heads on device */ int quiet; /* -q, quiet execution. */ int verbose; /* -v, verbose execution, given twice, * really verbose execution (debug @@ -357,7 +357,7 @@ static void parse_options(int argc, char *argv[]) if (argc && *argv) EXEC_NAME = *argv; fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); - while ((c = getopt(argc, argv, "c:fh?np:qs:vz:CFTIL:QVl")) != EOF) + while ((c = getopt(argc, argv, "c:fH:h?np:qS:s:vz:CFTIL:QVl")) != EOF) switch (c) { case 'n': opts.no_action = 1; diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index 72580d7f..2ada65e4 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -122,6 +122,7 @@ static int err_exit(const char *fmt, ...) exit(1); } +#ifdef DEBUG /** * perr_exit * @@ -144,6 +145,7 @@ static int perr_exit(const char *fmt, ...) fflush(stderr); exit(1); } +#endif /* DEBUG */ /** * usage - Print a list of the parameters to the program From b24f640e24296757fc4f63e5302e4578ac9e78fb Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 30 Sep 2005 19:25:41 +0000 Subject: [PATCH 2546/2994] Update. --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6b58971c..7711e9d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -68,6 +68,9 @@ xx/xx/2005 - 1.12.0-WIP testing, etc. (Szaka) - ntfsresize, ntfsclone: accept incorrect $Bitmap size if it covers the entire volume. (Szaka) + - mkntfs: Fix silly bug where I forgot to add the "H:S:p:" string to + the getopt() parsing string for those options. Cannot be used very + often if people only now noticed! 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. From 3c3507c4a3aa7c96111a3d8832b671ac98b65d77 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 30 Sep 2005 19:26:06 +0000 Subject: [PATCH 2547/2994] Fix the update. --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7711e9d7..02fac07d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -70,7 +70,7 @@ xx/xx/2005 - 1.12.0-WIP the entire volume. (Szaka) - mkntfs: Fix silly bug where I forgot to add the "H:S:p:" string to the getopt() parsing string for those options. Cannot be used very - often if people only now noticed! + often if people only now noticed! (Anton) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. From d07aab11f5723822287307a6ca758622a7138a8d Mon Sep 17 00:00:00 2001 From: szaka Date: Fri, 30 Sep 2005 19:46:45 +0000 Subject: [PATCH 2548/2994] Update unclean_journal_msg --- ntfsprogs/ntfsresize.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 6c16efe0..f0f9b6fd 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -100,9 +100,9 @@ static const char *hibernated_volume_msg = "turned off properly, thus resizing will be possible later on.\n"; static const char *unclean_journal_msg = -"Apparently the NTFS journal file is unclean. Please shutdown Windows\n" -"properly before using this software. If it wouldn't help then please\n" -"report it to linux-ntfs-dev@lists.sf.net. Thank you.\n"; +"The NTFS journal file is unclean. Please shutdown Windows properly before\n" +"using this software! Note, if you have run chkdsk previously then boot\n" +"Windows again which will automatically initialize the journal correctly.\n"; static const char *bad_sectors_warning_msg = "****************************************************************************\n" From 39403911a4ba691933b3baba530b164e52b03949 Mon Sep 17 00:00:00 2001 From: szaka Date: Fri, 30 Sep 2005 19:51:12 +0000 Subject: [PATCH 2549/2994] Clarify --force usage --- ntfsprogs/utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 4218fb3d..bea72797 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -133,7 +133,7 @@ int utils_valid_device (const char *name, int force) if (!S_ISBLK (st.st_mode)) { Vprintf ("%s is not a block device.\n", name); if (!force) { - Eprintf ("Use the force option to work with files.\n"); + Eprintf ("Use the --force option to work with files.\n"); return 0; } Vprintf ("Forced to continue.\n"); @@ -143,14 +143,14 @@ int utils_valid_device (const char *name, int force) if (ntfs_check_if_mounted (name, &mnt_flags)) { Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); if (!force) { - Eprintf ("Use the force option to ignore this error.\n"); + Eprintf ("Use the --force option to ignore this error.\n"); return 0; } Vprintf ("Forced to continue.\n"); } else if (mnt_flags & NTFS_MF_MOUNTED) { Vprintf ("The device %s, is mounted.\n", name); if (!force) { - Eprintf ("Use the force option to work a mounted filesystem.\n"); + Eprintf ("Use the --force option to work a mounted filesystem.\n"); return 0; } Vprintf ("Forced to continue.\n"); From 54891f3112d8a76cd834ff5cbabfeff0bcfa1820 Mon Sep 17 00:00:00 2001 From: szaka Date: Fri, 30 Sep 2005 20:29:58 +0000 Subject: [PATCH 2550/2994] Emphasize Windows needs to be rebooted twice after chkdsk /f --- ntfsprogs/ntfsclone.c | 2 +- ntfsprogs/ntfsresize.c | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index bce0403b..5dfe86b5 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -903,7 +903,7 @@ done: } err_exit("Filesystem check failed! Windows wasn't shutdown " "properly or inconsistent\nfilesystem. Please run " - "chkdsk on Windows.\n"); + "chkdsk /f on Windows then reboot it TWICE.\n"); } } diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index f0f9b6fd..c2318b90 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -84,20 +84,19 @@ static const char *resize_important_msg = "can recover the partition table by TestDisk or Parted's rescue mode.\n"; static const char *invalid_ntfs_msg = -"Apparently device '%s' doesn't have a valid NTFS.\n" +"The device '%s' doesn't have a valid NTFS.\n" "Maybe you selected the wrong partition? Or the whole disk instead of a\n" "partition (e.g. /dev/hda, not /dev/hda1)? This error might also occur\n" "if the disk was incorrectly repartitioned (see the ntfsresize FAQ).\n"; static const char *corrupt_volume_msg = -"Apparently you have a corrupted NTFS. Please run the filesystem checker\n" -"on Windows by invoking chkdsk /f. Don't forget the /f (force) parameter,\n" -"it's important! You probably also need to reboot Windows to take effect.\n" -"Then you can try ntfsresize again. No modification was made to your NTFS.\n"; +"This software has detected that your NTFS is corrupted. Please run chkdsk /f\n" +"on Windows then reboot it TWICE! Important, don't forget the /f parameter!\n" +"Afterwards you can run ntfsresize. No modification was made to NTFS.\n"; static const char *hibernated_volume_msg = -"Apparently the NTFS partition is hibernated. Windows must be resumed and\n" -"turned off properly, thus resizing will be possible later on.\n"; +"The NTFS partition is hibernated. Windows must be resumed and turned off\n" +"properly, so resizing could be done safely.\n"; static const char *unclean_journal_msg = "The NTFS journal file is unclean. Please shutdown Windows properly before\n" @@ -110,8 +109,8 @@ static const char *bad_sectors_warning_msg = "* surface caused by deterioration, manufacturing faults or other reason. *\n" "* The reliability of the disk may stay stable or degrade fast. We suggest *\n" "* making a full backup urgently by running 'ntfsclone --rescue ...' then *\n" -"* run 'chkdsk /f /r volume:' on Windows then you should be able to resize *\n" -"* safely by additionally using the --bad-sectors option to ntfsresize. *\n" +"* run 'chkdsk /f /r' on Windows and rebooot it TWICE! Then you can resize *\n" +"* NTFS safely by additionally using the --bad-sectors option of ntfsresize.*\n" "****************************************************************************\n"; struct { From 75668af15eab2e2cb94f50ea8d0bd748636a4007 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 1 Oct 2005 00:34:53 +0000 Subject: [PATCH 2551/2994] last optimizations to ntfs_delete was incorrect, revert it --- libntfs/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/dir.c b/libntfs/dir.c index 4f55c565..f0f54c3d 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1302,6 +1302,7 @@ search: ni->vol->upcase, ni->vol->upcase_len)) { if (fn->file_name_type == FILE_NAME_WIN32) { looking_for_dos_name = TRUE; + ntfs_attr_reinit_search_ctx(actx); continue; } if (fn->file_name_type == FILE_NAME_DOS) From f292546aedd445094b816fff6f0ec5035fbf098b Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 1 Oct 2005 00:42:11 +0000 Subject: [PATCH 2552/2994] EPERM is returned if windows was hibernated --- ntfsprogs/utils.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index bea72797..32005bc2 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -181,11 +181,14 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL err = errno; Eprintf("Couldn't mount device '%s': %s\n", device, strerror(err)); - if (err == EOPNOTSUPP) - Eprintf("Windows was either hibernated or did not " - "shut down properly. Try to mount " - "volume in windows, shut down and try " + if (err == EPERM) + Eprintf("Windows was hibernated. Try to mount volume " + "in windows, shut down and try " "again.\n"); + if (err == EOPNOTSUPP) + Eprintf("Windows did not shut down properly. Try to " + "mount volume in windows, shut down " + "and try again.\n"); return NULL; } From 96f31a07ed06153d7cb4823098fcc53b13793216 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 3 Oct 2005 19:48:54 +0000 Subject: [PATCH 2553/2994] Add locale options to ntfsmount. --- ntfsprogs/ntfsmount.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 3a73fcd6..87a2601b 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1306,6 +1306,14 @@ static char *parse_mount_options(char *org_options, char **device) goto err_exit; } ctx->force = TRUE; + } else if (!strcmp(opt, "locale")) { + if (!val) { + Eprintf("'locale' option should have value.\n"); + goto err_exit; + } + if (!setlocale(LC_ALL, val)) + Eprintf("Failed to set locale to %s. " + "Continue anyway.\n", val); } else { /* Probably FUSE option. */ strcat(ret, opt); if (val) { @@ -1340,7 +1348,8 @@ static void usage(void) Eprintf("Possible options are:\n\tdefault_permissions\n\tallow_other\n" "\tkernel_cache\n\tlarge_read\n\tdirect_io\n\tmax_read\n\t" "force\n\tro\n\tno_def_opts\n\tumask\n\tfmask\n\tdmask\n\t" - "uid\n\tgid\n\tshow_sys_files\n\tsucceed_chmod\n\tdev\n\n"); + "uid\n\tgid\n\tshow_sys_files\n\tsucceed_chmod\n\tdev\n\t" + "locale\n\n"); Eprintf("Default options are: \"%s\".\n", def_opts); } From cc9bc93221a1b53b5b9387987be837095dda4ce4 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 3 Oct 2005 21:07:24 +0000 Subject: [PATCH 2554/2994] * change interface: ntfsmount device mnt_point -o opts * hardlink ntfsmount to /sbin/mount.ntfs-fuse, thus volume can be mounted via fstab without any helpers * update man page for ntfsmount --- ntfsprogs/Makefile.am | 5 ++- ntfsprogs/ntfsmount.8.in | 28 +++++++----- ntfsprogs/ntfsmount.c | 92 +++++++++++++++++++--------------------- 3 files changed, 65 insertions(+), 60 deletions(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index fc2d5da7..6f5950e2 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -139,10 +139,11 @@ extra: extras extras: libs $(EXTRA_PROGRAMS) -# mkfs.ntfs[.8] hard links +# mkfs.ntfs[.8] and mount.ntfs-fuse hard links install-exec-hook: $(LN) -f $(DESTDIR)$(sbindir)/mkntfs $(DESTDIR)$(sbindir)/mkfs.ntfs + $(LN) -f $(DESTDIR)$(bindir)/ntfsmount /sbin/mount.ntfs-fuse install-data-hook: $(LN) -f $(DESTDIR)$(man8dir)/mkntfs.8 $(DESTDIR)$(man8dir)/mkfs.ntfs.8 @@ -150,4 +151,4 @@ install-data-hook: uninstall-local: rm -f $(DESTDIR)$(sbindir)/mkfs.ntfs rm -f $(DESTDIR)$(man8dir)/mkfs.ntfs.8 - + rm -f /sbin/mount.ntfs-fuse diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 14431a46..cddc19a2 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -2,11 +2,11 @@ .\" Copyright (c) 2005 Yura Pakhuchiy. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSMOUNT 8 "September 2005" "ntfsprogs version @VERSION@" +.TH NTFSMOUNT 8 "October 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsmount \- NTFS module for FUSE. .SH SYNOPSIS -.BI "ntfsmount " mount_point " \-o " device "[," other_options "]" +.BI "ntfsmount " device " " mount_point " [\-o " options "]" .SH DESCRIPTION .B ntfsmount is a @@ -129,7 +129,7 @@ The default is infinite. Note that the size of read requests is limited anyway to 32 pages (which is 128kbyte on i386). .TP -.B force= +.B force Force mount even if errors occured. Use this option only if you know what are you doing and don't cry about data loss. @@ -147,8 +147,9 @@ this option cancel this behaviour. Don't change any permissions and don't return error on chmod operation. .TP -.B dev= -Mount this device. +.B locale= +You can set locale with this option. It's useful if locale enviroment variables +are not set before partitions from /etc/fstab had been mounted. .SH DATA STREAMS All data on NTFS is stored in streams, which can have names. @@ -171,18 +172,25 @@ attribute. NOTE: The last feauture is unique for NTFS FUSE module and maybe will be never supported by kernel driver. .SH EXAMPLES -Mount /dev/hda1 to /mnt/ntfs-fuse using NTFS FUSE module: +Mount /dev/hda1 to /mnt/ntfs-fuse using ntfsmount: .RS .sp -.B ntfsmount /mnt/ntfs-fuse -o dev=/dev/hda1 +.B ntfsmount /dev/hda1 /mnt/ntfs-fuse .sp .RE -Read-only mount /dev/hda5 to /home/user/tmp and make root to be owner of all -files: +Read-only mount /dev/hda5 to /home/user/mnt and make user with uid 1000 to be +owner of all files: .RS .sp -.B ntfsmount /home/user/tmp -o dev=/dev/hda5,ro,uid=0 +.B ntfsmount /dev/hda5 /home/user/mnt -o ro,uid=1000 +.sp +.RE + +/etc/fstab entry for above: +.RS +.sp +.B /dev/hda5 /home/user/mnt ntfs-fuse ro,uid=1000 0 0 .sp .RE diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 87a2601b..ce5afb91 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -99,6 +99,7 @@ typedef enum { static struct options { char *mnt_point; /* Mount point */ char *options; /* Mount options */ + char *device; /* Device to mount */ int quiet; /* Less output */ int verbose; /* Extra output */ } opts; @@ -1180,19 +1181,18 @@ static void signal_handler(int arg __attribute__((unused))) fuse_exit((fuse_get_context())->fuse); } -static char *parse_mount_options(char *org_options, char **device) +static char *parse_mount_options(const char *org_options) { char *options, *s, *opt, *val, *ret; BOOL no_def_opts = FALSE; - *device = NULL; /* - * +3 for different in length of "fsname=..." and "dev=...". + * +7 for "fsname=". * +1 for comma. * +1 for null-terminator. - * +PATH_MAX for resolved by realpath() device name + * +PATH_MAX for resolved by realpath() device name. */ - ret = malloc(strlen(def_opts) + strlen(org_options) + 5 + PATH_MAX); + ret = malloc(strlen(def_opts) + strlen(org_options) + 9 + PATH_MAX); if (!ret) { perror("malloc failed"); return NULL; @@ -1206,25 +1206,7 @@ static char *parse_mount_options(char *org_options, char **device) s = options; while ((val = strsep(&s, ","))) { opt = strsep(&val, "="); - if (!strcmp(opt, "dev")) { /* Device to mount. */ - if (!val) { - Eprintf("'dev' option should have value.\n"); - goto err_exit; - } - *device = malloc(PATH_MAX + 1); - if (!*device) - goto err_exit; - /* We don't want relative path in /etc/mtab. */ - if (val[0] != '/') { - if (!realpath(val, *device)) { - perror(""); - free(*device); - *device = NULL; - goto err_exit; - } - } else - strcpy(*device, val); - } else if (!strcmp(opt, "ro")) { /* Read-only mount. */ + if (!strcmp(opt, "ro")) { /* Read-only mount. */ if (val) { Eprintf("'ro' option should not have value.\n"); goto err_exit; @@ -1323,12 +1305,10 @@ static char *parse_mount_options(char *org_options, char **device) strcat(ret, ","); } } - if (!*device) - goto err_exit; if (!no_def_opts) strcat(ret, def_opts); strcat(ret, "fsname="); - strcat(ret, *device); + strcat(ret, opts.device); exit: free(options); return ret; @@ -1343,13 +1323,12 @@ static void usage(void) Eprintf("\n%s v%s - NTFS module for FUSE.\n\n", EXEC_NAME, VERSION); Eprintf("Copyright (c) 2005 Yura Pakhuchiy\n\n"); - Eprintf("usage: %s mount_point -o dev=device[,other_options]\n\n", + Eprintf("usage: %s device mount_point [-o options]\n\n", EXEC_NAME); Eprintf("Possible options are:\n\tdefault_permissions\n\tallow_other\n" "\tkernel_cache\n\tlarge_read\n\tdirect_io\n\tmax_read\n\t" "force\n\tro\n\tno_def_opts\n\tumask\n\tfmask\n\tdmask\n\t" - "uid\n\tgid\n\tshow_sys_files\n\tsucceed_chmod\n\tdev\n\t" - "locale\n\n"); + "uid\n\tgid\n\tshow_sys_files\n\tsucceed_chmod\n\tlocale\n\n"); Eprintf("Default options are: \"%s\".\n", def_opts); } @@ -1380,15 +1359,36 @@ static int parse_options(int argc, char *argv[]) opts.mnt_point = NULL; opts.options = NULL; + opts.device = NULL; while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ - if (!opts.mnt_point) + if (!opts.device) { + opts.device = malloc(PATH_MAX + 1); + if (!opts.device) { + perror("malloc"); + err++; + break; + } + /* We don't want relative path in /etc/mtab. */ + if (argv[optind - 1][0] != '/') { + if (!realpath(argv[optind - 1], + opts.device)) { + perror("realpath"); + free(opts.device); + opts.device = NULL; + err++; + break; + } + } else + strcpy(opts.device, argv[optind - 1]); + } else if (!opts.mnt_point) opts.mnt_point = argv[optind - 1]; else { - Eprintf("You must specify exactly one " - "mount point.\n"); + Eprintf("You must specify exactly one device " + "and exactly one mount " + "point.\n"); err++; } break; @@ -1412,7 +1412,7 @@ static int parse_options(int argc, char *argv[]) opts.verbose++; break; default: - Eprintf("Unknown option '%s'.\n", argv[optind-1]); + Eprintf("Unknown option '%s'.\n", argv[optind - 1]); err++; break; } @@ -1421,9 +1421,8 @@ static int parse_options(int argc, char *argv[]) if (help) { opts.quiet = 0; } else { - if (!opts.options) { - Eprintf("No mount options passed, but 'dev' option is " - "mandatory.\n"); + if (!opts.device) { + Eprintf("No mount point specified.\n"); err++; } @@ -1448,7 +1447,7 @@ static int parse_options(int argc, char *argv[]) int main(int argc, char *argv[]) { - char *parsed_options, *device; + char *parsed_options; struct fuse *fh; int ffd; @@ -1461,25 +1460,22 @@ int main(int argc, char *argv[]) ntfs_fuse_init(); /* Parse options. */ - parsed_options = parse_mount_options(opts.options, &device); - if (!device) { - Eprintf("'dev' option is mandatory.\n"); - ntfs_fuse_destroy(); - return 2; - } + parsed_options = parse_mount_options((opts.options) ? + opts.options : ""); if (!parsed_options) { - free(device); + if (opts.device) + free(opts.device); ntfs_fuse_destroy(); return 3; } /* Mount volume. */ - if (ntfs_fuse_mount(device)) { - free(device); + if (ntfs_fuse_mount(opts.device)) { ntfs_fuse_destroy(); + free(opts.device); return 4; } - free(device); + free(opts.device); /* Create filesystem. */ ffd = fuse_mount(opts.mnt_point, parsed_options); if (ffd == -1) { From e0dd52faae20819081d8500e3952c76d81f21ac3 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 3 Oct 2005 21:11:25 +0000 Subject: [PATCH 2555/2994] update changelog --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 02fac07d..4aadf2f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -71,6 +71,10 @@ xx/xx/2005 - 1.12.0-WIP - mkntfs: Fix silly bug where I forgot to add the "H:S:p:" string to the getopt() parsing string for those options. Cannot be used very often if people only now noticed! (Anton) + - ntfsmount: Add 'locale' option. (Yura) + - ntfsmount: Change interface to 'ntfsmount device mount_point'. (Yura) + - Hardlink ntfsmount to /sbin/mount.ntfs-fuse, thus it possible mounting + from fstab by specifying ntfs-fuse filesystem type. (Yura) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. From fa46de6b6f7e4a20af213f08e61b5e8544b4d634 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 4 Oct 2005 20:00:22 +0000 Subject: [PATCH 2556/2994] accept noauto mount option for better support mounting via fstab --- ntfsprogs/ntfsmount.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index ce5afb91..e6c5f482 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1296,6 +1296,8 @@ static char *parse_mount_options(const char *org_options) if (!setlocale(LC_ALL, val)) Eprintf("Failed to set locale to %s. " "Continue anyway.\n", val); + } else if (!strcmp(opt, "noauto")) { + /* Don't pass noauto option to fuse. */ } else { /* Probably FUSE option. */ strcat(ret, opt); if (val) { From 62579b84d4a0c3eaa89936979b606d686de32f25 Mon Sep 17 00:00:00 2001 From: uvman Date: Tue, 4 Oct 2005 20:36:42 +0000 Subject: [PATCH 2557/2994] compiler warnings fixes. --- ntfsprogs/ntfsclone.c | 2 +- ntfsprogs/ntfscmp.c | 4 ++-- ntfsprogs/ntfsfix.c | 2 +- ntfsprogs/ntfsinfo.c | 8 ++++---- ntfsprogs/ntfsresize.c | 18 +++++++++--------- ntfsprogs/ntfsundelete.c | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 5dfe86b5..6746b748 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -523,7 +523,7 @@ static void copy_cluster(int rescue, u64 rescue_lcn) for (i = 0; i < csize; i += NTFS_SECTOR_SIZE) rescue_sector(fd, rescue_pos + i, buff + i); } else { - Printf(bad_sectors_warning_msg); + Printf("%s", bad_sectors_warning_msg); err_exit("Disk is faulty, can't make full backup!"); } } diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index 2ada65e4..c915b3b6 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -768,9 +768,9 @@ static ntfs_volume *mount_volume(const char *volume) if (err == EINVAL) printf(invalid_ntfs_msg, volume); else if (err == EIO) - printf(corrupt_volume_msg); + puts(corrupt_volume_msg); else if (err == EPERM) - printf(hibernated_volume_msg); + puts(hibernated_volume_msg); exit(1); } diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 835b07d1..c50377bb 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -93,9 +93,9 @@ struct { char *volume; } opt; +static int usage(void) __attribute__((noreturn)); static int usage(void) { - printf("%s v%s\n" "\n" "Usage: %s [options] device\n" diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index f1ada6ce..76af75f0 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -475,7 +475,7 @@ static void ntfs_dump_flags(ATTR_TYPES type, u32 flags) static void ntfs_dump_namespace(u8 file_name_type) { - const char *mbs_file_type = NULL; + const char *mbs_file_type; /* name space */ switch (file_name_type) { @@ -491,9 +491,9 @@ static void ntfs_dump_namespace(u8 file_name_type) case FILE_NAME_WIN32_AND_DOS: mbs_file_type = "Win32 & DOS"; break; + default: + mbs_file_type = "(unknown)"; } - if (mbs_file_type == NULL) /* should never happen */ - mbs_file_type = "(unknown)"; printf("\tNamespace:\t\t %s\n", mbs_file_type); } @@ -982,7 +982,7 @@ static void ntfs_dump_attr_volume_information(ATTR_RECORD *attr) printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); - printf("\tVolume Version:\t %d.%d\n", vol_information->major_ver, + printf("\tVolume Version:\t\t %d.%d\n", vol_information->major_ver, vol_information->minor_ver); printf("\tFlags:\t\t\t "); if (vol_information->flags & VOLUME_IS_DIRTY) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index c2318b90..c50cf231 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -821,7 +821,7 @@ static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfsck_t *fsck) int err = errno; perr_printf("ntfs_decompress_mapping_pairs"); if (err == EIO) - printf(corrupt_volume_msg); + puts(corrupt_volume_msg); exit(1); } @@ -972,7 +972,7 @@ done: if (mismatch) { err_printf("Filesystem check failed! Totally %d cluster " "accounting mismatches.\n", mismatch); - printf(corrupt_volume_msg); + puts(corrupt_volume_msg); exit(1); } } @@ -2212,11 +2212,11 @@ static ntfs_volume *mount_volume(void) if (err == EINVAL) printf(invalid_ntfs_msg, opt.volume); else if (err == EIO) - printf(corrupt_volume_msg); + puts(corrupt_volume_msg); else if (err == EPERM) - printf(hibernated_volume_msg); + puts(hibernated_volume_msg); else if (err == EOPNOTSUPP) - printf(unclean_journal_msg); + puts(unclean_journal_msg); exit(1); } @@ -2294,7 +2294,7 @@ static void check_resize_constraints(ntfs_resize_t *resize) resize->badclusters, resize->badclusters - 1 ? "s" : ""); if (!opt.badsectors) { - printf(bad_sectors_warning_msg); + puts(bad_sectors_warning_msg); exit(1); } } @@ -2398,7 +2398,7 @@ int main(int argc, char **argv) if (fsck.multi_ref) err_printf("%d clusters are referenced multiply" " times.\n", fsck.multi_ref); - printf(corrupt_volume_msg); + puts(corrupt_volume_msg); exit(1); } compare_bitmaps(vol, &fsck.lcn_bitmap); @@ -2427,7 +2427,7 @@ int main(int argc, char **argv) } if (opt.force-- <= 0 && !opt.ro_flag) { - printf(resize_warning_msg); + puts(resize_warning_msg); proceed_question(); } @@ -2456,7 +2456,7 @@ int main(int argc, char **argv) printf("Successfully resized NTFS on device '%s'.\n", vol->dev->d_name); if (resize.shrink) - printf(resize_important_msg); + puts(resize_important_msg); return 0; } diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index acc12661..1a5164cf 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -1274,7 +1274,7 @@ static void dump_record (struct ufile *file) if (!(f->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_DIRECTORY | FILE_ATTR_SPARSE_FILE | FILE_ATTR_REPARSE_POINT | FILE_ATTR_COMPRESSED | FILE_ATTR_ENCRYPTED))) { - Qprintf (NONE); + Qprintf ("%s", NONE); } Qprintf ("\n"); From ecc920583e92331ceb7fb81d2bb3d7c3b192bf16 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 4 Oct 2005 21:42:07 +0000 Subject: [PATCH 2558/2994] revert utils.c revision 1.46, because it breaks ntfsmount output --- ntfsprogs/utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 32005bc2..4c558f5d 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -133,7 +133,7 @@ int utils_valid_device (const char *name, int force) if (!S_ISBLK (st.st_mode)) { Vprintf ("%s is not a block device.\n", name); if (!force) { - Eprintf ("Use the --force option to work with files.\n"); + Eprintf ("Use the force option to work with files.\n"); return 0; } Vprintf ("Forced to continue.\n"); @@ -143,14 +143,14 @@ int utils_valid_device (const char *name, int force) if (ntfs_check_if_mounted (name, &mnt_flags)) { Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); if (!force) { - Eprintf ("Use the --force option to ignore this error.\n"); + Eprintf ("Use the force option to ignore this error.\n"); return 0; } Vprintf ("Forced to continue.\n"); } else if (mnt_flags & NTFS_MF_MOUNTED) { Vprintf ("The device %s, is mounted.\n", name); if (!force) { - Eprintf ("Use the --force option to work a mounted filesystem.\n"); + Eprintf ("Use the force option to work a mounted filesystem.\n"); return 0; } Vprintf ("Forced to continue.\n"); From 4f74c309840fb59b9d44bdbc65dafe1c2963a14c Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 4 Oct 2005 22:03:13 +0000 Subject: [PATCH 2559/2994] Revert to the original output but by also fixing the "format string" warnings --- ntfsprogs/ntfsresize.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index c50cf231..907a0499 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -821,7 +821,7 @@ static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfsck_t *fsck) int err = errno; perr_printf("ntfs_decompress_mapping_pairs"); if (err == EIO) - puts(corrupt_volume_msg); + printf("%s", corrupt_volume_msg); exit(1); } @@ -972,7 +972,7 @@ done: if (mismatch) { err_printf("Filesystem check failed! Totally %d cluster " "accounting mismatches.\n", mismatch); - puts(corrupt_volume_msg); + printf("%s", corrupt_volume_msg); exit(1); } } @@ -2212,11 +2212,11 @@ static ntfs_volume *mount_volume(void) if (err == EINVAL) printf(invalid_ntfs_msg, opt.volume); else if (err == EIO) - puts(corrupt_volume_msg); + printf("%s", corrupt_volume_msg); else if (err == EPERM) - puts(hibernated_volume_msg); + printf("%s", hibernated_volume_msg); else if (err == EOPNOTSUPP) - puts(unclean_journal_msg); + printf("%s", unclean_journal_msg); exit(1); } @@ -2294,7 +2294,7 @@ static void check_resize_constraints(ntfs_resize_t *resize) resize->badclusters, resize->badclusters - 1 ? "s" : ""); if (!opt.badsectors) { - puts(bad_sectors_warning_msg); + printf("%s", bad_sectors_warning_msg); exit(1); } } @@ -2398,7 +2398,7 @@ int main(int argc, char **argv) if (fsck.multi_ref) err_printf("%d clusters are referenced multiply" " times.\n", fsck.multi_ref); - puts(corrupt_volume_msg); + printf("%s", corrupt_volume_msg); exit(1); } compare_bitmaps(vol, &fsck.lcn_bitmap); @@ -2427,7 +2427,7 @@ int main(int argc, char **argv) } if (opt.force-- <= 0 && !opt.ro_flag) { - puts(resize_warning_msg); + printf("%s", resize_warning_msg); proceed_question(); } @@ -2456,7 +2456,7 @@ int main(int argc, char **argv) printf("Successfully resized NTFS on device '%s'.\n", vol->dev->d_name); if (resize.shrink) - puts(resize_important_msg); + printf("%s", resize_important_msg); return 0; } From ce52b49c3628a201af617a50180a0f1718e69f28 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 5 Oct 2005 11:14:30 +0000 Subject: [PATCH 2560/2994] Minor man pages updates --- ntfsprogs/ntfscp.8.in | 10 +++------- ntfsprogs/ntfsmount.8.in | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in index b709c989..ac64c207 100644 --- a/ntfsprogs/ntfscp.8.in +++ b/ntfsprogs/ntfscp.8.in @@ -1,16 +1,12 @@ .\" -*- nroff -*- -.\" Copyright (c) 2004 Yura Pakhuchiy. All Rights Reserved. +.\" Copyright (c) 2004-2005 Yura Pakhuchiy. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCP 8 "June 2005" "ntfsprogs version @VERSION@" +.TH NTFSCP 8 "October 2005" "ntfsprogs version @VERSION@" .SH NAME ntfscp \- overwrite file on an NTFS volume. .SH SYNOPSIS -.B ntfscp -[ -.I options -] -.B device source_file destination +.BI "ntfscp [" options "] device source_file destination" .SH DESCRIPTION .B ntfscp will overwrite file on an NTFS volume. At present diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index cddc19a2..2a1cc713 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -17,7 +17,7 @@ You need .B FUSE to compile it, .B xattr -is also highly recommended. +is recommended, but not mandatory. .sp .TP .B Fully implemented ntfsmount features are: From aa7e3cc98ee930091403304484868112b0158bad Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 5 Oct 2005 13:01:10 +0000 Subject: [PATCH 2561/2994] return volume set dirty functionality to ntfsfix on Yura's request. Anton --- ChangeLog | 1 - ntfsprogs/ntfsfix.c | 132 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 131 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4aadf2f7..ec98b1a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -55,7 +55,6 @@ xx/xx/2005 - 1.12.0-WIP set a flag, it overwrites the flags! Rename it to ntfs_volume_write_flags() and clean it up a lot. Update all callers. (Anton) - - Change ntfsfix to no longer set the volume dirty. (Anton) - Change everything to supply an ntfs_inode and NULL for mft record when calling ntfs_attr_get_search_ctx() except a very few cases which genuinely need this functionality as they work on a too low level. diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index c50377bb..bacafdb3 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -1,7 +1,7 @@ /** * NtfsFix - Part of the Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov. + * Copyright (c) 2000-2005 Anton Altaparmakov. * * This utility will attempt to fix a partition that has been damaged by the * current Linux-NTFS driver. It should be run after dismounting an NTFS @@ -87,6 +87,7 @@ GEN_PRINTF(Qprintf, stdout, NULL, FALSE) static const char *EXEC_NAME = "ntfsfix"; static const char *OK = "OK"; static const char *FAILED = "FAILED"; +static BOOL vol_is_dirty = FALSE; static BOOL journal_is_empty = FALSE; struct { @@ -159,6 +160,128 @@ static void parse_options(int argc, char **argv) } } +static int OLD_ntfs_volume_set_flags(ntfs_volume *vol, const u16 flags) +{ + MFT_RECORD *m = NULL; + ATTR_RECORD *a; + VOLUME_INFORMATION *c; + ntfs_attr_search_ctx *ctx; + int ret = -1; /* failure */ + + if (!vol) { + errno = EINVAL; + return -1; + } + if (ntfs_file_record_read(vol, FILE_Volume, &m, NULL)) { + Dperror("Failed to read $Volume"); + return -1; + } + /* Sanity check */ + if (!(m->flags & MFT_RECORD_IN_USE)) { + Dprintf("Error: $Volume has been deleted. Cannot " + "handle this yet. Run chkdsk to fix this.\n"); + errno = EIO; + goto err_exit; + } + /* Get a pointer to the volume information attribute. */ + ctx = ntfs_attr_get_search_ctx(NULL, m); + if (!ctx) { + Dperror("Failed to allocate attribute search context"); + goto err_exit; + } + if (ntfs_attr_lookup(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, + 0, ctx)) { + Dputs("Error: Attribute $VOLUME_INFORMATION was not found in " + "$Volume!"); + goto err_out; + } + a = ctx->attr; + /* Sanity check. */ + if (a->non_resident) { + Dputs("Error: Attribute $VOLUME_INFORMATION must be resident " + "(and it isn't)!"); + errno = EIO; + goto err_out; + } + /* Get a pointer to the value of the attribute. */ + c = (VOLUME_INFORMATION*)(le16_to_cpu(a->value_offset) + (char*)a); + /* Sanity checks. */ + if ((char*)c + le32_to_cpu(a->value_length) > + le16_to_cpu(m->bytes_in_use) + (char*)m || + le16_to_cpu(a->value_offset) + + le32_to_cpu(a->value_length) > le32_to_cpu(a->length)) { + Dputs("Error: Attribute $VOLUME_INFORMATION in $Volume is " + "corrupt!"); + errno = EIO; + goto err_out; + } + /* Set the volume flags. */ + vol->flags = c->flags = cpu_to_le16(flags); + if (ntfs_mft_record_write(vol, FILE_Volume, m)) { + Dperror("Error writing $Volume"); + goto err_out; + } + ret = 0; /* success */ +err_out: + ntfs_attr_put_search_ctx(ctx); +err_exit: + if (m) + free(m); + return ret; +} + +static int set_dirty_flag(ntfs_volume *vol) +{ + u16 flags; + + if (vol_is_dirty == TRUE) + return 0; + + printf("Setting required flags on partition... "); + /* + * Set chkdsk flag, i.e. mark the partition dirty so chkdsk will run + * and fix it for us. + */ + flags = vol->flags | VOLUME_IS_DIRTY; + /* If NTFS volume version >= 2.0 then set mounted on NT4 flag. */ + if (vol->major_ver >= 2) + flags |= VOLUME_MOUNTED_ON_NT4; + if (OLD_ntfs_volume_set_flags(vol, flags)) { + puts(FAILED); + fprintf(stderr, "Error setting volume flags.\n"); + return -1; + } + puts(OK); + vol_is_dirty = TRUE; + return 0; +} + +static int set_dirty_flag_mount(ntfs_volume *vol) +{ + u16 flags; + + if (vol_is_dirty == TRUE) + return 0; + + printf("Setting required flags on partition... "); + /* + * Set chkdsk flag, i.e. mark the partition dirty so chkdsk will run + * and fix it for us. + */ + flags = vol->flags | VOLUME_IS_DIRTY; + /* If NTFS volume version >= 2.0 then set mounted on NT4 flag. */ + if (vol->major_ver >= 2) + flags |= VOLUME_MOUNTED_ON_NT4; + if (ntfs_volume_write_flags(vol, flags)) { + puts(FAILED); + fprintf(stderr, "Error setting volume flags.\n"); + return -1; + } + puts(OK); + vol_is_dirty = TRUE; + return 0; +} + static int empty_journal(ntfs_volume *vol) { if (journal_is_empty == TRUE) @@ -336,6 +459,10 @@ int main(int argc, char **argv) printf("Processing of $MFT and $MFTMirr completed successfully.\n"); + /* FIXME: Will this fail? Probably... */ + if (set_dirty_flag(vol) < 0) + goto error_exit; + if (empty_journal(vol) < 0) goto error_exit; @@ -358,6 +485,9 @@ mount_ok: goto error_exit; } + if (set_dirty_flag_mount(vol) < 0) + goto error_exit; + if (empty_journal(vol) < 0) goto error_exit; From 8172a1a9b334199f57bbee7bebcad199079096c2 Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 5 Oct 2005 13:12:22 +0000 Subject: [PATCH 2562/2994] Add test/.cvsignore with the right things in it... --- test/.cvsignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 test/.cvsignore diff --git a/test/.cvsignore b/test/.cvsignore new file mode 100644 index 00000000..6d39d9bc --- /dev/null +++ b/test/.cvsignore @@ -0,0 +1,5 @@ +.deps +.libs +Makefile +Makefile.in +runlist From 95ab175a92cad344b278add567aa087e63459f2d Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 5 Oct 2005 13:32:39 +0000 Subject: [PATCH 2563/2994] revert manual to say that the volume is marked dirty. Anton --- ntfsprogs/ntfsfix.8.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index af5a79b4..8b828114 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -16,15 +16,16 @@ .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME -ntfsfix \- fix common errors +ntfsfix \- fix common errors and force Windows to check NTFS .SH SYNOPSIS .B ntfsfix .I device .SH DESCRIPTION \fBntfsfix\fP is a utility that fixes some common NTFS problems. \fBntfsfix\fP is \fBNOT\fP a Linux -version of chkdsk. It only repairs some fundamental NTFS inconsistencies and -resets the NTFS journal file. +version of chkdsk. It only repairs some fundamental NTFS inconsistencies, +resets the NTFS journal file and schedules an NTFS consistency check for +the first boot into Windows. .sp You may run .B ntfsfix From 81d7457fe8b4b8eae89786471c9458a743a938ac Mon Sep 17 00:00:00 2001 From: uvman Date: Wed, 5 Oct 2005 19:13:54 +0000 Subject: [PATCH 2564/2994] Add all reasonable warning flags supported by GCC 3.2+ to --enable-warnings. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d626e6e6..cda895ec 100644 --- a/configure.ac +++ b/configure.ac @@ -235,7 +235,7 @@ CFLAGS="$CFLAGS -Wall" # Add lots of extra warnings if --enable-warnings was specified. if test "$enable_warnings" = "yes"; then - CFLAGS="$CFLAGS -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare" + CFLAGS="$CFLAGS -W -Wall -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Winline -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wmultichar -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings" fi # Add debugging switches if --enable-debug was specified. From ae276bbfe14ba250320563af4f1cf10aa9bcee11 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 5 Oct 2005 20:11:23 +0000 Subject: [PATCH 2565/2994] Fix 'make install' and 'make uninstall' if FUSE isn't enabled --- ChangeLog | 2 +- ntfsprogs/Makefile.am | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ec98b1a6..f6b61f69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -73,7 +73,7 @@ xx/xx/2005 - 1.12.0-WIP - ntfsmount: Add 'locale' option. (Yura) - ntfsmount: Change interface to 'ntfsmount device mount_point'. (Yura) - Hardlink ntfsmount to /sbin/mount.ntfs-fuse, thus it possible mounting - from fstab by specifying ntfs-fuse filesystem type. (Yura) + from fstab by specifying ntfs-fuse filesystem type. (Yura, Szaka) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 6f5950e2..c69fb56e 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -143,7 +143,9 @@ extras: libs $(EXTRA_PROGRAMS) install-exec-hook: $(LN) -f $(DESTDIR)$(sbindir)/mkntfs $(DESTDIR)$(sbindir)/mkfs.ntfs +if ENABLE_FUSE_MODULE $(LN) -f $(DESTDIR)$(bindir)/ntfsmount /sbin/mount.ntfs-fuse +endif install-data-hook: $(LN) -f $(DESTDIR)$(man8dir)/mkntfs.8 $(DESTDIR)$(man8dir)/mkfs.ntfs.8 @@ -151,4 +153,6 @@ install-data-hook: uninstall-local: rm -f $(DESTDIR)$(sbindir)/mkfs.ntfs rm -f $(DESTDIR)$(man8dir)/mkfs.ntfs.8 +if ENABLE_FUSE_MODULE rm -f /sbin/mount.ntfs-fuse +endif From 31ee9de6ac57e02e2857b4122acb71b733a42716 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 7 Oct 2005 12:21:32 +0000 Subject: [PATCH 2566/2994] Fix stupid bug in mkntfs which caused it to fail even though only the backup boot sector could not be written because a 2.4 kernel is used and the partition has an odd number of sectors. (Anton) --- ChangeLog | 5 ++++- ntfsprogs/mkntfs.c | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6b61f69..4eeda9b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -xx/xx/2005 - 1.12.0-WIP +07/10/2005 - 1.12.0 - Lots of fixes and enhancements! - Add ./configure detection for gnutls library and make minimum version 1.2.3 which is the one that has the rsa key export fixed. (Anton) @@ -74,6 +74,9 @@ xx/xx/2005 - 1.12.0-WIP - ntfsmount: Change interface to 'ntfsmount device mount_point'. (Yura) - Hardlink ntfsmount to /sbin/mount.ntfs-fuse, thus it possible mounting from fstab by specifying ntfs-fuse filesystem type. (Yura, Szaka) + - Fix stupid bug in mkntfs which caused it to fail even though only the + backup boot sector could not be written because a 2.4 kernel is used + and the partition has an odd number of sectors. (Anton) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index ab32a1fc..07839d0a 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3555,13 +3555,13 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) /** * create_backup_boot_sector * - * Return 0 on success or 1 if it couldn't be created. + * Return 0 on success or -1 if it couldn't be created. */ static int create_backup_boot_sector(u8 *buff) { const char *_s; ssize_t bw; - int size, _e = errno; + int size, _e; Vprintf("Creating backup boot sector.\n"); /* @@ -3580,6 +3580,7 @@ static int create_backup_boot_sector(u8 *buff) bw = mkntfs_write(vol->dev, buff, size); if (bw == size) return 0; + _e = errno; if (bw == -1LL) _s = strerror(_e); else @@ -3594,7 +3595,7 @@ bb_err: "a major problem as Windows check disk will " "create the\nbackup boot sector when it " "is run on your next boot into Windows.\n"); - return 1; + return -1; } /** @@ -3904,7 +3905,7 @@ static void mkntfs_create_root_structures(void) if (err < 0) err_exit("Couldn't create $Boot: %s\n", strerror(-err)); - if (create_backup_boot_sector(buf2) != 0) { + if (create_backup_boot_sector(buf2)) { /* * Pre-2.6 kernels couldn't access the last sector * if it was odd hence we schedule chkdsk to create it. From 9b1a8920fbcb7d87ce92fcc272fef8dd54e04cfb Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 7 Oct 2005 12:41:34 +0000 Subject: [PATCH 2567/2994] Fix "make test". --- test/Makefile.am | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index ba3e615c..09dcfca7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -12,9 +12,8 @@ endif LINK=$(STATIC_LINK) $(LIBTOOL_LINK) #TEST_VALGRIND = valgrind -TEST_RUNLIST = runlist -bin_PROGRAMS = $(TEST_RUNLIST) +bin_PROGRAMS = runlist CLEANFILES = attr[123].bin frag[123][123][123] pure-[cn][ms] zero MAINTAINERCLEANFILES = Makefile.in @@ -33,26 +32,26 @@ runlist_LDFLAGS = $(AM_LFLAGS) libs: (cd ../libntfs && $(MAKE) libs) || exit 1; -test: $(TEST_RUNLIST) testz testp testf +test: runlist testz testp testf -testz: $(TEST_RUNLIST) - @$(TEST_VALGRIND) $(TEST_RUNLIST) zero > zero +testz: runlist + @$(TEST_VALGRIND) ./runlist zero > zero @diff -qs {runlist-data/,}zero -testp: $(TEST_RUNLIST) +testp: runlist @for i in contig noncontig; do \ for j in single multi; do \ L1=`echo $$i | cut -b1`; \ L2=`echo $$j | cut -b1`; \ FILE=pure-$$L1$$L2; \ - $(TEST_VALGRIND) $(TEST_RUNLIST) pure $$i $$j > $$FILE; \ + $(TEST_VALGRIND) ./runlist pure $$i $$j > $$FILE; \ diff -qs {runlist-data/,}$$FILE; \ done; \ done -testf: $(TEST_RUNLIST) +testf: runlist @for i in 123 132 213 231 312 321; do \ - $(TEST_VALGRIND) $(TEST_RUNLIST) frag $$i > frag$$i; \ + $(TEST_VALGRIND) ./runlist frag $$i > frag$$i; \ diff -qs {runlist-data/,}frag$$i; \ done From 5f6a0988e35edb30044ec8b17636d943e9f627e3 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 7 Oct 2005 12:47:03 +0000 Subject: [PATCH 2568/2994] Fix compiler warning. --- libntfs/logfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/logfile.c b/libntfs/logfile.c index e963f5c9..c56fb5fa 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -399,7 +399,7 @@ static int ntfs_check_and_load_restart_page(ntfs_attr *log_na, */ if (le16_to_cpu(rp->restart_area_offset) + le16_to_cpu(ra->restart_area_length) > - NTFS_BLOCK_SIZE - sizeof(u16)) { + NTFS_BLOCK_SIZE - (int)sizeof(u16)) { ntfs_error(vi->i_sb, "Multi sector transfer error " "detected in $LogFile restart page."); err = EINVAL; From 3d46df6b4a5ec157bfe644b217d780eb9870bbda Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 7 Oct 2005 12:52:52 +0000 Subject: [PATCH 2569/2994] Prepare for 1.12.0 release. --- NEWS | 2 +- configure.ac | 2 +- ntfsprogs/.cvsignore | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 75f2eaf4..b022148b 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,7 @@ Current news ============ -ntfsmount can create/delete/move files and directories! It's not full +ntfsmount can create/delete/move files and directories! It is not a full implementation, thus sometimes it will say 'Operation is not supported', nothing bad will happen to user data in this case. (Yura Pakhuchiy) diff --git a/configure.ac b/configure.ac index cda895ec..67f74b23 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.11.3-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.12.0],[linux-ntfs-dev@lists.sourceforge.net]) AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) diff --git a/ntfsprogs/.cvsignore b/ntfsprogs/.cvsignore index b3458673..d31d1c5a 100644 --- a/ntfsprogs/.cvsignore +++ b/ntfsprogs/.cvsignore @@ -6,6 +6,7 @@ mkntfs ntfscat ntfsclone ntfscluster +ntfscmp ntfscp ntfsdecrypt ntfsdump_logfile From 3814896a5b497ae90d88ddad5cc9f1bb3a77af6d Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 7 Oct 2005 13:26:44 +0000 Subject: [PATCH 2570/2994] fix compiler warning --- ntfsprogs/ntfsfix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index bacafdb3..8fcee6ef 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -111,7 +111,8 @@ static int usage(void) exit(1); } -static void version (void) +static void version(void) __attribute__((noreturn)); +static void version(void) { printf("%s v%s\n\n" "Attempt to fix an NTFS partition.\n\n" From 0c293d040772a658a563688fbc2e525cad78964b Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 7 Oct 2005 14:10:56 +0000 Subject: [PATCH 2571/2994] - Add API (actually renamed from what Rich/FlatCap did): volume.[hc]::ntfs_libntfs_version() which returns a pointer to a static const string of the libntfs verion, i.e. at the moment this is "8.0.0". This required moving the version specifications from libntfs/Makefile.am to configure.ac. This should hopefully have the sideeffect that I will remember to increment it when incrementing the ntfsprogs version number when making a release given the two are right under one another. (Anton) - Change ALL utilities to display the libntfs version they are running on. This should make debugging easier in the case that people are running mismatched utilities/library. (Anton) --- ChangeLog | 11 +++++++++++ configure.ac | 31 +++++++++++++++++++++++++++++++ include/ntfs/version.h | 5 +++-- libntfs/Makefile.am | 5 +++-- libntfs/version.c | 28 ++++++++++++++++------------ ntfsprogs/mkntfs.c | 7 +++++-- ntfsprogs/ntfscat.c | 12 +++++++----- ntfsprogs/ntfsclone.c | 6 ++++-- ntfsprogs/ntfscluster.c | 7 +++++-- ntfsprogs/ntfscmp.c | 6 ++++-- ntfsprogs/ntfscp.c | 5 +++-- ntfsprogs/ntfsdecrypt.c | 6 ++++-- ntfsprogs/ntfsdump_logfile.c | 28 +++++++++++++++------------- ntfsprogs/ntfsfix.c | 6 ++++-- ntfsprogs/ntfsinfo.c | 10 ++++++---- ntfsprogs/ntfslabel.c | 10 ++++++---- ntfsprogs/ntfsls.c | 10 ++++++---- ntfsprogs/ntfsmftalloc.c | 8 +++++--- ntfsprogs/ntfsmount.c | 6 ++++-- ntfsprogs/ntfsmove.c | 8 +++++--- ntfsprogs/ntfsresize.c | 6 ++++-- ntfsprogs/ntfsrm.c | 6 ++++-- ntfsprogs/ntfstruncate.c | 8 +++++--- ntfsprogs/ntfsundelete.c | 6 ++++-- ntfsprogs/ntfswipe.c | 7 +++++-- ntfsprogs/utils.c | 1 + 26 files changed, 170 insertions(+), 79 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4eeda9b1..560cddde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -77,6 +77,17 @@ - Fix stupid bug in mkntfs which caused it to fail even though only the backup boot sector could not be written because a 2.4 kernel is used and the partition has an odd number of sectors. (Anton) + - Add API (actually renamed from what Rich/FlatCap did): + volume.[hc]::ntfs_libntfs_version() which returns a pointer to a + static const string of the libntfs verion, i.e. at the moment this is + "8.0.0". This required moving the version specifications from + libntfs/Makefile.am to configure.ac. This should hopefully have the + sideeffect that I will remember to increment it when incrementing the + ntfsprogs version number when making a release given the two are + right under one another. (Anton) + - Change ALL utilities to display the libntfs version they are running + on. This should make debugging easier in the case that people are + running mismatched utilities/library. (Anton) 08/08/2005 - 1.11.2 - ntfsdecrypt now works and lots of fixes and improvements. diff --git a/configure.ac b/configure.ac index 67f74b23..de35f2ff 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,36 @@ AC_PREREQ(2.59) AC_INIT([ntfsprogs],[1.12.0],[linux-ntfs-dev@lists.sourceforge.net]) + +# +# Before making a release, the LTVERSION string should be modified. +# The string is of the form CURRENT:REVISION:AGE. +# +# CURRENT (C) +# The most recent interface number that this library implements. +# +# REVISION (R) +# The implementation number that this library implements. +# +# AGE (A) +# The difference between the newest and oldest interfaces that this +# library implements. In other works, the library implements all the +# interface numbers in the range from number 'CURRENT - AGE' to +# 'CURRENT'. +# +# This means that: +# +# - If interfaces have been changed or added, but binary compatibility has +# been preserved, change to C+1:0:A+1 +# +# - If binary compatibility has been broken (eg removed or changed +# interfaces) change to C+1:0:0 +# +# - If the interface is the same as the previous version, change to C:R+1:A +# +LTVERSION_LIBNTFS="8:0:0" +AC_SUBST(LTVERSION_LIBNTFS) + AC_CANONICAL_HOST([]) AC_CANONICAL_TARGET([]) AC_CONFIG_SRCDIR([config.h.in]) @@ -248,6 +278,7 @@ AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(LIBS) +AC_SUBST(LIBNTFS_CFLAGS) AC_SUBST(LIBNTFS_GNOMEVFS_CFLAGS) AC_SUBST(LIBNTFS_GNOMEVFS_LIBS) diff --git a/include/ntfs/version.h b/include/ntfs/version.h index d9198b71..27e62fdd 100644 --- a/include/ntfs/version.h +++ b/include/ntfs/version.h @@ -1,6 +1,7 @@ /** - * version.h - Info about the NTFS library. Part of the Linux-NTFS project. + * version.h - Info about the NTFS library. Part of the Linux-NTFS project. * + * Copyright (c) 2005 Anton Altaparmakov * Copyright (c) 2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or @@ -22,7 +23,7 @@ #ifndef _NTFS_VERSION_H_ #define _NTFS_VERSION_H_ -extern const char * ntfs_get_library_version (void); +extern const char *ntfs_libntfs_version(void); #endif /* _NTFS_VERSION_H_ */ diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 12282845..e199c9d4 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -25,7 +25,7 @@ # - If the interface is the same as the previous version, change to C:R+1:A # -LTVERSION_LIBNTFS = 8:0:0 +# For LTVERSION_LIBNTFS see configure.ac! LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 @@ -33,6 +33,8 @@ linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs lib_LTLIBRARIES = libntfs.la libntfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS) +libntfs_la_CFLAGS = $(LIBNTFS_CFLAGS) \ + -DLTVERSION_LIBNTFS=\"$(LTVERSION_LIBNTFS)\" libntfs_la_SOURCES = \ attrib.c \ attrlist.c \ @@ -84,4 +86,3 @@ EXTRA_DIST = unix_io.c win32_io.c libntfs.conf.in MAINTAINERCLEANFILES = Makefile.in libs: $(lib_LTLIBRARIES) - diff --git a/libntfs/version.c b/libntfs/version.c index 6cfba869..7882e717 100644 --- a/libntfs/version.c +++ b/libntfs/version.c @@ -1,6 +1,7 @@ /** - * version.c - Info about the NTFS library. Part of the Linux-NTFS project. + * version.c - Info about the NTFS library. Part of the Linux-NTFS project. * + * Copyright (c) 2005 Anton Altaparmakov * Copyright (c) 2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or @@ -25,17 +26,20 @@ #include "version.h" -#ifndef VERSION -#define VERSION "unknown" +#ifdef LTVERSION_LIBNTFS +#define LIBNTFS_VERSION_STRING LTVERSION_LIBNTFS +#else +#define LIBNTFS_VERSION_STRING "unknown" #endif -/** - * ntfs_get_library_version - Version number of the library release - * - * Returns a text string representing the release of libntfs, e.g. "1.9.4". - */ -const char * ntfs_get_library_version (void) -{ - return VERSION; -} +static const char *libntfs_version_string = LIBNTFS_VERSION_STRING; +/** + * ntfs_libntfs_version - query version number of the ntfs library libntfs + * + * Returns pointer to a text string representing the version of libntfs. + */ +const char *ntfs_libntfs_version(void) +{ + return libntfs_version_string; +} diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 07839d0a..577b2cbe 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -137,6 +137,7 @@ #include "runlist.h" #include "utils.h" #include "ntfstime.h" +#include "version.h" #ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS # error "No default device io operations! Cannot build mkntfs. \ @@ -282,7 +283,7 @@ static void err_exit(const char *fmt, ...) */ static void copyright(void) { - fprintf(stderr, "Copyright (c) 2000-2004 Anton Altaparmakov\n" + fprintf(stderr, "Copyright (c) 2000-2005 Anton Altaparmakov\n" "Copyright (c) 2001-2003 Richard Russon\n" "Create an NTFS volume on a user specified (block) " "device.\n"); @@ -342,6 +343,7 @@ static void usage(void) exit(1); } +#include "version.h" /** * parse_options */ @@ -356,7 +358,8 @@ static void parse_options(int argc, char *argv[]) // logfile size, list of bad blocks, check for bad blocks, ... if (argc && *argv) EXEC_NAME = *argv; - fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); + fprintf(stderr, "%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); while ((c = getopt(argc, argv, "c:fH:h?np:qS:s:vz:CFTIL:QVl")) != EOF) switch (c) { case 'n': diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 809b17b2..ea59d903 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -2,7 +2,7 @@ * ntfscat - Part of the Linux-NTFS project. * * Copyright (c) 2003-2005 Richard Russon - * Copyright (c) 2003 Anton Altaparmakov + * Copyright (c) 2003-2005 Anton Altaparmakov * * This utility will concatenate files and print on the standard output. * @@ -44,6 +44,7 @@ #include "debug.h" #include "dir.h" #include "ntfscat.h" +#include "version.h" static const char *EXEC_NAME = "ntfscat"; static struct options opts; @@ -62,10 +63,11 @@ static GEN_PRINTF (Printf, stderr, NULL, FALSE) */ static void version (void) { - Printf ("\n%s v%s - Concatenate files and print on the standard output.\n\n", - EXEC_NAME, VERSION); - Printf ("Copyright (c) 2003 Richard Russon\n"); - Printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + Printf("\n%s v%s (libntfs %s) - Concatenate files and print on the " + "standard output.\n\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); + Printf("Copyright (c) 2003 Richard Russon\n"); + Printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 6746b748..68854179 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -2,7 +2,7 @@ * ntfsclone - Part of the Linux-NTFS project. * * Copyright (c) 2003-2005 Szabolcs Szakacsits - * Copyright (c) 2004 Anton Altaparmakov + * Copyright (c) 2004-2005 Anton Altaparmakov * Special image format support copyright (c) 2004 Per Olofsson * * Clone NTFS data and/or metadata to a sparse file, image, device or stdout. @@ -65,6 +65,7 @@ #include "inode.h" #include "runlist.h" #include "utils.h" +#include "version.h" #if defined(linux) && defined(_IO) && !defined(BLKGETSIZE) #define BLKGETSIZE _IO(0x12,96) /* Get device size in 512-byte blocks. */ @@ -1443,7 +1444,8 @@ int main(int argc, char **argv) unsigned int wiped_total = 0; /* print to stderr, stdout can be an NTFS image ... */ - Eprintf("%s v%s\n", EXEC_NAME, VERSION); + Eprintf("%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); msg_out = stderr; parse_options(argc, argv); diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 0c7b86f1..2f0a0bbe 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -1,6 +1,7 @@ /** * ntfscluster - Part of the Linux-NTFS project. * + * Copyright (c) 2005 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon * * This utility will locate the owner of any given sector or cluster. @@ -47,6 +48,7 @@ #include "debug.h" #include "dir.h" #include "cluster.h" +#include "version.h" static const char *EXEC_NAME = "ntfscluster"; static struct options opts; @@ -64,8 +66,9 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) */ static void version (void) { - printf ("\n%s v%s - Find the owner of any given sector or cluster.\n\n", - EXEC_NAME, VERSION); + printf("\n%s v%s (libntfs %s) - Find the owner of any given sector or " + "cluster.\n\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); printf ("Copyright (c) 2002-2003 Richard Russon\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index c915b3b6..b65c9a04 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -1,10 +1,10 @@ /** * ntfscmp - compare two NTFS volumes. * + * Copyright (c) 2005 Anton Altaparmakov * Copyright (c) 2005 Szabolcs Szakacsits * * This utility is part of the Linux-NTFS project. - * */ #include "config.h" @@ -18,6 +18,7 @@ #include #include "utils.h" +#include "version.h" static const char *EXEC_NAME = "ntfscmp"; @@ -782,7 +783,8 @@ int main(int argc, char **argv) ntfs_volume *vol1; ntfs_volume *vol2; - printf("%s v%s\n", EXEC_NAME, VERSION); + printf("%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); parse_options(argc, argv); diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 676ae152..0b087fa0 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -50,6 +50,7 @@ #include "volume.h" #include "dir.h" #include "debug.h" +#include "version.h" struct options { char *device; /* Device/File to work with */ @@ -82,8 +83,8 @@ static GEN_PRINTF (Printf, stderr, NULL, FALSE) */ static void version (void) { - Printf ("\n%s v%s - Overwrite files on NTFS volume.\n\n", - EXEC_NAME, VERSION); + Printf("\n%s v%s (libntfs %s) - Overwrite files on NTFS volume.\n\n", + EXEC_NAME, VERSION, ntfs_libntfs_version()); Printf ("Copyright (c) 2004-2005 Yura Pakhuchiy\n"); Printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 72ce32e6..cb0af987 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -70,6 +70,7 @@ #include "debug.h" #include "dir.h" #include "layout.h" +#include "version.h" typedef gcry_sexp_t ntfs_rsa_private_key; @@ -128,8 +129,9 @@ static ntfschar EFS[5] = { */ static void version(void) { - Printf("\n%s v%s - Decrypt files and print on the standard output.\n\n", - EXEC_NAME, VERSION); + Printf("\n%s v%s (libntfs %s) - Decrypt files and print on the " + "standard output.\n\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); Printf("Copyright (c) 2005 Yuval Fledel\n"); Printf("Copyright (c) 2005 Anton Altaparmakov\n"); Printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 38d7d7ba..b2602a78 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -69,6 +69,7 @@ #include "logfile.h" #include "mst.h" #include "utils.h" +#include "version.h" typedef struct { BOOL is_volume; @@ -171,19 +172,20 @@ void log_err_exit(u8 *buf, const char *fmt, ...) void usage(const char *exec_name) __attribute__ ((noreturn)); void usage(const char *exec_name) { - Eprintf("%s v%s - Interpret and display information about the " - "journal\n($LogFile) of an NTFS volume.\n" - "Copyright (c) 2000-2004 Anton Altaparmakov.\n" - "%s is free software, released under the GNU General " - "Public License\nand you are welcome to redistribute " - "it under certain conditions.\n%s comes with " - "ABSOLUTELY NO WARRANTY; for details read the GNU\n" - "General Public License to be found in the file " - "COPYING in the main Linux-NTFS\ndistribution " - "directory.\nUsage: %s device\n e.g. %s /dev/hda6\n" - "Alternative usage: %s -f file\n e.g. %s -f " - "MyCopyOfTheLogFile\n", exec_name, VERSION, exec_name, - exec_name, exec_name, exec_name, exec_name, exec_name); + Eprintf("%s v%s (libntfs %s) - Interpret and display information " + "about the journal\n($LogFile) of an NTFS volume.\n" + "Copyright (c) 2000-2005 Anton Altaparmakov.\n" + "%s is free software, released under the GNU General " + "Public License\nand you are welcome to redistribute " + "it under certain conditions.\n%s comes with " + "ABSOLUTELY NO WARRANTY; for details read the GNU\n" + "General Public License to be found in the file " + "COPYING in the main Linux-NTFS\ndistribution " + "directory.\nUsage: %s device\n e.g. %s /dev/hda6\n" + "Alternative usage: %s -f file\n e.g. %s -f " + "MyCopyOfTheLogFile\n", exec_name, VERSION, + ntfs_libntfs_version(), exec_name, exec_name, + exec_name, exec_name, exec_name, exec_name); exit(1); } diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 8fcee6ef..7cd574ad 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -73,6 +73,7 @@ #include "device.h" #include "logfile.h" #include "utils.h" +#include "version.h" #ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS # error "No default device io operations! Cannot build ntfsfix. \ @@ -97,7 +98,7 @@ struct { static int usage(void) __attribute__((noreturn)); static int usage(void) { - printf("%s v%s\n" + printf("%s v%s (libntfs %s)\n" "\n" "Usage: %s [options] device\n" " Attempt to fix an NTFS partition.\n" @@ -106,7 +107,8 @@ static int usage(void) " -V, --version Display version information\n" "\n" "For example: %s /dev/hda6\n\n", - EXEC_NAME, VERSION, EXEC_NAME, EXEC_NAME); + EXEC_NAME, VERSION, ntfs_libntfs_version(), EXEC_NAME, + EXEC_NAME); printf("%s%s", ntfs_bugs, ntfs_home); exit(1); } diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 76af75f0..b5751796 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -2,7 +2,7 @@ * ntfsinfo - Part of the Linux-NTFS project. * * Copyright (c) 2002-2004 Matthew J. Fanto - * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2002-2005 Anton Altaparmakov * Copyright (c) 2002-2005 Richard Russon * Copyright (c) 2004-2005 Yura Pakhuchiy * Copyright (c) 2005 Cristian Klein @@ -76,6 +76,7 @@ #include "mst.h" #include "dir.h" #include "ntfstime.h" +#include "version.h" static const char *EXEC_NAME = "ntfsinfo"; @@ -104,11 +105,12 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) */ static void version (void) { - printf ("\n%s v%s - Display information about an NTFS Volume.\n\n", - EXEC_NAME, VERSION); + printf ("\n%s v%s (libntfs %s) - Display information about an NTFS " + "Volume.\n\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); printf ("Copyright (c)\n"); printf (" 2002-2004 Matthew J. Fanto\n"); - printf (" 2002-2004 Anton Altaparmakov\n"); + printf (" 2002-2005 Anton Altaparmakov\n"); printf (" 2002-2003 Richard Russon\n"); printf (" 2003 Leonard NorrgĂĄrd\n"); printf (" 2004-2005 Yura Pakhuchiy\n"); diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index e8747cb5..8727ebc5 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -2,7 +2,7 @@ * ntfslabel - Part of the Linux-NTFS project. * * Copyright (c) 2002 Matthew J. Fanto - * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2002-2005 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon * * This utility will display/change the label on an NTFS partition. @@ -47,6 +47,7 @@ #include "debug.h" #include "mft.h" #include "utils.h" +#include "version.h" static const char *EXEC_NAME = "ntfslabel"; @@ -72,11 +73,12 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) */ static void version (void) { - printf ("\n%s v%s - Display, or set, the label for an NTFS Volume.\n\n", - EXEC_NAME, VERSION); + printf ("\n%s v%s (libntfs %s) - Display, or set, the label for an " + "NTFS Volume.\n\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); printf ("Copyright (c)\n"); printf (" 2002 Matthew J. Fanto\n"); - printf (" 2002-2004 Anton Altaparmakov\n"); + printf (" 2002-2005 Anton Altaparmakov\n"); printf (" 2002-2003 Richard Russon\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index d5cada66..97752159 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -2,7 +2,7 @@ * ntfsls - Part of the Linux-NTFS project. * * Copyright (c) 2003 Lode Leroy - * Copyright (c) 2003 Anton Altaparmakov + * Copyright (c) 2003-2005 Anton Altaparmakov * Copyright (c) 2003 Richard Russon * Copyright (c) 2004 Carmelo Kintana * Copyright (c) 2004 Giang Nguyen @@ -51,6 +51,7 @@ #include "dir.h" #include "list.h" #include "ntfstime.h" +#include "version.h" static const char *EXEC_NAME = "ntfsls"; @@ -135,10 +136,11 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) */ static void version(void) { - printf("\n%s v%s - Display information about an NTFS Volume.\n\n", - EXEC_NAME, VERSION); + printf("\n%s v%s (libntfs %s) - Display information about an NTFS " + "Volume.\n\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); printf("Copyright (c) 2003 Lode Leroy\n"); - printf("Copyright (c) 2003 Anton Altaparmakov\n"); + printf("Copyright (c) 2003-2005 Anton Altaparmakov\n"); printf("Copyright (c) 2003 Richard Russon\n"); printf("Copyright (c) 2004 Carmelo Kintana\n"); printf("Copyright (c) 2004 Giang Nguyen\n"); diff --git a/ntfsprogs/ntfsmftalloc.c b/ntfsprogs/ntfsmftalloc.c index 8ecb10b2..07f2a59a 100644 --- a/ntfsprogs/ntfsmftalloc.c +++ b/ntfsprogs/ntfsmftalloc.c @@ -1,7 +1,7 @@ /** * ntfsmftalloc - Part of the Linux-NTFS project. * - * Copyright (c) 2002-2003 Anton Altaparmakov + * Copyright (c) 2002-2005 Anton Altaparmakov * * This utility will allocate and initialize an mft record. * @@ -63,6 +63,7 @@ #include "volume.h" #include "mft.h" #include "utils.h" +#include "version.h" static const char *EXEC_NAME = "ntfsmftalloc"; @@ -146,7 +147,7 @@ static void err_exit(const char *fmt, ...) */ static void copyright(void) { - fprintf(stderr, "Copyright (c) 2004 Anton Altaparmakov\n" + fprintf(stderr, "Copyright (c) 2004-2005 Anton Altaparmakov\n" "Allocate and initialize a base or an extent mft " "record. If a base mft record\nis not specified, a " "base mft record is allocated and initialized. " @@ -194,7 +195,8 @@ static void parse_options(int argc, char *argv[]) if (argc && *argv) EXEC_NAME = *argv; - fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); + fprintf(stderr, "%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); while ((c = getopt(argc, argv, "fh?nqvVl")) != EOF) switch (c) { case 'f': diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index e6c5f482..b615dc41 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1,6 +1,7 @@ /** * ntfsmount - Part of the Linux-NTFS project. * + * Copyright (c) 2005 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy * * NTFS module for FUSE. @@ -64,6 +65,7 @@ #include "layout.h" #include "index.h" #include "utils.h" +#include "version.h" #ifndef PATH_MAX #define PATH_MAX 4096 @@ -1322,8 +1324,8 @@ err_exit: static void usage(void) { - Eprintf("\n%s v%s - NTFS module for FUSE.\n\n", - EXEC_NAME, VERSION); + Eprintf("\n%s v%s (libntfs %s) - NTFS module for FUSE.\n\n", + EXEC_NAME, VERSION, ntfs_libntfs_version()); Eprintf("Copyright (c) 2005 Yura Pakhuchiy\n\n"); Eprintf("usage: %s device mount_point [-o options]\n\n", EXEC_NAME); diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index ab05c0e2..56dfccdb 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -2,7 +2,7 @@ * ntfsmove - Part of the Linux-NTFS project. * * Copyright (c) 2003 Richard Russon - * Copyright (c) 2003 Anton Altaparmakov + * Copyright (c) 2003-2005 Anton Altaparmakov * * This utility will move files on an NTFS volume. * @@ -45,6 +45,7 @@ #include "dir.h" #include "bitmap.h" #include "ntfsmove.h" +#include "version.h" static const char *EXEC_NAME = "ntfsmove"; static struct options opts; @@ -67,8 +68,9 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) */ static void version (void) { - printf ("\n%s v%s - Move files and directories on an NTFS volume.\n\n", - EXEC_NAME, VERSION); + printf ("\n%s v%s (libntfs %s) - Move files and directories on an " + "NTFS volume.\n\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); printf ("Copyright (c) 2003 Richard Russon\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 907a0499..c3d5643f 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2,7 +2,7 @@ * ntfsresize - Part of the Linux-NTFS project. * * Copyright (c) 2002-2005 Szabolcs Szakacsits - * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2002-2005 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon * * This utility will resize an NTFS volume without data loss. @@ -64,6 +64,7 @@ #include "inode.h" #include "runlist.h" #include "utils.h" +#include "version.h" static const char *EXEC_NAME = "ntfsresize"; @@ -2334,7 +2335,8 @@ int main(int argc, char **argv) s64 device_size; /* in bytes */ ntfs_volume *vol; - printf("%s v%s\n", EXEC_NAME, VERSION); + printf("%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); if (!parse_options(argc, argv)) return 1; diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 6a0a6e21..164d50fc 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1,6 +1,7 @@ /** * ntfsrm - Part of the Linux-NTFS project. * + * Copyright (c) 2005 Anton Altaparmakov * Copyright (c) 2004-2005 Richard Russon * * This utility will delete files from an NTFS volume. @@ -46,6 +47,7 @@ #include "lcnalloc.h" #include "mft.h" #include "ntfstime.h" +#include "version.h" static const char *EXEC_NAME = "ntfsrm"; static struct options opts; @@ -66,8 +68,8 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) */ static void version (void) { - printf ("\n%s v%s - Delete files from an NTFS volume.\n\n", - EXEC_NAME, VERSION); + printf("\n%s v%s (libntfs %s) - Delete files from an NTFS volume.\n\n", + EXEC_NAME, VERSION, ntfs_libntfs_version()); printf ("Copyright (c) 2004 Richard Russon\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 75663989..2acd49d5 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -1,7 +1,7 @@ /** * ntfstruncate - Part of the Linux-NTFS project. * - * Copyright (c) 2002-2003 Anton Altaparmakov + * Copyright (c) 2002-2005 Anton Altaparmakov * * This utility will truncate a specified attribute belonging to a * specified inode, i.e. file or directory, to a specified length. @@ -64,6 +64,7 @@ #include "layout.h" #include "volume.h" #include "utils.h" +#include "version.h" extern const unsigned char attrdef_ntfs12_array[2400]; @@ -156,7 +157,7 @@ static void err_exit(const char *fmt, ...) */ static void copyright(void) { - fprintf(stderr, "Copyright (c) 2002-2003 Anton Altaparmakov\n" + fprintf(stderr, "Copyright (c) 2002-2005 Anton Altaparmakov\n" "Copyright (c) 2003 Richard Russon\n" "Truncate a specified attribute of a specified " "inode.\n"); @@ -206,7 +207,8 @@ static void parse_options(int argc, char *argv[]) if (argc && *argv) EXEC_NAME = *argv; - fprintf(stderr, "%s v%s\n", EXEC_NAME, VERSION); + fprintf(stderr, "%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); while ((c = getopt(argc, argv, "fh?nqvVl")) != EOF) switch (c) { case 'f': diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 1a5164cf..d8d009b0 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -79,6 +79,7 @@ #include "utils.h" #include "debug.h" #include "ntfstime.h" +#include "version.h" static const char *EXEC_NAME = "ntfsundelete"; static const char *MFTFILE = "mft"; @@ -225,8 +226,9 @@ static int parse_inode_arg (void) */ static void version (void) { - printf ("\n%s v%s - Recover deleted files from an NTFS Volume.\n\n", - EXEC_NAME, VERSION); + printf("\n%s v%s (libntfs %s) - Recover deleted files from an NTFS " + "Volume.\n\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); printf ("Copyright (c) 2002-2005 Richard Russon\n" "Copyright (c) 2004-2005 Holger Ohmacht\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 07f34e97..c83c1541 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -1,6 +1,7 @@ /** * ntfswipe - Part of the Linux-NTFS project. * + * Copyright (c) 2005 Anton Altaparmakov * Copyright (c) 2002-2003 Richard Russon * Copyright (c) 2004 Yura Pakhuchiy * @@ -53,6 +54,7 @@ #include "debug.h" #include "dir.h" #include "mst.h" +#include "version.h" static const char *EXEC_NAME = "ntfswipe"; static struct options opts; @@ -70,8 +72,9 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) */ static void version (void) { - printf ("\n%s v%s - Overwrite the unused space on an NTFS Volume.\n\n", - EXEC_NAME, VERSION); + printf("\n%s v%s (libntfs %s) - Overwrite the unused space on an NTFS " + "Volume.\n\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); printf ("Copyright (c) 2002-2003 Richard Russon\n"); printf ("Copyright (c) 2004 Yura Pakhuchiy\n"); printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 4c558f5d..5bfbd15a 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -68,6 +68,7 @@ #include "volume.h" #include "debug.h" #include "dir.h" +#include "version.h" const char *ntfs_bugs = "Developers' email address: linux-ntfs-dev@lists.sourceforge.net\n"; const char *ntfs_home = "Linux NTFS homepage: http://linux-ntfs.sourceforge.net\n"; From 0377e979d060fc291bbf574ead1a1941cd19fb16 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 7 Oct 2005 15:02:15 +0000 Subject: [PATCH 2572/2994] Various fixes before release. --- ntfsprogs.spec.in | 8 +++++++- ntfsprogs/Makefile.am | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index 3c95487c..cea4692d 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -88,7 +88,8 @@ rm -rf "$RPM_BUILD_ROOT" %defattr(-,root,root) %doc AUTHORS COPYING CREDITS ChangeLog INSTALL NEWS README TODO.include TODO.libntfs TODO.ntfsprogs doc/CodingStyle doc/attribute_definitions doc/attributes.txt doc/compression.txt doc/tunable_settings doc/template.c doc/template.h doc/system_files.txt doc/system_security_descriptors.txt %{bindir}/ntfs[^m][^o]* -%{sbindir}/* +%{sbindir}/mk* +%{sbindir}/ntfs* %{mandir}/man8/mkntfs.8* %{mandir}/man8/mkfs.ntfs.8* %{mandir}/man8/ntfs[^m][^o]*.8* @@ -103,6 +104,7 @@ rm -rf "$RPM_BUILD_ROOT" %files fuse %defattr(-,root,root) %{bindir}/ntfsmount* +%{sbindir}/mount.ntfs-fuse %{mandir}/man8/ntfsmount.8* %files devel @@ -112,6 +114,10 @@ rm -rf "$RPM_BUILD_ROOT" %{_libdir}/gnome-vfs-2.0/modules/libntfs-gnomevfs.*a* %changelog +* Fri Oct 7 2005 Anton Altaparmakov +- Fix the file distribution after new binaries have been added as they were + ending up in the wrong rpms. + * Mon Aug 15 2005 Szabolcs Szakacsits - Add mkfs.ntfs. diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index c69fb56e..e4748812 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -144,7 +144,7 @@ extras: libs $(EXTRA_PROGRAMS) install-exec-hook: $(LN) -f $(DESTDIR)$(sbindir)/mkntfs $(DESTDIR)$(sbindir)/mkfs.ntfs if ENABLE_FUSE_MODULE - $(LN) -f $(DESTDIR)$(bindir)/ntfsmount /sbin/mount.ntfs-fuse + $(LN) -f $(DESTDIR)$(bindir)/ntfsmount $(DESTDIR)$(sbindir)/mount.ntfs-fuse endif install-data-hook: From 093431f2f78b36ef1460b852132e2ddf5db7c576 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 7 Oct 2005 15:13:10 +0000 Subject: [PATCH 2573/2994] revert 1.49, mount.ntfs-fuse should be in /sbin, not /usr/sbin or /usr/local/sbin --- ntfsprogs/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index e4748812..778d453e 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -144,7 +144,7 @@ extras: libs $(EXTRA_PROGRAMS) install-exec-hook: $(LN) -f $(DESTDIR)$(sbindir)/mkntfs $(DESTDIR)$(sbindir)/mkfs.ntfs if ENABLE_FUSE_MODULE - $(LN) -f $(DESTDIR)$(bindir)/ntfsmount $(DESTDIR)$(sbindir)/mount.ntfs-fuse + $(LN) -f $(DESTDIR)$(bindir)/ntfsmount mount.ntfs-fuse endif install-data-hook: From 88545852708fe685f2655a5f28a701fb21ca2e1a Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 7 Oct 2005 15:15:13 +0000 Subject: [PATCH 2574/2994] oops, fix previous fix --- ntfsprogs/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 778d453e..c69fb56e 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -144,7 +144,7 @@ extras: libs $(EXTRA_PROGRAMS) install-exec-hook: $(LN) -f $(DESTDIR)$(sbindir)/mkntfs $(DESTDIR)$(sbindir)/mkfs.ntfs if ENABLE_FUSE_MODULE - $(LN) -f $(DESTDIR)$(bindir)/ntfsmount mount.ntfs-fuse + $(LN) -f $(DESTDIR)$(bindir)/ntfsmount /sbin/mount.ntfs-fuse endif install-data-hook: From fdd8dbd8193a9db35c8364fce1128a271aeec8d3 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 7 Oct 2005 15:18:47 +0000 Subject: [PATCH 2575/2994] fix spec too --- ntfsprogs.spec.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index cea4692d..38f256d7 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -104,7 +104,7 @@ rm -rf "$RPM_BUILD_ROOT" %files fuse %defattr(-,root,root) %{bindir}/ntfsmount* -%{sbindir}/mount.ntfs-fuse +/sbin/mount.ntfs-fuse %{mandir}/man8/ntfsmount.8* %files devel From 4c3687fc64819fbe3235ac6b18d5288cd1177dc9 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 7 Oct 2005 15:52:29 +0000 Subject: [PATCH 2576/2994] Fix hardcoded location for hardlink on uninstall. (Anton, Szaka) --- ntfsprogs/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index c69fb56e..1a16bc95 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -154,5 +154,5 @@ uninstall-local: rm -f $(DESTDIR)$(sbindir)/mkfs.ntfs rm -f $(DESTDIR)$(man8dir)/mkfs.ntfs.8 if ENABLE_FUSE_MODULE - rm -f /sbin/mount.ntfs-fuse + rm -f $(DESTDIR)$(sbindir)/mount.ntfs-fuse endif From ff86e350bc87cc7dffa159d663f458ab04004a12 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 7 Oct 2005 16:00:42 +0000 Subject: [PATCH 2577/2994] Update changelog and bump version number on ntfsprogs and libntfs appropriately. NOTE: If anyone makes libntfs changes that modify the interfaces, please update the libntfs version appropriately before the next release (see configure.ac for explanation of how to update the version). --- ChangeLog | 5 +++++ configure.ac | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 560cddde..f62a71be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +xx/xx/2005 - 1.12.1-WIP + + - Fix hardcoded location for uninstalling mount.ntfs-fuse hardlink to + match the relocatable location for installing it. (Anton, Szaka) + 07/10/2005 - 1.12.0 - Lots of fixes and enhancements! - Add ./configure detection for gnutls library and make minimum version diff --git a/configure.ac b/configure.ac index de35f2ff..acfa5f45 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.12.0],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.12.1-WIP],[linux-ntfs-dev@lists.sourceforge.net]) # # Before making a release, the LTVERSION string should be modified. @@ -50,7 +50,7 @@ AC_INIT([ntfsprogs],[1.12.0],[linux-ntfs-dev@lists.sourceforge.net]) # # - If the interface is the same as the previous version, change to C:R+1:A # -LTVERSION_LIBNTFS="8:0:0" +LTVERSION_LIBNTFS="8:1:0" AC_SUBST(LTVERSION_LIBNTFS) AC_CANONICAL_HOST([]) From cc57c76cd56b2441ed078354aebafc7508381095 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 7 Oct 2005 23:01:23 +0000 Subject: [PATCH 2578/2994] Move mount.ntfs-fuse and mkfs.ntfs to be symlinks instead of hardlinks and move both to /sbin rather than prefix/sbin. Note we still obey $destdir so building packages works as well as installing into alternate chroot / other system still works. --- ChangeLog | 6 +++++- configure.ac | 4 ++-- ntfsprogs.spec.in | 5 +++-- ntfsprogs/Makefile.am | 18 ++++++++++++------ 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index f62a71be..38061fc5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,11 @@ -xx/xx/2005 - 1.12.1-WIP +08/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. - Fix hardcoded location for uninstalling mount.ntfs-fuse hardlink to match the relocatable location for installing it. (Anton, Szaka) + - Move mount.ntfs-fuse and mkfs.ntfs to be symlinks instead of + hardlinks and move both to /sbin rather than prefix/sbin. Note we + still obey $destdir so building packages works as well as installing + into alternate chroot / other system still works. 07/10/2005 - 1.12.0 - Lots of fixes and enhancements! diff --git a/configure.ac b/configure.ac index acfa5f45..f62ed5d0 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.12.1-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.12.1],[linux-ntfs-dev@lists.sourceforge.net]) # # Before making a release, the LTVERSION string should be modified. @@ -155,7 +155,7 @@ esac AC_PROG_CC AC_PROG_GCC_TRADITIONAL AC_PROG_INSTALL -AC_PATH_PROG(LN, ln, ln) +AC_PATH_PROG(RM, rm, rm) AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_LIBTOOL diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index 38f256d7..d0b06308 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -88,8 +88,8 @@ rm -rf "$RPM_BUILD_ROOT" %defattr(-,root,root) %doc AUTHORS COPYING CREDITS ChangeLog INSTALL NEWS README TODO.include TODO.libntfs TODO.ntfsprogs doc/CodingStyle doc/attribute_definitions doc/attributes.txt doc/compression.txt doc/tunable_settings doc/template.c doc/template.h doc/system_files.txt doc/system_security_descriptors.txt %{bindir}/ntfs[^m][^o]* -%{sbindir}/mk* -%{sbindir}/ntfs* +%{sbindir}/* +/sbin/mkfs.ntfs %{mandir}/man8/mkntfs.8* %{mandir}/man8/mkfs.ntfs.8* %{mandir}/man8/ntfs[^m][^o]*.8* @@ -106,6 +106,7 @@ rm -rf "$RPM_BUILD_ROOT" %{bindir}/ntfsmount* /sbin/mount.ntfs-fuse %{mandir}/man8/ntfsmount.8* +%{mandir}/man8/mount.ntfs-fuse.8* %files devel %defattr(-,root,root) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 1a16bc95..3dfd19ed 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -142,17 +142,23 @@ extras: libs $(EXTRA_PROGRAMS) # mkfs.ntfs[.8] and mount.ntfs-fuse hard links install-exec-hook: - $(LN) -f $(DESTDIR)$(sbindir)/mkntfs $(DESTDIR)$(sbindir)/mkfs.ntfs + $(INSTALL) -d $(DESTDIR)/sbin + $(LN_S) -f $(sbindir)/mkntfs $(DESTDIR)/sbin/mkfs.ntfs if ENABLE_FUSE_MODULE - $(LN) -f $(DESTDIR)$(bindir)/ntfsmount /sbin/mount.ntfs-fuse + $(LN_S) -f $(bindir)/ntfsmount $(DESTDIR)/sbin/mount.ntfs-fuse endif install-data-hook: - $(LN) -f $(DESTDIR)$(man8dir)/mkntfs.8 $(DESTDIR)$(man8dir)/mkfs.ntfs.8 + $(INSTALL) -d $(DESTDIR)$(man8dir) + $(LN_S) -f mkntfs.8 $(DESTDIR)$(man8dir)/mkfs.ntfs.8 +if ENABLE_FUSE_MODULE + $(LN_S) -f ntfsmount.8 $(DESTDIR)$(man8dir)/mount.ntfs-fuse.8 +endif uninstall-local: - rm -f $(DESTDIR)$(sbindir)/mkfs.ntfs - rm -f $(DESTDIR)$(man8dir)/mkfs.ntfs.8 + $(RM) -f $(DESTDIR)/sbin/mkfs.ntfs + $(RM) -f $(DESTDIR)$(man8dir)/mkfs.ntfs.8 if ENABLE_FUSE_MODULE - rm -f $(DESTDIR)$(sbindir)/mount.ntfs-fuse + $(RM) -f $(DESTDIR)/sbin/mount.ntfs-fuse + $(RM) -f $(DESTDIR)$(man8dir)/mount.ntfs-fuse.8 endif From 9e589a7bceab447b5a9d02f105a6e8827ba50832 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 9 Oct 2005 12:53:44 +0000 Subject: [PATCH 2579/2994] Fix some corner cases and all memory leaks; handle corrupt NTFS more gracefully --- ChangeLog | 4 +- ntfsprogs/ntfscmp.c | 174 +++++++++++++++++++++++++++----------------- 2 files changed, 111 insertions(+), 67 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38061fc5..f9cac5b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,9 @@ - Move mount.ntfs-fuse and mkfs.ntfs to be symlinks instead of hardlinks and move both to /sbin rather than prefix/sbin. Note we still obey $destdir so building packages works as well as installing - into alternate chroot / other system still works. + into alternate chroot / other system still works. (Anton) + - ntfscmp: fix some corner cases and all memory leaks; handle corrupt + NTFS more gracefully. (Szaka) 07/10/2005 - 1.12.0 - Lots of fixes and enhancements! diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index b65c9a04..cbd6841e 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -327,15 +327,6 @@ static const char *err2string(int err) return ntfscmp_errs[err]; } -static const char *ret2string(int ret) -{ - if (ret == -1) - return "FAILED"; - else if (ret != 0) - err_exit("Unhandled return code: %d\n", ret); - return "OK"; -} - static const char *pret2str(void *p) { if (p == NULL) @@ -399,6 +390,14 @@ static void print_attribute_name(char *name) #define GET_ATTR_NAME(a) \ ((ntfschar *)(((u8 *)(a)) + ((a)->name_offset))), ((a)->name_length) +static void free_name(char **name) +{ + if (*name) { + free(*name); + *name = NULL; + } +} + static char *get_attr_name(u64 mft_no, ATTR_TYPES atype, const ntfschar *uname, @@ -421,6 +420,7 @@ static char *get_attr_name(u64 mft_no, } else if (name_len > 0) return name; + free_name(&name); return NULL; } @@ -446,19 +446,25 @@ static void print_attribute(ATTR_TYPES atype, char *name) static void print_na(ntfs_attr *na) { + char *name = get_attr_name_na(na); print_inode_ni(na->ni); - print_attribute(na->type, get_attr_name_na(na)); + print_attribute(na->type, name); + free_name(&name); } static void print_attribute_ctx(ntfs_attr_search_ctx *ctx) { - print_attribute(ctx->attr->type, get_attr_name_ctx(ctx)); + char *name = get_attr_name_ctx(ctx); + print_attribute(ctx->attr->type, name); + free_name(&name); } static void print_ctx(ntfs_attr_search_ctx *ctx) { + char *name = get_attr_name_ctx(ctx); print_inode_ni(base_inode(ctx)); - print_attribute(ctx->attr->type, get_attr_name_ctx(ctx)); + print_attribute(ctx->attr->type, name); + free_name(&name); } static void cmp_attribute_data(ntfs_attr *na1, ntfs_attr *na2) @@ -568,22 +574,36 @@ static void print_attributes(ntfs_inode *ni, Vprintf("\n"); } +static int new_name(ntfs_attr_search_ctx *ctx, char *prev_name) +{ + int ret = 0; + char *name = get_attr_name_ctx(ctx); + + if (prev_name && name) { + if (strcmp(prev_name, name) != 0) + ret = 1; + } else if (prev_name || name) + ret = 1; + + free_name(&name); + return ret; + +} + static int new_attribute(ntfs_attr_search_ctx *ctx, ATTR_TYPES prev_atype, char *prev_name) { - char *name = get_attr_name_ctx(ctx); - + if (!prev_atype && !prev_name) + return 1; + if (!ctx->attr->non_resident) return 1; if (prev_atype != ctx->attr->type) return 1; - if (prev_name && name) { - if (strcmp(prev_name, name) != 0) - return 1; - } else if (prev_name || name) + if (new_name(ctx, prev_name)) return 1; if (opt.verbose) { @@ -595,26 +615,51 @@ static int new_attribute(ntfs_attr_search_ctx *ctx, return 0; } - -static void set_prev(char **prev_name, char *name, char *name_unused, - ATTR_TYPES *prev_atype, ATTR_TYPES atype) + +static void set_prev(char **prev_name, ATTR_TYPES *prev_atype, + char *name, ATTR_TYPES atype) { - if (*prev_name) - free(*prev_name); - *prev_name = name; - - free(name_unused); - + free_name(prev_name); + if (name) { + *prev_name = strdup(name); + if (!*prev_name) + perr_exit("strdup error"); + } + *prev_atype = atype; } +static void set_cmp_attr(ntfs_attr_search_ctx *ctx, ATTR_TYPES *atype, char **name) +{ + *atype = ctx->attr->type; + + free_name(name); + *name = get_attr_name_ctx(ctx); +} + +static int next_attr(ntfs_attr_search_ctx *ctx, ATTR_TYPES *atype, char **name, + int *err) +{ + int ret; + + ret = ntfs_attrs_walk(ctx); + *err = errno; + if (ret) { + *atype = AT_END; + free_name(name); + } else + set_cmp_attr(ctx, atype, name); + + return ret; +} + static int cmp_attributes(ntfs_inode *ni1, ntfs_inode *ni2) { int ret = -1; - int ret1 = 0, ret2 = 0; - int prev_first = 1; - char *prev_name = NULL, *name1, *name2; - ATTR_TYPES prev_atype, atype1, atype2; + int old_ret1, ret1 = 0, ret2 = 0; + int errno1 = 0, errno2 = 0; + char *prev_name = NULL, *name1 = NULL, *name2 = NULL; + ATTR_TYPES old_atype1, prev_atype = 0, atype1, atype2; ntfs_attr_search_ctx *ctx1, *ctx2; if (!(ctx1 = attr_get_search_ctx(ni1))) @@ -622,58 +667,52 @@ static int cmp_attributes(ntfs_inode *ni1, ntfs_inode *ni2) if (!(ctx2 = attr_get_search_ctx(ni2))) goto out; - atype1 = ctx1->attr->type; - atype2 = ctx2->attr->type; + set_cmp_attr(ctx1, &atype1, &name1); + set_cmp_attr(ctx2, &atype2, &name2); while (1) { - if (atype1 <= atype2) - ret1 = ntfs_attrs_walk(ctx1); - if (atype1 >= atype2) - ret2 = ntfs_attrs_walk(ctx2); - - atype1 = ctx1->attr->type; - atype2 = ctx2->attr->type; - name1 = get_attr_name_ctx(ctx1); - name2 = get_attr_name_ctx(ctx2); + + old_atype1 = atype1; + old_ret1 = ret1; + if (!ret1 && (atype1 <= atype2 || ret2)) + ret1 = next_attr(ctx1, &atype1, &name1, &errno1); + if (!ret2 && (old_atype1 >= atype2 || old_ret1)) + ret2 = next_attr(ctx2, &atype2, &name2, &errno2); print_attributes(ni1, atype1, atype2, name1, name2); - - if (atype1 != AT_END && atype2 != AT_END && ret1 != ret2) { - print_inode_ni(ni1); - printf("attribute_walk: %s != %s\n", - ret2string(ret1), ret2string(ret2)); + + if (ret1 && ret2) { + if (errno1 != errno2) { + print_inode_ni(ni1); + printf("attribute walk (errno): %d != %d\n", + errno1, errno2); + } break; } - if (atype1 == atype2) { - - if (atype1 == AT_END) - break; - - if (prev_first || new_attribute(ctx1, prev_atype, prev_name)) { - prev_first = 0; - cmp_attribute(ctx1, ctx2); - set_prev(&prev_name, name1, name2, &prev_atype, atype1); - } - - } else if (atype2 == AT_END || atype1 < atype2) { - if (prev_first || new_attribute(ctx1, prev_atype, prev_name)) { - prev_first = 0; + if (ret2 || atype1 < atype2) { + if (new_attribute(ctx1, prev_atype, prev_name)) { print_ctx(ctx1); printf("presence: EXISTS != MISSING\n"); - set_prev(&prev_name, name1, name2, &prev_atype, atype1); + set_prev(&prev_name, &prev_atype, name1, atype1); } - } else /* atype1 == AT_END || atype1 > atype2) */ { - if (prev_first || new_attribute(ctx2, prev_atype, prev_name)) { - prev_first = 0; + } else if (ret1 || atype1 > atype2) { + if (new_attribute(ctx2, prev_atype, prev_name)) { print_ctx(ctx2); printf("presence: MISSING != EXISTS \n"); - set_prev(&prev_name, name2, name1, &prev_atype, atype2); + set_prev(&prev_name, &prev_atype, name2, atype2); + } + + } else /* atype1 == atype2 */ { + if (new_attribute(ctx1, prev_atype, prev_name)) { + cmp_attribute(ctx1, ctx2); + set_prev(&prev_name, &prev_atype, name1, atype1); } } } + free_name(&prev_name); ret = 0; ntfs_attr_put_search_ctx(ctx2); out: @@ -796,6 +835,9 @@ int main(int argc, char **argv) if (cmp_inodes(vol1, vol2) != 0) exit(1); + ntfs_umount(vol1, FALSE); + ntfs_umount(vol2, FALSE); + exit(0); } From b1c1348d37d04137fb58a8171b075543cb52ec78 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 9 Oct 2005 13:35:15 +0000 Subject: [PATCH 2580/2994] fix build under cygwin if FSCTL_GET_NTFS_VOLUME_DATA is not defined --- libntfs/win32_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 50d65efb..e9ca9bd7 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -414,8 +414,8 @@ static s64 ntfs_device_win32_getdisklength(HANDLE handle) */ static s64 ntfs_device_win32_getntfssize(HANDLE handle) { -#ifdef FSCTL_GET_NTFS_VOLUME_DATA s64 rvl; +#ifdef FSCTL_GET_NTFS_VOLUME_DATA DWORD i; NTFS_VOLUME_DATA_BUFFER buf; From bf91f7c0fc094a361d01614a385002c4975a6746 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 10 Oct 2005 11:04:56 +0000 Subject: [PATCH 2581/2994] Apply patch from Christophe. --- configure.ac | 2 +- libntfs/volume.c | 11 +++++++++++ ntfsprogs/ntfsmount.c | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f62ed5d0..4037ec24 100644 --- a/configure.ac +++ b/configure.ac @@ -317,7 +317,7 @@ AC_FUNC_STAT AC_FUNC_STRFTIME AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF -AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \ +AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset realpath regcomp setlocale \ strcasecmp strchr strdup strerror strtol strtoul utime mbsinit \ setxattr getopt_long ]) diff --git a/libntfs/volume.c b/libntfs/volume.c index 984a06ae..b1adb11f 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1277,10 +1277,13 @@ int ntfs_umount(ntfs_volume *vol, static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) { struct mntent *mnt; +#ifdef HAVE_REALPATH char *real_file = NULL, *real_fsname = NULL; +#endif FILE *f; int err = 0; +#ifdef HAVE_REALPATH real_file = malloc(PATH_MAX + 1); if (!real_file) return -1; @@ -1293,15 +1296,21 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) err = errno; goto exit; } +#endif if (!(f = setmntent(MOUNTED, "r"))) { err = errno; goto exit; } while ((mnt = getmntent(f))) { +#ifdef HAVE_REALPATH if (!realpath(mnt->mnt_fsname, real_fsname)) continue; if (!strcmp(real_file, real_fsname)) break; +#else + if (!strcmp(file, mnt->mnt_fsname)) + break; +#endif } endmntent(f); if (!mnt) @@ -1314,10 +1323,12 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) *mnt_flags |= NTFS_MF_READONLY; #endif exit: +#ifdef HAVE_REALPATH if (real_file) free(real_file); if (real_fsname) free(real_fsname); +#endif if (err) { errno = err; return -1; diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index b615dc41..fccc175d 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1375,6 +1375,7 @@ static int parse_options(int argc, char *argv[]) err++; break; } +#ifdef HAVE_REALPATH /* We don't want relative path in /etc/mtab. */ if (argv[optind - 1][0] != '/') { if (!realpath(argv[optind - 1], @@ -1387,6 +1388,9 @@ static int parse_options(int argc, char *argv[]) } } else strcpy(opts.device, argv[optind - 1]); +#else + strcpy(opts.device, argv[optind - 1]); +#endif } else if (!opts.mnt_point) opts.mnt_point = argv[optind - 1]; else { From a40d7e55d6dab76715011b37c3052bf6adf34b72 Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 10 Oct 2005 12:55:11 +0000 Subject: [PATCH 2582/2994] - Revert patch from Christophe applied by Yura. - Provide a realpath() alternative for systems which do not have it. This is _much_ nicer as it avoids the horrible #ifdef gunk in the code... --- ChangeLog | 3 +++ configure.ac | 6 +++--- libntfs/volume.c | 25 ++++++++++++------------- ntfsprogs/ntfsmount.c | 14 ++++++++++---- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9cac5b8..db39b4c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,9 @@ into alternate chroot / other system still works. (Anton) - ntfscmp: fix some corner cases and all memory leaks; handle corrupt NTFS more gracefully. (Szaka) + - If the system does not have realpath(), supply our own dummy version + which just copies the string without any kind of checking or + expansion. (Anton) 07/10/2005 - 1.12.0 - Lots of fixes and enhancements! diff --git a/configure.ac b/configure.ac index 4037ec24..a68c7c90 100644 --- a/configure.ac +++ b/configure.ac @@ -317,9 +317,9 @@ AC_FUNC_STAT AC_FUNC_STRFTIME AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF -AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset realpath regcomp setlocale \ - strcasecmp strchr strdup strerror strtol strtoul utime mbsinit \ - setxattr getopt_long ]) +AC_CHECK_FUNCS([atexit fdatasync getopt_long hasmntopt mbsinit memmove memset \ + realpath regcomp setlocale setxattr strcasecmp strchr strdup strerror \ + strtol strtoul utime]) # Makefiles to be created by configure. AC_CONFIG_FILES([ diff --git a/libntfs/volume.c b/libntfs/volume.c index b1adb11f..92935a73 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1264,6 +1264,17 @@ int ntfs_umount(ntfs_volume *vol, } #ifdef HAVE_MNTENT_H + +#ifndef HAVE_REALPATH +/* If there is no realpath() on the system, provide a dummy one. */ +static char *realpath(const char *path, char *resolved_path) +{ + strncpy(resolved_path, path, PATH_MAX); + resolved_path[PATH_MAX] = '\0'; + return resolved_path; +} +#endif + /** * Internal: * @@ -1277,13 +1288,10 @@ int ntfs_umount(ntfs_volume *vol, static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) { struct mntent *mnt; -#ifdef HAVE_REALPATH char *real_file = NULL, *real_fsname = NULL; -#endif FILE *f; int err = 0; -#ifdef HAVE_REALPATH real_file = malloc(PATH_MAX + 1); if (!real_file) return -1; @@ -1296,21 +1304,15 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) err = errno; goto exit; } -#endif if (!(f = setmntent(MOUNTED, "r"))) { err = errno; goto exit; } while ((mnt = getmntent(f))) { -#ifdef HAVE_REALPATH if (!realpath(mnt->mnt_fsname, real_fsname)) continue; if (!strcmp(real_file, real_fsname)) break; -#else - if (!strcmp(file, mnt->mnt_fsname)) - break; -#endif } endmntent(f); if (!mnt) @@ -1323,12 +1325,9 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) *mnt_flags |= NTFS_MF_READONLY; #endif exit: -#ifdef HAVE_REALPATH - if (real_file) - free(real_file); + free(real_file); if (real_fsname) free(real_fsname); -#endif if (err) { errno = err; return -1; diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index fccc175d..408a987a 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1336,6 +1336,16 @@ static void usage(void) Eprintf("Default options are: \"%s\".\n", def_opts); } +#ifndef HAVE_REALPATH +/* If there is no realpath() on the system, provide a dummy one. */ +static char *realpath(const char *path, char *resolved_path) +{ + strncpy(resolved_path, path, PATH_MAX); + resolved_path[PATH_MAX] = '\0'; + return resolved_path; +} +#endif + /** * parse_options - Read and validate the programs command line * @@ -1375,7 +1385,6 @@ static int parse_options(int argc, char *argv[]) err++; break; } -#ifdef HAVE_REALPATH /* We don't want relative path in /etc/mtab. */ if (argv[optind - 1][0] != '/') { if (!realpath(argv[optind - 1], @@ -1388,9 +1397,6 @@ static int parse_options(int argc, char *argv[]) } } else strcpy(opts.device, argv[optind - 1]); -#else - strcpy(opts.device, argv[optind - 1]); -#endif } else if (!opts.mnt_point) opts.mnt_point = argv[optind - 1]; else { From f0ff7e83e47b3e44e6a43e39d284ec3891dc1eaf Mon Sep 17 00:00:00 2001 From: antona Date: Mon, 10 Oct 2005 13:04:33 +0000 Subject: [PATCH 2583/2994] Forgot to update the release date! --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index db39b4c6..4fddc474 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -08/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. +10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. - Fix hardcoded location for uninstalling mount.ntfs-fuse hardlink to match the relocatable location for installing it. (Anton, Szaka) From e44bb7afb7d2c270baaae5e06a4482585d48bba6 Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 11 Oct 2005 23:09:07 +0000 Subject: [PATCH 2584/2994] fix build bug - wouldn't build without DEBUG defined --- ntfsprogs/ntfscmp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index cbd6841e..0a47c343 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -123,7 +123,6 @@ static int err_exit(const char *fmt, ...) exit(1); } -#ifdef DEBUG /** * perr_exit * @@ -146,7 +145,6 @@ static int perr_exit(const char *fmt, ...) fflush(stderr); exit(1); } -#endif /* DEBUG */ /** * usage - Print a list of the parameters to the program From 42de4cf9055744aee297a2a5cfd0cc798bda2930 Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 12 Oct 2005 11:52:40 +0000 Subject: [PATCH 2585/2994] tidy up some __attribute__ usage --- ntfsprogs/mkntfs.c | 12 +++++------- ntfsprogs/ntfsclone.c | 18 +++++++----------- ntfsprogs/ntfscmp.c | 18 +++++++----------- ntfsprogs/ntfsdump_logfile.c | 17 ++++++++--------- ntfsprogs/ntfsfix.c | 4 ++-- ntfsprogs/ntfsmftalloc.c | 11 +++++------ ntfsprogs/ntfsresize.c | 18 +++++++----------- ntfsprogs/ntfstruncate.c | 12 +++++------- 8 files changed, 46 insertions(+), 64 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 577b2cbe..8293c71d 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -225,8 +225,7 @@ struct { /** * mkDprintf - debugging output (-vv); overridden by quiet (-q) */ -static void mkDprintf(const char *fmt, ...) - __attribute__((format(printf, 1, 2))); +__attribute__((format(printf, 1, 2))) static void mkDprintf(const char *fmt, ...) { va_list ap; @@ -262,9 +261,8 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * err_exit - error output and terminate; ignores quiet (-q) */ -static void err_exit(const char *fmt, ...) - __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); +__attribute__((noreturn)) +__attribute__((format(printf, 1, 2))) static void err_exit(const char *fmt, ...) { va_list ap; @@ -300,7 +298,7 @@ static void license(void) /** * usage - print a list of the parameters to the program */ -static void usage(void) __attribute__ ((noreturn)); +__attribute__ ((noreturn)) static void usage(void) { copyright(); @@ -987,7 +985,7 @@ static void dump_attr_record(ATTR_RECORD *a) /** * dump_mft_record */ -static void dump_mft_record(MFT_RECORD *m) __attribute__((unused)); +__attribute__((unused)) static void dump_mft_record(MFT_RECORD *m) { ATTR_RECORD *a; diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 68854179..1b31f14f 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -177,8 +177,7 @@ GEN_PRINTF(Vprintf, msg_out, &opt.verbose, TRUE) GEN_PRINTF(Qprintf, msg_out, &opt.quiet, FALSE) static GEN_PRINTF(Printf, msg_out, NULL, FALSE) -static void perr_printf(const char *fmt, ...) - __attribute__((format(printf, 1, 2))); +__attribute__((format(printf, 1, 2))) static void perr_printf(const char *fmt, ...) { va_list ap; @@ -192,8 +191,7 @@ static void perr_printf(const char *fmt, ...) fflush(msg_out); } -static void err_printf(const char *fmt, ...) - __attribute__((format(printf, 1, 2))); +__attribute__((format(printf, 1, 2))) static void err_printf(const char *fmt, ...) { va_list ap; @@ -205,9 +203,8 @@ static void err_printf(const char *fmt, ...) fflush(msg_out); } -static int err_exit(const char *fmt, ...) - __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); +__attribute__((noreturn)) +__attribute__((format(printf, 1, 2))) static int err_exit(const char *fmt, ...) { va_list ap; @@ -220,9 +217,8 @@ static int err_exit(const char *fmt, ...) exit(1); } -static int perr_exit(const char *fmt, ...) - __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); +__attribute__((noreturn)) +__attribute__((format(printf, 1, 2))) static int perr_exit(const char *fmt, ...) { va_list ap; @@ -238,7 +234,7 @@ static int perr_exit(const char *fmt, ...) } -static void usage(void) __attribute__((noreturn)); +__attribute__((noreturn)) static void usage(void) { Eprintf("\nUsage: %s [OPTIONS] SOURCE\n" diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index 0a47c343..95cd03db 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -67,8 +67,7 @@ GEN_PRINTF(Eprintf, stderr, NULL, FALSE) GEN_PRINTF(Vprintf, stdout, &opt.verbose, TRUE) GEN_PRINTF(Qprintf, stdout, NULL, FALSE) -static void perr_printf(int newline, const char *fmt, ...) - __attribute__((format(printf, 2, 3))); +__attribute__((format(printf, 2, 3))) static void perr_printf(int newline, const char *fmt, ...) { va_list ap; @@ -88,8 +87,7 @@ static void perr_printf(int newline, const char *fmt, ...) #define perr_print(...) perr_printf(0, __VA_ARGS__) #define perr_println(...) perr_printf(1, __VA_ARGS__) -static void err_printf(const char *fmt, ...) - __attribute__((format(printf, 1, 2))); +__attribute__((format(printf, 1, 2))) static void err_printf(const char *fmt, ...) { va_list ap; @@ -107,9 +105,8 @@ static void err_printf(const char *fmt, ...) * * Print and error message and exit the program. */ -static int err_exit(const char *fmt, ...) - __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); +__attribute__((noreturn)) +__attribute__((format(printf, 1, 2))) static int err_exit(const char *fmt, ...) { va_list ap; @@ -128,9 +125,8 @@ static int err_exit(const char *fmt, ...) * * Print and error message and exit the program */ -static int perr_exit(const char *fmt, ...) - __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); +__attribute__((noreturn)) +__attribute__((format(printf, 1, 2))) static int perr_exit(const char *fmt, ...) { va_list ap; @@ -153,7 +149,7 @@ static int perr_exit(const char *fmt, ...) * * Return: none */ -static void usage(void) __attribute__((noreturn)); +__attribute__((noreturn)) static void usage(void) { diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index b2602a78..24e2647c 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -120,10 +120,9 @@ static int logfile_close(logfile_file *logfile) * Use when you wish to exit and collate all the cleanups together. * if you don't have some parameter to pass, just pass NULL. */ -void device_err_exit(ntfs_volume *vol, ntfs_inode *ni, - ntfs_attr *na, const char *fmt, ...) __attribute__ ((noreturn)) - __attribute__ ((format(printf, 4, 5))); -void device_err_exit(ntfs_volume *vol, ntfs_inode *ni, +__attribute__ ((noreturn)) +__attribute__ ((format(printf, 4, 5))) +static void device_err_exit(ntfs_volume *vol, ntfs_inode *ni, ntfs_attr *na, const char *fmt, ...) { va_list ap; @@ -148,9 +147,9 @@ void device_err_exit(ntfs_volume *vol, ntfs_inode *ni, /** * log_err_exit - */ -void log_err_exit(u8 *buf, const char *fmt, ...) __attribute__ ((noreturn)) - __attribute__((format(printf, 2, 3))); -void log_err_exit(u8 *buf, const char *fmt, ...) +__attribute__ ((noreturn)) +__attribute__((format(printf, 2, 3))) +static void log_err_exit(u8 *buf, const char *fmt, ...) { va_list ap; @@ -169,8 +168,8 @@ void log_err_exit(u8 *buf, const char *fmt, ...) /** * usage - */ -void usage(const char *exec_name) __attribute__ ((noreturn)); -void usage(const char *exec_name) +__attribute__ ((noreturn)) +static void usage(const char *exec_name) { Eprintf("%s v%s (libntfs %s) - Interpret and display information " "about the journal\n($LogFile) of an NTFS volume.\n" diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 7cd574ad..eab2426d 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -95,7 +95,7 @@ struct { char *volume; } opt; -static int usage(void) __attribute__((noreturn)); +__attribute__((noreturn)) static int usage(void) { printf("%s v%s (libntfs %s)\n" @@ -113,7 +113,7 @@ static int usage(void) exit(1); } -static void version(void) __attribute__((noreturn)); +__attribute__((noreturn)) static void version(void) { printf("%s v%s\n\n" diff --git a/ntfsprogs/ntfsmftalloc.c b/ntfsprogs/ntfsmftalloc.c index 07f2a59a..5237d520 100644 --- a/ntfsprogs/ntfsmftalloc.c +++ b/ntfsprogs/ntfsmftalloc.c @@ -91,8 +91,7 @@ static struct { /** * mkDprintf - debugging output (-vv); overridden by quiet (-q) */ -static void mkDprintf(const char *fmt, ...) - __attribute__((format(printf, 1, 2))); +__attribute__((format(printf, 1, 2))) static void mkDprintf(const char *fmt, ...) { va_list ap; @@ -128,8 +127,8 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * err_exit - error output and terminate; ignores quiet (-q) */ -static void err_exit(const char *fmt, ...) __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); +__attribute__((noreturn)) +__attribute__((format(printf, 1, 2))) static void err_exit(const char *fmt, ...) { va_list ap; @@ -167,8 +166,8 @@ static void license(void) /** * usage - print a list of the parameters to the program */ -void usage(void) __attribute__ ((noreturn)); -void usage (void) +__attribute__ ((noreturn)) +static void usage (void) { copyright(); fprintf(stderr, "Usage: %s [options] device [base-mft-record]\n" diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index c3d5643f..a38fd5b7 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -220,8 +220,7 @@ static s64 rounded_up_division(s64 numer, s64 denom) * * Print an error message. */ -static void perr_printf(const char *fmt, ...) - __attribute__((format(printf, 1, 2))); +__attribute__((format(printf, 1, 2))) static void perr_printf(const char *fmt, ...) { va_list ap; @@ -236,8 +235,7 @@ static void perr_printf(const char *fmt, ...) fflush(stderr); } -static void err_printf(const char *fmt, ...) - __attribute__((format(printf, 1, 2))); +__attribute__((format(printf, 1, 2))) static void err_printf(const char *fmt, ...) { va_list ap; @@ -255,9 +253,8 @@ static void err_printf(const char *fmt, ...) * * Print and error message and exit the program. */ -static int err_exit(const char *fmt, ...) - __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); +__attribute__((noreturn)) +__attribute__((format(printf, 1, 2))) static int err_exit(const char *fmt, ...) { va_list ap; @@ -276,9 +273,8 @@ static int err_exit(const char *fmt, ...) * * Print and error message and exit the program */ -static int perr_exit(const char *fmt, ...) - __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); +__attribute__((noreturn)) +__attribute__((format(printf, 1, 2))) static int perr_exit(const char *fmt, ...) { va_list ap; @@ -301,7 +297,7 @@ static int perr_exit(const char *fmt, ...) * * Return: none */ -static void usage(void) __attribute__((noreturn)); +__attribute__((noreturn)) static void usage(void) { diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 2acd49d5..0b455e07 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -100,8 +100,7 @@ struct { /** * mkDprintf - debugging output (-vv); overridden by quiet (-q) */ -static void mkDprintf(const char *fmt, ...) - __attribute__((format(printf, 1, 2))); +__attribute__((format(printf, 1, 2))) static void mkDprintf(const char *fmt, ...) { va_list ap; @@ -137,9 +136,8 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * err_exit - error output and terminate; ignores quiet (-q) */ -static void err_exit(const char *fmt, ...) - __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); +__attribute__((noreturn)) +__attribute__((format(printf, 1, 2))) static void err_exit(const char *fmt, ...) { va_list ap; @@ -174,8 +172,8 @@ static void license(void) /** * usage - print a list of the parameters to the program */ -void usage(void) __attribute__ ((noreturn)); -void usage (void) +__attribute__ ((noreturn)) +static void usage (void) { copyright(); fprintf(stderr, "Usage: %s [options] device inode [attr-type " From 62f963608067cca2f8d919907035a4a628a4affd Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 13 Oct 2005 08:26:02 +0000 Subject: [PATCH 2586/2994] Temporarily disable use of the legal ansi character checking in libntfs/unistr.c::ntfs_names_collate() pending a proper fix at some point. (Anton) --- ChangeLog | 6 ++++++ configure.ac | 4 ++-- include/ntfs/unistr.h | 2 -- libntfs/unistr.c | 16 +++++++++++----- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4fddc474..1874e216 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +xx/xx/2005 - 1.12.2-WIP + + - Temporarily disable use of the legal ansi character checking in + libntfs/unistr.c::ntfs_names_collate() pending a proper fix at some + point. (Anton) + 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. - Fix hardcoded location for uninstalling mount.ntfs-fuse hardlink to diff --git a/configure.ac b/configure.ac index a68c7c90..6a63308e 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.12.1],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.12.2-WIP],[linux-ntfs-dev@lists.sourceforge.net]) # # Before making a release, the LTVERSION string should be modified. @@ -50,7 +50,7 @@ AC_INIT([ntfsprogs],[1.12.1],[linux-ntfs-dev@lists.sourceforge.net]) # # - If the interface is the same as the previous version, change to C:R+1:A # -LTVERSION_LIBNTFS="8:1:0" +LTVERSION_LIBNTFS="9:0:0" AC_SUBST(LTVERSION_LIBNTFS) AC_CANONICAL_HOST([]) diff --git a/include/ntfs/unistr.h b/include/ntfs/unistr.h index 7fdbc678..d5b22627 100644 --- a/include/ntfs/unistr.h +++ b/include/ntfs/unistr.h @@ -26,8 +26,6 @@ #include "types.h" #include "layout.h" -extern const u8 legal_ansi_char_array[0x40]; - extern BOOL ntfs_names_are_equal(const ntfschar *s1, size_t s1_len, const ntfschar *s2, size_t s2_len, const IGNORE_CASE_BOOL ic, const ntfschar *upcase, const u32 upcase_size); diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 79103627..529a2b9e 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -53,7 +53,8 @@ * This is used by the name collation functions to quickly determine what * characters are (in)valid. */ -const u8 legal_ansi_char_array[0x40] = { +#if 0 +static const u8 legal_ansi_char_array[0x40] = { 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, @@ -66,6 +67,7 @@ const u8 legal_ansi_char_array[0x40] = { 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x04, 0x16, 0x18, 0x16, 0x18, 0x18, }; +#endif /** * ntfs_names_are_equal - compare two Unicode names for equality @@ -118,8 +120,9 @@ BOOL ntfs_names_are_equal(const ntfschar *s1, size_t s1_len, */ int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, const ntfschar *name2, const u32 name2_len, - const int err_val, const IGNORE_CASE_BOOL ic, - const ntfschar *upcase, const u32 upcase_len) + const int err_val __attribute__((__unused__)), + const IGNORE_CASE_BOOL ic, const ntfschar *upcase, + const u32 upcase_len) { u32 cnt; ntfschar c1, c2; @@ -130,8 +133,7 @@ int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, exit(1); } #endif - for (cnt = 0; cnt < min(name1_len, name2_len); ++cnt) - { + for (cnt = 0; cnt < min(name1_len, name2_len); ++cnt) { c1 = le16_to_cpu(*name1); name1++; c2 = le16_to_cpu(*name2); @@ -142,8 +144,10 @@ int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, if (c2 < upcase_len) c2 = le16_to_cpu(upcase[c2]); } +#if 0 if (c1 < 64 && legal_ansi_char_array[c1] & 8) return err_val; +#endif if (c1 < c2) return -1; if (c1 > c2) @@ -154,9 +158,11 @@ int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, if (name1_len == name2_len) return 0; /* name1_len > name2_len */ +#if 0 c1 = le16_to_cpu(*name1); if (c1 < 64 && legal_ansi_char_array[c1] & 8) return err_val; +#endif return 1; } From b67fb5e78f192cf7999f1c92b1dc46c92622f245 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 09:15:46 +0000 Subject: [PATCH 2587/2994] Add a comment about the valid size for $EFS attribute value. --- include/ntfs/layout.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index b77b7b97..1bb72b35 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -2386,6 +2386,9 @@ typedef struct { * * Note all the below are best guesses so may have mistakes/inaccuracies. * Corrections/clarifications/additions are always welcome! + * + * Ntfs.sys takes an EFS value length of <= 0x54 or > 0x40000 to BSOD, i.e. it + * is invalid. */ /* The header of the 0x100 attribute named "$EFS". */ From c0b2d7dab287e512ffc38218652c3cda789d7141 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 09:53:36 +0000 Subject: [PATCH 2588/2994] Remove getgccver script and just use -dumpversion option to get the version directly inside configure.ac. --- ChangeLog | 3 +++ configure.ac | 4 ++-- getgccver | 10 ---------- 3 files changed, 5 insertions(+), 12 deletions(-) delete mode 100755 getgccver diff --git a/ChangeLog b/ChangeLog index 1874e216..242da058 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ xx/xx/2005 - 1.12.2-WIP - Temporarily disable use of the legal ansi character checking in libntfs/unistr.c::ntfs_names_collate() pending a proper fix at some point. (Anton) + - Remove getgccver script and just get the version with the simple gcc + option -dumpversion. I wish I had known about it earlier! Tested on + various architectures and versions from 2.95 to 4.0.1. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/configure.ac b/configure.ac index 6a63308e..d8052ee1 100644 --- a/configure.ac +++ b/configure.ac @@ -209,7 +209,7 @@ if test "$enable_crypto" != "no"; then fi ]) have_libgnutls=false - AM_PATH_LIBGNUTLS(1.2.3, [ have_libgnutls=true ], + AM_PATH_LIBGNUTLS(1.2.8, [ have_libgnutls=true ], [ if test "$enable_crypto" = "yes"; then AC_MSG_ERROR([Linux-NTFS crypto code requires the gnutls library.]) @@ -240,7 +240,7 @@ fi # Check for gcc version being >= 2.96. AC_MSG_CHECKING(version of $_cc) -cc_version=`$srcdir/getgccver $_cc` +cc_version=`$_cc -dumpversion` cc_major=`echo $cc_version | cut -d'.' -f1` cc_minor=`echo $cc_version | cut -d'.' -f2` if test -z "$cc_version"; then diff --git a/getgccver b/getgccver deleted file mode 100755 index a0e6e22e..00000000 --- a/getgccver +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -if test -z "$1"; then - echo "This program is only to be run by the ./configure script." - exit 1 -fi - -# Get the gcc version. Can't do this in configure.ac as automake refuses to -# preserve the square brackets while generating the configure script. -$1 --version 2>&1 | head -n 1 | sed s/"egcs-"// | sed s/"gcc (GCC) \([0-9]\.[0-9]*\).*"/"\1"/ From be4c70b45eb8cf8a928c66b202b72270c04345c9 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 10:16:26 +0000 Subject: [PATCH 2589/2994] Argh, found one compiler that gives a minor version including text so cut it off the versions. --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d8052ee1..b7ba7d78 100644 --- a/configure.ac +++ b/configure.ac @@ -240,9 +240,9 @@ fi # Check for gcc version being >= 2.96. AC_MSG_CHECKING(version of $_cc) -cc_version=`$_cc -dumpversion` -cc_major=`echo $cc_version | cut -d'.' -f1` -cc_minor=`echo $cc_version | cut -d'.' -f2` +cc_version=`$_cc -dumpversion 2> /dev/null | head -n 1` +cc_major=`echo $cc_version | cut -d'.' -f1 | sed s/"^\([0-9]+\).*$"/"\1"/` +cc_minor=`echo $cc_version | cut -d'.' -f2 | sed s/"^\([0-9]+\).*$"/"\1"/` if test -z "$cc_version"; then cc_version="v. ?.??" cc_major=1 From 01a929556c35be098f3e780d31535385e8d113d1 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 11:14:43 +0000 Subject: [PATCH 2590/2994] Re-add getgccver but a completely different version. This is to cope with all OS I tried it on (Solaris, OSX, Linux, NetBSD, FreeBSD) and various gcc flavours including weird ones like "3.5-blah". --- configure.ac | 6 +++--- getgccver | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100755 getgccver diff --git a/configure.ac b/configure.ac index b7ba7d78..9bd8f5ba 100644 --- a/configure.ac +++ b/configure.ac @@ -240,9 +240,9 @@ fi # Check for gcc version being >= 2.96. AC_MSG_CHECKING(version of $_cc) -cc_version=`$_cc -dumpversion 2> /dev/null | head -n 1` -cc_major=`echo $cc_version | cut -d'.' -f1 | sed s/"^\([0-9]+\).*$"/"\1"/` -cc_minor=`echo $cc_version | cut -d'.' -f2 | sed s/"^\([0-9]+\).*$"/"\1"/` +cc_version=`getgccver $_cc version` +cc_major=`getgccver $_cc major` +cc_minor=`getgccver $_cc minor` if test -z "$cc_version"; then cc_version="v. ?.??" cc_major=1 diff --git a/getgccver b/getgccver new file mode 100755 index 00000000..ccae864a --- /dev/null +++ b/getgccver @@ -0,0 +1,27 @@ +#!/bin/sh + +if test -z "$1"; then + echo "This program is only to be run by the ./configure script." + exit 1 +fi + +# Get the gcc version. Can't do this in configure.ac as automake refuses to +# preserve the square brackets while generating the configure script. +ver_str=`$1 -dumpversion 2> /dev/null | head -n 1` + +case $2 in +version) + echo ${ver_str} + ;; +major) + echo `echo ${ver_str} | cut -d'.' -f1 | sed s/"^\([0-9]*\).*$"/"\1"/` + ;; +minor) + echo `echo ${ver_str} | cut -d'.' -f2 | sed s/"^\([0-9]*\).*$"/"\1"/` + ;; +*) + echo "This program is only to be run by the ./configure script." + exit 1 + ;; +esac +exit 0 From 9c062a85316d26addebd1c725e61feabcb670687 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 11:16:32 +0000 Subject: [PATCH 2591/2994] Update changelog --- ChangeLog | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 242da058..c1d44e01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,9 +3,9 @@ xx/xx/2005 - 1.12.2-WIP - Temporarily disable use of the legal ansi character checking in libntfs/unistr.c::ntfs_names_collate() pending a proper fix at some point. (Anton) - - Remove getgccver script and just get the version with the simple gcc - option -dumpversion. I wish I had known about it earlier! Tested on - various architectures and versions from 2.95 to 4.0.1. (Anton) + - Rewrite gcc version detection logic using the -dumpversion option. + Tested on various OS and architectures and gcc versions from 2.95 to + 4.0.1 with some weird ones like 3.5-blah thrown in, too. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. From bc4bee7b2fc786eaa5190678c778d91744ae551a Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 11:33:42 +0000 Subject: [PATCH 2592/2994] Fix bogus le16_to_cpu() which shouldbe le32_to_cpu() when accessing the attribute list entry attribute type in some places in libntfs/attrib.c. (Anton) --- ChangeLog | 3 +++ libntfs/attrib.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c1d44e01..94fe6811 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ xx/xx/2005 - 1.12.2-WIP - Rewrite gcc version detection logic using the -dumpversion option. Tested on various OS and architectures and gcc versions from 2.95 to 4.0.1 with some weird ones like 3.5-blah thrown in, too. (Anton) + - Fix bogus le16_to_cpu() which shouldbe le32_to_cpu() when accessing + the attribute list entry attribute type in some places in + libntfs/attrib.c. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 7dc79568..8ca7e857 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1813,8 +1813,8 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const ntfschar *name, * attribute. */ if ((type == AT_UNUSED) && is_first_search && - le16_to_cpu(al_entry->type) > - le16_to_cpu(AT_ATTRIBUTE_LIST)) + le32_to_cpu(al_entry->type) > + le32_to_cpu(AT_ATTRIBUTE_LIST)) goto find_attr_list_attr; } else { al_entry = (ATTR_LIST_ENTRY*)((char*)ctx->al_entry + @@ -1825,10 +1825,10 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const ntfschar *name, * attribute list attribute from the base mft record as it is * not listed in the attribute list itself. */ - if ((type == AT_UNUSED) && le16_to_cpu(ctx->al_entry->type) < - le16_to_cpu(AT_ATTRIBUTE_LIST) && - le16_to_cpu(al_entry->type) > - le16_to_cpu(AT_ATTRIBUTE_LIST)) { + if ((type == AT_UNUSED) && le32_to_cpu(ctx->al_entry->type) < + le32_to_cpu(AT_ATTRIBUTE_LIST) && + le32_to_cpu(al_entry->type) > + le32_to_cpu(AT_ATTRIBUTE_LIST)) { int rc; find_attr_list_attr: From a3ab2bc6a066b0d318d1688e19e43cce2ef0c120 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 11:34:26 +0000 Subject: [PATCH 2593/2994] Fix stupidity. --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 9bd8f5ba..e28a861e 100644 --- a/configure.ac +++ b/configure.ac @@ -240,9 +240,9 @@ fi # Check for gcc version being >= 2.96. AC_MSG_CHECKING(version of $_cc) -cc_version=`getgccver $_cc version` -cc_major=`getgccver $_cc major` -cc_minor=`getgccver $_cc minor` +cc_version=`$srcdir/getgccver $_cc version` +cc_major=`$srcdir/getgccver $_cc major` +cc_minor=`$srcdir/getgccver $_cc minor` if test -z "$cc_version"; then cc_version="v. ?.??" cc_major=1 From e46d4e8959279c24830922d0e4ad94280af38f31 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 20:52:41 +0000 Subject: [PATCH 2594/2994] Fix silly bug introduced in 1.12.0 which breaks ntfsfix (and others possibly) when calling ntfs_attr_lookup() with AT_UNNAMED name and no ntfs inode in the search context. (Anton) --- ChangeLog | 3 +++ libntfs/attrib.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 94fe6811..7dd7c838 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,9 @@ xx/xx/2005 - 1.12.2-WIP - Fix bogus le16_to_cpu() which shouldbe le32_to_cpu() when accessing the attribute list entry attribute type in some places in libntfs/attrib.c. (Anton) + - Fix silly bug introduced in 1.12.0 which breaks ntfsfix (and others + possibly) when calling ntfs_attr_lookup() with AT_UNNAMED name and + no ntfs inode in the search context. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 8ca7e857..4578f3ad 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1576,7 +1576,7 @@ static int ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, upcase = vol->upcase; upcase_len = vol->upcase_len; } else { - if (name) { + if (name && name != AT_UNNAMED) { errno = EINVAL; return -1; } @@ -2187,9 +2187,9 @@ int ntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name, ntfs_volume *vol; ntfs_inode *base_ni; - if (!ctx || !ctx->mrec || !ctx->attr || (name && (!ctx->ntfs_ino || - !(vol = ctx->ntfs_ino->vol) || !vol->upcase || - !vol->upcase_len))) { + if (!ctx || !ctx->mrec || !ctx->attr || (name && name != AT_UNNAMED && + (!ctx->ntfs_ino || !(vol = ctx->ntfs_ino->vol) || + !vol->upcase || !vol->upcase_len))) { errno = EINVAL; return -1; } From b9422552da36367dd28a682378af8f5627f5eda2 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 21:26:16 +0000 Subject: [PATCH 2595/2994] Fix compilation on OSX in ntfsresize.c where stderr = stdout is not legal (but happens to work on Linux) to do proper low-level file descriptor mangling which is portable. (Anton) --- ChangeLog | 3 +++ ntfsprogs/ntfsresize.c | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7dd7c838..3f012666 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ xx/xx/2005 - 1.12.2-WIP - Fix silly bug introduced in 1.12.0 which breaks ntfsfix (and others possibly) when calling ntfs_attr_lookup() with AT_UNNAMED name and no ntfs inode in the search context. (Anton) + - Fix compilation on OSX in ntfsresize.c where stderr = stdout is not + legal (but happens to work on Linux) to do proper low-level file + descriptor mangling which is portable. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index a38fd5b7..1d1f23a6 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -523,12 +523,20 @@ static int parse_options(int argc, char **argv) } } - stderr = stdout; + /* Redirect stderr to stdout, note fflush()es are essential! */ + fflush(stdout); + fflush(stderr); + if (dup2(STDOUT_FILENO, STDERR_FILENO) == -1) { + perror("Failed to redirect stderr to stdout"); + exit(1); + } + fflush(stdout); + fflush(stderr); #ifdef DEBUG if (!opt.debug) - if (!(stderr = fopen("/dev/null", "rw"))) - perr_exit("Couldn't open /dev/null"); + if (!freopen("/dev/null", "w", stderr)) + perr_exit("Failed to redirect stderr to /dev/null"); #endif if (ver) From f5961c075e348c283a32e69c9619100395909513 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 21:44:17 +0000 Subject: [PATCH 2596/2994] - Fix compilation on OSX in ntfsclone.c where stderr = stdout is not legal (but happens to work on Linux) to do proper low-level file descriptor mangling which is portable. (Anton) - Add test/runlist-data to EXTRA_DIST so it gets included in the distribution otherwise make test fails on released sources. Solution is not perfect as it also adds the test/runlist-data/CVS directory but it will do at least for me. (Anton) --- ChangeLog | 10 +++++++--- ntfsprogs/ntfsclone.c | 20 +++++++++++++++----- test/Makefile.am | 2 ++ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f012666..03e77e15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,9 +12,13 @@ xx/xx/2005 - 1.12.2-WIP - Fix silly bug introduced in 1.12.0 which breaks ntfsfix (and others possibly) when calling ntfs_attr_lookup() with AT_UNNAMED name and no ntfs inode in the search context. (Anton) - - Fix compilation on OSX in ntfsresize.c where stderr = stdout is not - legal (but happens to work on Linux) to do proper low-level file - descriptor mangling which is portable. (Anton) + - Fix compilation on OSX in ntfsresize.c and ntfsclone.c where stderr = + stdout is not legal (but happens to work on Linux) to do proper + low-level file descriptor mangling which is portable. (Anton) + - Add test/runlist-data to EXTRA_DIST so it gets included in the + distribution otherwise make test fails on released sources. Solution + is not perfect as it also adds the test/runlist-data/CVS directory + but it will do at least for me. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 1b31f14f..32734e57 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -387,11 +387,21 @@ static void parse_options(int argc, char **argv) and for the uncontrollable verbose messages in libntfs. Ughhh. */ if (opt.std_out) msg_out = stderr; - else if (opt.debug) - stderr = stdout; - else - if (!(stderr = fopen("/dev/null", "rw"))) - perr_exit("Couldn't open /dev/null"); + else if (opt.debug) { + /* Redirect stderr to stdout, note fflush()es are essential! */ + fflush(stdout); + fflush(stderr); + if (dup2(STDOUT_FILENO, STDERR_FILENO) == -1) { + perror("Failed to redirect stderr to stdout"); + exit(1); + } + fflush(stdout); + fflush(stderr); + } else { + fflush(stderr); + if (!freopen("/dev/null", "w", stderr)) + perr_exit("Failed to redirect stderr to /dev/null"); + } } static void progress_init(struct progress_bar *p, u64 start, u64 stop, int res) diff --git a/test/Makefile.am b/test/Makefile.am index 09dcfca7..8ea5ea5d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -15,6 +15,8 @@ LINK=$(STATIC_LINK) $(LIBTOOL_LINK) bin_PROGRAMS = runlist +EXTRA_DIST = runlist-data + CLEANFILES = attr[123].bin frag[123][123][123] pure-[cn][ms] zero MAINTAINERCLEANFILES = Makefile.in From da1495a11d8331fb8ae6d8b41661132adafad657 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 21:48:37 +0000 Subject: [PATCH 2597/2994] Fix compilation on OSX in ntfscmp.c where stderr = stdout is not legal (but happens to work on Linux) to do portable low-level file descriptor mangling. --- ChangeLog | 6 +++--- ntfsprogs/ntfscmp.c | 15 +++++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 03e77e15..cdf35a96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,9 +12,9 @@ xx/xx/2005 - 1.12.2-WIP - Fix silly bug introduced in 1.12.0 which breaks ntfsfix (and others possibly) when calling ntfs_attr_lookup() with AT_UNNAMED name and no ntfs inode in the search context. (Anton) - - Fix compilation on OSX in ntfsresize.c and ntfsclone.c where stderr = - stdout is not legal (but happens to work on Linux) to do proper - low-level file descriptor mangling which is portable. (Anton) + - Fix compilation on OSX in ntfsresize.c, ntfsclone.c, and ntfscmp.c + where stderr = stdout is not legal (but happens to work on Linux) to + do portable low-level file descriptor mangling. (Anton) - Add test/runlist-data to EXTRA_DIST so it gets included in the distribution otherwise make test fails on released sources. Solution is not perfect as it also adds the test/runlist-data/CVS directory diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index 95cd03db..13ab60bb 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -224,13 +224,20 @@ static void parse_options(int argc, char **argv) usage(); } - stderr = stdout; + /* Redirect stderr to stdout, note fflush()es are essential! */ + fflush(stdout); + fflush(stderr); + if (dup2(STDOUT_FILENO, STDERR_FILENO) == -1) { + perror("Failed to redirect stderr to stdout"); + exit(1); + } + fflush(stdout); + fflush(stderr); #ifdef DEBUG if (!opt.debug) - if (!(stderr = fopen("/dev/null", "rw"))) - perr_exit("Couldn't open /dev/null"); - + if (!freopen("/dev/null", "w", stderr)) + perr_exit("Failed to redirect stderr to /dev/null"); #endif } From 3adf9237669cb7ae0e178469ca190660149b6d30 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 22:30:20 +0000 Subject: [PATCH 2598/2994] Fix compilation and warnings in ntfsdecrypt.c on OSX/gcc4.0.1. The compilation failure was because we use strnlen() which is gnu specific and not present on my current version of OSX so ntfsdecrypt now provides own version if it is not present on system. (Anton) --- ChangeLog | 6 +++++- configure.ac | 6 +++--- ntfsprogs/ntfsdecrypt.c | 32 +++++++++++++++++++++++++------- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index cdf35a96..2239e235 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,7 +6,7 @@ xx/xx/2005 - 1.12.2-WIP - Rewrite gcc version detection logic using the -dumpversion option. Tested on various OS and architectures and gcc versions from 2.95 to 4.0.1 with some weird ones like 3.5-blah thrown in, too. (Anton) - - Fix bogus le16_to_cpu() which shouldbe le32_to_cpu() when accessing + - Fix bogus le16_to_cpu() which should be le32_to_cpu() when accessing the attribute list entry attribute type in some places in libntfs/attrib.c. (Anton) - Fix silly bug introduced in 1.12.0 which breaks ntfsfix (and others @@ -19,6 +19,10 @@ xx/xx/2005 - 1.12.2-WIP distribution otherwise make test fails on released sources. Solution is not perfect as it also adds the test/runlist-data/CVS directory but it will do at least for me. (Anton) + - Fix compilation and warnings in ntfsdecrypt.c on OSX/gcc4.0.1. The + compilation failure was because we use strnlen() which is gnu + specific and not present on my current version of OSX so ntfsdecrypt + now provides own version if it is not present on system. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/configure.ac b/configure.ac index e28a861e..ff4576a9 100644 --- a/configure.ac +++ b/configure.ac @@ -317,9 +317,9 @@ AC_FUNC_STAT AC_FUNC_STRFTIME AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF -AC_CHECK_FUNCS([atexit fdatasync getopt_long hasmntopt mbsinit memmove memset \ - realpath regcomp setlocale setxattr strcasecmp strchr strdup strerror \ - strtol strtoul utime]) +AC_CHECK_FUNCS([atexit dup2 fdatasync getopt_long hasmntopt mbsinit memmove \ + memset realpath regcomp setlocale setxattr strcasecmp strchr strdup \ + strerror strnlen strtol strtoul utime]) # Makefiles to be created by configure. AC_CONFIG_FILES([ diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index cb0af987..2e19ecc3 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -368,7 +368,8 @@ static void ntfs_crypto_deinit(void) static ntfs_rsa_private_key ntfs_rsa_private_key_import_from_gnutls( gnutls_x509_privkey_t priv_key) { - int i, j, tmp_size; + int i, j; + size_t tmp_size; gnutls_datum_t rd[6]; gcry_mpi_t rm[6]; gcry_sexp_t rsa_key; @@ -577,6 +578,21 @@ static inline void ntfs_buffer_reverse(u8 *buf, unsigned buf_size) } } +#ifndef HAVE_STRNLEN +/** + * * strnlen - strnlen is a gnu extension so emulate it if not present + * */ +static size_t strnlen(const char *s, size_t maxlen) +{ + const char *p, *end; + + /* Look for a '\0' character. */ + for (p = s, end = s + maxlen; p < end && *p; p++) + ; + return p - s; +} +#endif /* ! HAVE_STRNLEN */ + /** * ntfs_raw_fek_decrypt - * @@ -648,7 +664,7 @@ static unsigned ntfs_raw_fek_decrypt(u8 *fek, u32 fek_size, * Finally, remove the PKCS#1 padding and return the size of the * decrypted FEK. */ - padding = strnlen(fek, size) + 1; + padding = strnlen((char *)fek, size) + 1; if (padding > size) { fprintf(stderr, "Failed to remove PKCS#1 padding from " "decrypted file encryption key.\n"); @@ -669,8 +685,8 @@ static unsigned ntfs_raw_fek_decrypt(u8 *fek, u32 fek_size, static gcry_error_t ntfs_desx_key_expand(const u8 *src, u32 *des_key, u64 *out_whitening, u64 *in_whitening) { - static const u8 *salt1 = "Dan Simon "; - static const u8 *salt2 = "Scott Field"; + static const u8 *salt1 = (const u8*)"Dan Simon "; + static const u8 *salt2 = (const u8*)"Scott Field"; static const int salt_len = 12; gcry_md_hd_t hd1, hd2; u32 *md; @@ -1107,7 +1123,7 @@ static int ntfs_fek_decrypt_sector(ntfs_fek *fek, u8 *data, const u64 offset) static int ntfs_cat_decrypt(ntfs_inode *inode, ntfs_fek *fek) { int bufsize = 512; - char *buffer; + unsigned char *buffer; ntfs_attr *attr; s64 bytes_read, written, offset, total; s64 old_data_size, old_initialized_size; @@ -1176,12 +1192,14 @@ static int ntfs_cat_decrypt(ntfs_inode *inode, ntfs_fek *fek) */ int main(int argc, char *argv[]) { - u8 *pfx_buf, *password; + u8 *pfx_buf; + char *password; ntfs_rsa_private_key rsa_key; ntfs_volume *vol; ntfs_inode *inode; ntfs_fek *fek; - int pfx_size, res; + unsigned pfx_size; + int res; if (!parse_options(argc, argv)) return 1; From 1d4958d38c9ce12a00adf332d3108c26b55385e5 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 23:13:49 +0000 Subject: [PATCH 2599/2994] Fix endianness bug (le16 instead of le32 when accessing mft record bytes_in_use) in volume.c::ntfs_volume_write_flags() and ntfsfix.c::OLD_ntfs_volume_set_flags(). (Anton) --- ChangeLog | 3 +++ libntfs/volume.c | 6 +++--- ntfsprogs/ntfsfix.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2239e235..f61d5105 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,9 @@ xx/xx/2005 - 1.12.2-WIP compilation failure was because we use strnlen() which is gnu specific and not present on my current version of OSX so ntfsdecrypt now provides own version if it is not present on system. (Anton) + - Fix endianness bug (le16 instead of le32 when accessing mft record + bytes_in_use) in volume.c::ntfs_volume_write_flags() and + ntfsfix.c::OLD_ntfs_volume_set_flags(). (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/volume.c b/libntfs/volume.c index 92935a73..8c1108aa 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1509,9 +1509,9 @@ int ntfs_volume_write_flags(ntfs_volume *vol, const u16 flags) /* Get a pointer to the value of the attribute. */ c = (VOLUME_INFORMATION*)(le16_to_cpu(a->value_offset) + (char*)a); /* Sanity checks. */ - if ((char*)c + le32_to_cpu(a->value_length) > - le16_to_cpu(ctx->mrec->bytes_in_use) + - (char*)ctx->mrec || le16_to_cpu(a->value_offset) + + if ((char*)c + le32_to_cpu(a->value_length) > (char*)ctx->mrec + + le32_to_cpu(ctx->mrec->bytes_in_use) || + le16_to_cpu(a->value_offset) + le32_to_cpu(a->value_length) > le32_to_cpu(a->length)) { Dputs("Error: Attribute $VOLUME_INFORMATION in $Volume is " "corrupt!"); diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index eab2426d..de871a95 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -210,7 +210,7 @@ static int OLD_ntfs_volume_set_flags(ntfs_volume *vol, const u16 flags) c = (VOLUME_INFORMATION*)(le16_to_cpu(a->value_offset) + (char*)a); /* Sanity checks. */ if ((char*)c + le32_to_cpu(a->value_length) > - le16_to_cpu(m->bytes_in_use) + (char*)m || + (char*)m + le32_to_cpu(m->bytes_in_use) || le16_to_cpu(a->value_offset) + le32_to_cpu(a->value_length) > le32_to_cpu(a->length)) { Dputs("Error: Attribute $VOLUME_INFORMATION in $Volume is " From 6803fa4b7665b3420b0df110776af4a6fc074066 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 23:44:57 +0000 Subject: [PATCH 2600/2994] Fix endianness bug in ntfsinfo. (Anton) --- ChangeLog | 1 + include/ntfs/layout.h | 6 ++---- ntfsprogs/ntfsinfo.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f61d5105..1b3dbaef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,7 @@ xx/xx/2005 - 1.12.2-WIP - Fix endianness bug (le16 instead of le32 when accessing mft record bytes_in_use) in volume.c::ntfs_volume_write_flags() and ntfsfix.c::OLD_ntfs_volume_set_flags(). (Anton) + - Fix endianness bug in ntfsinfo. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 1bb72b35..44608924 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -292,10 +292,8 @@ typedef enum { * The _LE versions are to be applied on little endian MFT_REFs. * Note: The _LE versions will return a CPU endian formatted value! */ -typedef enum { - MFT_REF_MASK_CPU = 0x0000ffffffffffffULL, - MFT_REF_MASK_LE = const_cpu_to_le64(0x0000ffffffffffffULL), -} MFT_REF_CONSTS; +#define MFT_REF_MASK_CPU 0x0000ffffffffffffULL +#define MFT_REF_MASK_LE const_cpu_to_le64(MFT_REF_MASK_CPU) typedef u64 MFT_REF; diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index b5751796..24041cbd 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1882,7 +1882,7 @@ int main(int argc, char **argv) if (opts.filename) { inode = ntfs_pathname_to_inode(vol, NULL, opts.filename); } else { - inode = ntfs_inode_open(vol, MK_LE_MREF(opts.inode, 0)); + inode = ntfs_inode_open(vol, MK_MREF(opts.inode, 0)); } /* dump the inode information */ From 85c866fceaaea43fdf7b7ee9a5ca8dbd08894097 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 15 Oct 2005 23:51:13 +0000 Subject: [PATCH 2601/2994] More endianness fixes! --- ntfsprogs/ntfsinfo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 24041cbd..3e941f8f 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -807,7 +807,7 @@ static void ntfs_dump_acl(const char *prefix,ACL *acl) ace = (ACCESS_ALLOWED_ACE *)((char *)acl + 8); /* iterate through ACE's */ - for (i=0;iace_count;i++) { + for (i=1;icontrol); sid = ntfs_sid_to_mbs((SID *)((char *)sec_desc_attr + - sec_desc_attr->owner), NULL, 0); + le32_to_cpu(sec_desc_attr->owner)), NULL, 0); printf("\tOwner SID:\t\t %s\n",sid); free(sid); sid = ntfs_sid_to_mbs((SID *)((char *)sec_desc_attr + - sec_desc_attr->group), NULL, 0); + le32_to_cpu(sec_desc_attr->group)), NULL, 0); printf("\tGroup SID:\t\t %s\n",sid); free(sid); @@ -909,7 +909,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v } printf("\n"); ntfs_dump_acl("\t\t",(ACL *)((char *)sec_desc_attr + - sec_desc_attr->sacl)); + le32_to_cpu(sec_desc_attr->sacl))); } else { printf("missing\n"); } @@ -921,7 +921,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v } printf("\n"); ntfs_dump_acl("\t\t",(ACL *)((char *)sec_desc_attr + - sec_desc_attr->dacl)); + le32_to_cpu(sec_desc_attr->dacl))); } else { printf("missing\n"); } From a570ee7b373839681d4c86c1bfb0df0f551a9f1c Mon Sep 17 00:00:00 2001 From: antona Date: Sun, 16 Oct 2005 00:07:14 +0000 Subject: [PATCH 2602/2994] Fix endiannes bug in libntfs/index.c. (Anton) --- ChangeLog | 3 ++- libntfs/index.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b3dbaef..9d3342ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,7 +26,8 @@ xx/xx/2005 - 1.12.2-WIP - Fix endianness bug (le16 instead of le32 when accessing mft record bytes_in_use) in volume.c::ntfs_volume_write_flags() and ntfsfix.c::OLD_ntfs_volume_set_flags(). (Anton) - - Fix endianness bug in ntfsinfo. (Anton) + - Fix endianness bugs in ntfsinfo. (Anton) + - Fix endianness bug in libntfs/index.c. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/index.c b/libntfs/index.c index 36dcdc91..41786e6f 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -207,7 +207,7 @@ int ntfs_index_lookup(const void *key, const int key_len, le16_to_cpu(actx->attr->value_offset)); index_end = (u8*)&ir->index + le32_to_cpu(ir->index.index_length); /* Save index block size for future use. */ - ictx->block_size = ir->index_block_size; + ictx->block_size = le32_to_cpu(ir->index_block_size); /* Get collation rule type and validate it. */ cr = ir->collation_rule; if (!ntfs_is_collation_rule_supported(cr)) { From 48feb16fa98cf756aeaf82cd4ab570e6830ae130 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 16 Oct 2005 11:12:08 +0000 Subject: [PATCH 2603/2994] Factor out cluster allocation check --- ntfsprogs/ntfsresize.c | 46 ++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 1d1f23a6..3cf36ae1 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2330,6 +2330,31 @@ static void check_resize_constraints(ntfs_resize_t *resize) print_num_of_relocations(resize); } +static void check_cluster_allocation(ntfs_volume *vol, ntfsck_t *fsck) +{ + memset(fsck, 0, sizeof(ntfsck_t)); + + if (opt.show_progress) + fsck->flags |= NTFSCK_PROGBAR; + + if (setup_lcn_bitmap(&fsck->lcn_bitmap, vol->nr_clusters) != 0) + perr_exit("Failed to setup allocation bitmap"); + if (build_allocation_bitmap(vol, fsck) != 0) + exit(1); + if (fsck->outsider || fsck->multi_ref) { + err_printf("Filesystem check failed!\n"); + if (fsck->outsider) + err_printf("%d clusters are referenced outside " + "of the volume.\n", fsck->outsider); + if (fsck->multi_ref) + err_printf("%d clusters are referenced multiply" + " times.\n", fsck->multi_ref); + printf("%s", corrupt_volume_msg); + exit(1); + } + + compare_bitmaps(vol, &fsck->lcn_bitmap); +} int main(int argc, char **argv) { @@ -2388,26 +2413,7 @@ int main(int argc, char **argv) exit(0); } - memset(&fsck, 0, sizeof(fsck)); - if (opt.show_progress) - fsck.flags |= NTFSCK_PROGBAR; - - if (setup_lcn_bitmap(&fsck.lcn_bitmap, vol->nr_clusters) != 0) - perr_exit("Failed to setup allocation bitmap"); - if (build_allocation_bitmap(vol, &fsck) != 0) - exit(1); - if (fsck.outsider || fsck.multi_ref) { - err_printf("Filesystem check failed!\n"); - if (fsck.outsider) - err_printf("%d clusters are referenced outside " - "of the volume.\n", fsck.outsider); - if (fsck.multi_ref) - err_printf("%d clusters are referenced multiply" - " times.\n", fsck.multi_ref); - printf("%s", corrupt_volume_msg); - exit(1); - } - compare_bitmaps(vol, &fsck.lcn_bitmap); + check_cluster_allocation(vol, &fsck); print_disk_usage(vol, fsck.inuse); From 27a9764d3a071e500c2f89d0d1b5938a71a7da4b Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 16 Oct 2005 18:50:56 +0000 Subject: [PATCH 2604/2994] Check and report bad sectors before cluster allocation check because chkdsk doesn't always fix $Bitmap with bad sectors --- ChangeLog | 4 +- ntfsprogs/ntfsresize.c | 96 +++++++++++++++++++++++++++++------------- 2 files changed, 70 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d3342ac..84f8699d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,7 +28,9 @@ xx/xx/2005 - 1.12.2-WIP ntfsfix.c::OLD_ntfs_volume_set_flags(). (Anton) - Fix endianness bugs in ntfsinfo. (Anton) - Fix endianness bug in libntfs/index.c. (Anton) - + - ntfsresize: check and report bad sectors before cluster allocation + check because chkdsk doesn't fix $Bitmap with bad sectors. (Szaka) + 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. - Fix hardcoded location for uninstalling mount.ntfs-fuse hardlink to diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 3cf36ae1..67b4c185 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -692,13 +692,6 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) if ((ret = has_bad_sectors(resize, 1)) != 0) { if (ret == -1) exit(1); - if (NInoAttrList(resize->ni)) - err_exit("Hopelessly many bad sectors! Not supported."); - if (resize->badclusters == 0) - printf("WARNING: The disk has bad sector! " - "This can cause reliability problems!\n"); - resize->badclusters += last_lcn - rl->lcn + 1; - Vprintf("Bad clusters: %8lld - %lld\n", rl->lcn, last_lcn); return; } @@ -1773,7 +1766,7 @@ static void relocate_inodes(ntfs_resize_t *resize) if (highest_vcn == resize->mft_highest_vcn) err_exit("Sanity check failed! Highest_vcn = %lld. " - "Please report!", highest_vcn); + "Please report!\n", highest_vcn); } done: if (resize->mrec) @@ -2039,6 +2032,56 @@ static void lookup_data_attr(ntfs_volume *vol, free(ustr); } +static int check_bad_sectors(ntfs_volume *vol) +{ + ntfs_attr_search_ctx *ctx; + runlist *rl; + s64 i, badclusters = 0; + + Vprintf("Checking for bad sectors ...\n"); + + lookup_data_attr(vol, FILE_BadClus, "$Bad", &ctx); + + if (NInoAttrList(ctx->ntfs_ino)) + err_exit("Hopelessly many bad sectors! Please report to " + "linux-ntfs@lists.sf.net\n"); + + if (!ctx->attr->non_resident) + err_exit("Resident attribute in $BadClust! Please report to " + "linux-ntfs@lists.sf.net\n"); + + if (!(rl = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL))) + perr_exit("Decompressing $BadClust:$Bad mapping pairs failed"); + + for (i = 0; rl[i].length; i++) { + /* CHECKME: LCN_RL_NOT_MAPPED check isn't needed */ + if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) + continue; + + badclusters += rl[i].length; + Vprintf("Bad cluster: %8lld - %lld\n", rl[i].lcn, + rl[i].lcn + rl[i].length - 1); + } + + if (badclusters) { + printf("%sThis software has detected that the disk has at least" + " %lld bad sector%s.\n", + !opt.badsectors ? NERR_PREFIX : "WARNING: ", + badclusters, badclusters - 1 ? "s" : ""); + if (!opt.badsectors) { + printf("%s", bad_sectors_warning_msg); + exit(1); + } else + printf("WARNING: Bad sectors can cause reliability " + "problems and massive data loss!!!\n"); + } + + free(rl); + ntfs_attr_put_search_ctx(ctx); + + return badclusters; +} + /** * truncate_badclust_file * @@ -2293,17 +2336,6 @@ static void check_resize_constraints(ntfs_resize_t *resize) { s64 new_size = resize->new_volume_size; - if (resize->badclusters) { - printf("%sThe NTFS volume has at least %lld bad sector%s.\n", - !opt.badsectors ? NERR_PREFIX : "", - resize->badclusters, - resize->badclusters - 1 ? "s" : ""); - if (!opt.badsectors) { - printf("%s", bad_sectors_warning_msg); - exit(1); - } - } - /* FIXME: resize.shrink true also if only -i is used */ if (!resize->shrink) return; @@ -2412,22 +2444,28 @@ int main(int argc, char **argv) printf("Nothing to do: NTFS volume size is already OK.\n"); exit(0); } - + + memset(&resize, 0, sizeof(resize)); + resize.vol = vol; + resize.new_volume_size = new_size; + /* This is also true if --info was used w/o --size (new_size = 0) */ + if (new_size < vol->nr_clusters) + resize.shrink = 1; + if (opt.show_progress) + resize.progress.flags |= NTFS_PROGBAR; + /* + * Checking and __reporting__ of bad sectors must be done before cluster + * allocation check because chkdsk doesn't fix $Bitmap's w/ bad sectors + * thus users would (were) quite confused why chkdsk doesn't work. + */ + resize.badclusters = check_bad_sectors(vol); + check_cluster_allocation(vol, &fsck); print_disk_usage(vol, fsck.inuse); - memset(&resize, 0, sizeof(resize)); - resize.new_volume_size = new_size; resize.inuse = fsck.inuse; resize.lcn_bitmap = fsck.lcn_bitmap; - resize.vol = vol; - if (opt.show_progress) - resize.progress.flags |= NTFS_PROGBAR; - - /* This is also true if --info was used w/o --size (new_size = 0) */ - if (new_size < vol->nr_clusters) - resize.shrink = 1; set_resize_constraints(&resize); set_disk_usage_constraint(&resize); From 8fa46025d5b3e03dd001c389295dd00f88a4ccf3 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 16 Oct 2005 19:21:47 +0000 Subject: [PATCH 2605/2994] trailing whitespace --- include/ntfs/layout.h | 2 +- libntfs/attrib.c | 4 ++-- libntfs/dir.c | 6 +++--- libntfs/inode.c | 2 +- libntfs/runlist.c | 2 +- ntfsprogs/utils.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 44608924..3e625001 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -2481,5 +2481,5 @@ typedef struct { } __attribute__ ((__packed__)) EFS_DF_CERTIFICATE_THUMBPRINT_HEADER; typedef EFS_DF_CERTIFICATE_THUMBPRINT_HEADER EFS_DF_CERT_THUMBPRINT_HEADER; - + #endif /* defined _NTFS_LAYOUT_H */ diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 4578f3ad..704c7312 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2271,7 +2271,7 @@ void ntfs_attr_reinit_search_ctx(ntfs_attr_search_ctx *ctx) * Note: For low level utilities which know what they are doing we allow @ni to * be NULL and @mrec to be set. Do NOT do this unless you understand the * implications!!! For example it is no longer safe to call ntfs_attr_lookup() - * if you + * if you */ ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) { @@ -3013,7 +3013,7 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, is_resident = TRUE; /* Check if it is better to make attribute non resident. */ if (!ntfs_attr_can_be_non_resident(ni->vol, type) && - offsetof(ATTR_RECORD, resident_end) + size >= + offsetof(ATTR_RECORD, resident_end) + size >= offsetof(ATTR_RECORD, non_resident_end) + 8) /* Make it non resident. */ is_resident = FALSE; diff --git a/libntfs/dir.c b/libntfs/dir.c index f0f54c3d..3118f0ef 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1279,7 +1279,7 @@ int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) search: while (!ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, CASE_SENSITIVE, 0, NULL, 0, actx)) { - errno = 0; + errno = 0; fn = (FILE_NAME_ATTR*)((u8*)actx->attr + le16_to_cpu(actx->attr->value_offset)); if (looking_for_dos_name) { @@ -1351,7 +1351,7 @@ search: /* * If hard link count is not equal to zero then we are done. In other * case there are no reference to this inode left, so we should free all - * non-resident atributes and mark inode as not in use. + * non-resident atributes and mark inode as not in use. */ if (ni->mrec->link_count) goto out; @@ -1485,7 +1485,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) ni->mrec->link_count) + 1); /* * Do not set attributes and file size, instead of this mark filenames - * dirty to force attribute and size update during sync. + * dirty to force attribute and size update during sync. * NOTE: File size may will be not updated and not all attributes will * be set, but it is acceptable since windows driver does not update * all file names when one of the hard links changed. diff --git a/libntfs/inode.c b/libntfs/inode.c index 352bc127..d91c870b 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -268,7 +268,7 @@ int ntfs_inode_close(ntfs_inode *ni) i = -1; break; } - /* + /* * ElectricFence is unhappy with realloc(x,0) as free(x) * thus we explicitly separate these two cases. */ diff --git a/libntfs/runlist.c b/libntfs/runlist.c index a6885314..058f2313 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1734,7 +1734,7 @@ static void test_rl_dump_runlist (const runlist_element *rl) if (abbr) for (len = 0; rl[len].length; len++) ; - + printf(" VCN LCN len\n"); for (i = 0; ; i++, rl++) { LCN lcn = rl->lcn; diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 5bfbd15a..3c87829b 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -986,7 +986,7 @@ int mft_next_record (struct mft_search_ctx *ctx) ntfs_attr_close(mft); return -1; } - + ntfs_attr_close(mft); } From 2436151e591cd0dff96e7500cc39095cffe503ee Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 16 Oct 2005 21:37:12 +0000 Subject: [PATCH 2606/2994] fix warning (uninitialised variable) --- ntfsprogs/ntfsrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 164d50fc..46c0ded0 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -4584,7 +4584,7 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) char *ptr = NULL; char *dirname = NULL; struct ntfs_find find; - INDEX_ENTRY *ie; + INDEX_ENTRY *ie = NULL; ntfschar *uname = NULL; int uname_len = 0; ntfs_inode *ino = NULL; From bde3e0063b480cd08c294e6f1980cc274818cb3e Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 16 Oct 2005 21:57:00 +0000 Subject: [PATCH 2607/2994] centralised logging system --- configure.ac | 10 + include/ntfs/Makefile.am | 1 + include/ntfs/logging.h | 114 ++++++++++ libntfs/Makefile.am | 1 + libntfs/logging.c | 449 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 575 insertions(+) create mode 100644 include/ntfs/logging.h create mode 100644 libntfs/logging.c diff --git a/configure.ac b/configure.ac index ff4576a9..6f384d39 100644 --- a/configure.ac +++ b/configure.ac @@ -139,6 +139,16 @@ if test "$enable_test" = "yes"; then CFLAGS="$CFLAGS -DNTFS_TEST" fi +AH_TEMPLATE([NTFS_DISABLE_DEBUG_LOGGING], + [Define this if you want to compile out the debug log messages. + This will reduce the size of the binaries.]) +AC_ARG_ENABLE(debug-logging, + AS_HELP_STRING(--disable-debug-logging,Remove debug logging from the code), + if test "$enable_debug_logging" == "no"; then + AC_DEFINE(NTFS_DISABLE_DEBUG_LOGGING) + fi, +) + # Use GNU extensions if available. AC_GNU_SOURCE diff --git a/include/ntfs/Makefile.am b/include/ntfs/Makefile.am index 89608d4b..11c6ed97 100644 --- a/include/ntfs/Makefile.am +++ b/include/ntfs/Makefile.am @@ -21,6 +21,7 @@ linux_ntfsinclude_HEADERS = \ lcnalloc.h \ list.h \ logfile.h \ + logging.h \ mft.h \ mst.h \ runlist.h \ diff --git a/include/ntfs/logging.h b/include/ntfs/logging.h new file mode 100644 index 00000000..d1165ea3 --- /dev/null +++ b/include/ntfs/logging.h @@ -0,0 +1,114 @@ +/* + * logging.h - Centralised logging. Part of the Linux-NTFS project. + * + * Copyright (c) 2005 Richard Russon + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _LOGGING_H_ +#define _LOGGING_H_ + +#include "config.h" + +#ifdef HAVE_STDARG_H +#include +#endif + +#include "types.h" + +struct ntfs_logging; + +/* Function prototype for the logging handlers */ +typedef int (logging_handler) (const char *handler, const char *file, int line, + int level, FILE *stream, const char *format, va_list args); + +/** + * struct ntfs_logging - Control info for the logging system + * @levels: Bitfield of logging levels + * @flags: Flags to affect the output style + * @handler: Function to perform the actual logging + */ +struct ntfs_logging { + u32 levels; + u32 flags; + logging_handler *handler; +}; + +extern struct ntfs_logging ntfs_log; + +void ntfs_logging_set_handler (logging_handler *handler); + +/* Enable/disable certain log levels */ +u32 ntfs_logging_set_levels (u32 levels); +u32 ntfs_logging_clear_levels (u32 levels); +u32 ntfs_logging_get_levels (void); + +/* Enable/disable certain log flags */ +u32 ntfs_logging_set_flags (u32 flags); +u32 ntfs_logging_clear_flags (u32 flags); +u32 ntfs_logging_get_flags (void); + +BOOL ntfs_logging_parse_option (const char *option); + +int ntfs_logging_redirect (const char *handler, const char *file, int line, + int level, FILE *stream, const char *format, ...) + __attribute__ ((format (printf, 6, 7))); + +/* Logging handlers */ +logging_handler ntfs_logging_handler_printf __attribute__ ((format (printf, 6, 0))); +logging_handler ntfs_logging_handler_colour __attribute__ ((format (printf, 6, 0))); + +/* Logging levels - Determine what gets logged */ +#define LOG_LEVEL_DEBUG (1 << 0) /* x = 42 */ +#define LOG_LEVEL_TRACE (1 << 1) /* Entering function x() */ +#define LOG_LEVEL_QUIET (1 << 2) /* Quietable output */ +#define LOG_LEVEL_INFO (1 << 3) /* Volume needs defragmenting */ +#define LOG_LEVEL_VERBOSE (1 << 4) /* Forced to continue */ +#define LOG_LEVEL_PROGRESS (1 << 5) /* 54% complete */ +#define LOG_LEVEL_WARNING (1 << 6) /* You should backup before starting */ +#define LOG_LEVEL_ERROR (1 << 7) /* Operation failed, no damage done */ +#define LOG_LEVEL_PERROR (1 << 8) /* Message : standard error description */ +#define LOG_LEVEL_CRITICAL (1 << 9) /* Operation failed,damage may have occurred */ + +/* Logging style flags - Manage the style of the output */ +#define LOG_FLAG_PREFIX (1 << 0) /* Prefix messages with "ERROR: ", etc */ +#define LOG_FLAG_FILENAME (1 << 1) /* Show the file origin of the message */ +#define LOG_FLAG_LINE (1 << 2) /* Show the line number of the message */ +#define LOG_FLAG_FUNCTION (1 << 3) /* Show the function name containing the message */ + +/* Macros to simplify logging. One for each level defined above. + * Note, if DEBUG isn't defined, then log_debug has no effect. + */ +#define log_crit(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_CRITICAL,NULL,FORMAT,##ARGS) +#define log_error(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_ERROR,NULL,FORMAT,##ARGS) +#define log_info(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_INFO,NULL,FORMAT,##ARGS) +#define log_perror(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_PERROR,NULL,FORMAT,##ARGS) +#define log_progress(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_PROGRESS,NULL,FORMAT,##ARGS) +#define log_quiet(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_QUIET,NULL,FORMAT,##ARGS) +#define log_verbose(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_VERBOSE,NULL,FORMAT,##ARGS) +#define log_warn(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_WARNING,NULL,FORMAT,##ARGS) + +#ifdef NTFS_DISABLE_DEBUG_LOGGING +#define log_debug(FORMAT, ARGS...)do {} while (0) +#define log_trace(FORMAT, ARGS...)do {} while (0) +#else +#define log_debug(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_DEBUG,NULL,FORMAT,##ARGS) +#define log_trace(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_TRACE,NULL,FORMAT,##ARGS) +#endif /* NTFS_DISABLE_DEBUG_LOGGING */ + +#endif /* _LOGGING_H_ */ + diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index e199c9d4..4828c850 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -51,6 +51,7 @@ libntfs_la_SOURCES = \ inode.c \ lcnalloc.c \ logfile.c \ + logging.c \ mft.c \ mst.c \ runlist.c \ diff --git a/libntfs/logging.c b/libntfs/logging.c new file mode 100644 index 00000000..6aba1027 --- /dev/null +++ b/libntfs/logging.c @@ -0,0 +1,449 @@ +/** + * logging.c - Centralised logging. Part of the Linux-NTFS project. + * + * Copyright (c) 2005 Richard Russon + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#ifdef HAVE_STDIO_H +#include +#endif +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_STDARG_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#include "logging.h" + +#ifndef PATH_SEP +#define PATH_SEP '/' +#endif + +/** + * struct ntfs_logging + * This global struct controls all the logging within the library and tools. + */ +struct ntfs_logging ntfs_log = +{ +#ifdef DEBUG + LOG_LEVEL_DEBUG | LOG_LEVEL_TRACE | +#endif + LOG_LEVEL_INFO | LOG_LEVEL_WARNING | LOG_LEVEL_ERROR | LOG_LEVEL_PERROR | LOG_LEVEL_CRITICAL, + LOG_FLAG_PREFIX, + ntfs_logging_handler_printf +}; + +/** + * ntfs_logging_get_levels - Get a list of the current logging levels + * + * Find out which logging levels are enabled. + * + * Returns: Log levels in a 32-bit field + */ +u32 ntfs_logging_get_levels (void) +{ + return ntfs_log.levels; +} + +/** + * ntfs_logging_set_levels - Enable extra logging levels + * @levels: 32-bit field of log levels to set + * + * Enable one or more logging levels. + * The logging levels are named: LOG_LEVEL_*. + * + * Returns: Log levels that were enabled before the call + */ +u32 ntfs_logging_set_levels (u32 levels) +{ + u32 old; + old = ntfs_log.levels; + ntfs_log.levels |= levels; + return old; +} + +/** + * ntfs_logging_clear_levels - Disable some logging levels + * @levels: 32-bit field of log levels to clear + * + * Disable one or more logging levels. + * The logging levels are named: LOG_LEVEL_*. + * + * Returns: Log levels that were enabled before the call + */ +u32 ntfs_logging_clear_levels (u32 levels) +{ + u32 old; + old = ntfs_log.levels; + ntfs_log.levels &= (~levels); + return old; +} + + +/** + * ntfs_logging_get_flags - Get a list of logging style flags + * + * Find out which logging flags are enabled. + * + * Returns: Logging flags in a 32-bit field + */ +u32 ntfs_logging_get_flags (void) +{ + return ntfs_log.flags; +} + +/** + * ntfs_logging_set_flags - Enable extra logging style flags + * @flags: 32-bit field of logging flags to set + * + * Enable one or more logging flags. + * The log flags are named: LOG_LEVEL_*. + * + * Returns: Logging flags that were enabled before the call + */ +u32 ntfs_logging_set_flags (u32 flags) +{ + u32 old; + old = ntfs_log.flags; + ntfs_log.flags |= flags; + return old; +} + +/** + * ntfs_logging_clear_flags - Disable some logging styles + * @flags: 32-bit field of logging flags to clear + * + * Disable one or more logging flags. + * The log flags are named: LOG_LEVEL_*. + * + * Returns: Logging flags that were enabled before the call + */ +u32 ntfs_logging_clear_flags (u32 flags) +{ + u32 old; + old = ntfs_log.flags; + ntfs_log.flags &= (~flags); + return old; +} + + +/** + * ntfs_logging_get_stream - Default output streams for logging levels + * @level: Log level + * + * By default, urgent messages are sent to "stderr". + * Other messages are sent to "stdout". + * + * Returns: "string" Prefix to be used + */ +static FILE * ntfs_logging_get_stream (int level) +{ + FILE *stream; + + switch (level) { + case LOG_LEVEL_INFO: + case LOG_LEVEL_QUIET: + case LOG_LEVEL_PROGRESS: + stream = stdout; + break; + + case LOG_LEVEL_DEBUG: + case LOG_LEVEL_TRACE: + case LOG_LEVEL_WARNING: + case LOG_LEVEL_ERROR: + case LOG_LEVEL_CRITICAL: + case LOG_LEVEL_PERROR: + default: + stream = stderr; + break; + } + + return stream; +} + +/** + * ntfs_logging_get_prefix - Default prefixes for logging levels + * @level: Log level to be prefixed + * + * Prefixing the logging output can make it easier to parse. + * + * Returns: "string" Prefix to be used + */ +static const char * ntfs_logging_get_prefix (int level) +{ + const char *prefix; + + switch (level) { + case LOG_LEVEL_DEBUG: + prefix = "DEBUG: "; + break; + case LOG_LEVEL_TRACE: + prefix = "TRACE: "; + break; + case LOG_LEVEL_QUIET: + prefix = "QUIET: "; + break; + case LOG_LEVEL_INFO: + prefix = "INFO: "; + break; + case LOG_LEVEL_VERBOSE: + prefix = "VERBOSE: "; + break; + case LOG_LEVEL_PROGRESS: + prefix = "PROGRESS: "; + break; + case LOG_LEVEL_WARNING: + prefix = "WARNING: "; + break; + case LOG_LEVEL_ERROR: + prefix = "ERROR: "; + break; + case LOG_LEVEL_PERROR: + prefix = "ERROR: "; + break; + case LOG_LEVEL_CRITICAL: + prefix = "CRITICAL: "; + break; + default: + prefix = ""; + break; + } + + return prefix; +} + + +/** + * ntfs_logging_set_handler - Provide an alternate logging handler + * @handler: function to perform the logging + * + * This alternate handler will be called for all future logging requests. + * If no @handler is specified, logging will revert to the default handler. + * + * Returns: void + */ +void ntfs_logging_set_handler (logging_handler *handler) +{ + if (handler) + ntfs_log.handler = handler; + else + ntfs_log.handler = ntfs_logging_handler_printf; +} + +/** + * ntfs_logging_redirect - Pass on the request to the real handler + * @function: Function in which the log line occurred + * @file: File in which the log line occurred + * @line: Line number on which the log line occurred + * @level: Level at which the line is logged + * @stream: FILE stream to output to (may be NULL) + * @format: printf-style formatting string + * @...: Arguments to be formatted + * + * This is just a redirector function. The arguments are simply passed to the + * main logging handler (as defined in the global logging struct @ntfs_log). + * + * Note: If @stream is NULL, the output stream will be determined by the + * function: ntfs_logging_get_stream + * + * Returns: -1 Error occurred + * 0 Message wasn't logged + * num Number of output characters + */ +int ntfs_logging_redirect (const char *function, const char *file, + int line, int level, FILE *stream, const char *format, ...) +{ + int olderr = errno; + int ret; + va_list args; + + if (!(ntfs_log.levels & level)) /* Don't log this message */ + return 0; + + va_start (args, format); + errno = olderr; + ret = ntfs_log.handler (function, file, line, level, stream, format, args); + va_end (args); + + errno = olderr; + return ret; +} + +/** + * ntfs_logging_handler_printf - Basic logging handler + * @function: Function in which the log line occurred + * @file: File in which the log line occurred + * @line: Line number on which the log line occurred + * @level: Level at which the line is logged + * @stream: FILE stream to output to (may be NULL) + * @format: printf-style formatting string + * @args: Arguments to be formatted + * + * A simple logging handler. This is where the log line is finally displayed. + * + * Note: If @stream is NULL, the output stream will be determined by the + * function: ntfs_logging_get_stream + * + * Returns: -1 Error occurred + * 0 Message wasn't logged + * num Number of output characters + */ +int ntfs_logging_handler_printf (const char *function, const char *file, + int line, int level, FILE *stream, const char *format, va_list args) +{ + int ret = 0; + int olderr = errno; + + if (!stream) + stream = ntfs_logging_get_stream (level); + + if (strchr (file, PATH_SEP)) /* Abbreviate the filename */ + file = strrchr (file, PATH_SEP) + 1; + + if (ntfs_log.flags & LOG_FLAG_PREFIX) /* Prefix the output */ + ret += fprintf (stream, "%s", ntfs_logging_get_prefix (level)); + + if (ntfs_log.flags & LOG_FLAG_FILENAME) /* Source filename */ + ret += fprintf (stream, "%s ", file); + + if (ntfs_log.flags & LOG_FLAG_LINE) /* Source line number */ + ret += fprintf (stream, "(%d) ", line); + + if (ntfs_log.flags & LOG_FLAG_FUNCTION) /* Source function */ + ret += fprintf (stream, ": %s : ", function); + + if (level & LOG_LEVEL_PERROR) { + errno = olderr; + ret += fprintf (stream, "<%s> : ", strerror (olderr)); + } + + ret += vfprintf (stream, format, args); + + errno = olderr; + return ret; +} + +/** + * ntfs_logging_handler_colour - Colour-highlighting logging handler + * @function: Function in which the log line occurred + * @file: File in which the log line occurred + * @line: Line number on which the log line occurred + * @level: Level at which the line is logged + * @stream: FILE stream to output to (may be NULL) + * @format: printf-style formatting string + * @args: Arguments to be formatted + * + * This is a simple logging filter that prefixes/suffixes some logs. + * Warnings: yellow + * Errors: red + * Critical errors: red (inverse video) + * + * Note: This function calls ntfs_logging_handler_printf to do the main work. + * + * Note: If @stream is NULL, the output stream will be determined by the + * function: ntfs_logging_get_stream + * + * Returns: -1 Error occurred + * 0 Message wasn't logged + * num Number of output characters + */ +int ntfs_logging_handler_colour (const char *function, const char *file, + int line, int level, FILE *stream, const char *format, va_list args) +{ + int ret = 0; + int olderr = errno; + const char *prefix = NULL; + const char *suffix = NULL; + const char *end = "\e[0m"; + + if (!stream) + stream = ntfs_logging_get_stream (level); + + switch (level) { + case LOG_LEVEL_WARNING: + prefix = "\e[01;33m"; /* Yellow */ + suffix = end; + break; + case LOG_LEVEL_ERROR: + case LOG_LEVEL_PERROR: + prefix = "\e[01;31m"; /* Red */ + suffix = end; + break; + case LOG_LEVEL_CRITICAL: + prefix = "\e[01;07;31m"; /* Red, inverse */ + suffix = end; + break; + } + + if (prefix) + ret += fprintf (stream, prefix); + + errno = olderr; + ret += ntfs_logging_handler_printf (function, file, line, level, stream, format, args); + + if (suffix) + ret += fprintf (stream, suffix); + + errno = olderr; + return ret; +} + + +/** + * ntfs_logging_parse_option - Act upon command line options + * @option: Option flag + * + * Delegate some of the work of parsing the command line. All the options begin + * with "--log-". Options cause log levels to be enabled in @ntfs_log (the + * global logging structure). + * + * Note: The "colour" option changes the logging handler. + * + * Returns: TRUE Option understood + * FALSE Invalid log option + */ +BOOL ntfs_logging_parse_option (const char *option) +{ + if (strcmp (option, "--log-debug") == 0) { + ntfs_logging_set_levels (LOG_LEVEL_DEBUG); + return TRUE; + } else if (strcmp (option, "--log-verbose") == 0) { + ntfs_logging_set_levels (LOG_LEVEL_VERBOSE); + return TRUE; + } else if (strcmp (option, "--log-quiet") == 0) { + ntfs_logging_set_levels (LOG_LEVEL_QUIET); + return TRUE; + } else if (strcmp (option, "--log-trace") == 0) { + ntfs_logging_set_levels (LOG_LEVEL_TRACE); + return TRUE; + } else if ((strcmp (option, "--log-colour") == 0) || + (strcmp (option, "--log-color") == 0)) { + ntfs_logging_set_handler (ntfs_logging_handler_colour); + return TRUE; + } + + log_error ("Unknown logging option '%s'\n", option); + return FALSE; +} + From 139f6c66037fa72bcf6225a098d41a85f0190b4c Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 16 Oct 2005 22:37:48 +0000 Subject: [PATCH 2608/2994] prevent a few name clashes with the new rm code --- ntfsprogs/cluster.c | 13 ++++++++----- ntfsprogs/ntfsmove.c | 17 ++++++++++------- ntfsprogs/utils.c | 6 +++--- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c index 775151f1..3f77ea27 100644 --- a/ntfsprogs/cluster.c +++ b/ntfsprogs/cluster.c @@ -36,10 +36,12 @@ #include "cluster.h" #include "utils.h" -#define RED "" -#define YELLOW "" -#define GREEN "" -#define NORM "" +#if 0 +#define RED "\e[31m" +#define YELLOW "\e[33m" +#define GREEN "\e[01;32m" +#define NORM "\e[0m" +#endif /** * cluster_find @@ -78,7 +80,8 @@ int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void m_ctx->flags_search = FEMR_IN_USE | FEMR_BASE_RECORD; while (mft_next_record (m_ctx) == 0) { - Qprintf (RED "Inode: %llu\n" NORM, (unsigned long long) + //Qprintf (RED "Inode: %llu\n" NORM, (unsigned long long) + Qprintf ("Inode: %llu\n", (unsigned long long) m_ctx->inode->mft_no); if (!(m_ctx->flags_match & FEMR_BASE_RECORD)) diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index 56dfccdb..11ac72e9 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -54,10 +54,12 @@ GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) -#define RED "" -#define YELLOW "" -#define GREEN "" -#define NORM "" +#if 0 +#define RED "\e[31m" +#define YELLOW "\e[33m" +#define GREEN "\e[01;32m" +#define NORM "\e[0m" +#endif /** * version - Print version information about the program @@ -362,12 +364,12 @@ static int calc_attr_length (ATTR_RECORD *rec, int runlength) static void dump_runs (u8 *buffer, int len) { int i; - printf ("RUN: "); + printf ("RUN: \e[01;31m"); for (i = 0; i < len; i++) { printf (" %02x", buffer[i]); } - printf ("\n"); + printf ("\e[0m\n"); } #endif /* if 0 */ @@ -700,7 +702,8 @@ static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, need_from = calc_attr_length (rec, need_from); need_to = calc_attr_length (rec, need_to); - printf (RED "Before %d, after %d\n" NORM, need_from, need_to); + //printf (RED "Before %d, after %d\n" NORM, need_from, need_to); + printf ("Before %d, after %d\n", need_from, need_to); if (need_from != need_to) { if (resize_nonres_attr (ino->mrec, rec, need_to) < 0) { diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 3c87829b..88981d54 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -802,9 +802,9 @@ void utils_dump_mem (void *buf, int start, int length, int flags) if (flags & DM_INDENT) printf ("\t"); if (flags & DM_BOLD) - printf (""); + printf ("\e[01m"); if (flags & (DM_RED | DM_BLUE | DM_GREEN | DM_BOLD)) - printf ("[%dm", col); + printf ("\e[%dm", col); if (off == s) printf("%6.6x ", start); else @@ -830,7 +830,7 @@ void utils_dump_mem (void *buf, int start, int length, int flags) } } if (flags & (DM_RED | DM_BLUE | DM_GREEN | DM_BOLD)) - printf (""); + printf ("\e[0m"); printf ("\n"); } } From 2a8d602d9fd213d387d7a744f3bbc2d34f5fb5a0 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 16 Oct 2005 23:33:03 +0000 Subject: [PATCH 2609/2994] ntfsrm has been split up and merged into libntfs. currently it's #ifdef'd out. tree.c - code for handling directory trees rich.c - a few helpers without a home (this file will go away soon) Note: ntfsrm isn't in the build any more (you need to ./configure --enable-rich; make extras). When rm is less intrusive, again, I'll put it back in the build. --- configure.ac | 9 + include/ntfs/Makefile.am | 4 +- include/ntfs/bitmap.h | 33 + include/ntfs/dir.h | 33 + include/ntfs/index.h | 18 + include/ntfs/inode.h | 9 + include/ntfs/mft.h | 14 + include/ntfs/rich.h | 50 + include/ntfs/tree.h | 82 + include/ntfs/volume.h | 12 + libntfs/Makefile.am | 4 + libntfs/bitmap.c | 386 ++++ libntfs/dir.c | 389 ++++ libntfs/index.c | 226 +++ libntfs/inode.c | 119 ++ libntfs/mft.c | 338 ++++ libntfs/rich.c | 177 ++ libntfs/tree.c | 2119 +++++++++++++++++++++ libntfs/volume.c | 330 ++++ ntfsprogs/Makefile.am | 8 +- ntfsprogs/ntfsrm.c | 3771 +------------------------------------- ntfsprogs/ntfsrm.h | 68 +- ntfsprogs/utils.c | 4 + ntfsprogs/utils.h | 34 +- 24 files changed, 4404 insertions(+), 3833 deletions(-) create mode 100644 include/ntfs/rich.h create mode 100644 include/ntfs/tree.h create mode 100644 libntfs/rich.c create mode 100644 libntfs/tree.c diff --git a/configure.ac b/configure.ac index 6f384d39..03b85204 100644 --- a/configure.ac +++ b/configure.ac @@ -149,6 +149,15 @@ AC_ARG_ENABLE(debug-logging, fi, ) +AC_ARG_ENABLE(rich, + AS_HELP_STRING(--enable-rich,enable Rich's "rm" test code), , + enable_rich=no +) +AM_CONDITIONAL(ENABLE_RICH, test "$enable_rich" = yes) +if test "$enable_rich" = "yes"; then + CFLAGS="$CFLAGS -DNTFS_RICH" +fi + # Use GNU extensions if available. AC_GNU_SOURCE diff --git a/include/ntfs/Makefile.am b/include/ntfs/Makefile.am index 11c6ed97..2725ae93 100644 --- a/include/ntfs/Makefile.am +++ b/include/ntfs/Makefile.am @@ -24,10 +24,12 @@ linux_ntfsinclude_HEADERS = \ logging.h \ mft.h \ mst.h \ + ntfstime.h \ + rich.h \ runlist.h \ security.h \ support.h \ - ntfstime.h \ + tree.h \ types.h \ unistr.h \ version.h \ diff --git a/include/ntfs/bitmap.h b/include/ntfs/bitmap.h index c18aa43b..041153f9 100644 --- a/include/ntfs/bitmap.h +++ b/include/ntfs/bitmap.h @@ -2,6 +2,7 @@ * bitmap.h - Exports for bitmap handling. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -130,4 +131,36 @@ static __inline__ int ntfs_bitmap_clear_bit(ntfs_attr *na, s64 bit) return ntfs_bitmap_clear_run(na, bit, 1); } + +#ifdef NTFS_RICH + +#include "layout.h" +#include "inode.h" + +/** + * struct ntfs_bmp + * a cache for either dir/$BITMAP, $MFT/$BITMAP or $Bitmap/$DATA + */ +struct ntfs_bmp { + ntfs_volume *vol; + ntfs_attr *attr; + int count; + u8 **data; + VCN *data_vcn; +}; + + +int ntfs_bmp_rollback (struct ntfs_bmp *bmp); +int ntfs_bmp_commit (struct ntfs_bmp *bmp); +void ntfs_bmp_free (struct ntfs_bmp *bmp); +struct ntfs_bmp * ntfs_bmp_create (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len); +int ntfs_bmp_add_data (struct ntfs_bmp *bmp, VCN vcn, u8 *data); +u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn); +int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int value); +s64 ntfs_bmp_find_last_set (struct ntfs_bmp *bmp); +int ntfs_bmp_find_space (struct ntfs_bmp *bmp, LCN start, long size); + +#endif /* NTFS_RICH */ + #endif /* defined _NTFS_BITMAP_H */ + diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index 98b1b256..e6a65930 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -3,6 +3,7 @@ * * Copyright (c) 2002 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -73,5 +74,37 @@ typedef int (*ntfs_filldir_t)(void *dirent, const ntfschar *name, extern int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, void *dirent, ntfs_filldir_t filldir); +#ifdef NTFS_RICH + +/** + * struct ntfs_dir + */ +struct ntfs_dir { + ntfs_volume *vol; + struct ntfs_dir *parent; + ntfschar *name; + int name_len; + MFT_REF mft_num; + struct ntfs_dt *index; + struct ntfs_dir **children; + int child_count; + struct ntfs_bmp *bitmap; + ntfs_inode *inode; + ntfs_attr *iroot; + ntfs_attr *ialloc; + int index_size; +}; + + +int ntfs_dir_rollback (struct ntfs_dir *dir); +int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir); +int ntfs_dir_commit (struct ntfs_dir *dir); +void ntfs_dir_free (struct ntfs_dir *dir); +struct ntfs_dir * ntfs_dir_create (ntfs_volume *vol, MFT_REF mft_num); +void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child); +struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, int name_len); + +#endif /* NTFS_RICH */ + #endif /* defined _NTFS_DIR_H */ diff --git a/include/ntfs/index.h b/include/ntfs/index.h index c4a78375..20ce386d 100644 --- a/include/ntfs/index.h +++ b/include/ntfs/index.h @@ -3,6 +3,7 @@ * * Copyright (c) 2004 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -121,4 +122,21 @@ static inline void ntfs_index_entry_mark_dirty(ntfs_index_context *ictx) ictx->ia_dirty = TRUE; } + +#ifdef NTFS_RICH + +#include "layout.h" + +void ntfs_ie_free (INDEX_ENTRY *ie); +INDEX_ENTRY * ntfs_ie_create (void); +VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie); +INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie); +INDEX_ENTRY * ntfs_ie_set_vcn (INDEX_ENTRY *ie, VCN vcn); +INDEX_ENTRY * ntfs_ie_remove_vcn (INDEX_ENTRY *ie); +INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype); +INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie); + +#endif /* NTFS_RICH */ + #endif /* _NTFS_INDEX_H */ + diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 05c4f07c..41fdf242 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -3,6 +3,7 @@ * * Copyright (c) 2001,2002 Anton Altaparmakov * Copyright (c) 2004-2005 Yura Pakhuchiy + * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -184,4 +185,12 @@ extern int ntfs_inode_add_attrlist(ntfs_inode *ni); extern int ntfs_inode_free_space(ntfs_inode *ni, int size); +#ifdef NTFS_RICH + +int ntfs_inode_close2 (ntfs_inode *ni); +ntfs_inode * ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref); +ntfs_inode * ntfs_inode_open3 (ntfs_volume *vol, const MFT_REF mref); + +#endif /* NTFS_RICH */ + #endif /* defined _NTFS_INODE_H */ diff --git a/include/ntfs/mft.h b/include/ntfs/mft.h index 4d842949..00d2088f 100644 --- a/include/ntfs/mft.h +++ b/include/ntfs/mft.h @@ -2,6 +2,7 @@ * mft.h - Exports for MFT record handling. Part of the Linux-NTFS project. * * Copyright (c) 2000-2002 Anton Altaparmakov + * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -110,5 +111,18 @@ extern ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni); extern int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni); +#ifdef NTFS_RICH + +#include "bitmap.h" +#include "dir.h" + +int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES type); +ATTR_RECORD * ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int data_len); +int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len, u8 *data, int data_len); +int ntfs_mft_free_space (struct ntfs_dir *dir); +int ntfs_mft_add_index (struct ntfs_dir *dir); + +#endif /* NTFS_RICH */ + #endif /* defined _NTFS_MFT_H */ diff --git a/include/ntfs/rich.h b/include/ntfs/rich.h new file mode 100644 index 00000000..e07451a7 --- /dev/null +++ b/include/ntfs/rich.h @@ -0,0 +1,50 @@ +/** + * rich.h - Temporary junk file. Part of the Linux-NTFS project. + * + * Copyright (c) 2004-2005 Richard Russon + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_RICH_H_ +#define _NTFS_RICH_H_ + +#include "layout.h" +#include "attrib.h" +#include "bitmap.h" + +// XXX Temporarily copied from utils.h +#define RED "\e[31m" +#define GREEN "\e[32m" +#define YELLOW "\e[33m" +#define BLUE "\e[34m" +#define MAGENTA "\e[35m" +#define CYAN "\e[36m" +#define BOLD "\e[01m" +#define END "\e[0m" + +#define ROUND_UP(num,bound) (((num)+((bound)-1)) & ~((bound)-1)) +#define ROUND_DOWN(num,bound) ((num) & ~((bound)-1)) +#define ATTR_SIZE(s) ROUND_UP(s,8) + +ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); +ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft); +int utils_free_non_residents3 (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECORD *attr); +int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp); +void ntfs_name_print (ntfschar *name, int name_len); + +#endif /* _NTFS_RICH_H_ */ + diff --git a/include/ntfs/tree.h b/include/ntfs/tree.h new file mode 100644 index 00000000..76dda3b0 --- /dev/null +++ b/include/ntfs/tree.h @@ -0,0 +1,82 @@ +/** + * tree.h - Directory tree handling code. Part of the Linux-NTFS project. + * + * Copyright (c) 2004-2005 Richard Russon + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _NTFS_TREE_H_ +#define _NTFS_TREE_H_ + +#include "layout.h" +#include "volume.h" + +struct ntfs_dir; + +/** + * struct ntfs_dt + */ +struct ntfs_dt { + struct ntfs_dir *dir; + struct ntfs_dt *parent; + u8 *data; + int data_len; + int child_count; + INDEX_ENTRY **children; + struct ntfs_dt **sub_nodes; + ntfs_inode **inodes; + VCN vcn; + INDEX_HEADER *header; + BOOL changed; +}; + + +void ntfs_dt_free (struct ntfs_dt *dt); +int ntfs_dt_rollback (struct ntfs_dt *dt); +int ntfs_dt_commit (struct ntfs_dt *dt); +BOOL ntfs_dt_create_children2 (struct ntfs_dt *dt, int count); +BOOL ntfs_dt_resize_children3 (struct ntfs_dt *dt, int new); +int ntfs_dt_root_count (struct ntfs_dt *dt); +int ntfs_dt_alloc_count (struct ntfs_dt *dt); +int ntfs_dt_initialise2 (ntfs_volume *vol, struct ntfs_dt *dt); +struct ntfs_dt * ntfs_dt_create (struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn); +MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len); +struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num); +struct ntfs_dt * ntfs_dt_find3 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num); +struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num); +void ntfs_dt_find_all (struct ntfs_dt *dt); +int ntfs_dt_find_parent (struct ntfs_dt *dt); +BOOL ntfs_dt_isroot (struct ntfs_dt *dt); +int ntfs_dt_root_freespace (struct ntfs_dt *dt); +int ntfs_dt_alloc_freespace (struct ntfs_dt *dt); +int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start, int count); +int ntfs_dt_alloc_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count); +INDEX_ENTRY * ntfs_dt_alloc_insert2 (struct ntfs_dt *dt, int before, int count, int bytes); +int ntfs_dt_root_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count); +int ntfs_dt_alloc_remove2 (struct ntfs_dt *dt, int start, int count); +int ntfs_dt_root_remove2 (struct ntfs_dt *dt, int start, int count); +int ntfs_dt_transfer2 (struct ntfs_dt *old, struct ntfs_dt *new, int start, int count); +int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie); +BOOL ntfs_dt_alloc_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie); +BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num); +BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num); +int ntfs_dt_alloc_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child); +int ntfs_dt_root_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child); +int ntfs_dt_add2 (INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs_dt *ded); + +#endif /* _NTFS_TREE_H_ */ + diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 3c126732..17d1828c 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -3,6 +3,7 @@ * * Copyright (c) 2000-2004 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -203,5 +204,16 @@ extern int ntfs_logfile_reset(ntfs_volume *vol); extern int ntfs_volume_write_flags(ntfs_volume *v, const u16 flags); +#ifdef NTFS_RICH + +int ntfs_volume_commit (ntfs_volume *vol); +int ntfs_volume_rollback (ntfs_volume *vol); +int ntfs_volume_umount2 (ntfs_volume *vol, const BOOL force); +ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL force); +int utils_valid_device (const char *name, int force); +ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force); + +#endif /* NTFS_RICH */ + #endif /* defined _NTFS_VOLUME_H */ diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index 4828c850..f1fd592e 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -60,6 +60,10 @@ libntfs_la_SOURCES = \ version.c \ volume.c +if ENABLE_RICH +libntfs_la_SOURCES += rich.c tree.c +endif + if ENABLE_GNOME_VFS gnomevfsmoduleslibdir = $(libdir)/gnome-vfs-2.0/modules diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index 9bae43eb..79ca11c0 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -2,6 +2,7 @@ * bitmap.c - Bitmap handling code. Part of the Linux-NTFS project. * * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -220,3 +221,388 @@ int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) { return ntfs_bitmap_set_bits_in_run(na, start_bit, count, 0); } + + +#ifdef NTFS_RICH + +#include + +#include "layout.h" +#include "volume.h" +#include "bitmap.h" +#include "rich.h" + +/** + * ntfs_bmp_rollback + */ +int ntfs_bmp_rollback (struct ntfs_bmp *bmp) +{ + int i; + + if ((!bmp) || (bmp->count == 0)) + return 0; + + for (i = 0; i < bmp->count; i++) + free (bmp->data[i]); + + free (bmp->data); + free (bmp->data_vcn); + bmp->data = NULL; + bmp->data_vcn = NULL; + bmp->count = 0; + + return 0; +} + +/** + * ntfs_bmp_commit + */ +int ntfs_bmp_commit (struct ntfs_bmp *bmp) +{ + int i; + u32 cs; +#ifdef RM_WRITE + u32 ws; // write size +#endif + + if (!bmp) + return 0; + if (bmp->count == 0) + return 0; + +#if 0 + printf ("attr = 0x%02X\n", bmp->attr->type); + printf ("resident = %d\n", !NAttrNonResident (bmp->attr)); + printf ("\ta size = %lld\n", bmp->attr->allocated_size); + printf ("\td size = %lld\n", bmp->attr->data_size); + printf ("\ti size = %lld\n", bmp->attr->initialized_size); +#endif + + printf ("commit bmp inode %lld, 0x%02X (%sresident)\n", bmp->attr->ni->mft_no, bmp->attr->type, NAttrNonResident (bmp->attr) ? "non-" : ""); + + if (NAttrNonResident (bmp->attr)) { + cs = bmp->vol->cluster_size; + + // non-resident + for (i = 0; i < bmp->count; i++) { +#ifdef RM_WRITE + if (((bmp->data_vcn[i]+1) * cs) < bmp->attr->data_size) + ws = cs; + else + ws = bmp->attr->data_size & (cs - 1); + //printf ("writing %d bytes\n", ws); + ntfs_attr_pwrite (bmp->attr, bmp->data_vcn[i] * cs, ws, bmp->data[i]); // XXX retval +#endif + printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, bmp->data_vcn[i]); + } + } else { + // resident +#ifdef RM_WRITE + ntfs_attr_pwrite (bmp->attr, bmp->data_vcn[0], bmp->attr->data_size, bmp->data[0]); // XXX retval +#endif + printf (RED "\tntfs_attr_pwrite resident (%lld)\n" END, bmp->attr->data_size); + } + + ntfs_bmp_rollback (bmp); + + return 0; +} + +/** + * ntfs_bmp_free + */ +void ntfs_bmp_free (struct ntfs_bmp *bmp) +{ + if (!bmp) + return; + + ntfs_bmp_rollback (bmp); + + ntfs_attr_close (bmp->attr); + + free (bmp); +} + +/** + * ntfs_bmp_create + */ +struct ntfs_bmp * ntfs_bmp_create (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len) +{ + struct ntfs_bmp *bmp; + ntfs_attr *attr; + + if (!inode) + return NULL; + + attr = ntfs_attr_open (inode, type, name, name_len); + if (!attr) + return NULL; + + bmp = calloc (1, sizeof (*bmp)); + if (!bmp) { + ntfs_attr_close (attr); + return NULL; + } + + bmp->vol = inode->vol; + bmp->attr = attr; + bmp->data = NULL; + bmp->data_vcn = NULL; + bmp->count = 0; + + return bmp; +} + +/** + * ntfs_bmp_add_data + */ +int ntfs_bmp_add_data (struct ntfs_bmp *bmp, VCN vcn, u8 *data) +{ + int i = 0; + int old; + int new; + + if (!bmp || !data) + return -1; + + old = ROUND_UP (bmp->count, 16); + bmp->count++; + new = ROUND_UP (bmp->count, 16); + + if (old != new) { + bmp->data = realloc (bmp->data, new * sizeof (*bmp->data)); + bmp->data_vcn = realloc (bmp->data_vcn , new * sizeof (*bmp->data_vcn)); + } + + for (i = 0; i < bmp->count-1; i++) + if (bmp->data_vcn[i] > vcn) + break; + + if ((bmp->count-i) > 0) { + memmove (&bmp->data[i+1], &bmp->data[i], (bmp->count-i) * sizeof (*bmp->data)); + memmove (&bmp->data_vcn[i+1], &bmp->data_vcn[i], (bmp->count-i) * sizeof (*bmp->data_vcn)); + } + + bmp->data[i] = data; + bmp->data_vcn[i] = vcn; + + return bmp->count; +} + +/** + * ntfs_bmp_get_data + */ +u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn) +{ + u8 *buffer; + int i; + int cs; + int cb; + + if (!bmp) + return NULL; + + cs = bmp->vol->cluster_size; + cb = bmp->vol->cluster_size_bits; + + // XXX range check against vol,attr + // never compressed, so data = init + + vcn >>= (cb + 3); // convert to bitmap clusters + + for (i = 0; i < bmp->count; i++) { + if (vcn == bmp->data_vcn[i]) { + //printf ("reusing bitmap cluster %lld\n", vcn); + return bmp->data[i]; + } + } + + buffer = calloc (1, cs); // XXX could be smaller if attr size < cluster size + if (!buffer) + return NULL; + + //printf ("loading from bitmap cluster %lld\n", vcn); + //printf ("loading from bitmap byte %lld\n", vcn<attr, vcn<vol->cluster_size << 3; + + vcn_start = vcn; + vcn_finish = vcn + length - 1; + + //printf ("vcn_start = %d, vcn_finish = %d\n", vcn_start, vcn_finish); + a = ROUND_DOWN (vcn_start, csib); + b = ROUND_DOWN (vcn_finish, csib) + 1; + + //printf ("a = %lld, b = %lld\n", a, b); + + for (i = a; i < b; i += csib) { + //printf ("ntfs_bmp_get_data %lld\n", i); + buffer = ntfs_bmp_get_data (bmp, i); + if (!buffer) + return -1; + + block_start = i; + block_finish = block_start + csib - 1; + + mask_start = (0xFF << (vcn_start & 7)); + mask_finish = (0xFF >> (7 - (vcn_finish & 7))); + + if ((vcn_start >= block_start) && (vcn_start <= block_finish)) { + byte_start = (vcn_start - block_start) >> 3; + } else { + byte_start = 0; + mask_start = 0xFF; + } + + if ((vcn_finish >= block_start) && (vcn_finish <= block_finish)) { + byte_finish = (vcn_finish - block_start) >> 3; + } else { + byte_finish = bmp->vol->cluster_size - 1; + mask_finish = 0xFF; + } + + if ((byte_finish - byte_start) > 1) { + memset (buffer+byte_start+1, value, byte_finish-byte_start-1); + } else if (byte_finish == byte_start) { + mask_start &= mask_finish; + mask_finish = 0x00; + } + + if (value) { + buffer[byte_start] |= mask_start; + buffer[byte_finish] |= mask_finish; + } else { + buffer[byte_start] &= (~mask_start); + buffer[byte_finish] &= (~mask_finish); + } + } + +#if 1 + printf (GREEN "Modified: inode %lld, ", bmp->attr->ni->mft_no); + switch (bmp->attr->type) { + case AT_BITMAP: printf ("$BITMAP"); break; + case AT_DATA: printf ("$DATA"); break; + default: break; + } + printf (" vcn %lld-%lld\n" END, vcn>>12, (vcn+length-1)>>12); +#endif + return 1; +} + +/** + * ntfs_bmp_find_last_set + */ +s64 ntfs_bmp_find_last_set (struct ntfs_bmp *bmp) +{ + s64 clust_count; + s64 byte_count; + s64 clust; + int byte; + int bit; + int note; + u8 *buffer; + + if (!bmp) + return -2; + + // find byte size of bmp + // find cluster size of bmp + + byte_count = bmp->attr->data_size; + clust_count = ROUND_UP (byte_count, bmp->vol->cluster_size) >> bmp->vol->cluster_size_bits; + + //printf ("bitmap = %lld bytes\n", byte_count); + //printf ("bitmap = %lld buffers\n", clust_count); + + // for each cluster backwards + for (clust = clust_count-1; clust >= 0; clust--) { + //printf ("cluster %lld\n", clust); + //printf ("get vcn %lld\n", clust << (bmp->vol->cluster_size_bits + 3)); + buffer = ntfs_bmp_get_data (bmp, clust << (bmp->vol->cluster_size_bits + 3)); + //utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); + if (!buffer) + return -2; + if ((clust == (clust_count-1) && ((byte_count % bmp->vol->cluster_size) != 0))) { + byte = byte_count % bmp->vol->cluster_size; + } else { + byte = bmp->vol->cluster_size; + } + //printf ("start byte = %d\n", byte); + // for each byte backward + for (byte--; byte >= 0; byte--) { + //printf ("\tbyte %d (%d)\n", byte, buffer[byte]); + // for each bit shift up + note = -1; + for (bit = 7; bit >= 0; bit--) { + //printf ("\t\tbit %d (%d)\n", (1<= 0) { + // if note, return value + //printf ("match %lld (c=%lld,b=%d,n=%d)\n", (((clust << bmp->vol->cluster_size_bits) + byte) << 3) + note, clust, byte, note); + return ((((clust << bmp->vol->cluster_size_bits) + byte) << 3) + note); + } + } + } + + return -1; +} + +/** + * ntfs_bmp_find_space + */ +int ntfs_bmp_find_space (struct ntfs_bmp *bmp, LCN start, long size) +{ + if (!bmp) + return 0; + + start = 0; + size = 0; + + /* + bmp find space - uncached bmp's + $Bitmap/$DATA free space on volume + dir/$BITMAP free index record + $MFT/$BITMAP free record in mft + */ + return 0; +} + + +#endif /* NTFS_RICH */ + diff --git a/libntfs/dir.c b/libntfs/dir.c index 3118f0ef..88c517b0 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -3,6 +3,7 @@ * * Copyright (c) 2002-2005 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -1506,3 +1507,391 @@ err_out: errno = err; return -1; } + + +#ifdef NTFS_RICH + +#include + +#include "layout.h" +#include "volume.h" +#include "inode.h" +#include "dir.h" +#include "tree.h" +#include "bitmap.h" +#include "index.h" +#include "rich.h" + +/** + * ntfs_dir_rollback + */ +int ntfs_dir_rollback (struct ntfs_dir *dir) +{ + int i; + + if (!dir) + return -1; + + if (ntfs_dt_rollback (dir->index) < 0) + return -1; + + if (ntfs_bmp_rollback (dir->bitmap) < 0) + return -1; + + for (i = 0; i < dir->child_count; i++) { + if (ntfs_dir_rollback (dir->children[i]) < 0) + return -1; + } + + return 0; +} + +/** + * ntfs_dir_truncate + */ +int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) +{ + //int i; + //u8 *buffer; + //int buf_count; + s64 last_bit; + INDEX_ENTRY *ie; + + if (!vol || !dir) + return -1; + + if ((dir->ialloc == NULL) || (dir->bitmap == NULL)) + return 0; + +#if 0 + buf_count = ROUND_UP (dir->bitmap->attr->allocated_size, vol->cluster_size) >> vol->cluster_size_bits; + printf ("alloc = %lld bytes\n", dir->ialloc->allocated_size); + printf ("alloc = %lld clusters\n", dir->ialloc->allocated_size >> vol->cluster_size_bits); + printf ("bitmap bytes 0 to %lld\n", ((dir->ialloc->allocated_size >> vol->cluster_size_bits)-1)>>3); + printf ("bitmap = %p\n", dir->bitmap); + printf ("bitmap = %lld bytes\n", dir->bitmap->attr->allocated_size); + printf ("bitmap = %d buffers\n", buf_count); +#endif + + last_bit = ntfs_bmp_find_last_set (dir->bitmap); + if (dir->ialloc->allocated_size == (dir->index_size * (last_bit + 1))) { + //printf ("nothing to do\n"); + return 0; + } + + printf (BOLD YELLOW "Truncation needed\n" END); + +#if 0 + printf ("\tlast bit = %lld\n", last_bit); + printf ("\tactual IALLOC size = %lld\n", dir->ialloc->allocated_size); + printf ("\tshould IALLOC size = %lld\n", dir->index_size * (last_bit + 1)); +#endif + + if ((dir->index_size * (last_bit + 1)) == 0) { + printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); + //rollback all dts + //ntfs_dt_rollback (dir->index); + //dir->index = NULL; + // What about the ROOT dt? + + ie = ntfs_ie_copy (dir->index->children[0]); + if (!ie) { + printf (RED "IE copy failed\n" END); + return -1; + } + + ie = ntfs_ie_remove_vcn (ie); + if (!ie) { + printf (RED "IE remove vcn failed\n" END); + return -1; + } + + //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); + //utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); + ntfs_dt_root_replace (dir->index, 0, dir->index->children[0], ie); + //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); + //printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); + + ntfs_ie_free (ie); + ie = NULL; + + //index flags remove LARGE_INDEX + dir->index->header->flags = 0; + + //rollback dir's bmp + ntfs_bmp_free (dir->bitmap); + dir->bitmap = NULL; + + /* + for (i = 0; i < dir->index->child_count; i++) { + ntfs_dt_rollback (dir->index->sub_nodes[i]); + dir->index->sub_nodes[i] = NULL; + } + */ + + //printf ("dir->index->inodes[0] = %p\n", dir->index->inodes[0]); + + //remove 0xA0 attribute + ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_INDEX_ALLOCATION); + + //remove 0xB0 attribute + ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_BITMAP); + } else { + printf (RED "Cannot shrink directory\n" END); + //ntfs_dir_shrink_alloc + //ntfs_dir_shrink_bitmap + //make bitmap resident? + } + + /* + * Remove + * dt -> dead + * bitmap updated + * rollback dead dts + * commit bitmap + * commit dts + * commit dir + */ + /* + * Reuse + * search for lowest dead + * update bitmap + * init dt + * remove from dead + * insert into tree + * init INDX + */ + +#if 0 + buffer = ntfs_bmp_get_data (dir->bitmap, 0); + if (!buffer) + return -1; + + utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); + for (i = buf_count-1; i >= 0; i--) { + if (buffer[i]) { + printf ("alloc in use\n"); + return 0; + } + } +#endif + + // /$BITMAP($I30) + // /$INDEX_ALLOCATION($I30) + // $Bitmap + + // Find the highest set bit in the directory bitmap + // can we free any clusters of the alloc? + // if yes, resize attribute + + // Are *any* bits set? + // If not remove ialloc + + return 0; +} + +/** + * ntfs_dir_commit + */ +int ntfs_dir_commit (struct ntfs_dir *dir) +{ + int i; + + if (!dir) + return 0; + + printf ("commit dir inode %llu\n", dir->inode->mft_no); + if (NInoDirty (dir->inode)) { +#ifdef RM_WRITE + ntfs_inode_sync (dir->inode); +#endif + printf (RED "\tntfs_inode_sync %llu\n" END, dir->inode->mft_no); + } + + if (ntfs_dt_commit (dir->index) < 0) + return -1; + + if (ntfs_bmp_commit (dir->bitmap) < 0) + return -1; + + for (i = 0; i < dir->child_count; i++) { + if (ntfs_dir_commit (dir->children[i]) < 0) + return -1; + } + + return 0; +} + +/** + * ntfs_dir_free + */ +void ntfs_dir_free (struct ntfs_dir *dir) +{ + struct ntfs_dir *parent; + int i; + + if (!dir) + return; + + ntfs_dir_rollback (dir); + + parent = dir->parent; + if (parent) { + for (i = 0; i < parent->child_count; i++) { + if (parent->children[i] == dir) { + parent->children[i] = NULL; + } + } + } + + ntfs_attr_close (dir->iroot); + ntfs_attr_close (dir->ialloc); + ntfs_inode_close2 (dir->inode); + + ntfs_dt_free (dir->index); + ntfs_bmp_free (dir->bitmap); + + for (i = 0; i < dir->child_count; i++) + ntfs_dir_free (dir->children[i]); + + free (dir->name); + free (dir->children); + free (dir); +} + +/** + * ntfs_dir_create + */ +struct ntfs_dir * ntfs_dir_create (ntfs_volume *vol, MFT_REF mft_num) +{ + struct ntfs_dir *dir = NULL; + ntfs_inode *inode = NULL; + ATTR_RECORD *rec = NULL; + INDEX_ROOT *ir = NULL; + FILE_NAME_ATTR *name = NULL; + + if (!vol) + return NULL; + + //printf ("ntfs_dir_create %lld\n", MREF (mft_num)); + inode = ntfs_inode_open2 (vol, mft_num); + if (!inode) + return NULL; + + dir = calloc (1, sizeof (*dir)); + if (!dir) { + ntfs_inode_close2 (inode); + return NULL; + } + + dir->inode = inode; + dir->iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); + dir->ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); + + if (!dir->iroot) { + ntfs_dir_free (dir); + return NULL; + } + + dir->vol = vol; + dir->parent = NULL; + dir->name = NULL; + dir->name_len = 0; + dir->index = NULL; + dir->children = NULL; + dir->child_count = 0; + dir->mft_num = mft_num; + + // This may not exist + dir->bitmap = ntfs_bmp_create (inode, AT_BITMAP, I30, 4); + + if (dir->iroot) { + rec = find_first_attribute (AT_INDEX_ROOT, inode->mrec); + ir = (INDEX_ROOT*) ((u8*)rec + rec->value_offset); + dir->index_size = ir->index_block_size; + } else { + // XXX !iroot? + dir->index_size = 0; + } + + // Finally, find the dir's name + rec = find_first_attribute (AT_FILE_NAME, inode->mrec); + name = (FILE_NAME_ATTR*) ((u8*)rec + rec->value_offset); + + dir->name_len = name->file_name_length; + dir->name = malloc (sizeof (ntfschar) * dir->name_len); + memcpy (dir->name, name->file_name, sizeof (ntfschar) * dir->name_len); + + return dir; +} + +/** + * ntfs_dir_add + */ +void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) +{ + if (!parent || !child) + return; + + parent->child_count++; + //printf ("child count = %d\n", parent->child_count); + parent->children = realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); + child->parent = parent; + + parent->children[parent->child_count-1] = child; +} + +/** + * ntfs_dir_find2 + */ +struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, int name_len) +{ + int i; + struct ntfs_dir *child = NULL; + struct ntfs_dt *dt = NULL; + int dt_num = 0; + INDEX_ENTRY *ie; + MFT_REF mft_num; + + if (!dir || !name) + return NULL; + + if (!dir->index) { // XXX when will this happen? + printf ("ntfs_dir_find2 - directory has no index\n"); + return NULL; + } + + for (i = 0; i < dir->child_count; i++) { + if (0 == ntfs_names_collate (name, name_len, + dir->children[i]->name, + dir->children[i]->name_len, + 2, IGNORE_CASE, + dir->vol->upcase, + dir->vol->upcase_len)) + return dir->children[i]; + } + + dt = ntfs_dt_find2 (dir->index, name, name_len, &dt_num); + if (!dt) { + printf ("can't find name in dir\n"); + return NULL; + } + + ie = dt->children[dt_num]; + + mft_num = ie->indexed_file; + + child = ntfs_dir_create (dir->vol, mft_num); + if (!child) + return NULL; + + child->index = ntfs_dt_create (child, NULL, -1); + + ntfs_dir_add (dir, child); + + return child; +} + + +#endif /* NTFS_RICH */ + diff --git a/libntfs/index.c b/libntfs/index.c index 41786e6f..1824e478 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -3,6 +3,7 @@ * * Copyright (c) 2004-2005 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -642,3 +643,228 @@ err_out: errno = err; return -1; } + + +#ifdef NTFS_RICH + +#include +#include + +#include "index.h" +#include "rich.h" + +/** + * ntfs_ie_free + */ +void ntfs_ie_free (INDEX_ENTRY *ie) +{ + free (ie); +} + +/** + * ntfs_ie_create + */ +INDEX_ENTRY * ntfs_ie_create (void) +{ + int length; + INDEX_ENTRY *ie; + + length = 16; + ie = calloc (1, length); + if (!ie) + return NULL; + + ie->indexed_file = 0; + ie->length = length; + ie->key_length = 0; + ie->flags = INDEX_ENTRY_END; + ie->reserved = 0; + return ie; +} + +/** + * ntfs_ie_get_vcn + */ +VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie) +{ + if (!ie) + return -1; + if (!(ie->flags & INDEX_ENTRY_NODE)) + return -1; + + return *((VCN*) ((u8*) ie + ie->length - 8)); +} + +/** + * ntfs_ie_copy + */ +INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie) +{ + INDEX_ENTRY *copy = NULL; + + if (!ie) + return NULL; + + copy = malloc (ie->length); + if (!copy) + return NULL; + memcpy (copy, ie, ie->length); + + return copy; +} + +/** + * ntfs_ie_set_vcn + */ +INDEX_ENTRY * ntfs_ie_set_vcn (INDEX_ENTRY *ie, VCN vcn) +{ + if (!ie) + return 0; + + if (!(ie->flags & INDEX_ENTRY_NODE)) { + ie->length += 8; + ie = realloc (ie, ie->length); + if (!ie) + return NULL; + + ie->flags |= INDEX_ENTRY_NODE; + } + + *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; + return ie; +} + +/** + * ntfs_ie_remove_vcn + */ +INDEX_ENTRY * ntfs_ie_remove_vcn (INDEX_ENTRY *ie) +{ + if (!ie) + return NULL; + if (!(ie->flags & INDEX_ENTRY_NODE)) + return ie; + + ie->length -= 8; + ie->flags &= ~INDEX_ENTRY_NODE; + ie = realloc (ie, ie->length); + return ie; +} + +/** + * ntfs_ie_set_name + */ +INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype) +{ + FILE_NAME_ATTR *file; + int need; + BOOL wipe = FALSE; + VCN vcn = 0; + + if (!ie || !name) + return NULL; + + /* + * INDEX_ENTRY + * MFT_REF indexed_file; + * u16 length; + * u16 key_length; + * INDEX_ENTRY_FLAGS flags; + * u16 reserved; + * + * FILENAME + * MFT_REF parent_directory; + * s64 creation_time; + * s64 last_data_change_time; + * s64 last_mft_change_time; + * s64 last_access_time; + * s64 allocated_size; + * s64 data_size; + * FILE_ATTR_FLAGS file_attributes; + * u32 reserved; + * u8 file_name_length; + * FILE_NAME_TYPE_FLAGS file_name_type; + * ntfschar file_name[l]; + * u8 reserved[n] + * + * VCN vcn; + */ + + //printf ("key length = 0x%02X\n", ie->key_length); + //printf ("new name length = %d\n", namelen); + if (ie->key_length > 0) { + file = &ie->key.file_name; + //printf ("filename, length %d\n", file->file_name_length); + need = ATTR_SIZE (namelen * sizeof (ntfschar) + 2) - + ATTR_SIZE (file->file_name_length * sizeof (ntfschar) + 2); + } else { + //printf ("no filename\n"); + need = ATTR_SIZE (sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar))); + wipe = TRUE; + } + + //printf ("need 0x%02X bytes\n", need); + + if (need != 0) { + if (ie->flags & INDEX_ENTRY_NODE) + vcn = ntfs_ie_get_vcn (ie); + + ie->length += need; + ie->key_length += need; + + //printf ("realloc 0x%02X\n", ie->length); + ie = realloc (ie, ie->length); + if (!ie) + return NULL; + + if (ie->flags & INDEX_ENTRY_NODE) + ie = ntfs_ie_set_vcn (ie, vcn); + + if (wipe) + memset (&ie->key.file_name, 0, sizeof (FILE_NAME_ATTR)); + if (need > 0) + memset ((u8*)ie + ie->length - need, 0, need); + } + + memcpy (ie->key.file_name.file_name, name, namelen * sizeof (ntfschar)); + + ie->key.file_name.file_name_length = namelen; + ie->key.file_name.file_name_type = nametype; + ie->flags &= ~INDEX_ENTRY_END; + + //printf ("ie->length = 0x%02X\n", ie->length); + //printf ("ie->key_length = 0x%02X\n", ie->key_length); + + return ie; +} + +/** + * ntfs_ie_remove_name + */ +INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) +{ + VCN vcn = 0; + + if (!ie) + return NULL; + if (ie->key_length == 0) + return ie; + + if (ie->flags & INDEX_ENTRY_NODE) + vcn = ntfs_ie_get_vcn (ie); + + ie->length -= ATTR_SIZE (ie->key_length); + ie->key_length = 0; + ie->flags |= INDEX_ENTRY_END; + + ie = realloc (ie, ie->length); + if (!ie) + return NULL; + + if (ie->flags & INDEX_ENTRY_NODE) + ie = ntfs_ie_set_vcn (ie, vcn); + return ie; +} + + +#endif /* NTFS_RICH */ + diff --git a/libntfs/inode.c b/libntfs/inode.c index d91c870b..96a41854 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -3,6 +3,7 @@ * * Copyright (c) 2002-2005 Anton Altaparmakov * Copyright (c) 2004-2005 Yura Pakhuchiy + * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -1083,3 +1084,121 @@ put_err_out: errno = err; return -1; } + + +#ifdef NTFS_RICH + +/** + * ntfs_inode_close2 + */ +int ntfs_inode_close2 (ntfs_inode *ni) +{ + if (!ni) + return 0; + + //printf (BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); + + ni->ref_count--; + if (ni->ref_count > 0) + return 0; + + // unlink + // ino->private_data + + // XXX temporary until we have commit/rollback + NInoClearDirty(ni); + + return ntfs_inode_close (ni); +} + +/** + * ntfs_inode_open2 + */ +ntfs_inode * ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) +{ + ntfs_inode *ino = NULL; + struct ntfs_dir *dir; + + if (!vol) + return NULL; + + switch (mref) { + case FILE_Bitmap: ino = vol->lcnbmp_ni; break; + case FILE_MFT: ino = vol->mft_ni; break; + case FILE_MFTMirr: ino = vol->mftmirr_ni; break; + case FILE_root: + dir = vol->private_data; + if (dir) + ino = dir->inode; + break; + } + + if (ino) { + //printf (BOLD YELLOW "inode reuse %lld\n" END, mref); + ino->ref_count++; + return ino; + } + + ino = ntfs_inode_open (vol, mref); + if (!ino) + return NULL; + + /* + if (mref != FILE_root) + ntfs_inode_dir_map (ino); + */ + + // link + // ino->private_data + + ino->private_data = NULL; + ino->ref_count = 1; + + //printf (BOLD YELLOW "inode open %lld\n" END, mref); + return ino; +} + +/** + * ntfs_inode_open3 + * open a deleted inode + */ +ntfs_inode * ntfs_inode_open3 (ntfs_volume *vol, const MFT_REF mref) +{ + ntfs_inode *ino = NULL; + + if (!vol) + return NULL; + + ino = calloc (1, sizeof (*ino)); + if (!ino) + return NULL; + + ino->mrec = malloc (vol->mft_record_size); + if (!ino->mrec) { + free (ino); + return NULL; + } + + ino->mft_no = mref; + ino->vol = vol; + + ino->data_size = -1; + ino->allocated_size = -1; + + ino->private_data = NULL; + ino->ref_count = 1; + + if (1 != ntfs_attr_mst_pread (vol->mft_na, MREF(mref) * vol->mft_record_size, 1, vol->mft_record_size, ino->mrec)) { + //ntfs_inode_close2 (ino); ??? + free (ino->mrec); + free (ino); + return NULL; + } + + NInoSetDirty (ino); + return ino; +} + + +#endif /* NTFS_RICH */ + diff --git a/libntfs/mft.c b/libntfs/mft.c index ce4ed5fb..beb682fc 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -3,6 +3,7 @@ * * Copyright (c) 2000-2004 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -1543,3 +1544,340 @@ sync_rollback: errno = err; return -1; } + + +#ifdef NTFS_RICH + +#include "bitmap.h" +#include "dir.h" +#include "tree.h" +#include "index.h" +#include "rich.h" + +/** + * ntfs_mft_remove_attr + */ +int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES type) +{ + ATTR_RECORD *attr20, *attrXX; + MFT_RECORD *mft; + u8 *src, *dst; + int len; + + if (!inode) + return 1; + + attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, inode->mrec); + if (attr20) + return 1; + + printf ("remove inode %lld, attr 0x%02X\n", inode->mft_no, type); + + attrXX = find_first_attribute (type, inode->mrec); + if (!attrXX) + return 1; + + if (utils_free_non_residents3 (bmp, inode, attrXX)) + return 1; + + // remove entry + // inode->mrec + + mft = inode->mrec; + //utils_dump_mem (mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); + + //utils_dump_mem (attrXX, 0, attrXX->length, DM_DEFAULTS); printf ("\n"); + + //printf ("mrec = %p, attr = %p, diff = %d (0x%02X)\n", mft, attrXX, (u8*)attrXX - (u8*)mft, (u8*)attrXX - (u8*)mft); + // memmove + + dst = (u8*) attrXX; + src = dst + attrXX->length; + len = (((u8*) mft + mft->bytes_in_use) - src); + + // fix mft header + mft->bytes_in_use -= attrXX->length; + +#if 0 + printf ("dst = 0x%02X, src = 0x%02X, len = 0x%02X\n", (dst - (u8*)mft), (src - (u8*)mft), len); + printf ("attr %02X, len = 0x%02X\n", attrXX->type, attrXX->length); + printf ("bytes in use = 0x%02X\n", mft->bytes_in_use); + printf ("\n"); +#endif + + memmove (dst, src, len); + //utils_dump_mem (mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); + + NInoSetDirty(inode); + return 0; +} + +/** + * ntfs_mft_add_attr + */ +ATTR_RECORD * ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int data_len) +{ + MFT_RECORD *mrec; + ATTR_RECORD *attr; + u8 *ptr; + u8 *src; + u8 *dst; + int len; + int attr_size; + + if (!inode) + return NULL; + if (!data) + return NULL; + + attr_size = ATTR_SIZE (data_len); + + mrec = inode->mrec; + if (!mrec) + return NULL; + + if ((mrec->bytes_in_use + attr_size + 0x18) > mrec->bytes_allocated) { + printf ("attribute is too big to fit in the record\n"); + return NULL; + } + + ptr = (u8*) inode->mrec + mrec->attrs_offset; + while (1) { + attr = (ATTR_RECORD*) ptr; + + if (type < attr->type) + break; + + ptr += attr->length; + } + + //printf ("insert before attr 0x%02X\n", attr->type); + + len = ((u8*) mrec + mrec->bytes_in_use) - ((u8*) attr); + src = (u8*) attr; + dst = src + attr_size + 0x18; + + memmove (dst, src, len); + + src = data; + dst = (u8*) attr + 0x18; + len = data_len; + + // XXX wipe slack space after attr? + + memcpy (dst, src, len); + + mrec->bytes_in_use += attr_size + 0x18; + + memset (attr, 0, 0x18); + *(u32*)((u8*) attr + 0x00) = type; + *(u32*)((u8*) attr + 0x04) = attr_size + 0x18; + *(u16*)((u8*) attr + 0x0E) = mrec->next_attr_instance; + *(u32*)((u8*) attr + 0x10) = data_len; + *(u32*)((u8*) attr + 0x14) = 0x18; + + mrec->next_attr_instance++; + + return attr; +} + +/** + * ntfs_mft_resize_resident + */ +int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len, u8 *data, int data_len) +{ + int mft_size; + int mft_usage; + int mft_free; + int attr_orig; + int attr_new; + u8 *src; + u8 *dst; + u8 *end; + int len; + ntfs_attr_search_ctx *ctx = NULL; + ATTR_RECORD *arec = NULL; + MFT_RECORD *mrec = NULL; + int res = -1; + + // XXX only works when attr is in base inode + + if ((!inode) || (!inode->mrec)) + return -1; + if ((!data) || (data_len < 0)) + return -1; + + mrec = inode->mrec; + + mft_size = mrec->bytes_allocated; + mft_usage = mrec->bytes_in_use; + mft_free = mft_size - mft_usage; + + //printf ("mft_size = %d\n", mft_size); + //printf ("mft_usage = %d\n", mft_usage); + //printf ("mft_free = %d\n", mft_free); + //printf ("\n"); + + ctx = ntfs_attr_get_search_ctx (NULL, mrec); + if (!ctx) + goto done; + + if (ntfs_attr_lookup(type, name, name_len, CASE_SENSITIVE, 0, NULL, 0, ctx) != 0) + goto done; + + arec = ctx->attr; + + if (arec->non_resident) { + printf ("attribute isn't resident\n"); + goto done; + } + + attr_orig = arec->value_length; + attr_new = data_len; + + //printf ("attr orig = %d\n", attr_orig); + //printf ("attr new = %d\n", attr_new); + //printf ("\n"); + + if ((attr_new - attr_orig + mft_usage) > mft_size) { + printf ("attribute won't fit into mft record\n"); + goto done; + } + + //printf ("new free space = %d\n", mft_size - (attr_new - attr_orig + mft_usage)); + + src = (u8*)arec + arec->length; + dst = src + (attr_new - attr_orig); + end = (u8*)mrec + mft_usage; + len = end - src; + + //printf ("src = %d\n", src - (u8*)mrec); + //printf ("dst = %d\n", dst - (u8*)mrec); + //printf ("end = %d\n", end - (u8*)mrec); + //printf ("len = %d\n", len); + + if (src != dst) + memmove (dst, src, len); + + memcpy ((u8*)arec + arec->value_offset, data, data_len); + + mrec->bytes_in_use += (attr_new - attr_orig); + arec->length += (attr_new - attr_orig); + arec->value_length += (attr_new - attr_orig); + + memset ((u8*)mrec + mrec->bytes_in_use, 0, mft_size - mrec->bytes_in_use); + + mft_usage += (attr_new - attr_orig); + //utils_dump_mem (mrec, 0, mft_size, DM_DEFAULTS); + res = 0; +done: + ntfs_attr_put_search_ctx (ctx); + return res; +} + +/** + * ntfs_mft_free_space + */ +int ntfs_mft_free_space (struct ntfs_dir *dir) +{ + int res = 0; + MFT_RECORD *mft; + + if ((!dir) || (!dir->inode)) + return -1; + + mft = (MFT_RECORD*) dir->inode->mrec; + + res = mft->bytes_allocated - mft->bytes_in_use; + + return res; +} + +/** + * ntfs_mft_add_index + */ +int ntfs_mft_add_index (struct ntfs_dir *dir) +{ + ntfs_volume *vol; + u8 *buffer = NULL; + ATTR_RECORD *attr = NULL; + struct ntfs_dt *dt = NULL; + INDEX_ENTRY *ie = NULL; + + if (!dir) + return 1; + if (dir->bitmap && dir->ialloc) + return 0; + if (dir->bitmap || dir->ialloc) + return 1; + if (dir->index_size < 512) + return 1; + + vol = dir->vol; + printf ("add two attrs to " YELLOW); ntfs_name_print (dir->name, dir->name_len); printf (END "\n"); + printf ("index size = %d\n", dir->index_size); + + buffer = malloc (dir->index_size); + if (!buffer) + return 1; + + dt = ntfs_dt_create (dir, dir->index, -1); + if (!dt) + return 1; + + dt->vcn = 0; // New alloc record + + ie = ntfs_ie_copy (dir->index->children[dir->index->child_count-1]); + ie = ntfs_ie_set_vcn (ie, dt->vcn); + + // can't replace ie yet, there may not be room + ntfs_ie_free (ie); + + ntfs_dt_transfer2 (dir->index, dt, 0, dir->index->child_count - 1); + + printf ("root has %d children\n", dir->index->child_count); + printf ("node has %d children\n", dt->child_count); + + ntfs_dt_free (dt); + + // create a new dt + // attach dt to dir + // move entries into alloc + // shrink root + + // transfer keys to new node + // hook up root & alloc dts + + // need disk allocation before here + + // Index Allocation + memset (buffer, 0, 128); + attr = ntfs_mft_add_attr (dir->inode, AT_INDEX_ALLOCATION, buffer, 0x48); + + // Bitmap + memset (buffer, 0, 8); + buffer[0] = 0x01; + //printf ("inode = %p\n", dir->inode); + attr = ntfs_mft_add_attr (dir->inode, AT_BITMAP, buffer, 8); + + // attach alloc and bitmap to dir + // need to create ntfs_attr's for them + + // one indx record + // 8 bits of bitmap + + if (0) ntfs_bmp_find_space (NULL, 0, 0); + + //printf ("m1 = %lld\n", vol->mft_zone_start); + //printf ("m2 = %lld\n", vol->mft_zone_end); + //printf ("m3 = %lld\n", vol->mft_zone_pos); + //printf ("z1 = %lld\n", vol->data1_zone_pos); + //printf ("z2 = %lld\n", vol->data2_zone_pos); + + free (buffer); + return 0; +} + + +#endif /* NTFS_RICH */ + diff --git a/libntfs/rich.c b/libntfs/rich.c new file mode 100644 index 00000000..aefe4a3e --- /dev/null +++ b/libntfs/rich.c @@ -0,0 +1,177 @@ +/** + * rich.c - Temporary junk file. Part of the Linux-NTFS project. + * + * Copyright (c) 2004-2005 Richard Russon + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef NTFS_RICH + +#include +#include "rich.h" +#include "layout.h" + +/** + * find_attribute - Find an attribute of the given type + * @type: An attribute type, e.g. AT_FILE_NAME + * @ctx: A search context, created using ntfs_get_attr_search_ctx + * + * Using the search context to keep track, find the first/next occurrence of a + * given attribute type. + * + * N.B. This will return a pointer into @mft. As long as the search context + * has been created without an inode, it won't overflow the buffer. + * + * Return: Pointer Success, an attribute was found + * NULL Error, no matching attributes were found + */ +ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) +{ + if (!ctx) { + errno = EINVAL; + return NULL; + } + + if (ntfs_attr_lookup(type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { + Dprintf ("find_attribute didn't find an attribute of type: 0x%02x.\n", type); + return NULL; /* None / no more of that type */ + } + + Dprintf ("find_attribute found an attribute of type: 0x%02x.\n", type); + return ctx->attr; +} + +/** + * find_first_attribute - Find the first attribute of a given type + * @type: An attribute type, e.g. AT_FILE_NAME + * @mft: A buffer containing a raw MFT record + * + * Search through a raw MFT record for an attribute of a given type. + * The return value is a pointer into the MFT record that was supplied. + * + * N.B. This will return a pointer into @mft. The pointer won't stray outside + * the buffer, since we created the search context without an inode. + * + * Return: Pointer Success, an attribute was found + * NULL Error, no matching attributes were found + */ +ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) +{ + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *rec; + + if (!mft) { + errno = EINVAL; + return NULL; + } + + ctx = ntfs_attr_get_search_ctx (NULL, mft); + if (!ctx) { + //XXX Eprintf ("Couldn't create a search context.\n"); + return NULL; + } + + rec = find_attribute (type, ctx); + ntfs_attr_put_search_ctx (ctx); + if (rec) + Dprintf ("find_first_attribute: found attr of type 0x%02x.\n", type); + else + Dprintf ("find_first_attribute: didn't find attr of type 0x%02x.\n", type); + return rec; +} + +/** + * ntfs_name_print + */ +void ntfs_name_print (ntfschar *name, int name_len) +{ + char *buffer = NULL; + + if (name_len) { + ntfs_ucstombs (name, name_len, &buffer, 0); + printf ("%s", buffer); + free (buffer); + } else { + printf ("!"); + } +} + +/** + * utils_free_non_residents3 + */ +int utils_free_non_residents3 (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECORD *attr) +{ + ntfs_attr *na; + runlist_element *rl; + LCN size; + LCN count; + + if (!bmp) + return 1; + if (!inode) + return 1; + if (!attr) + return 1; + if (!attr->non_resident) + return 0; + + na = ntfs_attr_open (inode, attr->type, NULL, 0); + if (!na) + return 1; + + ntfs_attr_map_whole_runlist (na); + rl = na->rl; + size = na->allocated_size >> inode->vol->cluster_size_bits; + for (count = 0; count < size; count += rl->length, rl++) { + if (ntfs_bmp_set_range (bmp, rl->lcn, rl->length, 0) < 0) { + printf (RED "set range : %lld - %lld FAILED\n" END, rl->lcn, rl->lcn+rl->length-1); + } + } + ntfs_attr_close (na); + + return 0; +} + +/** + * utils_free_non_residents2 + */ +int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) +{ + ntfs_attr_search_ctx *ctx; + + if (!inode) + return -1; + if (!bmp) + return -1; + + ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); + if (!ctx) { + printf ("can't create a search context\n"); + return -1; + } + + while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { + utils_free_non_residents3 (bmp, inode, ctx->attr); + } + + ntfs_attr_put_search_ctx (ctx); + return 0; +} + + +#endif /* NTFS_RICH */ + diff --git a/libntfs/tree.c b/libntfs/tree.c new file mode 100644 index 00000000..dbbaec36 --- /dev/null +++ b/libntfs/tree.c @@ -0,0 +1,2119 @@ +/** + * tree.c - Directory tree handling code. Part of the Linux-NTFS project. + * + * Copyright (c) 2004-2005 Richard Russon + * + * This program/include file 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 of the License, or + * (at your option) any later version. + * + * This program/include file 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 (in the main directory of the Linux-NTFS + * distribution in the file COPYING); if not, write to the Free Software + * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef NTFS_RICH + +#include "config.h" + +#ifdef HAVE_STDLIB_H +#include +#endif + +#include "volume.h" +#include "dir.h" + +#include "tree.h" +#include "bitmap.h" +#include "index.h" +#include "inode.h" +#include "rich.h" + +/** + * ntfs_dt_free + */ +void ntfs_dt_free (struct ntfs_dt *dt) +{ + int i; + + if (!dt) + return; + + for (i = 0; i < dt->child_count; i++) { + ntfs_dt_free (dt->sub_nodes[i]); + ntfs_inode_close2 (dt->inodes[i]); + } + + free (dt->sub_nodes); + free (dt->children); + free (dt->inodes); + free (dt->data); // XXX is this always ours? + free (dt); +} + +/** + * ntfs_dt_rollback + */ +int ntfs_dt_rollback (struct ntfs_dt *dt) +{ + int i; + + if (!dt) + return 0; + if (dt->child_count == 0) // No children or nothing mapped + return 0; + + if (dt->changed) { + // We can't trust anything below us in the tree + for (i = 0; i < dt->child_count; i++) { + ntfs_dt_free (dt->sub_nodes[i]); + ntfs_inode_close2 (dt->inodes[i]); + } + + dt->child_count = 0; + + free (dt->data); + free (dt->children); + free (dt->sub_nodes); + free (dt->inodes); + + dt->data = NULL; + dt->children = NULL; + dt->sub_nodes = NULL; + dt->inodes = NULL; + } else { + // This node is OK, check the su-nodes + for (i = 0; i < dt->child_count; i++) { + if (ntfs_dt_rollback (dt->sub_nodes[i])) { + ntfs_inode_close2 (dt->inodes[i]); + // Child was changed so unmap it + dt->sub_nodes[i] = NULL; + dt->inodes[i] = NULL; + } + } + } + + return (dt->child_count == 0); +} + +/** + * ntfs_dt_commit + */ +int ntfs_dt_commit (struct ntfs_dt *dt) +{ + ntfs_volume *vol; + ntfs_attr *attr; + struct ntfs_dir *dir; + int i; + int size; + + if (!dt) + return 0; + + dir = dt->dir; + if (!dir) + return -1; + + vol = dir->vol; // cluster size + + if (dt->changed) { + if (dt->parent) { + printf ("commit dt (alloc)\n"); + attr = dt->dir->ialloc; + size = dt->dir->index_size; + //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); +#ifdef RM_WRITE + ntfs_attr_mst_pwrite(attr, dt->vcn * vol->cluster_size, 1, size, dt->data); // XXX retval +#endif + } else { + printf ("commit dt (root)\n"); + attr = dt->dir->iroot; + size = dt->data_len; + //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); +#ifdef RM_WRITE + ntfs_attr_pwrite(attr, 0, size, dt->data); // XXX retval +#endif + } + + printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, dt->vcn); + + dt->changed = FALSE; + } + + for (i = 0; i < dt->child_count; i++) { + if ((dt->inodes[i]) && (NInoDirty (dt->inodes[i]))) { + //utils_dump_mem (dt->inodes[i]->mrec, 0, vol->mft_record_size, DM_DEFAULTS); +#ifdef RM_WRITE + ntfs_inode_sync (dt->inodes[i]); +#endif + printf (RED "\tntfs_inode_sync %llu\n" END, dt->inodes[i]->mft_no); + } + + if (ntfs_dt_commit (dt->sub_nodes[i]) < 0) + return -1; + } + + return 0; +} + +/** + * ntfs_dt_create_children2 + */ +BOOL ntfs_dt_create_children2 (struct ntfs_dt *dt, int count) +{ + // XXX calculate for 2K and 4K indexes max and min filenames (inc/exc VCN) + + int old = (dt->child_count + 0x1e) & ~0x1f; + int new = (count + 0x1f) & ~0x1f; + + if (old == new) + return TRUE; + + dt->children = realloc (dt->children, new * sizeof (*dt->children)); + dt->sub_nodes = realloc (dt->sub_nodes, new * sizeof (*dt->sub_nodes)); + dt->inodes = realloc (dt->inodes, new * sizeof (*dt->inodes)); + + if (!dt->children || !dt->sub_nodes || !dt->inodes) + return FALSE; // dt->child_count = -1 ? + + memset ((u8*)dt->children + old, 0, (new - old) * sizeof (*dt->children)); + memset ((u8*)dt->sub_nodes + old, 0, (new - old) * sizeof (*dt->sub_nodes)); + memset ((u8*)dt->inodes + old, 0, (new - old) * sizeof (*dt->inodes)); + + return TRUE; +} + +/** + * ntfs_dt_resize_children3 + */ +BOOL ntfs_dt_resize_children3 (struct ntfs_dt *dt, int new) +{ + int old; + + // XXX calculate for 2K and 4K indexes max and min filenames (inc/exc VCN) + // XXX assumption: sizeof (*dt->children) == sizeof (*dt->sub_nodes) == sizeof (*dt->inodes) + // XXX put back blocking factor + + if (!dt) + return FALSE; + + old = dt->child_count; + if (old == new) + return TRUE; + + dt->child_count = new; + + old *= sizeof (*dt->children); + new *= sizeof (*dt->children); + + dt->children = realloc (dt->children, new); + dt->sub_nodes = realloc (dt->sub_nodes, new); + dt->inodes = realloc (dt->inodes, new); + + if (!dt->children || !dt->sub_nodes || !dt->inodes) + return FALSE; + + if (new > old) { + memset ((u8*)dt->children + old, 0, (new - old)); + memset ((u8*)dt->sub_nodes + old, 0, (new - old)); + memset ((u8*)dt->inodes + old, 0, (new - old)); + } + + return TRUE; +} + +/** + * ntfs_dt_root_count + */ +int ntfs_dt_root_count (struct ntfs_dt *dt) +{ + u8 *buffer = NULL; + u8 *ptr = NULL; + VCN vcn; + s64 size = 0; + char *name = NULL; + + INDEX_ROOT *root; + INDEX_HEADER *header; + INDEX_ENTRY *entry; + + if (!dt) + return -1; + + buffer = dt->data; + size = dt->data_len; + + root = (INDEX_ROOT*) buffer; + if (root->type != AT_FILE_NAME) + return -1; + + header = (INDEX_HEADER*) (buffer + 0x10); + if (header->index_length > size) + return -1; + + dt->child_count = 0; + ptr = buffer + header->entries_offset + 0x10; + + while (ptr < (buffer + size)) { + entry = (INDEX_ENTRY*) ptr; + + ntfs_dt_resize_children3 (dt, dt->child_count + 1); // XXX retval + + if (entry->flags & INDEX_ENTRY_NODE) { + vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); + //printf ("VCN %lld\n", vcn); + } + + if (!(entry->flags & INDEX_ENTRY_END)) { + ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0); + //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); + free (name); + name = NULL; + } + + //printf ("CC[%d] = %p\n", dt->child_count-1, entry); + dt->children[dt->child_count-1] = entry; + + ptr += entry->length; + } + + //printf ("count = %d\n\n", dt->child_count); + + return dt->child_count; +} + +/** + * ntfs_dt_alloc_count + */ +int ntfs_dt_alloc_count (struct ntfs_dt *dt) +{ + u8 *buffer = NULL; + u8 *ptr = NULL; + VCN vcn; + s64 size = 0; + char *name = NULL; + + INDEX_BLOCK *block; + INDEX_ENTRY *entry; + + if (!dt) + return -1; + + buffer = dt->data; + size = dt->data_len; + + //utils_dump_mem (buffer, 0, 128, DM_DEFAULTS); + + block = (INDEX_BLOCK*) buffer; + //printf ("INDX %lld\n", block->index_block_vcn); + + ptr = buffer + 0x18 + block->index.entries_offset; + + //printf ("block size %d\n", block->index.index_length); + dt->child_count = 0; + //printf ("start = 0x%02X, end = 0x%02X\n", 0x18 + block->index.entries_offset, 0x18 + block->index.index_length); + while (ptr < (buffer + 0x18 + block->index.index_length)) { + entry = (INDEX_ENTRY*) ptr; + + ntfs_dt_resize_children3 (dt, dt->child_count + 1); // XXX retval + + if (entry->flags & INDEX_ENTRY_NODE) { + vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); + //printf ("\tVCN %lld\n", vcn); + } + + dt->children[dt->child_count-1] = entry; + + if (entry->flags & INDEX_ENTRY_END) { + break; + } else { + ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0); + //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); + free (name); + name = NULL; + } + + ptr += entry->length; + } + //printf ("count = %d\n", dt->child_count); + + return dt->child_count; +} + +/** + * ntfs_dt_initialise2 + */ +int ntfs_dt_initialise2 (ntfs_volume *vol, struct ntfs_dt *dt) +{ + INDEX_ALLOCATION *alloc; + INDEX_ENTRY *entry; + + if (!vol) + return 1; + if (!dt) + return 1; + + memset (dt->data, 0, dt->data_len); + + alloc = (INDEX_ALLOCATION*) dt->data; + + alloc->magic = magic_INDX; + alloc->usa_ofs = 0x28; + alloc->usa_count = (dt->data_len >> vol->sector_size_bits) + 1; + alloc->lsn = 0; + alloc->index_block_vcn = 0; + + alloc->index.entries_offset = 0x28; + alloc->index.index_length = 0x10 + 0x28; + alloc->index.allocated_size = dt->data_len - 0x18; + alloc->index.flags = 0; + + entry = (INDEX_ENTRY*) (dt->data + 0x40); + + entry->indexed_file = 0; + entry->length = 0x10; + entry->key_length = 0; + entry->flags = INDEX_ENTRY_END; + + ntfs_dt_resize_children3 (dt, 1); // XXX retval + + dt->children[0] = entry; + + return 0; +} + +/** + * ntfs_dt_create + */ +struct ntfs_dt * ntfs_dt_create (struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn) +{ + struct ntfs_dt *dt = NULL; + //int i; + + if (!dir) + return NULL; + + dt = calloc (1, sizeof (*dt)); + if (!dt) + return NULL; + + dt->dir = dir; + dt->parent = parent; + dt->child_count = 0; + dt->children = NULL; + dt->sub_nodes = NULL; + dt->inodes = NULL; + dt->vcn = vcn; + dt->changed = FALSE; + + if (parent) { + //printf ("alloc a = %lld\n", dir->ialloc->allocated_size); + //printf ("alloc d = %lld\n", dir->ialloc->data_size); + //printf ("alloc i = %lld\n", dir->ialloc->initialized_size); + //printf ("vcn = %lld\n", vcn); + + dt->data_len = dt->dir->index_size; + //printf ("parent size = %d\n", dt->data_len); + dt->data = malloc (dt->data_len); + + if (vcn >= 0) { + //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data)); + ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data); + } else { + ntfs_dt_initialise2 (dir->vol, dt); + } + + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); + //printf ("\n"); + + ntfs_dt_alloc_count (dt); + + dt->header = &((INDEX_BLOCK*)dt->data)->index; + //printf ("USA = %d\n", ((INDEX_BLOCK*)dt->data)->usa_count); + +#if 0 + for (i = 0; i < dt->child_count; i++) { + INDEX_ENTRY *ie = dt->children[i]; + + printf ("%d\n", ((u8*)ie) - dt->data); + if (ie->flags & INDEX_ENTRY_END) + printf ("IE (%d)\n", ie->length); + else + printf ("IE %lld (%d)\n", MREF (ie->key.file_name.parent_directory), ie->length); + utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); + printf ("\n"); + } +#endif + } else { + //printf ("root a = %lld\n", dir->iroot->allocated_size); + //printf ("root d = %lld\n", dir->iroot->data_size); + //printf ("root i = %lld\n", dir->iroot->initialized_size); + + dt->data_len = dir->iroot->allocated_size; + dt->data = malloc (dt->data_len); + //printf ("%lld\n", ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data)); + ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data); + //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); + //printf ("\n"); + + ntfs_dt_root_count (dt); + + dt->header = &((INDEX_ROOT*)dt->data)->index; + //dt->data_len = ((INDEX_ROOT*)dt->data)->index_block_size; + //printf ("IBS = %d\n", ((INDEX_ROOT*)dt->data)->index_block_size); + +#if 0 + for (i = 0; i < dt->child_count; i++) { + INDEX_ENTRY *ie = dt->children[i]; + + printf ("%d\n", ((u8*)ie) - dt->data); + if (ie->flags & INDEX_ENTRY_END) + printf ("IE (%d)\n", ie->length); + else + printf ("IE %lld (%d)\n", MREF (ie->key.file_name.parent_directory), ie->length); + utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); + printf ("\n"); + } +#endif + } + //printf ("index_header (%d,%d)\n", dt->header.index_length, dt->header.allocated_size); + + return dt; +} + +/** + * ntfs_dt_find + * find dt by name, return MFT_REF + * maps dt's as necessary + */ +MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) +{ + MFT_REF res = -1; + INDEX_ENTRY *ie; + struct ntfs_dt *sub; + VCN vcn; + int i; + int r; + + if (!dt || !name) + return -1; + + /* + * State Children Action + * ------------------------------------------- + * collates after - keep searching + * match name - return MREF + * collates before no return -1 + * collates before yes map & recurse + * end marker no return -1 + * end marker yes map & recurse + */ + + //printf ("child_count = %d\n", dt->child_count); + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + if (ie->flags & INDEX_ENTRY_END) { + r = -1; + } else { + //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); + r = ntfs_names_collate (name, name_len, + ie->key.file_name.file_name, + ie->key.file_name.file_name_length, + 2, IGNORE_CASE, + dt->dir->vol->upcase, + dt->dir->vol->upcase_len); + } + + //printf ("%d, %d\n", i, r); + + if (r == 1) { + //printf ("keep searching\n"); + continue; + } else if (r == 0) { + res = MREF (ie->indexed_file); + //printf ("match %lld\n", res); + } else if (r == -1) { + if (ie->flags & INDEX_ENTRY_NODE) { + //printf ("map & recurse\n"); + //printf ("sub %p\n", dt->sub_nodes); + if (!dt->sub_nodes[i]) { + vcn = ntfs_ie_get_vcn (ie); + //printf ("vcn = %lld\n", vcn); + sub = ntfs_dt_create (dt->dir, dt, vcn); + dt->sub_nodes[i] = sub; + } + res = ntfs_dt_find (dt->sub_nodes[i], name, name_len); + } else { + //printf ("ENOENT\n"); + } + } else { + printf ("error collating name\n"); + } + break; + } + + return res; +} + +/** + * ntfs_dt_find2 + * find dt by name, returns dt and index + * maps dt's as necessary + */ +struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) +{ + struct ntfs_dt *res = NULL; + INDEX_ENTRY *ie; + VCN vcn; + int i; + int r; + + if (!dt || !name) + return NULL; + + // XXX default index_num to -1 + + /* + * State Children Action + * ------------------------------------------- + * collates after - keep searching + * match name - return MREF + * collates before no return -1 + * collates before yes map & recurse + * end marker no return -1 + * end marker yes map & recurse + */ + + //printf ("child_count = %d\n", dt->child_count); + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + if (ie->flags & INDEX_ENTRY_END) { + r = -1; + } else { + //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); + r = ntfs_names_collate (name, name_len, + ie->key.file_name.file_name, + ie->key.file_name.file_name_length, + 2, IGNORE_CASE, + dt->dir->vol->upcase, + dt->dir->vol->upcase_len); + } + + //printf ("%d, %d\n", i, r); + + if (r == 1) { + //printf ("keep searching\n"); + continue; + } else if (r == 0) { + res = dt; + //printf ("match %p\n", res); + if (index_num) + *index_num = i; + } else if ((r == -1) && (ie->flags & INDEX_ENTRY_NODE)) { + //printf ("recurse\n"); + if (!dt->sub_nodes[i]) { + vcn = ntfs_ie_get_vcn (ie); + //printf ("vcn = %lld\n", vcn); + dt->sub_nodes[i] = ntfs_dt_create (dt->dir, dt, vcn); + } + res = ntfs_dt_find2 (dt->sub_nodes[i], name, name_len, index_num); + } else { + printf ("error collating name\n"); + } + break; + } + + return res; +} + +/** + * ntfs_dt_find3 + * find dt by name, returns dt and index + * does not map new dt's + */ +struct ntfs_dt * ntfs_dt_find3 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) +{ + struct ntfs_dt *res = NULL; + INDEX_ENTRY *ie; + int i; + int r; + + if (!dt || !name) + return NULL; + + //printf ("child_count = %d\n", dt->child_count); + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + if (ie->flags & INDEX_ENTRY_END) { + r = -1; + } else { + //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); + r = ntfs_names_collate (name, name_len, + ie->key.file_name.file_name, + ie->key.file_name.file_name_length, + 2, IGNORE_CASE, + dt->dir->vol->upcase, + dt->dir->vol->upcase_len); + } + + //printf ("%d, %d\n", i, r); + + if (r == 1) { + //printf ("keep searching\n"); + continue; + } else if (r == 0) { + res = dt; + //printf ("match %p\n", res); + if (index_num) + *index_num = i; + } else if (r == -1) { + if (ie->flags & INDEX_ENTRY_NODE) { + //printf ("recurse\n"); + res = ntfs_dt_find3 (dt->sub_nodes[i], name, name_len, index_num); + } else { + //printf ("no match\n"); + res = dt; + if (index_num) + *index_num = i; + } + } else { + printf ("error collating name\n"); + } + break; + } + + return res; +} + +/** + * ntfs_dt_find4 + * find successor to specified name, returns dt and index + * maps dt's as necessary + */ +struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) +{ + struct ntfs_dt *res = NULL; + struct ntfs_dt *sub = NULL; + INDEX_ENTRY *ie; + VCN vcn; + int i; + int r; + + if (!dt || !name) + return NULL; + + //printf ("child_count = %d\n", dt->child_count); + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + //printf ("ie->flags = %d\n", ie->flags); + if (ie->flags & INDEX_ENTRY_END) { + r = -1; + } else { + //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); + r = ntfs_names_collate (name, name_len, + ie->key.file_name.file_name, + ie->key.file_name.file_name_length, + 2, IGNORE_CASE, + dt->dir->vol->upcase, + dt->dir->vol->upcase_len); + } + + //printf ("%d, %d\n", i, r); + + if (r == 1) { + //printf ("keep searching\n"); + } else if (r == 0) { + //res = dt; + //printf ("match\n"); + // ignore + } else if (r == -1) { + if (ie->flags & INDEX_ENTRY_NODE) { + //printf ("recurse\n"); + if (!dt->sub_nodes[i]) { + vcn = ntfs_ie_get_vcn (ie); + //printf ("vcn = %lld\n", vcn); + sub = ntfs_dt_create (dt->dir, dt, vcn); + dt->sub_nodes[i] = sub; + } + res = ntfs_dt_find4 (dt->sub_nodes[i], name, name_len, index_num); + } else { + //printf ("no match\n"); + res = dt; + if (index_num) + *index_num = i; + } + break; + } else { + printf ("error collating name\n"); + } + //break; + } + + return res; +} + +/** + * ntfs_dt_find_all + * maps all dt's into memory + */ +void ntfs_dt_find_all (struct ntfs_dt *dt) +{ + INDEX_ENTRY *ie; + VCN vcn; + int i; + + if (!dt) + return; + + for (i = 0; i < dt->child_count; i++) { + ie = dt->children[i]; + + if (ie->flags & INDEX_ENTRY_NODE) { + if (!dt->sub_nodes[i]) { + vcn = ntfs_ie_get_vcn (ie); + dt->sub_nodes[i] = ntfs_dt_create (dt->dir, dt, vcn); + } + ntfs_dt_find_all (dt->sub_nodes[i]); + } + } +} + +/** + * ntfs_dt_find_parent + */ +int ntfs_dt_find_parent (struct ntfs_dt *dt) +{ + int i; + struct ntfs_dt *parent; + + if (!dt) + return -1; + + parent = dt->parent; + if (!parent) + return -1; + + for (i = 0; i < parent->child_count; i++) + if (parent->sub_nodes[i] == dt) + return i; + + return -1; +} + +/** + * ntfs_dt_isroot + */ +BOOL ntfs_dt_isroot (struct ntfs_dt *dt) +{ + if (!dt) + return FALSE; + return (dt->parent == NULL); +} + +/** + * ntfs_dt_root_freespace + */ +int ntfs_dt_root_freespace (struct ntfs_dt *dt) +{ + int recsize; + int inuse; + MFT_RECORD *mrec; + + if (!dt) + return -1; + + recsize = dt->dir->inode->vol->mft_record_size; + + mrec = (MFT_RECORD*) dt->dir->inode->mrec; + inuse = mrec->bytes_in_use; + + return recsize - inuse; +} + +/** + * ntfs_dt_alloc_freespace + */ +int ntfs_dt_alloc_freespace (struct ntfs_dt *dt) +{ + int recsize; + int inuse; + INDEX_BLOCK *block; + + if (!dt) + return -1; + + recsize = dt->dir->index_size; + + block = (INDEX_BLOCK*) dt->data; + inuse = block->index.index_length + 24; + + return recsize - inuse; +} + +/** + * ntfs_dt_transfer + */ +int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start, int count) +{ + int i; + int need; + int space; + INDEX_ENTRY *mov_ie; + u8 *src; + u8 *dst; + int len; + int insert; + //FILE_NAME_ATTR *file; + + //XXX check len > 0 + + if (!old || !new) + return -1; + + if ((start < 0) || ((start+count) >= old->child_count)) + return -1; + + printf ("\n"); + printf (BOLD YELLOW "Transferring children\n" END); + + need = 0; + for (i = start; i < (start+count+1); i++) { + mov_ie = old->children[i]; + need += mov_ie->length; + //file = &mov_ie->key.file_name; printf ("\ttrn name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + } + + if (ntfs_dt_isroot (new)) + space = ntfs_dt_root_freespace (new); + else + space = ntfs_dt_alloc_freespace (new); + + // XXX if this is an index root, it'll go badly wrong + // restrict to allocs only? + + printf ("\tneed = %d\n", need); + printf ("\tspace = %d\n", space); + + if (space < need) + return -1; + + if (new->child_count == 1) { + i = -1; + } else { + ntfschar *n1, *n2; + int l1, l2; + + n1 = new->children[0]->key.file_name.file_name; + l1 = new->children[0]->key.file_name.file_name_length; + + n2 = old->children[start]->key.file_name.file_name; + l2 = old->children[start]->key.file_name.file_name_length; + + i = ntfs_names_collate (n1, l1, n2, l2, + 2, IGNORE_CASE, + old->dir->vol->upcase, + old->dir->vol->upcase_len); + } + + if ((i == 0) || (i == 2)) + return -1; + + // determine the insertion point + if (i == 1) + insert = 0; + else + insert = new->child_count-1; + + src = (u8*) new->children[insert]; + dst = src + need; + len = (u8*) new->children[new->child_count-1] + new->children[new->child_count-1]->length - src; + + //printf ("src = %d, dst = %d, len = %d\n", src - new->data, dst - new->data, len); + memmove (dst, src, len); + + dst = src; + src = (u8*) old->children[start]; + len = need; + + memcpy (dst, src, len); + + src = (u8*) old->children[start+count-1]; + dst = (u8*) old->children[start]; + len = (u8*) old->children[old->child_count-1] + old->children[old->child_count-1]->length - src; + + //printf ("src = %d, dst = %d, len = %d\n", src - old->data, dst - old->data, len); + memmove (dst, src, len); + + dst += len; + len = old->data + old->dir->index_size - dst; + + //printf ("dst = %d, len = %d\n", dst - old->data, len); + memset (dst, 0, len); + + if (!ntfs_dt_resize_children3 (new, new->child_count + count)) + return -1; + + src = (u8*) &old->sub_nodes[start+count-1]; + dst = (u8*) &old->sub_nodes[start]; + len = (old->child_count - start - count + 1) * sizeof (struct ntfs_dt*); + + memmove (dst, src, len); + + src = (u8*) &new->sub_nodes[insert]; + dst = (u8*) &new->sub_nodes[insert+count-1]; + len = (new->child_count - insert - count + 1) * sizeof (struct ntfs_dt*); + + memmove (dst, src, len); + + if (!ntfs_dt_resize_children3 (old, old->child_count - count)) + return -1; + + src = (u8*) new->children[0]; + for (i = 0; i < new->child_count; i++) { + new->children[i] = (INDEX_ENTRY*) src; + src += new->children[i]->length; + } + + src = (u8*) old->children[0]; + for (i = 0; i < old->child_count; i++) { + old->children[i] = (INDEX_ENTRY*) src; + src += old->children[i]->length; + } + + old->header->index_length -= need; + new->header->index_length += need; + + // resize children and sub_nodes + // memmove keys in new + // memcpy old to new + // memmove keys in old + // rebuild old/new children/sub_nodes without destroying tree + // update old/new headers + + old->changed = TRUE; + new->changed = TRUE; + + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); + + return 0; +} + +/** + * ntfs_dt_alloc_insert + */ +int ntfs_dt_alloc_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count) +{ + // XXX don't bother measuring, just subtract the children pointers + + int i; + int need; + INDEX_ENTRY *ie; + INDEX_ALLOCATION *alloc; + u8 *src; + u8 *dst; + int len; + + if (!dt) + return 1; + if (!first) + return 1; + + need = 0; + ie = first; + for (i = 0; i < count; i++) { + need += ie->length; + ie = (INDEX_ENTRY*) ((u8*)ie + ie->length); + } + + printf ("alloc insert %d bytes\n", need); + + alloc = (INDEX_ALLOCATION*) dt->data; + printf ("entries_offset = %d\n", alloc->index.entries_offset); + printf ("index_length = %d\n", alloc->index.index_length); + printf ("allocated_size = %d\n", alloc->index.allocated_size); + + printf ("insert has %d children\n", dt->child_count); + printf ("children = %p\n", dt->children); + //utils_dump_mem (dt->data, 0, 128, DM_DEFAULTS); + + ie = dt->children[dt->child_count-1]; + + printf ("last child = %p (%ld)\n", ie, (long)ie - (long)dt->data); + printf ("size = %d\n", ie->length); + + src = (u8*) ie; + dst = src + need; + len = ie->length; + + memmove (dst, src, len); + + src = (u8*) first; + dst = (u8*) ie; + len = need; + + memcpy (dst, src, len); + + // use create children + // measure need and update children list + // adjust headers + + //utils_dump_mem (dt->data, 0, 256, DM_DEFAULTS); + return 0; +} + +/** + * ntfs_dt_alloc_insert2 + */ +INDEX_ENTRY * ntfs_dt_alloc_insert2 (struct ntfs_dt *dt, int before, int count, int bytes) +{ + int space; + u8 *src; + u8 *dst; + int len; + + // XXX don't bother measuring, just subtract the children pointers + + if (!dt) + return NULL; + if (before < 0) + return NULL; + if (count < 1) + return NULL; + if (bytes < 1) + return NULL; + + // check alloc has enough space + space = ntfs_dt_alloc_freespace (dt); + if (bytes > space) + return NULL; + + // move data + src = (u8*) dt->children[before]; + dst = src + bytes; + len = dt->header->index_length - ((int)dt->children[before] - (int)dt->data) + 24; + + //printf ("%d, %d, %d\n", (int)src - (int)dt->data, (int)dst - (int)dt->data, len); + + memmove (dst, src, len); + memset (dst, 0, bytes); + + // resize arrays + ntfs_dt_resize_children3 (dt, dt->child_count + count); + + // move keys (children) + src = (u8*) (dt->children + before); + dst = src + (count * sizeof (u8*)); + len = (dt->child_count - count - before) * sizeof (u8*); + + memmove (dst, src, len); + memset (src, 0, count * sizeof (u8*)); + + // move keys (inodes) + src = (u8*) (dt->inodes + before); + dst = src + (count * sizeof (u8*)); + len = (dt->child_count - count - before) * sizeof (u8*); + + memmove (dst, src, len); + memset (src, 0, count * sizeof (u8*)); + + // move keys (sub_nodes) + src = (u8*) (dt->sub_nodes + before); + dst = src + (count * sizeof (u8*)); + len = (dt->child_count - count - before) * sizeof (u8*); + + memmove (dst, src, len); + memset (src, 0, count * sizeof (u8*)); + + return NULL; +} + +/** + * ntfs_dt_root_insert + */ +int ntfs_dt_root_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count) +{ + if (!dt) + return 1; + if (!first) + return 1; + + return count; +} + +/** + * ntfs_dt_alloc_remove2 + */ +int ntfs_dt_alloc_remove2 (struct ntfs_dt *dt, int start, int count) +{ + int i; + int size; + + if (!dt) + return 1; + + size = 0; + for (i = start; i < (start+count); i++) { + size += dt->children[i]->length; + } + + return start + count; +} + +/** + * ntfs_dt_root_remove2 + */ +int ntfs_dt_root_remove2 (struct ntfs_dt *dt, int start, int count) +{ + int i; + int size; + + if (!dt) + return -1; + if ((start < 0) || (start >= dt->child_count)) + return -1; + if ((count < 1) || ((start + count - 1) >= dt->child_count)) + return -1; + + printf ("s c/t %d %d/%d\n", start, count, dt->child_count); + + size = 0; + for (i = start; i < (start + count); i++) + size += dt->children[i]->length; + printf ("size1 = %d\n", size); + + size = (int) dt->children[start+count] - (int) dt->children[start]; + printf ("size2 = %d\n", size); + + size = (int) dt->children[start+count-1] - (int) dt->children[start] + dt->children[start+count-1]->length; + printf ("size3 = %d\n", size); + + // XXX what shall we do with the inodes? + // transfer them to the dir (commit them for now) + // are they _our_ responsibility? probably not + + // rearrange arrays + // shrink attribute + + ntfs_dt_resize_children3 (dt, dt->child_count - count); + + printf ("ntfs_dt_root_remove2\n"); + return dt->child_count; +} + +/** + * ntfs_dt_transfer2 + */ +int ntfs_dt_transfer2 (struct ntfs_dt *old, struct ntfs_dt *new, int start, int count) +{ + int i; + int need; + int space; + INDEX_ENTRY *mov_ie; + u8 *src; + u8 *dst; + int len; + int insert; + //FILE_NAME_ATTR *file; + + if (!old || !new) + return -1; + + if ((start < 0) || (count < 0)) + return -1; + + if ((start + count) >= old->child_count) + return -1; + + printf ("\n"); + printf (BOLD YELLOW "Transferring children\n" END); + + need = 0; + for (i = start; i < (start+count); i++) { + mov_ie = old->children[i]; + need += mov_ie->length; + //file = &mov_ie->key.file_name; printf ("\ttrn name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + } + + if (ntfs_dt_isroot (new)) + space = ntfs_dt_root_freespace (new); + else + space = ntfs_dt_alloc_freespace (new); + + printf ("\tneed = %d\n", need); + printf ("\tspace = %d\n", space); + + if (need > space) + return -1; + + if (ntfs_dt_isroot (new)) + ntfs_dt_root_insert (new, old->children[0], count); + else + ntfs_dt_alloc_insert2 (new, 0, count, need); + + if (ntfs_dt_isroot (old)) + ntfs_dt_root_remove2 (old, 0, count); + else + ntfs_dt_alloc_remove2 (old, 0, count); + + if (1) return -1; + if (0) ntfs_dt_alloc_insert (NULL, NULL, 0); + + if (new->child_count == 1) { + i = -1; + } else { + ntfschar *n1, *n2; + int l1, l2; + + n1 = new->children[0]->key.file_name.file_name; + l1 = new->children[0]->key.file_name.file_name_length; + + n2 = old->children[start]->key.file_name.file_name; + l2 = old->children[start]->key.file_name.file_name_length; + + i = ntfs_names_collate (n1, l1, n2, l2, + 2, IGNORE_CASE, + old->dir->vol->upcase, + old->dir->vol->upcase_len); + } + + if ((i == 0) || (i == 2)) + return -1; + + // determine the insertion point + if (i == 1) + insert = 0; + else + insert = new->child_count-1; + + src = (u8*) new->children[insert]; + dst = src + need; + len = (u8*) new->children[new->child_count-1] + new->children[new->child_count-1]->length - src; + + //printf ("src = %d, dst = %d, len = %d\n", src - new->data, dst - new->data, len); + memmove (dst, src, len); + + dst = src; + src = (u8*) old->children[start]; + len = need; + + memcpy (dst, src, len); + + src = (u8*) old->children[start+count-1]; + dst = (u8*) old->children[start]; + len = (u8*) old->children[old->child_count-1] + old->children[old->child_count-1]->length - src; + + //printf ("src = %d, dst = %d, len = %d\n", src - old->data, dst - old->data, len); + memmove (dst, src, len); + + dst += len; + len = old->data + old->dir->index_size - dst; + + //printf ("dst = %d, len = %d\n", dst - old->data, len); + memset (dst, 0, len); + + if (!ntfs_dt_resize_children3 (new, new->child_count + count)) + return -1; + + src = (u8*) &old->sub_nodes[start+count-1]; + dst = (u8*) &old->sub_nodes[start]; + len = (old->child_count - start - count + 1) * sizeof (struct ntfs_dt*); + + memmove (dst, src, len); + + src = (u8*) &new->sub_nodes[insert]; + dst = (u8*) &new->sub_nodes[insert+count-1]; + len = (new->child_count - insert - count + 1) * sizeof (struct ntfs_dt*); + + memmove (dst, src, len); + + if (!ntfs_dt_resize_children3 (old, old->child_count - count)) + return -1; + + src = (u8*) new->children[0]; + for (i = 0; i < new->child_count; i++) { + new->children[i] = (INDEX_ENTRY*) src; + src += new->children[i]->length; + } + + src = (u8*) old->children[0]; + for (i = 0; i < old->child_count; i++) { + old->children[i] = (INDEX_ENTRY*) src; + src += old->children[i]->length; + } + + old->header->index_length -= need; + new->header->index_length += need; + + // resize children and sub_nodes + // memmove keys in new + // memcpy old to new + // memmove keys in old + // rebuild old/new children/sub_nodes without destroying tree + // update old/new headers + + old->changed = TRUE; + new->changed = TRUE; + + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); + + return 0; +} + +/** + * ntfs_dt_root_replace + */ +int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) +{ + u8 *src; + u8 *dst; + u8 *attr; + int len; + int i; + + if (!del || !del_ie || !suc_ie) + return FALSE; + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + //printf ("\n"); + + attr = malloc (del->data_len + suc_ie->length - del_ie->length); + + dst = attr; + src = del->data; + len = (u8*) del_ie - del->data; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) suc_ie; + len = suc_ie->length; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) del_ie + del_ie->length; + len = del->data_len + (del->data - (u8*) del_ie) - del_ie->length; + + memcpy (dst, src, len); + + src = (u8*) del->data; + dst = attr; + + len = suc_ie->length - del_ie->length; + free (del->data); + del->data = attr; + del->data_len += len; + del->header = (INDEX_HEADER*) (del->data + 0x10); + del->header->index_length += len; + del->header->allocated_size += len; + + ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); + + //utils_dump_mem (attr, 0, del->data_len, DM_DEFAULTS); + + //printf ("\n"); + //printf (BOLD YELLOW "Adjust children\n" END); + //for (i = 0; i < del->child_count; i++) + // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); + //printf ("\n"); + + //printf ("src = %p, dst = %p, len = %d\n", src, dst, len); fflush (stdout); + + for (i = 0; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) (dst + ((u8*) del->children[i] - src)); + + for (i = del_num+1; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); + + //for (i = 0; i < del->child_count; i++) + // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); + //printf ("\n"); + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + //printf ("\n"); + + del->changed = TRUE; + + printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); + return TRUE; +} + +/** + * ntfs_dt_alloc_replace + */ +BOOL ntfs_dt_alloc_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) +{ + u8 *src; + u8 *dst; + int len; + int i; + + if (!del || !del_ie || !suc_ie) + return FALSE; + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + + src = (u8*) del_ie + del_ie->length; + dst = (u8*) del_ie + suc_ie->length; + len = del->header->index_length + 24 + (del->data - src); + //printf ("src = %d\n", src - del->data); + //printf ("dst = %d\n", dst - del->data); + //printf ("len = %d\n", len); + + if (src != dst) + memmove (dst, src, len); + + src = (u8*) suc_ie; + dst = (u8*) del_ie; + len = suc_ie->length; + + memcpy (dst, src, len); + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + + del->header->index_length += suc_ie->length - del_ie->length; + + dst = del->data + del->header->index_length + 24; + len = del->data_len - del->header->index_length - 24; + + memset (dst, 0, len); + + //for (i = 0; i < del->child_count; i++) + // printf ("Child %d %p\n", i, del->children[i]); + //printf ("\n"); + + len = suc_ie->length - del_ie->length; + //printf ("len = %d\n", len); + + for (i = del_num+1; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); + + //for (i = 0; i < del->child_count; i++) + // printf ("Child %d %p\n", i, del->children[i]); + //printf ("\n"); + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + + del->changed = TRUE; + + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); + return TRUE; +} + +/** + * ntfs_dt_root_remove + */ +BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) +{ + INDEX_ENTRY *del_ie = NULL; + u8 *src; + u8 *dst; + u8 *old; + int len; + int del_len; + int i; + //int off; + + if (!del) + return FALSE; + + //utils_dump_mem (del->data, 0, del->header->index_length+16, DM_RED); + //printf ("\n"); + +#if 0 + off = (u8*) del->children[0] - del->data; + for (i = 0; i < del->child_count; i++) { + del_ie = del->children[i]; + + printf ("%2d %4d ", i+1, off); + off += del_ie->length; + + if (del_ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", del_ie->length); + break; + } + + ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + printf (" (%d)\n", del_ie->length); + } + printf ("total = %d\n", off); +#endif + + del_ie = del->children[del_num]; + del_len = del_ie->length; + + src = (u8*) del_ie + del_len; + dst = (u8*) del_ie; + len = del->header->index_length + 16 - (src - del->data); + + //printf ("src = %d\n", src - del->data); + //printf ("dst = %d\n", dst - del->data); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + del->data_len -= del_len; + del->child_count--; + + del->header->index_length = del->data_len - 16; + del->header->allocated_size = del->data_len - 16; + + ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); + old = del->data; + del->data = realloc (del->data, del->data_len); + del->header = (INDEX_HEADER*) (del->data + 0x10); + + //utils_dump_mem (del->data, 0, del->data_len, DM_GREEN | DM_RED); + + src = (u8*) (&del->children[del_num+1]); + dst = (u8*) (&del->children[del_num]); + len = (del->child_count - del_num) * sizeof (INDEX_ENTRY*); + + //printf ("src = %d\n", src - (u8*) del->children); + //printf ("dst = %d\n", dst - (u8*) del->children); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + src = (u8*) (&del->sub_nodes[del_num+1]); + dst = (u8*) (&del->sub_nodes[del_num]); + len = (del->child_count - del_num) * sizeof (struct ntfs_dt*); + + //printf ("src = %d\n", src - (u8*) del->children); + //printf ("dst = %d\n", dst - (u8*) del->children); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + //printf ("del_num = %d\n", del_num); + for (i = 0; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - old + del->data); + for (i = del_num; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_len); + + if (!ntfs_dt_create_children2 (del, del->child_count)) + return FALSE; + +#if 0 + off = (u8*) del->children[0] - del->data; + for (i = 0; i < del->child_count; i++) { + del_ie = del->children[i]; + + printf ("%2d %4d ", i+1, off); + off += del_len; + + if (del_ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", del_len); + break; + } + + ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + printf (" (%d)\n", del_len); + } + printf ("total = %d\n", off); +#endif + + //utils_dump_mem (del->data, 0, del->header->index_length+16, DM_DEFAULTS); + + del->changed = TRUE; + + printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); + return TRUE; +} + +/** + * ntfs_dt_alloc_remove + */ +BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) +{ + INDEX_ENTRY *del_ie = NULL; + u8 *dst; + u8 *src; + int len; + int i; + //int off; + + if (!del) + return FALSE; + +#if 0 + off = (u8*)del->children[0] - del->data; + for (i = 0; i < del->child_count; i++) { + del_ie = del->children[i]; + + printf ("%2d %4d ", i, off); + off += del_ie->length; + + if (del_ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", del_ie->length); + break; + } + + ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + printf (" (%d)\n", del_ie->length); + } + printf ("total = %d\n", off); + printf ("\n"); +#endif + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + //printf ("\n"); + + del_ie = del->children[del_num]; + + src = (u8*) del_ie + del_ie->length; + dst = (u8*) del_ie; + len = del->header->index_length + 24 - (src - del->data); + + //printf ("src = %d\n", src - del->data); + //printf ("dst = %d\n", dst - del->data); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + del->header->index_length -= src - dst; + del->child_count--; + + dst += len; + len = del->data_len - del->header->index_length - 24; + + //printf ("dst = %d\n", dst - del->data); + //printf ("len = %d\n", len); + + memset (dst, 0, len); + + src = (u8*) (&del->children[del_num+1]); + dst = (u8*) (&del->children[del_num]); + len = (del->child_count - del_num) * sizeof (INDEX_ENTRY*); + + //printf ("src = %d\n", src - (u8*) del->children); + //printf ("dst = %d\n", dst - (u8*) del->children); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + src = (u8*) (&del->sub_nodes[del_num+1]); + dst = (u8*) (&del->sub_nodes[del_num]); + len = (del->child_count - del_num) * sizeof (struct ntfs_dt*); + + //printf ("src = %d\n", src - (u8*) del->children); + //printf ("dst = %d\n", dst - (u8*) del->children); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + //printf ("del_num = %d\n", del_num); + for (i = del_num; i < del->child_count; i++) + del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_ie->length); + + if (!ntfs_dt_create_children2 (del, del->child_count)) + return FALSE; + + //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + +#if 0 + off = (u8*)del->children[0] - del->data; + for (i = 0; i < del->child_count; i++) { + del_ie = del->children[i]; + + printf ("%2d %4d ", i, off); + off += del_ie->length; + + if (del_ie->flags & INDEX_ENTRY_END) { + printf ("END (%d)\n", del_ie->length); + break; + } + + ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + printf (" (%d)\n", del_ie->length); + } + printf ("total = %d\n", off); + printf ("\n"); +#endif + + del->changed = TRUE; + + printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); + + if (del->child_count < 2) { + printf ("indx is empty\n"); + ntfs_bmp_set_range (del->dir->bitmap, del->vcn, 1, 0); + } + + return TRUE; +} + +/** + * ntfs_dt_alloc_add + */ +int ntfs_dt_alloc_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) +{ + INDEX_BLOCK *block; + INDEX_ENTRY *entry; + int need; + int space; + u8 *src; + u8 *dst; + int len; + + if (!parent || !ie) + return 0; + + block = (INDEX_BLOCK*) parent->data; + + need = ie->length; + space = parent->data_len - block->index.index_length - 24; + + printf ("need %d, have %d\n", need, space); + if (need > space) { + printf ("no room"); + return 0; + } + + //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); + //printf ("\n"); + + src = (u8*) parent->children[index_num]; + dst = src + need; + len = parent->data + parent->data_len - src - space; + //printf ("src = %d\n", src - parent->data); + //printf ("dst = %d\n", dst - parent->data); + //printf ("len = %d\n", len); + + memmove (dst, src, len); + + dst = src; + src = (u8*) ie; + len = need; + + memcpy (dst, src, len); + + block->index.index_length += len; + + dst = parent->data + block->index.index_length + 24; + len = parent->data_len - block->index.index_length - 24; + + memset (dst, 0, len); + + //realloc children, sub_nodes + ntfs_dt_create_children2 (parent, parent->child_count + 1); + + // regen children pointers + parent->child_count = 0; + + src = parent->data + 0x18 + parent->header->entries_offset; + len = parent->data_len - 0x18 - parent->header->entries_offset; + + while (src < (parent->data + parent->data_len)) { + entry = (INDEX_ENTRY*) src; + + parent->children[parent->child_count] = entry; + parent->child_count++; + + if (entry->flags & INDEX_ENTRY_END) + break; + + src += entry->length; + } + printf ("count = %d\n", parent->child_count); + + src = (u8*) &parent->sub_nodes[index_num+parent->child_count-1]; + dst = (u8*) &parent->sub_nodes[index_num]; + len = (parent->child_count - index_num - 1) * sizeof (struct ntfs_dt*); + + memmove (dst, src, len); + + //insert sub_node pointer + parent->sub_nodes[index_num] = child; + + //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); + //printf ("\n"); + return 0; +} + +/** + * ntfs_dt_root_add + */ +int ntfs_dt_root_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) +{ + INDEX_ROOT *root; + INDEX_ENTRY *entry; + int need; + int space; + u8 *attr; + u8 *src; + u8 *dst; + int len; + + if (!parent || !ie) + return 0; + + root = (INDEX_ROOT*) parent->data; + + //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); + printf ("\n"); + + need = ie->length; + space = ntfs_mft_free_space (parent->dir); + + printf ("need %d, have %d\n", need, space); + if (need > space) { + printf ("no room"); + return 0; + } + + attr = malloc (parent->data_len + need); + + src = parent->data; + dst = attr; + len = root->index.entries_offset + 16; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) ie; + len = ie->length; + + memcpy (dst, src, len); + + dst += len; + src = (u8*) parent->children[index_num]; + len = parent->data + parent->data_len - src; + + memcpy (dst, src, len); + + free (parent->data); + parent->data = attr; + parent->data_len += need; + + root = (INDEX_ROOT*) parent->data; + root->index.index_length = parent->data_len - 16; + root->index.allocated_size = parent->data_len - 16; + + //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); + printf ("\n"); + + ntfs_mft_resize_resident (parent->dir->inode, AT_INDEX_ROOT, I30, 4, parent->data, parent->data_len); + + //realloc children, sub_nodes + ntfs_dt_create_children2 (parent, parent->child_count + 1); + + // regen children pointers + parent->child_count = 0; + + src = parent->data + 0x18 + parent->header->entries_offset; + len = parent->data_len - 0x18 - parent->header->entries_offset; + + // XXX can we rebase the children more simply? (in alloc_add too) + while (src < (parent->data + parent->data_len)) { + entry = (INDEX_ENTRY*) src; + + parent->children[parent->child_count] = entry; + parent->child_count++; + + if (entry->flags & INDEX_ENTRY_END) + break; + + src += entry->length; + } + printf ("count = %d\n", parent->child_count); + + src = (u8*) &parent->sub_nodes[index_num+parent->child_count-1]; + dst = (u8*) &parent->sub_nodes[index_num]; + len = (parent->child_count - index_num - 1) * sizeof (struct ntfs_dt*); + + memmove (dst, src, len); + + //insert sub_node pointer + parent->sub_nodes[index_num] = child; + + return 0; +} + +/** + * ntfs_dt_add2 + */ +int ntfs_dt_add2 (INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs_dt *ded) +{ + int need; + int space; + int median; + struct ntfs_dt *new = NULL; + struct ntfs_dt *chl; + INDEX_ENTRY *med_ie = NULL; + //FILE_NAME_ATTR *file; + VCN vcn = 0; + //int i; + + if (!ie || !suc) + return -1; + + printf ("\n"); + printf (BOLD YELLOW "Add key to leaf\n" END); + + //utils_dump_mem (suc->data, 0, suc->data_len, DM_DEFAULTS); + + chl = NULL; +ascend: + //XXX replace with while/break? + +#if 0 + for (; ded; ded = ded->sub_nodes[0]) { + printf ("\tded vcn = %lld\n", ded->vcn); + } +#endif + + /* + * ADD + * room in current node? + * yes, add, done + * no, split, ascend + */ + need = ie->length; + + if (ntfs_dt_isroot (suc)) + space = ntfs_dt_root_freespace (suc); + else + space = ntfs_dt_alloc_freespace (suc); + + printf ("\tneed %d\n", need); + printf ("\tspace %d\n", space); + + if (space >= need) { + if (ntfs_dt_isroot (suc)) + ntfs_dt_root_add (suc, suc_num, ie, chl); + else + ntfs_dt_alloc_add (suc, suc_num, ie, chl); + goto done; + } + + /* + * SPLIT + * any dead? + * yes reuse + * no alloc + */ + if (ded) { + new = ded; + vcn = ded->vcn; + ded = ded->sub_nodes[0]; + printf ("\treusing vcn %lld\n", new->vcn); + } else { + ntfs_mft_add_index (suc->dir); + /* + * ALLOC + * any unused records? + * yes, enable first + * no, extend + */ + /* + * ENABLE + * modify bitmap + * init indx record + */ + /* + * EXTEND + * room in bitmap + * yes, do nothing + * no, extend bitmap + * extend alloc + */ + /* + * EXTEND BITMAP + * extend bitmap + * init bitmap + */ + } + + //printf ("\tnode has %d children\n", suc->child_count); + + // initialise new node + // XXX ntfs_dt_initialise (new, vcn); + + goto done; + + // find median key + median = (suc->child_count+1) / 2; + med_ie = ntfs_ie_copy (suc->children[median]); + //file = &med_ie->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + + ntfs_ie_free (med_ie); + med_ie = NULL; + + //printf ("suc key count = %d\n", suc->child_count); + //printf ("new key count = %d\n", new->child_count); + + //printf ("median's child = %p\n", suc->sub_nodes[median]); + // need to pass the child when ascending + chl = suc->sub_nodes[median]; + + // transfer keys + if (ntfs_dt_transfer (suc, new, 0, median-1) < 0) + goto done; + + //printf ("suc key count = %d\n", suc->child_count); + //printf ("new key count = %d\n", new->child_count); + + //file = &suc->children[0]->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + + // can this be a root node? + if (ntfs_dt_isroot (suc)) + ntfs_dt_root_remove (suc, 0); + else + ntfs_dt_alloc_remove (suc, 0); + + //file = &suc->children[0]->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + //printf ("suc key count = %d\n", suc->child_count); + //printf ("new key count = %d\n", new->child_count); + + // remove the median key + + // split when median has children + // median child given to new ! + // median child is new + // ascend + + med_ie = ntfs_ie_set_vcn (med_ie, new->vcn); + if (!med_ie) + goto done; + + //printf ("median child = %lld\n", ntfs_ie_get_vcn (med_ie)); + //printf ("new's vcn = %lld\n", new->vcn); + + // adjust parents + // attach new to median + // escape clause for root node? + // goto ascend + + // ie = insert + // child = child + // suc = successor + // suc_num = insert point + + ie = med_ie; + suc = suc->parent; + suc_num = 0; + + printf ("\n"); + printf (BOLD YELLOW "Ascend\n" END); + goto ascend; +done: + return 0; +} + + +#endif /* NTFS_RICH */ + diff --git a/libntfs/volume.c b/libntfs/volume.c index 8c1108aa..00cf6c47 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -3,6 +3,7 @@ * * Copyright (c) 2000-2005 Anton Altaparmakov * Copyright (c) 2002-2005 Szabolcs Szakacsits + * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -1531,3 +1532,332 @@ err_out: ntfs_attr_put_search_ctx(ctx); return ret; } + + +#ifdef NTFS_RICH + +#include "tree.h" + +// XXX temp +#define Eprintf printf +#define Vprintf printf +#define Qprintf printf + +/** + * utils_valid_device - Perform some safety checks on the device, before we start + * @name: Full pathname of the device/file to work with + * @force: Continue regardless of problems + * + * Check that the name refers to a device and that is isn't already mounted. + * These checks can be overridden by using the force option. + * + * Return: 1 Success, we can continue + * 0 Error, we cannot use this device + */ +int utils_valid_device (const char *name, int force) +{ + unsigned long mnt_flags = 0; + struct stat st; + +#ifdef __CYGWIN32__ + /* FIXME: This doesn't work for Cygwin, so just return success for now... */ + return 1; +#endif + if (!name) { + errno = EINVAL; + return 0; + } + + if (stat (name, &st) == -1) { + if (errno == ENOENT) { + Eprintf ("The device %s doesn't exist\n", name); + } else { + Eprintf ("Error getting information about %s: %s\n", name, strerror (errno)); + } + return 0; + } + + if (!S_ISBLK (st.st_mode)) { + Vprintf ("%s is not a block device.\n", name); + if (!force) { + Eprintf ("Use the force option to work with files.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + /* Make sure the file system is not mounted. */ + if (ntfs_check_if_mounted (name, &mnt_flags)) { + Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); + if (!force) { + Eprintf ("Use the force option to ignore this error.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } else if (mnt_flags & NTFS_MF_MOUNTED) { + Vprintf ("The device %s, is mounted.\n", name); + if (!force) { + Eprintf ("Use the force option to work a mounted filesystem.\n"); + return 0; + } + Vprintf ("Forced to continue.\n"); + } + + return 1; +} + +/** + * utils_mount_volume + */ +ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force) +{ + ntfs_volume *vol; + + if (!device) { + errno = EINVAL; + return NULL; + } + + if (!utils_valid_device (device, force)) + return NULL; + + vol = ntfs_mount (device, flags); + if (!vol) { + int err; + + err = errno; + Eprintf("Couldn't mount device '%s': %s\n", device, + strerror(err)); + if (err == EOPNOTSUPP) + Eprintf("Windows was either hibernated or did not " + "shut down properly. Try to mount " + "volume in windows, shut down and try " + "again.\n"); + return NULL; + } + + if (vol->flags & VOLUME_IS_DIRTY) { + Qprintf ("Volume is dirty.\n"); + if (!force) { + Eprintf ("Run chkdsk and try again, or use the --force option.\n"); + ntfs_umount (vol, FALSE); + return NULL; + } + Qprintf ("Forced to continue.\n"); + } + + return vol; +} + +/** + * ntfs_volume_commit + */ +int ntfs_volume_commit (ntfs_volume *vol) +{ + if (!vol) + return -1; + + printf ("commit volume\n"); + if (ntfs_bmp_commit (vol->private_bmp1) < 0) + return -1; + + if (ntfs_bmp_commit (vol->private_bmp2) < 0) + return -1; + + if (ntfs_dir_commit (vol->private_data) < 0) + return -1; + + return 0; +} + +/** + * ntfs_volume_rollback + */ +int ntfs_volume_rollback (ntfs_volume *vol) +{ + if (!vol) + return -1; + + if (ntfs_bmp_rollback (vol->private_bmp1) < 0) + return -1; + + if (ntfs_bmp_rollback (vol->private_bmp2) < 0) + return -1; + + if (ntfs_dir_rollback (vol->private_data) < 0) + return -1; + + return 0; +} + +/** + * ntfs_volume_umount2 + */ +int ntfs_volume_umount2 (ntfs_volume *vol, const BOOL force) +{ + struct ntfs_dir *dir; + struct ntfs_bmp *bmp; + + if (!vol) + return 0; + + ntfs_volume_rollback (vol); + + dir = (struct ntfs_dir *) vol->private_data; + vol->private_data = NULL; + ntfs_dir_free (dir); + + bmp = (struct ntfs_bmp *) vol->private_bmp1; + vol->private_bmp1 = NULL; + ntfs_bmp_free (bmp); + + bmp = (struct ntfs_bmp *) vol->private_bmp2; + vol->private_bmp2 = NULL; + ntfs_bmp_free (bmp); + + return ntfs_umount (vol, force); +} + +/** + * ntfs_volume_mount2 + */ +ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL force) +{ + // XXX can we replace these and search by mft number? Hmm... NO. + // unless I have a recursive search for an MFT number + static ntfschar bmp[8] = { + const_cpu_to_le16('$'), + const_cpu_to_le16('B'), + const_cpu_to_le16('i'), + const_cpu_to_le16('t'), + const_cpu_to_le16('m'), + const_cpu_to_le16('a'), + const_cpu_to_le16('p'), + const_cpu_to_le16(0) + }; + + static ntfschar mft[5] = { + const_cpu_to_le16('$'), + const_cpu_to_le16('M'), + const_cpu_to_le16('F'), + const_cpu_to_le16('T'), + const_cpu_to_le16(0) + }; + + static ntfschar mftmirr[9] = { + const_cpu_to_le16('$'), + const_cpu_to_le16('M'), + const_cpu_to_le16('F'), + const_cpu_to_le16('T'), + const_cpu_to_le16('M'), + const_cpu_to_le16('i'), + const_cpu_to_le16('r'), + const_cpu_to_le16('r'), + const_cpu_to_le16(0) + }; + + static ntfschar dot[2] = { + const_cpu_to_le16('.'), + const_cpu_to_le16(0) + }; + + ntfs_volume *vol; + struct ntfs_dir *dir; + struct ntfs_dt *root; + struct ntfs_dt *found; + int num; + + vol = utils_mount_volume (device, flags, force); + if (!vol) + return NULL; + + vol->lcnbmp_ni ->ref_count = 1; + vol->mft_ni ->ref_count = 1; + vol->mftmirr_ni->ref_count = 1; + + vol->lcnbmp_ni ->private_data = NULL; + vol->mft_ni ->private_data = NULL; + vol->mftmirr_ni->private_data = NULL; + + dir = ntfs_dir_create (vol, FILE_root); + if (!dir) { + ntfs_volume_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + + dir->index = ntfs_dt_create (dir, NULL, -1); + + root = dir->index; + + //$Bitmap + num = -1; + found = ntfs_dt_find2 (root, bmp, sizeof (bmp) - 1, &num); + if ((!found) || (num < 0)) { + printf ("can't find $Bitmap\n"); + ntfs_volume_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + vol->lcnbmp_ni->ref_count++; + vol->lcnbmp_ni->private_data = found->dir; + found->inodes[num] = vol->lcnbmp_ni; + + //$MFT + num = -1; + found = ntfs_dt_find2 (root, mft, sizeof (mft) - 1, &num); + if ((!found) || (num < 0)) { + printf ("can't find $MFT\n"); + ntfs_volume_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + vol->mft_ni->ref_count++; + vol->mft_ni->private_data = found->dir; + found->inodes[num] = vol->mft_ni; + + //$MFTMirr + num = -1; + found = ntfs_dt_find2 (root, mftmirr, sizeof (mftmirr) - 1, &num); + if ((!found) || (num < 0)) { + printf ("can't find $MFTMirr\n"); + ntfs_volume_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + vol->mftmirr_ni->ref_count++; + vol->mftmirr_ni->private_data = found->dir; + found->inodes[num] = vol->mftmirr_ni; + + // root directory + num = -1; + found = ntfs_dt_find2 (root, dot, 1, &num); + if ((!found) || (num < 0)) { + printf ("can't find the root directory\n"); + ntfs_volume_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + + vol->private_data = found->dir; + found->inodes[num] = dir->inode; + dir->inode->private_data = found; + dir->inode->ref_count = 2; + + vol->private_bmp1 = ntfs_bmp_create (vol->mft_ni, AT_BITMAP, NULL, 0); + vol->private_bmp2 = ntfs_bmp_create (vol->lcnbmp_ni, AT_DATA, NULL, 0); + + if (!vol->private_bmp1 || !vol->private_bmp2) { + printf ("can't find the bitmaps\n"); + ntfs_volume_umount2 (vol, FALSE); + vol = NULL; + goto done; + } + +done: + return vol; +} + + +#endif /* NTFS_RICH */ + diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 3dfd19ed..8ce5aad3 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -15,7 +15,7 @@ bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone \ ntfscp EXTRA_PROGRAMS = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove \ - ntfsrm ntfsmftalloc ntfscmp + ntfsmftalloc ntfscmp man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \ @@ -37,6 +37,10 @@ if ENABLE_CRYPTO EXTRA_PROGRAMS += ntfsdecrypt endif +if ENABLE_RICH +EXTRA_PROGRAMS += ntfsrm +endif + # Set the include path. AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs $(all_includes) @@ -93,9 +97,11 @@ endif # We don't distribute these +if ENABLE_RICH ntfsrm_SOURCES = ntfsrm.c ntfsrm.h utils.c utils.h ntfsrm_LDADD = $(AM_LIBS) ntfsrm_LDFLAGS = $(AM_LFLAGS) +endif ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h ntfstruncate_LDADD = $(AM_LIBS) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 46c0ded0..1b564a2c 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -1,7 +1,6 @@ /** * ntfsrm - Part of the Linux-NTFS project. * - * Copyright (c) 2005 Anton Altaparmakov * Copyright (c) 2004-2005 Richard Russon * * This utility will delete files from an NTFS volume. @@ -40,14 +39,18 @@ #include #endif -#include "utils.h" #include "ntfsrm.h" +#include "rich.h" +#include "utils.h" #include "debug.h" #include "dir.h" #include "lcnalloc.h" #include "mft.h" #include "ntfstime.h" #include "version.h" +#include "tree.h" +#include "index.h" +#include "inode.h" static const char *EXEC_NAME = "ntfsrm"; static struct options opts; @@ -210,22 +213,6 @@ static int parse_options (int argc, char **argv) } -/** - * ntfs_name_print - */ -static void ntfs_name_print (ntfschar *name, int name_len) -{ - char *buffer = NULL; - - if (name_len) { - ntfs_ucstombs (name, name_len, &buffer, 0); - printf ("%s", buffer); - free (buffer); - } else { - printf ("!"); - } -} - /** * ntfs_dir_print */ @@ -263,1733 +250,6 @@ static void ntfs_dt_print (struct ntfs_dt *dt, int indent) } -/** - * ntfs_bmp_rollback - */ -static int ntfs_bmp_rollback (struct ntfs_bmp *bmp) -{ - int i; - - if ((!bmp) || (bmp->count == 0)) - return 0; - - for (i = 0; i < bmp->count; i++) - free (bmp->data[i]); - - free (bmp->data); - free (bmp->data_vcn); - bmp->data = NULL; - bmp->data_vcn = NULL; - bmp->count = 0; - - return 0; -} - -/** - * ntfs_bmp_commit - */ -static int ntfs_bmp_commit (struct ntfs_bmp *bmp) -{ - int i; - u32 cs; -#ifdef RM_WRITE - u32 ws; // write size -#endif - - if (!bmp) - return 0; - if (bmp->count == 0) - return 0; - -#if 0 - printf ("attr = 0x%02X\n", bmp->attr->type); - printf ("resident = %d\n", !NAttrNonResident (bmp->attr)); - printf ("\ta size = %lld\n", bmp->attr->allocated_size); - printf ("\td size = %lld\n", bmp->attr->data_size); - printf ("\ti size = %lld\n", bmp->attr->initialized_size); -#endif - - printf ("commit bmp inode %lld, 0x%02X (%sresident)\n", bmp->attr->ni->mft_no, bmp->attr->type, NAttrNonResident (bmp->attr) ? "non-" : ""); - - if (NAttrNonResident (bmp->attr)) { - cs = bmp->vol->cluster_size; - - // non-resident - for (i = 0; i < bmp->count; i++) { -#ifdef RM_WRITE - if (((bmp->data_vcn[i]+1) * cs) < bmp->attr->data_size) - ws = cs; - else - ws = bmp->attr->data_size & (cs - 1); - //printf ("writing %d bytes\n", ws); - ntfs_attr_pwrite (bmp->attr, bmp->data_vcn[i] * cs, ws, bmp->data[i]); // XXX retval -#endif - printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, bmp->data_vcn[i]); - } - } else { - // resident -#ifdef RM_WRITE - ntfs_attr_pwrite (bmp->attr, bmp->data_vcn[0], bmp->attr->data_size, bmp->data[0]); // XXX retval -#endif - printf (RED "\tntfs_attr_pwrite resident (%lld)\n" END, bmp->attr->data_size); - } - - ntfs_bmp_rollback (bmp); - - return 0; -} - -/** - * ntfs_bmp_free - */ -static void ntfs_bmp_free (struct ntfs_bmp *bmp) -{ - if (!bmp) - return; - - ntfs_bmp_rollback (bmp); - - ntfs_attr_close (bmp->attr); - - free (bmp); -} - -/** - * ntfs_bmp_create - */ -static struct ntfs_bmp * ntfs_bmp_create (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len) -{ - struct ntfs_bmp *bmp; - ntfs_attr *attr; - - if (!inode) - return NULL; - - attr = ntfs_attr_open (inode, type, name, name_len); - if (!attr) - return NULL; - - bmp = calloc (1, sizeof (*bmp)); - if (!bmp) { - ntfs_attr_close (attr); - return NULL; - } - - bmp->vol = inode->vol; - bmp->attr = attr; - bmp->data = NULL; - bmp->data_vcn = NULL; - bmp->count = 0; - - return bmp; -} - -/** - * ntfs_bmp_add_data - */ -static int ntfs_bmp_add_data (struct ntfs_bmp *bmp, VCN vcn, u8 *data) -{ - int i = 0; - int old; - int new; - - if (!bmp || !data) - return -1; - - old = ROUND_UP (bmp->count, 16); - bmp->count++; - new = ROUND_UP (bmp->count, 16); - - if (old != new) { - bmp->data = realloc (bmp->data, new * sizeof (*bmp->data)); - bmp->data_vcn = realloc (bmp->data_vcn , new * sizeof (*bmp->data_vcn)); - } - - for (i = 0; i < bmp->count-1; i++) - if (bmp->data_vcn[i] > vcn) - break; - - if ((bmp->count-i) > 0) { - memmove (&bmp->data[i+1], &bmp->data[i], (bmp->count-i) * sizeof (*bmp->data)); - memmove (&bmp->data_vcn[i+1], &bmp->data_vcn[i], (bmp->count-i) * sizeof (*bmp->data_vcn)); - } - - bmp->data[i] = data; - bmp->data_vcn[i] = vcn; - - return bmp->count; -} - -/** - * ntfs_bmp_get_data - */ -static u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn) -{ - u8 *buffer; - int i; - int cs; - int cb; - - if (!bmp) - return NULL; - - cs = bmp->vol->cluster_size; - cb = bmp->vol->cluster_size_bits; - - // XXX range check against vol,attr - // never compressed, so data = init - - vcn >>= (cb + 3); // convert to bitmap clusters - - for (i = 0; i < bmp->count; i++) { - if (vcn == bmp->data_vcn[i]) { - //printf ("reusing bitmap cluster %lld\n", vcn); - return bmp->data[i]; - } - } - - buffer = calloc (1, cs); // XXX could be smaller if attr size < cluster size - if (!buffer) - return NULL; - - //printf ("loading from bitmap cluster %lld\n", vcn); - //printf ("loading from bitmap byte %lld\n", vcn<attr, vcn<vol->cluster_size << 3; - - vcn_start = vcn; - vcn_finish = vcn + length - 1; - - //printf ("vcn_start = %d, vcn_finish = %d\n", vcn_start, vcn_finish); - a = ROUND_DOWN (vcn_start, csib); - b = ROUND_DOWN (vcn_finish, csib) + 1; - - //printf ("a = %lld, b = %lld\n", a, b); - - for (i = a; i < b; i += csib) { - //printf ("ntfs_bmp_get_data %lld\n", i); - buffer = ntfs_bmp_get_data (bmp, i); - if (!buffer) - return -1; - - block_start = i; - block_finish = block_start + csib - 1; - - mask_start = (0xFF << (vcn_start & 7)); - mask_finish = (0xFF >> (7 - (vcn_finish & 7))); - - if ((vcn_start >= block_start) && (vcn_start <= block_finish)) { - byte_start = (vcn_start - block_start) >> 3; - } else { - byte_start = 0; - mask_start = 0xFF; - } - - if ((vcn_finish >= block_start) && (vcn_finish <= block_finish)) { - byte_finish = (vcn_finish - block_start) >> 3; - } else { - byte_finish = bmp->vol->cluster_size - 1; - mask_finish = 0xFF; - } - - if ((byte_finish - byte_start) > 1) { - memset (buffer+byte_start+1, value, byte_finish-byte_start-1); - } else if (byte_finish == byte_start) { - mask_start &= mask_finish; - mask_finish = 0x00; - } - - if (value) { - buffer[byte_start] |= mask_start; - buffer[byte_finish] |= mask_finish; - } else { - buffer[byte_start] &= (~mask_start); - buffer[byte_finish] &= (~mask_finish); - } - } - -#if 1 - printf (GREEN "Modified: inode %lld, ", bmp->attr->ni->mft_no); - switch (bmp->attr->type) { - case AT_BITMAP: printf ("$BITMAP"); break; - case AT_DATA: printf ("$DATA"); break; - default: break; - } - printf (" vcn %lld-%lld\n" END, vcn>>12, (vcn+length-1)>>12); -#endif - return 1; -} - -/** - * ntfs_bmp_find_last_set - */ -static s64 ntfs_bmp_find_last_set (struct ntfs_bmp *bmp) -{ - s64 clust_count; - s64 byte_count; - s64 clust; - int byte; - int bit; - int note; - u8 *buffer; - - if (!bmp) - return -2; - - // find byte size of bmp - // find cluster size of bmp - - byte_count = bmp->attr->data_size; - clust_count = ROUND_UP (byte_count, bmp->vol->cluster_size) >> bmp->vol->cluster_size_bits; - - //printf ("bitmap = %lld bytes\n", byte_count); - //printf ("bitmap = %lld buffers\n", clust_count); - - // for each cluster backwards - for (clust = clust_count-1; clust >= 0; clust--) { - //printf ("cluster %lld\n", clust); - //printf ("get vcn %lld\n", clust << (bmp->vol->cluster_size_bits + 3)); - buffer = ntfs_bmp_get_data (bmp, clust << (bmp->vol->cluster_size_bits + 3)); - //utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); - if (!buffer) - return -2; - if ((clust == (clust_count-1) && ((byte_count % bmp->vol->cluster_size) != 0))) { - byte = byte_count % bmp->vol->cluster_size; - } else { - byte = bmp->vol->cluster_size; - } - //printf ("start byte = %d\n", byte); - // for each byte backward - for (byte--; byte >= 0; byte--) { - //printf ("\tbyte %d (%d)\n", byte, buffer[byte]); - // for each bit shift up - note = -1; - for (bit = 7; bit >= 0; bit--) { - //printf ("\t\tbit %d (%d)\n", (1<= 0) { - // if note, return value - //printf ("match %lld (c=%lld,b=%d,n=%d)\n", (((clust << bmp->vol->cluster_size_bits) + byte) << 3) + note, clust, byte, note); - return ((((clust << bmp->vol->cluster_size_bits) + byte) << 3) + note); - } - } - } - - return -1; -} - -/** - * ntfs_bmp_find_space - */ -static int ntfs_bmp_find_space (struct ntfs_bmp *bmp, LCN start, long size) -{ - if (!bmp) - return 0; - - start = 0; - size = 0; - - /* - bmp find space - uncached bmp's - $Bitmap/$DATA free space on volume - dir/$BITMAP free index record - $MFT/$BITMAP free record in mft - */ - return 0; -} - - -/** - * ntfs_ie_free - */ -static void ntfs_ie_free (INDEX_ENTRY *ie) -{ - free (ie); -} - -/** - * ntfs_ie_create - */ -static INDEX_ENTRY * ntfs_ie_create (void) -{ - int length; - INDEX_ENTRY *ie; - - length = 16; - ie = calloc (1, length); - if (!ie) - return NULL; - - ie->indexed_file = 0; - ie->length = length; - ie->key_length = 0; - ie->flags = INDEX_ENTRY_END; - ie->reserved = 0; - return ie; -} - -/** - * ntfs_ie_get_vcn - */ -static VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie) -{ - if (!ie) - return -1; - if (!(ie->flags & INDEX_ENTRY_NODE)) - return -1; - - return *((VCN*) ((u8*) ie + ie->length - 8)); -} - -/** - * ntfs_ie_copy - */ -static INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie) -{ - INDEX_ENTRY *copy = NULL; - - if (!ie) - return NULL; - - copy = malloc (ie->length); - if (!copy) - return NULL; - memcpy (copy, ie, ie->length); - - return copy; -} - -/** - * ntfs_ie_set_vcn - */ -static INDEX_ENTRY * ntfs_ie_set_vcn (INDEX_ENTRY *ie, VCN vcn) -{ - if (!ie) - return 0; - - if (!(ie->flags & INDEX_ENTRY_NODE)) { - ie->length += 8; - ie = realloc (ie, ie->length); - if (!ie) - return NULL; - - ie->flags |= INDEX_ENTRY_NODE; - } - - *((VCN*) ((u8*) ie + ie->length - 8)) = vcn; - return ie; -} - -/** - * ntfs_ie_remove_vcn - */ -static INDEX_ENTRY * ntfs_ie_remove_vcn (INDEX_ENTRY *ie) -{ - if (!ie) - return NULL; - if (!(ie->flags & INDEX_ENTRY_NODE)) - return ie; - - ie->length -= 8; - ie->flags &= ~INDEX_ENTRY_NODE; - ie = realloc (ie, ie->length); - return ie; -} - -/** - * ntfs_ie_set_name - */ -static INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype) -{ - FILE_NAME_ATTR *file; - int need; - BOOL wipe = FALSE; - VCN vcn = 0; - - if (!ie || !name) - return NULL; - - /* - * INDEX_ENTRY - * MFT_REF indexed_file; - * u16 length; - * u16 key_length; - * INDEX_ENTRY_FLAGS flags; - * u16 reserved; - * - * FILENAME - * MFT_REF parent_directory; - * s64 creation_time; - * s64 last_data_change_time; - * s64 last_mft_change_time; - * s64 last_access_time; - * s64 allocated_size; - * s64 data_size; - * FILE_ATTR_FLAGS file_attributes; - * u32 reserved; - * u8 file_name_length; - * FILE_NAME_TYPE_FLAGS file_name_type; - * ntfschar file_name[l]; - * u8 reserved[n] - * - * VCN vcn; - */ - - //printf ("key length = 0x%02X\n", ie->key_length); - //printf ("new name length = %d\n", namelen); - if (ie->key_length > 0) { - file = &ie->key.file_name; - //printf ("filename, length %d\n", file->file_name_length); - need = ATTR_SIZE (namelen * sizeof (ntfschar) + 2) - - ATTR_SIZE (file->file_name_length * sizeof (ntfschar) + 2); - } else { - //printf ("no filename\n"); - need = ATTR_SIZE (sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar))); - wipe = TRUE; - } - - //printf ("need 0x%02X bytes\n", need); - - if (need != 0) { - if (ie->flags & INDEX_ENTRY_NODE) - vcn = ntfs_ie_get_vcn (ie); - - ie->length += need; - ie->key_length += need; - - //printf ("realloc 0x%02X\n", ie->length); - ie = realloc (ie, ie->length); - if (!ie) - return NULL; - - if (ie->flags & INDEX_ENTRY_NODE) - ie = ntfs_ie_set_vcn (ie, vcn); - - if (wipe) - memset (&ie->key.file_name, 0, sizeof (FILE_NAME_ATTR)); - if (need > 0) - memset ((u8*)ie + ie->length - need, 0, need); - } - - memcpy (ie->key.file_name.file_name, name, namelen * sizeof (ntfschar)); - - ie->key.file_name.file_name_length = namelen; - ie->key.file_name.file_name_type = nametype; - ie->flags &= ~INDEX_ENTRY_END; - - //printf ("ie->length = 0x%02X\n", ie->length); - //printf ("ie->key_length = 0x%02X\n", ie->key_length); - - return ie; -} - -/** - * ntfs_ie_remove_name - */ -static INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) -{ - VCN vcn = 0; - - if (!ie) - return NULL; - if (ie->key_length == 0) - return ie; - - if (ie->flags & INDEX_ENTRY_NODE) - vcn = ntfs_ie_get_vcn (ie); - - ie->length -= ATTR_SIZE (ie->key_length); - ie->key_length = 0; - ie->flags |= INDEX_ENTRY_END; - - ie = realloc (ie, ie->length); - if (!ie) - return NULL; - - if (ie->flags & INDEX_ENTRY_NODE) - ie = ntfs_ie_set_vcn (ie, vcn); - return ie; -} - - -/** - * ntfs_inode_close2 - */ -static int ntfs_inode_close2 (ntfs_inode *ni) -{ - if (!ni) - return 0; - - //printf (BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); - - ni->ref_count--; - if (ni->ref_count > 0) - return 0; - - // unlink - // ino->private_data - - // XXX temporary until we have commit/rollback - NInoClearDirty(ni); - - return ntfs_inode_close (ni); -} - - -/** - * ntfs_dt_free - */ -static void ntfs_dt_free (struct ntfs_dt *dt) -{ - int i; - - if (!dt) - return; - - for (i = 0; i < dt->child_count; i++) { - ntfs_dt_free (dt->sub_nodes[i]); - ntfs_inode_close2 (dt->inodes[i]); - } - - free (dt->sub_nodes); - free (dt->children); - free (dt->inodes); - free (dt->data); // XXX is this always ours? - free (dt); -} - -/** - * ntfs_dt_rollback - */ -static int ntfs_dt_rollback (struct ntfs_dt *dt) -{ - int i; - - if (!dt) - return 0; - if (dt->child_count == 0) // No children or nothing mapped - return 0; - - if (dt->changed) { - // We can't trust anything below us in the tree - for (i = 0; i < dt->child_count; i++) { - ntfs_dt_free (dt->sub_nodes[i]); - ntfs_inode_close2 (dt->inodes[i]); - } - - dt->child_count = 0; - - free (dt->data); - free (dt->children); - free (dt->sub_nodes); - free (dt->inodes); - - dt->data = NULL; - dt->children = NULL; - dt->sub_nodes = NULL; - dt->inodes = NULL; - } else { - // This node is OK, check the su-nodes - for (i = 0; i < dt->child_count; i++) { - if (ntfs_dt_rollback (dt->sub_nodes[i])) { - ntfs_inode_close2 (dt->inodes[i]); - // Child was changed so unmap it - dt->sub_nodes[i] = NULL; - dt->inodes[i] = NULL; - } - } - } - - return (dt->child_count == 0); -} - -/** - * ntfs_dt_commit - */ -static int ntfs_dt_commit (struct ntfs_dt *dt) -{ - ntfs_volume *vol; - ntfs_attr *attr; - struct ntfs_dir *dir; - int i; - int size; - - if (!dt) - return 0; - - dir = dt->dir; - if (!dir) - return -1; - - vol = dir->vol; // cluster size - - if (dt->changed) { - if (dt->parent) { - printf ("commit dt (alloc)\n"); - attr = dt->dir->ialloc; - size = dt->dir->index_size; - //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); -#ifdef RM_WRITE - ntfs_attr_mst_pwrite(attr, dt->vcn * vol->cluster_size, 1, size, dt->data); // XXX retval -#endif - } else { - printf ("commit dt (root)\n"); - attr = dt->dir->iroot; - size = dt->data_len; - //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); -#ifdef RM_WRITE - ntfs_attr_pwrite(attr, 0, size, dt->data); // XXX retval -#endif - } - - printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, dt->vcn); - - dt->changed = FALSE; - } - - for (i = 0; i < dt->child_count; i++) { - if ((dt->inodes[i]) && (NInoDirty (dt->inodes[i]))) { - //utils_dump_mem (dt->inodes[i]->mrec, 0, vol->mft_record_size, DM_DEFAULTS); -#ifdef RM_WRITE - ntfs_inode_sync (dt->inodes[i]); -#endif - printf (RED "\tntfs_inode_sync %llu\n" END, dt->inodes[i]->mft_no); - } - - if (ntfs_dt_commit (dt->sub_nodes[i]) < 0) - return -1; - } - - return 0; -} - -/** - * ntfs_dt_create_children2 - */ -static BOOL ntfs_dt_create_children2 (struct ntfs_dt *dt, int count) -{ - // XXX calculate for 2K and 4K indexes max and min filenames (inc/exc VCN) - - int old = (dt->child_count + 0x1e) & ~0x1f; - int new = (count + 0x1f) & ~0x1f; - - if (old == new) - return TRUE; - - dt->children = realloc (dt->children, new * sizeof (*dt->children)); - dt->sub_nodes = realloc (dt->sub_nodes, new * sizeof (*dt->sub_nodes)); - dt->inodes = realloc (dt->inodes, new * sizeof (*dt->inodes)); - - if (!dt->children || !dt->sub_nodes || !dt->inodes) - return FALSE; // dt->child_count = -1 ? - - memset ((u8*)dt->children + old, 0, (new - old) * sizeof (*dt->children)); - memset ((u8*)dt->sub_nodes + old, 0, (new - old) * sizeof (*dt->sub_nodes)); - memset ((u8*)dt->inodes + old, 0, (new - old) * sizeof (*dt->inodes)); - - return TRUE; -} - -/** - * ntfs_dt_resize_children3 - */ -static BOOL ntfs_dt_resize_children3 (struct ntfs_dt *dt, int new) -{ - int old; - - // XXX calculate for 2K and 4K indexes max and min filenames (inc/exc VCN) - // XXX assumption: sizeof (*dt->children) == sizeof (*dt->sub_nodes) == sizeof (*dt->inodes) - // XXX put back blocking factor - - if (!dt) - return FALSE; - - old = dt->child_count; - if (old == new) - return TRUE; - - dt->child_count = new; - - old *= sizeof (*dt->children); - new *= sizeof (*dt->children); - - dt->children = realloc (dt->children, new); - dt->sub_nodes = realloc (dt->sub_nodes, new); - dt->inodes = realloc (dt->inodes, new); - - if (!dt->children || !dt->sub_nodes || !dt->inodes) - return FALSE; - - if (new > old) { - memset ((u8*)dt->children + old, 0, (new - old)); - memset ((u8*)dt->sub_nodes + old, 0, (new - old)); - memset ((u8*)dt->inodes + old, 0, (new - old)); - } - - return TRUE; -} - -/** - * ntfs_dt_root_count - */ -static int ntfs_dt_root_count (struct ntfs_dt *dt) -{ - u8 *buffer = NULL; - u8 *ptr = NULL; - VCN vcn; - s64 size = 0; - char *name = NULL; - - INDEX_ROOT *root; - INDEX_HEADER *header; - INDEX_ENTRY *entry; - - if (!dt) - return -1; - - buffer = dt->data; - size = dt->data_len; - - root = (INDEX_ROOT*) buffer; - if (root->type != AT_FILE_NAME) - return -1; - - header = (INDEX_HEADER*) (buffer + 0x10); - if (header->index_length > size) - return -1; - - dt->child_count = 0; - ptr = buffer + header->entries_offset + 0x10; - - while (ptr < (buffer + size)) { - entry = (INDEX_ENTRY*) ptr; - - ntfs_dt_resize_children3 (dt, dt->child_count + 1); // XXX retval - - if (entry->flags & INDEX_ENTRY_NODE) { - vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); - //printf ("VCN %lld\n", vcn); - } - - if (!(entry->flags & INDEX_ENTRY_END)) { - ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0); - //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); - free (name); - name = NULL; - } - - //printf ("CC[%d] = %p\n", dt->child_count-1, entry); - dt->children[dt->child_count-1] = entry; - - ptr += entry->length; - } - - //printf ("count = %d\n\n", dt->child_count); - - return dt->child_count; -} - -/** - * ntfs_dt_alloc_count - */ -static int ntfs_dt_alloc_count (struct ntfs_dt *dt) -{ - u8 *buffer = NULL; - u8 *ptr = NULL; - VCN vcn; - s64 size = 0; - char *name = NULL; - - INDEX_BLOCK *block; - INDEX_ENTRY *entry; - - if (!dt) - return -1; - - buffer = dt->data; - size = dt->data_len; - - //utils_dump_mem (buffer, 0, 128, DM_DEFAULTS); - - block = (INDEX_BLOCK*) buffer; - //printf ("INDX %lld\n", block->index_block_vcn); - - ptr = buffer + 0x18 + block->index.entries_offset; - - //printf ("block size %d\n", block->index.index_length); - dt->child_count = 0; - //printf ("start = 0x%02X, end = 0x%02X\n", 0x18 + block->index.entries_offset, 0x18 + block->index.index_length); - while (ptr < (buffer + 0x18 + block->index.index_length)) { - entry = (INDEX_ENTRY*) ptr; - - ntfs_dt_resize_children3 (dt, dt->child_count + 1); // XXX retval - - if (entry->flags & INDEX_ENTRY_NODE) { - vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); - //printf ("\tVCN %lld\n", vcn); - } - - dt->children[dt->child_count-1] = entry; - - if (entry->flags & INDEX_ENTRY_END) { - break; - } else { - ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0); - //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); - free (name); - name = NULL; - } - - ptr += entry->length; - } - //printf ("count = %d\n", dt->child_count); - - return dt->child_count; -} - -/** - * ntfs_dt_initialise2 - */ -static int ntfs_dt_initialise2 (ntfs_volume *vol, struct ntfs_dt *dt) -{ - INDEX_ALLOCATION *alloc; - INDEX_ENTRY *entry; - - if (!vol) - return 1; - if (!dt) - return 1; - - memset (dt->data, 0, dt->data_len); - - alloc = (INDEX_ALLOCATION*) dt->data; - - alloc->magic = magic_INDX; - alloc->usa_ofs = 0x28; - alloc->usa_count = (dt->data_len >> vol->sector_size_bits) + 1; - alloc->lsn = 0; - alloc->index_block_vcn = 0; - - alloc->index.entries_offset = 0x28; - alloc->index.index_length = 0x10 + 0x28; - alloc->index.allocated_size = dt->data_len - 0x18; - alloc->index.flags = 0; - - entry = (INDEX_ENTRY*) (dt->data + 0x40); - - entry->indexed_file = 0; - entry->length = 0x10; - entry->key_length = 0; - entry->flags = INDEX_ENTRY_END; - - ntfs_dt_resize_children3 (dt, 1); // XXX retval - - dt->children[0] = entry; - - return 0; -} - -/** - * ntfs_dt_create - */ -static struct ntfs_dt * ntfs_dt_create (struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn) -{ - struct ntfs_dt *dt = NULL; - //int i; - - if (!dir) - return NULL; - - dt = calloc (1, sizeof (*dt)); - if (!dt) - return NULL; - - dt->dir = dir; - dt->parent = parent; - dt->child_count = 0; - dt->children = NULL; - dt->sub_nodes = NULL; - dt->inodes = NULL; - dt->vcn = vcn; - dt->changed = FALSE; - - if (parent) { - //printf ("alloc a = %lld\n", dir->ialloc->allocated_size); - //printf ("alloc d = %lld\n", dir->ialloc->data_size); - //printf ("alloc i = %lld\n", dir->ialloc->initialized_size); - //printf ("vcn = %lld\n", vcn); - - dt->data_len = dt->dir->index_size; - //printf ("parent size = %d\n", dt->data_len); - dt->data = malloc (dt->data_len); - - if (vcn >= 0) { - //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data)); - ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data); - } else { - ntfs_dt_initialise2 (dir->vol, dt); - } - - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - //printf ("\n"); - - ntfs_dt_alloc_count (dt); - - dt->header = &((INDEX_BLOCK*)dt->data)->index; - //printf ("USA = %d\n", ((INDEX_BLOCK*)dt->data)->usa_count); - -#if 0 - for (i = 0; i < dt->child_count; i++) { - INDEX_ENTRY *ie = dt->children[i]; - - printf ("%d\n", ((u8*)ie) - dt->data); - if (ie->flags & INDEX_ENTRY_END) - printf ("IE (%d)\n", ie->length); - else - printf ("IE %lld (%d)\n", MREF (ie->key.file_name.parent_directory), ie->length); - utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); - printf ("\n"); - } -#endif - } else { - //printf ("root a = %lld\n", dir->iroot->allocated_size); - //printf ("root d = %lld\n", dir->iroot->data_size); - //printf ("root i = %lld\n", dir->iroot->initialized_size); - - dt->data_len = dir->iroot->allocated_size; - dt->data = malloc (dt->data_len); - //printf ("%lld\n", ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data)); - ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data); - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - //printf ("\n"); - - ntfs_dt_root_count (dt); - - dt->header = &((INDEX_ROOT*)dt->data)->index; - //dt->data_len = ((INDEX_ROOT*)dt->data)->index_block_size; - //printf ("IBS = %d\n", ((INDEX_ROOT*)dt->data)->index_block_size); - -#if 0 - for (i = 0; i < dt->child_count; i++) { - INDEX_ENTRY *ie = dt->children[i]; - - printf ("%d\n", ((u8*)ie) - dt->data); - if (ie->flags & INDEX_ENTRY_END) - printf ("IE (%d)\n", ie->length); - else - printf ("IE %lld (%d)\n", MREF (ie->key.file_name.parent_directory), ie->length); - utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); - printf ("\n"); - } -#endif - } - //printf ("index_header (%d,%d)\n", dt->header.index_length, dt->header.allocated_size); - - return dt; -} - -/** - * ntfs_dt_find - * find dt by name, return MFT_REF - * maps dt's as necessary - */ -static MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) -{ - MFT_REF res = -1; - INDEX_ENTRY *ie; - struct ntfs_dt *sub; - VCN vcn; - int i; - int r; - - if (!dt || !name) - return -1; - - /* - * State Children Action - * ------------------------------------------- - * collates after - keep searching - * match name - return MREF - * collates before no return -1 - * collates before yes map & recurse - * end marker no return -1 - * end marker yes map & recurse - */ - - //printf ("child_count = %d\n", dt->child_count); - for (i = 0; i < dt->child_count; i++) { - ie = dt->children[i]; - - if (ie->flags & INDEX_ENTRY_END) { - r = -1; - } else { - //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); - r = ntfs_names_collate (name, name_len, - ie->key.file_name.file_name, - ie->key.file_name.file_name_length, - 2, IGNORE_CASE, - dt->dir->vol->upcase, - dt->dir->vol->upcase_len); - } - - //printf ("%d, %d\n", i, r); - - if (r == 1) { - //printf ("keep searching\n"); - continue; - } else if (r == 0) { - res = MREF (ie->indexed_file); - //printf ("match %lld\n", res); - } else if (r == -1) { - if (ie->flags & INDEX_ENTRY_NODE) { - //printf ("map & recurse\n"); - //printf ("sub %p\n", dt->sub_nodes); - if (!dt->sub_nodes[i]) { - vcn = ntfs_ie_get_vcn (ie); - //printf ("vcn = %lld\n", vcn); - sub = ntfs_dt_create (dt->dir, dt, vcn); - dt->sub_nodes[i] = sub; - } - res = ntfs_dt_find (dt->sub_nodes[i], name, name_len); - } else { - //printf ("ENOENT\n"); - } - } else { - printf ("error collating name\n"); - } - break; - } - - return res; -} - -/** - * ntfs_dt_find2 - * find dt by name, returns dt and index - * maps dt's as necessary - */ -static struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) -{ - struct ntfs_dt *res = NULL; - INDEX_ENTRY *ie; - VCN vcn; - int i; - int r; - - if (!dt || !name) - return NULL; - - // XXX default index_num to -1 - - /* - * State Children Action - * ------------------------------------------- - * collates after - keep searching - * match name - return MREF - * collates before no return -1 - * collates before yes map & recurse - * end marker no return -1 - * end marker yes map & recurse - */ - - //printf ("child_count = %d\n", dt->child_count); - for (i = 0; i < dt->child_count; i++) { - ie = dt->children[i]; - - if (ie->flags & INDEX_ENTRY_END) { - r = -1; - } else { - //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); - r = ntfs_names_collate (name, name_len, - ie->key.file_name.file_name, - ie->key.file_name.file_name_length, - 2, IGNORE_CASE, - dt->dir->vol->upcase, - dt->dir->vol->upcase_len); - } - - //printf ("%d, %d\n", i, r); - - if (r == 1) { - //printf ("keep searching\n"); - continue; - } else if (r == 0) { - res = dt; - //printf ("match %p\n", res); - if (index_num) - *index_num = i; - } else if ((r == -1) && (ie->flags & INDEX_ENTRY_NODE)) { - //printf ("recurse\n"); - if (!dt->sub_nodes[i]) { - vcn = ntfs_ie_get_vcn (ie); - //printf ("vcn = %lld\n", vcn); - dt->sub_nodes[i] = ntfs_dt_create (dt->dir, dt, vcn); - } - res = ntfs_dt_find2 (dt->sub_nodes[i], name, name_len, index_num); - } else { - printf ("error collating name\n"); - } - break; - } - - return res; -} - -/** - * ntfs_dt_find3 - * find dt by name, returns dt and index - * does not map new dt's - */ -static struct ntfs_dt * ntfs_dt_find3 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) -{ - struct ntfs_dt *res = NULL; - INDEX_ENTRY *ie; - int i; - int r; - - if (!dt || !name) - return NULL; - - //printf ("child_count = %d\n", dt->child_count); - for (i = 0; i < dt->child_count; i++) { - ie = dt->children[i]; - - if (ie->flags & INDEX_ENTRY_END) { - r = -1; - } else { - //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); - r = ntfs_names_collate (name, name_len, - ie->key.file_name.file_name, - ie->key.file_name.file_name_length, - 2, IGNORE_CASE, - dt->dir->vol->upcase, - dt->dir->vol->upcase_len); - } - - //printf ("%d, %d\n", i, r); - - if (r == 1) { - //printf ("keep searching\n"); - continue; - } else if (r == 0) { - res = dt; - //printf ("match %p\n", res); - if (index_num) - *index_num = i; - } else if (r == -1) { - if (ie->flags & INDEX_ENTRY_NODE) { - //printf ("recurse\n"); - res = ntfs_dt_find3 (dt->sub_nodes[i], name, name_len, index_num); - } else { - //printf ("no match\n"); - res = dt; - if (index_num) - *index_num = i; - } - } else { - printf ("error collating name\n"); - } - break; - } - - return res; -} - -/** - * ntfs_dt_find4 - * find successor to specified name, returns dt and index - * maps dt's as necessary - */ -static struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) -{ - struct ntfs_dt *res = NULL; - struct ntfs_dt *sub = NULL; - INDEX_ENTRY *ie; - VCN vcn; - int i; - int r; - - if (!dt || !name) - return NULL; - - //printf ("child_count = %d\n", dt->child_count); - for (i = 0; i < dt->child_count; i++) { - ie = dt->children[i]; - - //printf ("ie->flags = %d\n", ie->flags); - if (ie->flags & INDEX_ENTRY_END) { - r = -1; - } else { - //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); - r = ntfs_names_collate (name, name_len, - ie->key.file_name.file_name, - ie->key.file_name.file_name_length, - 2, IGNORE_CASE, - dt->dir->vol->upcase, - dt->dir->vol->upcase_len); - } - - //printf ("%d, %d\n", i, r); - - if (r == 1) { - //printf ("keep searching\n"); - } else if (r == 0) { - //res = dt; - //printf ("match\n"); - // ignore - } else if (r == -1) { - if (ie->flags & INDEX_ENTRY_NODE) { - //printf ("recurse\n"); - if (!dt->sub_nodes[i]) { - vcn = ntfs_ie_get_vcn (ie); - //printf ("vcn = %lld\n", vcn); - sub = ntfs_dt_create (dt->dir, dt, vcn); - dt->sub_nodes[i] = sub; - } - res = ntfs_dt_find4 (dt->sub_nodes[i], name, name_len, index_num); - } else { - //printf ("no match\n"); - res = dt; - if (index_num) - *index_num = i; - } - break; - } else { - printf ("error collating name\n"); - } - //break; - } - - return res; -} - -/** - * ntfs_dt_find_all - * maps all dt's into memory - */ -static void ntfs_dt_find_all (struct ntfs_dt *dt) -{ - INDEX_ENTRY *ie; - VCN vcn; - int i; - - if (!dt) - return; - - for (i = 0; i < dt->child_count; i++) { - ie = dt->children[i]; - - if (ie->flags & INDEX_ENTRY_NODE) { - if (!dt->sub_nodes[i]) { - vcn = ntfs_ie_get_vcn (ie); - dt->sub_nodes[i] = ntfs_dt_create (dt->dir, dt, vcn); - } - ntfs_dt_find_all (dt->sub_nodes[i]); - } - } -} - -/** - * ntfs_dt_find_parent - */ -static int ntfs_dt_find_parent (struct ntfs_dt *dt) -{ - int i; - struct ntfs_dt *parent; - - if (!dt) - return -1; - - parent = dt->parent; - if (!parent) - return -1; - - for (i = 0; i < parent->child_count; i++) - if (parent->sub_nodes[i] == dt) - return i; - - return -1; -} - -/** - * ntfs_dt_isroot - */ -static BOOL ntfs_dt_isroot (struct ntfs_dt *dt) -{ - if (!dt) - return FALSE; - return (dt->parent == NULL); -} - -/** - * ntfs_dt_root_freespace - */ -static int ntfs_dt_root_freespace (struct ntfs_dt *dt) -{ - int recsize; - int inuse; - MFT_RECORD *mrec; - - if (!dt) - return -1; - - recsize = dt->dir->inode->vol->mft_record_size; - - mrec = (MFT_RECORD*) dt->dir->inode->mrec; - inuse = mrec->bytes_in_use; - - return recsize - inuse; -} - -/** - * ntfs_dt_alloc_freespace - */ -static int ntfs_dt_alloc_freespace (struct ntfs_dt *dt) -{ - int recsize; - int inuse; - INDEX_BLOCK *block; - - if (!dt) - return -1; - - recsize = dt->dir->index_size; - - block = (INDEX_BLOCK*) dt->data; - inuse = block->index.index_length + 24; - - return recsize - inuse; -} - -/** - * ntfs_dt_transfer - */ -static int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start, int count) -{ - int i; - int need; - int space; - INDEX_ENTRY *mov_ie; - u8 *src; - u8 *dst; - int len; - int insert; - //FILE_NAME_ATTR *file; - - //XXX check len > 0 - - if (!old || !new) - return -1; - - if ((start < 0) || ((start+count) >= old->child_count)) - return -1; - - printf ("\n"); - printf (BOLD YELLOW "Transferring children\n" END); - - need = 0; - for (i = start; i < (start+count+1); i++) { - mov_ie = old->children[i]; - need += mov_ie->length; - //file = &mov_ie->key.file_name; printf ("\ttrn name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - } - - if (ntfs_dt_isroot (new)) - space = ntfs_dt_root_freespace (new); - else - space = ntfs_dt_alloc_freespace (new); - - // XXX if this is an index root, it'll go badly wrong - // restrict to allocs only? - - printf ("\tneed = %d\n", need); - printf ("\tspace = %d\n", space); - - if (space < need) - return -1; - - if (new->child_count == 1) { - i = -1; - } else { - ntfschar *n1, *n2; - int l1, l2; - - n1 = new->children[0]->key.file_name.file_name; - l1 = new->children[0]->key.file_name.file_name_length; - - n2 = old->children[start]->key.file_name.file_name; - l2 = old->children[start]->key.file_name.file_name_length; - - i = ntfs_names_collate (n1, l1, n2, l2, - 2, IGNORE_CASE, - old->dir->vol->upcase, - old->dir->vol->upcase_len); - } - - if ((i == 0) || (i == 2)) - return -1; - - // determine the insertion point - if (i == 1) - insert = 0; - else - insert = new->child_count-1; - - src = (u8*) new->children[insert]; - dst = src + need; - len = (u8*) new->children[new->child_count-1] + new->children[new->child_count-1]->length - src; - - //printf ("src = %d, dst = %d, len = %d\n", src - new->data, dst - new->data, len); - memmove (dst, src, len); - - dst = src; - src = (u8*) old->children[start]; - len = need; - - memcpy (dst, src, len); - - src = (u8*) old->children[start+count-1]; - dst = (u8*) old->children[start]; - len = (u8*) old->children[old->child_count-1] + old->children[old->child_count-1]->length - src; - - //printf ("src = %d, dst = %d, len = %d\n", src - old->data, dst - old->data, len); - memmove (dst, src, len); - - dst += len; - len = old->data + old->dir->index_size - dst; - - //printf ("dst = %d, len = %d\n", dst - old->data, len); - memset (dst, 0, len); - - if (!ntfs_dt_resize_children3 (new, new->child_count + count)) - return -1; - - src = (u8*) &old->sub_nodes[start+count-1]; - dst = (u8*) &old->sub_nodes[start]; - len = (old->child_count - start - count + 1) * sizeof (struct ntfs_dt*); - - memmove (dst, src, len); - - src = (u8*) &new->sub_nodes[insert]; - dst = (u8*) &new->sub_nodes[insert+count-1]; - len = (new->child_count - insert - count + 1) * sizeof (struct ntfs_dt*); - - memmove (dst, src, len); - - if (!ntfs_dt_resize_children3 (old, old->child_count - count)) - return -1; - - src = (u8*) new->children[0]; - for (i = 0; i < new->child_count; i++) { - new->children[i] = (INDEX_ENTRY*) src; - src += new->children[i]->length; - } - - src = (u8*) old->children[0]; - for (i = 0; i < old->child_count; i++) { - old->children[i] = (INDEX_ENTRY*) src; - src += old->children[i]->length; - } - - old->header->index_length -= need; - new->header->index_length += need; - - // resize children and sub_nodes - // memmove keys in new - // memcpy old to new - // memmove keys in old - // rebuild old/new children/sub_nodes without destroying tree - // update old/new headers - - old->changed = TRUE; - new->changed = TRUE; - - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); - - return 0; -} - - -/** - * ntfs_dt_alloc_insert - */ -static int ntfs_dt_alloc_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count) -{ - // XXX don't bother measuring, just subtract the children pointers - - int i; - int need; - INDEX_ENTRY *ie; - INDEX_ALLOCATION *alloc; - u8 *src; - u8 *dst; - int len; - - if (!dt) - return 1; - if (!first) - return 1; - - need = 0; - ie = first; - for (i = 0; i < count; i++) { - need += ie->length; - ie = (INDEX_ENTRY*) ((u8*)ie + ie->length); - } - - printf ("alloc insert %d bytes\n", need); - - alloc = (INDEX_ALLOCATION*) dt->data; - printf ("entries_offset = %d\n", alloc->index.entries_offset); - printf ("index_length = %d\n", alloc->index.index_length); - printf ("allocated_size = %d\n", alloc->index.allocated_size); - - printf ("insert has %d children\n", dt->child_count); - printf ("children = %p\n", dt->children); - //utils_dump_mem (dt->data, 0, 128, DM_DEFAULTS); - - ie = dt->children[dt->child_count-1]; - - printf ("last child = %p (%ld)\n", ie, (long)ie - (long)dt->data); - printf ("size = %d\n", ie->length); - - src = (u8*) ie; - dst = src + need; - len = ie->length; - - memmove (dst, src, len); - - src = (u8*) first; - dst = (u8*) ie; - len = need; - - memcpy (dst, src, len); - - // use create children - // measure need and update children list - // adjust headers - - utils_dump_mem (dt->data, 0, 256, DM_DEFAULTS); - return 0; -} - -/** - * ntfs_dt_alloc_insert2 - */ -static INDEX_ENTRY * ntfs_dt_alloc_insert2 (struct ntfs_dt *dt, int before, int count, int bytes) -{ - int space; - u8 *src; - u8 *dst; - int len; - - // XXX don't bother measuring, just subtract the children pointers - - if (!dt) - return NULL; - if (before < 0) - return NULL; - if (count < 1) - return NULL; - if (bytes < 1) - return NULL; - - // check alloc has enough space - space = ntfs_dt_alloc_freespace (dt); - if (bytes > space) - return NULL; - - // move data - src = (u8*) dt->children[before]; - dst = src + bytes; - len = dt->header->index_length - ((int)dt->children[before] - (int)dt->data) + 24; - - //printf ("%d, %d, %d\n", (int)src - (int)dt->data, (int)dst - (int)dt->data, len); - - memmove (dst, src, len); - memset (dst, 0, bytes); - - // resize arrays - ntfs_dt_resize_children3 (dt, dt->child_count + count); - - // move keys (children) - src = (u8*) (dt->children + before); - dst = src + (count * sizeof (u8*)); - len = (dt->child_count - count - before) * sizeof (u8*); - - memmove (dst, src, len); - memset (src, 0, count * sizeof (u8*)); - - // move keys (inodes) - src = (u8*) (dt->inodes + before); - dst = src + (count * sizeof (u8*)); - len = (dt->child_count - count - before) * sizeof (u8*); - - memmove (dst, src, len); - memset (src, 0, count * sizeof (u8*)); - - // move keys (sub_nodes) - src = (u8*) (dt->sub_nodes + before); - dst = src + (count * sizeof (u8*)); - len = (dt->child_count - count - before) * sizeof (u8*); - - memmove (dst, src, len); - memset (src, 0, count * sizeof (u8*)); - - return NULL; -} - -/** - * ntfs_dt_root_insert - */ -static int ntfs_dt_root_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count) -{ - if (!dt) - return 1; - if (!first) - return 1; - - return count; -} - - /** * utils_array_insert */ @@ -2046,2027 +306,6 @@ static int utils_array_remove (void *ptr, int asize, int first, int count) } -/** - * ntfs_dt_alloc_remove2 - */ -static int ntfs_dt_alloc_remove2 (struct ntfs_dt *dt, int start, int count) -{ - int i; - int size; - - if (!dt) - return 1; - - size = 0; - for (i = start; i < (start+count); i++) { - size += dt->children[i]->length; - } - - return start + count; -} - -/** - * ntfs_dt_root_remove2 - */ -static int ntfs_dt_root_remove2 (struct ntfs_dt *dt, int start, int count) -{ - int i; - int size; - - if (!dt) - return -1; - if ((start < 0) || (start >= dt->child_count)) - return -1; - if ((count < 1) || ((start + count - 1) >= dt->child_count)) - return -1; - - printf ("s c/t %d %d/%d\n", start, count, dt->child_count); - - size = 0; - for (i = start; i < (start + count); i++) - size += dt->children[i]->length; - printf ("size1 = %d\n", size); - - size = (int) dt->children[start+count] - (int) dt->children[start]; - printf ("size2 = %d\n", size); - - size = (int) dt->children[start+count-1] - (int) dt->children[start] + dt->children[start+count-1]->length; - printf ("size3 = %d\n", size); - - // XXX what shall we do with the inodes? - // transfer them to the dir (commit them for now) - // are they _our_ responsibility? probably not - - // rearrange arrays - // shrink attribute - - ntfs_dt_resize_children3 (dt, dt->child_count - count); - - printf ("ntfs_dt_root_remove2\n"); - return dt->child_count; -} - -/** - * ntfs_dt_transfer2 - */ -static int ntfs_dt_transfer2 (struct ntfs_dt *old, struct ntfs_dt *new, int start, int count) -{ - int i; - int need; - int space; - INDEX_ENTRY *mov_ie; - u8 *src; - u8 *dst; - int len; - int insert; - //FILE_NAME_ATTR *file; - - if (!old || !new) - return -1; - - if ((start < 0) || (count < 0)) - return -1; - - if ((start + count) >= old->child_count) - return -1; - - printf ("\n"); - printf (BOLD YELLOW "Transferring children\n" END); - - need = 0; - for (i = start; i < (start+count); i++) { - mov_ie = old->children[i]; - need += mov_ie->length; - //file = &mov_ie->key.file_name; printf ("\ttrn name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - } - - if (ntfs_dt_isroot (new)) - space = ntfs_dt_root_freespace (new); - else - space = ntfs_dt_alloc_freespace (new); - - printf ("\tneed = %d\n", need); - printf ("\tspace = %d\n", space); - - if (need > space) - return -1; - - if (ntfs_dt_isroot (new)) - ntfs_dt_root_insert (new, old->children[0], count); - else - ntfs_dt_alloc_insert2 (new, 0, count, need); - - if (ntfs_dt_isroot (old)) - ntfs_dt_root_remove2 (old, 0, count); - else - ntfs_dt_alloc_remove2 (old, 0, count); - - if (1) return -1; - if (0) ntfs_dt_alloc_insert (NULL, NULL, 0); - - if (new->child_count == 1) { - i = -1; - } else { - ntfschar *n1, *n2; - int l1, l2; - - n1 = new->children[0]->key.file_name.file_name; - l1 = new->children[0]->key.file_name.file_name_length; - - n2 = old->children[start]->key.file_name.file_name; - l2 = old->children[start]->key.file_name.file_name_length; - - i = ntfs_names_collate (n1, l1, n2, l2, - 2, IGNORE_CASE, - old->dir->vol->upcase, - old->dir->vol->upcase_len); - } - - if ((i == 0) || (i == 2)) - return -1; - - // determine the insertion point - if (i == 1) - insert = 0; - else - insert = new->child_count-1; - - src = (u8*) new->children[insert]; - dst = src + need; - len = (u8*) new->children[new->child_count-1] + new->children[new->child_count-1]->length - src; - - //printf ("src = %d, dst = %d, len = %d\n", src - new->data, dst - new->data, len); - memmove (dst, src, len); - - dst = src; - src = (u8*) old->children[start]; - len = need; - - memcpy (dst, src, len); - - src = (u8*) old->children[start+count-1]; - dst = (u8*) old->children[start]; - len = (u8*) old->children[old->child_count-1] + old->children[old->child_count-1]->length - src; - - //printf ("src = %d, dst = %d, len = %d\n", src - old->data, dst - old->data, len); - memmove (dst, src, len); - - dst += len; - len = old->data + old->dir->index_size - dst; - - //printf ("dst = %d, len = %d\n", dst - old->data, len); - memset (dst, 0, len); - - if (!ntfs_dt_resize_children3 (new, new->child_count + count)) - return -1; - - src = (u8*) &old->sub_nodes[start+count-1]; - dst = (u8*) &old->sub_nodes[start]; - len = (old->child_count - start - count + 1) * sizeof (struct ntfs_dt*); - - memmove (dst, src, len); - - src = (u8*) &new->sub_nodes[insert]; - dst = (u8*) &new->sub_nodes[insert+count-1]; - len = (new->child_count - insert - count + 1) * sizeof (struct ntfs_dt*); - - memmove (dst, src, len); - - if (!ntfs_dt_resize_children3 (old, old->child_count - count)) - return -1; - - src = (u8*) new->children[0]; - for (i = 0; i < new->child_count; i++) { - new->children[i] = (INDEX_ENTRY*) src; - src += new->children[i]->length; - } - - src = (u8*) old->children[0]; - for (i = 0; i < old->child_count; i++) { - old->children[i] = (INDEX_ENTRY*) src; - src += old->children[i]->length; - } - - old->header->index_length -= need; - new->header->index_length += need; - - // resize children and sub_nodes - // memmove keys in new - // memcpy old to new - // memmove keys in old - // rebuild old/new children/sub_nodes without destroying tree - // update old/new headers - - old->changed = TRUE; - new->changed = TRUE; - - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); - - return 0; -} - - -/** - * utils_free_non_residents3 - */ -static int utils_free_non_residents3 (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECORD *attr) -{ - ntfs_attr *na; - runlist_element *rl; - LCN size; - LCN count; - - if (!bmp) - return 1; - if (!inode) - return 1; - if (!attr) - return 1; - if (!attr->non_resident) - return 0; - - na = ntfs_attr_open (inode, attr->type, NULL, 0); - if (!na) - return 1; - - ntfs_attr_map_whole_runlist (na); - rl = na->rl; - size = na->allocated_size >> inode->vol->cluster_size_bits; - for (count = 0; count < size; count += rl->length, rl++) { - if (ntfs_bmp_set_range (bmp, rl->lcn, rl->length, 0) < 0) { - printf (RED "set range : %lld - %lld FAILED\n" END, rl->lcn, rl->lcn+rl->length-1); - } - } - ntfs_attr_close (na); - - return 0; -} - -/** - * utils_free_non_residents2 - */ -static int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) -{ - ntfs_attr_search_ctx *ctx; - - if (!inode) - return -1; - if (!bmp) - return -1; - - ctx = ntfs_attr_get_search_ctx (inode, NULL); - if (!ctx) { - printf ("can't create a search context\n"); - return -1; - } - - while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { - utils_free_non_residents3 (bmp, inode, ctx->attr); - } - - ntfs_attr_put_search_ctx (ctx); - return 0; -} - - -/** - * ntfs_mft_remove_attr - */ -static int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES type) -{ - ATTR_RECORD *attr20, *attrXX; - MFT_RECORD *mft; - u8 *src, *dst; - int len; - - if (!inode) - return 1; - - attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, inode->mrec); - if (attr20) - return 1; - - printf ("remove inode %lld, attr 0x%02X\n", inode->mft_no, type); - - attrXX = find_first_attribute (type, inode->mrec); - if (!attrXX) - return 1; - - if (utils_free_non_residents3 (bmp, inode, attrXX)) - return 1; - - // remove entry - // inode->mrec - - mft = inode->mrec; - //utils_dump_mem (mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); - - //utils_dump_mem (attrXX, 0, attrXX->length, DM_DEFAULTS); printf ("\n"); - - //printf ("mrec = %p, attr = %p, diff = %d (0x%02X)\n", mft, attrXX, (u8*)attrXX - (u8*)mft, (u8*)attrXX - (u8*)mft); - // memmove - - dst = (u8*) attrXX; - src = dst + attrXX->length; - len = (((u8*) mft + mft->bytes_in_use) - src); - - // fix mft header - mft->bytes_in_use -= attrXX->length; - -#if 0 - printf ("dst = 0x%02X, src = 0x%02X, len = 0x%02X\n", (dst - (u8*)mft), (src - (u8*)mft), len); - printf ("attr %02X, len = 0x%02X\n", attrXX->type, attrXX->length); - printf ("bytes in use = 0x%02X\n", mft->bytes_in_use); - printf ("\n"); -#endif - - memmove (dst, src, len); - //utils_dump_mem (mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); - - NInoSetDirty(inode); - return 0; -} - -/** - * ntfs_mft_add_attr - */ -static ATTR_RECORD * ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int data_len) -{ - MFT_RECORD *mrec; - ATTR_RECORD *attr; - u8 *ptr; - u8 *src; - u8 *dst; - int len; - int attr_size; - - if (!inode) - return NULL; - if (!data) - return NULL; - - attr_size = ATTR_SIZE (data_len); - - mrec = inode->mrec; - if (!mrec) - return NULL; - - if ((mrec->bytes_in_use + attr_size + 0x18) > mrec->bytes_allocated) { - printf ("attribute is too big to fit in the record\n"); - return NULL; - } - - ptr = (u8*) inode->mrec + mrec->attrs_offset; - while (1) { - attr = (ATTR_RECORD*) ptr; - - if (type < attr->type) - break; - - ptr += attr->length; - } - - //printf ("insert before attr 0x%02X\n", attr->type); - - len = ((u8*) mrec + mrec->bytes_in_use) - ((u8*) attr); - src = (u8*) attr; - dst = src + attr_size + 0x18; - - memmove (dst, src, len); - - src = data; - dst = (u8*) attr + 0x18; - len = data_len; - - // XXX wipe slack space after attr? - - memcpy (dst, src, len); - - mrec->bytes_in_use += attr_size + 0x18; - - memset (attr, 0, 0x18); - *(u32*)((u8*) attr + 0x00) = type; - *(u32*)((u8*) attr + 0x04) = attr_size + 0x18; - *(u16*)((u8*) attr + 0x0E) = mrec->next_attr_instance; - *(u32*)((u8*) attr + 0x10) = data_len; - *(u32*)((u8*) attr + 0x14) = 0x18; - - mrec->next_attr_instance++; - - return attr; -} - -/** - * ntfs_mft_resize_resident - */ -static int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len, u8 *data, int data_len) -{ - int mft_size; - int mft_usage; - int mft_free; - int attr_orig; - int attr_new; - u8 *src; - u8 *dst; - u8 *end; - int len; - ntfs_attr_search_ctx *ctx = NULL; - ATTR_RECORD *arec = NULL; - MFT_RECORD *mrec = NULL; - int res = -1; - - // XXX only works when attr is in base inode - - if ((!inode) || (!inode->mrec)) - return -1; - if ((!data) || (data_len < 0)) - return -1; - - mrec = inode->mrec; - - mft_size = mrec->bytes_allocated; - mft_usage = mrec->bytes_in_use; - mft_free = mft_size - mft_usage; - - //printf ("mft_size = %d\n", mft_size); - //printf ("mft_usage = %d\n", mft_usage); - //printf ("mft_free = %d\n", mft_free); - //printf ("\n"); - - ctx = ntfs_attr_get_search_ctx (inode, NULL); - if (!ctx) - goto done; - - if (ntfs_attr_lookup(type, name, name_len, CASE_SENSITIVE, 0, NULL, 0, ctx) != 0) - goto done; - - arec = ctx->attr; - - if (arec->non_resident) { - printf ("attribute isn't resident\n"); - goto done; - } - - attr_orig = arec->value_length; - attr_new = data_len; - - //printf ("attr orig = %d\n", attr_orig); - //printf ("attr new = %d\n", attr_new); - //printf ("\n"); - - if ((attr_new - attr_orig + mft_usage) > mft_size) { - printf ("attribute won't fit into mft record\n"); - goto done; - } - - //printf ("new free space = %d\n", mft_size - (attr_new - attr_orig + mft_usage)); - - src = (u8*)arec + arec->length; - dst = src + (attr_new - attr_orig); - end = (u8*)mrec + mft_usage; - len = end - src; - - //printf ("src = %d\n", src - (u8*)mrec); - //printf ("dst = %d\n", dst - (u8*)mrec); - //printf ("end = %d\n", end - (u8*)mrec); - //printf ("len = %d\n", len); - - if (src != dst) - memmove (dst, src, len); - - memcpy ((u8*)arec + arec->value_offset, data, data_len); - - mrec->bytes_in_use += (attr_new - attr_orig); - arec->length += (attr_new - attr_orig); - arec->value_length += (attr_new - attr_orig); - - memset ((u8*)mrec + mrec->bytes_in_use, 0, mft_size - mrec->bytes_in_use); - - mft_usage += (attr_new - attr_orig); - //utils_dump_mem (mrec, 0, mft_size, DM_DEFAULTS); - res = 0; -done: - ntfs_attr_put_search_ctx (ctx); - return res; -} - -/** - * ntfs_mft_free_space - */ -static int ntfs_mft_free_space (struct ntfs_dir *dir) -{ - int res = 0; - MFT_RECORD *mft; - - if ((!dir) || (!dir->inode)) - return -1; - - mft = (MFT_RECORD*) dir->inode->mrec; - - res = mft->bytes_allocated - mft->bytes_in_use; - - return res; -} - -/** - * ntfs_mft_add_index - */ -static int ntfs_mft_add_index (struct ntfs_dir *dir) -{ - ntfs_volume *vol; - u8 *buffer = NULL; - ATTR_RECORD *attr = NULL; - struct ntfs_dt *dt = NULL; - INDEX_ENTRY *ie = NULL; - - if (!dir) - return 1; - if (dir->bitmap && dir->ialloc) - return 0; - if (dir->bitmap || dir->ialloc) - return 1; - if (dir->index_size < 512) - return 1; - - vol = dir->vol; - printf ("add two attrs to " YELLOW); ntfs_name_print (dir->name, dir->name_len); printf (END "\n"); - printf ("index size = %d\n", dir->index_size); - - buffer = malloc (dir->index_size); - if (!buffer) - return 1; - - dt = ntfs_dt_create (dir, dir->index, -1); - if (!dt) - return 1; - - dt->vcn = 0; // New alloc record - - ie = ntfs_ie_copy (dir->index->children[dir->index->child_count-1]); - ie = ntfs_ie_set_vcn (ie, dt->vcn); - - // can't replace ie yet, there may not be room - ntfs_ie_free (ie); - - ntfs_dt_transfer2 (dir->index, dt, 0, dir->index->child_count - 1); - - printf ("root has %d children\n", dir->index->child_count); - printf ("node has %d children\n", dt->child_count); - - ntfs_dt_free (dt); - - // create a new dt - // attach dt to dir - // move entries into alloc - // shrink root - - // transfer keys to new node - // hook up root & alloc dts - - // need disk allocation before here - - // Index Allocation - memset (buffer, 0, 128); - attr = ntfs_mft_add_attr (dir->inode, AT_INDEX_ALLOCATION, buffer, 0x48); - - // Bitmap - memset (buffer, 0, 8); - buffer[0] = 0x01; - //printf ("inode = %p\n", dir->inode); - attr = ntfs_mft_add_attr (dir->inode, AT_BITMAP, buffer, 8); - - // attach alloc and bitmap to dir - // need to create ntfs_attr's for them - - // one indx record - // 8 bits of bitmap - - if (0) ntfs_bmp_find_space (NULL, 0, 0); - - //printf ("m1 = %lld\n", vol->mft_zone_start); - //printf ("m2 = %lld\n", vol->mft_zone_end); - //printf ("m3 = %lld\n", vol->mft_zone_pos); - //printf ("z1 = %lld\n", vol->data1_zone_pos); - //printf ("z2 = %lld\n", vol->data2_zone_pos); - - free (buffer); - return 0; -} - - -/** - * ntfs_inode_open2 - */ -static ntfs_inode * ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) -{ - ntfs_inode *ino = NULL; - struct ntfs_dir *dir; - - if (!vol) - return NULL; - - switch (mref) { - case FILE_Bitmap: ino = vol->lcnbmp_ni; break; - case FILE_MFT: ino = vol->mft_ni; break; - case FILE_MFTMirr: ino = vol->mftmirr_ni; break; - case FILE_root: - dir = vol->private_data; - if (dir) - ino = dir->inode; - break; - } - - if (ino) { - //printf (BOLD YELLOW "inode reuse %lld\n" END, mref); - ino->ref_count++; - return ino; - } - - ino = ntfs_inode_open (vol, mref); - if (!ino) - return NULL; - - /* - if (mref != FILE_root) - ntfs_inode_dir_map (ino); - */ - - // link - // ino->private_data - - ino->private_data = NULL; - ino->ref_count = 1; - - //printf (BOLD YELLOW "inode open %lld\n" END, mref); - return ino; -} - -/** - * ntfs_inode_open3 - * open a deleted inode - */ -static ntfs_inode * ntfs_inode_open3 (ntfs_volume *vol, const MFT_REF mref) -{ - ntfs_inode *ino = NULL; - - if (!vol) - return NULL; - - ino = calloc (1, sizeof (*ino)); - if (!ino) - return NULL; - - ino->mrec = malloc (vol->mft_record_size); - if (!ino->mrec) { - free (ino); - return NULL; - } - - ino->mft_no = mref; - ino->vol = vol; - - ino->data_size = -1; - ino->allocated_size = -1; - - ino->private_data = NULL; - ino->ref_count = 1; - - if (1 != ntfs_attr_mst_pread (vol->mft_na, MREF(mref) * vol->mft_record_size, 1, vol->mft_record_size, ino->mrec)) { - //ntfs_inode_close2 (ino); ??? - free (ino->mrec); - free (ino); - return NULL; - } - - NInoSetDirty (ino); - return ino; -} - - -/** - * ntfs_dt_root_replace - */ -static int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) -{ - u8 *src; - u8 *dst; - u8 *attr; - int len; - int i; - - if (!del || !del_ie || !suc_ie) - return FALSE; - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - //printf ("\n"); - - attr = malloc (del->data_len + suc_ie->length - del_ie->length); - - dst = attr; - src = del->data; - len = (u8*) del_ie - del->data; - - memcpy (dst, src, len); - - dst += len; - src = (u8*) suc_ie; - len = suc_ie->length; - - memcpy (dst, src, len); - - dst += len; - src = (u8*) del_ie + del_ie->length; - len = del->data_len + (del->data - (u8*) del_ie) - del_ie->length; - - memcpy (dst, src, len); - - src = (u8*) del->data; - dst = attr; - - len = suc_ie->length - del_ie->length; - free (del->data); - del->data = attr; - del->data_len += len; - del->header = (INDEX_HEADER*) (del->data + 0x10); - del->header->index_length += len; - del->header->allocated_size += len; - - ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); - - //utils_dump_mem (attr, 0, del->data_len, DM_DEFAULTS); - - //printf ("\n"); - //printf (BOLD YELLOW "Adjust children\n" END); - //for (i = 0; i < del->child_count; i++) - // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); - //printf ("\n"); - - //printf ("src = %p, dst = %p, len = %d\n", src, dst, len); fflush (stdout); - - for (i = 0; i < del->child_count; i++) - del->children[i] = (INDEX_ENTRY*) (dst + ((u8*) del->children[i] - src)); - - for (i = del_num+1; i < del->child_count; i++) - del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); - - //for (i = 0; i < del->child_count; i++) - // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); - //printf ("\n"); - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - //printf ("\n"); - - del->changed = TRUE; - - printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); - return TRUE; -} - -/** - * ntfs_dt_alloc_replace - */ -static BOOL ntfs_dt_alloc_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) -{ - u8 *src; - u8 *dst; - int len; - int i; - - if (!del || !del_ie || !suc_ie) - return FALSE; - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - - src = (u8*) del_ie + del_ie->length; - dst = (u8*) del_ie + suc_ie->length; - len = del->header->index_length + 24 + (del->data - src); - //printf ("src = %d\n", src - del->data); - //printf ("dst = %d\n", dst - del->data); - //printf ("len = %d\n", len); - - if (src != dst) - memmove (dst, src, len); - - src = (u8*) suc_ie; - dst = (u8*) del_ie; - len = suc_ie->length; - - memcpy (dst, src, len); - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - - del->header->index_length += suc_ie->length - del_ie->length; - - dst = del->data + del->header->index_length + 24; - len = del->data_len - del->header->index_length - 24; - - memset (dst, 0, len); - - //for (i = 0; i < del->child_count; i++) - // printf ("Child %d %p\n", i, del->children[i]); - //printf ("\n"); - - len = suc_ie->length - del_ie->length; - //printf ("len = %d\n", len); - - for (i = del_num+1; i < del->child_count; i++) - del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); - - //for (i = 0; i < del->child_count; i++) - // printf ("Child %d %p\n", i, del->children[i]); - //printf ("\n"); - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - - del->changed = TRUE; - - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); - return TRUE; -} - -/** - * ntfs_dt_root_remove - */ -static BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) -{ - INDEX_ENTRY *del_ie = NULL; - u8 *src; - u8 *dst; - u8 *old; - int len; - int del_len; - int i; - //int off; - - if (!del) - return FALSE; - - //utils_dump_mem (del->data, 0, del->header->index_length+16, DM_RED); - //printf ("\n"); - -#if 0 - off = (u8*) del->children[0] - del->data; - for (i = 0; i < del->child_count; i++) { - del_ie = del->children[i]; - - printf ("%2d %4d ", i+1, off); - off += del_ie->length; - - if (del_ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", del_ie->length); - break; - } - - ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); - printf (" (%d)\n", del_ie->length); - } - printf ("total = %d\n", off); -#endif - - del_ie = del->children[del_num]; - del_len = del_ie->length; - - src = (u8*) del_ie + del_len; - dst = (u8*) del_ie; - len = del->header->index_length + 16 - (src - del->data); - - //printf ("src = %d\n", src - del->data); - //printf ("dst = %d\n", dst - del->data); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - del->data_len -= del_len; - del->child_count--; - - del->header->index_length = del->data_len - 16; - del->header->allocated_size = del->data_len - 16; - - ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); - old = del->data; - del->data = realloc (del->data, del->data_len); - del->header = (INDEX_HEADER*) (del->data + 0x10); - - //utils_dump_mem (del->data, 0, del->data_len, DM_GREEN | DM_RED); - - src = (u8*) (&del->children[del_num+1]); - dst = (u8*) (&del->children[del_num]); - len = (del->child_count - del_num) * sizeof (INDEX_ENTRY*); - - //printf ("src = %d\n", src - (u8*) del->children); - //printf ("dst = %d\n", dst - (u8*) del->children); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - src = (u8*) (&del->sub_nodes[del_num+1]); - dst = (u8*) (&del->sub_nodes[del_num]); - len = (del->child_count - del_num) * sizeof (struct ntfs_dt*); - - //printf ("src = %d\n", src - (u8*) del->children); - //printf ("dst = %d\n", dst - (u8*) del->children); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - //printf ("del_num = %d\n", del_num); - for (i = 0; i < del->child_count; i++) - del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - old + del->data); - for (i = del_num; i < del->child_count; i++) - del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_len); - - if (!ntfs_dt_create_children2 (del, del->child_count)) - return FALSE; - -#if 0 - off = (u8*) del->children[0] - del->data; - for (i = 0; i < del->child_count; i++) { - del_ie = del->children[i]; - - printf ("%2d %4d ", i+1, off); - off += del_len; - - if (del_ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", del_len); - break; - } - - ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); - printf (" (%d)\n", del_len); - } - printf ("total = %d\n", off); -#endif - - //utils_dump_mem (del->data, 0, del->header->index_length+16, DM_DEFAULTS); - - del->changed = TRUE; - - printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); - return TRUE; -} - -/** - * ntfs_dt_alloc_remove - */ -static BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) -{ - INDEX_ENTRY *del_ie = NULL; - u8 *dst; - u8 *src; - int len; - int i; - //int off; - - if (!del) - return FALSE; - -#if 0 - off = (u8*)del->children[0] - del->data; - for (i = 0; i < del->child_count; i++) { - del_ie = del->children[i]; - - printf ("%2d %4d ", i, off); - off += del_ie->length; - - if (del_ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", del_ie->length); - break; - } - - ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); - printf (" (%d)\n", del_ie->length); - } - printf ("total = %d\n", off); - printf ("\n"); -#endif - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - //printf ("\n"); - - del_ie = del->children[del_num]; - - src = (u8*) del_ie + del_ie->length; - dst = (u8*) del_ie; - len = del->header->index_length + 24 - (src - del->data); - - //printf ("src = %d\n", src - del->data); - //printf ("dst = %d\n", dst - del->data); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - del->header->index_length -= src - dst; - del->child_count--; - - dst += len; - len = del->data_len - del->header->index_length - 24; - - //printf ("dst = %d\n", dst - del->data); - //printf ("len = %d\n", len); - - memset (dst, 0, len); - - src = (u8*) (&del->children[del_num+1]); - dst = (u8*) (&del->children[del_num]); - len = (del->child_count - del_num) * sizeof (INDEX_ENTRY*); - - //printf ("src = %d\n", src - (u8*) del->children); - //printf ("dst = %d\n", dst - (u8*) del->children); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - src = (u8*) (&del->sub_nodes[del_num+1]); - dst = (u8*) (&del->sub_nodes[del_num]); - len = (del->child_count - del_num) * sizeof (struct ntfs_dt*); - - //printf ("src = %d\n", src - (u8*) del->children); - //printf ("dst = %d\n", dst - (u8*) del->children); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - //printf ("del_num = %d\n", del_num); - for (i = del_num; i < del->child_count; i++) - del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_ie->length); - - if (!ntfs_dt_create_children2 (del, del->child_count)) - return FALSE; - - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - -#if 0 - off = (u8*)del->children[0] - del->data; - for (i = 0; i < del->child_count; i++) { - del_ie = del->children[i]; - - printf ("%2d %4d ", i, off); - off += del_ie->length; - - if (del_ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", del_ie->length); - break; - } - - ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); - printf (" (%d)\n", del_ie->length); - } - printf ("total = %d\n", off); - printf ("\n"); -#endif - - del->changed = TRUE; - - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); - - if (del->child_count < 2) { - printf ("indx is empty\n"); - ntfs_bmp_set_range (del->dir->bitmap, del->vcn, 1, 0); - } - - return TRUE; -} - -/** - * ntfs_dt_alloc_add - */ -static int ntfs_dt_alloc_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) -{ - INDEX_BLOCK *block; - INDEX_ENTRY *entry; - int need; - int space; - u8 *src; - u8 *dst; - int len; - - if (!parent || !ie) - return 0; - - block = (INDEX_BLOCK*) parent->data; - - need = ie->length; - space = parent->data_len - block->index.index_length - 24; - - printf ("need %d, have %d\n", need, space); - if (need > space) { - printf ("no room"); - return 0; - } - - //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); - //printf ("\n"); - - src = (u8*) parent->children[index_num]; - dst = src + need; - len = parent->data + parent->data_len - src - space; - //printf ("src = %d\n", src - parent->data); - //printf ("dst = %d\n", dst - parent->data); - //printf ("len = %d\n", len); - - memmove (dst, src, len); - - dst = src; - src = (u8*) ie; - len = need; - - memcpy (dst, src, len); - - block->index.index_length += len; - - dst = parent->data + block->index.index_length + 24; - len = parent->data_len - block->index.index_length - 24; - - memset (dst, 0, len); - - //realloc children, sub_nodes - ntfs_dt_create_children2 (parent, parent->child_count + 1); - - // regen children pointers - parent->child_count = 0; - - src = parent->data + 0x18 + parent->header->entries_offset; - len = parent->data_len - 0x18 - parent->header->entries_offset; - - while (src < (parent->data + parent->data_len)) { - entry = (INDEX_ENTRY*) src; - - parent->children[parent->child_count] = entry; - parent->child_count++; - - if (entry->flags & INDEX_ENTRY_END) - break; - - src += entry->length; - } - printf ("count = %d\n", parent->child_count); - - src = (u8*) &parent->sub_nodes[index_num+parent->child_count-1]; - dst = (u8*) &parent->sub_nodes[index_num]; - len = (parent->child_count - index_num - 1) * sizeof (struct ntfs_dt*); - - memmove (dst, src, len); - - //insert sub_node pointer - parent->sub_nodes[index_num] = child; - - //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); - //printf ("\n"); - return 0; -} - -/** - * ntfs_dt_root_add - */ -static int ntfs_dt_root_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) -{ - INDEX_ROOT *root; - INDEX_ENTRY *entry; - int need; - int space; - u8 *attr; - u8 *src; - u8 *dst; - int len; - - if (!parent || !ie) - return 0; - - root = (INDEX_ROOT*) parent->data; - - utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); - printf ("\n"); - - need = ie->length; - space = ntfs_mft_free_space (parent->dir); - - printf ("need %d, have %d\n", need, space); - if (need > space) { - printf ("no room"); - return 0; - } - - attr = malloc (parent->data_len + need); - - src = parent->data; - dst = attr; - len = root->index.entries_offset + 16; - - memcpy (dst, src, len); - - dst += len; - src = (u8*) ie; - len = ie->length; - - memcpy (dst, src, len); - - dst += len; - src = (u8*) parent->children[index_num]; - len = parent->data + parent->data_len - src; - - memcpy (dst, src, len); - - free (parent->data); - parent->data = attr; - parent->data_len += need; - - root = (INDEX_ROOT*) parent->data; - root->index.index_length = parent->data_len - 16; - root->index.allocated_size = parent->data_len - 16; - - utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); - printf ("\n"); - - ntfs_mft_resize_resident (parent->dir->inode, AT_INDEX_ROOT, I30, 4, parent->data, parent->data_len); - - //realloc children, sub_nodes - ntfs_dt_create_children2 (parent, parent->child_count + 1); - - // regen children pointers - parent->child_count = 0; - - src = parent->data + 0x18 + parent->header->entries_offset; - len = parent->data_len - 0x18 - parent->header->entries_offset; - - // XXX can we rebase the children more simply? (in alloc_add too) - while (src < (parent->data + parent->data_len)) { - entry = (INDEX_ENTRY*) src; - - parent->children[parent->child_count] = entry; - parent->child_count++; - - if (entry->flags & INDEX_ENTRY_END) - break; - - src += entry->length; - } - printf ("count = %d\n", parent->child_count); - - src = (u8*) &parent->sub_nodes[index_num+parent->child_count-1]; - dst = (u8*) &parent->sub_nodes[index_num]; - len = (parent->child_count - index_num - 1) * sizeof (struct ntfs_dt*); - - memmove (dst, src, len); - - //insert sub_node pointer - parent->sub_nodes[index_num] = child; - - return 0; -} - -/** - * ntfs_dt_add2 - */ -static int ntfs_dt_add2 (INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs_dt *ded) -{ - int need; - int space; - int median; - struct ntfs_dt *new = NULL; - struct ntfs_dt *chl; - INDEX_ENTRY *med_ie = NULL; - //FILE_NAME_ATTR *file; - VCN vcn = 0; - //int i; - - if (!ie || !suc) - return -1; - - printf ("\n"); - printf (BOLD YELLOW "Add key to leaf\n" END); - - //utils_dump_mem (suc->data, 0, suc->data_len, DM_DEFAULTS); - - chl = NULL; -ascend: - //XXX replace with while/break? - -#if 0 - for (; ded; ded = ded->sub_nodes[0]) { - printf ("\tded vcn = %lld\n", ded->vcn); - } -#endif - - /* - * ADD - * room in current node? - * yes, add, done - * no, split, ascend - */ - need = ie->length; - - if (ntfs_dt_isroot (suc)) - space = ntfs_dt_root_freespace (suc); - else - space = ntfs_dt_alloc_freespace (suc); - - printf ("\tneed %d\n", need); - printf ("\tspace %d\n", space); - - if (space >= need) { - if (ntfs_dt_isroot (suc)) - ntfs_dt_root_add (suc, suc_num, ie, chl); - else - ntfs_dt_alloc_add (suc, suc_num, ie, chl); - goto done; - } - - /* - * SPLIT - * any dead? - * yes reuse - * no alloc - */ - if (ded) { - new = ded; - vcn = ded->vcn; - ded = ded->sub_nodes[0]; - printf ("\treusing vcn %lld\n", new->vcn); - } else { - ntfs_mft_add_index (suc->dir); - /* - * ALLOC - * any unused records? - * yes, enable first - * no, extend - */ - /* - * ENABLE - * modify bitmap - * init indx record - */ - /* - * EXTEND - * room in bitmap - * yes, do nothing - * no, extend bitmap - * extend alloc - */ - /* - * EXTEND BITMAP - * extend bitmap - * init bitmap - */ - } - - //printf ("\tnode has %d children\n", suc->child_count); - - // initialise new node - // XXX ntfs_dt_initialise (new, vcn); - - goto done; - - // find median key - median = (suc->child_count+1) / 2; - med_ie = ntfs_ie_copy (suc->children[median]); - //file = &med_ie->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - - ntfs_ie_free (med_ie); - med_ie = NULL; - - //printf ("suc key count = %d\n", suc->child_count); - //printf ("new key count = %d\n", new->child_count); - - //printf ("median's child = %p\n", suc->sub_nodes[median]); - // need to pass the child when ascending - chl = suc->sub_nodes[median]; - - // transfer keys - if (ntfs_dt_transfer (suc, new, 0, median-1) < 0) - goto done; - - //printf ("suc key count = %d\n", suc->child_count); - //printf ("new key count = %d\n", new->child_count); - - //file = &suc->children[0]->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - - // can this be a root node? - if (ntfs_dt_isroot (suc)) - ntfs_dt_root_remove (suc, 0); - else - ntfs_dt_alloc_remove (suc, 0); - - //file = &suc->children[0]->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - //printf ("suc key count = %d\n", suc->child_count); - //printf ("new key count = %d\n", new->child_count); - - // remove the median key - - // split when median has children - // median child given to new ! - // median child is new - // ascend - - med_ie = ntfs_ie_set_vcn (med_ie, new->vcn); - if (!med_ie) - goto done; - - //printf ("median child = %lld\n", ntfs_ie_get_vcn (med_ie)); - //printf ("new's vcn = %lld\n", new->vcn); - - // adjust parents - // attach new to median - // escape clause for root node? - // goto ascend - - // ie = insert - // child = child - // suc = successor - // suc_num = insert point - - ie = med_ie; - suc = suc->parent; - suc_num = 0; - - printf ("\n"); - printf (BOLD YELLOW "Ascend\n" END); - goto ascend; -done: - return 0; -} - - -/** - * ntfs_dir_rollback - */ -static int ntfs_dir_rollback (struct ntfs_dir *dir) -{ - int i; - - if (!dir) - return -1; - - if (ntfs_dt_rollback (dir->index) < 0) - return -1; - - if (ntfs_bmp_rollback (dir->bitmap) < 0) - return -1; - - for (i = 0; i < dir->child_count; i++) { - if (ntfs_dir_rollback (dir->children[i]) < 0) - return -1; - } - - return 0; -} - -/** - * ntfs_dir_truncate - */ -static int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) -{ - //int i; - //u8 *buffer; - //int buf_count; - s64 last_bit; - INDEX_ENTRY *ie; - - if (!vol || !dir) - return -1; - - if ((dir->ialloc == NULL) || (dir->bitmap == NULL)) - return 0; - -#if 0 - buf_count = ROUND_UP (dir->bitmap->attr->allocated_size, vol->cluster_size) >> vol->cluster_size_bits; - printf ("alloc = %lld bytes\n", dir->ialloc->allocated_size); - printf ("alloc = %lld clusters\n", dir->ialloc->allocated_size >> vol->cluster_size_bits); - printf ("bitmap bytes 0 to %lld\n", ((dir->ialloc->allocated_size >> vol->cluster_size_bits)-1)>>3); - printf ("bitmap = %p\n", dir->bitmap); - printf ("bitmap = %lld bytes\n", dir->bitmap->attr->allocated_size); - printf ("bitmap = %d buffers\n", buf_count); -#endif - - last_bit = ntfs_bmp_find_last_set (dir->bitmap); - if (dir->ialloc->allocated_size == (dir->index_size * (last_bit + 1))) { - //printf ("nothing to do\n"); - return 0; - } - - printf (BOLD YELLOW "Truncation needed\n" END); - -#if 0 - printf ("\tlast bit = %lld\n", last_bit); - printf ("\tactual IALLOC size = %lld\n", dir->ialloc->allocated_size); - printf ("\tshould IALLOC size = %lld\n", dir->index_size * (last_bit + 1)); -#endif - - if ((dir->index_size * (last_bit + 1)) == 0) { - printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); - //rollback all dts - //ntfs_dt_rollback (dir->index); - //dir->index = NULL; - // What about the ROOT dt? - - ie = ntfs_ie_copy (dir->index->children[0]); - if (!ie) { - printf (RED "IE copy failed\n" END); - return -1; - } - - ie = ntfs_ie_remove_vcn (ie); - if (!ie) { - printf (RED "IE remove vcn failed\n" END); - return -1; - } - - //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); - //utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); - ntfs_dt_root_replace (dir->index, 0, dir->index->children[0], ie); - //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); - //printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); - - ntfs_ie_free (ie); - ie = NULL; - - //index flags remove LARGE_INDEX - dir->index->header->flags = 0; - - //rollback dir's bmp - ntfs_bmp_free (dir->bitmap); - dir->bitmap = NULL; - - /* - for (i = 0; i < dir->index->child_count; i++) { - ntfs_dt_rollback (dir->index->sub_nodes[i]); - dir->index->sub_nodes[i] = NULL; - } - */ - - //printf ("dir->index->inodes[0] = %p\n", dir->index->inodes[0]); - - //remove 0xA0 attribute - ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_INDEX_ALLOCATION); - - //remove 0xB0 attribute - ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_BITMAP); - } else { - printf (RED "Cannot shrink directory\n" END); - //ntfs_dir_shrink_alloc - //ntfs_dir_shrink_bitmap - //make bitmap resident? - } - - /* - * Remove - * dt -> dead - * bitmap updated - * rollback dead dts - * commit bitmap - * commit dts - * commit dir - */ - /* - * Reuse - * search for lowest dead - * update bitmap - * init dt - * remove from dead - * insert into tree - * init INDX - */ - -#if 0 - buffer = ntfs_bmp_get_data (dir->bitmap, 0); - if (!buffer) - return -1; - - utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); - for (i = buf_count-1; i >= 0; i--) { - if (buffer[i]) { - printf ("alloc in use\n"); - return 0; - } - } -#endif - - // /$BITMAP($I30) - // /$INDEX_ALLOCATION($I30) - // $Bitmap - - // Find the highest set bit in the directory bitmap - // can we free any clusters of the alloc? - // if yes, resize attribute - - // Are *any* bits set? - // If not remove ialloc - - return 0; -} - -/** - * ntfs_dir_commit - */ -static int ntfs_dir_commit (struct ntfs_dir *dir) -{ - int i; - - if (!dir) - return 0; - - printf ("commit dir inode %llu\n", dir->inode->mft_no); - if (NInoDirty (dir->inode)) { -#ifdef RM_WRITE - ntfs_inode_sync (dir->inode); -#endif - printf (RED "\tntfs_inode_sync %llu\n" END, dir->inode->mft_no); - } - - if (ntfs_dt_commit (dir->index) < 0) - return -1; - - if (ntfs_bmp_commit (dir->bitmap) < 0) - return -1; - - for (i = 0; i < dir->child_count; i++) { - if (ntfs_dir_commit (dir->children[i]) < 0) - return -1; - } - - return 0; -} - -/** - * ntfs_dir_free - */ -static void ntfs_dir_free (struct ntfs_dir *dir) -{ - struct ntfs_dir *parent; - int i; - - if (!dir) - return; - - ntfs_dir_rollback (dir); - - parent = dir->parent; - if (parent) { - for (i = 0; i < parent->child_count; i++) { - if (parent->children[i] == dir) { - parent->children[i] = NULL; - } - } - } - - ntfs_attr_close (dir->iroot); - ntfs_attr_close (dir->ialloc); - ntfs_inode_close2 (dir->inode); - - ntfs_dt_free (dir->index); - ntfs_bmp_free (dir->bitmap); - - for (i = 0; i < dir->child_count; i++) - ntfs_dir_free (dir->children[i]); - - free (dir->name); - free (dir->children); - free (dir); -} - -/** - * ntfs_dir_create - */ -static struct ntfs_dir * ntfs_dir_create (ntfs_volume *vol, MFT_REF mft_num) -{ - struct ntfs_dir *dir = NULL; - ntfs_inode *inode = NULL; - ATTR_RECORD *rec = NULL; - INDEX_ROOT *ir = NULL; - FILE_NAME_ATTR *name = NULL; - - if (!vol) - return NULL; - - //printf ("ntfs_dir_create %lld\n", MREF (mft_num)); - inode = ntfs_inode_open2 (vol, mft_num); - if (!inode) - return NULL; - - dir = calloc (1, sizeof (*dir)); - if (!dir) { - ntfs_inode_close2 (inode); - return NULL; - } - - dir->inode = inode; - dir->iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); - dir->ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); - - if (!dir->iroot) { - ntfs_dir_free (dir); - return NULL; - } - - dir->vol = vol; - dir->parent = NULL; - dir->name = NULL; - dir->name_len = 0; - dir->index = NULL; - dir->children = NULL; - dir->child_count = 0; - dir->mft_num = mft_num; - - // This may not exist - dir->bitmap = ntfs_bmp_create (inode, AT_BITMAP, I30, 4); - - if (dir->iroot) { - rec = find_first_attribute (AT_INDEX_ROOT, inode->mrec); - ir = (INDEX_ROOT*) ((u8*)rec + rec->value_offset); - dir->index_size = ir->index_block_size; - } else { - // XXX !iroot? - dir->index_size = 0; - } - - // Finally, find the dir's name - rec = find_first_attribute (AT_FILE_NAME, inode->mrec); - name = (FILE_NAME_ATTR*) ((u8*)rec + rec->value_offset); - - dir->name_len = name->file_name_length; - dir->name = malloc (sizeof (ntfschar) * dir->name_len); - memcpy (dir->name, name->file_name, sizeof (ntfschar) * dir->name_len); - - return dir; -} - -/** - * ntfs_dir_add - */ -static void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) -{ - if (!parent || !child) - return; - - parent->child_count++; - //printf ("child count = %d\n", parent->child_count); - parent->children = realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); - child->parent = parent; - - parent->children[parent->child_count-1] = child; -} - -/** - * ntfs_dir_find2 - */ -static struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, int name_len) -{ - int i; - struct ntfs_dir *child = NULL; - struct ntfs_dt *dt = NULL; - int dt_num = 0; - INDEX_ENTRY *ie; - MFT_REF mft_num; - - if (!dir || !name) - return NULL; - - if (!dir->index) { // XXX when will this happen? - printf ("ntfs_dir_find2 - directory has no index\n"); - return NULL; - } - - for (i = 0; i < dir->child_count; i++) { - if (0 == ntfs_names_collate (name, name_len, - dir->children[i]->name, - dir->children[i]->name_len, - 2, IGNORE_CASE, - dir->vol->upcase, - dir->vol->upcase_len)) - return dir->children[i]; - } - - dt = ntfs_dt_find2 (dir->index, name, name_len, &dt_num); - if (!dt) { - printf ("can't find name in dir\n"); - return NULL; - } - - ie = dt->children[dt_num]; - - mft_num = ie->indexed_file; - - child = ntfs_dir_create (dir->vol, mft_num); - if (!child) - return NULL; - - child->index = ntfs_dt_create (child, NULL, -1); - - ntfs_dir_add (dir, child); - - return child; -} - - -/** - * ntfs_volume_commit - */ -static int ntfs_volume_commit (ntfs_volume *vol) -{ - if (!vol) - return -1; - - printf ("commit volume\n"); - if (ntfs_bmp_commit (vol->private_bmp1) < 0) - return -1; - - if (ntfs_bmp_commit (vol->private_bmp2) < 0) - return -1; - - if (ntfs_dir_commit (vol->private_data) < 0) - return -1; - - return 0; -} - -/** - * ntfs_volume_rollback - */ -static int ntfs_volume_rollback (ntfs_volume *vol) -{ - if (!vol) - return -1; - - if (ntfs_bmp_rollback (vol->private_bmp1) < 0) - return -1; - - if (ntfs_bmp_rollback (vol->private_bmp2) < 0) - return -1; - - if (ntfs_dir_rollback (vol->private_data) < 0) - return -1; - - return 0; -} - -/** - * ntfs_volume_umount2 - */ -static int ntfs_volume_umount2 (ntfs_volume *vol, const BOOL force) -{ - struct ntfs_dir *dir; - struct ntfs_bmp *bmp; - - if (!vol) - return 0; - - ntfs_volume_rollback (vol); - - dir = (struct ntfs_dir *) vol->private_data; - vol->private_data = NULL; - ntfs_dir_free (dir); - - bmp = (struct ntfs_bmp *) vol->private_bmp1; - vol->private_bmp1 = NULL; - ntfs_bmp_free (bmp); - - bmp = (struct ntfs_bmp *) vol->private_bmp2; - vol->private_bmp2 = NULL; - ntfs_bmp_free (bmp); - - return ntfs_umount (vol, force); -} - -/** - * ntfs_volume_mount2 - */ -static ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL force) -{ - // XXX can we replace these and search by mft number? Hmm... NO. - // unless I have a recursive search for an MFT number - static ntfschar bmp[8] = { - const_cpu_to_le16('$'), - const_cpu_to_le16('B'), - const_cpu_to_le16('i'), - const_cpu_to_le16('t'), - const_cpu_to_le16('m'), - const_cpu_to_le16('a'), - const_cpu_to_le16('p'), - const_cpu_to_le16(0) - }; - - static ntfschar mft[5] = { - const_cpu_to_le16('$'), - const_cpu_to_le16('M'), - const_cpu_to_le16('F'), - const_cpu_to_le16('T'), - const_cpu_to_le16(0) - }; - - static ntfschar mftmirr[9] = { - const_cpu_to_le16('$'), - const_cpu_to_le16('M'), - const_cpu_to_le16('F'), - const_cpu_to_le16('T'), - const_cpu_to_le16('M'), - const_cpu_to_le16('i'), - const_cpu_to_le16('r'), - const_cpu_to_le16('r'), - const_cpu_to_le16(0) - }; - - static ntfschar dot[2] = { - const_cpu_to_le16('.'), - const_cpu_to_le16(0) - }; - - ntfs_volume *vol; - struct ntfs_dir *dir; - struct ntfs_dt *root; - struct ntfs_dt *found; - int num; - - vol = utils_mount_volume (device, flags, force); - if (!vol) - return NULL; - - vol->lcnbmp_ni ->ref_count = 1; - vol->mft_ni ->ref_count = 1; - vol->mftmirr_ni->ref_count = 1; - - vol->lcnbmp_ni ->private_data = NULL; - vol->mft_ni ->private_data = NULL; - vol->mftmirr_ni->private_data = NULL; - - dir = ntfs_dir_create (vol, FILE_root); - if (!dir) { - ntfs_volume_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - - dir->index = ntfs_dt_create (dir, NULL, -1); - - root = dir->index; - - //$Bitmap - num = -1; - found = ntfs_dt_find2 (root, bmp, sizeof (bmp) - 1, &num); - if ((!found) || (num < 0)) { - printf ("can't find $Bitmap\n"); - ntfs_volume_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - vol->lcnbmp_ni->ref_count++; - vol->lcnbmp_ni->private_data = found->dir; - found->inodes[num] = vol->lcnbmp_ni; - - //$MFT - num = -1; - found = ntfs_dt_find2 (root, mft, sizeof (mft) - 1, &num); - if ((!found) || (num < 0)) { - printf ("can't find $MFT\n"); - ntfs_volume_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - vol->mft_ni->ref_count++; - vol->mft_ni->private_data = found->dir; - found->inodes[num] = vol->mft_ni; - - //$MFTMirr - num = -1; - found = ntfs_dt_find2 (root, mftmirr, sizeof (mftmirr) - 1, &num); - if ((!found) || (num < 0)) { - printf ("can't find $MFTMirr\n"); - ntfs_volume_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - vol->mftmirr_ni->ref_count++; - vol->mftmirr_ni->private_data = found->dir; - found->inodes[num] = vol->mftmirr_ni; - - // root directory - num = -1; - found = ntfs_dt_find2 (root, dot, 1, &num); - if ((!found) || (num < 0)) { - printf ("can't find the root directory\n"); - ntfs_volume_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - - vol->private_data = found->dir; - found->inodes[num] = dir->inode; - dir->inode->private_data = found; - dir->inode->ref_count = 2; - - vol->private_bmp1 = ntfs_bmp_create (vol->mft_ni, AT_BITMAP, NULL, 0); - vol->private_bmp2 = ntfs_bmp_create (vol->lcnbmp_ni, AT_DATA, NULL, 0); - - if (!vol->private_bmp1 || !vol->private_bmp2) { - printf ("can't find the bitmaps\n"); - ntfs_volume_umount2 (vol, FALSE); - vol = NULL; - goto done; - } - -done: - return vol; -} - /** * utils_pathname_to_inode2 */ diff --git a/ntfsprogs/ntfsrm.h b/ntfsprogs/ntfsrm.h index cd1186e0..c37e55b8 100644 --- a/ntfsprogs/ntfsrm.h +++ b/ntfsprogs/ntfsrm.h @@ -1,7 +1,7 @@ /* * ntfsrm - Part of the Linux-NTFS project. * - * Copyright (c) 2004 Richard Russon + * Copyright (c) 2004-2005 Richard Russon * * This utility will delete files from an NTFS volume. * @@ -26,6 +26,11 @@ #include "types.h" #include "layout.h" +#include "volume.h" +#include "inode.h" + +struct ntfs_dir; +struct ntfs_dt; /** * struct options @@ -42,54 +47,6 @@ struct options { int nodirty; /* Do not mark volume dirty */ }; -/** - * struct ntfs_bmp - * a cache for either dir/$BITMAP, $MFT/$BITMAP or $Bitmap/$DATA - */ -struct ntfs_bmp { - ntfs_volume *vol; - ntfs_attr *attr; - int count; - u8 **data; - VCN *data_vcn; -}; - -/** - * struct ntfs_dt - */ -struct ntfs_dt { - struct ntfs_dir *dir; - struct ntfs_dt *parent; - u8 *data; - int data_len; - int child_count; - INDEX_ENTRY **children; - struct ntfs_dt **sub_nodes; - ntfs_inode **inodes; - VCN vcn; - INDEX_HEADER *header; - BOOL changed; -}; - -/** - * struct ntfs_dir - */ -struct ntfs_dir { - ntfs_volume *vol; - struct ntfs_dir *parent; - ntfschar *name; - int name_len; - MFT_REF mft_num; - struct ntfs_dt *index; - struct ntfs_dir **children; - int child_count; - struct ntfs_bmp *bitmap; - ntfs_inode *inode; - ntfs_attr *iroot; - ntfs_attr *ialloc; - int index_size; -}; - /** * struct ntfs_find */ @@ -102,18 +59,5 @@ struct ntfs_find { }; -#define RED "" -#define GREEN "" -#define YELLOW "" -#define BLUE "" -#define MAGENTA "" -#define CYAN "" -#define BOLD "" -#define END "" - -#define ROUND_UP(num,bound) (((num)+((bound)-1)) & ~((bound)-1)) -#define ROUND_DOWN(num,bound) ((num) & ~((bound)-1)) -#define ATTR_SIZE(s) ROUND_UP(s,8) - #endif /* _NTFSRM_H_ */ diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 88981d54..fd409371 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -97,6 +97,7 @@ int utils_set_locale (void) } } +#ifndef NTFS_RICH /** * utils_valid_device - Perform some safety checks on the device, before we start * @name: Full pathname of the device/file to work with @@ -206,6 +207,7 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL return vol; } +#endif /** * utils_parse_size - Convert a string representing a size * @value: String to be parsed @@ -327,6 +329,7 @@ int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale) return 1; } +#ifndef NTFS_RICH /** * find_attribute - Find an attribute of the given type * @type: An attribute type, e.g. AT_FILE_NAME @@ -396,6 +399,7 @@ ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) return rec; } +#endif /** * utils_inode_get_name * diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 3aaa11bf..e6490961 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -1,7 +1,7 @@ /* * utils.h - Part of the Linux-NTFS project. * - * Copyright (c) 2002-2003 Richard Russon + * Copyright (c) 2002-2005 Richard Russon * Copyright (c) 2004 Anton Altaparmakov * * A set of shared functions for ntfs utilities @@ -77,9 +77,7 @@ extern DEC_PRINTF(Eprintf) extern DEC_PRINTF(Vprintf) extern DEC_PRINTF(Qprintf) -int utils_valid_device (const char *name, int force); int utils_set_locale (void); -ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force); int utils_parse_size (const char *value, s64 *size, BOOL scale); int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale); int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize); @@ -89,8 +87,15 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref); int utils_is_metadata (ntfs_inode *inode); void utils_dump_mem (void *buf, int start, int length, int ascii); +#ifndef _RICH_H_ ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft); +#endif + +#if !(defined (_NTFS_VOLUME_H) && defined (NTFS_RICH)) +int utils_valid_device (const char *name, int force); +ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force); +#endif /** * defines... @@ -131,4 +136,27 @@ int mft_next_record (struct mft_search_ctx *ctx); #define DM_BLUE (1 << 5) #define DM_BOLD (1 << 6) +#ifdef NTFS_RICH + +#include "layout.h" +#include "volume.h" +#include "inode.h" +#include "bitmap.h" +#include "dir.h" + +#define RED "\e[31m" +#define GREEN "\e[32m" +#define YELLOW "\e[33m" +#define BLUE "\e[34m" +#define MAGENTA "\e[35m" +#define CYAN "\e[36m" +#define BOLD "\e[01m" +#define END "\e[0m" + +#define ROUND_UP(num,bound) (((num)+((bound)-1)) & ~((bound)-1)) +#define ROUND_DOWN(num,bound) ((num) & ~((bound)-1)) +#define ATTR_SIZE(s) ROUND_UP(s,8) + +#endif /* NTFS_RICH */ + #endif /* _NTFS_UTILS_H_ */ From ea2c4c6c61323631a642bc601917ec326909ebda Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 17 Oct 2005 14:07:28 +0000 Subject: [PATCH 2610/2994] fix build warning - duplicate definition --- ntfsprogs/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index e6490961..40b50e6a 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -87,7 +87,7 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref); int utils_is_metadata (ntfs_inode *inode); void utils_dump_mem (void *buf, int start, int length, int ascii); -#ifndef _RICH_H_ +#ifndef _NTFS_RICH_H_ ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft); #endif From fe408380c70b8167936410a176ffcb7855e8a052 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 17 Oct 2005 20:21:22 +0000 Subject: [PATCH 2611/2994] typo fix --- ntfsprogs/ntfsmount.8.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 2a1cc713..dcb35c28 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -29,7 +29,7 @@ is recommended, but not mandatory. * List/Read/Write/Add/Remove named data streams. .TP -.B Partly implented features: +.B Partly implemented features: * Create/Delete/Move files and directories. From a7fd01e543a62409f1050c07b93cb05fd444d092 Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 19 Oct 2005 08:13:44 +0000 Subject: [PATCH 2612/2994] $EA can be resident and non-resident. Fix libntfs/attrib.c:: ntfs_attr_can_be_resident() apropriately. (Anton) --- ChangeLog | 2 ++ libntfs/attrib.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 84f8699d..be3258ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,8 @@ xx/xx/2005 - 1.12.2-WIP - Fix endianness bug in libntfs/index.c. (Anton) - ntfsresize: check and report bad sectors before cluster allocation check because chkdsk doesn't fix $Bitmap with bad sectors. (Szaka) + - $EA can be resident and non-resident. Fix libntfs/attrib.c:: + ntfs_attr_can_be_resident() apropriately. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 704c7312..3a8b4d26 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2446,7 +2446,7 @@ int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type) errno = EINVAL; return -1; } - if (type != AT_INDEX_ALLOCATION && type != AT_EA) + if (type != AT_INDEX_ALLOCATION) return 0; errno = EPERM; return -1; From 8f03f5a6cade74a15bf6d97285c6acb6961ed419 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 19 Oct 2005 22:04:46 +0000 Subject: [PATCH 2613/2994] Optionally create NTFS version 3.0 (W2K) or 3.1 (XP, W2K3, Vista). Contributed by Erik Sornes. No side-effect for v1.2 NTFS which is still the default. The implementation needs some minor work: see e.g. the chkdsk messages and the result of ntfscmp'ing the two images. --- ChangeLog | 2 + include/ntfs/dir.h | 8 +- include/ntfs/layout.h | 25 + include/ntfs/security.h | 1 + libntfs/dir.c | 13 +- libntfs/security.c | 23 + ntfsprogs/attrdef.c | 94 ++++ ntfsprogs/mkntfs.c | 1109 ++++++++++++++++++++++++++++++++++---- ntfsprogs/sd.c | 1118 ++++++++++++++++++++++++++++++++++++++- 9 files changed, 2279 insertions(+), 114 deletions(-) diff --git a/ChangeLog b/ChangeLog index be3258ff..f82bac96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,8 @@ xx/xx/2005 - 1.12.2-WIP check because chkdsk doesn't fix $Bitmap with bad sectors. (Szaka) - $EA can be resident and non-resident. Fix libntfs/attrib.c:: ntfs_attr_can_be_resident() apropriately. (Anton) + - mkntfs: optionally create NTFS version 3.0 (W2K) or 3.1 (XP, W2K3, + Vista). (Implementation by Erik Sornes, adaption by Szaka) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index e6a65930..813f0e9e 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -32,8 +32,14 @@ #define MAX_PATH 1024 #endif -/* The little endian Unicode string $I30 as a global constant. */ +/* The little endian Unicode strings $I30, $SII, $SDH, $O, $Q + * as a global constant. + */ extern ntfschar I30[5]; +extern ntfschar SII[5]; +extern ntfschar SDH[5]; +extern ntfschar O[3]; +extern ntfschar Q[3]; extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname, const int uname_len); diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 3e625001..073e1ae7 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -241,10 +241,15 @@ typedef enum { /* * These are the so far known MFT_RECORD_* flags (16-bit) which contain * information about the mft record in which they are present. + * _4 and _8 are needed by $Extend sub-files (don't know what to + * call them yet...) */ + typedef enum { MFT_RECORD_IN_USE = const_cpu_to_le16(0x0001), MFT_RECORD_IS_DIRECTORY = const_cpu_to_le16(0x0002), + MFT_RECORD_IS_4 = const_cpu_to_le16(0x0004), + MFT_RECORD_IS_8 = const_cpu_to_le16(0x0008), MFT_REC_SPACE_FILLER = 0xffff /* Just to make flags 16-bit. */ } __attribute__ ((__packed__)) MFT_RECORD_FLAGS; @@ -1822,6 +1827,25 @@ typedef struct { u32 length; /* Size in bytes of this entry in $SDS stream. */ } __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_HEADER; +typedef struct { + u32 hash; /* Hash of the security descriptor. */ + u32 security_id; /* The security_id assigned to the descriptor. */ + u64 offset_in_sds; /* Offset of the descriptor in SDS data stream */ + u32 size_in_sds; /* Size of the descriptor in SDS data stream */ + u64 reserved_II; /* Padding - always unicode "II" */ +} __attribute__ ((__packed__)) SDH_INDEX_DATA; + +typedef struct { + u32 hash; /* Hash of the security descriptor. */ + u32 security_id; /* The security_id assigned to the descriptor. */ + u64 offset_in_sds; /* Offset of the descriptor in SDS data stream */ + u32 size_in_sds; /* Size of the descriptor in SDS data stream */ +} __attribute__ ((__packed__)) SII_INDEX_DATA; + +typedef struct { + u64 owner_id; +} __attribute__ ((__packed__)) QUOTA_O_INDEX_DATA; + /* * The $SDS data stream contains the security descriptors, aligned on 16-byte * boundaries, sorted by security_id in a B+ tree. Security descriptors cannot @@ -2211,6 +2235,7 @@ typedef struct { control entry in the data part of the index. */ } __attribute__ ((__packed__)) key; + /* The (optional) index data is inserted here when creating. */ // VCN vcn; /* If INDEX_ENTRY_NODE bit in flags is set, the last // eight bytes of this index entry contain the virtual diff --git a/include/ntfs/security.h b/include/ntfs/security.h index 1eac550a..3a579d97 100644 --- a/include/ntfs/security.h +++ b/include/ntfs/security.h @@ -50,5 +50,6 @@ static __inline__ BOOL ntfs_sid_is_valid(const SID *sid) extern int ntfs_sid_to_mbs_size(const SID *sid); extern char *ntfs_sid_to_mbs(const SID *sid, char *sid_str, size_t sid_str_size); +extern GUID *generate_guid(GUID *guid); #endif /* defined _NTFS_SECURITY_H */ diff --git a/libntfs/dir.c b/libntfs/dir.c index 88c517b0..4866e6d9 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -45,11 +45,22 @@ #include "lcnalloc.h" /* - * The little endian Unicode string "$I30" as a global constant. + * The little endian Unicode strings "$I30", "$SII", "$SDH", "$O" + * and "$Q" as global constants. */ ntfschar I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'), const_cpu_to_le16('3'), const_cpu_to_le16('0'), const_cpu_to_le16('\0') }; +ntfschar SII[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'), + const_cpu_to_le16('I'), const_cpu_to_le16('I'), + const_cpu_to_le16('\0') }; +ntfschar SDH[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'), + const_cpu_to_le16('D'), const_cpu_to_le16('H'), + const_cpu_to_le16('\0') }; +ntfschar O[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('O'), + const_cpu_to_le16('\0') }; +ntfschar Q[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('Q'), + const_cpu_to_le16('\0') }; /** * ntfs_inode_lookup_by_name - find an inode in a directory given its name diff --git a/libntfs/security.c b/libntfs/security.c index 64f228a8..fec170ef 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -248,3 +248,26 @@ err_out: errno = i; return NULL; } + +/* + * GUID generate_guid(GUID *guid) + * generatates a random current guid + * perhaps not a very good random number generator though... + */ + +GUID *generate_guid(GUID *guid) { + + int i; + static u8 array[16]; + + for (i = 0; i < 16; i++) { + array[i] = (u8)(random() & 0xFF); + if (i == 7) + array[7] = (array[7] & 0x0F) | 0x40; + if (i == 8) + array[8] = (array[8] & 0x3F) | 0x80; + } + memcpy(guid, array, sizeof(guid)); + return guid; +} + diff --git a/ntfsprogs/attrdef.c b/ntfsprogs/attrdef.c index c9bb82c6..c55a8d5f 100644 --- a/ntfsprogs/attrdef.c +++ b/ntfsprogs/attrdef.c @@ -151,3 +151,97 @@ const unsigned char attrdef_ntfs12_array[2400] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +const unsigned char attrdef_ntfs3x_array[2560] = { + + 0x24, 0x00, 0x53, 0x00, 0x54, 0x00, 0x41, 0x00, 0x4E, 0x00, 0x44, 0x00 +, 0x41, 0x00, 0x52, 0x00, 0x44, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x52, 0x00, 0x4D, 0x00, 0x41, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4F, 0x00 +, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x41, 0x00, 0x54, 0x00, 0x54, 0x00, 0x52, 0x00, 0x49, 0x00, 0x42, 0x00, 0x55, 0x00, 0x54, 0x00, 0x45, 0x00 +, 0x5F, 0x00, 0x4C, 0x00, 0x49, 0x00, 0x53, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +, 0x24, 0x00, 0x46, 0x00, 0x49, 0x00, 0x4C, 0x00, 0x45, 0x00, 0x5F, 0x00, 0x4E, 0x00, 0x41, 0x00, 0x4D, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x42, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x4F, 0x00, 0x42, 0x00, 0x4A, 0x00 +, 0x45, 0x00, 0x43, 0x00, 0x54, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x53, 0x00, 0x45, 0x00, 0x43, 0x00, 0x55, 0x00, 0x52, 0x00, 0x49, 0x00, 0x54, 0x00 +, 0x59, 0x00, 0x5F, 0x00, 0x44, 0x00, 0x45, 0x00, 0x53, 0x00, 0x43, 0x00, 0x52, 0x00, 0x49, 0x00, 0x50, 0x00, 0x54, 0x00, 0x4F, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF +, 0xFF, 0xFF, 0xFF, 0xFF, 0x24, 0x00, 0x56, 0x00, 0x4F, 0x00, 0x4C, 0x00, 0x55, 0x00, 0x4D, 0x00, 0x45, 0x00, 0x5F, 0x00, 0x4E, 0x00, 0x41, 0x00, 0x4D, 0x00, 0x45, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x56, 0x00 +, 0x4F, 0x00, 0x4C, 0x00, 0x55, 0x00, 0x4D, 0x00, 0x45, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x52, 0x00, 0x4D, 0x00, 0x41, 0x00, 0x54, 0x00 +, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 +, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x44, 0x00, 0x41, 0x00, 0x54, 0x00, 0x41, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x24, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x44, 0x00, 0x45, 0x00, 0x58, 0x00, 0x5F, 0x00, 0x52, 0x00, 0x4F, 0x00, 0x4F, 0x00 +, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +, 0x24, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x44, 0x00, 0x45, 0x00, 0x58, 0x00, 0x5F, 0x00, 0x41, 0x00, 0x4C, 0x00, 0x4C, 0x00, 0x4F, 0x00, 0x43, 0x00, 0x41, 0x00, 0x54, 0x00 +, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x24, 0x00, 0x42, 0x00, 0x49, 0x00, 0x54, 0x00 +, 0x4D, 0x00, 0x41, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x24, 0x00, 0x52, 0x00, 0x45, 0x00, 0x50, 0x00, 0x41, 0x00, 0x52, 0x00, 0x53, 0x00, 0x45, 0x00 +, 0x5F, 0x00, 0x50, 0x00, 0x4F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x45, 0x00, 0x41, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x52, 0x00, 0x4D, 0x00, 0x41, 0x00, 0x54, 0x00 +, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x45, 0x00 +, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x4C, 0x00, 0x4F, 0x00, 0x47, 0x00, 0x47, 0x00, 0x45, 0x00 +, 0x44, 0x00, 0x5F, 0x00, 0x55, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4C, 0x00, 0x49, 0x00, 0x54, 0x00, 0x59, 0x00, 0x5F, 0x00, 0x53, 0x00, 0x54, 0x00, 0x52, 0x00, 0x45, 0x00 +, 0x41, 0x00, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + +}; diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 8293c71d..14c66ccf 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3,8 +3,10 @@ * * Copyright (c) 2000-2005 Anton Altaparmakov * Copyright (c) 2001-2003 Richard Russon + * Copyright (c) 2002-2005 Szabolcs Szakacsits + * Copyright (c) 2005 Erik Sornes * - * This utility will create an NTFS 1.2 (Windows NT 4.0) volume on a user + * This utility will create an NTFS 1.2, 3.0 or 3.1 volume on a user * specified (block) device. * * Some things (option handling and determination of mount status) have been @@ -44,7 +46,7 @@ #include "config.h" -#ifdef HAVE_UNISTD_H +#ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_STDLIB_H @@ -126,6 +128,7 @@ # define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytes. */ #endif +#include "security.h" #include "types.h" #include "attrib.h" #include "bitmap.h" @@ -146,9 +149,13 @@ switch if you want to be able to build the NTFS utilities." #endif extern const unsigned char attrdef_ntfs12_array[2400]; +extern const unsigned char attrdef_ntfs3x_array[2560]; extern const unsigned char boot_array[3429]; extern void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len); extern void init_upcase_table(ntfschar *uc, u32 uc_len); +extern void init_secure_30(char *idx_secure); +extern void init_secure_31(char *idx_secure); +extern void init_root_sd_31(u8 **sd_val, int *sd_val_len); /* Page size on ia32. Can change to 8192 on Alpha. */ #define NTFS_PAGE_SIZE 4096 @@ -159,10 +166,15 @@ const char *EXEC_NAME = "mkntfs"; u8 *buf = NULL; u8 *buf2 = NULL; int buf2_size = 0; +char *buf_sds = NULL; +char *buf_sds_init = NULL; +int buf_sds_size = 0; +int buf_sds_first_size; int mft_bitmap_size, mft_bitmap_byte_size; u8 *mft_bitmap = NULL; int lcn_bitmap_byte_size; u8 *lcn_bitmap = NULL; +OBJECT_ID_ATTR *volume_obj_id; runlist *rl_mft = NULL, *rl_mft_bmp = NULL, *rl_mftmirr = NULL; runlist *rl_logfile = NULL, *rl_boot = NULL, *rl_bad = NULL, *rl_index; INDEX_ALLOCATION *index_block = NULL; @@ -331,7 +343,8 @@ static void usage(void) " -q Quiet execution\n" " -v Verbose execution\n" " -vv Very verbose execution\n" - " -V Display version " + " -V Display version \n" + " -w NTFS version " "information\n" " -l Display licensing " "information\n" @@ -352,13 +365,13 @@ static void parse_options(int argc, char *argv[]) unsigned long u; char *s; -// Need to have: mft record size, index record size, ntfs version, mft size, +// Need to have: mft record size, index record size, mft size, // logfile size, list of bad blocks, check for bad blocks, ... if (argc && *argv) EXEC_NAME = *argv; fprintf(stderr, "%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - while ((c = getopt(argc, argv, "c:fH:h?np:qS:s:vz:CFTIL:QVl")) != EOF) + while ((c = getopt(argc, argv, "c:fH:h?np:qS:s:vz:CFTIL:QVlw:")) != EOF) switch (c) { case 'n': opts.no_action = 1; @@ -404,6 +417,35 @@ static void parse_options(int argc, char *argv[]) case 'v': opts.verbose++; break; + case 'w': + if (!strcmp(optarg , "1.2")) { + vol->major_ver = 1; + vol->minor_ver = 2; + opts.attr_defs = + (ATTR_DEF*)&attrdef_ntfs12_array; + opts.attr_defs_len = + sizeof(attrdef_ntfs12_array); + break; + } + if (!strcmp(optarg , "3.0")) { + vol->major_ver = 3; + vol->minor_ver = 0; + opts.attr_defs = + (ATTR_DEF*)&attrdef_ntfs3x_array; + opts.attr_defs_len = + sizeof(attrdef_ntfs3x_array); + break; + } + if (!strcmp(optarg , "3.1")) { + vol->major_ver = 3; + vol->minor_ver = 1; + opts.attr_defs = + (ATTR_DEF*)&attrdef_ntfs3x_array; + opts.attr_defs_len = + sizeof(attrdef_ntfs3x_array); + break; + } + err_exit("Ntfs version not supported.\n"); case 'z': l = strtol(optarg, &s, 0); if (l < 1 || l > 4 || *s) @@ -532,7 +574,7 @@ static __inline__ long long mkntfs_write(struct ntfs_device *dev, */ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, const u8 *val, const s64 val_len, s64 *inited_size) -{ +{ s64 bytes_written, total, length, delta; int retry, i; @@ -1962,10 +2004,13 @@ err_out: * add_attr_std_info * Return 0 on success or -errno on error. */ -static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) +static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags, + u32 security_id) { STANDARD_INFORMATION si; - int err; + int err, sd_size; + + sd_size = 48; si.creation_time = utc2ntfs(mkntfs_time()); si.last_data_change_time = si.creation_time; @@ -1978,18 +2023,18 @@ static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags) si.maximum_versions = cpu_to_le32(0); si.version_number = cpu_to_le32(0); si.class_id = cpu_to_le32(0); - /* FIXME: $Secure support... */ - si.security_id = cpu_to_le32(0); + si.security_id = security_id; + if (si.security_id != 0) + sd_size = 72; /* FIXME: $Quota support... */ si.owner_id = cpu_to_le32(0); si.quota_charged = cpu_to_le64(0ULL); - /* FIXME: $UsnJrnl support... */ + /* FIXME: $UsnJrnl support... Not needed on fresh w2k3-volume */ si.usn = cpu_to_le64(0ULL); } - /* NTFS 1.2: size of si = 48, NTFS 3.0: size of si = 72 */ + /* NTFS 1.2: size of si = 48, NTFS 3.[01]: size of si = 72 */ err = insert_resident_attr_in_mft_record(m, AT_STANDARD_INFORMATION, - NULL, 0, 0, 0, 0, (u8*)&si, - vol->major_ver < 3 ? 48 : 72); + NULL, 0, 0, 0, 0, (u8*)&si, sd_size); if (err < 0) Eprintf("add_attr_std_info failed: %s\n", strerror(-err)); return err; @@ -2075,6 +2120,33 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, return i; } +/** + * add_attr_object_id + * add an object_id attribute to the mft record @m + * return 0 on success or -errno on error + */ + +static int add_attr_object_id(MFT_RECORD *m, OBJECT_ID_ATTR *objid_attr, + int objid_attr_len) +{ + int err; + + /* Does it fit? NO: create non-resident. YES: create resident. */ + if (le32_to_cpu(m->bytes_in_use) + 24 + objid_attr_len > + le32_to_cpu(m->bytes_allocated)) + err = insert_non_resident_attr_in_mft_record(m, + AT_OBJECT_ID, NULL, 0, 0, 0, (char*)objid_attr, + objid_attr_len); + else + err = insert_resident_attr_in_mft_record(m, + AT_OBJECT_ID, NULL, 0, 0, 0, 0, + (char*)objid_attr, objid_attr_len); + if (err < 0) + Eprintf("add_attr_volume_id failed: %s\n", strerror(-err)); + return err; + +} + /** * add_attr_sd * Create the security descriptor attribute adding the security descriptor @sd @@ -2583,6 +2655,434 @@ static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *idx, return 0; } +/* + * ntfs_index_keys_compare(char *key1, char *key2, + * COLLATION_RULES *collation_rule) + * not alle types of COLLATION_RULES supported yet... + * added as needed.. (remove this comment when all is added) + */ + +static int ntfs_index_keys_compare(char *key1, char *key2, + int key1_length,int key2_length, + COLLATION_RULES collation_rule) { + + int i, j; + + i=j=0; + + if (collation_rule == COLLATION_NTOFS_ULONG) { +//i.e. $SII or $QUOTA-$Q + while ((j < min(key1_length, key2_length)) && (i == 0)) { + if (*(u32*)(key1 + j) < *(u32*)(key2 + j)) i = -1; + if (*(u32*)(key1 + j) > *(u32*)(key2 + j)) i = +1; + if (*(u32*)(key1 + j) == *(u32*)(key2 + j)) { + i = 0; + j += 4; + } + } + if ((i == 0) && (key1_length > key2_length)) i = -1; + if ((i == 0) && (key1_length < key2_length)) i = +1; + + return i; + } + + if (collation_rule == COLLATION_NTOFS_ULONGS) { +//i.e $OBJID-$O + while ((j < min(key1_length, key2_length)) && (i == 0)) { + if (bswap_32(*(u32*)(key1 + j)) < + bswap_32(*(u32*)(key1 + j))) i = -1; + if (bswap_32(*(u32*)(key1 + j)) > + bswap_32(*(u32*)(key1 + j))) i = +1; + if (bswap_32(*(u32*)(key1 + j)) == + bswap_32(*(u32*)(key1 + j))) { + i = 0; + j += 4; + } + } + if ((i == 0) && (key1_length > key2_length)) i = -1; + if ((i == 0) && (key1_length < key2_length)) i = +1; + + return i; + } + if (collation_rule == COLLATION_NTOFS_SECURITY_HASH) { +//i.e. $SDH + if (((SDH_INDEX_KEY*)key1)->hash < + ((SDH_INDEX_KEY*)key2)->hash) i = -1; + if (((SDH_INDEX_KEY*)key1)->hash > + ((SDH_INDEX_KEY*)key2)->hash) i = +1; + if (((SDH_INDEX_KEY*)key1)->hash == + ((SDH_INDEX_KEY*)key2)->hash) { + if (((SDH_INDEX_KEY*)key1)->security_id < + ((SDH_INDEX_KEY*)key2)->security_id) i = -1; + if (((SDH_INDEX_KEY*)key1)->security_id > + ((SDH_INDEX_KEY*)key2)->security_id) i = +1; + if (((SDH_INDEX_KEY*)key1)->security_id == + ((SDH_INDEX_KEY*)key2)->security_id) i = 0; + } + return i; + } + if (collation_rule == COLLATION_NTOFS_SID ) { +//i.e. $QUOTA-O + i = memcmp(key1, key2, min(key1_length, key2_length)); + if ((i == 0) && (key1_length > key2_length)) i = -1; + if ((i == 0) && (key1_length < key2_length)) i = +1; + + return i; + } + err_exit("ntfs_index_keys_compare called without supported " + "collation rule.\n"); +} + +/** + * insert_index_entry_in_res_dir_index + * i.e. insert an index_entry in some named index_root + * simplified search method, works for mkntfs + */ + +static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, + u32 idx_size, MFT_RECORD *m, ntfschar *name, u32 name_size, + ATTR_TYPES type) +{ + ntfs_attr_search_ctx *ctx; + INDEX_HEADER *idx_header; + INDEX_ENTRY *idx_entry, *idx_end; + ATTR_RECORD *a; + COLLATION_RULES collation_rule; + int err, i; + + err = 0; + /* does it fit ?*/ + if ( vol->mft_record_size > idx_size + m->bytes_allocated ) + return -ENOSPC; + + /* find the INDEX_ROOT attribute:*/ + ctx = ntfs_attr_get_search_ctx(NULL, m); + if (!ctx) { + Eprintf("Failed to allocate attribute search context.\n"); + err = -ENOMEM; + goto err_out; + } + if (ntfs_attr_lookup(AT_INDEX_ROOT, name, name_size, 0, 0, + NULL, 0, ctx)) { + err = EEXIST; + goto err_out; + } + /* found attribute */ + a = (ATTR_RECORD*)ctx->attr; + collation_rule = ((INDEX_ROOT*)((char*)a + + le16_to_cpu(a->value_offset)))->collation_rule; + idx_header = (INDEX_HEADER*)((char*)a + le16_to_cpu(a->value_offset) + + le16_to_cpu(0x10)); + idx_entry = (INDEX_ENTRY*)((char*)idx_header + + le16_to_cpu((idx_header)->entries_offset)); + idx_end = (INDEX_ENTRY*)((char*)idx_entry + + le32_to_cpu(idx_header->index_length)); + /* + * Loop until we exceed valid memory (corruption case) or until we + * reach the last entry. + */ + + if (type == AT_FILE_NAME) { + while ((char*)idx_entry < (char*)idx_end && + !(idx_entry->flags & INDEX_ENTRY_END)) { + i = ntfs_file_values_compare( + (FILE_NAME_ATTR*)&idx->key.file_name, + (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, + IGNORE_CASE, vol->upcase, vol->upcase_len); + /* + * If @file_name collates before ie->key.file_name, + * there is no + * matching index entry. + */ + if (i == -1) + break; + /* If file names are not equal, continue search. */ + if (i) + goto do_next; + if (((FILE_NAME_ATTR*)&idx->key.file_name)->\ + file_name_type != FILE_NAME_POSIX || + idx_entry->key.file_name.file_name_type + != FILE_NAME_POSIX) + return -EEXIST; + + i = ntfs_file_values_compare((FILE_NAME_ATTR*)&idx-> + key.file_name, + (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, + CASE_SENSITIVE, vol->upcase, vol->upcase_len); + if (i == -1) + break; + /* Complete match. Bugger. Can't insert. */ + /*if (!i) + return -EEXIST; + */ +do_next: + idx_entry = (INDEX_ENTRY*)((char*)idx_entry + + le16_to_cpu(idx_entry->length)); + } + } else if (type == AT_UNUSED) { // case view + while ((char*)idx_entry < (char*)idx_end && !(idx_entry->flags + & INDEX_ENTRY_END)) { + i = ntfs_index_keys_compare((char*)idx_entry + 0x10, + (char*)idx + 0x10, + idx_entry->key_length, idx->key_length, collation_rule); + if (!i) { + return -EEXIST; + } + if (i == 1) + break; + idx_entry = (INDEX_ENTRY*)((char*)idx_entry + + le16_to_cpu(idx_entry->length)); + } + } else return EINVAL; + + memmove((char*)idx_entry + idx_size, (char*)idx_entry, + (char*)m + vol->mft_record_size - + ((char*)idx_entry + idx_size)); + memcpy((char*)idx_entry, (char*)idx, idx_size); + // adjusting various offsets etc... + m->bytes_in_use += idx_size; + a->length += idx_size; + a->value_length += idx_size; + ((INDEX_HEADER*)idx_header)->index_length += idx_size; + ((INDEX_HEADER*)idx_header)->allocated_size += idx_size; + +err_out: + if (ctx) + ntfs_attr_put_search_ctx(ctx); + return err; +} + +/** + * intialize_secure + * initializes $Secure's $SDH and $SII indexes from $SDS datastream + */ + +static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) { + + int err, sdh_size, sii_size; + SECURITY_DESCRIPTOR_HEADER *sds_header; + INDEX_ENTRY *idx_entry_sdh, *idx_entry_sii; + SDH_INDEX_DATA *sdh_data; + SII_INDEX_DATA *sii_data; + + sds_header = (SECURITY_DESCRIPTOR_HEADER*)sds; + sdh_size = cpu_to_le32(0x30); + sii_size = cpu_to_le32(0x28); + idx_entry_sdh = (INDEX_ENTRY*)calloc(1, sizeof(INDEX_ENTRY)); + idx_entry_sii = (INDEX_ENTRY*)calloc(1, sizeof(INDEX_ENTRY)); + err = 0; + + while ( (char*)sds_header < (char*)sds + sds_size) { + //SDH index entry + idx_entry_sdh->data_offset = cpu_to_le16(0x18); + idx_entry_sdh->data_length = cpu_to_le16(0x14); + idx_entry_sdh->reservedV = cpu_to_le32(0x00); + idx_entry_sdh->length = cpu_to_le16(0x30); + idx_entry_sdh->key_length = cpu_to_le16(0x08); + idx_entry_sdh->flags = cpu_to_le16(0x00); + idx_entry_sdh->reserved = cpu_to_le16(0x00); + idx_entry_sdh->key.sdh.hash = sds_header->hash; + idx_entry_sdh->key.sdh.security_id = sds_header->security_id; + sdh_data = (SDH_INDEX_DATA*)((char*)idx_entry_sdh + + idx_entry_sdh->data_offset); + sdh_data->hash = sds_header->hash; + sdh_data->security_id = sds_header->security_id; + + sdh_data->offset_in_sds = sds_header->offset; + + sdh_data->size_in_sds = sds_header->length; + sdh_data->reserved_II = cpu_to_le64(0x00490049); + + //SII index entry + idx_entry_sii->data_offset = cpu_to_le16(0x14); + idx_entry_sii->data_length = cpu_to_le16(0x14); + idx_entry_sii->reservedV = cpu_to_le32(0x00); + idx_entry_sii->length = cpu_to_le16(0x28); + idx_entry_sii->key_length = cpu_to_le16(0x04); + idx_entry_sii->flags = cpu_to_le16(0x00); + idx_entry_sii->reserved = cpu_to_le16(0x00); + idx_entry_sii->key.sii.security_id = sds_header->security_id; + sii_data = (SII_INDEX_DATA*)((char*)idx_entry_sii + + idx_entry_sii->data_offset); + sii_data->hash = sds_header->hash; + sii_data->security_id = sds_header->security_id; + sii_data->offset_in_sds = sds_header->offset; + sii_data->size_in_sds = sds_header->length; + if ((err = insert_index_entry_in_res_dir_index(idx_entry_sdh, + sdh_size, m, + SDH, 4, AT_UNUSED))) + break; + + if ((err = insert_index_entry_in_res_dir_index(idx_entry_sii, + sii_size, m, + SII, 4, AT_UNUSED))) + break; + sds_header = (SECURITY_DESCRIPTOR_HEADER*)((char*)sds_header + + (cpu_to_le32(sds_header->length + 0x0F) & + ~cpu_to_le32(0x0F))); + if (!sds_header->length) + break; + } + + if(idx_entry_sdh) free(idx_entry_sdh); + if(idx_entry_sii) free(idx_entry_sii); + + return err; +} + +/* + * initialize_quota(MFT_RECORD *m) + * initialize $Quota with the default quota index-entries. + */ + +static int initialize_quota(MFT_RECORD *m) { + + int o_size, q1_size, q2_size, err; + INDEX_ENTRY *idx_entry_o, *idx_entry_q1, *idx_entry_q2; + QUOTA_O_INDEX_DATA *idx_entry_o_data; + QUOTA_CONTROL_ENTRY *idx_entry_q1_data, *idx_entry_q2_data; + err = 0; + o_size = cpu_to_le32(0x28); + q1_size = cpu_to_le32(0x48); + q2_size = cpu_to_le32(0x58); + + idx_entry_o = (INDEX_ENTRY*)calloc(1, o_size); + idx_entry_q1 = (INDEX_ENTRY*)calloc(1, q1_size); + idx_entry_q2 = (INDEX_ENTRY*)calloc(1, q2_size); + + idx_entry_o->data_offset = cpu_to_le16(0x20); + idx_entry_o->data_length = cpu_to_le16(0x04); + idx_entry_o->reservedV = cpu_to_le32(0x00); + idx_entry_o->length = cpu_to_le16(0x28); + idx_entry_o->key_length = cpu_to_le16(0x10); + idx_entry_o->flags = cpu_to_le16(0x00); + idx_entry_o->reserved = cpu_to_le16(0x00); + idx_entry_o->key.sid.revision = 0x01; + idx_entry_o->key.sid.sub_authority_count = 0x02; + idx_entry_o->key.sid.identifier_authority.high_part = + cpu_to_le16(0x0000); + idx_entry_o->key.sid.identifier_authority.low_part = + cpu_to_le32(0x05000000); + idx_entry_o->key.sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + idx_entry_o->key.sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + idx_entry_o_data = (QUOTA_O_INDEX_DATA*)((char*)idx_entry_o + + idx_entry_o->data_offset); + idx_entry_o_data->owner_id = QUOTA_FIRST_USER_ID; + // 20 00 00 00 padding after here on ntfs 3.1 ?? + + err = insert_index_entry_in_res_dir_index(idx_entry_o, + o_size, m, + O, 2, AT_UNUSED); + if (idx_entry_o) free(idx_entry_o); + if (err) return err; + + //q index entry nr. 1 + idx_entry_q1->data_offset = cpu_to_le16(0x14); + idx_entry_q1->data_length = cpu_to_le16(0x30); + idx_entry_q1->reservedV = cpu_to_le32(0x00); + idx_entry_q1->length = cpu_to_le16(0x48); + idx_entry_q1->key_length = cpu_to_le16(0x04); + idx_entry_q1->flags = cpu_to_le16(0x00); + idx_entry_q1->reserved = cpu_to_le16(0x00); + idx_entry_q1->key.owner_id = cpu_to_le16(0x01); + idx_entry_q1_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q1 + + idx_entry_q1->data_offset); + idx_entry_q1_data->version = cpu_to_le32(0x02); + idx_entry_q1_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; + if (vol->minor_ver == 0) + idx_entry_q1_data->flags |= QUOTA_FLAG_OUT_OF_DATE; + idx_entry_q1_data->bytes_used = cpu_to_le64(0x00); + idx_entry_q1_data->change_time = utc2ntfs(time(NULL)); + idx_entry_q1_data->threshold = cpu_to_sle64(-0x01); + idx_entry_q1_data->limit = cpu_to_sle64(-0x01); + idx_entry_q1_data->exceeded_time = cpu_to_sle64(0x00); + + err = insert_index_entry_in_res_dir_index(idx_entry_q1, + q1_size, m, + Q, 2, AT_UNUSED); + if (idx_entry_q1) free(idx_entry_q1); + if (err) return err; + + //q index entry nr. 2 + idx_entry_q2->data_offset = cpu_to_le16(0x14); + idx_entry_q2->data_length = cpu_to_le16(0x40); + idx_entry_q2->reservedV = cpu_to_le32(0x00); + idx_entry_q2->length = cpu_to_le16(0x58); + idx_entry_q2->key_length = cpu_to_le16(0x04); + idx_entry_q2->flags = cpu_to_le16(0x00); + idx_entry_q2->reserved = cpu_to_le16(0x00); + idx_entry_q2->key.owner_id = QUOTA_FIRST_USER_ID; + idx_entry_q2_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q2 + + idx_entry_q2->data_offset); + idx_entry_q2_data->version = cpu_to_le32(0x02); + idx_entry_q2_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; + idx_entry_q2_data->bytes_used = cpu_to_le64(0x00); + idx_entry_q2_data->change_time = utc2ntfs(time(NULL));; + idx_entry_q2_data->threshold = cpu_to_sle64(-0x01); + idx_entry_q2_data->limit = cpu_to_sle64(-0x01); + idx_entry_q2_data->exceeded_time = cpu_to_sle64(0x00); + idx_entry_q2_data->sid.revision = 1; + idx_entry_q2_data->sid.sub_authority_count = 2; + idx_entry_q2_data->sid.identifier_authority.high_part = + cpu_to_le16(0x0000); + idx_entry_q2_data->sid.identifier_authority.low_part = + cpu_to_le32(0x05000000); + idx_entry_q2_data->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + idx_entry_q2_data->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + err = insert_index_entry_in_res_dir_index(idx_entry_q2, + q2_size, m, + Q, 2, AT_UNUSED); + if (idx_entry_q2) free(idx_entry_q2); + + return err; + +} + +/* + * initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) + * initialize $ObjId with the default index-entries. + * It is one entry which belongs to $Volume. (W2k3) + */ + +static int initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) { + + int o_size, err; + INDEX_ENTRY *idx_entry_o; + OBJ_ID_INDEX_DATA *idx_entry_o_data; + + err = 0; + o_size = cpu_to_le32(0x58); + idx_entry_o = (INDEX_ENTRY*)calloc(1, o_size); + + //o index entry + idx_entry_o->data_offset = cpu_to_le16(0x20); + idx_entry_o->data_length = cpu_to_le16(0x38); + idx_entry_o->reservedV = cpu_to_le32(0x00); + idx_entry_o->length = cpu_to_le16(0x58); + idx_entry_o->key_length = cpu_to_le16(0x10); + idx_entry_o->flags = cpu_to_le16(0x00); + idx_entry_o->reserved = cpu_to_le16(0x00); + idx_entry_o->key.object_id = guid; + idx_entry_o_data = (OBJ_ID_INDEX_DATA*)((char*)idx_entry_o + + idx_entry_o->data_offset); + idx_entry_o_data->mft_reference = mref; + idx_entry_o_data->birth_volume_id = *zero_guid; + idx_entry_o_data->birth_object_id = *zero_guid; + idx_entry_o_data->domain_id = *zero_guid; + err = insert_index_entry_in_res_dir_index(idx_entry_o, + o_size, m, + O, 2, AT_UNUSED); + if (idx_entry_o) free (idx_entry_o); + + return err; +} + + /** * insert_file_link_in_dir_index * Insert the fully completed FILE_NAME_ATTR @file_name which is inside @@ -2604,6 +3104,7 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, * method which is sufficient for mkntfs but no good whatsoever in * real world scenario. (AIA) */ + index_end = (char*)&idx->index + le32_to_cpu(idx->index.index_length); ie = (INDEX_ENTRY*)((char*)&idx->index + le32_to_cpu(idx->index.entries_offset)); @@ -2710,6 +3211,117 @@ do_next: return 0; } +/** + * create_hardlink_res + * Create a file_name_attribute in the mft record @m_file which points to the + * parent directory with mft reference @ref_parent. + * + * Then, insert an index entry with this file_name_attribute in the index + * root @idx of the index_root attribute of the parent directory. + * + * @ref_file is the mft reference of @m_file. + * + * Return 0 on success or -errno on error. + */ + +static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, + MFT_RECORD *m_file, const MFT_REF ref_file, + const s64 allocated_size, const s64 data_size, + const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, + const u32 reparse_point_tag, const char *file_name, + const FILE_NAME_TYPE_FLAGS file_name_type) +{ + FILE_NAME_ATTR *fn; + int i, fn_size, idx_size; + INDEX_ENTRY *idx_entry_new; + + /* Create the file_name attribute. */ + i = (strlen(file_name) + 1) * sizeof(ntfschar); + fn_size = sizeof(FILE_NAME_ATTR) + i; + fn = (FILE_NAME_ATTR*)malloc(fn_size); + if (!fn) + return -errno; + fn->parent_directory = ref_parent; + // FIXME: Is this correct? Or do we have to copy the creation_time + // from the std info? + fn->creation_time = utc2ntfs(time(NULL)); + fn->last_data_change_time = fn->creation_time; + fn->last_mft_change_time = fn->creation_time; + fn->last_access_time = fn->creation_time; + fn->allocated_size = cpu_to_le64(allocated_size); + fn->data_size = cpu_to_le64(data_size); + fn->file_attributes = flags; + /* These are in a union so can't have both. */ + if (packed_ea_size && reparse_point_tag) { + free(fn); + return -EINVAL; + } + if (packed_ea_size) { + free(fn); + return -EINVAL; + } + if (packed_ea_size) { + fn->packed_ea_size = cpu_to_le16(packed_ea_size); + fn->reserved = cpu_to_le16(0); + } else + fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); + fn->file_name_type = file_name_type; + i = stoucs(fn->file_name, file_name, i); + if (i < 1) { + free(fn); + return -EINVAL; + } + if (i > 0xff) { + free(fn); + return -ENAMETOOLONG; + } + /* No terminating null in file names. */ + fn->file_name_length = i; + fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(ntfschar); + /* Increment the link count of @m_file. */ + i = le16_to_cpu(m_file->link_count); + if (i == 0xffff) { + Eprintf("Too many hardlinks present already.\n"); + free(fn); + return -EINVAL; + } + m_file->link_count = cpu_to_le16(i + 1); + /* Add the file_name to @m_file. */ + i = insert_resident_attr_in_mft_record(m_file, AT_FILE_NAME, NULL, 0, 0, + 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size); + if (i < 0) { + Eprintf("create_hardlink failed adding file name attribute: " + "%s\n", strerror(-i)); + free(fn); + /* Undo link count increment. */ + m_file->link_count = cpu_to_le16( + le16_to_cpu(m_file->link_count) - 1); + return i; + } + /* Insert the index entry for file_name in @idx. */ + //remmet ut kun for debugging + idx_size = (fn_size + 7) & ~7; + idx_entry_new = (INDEX_ENTRY*)calloc(1, idx_size + 0x10); + idx_entry_new->indexed_file = ref_file; + idx_entry_new->length = idx_size + 0x10; + idx_entry_new->key_length = fn_size; + memcpy((char*)idx_entry_new+0x10, (char*)fn, fn_size); + i = insert_index_entry_in_res_dir_index(idx_entry_new, idx_size + 0x10 + , m_parent, I30, 4, AT_FILE_NAME); + if (i < 0) { + Eprintf("create_hardlink failed inserting index entry: %s\n", + strerror(-i)); + /* FIXME: Remove the file name attribute from @m_file. */ + free(fn); + /* Undo link count increment. */ + m_file->link_count = cpu_to_le16( + le16_to_cpu(m_file->link_count) - 1); + return i; + } + free(fn); + return 0; +} + /** * create_hardlink * Create a file_name_attribute in the mft record @m_file which points to the @@ -2817,8 +3429,8 @@ static void init_options(void) opts.heads = -1; opts.part_start_sect = -1; opts.index_block_size = 4096; - opts.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; - opts.attr_defs_len = sizeof(attrdef_ntfs12_array); + opts.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; + opts.attr_defs_len = sizeof(attrdef_ntfs12_array); //mkDprintf("Attr_defs table length = %u\n", opts.attr_defs_len); } @@ -2829,6 +3441,10 @@ static void mkntfs_exit(void) { if (index_block) free(index_block); + if (buf_sds_init) + free(buf_sds_init); + if (buf_sds) + free(buf_sds); if (buf) free(buf); if (buf2) @@ -2853,7 +3469,8 @@ static void mkntfs_exit(void) free(rl_index); if (opts.bad_blocks) free(opts.bad_blocks); - if (opts.attr_defs != (const ATTR_DEF*)attrdef_ntfs12_array) + if ((opts.attr_defs != (const ATTR_DEF*)attrdef_ntfs12_array) && + (opts.attr_defs != (const ATTR_DEF*)attrdef_ntfs3x_array)) free(opts.attr_defs); if (!vol) return; @@ -3202,11 +3819,13 @@ static void mkntfs_initialize_bitmaps(void) for (i = opts.nr_clusters; i < lcn_bitmap_byte_size << 3; i++) ntfs_bit_set(lcn_bitmap, (u64)i, 1); /* - * Determine mft_size: 16 mft records or 1 cluster, which ever is - * bigger, rounded to multiples of cluster size. + * Determine mft_size: (16 (1.2) or 28 (3.0+) mft records) or + * 1 cluster, which ever is bigger, rounded to multiples of cluster + * size */ - opts.mft_size = (16 * vol->mft_record_size + vol->cluster_size - 1) - & ~(vol->cluster_size - 1); + opts.mft_size = ((16 + 12 * (vol->major_ver >= 3)) * + vol->mft_record_size + vol->cluster_size - 1) + & ~(vol->cluster_size - 1); mkDprintf("MFT size = %i (0x%x) bytes\n", opts.mft_size, opts.mft_size); /* Determine mft bitmap size and allocate it. */ mft_bitmap_size = opts.mft_size / vol->mft_record_size; @@ -3520,6 +4139,56 @@ static void mkntfs_fill_device_with_zeroes(void) Qprintf(" - Done.\n"); } +/** + * mkntfs_sync_index_record + * (ERSO) made a function out of this, but the reason for doing that + * disapeared during coding.... + */ + +static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, + ntfschar* name, u32 name_len) +{ + int i, err; + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + long long lw; + i = 5 * sizeof(ntfschar); + ctx = ntfs_attr_get_search_ctx(NULL, m); + + if (!ctx) + err_exit("Failed to allocate attribute search context: %s\n", + strerror(errno)); + // FIXME: This should be IGNORE_CASE! + if (mkntfs_attr_lookup(AT_INDEX_ALLOCATION, name, name_len, 0, 0, + NULL, 0, ctx)) { + ntfs_attr_put_search_ctx(ctx); + err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n"); + } + a = ctx->attr; + rl_index = ntfs_mapping_pairs_decompress(vol, a, NULL); + if (!rl_index) { + ntfs_attr_put_search_ctx(ctx); + err_exit("Failed to decompress runlist of $INDEX_ALLOCATION " + "attribute.\n"); + } + if (sle64_to_cpu(a->initialized_size) < i) { + ntfs_attr_put_search_ctx(ctx); + err_exit("BUG: $INDEX_ALLOCATION attribute too short.\n"); + } + ntfs_attr_put_search_ctx(ctx); + i = sizeof(INDEX_BLOCK) - sizeof(INDEX_HEADER) + + le32_to_cpu(idx->index.allocated_size); + err = ntfs_mst_pre_write_fixup((NTFS_RECORD*)idx, i); + if (err) + err_exit("ntfs_mst_pre_write_fixup() failed while " + "syncing index block.\n"); + lw = ntfs_rlwrite(vol->dev, rl_index, (u8*)idx, i, NULL); + if (lw != i) + err_exit("Error writing $INDEX_ALLOCATION.\n"); + /* No more changes to @idx below here so no need for fixup: */ + // ntfs_mst_post_write_fixup((NTFS_RECORD*)idx); +} + /** * create_file_volume - */ @@ -3538,6 +4207,11 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) init_system_file_sd(FILE_Volume, &sd, &i); err = add_attr_sd(m, sd, i); } + if (!err && vol->major_ver>=3) { + volume_obj_id=(OBJECT_ID_ATTR*)calloc(1,0x10); + volume_obj_id->object_id = *generate_guid(&volume_obj_id->object_id); + err = add_attr_object_id(m, volume_obj_id, 0x10); + } if (!err) err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); if (!err) @@ -3609,9 +4283,10 @@ static void mkntfs_create_root_structures(void) NTFS_BOOT_SECTOR *bs; ATTR_RECORD *a; MFT_RECORD *m; - MFT_REF root_ref; - int i, j, err; + MFT_REF root_ref, extend_ref; + int i, j, err, mft_total_cluster_size; u8 *sd; + FILE_ATTR_FLAGS extend_flags; VOLUME_FLAGS volume_flags = 0; Qprintf("Creating NTFS volume structures.\n"); @@ -3619,42 +4294,64 @@ static void mkntfs_create_root_structures(void) * Setup an empty mft record. Note, we can just give 0 as the mft * reference as we are creating an NTFS 1.2 volume for which the mft * reference is ignored by ntfs_mft_record_layout(). - */ - if (ntfs_mft_record_layout(vol, 0, (MFT_RECORD *)buf)) - err_exit("Error: Failed to layout mft record.\n"); -#if 0 - if (!opts.quiet && opts.verbose > 1) - dump_mft_record((MFT_RECORD*)buf); -#endif - /* + * * Copy the mft record onto all 16 records in the buffer and setup the * sequence numbers of each system file to equal the mft record number * of that file (only for $MFT is the sequence number 1 rather than 0). */ - for (i = 1; i < 16; i++) { - m = (MFT_RECORD*)(buf + i * vol->mft_record_size); - memcpy(m, buf, vol->mft_record_size); - m->sequence_number = cpu_to_le16(i); + for (i = 0; i < 16 + 12 * (vol->major_ver >= 3); i++) { + if (ntfs_mft_record_layout(vol, 0, m = (MFT_RECORD *)(buf + + i * vol->mft_record_size))) + err_exit("Error: Failed to layout mft record.\n"); +#if 0 + if (!opts.quiet && opts.verbose > 1) + dump_mft_record((MFT_RECORD*)buf + + i * vol->mft_record_size); +#endif + + if ( i > 0 ) m->sequence_number = cpu_to_le16(i); + if ( i == 0) m->sequence_number = cpu_to_le16(1); } /* - * If a cluster contains more than the 16 system files, fill the rest + * If a cluster contains more than the 16 (ntfs 1.2) or + * 28 (ntfs 3.0+) system files, fill the rest * with empty, formatted records. */ - if (vol->cluster_size > 16 * vol->mft_record_size) { - for (i = 16; i * vol->mft_record_size < vol->cluster_size; i++) - memcpy(buf + i * vol->mft_record_size, buf, - vol->mft_record_size); + mft_total_cluster_size = vol->cluster_size * + (((16 + 12 * (vol->major_ver >= 3) -1) + * vol->mft_record_size) / vol->cluster_size + 1); + if (mft_total_cluster_size > (16 + 12 * (vol->major_ver >= 3))* + vol->mft_record_size) { + for (i = 16 + 12 * (vol->major_ver >= 3); + i * vol->mft_record_size < mft_total_cluster_size; i++) + { + if (ntfs_mft_record_layout(vol, 0, m = + (MFT_RECORD *)(buf + i * vol->mft_record_size))) + err_exit("Error: Failed to layout mft" + " record.\n"); +#if 0 + if (!opts.quiet && opts.verbose > 1) + dump_mft_record((MFT_RECORD*)buf + + i * vol->mft_record_size); +#endif + m->flags = cpu_to_le16(0); + m->sequence_number = cpu_to_le16(i); + } } /* * Create the 16 system files, adding the system information attribute * to each as well as marking them in use in the mft bitmap. */ - for (i = 0; i < 16; i++) { + for (i = 0; i < 16 + 12 * (vol->major_ver >= 3); i++) { u32 file_attrs; m = (MFT_RECORD*)(buf + i * vol->mft_record_size); - m->flags |= MFT_RECORD_IN_USE; - ntfs_bit_set(mft_bitmap, 0LL + i, 1); + if (i < 16 || i > 23) { + if (vol->major_ver >= 3 && vol->minor_ver >= 1) + m->mft_record_number = cpu_to_le32(i); + m->flags |= MFT_RECORD_IN_USE; + ntfs_bit_set(mft_bitmap, 0LL + i, 1); + } file_attrs = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM; if (i == FILE_root) { if (opts.disable_indexing) @@ -3662,11 +4359,40 @@ static void mkntfs_create_root_structures(void) if (opts.enable_compression) file_attrs |= FILE_ATTR_COMPRESSED; } - add_attr_std_info(m, file_attrs); - // dump_mft_record(m); + + if (vol->major_ver < 3) + add_attr_std_info(m, file_attrs, + cpu_to_le32(0)); // dump_mft_record(m); + else { + // setting specific security_id flag and + // filepermissions for ntfs 3.x + if (i == 0 || i == 1 || i == 2 || i == 6 || i == 8 || + i == 10 ) + add_attr_std_info(m, file_attrs, + cpu_to_le32(0x0100)); + else if (i == 9) { + file_attrs |= FILE_ATTR_NOT_CONTENT_INDEXED; + add_attr_std_info(m, file_attrs, + cpu_to_le32(0x0101)); + } + else if (i == 11) + add_attr_std_info(m, file_attrs, + cpu_to_le32(0x0101)); + else if (i ==24 || i == 25 || i == 26) { + file_attrs |= FILE_ATTR_DUP_VIEW_INDEX_PRESENT; + add_attr_std_info(m, file_attrs, + cpu_to_le32(0x0101)); + } + else if (i == 27) + add_attr_std_info(m, file_attrs, + cpu_to_le32(0x0102)); + else add_attr_std_info(m, file_attrs, + cpu_to_le32(0x00)); + } } /* The root directory mft reference. */ root_ref = MK_LE_MREF(FILE_root, FILE_root); + extend_ref = MK_LE_MREF(11,11); Vprintf("Creating root directory (mft record 5)\n"); m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); m->flags |= MFT_RECORD_IS_DIRECTORY; @@ -3676,8 +4402,17 @@ static void mkntfs_create_root_structures(void) FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, ".", FILE_NAME_WIN32_AND_DOS); if (!err) { - init_system_file_sd(FILE_root, &sd, &i); - err = add_attr_sd(m, sd, i); + if (vol->major_ver == 1) { + init_system_file_sd(FILE_root, &sd, &i); + err = add_attr_sd(m, sd, i); + } else if (vol->major_ver == 3 && vol->minor_ver == 0) { + init_system_file_sd(FILE_root, &sd, &i); + err = add_attr_sd(m, sd, i); + } else if (vol->major_ver == 3 && vol->minor_ver == 1) { + init_root_sd_31(&sd, &i); + err = add_attr_sd(m, sd, i); + } else + err_exit("BUG: Unsupported NTFS version\n"); } // FIXME: This should be IGNORE_CASE if (!err) @@ -3720,7 +4455,7 @@ static void mkntfs_create_root_structures(void) opts.mft_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$MFT", FILE_NAME_WIN32_AND_DOS); - if (!err) { + if (!err && vol->major_ver == 1) { init_system_file_sd(FILE_MFT, &sd, &i); err = add_attr_sd(m, sd, i); } @@ -3742,7 +4477,7 @@ static void mkntfs_create_root_structures(void) rl_mftmirr[0].length * vol->cluster_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$MFTMirr", FILE_NAME_WIN32_AND_DOS); - if (!err) { + if (!err && vol->major_ver == 1) { init_system_file_sd(FILE_MFTMirr, &sd, &i); err = add_attr_sd(m, sd, i); } @@ -3766,7 +4501,7 @@ static void mkntfs_create_root_structures(void) opts.logfile_size, opts.logfile_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$LogFile", FILE_NAME_WIN32_AND_DOS); - if (!err) { + if (!err && vol->major_ver == 1) { init_system_file_sd(FILE_LogFile, &sd, &i); err = add_attr_sd(m, sd, i); } @@ -3783,7 +4518,7 @@ static void mkntfs_create_root_structures(void) buf2 = calloc(1, buf2_size); if (!buf2) err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); + strerror(errno)); memcpy(buf2, opts.attr_defs, opts.attr_defs_len); err = add_attr_data(m, NULL, 0, 0, 0, buf2, buf2_size); free(buf2); @@ -3805,7 +4540,15 @@ static void mkntfs_create_root_structures(void) //dump_mft_record(m); Vprintf("Creating $Bitmap (mft record 6)\n"); m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); - err = add_attr_data(m, NULL, 0, 0, 0, lcn_bitmap, lcn_bitmap_byte_size); + // the data attribute of $Bitmap must be non-resident or otherwise + // windows 2003 will regard the volume as corrupt (ERSO) + if(!err) + err = insert_non_resident_attr_in_mft_record(m, + AT_DATA, NULL, 0, + 0, 0, + lcn_bitmap, lcn_bitmap_byte_size); + + if (!err) err = create_hardlink(index_block, root_ref, m, MK_LE_MREF(FILE_Bitmap, FILE_Bitmap), @@ -3813,7 +4556,7 @@ static void mkntfs_create_root_structures(void) ~(vol->cluster_size - 1), lcn_bitmap_byte_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$Bitmap", FILE_NAME_WIN32_AND_DOS); - if (!err) { + if (!err && vol->major_ver == 1) { init_system_file_sd(FILE_Bitmap, &sd, &i); err = add_attr_sd(m, sd, i); } @@ -3934,27 +4677,86 @@ static void mkntfs_create_root_structures(void) 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$BadClus", FILE_NAME_WIN32_AND_DOS); } - if (!err) { + if (!err && vol->major_ver == 1) { init_system_file_sd(FILE_BadClus, &sd, &i); err = add_attr_sd(m, sd, i); } if (err < 0) err_exit("Couldn't create $BadClus: %s\n", strerror(-err)); + //dump_mft_record(m); - Vprintf("Creating $Quota (mft record 9)\n"); - m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); - err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); - if (!err) - err = create_hardlink(index_block, root_ref, m, - MK_LE_MREF(9, 9), 0LL, 0LL, FILE_ATTR_HIDDEN - | FILE_ATTR_SYSTEM, 0, 0, "$Quota", - FILE_NAME_WIN32_AND_DOS); - if (!err) { - init_system_file_sd(FILE_Secure, &sd, &i); - err = add_attr_sd(m, sd, i); + /* create $Quota (1.2) or $Secure (3.0+) + */ + + if (vol->major_ver < 3 ) { + Vprintf("Creating $Quota (mft record 9)\n"); + m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); + err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); + if (!err) + err = create_hardlink(index_block, root_ref, m, + MK_LE_MREF(9, 9), 0LL, 0LL, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0 + , 0, "$Quota", + FILE_NAME_WIN32_AND_DOS); + if (!err) { + init_system_file_sd(FILE_Secure, &sd, &i); + err = add_attr_sd(m, sd, i); + } + if (err < 0) + err_exit("Couldn't create $Quota: %s\n", + strerror(-err)); + } else { + Vprintf("Creating $Secure (mft record 9)\n"); + m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_8; + if (!err) + err = create_hardlink(index_block, root_ref, m, + MK_LE_MREF(9, 9), 0LL, 0LL, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | + FILE_ATTR_DUP_VIEW_INDEX_PRESENT + , 0, 0, "$Secure", + FILE_NAME_WIN32_AND_DOS); + if (!err) { + if (vol->minor_ver == 0) { + buf_sds_first_size = 0x1E0; + buf_sds_size = 0x40000 + buf_sds_first_size; + buf_sds_init = (char*)calloc(1, + buf_sds_first_size); + init_secure_30(buf_sds_init); + } else { + buf_sds_first_size = 0x240; + buf_sds_size = 0x40000 + buf_sds_first_size; + buf_sds_init = (char*)calloc(1, + buf_sds_first_size); + init_secure_31(buf_sds_init); + } + buf_sds = (char*)calloc(1,buf_sds_size); + if (!buf_sds) + err_exit("Failed to allocate internal buffer:" + " %s\n", strerror(errno)); + memcpy((char*)buf_sds, (char*)buf_sds_init, + buf_sds_first_size); + memcpy((char*)buf_sds + 0x40000, (char*)buf_sds_init, + buf_sds_first_size); + err = add_attr_data(m, "$SDS", 4, 0, 0, buf_sds, + buf_sds_size); + } + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$SDH", 4, 0, AT_UNUSED, + COLLATION_NTOFS_SECURITY_HASH , + opts.index_block_size); + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$SII", 4, 0, AT_UNUSED, + COLLATION_NTOFS_ULONG, opts.index_block_size); + if (!err) + err =initialize_secure(buf_sds_init, buf_sds_first_size + , m); + if (err < 0) + err_exit("Couldn't create $Secure: %s\n", + strerror(-err)); } - if (err < 0) - err_exit("Couldn't create $Quota: %s\n", strerror(-err)); //dump_mft_record(m); Vprintf("Creating $UpCase (mft record 0xa)\n"); m = (MFT_RECORD*)(buf + 0xa * vol->mft_record_size); @@ -3963,19 +4765,57 @@ static void mkntfs_create_root_structures(void) if (!err) err = create_hardlink(index_block, root_ref, m, MK_LE_MREF(FILE_UpCase, FILE_UpCase), - ((vol->upcase_len << 1) + vol->cluster_size - 1) & + ((vol->upcase_len << 1) + + vol->cluster_size - 1) & ~(vol->cluster_size - 1), vol->upcase_len << 1, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$UpCase", FILE_NAME_WIN32_AND_DOS); - if (!err) { + if (!err && vol->major_ver == 1) { init_system_file_sd(FILE_UpCase, &sd, &i); err = add_attr_sd(m, sd, i); } if (err < 0) err_exit("Couldn't create $UpCase: %s\n", strerror(-err)); //dump_mft_record(m); - /* NTFS 1.2 reserved system files (mft records 0xb-0xf) */ - for (i = 0xb; i < 0x10; i++) { + + if (vol->major_ver < 3) { + Vprintf("Creating empty record, marked as in use " + "(mft record 11)\n"); + m = (MFT_RECORD*)(buf + 11 * vol->mft_record_size); + err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); + if (!err) { + init_system_file_sd(11, &sd, &j); + err = add_attr_sd(m, sd, j); + } + if (err < 0) + err_exit("Couldn't create system file 11 (0x0b): %s\n", + strerror(-err)); + //dump_mft_record(m); + } else { + Vprintf("Creating $Extend (mft record 11)\n"); + /* + * $Extends index must be resident. Otherwise, w2k3 will + * regard the volume as corrupt. (ERSO) + */ + m = (MFT_RECORD*)(buf + 11 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_DIRECTORY; + if (!err) + err = create_hardlink(index_block, root_ref, m, + MK_LE_MREF(11, 11), 0LL, 0LL, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | + FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, + 0, 0, "$Extend", + FILE_NAME_WIN32_AND_DOS); + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, + COLLATION_FILE_NAME, opts.index_block_size); + if (err < 0) + err_exit("Couldn't create $Extend: %s\n", + strerror(-err)); + } + /* NTFS 1.2 reserved system files (mft records 0xc-0xf) */ + for (i = 0xc; i < 0x10; i++) { Vprintf("Creating system file (mft record 0x%x)\n", i); m = (MFT_RECORD*)(buf + i * vol->mft_record_size); err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); @@ -3988,6 +4828,92 @@ static void mkntfs_create_root_structures(void) i, i, strerror(-err)); //dump_mft_record(m); } + // create systemfiles for ntfs volumes (3.1) + // starting vith file 24 (ignoring file 16-23) + if (vol->major_ver >= 3) { + extend_flags = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | + FILE_ATTR_DUP_VIEW_INDEX_PRESENT; + Vprintf("Creating $ObjId (mft record 24)\n"); + m = (MFT_RECORD*)(buf + 24 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_4; + m->flags |= MFT_RECORD_IS_8; + if (!err) + err = create_hardlink_res((MFT_RECORD*)(buf + + 11 * vol->mft_record_size), extend_ref, + m, MK_LE_MREF(24, 24), 0LL, 0LL, + extend_flags, 0, 0, "$ObjId", + FILE_NAME_WIN32_AND_DOS); + + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, + COLLATION_NTOFS_ULONGS, opts.index_block_size); + if (!err) + err = initialize_objid(m, volume_obj_id->object_id, + MK_LE_MREF(FILE_Volume, FILE_Volume)); + if (err < 0) + err_exit("Couldn't create $ObjId: %s\n", strerror(-err)); + Vprintf("Creating $Quota (mft record 25)\n"); + m = (MFT_RECORD*)(buf + 25 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_4; + m->flags |= MFT_RECORD_IS_8; + if (!err) + err = create_hardlink_res((MFT_RECORD*)(buf + + 11 * vol->mft_record_size), extend_ref, m, + MK_LE_MREF(25, 25), 0LL, 0LL, extend_flags + , 0, 0, "$Quota", FILE_NAME_WIN32_AND_DOS); + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, + COLLATION_NTOFS_SID, opts.index_block_size); + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$Q", 2, 0, AT_UNUSED, + COLLATION_NTOFS_ULONG, opts.index_block_size); + if (!err) + err = initialize_quota(m); + if (err < 0) + err_exit("Couldn't create $Quota: %s\n", strerror(-err)); + Vprintf("Creating $Reparse (mft record 26)\n"); + m = (MFT_RECORD*)(buf + 26 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_4; + m->flags |= MFT_RECORD_IS_8; + if (!err) + err = create_hardlink_res((MFT_RECORD*)(buf + + 11 * vol->mft_record_size), + extend_ref, m, MK_LE_MREF(26, 26), + 0LL, 0LL, extend_flags, 0, 0, + "$Reparse", FILE_NAME_WIN32_AND_DOS); + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$R", 2, 0, AT_UNUSED, + COLLATION_NTOFS_ULONGS, opts.index_block_size); + if (err < 0) + err_exit("Couldn't create $Reparse: %s\n", + strerror(-err)); + Vprintf("Creating System Volume Information (mft record 27)\n"); + m = (MFT_RECORD*)(buf + 27 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_DIRECTORY; + if (!err) + err = create_hardlink(index_block, root_ref, m, + MK_LE_MREF(27, 27), 0LL, 0LL, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | + FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, + "SYSTEM~1", FILE_NAME_DOS); + + if (!err) + err = create_hardlink(index_block, root_ref, m, + MK_LE_MREF(27, 27), 0LL, 0LL, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | + FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, + "System Volume Information", FILE_NAME_WIN32); + if (!err) + err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, + COLLATION_FILE_NAME, opts.index_block_size); + if (err < 0) + err_exit("Couldn't create 'System Volume Information'" + ": %s\n", strerror(-err)); + } } /** @@ -4028,7 +4954,7 @@ int main(int argc, char **argv) err_exit("Could not allocate memory for internal buffer.\n"); init_upcase_table(vol->upcase, vol->upcase_len * sizeof(ntfschar)); /* Initialize opts to zero / required values. */ - init_options(); + init_options(); /* Parse command line options. */ parse_options(argc, argv); /* Open the partition. */ @@ -4067,41 +4993,9 @@ int main(int argc, char **argv) // applicable). Possibly should move this as far to the top as possible and // update during each subsequent c&w of each system file. Vprintf("Syncing root directory index record.\n"); - m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); - i = 5 * sizeof(ntfschar); - ctx = ntfs_attr_get_search_ctx(NULL, m); - if (!ctx) - err_exit("Failed to allocate attribute search context: %s\n", - strerror(errno)); - // FIXME: This should be IGNORE_CASE! - if (mkntfs_attr_lookup(AT_INDEX_ALLOCATION, I30, 4, 0, 0, - NULL, 0, ctx)) { - ntfs_attr_put_search_ctx(ctx); - err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n"); - } - a = ctx->attr; - rl_index = ntfs_mapping_pairs_decompress(vol, a, NULL); - if (!rl_index) { - ntfs_attr_put_search_ctx(ctx); - err_exit("Failed to decompress runlist of $INDEX_ALLOCATION " - "attribute.\n"); - } - if (sle64_to_cpu(a->initialized_size) < i) { - ntfs_attr_put_search_ctx(ctx); - err_exit("BUG: $INDEX_ALLOCATION attribute too short.\n"); - } - ntfs_attr_put_search_ctx(ctx); - i = sizeof(INDEX_BLOCK) - sizeof(INDEX_HEADER) + - le32_to_cpu(index_block->index.allocated_size); - err = ntfs_mst_pre_write_fixup((NTFS_RECORD*)index_block, i); - if (err) - err_exit("ntfs_mst_pre_write_fixup() failed while syncing " - "root directory index block.\n"); - lw = ntfs_rlwrite(vol->dev, rl_index, (u8*)index_block, i, NULL); - if (lw != i) - err_exit("Error writing $INDEX_ALLOCATION.\n"); - /* No more changes to @index_block below here so no need for fixup: */ - // ntfs_mst_post_write_fixup((NTFS_RECORD*)index_block); + mkntfs_sync_index_record(index_block, (MFT_RECORD*)(buf + + 5 * vol->mft_record_size), I30, 4); + Vprintf("Syncing $Bitmap.\n"); m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); ctx = ntfs_attr_get_search_ctx(NULL, m); @@ -4184,3 +5078,4 @@ int main(int argc, char **argv) */ return 0; } + diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c index 90b4cd0c..245d01f4 100644 --- a/ntfsprogs/sd.c +++ b/ntfsprogs/sd.c @@ -4,8 +4,8 @@ /** * init_system_file_sd * - * NTFS 1.2 - System files security descriptors - * =========================================== + * NTFS 1.2, 3.0, 3.1 - System files security decriptors + * ===================================================== * * Create the security descriptor for system file number @sys_file_no and * return a pointer to the descriptor. @@ -36,7 +36,7 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) ACCESS_ALLOWED_ACE *aa_ace; SID *sid; - if (sys_file_no < 0 || sys_file_no > 0xf) { + if (sys_file_no < 0) { *sd_val = NULL; *sd_val_len = 0; return; @@ -90,7 +90,7 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ | FILE_READ_ATTRIBUTES | FILE_READ_EA | FILE_READ_DATA; break; - case FILE_Volume: case FILE_Secure: case 0xb ... 0xf: + case FILE_Volume: case FILE_Secure: case 0xb ... 0xffff: aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_WRITE | FILE_WRITE_ATTRIBUTES | FILE_READ_ATTRIBUTES | FILE_WRITE_EA | FILE_READ_EA | FILE_APPEND_DATA | @@ -145,7 +145,7 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) FILE_READ_DATA; break; case FILE_Volume: case FILE_Secure: - case 0xb ... 0xf: + case 0xb ... 0xffff : aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ | FILE_WRITE_ATTRIBUTES | FILE_READ_ATTRIBUTES | FILE_WRITE_EA | @@ -200,3 +200,1111 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) sid->sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); } + +/* + * init_root_sd_31 (ERSO) + * creates the security_descriptor for the root folder on ntfs 3.1. + * It is very long ; lot's av ACE's at first, then large pieces of zero's + * the owner user/group is near the end. On a partition created with + * w2k3 the owner user/group at the end is surrounded by 'garbage', which I + * yet do not understand. Here I have replaced the 'garbage' with + * zero's, which seems to work. Chkdsk does not add the 'garbage', nor alter + * this security descriptor in any way. + */ + +void init_root_sd_31(u8 **sd_val, int *sd_val_len); +void init_root_sd_31(u8 **sd_val, int *sd_val_len) +{ + SECURITY_DESCRIPTOR_RELATIVE *sd; + ACL *acl; + ACCESS_ALLOWED_ACE *ace; + SID *sid; + + static char sd_array[0x1200]; + //char* sd_val = NULL; + *sd_val_len = 0x1200; + *sd_val = (char*)&sd_array; + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)&sd_array; + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x1014); + sd->group = cpu_to_le32(0x1024); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x1000); + acl->ace_count = cpu_to_le16(0x07); + acl->alignment2 = cpu_to_le16(0x00); + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; + ace->size = cpu_to_le16(0x18); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //ace2 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; + ace->size = cpu_to_le16(0x14); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + //ace3 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | + INHERIT_ONLY_ACE; + ace->size = cpu_to_le16(0x14); + ace->mask = cpu_to_le32(0x10000000); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_CREATOR_SID_AUTHORITY (S-1-3) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 3; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_CREATOR_OWNER_RID); + + //ace4 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x1200A9); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_USERS); + + //ace5 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = CONTAINER_INHERIT_ACE; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x04); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_USERS); + + //ace6 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x02); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_USERS); + + //ace7 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = cpu_to_le32(0x1200A9); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_WORLD_SID_AUTHORITY (S-1-1) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 1; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_WORLD_RID); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + +} + +/** + * init_secure + * + * NTFS 3.0 - System files security decriptors + * =========================================== + * Create the security descriptor entries in $SDS data stream like they + * are in a partition, newly formatet with windows 2000 + * + */ +void init_secure_30(char *sd_val); +void init_secure_30(char *sd_val) +{ + SECURITY_DESCRIPTOR_HEADER *sds; + SECURITY_DESCRIPTOR_RELATIVE *sd; + ACL *acl; + ACCESS_ALLOWED_ACE *ace; + SID *sid; + +/* + * security descriptor #1 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val); + sds->hash = cpu_to_le32(0xF80312F0); + sds->security_id = cpu_to_le32(0x0100); + sds->offset = cpu_to_le64(0x00); + sds->length = cpu_to_le32(0x7C); + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(0x02); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = cpu_to_le32(0x120089); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + //ace2 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x120089); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + +/* + * security descriptor #2 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80); + sds->hash = cpu_to_le32(0xB32451); + sds->security_id = cpu_to_le32(0x0101); + sds->offset = cpu_to_le64(0x80); + sds->length = cpu_to_le32(0x7C); + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(0x02); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = cpu_to_le32(0x12019F); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + //ace2 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x12019F); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + +/* + * security descriptor #3 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80); + sds->hash = cpu_to_le32(0x0A9F9562); + sds->security_id = cpu_to_le32(0x0102); + sds->offset = cpu_to_le64(0x0100); + sds->length = cpu_to_le32(0x60); + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x30); + sd->group = cpu_to_le32(0x40); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x1C); + acl->ace_count = cpu_to_le16(0x01); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x01; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + +/* + * security descriptor #4 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80 + 0x60); + sds->hash = cpu_to_le32(0x453F0A2E); + sds->security_id = cpu_to_le32(0x0103); + sds->offset = cpu_to_le64(0x0160); + sds->length = cpu_to_le32(0x78); + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(0x02); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x18); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //ace2 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x01; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + return; +} + +/** + * init_secure_31(char **r, int size); + * + * NTFS 3.1 - System files security decriptors + * =========================================== + * Create the security descriptor entries in $SDS data stream like they + * are in a partition, newly formatet with windows 2003 + * + */ +void init_secure_31(char *sd_val); +void init_secure_31(char *sd_val) +{ + SECURITY_DESCRIPTOR_HEADER *sds; + SECURITY_DESCRIPTOR_RELATIVE *sd; + ACL *acl; + ACCESS_ALLOWED_ACE *ace; + SID *sid; + +/* + * security descriptor #1 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val); + sds->hash = cpu_to_le32(0xF80312F0); + sds->security_id = cpu_to_le32(0x0100); + sds->offset = cpu_to_le64(0x00); + sds->length = cpu_to_le32(0x7C); + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(0x02); + acl->alignment2 = 0x00; + + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = cpu_to_le32(0x120089); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + //ace2 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x120089); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); +/* + * security descriptor #2 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80); + sds->hash = cpu_to_le32(0xB32451); + sds->security_id = cpu_to_le32(0x0101); + sds->offset = cpu_to_le64(0x80); + sds->length = cpu_to_le32(0x7C); + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(0x02); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = cpu_to_le32(0x12019F); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + //ace2 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x12019F); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + +/* + * security descriptor #3 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80); + sds->hash = cpu_to_le32(0x0A9F9B62); + sds->security_id = cpu_to_le32(0x0102); + sds->offset = cpu_to_le64(0x0100); + sds->length = cpu_to_le32(0x60); + + + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x30); + sd->group = cpu_to_le32(0x40); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x1C); + acl->ace_count = cpu_to_le16(0x01); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; + ace->size = cpu_to_le16(0x14); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + +/* + * security descriptor #4 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80 + 0x60); + sds->hash = cpu_to_le32(0x0A9F9562); + sds->security_id = cpu_to_le32(0x0103); + sds->offset = cpu_to_le64(0x0160); + sds->length = cpu_to_le32(0x60); + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x30); + sd->group = cpu_to_le32(0x40); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x1C); + acl->ace_count = cpu_to_le16(0x01); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x01; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + +/* + * security descriptor #5 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80 + + 0x60 + 0x60); + sds->hash = cpu_to_le32(0x453F0A2E); + sds->security_id = cpu_to_le32(0x0104); + sds->offset = cpu_to_le64(0x01C0); + sds->length = cpu_to_le32(0x78); + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(0x02); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x18); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //ace2 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x01; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + return; +} + + From 24cb1ec6e8062a2edc844ab25488cea41daecd62 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 19 Oct 2005 22:10:57 +0000 Subject: [PATCH 2614/2994] fix warnings --- ntfsprogs/mkntfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 14c66ccf..e6a412c4 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -4284,7 +4284,8 @@ static void mkntfs_create_root_structures(void) ATTR_RECORD *a; MFT_RECORD *m; MFT_REF root_ref, extend_ref; - int i, j, err, mft_total_cluster_size; + int i, j, err; + unsigned mft_total_cluster_size; u8 *sd; FILE_ATTR_FLAGS extend_flags; VOLUME_FLAGS volume_flags = 0; From 570705dcab6047200f7125b1a0c4ded2a8d3a384 Mon Sep 17 00:00:00 2001 From: uvman Date: Thu, 20 Oct 2005 00:56:11 +0000 Subject: [PATCH 2615/2994] Add a comment to some typedefs per discussion on linux-ntfs-dev --- include/ntfs/types.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/ntfs/types.h b/include/ntfs/types.h index 29b62f25..e1ebbae6 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -45,6 +45,11 @@ typedef int64_t s64; typedef u16 le16; typedef u32 le32; typedef u64 le64; + +/* + * Declare sle{16,32,64} to be unsigned because we do not want sign extension + * on BE architectures. + */ typedef u16 sle16; typedef u32 sle32; typedef u64 sle64; From 705814c9d79e51e50f4cd48e5ef335b6430f5e0e Mon Sep 17 00:00:00 2001 From: uvman Date: Thu, 20 Oct 2005 00:59:22 +0000 Subject: [PATCH 2616/2994] Allow building libntfs as a shared library on Cygwin. This should not disturb non-Cygwin enviroments, but not tested. As a side-effect it generates ugly informational messages about importing extern variables. These are not errors or warnings, just info. --- libntfs/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/Makefile.am b/libntfs/Makefile.am index f1fd592e..ac784c67 100644 --- a/libntfs/Makefile.am +++ b/libntfs/Makefile.am @@ -32,7 +32,7 @@ LTVERSION_LIBNTFS_GNOMEVFS = 1:0:0 linux_ntfsincludedir = -I$(top_srcdir)/include/ntfs lib_LTLIBRARIES = libntfs.la -libntfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS) +libntfs_la_LDFLAGS = -version-info $(LTVERSION_LIBNTFS) -no-undefined libntfs_la_CFLAGS = $(LIBNTFS_CFLAGS) \ -DLTVERSION_LIBNTFS=\"$(LTVERSION_LIBNTFS)\" libntfs_la_SOURCES = \ From a2c8e7befe92920a575e6d7d3cab79eecdc603d2 Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 20 Oct 2005 13:49:56 +0000 Subject: [PATCH 2617/2994] fix a few build warnings --- ntfsprogs/mkntfs.c | 8 ++++---- ntfsprogs/sd.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index e6a412c4..897633ab 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2135,12 +2135,12 @@ static int add_attr_object_id(MFT_RECORD *m, OBJECT_ID_ATTR *objid_attr, if (le32_to_cpu(m->bytes_in_use) + 24 + objid_attr_len > le32_to_cpu(m->bytes_allocated)) err = insert_non_resident_attr_in_mft_record(m, - AT_OBJECT_ID, NULL, 0, 0, 0, (char*)objid_attr, + AT_OBJECT_ID, NULL, 0, 0, 0, (u8*)objid_attr, objid_attr_len); else err = insert_resident_attr_in_mft_record(m, AT_OBJECT_ID, NULL, 0, 0, 0, 0, - (char*)objid_attr, objid_attr_len); + (u8*)objid_attr, objid_attr_len); if (err < 0) Eprintf("add_attr_volume_id failed: %s\n", strerror(-err)); return err; @@ -3288,7 +3288,7 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, m_file->link_count = cpu_to_le16(i + 1); /* Add the file_name to @m_file. */ i = insert_resident_attr_in_mft_record(m_file, AT_FILE_NAME, NULL, 0, 0, - 0, RESIDENT_ATTR_IS_INDEXED, (char*)fn, fn_size); + 0, RESIDENT_ATTR_IS_INDEXED, (u8*)fn, fn_size); if (i < 0) { Eprintf("create_hardlink failed adding file name attribute: " "%s\n", strerror(-i)); @@ -4739,7 +4739,7 @@ static void mkntfs_create_root_structures(void) buf_sds_first_size); memcpy((char*)buf_sds + 0x40000, (char*)buf_sds_init, buf_sds_first_size); - err = add_attr_data(m, "$SDS", 4, 0, 0, buf_sds, + err = add_attr_data(m, "$SDS", 4, 0, 0, (u8*)buf_sds, buf_sds_size); } // FIXME: This should be IGNORE_CASE diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c index 245d01f4..209281fd 100644 --- a/ntfsprogs/sd.c +++ b/ntfsprogs/sd.c @@ -223,7 +223,7 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) static char sd_array[0x1200]; //char* sd_val = NULL; *sd_val_len = 0x1200; - *sd_val = (char*)&sd_array; + *sd_val = (u8*)&sd_array; //security descriptor relative sd = (SECURITY_DESCRIPTOR_RELATIVE*)&sd_array; From 8c53ea8d4fa0757aa4768748416e590ee9e3d4e4 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 20 Oct 2005 15:38:21 +0000 Subject: [PATCH 2618/2994] *** empty log message *** --- ntfsprogs/ntfsmount.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 408a987a..ab46d430 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -542,9 +542,11 @@ exit: return res; } -static int ntfs_fuse_chmod(const char *path __attribute__((unused)), +static int ntfs_fuse_chmod(const char *path, mode_t mode __attribute__((unused))) { + if (strchr(path, ':')) + return -EINVAL; /* n/a for named data streams. */ if (ctx->succeed_chmod) return 0; return -EOPNOTSUPP; @@ -655,6 +657,10 @@ static int ntfs_fuse_link(const char *old_path, const char *new_path) char *path; int res = 0, uname_len; + if (strchr(old_path, ':')) + return -EINVAL; /* n/a for named data streams. */ + if (strchr(new_path, ':')) + return -EINVAL; /* n/a for named data streams. */ path = strdup(new_path); if (!path) return -errno; @@ -805,11 +811,15 @@ static int ntfs_fuse_rename(const char *old_path, const char *new_path) static int ntfs_fuse_mkdir(const char *path, mode_t mode __attribute__((unused))) { + if (strchr(path, ':')) + return -EINVAL; /* n/a for named data streams. */ return ntfs_fuse_create(path, NTFS_DT_DIR); } static int ntfs_fuse_rmdir(const char *path) { + if (strchr(path, ':')) + return -EINVAL; /* n/a for named data streams. */ return ntfs_fuse_rm(path); } From f4e427e91a1062ab435e12eb9c770a2466dc27ea Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 21 Oct 2005 18:05:13 +0000 Subject: [PATCH 2619/2994] implement logging in libntfs fix whitespace fix build problems tidy source code and more... --- include/ntfs/attrib.h | 8 +- include/ntfs/bitmap.h | 18 +- include/ntfs/debug.h | 25 +- include/ntfs/dir.h | 14 +- include/ntfs/endians.h | 12 +- include/ntfs/index.h | 16 +- include/ntfs/inode.h | 6 +- include/ntfs/layout.h | 168 +-- include/ntfs/logfile.h | 22 +- include/ntfs/logging.h | 91 +- include/ntfs/mft.h | 10 +- include/ntfs/ntfstime.h | 2 + include/ntfs/rich.h | 12 +- include/ntfs/runlist.h | 2 +- include/ntfs/support.h | 2 + include/ntfs/tree.h | 66 +- include/ntfs/types.h | 2 + include/ntfs/version.h | 2 +- include/ntfs/volume.h | 20 +- libntfs/attrib.c | 729 ++++++------- libntfs/attrlist.c | 65 +- libntfs/bitmap.c | 167 ++- libntfs/bootsect.c | 91 +- libntfs/collate.c | 36 +- libntfs/compat.c | 4 +- libntfs/compress.c | 30 +- libntfs/debug.c | 40 +- libntfs/device.c | 46 +- libntfs/dir.c | 423 ++++---- libntfs/index.c | 157 +-- libntfs/inode.c | 199 ++-- libntfs/lcnalloc.c | 386 +++---- libntfs/logfile.c | 112 +- libntfs/logging.c | 258 +++-- libntfs/mft.c | 383 +++---- libntfs/mst.c | 7 +- libntfs/rich.c | 60 +- libntfs/runlist.c | 342 +++--- libntfs/security.c | 16 +- libntfs/tree.c | 894 +++++++-------- libntfs/unistr.c | 20 +- libntfs/unix_io.c | 51 +- libntfs/volume.c | 533 ++++----- ntfsprogs/Makefile.am | 2 +- ntfsprogs/attrdef.c | 4 +- ntfsprogs/mkntfs.c | 1139 ++++++++++---------- ntfsprogs/ntfscat.c | 2 +- ntfsprogs/ntfsclone.c | 19 +- ntfsprogs/ntfscmp.c | 66 +- ntfsprogs/ntfscp.c | 2 +- ntfsprogs/ntfsdump_logfile.c | 3 +- ntfsprogs/ntfsfix.c | 9 +- ntfsprogs/ntfsinfo.c | 18 +- ntfsprogs/ntfslabel.c | 3 +- ntfsprogs/ntfsmount.c | 27 +- ntfsprogs/ntfsmove.h | 2 +- ntfsprogs/ntfsresize.c | 87 +- ntfsprogs/ntfsrm.c | 4 +- ntfsprogs/ntfstruncate.c | 3 +- ntfsprogs/ntfsundelete.c | 252 +++-- ntfsprogs/ntfsundelete.h | 2 +- ntfsprogs/sd.c | 1974 +++++++++++++++++----------------- ntfsprogs/upcase.c | 2 +- ntfsprogs/utils.c | 167 ++- ntfsprogs/utils.h | 8 +- 65 files changed, 4609 insertions(+), 4733 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 7d1f9f18..7f9182b8 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -33,6 +33,7 @@ typedef struct _ntfs_attr_search_ctx ntfs_attr_search_ctx; #include "runlist.h" #include "volume.h" #include "debug.h" +#include "logging.h" extern ntfschar AT_UNNAMED[]; @@ -135,7 +136,7 @@ static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx) * @allocated_size: copy from the attribute record * @data_size: copy from the attribute record * @initialized_size: copy from the attribute record - * @compressed_size: copy from the attribute record + * @compressed_size: copy from the attribute record * @compression_block_size: size of a compression block (cb) * @compression_block_size_bits: log2 of the size of a cb * @compression_block_clusters: number of clusters per cb @@ -214,9 +215,8 @@ static inline void NAttrSet##flag(ntfs_attr *na) \ if (na->type == AT_DATA && na->name == AT_UNNAMED) \ NInoSet##flag(na->ni); \ else \ - Dprintf("%s(): BUG! Should be called only for " \ - "unnamed data attribute.\n", \ - __FUNCTION__); \ + ntfs_log_trace("BUG! Should be called only for "\ + "unnamed data attribute.\n"); \ } \ static inline void NAttrClear##flag(ntfs_attr *na) \ { \ diff --git a/include/ntfs/bitmap.h b/include/ntfs/bitmap.h index 041153f9..ef8e77ba 100644 --- a/include/ntfs/bitmap.h +++ b/include/ntfs/bitmap.h @@ -150,15 +150,15 @@ struct ntfs_bmp { }; -int ntfs_bmp_rollback (struct ntfs_bmp *bmp); -int ntfs_bmp_commit (struct ntfs_bmp *bmp); -void ntfs_bmp_free (struct ntfs_bmp *bmp); -struct ntfs_bmp * ntfs_bmp_create (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len); -int ntfs_bmp_add_data (struct ntfs_bmp *bmp, VCN vcn, u8 *data); -u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn); -int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int value); -s64 ntfs_bmp_find_last_set (struct ntfs_bmp *bmp); -int ntfs_bmp_find_space (struct ntfs_bmp *bmp, LCN start, long size); +int ntfs_bmp_rollback(struct ntfs_bmp *bmp); +int ntfs_bmp_commit(struct ntfs_bmp *bmp); +void ntfs_bmp_free(struct ntfs_bmp *bmp); +struct ntfs_bmp * ntfs_bmp_create(ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len); +int ntfs_bmp_add_data(struct ntfs_bmp *bmp, VCN vcn, u8 *data); +u8 * ntfs_bmp_get_data(struct ntfs_bmp *bmp, VCN vcn); +int ntfs_bmp_set_range(struct ntfs_bmp *bmp, VCN vcn, s64 length, int value); +s64 ntfs_bmp_find_last_set(struct ntfs_bmp *bmp); +int ntfs_bmp_find_space(struct ntfs_bmp *bmp, LCN start, long size); #endif /* NTFS_RICH */ diff --git a/include/ntfs/debug.h b/include/ntfs/debug.h index b8615571..61ac9df7 100644 --- a/include/ntfs/debug.h +++ b/include/ntfs/debug.h @@ -25,26 +25,31 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif + #ifdef HAVE_STDIO_H -# include +#include #endif #ifdef HAVE_STDARG_H -# include +#include #endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_ERRNO_H #include +#endif struct _runlist_element; extern void __Sprintf(const int silent, const char *fmt, ...) - __attribute__ ((format (printf, 2, 3))); + __attribute__((format(printf, 2, 3))); #define Sprintf(silent, f, a...) __Sprintf(silent, f, ##a) #ifdef DEBUG /* Debug output to stderr. To get it run ./configure --enable-debug. */ -extern void __ntfs_debug (const char *file, int line, const char *function, +extern void __ntfs_debug(const char *file, int line, const char *function, const char *format, ...) __attribute__((format(printf, 4, 5))); #define ntfs_debug(f, a...) \ __ntfs_debug(__FILE__, __LINE__, __FUNCTION__, f, ##a) @@ -54,7 +59,7 @@ extern void __ntfs_error(const char *function, #define ntfs_error(sb, f, a...) __ntfs_error(__FUNCTION__, f, ##a) extern void __Dprintf(const char *fmt, ...) - __attribute__ ((format (printf, 1, 2))); + __attribute__((format(printf, 1, 2))); #define Dprintf(f, a...) __Dprintf(f, ##a) extern void __Dputs(const char *s); @@ -63,8 +68,6 @@ extern void __Dputs(const char *s); extern void __Dperror(const char *s); #define Dperror(s) __Dperror(s) -extern void ntfs_debug_runlist_dump(const struct _runlist_element *rl); - #else /* if !DEBUG */ #define ntfs_debug(f, a...) do {} while (0) @@ -74,10 +77,14 @@ extern void ntfs_debug_runlist_dump(const struct _runlist_element *rl); #define Dputs(s) do {} while (0) #define Dperror(s) do {} while (0) -static __inline__ void ntfs_debug_runlist_dump(const struct _runlist_element *rl __attribute__((unused))) {} - #endif /* !DEBUG */ +#ifdef NTFS_DISABLE_DEBUG_LOGGING +static __inline__ void ntfs_debug_runlist_dump(const struct _runlist_element *rl __attribute__((unused))) {} +#else +extern void ntfs_debug_runlist_dump(const struct _runlist_element *rl); +#endif + #define NTFS_BUG(msg) \ { \ int ___i; \ diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index 813f0e9e..fee2dd3c 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -102,13 +102,13 @@ struct ntfs_dir { }; -int ntfs_dir_rollback (struct ntfs_dir *dir); -int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir); -int ntfs_dir_commit (struct ntfs_dir *dir); -void ntfs_dir_free (struct ntfs_dir *dir); -struct ntfs_dir * ntfs_dir_create (ntfs_volume *vol, MFT_REF mft_num); -void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child); -struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, int name_len); +int ntfs_dir_rollback(struct ntfs_dir *dir); +int ntfs_dir_truncate(ntfs_volume *vol, struct ntfs_dir *dir); +int ntfs_dir_commit(struct ntfs_dir *dir); +void ntfs_dir_free(struct ntfs_dir *dir); +struct ntfs_dir * ntfs_dir_create(ntfs_volume *vol, MFT_REF mft_num); +void ntfs_dir_add(struct ntfs_dir *parent, struct ntfs_dir *child); +struct ntfs_dir * ntfs_dir_find2(struct ntfs_dir *dir, ntfschar *name, int name_len); #endif /* NTFS_RICH */ diff --git a/include/ntfs/endians.h b/include/ntfs/endians.h index 27b30064..ec73c442 100644 --- a/include/ntfs/endians.h +++ b/include/ntfs/endians.h @@ -29,7 +29,6 @@ /* * Notes: - * * We define the conversion functions including typecasts since the * defaults don't necessarily perform appropriate typecasts. * Also, using our own functions means that we can change them if it @@ -38,20 +37,21 @@ */ #ifdef HAVE_ENDIAN_H -# include +#include #endif #ifdef HAVE_SYS_ENDIAN_H -# include +#include #endif #ifdef HAVE_MACHINE_ENDIAN_H -# include +#include #endif #ifdef HAVE_SYS_BYTEORDER_H -# include +#include #endif #ifdef HAVE_SYS_PARAM_H -# include +#include #endif + #ifndef __BYTE_ORDER # if defined(_BYTE_ORDER) # define __BYTE_ORDER _BYTE_ORDER diff --git a/include/ntfs/index.h b/include/ntfs/index.h index 20ce386d..756deb98 100644 --- a/include/ntfs/index.h +++ b/include/ntfs/index.h @@ -127,14 +127,14 @@ static inline void ntfs_index_entry_mark_dirty(ntfs_index_context *ictx) #include "layout.h" -void ntfs_ie_free (INDEX_ENTRY *ie); -INDEX_ENTRY * ntfs_ie_create (void); -VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie); -INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie); -INDEX_ENTRY * ntfs_ie_set_vcn (INDEX_ENTRY *ie, VCN vcn); -INDEX_ENTRY * ntfs_ie_remove_vcn (INDEX_ENTRY *ie); -INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype); -INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie); +void ntfs_ie_free(INDEX_ENTRY *ie); +INDEX_ENTRY * ntfs_ie_create(void); +VCN ntfs_ie_get_vcn(INDEX_ENTRY *ie); +INDEX_ENTRY * ntfs_ie_copy(INDEX_ENTRY *ie); +INDEX_ENTRY * ntfs_ie_set_vcn(INDEX_ENTRY *ie, VCN vcn); +INDEX_ENTRY * ntfs_ie_remove_vcn(INDEX_ENTRY *ie); +INDEX_ENTRY * ntfs_ie_set_name(INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype); +INDEX_ENTRY * ntfs_ie_remove_name(INDEX_ENTRY *ie); #endif /* NTFS_RICH */ diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 41fdf242..4c15a60b 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -187,9 +187,9 @@ extern int ntfs_inode_free_space(ntfs_inode *ni, int size); #ifdef NTFS_RICH -int ntfs_inode_close2 (ntfs_inode *ni); -ntfs_inode * ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref); -ntfs_inode * ntfs_inode_open3 (ntfs_volume *vol, const MFT_REF mref); +int ntfs_inode_close2(ntfs_inode *ni); +ntfs_inode * ntfs_inode_open2(ntfs_volume *vol, const MFT_REF mref); +ntfs_inode * ntfs_inode_open3(ntfs_volume *vol, const MFT_REF mref); #endif /* NTFS_RICH */ diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 073e1ae7..3a7e1ecc 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -62,7 +62,7 @@ typedef struct { Required to boot Windows. */ /*0x15*/u32 large_sectors; /* zero */ /* sizeof() = 25 (0x19) bytes */ -} __attribute__ ((__packed__)) BIOS_PARAMETER_BLOCK; +} __attribute__((__packed__)) BIOS_PARAMETER_BLOCK; /* * NTFS boot sector structure. @@ -95,7 +95,7 @@ typedef struct { u16 end_of_sector_marker; /* End of bootsector magic. Always is 0xaa55 in little endian. */ /* sizeof() = 512 (0x200) bytes */ -} __attribute__ ((__packed__)) NTFS_BOOT_SECTOR; +} __attribute__((__packed__)) NTFS_BOOT_SECTOR; /* * Magic identifiers present at the beginning of all ntfs record containing @@ -190,7 +190,7 @@ typedef struct { including the Update Sequence Number (usn), thus the number of fixups is the usa_count minus 1. */ -} __attribute__ ((__packed__)) NTFS_RECORD; +} __attribute__((__packed__)) NTFS_RECORD; /* * System files mft record numbers. All these files are always marked as used @@ -241,7 +241,7 @@ typedef enum { /* * These are the so far known MFT_RECORD_* flags (16-bit) which contain * information about the mft record in which they are present. - * _4 and _8 are needed by $Extend sub-files (don't know what to + * _4 and _8 are needed by $Extend sub-files (don't know what to * call them yet...) */ @@ -251,7 +251,7 @@ typedef enum { MFT_RECORD_IS_4 = const_cpu_to_le16(0x0004), MFT_RECORD_IS_8 = const_cpu_to_le16(0x0008), MFT_REC_SPACE_FILLER = 0xffff /* Just to make flags 16-bit. */ -} __attribute__ ((__packed__)) MFT_RECORD_FLAGS; +} __attribute__((__packed__)) MFT_RECORD_FLAGS; /* * mft references (aka file references or file record segment references) are @@ -390,7 +390,7 @@ typedef struct { * by overwriting it since you then can't get it back... * When reading we obviously use the data from the ntfs record header. */ -} __attribute__ ((__packed__)) MFT_RECORD; +} __attribute__((__packed__)) MFT_RECORD; /* This is the version without the NTFS 3.1+ specific fields. */ typedef struct { @@ -457,7 +457,7 @@ typedef struct { * by overwriting it since you then can't get it back... * When reading we obviously use the data from the ntfs record header. */ -} __attribute__ ((__packed__)) MFT_RECORD_OLD; +} __attribute__((__packed__)) MFT_RECORD_OLD; /* * System defined attributes (32-bit). Each attribute type has a corresponding @@ -599,7 +599,7 @@ typedef struct { /* 90*/ s64 min_size; /* Optional minimum attribute size. */ /* 98*/ s64 max_size; /* Maximum size of attribute. */ /* sizeof() = 0xa0 or 160 bytes */ -} __attribute__ ((__packed__)) ATTR_DEF; +} __attribute__((__packed__)) ATTR_DEF; /* * Attribute flags (16-bit). @@ -611,7 +611,7 @@ typedef enum { illegal value. */ ATTR_IS_ENCRYPTED = const_cpu_to_le16(0x4000), ATTR_IS_SPARSE = const_cpu_to_le16(0x8000), -} __attribute__ ((__packed__)) ATTR_FLAGS; +} __attribute__((__packed__)) ATTR_FLAGS; /* * Attribute compression. @@ -687,7 +687,7 @@ typedef enum { RESIDENT_ATTR_IS_INDEXED = 0x01, /* Attribute is referenced in an index (has implications for deleting and modifying the attribute). */ -} __attribute__ ((__packed__)) RESIDENT_ATTR_FLAGS; +} __attribute__((__packed__)) RESIDENT_ATTR_FLAGS; /* * Attribute record header. Always aligned to 8-byte boundary. @@ -733,7 +733,7 @@ typedef struct { /* 24 */ void *resident_end[0]; /* Use offsetof(ATTR_RECORD, resident_end) to get size of a resident attribute. */ - } __attribute__ ((__packed__)); + } __attribute__((__packed__)); /* Non-resident attributes. */ struct { /* 16*/ VCN lowest_vcn; /* Lowest valid virtual cluster number @@ -790,9 +790,9 @@ typedef struct { /* Use offsetof(ATTR_RECORD, compressed_end) to get size of a compressed attribute. */ /* sizeof(compressed attr) = 72*/ - } __attribute__ ((__packed__)); - } __attribute__ ((__packed__)); -} __attribute__ ((__packed__)) ATTR_RECORD; + } __attribute__((__packed__)); + } __attribute__((__packed__)); +} __attribute__((__packed__)) ATTR_RECORD; typedef ATTR_RECORD ATTR_REC; @@ -848,7 +848,7 @@ typedef enum { us whether this file has a view index present (eg. object id index, quota index, one of the security indexes or the encrypting file system related indexes). */ -} __attribute__ ((__packed__)) FILE_ATTR_FLAGS; +} __attribute__((__packed__)) FILE_ATTR_FLAGS; /* * NOTE on times in NTFS: All times are in MS standard time format, i.e. they @@ -890,7 +890,7 @@ typedef struct { /* 36 */ u8 reserved12[12]; /* Reserved/alignment to 8-byte boundary. */ /* 48 */ void *v1_end[0]; /* Marker for offsetof(). */ - } __attribute__ ((__packed__)); + } __attribute__((__packed__)); /* sizeof() = 48 bytes */ /* NTFS 3.0 */ struct { @@ -944,10 +944,10 @@ typedef struct { journal is a very fast process, so the user won't even notice it. */ /* 72*/ void *v3_end[0]; /* Marker for offsetof(). */ - } __attribute__ ((__packed__)); - } __attribute__ ((__packed__)); + } __attribute__((__packed__)); + } __attribute__((__packed__)); /* sizeof() = 72 bytes (NTFS 3.0) */ -} __attribute__ ((__packed__)) STANDARD_INFORMATION; +} __attribute__((__packed__)) STANDARD_INFORMATION; /* * Attribute: Attribute list (0x20). @@ -1008,7 +1008,7 @@ typedef struct { name_offset to determine the location of the name. */ /* sizeof() = 26 + (attribute_name_length * 2) bytes */ -} __attribute__ ((__packed__)) ATTR_LIST_ENTRY; +} __attribute__((__packed__)) ATTR_LIST_ENTRY; /* * The maximum allowed length for a file name. @@ -1039,7 +1039,7 @@ typedef enum { /* 3 means that both the Win32 and the DOS filenames are identical and hence have been saved in this single filename record. */ -} __attribute__ ((__packed__)) FILE_NAME_TYPE_FLAGS; +} __attribute__((__packed__)) FILE_NAME_TYPE_FLAGS; /* * Attribute: Filename (0x30). @@ -1077,17 +1077,17 @@ typedef struct { pack the extended attributes (EAs), if such are present.*/ /* 3e*/ u16 reserved; /* Reserved for alignment. */ - } __attribute__ ((__packed__)); + } __attribute__((__packed__)); /* 3c*/ u32 reparse_point_tag; /* Type of reparse point, present only in reparse points and only if there are no EAs. */ - } __attribute__ ((__packed__)); + } __attribute__((__packed__)); /* 40*/ u8 file_name_length; /* Length of file name in (Unicode) characters. */ /* 41*/ FILE_NAME_TYPE_FLAGS file_name_type; /* Namespace of the file name.*/ /* 42*/ ntfschar file_name[0]; /* File name in Unicode. */ -} __attribute__ ((__packed__)) FILE_NAME_ATTR; +} __attribute__((__packed__)) FILE_NAME_ATTR; /* * GUID structures store globally unique identifiers (GUID). A GUID is a @@ -1105,7 +1105,7 @@ typedef struct { u8 data4[8]; /* The first two bytes are the third group of four hexadecimal digits. The remaining six bytes are the final 12 hexadecimal digits. */ -} __attribute__ ((__packed__)) GUID; +} __attribute__((__packed__)) GUID; /* * FILE_Extend/$ObjId contains an index named $O. This index contains all @@ -1126,10 +1126,10 @@ typedef struct { GUID birth_volume_id; GUID birth_object_id; GUID domain_id; - } __attribute__ ((__packed__)); + } __attribute__((__packed__)); u8 extended_info[48]; - } __attribute__ ((__packed__)); -} __attribute__ ((__packed__)) OBJ_ID_INDEX_DATA; + } __attribute__((__packed__)); +} __attribute__((__packed__)) OBJ_ID_INDEX_DATA; /* * Attribute: Object id (NTFS 3.0+) (0x40). @@ -1153,10 +1153,10 @@ typedef struct { GUID birth_object_id; /* Unique id of file when it was first created. */ GUID domain_id; /* Reserved, zero. */ - } __attribute__ ((__packed__)); + } __attribute__((__packed__)); u8 extended_info[48]; - } __attribute__ ((__packed__)); -} __attribute__ ((__packed__)) OBJECT_ID_ATTR; + } __attribute__((__packed__)); +} __attribute__((__packed__)) OBJECT_ID_ATTR; /* * The pre-defined IDENTIFIER_AUTHORITIES used as SID_IDENTIFIER_AUTHORITY in @@ -1297,9 +1297,9 @@ typedef union { struct { u16 high_part; /* High 16-bits. */ u32 low_part; /* Low 32-bits. */ - } __attribute__ ((__packed__)); + } __attribute__((__packed__)); u8 value[6]; /* Value as individual bytes. */ -} __attribute__ ((__packed__)) SID_IDENTIFIER_AUTHORITY; +} __attribute__((__packed__)) SID_IDENTIFIER_AUTHORITY; /* * The SID structure is a variable-length structure used to uniquely identify @@ -1332,7 +1332,7 @@ typedef struct { u8 sub_authority_count; SID_IDENTIFIER_AUTHORITY identifier_authority; u32 sub_authority[1]; /* At least one sub_authority. */ -} __attribute__ ((__packed__)) SID; +} __attribute__((__packed__)) SID; /* * Current constants for SIDs. @@ -1370,7 +1370,7 @@ typedef enum { /* This one is for WinNT&2k. */ ACCESS_MAX_MS_ACE_TYPE = 8, -} __attribute__ ((__packed__)) ACE_TYPES; +} __attribute__((__packed__)) ACE_TYPES; /* * The ACE flags (8-bit) for audit and inheritance (see below). @@ -1394,7 +1394,7 @@ typedef enum { /* The audit flags. */ SUCCESSFUL_ACCESS_ACE_FLAG = 0x40, FAILED_ACCESS_ACE_FLAG = 0x80, -} __attribute__ ((__packed__)) ACE_FLAGS; +} __attribute__((__packed__)) ACE_FLAGS; /* * An ACE is an access-control entry in an access-control list (ACL). @@ -1411,7 +1411,7 @@ typedef struct { ACE_TYPES type; /* Type of the ACE. */ ACE_FLAGS flags; /* Flags describing the ACE. */ u16 size; /* Size in bytes of the ACE. */ -} __attribute__ ((__packed__)) ACE_HEADER; +} __attribute__((__packed__)) ACE_HEADER; /* * The access mask (32-bit). Defines the access rights. @@ -1557,7 +1557,7 @@ typedef struct { ACCESS_MASK generic_write; ACCESS_MASK generic_execute; ACCESS_MASK generic_all; -} __attribute__ ((__packed__)) GENERIC_MAPPING; +} __attribute__((__packed__)) GENERIC_MAPPING; /* * The predefined ACE type structures are as defined below. @@ -1574,7 +1574,7 @@ typedef struct { /* 4*/ ACCESS_MASK mask; /* Access mask associated with the ACE. */ /* 8*/ SID sid; /* The SID associated with the ACE. */ -} __attribute__ ((__packed__)) ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, +} __attribute__((__packed__)) ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE; /* @@ -1596,7 +1596,7 @@ typedef struct { /* 12*/ GUID object_type; /* 28*/ GUID inherited_object_type; /* 44*/ SID sid; /* The SID associated with the ACE. */ -} __attribute__ ((__packed__)) ACCESS_ALLOWED_OBJECT_ACE, +} __attribute__((__packed__)) ACCESS_ALLOWED_OBJECT_ACE, ACCESS_DENIED_OBJECT_ACE, SYSTEM_AUDIT_OBJECT_ACE, SYSTEM_ALARM_OBJECT_ACE; @@ -1616,7 +1616,7 @@ typedef struct { u16 ace_count; /* Number of ACEs in the ACL. */ u16 alignment2; /* sizeof() = 8 bytes */ -} __attribute__ ((__packed__)) ACL; +} __attribute__((__packed__)) ACL; /* * Current constants for ACLs. @@ -1697,7 +1697,7 @@ typedef enum { SE_SACL_PROTECTED = const_cpu_to_le16(0x2000), SE_RM_CONTROL_VALID = const_cpu_to_le16(0x4000), SE_SELF_RELATIVE = const_cpu_to_le16(0x8000), -} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_CONTROL; +} __attribute__((__packed__)) SECURITY_DESCRIPTOR_CONTROL; /* * Self-relative security descriptor. Contains the owner and group SIDs as well @@ -1723,7 +1723,7 @@ typedef struct { SE_DACL_PRESENT is set but dacl is NULL, a NULL ACL (unconditionally granting access) is specified. */ /* sizeof() = 0x14 bytes */ -} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_RELATIVE; +} __attribute__((__packed__)) SECURITY_DESCRIPTOR_RELATIVE; /* * Absolute security descriptor. Does not contain the owner and group SIDs, nor @@ -1751,7 +1751,7 @@ typedef struct { SE_DACL_PRESENT is set in the control field. If SE_DACL_PRESENT is set but dacl is NULL, a NULL ACL (unconditionally granting access) is specified. */ -} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR; +} __attribute__((__packed__)) SECURITY_DESCRIPTOR; /* * Current constants for security descriptors. @@ -1825,16 +1825,16 @@ typedef struct { u32 security_id; /* The security_id assigned to the descriptor. */ u64 offset; /* Byte offset of this entry in the $SDS stream. */ u32 length; /* Size in bytes of this entry in $SDS stream. */ -} __attribute__ ((__packed__)) SECURITY_DESCRIPTOR_HEADER; +} __attribute__((__packed__)) SECURITY_DESCRIPTOR_HEADER; typedef struct { u32 hash; /* Hash of the security descriptor. */ - u32 security_id; /* The security_id assigned to the descriptor. */ + u32 security_id; /* The security_id assigned to the descriptor. */ u64 offset_in_sds; /* Offset of the descriptor in SDS data stream */ u32 size_in_sds; /* Size of the descriptor in SDS data stream */ u64 reserved_II; /* Padding - always unicode "II" */ } __attribute__ ((__packed__)) SDH_INDEX_DATA; - + typedef struct { u32 hash; /* Hash of the security descriptor. */ u32 security_id; /* The security_id assigned to the descriptor. */ @@ -1843,7 +1843,7 @@ typedef struct { } __attribute__ ((__packed__)) SII_INDEX_DATA; typedef struct { - u64 owner_id; + u64 owner_id; } __attribute__ ((__packed__)) QUOTA_O_INDEX_DATA; /* @@ -1866,7 +1866,7 @@ typedef struct { u32 length; /* Size in bytes of this entry in $SDS stream. */ /* 20*/ SECURITY_DESCRIPTOR_RELATIVE sid; /* The self-relative security descriptor. */ -} __attribute__ ((__packed__)) SDS_ENTRY; +} __attribute__((__packed__)) SDS_ENTRY; /* * The index entry key used in the $SII index. The collation type is @@ -1874,7 +1874,7 @@ typedef struct { */ typedef struct { u32 security_id; /* The security_id assigned to the descriptor. */ -} __attribute__ ((__packed__)) SII_INDEX_KEY; +} __attribute__((__packed__)) SII_INDEX_KEY; /* * The index entry key used in the $SDH index. The keys are sorted first by @@ -1884,7 +1884,7 @@ typedef struct { typedef struct { u32 hash; /* Hash of the security descriptor. */ u32 security_id; /* The security_id assigned to the descriptor. */ -} __attribute__ ((__packed__)) SDH_INDEX_KEY; +} __attribute__((__packed__)) SDH_INDEX_KEY; /* * Attribute: Volume name (0x60). @@ -1894,7 +1894,7 @@ typedef struct { */ typedef struct { ntfschar name[0]; /* The name of the volume in Unicode. */ -} __attribute__ ((__packed__)) VOLUME_NAME; +} __attribute__((__packed__)) VOLUME_NAME; /* * Possible flags for the volume (16-bit). @@ -1908,7 +1908,7 @@ typedef enum { VOLUME_REPAIR_OBJECT_ID = const_cpu_to_le16(0x0020), VOLUME_MODIFIED_BY_CHKDSK = const_cpu_to_le16(0x8000), VOLUME_FLAGS_MASK = const_cpu_to_le16(0x803f), -} __attribute__ ((__packed__)) VOLUME_FLAGS; +} __attribute__((__packed__)) VOLUME_FLAGS; /* * Attribute: Volume information (0x70). @@ -1923,7 +1923,7 @@ typedef struct { u8 major_ver; /* Major version of the ntfs format. */ u8 minor_ver; /* Minor version of the ntfs format. */ VOLUME_FLAGS flags; /* Bit array of VOLUME_* flags. */ -} __attribute__ ((__packed__)) VOLUME_INFORMATION; +} __attribute__((__packed__)) VOLUME_INFORMATION; /* * Attribute: Data attribute (0x80). @@ -1934,7 +1934,7 @@ typedef struct { */ typedef struct { u8 data[0]; /* The file's data contents. */ -} __attribute__ ((__packed__)) DATA_ATTR; +} __attribute__((__packed__)) DATA_ATTR; /* * Index header flags (8-bit). @@ -1956,7 +1956,7 @@ typedef enum { INDEX_NODE = 1, /* This node indexes other nodes, i.e. is not a leaf node. */ NODE_MASK = 1, /* Mask for accessing the *_NODE bits. */ -} __attribute__ ((__packed__)) INDEX_HEADER_FLAGS; +} __attribute__((__packed__)) INDEX_HEADER_FLAGS; /* * This is the header for indexes, describing the INDEX_ENTRY records, which @@ -1984,7 +1984,7 @@ typedef struct { belongs to. */ INDEX_HEADER_FLAGS flags; /* Bit field of INDEX_HEADER_FLAGS. */ u8 reserved[3]; /* Reserved/align to 8-byte boundary. */ -} __attribute__ ((__packed__)) INDEX_HEADER; +} __attribute__((__packed__)) INDEX_HEADER; /* * Attribute: Index root (0x90). @@ -2026,7 +2026,7 @@ typedef struct { u8 reserved[3]; /* Reserved/align to 8-byte boundary. */ INDEX_HEADER index; /* Index header describing the following index entries. */ -} __attribute__ ((__packed__)) INDEX_ROOT; +} __attribute__((__packed__)) INDEX_ROOT; /* * Attribute: Index allocation (0xa0). @@ -2057,7 +2057,7 @@ typedef struct { * by overwriting it since you then can't get it back... * When reading use the data from the ntfs record header. */ -} __attribute__ ((__packed__)) INDEX_BLOCK; +} __attribute__((__packed__)) INDEX_BLOCK; typedef INDEX_BLOCK INDEX_ALLOCATION; @@ -2074,7 +2074,7 @@ typedef struct { u32 reparse_tag; /* Reparse point type (inc. flags). */ MFT_REF file_id; /* Mft record of the file containing the reparse point attribute. */ -} __attribute__ ((__packed__)) REPARSE_INDEX_KEY; +} __attribute__((__packed__)) REPARSE_INDEX_KEY; /* * Quota flags (32-bit). @@ -2132,7 +2132,7 @@ typedef struct { SID sid; /* The SID of the user/object associated with this quota entry. Equals zero for the quota defaults entry. */ -} __attribute__ ((__packed__)) QUOTA_CONTROL_ENTRY; +} __attribute__((__packed__)) QUOTA_CONTROL_ENTRY; /* * Predefined owner_id values (32-bit). @@ -2156,7 +2156,7 @@ typedef enum { entry does not represent a file but it can point to a sub-node. */ INDEX_ENTRY_SPACE_FILLER = 0xffff, /* Just to force 16-bit width. */ -} __attribute__ ((__packed__)) INDEX_ENTRY_FLAGS; +} __attribute__((__packed__)) INDEX_ENTRY_FLAGS; /* * This the index entry header (see below). @@ -2173,8 +2173,8 @@ typedef struct { index key. */ u16 data_length; /* Data length in bytes. */ u32 reservedV; /* Reserved (zero). */ - } __attribute__ ((__packed__)); - } __attribute__ ((__packed__)); + } __attribute__((__packed__)); + } __attribute__((__packed__)); /* 8*/ u16 length; /* Byte size of this index entry, multiple of 8-bytes. */ /* 10*/ u16 key_length; /* Byte size of the key value, which is in the @@ -2183,7 +2183,7 @@ typedef struct { /* 12*/ INDEX_ENTRY_FLAGS flags; /* Bit field of INDEX_ENTRY_* flags. */ /* 14*/ u16 reserved; /* Reserved/align to 8-byte boundary. */ /* sizeof() = 16 bytes */ -} __attribute__ ((__packed__)) INDEX_ENTRY_HEADER; +} __attribute__((__packed__)) INDEX_ENTRY_HEADER; /* * This is an index entry. A sequence of such entries follows each INDEX_HEADER @@ -2205,8 +2205,8 @@ typedef struct { index key. */ u16 data_length; /* Data length in bytes. */ u32 reservedV; /* Reserved (zero). */ - } __attribute__ ((__packed__)); - } __attribute__ ((__packed__)); + } __attribute__((__packed__)); + } __attribute__((__packed__)); u16 length; /* Byte size of this index entry, multiple of 8-bytes. */ u16 key_length; /* Byte size of the key value, which is in the @@ -2234,7 +2234,7 @@ typedef struct { user_id of the owner of the quota control entry in the data part of the index. */ - } __attribute__ ((__packed__)) key; + } __attribute__((__packed__)) key; /* The (optional) index data is inserted here when creating. */ // VCN vcn; /* If INDEX_ENTRY_NODE bit in flags is set, the last @@ -2249,7 +2249,7 @@ typedef struct { // aligned vcn of INDEX_ENTRY{_HEADER} *ie is given by // (char*)ie + le16_to_cpu(ie->length) - sizeof(VCN), // where sizeof(VCN) can be hardcoded as 8 if wanted. */ -} __attribute__ ((__packed__)) INDEX_ENTRY; +} __attribute__((__packed__)) INDEX_ENTRY; /* * Attribute: Bitmap (0xb0). @@ -2263,7 +2263,7 @@ typedef struct { */ typedef struct { u8 bitmap[0]; /* Array of bits. */ -} __attribute__ ((__packed__)) BITMAP_ATTR; +} __attribute__((__packed__)) BITMAP_ATTR; /* * The reparse point tag defines the type of the reparse point. It also @@ -2316,7 +2316,7 @@ typedef struct { u16 reparse_data_length; /* Byte size of reparse data. */ u16 reserved; /* Align to 8-byte boundary. */ u8 reparse_data[0]; /* Meaning depends on reparse_tag. */ -} __attribute__ ((__packed__)) REPARSE_POINT; +} __attribute__((__packed__)) REPARSE_POINT; /* * Attribute: Extended attribute (EA) information (0xd0). @@ -2333,14 +2333,14 @@ typedef struct { ZwQueryEaFile() in Windows NT/2k. I.e. the byte size of the unpacked extended attributes. */ -} __attribute__ ((__packed__)) EA_INFORMATION; +} __attribute__((__packed__)) EA_INFORMATION; /* * Extended attribute flags (8-bit). */ typedef enum { NEED_EA = 0x80, -} __attribute__ ((__packed__)) EA_FLAGS; +} __attribute__((__packed__)) EA_FLAGS; /* * Attribute: Extended attribute (EA) (0xe0). @@ -2360,7 +2360,7 @@ typedef struct { u8 name[0]; /* Name of the EA. */ u8 value[0]; /* The value of the EA. Immediately follows the name. */ -} __attribute__ ((__packed__)) EA_ATTR; +} __attribute__((__packed__)) EA_ATTR; /* * Attribute: Property set (0xf0). @@ -2370,7 +2370,7 @@ typedef struct { */ typedef struct { /* Irrelevant as feature unused. */ -} __attribute__ ((__packed__)) PROPERTY_SET; +} __attribute__((__packed__)) PROPERTY_SET; /* * Attribute: Logged utility stream (0x100). @@ -2385,7 +2385,7 @@ typedef struct { */ typedef struct { /* Can be anything the creator chooses. */ -} __attribute__ ((__packed__)) LOGGED_UTILITY_STREAM; +} __attribute__((__packed__)) LOGGED_UTILITY_STREAM; /* * $EFS Data Structure: @@ -2430,12 +2430,12 @@ typedef struct { recovery fields (DRF), see below. Zero if no DRFs are present. */ u32 reserved; /* Reserved. */ -} __attribute__ ((__packed__)) EFS_ATTR_HEADER; +} __attribute__((__packed__)) EFS_ATTR_HEADER; typedef struct { u32 df_count; /* Number of data decryption/recovery fields in the array. */ -} __attribute__ ((__packed__)) EFS_DF_ARRAY_HEADER; +} __attribute__((__packed__)) EFS_DF_ARRAY_HEADER; typedef struct { /* 0*/ u32 df_length; /* Length of this data decryption/recovery @@ -2446,7 +2446,7 @@ typedef struct { u32 fek_offset; /* Offset in bytes to the FEK from the start of the data decryption/recovery field. */ /* 16*/ u32 unknown1; /* always 0? Might be just padding. */ -} __attribute__ ((__packed__)) EFS_DF_HEADER; +} __attribute__((__packed__)) EFS_DF_HEADER; typedef struct { /* 0*/ u32 cred_length; /* Length of this credential in bytes. */ @@ -2472,7 +2472,7 @@ typedef struct { structure. */ /* 24*/ u32 public_key_blob_size; /* Size in bytes of public key blob. */ - } __attribute__ ((__packed__)); + } __attribute__((__packed__)); /* Certificate thumbprint. */ struct { /* 12*/ u32 cert_thumbprint_header_size; /* Size in @@ -2483,9 +2483,9 @@ typedef struct { thumbprint from start of this structure. */ u32 unknown1; /* Always 0? Might be padding... */ u32 unknown2; /* Always 0? Might be padding... */ - } __attribute__ ((__packed__)); - } __attribute__ ((__packed__)); -} __attribute__ ((__packed__)) EFS_DF_CREDENTIAL_HEADER; + } __attribute__((__packed__)); + } __attribute__((__packed__)); +} __attribute__((__packed__)) EFS_DF_CREDENTIAL_HEADER; typedef EFS_DF_CREDENTIAL_HEADER EFS_DF_CRED_HEADER; @@ -2503,7 +2503,7 @@ typedef struct { from start of this structure or 0 if no user name present. (This is also known as lpDisplayInformation.) */ -} __attribute__ ((__packed__)) EFS_DF_CERTIFICATE_THUMBPRINT_HEADER; +} __attribute__((__packed__)) EFS_DF_CERTIFICATE_THUMBPRINT_HEADER; typedef EFS_DF_CERTIFICATE_THUMBPRINT_HEADER EFS_DF_CERT_THUMBPRINT_HEADER; diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index 4e361e2f..7bfe5d8f 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -92,7 +92,7 @@ typedef struct { /* 28*/ sle16 major_ver; /* Log file major version. We only support version 1.1. */ /* sizeof() = 30 (0x1e) bytes */ -} __attribute__ ((__packed__)) RESTART_PAGE_HEADER; +} __attribute__((__packed__)) RESTART_PAGE_HEADER; /* * Constant for the log client indices meaning that there are no client records @@ -109,7 +109,7 @@ typedef struct { enum { RESTART_VOLUME_IS_CLEAN = const_cpu_to_le16(0x0002), RESTART_SPACE_FILLER = 0xffff, /* gcc: Force enum bit width to 16. */ -} __attribute__ ((__packed__)); +} __attribute__((__packed__)); typedef le16 RESTART_AREA_FLAGS; @@ -250,7 +250,7 @@ typedef struct { system time in NTFS format (see time.h). */ /* 44*/ le32 reserved; /* Reserved/alignment to 8-byte boundary. */ /* sizeof() = 48 (0x30) bytes */ -} __attribute__ ((__packed__)) RESTART_AREA; +} __attribute__((__packed__)) RESTART_AREA; /* * Log client record. The offset of this record is found by adding the offset @@ -289,7 +289,7 @@ typedef struct { always be "NTFS" with the remaining bytes set to 0. */ /* sizeof() = 160 (0xa0) bytes */ -} __attribute__ ((__packed__)) LOG_CLIENT_RECORD; +} __attribute__((__packed__)) LOG_CLIENT_RECORD; /* * Log page record page header. Each log page begins with this header and is @@ -309,7 +309,7 @@ typedef struct { union { LSN last_lsn; s64 file_offset; - } __attribute__ ((__packed__)) copy; + } __attribute__((__packed__)) copy; u32 flags; u16 page_count; u16 page_position; @@ -318,9 +318,9 @@ typedef struct { u16 next_record_offset; u8 reserved[6]; LSN last_end_lsn; - } __attribute__ ((__packed__)) packed; - } __attribute__ ((__packed__)) header; -} __attribute__ ((__packed__)) RECORD_PAGE_HEADER; + } __attribute__((__packed__)) packed; + } __attribute__((__packed__)) header; +} __attribute__((__packed__)) RECORD_PAGE_HEADER; /* * Possible 16-bit flags for log records. (Or is it log record pages?) @@ -330,7 +330,7 @@ typedef enum { LOG_RECORD_SIZE_PLACE_HOLDER = 0xffff, /* This has nothing to do with the log record. It is only so gcc knows to make the flags 16-bit. */ -} __attribute__ ((__packed__)) LOG_RECORD_FLAGS; +} __attribute__((__packed__)) LOG_RECORD_FLAGS; /* * The log client id structure identifying a log client. @@ -338,7 +338,7 @@ typedef enum { typedef struct { u16 seq_number; u16 client_index; -} __attribute__ ((__packed__)) LOG_CLIENT_ID; +} __attribute__((__packed__)) LOG_CLIENT_ID; /* * Log record header. Each log record seems to have a constant size of 0x70 @@ -374,7 +374,7 @@ typedef struct { is not 0. */ LCN lcn; } __attribute__((__packed__)) lcn_list[0]; -} __attribute__ ((__packed__)) LOG_RECORD; +} __attribute__((__packed__)) LOG_RECORD; extern BOOL ntfs_check_logfile(ntfs_attr *log_na, RESTART_PAGE_HEADER **rp); extern BOOL ntfs_is_logfile_clean(ntfs_attr *log_na, RESTART_PAGE_HEADER *rp); diff --git a/include/ntfs/logging.h b/include/ntfs/logging.h index d1165ea3..25d23409 100644 --- a/include/ntfs/logging.h +++ b/include/ntfs/logging.h @@ -22,7 +22,9 @@ #ifndef _LOGGING_H_ #define _LOGGING_H_ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDARG_H #include @@ -33,8 +35,8 @@ struct ntfs_logging; /* Function prototype for the logging handlers */ -typedef int (logging_handler) (const char *handler, const char *file, int line, - int level, FILE *stream, const char *format, va_list args); +typedef int (ntfs_logging_handler)(const char *function, const char *file, int line, + u32 level, void *data, const char *format, va_list args); /** * struct ntfs_logging - Control info for the logging system @@ -45,69 +47,72 @@ typedef int (logging_handler) (const char *handler, const char *file, int line, struct ntfs_logging { u32 levels; u32 flags; - logging_handler *handler; + ntfs_logging_handler *handler; }; extern struct ntfs_logging ntfs_log; -void ntfs_logging_set_handler (logging_handler *handler); +void ntfs_logging_set_handler(ntfs_logging_handler *handler); /* Enable/disable certain log levels */ -u32 ntfs_logging_set_levels (u32 levels); -u32 ntfs_logging_clear_levels (u32 levels); -u32 ntfs_logging_get_levels (void); +u32 ntfs_logging_set_levels(u32 levels); +u32 ntfs_logging_clear_levels(u32 levels); +u32 ntfs_logging_get_levels(void); /* Enable/disable certain log flags */ -u32 ntfs_logging_set_flags (u32 flags); -u32 ntfs_logging_clear_flags (u32 flags); -u32 ntfs_logging_get_flags (void); +u32 ntfs_logging_set_flags(u32 flags); +u32 ntfs_logging_clear_flags(u32 flags); +u32 ntfs_logging_get_flags(void); -BOOL ntfs_logging_parse_option (const char *option); +BOOL ntfs_logging_parse_option(const char *option); -int ntfs_logging_redirect (const char *handler, const char *file, int line, - int level, FILE *stream, const char *format, ...) - __attribute__ ((format (printf, 6, 7))); +int ntfs_logging_redirect(const char *function, const char *file, int line, + u32 level, void *data, const char *format, ...) + __attribute__((format(printf, 6, 7))); /* Logging handlers */ -logging_handler ntfs_logging_handler_printf __attribute__ ((format (printf, 6, 0))); -logging_handler ntfs_logging_handler_colour __attribute__ ((format (printf, 6, 0))); +ntfs_logging_handler ntfs_logging_handler_printf __attribute__((format(printf, 6, 0))); +ntfs_logging_handler ntfs_logging_handler_colour __attribute__((format(printf, 6, 0))); /* Logging levels - Determine what gets logged */ -#define LOG_LEVEL_DEBUG (1 << 0) /* x = 42 */ -#define LOG_LEVEL_TRACE (1 << 1) /* Entering function x() */ -#define LOG_LEVEL_QUIET (1 << 2) /* Quietable output */ -#define LOG_LEVEL_INFO (1 << 3) /* Volume needs defragmenting */ -#define LOG_LEVEL_VERBOSE (1 << 4) /* Forced to continue */ -#define LOG_LEVEL_PROGRESS (1 << 5) /* 54% complete */ -#define LOG_LEVEL_WARNING (1 << 6) /* You should backup before starting */ -#define LOG_LEVEL_ERROR (1 << 7) /* Operation failed, no damage done */ -#define LOG_LEVEL_PERROR (1 << 8) /* Message : standard error description */ -#define LOG_LEVEL_CRITICAL (1 << 9) /* Operation failed,damage may have occurred */ +#define NTFS_LOG_LEVEL_DEBUG (1 << 0) /* x = 42 */ +#define NTFS_LOG_LEVEL_TRACE (1 << 1) /* Entering function x() */ +#define NTFS_LOG_LEVEL_QUIET (1 << 2) /* Quietable output */ +#define NTFS_LOG_LEVEL_INFO (1 << 3) /* Volume needs defragmenting */ +#define NTFS_LOG_LEVEL_VERBOSE (1 << 4) /* Forced to continue */ +#define NTFS_LOG_LEVEL_PROGRESS (1 << 5) /* 54% complete */ +#define NTFS_LOG_LEVEL_WARNING (1 << 6) /* You should backup before starting */ +#define NTFS_LOG_LEVEL_ERROR (1 << 7) /* Operation failed, no damage done */ +#define NTFS_LOG_LEVEL_PERROR (1 << 8) /* Message : standard error description */ +#define NTFS_LOG_LEVEL_CRITICAL (1 << 9) /* Operation failed,damage may have occurred */ +#define NTFS_LOG_LEVEL_REASON (1 << 10) /* Human readable reason for failure */ /* Logging style flags - Manage the style of the output */ -#define LOG_FLAG_PREFIX (1 << 0) /* Prefix messages with "ERROR: ", etc */ -#define LOG_FLAG_FILENAME (1 << 1) /* Show the file origin of the message */ -#define LOG_FLAG_LINE (1 << 2) /* Show the line number of the message */ -#define LOG_FLAG_FUNCTION (1 << 3) /* Show the function name containing the message */ +#define NTFS_LOG_FLAG_PREFIX (1 << 0) /* Prefix messages with "ERROR: ", etc */ +#define NTFS_LOG_FLAG_FILENAME (1 << 1) /* Show the file origin of the message */ +#define NTFS_LOG_FLAG_LINE (1 << 2) /* Show the line number of the message */ +#define NTFS_LOG_FLAG_FUNCTION (1 << 3) /* Show the function name containing the message */ +#define NTFS_LOG_FLAG_ONLYNAME (1 << 4) /* Only display the filename, not the pathname */ /* Macros to simplify logging. One for each level defined above. - * Note, if DEBUG isn't defined, then log_debug has no effect. + * Note, if NTFS_DISABLE_DEBUG_LOGGING is defined, then ntfs_log_debug/trace have no effect. */ -#define log_crit(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_CRITICAL,NULL,FORMAT,##ARGS) -#define log_error(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_ERROR,NULL,FORMAT,##ARGS) -#define log_info(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_INFO,NULL,FORMAT,##ARGS) -#define log_perror(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_PERROR,NULL,FORMAT,##ARGS) -#define log_progress(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_PROGRESS,NULL,FORMAT,##ARGS) -#define log_quiet(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_QUIET,NULL,FORMAT,##ARGS) -#define log_verbose(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_VERBOSE,NULL,FORMAT,##ARGS) -#define log_warn(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_WARNING,NULL,FORMAT,##ARGS) +#define ntfs_log_critical(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_CRITICAL,NULL,FORMAT,##ARGS) +#define ntfs_log_error(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_ERROR,NULL,FORMAT,##ARGS) +#define ntfs_log_info(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_INFO,NULL,FORMAT,##ARGS) +#define ntfs_log_perror(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_PERROR,NULL,FORMAT,##ARGS) +#define ntfs_log_progress(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_PROGRESS,NULL,FORMAT,##ARGS) +#define ntfs_log_quiet(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_QUIET,NULL,FORMAT,##ARGS) +#define ntfs_log_verbose(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_VERBOSE,NULL,FORMAT,##ARGS) +#define ntfs_log_warning(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_WARNING,NULL,FORMAT,##ARGS) +#define ntfs_log_reason(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_REASON,NULL,FORMAT,##ARGS) #ifdef NTFS_DISABLE_DEBUG_LOGGING -#define log_debug(FORMAT, ARGS...)do {} while (0) -#define log_trace(FORMAT, ARGS...)do {} while (0) +#define ntfs_log_debug(FORMAT, ARGS...)do {} while (0) +#define ntfs_log_trace(FORMAT, ARGS...)do {} while (0) #else -#define log_debug(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_DEBUG,NULL,FORMAT,##ARGS) -#define log_trace(FORMAT, ARGS...) ntfs_logging_redirect (__FUNCTION__,__FILE__,__LINE__,LOG_LEVEL_TRACE,NULL,FORMAT,##ARGS) +#define ntfs_log_debug(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_DEBUG,NULL,FORMAT,##ARGS) +#define ntfs_log_trace(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_TRACE,NULL,FORMAT,##ARGS) #endif /* NTFS_DISABLE_DEBUG_LOGGING */ #endif /* _LOGGING_H_ */ diff --git a/include/ntfs/mft.h b/include/ntfs/mft.h index 00d2088f..4d811e79 100644 --- a/include/ntfs/mft.h +++ b/include/ntfs/mft.h @@ -116,11 +116,11 @@ extern int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni); #include "bitmap.h" #include "dir.h" -int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES type); -ATTR_RECORD * ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int data_len); -int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len, u8 *data, int data_len); -int ntfs_mft_free_space (struct ntfs_dir *dir); -int ntfs_mft_add_index (struct ntfs_dir *dir); +int ntfs_mft_remove_attr(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES type); +ATTR_RECORD * ntfs_mft_add_attr(ntfs_inode *inode, ATTR_TYPES type, u8 *data, int data_len); +int ntfs_mft_resize_resident(ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len, u8 *data, int data_len); +int ntfs_mft_free_space(struct ntfs_dir *dir); +int ntfs_mft_add_index(struct ntfs_dir *dir); #endif /* NTFS_RICH */ diff --git a/include/ntfs/ntfstime.h b/include/ntfs/ntfstime.h index 85d8a53c..e0d1ae20 100644 --- a/include/ntfs/ntfstime.h +++ b/include/ntfs/ntfstime.h @@ -23,7 +23,9 @@ #ifndef _NTFS_NTFSTIME_H #define _NTFS_NTFSTIME_H +#ifdef HAVE_TIME_H #include +#endif #include "types.h" diff --git a/include/ntfs/rich.h b/include/ntfs/rich.h index e07451a7..48400e7e 100644 --- a/include/ntfs/rich.h +++ b/include/ntfs/rich.h @@ -1,4 +1,4 @@ -/** +/* * rich.h - Temporary junk file. Part of the Linux-NTFS project. * * Copyright (c) 2004-2005 Richard Russon @@ -40,11 +40,11 @@ #define ROUND_DOWN(num,bound) ((num) & ~((bound)-1)) #define ATTR_SIZE(s) ROUND_UP(s,8) -ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); -ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft); -int utils_free_non_residents3 (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECORD *attr); -int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp); -void ntfs_name_print (ntfschar *name, int name_len); +ATTR_RECORD * find_attribute(const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); +ATTR_RECORD * find_first_attribute(const ATTR_TYPES type, MFT_RECORD *mft); +int utils_free_non_residents3(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECORD *attr); +int utils_free_non_residents2(ntfs_inode *inode, struct ntfs_bmp *bmp); +void ntfs_name_print(ntfschar *name, int name_len); #endif /* _NTFS_RICH_H_ */ diff --git a/include/ntfs/runlist.h b/include/ntfs/runlist.h index 1d48a433..d821f311 100644 --- a/include/ntfs/runlist.h +++ b/include/ntfs/runlist.h @@ -80,7 +80,7 @@ extern int ntfs_rl_sparse(runlist *rl); extern s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl); #ifdef NTFS_TEST -int test_rl_main (int argc, char *argv[]); +int test_rl_main(int argc, char *argv[]); #endif #endif /* defined _NTFS_RUNLIST_H */ diff --git a/include/ntfs/support.h b/include/ntfs/support.h index b02390bf..1c295672 100644 --- a/include/ntfs/support.h +++ b/include/ntfs/support.h @@ -26,7 +26,9 @@ #include "config.h" #endif +#ifdef HAVE_STDDEF_H #include +#endif /* * Generic macro to convert pointers to values for comparison purposes. diff --git a/include/ntfs/tree.h b/include/ntfs/tree.h index 76dda3b0..d7960663 100644 --- a/include/ntfs/tree.h +++ b/include/ntfs/tree.h @@ -1,4 +1,4 @@ -/** +/* * tree.h - Directory tree handling code. Part of the Linux-NTFS project. * * Copyright (c) 2004-2005 Richard Russon @@ -45,38 +45,38 @@ struct ntfs_dt { }; -void ntfs_dt_free (struct ntfs_dt *dt); -int ntfs_dt_rollback (struct ntfs_dt *dt); -int ntfs_dt_commit (struct ntfs_dt *dt); -BOOL ntfs_dt_create_children2 (struct ntfs_dt *dt, int count); -BOOL ntfs_dt_resize_children3 (struct ntfs_dt *dt, int new); -int ntfs_dt_root_count (struct ntfs_dt *dt); -int ntfs_dt_alloc_count (struct ntfs_dt *dt); -int ntfs_dt_initialise2 (ntfs_volume *vol, struct ntfs_dt *dt); -struct ntfs_dt * ntfs_dt_create (struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn); -MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len); -struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num); -struct ntfs_dt * ntfs_dt_find3 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num); -struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num); -void ntfs_dt_find_all (struct ntfs_dt *dt); -int ntfs_dt_find_parent (struct ntfs_dt *dt); -BOOL ntfs_dt_isroot (struct ntfs_dt *dt); -int ntfs_dt_root_freespace (struct ntfs_dt *dt); -int ntfs_dt_alloc_freespace (struct ntfs_dt *dt); -int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start, int count); -int ntfs_dt_alloc_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count); -INDEX_ENTRY * ntfs_dt_alloc_insert2 (struct ntfs_dt *dt, int before, int count, int bytes); -int ntfs_dt_root_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count); -int ntfs_dt_alloc_remove2 (struct ntfs_dt *dt, int start, int count); -int ntfs_dt_root_remove2 (struct ntfs_dt *dt, int start, int count); -int ntfs_dt_transfer2 (struct ntfs_dt *old, struct ntfs_dt *new, int start, int count); -int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie); -BOOL ntfs_dt_alloc_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie); -BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num); -BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num); -int ntfs_dt_alloc_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child); -int ntfs_dt_root_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child); -int ntfs_dt_add2 (INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs_dt *ded); +void ntfs_dt_free(struct ntfs_dt *dt); +int ntfs_dt_rollback(struct ntfs_dt *dt); +int ntfs_dt_commit(struct ntfs_dt *dt); +BOOL ntfs_dt_create_children2(struct ntfs_dt *dt, int count); +BOOL ntfs_dt_resize_children3(struct ntfs_dt *dt, int new); +int ntfs_dt_root_count(struct ntfs_dt *dt); +int ntfs_dt_alloc_count(struct ntfs_dt *dt); +int ntfs_dt_initialise2(ntfs_volume *vol, struct ntfs_dt *dt); +struct ntfs_dt * ntfs_dt_create(struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn); +MFT_REF ntfs_dt_find(struct ntfs_dt *dt, ntfschar *name, int name_len); +struct ntfs_dt * ntfs_dt_find2(struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num); +struct ntfs_dt * ntfs_dt_find3(struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num); +struct ntfs_dt * ntfs_dt_find4(struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num); +void ntfs_dt_find_all(struct ntfs_dt *dt); +int ntfs_dt_find_parent(struct ntfs_dt *dt); +BOOL ntfs_dt_isroot(struct ntfs_dt *dt); +int ntfs_dt_root_freespace(struct ntfs_dt *dt); +int ntfs_dt_alloc_freespace(struct ntfs_dt *dt); +int ntfs_dt_transfer(struct ntfs_dt *old, struct ntfs_dt *new, int start, int count); +int ntfs_dt_alloc_insert(struct ntfs_dt *dt, INDEX_ENTRY *first, int count); +INDEX_ENTRY * ntfs_dt_alloc_insert2(struct ntfs_dt *dt, int before, int count, int bytes); +int ntfs_dt_root_insert(struct ntfs_dt *dt, INDEX_ENTRY *first, int count); +int ntfs_dt_alloc_remove2(struct ntfs_dt *dt, int start, int count); +int ntfs_dt_root_remove2(struct ntfs_dt *dt, int start, int count); +int ntfs_dt_transfer2(struct ntfs_dt *old, struct ntfs_dt *new, int start, int count); +int ntfs_dt_root_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie); +BOOL ntfs_dt_alloc_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie); +BOOL ntfs_dt_root_remove(struct ntfs_dt *del, int del_num); +BOOL ntfs_dt_alloc_remove(struct ntfs_dt *del, int del_num); +int ntfs_dt_alloc_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child); +int ntfs_dt_root_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child); +int ntfs_dt_add2(INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs_dt *ded); #endif /* _NTFS_TREE_H_ */ diff --git a/include/ntfs/types.h b/include/ntfs/types.h index e1ebbae6..fa49fc7a 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -30,7 +30,9 @@ #if HAVE_STDINT_H || !HAVE_CONFIG_H #include #endif +#ifdef HAVE_SYS_TYPES_H #include +#endif typedef uint8_t u8; /* Unsigned types of an exact size */ typedef uint16_t u16; diff --git a/include/ntfs/version.h b/include/ntfs/version.h index 27e62fdd..ec6dbdca 100644 --- a/include/ntfs/version.h +++ b/include/ntfs/version.h @@ -1,4 +1,4 @@ -/** +/* * version.h - Info about the NTFS library. Part of the Linux-NTFS project. * * Copyright (c) 2005 Anton Altaparmakov diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 17d1828c..4c428d29 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -28,15 +28,17 @@ #include "config.h" #endif +#ifdef HAVE_STDIO_H #include +#endif #ifdef HAVE_SYS_PARAM_H -# include +#include #endif #ifdef HAVE_SYS_MOUNT_H -# include +#include #endif #ifdef HAVE_MNTENT_H -# include +#include #endif /* Both under Cygwin and DJGPP we do not have MS_RDONLY, so we define it. */ @@ -206,12 +208,12 @@ extern int ntfs_volume_write_flags(ntfs_volume *v, const u16 flags); #ifdef NTFS_RICH -int ntfs_volume_commit (ntfs_volume *vol); -int ntfs_volume_rollback (ntfs_volume *vol); -int ntfs_volume_umount2 (ntfs_volume *vol, const BOOL force); -ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL force); -int utils_valid_device (const char *name, int force); -ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force); +int ntfs_volume_commit(ntfs_volume *vol); +int ntfs_volume_rollback(ntfs_volume *vol); +int ntfs_volume_umount2(ntfs_volume *vol, const BOOL force); +ntfs_volume * ntfs_volume_mount2(const char *device, unsigned long flags, BOOL force); +int utils_valid_device(const char *name, int force); +ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL force); #endif /* NTFS_RICH */ diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 3a8b4d26..a4366143 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1,8 +1,8 @@ -/* +/** * attrib.c - Attribute handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000-2005 Anton Altaparmakov - * Copyright (c) 2002 Richard Russon + * Copyright (c) 2002-2005 Richard Russon * Copyright (c) 2004-2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or @@ -21,7 +21,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDIO_H #include @@ -37,7 +39,6 @@ #endif #include "compat.h" - #include "attrib.h" #include "attrlist.h" #include "device.h" @@ -53,6 +54,7 @@ #include "dir.h" #include "compress.h" #include "bitmap.h" +#include "logging.h" ntfschar AT_UNNAMED[] = { const_cpu_to_le16('\0') }; @@ -91,8 +93,8 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, } /* Complex attribute? */ if (a->flags) { - Dputs("Encountered non-zero attribute flags. Cannot handle " - "this yet."); + ntfs_log_debug("Encountered non-zero attribute flags. Cannot handle " + "this yet.\n"); errno = EOPNOTSUPP; return 0; } @@ -160,8 +162,8 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, intbuf = malloc(rl[i].length << vol->cluster_size_bits); if (!intbuf) { int eo = errno; - perror("Couldn't allocate memory for internal " - "buffer.\n"); + ntfs_log_perror("Couldn't allocate memory for " + "internal buffer."); free(rl); errno = eo; return 0; @@ -184,14 +186,14 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, #define ESTR "Error reading attribute value" if (r == -1) { int eo = errno; - perror(ESTR); + ntfs_log_perror(ESTR); errno = eo; } else if (r < rl[i].length << vol->cluster_size_bits) { - Dputs(ESTR ": Ran out of input data."); + ntfs_log_debug(ESTR ": Ran out of input data.\n"); errno = EIO; } else { - Dputs(ESTR ": unknown error"); + ntfs_log_debug(ESTR ": unknown error\n"); errno = EIO; } #undef ESTR @@ -222,13 +224,13 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, #define ESTR "Error reading attribute value" if (r == -1) { int eo = errno; - perror(ESTR); + ntfs_log_perror(ESTR); errno = eo; } else if (r < rl[i].length << vol->cluster_size_bits) { - Dputs(ESTR ": Ran out of input data."); + ntfs_log_debug(ESTR ": Ran out of input data.\n"); errno = EIO; } else { - Dputs(ESTR ": unknown error"); + ntfs_log_debug(ESTR ": unknown error\n"); errno = EIO; } #undef ESTR @@ -338,8 +340,8 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, int err; BOOL cs; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, - (unsigned long long)ni->mft_no, type); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x.\n", + (unsigned long long)ni->mft_no, type); if (!ni || !ni->vol || !ni->mrec) { errno = EINVAL; return NULL; @@ -445,9 +447,8 @@ int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn) ntfs_attr_search_ctx *ctx; int err; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, vcn 0x%llx.\n", - __FUNCTION__, (unsigned long long)na->ni->mft_no, - na->type, (long long)vcn); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, vcn 0x%llx.\n", + (unsigned long long)na->ni->mft_no, na->type, (long long)vcn); lcn = ntfs_rl_vcn_to_lcn(na->rl, vcn); if (lcn >= 0 || lcn == LCN_HOLE || lcn == LCN_ENOENT) @@ -498,7 +499,7 @@ int ntfs_attr_map_whole_runlist(ntfs_attr *na) ATTR_RECORD *a; int err; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x.\n", (unsigned long long)na->ni->mft_no, na->type); ctx = ntfs_attr_get_search_ctx(na->ni, NULL); @@ -533,10 +534,8 @@ int ntfs_attr_map_whole_runlist(ntfs_attr *na) /* Are we in the first extent? */ if (!next_vcn) { if (a->lowest_vcn) { - Dprintf("%s(): First extent of attribute " - "has non zero lowest_vcn. " - "Inode is corrupt.\n", - __FUNCTION__); + ntfs_log_trace("First extent of attribute has non " + "zero lowest_vcn. Inode is corrupt.\n"); errno = EIO; goto err_out; } @@ -557,8 +556,8 @@ int ntfs_attr_map_whole_runlist(ntfs_attr *na) /* Avoid endless loops due to corruption. */ if (next_vcn < sle64_to_cpu(a->lowest_vcn)) { - Dprintf("%s(): Inode has corrupt attribute list " - "attribute.\n", __FUNCTION__); + ntfs_log_trace("Inode has corrupt attribute list " + "attribute.\n"); errno = EIO; goto err_out; } @@ -566,20 +565,17 @@ int ntfs_attr_map_whole_runlist(ntfs_attr *na) if (!a) { err = errno; if (err == ENOENT) - Dprintf("%s(): Attribute not found. Inode is " - "corrupt.\n", __FUNCTION__); + ntfs_log_trace("Attribute not found. Inode is corrupt.\n"); else - Dprintf("%s(): Inode is corrupt.\n", __FUNCTION__); + ntfs_log_trace("Inode is corrupt.\n"); errno = err; goto err_out; } if (highest_vcn && highest_vcn != last_vcn - 1) { - Dprintf("%s(): Failed to load the complete run list for the " - "attribute. Bug or corrupt inode.\n", - __FUNCTION__); - Dprintf("%s(): highest_vcn = 0x%llx, last_vcn - 1 = 0x%llx\n", - __FUNCTION__, (long long)highest_vcn, - (long long)last_vcn - 1); + ntfs_log_trace("Failed to load the complete run list for the " + "attribute. Bug or corrupt inode.\n"); + ntfs_log_trace("highest_vcn = 0x%llx, last_vcn - 1 = 0x%llx\n", + (long long)highest_vcn, (long long)last_vcn - 1); errno = EIO; goto err_out; } @@ -743,10 +739,9 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) ntfs_volume *vol; runlist_element *rl; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, " - "count 0x%llx.\n", __FUNCTION__, - (unsigned long long)na->ni->mft_no, na->type, - (long long)pos, (long long)count); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, count " + "0x%llx.\n", (unsigned long long)na->ni->mft_no, + na->type, (long long)pos, (long long)count); if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) { errno = EINVAL; return -1; @@ -861,9 +856,8 @@ res_err_out: to_read = min(count, (rl->length << vol->cluster_size_bits) - ofs); retry: - Dprintf("%s(): Reading 0x%llx bytes from vcn 0x%llx, " - "lcn 0x%llx, ofs 0x%llx.\n", __FUNCTION__, - to_read, rl->vcn, rl->lcn, ofs); + ntfs_log_trace("Reading 0x%llx bytes from vcn 0x%llx, lcn 0x%llx, " + "ofs 0x%llx.\n", to_read, rl->vcn, rl->lcn, ofs); br = ntfs_pread(vol->dev, (rl->lcn << vol->cluster_size_bits) + ofs, to_read, b); /* If everything ok, update progress counters and continue. */ @@ -923,9 +917,9 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) unsigned int update_mapping_pairs : 1; } need_to = { 0, 0, 0 }; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, " - "count 0x%llx.\n", __FUNCTION__, na->ni->mft_no, - na->type, (long long)pos, (long long)count); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, count " + "0x%llx.\n", na->ni->mft_no, na->type, (long long)pos, + (long long)count); if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) { errno = EINVAL; return -1; @@ -954,8 +948,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) if (pos + count > na->data_size) { if (ntfs_attr_truncate(na, pos + count)) { eo = errno; - Dprintf("%s(): Attribute extend failed.\n", - __FUNCTION__); + ntfs_log_trace("Attribute extend failed.\n"); errno = eo; return -1; } @@ -1026,8 +1019,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) buf = malloc(NTFS_BUF_SIZE); if (!buf) { err = errno; - Dprintf("%s(): Not enough memory.\n", - __FUNCTION__); + ntfs_log_trace("Not enough memory.\n"); errno = err; goto err_out; } @@ -1039,9 +1031,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) to_write, buf); if (written <= 0) { err = errno; - Dprintf("%s(): Failed to zero space " - "between initialized size and " - "@pos.\n", __FUNCTION__); + ntfs_log_trace("Failed to zero space between " + "initialized size and @pos.\n"); free(buf); errno = err; goto err_out; @@ -1147,8 +1138,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) /* The buffer is non zero, instantiate the hole. */ cur_vcn = rl->vcn; from_vcn = rl->vcn + (ofs >> vol->cluster_size_bits); - Dprintf("%s(): Instantiate the hole with vcn 0x%llx.\n", - __FUNCTION__, cur_vcn); + ntfs_log_trace("Instantiate the hole with vcn 0x%llx.\n", + cur_vcn); /* * Search backwards to find the best lcn to start * seek from. @@ -1182,8 +1173,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) lcn_seek_from, DATA_ZONE); if (!rlc) { eo = errno; - Dprintf("%s(): Failed to allocate clusters for " - "hole instantiating.\n", __FUNCTION__); + ntfs_log_trace("Failed to allocate clusters for hole " + "instantiating.\n"); errno = eo; goto err_out; } @@ -1191,13 +1182,11 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) rl = ntfs_runlists_merge(na->rl, rlc); if (!rl) { eo = errno; - Dprintf("%s(): Failed to merge runlists.\n", - __FUNCTION__); + ntfs_log_trace("Failed to merge runlists.\n"); if (ntfs_cluster_free_from_rl(vol, rlc)) { - Dprintf("%s(): Failed to free just " + ntfs_log_trace("Failed to free just " "allocated clusters. Leaving " - "inconstant metadata. " - "Run chkdsk", __FUNCTION__); + "inconstant metadata. Run chkdsk"); } errno = eo; goto err_out; @@ -1211,10 +1200,9 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) * @cur_vcn, because we missed it during * instantiating of the hole. */ - Dprintf("%s(): BUG! Failed to find run after " - "instantiating. Please report to the " - "linux-ntfs-dev@lists.sf.net.\n", - __FUNCTION__); + ntfs_log_trace("BUG! Failed to find run after " + "instantiating. Please report " + "to the linux-ntfs-dev@lists.sf.net.\n"); errno = EIO; goto err_out; } @@ -1223,10 +1211,9 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) rl++; /* Now LCN shoudn't be less than 0. */ if (rl->lcn < 0) { - Dprintf("%s(): BUG! LCN is lesser than 0. " - "Please report to the " - "linux-ntfs-dev@lists.sf.net." - "\n", __FUNCTION__); + ntfs_log_trace("BUG! LCN is lesser than 0. Please " + "report to the " + "linux-ntfs-dev@lists.sf.net.\n"); errno = EIO; goto err_out; } @@ -1239,9 +1226,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) buf = malloc(ofs); if (!buf) { - Dprintf("%s(): Not enough memory to " - "allocate %lld bytes.\n", - __FUNCTION__, ofs); + ntfs_log_trace("Not enough memory to " + "allocate %lld bytes.\n", ofs); errno = ENOMEM; goto err_out; } @@ -1250,8 +1236,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) vol->cluster_size_bits, ofs, buf) < 0) { eo = errno; - Dprintf("%s(): Failed to zero area.\n", - __FUNCTION__); + ntfs_log_trace("Failed to zero area.\n"); free(buf); errno = eo; goto err_out; @@ -1279,9 +1264,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) to_write = min(count, (rl->length << vol->cluster_size_bits) - ofs); retry: - Dprintf("%s(): Writing 0x%llx bytes to vcn 0x%llx, lcn 0x%llx, " - "ofs 0x%llx.\n", __FUNCTION__, to_write, - rl->vcn, rl->lcn, ofs); + ntfs_log_trace("Writing 0x%llx bytes to vcn 0x%llx, lcn 0x%llx, ofs " + "0x%llx.\n", to_write, rl->vcn, rl->lcn, ofs); if (!NVolReadOnly(vol)) written = ntfs_pwrite(vol->dev, (rl->lcn << vol->cluster_size_bits) + ofs, @@ -1349,9 +1333,8 @@ err_out: } } if (err) { - Dputs("Eeek! Failed to recover from error. Leaving " - "metadata in inconsistent state! Run " - "chkdsk!"); + ntfs_log_debug("Eeek! Failed to recover from error. Leaving " + "metadata in inconsistent state! Run chkdsk!\n"); // FIXME: At this stage could try to recover by filling // old_initialized_size -> new_initialized_size with // data or at least zeroes. (AIA) @@ -1364,7 +1347,7 @@ err_out: ntfs_attr_update_mapping_pairs(na); /* Restore original data_size if needed. */ if (need_to.undo_data_size && ntfs_attr_truncate(na, old_data_size)) - Dprintf("%s(): Failed to restore data_size.\n", __FUNCTION__); + ntfs_log_trace("Failed to restore data_size.\n"); errno = eo; return -1; } @@ -1404,9 +1387,9 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, s64 br; u8 *end; - Dprintf("%s(): Entering for inode 0x%llx, attr type 0x%x, pos 0x%llx.\n", - __FUNCTION__, (unsigned long long)na->ni->mft_no, - na->type, (long long)pos); + ntfs_log_trace("Entering for inode 0x%llx, attr type 0x%x, pos 0x%llx.\n", + (unsigned long long)na->ni->mft_no, na->type, + (long long)pos); if (bk_cnt < 0 || bk_size % NTFS_BLOCK_SIZE) { errno = EINVAL; return -1; @@ -1456,9 +1439,9 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, { s64 written, i; - Dprintf("%s(): Entering for inode 0x%llx, attr type 0x%x, pos 0x%llx.\n", - __FUNCTION__, (unsigned long long)na->ni->mft_no, - na->type, (long long)pos); + ntfs_log_trace("Entering for inode 0x%llx, attr type 0x%x, pos 0x%llx.\n", + (unsigned long long)na->ni->mft_no, na->type, + (long long)pos); if (bk_cnt < 0 || bk_size % NTFS_BLOCK_SIZE) { errno = EINVAL; return -1; @@ -1689,7 +1672,7 @@ static int ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, } } } - Dputs("ntfs_attr_find(): File is corrupt. Run chkdsk."); + ntfs_log_debug("ntfs_attr_find(): File is corrupt. Run chkdsk.\n"); errno = EIO; return -1; } @@ -1782,8 +1765,8 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const ntfschar *name, ni = ctx->ntfs_ino; base_ni = ctx->base_ntfs_ino; - Dprintf("%s(): Entering for inode 0x%llx, attribute type 0x%x.\n", - __FUNCTION__, (unsigned long long)ni->mft_no, type); + ntfs_log_trace("Entering for inode 0x%llx, attribute type 0x%x.\n", + (unsigned long long)ni->mft_no, type); if (!base_ni) { /* First call happens with the base mft record. */ base_ni = ctx->base_ntfs_ino = ctx->ntfs_ino; @@ -1866,9 +1849,8 @@ find_attr_list_attr: return rc; /* Not found?!? Absurd! Must be a bug... )-: */ - Dprintf("%s(): BUG! Attribute list attribute not found " - "but it exists! Returning error " - "(EINVAL).\n", __FUNCTION__); + ntfs_log_trace("BUG! Attribute list attribute not found but " + "it exists! Returning error (EINVAL).\n"); errno = EINVAL; return -1; } @@ -1970,8 +1952,8 @@ is_enumeration: if (MSEQNO_LE(al_entry->mft_reference) != le16_to_cpu( ni->mrec->sequence_number)) { - Dputs("Found stale mft reference in attribute " - "list!"); + ntfs_log_debug("Found stale mft reference in " + "attribute list!\n"); break; } } else { /* Mft references do not match. */ @@ -1985,7 +1967,7 @@ is_enumeration: ni = ntfs_extent_inode_open(base_ni, al_entry->mft_reference); if (!ni) { - Dperror("Failed to map extent inode"); + ntfs_log_perror("Failed to map extent inode"); break; } ctx->ntfs_ino = ni; @@ -2059,7 +2041,7 @@ do_next_attr: ctx->mrec = ctx->base_mrec; ctx->attr = ctx->base_attr; } - Dputs("Inode is corrupt."); + ntfs_log_debug("Inode is corrupt.\n"); errno = EIO; return -1; not_found: @@ -2296,7 +2278,6 @@ ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec) void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) { free(ctx); - return; } /** @@ -2470,8 +2451,8 @@ int ntfs_make_room_for_attr(MFT_RECORD *m, u8 *pos, u32 size) { u32 biu; - Dprintf("%s(): Entering for pos 0x%d, size %u.\n", - __FUNCTION__, (int)(pos - (u8*)m), (unsigned) size); + ntfs_log_trace("Entering for pos 0x%d, size %u.\n", + (int)(pos - (u8*)m), (unsigned) size); /* Make size 8-byte alignment. */ size = (size + 7) & ~7; @@ -2532,9 +2513,8 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, int err, offset; ntfs_inode *base_ni; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, flags 0x%x.\n", - __FUNCTION__, (long long) ni->mft_no, (unsigned) type, - (unsigned) flags); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, flags 0x%x.\n", + (long long) ni->mft_no, (unsigned) type, (unsigned) flags); if (!ni || (!name && name_len)) { errno = EINVAL; @@ -2544,11 +2524,9 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, if (ntfs_attr_can_be_resident(ni->vol, type)) { err = errno; if (errno == EPERM) - Dprintf("%s(): Attribute can't be resident.\n", - __FUNCTION__); + ntfs_log_trace("Attribute can't be resident.\n"); else - Dprintf("%s(): ntfs_attr_can_be_resident failed.\n", - __FUNCTION__); + ntfs_log_trace("ntfs_attr_can_be_resident failed.\n"); errno = err; return -1; } @@ -2565,7 +2543,7 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, if (!ntfs_attr_find(type, name, name_len, CASE_SENSITIVE, val, size, ctx)) { err = EEXIST; - Dprintf("%s(): Attribute already present.\n", __FUNCTION__); + ntfs_log_trace("Attribute already present.\n"); goto put_err_out; } if (errno != ENOENT) { @@ -2581,8 +2559,7 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ((size + 7) & ~7); if (ntfs_make_room_for_attr(ctx->mrec, (u8*) ctx->attr, length)) { err = errno; - Dprintf("%s(): Failed to make room for attribute.\n", - __FUNCTION__); + ntfs_log_trace("Failed to make room for attribute.\n"); goto put_err_out; } @@ -2618,8 +2595,8 @@ int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, if (ntfs_attrlist_entry_add(ni, a)) { err = errno; ntfs_attr_record_resize(m, a, 0); - Dprintf("%s(): Failed add attribute entry to " - "ATTRIBUTE_LIST.\n", __FUNCTION__); + ntfs_log_trace("Failed add attribute entry to " + "ATTRIBUTE_LIST.\n"); goto put_err_out; } } @@ -2661,10 +2638,10 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, ntfs_inode *base_ni; int err, offset; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn %lld, " - "dataruns_size %d, flags 0x%x.\n", __FUNCTION__, - (long long) ni->mft_no, (unsigned) type, (long long) lowest_vcn, - dataruns_size, (unsigned) flags); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, lowest_vcn %lld, " + "dataruns_size %d, flags 0x%x.\n", + (long long) ni->mft_no, (unsigned) type, + (long long) lowest_vcn, dataruns_size, (unsigned) flags); if (!ni || dataruns_size <= 0 || (!name && name_len)) { errno = EINVAL; @@ -2674,11 +2651,9 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, if (ntfs_attr_can_be_non_resident(ni->vol, type)) { err = errno; if (errno == EPERM) - Dprintf("%s(): Attribute can't be non resident.\n", - __FUNCTION__); + ntfs_log_trace("Attribute can't be non resident.\n"); else - Dprintf("%s(): ntfs_attr_can_be_non_resident failed.\n", - __FUNCTION__); + ntfs_log_trace("ntfs_attr_can_be_non_resident failed.\n"); errno = err; return -1; } @@ -2695,7 +2670,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, if (!ntfs_attr_find(type, name, name_len, CASE_SENSITIVE, NULL, 0, ctx)) { err = EEXIST; - Dprintf("%s(): Attribute already present.\n", __FUNCTION__); + ntfs_log_trace("Attribute already present.\n"); goto put_err_out; } if (errno != ENOENT) { @@ -2713,8 +2688,7 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, sizeof(a->compressed_size) : 0); if (ntfs_make_room_for_attr(ctx->mrec, (u8*) ctx->attr, length)) { err = errno; - Dprintf("%s(): Failed to make room for attribute.\n", - __FUNCTION__); + ntfs_log_trace("Failed to make room for attribute.\n"); goto put_err_out; } @@ -2753,8 +2727,8 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, if (ntfs_attrlist_entry_add(ni, a)) { err = errno; ntfs_attr_record_resize(m, a, 0); - Dprintf("%s(): Failed add attribute entry to " - "ATTRIBUTE_LIST.\n", __FUNCTION__); + ntfs_log_trace("Failed add attribute entry to " + "ATTRIBUTE_LIST.\n"); goto put_err_out; } } @@ -2768,8 +2742,8 @@ int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type, if (ntfs_attr_lookup(type, name, name_len, CASE_SENSITIVE, lowest_vcn, NULL, 0, ctx)) { err = errno; - Dprintf("%s(): Attribute lookup failed. Probably leaving " - "inconstant metadata.\n", __FUNCTION__); + ntfs_log_trace("Attribute lookup failed. Probably leaving inconstant " + "metadata.\n"); ntfs_attr_put_search_ctx(ctx); errno = err; return -1; @@ -2807,9 +2781,9 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) return -1; } - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", - __FUNCTION__, (long long) ctx->ntfs_ino->mft_no, - (unsigned) le32_to_cpu(ctx->attr->type)); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x.\n", + (long long) ctx->ntfs_ino->mft_no, + (unsigned) le32_to_cpu(ctx->attr->type)); type = ctx->attr->type; ni = ctx->ntfs_ino; if (ctx->base_ntfs_ino) @@ -2819,12 +2793,12 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) /* Remove attribute itself. */ if (ntfs_attr_record_resize(ctx->mrec, ctx->attr, 0)) { - Dprintf("%s(): Couldn't remove attribute record. Bug or " - "damaged MFT record.\n", __FUNCTION__); + ntfs_log_trace("Couldn't remove attribute record. Bug or damaged MFT " + "record.\n"); if (NInoAttrList(base_ni) && type != AT_ATTRIBUTE_LIST) if (ntfs_attrlist_entry_add(ni, ctx->attr)) - Dprintf("%s(): Rollback failed. Leaving " - "inconstant metadata.\n", __FUNCTION__); + ntfs_log_trace("Rollback failed. Leaving inconstant " + "metadata.\n"); err = EIO; return -1; } @@ -2837,8 +2811,8 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) if (NInoAttrList(base_ni) && type != AT_ATTRIBUTE_LIST) { if (ntfs_attrlist_entry_rm(ctx)) { err = errno; - Dprintf("%s(): Couldn't delete record from " - "$ATTRIBUTE_LIST.\n", __FUNCTION__); + ntfs_log_trace("Couldn't delete record from " + "$ATTRIBUTE_LIST.\n"); errno = err; return -1; } @@ -2858,8 +2832,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) le16_to_cpu(ctx->mrec->attrs_offset) == 8) { if (ntfs_mft_record_free(ni->vol, ni)) { // FIXME: We need rollback here. - Dprintf("%s(): Couldn't free MFT record.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't free MFT record.\n"); errno = EIO; return -1; } @@ -2881,8 +2854,8 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) * goes wrong because NInoAttrList(base_ni) returned * that we have got attribute list. */ - Dprintf("%s(): Couldn't find attribute list. Succeed " - "anyway.\n", __FUNCTION__); + ntfs_log_trace("Couldn't find attribute list. Succeed " + "anyway.\n"); return 0; } /* Deallocate clusters. */ @@ -2892,16 +2865,14 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) al_rl = ntfs_mapping_pairs_decompress(base_ni->vol, ctx->attr, NULL); if (!al_rl) { - Dprintf("%s(): Couldn't decompress attribute " - "list runlist. Succeed anyway.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't decompress attribute list " + "runlist. Succeed anyway.\n"); return 0; } if (ntfs_cluster_free_from_rl(base_ni->vol, al_rl)) { - Dprintf("%s(): Leaking clusters! Run chkdsk. " - "Couldn't free clusters from attribute " - "list runlist.\n", - __FUNCTION__); + ntfs_log_trace("Leaking clusters! Run chkdsk. " + "Couldn't free clusters from " + "attribute list runlist.\n"); } free(al_rl); } @@ -2912,8 +2883,8 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx) * complain if it find MFT record with attribute list, * but without extents. */ - Dprintf("%s(): Couldn't remove attribute list. Succeed " - "anyway.\n", __FUNCTION__); + ntfs_log_trace("Couldn't remove attribute list. Succeed " + "anyway.\n"); return 0; } } @@ -2956,13 +2927,13 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, ntfs_attr *na; if (!ni || size < 0 || type == AT_ATTRIBUTE_LIST) { - Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments passed.\n"); errno = EINVAL; return -1; } - Dprintf("%s(): Entering for inode 0x%llx, attr %x, size %lld.\n", - __FUNCTION__, (long long) ni->mft_no, type, size); + ntfs_log_trace("Entering for inode 0x%llx, attr %x, size %lld.\n", + (long long) ni->mft_no, type, size); if (ni->nr_extents == -1) ni = ni->base_ni; @@ -2971,11 +2942,9 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, if (ntfs_attr_size_bounds_check(ni->vol, type, size)) { err = errno; if (err == ERANGE) { - Dprintf("%s(): Size bounds check failed. " - "Aborting...\n", __FUNCTION__); + ntfs_log_trace("Size bounds check failed. Aborting...\n"); } else if (err == ENOENT) { - Dprintf("%s(): Invalid attribute type. " - "Aborting...\n", __FUNCTION__); + ntfs_log_trace("Invalid attribute type. Aborting...\n"); err = EIO; } errno = err; @@ -2986,19 +2955,18 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, if (ntfs_attr_can_be_non_resident(ni->vol, type)) { if (errno != EPERM) { err = errno; - Dprintf("%s(): ntfs_attr_can_be_non_resident failed.\n", - __FUNCTION__); + ntfs_log_trace("ntfs_attr_can_be_non_resident failed.\n"); goto err_out; } /* @val is mandatory. */ if (!val) { - Dprintf("%s(): @val is mandatory for always resident " - "atributes.\n", __FUNCTION__); + ntfs_log_trace("val is mandatory for always resident " + "atributes.\n"); errno = EINVAL; return -1; } if (size > ni->vol->mft_record_size) { - Dprintf("%s(): Attribute is too big.\n", __FUNCTION__); + ntfs_log_trace("Attribute is too big.\n"); errno = ERANGE; return -1; } @@ -3020,8 +2988,7 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, } else { if (errno != EPERM) { err = errno; - Dprintf("%s(): ntfs_attr_can_be_resident failed.\n", - __FUNCTION__); + ntfs_log_trace("ntfs_attr_can_be_resident failed.\n"); goto err_out; } /* Attribute can't be resident. */ @@ -3049,8 +3016,7 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, /* Try to add to extent inodes. */ if (ntfs_inode_attach_all_extents(ni)) { err = errno; - Dprintf("%s(): Failed to attach all extents to inode.\n", - __FUNCTION__); + ntfs_log_trace("Failed to attach all extents to inode.\n"); goto err_out; } for (i = 0; i < ni->nr_extents; i++) { @@ -3066,8 +3032,7 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, /* Add attribute list not present, add it and retry. */ if (ntfs_inode_add_attrlist(ni)) { err = errno; - Dprintf("%s(): Failed to add attribute list.\n", - __FUNCTION__); + ntfs_log_trace("Failed to add attribute list.\n"); goto err_out; } return ntfs_attr_add(ni, type, name, name_len, val, size); @@ -3076,8 +3041,7 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, attr_ni = ntfs_mft_record_alloc(ni->vol, ni); if (!attr_ni) { err = errno; - Dprintf("%s(): Failed to allocate extent record.\n", - __FUNCTION__); + ntfs_log_trace("Failed to allocate extent record.\n"); goto err_out; } @@ -3088,8 +3052,7 @@ add_attr_record: name_len, val, size, 0); if (offset < 0) { err = errno; - Dprintf("%s(): Failed to add resident attribute.\n", - __FUNCTION__); + ntfs_log_trace("Failed to add resident attribute.\n"); goto free_err_out; } return 0; @@ -3100,8 +3063,7 @@ add_attr_record: name_len, 0, 8, 0); if (offset < 0) { err = errno; - Dprintf("%s(): Failed to add non resident attribute.\n", - __FUNCTION__); + ntfs_log_trace("Failed to add non resident attribute.\n"); goto free_err_out; } @@ -3113,20 +3075,17 @@ add_attr_record: na = ntfs_attr_open(ni, type, name, name_len); if (!na) { err = errno; - Dprintf("%s(): Failed to open just added attribute.\n", - __FUNCTION__); + ntfs_log_trace("Failed to open just added attribute.\n"); goto rm_attr_err_out; } /* Resize and set attribute value. */ if (ntfs_attr_truncate(na, size) || (val && (ntfs_attr_pwrite(na, 0, size, val) != size))) { err = errno; - Dprintf("%s(): Failed to initialize just added attribute.\n", - __FUNCTION__); + ntfs_log_trace("Failed to initialize just added attribute.\n"); if (ntfs_attr_rm(na)) { - Dprintf("%s(): Failed to remove just added attribute. " - "Probably leaving inconstant metadata.\n", - __FUNCTION__); + ntfs_log_trace("Failed to remove just added attribute. " + "Probably leaving inconstant metadata.\n"); ntfs_attr_close(na); } goto err_out; @@ -3139,16 +3098,15 @@ rm_attr_err_out: /* Remove just added attribute. */ if (ntfs_attr_record_resize(attr_ni->mrec, (ATTR_RECORD*)((u8*)attr_ni->mrec + offset), 0)) { - Dprintf("%s(): Failed to remove just added attribute.\n", - __FUNCTION__); + ntfs_log_trace("Failed to remove just added attribute.\n"); } free_err_out: /* Free MFT record, if it isn't contain attributes. */ if (le32_to_cpu(attr_ni->mrec->bytes_in_use) - le32_to_cpu(attr_ni->mrec->attrs_offset) == 8) { if (ntfs_mft_record_free(attr_ni->vol, attr_ni)) { - Dprintf("%s(): Failed to free MFT record. Leaving " - "inconstant metadata.\n", __FUNCTION__); + ntfs_log_trace("Failed to free MFT record. Leaving " + "inconstant metadata.\n"); } } err_out: @@ -3171,21 +3129,21 @@ int ntfs_attr_rm(ntfs_attr *na) int ret = 0; if (!na) { - Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments passed.\n"); errno = EINVAL; return -1; } - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", - __FUNCTION__, (long long) na->ni->mft_no, na->type); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x.\n", + (long long) na->ni->mft_no, na->type); /* Free cluster allocation. */ if (NAttrNonResident(na)) { if (ntfs_attr_map_whole_runlist(na)) return -1; if (ntfs_cluster_free(na->ni->vol, na, 0, -1) < 0) { - Dprintf("%s(): Failed to free cluster allocation. " - "Leaving inconstant metadata.\n", __FUNCTION__); + ntfs_log_trace("Failed to free cluster allocation. Leaving " + "inconstant metadata.\n"); ret = -1; } } @@ -3197,15 +3155,15 @@ int ntfs_attr_rm(ntfs_attr *na) while (!ntfs_attr_lookup(na->type, na->name, na->name_len, CASE_SENSITIVE, 0, NULL, 0, ctx)) { if (ntfs_attr_record_rm(ctx)) { - Dprintf("%s(): Failed to remove attribute extent. " - "Leaving inconstant metadata.\n", __FUNCTION__); + ntfs_log_trace("Failed to remove attribute extent. Leaving " + "inconstant metadata.\n"); ret = -1; } ntfs_attr_reinit_search_ctx(ctx); } if (errno != ENOENT) { - Dprintf("%s(): Attribute lookup failed. Probably leaving " - "inconstant metadata.\n", __FUNCTION__); + ntfs_log_trace("Attribute lookup failed. Probably leaving inconstant " + "metadata.\n"); ret = -1; } @@ -3234,8 +3192,7 @@ int ntfs_attr_rm(ntfs_attr *na) */ int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) { - Dprintf("%s(): Entering for new_size %u.\n", - __FUNCTION__, (unsigned) new_size); + ntfs_log_trace("Entering for new_size %u.\n", (unsigned) new_size); /* Align to 8 bytes, just in case the caller hasn't. */ new_size = (new_size + 7) & ~7; /* If the actual attribute length has changed, move things around. */ @@ -3283,9 +3240,8 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, */ if (a->name_length && le16_to_cpu(a->name_offset) >= le16_to_cpu(a->value_offset)) { - Dprintf("%s(): Eeek! Name is placed after the " - "attribute value. Corrupted inode. Run chkdsk. " - "Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Name is placed after the attribute value. " + "Corrupted inode. Run chkdsk. Aborting...\n"); errno = EIO; return -1; } @@ -3294,8 +3250,8 @@ int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, new_size + 7) & ~7) < 0) { if (errno != ENOSPC) { int eo = errno; - Dprintf("%s(): Eeek! Attribute record resize failed. " - "Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Attribute record resize failed. " + "Aborting...\n"); errno = eo; } return -1; @@ -3330,22 +3286,23 @@ int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) int err; if (!ctx || !ctx->attr || !ctx->ntfs_ino || !ni) { - Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments passed.\n"); errno = EINVAL; return -1; } - Dprintf("%s(): Entering for ctx->attr->type 0x%x, ctx->ntfs_ino->mft_no" - " 0x%llx, ni->mft_no 0x%llx.\n", __FUNCTION__, (unsigned) - le32_to_cpu(ctx->attr->type), (long long) ctx->ntfs_ino->mft_no, - (long long) ni->mft_no); + ntfs_log_trace("Entering for ctx->attr->type 0x%x, ctx->ntfs_ino->mft_no " + "0x%llx, ni->mft_no 0x%llx.\n", + (unsigned) le32_to_cpu(ctx->attr->type), + (long long) ctx->ntfs_ino->mft_no, + (long long) ni->mft_no); if (ctx->ntfs_ino == ni) return 0; if (!ctx->al_entry) { - Dprintf("%s(): Inode should contain attribute list to use " - "this function.\n", __FUNCTION__); + ntfs_log_trace("Inode should contain attribute list to use this " + "function.\n"); errno = EINVAL; return -1; } @@ -3355,8 +3312,7 @@ int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) nctx = ntfs_attr_get_search_ctx(ni, NULL); if (!nctx) { err = errno; - Dprintf("%s(): Couldn't obtain search context.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't obtain search context.\n"); errno = err; return -1; } @@ -3368,14 +3324,14 @@ int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) if (!ntfs_attr_find(a->type, (ntfschar*)((u8*)a + le16_to_cpu( a->name_offset)), a->name_length, CASE_SENSITIVE, NULL, 0, nctx)) { - Dprintf("%s(): Attribute of such type, with same name already " - "present in this MFT record.\n", __FUNCTION__); + ntfs_log_trace("Attribute of such type, with same name already " + "present in this MFT record.\n"); err = EEXIST; goto put_err_out; } if (errno != ENOENT) { err = errno; - Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); + ntfs_log_debug("Attribute lookup failed.\n"); goto put_err_out; } @@ -3383,8 +3339,7 @@ int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni) if (ntfs_make_room_for_attr(ni->mrec, (u8*) nctx->attr, le32_to_cpu(a->length))) { err = errno; - Dprintf("%s(): Couldn't make space for attribute.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't make space for attribute.\n"); goto put_err_out; } memcpy(nctx->attr, a, le32_to_cpu(a->length)); @@ -3429,12 +3384,12 @@ int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx, int extra) int i, err; if (!ctx || !ctx->attr || !ctx->ntfs_ino || extra < 0) { - Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments passed.\n"); errno = EINVAL; return -1; } - Dprintf("%s(): Entering for attr 0x%x, inode 0x%llx.\n", __FUNCTION__, + ntfs_log_trace("Entering for attr 0x%x, inode 0x%llx.\n", (unsigned) le32_to_cpu(ctx->attr->type), (long long) ctx->ntfs_ino->mft_no); @@ -3444,15 +3399,15 @@ int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx, int extra) base_ni = ctx->ntfs_ino; if (!NInoAttrList(base_ni)) { - Dprintf("%s(): Inode should contain attribute list to use " - "this function.\n", __FUNCTION__); + ntfs_log_trace("Inode should contain attribute list to use this " + "function.\n"); errno = EINVAL; return -1; } if (ntfs_inode_attach_all_extents(ctx->ntfs_ino)) { err = errno; - Dprintf("%s(): Couldn't attach extent inode.\n", __FUNCTION__); + ntfs_log_trace("Couldn't attach extent inode.\n"); errno = err; return -1; } @@ -3486,15 +3441,13 @@ int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx, int extra) ni = ntfs_mft_record_alloc(base_ni->vol, base_ni); if (!ni) { err = errno; - Dprintf("%s(): Couldn't allocate new MFT record.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't allocate new MFT record.\n"); errno = err; return -1; } if (ntfs_attr_record_move_to(ctx, ni)) { err = errno; - Dprintf("%s(): Couldn't move attribute to new MFT record.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't move attribute to new MFT record.\n"); errno = err; return -1; } @@ -3531,8 +3484,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, /* Some preliminary sanity checking. */ if (NAttrNonResident(na)) { - Dprintf("%s(): Eeek! Trying to make non-resident attribute " - "non-resident. Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Trying to make non-resident attribute " + "non-resident. Aborting...\n"); errno = EINVAL; return -1; } @@ -3547,9 +3500,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, */ if (a->name_length && le16_to_cpu(a->name_offset) >= le16_to_cpu(a->value_offset)) { - Dprintf("%s(): Eeek! Name is placed after the " - "attribute value. Corrupted inode. Run chkdsk. " - "Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Name is placed after the attribute value. " + "Corrupted inode. Run chkdsk. Aborting...\n"); errno = EIO; return -1; } @@ -3565,9 +3517,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, if (errno != ENOSPC) { int eo = errno; - Dprintf("%s(): Eeek! Failed to allocate " - "cluster(s). Aborting...\n", - __FUNCTION__); + ntfs_log_trace("Eeek! Failed to allocate " + "cluster(s). Aborting...\n"); errno = eo; } return -1; @@ -3596,7 +3547,7 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, (u8*)a + le16_to_cpu(a->value_offset)); if (bw != le32_to_cpu(a->value_length)) { err = errno; - Dprintf("Eeek! Failed to write out attribute value " + ntfs_log_debug("Eeek! Failed to write out attribute value " "(bw = %lli, errno = %i). " "Aborting...\n", (long long)bw, err); if (bw >= 0) @@ -3608,8 +3559,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, mp_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0); if (mp_size < 0) { err = errno; - Dputs("Eeek! Failed to get size for mapping pairs array. " - "Aborting..."); + ntfs_log_debug("Eeek! Failed to get size for mapping pairs array. " + "Aborting...\n"); goto cluster_free_err_out; } /* Calculate new offsets for the name and the mapping pairs array. */ @@ -3626,8 +3577,8 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, if (ntfs_attr_record_resize(ctx->mrec, a, arec_size) < 0) { err = errno; if (err != ENOSPC) { - Dprintf("%s(): Eeek! Failed to resize attribute " - "record. Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Failed to resize attribute record. " + "Aborting...\n"); } goto cluster_free_err_out; } @@ -3667,11 +3618,10 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, rl, 0, NULL) < 0) { err = errno; // FIXME: Eeek! We need rollback! (AIA) - Dprintf("%s(): Eeek! Failed to build mapping pairs. Leaving " - "corrupt attribute record on disk. " - "In memory runlist is still intact! Error " - "code is %i. FIXME: Need to rollback " - "instead!\n", __FUNCTION__, err); + ntfs_log_trace("Eeek! Failed to build mapping pairs. Leaving " + "corrupt attribute record on disk. In memory " + "runlist is still intact! Error code is %i. " + "FIXME: Need to rollback instead!\n", err); errno = err; return -1; } @@ -3681,14 +3631,12 @@ static int ntfs_attr_make_non_resident(ntfs_attr *na, cluster_free_err_out: if (rl && ntfs_cluster_free(vol, na, 0, -1) < 0) - Dprintf("%s(): Eeek! Failed to release allocated " - "clusters in error code path. Leaving " - "inconsistent metadata...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Failed to release allocated clusters in error " + "code path. Leaving inconsistent metadata...\n"); NAttrClearNonResident(na); na->allocated_size = na->data_size; na->rl = NULL; - if (rl) - free(rl); + free(rl); errno = err; return -1; } @@ -3702,9 +3650,9 @@ cluster_free_err_out: * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: - * ENOMEM - Not enough memory to complete operation. - * ERANGE - @newsize is not valid for the attribute type of @na. - * ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST. + * ENOMEM - Not enough memory to complete operation. + * ERANGE - @newsize is not valid for the attribute type of @na. + * ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST. */ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) { @@ -3713,8 +3661,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) ntfs_inode *ni; int err; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, - (unsigned long long)na->ni->mft_no, na->type); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x.\n", (unsigned long + long)na->ni->mft_no, na->type); /* Get the attribute record that needs modification. */ ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) @@ -3732,8 +3680,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) if (ntfs_attr_size_bounds_check(vol, na->type, newsize) < 0) { err = errno; if (err == ERANGE) { - Dprintf("%s(): Eeek! Size bounds check failed. " - "Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Size bounds check failed. " + "Aborting...\n"); } else if (err == ENOENT) err = EIO; goto put_err_out; @@ -3757,8 +3705,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) /* Error! If not enough space, just continue. */ if (errno != ENOSPC) { err = errno; - Dprintf("%s(): Eeek! Failed to resize resident part " - "of attribute. Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Failed to resize resident part of " + "attribute. Aborting...\n"); goto put_err_out; } } @@ -3772,8 +3720,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) return ntfs_attr_truncate(na, newsize); } else if (errno != ENOSPC && errno != EPERM) { err = errno; - Dprintf("%s(): Eeek! Failed to make attribute non-resident. " - "Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Failed to make attribute non-resident. " + "Aborting...\n"); goto put_err_out; } @@ -3800,8 +3748,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) le16_to_cpu(a->name_offset)), a->name_length); if (!tna) { err = errno; - Dprintf("%s(): Couldn't open attribute.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't open attribute.\n"); goto put_err_out; } if (ntfs_attr_make_non_resident(tna, ctx)) { @@ -3816,7 +3763,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) /* Check whether error occurred. */ if (errno != ENOENT) { err = errno; - Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); + ntfs_log_trace("Attribute lookup failed.\n"); goto put_err_out; } @@ -3826,9 +3773,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) if (ntfs_inode_free_space(na->ni, offsetof(ATTR_RECORD, non_resident_end) + 8)) { err = errno; - Dprintf("%s(): Couldn't free space in the MFT record " - "to make attribute list non resident.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't free space in the MFT record to " + "make attribute list non resident.\n"); errno = err; return -1; } @@ -3844,7 +3790,7 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) ntfs_attr_init_search_ctx(ctx, na->ni, NULL); if (ntfs_attr_lookup(na->type, na->name, na->name_len, CASE_SENSITIVE, 0, NULL, 0, ctx)) { - Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); + ntfs_log_trace("Attribute lookup failed.\n"); err = errno; goto put_err_out; } @@ -3875,15 +3821,13 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) ni = ntfs_mft_record_alloc(vol, ni); if (!ni) { err = errno; - Dprintf("%s(): Couldn't allocate new MFT record.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't allocate new MFT record.\n"); goto put_err_out; } /* Move attribute to it. */ if (ntfs_attr_record_move_to(ctx, ni)) { err = errno; - Dprintf("%s(): Couldn't move attribute to new MFT record.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't move attribute to new MFT record.\n"); goto put_err_out; } /* Update ntfs attribute. */ @@ -3937,16 +3881,16 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) /* Should be called for the first extent of the attribute. */ if (sle64_to_cpu(a->lowest_vcn)) { - Dprintf("%s(): Eeek! Should be called for the first extent " - "of the attribute. Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Should be called for the first extent of the " + "attribute. Aborting...\n"); err = EINVAL; return -1; } /* Some preliminary sanity checking. */ if (!NAttrNonResident(na)) { - Dprintf("%s(): Eeek! Trying to make resident attribute " - "resident. Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Trying to make resident attribute resident. " + "Aborting...\n"); errno = EINVAL; return -1; } @@ -3967,17 +3911,15 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) */ if (a->name_length && le16_to_cpu(a->name_offset) >= le16_to_cpu(a->mapping_pairs_offset)) { - Dprintf("%s(): Eeek! Damaged attribute. Name is placed after " - "the mapping pairs array. Run chkdsk. " - "Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Damaged attribute. Name is placed after the " + "mapping pairs array. Run chkdsk. Aborting...\n"); errno = EIO; return -1; } if (NAttrCompressed(na) || NAttrEncrypted(na)) { - Dprintf("%s(): Making compressed or encrypted files " - "resident is not implemented yet.\n", - __FUNCTION__); + ntfs_log_trace("Making compressed or encrypted files resident is not " + "implemented yet.\n"); errno = EOPNOTSUPP; return -1; } @@ -4011,9 +3953,9 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) * Bug, because ntfs_attr_record_resize should not fail (we * already checked that attribute fits MFT record). */ - Dprintf("%s(): BUG! Failed to resize attribute record. " - "Please report to the linux-ntfs-dev@lists.sf.net. " - "Aborting...\n", __FUNCTION__); + ntfs_log_trace("BUG! Failed to resize attribute record. Please " + "report to the linux-ntfs-dev@lists.sf.net. " + "Aborting...\n"); errno = EIO; return -1; } @@ -4044,9 +3986,9 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) if (bytes_read != na->initialized_size) { if (bytes_read < 0) err = errno; - Dprintf("%s(): Eeek! Failed to read attribute data. " - "Leaving inconstant metadata. Run chkdsk. " - "Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Failed to read attribute data. Leaving " + "inconstant metadata. Run chkdsk. " + "Aborting...\n"); errno = err; return -1; } @@ -4065,10 +4007,9 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) */ if (ntfs_cluster_free(vol, na, 0, -1) < 0) { err = errno; - Dprintf("%s(): Eeek! Failed to release allocated " - "clusters (error: %s). Ignoring error and " - "leaving behind wasted clusters.\n", - __FUNCTION__, strerror(err)); + ntfs_log_perror("Eeek! Failed to release allocated clusters"); + ntfs_log_trace("Ignoring error and leaving behind wasted " + "clusters.\n"); } /* Throw away the now unused runlist. */ @@ -4098,8 +4039,8 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: - * ENOMEM - Not enough memory to complete operation. - * ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST. + * ENOMEM - Not enough memory to complete operation. + * ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST. */ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) { @@ -4113,20 +4054,19 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na) retry: if (!na || !na->rl) { - Dprintf("%s(): Invalid parameters passed.\n", __FUNCTION__); + ntfs_log_trace("Invalid parameters passed.\n"); errno = EINVAL; return -1; } if (!NAttrNonResident(na)) { - Dprintf("%s(): Attribute should be non resident.\n", - __FUNCTION__); + ntfs_log_trace("Attribute should be non resident.\n"); errno = EINVAL; return -1; } - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, - (unsigned long long)na->ni->mft_no, na->type); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x.\n", (unsigned long + long)na->ni->mft_no, na->type); if (na->ni->nr_extents == -1) base_ni = na->ni->base_ni; @@ -4136,7 +4076,7 @@ retry: ctx = ntfs_attr_get_search_ctx(base_ni, NULL); if (!ctx) { err = errno; - Dprintf("%s(): Couldn't get search context.\n", __FUNCTION__); + ntfs_log_trace("Couldn't get search context.\n"); errno = err; return -1; } @@ -4156,9 +4096,8 @@ retry: * delete extent) and continue search. */ if (finished_build) { - Dprintf("%s(): Mark attr 0x%x for delete in inode " - "0x%llx.\n", __FUNCTION__, - (unsigned)le32_to_cpu(a->type), + ntfs_log_trace("Mark attr 0x%x for delete in inode " + "0x%llx.\n", (unsigned)le32_to_cpu(a->type), ctx->ntfs_ino->mft_no); a->highest_vcn = cpu_to_sle64(NTFS_VCN_DELETE_MARK); ntfs_inode_mark_dirty(ctx->ntfs_ino); @@ -4172,9 +4111,9 @@ retry: if (a->name_length) { if (le16_to_cpu(a->name_offset) >= le16_to_cpu(a->mapping_pairs_offset)) { - Dprintf("%s(): Eeek! Damaged attribute. Name is" - " placed after the mapping pairs array." - " Run chkdsk.\n", __FUNCTION__); + ntfs_log_trace("Eeek! Damaged attribute. Name is " + "placed after the mapping pairs " + "array. Run chkdsk.\n"); err = EIO; goto put_err_out; } @@ -4185,7 +4124,7 @@ retry: sparse = ntfs_rl_sparse(na->rl); if (sparse == -1) { - Dprintf("%s(): Bad runlist.\n", __FUNCTION__); + ntfs_log_trace("Bad runlist.\n"); err = EIO; goto put_err_out; } @@ -4211,10 +4150,9 @@ retry: } if (ntfs_attr_record_move_away(ctx, 8)) { - Dprintf("%s(): Failed to move " + ntfs_log_trace("Failed to move " "attribute to another " - "extent. Aborting...\n", - __FUNCTION__); + "extent. Aborting...\n"); err = errno; goto put_err_out; } @@ -4223,10 +4161,10 @@ retry: } if (!(le32_to_cpu(a->length) - le16_to_cpu( a->mapping_pairs_offset))) { - Dprintf("%s(): Size of the space " - "allocated for mapping pairs " - "should not be 0. " - "Aborting ...\n", __FUNCTION__); + ntfs_log_trace("Size of the space allocated " + "for mapping pairs " + "should not be 0. " + "Aborting ...\n"); err = EIO; goto put_err_out; } @@ -4279,8 +4217,7 @@ retry: stop_vcn); if (mp_size <= 0) { err = errno; - Dprintf("%s(): Eeek! Get size for mapping " - "pairs failed.\n", __FUNCTION__); + ntfs_log_trace("Eeek! Get size for mapping pairs failed.\n"); goto put_err_out; } /* @@ -4309,11 +4246,12 @@ retry: cur_max_mp_size)) { if (errno != ENOSPC) return -1; - Dprintf("%s(): Attribute list mapping " - "pairs size to big, can't fit " - "them in the base MFT record. " - "Defragment volume and try " - "once again.\n", __FUNCTION__); + ntfs_log_trace("Attribute list mapping pairs " + "size to big, can't fit " + "them in the base MFT " + "record. Defragment " + "volume and try once " + "again.\n"); errno = ENOSPC; return -1; } @@ -4325,9 +4263,8 @@ retry: ntfs_attr_put_search_ctx(ctx); if (ntfs_inode_add_attrlist(base_ni)) { err = errno; - Dprintf("%s(): Eeek! Couldn't add " - "attribute list.\n", - __FUNCTION__); + ntfs_log_trace("Eeek! Couldn't add attribute " + "list.\n"); errno = err; return -1; } @@ -4347,13 +4284,11 @@ retry: if (ntfs_attr_record_resize(m, a, le16_to_cpu(a->mapping_pairs_offset) + mp_size)) { - Dprintf("%s(): BUG! Ran out of space in" - " mft record. Please run chkdsk" - " and if that doesn't find any " - "errors please report you saw " - "this message to " - "linux-ntfs-dev@lists.sf.net." - "\n", __FUNCTION__); + ntfs_log_trace("BUG! Ran out of space in mft record. " + "Please run chkdsk and if that " + "doesn't find any errors please " + "report you saw this message to " + "linux-ntfs-dev@lists.sf.net.\n"); err = EIO; goto put_err_out; } @@ -4379,11 +4314,10 @@ retry: finished_build = TRUE; if (!finished_build && errno != ENOSPC) { err = errno; - Dprintf("%s(): BUG! Mapping pairs build failed. " - "Please run chkdsk and if that doesn't find " - "any errors please report you saw this message" - " to linux-ntfs-dev@lists.sf.net.\n", - __FUNCTION__); + ntfs_log_trace("BUG! Mapping pairs build failed. Please " + "run chkdsk and if that doesn't find " + "any errors please report you saw this " + "message to linux-ntfs-dev@lists.sf.net.\n"); goto put_err_out; } a->highest_vcn = cpu_to_sle64(stop_vcn - 1); @@ -4391,14 +4325,14 @@ retry: /* Check whether error occurred. */ if (errno != ENOENT) { err = errno; - Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); + ntfs_log_trace("Attribute lookup failed.\n"); goto put_err_out; } /* Deallocate not used attribute extents and return with success. */ if (finished_build) { ntfs_attr_reinit_search_ctx(ctx); - Dprintf("%s(): Deallocate marked extents.\n", __FUNCTION__); + ntfs_log_trace("Deallocate marked extents.\n"); while (!ntfs_attr_lookup(na->type, na->name, na->name_len, CASE_SENSITIVE, 0, NULL, 0, ctx)) { if (sle64_to_cpu(ctx->attr->highest_vcn) != @@ -4407,19 +4341,18 @@ retry: /* Remove unused attribute record. */ if (ntfs_attr_record_rm(ctx)) { err = errno; - Dprintf("%s(): Couldn't remove unused attribute" - " record.\n", __FUNCTION__); + ntfs_log_trace("Couldn't remove unused attribute " + "record.\n"); goto put_err_out; } ntfs_attr_reinit_search_ctx(ctx); } if (errno != ENOENT) { err = errno; - Dprintf("%s(): Attribute lookup failed.\n", - __FUNCTION__); + ntfs_log_trace("Attribute lookup failed.\n"); goto put_err_out; } - Dprintf("%s(): Deallocate done.\n", __FUNCTION__); + ntfs_log_trace("Deallocate done.\n"); ntfs_attr_put_search_ctx(ctx); return 0; } @@ -4433,16 +4366,14 @@ retry: na->rl, stop_vcn); if (mp_size <= 0) { err = errno; - Dprintf("%s(): Eeek! Get size for mapping " - "pairs failed.\n", __FUNCTION__); + ntfs_log_trace("Eeek! Get size for mapping pairs failed.\n"); goto put_err_out; } /* Allocate new mft record. */ ni = ntfs_mft_record_alloc(na->ni->vol, base_ni); if (!ni) { err = errno; - Dprintf("%s(): Couldn't allocate new MFT record.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't allocate new MFT record.\n"); goto put_err_out; } m = ni->mrec; @@ -4463,11 +4394,10 @@ retry: na->name, na->name_len, stop_vcn, mp_size, 0); if (err == -1) { err = errno; - Dprintf("%s(): Couldn't add attribute extent " - "into the MFT record.\n", __FUNCTION__); + ntfs_log_trace("Couldn't add attribute extent into the MFT " + "record.\n"); if (ntfs_mft_record_free(na->ni->vol, ni)) { - Dprintf("%s(): Couldn't free MFT record.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't free MFT record.\n"); } goto put_err_out; } @@ -4478,15 +4408,12 @@ retry: stop_vcn, &stop_vcn); if (err < 0 && errno != ENOSPC) { err = errno; - Dprintf("%s(): BUG! Mapping pairs build " - "failed. Please run chkdsk and if " - "that doesn't find any errors please " - "report you saw this message to " - "linux-ntfs-dev@lists.sf.net.\n", - __FUNCTION__); + ntfs_log_trace("BUG! Mapping pairs build failed. Please " + "run chkdsk and if that doesn't find " + "any errors please report you saw this " + "message to linux-ntfs-dev@lists.sf.net.\n"); if (ntfs_mft_record_free(na->ni->vol, ni)) - Dprintf("%s(): Couldn't free MFT record.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't free MFT record.\n"); goto put_err_out; } a->highest_vcn = cpu_to_sle64(stop_vcn - 1); @@ -4525,8 +4452,8 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) s64 nr_freed_clusters; int err; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, - (unsigned long long)na->ni->mft_no, na->type); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x.\n", (unsigned long + long)na->ni->mft_no, na->type); vol = na->ni->vol; @@ -4537,8 +4464,8 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) if (ntfs_attr_size_bounds_check(vol, na->type, newsize) < 0) { err = errno; if (err == ERANGE) { - Dprintf("%s(): Eeek! Size bounds check " - "failed. Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Size bounds check failed. " + "Aborting...\n"); } else if (err == ENOENT) err = EIO; errno = err; @@ -4555,8 +4482,8 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) { if (ntfs_attr_map_whole_runlist(na)) { err = errno; - Dprintf("%s(): Eeek! ntfs_attr_map_whole_runlist " - "failed.\n", __FUNCTION__); + ntfs_log_trace("Eeek! ntfs_attr_map_whole_runlist " + "failed.\n"); errno = err; return -1; } @@ -4565,8 +4492,8 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) -1); if (nr_freed_clusters < 0) { err = errno; - Dprintf("%s(): Eeek! Freeing of clusters " - "failed. Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Freeing of clusters failed. " + "Aborting...\n"); errno = err; return -1; } @@ -4580,8 +4507,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) */ free(na->rl); na->rl = NULL; - Dprintf("%s(): Eeek! Run list truncation failed.\n", - __FUNCTION__); + ntfs_log_trace("Eeek! Run list truncation failed.\n"); errno = err; return -1; } @@ -4589,9 +4515,8 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) /* Write mapping pairs for new runlist. */ if (ntfs_attr_update_mapping_pairs(na)) { err = errno; - Dprintf("%s(): Eeek! Mapping pairs update failed. " - "Leaving inconstant metadata. Run chkdsk.\n", - __FUNCTION__); + ntfs_log_trace("Eeek! Mapping pairs update failed. Leaving " + "inconstant metadata. Run chkdsk.\n"); errno = err; return -1; } @@ -4603,11 +4528,10 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) err = errno; if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) - Dprintf("%s(): Couldn't get attribute search context. " - "Leaving inconstant metadata.\n", __FUNCTION__); + ntfs_log_trace("Couldn't get attribute search context. " + "Leaving inconstant metadata.\n"); else - Dprintf("%s(): Couldn't get attribute search context.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't get attribute search context.\n"); errno = err; return -1; } @@ -4616,8 +4540,8 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) err = errno; if (err == ENOENT) err = EIO; - Dprintf("%s(): Eeek! Lookup of first attribute extent failed. " - "Leaving inconstant metadata.\n", __FUNCTION__); + ntfs_log_trace("Eeek! Lookup of first attribute extent failed. " + "Leaving inconstant metadata.\n"); goto put_err_out; } a = ctx->attr; @@ -4635,8 +4559,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) new_compr_size = ntfs_rl_get_compressed_size(vol, na->rl); if (new_compr_size == -1) { err = errno; - Dprintf("%s(): BUG! Leaving inconstant metadata.\n", - __FUNCTION__); + ntfs_log_trace("BUG! Leaving inconstant metadata.\n"); goto put_err_out; } na->compressed_size = new_compr_size; @@ -4656,9 +4579,8 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) if (ntfs_attr_make_resident(na, ctx)) { /* If couldn't make resident, just continue. */ if (errno != EPERM) - Dprintf("%s(): Failed to make attribute " - "resident. Leaving as is...\n", - __FUNCTION__); + ntfs_log_trace("Failed to make attribute resident. " + "Leaving as is...\n"); } } @@ -4683,9 +4605,9 @@ put_err_out: * * On success return 0 and on error return -1 with errno set to the error code. * The following error codes are defined: - * ENOMEM - Not enough memory to complete operation. - * ERANGE - @newsize is not valid for the attribute type of @na. - * ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST. + * ENOMEM - Not enough memory to complete operation. + * ERANGE - @newsize is not valid for the attribute type of @na. + * ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST. */ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) { @@ -4697,8 +4619,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) runlist *rl, *rln; int err; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", __FUNCTION__, - (unsigned long long)na->ni->mft_no, na->type); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x.\n", (unsigned long + long)na->ni->mft_no, na->type); vol = na->ni->vol; @@ -4709,8 +4631,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (ntfs_attr_size_bounds_check(vol, na->type, newsize) < 0) { err = errno; if (err == ERANGE) { - Dprintf("%s(): Eeek! Size bounds check " - "failed. Aborting...\n", __FUNCTION__); + ntfs_log_trace("Eeek! Size bounds check failed. " + "Aborting...\n"); } else if (err == ENOENT) err = EIO; errno = err; @@ -4727,8 +4649,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if ((na->allocated_size >> vol->cluster_size_bits) < first_free_vcn) { if (ntfs_attr_map_whole_runlist(na)) { err = errno; - Dprintf("%s(): Eeek! ntfs_attr_map_whole_runlist " - "failed.\n", __FUNCTION__); + ntfs_log_trace("Eeek! ntfs_attr_map_whole_runlist " + "failed.\n"); errno = err; return -1; } @@ -4740,8 +4662,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (na->type == AT_DATA && vol->major_ver >= 3) { rl = malloc(0x1000); if (!rl) { - Dprintf("%s(): Not enough memory.\n", - __FUNCTION__); + ntfs_log_trace("Not enough memory.\n"); err = ENOMEM; return -1; } @@ -4786,8 +4707,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) DATA_ZONE); if (!rl) { err = errno; - Dprintf("%s(): Eeek! Cluster allocation " - "failed.\n", __FUNCTION__); + ntfs_log_trace("Eeek! Cluster allocation failed.\n"); errno = err; return -1; } @@ -4798,8 +4718,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (!rln) { /* Failed, free just allocated clusters. */ err = errno; - Dprintf("%s(): Eeek! Run list merge " - "failed.\n", __FUNCTION__); + ntfs_log_trace("Eeek! Run list merge failed.\n"); ntfs_cluster_free_from_rl(vol, rl); free(rl); errno = err; @@ -4810,8 +4729,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) /* Write mapping pairs for new runlist. */ if (ntfs_attr_update_mapping_pairs(na)) { err = errno; - Dprintf("%s(): Eeek! Mapping pairs update failed.\n", - __FUNCTION__); + ntfs_log_trace("Eeek! Mapping pairs update failed.\n"); goto rollback; } } @@ -4819,7 +4737,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) ctx = ntfs_attr_get_search_ctx(na->ni, NULL); if (!ctx) { err = errno; - Dprintf("%s(): Failed to get search context.\n", __FUNCTION__); + ntfs_log_trace("Failed to get search context.\n"); if ((na->allocated_size >> vol->cluster_size_bits) == first_free_vcn) { errno = err; @@ -4830,8 +4748,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) if (ntfs_attr_lookup(na->type, na->name, na->name_len, CASE_SENSITIVE, 0, NULL, 0, ctx)) { - Dprintf("%s(): Eeek! Lookup of first attribute extent " - "failed.\n", __FUNCTION__); + ntfs_log_trace("Eeek! Lookup of first attribute extent failed.\n"); err = errno; if (err == ENOENT) err = EIO; @@ -4857,8 +4774,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) new_compr_size = ntfs_rl_get_compressed_size(vol, na->rl); if (new_compr_size == -1) { err = errno; - Dprintf("%s(): BUG! Leaving inconstant metadata.\n", - __FUNCTION__); + ntfs_log_trace("BUG! Leaving inconstant metadata.\n"); goto put_err_out; } na->compressed_size = new_compr_size; @@ -4877,8 +4793,7 @@ rollback: /* Free allocated clusters. */ if (ntfs_cluster_free(vol, na, na->allocated_size >> vol->cluster_size_bits, -1) < 0) { - Dprintf("%s(): Eeek! Leaking clusters. Run chkdsk!\n", - __FUNCTION__); + ntfs_log_trace("Eeek! Leaking clusters. Run chkdsk!\n"); err = EIO; } /* Now, truncate the runlist itself. */ @@ -4890,13 +4805,13 @@ rollback: */ free(na->rl); na->rl = NULL; - Dprintf("%s(): Eeek! Couldn't truncate runlist. Rollback " - "failed.\n", __FUNCTION__); + ntfs_log_trace("Eeek! Couldn't truncate runlist. Rollback " + "failed.\n"); } else { /* Restore mapping pairs. */ if (ntfs_attr_update_mapping_pairs(na)) { - Dprintf("%s(): Eeek! Couldn't restore old mapping " - "pairs. Rollback failed.\n", __FUNCTION__); + ntfs_log_trace("Eeek! Couldn't restore old mapping pairs. " + "Rollback failed.\n"); } } errno = err; @@ -4929,7 +4844,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) if (!na || newsize < 0 || (na->ni->mft_no == FILE_MFT && na->type == AT_DATA)) { - Dprintf("%s(): Invalid arguments passed.\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments passed.\n"); errno = EINVAL; return -1; } diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index 530a0a36..b1c7475b 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -1,4 +1,4 @@ -/* +/** * attrlist.c - Attribute list attribute handling code. Part of the Linux-NTFS * project. * @@ -21,7 +21,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDLIB_H #include @@ -36,6 +38,7 @@ #include "attrlist.h" #include "debug.h" #include "unistr.h" +#include "logging.h" /** * ntfs_attrlist_need - check whether inode need attribute list @@ -55,23 +58,21 @@ int ntfs_attrlist_need(ntfs_inode *ni) ATTR_LIST_ENTRY *ale; if (!ni) { - Dprintf("%s(): Invalid arguments.\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments.\n"); errno = EINVAL; return -1; } - Dprintf("%s(): Entering for inode 0x%llx.\n", - __FUNCTION__, (long long) ni->mft_no); + ntfs_log_trace("Entering for inode 0x%llx.\n", (long long) ni->mft_no); if (!NInoAttrList(ni)) { - Dprintf("%s(): Inode haven't got attribute list.\n", - __FUNCTION__); + ntfs_log_trace("Inode haven't got attribute list.\n"); errno = EINVAL; return -1; } if (!ni->attr_list) { - Dprintf("%s(): Corrupt in-memory struct.\n", __FUNCTION__); + ntfs_log_trace("Corrupt in-memory struct.\n"); errno = EINVAL; return -1; } @@ -107,12 +108,12 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) u8 *new_al; int entry_len, entry_offset, err; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x.\n", - __FUNCTION__, (long long) ni->mft_no, + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x.\n", + (long long) ni->mft_no, (unsigned) le32_to_cpu(attr->type)); if (!ni || !attr) { - Dprintf("%s(): Invalid arguments.\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments.\n"); errno = EINVAL; return -1; } @@ -123,7 +124,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) ni = ni->base_ni; if (!NInoAttrList(ni)) { - Dprintf("%s(): Attribute list isn't present.\n", __FUNCTION__); + ntfs_log_trace("Attribute list isn't present.\n"); errno = ENOENT; return -1; } @@ -133,7 +134,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) attr->name_length + 7) & ~7; new_al = malloc(ni->attr_list_size + entry_len); if (!new_al) { - Dprintf("%s(): Not enough memory.\n", __FUNCTION__); + ntfs_log_trace("Not enough memory.\n"); err = ENOMEM; return -1; } @@ -142,8 +143,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { err = errno; - Dprintf("%s(): Failed to obtain attribute search context.\n", - __FUNCTION__); + ntfs_log_trace("Failed to obtain attribute search context.\n"); goto err_out; } if (!ntfs_attr_lookup(attr->type, (attr->name_length) ? (ntfschar*) @@ -156,8 +156,8 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) /* Found some extent, check it to be before new extent. */ if (ctx->al_entry->lowest_vcn == attr->lowest_vcn) { err = EEXIST; - Dprintf("%s(): Such attribute already present in the " - "attribute list.\n", __FUNCTION__); + ntfs_log_trace("Such attribute already present in the " + "attribute list.\n"); ntfs_attr_put_search_ctx(ctx); goto err_out; } @@ -168,8 +168,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) /* Check for real errors. */ if (errno != ENOENT) { err = errno; - Dprintf("%s(): Attribute lookup failed.\n", - __FUNCTION__); + ntfs_log_trace("Attribute lookup failed.\n"); ntfs_attr_put_search_ctx(ctx); goto err_out; } @@ -203,13 +202,12 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, AT_UNNAMED, 0); if (!na) { err = errno; - Dprintf("%s(): Failed to open $ATTRIBUTE_LIST attribute.\n", - __FUNCTION__); + ntfs_log_trace("Failed to open $ATTRIBUTE_LIST attribute.\n"); goto err_out; } if (ntfs_attr_truncate(na, ni->attr_list_size + entry_len)) { err = errno; - Dprintf("%s(): $ATTRIBUTE_LIST resize failed.\n", __FUNCTION__); + ntfs_log_trace("$ATTRIBUTE_LIST resize failed.\n"); goto err_out; } @@ -219,8 +217,7 @@ int ntfs_attrlist_entry_add(ntfs_inode *ni, ATTR_RECORD *attr) entry_offset, ni->attr_list_size - entry_offset); /* Set new runlist. */ - if (ni->attr_list) - free(ni->attr_list); + free(ni->attr_list); ni->attr_list = new_al; ni->attr_list_size = ni->attr_list_size + entry_len; NInoAttrListSetDirty(ni); @@ -253,7 +250,7 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) int err; if (!ctx || !ctx->ntfs_ino || !ctx->al_entry) { - Dprintf("%s(): Invalid arguments.\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments.\n"); errno = EINVAL; return -1; } @@ -264,13 +261,13 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) base_ni = ctx->ntfs_ino; ale = ctx->al_entry; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, lowest_vcn " - "%lld.\n", __FUNCTION__, (long long) ctx->ntfs_ino->mft_no, - (unsigned) le32_to_cpu(ctx->al_entry->type), - (long long) le64_to_cpu(ctx->al_entry->lowest_vcn)); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, lowest_vcn %lld.\n", + (long long) ctx->ntfs_ino->mft_no, + (unsigned) le32_to_cpu(ctx->al_entry->type), + (long long) le64_to_cpu(ctx->al_entry->lowest_vcn)); if (!NInoAttrList(base_ni)) { - Dprintf("%s(): Attribute list isn't present.\n", __FUNCTION__); + ntfs_log_trace("Attribute list isn't present.\n"); errno = ENOENT; return -1; } @@ -279,7 +276,7 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) new_al_len = base_ni->attr_list_size - le16_to_cpu(ale->length); new_al = malloc(new_al_len); if (!new_al) { - Dprintf("%s(): Not enough memory.\n", __FUNCTION__); + ntfs_log_trace("Not enough memory.\n"); errno = ENOMEM; return -1; } @@ -288,13 +285,12 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) na = ntfs_attr_open(base_ni, AT_ATTRIBUTE_LIST, AT_UNNAMED, 0); if (!na) { err = errno; - Dprintf("%s(): Failed to open $ATTRIBUTE_LIST attribute.\n", - __FUNCTION__); + ntfs_log_trace("Failed to open $ATTRIBUTE_LIST attribute.\n"); goto err_out; } if (ntfs_attr_truncate(na, new_al_len)) { err = errno; - Dprintf("%s(): $ATTRIBUTE_LIST resize failed.\n", __FUNCTION__); + ntfs_log_trace("$ATTRIBUTE_LIST resize failed.\n"); goto err_out; } @@ -304,8 +300,7 @@ int ntfs_attrlist_entry_rm(ntfs_attr_search_ctx *ctx) ale->length), new_al_len - ((u8*)ale - base_ni->attr_list)); /* Set new runlist. */ - if (base_ni->attr_list) - free(base_ni->attr_list); + free(base_ni->attr_list); base_ni->attr_list = new_al; base_ni->attr_list_size = new_al_len; NInoAttrListSetDirty(base_ni); diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index 79ca11c0..e722fe9b 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -1,4 +1,4 @@ -/* +/** * bitmap.c - Bitmap handling code. Part of the Linux-NTFS project. * * Copyright (c) 2002-2004 Anton Altaparmakov @@ -20,7 +20,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDLIB_H #include @@ -39,6 +41,7 @@ #include "attrib.h" #include "bitmap.h" #include "debug.h" +#include "logging.h" /** * ntfs_bitmap_set_bits_in_run - set a run of bits in a bitmap to a value @@ -112,9 +115,8 @@ static __inline__ int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, lastbyte_pos = ((count + 7) >> 3) + firstbyte; if (!lastbyte_pos) { // FIXME: Eeek! BUG! - Dprintf("%s(): Eeek! lastbyte is zero. " - "Leaving inconsistent " - "metadata.\n", __FUNCTION__); + ntfs_log_trace("Eeek! lastbyte is zero. Leaving " + "inconsistent metadata.\n"); err = EIO; goto free_err_out; } @@ -127,11 +129,9 @@ static __inline__ int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, 3, 1, lastbyte_buf); if (br != 1) { // FIXME: Eeek! We need rollback! (AIA) - Dprintf("%s(): Eeek! Read of last " - "byte failed. " - "Leaving inconsistent " - "metadata.\n", - __FUNCTION__); + ntfs_log_trace("Eeek! Read of last byte " + "failed. Leaving " + "inconsistent metadata.\n"); err = EIO; goto free_err_out; } @@ -154,9 +154,8 @@ static __inline__ int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, br = ntfs_attr_pwrite(na, tmp, bufsize, buf); if (br != bufsize) { // FIXME: Eeek! We need rollback! (AIA) - Dprintf("%s(): Eeek! Failed to write buffer to " - "bitmap. Leaving inconsistent " - "metadata.\n", __FUNCTION__); + ntfs_log_trace("Eeek! Failed to write buffer to bitmap. " + "Leaving inconsistent metadata.\n"); err = EIO; goto free_err_out; } @@ -171,10 +170,9 @@ static __inline__ int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, if (lastbyte && count != 0) { // FIXME: Eeek! BUG! - Dprintf("%s(): Eeek! Last buffer but count is not " - "zero (= %lli). Leaving " - "inconsistent metadata.\n", - __FUNCTION__, (long long)count); + ntfs_log_trace("Eeek! Last buffer but count is not zero (= " + "%lli). Leaving inconsistent metadata.\n", + (long long)count); err = EIO; goto free_err_out; } @@ -225,17 +223,14 @@ int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) #ifdef NTFS_RICH -#include - #include "layout.h" #include "volume.h" -#include "bitmap.h" #include "rich.h" /** * ntfs_bmp_rollback */ -int ntfs_bmp_rollback (struct ntfs_bmp *bmp) +int ntfs_bmp_rollback(struct ntfs_bmp *bmp) { int i; @@ -243,10 +238,10 @@ int ntfs_bmp_rollback (struct ntfs_bmp *bmp) return 0; for (i = 0; i < bmp->count; i++) - free (bmp->data[i]); + free(bmp->data[i]); - free (bmp->data); - free (bmp->data_vcn); + free(bmp->data); + free(bmp->data_vcn); bmp->data = NULL; bmp->data_vcn = NULL; bmp->count = 0; @@ -257,7 +252,7 @@ int ntfs_bmp_rollback (struct ntfs_bmp *bmp) /** * ntfs_bmp_commit */ -int ntfs_bmp_commit (struct ntfs_bmp *bmp) +int ntfs_bmp_commit(struct ntfs_bmp *bmp) { int i; u32 cs; @@ -271,16 +266,16 @@ int ntfs_bmp_commit (struct ntfs_bmp *bmp) return 0; #if 0 - printf ("attr = 0x%02X\n", bmp->attr->type); - printf ("resident = %d\n", !NAttrNonResident (bmp->attr)); - printf ("\ta size = %lld\n", bmp->attr->allocated_size); - printf ("\td size = %lld\n", bmp->attr->data_size); - printf ("\ti size = %lld\n", bmp->attr->initialized_size); + ntfs_log_debug("attr = 0x%02X\n", bmp->attr->type); + ntfs_log_debug("resident = %d\n", !NAttrNonResident(bmp->attr)); + ntfs_log_debug("\ta size = %lld\n", bmp->attr->allocated_size); + ntfs_log_debug("\td size = %lld\n", bmp->attr->data_size); + ntfs_log_debug("\ti size = %lld\n", bmp->attr->initialized_size); #endif - printf ("commit bmp inode %lld, 0x%02X (%sresident)\n", bmp->attr->ni->mft_no, bmp->attr->type, NAttrNonResident (bmp->attr) ? "non-" : ""); + ntfs_log_debug("commit bmp inode %lld, 0x%02X (%sresident)\n", bmp->attr->ni->mft_no, bmp->attr->type, NAttrNonResident(bmp->attr) ? "non-" : ""); - if (NAttrNonResident (bmp->attr)) { + if (NAttrNonResident(bmp->attr)) { cs = bmp->vol->cluster_size; // non-resident @@ -290,20 +285,20 @@ int ntfs_bmp_commit (struct ntfs_bmp *bmp) ws = cs; else ws = bmp->attr->data_size & (cs - 1); - //printf ("writing %d bytes\n", ws); - ntfs_attr_pwrite (bmp->attr, bmp->data_vcn[i] * cs, ws, bmp->data[i]); // XXX retval + //ntfs_log_debug("writing %d bytes\n", ws); + ntfs_attr_pwrite(bmp->attr, bmp->data_vcn[i] * cs, ws, bmp->data[i]); // XXX retval #endif - printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, bmp->data_vcn[i]); + ntfs_log_debug(RED "\tntfs_attr_pwrite(vcn %lld)\n" END, bmp->data_vcn[i]); } } else { // resident #ifdef RM_WRITE - ntfs_attr_pwrite (bmp->attr, bmp->data_vcn[0], bmp->attr->data_size, bmp->data[0]); // XXX retval + ntfs_attr_pwrite(bmp->attr, bmp->data_vcn[0], bmp->attr->data_size, bmp->data[0]); // XXX retval #endif - printf (RED "\tntfs_attr_pwrite resident (%lld)\n" END, bmp->attr->data_size); + ntfs_log_debug(RED "\tntfs_attr_pwrite resident (%lld)\n" END, bmp->attr->data_size); } - ntfs_bmp_rollback (bmp); + ntfs_bmp_rollback(bmp); return 0; } @@ -311,22 +306,22 @@ int ntfs_bmp_commit (struct ntfs_bmp *bmp) /** * ntfs_bmp_free */ -void ntfs_bmp_free (struct ntfs_bmp *bmp) +void ntfs_bmp_free(struct ntfs_bmp *bmp) { if (!bmp) return; - ntfs_bmp_rollback (bmp); + ntfs_bmp_rollback(bmp); - ntfs_attr_close (bmp->attr); + ntfs_attr_close(bmp->attr); - free (bmp); + free(bmp); } /** * ntfs_bmp_create */ -struct ntfs_bmp * ntfs_bmp_create (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len) +struct ntfs_bmp * ntfs_bmp_create(ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len) { struct ntfs_bmp *bmp; ntfs_attr *attr; @@ -334,13 +329,13 @@ struct ntfs_bmp * ntfs_bmp_create (ntfs_inode *inode, ATTR_TYPES type, ntfschar if (!inode) return NULL; - attr = ntfs_attr_open (inode, type, name, name_len); + attr = ntfs_attr_open(inode, type, name, name_len); if (!attr) return NULL; - bmp = calloc (1, sizeof (*bmp)); + bmp = calloc(1, sizeof(*bmp)); if (!bmp) { - ntfs_attr_close (attr); + ntfs_attr_close(attr); return NULL; } @@ -356,7 +351,7 @@ struct ntfs_bmp * ntfs_bmp_create (ntfs_inode *inode, ATTR_TYPES type, ntfschar /** * ntfs_bmp_add_data */ -int ntfs_bmp_add_data (struct ntfs_bmp *bmp, VCN vcn, u8 *data) +int ntfs_bmp_add_data(struct ntfs_bmp *bmp, VCN vcn, u8 *data) { int i = 0; int old; @@ -365,13 +360,13 @@ int ntfs_bmp_add_data (struct ntfs_bmp *bmp, VCN vcn, u8 *data) if (!bmp || !data) return -1; - old = ROUND_UP (bmp->count, 16); + old = ROUND_UP(bmp->count, 16); bmp->count++; - new = ROUND_UP (bmp->count, 16); + new = ROUND_UP(bmp->count, 16); if (old != new) { - bmp->data = realloc (bmp->data, new * sizeof (*bmp->data)); - bmp->data_vcn = realloc (bmp->data_vcn , new * sizeof (*bmp->data_vcn)); + bmp->data = realloc(bmp->data, new * sizeof(*bmp->data)); + bmp->data_vcn = realloc(bmp->data_vcn , new * sizeof(*bmp->data_vcn)); } for (i = 0; i < bmp->count-1; i++) @@ -379,8 +374,8 @@ int ntfs_bmp_add_data (struct ntfs_bmp *bmp, VCN vcn, u8 *data) break; if ((bmp->count-i) > 0) { - memmove (&bmp->data[i+1], &bmp->data[i], (bmp->count-i) * sizeof (*bmp->data)); - memmove (&bmp->data_vcn[i+1], &bmp->data_vcn[i], (bmp->count-i) * sizeof (*bmp->data_vcn)); + memmove(&bmp->data[i+1], &bmp->data[i], (bmp->count-i) * sizeof(*bmp->data)); + memmove(&bmp->data_vcn[i+1], &bmp->data_vcn[i], (bmp->count-i) * sizeof(*bmp->data_vcn)); } bmp->data[i] = data; @@ -392,7 +387,7 @@ int ntfs_bmp_add_data (struct ntfs_bmp *bmp, VCN vcn, u8 *data) /** * ntfs_bmp_get_data */ -u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn) +u8 * ntfs_bmp_get_data(struct ntfs_bmp *bmp, VCN vcn) { u8 *buffer; int i; @@ -412,30 +407,30 @@ u8 * ntfs_bmp_get_data (struct ntfs_bmp *bmp, VCN vcn) for (i = 0; i < bmp->count; i++) { if (vcn == bmp->data_vcn[i]) { - //printf ("reusing bitmap cluster %lld\n", vcn); + //ntfs_log_debug("reusing bitmap cluster %lld\n", vcn); return bmp->data[i]; } } - buffer = calloc (1, cs); // XXX could be smaller if attr size < cluster size + buffer = calloc(1, cs); // XXX could be smaller if attr size < cluster size if (!buffer) return NULL; - //printf ("loading from bitmap cluster %lld\n", vcn); - //printf ("loading from bitmap byte %lld\n", vcn<attr, vcn<attr, vcn< 1) { - memset (buffer+byte_start+1, value, byte_finish-byte_start-1); + memset(buffer+byte_start+1, value, byte_finish-byte_start-1); } else if (byte_finish == byte_start) { mask_start &= mask_finish; mask_finish = 0x00; @@ -509,13 +504,13 @@ int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int value) } #if 1 - printf (GREEN "Modified: inode %lld, ", bmp->attr->ni->mft_no); + ntfs_log_debug(GREEN "Modified: inode %lld, ", bmp->attr->ni->mft_no); switch (bmp->attr->type) { - case AT_BITMAP: printf ("$BITMAP"); break; - case AT_DATA: printf ("$DATA"); break; - default: break; + case AT_BITMAP: ntfs_log_debug("$BITMAP"); break; + case AT_DATA: ntfs_log_debug("$DATA"); break; + default: break; } - printf (" vcn %lld-%lld\n" END, vcn>>12, (vcn+length-1)>>12); + ntfs_log_debug(" vcn %lld-%lld\n" END, vcn>>12, (vcn+length-1)>>12); #endif return 1; } @@ -523,7 +518,7 @@ int ntfs_bmp_set_range (struct ntfs_bmp *bmp, VCN vcn, s64 length, int value) /** * ntfs_bmp_find_last_set */ -s64 ntfs_bmp_find_last_set (struct ntfs_bmp *bmp) +s64 ntfs_bmp_find_last_set(struct ntfs_bmp *bmp) { s64 clust_count; s64 byte_count; @@ -540,17 +535,17 @@ s64 ntfs_bmp_find_last_set (struct ntfs_bmp *bmp) // find cluster size of bmp byte_count = bmp->attr->data_size; - clust_count = ROUND_UP (byte_count, bmp->vol->cluster_size) >> bmp->vol->cluster_size_bits; + clust_count = ROUND_UP(byte_count, bmp->vol->cluster_size) >> bmp->vol->cluster_size_bits; - //printf ("bitmap = %lld bytes\n", byte_count); - //printf ("bitmap = %lld buffers\n", clust_count); + //ntfs_log_debug("bitmap = %lld bytes\n", byte_count); + //ntfs_log_debug("bitmap = %lld buffers\n", clust_count); // for each cluster backwards for (clust = clust_count-1; clust >= 0; clust--) { - //printf ("cluster %lld\n", clust); - //printf ("get vcn %lld\n", clust << (bmp->vol->cluster_size_bits + 3)); - buffer = ntfs_bmp_get_data (bmp, clust << (bmp->vol->cluster_size_bits + 3)); - //utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); + //ntfs_log_debug("cluster %lld\n", clust); + //ntfs_log_debug("get vcn %lld\n", clust << (bmp->vol->cluster_size_bits + 3)); + buffer = ntfs_bmp_get_data(bmp, clust << (bmp->vol->cluster_size_bits + 3)); + //utils_dump_mem(buffer, 0, 8, DM_NO_ASCII); if (!buffer) return -2; if ((clust == (clust_count-1) && ((byte_count % bmp->vol->cluster_size) != 0))) { @@ -558,14 +553,14 @@ s64 ntfs_bmp_find_last_set (struct ntfs_bmp *bmp) } else { byte = bmp->vol->cluster_size; } - //printf ("start byte = %d\n", byte); + //ntfs_log_debug("start byte = %d\n", byte); // for each byte backward for (byte--; byte >= 0; byte--) { - //printf ("\tbyte %d (%d)\n", byte, buffer[byte]); + //ntfs_log_debug("\tbyte %d (%d)\n", byte, buffer[byte]); // for each bit shift up note = -1; for (bit = 7; bit >= 0; bit--) { - //printf ("\t\tbit %d (%d)\n", (1<= 0) { // if note, return value - //printf ("match %lld (c=%lld,b=%d,n=%d)\n", (((clust << bmp->vol->cluster_size_bits) + byte) << 3) + note, clust, byte, note); + //ntfs_log_debug("match %lld (c=%lld,b=%d,n=%d)\n", (((clust << bmp->vol->cluster_size_bits) + byte) << 3) + note, clust, byte, note); return ((((clust << bmp->vol->cluster_size_bits) + byte) << 3) + note); } } @@ -586,7 +581,7 @@ s64 ntfs_bmp_find_last_set (struct ntfs_bmp *bmp) /** * ntfs_bmp_find_space */ -int ntfs_bmp_find_space (struct ntfs_bmp *bmp, LCN start, long size) +int ntfs_bmp_find_space(struct ntfs_bmp *bmp, LCN start, long size) { if (!bmp) return 0; diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index e9fb56f9..cf81bb10 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -1,4 +1,4 @@ -/* +/** * bootsect.c - Boot sector handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000-2005 Anton Altaparmakov @@ -20,7 +20,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDIO_H #include @@ -36,9 +38,9 @@ #endif #include "compat.h" - #include "bootsect.h" #include "debug.h" +#include "logging.h" /** * ntfs_boot_sector_is_ntfs - check if buffer contains a valid ntfs boot sector @@ -54,11 +56,11 @@ * * Return TRUE if @b contains a valid ntfs boot sector and FALSE if not. */ -BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) +BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent __attribute__((unused))) { u32 i; - Sprintf(silent, "\nBeginning bootsector check...\n"); + ntfs_log_debug("\nBeginning bootsector check...\n"); /* Calculate the checksum. Note, this is just a simple addition of all u32 values in the bootsector starting at the beginning and @@ -68,31 +70,31 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) u32 *u = (u32 *)b; u32 *bi = (u32 *)(&b->checksum); - Sprintf(silent, "Calculating bootsector checksum... "); + ntfs_log_debug("Calculating bootsector checksum... "); for (i = 0; u < bi; ++u) i += le32_to_cpup(u); if (le32_to_cpu(b->checksum) && le32_to_cpu(b->checksum) != i) goto not_ntfs; - Sprintf(silent, "OK\n"); + ntfs_log_debug("OK\n"); } /* Check OEMidentifier is "NTFS " */ - Sprintf(silent, "Checking OEMid... "); + ntfs_log_debug("Checking OEMid... "); if (b->oem_id != cpu_to_le64(0x202020205346544eULL)) /* "NTFS " */ goto not_ntfs; - Sprintf(silent, "OK\n"); + ntfs_log_debug("OK\n"); /* Check bytes per sector value is between 256 and 4096. */ - Sprintf(silent, "Checking bytes per sector... "); + ntfs_log_debug("Checking bytes per sector... "); if (le16_to_cpu(b->bpb.bytes_per_sector) < 0x100 || le16_to_cpu(b->bpb.bytes_per_sector) > 0x1000) goto not_ntfs; - Sprintf(silent, "OK\n"); + ntfs_log_debug("OK\n"); /* Check sectors per cluster value is valid. */ - Sprintf(silent, "Checking sectors per cluster... "); + ntfs_log_debug("Checking sectors per cluster... "); switch (b->bpb.sectors_per_cluster) { case 1: case 2: case 4: case 8: case 16: case 32: case 64: case 128: @@ -100,17 +102,17 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) default: goto not_ntfs; } - Sprintf(silent, "OK\n"); + ntfs_log_debug("OK\n"); /* Check the cluster size is not above 65536 bytes. */ - Sprintf(silent, "Checking cluster size... "); + ntfs_log_debug("Checking cluster size... "); if ((u32)le16_to_cpu(b->bpb.bytes_per_sector) * b->bpb.sectors_per_cluster > 0x10000) goto not_ntfs; - Sprintf(silent, "OK\n"); + ntfs_log_debug("OK\n"); /* Check reserved/unused fields are really zero. */ - Sprintf(silent, "Checking reserved fields are zero... "); + ntfs_log_debug("Checking reserved fields are zero... "); if (le16_to_cpu(b->bpb.reserved_sectors) || le16_to_cpu(b->bpb.root_entries) || le16_to_cpu(b->bpb.sectors) || @@ -118,10 +120,10 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) le32_to_cpu(b->bpb.large_sectors) || b->bpb.fats) goto not_ntfs; - Sprintf(silent, "OK\n"); + ntfs_log_debug("OK\n"); /* Check clusters per file mft record value is valid. */ - Sprintf(silent, "Checking clusters per mft record... "); + ntfs_log_debug("Checking clusters per mft record... "); if ((u8)b->clusters_per_mft_record < 0xe1 || (u8)b->clusters_per_mft_record > 0xf7) { switch (b->clusters_per_mft_record) { @@ -131,10 +133,10 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) goto not_ntfs; } } - Sprintf(silent, "OK\n"); + ntfs_log_debug("OK\n"); /* Check clusters per index block value is valid. */ - Sprintf(silent, "Checking clusters per index block... "); + ntfs_log_debug("Checking clusters per index block... "); if ((u8)b->clusters_per_index_record < 0xe1 || (u8)b->clusters_per_index_record > 0xf7) { switch (b->clusters_per_index_record) { @@ -144,17 +146,17 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent) goto not_ntfs; } } - Sprintf(silent, "OK\n"); + ntfs_log_debug("OK\n"); if (b->end_of_sector_marker != cpu_to_le16(0xaa55)) - Dputs("Warning: Bootsector has invalid end of sector marker."); + ntfs_log_debug("Warning: Bootsector has invalid end of sector marker.\n"); - Sprintf(silent, "Bootsector check completed successfully.\n"); + ntfs_log_debug("Bootsector check completed successfully.\n"); return TRUE; not_ntfs: - Sprintf(silent, "FAILED\n"); - Sprintf(silent, "Bootsector check failed. Aborting...\n"); + ntfs_log_debug("FAILED\n"); + ntfs_log_debug("Bootsector check failed. Aborting...\n"); return FALSE; } @@ -178,18 +180,18 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) vol->sector_size = le16_to_cpu(bs->bpb.bytes_per_sector); vol->sector_size_bits = ffs(vol->sector_size) - 1; - Dprintf("SectorSize = 0x%x\n", vol->sector_size); - Dprintf("SectorSizeBits = %u\n", vol->sector_size_bits); + ntfs_log_debug("SectorSize = 0x%x\n", vol->sector_size); + ntfs_log_debug("SectorSizeBits = %u\n", vol->sector_size_bits); /* * The bounds checks on mft_lcn and mft_mirr_lcn (i.e. them being * below or equal the number_of_clusters) really belong in the * ntfs_boot_sector_is_ntfs but in this way we can just do this once. */ sectors_per_cluster = bs->bpb.sectors_per_cluster; - Dprintf("NumberOfSectors = %lli\n", sle64_to_cpu(bs->number_of_sectors)); - Dprintf("SectorsPerCluster = 0x%x\n", sectors_per_cluster); + ntfs_log_debug("NumberOfSectors = %lli\n", sle64_to_cpu(bs->number_of_sectors)); + ntfs_log_debug("SectorsPerCluster = 0x%x\n", sectors_per_cluster); if (sectors_per_cluster & (sectors_per_cluster - 1)) { - Dprintf("Error: %s is not a valid NTFS partition! " + ntfs_log_debug("Error: %s is not a valid NTFS partition! " "sectors_per_cluster is not a power of 2.\n", vol->dev->d_name); return -1; @@ -199,18 +201,19 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) vol->mft_lcn = sle64_to_cpu(bs->mft_lcn); vol->mftmirr_lcn = sle64_to_cpu(bs->mftmirr_lcn); - Dprintf("MFT LCN = 0x%llx\n", vol->mft_lcn); - Dprintf("MFTMirr LCN = 0x%llx\n", vol->mftmirr_lcn); + ntfs_log_debug("MFT LCN = 0x%llx\n", vol->mft_lcn); + ntfs_log_debug("MFTMirr LCN = 0x%llx\n", vol->mftmirr_lcn); if (vol->mft_lcn > vol->nr_clusters || vol->mftmirr_lcn > vol->nr_clusters) { - Dprintf("Error: %s is not a valid NTFS partition! ($Mft LCN " - "or\n$MftMirr LCN is greater than the number " - "of clusters!\n", vol->dev->d_name); + ntfs_log_debug("Error: %s is not a valid NTFS partition!\n", + vol->dev->d_name); + ntfs_log_debug("($Mft LCN or $MftMirr LCN is greater than the " + "number of clusters!)\n"); return -1; } vol->cluster_size = sectors_per_cluster * vol->sector_size; if (vol->cluster_size & (vol->cluster_size - 1)) { - Dprintf("Error: %s is not a valid NTFS partition! " + ntfs_log_debug("Error: %s is not a valid NTFS partition! " "cluster_size is not a power of 2.\n", vol->dev->d_name); return -1; @@ -222,9 +225,9 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) * illegal, thus signed char is actually ok! */ c = bs->clusters_per_mft_record; - Dprintf("ClusterSize = 0x%x\n", (unsigned)vol->cluster_size); - Dprintf("ClusterSizeBits = %u\n", vol->cluster_size_bits); - Dprintf("ClustersPerMftRecord = 0x%x\n", c); + ntfs_log_debug("ClusterSize = 0x%x\n", (unsigned)vol->cluster_size); + ntfs_log_debug("ClusterSizeBits = %u\n", vol->cluster_size_bits); + ntfs_log_debug("ClustersPerMftRecord = 0x%x\n", c); /* * When clusters_per_mft_record is negative, it means that it is to * be taken to be the negative base 2 logarithm of the mft_record_size @@ -236,24 +239,24 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) else vol->mft_record_size = c << vol->cluster_size_bits; if (vol->mft_record_size & (vol->mft_record_size - 1)) { - Dprintf("Error: %s is not a valid NTFS partition! " + ntfs_log_debug("Error: %s is not a valid NTFS partition! " "mft_record_size is not a power of 2.\n", vol->dev->d_name); return -1; } vol->mft_record_size_bits = ffs(vol->mft_record_size) - 1; - Dprintf("MftRecordSize = 0x%x\n", (unsigned)vol->mft_record_size); - Dprintf("MftRecordSizeBits = %u\n", vol->mft_record_size_bits); + ntfs_log_debug("MftRecordSize = 0x%x\n", (unsigned)vol->mft_record_size); + ntfs_log_debug("MftRecordSizeBits = %u\n", vol->mft_record_size_bits); /* Same as above for INDX record. */ c = bs->clusters_per_index_record; - Dprintf("ClustersPerINDXRecord = 0x%x\n", c); + ntfs_log_debug("ClustersPerINDXRecord = 0x%x\n", c); if (c < 0) vol->indx_record_size = 1 << -c; else vol->indx_record_size = c << vol->cluster_size_bits; vol->indx_record_size_bits = ffs(vol->indx_record_size) - 1; - Dprintf("INDXRecordSize = 0x%x\n", (unsigned)vol->indx_record_size); - Dprintf("INDXRecordSizeBits = %u\n", vol->indx_record_size_bits); + ntfs_log_debug("INDXRecordSize = 0x%x\n", (unsigned)vol->indx_record_size); + ntfs_log_debug("INDXRecordSizeBits = %u\n", vol->indx_record_size_bits); /* * Work out the size of the MFT mirror in number of mft records. If the * cluster size is less than or equal to the size taken by four mft diff --git a/libntfs/collate.c b/libntfs/collate.c index 15251b09..08128ca1 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -1,4 +1,4 @@ -/* +/** * collate.c - NTFS collation handling. Part of the Linux-NTFS project. * * Copyright (c) 2004 Anton Altaparmakov @@ -20,17 +20,25 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "collate.h" #include "debug.h" #include "unistr.h" +#include "logging.h" +/** + * ntfs_collate_binary + */ static int ntfs_collate_binary(ntfs_volume *vol __attribute__((unused)), const void *data1, const int data1_len, const void *data2, const int data2_len) { int rc; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); rc = memcmp(data1, data2, min(data1_len, data2_len)); if (!rc && (data1_len != data2_len)) { if (data1_len < data2_len) @@ -38,10 +46,13 @@ static int ntfs_collate_binary(ntfs_volume *vol __attribute__((unused)), else rc = 1; } - ntfs_debug("Done, returning %i.", rc); + ntfs_log_trace("Done, returning %i.", rc); return rc; } +/** + * ntfs_collate_ntofs_ulong + */ static int ntfs_collate_ntofs_ulong(ntfs_volume *vol __attribute__((unused)), const void *data1, const int data1_len, const void *data2, const int data2_len) @@ -49,9 +60,9 @@ static int ntfs_collate_ntofs_ulong(ntfs_volume *vol __attribute__((unused)), int rc; u32 d1, d2; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); if (data1_len != data2_len || data1_len != 4) { - ntfs_error(, "data1_len or/and data2_len not equal to 4."); + ntfs_log_error("data1_len or/and data2_len not equal to 4."); return NTFS_COLLATION_ERROR; } d1 = le32_to_cpup(data1); @@ -64,24 +75,27 @@ static int ntfs_collate_ntofs_ulong(ntfs_volume *vol __attribute__((unused)), else rc = 1; } - ntfs_debug("Done, returning %i.", rc); + ntfs_log_trace("Done, returning %i.\n", rc); return rc; } +/** + * ntfs_collate_file_name + */ static int ntfs_collate_file_name(ntfs_volume *vol, const void *data1, const int data1_len __attribute__((unused)), const void *data2, const int data2_len __attribute__((unused))) { int rc; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); rc = ntfs_file_values_compare(data1, data2, NTFS_COLLATION_ERROR, IGNORE_CASE, vol->upcase, vol->upcase_len); if (!rc) rc = ntfs_file_values_compare(data1, data2, NTFS_COLLATION_ERROR, CASE_SENSITIVE, vol->upcase, vol->upcase_len); - ntfs_debug("Done, returning %i.", rc); + ntfs_log_trace("Done, returning %i.\n", rc); return rc; } @@ -125,9 +139,9 @@ int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr, { int i; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); if (!vol || !data1 || !data2 || data1_len < 0 || data2_len < 0) { - ntfs_error(, "Invalid arguments passed."); + ntfs_log_error("Invalid arguments passed."); return NTFS_COLLATION_ERROR; } /* @@ -151,6 +165,6 @@ int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr, return ntfs_do_collate0x1[i](vol, data1, data1_len, data2, data2_len); err: - ntfs_error(, "Unknown collation rule."); + ntfs_log_debug("Unknown collation rule.\n"); return NTFS_COLLATION_ERROR; } diff --git a/libntfs/compat.c b/libntfs/compat.c index 0ea141dc..636987d5 100644 --- a/libntfs/compat.c +++ b/libntfs/compat.c @@ -1,4 +1,4 @@ -/* +/** * compat.c - Tweaks for Windows compatibility * * Copyright (c) 2002 Richard Russon @@ -22,7 +22,9 @@ #ifdef WINDOWS +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "compat.h" diff --git a/libntfs/compress.c b/libntfs/compress.c index 869e8de0..abf44d0d 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -1,4 +1,4 @@ -/* +/** * compress.c - Compressed attribute handling code. Part of the Linux-NTFS * project. * @@ -21,7 +21,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDIO_H #include @@ -43,6 +45,7 @@ #include "layout.h" #include "runlist.h" #include "compress.h" +#include "logging.h" /** * ntfs_compression_constants - enum of constants used in the compression code @@ -93,9 +96,9 @@ static int ntfs_decompress(u8 *dest, const u32 dest_size, u8 tag; /* Current tag. */ int token; /* Loop counter for the eight tokens in tag. */ - Dprintf("Entering, cb_size = 0x%x.\n", (unsigned)cb_size); + ntfs_log_trace("Entering, cb_size = 0x%x.\n", (unsigned)cb_size); do_next_sb: - Dprintf("Beginning sub-block at offset = 0x%x in the cb.\n", + ntfs_log_debug("Beginning sub-block at offset = 0x%x in the cb.\n", cb - cb_start); /* * Have we reached the end of the compression block or the end of the @@ -104,7 +107,7 @@ do_next_sb: * first two checks do not detect it. */ if (cb == cb_end || !le16_to_cpup((u16*)cb) || dest == dest_end) { - Dprintf("Completed. Returning success (0).\n"); + ntfs_log_debug("Completed. Returning success (0).\n"); return 0; } /* Setup offset for the current sub-block destination. */ @@ -124,7 +127,7 @@ do_next_sb: goto return_overflow; /* Now, we are ready to process the current sub-block (sb). */ if (!(le16_to_cpup((u16*)cb) & NTFS_SB_IS_COMPRESSED)) { - Dprintf("Found uncompressed sub-block.\n"); + ntfs_log_debug("Found uncompressed sub-block.\n"); /* This sb is not compressed, just copy it into destination. */ /* Advance source position to first data byte. */ cb += 2; @@ -138,7 +141,7 @@ do_next_sb: dest += NTFS_SB_SIZE; goto do_next_sb; } - Dprintf("Found compressed sub-block.\n"); + ntfs_log_debug("Found compressed sub-block.\n"); /* This sb is compressed, decompress it into destination. */ /* Forward to the first tag in the sub-block. */ cb += 2; @@ -148,7 +151,7 @@ do_next_tag: if (dest < dest_sb_end) { int nr_bytes = dest_sb_end - dest; - Dprintf("Filling incomplete sub-block with zeroes.\n"); + ntfs_log_debug("Filling incomplete sub-block with zeroes.\n"); /* Zero remainder and update destination position. */ memset(dest, 0, nr_bytes); dest += nr_bytes; @@ -238,7 +241,7 @@ do_next_tag: /* No tokens left in the current tag. Continue with the next tag. */ goto do_next_tag; return_overflow: - Dprintf("Failed. Returning -EOVERFLOW.\n"); + ntfs_log_debug("Failed. Returning -EOVERFLOW.\n"); errno = EOVERFLOW; return -1; } @@ -329,8 +332,7 @@ s64 ntfs_compressed_attr_pread(ntfs_attr *na, s64 pos, s64 count, void *b) int err; unsigned int nr_cbs, cb_clusters; - Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, " - "count 0x%llx.\n", __FUNCTION__, + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, count 0x%llx.\n", (unsigned long long)na->ni->mft_no, na->type, (long long)pos, (long long)count); if (!na || !NAttrCompressed(na) || !na->ni || !na->ni->vol || !b || @@ -421,7 +423,7 @@ do_next_cb: } if (rl->lcn == LCN_HOLE) { /* Sparse cb, zero out destination range overlapping the cb. */ - Dprintf("Found sparse compression block.\n"); + ntfs_log_debug("Found sparse compression block.\n"); to_read = min(count, cb_size - ofs); memset(b, 0, to_read); ofs = 0; @@ -434,7 +436,7 @@ do_next_cb: * Uncompressed cb, read it straight into the destination range * overlapping the cb. */ - Dprintf("Found uncompressed compression block.\n"); + ntfs_log_debug("Found uncompressed compression block.\n"); /* * Read the uncompressed data into the destination buffer. * NOTE: We cheat a little bit here by marking the attribute as @@ -480,7 +482,7 @@ do_next_cb: * Compressed cb, decompress it into the temporary buffer, then * copy the data to the destination range overlapping the cb. */ - Dprintf("Found compressed compression block.\n"); + ntfs_log_debug("Found compressed compression block.\n"); /* * Read the compressed data into the temporary buffer. * NOTE: We cheat a little bit here by marking the attribute as @@ -520,7 +522,7 @@ do_next_cb: /* Just a precaution. */ if (cb_pos + 2 <= cb_end) *(u16*)cb_pos = 0; - Dprintf("Successfully read the compression block.\n"); + ntfs_log_debug("Successfully read the compression block.\n"); if (ntfs_decompress(dest, cb_size, cb, cb_size) < 0) { err = errno; free(cb); diff --git a/libntfs/debug.c b/libntfs/debug.c index 55008543..c9803ca5 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -1,4 +1,4 @@ -/* +/** * debug.c - Debugging output functions. Part of the Linux-NTFS project. * * Copyright (c) 2002-2004 Anton Altaparmakov @@ -19,11 +19,14 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include "types.h" #include "attrib.h" #include "debug.h" +#include "logging.h" /** * Sprintf - silencable output to stderr @@ -61,6 +64,9 @@ void __Sprintf(const int silent, const char *fmt, ...) /* Debug output to stderr. To get it run ./configure --enable-debug. */ +/** + * __ntfs_error + */ void __ntfs_error(const char *function, const char *fmt, ...) { int eo = errno; @@ -78,7 +84,10 @@ void __ntfs_error(const char *function, const char *fmt, ...) errno = eo; } -void __ntfs_debug (const char *file, int line, const char *function, +/** + * __ntfs_debug + */ +void __ntfs_debug(const char *file, int line, const char *function, const char *fmt, ...) { int eo = errno; @@ -96,6 +105,9 @@ void __ntfs_debug (const char *file, int line, const char *function, errno = eo; } +/** + * __Dprintf + */ void __Dprintf(const char *fmt, ...) { int eo = errno; @@ -107,6 +119,9 @@ void __Dprintf(const char *fmt, ...) errno = eo; } +/** + * __Dputs + */ void __Dputs(const char *s) { int eo = errno; @@ -114,6 +129,9 @@ void __Dputs(const char *s) errno = eo; } +/** + * __Dperror + */ void __Dperror(const char *s) { int eo = errno; @@ -121,6 +139,9 @@ void __Dperror(const char *s) errno = eo; } +#endif + +#ifndef NTFS_DISABLE_DEBUG_LOGGING /** * ntfs_debug_runlist_dump - Dump a runlist. */ @@ -131,12 +152,12 @@ void ntfs_debug_runlist_dump(const runlist_element *rl) "LCN_ENOENT ", "LCN_EINVAL ", "LCN_unknown " }; - Dputs("NTFS-fs DEBUG: Dumping runlist (values in hex):"); + ntfs_log_debug("NTFS-fs DEBUG: Dumping runlist (values in hex):\n"); if (!rl) { - Dputs("Run list not present."); + ntfs_log_debug("Run list not present.\n"); return; } - Dputs("VCN LCN Run length"); + ntfs_log_debug("VCN LCN Run length\n"); do { LCN lcn = (rl + i)->lcn; @@ -145,14 +166,11 @@ void ntfs_debug_runlist_dump(const runlist_element *rl) if (idx > -LCN_EINVAL - 1) idx = 4; - Dprintf("%-16llx %s %-16llx%s\n", rl[i].vcn, - lcn_str[idx], rl[i].length, - rl[i].length ? "" : " (runlist end)"); + ntfs_log_debug("%-16llx %s %-16llx%s\n", rl[i].vcn, lcn_str[idx], rl[i].length, rl[i].length ? "" : " (runlist end)"); } else - Dprintf("%-16llx %-16llx %-16llx%s\n", rl[i].vcn, - rl[i].lcn, rl[i].length, - rl[i].length ? "" : " (runlist end)"); + ntfs_log_debug("%-16llx %-16llx %-16llx%s\n", rl[i].vcn, rl[i].lcn, rl[i].length, rl[i].length ? "" : " (runlist end)"); } while (rl[i++].length); } #endif + diff --git a/libntfs/device.c b/libntfs/device.c index 83da11c3..a78319fe 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -1,4 +1,4 @@ -/* +/** * device.c - Low level device io functions. Part of the Linux-NTFS project. * * Copyright (c) 2004 Anton Altaparmakov @@ -19,7 +19,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_UNISTD_H #include @@ -46,19 +48,20 @@ #include #endif #ifdef HAVE_SYS_IOCTL_H -# include +#include #endif #ifdef HAVE_LINUX_FD_H -# include +#include #endif #ifdef HAVE_LINUX_HDREG_H -# include +#include #endif #include "types.h" #include "mst.h" #include "debug.h" #include "device.h" +#include "logging.h" #if defined(linux) && defined(_IO) && !defined(BLKGETSIZE) #define BLKGETSIZE _IO(0x12,96) /* Get device size in 512-byte blocks. */ @@ -132,8 +135,7 @@ int ntfs_device_free(struct ntfs_device *dev) errno = EBUSY; return -1; } - if (dev->d_name) - free(dev->d_name); + free(dev->d_name); free(dev); return 0; } @@ -162,8 +164,7 @@ s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, void *b) s64 br, total; struct ntfs_device_operations *dops; - Dprintf("%s(): Entering for pos 0x%llx, count 0x%llx.\n", __FUNCTION__, - pos, count); + ntfs_log_trace("Entering for pos 0x%llx, count 0x%llx.\n", pos, count); if (!b || count < 0 || pos < 0) { errno = EINVAL; return -1; @@ -173,8 +174,8 @@ s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count, void *b) dops = dev->d_ops; /* Locate to position. */ if (dops->seek(dev, pos, SEEK_SET) == (off_t)-1) { - Dprintf("ntfs_pread: device seek to 0x%llx returned error: " - "%s\n", pos, strerror(errno)); + ntfs_log_perror("ntfs_pread: device seek to 0x%llx returned error", + pos); return -1; } /* Read the data. */ @@ -218,8 +219,7 @@ s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, s64 written, total; struct ntfs_device_operations *dops; - Dprintf("%s(): Entering for pos 0x%llx, count 0x%llx.\n", __FUNCTION__, - pos, count); + ntfs_log_trace("Entering for pos 0x%llx, count 0x%llx.\n", pos, count); if (!b || count < 0 || pos < 0) { errno = EINVAL; return -1; @@ -233,8 +233,8 @@ s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count, dops = dev->d_ops; /* Locate to position. */ if (dops->seek(dev, pos, SEEK_SET) == (off_t)-1) { - Dprintf("ntfs_pwrite: seek to 0x%llx returned error: %s\n", - pos, strerror(errno)); + ntfs_log_perror("ntfs_pwrite: seek to 0x%llx returned error", + pos); return -1; } NDevSetDirty(dev); @@ -405,7 +405,7 @@ s64 ntfs_cluster_read(const ntfs_volume *vol, const s64 lcn, const s64 count, br = ntfs_pread(vol->dev, lcn << vol->cluster_size_bits, count << vol->cluster_size_bits, b); if (br < 0) { - Dperror("Error reading cluster(s)"); + ntfs_log_perror("Error reading cluster(s)"); return br; } return br >> vol->cluster_size_bits; @@ -441,7 +441,7 @@ s64 ntfs_cluster_write(const ntfs_volume *vol, const s64 lcn, else bw = count << vol->cluster_size_bits; if (bw < 0) { - Dperror("Error writing cluster(s)"); + ntfs_log_perror("Error writing cluster(s)"); return bw; } return bw >> vol->cluster_size_bits; @@ -491,7 +491,7 @@ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) { u64 size; if (dev->d_ops->ioctl(dev, BLKGETSIZE64, &size) >= 0) { - Dprintf("BLKGETSIZE64 nr bytes = %llu (0x%llx)\n", + ntfs_log_debug("BLKGETSIZE64 nr bytes = %llu (0x%llx)\n", (unsigned long long)size, (unsigned long long)size); return (s64)size / block_size; @@ -502,8 +502,8 @@ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) { unsigned long size; if (dev->d_ops->ioctl(dev, BLKGETSIZE, &size) >= 0) { - Dprintf("BLKGETSIZE nr 512 byte blocks = %lu " - "(0x%lx)\n", size, size); + ntfs_log_debug("BLKGETSIZE nr 512 byte blocks = %lu (0x%lx)\n", + size, size); return (s64)size * 512 / block_size; } } @@ -512,7 +512,7 @@ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size) { struct floppy_struct this_floppy; if (dev->d_ops->ioctl(dev, FDGETPRM, &this_floppy) >= 0) { - Dprintf("FDGETPRM nr 512 byte blocks = %lu (0x%lx)\n", + ntfs_log_debug("FDGETPRM nr 512 byte blocks = %lu (0x%lx)\n", (unsigned long)this_floppy.size, (unsigned long)this_floppy.size); return (s64)this_floppy.size * 512 / block_size; @@ -560,7 +560,7 @@ s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev) { struct hd_geometry geo; if (!dev->d_ops->ioctl(dev, HDIO_GETGEO, &geo)) { - Dprintf("HDIO_GETGEO start_sect = %lu (0x%lx)\n", + ntfs_log_debug("HDIO_GETGEO start_sect = %lu (0x%lx)\n", geo.start, geo.start); return geo.start; } @@ -593,7 +593,7 @@ int ntfs_device_heads_get(struct ntfs_device *dev) { struct hd_geometry geo; if (!dev->d_ops->ioctl(dev, HDIO_GETGEO, &geo)) { - Dprintf("HDIO_GETGEO heads = %u (0x%x)\n", + ntfs_log_debug("HDIO_GETGEO heads = %u (0x%x)\n", (unsigned)geo.heads, (unsigned)geo.heads); return geo.heads; @@ -627,7 +627,7 @@ int ntfs_device_sectors_per_track_get(struct ntfs_device *dev) { struct hd_geometry geo; if (!dev->d_ops->ioctl(dev, HDIO_GETGEO, &geo)) { - Dprintf("HDIO_GETGEO sectors_per_track = %u (0x%x)\n", + ntfs_log_debug("HDIO_GETGEO sectors_per_track = %u (0x%x)\n", (unsigned)geo.sectors, (unsigned)geo.sectors); return geo.sectors; diff --git a/libntfs/dir.c b/libntfs/dir.c index 4866e6d9..fc2756f8 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1,4 +1,4 @@ -/* +/** * dir.c - Directory handling code. Part of the Linux-NTFS project. * * Copyright (c) 2002-2005 Anton Altaparmakov @@ -21,16 +21,18 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDLIB_H -# include +#include #endif #ifdef HAVE_ERRNO_H -# include +#include #endif #ifdef HAVE_STRING_H -# include +#include #endif #include "types.h" @@ -43,6 +45,7 @@ #include "index.h" #include "ntfstime.h" #include "lcnalloc.h" +#include "logging.h" /* * The little endian Unicode strings "$I30", "$SII", "$SDH", "$O" @@ -116,10 +119,8 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname, /* Find the index root attribute in the mft record. */ if (ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 0, ctx)) { - Dprintf("Index root attribute missing in directory inode " - "0x%llx: %s\n", - (unsigned long long)dir_ni->mft_no, - strerror(errno)); + ntfs_log_perror("Index root attribute missing in directory inode " + "0x%llx", (unsigned long long)dir_ni->mft_no); goto put_err_out; } /* Get to the index root value. */ @@ -128,7 +129,7 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname, index_block_size = le32_to_cpu(ir->index_block_size); if (index_block_size < NTFS_BLOCK_SIZE || index_block_size & (index_block_size - 1)) { - Dprintf("Index block size %u is invalid.\n", + ntfs_log_debug("Index block size %u is invalid.\n", (unsigned)index_block_size); goto put_err_out; } @@ -187,12 +188,12 @@ found_it: IGNORE_CASE, vol->upcase, vol->upcase_len)) { /* Only one case insensitive matching name allowed. */ if (mref) { - Dputs("Found already cached mft reference in " - "phase 1. Please run chkdsk " - "and if that doesn't find any " - "errors please report you saw " - "this message to " - "linux-ntfs-dev@lists.sf.net."); + ntfs_log_debug("Found already cached mft reference " + "in phase 1. Please run " + "chkdsk and if that doesn't " + "find any errors please report " + "you saw this message to " + "linux-ntfs-dev@lists.sf.net.\n"); goto put_err_out; } mref = le64_to_cpu(ie->indexed_file); @@ -245,7 +246,7 @@ found_it: ntfs_attr_put_search_ctx(ctx); if (mref) return mref; - Dputs("Entry not found."); + ntfs_log_debug("Entry not found.\n"); errno = ENOENT; return -1; } /* Child node present, descend into it. */ @@ -253,17 +254,16 @@ found_it: /* Open the index allocation attribute. */ ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, I30, 4); if (!ia_na) { - Dprintf("Failed to open index allocation attribute. Directory " - "inode 0x%llx is corrupt or driver bug: %s\n", - (unsigned long long)dir_ni->mft_no, - strerror(errno)); + ntfs_log_perror("Failed to open index allocation attribute. Directory " + "inode 0x%llx is corrupt or driver bug", + (unsigned long long)dir_ni->mft_no); goto put_err_out; } /* Allocate a buffer for the current index block. */ ia = (INDEX_ALLOCATION*)malloc(index_block_size); if (!ia) { - Dperror("Failed to allocate buffer for index block"); + ntfs_log_perror("Failed to allocate buffer for index block"); ntfs_attr_close(ia_na); goto put_err_out; } @@ -288,33 +288,33 @@ descend_into_child_node: if (br != 1) { if (br != -1) errno = EIO; - Dprintf("Failed to read vcn 0x%llx: %s\n", vcn, strerror(errno)); + ntfs_log_perror("Failed to read vcn 0x%llx", vcn); goto close_err_out; } if (sle64_to_cpu(ia->index_block_vcn) != vcn) { - Dprintf("Actual VCN (0x%llx) of index buffer is different from " - "expected VCN (0x%llx).\n", + ntfs_log_debug("Actual VCN (0x%llx) of index buffer is different " + "from expected VCN (0x%llx).\n", (long long)sle64_to_cpu(ia->index_block_vcn), (long long)vcn); errno = EIO; goto close_err_out; } if (le32_to_cpu(ia->index.allocated_size) + 0x18 != index_block_size) { - Dprintf("Index buffer (VCN 0x%llx) of directory inode 0x%llx " + ntfs_log_debug("Index buffer (VCN 0x%llx) of directory inode 0x%llx " "has a size (%u) differing from the directory " "specified size (%u).\n", (long long)vcn, - (unsigned long long)dir_ni->mft_no, (unsigned) - le32_to_cpu(ia->index.allocated_size) + 0x18, + (unsigned long long)dir_ni->mft_no, + (unsigned) le32_to_cpu(ia->index.allocated_size) + 0x18, (unsigned)index_block_size); errno = EIO; goto close_err_out; } index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); if (index_end > (u8*)ia + index_block_size) { - Dprintf("Size of index buffer (VCN 0x%llx) of directory inode " - "0x%llx exceeds maximum size.\n", (long long)vcn, - (unsigned long long)dir_ni->mft_no); + ntfs_log_debug("Size of index buffer (VCN 0x%llx) of directory inode " + "0x%llx exceeds maximum size.\n", + (long long)vcn, (unsigned long long)dir_ni->mft_no); errno = EIO; goto close_err_out; } @@ -333,8 +333,8 @@ descend_into_child_node: sizeof(INDEX_ENTRY_HEADER) > index_end || (u8*)ie + le16_to_cpu(ie->key_length) > index_end) { - Dprintf("Index entry out of bounds in directory inode " - "0x%llx.\n", + ntfs_log_debug("Index entry out of bounds in directory " + "inode 0x%llx.\n", (unsigned long long)dir_ni->mft_no); errno = EIO; goto close_err_out; @@ -381,12 +381,12 @@ found_it2: IGNORE_CASE, vol->upcase, vol->upcase_len)) { /* Only one case insensitive matching name allowed. */ if (mref) { - Dputs("Found already cached mft reference in " - "phase 2. Please run chkdsk " - "and if that doesn't find any " - "errors please report you saw " - "this message to " - "linux-ntfs-dev@lists.sf.net."); + ntfs_log_debug("Found already cached mft reference " + "in phase 2. Please run " + "chkdsk and if that doesn't " + "find any errors please report " + "you saw this message to " + "linux-ntfs-dev@lists.sf.net.\n"); goto close_err_out; } mref = le64_to_cpu(ie->indexed_file); @@ -435,7 +435,7 @@ found_it2: */ if (ie->flags & INDEX_ENTRY_NODE) { if ((ia->index.flags & NODE_MASK) == LEAF_NODE) { - Dprintf("Index entry with child node found in a leaf " + ntfs_log_debug("Index entry with child node found in a leaf " "node in directory inode 0x%llx.\n", (unsigned long long)dir_ni->mft_no); errno = EIO; @@ -445,8 +445,8 @@ found_it2: vcn = sle64_to_cpup((u8*)ie + le16_to_cpu(ie->length) - 8); if (vcn >= 0) goto descend_into_child_node; - Dprintf("Negative child node vcn in directory inode 0x%llx.\n", - (unsigned long long)dir_ni->mft_no); + ntfs_log_debug("Negative child node vcn in directory inode " + "0x%llx.\n", (unsigned long long)dir_ni->mft_no); errno = EIO; goto close_err_out; } @@ -460,12 +460,12 @@ found_it2: */ if (mref) return mref; - Dputs("Entry not found."); + ntfs_log_debug("Entry not found.\n"); errno = ENOENT; return -1; put_err_out: eo = EIO; - Dputs("Corrupt directory. Aborting lookup."); + ntfs_log_debug("Corrupt directory. Aborting lookup.\n"); eo_put_err_out: ntfs_attr_put_search_ctx(ctx); errno = eo; @@ -511,7 +511,7 @@ ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent, } else { ni = ntfs_inode_open(vol, FILE_root); if (!ni) { - Dprintf("Couldn't open the inode of the root " + ntfs_log_debug("Couldn't open the inode of the root " "directory.\n"); err = EIO; goto close; @@ -521,7 +521,7 @@ ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent, unicode = calloc(1, MAX_PATH); ascii = strdup(pathname); if (!unicode || !ascii) { - Dprintf("Out of memory.\n"); + ntfs_log_debug("Out of memory.\n"); err = ENOMEM; goto close; } @@ -540,15 +540,15 @@ ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent, len = ntfs_mbstoucs(p, &unicode, MAX_PATH); if (len < 0) { - Dprintf("Couldn't convert name to Unicode: %s.\n", p); + ntfs_log_debug("Couldn't convert name to Unicode: %s.\n", p); err = EILSEQ; goto close; } inum = ntfs_inode_lookup_by_name(ni, unicode, len); if (inum == (u64) -1) { - Dprintf("Couldn't find name '%s' in " - "pathname '%s'.\n", p, pathname); + ntfs_log_debug("Couldn't find name '%s' in pathname " + "'%s'.\n", p, pathname); err = ENOENT; goto close; } @@ -559,7 +559,7 @@ ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent, inum = MREF(inum); ni = ntfs_inode_open(vol, inum); if (!ni) { - Dprintf("Cannot open inode %llu: %s.\n", + ntfs_log_debug("Cannot open inode %llu: %s.\n", (unsigned long long)inum, p); err = EIO; goto close; @@ -595,7 +595,7 @@ static const ntfschar dotdot[3] = { const_cpu_to_le16('.'), typedef union { INDEX_ROOT *ir; INDEX_ALLOCATION *ia; -} index_union __attribute__ ((__transparent_union__)); +} index_union __attribute__((__transparent_union__)); typedef enum { INDEX_TYPE_ROOT, /* index root */ @@ -681,12 +681,12 @@ static MFT_REF ntfs_mft_get_parent_ref(ntfs_inode *ni) if (!ctx) return ERR_MREF(-1); if (ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - Dprintf("No file name found in inode 0x%llx. Corrupt inode.\n", - (unsigned long long)ni->mft_no); + ntfs_log_debug("No file name found in inode 0x%llx. Corrupt " + "inode.\n", (unsigned long long)ni->mft_no); goto err_out; } if (ctx->attr->non_resident) { - Dprintf("File name attribute must be resident. Corrupt inode " + ntfs_log_debug("File name attribute must be resident. Corrupt inode " "0x%llx.\n", (unsigned long long)ni->mft_no); goto io_err_out; } @@ -694,7 +694,7 @@ static MFT_REF ntfs_mft_get_parent_ref(ntfs_inode *ni) le16_to_cpu(ctx->attr->value_offset)); if ((u8*)fn + le32_to_cpu(ctx->attr->value_length) > (u8*)ctx->attr + le32_to_cpu(ctx->attr->length)) { - Dprintf("Corrupt file name attribute in inode 0x%llx.\n", + ntfs_log_debug("Corrupt file name attribute in inode 0x%llx.\n", (unsigned long long)ni->mft_no); goto io_err_out; } @@ -753,18 +753,16 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, vol = dir_ni->vol; - Dprintf("Entering for inode 0x%llx, *pos 0x%llx.\n", + ntfs_log_trace("Entering for inode 0x%llx, *pos 0x%llx.\n", (unsigned long long)dir_ni->mft_no, (long long)*pos); /* Open the index allocation attribute. */ ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, I30, 4); if (!ia_na) { if (errno != ENOENT) { - Dprintf("Failed to open index allocation attribute. " - "Directory inode 0x%llx is corrupt or " - "bug: %s\n", - (unsigned long long)dir_ni->mft_no, - strerror(errno)); + ntfs_log_perror("Failed to open index allocation attribute. " + "Directory inode 0x%llx is corrupt or bug", + (unsigned long long)dir_ni->mft_no); return -1; } i_size = 0; @@ -792,7 +790,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, parent_mref = ntfs_mft_get_parent_ref(dir_ni); if (parent_mref == ERR_MREF(-1)) { - Dperror("Parent directory not found"); + ntfs_log_perror("Parent directory not found"); goto dir_err_out; } @@ -812,7 +810,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, /* Find the index root attribute in the mft record. */ if (ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, 0, ctx)) { - Dprintf("Index root attribute missing in directory inode " + ntfs_log_debug("Index root attribute missing in directory inode " "0x%llx.\n", (unsigned long long)dir_ni->mft_no); goto dir_err_out; } @@ -824,7 +822,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, index_block_size = le32_to_cpu(ir->index_block_size); if (index_block_size < NTFS_BLOCK_SIZE || index_block_size & (index_block_size - 1)) { - Dprintf("Index block size %u is invalid.\n", + ntfs_log_debug("Index block size %u is invalid.\n", (unsigned)index_block_size); goto dir_err_out; } @@ -854,7 +852,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, * or signals an error (both covered by the rc test). */ for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { - Dprintf("In index root, offset 0x%x.\n", (u8*)ie - (u8*)ir); + ntfs_log_debug("In index root, offset 0x%x.\n", (u8*)ie - (u8*)ir); /* Bounds checks. */ if ((u8*)ie < (u8*)ctx->mrec || (u8*)ie + sizeof(INDEX_ENTRY_HEADER) > index_end || @@ -897,13 +895,13 @@ skip_index_root: /* Allocate a buffer for the current index block. */ ia = (INDEX_ALLOCATION*)malloc(index_block_size); if (!ia) { - Dperror("Failed to allocate buffer for index block"); + ntfs_log_perror("Failed to allocate buffer for index block"); goto err_out; } bmp_na = ntfs_attr_open(dir_ni, AT_BITMAP, I30, 4); if (!bmp_na) { - Dperror("Failed to open index bitmap attribute"); + ntfs_log_perror("Failed to open index bitmap attribute"); goto dir_err_out; } @@ -912,14 +910,15 @@ skip_index_root: bmp_pos = ia_pos >> index_block_size_bits; if (bmp_pos >> 3 >= bmp_na->data_size) { - Dputs("Current index position exceeds index bitmap size."); + ntfs_log_debug("Current index position exceeds index bitmap " + "size.\n"); goto dir_err_out; } bmp_buf_size = min(bmp_na->data_size - (bmp_pos >> 3), 4096); bmp = (u8*)malloc(bmp_buf_size); if (!bmp) { - Dperror("Failed to allocate bitmap buffer"); + ntfs_log_perror("Failed to allocate bitmap buffer"); goto err_out; } @@ -927,7 +926,7 @@ skip_index_root: if (br != bmp_buf_size) { if (br != -1) errno = EIO; - Dperror("Failed to read from index bitmap attribute"); + ntfs_log_perror("Failed to read from index bitmap attribute"); goto err_out; } @@ -950,12 +949,12 @@ find_next_index_buffer: if (br != bmp_buf_size) { if (br != -1) errno = EIO; - Dperror("Failed to read from index bitmap attribute"); + ntfs_log_perror("Failed to read from index bitmap attribute"); goto err_out; } } - Dprintf("Handling index block 0x%llx.\n", (long long)bmp_pos); + ntfs_log_debug("Handling index block 0x%llx.\n", (long long)bmp_pos); /* Read the index block starting at bmp_pos. */ br = ntfs_attr_mst_pread(ia_na, bmp_pos << index_block_size_bits, 1, @@ -963,33 +962,33 @@ find_next_index_buffer: if (br != 1) { if (br != -1) errno = EIO; - Dperror("Failed to read index block"); + ntfs_log_perror("Failed to read index block"); goto err_out; } ia_start = ia_pos & ~(s64)(index_block_size - 1); if (sle64_to_cpu(ia->index_block_vcn) != ia_start >> index_vcn_size_bits) { - Dprintf("Actual VCN (0x%llx) of index buffer is different from " - "expected VCN (0x%llx) in inode 0x%llx.\n", + ntfs_log_debug("Actual VCN (0x%llx) of index buffer is different " + "from expected VCN (0x%llx) in inode 0x%llx.\n", (long long)sle64_to_cpu(ia->index_block_vcn), (long long)ia_start >> index_vcn_size_bits, (unsigned long long)dir_ni->mft_no); goto dir_err_out; } if (le32_to_cpu(ia->index.allocated_size) + 0x18 != index_block_size) { - Dprintf("Index buffer (VCN 0x%llx) of directory inode 0x%llx " + ntfs_log_debug("Index buffer (VCN 0x%llx) of directory inode 0x%llx " "has a size (%u) differing from the directory " - "specified size (%u).\n", - (long long)ia_start >> index_vcn_size_bits, - (unsigned long long)dir_ni->mft_no, (unsigned) - le32_to_cpu(ia->index.allocated_size) + 0x18, - (unsigned)index_block_size); + "specified size (%u).\n", (long long)ia_start >> + index_vcn_size_bits, + (unsigned long long)dir_ni->mft_no, + (unsigned) le32_to_cpu(ia->index.allocated_size) + + 0x18, (unsigned)index_block_size); goto dir_err_out; } index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); if (index_end > (u8*)ia + index_block_size) { - Dprintf("Size of index buffer (VCN 0x%llx) of directory inode " + ntfs_log_debug("Size of index buffer (VCN 0x%llx) of directory inode " "0x%llx exceeds maximum size.\n", (long long)ia_start >> index_vcn_size_bits, (unsigned long long)dir_ni->mft_no); @@ -1004,16 +1003,15 @@ find_next_index_buffer: * enough or signals an error (both covered by the rc test). */ for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) { - Dprintf("In index allocation, offset 0x%llx.\n", + ntfs_log_debug("In index allocation, offset 0x%llx.\n", (long long)ia_start + ((u8*)ie - (u8*)ia)); /* Bounds checks. */ if ((u8*)ie < (u8*)ia || (u8*)ie + sizeof(INDEX_ENTRY_HEADER) > index_end || (u8*)ie + le16_to_cpu(ie->key_length) > index_end) { - Dprintf("Index entry out of bounds in directory inode " - "0x%llx.\n", - (unsigned long long)dir_ni->mft_no); + ntfs_log_debug("Index entry out of bounds in directory inode " + "0x%llx.\n", (unsigned long long)dir_ni->mft_no); goto dir_err_out; } /* The last entry cannot contain a name. */ @@ -1036,19 +1034,17 @@ EOD: /* We are finished, set *pos to EOD. */ *pos = i_size + vol->mft_record_size; done: - if (ia) - free(ia); - if (bmp) - free(bmp); + free(ia); + free(bmp); if (bmp_na) ntfs_attr_close(bmp_na); if (ia_na) ntfs_attr_close(ia_na); #ifdef DEBUG if (!rc) - Dprintf("EOD, *pos 0x%llx, returning 0.\n", (long long)*pos); + ntfs_log_debug("EOD, *pos 0x%llx, returning 0.\n", (long long)*pos); else - Dprintf("filldir returned %i, *pos 0x%llx, returning 0.\n", + ntfs_log_debug("filldir returned %i, *pos 0x%llx, returning 0.\n", rc, (long long)*pos); #endif return 0; @@ -1056,13 +1052,11 @@ dir_err_out: errno = EIO; err_out: eo = errno; - Dprintf("%s() failed.\n", __FUNCTION__); + ntfs_log_trace("failed.\n"); if (ctx) ntfs_attr_put_search_ctx(ctx); - if (ia) - free(ia); - if (bmp) - free(bmp); + free(ia); + free(bmp); if (bmp_na) ntfs_attr_close(bmp_na); if (ia_na) @@ -1092,17 +1086,17 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, STANDARD_INFORMATION *si = NULL; int err, fn_len, si_len; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); /* Sanity checks. */ if (!dir_ni || !name || !name_len || (type != NTFS_DT_REG && type != NTFS_DT_DIR)) { - ntfs_error(, "Invalid arguments."); + ntfs_log_error("Invalid arguments."); return NULL; } /* Allocate MFT record for new file. */ ni = ntfs_mft_record_alloc(dir_ni->vol, NULL); if (!ni) { - ntfs_error(, "Failed to allocate new MFT record."); + ntfs_log_error("Failed to allocate new MFT record."); return NULL; } /* @@ -1113,7 +1107,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, si = calloc(1, si_len); if (!si) { err = errno; - ntfs_error(, "Not enough memory."); + ntfs_log_error("Not enough memory."); goto err_out; } si->creation_time = utc2ntfs(ni->creation_time); @@ -1124,7 +1118,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, if (ntfs_attr_add(ni, AT_STANDARD_INFORMATION, AT_UNNAMED, 0, (u8*)si, si_len)) { err = errno; - ntfs_error(, "Failed to add STANDARD_INFORMATION attribute."); + ntfs_log_error("Failed to add STANDARD_INFORMATION attribute."); goto err_out; } if (type == NTFS_DT_DIR) { @@ -1138,7 +1132,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, ir = calloc(1, ir_len); if (!ir) { err = errno; - ntfs_error(, "Not enough memory."); + ntfs_log_error("Not enough memory."); goto err_out; } ir->type = AT_FILE_NAME; @@ -1162,14 +1156,14 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, if (ntfs_attr_add(ni, AT_INDEX_ROOT, I30, 4, (u8*)ir, ir_len)) { err = errno; free(ir); - ntfs_error(, "Failed to add INDEX_ROOT attribute."); + ntfs_log_error("Failed to add INDEX_ROOT attribute."); goto err_out; } } else { /* Add DATA attribute to inode. */ if (ntfs_attr_add(ni, AT_DATA, AT_UNNAMED, 0, NULL, 0)) { err = errno; - ntfs_error(, "Failed to add DATA attribute."); + ntfs_log_error("Failed to add DATA attribute."); goto err_out; } } @@ -1178,7 +1172,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, fn = calloc(1, fn_len); if (!fn) { err = errno; - ntfs_error(, "Not enough memory."); + ntfs_log_error("Not enough memory."); goto err_out; } fn->parent_directory = MK_LE_MREF(dir_ni->mft_no, @@ -1195,14 +1189,14 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, /* Add FILE_NAME attribute to inode. */ if (ntfs_attr_add(ni, AT_FILE_NAME, AT_UNNAMED, 0, (u8*)fn, fn_len)) { err = errno; - ntfs_error(, "Failed to add FILE_NAME attribute."); + ntfs_log_error("Failed to add FILE_NAME attribute."); goto err_out; } /* Add FILE_NAME attribute to index. */ if (ntfs_index_add_filename(dir_ni, fn, MK_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number)))) { err = errno; - ntfs_error(, "Failed to add entry to the index."); + ntfs_log_error("Failed to add entry to the index."); goto err_out; } /* Set hard links count and directory flag. */ @@ -1213,17 +1207,15 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, /* Done! */ free(fn); free(si); - ntfs_debug("Done."); + ntfs_log_trace("Done.\n"); return ni; err_out: - ntfs_debug("Failed."); + ntfs_log_trace("Failed.\n"); if (ntfs_mft_record_free(ni->vol, ni)) - ntfs_error(, "Failed to free MFT record. " + ntfs_log_error("Failed to free MFT record. " "Leaving inconsist metadata. Run chkdsk."); - if (fn) - free(fn); - if (si) - free(si); + free(fn); + free(si); errno = err; return NULL; } @@ -1248,9 +1240,9 @@ int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) BOOL looking_for_dos_name = FALSE, looking_for_win32_name = FALSE; int err = 0; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); if (!ni || !dir_ni || !name || !name_len) { - ntfs_error(, "Invalid arguments."); + ntfs_log_error("Invalid arguments."); errno = EINVAL; goto err_out; } @@ -1264,14 +1256,14 @@ int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) na = ntfs_attr_open(ni, AT_INDEX_ROOT, I30, 4); if (!na) { - ntfs_error(, "Corrupt directory or library bug."); + ntfs_log_error("Corrupt directory or library bug."); errno = EIO; goto err_out; } if (na->data_size != sizeof(INDEX_ROOT) + sizeof(INDEX_ENTRY_HEADER)) { ntfs_attr_close(na); - ntfs_error(, "Directory is not empty."); + ntfs_log_error("Directory is not empty."); errno = ENOTEMPTY; goto err_out; } @@ -1376,13 +1368,13 @@ search: NULL); if (!rl) { err = errno; - ntfs_error(, "Failed to decompress runlist. " + ntfs_log_error("Failed to decompress runlist. " "Leaving inconsist metadata."); continue; } if (ntfs_cluster_free_from_rl(ni->vol, rl)) { err = errno; - ntfs_error(, "Failed to free clusters. " + ntfs_log_error("Failed to free clusters. " "Leaving inconsist metadata."); continue; } @@ -1391,19 +1383,19 @@ search: } if (errno != ENOENT) { err = errno; - ntfs_error(, "Atribute enumeration failed. " + ntfs_log_error("Atribute enumeration failed. " "Probably leaving inconsist metadata."); } /* All extents should be attached after attribute walk. */ while (ni->nr_extents) if (ntfs_mft_record_free(ni->vol, *(ni->extent_nis))) { err = errno; - ntfs_error(, "Failed to free extent MFT record. " + ntfs_log_error("Failed to free extent MFT record. " "Leaving inconsist metadata."); } if (ntfs_mft_record_free(ni->vol, ni)) { err = errno; - ntfs_error(, "Failed to free base MFT record. " + ntfs_log_error("Failed to free base MFT record. " "Leaving inconsist metadata."); } ni = NULL; @@ -1415,11 +1407,11 @@ out: if (ni) ntfs_inode_close(ni); if (err) { - ntfs_error(, "Failed."); + ntfs_log_error("Failed.\n"); errno = err; return -1; } - ntfs_debug("Done."); + ntfs_log_trace("Done.\n"); return 0; err_out: err = errno; @@ -1440,10 +1432,10 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) FILE_NAME_ATTR *fn = NULL; int fn_len, err; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); if (!ni || !dir_ni || !name || !name_len) { err = errno; - ntfs_error(, "Invalid arguments."); + ntfs_log_error("Invalid arguments."); goto err_out; } /* Create FILE_NAME attribute. */ @@ -1451,7 +1443,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) fn = calloc(1, fn_len); if (!fn) { err = errno; - ntfs_error(, "Not enough memory."); + ntfs_log_error("Not enough memory."); goto err_out; } fn->parent_directory = MK_LE_MREF(dir_ni->mft_no, @@ -1469,7 +1461,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) if (ntfs_index_add_filename(dir_ni, fn, MK_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number)))) { err = errno; - ntfs_error(, "Failed to add entry to the index."); + ntfs_log_error("Failed to add entry to the index."); goto err_out; } /* Add FILE_NAME attribute to inode. */ @@ -1477,7 +1469,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) ntfs_index_context *ictx; err = errno; - ntfs_error(, "Failed to add FILE_NAME attribute."); + ntfs_log_error("Failed to add FILE_NAME attribute."); /* Try to remove just added attribute from index. */ ictx = ntfs_index_ctx_get(dir_ni, I30, 4); if (!ictx) @@ -1507,14 +1499,13 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) /* Done! */ ntfs_inode_mark_dirty(ni); free(fn); - ntfs_debug("Done."); + ntfs_log_trace("Done.\n"); return 0; rollback_failed: - ntfs_error(, "Rollback failed. Leaving inconsist metadata."); + ntfs_log_error("Rollback failed. Leaving inconsist metadata."); err_out: - ntfs_error(, "Failed."); - if (fn) - free(fn); + ntfs_log_error("Failed.\n"); + free(fn); errno = err; return -1; } @@ -1536,21 +1527,21 @@ err_out: /** * ntfs_dir_rollback */ -int ntfs_dir_rollback (struct ntfs_dir *dir) +int ntfs_dir_rollback(struct ntfs_dir *dir) { int i; if (!dir) return -1; - if (ntfs_dt_rollback (dir->index) < 0) + if (ntfs_dt_rollback(dir->index) < 0) return -1; - if (ntfs_bmp_rollback (dir->bitmap) < 0) + if (ntfs_bmp_rollback(dir->bitmap) < 0) return -1; for (i = 0; i < dir->child_count; i++) { - if (ntfs_dir_rollback (dir->children[i]) < 0) + if (ntfs_dir_rollback(dir->children[i]) < 0) return -1; } @@ -1560,7 +1551,7 @@ int ntfs_dir_rollback (struct ntfs_dir *dir) /** * ntfs_dir_truncate */ -int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) +int ntfs_dir_truncate(ntfs_volume *vol, struct ntfs_dir *dir) { //int i; //u8 *buffer; @@ -1575,80 +1566,80 @@ int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) return 0; #if 0 - buf_count = ROUND_UP (dir->bitmap->attr->allocated_size, vol->cluster_size) >> vol->cluster_size_bits; - printf ("alloc = %lld bytes\n", dir->ialloc->allocated_size); - printf ("alloc = %lld clusters\n", dir->ialloc->allocated_size >> vol->cluster_size_bits); - printf ("bitmap bytes 0 to %lld\n", ((dir->ialloc->allocated_size >> vol->cluster_size_bits)-1)>>3); - printf ("bitmap = %p\n", dir->bitmap); - printf ("bitmap = %lld bytes\n", dir->bitmap->attr->allocated_size); - printf ("bitmap = %d buffers\n", buf_count); + buf_count = ROUND_UP(dir->bitmap->attr->allocated_size, vol->cluster_size) >> vol->cluster_size_bits; + ntfs_log_debug("alloc = %lld bytes\n", dir->ialloc->allocated_size); + ntfs_log_debug("alloc = %lld clusters\n", dir->ialloc->allocated_size >> vol->cluster_size_bits); + ntfs_log_debug("bitmap bytes 0 to %lld\n", ((dir->ialloc->allocated_size >> vol->cluster_size_bits)-1)>>3); + ntfs_log_debug("bitmap = %p\n", dir->bitmap); + ntfs_log_debug("bitmap = %lld bytes\n", dir->bitmap->attr->allocated_size); + ntfs_log_debug("bitmap = %d buffers\n", buf_count); #endif - last_bit = ntfs_bmp_find_last_set (dir->bitmap); + last_bit = ntfs_bmp_find_last_set(dir->bitmap); if (dir->ialloc->allocated_size == (dir->index_size * (last_bit + 1))) { - //printf ("nothing to do\n"); + //ntfs_log_debug("nothing to do\n"); return 0; } - printf (BOLD YELLOW "Truncation needed\n" END); + ntfs_log_debug(BOLD YELLOW "Truncation needed\n" END); #if 0 - printf ("\tlast bit = %lld\n", last_bit); - printf ("\tactual IALLOC size = %lld\n", dir->ialloc->allocated_size); - printf ("\tshould IALLOC size = %lld\n", dir->index_size * (last_bit + 1)); + ntfs_log_debug("\tlast bit = %lld\n", last_bit); + ntfs_log_debug("\tactual IALLOC size = %lld\n", dir->ialloc->allocated_size); + ntfs_log_debug("\tshould IALLOC size = %lld\n", dir->index_size * (last_bit + 1)); #endif if ((dir->index_size * (last_bit + 1)) == 0) { - printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); + ntfs_log_debug("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); //rollback all dts - //ntfs_dt_rollback (dir->index); + //ntfs_dt_rollback(dir->index); //dir->index = NULL; // What about the ROOT dt? - ie = ntfs_ie_copy (dir->index->children[0]); + ie = ntfs_ie_copy(dir->index->children[0]); if (!ie) { - printf (RED "IE copy failed\n" END); + ntfs_log_debug(RED "IE copy failed\n" END); return -1; } - ie = ntfs_ie_remove_vcn (ie); + ie = ntfs_ie_remove_vcn(ie); if (!ie) { - printf (RED "IE remove vcn failed\n" END); + ntfs_log_debug(RED "IE remove vcn failed\n" END); return -1; } - //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); - //utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); printf ("\n"); - ntfs_dt_root_replace (dir->index, 0, dir->index->children[0], ie); - //utils_dump_mem (dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); printf ("\n"); - //printf ("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); + //utils_dump_mem(dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); ntfs_log_debug("\n"); + //utils_dump_mem(ie, 0, ie->length, DM_DEFAULTS); ntfs_log_debug("\n"); + ntfs_dt_root_replace(dir->index, 0, dir->index->children[0], ie); + //utils_dump_mem(dir->index->data, 0, dir->index->data_len, DM_DEFAULTS); ntfs_log_debug("\n"); + //ntfs_log_debug("root dt %d, vcn = %lld\n", dir->index->changed, dir->index->vcn); - ntfs_ie_free (ie); + ntfs_ie_free(ie); ie = NULL; //index flags remove LARGE_INDEX dir->index->header->flags = 0; //rollback dir's bmp - ntfs_bmp_free (dir->bitmap); + ntfs_bmp_free(dir->bitmap); dir->bitmap = NULL; /* for (i = 0; i < dir->index->child_count; i++) { - ntfs_dt_rollback (dir->index->sub_nodes[i]); + ntfs_dt_rollback(dir->index->sub_nodes[i]); dir->index->sub_nodes[i] = NULL; } */ - //printf ("dir->index->inodes[0] = %p\n", dir->index->inodes[0]); + //ntfs_log_debug("dir->index->inodes[0] = %p\n", dir->index->inodes[0]); //remove 0xA0 attribute - ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_INDEX_ALLOCATION); + ntfs_mft_remove_attr(vol->private_bmp2, dir->inode, AT_INDEX_ALLOCATION); //remove 0xB0 attribute - ntfs_mft_remove_attr (vol->private_bmp2, dir->inode, AT_BITMAP); + ntfs_mft_remove_attr(vol->private_bmp2, dir->inode, AT_BITMAP); } else { - printf (RED "Cannot shrink directory\n" END); + ntfs_log_debug(RED "Cannot shrink directory\n" END); //ntfs_dir_shrink_alloc //ntfs_dir_shrink_bitmap //make bitmap resident? @@ -1674,14 +1665,14 @@ int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) */ #if 0 - buffer = ntfs_bmp_get_data (dir->bitmap, 0); + buffer = ntfs_bmp_get_data(dir->bitmap, 0); if (!buffer) return -1; - utils_dump_mem (buffer, 0, 8, DM_NO_ASCII); + utils_dump_mem(buffer, 0, 8, DM_NO_ASCII); for (i = buf_count-1; i >= 0; i--) { if (buffer[i]) { - printf ("alloc in use\n"); + ntfs_log_debug("alloc in use\n"); return 0; } } @@ -1704,29 +1695,29 @@ int ntfs_dir_truncate (ntfs_volume *vol, struct ntfs_dir *dir) /** * ntfs_dir_commit */ -int ntfs_dir_commit (struct ntfs_dir *dir) +int ntfs_dir_commit(struct ntfs_dir *dir) { int i; if (!dir) return 0; - printf ("commit dir inode %llu\n", dir->inode->mft_no); - if (NInoDirty (dir->inode)) { + ntfs_log_debug("commit dir inode %llu\n", dir->inode->mft_no); + if (NInoDirty(dir->inode)) { #ifdef RM_WRITE - ntfs_inode_sync (dir->inode); + ntfs_inode_sync(dir->inode); #endif - printf (RED "\tntfs_inode_sync %llu\n" END, dir->inode->mft_no); + ntfs_log_debug(RED "\tntfs_inode_sync %llu\n" END, dir->inode->mft_no); } - if (ntfs_dt_commit (dir->index) < 0) + if (ntfs_dt_commit(dir->index) < 0) return -1; - if (ntfs_bmp_commit (dir->bitmap) < 0) + if (ntfs_bmp_commit(dir->bitmap) < 0) return -1; for (i = 0; i < dir->child_count; i++) { - if (ntfs_dir_commit (dir->children[i]) < 0) + if (ntfs_dir_commit(dir->children[i]) < 0) return -1; } @@ -1736,7 +1727,7 @@ int ntfs_dir_commit (struct ntfs_dir *dir) /** * ntfs_dir_free */ -void ntfs_dir_free (struct ntfs_dir *dir) +void ntfs_dir_free(struct ntfs_dir *dir) { struct ntfs_dir *parent; int i; @@ -1744,7 +1735,7 @@ void ntfs_dir_free (struct ntfs_dir *dir) if (!dir) return; - ntfs_dir_rollback (dir); + ntfs_dir_rollback(dir); parent = dir->parent; if (parent) { @@ -1755,25 +1746,25 @@ void ntfs_dir_free (struct ntfs_dir *dir) } } - ntfs_attr_close (dir->iroot); - ntfs_attr_close (dir->ialloc); - ntfs_inode_close2 (dir->inode); + ntfs_attr_close(dir->iroot); + ntfs_attr_close(dir->ialloc); + ntfs_inode_close2(dir->inode); ntfs_dt_free (dir->index); - ntfs_bmp_free (dir->bitmap); + ntfs_bmp_free(dir->bitmap); for (i = 0; i < dir->child_count; i++) - ntfs_dir_free (dir->children[i]); + ntfs_dir_free(dir->children[i]); - free (dir->name); - free (dir->children); - free (dir); + free(dir->name); + free(dir->children); + free(dir); } /** * ntfs_dir_create */ -struct ntfs_dir * ntfs_dir_create (ntfs_volume *vol, MFT_REF mft_num) +struct ntfs_dir * ntfs_dir_create(ntfs_volume *vol, MFT_REF mft_num) { struct ntfs_dir *dir = NULL; ntfs_inode *inode = NULL; @@ -1784,23 +1775,23 @@ struct ntfs_dir * ntfs_dir_create (ntfs_volume *vol, MFT_REF mft_num) if (!vol) return NULL; - //printf ("ntfs_dir_create %lld\n", MREF (mft_num)); - inode = ntfs_inode_open2 (vol, mft_num); + //ntfs_log_debug("ntfs_dir_create %lld\n", MREF(mft_num)); + inode = ntfs_inode_open2(vol, mft_num); if (!inode) return NULL; - dir = calloc (1, sizeof (*dir)); + dir = calloc(1, sizeof(*dir)); if (!dir) { - ntfs_inode_close2 (inode); + ntfs_inode_close2(inode); return NULL; } dir->inode = inode; - dir->iroot = ntfs_attr_open (inode, AT_INDEX_ROOT, I30, 4); - dir->ialloc = ntfs_attr_open (inode, AT_INDEX_ALLOCATION, I30, 4); + dir->iroot = ntfs_attr_open(inode, AT_INDEX_ROOT, I30, 4); + dir->ialloc = ntfs_attr_open(inode, AT_INDEX_ALLOCATION, I30, 4); if (!dir->iroot) { - ntfs_dir_free (dir); + ntfs_dir_free(dir); return NULL; } @@ -1814,10 +1805,10 @@ struct ntfs_dir * ntfs_dir_create (ntfs_volume *vol, MFT_REF mft_num) dir->mft_num = mft_num; // This may not exist - dir->bitmap = ntfs_bmp_create (inode, AT_BITMAP, I30, 4); + dir->bitmap = ntfs_bmp_create(inode, AT_BITMAP, I30, 4); if (dir->iroot) { - rec = find_first_attribute (AT_INDEX_ROOT, inode->mrec); + rec = find_first_attribute(AT_INDEX_ROOT, inode->mrec); ir = (INDEX_ROOT*) ((u8*)rec + rec->value_offset); dir->index_size = ir->index_block_size; } else { @@ -1826,12 +1817,12 @@ struct ntfs_dir * ntfs_dir_create (ntfs_volume *vol, MFT_REF mft_num) } // Finally, find the dir's name - rec = find_first_attribute (AT_FILE_NAME, inode->mrec); + rec = find_first_attribute(AT_FILE_NAME, inode->mrec); name = (FILE_NAME_ATTR*) ((u8*)rec + rec->value_offset); dir->name_len = name->file_name_length; - dir->name = malloc (sizeof (ntfschar) * dir->name_len); - memcpy (dir->name, name->file_name, sizeof (ntfschar) * dir->name_len); + dir->name = malloc(sizeof(ntfschar) * dir->name_len); + memcpy(dir->name, name->file_name, sizeof(ntfschar) * dir->name_len); return dir; } @@ -1839,14 +1830,14 @@ struct ntfs_dir * ntfs_dir_create (ntfs_volume *vol, MFT_REF mft_num) /** * ntfs_dir_add */ -void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) +void ntfs_dir_add(struct ntfs_dir *parent, struct ntfs_dir *child) { if (!parent || !child) return; parent->child_count++; - //printf ("child count = %d\n", parent->child_count); - parent->children = realloc (parent->children, parent->child_count * sizeof (struct ntfs_dir*)); + //ntfs_log_debug("child count = %d\n", parent->child_count); + parent->children = realloc(parent->children, parent->child_count * sizeof(struct ntfs_dir*)); child->parent = parent; parent->children[parent->child_count-1] = child; @@ -1855,7 +1846,7 @@ void ntfs_dir_add (struct ntfs_dir *parent, struct ntfs_dir *child) /** * ntfs_dir_find2 */ -struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, int name_len) +struct ntfs_dir * ntfs_dir_find2(struct ntfs_dir *dir, ntfschar *name, int name_len) { int i; struct ntfs_dir *child = NULL; @@ -1868,12 +1859,12 @@ struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, int name return NULL; if (!dir->index) { // XXX when will this happen? - printf ("ntfs_dir_find2 - directory has no index\n"); + ntfs_log_debug("ntfs_dir_find2 - directory has no index\n"); return NULL; } for (i = 0; i < dir->child_count; i++) { - if (0 == ntfs_names_collate (name, name_len, + if (0 == ntfs_names_collate(name, name_len, dir->children[i]->name, dir->children[i]->name_len, 2, IGNORE_CASE, @@ -1882,9 +1873,9 @@ struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, int name return dir->children[i]; } - dt = ntfs_dt_find2 (dir->index, name, name_len, &dt_num); + dt = ntfs_dt_find2(dir->index, name, name_len, &dt_num); if (!dt) { - printf ("can't find name in dir\n"); + ntfs_log_debug("can't find name in dir\n"); return NULL; } @@ -1892,13 +1883,13 @@ struct ntfs_dir * ntfs_dir_find2 (struct ntfs_dir *dir, ntfschar *name, int name mft_num = ie->indexed_file; - child = ntfs_dir_create (dir->vol, mft_num); + child = ntfs_dir_create(dir->vol, mft_num); if (!child) return NULL; - child->index = ntfs_dt_create (child, NULL, -1); + child->index = ntfs_dt_create(child, NULL, -1); - ntfs_dir_add (dir, child); + ntfs_dir_add(dir, child); return child; } diff --git a/libntfs/index.c b/libntfs/index.c index 1824e478..f575039a 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -1,4 +1,4 @@ -/* +/** * index.c - NTFS index handling. Part of the Linux-NTFS project. * * Copyright (c) 2004-2005 Anton Altaparmakov @@ -21,7 +21,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDLIB_H #include @@ -33,6 +35,7 @@ #include "index.h" #include "mst.h" #include "dir.h" +#include "logging.h" /** * ntfs_index_ctx_get - allocate and initialize a new index context @@ -85,7 +88,7 @@ void ntfs_index_ctx_put(ntfs_index_context *ictx) cluster_size_bits, 1, ictx->block_size, ictx->ia) != 1) - ntfs_error(, "Failed to write out " + ntfs_log_error("Failed to write out " "index block."); } /* Free resources. */ @@ -117,7 +120,7 @@ void ntfs_index_ctx_reinit(ntfs_index_context *ictx) cluster_size_bits, 1, ictx->block_size, ictx->ia) != 1) - ntfs_error(, "Failed to write out " + ntfs_log_error("Failed to write out " "index block."); } /* Free resources. */ @@ -179,7 +182,7 @@ int ntfs_index_lookup(const void *key, const int key_len, ntfs_attr *na = NULL; int rc, err = 0; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); if (!key || key_len <= 0) { errno = EINVAL; return -1; @@ -196,7 +199,7 @@ int ntfs_index_lookup(const void *key, const int key_len, CASE_SENSITIVE, 0, NULL, 0, actx); if (err) { if (errno == ENOENT) { - ntfs_error(sb, "Index root attribute missing in inode " + ntfs_log_error("Index root attribute missing in inode " "0x%llx.", ni->mft_no); err = EIO; } else @@ -212,7 +215,7 @@ int ntfs_index_lookup(const void *key, const int key_len, /* Get collation rule type and validate it. */ cr = ir->collation_rule; if (!ntfs_is_collation_rule_supported(cr)) { - ntfs_error(sb, "Index uses unsupported collation rule 0x%x. " + ntfs_log_error("Index uses unsupported collation rule 0x%x. " "Aborting lookup.", (unsigned)le32_to_cpu(cr)); err = EOPNOTSUPP; goto err_out; @@ -248,7 +251,7 @@ done: ictx->entry = ie; ictx->data = (u8*)ie + offsetof(INDEX_ENTRY, key); ictx->data_len = le16_to_cpu(ie->key_length); - ntfs_debug("Done."); + ntfs_log_trace("Done.\n"); if (err) { errno = err; return -1; @@ -262,7 +265,7 @@ done: rc = ntfs_collate(vol, cr, key, key_len, &ie->key, le16_to_cpu(ie->key_length)); if (rc == NTFS_COLLATION_ERROR) { - ntfs_error(, "Collation error. Probably filename " + ntfs_log_error("Collation error. Probably filename " "contain invalid characters."); err = ERANGE; goto err_out; @@ -288,7 +291,7 @@ done: * -1 with errno ENOENT. */ if (!(ie->flags & INDEX_ENTRY_NODE)) { - ntfs_debug("Entry not found."); + ntfs_log_debug("Entry not found.\n"); err = ENOENT; goto ir_done; } /* Child node present, descend into it. */ @@ -301,7 +304,7 @@ done: na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, ictx->name, ictx->name_len); if (!na) { - ntfs_error(sb, "No index allocation attribute but index entry " + ntfs_log_error("No index allocation attribute but index entry " "requires one. Inode 0x%llx is corrupt or " "library bug.", ni->mft_no); goto err_out; @@ -309,28 +312,28 @@ done: /* Allocate memory to store index block. */ ia = malloc(ictx->block_size); if (!ia) { - ntfs_error(, "Not enough memory to allocate buffer for index" + ntfs_log_error("Not enough memory to allocate buffer for index" " allocation."); err = ENOMEM; goto err_out; } descend_into_child_node: - ntfs_debug("Descend into node with VCN %lld.", vcn); + ntfs_log_debug("Descend into node with VCN %lld.\n", vcn); /* Read index allocation block. */ if (ntfs_attr_mst_pread(na, vcn << vol->cluster_size_bits, 1, ictx->block_size, ia) != 1) { - ntfs_error(, "Failed to read index allocation."); + ntfs_log_error("Failed to read index allocation."); goto err_out; } /* Catch multi sector transfer fixup errors. */ if (!ntfs_is_indx_record(ia->magic)) { - ntfs_error(sb, "Index record with vcn 0x%llx is corrupt. " + ntfs_log_error("Index record with vcn 0x%llx is corrupt. " "Corrupt inode 0x%llx. Run chkdsk.", (long long)vcn, ni->mft_no); goto err_out; } if (sle64_to_cpu(ia->index_block_vcn) != vcn) { - ntfs_error(sb, "Actual VCN (0x%llx) of index buffer is " + ntfs_log_error("Actual VCN (0x%llx) of index buffer is " "different from expected VCN (0x%llx). Inode " "0x%llx is corrupt or driver bug.", (unsigned long long) @@ -339,7 +342,7 @@ descend_into_child_node: goto err_out; } if (le32_to_cpu(ia->index.allocated_size) + 0x18 != ictx->block_size) { - ntfs_error(sb, "Index buffer (VCN 0x%llx) of inode 0x%llx has " + ntfs_log_error("Index buffer (VCN 0x%llx) of inode 0x%llx has " "a size (%u) differing from the index " "specified size (%u). Inode is corrupt or " "driver bug.", (unsigned long long)vcn, @@ -350,7 +353,7 @@ descend_into_child_node: } index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); if (index_end > (u8*)ia + ictx->block_size) { - ntfs_error(sb, "Size of index buffer (VCN 0x%llx) of inode " + ntfs_log_error("Size of index buffer (VCN 0x%llx) of inode " "0x%llx exceeds maximum size.", (unsigned long long)vcn, ni->mft_no); goto err_out; @@ -368,7 +371,7 @@ descend_into_child_node: if ((u8*)ie < (u8*)ia || (u8*)ie + sizeof(INDEX_ENTRY_HEADER) > index_end || (u8*)ie + le16_to_cpu(ie->length) > index_end) { - ntfs_error(sb, "Index entry out of bounds in inode " + ntfs_log_error("Index entry out of bounds in inode " "0x%llx.", ni->mft_no); goto err_out; } @@ -396,7 +399,7 @@ ia_done: rc = ntfs_collate(vol, cr, key, key_len, &ie->key, le16_to_cpu(ie->key_length)); if (rc == NTFS_COLLATION_ERROR) { - ntfs_error(, "Collation error. Probably filename " + ntfs_log_error("Collation error. Probably filename " "contain invalid characters."); err = ERANGE; goto err_out; @@ -421,12 +424,12 @@ ia_done: * the presence of a child node and if not present return ENOENT. */ if (!(ie->flags & INDEX_ENTRY_NODE)) { - ntfs_debug("Entry not found."); + ntfs_log_debug("Entry not found.\n"); err = ENOENT; goto ia_done; } if ((ia->index.flags & NODE_MASK) == LEAF_NODE) { - ntfs_error(sb, "Index entry with child node found in a leaf " + ntfs_log_error("Index entry with child node found in a leaf " "node in inode 0x%llx.", ni->mft_no); goto err_out; } @@ -434,12 +437,11 @@ ia_done: vcn = sle64_to_cpup((sle64*)((u8*)ie + le16_to_cpu(ie->length) - 8)); if (vcn >= 0) goto descend_into_child_node; - ntfs_error(sb, "Negative child node vcn in inode 0x%llx.", ni->mft_no); + ntfs_log_error("Negative child node vcn in inode 0x%llx.", ni->mft_no); err_out: if (na) ntfs_attr_close(na); - if (ia) - free(ia); + free(ia); if (!err) err = EIO; if (actx) @@ -447,7 +449,7 @@ err_out: errno = err; return -1; idx_err_out: - ntfs_error(sb, "Corrupt index. Aborting lookup."); + ntfs_log_error("Corrupt index. Aborting lookup."); goto err_out; } @@ -469,9 +471,9 @@ int ntfs_index_add_filename(ntfs_inode *ni, FILE_NAME_ATTR *fn, MFT_REF mref) INDEX_HEADER *ih; int err, fn_size, ie_size, allocated_size = 0; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); if (!ni || !fn) { - ntfs_error(, "Invalid arguments."); + ntfs_log_error("Invalid arguments."); errno = EINVAL; return -1; } @@ -485,12 +487,12 @@ retry: /* Find place where insert new entry. */ if (!ntfs_index_lookup(fn, fn_size, ictx)) { err = EEXIST; - ntfs_error(, "Index already have such entry."); + ntfs_log_error("Index already have such entry."); goto err_out; } if (errno != ENOENT) { err = errno; - ntfs_error(, "Failed to find place where to insert new entry."); + ntfs_log_error("Failed to find place where to insert new entry."); goto err_out; } /* Some setup. */ @@ -512,21 +514,21 @@ retry: ictx->name_len); if (!na) { err = errno; - ntfs_error(, "Failed to open INDEX_ROOT."); + ntfs_log_error("Failed to open INDEX_ROOT."); goto err_out; } if (ntfs_attr_truncate(na, allocated_size + offsetof( INDEX_ROOT, index))) { err = EOPNOTSUPP; ntfs_attr_close(na); - ntfs_error(, "Failed to truncate INDEX_ROOT."); + ntfs_log_error("Failed to truncate INDEX_ROOT."); goto err_out; } ntfs_attr_close(na); ntfs_index_ctx_reinit(ictx); goto retry; } - ntfs_debug("Not implemented case."); + ntfs_log_debug("Not implemented case.\n"); err = EOPNOTSUPP; goto err_out; } @@ -553,10 +555,10 @@ retry: ntfs_index_entry_mark_dirty(ictx); ntfs_index_ctx_put(ictx); free(ie); - ntfs_debug("Done."); + ntfs_log_trace("Done.\n"); return 0; err_out: - ntfs_debug("Failed."); + ntfs_log_trace("Failed.\n"); ntfs_index_ctx_put(ictx); errno = err; return -1; @@ -579,10 +581,10 @@ int ntfs_index_rm(ntfs_index_context *ictx) u32 new_index_length; int err; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); if (!ictx || (!ictx->ia && !ictx->ir) || ictx->entry->flags & INDEX_ENTRY_END) { - ntfs_error(, "Invalid arguments."); + ntfs_log_error("Invalid arguments."); err = EINVAL; goto err_out; } @@ -621,25 +623,25 @@ int ntfs_index_rm(ntfs_index_context *ictx) ictx->name_len); if (!na) { err = errno; - ntfs_error(, "Failed to open INDEX_ROOT attribute. " + ntfs_log_error("Failed to open INDEX_ROOT attribute. " "Leaving inconsist metadata."); goto err_out; } if (ntfs_attr_truncate(na, new_index_length + offsetof( INDEX_ROOT, index))) { err = errno; - ntfs_error(, "Failed to truncate INDEX_ROOT attribute. " + ntfs_log_error("Failed to truncate INDEX_ROOT attribute. " " Leaving inconsist metadata."); goto err_out; } ntfs_attr_close(na); } ntfs_index_ctx_reinit(ictx); - ntfs_debug("Done."); + ntfs_log_trace("Done.\n"); return 0; err_out: ntfs_index_ctx_reinit(ictx); - ntfs_debug("Failed."); + ntfs_log_trace("Failed.\n"); errno = err; return -1; } @@ -647,30 +649,29 @@ err_out: #ifdef NTFS_RICH -#include +#ifdef HAVE_STRING_H #include - -#include "index.h" +#endif #include "rich.h" /** * ntfs_ie_free */ -void ntfs_ie_free (INDEX_ENTRY *ie) +void ntfs_ie_free(INDEX_ENTRY *ie) { - free (ie); + free(ie); } /** * ntfs_ie_create */ -INDEX_ENTRY * ntfs_ie_create (void) +INDEX_ENTRY * ntfs_ie_create(void) { int length; INDEX_ENTRY *ie; length = 16; - ie = calloc (1, length); + ie = calloc(1, length); if (!ie) return NULL; @@ -685,7 +686,7 @@ INDEX_ENTRY * ntfs_ie_create (void) /** * ntfs_ie_get_vcn */ -VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie) +VCN ntfs_ie_get_vcn(INDEX_ENTRY *ie) { if (!ie) return -1; @@ -698,17 +699,17 @@ VCN ntfs_ie_get_vcn (INDEX_ENTRY *ie) /** * ntfs_ie_copy */ -INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie) +INDEX_ENTRY * ntfs_ie_copy(INDEX_ENTRY *ie) { INDEX_ENTRY *copy = NULL; if (!ie) return NULL; - copy = malloc (ie->length); + copy = malloc(ie->length); if (!copy) return NULL; - memcpy (copy, ie, ie->length); + memcpy(copy, ie, ie->length); return copy; } @@ -716,14 +717,14 @@ INDEX_ENTRY * ntfs_ie_copy (INDEX_ENTRY *ie) /** * ntfs_ie_set_vcn */ -INDEX_ENTRY * ntfs_ie_set_vcn (INDEX_ENTRY *ie, VCN vcn) +INDEX_ENTRY * ntfs_ie_set_vcn(INDEX_ENTRY *ie, VCN vcn) { if (!ie) return 0; if (!(ie->flags & INDEX_ENTRY_NODE)) { ie->length += 8; - ie = realloc (ie, ie->length); + ie = realloc(ie, ie->length); if (!ie) return NULL; @@ -737,7 +738,7 @@ INDEX_ENTRY * ntfs_ie_set_vcn (INDEX_ENTRY *ie, VCN vcn) /** * ntfs_ie_remove_vcn */ -INDEX_ENTRY * ntfs_ie_remove_vcn (INDEX_ENTRY *ie) +INDEX_ENTRY * ntfs_ie_remove_vcn(INDEX_ENTRY *ie) { if (!ie) return NULL; @@ -746,14 +747,14 @@ INDEX_ENTRY * ntfs_ie_remove_vcn (INDEX_ENTRY *ie) ie->length -= 8; ie->flags &= ~INDEX_ENTRY_NODE; - ie = realloc (ie, ie->length); + ie = realloc(ie, ie->length); return ie; } /** * ntfs_ie_set_name */ -INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype) +INDEX_ENTRY * ntfs_ie_set_name(INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype) { FILE_NAME_ATTR *file; int need; @@ -789,50 +790,50 @@ INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FI * VCN vcn; */ - //printf ("key length = 0x%02X\n", ie->key_length); - //printf ("new name length = %d\n", namelen); + //ntfs_log_debug("key length = 0x%02X\n", ie->key_length); + //ntfs_log_debug("new name length = %d\n", namelen); if (ie->key_length > 0) { file = &ie->key.file_name; - //printf ("filename, length %d\n", file->file_name_length); - need = ATTR_SIZE (namelen * sizeof (ntfschar) + 2) - - ATTR_SIZE (file->file_name_length * sizeof (ntfschar) + 2); + //ntfs_log_debug("filename, length %d\n", file->file_name_length); + need = ATTR_SIZE(namelen * sizeof(ntfschar) + 2) - + ATTR_SIZE(file->file_name_length * sizeof(ntfschar) + 2); } else { - //printf ("no filename\n"); - need = ATTR_SIZE (sizeof (FILE_NAME_ATTR) + (namelen * sizeof (ntfschar))); + //ntfs_log_debug("no filename\n"); + need = ATTR_SIZE(sizeof(FILE_NAME_ATTR) + (namelen * sizeof(ntfschar))); wipe = TRUE; } - //printf ("need 0x%02X bytes\n", need); + //ntfs_log_debug("need 0x%02X bytes\n", need); if (need != 0) { if (ie->flags & INDEX_ENTRY_NODE) - vcn = ntfs_ie_get_vcn (ie); + vcn = ntfs_ie_get_vcn(ie); ie->length += need; ie->key_length += need; - //printf ("realloc 0x%02X\n", ie->length); - ie = realloc (ie, ie->length); + //ntfs_log_debug("realloc 0x%02X\n", ie->length); + ie = realloc(ie, ie->length); if (!ie) return NULL; if (ie->flags & INDEX_ENTRY_NODE) - ie = ntfs_ie_set_vcn (ie, vcn); + ie = ntfs_ie_set_vcn(ie, vcn); if (wipe) - memset (&ie->key.file_name, 0, sizeof (FILE_NAME_ATTR)); + memset(&ie->key.file_name, 0, sizeof(FILE_NAME_ATTR)); if (need > 0) - memset ((u8*)ie + ie->length - need, 0, need); + memset((u8*)ie + ie->length - need, 0, need); } - memcpy (ie->key.file_name.file_name, name, namelen * sizeof (ntfschar)); + memcpy(ie->key.file_name.file_name, name, namelen * sizeof(ntfschar)); ie->key.file_name.file_name_length = namelen; ie->key.file_name.file_name_type = nametype; ie->flags &= ~INDEX_ENTRY_END; - //printf ("ie->length = 0x%02X\n", ie->length); - //printf ("ie->key_length = 0x%02X\n", ie->key_length); + //ntfs_log_debug("ie->length = 0x%02X\n", ie->length); + //ntfs_log_debug("ie->key_length = 0x%02X\n", ie->key_length); return ie; } @@ -840,7 +841,7 @@ INDEX_ENTRY * ntfs_ie_set_name (INDEX_ENTRY *ie, ntfschar *name, int namelen, FI /** * ntfs_ie_remove_name */ -INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) +INDEX_ENTRY * ntfs_ie_remove_name(INDEX_ENTRY *ie) { VCN vcn = 0; @@ -850,18 +851,18 @@ INDEX_ENTRY * ntfs_ie_remove_name (INDEX_ENTRY *ie) return ie; if (ie->flags & INDEX_ENTRY_NODE) - vcn = ntfs_ie_get_vcn (ie); + vcn = ntfs_ie_get_vcn(ie); - ie->length -= ATTR_SIZE (ie->key_length); + ie->length -= ATTR_SIZE(ie->key_length); ie->key_length = 0; ie->flags |= INDEX_ENTRY_END; - ie = realloc (ie, ie->length); + ie = realloc(ie, ie->length); if (!ie) return NULL; if (ie->flags & INDEX_ENTRY_NODE) - ie = ntfs_ie_set_vcn (ie, vcn); + ie = ntfs_ie_set_vcn(ie, vcn); return ie; } diff --git a/libntfs/inode.c b/libntfs/inode.c index 96a41854..b13b24da 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -1,4 +1,4 @@ -/* +/** * inode.c - Inode handling code. Part of the Linux-NTFS project. * * Copyright (c) 2002-2005 Anton Altaparmakov @@ -21,7 +21,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDLIB_H #include @@ -34,7 +36,6 @@ #endif #include "compat.h" - #include "types.h" #include "attrib.h" #include "inode.h" @@ -46,6 +47,7 @@ #include "index.h" #include "dir.h" #include "ntfstime.h" +#include "logging.h" /** * Internal: @@ -80,11 +82,10 @@ ntfs_inode *ntfs_inode_allocate(ntfs_volume *vol) static __inline__ int __ntfs_inode_release(ntfs_inode *ni) { if (NInoDirty(ni)) - Dputs("Eeek. Discarding dirty inode!"); + ntfs_log_debug("Eeek. Discarding dirty inode!\n"); if (NInoAttrList(ni) && ni->attr_list) free(ni->attr_list); - if (ni->mrec) - free(ni->mrec); + free(ni->mrec); free(ni); return 0; } @@ -120,7 +121,7 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) int err = 0; STANDARD_INFORMATION *std_info; - Dprintf("%s(): Entering for inode 0x%llx.\n", __FUNCTION__, MREF(mref)); + ntfs_log_trace("Entering for inode 0x%llx.\n", MREF(mref)); if (!vol) { errno = EINVAL; return NULL; @@ -144,8 +145,8 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) if (ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, CASE_SENSITIVE, 0, NULL, 0, ctx)) { err = errno; - Dprintf("%s(): Failed to receive STANDARD_INFORMATION " - "attribute.\n", __FUNCTION__); + ntfs_log_trace("Failed to receive STANDARD_INFORMATION " + "attribute.\n"); goto put_err_out; } std_info = (STANDARD_INFORMATION *)((u8 *)ctx->attr + @@ -280,15 +281,15 @@ int ntfs_inode_close(ntfs_inode *ni) /* Ignore errors, they don't really matter. */ if (tmp_nis) base_ni->extent_nis = tmp_nis; - } else if(tmp_nis) + } else if (tmp_nis) free(tmp_nis); /* Allow for error checking. */ i = -1; break; } if (i != -1) - Dputs("Extent inode was not attached to base inode! " - "Weird! Continuing regardless."); + ntfs_log_debug("Extent inode was not attached to base inode! " + "Weird! Continuing regardless.\n"); } return __ntfs_inode_release(ni); } @@ -329,8 +330,8 @@ ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref) errno = EINVAL; return NULL; } - Dprintf("%s(): Opening extent inode 0x%llx (base mft record 0x%llx).\n", - __FUNCTION__, (unsigned long long)mft_no, + ntfs_log_trace("Opening extent inode 0x%llx (base mft record 0x%llx).\n", + (unsigned long long)mft_no, (unsigned long long)base_ni->mft_no); /* Is the extent inode already open and attached to the base inode? */ if (base_ni->nr_extents > 0) { @@ -345,9 +346,8 @@ ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref) seq_no = MSEQNO_LE(mref); if (seq_no && seq_no != le16_to_cpu( ni->mrec->sequence_number)) { - Dputs("Found stale extent mft reference! " - "Corrupt file system. Run " - "chkdsk."); + ntfs_log_debug("Found stale extent mft reference! " + "Corrupt file system. Run chkdsk.\n"); errno = EIO; return NULL; } @@ -385,7 +385,7 @@ err_out: i = errno; __ntfs_inode_release(ni); errno = i; - Dperror("Failed to open extent inode"); + ntfs_log_perror("Failed to open extent inode"); return NULL; } @@ -401,7 +401,7 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) u64 prev_attached = 0; if (!ni) { - Dprintf("%s(): Invalid arguments.\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments.\n"); errno = EINVAL; return -1; } @@ -409,15 +409,14 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) if (ni->nr_extents == -1) ni = ni->base_ni; - Dprintf("%s(): Entering for inode 0x%llx.\n", - __FUNCTION__, (long long) ni->mft_no); + ntfs_log_trace("Entering for inode 0x%llx.\n", (long long) ni->mft_no); /* Inode haven't got attribute list, thus nothing to attach. */ if (!NInoAttrList(ni)) return 0; if (!ni->attr_list) { - Dprintf("%s(): Corrupt in-memory struct.\n", __FUNCTION__); + ntfs_log_trace("Corrupt in-memory struct.\n"); errno = EINVAL; return -1; } @@ -430,8 +429,7 @@ int ntfs_inode_attach_all_extents(ntfs_inode *ni) prev_attached != MREF_LE(ale->mft_reference)) { if (!ntfs_extent_inode_open(ni, MREF_LE(ale->mft_reference))) { - Dprintf("%s(): Couldn't attach extent inode.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't attach extent inode.\n"); return -1; } prev_attached = MREF_LE(ale->mft_reference); @@ -459,8 +457,8 @@ static int ntfs_inode_sync_standard_information(ntfs_inode *ni) if (ntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, CASE_SENSITIVE, 0, NULL, 0, ctx)) { err = errno; - Dprintf("%s(): Failed to receive STANDARD_INFORMATION " - "attribute.\n", __FUNCTION__); + ntfs_log_trace("Failed to receive STANDARD_INFORMATION " + "attribute.\n"); ntfs_attr_put_search_ctx(ctx); errno = err; return -1; @@ -507,8 +505,7 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni) ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { err = errno; - Dprintf("%s(): Failed to get attribute search context.\n", - __FUNCTION__); + ntfs_log_trace("Failed to get attribute search context.\n"); goto err_out; } /* Walk through all FILE_NAME attributes and update them. */ @@ -530,16 +527,14 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni) if (!index_ni) { if (!err) err = errno; - Dprintf("%s(): Failed to open inode with index.\n", - __FUNCTION__); + ntfs_log_trace("Failed to open inode with index.\n"); continue; } ictx = ntfs_index_ctx_get(index_ni, I30, 4); if (!ictx) { if (!err) err = errno; - Dprintf("%s(): Failed to get index context.\n", - __FUNCTION__); + ntfs_log_trace("Failed to get index context.\n"); ntfs_inode_close(index_ni); continue; } @@ -550,7 +545,7 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni) else err = errno; } - Dprintf("%s(): Index lookup failed.\n", __FUNCTION__); + ntfs_log_trace("Index lookup failed.\n"); ntfs_index_ctx_put(ictx); ntfs_inode_close(index_ni); continue; @@ -584,7 +579,7 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni) /* Check for real error occurred. */ if (errno != ENOENT) { err = errno; - Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); + ntfs_log_trace("Attribute lookup failed.\n"); goto err_out; } ntfs_attr_put_search_ctx(ctx); @@ -628,8 +623,7 @@ int ntfs_inode_sync(ntfs_inode *ni) return -1; } - Dprintf("%s(): Entering for inode 0x%llx.\n", - __FUNCTION__, (long long) ni->mft_no); + ntfs_log_trace("Entering for inode 0x%llx.\n", (long long) ni->mft_no); /* Update STANDARD_INFORMATION. */ if ((ni->mrec->flags & MFT_RECORD_IN_USE) && ni->nr_extents != -1 && @@ -639,8 +633,7 @@ int ntfs_inode_sync(ntfs_inode *ni) if (err != EIO) err = EBUSY; } - Dprintf("%s(): Failed to sync standard information.\n", - __FUNCTION__); + ntfs_log_trace("Failed to sync standard information.\n"); } /* Update FILE_NAME's in the index. */ @@ -652,8 +645,7 @@ int ntfs_inode_sync(ntfs_inode *ni) if (err != EIO) err = EBUSY; } - Dprintf("%s(): Failed to sync FILE_NAME attributes.\n", - __FUNCTION__); + ntfs_log_trace("Failed to sync FILE_NAME attributes.\n"); NInoFileNameSetDirty(ni); } @@ -668,8 +660,8 @@ int ntfs_inode_sync(ntfs_inode *ni) err = errno; if (err != EIO) err = EBUSY; - Dprintf("%s(): Attribute list sync failed " - "(open failed).\n", __FUNCTION__); + ntfs_log_trace("Attribute list sync failed (open " + "failed).\n"); } NInoAttrListSetDirty(ni); } else { @@ -681,16 +673,14 @@ int ntfs_inode_sync(ntfs_inode *ni) err = errno; if (err != EIO) err = EBUSY; - Dprintf("%s(): Attribute list " - "sync failed (write failed).\n", - __FUNCTION__); + ntfs_log_trace("Attribute list sync " + "failed (write failed).\n"); } NInoAttrListSetDirty(ni); } } else { err = EIO; - Dprintf("%s(): Attribute list sync failed " - "(invalid size).\n", __FUNCTION__); + ntfs_log_trace("Attribute list sync failed (invalid size).\n"); NInoAttrListSetDirty(ni); } ntfs_attr_close(na); @@ -706,8 +696,7 @@ int ntfs_inode_sync(ntfs_inode *ni) err = EBUSY; } NInoSetDirty(ni); - Dprintf("%s(): Base MFT record sync failed.\n", - __FUNCTION__); + ntfs_log_trace("Base MFT record sync failed.\n"); } } @@ -728,8 +717,8 @@ int ntfs_inode_sync(ntfs_inode *ni) err = EBUSY; } NInoSetDirty(eni); - Dprintf("%s(): Extent MFT record sync " - "failed.\n", __FUNCTION__); + ntfs_log_trace("Extent MFT record sync " + "failed.\n"); } } } @@ -762,17 +751,15 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) ntfs_attr *na; if (!ni) { - Dprintf("%s(): Invalid arguments.\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments.\n"); errno = EINVAL; return -1; } - Dprintf("%s(): Entering for inode 0x%llx.\n", - __FUNCTION__, (long long) ni->mft_no); + ntfs_log_trace("Entering for inode 0x%llx.\n", (long long) ni->mft_no); if (NInoAttrList(ni) || ni->nr_extents) { - Dprintf("%s(): Inode already has got attribute list.\n", - __FUNCTION__); + ntfs_log_trace("Inode already has got attribute list.\n"); errno = EEXIST; return -1; } @@ -782,7 +769,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) al = malloc(al_allocated); ale = (ATTR_LIST_ENTRY *) al; if (!al) { - Dprintf("%s(): Not enough memory.\n", __FUNCTION__); + ntfs_log_trace("Not enough memory.\n"); errno = ENOMEM; return -1; } @@ -791,15 +778,14 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { err = errno; - Dprintf("%s(): Couldn't get search context.\n", __FUNCTION__); + ntfs_log_trace("Couldn't get search context.\n"); goto err_out; } /* Walk through all attributes. */ while (!ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx)) { if (ctx->attr->type == AT_ATTRIBUTE_LIST) { err = EIO; - Dprintf("%s(): Eeek! Attribute list already present.\n", - __FUNCTION__); + ntfs_log_trace("Eeek! Attribute list already present.\n"); goto put_err_out; } /* Calculate new length of attribute list. */ @@ -810,8 +796,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) al_allocated += 0x40; aln = realloc(al, al_allocated); if (!aln) { - Dprintf("%s(): Not enough memory.\n", - __FUNCTION__); + ntfs_log_trace("Not enough memory.\n"); err = ENOMEM; goto put_err_out; } @@ -839,14 +824,14 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) /* Check for real error occurred. */ if (errno != ENOENT) { err = errno; - Dprintf("%s(): Attribute lookup failed.\n", __FUNCTION__); + ntfs_log_trace("Attribute lookup failed.\n"); goto put_err_out; } /* Deallocate trailing memory. */ aln = realloc(al, al_len); if (!aln) { err = errno; - Dprintf("%s(): realloc() failed.\n", __FUNCTION__); + ntfs_log_trace("realloc() failed.\n"); goto put_err_out; } al = aln; @@ -865,8 +850,8 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) offsetof(ATTR_RECORD, resident_end))) { /* Failed to free space. */ err = errno; - Dprintf("%s(): Failed to free space for " - "$ATTRIBUTE_LIST.\n", __FUNCTION__); + ntfs_log_trace("Failed to free space for " + "$ATTRIBUTE_LIST.\n"); goto rollback; } } @@ -875,8 +860,7 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) if (ntfs_resident_attr_record_add(ni, AT_ATTRIBUTE_LIST, NULL, 0, NULL, 0, 0) < 0) { err = errno; - Dprintf("%s(): Couldn't add $ATTRIBUTE_LIST to MFT record.\n", - __FUNCTION__); + ntfs_log_trace("Couldn't add $ATTRIBUTE_LIST to MFT record.\n"); goto rollback; } @@ -884,14 +868,12 @@ int ntfs_inode_add_attrlist(ntfs_inode *ni) na = ntfs_attr_open(ni, AT_ATTRIBUTE_LIST, AT_UNNAMED, 0); if (!na) { err = errno; - Dprintf("%s(): Failed to open just added $ATTRIBUTE_LIST.\n", - __FUNCTION__); + ntfs_log_trace("Failed to open just added $ATTRIBUTE_LIST.\n"); goto remove_attrlist_record; } if (ntfs_attr_truncate(na, al_len)) { err = errno; - Dprintf("%s(): Failed to resize just added $ATTRIBUTE_LIST.\n", - __FUNCTION__); + ntfs_log_trace("Failed to resize just added $ATTRIBUTE_LIST.\n"); ntfs_attr_close(na); goto remove_attrlist_record;; } @@ -907,11 +889,11 @@ remove_attrlist_record: if (!ntfs_attr_lookup(AT_ATTRIBUTE_LIST, NULL, 0, CASE_SENSITIVE, 0, NULL, 0, ctx)) { if (ntfs_attr_record_rm(ctx)) - Dprintf("%s(): Rollback failed. Failed to remove " - "attribute list record.\n", __FUNCTION__); + ntfs_log_trace("Rollback failed. Failed to remove attribute " + "list record.\n"); } else - Dprintf("%s(): Rollback failed. Couldn't find attribute list " - "record.\n", __FUNCTION__); + ntfs_log_trace("Rollback failed. Couldn't find attribute list " + "record.\n"); /* Setup back in-memory runlist. */ ni->attr_list = al; ni->attr_list_size = al_len; @@ -931,14 +913,11 @@ rollback: sle64_to_cpu(ale->lowest_vcn), NULL, 0, ctx)) { if (ntfs_attr_record_move_to(ctx, ni)) - Dprintf("%s(): Rollback failed. " - "Couldn't back attribute to " - "base MFT record.\n", - __FUNCTION__); + ntfs_log_trace("Rollback failed. Couldn't " + "back attribute to base MFT record.\n"); } else - Dprintf("%s(): Rollback failed. " - "ntfs_attr_lookup failed.\n", - __FUNCTION__); + ntfs_log_trace("Rollback failed. ntfs_attr_lookup " + "failed.\n"); ntfs_attr_reinit_search_ctx(ctx); } ale = (ATTR_LIST_ENTRY*)((u8*)ale + le16_to_cpu(ale->length)); @@ -969,13 +948,13 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) int freed, err; if (!ni || size < 0) { - Dprintf("%s(): Invalid arguments.\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments.\n"); errno = EINVAL; return -1; } - Dprintf("%s(): Entering for inode 0x%llx, size %d.\n", - __FUNCTION__, (long long) ni->mft_no, size); + ntfs_log_trace("Entering for inode 0x%llx, size %d.\n", + (long long) ni->mft_no, size); freed = (le32_to_cpu(ni->mrec->bytes_allocated) - le32_to_cpu(ni->mrec->bytes_in_use)); @@ -986,8 +965,7 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { err = errno; - Dprintf("%s(): Failed to get attribute search context.\n", - __FUNCTION__); + ntfs_log_trace("Failed to get attribute search context.\n"); errno = err; return -1; } @@ -1010,8 +988,7 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) 0, ctx)) { if (errno != ENOENT) { err = errno; - Dprintf("%s(): Attribute lookup failed.\n", - __FUNCTION__); + ntfs_log_trace("Attribute lookup failed.\n"); goto put_err_out; } if (ctx->attr->type == AT_END) { @@ -1032,8 +1009,7 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) 0, NULL, 0, ctx)) { err = errno; if (errno != ENOENT) { - Dprintf("%s(): Attribute lookup failed." - "\n", __FUNCTION__); + ntfs_log_trace("Attribute lookup failed.\n"); } else err = ENOSPC; goto put_err_out; @@ -1045,8 +1021,7 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) /* Move away attribute. */ if (ntfs_attr_record_move_away(ctx, 0)) { err = errno; - Dprintf("%s(): Failed to move out attribute.\n", - __FUNCTION__); + ntfs_log_trace("Failed to move out attribute.\n"); break; } freed += record_size; @@ -1066,8 +1041,7 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) NULL, 0, ctx)) { if (errno != ENOENT) { err = errno; - Dprintf("%s(): Attribute lookup failed.\n", - __FUNCTION__); + ntfs_log_trace("Attribute lookup failed.\n"); break; } if (ctx->attr->type == AT_END) { @@ -1079,8 +1053,7 @@ int ntfs_inode_free_space(ntfs_inode *ni, int size) put_err_out: ntfs_attr_put_search_ctx(ctx); if (err == ENOSPC) - Dprintf("%s(): No attributes left that can be moved out.\n", - __FUNCTION__); + ntfs_log_trace("No attributes left that can be moved out.\n"); errno = err; return -1; } @@ -1091,12 +1064,12 @@ put_err_out: /** * ntfs_inode_close2 */ -int ntfs_inode_close2 (ntfs_inode *ni) +int ntfs_inode_close2(ntfs_inode *ni) { if (!ni) return 0; - //printf (BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); + //ntfs_log_debug(BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); ni->ref_count--; if (ni->ref_count > 0) @@ -1108,13 +1081,13 @@ int ntfs_inode_close2 (ntfs_inode *ni) // XXX temporary until we have commit/rollback NInoClearDirty(ni); - return ntfs_inode_close (ni); + return ntfs_inode_close(ni); } /** * ntfs_inode_open2 */ -ntfs_inode * ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) +ntfs_inode * ntfs_inode_open2(ntfs_volume *vol, const MFT_REF mref) { ntfs_inode *ino = NULL; struct ntfs_dir *dir; @@ -1134,12 +1107,12 @@ ntfs_inode * ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) } if (ino) { - //printf (BOLD YELLOW "inode reuse %lld\n" END, mref); + //ntfs_log_debug(BOLD YELLOW "inode reuse %lld\n" END, mref); ino->ref_count++; return ino; } - ino = ntfs_inode_open (vol, mref); + ino = ntfs_inode_open(vol, mref); if (!ino) return NULL; @@ -1154,7 +1127,7 @@ ntfs_inode * ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) ino->private_data = NULL; ino->ref_count = 1; - //printf (BOLD YELLOW "inode open %lld\n" END, mref); + //ntfs_log_debug(BOLD YELLOW "inode open %lld\n" END, mref); return ino; } @@ -1162,20 +1135,20 @@ ntfs_inode * ntfs_inode_open2 (ntfs_volume *vol, const MFT_REF mref) * ntfs_inode_open3 * open a deleted inode */ -ntfs_inode * ntfs_inode_open3 (ntfs_volume *vol, const MFT_REF mref) +ntfs_inode * ntfs_inode_open3(ntfs_volume *vol, const MFT_REF mref) { ntfs_inode *ino = NULL; if (!vol) return NULL; - ino = calloc (1, sizeof (*ino)); + ino = calloc(1, sizeof(*ino)); if (!ino) return NULL; - ino->mrec = malloc (vol->mft_record_size); + ino->mrec = malloc(vol->mft_record_size); if (!ino->mrec) { - free (ino); + free(ino); return NULL; } @@ -1188,14 +1161,14 @@ ntfs_inode * ntfs_inode_open3 (ntfs_volume *vol, const MFT_REF mref) ino->private_data = NULL; ino->ref_count = 1; - if (1 != ntfs_attr_mst_pread (vol->mft_na, MREF(mref) * vol->mft_record_size, 1, vol->mft_record_size, ino->mrec)) { - //ntfs_inode_close2 (ino); ??? - free (ino->mrec); - free (ino); + if (1 != ntfs_attr_mst_pread(vol->mft_na, MREF(mref) * vol->mft_record_size, 1, vol->mft_record_size, ino->mrec)) { + //ntfs_inode_close2(ino); ??? + free(ino->mrec); + free(ino); return NULL; } - NInoSetDirty (ino); + NInoSetDirty(ino); return ino; } diff --git a/libntfs/lcnalloc.c b/libntfs/lcnalloc.c index 807e6537..f40f3604 100644 --- a/libntfs/lcnalloc.c +++ b/libntfs/lcnalloc.c @@ -1,4 +1,4 @@ -/* +/** * lcnalloc.c - Cluster (de)allocation code. Part of the Linux-NTFS project. * * Copyright (c) 2002-2004 Anton Altaparmakov @@ -20,7 +20,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDLIB_H #include @@ -39,6 +41,7 @@ #include "runlist.h" #include "volume.h" #include "lcnalloc.h" +#include "logging.h" /** * ntfs_cluster_alloc - allocate clusters on an ntfs volume @@ -107,13 +110,12 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, int err = 0, rlpos, rlsize, buf_size; u8 pass, done_zones, search_zone, need_writeback, bit; - Dprintf("%s(): Entering with count = 0x%llx, start_lcn = 0x%llx, " - "zone = %s_ZONE.\n", __FUNCTION__, (long long)count, - (long long)start_lcn, + ntfs_log_trace("Entering with count = 0x%llx, start_lcn = 0x%llx, zone = " + "%s_ZONE.\n", (long long)count, (long long)start_lcn, zone == MFT_ZONE ? "MFT" : "DATA"); if (!vol || count < 0 || start_lcn < -1 || !vol->lcnbmp_na || (s8)zone < FIRST_ZONE || zone > LAST_ZONE) { - Dprintf("%s(): Invalid arguments!\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments!\n"); errno = EINVAL; return NULL; } @@ -207,30 +209,27 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, clusters = count; rlpos = rlsize = 0; while (1) { - Dprintf("%s(): Start of outer while loop: done_zones = 0x%x, " + ntfs_log_trace("Start of outer while loop: done_zones = 0x%x, " "search_zone = %i, pass = %i, zone_start = " "0x%llx, zone_end = 0x%llx, bmp_initial_pos = " "0x%llx, bmp_pos = 0x%llx, rlpos = %i, rlsize = " - "%i.\n", __FUNCTION__, done_zones, search_zone, - pass, (long long)zone_start, - (long long)zone_end, (long long)bmp_initial_pos, - (long long)bmp_pos, rlpos, rlsize); + "%i.\n", done_zones, search_zone, pass, + (long long)zone_start, (long long)zone_end, + (long long)bmp_initial_pos, (long long)bmp_pos, + rlpos, rlsize); /* Loop until we run out of free clusters. */ last_read_pos = bmp_pos >> 3; - Dprintf("%s(): last_read_pos = 0x%llx.\n", __FUNCTION__, - (long long)last_read_pos); + ntfs_log_trace("last_read_pos = 0x%llx.\n", (long long)last_read_pos); br = ntfs_attr_pread(vol->lcnbmp_na, last_read_pos, 8192, buf); if (br <= 0) { if (!br) { /* Reached end of attribute. */ - Dprintf("%s(): End of attribute reached. " - "Skipping to zone_pass_done.\n", - __FUNCTION__); + ntfs_log_trace("End of attribute reached. Skipping " + "to zone_pass_done.\n"); goto zone_pass_done; } err = errno; - Dprintf("%s(): ntfs_attr_pread() failed. Aborting.\n", - __FUNCTION__); + ntfs_log_trace("ntfs_attr_pread() failed. Aborting.\n"); goto err_ret; } /* @@ -241,109 +240,90 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, lcn = bmp_pos & 7; bmp_pos &= ~7; need_writeback = 0; - Dprintf("%s(): Before inner while loop: buf_size = %i, " - "lcn = 0x%llx, bmp_pos = 0x%llx, need_writeback " - "= %i.\n", __FUNCTION__, buf_size, - (long long)lcn, (long long)bmp_pos, + ntfs_log_trace("Before inner while loop: buf_size = %i, lcn = " + "0x%llx, bmp_pos = 0x%llx, need_writeback = %i.\n", + buf_size, (long long)lcn, (long long)bmp_pos, need_writeback); while (lcn < buf_size && lcn + bmp_pos < zone_end) { byte = buf + (lcn >> 3); - Dprintf("%s(): In inner while loop: buf_size = %i, " - "lcn = 0x%llx, bmp_pos = 0x%llx, " + ntfs_log_trace("In inner while loop: buf_size = %i, lcn = " + "0x%llx, bmp_pos = 0x%llx, " "need_writeback = %i, byte ofs = 0x%x, " - "*byte = 0x%x.\n", __FUNCTION__, - buf_size, (long long)lcn, - (long long)bmp_pos, need_writeback, - (unsigned int)(lcn >> 3), + "*byte = 0x%x.\n", buf_size, + (long long)lcn, (long long)bmp_pos, + need_writeback, (unsigned int)(lcn >> 3), (unsigned int)*byte); /* Skip full bytes. */ if (*byte == 0xff) { lcn = (lcn + 8) & ~7; - Dprintf("%s(): continuing while loop 1.\n", - __FUNCTION__); + ntfs_log_trace("continuing while loop 1.\n"); continue; } bit = 1 << (lcn & 7); - Dprintf("%s(): bit = %i.\n", __FUNCTION__, bit); + ntfs_log_trace("bit = %i.\n", bit); /* If the bit is already set, go onto the next one. */ if (*byte & bit) { lcn++; - Dprintf("%s(): continuing while loop 2.\n", - __FUNCTION__); + ntfs_log_trace("continuing while loop 2.\n"); continue; } /* Reallocate memory if necessary. */ if ((rlpos + 2) * (int)sizeof(runlist) >= rlsize) { - Dprintf("%s(): Reallocating space.\n", - __FUNCTION__); + ntfs_log_trace("Reallocating space.\n"); if (!rl) - Dprintf("%s(): First free bit is at " - "LCN = 0x%llx.\n", - __FUNCTION__, - (long long)(lcn + - bmp_pos)); + ntfs_log_trace("First free bit is at LCN = " + "0x%llx.\n", (long long)(lcn + bmp_pos)); rlsize += 4096; trl = (runlist*)realloc(rl, rlsize); if (!trl) { err = ENOMEM; - Dprintf("%s(): Failed to allocate " - "memory, going to " - "wb_err_ret.\n", - __FUNCTION__); + ntfs_log_trace("Failed to allocate memory, " + "going to wb_err_ret.\n"); goto wb_err_ret; } rl = trl; - Dprintf("%s(): Reallocated memory, rlsize = " - "0x%x.\n", __FUNCTION__, - rlsize); + ntfs_log_trace("Reallocated memory, rlsize = " + "0x%x.\n", rlsize); } /* Allocate the bitmap bit. */ *byte |= bit; /* We need to write this bitmap buffer back to disk! */ need_writeback = 1; - Dprintf("%s(): *byte = 0x%x, need_writeback is set.\n", - __FUNCTION__, (unsigned int)*byte); + ntfs_log_trace("*byte = 0x%x, need_writeback is set.\n", + (unsigned int)*byte); /* * Coalesce with previous run if adjacent LCNs. * Otherwise, append a new run. */ - Dprintf("%s(): Adding run (lcn 0x%llx, len 0x%llx), " + ntfs_log_trace("Adding run (lcn 0x%llx, len 0x%llx), " "prev_lcn = 0x%llx, lcn = 0x%llx, " "bmp_pos = 0x%llx, prev_run_len = " - "0x%llx, rlpos = %i.\n", __FUNCTION__, + "0x%llx, rlpos = %i.\n", (long long)(lcn + bmp_pos), 1LL, (long long)prev_lcn, (long long)lcn, (long long)bmp_pos, (long long)prev_run_len, rlpos); if (prev_lcn == lcn + bmp_pos - prev_run_len && rlpos) { - Dprintf("%s(): Coalescing to run (lcn 0x%llx, " - "len 0x%llx).\n", __FUNCTION__, + ntfs_log_trace("Coalescing to run (lcn 0x%llx, len " + "0x%llx).\n", (long long)rl[rlpos - 1].lcn, - (long long) - rl[rlpos - 1].length); + (long long) rl[rlpos - 1].length); rl[rlpos - 1].length = ++prev_run_len; - Dprintf("%s(): Run now (lcn 0x%llx, len 0x%llx), " + ntfs_log_trace("Run now (lcn 0x%llx, len 0x%llx), " "prev_run_len = 0x%llx.\n", - __FUNCTION__, (long long)rl[rlpos - 1].lcn, (long long)rl[rlpos - 1].length, (long long)prev_run_len); } else { if (rlpos) { - Dprintf("%s(): Adding new run, " - "(previous run lcn " - "0x%llx, len 0x%llx).\n", - __FUNCTION__, - (long long) - rl[rlpos - 1].lcn, - (long long) - rl[rlpos - 1].length); + ntfs_log_trace("Adding new run, (previous " + "run lcn 0x%llx, len 0x%llx).\n", + (long long) rl[rlpos - 1].lcn, + (long long) rl[rlpos - 1].length); rl[rlpos].vcn = rl[rlpos - 1].vcn + prev_run_len; } else { - Dprintf("%s(): Adding new run, is " - "first run.\n", - __FUNCTION__); + ntfs_log_trace("Adding new run, is first run.\n"); rl[rlpos].vcn = start_vcn; } rl[rlpos].lcn = prev_lcn = lcn + bmp_pos; @@ -359,19 +339,13 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, * during the respective zone switches. */ tc = lcn + bmp_pos + 1; - Dprintf("%s(): Done. Updating current zone " - "position, tc = 0x%llx, " - "search_zone = %i.\n", - __FUNCTION__, (long long)tc, - search_zone); + ntfs_log_trace("Done. Updating current zone " + "position, tc = 0x%llx, search_zone = %i.\n", + (long long)tc, search_zone); switch (search_zone) { case 1: - Dprintf("%s(): Before checks, " - "vol->mft_zone_pos = " - "0x%llx.\n", - __FUNCTION__, - (long long) - vol->mft_zone_pos); + ntfs_log_trace("Before checks, vol->mft_zone_pos = 0x%llx.\n", + (long long) vol->mft_zone_pos); if (tc >= vol->mft_zone_end) { vol->mft_zone_pos = vol->mft_lcn; @@ -382,20 +356,12 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, tc > vol->mft_zone_pos) && tc >= vol->mft_lcn) vol->mft_zone_pos = tc; - Dprintf("%s(): After checks, " - "vol->mft_zone_pos = " - "0x%llx.\n", - __FUNCTION__, - (long long) - vol->mft_zone_pos); + ntfs_log_trace("After checks, vol->mft_zone_pos = 0x%llx.\n", + (long long) vol->mft_zone_pos); break; case 2: - Dprintf("%s(): Before checks, " - "vol->data1_zone_pos = " - "0x%llx.\n", - __FUNCTION__, - (long long) - vol->data1_zone_pos); + ntfs_log_trace("Before checks, vol->data1_zone_pos = 0x%llx.\n", + (long long) vol->data1_zone_pos); if (tc >= vol->nr_clusters) vol->data1_zone_pos = vol->mft_zone_end; @@ -404,55 +370,40 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, tc > vol->data1_zone_pos) && tc >= vol->mft_zone_end) vol->data1_zone_pos = tc; - Dprintf("%s(): After checks, " - "vol->data1_zone_pos = " - "0x%llx.\n", - __FUNCTION__, - (long long) - vol->data1_zone_pos); + ntfs_log_trace("After checks, vol->data1_zone_pos = 0x%llx.\n", + (long long) vol->data1_zone_pos); break; case 4: - Dprintf("%s(): Before checks, " - "vol->data2_zone_pos = " - "0x%llx.\n", - __FUNCTION__, - (long long) - vol->data2_zone_pos); + ntfs_log_trace("Before checks, vol->data2_zone_pos = 0x%llx.\n", + (long long) vol->data2_zone_pos); if (tc >= vol->mft_zone_start) vol->data2_zone_pos = 0; else if (bmp_initial_pos >= vol->data2_zone_pos || tc > vol->data2_zone_pos) vol->data2_zone_pos = tc; - Dprintf("%s(): After checks, " - "vol->data2_zone_pos = " - "0x%llx.\n", - __FUNCTION__, - (long long) - vol->data2_zone_pos); + ntfs_log_trace("After checks, vol->data2_zone_pos = 0x%llx.\n", + (long long) vol->data2_zone_pos); break; default: - if (rl) - free(rl); + free(rl); free(buf); - NTFS_BUG("switch(search_zone) 1"); + NTFS_BUG("switch (search_zone) 1"); return NULL; } - Dprintf("%s(): Going to done_ret.\n", - __FUNCTION__); + ntfs_log_trace("Going to done_ret.\n"); goto done_ret; } lcn++; } bmp_pos += buf_size; - Dprintf("%s(): After inner while loop: buf_size = 0x%x, " - "lcn = 0x%llx, bmp_pos = 0x%llx, need_writeback " - "= %i.\n", __FUNCTION__, buf_size, - (long long)lcn, (long long)bmp_pos, - need_writeback); + ntfs_log_trace("After inner while loop: buf_size = 0x%x, lcn = " + "0x%llx, bmp_pos = 0x%llx, need_writeback = %i.\n", + buf_size, (long long)lcn, + (long long)bmp_pos, need_writeback); if (need_writeback) { s64 bw; - Dprintf("%s(): Writing back.\n", __FUNCTION__); + ntfs_log_trace("Writing back.\n"); need_writeback = 0; bw = ntfs_attr_pwrite(vol->lcnbmp_na, last_read_pos, br, buf); @@ -461,23 +412,20 @@ runlist *ntfs_cluster_alloc(ntfs_volume *vol, VCN start_vcn, s64 count, err = errno; else err = EIO; - Dprintf("%s(): Bitmap writeback failed in " - "read next buffer code path " - "with error code %i.\n", - __FUNCTION__, err); + ntfs_log_trace("Bitmap writeback failed in read next " + "buffer code path with error code %i.\n", err); goto err_ret; } } if (bmp_pos < zone_end) { - Dprintf("%s(): Continuing outer while loop, bmp_pos = " + ntfs_log_trace("Continuing outer while loop, bmp_pos = " "0x%llx, zone_end = 0x%llx.\n", - __FUNCTION__, (long long)bmp_pos, + (long long)bmp_pos, (long long)zone_end); continue; } zone_pass_done: /* Finished with the current zone pass. */ - Dprintf("%s(): At zone_pass_done, pass = %i.\n", __FUNCTION__, - pass); + ntfs_log_trace("At zone_pass_done, pass = %i.\n", pass); if (pass == 1) { /* * Now do pass 2, scanning the first part of the zone @@ -496,41 +444,36 @@ zone_pass_done: /* Finished with the current zone pass. */ zone_start = 0; break; default: - NTFS_BUG("switch(search_zone) 2"); + NTFS_BUG("switch (search_zone) 2"); } /* Sanity check. */ if (zone_end < zone_start) zone_end = zone_start; bmp_pos = zone_start; - Dprintf("%s(): Continuing outer while loop, pass = 2, " - "zone_start = 0x%llx, zone_end = 0x%llx, " - "bmp_pos = 0x%llx.\n", __FUNCTION__, + ntfs_log_trace("Continuing outer while loop, pass = 2, " + "zone_start = 0x%llx, zone_end = " + "0x%llx, bmp_pos = 0x%llx.\n", zone_start, zone_end, bmp_pos); continue; } /* pass == 2 */ done_zones_check: - Dprintf("%s(): At done_zones_check, search_zone = %i, " - "done_zones before = 0x%x, done_zones after = " - "0x%x.\n", __FUNCTION__, search_zone, - done_zones, done_zones | search_zone); + ntfs_log_trace("At done_zones_check, search_zone = %i, done_zones " + "before = 0x%x, done_zones after = 0x%x.\n", + search_zone, done_zones, done_zones | search_zone); done_zones |= search_zone; if (done_zones < 7) { - Dprintf("%s(): Switching zone.\n", __FUNCTION__); + ntfs_log_trace("Switching zone.\n"); /* Now switch to the next zone we haven't done yet. */ pass = 1; switch (search_zone) { case 1: - Dprintf("%s(): Switching from mft zone to " - "data1 zone.\n", __FUNCTION__); + ntfs_log_trace("Switching from mft zone to data1 " + "zone.\n"); /* Update mft zone position. */ if (rlpos) { LCN tc; - Dprintf("%s(): Before checks, " - "vol->mft_zone_pos = " - "0x%llx.\n", - __FUNCTION__, - (long long) - vol->mft_zone_pos); + ntfs_log_trace("Before checks, vol->mft_zone_pos = 0x%llx.\n", + (long long) vol->mft_zone_pos); tc = rl[rlpos - 1].lcn + rl[rlpos - 1].length; if (tc >= vol->mft_zone_end) { @@ -543,12 +486,8 @@ done_zones_check: tc > vol->mft_zone_pos) && tc >= vol->mft_lcn) vol->mft_zone_pos = tc; - Dprintf("%s(): After checks, " - "vol->mft_zone_pos = " - "0x%llx.\n", - __FUNCTION__, - (long long) - vol->mft_zone_pos); + ntfs_log_trace("After checks, vol->mft_zone_pos = 0x%llx.\n", + (long long) vol->mft_zone_pos); } /* Switch from mft zone to data1 zone. */ switch_to_data1_zone: search_zone = 2; @@ -564,17 +503,13 @@ switch_to_data1_zone: search_zone = 2; } break; case 2: - Dprintf("%s(): Switching from data1 zone to " - "data2 zone.\n", __FUNCTION__); + ntfs_log_trace("Switching from data1 zone to data2 " + "zone.\n"); /* Update data1 zone position. */ if (rlpos) { LCN tc; - Dprintf("%s(): Before checks, " - "vol->data1_zone_pos = " - "0x%llx.\n", - __FUNCTION__, - (long long) - vol->data1_zone_pos); + ntfs_log_trace("Before checks, vol->data1_zone_pos = 0x%llx.\n", + (long long) vol->data1_zone_pos); tc = rl[rlpos - 1].lcn + rl[rlpos - 1].length; if (tc >= vol->nr_clusters) @@ -585,12 +520,8 @@ switch_to_data1_zone: search_zone = 2; tc > vol->data1_zone_pos) && tc >= vol->mft_zone_end) vol->data1_zone_pos = tc; - Dprintf("%s(): After checks, " - "vol->data1_zone_pos = " - "0x%llx.\n", - __FUNCTION__, - (long long) - vol->data1_zone_pos); + ntfs_log_trace("After checks, vol->data1_zone_pos = 0x%llx.\n", + (long long) vol->data1_zone_pos); } /* Switch from data1 zone to data2 zone. */ search_zone = 4; @@ -606,17 +537,13 @@ switch_to_data1_zone: search_zone = 2; } break; case 4: - Dputs("Switching from data2 zone to data1 " - "zone."); + ntfs_log_debug("Switching from data2 zone to data1 " + "zone.\n"); /* Update data2 zone position. */ if (rlpos) { LCN tc; - Dprintf("%s(): Before checks, " - "vol->data2_zone_pos = " - "0x%llx.\n", - __FUNCTION__, - (long long) - vol->data2_zone_pos); + ntfs_log_trace("Before checks, vol->data2_zone_pos = 0x%llx.\n", + (long long) vol->data2_zone_pos); tc = rl[rlpos - 1].lcn + rl[rlpos - 1].length; if (tc >= vol->mft_zone_start) @@ -625,56 +552,49 @@ switch_to_data1_zone: search_zone = 2; vol->data2_zone_pos || tc > vol->data2_zone_pos) vol->data2_zone_pos = tc; - Dprintf("%s(): After checks, " - "vol->data2_zone_pos = " - "0x%llx.\n", - __FUNCTION__, - (long long) - vol->data2_zone_pos); + ntfs_log_trace("After checks, vol->data2_zone_pos = 0x%llx.\n", + (long long) vol->data2_zone_pos); } /* Switch from data2 zone to data1 zone. */ goto switch_to_data1_zone; /* See above. */ default: - NTFS_BUG("switch(search_zone) 3"); + NTFS_BUG("switch (search_zone) 3"); } - Dprintf("%s(): After zone switch, search_zone = %i, " - "pass = %i, bmp_initial_pos = 0x%llx, " + ntfs_log_trace("After zone switch, search_zone = %i, pass = " + "%i, bmp_initial_pos = 0x%llx, " "zone_start = 0x%llx, zone_end = " - "0x%llx.\n", __FUNCTION__, search_zone, - pass, (long long)bmp_initial_pos, + "0x%llx.\n", search_zone, pass, + (long long)bmp_initial_pos, (long long)zone_start, (long long)zone_end); bmp_pos = zone_start; if (zone_start == zone_end) { - Dprintf("%s(): Empty zone, going to " - "done_zones_check.\n", - __FUNCTION__); + ntfs_log_trace("Empty zone, going to " + "done_zones_check.\n"); /* Empty zone. Don't bother searching it. */ goto done_zones_check; } - Dprintf("%s(): Continuing outer while loop.\n", - __FUNCTION__); + ntfs_log_trace("Continuing outer while loop.\n"); continue; } /* done_zones == 7 */ - Dprintf("%s(): All zones are finished.\n", __FUNCTION__); + ntfs_log_trace("All zones are finished.\n"); /* * All zones are finished! If DATA_ZONE, shrink mft zone. If * MFT_ZONE, we have really run out of space. */ mft_zone_size = vol->mft_zone_end - vol->mft_zone_start; - Dprintf("%s(): vol->mft_zone_start = 0x%llx, vol->mft_zone_end " - "= 0x%llx, mft_zone_size = 0x%llx.\n", - __FUNCTION__, (long long)vol->mft_zone_start, + ntfs_log_trace("vol->mft_zone_start = 0x%llx, vol->mft_zone_end = " + "0x%llx, mft_zone_size = 0x%llx.\n", + (long long)vol->mft_zone_start, (long long)vol->mft_zone_end, (long long)mft_zone_size); if (zone == MFT_ZONE || mft_zone_size <= 0) { - Dprintf("%s(): No free clusters left, going to " - "err_ret.\n", __FUNCTION__); + ntfs_log_trace("No free clusters left, going to err_ret.\n"); /* Really no more space left on device. */ err = ENOSPC; goto err_ret; } /* zone == DATA_ZONE && mft_zone_size > 0 */ - Dprintf("%s(): Shrinking mft zone.\n", __FUNCTION__); + ntfs_log_trace("Shrinking mft zone.\n"); zone_end = vol->mft_zone_end; mft_zone_size >>= 1; if (mft_zone_size > 0) @@ -692,31 +612,32 @@ switch_to_data1_zone: search_zone = 2; search_zone = 2; pass = 2; done_zones &= ~2; - Dprintf("%s(): After shrinking mft zone, mft_zone_size = " - "0x%llx, vol->mft_zone_start = 0x%llx, " + ntfs_log_trace("After shrinking mft zone, mft_zone_size = 0x%llx, " + "vol->mft_zone_start = 0x%llx, " "vol->mft_zone_end = 0x%llx, vol->mft_zone_pos " "= 0x%llx, search_zone = 2, pass = 2, " "dones_zones = 0x%x, zone_start = 0x%llx, " "zone_end = 0x%llx, vol->data1_zone_pos = " "0x%llx, continuing outer while loop.\n", - __FUNCTION__, (long long)mft_zone_size, + (long long)mft_zone_size, (long long)vol->mft_zone_start, (long long)vol->mft_zone_end, (long long)vol->mft_zone_pos, - done_zones, (long long)zone_start, + done_zones, + (long long)zone_start, (long long)zone_end, (long long)vol->data1_zone_pos); } - Dputs("After outer while loop."); + ntfs_log_debug("After outer while loop.\n"); done_ret: - Dputs("At done_ret."); + ntfs_log_debug("At done_ret.\n"); /* Add runlist terminator element. */ rl[rlpos].vcn = rl[rlpos - 1].vcn + rl[rlpos - 1].length; rl[rlpos].lcn = LCN_RL_NOT_MAPPED; rl[rlpos].length = 0; if (need_writeback) { s64 bw; - Dprintf("%s(): Writing back.\n", __FUNCTION__); + ntfs_log_trace("Writing back.\n"); need_writeback = 0; bw = ntfs_attr_pwrite(vol->lcnbmp_na, last_read_pos, br, buf); if (bw != br) { @@ -724,27 +645,26 @@ done_ret: err = errno; else err = EIO; - Dprintf("%s(): Bitmap writeback failed in done code " - "path with error code %i.\n", - __FUNCTION__, err); + ntfs_log_trace("Bitmap writeback failed in done code path " + "with error code %i.\n", err); goto err_ret; } } done_err_ret: - Dputs("At done_err_ret (follows done_ret)."); + ntfs_log_debug("At done_err_ret (follows done_ret).\n"); free(buf); /* Done! */ if (!err) return rl; - Dprintf("%s(): Failed to allocate clusters. Returning with error code " - "%i.\n", __FUNCTION__, err); + ntfs_log_trace("Failed to allocate clusters. Returning with error code " + "%i.\n", err); errno = err; return NULL; wb_err_ret: - Dprintf("%s(): At wb_err_ret.\n", __FUNCTION__); + ntfs_log_trace("At wb_err_ret.\n"); if (need_writeback) { s64 bw; - Dprintf("%s(): Writing back.\n", __FUNCTION__); + ntfs_log_trace("Writing back.\n"); need_writeback = 0; bw = ntfs_attr_pwrite(vol->lcnbmp_na, last_read_pos, br, buf); if (bw != br) { @@ -752,18 +672,16 @@ wb_err_ret: err = errno; else err = EIO; - Dprintf("%s(): Bitmap writeback failed in error code " - "path with error code %i.\n", - __FUNCTION__, err); + ntfs_log_trace("Bitmap writeback failed in error code path " + "with error code %i.\n", err); } } err_ret: - Dprintf("%s(): At err_ret.\n", __FUNCTION__); + ntfs_log_trace("At err_ret.\n"); if (rl) { if (err == ENOSPC) { - Dprintf("%s(): err = ENOSPC, first free lcn = 0x%llx, " - "could allocate up to = 0x%llx " - "clusters.\n", __FUNCTION__, + ntfs_log_trace("err = ENOSPC, first free lcn = 0x%llx, could " + "allocate up to = 0x%llx clusters.\n", (long long)rl[0].lcn, (long long)count - clusters); } @@ -772,21 +690,19 @@ err_ret: rl[rlpos].lcn = LCN_RL_NOT_MAPPED; rl[rlpos].length = 0; /* Deallocate all allocated clusters. */ - Dprintf("%s(): Deallocating allocated clusters.\n", - __FUNCTION__); - ntfs_cluster_free_from_rl (vol, rl); + ntfs_log_trace("Deallocating allocated clusters.\n"); + ntfs_cluster_free_from_rl(vol, rl); /* Free the runlist. */ free(rl); rl = NULL; } else { if (err == ENOSPC) { - Dprintf("%s(): No space left at all, err = ENOSPC, " - "first free lcn = 0x%llx.\n", - __FUNCTION__, + ntfs_log_trace("No space left at all, err = ENOSPC, first " + "free lcn = 0x%llx.\n", (long long)vol->data1_zone_pos); } } - Dprintf("%s(): rl = NULL, going to done_err_ret.\n", __FUNCTION__); + ntfs_log_trace("rl = NULL, going to done_err_ret.\n"); goto done_err_ret; } @@ -803,8 +719,7 @@ int ntfs_cluster_free_from_rl(ntfs_volume *vol, runlist *rl) if (rl->lcn >= 0 && ntfs_bitmap_clear_run(vol->lcnbmp_na, rl->lcn, rl->length)) { int eo = errno; - Dprintf("%s(): Eeek! Deallocation of clusters " - "failed.\n", __FUNCTION__); + ntfs_log_trace("Eeek! Deallocation of clusters failed.\n"); errno = eo; return -1; } @@ -835,7 +750,7 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) if (!vol || !vol->lcnbmp_na || !na || start_vcn < 0 || (count < 0 && count != -1)) { - Dprintf("%s(): Invalid arguments!\n", __FUNCTION__); + ntfs_log_trace("Invalid arguments!\n"); errno = EINVAL; return -1; } @@ -887,10 +802,9 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) // list support! (AIA) if (rl->lcn < 0 && rl->lcn != LCN_HOLE) { // FIXME: Eeek! We need rollback! (AIA) - Dprintf("%s(): Eeek! invalid lcn (= %lli). Should " - "attempt to map runlist! " - "Leaving inconsistent metadata!\n", - __FUNCTION__, (long long)rl->lcn); + ntfs_log_trace("Eeek! invalid lcn (= %lli). Should attempt " + "to map runlist! Leaving inconsistent " + "metadata!\n", (long long)rl->lcn); errno = EIO; return -1; } @@ -907,9 +821,8 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) int eo = errno; // FIXME: Eeek! We need rollback! (AIA) - Dprintf("%s(): Eeek! bitmap clear run " - "failed. Leaving inconsistent " - "metadata!\n", __FUNCTION__); + ntfs_log_trace("Eeek! bitmap clear run failed. " + "Leaving inconsistent metadata!\n"); errno = eo; return -1; } @@ -923,9 +836,8 @@ int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn, s64 count) if (count != -1 && count != 0) { // FIXME: Eeek! BUG() - Dprintf("%s(): Eeek! count still not zero (= %lli). Leaving " - "inconsistent metadata!\n", __FUNCTION__, - (long long)count); + ntfs_log_trace("Eeek! count still not zero (= %lli). Leaving " + "inconsistent metadata!\n", (long long)count); errno = EIO; return -1; } diff --git a/libntfs/logfile.c b/libntfs/logfile.c index c56fb5fa..53f5359c 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -1,4 +1,4 @@ -/* +/** * logfile.c - NTFS journal handling. Part of the Linux-NTFS project. * * Copyright (c) 2002-2005 Anton Altaparmakov @@ -20,7 +20,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDLIB_H #include @@ -31,6 +33,7 @@ #include "logfile.h" #include "volume.h" #include "mst.h" +#include "logging.h" /** * ntfs_check_restart_page_header - check the page header for consistency @@ -49,7 +52,7 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) u16 ra_ofs, usa_count, usa_ofs, usa_end = 0; BOOL have_usa = TRUE; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); /* * If the system or log page sizes are smaller than the ntfs block size * or either is not a power of 2 we cannot handle this log file. @@ -61,7 +64,7 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) logfile_system_page_size & (logfile_system_page_size - 1) || logfile_log_page_size & (logfile_log_page_size - 1)) { - ntfs_error(vi->i_sb, "$LogFile uses unsupported page size."); + ntfs_log_error("$LogFile uses unsupported page size."); return FALSE; } /* @@ -69,14 +72,14 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) * size (2nd restart page). */ if (pos && pos != logfile_system_page_size) { - ntfs_error(vi->i_sb, "Found restart area in incorrect " + ntfs_log_error("Found restart area in incorrect " "position in $LogFile."); return FALSE; } /* We only know how to handle version 1.1. */ if (sle16_to_cpu(rp->major_ver) != 1 || sle16_to_cpu(rp->minor_ver) != 1) { - ntfs_error(vi->i_sb, "$LogFile version %i.%i is not " + ntfs_log_error("$LogFile version %i.%i is not " "supported. (This driver supports version " "1.1 only.)", (int)sle16_to_cpu(rp->major_ver), (int)sle16_to_cpu(rp->minor_ver)); @@ -93,7 +96,7 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) /* Verify the size of the update sequence array. */ usa_count = 1 + (logfile_system_page_size >> NTFS_BLOCK_SIZE_BITS); if (usa_count != le16_to_cpu(rp->usa_count)) { - ntfs_error(vi->i_sb, "$LogFile restart page specifies " + ntfs_log_error("$LogFile restart page specifies " "inconsistent update sequence array count."); return FALSE; } @@ -102,7 +105,7 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) usa_end = usa_ofs + usa_count * sizeof(u16); if (usa_ofs < sizeof(RESTART_PAGE_HEADER) || usa_end > NTFS_BLOCK_SIZE - sizeof(u16)) { - ntfs_error(vi->i_sb, "$LogFile restart page specifies " + ntfs_log_error("$LogFile restart page specifies " "inconsistent update sequence array offset."); return FALSE; } @@ -117,7 +120,7 @@ skip_usa_checks: if (ra_ofs & 7 || (have_usa ? ra_ofs < usa_end : ra_ofs < sizeof(RESTART_PAGE_HEADER)) || ra_ofs > logfile_system_page_size) { - ntfs_error(vi->i_sb, "$LogFile restart page specifies " + ntfs_log_error("$LogFile restart page specifies " "inconsistent restart area offset."); return FALSE; } @@ -126,11 +129,11 @@ skip_usa_checks: * set. */ if (!ntfs_is_chkd_record(rp->magic) && sle64_to_cpu(rp->chkdsk_lsn)) { - ntfs_error(vi->i_sb, "$LogFile restart page is not modified " + ntfs_log_error("$LogFile restart page is not modified " "by chkdsk but a chkdsk LSN is specified."); return FALSE; } - ntfs_debug("Done."); + ntfs_log_trace("Done.\n"); return TRUE; } @@ -154,7 +157,7 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) u16 ra_ofs, ra_len, ca_ofs; u8 fs_bits; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); ra_ofs = le16_to_cpu(rp->restart_area_offset); ra = (RESTART_AREA*)((u8*)rp + ra_ofs); /* @@ -164,7 +167,7 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) */ if (ra_ofs + offsetof(RESTART_AREA, file_size) > NTFS_BLOCK_SIZE - sizeof(u16)) { - ntfs_error(vi->i_sb, "$LogFile restart area specifies " + ntfs_log_error("$LogFile restart area specifies " "inconsistent file offset."); return FALSE; } @@ -179,7 +182,7 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) if (((ca_ofs + 7) & ~7) != ca_ofs || ra_ofs + ca_ofs > (u16)(NTFS_BLOCK_SIZE - sizeof(u16))) { - ntfs_error(vi->i_sb, "$LogFile restart area specifies " + ntfs_log_error("$LogFile restart area specifies " "inconsistent client array offset."); return FALSE; } @@ -194,7 +197,7 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) (u32)(ra_ofs + le16_to_cpu(ra->restart_area_length)) > le32_to_cpu(rp->system_page_size) || ra_len > le16_to_cpu(ra->restart_area_length)) { - ntfs_error(vi->i_sb, "$LogFile restart area is out of bounds " + ntfs_log_error("$LogFile restart area is out of bounds " "of the system page size specified by the " "restart page header and/or the specified " "restart area length is inconsistent."); @@ -211,7 +214,7 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) (ra->client_in_use_list != LOGFILE_NO_CLIENT && le16_to_cpu(ra->client_in_use_list) >= le16_to_cpu(ra->log_clients))) { - ntfs_error(vi->i_sb, "$LogFile restart area specifies " + ntfs_log_error("$LogFile restart area specifies " "overflowing client free and/or in use lists."); return FALSE; } @@ -226,25 +229,25 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) fs_bits++; } if (le32_to_cpu(ra->seq_number_bits) != (u32)(67 - fs_bits)) { - ntfs_error(vi->i_sb, "$LogFile restart area specifies " + ntfs_log_error("$LogFile restart area specifies " "inconsistent sequence number bits."); return FALSE; } /* The log record header length must be a multiple of 8. */ if (((le16_to_cpu(ra->log_record_header_length) + 7) & ~7) != le16_to_cpu(ra->log_record_header_length)) { - ntfs_error(vi->i_sb, "$LogFile restart area specifies " + ntfs_log_error("$LogFile restart area specifies " "inconsistent log record header length."); return FALSE; } /* Ditto for the log page data offset. */ if (((le16_to_cpu(ra->log_page_data_offset) + 7) & ~7) != le16_to_cpu(ra->log_page_data_offset)) { - ntfs_error(vi->i_sb, "$LogFile restart area specifies " + ntfs_log_error("$LogFile restart area specifies " "inconsistent log page data offset."); return FALSE; } - ntfs_debug("Done."); + ntfs_log_trace("Done.\n"); return TRUE; } @@ -269,7 +272,7 @@ static BOOL ntfs_check_log_client_array(RESTART_PAGE_HEADER *rp) u16 nr_clients, idx; BOOL in_free_list, idx_is_first; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); ra = (RESTART_AREA*)((u8*)rp + le16_to_cpu(rp->restart_area_offset)); ca = (LOG_CLIENT_RECORD*)((u8*)ra + le16_to_cpu(ra->client_array_offset)); @@ -304,10 +307,10 @@ check_list: idx = le16_to_cpu(ra->client_in_use_list); goto check_list; } - ntfs_debug("Done."); + ntfs_log_trace("Done.\n"); return TRUE; err_out: - ntfs_error(vi->i_sb, "$LogFile log client array is corrupt."); + ntfs_log_error("$LogFile log client array is corrupt."); return FALSE; } @@ -346,7 +349,7 @@ static int ntfs_check_and_load_restart_page(ntfs_attr *log_na, RESTART_PAGE_HEADER *trp; int err; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); /* Check the restart page header for consistency. */ if (!ntfs_check_restart_page_header(rp, pos)) { /* Error output already done inside the function. */ @@ -364,7 +367,7 @@ static int ntfs_check_and_load_restart_page(ntfs_attr *log_na, */ trp = malloc(le32_to_cpu(rp->system_page_size)); if (!trp) { - ntfs_error(vi->i_sb, "Failed to allocate memory for $LogFile " + ntfs_log_error("Failed to allocate memory for $LogFile " "restart page buffer."); return ENOMEM; } @@ -379,7 +382,7 @@ static int ntfs_check_and_load_restart_page(ntfs_attr *log_na, le32_to_cpu(rp->system_page_size), trp) != le32_to_cpu(rp->system_page_size)) { err = errno; - ntfs_error(, "Failed to read whole restart page into the " + ntfs_log_error("Failed to read whole restart page into the " "buffer."); if (err != ENOMEM) err = EIO; @@ -400,7 +403,7 @@ static int ntfs_check_and_load_restart_page(ntfs_attr *log_na, if (le16_to_cpu(rp->restart_area_offset) + le16_to_cpu(ra->restart_area_length) > NTFS_BLOCK_SIZE - (int)sizeof(u16)) { - ntfs_error(vi->i_sb, "Multi sector transfer error " + ntfs_log_error("Multi sector transfer error " "detected in $LogFile restart page."); err = EINVAL; goto err_out; @@ -425,7 +428,7 @@ static int ntfs_check_and_load_restart_page(ntfs_attr *log_na, else /* if (ntfs_is_chkd_record(rp->magic)) */ *lsn = sle64_to_cpu(rp->chkdsk_lsn); } - ntfs_debug("Done."); + ntfs_log_trace("Done.\n"); if (wrp) *wrp = trp; else { @@ -464,7 +467,7 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na, RESTART_PAGE_HEADER **rp) BOOL logfile_is_empty = TRUE; u8 log_page_bits; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); /* An empty $LogFile must have been clean before it got emptied. */ if (NVolLogFileEmpty(vol)) goto is_empty; @@ -487,13 +490,13 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na, RESTART_PAGE_HEADER **rp) */ if (size < log_page_size * 2 || (size - log_page_size * 2) >> log_page_bits < MinLogRecordPages) { - ntfs_error(vol->sb, "$LogFile is too small."); + ntfs_log_error("$LogFile is too small."); return FALSE; } /* Allocate memory for restart page. */ kaddr = malloc(NTFS_BLOCK_SIZE); if (!kaddr) { - ntfs_error(, "Not enough memory."); + ntfs_log_error("Not enough memory."); return FALSE; } /* @@ -510,7 +513,7 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na, RESTART_PAGE_HEADER **rp) */ if (ntfs_attr_pread(log_na, pos, NTFS_BLOCK_SIZE, kaddr) != NTFS_BLOCK_SIZE) { - ntfs_error(, "Failed to read first NTFS_BLOCK_SIZE " + ntfs_log_error("Failed to read first NTFS_BLOCK_SIZE " "bytes of potential restart page."); goto err_out; } @@ -579,13 +582,13 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na, RESTART_PAGE_HEADER **rp) if (logfile_is_empty) { NVolSetLogFileEmpty(vol); is_empty: - ntfs_debug("Done. ($LogFile is empty.)"); + ntfs_log_trace("Done. ($LogFile is empty.)\n"); return TRUE; } if (!rstr1_ph) { if (rstr2_ph) - ntfs_error(vol->sb, "BUG: rstr2_ph isn't NULL!"); - ntfs_error(vol->sb, "Did not find any restart pages in " + ntfs_log_error("BUG: rstr2_ph isn't NULL!"); + ntfs_log_error("Did not find any restart pages in " "$LogFile and it was not empty."); return FALSE; } @@ -596,13 +599,13 @@ is_empty: * Otherwise just throw it away. */ if (rstr2_lsn > rstr1_lsn) { - ntfs_debug("Using second restart page as it is more " + ntfs_log_debug("Using second restart page as it is more " "recent."); free(rstr1_ph); rstr1_ph = rstr2_ph; /* rstr1_lsn = rstr2_lsn; */ } else { - ntfs_debug("Using first restart page as it is more " + ntfs_log_debug("Using first restart page as it is more " "recent."); free(rstr2_ph); } @@ -613,15 +616,12 @@ is_empty: *rp = rstr1_ph; else free(rstr1_ph); - ntfs_debug("Done."); + ntfs_log_trace("Done.\n"); return TRUE; err_out: - if (kaddr) - free(kaddr); - if (rstr1_ph) - free(rstr1_ph); - if (rstr2_ph) - free(rstr2_ph); + free(kaddr); + free(rstr1_ph); + free(rstr2_ph); return FALSE; } @@ -649,19 +649,19 @@ BOOL ntfs_is_logfile_clean(ntfs_attr *log_na, RESTART_PAGE_HEADER *rp) { RESTART_AREA *ra; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); /* An empty $LogFile must have been clean before it got emptied. */ if (NVolLogFileEmpty(log_na->ni->vol)) { - ntfs_debug("Done. ($LogFile is empty.)"); + ntfs_log_trace("Done. ($LogFile is empty.)\n"); return TRUE; } if (!rp) { - ntfs_error(, "Restart page header is NULL."); + ntfs_log_error("Restart page header is NULL."); return FALSE; } if (!ntfs_is_rstr_record(rp->magic) && !ntfs_is_chkd_record(rp->magic)) { - ntfs_error(vol->sb, "Restart page buffer is invalid. This is " + ntfs_log_error("Restart page buffer is invalid. This is " "probably a bug in that the $LogFile should " "have been consistency checked before calling " "this function."); @@ -676,11 +676,11 @@ BOOL ntfs_is_logfile_clean(ntfs_attr *log_na, RESTART_PAGE_HEADER *rp) */ if (ra->client_in_use_list != LOGFILE_NO_CLIENT && !(ra->flags & RESTART_VOLUME_IS_CLEAN)) { - ntfs_debug("Done. $LogFile indicates a dirty shutdown."); + ntfs_log_debug("Done. $LogFile indicates a dirty shutdown.\n"); return FALSE; } /* $LogFile indicates a clean shutdown. */ - ntfs_debug("Done. $LogFile indicates a clean shutdown."); + ntfs_log_trace("Done. $LogFile indicates a clean shutdown.\n"); return TRUE; } @@ -701,21 +701,21 @@ int ntfs_empty_logfile(ntfs_attr *na) char buf[NTFS_BUF_SIZE]; int err; - ntfs_debug("Entering."); + ntfs_log_trace("Entering.\n"); if (NVolLogFileEmpty(na->ni->vol)) goto done; /* The $DATA attribute of the $LogFile has to be non-resident. */ if (!NAttrNonResident(na)) { err = EIO; - Dprintf("$LogFile $DATA attribute is resident!?!\n"); + ntfs_log_debug("$LogFile $DATA attribute is resident!?!\n"); goto io_error_exit; } /* Get length of $LogFile contents. */ len = na->data_size; if (!len) { - Dprintf("$LogFile has zero length, no disk write needed.\n"); + ntfs_log_debug("$LogFile has zero length, no disk write needed.\n"); return 0; } @@ -728,8 +728,8 @@ int ntfs_empty_logfile(ntfs_attr *na) if (count == -1 || pos != len) { err = errno; - Dprintf("Amount of $LogFile data read does not " - "correspond to expected length!"); + ntfs_log_debug("Amount of $LogFile data read does not correspond to " + "expected length!"); if (count != -1) err = EIO; goto io_error_exit; @@ -746,7 +746,7 @@ int ntfs_empty_logfile(ntfs_attr *na) if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { err = errno; - Dprintf("Failed to set the $LogFile attribute value."); + ntfs_log_debug("Failed to set the $LogFile attribute value.\n"); if (count != -1) err = EIO; goto io_error_exit; @@ -757,7 +757,7 @@ int ntfs_empty_logfile(ntfs_attr *na) /* Set the flag so we do not have to do it again on remount. */ NVolSetLogFileEmpty(na->ni->vol); done: - ntfs_debug("Done."); + ntfs_log_trace("Done.\n"); return 0; io_error_exit: ntfs_attr_close(na); diff --git a/libntfs/logging.c b/libntfs/logging.c index 6aba1027..6ec0ec27 100644 --- a/libntfs/logging.c +++ b/libntfs/logging.c @@ -19,7 +19,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDIO_H #include @@ -33,6 +35,9 @@ #ifdef HAVE_STRING_H #include #endif +#ifdef HAVE_STDLIB_H +#include +#endif #include "logging.h" @@ -47,10 +52,12 @@ struct ntfs_logging ntfs_log = { #ifdef DEBUG - LOG_LEVEL_DEBUG | LOG_LEVEL_TRACE | + NTFS_LOG_LEVEL_DEBUG | NTFS_LOG_LEVEL_TRACE | #endif - LOG_LEVEL_INFO | LOG_LEVEL_WARNING | LOG_LEVEL_ERROR | LOG_LEVEL_PERROR | LOG_LEVEL_CRITICAL, - LOG_FLAG_PREFIX, + NTFS_LOG_LEVEL_INFO | NTFS_LOG_LEVEL_QUIET | NTFS_LOG_LEVEL_WARNING | + NTFS_LOG_LEVEL_ERROR | NTFS_LOG_LEVEL_PERROR | NTFS_LOG_LEVEL_CRITICAL | + NTFS_LOG_LEVEL_REASON, + NTFS_LOG_FLAG_ONLYNAME, ntfs_logging_handler_printf }; @@ -61,7 +68,7 @@ struct ntfs_logging ntfs_log = * * Returns: Log levels in a 32-bit field */ -u32 ntfs_logging_get_levels (void) +u32 ntfs_logging_get_levels(void) { return ntfs_log.levels; } @@ -71,11 +78,11 @@ u32 ntfs_logging_get_levels (void) * @levels: 32-bit field of log levels to set * * Enable one or more logging levels. - * The logging levels are named: LOG_LEVEL_*. + * The logging levels are named: NTFS_LOG_LEVEL_*. * * Returns: Log levels that were enabled before the call */ -u32 ntfs_logging_set_levels (u32 levels) +u32 ntfs_logging_set_levels(u32 levels) { u32 old; old = ntfs_log.levels; @@ -88,11 +95,11 @@ u32 ntfs_logging_set_levels (u32 levels) * @levels: 32-bit field of log levels to clear * * Disable one or more logging levels. - * The logging levels are named: LOG_LEVEL_*. + * The logging levels are named: NTFS_LOG_LEVEL_*. * * Returns: Log levels that were enabled before the call */ -u32 ntfs_logging_clear_levels (u32 levels) +u32 ntfs_logging_clear_levels(u32 levels) { u32 old; old = ntfs_log.levels; @@ -108,7 +115,7 @@ u32 ntfs_logging_clear_levels (u32 levels) * * Returns: Logging flags in a 32-bit field */ -u32 ntfs_logging_get_flags (void) +u32 ntfs_logging_get_flags(void) { return ntfs_log.flags; } @@ -118,11 +125,11 @@ u32 ntfs_logging_get_flags (void) * @flags: 32-bit field of logging flags to set * * Enable one or more logging flags. - * The log flags are named: LOG_LEVEL_*. + * The log flags are named: NTFS_LOG_LEVEL_*. * * Returns: Logging flags that were enabled before the call */ -u32 ntfs_logging_set_flags (u32 flags) +u32 ntfs_logging_set_flags(u32 flags) { u32 old; old = ntfs_log.flags; @@ -135,11 +142,11 @@ u32 ntfs_logging_set_flags (u32 flags) * @flags: 32-bit field of logging flags to clear * * Disable one or more logging flags. - * The log flags are named: LOG_LEVEL_*. + * The log flags are named: NTFS_LOG_LEVEL_*. * * Returns: Logging flags that were enabled before the call */ -u32 ntfs_logging_clear_flags (u32 flags) +u32 ntfs_logging_clear_flags(u32 flags) { u32 old; old = ntfs_log.flags; @@ -157,23 +164,24 @@ u32 ntfs_logging_clear_flags (u32 flags) * * Returns: "string" Prefix to be used */ -static FILE * ntfs_logging_get_stream (int level) +static FILE * ntfs_logging_get_stream(u32 level) { FILE *stream; switch (level) { - case LOG_LEVEL_INFO: - case LOG_LEVEL_QUIET: - case LOG_LEVEL_PROGRESS: + case NTFS_LOG_LEVEL_INFO: + case NTFS_LOG_LEVEL_QUIET: + case NTFS_LOG_LEVEL_PROGRESS: + case NTFS_LOG_LEVEL_VERBOSE: stream = stdout; break; - case LOG_LEVEL_DEBUG: - case LOG_LEVEL_TRACE: - case LOG_LEVEL_WARNING: - case LOG_LEVEL_ERROR: - case LOG_LEVEL_CRITICAL: - case LOG_LEVEL_PERROR: + case NTFS_LOG_LEVEL_DEBUG: + case NTFS_LOG_LEVEL_TRACE: + case NTFS_LOG_LEVEL_WARNING: + case NTFS_LOG_LEVEL_ERROR: + case NTFS_LOG_LEVEL_CRITICAL: + case NTFS_LOG_LEVEL_PERROR: default: stream = stderr; break; @@ -190,39 +198,39 @@ static FILE * ntfs_logging_get_stream (int level) * * Returns: "string" Prefix to be used */ -static const char * ntfs_logging_get_prefix (int level) +static const char * ntfs_logging_get_prefix(u32 level) { const char *prefix; switch (level) { - case LOG_LEVEL_DEBUG: + case NTFS_LOG_LEVEL_DEBUG: prefix = "DEBUG: "; break; - case LOG_LEVEL_TRACE: + case NTFS_LOG_LEVEL_TRACE: prefix = "TRACE: "; break; - case LOG_LEVEL_QUIET: + case NTFS_LOG_LEVEL_QUIET: prefix = "QUIET: "; break; - case LOG_LEVEL_INFO: + case NTFS_LOG_LEVEL_INFO: prefix = "INFO: "; break; - case LOG_LEVEL_VERBOSE: + case NTFS_LOG_LEVEL_VERBOSE: prefix = "VERBOSE: "; break; - case LOG_LEVEL_PROGRESS: + case NTFS_LOG_LEVEL_PROGRESS: prefix = "PROGRESS: "; break; - case LOG_LEVEL_WARNING: + case NTFS_LOG_LEVEL_WARNING: prefix = "WARNING: "; break; - case LOG_LEVEL_ERROR: + case NTFS_LOG_LEVEL_ERROR: prefix = "ERROR: "; break; - case LOG_LEVEL_PERROR: + case NTFS_LOG_LEVEL_PERROR: prefix = "ERROR: "; break; - case LOG_LEVEL_CRITICAL: + case NTFS_LOG_LEVEL_CRITICAL: prefix = "CRITICAL: "; break; default: @@ -243,7 +251,7 @@ static const char * ntfs_logging_get_prefix (int level) * * Returns: void */ -void ntfs_logging_set_handler (logging_handler *handler) +void ntfs_logging_set_handler(ntfs_logging_handler *handler) { if (handler) ntfs_log.handler = handler; @@ -257,22 +265,19 @@ void ntfs_logging_set_handler (logging_handler *handler) * @file: File in which the log line occurred * @line: Line number on which the log line occurred * @level: Level at which the line is logged - * @stream: FILE stream to output to (may be NULL) + * @data: User specified data, possibly specific to a handler * @format: printf-style formatting string * @...: Arguments to be formatted * * This is just a redirector function. The arguments are simply passed to the * main logging handler (as defined in the global logging struct @ntfs_log). * - * Note: If @stream is NULL, the output stream will be determined by the - * function: ntfs_logging_get_stream - * * Returns: -1 Error occurred * 0 Message wasn't logged * num Number of output characters */ -int ntfs_logging_redirect (const char *function, const char *file, - int line, int level, FILE *stream, const char *format, ...) +int ntfs_logging_redirect(const char *function, const char *file, + int line, u32 level, void *data, const char *format, ...) { int olderr = errno; int ret; @@ -281,10 +286,10 @@ int ntfs_logging_redirect (const char *function, const char *file, if (!(ntfs_log.levels & level)) /* Don't log this message */ return 0; - va_start (args, format); + va_start(args, format); errno = olderr; - ret = ntfs_log.handler (function, file, line, level, stream, format, args); - va_end (args); + ret = ntfs_log.handler(function, file, line, level, data, format, args); + va_end(args); errno = olderr; return ret; @@ -296,49 +301,73 @@ int ntfs_logging_redirect (const char *function, const char *file, * @file: File in which the log line occurred * @line: Line number on which the log line occurred * @level: Level at which the line is logged - * @stream: FILE stream to output to (may be NULL) + * @data: User specified data, possibly specific to a handler * @format: printf-style formatting string * @args: Arguments to be formatted * * A simple logging handler. This is where the log line is finally displayed. * - * Note: If @stream is NULL, the output stream will be determined by the - * function: ntfs_logging_get_stream + * Note: For this handler, @data is a pointer to a FILE output stream. + * If @data is NULL, the function ntfs_logging_get_stream will be called * * Returns: -1 Error occurred * 0 Message wasn't logged * num Number of output characters */ -int ntfs_logging_handler_printf (const char *function, const char *file, - int line, int level, FILE *stream, const char *format, va_list args) +int ntfs_logging_handler_printf(const char *function, const char *file, + int line, u32 level, void *data, const char *format, va_list args) { + const int reason_size = 128; + static char *reason = NULL; int ret = 0; int olderr = errno; + FILE *stream; - if (!stream) - stream = ntfs_logging_get_stream (level); - - if (strchr (file, PATH_SEP)) /* Abbreviate the filename */ - file = strrchr (file, PATH_SEP) + 1; - - if (ntfs_log.flags & LOG_FLAG_PREFIX) /* Prefix the output */ - ret += fprintf (stream, "%s", ntfs_logging_get_prefix (level)); - - if (ntfs_log.flags & LOG_FLAG_FILENAME) /* Source filename */ - ret += fprintf (stream, "%s ", file); - - if (ntfs_log.flags & LOG_FLAG_LINE) /* Source line number */ - ret += fprintf (stream, "(%d) ", line); - - if (ntfs_log.flags & LOG_FLAG_FUNCTION) /* Source function */ - ret += fprintf (stream, ": %s : ", function); - - if (level & LOG_LEVEL_PERROR) { - errno = olderr; - ret += fprintf (stream, "<%s> : ", strerror (olderr)); + if (level == NTFS_LOG_LEVEL_REASON) { + if (!reason) + reason = malloc (reason_size); + if (reason) { + memset (reason, 0, reason_size); + return vsnprintf (reason, reason_size, format, args); + } else { + /* Rather than call ourselves, just drop through */ + level = NTFS_LOG_LEVEL_PERROR; + format = "Couldn't create reason"; + args = NULL; + olderr = errno; + } } - ret += vfprintf (stream, format, args); + if (data) + stream = (FILE*) data; + else + stream = ntfs_logging_get_stream(level); + + if ((ntfs_log.flags & NTFS_LOG_FLAG_ONLYNAME) && + (strchr(file, PATH_SEP))) /* Abbreviate the filename */ + file = strrchr(file, PATH_SEP) + 1; + + if (ntfs_log.flags & NTFS_LOG_FLAG_PREFIX) /* Prefix the output */ + ret += fprintf(stream, "%s", ntfs_logging_get_prefix(level)); + + if (ntfs_log.flags & NTFS_LOG_FLAG_FILENAME) /* Source filename */ + ret += fprintf(stream, "%s ", file); + + if (ntfs_log.flags & NTFS_LOG_FLAG_LINE) /* Source line number */ + ret += fprintf(stream, "(%d) ", line); + + if ((ntfs_log.flags & NTFS_LOG_FLAG_FUNCTION) && /* Source function */ + (level & NTFS_LOG_LEVEL_TRACE)) + ret += fprintf(stream, "%s(): ", function); + + ret += vfprintf(stream, format, args); + + if (level & NTFS_LOG_LEVEL_PERROR) { + if (reason) + ret += fprintf(stream, " : %s\n", reason); + else + ret += fprintf(stream, " : %s\n", strerror(olderr)); + } errno = olderr; return ret; @@ -350,7 +379,7 @@ int ntfs_logging_handler_printf (const char *function, const char *file, * @file: File in which the log line occurred * @line: Line number on which the log line occurred * @level: Level at which the line is logged - * @stream: FILE stream to output to (may be NULL) + * @data: User specified data, possibly specific to a handler * @format: printf-style formatting string * @args: Arguments to be formatted * @@ -361,49 +390,62 @@ int ntfs_logging_handler_printf (const char *function, const char *file, * * Note: This function calls ntfs_logging_handler_printf to do the main work. * - * Note: If @stream is NULL, the output stream will be determined by the - * function: ntfs_logging_get_stream + * Note: For this handler, @data is a pointer to a FILE output stream. + * If @data is NULL, the function ntfs_logging_get_stream will be called * * Returns: -1 Error occurred * 0 Message wasn't logged * num Number of output characters */ -int ntfs_logging_handler_colour (const char *function, const char *file, - int line, int level, FILE *stream, const char *format, va_list args) +int ntfs_logging_handler_colour(const char *function, const char *file, + int line, u32 level, void *data, const char *format, va_list args) { int ret = 0; int olderr = errno; const char *prefix = NULL; const char *suffix = NULL; const char *end = "\e[0m"; + FILE *stream = NULL; - if (!stream) - stream = ntfs_logging_get_stream (level); + if (level != NTFS_LOG_LEVEL_REASON) { /* Reasons get passed through */ + if (data) + stream = (FILE*) data; + else + stream = ntfs_logging_get_stream(level); - switch (level) { - case LOG_LEVEL_WARNING: - prefix = "\e[01;33m"; /* Yellow */ - suffix = end; - break; - case LOG_LEVEL_ERROR: - case LOG_LEVEL_PERROR: - prefix = "\e[01;31m"; /* Red */ - suffix = end; - break; - case LOG_LEVEL_CRITICAL: - prefix = "\e[01;07;31m"; /* Red, inverse */ - suffix = end; - break; + switch (level) { + case NTFS_LOG_LEVEL_DEBUG: + prefix = "\e[32m"; /* Green */ + suffix = end; + break; + case NTFS_LOG_LEVEL_TRACE: + prefix = "\e[36m"; /* Cyan */ + suffix = end; + break; + case NTFS_LOG_LEVEL_WARNING: + prefix = "\e[01;33m"; /* Yellow */ + suffix = end; + break; + case NTFS_LOG_LEVEL_ERROR: + case NTFS_LOG_LEVEL_PERROR: + prefix = "\e[01;31m"; /* Red */ + suffix = end; + break; + case NTFS_LOG_LEVEL_CRITICAL: + prefix = "\e[01;07;31m"; /* Red, inverse */ + suffix = end; + break; + } } if (prefix) - ret += fprintf (stream, prefix); + ret += fprintf(stream, prefix); errno = olderr; - ret += ntfs_logging_handler_printf (function, file, line, level, stream, format, args); + ret += ntfs_logging_handler_printf(function, file, line, level, stream, format, args); if (suffix) - ret += fprintf (stream, suffix); + ret += fprintf(stream, suffix); errno = olderr; return ret; @@ -423,27 +465,27 @@ int ntfs_logging_handler_colour (const char *function, const char *file, * Returns: TRUE Option understood * FALSE Invalid log option */ -BOOL ntfs_logging_parse_option (const char *option) +BOOL ntfs_logging_parse_option(const char *option) { - if (strcmp (option, "--log-debug") == 0) { - ntfs_logging_set_levels (LOG_LEVEL_DEBUG); + if (strcmp(option, "--log-debug") == 0) { + ntfs_logging_set_levels(NTFS_LOG_LEVEL_DEBUG); return TRUE; - } else if (strcmp (option, "--log-verbose") == 0) { - ntfs_logging_set_levels (LOG_LEVEL_VERBOSE); + } else if (strcmp(option, "--log-verbose") == 0) { + ntfs_logging_set_levels(NTFS_LOG_LEVEL_VERBOSE); return TRUE; - } else if (strcmp (option, "--log-quiet") == 0) { - ntfs_logging_set_levels (LOG_LEVEL_QUIET); + } else if (strcmp(option, "--log-quiet") == 0) { + ntfs_logging_set_levels(NTFS_LOG_LEVEL_QUIET); return TRUE; - } else if (strcmp (option, "--log-trace") == 0) { - ntfs_logging_set_levels (LOG_LEVEL_TRACE); + } else if (strcmp(option, "--log-trace") == 0) { + ntfs_logging_set_levels(NTFS_LOG_LEVEL_TRACE); return TRUE; - } else if ((strcmp (option, "--log-colour") == 0) || - (strcmp (option, "--log-color") == 0)) { - ntfs_logging_set_handler (ntfs_logging_handler_colour); + } else if ((strcmp(option, "--log-colour") == 0) || + (strcmp(option, "--log-color") == 0)) { + ntfs_logging_set_handler(ntfs_logging_handler_colour); return TRUE; } - log_error ("Unknown logging option '%s'\n", option); + ntfs_log_warning("Unknown logging option '%s'\n", option); return FALSE; } diff --git a/libntfs/mft.c b/libntfs/mft.c index beb682fc..d5c10b69 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -1,4 +1,4 @@ -/* +/** * mft.c - Mft record handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov @@ -21,7 +21,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDLIB_H #include @@ -38,7 +40,6 @@ #include #include "compat.h" - #include "types.h" #include "device.h" #include "debug.h" @@ -49,6 +50,7 @@ #include "layout.h" #include "lcnalloc.h" #include "mft.h" +#include "logging.h" /** * ntfs_mft_records_read - read records from the mft from disk @@ -77,7 +79,7 @@ int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref, s64 br; VCN m; - Dprintf("%s(): Entering for inode 0x%llx.\n", __FUNCTION__, MREF(mref)); + ntfs_log_trace("Entering for inode 0x%llx.\n", MREF(mref)); if (!vol || !vol->mft_na || !b || count < 0) { errno = EINVAL; return -1; @@ -95,9 +97,10 @@ int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref, if (br != -1) errno = EIO; if (br >= 0) - Dputs("Error: partition is smaller than it should be!"); + ntfs_log_debug("Error: partition is smaller than it should " + "be!\n"); else - Dperror("Error reading $Mft record(s)"); + ntfs_log_perror("Error reading $Mft record(s)"); return -1; } return 0; @@ -135,7 +138,7 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, void *bmirr = NULL; int cnt = 0, res = 0; - Dprintf("%s(): Entering for inode 0x%llx.\n", __FUNCTION__, MREF(mref)); + ntfs_log_trace("Entering for inode 0x%llx.\n", MREF(mref)); if (!vol || !vol->mft_na || vol->mftmirr_size <= 0 || !b || count < 0) { errno = EINVAL; return -1; @@ -166,10 +169,10 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, if (bw != -1) errno = EIO; if (bw >= 0) - Dputs("Error: partial write while writing $Mft " + ntfs_log_debug("Error: partial write while writing $Mft " "record(s)!\n"); else - Dperror("Error writing $Mft record(s)"); + ntfs_log_perror("Error writing $Mft record(s)"); res = errno; } if (bmirr && bw > 0) { @@ -181,12 +184,12 @@ int ntfs_mft_records_write(const ntfs_volume *vol, const MFT_REF mref, if (bw != cnt) { if (bw != -1) errno = EIO; - Dputs("Error: failed to sync $MFTMirr! Run chkdsk."); + ntfs_log_debug("Error: failed to sync $MFTMirr! Run " + "chkdsk.\n"); res = errno; } } - if (bmirr) - free(bmirr); + free(bmirr); if (!res) return res; errno = res; @@ -257,7 +260,7 @@ int ntfs_file_record_read(const ntfs_volume *vol, const MFT_REF mref, *attr = a; return 0; file_corrupt: - Dputs("ntfs_file_record_read(): file is corrupt."); + ntfs_log_debug("ntfs_file_record_read(): file is corrupt.\n"); err = EIO; read_failed: if (m != *mrec) @@ -294,7 +297,7 @@ int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref, else { /* Abort if mref is > 32 bits. */ if (MREF(mref) & 0x0000ffff00000000ull) { - Dputs("Mft reference exceeds 32 bits!"); + ntfs_log_debug("Mft reference exceeds 32 bits!\n"); errno = ERANGE; return -1; } @@ -312,12 +315,13 @@ int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref, NTFS_BLOCK_SIZE + 1); else { m->usa_count = cpu_to_le16(1); - Dprintf("Sector size is bigger than MFT record size. " - "Setting usa_count to 1. If Windows\nchkdsk " - "reports this as corruption, please email " - "linux-ntfs-dev@lists.sf.net\nstating that " - "you saw this message and that the file " - "system created was corrupt.\nThank you.\n"); + ntfs_log_debug("Sector size is bigger than MFT record size. " + "Setting usa_count to 1. If Windows\n"); + ntfs_log_debug("chkdsk reports this as corruption, please email " + "linux-ntfs-dev@lists.sf.net\n"); + ntfs_log_debug("stating that you saw this message and that the " + "file system created was corrupt.\n"); + ntfs_log_debug("Thank you.\n"); } /* Set the update sequence number to 1. */ *(u16*)((u8*)m + le16_to_cpu(m->usa_ofs)) = cpu_to_le16(1); @@ -383,7 +387,7 @@ int ntfs_mft_record_format(const ntfs_volume *vol, const MFT_REF mref) return 0; } -#ifdef DEBUG +#ifndef NTFS_DISABLE_DEBUG_LOGGING static const char *es = " Leaving inconsistent metadata. Run chkdsk."; #endif @@ -451,11 +455,11 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) buf = (u8*)malloc(PAGE_SIZE); if (!buf) return -1; - ntfs_debug("Starting bitmap search: pass %u, pass_start 0x%llx, " - "pass_end 0x%llx, data_pos 0x%llx.", pass, + ntfs_log_debug("Starting bitmap search: pass %u, pass_start 0x%llx, " + "pass_end 0x%llx, data_pos 0x%llx.\n", pass, (long long)pass_start, (long long)pass_end, (long long)data_pos); -#ifdef DEBUG +#ifndef NTFS_DISABLE_DEBUG_LOGGING byte = NULL; b = 0; #endif @@ -468,20 +472,20 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) size = ll; ll = ntfs_attr_pread(mftbmp_na, ofs, size, buf); if (ll < 0) { - ntfs_error(vol->sb, "Failed to read mft bitmap " + ntfs_log_error("Failed to read mft bitmap " "attribute, aborting."); free(buf); return -1; } - ntfs_debug("Read 0x%llx bytes.", (long long)ll); + ntfs_log_debug("Read 0x%llx bytes.\n", (long long)ll); /* If we read at least one byte, search @buf for a zero bit. */ if (ll) { size = ll << 3; bit = data_pos & 7; data_pos &= ~7ull; - ntfs_debug("Before inner for loop: size 0x%x, " + ntfs_log_debug("Before inner for loop: size 0x%x, " "data_pos 0x%llx, bit 0x%llx, " - "*byte 0x%hhx, b %u.", size, + "*byte 0x%hhx, b %u.\n", size, (long long)data_pos, (long long)bit, byte ? *byte : -1, b); for (; bit < size && data_pos + bit < pass_end; @@ -496,9 +500,9 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) return data_pos + (bit & ~7ull) + b; } } - ntfs_debug("After inner for loop: size 0x%x, " + ntfs_log_debug("After inner for loop: size 0x%x, " "data_pos 0x%llx, bit 0x%llx, " - "*byte 0x%hhx, b %u.", size, + "*byte 0x%hhx, b %u.\n", size, (long long)data_pos, (long long)bit, byte ? *byte : -1, b); data_pos += size; @@ -518,8 +522,8 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) */ pass_end = pass_start; data_pos = pass_start = 24; - ntfs_debug("pass %i, pass_start 0x%llx, pass_end " - "0x%llx.", pass, (long long)pass_start, + ntfs_log_debug("pass %i, pass_start 0x%llx, pass_end " + "0x%llx.\n", pass, (long long)pass_start, (long long)pass_end); if (data_pos >= pass_end) break; @@ -569,7 +573,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) rl = ntfs_attr_find_vcn(mftbmp_na, (mftbmp_na->allocated_size - 1) >> vol->cluster_size_bits); if (!rl || !rl->length || rl->lcn < 0) { - ntfs_error(vol->sb, "Failed to determine last allocated " + ntfs_log_error("Failed to determine last allocated " "cluster of mft bitmap attribute."); if (rl) errno = EIO; @@ -583,17 +587,17 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) */ ret = (int)ntfs_attr_pread(lcnbmp_na, lcn >> 3, 1, &b); if (ret < 0) { - ntfs_error(vol->sb, "Failed to read from lcn bitmap."); + ntfs_log_error("Failed to read from lcn bitmap."); return -1; } - ntfs_debug("Read %i byte%s.", ret, ret == 1 ? "" : "s"); + ntfs_log_debug("Read %i byte%s.\n", ret, ret == 1 ? "" : "s"); tb = 1 << (lcn & 7ull); if (ret == 1 && b != 0xff && !(b & tb)) { /* Next cluster is free, allocate it. */ b |= tb; ret = (int)ntfs_attr_pwrite(lcnbmp_na, lcn >> 3, 1, &b); if (ret < 1) { - ntfs_error(vol->sb, "Failed to write to lcn " + ntfs_log_error("Failed to write to lcn " "bitmap."); if (!ret) errno = EIO; @@ -603,22 +607,22 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) rl->length++; rl[1].vcn++; status.added_cluster = 1; - ntfs_debug("Appending one cluster to mft bitmap."); + ntfs_log_debug("Appending one cluster to mft bitmap.\n"); } else { /* Allocate a cluster from the DATA_ZONE. */ rl2 = ntfs_cluster_alloc(vol, rl[1].vcn, 1, lcn, DATA_ZONE); if (!rl2) { - ntfs_error(vol->sb, "Failed to allocate a cluster for " + ntfs_log_error("Failed to allocate a cluster for " "the mft bitmap."); return -1; } rl = ntfs_runlists_merge(mftbmp_na->rl, rl2); if (!rl) { ret = errno; - ntfs_error(vol->sb, "Failed to merge runlists for mft " + ntfs_log_error("Failed to merge runlists for mft " "bitmap."); if (ntfs_cluster_free_from_rl(vol, rl2)) - ntfs_error(vol->sb, "Failed to deallocate " + ntfs_log_error("Failed to deallocate " "cluster.%s", es); free(rl2); errno = ret; @@ -626,7 +630,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) } mftbmp_na->rl = rl; status.added_run = 1; - ntfs_debug("Adding one run to mft bitmap."); + ntfs_log_debug("Adding one run to mft bitmap.\n"); /* Find the last run in the new runlist. */ for (; rl[1].length; rl++) ; @@ -637,12 +641,12 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) */ ctx = ntfs_attr_get_search_ctx(mftbmp_na->ni, NULL); if (!ctx) { - ntfs_error(vol->sb, "Failed to get search context."); + ntfs_log_error("Failed to get search context."); goto undo_alloc; } if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, mftbmp_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { - ntfs_error(vol->sb, "Failed to find last attribute extent of " + ntfs_log_error("Failed to find last attribute extent of " "mft bitmap attribute."); goto undo_alloc; } @@ -651,7 +655,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) ll = sle64_to_cpu(a->lowest_vcn); rl2 = ntfs_attr_find_vcn(mftbmp_na, ll); if (!rl2 || !rl2->length) { - ntfs_error(vol->sb, "Failed to determine previous last " + ntfs_log_error("Failed to determine previous last " "allocated cluster of mft bitmap attribute."); if (rl2) errno = EIO; @@ -660,7 +664,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) /* Get the size for the new mapping pairs array for this extent. */ mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll); if (mp_size <= 0) { - ntfs_error(vol->sb, "Get size for mapping pairs failed for " + ntfs_log_error("Get size for mapping pairs failed for " "mft bitmap attribute extent."); goto undo_alloc; } @@ -669,13 +673,13 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) if (ntfs_attr_record_resize(m, a, mp_size + le16_to_cpu(a->mapping_pairs_offset))) { if (errno != ENOSPC) { - ntfs_error(vol->sb, "Failed to resize attribute " + ntfs_log_error("Failed to resize attribute " "record for mft bitmap attribute."); goto undo_alloc; } // TODO: Deal with this by moving this extent to a new mft // record or by starting a new extent in a new mft record. - ntfs_error(vol->sb, "Not enough space in this mft record to " + ntfs_log_error("Not enough space in this mft record to " "accommodate extended mft bitmap attribute " "extent. Cannot handle this yet."); errno = EOPNOTSUPP; @@ -686,7 +690,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu(a->mapping_pairs_offset), mp_size, rl2, ll, NULL)) { - ntfs_error(vol->sb, "Failed to build mapping pairs array for " + ntfs_log_error("Failed to build mapping pairs array for " "mft bitmap attribute."); errno = EIO; goto undo_alloc; @@ -706,7 +710,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) ntfs_attr_reinit_search_ctx(ctx); if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, mftbmp_na->name_len, 0, 0, NULL, 0, ctx)) { - ntfs_error(vol->sb, "Failed to find first attribute " + ntfs_log_error("Failed to find first attribute " "extent of mft bitmap attribute."); goto restore_undo_alloc; } @@ -723,7 +727,7 @@ restore_undo_alloc: ntfs_attr_reinit_search_ctx(ctx); if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, mftbmp_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { - ntfs_error(vol->sb, "Failed to find last attribute extent of " + ntfs_log_error("Failed to find last attribute extent of " "mft bitmap attribute.%s", es); ntfs_attr_put_search_ctx(ctx); mftbmp_na->allocated_size += vol->cluster_size; @@ -752,16 +756,16 @@ undo_alloc: } /* Deallocate the cluster. */ if (ntfs_bitmap_clear_bit(lcnbmp_na, lcn)) - ntfs_error(vol->sb, "Failed to free cluster.%s", es); + ntfs_log_error("Failed to free cluster.%s", es); if (status.mp_rebuilt) { if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu(a->mapping_pairs_offset), old_alen - le16_to_cpu(a->mapping_pairs_offset), rl2, ll, NULL)) - ntfs_error(vol->sb, "Failed to restore mapping " + ntfs_log_error("Failed to restore mapping " "pairs array.%s", es); if (ntfs_attr_record_resize(m, a, old_alen)) - ntfs_error(vol->sb, "Failed to restore attribute " + ntfs_log_error("Failed to restore attribute " "record.%s", es); ntfs_inode_mark_dirty(ctx->ntfs_ino); @@ -795,12 +799,12 @@ static int ntfs_mft_bitmap_extend_initialized(ntfs_volume *vol) mftbmp_na = vol->mftbmp_na; ctx = ntfs_attr_get_search_ctx(mftbmp_na->ni, NULL); if (!ctx) { - ntfs_error(vol->sb, "Failed to get search context."); + ntfs_log_error("Failed to get search context."); return -1; } if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, mftbmp_na->name_len, 0, 0, NULL, 0, ctx)) { - ntfs_error(vol->sb, "Failed to find first attribute extent of " + ntfs_log_error("Failed to find first attribute extent of " "mft bitmap attribute."); err = errno; goto put_err_out; @@ -821,22 +825,22 @@ static int ntfs_mft_bitmap_extend_initialized(ntfs_volume *vol) ll = 0; ll = ntfs_attr_pwrite(mftbmp_na, old_initialized_size, 8, &ll); if (ll == 8) { - ntfs_debug("Wrote eight initialized bytes to mft bitmap."); + ntfs_log_debug("Wrote eight initialized bytes to mft bitmap.\n"); return 0; } - ntfs_error(vol->sb, "Failed to write to mft bitmap."); + ntfs_log_error("Failed to write to mft bitmap."); err = errno; if (ll >= 0) err = EIO; /* Try to recover from the error. */ ctx = ntfs_attr_get_search_ctx(mftbmp_na->ni, NULL); if (!ctx) { - ntfs_error(vol->sb, "Failed to get search context.%s", es); + ntfs_log_error("Failed to get search context.%s", es); goto err_out; } if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, mftbmp_na->name_len, 0, 0, NULL, 0, ctx)) { - ntfs_error(vol->sb, "Failed to find first attribute extent of " + ntfs_log_error("Failed to find first attribute extent of " "mft bitmap attribute.%s", es); put_err_out: ntfs_attr_put_search_ctx(ctx); @@ -851,8 +855,8 @@ put_err_out: } ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); - ntfs_debug("Restored status of mftbmp: allocated_size 0x%llx, " - "data_size 0x%llx, initialized_size 0x%llx.", + ntfs_log_debug("Restored status of mftbmp: allocated_size 0x%llx, " + "data_size 0x%llx, initialized_size 0x%llx.\n", (long long)mftbmp_na->allocated_size, (long long)mftbmp_na->data_size, (long long)mftbmp_na->initialized_size); @@ -888,7 +892,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) u32 old_alen = 0; /* silence compiler warning */ BOOL mp_rebuilt = FALSE; - ntfs_debug("Extending mft data allocation."); + ntfs_log_debug("Extending mft data allocation.\n"); mft_na = vol->mft_na; /* * Determine the preferred allocation location, i.e. the last lcn of @@ -898,14 +902,14 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) rl = ntfs_attr_find_vcn(mft_na, (mft_na->allocated_size - 1) >> vol->cluster_size_bits); if (!rl || !rl->length || rl->lcn < 0) { - ntfs_error(vol->sb, "Failed to determine last allocated " + ntfs_log_error("Failed to determine last allocated " "cluster of mft data attribute."); if (rl) errno = EIO; return -1; } lcn = rl->lcn + rl->length; - ntfs_debug("Last lcn of mft data attribute is 0x%llx.", (long long)lcn); + ntfs_log_debug("Last lcn of mft data attribute is 0x%llx.\n", (long long)lcn); /* Minimum allocation is one mft record worth of clusters. */ min_nr = vol->mft_record_size >> vol->cluster_size_bits; if (!min_nr) @@ -914,15 +918,15 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) nr = vol->mft_record_size << 4 >> vol->cluster_size_bits; if (!nr) nr = min_nr; - ntfs_debug("Trying mft data allocation with default cluster count " - "%lli.", (long long)nr); + ntfs_log_debug("Trying mft data allocation with default cluster count " + "%lli.\n", (long long)nr); old_last_vcn = rl[1].vcn; do { rl2 = ntfs_cluster_alloc(vol, old_last_vcn, nr, lcn, MFT_ZONE); if (rl2) break; if (errno != ENOSPC || nr == min_nr) { - ntfs_error(vol->sb, "Failed to allocate the minimal " + ntfs_log_error("Failed to allocate the minimal " "number of clusters (%lli) for the " "mft data attribute.", (long long)nr); return -1; @@ -933,35 +937,35 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) * before failing. */ nr = min_nr; - ntfs_debug("Retrying mft data allocation with minimal cluster " - "count %lli.", (long long)nr); + ntfs_log_debug("Retrying mft data allocation with minimal cluster " + "count %lli.\n", (long long)nr); } while (1); rl = ntfs_runlists_merge(mft_na->rl, rl2); if (!rl) { err = errno; - ntfs_error(vol->sb, "Failed to merge runlists for mft data " + ntfs_log_error("Failed to merge runlists for mft data " "attribute."); if (ntfs_cluster_free_from_rl(vol, rl2)) - ntfs_error(vol->sb, "Failed to deallocate clusters " + ntfs_log_error("Failed to deallocate clusters " "from the mft data attribute.%s", es); free(rl2); errno = err; return -1; } mft_na->rl = rl; - ntfs_debug("Allocated %lli clusters.", nr); + ntfs_log_debug("Allocated %lli clusters.\n", nr); /* Find the last run in the new runlist. */ for (; rl[1].length; rl++) ; /* Update the attribute record as well. */ ctx = ntfs_attr_get_search_ctx(mft_na->ni, NULL); if (!ctx) { - ntfs_error(vol->sb, "Failed to get search context."); + ntfs_log_error("Failed to get search context."); goto undo_alloc; } if (ntfs_attr_lookup(mft_na->type, mft_na->name, mft_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { - ntfs_error(vol->sb, "Failed to find last attribute extent of " + ntfs_log_error("Failed to find last attribute extent of " "mft data attribute."); goto undo_alloc; } @@ -970,7 +974,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) ll = sle64_to_cpu(a->lowest_vcn); rl2 = ntfs_attr_find_vcn(mft_na, ll); if (!rl2 || !rl2->length) { - ntfs_error(vol->sb, "Failed to determine previous last " + ntfs_log_error("Failed to determine previous last " "allocated cluster of mft data attribute."); if (rl2) errno = EIO; @@ -979,7 +983,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) /* Get the size for the new mapping pairs array for this extent. */ mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll); if (mp_size <= 0) { - ntfs_error(vol->sb, "Get size for mapping pairs failed for " + ntfs_log_error("Get size for mapping pairs failed for " "mft data attribute extent."); goto undo_alloc; } @@ -988,7 +992,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) if (ntfs_attr_record_resize(m, a, mp_size + le16_to_cpu(a->mapping_pairs_offset))) { if (errno != ENOSPC) { - ntfs_error(vol->sb, "Failed to resize attribute " + ntfs_log_error("Failed to resize attribute " "record for mft data attribute."); goto undo_alloc; } @@ -997,7 +1001,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) // Note: Use the special reserved mft records and ensure that // this extent is not required to find the mft record in // question. - ntfs_error(vol->sb, "Not enough space in this mft record to " + ntfs_log_error("Not enough space in this mft record to " "accommodate extended mft data attribute " "extent. Cannot handle this yet."); errno = EOPNOTSUPP; @@ -1010,7 +1014,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu(a->mapping_pairs_offset), mp_size, rl2, ll, NULL)) { - ntfs_error(vol->sb, "Failed to build mapping pairs array of " + ntfs_log_error("Failed to build mapping pairs array of " "mft data attribute."); errno = EIO; goto undo_alloc; @@ -1032,7 +1036,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) ntfs_attr_reinit_search_ctx(ctx); if (ntfs_attr_lookup(mft_na->type, mft_na->name, mft_na->name_len, 0, 0, NULL, 0, ctx)) { - ntfs_error(vol->sb, "Failed to find first attribute " + ntfs_log_error("Failed to find first attribute " "extent of mft data attribute."); goto restore_undo_alloc; } @@ -1049,7 +1053,7 @@ restore_undo_alloc: ntfs_attr_reinit_search_ctx(ctx); if (ntfs_attr_lookup(mft_na->type, mft_na->name, mft_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { - ntfs_error(vol->sb, "Failed to find last attribute extent of " + ntfs_log_error("Failed to find last attribute extent of " "mft data attribute.%s", es); ntfs_attr_put_search_ctx(ctx); mft_na->allocated_size += nr << vol->cluster_size_bits; @@ -1067,20 +1071,20 @@ restore_undo_alloc: undo_alloc: err = errno; if (ntfs_cluster_free(vol, mft_na, old_last_vcn, -1) < 0) - ntfs_error(vol->sb, "Failed to free clusters from mft data " + ntfs_log_error("Failed to free clusters from mft data " "attribute.%s", es); if (ntfs_rl_truncate(&mft_na->rl, old_last_vcn)) - ntfs_error(vol->sb, "Failed to truncate mft data attribute " + ntfs_log_error("Failed to truncate mft data attribute " "runlist.%s", es); if (mp_rebuilt) { if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu(a->mapping_pairs_offset), old_alen - le16_to_cpu(a->mapping_pairs_offset), rl2, ll, NULL)) - ntfs_error(vol->sb, "Failed to restore mapping pairs " + ntfs_log_error("Failed to restore mapping pairs " "array.%s", es); if (ntfs_attr_record_resize(m, a, old_alen)) - ntfs_error(vol->sb, "Failed to restore attribute " + ntfs_log_error("Failed to restore attribute " "record.%s", es); ntfs_inode_mark_dirty(ctx->ntfs_ino); } @@ -1185,11 +1189,11 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) u16 seq_no, usn; if (base_ni) - ntfs_debug("Entering (allocating an extent mft record for " + ntfs_log_trace("Entering (allocating an extent mft record for " "base mft record 0x%llx).", (long long)base_ni->mft_no); else - ntfs_debug("Entering (allocating a base mft record)."); + ntfs_log_trace("Entering (allocating a base mft record).\n"); if (!vol || !vol->mft_na || !vol->mftbmp_na) { errno = EINVAL; return NULL; @@ -1198,7 +1202,7 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) mftbmp_na = vol->mftbmp_na; bit = ntfs_mft_bitmap_find_free_rec(vol, base_ni); if (bit >= 0) { - ntfs_debug("Found free record (#1), bit 0x%llx.", + ntfs_log_debug("Found free record (#1), bit 0x%llx.\n", (long long)bit); goto found_free_rec; } @@ -1218,7 +1222,7 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) bit = ll; if (bit < 24) bit = 24; - ntfs_debug("Found free record (#2), bit 0x%llx.", + ntfs_log_debug("Found free record (#2), bit 0x%llx.\n", (long long)bit); goto found_free_rec; } @@ -1227,19 +1231,19 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) * mft record that we can allocate. * Note: The smallest mft record we allocate is mft record 24. */ - ntfs_debug("Status of mftbmp before extension: allocated_size 0x%llx, " - "data_size 0x%llx, initialized_size 0x%llx.", + ntfs_log_debug("Status of mftbmp before extension: allocated_size 0x%llx, " + "data_size 0x%llx, initialized_size 0x%llx.\n", (long long)mftbmp_na->allocated_size, (long long)mftbmp_na->data_size, (long long)mftbmp_na->initialized_size); if (mftbmp_na->initialized_size + 8 > mftbmp_na->allocated_size) { /* Need to extend bitmap by one more cluster. */ - ntfs_debug("mftbmp: initialized_size + 8 > allocated_size."); + ntfs_log_debug("mftbmp: initialized_size + 8 > allocated_size.\n"); if (ntfs_mft_bitmap_extend_allocation(vol)) goto err_out; - ntfs_debug("Status of mftbmp after allocation extension: " + ntfs_log_debug("Status of mftbmp after allocation extension: " "allocated_size 0x%llx, data_size 0x%llx, " - "initialized_size 0x%llx.", + "initialized_size 0x%llx.\n", (long long)mftbmp_na->allocated_size, (long long)mftbmp_na->data_size, (long long)mftbmp_na->initialized_size); @@ -1252,46 +1256,46 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) bit = mftbmp_na->initialized_size << 3; if (ntfs_mft_bitmap_extend_initialized(vol)) goto err_out; - ntfs_debug("Status of mftbmp after initialized extension: " + ntfs_log_debug("Status of mftbmp after initialized extension: " "allocated_size 0x%llx, data_size 0x%llx, " - "initialized_size 0x%llx.", + "initialized_size 0x%llx.\n", (long long)mftbmp_na->allocated_size, (long long)mftbmp_na->data_size, (long long)mftbmp_na->initialized_size); - ntfs_debug("Found free record (#3), bit 0x%llx.", (long long)bit); + ntfs_log_debug("Found free record (#3), bit 0x%llx.\n", (long long)bit); found_free_rec: /* @bit is the found free mft record, allocate it in the mft bitmap. */ - ntfs_debug("At found_free_rec."); + ntfs_log_debug("At found_free_rec.\n"); if (ntfs_bitmap_set_bit(mftbmp_na, bit)) { - ntfs_error(vol->sb, "Failed to allocate bit in mft bitmap."); + ntfs_log_error("Failed to allocate bit in mft bitmap."); goto err_out; } - ntfs_debug("Set bit 0x%llx in mft bitmap.", (long long)bit); + ntfs_log_debug("Set bit 0x%llx in mft bitmap.\n", (long long)bit); /* The mft bitmap is now uptodate. Deal with mft data attribute now. */ ll = (bit + 1) << vol->mft_record_size_bits; if (ll <= mft_na->initialized_size) { - ntfs_debug("Allocated mft record already initialized."); + ntfs_log_debug("Allocated mft record already initialized.\n"); goto mft_rec_already_initialized; } - ntfs_debug("Initializing allocated mft record."); + ntfs_log_debug("Initializing allocated mft record.\n"); /* * The mft record is outside the initialized data. Extend the mft data * attribute until it covers the allocated record. The loop is only * actually traversed more than once when a freshly formatted volume is * first written to so it optimizes away nicely in the common case. */ - ntfs_debug("Status of mft data before extension: " + ntfs_log_debug("Status of mft data before extension: " "allocated_size 0x%llx, data_size 0x%llx, " - "initialized_size 0x%llx.", + "initialized_size 0x%llx.\n", (long long)mft_na->allocated_size, (long long)mft_na->data_size, (long long)mft_na->initialized_size); while (ll > mft_na->allocated_size) { if (ntfs_mft_data_extend_allocation(vol)) goto undo_mftbmp_alloc; - ntfs_debug("Status of mft data after allocation extension: " + ntfs_log_debug("Status of mft data after allocation extension: " "allocated_size 0x%llx, data_size 0x%llx, " - "initialized_size 0x%llx.", + "initialized_size 0x%llx.\n", (long long)mft_na->allocated_size, (long long)mft_na->data_size, (long long)mft_na->initialized_size); @@ -1310,22 +1314,22 @@ found_free_rec: mft_na->initialized_size += vol->mft_record_size; if (mft_na->initialized_size > mft_na->data_size) mft_na->data_size = mft_na->initialized_size; - ntfs_debug("Initializing mft record 0x%llx.", (long long)ll2); + ntfs_log_debug("Initializing mft record 0x%llx.\n", (long long)ll2); err = ntfs_mft_record_format(vol, ll2); if (err) { - ntfs_error(vol->sb, "Failed to format mft record."); + ntfs_log_error("Failed to format mft record."); goto undo_data_init; } } /* Update the mft data attribute record to reflect the new sizes. */ ctx = ntfs_attr_get_search_ctx(mft_na->ni, NULL); if (!ctx) { - ntfs_error(vol->sb, "Failed to get search context."); + ntfs_log_error("Failed to get search context."); goto undo_data_init; } if (ntfs_attr_lookup(mft_na->type, mft_na->name, mft_na->name_len, 0, 0, NULL, 0, ctx)) { - ntfs_error(vol->sb, "Failed to find first attribute extent of " + ntfs_log_error("Failed to find first attribute extent of " "mft data attribute."); ntfs_attr_put_search_ctx(ctx); goto undo_data_init; @@ -1336,9 +1340,9 @@ found_free_rec: /* Ensure the changes make it to disk. */ ntfs_inode_mark_dirty(ctx->ntfs_ino); ntfs_attr_put_search_ctx(ctx); - ntfs_debug("Status of mft data after mft record initialization: " + ntfs_log_debug("Status of mft data after mft record initialization: " "allocated_size 0x%llx, data_size 0x%llx, " - "initialized_size 0x%llx.", + "initialized_size 0x%llx.\n", (long long)mft_na->allocated_size, (long long)mft_na->data_size, (long long)mft_na->initialized_size); @@ -1357,20 +1361,20 @@ mft_rec_already_initialized: */ m = (MFT_RECORD*)malloc(vol->mft_record_size); if (!m) { - ntfs_error(vol->sb, "Failed to allocate buffer for mft " + ntfs_log_error("Failed to allocate buffer for mft " "record."); goto undo_mftbmp_alloc; } if (ntfs_mft_record_read(vol, bit, m)) { err = errno; - ntfs_error(vol->sb, "Failed to read mft record."); + ntfs_log_error("Failed to read mft record."); free(m); errno = err; goto undo_mftbmp_alloc; } /* Sanity check that the mft record is really not in use. */ if (ntfs_is_file_record(m->magic) && (m->flags & MFT_RECORD_IN_USE)) { - ntfs_error(vol->sb, "Mft record 0x%llx was marked unused in " + ntfs_log_error("Mft record 0x%llx was marked unused in " "mft bitmap but is marked used itself. " "Corrupt filesystem or library bug! " "Run chkdsk immediately!", (long long)bit); @@ -1382,7 +1386,7 @@ mft_rec_already_initialized: usn = *(u16*)((u8*)m + le16_to_cpu(m->usa_ofs)); if (ntfs_mft_record_layout(vol, bit, m)) { err = errno; - ntfs_error(vol->sb, "Failed to re-format mft record."); + ntfs_log_error("Failed to re-format mft record."); free(m); errno = err; goto undo_mftbmp_alloc; @@ -1398,7 +1402,7 @@ mft_rec_already_initialized: ni = ntfs_inode_allocate(vol); if (!ni) { err = errno; - ntfs_error(vol->sb, "Failed to allocate buffer for inode."); + ntfs_log_error("Failed to allocate buffer for inode."); free(m); errno = err; goto undo_mftbmp_alloc; @@ -1427,7 +1431,7 @@ mft_rec_already_initialized: extent_nis = (ntfs_inode**)malloc(i); if (!extent_nis) { err = errno; - ntfs_error(vol->sb, "Failed to allocate " + ntfs_log_error("Failed to allocate " "buffer for extent inodes " "array."); free(m); @@ -1455,7 +1459,7 @@ mft_rec_already_initialized: if (!base_ni) vol->mft_data_pos = bit + 1; /* Return the opened, allocated inode of the allocated mft record. */ - ntfs_debug("Returning opened, allocated %sinode 0x%llx.", + ntfs_log_debug("Returning opened, allocated %sinode 0x%llx.\n", base_ni ? "extent " : "", (long long)bit); return ni; undo_data_init: @@ -1464,7 +1468,7 @@ undo_data_init: undo_mftbmp_alloc: err = errno; if (ntfs_bitmap_clear_bit(mftbmp_na, bit)) - ntfs_error(vol->sb, "Failed to clear bit in mft bitmap.%s", es); + ntfs_log_error("Failed to clear bit in mft bitmap.%s", es); errno = err; err_out: if (!errno) @@ -1489,8 +1493,7 @@ int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni) int err; u16 seq_no, old_seq_no; - Dprintf("%s(): Entering for inode 0x%llx.\n", - __FUNCTION__, (long long) ni->mft_no); + ntfs_log_trace("Entering for inode 0x%llx.\n", (long long) ni->mft_no); if (!vol || !vol->mftbmp_na || !ni) { errno = EINVAL; @@ -1535,8 +1538,8 @@ int ntfs_mft_record_free(ntfs_volume *vol, ntfs_inode *ni) /* Rollback what we did... */ bitmap_rollback: if (ntfs_bitmap_set_bit(vol->mftbmp_na, mft_no)) - Dputs("Eeek! Rollback failed in ntfs_mft_record_free(). " - "Leaving inconsistent metadata!"); + ntfs_log_debug("Eeek! Rollback failed in ntfs_mft_record_free(). " + "Leaving inconsistent metadata!\n"); sync_rollback: ni->mrec->flags |= MFT_RECORD_IN_USE; ni->mrec->sequence_number = old_seq_no; @@ -1557,7 +1560,7 @@ sync_rollback: /** * ntfs_mft_remove_attr */ -int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES type) +int ntfs_mft_remove_attr(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES type) { ATTR_RECORD *attr20, *attrXX; MFT_RECORD *mft; @@ -1567,28 +1570,28 @@ int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES ty if (!inode) return 1; - attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, inode->mrec); + attr20 = find_first_attribute(AT_ATTRIBUTE_LIST, inode->mrec); if (attr20) return 1; - printf ("remove inode %lld, attr 0x%02X\n", inode->mft_no, type); + ntfs_log_debug("remove inode %lld, attr 0x%02X\n", inode->mft_no, type); - attrXX = find_first_attribute (type, inode->mrec); + attrXX = find_first_attribute(type, inode->mrec); if (!attrXX) return 1; - if (utils_free_non_residents3 (bmp, inode, attrXX)) + if (utils_free_non_residents3(bmp, inode, attrXX)) return 1; // remove entry // inode->mrec mft = inode->mrec; - //utils_dump_mem (mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); + //utils_dump_mem(mft, 0, mft->bytes_in_use, DM_DEFAULTS); ntfs_log_debug("\n"); - //utils_dump_mem (attrXX, 0, attrXX->length, DM_DEFAULTS); printf ("\n"); + //utils_dump_mem(attrXX, 0, attrXX->length, DM_DEFAULTS); ntfs_log_debug("\n"); - //printf ("mrec = %p, attr = %p, diff = %d (0x%02X)\n", mft, attrXX, (u8*)attrXX - (u8*)mft, (u8*)attrXX - (u8*)mft); + //ntfs_log_debug("mrec = %p, attr = %p, diff = %d (0x%02X)\n", mft, attrXX, (u8*)attrXX - (u8*)mft, (u8*)attrXX - (u8*)mft); // memmove dst = (u8*) attrXX; @@ -1599,14 +1602,14 @@ int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES ty mft->bytes_in_use -= attrXX->length; #if 0 - printf ("dst = 0x%02X, src = 0x%02X, len = 0x%02X\n", (dst - (u8*)mft), (src - (u8*)mft), len); - printf ("attr %02X, len = 0x%02X\n", attrXX->type, attrXX->length); - printf ("bytes in use = 0x%02X\n", mft->bytes_in_use); - printf ("\n"); + ntfs_log_debug("dst = 0x%02X, src = 0x%02X, len = 0x%02X\n", (dst - (u8*)mft), (src - (u8*)mft), len); + ntfs_log_debug("attr %02X, len = 0x%02X\n", attrXX->type, attrXX->length); + ntfs_log_debug("bytes in use = 0x%02X\n", mft->bytes_in_use); + ntfs_log_debug("\n"); #endif - memmove (dst, src, len); - //utils_dump_mem (mft, 0, mft->bytes_in_use, DM_DEFAULTS); printf ("\n"); + memmove(dst, src, len); + //utils_dump_mem(mft, 0, mft->bytes_in_use, DM_DEFAULTS); ntfs_log_debug("\n"); NInoSetDirty(inode); return 0; @@ -1615,7 +1618,7 @@ int ntfs_mft_remove_attr (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES ty /** * ntfs_mft_add_attr */ -ATTR_RECORD * ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, int data_len) +ATTR_RECORD * ntfs_mft_add_attr(ntfs_inode *inode, ATTR_TYPES type, u8 *data, int data_len) { MFT_RECORD *mrec; ATTR_RECORD *attr; @@ -1630,14 +1633,14 @@ ATTR_RECORD * ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, i if (!data) return NULL; - attr_size = ATTR_SIZE (data_len); + attr_size = ATTR_SIZE(data_len); mrec = inode->mrec; if (!mrec) return NULL; if ((mrec->bytes_in_use + attr_size + 0x18) > mrec->bytes_allocated) { - printf ("attribute is too big to fit in the record\n"); + ntfs_log_debug("attribute is too big to fit in the record\n"); return NULL; } @@ -1651,13 +1654,13 @@ ATTR_RECORD * ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, i ptr += attr->length; } - //printf ("insert before attr 0x%02X\n", attr->type); + //ntfs_log_debug("insert before attr 0x%02X\n", attr->type); len = ((u8*) mrec + mrec->bytes_in_use) - ((u8*) attr); src = (u8*) attr; dst = src + attr_size + 0x18; - memmove (dst, src, len); + memmove(dst, src, len); src = data; dst = (u8*) attr + 0x18; @@ -1665,11 +1668,11 @@ ATTR_RECORD * ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, i // XXX wipe slack space after attr? - memcpy (dst, src, len); + memcpy(dst, src, len); mrec->bytes_in_use += attr_size + 0x18; - memset (attr, 0, 0x18); + memset(attr, 0, 0x18); *(u32*)((u8*) attr + 0x00) = type; *(u32*)((u8*) attr + 0x04) = attr_size + 0x18; *(u16*)((u8*) attr + 0x0E) = mrec->next_attr_instance; @@ -1684,7 +1687,7 @@ ATTR_RECORD * ntfs_mft_add_attr (ntfs_inode *inode, ATTR_TYPES type, u8 *data, i /** * ntfs_mft_resize_resident */ -int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len, u8 *data, int data_len) +int ntfs_mft_resize_resident(ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len, u8 *data, int data_len) { int mft_size; int mft_usage; @@ -1713,12 +1716,12 @@ int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name mft_usage = mrec->bytes_in_use; mft_free = mft_size - mft_usage; - //printf ("mft_size = %d\n", mft_size); - //printf ("mft_usage = %d\n", mft_usage); - //printf ("mft_free = %d\n", mft_free); - //printf ("\n"); + //ntfs_log_debug("mft_size = %d\n", mft_size); + //ntfs_log_debug("mft_usage = %d\n", mft_usage); + //ntfs_log_debug("mft_free = %d\n", mft_free); + //ntfs_log_debug("\n"); - ctx = ntfs_attr_get_search_ctx (NULL, mrec); + ctx = ntfs_attr_get_search_ctx(NULL, mrec); if (!ctx) goto done; @@ -1728,57 +1731,57 @@ int ntfs_mft_resize_resident (ntfs_inode *inode, ATTR_TYPES type, ntfschar *name arec = ctx->attr; if (arec->non_resident) { - printf ("attribute isn't resident\n"); + ntfs_log_debug("attribute isn't resident\n"); goto done; } attr_orig = arec->value_length; attr_new = data_len; - //printf ("attr orig = %d\n", attr_orig); - //printf ("attr new = %d\n", attr_new); - //printf ("\n"); + //ntfs_log_debug("attr orig = %d\n", attr_orig); + //ntfs_log_debug("attr new = %d\n", attr_new); + //ntfs_log_debug("\n"); if ((attr_new - attr_orig + mft_usage) > mft_size) { - printf ("attribute won't fit into mft record\n"); + ntfs_log_debug("attribute won't fit into mft record\n"); goto done; } - //printf ("new free space = %d\n", mft_size - (attr_new - attr_orig + mft_usage)); + //ntfs_log_debug("new free space = %d\n", mft_size - (attr_new - attr_orig + mft_usage)); src = (u8*)arec + arec->length; dst = src + (attr_new - attr_orig); end = (u8*)mrec + mft_usage; len = end - src; - //printf ("src = %d\n", src - (u8*)mrec); - //printf ("dst = %d\n", dst - (u8*)mrec); - //printf ("end = %d\n", end - (u8*)mrec); - //printf ("len = %d\n", len); + //ntfs_log_debug("src = %d\n", src - (u8*)mrec); + //ntfs_log_debug("dst = %d\n", dst - (u8*)mrec); + //ntfs_log_debug("end = %d\n", end - (u8*)mrec); + //ntfs_log_debug("len = %d\n", len); if (src != dst) - memmove (dst, src, len); + memmove(dst, src, len); - memcpy ((u8*)arec + arec->value_offset, data, data_len); + memcpy((u8*)arec + arec->value_offset, data, data_len); mrec->bytes_in_use += (attr_new - attr_orig); arec->length += (attr_new - attr_orig); arec->value_length += (attr_new - attr_orig); - memset ((u8*)mrec + mrec->bytes_in_use, 0, mft_size - mrec->bytes_in_use); + memset((u8*)mrec + mrec->bytes_in_use, 0, mft_size - mrec->bytes_in_use); mft_usage += (attr_new - attr_orig); - //utils_dump_mem (mrec, 0, mft_size, DM_DEFAULTS); + //utils_dump_mem(mrec, 0, mft_size, DM_DEFAULTS); res = 0; done: - ntfs_attr_put_search_ctx (ctx); + ntfs_attr_put_search_ctx(ctx); return res; } /** * ntfs_mft_free_space */ -int ntfs_mft_free_space (struct ntfs_dir *dir) +int ntfs_mft_free_space(struct ntfs_dir *dir) { int res = 0; MFT_RECORD *mft; @@ -1796,7 +1799,7 @@ int ntfs_mft_free_space (struct ntfs_dir *dir) /** * ntfs_mft_add_index */ -int ntfs_mft_add_index (struct ntfs_dir *dir) +int ntfs_mft_add_index(struct ntfs_dir *dir) { ntfs_volume *vol; u8 *buffer = NULL; @@ -1814,31 +1817,31 @@ int ntfs_mft_add_index (struct ntfs_dir *dir) return 1; vol = dir->vol; - printf ("add two attrs to " YELLOW); ntfs_name_print (dir->name, dir->name_len); printf (END "\n"); - printf ("index size = %d\n", dir->index_size); + ntfs_log_debug("add two attrs to " YELLOW); ntfs_name_print(dir->name, dir->name_len); ntfs_log_debug(END "\n"); + ntfs_log_debug("index size = %d\n", dir->index_size); - buffer = malloc (dir->index_size); + buffer = malloc(dir->index_size); if (!buffer) return 1; - dt = ntfs_dt_create (dir, dir->index, -1); + dt = ntfs_dt_create(dir, dir->index, -1); if (!dt) return 1; dt->vcn = 0; // New alloc record - ie = ntfs_ie_copy (dir->index->children[dir->index->child_count-1]); - ie = ntfs_ie_set_vcn (ie, dt->vcn); + ie = ntfs_ie_copy(dir->index->children[dir->index->child_count-1]); + ie = ntfs_ie_set_vcn(ie, dt->vcn); // can't replace ie yet, there may not be room - ntfs_ie_free (ie); + ntfs_ie_free(ie); - ntfs_dt_transfer2 (dir->index, dt, 0, dir->index->child_count - 1); + ntfs_dt_transfer2(dir->index, dt, 0, dir->index->child_count - 1); - printf ("root has %d children\n", dir->index->child_count); - printf ("node has %d children\n", dt->child_count); + ntfs_log_debug("root has %d children\n", dir->index->child_count); + ntfs_log_debug("node has %d children\n", dt->child_count); - ntfs_dt_free (dt); + ntfs_dt_free(dt); // create a new dt // attach dt to dir @@ -1851,14 +1854,14 @@ int ntfs_mft_add_index (struct ntfs_dir *dir) // need disk allocation before here // Index Allocation - memset (buffer, 0, 128); - attr = ntfs_mft_add_attr (dir->inode, AT_INDEX_ALLOCATION, buffer, 0x48); + memset(buffer, 0, 128); + attr = ntfs_mft_add_attr(dir->inode, AT_INDEX_ALLOCATION, buffer, 0x48); // Bitmap - memset (buffer, 0, 8); + memset(buffer, 0, 8); buffer[0] = 0x01; - //printf ("inode = %p\n", dir->inode); - attr = ntfs_mft_add_attr (dir->inode, AT_BITMAP, buffer, 8); + //ntfs_log_debug("inode = %p\n", dir->inode); + attr = ntfs_mft_add_attr(dir->inode, AT_BITMAP, buffer, 8); // attach alloc and bitmap to dir // need to create ntfs_attr's for them @@ -1866,15 +1869,15 @@ int ntfs_mft_add_index (struct ntfs_dir *dir) // one indx record // 8 bits of bitmap - if (0) ntfs_bmp_find_space (NULL, 0, 0); + if (0) ntfs_bmp_find_space(NULL, 0, 0); - //printf ("m1 = %lld\n", vol->mft_zone_start); - //printf ("m2 = %lld\n", vol->mft_zone_end); - //printf ("m3 = %lld\n", vol->mft_zone_pos); - //printf ("z1 = %lld\n", vol->data1_zone_pos); - //printf ("z2 = %lld\n", vol->data2_zone_pos); + //ntfs_log_debug("m1 = %lld\n", vol->mft_zone_start); + //ntfs_log_debug("m2 = %lld\n", vol->mft_zone_end); + //ntfs_log_debug("m3 = %lld\n", vol->mft_zone_pos); + //ntfs_log_debug("z1 = %lld\n", vol->data1_zone_pos); + //ntfs_log_debug("z2 = %lld\n", vol->data2_zone_pos); - free (buffer); + free(buffer); return 0; } diff --git a/libntfs/mst.c b/libntfs/mst.c index 72587d4c..140700ea 100644 --- a/libntfs/mst.c +++ b/libntfs/mst.c @@ -1,4 +1,4 @@ -/* +/** * mst.c - Multi sector fixup handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov @@ -19,13 +19,16 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif -#include "mst.h" #ifdef HAVE_ERRNO_H #include #endif +#include "mst.h" + /** * ntfs_mst_post_read_fixup - deprotect multi sector transfer protected data * @b: pointer to the data to deprotect diff --git a/libntfs/rich.c b/libntfs/rich.c index aefe4a3e..42cc0022 100644 --- a/libntfs/rich.c +++ b/libntfs/rich.c @@ -21,9 +21,17 @@ #ifdef NTFS_RICH +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_STDLIB_H #include +#endif + #include "rich.h" #include "layout.h" +#include "logging.h" /** * find_attribute - Find an attribute of the given type @@ -39,7 +47,7 @@ * Return: Pointer Success, an attribute was found * NULL Error, no matching attributes were found */ -ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) +ATTR_RECORD * find_attribute(const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) { if (!ctx) { errno = EINVAL; @@ -47,11 +55,11 @@ ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) } if (ntfs_attr_lookup(type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { - Dprintf ("find_attribute didn't find an attribute of type: 0x%02x.\n", type); + ntfs_log_debug("find_attribute didn't find an attribute of type: 0x%02x.\n", type); return NULL; /* None / no more of that type */ } - Dprintf ("find_attribute found an attribute of type: 0x%02x.\n", type); + ntfs_log_debug("find_attribute found an attribute of type: 0x%02x.\n", type); return ctx->attr; } @@ -69,7 +77,7 @@ ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) * Return: Pointer Success, an attribute was found * NULL Error, no matching attributes were found */ -ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) +ATTR_RECORD * find_first_attribute(const ATTR_TYPES type, MFT_RECORD *mft) { ntfs_attr_search_ctx *ctx; ATTR_RECORD *rec; @@ -79,41 +87,41 @@ ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) return NULL; } - ctx = ntfs_attr_get_search_ctx (NULL, mft); + ctx = ntfs_attr_get_search_ctx(NULL, mft); if (!ctx) { - //XXX Eprintf ("Couldn't create a search context.\n"); + //XXX ntfs_log_error("Couldn't create a search context.\n"); return NULL; } - rec = find_attribute (type, ctx); - ntfs_attr_put_search_ctx (ctx); + rec = find_attribute(type, ctx); + ntfs_attr_put_search_ctx(ctx); if (rec) - Dprintf ("find_first_attribute: found attr of type 0x%02x.\n", type); + ntfs_log_debug("find_first_attribute: found attr of type 0x%02x.\n", type); else - Dprintf ("find_first_attribute: didn't find attr of type 0x%02x.\n", type); + ntfs_log_debug("find_first_attribute: didn't find attr of type 0x%02x.\n", type); return rec; } /** * ntfs_name_print */ -void ntfs_name_print (ntfschar *name, int name_len) +void ntfs_name_print(ntfschar *name, int name_len) { char *buffer = NULL; if (name_len) { - ntfs_ucstombs (name, name_len, &buffer, 0); - printf ("%s", buffer); - free (buffer); + ntfs_ucstombs(name, name_len, &buffer, 0); + ntfs_log_info("%s", buffer); + free(buffer); } else { - printf ("!"); + ntfs_log_info("!"); } } /** * utils_free_non_residents3 */ -int utils_free_non_residents3 (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECORD *attr) +int utils_free_non_residents3(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECORD *attr) { ntfs_attr *na; runlist_element *rl; @@ -129,19 +137,19 @@ int utils_free_non_residents3 (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_REC if (!attr->non_resident) return 0; - na = ntfs_attr_open (inode, attr->type, NULL, 0); + na = ntfs_attr_open(inode, attr->type, NULL, 0); if (!na) return 1; - ntfs_attr_map_whole_runlist (na); + ntfs_attr_map_whole_runlist(na); rl = na->rl; size = na->allocated_size >> inode->vol->cluster_size_bits; for (count = 0; count < size; count += rl->length, rl++) { - if (ntfs_bmp_set_range (bmp, rl->lcn, rl->length, 0) < 0) { - printf (RED "set range : %lld - %lld FAILED\n" END, rl->lcn, rl->lcn+rl->length-1); + if (ntfs_bmp_set_range(bmp, rl->lcn, rl->length, 0) < 0) { + ntfs_log_info(RED "set range : %lld - %lld FAILED\n" END, rl->lcn, rl->lcn+rl->length-1); } } - ntfs_attr_close (na); + ntfs_attr_close(na); return 0; } @@ -149,7 +157,7 @@ int utils_free_non_residents3 (struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_REC /** * utils_free_non_residents2 */ -int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) +int utils_free_non_residents2(ntfs_inode *inode, struct ntfs_bmp *bmp) { ntfs_attr_search_ctx *ctx; @@ -158,17 +166,17 @@ int utils_free_non_residents2 (ntfs_inode *inode, struct ntfs_bmp *bmp) if (!bmp) return -1; - ctx = ntfs_attr_get_search_ctx (NULL, inode->mrec); + ctx = ntfs_attr_get_search_ctx(NULL, inode->mrec); if (!ctx) { - printf ("can't create a search context\n"); + ntfs_log_info("can't create a search context\n"); return -1; } while (ntfs_attr_lookup(AT_UNUSED, NULL, 0, 0, 0, NULL, 0, ctx) == 0) { - utils_free_non_residents3 (bmp, inode, ctx->attr); + utils_free_non_residents3(bmp, inode, ctx->attr); } - ntfs_attr_put_search_ctx (ctx); + ntfs_attr_put_search_ctx(ctx); return 0; } diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 058f2313..f70f3e35 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -21,7 +21,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDIO_H #include @@ -37,13 +39,13 @@ #endif #include "compat.h" - #include "types.h" #include "attrib.h" #include "volume.h" #include "layout.h" #include "debug.h" #include "device.h" +#include "logging.h" /** * Internal: @@ -114,8 +116,8 @@ static __inline__ BOOL ntfs_rl_are_mergeable(runlist_element *dst, runlist_element *src) { if (!dst || !src) { - Dputs("Eeek. ntfs_rl_are_mergeable() invoked with NULL " - "pointer!"); + ntfs_log_debug("Eeek. ntfs_rl_are_mergeable() invoked with NULL " + "pointer!\n"); return FALSE; } @@ -182,7 +184,8 @@ static __inline__ runlist_element *ntfs_rl_append(runlist_element *dst, int marker; /* End of the inserted runs */ if (!dst || !src) { - Dputs("Eeek. ntfs_rl_append() invoked with NULL pointer!"); + ntfs_log_debug("Eeek. ntfs_rl_append() invoked with NULL " + "pointer!\n"); errno = EINVAL; return NULL; } @@ -251,7 +254,8 @@ static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, int marker; /* End of the inserted runs */ if (!dst || !src) { - Dputs("Eeek. ntfs_rl_insert() invoked with NULL pointer!"); + ntfs_log_debug("Eeek. ntfs_rl_insert() invoked with NULL " + "pointer!\n"); errno = EINVAL; return NULL; } @@ -349,7 +353,8 @@ static __inline__ runlist_element *ntfs_rl_replace(runlist_element *dst, int marker; /* End of the inserted runs */ if (!dst || !src) { - Dputs("Eeek. ntfs_rl_replace() invoked with NULL pointer!"); + ntfs_log_debug("Eeek. ntfs_rl_replace() invoked with NULL " + "pointer!\n"); errno = EINVAL; return NULL; } @@ -428,7 +433,7 @@ static __inline__ runlist_element *ntfs_rl_split(runlist_element *dst, int dsize, runlist_element *src, int ssize, int loc) { if (!dst || !src) { - Dputs("Eeek. ntfs_rl_split() invoked with NULL pointer!"); + ntfs_log_debug("Eeek. ntfs_rl_split() invoked with NULL pointer!\n"); errno = EINVAL; return NULL; } @@ -499,9 +504,9 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, int marker = 0; VCN marker_vcn = 0; - Dputs("dst:"); + ntfs_log_debug("dst:\n"); ntfs_debug_runlist_dump(drl); - Dputs("src:"); + ntfs_log_debug("src:\n"); ntfs_debug_runlist_dump(srl); /* Check for silly calling... */ @@ -537,8 +542,8 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, /* Can't have an entirely unmapped source runlist. */ if (!srl[si].length) { - Dputs("Eeek! ntfs_runlists_merge() received entirely " - "unmapped source runlist."); + ntfs_log_debug("Eeek! ntfs_runlists_merge() received entirely " + "unmapped source runlist.\n"); errno = EINVAL; return NULL; } @@ -560,7 +565,7 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, /* Sanity check for illegal overlaps. */ if ((drl[di].vcn == srl[si].vcn) && (drl[di].lcn >= 0) && (srl[si].lcn >= 0)) { - Dputs("Run lists overlap. Cannot merge!"); + ntfs_log_debug("Run lists overlap. Cannot merge!\n"); errno = ERANGE; return NULL; } @@ -598,10 +603,10 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn)) finish = FALSE; #ifdef DEBUG - Dprintf("dfinal = %i, dend = %i\n", dfinal, dend); - Dprintf("sstart = %i, sfinal = %i, send = %i\n", sstart, sfinal, send); - Dprintf("start = %i, finish = %i\n", start, finish); - Dprintf("ds = %i, ss = %i, dins = %i\n", ds, ss, dins); + ntfs_log_debug("dfinal = %i, dend = %i\n", dfinal, dend); + ntfs_log_debug("sstart = %i, sfinal = %i, send = %i\n", sstart, sfinal, send); + ntfs_log_debug("start = %i, finish = %i\n", start, finish); + ntfs_log_debug("ds = %i, ss = %i, dins = %i\n", ds, ss, dins); #endif if (start) { if (finish) @@ -615,13 +620,12 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, drl = ntfs_rl_split(drl, ds, srl + sstart, ss, dins); } if (!drl) { - Dprintf("%s(): Merge failed: %s\n", __FUNCTION__, - strerror(errno)); + ntfs_log_perror("Merge failed"); return drl; } free(srl); if (marker) { - Dputs("Triggering marker code."); + ntfs_log_debug("Triggering marker code.\n"); for (ds = dend; drl[ds].length; ds++) ; /* We only need to care if @srl ended after @drl. */ @@ -629,7 +633,7 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, int slots = 0; if (drl[ds].vcn == marker_vcn) { - Dprintf("Old marker = %lli, replacing with " + ntfs_log_debug("Old marker = %lli, replacing with " "LCN_ENOENT.\n", (long long)drl[ds].lcn); drl[ds].lcn = (LCN)LCN_ENOENT; @@ -684,14 +688,14 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, finished: /* The merge was completed successfully. */ - Dputs("Merged runlist:"); + ntfs_log_debug("Merged runlist:\n"); ntfs_debug_runlist_dump(drl); return drl; critical_error: /* Critical error! We cannot afford to fail here. */ - Dperror("libntfs: Critical error"); - Dputs("Forcing segmentation fault!"); + ntfs_log_perror("libntfs: Critical error"); + ntfs_log_debug("Forcing segmentation fault!\n"); marker_vcn = ((runlist*)NULL)->lcn; return drl; } @@ -737,7 +741,7 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, runlist_elements. */ u8 b; /* Current byte offset in buf. */ - Dprintf("%s(): Entering for attr 0x%x.\n", __FUNCTION__, + ntfs_log_trace("Entering for attr 0x%x.\n", (unsigned)le32_to_cpu(attr->type)); /* Make sure attr exists and is non-resident. */ if (!attr || !attr->non_resident || @@ -752,7 +756,7 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, buf = (const u8*)attr + le16_to_cpu(attr->mapping_pairs_offset); attr_end = (const u8*)attr + le32_to_cpu(attr->length); if (buf < (const u8*)attr || buf > attr_end) { - Dputs("Corrupt attribute."); + ntfs_log_debug("Corrupt attribute.\n"); errno = EIO; return NULL; } @@ -803,7 +807,8 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, for (deltaxcn = (s8)buf[b--]; b; b--) deltaxcn = (deltaxcn << 8) + buf[b]; } else { /* The length entry is compulsory. */ - Dputs("Missing length entry in mapping pairs array."); + ntfs_log_debug("Missing length entry in mapping pairs " + "array.\n"); deltaxcn = (s64)-1; } /* @@ -811,7 +816,7 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, * hence clean-up and return NULL. */ if (deltaxcn < 0) { - Dputs("Invalid length in mapping pairs array."); + ntfs_log_debug("Invalid length in mapping pairs array.\n"); goto err_out; } /* @@ -848,15 +853,15 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, */ if (vol->major_ver < 3) { if (deltaxcn == (LCN)-1) - Dputs("lcn delta == -1"); + ntfs_log_debug("lcn delta == -1\n"); if (lcn == (LCN)-1) - Dputs("lcn == -1"); + ntfs_log_debug("lcn == -1\n"); } #endif /* Check lcn is not below -1. */ if (lcn < (LCN)-1) { - Dputs("Invalid LCN < -1 in mapping pairs " - "array."); + ntfs_log_debug("Invalid LCN < -1 in mapping pairs " + "array.\n"); goto err_out; } /* Enter the current lcn into the runlist element. */ @@ -876,7 +881,8 @@ runlist_element *ntfs_mapping_pairs_decompress(const ntfs_volume *vol, deltaxcn = sle64_to_cpu(attr->highest_vcn); if (deltaxcn && vcn - 1 != deltaxcn) { mpa_err: - Dputs("Corrupt mapping pairs array in non-resident attribute."); + ntfs_log_debug("Corrupt mapping pairs array in non-resident " + "attribute.\n"); goto err_out; } /* Setup not mapped runlist element if this is the base extent. */ @@ -898,8 +904,8 @@ mpa_err: * this one. */ if (deltaxcn < max_cluster) { - Dprintf("More extents to follow; deltaxcn = 0x%llx, " - "max_cluster = 0x%llx\n", + ntfs_log_debug("More extents to follow; deltaxcn = " + "0x%llx, max_cluster = 0x%llx\n", (long long)deltaxcn, (long long)max_cluster); rl[rlpos].vcn = vcn; @@ -907,8 +913,8 @@ mpa_err: rl[rlpos].lcn = (LCN)LCN_RL_NOT_MAPPED; rlpos++; } else if (deltaxcn > max_cluster) { - Dprintf("Corrupt attribute. deltaxcn = 0x%llx, " - "max_cluster = 0x%llx", + ntfs_log_debug("Corrupt attribute. deltaxcn = " + "0x%llx, max_cluster = 0x%llx", (long long)deltaxcn, (long long)max_cluster); goto mpa_err; @@ -923,7 +929,7 @@ mpa_err: rl[rlpos].length = (s64)0; /* If no existing runlist was specified, we are done. */ if (!old_rl) { - Dputs("Mapping pairs array successfully decompressed:"); + ntfs_log_debug("Mapping pairs array successfully decompressed:\n"); ntfs_debug_runlist_dump(rl); return rl; } @@ -933,11 +939,11 @@ mpa_err: return old_rl; err = errno; free(rl); - Dputs("Failed to merge runlists."); + ntfs_log_debug("Failed to merge runlists.\n"); errno = err; return NULL; io_error: - Dputs("Corrupt attribute."); + ntfs_log_debug("Corrupt attribute.\n"); err_out: free(rl); errno = EIO; @@ -1256,15 +1262,15 @@ int ntfs_get_size_for_mapping_pairs(const ntfs_volume *vol, int rls; if (start_vcn < 0) { - Dprintf("%s(): start_vcn %lld (should be >= 0)", - __FUNCTION__, (long long) start_vcn); + ntfs_log_trace("start_vcn %lld (should be >= 0)\n", + (long long) start_vcn); errno = EINVAL; return -1; } if (!rl) { if (start_vcn) { - Dprintf("%s(): rl NULL, start_vcn %lld (should be > 0)", - __FUNCTION__, (long long) start_vcn); + ntfs_log_trace("rl NULL, start_vcn %lld (should be > 0)\n", + (long long) start_vcn); errno = EINVAL; return -1; } @@ -1581,8 +1587,8 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) rl = *arl; if (start_vcn < rl->vcn) { // FIXME: Eeek! BUG() - Dprintf("%s(): Eeek! start_vcn lies outside front of " - "runlist! Aborting.\n", __FUNCTION__); + ntfs_log_trace("Eeek! start_vcn lies outside front of runlist! " + "Aborting.\n"); errno = EIO; return -1; } @@ -1594,15 +1600,14 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) } if (!rl->length) { // FIXME: Weird, probably a BUG()! - Dprintf("%s(): Weird! Asking to truncate already truncated " - "runlist?!? Abort.\n", __FUNCTION__); + ntfs_log_trace("Weird! Asking to truncate already truncated " + "runlist?!? Abort.\n"); errno = EIO; return -1; } if (start_vcn < rl->vcn) { // FIXME: Eeek! BUG() - Dprintf("%s(): Eeek! start_vcn < rl->vcn! Aborting.\n", - __FUNCTION__); + ntfs_log_trace("Eeek! start_vcn < rl->vcn! Aborting.\n"); errno = EIO; return -1; } @@ -1635,9 +1640,8 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn) *arl = NULL; else { // FIXME: Eeek! - Dprintf("%s(): Eeek! Failed to reallocate runlist " - "buffer! Continuing regardless and " - "returning success.\n", __FUNCTION__); + ntfs_log_trace("Eeek! Failed to reallocate runlist buffer! " + "Continuing regardless and returning success.\n"); } } /* Done! */ @@ -1655,7 +1659,7 @@ int ntfs_rl_sparse(runlist *rl) runlist *rlc; if (!rl) { - Dprintf("%s(): Invalid argument passed.\n", __FUNCTION__); + ntfs_log_trace("Invalid argument passed.\n"); errno = EINVAL; return -1; } @@ -1663,8 +1667,7 @@ int ntfs_rl_sparse(runlist *rl) for (rlc = rl; rlc->length; rlc++) if (rlc->lcn < 0) { if (rlc->lcn != LCN_HOLE) { - Dprintf("%s(): Received unmapped runlist.\n", - __FUNCTION__); + ntfs_log_trace("Received unmapped runlist.\n"); errno = EINVAL; return -1; } @@ -1686,7 +1689,7 @@ s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl) s64 ret = 0; if (!rl) { - Dprintf("%s(): Invalid argument passed.\n", __FUNCTION__); + ntfs_log_trace("Invalid argument passed.\n"); errno = EINVAL; return -1; } @@ -1694,8 +1697,7 @@ s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl) for (rlc = rl; rlc->length; rlc++) { if (rlc->lcn < 0) { if (rlc->lcn != LCN_HOLE) { - Dprintf("%s(): Received unmapped runlist.\n", - __FUNCTION__); + ntfs_log_trace("Received unmapped runlist.\n"); errno = EINVAL; return -1; } @@ -1720,7 +1722,7 @@ s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl) /** * test_rl_dump_runlist */ -static void test_rl_dump_runlist (const runlist_element *rl) +static void test_rl_dump_runlist(const runlist_element *rl) { int abbr = 0; /* abbreviate long lists */ int len = 0; @@ -1728,20 +1730,20 @@ static void test_rl_dump_runlist (const runlist_element *rl) const char *lcn_str[5] = { "HOLE", "NOTMAP", "ENOENT", "XXXX" }; if (!rl) { - printf(" Run list not present.\n"); + ntfs_log_debug(" Run list not present.\n"); return; } if (abbr) for (len = 0; rl[len].length; len++) ; - printf(" VCN LCN len\n"); + ntfs_log_debug(" VCN LCN len\n"); for (i = 0; ; i++, rl++) { LCN lcn = rl->lcn; if ((abbr) && (len > 20)) { if (i == 4) - printf (" ...\n"); + ntfs_log_debug(" ...\n"); if ((i > 3) && (i < (len - 3))) continue; } @@ -1751,35 +1753,35 @@ static void test_rl_dump_runlist (const runlist_element *rl) if (ind > -LCN_ENOENT - 1) ind = 3; - printf("%8lld %8s %8lld\n", + ntfs_log_debug("%8lld %8s %8lld\n", rl->vcn, lcn_str[ind], rl->length); } else - printf("%8lld %8lld %8lld\n", + ntfs_log_debug("%8lld %8lld %8lld\n", rl->vcn, rl->lcn, rl->length); if (!rl->length) break; } if ((abbr) && (len > 20)) - printf (" (%d entries)\n", len+1); - printf ("\n"); + ntfs_log_debug(" (%d entries)\n", len+1); + ntfs_log_debug("\n"); } /** * test_rl_runlists_merge */ -static runlist_element * test_rl_runlists_merge (runlist_element *drl, runlist_element *srl) +static runlist_element * test_rl_runlists_merge(runlist_element *drl, runlist_element *srl) { runlist_element *res = NULL; - printf ("dst:\n"); - test_rl_dump_runlist (drl); - printf ("src:\n"); - test_rl_dump_runlist (srl); + ntfs_log_debug("dst:\n"); + test_rl_dump_runlist(drl); + ntfs_log_debug("src:\n"); + test_rl_dump_runlist(srl); - res = ntfs_runlists_merge (drl, srl); + res = ntfs_runlists_merge(drl, srl); - printf ("res:\n"); - test_rl_dump_runlist (res); + ntfs_log_debug("res:\n"); + test_rl_dump_runlist(res); return res; } @@ -1787,29 +1789,29 @@ static runlist_element * test_rl_runlists_merge (runlist_element *drl, runlist_e /** * test_rl_read_buffer */ -static int test_rl_read_buffer (const char *file, u8 *buf, int bufsize) +static int test_rl_read_buffer(const char *file, u8 *buf, int bufsize) { FILE *fptr; - fptr = fopen (file, "r"); + fptr = fopen(file, "r"); if (!fptr) { - printf ("open %s\n", file); + ntfs_log_debug("open %s\n", file); return 0; } - if (fread (buf, bufsize, 1, fptr) == 99) { - printf ("read %s\n", file); + if (fread(buf, bufsize, 1, fptr) == 99) { + ntfs_log_debug("read %s\n", file); return 0; } - fclose (fptr); + fclose(fptr); return 1; } /** * test_rl_pure_src */ -static runlist_element * test_rl_pure_src (BOOL contig, BOOL multi, int vcn, int len) +static runlist_element * test_rl_pure_src(BOOL contig, BOOL multi, int vcn, int len) { runlist_element *result; int fudge; @@ -1819,16 +1821,16 @@ static runlist_element * test_rl_pure_src (BOOL contig, BOOL multi, int vcn, int else fudge = 999; - result = malloc (4096); + result = malloc(4096); if (multi) { - MKRL (result+0, vcn + (0*len/4), fudge + vcn + 1000 + (0*len/4), len / 4) - MKRL (result+1, vcn + (1*len/4), fudge + vcn + 1000 + (1*len/4), len / 4) - MKRL (result+2, vcn + (2*len/4), fudge + vcn + 1000 + (2*len/4), len / 4) - MKRL (result+3, vcn + (3*len/4), fudge + vcn + 1000 + (3*len/4), len / 4) - MKRL (result+4, vcn + (4*len/4), LCN_RL_NOT_MAPPED, 0) + MKRL(result+0, vcn + (0*len/4), fudge + vcn + 1000 + (0*len/4), len / 4) + MKRL(result+1, vcn + (1*len/4), fudge + vcn + 1000 + (1*len/4), len / 4) + MKRL(result+2, vcn + (2*len/4), fudge + vcn + 1000 + (2*len/4), len / 4) + MKRL(result+3, vcn + (3*len/4), fudge + vcn + 1000 + (3*len/4), len / 4) + MKRL(result+4, vcn + (4*len/4), LCN_RL_NOT_MAPPED, 0) } else { - MKRL (result+0, vcn, fudge + vcn + 1000, len) - MKRL (result+1, vcn + len, LCN_RL_NOT_MAPPED, 0) + MKRL(result+0, vcn, fudge + vcn + 1000, len) + MKRL(result+1, vcn + len, LCN_RL_NOT_MAPPED, 0) } return result; } @@ -1836,27 +1838,27 @@ static runlist_element * test_rl_pure_src (BOOL contig, BOOL multi, int vcn, int /** * test_rl_pure_test */ -static void test_rl_pure_test (int test, BOOL contig, BOOL multi, int vcn, int len, runlist_element *file, int size) +static void test_rl_pure_test(int test, BOOL contig, BOOL multi, int vcn, int len, runlist_element *file, int size) { runlist_element *src; runlist_element *dst; runlist_element *res; - src = test_rl_pure_src (contig, multi, vcn, len); - dst = malloc (4096); + src = test_rl_pure_src(contig, multi, vcn, len); + dst = malloc(4096); - memcpy (dst, file, size); + memcpy(dst, file, size); - printf ("Test %2d ----------\n", test); - res = test_rl_runlists_merge (dst, src); + ntfs_log_debug("Test %2d ----------\n", test); + res = test_rl_runlists_merge(dst, src); - free (res); + free(res); } /** * test_rl_pure */ -static void test_rl_pure (char *contig, char *multi) +static void test_rl_pure(char *contig, char *multi) { /* VCN, LCN, len */ static runlist_element file1[] = { @@ -1894,118 +1896,118 @@ static void test_rl_pure (char *contig, char *multi) }; BOOL c, m; - if (strcmp (contig, "contig") == 0) + if (strcmp(contig, "contig") == 0) c = TRUE; - else if (strcmp (contig, "noncontig") == 0) + else if (strcmp(contig, "noncontig") == 0) c = FALSE; else { - printf ("rl pure [contig|noncontig] [single|multi]\n"); + ntfs_log_debug("rl pure [contig|noncontig] [single|multi]\n"); return; } - if (strcmp (multi, "multi") == 0) + if (strcmp(multi, "multi") == 0) m = TRUE; - else if (strcmp (multi, "single") == 0) + else if (strcmp(multi, "single") == 0) m = FALSE; else { - printf ("rl pure [contig|noncontig] [single|multi]\n"); + ntfs_log_debug("rl pure [contig|noncontig] [single|multi]\n"); return; } - test_rl_pure_test (1, c, m, 0, 40, file1, sizeof (file1)); - test_rl_pure_test (2, c, m, 40, 40, file1, sizeof (file1)); - test_rl_pure_test (3, c, m, 60, 40, file1, sizeof (file1)); - test_rl_pure_test (4, c, m, 0, 100, file1, sizeof (file1)); - test_rl_pure_test (5, c, m, 200, 40, file1, sizeof (file1)); - test_rl_pure_test (6, c, m, 240, 40, file1, sizeof (file1)); - test_rl_pure_test (7, c, m, 260, 40, file1, sizeof (file1)); - test_rl_pure_test (8, c, m, 200, 100, file1, sizeof (file1)); - test_rl_pure_test (9, c, m, 400, 40, file1, sizeof (file1)); - test_rl_pure_test (10, c, m, 440, 40, file1, sizeof (file1)); - test_rl_pure_test (11, c, m, 460, 40, file1, sizeof (file1)); - test_rl_pure_test (12, c, m, 400, 100, file1, sizeof (file1)); - test_rl_pure_test (13, c, m, 160, 100, file2, sizeof (file2)); - test_rl_pure_test (14, c, m, 100, 140, file2, sizeof (file2)); - test_rl_pure_test (15, c, m, 200, 40, file2, sizeof (file2)); - test_rl_pure_test (16, c, m, 240, 40, file2, sizeof (file2)); - test_rl_pure_test (17, c, m, 100, 40, file3, sizeof (file3)); - test_rl_pure_test (18, c, m, 140, 40, file3, sizeof (file3)); - test_rl_pure_test (19, c, m, 0, 40, file4, sizeof (file4)); - test_rl_pure_test (20, c, m, 40, 40, file4, sizeof (file4)); - test_rl_pure_test (21, c, m, 0, 40, file5, sizeof (file5)); - test_rl_pure_test (22, c, m, 40, 40, file5, sizeof (file5)); - test_rl_pure_test (23, c, m, 60, 40, file5, sizeof (file5)); - test_rl_pure_test (24, c, m, 0, 100, file5, sizeof (file5)); - test_rl_pure_test (25, c, m, 200, 40, file5, sizeof (file5)); - test_rl_pure_test (26, c, m, 240, 40, file5, sizeof (file5)); - test_rl_pure_test (27, c, m, 260, 40, file5, sizeof (file5)); - test_rl_pure_test (28, c, m, 200, 100, file5, sizeof (file5)); - test_rl_pure_test (29, c, m, 400, 40, file5, sizeof (file5)); - test_rl_pure_test (30, c, m, 440, 40, file5, sizeof (file5)); - test_rl_pure_test (31, c, m, 460, 40, file5, sizeof (file5)); - test_rl_pure_test (32, c, m, 400, 100, file5, sizeof (file5)); - test_rl_pure_test (33, c, m, 160, 100, file6, sizeof (file6)); - test_rl_pure_test (34, c, m, 100, 140, file6, sizeof (file6)); + test_rl_pure_test(1, c, m, 0, 40, file1, sizeof(file1)); + test_rl_pure_test(2, c, m, 40, 40, file1, sizeof(file1)); + test_rl_pure_test(3, c, m, 60, 40, file1, sizeof(file1)); + test_rl_pure_test(4, c, m, 0, 100, file1, sizeof(file1)); + test_rl_pure_test(5, c, m, 200, 40, file1, sizeof(file1)); + test_rl_pure_test(6, c, m, 240, 40, file1, sizeof(file1)); + test_rl_pure_test(7, c, m, 260, 40, file1, sizeof(file1)); + test_rl_pure_test(8, c, m, 200, 100, file1, sizeof(file1)); + test_rl_pure_test(9, c, m, 400, 40, file1, sizeof(file1)); + test_rl_pure_test(10, c, m, 440, 40, file1, sizeof(file1)); + test_rl_pure_test(11, c, m, 460, 40, file1, sizeof(file1)); + test_rl_pure_test(12, c, m, 400, 100, file1, sizeof(file1)); + test_rl_pure_test(13, c, m, 160, 100, file2, sizeof(file2)); + test_rl_pure_test(14, c, m, 100, 140, file2, sizeof(file2)); + test_rl_pure_test(15, c, m, 200, 40, file2, sizeof(file2)); + test_rl_pure_test(16, c, m, 240, 40, file2, sizeof(file2)); + test_rl_pure_test(17, c, m, 100, 40, file3, sizeof(file3)); + test_rl_pure_test(18, c, m, 140, 40, file3, sizeof(file3)); + test_rl_pure_test(19, c, m, 0, 40, file4, sizeof(file4)); + test_rl_pure_test(20, c, m, 40, 40, file4, sizeof(file4)); + test_rl_pure_test(21, c, m, 0, 40, file5, sizeof(file5)); + test_rl_pure_test(22, c, m, 40, 40, file5, sizeof(file5)); + test_rl_pure_test(23, c, m, 60, 40, file5, sizeof(file5)); + test_rl_pure_test(24, c, m, 0, 100, file5, sizeof(file5)); + test_rl_pure_test(25, c, m, 200, 40, file5, sizeof(file5)); + test_rl_pure_test(26, c, m, 240, 40, file5, sizeof(file5)); + test_rl_pure_test(27, c, m, 260, 40, file5, sizeof(file5)); + test_rl_pure_test(28, c, m, 200, 100, file5, sizeof(file5)); + test_rl_pure_test(29, c, m, 400, 40, file5, sizeof(file5)); + test_rl_pure_test(30, c, m, 440, 40, file5, sizeof(file5)); + test_rl_pure_test(31, c, m, 460, 40, file5, sizeof(file5)); + test_rl_pure_test(32, c, m, 400, 100, file5, sizeof(file5)); + test_rl_pure_test(33, c, m, 160, 100, file6, sizeof(file6)); + test_rl_pure_test(34, c, m, 100, 140, file6, sizeof(file6)); } /** * test_rl_zero */ -static void test_rl_zero (void) +static void test_rl_zero(void) { runlist_element *jim = NULL; runlist_element *bob = NULL; - bob = calloc (3, sizeof (runlist_element)); + bob = calloc(3, sizeof(runlist_element)); if (!bob) return; MKRL(bob+0, 10, 99, 5) MKRL(bob+1, 15, LCN_RL_NOT_MAPPED, 0) - jim = test_rl_runlists_merge (jim, bob); + jim = test_rl_runlists_merge(jim, bob); if (!jim) return; - free (jim); + free(jim); } /** * test_rl_frag_combine */ -static void test_rl_frag_combine (ntfs_volume *vol, ATTR_RECORD *attr1, ATTR_RECORD *attr2, ATTR_RECORD *attr3) +static void test_rl_frag_combine(ntfs_volume *vol, ATTR_RECORD *attr1, ATTR_RECORD *attr2, ATTR_RECORD *attr3) { runlist_element *run1; runlist_element *run2; runlist_element *run3; - run1 = ntfs_mapping_pairs_decompress (vol, attr1, NULL); + run1 = ntfs_mapping_pairs_decompress(vol, attr1, NULL); if (!run1) return; - run2 = ntfs_mapping_pairs_decompress (vol, attr2, NULL); + run2 = ntfs_mapping_pairs_decompress(vol, attr2, NULL); if (!run2) return; - run1 = test_rl_runlists_merge (run1, run2); + run1 = test_rl_runlists_merge(run1, run2); - run3 = ntfs_mapping_pairs_decompress (vol, attr3, NULL); + run3 = ntfs_mapping_pairs_decompress(vol, attr3, NULL); if (!run3) return; - run1 = test_rl_runlists_merge (run1, run3); + run1 = test_rl_runlists_merge(run1, run3); - free (run1); + free(run1); } /** * test_rl_frag */ -static void test_rl_frag (char *test) +static void test_rl_frag(char *test) { ntfs_volume vol; - ATTR_RECORD *attr1 = malloc (1024); - ATTR_RECORD *attr2 = malloc (1024); - ATTR_RECORD *attr3 = malloc (1024); + ATTR_RECORD *attr1 = malloc(1024); + ATTR_RECORD *attr2 = malloc(1024); + ATTR_RECORD *attr3 = malloc(1024); if (!attr1 || !attr2 || !attr3) goto out; @@ -2016,36 +2018,36 @@ static void test_rl_frag (char *test) vol.cluster_size_bits = 11; vol.major_ver = 3; - if (!test_rl_read_buffer ("runlist-data/attr1.bin", (u8*) attr1, 1024)) + if (!test_rl_read_buffer("runlist-data/attr1.bin", (u8*) attr1, 1024)) goto out; - if (!test_rl_read_buffer ("runlist-data/attr2.bin", (u8*) attr2, 1024)) + if (!test_rl_read_buffer("runlist-data/attr2.bin", (u8*) attr2, 1024)) goto out; - if (!test_rl_read_buffer ("runlist-data/attr3.bin", (u8*) attr3, 1024)) + if (!test_rl_read_buffer("runlist-data/attr3.bin", (u8*) attr3, 1024)) goto out; - if (strcmp (test, "123") == 0) test_rl_frag_combine (&vol, attr1, attr2, attr3); - else if (strcmp (test, "132") == 0) test_rl_frag_combine (&vol, attr1, attr3, attr2); - else if (strcmp (test, "213") == 0) test_rl_frag_combine (&vol, attr2, attr1, attr3); - else if (strcmp (test, "231") == 0) test_rl_frag_combine (&vol, attr2, attr3, attr1); - else if (strcmp (test, "312") == 0) test_rl_frag_combine (&vol, attr3, attr1, attr2); - else if (strcmp (test, "321") == 0) test_rl_frag_combine (&vol, attr3, attr2, attr1); - else printf ("Frag: No such test '%s'\n", test); + if (strcmp(test, "123") == 0) test_rl_frag_combine(&vol, attr1, attr2, attr3); + else if (strcmp(test, "132") == 0) test_rl_frag_combine(&vol, attr1, attr3, attr2); + else if (strcmp(test, "213") == 0) test_rl_frag_combine(&vol, attr2, attr1, attr3); + else if (strcmp(test, "231") == 0) test_rl_frag_combine(&vol, attr2, attr3, attr1); + else if (strcmp(test, "312") == 0) test_rl_frag_combine(&vol, attr3, attr1, attr2); + else if (strcmp(test, "321") == 0) test_rl_frag_combine(&vol, attr3, attr2, attr1); + else ntfs_log_debug("Frag: No such test '%s'\n", test); out: - free (attr1); - free (attr2); - free (attr3); + free(attr1); + free(attr2); + free(attr3); } /** * test_rl_main */ -int test_rl_main (int argc, char *argv[]) +int test_rl_main(int argc, char *argv[]) { - if ((argc == 2) && (strcmp (argv[1], "zero") == 0)) test_rl_zero(); - else if ((argc == 3) && (strcmp (argv[1], "frag") == 0)) test_rl_frag (argv[2]); - else if ((argc == 4) && (strcmp (argv[1], "pure") == 0)) test_rl_pure (argv[2], argv[3]); - else printf ("rl [zero|frag|pure] {args}\n"); + if ((argc == 2) && (strcmp(argv[1], "zero") == 0)) test_rl_zero(); + else if ((argc == 3) && (strcmp(argv[1], "frag") == 0)) test_rl_frag(argv[2]); + else if ((argc == 4) && (strcmp(argv[1], "pure") == 0)) test_rl_pure(argv[2], argv[3]); + else ntfs_log_debug("rl [zero|frag|pure] {args}\n"); return 0; } diff --git a/libntfs/security.c b/libntfs/security.c index fec170ef..e30e6662 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -1,6 +1,5 @@ -/* - * security.c - Code for handling security/ACLs in NTFS. Part of the - * Linux-NTFS project. +/** + * security.c - Handling security/ACLs in NTFS. Part of the Linux-NTFS project. * * Copyright (c) 2004 Anton Altaparmakov * @@ -20,7 +19,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDIO_H #include @@ -249,12 +250,11 @@ err_out: return NULL; } -/* - * GUID generate_guid(GUID *guid) +/** + * GUID generate_guid(GUID *guid) * generatates a random current guid * perhaps not a very good random number generator though... */ - GUID *generate_guid(GUID *guid) { int i; @@ -262,9 +262,9 @@ GUID *generate_guid(GUID *guid) { for (i = 0; i < 16; i++) { array[i] = (u8)(random() & 0xFF); - if (i == 7) + if (i == 7) array[7] = (array[7] & 0x0F) | 0x40; - if (i == 8) + if (i == 8) array[8] = (array[8] & 0x3F) | 0x80; } memcpy(guid, array, sizeof(guid)); diff --git a/libntfs/tree.c b/libntfs/tree.c index dbbaec36..1256ecae 100644 --- a/libntfs/tree.c +++ b/libntfs/tree.c @@ -21,7 +21,9 @@ #ifdef NTFS_RICH +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDLIB_H #include @@ -29,17 +31,17 @@ #include "volume.h" #include "dir.h" - #include "tree.h" #include "bitmap.h" #include "index.h" #include "inode.h" +#include "logging.h" #include "rich.h" /** * ntfs_dt_free */ -void ntfs_dt_free (struct ntfs_dt *dt) +void ntfs_dt_free(struct ntfs_dt *dt) { int i; @@ -47,21 +49,21 @@ void ntfs_dt_free (struct ntfs_dt *dt) return; for (i = 0; i < dt->child_count; i++) { - ntfs_dt_free (dt->sub_nodes[i]); - ntfs_inode_close2 (dt->inodes[i]); + ntfs_dt_free(dt->sub_nodes[i]); + ntfs_inode_close2(dt->inodes[i]); } - free (dt->sub_nodes); - free (dt->children); - free (dt->inodes); - free (dt->data); // XXX is this always ours? - free (dt); + free(dt->sub_nodes); + free(dt->children); + free(dt->inodes); + free(dt->data); // XXX is this always ours? + free(dt); } /** * ntfs_dt_rollback */ -int ntfs_dt_rollback (struct ntfs_dt *dt) +int ntfs_dt_rollback(struct ntfs_dt *dt) { int i; @@ -73,16 +75,16 @@ int ntfs_dt_rollback (struct ntfs_dt *dt) if (dt->changed) { // We can't trust anything below us in the tree for (i = 0; i < dt->child_count; i++) { - ntfs_dt_free (dt->sub_nodes[i]); - ntfs_inode_close2 (dt->inodes[i]); + ntfs_dt_free(dt->sub_nodes[i]); + ntfs_inode_close2(dt->inodes[i]); } dt->child_count = 0; - free (dt->data); - free (dt->children); - free (dt->sub_nodes); - free (dt->inodes); + free(dt->data); + free(dt->children); + free(dt->sub_nodes); + free(dt->inodes); dt->data = NULL; dt->children = NULL; @@ -91,8 +93,8 @@ int ntfs_dt_rollback (struct ntfs_dt *dt) } else { // This node is OK, check the su-nodes for (i = 0; i < dt->child_count; i++) { - if (ntfs_dt_rollback (dt->sub_nodes[i])) { - ntfs_inode_close2 (dt->inodes[i]); + if (ntfs_dt_rollback(dt->sub_nodes[i])) { + ntfs_inode_close2(dt->inodes[i]); // Child was changed so unmap it dt->sub_nodes[i] = NULL; dt->inodes[i] = NULL; @@ -106,7 +108,7 @@ int ntfs_dt_rollback (struct ntfs_dt *dt) /** * ntfs_dt_commit */ -int ntfs_dt_commit (struct ntfs_dt *dt) +int ntfs_dt_commit(struct ntfs_dt *dt) { ntfs_volume *vol; ntfs_attr *attr; @@ -125,38 +127,38 @@ int ntfs_dt_commit (struct ntfs_dt *dt) if (dt->changed) { if (dt->parent) { - printf ("commit dt (alloc)\n"); + ntfs_log_debug("commit dt (alloc)\n"); attr = dt->dir->ialloc; size = dt->dir->index_size; - //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); + //utils_dump_mem(dt->data, 0, size, DM_DEFAULTS); #ifdef RM_WRITE ntfs_attr_mst_pwrite(attr, dt->vcn * vol->cluster_size, 1, size, dt->data); // XXX retval #endif } else { - printf ("commit dt (root)\n"); + ntfs_log_debug("commit dt (root)\n"); attr = dt->dir->iroot; size = dt->data_len; - //utils_dump_mem (dt->data, 0, size, DM_DEFAULTS); + //utils_dump_mem(dt->data, 0, size, DM_DEFAULTS); #ifdef RM_WRITE ntfs_attr_pwrite(attr, 0, size, dt->data); // XXX retval #endif } - printf (RED "\tntfs_attr_pwrite (vcn %lld)\n" END, dt->vcn); + ntfs_log_debug(RED "\tntfs_attr_pwrite(vcn %lld)\n" END, dt->vcn); dt->changed = FALSE; } for (i = 0; i < dt->child_count; i++) { - if ((dt->inodes[i]) && (NInoDirty (dt->inodes[i]))) { - //utils_dump_mem (dt->inodes[i]->mrec, 0, vol->mft_record_size, DM_DEFAULTS); + if ((dt->inodes[i]) && (NInoDirty(dt->inodes[i]))) { + //utils_dump_mem(dt->inodes[i]->mrec, 0, vol->mft_record_size, DM_DEFAULTS); #ifdef RM_WRITE - ntfs_inode_sync (dt->inodes[i]); + ntfs_inode_sync(dt->inodes[i]); #endif - printf (RED "\tntfs_inode_sync %llu\n" END, dt->inodes[i]->mft_no); + ntfs_log_debug(RED "\tntfs_inode_sync %llu\n" END, dt->inodes[i]->mft_no); } - if (ntfs_dt_commit (dt->sub_nodes[i]) < 0) + if (ntfs_dt_commit(dt->sub_nodes[i]) < 0) return -1; } @@ -166,7 +168,7 @@ int ntfs_dt_commit (struct ntfs_dt *dt) /** * ntfs_dt_create_children2 */ -BOOL ntfs_dt_create_children2 (struct ntfs_dt *dt, int count) +BOOL ntfs_dt_create_children2(struct ntfs_dt *dt, int count) { // XXX calculate for 2K and 4K indexes max and min filenames (inc/exc VCN) @@ -176,16 +178,16 @@ BOOL ntfs_dt_create_children2 (struct ntfs_dt *dt, int count) if (old == new) return TRUE; - dt->children = realloc (dt->children, new * sizeof (*dt->children)); - dt->sub_nodes = realloc (dt->sub_nodes, new * sizeof (*dt->sub_nodes)); - dt->inodes = realloc (dt->inodes, new * sizeof (*dt->inodes)); + dt->children = realloc(dt->children, new * sizeof(*dt->children)); + dt->sub_nodes = realloc(dt->sub_nodes, new * sizeof(*dt->sub_nodes)); + dt->inodes = realloc(dt->inodes, new * sizeof(*dt->inodes)); if (!dt->children || !dt->sub_nodes || !dt->inodes) return FALSE; // dt->child_count = -1 ? - memset ((u8*)dt->children + old, 0, (new - old) * sizeof (*dt->children)); - memset ((u8*)dt->sub_nodes + old, 0, (new - old) * sizeof (*dt->sub_nodes)); - memset ((u8*)dt->inodes + old, 0, (new - old) * sizeof (*dt->inodes)); + memset((u8*)dt->children + old, 0, (new - old) * sizeof(*dt->children)); + memset((u8*)dt->sub_nodes + old, 0, (new - old) * sizeof(*dt->sub_nodes)); + memset((u8*)dt->inodes + old, 0, (new - old) * sizeof(*dt->inodes)); return TRUE; } @@ -193,12 +195,12 @@ BOOL ntfs_dt_create_children2 (struct ntfs_dt *dt, int count) /** * ntfs_dt_resize_children3 */ -BOOL ntfs_dt_resize_children3 (struct ntfs_dt *dt, int new) +BOOL ntfs_dt_resize_children3(struct ntfs_dt *dt, int new) { int old; // XXX calculate for 2K and 4K indexes max and min filenames (inc/exc VCN) - // XXX assumption: sizeof (*dt->children) == sizeof (*dt->sub_nodes) == sizeof (*dt->inodes) + // XXX assumption: sizeof(*dt->children) == sizeof(*dt->sub_nodes) == sizeof(*dt->inodes) // XXX put back blocking factor if (!dt) @@ -210,20 +212,20 @@ BOOL ntfs_dt_resize_children3 (struct ntfs_dt *dt, int new) dt->child_count = new; - old *= sizeof (*dt->children); - new *= sizeof (*dt->children); + old *= sizeof(*dt->children); + new *= sizeof(*dt->children); - dt->children = realloc (dt->children, new); - dt->sub_nodes = realloc (dt->sub_nodes, new); - dt->inodes = realloc (dt->inodes, new); + dt->children = realloc(dt->children, new); + dt->sub_nodes = realloc(dt->sub_nodes, new); + dt->inodes = realloc(dt->inodes, new); if (!dt->children || !dt->sub_nodes || !dt->inodes) return FALSE; if (new > old) { - memset ((u8*)dt->children + old, 0, (new - old)); - memset ((u8*)dt->sub_nodes + old, 0, (new - old)); - memset ((u8*)dt->inodes + old, 0, (new - old)); + memset((u8*)dt->children + old, 0, (new - old)); + memset((u8*)dt->sub_nodes + old, 0, (new - old)); + memset((u8*)dt->inodes + old, 0, (new - old)); } return TRUE; @@ -232,7 +234,7 @@ BOOL ntfs_dt_resize_children3 (struct ntfs_dt *dt, int new) /** * ntfs_dt_root_count */ -int ntfs_dt_root_count (struct ntfs_dt *dt) +int ntfs_dt_root_count(struct ntfs_dt *dt) { u8 *buffer = NULL; u8 *ptr = NULL; @@ -264,27 +266,27 @@ int ntfs_dt_root_count (struct ntfs_dt *dt) while (ptr < (buffer + size)) { entry = (INDEX_ENTRY*) ptr; - ntfs_dt_resize_children3 (dt, dt->child_count + 1); // XXX retval + ntfs_dt_resize_children3(dt, dt->child_count + 1); // XXX retval if (entry->flags & INDEX_ENTRY_NODE) { - vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); - //printf ("VCN %lld\n", vcn); + vcn = ntfs_ie_get_vcn((INDEX_ENTRY*) ptr); + //ntfs_log_debug("VCN %lld\n", vcn); } if (!(entry->flags & INDEX_ENTRY_END)) { - ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0); - //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); - free (name); + ntfs_ucstombs(entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0); + //ntfs_log_debug("\tinode %8lld %s\n", MREF(entry->indexed_file), name); + free(name); name = NULL; } - //printf ("CC[%d] = %p\n", dt->child_count-1, entry); + //ntfs_log_debug("CC[%d] = %p\n", dt->child_count-1, entry); dt->children[dt->child_count-1] = entry; ptr += entry->length; } - //printf ("count = %d\n\n", dt->child_count); + //ntfs_log_debug("count = %d\n\n", dt->child_count); return dt->child_count; } @@ -292,7 +294,7 @@ int ntfs_dt_root_count (struct ntfs_dt *dt) /** * ntfs_dt_alloc_count */ -int ntfs_dt_alloc_count (struct ntfs_dt *dt) +int ntfs_dt_alloc_count(struct ntfs_dt *dt) { u8 *buffer = NULL; u8 *ptr = NULL; @@ -309,24 +311,24 @@ int ntfs_dt_alloc_count (struct ntfs_dt *dt) buffer = dt->data; size = dt->data_len; - //utils_dump_mem (buffer, 0, 128, DM_DEFAULTS); + //utils_dump_mem(buffer, 0, 128, DM_DEFAULTS); block = (INDEX_BLOCK*) buffer; - //printf ("INDX %lld\n", block->index_block_vcn); + //ntfs_log_debug("INDX %lld\n", block->index_block_vcn); ptr = buffer + 0x18 + block->index.entries_offset; - //printf ("block size %d\n", block->index.index_length); + //ntfs_log_debug("block size %d\n", block->index.index_length); dt->child_count = 0; - //printf ("start = 0x%02X, end = 0x%02X\n", 0x18 + block->index.entries_offset, 0x18 + block->index.index_length); + //ntfs_log_debug("start = 0x%02X, end = 0x%02X\n", 0x18 + block->index.entries_offset, 0x18 + block->index.index_length); while (ptr < (buffer + 0x18 + block->index.index_length)) { entry = (INDEX_ENTRY*) ptr; - ntfs_dt_resize_children3 (dt, dt->child_count + 1); // XXX retval + ntfs_dt_resize_children3(dt, dt->child_count + 1); // XXX retval if (entry->flags & INDEX_ENTRY_NODE) { - vcn = ntfs_ie_get_vcn ((INDEX_ENTRY*) ptr); - //printf ("\tVCN %lld\n", vcn); + vcn = ntfs_ie_get_vcn((INDEX_ENTRY*) ptr); + //ntfs_log_debug("\tVCN %lld\n", vcn); } dt->children[dt->child_count-1] = entry; @@ -334,15 +336,15 @@ int ntfs_dt_alloc_count (struct ntfs_dt *dt) if (entry->flags & INDEX_ENTRY_END) { break; } else { - ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0); - //printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name); - free (name); + ntfs_ucstombs(entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0); + //ntfs_log_debug("\tinode %8lld %s\n", MREF(entry->indexed_file), name); + free(name); name = NULL; } ptr += entry->length; } - //printf ("count = %d\n", dt->child_count); + //ntfs_log_debug("count = %d\n", dt->child_count); return dt->child_count; } @@ -350,7 +352,7 @@ int ntfs_dt_alloc_count (struct ntfs_dt *dt) /** * ntfs_dt_initialise2 */ -int ntfs_dt_initialise2 (ntfs_volume *vol, struct ntfs_dt *dt) +int ntfs_dt_initialise2(ntfs_volume *vol, struct ntfs_dt *dt) { INDEX_ALLOCATION *alloc; INDEX_ENTRY *entry; @@ -360,7 +362,7 @@ int ntfs_dt_initialise2 (ntfs_volume *vol, struct ntfs_dt *dt) if (!dt) return 1; - memset (dt->data, 0, dt->data_len); + memset(dt->data, 0, dt->data_len); alloc = (INDEX_ALLOCATION*) dt->data; @@ -382,7 +384,7 @@ int ntfs_dt_initialise2 (ntfs_volume *vol, struct ntfs_dt *dt) entry->key_length = 0; entry->flags = INDEX_ENTRY_END; - ntfs_dt_resize_children3 (dt, 1); // XXX retval + ntfs_dt_resize_children3(dt, 1); // XXX retval dt->children[0] = entry; @@ -392,7 +394,7 @@ int ntfs_dt_initialise2 (ntfs_volume *vol, struct ntfs_dt *dt) /** * ntfs_dt_create */ -struct ntfs_dt * ntfs_dt_create (struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn) +struct ntfs_dt * ntfs_dt_create(struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn) { struct ntfs_dt *dt = NULL; //int i; @@ -400,7 +402,7 @@ struct ntfs_dt * ntfs_dt_create (struct ntfs_dir *dir, struct ntfs_dt *parent, V if (!dir) return NULL; - dt = calloc (1, sizeof (*dt)); + dt = calloc(1, sizeof(*dt)); if (!dt) return NULL; @@ -414,76 +416,76 @@ struct ntfs_dt * ntfs_dt_create (struct ntfs_dir *dir, struct ntfs_dt *parent, V dt->changed = FALSE; if (parent) { - //printf ("alloc a = %lld\n", dir->ialloc->allocated_size); - //printf ("alloc d = %lld\n", dir->ialloc->data_size); - //printf ("alloc i = %lld\n", dir->ialloc->initialized_size); - //printf ("vcn = %lld\n", vcn); + //ntfs_log_debug("alloc a = %lld\n", dir->ialloc->allocated_size); + //ntfs_log_debug("alloc d = %lld\n", dir->ialloc->data_size); + //ntfs_log_debug("alloc i = %lld\n", dir->ialloc->initialized_size); + //ntfs_log_debug("vcn = %lld\n", vcn); dt->data_len = dt->dir->index_size; - //printf ("parent size = %d\n", dt->data_len); - dt->data = malloc (dt->data_len); + //ntfs_log_debug("parent size = %d\n", dt->data_len); + dt->data = malloc(dt->data_len); if (vcn >= 0) { - //printf ("%lld\n", ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data)); - ntfs_attr_mst_pread (dir->ialloc, vcn*512, 1, dt->data_len, dt->data); + //ntfs_log_debug("%lld\n", ntfs_attr_mst_pread(dir->ialloc, vcn*512, 1, dt->data_len, dt->data)); + ntfs_attr_mst_pread(dir->ialloc, vcn*512, 1, dt->data_len, dt->data); } else { - ntfs_dt_initialise2 (dir->vol, dt); + ntfs_dt_initialise2(dir->vol, dt); } - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - //printf ("\n"); + //utils_dump_mem(dt->data, 0, dt->data_len, DM_DEFAULTS); + //ntfs_log_debug("\n"); - ntfs_dt_alloc_count (dt); + ntfs_dt_alloc_count(dt); dt->header = &((INDEX_BLOCK*)dt->data)->index; - //printf ("USA = %d\n", ((INDEX_BLOCK*)dt->data)->usa_count); + //ntfs_log_debug("USA = %d\n", ((INDEX_BLOCK*)dt->data)->usa_count); #if 0 for (i = 0; i < dt->child_count; i++) { INDEX_ENTRY *ie = dt->children[i]; - printf ("%d\n", ((u8*)ie) - dt->data); + ntfs_log_debug("%d\n", ((u8*)ie) - dt->data); if (ie->flags & INDEX_ENTRY_END) - printf ("IE (%d)\n", ie->length); + ntfs_log_debug("IE (%d)\n", ie->length); else - printf ("IE %lld (%d)\n", MREF (ie->key.file_name.parent_directory), ie->length); - utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); - printf ("\n"); + ntfs_log_debug("IE %lld (%d)\n", MREF(ie->key.file_name.parent_directory), ie->length); + utils_dump_mem(ie, 0, ie->length, DM_DEFAULTS); + ntfs_log_debug("\n"); } #endif } else { - //printf ("root a = %lld\n", dir->iroot->allocated_size); - //printf ("root d = %lld\n", dir->iroot->data_size); - //printf ("root i = %lld\n", dir->iroot->initialized_size); + //ntfs_log_debug("root a = %lld\n", dir->iroot->allocated_size); + //ntfs_log_debug("root d = %lld\n", dir->iroot->data_size); + //ntfs_log_debug("root i = %lld\n", dir->iroot->initialized_size); dt->data_len = dir->iroot->allocated_size; - dt->data = malloc (dt->data_len); - //printf ("%lld\n", ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data)); - ntfs_attr_pread (dir->iroot, 0, dt->data_len, dt->data); - //utils_dump_mem (dt->data, 0, dt->data_len, DM_DEFAULTS); - //printf ("\n"); + dt->data = malloc(dt->data_len); + //ntfs_log_debug("%lld\n", ntfs_attr_pread(dir->iroot, 0, dt->data_len, dt->data)); + ntfs_attr_pread(dir->iroot, 0, dt->data_len, dt->data); + //utils_dump_mem(dt->data, 0, dt->data_len, DM_DEFAULTS); + //ntfs_log_debug("\n"); - ntfs_dt_root_count (dt); + ntfs_dt_root_count(dt); dt->header = &((INDEX_ROOT*)dt->data)->index; //dt->data_len = ((INDEX_ROOT*)dt->data)->index_block_size; - //printf ("IBS = %d\n", ((INDEX_ROOT*)dt->data)->index_block_size); + //ntfs_log_debug("IBS = %d\n", ((INDEX_ROOT*)dt->data)->index_block_size); #if 0 for (i = 0; i < dt->child_count; i++) { INDEX_ENTRY *ie = dt->children[i]; - printf ("%d\n", ((u8*)ie) - dt->data); + ntfs_log_debug("%d\n", ((u8*)ie) - dt->data); if (ie->flags & INDEX_ENTRY_END) - printf ("IE (%d)\n", ie->length); + ntfs_log_debug("IE (%d)\n", ie->length); else - printf ("IE %lld (%d)\n", MREF (ie->key.file_name.parent_directory), ie->length); - utils_dump_mem (ie, 0, ie->length, DM_DEFAULTS); - printf ("\n"); + ntfs_log_debug("IE %lld (%d)\n", MREF(ie->key.file_name.parent_directory), ie->length); + utils_dump_mem(ie, 0, ie->length, DM_DEFAULTS); + ntfs_log_debug("\n"); } #endif } - //printf ("index_header (%d,%d)\n", dt->header.index_length, dt->header.allocated_size); + //ntfs_log_debug("index_header (%d,%d)\n", dt->header.index_length, dt->header.allocated_size); return dt; } @@ -493,7 +495,7 @@ struct ntfs_dt * ntfs_dt_create (struct ntfs_dir *dir, struct ntfs_dt *parent, V * find dt by name, return MFT_REF * maps dt's as necessary */ -MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) +MFT_REF ntfs_dt_find(struct ntfs_dt *dt, ntfschar *name, int name_len) { MFT_REF res = -1; INDEX_ENTRY *ie; @@ -516,15 +518,15 @@ MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) * end marker yes map & recurse */ - //printf ("child_count = %d\n", dt->child_count); + //ntfs_log_debug("child_count = %d\n", dt->child_count); for (i = 0; i < dt->child_count; i++) { ie = dt->children[i]; if (ie->flags & INDEX_ENTRY_END) { r = -1; } else { - //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); - r = ntfs_names_collate (name, name_len, + //ntfs_log_debug("\t"); ntfs_name_print(ie->key.file_name.file_name, ie->key.file_name.file_name_length); ntfs_log_debug("\n"); + r = ntfs_names_collate(name, name_len, ie->key.file_name.file_name, ie->key.file_name.file_name_length, 2, IGNORE_CASE, @@ -532,30 +534,30 @@ MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) dt->dir->vol->upcase_len); } - //printf ("%d, %d\n", i, r); + //ntfs_log_debug("%d, %d\n", i, r); if (r == 1) { - //printf ("keep searching\n"); + //ntfs_log_debug("keep searching\n"); continue; } else if (r == 0) { - res = MREF (ie->indexed_file); - //printf ("match %lld\n", res); + res = MREF(ie->indexed_file); + //ntfs_log_debug("match %lld\n", res); } else if (r == -1) { if (ie->flags & INDEX_ENTRY_NODE) { - //printf ("map & recurse\n"); - //printf ("sub %p\n", dt->sub_nodes); + //ntfs_log_debug("map & recurse\n"); + //ntfs_log_debug("sub %p\n", dt->sub_nodes); if (!dt->sub_nodes[i]) { - vcn = ntfs_ie_get_vcn (ie); - //printf ("vcn = %lld\n", vcn); - sub = ntfs_dt_create (dt->dir, dt, vcn); + vcn = ntfs_ie_get_vcn(ie); + //ntfs_log_debug("vcn = %lld\n", vcn); + sub = ntfs_dt_create(dt->dir, dt, vcn); dt->sub_nodes[i] = sub; } - res = ntfs_dt_find (dt->sub_nodes[i], name, name_len); + res = ntfs_dt_find(dt->sub_nodes[i], name, name_len); } else { - //printf ("ENOENT\n"); + //ntfs_log_debug("ENOENT\n"); } } else { - printf ("error collating name\n"); + ntfs_log_debug("error collating name\n"); } break; } @@ -568,7 +570,7 @@ MFT_REF ntfs_dt_find (struct ntfs_dt *dt, ntfschar *name, int name_len) * find dt by name, returns dt and index * maps dt's as necessary */ -struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) +struct ntfs_dt * ntfs_dt_find2(struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) { struct ntfs_dt *res = NULL; INDEX_ENTRY *ie; @@ -592,15 +594,15 @@ struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int name_len * end marker yes map & recurse */ - //printf ("child_count = %d\n", dt->child_count); + //ntfs_log_debug("child_count = %d\n", dt->child_count); for (i = 0; i < dt->child_count; i++) { ie = dt->children[i]; if (ie->flags & INDEX_ENTRY_END) { r = -1; } else { - //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); - r = ntfs_names_collate (name, name_len, + //ntfs_log_debug("\t"); ntfs_name_print(ie->key.file_name.file_name, ie->key.file_name.file_name_length); ntfs_log_debug("\n"); + r = ntfs_names_collate(name, name_len, ie->key.file_name.file_name, ie->key.file_name.file_name_length, 2, IGNORE_CASE, @@ -608,26 +610,26 @@ struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int name_len dt->dir->vol->upcase_len); } - //printf ("%d, %d\n", i, r); + //ntfs_log_debug("%d, %d\n", i, r); if (r == 1) { - //printf ("keep searching\n"); + //ntfs_log_debug("keep searching\n"); continue; } else if (r == 0) { res = dt; - //printf ("match %p\n", res); + //ntfs_log_debug("match %p\n", res); if (index_num) *index_num = i; } else if ((r == -1) && (ie->flags & INDEX_ENTRY_NODE)) { - //printf ("recurse\n"); + //ntfs_log_debug("recurse\n"); if (!dt->sub_nodes[i]) { - vcn = ntfs_ie_get_vcn (ie); - //printf ("vcn = %lld\n", vcn); - dt->sub_nodes[i] = ntfs_dt_create (dt->dir, dt, vcn); + vcn = ntfs_ie_get_vcn(ie); + //ntfs_log_debug("vcn = %lld\n", vcn); + dt->sub_nodes[i] = ntfs_dt_create(dt->dir, dt, vcn); } - res = ntfs_dt_find2 (dt->sub_nodes[i], name, name_len, index_num); + res = ntfs_dt_find2(dt->sub_nodes[i], name, name_len, index_num); } else { - printf ("error collating name\n"); + ntfs_log_debug("error collating name\n"); } break; } @@ -640,7 +642,7 @@ struct ntfs_dt * ntfs_dt_find2 (struct ntfs_dt *dt, ntfschar *name, int name_len * find dt by name, returns dt and index * does not map new dt's */ -struct ntfs_dt * ntfs_dt_find3 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) +struct ntfs_dt * ntfs_dt_find3(struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) { struct ntfs_dt *res = NULL; INDEX_ENTRY *ie; @@ -650,15 +652,15 @@ struct ntfs_dt * ntfs_dt_find3 (struct ntfs_dt *dt, ntfschar *name, int name_len if (!dt || !name) return NULL; - //printf ("child_count = %d\n", dt->child_count); + //ntfs_log_debug("child_count = %d\n", dt->child_count); for (i = 0; i < dt->child_count; i++) { ie = dt->children[i]; if (ie->flags & INDEX_ENTRY_END) { r = -1; } else { - //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); - r = ntfs_names_collate (name, name_len, + //ntfs_log_debug("\t"); ntfs_name_print(ie->key.file_name.file_name, ie->key.file_name.file_name_length); ntfs_log_debug("\n"); + r = ntfs_names_collate(name, name_len, ie->key.file_name.file_name, ie->key.file_name.file_name_length, 2, IGNORE_CASE, @@ -666,28 +668,28 @@ struct ntfs_dt * ntfs_dt_find3 (struct ntfs_dt *dt, ntfschar *name, int name_len dt->dir->vol->upcase_len); } - //printf ("%d, %d\n", i, r); + //ntfs_log_debug("%d, %d\n", i, r); if (r == 1) { - //printf ("keep searching\n"); + //ntfs_log_debug("keep searching\n"); continue; } else if (r == 0) { res = dt; - //printf ("match %p\n", res); + //ntfs_log_debug("match %p\n", res); if (index_num) *index_num = i; } else if (r == -1) { if (ie->flags & INDEX_ENTRY_NODE) { - //printf ("recurse\n"); - res = ntfs_dt_find3 (dt->sub_nodes[i], name, name_len, index_num); + //ntfs_log_debug("recurse\n"); + res = ntfs_dt_find3(dt->sub_nodes[i], name, name_len, index_num); } else { - //printf ("no match\n"); + //ntfs_log_debug("no match\n"); res = dt; if (index_num) *index_num = i; } } else { - printf ("error collating name\n"); + ntfs_log_debug("error collating name\n"); } break; } @@ -700,7 +702,7 @@ struct ntfs_dt * ntfs_dt_find3 (struct ntfs_dt *dt, ntfschar *name, int name_len * find successor to specified name, returns dt and index * maps dt's as necessary */ -struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) +struct ntfs_dt * ntfs_dt_find4(struct ntfs_dt *dt, ntfschar *name, int name_len, int *index_num) { struct ntfs_dt *res = NULL; struct ntfs_dt *sub = NULL; @@ -712,16 +714,16 @@ struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int name_len if (!dt || !name) return NULL; - //printf ("child_count = %d\n", dt->child_count); + //ntfs_log_debug("child_count = %d\n", dt->child_count); for (i = 0; i < dt->child_count; i++) { ie = dt->children[i]; - //printf ("ie->flags = %d\n", ie->flags); + //ntfs_log_debug("ie->flags = %d\n", ie->flags); if (ie->flags & INDEX_ENTRY_END) { r = -1; } else { - //printf ("\t"); ntfs_name_print (ie->key.file_name.file_name, ie->key.file_name.file_name_length); printf ("\n"); - r = ntfs_names_collate (name, name_len, + //ntfs_log_debug("\t"); ntfs_name_print(ie->key.file_name.file_name, ie->key.file_name.file_name_length); ntfs_log_debug("\n"); + r = ntfs_names_collate(name, name_len, ie->key.file_name.file_name, ie->key.file_name.file_name_length, 2, IGNORE_CASE, @@ -729,33 +731,33 @@ struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int name_len dt->dir->vol->upcase_len); } - //printf ("%d, %d\n", i, r); + //ntfs_log_debug("%d, %d\n", i, r); if (r == 1) { - //printf ("keep searching\n"); + //ntfs_log_debug("keep searching\n"); } else if (r == 0) { //res = dt; - //printf ("match\n"); + //ntfs_log_debug("match\n"); // ignore } else if (r == -1) { if (ie->flags & INDEX_ENTRY_NODE) { - //printf ("recurse\n"); + //ntfs_log_debug("recurse\n"); if (!dt->sub_nodes[i]) { - vcn = ntfs_ie_get_vcn (ie); - //printf ("vcn = %lld\n", vcn); - sub = ntfs_dt_create (dt->dir, dt, vcn); + vcn = ntfs_ie_get_vcn(ie); + //ntfs_log_debug("vcn = %lld\n", vcn); + sub = ntfs_dt_create(dt->dir, dt, vcn); dt->sub_nodes[i] = sub; } - res = ntfs_dt_find4 (dt->sub_nodes[i], name, name_len, index_num); + res = ntfs_dt_find4(dt->sub_nodes[i], name, name_len, index_num); } else { - //printf ("no match\n"); + //ntfs_log_debug("no match\n"); res = dt; if (index_num) *index_num = i; } break; } else { - printf ("error collating name\n"); + ntfs_log_debug("error collating name\n"); } //break; } @@ -767,7 +769,7 @@ struct ntfs_dt * ntfs_dt_find4 (struct ntfs_dt *dt, ntfschar *name, int name_len * ntfs_dt_find_all * maps all dt's into memory */ -void ntfs_dt_find_all (struct ntfs_dt *dt) +void ntfs_dt_find_all(struct ntfs_dt *dt) { INDEX_ENTRY *ie; VCN vcn; @@ -781,10 +783,10 @@ void ntfs_dt_find_all (struct ntfs_dt *dt) if (ie->flags & INDEX_ENTRY_NODE) { if (!dt->sub_nodes[i]) { - vcn = ntfs_ie_get_vcn (ie); - dt->sub_nodes[i] = ntfs_dt_create (dt->dir, dt, vcn); + vcn = ntfs_ie_get_vcn(ie); + dt->sub_nodes[i] = ntfs_dt_create(dt->dir, dt, vcn); } - ntfs_dt_find_all (dt->sub_nodes[i]); + ntfs_dt_find_all(dt->sub_nodes[i]); } } } @@ -792,7 +794,7 @@ void ntfs_dt_find_all (struct ntfs_dt *dt) /** * ntfs_dt_find_parent */ -int ntfs_dt_find_parent (struct ntfs_dt *dt) +int ntfs_dt_find_parent(struct ntfs_dt *dt) { int i; struct ntfs_dt *parent; @@ -814,7 +816,7 @@ int ntfs_dt_find_parent (struct ntfs_dt *dt) /** * ntfs_dt_isroot */ -BOOL ntfs_dt_isroot (struct ntfs_dt *dt) +BOOL ntfs_dt_isroot(struct ntfs_dt *dt) { if (!dt) return FALSE; @@ -824,7 +826,7 @@ BOOL ntfs_dt_isroot (struct ntfs_dt *dt) /** * ntfs_dt_root_freespace */ -int ntfs_dt_root_freespace (struct ntfs_dt *dt) +int ntfs_dt_root_freespace(struct ntfs_dt *dt) { int recsize; int inuse; @@ -844,7 +846,7 @@ int ntfs_dt_root_freespace (struct ntfs_dt *dt) /** * ntfs_dt_alloc_freespace */ -int ntfs_dt_alloc_freespace (struct ntfs_dt *dt) +int ntfs_dt_alloc_freespace(struct ntfs_dt *dt) { int recsize; int inuse; @@ -864,7 +866,7 @@ int ntfs_dt_alloc_freespace (struct ntfs_dt *dt) /** * ntfs_dt_transfer */ -int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start, int count) +int ntfs_dt_transfer(struct ntfs_dt *old, struct ntfs_dt *new, int start, int count) { int i; int need; @@ -884,26 +886,26 @@ int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start, int c if ((start < 0) || ((start+count) >= old->child_count)) return -1; - printf ("\n"); - printf (BOLD YELLOW "Transferring children\n" END); + ntfs_log_debug("\n"); + ntfs_log_debug(BOLD YELLOW "Transferring children\n" END); need = 0; for (i = start; i < (start+count+1); i++) { mov_ie = old->children[i]; need += mov_ie->length; - //file = &mov_ie->key.file_name; printf ("\ttrn name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + //file = &mov_ie->key.file_name; ntfs_log_debug("\ttrn name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_debug("\n"); } - if (ntfs_dt_isroot (new)) - space = ntfs_dt_root_freespace (new); + if (ntfs_dt_isroot(new)) + space = ntfs_dt_root_freespace(new); else - space = ntfs_dt_alloc_freespace (new); + space = ntfs_dt_alloc_freespace(new); // XXX if this is an index root, it'll go badly wrong // restrict to allocs only? - printf ("\tneed = %d\n", need); - printf ("\tspace = %d\n", space); + ntfs_log_debug("\tneed = %d\n", need); + ntfs_log_debug("\tspace = %d\n", space); if (space < need) return -1; @@ -920,7 +922,7 @@ int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start, int c n2 = old->children[start]->key.file_name.file_name; l2 = old->children[start]->key.file_name.file_name_length; - i = ntfs_names_collate (n1, l1, n2, l2, + i = ntfs_names_collate(n1, l1, n2, l2, 2, IGNORE_CASE, old->dir->vol->upcase, old->dir->vol->upcase_len); @@ -939,44 +941,44 @@ int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start, int c dst = src + need; len = (u8*) new->children[new->child_count-1] + new->children[new->child_count-1]->length - src; - //printf ("src = %d, dst = %d, len = %d\n", src - new->data, dst - new->data, len); - memmove (dst, src, len); + //ntfs_log_debug("src = %d, dst = %d, len = %d\n", src - new->data, dst - new->data, len); + memmove(dst, src, len); dst = src; src = (u8*) old->children[start]; len = need; - memcpy (dst, src, len); + memcpy(dst, src, len); src = (u8*) old->children[start+count-1]; dst = (u8*) old->children[start]; len = (u8*) old->children[old->child_count-1] + old->children[old->child_count-1]->length - src; - //printf ("src = %d, dst = %d, len = %d\n", src - old->data, dst - old->data, len); - memmove (dst, src, len); + //ntfs_log_debug("src = %d, dst = %d, len = %d\n", src - old->data, dst - old->data, len); + memmove(dst, src, len); dst += len; len = old->data + old->dir->index_size - dst; - //printf ("dst = %d, len = %d\n", dst - old->data, len); - memset (dst, 0, len); + //ntfs_log_debug("dst = %d, len = %d\n", dst - old->data, len); + memset(dst, 0, len); - if (!ntfs_dt_resize_children3 (new, new->child_count + count)) + if (!ntfs_dt_resize_children3(new, new->child_count + count)) return -1; src = (u8*) &old->sub_nodes[start+count-1]; dst = (u8*) &old->sub_nodes[start]; - len = (old->child_count - start - count + 1) * sizeof (struct ntfs_dt*); + len = (old->child_count - start - count + 1) * sizeof(struct ntfs_dt*); - memmove (dst, src, len); + memmove(dst, src, len); src = (u8*) &new->sub_nodes[insert]; dst = (u8*) &new->sub_nodes[insert+count-1]; - len = (new->child_count - insert - count + 1) * sizeof (struct ntfs_dt*); + len = (new->child_count - insert - count + 1) * sizeof(struct ntfs_dt*); - memmove (dst, src, len); + memmove(dst, src, len); - if (!ntfs_dt_resize_children3 (old, old->child_count - count)) + if (!ntfs_dt_resize_children3(old, old->child_count - count)) return -1; src = (u8*) new->children[0]; @@ -1004,8 +1006,8 @@ int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start, int c old->changed = TRUE; new->changed = TRUE; - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); + ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); + ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); return 0; } @@ -1013,7 +1015,7 @@ int ntfs_dt_transfer (struct ntfs_dt *old, struct ntfs_dt *new, int start, int c /** * ntfs_dt_alloc_insert */ -int ntfs_dt_alloc_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count) +int ntfs_dt_alloc_insert(struct ntfs_dt *dt, INDEX_ENTRY *first, int count) { // XXX don't bother measuring, just subtract the children pointers @@ -1037,46 +1039,46 @@ int ntfs_dt_alloc_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count) ie = (INDEX_ENTRY*) ((u8*)ie + ie->length); } - printf ("alloc insert %d bytes\n", need); + ntfs_log_debug("alloc insert %d bytes\n", need); alloc = (INDEX_ALLOCATION*) dt->data; - printf ("entries_offset = %d\n", alloc->index.entries_offset); - printf ("index_length = %d\n", alloc->index.index_length); - printf ("allocated_size = %d\n", alloc->index.allocated_size); + ntfs_log_debug("entries_offset = %d\n", alloc->index.entries_offset); + ntfs_log_debug("index_length = %d\n", alloc->index.index_length); + ntfs_log_debug("allocated_size = %d\n", alloc->index.allocated_size); - printf ("insert has %d children\n", dt->child_count); - printf ("children = %p\n", dt->children); - //utils_dump_mem (dt->data, 0, 128, DM_DEFAULTS); + ntfs_log_debug("insert has %d children\n", dt->child_count); + ntfs_log_debug("children = %p\n", dt->children); + //utils_dump_mem(dt->data, 0, 128, DM_DEFAULTS); ie = dt->children[dt->child_count-1]; - printf ("last child = %p (%ld)\n", ie, (long)ie - (long)dt->data); - printf ("size = %d\n", ie->length); + ntfs_log_debug("last child = %p (%ld)\n", ie, (long)ie - (long)dt->data); + ntfs_log_debug("size = %d\n", ie->length); src = (u8*) ie; dst = src + need; len = ie->length; - memmove (dst, src, len); + memmove(dst, src, len); src = (u8*) first; dst = (u8*) ie; len = need; - memcpy (dst, src, len); + memcpy(dst, src, len); // use create children // measure need and update children list // adjust headers - //utils_dump_mem (dt->data, 0, 256, DM_DEFAULTS); + //utils_dump_mem(dt->data, 0, 256, DM_DEFAULTS); return 0; } /** * ntfs_dt_alloc_insert2 */ -INDEX_ENTRY * ntfs_dt_alloc_insert2 (struct ntfs_dt *dt, int before, int count, int bytes) +INDEX_ENTRY * ntfs_dt_alloc_insert2(struct ntfs_dt *dt, int before, int count, int bytes) { int space; u8 *src; @@ -1095,7 +1097,7 @@ INDEX_ENTRY * ntfs_dt_alloc_insert2 (struct ntfs_dt *dt, int before, int count, return NULL; // check alloc has enough space - space = ntfs_dt_alloc_freespace (dt); + space = ntfs_dt_alloc_freespace(dt); if (bytes > space) return NULL; @@ -1104,37 +1106,37 @@ INDEX_ENTRY * ntfs_dt_alloc_insert2 (struct ntfs_dt *dt, int before, int count, dst = src + bytes; len = dt->header->index_length - ((int)dt->children[before] - (int)dt->data) + 24; - //printf ("%d, %d, %d\n", (int)src - (int)dt->data, (int)dst - (int)dt->data, len); + //ntfs_log_debug("%d, %d, %d\n", (int)src - (int)dt->data, (int)dst - (int)dt->data, len); - memmove (dst, src, len); - memset (dst, 0, bytes); + memmove(dst, src, len); + memset(dst, 0, bytes); // resize arrays - ntfs_dt_resize_children3 (dt, dt->child_count + count); + ntfs_dt_resize_children3(dt, dt->child_count + count); // move keys (children) src = (u8*) (dt->children + before); - dst = src + (count * sizeof (u8*)); - len = (dt->child_count - count - before) * sizeof (u8*); + dst = src + (count * sizeof(u8*)); + len = (dt->child_count - count - before) * sizeof(u8*); - memmove (dst, src, len); - memset (src, 0, count * sizeof (u8*)); + memmove(dst, src, len); + memset(src, 0, count * sizeof(u8*)); // move keys (inodes) src = (u8*) (dt->inodes + before); - dst = src + (count * sizeof (u8*)); - len = (dt->child_count - count - before) * sizeof (u8*); + dst = src + (count * sizeof(u8*)); + len = (dt->child_count - count - before) * sizeof(u8*); - memmove (dst, src, len); - memset (src, 0, count * sizeof (u8*)); + memmove(dst, src, len); + memset(src, 0, count * sizeof(u8*)); // move keys (sub_nodes) src = (u8*) (dt->sub_nodes + before); - dst = src + (count * sizeof (u8*)); - len = (dt->child_count - count - before) * sizeof (u8*); + dst = src + (count * sizeof(u8*)); + len = (dt->child_count - count - before) * sizeof(u8*); - memmove (dst, src, len); - memset (src, 0, count * sizeof (u8*)); + memmove(dst, src, len); + memset(src, 0, count * sizeof(u8*)); return NULL; } @@ -1142,7 +1144,7 @@ INDEX_ENTRY * ntfs_dt_alloc_insert2 (struct ntfs_dt *dt, int before, int count, /** * ntfs_dt_root_insert */ -int ntfs_dt_root_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count) +int ntfs_dt_root_insert(struct ntfs_dt *dt, INDEX_ENTRY *first, int count) { if (!dt) return 1; @@ -1155,7 +1157,7 @@ int ntfs_dt_root_insert (struct ntfs_dt *dt, INDEX_ENTRY *first, int count) /** * ntfs_dt_alloc_remove2 */ -int ntfs_dt_alloc_remove2 (struct ntfs_dt *dt, int start, int count) +int ntfs_dt_alloc_remove2(struct ntfs_dt *dt, int start, int count) { int i; int size; @@ -1174,7 +1176,7 @@ int ntfs_dt_alloc_remove2 (struct ntfs_dt *dt, int start, int count) /** * ntfs_dt_root_remove2 */ -int ntfs_dt_root_remove2 (struct ntfs_dt *dt, int start, int count) +int ntfs_dt_root_remove2(struct ntfs_dt *dt, int start, int count) { int i; int size; @@ -1186,18 +1188,18 @@ int ntfs_dt_root_remove2 (struct ntfs_dt *dt, int start, int count) if ((count < 1) || ((start + count - 1) >= dt->child_count)) return -1; - printf ("s c/t %d %d/%d\n", start, count, dt->child_count); + ntfs_log_debug("s c/t %d %d/%d\n", start, count, dt->child_count); size = 0; for (i = start; i < (start + count); i++) size += dt->children[i]->length; - printf ("size1 = %d\n", size); + ntfs_log_debug("size1 = %d\n", size); size = (int) dt->children[start+count] - (int) dt->children[start]; - printf ("size2 = %d\n", size); + ntfs_log_debug("size2 = %d\n", size); size = (int) dt->children[start+count-1] - (int) dt->children[start] + dt->children[start+count-1]->length; - printf ("size3 = %d\n", size); + ntfs_log_debug("size3 = %d\n", size); // XXX what shall we do with the inodes? // transfer them to the dir (commit them for now) @@ -1206,16 +1208,16 @@ int ntfs_dt_root_remove2 (struct ntfs_dt *dt, int start, int count) // rearrange arrays // shrink attribute - ntfs_dt_resize_children3 (dt, dt->child_count - count); + ntfs_dt_resize_children3(dt, dt->child_count - count); - printf ("ntfs_dt_root_remove2\n"); + ntfs_log_debug("ntfs_dt_root_remove2\n"); return dt->child_count; } /** * ntfs_dt_transfer2 */ -int ntfs_dt_transfer2 (struct ntfs_dt *old, struct ntfs_dt *new, int start, int count) +int ntfs_dt_transfer2(struct ntfs_dt *old, struct ntfs_dt *new, int start, int count) { int i; int need; @@ -1236,39 +1238,39 @@ int ntfs_dt_transfer2 (struct ntfs_dt *old, struct ntfs_dt *new, int start, int if ((start + count) >= old->child_count) return -1; - printf ("\n"); - printf (BOLD YELLOW "Transferring children\n" END); + ntfs_log_debug("\n"); + ntfs_log_debug(BOLD YELLOW "Transferring children\n" END); need = 0; for (i = start; i < (start+count); i++) { mov_ie = old->children[i]; need += mov_ie->length; - //file = &mov_ie->key.file_name; printf ("\ttrn name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + //file = &mov_ie->key.file_name; ntfs_log_debug("\ttrn name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_debug("\n"); } - if (ntfs_dt_isroot (new)) - space = ntfs_dt_root_freespace (new); + if (ntfs_dt_isroot(new)) + space = ntfs_dt_root_freespace(new); else - space = ntfs_dt_alloc_freespace (new); + space = ntfs_dt_alloc_freespace(new); - printf ("\tneed = %d\n", need); - printf ("\tspace = %d\n", space); + ntfs_log_debug("\tneed = %d\n", need); + ntfs_log_debug("\tspace = %d\n", space); if (need > space) return -1; - if (ntfs_dt_isroot (new)) - ntfs_dt_root_insert (new, old->children[0], count); + if (ntfs_dt_isroot(new)) + ntfs_dt_root_insert(new, old->children[0], count); else - ntfs_dt_alloc_insert2 (new, 0, count, need); + ntfs_dt_alloc_insert2(new, 0, count, need); - if (ntfs_dt_isroot (old)) - ntfs_dt_root_remove2 (old, 0, count); + if (ntfs_dt_isroot(old)) + ntfs_dt_root_remove2(old, 0, count); else - ntfs_dt_alloc_remove2 (old, 0, count); + ntfs_dt_alloc_remove2(old, 0, count); if (1) return -1; - if (0) ntfs_dt_alloc_insert (NULL, NULL, 0); + if (0) ntfs_dt_alloc_insert(NULL, NULL, 0); if (new->child_count == 1) { i = -1; @@ -1282,7 +1284,7 @@ int ntfs_dt_transfer2 (struct ntfs_dt *old, struct ntfs_dt *new, int start, int n2 = old->children[start]->key.file_name.file_name; l2 = old->children[start]->key.file_name.file_name_length; - i = ntfs_names_collate (n1, l1, n2, l2, + i = ntfs_names_collate(n1, l1, n2, l2, 2, IGNORE_CASE, old->dir->vol->upcase, old->dir->vol->upcase_len); @@ -1301,44 +1303,44 @@ int ntfs_dt_transfer2 (struct ntfs_dt *old, struct ntfs_dt *new, int start, int dst = src + need; len = (u8*) new->children[new->child_count-1] + new->children[new->child_count-1]->length - src; - //printf ("src = %d, dst = %d, len = %d\n", src - new->data, dst - new->data, len); - memmove (dst, src, len); + //ntfs_log_debug("src = %d, dst = %d, len = %d\n", src - new->data, dst - new->data, len); + memmove(dst, src, len); dst = src; src = (u8*) old->children[start]; len = need; - memcpy (dst, src, len); + memcpy(dst, src, len); src = (u8*) old->children[start+count-1]; dst = (u8*) old->children[start]; len = (u8*) old->children[old->child_count-1] + old->children[old->child_count-1]->length - src; - //printf ("src = %d, dst = %d, len = %d\n", src - old->data, dst - old->data, len); - memmove (dst, src, len); + //ntfs_log_debug("src = %d, dst = %d, len = %d\n", src - old->data, dst - old->data, len); + memmove(dst, src, len); dst += len; len = old->data + old->dir->index_size - dst; - //printf ("dst = %d, len = %d\n", dst - old->data, len); - memset (dst, 0, len); + //ntfs_log_debug("dst = %d, len = %d\n", dst - old->data, len); + memset(dst, 0, len); - if (!ntfs_dt_resize_children3 (new, new->child_count + count)) + if (!ntfs_dt_resize_children3(new, new->child_count + count)) return -1; src = (u8*) &old->sub_nodes[start+count-1]; dst = (u8*) &old->sub_nodes[start]; - len = (old->child_count - start - count + 1) * sizeof (struct ntfs_dt*); + len = (old->child_count - start - count + 1) * sizeof(struct ntfs_dt*); - memmove (dst, src, len); + memmove(dst, src, len); src = (u8*) &new->sub_nodes[insert]; dst = (u8*) &new->sub_nodes[insert+count-1]; - len = (new->child_count - insert - count + 1) * sizeof (struct ntfs_dt*); + len = (new->child_count - insert - count + 1) * sizeof(struct ntfs_dt*); - memmove (dst, src, len); + memmove(dst, src, len); - if (!ntfs_dt_resize_children3 (old, old->child_count - count)) + if (!ntfs_dt_resize_children3(old, old->child_count - count)) return -1; src = (u8*) new->children[0]; @@ -1366,8 +1368,8 @@ int ntfs_dt_transfer2 (struct ntfs_dt *old, struct ntfs_dt *new, int start, int old->changed = TRUE; new->changed = TRUE; - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); + ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); + ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); return 0; } @@ -1375,7 +1377,7 @@ int ntfs_dt_transfer2 (struct ntfs_dt *old, struct ntfs_dt *new, int start, int /** * ntfs_dt_root_replace */ -int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) +int ntfs_dt_root_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) { u8 *src; u8 *dst; @@ -1386,51 +1388,51 @@ int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, if (!del || !del_ie || !suc_ie) return FALSE; - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - //printf ("\n"); + //utils_dump_mem(del->data, 0, del->data_len, DM_DEFAULTS); + //ntfs_log_debug("\n"); - attr = malloc (del->data_len + suc_ie->length - del_ie->length); + attr = malloc(del->data_len + suc_ie->length - del_ie->length); dst = attr; src = del->data; len = (u8*) del_ie - del->data; - memcpy (dst, src, len); + memcpy(dst, src, len); dst += len; src = (u8*) suc_ie; len = suc_ie->length; - memcpy (dst, src, len); + memcpy(dst, src, len); dst += len; src = (u8*) del_ie + del_ie->length; len = del->data_len + (del->data - (u8*) del_ie) - del_ie->length; - memcpy (dst, src, len); + memcpy(dst, src, len); src = (u8*) del->data; dst = attr; len = suc_ie->length - del_ie->length; - free (del->data); + free(del->data); del->data = attr; del->data_len += len; del->header = (INDEX_HEADER*) (del->data + 0x10); del->header->index_length += len; del->header->allocated_size += len; - ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); + ntfs_mft_resize_resident(del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); - //utils_dump_mem (attr, 0, del->data_len, DM_DEFAULTS); + //utils_dump_mem(attr, 0, del->data_len, DM_DEFAULTS); - //printf ("\n"); - //printf (BOLD YELLOW "Adjust children\n" END); + //ntfs_log_debug("\n"); + //ntfs_log_debug(BOLD YELLOW "Adjust children\n" END); //for (i = 0; i < del->child_count; i++) - // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); - //printf ("\n"); + // ntfs_log_debug("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); + //ntfs_log_debug("\n"); - //printf ("src = %p, dst = %p, len = %d\n", src, dst, len); fflush (stdout); + //ntfs_log_debug("src = %p, dst = %p, len = %d\n", src, dst, len); fflush (stdout); for (i = 0; i < del->child_count; i++) del->children[i] = (INDEX_ENTRY*) (dst + ((u8*) del->children[i] - src)); @@ -1439,22 +1441,22 @@ int ntfs_dt_root_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); //for (i = 0; i < del->child_count; i++) - // printf ("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); - //printf ("\n"); + // ntfs_log_debug("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); + //ntfs_log_debug("\n"); - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - //printf ("\n"); + //utils_dump_mem(del->data, 0, del->data_len, DM_DEFAULTS); + //ntfs_log_debug("\n"); del->changed = TRUE; - printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); + ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); return TRUE; } /** * ntfs_dt_alloc_replace */ -BOOL ntfs_dt_alloc_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) +BOOL ntfs_dt_alloc_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) { u8 *src; u8 *dst; @@ -1464,59 +1466,59 @@ BOOL ntfs_dt_alloc_replace (struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_i if (!del || !del_ie || !suc_ie) return FALSE; - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + //utils_dump_mem(del->data, 0, del->data_len, DM_DEFAULTS); src = (u8*) del_ie + del_ie->length; dst = (u8*) del_ie + suc_ie->length; len = del->header->index_length + 24 + (del->data - src); - //printf ("src = %d\n", src - del->data); - //printf ("dst = %d\n", dst - del->data); - //printf ("len = %d\n", len); + //ntfs_log_debug("src = %d\n", src - del->data); + //ntfs_log_debug("dst = %d\n", dst - del->data); + //ntfs_log_debug("len = %d\n", len); if (src != dst) - memmove (dst, src, len); + memmove(dst, src, len); src = (u8*) suc_ie; dst = (u8*) del_ie; len = suc_ie->length; - memcpy (dst, src, len); + memcpy(dst, src, len); - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + //utils_dump_mem(del->data, 0, del->data_len, DM_DEFAULTS); del->header->index_length += suc_ie->length - del_ie->length; dst = del->data + del->header->index_length + 24; len = del->data_len - del->header->index_length - 24; - memset (dst, 0, len); + memset(dst, 0, len); //for (i = 0; i < del->child_count; i++) - // printf ("Child %d %p\n", i, del->children[i]); - //printf ("\n"); + // ntfs_log_debug("Child %d %p\n", i, del->children[i]); + //ntfs_log_debug("\n"); len = suc_ie->length - del_ie->length; - //printf ("len = %d\n", len); + //ntfs_log_debug("len = %d\n", len); for (i = del_num+1; i < del->child_count; i++) del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] + len); //for (i = 0; i < del->child_count; i++) - // printf ("Child %d %p\n", i, del->children[i]); - //printf ("\n"); + // ntfs_log_debug("Child %d %p\n", i, del->children[i]); + //ntfs_log_debug("\n"); - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + //utils_dump_mem(del->data, 0, del->data_len, DM_DEFAULTS); del->changed = TRUE; - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); + ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); return TRUE; } /** * ntfs_dt_root_remove */ -BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) +BOOL ntfs_dt_root_remove(struct ntfs_dt *del, int del_num) { INDEX_ENTRY *del_ie = NULL; u8 *src; @@ -1530,26 +1532,26 @@ BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) if (!del) return FALSE; - //utils_dump_mem (del->data, 0, del->header->index_length+16, DM_RED); - //printf ("\n"); + //utils_dump_mem(del->data, 0, del->header->index_length+16, DM_RED); + //ntfs_log_debug("\n"); #if 0 off = (u8*) del->children[0] - del->data; for (i = 0; i < del->child_count; i++) { del_ie = del->children[i]; - printf ("%2d %4d ", i+1, off); + ntfs_log_debug("%2d %4d ", i+1, off); off += del_ie->length; if (del_ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", del_ie->length); + ntfs_log_debug("END (%d)\n", del_ie->length); break; } - ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); - printf (" (%d)\n", del_ie->length); + ntfs_name_print(del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + ntfs_log_debug(" (%d)\n", del_ie->length); } - printf ("total = %d\n", off); + ntfs_log_debug("total = %d\n", off); #endif del_ie = del->children[del_num]; @@ -1559,11 +1561,11 @@ BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) dst = (u8*) del_ie; len = del->header->index_length + 16 - (src - del->data); - //printf ("src = %d\n", src - del->data); - //printf ("dst = %d\n", dst - del->data); - //printf ("len = %d\n", len); + //ntfs_log_debug("src = %d\n", src - del->data); + //ntfs_log_debug("dst = %d\n", dst - del->data); + //ntfs_log_debug("len = %d\n", len); - memmove (dst, src, len); + memmove(dst, src, len); del->data_len -= del_len; del->child_count--; @@ -1571,40 +1573,40 @@ BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) del->header->index_length = del->data_len - 16; del->header->allocated_size = del->data_len - 16; - ntfs_mft_resize_resident (del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); + ntfs_mft_resize_resident(del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); old = del->data; - del->data = realloc (del->data, del->data_len); + del->data = realloc(del->data, del->data_len); del->header = (INDEX_HEADER*) (del->data + 0x10); - //utils_dump_mem (del->data, 0, del->data_len, DM_GREEN | DM_RED); + //utils_dump_mem(del->data, 0, del->data_len, DM_GREEN | DM_RED); src = (u8*) (&del->children[del_num+1]); dst = (u8*) (&del->children[del_num]); - len = (del->child_count - del_num) * sizeof (INDEX_ENTRY*); + len = (del->child_count - del_num) * sizeof(INDEX_ENTRY*); - //printf ("src = %d\n", src - (u8*) del->children); - //printf ("dst = %d\n", dst - (u8*) del->children); - //printf ("len = %d\n", len); + //ntfs_log_debug("src = %d\n", src - (u8*) del->children); + //ntfs_log_debug("dst = %d\n", dst - (u8*) del->children); + //ntfs_log_debug("len = %d\n", len); - memmove (dst, src, len); + memmove(dst, src, len); src = (u8*) (&del->sub_nodes[del_num+1]); dst = (u8*) (&del->sub_nodes[del_num]); - len = (del->child_count - del_num) * sizeof (struct ntfs_dt*); + len = (del->child_count - del_num) * sizeof(struct ntfs_dt*); - //printf ("src = %d\n", src - (u8*) del->children); - //printf ("dst = %d\n", dst - (u8*) del->children); - //printf ("len = %d\n", len); + //ntfs_log_debug("src = %d\n", src - (u8*) del->children); + //ntfs_log_debug("dst = %d\n", dst - (u8*) del->children); + //ntfs_log_debug("len = %d\n", len); - memmove (dst, src, len); + memmove(dst, src, len); - //printf ("del_num = %d\n", del_num); + //ntfs_log_debug("del_num = %d\n", del_num); for (i = 0; i < del->child_count; i++) del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - old + del->data); for (i = del_num; i < del->child_count; i++) del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_len); - if (!ntfs_dt_create_children2 (del, del->child_count)) + if (!ntfs_dt_create_children2(del, del->child_count)) return FALSE; #if 0 @@ -1612,32 +1614,32 @@ BOOL ntfs_dt_root_remove (struct ntfs_dt *del, int del_num) for (i = 0; i < del->child_count; i++) { del_ie = del->children[i]; - printf ("%2d %4d ", i+1, off); + ntfs_log_debug("%2d %4d ", i+1, off); off += del_len; if (del_ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", del_len); + ntfs_log_debug("END (%d)\n", del_len); break; } - ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); - printf (" (%d)\n", del_len); + ntfs_name_print(del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + ntfs_log_debug(" (%d)\n", del_len); } - printf ("total = %d\n", off); + ntfs_log_debug("total = %d\n", off); #endif - //utils_dump_mem (del->data, 0, del->header->index_length+16, DM_DEFAULTS); + //utils_dump_mem(del->data, 0, del->header->index_length+16, DM_DEFAULTS); del->changed = TRUE; - printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); + ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); return TRUE; } /** * ntfs_dt_alloc_remove */ -BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) +BOOL ntfs_dt_alloc_remove(struct ntfs_dt *del, int del_num) { INDEX_ENTRY *del_ie = NULL; u8 *dst; @@ -1654,23 +1656,23 @@ BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) for (i = 0; i < del->child_count; i++) { del_ie = del->children[i]; - printf ("%2d %4d ", i, off); + ntfs_log_debug("%2d %4d ", i, off); off += del_ie->length; if (del_ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", del_ie->length); + ntfs_log_debug("END (%d)\n", del_ie->length); break; } - ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); - printf (" (%d)\n", del_ie->length); + ntfs_name_print(del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + ntfs_log_debug(" (%d)\n", del_ie->length); } - printf ("total = %d\n", off); - printf ("\n"); + ntfs_log_debug("total = %d\n", off); + ntfs_log_debug("\n"); #endif - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); - //printf ("\n"); + //utils_dump_mem(del->data, 0, del->data_len, DM_DEFAULTS); + //ntfs_log_debug("\n"); del_ie = del->children[del_num]; @@ -1678,11 +1680,11 @@ BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) dst = (u8*) del_ie; len = del->header->index_length + 24 - (src - del->data); - //printf ("src = %d\n", src - del->data); - //printf ("dst = %d\n", dst - del->data); - //printf ("len = %d\n", len); + //ntfs_log_debug("src = %d\n", src - del->data); + //ntfs_log_debug("dst = %d\n", dst - del->data); + //ntfs_log_debug("len = %d\n", len); - memmove (dst, src, len); + memmove(dst, src, len); del->header->index_length -= src - dst; del->child_count--; @@ -1690,67 +1692,67 @@ BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) dst += len; len = del->data_len - del->header->index_length - 24; - //printf ("dst = %d\n", dst - del->data); - //printf ("len = %d\n", len); + //ntfs_log_debug("dst = %d\n", dst - del->data); + //ntfs_log_debug("len = %d\n", len); - memset (dst, 0, len); + memset(dst, 0, len); src = (u8*) (&del->children[del_num+1]); dst = (u8*) (&del->children[del_num]); - len = (del->child_count - del_num) * sizeof (INDEX_ENTRY*); + len = (del->child_count - del_num) * sizeof(INDEX_ENTRY*); - //printf ("src = %d\n", src - (u8*) del->children); - //printf ("dst = %d\n", dst - (u8*) del->children); - //printf ("len = %d\n", len); + //ntfs_log_debug("src = %d\n", src - (u8*) del->children); + //ntfs_log_debug("dst = %d\n", dst - (u8*) del->children); + //ntfs_log_debug("len = %d\n", len); - memmove (dst, src, len); + memmove(dst, src, len); src = (u8*) (&del->sub_nodes[del_num+1]); dst = (u8*) (&del->sub_nodes[del_num]); - len = (del->child_count - del_num) * sizeof (struct ntfs_dt*); + len = (del->child_count - del_num) * sizeof(struct ntfs_dt*); - //printf ("src = %d\n", src - (u8*) del->children); - //printf ("dst = %d\n", dst - (u8*) del->children); - //printf ("len = %d\n", len); + //ntfs_log_debug("src = %d\n", src - (u8*) del->children); + //ntfs_log_debug("dst = %d\n", dst - (u8*) del->children); + //ntfs_log_debug("len = %d\n", len); - memmove (dst, src, len); + memmove(dst, src, len); - //printf ("del_num = %d\n", del_num); + //ntfs_log_debug("del_num = %d\n", del_num); for (i = del_num; i < del->child_count; i++) del->children[i] = (INDEX_ENTRY*) ((u8*) del->children[i] - del_ie->length); - if (!ntfs_dt_create_children2 (del, del->child_count)) + if (!ntfs_dt_create_children2(del, del->child_count)) return FALSE; - //utils_dump_mem (del->data, 0, del->data_len, DM_DEFAULTS); + //utils_dump_mem(del->data, 0, del->data_len, DM_DEFAULTS); #if 0 off = (u8*)del->children[0] - del->data; for (i = 0; i < del->child_count; i++) { del_ie = del->children[i]; - printf ("%2d %4d ", i, off); + ntfs_log_debug("%2d %4d ", i, off); off += del_ie->length; if (del_ie->flags & INDEX_ENTRY_END) { - printf ("END (%d)\n", del_ie->length); + ntfs_log_debug("END (%d)\n", del_ie->length); break; } - ntfs_name_print (del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); - printf (" (%d)\n", del_ie->length); + ntfs_name_print(del_ie->key.file_name.file_name, del_ie->key.file_name.file_name_length); + ntfs_log_debug(" (%d)\n", del_ie->length); } - printf ("total = %d\n", off); - printf ("\n"); + ntfs_log_debug("total = %d\n", off); + ntfs_log_debug("\n"); #endif del->changed = TRUE; - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); + ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); if (del->child_count < 2) { - printf ("indx is empty\n"); - ntfs_bmp_set_range (del->dir->bitmap, del->vcn, 1, 0); + ntfs_log_debug("indx is empty\n"); + ntfs_bmp_set_range(del->dir->bitmap, del->vcn, 1, 0); } return TRUE; @@ -1759,7 +1761,7 @@ BOOL ntfs_dt_alloc_remove (struct ntfs_dt *del, int del_num) /** * ntfs_dt_alloc_add */ -int ntfs_dt_alloc_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) +int ntfs_dt_alloc_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) { INDEX_BLOCK *block; INDEX_ENTRY *entry; @@ -1777,39 +1779,39 @@ int ntfs_dt_alloc_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, s need = ie->length; space = parent->data_len - block->index.index_length - 24; - printf ("need %d, have %d\n", need, space); + ntfs_log_debug("need %d, have %d\n", need, space); if (need > space) { - printf ("no room"); + ntfs_log_debug("no room"); return 0; } - //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); - //printf ("\n"); + //utils_dump_mem(parent->data, 0, parent->data_len, DM_DEFAULTS); + //ntfs_log_debug("\n"); src = (u8*) parent->children[index_num]; dst = src + need; len = parent->data + parent->data_len - src - space; - //printf ("src = %d\n", src - parent->data); - //printf ("dst = %d\n", dst - parent->data); - //printf ("len = %d\n", len); + //ntfs_log_debug("src = %d\n", src - parent->data); + //ntfs_log_debug("dst = %d\n", dst - parent->data); + //ntfs_log_debug("len = %d\n", len); - memmove (dst, src, len); + memmove(dst, src, len); dst = src; src = (u8*) ie; len = need; - memcpy (dst, src, len); + memcpy(dst, src, len); block->index.index_length += len; dst = parent->data + block->index.index_length + 24; len = parent->data_len - block->index.index_length - 24; - memset (dst, 0, len); + memset(dst, 0, len); //realloc children, sub_nodes - ntfs_dt_create_children2 (parent, parent->child_count + 1); + ntfs_dt_create_children2(parent, parent->child_count + 1); // regen children pointers parent->child_count = 0; @@ -1828,26 +1830,26 @@ int ntfs_dt_alloc_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, s src += entry->length; } - printf ("count = %d\n", parent->child_count); + ntfs_log_debug("count = %d\n", parent->child_count); src = (u8*) &parent->sub_nodes[index_num+parent->child_count-1]; dst = (u8*) &parent->sub_nodes[index_num]; - len = (parent->child_count - index_num - 1) * sizeof (struct ntfs_dt*); + len = (parent->child_count - index_num - 1) * sizeof(struct ntfs_dt*); - memmove (dst, src, len); + memmove(dst, src, len); //insert sub_node pointer parent->sub_nodes[index_num] = child; - //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); - //printf ("\n"); + //utils_dump_mem(parent->data, 0, parent->data_len, DM_DEFAULTS); + //ntfs_log_debug("\n"); return 0; } /** * ntfs_dt_root_add */ -int ntfs_dt_root_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) +int ntfs_dt_root_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) { INDEX_ROOT *root; INDEX_ENTRY *entry; @@ -1863,39 +1865,39 @@ int ntfs_dt_root_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, st root = (INDEX_ROOT*) parent->data; - //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); - printf ("\n"); + //utils_dump_mem(parent->data, 0, parent->data_len, DM_DEFAULTS); + ntfs_log_debug("\n"); need = ie->length; - space = ntfs_mft_free_space (parent->dir); + space = ntfs_mft_free_space(parent->dir); - printf ("need %d, have %d\n", need, space); + ntfs_log_debug("need %d, have %d\n", need, space); if (need > space) { - printf ("no room"); + ntfs_log_debug("no room"); return 0; } - attr = malloc (parent->data_len + need); + attr = malloc(parent->data_len + need); src = parent->data; dst = attr; len = root->index.entries_offset + 16; - memcpy (dst, src, len); + memcpy(dst, src, len); dst += len; src = (u8*) ie; len = ie->length; - memcpy (dst, src, len); + memcpy(dst, src, len); dst += len; src = (u8*) parent->children[index_num]; len = parent->data + parent->data_len - src; - memcpy (dst, src, len); + memcpy(dst, src, len); - free (parent->data); + free(parent->data); parent->data = attr; parent->data_len += need; @@ -1903,13 +1905,13 @@ int ntfs_dt_root_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, st root->index.index_length = parent->data_len - 16; root->index.allocated_size = parent->data_len - 16; - //utils_dump_mem (parent->data, 0, parent->data_len, DM_DEFAULTS); - printf ("\n"); + //utils_dump_mem(parent->data, 0, parent->data_len, DM_DEFAULTS); + ntfs_log_debug("\n"); - ntfs_mft_resize_resident (parent->dir->inode, AT_INDEX_ROOT, I30, 4, parent->data, parent->data_len); + ntfs_mft_resize_resident(parent->dir->inode, AT_INDEX_ROOT, I30, 4, parent->data, parent->data_len); //realloc children, sub_nodes - ntfs_dt_create_children2 (parent, parent->child_count + 1); + ntfs_dt_create_children2(parent, parent->child_count + 1); // regen children pointers parent->child_count = 0; @@ -1929,13 +1931,13 @@ int ntfs_dt_root_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, st src += entry->length; } - printf ("count = %d\n", parent->child_count); + ntfs_log_debug("count = %d\n", parent->child_count); src = (u8*) &parent->sub_nodes[index_num+parent->child_count-1]; dst = (u8*) &parent->sub_nodes[index_num]; - len = (parent->child_count - index_num - 1) * sizeof (struct ntfs_dt*); + len = (parent->child_count - index_num - 1) * sizeof(struct ntfs_dt*); - memmove (dst, src, len); + memmove(dst, src, len); //insert sub_node pointer parent->sub_nodes[index_num] = child; @@ -1946,7 +1948,7 @@ int ntfs_dt_root_add (struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, st /** * ntfs_dt_add2 */ -int ntfs_dt_add2 (INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs_dt *ded) +int ntfs_dt_add2(INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs_dt *ded) { int need; int space; @@ -1961,10 +1963,10 @@ int ntfs_dt_add2 (INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs if (!ie || !suc) return -1; - printf ("\n"); - printf (BOLD YELLOW "Add key to leaf\n" END); + ntfs_log_debug("\n"); + ntfs_log_debug(BOLD YELLOW "Add key to leaf\n" END); - //utils_dump_mem (suc->data, 0, suc->data_len, DM_DEFAULTS); + //utils_dump_mem(suc->data, 0, suc->data_len, DM_DEFAULTS); chl = NULL; ascend: @@ -1972,7 +1974,7 @@ ascend: #if 0 for (; ded; ded = ded->sub_nodes[0]) { - printf ("\tded vcn = %lld\n", ded->vcn); + ntfs_log_debug("\tded vcn = %lld\n", ded->vcn); } #endif @@ -1984,19 +1986,19 @@ ascend: */ need = ie->length; - if (ntfs_dt_isroot (suc)) - space = ntfs_dt_root_freespace (suc); + if (ntfs_dt_isroot(suc)) + space = ntfs_dt_root_freespace(suc); else - space = ntfs_dt_alloc_freespace (suc); + space = ntfs_dt_alloc_freespace(suc); - printf ("\tneed %d\n", need); - printf ("\tspace %d\n", space); + ntfs_log_debug("\tneed %d\n", need); + ntfs_log_debug("\tspace %d\n", space); if (space >= need) { - if (ntfs_dt_isroot (suc)) - ntfs_dt_root_add (suc, suc_num, ie, chl); + if (ntfs_dt_isroot(suc)) + ntfs_dt_root_add(suc, suc_num, ie, chl); else - ntfs_dt_alloc_add (suc, suc_num, ie, chl); + ntfs_dt_alloc_add(suc, suc_num, ie, chl); goto done; } @@ -2010,9 +2012,9 @@ ascend: new = ded; vcn = ded->vcn; ded = ded->sub_nodes[0]; - printf ("\treusing vcn %lld\n", new->vcn); + ntfs_log_debug("\treusing vcn %lld\n", new->vcn); } else { - ntfs_mft_add_index (suc->dir); + ntfs_mft_add_index(suc->dir); /* * ALLOC * any unused records? @@ -2038,7 +2040,7 @@ ascend: */ } - //printf ("\tnode has %d children\n", suc->child_count); + //ntfs_log_debug("\tnode has %d children\n", suc->child_count); // initialise new node // XXX ntfs_dt_initialise (new, vcn); @@ -2047,37 +2049,37 @@ ascend: // find median key median = (suc->child_count+1) / 2; - med_ie = ntfs_ie_copy (suc->children[median]); - //file = &med_ie->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + med_ie = ntfs_ie_copy(suc->children[median]); + //file = &med_ie->key.file_name; ntfs_log_debug("\tmed name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_debug("\n"); - ntfs_ie_free (med_ie); + ntfs_ie_free(med_ie); med_ie = NULL; - //printf ("suc key count = %d\n", suc->child_count); - //printf ("new key count = %d\n", new->child_count); + //ntfs_log_debug("suc key count = %d\n", suc->child_count); + //ntfs_log_debug("new key count = %d\n", new->child_count); - //printf ("median's child = %p\n", suc->sub_nodes[median]); + //ntfs_log_debug("median's child = %p\n", suc->sub_nodes[median]); // need to pass the child when ascending chl = suc->sub_nodes[median]; // transfer keys - if (ntfs_dt_transfer (suc, new, 0, median-1) < 0) + if (ntfs_dt_transfer(suc, new, 0, median-1) < 0) goto done; - //printf ("suc key count = %d\n", suc->child_count); - //printf ("new key count = %d\n", new->child_count); + //ntfs_log_debug("suc key count = %d\n", suc->child_count); + //ntfs_log_debug("new key count = %d\n", new->child_count); - //file = &suc->children[0]->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + //file = &suc->children[0]->key.file_name; ntfs_log_debug("\tmed name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_debug("\n"); // can this be a root node? - if (ntfs_dt_isroot (suc)) - ntfs_dt_root_remove (suc, 0); + if (ntfs_dt_isroot(suc)) + ntfs_dt_root_remove(suc, 0); else - ntfs_dt_alloc_remove (suc, 0); + ntfs_dt_alloc_remove(suc, 0); - //file = &suc->children[0]->key.file_name; printf ("\tmed name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - //printf ("suc key count = %d\n", suc->child_count); - //printf ("new key count = %d\n", new->child_count); + //file = &suc->children[0]->key.file_name; ntfs_log_debug("\tmed name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_debug("\n"); + //ntfs_log_debug("suc key count = %d\n", suc->child_count); + //ntfs_log_debug("new key count = %d\n", new->child_count); // remove the median key @@ -2086,12 +2088,12 @@ ascend: // median child is new // ascend - med_ie = ntfs_ie_set_vcn (med_ie, new->vcn); + med_ie = ntfs_ie_set_vcn(med_ie, new->vcn); if (!med_ie) goto done; - //printf ("median child = %lld\n", ntfs_ie_get_vcn (med_ie)); - //printf ("new's vcn = %lld\n", new->vcn); + //ntfs_log_debug("median child = %lld\n", ntfs_ie_get_vcn(med_ie)); + //ntfs_log_debug("new's vcn = %lld\n", new->vcn); // adjust parents // attach new to median @@ -2107,8 +2109,8 @@ ascend: suc = suc->parent; suc_num = 0; - printf ("\n"); - printf (BOLD YELLOW "Ascend\n" END); + ntfs_log_debug("\n"); + ntfs_log_debug(BOLD YELLOW "Ascend\n" END); goto ascend; done: return 0; diff --git a/libntfs/unistr.c b/libntfs/unistr.c index 529a2b9e..a8b91d20 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -1,4 +1,4 @@ -/* +/** * unistr.c - Unicode string handling. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov @@ -19,7 +19,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDIO_H #include @@ -40,6 +42,7 @@ #include "types.h" #include "unistr.h" #include "debug.h" +#include "logging.h" /* * IMPORTANT @@ -129,7 +132,7 @@ int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, #ifdef DEBUG if (!name1 || !name2 || (ic && (!upcase || !upcase_len))) { - Dputs("ntfs_names_collate received NULL pointer!"); + ntfs_log_debug("ntfs_names_collate received NULL pointer!\n"); exit(1); } #endif @@ -187,7 +190,7 @@ int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n) #ifdef DEBUG if (!s1 || !s2) { - Dputs("ntfs_wcsncmp() received NULL pointer!"); + ntfs_log_debug("ntfs_wcsncmp() received NULL pointer!\n"); exit(1); } #endif @@ -230,7 +233,7 @@ int ntfs_ucsncasecmp(const ntfschar *s1, const ntfschar *s2, size_t n, #ifdef DEBUG if (!s1 || !s2 || !upcase) { - Dputs("ntfs_wcsncasecmp() received NULL pointer!"); + ntfs_log_debug("ntfs_wcsncasecmp() received NULL pointer!\n"); exit(1); } #endif @@ -428,7 +431,7 @@ int ntfs_ucstombs(const ntfschar *ins, const int ins_len, char **outs, if (cnt == -1) goto err_out; if (cnt <= 0) { - Dprintf("Eeek. cnt <= 0, cnt = %i\n", cnt); + ntfs_log_debug("Eeek. cnt <= 0, cnt = %i\n", cnt); errno = EINVAL; goto err_out; } @@ -437,7 +440,7 @@ int ntfs_ucstombs(const ntfschar *ins, const int ins_len, char **outs, #ifdef HAVE_MBSINIT /* Make sure we are back in the initial state. */ if (!mbsinit(&mbstate)) { - Dputs("Eeek. mbstate not in initial state!"); + ntfs_log_debug("Eeek. mbstate not in initial state!\n"); errno = EILSEQ; goto err_out; } @@ -572,7 +575,7 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs, int outs_len) if (cnt == -1) goto err_out; if (cnt < -1) { - Dprintf("%s(): Eeek. cnt = %i\n", __FUNCTION__, cnt); + ntfs_log_trace("Eeek. cnt = %i\n", cnt); errno = EINVAL; goto err_out; } @@ -588,8 +591,7 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs, int outs_len) #ifdef HAVE_MBSINIT /* Make sure we are back in the initial state. */ if (!mbsinit(&mbstate)) { - Dprintf("%s(): Eeek. mbstate not in initial state!\n", - __FUNCTION__); + ntfs_log_trace("Eeek. mbstate not in initial state!\n"); errno = EILSEQ; goto err_out; } diff --git a/libntfs/unix_io.c b/libntfs/unix_io.c index 196d6160..a91b6431 100644 --- a/libntfs/unix_io.c +++ b/libntfs/unix_io.c @@ -1,4 +1,4 @@ -/* +/** * unix_io.c - Unix style disk io functions. Part of the Linux-NTFS project. * * Copyright (c) 2000-2003 Anton Altaparmakov @@ -19,7 +19,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_UNISTD_H #include @@ -49,13 +51,14 @@ #include #endif #ifdef HAVE_LINUX_FD_H -# include +#include #endif #include "types.h" #include "mst.h" #include "debug.h" #include "device.h" +#include "logging.h" #if defined(linux) && defined(_IO) && !defined(BLKGETSIZE) # define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ @@ -63,6 +66,9 @@ #define DEV_FD(dev) (*(int *)dev->d_private) +/** + * ntfs_device_unix_io_open + */ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags) { struct flock flk; @@ -92,13 +98,11 @@ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags) flk.l_start = flk.l_len = 0LL; if (fcntl(DEV_FD(dev), F_SETLK, &flk)) { err = errno; - Dprintf("ntfs_device_unix_io_open: Could not lock %s for %s: " - "%s\n", dev->d_name, NDevReadOnly(dev) ? - "reading" : "writing", strerror(errno)); + ntfs_log_debug("ntfs_device_unix_io_open: Could not lock %s for %s", + dev->d_name, NDevReadOnly(dev) ? "reading" : "writing"); if (close(DEV_FD(dev))) - Dprintf("ntfs_device_unix_io_open: Warning: Could not " - "close %s: %s\n", dev->d_name, - strerror(errno)); + ntfs_log_perror("ntfs_device_unix_io_open: Warning: Could not " + "close %s", dev->d_name); goto err_out; } /* Set our open flag. */ @@ -111,6 +115,9 @@ err_out: return -1; } +/** + * ntfs_device_unix_io_close + */ static int ntfs_device_unix_io_close(struct ntfs_device *dev) { struct flock flk; @@ -127,8 +134,8 @@ static int ntfs_device_unix_io_close(struct ntfs_device *dev) flk.l_whence = SEEK_SET; flk.l_start = flk.l_len = 0LL; if (fcntl(DEV_FD(dev), F_SETLK, &flk)) - Dprintf("ntfs_device_unix_io_close: Warning: Could not unlock " - "%s: %s\n", dev->d_name, strerror(errno)); + ntfs_log_perror("ntfs_device_unix_io_close: Warning: Could not " + "unlock %s", dev->d_name); /* Close the file descriptor and clear our open flag. */ if (close(DEV_FD(dev))) return -1; @@ -138,18 +145,27 @@ static int ntfs_device_unix_io_close(struct ntfs_device *dev) return 0; } +/** + * ntfs_device_unix_io_seek + */ static s64 ntfs_device_unix_io_seek(struct ntfs_device *dev, s64 offset, int whence) { return lseek(DEV_FD(dev), offset, whence); } +/** + * ntfs_device_unix_io_read + */ static s64 ntfs_device_unix_io_read(struct ntfs_device *dev, void *buf, s64 count) { return read(DEV_FD(dev), buf, count); } +/** + * ntfs_device_unix_io_write + */ static s64 ntfs_device_unix_io_write(struct ntfs_device *dev, const void *buf, s64 count) { @@ -161,12 +177,18 @@ static s64 ntfs_device_unix_io_write(struct ntfs_device *dev, const void *buf, return write(DEV_FD(dev), buf, count); } +/** + * ntfs_device_unix_io_pread + */ static s64 ntfs_device_unix_io_pread(struct ntfs_device *dev, void *buf, s64 count, s64 offset) { return ntfs_pread(dev, offset, count, buf); } +/** + * ntfs_device_unix_io_pwrite + */ static s64 ntfs_device_unix_io_pwrite(struct ntfs_device *dev, const void *buf, s64 count, s64 offset) { @@ -178,6 +200,9 @@ static s64 ntfs_device_unix_io_pwrite(struct ntfs_device *dev, const void *buf, return ntfs_pwrite(dev, offset, count, buf); } +/** + * ntfs_device_unix_io_sync + */ static int ntfs_device_unix_io_sync(struct ntfs_device *dev) { if (!NDevReadOnly(dev) && NDevDirty(dev)) { @@ -189,11 +214,17 @@ static int ntfs_device_unix_io_sync(struct ntfs_device *dev) return 0; } +/** + * ntfs_device_unix_io_stat + */ static int ntfs_device_unix_io_stat(struct ntfs_device *dev, struct stat *buf) { return fstat(DEV_FD(dev), buf); } +/** + * ntfs_device_unix_io_ioctl + */ static int ntfs_device_unix_io_ioctl(struct ntfs_device *dev, int request, void *argp) { diff --git a/libntfs/volume.c b/libntfs/volume.c index 00cf6c47..5c5ca3a2 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1,4 +1,4 @@ -/* +/** * volume.c - NTFS volume handling code. Part of the Linux-NTFS project. * * Copyright (c) 2000-2005 Anton Altaparmakov @@ -21,7 +21,9 @@ * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDLIB_H #include @@ -58,6 +60,7 @@ #include "runlist.h" #include "logfile.h" #include "dir.h" +#include "logging.h" #ifndef PATH_MAX #define PATH_MAX 4096 @@ -65,7 +68,6 @@ /** * ntfs_volume_alloc - - * */ ntfs_volume *ntfs_volume_alloc(void) { @@ -92,7 +94,6 @@ ntfs_volume *ntfs_volume_alloc(void) * Internal: * * __ntfs_volume_release - - * */ static void __ntfs_volume_release(ntfs_volume *v) { @@ -124,16 +125,11 @@ static void __ntfs_volume_release(ntfs_volume *v) if (NDevDirty(dev)) dev->d_ops->sync(dev); if (dev->d_ops->close(dev)) - Dprintf("%s(): Eeek! Failed to close the device. " - "Error: %s\n", __FUNCTION__, - strerror(errno)); + ntfs_log_perror("Eeek! Failed to close the device. Error: "); } - if (v->vol_name) - free(v->vol_name); - if (v->upcase) - free(v->upcase); - if (v->attrdef) - free(v->attrdef); + free(v->vol_name); + free(v->upcase); + free(v->attrdef); free(v); } @@ -162,7 +158,7 @@ static int ntfs_mft_load(ntfs_volume *vol) vol->mft_ni = ntfs_inode_allocate(vol); mb = (MFT_RECORD*)malloc(vol->mft_record_size); if (!vol->mft_ni || !mb) { - Dperror("Error allocating memory for $MFT"); + ntfs_log_perror("Error allocating memory for $MFT"); goto error_exit; } vol->mft_ni->mft_no = 0; @@ -173,33 +169,33 @@ static int ntfs_mft_load(ntfs_volume *vol) if (l != 1) { if (l != -1) errno = EIO; - Dperror("Error reading $MFT"); + ntfs_log_perror("Error reading $MFT"); goto error_exit; } if (ntfs_is_baad_record(mb->magic)) { - Dputs("Error: Incomplete multi sector transfer detected in " - "$MFT."); + ntfs_log_debug("Error: Incomplete multi sector transfer detected in " + "$MFT.\n"); goto io_error_exit; } if (!ntfs_is_mft_record(mb->magic)) { - Dputs("Error: $MFT has invalid magic."); + ntfs_log_debug("Error: $MFT has invalid magic.\n"); goto io_error_exit; } ctx = ntfs_attr_get_search_ctx(vol->mft_ni, NULL); if (!ctx) { - Dperror("Failed to allocate attribute search context"); + ntfs_log_perror("Failed to allocate attribute search context"); goto error_exit; } if (p2n(ctx->attr) < p2n(mb) || (char*)ctx->attr > (char*)mb + vol->mft_record_size) { - Dputs("Error: $MFT is corrupt."); + ntfs_log_debug("Error: $MFT is corrupt.\n"); goto io_error_exit; } /* Find the $ATTRIBUTE_LIST attribute in $MFT if present. */ if (ntfs_attr_lookup(AT_ATTRIBUTE_LIST, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { if (errno != ENOENT) { - Dputs("Error: $MFT has corrupt attribute list."); + ntfs_log_debug("Error: $MFT has corrupt attribute list.\n"); goto io_error_exit; } goto mft_has_no_attr_list; @@ -207,23 +203,25 @@ static int ntfs_mft_load(ntfs_volume *vol) NInoSetAttrList(vol->mft_ni); l = ntfs_get_attribute_value_length(ctx->attr); if (l <= 0 || l > 0x40000) { - Dputs("Error: $MFT/$ATTRIBUTE_LIST has invalid length."); + ntfs_log_debug("Error: $MFT/$ATTRIBUTE_LIST has invalid length.\n"); goto io_error_exit; } vol->mft_ni->attr_list_size = l; vol->mft_ni->attr_list = malloc(l); if (!vol->mft_ni->attr_list) { - Dputs("Error: failed to allocate buffer for attribute list."); + ntfs_log_debug("Error: failed to allocate buffer for attribute " + "list.\n"); goto error_exit; } l = ntfs_get_attribute_value(vol, ctx->attr, vol->mft_ni->attr_list); if (!l) { - Dputs("Error: failed to get value of $MFT/$ATTRIBUTE_LIST."); + ntfs_log_debug("Error: failed to get value of " + "$MFT/$ATTRIBUTE_LIST.\n"); goto io_error_exit; } if (l != vol->mft_ni->attr_list_size) { - Dputs("Error: got unexpected amount of data when reading " - "$MFT/$ATTRIBUTE_LIST."); + ntfs_log_debug("Error: got unexpected amount of data when reading " + "$MFT/$ATTRIBUTE_LIST.\n"); goto io_error_exit; } mft_has_no_attr_list: @@ -232,7 +230,7 @@ mft_has_no_attr_list: /* Get an ntfs attribute for $MFT/$DATA and set it up, too. */ vol->mft_na = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0); if (!vol->mft_na) { - Dperror("Failed to open ntfs attribute"); + ntfs_log_perror("Failed to open ntfs attribute"); goto error_exit; } /* Read all extents from the $DATA attribute in $MFT. */ @@ -247,17 +245,17 @@ mft_has_no_attr_list: a = ctx->attr; /* $MFT must be non-resident. */ if (!a->non_resident) { - Dputs("$MFT must be non-resident but a resident " - "extent was found. $MFT is corrupt. " - "Run chkdsk."); + ntfs_log_debug("$MFT must be non-resident but a resident " + "extent was found. $MFT is corrupt. Run " + "chkdsk.\n"); goto io_error_exit; } /* $MFT must be uncompressed and unencrypted. */ if (a->flags & ATTR_COMPRESSION_MASK || a->flags & ATTR_IS_ENCRYPTED) { - Dputs("$MFT must be uncompressed and unencrypted but " - "a compressed/encrypted extent was " - "found. $MFT is corrupt. Run chkdsk."); + ntfs_log_debug("$MFT must be uncompressed and unencrypted " + "but a compressed/encrypted extent was " + "found. $MFT is corrupt. Run chkdsk.\n"); goto io_error_exit; } /* @@ -268,7 +266,7 @@ mft_has_no_attr_list: */ nrl = ntfs_mapping_pairs_decompress(vol, a, vol->mft_na->rl); if (!nrl) { - Dperror("ntfs_mapping_pairs_decompress() failed"); + ntfs_log_perror("ntfs_mapping_pairs_decompress() failed"); goto error_exit; } vol->mft_na->rl = nrl; @@ -283,22 +281,21 @@ mft_has_no_attr_list: /* Avoid endless loops due to corruption. */ if (next_vcn < sle64_to_cpu(a->lowest_vcn)) { - Dputs("$MFT has corrupt attribute list attribute. " - "Run chkdsk."); + ntfs_log_debug("$MFT has corrupt attribute list attribute. " + "Run chkdsk.\n"); goto io_error_exit; } } if (!a) { - Dputs("$MFT/$DATA attribute not found. $MFT is corrupt. " - "Run chkdsk."); + ntfs_log_debug("$MFT/$DATA attribute not found. $MFT is corrupt. Run " + "chkdsk.\n"); goto io_error_exit; } if (highest_vcn && highest_vcn != last_vcn - 1) { - Dputs("Failed to load the complete runlist for $MFT/$DATA. " - "Bug or corrupt $MFT. Run chkdsk."); - Dprintf("highest_vcn = 0x%llx, last_vcn - 1 = 0x%llx\n", - (long long)highest_vcn, - (long long)last_vcn - 1); + ntfs_log_debug("Failed to load the complete runlist for $MFT/$DATA. " + "Bug or corrupt $MFT. Run chkdsk.\n"); + ntfs_log_debug("highest_vcn = 0x%llx, last_vcn - 1 = 0x%llx\n", + (long long)highest_vcn, (long long)last_vcn - 1); goto io_error_exit; } /* Done with the $Mft mft record. */ @@ -309,7 +306,7 @@ mft_has_no_attr_list: */ vol->mftbmp_na = ntfs_attr_open(vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0); if (!vol->mftbmp_na) { - Dperror("Failed to open $MFT/$BITMAP"); + ntfs_log_perror("Failed to open $MFT/$BITMAP"); goto error_exit; } return 0; @@ -351,17 +348,17 @@ static int ntfs_mftmirr_load(ntfs_volume *vol) vol->mftmirr_ni = ntfs_inode_open(vol, FILE_MFTMirr); if (!vol->mftmirr_ni) { - Dperror("Failed to open inode $MFTMirr"); + ntfs_log_perror("Failed to open inode $MFTMirr"); return -1; } /* Get an ntfs attribute for $MFTMirr/$DATA, too. */ vol->mftmirr_na = ntfs_attr_open(vol->mftmirr_ni, AT_DATA, AT_UNNAMED, 0); if (!vol->mftmirr_na) { - Dperror("Failed to open $MFTMirr/$DATA"); + ntfs_log_perror("Failed to open $MFTMirr/$DATA"); goto error_exit; } if (ntfs_attr_map_runlist(vol->mftmirr_na, 0) < 0) { - Dperror("Failed to map runlist of $MFTMirr/$DATA"); + ntfs_log_perror("Failed to map runlist of $MFTMirr/$DATA"); goto error_exit; } /* Construct the mft mirror runlist. */ @@ -378,7 +375,8 @@ static int ntfs_mftmirr_load(ntfs_volume *vol) if (rl[i].vcn != vol->mftmirr_na->rl[i].vcn || rl[i].lcn != vol->mftmirr_na->rl[i].lcn || rl[i].length != vol->mftmirr_na->rl[i].length) { - Dputs("Error: $MFTMirr location mismatch! Run chkdsk."); + ntfs_log_debug("Error: $MFTMirr location mismatch! Run " + "chkdsk.\n"); errno = EIO; goto error_exit; } @@ -415,9 +413,9 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) ntfs_volume *vol; NTFS_BOOT_SECTOR *bs; int eo; -#ifdef DEBUG - const char *OK = "OK"; - const char *FAILED = "FAILED"; +#ifndef NTFS_DISABLE_DEBUG_LOGGING + const char *OK = "OK\n"; + const char *FAILED = "FAILED\n"; BOOL debug = 1; #else BOOL debug = 0; @@ -439,17 +437,17 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) vol->upcase_len = 65536; vol->upcase = (ntfschar*)malloc(vol->upcase_len * sizeof(ntfschar)); if (!vol->upcase) { - Dperror("Error allocating memory for upcase table."); + ntfs_log_perror("Error allocating memory for upcase table."); goto error_exit; } ntfs_upcase_table_build(vol->upcase, vol->upcase_len * sizeof(ntfschar)); if ((rwflag & MS_RDONLY) == MS_RDONLY) NVolSetReadOnly(vol); - Dprintf("Reading bootsector... "); + ntfs_log_debug("Reading bootsector... "); if (dev->d_ops->open(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) { - Dputs(FAILED); - Dperror("Error opening partition device"); + ntfs_log_debug(FAILED); + ntfs_log_perror("Error opening partition device"); goto error_exit; } /* Attach the device to the volume. */ @@ -457,25 +455,25 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) /* Now read the bootsector. */ br = ntfs_pread(dev, 0, sizeof(NTFS_BOOT_SECTOR), bs); if (br != sizeof(NTFS_BOOT_SECTOR)) { - Dputs(FAILED); + ntfs_log_debug(FAILED); if (br != -1) errno = EINVAL; if (!br) - Dputs("Error: partition is smaller than bootsector " - "size. Weird!"); + ntfs_log_debug("Error: partition is smaller than bootsector " + "size. Weird!\n"); else - Dperror("Error reading bootsector"); + ntfs_log_perror("Error reading bootsector"); goto error_exit; } - Dputs(OK); + ntfs_log_debug(OK); if (!ntfs_boot_sector_is_ntfs(bs, !debug)) { - Dprintf("Error: %s is not a valid NTFS partition!\n", + ntfs_log_debug("Error: %s is not a valid NTFS partition!\n", dev->d_name); errno = EINVAL; goto error_exit; } if (ntfs_boot_sector_parse(vol, bs) < 0) { - Dperror("Failed to parse ntfs bootsector"); + ntfs_log_perror("Failed to parse ntfs bootsector"); goto error_exit; } free(bs); @@ -510,7 +508,7 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) /* Setup the mft zone. */ vol->mft_zone_start = vol->mft_zone_pos = vol->mft_lcn; - Dprintf("mft_zone_pos = 0x%llx\n", (long long)vol->mft_zone_pos); + ntfs_log_debug("mft_zone_pos = 0x%llx\n", (long long)vol->mft_zone_pos); /* * Calculate the mft_lcn for an unmodified NTFS volume (see mkntfs @@ -527,7 +525,7 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) vol->cluster_size; if (vol->mft_zone_start <= mft_lcn) vol->mft_zone_start = 0; - Dprintf("mft_zone_start = 0x%llx\n", (long long)vol->mft_zone_start); + ntfs_log_debug("mft_zone_start = 0x%llx\n", (long long)vol->mft_zone_start); /* * Need to cap the mft zone on non-standard volumes so that it does @@ -539,16 +537,16 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) mft_zone_size >>= 1; vol->mft_zone_end = vol->mft_lcn + mft_zone_size; } - Dprintf("mft_zone_end = 0x%llx\n", (long long)vol->mft_zone_end); + ntfs_log_debug("mft_zone_end = 0x%llx\n", (long long)vol->mft_zone_end); /* * Set the current position within each data zone to the start of the * respective zone. */ vol->data1_zone_pos = vol->mft_zone_end; - Dprintf("data1_zone_pos = 0x%llx\n", vol->data1_zone_pos); + ntfs_log_debug("data1_zone_pos = 0x%llx\n", vol->data1_zone_pos); vol->data2_zone_pos = 0; - Dprintf("data2_zone_pos = 0x%llx\n", vol->data2_zone_pos); + ntfs_log_debug("data2_zone_pos = 0x%llx\n", vol->data2_zone_pos); /* Set the mft data allocation position to mft record 24. */ vol->mft_data_pos = 24; @@ -558,22 +556,22 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) */ /* Need to setup $MFT so we can use the library read functions. */ - Dprintf("Loading $MFT... "); + ntfs_log_debug("Loading $MFT... "); if (ntfs_mft_load(vol) < 0) { - Dputs(FAILED); - Dperror("Failed to load $MFT"); + ntfs_log_debug(FAILED); + ntfs_log_perror("Failed to load $MFT"); goto error_exit; } - Dputs(OK); + ntfs_log_debug(OK); /* Need to setup $MFTMirr so we can use the write functions, too. */ - Dprintf("Loading $MFTMirr... "); + ntfs_log_debug("Loading $MFTMirr... "); if (ntfs_mftmirr_load(vol) < 0) { - Dputs(FAILED); - Dperror("Failed to load $MFTMirr"); + ntfs_log_debug(FAILED); + ntfs_log_perror("Failed to load $MFTMirr"); goto error_exit; } - Dputs(OK); + ntfs_log_debug(OK); return vol; error_exit: eo = errno; @@ -598,19 +596,18 @@ static int ntfs_volume_check_logfile(ntfs_volume *vol) int err = 0; if ((ni = ntfs_inode_open(vol, FILE_LogFile)) == NULL) { - Dprintf("Failed to open inode FILE_LogFile.\n"); + ntfs_log_debug("Failed to open inode FILE_LogFile.\n"); errno = EIO; return -1; } if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) { - Dprintf("Failed to open $FILE_LogFile/$DATA\n"); + ntfs_log_debug("Failed to open $FILE_LogFile/$DATA\n"); err = EIO; goto exit; } if (!ntfs_check_logfile(na, &rp) || !ntfs_is_logfile_clean(na, rp)) err = EOPNOTSUPP; - if (rp) - free(rp); + free(rp); exit: if (na) ntfs_attr_close(na); @@ -645,32 +642,31 @@ static ntfs_inode *ntfs_hiberfile_open(ntfs_volume *vol) ni_root = ntfs_inode_open(vol, FILE_root); if (!ni_root) { - Dprintf("Couldn't open the root directory.\n"); + ntfs_log_debug("Couldn't open the root directory.\n"); return NULL; } unicode_len = ntfs_mbstoucs(hiberfile, &unicode, 0); if (unicode_len < 0) { - Dperror("Couldn't convert 'hiberfil.sys' to Unicode"); + ntfs_log_perror("Couldn't convert 'hiberfil.sys' to Unicode"); goto out; } inode = ntfs_inode_lookup_by_name(ni_root, unicode, unicode_len); if (inode == (u64)-1) { - Dprintf("Couldn't find file '%s'.\n", hiberfile); + ntfs_log_debug("Couldn't find file '%s'.\n", hiberfile); goto out; } inode = MREF(inode); ni_hibr = ntfs_inode_open(vol, inode); if (!ni_hibr) { - Dprintf("Couldn't open inode %lld.\n", (long long)inode); + ntfs_log_debug("Couldn't open inode %lld.\n", (long long)inode); goto out; } out: ntfs_inode_close(ni_root); - if (unicode) - free(unicode); + free(unicode); return ni_hibr; } @@ -701,34 +697,35 @@ static int ntfs_volume_check_hiberfile(ntfs_volume *vol) buf = malloc(NTFS_HIBERFILE_HEADER_SIZE); if (!buf) { - Dperror("Error allocating memory for hiberfile.sys header"); + ntfs_log_perror("Error allocating memory for hiberfile.sys header"); goto out; } na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); if (!na) { - Dperror("Failed to open hiberfil.sys data attribute"); + ntfs_log_perror("Failed to open hiberfil.sys data attribute"); goto out; } bytes_read = ntfs_attr_pread(na, 0, NTFS_HIBERFILE_HEADER_SIZE, buf); if (bytes_read == -1) { - Dperror("Failed to read hiberfil.sys"); + ntfs_log_perror("Failed to read hiberfil.sys"); goto out; } if (bytes_read < NTFS_HIBERFILE_HEADER_SIZE) { - Dprintf("Hibernated non-system partition, refused to mount!\n"); + ntfs_log_debug("Hibernated non-system partition, refused to " + "mount!\n"); errno = EPERM; goto out; } if (memcmp(buf, "hibr", 4) == 0) { - Dprintf("Windows is hibernated, refused to mount!\n"); + ntfs_log_debug("Windows is hibernated, refused to mount!\n"); errno = EPERM; goto out; } for (i = 0; i < NTFS_HIBERFILE_HEADER_SIZE; i++) { if (buf[i]) { - Dprintf("Windows is hibernated, won't mount!\n"); + ntfs_log_debug("Windows is hibernated, won't mount!\n"); errno = EPERM; goto out; } @@ -738,8 +735,7 @@ static int ntfs_volume_check_hiberfile(ntfs_volume *vol) out: if (na) ntfs_attr_close(na); - if (buf) - free(buf); + free(buf); ntfs_inode_close(ni); return ret; } @@ -769,9 +765,9 @@ out: ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) { s64 l; -#ifdef DEBUG - const char *OK = "OK"; - const char *FAILED = "FAILED"; +#ifndef NTFS_DISABLE_DEBUG_LOGGING + const char *OK = "OK\n"; + const char *FAILED = "FAILED\n"; #endif ntfs_volume *vol; u8 *m = NULL, *m2 = NULL; @@ -786,7 +782,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) vol = ntfs_volume_startup(dev, rwflag); if (!vol) { - Dperror("Failed to startup volume"); + ntfs_log_perror("Failed to startup volume"); return NULL; } @@ -794,7 +790,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) m = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); m2 = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); if (!m || !m2) { - Dperror("Failed to allocate memory"); + ntfs_log_perror("Failed to allocate memory"); goto error_exit; } @@ -802,9 +798,10 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) vol->mft_record_size, m); if (l != vol->mftmirr_size) { if (l == -1) - Dperror("Failed to read $MFT"); + ntfs_log_perror("Failed to read $MFT"); else { - Dputs("Length of data not equal expected length."); + ntfs_log_debug("Length of data not equal expected " + "length.\n"); errno = EIO; } goto error_exit; @@ -813,14 +810,15 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) vol->mft_record_size, m2); if (l != vol->mftmirr_size) { if (l == -1) - Dperror("Failed to read $MFTMirr"); + ntfs_log_perror("Failed to read $MFTMirr"); else { - Dputs("Length of data not equal expected length."); + ntfs_log_debug("Length of data not equal expected " + "length.\n"); errno = EIO; } goto error_exit; } - Dprintf("Comparing $MFTMirr to $MFT... "); + ntfs_log_debug("Comparing $MFTMirr to $MFT... "); for (i = 0; i < vol->mftmirr_size; ++i) { const char *ESTR[12] = { "$MFT", "$MFTMirr", "$LogFile", "$Volume", "$AttrDef", "root directory", "$Bitmap", @@ -835,74 +833,75 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) s = "mft record"; if (ntfs_is_baad_recordp(m + i * vol->mft_record_size)) { - Dputs("FAILED"); - Dprintf("$MFT error: Incomplete multi sector transfer " + ntfs_log_debug("FAILED\n"); + ntfs_log_debug("$MFT error: Incomplete multi sector transfer " "detected in %s.\n", s); goto io_error_exit; } if (!ntfs_is_mft_recordp(m + i * vol->mft_record_size)) { - Dputs("FAILED"); - Dprintf("$MFT error: Invalid mft record for %s.\n", s); + ntfs_log_debug("FAILED\n"); + ntfs_log_debug("$MFT error: Invalid mft record for %s.\n", s); goto io_error_exit; } if (ntfs_is_baad_recordp(m2 + i * vol->mft_record_size)) { - Dputs("FAILED"); - Dprintf("$MFTMirr error: Incomplete multi sector " + ntfs_log_debug("FAILED\n"); + ntfs_log_debug("$MFTMirr error: Incomplete multi sector " "transfer detected in %s.\n", s); goto io_error_exit; } if (!ntfs_is_mft_recordp(m2 + i * vol->mft_record_size)) { - Dputs("FAILED"); - Dprintf("$MFTMirr error: Invalid mft record for %s.\n", - s); + ntfs_log_debug("FAILED\n"); + ntfs_log_debug("$MFTMirr error: Invalid mft record for " + "%s.\n", s); goto io_error_exit; } if (memcmp((u8*)m + i * vol->mft_record_size, (u8*)m2 + i * vol->mft_record_size, ntfs_mft_record_get_data_size((MFT_RECORD*)( (u8*)m + i * vol->mft_record_size)))) { - Dputs(FAILED); - Dputs("$MFTMirr does not match $MFT. Run chkdsk."); + ntfs_log_debug(FAILED); + ntfs_log_debug("$MFTMirr does not match $MFT. Run " + "chkdsk.\n"); goto io_error_exit; } } - Dputs(OK); + ntfs_log_debug(OK); free(m2); free(m); m = m2 = NULL; /* Now load the bitmap from $Bitmap. */ - Dprintf("Loading $Bitmap... "); + ntfs_log_debug("Loading $Bitmap... "); vol->lcnbmp_ni = ntfs_inode_open(vol, FILE_Bitmap); if (!vol->lcnbmp_ni) { - Dputs(FAILED); - Dperror("Failed to open inode"); + ntfs_log_debug(FAILED); + ntfs_log_perror("Failed to open inode"); goto error_exit; } /* Get an ntfs attribute for $Bitmap/$DATA. */ vol->lcnbmp_na = ntfs_attr_open(vol->lcnbmp_ni, AT_DATA, AT_UNNAMED, 0); if (!vol->lcnbmp_na) { - Dputs(FAILED); - Dperror("Failed to open ntfs attribute"); + ntfs_log_debug(FAILED); + ntfs_log_perror("Failed to open ntfs attribute"); goto error_exit; } /* Done with the $Bitmap mft record. */ - Dputs(OK); + ntfs_log_debug(OK); /* Now load the upcase table from $UpCase. */ - Dprintf("Loading $UpCase... "); + ntfs_log_debug("Loading $UpCase... "); ni = ntfs_inode_open(vol, FILE_UpCase); if (!ni) { - Dputs(FAILED); - Dperror("Failed to open inode"); + ntfs_log_debug(FAILED); + ntfs_log_perror("Failed to open inode"); goto error_exit; } /* Get an ntfs attribute for $UpCase/$DATA. */ na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); if (!na) { - Dputs(FAILED); - Dperror("Failed to open ntfs attribute"); + ntfs_log_debug(FAILED); + ntfs_log_perror("Failed to open ntfs attribute"); goto error_exit; } /* @@ -912,8 +911,9 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) * characters. */ if (na->data_size & ~0x1ffffffffULL) { - Dputs(FAILED); - Dputs("Error: Upcase table is too big (max 32-bit allowed)."); + ntfs_log_debug(FAILED); + ntfs_log_debug("Error: Upcase table is too big (max 32-bit " + "allowed).\n"); errno = EINVAL; goto error_exit; } @@ -923,58 +923,58 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) free(vol->upcase); vol->upcase = (ntfschar*)malloc(na->data_size); if (!vol->upcase) { - Dputs(FAILED); - Dputs("Not enough memory to load $UpCase."); + ntfs_log_debug(FAILED); + ntfs_log_debug("Not enough memory to load $UpCase.\n"); goto error_exit; } } /* Read in the $DATA attribute value into the buffer. */ l = ntfs_attr_pread(na, 0, na->data_size, vol->upcase); if (l != na->data_size) { - Dputs(FAILED); - Dputs("Amount of data read does not correspond to expected " - "length!"); + ntfs_log_debug(FAILED); + ntfs_log_debug("Amount of data read does not correspond to expected " + "length!\n"); errno = EIO; goto error_exit; } /* Done with the $UpCase mft record. */ - Dputs(OK); + ntfs_log_debug(OK); ntfs_attr_close(na); if (ntfs_inode_close(ni)) - Dperror("Failed to close inode, leaking memory"); + ntfs_log_perror("Failed to close inode, leaking memory"); /* * Now load $Volume and set the version information and flags in the * vol structure accordingly. */ - Dprintf("Loading $Volume... "); + ntfs_log_debug("Loading $Volume... "); vol->vol_ni = ntfs_inode_open(vol, FILE_Volume); if (!vol->vol_ni) { - Dputs(FAILED); - Dperror("Failed to open inode"); + ntfs_log_debug(FAILED); + ntfs_log_perror("Failed to open inode"); goto error_exit; } /* Get a search context for the $Volume/$VOLUME_INFORMATION lookup. */ ctx = ntfs_attr_get_search_ctx(vol->vol_ni, NULL); if (!ctx) { - Dputs(FAILED); - Dperror("Failed to allocate attribute search context"); + ntfs_log_debug(FAILED); + ntfs_log_perror("Failed to allocate attribute search context"); goto error_exit; } /* Find the $VOLUME_INFORMATION attribute. */ if (ntfs_attr_lookup(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - Dputs(FAILED); - Dputs("$VOLUME_INFORMATION attribute not found in " - "$Volume?!?"); + ntfs_log_debug(FAILED); + ntfs_log_debug("$VOLUME_INFORMATION attribute not found in " + "$Volume?!?\n"); goto error_exit; } a = ctx->attr; /* Has to be resident. */ if (a->non_resident) { - Dputs(FAILED); - Dputs("Error: Attribute $VOLUME_INFORMATION must be resident " - "(and it isn't)!"); + ntfs_log_debug(FAILED); + ntfs_log_debug("Error: Attribute $VOLUME_INFORMATION must be " + "resident (and it isn't)!\n"); errno = EIO; goto error_exit; } @@ -985,9 +985,9 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) le32_to_cpu(ctx->mrec->bytes_in_use) || le16_to_cpu(a->value_offset) + le32_to_cpu( a->value_length) > le32_to_cpu(a->length)) { - Dputs(FAILED); - Dputs("Error: Attribute $VOLUME_INFORMATION in $Volume is " - "corrupt!"); + ntfs_log_debug(FAILED); + ntfs_log_debug("Error: Attribute $VOLUME_INFORMATION in $Volume is " + "corrupt!\n"); errno = EIO; goto error_exit; } @@ -1004,10 +1004,10 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) if (ntfs_attr_lookup(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { if (errno != ENOENT) { - Dputs(FAILED); - Dputs("Error: Lookup of $VOLUME_NAME attribute in " + ntfs_log_debug(FAILED); + ntfs_log_debug("Error: Lookup of $VOLUME_NAME attribute in " "$Volume failed. This probably means " - "something is corrupt. Run chkdsk."); + "something is corrupt. Run chkdsk.\n"); goto error_exit; } /* @@ -1017,9 +1017,9 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) */ vol->vol_name = malloc(1); if (!vol->vol_name) { - Dputs(FAILED); - Dputs("Error: Unable to allocate memory for volume " - "name!"); + ntfs_log_debug(FAILED); + ntfs_log_debug("Error: Unable to allocate memory for volume " + "name!\n"); goto error_exit; } vol->vol_name[0] = '\0'; @@ -1027,9 +1027,9 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) a = ctx->attr; /* Has to be resident. */ if (a->non_resident) { - Dputs(FAILED); - Dputs("Error: Attribute $VOLUME_NAME must be " - "resident!"); + ntfs_log_debug(FAILED); + ntfs_log_debug("Error: Attribute $VOLUME_NAME must be " + "resident!\n"); errno = EIO; goto error_exit; } @@ -1042,15 +1042,15 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) */ vol->vol_name = NULL; if (ntfs_ucstombs(vname, u, &vol->vol_name, 0) == -1) { - Dperror("Error: Volume name could not be converted to " - "current locale"); - Dputs("Forcing name into ASCII by replacing non-ASCII " - "characters with underscores."); + ntfs_log_perror("Error: Volume name could not be converted " + "to current locale"); + ntfs_log_debug("Forcing name into ASCII by replacing " + "non-ASCII characters with underscores.\n"); vol->vol_name = malloc(u + 1); if (!vol->vol_name) { - Dputs(FAILED); - Dputs("Error: Unable to allocate memory for " - "volume name!"); + ntfs_log_debug(FAILED); + ntfs_log_debug("Error: Unable to allocate memory for " + "volume name!\n"); goto error_exit; } for (j = 0; j < (s32)u; j++) { @@ -1062,53 +1062,53 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) vol->vol_name[u] = '\0'; } } - Dputs(OK); + ntfs_log_debug(OK); ntfs_attr_put_search_ctx(ctx); ctx = NULL; /* Now load the attribute definitions from $AttrDef. */ - Dprintf("Loading $AttrDef... "); + ntfs_log_debug("Loading $AttrDef... "); ni = ntfs_inode_open(vol, FILE_AttrDef); if (!ni) { - Dputs(FAILED); - Dperror("Failed to open inode"); + ntfs_log_debug(FAILED); + ntfs_log_perror("Failed to open inode"); goto error_exit; } /* Get an ntfs attribute for $AttrDef/$DATA. */ na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); if (!na) { - Dputs(FAILED); - Dperror("Failed to open ntfs attribute"); + ntfs_log_debug(FAILED); + ntfs_log_perror("Failed to open ntfs attribute"); goto error_exit; } /* Check we don't overflow 32-bits. */ if (na->data_size > 0xffffffffLL) { - Dputs(FAILED); - Dputs("Error: Attribute definition table is too big " - "(max 32-bit allowed)."); + ntfs_log_debug(FAILED); + ntfs_log_debug("Error: Attribute definition table is too big (max " + "32-bit allowed).\n"); errno = EINVAL; goto error_exit; } vol->attrdef_len = na->data_size; vol->attrdef = (ATTR_DEF*)malloc(na->data_size); if (!vol->attrdef) { - Dputs(FAILED); - Dputs("Not enough memory to load $AttrDef."); + ntfs_log_debug(FAILED); + ntfs_log_debug("Not enough memory to load $AttrDef.\n"); goto error_exit; } /* Read in the $DATA attribute value into the buffer. */ l = ntfs_attr_pread(na, 0, na->data_size, vol->attrdef); if (l != na->data_size) { - Dputs(FAILED); - Dputs("Amount of data read does not correspond to expected " - "length!"); + ntfs_log_debug(FAILED); + ntfs_log_debug("Amount of data read does not correspond to expected " + "length!\n"); errno = EIO; goto error_exit; } /* Done with the $AttrDef mft record. */ - Dputs(OK); + ntfs_log_debug(OK); ntfs_attr_close(na); if (ntfs_inode_close(ni)) - Dperror("Failed to close inode, leaking memory"); + ntfs_log_perror("Failed to close inode, leaking memory"); /* * Check for dirty logfile and hibernated Windows. * We care only about read-write mounts. @@ -1127,10 +1127,8 @@ error_exit: eo = errno; if (ctx) ntfs_attr_put_search_ctx(ctx); - if (m) - free(m); - if (m2) - free(m2); + free(m); + free(m2); __ntfs_volume_release(vol); errno = eo; return NULL; @@ -1267,7 +1265,11 @@ int ntfs_umount(ntfs_volume *vol, #ifdef HAVE_MNTENT_H #ifndef HAVE_REALPATH -/* If there is no realpath() on the system, provide a dummy one. */ +/** + * Internal: + * + * realpath - If there is no realpath on the system + */ static char *realpath(const char *path, char *resolved_path) { strncpy(resolved_path, path, PATH_MAX); @@ -1275,7 +1277,6 @@ static char *realpath(const char *path, char *resolved_path) return resolved_path; } #endif - /** * Internal: * @@ -1327,8 +1328,7 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) #endif exit: free(real_file); - if (real_fsname) - free(real_fsname); + free(real_fsname); if (err) { errno = err; return -1; @@ -1441,19 +1441,19 @@ int ntfs_logfile_reset(ntfs_volume *vol) } if ((ni = ntfs_inode_open(vol, FILE_LogFile)) == NULL) { - Dperror("Failed to open inode FILE_LogFile.\n"); + ntfs_log_perror("Failed to open inode FILE_LogFile."); return -1; } if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) { eo = errno; - Dperror("Failed to open $FILE_LogFile/$DATA\n"); + ntfs_log_perror("Failed to open $FILE_LogFile/$DATA"); goto error_exit; } if (ntfs_empty_logfile(na)) { eo = errno; - Dperror("Failed to empty $FILE_LogFile/$DATA\n"); + ntfs_log_perror("Failed to empty $FILE_LogFile/$DATA"); ntfs_attr_close(na); goto error_exit; } @@ -1490,20 +1490,20 @@ int ntfs_volume_write_flags(ntfs_volume *vol, const u16 flags) /* Get a pointer to the volume information attribute. */ ctx = ntfs_attr_get_search_ctx(vol->vol_ni, NULL); if (!ctx) { - Dperror("Failed to allocate attribute search context"); + ntfs_log_perror("Failed to allocate attribute search context"); return -1; } if (ntfs_attr_lookup(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - Dputs("Error: Attribute $VOLUME_INFORMATION was not found in " - "$Volume!"); + ntfs_log_debug("Error: Attribute $VOLUME_INFORMATION was not found " + "in $Volume!\n"); goto err_out; } a = ctx->attr; /* Sanity check. */ if (a->non_resident) { - Dputs("Error: Attribute $VOLUME_INFORMATION must be resident " - "(and it isn't)!"); + ntfs_log_debug("Error: Attribute $VOLUME_INFORMATION must be " + "resident (and it isn't)!\n"); errno = EIO; goto err_out; } @@ -1514,8 +1514,8 @@ int ntfs_volume_write_flags(ntfs_volume *vol, const u16 flags) le32_to_cpu(ctx->mrec->bytes_in_use) || le16_to_cpu(a->value_offset) + le32_to_cpu(a->value_length) > le32_to_cpu(a->length)) { - Dputs("Error: Attribute $VOLUME_INFORMATION in $Volume is " - "corrupt!"); + ntfs_log_debug("Error: Attribute $VOLUME_INFORMATION in $Volume is " + "corrupt!\n"); errno = EIO; goto err_out; } @@ -1524,7 +1524,7 @@ int ntfs_volume_write_flags(ntfs_volume *vol, const u16 flags) /* Write them to disk. */ ntfs_inode_mark_dirty(vol->vol_ni); if (ntfs_inode_sync(vol->vol_ni)) { - Dperror("Error writing $Volume"); + ntfs_log_perror("Error writing $Volume"); goto err_out; } ret = 0; /* success */ @@ -1538,13 +1538,8 @@ err_out: #include "tree.h" -// XXX temp -#define Eprintf printf -#define Vprintf printf -#define Qprintf printf - /** - * utils_valid_device - Perform some safety checks on the device, before we start + * utils_valid_device - Perform some safety checks on the device before we start * @name: Full pathname of the device/file to work with * @force: Continue regardless of problems * @@ -1554,7 +1549,7 @@ err_out: * Return: 1 Success, we can continue * 0 Error, we cannot use this device */ -int utils_valid_device (const char *name, int force) +int utils_valid_device(const char *name, int force) { unsigned long mnt_flags = 0; struct stat st; @@ -1568,39 +1563,44 @@ int utils_valid_device (const char *name, int force) return 0; } - if (stat (name, &st) == -1) { + if (stat(name, &st) == -1) { if (errno == ENOENT) { - Eprintf ("The device %s doesn't exist\n", name); + ntfs_log_error("The device %s doesn't exist\n", name); } else { - Eprintf ("Error getting information about %s: %s\n", name, strerror (errno)); + ntfs_log_perror("Error getting information about %s", + name); } return 0; } - if (!S_ISBLK (st.st_mode)) { - Vprintf ("%s is not a block device.\n", name); + if (!S_ISBLK(st.st_mode)) { + ntfs_log_verbose("%s is not a block device.\n", name); if (!force) { - Eprintf ("Use the force option to work with files.\n"); + ntfs_log_error("Use the force option to work with " + "files.\n"); return 0; } - Vprintf ("Forced to continue.\n"); + ntfs_log_verbose("Forced to continue.\n"); } /* Make sure the file system is not mounted. */ - if (ntfs_check_if_mounted (name, &mnt_flags)) { - Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); + if (ntfs_check_if_mounted(name, &mnt_flags)) { + ntfs_log_perror("Failed to determine whether %s is mounted", + name); if (!force) { - Eprintf ("Use the force option to ignore this error.\n"); + ntfs_log_error("Use the force option to ignore this " + "error.\n"); return 0; } - Vprintf ("Forced to continue.\n"); + ntfs_log_verbose("Forced to continue.\n"); } else if (mnt_flags & NTFS_MF_MOUNTED) { - Vprintf ("The device %s, is mounted.\n", name); + ntfs_log_verbose("The device %s, is mounted.\n", name); if (!force) { - Eprintf ("Use the force option to work a mounted filesystem.\n"); + ntfs_log_error("Use the force option to work a mounted " + "filesystem.\n"); return 0; } - Vprintf ("Forced to continue.\n"); + ntfs_log_verbose("Forced to continue.\n"); } return 1; @@ -1609,7 +1609,7 @@ int utils_valid_device (const char *name, int force) /** * utils_mount_volume */ -ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force) +ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL force) { ntfs_volume *vol; @@ -1618,18 +1618,17 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL return NULL; } - if (!utils_valid_device (device, force)) + if (!utils_valid_device(device, force)) return NULL; - vol = ntfs_mount (device, flags); + vol = ntfs_mount(device, flags); if (!vol) { int err; err = errno; - Eprintf("Couldn't mount device '%s': %s\n", device, - strerror(err)); + ntfs_log_perror("Couldn't mount device '%s'", device); if (err == EOPNOTSUPP) - Eprintf("Windows was either hibernated or did not " + ntfs_log_error("Windows was either hibernated or did not " "shut down properly. Try to mount " "volume in windows, shut down and try " "again.\n"); @@ -1637,13 +1636,15 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL } if (vol->flags & VOLUME_IS_DIRTY) { - Qprintf ("Volume is dirty.\n"); + ntfs_log_quiet("Volume is dirty.\n"); + return NULL; if (!force) { - Eprintf ("Run chkdsk and try again, or use the --force option.\n"); - ntfs_umount (vol, FALSE); + ntfs_log_error("Run chkdsk and try again, or use the " + "--force option.\n"); + ntfs_umount(vol, FALSE); return NULL; } - Qprintf ("Forced to continue.\n"); + ntfs_log_quiet("Forced to continue.\n"); } return vol; @@ -1652,19 +1653,19 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL /** * ntfs_volume_commit */ -int ntfs_volume_commit (ntfs_volume *vol) +int ntfs_volume_commit(ntfs_volume *vol) { if (!vol) return -1; - printf ("commit volume\n"); - if (ntfs_bmp_commit (vol->private_bmp1) < 0) + ntfs_log_debug("commit volume\n"); + if (ntfs_bmp_commit(vol->private_bmp1) < 0) return -1; - if (ntfs_bmp_commit (vol->private_bmp2) < 0) + if (ntfs_bmp_commit(vol->private_bmp2) < 0) return -1; - if (ntfs_dir_commit (vol->private_data) < 0) + if (ntfs_dir_commit(vol->private_data) < 0) return -1; return 0; @@ -1673,18 +1674,18 @@ int ntfs_volume_commit (ntfs_volume *vol) /** * ntfs_volume_rollback */ -int ntfs_volume_rollback (ntfs_volume *vol) +int ntfs_volume_rollback(ntfs_volume *vol) { if (!vol) return -1; - if (ntfs_bmp_rollback (vol->private_bmp1) < 0) + if (ntfs_bmp_rollback(vol->private_bmp1) < 0) return -1; - if (ntfs_bmp_rollback (vol->private_bmp2) < 0) + if (ntfs_bmp_rollback(vol->private_bmp2) < 0) return -1; - if (ntfs_dir_rollback (vol->private_data) < 0) + if (ntfs_dir_rollback(vol->private_data) < 0) return -1; return 0; @@ -1693,7 +1694,7 @@ int ntfs_volume_rollback (ntfs_volume *vol) /** * ntfs_volume_umount2 */ -int ntfs_volume_umount2 (ntfs_volume *vol, const BOOL force) +int ntfs_volume_umount2(ntfs_volume *vol, const BOOL force) { struct ntfs_dir *dir; struct ntfs_bmp *bmp; @@ -1701,27 +1702,27 @@ int ntfs_volume_umount2 (ntfs_volume *vol, const BOOL force) if (!vol) return 0; - ntfs_volume_rollback (vol); + ntfs_volume_rollback(vol); dir = (struct ntfs_dir *) vol->private_data; vol->private_data = NULL; - ntfs_dir_free (dir); + ntfs_dir_free(dir); bmp = (struct ntfs_bmp *) vol->private_bmp1; vol->private_bmp1 = NULL; - ntfs_bmp_free (bmp); + ntfs_bmp_free(bmp); bmp = (struct ntfs_bmp *) vol->private_bmp2; vol->private_bmp2 = NULL; - ntfs_bmp_free (bmp); + ntfs_bmp_free(bmp); - return ntfs_umount (vol, force); + return ntfs_umount(vol, force); } /** * ntfs_volume_mount2 */ -ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL force) +ntfs_volume * ntfs_volume_mount2(const char *device, unsigned long flags, BOOL force) { // XXX can we replace these and search by mft number? Hmm... NO. // unless I have a recursive search for an MFT number @@ -1767,7 +1768,7 @@ ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL struct ntfs_dt *found; int num; - vol = utils_mount_volume (device, flags, force); + vol = utils_mount_volume(device, flags, force); if (!vol) return NULL; @@ -1779,23 +1780,23 @@ ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL vol->mft_ni ->private_data = NULL; vol->mftmirr_ni->private_data = NULL; - dir = ntfs_dir_create (vol, FILE_root); + dir = ntfs_dir_create(vol, FILE_root); if (!dir) { - ntfs_volume_umount2 (vol, FALSE); + ntfs_volume_umount2(vol, FALSE); vol = NULL; goto done; } - dir->index = ntfs_dt_create (dir, NULL, -1); + dir->index = ntfs_dt_create(dir, NULL, -1); root = dir->index; //$Bitmap num = -1; - found = ntfs_dt_find2 (root, bmp, sizeof (bmp) - 1, &num); + found = ntfs_dt_find2(root, bmp, sizeof(bmp) - 1, &num); if ((!found) || (num < 0)) { - printf ("can't find $Bitmap\n"); - ntfs_volume_umount2 (vol, FALSE); + ntfs_log_debug("can't find $Bitmap\n"); + ntfs_volume_umount2(vol, FALSE); vol = NULL; goto done; } @@ -1805,10 +1806,10 @@ ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL //$MFT num = -1; - found = ntfs_dt_find2 (root, mft, sizeof (mft) - 1, &num); + found = ntfs_dt_find2(root, mft, sizeof(mft) - 1, &num); if ((!found) || (num < 0)) { - printf ("can't find $MFT\n"); - ntfs_volume_umount2 (vol, FALSE); + ntfs_log_debug("can't find $MFT\n"); + ntfs_volume_umount2(vol, FALSE); vol = NULL; goto done; } @@ -1818,10 +1819,10 @@ ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL //$MFTMirr num = -1; - found = ntfs_dt_find2 (root, mftmirr, sizeof (mftmirr) - 1, &num); + found = ntfs_dt_find2(root, mftmirr, sizeof(mftmirr) - 1, &num); if ((!found) || (num < 0)) { - printf ("can't find $MFTMirr\n"); - ntfs_volume_umount2 (vol, FALSE); + ntfs_log_debug("can't find $MFTMirr\n"); + ntfs_volume_umount2(vol, FALSE); vol = NULL; goto done; } @@ -1831,10 +1832,10 @@ ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL // root directory num = -1; - found = ntfs_dt_find2 (root, dot, 1, &num); + found = ntfs_dt_find2(root, dot, 1, &num); if ((!found) || (num < 0)) { - printf ("can't find the root directory\n"); - ntfs_volume_umount2 (vol, FALSE); + ntfs_log_debug("can't find the root directory\n"); + ntfs_volume_umount2(vol, FALSE); vol = NULL; goto done; } @@ -1844,12 +1845,12 @@ ntfs_volume * ntfs_volume_mount2 (const char *device, unsigned long flags, BOOL dir->inode->private_data = found; dir->inode->ref_count = 2; - vol->private_bmp1 = ntfs_bmp_create (vol->mft_ni, AT_BITMAP, NULL, 0); - vol->private_bmp2 = ntfs_bmp_create (vol->lcnbmp_ni, AT_DATA, NULL, 0); + vol->private_bmp1 = ntfs_bmp_create(vol->mft_ni, AT_BITMAP, NULL, 0); + vol->private_bmp2 = ntfs_bmp_create(vol->lcnbmp_ni, AT_DATA, NULL, 0); if (!vol->private_bmp1 || !vol->private_bmp2) { - printf ("can't find the bitmaps\n"); - ntfs_volume_umount2 (vol, FALSE); + ntfs_log_debug("can't find the bitmaps\n"); + ntfs_volume_umount2(vol, FALSE); vol = NULL; goto done; } diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index 8ce5aad3..aef3c517 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -48,7 +48,7 @@ ntfsfix_SOURCES = ntfsfix.c utils.c utils.h ntfsfix_LDADD = $(AM_LIBS) ntfsfix_LDFLAGS = $(AM_LFLAGS) -mkntfs_SOURCES = attrdef.c upcase.c boot.c sd.c mkntfs.c utils.c utils.h +mkntfs_SOURCES = attrdef.c attrdef.h upcase.c upcase.h boot.c boot.h sd.c sd.h mkntfs.c utils.c utils.h mkntfs_LDADD = $(AM_LIBS) mkntfs_LDFLAGS = $(AM_LFLAGS) diff --git a/ntfsprogs/attrdef.c b/ntfsprogs/attrdef.c index c55a8d5f..3cdaf400 100644 --- a/ntfsprogs/attrdef.c +++ b/ntfsprogs/attrdef.c @@ -203,7 +203,8 @@ const unsigned char attrdef_ntfs3x_array[2560] = { , 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00 +, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF , 0x24, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x44, 0x00, 0x45, 0x00, 0x58, 0x00, 0x5F, 0x00, 0x41, 0x00, 0x4C, 0x00, 0x4C, 0x00, 0x4F, 0x00, 0x43, 0x00, 0x41, 0x00, 0x54, 0x00 , 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 @@ -245,3 +246,4 @@ const unsigned char attrdef_ntfs3x_array[2560] = { , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 897633ab..290cda0d 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -140,6 +140,10 @@ #include "runlist.h" #include "utils.h" #include "ntfstime.h" +#include "sd.h" +#include "upcase.h" +#include "boot.h" +#include "attrdef.h" #include "version.h" #ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS @@ -148,15 +152,6 @@ You need to run ./configure without the --disable-default-device-io-ops \ switch if you want to be able to build the NTFS utilities." #endif -extern const unsigned char attrdef_ntfs12_array[2400]; -extern const unsigned char attrdef_ntfs3x_array[2560]; -extern const unsigned char boot_array[3429]; -extern void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len); -extern void init_upcase_table(ntfschar *uc, u32 uc_len); -extern void init_secure_30(char *idx_secure); -extern void init_secure_31(char *idx_secure); -extern void init_root_sd_31(u8 **sd_val, int *sd_val_len); - /* Page size on ia32. Can change to 8192 on Alpha. */ #define NTFS_PAGE_SIZE 4096 @@ -344,7 +339,7 @@ static void usage(void) " -v Verbose execution\n" " -vv Very verbose execution\n" " -V Display version \n" - " -w NTFS version " + " -w NTFS version " "information\n" " -l Display licensing " "information\n" @@ -354,7 +349,6 @@ static void usage(void) exit(1); } -#include "version.h" /** * parse_options */ @@ -417,34 +411,34 @@ static void parse_options(int argc, char *argv[]) case 'v': opts.verbose++; break; - case 'w': - if (!strcmp(optarg , "1.2")) { + case 'w': + if (!strcmp(optarg , "1.2")) { vol->major_ver = 1; vol->minor_ver = 2; - opts.attr_defs = + opts.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; - opts.attr_defs_len = + opts.attr_defs_len = sizeof(attrdef_ntfs12_array); break; } - if (!strcmp(optarg , "3.0")) { - vol->major_ver = 3; - vol->minor_ver = 0; - opts.attr_defs = - (ATTR_DEF*)&attrdef_ntfs3x_array; - opts.attr_defs_len = - sizeof(attrdef_ntfs3x_array); - break; - } - if (!strcmp(optarg , "3.1")) { - vol->major_ver = 3; - vol->minor_ver = 1; - opts.attr_defs = + if (!strcmp(optarg , "3.0")) { + vol->major_ver = 3; + vol->minor_ver = 0; + opts.attr_defs = (ATTR_DEF*)&attrdef_ntfs3x_array; - opts.attr_defs_len = + opts.attr_defs_len = + sizeof(attrdef_ntfs3x_array); + break; + } + if (!strcmp(optarg , "3.1")) { + vol->major_ver = 3; + vol->minor_ver = 1; + opts.attr_defs = + (ATTR_DEF*)&attrdef_ntfs3x_array; + opts.attr_defs_len = sizeof(attrdef_ntfs3x_array); - break; - } + break; + } err_exit("Ntfs version not supported.\n"); case 'z': l = strtol(optarg, &s, 0); @@ -574,7 +568,7 @@ static __inline__ long long mkntfs_write(struct ntfs_device *dev, */ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, const u8 *val, const s64 val_len, s64 *inited_size) -{ +{ s64 bytes_written, total, length, delta; int retry, i; @@ -1696,8 +1690,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, err_out: if (ctx) ntfs_attr_put_search_ctx(ctx); - if (uname) - free(uname); + free(uname); return err; } @@ -1887,8 +1880,7 @@ err_out: ntfs_attr_put_search_ctx(ctx); if (uname && (uname != AT_UNNAMED)) free(uname); - if (rl) - free(rl); + free(rl); return err; } @@ -2004,7 +1996,7 @@ err_out: * add_attr_std_info * Return 0 on success or -errno on error. */ -static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags, +static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags, u32 security_id) { STANDARD_INFORMATION si; @@ -2024,7 +2016,7 @@ static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags, si.version_number = cpu_to_le32(0); si.class_id = cpu_to_le32(0); si.security_id = security_id; - if (si.security_id != 0) + if (si.security_id != 0) sd_size = 72; /* FIXME: $Quota support... */ si.owner_id = cpu_to_le32(0); @@ -2127,23 +2119,23 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, */ static int add_attr_object_id(MFT_RECORD *m, OBJECT_ID_ATTR *objid_attr, - int objid_attr_len) + int objid_attr_len) { - int err; + int err; - /* Does it fit? NO: create non-resident. YES: create resident. */ - if (le32_to_cpu(m->bytes_in_use) + 24 + objid_attr_len > - le32_to_cpu(m->bytes_allocated)) - err = insert_non_resident_attr_in_mft_record(m, - AT_OBJECT_ID, NULL, 0, 0, 0, (u8*)objid_attr, - objid_attr_len); - else - err = insert_resident_attr_in_mft_record(m, - AT_OBJECT_ID, NULL, 0, 0, 0, 0, + /* Does it fit? NO: create non-resident. YES: create resident. */ + if (le32_to_cpu(m->bytes_in_use) + 24 + objid_attr_len > + le32_to_cpu(m->bytes_allocated)) + err = insert_non_resident_attr_in_mft_record(m, + AT_OBJECT_ID, NULL, 0, 0, 0, (u8*)objid_attr, + objid_attr_len); + else + err = insert_resident_attr_in_mft_record(m, + AT_OBJECT_ID, NULL, 0, 0, 0, 0, (u8*)objid_attr, objid_attr_len); - if (err < 0) - Eprintf("add_attr_volume_id failed: %s\n", strerror(-err)); - return err; + if (err < 0) + Eprintf("add_attr_volume_id failed: %s\n", strerror(-err)); + return err; } @@ -2267,8 +2259,7 @@ static int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, } i = insert_resident_attr_in_mft_record(m, AT_VOLUME_NAME, NULL, 0, 0, 0, 0, (u8*)uname, len); - if (uname) - free(uname); + free(uname); if (i < 0) Eprintf("add_attr_vol_name failed: %s\n", strerror(-i)); return i; @@ -2477,21 +2468,18 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { Eprintf("Failed to allocate attribute search context.\n"); - if (uname) - free(uname); + free(uname); return -ENOMEM; } if (ic == IGNORE_CASE) { Eprintf("FIXME: Hit unimplemented code path #4.\n"); err = -EOPNOTSUPP; - if (uname) - free(uname); + free(uname); goto err_out; } err = mkntfs_attr_lookup(AT_INDEX_ROOT, uname, name_len, ic, 0, NULL, 0, ctx); - if (uname) - free(uname); + free(uname); if (err) { err = -ENOTDIR; goto err_out; @@ -2599,8 +2587,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, err_out: if (ctx) ntfs_attr_put_search_ctx(ctx); - if (ia_val) - free(ia_val); + free(ia_val); return err; } @@ -2657,13 +2644,13 @@ static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *idx, /* * ntfs_index_keys_compare(char *key1, char *key2, - * COLLATION_RULES *collation_rule) + * COLLATION_RULES *collation_rule) * not alle types of COLLATION_RULES supported yet... * added as needed.. (remove this comment when all is added) - */ + */ -static int ntfs_index_keys_compare(char *key1, char *key2, - int key1_length,int key2_length, +static int ntfs_index_keys_compare(char *key1, char *key2, + int key1_length,int key2_length, COLLATION_RULES collation_rule) { int i, j; @@ -2673,73 +2660,73 @@ static int ntfs_index_keys_compare(char *key1, char *key2, if (collation_rule == COLLATION_NTOFS_ULONG) { //i.e. $SII or $QUOTA-$Q while ((j < min(key1_length, key2_length)) && (i == 0)) { - if (*(u32*)(key1 + j) < *(u32*)(key2 + j)) i = -1; - if (*(u32*)(key1 + j) > *(u32*)(key2 + j)) i = +1; - if (*(u32*)(key1 + j) == *(u32*)(key2 + j)) { + if (*(u32*)(key1 + j) < *(u32*)(key2 + j)) i = -1; + if (*(u32*)(key1 + j) > *(u32*)(key2 + j)) i = +1; + if (*(u32*)(key1 + j) == *(u32*)(key2 + j)) { i = 0; j += 4; - } + } } if ((i == 0) && (key1_length > key2_length)) i = -1; if ((i == 0) && (key1_length < key2_length)) i = +1; - return i; + return i; } if (collation_rule == COLLATION_NTOFS_ULONGS) { //i.e $OBJID-$O - while ((j < min(key1_length, key2_length)) && (i == 0)) { - if (bswap_32(*(u32*)(key1 + j)) < + while ((j < min(key1_length, key2_length)) && (i == 0)) { + if (bswap_32(*(u32*)(key1 + j)) < bswap_32(*(u32*)(key1 + j))) i = -1; - if (bswap_32(*(u32*)(key1 + j)) > + if (bswap_32(*(u32*)(key1 + j)) > bswap_32(*(u32*)(key1 + j))) i = +1; - if (bswap_32(*(u32*)(key1 + j)) == + if (bswap_32(*(u32*)(key1 + j)) == bswap_32(*(u32*)(key1 + j))) { - i = 0; - j += 4; - } - } - if ((i == 0) && (key1_length > key2_length)) i = -1; - if ((i == 0) && (key1_length < key2_length)) i = +1; + i = 0; + j += 4; + } + } + if ((i == 0) && (key1_length > key2_length)) i = -1; + if ((i == 0) && (key1_length < key2_length)) i = +1; - return i; + return i; } if (collation_rule == COLLATION_NTOFS_SECURITY_HASH) { //i.e. $SDH if (((SDH_INDEX_KEY*)key1)->hash < ((SDH_INDEX_KEY*)key2)->hash) i = -1; if (((SDH_INDEX_KEY*)key1)->hash > - ((SDH_INDEX_KEY*)key2)->hash) i = +1; - if (((SDH_INDEX_KEY*)key1)->hash == + ((SDH_INDEX_KEY*)key2)->hash) i = +1; + if (((SDH_INDEX_KEY*)key1)->hash == ((SDH_INDEX_KEY*)key2)->hash) { if (((SDH_INDEX_KEY*)key1)->security_id < ((SDH_INDEX_KEY*)key2)->security_id) i = -1; if (((SDH_INDEX_KEY*)key1)->security_id > ((SDH_INDEX_KEY*)key2)->security_id) i = +1; - if (((SDH_INDEX_KEY*)key1)->security_id == + if (((SDH_INDEX_KEY*)key1)->security_id == ((SDH_INDEX_KEY*)key2)->security_id) i = 0; } - return i; + return i; } - if (collation_rule == COLLATION_NTOFS_SID ) { + if (collation_rule == COLLATION_NTOFS_SID ) { //i.e. $QUOTA-O i = memcmp(key1, key2, min(key1_length, key2_length)); - if ((i == 0) && (key1_length > key2_length)) i = -1; - if ((i == 0) && (key1_length < key2_length)) i = +1; + if ((i == 0) && (key1_length > key2_length)) i = -1; + if ((i == 0) && (key1_length < key2_length)) i = +1; return i; } - err_exit("ntfs_index_keys_compare called without supported " + err_exit("ntfs_index_keys_compare called without supported " "collation rule.\n"); } /** - * insert_index_entry_in_res_dir_index + * insert_index_entry_in_res_dir_index * i.e. insert an index_entry in some named index_root - * simplified search method, works for mkntfs + * simplified search method, works for mkntfs */ -static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, +static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, u32 idx_size, MFT_RECORD *m, ntfschar *name, u32 name_size, ATTR_TYPES type) { @@ -2750,90 +2737,90 @@ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, COLLATION_RULES collation_rule; int err, i; - err = 0; + err = 0; /* does it fit ?*/ if ( vol->mft_record_size > idx_size + m->bytes_allocated ) return -ENOSPC; /* find the INDEX_ROOT attribute:*/ ctx = ntfs_attr_get_search_ctx(NULL, m); - if (!ctx) { - Eprintf("Failed to allocate attribute search context.\n"); - err = -ENOMEM; - goto err_out; - } - if (ntfs_attr_lookup(AT_INDEX_ROOT, name, name_size, 0, 0, + if (!ctx) { + Eprintf("Failed to allocate attribute search context.\n"); + err = -ENOMEM; + goto err_out; + } + if (ntfs_attr_lookup(AT_INDEX_ROOT, name, name_size, 0, 0, NULL, 0, ctx)) { - err = EEXIST; - goto err_out; - } + err = EEXIST; + goto err_out; + } /* found attribute */ a = (ATTR_RECORD*)ctx->attr; - collation_rule = ((INDEX_ROOT*)((char*)a + + collation_rule = ((INDEX_ROOT*)((char*)a + le16_to_cpu(a->value_offset)))->collation_rule; - idx_header = (INDEX_HEADER*)((char*)a + le16_to_cpu(a->value_offset) + idx_header = (INDEX_HEADER*)((char*)a + le16_to_cpu(a->value_offset) + le16_to_cpu(0x10)); - idx_entry = (INDEX_ENTRY*)((char*)idx_header + - le16_to_cpu((idx_header)->entries_offset)); - idx_end = (INDEX_ENTRY*)((char*)idx_entry + + idx_entry = (INDEX_ENTRY*)((char*)idx_header + + le16_to_cpu((idx_header)->entries_offset)); + idx_end = (INDEX_ENTRY*)((char*)idx_entry + le32_to_cpu(idx_header->index_length)); /* - * Loop until we exceed valid memory (corruption case) or until we - * reach the last entry. - */ + * Loop until we exceed valid memory (corruption case) or until we + * reach the last entry. + */ - if (type == AT_FILE_NAME) { - while ((char*)idx_entry < (char*)idx_end && + if (type == AT_FILE_NAME) { + while ((char*)idx_entry < (char*)idx_end && !(idx_entry->flags & INDEX_ENTRY_END)) { - i = ntfs_file_values_compare( + i = ntfs_file_values_compare( (FILE_NAME_ATTR*)&idx->key.file_name, - (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, - IGNORE_CASE, vol->upcase, vol->upcase_len); - /* - * If @file_name collates before ie->key.file_name, + (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, + IGNORE_CASE, vol->upcase, vol->upcase_len); + /* + * If @file_name collates before ie->key.file_name, * there is no - * matching index entry. - */ - if (i == -1) - break; - /* If file names are not equal, continue search. */ - if (i) - goto do_next; - if (((FILE_NAME_ATTR*)&idx->key.file_name)->\ + * matching index entry. + */ + if (i == -1) + break; + /* If file names are not equal, continue search. */ + if (i) + goto do_next; + if (((FILE_NAME_ATTR*)&idx->key.file_name)->\ file_name_type != FILE_NAME_POSIX || - idx_entry->key.file_name.file_name_type + idx_entry->key.file_name.file_name_type != FILE_NAME_POSIX) - return -EEXIST; - - i = ntfs_file_values_compare((FILE_NAME_ATTR*)&idx-> + return -EEXIST; + + i = ntfs_file_values_compare((FILE_NAME_ATTR*)&idx-> key.file_name, - (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, - CASE_SENSITIVE, vol->upcase, vol->upcase_len); - if (i == -1) - break; - /* Complete match. Bugger. Can't insert. */ - /*if (!i) - return -EEXIST; - */ + (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, + CASE_SENSITIVE, vol->upcase, vol->upcase_len); + if (i == -1) + break; + /* Complete match. Bugger. Can't insert. */ + /*if (!i) + return -EEXIST; + */ do_next: - idx_entry = (INDEX_ENTRY*)((char*)idx_entry + + idx_entry = (INDEX_ENTRY*)((char*)idx_entry + le16_to_cpu(idx_entry->length)); } } else if (type == AT_UNUSED) { // case view while ((char*)idx_entry < (char*)idx_end && !(idx_entry->flags & INDEX_ENTRY_END)) { i = ntfs_index_keys_compare((char*)idx_entry + 0x10, - (char*)idx + 0x10, + (char*)idx + 0x10, idx_entry->key_length, idx->key_length, collation_rule); if (!i) { return -EEXIST; } if (i == 1) break; - idx_entry = (INDEX_ENTRY*)((char*)idx_entry + - le16_to_cpu(idx_entry->length)); - } - } else return EINVAL; + idx_entry = (INDEX_ENTRY*)((char*)idx_entry + + le16_to_cpu(idx_entry->length)); + } + } else return EINVAL; memmove((char*)idx_entry + idx_size, (char*)idx_entry, (char*)m + vol->mft_record_size - @@ -2843,13 +2830,13 @@ do_next: m->bytes_in_use += idx_size; a->length += idx_size; a->value_length += idx_size; - ((INDEX_HEADER*)idx_header)->index_length += idx_size; + ((INDEX_HEADER*)idx_header)->index_length += idx_size; ((INDEX_HEADER*)idx_header)->allocated_size += idx_size; err_out: - if (ctx) - ntfs_attr_put_search_ctx(ctx); - return err; + if (ctx) + ntfs_attr_put_search_ctx(ctx); + return err; } /** @@ -2867,11 +2854,11 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) { sds_header = (SECURITY_DESCRIPTOR_HEADER*)sds; sdh_size = cpu_to_le32(0x30); - sii_size = cpu_to_le32(0x28); + sii_size = cpu_to_le32(0x28); idx_entry_sdh = (INDEX_ENTRY*)calloc(1, sizeof(INDEX_ENTRY)); idx_entry_sii = (INDEX_ENTRY*)calloc(1, sizeof(INDEX_ENTRY)); err = 0; - + while ( (char*)sds_header < (char*)sds + sds_size) { //SDH index entry idx_entry_sdh->data_offset = cpu_to_le16(0x18); @@ -2879,64 +2866,64 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) { idx_entry_sdh->reservedV = cpu_to_le32(0x00); idx_entry_sdh->length = cpu_to_le16(0x30); idx_entry_sdh->key_length = cpu_to_le16(0x08); - idx_entry_sdh->flags = cpu_to_le16(0x00); - idx_entry_sdh->reserved = cpu_to_le16(0x00); + idx_entry_sdh->flags = cpu_to_le16(0x00); + idx_entry_sdh->reserved = cpu_to_le16(0x00); idx_entry_sdh->key.sdh.hash = sds_header->hash; idx_entry_sdh->key.sdh.security_id = sds_header->security_id; - sdh_data = (SDH_INDEX_DATA*)((char*)idx_entry_sdh + + sdh_data = (SDH_INDEX_DATA*)((char*)idx_entry_sdh + idx_entry_sdh->data_offset); sdh_data->hash = sds_header->hash; sdh_data->security_id = sds_header->security_id; sdh_data->offset_in_sds = sds_header->offset; - + sdh_data->size_in_sds = sds_header->length; - sdh_data->reserved_II = cpu_to_le64(0x00490049); + sdh_data->reserved_II = cpu_to_le64(0x00490049); //SII index entry idx_entry_sii->data_offset = cpu_to_le16(0x14); - idx_entry_sii->data_length = cpu_to_le16(0x14); - idx_entry_sii->reservedV = cpu_to_le32(0x00); - idx_entry_sii->length = cpu_to_le16(0x28); - idx_entry_sii->key_length = cpu_to_le16(0x04); - idx_entry_sii->flags = cpu_to_le16(0x00); - idx_entry_sii->reserved = cpu_to_le16(0x00); - idx_entry_sii->key.sii.security_id = sds_header->security_id; + idx_entry_sii->data_length = cpu_to_le16(0x14); + idx_entry_sii->reservedV = cpu_to_le32(0x00); + idx_entry_sii->length = cpu_to_le16(0x28); + idx_entry_sii->key_length = cpu_to_le16(0x04); + idx_entry_sii->flags = cpu_to_le16(0x00); + idx_entry_sii->reserved = cpu_to_le16(0x00); + idx_entry_sii->key.sii.security_id = sds_header->security_id; sii_data = (SII_INDEX_DATA*)((char*)idx_entry_sii + idx_entry_sii->data_offset); - sii_data->hash = sds_header->hash; + sii_data->hash = sds_header->hash; sii_data->security_id = sds_header->security_id; sii_data->offset_in_sds = sds_header->offset; sii_data->size_in_sds = sds_header->length; if ((err = insert_index_entry_in_res_dir_index(idx_entry_sdh, sdh_size, m, - SDH, 4, AT_UNUSED))) + SDH, 4, AT_UNUSED))) break; - + if ((err = insert_index_entry_in_res_dir_index(idx_entry_sii, sii_size, m, - SII, 4, AT_UNUSED))) - break; + SII, 4, AT_UNUSED))) + break; sds_header = (SECURITY_DESCRIPTOR_HEADER*)((char*)sds_header + (cpu_to_le32(sds_header->length + 0x0F) & ~cpu_to_le32(0x0F))); - if (!sds_header->length) + if (!sds_header->length) break; } - if(idx_entry_sdh) free(idx_entry_sdh); - if(idx_entry_sii) free(idx_entry_sii); + free(idx_entry_sdh); + free(idx_entry_sii); return err; } /* - * initialize_quota(MFT_RECORD *m) + * initialize_quota(MFT_RECORD *m) * initialize $Quota with the default quota index-entries. */ static int initialize_quota(MFT_RECORD *m) { - + int o_size, q1_size, q2_size, err; INDEX_ENTRY *idx_entry_o, *idx_entry_q1, *idx_entry_q2; QUOTA_O_INDEX_DATA *idx_entry_o_data; @@ -2946,50 +2933,50 @@ static int initialize_quota(MFT_RECORD *m) { q1_size = cpu_to_le32(0x48); q2_size = cpu_to_le32(0x58); - idx_entry_o = (INDEX_ENTRY*)calloc(1, o_size); + idx_entry_o = (INDEX_ENTRY*)calloc(1, o_size); idx_entry_q1 = (INDEX_ENTRY*)calloc(1, q1_size); idx_entry_q2 = (INDEX_ENTRY*)calloc(1, q2_size); - idx_entry_o->data_offset = cpu_to_le16(0x20); - idx_entry_o->data_length = cpu_to_le16(0x04); - idx_entry_o->reservedV = cpu_to_le32(0x00); - idx_entry_o->length = cpu_to_le16(0x28); - idx_entry_o->key_length = cpu_to_le16(0x10); - idx_entry_o->flags = cpu_to_le16(0x00); - idx_entry_o->reserved = cpu_to_le16(0x00); - idx_entry_o->key.sid.revision = 0x01; + idx_entry_o->data_offset = cpu_to_le16(0x20); + idx_entry_o->data_length = cpu_to_le16(0x04); + idx_entry_o->reservedV = cpu_to_le32(0x00); + idx_entry_o->length = cpu_to_le16(0x28); + idx_entry_o->key_length = cpu_to_le16(0x10); + idx_entry_o->flags = cpu_to_le16(0x00); + idx_entry_o->reserved = cpu_to_le16(0x00); + idx_entry_o->key.sid.revision = 0x01; idx_entry_o->key.sid.sub_authority_count = 0x02; - idx_entry_o->key.sid.identifier_authority.high_part = + idx_entry_o->key.sid.identifier_authority.high_part = cpu_to_le16(0x0000); - idx_entry_o->key.sid.identifier_authority.low_part = + idx_entry_o->key.sid.identifier_authority.low_part = cpu_to_le32(0x05000000); idx_entry_o->key.sid.sub_authority[0] = cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - idx_entry_o->key.sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - idx_entry_o_data = (QUOTA_O_INDEX_DATA*)((char*)idx_entry_o - + idx_entry_o->data_offset); - idx_entry_o_data->owner_id = QUOTA_FIRST_USER_ID; + idx_entry_o->key.sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + idx_entry_o_data = (QUOTA_O_INDEX_DATA*)((char*)idx_entry_o + + idx_entry_o->data_offset); + idx_entry_o_data->owner_id = QUOTA_FIRST_USER_ID; // 20 00 00 00 padding after here on ntfs 3.1 ?? err = insert_index_entry_in_res_dir_index(idx_entry_o, - o_size, m, - O, 2, AT_UNUSED); - if (idx_entry_o) free(idx_entry_o); - if (err) return err; + o_size, m, + O, 2, AT_UNUSED); + free(idx_entry_o); + if (err) return err; //q index entry nr. 1 - idx_entry_q1->data_offset = cpu_to_le16(0x14); - idx_entry_q1->data_length = cpu_to_le16(0x30); - idx_entry_q1->reservedV = cpu_to_le32(0x00); - idx_entry_q1->length = cpu_to_le16(0x48); - idx_entry_q1->key_length = cpu_to_le16(0x04); - idx_entry_q1->flags = cpu_to_le16(0x00); - idx_entry_q1->reserved = cpu_to_le16(0x00); - idx_entry_q1->key.owner_id = cpu_to_le16(0x01); - idx_entry_q1_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q1 - + idx_entry_q1->data_offset); - idx_entry_q1_data->version = cpu_to_le32(0x02); + idx_entry_q1->data_offset = cpu_to_le16(0x14); + idx_entry_q1->data_length = cpu_to_le16(0x30); + idx_entry_q1->reservedV = cpu_to_le32(0x00); + idx_entry_q1->length = cpu_to_le16(0x48); + idx_entry_q1->key_length = cpu_to_le16(0x04); + idx_entry_q1->flags = cpu_to_le16(0x00); + idx_entry_q1->reserved = cpu_to_le16(0x00); + idx_entry_q1->key.owner_id = cpu_to_le16(0x01); + idx_entry_q1_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q1 + + idx_entry_q1->data_offset); + idx_entry_q1_data->version = cpu_to_le32(0x02); idx_entry_q1_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; if (vol->minor_ver == 0) idx_entry_q1_data->flags |= QUOTA_FLAG_OUT_OF_DATE; @@ -2997,54 +2984,54 @@ static int initialize_quota(MFT_RECORD *m) { idx_entry_q1_data->change_time = utc2ntfs(time(NULL)); idx_entry_q1_data->threshold = cpu_to_sle64(-0x01); idx_entry_q1_data->limit = cpu_to_sle64(-0x01); - idx_entry_q1_data->exceeded_time = cpu_to_sle64(0x00); + idx_entry_q1_data->exceeded_time = cpu_to_sle64(0x00); - err = insert_index_entry_in_res_dir_index(idx_entry_q1, - q1_size, m, - Q, 2, AT_UNUSED); - if (idx_entry_q1) free(idx_entry_q1); - if (err) return err; + err = insert_index_entry_in_res_dir_index(idx_entry_q1, + q1_size, m, + Q, 2, AT_UNUSED); + free(idx_entry_q1); + if (err) return err; - //q index entry nr. 2 - idx_entry_q2->data_offset = cpu_to_le16(0x14); - idx_entry_q2->data_length = cpu_to_le16(0x40); - idx_entry_q2->reservedV = cpu_to_le32(0x00); - idx_entry_q2->length = cpu_to_le16(0x58); - idx_entry_q2->key_length = cpu_to_le16(0x04); - idx_entry_q2->flags = cpu_to_le16(0x00); - idx_entry_q2->reserved = cpu_to_le16(0x00); - idx_entry_q2->key.owner_id = QUOTA_FIRST_USER_ID; - idx_entry_q2_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q2 - + idx_entry_q2->data_offset); - idx_entry_q2_data->version = cpu_to_le32(0x02); - idx_entry_q2_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; - idx_entry_q2_data->bytes_used = cpu_to_le64(0x00); - idx_entry_q2_data->change_time = utc2ntfs(time(NULL));; - idx_entry_q2_data->threshold = cpu_to_sle64(-0x01); - idx_entry_q2_data->limit = cpu_to_sle64(-0x01); - idx_entry_q2_data->exceeded_time = cpu_to_sle64(0x00); - idx_entry_q2_data->sid.revision = 1; - idx_entry_q2_data->sid.sub_authority_count = 2; - idx_entry_q2_data->sid.identifier_authority.high_part = + //q index entry nr. 2 + idx_entry_q2->data_offset = cpu_to_le16(0x14); + idx_entry_q2->data_length = cpu_to_le16(0x40); + idx_entry_q2->reservedV = cpu_to_le32(0x00); + idx_entry_q2->length = cpu_to_le16(0x58); + idx_entry_q2->key_length = cpu_to_le16(0x04); + idx_entry_q2->flags = cpu_to_le16(0x00); + idx_entry_q2->reserved = cpu_to_le16(0x00); + idx_entry_q2->key.owner_id = QUOTA_FIRST_USER_ID; + idx_entry_q2_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q2 + + idx_entry_q2->data_offset); + idx_entry_q2_data->version = cpu_to_le32(0x02); + idx_entry_q2_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; + idx_entry_q2_data->bytes_used = cpu_to_le64(0x00); + idx_entry_q2_data->change_time = utc2ntfs(time(NULL));; + idx_entry_q2_data->threshold = cpu_to_sle64(-0x01); + idx_entry_q2_data->limit = cpu_to_sle64(-0x01); + idx_entry_q2_data->exceeded_time = cpu_to_sle64(0x00); + idx_entry_q2_data->sid.revision = 1; + idx_entry_q2_data->sid.sub_authority_count = 2; + idx_entry_q2_data->sid.identifier_authority.high_part = cpu_to_le16(0x0000); - idx_entry_q2_data->sid.identifier_authority.low_part = + idx_entry_q2_data->sid.identifier_authority.low_part = cpu_to_le32(0x05000000); - idx_entry_q2_data->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - idx_entry_q2_data->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + idx_entry_q2_data->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + idx_entry_q2_data->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + err = insert_index_entry_in_res_dir_index(idx_entry_q2, + q2_size, m, + Q, 2, AT_UNUSED); + free(idx_entry_q2); - err = insert_index_entry_in_res_dir_index(idx_entry_q2, - q2_size, m, - Q, 2, AT_UNUSED); - if (idx_entry_q2) free(idx_entry_q2); - return err; } /* - * initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) + * initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) * initialize $ObjId with the default index-entries. * It is one entry which belongs to $Volume. (W2k3) */ @@ -3056,27 +3043,27 @@ static int initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) { OBJ_ID_INDEX_DATA *idx_entry_o_data; err = 0; - o_size = cpu_to_le32(0x58); - idx_entry_o = (INDEX_ENTRY*)calloc(1, o_size); + o_size = cpu_to_le32(0x58); + idx_entry_o = (INDEX_ENTRY*)calloc(1, o_size); //o index entry idx_entry_o->data_offset = cpu_to_le16(0x20); - idx_entry_o->data_length = cpu_to_le16(0x38); - idx_entry_o->reservedV = cpu_to_le32(0x00); - idx_entry_o->length = cpu_to_le16(0x58); - idx_entry_o->key_length = cpu_to_le16(0x10); - idx_entry_o->flags = cpu_to_le16(0x00); - idx_entry_o->reserved = cpu_to_le16(0x00); + idx_entry_o->data_length = cpu_to_le16(0x38); + idx_entry_o->reservedV = cpu_to_le32(0x00); + idx_entry_o->length = cpu_to_le16(0x58); + idx_entry_o->key_length = cpu_to_le16(0x10); + idx_entry_o->flags = cpu_to_le16(0x00); + idx_entry_o->reserved = cpu_to_le16(0x00); idx_entry_o->key.object_id = guid; idx_entry_o_data = (OBJ_ID_INDEX_DATA*)((char*)idx_entry_o + idx_entry_o->data_offset); idx_entry_o_data->mft_reference = mref; idx_entry_o_data->birth_volume_id = *zero_guid; - idx_entry_o_data->birth_object_id = *zero_guid; - idx_entry_o_data->domain_id = *zero_guid; + idx_entry_o_data->birth_object_id = *zero_guid; + idx_entry_o_data->domain_id = *zero_guid; err = insert_index_entry_in_res_dir_index(idx_entry_o, - o_size, m, - O, 2, AT_UNUSED); + o_size, m, + O, 2, AT_UNUSED); if (idx_entry_o) free (idx_entry_o); return err; @@ -3225,103 +3212,103 @@ do_next: */ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, - MFT_RECORD *m_file, const MFT_REF ref_file, - const s64 allocated_size, const s64 data_size, - const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, - const u32 reparse_point_tag, const char *file_name, - const FILE_NAME_TYPE_FLAGS file_name_type) + MFT_RECORD *m_file, const MFT_REF ref_file, + const s64 allocated_size, const s64 data_size, + const FILE_ATTR_FLAGS flags, const u16 packed_ea_size, + const u32 reparse_point_tag, const char *file_name, + const FILE_NAME_TYPE_FLAGS file_name_type) { - FILE_NAME_ATTR *fn; - int i, fn_size, idx_size; + FILE_NAME_ATTR *fn; + int i, fn_size, idx_size; INDEX_ENTRY *idx_entry_new; - /* Create the file_name attribute. */ - i = (strlen(file_name) + 1) * sizeof(ntfschar); - fn_size = sizeof(FILE_NAME_ATTR) + i; - fn = (FILE_NAME_ATTR*)malloc(fn_size); - if (!fn) - return -errno; - fn->parent_directory = ref_parent; - // FIXME: Is this correct? Or do we have to copy the creation_time - // from the std info? - fn->creation_time = utc2ntfs(time(NULL)); - fn->last_data_change_time = fn->creation_time; - fn->last_mft_change_time = fn->creation_time; - fn->last_access_time = fn->creation_time; - fn->allocated_size = cpu_to_le64(allocated_size); - fn->data_size = cpu_to_le64(data_size); - fn->file_attributes = flags; - /* These are in a union so can't have both. */ - if (packed_ea_size && reparse_point_tag) { - free(fn); - return -EINVAL; - } - if (packed_ea_size) { - free(fn); - return -EINVAL; - } - if (packed_ea_size) { - fn->packed_ea_size = cpu_to_le16(packed_ea_size); - fn->reserved = cpu_to_le16(0); - } else - fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); - fn->file_name_type = file_name_type; - i = stoucs(fn->file_name, file_name, i); - if (i < 1) { - free(fn); - return -EINVAL; - } - if (i > 0xff) { - free(fn); - return -ENAMETOOLONG; - } - /* No terminating null in file names. */ - fn->file_name_length = i; - fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(ntfschar); - /* Increment the link count of @m_file. */ - i = le16_to_cpu(m_file->link_count); - if (i == 0xffff) { - Eprintf("Too many hardlinks present already.\n"); - free(fn); - return -EINVAL; - } - m_file->link_count = cpu_to_le16(i + 1); - /* Add the file_name to @m_file. */ - i = insert_resident_attr_in_mft_record(m_file, AT_FILE_NAME, NULL, 0, 0, - 0, RESIDENT_ATTR_IS_INDEXED, (u8*)fn, fn_size); - if (i < 0) { - Eprintf("create_hardlink failed adding file name attribute: " - "%s\n", strerror(-i)); - free(fn); - /* Undo link count increment. */ - m_file->link_count = cpu_to_le16( - le16_to_cpu(m_file->link_count) - 1); - return i; - } - /* Insert the index entry for file_name in @idx. */ + /* Create the file_name attribute. */ + i = (strlen(file_name) + 1) * sizeof(ntfschar); + fn_size = sizeof(FILE_NAME_ATTR) + i; + fn = (FILE_NAME_ATTR*)malloc(fn_size); + if (!fn) + return -errno; + fn->parent_directory = ref_parent; + // FIXME: Is this correct? Or do we have to copy the creation_time + // from the std info? + fn->creation_time = utc2ntfs(time(NULL)); + fn->last_data_change_time = fn->creation_time; + fn->last_mft_change_time = fn->creation_time; + fn->last_access_time = fn->creation_time; + fn->allocated_size = cpu_to_le64(allocated_size); + fn->data_size = cpu_to_le64(data_size); + fn->file_attributes = flags; + /* These are in a union so can't have both. */ + if (packed_ea_size && reparse_point_tag) { + free(fn); + return -EINVAL; + } + if (packed_ea_size) { + free(fn); + return -EINVAL; + } + if (packed_ea_size) { + fn->packed_ea_size = cpu_to_le16(packed_ea_size); + fn->reserved = cpu_to_le16(0); + } else + fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); + fn->file_name_type = file_name_type; + i = stoucs(fn->file_name, file_name, i); + if (i < 1) { + free(fn); + return -EINVAL; + } + if (i > 0xff) { + free(fn); + return -ENAMETOOLONG; + } + /* No terminating null in file names. */ + fn->file_name_length = i; + fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(ntfschar); + /* Increment the link count of @m_file. */ + i = le16_to_cpu(m_file->link_count); + if (i == 0xffff) { + Eprintf("Too many hardlinks present already.\n"); + free(fn); + return -EINVAL; + } + m_file->link_count = cpu_to_le16(i + 1); + /* Add the file_name to @m_file. */ + i = insert_resident_attr_in_mft_record(m_file, AT_FILE_NAME, NULL, 0, 0, + 0, RESIDENT_ATTR_IS_INDEXED, (u8*)fn, fn_size); + if (i < 0) { + Eprintf("create_hardlink failed adding file name attribute: " + "%s\n", strerror(-i)); + free(fn); + /* Undo link count increment. */ + m_file->link_count = cpu_to_le16( + le16_to_cpu(m_file->link_count) - 1); + return i; + } + /* Insert the index entry for file_name in @idx. */ //remmet ut kun for debugging idx_size = (fn_size + 7) & ~7; idx_entry_new = (INDEX_ENTRY*)calloc(1, idx_size + 0x10); idx_entry_new->indexed_file = ref_file; idx_entry_new->length = idx_size + 0x10; - idx_entry_new->key_length = fn_size; + idx_entry_new->key_length = fn_size; memcpy((char*)idx_entry_new+0x10, (char*)fn, fn_size); i = insert_index_entry_in_res_dir_index(idx_entry_new, idx_size + 0x10 , m_parent, I30, 4, AT_FILE_NAME); - if (i < 0) { - Eprintf("create_hardlink failed inserting index entry: %s\n", - strerror(-i)); - /* FIXME: Remove the file name attribute from @m_file. */ - free(fn); - /* Undo link count increment. */ - m_file->link_count = cpu_to_le16( - le16_to_cpu(m_file->link_count) - 1); - return i; - } + if (i < 0) { + Eprintf("create_hardlink failed inserting index entry: %s\n", + strerror(-i)); + /* FIXME: Remove the file name attribute from @m_file. */ + free(fn); + /* Undo link count increment. */ + m_file->link_count = cpu_to_le16( + le16_to_cpu(m_file->link_count) - 1); + return i; + } free(fn); - return 0; + return 0; } - + /** * create_hardlink * Create a file_name_attribute in the mft record @m_file which points to the @@ -3429,8 +3416,8 @@ static void init_options(void) opts.heads = -1; opts.part_start_sect = -1; opts.index_block_size = 4096; - opts.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; - opts.attr_defs_len = sizeof(attrdef_ntfs12_array); + opts.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; + opts.attr_defs_len = sizeof(attrdef_ntfs12_array); //mkDprintf("Attr_defs table length = %u\n", opts.attr_defs_len); } @@ -3439,43 +3426,27 @@ static void init_options(void) */ static void mkntfs_exit(void) { - if (index_block) - free(index_block); - if (buf_sds_init) - free(buf_sds_init); - if (buf_sds) - free(buf_sds); - if (buf) - free(buf); - if (buf2) - free(buf2); - if (lcn_bitmap) - free(lcn_bitmap); - if (mft_bitmap) - free(mft_bitmap); - if (rl_mft) - free(rl_mft); - if (rl_mft_bmp) - free(rl_mft_bmp); - if (rl_mftmirr) - free(rl_mftmirr); - if (rl_logfile) - free(rl_logfile); - if (rl_boot) - free(rl_boot); - if (rl_bad) - free(rl_bad); - if (rl_index) - free(rl_index); - if (opts.bad_blocks) - free(opts.bad_blocks); + free(index_block); + free(buf_sds_init); + free(buf_sds); + free(buf); + free(buf2); + free(lcn_bitmap); + free(mft_bitmap); + free(rl_mft); + free(rl_mft_bmp); + free(rl_mftmirr); + free(rl_logfile); + free(rl_boot); + free(rl_bad); + free(rl_index); + free(opts.bad_blocks); if ((opts.attr_defs != (const ATTR_DEF*)attrdef_ntfs12_array) && (opts.attr_defs != (const ATTR_DEF*)attrdef_ntfs3x_array)) free(opts.attr_defs); if (!vol) return; - if (vol->upcase) - free(vol->upcase); + free(vol->upcase); if (vol->dev) { if (NDevOpen(vol->dev) && vol->dev->d_ops->close(vol->dev)) Eprintf("Warning: Could not close %s: %s\n", @@ -3819,11 +3790,11 @@ static void mkntfs_initialize_bitmaps(void) for (i = opts.nr_clusters; i < lcn_bitmap_byte_size << 3; i++) ntfs_bit_set(lcn_bitmap, (u64)i, 1); /* - * Determine mft_size: (16 (1.2) or 28 (3.0+) mft records) or + * Determine mft_size: (16 (1.2) or 28 (3.0+) mft records) or * 1 cluster, which ever is bigger, rounded to multiples of cluster * size */ - opts.mft_size = ((16 + 12 * (vol->major_ver >= 3)) * + opts.mft_size = ((16 + 12 * (vol->major_ver >= 3)) * vol->mft_record_size + vol->cluster_size - 1) & ~(vol->cluster_size - 1); mkDprintf("MFT size = %i (0x%x) bytes\n", opts.mft_size, opts.mft_size); @@ -4139,54 +4110,54 @@ static void mkntfs_fill_device_with_zeroes(void) Qprintf(" - Done.\n"); } -/** +/** * mkntfs_sync_index_record - * (ERSO) made a function out of this, but the reason for doing that - * disapeared during coding.... + * (ERSO) made a function out of this, but the reason for doing that + * disapeared during coding.... */ -static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, +static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, ntfschar* name, u32 name_len) { - int i, err; - ntfs_attr_search_ctx *ctx; - ATTR_RECORD *a; - long long lw; - i = 5 * sizeof(ntfschar); - ctx = ntfs_attr_get_search_ctx(NULL, m); + int i, err; + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + long long lw; + i = 5 * sizeof(ntfschar); + ctx = ntfs_attr_get_search_ctx(NULL, m); - if (!ctx) - err_exit("Failed to allocate attribute search context: %s\n", - strerror(errno)); - // FIXME: This should be IGNORE_CASE! - if (mkntfs_attr_lookup(AT_INDEX_ALLOCATION, name, name_len, 0, 0, - NULL, 0, ctx)) { - ntfs_attr_put_search_ctx(ctx); - err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n"); - } - a = ctx->attr; - rl_index = ntfs_mapping_pairs_decompress(vol, a, NULL); - if (!rl_index) { - ntfs_attr_put_search_ctx(ctx); - err_exit("Failed to decompress runlist of $INDEX_ALLOCATION " - "attribute.\n"); - } - if (sle64_to_cpu(a->initialized_size) < i) { - ntfs_attr_put_search_ctx(ctx); - err_exit("BUG: $INDEX_ALLOCATION attribute too short.\n"); - } - ntfs_attr_put_search_ctx(ctx); - i = sizeof(INDEX_BLOCK) - sizeof(INDEX_HEADER) + - le32_to_cpu(idx->index.allocated_size); - err = ntfs_mst_pre_write_fixup((NTFS_RECORD*)idx, i); - if (err) - err_exit("ntfs_mst_pre_write_fixup() failed while " + if (!ctx) + err_exit("Failed to allocate attribute search context: %s\n", + strerror(errno)); + // FIXME: This should be IGNORE_CASE! + if (mkntfs_attr_lookup(AT_INDEX_ALLOCATION, name, name_len, 0, 0, + NULL, 0, ctx)) { + ntfs_attr_put_search_ctx(ctx); + err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n"); + } + a = ctx->attr; + rl_index = ntfs_mapping_pairs_decompress(vol, a, NULL); + if (!rl_index) { + ntfs_attr_put_search_ctx(ctx); + err_exit("Failed to decompress runlist of $INDEX_ALLOCATION " + "attribute.\n"); + } + if (sle64_to_cpu(a->initialized_size) < i) { + ntfs_attr_put_search_ctx(ctx); + err_exit("BUG: $INDEX_ALLOCATION attribute too short.\n"); + } + ntfs_attr_put_search_ctx(ctx); + i = sizeof(INDEX_BLOCK) - sizeof(INDEX_HEADER) + + le32_to_cpu(idx->index.allocated_size); + err = ntfs_mst_pre_write_fixup((NTFS_RECORD*)idx, i); + if (err) + err_exit("ntfs_mst_pre_write_fixup() failed while " "syncing index block.\n"); - lw = ntfs_rlwrite(vol->dev, rl_index, (u8*)idx, i, NULL); - if (lw != i) - err_exit("Error writing $INDEX_ALLOCATION.\n"); - /* No more changes to @idx below here so no need for fixup: */ - // ntfs_mst_post_write_fixup((NTFS_RECORD*)idx); + lw = ntfs_rlwrite(vol->dev, rl_index, (u8*)idx, i, NULL); + if (lw != i) + err_exit("Error writing $INDEX_ALLOCATION.\n"); + /* No more changes to @idx below here so no need for fixup: */ + // ntfs_mst_post_write_fixup((NTFS_RECORD*)idx); } /** @@ -4301,43 +4272,43 @@ static void mkntfs_create_root_structures(void) * of that file (only for $MFT is the sequence number 1 rather than 0). */ for (i = 0; i < 16 + 12 * (vol->major_ver >= 3); i++) { - if (ntfs_mft_record_layout(vol, 0, m = (MFT_RECORD *)(buf + + if (ntfs_mft_record_layout(vol, 0, m = (MFT_RECORD *)(buf + i * vol->mft_record_size))) - err_exit("Error: Failed to layout mft record.\n"); + err_exit("Error: Failed to layout mft record.\n"); #if 0 - if (!opts.quiet && opts.verbose > 1) - dump_mft_record((MFT_RECORD*)buf + + if (!opts.quiet && opts.verbose > 1) + dump_mft_record((MFT_RECORD*)buf + i * vol->mft_record_size); -#endif - +#endif + if ( i > 0 ) m->sequence_number = cpu_to_le16(i); if ( i == 0) m->sequence_number = cpu_to_le16(1); } /* - * If a cluster contains more than the 16 (ntfs 1.2) or + * If a cluster contains more than the 16 (ntfs 1.2) or * 28 (ntfs 3.0+) system files, fill the rest * with empty, formatted records. */ - mft_total_cluster_size = vol->cluster_size * - (((16 + 12 * (vol->major_ver >= 3) -1) + mft_total_cluster_size = vol->cluster_size * + (((16 + 12 * (vol->major_ver >= 3) -1) * vol->mft_record_size) / vol->cluster_size + 1); - if (mft_total_cluster_size > (16 + 12 * (vol->major_ver >= 3))* + if (mft_total_cluster_size > (16 + 12 * (vol->major_ver >= 3))* vol->mft_record_size) { - for (i = 16 + 12 * (vol->major_ver >= 3); + for (i = 16 + 12 * (vol->major_ver >= 3); i * vol->mft_record_size < mft_total_cluster_size; i++) - { - if (ntfs_mft_record_layout(vol, 0, m = + { + if (ntfs_mft_record_layout(vol, 0, m = (MFT_RECORD *)(buf + i * vol->mft_record_size))) - err_exit("Error: Failed to layout mft" + err_exit("Error: Failed to layout mft" " record.\n"); #if 0 - if (!opts.quiet && opts.verbose > 1) - dump_mft_record((MFT_RECORD*)buf + + if (!opts.quiet && opts.verbose > 1) + dump_mft_record((MFT_RECORD*)buf + i * vol->mft_record_size); #endif m->flags = cpu_to_le16(0); - m->sequence_number = cpu_to_le16(i); - } + m->sequence_number = cpu_to_le16(i); + } } /* * Create the 16 system files, adding the system information attribute @@ -4348,7 +4319,7 @@ static void mkntfs_create_root_structures(void) m = (MFT_RECORD*)(buf + i * vol->mft_record_size); if (i < 16 || i > 23) { - if (vol->major_ver >= 3 && vol->minor_ver >= 1) + if (vol->major_ver >= 3 && vol->minor_ver >= 1) m->mft_record_number = cpu_to_le32(i); m->flags |= MFT_RECORD_IN_USE; ntfs_bit_set(mft_bitmap, 0LL + i, 1); @@ -4360,40 +4331,40 @@ static void mkntfs_create_root_structures(void) if (opts.enable_compression) file_attrs |= FILE_ATTR_COMPRESSED; } - - if (vol->major_ver < 3) - add_attr_std_info(m, file_attrs, + + if (vol->major_ver < 3) + add_attr_std_info(m, file_attrs, cpu_to_le32(0)); // dump_mft_record(m); else { - // setting specific security_id flag and - // filepermissions for ntfs 3.x - if (i == 0 || i == 1 || i == 2 || i == 6 || i == 8 || + // setting specific security_id flag and + // filepermissions for ntfs 3.x + if (i == 0 || i == 1 || i == 2 || i == 6 || i == 8 || i == 10 ) - add_attr_std_info(m, file_attrs, + add_attr_std_info(m, file_attrs, cpu_to_le32(0x0100)); else if (i == 9) { file_attrs |= FILE_ATTR_NOT_CONTENT_INDEXED; - add_attr_std_info(m, file_attrs, + add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); } else if (i == 11) - add_attr_std_info(m, file_attrs, + add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); else if (i ==24 || i == 25 || i == 26) { file_attrs |= FILE_ATTR_DUP_VIEW_INDEX_PRESENT; - add_attr_std_info(m, file_attrs, + add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); } - else if (i == 27) - add_attr_std_info(m, file_attrs, + else if (i == 27) + add_attr_std_info(m, file_attrs, cpu_to_le32(0x0102)); - else add_attr_std_info(m, file_attrs, + else add_attr_std_info(m, file_attrs, cpu_to_le32(0x00)); } } /* The root directory mft reference. */ root_ref = MK_LE_MREF(FILE_root, FILE_root); - extend_ref = MK_LE_MREF(11,11); + extend_ref = MK_LE_MREF(11,11); Vprintf("Creating root directory (mft record 5)\n"); m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); m->flags |= MFT_RECORD_IS_DIRECTORY; @@ -4407,11 +4378,11 @@ static void mkntfs_create_root_structures(void) init_system_file_sd(FILE_root, &sd, &i); err = add_attr_sd(m, sd, i); } else if (vol->major_ver == 3 && vol->minor_ver == 0) { - init_system_file_sd(FILE_root, &sd, &i); - err = add_attr_sd(m, sd, i); + init_system_file_sd(FILE_root, &sd, &i); + err = add_attr_sd(m, sd, i); } else if (vol->major_ver == 3 && vol->minor_ver == 1) { - init_root_sd_31(&sd, &i); - err = add_attr_sd(m, sd, i); + init_root_sd_31(&sd, &i); + err = add_attr_sd(m, sd, i); } else err_exit("BUG: Unsupported NTFS version\n"); } @@ -4541,13 +4512,13 @@ static void mkntfs_create_root_structures(void) //dump_mft_record(m); Vprintf("Creating $Bitmap (mft record 6)\n"); m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); - // the data attribute of $Bitmap must be non-resident or otherwise + // the data attribute of $Bitmap must be non-resident or otherwise // windows 2003 will regard the volume as corrupt (ERSO) - if(!err) - err = insert_non_resident_attr_in_mft_record(m, - AT_DATA, NULL, 0, - 0, 0, - lcn_bitmap, lcn_bitmap_byte_size); + if (!err) + err = insert_non_resident_attr_in_mft_record(m, + AT_DATA, NULL, 0, + 0, 0, + lcn_bitmap, lcn_bitmap_byte_size); if (!err) @@ -4688,7 +4659,7 @@ static void mkntfs_create_root_structures(void) //dump_mft_record(m); /* create $Quota (1.2) or $Secure (3.0+) */ - + if (vol->major_ver < 3 ) { Vprintf("Creating $Quota (mft record 9)\n"); m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); @@ -4698,64 +4669,64 @@ static void mkntfs_create_root_structures(void) MK_LE_MREF(9, 9), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0 , 0, "$Quota", - FILE_NAME_WIN32_AND_DOS); + FILE_NAME_WIN32_AND_DOS); if (!err) { init_system_file_sd(FILE_Secure, &sd, &i); err = add_attr_sd(m, sd, i); } if (err < 0) - err_exit("Couldn't create $Quota: %s\n", + err_exit("Couldn't create $Quota: %s\n", strerror(-err)); } else { - Vprintf("Creating $Secure (mft record 9)\n"); - m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); - m->flags |= MFT_RECORD_IS_8; - if (!err) - err = create_hardlink(index_block, root_ref, m, - MK_LE_MREF(9, 9), 0LL, 0LL, + Vprintf("Creating $Secure (mft record 9)\n"); + m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_8; + if (!err) + err = create_hardlink(index_block, root_ref, m, + MK_LE_MREF(9, 9), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | - FILE_ATTR_DUP_VIEW_INDEX_PRESENT + FILE_ATTR_DUP_VIEW_INDEX_PRESENT , 0, 0, "$Secure", - FILE_NAME_WIN32_AND_DOS); + FILE_NAME_WIN32_AND_DOS); if (!err) { if (vol->minor_ver == 0) { buf_sds_first_size = 0x1E0; buf_sds_size = 0x40000 + buf_sds_first_size; buf_sds_init = (char*)calloc(1, buf_sds_first_size); - init_secure_30(buf_sds_init); + init_secure_30(buf_sds_init); } else { - buf_sds_first_size = 0x240; - buf_sds_size = 0x40000 + buf_sds_first_size; + buf_sds_first_size = 0x240; + buf_sds_size = 0x40000 + buf_sds_first_size; buf_sds_init = (char*)calloc(1, buf_sds_first_size); - init_secure_31(buf_sds_init); + init_secure_31(buf_sds_init); } buf_sds = (char*)calloc(1,buf_sds_size); - if (!buf_sds) - err_exit("Failed to allocate internal buffer:" + if (!buf_sds) + err_exit("Failed to allocate internal buffer:" " %s\n", strerror(errno)); - memcpy((char*)buf_sds, (char*)buf_sds_init, - buf_sds_first_size); - memcpy((char*)buf_sds + 0x40000, (char*)buf_sds_init, + memcpy((char*)buf_sds, (char*)buf_sds_init, buf_sds_first_size); - err = add_attr_data(m, "$SDS", 4, 0, 0, (u8*)buf_sds, + memcpy((char*)buf_sds + 0x40000, (char*)buf_sds_init, + buf_sds_first_size); + err = add_attr_data(m, "$SDS", 4, 0, 0, (u8*)buf_sds, buf_sds_size); } - // FIXME: This should be IGNORE_CASE - if (!err) - err = add_attr_index_root(m, "$SDH", 4, 0, AT_UNUSED, - COLLATION_NTOFS_SECURITY_HASH , + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$SDH", 4, 0, AT_UNUSED, + COLLATION_NTOFS_SECURITY_HASH , opts.index_block_size); - // FIXME: This should be IGNORE_CASE - if (!err) - err = add_attr_index_root(m, "$SII", 4, 0, AT_UNUSED, - COLLATION_NTOFS_ULONG, opts.index_block_size); + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$SII", 4, 0, AT_UNUSED, + COLLATION_NTOFS_ULONG, opts.index_block_size); if (!err) err =initialize_secure(buf_sds_init, buf_sds_first_size - , m); - if (err < 0) - err_exit("Couldn't create $Secure: %s\n", + , m); + if (err < 0) + err_exit("Couldn't create $Secure: %s\n", strerror(-err)); } //dump_mft_record(m); @@ -4766,7 +4737,7 @@ static void mkntfs_create_root_structures(void) if (!err) err = create_hardlink(index_block, root_ref, m, MK_LE_MREF(FILE_UpCase, FILE_UpCase), - ((vol->upcase_len << 1) + + ((vol->upcase_len << 1) + vol->cluster_size - 1) & ~(vol->cluster_size - 1), vol->upcase_len << 1, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, @@ -4778,43 +4749,43 @@ static void mkntfs_create_root_structures(void) if (err < 0) err_exit("Couldn't create $UpCase: %s\n", strerror(-err)); //dump_mft_record(m); - - if (vol->major_ver < 3) { - Vprintf("Creating empty record, marked as in use " + + if (vol->major_ver < 3) { + Vprintf("Creating empty record, marked as in use " "(mft record 11)\n"); - m = (MFT_RECORD*)(buf + 11 * vol->mft_record_size); - err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); - if (!err) { - init_system_file_sd(11, &sd, &j); - err = add_attr_sd(m, sd, j); - } - if (err < 0) - err_exit("Couldn't create system file 11 (0x0b): %s\n", - strerror(-err)); - //dump_mft_record(m); + m = (MFT_RECORD*)(buf + 11 * vol->mft_record_size); + err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); + if (!err) { + init_system_file_sd(11, &sd, &j); + err = add_attr_sd(m, sd, j); + } + if (err < 0) + err_exit("Couldn't create system file 11 (0x0b): %s\n", + strerror(-err)); + //dump_mft_record(m); } else { Vprintf("Creating $Extend (mft record 11)\n"); /* * $Extends index must be resident. Otherwise, w2k3 will * regard the volume as corrupt. (ERSO) */ - m = (MFT_RECORD*)(buf + 11 * vol->mft_record_size); + m = (MFT_RECORD*)(buf + 11 * vol->mft_record_size); m->flags |= MFT_RECORD_IS_DIRECTORY; - if (!err) - err = create_hardlink(index_block, root_ref, m, - MK_LE_MREF(11, 11), 0LL, 0LL, + if (!err) + err = create_hardlink(index_block, root_ref, m, + MK_LE_MREF(11, 11), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, - 0, 0, "$Extend", + 0, 0, "$Extend", FILE_NAME_WIN32_AND_DOS); // FIXME: This should be IGNORE_CASE - if (!err) - err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, - COLLATION_FILE_NAME, opts.index_block_size); - if (err < 0) - err_exit("Couldn't create $Extend: %s\n", + if (!err) + err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, + COLLATION_FILE_NAME, opts.index_block_size); + if (err < 0) + err_exit("Couldn't create $Extend: %s\n", strerror(-err)); - } + } /* NTFS 1.2 reserved system files (mft records 0xc-0xf) */ for (i = 0xc; i < 0x10; i++) { Vprintf("Creating system file (mft record 0x%x)\n", i); @@ -4829,92 +4800,92 @@ static void mkntfs_create_root_structures(void) i, i, strerror(-err)); //dump_mft_record(m); } - // create systemfiles for ntfs volumes (3.1) + // create systemfiles for ntfs volumes (3.1) // starting vith file 24 (ignoring file 16-23) - if (vol->major_ver >= 3) { - extend_flags = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | + if (vol->major_ver >= 3) { + extend_flags = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | FILE_ATTR_DUP_VIEW_INDEX_PRESENT; Vprintf("Creating $ObjId (mft record 24)\n"); - m = (MFT_RECORD*)(buf + 24 * vol->mft_record_size); - m->flags |= MFT_RECORD_IS_4; - m->flags |= MFT_RECORD_IS_8; - if (!err) - err = create_hardlink_res((MFT_RECORD*)(buf + + m = (MFT_RECORD*)(buf + 24 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_4; + m->flags |= MFT_RECORD_IS_8; + if (!err) + err = create_hardlink_res((MFT_RECORD*)(buf + 11 * vol->mft_record_size), extend_ref, m, MK_LE_MREF(24, 24), 0LL, 0LL, - extend_flags, 0, 0, "$ObjId", - FILE_NAME_WIN32_AND_DOS); - - // FIXME: This should be IGNORE_CASE - if (!err) - err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, - COLLATION_NTOFS_ULONGS, opts.index_block_size); + extend_flags, 0, 0, "$ObjId", + FILE_NAME_WIN32_AND_DOS); + + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, + COLLATION_NTOFS_ULONGS, opts.index_block_size); if (!err) err = initialize_objid(m, volume_obj_id->object_id, MK_LE_MREF(FILE_Volume, FILE_Volume)); - if (err < 0) - err_exit("Couldn't create $ObjId: %s\n", strerror(-err)); - Vprintf("Creating $Quota (mft record 25)\n"); - m = (MFT_RECORD*)(buf + 25 * vol->mft_record_size); - m->flags |= MFT_RECORD_IS_4; - m->flags |= MFT_RECORD_IS_8; - if (!err) - err = create_hardlink_res((MFT_RECORD*)(buf + + if (err < 0) + err_exit("Couldn't create $ObjId: %s\n", strerror(-err)); + Vprintf("Creating $Quota (mft record 25)\n"); + m = (MFT_RECORD*)(buf + 25 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_4; + m->flags |= MFT_RECORD_IS_8; + if (!err) + err = create_hardlink_res((MFT_RECORD*)(buf + 11 * vol->mft_record_size), extend_ref, m, - MK_LE_MREF(25, 25), 0LL, 0LL, extend_flags + MK_LE_MREF(25, 25), 0LL, 0LL, extend_flags , 0, 0, "$Quota", FILE_NAME_WIN32_AND_DOS); - // FIXME: This should be IGNORE_CASE - if (!err) - err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, - COLLATION_NTOFS_SID, opts.index_block_size); - // FIXME: This should be IGNORE_CASE - if (!err) - err = add_attr_index_root(m, "$Q", 2, 0, AT_UNUSED, - COLLATION_NTOFS_ULONG, opts.index_block_size); + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, + COLLATION_NTOFS_SID, opts.index_block_size); + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$Q", 2, 0, AT_UNUSED, + COLLATION_NTOFS_ULONG, opts.index_block_size); if (!err) err = initialize_quota(m); - if (err < 0) - err_exit("Couldn't create $Quota: %s\n", strerror(-err)); - Vprintf("Creating $Reparse (mft record 26)\n"); - m = (MFT_RECORD*)(buf + 26 * vol->mft_record_size); - m->flags |= MFT_RECORD_IS_4; - m->flags |= MFT_RECORD_IS_8; - if (!err) - err = create_hardlink_res((MFT_RECORD*)(buf + + if (err < 0) + err_exit("Couldn't create $Quota: %s\n", strerror(-err)); + Vprintf("Creating $Reparse (mft record 26)\n"); + m = (MFT_RECORD*)(buf + 26 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_4; + m->flags |= MFT_RECORD_IS_8; + if (!err) + err = create_hardlink_res((MFT_RECORD*)(buf + 11 * vol->mft_record_size), extend_ref, m, MK_LE_MREF(26, 26), - 0LL, 0LL, extend_flags, 0, 0, - "$Reparse", FILE_NAME_WIN32_AND_DOS); - // FIXME: This should be IGNORE_CASE - if (!err) - err = add_attr_index_root(m, "$R", 2, 0, AT_UNUSED, - COLLATION_NTOFS_ULONGS, opts.index_block_size); - if (err < 0) - err_exit("Couldn't create $Reparse: %s\n", - strerror(-err)); - Vprintf("Creating System Volume Information (mft record 27)\n"); - m = (MFT_RECORD*)(buf + 27 * vol->mft_record_size); - m->flags |= MFT_RECORD_IS_DIRECTORY; - if (!err) - err = create_hardlink(index_block, root_ref, m, - MK_LE_MREF(27, 27), 0LL, 0LL, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | - FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, - "SYSTEM~1", FILE_NAME_DOS); - + 0LL, 0LL, extend_flags, 0, 0, + "$Reparse", FILE_NAME_WIN32_AND_DOS); + // FIXME: This should be IGNORE_CASE if (!err) - err = create_hardlink(index_block, root_ref, m, - MK_LE_MREF(27, 27), 0LL, 0LL, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | - FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, - "System Volume Information", FILE_NAME_WIN32); - if (!err) - err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, - COLLATION_FILE_NAME, opts.index_block_size); + err = add_attr_index_root(m, "$R", 2, 0, AT_UNUSED, + COLLATION_NTOFS_ULONGS, opts.index_block_size); if (err < 0) - err_exit("Couldn't create 'System Volume Information'" + err_exit("Couldn't create $Reparse: %s\n", + strerror(-err)); + Vprintf("Creating System Volume Information (mft record 27)\n"); + m = (MFT_RECORD*)(buf + 27 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_DIRECTORY; + if (!err) + err = create_hardlink(index_block, root_ref, m, + MK_LE_MREF(27, 27), 0LL, 0LL, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | + FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, + "SYSTEM~1", FILE_NAME_DOS); + + if (!err) + err = create_hardlink(index_block, root_ref, m, + MK_LE_MREF(27, 27), 0LL, 0LL, + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | + FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, + "System Volume Information", FILE_NAME_WIN32); + if (!err) + err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, + COLLATION_FILE_NAME, opts.index_block_size); + if (err < 0) + err_exit("Couldn't create 'System Volume Information'" ": %s\n", strerror(-err)); - } + } } /** @@ -4955,7 +4926,7 @@ int main(int argc, char **argv) err_exit("Could not allocate memory for internal buffer.\n"); init_upcase_table(vol->upcase, vol->upcase_len * sizeof(ntfschar)); /* Initialize opts to zero / required values. */ - init_options(); + init_options(); /* Parse command line options. */ parse_options(argc, argv); /* Open the partition. */ diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index ea59d903..1964fa25 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -243,7 +243,7 @@ static int parse_options (int argc, char **argv) opts.quiet = 0; } else { if (opts.device == NULL) { - Eprintf ("You must specify a device.\n"); + Eprintf ("You must specify a device.\n"); err++; } else if (opts.file == NULL && opts.inode == -1) { diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 32734e57..f9e8c1c1 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -162,10 +162,10 @@ struct { #define PERR_PREFIX ERR_PREFIX "(%d): " #define NERR_PREFIX ERR_PREFIX ": " -#define LAST_METADATA_INODE 11 +#define LAST_METADATA_INODE 11 -#define NTFS_MAX_CLUSTER_SIZE 65536 -#define NTFS_SECTOR_SIZE 512 +#define NTFS_MAX_CLUSTER_SIZE 65536 +#define NTFS_SECTOR_SIZE 512 #define rounded_up_division(a, b) (((a) + (b - 1)) / (b)) @@ -383,7 +383,7 @@ static void parse_options(int argc, char **argv) msg_out = stdout; - /* FIXME: this is a workaround for loosing debug info if stdout != stderr + /* FIXME: this is a workaround for losing debug info if stdout != stderr and for the uncontrollable verbose messages in libntfs. Ughhh. */ if (opt.std_out) msg_out = stderr; @@ -699,7 +699,7 @@ static void restore_image(void) #define WIPE_TIMESTAMPS(atype, attr) \ do { \ atype *ats; \ - ats = (atype *)((char*)(attr) + (attr)->value_offset); \ + ats = (atype *)((char*)(attr) + (attr)->value_offset); \ \ ats->creation_time = 0; \ ats->last_data_change_time = 0; \ @@ -708,7 +708,7 @@ do { \ \ wiped_timestamp_data += 32; \ \ -} while(0) +} while (0) static void wipe_timestamps(ntfs_walk_clusters_ctx *image) { @@ -1004,8 +1004,7 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) } } - if (ni->mrec) - free(ni->mrec); + free(ni->mrec); free(ni); if (deleted_inode) @@ -1248,9 +1247,9 @@ static void set_filesize(s64 filesize) if (fstatfs(fd_out, &opt.stfs) == -1) Printf("WARNING: Couldn't get filesystem type: " "%s\n", strerror(errno)); - else + else fs_type = opt.stfs.f_type; - + if (fs_type == 0x52654973) Printf("WARNING: You're using ReiserFS, it has very poor " "performance creating\nlarge sparse files. The next " diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index 13ab60bb..687e25c3 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -176,7 +176,7 @@ static void parse_options(int argc, char **argv) { "debug", no_argument, NULL, 'd' }, #endif { "help", no_argument, NULL, 'h' }, - { "no-progress-bar", no_argument, NULL, 'P' }, + { "no-progress-bar", no_argument, NULL, 'P' }, { "verbose", no_argument, NULL, 'v' }, { NULL, 0, NULL, 0 } }; @@ -193,7 +193,7 @@ static void parse_options(int argc, char **argv) opt.vol1 = argv[optind - 1]; } else if (!opt.vol2) { opt.vol2 = argv[optind - 1]; - } else { + } else { err_printf("Too many arguments!\n"); usage(); } @@ -284,7 +284,7 @@ static u64 inumber(ntfs_inode *ni) { if (ni->nr_extents >= 0) return ni->mft_no; - + return ni->base_ni->mft_no; } @@ -312,7 +312,7 @@ static inline s64 get_nr_mft_records(ntfs_volume *vol) #define NTFSCMP_EXTENSION_RECORD 4 #define NTFSCMP_INODE_CLOSE_ERROR 5 -const char *ntfscmp_errs[] = { +const char *ntfscmp_errs[] = { "OK", "INODE_OPEN_ERROR", "INODE_OPEN_IO_ERROR", @@ -325,7 +325,7 @@ const char *ntfscmp_errs[] = { static const char *err2string(int err) { - return ntfscmp_errs[err]; + return ntfscmp_errs[err]; } static const char *pret2str(void *p) @@ -352,7 +352,7 @@ static int inode_open(ntfs_volume *vol, MFT_REF mref, ntfs_inode **ni) if (inode_close(*ni) != 0) return NTFSCMP_INODE_CLOSE_ERROR; - + return NTFSCMP_EXTENSION_RECORD; } @@ -363,7 +363,7 @@ static ntfs_inode *base_inode(ntfs_attr_search_ctx *ctx) { if (ctx->base_ntfs_ino) return ctx->base_ntfs_ino; - + return ctx->ntfs_ino; } @@ -401,7 +401,7 @@ static void free_name(char **name) static char *get_attr_name(u64 mft_no, ATTR_TYPES atype, - const ntfschar *uname, + const ntfschar *uname, const int uname_len) { char *name = NULL; @@ -417,7 +417,7 @@ static char *get_attr_name(u64 mft_no, print_attribute_type(atype); puts(""); exit(1); - + } else if (name_len > 0) return name; @@ -495,9 +495,9 @@ static void cmp_attribute_data(ntfs_attr *na1, ntfs_attr *na2) printf("len = %lld, pos = %lld\n", na1->data_size, pos); exit(1); } - + if (count1 == 0) { - + if (pos + count1 == na1->data_size) return; /* we are ready */ @@ -506,7 +506,7 @@ static void cmp_attribute_data(ntfs_attr *na1, ntfs_attr *na2) printf("%lld != %lld\n", pos + count1, na1->data_size); exit(1); } - + if (memcmp(buf1, buf2, count1)) { print_na(na1); printf("content"); @@ -515,15 +515,15 @@ static void cmp_attribute_data(ntfs_attr *na1, ntfs_attr *na2) return; } } - + err_printf("%s read overrun: ", __FUNCTION__); print_na(na1); - err_printf("(len = %lld, pos = %lld, count = %lld)\n", + err_printf("(len = %lld, pos = %lld, count = %lld)\n", na1->data_size, pos, count1); exit(1); } -static void cmp_attribute(ntfs_attr_search_ctx *ctx1, +static void cmp_attribute(ntfs_attr_search_ctx *ctx1, ntfs_attr_search_ctx *ctx2) { ATTR_RECORD *a1 = ctx1->attr; @@ -532,7 +532,7 @@ static void cmp_attribute(ntfs_attr_search_ctx *ctx1, na1 = ntfs_attr_open(base_inode(ctx1), a1->type, GET_ATTR_NAME(a1)); na2 = ntfs_attr_open(base_inode(ctx2), a2->type, GET_ATTR_NAME(a2)); - + if ((!na1 && na2) || (na1 && !na2)) { print_ctx(ctx1); printf("open: %s != %s\n", pret2str(na1), pret2str(na2)); @@ -579,7 +579,7 @@ static int new_name(ntfs_attr_search_ctx *ctx, char *prev_name) { int ret = 0; char *name = get_attr_name_ctx(ctx); - + if (prev_name && name) { if (strcmp(prev_name, name) != 0) ret = 1; @@ -597,13 +597,13 @@ static int new_attribute(ntfs_attr_search_ctx *ctx, { if (!prev_atype && !prev_name) return 1; - + if (!ctx->attr->non_resident) return 1; if (prev_atype != ctx->attr->type) return 1; - + if (new_name(ctx, prev_name)) return 1; @@ -613,11 +613,11 @@ static int new_attribute(ntfs_attr_search_ctx *ctx, printf("record %llu lowest_vcn %lld: SKIPPED\n", ctx->ntfs_ino->mft_no, ctx->attr->lowest_vcn); } - + return 0; } - -static void set_prev(char **prev_name, ATTR_TYPES *prev_atype, + +static void set_prev(char **prev_name, ATTR_TYPES *prev_atype, char *name, ATTR_TYPES atype) { free_name(prev_name); @@ -632,8 +632,8 @@ static void set_prev(char **prev_name, ATTR_TYPES *prev_atype, static void set_cmp_attr(ntfs_attr_search_ctx *ctx, ATTR_TYPES *atype, char **name) { - *atype = ctx->attr->type; - + *atype = ctx->attr->type; + free_name(name); *name = get_attr_name_ctx(ctx); } @@ -642,15 +642,15 @@ static int next_attr(ntfs_attr_search_ctx *ctx, ATTR_TYPES *atype, char **name, int *err) { int ret; - + ret = ntfs_attrs_walk(ctx); *err = errno; - if (ret) { + if (ret) { *atype = AT_END; free_name(name); } else set_cmp_attr(ctx, atype, name); - + return ret; } @@ -662,12 +662,12 @@ static int cmp_attributes(ntfs_inode *ni1, ntfs_inode *ni2) char *prev_name = NULL, *name1 = NULL, *name2 = NULL; ATTR_TYPES old_atype1, prev_atype = 0, atype1, atype2; ntfs_attr_search_ctx *ctx1, *ctx2; - + if (!(ctx1 = attr_get_search_ctx(ni1))) return -1; if (!(ctx2 = attr_get_search_ctx(ni2))) goto out; - + set_cmp_attr(ctx1, &atype1, &name1); set_cmp_attr(ctx2, &atype2, &name2); @@ -681,7 +681,7 @@ static int cmp_attributes(ntfs_inode *ni1, ntfs_inode *ni2) ret2 = next_attr(ctx2, &atype2, &name2, &errno2); print_attributes(ni1, atype1, atype2, name1, name2); - + if (ret1 && ret2) { if (errno1 != errno2) { print_inode_ni(ni1); @@ -697,14 +697,14 @@ static int cmp_attributes(ntfs_inode *ni1, ntfs_inode *ni2) printf("presence: EXISTS != MISSING\n"); set_prev(&prev_name, &prev_atype, name1, atype1); } - + } else if (ret1 || atype1 > atype2) { if (new_attribute(ctx2, prev_atype, prev_name)) { print_ctx(ctx2); printf("presence: MISSING != EXISTS \n"); set_prev(&prev_name, &prev_atype, name2, atype2); } - + } else /* atype1 == atype2 */ { if (new_attribute(ctx1, prev_atype, prev_name)) { cmp_attribute(ctx1, ctx2); @@ -759,7 +759,7 @@ static int cmp_inodes(ntfs_volume *vol1, ntfs_volume *vol2) if (ret1 != ret2) { print_inode(inode); - printf("open: %s != %s\n", + printf("open: %s != %s\n", err2string(ret1), err2string(ret2)); goto close_inodes; } diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 0b087fa0..988e2777 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -222,7 +222,7 @@ static int parse_options (int argc, char **argv) opts.quiet = 0; } else { if (!opts.device) { - Eprintf("You must specify a device.\n"); + Eprintf("You must specify a device.\n"); err++; } else if (!opts.src_file) { Eprintf("You must specify a source file.\n"); diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 24e2647c..0ace7ef1 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -153,8 +153,7 @@ static void log_err_exit(u8 *buf, const char *fmt, ...) { va_list ap; - if (buf) - free(buf); + free(buf); fprintf(stderr, "ERROR: "); va_start(ap, fmt); diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index de871a95..e8ace522 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -228,8 +228,7 @@ static int OLD_ntfs_volume_set_flags(ntfs_volume *vol, const u16 flags) err_out: ntfs_attr_put_search_ctx(ctx); err_exit: - if (m) - free(m); + free(m); return ret; } @@ -509,10 +508,8 @@ mount_ok: /* Set return code to 0. */ i = 0; final_exit: - if (m) - free(m); - if (m2) - free(m2); + free(m); + free(m2); if (vol && ntfs_umount(vol, 0)) ntfs_umount(vol, 1); return i; diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 3e941f8f..8bc55a16 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -625,7 +625,7 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) } printf("\tDumping attribute list:"); entry = (ATTR_LIST_ENTRY *) value; - for(;(u8 *)entry < (u8 *) value + l; entry = (ATTR_LIST_ENTRY *) + for (;(u8 *)entry < (u8 *) value + l; entry = (ATTR_LIST_ENTRY *) ((u8 *) entry + le16_to_cpu(entry->length))) { printf("\n"); printf("\t\tAttribute type:\t0x%x\n", @@ -832,8 +832,7 @@ static void ntfs_dump_acl(const char *prefix,ACL *acl) /* get a SID string */ sid = ntfs_sid_to_mbs(&ace->sid, NULL, 0); printf("%s\t\t SID: %s\n",prefix,sid); - if (sid) - free(sid); + free(sid); /* proceed to next ACE */ ace = (ACCESS_ALLOWED_ACE *)(((char *)ace) + le32_to_cpu(ace->size)); @@ -1098,7 +1097,7 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) int numb_entries = 1; char *name = NULL; - while(1) { + while (1) { if (!opts.verbose) { if (entry->flags & INDEX_ENTRY_END) break; @@ -1121,7 +1120,7 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) if (entry->flags & INDEX_ENTRY_END) break; - switch(type) { + switch (type) { case(AT_FILE_NAME): Vprintf("\t\tFILE record number:\t %llu\n", MREF_LE(entry->indexed_file)); @@ -1351,7 +1350,7 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) tmp_alloc = allocation; bit = 0; - while((u8 *)tmp_alloc < (u8 *)allocation + na->data_size) { + while ((u8 *)tmp_alloc < (u8 *)allocation + na->data_size) { if (*byte & (1 << bit)) { if (ntfs_mst_post_read_fixup((NTFS_RECORD *) tmp_alloc, indx_record_size)) { @@ -1493,7 +1492,7 @@ static void ntfs_dump_attr_reparse_point(ATTR_RECORD *attr __attribute__((unused static void ntfs_dump_attr_ea_information(ATTR_RECORD *attr) { EA_INFORMATION *ea_info; - + ea_info = (EA_INFORMATION*)((u8*)attr + le16_to_cpu(attr->value_offset)); printf("Dumping attribute $EA_INFORMATION (0xD0)\n"); @@ -1519,7 +1518,7 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol) if (attr->non_resident) { runlist *rl; - data_size = sle64_to_cpu(attr->data_size); + data_size = sle64_to_cpu(attr->data_size); printf("\tIs resident? \t\t No\n"); printf("\tData size:\t\t %lld\n", data_size); if (!opts.verbose) @@ -1578,8 +1577,7 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol) if ((u8*)ea - buf >= data_size) break; } - if (buf) - free(buf); + free(buf); } /** diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 8727ebc5..2de0c033 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -354,8 +354,7 @@ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, } result = 0; err_out: - if (new_label) - free(new_label); + free(new_label); return result; } diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index ab46d430..097c8144 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -119,7 +119,7 @@ static long ntfs_fuse_get_nr_free_mft_records(ntfs_volume *vol) u8 *buf; long nr_free = 0; s64 br, total = 0; - + if (!(ctx->state & NF_FreeMFTOutdate)) return ctx->free_mft; buf = malloc(vol->cluster_size); @@ -494,7 +494,7 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, total += res; } res = total; -exit: +exit: ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); if (na) ntfs_attr_close(na); @@ -587,8 +587,7 @@ static int ntfs_fuse_create(const char *org_path, const unsigned type) else res = -errno; exit: - if (uname) - free(uname); + free(uname); if (dir_ni) ntfs_inode_close(dir_ni); free(path); @@ -693,8 +692,7 @@ static int ntfs_fuse_link(const char *old_path, const char *new_path) exit: if (ni) ntfs_inode_close(ni); - if (uname) - free(uname); + free(uname); if (dir_ni) ntfs_inode_close(dir_ni); free(path); @@ -742,8 +740,7 @@ static int ntfs_fuse_rm(const char *org_path) exit: if (ni) ntfs_inode_close(ni); - if (uname) - free(uname); + free(uname); if (dir_ni) ntfs_inode_close(dir_ni); free(path); @@ -1015,8 +1012,7 @@ static int ntfs_fuse_getxattr(const char *path, const char *name, exit: if (na) ntfs_attr_close(na); - if (lename) - free(lename); + free(lename); if (ntfs_inode_close(ni)) perror("Failed to close inode"); return res; @@ -1070,8 +1066,7 @@ static int ntfs_fuse_setxattr(const char *path, const char *name, exit: if (na) ntfs_attr_close(na); - if (lename) - free(lename); + free(lename); if (ntfs_inode_close(ni)) perror("Failed to close inode"); return res; @@ -1111,8 +1106,7 @@ static int ntfs_fuse_removexattr(const char *path, const char *name) exit: if (na) ntfs_attr_close(na); - if (lename) - free(lename); + free(lename); if (ntfs_inode_close(ni)) perror("Failed to close inode"); return res; @@ -1140,7 +1134,7 @@ static struct fuse_operations ntfs_fuse_oper = { .utime = ntfs_fuse_utime, #ifdef HAVE_SETXATTR .getxattr = ntfs_fuse_getxattr, -#if 0 +#if 0 .setxattr = ntfs_fuse_setxattr, .removexattr = ntfs_fuse_removexattr, .listxattr = ntfs_fuse_listxattr, @@ -1487,8 +1481,7 @@ int main(int argc, char *argv[]) parsed_options = parse_mount_options((opts.options) ? opts.options : ""); if (!parsed_options) { - if (opts.device) - free(opts.device); + free(opts.device); ntfs_fuse_destroy(); return 3; } diff --git a/ntfsprogs/ntfsmove.h b/ntfsprogs/ntfsmove.h index f13dcdbf..1aeeef2a 100644 --- a/ntfsprogs/ntfsmove.h +++ b/ntfsprogs/ntfsmove.h @@ -39,7 +39,7 @@ struct options { int verbose; /* Extra output */ int noaction; /* Do not write to disk */ int nodirty; /* Do not mark volume dirty */ - u8 padding[4]; /* Unused: alignment to 64 bit. */ + u8 padding[4]; /* Unused: alignment to 64 bit. */ }; #endif /* _NTFSMOVE_H_ */ diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 67b4c185..3b074fdf 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -204,7 +204,7 @@ s64 max_free_cluster_range = 0; #define DIRTY_INODE (1) #define DIRTY_ATTRIB (2) -#define NTFS_MAX_CLUSTER_SIZE (65536) +#define NTFS_MAX_CLUSTER_SIZE (65536) GEN_PRINTF(Eprintf, stderr, NULL, FALSE) GEN_PRINTF(Vprintf, stdout, &opt.verbose, TRUE) @@ -694,7 +694,7 @@ static void collect_resize_constraints(ntfs_resize_t *resize, runlist *rl) exit(1); return; } - + if (inode == FILE_Bitmap) { llcn = &resize->last_lcn; if (atype == AT_DATA && NInoAttrList(resize->ni)) @@ -765,7 +765,7 @@ static void collect_relocation_info(ntfs_resize_t *resize, runlist *rl) if (inode == FILE_Bitmap && resize->ctx->attr->type == AT_DATA) return; - + start = lcn; len = lcn_length; @@ -1636,11 +1636,11 @@ static int is_mftdata(ntfs_resize_t *resize) if (resize->mref == 0) return 1; - + if ( MREF(resize->mrec->base_mft_record) == 0 && MSEQNO(resize->mrec->base_mft_record) != 0) return 1; - + return 0; } @@ -1648,30 +1648,30 @@ static int handle_mftdata(ntfs_resize_t *resize, int do_mftdata) { ATTR_RECORD *attr = resize->ctx->attr; VCN highest_vcn, lowest_vcn; - + if (do_mftdata) { - + if (!is_mftdata(resize)) return 0; - + highest_vcn = sle64_to_cpu(attr->highest_vcn); lowest_vcn = sle64_to_cpu(attr->lowest_vcn); - + if (resize->mft_highest_vcn != highest_vcn) return 0; - + if (lowest_vcn == 0) resize->mft_highest_vcn = lowest_vcn; else resize->mft_highest_vcn = lowest_vcn - 1; } else if (is_mftdata(resize)) { - + highest_vcn = sle64_to_cpu(attr->highest_vcn); - + if (resize->mft_highest_vcn < highest_vcn) resize->mft_highest_vcn = highest_vcn; - + return 0; } @@ -1688,10 +1688,10 @@ static void relocate_attributes(ntfs_resize_t *resize, int do_mftdata) while (!ntfs_attrs_walk(resize->ctx)) { if (resize->ctx->attr->type == AT_END) break; - + if (handle_mftdata(resize, do_mftdata) == 0) continue; - + ret = has_bad_sectors(resize, 0); if (ret == -1) exit(1); @@ -1752,10 +1752,10 @@ static void relocate_inodes(ntfs_resize_t *resize) nr_mft_records = resize->vol->mft_na->initialized_size >> resize->vol->mft_record_size_bits; - for (mref = 0; mref < (MFT_REF)nr_mft_records; mref++) + for (mref = 0; mref < (MFT_REF)nr_mft_records; mref++) relocate_inode(resize, mref, 0); - while(1) { + while (1) { highest_vcn = resize->mft_highest_vcn; mref = nr_mft_records; do { @@ -1769,8 +1769,7 @@ static void relocate_inodes(ntfs_resize_t *resize) "Please report!\n", highest_vcn); } done: - if (resize->mrec) - free(resize->mrec); + free(resize->mrec); } static void print_hint(ntfs_volume *vol, const char *s, struct llcn_t llcn) @@ -1800,12 +1799,12 @@ static void advise_on_resize(ntfs_resize_t *resize) if (opt.verbose) { printf("Estimating smallest shrunken size supported ...\n"); printf("File feature Last used at By inode\n"); - print_hint(vol, "$MFT", resize->last_mft); + print_hint(vol, "$MFT", resize->last_mft); print_hint(vol, "Multi-Record", resize->last_multi_mft); - print_hint(vol, "$MFTMirr", resize->last_mftmir); - print_hint(vol, "Compressed", resize->last_compressed); - print_hint(vol, "Sparse", resize->last_sparse); - print_hint(vol, "Ordinary", resize->last_lcn); + print_hint(vol, "$MFTMirr", resize->last_mftmir); + print_hint(vol, "Compressed", resize->last_compressed); + print_hint(vol, "Sparse", resize->last_sparse); + print_hint(vol, "Ordinary", resize->last_lcn); } print_advise(vol, resize->last_unsupp); @@ -1849,16 +1848,16 @@ static void rl_truncate(runlist **rl, const VCN last_vcn) { int len; VCN vcn; - + len = rl_items(*rl) - 1; if (len <= 0) err_exit("rl_truncate: bad runlist length: %d\n", len); vcn = (*rl)[len].vcn; - + if (vcn < last_vcn) rl_expand(rl, last_vcn); - + else if (vcn > last_vcn) if (ntfs_rl_truncate(rl, last_vcn) == -1) perr_exit("ntfs_rl_truncate"); @@ -1898,7 +1897,7 @@ static void truncate_badclust_bad_attr(ntfs_resize_t *resize) if (!(rl_bad = ntfs_mapping_pairs_decompress(vol, a, NULL))) perr_exit("ntfs_mapping_pairs_decompress"); - + rl_truncate(&rl_bad, nr_clusters); a->highest_vcn = cpu_to_le64(nr_clusters - 1LL); @@ -1945,7 +1944,7 @@ static void realloc_lcn_bitmap(ntfs_resize_t *resize, s64 bm_bsize) if (!(tmp = realloc(resize->lcn_bitmap.bm, bm_bsize))) perr_exit("realloc"); - + resize->lcn_bitmap.bm = tmp; resize->lcn_bitmap.size = bm_bsize; bitmap_file_data_fixup(resize->new_volume_size, &resize->lcn_bitmap); @@ -2037,41 +2036,41 @@ static int check_bad_sectors(ntfs_volume *vol) ntfs_attr_search_ctx *ctx; runlist *rl; s64 i, badclusters = 0; - + Vprintf("Checking for bad sectors ...\n"); lookup_data_attr(vol, FILE_BadClus, "$Bad", &ctx); - + if (NInoAttrList(ctx->ntfs_ino)) err_exit("Hopelessly many bad sectors! Please report to " "linux-ntfs@lists.sf.net\n"); - + if (!ctx->attr->non_resident) err_exit("Resident attribute in $BadClust! Please report to " "linux-ntfs@lists.sf.net\n"); if (!(rl = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL))) perr_exit("Decompressing $BadClust:$Bad mapping pairs failed"); - + for (i = 0; rl[i].length; i++) { /* CHECKME: LCN_RL_NOT_MAPPED check isn't needed */ if (rl[i].lcn == LCN_HOLE || rl[i].lcn == LCN_RL_NOT_MAPPED) continue; - + badclusters += rl[i].length; - Vprintf("Bad cluster: %8lld - %lld\n", rl[i].lcn, + Vprintf("Bad cluster: %8lld - %lld\n", rl[i].lcn, rl[i].lcn + rl[i].length - 1); } if (badclusters) { printf("%sThis software has detected that the disk has at least" - " %lld bad sector%s.\n", + " %lld bad sector%s.\n", !opt.badsectors ? NERR_PREFIX : "WARNING: ", badclusters, badclusters - 1 ? "s" : ""); if (!opt.badsectors) { printf("%s", bad_sectors_warning_msg); exit(1); - } else + } else printf("WARNING: Bad sectors can cause reliability " "problems and massive data loss!!!\n"); } @@ -2263,7 +2262,7 @@ static ntfs_volume *mount_volume(void) printf("%s", corrupt_volume_msg); else if (err == EPERM) printf("%s", hibernated_volume_msg); - else if (err == EOPNOTSUPP) + else if (err == EOPNOTSUPP) printf("%s", unclean_journal_msg); exit(1); } @@ -2384,7 +2383,7 @@ static void check_cluster_allocation(ntfs_volume *vol, ntfsck_t *fsck) printf("%s", corrupt_volume_msg); exit(1); } - + compare_bitmaps(vol, &fsck->lcn_bitmap); } @@ -2444,7 +2443,7 @@ int main(int argc, char **argv) printf("Nothing to do: NTFS volume size is already OK.\n"); exit(0); } - + memset(&resize, 0, sizeof(resize)); resize.vol = vol; resize.new_volume_size = new_size; @@ -2453,13 +2452,13 @@ int main(int argc, char **argv) resize.shrink = 1; if (opt.show_progress) resize.progress.flags |= NTFS_PROGBAR; - /* + /* * Checking and __reporting__ of bad sectors must be done before cluster * allocation check because chkdsk doesn't fix $Bitmap's w/ bad sectors * thus users would (were) quite confused why chkdsk doesn't work. - */ + */ resize.badclusters = check_bad_sectors(vol); - + check_cluster_allocation(vol, &fsck); print_disk_usage(vol, fsck.inuse); @@ -2472,7 +2471,7 @@ int main(int argc, char **argv) check_resize_constraints(&resize); if (opt.info) { - advise_on_resize(&resize); + advise_on_resize(&resize); exit(0); } diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 1b564a2c..0a4cf481 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -264,7 +264,7 @@ static int utils_array_insert (void *ptr, int asize, int before, int count) return -1; src = (u8*) ptr + (before * esize); - dst = src + (count * esize); + dst = src + (count * esize); len = (asize - before) * esize; // XXX what about realloc? @@ -291,7 +291,7 @@ static int utils_array_remove (void *ptr, int asize, int first, int count) return -1; dst = (u8*) ptr + (first * esize); - src = dst + (count * esize); + src = dst + (count * esize); len = (asize - first) * esize; memmove (dst, src, len); diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 0b455e07..c82ad43d 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -64,10 +64,9 @@ #include "layout.h" #include "volume.h" #include "utils.h" +#include "attrdef.h" #include "version.h" -extern const unsigned char attrdef_ntfs12_array[2400]; - const char *EXEC_NAME = "ntfstruncate"; /* Need these global so ntfstruncate_exit can access them. */ diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index d8d009b0..848b9400 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -105,10 +105,6 @@ GEN_PRINTF (Eprintf, stderr, NULL, FALSE) GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) -static int undelete_file (ntfs_volume *vol, long long inode); - -#define _(S) gettext(S) - /** * parse_inode_arg - parses the inode expression * @@ -1571,130 +1567,6 @@ static int set_date (const char *pathname, time_t date) return 1; } -/** - * scan_disk - Search an NTFS volume for files that could be undeleted - * @vol: An ntfs volume obtained from ntfs_mount - * - * Read through all the MFT entries looking for deleted files. For each one - * determine how much of the data lies in unused disk space. - * - * The list can be filtered by name, size and date, using command line options. - * - * Return: -1 Error, something went wrong - * n Success, the number of recoverable files - */ -static int scan_disk (ntfs_volume *vol) -{ - s64 nr_mft_records; - const int BUFSIZE = 8192; - char *buffer = NULL; - int results = 0; - ntfs_attr *attr; - long long size; - long long bmpsize; - int i, j, k, b; - int percent; - struct ufile *file; - regex_t re; - - if (!vol) - return -1; - - attr = ntfs_attr_open (vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0); - if (!attr) { - Eprintf ("ERROR: Couldn't open $MFT/$BITMAP: %s\n", strerror (errno)); - return -1; - } - bmpsize = attr->initialized_size; - - buffer = malloc (BUFSIZE); - if (!buffer) { - Eprintf ("ERROR: Couldn't allocate memory in scan_disk()\n"); - results = -1; - goto out; - } - - if (opts.match) { - int flags = REG_NOSUB; - - if (!opts.match_case) - flags |= REG_ICASE; - if (regcomp (&re, opts.match, flags)) { - Eprintf ("ERROR: Couldn't create a regex.\n"); - goto out; - } - } - - nr_mft_records = vol->mft_na->initialized_size >> - vol->mft_record_size_bits; - - Qprintf ("Inode Flags %%age Date Size Filename\n"); - Qprintf ("---------------------------------------------------------------\n"); - for (i = 0; i < bmpsize; i += BUFSIZE) { - long long read_count = min ((bmpsize - i), BUFSIZE); - size = ntfs_attr_pread (attr, i, read_count, buffer); - if (size < 0) - break; - - for (j = 0; j < size; j++) { - b = buffer[j]; - for (k = 0; k < 8; k++, b>>=1) { - if (((i+j)*8+k) >= nr_mft_records) - goto done; - if (b & 1) - continue; - file = read_record (vol, (i+j)*8+k); - if (!file) { - Eprintf ("Couldn't read MFT Record %d.\n", (i+j)*8+k); - continue; - } - - if ((opts.since > 0) && (file->date <= opts.since)) - goto skip; - if (opts.match && !name_match (&re, file)) - goto skip; - if (opts.size_begin && (opts.size_begin > file->max_size)) - goto skip; - if (opts.size_end && (opts.size_end < file->max_size)) - goto skip; - - percent = calc_percentage (file, vol); - if ((opts.percent == -1) || (percent >= opts.percent)) { - if (opts.verbose) - dump_record (file); - else - list_record (file); - - /* Was -u specified with no inode - so undelete file by regex */ - if (opts.mode == MODE_UNDELETE) { - if (!undelete_file (vol, file->inode)) - Vprintf ("ERROR: Failed to undelete " - "inode %lli\n!", - file->inode); - printf ("\n"); - } - } - if (((opts.percent == -1) && (percent > 0)) || - ((opts.percent > 0) && (percent >= opts.percent))) { - results++; - } -skip: - free_file (file); - } - } - } -done: - Qprintf ("\nFiles with potentially recoverable content: %d\n", results); -out: - if (opts.match) - regfree (&re); - free (buffer); - if (attr) - ntfs_attr_close (attr); - return results; -} - /** * undelete_file - Recover a deleted file from an NTFS volume * @vol: An ntfs volume obtained from ntfs_mount @@ -1940,6 +1812,130 @@ free: return result; } +/** + * scan_disk - Search an NTFS volume for files that could be undeleted + * @vol: An ntfs volume obtained from ntfs_mount + * + * Read through all the MFT entries looking for deleted files. For each one + * determine how much of the data lies in unused disk space. + * + * The list can be filtered by name, size and date, using command line options. + * + * Return: -1 Error, something went wrong + * n Success, the number of recoverable files + */ +static int scan_disk (ntfs_volume *vol) +{ + s64 nr_mft_records; + const int BUFSIZE = 8192; + char *buffer = NULL; + int results = 0; + ntfs_attr *attr; + long long size; + long long bmpsize; + int i, j, k, b; + int percent; + struct ufile *file; + regex_t re; + + if (!vol) + return -1; + + attr = ntfs_attr_open (vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0); + if (!attr) { + Eprintf ("ERROR: Couldn't open $MFT/$BITMAP: %s\n", strerror (errno)); + return -1; + } + bmpsize = attr->initialized_size; + + buffer = malloc (BUFSIZE); + if (!buffer) { + Eprintf ("ERROR: Couldn't allocate memory in scan_disk()\n"); + results = -1; + goto out; + } + + if (opts.match) { + int flags = REG_NOSUB; + + if (!opts.match_case) + flags |= REG_ICASE; + if (regcomp (&re, opts.match, flags)) { + Eprintf ("ERROR: Couldn't create a regex.\n"); + goto out; + } + } + + nr_mft_records = vol->mft_na->initialized_size >> + vol->mft_record_size_bits; + + Qprintf ("Inode Flags %%age Date Size Filename\n"); + Qprintf ("---------------------------------------------------------------\n"); + for (i = 0; i < bmpsize; i += BUFSIZE) { + long long read_count = min ((bmpsize - i), BUFSIZE); + size = ntfs_attr_pread (attr, i, read_count, buffer); + if (size < 0) + break; + + for (j = 0; j < size; j++) { + b = buffer[j]; + for (k = 0; k < 8; k++, b>>=1) { + if (((i+j)*8+k) >= nr_mft_records) + goto done; + if (b & 1) + continue; + file = read_record (vol, (i+j)*8+k); + if (!file) { + Eprintf ("Couldn't read MFT Record %d.\n", (i+j)*8+k); + continue; + } + + if ((opts.since > 0) && (file->date <= opts.since)) + goto skip; + if (opts.match && !name_match (&re, file)) + goto skip; + if (opts.size_begin && (opts.size_begin > file->max_size)) + goto skip; + if (opts.size_end && (opts.size_end < file->max_size)) + goto skip; + + percent = calc_percentage (file, vol); + if ((opts.percent == -1) || (percent >= opts.percent)) { + if (opts.verbose) + dump_record (file); + else + list_record (file); + + /* Was -u specified with no inode + so undelete file by regex */ + if (opts.mode == MODE_UNDELETE) { + if (!undelete_file (vol, file->inode)) + Vprintf ("ERROR: Failed to undelete " + "inode %lli\n!", + file->inode); + printf ("\n"); + } + } + if (((opts.percent == -1) && (percent > 0)) || + ((opts.percent > 0) && (percent >= opts.percent))) { + results++; + } +skip: + free_file (file); + } + } + } +done: + Qprintf ("\nFiles with potentially recoverable content: %d\n", results); +out: + if (opts.match) + regfree (&re); + free (buffer); + if (attr) + ntfs_attr_close (attr); + return results; +} + /** * copy_mft - Write a range of MFT Records to a file * @vol: An ntfs volume obtained from ntfs_mount diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h index ace3341b..f4b0271a 100644 --- a/ntfsprogs/ntfsundelete.h +++ b/ntfsprogs/ntfsundelete.h @@ -102,7 +102,7 @@ struct ufile { struct list_head name; /* A list of filenames */ struct list_head data; /* A list of data streams */ char *pref_name; /* Preferred filename */ - char *pref_pname; /* parent filename */ + char *pref_pname; /* parent filename */ long long max_size; /* Largest size we find */ int attr_list; /* MFT record may be one of many */ int directory; /* MFT record represents a directory */ diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c index 209281fd..a9c5f82f 100644 --- a/ntfsprogs/sd.c +++ b/ntfsprogs/sd.c @@ -1,5 +1,6 @@ #include "types.h" #include "layout.h" +#include "sd.h" /** * init_system_file_sd @@ -27,7 +28,6 @@ * Do NOT free *@sd_val as it is static memory. This also means that you can * only use *@sd_val until the next call to this function. */ -void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len); void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) { static u8 sd_array[0x68]; @@ -200,222 +200,219 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) sid->sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); } - -/* +/** * init_root_sd_31 (ERSO) * creates the security_descriptor for the root folder on ntfs 3.1. * It is very long ; lot's av ACE's at first, then large pieces of zero's - * the owner user/group is near the end. On a partition created with + * the owner user/group is near the end. On a partition created with * w2k3 the owner user/group at the end is surrounded by 'garbage', which I - * yet do not understand. Here I have replaced the 'garbage' with + * yet do not understand. Here I have replaced the 'garbage' with * zero's, which seems to work. Chkdsk does not add the 'garbage', nor alter * this security descriptor in any way. */ - -void init_root_sd_31(u8 **sd_val, int *sd_val_len); void init_root_sd_31(u8 **sd_val, int *sd_val_len) { - SECURITY_DESCRIPTOR_RELATIVE *sd; - ACL *acl; - ACCESS_ALLOWED_ACE *ace; - SID *sid; + SECURITY_DESCRIPTOR_RELATIVE *sd; + ACL *acl; + ACCESS_ALLOWED_ACE *ace; + SID *sid; static char sd_array[0x1200]; - //char* sd_val = NULL; - *sd_val_len = 0x1200; - *sd_val = (u8*)&sd_array; + //char* sd_val = NULL; + *sd_val_len = 0x1200; + *sd_val = (u8*)&sd_array; - //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)&sd_array; - sd->revision = 0x01; - sd->alignment = 0x00; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x1014); - sd->group = cpu_to_le32(0x1024); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)&sd_array; + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x1014); + sd->group = cpu_to_le32(0x1024); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); - //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); - acl->revision = 0x02; - acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x1000); - acl->ace_count = cpu_to_le16(0x07); - acl->alignment2 = cpu_to_le16(0x00); + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x1000); + acl->ace_count = cpu_to_le16(0x07); + acl->alignment2 = cpu_to_le16(0x00); - //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - ace->type = 0x00; - ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; - ace->size = cpu_to_le16(0x18); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; + ace->size = cpu_to_le16(0x18); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | FILE_LIST_DIRECTORY | FILE_WRITE_DATA | FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | FILE_TRAVERSE | FILE_DELETE_CHILD | FILE_READ_ATTRIBUTES; - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); ace->sid.sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - + //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); - ace->type = 0x00; - ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; - ace->size = cpu_to_le16(0x14); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_LIST_DIRECTORY | FILE_WRITE_DATA | - FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | - FILE_TRAVERSE | FILE_DELETE_CHILD | - FILE_READ_ATTRIBUTES; + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; + ace->size = cpu_to_le16(0x14); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - //ace3 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); - ace->type = 0x00; - ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | + //ace3 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE; - ace->size = cpu_to_le16(0x14); - ace->mask = cpu_to_le32(0x10000000); - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - /* SECURITY_CREATOR_SID_AUTHORITY (S-1-3) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 3; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_CREATOR_OWNER_RID); + ace->size = cpu_to_le16(0x14); + ace->mask = cpu_to_le32(0x10000000); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_CREATOR_SID_AUTHORITY (S-1-3) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 3; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_CREATOR_OWNER_RID); - //ace4 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); - ace->type = 0x00; - ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x1200A9); - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - ace->sid.sub_authority[1] = + //ace4 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x1200A9); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_USERS); - //ace5 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); - ace->type = 0x00; - ace->flags = CONTAINER_INHERIT_ACE; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x04); - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_USERS); + //ace5 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = CONTAINER_INHERIT_ACE; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x04); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_USERS); - //ace6 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); - ace->type = 0x00; - ace->flags = CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x02); - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_USERS); + //ace6 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x02); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_USERS); - //ace7 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = cpu_to_le32(0x1200A9); - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - /* SECURITY_WORLD_SID_AUTHORITY (S-1-1) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 1; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_WORLD_RID); + //ace7 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = cpu_to_le32(0x1200A9); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_WORLD_SID_AUTHORITY (S-1-1) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 1; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_WORLD_RID); - //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); } @@ -425,420 +422,15 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) * NTFS 3.0 - System files security decriptors * =========================================== * Create the security descriptor entries in $SDS data stream like they - * are in a partition, newly formatet with windows 2000 - * + * are in a partition, newly formatted with windows 2000 */ -void init_secure_30(char *sd_val); void init_secure_30(char *sd_val) -{ - SECURITY_DESCRIPTOR_HEADER *sds; - SECURITY_DESCRIPTOR_RELATIVE *sd; - ACL *acl; - ACCESS_ALLOWED_ACE *ace; - SID *sid; - -/* - * security descriptor #1 - */ - //header - sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val); - sds->hash = cpu_to_le32(0xF80312F0); - sds->security_id = cpu_to_le32(0x0100); - sds->offset = cpu_to_le64(0x00); - sds->length = cpu_to_le32(0x7C); - //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + - sizeof(SECURITY_DESCRIPTOR_HEADER)); - sd->revision = 0x01; - sd->alignment = 0x00; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); - - //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); - acl->revision = 0x02; - acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(0x02); - acl->alignment2 = 0x00; - - //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = cpu_to_le32(0x120089); - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - - //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x120089); - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - - //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - - //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - -/* - * security descriptor #2 - */ - //header - sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80); - sds->hash = cpu_to_le32(0xB32451); - sds->security_id = cpu_to_le32(0x0101); - sds->offset = cpu_to_le64(0x80); - sds->length = cpu_to_le32(0x7C); - - //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + - sizeof(SECURITY_DESCRIPTOR_HEADER)); - sd->revision = 0x01; - sd->alignment = 0x00; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); - - //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); - acl->revision = 0x02; - acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(0x02); - acl->alignment2 = 0x00; - - //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = cpu_to_le32(0x12019F); - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - - //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x12019F); - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - - //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - - //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - -/* - * security descriptor #3 - */ - //header - sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80); - sds->hash = cpu_to_le32(0x0A9F9562); - sds->security_id = cpu_to_le32(0x0102); - sds->offset = cpu_to_le64(0x0100); - sds->length = cpu_to_le32(0x60); - - //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + - sizeof(SECURITY_DESCRIPTOR_HEADER)); - sd->revision = 0x01; - sd->alignment = 0x00; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x30); - sd->group = cpu_to_le32(0x40); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); - - //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); - acl->revision = 0x02; - acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x1C); - acl->ace_count = cpu_to_le16(0x01); - acl->alignment2 = 0x00; - - //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_LIST_DIRECTORY | FILE_WRITE_DATA | - FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | - FILE_TRAVERSE | FILE_DELETE_CHILD | - FILE_READ_ATTRIBUTES; - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - - //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x01; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - - -/* - * security descriptor #4 - */ - //header - sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80 + 0x60); - sds->hash = cpu_to_le32(0x453F0A2E); - sds->security_id = cpu_to_le32(0x0103); - sds->offset = cpu_to_le64(0x0160); - sds->length = cpu_to_le32(0x78); - - //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + - sizeof(SECURITY_DESCRIPTOR_HEADER)); - sd->revision = 0x01; - sd->alignment = 0x00; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); - - //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); - acl->revision = 0x02; - acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(0x02); - acl->alignment2 = 0x00; - - //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x18); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_LIST_DIRECTORY | FILE_WRITE_DATA | - FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | - FILE_TRAVERSE | FILE_DELETE_CHILD | - FILE_READ_ATTRIBUTES; - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x02; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_LIST_DIRECTORY | FILE_WRITE_DATA | - FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | - FILE_TRAVERSE | FILE_DELETE_CHILD | - FILE_READ_ATTRIBUTES; - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - - //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - - //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x01; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - - return; -} - -/** - * init_secure_31(char **r, int size); - * - * NTFS 3.1 - System files security decriptors - * =========================================== - * Create the security descriptor entries in $SDS data stream like they - * are in a partition, newly formatet with windows 2003 - * - */ -void init_secure_31(char *sd_val); -void init_secure_31(char *sd_val) { SECURITY_DESCRIPTOR_HEADER *sds; - SECURITY_DESCRIPTOR_RELATIVE *sd; - ACL *acl; - ACCESS_ALLOWED_ACE *ace; - SID *sid; + SECURITY_DESCRIPTOR_RELATIVE *sd; + ACL *acl; + ACCESS_ALLOWED_ACE *ace; + SID *sid; /* * security descriptor #1 @@ -850,13 +442,13 @@ void init_secure_31(char *sd_val) sds->offset = cpu_to_le64(0x00); sds->length = cpu_to_le32(0x7C); //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + sizeof(SECURITY_DESCRIPTOR_HEADER)); sd->revision = 0x01; - sd->alignment = 0x00; + sd->alignment = 0x00; sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); + sd->group = cpu_to_le32(0x58); sd->sacl = cpu_to_le32(0x00); sd->dacl = cpu_to_le32(0x14); @@ -867,444 +459,838 @@ void init_secure_31(char *sd_val) acl->size = cpu_to_le16(0x34); acl->ace_count = cpu_to_le16(0x02); acl->alignment2 = 0x00; - - + //ace1 ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); ace->type = 0x00; ace->flags = 0x00; ace->size = cpu_to_le16(0x14); ace->mask = cpu_to_le32(0x120089); - ace->sid.revision = 0x01; + ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x120089); - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x120089); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); sid->revision = 0x01; sid->sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + /* * security descriptor #2 */ - //header - sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80); - sds->hash = cpu_to_le32(0xB32451); - sds->security_id = cpu_to_le32(0x0101); - sds->offset = cpu_to_le64(0x80); - sds->length = cpu_to_le32(0x7C); + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80); + sds->hash = cpu_to_le32(0xB32451); + sds->security_id = cpu_to_le32(0x0101); + sds->offset = cpu_to_le64(0x80); + sds->length = cpu_to_le32(0x7C); - //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + - sizeof(SECURITY_DESCRIPTOR_HEADER)); - sd->revision = 0x01; - sd->alignment = 0x00; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); - //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); - acl->revision = 0x02; - acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(0x02); - acl->alignment2 = 0x00; - - //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = cpu_to_le32(0x12019F); - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x12019F); - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(0x02); + acl->alignment2 = 0x00; - //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = cpu_to_le32(0x12019F); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //ace2 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x12019F); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); /* * security descriptor #3 */ - //header - sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80); - sds->hash = cpu_to_le32(0x0A9F9B62); - sds->security_id = cpu_to_le32(0x0102); - sds->offset = cpu_to_le64(0x0100); - sds->length = cpu_to_le32(0x60); - + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80); + sds->hash = cpu_to_le32(0x0A9F9562); + sds->security_id = cpu_to_le32(0x0102); + sds->offset = cpu_to_le64(0x0100); + sds->length = cpu_to_le32(0x60); - - //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + sizeof(SECURITY_DESCRIPTOR_HEADER)); - sd->revision = 0x01; - sd->alignment = 0x00; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x30); - sd->group = cpu_to_le32(0x40); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x30); + sd->group = cpu_to_le32(0x40); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); - //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); - acl->revision = 0x02; - acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x1C); - acl->ace_count = cpu_to_le16(0x01); - acl->alignment2 = 0x00; + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x1C); + acl->ace_count = cpu_to_le16(0x01); + acl->alignment2 = 0x00; - //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - ace->type = 0x00; - ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; - ace->size = cpu_to_le16(0x14); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_LIST_DIRECTORY | FILE_WRITE_DATA | - FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | - FILE_TRAVERSE | FILE_DELETE_CHILD | - FILE_READ_ATTRIBUTES; - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - - //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - - //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x01; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); /* * security descriptor #4 */ - //header - sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80 + 0x60); - sds->hash = cpu_to_le32(0x0A9F9562); - sds->security_id = cpu_to_le32(0x0103); - sds->offset = cpu_to_le64(0x0160); - sds->length = cpu_to_le32(0x60); + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80 + 0x60); + sds->hash = cpu_to_le32(0x453F0A2E); + sds->security_id = cpu_to_le32(0x0103); + sds->offset = cpu_to_le64(0x0160); + sds->length = cpu_to_le32(0x78); - //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + sizeof(SECURITY_DESCRIPTOR_HEADER)); - sd->revision = 0x01; - sd->alignment = 0x00; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x30); - sd->group = cpu_to_le32(0x40); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); - //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); - acl->revision = 0x02; - acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x1C); - acl->ace_count = cpu_to_le16(0x01); - acl->alignment2 = 0x00; + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(0x02); + acl->alignment2 = 0x00; - //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_LIST_DIRECTORY | FILE_WRITE_DATA | - FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | - FILE_TRAVERSE | FILE_DELETE_CHILD | - FILE_READ_ATTRIBUTES; - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - - //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x01; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - - -/* - * security descriptor #5 - */ - //header - sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80 + - 0x60 + 0x60); - sds->hash = cpu_to_le32(0x453F0A2E); - sds->security_id = cpu_to_le32(0x0104); - sds->offset = cpu_to_le64(0x01C0); - sds->length = cpu_to_le32(0x78); - - //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + - sizeof(SECURITY_DESCRIPTOR_HEADER)); - sd->revision = 0x01; - sd->alignment = 0x00; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); - - //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); - acl->revision = 0x02; - acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(0x02); - acl->alignment2 = 0x00; - - //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x18); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_LIST_DIRECTORY | FILE_WRITE_DATA | - FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | - FILE_TRAVERSE | FILE_DELETE_CHILD | - FILE_READ_ATTRIBUTES; - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x02; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_LIST_DIRECTORY | FILE_WRITE_DATA | - FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | - FILE_TRAVERSE | FILE_DELETE_CHILD | - FILE_READ_ATTRIBUTES; - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + ace->flags = 0x00; + ace->size = cpu_to_le16(0x18); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //ace2 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x01; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x01; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); return; } +/** + * init_secure_31(char **r, int size); + * + * NTFS 3.1 - System files security decriptors + * =========================================== + * Create the security descriptor entries in $SDS data stream like they + * are in a partition, newly formatted with windows 2003 + */ +void init_secure_31(char *sd_val) +{ + SECURITY_DESCRIPTOR_HEADER *sds; + SECURITY_DESCRIPTOR_RELATIVE *sd; + ACL *acl; + ACCESS_ALLOWED_ACE *ace; + SID *sid; + +/* + * security descriptor #1 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val); + sds->hash = cpu_to_le32(0xF80312F0); + sds->security_id = cpu_to_le32(0x0100); + sds->offset = cpu_to_le64(0x00); + sds->length = cpu_to_le32(0x7C); + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(0x02); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = cpu_to_le32(0x120089); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + //ace2 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x120089); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); +/* + * security descriptor #2 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80); + sds->hash = cpu_to_le32(0xB32451); + sds->security_id = cpu_to_le32(0x0101); + sds->offset = cpu_to_le64(0x80); + sds->length = cpu_to_le32(0x7C); + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(0x02); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = cpu_to_le32(0x12019F); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + //ace2 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x18); + ace->mask = cpu_to_le32(0x12019F); + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + +/* + * security descriptor #3 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80); + sds->hash = cpu_to_le32(0x0A9F9B62); + sds->security_id = cpu_to_le32(0x0102); + sds->offset = cpu_to_le64(0x0100); + sds->length = cpu_to_le32(0x60); + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x30); + sd->group = cpu_to_le32(0x40); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x1C); + acl->ace_count = cpu_to_le16(0x01); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; + ace->size = cpu_to_le16(0x14); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + +/* + * security descriptor #4 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80 + 0x60); + sds->hash = cpu_to_le32(0x0A9F9562); + sds->security_id = cpu_to_le32(0x0103); + sds->offset = cpu_to_le64(0x0160); + sds->length = cpu_to_le32(0x60); + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x30); + sd->group = cpu_to_le32(0x40); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x1C); + acl->ace_count = cpu_to_le16(0x01); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x01; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + +/* + * security descriptor #5 + */ + //header + sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80 + + 0x60 + 0x60); + sds->hash = cpu_to_le32(0x453F0A2E); + sds->security_id = cpu_to_le32(0x0104); + sds->offset = cpu_to_le64(0x01C0); + sds->length = cpu_to_le32(0x78); + + //security descriptor relative + sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + sd->revision = 0x01; + sd->alignment = 0x00; + sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; + sd->owner = cpu_to_le32(0x48); + sd->group = cpu_to_le32(0x58); + sd->sacl = cpu_to_le32(0x00); + sd->dacl = cpu_to_le32(0x14); + + //acl + acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl->revision = 0x02; + acl->alignment1 = 0x00; + acl->size = cpu_to_le16(0x34); + acl->ace_count = cpu_to_le16(0x02); + acl->alignment2 = 0x00; + + //ace1 + ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x18); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x02; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + ace->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + //ace2 + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); + ace->type = 0x00; + ace->flags = 0x00; + ace->size = cpu_to_le16(0x14); + ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | + FILE_LIST_DIRECTORY | FILE_WRITE_DATA | + FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | + FILE_TRAVERSE | FILE_DELETE_CHILD | + FILE_READ_ATTRIBUTES; + ace->sid.revision = 0x01; + ace->sid.sub_authority_count = 0x01; + /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ + ace->sid.identifier_authority.value[0] = 0; + ace->sid.identifier_authority.value[1] = 0; + ace->sid.identifier_authority.value[2] = 0; + ace->sid.identifier_authority.value[3] = 0; + ace->sid.identifier_authority.value[4] = 0; + ace->sid.identifier_authority.value[5] = 5; + ace->sid.sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + //owner sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); + sid->revision = 0x01; + sid->sub_authority_count = 0x02; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + //group sid + sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); + sid->revision = 0x01; + sid->sub_authority_count = 0x01; + // SECURITY_NT_SID_AUTHORITY (S-1-5) + sid->identifier_authority.value[0] = 0; + sid->identifier_authority.value[1] = 0; + sid->identifier_authority.value[2] = 0; + sid->identifier_authority.value[3] = 0; + sid->identifier_authority.value[4] = 0; + sid->identifier_authority.value[5] = 5; + sid->sub_authority[0] = + cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + + return; +} diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c index 08cdb0bb..505e7275 100644 --- a/ntfsprogs/upcase.c +++ b/ntfsprogs/upcase.c @@ -29,11 +29,11 @@ #endif #include "types.h" +#include "upcase.h" /** * init_upcase_table */ -void init_upcase_table(ntfschar *uc, u32 uc_len); void init_upcase_table(ntfschar *uc, u32 uc_len) { static int uc_run_table[][3] = { /* Start, End, Add */ diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index fd409371..72e78088 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -50,7 +50,7 @@ #include #endif #ifdef HAVE_LIBINTL_H -# include +#include #endif #ifdef HAVE_STDLIB_H #include @@ -69,6 +69,7 @@ #include "debug.h" #include "dir.h" #include "version.h" +#include "logging.h" const char *ntfs_bugs = "Developers' email address: linux-ntfs-dev@lists.sourceforge.net\n"; const char *ntfs_home = "Linux NTFS homepage: http://linux-ntfs.sourceforge.net\n"; @@ -89,10 +90,10 @@ int utils_set_locale (void) locale = setlocale (LC_ALL, ""); if (!locale) { locale = setlocale (LC_ALL, NULL); - Eprintf ("Failed to set locale, using default '%s'.\n", locale); + ntfs_log_error ("Failed to set locale, using default '%s'.\n", locale); return 1; } else { - Vprintf ("Using locale '%s'.\n", locale); + ntfs_log_verbose ("Using locale '%s'.\n", locale); return 0; } } @@ -125,37 +126,37 @@ int utils_valid_device (const char *name, int force) if (stat (name, &st) == -1) { if (errno == ENOENT) { - Eprintf ("The device %s doesn't exist\n", name); + ntfs_log_error ("The device %s doesn't exist\n", name); } else { - Eprintf ("Error getting information about %s: %s\n", name, strerror (errno)); + ntfs_log_error ("Error getting information about %s: %s\n", name, strerror (errno)); } return 0; } if (!S_ISBLK (st.st_mode)) { - Vprintf ("%s is not a block device.\n", name); + ntfs_log_verbose ("%s is not a block device.\n", name); if (!force) { - Eprintf ("Use the force option to work with files.\n"); + ntfs_log_error ("Use the force option to work with files.\n"); return 0; } - Vprintf ("Forced to continue.\n"); + ntfs_log_verbose ("Forced to continue.\n"); } /* Make sure the file system is not mounted. */ if (ntfs_check_if_mounted (name, &mnt_flags)) { - Vprintf ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); + ntfs_log_verbose ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); if (!force) { - Eprintf ("Use the force option to ignore this error.\n"); + ntfs_log_error ("Use the force option to ignore this error.\n"); return 0; } - Vprintf ("Forced to continue.\n"); + ntfs_log_verbose ("Forced to continue.\n"); } else if (mnt_flags & NTFS_MF_MOUNTED) { - Vprintf ("The device %s, is mounted.\n", name); + ntfs_log_verbose ("The device %s, is mounted.\n", name); if (!force) { - Eprintf ("Use the force option to work a mounted filesystem.\n"); + ntfs_log_error ("Use the force option to work a mounted filesystem.\n"); return 0; } - Vprintf ("Forced to continue.\n"); + ntfs_log_verbose ("Forced to continue.\n"); } return 1; @@ -181,27 +182,27 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL int err; err = errno; - Eprintf("Couldn't mount device '%s': %s\n", device, + ntfs_log_error("Couldn't mount device '%s': %s\n", device, strerror(err)); if (err == EPERM) - Eprintf("Windows was hibernated. Try to mount volume " + ntfs_log_error("Windows was hibernated. Try to mount volume " "in windows, shut down and try " "again.\n"); if (err == EOPNOTSUPP) - Eprintf("Windows did not shut down properly. Try to " + ntfs_log_error("Windows did not shut down properly. Try to " "mount volume in windows, shut down " "and try again.\n"); return NULL; } if (vol->flags & VOLUME_IS_DIRTY) { - Qprintf ("Volume is dirty.\n"); + ntfs_log_quiet ("Volume is dirty.\n"); if (!force) { - Eprintf ("Run chkdsk and try again, or use the --force option.\n"); + ntfs_log_error ("Run chkdsk and try again, or use the --force option.\n"); ntfs_umount (vol, FALSE); return NULL; } - Qprintf ("Forced to continue.\n"); + ntfs_log_quiet ("Forced to continue.\n"); } return vol; @@ -241,16 +242,16 @@ int utils_parse_size (const char *value, s64 *size, BOOL scale) return 0; } - Dprintf ("Parsing size '%s'.\n", value); + ntfs_log_debug ("Parsing size '%s'.\n", value); result = strtoll (value, &suffix, 10); if (result < 0 || errno == ERANGE) { - Eprintf ("Invalid size '%s'.\n", value); + ntfs_log_error ("Invalid size '%s'.\n", value); return 0; } if (!suffix) { - Eprintf ("Internal error, strtoll didn't return a suffix.\n"); + ntfs_log_error ("Internal error, strtoll didn't return a suffix.\n"); return 0; } @@ -263,17 +264,17 @@ int utils_parse_size (const char *value, s64 *size, BOOL scale) case '-': case 0: break; default: - Eprintf ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); + ntfs_log_error ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); return 0; } } else { if ((suffix[0] != '-') && (suffix[0] != 0)) { - Eprintf ("Invalid number '%.*s'.\n", (int)(suffix - value + 1), value); + ntfs_log_error ("Invalid number '%.*s'.\n", (int)(suffix - value + 1), value); return 0; } } - Dprintf ("Parsed size = %lld.\n", result); + ntfs_log_debug ("Parsed size = %lld.\n", result); *size = result; return 1; } @@ -303,7 +304,7 @@ int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale) middle = strchr (string, '-'); if (string == middle) { - Dprintf ("Range has no beginning, defaulting to 0.\n"); + ntfs_log_debug ("Range has no beginning, defaulting to 0.\n"); a = 0; } else { if (!utils_parse_size (string, &a, scale)) @@ -313,7 +314,7 @@ int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale) if (middle) { if (middle[1] == 0) { b = LONG_MAX; // XXX ULLONG_MAX - Dprintf ("Range has no end, defaulting to %lld.\n", b); + ntfs_log_debug ("Range has no end, defaulting to %lld.\n", b); } else { if (!utils_parse_size (middle+1, &b, scale)) return 0; @@ -322,7 +323,7 @@ int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale) b = a; } - Dprintf ("Range '%s' = %lld - %lld\n", string, a, b); + ntfs_log_debug ("Range '%s' = %lld - %lld\n", string, a, b); *start = a; *finish = b; @@ -352,11 +353,11 @@ ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) } if (ntfs_attr_lookup(type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { - Dprintf ("find_attribute didn't find an attribute of type: 0x%02x.\n", type); + ntfs_log_debug ("find_attribute didn't find an attribute of type: 0x%02x.\n", type); return NULL; /* None / no more of that type */ } - Dprintf ("find_attribute found an attribute of type: 0x%02x.\n", type); + ntfs_log_debug ("find_attribute found an attribute of type: 0x%02x.\n", type); return ctx->attr; } @@ -386,16 +387,16 @@ ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) ctx = ntfs_attr_get_search_ctx (NULL, mft); if (!ctx) { - Eprintf ("Couldn't create a search context.\n"); + ntfs_log_error ("Couldn't create a search context.\n"); return NULL; } rec = find_attribute (type, ctx); ntfs_attr_put_search_ctx (ctx); if (rec) - Dprintf ("find_first_attribute: found attr of type 0x%02x.\n", type); + ntfs_log_debug ("find_first_attribute: found attr of type 0x%02x.\n", type); else - Dprintf ("find_first_attribute: didn't find attr of type 0x%02x.\n", type); + ntfs_log_debug ("find_first_attribute: didn't find attr of type 0x%02x.\n", type); return rec; } @@ -432,18 +433,18 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) vol = inode->vol; - //printf ("sizeof (char*) = %d, sizeof (names) = %d\n", sizeof (char*), sizeof (names)); + //ntfs_log_debug ("sizeof (char*) = %d, sizeof (names) = %d\n", sizeof (char*), sizeof (names)); memset (names, 0, sizeof (names)); for (i = 0; i < max_path; i++) { ctx = ntfs_attr_get_search_ctx (inode, NULL); if (!ctx) { - Eprintf ("Couldn't create a search context.\n"); + ntfs_log_error ("Couldn't create a search context.\n"); return 0; } - //printf ("i = %d, inode = %p (%lld)\n", i, inode, inode->mft_no); + //ntfs_log_debug ("i = %d, inode = %p (%lld)\n", i, inode, inode->mft_no); name_space = 4; while ((rec = find_attribute (AT_FILE_NAME, ctx))) { @@ -465,7 +466,7 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) if (ntfs_ucstombs (attr->file_name, attr->file_name_length, &names[i], 0) < 0) { char *temp; - Eprintf ("Couldn't translate filename to current locale.\n"); + ntfs_log_error ("Couldn't translate filename to current locale.\n"); temp = malloc (30); if (!temp) return 0; @@ -474,8 +475,8 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) names[i] = temp; } - //printf ("names[%d] %s\n", i, names[i]); - //printf ("parent = %lld\n", MREF (parent)); + //ntfs_log_debug ("names[%d] %s\n", i, names[i]); + //ntfs_log_debug ("parent = %lld\n", MREF (parent)); } ntfs_attr_put_search_ctx(ctx); @@ -484,13 +485,13 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) ntfs_inode_close (inode); if (MREF (parent) == FILE_root) { /* The root directory, stop. */ - //printf ("inode 5\n"); + //ntfs_log_debug ("inode 5\n"); break; } inode = ntfs_inode_open (vol, parent); if (!inode) { - Eprintf ("Couldn't open inode %llu.\n", + ntfs_log_error ("Couldn't open inode %llu.\n", (unsigned long long)MREF(parent)); break; } @@ -498,7 +499,7 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) if (i >= max_path) { /* If we get into an infinite loop, we'll end up here. */ - Eprintf ("The directory structure is too deep (over %d) nested directories.\n", max_path); + ntfs_log_error ("The directory structure is too deep (over %d) nested directories.\n", max_path); return 0; } @@ -509,7 +510,7 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) len = snprintf (buffer + offset, bufsize - offset, "%c%s", PATH_SEP, names[i]); if (len >= (bufsize - offset)) { - Eprintf ("Pathname was truncated.\n"); + ntfs_log_error ("Pathname was truncated.\n"); break; } @@ -520,7 +521,7 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) for (i = 0; i < max_path; i++) free (names[i]); - Dprintf ("Pathname: %s\n", buffer); + ntfs_log_debug ("Pathname: %s\n", buffer); return 0; } @@ -545,18 +546,18 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int name = NULL; namelen = ntfs_ucsnlen (attrdef->name, sizeof (attrdef->name)); if (ntfs_ucstombs (attrdef->name, namelen, &name, 0) < 0) { - Eprintf ("Couldn't translate attribute type to current locale.\n"); + ntfs_log_error ("Couldn't translate attribute type to current locale.\n"); // ? return 0; } len = snprintf (buffer, bufsize, "%s", name); } else { - Eprintf ("Unknown attribute type 0x%02x\n", attr->type); + ntfs_log_error ("Unknown attribute type 0x%02x\n", attr->type); len = snprintf (buffer, bufsize, ""); } if (len >= bufsize) { - Eprintf ("Attribute type was truncated.\n"); + ntfs_log_error ("Attribute type was truncated.\n"); return 0; } @@ -571,7 +572,7 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int namelen = attr->name_length; if (ntfs_ucstombs ((ntfschar *)((char *)attr + attr->name_offset), namelen, &name, 0) < 0) { - Eprintf ("Couldn't translate attribute name to current locale.\n"); + ntfs_log_error ("Couldn't translate attribute name to current locale.\n"); // ? len = snprintf (buffer, bufsize, ""); return 0; @@ -581,7 +582,7 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int free (name); if (len >= bufsize) { - Eprintf ("Attribute name was truncated.\n"); + ntfs_log_error ("Attribute name was truncated.\n"); return 0; } @@ -620,10 +621,10 @@ int utils_cluster_in_use (ntfs_volume *vol, long long lcn) /* Does lcn lie in the section of $Bitmap we already have cached? */ if ((lcn < bmplcn) || (lcn >= (bmplcn + (sizeof (buffer) << 3)))) { - Dprintf ("Bit lies outside cache.\n"); + ntfs_log_debug ("Bit lies outside cache.\n"); attr = ntfs_attr_open (vol->lcnbmp_ni, AT_DATA, AT_UNNAMED, 0); if (!attr) { - Eprintf ("Couldn't open $Bitmap: %s\n", strerror (errno)); + ntfs_log_error ("Couldn't open $Bitmap: %s\n", strerror (errno)); return -1; } @@ -632,19 +633,18 @@ int utils_cluster_in_use (ntfs_volume *vol, long long lcn) bmplcn = lcn & (~((sizeof (buffer) << 3) - 1)); if (ntfs_attr_pread (attr, (bmplcn>>3), sizeof (buffer), buffer) < 0) { - Eprintf ("Couldn't read $Bitmap: %s\n", strerror (errno)); + ntfs_log_error ("Couldn't read $Bitmap: %s\n", strerror (errno)); ntfs_attr_close (attr); return -1; } - Dprintf ("Reloaded bitmap buffer.\n"); + ntfs_log_debug ("Reloaded bitmap buffer.\n"); ntfs_attr_close (attr); } bit = 1 << (lcn & 7); byte = (lcn >> 3) & (sizeof (buffer) - 1); - Dprintf ("cluster = %lld, bmplcn = %lld, byte = %d, bit = %d, in use %d\n", - lcn, bmplcn, byte, bit, buffer[byte] & bit); + ntfs_log_debug ("cluster = %lld, bmplcn = %lld, byte = %d, bit = %d, in use %d\n", lcn, bmplcn, byte, bit, buffer[byte] & bit); return (buffer[byte] & bit); } @@ -681,24 +681,23 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref) /* Does mref lie in the section of $Bitmap we already have cached? */ if (((s64)MREF(mref) < bmpmref) || ((s64)MREF(mref) >= (bmpmref + (sizeof (buffer) << 3)))) { - Dprintf ("Bit lies outside cache.\n"); + ntfs_log_debug ("Bit lies outside cache.\n"); /* Mark the buffer as not in use, in case the read is shorter. */ memset (buffer, 0, sizeof (buffer)); bmpmref = mref & (~((sizeof (buffer) << 3) - 1)); if (ntfs_attr_pread (vol->mftbmp_na, (bmpmref>>3), sizeof (buffer), buffer) < 0) { - Eprintf ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno)); + ntfs_log_error ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno)); return -1; } - Dprintf ("Reloaded bitmap buffer.\n"); + ntfs_log_debug ("Reloaded bitmap buffer.\n"); } bit = 1 << (mref & 7); byte = (mref >> 3) & (sizeof (buffer) - 1); - Dprintf ("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", - mref, bmpmref, byte, bit, buffer[byte] & bit); + ntfs_log_debug ("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", mref, bmpmref, byte, bit, buffer[byte] & bit); return (buffer[byte] & bit); } @@ -804,38 +803,38 @@ void utils_dump_mem (void *buf, int start, int length, int flags) if (flags & DM_BLUE) col += 4; if (flags & DM_INDENT) - printf ("\t"); + ntfs_log_debug ("\t"); if (flags & DM_BOLD) - printf ("\e[01m"); + ntfs_log_debug ("\e[01m"); if (flags & (DM_RED | DM_BLUE | DM_GREEN | DM_BOLD)) - printf ("\e[%dm", col); + ntfs_log_debug ("\e[%dm", col); if (off == s) - printf("%6.6x ", start); + ntfs_log_debug("%6.6x ", start); else - printf("%6.6x ", off); + ntfs_log_debug("%6.6x ", off); for (i = 0; i < 16; i++) { if ((i == 8) && (!(flags & DM_NO_DIVIDER))) - printf (" -"); + ntfs_log_debug (" -"); if (((off+i) >= start) && ((off+i) < (start+length))) - printf (" %02X", mem[off+i]); + ntfs_log_debug (" %02X", mem[off+i]); else - printf (" "); + ntfs_log_debug (" "); } if (!(flags & DM_NO_ASCII)) { - printf (" "); + ntfs_log_debug (" "); for (i = 0; i < 16; i++) { if (((off+i) < start) || ((off+i) >= (start+length))) - printf (" "); + ntfs_log_debug (" "); else if (isprint (mem[off + i])) - printf ("%c", mem[off + i]); + ntfs_log_debug ("%c", mem[off + i]); else - printf ("."); + ntfs_log_debug ("."); } } if (flags & (DM_RED | DM_BLUE | DM_GREEN | DM_BOLD)) - printf ("\e[0m"); - printf ("\n"); + ntfs_log_debug ("\e[0m"); + ntfs_log_debug ("\n"); } } @@ -902,7 +901,7 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->flags_match = 0; in_use = utils_mftrec_in_use (ctx->vol, (MFT_REF) ctx->mft_num); if (in_use == -1) { - Eprintf ("Error reading inode %llu. Aborting.\n", + ntfs_log_error ("Error reading inode %llu. Aborting.\n", (unsigned long long)ctx->mft_num); return -1; } @@ -912,7 +911,7 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->inode = ntfs_inode_open (ctx->vol, (MFT_REF) ctx->mft_num); if (ctx->inode == NULL) { - Eprintf ("Error reading inode %llu.\n", (unsigned + ntfs_log_error ("Error reading inode %llu.\n", (unsigned long long) ctx->mft_num); continue; } @@ -940,7 +939,7 @@ int mft_next_record (struct mft_search_ctx *ctx) ntfs_attr_put_search_ctx (attr_ctx); } else { - Eprintf ("Couldn't create a search context.\n"); + ntfs_log_error ("Couldn't create a search context.\n"); return -1; } } @@ -950,7 +949,7 @@ int mft_next_record (struct mft_search_ctx *ctx) case 0: ctx->flags_match |= FEMR_NOT_METADATA; break; default: ctx->flags_match |= FEMR_NOT_METADATA; break; - //Eprintf ("Error reading inode %lld.\n", ctx->mft_num); + //ntfs_log_error ("Error reading inode %lld.\n", ctx->mft_num); //return -1; } @@ -961,7 +960,7 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->inode = calloc (1, sizeof (*ctx->inode)); if (!ctx->inode) { - Eprintf ("Out of memory. Aborting.\n"); + ntfs_log_error ("Out of memory. Aborting.\n"); return -1; } @@ -970,20 +969,20 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->inode->mrec = malloc (ctx->vol->mft_record_size); if (!ctx->inode->mrec) { free (ctx->inode); // == ntfs_inode_close - Eprintf ("Out of memory. Aborting.\n"); + ntfs_log_error ("Out of memory. Aborting.\n"); return -1; } mft = ntfs_attr_open (ctx->vol->mft_ni, AT_DATA, AT_UNNAMED, 0); if (!mft) { - Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); + ntfs_log_error ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); // free / close return -1; } if (ntfs_attr_pread (mft, ctx->vol->mft_record_size * ctx->mft_num, ctx->vol->mft_record_size, ctx->inode->mrec) < ctx->vol->mft_record_size) { - Eprintf ("Couldn't read MFT Record %llu: %s.\n", + ntfs_log_error ("Couldn't read MFT Record %llu: %s.\n", (unsigned long long) ctx->mft_num, strerror (errno)); // free / close @@ -999,7 +998,7 @@ int mft_next_record (struct mft_search_ctx *ctx) } if (ntfs_inode_close (ctx->inode)) { - Eprintf ("Error closing inode %llu.\n", + ntfs_log_error ("Error closing inode %llu.\n", (unsigned long long)ctx->mft_num); return -errno; } diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 40b50e6a..f6c09d0e 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -31,9 +31,13 @@ #include "layout.h" #include "volume.h" +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_STDARG_H #include -#include +#endif +//#include extern const char *ntfs_bugs; extern const char *ntfs_home; @@ -42,7 +46,6 @@ extern const char *ntfs_gpl; #if !defined(REG_NOERROR) || (REG_NOERROR != 0) # define REG_NOERROR 0 #endif - #define DEC_PRINTF(NAME) \ int NAME (const char *format, ...) \ __attribute__ ((format (printf, 1, 2))); @@ -67,6 +70,7 @@ extern const char *ntfs_gpl; return ret; \ } + /* utils.c's utilities require the following functions implemented. * Example of implementation is: * GEN_PRINTF (Eprintf, stderr, NULL, FALSE) From 0c2247c7cad77bb9422984310e8a95df7d1120a8 Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 21 Oct 2005 18:08:28 +0000 Subject: [PATCH 2620/2994] new header files to tidy build process --- ntfsprogs/attrdef.h | 8 ++++++++ ntfsprogs/boot.h | 7 +++++++ ntfsprogs/sd.h | 12 ++++++++++++ ntfsprogs/upcase.h | 7 +++++++ 4 files changed, 34 insertions(+) create mode 100644 ntfsprogs/attrdef.h create mode 100644 ntfsprogs/boot.h create mode 100644 ntfsprogs/sd.h create mode 100644 ntfsprogs/upcase.h diff --git a/ntfsprogs/attrdef.h b/ntfsprogs/attrdef.h new file mode 100644 index 00000000..09740fab --- /dev/null +++ b/ntfsprogs/attrdef.h @@ -0,0 +1,8 @@ +#ifndef _NTFS_ATTRDEF_H_ +#define _NTFS_ATTRDEF_H_ + +extern const unsigned char attrdef_ntfs12_array[2400]; +extern const unsigned char attrdef_ntfs3x_array[2560]; + +#endif /* _NTFS_ATTRDEF_H_ */ + diff --git a/ntfsprogs/boot.h b/ntfsprogs/boot.h new file mode 100644 index 00000000..74e9ba12 --- /dev/null +++ b/ntfsprogs/boot.h @@ -0,0 +1,7 @@ +#ifndef _NTFS_BOOT_H_ +#define _NTFS_BOOT_H_ + +extern const unsigned char boot_array[3429]; + +#endif /* _NTFS_BOOT_H_ */ + diff --git a/ntfsprogs/sd.h b/ntfsprogs/sd.h new file mode 100644 index 00000000..aac6b111 --- /dev/null +++ b/ntfsprogs/sd.h @@ -0,0 +1,12 @@ +#ifndef _NTFS_SD_H_ +#define _NTFS_SD_H_ + +#include "types.h" + +void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len); +void init_root_sd_31(u8 **sd_val, int *sd_val_len); +void init_secure_30(char *sd_val); +void init_secure_31(char *sd_val); + +#endif /* _NTFS_SD_H_ */ + diff --git a/ntfsprogs/upcase.h b/ntfsprogs/upcase.h new file mode 100644 index 00000000..9ec567dc --- /dev/null +++ b/ntfsprogs/upcase.h @@ -0,0 +1,7 @@ +#ifndef _NTFS_UPCASE_H_ +#define _NTFS_UPCASE_H_ + +void init_upcase_table(ntfschar *uc, u32 uc_len); + +#endif /* _NTFS_UPCASE_H_ */ + From dd3ce28cd2eb584961bf6c77dd3b0b3b1d3c25e7 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 22 Oct 2005 19:54:01 +0000 Subject: [PATCH 2621/2994] Factor out fix_mount() and fix_mftmirr() from main() Avoid freeing NULL's to end non-constuctive discussion about its usage --- ntfsprogs/ntfsfix.c | 162 ++++++++++++++++++++++++-------------------- 1 file changed, 90 insertions(+), 72 deletions(-) diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index e8ace522..17f456d2 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -300,68 +300,26 @@ static int empty_journal(ntfs_volume *vol) return 0; } -/** - * main - */ -int main(int argc, char **argv) +static int fix_mftmirr(ntfs_volume *vol) { s64 l, br; - unsigned char *m = NULL, *m2 = NULL; - ntfs_volume *vol; - struct ntfs_device *dev; - unsigned long mnt_flags; - int i; - BOOL done, force = FALSE; - - parse_options(argc, argv); - - if (!ntfs_check_if_mounted(opt.volume, &mnt_flags)) { - if ((mnt_flags & NTFS_MF_MOUNTED) && - !(mnt_flags & NTFS_MF_READONLY) && !force) { - fprintf(stderr, "Refusing to operate on read-write " - "mounted device %s.\n", opt.volume); - exit(1); - } - } else - fprintf(stderr, "Failed to determine whether %s is mounted: " - "%s\n", opt.volume, strerror(errno)); - /* Attempt a full mount first. */ - printf("Mounting volume... "); - vol = ntfs_mount(opt.volume, 0); - if (vol) { - puts(OK); - printf("Processing of $MFT and $MFTMirr completed " - "successfully.\n"); - goto mount_ok; - } - puts(FAILED); - - printf("Attempting to correct errors... "); - - dev = ntfs_device_alloc(opt.volume, 0, &ntfs_device_default_io_ops, NULL); - if (!dev) { - puts(FAILED); - perror("Failed to allocate device"); - goto error_exit; - } - - vol = ntfs_volume_startup(dev, 0); - if (!vol) { - puts(FAILED); - perror("Failed to startup volume"); - fprintf(stderr, "Volume is corrupt. You should run chkdsk.\n"); - ntfs_device_free(dev); - goto error_exit; - } - + unsigned char *m, *m2; + int i, ret = -1; /* failure */ + BOOL done; + puts("\nProcessing $MFT and $MFTMirr... "); /* Load data from $MFT and $MFTMirr and compare the contents. */ m = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); - m2 = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); - if (!m || !m2) { + if (!m) { perror("Failed to allocate memory"); - goto error_exit; + return -1; + } + m2 = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); + if (!m2) { + perror("Failed to allocate memory"); + free(m); + return -1; } printf("Reading $MFT... "); @@ -454,12 +412,40 @@ int main(int argc, char **argv) } } puts(OK); - + printf("Processing of $MFT and $MFTMirr completed successfully.\n"); + ret = 0; +error_exit: free(m); free(m2); - m = m2 = NULL; + return ret; +} - printf("Processing of $MFT and $MFTMirr completed successfully.\n"); +static int fix_mount(void) +{ + int ret = -1; /* failure */ + ntfs_volume *vol; + struct ntfs_device *dev; + + printf("Attempting to correct errors... "); + + dev = ntfs_device_alloc(opt.volume, 0, &ntfs_device_default_io_ops, NULL); + if (!dev) { + puts(FAILED); + perror("Failed to allocate device"); + return -1; + } + + vol = ntfs_volume_startup(dev, 0); + if (!vol) { + puts(FAILED); + perror("Failed to startup volume"); + fprintf(stderr, "Volume is corrupt. You should run chkdsk.\n"); + ntfs_device_free(dev); + return -1; + } + + if (fix_mftmirr(vol) < 0) + goto error_exit; /* FIXME: Will this fail? Probably... */ if (set_dirty_flag(vol) < 0) @@ -468,16 +454,53 @@ int main(int argc, char **argv) if (empty_journal(vol) < 0) goto error_exit; + ret = 0; +error_exit: /* ntfs_umount() will invoke ntfs_device_free() for us. */ if (ntfs_umount(vol, 0)) ntfs_umount(vol, 1); + return ret; +} + +/** + * main + */ +int main(int argc, char **argv) +{ + ntfs_volume *vol; + unsigned long mnt_flags; + int ret = 1; /* failure */ + BOOL force = FALSE; + + parse_options(argc, argv); + + if (!ntfs_check_if_mounted(opt.volume, &mnt_flags)) { + if ((mnt_flags & NTFS_MF_MOUNTED) && + !(mnt_flags & NTFS_MF_READONLY) && !force) { + fprintf(stderr, "Refusing to operate on read-write " + "mounted device %s.\n", opt.volume); + exit(1); + } + } else + fprintf(stderr, "Failed to determine whether %s is mounted: " + "%s\n", opt.volume, strerror(errno)); + /* Attempt a full mount first. */ + printf("Mounting volume... "); vol = ntfs_mount(opt.volume, 0); - if (!vol) { - perror("Remount failed"); - goto error_exit; + if (vol) { + puts(OK); + printf("Processing of $MFT and $MFTMirr completed " + "successfully.\n"); + } else { + puts(FAILED); + if (fix_mount() < 0) + exit(1); + vol = ntfs_mount(opt.volume, 0); + if (!vol) { + perror("Remount failed"); + exit(1); + } } -mount_ok: - m = NULL; /* Check NTFS version is ok for us (in $Volume) */ printf("NTFS volume version is %i.%i.\n", vol->major_ver, @@ -506,15 +529,10 @@ mount_ok: printf("NTFS partition %s was processed successfully.\n", vol->dev->d_name); /* Set return code to 0. */ - i = 0; -final_exit: - free(m); - free(m2); - if (vol && ntfs_umount(vol, 0)) - ntfs_umount(vol, 1); - return i; + ret = 0; error_exit: - i = 1; - goto final_exit; + if (ntfs_umount(vol, 0)) + ntfs_umount(vol, 1); + return ret; } From b7aaeece53f91a37d35070a08440a718eb72243e Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 22 Oct 2005 20:22:21 +0000 Subject: [PATCH 2622/2994] documment need ea flag --- include/ntfs/layout.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 3a7e1ecc..9b465b44 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -2339,7 +2339,10 @@ typedef struct { * Extended attribute flags (8-bit). */ typedef enum { - NEED_EA = 0x80, + NEED_EA = 0x80, /* Indicate that the file to which the EA + belongs cannot be interpreted without + understanding the associated extended + attributes. */ } __attribute__((__packed__)) EA_FLAGS; /* From 8980ec6d7662ce10a871e44cac6dced922bfe9b9 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 23 Oct 2005 11:54:00 +0000 Subject: [PATCH 2623/2994] ntfsmount: Add 'streams_interface=' option to select named data streams access interface. Currently supported interfaces are 'none' and 'windows'. --- ChangeLog | 5 +++- ntfsprogs/ntfsmount.c | 66 ++++++++++++++++++++++++++++++++----------- 2 files changed, 54 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index f82bac96..751192a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,7 +34,10 @@ xx/xx/2005 - 1.12.2-WIP ntfs_attr_can_be_resident() apropriately. (Anton) - mkntfs: optionally create NTFS version 3.0 (W2K) or 3.1 (XP, W2K3, Vista). (Implementation by Erik Sornes, adaption by Szaka) - + - ntfsmount: Add 'streams_interface=' option to select named data + streams access interface. Currently supported interfaces are 'none' + and 'windows'. (Yura) + 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. - Fix hardcoded location for uninstalling mount.ntfs-fuse hardlink to diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 097c8144..3fe50b9e 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -76,6 +76,14 @@ typedef struct { void *buf; } ntfs_fuse_fill_context_t; +typedef enum { + NF_STREAMS_INTERFACE_NONE, /* No access to named data streams. */ +#if 0 + NF_STREAMS_INTERFACE_XATTR, /* Map named data streams to xattrs. */ +#endif + NF_STREAMS_INTERFACE_WINDOWS, /* "file:stream" interface. */ +} ntfs_fuse_streams_interface; + typedef struct { ntfs_volume *vol; int state; @@ -85,6 +93,7 @@ typedef struct { gid_t gid; mode_t fmask; mode_t dmask; + ntfs_fuse_streams_interface streams; BOOL ro; BOOL show_sys_files; BOOL succeed_chmod; @@ -255,14 +264,17 @@ static int ntfs_fuse_parse_path(const char *org_path, char **path, stream_name_mbs = strdup(org_path); if (!stream_name_mbs) return -errno; - *path = strsep(&stream_name_mbs, ":"); - if (stream_name_mbs) { - *stream_name = NULL; - res = ntfs_mbstoucs(stream_name_mbs, stream_name, 0); - if (res < 0) - return -errno; - return res; - } + if (ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) { + *path = strsep(&stream_name_mbs, ":"); + if (stream_name_mbs) { + *stream_name = NULL; + res = ntfs_mbstoucs(stream_name_mbs, stream_name, 0); + if (res < 0) + return -errno; + return res; + } + } else + *path = stream_name_mbs; *stream_name = AT_UNNAMED; return 0; } @@ -545,7 +557,7 @@ exit: static int ntfs_fuse_chmod(const char *path, mode_t mode __attribute__((unused))) { - if (strchr(path, ':')) + if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; /* n/a for named data streams. */ if (ctx->succeed_chmod) return 0; @@ -656,10 +668,12 @@ static int ntfs_fuse_link(const char *old_path, const char *new_path) char *path; int res = 0, uname_len; - if (strchr(old_path, ':')) - return -EINVAL; /* n/a for named data streams. */ - if (strchr(new_path, ':')) - return -EINVAL; /* n/a for named data streams. */ + if (strchr(old_path, ':') && /* n/a for named data streams. */ + ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) + return -EINVAL; + if (strchr(new_path, ':') && /* n/a for named data streams. */ + ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) + return -EINVAL; path = strdup(new_path); if (!path) return -errno; @@ -808,14 +822,14 @@ static int ntfs_fuse_rename(const char *old_path, const char *new_path) static int ntfs_fuse_mkdir(const char *path, mode_t mode __attribute__((unused))) { - if (strchr(path, ':')) + if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; /* n/a for named data streams. */ return ntfs_fuse_create(path, NTFS_DT_DIR); } static int ntfs_fuse_rmdir(const char *path) { - if (strchr(path, ':')) + if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; /* n/a for named data streams. */ return ntfs_fuse_rm(path); } @@ -824,7 +838,7 @@ static int ntfs_fuse_utime(const char *path, struct utimbuf *buf) { ntfs_inode *ni; - if (strchr(path, ':')) + if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return 0; /* Unable to change time for named data streams. */ ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); if (!ni) @@ -1155,6 +1169,7 @@ static int ntfs_fuse_init(void) .gid = getegid(), .fmask = 0177, .dmask = 0077, + .streams = NF_STREAMS_INTERFACE_NONE, }; return 0; } @@ -1302,6 +1317,25 @@ static char *parse_mount_options(const char *org_options) if (!setlocale(LC_ALL, val)) Eprintf("Failed to set locale to %s. " "Continue anyway.\n", val); + } else if (!strcmp(opt, "streams_interface")) { + if (!val) { + Eprintf("'streams_interface' option " + "should have value.\n"); + goto err_exit; + } + if (!strcmp(val, "none")) + ctx->streams = NF_STREAMS_INTERFACE_NONE; +#if 0 + else if (!strcmp(val, "xattr")) + ctx->streams = NF_STREAMS_INTERFACE_XATTR; +#endif + else if (!strcmp(val, "windows")) + ctx->streams = NF_STREAMS_INTERFACE_WINDOWS; + else { + Eprintf("Invalid named data streams access " + "interface.\n"); + goto err_exit; + } } else if (!strcmp(opt, "noauto")) { /* Don't pass noauto option to fuse. */ } else { /* Probably FUSE option. */ From 9be56ad8481cdf7e892289bb41af13e4e4aa4dda Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 23 Oct 2005 14:00:37 +0000 Subject: [PATCH 2624/2994] ntfscat can display named attributes, streams too --- ChangeLog | 1 + ntfsprogs/ntfscat.8.in | 31 +++++++++++++--------- ntfsprogs/ntfscat.c | 60 ++++++++++++++++++++++++------------------ ntfsprogs/ntfscat.h | 2 ++ 4 files changed, 57 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 751192a3..7550e059 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,7 @@ xx/xx/2005 - 1.12.2-WIP - ntfsmount: Add 'streams_interface=' option to select named data streams access interface. Currently supported interfaces are 'none' and 'windows'. (Yura) + - ntfscat can display named attributes, streams too. (Szaka) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in index 253e4e34..038d07e3 100644 --- a/ntfsprogs/ntfscat.8.in +++ b/ntfsprogs/ntfscat.8.in @@ -2,9 +2,9 @@ .\" Copyright (c) 2003 Richard Russon. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCAT 8 "October 2003" "ntfsprogs version @VERSION@" +.TH NTFSCAT 8 "October 2005" "ntfsprogs version @VERSION@" .SH NAME -ntfscat \- concatenate files and print them on the standard output +ntfscat \- print NTFS files and streams on the standard output .SH SYNOPSIS .B ntfscat [ @@ -13,7 +13,8 @@ ntfscat \- concatenate files and print them on the standard output .B device file .SH DESCRIPTION .B ntfscat -will read a file from an NTFS volume and display the contents on the standard output. +will read a file or stream from an NTFS volume and display the contents +on the standard output. .PP The case of the filename passed to .B ntfscat @@ -32,14 +33,14 @@ is equivalent to .BR "\-f \-v" . Long named options can be abbreviated to any unique prefix of their name. .TP -.B "\-a " desc +.B "\-a " type .br .ns .TP -.B "\-\-attribute " desc -Display the contents of a particular attribute. By default, the unname $DATA -attribute will be shown. The attribute can be specified by number (in decimal -or hexadecimal), or by name. +.B "\-\-attribute " type +Display the contents of a particular attribute type. By default, the unnamed +$DATA attribute will be shown. The attribute can be specified by a number +in decimal or hexadecimal, or by name. .TS lB lB lB l l l. @@ -68,6 +69,13 @@ The attribute names may be given without the leading $ symbol. .br If you use the $ symbol, you must escape it from the shell. .TP +.B "\-n " name +.br +.ns +.TP +.B "\-\-attribute-name " name +Display this named attribute, stream. +.TP .B "\-i " num .br .ns @@ -122,10 +130,9 @@ Display the contents of the $INDEX_ROOT attribute of the root directory (inode .sp .B ntfscat /dev/hda1 \-a INDEX_ROOT \-i 5 | hexdump \-C .RE -.SH BUGS -.B ntfscat -was written in a short time, to get something "out there". It needs a lot more work. -If you find any bugs, please send an email to +.SH KNOWN ISSUES +There are no known problems. If you think you had found any then +please report it to .nh .hy diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 1964fa25..2a939279 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -3,6 +3,7 @@ * * Copyright (c) 2003-2005 Richard Russon * Copyright (c) 2003-2005 Anton Altaparmakov + * Copyright (c) 2003-2005 Szabolcs Szakacsits * * This utility will concatenate files and print on the standard output. * @@ -80,16 +81,15 @@ static void version (void) static void usage (void) { Printf ("\nUsage: %s [options] device [file]\n\n" - " -a, --attribute desc Display this attribute (name or number)\n" - " -i, --inode num Display this inode\n\n" - " -f --force Use less caution\n" - " -h --help Print this help\n" - " -q --quiet Less output\n" - " -V --version Version information\n" - " -v --verbose More output\n\n", - //" -N --name Display this attribute name", - //" -F --file Display this file", - //" -r --raw Display the compressed or encrypted file", + " -a, --attribute type Display this attribute type\n" + " -n, --attribute-name name Display this attribute name\n" + " -i, --inode num Display this inode\n\n" + " -f --force Use less caution\n" + " -h --help Print this help\n" + " -q --quiet Less output\n" + " -V --version Version information\n" + " -v --verbose More output\n\n", + //" -r --raw Display the compressed or encrypted file", EXEC_NAME); Printf ("%s%s\n", ntfs_bugs, ntfs_home); } @@ -159,18 +159,17 @@ static int parse_attribute (const char *value, ATTR_TYPES *attr) */ static int parse_options (int argc, char **argv) { - static const char *sopt = "-a:fh?i:qVv"; // F:N: + static const char *sopt = "-a:fh?i:n:qVv"; static const struct option lopt[] = { - { "attribute", required_argument, NULL, 'a' }, - { "force", no_argument, NULL, 'f' }, - { "help", no_argument, NULL, 'h' }, - { "inode", required_argument, NULL, 'i' }, - { "quiet", no_argument, NULL, 'q' }, - { "version", no_argument, NULL, 'V' }, - { "verbose", no_argument, NULL, 'v' }, - // { "file", required_argument, NULL, 'F' }, - // { "name", required_argument, NULL, 'N' }, - { NULL, 0, NULL, 0 } + { "attribute", required_argument, NULL, 'a' }, + { "attribute-name", required_argument, NULL, 'n' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "inode", required_argument, NULL, 'i' }, + { "quiet", no_argument, NULL, 'q' }, + { "version", no_argument, NULL, 'V' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 } }; char c = -1; @@ -183,6 +182,8 @@ static int parse_options (int argc, char **argv) opts.inode = -1; opts.attr = -1; + opts.attr_name = NULL; + opts.attr_name_len = 0; while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { @@ -223,6 +224,16 @@ static int parse_options (int argc, char **argv) Eprintf("Couldn't parse inode number.\n"); err++; break; + + case 'n': + opts.attr_name_len = ntfs_mbstoucs(optarg, + &opts.attr_name, 0); + if (opts.attr_name_len < 0) { + Eprintf("Invalid attribute name '%s': %s\n", + optarg, strerror(errno)); + usage(); + } + case 'q': opts.quiet++; break; @@ -298,8 +309,7 @@ static int index_get_size (ntfs_inode *inode) * cat */ static int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, - ntfschar *name __attribute__((unused)), - int namelen __attribute__((unused))) + ntfschar *name, int namelen) { const int bufsize = 4096; char *buffer; @@ -312,7 +322,7 @@ static int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, if (!buffer) return 1; - attr = ntfs_attr_open (inode, type, NULL, 0); + attr = ntfs_attr_open (inode, type, name, namelen); if (!attr) { Eprintf ("Cannot find attribute type 0x%lx.\n", (long) type); free (buffer); @@ -396,7 +406,7 @@ int main (int argc, char *argv[]) if (opts.attr != (ATTR_TYPES)-1) attr = opts.attr; - result = cat (vol, inode, attr, NULL, 0); + result = cat(vol, inode, attr, opts.attr_name, opts.attr_name_len); ntfs_inode_close (inode); ntfs_umount (vol, FALSE); diff --git a/ntfsprogs/ntfscat.h b/ntfsprogs/ntfscat.h index a69df80c..75b2b068 100644 --- a/ntfsprogs/ntfscat.h +++ b/ntfsprogs/ntfscat.h @@ -33,6 +33,8 @@ struct options { char *file; /* File to display */ s64 inode; /* Inode to work with */ ATTR_TYPES attr; /* Attribute type to display */ + ntfschar *attr_name; /* Attribute name to display */ + int attr_name_len; /* Attribute name length */ int force; /* Override common sense */ int quiet; /* Less output */ int verbose; /* Extra output */ From 746dff1a24283ea0604ae1a40549c583bc007729 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 23 Oct 2005 18:35:58 +0000 Subject: [PATCH 2625/2994] NTFS_INDEX_ prefix $I30, $SII, $SDH, $O and $Q indexes --- include/ntfs/dir.h | 10 +++++----- libntfs/attrib.c | 4 ++-- libntfs/dir.c | 34 +++++++++++++++++----------------- libntfs/index.c | 2 +- libntfs/inode.c | 2 +- libntfs/tree.c | 6 +++--- ntfsprogs/mkntfs.c | 16 ++++++++-------- ntfsprogs/ntfsmount.c | 2 +- ntfsprogs/ntfswipe.c | 6 +++--- ntfsprogs/utils.c | 2 +- 10 files changed, 42 insertions(+), 42 deletions(-) diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index fee2dd3c..a274f80a 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -35,11 +35,11 @@ /* The little endian Unicode strings $I30, $SII, $SDH, $O, $Q * as a global constant. */ -extern ntfschar I30[5]; -extern ntfschar SII[5]; -extern ntfschar SDH[5]; -extern ntfschar O[3]; -extern ntfschar Q[3]; +extern ntfschar NTFS_INDEX_I30[5]; +extern ntfschar NTFS_INDEX_SII[5]; +extern ntfschar NTFS_INDEX_SDH[5]; +extern ntfschar NTFS_INDEX_O[3]; +extern ntfschar NTFS_INDEX_Q[3]; extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname, const int uname_len); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index a4366143..e1ecf730 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -349,7 +349,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, na = calloc(sizeof(ntfs_attr), 1); if (!na) return NULL; - if (name && name != AT_UNNAMED && name != I30) { + if (name && name != AT_UNNAMED && name != NTFS_INDEX_I30) { name = ntfs_ucsndup(name, name_len); if (!name) { err = errno; @@ -427,7 +427,7 @@ void ntfs_attr_close(ntfs_attr *na) if (NAttrNonResident(na) && na->rl) free(na->rl); /* Don't release if using an internal constant. */ - if (na->name != AT_UNNAMED && na->name != I30) + if (na->name != AT_UNNAMED && na->name != NTFS_INDEX_I30) free(na->name); free(na); } diff --git a/libntfs/dir.c b/libntfs/dir.c index fc2756f8..410028cf 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -51,18 +51,18 @@ * The little endian Unicode strings "$I30", "$SII", "$SDH", "$O" * and "$Q" as global constants. */ -ntfschar I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'), +ntfschar NTFS_INDEX_I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'), const_cpu_to_le16('3'), const_cpu_to_le16('0'), const_cpu_to_le16('\0') }; -ntfschar SII[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'), +ntfschar NTFS_INDEX_SII[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'), const_cpu_to_le16('I'), const_cpu_to_le16('I'), const_cpu_to_le16('\0') }; -ntfschar SDH[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'), +ntfschar NTFS_INDEX_SDH[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'), const_cpu_to_le16('D'), const_cpu_to_le16('H'), const_cpu_to_le16('\0') }; -ntfschar O[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('O'), +ntfschar NTFS_INDEX_O[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('O'), const_cpu_to_le16('\0') }; -ntfschar Q[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('Q'), +ntfschar NTFS_INDEX_Q[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('Q'), const_cpu_to_le16('\0') }; /** @@ -117,7 +117,7 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname, return -1; /* Find the index root attribute in the mft record. */ - if (ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, + if (ntfs_attr_lookup(AT_INDEX_ROOT, NTFS_INDEX_I30, 4, CASE_SENSITIVE, 0, NULL, 0, ctx)) { ntfs_log_perror("Index root attribute missing in directory inode " "0x%llx", (unsigned long long)dir_ni->mft_no); @@ -252,7 +252,7 @@ found_it: } /* Child node present, descend into it. */ /* Open the index allocation attribute. */ - ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, I30, 4); + ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4); if (!ia_na) { ntfs_log_perror("Failed to open index allocation attribute. Directory " "inode 0x%llx is corrupt or driver bug", @@ -757,7 +757,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, (unsigned long long)dir_ni->mft_no, (long long)*pos); /* Open the index allocation attribute. */ - ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, I30, 4); + ia_na = ntfs_attr_open(dir_ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4); if (!ia_na) { if (errno != ENOENT) { ntfs_log_perror("Failed to open index allocation attribute. " @@ -808,7 +808,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, /* Get the offset into the index root attribute. */ ir_pos = (int)*pos; /* Find the index root attribute in the mft record. */ - if (ntfs_attr_lookup(AT_INDEX_ROOT, I30, 4, CASE_SENSITIVE, 0, NULL, + if (ntfs_attr_lookup(AT_INDEX_ROOT, NTFS_INDEX_I30, 4, CASE_SENSITIVE, 0, NULL, 0, ctx)) { ntfs_log_debug("Index root attribute missing in directory inode " "0x%llx.\n", (unsigned long long)dir_ni->mft_no); @@ -899,7 +899,7 @@ skip_index_root: goto err_out; } - bmp_na = ntfs_attr_open(dir_ni, AT_BITMAP, I30, 4); + bmp_na = ntfs_attr_open(dir_ni, AT_BITMAP, NTFS_INDEX_I30, 4); if (!bmp_na) { ntfs_log_perror("Failed to open index bitmap attribute"); goto dir_err_out; @@ -1153,7 +1153,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, ie->key_length = 0; ie->flags = INDEX_ENTRY_END; /* Add INDEX_ROOT attribute to inode. */ - if (ntfs_attr_add(ni, AT_INDEX_ROOT, I30, 4, (u8*)ir, ir_len)) { + if (ntfs_attr_add(ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4, (u8*)ir, ir_len)) { err = errno; free(ir); ntfs_log_error("Failed to add INDEX_ROOT attribute."); @@ -1254,7 +1254,7 @@ int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) { ntfs_attr *na; - na = ntfs_attr_open(ni, AT_INDEX_ROOT, I30, 4); + na = ntfs_attr_open(ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4); if (!na) { ntfs_log_error("Corrupt directory or library bug."); errno = EIO; @@ -1317,7 +1317,7 @@ search: if (errno) goto err_out; /* Search for such FILE_NAME in index. */ - ictx = ntfs_index_ctx_get(dir_ni, I30, 4); + ictx = ntfs_index_ctx_get(dir_ni, NTFS_INDEX_I30, 4); if (!ictx) goto err_out; if (ntfs_index_lookup(fn, le32_to_cpu(actx->attr->value_length), ictx)) @@ -1471,7 +1471,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) err = errno; ntfs_log_error("Failed to add FILE_NAME attribute."); /* Try to remove just added attribute from index. */ - ictx = ntfs_index_ctx_get(dir_ni, I30, 4); + ictx = ntfs_index_ctx_get(dir_ni, NTFS_INDEX_I30, 4); if (!ictx) goto rollback_failed; if (ntfs_index_lookup(fn, fn_len, ictx)) { @@ -1787,8 +1787,8 @@ struct ntfs_dir * ntfs_dir_create(ntfs_volume *vol, MFT_REF mft_num) } dir->inode = inode; - dir->iroot = ntfs_attr_open(inode, AT_INDEX_ROOT, I30, 4); - dir->ialloc = ntfs_attr_open(inode, AT_INDEX_ALLOCATION, I30, 4); + dir->iroot = ntfs_attr_open(inode, AT_INDEX_ROOT, NTFS_INDEX_I30, 4); + dir->ialloc = ntfs_attr_open(inode, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4); if (!dir->iroot) { ntfs_dir_free(dir); @@ -1805,7 +1805,7 @@ struct ntfs_dir * ntfs_dir_create(ntfs_volume *vol, MFT_REF mft_num) dir->mft_num = mft_num; // This may not exist - dir->bitmap = ntfs_bmp_create(inode, AT_BITMAP, I30, 4); + dir->bitmap = ntfs_bmp_create(inode, AT_BITMAP, NTFS_INDEX_I30, 4); if (dir->iroot) { rec = find_first_attribute(AT_INDEX_ROOT, inode->mrec); diff --git a/libntfs/index.c b/libntfs/index.c index f575039a..b7274c86 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -477,7 +477,7 @@ int ntfs_index_add_filename(ntfs_inode *ni, FILE_NAME_ATTR *fn, MFT_REF mref) errno = EINVAL; return -1; } - ictx = ntfs_index_ctx_get(ni, I30, 4); + ictx = ntfs_index_ctx_get(ni, NTFS_INDEX_I30, 4); if (!ictx) return -1; fn_size = (fn->file_name_length * sizeof(ntfschar)) + diff --git a/libntfs/inode.c b/libntfs/inode.c index b13b24da..a01ed251 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -530,7 +530,7 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni) ntfs_log_trace("Failed to open inode with index.\n"); continue; } - ictx = ntfs_index_ctx_get(index_ni, I30, 4); + ictx = ntfs_index_ctx_get(index_ni, NTFS_INDEX_I30, 4); if (!ictx) { if (!err) err = errno; diff --git a/libntfs/tree.c b/libntfs/tree.c index 1256ecae..0e11284e 100644 --- a/libntfs/tree.c +++ b/libntfs/tree.c @@ -1422,7 +1422,7 @@ int ntfs_dt_root_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, del->header->index_length += len; del->header->allocated_size += len; - ntfs_mft_resize_resident(del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); + ntfs_mft_resize_resident(del->dir->inode, AT_INDEX_ROOT, NTFS_INDEX_I30, 4, del->data, del->data_len); //utils_dump_mem(attr, 0, del->data_len, DM_DEFAULTS); @@ -1573,7 +1573,7 @@ BOOL ntfs_dt_root_remove(struct ntfs_dt *del, int del_num) del->header->index_length = del->data_len - 16; del->header->allocated_size = del->data_len - 16; - ntfs_mft_resize_resident(del->dir->inode, AT_INDEX_ROOT, I30, 4, del->data, del->data_len); + ntfs_mft_resize_resident(del->dir->inode, AT_INDEX_ROOT, NTFS_INDEX_I30, 4, del->data, del->data_len); old = del->data; del->data = realloc(del->data, del->data_len); del->header = (INDEX_HEADER*) (del->data + 0x10); @@ -1908,7 +1908,7 @@ int ntfs_dt_root_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, str //utils_dump_mem(parent->data, 0, parent->data_len, DM_DEFAULTS); ntfs_log_debug("\n"); - ntfs_mft_resize_resident(parent->dir->inode, AT_INDEX_ROOT, I30, 4, parent->data, parent->data_len); + ntfs_mft_resize_resident(parent->dir->inode, AT_INDEX_ROOT, NTFS_INDEX_I30, 4, parent->data, parent->data_len); //realloc children, sub_nodes ntfs_dt_create_children2(parent, parent->child_count + 1); diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 290cda0d..bc5d8956 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2897,12 +2897,12 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) { sii_data->size_in_sds = sds_header->length; if ((err = insert_index_entry_in_res_dir_index(idx_entry_sdh, sdh_size, m, - SDH, 4, AT_UNUSED))) + NTFS_INDEX_SDH, 4, AT_UNUSED))) break; if ((err = insert_index_entry_in_res_dir_index(idx_entry_sii, sii_size, m, - SII, 4, AT_UNUSED))) + NTFS_INDEX_SII, 4, AT_UNUSED))) break; sds_header = (SECURITY_DESCRIPTOR_HEADER*)((char*)sds_header + (cpu_to_le32(sds_header->length + 0x0F) & @@ -2961,7 +2961,7 @@ static int initialize_quota(MFT_RECORD *m) { err = insert_index_entry_in_res_dir_index(idx_entry_o, o_size, m, - O, 2, AT_UNUSED); + NTFS_INDEX_O, 2, AT_UNUSED); free(idx_entry_o); if (err) return err; @@ -2988,7 +2988,7 @@ static int initialize_quota(MFT_RECORD *m) { err = insert_index_entry_in_res_dir_index(idx_entry_q1, q1_size, m, - Q, 2, AT_UNUSED); + NTFS_INDEX_Q, 2, AT_UNUSED); free(idx_entry_q1); if (err) return err; @@ -3023,7 +3023,7 @@ static int initialize_quota(MFT_RECORD *m) { err = insert_index_entry_in_res_dir_index(idx_entry_q2, q2_size, m, - Q, 2, AT_UNUSED); + NTFS_INDEX_Q, 2, AT_UNUSED); free(idx_entry_q2); return err; @@ -3063,7 +3063,7 @@ static int initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) { idx_entry_o_data->domain_id = *zero_guid; err = insert_index_entry_in_res_dir_index(idx_entry_o, o_size, m, - O, 2, AT_UNUSED); + NTFS_INDEX_O, 2, AT_UNUSED); if (idx_entry_o) free (idx_entry_o); return err; @@ -3294,7 +3294,7 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, idx_entry_new->key_length = fn_size; memcpy((char*)idx_entry_new+0x10, (char*)fn, fn_size); i = insert_index_entry_in_res_dir_index(idx_entry_new, idx_size + 0x10 - , m_parent, I30, 4, AT_FILE_NAME); + , m_parent, NTFS_INDEX_I30, 4, AT_FILE_NAME); if (i < 0) { Eprintf("create_hardlink failed inserting index entry: %s\n", strerror(-i)); @@ -4966,7 +4966,7 @@ int main(int argc, char **argv) // update during each subsequent c&w of each system file. Vprintf("Syncing root directory index record.\n"); mkntfs_sync_index_record(index_block, (MFT_RECORD*)(buf + - 5 * vol->mft_record_size), I30, 4); + 5 * vol->mft_record_size), NTFS_INDEX_I30, 4); Vprintf("Syncing $Bitmap.\n"); m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 3fe50b9e..0accd102 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -298,7 +298,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY && !stream_name_len) { stbuf->st_mode = S_IFDIR | (0777 & ~ctx->dmask); - na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, I30, 4); + na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4); if (na) { stbuf->st_size = na->data_size; stbuf->st_blocks = na->allocated_size >> diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index c83c1541..66f63479 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -979,7 +979,7 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) goto close_inode; } - naa = ntfs_attr_open (ni, AT_INDEX_ALLOCATION, I30, 4); + naa = ntfs_attr_open (ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4); if (!naa) { if (opts.verbose > 2) Vprintf ("Couldn't open $INDEX_ALLOCATION\n"); @@ -1002,7 +1002,7 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) goto close_attr_allocation; } - nab = ntfs_attr_open (ni, AT_BITMAP, I30, 4); + nab = ntfs_attr_open (ni, AT_BITMAP, NTFS_INDEX_I30, 4); if (!nab) { Vprintf ("Couldn't open $BITMAP\n"); Eprintf ("damaged fs: $INDEX_ALLOCATION is present, " @@ -1011,7 +1011,7 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) goto close_attr_allocation; } - nar = ntfs_attr_open (ni, AT_INDEX_ROOT, I30, 4); + nar = ntfs_attr_open (ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4); if (!nar) { Vprintf ("Couldn't open $INDEX_ROOT\n"); Eprintf ("damaged fs: $INDEX_ALLOCATION is present, but " diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 72e78088..b7682ac3 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -934,7 +934,7 @@ int mft_next_record (struct mft_search_ctx *ctx) if (ctx->flags_search & FEMR_DIR) { attr_ctx = ntfs_attr_get_search_ctx (ctx->inode, NULL); if (attr_ctx) { - if (ntfs_attr_lookup (AT_INDEX_ROOT, I30, 4, 0, 0, NULL, 0, attr_ctx) == 0) + if (ntfs_attr_lookup (AT_INDEX_ROOT, NTFS_INDEX_I30, 4, 0, 0, NULL, 0, attr_ctx) == 0) ctx->flags_match |= FEMR_DIR; ntfs_attr_put_search_ctx (attr_ctx); From 7cbc0a6cb69aec49d7690995958f7e78c533b7b6 Mon Sep 17 00:00:00 2001 From: uvman Date: Mon, 24 Oct 2005 20:50:05 +0000 Subject: [PATCH 2626/2994] Remove any uses of the old logging system (Dputs, Dprintf, ...) from libntfs. --- include/ntfs/debug.h | 23 ++---- libntfs/attrlist.c | 3 + libntfs/collate.c | 4 + libntfs/debug.c | 6 +- libntfs/index.c | 6 ++ libntfs/logfile.c | 6 ++ libntfs/runlist.c | 1 - libntfs/win32_io.c | 175 +++++++++++++++++++++---------------------- 8 files changed, 116 insertions(+), 108 deletions(-) diff --git a/include/ntfs/debug.h b/include/ntfs/debug.h index 61ac9df7..805b4587 100644 --- a/include/ntfs/debug.h +++ b/include/ntfs/debug.h @@ -29,15 +29,8 @@ #ifdef HAVE_STDIO_H #include #endif -#ifdef HAVE_STDARG_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_ERRNO_H -#include -#endif + +#include "logging.h" struct _runlist_element; @@ -85,12 +78,12 @@ static __inline__ void ntfs_debug_runlist_dump(const struct _runlist_element *rl extern void ntfs_debug_runlist_dump(const struct _runlist_element *rl); #endif -#define NTFS_BUG(msg) \ -{ \ - int ___i; \ - fprintf(stderr, "libntfs: Bug in %s(): %s\n", __FUNCTION__, msg); \ - Dputs("Forcing segmentation fault!"); \ - ___i = ((int*)NULL)[1]; \ +#define NTFS_BUG(msg) \ +{ \ + int ___i; \ + ntfs_log_critical("Bug in %s(): %s\n", __FUNCTION__, msg); \ + ntfs_log_debug("Forcing segmentation fault!"); \ + ___i = ((int*)NULL)[1]; \ } #endif /* defined _NTFS_DEBUG_H */ diff --git a/libntfs/attrlist.c b/libntfs/attrlist.c index b1c7475b..f09d4b42 100644 --- a/libntfs/attrlist.c +++ b/libntfs/attrlist.c @@ -25,6 +25,9 @@ #include "config.h" #endif +#ifdef HAVE_STRING_H +#include +#endif #ifdef HAVE_STDLIB_H #include #endif diff --git a/libntfs/collate.c b/libntfs/collate.c index 08128ca1..7bc354a2 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -24,6 +24,10 @@ #include "config.h" #endif +#ifdef HAVE_STRING_H +#include +#endif + #include "collate.h" #include "debug.h" #include "unistr.h" diff --git a/libntfs/debug.c b/libntfs/debug.c index c9803ca5..425dbd64 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -23,8 +23,12 @@ #include "config.h" #endif +#ifdef HAVE_ERRNO_H +#include +#endif + #include "types.h" -#include "attrib.h" +#include "runlist.h" #include "debug.h" #include "logging.h" diff --git a/libntfs/index.c b/libntfs/index.c index b7274c86..670fdc02 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -28,6 +28,12 @@ #ifdef HAVE_STDLIB_H #include #endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_ERRNO_H +#include +#endif #include "attrib.h" #include "collate.h" diff --git a/libntfs/logfile.c b/libntfs/logfile.c index 53f5359c..7ed40304 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -27,6 +27,12 @@ #ifdef HAVE_STDLIB_H #include #endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_ERRNO_H +#include +#endif #include "attrib.h" #include "debug.h" diff --git a/libntfs/runlist.c b/libntfs/runlist.c index f70f3e35..ccce7538 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -40,7 +40,6 @@ #include "compat.h" #include "types.h" -#include "attrib.h" #include "volume.h" #include "layout.h" #include "debug.h" diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index e9ca9bd7..6008ff51 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -42,28 +42,20 @@ #include #endif -/* - * Cannot use "../include/types.h" since it conflicts with "wintypes.h". - * define our own... - */ -typedef long long s64; -typedef unsigned long u32; -struct stat; +/* Prevent volume.h from being be loaded, as it conflicts with winnt.h. */ +#define _NTFS_VOLUME_H struct ntfs_volume; typedef struct ntfs_volume ntfs_volume; +#include "debug.h" +#include "types.h" +#include "device.h" + #ifndef NTFS_BLOCK_SIZE #define NTFS_BLOCK_SIZE 512 #define NTFS_BLOCK_SIZE_BITS 9 #endif -#include "debug.h" - -/* Need device, but prevent ../include/types.h to be loaded. */ -#define _NTFS_TYPES_H -#define _NTFS_VOLUME_H -#include "device.h" - #ifndef IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS #define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS 5636096 #endif @@ -105,7 +97,7 @@ typedef struct { */ static int ntfs_w32error_to_errno(unsigned int w32error) { - Dprintf("win32_w32error_to_errno(%d).\n",w32error); + ntfs_log_trace("Converting w32error 0x%x.\n",w32error); switch (w32error) { case ERROR_INVALID_FUNCTION: return EBADRQC; @@ -187,7 +179,7 @@ static void ntfs_device_win32_init_imports(void) HMODULE kernel32 = GetModuleHandle("kernel32"); if (!kernel32) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: kernel32.dll not found in memory."); + ntfs_log_trace("kernel32.dll could not be imported.\n"); } if (!fnSetFilePointerEx) { if (kernel32) @@ -199,8 +191,8 @@ static void ntfs_device_win32_init_imports(void) * SetFilePointerEx(). */ if (!fnSetFilePointerEx) { - Dputs("SetFilePonterEx() not found in kernel32.dll: " - "Enabling emulation."); + ntfs_log_debug("SetFilePonterEx() not found in " + "kernel32.dll: Enabling emulation.\n"); fnSetFilePointerEx = libntfs_SetFilePointerEx; } } @@ -242,7 +234,7 @@ static __inline__ int ntfs_device_unix_status_flags_to_win32(int flags) break; default: /* error */ - Dputs("win32_unix_status_flags_to_win32: unknown flags"); + ntfs_log_trace("Unknown status flags.\n"); win_mode = 0; } return win_mode; @@ -270,7 +262,7 @@ static int ntfs_device_win32_simple_open_file(const char *filename, NULL, OPEN_EXISTING, 0, NULL); if (*handle == INVALID_HANDLE_VALUE) { errno = ntfs_w32error_to_errno(GetLastError()); - Dprintf("CreateFile(%s) failed.\n", filename); + ntfs_log_trace("CreateFile(%s) failed.\n", filename); return -1; } return 0; @@ -293,10 +285,10 @@ static int ntfs_device_win32_lock(HANDLE handle) if (!DeviceIoControl(handle, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &i, NULL)) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: Couldn't lock volume."); + ntfs_log_trace("Couldn't lock volume.\n"); return -1; } - Dputs("Volume locked."); + ntfs_log_debug("Volume locked.\n"); return 0; } @@ -314,10 +306,10 @@ static int ntfs_device_win32_unlock(HANDLE handle) if (!DeviceIoControl(handle, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &i, NULL)) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: Couldn't unlock volume."); + ntfs_log_trace("Couldn't unlock volume.\n"); return -1; } - Dputs("Volume unlocked."); + ntfs_log_debug("Volume unlocked.\n"); return 0; } @@ -341,12 +333,11 @@ static int ntfs_device_win32_dismount(HANDLE handle) if (!DeviceIoControl(handle, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &i, NULL)) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: Couldn't dismount volume."); + ntfs_log_trace("Couldn't dismount volume.\n"); return -1; - } else { - Dputs("Volume dismounted."); - return 0; } + ntfs_log_debug("Volume dismounted.\n"); + return 0; } /** @@ -365,7 +356,7 @@ static s64 ntfs_device_win32_getsize(HANDLE handle) loword = GetFileSize(handle, &hiword); if (loword == INVALID_FILE_SIZE) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: Couldn't get file size."); + ntfs_log_trace("Couldn't get file size.\n"); return -1; } return ((s64)hiword << 32) + loword; @@ -389,12 +380,11 @@ static s64 ntfs_device_win32_getdisklength(HANDLE handle) if (!DeviceIoControl(handle, IOCTL_DISK_GET_LENGTH_INFO, NULL, 0, &buf, sizeof(buf), &i, NULL)) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: Couldn't get disk length."); + ntfs_log_trace("Couldn't get disk length.\n"); return -1; - } else { - Dprintf("Disk length: %lld\n", buf.Length.QuadPart); - return buf.Length.QuadPart; } + ntfs_log_debug("Disk length: %lld.\n", buf.Length.QuadPart); + return buf.Length.QuadPart; } /** @@ -422,11 +412,11 @@ static s64 ntfs_device_win32_getntfssize(HANDLE handle) if (!DeviceIoControl(handle, FSCTL_GET_NTFS_VOLUME_DATA, NULL, 0, &buf, sizeof(buf), &i, NULL)) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Warnning: Couldn't get NTFS volume length."); + ntfs_log_trace("Couldn't get NTFS volume length.\n"); return -1; } rvl = buf.NumberSectors.QuadPart * buf.BytesPerSector; - Dprintf("NTFS volume length: 0x%llx\n", (long long)rvl); + ntfs_log_debug("NTFS volume length: 0x%llx.\n", (long long)rvl); #else errno = EINVAL; rvl = -1; @@ -460,7 +450,7 @@ static int ntfs_device_win32_getgeo(HANDLE handle, win32_fd *fd) rvl = DeviceIoControl(handle, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, &b, sizeof(b), &i, NULL); if (rvl) { - Dputs("GET_DRIVE_GEOMETRY_EX detected."); + ntfs_log_debug("GET_DRIVE_GEOMETRY_EX detected.\n"); DISK_DETECTION_INFO *ddi = (PDISK_DETECTION_INFO) (((PBYTE)(&((PDISK_GEOMETRY_EX)b)->Data)) + (((PDISK_PARTITION_INFO) @@ -489,7 +479,7 @@ static int ntfs_device_win32_getgeo(HANDLE handle, win32_fd *fd) rvl = DeviceIoControl(handle, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &b, sizeof(b), &i, NULL); if (rvl) { - Dputs("GET_DRIVE_GEOMETRY detected."); + ntfs_log_debug("GET_DRIVE_GEOMETRY detected.\n"); fd->geo_cylinders = ((DISK_GEOMETRY*)&b)->Cylinders.QuadPart; fd->geo_sectors = ((DISK_GEOMETRY*)&b)->SectorsPerTrack; fd->geo_size = fd->geo_cylinders * fd->geo_sectors * @@ -498,7 +488,7 @@ static int ntfs_device_win32_getgeo(HANDLE handle, win32_fd *fd) return 0; } errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: Couldn't retrieve disk geometry."); + ntfs_log_trace("Couldn't retrieve disk geometry.\n"); fd->geo_cylinders = -1; fd->geo_sectors = -1; fd->geo_size = -1; @@ -593,16 +583,18 @@ static HANDLE ntfs_device_win32_open_volume_for_partition(unsigned int drive_id, /* Make sure all the required imports exist. */ if (!fnFindFirstVolume || !fnFindNextVolume || !fnFindVolumeClose) { - Dputs("win32_is_mounted: Required dll imports not found."); + ntfs_log_trace("Required dll imports not found.\n"); return INVALID_HANDLE_VALUE; } /* Start iterating through volumes. */ - Dprintf("win32_open_volume_for_partition: Start\n"); + ntfs_log_trace("Entering with drive_id=%d, part_offset=%lld, " + "path_length=%lld, flags=%d.\n", drive_id, + (unsigned long long)part_offset, + (unsigned long long)part_length, flags); vol_find_handle = fnFindFirstVolume(vol_name, MAX_PATH); /* If a valid handle could not be aquired, reply with "don't know". */ if (vol_find_handle == INVALID_HANDLE_VALUE) { - Dprintf("win32_open_volume_for_partition: " - "FindFirstVolume failed."); + ntfs_log_trace("FindFirstVolume failed.\n"); return INVALID_HANDLE_VALUE; } do { @@ -618,8 +610,7 @@ static HANDLE ntfs_device_win32_open_volume_for_partition(unsigned int drive_id, if (vol_name_length>0) vol_name[vol_name_length-1]=0; - Dprintf("win32_open_volume_for_partition: Processing %s\n", - vol_name); + ntfs_log_debug("Processing %s.\n", vol_name); /* open the file */ handle = CreateFile(vol_name, ntfs_device_unix_status_flags_to_win32(flags), @@ -657,11 +648,10 @@ static HANDLE ntfs_device_win32_open_volume_for_partition(unsigned int drive_id, } } } else - Dputs("win32_open_volume_for_partition: getExtents " - "Failed!" ); + ntfs_log_trace("getExtents() Failed.\n"); } while (fnFindNextVolume(vol_find_handle, vol_name, MAX_PATH)); /* End of iteration through volumes. */ - Dprintf("win32_open_volume_for_partition: Closing.\n"); + ntfs_log_trace("Closing, volume was not found.\n"); fnFindVolumeClose(vol_find_handle); return INVALID_HANDLE_VALUE; } @@ -707,15 +697,15 @@ static BOOL ntfs_device_win32_find_partition(HANDLE handle, DWORD partition_id, err = GetLastError(); free(drive_layout); if (err != ERROR_INSUFFICIENT_BUFFER) { - Dputs("Error: GetDriveLayout failed."); + ntfs_log_trace("GetDriveLayout failed."); errno = ntfs_w32error_to_errno(err); return FALSE; } - Dprintf("More than %u partitions.\n", part_count); + ntfs_log_debug("More than %u partitions.\n", part_count); part_count <<= 1; if (part_count > 512) { - Dputs("Error: GetDriveLayout failed: More than 512 " - "partitions?"); + ntfs_log_trace("GetDriveLayout failed: More than 512 " + "partitions?\n"); errno = ENOBUFS; return FALSE; } @@ -793,9 +783,10 @@ static int ntfs_device_win32_open_partition(int drive_id, } else { if ((flags & O_RDWR) == O_RDWR) { /* Access if read-write, no volume found. */ - Dputs("Partitions containing Spanned/Mirrored " - "volumes are not supported in " - "R/W status yet"); + ntfs_log_trace("Partitions containing Spanned/" + "Mirrored volumes are not " + "supported in R/W status " + "yet.\n"); CloseHandle(handle); errno = EOPNOTSUPP; return -1; @@ -804,8 +795,8 @@ static int ntfs_device_win32_open_partition(int drive_id, } return 0; } else { - Dprintf("Partition %u not found on drive %d.\n", partition_id, - drive_id); + ntfs_log_debug("Partition %u not found on drive %d.\n", + partition_id, drive_id); CloseHandle(handle); errno = ENODEV; return -1; @@ -841,27 +832,29 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags) drive_id = toupper(drive_char) - 'A'; switch (numparams) { case 0: - Dprintf("win32_open(%s) -> file\n", dev->d_name); + ntfs_log_debug("win32_open(%s) -> file.\n", dev->d_name); err = ntfs_device_win32_open_file(dev->d_name, &fd, flags); break; case 1: - Dprintf("win32_open(%s) -> drive %d\n", dev->d_name, drive_id); + ntfs_log_debug("win32_open(%s) -> drive %d.\n", dev->d_name, + drive_id); err = ntfs_device_win32_open_drive(drive_id, &fd, flags); break; case 2: - Dprintf("win32_open(%s) -> drive %d, part %u\n", dev->d_name, - drive_id, part); + ntfs_log_debug("win32_open(%s) -> drive %d, part %u.\n", + dev->d_name, drive_id, part); err = ntfs_device_win32_open_partition(drive_id, part, &fd, flags); break; default: - Dprintf("win32_open(%s) -> unknwon file format\n", dev->d_name); + ntfs_log_debug("win32_open(%s) -> unknwon file format.\n", + dev->d_name); err = -1; } if (err) return err; - Dprintf("win32_open(%s) -> %p, offset 0x%llx\n", dev->d_name, dev, - fd.part_start); + ntfs_log_debug("win32_open(%s) -> %p, offset 0x%llx.\n", dev->d_name, + dev, fd.part_start); /* Setup our read-only flag. */ if ((flags & O_RDWR) != O_RDWR) NDevSetReadOnly(dev); @@ -892,7 +885,7 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, s64 abs_ofs; win32_fd *fd = (win32_fd *)dev->d_private; - Dprintf("win32_seek(): offset = 0x%llx, whence = %d\n", offset, whence); + ntfs_log_trace("seek offset = 0x%llx, whence = %d.\n", offset, whence); switch (whence) { case SEEK_SET: abs_ofs = offset; @@ -903,20 +896,20 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset, case SEEK_END: /* End of partition != end of disk. */ if (fd->part_length == -1) { - Dputs("win32_seek(): Error: Position relative to end " - "of disk not implemented."); + ntfs_log_trace("Position relative to end of disk not " + "implemented.\n"); errno = EOPNOTSUPP; return -1; } abs_ofs = fd->part_length + offset; break; default: - Dprintf("win32_seek(): Error: Wrong mode %d.\n", whence); + ntfs_log_trace("Wrong mode %d.\n", whence); errno = EINVAL; return -1; } if (abs_ofs < 0 || abs_ofs > fd->part_length) { - Dputs("Error: Seeking outsize seekable area."); + ntfs_log_trace("Seeking outsize seekable area.\n"); errno = EINVAL; return -1; } @@ -949,21 +942,21 @@ static s64 ntfs_device_win32_pio(win32_fd *fd, const s64 pos, DWORD bt; BOOL res; - Dprintf("win32_pio(): pos = 0x%llx, count = 0x%llx, direction = %s", + ntfs_log_trace("pos = 0x%llx, count = 0x%llx, direction = %s.\n", (long long)pos, (long long)count, write ? "write" : "read"); li.QuadPart = pos; if (fd->vol_handle != INVALID_HANDLE_VALUE && pos < fd->geo_size) { - Dputs("Transfering via vol_handle."); + ntfs_log_debug("Transfering via vol_handle.\n"); handle = fd->vol_handle; } else { - Dputs("Transfering via handle."); + ntfs_log_debug("Transfering via handle.\n"); handle = fd->handle; li.QuadPart += fd->part_start; } if (!fnSetFilePointerEx(handle, li, NULL, FILE_BEGIN)) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: SetFilePointer failed."); + ntfs_log_trace("SetFilePointer failed.\n"); return -1; } if (write) @@ -972,7 +965,7 @@ static s64 ntfs_device_win32_pio(win32_fd *fd, const s64 pos, res = ReadFile(handle, b, count, &bt, NULL); if (!res) { errno = ntfs_w32error_to_errno(GetLastError()); - Dprintf("Error: %sFile() failed.\n", write ? "Write" : "Read"); + ntfs_log_trace("%sFile() failed.\n", write ? "Write" : "Read"); return -1; } return bt; @@ -1026,8 +1019,8 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *b, s64 count) to_read = 0x80000000; count = to_read - delta; } - Dprintf("win32_read(): fd = %p, b = %p, count = 0x%llx, pos = 0x%llx, " - "ofs = %i, to_read = 0x%llx\n", fd, b, + ntfs_log_trace("fd = %p, b = %p, count = 0x%llx, pos = 0x%llx, " + "ofs = %i, to_read = 0x%llx.\n", fd, b, (long long)count, (long long)old_pos, ofs, (long long)to_read); if (!((unsigned long)b & (NTFS_BLOCK_SIZE - 1)) && !old_ofs && @@ -1038,7 +1031,7 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *b, s64 count) PAGE_READWRITE); if (!alignedbuffer) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: VirtualAlloc failed for read."); + ntfs_log_trace("VirtualAlloc failed for read.\n"); return -1; } } @@ -1101,7 +1094,7 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) win32_fd *fd = (win32_fd *)dev->d_private; BOOL rvl; - Dprintf("win32_close(%p)\n", dev); + ntfs_log_trace("Closing device %p.\n", dev); if (!NDevOpen(dev)) { errno = EBADF; return -1; @@ -1112,13 +1105,13 @@ static int ntfs_device_win32_close(struct ntfs_device *dev) ntfs_device_win32_unlock(fd->vol_handle); } if (!CloseHandle(fd->vol_handle)) - Dputs("Error: CloseHandle() failed for volume."); + ntfs_log_trace("CloseHandle() failed for volume.\n"); } rvl = CloseHandle(fd->handle); free(fd); if (!rvl) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: CloseHandle failed."); + ntfs_log_trace("CloseHandle() failed.\n"); return -1; } return 0; @@ -1153,8 +1146,8 @@ static int ntfs_device_win32_sync(struct ntfs_device *dev) err = ntfs_w32error_to_errno(GetLastError()); } if (!to_clear) { + ntfs_log_trace("Could not sync.\n"); errno = err; - Dputs("Error: Could not sync."); return -1; } NDevClearDirty(dev); @@ -1211,12 +1204,12 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *b, to_write = 0x80000000; count = to_write - delta; } - Dprintf("win32_write(): fd = %p, b = %p, count = 0x%llx, " - "pos = 0x%llx, ofs = %i, to_write = 0x%llx\n", fd, b, + ntfs_log_trace("fd = %p, b = %p, count = 0x%llx, pos = 0x%llx, " + "ofs = %i, to_write = 0x%llx.\n", fd, b, (long long)count, (long long)old_pos, ofs, (long long)to_write); if (NDevReadOnly(dev)) { - Dputs("win32_write: Device R/O, exiting."); + ntfs_log_trace("Can't write on a R/O device.\n"); errno = EROFS; return -1; } @@ -1233,7 +1226,7 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *b, MEM_COMMIT, PAGE_READWRITE); if (!alignedbuffer) { errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: VirtualAlloc failed for write."); + ntfs_log_trace("VirtualAlloc failed for write.\n"); return -1; } /* Read first sector if start of write not sector aligned. */ @@ -1396,7 +1389,7 @@ static __inline__ int ntfs_win32_blksszget(struct ntfs_device *dev,int *argp) return 0; } errno = ntfs_w32error_to_errno(GetLastError()); - Dputs("Error: GET_DRIVE_GEOMETRY failed."); + ntfs_log_trace("GET_DRIVE_GEOMETRY failed.\n"); return -1; } @@ -1405,11 +1398,11 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, { win32_fd *fd = (win32_fd *)dev->d_private; - Dprintf("win32_ioctl(%d) called.\n", request); + ntfs_log_trace("win32_ioctl(%d) called.\n", request); switch (request) { #if defined(BLKGETSIZE) case BLKGETSIZE: - Dputs("win32_ioctl(): BLKGETSIZE detected."); + ntfs_log_debug("BLKGETSIZE detected.\n"); if (fd->part_length >= 0) { *(int *)argp = (int)(fd->part_length / 512); return 0; @@ -1419,7 +1412,7 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, #endif #if defined(BLKGETSIZE64) case BLKGETSIZE64: - Dputs("win32_ioctl(): BLKGETSIZE64 detected."); + ntfs_log_debug("BLKGETSIZE64 detected.\n"); if (fd->part_length >= 0) { *(s64 *)argp = fd->part_length; return 0; @@ -1429,16 +1422,16 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, #endif #ifdef HDIO_GETGEO case HDIO_GETGEO: - Dputs("win32_ioctl(): HDIO_GETGEO detected."); + ntfs_log_debug("HDIO_GETGEO detected.\n"); return ntfs_win32_hdio_getgeo(dev, (struct hd_geometry *)argp); #endif #ifdef BLKSSZGET case BLKSSZGET: - Dputs("win32_ioctl(): BLKSSZGET detected."); + ntfs_log_debug("BLKSSZGET detected.\n"); return ntfs_win32_blksszget(dev, (int *)argp); #endif default: - Dprintf("win32_ioctl(): unimplemented ioctl %d.\n", request); + ntfs_log_debug("unimplemented ioctl %d.\n", request); errno = EOPNOTSUPP; return -1; } From f9cdaed3dba7defff7f78a6c689eeb06e2e9dfe6 Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 24 Oct 2005 21:20:10 +0000 Subject: [PATCH 2627/2994] temporary fix for the corrupted stdout due to the recent logging changes --- ntfsprogs/ntfsclone.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index f9e8c1c1..a2aa4eb7 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1455,7 +1455,8 @@ int main(int argc, char **argv) parse_options(argc, argv); - utils_set_locale(); + /* FIXME: this started to corrupt stdout due to logging changes */ +// utils_set_locale(); if (opt.restore_image) { device_size = open_image(); From 0dd0cdc6be0915af960690814afffb8fc2673995 Mon Sep 17 00:00:00 2001 From: uvman Date: Tue, 25 Oct 2005 01:28:10 +0000 Subject: [PATCH 2628/2994] Remove {Dputs, Dprintf, Dperror} and convert callers to ntfs_log_*. Make ntfsinfo use ntfs_logging_parse_option(). --- include/ntfs/debug.h | 42 --------------- libntfs/debug.c | 113 --------------------------------------- libntfs/logging.c | 2 +- ntfsprogs/mkntfs.c | 2 +- ntfsprogs/ntfsclone.c | 13 ++--- ntfsprogs/ntfsfix.c | 23 ++++---- ntfsprogs/ntfsinfo.c | 32 +++++++---- ntfsprogs/ntfsundelete.c | 67 +++++++++++++---------- ntfsprogs/ntfswipe.c | 34 ++++++------ 9 files changed, 101 insertions(+), 227 deletions(-) diff --git a/include/ntfs/debug.h b/include/ntfs/debug.h index 805b4587..57fdf3bc 100644 --- a/include/ntfs/debug.h +++ b/include/ntfs/debug.h @@ -26,52 +26,10 @@ #include "config.h" #endif -#ifdef HAVE_STDIO_H -#include -#endif - #include "logging.h" struct _runlist_element; -extern void __Sprintf(const int silent, const char *fmt, ...) - __attribute__((format(printf, 2, 3))); -#define Sprintf(silent, f, a...) __Sprintf(silent, f, ##a) - -#ifdef DEBUG - -/* Debug output to stderr. To get it run ./configure --enable-debug. */ - -extern void __ntfs_debug(const char *file, int line, const char *function, - const char *format, ...) __attribute__((format(printf, 4, 5))); -#define ntfs_debug(f, a...) \ - __ntfs_debug(__FILE__, __LINE__, __FUNCTION__, f, ##a) - -extern void __ntfs_error(const char *function, - const char *fmt, ...) __attribute__((format(printf, 2, 3))); -#define ntfs_error(sb, f, a...) __ntfs_error(__FUNCTION__, f, ##a) - -extern void __Dprintf(const char *fmt, ...) - __attribute__((format(printf, 1, 2))); -#define Dprintf(f, a...) __Dprintf(f, ##a) - -extern void __Dputs(const char *s); -#define Dputs(s) __Dputs(s) - -extern void __Dperror(const char *s); -#define Dperror(s) __Dperror(s) - -#else /* if !DEBUG */ - -#define ntfs_debug(f, a...) do {} while (0) -#define ntfs_error(f, a...) do {} while (0) - -#define Dprintf(f, a...) do {} while (0) -#define Dputs(s) do {} while (0) -#define Dperror(s) do {} while (0) - -#endif /* !DEBUG */ - #ifdef NTFS_DISABLE_DEBUG_LOGGING static __inline__ void ntfs_debug_runlist_dump(const struct _runlist_element *rl __attribute__((unused))) {} #else diff --git a/libntfs/debug.c b/libntfs/debug.c index 425dbd64..63eabbb1 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -32,119 +32,6 @@ #include "debug.h" #include "logging.h" -/** - * Sprintf - silencable output to stderr - * @silent: if 0 string is output to stderr - * @fmt: printf style format string - * @...: optional arguments for the printf style format string - * - * If @silent is 0, output the string @fmt to stderr. - * - * This is basically a replacement for: - * - * if (!silent) - * fprintf(stderr, fmt, ...); - * - * It is more convenient to use Sprintf instead of the above code and perhaps - * more importantly, Sprintf makes it much easier to turn it into a "do - * nothing" function, by defining it to "do {} while (0)" in debug.h instead of - * to * __Sprintf, thus removing the whole output completely. - */ -void __Sprintf(const int silent, const char *fmt, ...) -{ - int eo; - va_list ap; - - if (silent) - return; - eo = errno; - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - errno = eo; -} - -#ifdef DEBUG - -/* Debug output to stderr. To get it run ./configure --enable-debug. */ - -/** - * __ntfs_error - */ -void __ntfs_error(const char *function, const char *fmt, ...) -{ - int eo = errno; - int flen = 0; - va_list args; - char err_buf[1024]; - - if (function) - flen = strlen(function); - va_start(args, fmt); - vsnprintf(err_buf, sizeof(err_buf), fmt, args); - va_end(args); - fprintf(stderr, "NTFS error: %s(): %s\n", flen ? function : "", - err_buf); - errno = eo; -} - -/** - * __ntfs_debug - */ -void __ntfs_debug(const char *file, int line, const char *function, - const char *fmt, ...) -{ - int eo = errno; - int flen = 0; - va_list args; - char err_buf[1024]; - - if (function) - flen = strlen(function); - va_start(args, fmt); - vsnprintf(err_buf, sizeof(err_buf), fmt, args); - va_end(args); - fprintf(stderr, "NTFS DEBUG (%s, %d): %s(): %s\n", file, line, - flen ? function : "", err_buf); - errno = eo; -} - -/** - * __Dprintf - */ -void __Dprintf(const char *fmt, ...) -{ - int eo = errno; - va_list ap; - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - errno = eo; -} - -/** - * __Dputs - */ -void __Dputs(const char *s) -{ - int eo = errno; - fprintf(stderr, "%s\n", s); - errno = eo; -} - -/** - * __Dperror - */ -void __Dperror(const char *s) -{ - int eo = errno; - perror(s); - errno = eo; -} - -#endif - #ifndef NTFS_DISABLE_DEBUG_LOGGING /** * ntfs_debug_runlist_dump - Dump a runlist. diff --git a/libntfs/logging.c b/libntfs/logging.c index 6ec0ec27..10da2fe4 100644 --- a/libntfs/logging.c +++ b/libntfs/logging.c @@ -485,7 +485,7 @@ BOOL ntfs_logging_parse_option(const char *option) return TRUE; } - ntfs_log_warning("Unknown logging option '%s'\n", option); + ntfs_log_debug("Unknown logging option '%s'\n", option); return FALSE; } diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index bc5d8956..7880c208 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1412,7 +1412,7 @@ static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, } } } - Dputs("mkntfs_attr_find(): File is corrupt. Run chkdsk."); + ntfs_log_trace("File is corrupt. Run chkdsk.\n"); errno = EIO; return -1; } diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index a2aa4eb7..32f7d051 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1187,8 +1187,8 @@ static s64 device_size_get(int fd) { u64 size; if (ioctl(fd, BLKGETSIZE64, &size) >= 0) { - Dprintf("BLKGETSIZE64 nr bytes = %llu (0x%llx)\n", - (unsigned long long)size, + ntfs_log_debug("BLKGETSIZE64 nr bytes = %llu " + "(0x%llx).\n", (unsigned long long)size, (unsigned long long)size); return (s64)size; } @@ -1198,8 +1198,8 @@ static s64 device_size_get(int fd) { unsigned long size; if (ioctl(fd, BLKGETSIZE, &size) >= 0) { - Dprintf("BLKGETSIZE nr 512 byte blocks = %lu " - "(0x%lx)\n", size, size); + ntfs_log_debug("BLKGETSIZE nr 512 byte blocks = %lu " + "(0x%lx).\n", size, size); return (s64)size * 512; } } @@ -1208,8 +1208,9 @@ static s64 device_size_get(int fd) { struct floppy_struct this_floppy; if (ioctl(fd, FDGETPRM, &this_floppy) >= 0) { - Dprintf("FDGETPRM nr 512 byte blocks = %lu (0x%lx)\n", - this_floppy.size, this_floppy.size); + ntfs_log_debug("FDGETPRM nr 512 byte blocks = %lu " + "(0x%lx).\n", this_floppy.size, + this_floppy.size); return (s64)this_floppy.size * 512; } } diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 17f456d2..ccc832f7 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -176,33 +176,34 @@ static int OLD_ntfs_volume_set_flags(ntfs_volume *vol, const u16 flags) return -1; } if (ntfs_file_record_read(vol, FILE_Volume, &m, NULL)) { - Dperror("Failed to read $Volume"); + ntfs_log_perror("Failed to read $Volume"); return -1; } /* Sanity check */ if (!(m->flags & MFT_RECORD_IN_USE)) { - Dprintf("Error: $Volume has been deleted. Cannot " - "handle this yet. Run chkdsk to fix this.\n"); + ntfs_log_error("$Volume has been deleted. Cannot handle this " + "yet. Run chkdsk to fix this.\n"); errno = EIO; goto err_exit; } /* Get a pointer to the volume information attribute. */ ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { - Dperror("Failed to allocate attribute search context"); + ntfs_log_debug("Failed to allocate attribute search " + "context.\n"); goto err_exit; } if (ntfs_attr_lookup(AT_VOLUME_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - Dputs("Error: Attribute $VOLUME_INFORMATION was not found in " - "$Volume!"); + ntfs_log_error("Attribute $VOLUME_INFORMATION was not found in " + "$Volume!\n"); goto err_out; } a = ctx->attr; /* Sanity check. */ if (a->non_resident) { - Dputs("Error: Attribute $VOLUME_INFORMATION must be resident " - "(and it isn't)!"); + ntfs_log_error("Attribute $VOLUME_INFORMATION must be resident " + "(and it isn't)!\n"); errno = EIO; goto err_out; } @@ -213,15 +214,15 @@ static int OLD_ntfs_volume_set_flags(ntfs_volume *vol, const u16 flags) (char*)m + le32_to_cpu(m->bytes_in_use) || le16_to_cpu(a->value_offset) + le32_to_cpu(a->value_length) > le32_to_cpu(a->length)) { - Dputs("Error: Attribute $VOLUME_INFORMATION in $Volume is " - "corrupt!"); + ntfs_log_error("Attribute $VOLUME_INFORMATION in $Volume is " + "corrupt!\n"); errno = EIO; goto err_out; } /* Set the volume flags. */ vol->flags = c->flags = cpu_to_le16(flags); if (ntfs_mft_record_write(vol, FILE_Volume, m)) { - Dperror("Error writing $Volume"); + ntfs_log_perror("Error writing $Volume"); goto err_out; } ret = 0; /* success */ diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 8bc55a16..a7dbdd33 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -153,7 +153,7 @@ static void usage (void) */ static int parse_options (int argc, char *argv[]) { - static const char *sopt = "-fh?i:F:mqtTvVd:"; + static const char *sopt = "-:fhi:F:mqtTvVd:"; static const struct option lopt[] = { { "device", required_argument, NULL, 'd' }, { "force", no_argument, NULL, 'f' }, @@ -179,6 +179,8 @@ static int parse_options (int argc, char *argv[]) opts.filename = NULL; while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + ntfs_log_trace("optind=%d; c='%c' optarg=\"%s\".\n", optind, c, + optarg); switch (c) { case 'd': if (!opts.device) @@ -205,7 +207,6 @@ static int parse_options (int argc, char *argv[]) opts.force++; break; case 'h': - case '?': help++; break; case 'q': @@ -228,12 +229,24 @@ static int parse_options (int argc, char *argv[]) case 'm': opts.mft++; break; - default: - if ((optopt == 'i') && (!optarg)) { - Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); - } else { - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + case '?': + if (optopt=='?') { + help++; + continue; } + if (ntfs_logging_parse_option(argv[optind-1])) + continue; + ntfs_log_error("Unknown option '%s'.\n", + argv[optind-1]); + err++; + break; + case ':': + ntfs_log_error("Option '%s' requires an " + "argument.\n", argv[optind-1]); + err++; + break; + default: + ntfs_log_error("Unhandled option case: %d.\n", c); err++; break; } @@ -1362,9 +1375,10 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) Vprintf("\tDumping index block " "(VCN %lld, used %u/%u):", le64_to_cpu( tmp_alloc->index_block_vcn), + (unsigned int)le32_to_cpu(tmp_alloc-> + index.index_length), (unsigned int) le32_to_cpu(tmp_alloc->index. - index_length), le32_to_cpu(tmp_alloc-> - index.allocated_size)); + allocated_size)); total_entries += ntfs_dump_index_entries(entry, type); total_indx_blocks++; } diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 848b9400..cd089662 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -26,7 +26,7 @@ #include "config.h" #ifdef HAVE_FEATURES_H -# include +#include #endif #ifdef HAVE_STDIO_H #include @@ -83,9 +83,7 @@ static const char *EXEC_NAME = "ntfsundelete"; static const char *MFTFILE = "mft"; -#ifdef DEBUG static const char *UNNAMED = ""; -#endif static const char *NONE = ""; static const char *UNKNOWN = "unknown"; static struct options opts; @@ -333,7 +331,8 @@ static int transform (const char *pattern, char **regex) result[j] = '$'; result[j+1] = 0; - Dprintf ("Pattern '%s' replaced with regex '%s'\n", pattern, result); + ntfs_log_debug("Pattern '%s' replaced with regex '%s'.\n", pattern, + result); *regex = result; return 1; @@ -372,7 +371,7 @@ static int parse_time (const char *value, time_t *since) if (!value || !since) return -1; - Dprintf ("parsing time '%s' ago\n", value); + ntfs_log_trace("Parsing time '%s' ago.\n", value); result = strtoll (value, &suffix, 10); if (result < 0 || errno == ERANGE) { @@ -406,7 +405,8 @@ static int parse_time (const char *value, time_t *since) now = time (NULL); - Dprintf ("Time now = %lld, Time then = %lld.\n", (long long) now, (long long) result); + ntfs_log_debug("Time now = %lld, Time then = %lld.\n", (long long) now, + (long long) result); *since = now - result; return 1; } @@ -709,19 +709,23 @@ static void free_file (struct ufile *file) list_for_each_safe (item, tmp, &file->name) { /* List of filenames */ struct filename *f = list_entry (item, struct filename, list); - Dprintf ("freeing filename '%s'\n", f->name ? f->name : NONE); + ntfs_log_debug("freeing filename '%s'", f->name ? f->name : + NONE); if (f->name) free (f->name); if (f->parent_name) { - Dprintf ("\tand parent filename '%s'\n", f->parent_name); + ntfs_log_debug(" and parent filename '%s'", + f->parent_name); free (f->parent_name); } + ntfs_log_debug(".\n"); free (f); } list_for_each_safe (item, tmp, &file->data) { /* List of data streams */ struct data *d = list_entry (item, struct data, list); - Dprintf ("freeing data stream '%s'\n", d->name ? d->name : UNNAMED); + ntfs_log_debug("Freeing data stream '%s'.\n", d->name ? + d->name : UNNAMED); if (d->name) free (d->name); if (d->runlist) @@ -826,12 +830,14 @@ static void get_parent_name (struct filename* name, ntfs_volume* vol) if (ntfs_attr_pread(mft_data, vol->mft_record_size * inode_num, vol->mft_record_size, rec) < 1) { Eprintf ("ERROR: Couldn't read MFT Record %lld.\n", inode_num); - } else { - if ((filename_attr = verify_parent(name, rec))) { - if (ntfs_ucstombs(filename_attr->file_name, filename_attr->file_name_length, &name->parent_name, 0) < 0) { - Dprintf ("Couldn't translate filename to current locale.\n"); - name->parent_name = NULL; - } + } else if ((filename_attr = verify_parent(name, rec))) { + if (ntfs_ucstombs(filename_attr->file_name, + filename_attr->file_name_length, + &name->parent_name, 0) < 0) { + ntfs_log_debug("ERROR: Couldn't translate " + "filename to current " + "locale.\n"); + name->parent_name = NULL; } } } @@ -907,7 +913,8 @@ static int get_filenames (struct ufile *file, ntfs_volume* vol) if (ntfs_ucstombs (name->uname, name->uname_len, &name->name, 0) < 0) { - Dprintf ("ERROR: Couldn't translate filename to current locale.\n"); + ntfs_log_debug("ERROR: Couldn't translate filename to " + "current locale.\n"); } name->parent_name = NULL; @@ -931,7 +938,7 @@ static int get_filenames (struct ufile *file, ntfs_volume* vol) } ntfs_attr_put_search_ctx(ctx); - Dprintf ("File has %d names.\n", count); + ntfs_log_debug("File has %d names.\n", count); return count; } @@ -998,7 +1005,7 @@ static int get_data (struct ufile *file, ntfs_volume *vol) data->runlist = ntfs_mapping_pairs_decompress(vol, rec, NULL); if (!data->runlist) { - Dprintf ("Couldn't decompress the data runs\n"); + ntfs_log_debug("Couldn't decompress the data runs.\n"); } file->max_size = max (file->max_size, data->size_data); @@ -1009,7 +1016,7 @@ static int get_data (struct ufile *file, ntfs_volume *vol) } ntfs_attr_put_search_ctx(ctx); - Dprintf ("File has %d data streams.\n", count); + ntfs_log_debug("File has %d data streams.\n", count); return count; } @@ -1071,7 +1078,8 @@ static struct ufile * read_record (ntfs_volume *vol, long long record) attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, file->mft); attr90 = find_first_attribute (AT_INDEX_ROOT, file->mft); - Dprintf ("Attributes present: %s %s %s\n", attr10?"0x10":"", attr20?"0x20":"", attr90?"0x90":""); + ntfs_log_debug("Attributes present: %s %s %s.\n", attr10?"0x10":"", + attr20?"0x20":"", attr90?"0x90":""); if (attr10) { STANDARD_INFORMATION *si; @@ -1131,7 +1139,7 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) return -1; if (file->directory) { - Dprintf ("Found a directory: not recoverable.\n"); + ntfs_log_debug("Found a directory: not recoverable.\n"); return 0; } @@ -1297,7 +1305,7 @@ static void dump_record (struct ufile *file) Qprintf ("Data Streams:\n"); list_for_each (item, &file->data) { struct data *d = list_entry (item, struct data, list); - Qprintf ("Name: %s\n", (d->name) ? d->name : ""); + Qprintf ("Name: %s\n", (d->name) ? d->name : UNNAMED); Qprintf ("Flags: "); if (d->resident) Qprintf ("Resident\n"); if (d->compressed) Qprintf ("Compressed\n"); @@ -1428,12 +1436,12 @@ static int name_match (regex_t *re, struct ufile *file) Eprintf ("Couldn't compare filename with regex: %s\n", strerror (errno)); return 0; } else if (result == REG_NOERROR) { - Dprintf ("Found a matching filename.\n"); + ntfs_log_debug("Found a matching filename.\n"); return 1; } } - Dprintf ("Filename '%s' doesn't match regex.\n", file->pref_name); + ntfs_log_debug("Filename '%s' doesn't match regex.\n", file->pref_name); return 0; } @@ -1981,7 +1989,8 @@ static int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) name = opts.output; if (!name) { name = MFTFILE; - Dprintf ("No output filename, defaulting to '%s'.\n", name); + ntfs_log_debug("No output filename, defaulting to '%s'.\n", + name); } create_pathname (opts.dest, name, NULL, pathname, sizeof (pathname)); @@ -1996,10 +2005,10 @@ static int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) mft_end = min (mft_end, nr_mft_records - 1); - Dprintf ("MFT records\n"); - Dprintf (" Total: %8lld\n", nr_mft_records); - Dprintf (" Begin: %8lld\n", mft_begin); - Dprintf (" End: %8lld\n", mft_end); + ntfs_log_debug("MFT records:\n"); + ntfs_log_debug("\tTotal: %8lld\n", nr_mft_records); + ntfs_log_debug("\tBegin: %8lld\n", mft_begin); + ntfs_log_debug("\tEnd: %8lld\n", mft_end); for (i = mft_begin; i <= mft_end; i++) { if (ntfs_attr_pread (mft, vol->mft_record_size * i, vol->mft_record_size, buffer) < vol->mft_record_size) { diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 66f63479..30a352c7 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -170,10 +170,10 @@ static int parse_list (char *list, int **result) ptr = end + 1; } - Dprintf ("Parsing list '%s' - ", list); + ntfs_log_debug("Parsing list '%s' - ", list); for (i = 0; i <= count; i++) - Dprintf ("0x%02x ", mem[i]); - Dprintf ("\n"); + ntfs_log_debug("0x%02x ", mem[i]); + ntfs_log_debug("\n"); *result = mem; return count; @@ -1094,18 +1094,18 @@ static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act //Qprintf ("wipe_logfile (not implemented) 0x%02x\n", byte); if ((ni = ntfs_inode_open(vol, FILE_LogFile)) == NULL) { - Dprintf("Failed to open inode FILE_LogFile.\n"); + ntfs_log_debug("Failed to open inode FILE_LogFile.\n"); return -1; } if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) { - Dprintf("Failed to open $FILE_LogFile/$DATA\n"); + ntfs_log_debug("Failed to open $FILE_LogFile/$DATA.\n"); goto error_exit; } /* The $DATA attribute of the $LogFile has to be non-resident. */ if (!NAttrNonResident(na)) { - Dprintf("$LogFile $DATA attribute is resident!?!\n"); + ntfs_log_debug("$LogFile $DATA attribute is resident!?!\n"); errno = EIO; goto io_error_exit; } @@ -1113,7 +1113,8 @@ static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act /* Get length of $LogFile contents. */ len = na->data_size; if (!len) { - Dprintf("$LogFile has zero length, no disk write needed.\n"); + ntfs_log_debug("$LogFile has zero length, no disk write " + "needed.\n"); return 0; } @@ -1125,8 +1126,8 @@ static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act pos += count; if (count == -1 || pos != len) { - Dprintf("Amount of $LogFile data read does not " - "correspond to expected length!"); + ntfs_log_debug("Amount of $LogFile data read does not " + "correspond to expected length!\n"); if (count != -1) errno = EIO; goto io_error_exit; @@ -1142,7 +1143,8 @@ static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act count = NTFS_BUF_SIZE2; if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { - Dprintf("Failed to set the $LogFile attribute value."); + ntfs_log_debug("Failed to set the $LogFile attribute " + "value.\n"); if (count != -1) errno = EIO; goto io_error_exit; @@ -1198,18 +1200,18 @@ static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act ni = ntfs_pathname_to_inode(vol, NULL, "pagefile.sys"); if (!ni) { - Dprintf("Failed to open inode of pagefile.sys.\n"); + ntfs_log_debug("Failed to open inode of pagefile.sys.\n"); return 0; } if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) { - Dprintf("Failed to open pagefile.sys/$DATA\n"); + ntfs_log_debug("Failed to open pagefile.sys/$DATA.\n"); goto error_exit; } /* The $DATA attribute of the pagefile.sys has to be non-resident. */ if (!NAttrNonResident(na)) { - Dprintf("pagefile.sys $DATA attribute is resident!?!\n"); + ntfs_log_debug("pagefile.sys $DATA attribute is resident!?!\n"); errno = EIO; goto io_error_exit; } @@ -1217,7 +1219,8 @@ static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act /* Get length of pagefile.sys contents. */ len = na->data_size; if (!len) { - Dprintf("pagefile.sys has zero length, no disk write needed.\n"); + ntfs_log_debug("pagefile.sys has zero length, no disk write " + "needed.\n"); return 0; } @@ -1230,7 +1233,8 @@ static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act count = NTFS_BUF_SIZE2; if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { - Dprintf("Failed to set the pagefile.sys attribute value."); + ntfs_log_debug("Failed to set the pagefile.sys " + "attribute value.\n"); if (count != -1) errno = EIO; goto io_error_exit; From c84e54a441ddd9553bcb749c6b33ce7a2e147722 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 25 Oct 2005 11:54:26 +0000 Subject: [PATCH 2629/2994] fix build --- libntfs/rich.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libntfs/rich.c b/libntfs/rich.c index 42cc0022..71f5652f 100644 --- a/libntfs/rich.c +++ b/libntfs/rich.c @@ -29,6 +29,10 @@ #include #endif +#ifdef HAVE_ERRNO_H +#include +#endif + #include "rich.h" #include "layout.h" #include "logging.h" From ef7bda1d7b02902c0d533b05d1b507e3975d1714 Mon Sep 17 00:00:00 2001 From: uvman Date: Tue, 25 Oct 2005 18:34:18 +0000 Subject: [PATCH 2630/2994] Update changelog about Dputs, Dprintf, ..., Sprintf --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7550e059..1585d10f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,6 +38,8 @@ xx/xx/2005 - 1.12.2-WIP streams access interface. Currently supported interfaces are 'none' and 'windows'. (Yura) - ntfscat can display named attributes, streams too. (Szaka) + - Remove Dputs(), Dprintf(), Dperror(), ntfs_debug(), ntfs_error() and + Sprintf(). Forward callers to ntfs_log_*(). (Yuval) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. From 98e5cda13e2f3fa64f9664c30d838140649cd966 Mon Sep 17 00:00:00 2001 From: antona Date: Tue, 25 Oct 2005 22:12:25 +0000 Subject: [PATCH 2631/2994] Add some debugging to ntfsdecrypt.c to allow printing of the private key after it is decrypted (this is ifdeffed out by default). (Anton) --- ChangeLog | 2 ++ ntfsprogs/ntfsdecrypt.c | 32 ++++++++++++++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1585d10f..b9766b63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -40,6 +40,8 @@ xx/xx/2005 - 1.12.2-WIP - ntfscat can display named attributes, streams too. (Szaka) - Remove Dputs(), Dprintf(), Dperror(), ntfs_debug(), ntfs_error() and Sprintf(). Forward callers to ntfs_log_*(). (Yuval) + - Add some debugging to ntfsdecrypt.c to allow printing of the private + key after it is decrypted (this is ifdeffed out by default). (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 2e19ecc3..e5f02c91 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -394,18 +394,8 @@ static ntfs_rsa_private_key ntfs_rsa_private_key_import_from_gnutls( } /* Release the no longer needed datum values. */ for (j = 0; j < 6; j++) { - /* - * FIXME: _gnutls_free_datum() is not exported from libgnutls - * so we do it by hand... )-: Let us just hope the - * gnutls_datum_t structure does not change across versions of - * the gnutls library. - */ -#if 0 - _gnutls_free_datum(&rd[j]); -#else if (rd[j].data && rd[j].size) gnutls_free(rd[j].data); -#endif } /* * Build the gcrypt private key, note libgcrypt uses p and q inversed @@ -528,6 +518,28 @@ check_again: gnutls_strerror(err)); goto key_out; } +#if 0 + /* + * Export the key again, but unencrypted, and output it + * to stderr. Note the output has an RSA header so to + * compare to openssl pkcs12 -nodes -in myfile.pfx + * output need to ignore the part of the key between + * the first "MII..." up to the second "MII...". The + * actual RSA private key begins at the second "MII..." + * and in my testing at least was identical to openssl + * output and was also identical both on big and little + * endian so gnutls should be endianness safe. + */ + char *buf = malloc(8192); + size_t bufsize = 8192; + err = gnutls_x509_privkey_export_pkcs8(pkey, GNUTLS_X509_FMT_PEM, "", GNUTLS_PKCS_PLAIN, buf, &bufsize); + if (err) { + fprintf(stderr, "eek1\n"); + exit(1); + } + fprintf(stderr, "%s\n", buf); + free(buf); +#endif /* Convert the private key to our internal format. */ rsa_key = ntfs_rsa_private_key_import_from_gnutls(pkey); goto key_out; From 0dc3b0597caf5b353dd85007d73a5281f4d3098d Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 26 Oct 2005 19:24:45 +0000 Subject: [PATCH 2632/2994] fflush() ntfs_log_ streams. (Christophe) --- ChangeLog | 1 + libntfs/logging.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index b9766b63..c6fbd0b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,7 @@ xx/xx/2005 - 1.12.2-WIP Sprintf(). Forward callers to ntfs_log_*(). (Yuval) - Add some debugging to ntfsdecrypt.c to allow printing of the private key after it is decrypted (this is ifdeffed out by default). (Anton) + - fflush() ntfs_log_ streams. (Christophe) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/logging.c b/libntfs/logging.c index 10da2fe4..fad6f62e 100644 --- a/libntfs/logging.c +++ b/libntfs/logging.c @@ -369,6 +369,7 @@ int ntfs_logging_handler_printf(const char *function, const char *file, ret += fprintf(stream, " : %s\n", strerror(olderr)); } + fflush(stream); errno = olderr; return ret; } @@ -447,6 +448,7 @@ int ntfs_logging_handler_colour(const char *function, const char *file, if (suffix) ret += fprintf(stream, suffix); + fflush(stream); errno = olderr; return ret; } From c27c1a40cbcba48c418c61ed339621a77e15a48d Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 26 Oct 2005 20:45:58 +0000 Subject: [PATCH 2633/2994] explain rm's elements in ntfs_inode, ntfs_volume --- include/ntfs/inode.h | 3 ++- include/ntfs/volume.h | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 4c15a60b..0bc0fe6c 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -138,7 +138,8 @@ struct _ntfs_inode { inode of the base mft record. */ }; - void *private_data; /* Temp: for directory handling */ + /* Temp: for directory handling */ + void *private_data; /* ntfs_dt containing this inode */ int ref_count; /* Below 2 fields needed to update indexes. They valid if != -1. */ diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 4c428d29..fd1ae4ea 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -184,9 +184,10 @@ struct _ntfs_volume { s32 attrdef_len; /* Size of the attribute definition table in bytes. */ - void *private_data; /* Temp: for directory handling */ - void *private_bmp1; - void *private_bmp2; + /* Temp: for directory handling */ + void *private_data; /* ntfs_dir for . */ + void *private_bmp1; /* ntfs_bmp for $MFT/$BITMAP */ + void *private_bmp2; /* ntfs_bmp for $Bitmap */ }; extern ntfs_volume *ntfs_volume_alloc(void); From 1f68df3f692a77ae4354eabbf0c8d299a215e93b Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 26 Oct 2005 20:46:37 +0000 Subject: [PATCH 2634/2994] shorten ntfs_logging_* to ntfs_log_* --- include/ntfs/logging.h | 49 +++++++++++------------ libntfs/logging.c | 91 +++++++++++++++++++++--------------------- ntfsprogs/ntfsinfo.c | 2 +- 3 files changed, 70 insertions(+), 72 deletions(-) diff --git a/include/ntfs/logging.h b/include/ntfs/logging.h index 25d23409..d693e343 100644 --- a/include/ntfs/logging.h +++ b/include/ntfs/logging.h @@ -32,10 +32,9 @@ #include "types.h" -struct ntfs_logging; /* Function prototype for the logging handlers */ -typedef int (ntfs_logging_handler)(const char *function, const char *file, int line, +typedef int (ntfs_log_handler)(const char *function, const char *file, int line, u32 level, void *data, const char *format, va_list args); /** @@ -47,32 +46,32 @@ typedef int (ntfs_logging_handler)(const char *function, const char *file, int l struct ntfs_logging { u32 levels; u32 flags; - ntfs_logging_handler *handler; + ntfs_log_handler *handler; }; extern struct ntfs_logging ntfs_log; -void ntfs_logging_set_handler(ntfs_logging_handler *handler); +void ntfs_log_set_handler(ntfs_log_handler *handler); /* Enable/disable certain log levels */ -u32 ntfs_logging_set_levels(u32 levels); -u32 ntfs_logging_clear_levels(u32 levels); -u32 ntfs_logging_get_levels(void); +u32 ntfs_log_set_levels(u32 levels); +u32 ntfs_log_clear_levels(u32 levels); +u32 ntfs_log_get_levels(void); /* Enable/disable certain log flags */ -u32 ntfs_logging_set_flags(u32 flags); -u32 ntfs_logging_clear_flags(u32 flags); -u32 ntfs_logging_get_flags(void); +u32 ntfs_log_set_flags(u32 flags); +u32 ntfs_log_clear_flags(u32 flags); +u32 ntfs_log_get_flags(void); -BOOL ntfs_logging_parse_option(const char *option); +BOOL ntfs_log_parse_option(const char *option); -int ntfs_logging_redirect(const char *function, const char *file, int line, +int ntfs_log_redirect(const char *function, const char *file, int line, u32 level, void *data, const char *format, ...) __attribute__((format(printf, 6, 7))); /* Logging handlers */ -ntfs_logging_handler ntfs_logging_handler_printf __attribute__((format(printf, 6, 0))); -ntfs_logging_handler ntfs_logging_handler_colour __attribute__((format(printf, 6, 0))); +ntfs_log_handler ntfs_log_handler_printf __attribute__((format(printf, 6, 0))); +ntfs_log_handler ntfs_log_handler_colour __attribute__((format(printf, 6, 0))); /* Logging levels - Determine what gets logged */ #define NTFS_LOG_LEVEL_DEBUG (1 << 0) /* x = 42 */ @@ -97,22 +96,22 @@ ntfs_logging_handler ntfs_logging_handler_colour __attribute__((format(printf, 6 /* Macros to simplify logging. One for each level defined above. * Note, if NTFS_DISABLE_DEBUG_LOGGING is defined, then ntfs_log_debug/trace have no effect. */ -#define ntfs_log_critical(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_CRITICAL,NULL,FORMAT,##ARGS) -#define ntfs_log_error(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_ERROR,NULL,FORMAT,##ARGS) -#define ntfs_log_info(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_INFO,NULL,FORMAT,##ARGS) -#define ntfs_log_perror(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_PERROR,NULL,FORMAT,##ARGS) -#define ntfs_log_progress(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_PROGRESS,NULL,FORMAT,##ARGS) -#define ntfs_log_quiet(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_QUIET,NULL,FORMAT,##ARGS) -#define ntfs_log_verbose(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_VERBOSE,NULL,FORMAT,##ARGS) -#define ntfs_log_warning(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_WARNING,NULL,FORMAT,##ARGS) -#define ntfs_log_reason(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_REASON,NULL,FORMAT,##ARGS) +#define ntfs_log_critical(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_CRITICAL,NULL,FORMAT,##ARGS) +#define ntfs_log_error(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_ERROR,NULL,FORMAT,##ARGS) +#define ntfs_log_info(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_INFO,NULL,FORMAT,##ARGS) +#define ntfs_log_perror(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_PERROR,NULL,FORMAT,##ARGS) +#define ntfs_log_progress(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_PROGRESS,NULL,FORMAT,##ARGS) +#define ntfs_log_quiet(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_QUIET,NULL,FORMAT,##ARGS) +#define ntfs_log_verbose(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_VERBOSE,NULL,FORMAT,##ARGS) +#define ntfs_log_warning(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_WARNING,NULL,FORMAT,##ARGS) +#define ntfs_log_reason(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_REASON,NULL,FORMAT,##ARGS) #ifdef NTFS_DISABLE_DEBUG_LOGGING #define ntfs_log_debug(FORMAT, ARGS...)do {} while (0) #define ntfs_log_trace(FORMAT, ARGS...)do {} while (0) #else -#define ntfs_log_debug(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_DEBUG,NULL,FORMAT,##ARGS) -#define ntfs_log_trace(FORMAT, ARGS...) ntfs_logging_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_TRACE,NULL,FORMAT,##ARGS) +#define ntfs_log_debug(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_DEBUG,NULL,FORMAT,##ARGS) +#define ntfs_log_trace(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_TRACE,NULL,FORMAT,##ARGS) #endif /* NTFS_DISABLE_DEBUG_LOGGING */ #endif /* _LOGGING_H_ */ diff --git a/libntfs/logging.c b/libntfs/logging.c index fad6f62e..9ab0ef2a 100644 --- a/libntfs/logging.c +++ b/libntfs/logging.c @@ -49,8 +49,7 @@ * struct ntfs_logging * This global struct controls all the logging within the library and tools. */ -struct ntfs_logging ntfs_log = -{ +struct ntfs_logging ntfs_log = { #ifdef DEBUG NTFS_LOG_LEVEL_DEBUG | NTFS_LOG_LEVEL_TRACE | #endif @@ -58,23 +57,23 @@ struct ntfs_logging ntfs_log = NTFS_LOG_LEVEL_ERROR | NTFS_LOG_LEVEL_PERROR | NTFS_LOG_LEVEL_CRITICAL | NTFS_LOG_LEVEL_REASON, NTFS_LOG_FLAG_ONLYNAME, - ntfs_logging_handler_printf + ntfs_log_handler_printf }; /** - * ntfs_logging_get_levels - Get a list of the current logging levels + * ntfs_log_get_levels - Get a list of the current logging levels * * Find out which logging levels are enabled. * * Returns: Log levels in a 32-bit field */ -u32 ntfs_logging_get_levels(void) +u32 ntfs_log_get_levels(void) { return ntfs_log.levels; } /** - * ntfs_logging_set_levels - Enable extra logging levels + * ntfs_log_set_levels - Enable extra logging levels * @levels: 32-bit field of log levels to set * * Enable one or more logging levels. @@ -82,7 +81,7 @@ u32 ntfs_logging_get_levels(void) * * Returns: Log levels that were enabled before the call */ -u32 ntfs_logging_set_levels(u32 levels) +u32 ntfs_log_set_levels(u32 levels) { u32 old; old = ntfs_log.levels; @@ -91,7 +90,7 @@ u32 ntfs_logging_set_levels(u32 levels) } /** - * ntfs_logging_clear_levels - Disable some logging levels + * ntfs_log_clear_levels - Disable some logging levels * @levels: 32-bit field of log levels to clear * * Disable one or more logging levels. @@ -99,7 +98,7 @@ u32 ntfs_logging_set_levels(u32 levels) * * Returns: Log levels that were enabled before the call */ -u32 ntfs_logging_clear_levels(u32 levels) +u32 ntfs_log_clear_levels(u32 levels) { u32 old; old = ntfs_log.levels; @@ -109,19 +108,19 @@ u32 ntfs_logging_clear_levels(u32 levels) /** - * ntfs_logging_get_flags - Get a list of logging style flags + * ntfs_log_get_flags - Get a list of logging style flags * * Find out which logging flags are enabled. * * Returns: Logging flags in a 32-bit field */ -u32 ntfs_logging_get_flags(void) +u32 ntfs_log_get_flags(void) { return ntfs_log.flags; } /** - * ntfs_logging_set_flags - Enable extra logging style flags + * ntfs_log_set_flags - Enable extra logging style flags * @flags: 32-bit field of logging flags to set * * Enable one or more logging flags. @@ -129,7 +128,7 @@ u32 ntfs_logging_get_flags(void) * * Returns: Logging flags that were enabled before the call */ -u32 ntfs_logging_set_flags(u32 flags) +u32 ntfs_log_set_flags(u32 flags) { u32 old; old = ntfs_log.flags; @@ -138,7 +137,7 @@ u32 ntfs_logging_set_flags(u32 flags) } /** - * ntfs_logging_clear_flags - Disable some logging styles + * ntfs_log_clear_flags - Disable some logging styles * @flags: 32-bit field of logging flags to clear * * Disable one or more logging flags. @@ -146,7 +145,7 @@ u32 ntfs_logging_set_flags(u32 flags) * * Returns: Logging flags that were enabled before the call */ -u32 ntfs_logging_clear_flags(u32 flags) +u32 ntfs_log_clear_flags(u32 flags) { u32 old; old = ntfs_log.flags; @@ -156,7 +155,7 @@ u32 ntfs_logging_clear_flags(u32 flags) /** - * ntfs_logging_get_stream - Default output streams for logging levels + * ntfs_log_get_stream - Default output streams for logging levels * @level: Log level * * By default, urgent messages are sent to "stderr". @@ -164,7 +163,7 @@ u32 ntfs_logging_clear_flags(u32 flags) * * Returns: "string" Prefix to be used */ -static FILE * ntfs_logging_get_stream(u32 level) +static FILE * ntfs_log_get_stream(u32 level) { FILE *stream; @@ -191,14 +190,14 @@ static FILE * ntfs_logging_get_stream(u32 level) } /** - * ntfs_logging_get_prefix - Default prefixes for logging levels + * ntfs_log_get_prefix - Default prefixes for logging levels * @level: Log level to be prefixed * * Prefixing the logging output can make it easier to parse. * * Returns: "string" Prefix to be used */ -static const char * ntfs_logging_get_prefix(u32 level) +static const char * ntfs_log_get_prefix(u32 level) { const char *prefix; @@ -243,7 +242,7 @@ static const char * ntfs_logging_get_prefix(u32 level) /** - * ntfs_logging_set_handler - Provide an alternate logging handler + * ntfs_log_set_handler - Provide an alternate logging handler * @handler: function to perform the logging * * This alternate handler will be called for all future logging requests. @@ -251,16 +250,16 @@ static const char * ntfs_logging_get_prefix(u32 level) * * Returns: void */ -void ntfs_logging_set_handler(ntfs_logging_handler *handler) +void ntfs_log_set_handler(ntfs_log_handler *handler) { if (handler) ntfs_log.handler = handler; else - ntfs_log.handler = ntfs_logging_handler_printf; + ntfs_log.handler = ntfs_log_handler_printf; } /** - * ntfs_logging_redirect - Pass on the request to the real handler + * ntfs_log_redirect - Pass on the request to the real handler * @function: Function in which the log line occurred * @file: File in which the log line occurred * @line: Line number on which the log line occurred @@ -276,7 +275,7 @@ void ntfs_logging_set_handler(ntfs_logging_handler *handler) * 0 Message wasn't logged * num Number of output characters */ -int ntfs_logging_redirect(const char *function, const char *file, +int ntfs_log_redirect(const char *function, const char *file, int line, u32 level, void *data, const char *format, ...) { int olderr = errno; @@ -296,7 +295,7 @@ int ntfs_logging_redirect(const char *function, const char *file, } /** - * ntfs_logging_handler_printf - Basic logging handler + * ntfs_log_handler_printf - Basic logging handler * @function: Function in which the log line occurred * @file: File in which the log line occurred * @line: Line number on which the log line occurred @@ -308,13 +307,13 @@ int ntfs_logging_redirect(const char *function, const char *file, * A simple logging handler. This is where the log line is finally displayed. * * Note: For this handler, @data is a pointer to a FILE output stream. - * If @data is NULL, the function ntfs_logging_get_stream will be called + * If @data is NULL, the function ntfs_log_get_stream will be called * * Returns: -1 Error occurred * 0 Message wasn't logged * num Number of output characters */ -int ntfs_logging_handler_printf(const char *function, const char *file, +int ntfs_log_handler_printf(const char *function, const char *file, int line, u32 level, void *data, const char *format, va_list args) { const int reason_size = 128; @@ -325,10 +324,10 @@ int ntfs_logging_handler_printf(const char *function, const char *file, if (level == NTFS_LOG_LEVEL_REASON) { if (!reason) - reason = malloc (reason_size); + reason = malloc(reason_size); if (reason) { - memset (reason, 0, reason_size); - return vsnprintf (reason, reason_size, format, args); + memset(reason, 0, reason_size); + return vsnprintf(reason, reason_size, format, args); } else { /* Rather than call ourselves, just drop through */ level = NTFS_LOG_LEVEL_PERROR; @@ -341,14 +340,14 @@ int ntfs_logging_handler_printf(const char *function, const char *file, if (data) stream = (FILE*) data; else - stream = ntfs_logging_get_stream(level); + stream = ntfs_log_get_stream(level); if ((ntfs_log.flags & NTFS_LOG_FLAG_ONLYNAME) && (strchr(file, PATH_SEP))) /* Abbreviate the filename */ file = strrchr(file, PATH_SEP) + 1; if (ntfs_log.flags & NTFS_LOG_FLAG_PREFIX) /* Prefix the output */ - ret += fprintf(stream, "%s", ntfs_logging_get_prefix(level)); + ret += fprintf(stream, "%s", ntfs_log_get_prefix(level)); if (ntfs_log.flags & NTFS_LOG_FLAG_FILENAME) /* Source filename */ ret += fprintf(stream, "%s ", file); @@ -356,7 +355,7 @@ int ntfs_logging_handler_printf(const char *function, const char *file, if (ntfs_log.flags & NTFS_LOG_FLAG_LINE) /* Source line number */ ret += fprintf(stream, "(%d) ", line); - if ((ntfs_log.flags & NTFS_LOG_FLAG_FUNCTION) && /* Source function */ + if ((ntfs_log.flags & NTFS_LOG_FLAG_FUNCTION) || /* Source function */ (level & NTFS_LOG_LEVEL_TRACE)) ret += fprintf(stream, "%s(): ", function); @@ -375,7 +374,7 @@ int ntfs_logging_handler_printf(const char *function, const char *file, } /** - * ntfs_logging_handler_colour - Colour-highlighting logging handler + * ntfs_log_handler_colour - Colour-highlighting logging handler * @function: Function in which the log line occurred * @file: File in which the log line occurred * @line: Line number on which the log line occurred @@ -389,16 +388,16 @@ int ntfs_logging_handler_printf(const char *function, const char *file, * Errors: red * Critical errors: red (inverse video) * - * Note: This function calls ntfs_logging_handler_printf to do the main work. + * Note: This function calls ntfs_log_handler_printf to do the main work. * * Note: For this handler, @data is a pointer to a FILE output stream. - * If @data is NULL, the function ntfs_logging_get_stream will be called + * If @data is NULL, the function ntfs_log_get_stream will be called * * Returns: -1 Error occurred * 0 Message wasn't logged * num Number of output characters */ -int ntfs_logging_handler_colour(const char *function, const char *file, +int ntfs_log_handler_colour(const char *function, const char *file, int line, u32 level, void *data, const char *format, va_list args) { int ret = 0; @@ -412,7 +411,7 @@ int ntfs_logging_handler_colour(const char *function, const char *file, if (data) stream = (FILE*) data; else - stream = ntfs_logging_get_stream(level); + stream = ntfs_log_get_stream(level); switch (level) { case NTFS_LOG_LEVEL_DEBUG: @@ -443,7 +442,7 @@ int ntfs_logging_handler_colour(const char *function, const char *file, ret += fprintf(stream, prefix); errno = olderr; - ret += ntfs_logging_handler_printf(function, file, line, level, stream, format, args); + ret += ntfs_log_handler_printf(function, file, line, level, stream, format, args); if (suffix) ret += fprintf(stream, suffix); @@ -455,7 +454,7 @@ int ntfs_logging_handler_colour(const char *function, const char *file, /** - * ntfs_logging_parse_option - Act upon command line options + * ntfs_log_parse_option - Act upon command line options * @option: Option flag * * Delegate some of the work of parsing the command line. All the options begin @@ -467,23 +466,23 @@ int ntfs_logging_handler_colour(const char *function, const char *file, * Returns: TRUE Option understood * FALSE Invalid log option */ -BOOL ntfs_logging_parse_option(const char *option) +BOOL ntfs_log_parse_option(const char *option) { if (strcmp(option, "--log-debug") == 0) { - ntfs_logging_set_levels(NTFS_LOG_LEVEL_DEBUG); + ntfs_log_set_levels(NTFS_LOG_LEVEL_DEBUG); return TRUE; } else if (strcmp(option, "--log-verbose") == 0) { - ntfs_logging_set_levels(NTFS_LOG_LEVEL_VERBOSE); + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); return TRUE; } else if (strcmp(option, "--log-quiet") == 0) { - ntfs_logging_set_levels(NTFS_LOG_LEVEL_QUIET); + ntfs_log_set_levels(NTFS_LOG_LEVEL_QUIET); return TRUE; } else if (strcmp(option, "--log-trace") == 0) { - ntfs_logging_set_levels(NTFS_LOG_LEVEL_TRACE); + ntfs_log_set_levels(NTFS_LOG_LEVEL_TRACE); return TRUE; } else if ((strcmp(option, "--log-colour") == 0) || (strcmp(option, "--log-color") == 0)) { - ntfs_logging_set_handler(ntfs_logging_handler_colour); + ntfs_log_set_handler(ntfs_log_handler_colour); return TRUE; } diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index a7dbdd33..9a1d2b37 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -234,7 +234,7 @@ static int parse_options (int argc, char *argv[]) help++; continue; } - if (ntfs_logging_parse_option(argv[optind-1])) + if (ntfs_log_parse_option(argv[optind-1])) continue; ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); From a244edbe1c4d34d48bb26ed1d03d6780149deaeb Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 26 Oct 2005 20:47:14 +0000 Subject: [PATCH 2635/2994] tidy up wrap lines --- ntfsprogs/attrdef.c | 259 ++++++++++++++++++++++++++++---------------- ntfsprogs/boot.c | 8 +- 2 files changed, 172 insertions(+), 95 deletions(-) diff --git a/ntfsprogs/attrdef.c b/ntfsprogs/attrdef.c index 3cdaf400..4ffa5eeb 100644 --- a/ntfsprogs/attrdef.c +++ b/ntfsprogs/attrdef.c @@ -1,3 +1,6 @@ +/** + * attrdef_ntfs12_array + */ const unsigned char attrdef_ntfs12_array[2400] = { 36, 0, 83, 0, 84, 0, 65, 0, 78, 0, 68, 0, 65, 0, 82, 0, 68, 0, 95, 0, 73, 0, 78, 0, 70, 0, 79, 0, 82, 0, 77, 0, @@ -151,99 +154,169 @@ const unsigned char attrdef_ntfs12_array[2400] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +/** + * attrdef_ntfs3x_array + */ const unsigned char attrdef_ntfs3x_array[2560] = { - - 0x24, 0x00, 0x53, 0x00, 0x54, 0x00, 0x41, 0x00, 0x4E, 0x00, 0x44, 0x00 -, 0x41, 0x00, 0x52, 0x00, 0x44, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x52, 0x00, 0x4D, 0x00, 0x41, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4F, 0x00 -, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x41, 0x00, 0x54, 0x00, 0x54, 0x00, 0x52, 0x00, 0x49, 0x00, 0x42, 0x00, 0x55, 0x00, 0x54, 0x00, 0x45, 0x00 -, 0x5F, 0x00, 0x4C, 0x00, 0x49, 0x00, 0x53, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF -, 0x24, 0x00, 0x46, 0x00, 0x49, 0x00, 0x4C, 0x00, 0x45, 0x00, 0x5F, 0x00, 0x4E, 0x00, 0x41, 0x00, 0x4D, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x42, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x4F, 0x00, 0x42, 0x00, 0x4A, 0x00 -, 0x45, 0x00, 0x43, 0x00, 0x54, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x53, 0x00, 0x45, 0x00, 0x43, 0x00, 0x55, 0x00, 0x52, 0x00, 0x49, 0x00, 0x54, 0x00 -, 0x59, 0x00, 0x5F, 0x00, 0x44, 0x00, 0x45, 0x00, 0x53, 0x00, 0x43, 0x00, 0x52, 0x00, 0x49, 0x00, 0x50, 0x00, 0x54, 0x00, 0x4F, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF -, 0xFF, 0xFF, 0xFF, 0xFF, 0x24, 0x00, 0x56, 0x00, 0x4F, 0x00, 0x4C, 0x00, 0x55, 0x00, 0x4D, 0x00, 0x45, 0x00, 0x5F, 0x00, 0x4E, 0x00, 0x41, 0x00, 0x4D, 0x00, 0x45, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x56, 0x00 -, 0x4F, 0x00, 0x4C, 0x00, 0x55, 0x00, 0x4D, 0x00, 0x45, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x52, 0x00, 0x4D, 0x00, 0x41, 0x00, 0x54, 0x00 -, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 -, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x44, 0x00, 0x41, 0x00, 0x54, 0x00, 0x41, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x24, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x44, 0x00, 0x45, 0x00, 0x58, 0x00, 0x5F, 0x00, 0x52, 0x00, 0x4F, 0x00, 0x4F, 0x00 -, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF -, 0x24, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x44, 0x00, 0x45, 0x00, 0x58, 0x00, 0x5F, 0x00, 0x41, 0x00, 0x4C, 0x00, 0x4C, 0x00, 0x4F, 0x00, 0x43, 0x00, 0x41, 0x00, 0x54, 0x00 -, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x24, 0x00, 0x42, 0x00, 0x49, 0x00, 0x54, 0x00 -, 0x4D, 0x00, 0x41, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x24, 0x00, 0x52, 0x00, 0x45, 0x00, 0x50, 0x00, 0x41, 0x00, 0x52, 0x00, 0x53, 0x00, 0x45, 0x00 -, 0x5F, 0x00, 0x50, 0x00, 0x4F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x45, 0x00, 0x41, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x52, 0x00, 0x4D, 0x00, 0x41, 0x00, 0x54, 0x00 -, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x45, 0x00 -, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x4C, 0x00, 0x4F, 0x00, 0x47, 0x00, 0x47, 0x00, 0x45, 0x00 -, 0x44, 0x00, 0x5F, 0x00, 0x55, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4C, 0x00, 0x49, 0x00, 0x54, 0x00, 0x59, 0x00, 0x5F, 0x00, 0x53, 0x00, 0x54, 0x00, 0x52, 0x00, 0x45, 0x00 -, 0x41, 0x00, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - +0x24, 0x00, 0x53, 0x00, 0x54, 0x00, 0x41, 0x00, 0x4E, 0x00, 0x44, 0x00, 0x41, 0x00, 0x52, 0x00, +0x44, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x52, 0x00, 0x4D, 0x00, +0x41, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, +0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x24, 0x00, 0x41, 0x00, 0x54, 0x00, 0x54, 0x00, 0x52, 0x00, 0x49, 0x00, 0x42, 0x00, 0x55, 0x00, +0x54, 0x00, 0x45, 0x00, 0x5F, 0x00, 0x4C, 0x00, 0x49, 0x00, 0x53, 0x00, 0x54, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +0x24, 0x00, 0x46, 0x00, 0x49, 0x00, 0x4C, 0x00, 0x45, 0x00, 0x5F, 0x00, 0x4E, 0x00, 0x41, 0x00, +0x4D, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, +0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x24, 0x00, 0x4F, 0x00, 0x42, 0x00, 0x4A, 0x00, 0x45, 0x00, 0x43, 0x00, 0x54, 0x00, 0x5F, 0x00, +0x49, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x24, 0x00, 0x53, 0x00, 0x45, 0x00, 0x43, 0x00, 0x55, 0x00, 0x52, 0x00, 0x49, 0x00, 0x54, 0x00, +0x59, 0x00, 0x5F, 0x00, 0x44, 0x00, 0x45, 0x00, 0x53, 0x00, 0x43, 0x00, 0x52, 0x00, 0x49, 0x00, +0x50, 0x00, 0x54, 0x00, 0x4F, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +0x24, 0x00, 0x56, 0x00, 0x4F, 0x00, 0x4C, 0x00, 0x55, 0x00, 0x4D, 0x00, 0x45, 0x00, 0x5F, 0x00, +0x4E, 0x00, 0x41, 0x00, 0x4D, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, +0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x24, 0x00, 0x56, 0x00, 0x4F, 0x00, 0x4C, 0x00, 0x55, 0x00, 0x4D, 0x00, 0x45, 0x00, 0x5F, 0x00, +0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x52, 0x00, 0x4D, 0x00, 0x41, 0x00, 0x54, 0x00, +0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, +0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x24, 0x00, 0x44, 0x00, 0x41, 0x00, 0x54, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +0x24, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x44, 0x00, 0x45, 0x00, 0x58, 0x00, 0x5F, 0x00, 0x52, 0x00, +0x4F, 0x00, 0x4F, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +0x24, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x44, 0x00, 0x45, 0x00, 0x58, 0x00, 0x5F, 0x00, 0x41, 0x00, +0x4C, 0x00, 0x4C, 0x00, 0x4F, 0x00, 0x43, 0x00, 0x41, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4F, 0x00, +0x4E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +0x24, 0x00, 0x42, 0x00, 0x49, 0x00, 0x54, 0x00, 0x4D, 0x00, 0x41, 0x00, 0x50, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +0x24, 0x00, 0x52, 0x00, 0x45, 0x00, 0x50, 0x00, 0x41, 0x00, 0x52, 0x00, 0x53, 0x00, 0x45, 0x00, +0x5F, 0x00, 0x50, 0x00, 0x4F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x24, 0x00, 0x45, 0x00, 0x41, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, +0x52, 0x00, 0x4D, 0x00, 0x41, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xD0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, +0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x24, 0x00, 0x45, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, +0x24, 0x00, 0x4C, 0x00, 0x4F, 0x00, 0x47, 0x00, 0x47, 0x00, 0x45, 0x00, 0x44, 0x00, 0x5F, 0x00, +0x55, 0x00, 0x54, 0x00, 0x49, 0x00, 0x4C, 0x00, 0x49, 0x00, 0x54, 0x00, 0x59, 0x00, 0x5F, 0x00, +0x53, 0x00, 0x54, 0x00, 0x52, 0x00, 0x45, 0x00, 0x41, 0x00, 0x4D, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/ntfsprogs/boot.c b/ntfsprogs/boot.c index b47ded9c..f0535ffd 100644 --- a/ntfsprogs/boot.c +++ b/ntfsprogs/boot.c @@ -1,4 +1,7 @@ -/* The first 3429 bytes of $Boot. The rest is just zero. Total 8192 bytes. */ +/** + * boot_array - the first 3429 bytes of $Boot + * The first 3429 bytes of $Boot. The rest is just zero. Total 8192 bytes. + */ const unsigned char boot_array[3429] = { 235, 91, 144, 78, 84, 70, 83, 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -214,5 +217,6 @@ const unsigned char boot_array[3429] = { 116, 32, 49, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, 116, 32, 50, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, 116, 32, 51, 13, 10, 0, 68, 101, 98, 117, 103, 32, 80, 111, 105, 110, -116, 32, 52, 13, 10 }; +116, 32, 52, 13, 10 +}; From 5bd198d66e07d95b69436e2eda4a768f3f1c98cf Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 26 Oct 2005 20:48:00 +0000 Subject: [PATCH 2636/2994] logging renames utils only uses stderr, now whitespace fixes --- ntfsprogs/utils.c | 355 +++++++++++++++++++++++----------------------- ntfsprogs/utils.h | 55 +++---- 2 files changed, 205 insertions(+), 205 deletions(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index b7682ac3..82c64665 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -23,7 +23,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_STDIO_H #include @@ -62,7 +64,6 @@ #include #endif -#include "config.h" #include "utils.h" #include "types.h" #include "volume.h" @@ -83,17 +84,16 @@ const char *ntfs_gpl = "This program is free software, released under the GNU " /** * utils_set_locale */ -int utils_set_locale (void) +int utils_set_locale(void) { const char *locale; - locale = setlocale (LC_ALL, ""); + locale = setlocale(LC_ALL, ""); if (!locale) { - locale = setlocale (LC_ALL, NULL); - ntfs_log_error ("Failed to set locale, using default '%s'.\n", locale); + locale = setlocale(LC_ALL, NULL); + ntfs_log_error("Failed to set locale, using default '%s'.\n", locale); return 1; } else { - ntfs_log_verbose ("Using locale '%s'.\n", locale); return 0; } } @@ -110,7 +110,7 @@ int utils_set_locale (void) * Return: 1 Success, we can continue * 0 Error, we cannot use this device */ -int utils_valid_device (const char *name, int force) +int utils_valid_device(const char *name, int force) { unsigned long mnt_flags = 0; struct stat st; @@ -124,39 +124,39 @@ int utils_valid_device (const char *name, int force) return 0; } - if (stat (name, &st) == -1) { + if (stat(name, &st) == -1) { if (errno == ENOENT) { - ntfs_log_error ("The device %s doesn't exist\n", name); + ntfs_log_error("The device %s doesn't exist\n", name); } else { - ntfs_log_error ("Error getting information about %s: %s\n", name, strerror (errno)); + ntfs_log_perror("Error getting information about %s", name); } return 0; } - if (!S_ISBLK (st.st_mode)) { - ntfs_log_verbose ("%s is not a block device.\n", name); + if (!S_ISBLK(st.st_mode)) { + ntfs_log_warning("%s is not a block device.\n", name); if (!force) { - ntfs_log_error ("Use the force option to work with files.\n"); + ntfs_log_error("Use the force option to work with files.\n"); return 0; } - ntfs_log_verbose ("Forced to continue.\n"); + ntfs_log_warning("Forced to continue.\n"); } /* Make sure the file system is not mounted. */ - if (ntfs_check_if_mounted (name, &mnt_flags)) { - ntfs_log_verbose ("Failed to determine whether %s is mounted: %s\n", name, strerror (errno)); + if (ntfs_check_if_mounted(name, &mnt_flags)) { + ntfs_log_perror("Failed to determine whether %s is mounted", name); if (!force) { - ntfs_log_error ("Use the force option to ignore this error.\n"); + ntfs_log_error("Use the force option to ignore this error.\n"); return 0; } - ntfs_log_verbose ("Forced to continue.\n"); + ntfs_log_warning("Forced to continue.\n"); } else if (mnt_flags & NTFS_MF_MOUNTED) { - ntfs_log_verbose ("The device %s, is mounted.\n", name); + ntfs_log_warning("The device %s, is mounted.\n", name); if (!force) { - ntfs_log_error ("Use the force option to work a mounted filesystem.\n"); + ntfs_log_error("Use the force option to work a mounted filesystem.\n"); return 0; } - ntfs_log_verbose ("Forced to continue.\n"); + ntfs_log_warning("Forced to continue.\n"); } return 1; @@ -165,7 +165,7 @@ int utils_valid_device (const char *name, int force) /** * utils_mount_volume */ -ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force) +ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL force) { ntfs_volume *vol; @@ -174,16 +174,15 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL return NULL; } - if (!utils_valid_device (device, force)) + if (!utils_valid_device(device, force)) return NULL; - vol = ntfs_mount (device, flags); + vol = ntfs_mount(device, flags); if (!vol) { int err; err = errno; - ntfs_log_error("Couldn't mount device '%s': %s\n", device, - strerror(err)); + ntfs_log_perror("Couldn't mount device '%s'", device); if (err == EPERM) ntfs_log_error("Windows was hibernated. Try to mount volume " "in windows, shut down and try " @@ -196,13 +195,13 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL } if (vol->flags & VOLUME_IS_DIRTY) { - ntfs_log_quiet ("Volume is dirty.\n"); + ntfs_log_warning("Volume is dirty.\n"); if (!force) { - ntfs_log_error ("Run chkdsk and try again, or use the --force option.\n"); - ntfs_umount (vol, FALSE); + ntfs_log_error("Run chkdsk and try again, or use the --force option.\n"); + ntfs_umount(vol, FALSE); return NULL; } - ntfs_log_quiet ("Forced to continue.\n"); + ntfs_log_warning("Forced to continue.\n"); } return vol; @@ -232,7 +231,7 @@ ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL * Return: 1 Success * 0 Error, the string was malformed */ -int utils_parse_size (const char *value, s64 *size, BOOL scale) +int utils_parse_size(const char *value, s64 *size, BOOL scale) { long long result; char *suffix = NULL; @@ -242,16 +241,16 @@ int utils_parse_size (const char *value, s64 *size, BOOL scale) return 0; } - ntfs_log_debug ("Parsing size '%s'.\n", value); + ntfs_log_debug("Parsing size '%s'.\n", value); - result = strtoll (value, &suffix, 10); + result = strtoll(value, &suffix, 10); if (result < 0 || errno == ERANGE) { - ntfs_log_error ("Invalid size '%s'.\n", value); + ntfs_log_error("Invalid size '%s'.\n", value); return 0; } if (!suffix) { - ntfs_log_error ("Internal error, strtoll didn't return a suffix.\n"); + ntfs_log_error("Internal error, strtoll didn't return a suffix.\n"); return 0; } @@ -264,17 +263,17 @@ int utils_parse_size (const char *value, s64 *size, BOOL scale) case '-': case 0: break; default: - ntfs_log_error ("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); + ntfs_log_error("Invalid size suffix '%s'. Use T, G, M, or K.\n", suffix); return 0; } } else { if ((suffix[0] != '-') && (suffix[0] != 0)) { - ntfs_log_error ("Invalid number '%.*s'.\n", (int)(suffix - value + 1), value); + ntfs_log_error("Invalid number '%.*s'.\n", (int)(suffix - value + 1), value); return 0; } } - ntfs_log_debug ("Parsed size = %lld.\n", result); + ntfs_log_debug("Parsed size = %lld.\n", result); *size = result; return 1; } @@ -292,7 +291,7 @@ int utils_parse_size (const char *value, s64 *size, BOOL scale) * Return: 1 Success, a valid string was found * 0 Error, the string was not a valid range */ -int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale) +int utils_parse_range(const char *string, s64 *start, s64 *finish, BOOL scale) { s64 a, b; char *middle; @@ -302,28 +301,28 @@ int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale) return 0; } - middle = strchr (string, '-'); + middle = strchr(string, '-'); if (string == middle) { - ntfs_log_debug ("Range has no beginning, defaulting to 0.\n"); + ntfs_log_debug("Range has no beginning, defaulting to 0.\n"); a = 0; } else { - if (!utils_parse_size (string, &a, scale)) + if (!utils_parse_size(string, &a, scale)) return 0; } if (middle) { if (middle[1] == 0) { b = LONG_MAX; // XXX ULLONG_MAX - ntfs_log_debug ("Range has no end, defaulting to %lld.\n", b); + ntfs_log_debug("Range has no end, defaulting to %lld.\n", b); } else { - if (!utils_parse_size (middle+1, &b, scale)) + if (!utils_parse_size(middle+1, &b, scale)) return 0; } } else { b = a; } - ntfs_log_debug ("Range '%s' = %lld - %lld\n", string, a, b); + ntfs_log_debug("Range '%s' = %lld - %lld\n", string, a, b); *start = a; *finish = b; @@ -345,7 +344,7 @@ int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale) * Return: Pointer Success, an attribute was found * NULL Error, no matching attributes were found */ -ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) +ATTR_RECORD * find_attribute(const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) { if (!ctx) { errno = EINVAL; @@ -353,11 +352,11 @@ ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) } if (ntfs_attr_lookup(type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { - ntfs_log_debug ("find_attribute didn't find an attribute of type: 0x%02x.\n", type); + ntfs_log_debug("find_attribute didn't find an attribute of type: 0x%02x.\n", type); return NULL; /* None / no more of that type */ } - ntfs_log_debug ("find_attribute found an attribute of type: 0x%02x.\n", type); + ntfs_log_debug("find_attribute found an attribute of type: 0x%02x.\n", type); return ctx->attr; } @@ -375,7 +374,7 @@ ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) * Return: Pointer Success, an attribute was found * NULL Error, no matching attributes were found */ -ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) +ATTR_RECORD * find_first_attribute(const ATTR_TYPES type, MFT_RECORD *mft) { ntfs_attr_search_ctx *ctx; ATTR_RECORD *rec; @@ -385,18 +384,18 @@ ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) return NULL; } - ctx = ntfs_attr_get_search_ctx (NULL, mft); + ctx = ntfs_attr_get_search_ctx(NULL, mft); if (!ctx) { - ntfs_log_error ("Couldn't create a search context.\n"); + ntfs_log_error("Couldn't create a search context.\n"); return NULL; } - rec = find_attribute (type, ctx); - ntfs_attr_put_search_ctx (ctx); + rec = find_attribute(type, ctx); + ntfs_attr_put_search_ctx(ctx); if (rec) - ntfs_log_debug ("find_first_attribute: found attr of type 0x%02x.\n", type); + ntfs_log_debug("find_first_attribute: found attr of type 0x%02x.\n", type); else - ntfs_log_debug ("find_first_attribute: didn't find attr of type 0x%02x.\n", type); + ntfs_log_debug("find_first_attribute: didn't find attr of type 0x%02x.\n", type); return rec; } @@ -411,7 +410,7 @@ ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft) * if parent is 5 (/) stop * get inode of parent */ -int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) +int utils_inode_get_name(ntfs_inode *inode, char *buffer, int bufsize) { // XXX option: names = posix/win32 or dos // flags: path, filename, or both @@ -433,65 +432,65 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) vol = inode->vol; - //ntfs_log_debug ("sizeof (char*) = %d, sizeof (names) = %d\n", sizeof (char*), sizeof (names)); - memset (names, 0, sizeof (names)); + //ntfs_log_debug("sizeof(char*) = %d, sizeof(names) = %d\n", sizeof(char*), sizeof(names)); + memset(names, 0, sizeof(names)); for (i = 0; i < max_path; i++) { - ctx = ntfs_attr_get_search_ctx (inode, NULL); + ctx = ntfs_attr_get_search_ctx(inode, NULL); if (!ctx) { - ntfs_log_error ("Couldn't create a search context.\n"); + ntfs_log_error("Couldn't create a search context.\n"); return 0; } - //ntfs_log_debug ("i = %d, inode = %p (%lld)\n", i, inode, inode->mft_no); + //ntfs_log_debug("i = %d, inode = %p (%lld)\n", i, inode, inode->mft_no); name_space = 4; - while ((rec = find_attribute (AT_FILE_NAME, ctx))) { + while ((rec = find_attribute(AT_FILE_NAME, ctx))) { /* We know this will always be resident. */ - attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); + attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu(rec->value_offset)); if (attr->file_name_type > name_space) { //XXX find the ... continue; } name_space = attr->file_name_type; - parent = le64_to_cpu (attr->parent_directory); + parent = le64_to_cpu(attr->parent_directory); if (names[i]) { - free (names[i]); + free(names[i]); names[i] = NULL; } - if (ntfs_ucstombs (attr->file_name, attr->file_name_length, + if (ntfs_ucstombs(attr->file_name, attr->file_name_length, &names[i], 0) < 0) { char *temp; - ntfs_log_error ("Couldn't translate filename to current locale.\n"); - temp = malloc (30); + ntfs_log_error("Couldn't translate filename to current locale.\n"); + temp = malloc(30); if (!temp) return 0; - snprintf (temp, 30, "", (unsigned + snprintf(temp, 30, "", (unsigned long long)inode->mft_no); names[i] = temp; } - //ntfs_log_debug ("names[%d] %s\n", i, names[i]); - //ntfs_log_debug ("parent = %lld\n", MREF (parent)); + //ntfs_log_debug("names[%d] %s\n", i, names[i]); + //ntfs_log_debug("parent = %lld\n", MREF(parent)); } ntfs_attr_put_search_ctx(ctx); if (i > 0) /* Don't close the original inode */ - ntfs_inode_close (inode); + ntfs_inode_close(inode); - if (MREF (parent) == FILE_root) { /* The root directory, stop. */ - //ntfs_log_debug ("inode 5\n"); + if (MREF(parent) == FILE_root) { /* The root directory, stop. */ + //ntfs_log_debug("inode 5\n"); break; } - inode = ntfs_inode_open (vol, parent); + inode = ntfs_inode_open(vol, parent); if (!inode) { - ntfs_log_error ("Couldn't open inode %llu.\n", + ntfs_log_error("Couldn't open inode %llu.\n", (unsigned long long)MREF(parent)); break; } @@ -499,7 +498,7 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) if (i >= max_path) { /* If we get into an infinite loop, we'll end up here. */ - ntfs_log_error ("The directory structure is too deep (over %d) nested directories.\n", max_path); + ntfs_log_error("The directory structure is too deep (over %d) nested directories.\n", max_path); return 0; } @@ -508,9 +507,9 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) if (!names[i]) continue; - len = snprintf (buffer + offset, bufsize - offset, "%c%s", PATH_SEP, names[i]); + len = snprintf(buffer + offset, bufsize - offset, "%c%s", PATH_SEP, names[i]); if (len >= (bufsize - offset)) { - ntfs_log_error ("Pathname was truncated.\n"); + ntfs_log_error("Pathname was truncated.\n"); break; } @@ -519,9 +518,9 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) /* Free all the allocated memory */ for (i = 0; i < max_path; i++) - free (names[i]); + free(names[i]); - ntfs_log_debug ("Pathname: %s\n", buffer); + ntfs_log_debug("Pathname: %s\n", buffer); return 0; } @@ -529,7 +528,7 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize) /** * utils_attr_get_name */ -int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int bufsize) +int utils_attr_get_name(ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int bufsize) { int len, namelen; char *name; @@ -541,23 +540,23 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int return 0; } - attrdef = ntfs_attr_find_in_attrdef (vol, attr->type); + attrdef = ntfs_attr_find_in_attrdef(vol, attr->type); if (attrdef) { name = NULL; - namelen = ntfs_ucsnlen (attrdef->name, sizeof (attrdef->name)); - if (ntfs_ucstombs (attrdef->name, namelen, &name, 0) < 0) { - ntfs_log_error ("Couldn't translate attribute type to current locale.\n"); + namelen = ntfs_ucsnlen(attrdef->name, sizeof(attrdef->name)); + if (ntfs_ucstombs(attrdef->name, namelen, &name, 0) < 0) { + ntfs_log_error("Couldn't translate attribute type to current locale.\n"); // ? return 0; } - len = snprintf (buffer, bufsize, "%s", name); + len = snprintf(buffer, bufsize, "%s", name); } else { - ntfs_log_error ("Unknown attribute type 0x%02x\n", attr->type); - len = snprintf (buffer, bufsize, ""); + ntfs_log_error("Unknown attribute type 0x%02x\n", attr->type); + len = snprintf(buffer, bufsize, ""); } if (len >= bufsize) { - ntfs_log_error ("Attribute type was truncated.\n"); + ntfs_log_error("Attribute type was truncated.\n"); return 0; } @@ -570,19 +569,19 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int name = NULL; namelen = attr->name_length; - if (ntfs_ucstombs ((ntfschar *)((char *)attr + attr->name_offset), + if (ntfs_ucstombs((ntfschar *)((char *)attr + attr->name_offset), namelen, &name, 0) < 0) { - ntfs_log_error ("Couldn't translate attribute name to current locale.\n"); + ntfs_log_error("Couldn't translate attribute name to current locale.\n"); // ? - len = snprintf (buffer, bufsize, ""); + len = snprintf(buffer, bufsize, ""); return 0; } - len = snprintf (buffer, bufsize, "(%s)", name); - free (name); + len = snprintf(buffer, bufsize, "(%s)", name); + free(name); if (len >= bufsize) { - ntfs_log_error ("Attribute name was truncated.\n"); + ntfs_log_error("Attribute name was truncated.\n"); return 0; } @@ -606,10 +605,10 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int * 0 Cluster is free space * -1 Error occurred */ -int utils_cluster_in_use (ntfs_volume *vol, long long lcn) +int utils_cluster_in_use(ntfs_volume *vol, long long lcn) { static unsigned char buffer[512]; - static long long bmplcn = -sizeof (buffer) - 1; /* Which bit of $Bitmap is in the buffer */ + static long long bmplcn = -sizeof(buffer) - 1; /* Which bit of $Bitmap is in the buffer */ int byte, bit; ntfs_attr *attr; @@ -620,31 +619,31 @@ int utils_cluster_in_use (ntfs_volume *vol, long long lcn) } /* Does lcn lie in the section of $Bitmap we already have cached? */ - if ((lcn < bmplcn) || (lcn >= (bmplcn + (sizeof (buffer) << 3)))) { - ntfs_log_debug ("Bit lies outside cache.\n"); - attr = ntfs_attr_open (vol->lcnbmp_ni, AT_DATA, AT_UNNAMED, 0); + if ((lcn < bmplcn) || (lcn >= (bmplcn + (sizeof(buffer) << 3)))) { + ntfs_log_debug("Bit lies outside cache.\n"); + attr = ntfs_attr_open(vol->lcnbmp_ni, AT_DATA, AT_UNNAMED, 0); if (!attr) { - ntfs_log_error ("Couldn't open $Bitmap: %s\n", strerror (errno)); + ntfs_log_perror("Couldn't open $Bitmap"); return -1; } /* Mark the buffer as in use, in case the read is shorter. */ - memset (buffer, 0xFF, sizeof (buffer)); - bmplcn = lcn & (~((sizeof (buffer) << 3) - 1)); + memset(buffer, 0xFF, sizeof(buffer)); + bmplcn = lcn & (~((sizeof(buffer) << 3) - 1)); - if (ntfs_attr_pread (attr, (bmplcn>>3), sizeof (buffer), buffer) < 0) { - ntfs_log_error ("Couldn't read $Bitmap: %s\n", strerror (errno)); - ntfs_attr_close (attr); + if (ntfs_attr_pread(attr, (bmplcn>>3), sizeof(buffer), buffer) < 0) { + ntfs_log_perror("Couldn't read $Bitmap"); + ntfs_attr_close(attr); return -1; } - ntfs_log_debug ("Reloaded bitmap buffer.\n"); - ntfs_attr_close (attr); + ntfs_log_debug("Reloaded bitmap buffer.\n"); + ntfs_attr_close(attr); } bit = 1 << (lcn & 7); - byte = (lcn >> 3) & (sizeof (buffer) - 1); - ntfs_log_debug ("cluster = %lld, bmplcn = %lld, byte = %d, bit = %d, in use %d\n", lcn, bmplcn, byte, bit, buffer[byte] & bit); + byte = (lcn >> 3) & (sizeof(buffer) - 1); + ntfs_log_debug("cluster = %lld, bmplcn = %lld, byte = %d, bit = %d, in use %d\n", lcn, bmplcn, byte, bit, buffer[byte] & bit); return (buffer[byte] & bit); } @@ -666,10 +665,10 @@ int utils_cluster_in_use (ntfs_volume *vol, long long lcn) * 0 MFT Record is unused * -1 Error occurred */ -int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref) +int utils_mftrec_in_use(ntfs_volume *vol, MFT_REF mref) { static u8 buffer[512]; - static s64 bmpmref = -sizeof (buffer) - 1; /* Which bit of $BITMAP is in the buffer */ + static s64 bmpmref = -sizeof(buffer) - 1; /* Which bit of $BITMAP is in the buffer */ int byte, bit; @@ -678,26 +677,27 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref) return -1; } + ntfs_log_trace("entering\n"); /* Does mref lie in the section of $Bitmap we already have cached? */ if (((s64)MREF(mref) < bmpmref) || ((s64)MREF(mref) >= (bmpmref + - (sizeof (buffer) << 3)))) { - ntfs_log_debug ("Bit lies outside cache.\n"); + (sizeof(buffer) << 3)))) { + ntfs_log_debug("Bit lies outside cache.\n"); /* Mark the buffer as not in use, in case the read is shorter. */ - memset (buffer, 0, sizeof (buffer)); - bmpmref = mref & (~((sizeof (buffer) << 3) - 1)); + memset(buffer, 0, sizeof(buffer)); + bmpmref = mref & (~((sizeof(buffer) << 3) - 1)); - if (ntfs_attr_pread (vol->mftbmp_na, (bmpmref>>3), sizeof (buffer), buffer) < 0) { - ntfs_log_error ("Couldn't read $MFT/$BITMAP: %s\n", strerror (errno)); + if (ntfs_attr_pread(vol->mftbmp_na, (bmpmref>>3), sizeof(buffer), buffer) < 0) { + ntfs_log_perror("Couldn't read $MFT/$BITMAP"); return -1; } - ntfs_log_debug ("Reloaded bitmap buffer.\n"); + ntfs_log_debug("Reloaded bitmap buffer.\n"); } bit = 1 << (mref & 7); - byte = (mref >> 3) & (sizeof (buffer) - 1); - ntfs_log_debug ("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", mref, bmpmref, byte, bit, buffer[byte] & bit); + byte = (mref >> 3) & (sizeof(buffer) - 1); + ntfs_log_debug("cluster = %lld, bmpmref = %lld, byte = %d, bit = %d, in use %d\n", mref, bmpmref, byte, bit, buffer[byte] & bit); return (buffer[byte] & bit); } @@ -705,7 +705,7 @@ int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref) /** * __metadata */ -static int __metadata (ntfs_volume *vol, u64 num) +static int __metadata(ntfs_volume *vol, u64 num) { if (num <= FILE_UpCase) return 1; @@ -729,7 +729,7 @@ static int __metadata (ntfs_volume *vol, u64 num) * 0 inode is not a metadata file * -1 Error occurred */ -int utils_is_metadata (ntfs_inode *inode) +int utils_is_metadata(ntfs_inode *inode) { ntfs_volume *vol; ATTR_RECORD *rec; @@ -747,26 +747,26 @@ int utils_is_metadata (ntfs_inode *inode) return -1; num = inode->mft_no; - if (__metadata (vol, num) == 1) + if (__metadata(vol, num) == 1) return 1; file = inode->mrec; if (file && (file->base_mft_record != 0)) { - num = MREF (file->base_mft_record); - if (__metadata (vol, num) == 1) + num = MREF(file->base_mft_record); + if (__metadata(vol, num) == 1) return 1; } file = inode->mrec; - rec = find_first_attribute (AT_FILE_NAME, inode->mrec); + rec = find_first_attribute(AT_FILE_NAME, inode->mrec); if (!rec) return -1; /* We know this will always be resident. */ - attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); + attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu(rec->value_offset)); - num = MREF (attr->parent_directory); - if ((num != FILE_root) && (__metadata (vol, num) == 1)) + num = MREF(attr->parent_directory); + if ((num != FILE_root) && (__metadata(vol, num) == 1)) return 1; return 0; @@ -786,7 +786,7 @@ int utils_is_metadata (ntfs_inode *inode) * Examples are: DM_INDENT (indent the output by one tab); DM_RED (colour the * output); DM_NO_ASCII (only print the hex values). */ -void utils_dump_mem (void *buf, int start, int length, int flags) +void utils_dump_mem(void *buf, int start, int length, int flags) { int off, i, s, e, col; u8 *mem = buf; @@ -803,11 +803,11 @@ void utils_dump_mem (void *buf, int start, int length, int flags) if (flags & DM_BLUE) col += 4; if (flags & DM_INDENT) - ntfs_log_debug ("\t"); + ntfs_log_debug("\t"); if (flags & DM_BOLD) - ntfs_log_debug ("\e[01m"); + ntfs_log_debug("\e[01m"); if (flags & (DM_RED | DM_BLUE | DM_GREEN | DM_BOLD)) - ntfs_log_debug ("\e[%dm", col); + ntfs_log_debug("\e[%dm", col); if (off == s) ntfs_log_debug("%6.6x ", start); else @@ -815,26 +815,26 @@ void utils_dump_mem (void *buf, int start, int length, int flags) for (i = 0; i < 16; i++) { if ((i == 8) && (!(flags & DM_NO_DIVIDER))) - ntfs_log_debug (" -"); + ntfs_log_debug(" -"); if (((off+i) >= start) && ((off+i) < (start+length))) - ntfs_log_debug (" %02X", mem[off+i]); + ntfs_log_debug(" %02X", mem[off+i]); else - ntfs_log_debug (" "); + ntfs_log_debug(" "); } if (!(flags & DM_NO_ASCII)) { - ntfs_log_debug (" "); + ntfs_log_debug(" "); for (i = 0; i < 16; i++) { if (((off+i) < start) || ((off+i) >= (start+length))) - ntfs_log_debug (" "); - else if (isprint (mem[off + i])) - ntfs_log_debug ("%c", mem[off + i]); + ntfs_log_debug(" "); + else if (isprint(mem[off + i])) + ntfs_log_debug("%c", mem[off + i]); else - ntfs_log_debug ("."); + ntfs_log_debug("."); } } if (flags & (DM_RED | DM_BLUE | DM_GREEN | DM_BOLD)) - ntfs_log_debug ("\e[0m"); - ntfs_log_debug ("\n"); + ntfs_log_debug("\e[0m"); + ntfs_log_debug("\n"); } } @@ -842,7 +842,7 @@ void utils_dump_mem (void *buf, int start, int length, int flags) /** * mft_get_search_ctx */ -struct mft_search_ctx * mft_get_search_ctx (ntfs_volume *vol) +struct mft_search_ctx * mft_get_search_ctx(ntfs_volume *vol) { struct mft_search_ctx *ctx; @@ -851,7 +851,7 @@ struct mft_search_ctx * mft_get_search_ctx (ntfs_volume *vol) return NULL; } - ctx = calloc (1, sizeof *ctx); + ctx = calloc(1, sizeof *ctx); ctx->mft_num = -1; ctx->vol = vol; @@ -862,19 +862,19 @@ struct mft_search_ctx * mft_get_search_ctx (ntfs_volume *vol) /** * mft_put_search_ctx */ -void mft_put_search_ctx (struct mft_search_ctx *ctx) +void mft_put_search_ctx(struct mft_search_ctx *ctx) { if (!ctx) return; if (ctx->inode) - ntfs_inode_close (ctx->inode); - free (ctx); + ntfs_inode_close(ctx->inode); + free(ctx); } /** * mft_next_record */ -int mft_next_record (struct mft_search_ctx *ctx) +int mft_next_record(struct mft_search_ctx *ctx) { s64 nr_mft_records; ATTR_RECORD *attr10 = NULL; @@ -888,7 +888,7 @@ int mft_next_record (struct mft_search_ctx *ctx) } if (ctx->inode) { - ntfs_inode_close (ctx->inode); + ntfs_inode_close(ctx->inode); ctx->inode = NULL; } @@ -899,9 +899,9 @@ int mft_next_record (struct mft_search_ctx *ctx) int in_use; ctx->flags_match = 0; - in_use = utils_mftrec_in_use (ctx->vol, (MFT_REF) ctx->mft_num); + in_use = utils_mftrec_in_use(ctx->vol, (MFT_REF) ctx->mft_num); if (in_use == -1) { - ntfs_log_error ("Error reading inode %llu. Aborting.\n", + ntfs_log_error("Error reading inode %llu. Aborting.\n", (unsigned long long)ctx->mft_num); return -1; } @@ -909,16 +909,16 @@ int mft_next_record (struct mft_search_ctx *ctx) if (in_use) { ctx->flags_match |= FEMR_IN_USE; - ctx->inode = ntfs_inode_open (ctx->vol, (MFT_REF) ctx->mft_num); + ctx->inode = ntfs_inode_open(ctx->vol, (MFT_REF) ctx->mft_num); if (ctx->inode == NULL) { - ntfs_log_error ("Error reading inode %llu.\n", (unsigned + ntfs_log_error("Error reading inode %llu.\n", (unsigned long long) ctx->mft_num); continue; } - attr10 = find_first_attribute (AT_STANDARD_INFORMATION, ctx->inode->mrec); - attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, ctx->inode->mrec); - attr80 = find_first_attribute (AT_DATA, ctx->inode->mrec); + attr10 = find_first_attribute(AT_STANDARD_INFORMATION, ctx->inode->mrec); + attr20 = find_first_attribute(AT_ATTRIBUTE_LIST, ctx->inode->mrec); + attr80 = find_first_attribute(AT_DATA, ctx->inode->mrec); if (attr10) ctx->flags_match |= FEMR_BASE_RECORD; @@ -932,24 +932,24 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->flags_match |= FEMR_FILE; if (ctx->flags_search & FEMR_DIR) { - attr_ctx = ntfs_attr_get_search_ctx (ctx->inode, NULL); + attr_ctx = ntfs_attr_get_search_ctx(ctx->inode, NULL); if (attr_ctx) { - if (ntfs_attr_lookup (AT_INDEX_ROOT, NTFS_INDEX_I30, 4, 0, 0, NULL, 0, attr_ctx) == 0) + if (ntfs_attr_lookup(AT_INDEX_ROOT, NTFS_INDEX_I30, 4, 0, 0, NULL, 0, attr_ctx) == 0) ctx->flags_match |= FEMR_DIR; - ntfs_attr_put_search_ctx (attr_ctx); + ntfs_attr_put_search_ctx(attr_ctx); } else { - ntfs_log_error ("Couldn't create a search context.\n"); + ntfs_log_error("Couldn't create a search context.\n"); return -1; } } - switch (utils_is_metadata (ctx->inode)) { + switch (utils_is_metadata(ctx->inode)) { case 1: ctx->flags_match |= FEMR_METADATA; break; case 0: ctx->flags_match |= FEMR_NOT_METADATA; break; default: ctx->flags_match |= FEMR_NOT_METADATA; break; - //ntfs_log_error ("Error reading inode %lld.\n", ctx->mft_num); + //ntfs_log_error("Error reading inode %lld.\n", ctx->mft_num); //return -1; } @@ -958,33 +958,32 @@ int mft_next_record (struct mft_search_ctx *ctx) ctx->flags_match |= FEMR_NOT_IN_USE; - ctx->inode = calloc (1, sizeof (*ctx->inode)); + ctx->inode = calloc(1, sizeof(*ctx->inode)); if (!ctx->inode) { - ntfs_log_error ("Out of memory. Aborting.\n"); + ntfs_log_error("Out of memory. Aborting.\n"); return -1; } ctx->inode->mft_no = ctx->mft_num; ctx->inode->vol = ctx->vol; - ctx->inode->mrec = malloc (ctx->vol->mft_record_size); + ctx->inode->mrec = malloc(ctx->vol->mft_record_size); if (!ctx->inode->mrec) { - free (ctx->inode); // == ntfs_inode_close - ntfs_log_error ("Out of memory. Aborting.\n"); + free(ctx->inode); // == ntfs_inode_close + ntfs_log_error("Out of memory. Aborting.\n"); return -1; } - mft = ntfs_attr_open (ctx->vol->mft_ni, AT_DATA, + mft = ntfs_attr_open(ctx->vol->mft_ni, AT_DATA, AT_UNNAMED, 0); if (!mft) { - ntfs_log_error ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); + ntfs_log_perror("Couldn't open $MFT/$DATA"); // free / close return -1; } - if (ntfs_attr_pread (mft, ctx->vol->mft_record_size * ctx->mft_num, ctx->vol->mft_record_size, ctx->inode->mrec) < ctx->vol->mft_record_size) { - ntfs_log_error ("Couldn't read MFT Record %llu: %s.\n", - (unsigned long long) - ctx->mft_num, strerror (errno)); + if (ntfs_attr_pread(mft, ctx->vol->mft_record_size * ctx->mft_num, ctx->vol->mft_record_size, ctx->inode->mrec) < ctx->vol->mft_record_size) { + ntfs_log_perror("Couldn't read MFT Record %llu", + (unsigned long long) ctx->mft_num); // free / close ntfs_attr_close(mft); return -1; @@ -997,8 +996,8 @@ int mft_next_record (struct mft_search_ctx *ctx) break; } - if (ntfs_inode_close (ctx->inode)) { - ntfs_log_error ("Error closing inode %llu.\n", + if (ntfs_inode_close(ctx->inode)) { + ntfs_log_error("Error closing inode %llu.\n", (unsigned long long)ctx->mft_num); return -errno; } diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index f6c09d0e..c627c1ea 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -46,13 +46,14 @@ extern const char *ntfs_gpl; #if !defined(REG_NOERROR) || (REG_NOERROR != 0) # define REG_NOERROR 0 #endif + #define DEC_PRINTF(NAME) \ - int NAME (const char *format, ...) \ - __attribute__ ((format (printf, 1, 2))); + int NAME(const char *format, ...) \ + __attribute__((format(printf, 1, 2))); #define GEN_PRINTF(NAME, STREAM, CONTROL, TRIGGER) \ - __attribute__ ((format (printf, 1, 2))) \ - int NAME (const char *format, ...) \ + __attribute__((format(printf, 1, 2))) \ + int NAME(const char *format, ...) \ { \ int ret, olderr = errno, *control = (CONTROL); \ va_list args; \ @@ -63,9 +64,9 @@ extern const char *ntfs_gpl; ((*control && !(TRIGGER)) || (!*control && (TRIGGER)))) \ return -1; \ \ - va_start (args, format); \ - ret = vfprintf ((STREAM), format, args); \ - va_end (args); \ + va_start(args, format); \ + ret = vfprintf((STREAM), format, args); \ + va_end(args); \ errno = olderr; \ return ret; \ } @@ -73,32 +74,32 @@ extern const char *ntfs_gpl; /* utils.c's utilities require the following functions implemented. * Example of implementation is: - * GEN_PRINTF (Eprintf, stderr, NULL, FALSE) - * GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) - * GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) + * GEN_PRINTF(Eprintf, stderr, NULL, FALSE) + * GEN_PRINTF(Vprintf, stderr, &opts.verbose, TRUE) + * GEN_PRINTF(Qprintf, stderr, &opts.quiet, FALSE) */ extern DEC_PRINTF(Eprintf) extern DEC_PRINTF(Vprintf) extern DEC_PRINTF(Qprintf) -int utils_set_locale (void); -int utils_parse_size (const char *value, s64 *size, BOOL scale); -int utils_parse_range (const char *string, s64 *start, s64 *finish, BOOL scale); -int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize); -int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int bufsize); -int utils_cluster_in_use (ntfs_volume *vol, long long lcn); -int utils_mftrec_in_use (ntfs_volume *vol, MFT_REF mref); -int utils_is_metadata (ntfs_inode *inode); -void utils_dump_mem (void *buf, int start, int length, int ascii); +int utils_set_locale(void); +int utils_parse_size(const char *value, s64 *size, BOOL scale); +int utils_parse_range(const char *string, s64 *start, s64 *finish, BOOL scale); +int utils_inode_get_name(ntfs_inode *inode, char *buffer, int bufsize); +int utils_attr_get_name(ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int bufsize); +int utils_cluster_in_use(ntfs_volume *vol, long long lcn); +int utils_mftrec_in_use(ntfs_volume *vol, MFT_REF mref); +int utils_is_metadata(ntfs_inode *inode); +void utils_dump_mem(void *buf, int start, int length, int ascii); #ifndef _NTFS_RICH_H_ -ATTR_RECORD * find_attribute (const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); -ATTR_RECORD * find_first_attribute (const ATTR_TYPES type, MFT_RECORD *mft); +ATTR_RECORD * find_attribute(const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); +ATTR_RECORD * find_first_attribute(const ATTR_TYPES type, MFT_RECORD *mft); #endif -#if !(defined (_NTFS_VOLUME_H) && defined (NTFS_RICH)) -int utils_valid_device (const char *name, int force); -ntfs_volume * utils_mount_volume (const char *device, unsigned long flags, BOOL force); +#if !(defined(_NTFS_VOLUME_H) && defined(NTFS_RICH)) +int utils_valid_device(const char *name, int force); +ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL force); #endif /** @@ -126,9 +127,9 @@ struct mft_search_ctx { u64 mft_num; }; -struct mft_search_ctx * mft_get_search_ctx (ntfs_volume *vol); -void mft_put_search_ctx (struct mft_search_ctx *ctx); -int mft_next_record (struct mft_search_ctx *ctx); +struct mft_search_ctx * mft_get_search_ctx(ntfs_volume *vol); +void mft_put_search_ctx(struct mft_search_ctx *ctx); +int mft_next_record(struct mft_search_ctx *ctx); // Flags for dump mem #define DM_DEFAULTS 0 From 1ee8d8b9e2ca73cb7fdb5e614e07b2cc24db5eba Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 26 Oct 2005 20:48:38 +0000 Subject: [PATCH 2637/2994] restore call to ntfs_set_locale (utils only uses stderr, now) --- ntfsprogs/ntfsclone.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 32f7d051..697a3417 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1456,8 +1456,7 @@ int main(int argc, char **argv) parse_options(argc, argv); - /* FIXME: this started to corrupt stdout due to logging changes */ -// utils_set_locale(); + utils_set_locale(); if (opt.restore_image) { device_size = open_image(); From c59d76aed20d12d032e5842b2bd05aa3afd827c4 Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 26 Oct 2005 20:52:53 +0000 Subject: [PATCH 2638/2994] missing include --- libntfs/tree.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libntfs/tree.c b/libntfs/tree.c index 0e11284e..0945d0b8 100644 --- a/libntfs/tree.c +++ b/libntfs/tree.c @@ -28,6 +28,9 @@ #ifdef HAVE_STDLIB_H #include #endif +#ifdef HAVE_STRING_H +#include +#endif #include "volume.h" #include "dir.h" From 8a584700c511cd24016172785532be7dfb26a341 Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 26 Oct 2005 22:54:57 +0000 Subject: [PATCH 2639/2994] whitespace fixes - no code changes --- include/ntfs/layout.h | 12 +- libntfs/attrib.c | 2 +- libntfs/dir.c | 16 +- libntfs/logfile.c | 2 +- libntfs/security.c | 2 +- libntfs/tree.c | 2 +- ntfsprogs/cluster.c | 40 +- ntfsprogs/cluster.h | 4 +- ntfsprogs/mkntfs.c | 6 +- ntfsprogs/ntfscat.c | 96 ++--- ntfsprogs/ntfsclone.c | 16 +- ntfsprogs/ntfscluster.c | 188 ++++----- ntfsprogs/ntfscmp.c | 6 +- ntfsprogs/ntfscp.c | 26 +- ntfsprogs/ntfsdump_logfile.c | 10 +- ntfsprogs/ntfsfix.c | 6 +- ntfsprogs/ntfsinfo.c | 58 +-- ntfsprogs/ntfslabel.c | 50 +-- ntfsprogs/ntfsls.c | 16 +- ntfsprogs/ntfsmftalloc.c | 4 +- ntfsprogs/ntfsmount.c | 4 +- ntfsprogs/ntfsmove.c | 302 +++++++-------- ntfsprogs/ntfsresize.c | 20 +- ntfsprogs/ntfsrm.c | 474 +++++++++++------------ ntfsprogs/ntfstruncate.c | 4 +- ntfsprogs/ntfsundelete.c | 722 ++++++++++++++++++----------------- ntfsprogs/ntfswipe.c | 446 +++++++++++----------- 27 files changed, 1268 insertions(+), 1266 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 9b465b44..41aa1ecd 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -248,8 +248,8 @@ typedef enum { typedef enum { MFT_RECORD_IN_USE = const_cpu_to_le16(0x0001), MFT_RECORD_IS_DIRECTORY = const_cpu_to_le16(0x0002), - MFT_RECORD_IS_4 = const_cpu_to_le16(0x0004), - MFT_RECORD_IS_8 = const_cpu_to_le16(0x0008), + MFT_RECORD_IS_4 = const_cpu_to_le16(0x0004), + MFT_RECORD_IS_8 = const_cpu_to_le16(0x0008), MFT_REC_SPACE_FILLER = 0xffff /* Just to make flags 16-bit. */ } __attribute__((__packed__)) MFT_RECORD_FLAGS; @@ -1833,18 +1833,18 @@ typedef struct { u64 offset_in_sds; /* Offset of the descriptor in SDS data stream */ u32 size_in_sds; /* Size of the descriptor in SDS data stream */ u64 reserved_II; /* Padding - always unicode "II" */ -} __attribute__ ((__packed__)) SDH_INDEX_DATA; +} __attribute__((__packed__)) SDH_INDEX_DATA; typedef struct { u32 hash; /* Hash of the security descriptor. */ u32 security_id; /* The security_id assigned to the descriptor. */ u64 offset_in_sds; /* Offset of the descriptor in SDS data stream */ u32 size_in_sds; /* Size of the descriptor in SDS data stream */ -} __attribute__ ((__packed__)) SII_INDEX_DATA; +} __attribute__((__packed__)) SII_INDEX_DATA; typedef struct { u64 owner_id; -} __attribute__ ((__packed__)) QUOTA_O_INDEX_DATA; +} __attribute__((__packed__)) QUOTA_O_INDEX_DATA; /* * The $SDS data stream contains the security descriptors, aligned on 16-byte @@ -2461,7 +2461,7 @@ typedef struct { 2 = Unexpected type. 3 = Certificate thumbprint. other = Unknown type. */ - union { + union { /* CryptoAPI container. */ struct { /* 12*/ u32 container_name_offset; /* Offset in bytes to diff --git a/libntfs/attrib.c b/libntfs/attrib.c index e1ecf730..6f80783f 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1842,7 +1842,7 @@ find_attr_list_attr: /* Got it. Done. */ if (!rc) - return 0; + return 0; /* Error! If other than not found return it. */ if (errno != ENOENT) diff --git a/libntfs/dir.c b/libntfs/dir.c index 410028cf..27be8804 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -52,18 +52,18 @@ * and "$Q" as global constants. */ ntfschar NTFS_INDEX_I30[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('I'), - const_cpu_to_le16('3'), const_cpu_to_le16('0'), - const_cpu_to_le16('\0') }; + const_cpu_to_le16('3'), const_cpu_to_le16('0'), + const_cpu_to_le16('\0') }; ntfschar NTFS_INDEX_SII[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'), - const_cpu_to_le16('I'), const_cpu_to_le16('I'), - const_cpu_to_le16('\0') }; + const_cpu_to_le16('I'), const_cpu_to_le16('I'), + const_cpu_to_le16('\0') }; ntfschar NTFS_INDEX_SDH[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('S'), - const_cpu_to_le16('D'), const_cpu_to_le16('H'), - const_cpu_to_le16('\0') }; + const_cpu_to_le16('D'), const_cpu_to_le16('H'), + const_cpu_to_le16('\0') }; ntfschar NTFS_INDEX_O[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('O'), - const_cpu_to_le16('\0') }; + const_cpu_to_le16('\0') }; ntfschar NTFS_INDEX_Q[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('Q'), - const_cpu_to_le16('\0') }; + const_cpu_to_le16('\0') }; /** * ntfs_inode_lookup_by_name - find an inode in a directory given its name diff --git a/libntfs/logfile.c b/libntfs/logfile.c index 7ed40304..d699c39c 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -413,7 +413,7 @@ static int ntfs_check_and_load_restart_page(ntfs_attr *log_na, "detected in $LogFile restart page."); err = EINVAL; goto err_out; - } + } } /* * If the restart page is modified by chkdsk or there are no active diff --git a/libntfs/security.c b/libntfs/security.c index e30e6662..2c0598f2 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -98,7 +98,7 @@ char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str) guid->data4[2], guid->data4[3], guid->data4[4], guid->data4[5], guid->data4[6], guid->data4[7]); if (res == 36) - return _guid_str; + return _guid_str; if (!guid_str) free(_guid_str); errno = EINVAL; diff --git a/libntfs/tree.c b/libntfs/tree.c index 0945d0b8..e111407a 100644 --- a/libntfs/tree.c +++ b/libntfs/tree.c @@ -2046,7 +2046,7 @@ ascend: //ntfs_log_debug("\tnode has %d children\n", suc->child_count); // initialise new node - // XXX ntfs_dt_initialise (new, vcn); + // XXX ntfs_dt_initialise(new, vcn); goto done; diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c index 3f77ea27..5abdd12e 100644 --- a/ntfsprogs/cluster.c +++ b/ntfsprogs/cluster.c @@ -46,7 +46,7 @@ /** * cluster_find */ -int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void *data) +int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void *data) { u64 i; int j; @@ -62,7 +62,7 @@ int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void // Quick check that at least one cluster is in use for (i = c_begin; (LCN)i < c_end; i++) { - if (utils_cluster_in_use (vol, i) == 1) { + if (utils_cluster_in_use(vol, i) == 1) { in_use = 1; break; } @@ -70,44 +70,44 @@ int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void if (!in_use) { if (c_begin == c_end) - Vprintf ("cluster isn't in use\n"); + Vprintf("cluster isn't in use\n"); else - Vprintf ("clusters aren't in use\n"); + Vprintf("clusters aren't in use\n"); return 0; } - m_ctx = mft_get_search_ctx (vol); + m_ctx = mft_get_search_ctx(vol); m_ctx->flags_search = FEMR_IN_USE | FEMR_BASE_RECORD; - while (mft_next_record (m_ctx) == 0) { - //Qprintf (RED "Inode: %llu\n" NORM, (unsigned long long) - Qprintf ("Inode: %llu\n", (unsigned long long) + while (mft_next_record(m_ctx) == 0) { + //Qprintf(RED "Inode: %llu\n" NORM, (unsigned long long) + Qprintf("Inode: %llu\n", (unsigned long long) m_ctx->inode->mft_no); if (!(m_ctx->flags_match & FEMR_BASE_RECORD)) continue; - Vprintf ("Inode: %llu\n", (unsigned long long) + Vprintf("Inode: %llu\n", (unsigned long long) m_ctx->inode->mft_no); - a_ctx = ntfs_attr_get_search_ctx (m_ctx->inode, NULL); + a_ctx = ntfs_attr_get_search_ctx(m_ctx->inode, NULL); - while ((rec = find_attribute (AT_UNUSED, a_ctx))) { + while ((rec = find_attribute(AT_UNUSED, a_ctx))) { if (!rec->non_resident) { - Vprintf ("0x%02x skipped - attr is resident\n", a_ctx->attr->type); + Vprintf("0x%02x skipped - attr is resident\n", a_ctx->attr->type); continue; } - runs = ntfs_mapping_pairs_decompress (vol, a_ctx->attr, NULL); + runs = ntfs_mapping_pairs_decompress(vol, a_ctx->attr, NULL); if (!runs) { - Eprintf ("Couldn't read the data runs.\n"); + Eprintf("Couldn't read the data runs.\n"); goto done; } - Vprintf ("\t[0x%02X]\n", a_ctx->attr->type); + Vprintf("\t[0x%02X]\n", a_ctx->attr->type); - Vprintf ("\t\tVCN\tLCN\tLength\n"); + Vprintf("\t\tVCN\tLCN\tLength\n"); for (j = 0; runs[j].length > 0; j++) { LCN a_begin = runs[j].lcn; LCN a_end = a_begin + runs[j].length - 1; @@ -115,7 +115,7 @@ int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void if (a_begin < 0) continue; // sparse, discontiguous, etc - Vprintf ("\t\t%lld\t%lld-%lld (%lld)\n", + Vprintf("\t\t%lld\t%lld-%lld (%lld)\n", (long long)runs[j].vcn, (long long)runs[j].lcn, (long long)(runs[j].lcn + @@ -131,14 +131,14 @@ int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void } } - ntfs_attr_put_search_ctx (a_ctx); + ntfs_attr_put_search_ctx(a_ctx); a_ctx = NULL; } result = 0; done: - ntfs_attr_put_search_ctx (a_ctx); - mft_put_search_ctx (m_ctx); + ntfs_attr_put_search_ctx(a_ctx); + mft_put_search_ctx(m_ctx); return result; } diff --git a/ntfsprogs/cluster.h b/ntfsprogs/cluster.h index f3fdebe7..4bc18276 100644 --- a/ntfsprogs/cluster.h +++ b/ntfsprogs/cluster.h @@ -31,9 +31,9 @@ typedef struct { int x; } ntfs_cluster; -typedef int (cluster_cb) (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void *data); +typedef int (cluster_cb)(ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void *data); -int cluster_find (ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void *data); +int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void *data); #endif /* _CLUSTER_H_ */ diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 7880c208..0eee3594 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -305,7 +305,7 @@ static void license(void) /** * usage - print a list of the parameters to the program */ -__attribute__ ((noreturn)) +__attribute__((noreturn)) static void usage(void) { copyright(); @@ -1486,7 +1486,7 @@ static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, */ static int mkntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name, const u32 name_len, const IGNORE_CASE_BOOL ic, - const VCN lowest_vcn __attribute__ ((unused)), const u8 *val, + const VCN lowest_vcn __attribute__((unused)), const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) { ntfs_inode *base_ni; @@ -3064,7 +3064,7 @@ static int initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) { err = insert_index_entry_in_res_dir_index(idx_entry_o, o_size, m, NTFS_INDEX_O, 2, AT_UNUSED); - if (idx_entry_o) free (idx_entry_o); + if (idx_entry_o) free(idx_entry_o); return err; } diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 2a939279..152959cb 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -50,10 +50,10 @@ static const char *EXEC_NAME = "ntfscat"; static struct options opts; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) -static GEN_PRINTF (Printf, stderr, NULL, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stderr, &opts.verbose, TRUE) +GEN_PRINTF(Qprintf, stderr, &opts.quiet, FALSE) +static GEN_PRINTF(Printf, stderr, NULL, FALSE) /** * version - Print version information about the program @@ -62,7 +62,7 @@ static GEN_PRINTF (Printf, stderr, NULL, FALSE) * * Return: none */ -static void version (void) +static void version(void) { Printf("\n%s v%s (libntfs %s) - Concatenate files and print on the " "standard output.\n\n", EXEC_NAME, VERSION, @@ -78,17 +78,17 @@ static void version (void) * * Return: none */ -static void usage (void) +static void usage(void) { Printf ("\nUsage: %s [options] device [file]\n\n" - " -a, --attribute type Display this attribute type\n" - " -n, --attribute-name name Display this attribute name\n" - " -i, --inode num Display this inode\n\n" - " -f --force Use less caution\n" - " -h --help Print this help\n" - " -q --quiet Less output\n" - " -V --version Version information\n" - " -v --verbose More output\n\n", + " -a, --attribute type Display this attribute type\n" + " -n, --attribute-name name Display this attribute name\n" + " -i, --inode num Display this inode\n\n" + " -f --force Use less caution\n" + " -h --help Print this help\n" + " -q --quiet Less output\n" + " -V --version Version information\n" + " -v --verbose More output\n\n", //" -r --raw Display the compressed or encrypted file", EXEC_NAME); Printf ("%s%s\n", ntfs_bugs, ntfs_home); @@ -106,7 +106,7 @@ static void usage (void) * Return: 1 Success, a valid attribute name or number * 0 Error, not an attribute name or number */ -static int parse_attribute (const char *value, ATTR_TYPES *attr) +static int parse_attribute(const char *value, ATTR_TYPES *attr) { static const char *attr_name[] = { "$STANDARD_INFORMATION", @@ -132,14 +132,14 @@ static int parse_attribute (const char *value, ATTR_TYPES *attr) long num; for (i = 0; attr_name[i]; i++) { - if ((strcmp (value, attr_name[i]) == 0) || - (strcmp (value, attr_name[i]+1) == 0)) { + if ((strcmp(value, attr_name[i]) == 0) || + (strcmp(value, attr_name[i]+1) == 0)) { *attr = (ATTR_TYPES) ((i+1)*16); return 1; } } - num = strtol (value, NULL, 0); + num = strtol(value, NULL, 0); if ((num > 0) && (num < 257)) { *attr = (ATTR_TYPES) num; return 1; @@ -157,7 +157,7 @@ static int parse_attribute (const char *value, ATTR_TYPES *attr) * Return: 1 Success * 0 Error, one or more problems */ -static int parse_options (int argc, char **argv) +static int parse_options(int argc, char **argv) { static const char *sopt = "-a:fh?i:n:qVv"; static const struct option lopt[] = { @@ -185,7 +185,7 @@ static int parse_options (int argc, char **argv) opts.attr_name = NULL; opts.attr_name_len = 0; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!opts.device) { @@ -200,7 +200,7 @@ static int parse_options (int argc, char **argv) case 'a': if (opts.attr != (ATTR_TYPES)-1) { Eprintf("You must specify exactly one attribute.\n"); - } else if (parse_attribute (optarg, &attr) > 0) { + } else if (parse_attribute(optarg, &attr) > 0) { opts.attr = attr; break; } else { @@ -226,7 +226,7 @@ static int parse_options (int argc, char **argv) break; case 'n': - opts.attr_name_len = ntfs_mbstoucs(optarg, + opts.attr_name_len = ntfs_mbstoucs(optarg, &opts.attr_name, 0); if (opts.attr_name_len < 0) { Eprintf("Invalid attribute name '%s': %s\n", @@ -244,7 +244,7 @@ static int parse_options (int argc, char **argv) opts.verbose++; break; default: - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + Eprintf("Unknown option '%s'.\n", argv[optind-1]); err++; break; } @@ -254,16 +254,16 @@ static int parse_options (int argc, char **argv) opts.quiet = 0; } else { if (opts.device == NULL) { - Eprintf ("You must specify a device.\n"); + Eprintf("You must specify a device.\n"); err++; } else if (opts.file == NULL && opts.inode == -1) { - Eprintf ("You must specify a file or inode " + Eprintf("You must specify a file or inode " "with the -i option.\n"); err++; } else if (opts.file != NULL && opts.inode != -1) { - Eprintf ("You can't specify both a file and inode.\n"); + Eprintf("You can't specify both a file and inode.\n"); err++; } @@ -291,12 +291,12 @@ static int parse_options (int argc, char **argv) * Return: n Success, the INDX blocks are n bytes in size * 0 Error, not a directory */ -static int index_get_size (ntfs_inode *inode) +static int index_get_size(ntfs_inode *inode) { ATTR_RECORD *attr90; INDEX_ROOT *iroot; - attr90 = find_first_attribute (AT_INDEX_ROOT, inode->mrec); + attr90 = find_first_attribute(AT_INDEX_ROOT, inode->mrec); if (!attr90) return 0; // not a directory @@ -308,7 +308,7 @@ static int index_get_size (ntfs_inode *inode) /** * cat */ -static int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, +static int cat(ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int namelen) { const int bufsize = 4096; @@ -318,21 +318,21 @@ static int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, s64 offset; u32 block_size; - buffer = malloc (bufsize); + buffer = malloc(bufsize); if (!buffer) return 1; - attr = ntfs_attr_open (inode, type, name, namelen); + attr = ntfs_attr_open(inode, type, name, namelen); if (!attr) { - Eprintf ("Cannot find attribute type 0x%lx.\n", (long) type); - free (buffer); + Eprintf("Cannot find attribute type 0x%lx.\n", (long) type); + free(buffer); return 1; } if ((inode->mft_no < 2) && (attr->type == AT_DATA)) block_size = vol->mft_record_size; else if (attr->type == AT_INDEX_ALLOCATION) - block_size = index_get_size (inode); + block_size = index_get_size(inode); else block_size = 0; @@ -343,26 +343,26 @@ static int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, bytes_read = ntfs_attr_mst_pread(attr, offset, 1, block_size, buffer); bytes_read *= block_size; } else { - bytes_read = ntfs_attr_pread (attr, offset, bufsize, buffer); + bytes_read = ntfs_attr_pread(attr, offset, bufsize, buffer); } - //fprintf (stderr, "read %lld bytes\n", bytes_read); + //fprintf(stderr, "read %lld bytes\n", bytes_read); if (bytes_read == -1) { - perror ("ERROR: Couldn't read file"); + perror("ERROR: Couldn't read file"); break; } if (!bytes_read) break; - written = fwrite (buffer, 1, bytes_read, stdout); + written = fwrite(buffer, 1, bytes_read, stdout); if (written != bytes_read) { - perror ("ERROR: Couldn't output all data!"); + perror("ERROR: Couldn't output all data!"); break; } offset += bytes_read; } - ntfs_attr_close (attr); - free (buffer); + ntfs_attr_close(attr); + free(buffer); return 0; } @@ -374,28 +374,28 @@ static int cat (ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, * Return: 0 Success, the program worked * 1 Error, something went wrong */ -int main (int argc, char *argv[]) +int main(int argc, char *argv[]) { ntfs_volume *vol; ntfs_inode *inode; ATTR_TYPES attr; int result = 1; - if (!parse_options (argc, argv)) + if (!parse_options(argc, argv)) return 1; utils_set_locale(); - vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); + vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); if (!vol) { perror("ERROR: couldn't mount volume"); return 1; } if (opts.inode != -1) - inode = ntfs_inode_open (vol, opts.inode); + inode = ntfs_inode_open(vol, opts.inode); else - inode = ntfs_pathname_to_inode (vol, NULL, opts.file); + inode = ntfs_pathname_to_inode(vol, NULL, opts.file); if (!inode) { perror("ERROR: Couldn't open inode"); @@ -408,8 +408,8 @@ int main (int argc, char *argv[]) result = cat(vol, inode, attr, opts.attr_name, opts.attr_name_len); - ntfs_inode_close (inode); - ntfs_umount (vol, FALSE); + ntfs_inode_close(inode); + ntfs_umount(vol, FALSE); return result; } diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 697a3417..3584106e 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -154,7 +154,7 @@ struct { s64 device_size; s64 nr_clusters; s64 inuse; -} __attribute__ ((__packed__)) image_hdr; +} __attribute__((__packed__)) image_hdr; #define NTFS_MBYTE (1000 * 1000) @@ -499,7 +499,7 @@ static void rescue_sector(void *fd, off_t pos, void *buff) if (read_all(fd, buff, NTFS_SECTOR_SIZE) == -1) { Printf("WARNING: Can't read sector at %llu, lost data.\n", - (unsigned long long)pos); + (unsigned long long)pos); memset(buff, '?', NTFS_SECTOR_SIZE); memmove(buff, badsector_magic, sizeof(badsector_magic)); } @@ -991,9 +991,9 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) continue; } - deleted_inode = !(ni->mrec->flags & MFT_RECORD_IN_USE); + deleted_inode = !(ni->mrec->flags & MFT_RECORD_IN_USE); - if (deleted_inode) { + if (deleted_inode) { ni->mft_no = MREF(mref); if (wipe) { @@ -1007,7 +1007,7 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) free(ni->mrec); free(ni); - if (deleted_inode) + if (deleted_inode) continue; if ((ni = ntfs_inode_open(volume, mref)) == NULL) { @@ -1468,10 +1468,10 @@ int main(int argc, char **argv) ntfs_size += 512; /* add backup boot sector */ if (opt.std_out) { - if ((fd_out = fileno(stdout)) == -1) - perr_exit("fileno for stdout failed"); + if ((fd_out = fileno(stdout)) == -1) + perr_exit("fileno for stdout failed"); } else { - /* device_size_get() might need to read() */ + /* device_size_get() might need to read() */ int flags = O_RDWR; if (!opt.blkdev_out) { diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 2f0a0bbe..95301172 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -53,9 +53,9 @@ static const char *EXEC_NAME = "ntfscluster"; static struct options opts; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * version - Print version information about the program @@ -64,13 +64,13 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -static void version (void) +static void version(void) { printf("\n%s v%s (libntfs %s) - Find the owner of any given sector or " "cluster.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf ("Copyright (c) 2002-2003 Richard Russon\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + printf("Copyright (c) 2002-2003 Richard Russon\n"); + printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -80,9 +80,9 @@ static void version (void) * * Return: none */ -static void usage (void) +static void usage(void) { - printf ("\nUsage: %s [options] device\n" + printf("\nUsage: %s [options] device\n" " -i --info Print information about the volume (default)\n" "\n" " -c range --cluster range Look for objects in this range of clusters\n" @@ -97,7 +97,7 @@ static void usage (void) " -V --version Version information\n" " -h --help Print this help\n\n", EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); + printf("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -109,7 +109,7 @@ static void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -static int parse_options (int argc, char **argv) +static int parse_options(int argc, char **argv) { static const char *sopt = "-c:F:fh?I:ilqs:vV"; static const struct option lopt[] = { @@ -139,7 +139,7 @@ static int parse_options (int argc, char **argv) opts.range_begin = -1; opts.range_end = -1; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!opts.device) { @@ -152,7 +152,7 @@ static int parse_options (int argc, char **argv) case 'c': if ((opts.action == act_none) && - (utils_parse_range (optarg, &opts.range_begin, &opts.range_end, FALSE))) + (utils_parse_range(optarg, &opts.range_begin, &opts.range_end, FALSE))) opts.action = act_cluster; else opts.action = act_error; @@ -175,7 +175,7 @@ static int parse_options (int argc, char **argv) case 'I': if (opts.action == act_none) { opts.action = act_inode; - opts.inode = strtol (optarg, &end, 0); + opts.inode = strtol(optarg, &end, 0); if (end && *end) err++; } else { @@ -199,7 +199,7 @@ static int parse_options (int argc, char **argv) break; case 's': if ((opts.action == act_none) && - (utils_parse_range (optarg, &opts.range_begin, &opts.range_end, FALSE))) + (utils_parse_range(optarg, &opts.range_begin, &opts.range_end, FALSE))) opts.action = act_sector; else opts.action = act_error; @@ -212,9 +212,9 @@ static int parse_options (int argc, char **argv) break; default: if ((optopt == 'c') || (optopt == 's')) - Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); + Eprintf("Option '%s' requires an argument.\n", argv[optind-1]); else - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + Eprintf("Unknown option '%s'.\n", argv[optind-1]); err++; break; } @@ -230,20 +230,20 @@ static int parse_options (int argc, char **argv) if (opts.device == NULL) { if (argc > 1) - Eprintf ("You must specify exactly one device.\n"); + Eprintf("You must specify exactly one device.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + Eprintf("You may not use --quiet and --verbose at the same time.\n"); err++; } if (opts.action == act_error) { - Eprintf ("You may only specify one action: --info, --cluster, --sector or --last.\n"); + Eprintf("You may only specify one action: --info, --cluster, --sector or --last.\n"); err++; } else if (opts.range_begin > opts.range_end) { - Eprintf ("The range must be in ascending order.\n"); + Eprintf("The range must be in ascending order.\n"); err++; } } @@ -260,7 +260,7 @@ static int parse_options (int argc, char **argv) /** * info */ -static int info (ntfs_volume *vol) +static int info(ntfs_volume *vol) { u64 a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u; int cb, sb, cps; @@ -273,23 +273,23 @@ static int info (ntfs_volume *vol) int z; int inuse = 0; - m_ctx = mft_get_search_ctx (vol); + m_ctx = mft_get_search_ctx(vol); m_ctx->flags_search = FEMR_IN_USE | FEMR_METADATA | FEMR_BASE_RECORD | FEMR_NOT_BASE_RECORD; - while (mft_next_record (m_ctx) == 0) { + while (mft_next_record(m_ctx) == 0) { if (!(m_ctx->flags_match & FEMR_IN_USE)) continue; inuse++; - a_ctx = ntfs_attr_get_search_ctx (m_ctx->inode, NULL); + a_ctx = ntfs_attr_get_search_ctx(m_ctx->inode, NULL); - while ((rec = find_attribute (AT_UNUSED, a_ctx))) { + while ((rec = find_attribute(AT_UNUSED, a_ctx))) { if (!rec->non_resident) continue; - rl = ntfs_mapping_pairs_decompress (vol, rec, NULL); + rl = ntfs_mapping_pairs_decompress(vol, rec, NULL); for (z = 0; rl[z].length > 0; z++) { @@ -302,12 +302,12 @@ static int info (ntfs_volume *vol) } - free (rl); + free(rl); } - ntfs_attr_put_search_ctx (a_ctx); + ntfs_attr_put_search_ctx(a_ctx); } - mft_put_search_ctx (m_ctx); + mft_put_search_ctx(m_ctx); cb = vol->cluster_size_bits; sb = vol->sector_size_bits; @@ -340,27 +340,27 @@ static int info (ntfs_volume *vol) t = mc >> cb; u = mc * 100 / b / e; - printf ("bytes per sector : %llu\n", (unsigned long long)a); - printf ("bytes per cluster : %llu\n", (unsigned long long)b); - printf ("sectors per cluster : %llu\n", (unsigned long long)c); - printf ("bytes per volume : %llu\n", (unsigned long long)d); - printf ("sectors per volume : %llu\n", (unsigned long long)e); - printf ("clusters per volume : %llu\n", (unsigned long long)f); - printf ("initialized mft records : %llu\n", (unsigned long long)g); - printf ("mft records in use : %llu\n", (unsigned long long)h); - printf ("mft records percentage : %llu\n", (unsigned long long)i); - printf ("bytes of free space : %llu\n", (unsigned long long)j); - printf ("sectors of free space : %llu\n", (unsigned long long)k); - printf ("clusters of free space : %llu\n", (unsigned long long)l); - printf ("percentage free space : %llu\n", (unsigned long long)m); - printf ("bytes of user data : %llu\n", (unsigned long long)n); - printf ("sectors of user data : %llu\n", (unsigned long long)o); - printf ("clusters of user data : %llu\n", (unsigned long long)p); - printf ("percentage user data : %llu\n", (unsigned long long)q); - printf ("bytes of metadata : %llu\n", (unsigned long long)r); - printf ("sectors of metadata : %llu\n", (unsigned long long)s); - printf ("clusters of metadata : %llu\n", (unsigned long long)t); - printf ("percentage metadata : %llu\n", (unsigned long long)u); + printf("bytes per sector : %llu\n", (unsigned long long)a); + printf("bytes per cluster : %llu\n", (unsigned long long)b); + printf("sectors per cluster : %llu\n", (unsigned long long)c); + printf("bytes per volume : %llu\n", (unsigned long long)d); + printf("sectors per volume : %llu\n", (unsigned long long)e); + printf("clusters per volume : %llu\n", (unsigned long long)f); + printf("initialized mft records : %llu\n", (unsigned long long)g); + printf("mft records in use : %llu\n", (unsigned long long)h); + printf("mft records percentage : %llu\n", (unsigned long long)i); + printf("bytes of free space : %llu\n", (unsigned long long)j); + printf("sectors of free space : %llu\n", (unsigned long long)k); + printf("clusters of free space : %llu\n", (unsigned long long)l); + printf("percentage free space : %llu\n", (unsigned long long)m); + printf("bytes of user data : %llu\n", (unsigned long long)n); + printf("sectors of user data : %llu\n", (unsigned long long)o); + printf("clusters of user data : %llu\n", (unsigned long long)p); + printf("percentage user data : %llu\n", (unsigned long long)q); + printf("bytes of metadata : %llu\n", (unsigned long long)r); + printf("sectors of metadata : %llu\n", (unsigned long long)s); + printf("clusters of metadata : %llu\n", (unsigned long long)t); + printf("percentage metadata : %llu\n", (unsigned long long)u); return 0; } @@ -368,7 +368,7 @@ static int info (ntfs_volume *vol) /** * dump_file */ -static int dump_file (ntfs_volume *vol, ntfs_inode *ino) +static int dump_file(ntfs_volume *vol, ntfs_inode *ino) { char buffer[1024]; ntfs_attr_search_ctx *ctx; @@ -376,41 +376,41 @@ static int dump_file (ntfs_volume *vol, ntfs_inode *ino) int i; runlist *runs; - utils_inode_get_name (ino, buffer, sizeof (buffer)); + utils_inode_get_name(ino, buffer, sizeof(buffer)); - printf ("Dump: %s\n", buffer); + printf("Dump: %s\n", buffer); - ctx = ntfs_attr_get_search_ctx (ino, NULL); + ctx = ntfs_attr_get_search_ctx(ino, NULL); - while ((rec = find_attribute (AT_UNUSED, ctx))) { - printf (" 0x%02x - ", rec->type); + while ((rec = find_attribute(AT_UNUSED, ctx))) { + printf(" 0x%02x - ", rec->type); if (rec->non_resident) { - printf ("non-resident\n"); - runs = ntfs_mapping_pairs_decompress (vol, rec, NULL); + printf("non-resident\n"); + runs = ntfs_mapping_pairs_decompress(vol, rec, NULL); if (runs) { - printf (" VCN LCN Length\n"); + printf(" VCN LCN Length\n"); for (i = 0; runs[i].length > 0; i++) { - printf (" %8lld %8lld %8lld\n", + printf(" %8lld %8lld %8lld\n", (long long)runs[i].vcn, (long long)runs[i].lcn, (long long) runs[i].length); } - free (runs); + free(runs); } } else { - printf ("resident\n"); + printf("resident\n"); } } - ntfs_attr_put_search_ctx (ctx); + ntfs_attr_put_search_ctx(ctx); return 0; } /** * print_match */ -static int print_match (ntfs_inode *ino, ATTR_RECORD *attr, +static int print_match(ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void *data __attribute__((unused))) { char *buffer; @@ -418,26 +418,26 @@ static int print_match (ntfs_inode *ino, ATTR_RECORD *attr, if (!ino || !attr || !run) return 1; - buffer = malloc (MAX_PATH); + buffer = malloc(MAX_PATH); if (!buffer) { - Eprintf ("!buffer\n"); + Eprintf("!buffer\n"); return 1; } - utils_inode_get_name (ino, buffer, MAX_PATH); - printf ("Inode %llu %s", (unsigned long long)ino->mft_no, buffer); + utils_inode_get_name(ino, buffer, MAX_PATH); + printf("Inode %llu %s", (unsigned long long)ino->mft_no, buffer); - utils_attr_get_name (ino->vol, attr, buffer, MAX_PATH); - printf ("/%s\n", buffer); + utils_attr_get_name(ino->vol, attr, buffer, MAX_PATH); + printf("/%s\n", buffer); - free (buffer); + free(buffer); return 0; } /** * find_last */ -static int find_last (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, +static int find_last(ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, void *data) { struct match *m; @@ -463,68 +463,68 @@ static int find_last (ntfs_inode *ino, ATTR_RECORD *attr, runlist_element *run, * Return: 0 Success, the program worked * 1 Error, something went wrong */ -int main (int argc, char *argv[]) +int main(int argc, char *argv[]) { ntfs_volume *vol; ntfs_inode *ino = NULL; struct match m; int result = 1; - if (!parse_options (argc, argv)) + if (!parse_options(argc, argv)) return 1; utils_set_locale(); - vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); + vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); if (!vol) return 1; switch (opts.action) { case act_sector: if (opts.range_begin == opts.range_end) - Qprintf ("Searching for sector %llu\n", + Qprintf("Searching for sector %llu\n", (unsigned long long)opts.range_begin); else - Qprintf ("Searching for sector range %llu-%llu\n", (unsigned long long)opts.range_begin, (unsigned long long)opts.range_end); + Qprintf("Searching for sector range %llu-%llu\n", (unsigned long long)opts.range_begin, (unsigned long long)opts.range_end); /* Convert to clusters */ opts.range_begin >>= (vol->cluster_size_bits - vol->sector_size_bits); opts.range_end >>= (vol->cluster_size_bits - vol->sector_size_bits); - result = cluster_find (vol, opts.range_begin, opts.range_end, (cluster_cb*)&print_match, NULL); + result = cluster_find(vol, opts.range_begin, opts.range_end, (cluster_cb*)&print_match, NULL); break; case act_cluster: if (opts.range_begin == opts.range_end) - Qprintf ("Searching for cluster %llu\n", + Qprintf("Searching for cluster %llu\n", (unsigned long long)opts.range_begin); else - Qprintf ("Searching for cluster range %llu-%llu\n", (unsigned long long)opts.range_begin, (unsigned long long)opts.range_end); - result = cluster_find (vol, opts.range_begin, opts.range_end, (cluster_cb*)&print_match, NULL); + Qprintf("Searching for cluster range %llu-%llu\n", (unsigned long long)opts.range_begin, (unsigned long long)opts.range_end); + result = cluster_find(vol, opts.range_begin, opts.range_end, (cluster_cb*)&print_match, NULL); break; case act_file: ino = ntfs_pathname_to_inode(vol, NULL, opts.filename); if (ino) - result = dump_file (vol, ino); + result = dump_file(vol, ino); break; case act_inode: - ino = ntfs_inode_open (vol, opts.inode); + ino = ntfs_inode_open(vol, opts.inode); if (ino) { - result = dump_file (vol, ino); - ntfs_inode_close (ino); + result = dump_file(vol, ino); + ntfs_inode_close(ino); } else { - Eprintf ("Cannot open inode %llu\n", + Eprintf("Cannot open inode %llu\n", (unsigned long long)opts.inode); } break; case act_last: - memset (&m, 0, sizeof (m)); + memset(&m, 0, sizeof(m)); m.lcn = -1; - result = cluster_find (vol, 0, LONG_MAX, (cluster_cb*)&find_last, &m); + result = cluster_find(vol, 0, LONG_MAX, (cluster_cb*)&find_last, &m); if (m.lcn >= 0) { - ino = ntfs_inode_open (vol, m.inum); + ino = ntfs_inode_open(vol, m.inum); if (ino) { - result = dump_file (vol, ino); - ntfs_inode_close (ino); + result = dump_file(vol, ino); + ntfs_inode_close(ino); } else { - Eprintf ("Cannot open inode %llu\n", + Eprintf("Cannot open inode %llu\n", (unsigned long long) opts.inode); } @@ -535,11 +535,11 @@ int main (int argc, char *argv[]) break; case act_info: default: - result = info (vol); + result = info(vol); break; } - ntfs_umount (vol, FALSE); + ntfs_umount(vol, FALSE); return result; } diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index 687e25c3..f123ddd7 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -153,7 +153,7 @@ __attribute__((noreturn)) static void usage(void) { - printf ("\nUsage: %s [OPTIONS] DEVICE1 DEVICE2\n" + printf("\nUsage: %s [OPTIONS] DEVICE1 DEVICE2\n" " Compare two NTFS volumes and tell the differences.\n" "\n" " -P, --no-progress-bar Don't show progress bar\n" @@ -163,7 +163,7 @@ static void usage(void) " -d, --debug Show debug information\n" #endif "\n", EXEC_NAME); - printf ("%s%s", ntfs_bugs, ntfs_home); + printf("%s%s", ntfs_bugs, ntfs_home); exit(1); } @@ -186,7 +186,7 @@ static void parse_options(int argc, char **argv) memset(&opt, 0, sizeof(opt)); opt.show_progress = 1; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!opt.vol1) { diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 988e2777..740f034a 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -69,10 +69,10 @@ static const char *EXEC_NAME = "ntfscp"; static struct options opts; volatile sig_atomic_t caught_terminate = 0; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stderr, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stderr, &opts.quiet, FALSE) -static GEN_PRINTF (Printf, stderr, NULL, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stderr, &opts.verbose, TRUE) +GEN_PRINTF(Qprintf, stderr, &opts.quiet, FALSE) +static GEN_PRINTF(Printf, stderr, NULL, FALSE) /** * version - Print version information about the program @@ -81,12 +81,12 @@ static GEN_PRINTF (Printf, stderr, NULL, FALSE) * * Return: none */ -static void version (void) +static void version(void) { Printf("\n%s v%s (libntfs %s) - Overwrite files on NTFS volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - Printf ("Copyright (c) 2004-2005 Yura Pakhuchiy\n"); - Printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + Printf("Copyright (c) 2004-2005 Yura Pakhuchiy\n"); + Printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -96,9 +96,9 @@ static void version (void) * * Return: none */ -static void usage (void) +static void usage(void) { - Printf ("\nUsage: %s [options] device src_file dest_file\n\n" + Printf("\nUsage: %s [options] device src_file dest_file\n\n" " -a --attribute num Write to this attribute\n" " -i --inode Treat dest_file as inode number\n" " -f --force Use less caution\n" @@ -109,7 +109,7 @@ static void usage (void) " -V --version Version information\n" " -v --verbose More output\n\n", EXEC_NAME); - Printf ("%s%s\n", ntfs_bugs, ntfs_home); + Printf("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -121,7 +121,7 @@ static void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -static int parse_options (int argc, char **argv) +static int parse_options(int argc, char **argv) { static const char *sopt = "-a:ifh?N:nqVv"; static const struct option lopt[] = { @@ -263,7 +263,7 @@ static void signal_handler(int arg __attribute__((unused))) * Return: 0 Success, the program worked * 1 Error, something went wrong */ -int main (int argc, char *argv[]) +int main(int argc, char *argv[]) { FILE *in; ntfs_volume *vol; @@ -308,7 +308,7 @@ int main (int argc, char *argv[]) { struct stat fst; - if (stat (opts.src_file, &fst) == -1) { + if (stat(opts.src_file, &fst) == -1) { perror("ERROR: Couldn't stat source file"); goto umount; } diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index 0ace7ef1..c91edf5c 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -87,7 +87,7 @@ typedef struct { }; } logfile_file; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) /** * logfile_close @@ -120,8 +120,8 @@ static int logfile_close(logfile_file *logfile) * Use when you wish to exit and collate all the cleanups together. * if you don't have some parameter to pass, just pass NULL. */ -__attribute__ ((noreturn)) -__attribute__ ((format(printf, 4, 5))) +__attribute__((noreturn)) +__attribute__((format(printf, 4, 5))) static void device_err_exit(ntfs_volume *vol, ntfs_inode *ni, ntfs_attr *na, const char *fmt, ...) { @@ -147,7 +147,7 @@ static void device_err_exit(ntfs_volume *vol, ntfs_inode *ni, /** * log_err_exit - */ -__attribute__ ((noreturn)) +__attribute__((noreturn)) __attribute__((format(printf, 2, 3))) static void log_err_exit(u8 *buf, const char *fmt, ...) { @@ -167,7 +167,7 @@ static void log_err_exit(u8 *buf, const char *fmt, ...) /** * usage - */ -__attribute__ ((noreturn)) +__attribute__((noreturn)) static void usage(const char *exec_name) { Eprintf("%s v%s (libntfs %s) - Interpret and display information " diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index ccc832f7..1a63bf5f 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -136,7 +136,7 @@ static void parse_options(int argc, char **argv) memset(&opt, 0, sizeof(opt)); - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!opt.volume) @@ -307,7 +307,7 @@ static int fix_mftmirr(ntfs_volume *vol) unsigned char *m, *m2; int i, ret = -1; /* failure */ BOOL done; - + puts("\nProcessing $MFT and $MFTMirr... "); /* Load data from $MFT and $MFTMirr and compare the contents. */ @@ -426,7 +426,7 @@ static int fix_mount(void) int ret = -1; /* failure */ ntfs_volume *vol; struct ntfs_device *dev; - + printf("Attempting to correct errors... "); dev = ntfs_device_alloc(opt.volume, 0, &ntfs_device_default_io_ops, NULL); diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 9a1d2b37..b406fa48 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -92,9 +92,9 @@ static struct options { u8 padding[4]; /* Unused: padding to 64 bit. */ } opts; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * version - Print version information about the program @@ -103,18 +103,18 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -static void version (void) +static void version(void) { - printf ("\n%s v%s (libntfs %s) - Display information about an NTFS " + printf("\n%s v%s (libntfs %s) - Display information about an NTFS " "Volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf ("Copyright (c)\n"); - printf (" 2002-2004 Matthew J. Fanto\n"); - printf (" 2002-2005 Anton Altaparmakov\n"); - printf (" 2002-2003 Richard Russon\n"); - printf (" 2003 Leonard NorrgĂĄrd\n"); - printf (" 2004-2005 Yura Pakhuchiy\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + printf("Copyright (c)\n"); + printf(" 2002-2004 Matthew J. Fanto\n"); + printf(" 2002-2005 Anton Altaparmakov\n"); + printf(" 2002-2003 Richard Russon\n"); + printf(" 2003 Leonard NorrgĂĄrd\n"); + printf(" 2004-2005 Yura Pakhuchiy\n"); + printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -124,9 +124,9 @@ static void version (void) * * Return: none */ -static void usage (void) +static void usage(void) { - printf ("\nUsage: %s [options] -d dev\n" + printf("\nUsage: %s [options] -d dev\n" " -d dev --device dev The ntfs volume to display information about\n" " -i num --inode num Display information about this inode\n" " -F file --file file Display information about this file (absolute path)\n" @@ -139,7 +139,7 @@ static void usage (void) " -V --version Display version information\n" " -h --help Display this help\n\n", EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); + printf("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -151,7 +151,7 @@ static void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -static int parse_options (int argc, char *argv[]) +static int parse_options(int argc, char *argv[]) { static const char *sopt = "-:fhi:F:mqtTvVd:"; static const struct option lopt[] = { @@ -178,7 +178,7 @@ static int parse_options (int argc, char *argv[]) opts.inode = -1; opts.filename = NULL; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { ntfs_log_trace("optind=%d; c='%c' optarg=\"%s\".\n", optind, c, optarg); switch (c) { @@ -190,7 +190,7 @@ static int parse_options (int argc, char *argv[]) break; case 'i': if ((opts.inode != -1) || - (!utils_parse_size (optarg, &opts.inode, FALSE))) { + (!utils_parse_size(optarg, &opts.inode, FALSE))) { err++; } break; @@ -217,7 +217,7 @@ static int parse_options (int argc, char *argv[]) break; case 'T': /* 'T' is deprecated, notify */ - Eprintf ("Option 'T' is deprecated, it was replaced by 't'.\n"); + Eprintf("Option 'T' is deprecated, it was replaced by 't'.\n"); err++; break; case 'v': @@ -257,24 +257,24 @@ static int parse_options (int argc, char *argv[]) } else { if (opts.device == NULL) { if (argc > 1) - Eprintf ("You must specify exactly one device.\n"); + Eprintf("You must specify exactly one device.\n"); err++; } if ((opts.inode == -1) && (opts.filename == NULL) && !opts.mft) { if (argc > 1) - Eprintf ("You must specify an inode to learn about.\n"); + Eprintf("You must specify an inode to learn about.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + Eprintf("You may not use --quiet and --verbose at the same time.\n"); err++; } if ((opts.inode != -1) && (opts.filename != NULL)) { if (argc > 1) - Eprintf ("You may not specify --inode and --file together.\n"); + Eprintf("You may not specify --inode and --file together.\n"); err++; } @@ -1078,13 +1078,13 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol) runlist *rl = ntfs_mapping_pairs_decompress(vol, attr, 0); if (rl) { runlist *rlc = rl; - printf ("\tRunlist:\tVCN\t\tLCN\t\tLength\n"); + printf("\tRunlist:\tVCN\t\tLCN\t\tLength\n"); while (rlc->length) { - printf ("\t\t\t%lld\t\t%lld\t\t%lld\n", + printf("\t\t\t%lld\t\t%lld\t\t%lld\n", rlc->vcn, rlc->lcn, rlc->length); rlc++; } - free (rl); + free(rl); } else { Eprintf("ntfsinfo error: could not decompress runlist\n"); return; @@ -1872,12 +1872,12 @@ int main(int argc, char **argv) { ntfs_volume *vol; - if (!parse_options (argc, argv)) + if (!parse_options(argc, argv)) return 1; utils_set_locale(); - vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); + vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); if (!vol) return 1; @@ -1913,7 +1913,7 @@ int main(int argc, char **argv) } } - ntfs_umount (vol, FALSE); + ntfs_umount(vol, FALSE); return 0; } diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 2de0c033..8067605d 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -60,9 +60,9 @@ static struct options { int noaction; /* Do not write to disk */ } opts; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * version - Print version information about the program @@ -71,16 +71,16 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -static void version (void) +static void version(void) { - printf ("\n%s v%s (libntfs %s) - Display, or set, the label for an " + printf("\n%s v%s (libntfs %s) - Display, or set, the label for an " "NTFS Volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf ("Copyright (c)\n"); - printf (" 2002 Matthew J. Fanto\n"); - printf (" 2002-2005 Anton Altaparmakov\n"); - printf (" 2002-2003 Richard Russon\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + printf("Copyright (c)\n"); + printf(" 2002 Matthew J. Fanto\n"); + printf(" 2002-2005 Anton Altaparmakov\n"); + printf(" 2002-2003 Richard Russon\n"); + printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -90,9 +90,9 @@ static void version (void) * * Return: none */ -static void usage (void) +static void usage(void) { - printf ("\nUsage: %s [options] device [label]\n" + printf("\nUsage: %s [options] device [label]\n" " -n --no-action Do not write to disk\n" " -f --force Use less caution\n" " -q --quiet Less output\n" @@ -100,7 +100,7 @@ static void usage (void) " -V --version Display version information\n" " -h --help Display this help\n\n", EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); + printf("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -112,7 +112,7 @@ static void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -static int parse_options (int argc, char *argv[]) +static int parse_options(int argc, char *argv[]) { static const char *sopt = "-fh?nqvV"; static const struct option lopt[] = { @@ -132,7 +132,7 @@ static int parse_options (int argc, char *argv[]) opterr = 0; /* We'll handle the errors, thank you. */ - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { case 1: /* A non-option argument */ if (!err && !opts.device) @@ -162,7 +162,7 @@ static int parse_options (int argc, char *argv[]) ver++; break; default: - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + Eprintf("Unknown option '%s'.\n", argv[optind-1]); err++; break; } @@ -173,12 +173,12 @@ static int parse_options (int argc, char *argv[]) } else { if (opts.device == NULL) { if (argc > 1) - Eprintf ("You must specify a device.\n"); + Eprintf("You must specify a device.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf ("You may not use --quiet and --verbose at " + Eprintf("You may not use --quiet and --verbose at " "the same time.\n"); err++; } @@ -201,13 +201,13 @@ static int parse_options (int argc, char *argv[]) * * Print the label of the device @dev to stdout. */ -static int print_label (ntfs_volume *vol, unsigned long mnt_flags) +static int print_label(ntfs_volume *vol, unsigned long mnt_flags) { int result = 0; //XXX significant? if ((mnt_flags & (NTFS_MF_MOUNTED | NTFS_MF_READONLY)) == NTFS_MF_MOUNTED) { - Eprintf ("%s is mounted read-write, results may be " + Eprintf("%s is mounted read-write, results may be " "unreliable.\n", opts.device); result = 1; } @@ -372,7 +372,7 @@ int main(int argc, char **argv) int result = 0; ntfs_volume *vol; - if (!parse_options (argc, argv)) + if (!parse_options(argc, argv)) return 1; utils_set_locale(); @@ -380,17 +380,17 @@ int main(int argc, char **argv) if (!opts.label) opts.noaction++; - vol = utils_mount_volume (opts.device, opts.noaction ? MS_RDONLY : 0, + vol = utils_mount_volume(opts.device, opts.noaction ? MS_RDONLY : 0, opts.force); if (!vol) return 1; if (opts.label) - result = change_label (vol, mnt_flags, opts.label, opts.force); + result = change_label(vol, mnt_flags, opts.label, opts.force); else - result = print_label (vol, mnt_flags); + result = print_label(vol, mnt_flags); - ntfs_umount (vol, FALSE); + ntfs_umount(vol, FALSE); return result; } diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 97752159..17beedd6 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -275,7 +275,7 @@ static int parse_options(int argc, char *argv[]) /* defaults to -a if -s is not specified */ if (!opts.system) - opts.all++; + opts.all++; if (help || ver) opts.quiet = 0; @@ -484,12 +484,12 @@ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, struct dir *dir = NULL; - filename = calloc (1, MAX_PATH); + filename = calloc(1, MAX_PATH); if (!filename) return -1; - if (ntfs_ucstombs (name, name_len, &filename, MAX_PATH) < 0) { - Eprintf ("Cannot represent filename in current locale.\n"); + if (ntfs_ucstombs(name, name_len, &filename, MAX_PATH) < 0) { + Eprintf("Cannot represent filename in current locale.\n"); goto free; } @@ -606,7 +606,7 @@ release: } free: - free (filename); + free(filename); return result; } @@ -641,7 +641,7 @@ int main(int argc, char **argv) return 2; } - ni = ntfs_pathname_to_inode (vol, NULL, opts.path); + ni = ntfs_pathname_to_inode(vol, NULL, opts.path); if (!ni) { // FIXME: Print error... (AIA) ntfs_umount(vol, FALSE); @@ -674,9 +674,9 @@ int main(int argc, char **argv) if (!ctx) return -1; - while ((rec = find_attribute (AT_FILE_NAME, ctx))) { + while ((rec = find_attribute(AT_FILE_NAME, ctx))) { /* We know this will always be resident. */ - attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); + attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu(rec->value_offset)); if (attr->file_name_type < space) { name = attr->file_name; diff --git a/ntfsprogs/ntfsmftalloc.c b/ntfsprogs/ntfsmftalloc.c index 5237d520..155d8706 100644 --- a/ntfsprogs/ntfsmftalloc.c +++ b/ntfsprogs/ntfsmftalloc.c @@ -166,8 +166,8 @@ static void license(void) /** * usage - print a list of the parameters to the program */ -__attribute__ ((noreturn)) -static void usage (void) +__attribute__((noreturn)) +static void usage(void) { copyright(); fprintf(stderr, "Usage: %s [options] device [base-mft-record]\n" diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 0accd102..cdb35de4 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -80,7 +80,7 @@ typedef enum { NF_STREAMS_INTERFACE_NONE, /* No access to named data streams. */ #if 0 NF_STREAMS_INTERFACE_XATTR, /* Map named data streams to xattrs. */ -#endif +#endif NF_STREAMS_INTERFACE_WINDOWS, /* "file:stream" interface. */ } ntfs_fuse_streams_interface; @@ -670,7 +670,7 @@ static int ntfs_fuse_link(const char *old_path, const char *new_path) if (strchr(old_path, ':') && /* n/a for named data streams. */ ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) - return -EINVAL; + return -EINVAL; if (strchr(new_path, ':') && /* n/a for named data streams. */ ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index 11ac72e9..7d1054f5 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -50,9 +50,9 @@ static const char *EXEC_NAME = "ntfsmove"; static struct options opts; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) #if 0 #define RED "\e[31m" @@ -68,13 +68,13 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -static void version (void) +static void version(void) { - printf ("\n%s v%s (libntfs %s) - Move files and directories on an " + printf("\n%s v%s (libntfs %s) - Move files and directories on an " "NTFS volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf ("Copyright (c) 2003 Richard Russon\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + printf("Copyright (c) 2003 Richard Russon\n"); + printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -84,9 +84,9 @@ static void version (void) * * Return: none */ -static void usage (void) +static void usage(void) { - printf ("\nUsage: %s [options] device file\n" + printf("\nUsage: %s [options] device file\n" "\n" " -S --start Move to the start of the volume\n" " -B --best Move to the best place on the volume\n" @@ -101,7 +101,7 @@ static void usage (void) " -V --version Version information\n" " -v --verbose More output\n\n", EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); + printf("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -113,7 +113,7 @@ static void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -static int parse_options (int argc, char **argv) +static int parse_options(int argc, char **argv) { static const char *sopt = "-BC:DEfh?nqSVv"; static const struct option lopt[] = { @@ -139,7 +139,7 @@ static int parse_options (int argc, char **argv) opterr = 0; /* We'll handle the errors, thank you. */ - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { case 1: /* A non-option argument */ if (!opts.device) { @@ -160,7 +160,7 @@ static int parse_options (int argc, char **argv) break; case 'C': if (opts.location == 0) { - opts.location = strtoll (optarg, &end, 0); + opts.location = strtoll(optarg, &end, 0); if (end && *end) err++; } else { @@ -202,7 +202,7 @@ static int parse_options (int argc, char **argv) opts.verbose++; break; default: - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + Eprintf("Unknown option '%s'.\n", argv[optind-1]); err++; break; } @@ -214,7 +214,7 @@ static int parse_options (int argc, char **argv) if ((opts.device == NULL) || (opts.file == NULL)) { if (argc > 1) - Eprintf ("You must specify one device and one file.\n"); + Eprintf("You must specify one device and one file.\n"); err++; } @@ -225,7 +225,7 @@ static int parse_options (int argc, char **argv) } if (opts.location == -1) { - Eprintf ("You may only specify one location option: " + Eprintf("You may only specify one location option: " "--start, --best, --end or --cluster\n"); err++; } else if (opts.location == 0) { @@ -246,7 +246,7 @@ static int parse_options (int argc, char **argv) /** * ntfs_debug_runlist_dump2 - Dump a runlist. */ -static int ntfs_debug_runlist_dump2 (const runlist *rl, int abbr, char *prefix) +static int ntfs_debug_runlist_dump2(const runlist *rl, int abbr, char *prefix) { //int abbr = 3; /* abbreviate long lists */ int len = 0; @@ -274,7 +274,7 @@ static int ntfs_debug_runlist_dump2 (const runlist *rl, int abbr, char *prefix) if (abbr) if (len > 20) { if ((i == abbr) && (len > (abbr*2))) - printf ("%s ... ... ...\n", prefix); + printf("%s ... ... ...\n", prefix); if ((i > (abbr-1)) && (i < (len - (abbr-1)))) continue; } @@ -295,9 +295,9 @@ static int ntfs_debug_runlist_dump2 (const runlist *rl, int abbr, char *prefix) printf("%s%8lld %8lld %8lld\n", prefix, rl->vcn, rl->lcn, rl->length); } - printf ("%s --------\n", prefix); - printf ("%s %8lld\n", prefix, total); - printf ("\n"); + printf("%s --------\n", prefix); + printf("%s %8lld\n", prefix, total); + printf("\n"); return res; } @@ -306,7 +306,7 @@ static int ntfs_debug_runlist_dump2 (const runlist *rl, int abbr, char *prefix) /** * resize_nonres_attr */ -static int resize_nonres_attr (MFT_RECORD *m, ATTR_RECORD *a, const u32 new_size) +static int resize_nonres_attr(MFT_RECORD *m, ATTR_RECORD *a, const u32 new_size) { int this_attr; int next_attr; @@ -323,15 +323,15 @@ static int resize_nonres_attr (MFT_RECORD *m, ATTR_RECORD *a, const u32 new_size ptr = (u8*) m; /* - printf ("old_size = %d\n", old_size); - printf ("new_size = %d\n", new_size); - printf ("file_size = %d\n", file_size); - printf ("this_attr = %d\n", this_attr); - printf ("next_attr = %d\n", next_attr); - printf ("tail_size = %d\n", tail_size); + printf("old_size = %d\n", old_size); + printf("new_size = %d\n", new_size); + printf("file_size = %d\n", file_size); + printf("this_attr = %d\n", this_attr); + printf("next_attr = %d\n", next_attr); + printf("tail_size = %d\n", tail_size); */ - memmove (ptr + this_attr + new_size, ptr + next_attr, tail_size); + memmove(ptr + this_attr + new_size, ptr + next_attr, tail_size); a->length = new_size; m->bytes_in_use += new_size - old_size; @@ -342,7 +342,7 @@ static int resize_nonres_attr (MFT_RECORD *m, ATTR_RECORD *a, const u32 new_size /** * calc_attr_length */ -static int calc_attr_length (ATTR_RECORD *rec, int runlength) +static int calc_attr_length(ATTR_RECORD *rec, int runlength) { int size; @@ -361,15 +361,15 @@ static int calc_attr_length (ATTR_RECORD *rec, int runlength) /** * dump_runs */ -static void dump_runs (u8 *buffer, int len) +static void dump_runs(u8 *buffer, int len) { int i; - printf ("RUN: \e[01;31m"); + printf("RUN: \e[01;31m"); for (i = 0; i < len; i++) { - printf (" %02x", buffer[i]); + printf(" %02x", buffer[i]); } - printf ("\e[0m\n"); + printf("\e[0m\n"); } #endif /* if 0 */ @@ -377,7 +377,7 @@ static void dump_runs (u8 *buffer, int len) /** * find_unused */ -static runlist * find_unused (ntfs_volume *vol, s64 size, u64 loc +static runlist * find_unused(ntfs_volume *vol, s64 size, u64 loc __attribute__((unused)), int flags __attribute__((unused))) { const int bufsize = 8192; @@ -390,34 +390,34 @@ static runlist * find_unused (ntfs_volume *vol, s64 size, u64 loc int bit = 0; runlist *res = NULL; - //printf ("find_unused\n"); - buffer = malloc (bufsize); + //printf("find_unused\n"); + buffer = malloc(bufsize); if (!buffer) { - printf ("!buffer\n"); + printf("!buffer\n"); return NULL; } - //printf ("looking for space for %lld clusters\n", size); + //printf("looking for space for %lld clusters\n", size); clus = vol->lcnbmp_na->allocated_size / bufsize; - //printf ("clus = %d\n", clus); + //printf("clus = %d\n", clus); for (i = 0; i < clus; i++) { int bytes_read, j; - bytes_read = ntfs_attr_pread (vol->lcnbmp_na, i*bufsize, + bytes_read = ntfs_attr_pread(vol->lcnbmp_na, i*bufsize, bufsize, buffer); if (bytes_read != bufsize) { - printf ("!read\n"); + printf("!read\n"); return NULL; } for (j = 0; j < bufsize*8; j++) { - bit = !!test_bit (j & 7, buffer[j>>3]); + bit = !!test_bit(j & 7, buffer[j>>3]); if (curr == bit) { count++; if ((!bit) && (count >= size)) { - //res = calloc (2, sizeof (*res)); - res = calloc (1, 4096); + //res = calloc(2, sizeof(*res)); + res = calloc(1, 4096); if (res) { res[0].vcn = 0; res[0].lcn = start; @@ -427,7 +427,7 @@ static runlist * find_unused (ntfs_volume *vol, s64 size, u64 loc goto done; } } else { - //printf ("%d * %d\n", curr, count); + //printf("%d * %d\n", curr, count); curr = bit; count = 1; start = i*bufsize*8 + j; @@ -435,18 +435,18 @@ static runlist * find_unused (ntfs_volume *vol, s64 size, u64 loc } } done: - //printf ("%d * %d\n", curr, count); + //printf("%d * %d\n", curr, count); - free (buffer); + free(buffer); if (res) { for (i = 0; i < size; i++) { - if (utils_cluster_in_use (vol, res->lcn + i)) { - printf ("ERROR cluster %lld in use\n", res->lcn + i); + if (utils_cluster_in_use(vol, res->lcn + i)) { + printf("ERROR cluster %lld in use\n", res->lcn + i); } } } else { - printf ("failed\n"); + printf("failed\n"); } return res; @@ -460,7 +460,7 @@ done: * Any fragmented MFT records * The boot file 'ntldr' */ -static int dont_move (ntfs_inode *ino) +static int dont_move(ntfs_inode *ino) { static const ntfschar ntldr[6] = { const_cpu_to_le16('n'), const_cpu_to_le16('t'), const_cpu_to_le16('l'), @@ -470,27 +470,27 @@ static int dont_move (ntfs_inode *ino) ATTR_RECORD *rec; FILE_NAME_ATTR *name; - if (utils_is_metadata (ino)) { - Eprintf ("metadata\n"); + if (utils_is_metadata(ino)) { + Eprintf("metadata\n"); return 1; } - rec = find_first_attribute (AT_ATTRIBUTE_LIST, ino->mrec); + rec = find_first_attribute(AT_ATTRIBUTE_LIST, ino->mrec); if (rec) { - Eprintf ("attribute list\n"); + Eprintf("attribute list\n"); return 1; } - rec = find_first_attribute (AT_FILE_NAME, ino->mrec); + rec = find_first_attribute(AT_FILE_NAME, ino->mrec); if (!rec) { - Eprintf ("extend inode\n"); + Eprintf("extend inode\n"); return 1; } name = (FILE_NAME_ATTR*) ((u8*)rec + rec->value_offset); - if (ntfs_names_are_equal (ntldr, 5, name->file_name, name->file_name_length, + if (ntfs_names_are_equal(ntldr, 5, name->file_name, name->file_name_length, IGNORE_CASE, ino->vol->upcase, ino->vol->upcase_len)) { - Eprintf ("ntldr\n"); + Eprintf("ntldr\n"); return 1; } @@ -501,16 +501,16 @@ static int dont_move (ntfs_inode *ino) /** * bitmap_alloc */ -static int bitmap_alloc (ntfs_volume *vol, runlist_element *rl) +static int bitmap_alloc(ntfs_volume *vol, runlist_element *rl) { int res; if (!rl) return -1; - res = ntfs_bitmap_set_run (vol->lcnbmp_na, rl->lcn, rl->length); + res = ntfs_bitmap_set_run(vol->lcnbmp_na, rl->lcn, rl->length); if (res < 0) { - Eprintf ("bitmap alloc returns %d\n", res); + Eprintf("bitmap alloc returns %d\n", res); } return res; @@ -519,16 +519,16 @@ static int bitmap_alloc (ntfs_volume *vol, runlist_element *rl) /** * bitmap_free */ -static int bitmap_free (ntfs_volume *vol, runlist_element *rl) +static int bitmap_free(ntfs_volume *vol, runlist_element *rl) { int res; if (!rl) return -1; - res = ntfs_bitmap_clear_run (vol->lcnbmp_na, rl->lcn, rl->length); + res = ntfs_bitmap_clear_run(vol->lcnbmp_na, rl->lcn, rl->length); if (res < 0) { - Eprintf ("bitmap free returns %d\n", res); + Eprintf("bitmap free returns %d\n", res); } return res; @@ -537,7 +537,7 @@ static int bitmap_free (ntfs_volume *vol, runlist_element *rl) /** * data_copy */ -static int data_copy (ntfs_volume *vol, runlist_element *from, runlist_element *to) +static int data_copy(ntfs_volume *vol, runlist_element *from, runlist_element *to) { int i; u8 *buffer; @@ -548,32 +548,32 @@ static int data_copy (ntfs_volume *vol, runlist_element *from, runlist_element * if ((from->length != to->length) || (from->lcn < 0) || (to->lcn < 0)) return -1; - //printf ("data_copy: from 0x%llx to 0x%llx\n", from->lcn, to->lcn); - buffer = malloc (vol->cluster_size); + //printf("data_copy: from 0x%llx to 0x%llx\n", from->lcn, to->lcn); + buffer = malloc(vol->cluster_size); if (!buffer) { - printf ("!buffer\n"); + printf("!buffer\n"); return -1; } for (i = 0; i < from->length; i++) { - //printf ("read cluster at %8lld\n", from->lcn+i); - res = ntfs_pread (vol->dev, (from->lcn+i) * vol->cluster_size, vol->cluster_size, buffer); + //printf("read cluster at %8lld\n", from->lcn+i); + res = ntfs_pread(vol->dev, (from->lcn+i) * vol->cluster_size, vol->cluster_size, buffer); if (res != vol->cluster_size) { - Eprintf ("!read\n"); + Eprintf("!read\n"); res = -1; break; } - //printf ("write cluster to %8lld\n", to->lcn+i); - res = ntfs_pwrite (vol->dev, (to->lcn+i) * vol->cluster_size, vol->cluster_size, buffer); + //printf("write cluster to %8lld\n", to->lcn+i); + res = ntfs_pwrite(vol->dev, (to->lcn+i) * vol->cluster_size, vol->cluster_size, buffer); if (res != vol->cluster_size) { - Eprintf ("!write %lld\n", res); + Eprintf("!write %lld\n", res); res = -1; break; } } - free (buffer); + free(buffer); return res; } @@ -588,7 +588,7 @@ static int data_copy (ntfs_volume *vol, runlist_element *from, runlist_element * * copy data * deallocate old space */ -static s64 move_runlist (ntfs_volume *vol, runlist_element *from, +static s64 move_runlist(ntfs_volume *vol, runlist_element *from, runlist_element *to) { int i; @@ -596,41 +596,41 @@ static s64 move_runlist (ntfs_volume *vol, runlist_element *from, if (!vol || !from || !to) return -1; if (from->length != to->length) { - Eprintf ("diffsizes\n"); + Eprintf("diffsizes\n"); return -1; } if ((from->lcn < 0) || (to->lcn < 0)) { - Eprintf ("invalid runs\n"); + Eprintf("invalid runs\n"); return -1; } for (i = 0; i < from->length; i++) { - if (!utils_cluster_in_use (vol, from->lcn+i)) { - Eprintf ("from not in use\n"); + if (!utils_cluster_in_use(vol, from->lcn+i)) { + Eprintf("from not in use\n"); return -1; } } for (i = 0; i < to->length; i++) { - if (utils_cluster_in_use (vol, to->lcn+i)) { - Eprintf ("to is in use\n"); + if (utils_cluster_in_use(vol, to->lcn+i)) { + Eprintf("to is in use\n"); return -1; } } - if (bitmap_alloc (vol, to) < 0) { - Eprintf ("cannot bitmap_alloc\n"); + if (bitmap_alloc(vol, to) < 0) { + Eprintf("cannot bitmap_alloc\n"); return -1; } - if (data_copy (vol, from, to) < 0) { - Eprintf ("cannot data_copy\n"); + if (data_copy(vol, from, to) < 0) { + Eprintf("cannot data_copy\n"); return -1; } - if (bitmap_free (vol, from) < 0) { - Eprintf ("cannot bitmap_free\n"); + if (bitmap_free(vol, from) < 0) { + Eprintf("cannot bitmap_free\n"); return -1; } @@ -654,7 +654,7 @@ static s64 move_runlist (ntfs_volume *vol, runlist_element *from, // requires a mrec arg, not an ino (ino->mrec will do for now) // check size of new runlist before allocating / moving // replace one datarun with another (by hand) -static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, +static s64 move_datarun(ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, runlist_element *run, u64 loc, int flags) { runlist *from; @@ -665,27 +665,27 @@ static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, s64 res = -1; // find empty space - to = find_unused (vol, run->length, loc, flags); + to = find_unused(vol, run->length, loc, flags); if (!to) { - Eprintf ("!to\n"); + Eprintf("!to\n"); return -1; } to->vcn = run->vcn; // copy original runlist - from = ntfs_mapping_pairs_decompress (vol, rec, NULL); + from = ntfs_mapping_pairs_decompress(vol, rec, NULL); if (!from) { - printf ("!from\n"); + printf("!from\n"); return -1; } - printf ("move %lld,%lld,%lld to %lld,%lld,%lld\n", run->vcn, run->lcn, run->length, to->vcn, to->lcn, to->length); + printf("move %lld,%lld,%lld to %lld,%lld,%lld\n", run->vcn, run->lcn, run->length, to->vcn, to->lcn, to->length); need_from = ntfs_get_size_for_mapping_pairs(vol, from, 0); - printf ("orig data run = %d bytes\n", need_from); + printf("orig data run = %d bytes\n", need_from); - //ntfs_debug_runlist_dump2 (from, 5, "\t"); + //ntfs_debug_runlist_dump2(from, 5, "\t"); for (i = 0; to[i].length > 0; i++) { if (from[i].vcn == run->vcn) { @@ -694,47 +694,47 @@ static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, } } - //ntfs_debug_runlist_dump2 (from, 5, "\t"); + //ntfs_debug_runlist_dump2(from, 5, "\t"); need_to = ntfs_get_size_for_mapping_pairs(vol, from, 0); - printf ("new data run = %d bytes\n", need_to); + printf("new data run = %d bytes\n", need_to); - need_from = calc_attr_length (rec, need_from); - need_to = calc_attr_length (rec, need_to); + need_from = calc_attr_length(rec, need_from); + need_to = calc_attr_length(rec, need_to); - //printf (RED "Before %d, after %d\n" NORM, need_from, need_to); - printf ("Before %d, after %d\n", need_from, need_to); + //printf(RED "Before %d, after %d\n" NORM, need_from, need_to); + printf("Before %d, after %d\n", need_from, need_to); if (need_from != need_to) { - if (resize_nonres_attr (ino->mrec, rec, need_to) < 0) { - printf ("!resize\n"); + if (resize_nonres_attr(ino->mrec, rec, need_to) < 0) { + printf("!resize\n"); return -1; } } - res = move_runlist (vol, run, to); + res = move_runlist(vol, run, to); if (res < 0) { - Eprintf ("!move_runlist\n"); + Eprintf("!move_runlist\n"); return -1; } // wipe orig runs - memset (((u8*)rec) +rec->mapping_pairs_offset, 0, need_to - rec->mapping_pairs_offset); + memset(((u8*)rec) +rec->mapping_pairs_offset, 0, need_to - rec->mapping_pairs_offset); // update data runs ntfs_mapping_pairs_build(vol, ((u8*)rec) + rec->mapping_pairs_offset, need_to, from, 0, NULL); // commit - ntfs_inode_mark_dirty (ino); + ntfs_inode_mark_dirty(ino); - if (ntfs_inode_sync (ino) < 0) { - printf ("!sync\n"); + if (ntfs_inode_sync(ino) < 0) { + printf("!sync\n"); return -1; } - free (from); - free (to); + free(from); + free(to); return res; } @@ -744,7 +744,7 @@ static s64 move_datarun (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, * = 0 Nothing to do * < 0 Error */ -static s64 move_attribute (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, +static s64 move_attribute(ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, u64 loc, int flags) { int i; @@ -756,24 +756,24 @@ static s64 move_attribute (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, // find that space and pass the location to our children. // Anything else we pass directly to move_datarun. - runs = ntfs_mapping_pairs_decompress (vol, rec, NULL); + runs = ntfs_mapping_pairs_decompress(vol, rec, NULL); if (!runs) { - Eprintf ("!runs\n"); + Eprintf("!runs\n"); return -1; } - //ntfs_debug_runlist_dump2 (runs, 5, "\t"); + //ntfs_debug_runlist_dump2(runs, 5, "\t"); - //printf (" VCN LCN Length\n"); + //printf(" VCN LCN Length\n"); for (i = 0; runs[i].length > 0; i++) { if (runs[i].lcn == LCN_RL_NOT_MAPPED) { continue; } - res = move_datarun (vol, ino, rec, runs+i, loc, flags); - //printf (" %8lld %8lld %8lld\n", runs[i].vcn, runs[i].lcn, runs[i].length); + res = move_datarun(vol, ino, rec, runs+i, loc, flags); + //printf(" %8lld %8lld %8lld\n", runs[i].vcn, runs[i].lcn, runs[i].length); if (res < 0) { - Eprintf ("!move_datarun\n"); + Eprintf("!move_datarun\n"); count = res; break; } @@ -789,7 +789,7 @@ static s64 move_attribute (ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, * = 0 Nothing to do * < 0 Error */ -static s64 move_file (ntfs_volume *vol, ntfs_inode *ino, u64 loc, int flags) +static s64 move_file(ntfs_volume *vol, ntfs_inode *ino, u64 loc, int flags) { char *buffer; ntfs_attr_search_ctx *ctx; @@ -797,47 +797,47 @@ static s64 move_file (ntfs_volume *vol, ntfs_inode *ino, u64 loc, int flags) s64 res; s64 count = 0; - buffer = malloc (MAX_PATH); + buffer = malloc(MAX_PATH); if (!buffer) { - Eprintf ("Out of memory\n"); + Eprintf("Out of memory\n"); return -1; } - utils_inode_get_name (ino, buffer, MAX_PATH); + utils_inode_get_name(ino, buffer, MAX_PATH); - if (dont_move (ino)) { - Eprintf ("can't move\n"); + if (dont_move(ino)) { + Eprintf("can't move\n"); return -1; } - printf ("Moving %s\n", buffer); + printf("Moving %s\n", buffer); // NTFS_MOVE_LOC_BEST : assess how much space all the attributes will need, // find that space and pass the location to our children. // Anything else we pass directly to move_attribute. - ctx = ntfs_attr_get_search_ctx (ino, NULL); + ctx = ntfs_attr_get_search_ctx(ino, NULL); - while ((rec = find_attribute (AT_UNUSED, ctx))) { - utils_attr_get_name (vol, rec, buffer, MAX_PATH); - printf ("\tAttribute 0x%02x %s is ", rec->type, buffer); + while ((rec = find_attribute(AT_UNUSED, ctx))) { + utils_attr_get_name(vol, rec, buffer, MAX_PATH); + printf("\tAttribute 0x%02x %s is ", rec->type, buffer); if (rec->non_resident) { - printf ("non-resident. Moving it.\n"); + printf("non-resident. Moving it.\n"); - res = move_attribute (vol, ino, rec, loc, flags); + res = move_attribute(vol, ino, rec, loc, flags); if (res < 0) { count = res; break; } count += res; } else { - printf ("resident.\n\t\tSkipping it.\n"); + printf("resident.\n\t\tSkipping it.\n"); } } - ntfs_attr_put_search_ctx (ctx); - free (buffer); + ntfs_attr_put_search_ctx(ctx); + free(buffer); return count; } @@ -850,7 +850,7 @@ static s64 move_file (ntfs_volume *vol, ntfs_inode *ino, u64 loc, int flags) * Return: 0 Success, the program worked * 1 Error, something went wrong */ -int main (int argc, char *argv[]) +int main(int argc, char *argv[]) { ntfs_volume *vol; ntfs_inode *inode; @@ -858,7 +858,7 @@ int main (int argc, char *argv[]) int result = 1; s64 count; - if (!parse_options (argc, argv)) + if (!parse_options(argc, argv)) return 1; utils_set_locale(); @@ -866,35 +866,35 @@ int main (int argc, char *argv[]) if (opts.noaction) flags |= MS_RDONLY; - vol = utils_mount_volume (opts.device, flags, opts.force); + vol = utils_mount_volume(opts.device, flags, opts.force); if (!vol) { - printf ("!vol\n"); + printf("!vol\n"); return 1; } inode = ntfs_pathname_to_inode(vol, NULL, opts.file); if (!inode) { - printf ("!inode\n"); + printf("!inode\n"); return 1; } - count = move_file (vol, inode, opts.location, 0); + count = move_file(vol, inode, opts.location, 0); if ((count > 0) && (!opts.nodirty)) { - if (ntfs_volume_write_flags (vol, vol->flags | VOLUME_IS_DIRTY) < + if (ntfs_volume_write_flags(vol, vol->flags | VOLUME_IS_DIRTY) < 0) { - Eprintf ("Couldn't mark volume dirty\n"); + Eprintf("Couldn't mark volume dirty\n"); } - printf ("Relocated %lld bytes\n", count); + printf("Relocated %lld bytes\n", count); } if (count >= 0) result = 0; if (result) - printf ("failed\n"); + printf("failed\n"); else - printf ("success\n"); + printf("success\n"); - ntfs_inode_close (inode); - ntfs_umount (vol, FALSE); + ntfs_inode_close(inode); + ntfs_umount(vol, FALSE); return result; } diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 3b074fdf..0b31d4b0 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -301,7 +301,7 @@ __attribute__((noreturn)) static void usage(void) { - printf ("\nUsage: %s [OPTIONS] DEVICE\n" + printf("\nUsage: %s [OPTIONS] DEVICE\n" " Resize an NTFS volume non-destructively, safely move any data if needed.\n" "\n" " -i, --info Estimate the smallest shrunken size possible\n" @@ -321,8 +321,8 @@ static void usage(void) " The options -i and -s are mutually exclusive. If both options are\n" " omitted then the NTFS volume will be enlarged to the DEVICE size.\n" "\n", EXEC_NAME); - printf ("%s%s", ntfs_bugs, ntfs_home); - printf ("Ntfsresize FAQ: http://linux-ntfs.sourceforge.net/info/ntfsresize.html\n"); + printf("%s%s", ntfs_bugs, ntfs_home); + printf("Ntfsresize FAQ: http://linux-ntfs.sourceforge.net/info/ntfsresize.html\n"); exit(1); } @@ -356,13 +356,13 @@ static void proceed_question(void) * * Return: none */ -static void version (void) +static void version(void) { - printf ("\nResize an NTFS Volume, without data loss.\n\n"); - printf ("Copyright (c) 2002-2005 Szabolcs Szakacsits\n"); - printf ("Copyright (c) 2002-2004 Anton Altaparmakov\n"); - printf ("Copyright (c) 2002-2003 Richard Russon\n"); - printf ("\n%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home); + printf("\nResize an NTFS Volume, without data loss.\n\n"); + printf("Copyright (c) 2002-2005 Szabolcs Szakacsits\n"); + printf("Copyright (c) 2002-2004 Anton Altaparmakov\n"); + printf("Copyright (c) 2002-2003 Richard Russon\n"); + printf("\n%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -454,7 +454,7 @@ static int parse_options(int argc, char **argv) memset(&opt, 0, sizeof(opt)); opt.show_progress = 1; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!err && !opt.volume) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 0a4cf481..30b02bea 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -56,9 +56,9 @@ static const char *EXEC_NAME = "ntfsrm"; static struct options opts; static const char *space_line = " "; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) #define RM_WRITE 0 @@ -69,12 +69,12 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -static void version (void) +static void version(void) { printf("\n%s v%s (libntfs %s) - Delete files from an NTFS volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf ("Copyright (c) 2004 Richard Russon\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + printf("Copyright (c) 2004 Richard Russon\n"); + printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -84,9 +84,9 @@ static void version (void) * * Return: none */ -static void usage (void) +static void usage(void) { - printf ("\nUsage: %s [options] device file\n" + printf("\nUsage: %s [options] device file\n" "\n" " -r --recursive Delete files in subdirectories\n" " -i --interactive Ask before deleting files\n" @@ -101,7 +101,7 @@ static void usage (void) " -V --version Version information\n" " -v --verbose More output\n\n", EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); + printf("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -113,7 +113,7 @@ static void usage (void) * Return: 1 Success * 0 Error, one or more problems */ -static int parse_options (int argc, char **argv) +static int parse_options(int argc, char **argv) { static const char *sopt = "-Dfh?inqRrVv"; //"-Dfh?I:inqRrUVv"; static const struct option lopt[] = { @@ -138,7 +138,7 @@ static int parse_options (int argc, char **argv) opterr = 0; /* We'll handle the errors, thank you. */ - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { case 1: /* A non-option argument */ if (!opts.device) { @@ -181,7 +181,7 @@ static int parse_options (int argc, char **argv) opts.verbose++; break; default: - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + Eprintf("Unknown option '%s'.\n", argv[optind-1]); err++; break; } @@ -193,7 +193,7 @@ static int parse_options (int argc, char **argv) if ((opts.device == NULL) || (opts.file == NULL)) { if (argc > 1) - Eprintf ("You must specify one device and one file.\n"); + Eprintf("You must specify one device and one file.\n"); err++; } @@ -216,18 +216,18 @@ static int parse_options (int argc, char **argv) /** * ntfs_dir_print */ -static void ntfs_dir_print (struct ntfs_dir *dir, int indent) +static void ntfs_dir_print(struct ntfs_dir *dir, int indent) { int i; if (!dir) return; - printf ("%.*s%p ", indent, space_line, dir); - ntfs_name_print (dir->name, dir->name_len); - printf ("\n"); + printf("%.*s%p ", indent, space_line, dir); + ntfs_name_print(dir->name, dir->name_len); + printf("\n"); for (i = 0; i < dir->child_count; i++) { - ntfs_dir_print (dir->children[i], indent + 4); + ntfs_dir_print(dir->children[i], indent + 4); } } @@ -235,17 +235,17 @@ static void ntfs_dir_print (struct ntfs_dir *dir, int indent) /** * ntfs_dt_print */ -static void ntfs_dt_print (struct ntfs_dt *dt, int indent) +static void ntfs_dt_print(struct ntfs_dt *dt, int indent) { int i; if (!dt) return; - printf ("%.*s%p (%d)\n", indent, space_line, dt, dt->child_count); + printf("%.*s%p (%d)\n", indent, space_line, dt, dt->child_count); for (i = 0; i < dt->child_count; i++) { - ntfs_dt_print (dt->sub_nodes[i], indent + 4); + ntfs_dt_print(dt->sub_nodes[i], indent + 4); } } @@ -253,9 +253,9 @@ static void ntfs_dt_print (struct ntfs_dt *dt, int indent) /** * utils_array_insert */ -static int utils_array_insert (void *ptr, int asize, int before, int count) +static int utils_array_insert(void *ptr, int asize, int before, int count) { - static int esize = sizeof (u8*); + static int esize = sizeof(u8*); u8 *src; u8 *dst; int len; @@ -268,11 +268,11 @@ static int utils_array_insert (void *ptr, int asize, int before, int count) len = (asize - before) * esize; // XXX what about realloc? - memmove (dst, src, len); + memmove(dst, src, len); len = count * esize; - memset (src, 0, len); + memset(src, 0, len); return 0; } @@ -280,9 +280,9 @@ static int utils_array_insert (void *ptr, int asize, int before, int count) /** * utils_array_remove */ -static int utils_array_remove (void *ptr, int asize, int first, int count) +static int utils_array_remove(void *ptr, int asize, int first, int count) { - static int esize = sizeof (u8*); + static int esize = sizeof(u8*); u8 *src; u8 *dst; int len; @@ -294,12 +294,12 @@ static int utils_array_remove (void *ptr, int asize, int first, int count) src = dst + (count * esize); len = (asize - first) * esize; - memmove (dst, src, len); + memmove(dst, src, len); src = (u8*) ptr + ((asize - count) * esize); len = count * esize; - memset (src, 0, len); + memset(src, 0, len); // XXX don't want to memset, want to realloc return 0; @@ -309,7 +309,7 @@ static int utils_array_remove (void *ptr, int asize, int first, int count) /** * utils_pathname_to_inode2 */ -static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, const char *pathname, struct ntfs_find *found) +static BOOL utils_pathname_to_inode2(ntfs_volume *vol, struct ntfs_dir *parent, const char *pathname, struct ntfs_find *found) { int len; char *p, *q; @@ -326,22 +326,22 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, return FALSE; } - memset (found, 0, sizeof (*found)); + memset(found, 0, sizeof(*found)); if (parent) { dir = parent; } else { dir = (struct ntfs_dir *) vol->private_data; if (!dir) { - Eprintf ("Couldn't open the inode of the root directory.\n"); + Eprintf("Couldn't open the inode of the root directory.\n"); goto close; } } - unicode = malloc (MAX_PATH * sizeof (ntfschar)); - ascii = strdup (pathname); // Work with a r/w copy + unicode = malloc(MAX_PATH * sizeof(ntfschar)); + ascii = strdup(pathname); // Work with a r/w copy if (!unicode || !ascii) { - Eprintf ("Out of memory.\n"); + Eprintf("Out of memory.\n"); goto close; } @@ -349,59 +349,59 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, while (p && *p && *p == PATH_SEP) // Remove leading /'s p++; while (p && *p) { - q = strchr (p, PATH_SEP); // Find the end of the first token + q = strchr(p, PATH_SEP); // Find the end of the first token if (q != NULL) { *q = '\0'; q++; } - len = ntfs_mbstoucs (p, &unicode, MAX_PATH); + len = ntfs_mbstoucs(p, &unicode, MAX_PATH); if (len < 0) { - Eprintf ("Couldn't convert name to Unicode: %s.\n", p); + Eprintf("Couldn't convert name to Unicode: %s.\n", p); goto close; } - //printf ("looking for %s in dir %lld\n", p, MREF (dir->mft_num)); - //printf ("dir: index = %p, children = %p, inode = %p, iroot = %p, ialloc = %p, count = %d\n", dir->index, dir->children, dir->inode, dir->iroot, dir->ialloc, dir->child_count); + //printf("looking for %s in dir %lld\n", p, MREF(dir->mft_num)); + //printf("dir: index = %p, children = %p, inode = %p, iroot = %p, ialloc = %p, count = %d\n", dir->index, dir->children, dir->inode, dir->iroot, dir->ialloc, dir->child_count); //if (dir->parent) if (q) { - child = ntfs_dir_find2 (dir, unicode, len); + child = ntfs_dir_find2(dir, unicode, len); if (!child) { - printf ("can't find %s in %s\n", p, pathname); + printf("can't find %s in %s\n", p, pathname); goto close; } } else { - //printf ("file: %s\n", p); + //printf("file: %s\n", p); - dt = ntfs_dt_find2 (dir->index, unicode, len, &dt_num); + dt = ntfs_dt_find2(dir->index, unicode, len, &dt_num); if (!dt) { - printf ("can't find %s in %s (2)\n", p, pathname); + printf("can't find %s in %s (2)\n", p, pathname); goto close; } - //printf ("dt's flags = 0x%08x\n", dt->children[dt_num]->key.file_name.file_attributes); + //printf("dt's flags = 0x%08x\n", dt->children[dt_num]->key.file_name.file_attributes); if (dt->children[dt_num]->key.file_name.file_attributes == FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) { - //printf ("DIR\n"); - child = ntfs_dir_create (dir->vol, dt->children[dt_num]->indexed_file); - //printf ("child = %p (%lld)\n", child, MREF (dt->children[dt_num]->indexed_file)); + //printf("DIR\n"); + child = ntfs_dir_create(dir->vol, dt->children[dt_num]->indexed_file); + //printf("child = %p (%lld)\n", child, MREF(dt->children[dt_num]->indexed_file)); if (child) { - child->index = ntfs_dt_create (child, NULL, -1); - ntfs_dir_add (dir, child); + child->index = ntfs_dt_create(child, NULL, -1); + ntfs_dir_add(dir, child); } } if (dt->inodes[dt_num] == NULL) { - dt->inodes[dt_num] = ntfs_inode_open (dir->vol, dt->children[dt_num]->indexed_file); + dt->inodes[dt_num] = ntfs_inode_open(dir->vol, dt->children[dt_num]->indexed_file); if (!dt->inodes[dt_num]) { - printf ("Can't open inode %lld\n", MREF (dt->children[dt_num]->indexed_file)); + printf("Can't open inode %lld\n", MREF(dt->children[dt_num]->indexed_file)); goto close; } dt->inodes[dt_num]->ref_count = 2; dt->inodes[dt_num]->private_data = dt; } - //printf ("dt = %p,%d\n", dt, dt_num); + //printf("dt = %p,%d\n", dt, dt_num); break; } @@ -418,10 +418,10 @@ static BOOL utils_pathname_to_inode2 (ntfs_volume *vol, struct ntfs_dir *parent, found->inode = dt->inodes[dt_num]; found->mref = found->inode->mft_no; result = TRUE; - //printf ("dir %p, dt %p, num %d, ino %p, %lld\n", dir, dt, dt_num, dt->inodes[dt_num], MREF (found->inode->mft_no)); + //printf("dir %p, dt %p, num %d, ino %p, %lld\n", dir, dt, dt_num, dt->inodes[dt_num], MREF(found->inode->mft_no)); close: - free (ascii); // from strdup - free (unicode); + free(ascii); // from strdup + free(unicode); return result; } @@ -429,7 +429,7 @@ close: /** * ntfs_mft_find_free_entry */ -static s64 ntfs_mft_find_free_entry (ntfs_volume *vol) +static s64 ntfs_mft_find_free_entry(ntfs_volume *vol) { MFT_REF i; u64 recs; @@ -438,9 +438,9 @@ static s64 ntfs_mft_find_free_entry (ntfs_volume *vol) return -1; recs = vol->mft_na->initialized_size >> vol->mft_record_size_bits; - //printf ("mft contains %lld records\n", recs); + //printf("mft contains %lld records\n", recs); for (i = 24; i < recs; i++) { - if (utils_mftrec_in_use (vol, i) == 0) + if (utils_mftrec_in_use(vol, i) == 0) return i; } return -1; @@ -449,14 +449,14 @@ static s64 ntfs_mft_find_free_entry (ntfs_volume *vol) /** * ntfs_mft_set_inuse6 */ -static int ntfs_mft_set_inuse6 (ntfs_inode *inode, struct ntfs_bmp *bmp, BOOL inuse) +static int ntfs_mft_set_inuse6(ntfs_inode *inode, struct ntfs_bmp *bmp, BOOL inuse) { MFT_RECORD *rec; if (!inode) return -1; - if (ntfs_bmp_set_range (bmp, (VCN) MREF (inode->mft_no), 1, inuse) < 0) + if (ntfs_bmp_set_range(bmp, (VCN) MREF(inode->mft_no), 1, inuse) < 0) return -1; rec = (MFT_RECORD*) inode->mrec; @@ -472,7 +472,7 @@ static int ntfs_mft_set_inuse6 (ntfs_inode *inode, struct ntfs_bmp *bmp, BOOL in NInoSetDirty(inode); - printf (GREEN "Modified: inode %lld MFT_RECORD header\n" END, inode->mft_no); + printf(GREEN "Modified: inode %lld MFT_RECORD header\n" END, inode->mft_no); return 0; } @@ -480,7 +480,7 @@ static int ntfs_mft_set_inuse6 (ntfs_inode *inode, struct ntfs_bmp *bmp, BOOL in /** * ntfs_file_remove */ -static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) +static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) { struct ntfs_dir *find_dir = NULL; struct ntfs_dt *top = NULL; @@ -511,12 +511,12 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) name_len = del->children[del_num]->key.file_name.file_name_length; top = del->dir->index; - //ntfs_dt_find_all (top); - //ntfs_dt_print (top, 0); + //ntfs_dt_find_all(top); + //ntfs_dt_print(top, 0); del_ie = del->children[del_num]; - //utils_dump_mem (del_ie, 0, del_ie->length, DM_DEFAULTS); - //printf ("\n"); + //utils_dump_mem(del_ie, 0, del_ie->length, DM_DEFAULTS); + //printf("\n"); /* * If the key is not in a leaf node, then replace it with its successor. @@ -526,41 +526,41 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) /* for (i = 0; i < top->child_count; i++) { par_ie = top->children[i]; - file = &par_ie->key.file_name; printf ("\ttop node, key %d: ", i); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - printf ("\tvcn = %lld\n", ntfs_ie_get_vcn (par_ie)); + file = &par_ie->key.file_name; printf("\ttop node, key %d: ", i); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); + printf("\tvcn = %lld\n", ntfs_ie_get_vcn(par_ie)); } */ if (del->header->flags & INDEX_NODE) { - printf (BOLD YELLOW "Replace key with its successor:\n" END); + printf(BOLD YELLOW "Replace key with its successor:\n" END); - vcn = ntfs_ie_get_vcn (del_ie); - //printf ("vcn = %lld\n", vcn); + vcn = ntfs_ie_get_vcn(del_ie); + //printf("vcn = %lld\n", vcn); - suc = ntfs_dt_find4 (find_dir->index, uname, name_len, &suc_num); - //printf ("succ = %p, index = %d\n", suc, suc_num); - //printf ("\n"); + suc = ntfs_dt_find4(find_dir->index, uname, name_len, &suc_num); + //printf("succ = %p, index = %d\n", suc, suc_num); + //printf("\n"); - suc_ie = ntfs_ie_copy (suc->children[suc_num]); - //utils_dump_mem (suc_ie, 0, suc_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); - //printf ("\n"); + suc_ie = ntfs_ie_copy(suc->children[suc_num]); + //utils_dump_mem(suc_ie, 0, suc_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); + //printf("\n"); - suc_ie = ntfs_ie_set_vcn (suc_ie, vcn); - //utils_dump_mem (suc_ie, 0, suc_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); - //printf ("\n"); + suc_ie = ntfs_ie_set_vcn(suc_ie, vcn); + //utils_dump_mem(suc_ie, 0, suc_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); + //printf("\n"); - file = &del_ie->key.file_name; printf ("\trep name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - file = &suc_ie->key.file_name; printf ("\tsuc name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + file = &del_ie->key.file_name; printf("\trep name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); + file = &suc_ie->key.file_name; printf("\tsuc name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); - //utils_dump_mem (del->data, 0, del->data_len, DM_BLUE|DM_GREEN|DM_INDENT); - if (ntfs_dt_isroot (del)) - res = ntfs_dt_root_replace (del, del_num, del_ie, suc_ie); + //utils_dump_mem(del->data, 0, del->data_len, DM_BLUE|DM_GREEN|DM_INDENT); + if (ntfs_dt_isroot(del)) + res = ntfs_dt_root_replace(del, del_num, del_ie, suc_ie); else - res = ntfs_dt_alloc_replace (del, del_num, del_ie, suc_ie); - //printf ("\n"); - //utils_dump_mem (del->data, 0, del->data_len, DM_BLUE|DM_GREEN|DM_INDENT); + res = ntfs_dt_alloc_replace(del, del_num, del_ie, suc_ie); + //printf("\n"); + //utils_dump_mem(del->data, 0, del->data_len, DM_BLUE|DM_GREEN|DM_INDENT); - ntfs_ie_free (suc_ie); + ntfs_ie_free(suc_ie); if (res == FALSE) goto done; @@ -570,27 +570,27 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) del_ie = suc->children[suc_num]; } - //ntfs_dt_print (top, 0); + //ntfs_dt_print(top, 0); /* * Now we have the simpler case of deleting from a leaf node. * If this step creates an empty node, we have more to do. */ - printf ("\n"); - printf (BOLD YELLOW "Delete key:\n" END); + printf("\n"); + printf(BOLD YELLOW "Delete key:\n" END); - file = &del->children[del_num]->key.file_name; printf ("\tdel name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + file = &del->children[del_num]->key.file_name; printf("\tdel name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); - //utils_dump_mem (del->data, 0, del->header->index_length+24, DM_BLUE|DM_GREEN|DM_INDENT); + //utils_dump_mem(del->data, 0, del->header->index_length+24, DM_BLUE|DM_GREEN|DM_INDENT); // XXX if del->child_count == 2, we could skip this step // no, if we combine with another node, we'll have to remember - if (ntfs_dt_isroot (del)) - ntfs_dt_root_remove (del, del_num); + if (ntfs_dt_isroot(del)) + ntfs_dt_root_remove(del, del_num); else - ntfs_dt_alloc_remove (del, del_num); - //printf ("\n"); - //utils_dump_mem (del->data, 0, del->header->index_length+24, DM_BLUE|DM_GREEN|DM_INDENT); + ntfs_dt_alloc_remove(del, del_num); + //printf("\n"); + //utils_dump_mem(del->data, 0, del->header->index_length+24, DM_BLUE|DM_GREEN|DM_INDENT); if (del->child_count > 1) // XXX ntfs_dt_empty (dt), ntfs_dt_full (dt, new) goto commit; @@ -603,30 +603,30 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) */ // find the key nearest the root which has no descendants - printf ("\n"); - printf (BOLD YELLOW "Find childless parent:\n" END); + printf("\n"); + printf(BOLD YELLOW "Find childless parent:\n" END); #if 0 for (par = del->parent, old = par; par; old = par, par = par->parent) { if (par->child_count > 1) break; - par_num = ntfs_dt_find_parent (par); + par_num = ntfs_dt_find_parent(par); } #endif - printf ("del = %p, parent = %p\n", del, del->parent); + printf("del = %p, parent = %p\n", del, del->parent); par = del->parent; - par_num = ntfs_dt_find_parent (del); + par_num = ntfs_dt_find_parent(del); - //utils_dump_mem (par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); + //utils_dump_mem(par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); - printf ("par = %p, par->parent = %p, num = %d\n", par, par->parent, par_num); + printf("par = %p, par->parent = %p, num = %d\n", par, par->parent, par_num); par_num = 0; // TEMP if (par) { file = &par->children[par_num]->key.file_name; - printf ("\tpar name: "); - ntfs_name_print (file->file_name, file->file_name_length); - printf ("\n"); + printf("\tpar name: "); + ntfs_name_print(file->file_name, file->file_name_length); + printf("\n"); } if (par == NULL) { @@ -634,123 +634,123 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) goto freedts; } - //ntfs_dt_print (top, 0); - printf ("\n"); + //ntfs_dt_print(top, 0); + printf("\n"); - //utils_dump_mem (par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); - //printf ("\n"); + //utils_dump_mem(par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); + //printf("\n"); /* for (i = 0; i < top->child_count; i++) { par_ie = top->children[i]; - file = &par_ie->key.file_name; printf ("\ttop node, key %d: ", i); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - printf ("\tvcn = %lld\n", ntfs_ie_get_vcn (par_ie)); + file = &par_ie->key.file_name; printf("\ttop node, key %d: ", i); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); + printf("\tvcn = %lld\n", ntfs_ie_get_vcn(par_ie)); } */ // find if parent has left siblings if (par->children[par_num]->flags & INDEX_ENTRY_END) { - printf (BOLD YELLOW "Swap the children of the parent and its left sibling\n" END); + printf(BOLD YELLOW "Swap the children of the parent and its left sibling\n" END); par_ie = par->children[par_num]; - vcn = ntfs_ie_get_vcn (par_ie); - //printf ("\toffset = %d\n", (u8*)par_ie - par->data); printf ("\tflags = %d\n", par_ie->flags); printf ("\tvcn = %lld\n", vcn); printf ("\tlength = %d\n", par_ie->length); - //utils_dump_mem (par_ie, 0, par_ie->length, DM_DEFAULTS); - //printf ("\n"); + vcn = ntfs_ie_get_vcn(par_ie); + //printf("\toffset = %d\n", (u8*)par_ie - par->data); printf("\tflags = %d\n", par_ie->flags); printf("\tvcn = %lld\n", vcn); printf("\tlength = %d\n", par_ie->length); + //utils_dump_mem(par_ie, 0, par_ie->length, DM_DEFAULTS); + //printf("\n"); - //printf ("\toffset = %d\n", (u8*)par_ie - par->data); printf ("\tflags = %d\n", par_ie->flags); printf ("\tvcn = %lld\n", vcn); printf ("\tlength = %d\n", par_ie->length); - //utils_dump_mem (par_ie, 0, par_ie->length, DM_DEFAULTS); - //printf ("\n"); + //printf("\toffset = %d\n", (u8*)par_ie - par->data); printf("\tflags = %d\n", par_ie->flags); printf("\tvcn = %lld\n", vcn); printf("\tlength = %d\n", par_ie->length); + //utils_dump_mem(par_ie, 0, par_ie->length, DM_DEFAULTS); + //printf("\n"); - file = &par->children[par_num] ->key.file_name; printf ("\tpar name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - file = &par->children[par_num-1]->key.file_name; printf ("\tsib name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + file = &par->children[par_num] ->key.file_name; printf("\tpar name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); + file = &par->children[par_num-1]->key.file_name; printf("\tsib name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); old = par->sub_nodes[par_num]; par->sub_nodes[par_num] = par->sub_nodes[par_num-1]; par->sub_nodes[par_num-1] = old; par_ie = par->children[par_num-1]; - vcn = ntfs_ie_get_vcn (par_ie); + vcn = ntfs_ie_get_vcn(par_ie); par_ie = par->children[par_num]; - ntfs_ie_set_vcn (par_ie, vcn); + ntfs_ie_set_vcn(par_ie, vcn); par_num--; - if (ntfs_dt_isroot (par)) - printf (GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, par->dir->inode->mft_no); + if (ntfs_dt_isroot(par)) + printf(GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, par->dir->inode->mft_no); else - printf (GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, par->dir->inode->mft_no, par->vcn, par->vcn + (par->dir->index_size>>9) - 1); + printf(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, par->dir->inode->mft_no, par->vcn, par->vcn + (par->dir->index_size>>9) - 1); } - //ntfs_dt_print (top, 0); + //ntfs_dt_print(top, 0); - //printf ("\n"); - //utils_dump_mem (par->data, 0, par->data_len, DM_DEFAULTS); + //printf("\n"); + //utils_dump_mem(par->data, 0, par->data_len, DM_DEFAULTS); // unhook and hold onto the ded dt's - printf ("\n"); - printf (BOLD YELLOW "Remove parent\n" END); + printf("\n"); + printf(BOLD YELLOW "Remove parent\n" END); - file = &par->children[par_num]->key.file_name; printf ("\tpar name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + file = &par->children[par_num]->key.file_name; printf("\tpar name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); - add_ie = ntfs_ie_copy (par->children[par_num]); - add_ie = ntfs_ie_remove_vcn (add_ie); + add_ie = ntfs_ie_copy(par->children[par_num]); + add_ie = ntfs_ie_remove_vcn(add_ie); if (!add_ie) goto done; - //printf ("\n"); - //utils_dump_mem (add_ie, 0, add_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); + //printf("\n"); + //utils_dump_mem(add_ie, 0, add_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); ded = par->sub_nodes[par_num]; par->sub_nodes[par_num] = NULL; - //ntfs_dt_print (ded, 8); + //ntfs_dt_print(ded, 8); #if 0 for (i = 0; i < par->child_count; i++) { par_ie = par->children[i]; - file = &par_ie->key.file_name; printf ("\tdel node, key %d: ", i); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - printf ("\tvcn = %lld\n", ntfs_ie_get_vcn (par_ie)); + file = &par_ie->key.file_name; printf("\tdel node, key %d: ", i); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); + printf("\tvcn = %lld\n", ntfs_ie_get_vcn(par_ie)); } #endif #if 1 - //printf ("PAR: %p,%d\n", par, par_num); - if (ntfs_dt_isroot (par)) - ntfs_dt_root_remove (par, par_num); + //printf("PAR: %p,%d\n", par, par_num); + if (ntfs_dt_isroot(par)) + ntfs_dt_root_remove(par, par_num); else - ntfs_dt_alloc_remove (par, par_num); + ntfs_dt_alloc_remove(par, par_num); #endif - //printf ("count = %d\n", par->child_count); - //utils_dump_mem (par->data, 0, par->data_len, DM_DEFAULTS); - //printf ("0x%x\n", (u8*)par->children[0] - par->data); + //printf("count = %d\n", par->child_count); + //utils_dump_mem(par->data, 0, par->data_len, DM_DEFAULTS); + //printf("0x%x\n", (u8*)par->children[0] - par->data); #if 0 for (i = 0; i < par->child_count; i++) { par_ie = par->children[i]; - file = &par_ie->key.file_name; printf ("\tadd node, key %d: ", i); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); - printf ("\tvcn = %lld\n", ntfs_ie_get_vcn (par_ie)); + file = &par_ie->key.file_name; printf("\tadd node, key %d: ", i); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); + printf("\tvcn = %lld\n", ntfs_ie_get_vcn(par_ie)); } #endif - //ntfs_dt_print (top, 0); - printf ("\n"); - printf (BOLD YELLOW "Add childless parent\n" END); + //ntfs_dt_print(top, 0); + printf("\n"); + printf(BOLD YELLOW "Add childless parent\n" END); - file = &add_ie->key.file_name; printf ("\tadd name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + file = &add_ie->key.file_name; printf("\tadd name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); suc = NULL; suc_num = -1; - suc = ntfs_dt_find4 (top, file->file_name, file->file_name_length, &suc_num); - //printf ("SUC: %p, %d\n", suc, suc_num); + suc = ntfs_dt_find4(top, file->file_name, file->file_name_length, &suc_num); + //printf("SUC: %p, %d\n", suc, suc_num); if (!suc) goto done; - file = &suc->children[suc_num]->key.file_name; printf ("\tsuc name: "); ntfs_name_print (file->file_name, file->file_name_length); printf ("\n"); + file = &suc->children[suc_num]->key.file_name; printf("\tsuc name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); // insert key into successor // if any new nodes are needed, reuse the preserved nodes - if (!ntfs_dt_add2 (add_ie, suc, suc_num, ded)) + if (!ntfs_dt_add2(add_ie, suc, suc_num, ded)) goto done; // remove any unused nodes @@ -762,14 +762,14 @@ static int ntfs_file_remove (ntfs_volume *vol, struct ntfs_dt *del, int del_num) // XXX reduce size of alloc // XXX if ded, don't write it back, just update bitmap - printf ("empty\n"); + printf("empty\n"); goto done; freedts: - printf ("\twhole dir is empty\n"); + printf("\twhole dir is empty\n"); commit: - //printf ("commit\n"); + //printf("commit\n"); done: return 0; @@ -778,7 +778,7 @@ done: /** * ntfs_file_remove2 */ -static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) +static int ntfs_file_remove2(ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) { INDEX_ENTRY *ie; ntfs_inode *ino; @@ -796,20 +796,20 @@ static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) bmp_mft = vol->private_bmp1; bmp_vol = vol->private_bmp2; - if (1) ntfs_mft_set_inuse6 (ino, bmp_mft, FALSE); + if (1) ntfs_mft_set_inuse6(ino, bmp_mft, FALSE); - if (1) utils_free_non_residents2 (ino, bmp_vol); + if (1) utils_free_non_residents2(ino, bmp_vol); - if (1) ntfs_file_remove (vol, dt, dt_num); // remove name from index + if (1) ntfs_file_remove(vol, dt, dt_num); // remove name from index - if (1) ntfs_dir_truncate (vol, dt->dir); + if (1) ntfs_dir_truncate(vol, dt->dir); - if (1) ntfs_volume_commit (vol); + if (1) ntfs_volume_commit(vol); - if (0) ntfs_volume_rollback (vol); + if (0) ntfs_volume_rollback(vol); - if (0) printf ("last mft = %lld\n", ntfs_bmp_find_last_set (bmp_mft)); - if (0) printf ("last vol = %lld\n", ntfs_bmp_find_last_set (bmp_vol)); + if (0) printf("last mft = %lld\n", ntfs_bmp_find_last_set(bmp_mft)); + if (0) printf("last vol = %lld\n", ntfs_bmp_find_last_set(bmp_vol)); return 0; } @@ -817,7 +817,7 @@ static int ntfs_file_remove2 (ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) /** * ntfs_file_add2 */ -static int ntfs_file_add2 (ntfs_volume *vol, char *filename) +static int ntfs_file_add2(ntfs_volume *vol, char *filename) { MFT_REF new_num; char *ptr = NULL; @@ -838,20 +838,20 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) struct ntfs_dt *suc = NULL; int suc_num = 0; - new_num = ntfs_mft_find_free_entry (vol); + new_num = ntfs_mft_find_free_entry(vol); if (new_num == (MFT_REF) -1) return 1; - if (rindex (filename, PATH_SEP)) { - ptr = rindex (filename, PATH_SEP); + if (rindex(filename, PATH_SEP)) { + ptr = rindex(filename, PATH_SEP); *ptr = 0; dirname = filename; filename = ptr + 1; } - printf ("looking for %s\n", dirname); - if (utils_pathname_to_inode2 (vol, NULL, dirname, &find) == FALSE) { - printf ("!inode\n"); + printf("looking for %s\n", dirname); + if (utils_pathname_to_inode2(vol, NULL, dirname, &find) == FALSE) { + printf("!inode\n"); return 0; } @@ -862,18 +862,18 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) if (uname_len < 0) goto close; - printf ("new inode %lld\n", new_num); - ino = ntfs_inode_open3 (vol, new_num); + printf("new inode %lld\n", new_num); + ino = ntfs_inode_open3(vol, new_num); if (!ino) { - printf ("!ino\n"); + printf("!ino\n"); goto close; } tmp = (u8*) ino->mrec; - now = utc2ntfs (time(NULL)); + now = utc2ntfs(time(NULL)); // Wipe all the attributes - memset (tmp + ino->mrec->attrs_offset, 0, vol->mft_record_size - ino->mrec->attrs_offset); + memset(tmp + ino->mrec->attrs_offset, 0, vol->mft_record_size - ino->mrec->attrs_offset); // Add new end marker *(u32*) (tmp + ino->mrec->attrs_offset) = 0xFFFFFFFF; @@ -886,74 +886,74 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) ino->mrec->next_attr_instance = 0; ino->mrec->flags = MFT_RECORD_IN_USE; - ntfs_mft_set_inuse6 (ino, vol->private_bmp1, TRUE); + ntfs_mft_set_inuse6(ino, vol->private_bmp1, TRUE); - buffer = malloc (128); + buffer = malloc(128); if (!buffer) goto close; // Standard information - memset (buffer, 0, 128); + memset(buffer, 0, 128); *(u64*)(buffer + 0x00) = now; // Time *(u64*)(buffer + 0x08) = now; // Time *(u64*)(buffer + 0x10) = now; // Time *(u64*)(buffer + 0x18) = now; // Time - ino->creation_time = time (NULL); - ino->last_data_change_time = time (NULL); - ino->last_mft_change_time = time (NULL); - ino->last_access_time = time (NULL); - attr = ntfs_mft_add_attr (ino, AT_STANDARD_INFORMATION, buffer, 0x48); + ino->creation_time = time(NULL); + ino->last_data_change_time = time(NULL); + ino->last_mft_change_time = time(NULL); + ino->last_access_time = time(NULL); + attr = ntfs_mft_add_attr(ino, AT_STANDARD_INFORMATION, buffer, 0x48); // Data - memset (buffer, 0, 128); - data_len = sprintf ((char*)buffer, "Contents of file: %s\n", filename); - attr = ntfs_mft_add_attr (ino, AT_DATA, buffer, data_len); + memset(buffer, 0, 128); + data_len = sprintf((char*)buffer, "Contents of file: %s\n", filename); + attr = ntfs_mft_add_attr(ino, AT_DATA, buffer, data_len); // File name - memset (buffer, 0, 128); - *(u64*)(buffer + 0x00) = MK_MREF (find.mref, 2); // MFT Ref of parent dir + memset(buffer, 0, 128); + *(u64*)(buffer + 0x00) = MK_MREF(find.mref, 2); // MFT Ref of parent dir *(u64*)(buffer + 0x08) = now; // Time *(u64*)(buffer + 0x10) = now; // Time *(u64*)(buffer + 0x18) = now; // Time *(u64*)(buffer + 0x20) = now; // Time - *(u64*)(buffer + 0x28) = ATTR_SIZE (data_len); // Allocated size + *(u64*)(buffer + 0x28) = ATTR_SIZE(data_len); // Allocated size *(u64*)(buffer + 0x30) = data_len; // Initialised size *(u32*)(buffer + 0x38) = 0; // Flags *(u32*)(buffer + 0x3C) = 0; // Not relevant *(u8* )(buffer + 0x40) = uname_len; // Filename length *(u8* )(buffer + 0x41) = FILE_NAME_POSIX; // Filename namespace - memcpy (buffer + 0x42, uname, uname_len * sizeof (ntfschar)); - attr = ntfs_mft_add_attr (ino, AT_FILE_NAME, buffer, ATTR_SIZE (0x42 + (uname_len * sizeof (ntfschar)))); + memcpy(buffer + 0x42, uname, uname_len * sizeof(ntfschar)); + attr = ntfs_mft_add_attr(ino, AT_FILE_NAME, buffer, ATTR_SIZE(0x42 + (uname_len * sizeof(ntfschar)))); attr->resident_flags = RESIDENT_ATTR_IS_INDEXED; attr->name_offset = 0x18; ie = ntfs_ie_create(); - ie = ntfs_ie_set_name (ie, uname, uname_len, FILE_NAME_POSIX); + ie = ntfs_ie_set_name(ie, uname, uname_len, FILE_NAME_POSIX); if (!ie) { - printf ("!ie\n"); + printf("!ie\n"); goto close; } // These two NEED the sequence number in the top 8 bits - ie->key.file_name.parent_directory = MK_MREF (find.mref, 2);// MFT Ref: parent dir - ie->indexed_file = MK_MREF (new_num, ino->mrec->sequence_number); + ie->key.file_name.parent_directory = MK_MREF(find.mref, 2);// MFT Ref: parent dir + ie->indexed_file = MK_MREF(new_num, ino->mrec->sequence_number); ie->key.file_name.creation_time = now; ie->key.file_name.last_data_change_time = now; ie->key.file_name.last_mft_change_time = now; ie->key.file_name.last_access_time = now; - ie->key.file_name.allocated_size = ATTR_SIZE (data_len); + ie->key.file_name.allocated_size = ATTR_SIZE(data_len); ie->key.file_name.data_size = data_len; dir = dt->dir->children[0]; dt = dir->index; - suc = ntfs_dt_find3 (dt, uname, uname_len, &suc_num); + suc = ntfs_dt_find3(dt, uname, uname_len, &suc_num); - ntfs_dt_add2 (ie, suc, suc_num, NULL); + ntfs_dt_add2(ie, suc, suc_num, NULL); /* - dt_index = ntfs_dt_root_add (dt, ie); + dt_index = ntfs_dt_root_add(dt, ie); if (dt_index >= 0) { dt->inodes[dt_index] = ino; ino->ref_count++; @@ -961,11 +961,11 @@ static int ntfs_file_add2 (ntfs_volume *vol, char *filename) */ close: - free (buffer); - ntfs_inode_close2 (ino); - ntfs_ie_free (ie); - free (uname); - ntfs_inode_close2 (find.inode); + free(buffer); + ntfs_inode_close2(ino); + ntfs_ie_free(ie); + free(uname); + ntfs_inode_close2(find.inode); return 0; } @@ -977,7 +977,7 @@ close: * Return: 0 Success, the program worked * 1 Error, something went wrong */ -int main (int argc, char *argv[]) +int main(int argc, char *argv[]) { ntfs_volume *vol = NULL; ntfs_inode *inode = NULL; @@ -985,52 +985,52 @@ int main (int argc, char *argv[]) int result = 1; struct ntfs_find find; - if (!parse_options (argc, argv)) + if (!parse_options(argc, argv)) goto done; utils_set_locale(); #if 0 - printf ("sizeof (ntfs_bmp) = %d\n", sizeof (struct ntfs_bmp)); - printf ("sizeof (ntfs_dt) = %d\n", sizeof (struct ntfs_dt)); - printf ("sizeof (ntfs_dir) = %d\n", sizeof (struct ntfs_dir)); - printf ("\n"); + printf("sizeof(ntfs_bmp) = %d\n", sizeof(struct ntfs_bmp)); + printf("sizeof(ntfs_dt) = %d\n", sizeof(struct ntfs_dt)); + printf("sizeof(ntfs_dir) = %d\n", sizeof(struct ntfs_dir)); + printf("\n"); #endif if (opts.noaction) flags |= MS_RDONLY; - vol = ntfs_volume_mount2 (opts.device, flags, opts.force); + vol = ntfs_volume_mount2(opts.device, flags, opts.force); if (!vol) { - printf ("!vol\n"); + printf("!vol\n"); goto done; } #if 0 - if (utils_pathname_to_inode2 (vol, NULL, opts.file, &find) == FALSE) { - printf ("!inode\n"); + if (utils_pathname_to_inode2(vol, NULL, opts.file, &find) == FALSE) { + printf("!inode\n"); goto done; } inode = find.inode; #endif - //printf ("inode = %lld\n", inode->mft_no); + //printf("inode = %lld\n", inode->mft_no); - if (0) result = ntfs_file_remove2 (vol, find.dt, find.dt_index); - if (1) result = ntfs_file_add2 (vol, opts.file); + if (0) result = ntfs_file_remove2(vol, find.dt, find.dt_index); + if (1) result = ntfs_file_add2(vol, opts.file); done: - if (1) ntfs_volume_commit (vol); - if (0) ntfs_volume_rollback (vol); - if (0) ntfs_inode_close2 (inode); - if (1) ntfs_volume_umount2 (vol, FALSE); + if (1) ntfs_volume_commit(vol); + if (0) ntfs_volume_rollback(vol); + if (0) ntfs_inode_close2(inode); + if (1) ntfs_volume_umount2(vol, FALSE); - if (0) utils_pathname_to_inode2 (NULL, NULL, NULL, NULL); - if (0) ntfs_ie_remove_name (NULL); - if (0) ntfs_dt_transfer2 (NULL, NULL, 0, 0); - if (0) utils_array_remove (NULL, 0, 0, 0); - if (0) utils_array_insert (NULL, 0, 0, 0); + if (0) utils_pathname_to_inode2(NULL, NULL, NULL, NULL); + if (0) ntfs_ie_remove_name(NULL); + if (0) ntfs_dt_transfer2(NULL, NULL, 0, 0); + if (0) utils_array_remove(NULL, 0, 0, 0); + if (0) utils_array_insert(NULL, 0, 0, 0); return result; } diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index c82ad43d..04530913 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -171,8 +171,8 @@ static void license(void) /** * usage - print a list of the parameters to the program */ -__attribute__ ((noreturn)) -static void usage (void) +__attribute__((noreturn)) +static void usage(void) { copyright(); fprintf(stderr, "Usage: %s [options] device inode [attr-type " diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index cd089662..47f3f85d 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -99,9 +99,9 @@ static short avoid_duplicate_printing; /* Flag No duplicate printing of file in static range *ranges; /* Array containing all Inode-Rages for undelete */ static long nr_entries; /* Number of range entries */ -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * parse_inode_arg - parses the inode expression @@ -110,7 +110,7 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: Number of correct inode specifications or -1 for error */ -static int parse_inode_arg (void) +static int parse_inode_arg(void) { int p; u32 imax; @@ -129,28 +129,28 @@ static int parse_inode_arg (void) return (0); /* bailout if no optarg */ /* init variables */ - p = strlen (optarg); + p = strlen(optarg); imax = p; opt_arg_ptr = optarg; opt_arg_end1 = optarg; opt_arg_end2 = &(optarg[p]); /* alloc mem for range table */ - ranges = (range *) malloc ((p + 1) * sizeof (range)); + ranges = (range *) malloc((p + 1) * sizeof(range)); if (ranges == NULL) { - printf ("ERROR: Couldn't alloc mem for parsing inodes!\n"); + printf("ERROR: Couldn't alloc mem for parsing inodes!\n"); return (-1); } /* loop */ while ((opt_arg_end1 != opt_arg_end2) && (p > 0)) { /* Try to get inode */ - inode = strtoul (opt_arg_ptr, &opt_arg_end1, 0); + inode = strtoul(opt_arg_ptr, &opt_arg_end1, 0); p--; /* invalid char at begin */ if ((opt_arg_ptr == opt_arg_end1) || (opt_arg_ptr == opt_arg_end2)) { - printf ("ERROR: Invalid Number: %s\n", opt_arg_ptr); + printf("ERROR: Invalid Number: %s\n", opt_arg_ptr); return (-1); } @@ -160,15 +160,15 @@ static int parse_inode_arg (void) opt_arg_temp = opt_arg_end1; opt_arg_end1 = & (opt_arg_temp[1]); if (opt_arg_temp >= opt_arg_end2) { - printf ("ERROR: Missing range end!\n"); + printf("ERROR: Missing range end!\n"); return (-1); } range_begin = inode; /* get count */ - range_end = strtoul (opt_arg_end1, &opt_arg_temp, 0); + range_end = strtoul(opt_arg_end1, &opt_arg_temp, 0); if (opt_arg_temp == opt_arg_end1) { - printf ("ERROR: Invalid Number: %s\n", opt_arg_temp); + printf("ERROR: Invalid Number: %s\n", opt_arg_temp); return (-1); } @@ -198,7 +198,7 @@ static int parse_inode_arg (void) /* Next inode */ opt_arg_ptr = & (opt_arg_end1[1]); if (opt_arg_ptr >= opt_arg_end2) { - printf ("ERROR: Missing new value at end of input!\n"); + printf("ERROR: Missing new value at end of input!\n"); return (-1); } continue; @@ -218,14 +218,14 @@ static int parse_inode_arg (void) * * Return: none */ -static void version (void) +static void version(void) { printf("\n%s v%s (libntfs %s) - Recover deleted files from an NTFS " "Volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf ("Copyright (c) 2002-2005 Richard Russon\n" + printf("Copyright (c) 2002-2005 Richard Russon\n" "Copyright (c) 2004-2005 Holger Ohmacht\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -235,9 +235,9 @@ static void version (void) * * Return: none */ -static void usage (void) +static void usage(void) { - printf ("\nUsage: %s [options] device\n" + printf("\nUsage: %s [options] device\n" " -s --scan Scan for files (default)\n" " -p num --percentage num Minimum percentage recoverable\n" " -m pattern --match pattern Only work on files with matching names\n" @@ -262,7 +262,7 @@ static void usage (void) " -V --version Display version information\n" " -h --help Display this help\n\n", EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); + printf("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -286,7 +286,7 @@ static void usage (void) * Return: 1, Success, the string was transformed * 0, An error occurred */ -static int transform (const char *pattern, char **regex) +static int transform(const char *pattern, char **regex) { char *result; int length, i, j; @@ -294,9 +294,9 @@ static int transform (const char *pattern, char **regex) if (!pattern || !regex) return 0; - length = strlen (pattern); + length = strlen(pattern); if (length < 1) { - Eprintf ("Pattern to transform is empty\n"); + Eprintf("Pattern to transform is empty\n"); return 0; } @@ -305,9 +305,9 @@ static int transform (const char *pattern, char **regex) length++; } - result = malloc (length + 3); + result = malloc(length + 3); if (!result) { - Eprintf ("Couldn't allocate memory in transform()\n"); + Eprintf("Couldn't allocate memory in transform()\n"); return 0; } @@ -362,7 +362,7 @@ static int transform (const char *pattern, char **regex) * Return: 1 Success * 0 Error, the string was malformed */ -static int parse_time (const char *value, time_t *since) +static int parse_time(const char *value, time_t *since) { long long result; time_t now; @@ -373,19 +373,19 @@ static int parse_time (const char *value, time_t *since) ntfs_log_trace("Parsing time '%s' ago.\n", value); - result = strtoll (value, &suffix, 10); + result = strtoll(value, &suffix, 10); if (result < 0 || errno == ERANGE) { - Eprintf ("Invalid time '%s'.\n", value); + Eprintf("Invalid time '%s'.\n", value); return 0; } if (!suffix) { - Eprintf ("Internal error, strtoll didn't return a suffix.\n"); + Eprintf("Internal error, strtoll didn't return a suffix.\n"); return 0; } - if (strlen (suffix) > 1) { - Eprintf ("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); + if (strlen(suffix) > 1) { + Eprintf("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); return 0; } @@ -399,11 +399,11 @@ static int parse_time (const char *value, time_t *since) break; default: - Eprintf ("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); + Eprintf("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); return 0; } - now = time (NULL); + now = time(NULL); ntfs_log_debug("Time now = %lld, Time then = %lld.\n", (long long) now, (long long) result); @@ -420,7 +420,7 @@ static int parse_time (const char *value, time_t *since) * Return: 1 Success * 0 Error, one or more problems */ -static int parse_options (int argc, char *argv[]) +static int parse_options(int argc, char *argv[]) { static const char *sopt = "-b:Cc:d:fhi?m:o:OPp:sS:t:Tu::qvV"; static const struct option lopt[] = { @@ -433,7 +433,7 @@ static int parse_options (int argc, char *argv[]) { "help", no_argument, NULL, 'h' }, { "match", required_argument, NULL, 'm' }, { "output", required_argument, NULL, 'o' }, - { "optimistic", no_argument, NULL, 'O' }, + { "optimistic", no_argument, NULL, 'O' }, { "percentage", required_argument, NULL, 'p' }, { "scan", no_argument, NULL, 's' }, { "size", required_argument, NULL, 'S' }, @@ -459,7 +459,7 @@ static int parse_options (int argc, char *argv[]) opts.uinode = -1; opts.percent = -1; opts.fillbyte = -1; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != (char)-1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { case 1: /* A non-option argument */ if (!opts.device) { @@ -472,7 +472,7 @@ static int parse_options (int argc, char *argv[]) case 'b': if (opts.fillbyte == (char)-1) { end = NULL; - opts.fillbyte = strtol (optarg, &end, 0); + opts.fillbyte = strtol(optarg, &end, 0); if (end && *end) err++; } else { @@ -484,7 +484,7 @@ static int parse_options (int argc, char *argv[]) break; case 'c': if (opts.mode == MODE_NONE) { - if (!utils_parse_range (optarg, + if (!utils_parse_range(optarg, &opts.mft_begin, &opts.mft_end, TRUE)) err++; opts.mode = MODE_COPY; @@ -507,7 +507,7 @@ static int parse_options (int argc, char *argv[]) break; case 'm': if (!opts.match) { - if (!transform (optarg, &opts.match)) { + if (!transform(optarg, &opts.match)) { err++; } else { /* set regex-flag on true ;) */ @@ -525,10 +525,10 @@ static int parse_options (int argc, char *argv[]) } break; case 'O': - if (!opts.optimistic) { + if (!opts.optimistic) { opts.optimistic++; } else { - err++; + err++; } break; case 'P': @@ -541,7 +541,7 @@ static int parse_options (int argc, char *argv[]) case 'p': if (opts.percent == -1) { end = NULL; - opts.percent = strtol (optarg, &end, 0); + opts.percent = strtol(optarg, &end, 0); if (end && ((*end != '%') && (*end != 0))) err++; } else { @@ -559,14 +559,14 @@ static int parse_options (int argc, char *argv[]) break; case 'S': if ((opts.size_begin > 0) || (opts.size_end > 0) || - !utils_parse_range (optarg, &opts.size_begin, + !utils_parse_range(optarg, &opts.size_begin, &opts.size_end, TRUE)) { err++; } break; case 't': if (opts.since == 0) { - if (!parse_time (optarg, &opts.since)) + if (!parse_time(optarg, &opts.since)) err++; } else { err++; @@ -600,9 +600,9 @@ static int parse_options (int argc, char *argv[]) (optopt == 'o') || (optopt == 'p') || (optopt == 'S') || (optopt == 't') || (optopt == 'u')) && (!optarg)) { - Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); + Eprintf("Option '%s' requires an argument.\n", argv[optind-1]); } else { - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + Eprintf("Unknown option '%s'.\n", argv[optind-1]); } err++; break; @@ -614,7 +614,7 @@ static int parse_options (int argc, char *argv[]) } else { if (opts.device == NULL) { if (argc > 1) - Eprintf ("You must specify exactly one device.\n"); + Eprintf("You must specify exactly one device.\n"); err++; } @@ -626,19 +626,19 @@ static int parse_options (int argc, char *argv[]) case MODE_SCAN: if (opts.output || opts.dest || opts.truncate || (opts.fillbyte != (char)-1)) { - Eprintf ("Scan can only be used with --percent, " + Eprintf("Scan can only be used with --percent, " "--match, --ignore-case, --size and --time.\n"); err++; } if (opts.match_case && !opts.match) { - Eprintf ("The --case option doesn't make sense without the --match option\n"); + Eprintf("The --case option doesn't make sense without the --match option\n"); err++; } break; case MODE_UNDELETE: /*if ((opts.percent != -1) || (opts.size_begin > 0) || (opts.size_end > 0)) { - Eprintf ("Undelete can only be used with " + Eprintf("Undelete can only be used with " "--output, --destination, --byte and --truncate.\n"); err++; }*/ @@ -649,32 +649,32 @@ static int parse_options (int argc, char *argv[]) opts.match || opts.match_case || (opts.size_begin > 0) || (opts.size_end > 0)) { - Eprintf ("Copy can only be used with --output and --destination.\n"); + Eprintf("Copy can only be used with --output and --destination.\n"); err++; } break; default: - Eprintf ("You can only select one of Scan, Undelete or Copy.\n"); + Eprintf("You can only select one of Scan, Undelete or Copy.\n"); err++; } if ((opts.percent < -1) || (opts.percent > 100)) { - Eprintf ("Percentage value must be in the range 0 - 100.\n"); + Eprintf("Percentage value must be in the range 0 - 100.\n"); err++; } if (opts.quiet) { if (opts.verbose) { - Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + Eprintf("You may not use --quiet and --verbose at the same time.\n"); err++; } else if (opts.mode == MODE_SCAN) { - Eprintf ("You may not use --quiet when scanning a volume.\n"); + Eprintf("You may not use --quiet when scanning a volume.\n"); err++; } } if (opts.parent && !opts.verbose) { - Eprintf ("To use --parent, you must also use --verbose.\n"); + Eprintf("To use --parent, you must also use --verbose.\n"); err++; } } @@ -700,41 +700,41 @@ static int parse_options (int argc, char *argv[]) * * Return: none */ -static void free_file (struct ufile *file) +static void free_file(struct ufile *file) { struct list_head *item, *tmp; if (!file) return; - list_for_each_safe (item, tmp, &file->name) { /* List of filenames */ - struct filename *f = list_entry (item, struct filename, list); + list_for_each_safe(item, tmp, &file->name) { /* List of filenames */ + struct filename *f = list_entry(item, struct filename, list); ntfs_log_debug("freeing filename '%s'", f->name ? f->name : NONE); if (f->name) - free (f->name); + free(f->name); if (f->parent_name) { ntfs_log_debug(" and parent filename '%s'", f->parent_name); - free (f->parent_name); + free(f->parent_name); } ntfs_log_debug(".\n"); - free (f); + free(f); } - list_for_each_safe (item, tmp, &file->data) { /* List of data streams */ - struct data *d = list_entry (item, struct data, list); + list_for_each_safe(item, tmp, &file->data) { /* List of data streams */ + struct data *d = list_entry(item, struct data, list); ntfs_log_debug("Freeing data stream '%s'.\n", d->name ? d->name : UNNAMED); if (d->name) - free (d->name); + free(d->name); if (d->runlist) - free (d->runlist); - free (d); + free(d->runlist); + free(d); } - free (file->mft); - free (file); + free(file->mft); + free(file); } /** @@ -765,7 +765,7 @@ static FILE_NAME_ATTR* verify_parent(struct filename* name, MFT_RECORD* rec) ctx = ntfs_attr_get_search_ctx(NULL, rec); if (!ctx) { - Eprintf ("ERROR: Couldn't create a search context.\n"); + Eprintf("ERROR: Couldn't create a search context.\n"); return NULL; } @@ -806,7 +806,7 @@ static FILE_NAME_ATTR* verify_parent(struct filename* name, MFT_RECORD* rec) * get_parent_name - Find the name of a file's parent. * @name: the filename whose parent's name to find */ -static void get_parent_name (struct filename* name, ntfs_volume* vol) +static void get_parent_name(struct filename* name, ntfs_volume* vol) { ntfs_attr* mft_data; MFT_RECORD* rec; @@ -818,18 +818,18 @@ static void get_parent_name (struct filename* name, ntfs_volume* vol) rec = calloc(1, vol->mft_record_size); if (!rec) { - Eprintf ("ERROR: Couldn't allocate memory in get_parent_name()\n"); + Eprintf("ERROR: Couldn't allocate memory in get_parent_name()\n"); return; } mft_data = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0); if (!mft_data) { - Eprintf ("ERROR: Couldn't open $MFT/$DATA: %s\n", strerror (errno)); + Eprintf("ERROR: Couldn't open $MFT/$DATA: %s\n", strerror(errno)); } else { inode_num = MREF(name->parent_mref); if (ntfs_attr_pread(mft_data, vol->mft_record_size * inode_num, vol->mft_record_size, rec) < 1) { - Eprintf ("ERROR: Couldn't read MFT Record %lld.\n", inode_num); + Eprintf("ERROR: Couldn't read MFT Record %lld.\n", inode_num); } else if ((filename_attr = verify_parent(name, rec))) { if (ntfs_ucstombs(filename_attr->file_name, filename_attr->file_name_length, @@ -872,7 +872,7 @@ static void get_parent_name (struct filename* name, ntfs_volume* vol) * Return: n The number of $FILENAME attributes found * -1 Error */ -static int get_filenames (struct ufile *file, ntfs_volume* vol) +static int get_filenames(struct ufile *file, ntfs_volume* vol) { ATTR_RECORD *rec; FILE_NAME_ATTR *attr; @@ -884,17 +884,17 @@ static int get_filenames (struct ufile *file, ntfs_volume* vol) if (!file) return -1; - ctx = ntfs_attr_get_search_ctx (NULL, file->mft); + ctx = ntfs_attr_get_search_ctx(NULL, file->mft); if (!ctx) return -1; - while ((rec = find_attribute (AT_FILE_NAME, ctx))) { + while ((rec = find_attribute(AT_FILE_NAME, ctx))) { /* We know this will always be resident. */ - attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu (rec->value_offset)); + attr = (FILE_NAME_ATTR *) ((char *) rec + le16_to_cpu(rec->value_offset)); - name = calloc (1, sizeof (*name)); + name = calloc(1, sizeof(*name)); if (!name) { - Eprintf ("ERROR: Couldn't allocate memory in get_filenames().\n"); + Eprintf("ERROR: Couldn't allocate memory in get_filenames().\n"); count = -1; break; } @@ -902,16 +902,16 @@ static int get_filenames (struct ufile *file, ntfs_volume* vol) name->uname = attr->file_name; name->uname_len = attr->file_name_length; name->name_space = attr->file_name_type; - name->size_alloc = sle64_to_cpu (attr->allocated_size); - name->size_data = sle64_to_cpu (attr->data_size); + name->size_alloc = sle64_to_cpu(attr->allocated_size); + name->size_data = sle64_to_cpu(attr->data_size); name->flags = attr->file_attributes; - name->date_c = ntfs2utc (attr->creation_time); - name->date_a = ntfs2utc (attr->last_data_change_time); - name->date_m = ntfs2utc (attr->last_mft_change_time); - name->date_r = ntfs2utc (attr->last_access_time); + name->date_c = ntfs2utc(attr->creation_time); + name->date_a = ntfs2utc(attr->last_data_change_time); + name->date_m = ntfs2utc(attr->last_mft_change_time); + name->date_r = ntfs2utc(attr->last_access_time); - if (ntfs_ucstombs (name->uname, name->uname_len, &name->name, + if (ntfs_ucstombs(name->uname, name->uname_len, &name->name, 0) < 0) { ntfs_log_debug("ERROR: Couldn't translate filename to " "current locale.\n"); @@ -930,10 +930,10 @@ static int get_filenames (struct ufile *file, ntfs_volume* vol) space = name->name_space; } - file->max_size = max (file->max_size, name->size_alloc); - file->max_size = max (file->max_size, name->size_data); + file->max_size = max(file->max_size, name->size_alloc); + file->max_size = max(file->max_size, name->size_data); - list_add_tail (&name->list, &file->name); + list_add_tail(&name->list, &file->name); count++; } @@ -957,7 +957,7 @@ static int get_filenames (struct ufile *file, ntfs_volume* vol) * Return: n The number of $FILENAME attributes found * -1 Error */ -static int get_data (struct ufile *file, ntfs_volume *vol) +static int get_data(struct ufile *file, ntfs_volume *vol) { ATTR_RECORD *rec; ntfs_attr_search_ctx *ctx; @@ -967,14 +967,14 @@ static int get_data (struct ufile *file, ntfs_volume *vol) if (!file) return -1; - ctx = ntfs_attr_get_search_ctx (NULL, file->mft); + ctx = ntfs_attr_get_search_ctx(NULL, file->mft); if (!ctx) return -1; - while ((rec = find_attribute (AT_DATA, ctx))) { - data = calloc (1, sizeof (*data)); + while ((rec = find_attribute(AT_DATA, ctx))) { + data = calloc(1, sizeof(*data)); if (!data) { - Eprintf ("ERROR: Couldn't allocate memory in get_data().\n"); + Eprintf("ERROR: Couldn't allocate memory in get_data().\n"); count = -1; break; } @@ -984,23 +984,23 @@ static int get_data (struct ufile *file, ntfs_volume *vol) data->encrypted = rec->flags & ATTR_IS_ENCRYPTED; if (rec->name_length) { - data->uname = (ntfschar *) ((char *) rec + le16_to_cpu (rec->name_offset)); + data->uname = (ntfschar *) ((char *) rec + le16_to_cpu(rec->name_offset)); data->uname_len = rec->name_length; - if (ntfs_ucstombs (data->uname, data->uname_len, &data->name, + if (ntfs_ucstombs(data->uname, data->uname_len, &data->name, 0) < 0) { - Eprintf ("ERROR: Cannot translate name into current locale.\n"); + Eprintf("ERROR: Cannot translate name into current locale.\n"); } } if (data->resident) { - data->size_data = le32_to_cpu (rec->value_length); - data->data = ((char*) (rec)) + le16_to_cpu (rec->value_offset); + data->size_data = le32_to_cpu(rec->value_length); + data->data = ((char*) (rec)) + le16_to_cpu(rec->value_offset); } else { - data->size_alloc = sle64_to_cpu (rec->allocated_size); - data->size_data = sle64_to_cpu (rec->data_size); - data->size_init = sle64_to_cpu (rec->initialized_size); - data->size_vcn = sle64_to_cpu (rec->highest_vcn) + 1; + data->size_alloc = sle64_to_cpu(rec->allocated_size); + data->size_data = sle64_to_cpu(rec->data_size); + data->size_init = sle64_to_cpu(rec->initialized_size); + data->size_vcn = sle64_to_cpu(rec->highest_vcn) + 1; } data->runlist = ntfs_mapping_pairs_decompress(vol, rec, NULL); @@ -1008,10 +1008,10 @@ static int get_data (struct ufile *file, ntfs_volume *vol) ntfs_log_debug("Couldn't decompress the data runs.\n"); } - file->max_size = max (file->max_size, data->size_data); - file->max_size = max (file->max_size, data->size_init); + file->max_size = max(file->max_size, data->size_data); + file->max_size = max(file->max_size, data->size_init); - list_add_tail (&data->list, &file->data); + list_add_tail(&data->list, &file->data); count++; } @@ -1031,7 +1031,7 @@ static int get_data (struct ufile *file, ntfs_volume *vol) * Return: Pointer A ufile object containing the results * NULL Error */ -static struct ufile * read_record (ntfs_volume *vol, long long record) +static struct ufile * read_record(ntfs_volume *vol, long long record) { ATTR_RECORD *attr10, *attr20, *attr90; struct ufile *file; @@ -1040,51 +1040,51 @@ static struct ufile * read_record (ntfs_volume *vol, long long record) if (!vol) return NULL; - file = calloc (1, sizeof (*file)); + file = calloc(1, sizeof(*file)); if (!file) { - Eprintf ("ERROR: Couldn't allocate memory in read_record()\n"); + Eprintf("ERROR: Couldn't allocate memory in read_record()\n"); return NULL; } - INIT_LIST_HEAD (&file->name); - INIT_LIST_HEAD (&file->data); + INIT_LIST_HEAD(&file->name); + INIT_LIST_HEAD(&file->data); file->inode = record; - file->mft = malloc (vol->mft_record_size); + file->mft = malloc(vol->mft_record_size); if (!file->mft) { - Eprintf ("ERROR: Couldn't allocate memory in read_record()\n"); - free_file (file); + Eprintf("ERROR: Couldn't allocate memory in read_record()\n"); + free_file(file); return NULL; } - mft = ntfs_attr_open (vol->mft_ni, AT_DATA, AT_UNNAMED, 0); + mft = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0); if (!mft) { - Eprintf ("ERROR: Couldn't open $MFT/$DATA: %s\n", strerror (errno)); - free_file (file); + Eprintf("ERROR: Couldn't open $MFT/$DATA: %s\n", strerror(errno)); + free_file(file); return NULL; } - if (ntfs_attr_mst_pread (mft, vol->mft_record_size * record, 1, vol->mft_record_size, file->mft) < 1) { - Eprintf ("ERROR: Couldn't read MFT Record %lld.\n", record); - ntfs_attr_close (mft); - free_file (file); + if (ntfs_attr_mst_pread(mft, vol->mft_record_size * record, 1, vol->mft_record_size, file->mft) < 1) { + Eprintf("ERROR: Couldn't read MFT Record %lld.\n", record); + ntfs_attr_close(mft); + free_file(file); return NULL; } - ntfs_attr_close (mft); + ntfs_attr_close(mft); mft = NULL; - attr10 = find_first_attribute (AT_STANDARD_INFORMATION, file->mft); - attr20 = find_first_attribute (AT_ATTRIBUTE_LIST, file->mft); - attr90 = find_first_attribute (AT_INDEX_ROOT, file->mft); + attr10 = find_first_attribute(AT_STANDARD_INFORMATION, file->mft); + attr20 = find_first_attribute(AT_ATTRIBUTE_LIST, file->mft); + attr90 = find_first_attribute(AT_INDEX_ROOT, file->mft); ntfs_log_debug("Attributes present: %s %s %s.\n", attr10?"0x10":"", attr20?"0x20":"", attr90?"0x90":""); if (attr10) { STANDARD_INFORMATION *si; - si = (STANDARD_INFORMATION *) ((char *) attr10 + le16_to_cpu (attr10->value_offset)); - file->date = ntfs2utc (si->last_data_change_time); + si = (STANDARD_INFORMATION *) ((char *) attr10 + le16_to_cpu(attr10->value_offset)); + file->date = ntfs2utc(si->last_data_change_time); } if (attr20 || !attr10) @@ -1092,11 +1092,11 @@ static struct ufile * read_record (ntfs_volume *vol, long long record) if (attr90) file->directory = 1; - if (get_filenames (file, vol) < 0) { - Eprintf ("ERROR: Couldn't get filenames.\n"); + if (get_filenames(file, vol) < 0) { + Eprintf("ERROR: Couldn't get filenames.\n"); } - if (get_data (file, vol) < 0) { - Eprintf ("ERROR: Couldn't get data streams.\n"); + if (get_data(file, vol) < 0) { + Eprintf("ERROR: Couldn't get data streams.\n"); } return file; @@ -1125,7 +1125,7 @@ static struct ufile * read_record (ntfs_volume *vol, long long record) * Return: n The percentage of the file that _could_ be recovered * -1 Error */ -static int calc_percentage (struct ufile *file, ntfs_volume *vol) +static int calc_percentage(struct ufile *file, ntfs_volume *vol) { runlist_element *rl = NULL; struct list_head *pos; @@ -1143,28 +1143,28 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) return 0; } - if (list_empty (&file->data)) { - Vprintf ("File has no data streams.\n"); + if (list_empty(&file->data)) { + Vprintf("File has no data streams.\n"); return 0; } - list_for_each (pos, &file->data) { - data = list_entry (pos, struct data, list); + list_for_each(pos, &file->data) { + data = list_entry(pos, struct data, list); clusters_inuse = 0; clusters_free = 0; if (data->encrypted) { - Vprintf ("File is encrypted, recovery is impossible.\n"); + Vprintf("File is encrypted, recovery is impossible.\n"); continue; } if (data->compressed) { - Vprintf ("File is compressed, recovery not yet implemented.\n"); + Vprintf("File is compressed, recovery not yet implemented.\n"); continue; } if (data->resident) { - Vprintf ("File is resident, therefore recoverable.\n"); + Vprintf("File is resident, therefore recoverable.\n"); percent = 100; data->percent = 100; continue; @@ -1172,17 +1172,17 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) rl = data->runlist; if (!rl) { - Vprintf ("File has no runlist, hence no data.\n"); + Vprintf("File has no runlist, hence no data.\n"); continue; } if (rl[0].length <= 0) { - Vprintf ("File has an empty runlist, hence no data.\n"); + Vprintf("File has an empty runlist, hence no data.\n"); continue; } if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ - Vprintf ("Missing segment at beginning, %lld " + Vprintf("Missing segment at beginning, %lld " "clusters\n", (long long)rl[0].length); clusters_inuse += rl[0].length; rl++; @@ -1190,7 +1190,7 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) for (i = 0; rl[i].length > 0; i++) { if (rl[i].lcn == LCN_RL_NOT_MAPPED) { - Vprintf ("Missing segment at end, %lld " + Vprintf("Missing segment at end, %lld " "clusters\n", (long long)rl[i].length); clusters_inuse += rl[i].length; @@ -1206,7 +1206,7 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) end = rl[i].lcn + rl[i].length; for (j = start; j < end; j++) { - if (utils_cluster_in_use (vol, j)) + if (utils_cluster_in_use(vol, j)) clusters_inuse++; else clusters_free++; @@ -1214,17 +1214,17 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) } if ((clusters_inuse + clusters_free) == 0) { - Eprintf ("ERROR: Unexpected error whilst calculating percentage for inode %lld\n", file->inode); + Eprintf("ERROR: Unexpected error whilst calculating percentage for inode %lld\n", file->inode); continue; } data->percent = (clusters_free * 100) / (clusters_inuse + clusters_free); - percent = max (percent, data->percent); + percent = max(percent, data->percent); } - Vprintf ("File is %d%% recoverable\n", percent); + Vprintf("File is %d%% recoverable\n", percent); return percent; } @@ -1243,7 +1243,7 @@ static int calc_percentage (struct ufile *file, ntfs_volume *vol) * * Return: none */ -static void dump_record (struct ufile *file) +static void dump_record(struct ufile *file) { char buffer[20]; const char *name; @@ -1253,88 +1253,88 @@ static void dump_record (struct ufile *file) if (!file) return; - Qprintf ("MFT Record %lld\n", file->inode); - Qprintf ("Type: %s\n", (file->directory) ? "Directory" : "File"); - strftime (buffer, sizeof (buffer), "%F %R", localtime (&file->date)); - Qprintf ("Date: %s\n", buffer); + Qprintf("MFT Record %lld\n", file->inode); + Qprintf("Type: %s\n", (file->directory) ? "Directory" : "File"); + strftime(buffer, sizeof(buffer), "%F %R", localtime(&file->date)); + Qprintf("Date: %s\n", buffer); if (file->attr_list) - Qprintf ("Metadata may span more than one MFT record\n"); + Qprintf("Metadata may span more than one MFT record\n"); - list_for_each (item, &file->name) { - struct filename *f = list_entry (item, struct filename, list); + list_for_each(item, &file->name) { + struct filename *f = list_entry(item, struct filename, list); if (f->name) name = f->name; else name = NONE; - Qprintf ("Filename: (%d) %s\n", f->name_space, f->name); - Qprintf ("File Flags: "); - if (f->flags & FILE_ATTR_SYSTEM) Qprintf ("System "); - if (f->flags & FILE_ATTR_DIRECTORY) Qprintf ("Directory "); - if (f->flags & FILE_ATTR_SPARSE_FILE) Qprintf ("Sparse "); - if (f->flags & FILE_ATTR_REPARSE_POINT) Qprintf ("Reparse "); - if (f->flags & FILE_ATTR_COMPRESSED) Qprintf ("Compressed "); - if (f->flags & FILE_ATTR_ENCRYPTED) Qprintf ("Encrypted "); + Qprintf("Filename: (%d) %s\n", f->name_space, f->name); + Qprintf("File Flags: "); + if (f->flags & FILE_ATTR_SYSTEM) Qprintf("System "); + if (f->flags & FILE_ATTR_DIRECTORY) Qprintf("Directory "); + if (f->flags & FILE_ATTR_SPARSE_FILE) Qprintf("Sparse "); + if (f->flags & FILE_ATTR_REPARSE_POINT) Qprintf("Reparse "); + if (f->flags & FILE_ATTR_COMPRESSED) Qprintf("Compressed "); + if (f->flags & FILE_ATTR_ENCRYPTED) Qprintf("Encrypted "); if (!(f->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_DIRECTORY | FILE_ATTR_SPARSE_FILE | FILE_ATTR_REPARSE_POINT | FILE_ATTR_COMPRESSED | FILE_ATTR_ENCRYPTED))) { - Qprintf ("%s", NONE); + Qprintf("%s", NONE); } - Qprintf ("\n"); + Qprintf("\n"); if (opts.parent) { - Qprintf ("Parent: %s\n", f->parent_name ? f->parent_name : ""); + Qprintf("Parent: %s\n", f->parent_name ? f->parent_name : ""); } - Qprintf ("Size alloc: %lld\n", f->size_alloc); - Qprintf ("Size data: %lld\n", f->size_data); + Qprintf("Size alloc: %lld\n", f->size_alloc); + Qprintf("Size data: %lld\n", f->size_data); - strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_c)); - Qprintf ("Date C: %s\n", buffer); - strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_a)); - Qprintf ("Date A: %s\n", buffer); - strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_m)); - Qprintf ("Date M: %s\n", buffer); - strftime (buffer, sizeof (buffer), "%F %R", localtime (&f->date_r)); - Qprintf ("Date R: %s\n", buffer); + strftime(buffer, sizeof(buffer), "%F %R", localtime(&f->date_c)); + Qprintf("Date C: %s\n", buffer); + strftime(buffer, sizeof(buffer), "%F %R", localtime(&f->date_a)); + Qprintf("Date A: %s\n", buffer); + strftime(buffer, sizeof(buffer), "%F %R", localtime(&f->date_m)); + Qprintf("Date M: %s\n", buffer); + strftime(buffer, sizeof(buffer), "%F %R", localtime(&f->date_r)); + Qprintf("Date R: %s\n", buffer); } - Qprintf ("Data Streams:\n"); - list_for_each (item, &file->data) { - struct data *d = list_entry (item, struct data, list); - Qprintf ("Name: %s\n", (d->name) ? d->name : UNNAMED); - Qprintf ("Flags: "); - if (d->resident) Qprintf ("Resident\n"); - if (d->compressed) Qprintf ("Compressed\n"); - if (d->encrypted) Qprintf ("Encrypted\n"); + Qprintf("Data Streams:\n"); + list_for_each(item, &file->data) { + struct data *d = list_entry(item, struct data, list); + Qprintf("Name: %s\n", (d->name) ? d->name : UNNAMED); + Qprintf("Flags: "); + if (d->resident) Qprintf("Resident\n"); + if (d->compressed) Qprintf("Compressed\n"); + if (d->encrypted) Qprintf("Encrypted\n"); if (!d->resident && !d->compressed && !d->encrypted) - Qprintf ("None\n"); + Qprintf("None\n"); else - Qprintf ("\n"); + Qprintf("\n"); - Qprintf ("Size alloc: %lld\n", d->size_alloc); - Qprintf ("Size data: %lld\n", d->size_data); - Qprintf ("Size init: %lld\n", d->size_init); - Qprintf ("Size vcn: %lld\n", d->size_vcn); + Qprintf("Size alloc: %lld\n", d->size_alloc); + Qprintf("Size data: %lld\n", d->size_data); + Qprintf("Size init: %lld\n", d->size_init); + Qprintf("Size vcn: %lld\n", d->size_vcn); - Qprintf ("Data runs:\n"); + Qprintf("Data runs:\n"); if ((!d->runlist) || (d->runlist[0].length <= 0)) { - Qprintf (" None\n"); + Qprintf(" None\n"); } else { for (i = 0; d->runlist[i].length > 0; i++) { - Qprintf (" %lld @ %lld\n", + Qprintf(" %lld @ %lld\n", (long long)d->runlist[i].length, (long long)d->runlist[i].lcn); } } - Qprintf ("Amount potentially recoverable %d%%\n", d->percent); + Qprintf("Amount potentially recoverable %d%%\n", d->percent); } - Qprintf ("________________________________________\n\n"); + Qprintf("________________________________________\n\n"); } /** @@ -1360,7 +1360,7 @@ static void dump_record (struct ufile *file) * * Return: none */ -static void list_record (struct ufile *file) +static void list_record(struct ufile *file) { char buffer[20]; struct list_head *item; @@ -1370,7 +1370,7 @@ static void list_record (struct ufile *file) char flagd = '.', flagr = '.', flagc = '.', flagx = '.'; - strftime (buffer, sizeof (buffer), "%F", localtime (&file->date)); + strftime(buffer, sizeof(buffer), "%F", localtime(&file->date)); if (file->attr_list) flagx = '!'; @@ -1380,8 +1380,8 @@ static void list_record (struct ufile *file) else flagd = 'F'; - list_for_each (item, &file->data) { - struct data *d = list_entry (item, struct data, list); + list_for_each(item, &file->data) { + struct data *d = list_entry(item, struct data, list); if (!d->name) { if (d->resident) flagr = 'R'; @@ -1389,11 +1389,11 @@ static void list_record (struct ufile *file) if (d->compressed) flagc = 'C'; /* These two are mutually exclusive */ if (d->encrypted) flagc = 'E'; - percent = max (percent, d->percent); + percent = max(percent, d->percent); } - size = max (size, d->size_data); - size = max (size, d->size_init); + size = max(size, d->size_data); + size = max(size, d->size_init); } if (file->pref_name) @@ -1401,7 +1401,7 @@ static void list_record (struct ufile *file) else name = NONE; - Qprintf ("%-8lld %c%c%c%c %3d%% %s %9lld %s\n", + Qprintf("%-8lld %c%c%c%c %3d%% %s %9lld %s\n", file->inode, flagd, flagr, flagc, flagx, percent, buffer, size, name); @@ -1418,7 +1418,7 @@ static void list_record (struct ufile *file) * Return: 1 There is a matching filename. * 0 There is no match. */ -static int name_match (regex_t *re, struct ufile *file) +static int name_match(regex_t *re, struct ufile *file) { struct list_head *item; int result; @@ -1426,14 +1426,14 @@ static int name_match (regex_t *re, struct ufile *file) if (!re || !file) return 0; - list_for_each (item, &file->name) { - struct filename *f = list_entry (item, struct filename, list); + list_for_each(item, &file->name) { + struct filename *f = list_entry(item, struct filename, list); if (!f->name) continue; - result = regexec (re, f->name, 0, NULL, 0); + result = regexec(re, f->name, 0, NULL, 0); if (result < 0) { - Eprintf ("Couldn't compare filename with regex: %s\n", strerror (errno)); + Eprintf("Couldn't compare filename with regex: %s\n", strerror(errno)); return 0; } else if (result == REG_NOERROR) { ntfs_log_debug("Found a matching filename.\n"); @@ -1456,7 +1456,7 @@ static int name_match (regex_t *re, struct ufile *file) * Return: -1 Error, something went wrong * 0 Success, all the data was written */ -static unsigned int write_data (int fd, const char *buffer, +static unsigned int write_data(int fd, const char *buffer, unsigned int bufsize) { ssize_t result1, result2; @@ -1466,7 +1466,7 @@ static unsigned int write_data (int fd, const char *buffer, return -1; } - result1 = write (fd, buffer, bufsize); + result1 = write(fd, buffer, bufsize); if ((result1 == (ssize_t) bufsize) || (result1 < 0)) return result1; @@ -1474,7 +1474,7 @@ static unsigned int write_data (int fd, const char *buffer, buffer += result1; bufsize -= result1; - result2 = write (fd, buffer, bufsize); + result2 = write(fd, buffer, bufsize); if (result2 < 0) return result1; @@ -1504,7 +1504,7 @@ static unsigned int write_data (int fd, const char *buffer, * * Return: n Length of the allocated name */ -static int create_pathname (const char *dir, const char *name, +static int create_pathname(const char *dir, const char *name, const char *stream, char *buffer, int bufsize) { if (!name) @@ -1512,16 +1512,16 @@ static int create_pathname (const char *dir, const char *name, if (dir) if (stream) - snprintf (buffer, bufsize, "%s/%s:%s", dir, name, stream); + snprintf(buffer, bufsize, "%s/%s:%s", dir, name, stream); else - snprintf (buffer, bufsize, "%s/%s", dir, name); + snprintf(buffer, bufsize, "%s/%s", dir, name); else if (stream) - snprintf (buffer, bufsize, "%s:%s", name, stream); + snprintf(buffer, bufsize, "%s:%s", name, stream); else - snprintf (buffer, bufsize, "%s", name); + snprintf(buffer, bufsize, "%s", name); - return strlen (buffer); + return strlen(buffer); } /** @@ -1535,18 +1535,18 @@ static int create_pathname (const char *dir, const char *name, * Return: -1 Error, failed to create the file * n Success, this is the file descriptor */ -static int open_file (const char *pathname) +static int open_file(const char *pathname) { int flags; - Vprintf ("Creating file: %s\n", pathname); + Vprintf("Creating file: %s\n", pathname); if (opts.force) flags = O_RDWR | O_CREAT | O_TRUNC; else flags = O_RDWR | O_CREAT | O_EXCL; - return open (pathname, flags, S_IRUSR | S_IWUSR); + return open(pathname, flags, S_IRUSR | S_IWUSR); } /** @@ -1559,7 +1559,7 @@ static int open_file (const char *pathname) * Return: 1 Success, set the file's date and time * 0 Error, failed to change the file's date and time */ -static int set_date (const char *pathname, time_t date) +static int set_date(const char *pathname, time_t date) { struct utimbuf ut; @@ -1568,8 +1568,8 @@ static int set_date (const char *pathname, time_t date) ut.actime = date; ut.modtime = date; - if (utime (pathname, &ut)) { - Eprintf ("ERROR: Couldn't set the file's date and time\n"); + if (utime(pathname, &ut)) { + Eprintf("ERROR: Couldn't set the file's date and time\n"); return 0; } return 1; @@ -1597,7 +1597,7 @@ static int set_date (const char *pathname, time_t date) * Return: 0 Error, something went wrong * 1 Success, the data was recovered */ -static int undelete_file (ntfs_volume *vol, long long inode) +static int undelete_file(ntfs_volume *vol, long long inode) { char pathname[256]; char *buffer = NULL; @@ -1617,101 +1617,101 @@ static int undelete_file (ntfs_volume *vol, long long inode) return 0; /* try to get record */ - file = read_record (vol, inode); + file = read_record(vol, inode); if (!file || !file->mft) { - Eprintf ("Can't read info from mft record %lld.\n", inode); + Eprintf("Can't read info from mft record %lld.\n", inode); return 0; } /* if flag was not set, print file informations */ if (avoid_duplicate_printing == 0) { if (opts.verbose) { - dump_record (file); + dump_record(file); } else { - list_record (file); - //Qprintf ("\n"); + list_record(file); + //Qprintf("\n"); } } bufsize = vol->cluster_size; - buffer = malloc (bufsize); + buffer = malloc(bufsize); if (!buffer) goto free; if (file->mft->flags & MFT_RECORD_IN_USE) { /* These two statement blocks were */ - Eprintf ("Record is in use by the mft\n"); /* relocated from below because */ + Eprintf("Record is in use by the mft\n"); /* relocated from below because */ if (!opts.force) { /* calc_percentage() must be called */ free(buffer); - free_file (file); /* before dump_record() or list_record(). */ + free_file(file); /* before dump_record() or list_record(). */ return 0; /* Otherwise, when undeleting, a file */ } /* will always be listed as 0% recoverable */ - Vprintf ("Forced to continue.\n"); /* even if successfully undeleted. +mabs */ + Vprintf("Forced to continue.\n"); /* even if successfully undeleted. +mabs */ } - if (calc_percentage (file, vol) == 0) { - Qprintf ("File has no recoverable data.\n"); + if (calc_percentage(file, vol) == 0) { + Qprintf("File has no recoverable data.\n"); goto free; } - if (list_empty (&file->data)) { - Qprintf ("File has no data. There is nothing to recover.\n"); + if (list_empty(&file->data)) { + Qprintf("File has no data. There is nothing to recover.\n"); goto free; } - list_for_each (item, &file->data) { - struct data *d = list_entry (item, struct data, list); + list_for_each(item, &file->data) { + struct data *d = list_entry(item, struct data, list); if (opts.output) name = opts.output; else name = file->pref_name; - create_pathname (opts.dest, name, d->name, pathname, sizeof (pathname)); + create_pathname(opts.dest, name, d->name, pathname, sizeof(pathname)); if (d->resident) { - fd = open_file (pathname); + fd = open_file(pathname); if (fd < 0) { - Eprintf ("Couldn't create file: %s\n", strerror (errno)); + Eprintf("Couldn't create file: %s\n", strerror(errno)); goto free; } - Vprintf ("File has resident data.\n"); - if (write_data (fd, d->data, d->size_data) < d->size_data) { - Eprintf ("Write failed: %s\n", strerror (errno)); - close (fd); + Vprintf("File has resident data.\n"); + if (write_data(fd, d->data, d->size_data) < d->size_data) { + Eprintf("Write failed: %s\n", strerror(errno)); + close(fd); goto free; } - if (close (fd) < 0) { - Eprintf ("Close failed: %s\n", strerror (errno)); + if (close(fd) < 0) { + Eprintf("Close failed: %s\n", strerror(errno)); } fd = -1; } else { rl = d->runlist; if (!rl) { - Vprintf ("File has no runlist, hence no data.\n"); + Vprintf("File has no runlist, hence no data.\n"); continue; } if (rl[0].length <= 0) { - Vprintf ("File has an empty runlist, hence no data.\n"); + Vprintf("File has an empty runlist, hence no data.\n"); continue; } - fd = open_file (pathname); + fd = open_file(pathname); if (fd < 0) { - Eprintf ("Couldn't create output file: %s\n", strerror (errno)); + Eprintf("Couldn't create output file: %s\n", strerror(errno)); goto free; } if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ - Vprintf ("Missing segment at beginning, %lld " + Vprintf("Missing segment at beginning, %lld " "clusters.\n", (long long)rl[0].length); - memset (buffer, opts.fillbyte, bufsize); + memset(buffer, opts.fillbyte, bufsize); for (k = 0; k < rl[0].length * vol->cluster_size; k += bufsize) { - if (write_data (fd, buffer, bufsize) < bufsize) { - Eprintf ("Write failed: %s\n", strerror (errno)); - close (fd); + if (write_data(fd, buffer, bufsize) < bufsize) { + Eprintf("Write failed: %s\n", strerror(errno)); + close(fd); goto free; } } @@ -1721,14 +1721,14 @@ static int undelete_file (ntfs_volume *vol, long long inode) for (i = 0; rl[i].length > 0; i++) { if (rl[i].lcn == LCN_RL_NOT_MAPPED) { - Vprintf ("Missing segment at end, " + Vprintf("Missing segment at end, " "%lld clusters.\n", (long long)rl[i].length); - memset (buffer, opts.fillbyte, bufsize); + memset(buffer, opts.fillbyte, bufsize); for (k = 0; k < rl[k].length * vol->cluster_size; k += bufsize) { - if (write_data (fd, buffer, bufsize) < bufsize) { - Eprintf ("Write failed: %s\n", strerror (errno)); - close (fd); + if (write_data(fd, buffer, bufsize) < bufsize) { + Eprintf("Write failed: %s\n", strerror(errno)); + close(fd); goto free; } cluster_count++; @@ -1737,12 +1737,12 @@ static int undelete_file (ntfs_volume *vol, long long inode) } if (rl[i].lcn == LCN_HOLE) { - Vprintf ("File has a sparse section.\n"); - memset (buffer, 0, bufsize); + Vprintf("File has a sparse section.\n"); + memset(buffer, 0, bufsize); for (k = 0; k < rl[k].length * vol->cluster_size; k += bufsize) { - if (write_data (fd, buffer, bufsize) < bufsize) { - Eprintf ("Write failed: %s\n", strerror (errno)); - close (fd); + if (write_data(fd, buffer, bufsize) < bufsize) { + Eprintf("Write failed: %s\n", strerror(errno)); + close(fd); goto free; } } @@ -1753,42 +1753,44 @@ static int undelete_file (ntfs_volume *vol, long long inode) end = rl[i].lcn + rl[i].length; for (j = start; j < end; j++) { - if (utils_cluster_in_use (vol, j) && !opts.optimistic) { - memset (buffer, opts.fillbyte, bufsize); - if (write_data (fd, buffer, bufsize) < bufsize) { - Eprintf ("Write failed: %s\n", strerror (errno)); - close (fd); + if (utils_cluster_in_use(vol, j) && !opts.optimistic) { + memset(buffer, opts.fillbyte, bufsize); + if (write_data(fd, buffer, bufsize) < bufsize) { + Eprintf("Write failed: %s\n", strerror(errno)); + close(fd); goto free; } } else { if (ntfs_cluster_read(vol, j, 1, buffer) < 1) { - Eprintf ("Read failed: %s\n", strerror (errno)); - close (fd); + Eprintf("Read failed: %s\n", strerror(errno)); + close(fd); goto free; } - if (write_data (fd, buffer, bufsize) < bufsize) { - Eprintf ("Write failed: %s\n", strerror (errno)); - close (fd); + if (write_data(fd, buffer, bufsize) < bufsize) { + Eprintf("Write failed: %s\n", strerror(errno)); + close(fd); goto free; } cluster_count++; } } } - Qprintf ("\n"); + Qprintf("\n"); - /* The following block of code implements the --truncate option. */ - /* Its semantics are as follows: */ - /* IF opts.truncate is set AND data stream currently being recovered is */ - /* non-resident AND data stream has no holes (100% recoverability) AND */ - /* 0 <= (data->size_alloc - data->size_data) <= vol->cluster_size AND */ - /* cluster_count * vol->cluster_size == data->size_alloc THEN file */ - /* currently being written is truncated to data->size_data bytes before */ - /* it's closed. */ - /* This multiple checks try to ensure that only files with consistent */ - /* values of size/occupied clusters are eligible for truncation. Note */ - /* that resident streams need not be truncated, since the original code */ - /* already recovers their exact length. +mabs */ + /* + * The following block of code implements the --truncate option. + * Its semantics are as follows: + * IF opts.truncate is set AND data stream currently being recovered is + * non-resident AND data stream has no holes (100% recoverability) AND + * 0 <= (data->size_alloc - data->size_data) <= vol->cluster_size AND + * cluster_count * vol->cluster_size == data->size_alloc THEN file + * currently being written is truncated to data->size_data bytes before + * it's closed. + * This multiple checks try to ensure that only files with consistent + * values of size/occupied clusters are eligible for truncation. Note + * that resident streams need not be truncated, since the original code + * already recovers their exact length. +mabs + */ if (opts.truncate) { if (d->percent == 100 && d->size_alloc >= d->size_data && @@ -1800,23 +1802,23 @@ static int undelete_file (ntfs_volume *vol, long long inode) "inconsistent $MFT record.\n"); } - if (close (fd) < 0) { - Eprintf ("Close failed: %s\n", strerror (errno)); + if (close(fd) < 0) { + Eprintf("Close failed: %s\n", strerror(errno)); } fd = -1; } - set_date (pathname, file->date); + set_date(pathname, file->date); if (d->name) - Qprintf ("Undeleted '%s:%s' successfully.\n", file->pref_name, d->name); + Qprintf("Undeleted '%s:%s' successfully.\n", file->pref_name, d->name); else - Qprintf ("Undeleted '%s' successfully.\n", file->pref_name); + Qprintf("Undeleted '%s' successfully.\n", file->pref_name); } result = 1; free: if (buffer) - free (buffer); - free_file (file); + free(buffer); + free_file(file); return result; } @@ -1832,7 +1834,7 @@ free: * Return: -1 Error, something went wrong * n Success, the number of recoverable files */ -static int scan_disk (ntfs_volume *vol) +static int scan_disk(ntfs_volume *vol) { s64 nr_mft_records; const int BUFSIZE = 8192; @@ -1849,16 +1851,16 @@ static int scan_disk (ntfs_volume *vol) if (!vol) return -1; - attr = ntfs_attr_open (vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0); + attr = ntfs_attr_open(vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0); if (!attr) { - Eprintf ("ERROR: Couldn't open $MFT/$BITMAP: %s\n", strerror (errno)); + Eprintf("ERROR: Couldn't open $MFT/$BITMAP: %s\n", strerror(errno)); return -1; } bmpsize = attr->initialized_size; - buffer = malloc (BUFSIZE); + buffer = malloc(BUFSIZE); if (!buffer) { - Eprintf ("ERROR: Couldn't allocate memory in scan_disk()\n"); + Eprintf("ERROR: Couldn't allocate memory in scan_disk()\n"); results = -1; goto out; } @@ -1868,8 +1870,8 @@ static int scan_disk (ntfs_volume *vol) if (!opts.match_case) flags |= REG_ICASE; - if (regcomp (&re, opts.match, flags)) { - Eprintf ("ERROR: Couldn't create a regex.\n"); + if (regcomp(&re, opts.match, flags)) { + Eprintf("ERROR: Couldn't create a regex.\n"); goto out; } } @@ -1877,11 +1879,11 @@ static int scan_disk (ntfs_volume *vol) nr_mft_records = vol->mft_na->initialized_size >> vol->mft_record_size_bits; - Qprintf ("Inode Flags %%age Date Size Filename\n"); - Qprintf ("---------------------------------------------------------------\n"); + Qprintf("Inode Flags %%age Date Size Filename\n"); + Qprintf("---------------------------------------------------------------\n"); for (i = 0; i < bmpsize; i += BUFSIZE) { - long long read_count = min ((bmpsize - i), BUFSIZE); - size = ntfs_attr_pread (attr, i, read_count, buffer); + long long read_count = min((bmpsize - i), BUFSIZE); + size = ntfs_attr_pread(attr, i, read_count, buffer); if (size < 0) break; @@ -1892,36 +1894,36 @@ static int scan_disk (ntfs_volume *vol) goto done; if (b & 1) continue; - file = read_record (vol, (i+j)*8+k); + file = read_record(vol, (i+j)*8+k); if (!file) { - Eprintf ("Couldn't read MFT Record %d.\n", (i+j)*8+k); + Eprintf("Couldn't read MFT Record %d.\n", (i+j)*8+k); continue; } if ((opts.since > 0) && (file->date <= opts.since)) goto skip; - if (opts.match && !name_match (&re, file)) + if (opts.match && !name_match(&re, file)) goto skip; if (opts.size_begin && (opts.size_begin > file->max_size)) goto skip; if (opts.size_end && (opts.size_end < file->max_size)) goto skip; - percent = calc_percentage (file, vol); + percent = calc_percentage(file, vol); if ((opts.percent == -1) || (percent >= opts.percent)) { if (opts.verbose) - dump_record (file); + dump_record(file); else - list_record (file); + list_record(file); /* Was -u specified with no inode so undelete file by regex */ if (opts.mode == MODE_UNDELETE) { - if (!undelete_file (vol, file->inode)) - Vprintf ("ERROR: Failed to undelete " - "inode %lli\n!", - file->inode); - printf ("\n"); + if (!undelete_file(vol, file->inode)) + Vprintf("ERROR: Failed to undelete " + "inode %lli\n!", + file->inode); + printf("\n"); } } if (((opts.percent == -1) && (percent > 0)) || @@ -1929,18 +1931,18 @@ static int scan_disk (ntfs_volume *vol) results++; } skip: - free_file (file); + free_file(file); } } } done: - Qprintf ("\nFiles with potentially recoverable content: %d\n", results); + Qprintf("\nFiles with potentially recoverable content: %d\n", results); out: if (opts.match) - regfree (&re); - free (buffer); + regfree(&re); + free(buffer); if (attr) - ntfs_attr_close (attr); + ntfs_attr_close(attr); return results; } @@ -1955,7 +1957,7 @@ out: * Return: 0 Success, all the records were written * 1 Error, something went wrong */ -static int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) +static int copy_mft(ntfs_volume *vol, long long mft_begin, long long mft_end) { s64 nr_mft_records; char pathname[256]; @@ -1970,19 +1972,19 @@ static int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) return 1; if (mft_end < mft_begin) { - Eprintf ("Range to copy is backwards.\n"); + Eprintf("Range to copy is backwards.\n"); return 1; } - buffer = malloc (vol->mft_record_size); + buffer = malloc(vol->mft_record_size); if (!buffer) { - Eprintf ("Couldn't allocate memory in copy_mft()\n"); + Eprintf("Couldn't allocate memory in copy_mft()\n"); return 1; } - mft = ntfs_attr_open (vol->mft_ni, AT_DATA, AT_UNNAMED, 0); + mft = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0); if (!mft) { - Eprintf ("Couldn't open $MFT/$DATA: %s\n", strerror (errno)); + Eprintf("Couldn't open $MFT/$DATA: %s\n", strerror(errno)); goto free; } @@ -1993,17 +1995,17 @@ static int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) name); } - create_pathname (opts.dest, name, NULL, pathname, sizeof (pathname)); - fd = open_file (pathname); + create_pathname(opts.dest, name, NULL, pathname, sizeof(pathname)); + fd = open_file(pathname); if (fd < 0) { - Eprintf ("Couldn't open output file '%s': %s\n", name, strerror (errno)); + Eprintf("Couldn't open output file '%s': %s\n", name, strerror(errno)); goto attr; } nr_mft_records = vol->mft_na->initialized_size >> vol->mft_record_size_bits; - mft_end = min (mft_end, nr_mft_records - 1); + mft_end = min(mft_end, nr_mft_records - 1); ntfs_log_debug("MFT records:\n"); ntfs_log_debug("\tTotal: %8lld\n", nr_mft_records); @@ -2011,25 +2013,25 @@ static int copy_mft (ntfs_volume *vol, long long mft_begin, long long mft_end) ntfs_log_debug("\tEnd: %8lld\n", mft_end); for (i = mft_begin; i <= mft_end; i++) { - if (ntfs_attr_pread (mft, vol->mft_record_size * i, vol->mft_record_size, buffer) < vol->mft_record_size) { - Eprintf ("Couldn't read MFT Record %lld: %s.\n", i, strerror (errno)); + if (ntfs_attr_pread(mft, vol->mft_record_size * i, vol->mft_record_size, buffer) < vol->mft_record_size) { + Eprintf("Couldn't read MFT Record %lld: %s.\n", i, strerror(errno)); goto close; } - if (write_data (fd, buffer, vol->mft_record_size) < vol->mft_record_size) { - Eprintf ("Write failed: %s\n", strerror (errno)); + if (write_data(fd, buffer, vol->mft_record_size) < vol->mft_record_size) { + Eprintf("Write failed: %s\n", strerror(errno)); goto close; } } - Vprintf ("Read %lld MFT Records\n", mft_end - mft_begin + 1); + Vprintf("Read %lld MFT Records\n", mft_end - mft_begin + 1); result = 0; close: - close (fd); + close(fd); attr: - ntfs_attr_close (mft); + ntfs_attr_close(mft); free: - free (buffer); + free(buffer); return result; } @@ -2037,7 +2039,7 @@ free: * handle_undelete * Handles the undelete */ -static int handle_undelete (ntfs_volume *vol) +static int handle_undelete(ntfs_volume *vol) { int result = 1; int i; @@ -2046,25 +2048,25 @@ static int handle_undelete (ntfs_volume *vol) /* Check whether (an) inode(s) was specified or at least a regex! */ if (nr_entries == 0) { if (with_regex == 0) { - printf ("ERROR: NO inode(s) AND NO match-regex specified!\n"); + printf("ERROR: NO inode(s) AND NO match-regex specified!\n"); } else { avoid_duplicate_printing= 1; - result = !scan_disk (vol); + result = !scan_disk(vol); if (result) - Vprintf ("ERROR: Failed to scan device '%s'.\n", opts.device); + Vprintf("ERROR: Failed to scan device '%s'.\n", opts.device); } } else { /* Normal undelete by specifying inode(s) */ - Qprintf ("Inode Flags %%age Date Size Filename\n"); - Qprintf ("---------------------------------------------------------------\n"); + Qprintf("Inode Flags %%age Date Size Filename\n"); + Qprintf("---------------------------------------------------------------\n"); /* loop all given inodes */ for (i = 0; i < nr_entries; i++) { for (inode = ranges[i].begin; inode <= ranges[i].end; inode ++) { /* Now undelete file */ - result = !undelete_file (vol, inode); + result = !undelete_file(vol, inode); if (result) - Vprintf ("ERROR: Failed to undelete " + Vprintf("ERROR: Failed to undelete " "inode %lli\n!", inode); } @@ -2081,7 +2083,7 @@ static int handle_undelete (ntfs_volume *vol) * Return: 0 Success, the program worked * 1 Error, something went wrong */ -int main (int argc, char *argv[]) +int main(int argc, char *argv[]) { ntfs_volume *vol; int result = 1; @@ -2089,12 +2091,12 @@ int main (int argc, char *argv[]) with_regex = 0; avoid_duplicate_printing = 0; - if (!parse_options (argc, argv)) + if (!parse_options(argc, argv)) goto free; utils_set_locale(); - vol = utils_mount_volume (opts.device, MS_RDONLY, opts.force); + vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); if (!vol) return 1; @@ -2102,21 +2104,21 @@ int main (int argc, char *argv[]) switch (opts.mode) { /* Scanning */ case MODE_SCAN: - result = !scan_disk (vol); + result = !scan_disk(vol); if (result) - Vprintf ("ERROR: Failed to scan device '%s'.\n", opts.device); + Vprintf("ERROR: Failed to scan device '%s'.\n", opts.device); break; /* Undelete-handling */ case MODE_UNDELETE: - result= handle_undelete (vol); + result= handle_undelete(vol); break; /* Handling of copy mft */ case MODE_COPY: - result = !copy_mft (vol, opts.mft_begin, opts.mft_end); + result = !copy_mft(vol, opts.mft_begin, opts.mft_end); if (result) - Vprintf ("ERROR: Failed to read MFT blocks %lld-%lld.\n", + Vprintf("ERROR: Failed to read MFT blocks %lld-%lld.\n", opts.mft_begin, min((vol->mft_na->initialized_size >> vol->mft_record_size_bits) , opts.mft_end)); @@ -2125,10 +2127,10 @@ int main (int argc, char *argv[]) ; /* Cannot happen */ } - ntfs_umount (vol, FALSE); + ntfs_umount(vol, FALSE); free: if (opts.match) - free (opts.match); + free(opts.match); return result; } diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 30a352c7..6f54af07 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -59,9 +59,9 @@ static const char *EXEC_NAME = "ntfswipe"; static struct options opts; -GEN_PRINTF (Eprintf, stderr, NULL, FALSE) -GEN_PRINTF (Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) +GEN_PRINTF(Eprintf, stderr, NULL, FALSE) +GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) +GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) /** * version - Print version information about the program @@ -70,14 +70,14 @@ GEN_PRINTF (Qprintf, stdout, &opts.quiet, FALSE) * * Return: none */ -static void version (void) +static void version(void) { printf("\n%s v%s (libntfs %s) - Overwrite the unused space on an NTFS " "Volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf ("Copyright (c) 2002-2003 Richard Russon\n"); - printf ("Copyright (c) 2004 Yura Pakhuchiy\n"); - printf ("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + printf("Copyright (c) 2002-2003 Richard Russon\n"); + printf("Copyright (c) 2004 Yura Pakhuchiy\n"); + printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -87,9 +87,9 @@ static void version (void) * * Return: none */ -static void usage (void) +static void usage(void) { - printf ("\nUsage: %s [options] device\n" + printf("\nUsage: %s [options] device\n" " -i --info Show volume information (default)\n" "\n" " -d --directory Wipe directory indexes\n" @@ -101,8 +101,8 @@ static void usage (void) "\n" " -a --all Wipe all unused space\n" "\n" - " -c num --count num Number of times to write (default = 1)\n" - " -b list --bytes list List of values to write (default = 0)\n" + " -c num --count num Number of times to write(default = 1)\n" + " -b list --bytes list List of values to write(default = 0)\n" "\n" " -n --no-action Do not write to disk\n" " -f --force Use less caution\n" @@ -111,7 +111,7 @@ static void usage (void) " -V --version Version information\n" " -h --help Print this help\n\n", EXEC_NAME); - printf ("%s%s\n", ntfs_bugs, ntfs_home); + printf("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -128,7 +128,7 @@ static void usage (void) * Return: 0 Error, invalid string * n Success, the count of numbers parsed */ -static int parse_list (char *list, int **result) +static int parse_list(char *list, int **result) { char *ptr; char *end; @@ -139,31 +139,31 @@ static int parse_list (char *list, int **result) if (!list || !result) return 0; - for (count = 0, ptr = list; ptr; ptr = strchr (ptr+1, ',')) + for (count = 0, ptr = list; ptr; ptr = strchr(ptr+1, ',')) count++; - mem = malloc ((count+1) * sizeof (int)); + mem = malloc((count+1) * sizeof(int)); if (!mem) { - Eprintf ("Couldn't allocate memory in parse_list().\n"); + Eprintf("Couldn't allocate memory in parse_list().\n"); return 0; } - memset (mem, 0xFF, (count+1) * sizeof (int)); + memset(mem, 0xFF, (count+1) * sizeof(int)); for (ptr = list, i = 0; i < count; i++) { end = NULL; - mem[i] = strtol (ptr, &end, 0); + mem[i] = strtol(ptr, &end, 0); if (!end || (end == ptr) || ((*end != ',') && (*end != 0))) { - Eprintf ("Invalid list '%s'\n", list); - free (mem); + Eprintf("Invalid list '%s'\n", list); + free(mem); return 0; } if ((mem[i] < 0) || (mem[i] > 255)) { - Eprintf ("Bytes must be in range 0-255.\n"); - free (mem); + Eprintf("Bytes must be in range 0-255.\n"); + free(mem); return 0; } @@ -188,7 +188,7 @@ static int parse_list (char *list, int **result) * Return: 1 Success * 0 Error, one or more problems */ -static int parse_options (int argc, char *argv[]) +static int parse_options(int argc, char *argv[]) { static const char *sopt = "-ab:c:dfh?ilmnpqtuvV"; static struct option lopt[] = { @@ -222,7 +222,7 @@ static int parse_options (int argc, char *argv[]) opts.count = 1; - while ((c = getopt_long (argc, argv, sopt, lopt, NULL)) != -1) { + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) { switch (c) { case 1: /* A non-option argument */ if (!opts.device) { @@ -245,7 +245,7 @@ static int parse_options (int argc, char *argv[]) break; case 'b': if (!opts.bytes) { - if (!parse_list (optarg, &opts.bytes)) + if (!parse_list(optarg, &opts.bytes)) err++; } else { err++; @@ -254,7 +254,7 @@ static int parse_options (int argc, char *argv[]) case 'c': if (opts.count == 1) { end = NULL; - opts.count = strtol (optarg, &end, 0); + opts.count = strtol(optarg, &end, 0); if (end && *end) err++; } else { @@ -300,9 +300,9 @@ static int parse_options (int argc, char *argv[]) break; default: if ((optopt == 'b') || (optopt == 'c')) { - Eprintf ("Option '%s' requires an argument.\n", argv[optind-1]); + Eprintf("Option '%s' requires an argument.\n", argv[optind-1]); } else { - Eprintf ("Unknown option '%s'.\n", argv[optind-1]); + Eprintf("Unknown option '%s'.\n", argv[optind-1]); } err++; break; @@ -314,35 +314,35 @@ static int parse_options (int argc, char *argv[]) } else { if (opts.device == NULL) { if (argc > 1) - Eprintf ("You must specify exactly one device.\n"); + Eprintf("You must specify exactly one device.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf ("You may not use --quiet and --verbose at the same time.\n"); + Eprintf("You may not use --quiet and --verbose at the same time.\n"); err++; } /* if (opts.info && (opts.unused || opts.tails || opts.mft || opts.directory)) { - Eprintf ("You may not use any other options with --info.\n"); + Eprintf("You may not use any other options with --info.\n"); err++; } */ if ((opts.count < 1) || (opts.count > 100)) { - Eprintf ("The iteration count must be between 1 and 100.\n"); + Eprintf("The iteration count must be between 1 and 100.\n"); err++; } /* Create a default list */ if (!opts.bytes) { - opts.bytes = malloc (2 * sizeof (int)); + opts.bytes = malloc(2 * sizeof(int)); if (opts.bytes) { opts.bytes[0] = 0; opts.bytes[1] = -1; } else { - Eprintf ("Couldn't allocate memory for byte list.\n"); + Eprintf("Couldn't allocate memory for byte list.\n"); err++; } } @@ -373,7 +373,7 @@ static int parse_options (int argc, char *argv[]) * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_unused (ntfs_volume *vol, int byte, enum action act) +static s64 wipe_unused(ntfs_volume *vol, int byte, enum action act) { s64 i; s64 total = 0; @@ -384,25 +384,25 @@ static s64 wipe_unused (ntfs_volume *vol, int byte, enum action act) return -1; if (act != act_info) { - buffer = malloc (vol->cluster_size); + buffer = malloc(vol->cluster_size); if (!buffer) { - Eprintf ("malloc failed\n"); + Eprintf("malloc failed\n"); return -1; } - memset (buffer, byte, vol->cluster_size); + memset(buffer, byte, vol->cluster_size); } for (i = 0; i < vol->nr_clusters; i++) { - if (utils_cluster_in_use (vol, i)) { - //Vprintf ("cluster %lld is in use\n", i); + if (utils_cluster_in_use(vol, i)) { + //Vprintf("cluster %lld is in use\n", i); continue; } if (act == act_wipe) { - //Vprintf ("cluster %lld is not in use\n", i); - result = ntfs_pwrite (vol->dev, vol->cluster_size * i, vol->cluster_size, buffer); + //Vprintf("cluster %lld is not in use\n", i); + result = ntfs_pwrite(vol->dev, vol->cluster_size * i, vol->cluster_size, buffer); if (result != vol->cluster_size) { - Eprintf ("write failed\n"); + Eprintf("write failed\n"); goto free; } } @@ -410,9 +410,9 @@ static s64 wipe_unused (ntfs_volume *vol, int byte, enum action act) total += vol->cluster_size; } - Qprintf ("wipe_unused 0x%02x, %lld bytes\n", byte, (long long)total); + Qprintf("wipe_unused 0x%02x, %lld bytes\n", byte, (long long)total); free: - free (buffer); + free(buffer); return total; } @@ -427,7 +427,7 @@ free: * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, +static s64 wipe_compressed_attribute(ntfs_volume *vol, int byte, enum action act, ntfs_attr *na) { unsigned char *buf; @@ -458,12 +458,12 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, rlt = rlc; while ((rlt - 1)->lcn == LCN_HOLE) rlt--; while (1) { - ret = ntfs_rl_pread (vol, na->rl, + ret = ntfs_rl_pread(vol, na->rl, offset, 2, &block_size); - block_size = le16_to_cpu (block_size); + block_size = le16_to_cpu(block_size); if (ret != 2) { - Vprintf ("Internal error\n"); - Eprintf ("ntfs_rl_pread failed"); + Vprintf("Internal error\n"); + Eprintf("ntfs_rl_pread failed"); return -1; } if (block_size == 0) { @@ -484,8 +484,8 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, } if (size < 0) { - Vprintf ("Internal error\n"); - Eprintf ("bug or damaged fs: we want " + Vprintf("Internal error\n"); + Eprintf("bug or damaged fs: we want " "allocate buffer size %lld bytes", size); return -1; } @@ -496,20 +496,20 @@ static s64 wipe_compressed_attribute (ntfs_volume *vol, int byte, continue; } - buf = malloc (size); + buf = malloc(size); if (!buf) { - Vprintf ("Not enough memory\n"); - Eprintf ("Not enough memory to allocate " + Vprintf("Not enough memory\n"); + Eprintf("Not enough memory to allocate " "%lld bytes", size); return -1; } - memset (buf, byte, size); + memset(buf, byte, size); - ret = ntfs_rl_pwrite (vol, na->rl, offset, size, buf); - free (buf); + ret = ntfs_rl_pwrite(vol, na->rl, offset, size, buf); + free(buf); if (ret != size) { - Vprintf ("Internal error\n"); - Eprintf ("ntfs_rl_pwrite failed, offset %llu, " + Vprintf("Internal error\n"); + Eprintf("ntfs_rl_pwrite failed, offset %llu, " "size %lld, vcn %lld", offset, size, rlc->vcn); return -1; } @@ -532,7 +532,7 @@ next: * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_attribute (ntfs_volume *vol, int byte, enum action act, +static s64 wipe_attribute(ntfs_volume *vol, int byte, enum action act, ntfs_attr *na) { unsigned char *buf; @@ -549,21 +549,21 @@ static s64 wipe_attribute (ntfs_volume *vol, int byte, enum action act, if (act == act_info) return size; - buf = malloc (size); + buf = malloc(size); if (!buf) { - Vprintf ("Not enough memory\n"); - Eprintf ("Not enough memory to allocate %lld bytes", size); + Vprintf("Not enough memory\n"); + Eprintf("Not enough memory to allocate %lld bytes", size); return -1; } - memset (buf, byte, size); + memset(buf, byte, size); - wiped = ntfs_rl_pwrite (vol, na->rl, offset, size, buf); + wiped = ntfs_rl_pwrite(vol, na->rl, offset, size, buf); if (wiped == -1) { - Vprintf ("Internal error\n"); - Eprintf ("Couldn't wipe tail"); + Vprintf("Internal error\n"); + Eprintf("Couldn't wipe tail"); } - free (buf); + free(buf); return wiped; } @@ -580,7 +580,7 @@ static s64 wipe_attribute (ntfs_volume *vol, int byte, enum action act, * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) +static s64 wipe_tails(ntfs_volume *vol, int byte, enum action act) { s64 total = 0; s64 nr_mft_records, inode_num; @@ -596,56 +596,56 @@ static s64 wipe_tails (ntfs_volume *vol, int byte, enum action act) for (inode_num = 16; inode_num < nr_mft_records; inode_num++) { s64 wiped; - Vprintf ("Inode %lld - ", inode_num); - ni = ntfs_inode_open (vol, inode_num); + Vprintf("Inode %lld - ", inode_num); + ni = ntfs_inode_open(vol, inode_num); if (!ni) { - Vprintf ("Could not open inode\n"); + Vprintf("Could not open inode\n"); continue; } if (ni->mrec->base_mft_record) { - Vprintf ("Not base mft record. Skipping\n"); + Vprintf("Not base mft record. Skipping\n"); goto close_inode; } - na = ntfs_attr_open (ni, AT_DATA, AT_UNNAMED, 0); + na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); if (!na) { - Vprintf ("Couldn't open $DATA attribute\n"); + Vprintf("Couldn't open $DATA attribute\n"); goto close_inode; } if (!NAttrNonResident(na)) { - Vprintf ("Resident $DATA attribute. Skipping.\n"); + Vprintf("Resident $DATA attribute. Skipping.\n"); goto close_attr; } if (ntfs_attr_map_whole_runlist(na)) { - Vprintf ("Internal error\n"); - Eprintf ("Can't map runlist (inode %lld)\n", inode_num); + Vprintf("Internal error\n"); + Eprintf("Can't map runlist (inode %lld)\n", inode_num); goto close_attr; } if (NAttrCompressed(na)) - wiped = wipe_compressed_attribute (vol, byte, act, na); + wiped = wipe_compressed_attribute(vol, byte, act, na); else - wiped = wipe_attribute (vol, byte, act, na); + wiped = wipe_attribute(vol, byte, act, na); if (wiped == -1) { - Eprintf (" (inode %lld)\n", inode_num); + Eprintf(" (inode %lld)\n", inode_num); goto close_attr; } if (wiped) { - Vprintf ("Wiped %llu bytes\n", wiped); + Vprintf("Wiped %llu bytes\n", wiped); total += wiped; } else - Vprintf ("Nothing to wipe\n"); + Vprintf("Nothing to wipe\n"); close_attr: - ntfs_attr_close (na); + ntfs_attr_close(na); close_inode: - ntfs_inode_close (ni); + ntfs_inode_close(ni); } - Qprintf ("wipe_tails 0x%02x, %lld bytes\n", byte, total); + Qprintf("wipe_tails 0x%02x, %lld bytes\n", byte, total); return total; } @@ -662,7 +662,7 @@ close_inode: * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) +static s64 wipe_mft(ntfs_volume *vol, int byte, enum action act) { // by considering the individual attributes we might be able to // wipe a few more bytes at the attr's tail. @@ -675,9 +675,9 @@ static s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) if (!vol || (byte < 0)) return -1; - buffer = malloc (vol->mft_record_size); + buffer = malloc(vol->mft_record_size); if (!buffer) { - Eprintf ("malloc failed\n"); + Eprintf("malloc failed\n"); return -1; } @@ -685,11 +685,11 @@ static s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) vol->mft_record_size_bits; for (i = 0; i < nr_mft_records; i++) { - if (utils_mftrec_in_use (vol, i)) { - result = ntfs_attr_mst_pread (vol->mft_na, vol->mft_record_size * i, + if (utils_mftrec_in_use(vol, i)) { + result = ntfs_attr_mst_pread(vol->mft_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); if (result != 1) { - Eprintf ("error attr mst read %lld\n", + Eprintf("error attr mst read %lld\n", (long long)i); total = -1; // XXX just negate result? goto free; @@ -699,17 +699,17 @@ static s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) size = *((u32*) (buffer + 0x18)) - 4; if (act == act_info) { - //printf ("mft %d\n", size); + //printf("mft %d\n", size); total += size; continue; } - memset (buffer + size, byte, vol->mft_record_size - size); + memset(buffer + size, byte, vol->mft_record_size - size); - result = ntfs_attr_mst_pwrite (vol->mft_na, vol->mft_record_size * i, + result = ntfs_attr_mst_pwrite(vol->mft_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); if (result != 1) { - Eprintf ("error attr mst write %lld\n", + Eprintf("error attr mst write %lld\n", (long long)i); total = -1; goto free; @@ -720,14 +720,14 @@ static s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) // We have to reduce the update sequence number, or else... u16 offset; u16 usa; - offset = le16_to_cpu (*(buffer + 0x04)); - usa = le16_to_cpu (*(buffer + offset)); - *((u16*) (buffer + offset)) = cpu_to_le16 (usa - 1); + offset = le16_to_cpu(*(buffer + 0x04)); + usa = le16_to_cpu(*(buffer + offset)); + *((u16*) (buffer + offset)) = cpu_to_le16(usa - 1); - result = ntfs_attr_mst_pwrite (vol->mftmirr_na, vol->mft_record_size * i, + result = ntfs_attr_mst_pwrite(vol->mftmirr_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); if (result != 1) { - Eprintf ("error attr mst write %lld\n", + Eprintf("error attr mst write %lld\n", (long long)i); total = -1; goto free; @@ -742,33 +742,33 @@ static s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) } // Build the record from scratch - memset (buffer, 0, vol->mft_record_size); + memset(buffer, 0, vol->mft_record_size); // Common values *((u32*) (buffer + 0x00)) = magic_FILE; // Magic - *((u16*) (buffer + 0x06)) = cpu_to_le16 (0x0003); // USA size - *((u16*) (buffer + 0x10)) = cpu_to_le16 (0x0001); // Seq num - *((u32*) (buffer + 0x1C)) = cpu_to_le32 (vol->mft_record_size); // FILE size - *((u16*) (buffer + 0x28)) = cpu_to_le16 (0x0001); // Attr ID + *((u16*) (buffer + 0x06)) = cpu_to_le16(0x0003); // USA size + *((u16*) (buffer + 0x10)) = cpu_to_le16(0x0001); // Seq num + *((u32*) (buffer + 0x1C)) = cpu_to_le32(vol->mft_record_size); // FILE size + *((u16*) (buffer + 0x28)) = cpu_to_le16(0x0001); // Attr ID if (vol->major_ver == 3) { // Only XP and 2K3 - *((u16*) (buffer + 0x04)) = cpu_to_le16 (0x0030); // USA offset - *((u16*) (buffer + 0x14)) = cpu_to_le16 (0x0038); // Attr offset - *((u32*) (buffer + 0x18)) = cpu_to_le32 (0x00000040); // FILE usage - *((u32*) (buffer + 0x38)) = cpu_to_le32 (0xFFFFFFFF); // End marker + *((u16*) (buffer + 0x04)) = cpu_to_le16(0x0030); // USA offset + *((u16*) (buffer + 0x14)) = cpu_to_le16(0x0038); // Attr offset + *((u32*) (buffer + 0x18)) = cpu_to_le32(0x00000040); // FILE usage + *((u32*) (buffer + 0x38)) = cpu_to_le32(0xFFFFFFFF); // End marker } else { // Only NT and 2K - *((u16*) (buffer + 0x04)) = cpu_to_le16 (0x002A); // USA offset - *((u16*) (buffer + 0x14)) = cpu_to_le16 (0x0030); // Attr offset - *((u32*) (buffer + 0x18)) = cpu_to_le32 (0x00000038); // FILE usage - *((u32*) (buffer + 0x30)) = cpu_to_le32 (0xFFFFFFFF); // End marker + *((u16*) (buffer + 0x04)) = cpu_to_le16(0x002A); // USA offset + *((u16*) (buffer + 0x14)) = cpu_to_le16(0x0030); // Attr offset + *((u32*) (buffer + 0x18)) = cpu_to_le32(0x00000038); // FILE usage + *((u32*) (buffer + 0x30)) = cpu_to_le32(0xFFFFFFFF); // End marker } - result = ntfs_attr_mst_pwrite (vol->mft_na, vol->mft_record_size * i, + result = ntfs_attr_mst_pwrite(vol->mft_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); if (result != 1) { - Eprintf ("error attr mst write %lld\n", + Eprintf("error attr mst write %lld\n", (long long)i); total = -1; goto free; @@ -778,9 +778,9 @@ static s64 wipe_mft (ntfs_volume *vol, int byte, enum action act) } } - Qprintf ("wipe_mft 0x%02x, %lld bytes\n", byte, (long long)total); + Qprintf("wipe_mft 0x%02x, %lld bytes\n", byte, (long long)total); free: - free (buffer); + free(buffer); return total; } @@ -797,7 +797,7 @@ free: * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act +static s64 wipe_index_allocation(ntfs_volume *vol, int byte, enum action act __attribute__((unused)), ntfs_attr *naa, ntfs_attr *nab, u32 indx_record_size) { @@ -812,25 +812,25 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act u8 *bitmap; u8 *buf; - bitmap = malloc (nab->data_size); + bitmap = malloc(nab->data_size); if (!bitmap) { - Vprintf ("malloc failed\n"); - Eprintf ("Couldn't allocate %lld bytes", nab->data_size); + Vprintf("malloc failed\n"); + Eprintf("Couldn't allocate %lld bytes", nab->data_size); return -1; } - if (ntfs_attr_pread (nab, 0, nab->data_size, bitmap) + if (ntfs_attr_pread(nab, 0, nab->data_size, bitmap) != nab->data_size) { - Vprintf ("Internal error\n"); - Eprintf ("Couldn't read $BITMAP"); + Vprintf("Internal error\n"); + Eprintf("Couldn't read $BITMAP"); total = -1; goto free_bitmap; } - buf = malloc (indx_record_size); + buf = malloc(indx_record_size); if (!buf) { - Vprintf ("malloc failed\n"); - Eprintf ("Couldn't allocate %u bytes", + Vprintf("malloc failed\n"); + Eprintf("Couldn't allocate %u bytes", (unsigned int)indx_record_size); total = -1; goto free_bitmap; @@ -841,24 +841,24 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act if (bitmap[obyte] & mask) { INDEX_ALLOCATION *indx; - s64 ret = ntfs_rl_pread (vol, naa->rl, + s64 ret = ntfs_rl_pread(vol, naa->rl, offset, indx_record_size, buf); if (ret != indx_record_size) { - Vprintf ("ntfs_rl_pread failed\n"); - Eprintf ("Couldn't read INDX record"); + Vprintf("ntfs_rl_pread failed\n"); + Eprintf("Couldn't read INDX record"); total = -1; goto free_buf; } indx = (INDEX_ALLOCATION *) buf; - if (ntfs_mst_post_read_fixup ((NTFS_RECORD *)buf, + if (ntfs_mst_post_read_fixup((NTFS_RECORD *)buf, indx_record_size)) - Eprintf ("damaged fs: mst_post_read_fixup failed"); + Eprintf("damaged fs: mst_post_read_fixup failed"); if ((le32_to_cpu(indx->index.allocated_size) + 0x18) != indx_record_size) { - Vprintf ("Internal error\n"); - Eprintf ("INDX record should be %u bytes", + Vprintf("Internal error\n"); + Eprintf("INDX record should be %u bytes", (unsigned int)indx_record_size); total = -1; goto free_buf; @@ -866,23 +866,23 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act wipe_offset = le32_to_cpu(indx->index.index_length) + 0x18; wipe_size = indx_record_size - wipe_offset; - memset (buf + wipe_offset, byte, wipe_size); - if (ntfs_mst_pre_write_fixup ((NTFS_RECORD *)indx, + memset(buf + wipe_offset, byte, wipe_size); + if (ntfs_mst_pre_write_fixup((NTFS_RECORD *)indx, indx_record_size)) - Eprintf ("damaged fs: mst_pre_write_protect failed"); + Eprintf("damaged fs: mst_pre_write_protect failed"); if (opts.verbose > 1) - Vprintf ("+"); + Vprintf("+"); } else { wipe_size = indx_record_size; - memset (buf, byte, wipe_size); + memset(buf, byte, wipe_size); if (opts.verbose > 1) - Vprintf ("x"); + Vprintf("x"); } - wiped = ntfs_rl_pwrite (vol, naa->rl, offset, indx_record_size, buf); + wiped = ntfs_rl_pwrite(vol, naa->rl, offset, indx_record_size, buf); if (wiped != indx_record_size) { - Vprintf ("ntfs_rl_pwrite failed\n"); - Eprintf ("Couldn't wipe tail of INDX record"); + Vprintf("ntfs_rl_pwrite failed\n"); + Eprintf("Couldn't wipe tail of INDX record"); total = -1; goto free_buf; } @@ -896,11 +896,11 @@ static s64 wipe_index_allocation (ntfs_volume *vol, int byte, enum action act } } if ((opts.verbose > 1) && (wiped != -1)) - Vprintf ("\n\t"); + Vprintf("\n\t"); free_buf: - free (buf); + free(buf); free_bitmap: - free (bitmap); + free(bitmap); return total; } @@ -911,20 +911,20 @@ free_bitmap: * Return: >0 Success, return INDX record size * 0 Error, something went wrong */ -static u32 get_indx_record_size (ntfs_attr *nar) +static u32 get_indx_record_size(ntfs_attr *nar) { u32 indx_record_size; - if (ntfs_attr_pread (nar, 8, 4, &indx_record_size) != 4) { - Vprintf ("Couldn't determine size of INDX record\n"); - Eprintf ("ntfs_attr_pread failed"); + if (ntfs_attr_pread(nar, 8, 4, &indx_record_size) != 4) { + Vprintf("Couldn't determine size of INDX record\n"); + Eprintf("ntfs_attr_pread failed"); return 0; } - indx_record_size = le32_to_cpu (indx_record_size); + indx_record_size = le32_to_cpu(indx_record_size); if (!indx_record_size) { - Vprintf ("Internal error\n"); - Eprintf ("INDX record should be 0"); + Vprintf("Internal error\n"); + Eprintf("INDX record should be 0"); } return indx_record_size; } @@ -942,7 +942,7 @@ static u32 get_indx_record_size (ntfs_attr *nar) * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) +static s64 wipe_directory(ntfs_volume *vol, int byte, enum action act) { s64 total = 0; s64 nr_mft_records, inode_num; @@ -961,101 +961,101 @@ static s64 wipe_directory (ntfs_volume *vol, int byte, enum action act) u32 indx_record_size; s64 wiped; - Vprintf ("Inode %lld - ", inode_num); - ni = ntfs_inode_open (vol, inode_num); + Vprintf("Inode %lld - ", inode_num); + ni = ntfs_inode_open(vol, inode_num); if (!ni) { if (opts.verbose > 2) - Vprintf ("Could not open inode\n"); + Vprintf("Could not open inode\n"); else - Vprintf ("\r"); + Vprintf("\r"); continue; } if (ni->mrec->base_mft_record) { if (opts.verbose > 2) - Vprintf ("Not base mft record. Skipping\n"); + Vprintf("Not base mft record. Skipping\n"); else - Vprintf ("\r"); + Vprintf("\r"); goto close_inode; } - naa = ntfs_attr_open (ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4); + naa = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4); if (!naa) { if (opts.verbose > 2) - Vprintf ("Couldn't open $INDEX_ALLOCATION\n"); + Vprintf("Couldn't open $INDEX_ALLOCATION\n"); else - Vprintf ("\r"); + Vprintf("\r"); goto close_inode; } if (!NAttrNonResident(naa)) { - Vprintf ("Resident $INDEX_ALLOCATION\n"); - Eprintf ("damaged fs: Resident $INDEX_ALLOCATION " + Vprintf("Resident $INDEX_ALLOCATION\n"); + Eprintf("damaged fs: Resident $INDEX_ALLOCATION " "(inode %lld)\n", inode_num); goto close_attr_allocation; } if (ntfs_attr_map_whole_runlist(naa)) { - Vprintf ("Internal error\n"); - Eprintf ("Can't map runlist for $INDEX_ALLOCATION " + Vprintf("Internal error\n"); + Eprintf("Can't map runlist for $INDEX_ALLOCATION " "(inode %lld)\n", inode_num); goto close_attr_allocation; } - nab = ntfs_attr_open (ni, AT_BITMAP, NTFS_INDEX_I30, 4); + nab = ntfs_attr_open(ni, AT_BITMAP, NTFS_INDEX_I30, 4); if (!nab) { - Vprintf ("Couldn't open $BITMAP\n"); - Eprintf ("damaged fs: $INDEX_ALLOCATION is present, " + Vprintf("Couldn't open $BITMAP\n"); + Eprintf("damaged fs: $INDEX_ALLOCATION is present, " "but we can't open $BITMAP with same " "name (inode %lld)\n", inode_num); goto close_attr_allocation; } - nar = ntfs_attr_open (ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4); + nar = ntfs_attr_open(ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4); if (!nar) { - Vprintf ("Couldn't open $INDEX_ROOT\n"); - Eprintf ("damaged fs: $INDEX_ALLOCATION is present, but " + Vprintf("Couldn't open $INDEX_ROOT\n"); + Eprintf("damaged fs: $INDEX_ALLOCATION is present, but " "we can't open $INDEX_ROOT with same name" " (inode %lld)\n", inode_num); goto close_attr_bitmap; } if (NAttrNonResident(nar)) { - Vprintf ("Not resident $INDEX_ROOT\n"); - Eprintf ("damaged fs: Not resident $INDEX_ROOT " + Vprintf("Not resident $INDEX_ROOT\n"); + Eprintf("damaged fs: Not resident $INDEX_ROOT " "(inode %lld)\n", inode_num); goto close_attr_root; } - indx_record_size = get_indx_record_size (nar); + indx_record_size = get_indx_record_size(nar); if (!indx_record_size) { - Eprintf (" (inode %lld)\n", inode_num); + Eprintf(" (inode %lld)\n", inode_num); goto close_attr_root; } - wiped = wipe_index_allocation (vol, byte, act, + wiped = wipe_index_allocation(vol, byte, act, naa, nab, indx_record_size); if (wiped == -1) { - Eprintf (" (inode %lld)\n", inode_num); + Eprintf(" (inode %lld)\n", inode_num); goto close_attr_root; } if (wiped) { - Vprintf ("Wiped %llu bytes\n", wiped); + Vprintf("Wiped %llu bytes\n", wiped); total += wiped; } else - Vprintf ("Nothing to wipe\n"); + Vprintf("Nothing to wipe\n"); close_attr_root: - ntfs_attr_close (nar); + ntfs_attr_close(nar); close_attr_bitmap: - ntfs_attr_close (nab); + ntfs_attr_close(nab); close_attr_allocation: - ntfs_attr_close (naa); + ntfs_attr_close(naa); close_inode: - ntfs_inode_close (ni); + ntfs_inode_close(ni); } - Qprintf ("wipe_directory 0x%02x, %lld bytes\n", byte, total); + Qprintf("wipe_directory 0x%02x, %lld bytes\n", byte, total); return total; } @@ -1072,7 +1072,7 @@ close_inode: * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act +static s64 wipe_logfile(ntfs_volume *vol, int byte, enum action act __attribute__((unused))) { const int NTFS_BUF_SIZE2 = 8192; @@ -1091,7 +1091,7 @@ static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act if (!vol || (byte < 0)) return -1; - //Qprintf ("wipe_logfile (not implemented) 0x%02x\n", byte); + //Qprintf("wipe_logfile(not implemented) 0x%02x\n", byte); if ((ni = ntfs_inode_open(vol, FILE_LogFile)) == NULL) { ntfs_log_debug("Failed to open inode FILE_LogFile.\n"); @@ -1155,7 +1155,7 @@ static s64 wipe_logfile (ntfs_volume *vol, int byte, enum action act ntfs_attr_close(na); ntfs_inode_close(ni); - Qprintf ("wipe_logfile 0x%02x, %lld bytes\n", byte, pos); + Qprintf("wipe_logfile 0x%02x, %lld bytes\n", byte, pos); return pos; io_error_exit: @@ -1182,7 +1182,7 @@ error_exit: * 0 Nothing to wipe * -1 Error, something went wrong */ -static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act +static s64 wipe_pagefile(ntfs_volume *vol, int byte, enum action act __attribute__((unused))) { // wipe completely, chkdsk doesn't do anything, booting writes header @@ -1196,7 +1196,7 @@ static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act if (!vol || (byte < 0)) return -1; - //Qprintf ("wipe_pagefile (not implemented) 0x%02x\n", byte); + //Qprintf("wipe_pagefile(not implemented) 0x%02x\n", byte); ni = ntfs_pathname_to_inode(vol, NULL, "pagefile.sys"); if (!ni) { @@ -1245,7 +1245,7 @@ static s64 wipe_pagefile (ntfs_volume *vol, int byte, enum action act ntfs_attr_close(na); ntfs_inode_close(ni); - Qprintf ("wipe_pagefile 0x%02x, %lld bytes\n", byte, pos); + Qprintf("wipe_pagefile 0x%02x, %lld bytes\n", byte, pos); return pos; io_error_exit: @@ -1267,38 +1267,38 @@ error_exit: * * Return: none */ -static void print_summary (void) +static void print_summary(void) { int i; if (opts.noaction) - Qprintf ("%s is in 'no-action' mode, it will NOT write to disk." + Qprintf("%s is in 'no-action' mode, it will NOT write to disk." "\n\n", EXEC_NAME); - Qprintf ("%s is about to wipe:\n", EXEC_NAME); + Qprintf("%s is about to wipe:\n", EXEC_NAME); if (opts.unused) - Qprintf ("\tunused disk space\n"); + Qprintf("\tunused disk space\n"); if (opts.tails) - Qprintf ("\tfile tails\n"); + Qprintf("\tfile tails\n"); if (opts.mft) - Qprintf ("\tunused mft areas\n"); + Qprintf("\tunused mft areas\n"); if (opts.directory) - Qprintf ("\tunused directory index space\n"); + Qprintf("\tunused directory index space\n"); if (opts.logfile) - Qprintf ("\tthe logfile (journal)\n"); + Qprintf("\tthe logfile (journal)\n"); if (opts.pagefile) - Qprintf ("\tthe pagefile (swap space)\n"); + Qprintf("\tthe pagefile (swap space)\n"); - Qprintf ("\n%s will overwrite these areas with: ", EXEC_NAME); + Qprintf("\n%s will overwrite these areas with: ", EXEC_NAME); if (opts.bytes) { for (i = 0; opts.bytes[i] >= 0; i++) - Qprintf ("0x%02x ", opts.bytes[i]); + Qprintf("0x%02x ", opts.bytes[i]); } - Qprintf ("\n"); + Qprintf("\n"); if (opts.count > 1) - Qprintf ("%s will repeat these operations %d times.\n", EXEC_NAME, opts.count); - Qprintf ("\n"); + Qprintf("%s will repeat these operations %d times.\n", EXEC_NAME, opts.count); + Qprintf("\n"); } /** @@ -1309,7 +1309,7 @@ static void print_summary (void) * Return: 0 Success, the program worked * 1 Error, something went wrong */ -int main (int argc, char *argv[]) +int main(int argc, char *argv[]) { ntfs_volume *vol; int result = 1; @@ -1317,7 +1317,7 @@ int main (int argc, char *argv[]) int i, j; enum action act = act_info; - if (!parse_options (argc, argv)) + if (!parse_options(argc, argv)) return 1; utils_set_locale(); @@ -1328,7 +1328,7 @@ int main (int argc, char *argv[]) if (opts.info || opts.noaction) flags = MS_RDONLY; - vol = utils_mount_volume (opts.device, flags, opts.force); + vol = utils_mount_volume(opts.device, flags, opts.force); if (!vol) goto free; @@ -1346,11 +1346,11 @@ int main (int argc, char *argv[]) /* Even if the output it quieted, you still get 5 seconds to abort. */ if ((act == act_wipe) && !opts.force) { - Qprintf ("\n%s will begin in 5 seconds, press CTRL-C to abort.\n", EXEC_NAME); - sleep (5); + Qprintf("\n%s will begin in 5 seconds, press CTRL-C to abort.\n", EXEC_NAME); + sleep(5); } - printf ("\n"); + printf("\n"); for (i = 0; i < opts.count; i++) { int byte; s64 total = 0; @@ -1359,7 +1359,7 @@ int main (int argc, char *argv[]) for (j = 0; byte = opts.bytes[j], byte >= 0; j++) { if (opts.directory) { - wiped = wipe_directory (vol, byte, act); + wiped = wipe_directory(vol, byte, act); if (wiped < 0) goto umount; else @@ -1367,7 +1367,7 @@ int main (int argc, char *argv[]) } if (opts.tails) { - wiped = wipe_tails (vol, byte, act); + wiped = wipe_tails(vol, byte, act); if (wiped < 0) goto umount; else @@ -1375,7 +1375,7 @@ int main (int argc, char *argv[]) } if (opts.logfile) { - wiped = wipe_logfile (vol, byte, act); + wiped = wipe_logfile(vol, byte, act); if (wiped < 0) goto umount; else @@ -1383,7 +1383,7 @@ int main (int argc, char *argv[]) } if (opts.mft) { - wiped = wipe_mft (vol, byte, act); + wiped = wipe_mft(vol, byte, act); if (wiped < 0) goto umount; else @@ -1391,7 +1391,7 @@ int main (int argc, char *argv[]) } if (opts.pagefile) { - wiped = wipe_pagefile (vol, byte, act); + wiped = wipe_pagefile(vol, byte, act); if (wiped < 0) goto umount; else @@ -1399,7 +1399,7 @@ int main (int argc, char *argv[]) } if (opts.unused) { - wiped = wipe_unused (vol, byte, act); + wiped = wipe_unused(vol, byte, act); if (wiped < 0) goto umount; else @@ -1410,13 +1410,13 @@ int main (int argc, char *argv[]) break; } - printf ("%lld bytes were wiped\n", (long long)total); + printf("%lld bytes were wiped\n", (long long)total); } result = 0; umount: - ntfs_umount (vol, FALSE); + ntfs_umount(vol, FALSE); free: if (opts.bytes) - free (opts.bytes); + free(opts.bytes); return result; } From 9fb63e797e546478bc3341746b3d633396e160dd Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 27 Oct 2005 11:37:49 +0000 Subject: [PATCH 2640/2994] Pass use_ino to fuse_new if named data streams access is not 'windows'. --- ntfsprogs/ntfsmount.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index cdb35de4..0c39f49f 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1536,9 +1536,12 @@ int main(int argc, char *argv[]) } free(parsed_options); #ifndef DEBUG - fh = fuse_new(ffd, NULL, &ntfs_fuse_oper, sizeof(ntfs_fuse_oper)); + fh = fuse_new(ffd, (ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) ? + NULL : "use_ino", &ntfs_fuse_oper, + sizeof(ntfs_fuse_oper)); #else - fh = fuse_new(ffd, "debug", &ntfs_fuse_oper, + fh = fuse_new(ffd, (ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) ? + "debug" : "debug,use_ino" , &ntfs_fuse_oper, sizeof(ntfs_fuse_oper)); #endif if (!fh) { From 01585fd7cd5d93ba13757e576d5f641bfda74a59 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 27 Oct 2005 13:01:58 +0000 Subject: [PATCH 2641/2994] Always pass "use_ino" to fuse_new, since it's ok to have several files with sameinode number. --- ntfsprogs/ntfsmount.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 0c39f49f..ed18d930 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1536,12 +1536,9 @@ int main(int argc, char *argv[]) } free(parsed_options); #ifndef DEBUG - fh = fuse_new(ffd, (ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) ? - NULL : "use_ino", &ntfs_fuse_oper, - sizeof(ntfs_fuse_oper)); + fh = fuse_new(ffd, "use_ino", &ntfs_fuse_oper, sizeof(ntfs_fuse_oper)); #else - fh = fuse_new(ffd, (ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) ? - "debug" : "debug,use_ino" , &ntfs_fuse_oper, + fh = fuse_new(ffd, "debug,use_ino" , &ntfs_fuse_oper, sizeof(ntfs_fuse_oper)); #endif if (!fh) { From 8b1263c21710225883228ddc5c631d3a39171451 Mon Sep 17 00:00:00 2001 From: szaka Date: Thu, 27 Oct 2005 18:45:45 +0000 Subject: [PATCH 2642/2994] Working with regular files needs no longer --force, except for mkntfs --- ChangeLog | 2 ++ ntfsprogs/utils.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6fbd0b2..8c1f2974 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,8 @@ xx/xx/2005 - 1.12.2-WIP - Add some debugging to ntfsdecrypt.c to allow printing of the private key after it is decrypted (this is ifdeffed out by default). (Anton) - fflush() ntfs_log_ streams. (Christophe) + - Working with regular files needs no longer the --force option, + except for mkntfs. (Szaka) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 82c64665..088e364c 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -133,10 +133,12 @@ int utils_valid_device(const char *name, int force) return 0; } - if (!S_ISBLK(st.st_mode)) { - ntfs_log_warning("%s is not a block device.\n", name); + if (!S_ISBLK(st.st_mode) && !S_ISREG(st.st_mode)) { + ntfs_log_warning("%s is not a block device, " + "nor regular file.\n", name); if (!force) { - ntfs_log_error("Use the force option to work with files.\n"); + ntfs_log_error("Use the force option to work with other" + " file types, for your own risk!\n"); return 0; } ntfs_log_warning("Forced to continue.\n"); From 1ce16eddb79c3ae14880f0839382f79c0bb66bee Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 27 Oct 2005 20:42:10 +0000 Subject: [PATCH 2643/2994] minor cleanup --- libntfs/index.c | 5 +++-- libntfs/logfile.c | 14 ++++++++------ ntfsprogs/ntfscp.c | 2 +- ntfsprogs/utils.c | 13 +++++++------ 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/libntfs/index.c b/libntfs/index.c index 670fdc02..e4704a96 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -636,8 +636,9 @@ int ntfs_index_rm(ntfs_index_context *ictx) if (ntfs_attr_truncate(na, new_index_length + offsetof( INDEX_ROOT, index))) { err = errno; - ntfs_log_error("Failed to truncate INDEX_ROOT attribute. " - " Leaving inconsist metadata."); + ntfs_log_error("Failed to truncate INDEX_ROOT " + "attribute. Leaving inconsist " + "metadata."); goto err_out; } ntfs_attr_close(na); diff --git a/libntfs/logfile.c b/libntfs/logfile.c index d699c39c..9f67acc9 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -606,13 +606,13 @@ is_empty: */ if (rstr2_lsn > rstr1_lsn) { ntfs_log_debug("Using second restart page as it is more " - "recent."); + "recent.\n"); free(rstr1_ph); rstr1_ph = rstr2_ph; /* rstr1_lsn = rstr2_lsn; */ } else { ntfs_log_debug("Using first restart page as it is more " - "recent."); + "recent.\n"); free(rstr2_ph); } rstr2_ph = NULL; @@ -721,7 +721,8 @@ int ntfs_empty_logfile(ntfs_attr *na) /* Get length of $LogFile contents. */ len = na->data_size; if (!len) { - ntfs_log_debug("$LogFile has zero length, no disk write needed.\n"); + ntfs_log_debug("$LogFile has zero length, no disk write " + "needed.\n"); return 0; } @@ -734,8 +735,8 @@ int ntfs_empty_logfile(ntfs_attr *na) if (count == -1 || pos != len) { err = errno; - ntfs_log_debug("Amount of $LogFile data read does not correspond to " - "expected length!"); + ntfs_log_debug("Amount of $LogFile data read does not " + "correspond to expected length!\n"); if (count != -1) err = EIO; goto io_error_exit; @@ -752,7 +753,8 @@ int ntfs_empty_logfile(ntfs_attr *na) if ((count = ntfs_attr_pwrite(na, pos, count, buf)) <= 0) { err = errno; - ntfs_log_debug("Failed to set the $LogFile attribute value.\n"); + ntfs_log_debug("Failed to set the $LogFile attribute " + "value.\n"); if (count != -1) err = EIO; goto io_error_exit; diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 740f034a..d40e8417 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -4,7 +4,7 @@ * Copyright (c) 2004-2005 Yura Pakhuchiy * Copyright (c) 2005 Anton Altaparmakov * - * This utility will overwrite files on ntfs volume + * This utility will overwrite files on NTFS volume. * * 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 diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index 088e364c..b412cc47 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -186,20 +186,21 @@ ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL f err = errno; ntfs_log_perror("Couldn't mount device '%s'", device); if (err == EPERM) - ntfs_log_error("Windows was hibernated. Try to mount volume " - "in windows, shut down and try " + ntfs_log_error("Windows was hibernated. Try to mount " + "volume in windows, shut down and try " "again.\n"); if (err == EOPNOTSUPP) - ntfs_log_error("Windows did not shut down properly. Try to " - "mount volume in windows, shut down " - "and try again.\n"); + ntfs_log_error("Windows did not shut down properly. " + "Try to mount volume in windows, " + "shut down and try again.\n"); return NULL; } if (vol->flags & VOLUME_IS_DIRTY) { ntfs_log_warning("Volume is dirty.\n"); if (!force) { - ntfs_log_error("Run chkdsk and try again, or use the --force option.\n"); + ntfs_log_error("Run chkdsk and try again, or use the " + "force option.\n"); ntfs_umount(vol, FALSE); return NULL; } From 73474b68db45232f409a249700d519b0ddcc98e5 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 27 Oct 2005 21:20:30 +0000 Subject: [PATCH 2644/2994] Fix ntfs_non_resident_attr_expand bug, that occured if we enlarge sparse or compressed file, but do not need to allocate new clusters to perfrom this. --- ChangeLog | 5 ++++- libntfs/attrib.c | 32 ++++++++++++++++++-------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c1f2974..e90b170f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -44,7 +44,10 @@ xx/xx/2005 - 1.12.2-WIP key after it is decrypted (this is ifdeffed out by default). (Anton) - fflush() ntfs_log_ streams. (Christophe) - Working with regular files needs no longer the --force option, - except for mkntfs. (Szaka) + except for mkntfs. (Szaka) + - Fix ntfs_non_resident_attr_expand bug, that occured if we enlarge + sparse or compressed file, but do not need to allocate new clusters to + perfrom this. (Yura) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 6f80783f..ee09fc03 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -4619,8 +4619,10 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) runlist *rl, *rln; int err; - ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x.\n", (unsigned long - long)na->ni->mft_no, na->type); + ntfs_log_trace("Entering for inode 0x%llx, attr 0x%x, new size %lld, " + "current size %lld.\n", + (unsigned long long)na->ni->mft_no, na->type, + (long long)newsize, (long long)na->data_size); vol = na->ni->vol; @@ -4761,24 +4763,26 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) } a = ctx->attr; - /* Update allocated size only if it is changed. */ + /* Update allocated and compressed size only if we changed runlist. */ if ((na->allocated_size >> vol->cluster_size_bits) < first_free_vcn) { na->allocated_size = first_free_vcn << vol->cluster_size_bits; a->allocated_size = cpu_to_sle64(na->allocated_size); - } - /* Update compressed_size if present. */ - if (NAttrSparse(na) || NAttrCompressed(na)) { - s64 new_compr_size; + /* Update compressed_size if present. */ + if (NAttrSparse(na) || NAttrCompressed(na)) { + s64 new_compr_size; - new_compr_size = ntfs_rl_get_compressed_size(vol, na->rl); - if (new_compr_size == -1) { - err = errno; - ntfs_log_trace("BUG! Leaving inconstant metadata.\n"); - goto put_err_out; + new_compr_size = ntfs_rl_get_compressed_size(vol, + na->rl); + if (new_compr_size == -1) { + err = errno; + ntfs_log_trace("BUG! Leaving inconstant " + "metadata.\n"); + goto put_err_out; + } + na->compressed_size = new_compr_size; + a->compressed_size = cpu_to_sle64(new_compr_size); } - na->compressed_size = new_compr_size; - a->compressed_size = cpu_to_sle64(new_compr_size); } /* Update data size. */ From 0e4a1ca25207cf531d46ceb2d9ab2a3fab4990ea Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 27 Oct 2005 21:46:00 +0000 Subject: [PATCH 2645/2994] Fix ntfsdecrypt endianness bugs thus it now works on OSX running on a dual G5! (Anton) --- ChangeLog | 12 +++++---- ntfsprogs/ntfsdecrypt.c | 59 ++++++++++++++++++++++++++++++----------- 2 files changed, 50 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index e90b170f..f684b23f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,11 +43,13 @@ xx/xx/2005 - 1.12.2-WIP - Add some debugging to ntfsdecrypt.c to allow printing of the private key after it is decrypted (this is ifdeffed out by default). (Anton) - fflush() ntfs_log_ streams. (Christophe) - - Working with regular files needs no longer the --force option, - except for mkntfs. (Szaka) - - Fix ntfs_non_resident_attr_expand bug, that occured if we enlarge - sparse or compressed file, but do not need to allocate new clusters to - perfrom this. (Yura) + - Working with regular files no longer needs the --force option, except + for mkntfs. (Szaka) + - Fix ntfs_non_resident_attr_expand() bug, that occured if we enlarge + sparse or compressed file, but do not need to allocate new clusters + to perfrom this. (Yura) + - Fix ntfsdecrypt endianness bugs thus it now works on OSX running on + a dual G5! (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index e5f02c91..748f0b0e 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -74,19 +74,36 @@ typedef gcry_sexp_t ntfs_rsa_private_key; +/* + * List of crypto algorithms used by EFS (32-bit values). + * + * To choose which one is used in Windows, create or set the REG_DWORD registry + * key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EFS\ + * AlgorithmID to the value of your chosen crypto algorithm, e.g. to use DesX, + * set AlgorithmID to 0x6604. + * + * Note that the Windows versions I have tried so far (all are high crypto + * enabled) ignore the AlgorithmID value if it is not one of CALG_3DES, + * CALG_DESX, or CALG_AES_256, i.e. you cannot select CALG_DES at all using + * this registry key. It would be interesting to check out encryption on one + * of the "crippled" crypto Windows versions... + */ +typedef enum { + CALG_DES = const_cpu_to_le32(0x6601), + /* If not one of the below three, fall back to standard Des. */ + CALG_3DES = const_cpu_to_le32(0x6603), + CALG_DESX = const_cpu_to_le32(0x6604), + CALG_AES_256 = const_cpu_to_le32(0x6610), +} NTFS_CRYPTO_ALGORITHMS; + +/* Decrypted, in-memory file encryption key. */ typedef struct { - u8 *key_data; - u32 alg_id; gcry_cipher_hd_t gcry_cipher_hd; + u32 alg_id; + u8 *key_data; gcry_cipher_hd_t *des_gcry_cipher_hd_ptr; } ntfs_fek; -#define CALG_DES (0x6601) -/* If not one of the below three, fall back to standard Des. */ -#define CALG_3DES (0x6603) -#define CALG_DESX (0x6604) -#define CALG_AES_256 (0x6610) - /* DESX-MS128 implementation for libgcrypt. */ static gcry_module_t ntfs_desx_module; static int ntfs_desx_algorithm_id = -1; @@ -921,7 +938,8 @@ static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, gcry_error_t err; // TODO: Sanity checking of sizes and offsets. - key_size = *(u32*)fek_buf; + key_size = le32_to_cpup(fek_buf); + //fprintf(stderr, "key_size 0x%x\n", key_size); fek = malloc(((((sizeof(*fek) + 7) & ~7) + key_size + 7) & ~7) + sizeof(gcry_cipher_hd_t)); if (!fek) { @@ -929,6 +947,7 @@ static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, return NULL; } fek->alg_id = *(u32*)(fek_buf + 8); + //fprintf(stderr, "alg_id 0x%x\n", le32_to_cpu(fek->alg_id)); fek->key_data = (u8*)fek + ((sizeof(*fek) + 7) & ~7); memcpy(fek->key_data, fek_buf + 16, key_size); fek->des_gcry_cipher_hd_ptr = NULL; @@ -966,10 +985,15 @@ static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, default: wanted_key_size = 8; gcry_algo = GCRY_CIPHER_DES; - fprintf(stderr, "DES is not supported at present. Please " - "email linux-ntfs-dev@lists.sourceforge.net " - "and say that you saw this message. We will " - "then implement support for DES.\n"); + if (fek->alg_id == CALG_DES) + fprintf(stderr, "DES is not supported at present"); + else + fprintf(stderr, "Unknown crypto algorithm 0x%x", + le32_to_cpu(fek->alg_id)); + fprintf(stderr, ". Please email linux-ntfs-dev@lists." + "sourceforge.net and say that you saw this " + "message. We will then try to implement " + "support for this algorithm.\n"); err = EOPNOTSUPP; goto out; } @@ -1119,11 +1143,14 @@ static int ntfs_fek_decrypt_sector(ntfs_fek *fek, u8 *data, const u64 offset) } /* Apply the IV. */ if (fek->alg_id == CALG_AES_256) { - ((u64*)data)[0] ^= 0x5816657be9161312ULL + offset; - ((u64*)data)[1] ^= 0x1989adbe44918961ULL + offset; + ((u64*)data)[0] ^= const_cpu_to_le64(0x5816657be9161312ULL + + offset); + ((u64*)data)[1] ^= const_cpu_to_le64(0x1989adbe44918961ULL + + offset); } else { /* All other algos (Des, 3Des, DesX) use the same IV. */ - ((u64*)data)[0] ^= 0x169119629891ad13ULL + offset; + ((u64*)data)[0] ^= const_cpu_to_le64(0x169119629891ad13ULL + + offset); } return 512; } From fa2217bafa87fe88e35940531808fae76005b930 Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 27 Oct 2005 21:55:59 +0000 Subject: [PATCH 2646/2994] Minor todying. --- ntfsprogs/ntfsdecrypt.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 748f0b0e..eb809077 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -1143,14 +1143,11 @@ static int ntfs_fek_decrypt_sector(ntfs_fek *fek, u8 *data, const u64 offset) } /* Apply the IV. */ if (fek->alg_id == CALG_AES_256) { - ((u64*)data)[0] ^= const_cpu_to_le64(0x5816657be9161312ULL + - offset); - ((u64*)data)[1] ^= const_cpu_to_le64(0x1989adbe44918961ULL + - offset); + ((u64*)data)[0] ^= cpu_to_le64(0x5816657be9161312ULL + offset); + ((u64*)data)[1] ^= cpu_to_le64(0x1989adbe44918961ULL + offset); } else { /* All other algos (Des, 3Des, DesX) use the same IV. */ - ((u64*)data)[0] ^= const_cpu_to_le64(0x169119629891ad13ULL + - offset); + ((u64*)data)[0] ^= cpu_to_le64(0x169119629891ad13ULL + offset); } return 512; } From 4e5c1c6efa10ce05f3b2ce3e92992e73dd065208 Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 04:12:22 +0000 Subject: [PATCH 2647/2994] rebuild logging again. today's arrangement has five handlers: ntfs_log_handler_fprintf (renamed from printf) ntfs_log_handler_null (does nothing, default) ntfs_log_handler_stdout (everything to stdout) ntfs_log_handler_outerr (info to stdout, errors to stderr) ntfs_log_handler_stderr (everything to stderr) the colour handler has gone away to be replaced by a flag: NTFS_LOG_FLAG_COLOUR --- include/ntfs/logging.h | 32 +++--- libntfs/logging.c | 229 +++++++++++++++++++++++++++++------------ 2 files changed, 176 insertions(+), 85 deletions(-) diff --git a/include/ntfs/logging.h b/include/ntfs/logging.h index d693e343..552dcc32 100644 --- a/include/ntfs/logging.h +++ b/include/ntfs/logging.h @@ -32,27 +32,20 @@ #include "types.h" - /* Function prototype for the logging handlers */ typedef int (ntfs_log_handler)(const char *function, const char *file, int line, u32 level, void *data, const char *format, va_list args); -/** - * struct ntfs_logging - Control info for the logging system - * @levels: Bitfield of logging levels - * @flags: Flags to affect the output style - * @handler: Function to perform the actual logging - */ -struct ntfs_logging { - u32 levels; - u32 flags; - ntfs_log_handler *handler; -}; - -extern struct ntfs_logging ntfs_log; - +/* Set the logging handler from one of the functions, below. */ void ntfs_log_set_handler(ntfs_log_handler *handler); +/* Logging handlers */ +ntfs_log_handler ntfs_log_handler_fprintf __attribute__((format(printf, 6, 0))); +ntfs_log_handler ntfs_log_handler_null __attribute__((format(printf, 6, 0))); +ntfs_log_handler ntfs_log_handler_stdout __attribute__((format(printf, 6, 0))); +ntfs_log_handler ntfs_log_handler_outerr __attribute__((format(printf, 6, 0))); +ntfs_log_handler ntfs_log_handler_stderr __attribute__((format(printf, 6, 0))); + /* Enable/disable certain log levels */ u32 ntfs_log_set_levels(u32 levels); u32 ntfs_log_clear_levels(u32 levels); @@ -63,16 +56,13 @@ u32 ntfs_log_set_flags(u32 flags); u32 ntfs_log_clear_flags(u32 flags); u32 ntfs_log_get_flags(void); +/* Turn command-line options into logging flags */ BOOL ntfs_log_parse_option(const char *option); int ntfs_log_redirect(const char *function, const char *file, int line, u32 level, void *data, const char *format, ...) __attribute__((format(printf, 6, 7))); -/* Logging handlers */ -ntfs_log_handler ntfs_log_handler_printf __attribute__((format(printf, 6, 0))); -ntfs_log_handler ntfs_log_handler_colour __attribute__((format(printf, 6, 0))); - /* Logging levels - Determine what gets logged */ #define NTFS_LOG_LEVEL_DEBUG (1 << 0) /* x = 42 */ #define NTFS_LOG_LEVEL_TRACE (1 << 1) /* Entering function x() */ @@ -92,6 +82,7 @@ ntfs_log_handler ntfs_log_handler_colour __attribute__((format(printf, 6, 0))); #define NTFS_LOG_FLAG_LINE (1 << 2) /* Show the line number of the message */ #define NTFS_LOG_FLAG_FUNCTION (1 << 3) /* Show the function name containing the message */ #define NTFS_LOG_FLAG_ONLYNAME (1 << 4) /* Only display the filename, not the pathname */ +#define NTFS_LOG_FLAG_COLOUR (1 << 5) /* Colour highlight some messages */ /* Macros to simplify logging. One for each level defined above. * Note, if NTFS_DISABLE_DEBUG_LOGGING is defined, then ntfs_log_debug/trace have no effect. @@ -106,6 +97,9 @@ ntfs_log_handler ntfs_log_handler_colour __attribute__((format(printf, 6, 0))); #define ntfs_log_warning(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_WARNING,NULL,FORMAT,##ARGS) #define ntfs_log_reason(FORMAT, ARGS...) ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_REASON,NULL,FORMAT,##ARGS) +/* By default debug and trace messages are compiled into the program, + * but not displayed. + */ #ifdef NTFS_DISABLE_DEBUG_LOGGING #define ntfs_log_debug(FORMAT, ARGS...)do {} while (0) #define ntfs_log_trace(FORMAT, ARGS...)do {} while (0) diff --git a/libntfs/logging.c b/libntfs/logging.c index 9ab0ef2a..526c4295 100644 --- a/libntfs/logging.c +++ b/libntfs/logging.c @@ -45,11 +45,31 @@ #define PATH_SEP '/' #endif +/* Colour prefixes and a suffix */ +static const char *col_green = "\e[32m"; +static const char *col_cyan = "\e[36m"; +static const char *col_yellow = "\e[01;33m"; +static const char *col_red = "\e[01;31m"; +static const char *col_redinv = "\e[01;07;31m"; +static const char *col_end = "\e[0m"; + /** - * struct ntfs_logging - * This global struct controls all the logging within the library and tools. + * struct ntfs_logging - Control info for the logging system + * @levels: Bitfield of logging levels + * @flags: Flags which affect the output style + * @handler: Function to perform the actual logging */ -struct ntfs_logging ntfs_log = { +struct ntfs_logging { + u32 levels; + u32 flags; + ntfs_log_handler *handler; +}; + +/** + * ntfs_log + * This struct controls all the logging within the library and tools. + */ +static struct ntfs_logging ntfs_log = { #ifdef DEBUG NTFS_LOG_LEVEL_DEBUG | NTFS_LOG_LEVEL_TRACE | #endif @@ -57,9 +77,14 @@ struct ntfs_logging ntfs_log = { NTFS_LOG_LEVEL_ERROR | NTFS_LOG_LEVEL_PERROR | NTFS_LOG_LEVEL_CRITICAL | NTFS_LOG_LEVEL_REASON, NTFS_LOG_FLAG_ONLYNAME, - ntfs_log_handler_printf +#ifdef DEBUG + ntfs_log_handler_outerr +#else + ntfs_log_handler_null +#endif }; + /** * ntfs_log_get_levels - Get a list of the current logging levels * @@ -255,7 +280,7 @@ void ntfs_log_set_handler(ntfs_log_handler *handler) if (handler) ntfs_log.handler = handler; else - ntfs_log.handler = ntfs_log_handler_printf; + ntfs_log.handler = ntfs_log_handler_null; } /** @@ -294,8 +319,9 @@ int ntfs_log_redirect(const char *function, const char *file, return ret; } + /** - * ntfs_log_handler_printf - Basic logging handler + * ntfs_log_handler_fprintf - Basic logging handler * @function: Function in which the log line occurred * @file: File in which the log line occurred * @line: Line number on which the log line occurred @@ -305,15 +331,17 @@ int ntfs_log_redirect(const char *function, const char *file, * @args: Arguments to be formatted * * A simple logging handler. This is where the log line is finally displayed. + * It is more likely that you will want to set the handler to either + * ntfs_log_handler_outerr or ntfs_log_handler_stderr. * * Note: For this handler, @data is a pointer to a FILE output stream. - * If @data is NULL, the function ntfs_log_get_stream will be called + * If @data is NULL, nothing will be displayed. * * Returns: -1 Error occurred * 0 Message wasn't logged * num Number of output characters */ -int ntfs_log_handler_printf(const char *function, const char *file, +int ntfs_log_handler_fprintf(const char *function, const char *file, int line, u32 level, void *data, const char *format, va_list args) { const int reason_size = 128; @@ -321,6 +349,12 @@ int ntfs_log_handler_printf(const char *function, const char *file, int ret = 0; int olderr = errno; FILE *stream; + const char *col_prefix = NULL; + const char *col_suffix = NULL; + + if (!data) /* Interpret data as a FILE stream. */ + return 0; /* If it's NULL, we can't do anything. */ + stream = (FILE*)data; if (level == NTFS_LOG_LEVEL_REASON) { if (!reason) @@ -337,10 +371,35 @@ int ntfs_log_handler_printf(const char *function, const char *file, } } - if (data) - stream = (FILE*) data; - else - stream = ntfs_log_get_stream(level); + if (ntfs_log.flags & NTFS_LOG_FLAG_COLOUR) { + /* Pick a colour determined by the log level */ + switch (level) { + case NTFS_LOG_LEVEL_DEBUG: + col_prefix = col_green; + col_suffix = col_end; + break; + case NTFS_LOG_LEVEL_TRACE: + col_prefix = col_cyan; + col_suffix = col_end; + break; + case NTFS_LOG_LEVEL_WARNING: + col_prefix = col_yellow; + col_suffix = col_end; + break; + case NTFS_LOG_LEVEL_ERROR: + case NTFS_LOG_LEVEL_PERROR: + col_prefix = col_red; + col_suffix = col_end; + break; + case NTFS_LOG_LEVEL_CRITICAL: + col_prefix = col_redinv; + col_suffix = col_end; + break; + } + } + + if (col_prefix) + ret += fprintf(stream, col_prefix); if ((ntfs_log.flags & NTFS_LOG_FLAG_ONLYNAME) && (strchr(file, PATH_SEP))) /* Abbreviate the filename */ @@ -368,13 +427,17 @@ int ntfs_log_handler_printf(const char *function, const char *file, ret += fprintf(stream, " : %s\n", strerror(olderr)); } + if (col_suffix) + ret += fprintf(stream, col_suffix); + + fflush(stream); errno = olderr; return ret; } /** - * ntfs_log_handler_colour - Colour-highlighting logging handler + * ntfs_log_handler_null - Null logging handler (no output) * @function: Function in which the log line occurred * @file: File in which the log line occurred * @line: Line number on which the log line occurred @@ -383,73 +446,107 @@ int ntfs_log_handler_printf(const char *function, const char *file, * @format: printf-style formatting string * @args: Arguments to be formatted * - * This is a simple logging filter that prefixes/suffixes some logs. - * Warnings: yellow - * Errors: red - * Critical errors: red (inverse video) + * This handler produces no output. It provides a way to temporarily disable + * logging, without having to change the levels and flags. * - * Note: This function calls ntfs_log_handler_printf to do the main work. + * Returns: 0 Message wasn't logged + */ +int ntfs_log_handler_null(const char *function __attribute__((unused)), const char *file __attribute__((unused)), + int line __attribute__((unused)), u32 level __attribute__((unused)), void *data __attribute__((unused)), + const char *format __attribute__((unused)), va_list args __attribute__((unused))) +{ + return 0; +} + +/** + * ntfs_log_handler_stdout - All logs go to stdout + * @function: Function in which the log line occurred + * @file: File in which the log line occurred + * @line: Line number on which the log line occurred + * @level: Level at which the line is logged + * @data: User specified data, possibly specific to a handler + * @format: printf-style formatting string + * @args: Arguments to be formatted + * + * Display a log message to stdout. * * Note: For this handler, @data is a pointer to a FILE output stream. - * If @data is NULL, the function ntfs_log_get_stream will be called + * If @data is NULL, then stdout will be used. + * + * Note: This function calls ntfs_log_handler_fprintf to do the main work. * * Returns: -1 Error occurred * 0 Message wasn't logged * num Number of output characters */ -int ntfs_log_handler_colour(const char *function, const char *file, +int ntfs_log_handler_stdout(const char *function, const char *file, int line, u32 level, void *data, const char *format, va_list args) { - int ret = 0; - int olderr = errno; - const char *prefix = NULL; - const char *suffix = NULL; - const char *end = "\e[0m"; - FILE *stream = NULL; + if (!data) + data = stdout; - if (level != NTFS_LOG_LEVEL_REASON) { /* Reasons get passed through */ - if (data) - stream = (FILE*) data; - else - stream = ntfs_log_get_stream(level); + return ntfs_log_handler_fprintf(function, file, line, level, data, format, args); +} - switch (level) { - case NTFS_LOG_LEVEL_DEBUG: - prefix = "\e[32m"; /* Green */ - suffix = end; - break; - case NTFS_LOG_LEVEL_TRACE: - prefix = "\e[36m"; /* Cyan */ - suffix = end; - break; - case NTFS_LOG_LEVEL_WARNING: - prefix = "\e[01;33m"; /* Yellow */ - suffix = end; - break; - case NTFS_LOG_LEVEL_ERROR: - case NTFS_LOG_LEVEL_PERROR: - prefix = "\e[01;31m"; /* Red */ - suffix = end; - break; - case NTFS_LOG_LEVEL_CRITICAL: - prefix = "\e[01;07;31m"; /* Red, inverse */ - suffix = end; - break; - } - } +/** + * ntfs_log_handler_outerr - Logs go to stdout/stderr depending on level + * @function: Function in which the log line occurred + * @file: File in which the log line occurred + * @line: Line number on which the log line occurred + * @level: Level at which the line is logged + * @data: User specified data, possibly specific to a handler + * @format: printf-style formatting string + * @args: Arguments to be formatted + * + * Display a log message. The output stream will be determined by the log + * level. + * + * Note: For this handler, @data is a pointer to a FILE output stream. + * If @data is NULL, the function ntfs_log_get_stream will be called + * + * Note: This function calls ntfs_log_handler_fprintf to do the main work. + * + * Returns: -1 Error occurred + * 0 Message wasn't logged + * num Number of output characters + */ +int ntfs_log_handler_outerr(const char *function, const char *file, + int line, u32 level, void *data, const char *format, va_list args) +{ + if (!data) + data = ntfs_log_get_stream(level); - if (prefix) - ret += fprintf(stream, prefix); + return ntfs_log_handler_fprintf(function, file, line, level, data, format, args); +} - errno = olderr; - ret += ntfs_log_handler_printf(function, file, line, level, stream, format, args); +/** + * ntfs_log_handler_stderr - All logs go to stderr + * @function: Function in which the log line occurred + * @file: File in which the log line occurred + * @line: Line number on which the log line occurred + * @level: Level at which the line is logged + * @data: User specified data, possibly specific to a handler + * @format: printf-style formatting string + * @args: Arguments to be formatted + * + * Display a log message to stderr. + * + * Note: For this handler, @data is a pointer to a FILE output stream. + * If @data is NULL, then stdout will be used. + * + * Note: This function calls ntfs_log_handler_fprintf to do the main work. + * + * Returns: -1 Error occurred + * 0 Message wasn't logged + * num Number of output characters + */ +int ntfs_log_handler_stderr(const char *function, const char *file, + int line, u32 level, void *data, const char *format, va_list args) +{ + if (!data) + data = stderr; - if (suffix) - ret += fprintf(stream, suffix); - - fflush(stream); - errno = olderr; - return ret; + return ntfs_log_handler_fprintf(function, file, line, level, data, format, args); } @@ -482,7 +579,7 @@ BOOL ntfs_log_parse_option(const char *option) return TRUE; } else if ((strcmp(option, "--log-colour") == 0) || (strcmp(option, "--log-color") == 0)) { - ntfs_log_set_handler(ntfs_log_handler_colour); + ntfs_log_set_flags(NTFS_LOG_FLAG_COLOUR); return TRUE; } From 16dd9defa56a5d514764688e0a225d4d6c3d7b6f Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 04:31:45 +0000 Subject: [PATCH 2648/2994] email typo --- ntfsprogs/ntfsresize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 0b31d4b0..1aa66db0 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2043,11 +2043,11 @@ static int check_bad_sectors(ntfs_volume *vol) if (NInoAttrList(ctx->ntfs_ino)) err_exit("Hopelessly many bad sectors! Please report to " - "linux-ntfs@lists.sf.net\n"); + "linux-ntfs-dev@lists.sf.net\n"); if (!ctx->attr->non_resident) err_exit("Resident attribute in $BadClust! Please report to " - "linux-ntfs@lists.sf.net\n"); + "linux-ntfs-dev@lists.sf.net\n"); if (!(rl = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL))) perr_exit("Decompressing $BadClust:$Bad mapping pairs failed"); From 8892ba7ac62b37ba6d49262a0ec64fe38c4989e1 Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 04:32:21 +0000 Subject: [PATCH 2649/2994] remove some colour hacks remove a few #ifdef DEBUGs and RM_WRITEs throw in lots of extra traces --- include/ntfs/rich.h | 10 ---- libntfs/bitmap.c | 27 ++++++---- libntfs/dir.c | 43 +++++++++------ libntfs/index.c | 8 +++ libntfs/inode.c | 11 ++-- libntfs/mft.c | 18 +++++-- libntfs/rich.c | 13 +++-- libntfs/runlist.c | 4 +- libntfs/tree.c | 112 ++++++++++++++++++++++++++++----------- libntfs/volume.c | 58 +++++++++++--------- ntfsprogs/cluster.c | 8 --- ntfsprogs/ntfsmove.c | 8 --- ntfsprogs/ntfsundelete.c | 6 ++- ntfsprogs/utils.h | 5 -- 14 files changed, 203 insertions(+), 128 deletions(-) diff --git a/include/ntfs/rich.h b/include/ntfs/rich.h index 48400e7e..b40a7a4f 100644 --- a/include/ntfs/rich.h +++ b/include/ntfs/rich.h @@ -26,16 +26,6 @@ #include "attrib.h" #include "bitmap.h" -// XXX Temporarily copied from utils.h -#define RED "\e[31m" -#define GREEN "\e[32m" -#define YELLOW "\e[33m" -#define BLUE "\e[34m" -#define MAGENTA "\e[35m" -#define CYAN "\e[36m" -#define BOLD "\e[01m" -#define END "\e[0m" - #define ROUND_UP(num,bound) (((num)+((bound)-1)) & ~((bound)-1)) #define ROUND_DOWN(num,bound) ((num) & ~((bound)-1)) #define ATTR_SIZE(s) ROUND_UP(s,8) diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index e722fe9b..5532c3ec 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -237,6 +237,8 @@ int ntfs_bmp_rollback(struct ntfs_bmp *bmp) if ((!bmp) || (bmp->count == 0)) return 0; + ntfs_log_trace ("bmp %p, records %d, attr %lld/%02X\n", bmp, bmp->count, MREF(bmp->attr->ni->mft_no), bmp->attr->type); + for (i = 0; i < bmp->count; i++) free(bmp->data[i]); @@ -256,15 +258,14 @@ int ntfs_bmp_commit(struct ntfs_bmp *bmp) { int i; u32 cs; -#ifdef RM_WRITE u32 ws; // write size -#endif if (!bmp) return 0; if (bmp->count == 0) return 0; + ntfs_log_trace ("bmp %p, records %d, attr %lld/%02X\n", bmp, bmp->count, MREF(bmp->attr->ni->mft_no), bmp->attr->type); #if 0 ntfs_log_debug("attr = 0x%02X\n", bmp->attr->type); ntfs_log_debug("resident = %d\n", !NAttrNonResident(bmp->attr)); @@ -280,22 +281,18 @@ int ntfs_bmp_commit(struct ntfs_bmp *bmp) // non-resident for (i = 0; i < bmp->count; i++) { -#ifdef RM_WRITE if (((bmp->data_vcn[i]+1) * cs) < bmp->attr->data_size) ws = cs; else ws = bmp->attr->data_size & (cs - 1); //ntfs_log_debug("writing %d bytes\n", ws); ntfs_attr_pwrite(bmp->attr, bmp->data_vcn[i] * cs, ws, bmp->data[i]); // XXX retval -#endif - ntfs_log_debug(RED "\tntfs_attr_pwrite(vcn %lld)\n" END, bmp->data_vcn[i]); + ntfs_log_warning("\tntfs_attr_pwrite(vcn %lld)\n", bmp->data_vcn[i]); } } else { // resident -#ifdef RM_WRITE ntfs_attr_pwrite(bmp->attr, bmp->data_vcn[0], bmp->attr->data_size, bmp->data[0]); // XXX retval -#endif - ntfs_log_debug(RED "\tntfs_attr_pwrite resident (%lld)\n" END, bmp->attr->data_size); + ntfs_log_warning("\tntfs_attr_pwrite resident (%lld)\n", bmp->attr->data_size); } ntfs_bmp_rollback(bmp); @@ -311,8 +308,9 @@ void ntfs_bmp_free(struct ntfs_bmp *bmp) if (!bmp) return; - ntfs_bmp_rollback(bmp); + ntfs_log_trace ("bmp %p, records %d, attr %lld/%02X\n", bmp, bmp->count, MREF(bmp->attr->ni->mft_no), bmp->attr->type); + ntfs_bmp_rollback(bmp); ntfs_attr_close(bmp->attr); free(bmp); @@ -329,6 +327,7 @@ struct ntfs_bmp * ntfs_bmp_create(ntfs_inode *inode, ATTR_TYPES type, ntfschar * if (!inode) return NULL; + ntfs_log_trace ("\n"); attr = ntfs_attr_open(inode, type, name, name_len); if (!attr) return NULL; @@ -339,6 +338,7 @@ struct ntfs_bmp * ntfs_bmp_create(ntfs_inode *inode, ATTR_TYPES type, ntfschar * return NULL; } + ntfs_log_critical("bmp = %p, attr = %p, inode = %p, attr->ni->mft_no = %lld\n", bmp, attr, inode, MREF(attr->ni->mft_no)); bmp->vol = inode->vol; bmp->attr = attr; bmp->data = NULL; @@ -360,6 +360,7 @@ int ntfs_bmp_add_data(struct ntfs_bmp *bmp, VCN vcn, u8 *data) if (!bmp || !data) return -1; + ntfs_log_trace ("\n"); old = ROUND_UP(bmp->count, 16); bmp->count++; new = ROUND_UP(bmp->count, 16); @@ -397,6 +398,7 @@ u8 * ntfs_bmp_get_data(struct ntfs_bmp *bmp, VCN vcn) if (!bmp) return NULL; + ntfs_log_trace ("\n"); cs = bmp->vol->cluster_size; cb = bmp->vol->cluster_size_bits; @@ -447,6 +449,7 @@ int ntfs_bmp_set_range(struct ntfs_bmp *bmp, VCN vcn, s64 length, int value) if (!bmp) return -1; + ntfs_log_trace ("vcn %lld, length %lld, value %d\n", vcn, length, value); if (value) value = 0xFF; @@ -504,13 +507,13 @@ int ntfs_bmp_set_range(struct ntfs_bmp *bmp, VCN vcn, s64 length, int value) } #if 1 - ntfs_log_debug(GREEN "Modified: inode %lld, ", bmp->attr->ni->mft_no); + ntfs_log_debug("Modified: inode %lld, ", bmp->attr->ni->mft_no); switch (bmp->attr->type) { case AT_BITMAP: ntfs_log_debug("$BITMAP"); break; case AT_DATA: ntfs_log_debug("$DATA"); break; default: break; } - ntfs_log_debug(" vcn %lld-%lld\n" END, vcn>>12, (vcn+length-1)>>12); + ntfs_log_debug(" vcn %lld-%lld\n", vcn>>12, (vcn+length-1)>>12); #endif return 1; } @@ -531,6 +534,7 @@ s64 ntfs_bmp_find_last_set(struct ntfs_bmp *bmp) if (!bmp) return -2; + ntfs_log_trace ("\n"); // find byte size of bmp // find cluster size of bmp @@ -586,6 +590,7 @@ int ntfs_bmp_find_space(struct ntfs_bmp *bmp, LCN start, long size) if (!bmp) return 0; + ntfs_log_trace ("\n"); start = 0; size = 0; diff --git a/libntfs/dir.c b/libntfs/dir.c index 27be8804..4b1ab17d 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1513,15 +1513,9 @@ err_out: #ifdef NTFS_RICH -#include - #include "layout.h" -#include "volume.h" -#include "inode.h" -#include "dir.h" #include "tree.h" #include "bitmap.h" -#include "index.h" #include "rich.h" /** @@ -1534,6 +1528,9 @@ int ntfs_dir_rollback(struct ntfs_dir *dir) if (!dir) return -1; + ntfs_log_trace ("dir %p, inode %lld, children %d\n", dir, + dir ? MREF(dir->mft_num) : 0, dir ? dir->child_count : 0); + if (ntfs_dt_rollback(dir->index) < 0) return -1; @@ -1562,6 +1559,9 @@ int ntfs_dir_truncate(ntfs_volume *vol, struct ntfs_dir *dir) if (!vol || !dir) return -1; + ntfs_log_trace ("dir %p, inode %lld, children %d\n", dir, + dir ? MREF(dir->mft_num) : 0, dir ? dir->child_count : 0); + if ((dir->ialloc == NULL) || (dir->bitmap == NULL)) return 0; @@ -1581,7 +1581,7 @@ int ntfs_dir_truncate(ntfs_volume *vol, struct ntfs_dir *dir) return 0; } - ntfs_log_debug(BOLD YELLOW "Truncation needed\n" END); + ntfs_log_debug("Truncation needed\n"); #if 0 ntfs_log_debug("\tlast bit = %lld\n", last_bit); @@ -1598,13 +1598,13 @@ int ntfs_dir_truncate(ntfs_volume *vol, struct ntfs_dir *dir) ie = ntfs_ie_copy(dir->index->children[0]); if (!ie) { - ntfs_log_debug(RED "IE copy failed\n" END); + ntfs_log_warning("IE copy failed\n"); return -1; } ie = ntfs_ie_remove_vcn(ie); if (!ie) { - ntfs_log_debug(RED "IE remove vcn failed\n" END); + ntfs_log_warning("IE remove vcn failed\n"); return -1; } @@ -1639,7 +1639,7 @@ int ntfs_dir_truncate(ntfs_volume *vol, struct ntfs_dir *dir) //remove 0xB0 attribute ntfs_mft_remove_attr(vol->private_bmp2, dir->inode, AT_BITMAP); } else { - ntfs_log_debug(RED "Cannot shrink directory\n" END); + ntfs_log_warning("Cannot shrink directory\n"); //ntfs_dir_shrink_alloc //ntfs_dir_shrink_bitmap //make bitmap resident? @@ -1702,12 +1702,12 @@ int ntfs_dir_commit(struct ntfs_dir *dir) if (!dir) return 0; - ntfs_log_debug("commit dir inode %llu\n", dir->inode->mft_no); + ntfs_log_trace ("dir %p, inode %lld, children %d\n", dir, + dir ? MREF(dir->mft_num) : 0, dir ? dir->child_count : 0); + if (NInoDirty(dir->inode)) { -#ifdef RM_WRITE ntfs_inode_sync(dir->inode); -#endif - ntfs_log_debug(RED "\tntfs_inode_sync %llu\n" END, dir->inode->mft_no); + ntfs_log_warning("\tntfs_inode_sync %llu\n", dir->inode->mft_no); } if (ntfs_dt_commit(dir->index) < 0) @@ -1735,6 +1735,9 @@ void ntfs_dir_free(struct ntfs_dir *dir) if (!dir) return; + ntfs_log_trace ("dir %p, inode %lld, children %d\n", dir, + dir ? MREF(dir->mft_num) : 0, dir ? dir->child_count : 0); + ntfs_dir_rollback(dir); parent = dir->parent; @@ -1775,7 +1778,8 @@ struct ntfs_dir * ntfs_dir_create(ntfs_volume *vol, MFT_REF mft_num) if (!vol) return NULL; - //ntfs_log_debug("ntfs_dir_create %lld\n", MREF(mft_num)); + ntfs_log_trace ("inode %lld\n", MREF(mft_num)); + inode = ntfs_inode_open2(vol, mft_num); if (!inode) return NULL; @@ -1811,6 +1815,7 @@ struct ntfs_dir * ntfs_dir_create(ntfs_volume *vol, MFT_REF mft_num) rec = find_first_attribute(AT_INDEX_ROOT, inode->mrec); ir = (INDEX_ROOT*) ((u8*)rec + rec->value_offset); dir->index_size = ir->index_block_size; + ntfs_log_debug("dir size = %d\n", dir->index_size); } else { // XXX !iroot? dir->index_size = 0; @@ -1835,6 +1840,11 @@ void ntfs_dir_add(struct ntfs_dir *parent, struct ntfs_dir *child) if (!parent || !child) return; + ntfs_log_trace ("parent %p, inode %lld, children %d\n", parent, + parent ? MREF(parent->mft_num) : 0, parent ? parent->child_count : 0); + ntfs_log_trace ("child %p, inode %lld, children %d\n", child, + child ? MREF(child->mft_num) : 0, child ? child->child_count : 0); + parent->child_count++; //ntfs_log_debug("child count = %d\n", parent->child_count); parent->children = realloc(parent->children, parent->child_count * sizeof(struct ntfs_dir*)); @@ -1858,6 +1868,9 @@ struct ntfs_dir * ntfs_dir_find2(struct ntfs_dir *dir, ntfschar *name, int name_ if (!dir || !name) return NULL; + ntfs_log_trace ("dir %p, inode %lld, children %d\n", dir, + dir ? MREF(dir->mft_num) : 0, dir ? dir->child_count : 0); + if (!dir->index) { // XXX when will this happen? ntfs_log_debug("ntfs_dir_find2 - directory has no index\n"); return NULL; diff --git a/libntfs/index.c b/libntfs/index.c index e4704a96..2c0330d5 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -666,6 +666,7 @@ err_out: */ void ntfs_ie_free(INDEX_ENTRY *ie) { + ntfs_log_trace ("ie %p, inode %lld\n", ie, MREF(ie->indexed_file)); free(ie); } @@ -677,6 +678,7 @@ INDEX_ENTRY * ntfs_ie_create(void) int length; INDEX_ENTRY *ie; + ntfs_log_trace ("\n"); length = 16; ie = calloc(1, length); if (!ie) @@ -700,6 +702,7 @@ VCN ntfs_ie_get_vcn(INDEX_ENTRY *ie) if (!(ie->flags & INDEX_ENTRY_NODE)) return -1; + ntfs_log_trace ("\n"); return *((VCN*) ((u8*) ie + ie->length - 8)); } @@ -713,6 +716,7 @@ INDEX_ENTRY * ntfs_ie_copy(INDEX_ENTRY *ie) if (!ie) return NULL; + ntfs_log_trace ("\n"); copy = malloc(ie->length); if (!copy) return NULL; @@ -729,6 +733,7 @@ INDEX_ENTRY * ntfs_ie_set_vcn(INDEX_ENTRY *ie, VCN vcn) if (!ie) return 0; + ntfs_log_trace ("\n"); if (!(ie->flags & INDEX_ENTRY_NODE)) { ie->length += 8; ie = realloc(ie, ie->length); @@ -752,6 +757,7 @@ INDEX_ENTRY * ntfs_ie_remove_vcn(INDEX_ENTRY *ie) if (!(ie->flags & INDEX_ENTRY_NODE)) return ie; + ntfs_log_trace ("\n"); ie->length -= 8; ie->flags &= ~INDEX_ENTRY_NODE; ie = realloc(ie, ie->length); @@ -771,6 +777,7 @@ INDEX_ENTRY * ntfs_ie_set_name(INDEX_ENTRY *ie, ntfschar *name, int namelen, FIL if (!ie || !name) return NULL; + ntfs_log_trace ("\n"); /* * INDEX_ENTRY * MFT_REF indexed_file; @@ -857,6 +864,7 @@ INDEX_ENTRY * ntfs_ie_remove_name(INDEX_ENTRY *ie) if (ie->key_length == 0) return ie; + ntfs_log_trace ("\n"); if (ie->flags & INDEX_ENTRY_NODE) vcn = ntfs_ie_get_vcn(ie); diff --git a/libntfs/inode.c b/libntfs/inode.c index a01ed251..41396f2b 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -1061,6 +1061,8 @@ put_err_out: #ifdef NTFS_RICH +#include "rich.h" + /** * ntfs_inode_close2 */ @@ -1069,7 +1071,7 @@ int ntfs_inode_close2(ntfs_inode *ni) if (!ni) return 0; - //ntfs_log_debug(BOLD YELLOW "inode close %lld (%d)\n" END, ni->mft_no, ni->ref_count); + ntfs_log_trace ("inode %p, mft %lld, refcount %d\n", ni, MREF(ni->mft_no), ni->ref_count); ni->ref_count--; if (ni->ref_count > 0) @@ -1095,10 +1097,12 @@ ntfs_inode * ntfs_inode_open2(ntfs_volume *vol, const MFT_REF mref) if (!vol) return NULL; + ntfs_log_trace ("\n"); switch (mref) { case FILE_Bitmap: ino = vol->lcnbmp_ni; break; case FILE_MFT: ino = vol->mft_ni; break; case FILE_MFTMirr: ino = vol->mftmirr_ni; break; + case FILE_Volume: ino = vol->vol_ni; break; case FILE_root: dir = vol->private_data; if (dir) @@ -1107,7 +1111,7 @@ ntfs_inode * ntfs_inode_open2(ntfs_volume *vol, const MFT_REF mref) } if (ino) { - //ntfs_log_debug(BOLD YELLOW "inode reuse %lld\n" END, mref); + ntfs_log_debug("inode reuse %lld\n", mref); ino->ref_count++; return ino; } @@ -1127,7 +1131,7 @@ ntfs_inode * ntfs_inode_open2(ntfs_volume *vol, const MFT_REF mref) ino->private_data = NULL; ino->ref_count = 1; - //ntfs_log_debug(BOLD YELLOW "inode open %lld\n" END, mref); + ntfs_log_debug("inode open %lld, 0x%llx\n", MREF(mref), mref); return ino; } @@ -1142,6 +1146,7 @@ ntfs_inode * ntfs_inode_open3(ntfs_volume *vol, const MFT_REF mref) if (!vol) return NULL; + ntfs_log_trace ("\n"); ino = calloc(1, sizeof(*ino)); if (!ino) return NULL; diff --git a/libntfs/mft.c b/libntfs/mft.c index d5c10b69..63fffeea 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -1556,6 +1556,7 @@ sync_rollback: #include "tree.h" #include "index.h" #include "rich.h" +#include "utils.h" /** * ntfs_mft_remove_attr @@ -1570,6 +1571,7 @@ int ntfs_mft_remove_attr(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES typ if (!inode) return 1; + ntfs_log_trace ("\n"); attr20 = find_first_attribute(AT_ATTRIBUTE_LIST, inode->mrec); if (attr20) return 1; @@ -1633,6 +1635,7 @@ ATTR_RECORD * ntfs_mft_add_attr(ntfs_inode *inode, ATTR_TYPES type, u8 *data, in if (!data) return NULL; + ntfs_log_trace ("inode %p, mft %lld, attr 0x%02x, len %d\n", inode, inode->mft_no, type, data_len); attr_size = ATTR_SIZE(data_len); mrec = inode->mrec; @@ -1703,6 +1706,7 @@ int ntfs_mft_resize_resident(ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, MFT_RECORD *mrec = NULL; int res = -1; + ntfs_log_trace ("\n"); // XXX only works when attr is in base inode if ((!inode) || (!inode->mrec)) @@ -1711,6 +1715,8 @@ int ntfs_mft_resize_resident(ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, return -1; mrec = inode->mrec; + ntfs_log_debug("inode = %lld\n", MREF(inode->mft_no)); + //utils_dump_mem(mrec, 0, 1024, DM_DEFAULTS); mft_size = mrec->bytes_allocated; mft_usage = mrec->bytes_in_use; @@ -1721,10 +1727,12 @@ int ntfs_mft_resize_resident(ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, //ntfs_log_debug("mft_free = %d\n", mft_free); //ntfs_log_debug("\n"); - ctx = ntfs_attr_get_search_ctx(NULL, mrec); + ctx = ntfs_attr_get_search_ctx(inode, NULL); if (!ctx) goto done; + ntfs_name_print(name, name_len); + ntfs_log_debug(" type = 0x%02x\n", type); if (ntfs_attr_lookup(type, name, name_len, CASE_SENSITIVE, 0, NULL, 0, ctx) != 0) goto done; @@ -1738,8 +1746,8 @@ int ntfs_mft_resize_resident(ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, attr_orig = arec->value_length; attr_new = data_len; - //ntfs_log_debug("attr orig = %d\n", attr_orig); - //ntfs_log_debug("attr new = %d\n", attr_new); + ntfs_log_debug("attr orig = %d\n", attr_orig); + ntfs_log_debug("attr new = %d\n", attr_new); //ntfs_log_debug("\n"); if ((attr_new - attr_orig + mft_usage) > mft_size) { @@ -1789,6 +1797,7 @@ int ntfs_mft_free_space(struct ntfs_dir *dir) if ((!dir) || (!dir->inode)) return -1; + ntfs_log_trace ("\n"); mft = (MFT_RECORD*) dir->inode->mrec; res = mft->bytes_allocated - mft->bytes_in_use; @@ -1816,8 +1825,9 @@ int ntfs_mft_add_index(struct ntfs_dir *dir) if (dir->index_size < 512) return 1; + ntfs_log_trace ("\n"); vol = dir->vol; - ntfs_log_debug("add two attrs to " YELLOW); ntfs_name_print(dir->name, dir->name_len); ntfs_log_debug(END "\n"); + ntfs_log_debug("add two attrs to "); ntfs_name_print(dir->name, dir->name_len); ntfs_log_debug("\n"); ntfs_log_debug("index size = %d\n", dir->index_size); buffer = malloc(dir->index_size); diff --git a/libntfs/rich.c b/libntfs/rich.c index 71f5652f..cb7ec73c 100644 --- a/libntfs/rich.c +++ b/libntfs/rich.c @@ -28,6 +28,9 @@ #ifdef HAVE_STDLIB_H #include #endif +#ifdef HAVE_ERRNO_H +#include +#endif #ifdef HAVE_ERRNO_H #include @@ -58,6 +61,7 @@ ATTR_RECORD * find_attribute(const ATTR_TYPES type, ntfs_attr_search_ctx *ctx) return NULL; } + ntfs_log_trace ("\n"); if (ntfs_attr_lookup(type, NULL, 0, 0, 0, NULL, 0, ctx) != 0) { ntfs_log_debug("find_attribute didn't find an attribute of type: 0x%02x.\n", type); return NULL; /* None / no more of that type */ @@ -91,6 +95,7 @@ ATTR_RECORD * find_first_attribute(const ATTR_TYPES type, MFT_RECORD *mft) return NULL; } + ntfs_log_trace ("\n"); ctx = ntfs_attr_get_search_ctx(NULL, mft); if (!ctx) { //XXX ntfs_log_error("Couldn't create a search context.\n"); @@ -115,10 +120,10 @@ void ntfs_name_print(ntfschar *name, int name_len) if (name_len) { ntfs_ucstombs(name, name_len, &buffer, 0); - ntfs_log_info("%s", buffer); + ntfs_log_debug("%s", buffer); free(buffer); } else { - ntfs_log_info("!"); + ntfs_log_debug("!"); } } @@ -141,6 +146,7 @@ int utils_free_non_residents3(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECO if (!attr->non_resident) return 0; + ntfs_log_trace ("\n"); na = ntfs_attr_open(inode, attr->type, NULL, 0); if (!na) return 1; @@ -150,7 +156,7 @@ int utils_free_non_residents3(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECO size = na->allocated_size >> inode->vol->cluster_size_bits; for (count = 0; count < size; count += rl->length, rl++) { if (ntfs_bmp_set_range(bmp, rl->lcn, rl->length, 0) < 0) { - ntfs_log_info(RED "set range : %lld - %lld FAILED\n" END, rl->lcn, rl->lcn+rl->length-1); + ntfs_log_warning("set range : %lld - %lld FAILED\n", rl->lcn, rl->lcn+rl->length-1); } } ntfs_attr_close(na); @@ -170,6 +176,7 @@ int utils_free_non_residents2(ntfs_inode *inode, struct ntfs_bmp *bmp) if (!bmp) return -1; + ntfs_log_trace ("\n"); ctx = ntfs_attr_get_search_ctx(NULL, inode->mrec); if (!ctx) { ntfs_log_info("can't create a search context\n"); diff --git a/libntfs/runlist.c b/libntfs/runlist.c index ccce7538..ac909c65 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -601,12 +601,12 @@ runlist_element *ntfs_runlists_merge(runlist_element *drl, ss++; if (marker && (drl[dins].vcn + drl[dins].length > srl[send - 1].vcn)) finish = FALSE; -#ifdef DEBUG + ntfs_log_debug("dfinal = %i, dend = %i\n", dfinal, dend); ntfs_log_debug("sstart = %i, sfinal = %i, send = %i\n", sstart, sfinal, send); ntfs_log_debug("start = %i, finish = %i\n", start, finish); ntfs_log_debug("ds = %i, ss = %i, dins = %i\n", ds, ss, dins); -#endif + if (start) { if (finish) drl = ntfs_rl_replace(drl, ds, srl + sstart, ss, dins); diff --git a/libntfs/tree.c b/libntfs/tree.c index e111407a..482bd1b2 100644 --- a/libntfs/tree.c +++ b/libntfs/tree.c @@ -40,6 +40,7 @@ #include "inode.h" #include "logging.h" #include "rich.h" +#include "utils.h" /** * ntfs_dt_free @@ -51,6 +52,8 @@ void ntfs_dt_free(struct ntfs_dt *dt) if (!dt) return; + ntfs_log_trace ("dt %p, children %d, dir %lld\n", dt, dt->child_count, MREF(dt->dir->mft_num)); + for (i = 0; i < dt->child_count; i++) { ntfs_dt_free(dt->sub_nodes[i]); ntfs_inode_close2(dt->inodes[i]); @@ -75,6 +78,8 @@ int ntfs_dt_rollback(struct ntfs_dt *dt) if (dt->child_count == 0) // No children or nothing mapped return 0; + ntfs_log_trace ("dt %p, children %d, dir %lld\n", dt, dt->child_count, MREF(dt->dir->mft_num)); + if (dt->changed) { // We can't trust anything below us in the tree for (i = 0; i < dt->child_count; i++) { @@ -122,6 +127,8 @@ int ntfs_dt_commit(struct ntfs_dt *dt) if (!dt) return 0; + ntfs_log_trace ("dt %p, children %d, dir %lld\n", dt, dt->child_count, MREF(dt->dir->mft_num)); + dir = dt->dir; if (!dir) return -1; @@ -134,31 +141,27 @@ int ntfs_dt_commit(struct ntfs_dt *dt) attr = dt->dir->ialloc; size = dt->dir->index_size; //utils_dump_mem(dt->data, 0, size, DM_DEFAULTS); -#ifdef RM_WRITE ntfs_attr_mst_pwrite(attr, dt->vcn * vol->cluster_size, 1, size, dt->data); // XXX retval -#endif } else { ntfs_log_debug("commit dt (root)\n"); attr = dt->dir->iroot; size = dt->data_len; //utils_dump_mem(dt->data, 0, size, DM_DEFAULTS); -#ifdef RM_WRITE ntfs_attr_pwrite(attr, 0, size, dt->data); // XXX retval -#endif } - ntfs_log_debug(RED "\tntfs_attr_pwrite(vcn %lld)\n" END, dt->vcn); + ntfs_log_warning("\tntfs_attr_pwrite(vcn %lld)\n", dt->vcn); dt->changed = FALSE; + } else { + //ntfs_log_debug("\tdt is clean\n"); } for (i = 0; i < dt->child_count; i++) { if ((dt->inodes[i]) && (NInoDirty(dt->inodes[i]))) { //utils_dump_mem(dt->inodes[i]->mrec, 0, vol->mft_record_size, DM_DEFAULTS); -#ifdef RM_WRITE ntfs_inode_sync(dt->inodes[i]); -#endif - ntfs_log_debug(RED "\tntfs_inode_sync %llu\n" END, dt->inodes[i]->mft_no); + ntfs_log_warning("\tntfs_inode_sync %llu\n", dt->inodes[i]->mft_no); } if (ntfs_dt_commit(dt->sub_nodes[i]) < 0) @@ -181,6 +184,7 @@ BOOL ntfs_dt_create_children2(struct ntfs_dt *dt, int count) if (old == new) return TRUE; + ntfs_log_trace ("\n"); dt->children = realloc(dt->children, new * sizeof(*dt->children)); dt->sub_nodes = realloc(dt->sub_nodes, new * sizeof(*dt->sub_nodes)); dt->inodes = realloc(dt->inodes, new * sizeof(*dt->inodes)); @@ -213,6 +217,7 @@ BOOL ntfs_dt_resize_children3(struct ntfs_dt *dt, int new) if (old == new) return TRUE; + ntfs_log_trace ("dt %p, mft %lld, old %d, new %d\n", dt, MREF(dt->dir->mft_num), old, new); dt->child_count = new; old *= sizeof(*dt->children); @@ -252,9 +257,12 @@ int ntfs_dt_root_count(struct ntfs_dt *dt) if (!dt) return -1; + ntfs_log_trace ("\n"); buffer = dt->data; size = dt->data_len; + //utils_dump_mem(buffer, 0, size, DM_DEFAULTS); + root = (INDEX_ROOT*) buffer; if (root->type != AT_FILE_NAME) return -1; @@ -311,6 +319,7 @@ int ntfs_dt_alloc_count(struct ntfs_dt *dt) if (!dt) return -1; + ntfs_log_trace ("\n"); buffer = dt->data; size = dt->data_len; @@ -365,6 +374,7 @@ int ntfs_dt_initialise2(ntfs_volume *vol, struct ntfs_dt *dt) if (!dt) return 1; + ntfs_log_trace ("\n"); memset(dt->data, 0, dt->data_len); alloc = (INDEX_ALLOCATION*) dt->data; @@ -409,6 +419,7 @@ struct ntfs_dt * ntfs_dt_create(struct ntfs_dir *dir, struct ntfs_dt *parent, VC if (!dt) return NULL; + ntfs_log_trace ("\n"); dt->dir = dir; dt->parent = parent; dt->child_count = 0; @@ -488,7 +499,7 @@ struct ntfs_dt * ntfs_dt_create(struct ntfs_dir *dir, struct ntfs_dt *parent, VC } #endif } - //ntfs_log_debug("index_header (%d,%d)\n", dt->header.index_length, dt->header.allocated_size); + //ntfs_log_debug("index_header (%d,%d)\n", dt->header->index_length, dt->header->allocated_size); return dt; } @@ -510,6 +521,7 @@ MFT_REF ntfs_dt_find(struct ntfs_dt *dt, ntfschar *name, int name_len) if (!dt || !name) return -1; + ntfs_log_trace ("\n"); /* * State Children Action * ------------------------------------------- @@ -583,6 +595,11 @@ struct ntfs_dt * ntfs_dt_find2(struct ntfs_dt *dt, ntfschar *name, int name_len, if (!dt || !name) return NULL; + ntfs_log_trace ("dt %p, mft %llu, name %p%d\n", dt, MREF(dt->dir->mft_num), name, name_len); + + //ntfs_log_debug("searching for: "); ntfs_name_print(name, name_len); ntfs_log_debug("\n"); + + //utils_dump_mem(dt->data, 0, 256, DM_DEFAULTS); // XXX default index_num to -1 @@ -605,6 +622,8 @@ struct ntfs_dt * ntfs_dt_find2(struct ntfs_dt *dt, ntfschar *name, int name_len, r = -1; } else { //ntfs_log_debug("\t"); ntfs_name_print(ie->key.file_name.file_name, ie->key.file_name.file_name_length); ntfs_log_debug("\n"); + //utils_dump_mem(name, 0, name_len * 2, DM_DEFAULTS); + //utils_dump_mem(ie->key.file_name.file_name, 0, ie->key.file_name.file_name_length * 2, DM_DEFAULTS); r = ntfs_names_collate(name, name_len, ie->key.file_name.file_name, ie->key.file_name.file_name_length, @@ -632,7 +651,7 @@ struct ntfs_dt * ntfs_dt_find2(struct ntfs_dt *dt, ntfschar *name, int name_len, } res = ntfs_dt_find2(dt->sub_nodes[i], name, name_len, index_num); } else { - ntfs_log_debug("error collating name\n"); + //ntfs_log_debug("error collating name\n"); } break; } @@ -654,6 +673,7 @@ struct ntfs_dt * ntfs_dt_find3(struct ntfs_dt *dt, ntfschar *name, int name_len, if (!dt || !name) return NULL; + ntfs_log_trace ("\n"); //ntfs_log_debug("child_count = %d\n", dt->child_count); for (i = 0; i < dt->child_count; i++) { @@ -716,6 +736,7 @@ struct ntfs_dt * ntfs_dt_find4(struct ntfs_dt *dt, ntfschar *name, int name_len, if (!dt || !name) return NULL; + ntfs_log_trace ("\n"); //ntfs_log_debug("child_count = %d\n", dt->child_count); for (i = 0; i < dt->child_count; i++) { @@ -780,6 +801,7 @@ void ntfs_dt_find_all(struct ntfs_dt *dt) if (!dt) return; + ntfs_log_trace ("\n"); for (i = 0; i < dt->child_count; i++) { ie = dt->children[i]; @@ -804,6 +826,7 @@ int ntfs_dt_find_parent(struct ntfs_dt *dt) if (!dt) return -1; + ntfs_log_trace ("\n"); parent = dt->parent; if (!parent) @@ -823,6 +846,7 @@ BOOL ntfs_dt_isroot(struct ntfs_dt *dt) { if (!dt) return FALSE; + ntfs_log_trace ("\n"); return (dt->parent == NULL); } @@ -837,6 +861,7 @@ int ntfs_dt_root_freespace(struct ntfs_dt *dt) if (!dt) return -1; + ntfs_log_trace ("\n"); recsize = dt->dir->inode->vol->mft_record_size; @@ -857,6 +882,7 @@ int ntfs_dt_alloc_freespace(struct ntfs_dt *dt) if (!dt) return -1; + ntfs_log_trace ("\n"); recsize = dt->dir->index_size; @@ -880,6 +906,7 @@ int ntfs_dt_transfer(struct ntfs_dt *old, struct ntfs_dt *new, int start, int co int len; int insert; //FILE_NAME_ATTR *file; + ntfs_log_trace ("\n"); //XXX check len > 0 @@ -889,8 +916,8 @@ int ntfs_dt_transfer(struct ntfs_dt *old, struct ntfs_dt *new, int start, int co if ((start < 0) || ((start+count) >= old->child_count)) return -1; - ntfs_log_debug("\n"); - ntfs_log_debug(BOLD YELLOW "Transferring children\n" END); + //ntfs_log_debug("\n"); + ntfs_log_debug("Transferring children\n"); need = 0; for (i = start; i < (start+count+1); i++) { @@ -1009,8 +1036,8 @@ int ntfs_dt_transfer(struct ntfs_dt *old, struct ntfs_dt *new, int start, int co old->changed = TRUE; new->changed = TRUE; - ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); - ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); + ntfs_log_debug("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); + ntfs_log_debug("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); return 0; } @@ -1034,6 +1061,7 @@ int ntfs_dt_alloc_insert(struct ntfs_dt *dt, INDEX_ENTRY *first, int count) return 1; if (!first) return 1; + ntfs_log_trace ("\n"); need = 0; ie = first; @@ -1098,6 +1126,7 @@ INDEX_ENTRY * ntfs_dt_alloc_insert2(struct ntfs_dt *dt, int before, int count, i return NULL; if (bytes < 1) return NULL; + ntfs_log_trace ("\n"); // check alloc has enough space space = ntfs_dt_alloc_freespace(dt); @@ -1153,6 +1182,7 @@ int ntfs_dt_root_insert(struct ntfs_dt *dt, INDEX_ENTRY *first, int count) return 1; if (!first) return 1; + ntfs_log_trace ("\n"); return count; } @@ -1167,6 +1197,7 @@ int ntfs_dt_alloc_remove2(struct ntfs_dt *dt, int start, int count) if (!dt) return 1; + ntfs_log_trace ("\n"); size = 0; for (i = start; i < (start+count); i++) { @@ -1190,6 +1221,7 @@ int ntfs_dt_root_remove2(struct ntfs_dt *dt, int start, int count) return -1; if ((count < 1) || ((start + count - 1) >= dt->child_count)) return -1; + ntfs_log_trace ("\n"); ntfs_log_debug("s c/t %d %d/%d\n", start, count, dt->child_count); @@ -1240,9 +1272,10 @@ int ntfs_dt_transfer2(struct ntfs_dt *old, struct ntfs_dt *new, int start, int c if ((start + count) >= old->child_count) return -1; + ntfs_log_trace ("\n"); - ntfs_log_debug("\n"); - ntfs_log_debug(BOLD YELLOW "Transferring children\n" END); + //ntfs_log_debug("\n"); + ntfs_log_debug("Transferring children\n"); need = 0; for (i = start; i < (start+count); i++) { @@ -1371,8 +1404,8 @@ int ntfs_dt_transfer2(struct ntfs_dt *old, struct ntfs_dt *new, int start, int c old->changed = TRUE; new->changed = TRUE; - ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); - ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); + ntfs_log_debug("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", old->dir->inode->mft_no, old->vcn, old->vcn + (old->dir->index_size>>9) - 1); + ntfs_log_debug("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", new->dir->inode->mft_no, new->vcn, new->vcn + (new->dir->index_size>>9) - 1); return 0; } @@ -1390,6 +1423,7 @@ int ntfs_dt_root_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, if (!del || !del_ie || !suc_ie) return FALSE; + ntfs_log_trace ("\n"); //utils_dump_mem(del->data, 0, del->data_len, DM_DEFAULTS); //ntfs_log_debug("\n"); @@ -1430,7 +1464,7 @@ int ntfs_dt_root_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, //utils_dump_mem(attr, 0, del->data_len, DM_DEFAULTS); //ntfs_log_debug("\n"); - //ntfs_log_debug(BOLD YELLOW "Adjust children\n" END); + //ntfs_log_debug("Adjust children\n"); //for (i = 0; i < del->child_count; i++) // ntfs_log_debug("\tChild %d %p %d\n", i, del->children[i], del->children[i]->flags); //ntfs_log_debug("\n"); @@ -1452,7 +1486,7 @@ int ntfs_dt_root_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, del->changed = TRUE; - ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); + ntfs_log_debug("Modified: inode %lld, $INDEX_ROOT\n", del->dir->inode->mft_no); return TRUE; } @@ -1468,6 +1502,7 @@ BOOL ntfs_dt_alloc_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie if (!del || !del_ie || !suc_ie) return FALSE; + ntfs_log_trace ("\n"); //utils_dump_mem(del->data, 0, del->data_len, DM_DEFAULTS); @@ -1514,7 +1549,7 @@ BOOL ntfs_dt_alloc_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie del->changed = TRUE; - ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); + ntfs_log_debug("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); return TRUE; } @@ -1534,6 +1569,7 @@ BOOL ntfs_dt_root_remove(struct ntfs_dt *del, int del_num) if (!del) return FALSE; + ntfs_log_trace ("\n"); //utils_dump_mem(del->data, 0, del->header->index_length+16, DM_RED); //ntfs_log_debug("\n"); @@ -1635,7 +1671,7 @@ BOOL ntfs_dt_root_remove(struct ntfs_dt *del, int del_num) del->changed = TRUE; - ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, del->dir->inode->mft_no); + ntfs_log_debug("Modified: inode %lld, $INDEX_ROOT\n", del->dir->inode->mft_no); return TRUE; } @@ -1653,6 +1689,7 @@ BOOL ntfs_dt_alloc_remove(struct ntfs_dt *del, int del_num) if (!del) return FALSE; + ntfs_log_trace ("\n"); #if 0 off = (u8*)del->children[0] - del->data; @@ -1751,7 +1788,7 @@ BOOL ntfs_dt_alloc_remove(struct ntfs_dt *del, int del_num) del->changed = TRUE; - ntfs_log_debug(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); + ntfs_log_debug("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", del->dir->inode->mft_no, del->vcn, del->vcn + (del->dir->index_size>>9) - 1); if (del->child_count < 2) { ntfs_log_debug("indx is empty\n"); @@ -1776,6 +1813,7 @@ int ntfs_dt_alloc_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, st if (!parent || !ie) return 0; + ntfs_log_trace ("\n"); block = (INDEX_BLOCK*) parent->data; @@ -1864,12 +1902,13 @@ int ntfs_dt_root_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, str int len; if (!parent || !ie) - return 0; + return -1; + ntfs_log_trace ("\n"); root = (INDEX_ROOT*) parent->data; //utils_dump_mem(parent->data, 0, parent->data_len, DM_DEFAULTS); - ntfs_log_debug("\n"); + //ntfs_log_debug("\n"); need = ie->length; space = ntfs_mft_free_space(parent->dir); @@ -1877,7 +1916,7 @@ int ntfs_dt_root_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, str ntfs_log_debug("need %d, have %d\n", need, space); if (need > space) { ntfs_log_debug("no room"); - return 0; + return -1; } attr = malloc(parent->data_len + need); @@ -1904,14 +1943,17 @@ int ntfs_dt_root_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, str parent->data = attr; parent->data_len += need; + ntfs_log_debug("parent data len = %d\n", parent->data_len); + root = (INDEX_ROOT*) parent->data; root->index.index_length = parent->data_len - 16; root->index.allocated_size = parent->data_len - 16; //utils_dump_mem(parent->data, 0, parent->data_len, DM_DEFAULTS); - ntfs_log_debug("\n"); + //ntfs_log_debug("\n"); ntfs_mft_resize_resident(parent->dir->inode, AT_INDEX_ROOT, NTFS_INDEX_I30, 4, parent->data, parent->data_len); + parent->changed = TRUE; //realloc children, sub_nodes ntfs_dt_create_children2(parent, parent->child_count + 1); @@ -1965,9 +2007,9 @@ int ntfs_dt_add2(INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs_ if (!ie || !suc) return -1; + ntfs_log_trace ("\n"); - ntfs_log_debug("\n"); - ntfs_log_debug(BOLD YELLOW "Add key to leaf\n" END); + ntfs_log_debug("Add key to leaf\n"); //utils_dump_mem(suc->data, 0, suc->data_len, DM_DEFAULTS); @@ -1998,11 +2040,17 @@ ascend: ntfs_log_debug("\tspace %d\n", space); if (space >= need) { + //ntfs_log_critical("index = %d\n", suc_num); + //ntfs_log_debug("prev inode = %p\n", suc->inodes[suc_num-1]); + //ntfs_log_debug("curr inode = %p\n", suc->inodes[suc_num]); + ntfs_log_debug("count = %d\n", suc->child_count); if (ntfs_dt_isroot(suc)) ntfs_dt_root_add(suc, suc_num, ie, chl); else ntfs_dt_alloc_add(suc, suc_num, ie, chl); - goto done; + ntfs_log_debug("count = %d\n", suc->child_count); + //goto done; + return suc_num; //XXX this is probably off-by-one } /* @@ -2112,8 +2160,8 @@ ascend: suc = suc->parent; suc_num = 0; - ntfs_log_debug("\n"); - ntfs_log_debug(BOLD YELLOW "Ascend\n" END); + //ntfs_log_debug("\n"); + ntfs_log_debug("Ascend\n"); goto ascend; done: return 0; diff --git a/libntfs/volume.c b/libntfs/volume.c index 5c5ca3a2..fcbd36b0 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1537,6 +1537,7 @@ err_out: #ifdef NTFS_RICH #include "tree.h" +#include "rich.h" /** * utils_valid_device - Perform some safety checks on the device before we start @@ -1562,45 +1563,43 @@ int utils_valid_device(const char *name, int force) errno = EINVAL; return 0; } + ntfs_log_trace ("\n"); if (stat(name, &st) == -1) { if (errno == ENOENT) { ntfs_log_error("The device %s doesn't exist\n", name); } else { - ntfs_log_perror("Error getting information about %s", - name); + ntfs_log_perror("Error getting information about %s", name); } return 0; } - if (!S_ISBLK(st.st_mode)) { - ntfs_log_verbose("%s is not a block device.\n", name); + if (!S_ISBLK(st.st_mode) && !S_ISREG(st.st_mode)) { + ntfs_log_warning("%s is not a block device, " + "nor regular file.\n", name); if (!force) { - ntfs_log_error("Use the force option to work with " - "files.\n"); + ntfs_log_error("Use the force option to work with other" + " file types, for your own risk!\n"); return 0; } - ntfs_log_verbose("Forced to continue.\n"); + ntfs_log_warning("Forced to continue.\n"); } /* Make sure the file system is not mounted. */ if (ntfs_check_if_mounted(name, &mnt_flags)) { - ntfs_log_perror("Failed to determine whether %s is mounted", - name); + ntfs_log_perror("Failed to determine whether %s is mounted", name); if (!force) { - ntfs_log_error("Use the force option to ignore this " - "error.\n"); + ntfs_log_error("Use the force option to ignore this error.\n"); return 0; } - ntfs_log_verbose("Forced to continue.\n"); + ntfs_log_warning("Forced to continue.\n"); } else if (mnt_flags & NTFS_MF_MOUNTED) { - ntfs_log_verbose("The device %s, is mounted.\n", name); + ntfs_log_warning("The device %s, is mounted.\n", name); if (!force) { - ntfs_log_error("Use the force option to work a mounted " - "filesystem.\n"); + ntfs_log_error("Use the force option to work a mounted filesystem.\n"); return 0; } - ntfs_log_verbose("Forced to continue.\n"); + ntfs_log_warning("Forced to continue.\n"); } return 1; @@ -1617,6 +1616,7 @@ ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL f errno = EINVAL; return NULL; } + ntfs_log_trace ("\n"); if (!utils_valid_device(device, force)) return NULL; @@ -1627,20 +1627,22 @@ ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL f err = errno; ntfs_log_perror("Couldn't mount device '%s'", device); - if (err == EOPNOTSUPP) - ntfs_log_error("Windows was either hibernated or did not " - "shut down properly. Try to mount " + if (err == EPERM) + ntfs_log_error("Windows was hibernated. Try to mount " "volume in windows, shut down and try " "again.\n"); + if (err == EOPNOTSUPP) + ntfs_log_error("Windows did not shut down properly. " + "Try to mount volume in windows, " + "shut down and try again.\n"); return NULL; } if (vol->flags & VOLUME_IS_DIRTY) { - ntfs_log_quiet("Volume is dirty.\n"); - return NULL; + ntfs_log_warning("Volume is dirty.\n"); if (!force) { ntfs_log_error("Run chkdsk and try again, or use the " - "--force option.\n"); + "force option.\n"); ntfs_umount(vol, FALSE); return NULL; } @@ -1658,6 +1660,7 @@ int ntfs_volume_commit(ntfs_volume *vol) if (!vol) return -1; + ntfs_log_trace ("\n"); ntfs_log_debug("commit volume\n"); if (ntfs_bmp_commit(vol->private_bmp1) < 0) return -1; @@ -1678,6 +1681,7 @@ int ntfs_volume_rollback(ntfs_volume *vol) { if (!vol) return -1; + ntfs_log_trace ("\n"); if (ntfs_bmp_rollback(vol->private_bmp1) < 0) return -1; @@ -1701,6 +1705,7 @@ int ntfs_volume_umount2(ntfs_volume *vol, const BOOL force) if (!vol) return 0; + ntfs_log_trace ("\n"); ntfs_volume_rollback(vol); @@ -1768,6 +1773,7 @@ ntfs_volume * ntfs_volume_mount2(const char *device, unsigned long flags, BOOL f struct ntfs_dt *found; int num; + ntfs_log_trace ("\n"); vol = utils_mount_volume(device, flags, force); if (!vol) return NULL; @@ -1793,7 +1799,7 @@ ntfs_volume * ntfs_volume_mount2(const char *device, unsigned long flags, BOOL f //$Bitmap num = -1; - found = ntfs_dt_find2(root, bmp, sizeof(bmp) - 1, &num); + found = ntfs_dt_find2(root, bmp, (sizeof(bmp)/sizeof(ntfschar)) - 1, &num); if ((!found) || (num < 0)) { ntfs_log_debug("can't find $Bitmap\n"); ntfs_volume_umount2(vol, FALSE); @@ -1806,7 +1812,7 @@ ntfs_volume * ntfs_volume_mount2(const char *device, unsigned long flags, BOOL f //$MFT num = -1; - found = ntfs_dt_find2(root, mft, sizeof(mft) - 1, &num); + found = ntfs_dt_find2(root, mft, (sizeof(mft)/sizeof(ntfschar)) - 1, &num); if ((!found) || (num < 0)) { ntfs_log_debug("can't find $MFT\n"); ntfs_volume_umount2(vol, FALSE); @@ -1819,7 +1825,7 @@ ntfs_volume * ntfs_volume_mount2(const char *device, unsigned long flags, BOOL f //$MFTMirr num = -1; - found = ntfs_dt_find2(root, mftmirr, sizeof(mftmirr) - 1, &num); + found = ntfs_dt_find2(root, mftmirr, (sizeof(mftmirr)/sizeof(ntfschar)) - 1, &num); if ((!found) || (num < 0)) { ntfs_log_debug("can't find $MFTMirr\n"); ntfs_volume_umount2(vol, FALSE); @@ -1832,7 +1838,7 @@ ntfs_volume * ntfs_volume_mount2(const char *device, unsigned long flags, BOOL f // root directory num = -1; - found = ntfs_dt_find2(root, dot, 1, &num); + found = ntfs_dt_find2(root, dot, (sizeof(dot)/sizeof(ntfschar)) - 1, &num); if ((!found) || (num < 0)) { ntfs_log_debug("can't find the root directory\n"); ntfs_volume_umount2(vol, FALSE); diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c index 5abdd12e..288f74f6 100644 --- a/ntfsprogs/cluster.c +++ b/ntfsprogs/cluster.c @@ -36,13 +36,6 @@ #include "cluster.h" #include "utils.h" -#if 0 -#define RED "\e[31m" -#define YELLOW "\e[33m" -#define GREEN "\e[01;32m" -#define NORM "\e[0m" -#endif - /** * cluster_find */ @@ -80,7 +73,6 @@ int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void m_ctx->flags_search = FEMR_IN_USE | FEMR_BASE_RECORD; while (mft_next_record(m_ctx) == 0) { - //Qprintf(RED "Inode: %llu\n" NORM, (unsigned long long) Qprintf("Inode: %llu\n", (unsigned long long) m_ctx->inode->mft_no); diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index 7d1054f5..62257e1a 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -54,13 +54,6 @@ GEN_PRINTF(Eprintf, stderr, NULL, FALSE) GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) -#if 0 -#define RED "\e[31m" -#define YELLOW "\e[33m" -#define GREEN "\e[01;32m" -#define NORM "\e[0m" -#endif - /** * version - Print version information about the program * @@ -702,7 +695,6 @@ static s64 move_datarun(ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, need_from = calc_attr_length(rec, need_from); need_to = calc_attr_length(rec, need_to); - //printf(RED "Before %d, after %d\n" NORM, need_from, need_to); printf("Before %d, after %d\n", need_from, need_to); if (need_from != need_to) { diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 47f3f85d..653dfbd4 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -61,13 +61,17 @@ #ifdef HAVE_LIMITS_H #include #endif -#include #ifdef HAVE_STDARG_H #include #endif #ifdef HAVE_UTIME_H #include #endif +#include + +#if !defined(REG_NOERROR) || (REG_NOERROR != 0) +#define REG_NOERROR 0 +#endif #include "ntfsundelete.h" #include "bootsect.h" diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index c627c1ea..425338ff 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -37,16 +37,11 @@ #ifdef HAVE_STDARG_H #include #endif -//#include extern const char *ntfs_bugs; extern const char *ntfs_home; extern const char *ntfs_gpl; -#if !defined(REG_NOERROR) || (REG_NOERROR != 0) -# define REG_NOERROR 0 -#endif - #define DEC_PRINTF(NAME) \ int NAME(const char *format, ...) \ __attribute__((format(printf, 1, 2))); From ec842e871a5b04216720e02644b586710eadf5e0 Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 04:41:39 +0000 Subject: [PATCH 2650/2994] remove some old defines --- ntfsprogs/utils.h | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 425338ff..b58432cb 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -136,27 +136,4 @@ int mft_next_record(struct mft_search_ctx *ctx); #define DM_BLUE (1 << 5) #define DM_BOLD (1 << 6) -#ifdef NTFS_RICH - -#include "layout.h" -#include "volume.h" -#include "inode.h" -#include "bitmap.h" -#include "dir.h" - -#define RED "\e[31m" -#define GREEN "\e[32m" -#define YELLOW "\e[33m" -#define BLUE "\e[34m" -#define MAGENTA "\e[35m" -#define CYAN "\e[36m" -#define BOLD "\e[01m" -#define END "\e[0m" - -#define ROUND_UP(num,bound) (((num)+((bound)-1)) & ~((bound)-1)) -#define ROUND_DOWN(num,bound) ((num) & ~((bound)-1)) -#define ATTR_SIZE(s) ROUND_UP(s,8) - -#endif /* NTFS_RICH */ - #endif /* _NTFS_UTILS_H_ */ From 8aa6d767412202bcb863998491eb05750df9bb6b Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 04:41:54 +0000 Subject: [PATCH 2651/2994] more evil spaces --- ntfsprogs/ntfscat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 152959cb..1b99f30d 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -80,7 +80,7 @@ static void version(void) */ static void usage(void) { - Printf ("\nUsage: %s [options] device [file]\n\n" + Printf("\nUsage: %s [options] device [file]\n\n" " -a, --attribute type Display this attribute type\n" " -n, --attribute-name name Display this attribute name\n" " -i, --inode num Display this inode\n\n" @@ -91,7 +91,7 @@ static void usage(void) " -v --verbose More output\n\n", //" -r --raw Display the compressed or encrypted file", EXEC_NAME); - Printf ("%s%s\n", ntfs_bugs, ntfs_home); + Printf("%s%s\n", ntfs_bugs, ntfs_home); } /** From 59ce9b4285b9e83bd464e70c226580a85d86ef31 Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 04:47:52 +0000 Subject: [PATCH 2652/2994] remove old logging macros add more traces --- ntfsprogs/ntfsrm.c | 70 +++++++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 30b02bea..09ad67ec 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -51,17 +51,12 @@ #include "tree.h" #include "index.h" #include "inode.h" +#include "logging.h" static const char *EXEC_NAME = "ntfsrm"; static struct options opts; static const char *space_line = " "; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) - -#define RM_WRITE 0 - /** * version - Print version information about the program * @@ -181,7 +176,7 @@ static int parse_options(int argc, char **argv) opts.verbose++; break; default: - Eprintf("Unknown option '%s'.\n", argv[optind-1]); + ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); err++; break; } @@ -193,12 +188,12 @@ static int parse_options(int argc, char **argv) if ((opts.device == NULL) || (opts.file == NULL)) { if (argc > 1) - Eprintf("You must specify one device and one file.\n"); + ntfs_log_error("You must specify one device and one file.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf("You may not use --quiet and --verbose at the " + ntfs_log_error("You may not use --quiet and --verbose at the " "same time.\n"); err++; } @@ -263,6 +258,7 @@ static int utils_array_insert(void *ptr, int asize, int before, int count) if (!ptr) return -1; + ntfs_log_trace ("\n"); src = (u8*) ptr + (before * esize); dst = src + (count * esize); len = (asize - before) * esize; @@ -290,6 +286,7 @@ static int utils_array_remove(void *ptr, int asize, int first, int count) if (!ptr) return -1; + ntfs_log_trace ("\n"); dst = (u8*) ptr + (first * esize); src = dst + (count * esize); len = (asize - first) * esize; @@ -326,6 +323,7 @@ static BOOL utils_pathname_to_inode2(ntfs_volume *vol, struct ntfs_dir *parent, return FALSE; } + ntfs_log_trace("\n"); memset(found, 0, sizeof(*found)); if (parent) { @@ -333,7 +331,7 @@ static BOOL utils_pathname_to_inode2(ntfs_volume *vol, struct ntfs_dir *parent, } else { dir = (struct ntfs_dir *) vol->private_data; if (!dir) { - Eprintf("Couldn't open the inode of the root directory.\n"); + ntfs_log_error("Couldn't open the inode of the root directory.\n"); goto close; } } @@ -341,7 +339,7 @@ static BOOL utils_pathname_to_inode2(ntfs_volume *vol, struct ntfs_dir *parent, unicode = malloc(MAX_PATH * sizeof(ntfschar)); ascii = strdup(pathname); // Work with a r/w copy if (!unicode || !ascii) { - Eprintf("Out of memory.\n"); + ntfs_log_error("Out of memory.\n"); goto close; } @@ -357,7 +355,7 @@ static BOOL utils_pathname_to_inode2(ntfs_volume *vol, struct ntfs_dir *parent, len = ntfs_mbstoucs(p, &unicode, MAX_PATH); if (len < 0) { - Eprintf("Couldn't convert name to Unicode: %s.\n", p); + ntfs_log_error("Couldn't convert name to Unicode: %s.\n", p); goto close; } @@ -365,12 +363,14 @@ static BOOL utils_pathname_to_inode2(ntfs_volume *vol, struct ntfs_dir *parent, //printf("dir: index = %p, children = %p, inode = %p, iroot = %p, ialloc = %p, count = %d\n", dir->index, dir->children, dir->inode, dir->iroot, dir->ialloc, dir->child_count); //if (dir->parent) if (q) { + ntfs_log_trace("q\n"); child = ntfs_dir_find2(dir, unicode, len); if (!child) { printf("can't find %s in %s\n", p, pathname); goto close; } } else { + ntfs_log_trace("!q dir->index = %p, %d\n", dir->index, dir->index->data_len); //printf("file: %s\n", p); dt = ntfs_dt_find2(dir->index, unicode, len, &dt_num); @@ -378,6 +378,7 @@ static BOOL utils_pathname_to_inode2(ntfs_volume *vol, struct ntfs_dir *parent, printf("can't find %s in %s (2)\n", p, pathname); goto close; } + ntfs_log_debug("dt = %p, data_len = %d, parent = %p\n", dt, dt->data_len, dt->parent); //printf("dt's flags = 0x%08x\n", dt->children[dt_num]->key.file_name.file_attributes); if (dt->children[dt_num]->key.file_name.file_attributes == FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) { @@ -437,6 +438,7 @@ static s64 ntfs_mft_find_free_entry(ntfs_volume *vol) if (!vol) return -1; + ntfs_log_trace ("\n"); recs = vol->mft_na->initialized_size >> vol->mft_record_size_bits; //printf("mft contains %lld records\n", recs); for (i = 24; i < recs; i++) { @@ -456,6 +458,7 @@ static int ntfs_mft_set_inuse6(ntfs_inode *inode, struct ntfs_bmp *bmp, BOOL inu if (!inode) return -1; + ntfs_log_trace("\n"); if (ntfs_bmp_set_range(bmp, (VCN) MREF(inode->mft_no), 1, inuse) < 0) return -1; @@ -472,7 +475,7 @@ static int ntfs_mft_set_inuse6(ntfs_inode *inode, struct ntfs_bmp *bmp, BOOL inu NInoSetDirty(inode); - printf(GREEN "Modified: inode %lld MFT_RECORD header\n" END, inode->mft_no); + printf("Modified: inode %lld MFT_RECORD header\n", inode->mft_no); return 0; } @@ -505,6 +508,7 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) return 1; } + ntfs_log_trace ("\n"); find_dir = del->dir; uname = del->children[del_num]->key.file_name.file_name; @@ -532,7 +536,7 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) */ if (del->header->flags & INDEX_NODE) { - printf(BOLD YELLOW "Replace key with its successor:\n" END); + printf("Replace key with its successor:\n"); vcn = ntfs_ie_get_vcn(del_ie); //printf("vcn = %lld\n", vcn); @@ -578,7 +582,7 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) */ printf("\n"); - printf(BOLD YELLOW "Delete key:\n" END); + printf("Delete key:\n"); file = &del->children[del_num]->key.file_name; printf("\tdel name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); @@ -604,7 +608,7 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) // find the key nearest the root which has no descendants printf("\n"); - printf(BOLD YELLOW "Find childless parent:\n" END); + printf("Find childless parent:\n"); #if 0 for (par = del->parent, old = par; par; old = par, par = par->parent) { if (par->child_count > 1) @@ -650,7 +654,7 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) // find if parent has left siblings if (par->children[par_num]->flags & INDEX_ENTRY_END) { - printf(BOLD YELLOW "Swap the children of the parent and its left sibling\n" END); + printf("Swap the children of the parent and its left sibling\n"); par_ie = par->children[par_num]; vcn = ntfs_ie_get_vcn(par_ie); @@ -678,9 +682,9 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) par_num--; if (ntfs_dt_isroot(par)) - printf(GREEN "Modified: inode %lld, $INDEX_ROOT\n" END, par->dir->inode->mft_no); + printf("Modified: inode %lld, $INDEX_ROOT\n", par->dir->inode->mft_no); else - printf(GREEN "Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n" END, par->dir->inode->mft_no, par->vcn, par->vcn + (par->dir->index_size>>9) - 1); + printf("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", par->dir->inode->mft_no, par->vcn, par->vcn + (par->dir->index_size>>9) - 1); } //ntfs_dt_print(top, 0); @@ -690,7 +694,7 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) // unhook and hold onto the ded dt's printf("\n"); - printf(BOLD YELLOW "Remove parent\n" END); + printf("Remove parent\n"); file = &par->children[par_num]->key.file_name; printf("\tpar name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); @@ -735,7 +739,7 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) //ntfs_dt_print(top, 0); printf("\n"); - printf(BOLD YELLOW "Add childless parent\n" END); + printf("Add childless parent\n"); file = &add_ie->key.file_name; printf("\tadd name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); suc = NULL; @@ -789,6 +793,7 @@ static int ntfs_file_remove2(ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) if (!vol || !dt) return -1; + ntfs_log_trace ("\n"); ie = dt->children[dt_num]; ino = dt->inodes[dt_num]; dir = dt->dir; @@ -832,12 +837,13 @@ static int ntfs_file_add2(ntfs_volume *vol, char *filename) s64 now = 0; struct ntfs_dir *dir; struct ntfs_dt *dt; - //int dt_index = 0; + int dt_index = 0; int data_len = 0; ATTR_RECORD *attr; struct ntfs_dt *suc = NULL; int suc_num = 0; + ntfs_log_trace("\n"); new_num = ntfs_mft_find_free_entry(vol); if (new_num == (MFT_REF) -1) return 1; @@ -948,19 +954,21 @@ static int ntfs_file_add2(ntfs_volume *vol, char *filename) dir = dt->dir->children[0]; dt = dir->index; + ntfs_log_debug("searching for "); ntfs_name_print(uname, uname_len); ntfs_log_debug("\n"); + // find3 doesn't map new dts. don't I _want_ to map them? suc = ntfs_dt_find3(dt, uname, uname_len, &suc_num); - ntfs_dt_add2(ie, suc, suc_num, NULL); + ntfs_log_debug("dt = %p, data_len = %d, parent = %p\n", dt, dt->data_len, dt->parent); - /* - dt_index = ntfs_dt_root_add(dt, ie); + //dt_index = ntfs_dt_root_add(dt, ie); + dt_index = ntfs_dt_add2(ie, suc, suc_num, NULL); if (dt_index >= 0) { dt->inodes[dt_index] = ino; ino->ref_count++; } - */ close: + ntfs_log_debug("working inode refcount = %d\n", ino->ref_count); free(buffer); ntfs_inode_close2(ino); ntfs_ie_free(ie); @@ -969,6 +977,7 @@ close: return 0; } + /** * main - Begin here * @@ -985,6 +994,11 @@ int main(int argc, char *argv[]) int result = 1; struct ntfs_find find; + ntfs_log_set_handler (ntfs_log_handler_stdout); + ntfs_log_set_levels (NTFS_LOG_LEVEL_TRACE); + ntfs_log_set_flags (NTFS_LOG_FLAG_COLOUR); + + ntfs_log_trace ("\n"); if (!parse_options(argc, argv)) goto done; @@ -1000,6 +1014,8 @@ int main(int argc, char *argv[]) if (opts.noaction) flags |= MS_RDONLY; + //ntfs_log_set_levels (NTFS_LOG_LEVEL_DEBUG | NTFS_LOG_LEVEL_TRACE); + //ntfs_log_set_levels (NTFS_LOG_LEVEL_DEBUG); vol = ntfs_volume_mount2(opts.device, flags, opts.force); if (!vol) { printf("!vol\n"); @@ -1026,12 +1042,14 @@ done: if (0) ntfs_inode_close2(inode); if (1) ntfs_volume_umount2(vol, FALSE); + //ntfs_log_clear_levels(NTFS_LOG_LEVEL_DEBUG | NTFS_LOG_LEVEL_TRACE); if (0) utils_pathname_to_inode2(NULL, NULL, NULL, NULL); if (0) ntfs_ie_remove_name(NULL); if (0) ntfs_dt_transfer2(NULL, NULL, 0, 0); if (0) utils_array_remove(NULL, 0, 0, 0); if (0) utils_array_insert(NULL, 0, 0, 0); + ntfs_log_trace("result = %d\n", result); return result; } From 0b55f323c2a5b507ae2154c8c461c36dd8043c62 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 28 Oct 2005 09:43:47 +0000 Subject: [PATCH 2653/2994] spelling fixes from debian --- ChangeLog | 2 +- ntfsprogs/ntfsclone.8.in | 4 ++-- ntfsprogs/ntfsmount.8.in | 11 ++++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index f684b23f..baa37d11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,7 +45,7 @@ xx/xx/2005 - 1.12.2-WIP - fflush() ntfs_log_ streams. (Christophe) - Working with regular files no longer needs the --force option, except for mkntfs. (Szaka) - - Fix ntfs_non_resident_attr_expand() bug, that occured if we enlarge + - Fix ntfs_non_resident_attr_expand() bug, that occurred if we enlarge sparse or compressed file, but do not need to allocate new clusters to perfrom this. (Yura) - Fix ntfsdecrypt endianness bugs thus it now works on OSX running on diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 5821e659..c86fdaff 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -37,7 +37,7 @@ filled with zeros (cloning to standard output). .B ntfsclone can be useful to make backups, an exact snapshot of an NTFS filesystem and restore it later on, or for developers to test NTFS read/write -functionality, troubleshot/investigate users' issues using the clone +functionality, troubleshoot/investigate users' issues using the clone without the risk of destroying the original filesystem. The clone, if not using the special image format, is an exact copy of the original @@ -85,7 +85,7 @@ with the options .B \-S (handle sparse files "efficiently") and .B \-j -(filter the archive through bzip2). Altough +(filter the archive through bzip2). Although .BR tar still reads and analyses the entire file, it doesn't pass on the large data blocks having only zeros to filters and it also avoids diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index dcb35c28..68b94b7a 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -130,7 +130,7 @@ limited anyway to 32 pages (which is 128kbyte on i386). .TP .B force -Force mount even if errors occured. Use this option only if you know what +Force mount even if errors occurred. Use this option only if you know what are you doing and don't cry about data loss. .TP @@ -168,7 +168,7 @@ NTFS FUSE module don't prevent you from accessing to named data streams so you can use your preferred utils to access them. You can even delete them using .B rm. You can list all named data streams by getting "ntfs.streams.list" extended -attribute. NOTE: The last feauture is unique for NTFS FUSE module and maybe +attribute. NOTE: The last feature is unique for NTFS FUSE module and maybe will be never supported by kernel driver. .SH EXAMPLES @@ -232,13 +232,17 @@ No bugs are known at present. If you find any bugs, please send an email to .nh . .hy + .SH AUTHOR .B ntfsmount was written by Yura Pakhuchiy. This manual page use information from Documentation/filesystems/ntfs.txt from linux kernel source, and from README from FUSE. + .SH DEDICATION With love to Marina Sapego. + .SH THANKS -Many thanks to Miklos Szeredi for advices and answers about FUSE. +Many thanks to Miklos Szeredi for advice and answers about FUSE. + .SH AVAILABILITY .B ntfsmount is part of the ntfsprogs package and is available from @@ -246,6 +250,7 @@ is part of the ntfsprogs package and is available from .nh http://linux\-ntfs.sourceforge.net/downloads.html. .hy + .SH SEE ALSO .BR "ntfsprogs" (8), " attr" (5), " getfattr" (1) From 8f43f0ef4c2e56b49b68ae0b25964f5209a51289 Mon Sep 17 00:00:00 2001 From: uvman Date: Fri, 28 Oct 2005 12:47:49 +0000 Subject: [PATCH 2654/2994] Match parameter names between .h and .c files --- include/ntfs/attrib.h | 2 +- include/ntfs/bootsect.h | 3 ++- include/ntfs/runlist.h | 2 +- include/ntfs/volume.h | 2 +- libntfs/attrib.c | 22 ++++++++++--------- libntfs/mft.c | 48 ++++++++++++++++++++--------------------- ntfsprogs/utils.h | 2 +- 7 files changed, 42 insertions(+), 39 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 7f9182b8..7f7a27ed 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -304,7 +304,7 @@ extern int ntfs_attr_rm(ntfs_attr *na); extern int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size); extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, - const u32 newsize); + const u32 new_size); extern int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni); extern int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx, int extra); diff --git a/include/ntfs/bootsect.h b/include/ntfs/bootsect.h index 345f48d9..af0da7a9 100644 --- a/include/ntfs/bootsect.h +++ b/include/ntfs/bootsect.h @@ -40,7 +40,8 @@ * --enable-debug). */ extern BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, BOOL silent); -extern int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *b); +extern int ntfs_boot_sector_parse(ntfs_volume *vol, + const NTFS_BOOT_SECTOR *bs); #endif /* defined _NTFS_BOOTSECT_H */ diff --git a/include/ntfs/runlist.h b/include/ntfs/runlist.h index d821f311..26c4a565 100644 --- a/include/ntfs/runlist.h +++ b/include/ntfs/runlist.h @@ -74,7 +74,7 @@ extern int ntfs_mapping_pairs_build(const ntfs_volume *vol, u8 *dst, const int dst_len, const runlist_element *rl, const VCN start_vcn, VCN *const stop_vcn); -extern int ntfs_rl_truncate(runlist **rl, const VCN start_vcn); +extern int ntfs_rl_truncate(runlist **arl, const VCN start_vcn); extern int ntfs_rl_sparse(runlist *rl); extern s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl); diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index fd1ae4ea..715c0320 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -205,7 +205,7 @@ extern int ntfs_umount(ntfs_volume *vol, const BOOL force); extern int ntfs_version_is_supported(ntfs_volume *vol); extern int ntfs_logfile_reset(ntfs_volume *vol); -extern int ntfs_volume_write_flags(ntfs_volume *v, const u16 flags); +extern int ntfs_volume_write_flags(ntfs_volume *vol, const u16 flags); #ifdef NTFS_RICH diff --git a/libntfs/attrib.c b/libntfs/attrib.c index ee09fc03..cf1a61d3 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1358,7 +1358,7 @@ err_out: * @pos: byte position in the attribute to begin reading from * @bk_cnt: number of mst protected blocks to read * @bk_size: size of each mst protected block in bytes - * @b: output data buffer + * @dst: output data buffer * * This function will read @bk_cnt blocks of size @bk_size bytes each starting * at offset @pos from the ntfs attribute @na into the data buffer @b. @@ -1382,7 +1382,7 @@ err_out: * errors can be repaired. */ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, - const u32 bk_size, void *b) + const u32 bk_size, void *dst) { s64 br; u8 *end; @@ -1394,12 +1394,13 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, errno = EINVAL; return -1; } - br = ntfs_attr_pread(na, pos, bk_cnt * bk_size, b); + br = ntfs_attr_pread(na, pos, bk_cnt * bk_size, dst); if (br <= 0) return br; br /= bk_size; - for (end = (u8*)b + br * bk_size; (u8*)b < end; b = (u8*)b + bk_size) - ntfs_mst_post_read_fixup((NTFS_RECORD*)b, bk_size); + for (end = (u8*)dst + br * bk_size; (u8*)dst < end; dst = (u8*)dst + + bk_size) + ntfs_mst_post_read_fixup((NTFS_RECORD*)dst, bk_size); /* Finally, return the number of blocks read. */ return br; } @@ -1410,7 +1411,7 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, * @pos: position in the attribute to write to * @bk_cnt: number of mst protected blocks to write * @bk_size: size of each mst protected block in bytes - * @b: data buffer to write to disk + * @src: data buffer to write to disk * * This function will write @bk_cnt blocks of size @bk_size bytes each from * data buffer @b to multi sector transfer (mst) protected ntfs attribute @na @@ -1435,7 +1436,7 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt, * achieved. */ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, - const u32 bk_size, void *b) + const u32 bk_size, void *src) { s64 written, i; @@ -1453,7 +1454,7 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, int err; err = ntfs_mst_pre_write_fixup((NTFS_RECORD*) - ((u8*)b + i * bk_size), bk_size); + ((u8*)src + i * bk_size), bk_size); if (err < 0) { /* Abort write at this position. */ if (!i) @@ -1463,10 +1464,11 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, } } /* Write the prepared data. */ - written = ntfs_attr_pwrite(na, pos, bk_cnt * bk_size, b); + written = ntfs_attr_pwrite(na, pos, bk_cnt * bk_size, src); /* Quickly deprotect the data again. */ for (i = 0; i < bk_cnt; ++i) - ntfs_mst_post_write_fixup((NTFS_RECORD*)((u8*)b + i * bk_size)); + ntfs_mst_post_write_fixup((NTFS_RECORD*)((u8*)src + i * + bk_size)); if (written <= 0) return written; /* Finally, return the number of complete blocks written. */ diff --git a/libntfs/mft.c b/libntfs/mft.c index 63fffeea..715f67a6 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -273,7 +273,7 @@ read_failed: * ntfs_mft_record_layout - layout an mft record into a memory buffer * @vol: volume to which the mft record will belong * @mref: mft reference specifying the mft record number - * @m: destination buffer of size >= @vol->mft_record_size bytes + * @mrec: destination buffer of size >= @vol->mft_record_size bytes * * Layout an empty, unused mft record with the mft reference @mref into the * buffer @m. The volume @vol is needed because the mft record structure was @@ -283,17 +283,17 @@ read_failed: * On success return 0 and on error return -1 with errno set to the error code. */ int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref, - MFT_RECORD *m) + MFT_RECORD *mrec) { ATTR_RECORD *a; - if (!vol || !m) { + if (!vol || !mrec) { errno = EINVAL; return -1; } /* Aligned to 2-byte boundary. */ if (vol->major_ver < 3 || (vol->major_ver == 3 && !vol->minor_ver)) - m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD_OLD) + 1) & ~1); + mrec->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD_OLD) + 1) & ~1); else { /* Abort if mref is > 32 bits. */ if (MREF(mref) & 0x0000ffff00000000ull) { @@ -301,20 +301,20 @@ int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref, errno = ERANGE; return -1; } - m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD) + 1) & ~1); + mrec->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD) + 1) & ~1); /* * Set the NTFS 3.1+ specific fields while we know that the * volume version is 3.1+. */ - m->reserved = cpu_to_le16(0); - m->mft_record_number = cpu_to_le32(MREF(mref)); + mrec->reserved = cpu_to_le16(0); + mrec->mft_record_number = cpu_to_le32(MREF(mref)); } - m->magic = magic_FILE; + mrec->magic = magic_FILE; if (vol->mft_record_size >= NTFS_BLOCK_SIZE) - m->usa_count = cpu_to_le16(vol->mft_record_size / + mrec->usa_count = cpu_to_le16(vol->mft_record_size / NTFS_BLOCK_SIZE + 1); else { - m->usa_count = cpu_to_le16(1); + mrec->usa_count = cpu_to_le16(1); ntfs_log_debug("Sector size is bigger than MFT record size. " "Setting usa_count to 1. If Windows\n"); ntfs_log_debug("chkdsk reports this as corruption, please email " @@ -324,28 +324,28 @@ int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref, ntfs_log_debug("Thank you.\n"); } /* Set the update sequence number to 1. */ - *(u16*)((u8*)m + le16_to_cpu(m->usa_ofs)) = cpu_to_le16(1); - m->lsn = cpu_to_le64(0ull); - m->sequence_number = cpu_to_le16(1); - m->link_count = cpu_to_le16(0); + *(u16*)((u8*)mrec + le16_to_cpu(mrec->usa_ofs)) = cpu_to_le16(1); + mrec->lsn = cpu_to_le64(0ull); + mrec->sequence_number = cpu_to_le16(1); + mrec->link_count = cpu_to_le16(0); /* Aligned to 8-byte boundary. */ - m->attrs_offset = cpu_to_le16((le16_to_cpu(m->usa_ofs) + - (le16_to_cpu(m->usa_count) << 1) + 7) & ~7); - m->flags = cpu_to_le16(0); + mrec->attrs_offset = cpu_to_le16((le16_to_cpu(mrec->usa_ofs) + + (le16_to_cpu(mrec->usa_count) << 1) + 7) & ~7); + mrec->flags = cpu_to_le16(0); /* * Using attrs_offset plus eight bytes (for the termination attribute), * aligned to 8-byte boundary. */ - m->bytes_in_use = cpu_to_le32((le16_to_cpu(m->attrs_offset) + 8 + 7) & - ~7); - m->bytes_allocated = cpu_to_le32(vol->mft_record_size); - m->base_mft_record = cpu_to_le64((MFT_REF)0); - m->next_attr_instance = cpu_to_le16(0); - a = (ATTR_RECORD*)((u8*)m + le16_to_cpu(m->attrs_offset)); + mrec->bytes_in_use = cpu_to_le32((le16_to_cpu(mrec->attrs_offset) + 8 + + 7) & ~7); + mrec->bytes_allocated = cpu_to_le32(vol->mft_record_size); + mrec->base_mft_record = cpu_to_le64((MFT_REF)0); + mrec->next_attr_instance = cpu_to_le16(0); + a = (ATTR_RECORD*)((u8*)mrec + le16_to_cpu(mrec->attrs_offset)); a->type = AT_END; a->length = cpu_to_le32(0); /* Finally, clear the unused part of the mft record. */ - memset((u8*)a + 8, 0, vol->mft_record_size - ((u8*)a + 8 - (u8*)m)); + memset((u8*)a + 8, 0, vol->mft_record_size - ((u8*)a + 8 - (u8*)mrec)); return 0; } diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index b58432cb..d9e451f2 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -85,7 +85,7 @@ int utils_attr_get_name(ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int b int utils_cluster_in_use(ntfs_volume *vol, long long lcn); int utils_mftrec_in_use(ntfs_volume *vol, MFT_REF mref); int utils_is_metadata(ntfs_inode *inode); -void utils_dump_mem(void *buf, int start, int length, int ascii); +void utils_dump_mem(void *buf, int start, int length, int flags); #ifndef _NTFS_RICH_H_ ATTR_RECORD * find_attribute(const ATTR_TYPES type, ntfs_attr_search_ctx *ctx); From 5b949d07fa32bf197f298f8d161c7f13f35e898e Mon Sep 17 00:00:00 2001 From: uvman Date: Fri, 28 Oct 2005 12:55:41 +0000 Subject: [PATCH 2655/2994] Fix comment formats. --- ChangeLog | 2 ++ include/ntfs/index.h | 1 + libntfs/device.c | 8 +++---- libntfs/inode.c | 2 +- libntfs/logging.c | 2 -- libntfs/security.c | 7 ++++-- libntfs/win32_io.c | 16 +++++++------- ntfsprogs/mkntfs.c | 46 ++++++++++++++++++++++++++++------------ ntfsprogs/ntfsclone.c | 2 ++ ntfsprogs/ntfsdecrypt.c | 4 ++-- ntfsprogs/ntfsls.c | 1 + ntfsprogs/ntfsundelete.c | 1 + 12 files changed, 60 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index baa37d11..01cfdbc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -50,6 +50,8 @@ xx/xx/2005 - 1.12.2-WIP to perfrom this. (Yura) - Fix ntfsdecrypt endianness bugs thus it now works on OSX running on a dual G5! (Anton) + - Match function parameters names between .h and .c files. (Yuval) + - Fix comment formats. (Yuval) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/include/ntfs/index.h b/include/ntfs/index.h index 756deb98..a86cb7d1 100644 --- a/include/ntfs/index.h +++ b/include/ntfs/index.h @@ -31,6 +31,7 @@ #include "mft.h" /** + * ntfs_index_context - * @ni: inode containing the @entry described by this context * @name: name of the index described by this context * @name_len: length of the index name diff --git a/libntfs/device.c b/libntfs/device.c index a78319fe..419752a4 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -75,10 +75,10 @@ /** * ntfs_device_alloc - allocate an ntfs device structure and pre-initialize it - * name: name of the device (must be present) - * state: initial device state (usually zero) - * dops: ntfs device operations to use with the device (must be present) - * priv_data: pointer to private data (optional) + * @name: name of the device (must be present) + * @state: initial device state (usually zero) + * @dops: ntfs device operations to use with the device (must be present) + * @priv_data: pointer to private data (optional) * * Allocate an ntfs device structure and pre-initialize it with the user- * specified device operations @dops, device state @state, device name @name, diff --git a/libntfs/inode.c b/libntfs/inode.c index 41396f2b..22008e9d 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -732,7 +732,7 @@ int ntfs_inode_sync(ntfs_inode *ni) /** * ntfs_inode_add_attrlist - add attribute list to inode and fill it - * @ni - opened ntfs inode to which add attribute list + * @ni: opened ntfs inode to which add attribute list * * Return 0 on success or -1 on error with errno set to the error code. * The following error codes are defined: diff --git a/libntfs/logging.c b/libntfs/logging.c index 526c4295..92a67b36 100644 --- a/libntfs/logging.c +++ b/libntfs/logging.c @@ -272,8 +272,6 @@ static const char * ntfs_log_get_prefix(u32 level) * * This alternate handler will be called for all future logging requests. * If no @handler is specified, logging will revert to the default handler. - * - * Returns: void */ void ntfs_log_set_handler(ntfs_log_handler *handler) { diff --git a/libntfs/security.c b/libntfs/security.c index 2c0598f2..3e5bfaf8 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -251,9 +251,12 @@ err_out: } /** - * GUID generate_guid(GUID *guid) - * generatates a random current guid + * generate_guid - generatates a random current guid. + * @guid: a pointer to a GUID struct to hold the generated guid. + * * perhaps not a very good random number generator though... + * + * Returns: The same pointer it was given as a parameter (guid). */ GUID *generate_guid(GUID *guid) { diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 6008ff51..95a53c3a 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -657,19 +657,19 @@ static HANDLE ntfs_device_win32_open_volume_for_partition(unsigned int drive_id, } /** - * ntfs_device_win32_find_partition - locates partition details by id - * @handle HANDLE to the PhysicalDrive - * @partition_id the partition number to locate - * @part_offset pointer to where to put the offset to the partition - * @part_length pointer to where to put the length of the partition - * @hidden_sectors pointer to where to put the hidden sectors + * ntfs_device_win32_find_partition - locates partition details by id. + * @handle: HANDLE to the PhysicalDrive + * @partition_id: the partition number to locate + * @part_offset: pointer to where to put the offset to the partition + * @part_length: pointer to where to put the length of the partition + * @hidden_sectors: pointer to where to put the hidden sectors * * This function requires an open PhysicalDrive handle and a partition_id. * If a partition with the required id is found on the supplied device, * the partition attributes are returned back. * - * Return TRUE if found, and sets the output parameters. - * FALSE if not and errno is set to the error code. + * Returns: TRUE if found, and sets the output parameters. + * FALSE if not and errno is set to the error code. */ static BOOL ntfs_device_win32_find_partition(HANDLE handle, DWORD partition_id, s64 *part_offset, s64 *part_length, int *hidden_sectors) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 0eee3594..f4cddb7e 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -552,8 +552,9 @@ static __inline__ long long mkntfs_write(struct ntfs_device *dev, } /** - * Write to disk the clusters contained in the runlist @rl taking the data - * from @val. Take @val_len bytes from @val and pad the rest with zeroes. + * ntfs_rlwrite - Write to disk the clusters contained in the runlist @rl + * taking the data from @val. Take @val_len bytes from @val and pad the + * rest with zeroes. * * If the @rl specifies a completely sparse file, @val is allowed to be NULL. * @@ -1147,6 +1148,8 @@ static void deallocate_scattered_clusters(const runlist *rl) /** * allocate_scattered_clusters + * @clusters: Amount of clusters to allocate. + * * Allocate @clusters and create a runlist of the allocated clusters. * * Return the allocated runlist. Caller has to free the runlist when finished @@ -1696,6 +1699,7 @@ err_out: /** * insert_non_resident_attr_in_mft_record + * * Return 0 on success and -errno on error. */ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, @@ -1886,6 +1890,7 @@ err_out: /** * insert_resident_attr_in_mft_record + * * Return 0 on success and -errno on error. */ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, @@ -1994,6 +1999,7 @@ err_out: /** * add_attr_std_info + * * Return 0 on success or -errno on error. */ static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags, @@ -2034,6 +2040,7 @@ static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags, /** * add_attr_file_name + * * Return 0 on success or -errno on error. */ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, @@ -2114,6 +2121,7 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, /** * add_attr_object_id + * * add an object_id attribute to the mft record @m * return 0 on success or -errno on error */ @@ -2141,6 +2149,7 @@ static int add_attr_object_id(MFT_RECORD *m, OBJECT_ID_ATTR *objid_attr, /** * add_attr_sd + * * Create the security descriptor attribute adding the security descriptor @sd * of length @sd_len to the mft record @m. * @@ -2167,6 +2176,7 @@ static int add_attr_sd(MFT_RECORD *m, const u8 *sd, const s64 sd_len) /** * add_attr_data + * * Return 0 on success or -errno on error. */ static int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, @@ -2202,6 +2212,7 @@ static int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, /** * add_attr_data_positioned + * * Create a non-resident data attribute with a predefined on disk location * specified by the runlist @rl. The clusters specified by @rl are assumed to * be allocated already. @@ -2225,6 +2236,7 @@ static int add_attr_data_positioned(MFT_RECORD *m, const char *name, /** * add_attr_vol_name + * * Create volume name attribute specifying the volume name @vol_name as a null * terminated char string of length @vol_name_len (number of characters not * including the terminating null), which is converted internally to a little @@ -2267,6 +2279,7 @@ static int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, /** * add_attr_vol_info + * * Return 0 on success or -errno on error. */ static int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags, @@ -2288,6 +2301,7 @@ static int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags, /** * add_attr_index_root + * * Return 0 on success or -errno on error. */ static int add_attr_index_root(MFT_RECORD *m, const char *name, @@ -2368,6 +2382,7 @@ static int add_attr_index_root(MFT_RECORD *m, const char *name, /** * add_attr_index_alloc + * * Return 0 on success or -errno on error. */ static int add_attr_index_alloc(MFT_RECORD *m, const char *name, @@ -2386,6 +2401,7 @@ static int add_attr_index_alloc(MFT_RECORD *m, const char *name, /** * add_attr_bitmap + * * Return 0 on success or -errno on error. */ static int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, @@ -2410,6 +2426,7 @@ static int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, /** * add_attr_bitmap_positioned + * * Create a non-resident bitmap attribute with a predefined on disk location * specified by the runlist @rl. The clusters specified by @rl are assumed to * be allocated already. @@ -2432,6 +2449,7 @@ static int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, /** * upgrade_to_large_index + * * Create bitmap and index allocation attributes, modify index root * attribute accordingly and move all of the index entries from the index root * into the index allocation. @@ -2593,6 +2611,7 @@ err_out: /** * make_room_for_index_entry_in_index_block + * * Create space of @size bytes at position @pos inside the index block @idx. * * Return 0 on success or -errno on error. @@ -2643,12 +2662,11 @@ static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *idx, } /* - * ntfs_index_keys_compare(char *key1, char *key2, - * COLLATION_RULES *collation_rule) + * ntfs_index_keys_compare + * * not alle types of COLLATION_RULES supported yet... * added as needed.. (remove this comment when all is added) */ - static int ntfs_index_keys_compare(char *key1, char *key2, int key1_length,int key2_length, COLLATION_RULES collation_rule) { @@ -2722,10 +2740,10 @@ static int ntfs_index_keys_compare(char *key1, char *key2, /** * insert_index_entry_in_res_dir_index + * * i.e. insert an index_entry in some named index_root * simplified search method, works for mkntfs */ - static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, u32 idx_size, MFT_RECORD *m, ntfschar *name, u32 name_size, ATTR_TYPES type) @@ -2841,9 +2859,9 @@ err_out: /** * intialize_secure + * * initializes $Secure's $SDH and $SII indexes from $SDS datastream */ - static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) { int err, sdh_size, sii_size; @@ -2918,10 +2936,10 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) { } /* - * initialize_quota(MFT_RECORD *m) + * initialize_quota + * * initialize $Quota with the default quota index-entries. */ - static int initialize_quota(MFT_RECORD *m) { int o_size, q1_size, q2_size, err; @@ -3031,11 +3049,11 @@ static int initialize_quota(MFT_RECORD *m) { } /* - * initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) + * initialize_objid + * * initialize $ObjId with the default index-entries. * It is one entry which belongs to $Volume. (W2k3) */ - static int initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) { int o_size, err; @@ -3072,6 +3090,7 @@ static int initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) { /** * insert_file_link_in_dir_index + * * Insert the fully completed FILE_NAME_ATTR @file_name which is inside * the file with mft reference @file_ref into the index (allocation) block * @idx (which belongs to @file_ref's parent directory). @@ -3200,6 +3219,7 @@ do_next: /** * create_hardlink_res + * * Create a file_name_attribute in the mft record @m_file which points to the * parent directory with mft reference @ref_parent. * @@ -3210,7 +3230,6 @@ do_next: * * Return 0 on success or -errno on error. */ - static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, MFT_RECORD *m_file, const MFT_REF ref_file, const s64 allocated_size, const s64 data_size, @@ -3311,6 +3330,7 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, /** * create_hardlink + * * Create a file_name_attribute in the mft record @m_file which points to the * parent directory with mft reference @ref_parent. * @@ -4112,10 +4132,10 @@ static void mkntfs_fill_device_with_zeroes(void) /** * mkntfs_sync_index_record + * * (ERSO) made a function out of this, but the reason for doing that * disapeared during coding.... */ - static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, ntfschar* name, u32 name_len) { diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 3584106e..b95c477b 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1128,6 +1128,8 @@ static void check_if_mounted(const char *device, unsigned long new_mntflag) } /** + * mount_volume - + * * First perform some checks to determine if the volume is already mounted, or * is dirty (Windows wasn't shutdown properly). If everything is OK, then mount * the volume (load the metadata into memory). diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index eb809077..3f145bf4 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -609,8 +609,8 @@ static inline void ntfs_buffer_reverse(u8 *buf, unsigned buf_size) #ifndef HAVE_STRNLEN /** - * * strnlen - strnlen is a gnu extension so emulate it if not present - * */ + * strnlen - strnlen is a gnu extension so emulate it if not present + */ static size_t strnlen(const char *s, size_t maxlen) { const char *p, *end; diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 17beedd6..fbb0c1ea 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -472,6 +472,7 @@ static int readdir_recursive(ntfs_inode * ni, s64 * pos, ntfsls_dirent * dirent) /** * list_dir_entry + * * FIXME: Should we print errors as we go along? (AIA) */ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 653dfbd4..e5a688d9 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -2041,6 +2041,7 @@ free: /** * handle_undelete + * * Handles the undelete */ static int handle_undelete(ntfs_volume *vol) From 56f119b245a89f4ba6d3f58a376087cfa2047063 Mon Sep 17 00:00:00 2001 From: uvman Date: Fri, 28 Oct 2005 13:00:48 +0000 Subject: [PATCH 2656/2994] Surround error-prone macros with parentheses --- ntfsprogs/utils.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index d9e451f2..95091590 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -101,14 +101,14 @@ ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL f * defines... * if *not in use* then the other flags are ignored? */ -#define FEMR_IN_USE 1 << 0 -#define FEMR_NOT_IN_USE 1 << 1 -#define FEMR_FILE 1 << 2 // $DATA -#define FEMR_DIR 1 << 3 // $INDEX_ROOT, "$I30" -#define FEMR_METADATA 1 << 4 -#define FEMR_NOT_METADATA 1 << 5 -#define FEMR_BASE_RECORD 1 << 6 -#define FEMR_NOT_BASE_RECORD 1 << 7 +#define FEMR_IN_USE (1 << 0) +#define FEMR_NOT_IN_USE (1 << 1) +#define FEMR_FILE (1 << 2) // $DATA +#define FEMR_DIR (1 << 3) // $INDEX_ROOT, "$I30" +#define FEMR_METADATA (1 << 4) +#define FEMR_NOT_METADATA (1 << 5) +#define FEMR_BASE_RECORD (1 << 6) +#define FEMR_NOT_BASE_RECORD (1 << 7) #define FEMR_ALL_RECORDS 0xFF /** From a7c595fe3ca99d1d8f6aa3879c0145b575ba53c5 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 28 Oct 2005 13:17:53 +0000 Subject: [PATCH 2657/2994] fix build --- libntfs/mft.c | 1 - libntfs/tree.c | 1 - 2 files changed, 2 deletions(-) diff --git a/libntfs/mft.c b/libntfs/mft.c index 715f67a6..3a2f72a8 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -1556,7 +1556,6 @@ sync_rollback: #include "tree.h" #include "index.h" #include "rich.h" -#include "utils.h" /** * ntfs_mft_remove_attr diff --git a/libntfs/tree.c b/libntfs/tree.c index 482bd1b2..7654e611 100644 --- a/libntfs/tree.c +++ b/libntfs/tree.c @@ -40,7 +40,6 @@ #include "inode.h" #include "logging.h" #include "rich.h" -#include "utils.h" /** * ntfs_dt_free From 7ae3cd3e822ad41f11b45fecb228dde30f768dc9 Mon Sep 17 00:00:00 2001 From: szaka Date: Fri, 28 Oct 2005 15:14:49 +0000 Subject: [PATCH 2658/2994] Fix two more typos (A. Costa) --- ntfsprogs/ntfsresize.8.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 2a59953c..cef18d0e 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -20,7 +20,7 @@ The program safely resizes Windows XP, Windows Server 2003, Windows 2000, Windows NT4 and Longhorn NTFS filesystems without data loss. All NTFS versions are supported, used by 32-bit and 64-bit Windows. -.B Defragmentation is NOT required prior resizing +.B Defragmentation is NOT required prior to resizing because the program can relocate any data if needed, without risking data integrity. .PP @@ -210,7 +210,7 @@ may also appear. Just acknowledge it and reboot again. .PP The disk geometry handling semantic (HDIO_GETGEO ioctl) has changed in an incompatible way in Linux 2.6 kernels and this triggered multitudinous -partition table corruptions resulting unbootable Windows systems, even if +partition table corruptions resulting in unbootable Windows systems, even if NTFS was consistent, if .BR parted (8) was involved in some way. This problem was often attributed to ntfsresize From 7f96d02758b777749dd190f56d8aec89ae4bb2da Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 15:31:41 +0000 Subject: [PATCH 2659/2994] typo --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 01cfdbc4..2c8510d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -47,7 +47,7 @@ xx/xx/2005 - 1.12.2-WIP for mkntfs. (Szaka) - Fix ntfs_non_resident_attr_expand() bug, that occurred if we enlarge sparse or compressed file, but do not need to allocate new clusters - to perfrom this. (Yura) + to perform this. (Yura) - Fix ntfsdecrypt endianness bugs thus it now works on OSX running on a dual G5! (Anton) - Match function parameters names between .h and .c files. (Yuval) From 4b81ab7e3bda1967aed415b73f9336ef57192263 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 28 Oct 2005 16:06:04 +0000 Subject: [PATCH 2660/2994] Add 'xattr' named data streams access interface. --- ChangeLog | 4 +- ntfsprogs/ntfsmount.c | 210 ++++++++++++++++++++++-------------------- 2 files changed, 114 insertions(+), 100 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c8510d0..470b8857 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,8 +35,8 @@ xx/xx/2005 - 1.12.2-WIP - mkntfs: optionally create NTFS version 3.0 (W2K) or 3.1 (XP, W2K3, Vista). (Implementation by Erik Sornes, adaption by Szaka) - ntfsmount: Add 'streams_interface=' option to select named data - streams access interface. Currently supported interfaces are 'none' - and 'windows'. (Yura) + streams access interface. Currently supported interfaces are 'none', + 'windows' and 'xattr'. (Yura) - ntfscat can display named attributes, streams too. (Szaka) - Remove Dputs(), Dprintf(), Dperror(), ntfs_debug(), ntfs_error() and Sprintf(). Forward callers to ntfs_log_*(). (Yuval) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index ed18d930..b44fa868 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -78,9 +78,7 @@ typedef struct { typedef enum { NF_STREAMS_INTERFACE_NONE, /* No access to named data streams. */ -#if 0 NF_STREAMS_INTERFACE_XATTR, /* Map named data streams to xattrs. */ -#endif NF_STREAMS_INTERFACE_WINDOWS, /* "file:stream" interface. */ } ntfs_fuse_streams_interface; @@ -864,7 +862,73 @@ static int ntfs_fuse_utime(const char *path, struct utimbuf *buf) #ifdef HAVE_SETXATTR -static int ntfs_fuse_getxattr(const char *path, const char *name, +static const char nf_ns_xattr_preffix[] = "user."; +static const int nf_ns_xattr_preffix_len = 5; + +static int ntfs_fuse_listxattr(const char *path, char *list, size_t size) +{ + ntfs_attr_search_ctx *actx = NULL; + ntfs_volume *vol; + ntfs_inode *ni; + char *to = list; + int ret = 0; + + if (ctx->streams != NF_STREAMS_INTERFACE_XATTR) + return -EOPNOTSUPP; + vol = ctx->vol; + if (!vol) + return -ENODEV; + ni = ntfs_pathname_to_inode(vol, NULL, path); + if (!ni) + return -errno; + actx = ntfs_attr_get_search_ctx(ni, NULL); + if (!actx) { + ret = -errno; + ntfs_inode_close(ni); + goto exit; + } + while (!ntfs_attr_lookup(AT_DATA, NULL, 0, CASE_SENSITIVE, + 0, NULL, 0, actx)) { + char *tmp_name = NULL; + int tmp_name_len; + + if (!actx->attr->name_length) + continue; + tmp_name_len = ntfs_ucstombs((ntfschar *)((u8*)actx->attr + + le16_to_cpu(actx->attr->name_offset)), + actx->attr->name_length, &tmp_name, 0); + if (tmp_name_len < 0) { + ret = -errno; + goto exit; + } + ret += tmp_name_len + nf_ns_xattr_preffix_len + 1; + if (size) { + if ((size_t)ret <= size) { + strcpy(to, nf_ns_xattr_preffix); + to += nf_ns_xattr_preffix_len; + strncpy(to, tmp_name, tmp_name_len); + to += tmp_name_len; + *to = 0; + to++; + } else { + free(tmp_name); + ret = -ERANGE; + goto exit; + } + } + free(tmp_name); + } + if (errno != ENOENT) + ret = -errno; +exit: + if (actx) + ntfs_attr_put_search_ctx(actx); + ntfs_inode_close(ni); + fprintf(stderr, "return %d\n", ret); + return ret; +} + +static int ntfs_fuse_getxattr_windows(const char *path, const char *name, char *value, size_t size) { ntfs_attr_search_ctx *actx = NULL; @@ -904,14 +968,20 @@ static int ntfs_fuse_getxattr(const char *path, const char *name, if (ret) ret++; /* For space delimiter. */ ret += tmp_name_len; - if ((size_t)ret <= size) { - /* Don't add space to the beginning of line. */ - if (to != value) { - *to = ' '; - to++; + if (size) { + if ((size_t)ret <= size) { + /* Don't add space to the beginning of line. */ + if (to != value) { + *to = ' '; + to++; + } + strncpy(to, tmp_name, tmp_name_len); + to += tmp_name_len; + } else { + free(tmp_name); + ret = -ERANGE; + goto exit; } - strncpy(to, tmp_name, tmp_name_len); - to += tmp_name_len; } free(tmp_name); } @@ -924,79 +994,21 @@ exit: return ret; } -#if 0 -/* If this will be enabled, need to fix bug before. (bug description below) */ - -static const char nf_ns_streams[] = "user.stream."; -static const int nf_ns_streams_len = 12; - -static const char nf_ns_eas[] = "user.ea."; -static const int nf_ns_eas_len = 8; - -static int ntfs_fuse_listxattr(const char *path, char *list, size_t size) -{ - ntfs_attr_search_ctx *actx = NULL; - ntfs_volume *vol; - ntfs_inode *ni; - char *to = list; - int ret = 0; - - vol = ctx->vol; - if (!vol) - return -ENODEV; - ni = ntfs_pathname_to_inode(vol, NULL, path); - if (!ni) - return -errno; - actx = ntfs_attr_get_search_ctx(ni, NULL); - if (!actx) { - ret = -errno; - ntfs_inode_close(ni); - goto exit; - } - while (!ntfs_attr_lookup(AT_DATA, NULL, 0, CASE_SENSITIVE, - 0, NULL, 0, actx)) { - if (!actx->attr->name_length) - continue; - ret += actx->attr->name_length + nf_ns_streams_len + 1; - if (size && (size_t)ret <= size) { - strcpy(to, nf_ns_streams); - to += nf_ns_streams_len; - /* - * BUG: destination buffer length can be bigger than - * actx->attr->name_length + 1. (eg. internatinal - * characters in utf8) - */ - if (ntfs_ucstombs((ntfschar *)((u8*)actx->attr + - le16_to_cpu(actx->attr->name_offset)), - actx->attr->name_length, &to, - actx->attr->name_length + 1) < 0) { - ret = -errno; - goto exit; - } - to += actx->attr->name_length + 1; - } - } - if (errno != ENOENT) - ret = -errno; -exit: - if (actx) - ntfs_attr_put_search_ctx(actx); - ntfs_inode_close(ni); - fprintf(stderr, "return %d\n", ret); - return ret; -} - static int ntfs_fuse_getxattr(const char *path, const char *name, char *value, size_t size) { ntfs_volume *vol; ntfs_inode *ni; ntfs_attr *na = NULL; - int res; ntfschar *lename = NULL; + int res, lename_len; - if (strncmp(name, nf_ns_streams, nf_ns_streams_len) || - strlen(name) == (size_t)nf_ns_streams_len) + if (ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) + return ntfs_fuse_getxattr_windows(path, name, value, size); + if (ctx->streams != NF_STREAMS_INTERFACE_XATTR) + return -EOPNOTSUPP; + if (strncmp(name, nf_ns_xattr_preffix, nf_ns_xattr_preffix_len) || + strlen(name) == (size_t)nf_ns_xattr_preffix_len) return -ENODATA; vol = ctx->vol; if (!vol) @@ -1004,12 +1016,12 @@ static int ntfs_fuse_getxattr(const char *path, const char *name, ni = ntfs_pathname_to_inode(vol, NULL, path); if (!ni) return -errno; - if (ntfs_mbstoucs(name + nf_ns_streams_len, &lename, 0) == -1) { + lename_len = ntfs_mbstoucs(name + nf_ns_xattr_preffix_len, &lename, 0); + if (lename_len == -1) { res = -errno; goto exit; } - na = ntfs_attr_open(ni, AT_DATA, lename, - strlen(name) - nf_ns_streams_len); + na = ntfs_attr_open(ni, AT_DATA, lename, lename_len); if (!na) { res = -ENODATA; goto exit; @@ -1038,11 +1050,13 @@ static int ntfs_fuse_setxattr(const char *path, const char *name, ntfs_volume *vol; ntfs_inode *ni; ntfs_attr *na = NULL; - int res; ntfschar *lename = NULL; + int res, lename_len; - if (strncmp(name, nf_ns_streams, nf_ns_streams_len) || - strlen(name) == (size_t)nf_ns_streams_len) + if (ctx->streams != NF_STREAMS_INTERFACE_XATTR) + return -EOPNOTSUPP; + if (strncmp(name, nf_ns_xattr_preffix, nf_ns_xattr_preffix_len) || + strlen(name) == (size_t)nf_ns_xattr_preffix_len) return -EACCES; vol = ctx->vol; if (!vol) @@ -1050,12 +1064,12 @@ static int ntfs_fuse_setxattr(const char *path, const char *name, ni = ntfs_pathname_to_inode(vol, NULL, path); if (!ni) return -errno; - if (ntfs_mbstoucs(name + nf_ns_streams_len, &lename, 0) == -1) { + lename_len = ntfs_mbstoucs(name + nf_ns_xattr_preffix_len, &lename, 0); + if (lename_len == -1) { res = -errno; goto exit; } - na = ntfs_attr_open(ni, AT_DATA, lename, - strlen(name) - nf_ns_streams_len); + na = ntfs_attr_open(ni, AT_DATA, lename, lename_len); if (na && flags == XATTR_CREATE) { res = -EEXIST; goto exit; @@ -1065,8 +1079,11 @@ static int ntfs_fuse_setxattr(const char *path, const char *name, res = -ENODATA; goto exit; } - na = ntfs_attr_add(ni, AT_DATA, lename, strlen(name) - - nf_ns_streams_len, 0); + if (ntfs_attr_add(ni, AT_DATA, lename, lename_len, NULL, 0)) { + res = -errno; + goto exit; + } + na = ntfs_attr_open(ni, AT_DATA, lename, lename_len); if (!na) { res = -errno; goto exit; @@ -1091,11 +1108,14 @@ static int ntfs_fuse_removexattr(const char *path, const char *name) ntfs_volume *vol; ntfs_inode *ni; ntfs_attr *na = NULL; - int res = 0; ntfschar *lename = NULL; + int res = 0, lename_len; - if (strncmp(name, nf_ns_streams, nf_ns_streams_len) || - strlen(name) == (size_t)nf_ns_streams_len) + + if (ctx->streams != NF_STREAMS_INTERFACE_XATTR) + return -EOPNOTSUPP; + if (strncmp(name, nf_ns_xattr_preffix, nf_ns_xattr_preffix_len) || + strlen(name) == (size_t)nf_ns_xattr_preffix_len) return -ENODATA; vol = ctx->vol; if (!vol) @@ -1103,12 +1123,12 @@ static int ntfs_fuse_removexattr(const char *path, const char *name) ni = ntfs_pathname_to_inode(vol, NULL, path); if (!ni) return -errno; - if (ntfs_mbstoucs(name + nf_ns_streams_len, &lename, 0) == -1) { + lename_len = ntfs_mbstoucs(name + nf_ns_xattr_preffix_len, &lename, 0); + if (lename_len == -1) { res = -errno; goto exit; } - na = ntfs_attr_open(ni, AT_DATA, lename, - strlen(name) - nf_ns_streams_len); + na = ntfs_attr_open(ni, AT_DATA, lename, lename_len); if (!na) { res = -ENODATA; goto exit; @@ -1126,8 +1146,6 @@ exit: return res; } -#endif /* 0 */ - #endif /* HAVE_SETXATTR */ static struct fuse_operations ntfs_fuse_oper = { @@ -1148,11 +1166,9 @@ static struct fuse_operations ntfs_fuse_oper = { .utime = ntfs_fuse_utime, #ifdef HAVE_SETXATTR .getxattr = ntfs_fuse_getxattr, -#if 0 .setxattr = ntfs_fuse_setxattr, .removexattr = ntfs_fuse_removexattr, .listxattr = ntfs_fuse_listxattr, -#endif /* 0 */ #endif /* HAVE_SETXATTR */ }; @@ -1325,10 +1341,8 @@ static char *parse_mount_options(const char *org_options) } if (!strcmp(val, "none")) ctx->streams = NF_STREAMS_INTERFACE_NONE; -#if 0 else if (!strcmp(val, "xattr")) ctx->streams = NF_STREAMS_INTERFACE_XATTR; -#endif else if (!strcmp(val, "windows")) ctx->streams = NF_STREAMS_INTERFACE_WINDOWS; else { From 755ef674e8592358d56c180d9e55df19c1ac6057 Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 16:47:41 +0000 Subject: [PATCH 2661/2994] upgrade to use new logging change stderror messages to ntfs_log_perror note: since the logging changes to utils.c, the --quiet option doesn't do anything --- ntfsprogs/ntfsinfo.c | 155 ++++++++++++++++++++++++------------------- 1 file changed, 87 insertions(+), 68 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index b406fa48..cdf009eb 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -61,7 +61,6 @@ #ifdef HAVE_GETOPT_H #include #endif - #ifdef HAVE_ERRNO_H #include #endif @@ -92,10 +91,6 @@ static struct options { u8 padding[4]; /* Unused: padding to 64 bit. */ } opts; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) - /** * version - Print version information about the program * @@ -111,7 +106,7 @@ static void version(void) printf("Copyright (c)\n"); printf(" 2002-2004 Matthew J. Fanto\n"); printf(" 2002-2005 Anton Altaparmakov\n"); - printf(" 2002-2003 Richard Russon\n"); + printf(" 2002-2005 Richard Russon\n"); printf(" 2003 Leonard NorrgĂĄrd\n"); printf(" 2004-2005 Yura Pakhuchiy\n"); printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); @@ -172,6 +167,7 @@ static int parse_options(int argc, char *argv[]) int err = 0; int ver = 0; int help = 0; + int levels = 0; opterr = 0; /* We'll handle the errors, thank you. */ @@ -196,7 +192,8 @@ static int parse_options(int argc, char *argv[]) break; case 'F': if (opts.filename == NULL) { - /* The inode can not be resolved here, store the filename */ + /* The inode can not be resolved here, + store the filename */ opts.filename = argv[optind-1]; } else { /* "-F" can't appear more than once */ @@ -211,17 +208,20 @@ static int parse_options(int argc, char *argv[]) break; case 'q': opts.quiet++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_QUIET); break; case 't': opts.notime++; break; case 'T': /* 'T' is deprecated, notify */ - Eprintf("Option 'T' is deprecated, it was replaced by 't'.\n"); + ntfs_log_error("Option 'T' is deprecated, it was " + "replaced by 't'.\n"); err++; break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; case 'V': ver++; @@ -252,29 +252,40 @@ static int parse_options(int argc, char *argv[]) } } + /* Make sure we're in sync with the log levels */ + levels = ntfs_log_get_levels(); + if (levels & NTFS_LOG_LEVEL_VERBOSE) + opts.verbose++; + if (!(levels & NTFS_LOG_LEVEL_QUIET)) + opts.quiet++; + if (help || ver) { opts.quiet = 0; } else { if (opts.device == NULL) { if (argc > 1) - Eprintf("You must specify exactly one device.\n"); + ntfs_log_error("You must specify exactly one " + "device.\n"); err++; } if ((opts.inode == -1) && (opts.filename == NULL) && !opts.mft) { if (argc > 1) - Eprintf("You must specify an inode to learn about.\n"); + ntfs_log_error("You must specify an inode to " + "learn about.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf("You may not use --quiet and --verbose at the same time.\n"); + ntfs_log_error("You may not use --quiet and --verbose " + "at the same time.\n"); err++; } if ((opts.inode != -1) && (opts.filename != NULL)) { if (argc > 1) - Eprintf("You may not specify --inode and --file together.\n"); + ntfs_log_error("You may not specify --inode " + "and --file together.\n"); err++; } @@ -488,6 +499,9 @@ static void ntfs_dump_flags(ATTR_TYPES type, u32 flags) printf("\n"); } +/** + * ntfs_dump_namespace + */ static void ntfs_dump_namespace(u8 file_name_type) { const char *mbs_file_type; @@ -594,8 +608,7 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) free(stream_name); } else { /* an error occurred, errno holds the reason - notify the user */ - fprintf(stderr, "ntfsinfo error: could not parse stream name: %s\n", - strerror(errno)); + ntfs_log_perror("ntfsinfo error: could not parse stream name"); } } else { printf("\tList name:\t\t unnamed\n"); @@ -700,8 +713,7 @@ static void ntfs_dump_attr_file_name(ATTR_RECORD *attr) free(mbs_file_name); } else { /* an error occurred, errno holds the reason - notify the user */ - fprintf(stderr, "ntfsinfo error: could not parse file name: %s\n", - strerror(errno)); + ntfs_log_perror("ntfsinfo error: could not parse file name"); } /* any way, error or not, print the length */ printf("\tFile Name Length:\t %d\n", file_name_attr->file_name_length); @@ -796,7 +808,7 @@ static void ntfs_dump_attr_object_id(ATTR_RECORD *attr,ntfs_volume *vol) printf("\tDomain ID:\t\t missing\n"); } else printf("\t$OBJECT_ID not present. Only NTFS versions > 3.0\n" - "\thave $OBJECT_ID. Your version of NTFS is %d.\n", + "\thave $OBJECT_ID. Your version of NTFS is %d.\n", vol->major_ver); } @@ -840,8 +852,9 @@ static void ntfs_dump_acl(const char *prefix,ACL *acl) break; } - printf("%sACE:\t\t type:%s flags:0x%x access:0x%x\n",prefix,ace_type, - (unsigned int)le16_to_cpu(ace->flags),(unsigned int)le32_to_cpu(ace->mask)); + printf("%sACE:\t\t type:%s flags:0x%x access:0x%x\n",prefix, + ace_type, (unsigned int)le16_to_cpu(ace->flags), + (unsigned int)le32_to_cpu(ace->mask)); /* get a SID string */ sid = ntfs_sid_to_mbs(&ace->sid, NULL, 0); printf("%s\t\t SID: %s\n",prefix,sid); @@ -882,7 +895,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v bytes_read = ntfs_rl_pread(vol, rl, 0, data_size, sec_desc_attr); if (bytes_read != data_size) { - Eprintf("ntfsinfo error: could not " + ntfs_log_error("ntfsinfo error: could not " "read security descriptor\n"); free(rl); free(sec_desc_attr); @@ -890,7 +903,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v } free(rl); } else { - Eprintf("ntfsinfo error: could not " + ntfs_log_error("ntfsinfo error: could not " "decompress runlist\n"); return; } @@ -971,8 +984,7 @@ static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr) free(mbs_vol_name); } else { /* an error occurred, errno holds the reason - notify the user */ - fprintf(stderr,"ntfsinfo error: could not parse volume name: %s\n", - strerror(errno)); + ntfs_log_perror("ntfsinfo error: could not parse volume name"); } } else { printf("\tVolume Name:\t\t unnamed\n"); @@ -1042,8 +1054,7 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol) free(stream_name); } else { /* an error occurred, errno holds the reason - notify the user */ - fprintf(stderr, "ntfsinfo error: could not parse stream name: %s\n", - strerror(errno)); + ntfs_log_perror("ntfsinfo error: could not parse stream name"); } } else { printf("\tStream name:\t\t unnamed\n"); @@ -1081,12 +1092,13 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol) printf("\tRunlist:\tVCN\t\tLCN\t\tLength\n"); while (rlc->length) { printf("\t\t\t%lld\t\t%lld\t\t%lld\n", - rlc->vcn, rlc->lcn, rlc->length); + rlc->vcn, rlc->lcn, rlc->length); rlc++; } free(rl); } else { - Eprintf("ntfsinfo error: could not decompress runlist\n"); + ntfs_log_error("ntfsinfo error: could not " + "decompress runlist\n"); return; } } @@ -1119,23 +1131,24 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) numb_entries++; continue; } - Vprintf("\n"); - Vprintf("\t\tEntry length:\t\t %u\n", + ntfs_log_verbose("\n"); + ntfs_log_verbose("\t\tEntry length:\t\t %u\n", le16_to_cpu(entry->length)); - Vprintf("\t\tKey length:\t\t %u\n", + ntfs_log_verbose("\t\tKey length:\t\t %u\n", le16_to_cpu(entry->key_length)); - Vprintf("\t\tFlags:\t\t\t 0x%02x\n", le16_to_cpu(entry->flags)); + ntfs_log_verbose("\t\tFlags:\t\t\t 0x%02x\n", + le16_to_cpu(entry->flags)); if (entry->flags & INDEX_ENTRY_NODE) - Vprintf("\t\tSubnode VCN:\t\t %lld\n", le64_to_cpu( - *((u8*)entry + le16_to_cpu( - entry->length) - sizeof(VCN)))); + ntfs_log_verbose("\t\tSubnode VCN:\t\t %lld\n", + le64_to_cpu(*((u8*)entry + + le16_to_cpu(entry->length) - sizeof(VCN)))); if (entry->flags & INDEX_ENTRY_END) break; switch (type) { case(AT_FILE_NAME): - Vprintf("\t\tFILE record number:\t %llu\n", + ntfs_log_verbose("\t\tFILE record number:\t %llu\n", MREF_LE(entry->indexed_file)); if (opts.verbose) { printf("\t"); @@ -1148,24 +1161,24 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) ntfs_ucstombs(entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0); - Vprintf("\t\tName:\t\t\t %s\n", name); + ntfs_log_verbose("\t\tName:\t\t\t %s\n", name); free(name); name = NULL; - Vprintf("\t\tParent directory:\t %lld\n", + ntfs_log_verbose("\t\tParent directory:\t %lld\n", MREF_LE(entry-> key.file_name.parent_directory)); - Vprintf("\t\tData size:\t\t %lld\n", + ntfs_log_verbose("\t\tData size:\t\t %lld\n", sle64_to_cpu( entry->key.file_name.data_size)); - Vprintf("\t\tAllocated size:\t\t %lld\n", + ntfs_log_verbose("\t\tAllocated size:\t\t %lld\n", sle64_to_cpu( entry->key.file_name.allocated_size)); break; default: // TODO: determine more attribute types - Vprintf("\t\tData offset:\t\t %u\n", + ntfs_log_verbose("\t\tData offset:\t\t %u\n", le16_to_cpu(entry->data_offset)); - Vprintf("\t\tData length:\t\t %u\n", + ntfs_log_verbose("\t\tData length:\t\t %u\n", le16_to_cpu(entry->data_length)); break; } @@ -1173,7 +1186,7 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) le16_to_cpu(entry->length)); numb_entries++; } - Vprintf("\tEnd of index block reached\n"); + ntfs_log_verbose("\tEnd of index block reached\n"); return numb_entries; } @@ -1202,8 +1215,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) free(index_name); } else { /* an error occurred, errno holds the reason - notify the user */ - fprintf(stderr, "ntfsinfo error: could not parse index name: %s\n", - strerror(errno)); + ntfs_log_perror("ntfsinfo error: could not parse index name"); } } else { printf("\tIndex name:\t\t unnamed\n"); @@ -1218,8 +1230,8 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) if (index_root->type != AT_FILE_NAME) { /* weird, this should be illgeal */ printf("0x%0X\n", type); - fprintf(stderr, "ntfsinfo error: Unknown Indexed Attr Type: 0x%0X\n", - type); + ntfs_log_error("ntfsinfo error: Unknown Indexed Attr " + "Type: 0x%0X\n", type); } else { printf("file names\n"); } @@ -1251,7 +1263,7 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) entry = (INDEX_ENTRY *)((u8 *)index_root + le32_to_cpu(index_root->index.entries_offset) + 0x10); - Vprintf("\tDumping index block:"); + ntfs_log_verbose("\tDumping index block:"); printf("\tIndex entries total:\t %d\n", ntfs_dump_index_entries(entry, index_root->type)); } @@ -1372,7 +1384,7 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) } entry = (INDEX_ENTRY *)((u8 *)tmp_alloc + le32_to_cpu( tmp_alloc->index.entries_offset) + 0x18); - Vprintf("\tDumping index block " + ntfs_log_verbose("\tDumping index block " "(VCN %lld, used %u/%u):", le64_to_cpu( tmp_alloc->index_block_vcn), (unsigned int)le32_to_cpu(tmp_alloc-> @@ -1419,8 +1431,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) * An error occurred, errno holds the reason - * notify the user */ - fprintf(stderr, "ntfsinfo error: could not parse " - "index name: %s\n", strerror(errno)); + ntfs_log_perror("ntfsinfo error: could not parse index name"); } } else { printf("\tIndex name:\t\t unnamed\n"); @@ -1436,7 +1447,7 @@ static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) printf("\tUsed data size:\t\t %llu\n", (unsigned long long)le64_to_cpu(attr->data_size)); } else { - Eprintf("Invalid $INDEX_ALLOCATION attribute. Should be be" + ntfs_log_error("Invalid $INDEX_ALLOCATION attribute. Should be" " non-resident\n"); } @@ -1462,8 +1473,7 @@ static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr) free(bitmap_name); } else { /* an error occurred, errno holds the reason - notify the user */ - fprintf(stderr, "ntfsinfo error: could not parse bitmap name: %s\n", - strerror(errno)); + ntfs_log_perror("ntfsinfo error: could not parse bitmap name"); } } else { printf("\tBitmap name:\t\t unnamed\n"); @@ -1661,8 +1671,8 @@ static void ntfs_hex_dump(void *buf,unsigned int length) static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) { printf("Dumping unknown attribute type 0x%X.\n" - "--Please report this to linux-ntfs-dev@lists.sourceforge.net--\n", - (unsigned int)le32_to_cpu(attr->type)); + "--Please report this to linux-ntfs-dev@lists.sourceforge.net--\n", + (unsigned int)le32_to_cpu(attr->type)); printf("\tResident size:\t\t %u\n",(unsigned int)le32_to_cpu(attr->length)); @@ -1682,9 +1692,11 @@ static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) printf("\tAttribute name:\t '%s'\n",attr_name); free(attr_name); } else { - /* an error occurred, errno holds the reason - notify the user */ - fprintf(stderr, "ntfsinfo error: could not parse attribute name: %s\n", - strerror(errno)); + /* an error occurred, errno holds the reason + * notify the user + */ + ntfs_log_perror("ntfsinfo error: could not parse " + "attribute name"); } } else { printf("\tAttribute name:\t unnamed\n"); @@ -1705,8 +1717,9 @@ static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) printf("\tInitialized data size:\t %llu\n", (unsigned long long)le64_to_cpu(attr->initialized_size)); - /* if the attribute resident part is large enough, it may contain - the compressed size */ + /* if the attribute resident part is large enough, it may + * contain the compressed size + */ if ((le32_to_cpu(attr->length)>=72) && ((attr->name_offset==0) || (le16_to_cpu(attr->name_offset)>=72))) { printf("\tCompressed size:\t %llu\n", @@ -1722,7 +1735,8 @@ static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) /* hex dump */ printf("\tDumping some of the attribute data:\n"); ntfs_hex_dump((u8*)attr + le16_to_cpu(attr->value_offset), - (le16_to_cpu(attr->value_length)>128)?128:le16_to_cpu(attr->value_length)); + (le16_to_cpu(attr->value_length)>128)?128 + :le16_to_cpu(attr->value_length)); } } @@ -1787,7 +1801,8 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) switch (ctx->attr->type) { case AT_UNUSED: /* That's an internal type, isn't it? */ - printf("Weird: AT_UNUSED type was returned, please report this.\n"); + printf("Weird: AT_UNUSED type was returned, please " + "report this.\n"); break; case AT_STANDARD_INFORMATION: ntfs_dump_attr_standard_information(ctx->attr); @@ -1838,7 +1853,8 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) ntfs_dump_attr_logged_utility_stream(ctx->attr); break; case AT_END: - printf("Weird: AT_END type was returned, please report this.\n"); + printf("Weird: AT_END type was returned, please report " + "this.\n"); break; default: ntfs_dump_attr_unknown(ctx->attr); @@ -1847,8 +1863,8 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) /* if we exited the loop before we're done - notify the user */ if (errno != ENOENT) { - fprintf(stderr, "ntfsinfo error: stopped before finished " - "enumerating attributes: %s\n", strerror(errno)); + ntfs_log_perror("ntfsinfo error: stopped before finished " + "enumerating attributes"); } else { printf("End of inode reached\n"); } @@ -1872,6 +1888,8 @@ int main(int argc, char **argv) { ntfs_volume *vol; + ntfs_log_set_handler(ntfs_log_handler_outerr); + if (!parse_options(argc, argv)) return 1; @@ -1906,10 +1924,11 @@ int main(int argc, char **argv) } else { /* can't open inode */ /* - * note: when the specified inode does not exist, either EIO or - * or ESPIPE is returned, we should notify better in those cases + * note: when the specified inode does not exist, either + * EIO or or ESPIPE is returned, we should notify better + * in those cases */ - fprintf(stderr, "Error loading node: %s\n", strerror(errno)); + ntfs_log_perror("Error loading node"); } } From 09368b5e83aea7f4a17d94fac06aeeea3c813916 Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 16:52:29 +0000 Subject: [PATCH 2662/2994] fix bug in ntfs_log_parse_option - quiet needs you to clear a level, not set it --- libntfs/logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/logging.c b/libntfs/logging.c index 92a67b36..8889da33 100644 --- a/libntfs/logging.c +++ b/libntfs/logging.c @@ -570,7 +570,7 @@ BOOL ntfs_log_parse_option(const char *option) ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); return TRUE; } else if (strcmp(option, "--log-quiet") == 0) { - ntfs_log_set_levels(NTFS_LOG_LEVEL_QUIET); + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); return TRUE; } else if (strcmp(option, "--log-trace") == 0) { ntfs_log_set_levels(NTFS_LOG_LEVEL_TRACE); From d5a925b3bf62bdab88e171c549e82143d3977a0b Mon Sep 17 00:00:00 2001 From: szaka Date: Fri, 28 Oct 2005 18:00:44 +0000 Subject: [PATCH 2663/2994] ntfsinfo and ntfsls follow the convention how other utilities read the device argument: no -d or --device option is needed --- ChangeLog | 3 +++ ntfsprogs/ntfsinfo.8.in | 2 +- ntfsprogs/ntfsinfo.c | 10 ++++------ ntfsprogs/ntfsls.8.in | 17 +++-------------- ntfsprogs/ntfsls.c | 13 +++++++------ 5 files changed, 18 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 470b8857..17fc59d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -52,6 +52,9 @@ xx/xx/2005 - 1.12.2-WIP a dual G5! (Anton) - Match function parameters names between .h and .c files. (Yuval) - Fix comment formats. (Yuval) + - ntfsinfo and ntfsls follow the convention how other utilities read + the device argument: no -d or --device option is needed. (Szaka) + 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index a77ed87f..efebca26 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -7,10 +7,10 @@ ntfsinfo \- dump a file's attributes .SH SYNOPSIS .B ntfsinfo -.I -d device .I -i inode-number .I -F path-filename .I -m +.I device .SH DESCRIPTION .B ntfsinfo will dump the attributes of inode diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index cdf009eb..a911d338 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -121,8 +121,7 @@ static void version(void) */ static void usage(void) { - printf("\nUsage: %s [options] -d dev\n" - " -d dev --device dev The ntfs volume to display information about\n" + printf("\nUsage: %s [options] device\n" " -i num --inode num Display information about this inode\n" " -F file --file file Display information about this file (absolute path)\n" " -m --mft Dump information about the volume\n" @@ -148,9 +147,8 @@ static void usage(void) */ static int parse_options(int argc, char *argv[]) { - static const char *sopt = "-:fhi:F:mqtTvVd:"; + static const char *sopt = "-:fhi:F:mqtTvV"; static const struct option lopt[] = { - { "device", required_argument, NULL, 'd' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, { "inode", required_argument, NULL, 'i' }, @@ -178,9 +176,9 @@ static int parse_options(int argc, char *argv[]) ntfs_log_trace("optind=%d; c='%c' optarg=\"%s\".\n", optind, c, optarg); switch (c) { - case 'd': + case 1: if (!opts.device) - opts.device = argv[optind-1]; + opts.device = optarg; else err++; break; diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index 4910b42f..f4fe8611 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2003 Anton Altaparmakov. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSLS 8 "August 2003" "ntfsprogs version @VERSION@" +.TH NTFSLS 8 "October 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsls \- list directory contents on an NTFS filesystem .SH SYNOPSIS @@ -70,9 +70,6 @@ ntfsls \- list directory contents on an NTFS filesystem | .B \-\-dos ] -.B \-d -| -.B \-\-device .I DEVICE .SH DESCRIPTION .B ntfsls @@ -81,7 +78,8 @@ is used to list information about the files specified by the option (the root directory by default). .I DEVICE is the special file corresponding to the device (e.g -.IR /dev/hdXX ). +.IR /dev/hdXX ) +or an NTFS image file. .SH OPTIONS .TP .B \-a, \-\-all @@ -129,15 +127,6 @@ Display more debug/warning/error messages. .B \-x, \-\-dos Display short file names, i.e. files in the DOS namespace, instead of long file names, i.e. files in the WIN32 namespace. -.TP -.BI "\-d, \-\-device" " DEVICE" -The special file corresponding to the device that contains the NTFS partition -to read. If you want to use an image of an NTFS partition stored on a normal -file, you will also need to specify the -.B \-f -or -.B \-\-force -options. .SH BUGS We are not aware of any bugs. If you find a bug, please report it to . Thank you. diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index fbb0c1ea..08a4d53b 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -156,10 +156,9 @@ static void version(void) */ static void usage(void) { - printf("\nUsage: %s [options] -d /dev/hda1\n" + printf("\nUsage: %s [options] device\n" "\n" " -a --all Display all files\n" - " -d DEVICE --device DEVICE NTFS volume\n" " -F --classify Display classification\n" " -f --force Use less caution\n" " -h -? --help Display this help\n" @@ -191,10 +190,9 @@ static void usage(void) */ static int parse_options(int argc, char *argv[]) { - static const char *sopt = "-ad:Ffh?ilp:qRsVvx"; + static const char *sopt = "-aFfh?ilp:qRsVvx"; static const struct option lopt[] = { { "all", no_argument, NULL, 'a' }, - { "device", required_argument, NULL, 'd' }, { "classify", no_argument, NULL, 'F' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, @@ -223,8 +221,11 @@ static int parse_options(int argc, char *argv[]) while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { switch (c) { - case 'd': - opts.device = optarg; + case 1: + if (!opts.device) + opts.device = optarg; + else + err++; break; case 'p': opts.path = optarg; From 7960f45998ce96098adb562ac0f55642ecb15cc4 Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 18:15:24 +0000 Subject: [PATCH 2664/2994] upgrade to use new logging change stderror messages to ntfs_log_perror --- ntfsprogs/ntfsundelete.c | 344 +++++++++++++++++++++------------------ 1 file changed, 183 insertions(+), 161 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index e5a688d9..25cdbee6 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -84,6 +84,7 @@ #include "debug.h" #include "ntfstime.h" #include "version.h" +#include "logging.h" static const char *EXEC_NAME = "ntfsundelete"; static const char *MFTFILE = "mft"; @@ -100,13 +101,9 @@ typedef struct static short with_regex; /* Flag Regular expression available */ static short avoid_duplicate_printing; /* Flag No duplicate printing of file infos */ -static range *ranges; /* Array containing all Inode-Rages for undelete */ +static range *ranges; /* Array containing all Inode-Ranges for undelete */ static long nr_entries; /* Number of range entries */ -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) - /** * parse_inode_arg - parses the inode expression * @@ -142,7 +139,7 @@ static int parse_inode_arg(void) /* alloc mem for range table */ ranges = (range *) malloc((p + 1) * sizeof(range)); if (ranges == NULL) { - printf("ERROR: Couldn't alloc mem for parsing inodes!\n"); + ntfs_log_error("ERROR: Couldn't alloc mem for parsing inodes!\n"); return (-1); } @@ -154,7 +151,7 @@ static int parse_inode_arg(void) /* invalid char at begin */ if ((opt_arg_ptr == opt_arg_end1) || (opt_arg_ptr == opt_arg_end2)) { - printf("ERROR: Invalid Number: %s\n", opt_arg_ptr); + ntfs_log_error("ERROR: Invalid Number: %s\n", opt_arg_ptr); return (-1); } @@ -164,7 +161,7 @@ static int parse_inode_arg(void) opt_arg_temp = opt_arg_end1; opt_arg_end1 = & (opt_arg_temp[1]); if (opt_arg_temp >= opt_arg_end2) { - printf("ERROR: Missing range end!\n"); + ntfs_log_error("ERROR: Missing range end!\n"); return (-1); } range_begin = inode; @@ -172,7 +169,7 @@ static int parse_inode_arg(void) /* get count */ range_end = strtoul(opt_arg_end1, &opt_arg_temp, 0); if (opt_arg_temp == opt_arg_end1) { - printf("ERROR: Invalid Number: %s\n", opt_arg_temp); + ntfs_log_error("ERROR: Invalid Number: %s\n", opt_arg_temp); return (-1); } @@ -202,7 +199,7 @@ static int parse_inode_arg(void) /* Next inode */ opt_arg_ptr = & (opt_arg_end1[1]); if (opt_arg_ptr >= opt_arg_end2) { - printf("ERROR: Missing new value at end of input!\n"); + ntfs_log_error("ERROR: Missing new value at end of input!\n"); return (-1); } continue; @@ -224,12 +221,12 @@ static int parse_inode_arg(void) */ static void version(void) { - printf("\n%s v%s (libntfs %s) - Recover deleted files from an NTFS " + ntfs_log_info("\n%s v%s (libntfs %s) - Recover deleted files from an NTFS " "Volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf("Copyright (c) 2002-2005 Richard Russon\n" + ntfs_log_info("Copyright (c) 2002-2005 Richard Russon\n" "Copyright (c) 2004-2005 Holger Ohmacht\n"); - printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -241,7 +238,7 @@ static void version(void) */ static void usage(void) { - printf("\nUsage: %s [options] device\n" + ntfs_log_info("\nUsage: %s [options] device\n" " -s --scan Scan for files (default)\n" " -p num --percentage num Minimum percentage recoverable\n" " -m pattern --match pattern Only work on files with matching names\n" @@ -266,7 +263,7 @@ static void usage(void) " -V --version Display version information\n" " -h --help Display this help\n\n", EXEC_NAME); - printf("%s%s\n", ntfs_bugs, ntfs_home); + ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -300,7 +297,7 @@ static int transform(const char *pattern, char **regex) length = strlen(pattern); if (length < 1) { - Eprintf("Pattern to transform is empty\n"); + ntfs_log_error("Pattern to transform is empty\n"); return 0; } @@ -311,7 +308,7 @@ static int transform(const char *pattern, char **regex) result = malloc(length + 3); if (!result) { - Eprintf("Couldn't allocate memory in transform()\n"); + ntfs_log_error("Couldn't allocate memory in transform()\n"); return 0; } @@ -379,17 +376,17 @@ static int parse_time(const char *value, time_t *since) result = strtoll(value, &suffix, 10); if (result < 0 || errno == ERANGE) { - Eprintf("Invalid time '%s'.\n", value); + ntfs_log_error("Invalid time '%s'.\n", value); return 0; } if (!suffix) { - Eprintf("Internal error, strtoll didn't return a suffix.\n"); + ntfs_log_error("Internal error, strtoll didn't return a suffix.\n"); return 0; } if (strlen(suffix) > 1) { - Eprintf("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); + ntfs_log_error("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); return 0; } @@ -403,7 +400,7 @@ static int parse_time(const char *value, time_t *since) break; default: - Eprintf("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); + ntfs_log_error("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix); return 0; } @@ -456,6 +453,7 @@ static int parse_options(int argc, char *argv[]) int err = 0; int ver = 0; int help = 0; + int levels = 0; opterr = 0; /* We'll handle the errors, thank you. */ @@ -507,6 +505,11 @@ static int parse_options(int argc, char *argv[]) break; case 'h': case '?': + if (strncmp (argv[optind-1], "--log-", 6) == 0) { + if (!ntfs_log_parse_option (argv[optind-1])) + err++; + break; + } help++; break; case 'm': @@ -554,6 +557,7 @@ static int parse_options(int argc, char *argv[]) break; case 'q': opts.quiet++; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 's': if (opts.mode == MODE_NONE) @@ -594,6 +598,7 @@ static int parse_options(int argc, char *argv[]) break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; case 'V': ver++; @@ -604,21 +609,28 @@ static int parse_options(int argc, char *argv[]) (optopt == 'o') || (optopt == 'p') || (optopt == 'S') || (optopt == 't') || (optopt == 'u')) && (!optarg)) { - Eprintf("Option '%s' requires an argument.\n", argv[optind-1]); + ntfs_log_error("Option '%s' requires an argument.\n", argv[optind-1]); } else { - Eprintf("Unknown option '%s'.\n", argv[optind-1]); + ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); } err++; break; } } + /* Make sure we're in sync with the log levels */ + levels = ntfs_log_get_levels(); + if (levels & NTFS_LOG_LEVEL_VERBOSE) + opts.verbose++; + if (!(levels & NTFS_LOG_LEVEL_QUIET)) + opts.quiet++; + if (help || ver) { opts.quiet = 0; } else { if (opts.device == NULL) { if (argc > 1) - Eprintf("You must specify exactly one device.\n"); + ntfs_log_error("You must specify exactly one device.\n"); err++; } @@ -630,19 +642,19 @@ static int parse_options(int argc, char *argv[]) case MODE_SCAN: if (opts.output || opts.dest || opts.truncate || (opts.fillbyte != (char)-1)) { - Eprintf("Scan can only be used with --percent, " + ntfs_log_error("Scan can only be used with --percent, " "--match, --ignore-case, --size and --time.\n"); err++; } if (opts.match_case && !opts.match) { - Eprintf("The --case option doesn't make sense without the --match option\n"); + ntfs_log_error("The --case option doesn't make sense without the --match option\n"); err++; } break; case MODE_UNDELETE: /*if ((opts.percent != -1) || (opts.size_begin > 0) || (opts.size_end > 0)) { - Eprintf("Undelete can only be used with " + ntfs_log_error("Undelete can only be used with " "--output, --destination, --byte and --truncate.\n"); err++; }*/ @@ -653,32 +665,32 @@ static int parse_options(int argc, char *argv[]) opts.match || opts.match_case || (opts.size_begin > 0) || (opts.size_end > 0)) { - Eprintf("Copy can only be used with --output and --destination.\n"); + ntfs_log_error("Copy can only be used with --output and --destination.\n"); err++; } break; default: - Eprintf("You can only select one of Scan, Undelete or Copy.\n"); + ntfs_log_error("You can only select one of Scan, Undelete or Copy.\n"); err++; } if ((opts.percent < -1) || (opts.percent > 100)) { - Eprintf("Percentage value must be in the range 0 - 100.\n"); + ntfs_log_error("Percentage value must be in the range 0 - 100.\n"); err++; } if (opts.quiet) { if (opts.verbose) { - Eprintf("You may not use --quiet and --verbose at the same time.\n"); + ntfs_log_error("You may not use --quiet and --verbose at the same time.\n"); err++; } else if (opts.mode == MODE_SCAN) { - Eprintf("You may not use --quiet when scanning a volume.\n"); + ntfs_log_error("You may not use --quiet when scanning a volume.\n"); err++; } } if (opts.parent && !opts.verbose) { - Eprintf("To use --parent, you must also use --verbose.\n"); + ntfs_log_error("To use --parent, you must also use --verbose.\n"); err++; } } @@ -694,7 +706,6 @@ static int parse_options(int argc, char *argv[]) return (!err && !help && !ver); } - /** * free_file - Release the resources used by a file object * @file: The unwanted file object @@ -769,7 +780,7 @@ static FILE_NAME_ATTR* verify_parent(struct filename* name, MFT_RECORD* rec) ctx = ntfs_attr_get_search_ctx(NULL, rec); if (!ctx) { - Eprintf("ERROR: Couldn't create a search context.\n"); + ntfs_log_error("ERROR: Couldn't create a search context.\n"); return NULL; } @@ -822,18 +833,18 @@ static void get_parent_name(struct filename* name, ntfs_volume* vol) rec = calloc(1, vol->mft_record_size); if (!rec) { - Eprintf("ERROR: Couldn't allocate memory in get_parent_name()\n"); + ntfs_log_error("ERROR: Couldn't allocate memory in get_parent_name()\n"); return; } mft_data = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0); if (!mft_data) { - Eprintf("ERROR: Couldn't open $MFT/$DATA: %s\n", strerror(errno)); + ntfs_log_perror("ERROR: Couldn't open $MFT/$DATA"); } else { inode_num = MREF(name->parent_mref); if (ntfs_attr_pread(mft_data, vol->mft_record_size * inode_num, vol->mft_record_size, rec) < 1) { - Eprintf("ERROR: Couldn't read MFT Record %lld.\n", inode_num); + ntfs_log_error("ERROR: Couldn't read MFT Record %lld.\n", inode_num); } else if ((filename_attr = verify_parent(name, rec))) { if (ntfs_ucstombs(filename_attr->file_name, filename_attr->file_name_length, @@ -898,7 +909,7 @@ static int get_filenames(struct ufile *file, ntfs_volume* vol) name = calloc(1, sizeof(*name)); if (!name) { - Eprintf("ERROR: Couldn't allocate memory in get_filenames().\n"); + ntfs_log_error("ERROR: Couldn't allocate memory in get_filenames().\n"); count = -1; break; } @@ -978,7 +989,7 @@ static int get_data(struct ufile *file, ntfs_volume *vol) while ((rec = find_attribute(AT_DATA, ctx))) { data = calloc(1, sizeof(*data)); if (!data) { - Eprintf("ERROR: Couldn't allocate memory in get_data().\n"); + ntfs_log_error("ERROR: Couldn't allocate memory in get_data().\n"); count = -1; break; } @@ -993,7 +1004,7 @@ static int get_data(struct ufile *file, ntfs_volume *vol) if (ntfs_ucstombs(data->uname, data->uname_len, &data->name, 0) < 0) { - Eprintf("ERROR: Cannot translate name into current locale.\n"); + ntfs_log_error("ERROR: Cannot translate name into current locale.\n"); } } @@ -1046,7 +1057,7 @@ static struct ufile * read_record(ntfs_volume *vol, long long record) file = calloc(1, sizeof(*file)); if (!file) { - Eprintf("ERROR: Couldn't allocate memory in read_record()\n"); + ntfs_log_error("ERROR: Couldn't allocate memory in read_record()\n"); return NULL; } @@ -1056,20 +1067,20 @@ static struct ufile * read_record(ntfs_volume *vol, long long record) file->mft = malloc(vol->mft_record_size); if (!file->mft) { - Eprintf("ERROR: Couldn't allocate memory in read_record()\n"); + ntfs_log_error("ERROR: Couldn't allocate memory in read_record()\n"); free_file(file); return NULL; } mft = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0); if (!mft) { - Eprintf("ERROR: Couldn't open $MFT/$DATA: %s\n", strerror(errno)); + ntfs_log_perror("ERROR: Couldn't open $MFT/$DATA"); free_file(file); return NULL; } if (ntfs_attr_mst_pread(mft, vol->mft_record_size * record, 1, vol->mft_record_size, file->mft) < 1) { - Eprintf("ERROR: Couldn't read MFT Record %lld.\n", record); + ntfs_log_error("ERROR: Couldn't read MFT Record %lld.\n", record); ntfs_attr_close(mft); free_file(file); return NULL; @@ -1097,16 +1108,15 @@ static struct ufile * read_record(ntfs_volume *vol, long long record) file->directory = 1; if (get_filenames(file, vol) < 0) { - Eprintf("ERROR: Couldn't get filenames.\n"); + ntfs_log_error("ERROR: Couldn't get filenames.\n"); } if (get_data(file, vol) < 0) { - Eprintf("ERROR: Couldn't get data streams.\n"); + ntfs_log_error("ERROR: Couldn't get data streams.\n"); } return file; } - /** * calc_percentage - Calculate how much of the file is recoverable * @file: The file object to work with @@ -1148,7 +1158,7 @@ static int calc_percentage(struct ufile *file, ntfs_volume *vol) } if (list_empty(&file->data)) { - Vprintf("File has no data streams.\n"); + ntfs_log_verbose("File has no data streams.\n"); return 0; } @@ -1158,17 +1168,17 @@ static int calc_percentage(struct ufile *file, ntfs_volume *vol) clusters_free = 0; if (data->encrypted) { - Vprintf("File is encrypted, recovery is impossible.\n"); + ntfs_log_verbose("File is encrypted, recovery is impossible.\n"); continue; } if (data->compressed) { - Vprintf("File is compressed, recovery not yet implemented.\n"); + ntfs_log_verbose("File is compressed, recovery not yet implemented.\n"); continue; } if (data->resident) { - Vprintf("File is resident, therefore recoverable.\n"); + ntfs_log_verbose("File is resident, therefore recoverable.\n"); percent = 100; data->percent = 100; continue; @@ -1176,17 +1186,17 @@ static int calc_percentage(struct ufile *file, ntfs_volume *vol) rl = data->runlist; if (!rl) { - Vprintf("File has no runlist, hence no data.\n"); + ntfs_log_verbose("File has no runlist, hence no data.\n"); continue; } if (rl[0].length <= 0) { - Vprintf("File has an empty runlist, hence no data.\n"); + ntfs_log_verbose("File has an empty runlist, hence no data.\n"); continue; } if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ - Vprintf("Missing segment at beginning, %lld " + ntfs_log_verbose("Missing segment at beginning, %lld " "clusters\n", (long long)rl[0].length); clusters_inuse += rl[0].length; rl++; @@ -1194,7 +1204,7 @@ static int calc_percentage(struct ufile *file, ntfs_volume *vol) for (i = 0; rl[i].length > 0; i++) { if (rl[i].lcn == LCN_RL_NOT_MAPPED) { - Vprintf("Missing segment at end, %lld " + ntfs_log_verbose("Missing segment at end, %lld " "clusters\n", (long long)rl[i].length); clusters_inuse += rl[i].length; @@ -1218,7 +1228,9 @@ static int calc_percentage(struct ufile *file, ntfs_volume *vol) } if ((clusters_inuse + clusters_free) == 0) { - Eprintf("ERROR: Unexpected error whilst calculating percentage for inode %lld\n", file->inode); + ntfs_log_error("ERROR: Unexpected error whilst " + "calculating percentage for inode %lld\n", + file->inode); continue; } @@ -1228,7 +1240,7 @@ static int calc_percentage(struct ufile *file, ntfs_volume *vol) percent = max(percent, data->percent); } - Vprintf("File is %d%% recoverable\n", percent); + ntfs_log_verbose("File is %d%% recoverable\n", percent); return percent; } @@ -1257,13 +1269,13 @@ static void dump_record(struct ufile *file) if (!file) return; - Qprintf("MFT Record %lld\n", file->inode); - Qprintf("Type: %s\n", (file->directory) ? "Directory" : "File"); + ntfs_log_quiet("MFT Record %lld\n", file->inode); + ntfs_log_quiet("Type: %s\n", (file->directory) ? "Directory" : "File"); strftime(buffer, sizeof(buffer), "%F %R", localtime(&file->date)); - Qprintf("Date: %s\n", buffer); + ntfs_log_quiet("Date: %s\n", buffer); if (file->attr_list) - Qprintf("Metadata may span more than one MFT record\n"); + ntfs_log_quiet("Metadata may span more than one MFT record\n"); list_for_each(item, &file->name) { struct filename *f = list_entry(item, struct filename, list); @@ -1273,72 +1285,73 @@ static void dump_record(struct ufile *file) else name = NONE; - Qprintf("Filename: (%d) %s\n", f->name_space, f->name); - Qprintf("File Flags: "); - if (f->flags & FILE_ATTR_SYSTEM) Qprintf("System "); - if (f->flags & FILE_ATTR_DIRECTORY) Qprintf("Directory "); - if (f->flags & FILE_ATTR_SPARSE_FILE) Qprintf("Sparse "); - if (f->flags & FILE_ATTR_REPARSE_POINT) Qprintf("Reparse "); - if (f->flags & FILE_ATTR_COMPRESSED) Qprintf("Compressed "); - if (f->flags & FILE_ATTR_ENCRYPTED) Qprintf("Encrypted "); + ntfs_log_quiet("Filename: (%d) %s\n", f->name_space, f->name); + ntfs_log_quiet("File Flags: "); + if (f->flags & FILE_ATTR_SYSTEM) ntfs_log_quiet("System "); + if (f->flags & FILE_ATTR_DIRECTORY) ntfs_log_quiet("Directory "); + if (f->flags & FILE_ATTR_SPARSE_FILE) ntfs_log_quiet("Sparse "); + if (f->flags & FILE_ATTR_REPARSE_POINT) ntfs_log_quiet("Reparse "); + if (f->flags & FILE_ATTR_COMPRESSED) ntfs_log_quiet("Compressed "); + if (f->flags & FILE_ATTR_ENCRYPTED) ntfs_log_quiet("Encrypted "); if (!(f->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_DIRECTORY | FILE_ATTR_SPARSE_FILE | FILE_ATTR_REPARSE_POINT | FILE_ATTR_COMPRESSED | FILE_ATTR_ENCRYPTED))) { - Qprintf("%s", NONE); + ntfs_log_quiet("%s", NONE); } - Qprintf("\n"); + ntfs_log_quiet("\n"); if (opts.parent) { - Qprintf("Parent: %s\n", f->parent_name ? f->parent_name : ""); + ntfs_log_quiet("Parent: %s\n", f->parent_name ? + f->parent_name : ""); } - Qprintf("Size alloc: %lld\n", f->size_alloc); - Qprintf("Size data: %lld\n", f->size_data); + ntfs_log_quiet("Size alloc: %lld\n", f->size_alloc); + ntfs_log_quiet("Size data: %lld\n", f->size_data); strftime(buffer, sizeof(buffer), "%F %R", localtime(&f->date_c)); - Qprintf("Date C: %s\n", buffer); + ntfs_log_quiet("Date C: %s\n", buffer); strftime(buffer, sizeof(buffer), "%F %R", localtime(&f->date_a)); - Qprintf("Date A: %s\n", buffer); + ntfs_log_quiet("Date A: %s\n", buffer); strftime(buffer, sizeof(buffer), "%F %R", localtime(&f->date_m)); - Qprintf("Date M: %s\n", buffer); + ntfs_log_quiet("Date M: %s\n", buffer); strftime(buffer, sizeof(buffer), "%F %R", localtime(&f->date_r)); - Qprintf("Date R: %s\n", buffer); + ntfs_log_quiet("Date R: %s\n", buffer); } - Qprintf("Data Streams:\n"); + ntfs_log_quiet("Data Streams:\n"); list_for_each(item, &file->data) { struct data *d = list_entry(item, struct data, list); - Qprintf("Name: %s\n", (d->name) ? d->name : UNNAMED); - Qprintf("Flags: "); - if (d->resident) Qprintf("Resident\n"); - if (d->compressed) Qprintf("Compressed\n"); - if (d->encrypted) Qprintf("Encrypted\n"); + ntfs_log_quiet("Name: %s\n", (d->name) ? d->name : UNNAMED); + ntfs_log_quiet("Flags: "); + if (d->resident) ntfs_log_quiet("Resident\n"); + if (d->compressed) ntfs_log_quiet("Compressed\n"); + if (d->encrypted) ntfs_log_quiet("Encrypted\n"); if (!d->resident && !d->compressed && !d->encrypted) - Qprintf("None\n"); + ntfs_log_quiet("None\n"); else - Qprintf("\n"); + ntfs_log_quiet("\n"); - Qprintf("Size alloc: %lld\n", d->size_alloc); - Qprintf("Size data: %lld\n", d->size_data); - Qprintf("Size init: %lld\n", d->size_init); - Qprintf("Size vcn: %lld\n", d->size_vcn); + ntfs_log_quiet("Size alloc: %lld\n", d->size_alloc); + ntfs_log_quiet("Size data: %lld\n", d->size_data); + ntfs_log_quiet("Size init: %lld\n", d->size_init); + ntfs_log_quiet("Size vcn: %lld\n", d->size_vcn); - Qprintf("Data runs:\n"); + ntfs_log_quiet("Data runs:\n"); if ((!d->runlist) || (d->runlist[0].length <= 0)) { - Qprintf(" None\n"); + ntfs_log_quiet(" None\n"); } else { for (i = 0; d->runlist[i].length > 0; i++) { - Qprintf(" %lld @ %lld\n", + ntfs_log_quiet(" %lld @ %lld\n", (long long)d->runlist[i].length, (long long)d->runlist[i].lcn); } } - Qprintf("Amount potentially recoverable %d%%\n", d->percent); + ntfs_log_quiet("Amount potentially recoverable %d%%\n", d->percent); } - Qprintf("________________________________________\n\n"); + ntfs_log_quiet("________________________________________\n\n"); } /** @@ -1405,7 +1418,7 @@ static void list_record(struct ufile *file) else name = NONE; - Qprintf("%-8lld %c%c%c%c %3d%% %s %9lld %s\n", + ntfs_log_quiet("%-8lld %c%c%c%c %3d%% %s %9lld %s\n", file->inode, flagd, flagr, flagc, flagx, percent, buffer, size, name); @@ -1437,7 +1450,7 @@ static int name_match(regex_t *re, struct ufile *file) continue; result = regexec(re, f->name, 0, NULL, 0); if (result < 0) { - Eprintf("Couldn't compare filename with regex: %s\n", strerror(errno)); + ntfs_log_perror("Couldn't compare filename with regex"); return 0; } else if (result == REG_NOERROR) { ntfs_log_debug("Found a matching filename.\n"); @@ -1543,7 +1556,7 @@ static int open_file(const char *pathname) { int flags; - Vprintf("Creating file: %s\n", pathname); + ntfs_log_verbose("Creating file: %s\n", pathname); if (opts.force) flags = O_RDWR | O_CREAT | O_TRUNC; @@ -1573,7 +1586,7 @@ static int set_date(const char *pathname, time_t date) ut.actime = date; ut.modtime = date; if (utime(pathname, &ut)) { - Eprintf("ERROR: Couldn't set the file's date and time\n"); + ntfs_log_error("ERROR: Couldn't set the file's date and time\n"); return 0; } return 1; @@ -1623,7 +1636,7 @@ static int undelete_file(ntfs_volume *vol, long long inode) /* try to get record */ file = read_record(vol, inode); if (!file || !file->mft) { - Eprintf("Can't read info from mft record %lld.\n", inode); + ntfs_log_error("Can't read info from mft record %lld.\n", inode); return 0; } @@ -1633,7 +1646,7 @@ static int undelete_file(ntfs_volume *vol, long long inode) dump_record(file); } else { list_record(file); - //Qprintf("\n"); + //ntfs_log_quiet("\n"); } } @@ -1642,23 +1655,27 @@ static int undelete_file(ntfs_volume *vol, long long inode) if (!buffer) goto free; - if (file->mft->flags & MFT_RECORD_IN_USE) { /* These two statement blocks were */ - Eprintf("Record is in use by the mft\n"); /* relocated from below because */ - if (!opts.force) { /* calc_percentage() must be called */ + /* calc_percentage() must be called before dump_record() or + * list_record(). Otherwise, when undeleting, a file will always be + * listed as 0% recoverable even if successfully undeleted. +mabs + */ + if (file->mft->flags & MFT_RECORD_IN_USE) { + ntfs_log_error("Record is in use by the mft\n"); + if (!opts.force) { free(buffer); - free_file(file); /* before dump_record() or list_record(). */ - return 0; /* Otherwise, when undeleting, a file */ - } /* will always be listed as 0% recoverable */ - Vprintf("Forced to continue.\n"); /* even if successfully undeleted. +mabs */ + free_file(file); + return 0; + } + ntfs_log_verbose("Forced to continue.\n"); } if (calc_percentage(file, vol) == 0) { - Qprintf("File has no recoverable data.\n"); + ntfs_log_quiet("File has no recoverable data.\n"); goto free; } if (list_empty(&file->data)) { - Qprintf("File has no data. There is nothing to recover.\n"); + ntfs_log_quiet("File has no data. There is nothing to recover.\n"); goto free; } @@ -1674,47 +1691,47 @@ static int undelete_file(ntfs_volume *vol, long long inode) if (d->resident) { fd = open_file(pathname); if (fd < 0) { - Eprintf("Couldn't create file: %s\n", strerror(errno)); + ntfs_log_perror("Couldn't create file"); goto free; } - Vprintf("File has resident data.\n"); + ntfs_log_verbose("File has resident data.\n"); if (write_data(fd, d->data, d->size_data) < d->size_data) { - Eprintf("Write failed: %s\n", strerror(errno)); + ntfs_log_perror("Write failed"); close(fd); goto free; } if (close(fd) < 0) { - Eprintf("Close failed: %s\n", strerror(errno)); + ntfs_log_perror("Close failed"); } fd = -1; } else { rl = d->runlist; if (!rl) { - Vprintf("File has no runlist, hence no data.\n"); + ntfs_log_verbose("File has no runlist, hence no data.\n"); continue; } if (rl[0].length <= 0) { - Vprintf("File has an empty runlist, hence no data.\n"); + ntfs_log_verbose("File has an empty runlist, hence no data.\n"); continue; } fd = open_file(pathname); if (fd < 0) { - Eprintf("Couldn't create output file: %s\n", strerror(errno)); + ntfs_log_perror("Couldn't create output file"); goto free; } if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */ - Vprintf("Missing segment at beginning, %lld " + ntfs_log_verbose("Missing segment at beginning, %lld " "clusters.\n", (long long)rl[0].length); memset(buffer, opts.fillbyte, bufsize); for (k = 0; k < rl[0].length * vol->cluster_size; k += bufsize) { if (write_data(fd, buffer, bufsize) < bufsize) { - Eprintf("Write failed: %s\n", strerror(errno)); + ntfs_log_perror("Write failed"); close(fd); goto free; } @@ -1725,13 +1742,13 @@ static int undelete_file(ntfs_volume *vol, long long inode) for (i = 0; rl[i].length > 0; i++) { if (rl[i].lcn == LCN_RL_NOT_MAPPED) { - Vprintf("Missing segment at end, " + ntfs_log_verbose("Missing segment at end, " "%lld clusters.\n", (long long)rl[i].length); memset(buffer, opts.fillbyte, bufsize); for (k = 0; k < rl[k].length * vol->cluster_size; k += bufsize) { if (write_data(fd, buffer, bufsize) < bufsize) { - Eprintf("Write failed: %s\n", strerror(errno)); + ntfs_log_perror("Write failed"); close(fd); goto free; } @@ -1741,11 +1758,11 @@ static int undelete_file(ntfs_volume *vol, long long inode) } if (rl[i].lcn == LCN_HOLE) { - Vprintf("File has a sparse section.\n"); + ntfs_log_verbose("File has a sparse section.\n"); memset(buffer, 0, bufsize); for (k = 0; k < rl[k].length * vol->cluster_size; k += bufsize) { if (write_data(fd, buffer, bufsize) < bufsize) { - Eprintf("Write failed: %s\n", strerror(errno)); + ntfs_log_perror("Write failed"); close(fd); goto free; } @@ -1760,18 +1777,18 @@ static int undelete_file(ntfs_volume *vol, long long inode) if (utils_cluster_in_use(vol, j) && !opts.optimistic) { memset(buffer, opts.fillbyte, bufsize); if (write_data(fd, buffer, bufsize) < bufsize) { - Eprintf("Write failed: %s\n", strerror(errno)); + ntfs_log_perror("Write failed"); close(fd); goto free; } } else { if (ntfs_cluster_read(vol, j, 1, buffer) < 1) { - Eprintf("Read failed: %s\n", strerror(errno)); + ntfs_log_perror("Read failed"); close(fd); goto free; } if (write_data(fd, buffer, bufsize) < bufsize) { - Eprintf("Write failed: %s\n", strerror(errno)); + ntfs_log_perror("Write failed"); close(fd); goto free; } @@ -1779,7 +1796,7 @@ static int undelete_file(ntfs_volume *vol, long long inode) } } } - Qprintf("\n"); + ntfs_log_quiet("\n"); /* * The following block of code implements the --truncate option. @@ -1795,28 +1812,27 @@ static int undelete_file(ntfs_volume *vol, long long inode) * that resident streams need not be truncated, since the original code * already recovers their exact length. +mabs */ - if (opts.truncate) { if (d->percent == 100 && d->size_alloc >= d->size_data && (d->size_alloc - d->size_data) <= (long long)vol->cluster_size && cluster_count * (long long)vol->cluster_size == d->size_alloc) { if (ftruncate(fd, (off_t)d->size_data)) - Eprintf("Truncation failed: %s\n", strerror(errno)); - } else Qprintf("Truncation not performed because file has an " + ntfs_log_perror("Truncation failed"); + } else ntfs_log_quiet("Truncation not performed because file has an " "inconsistent $MFT record.\n"); } if (close(fd) < 0) { - Eprintf("Close failed: %s\n", strerror(errno)); + ntfs_log_perror("Close failed"); } fd = -1; } set_date(pathname, file->date); if (d->name) - Qprintf("Undeleted '%s:%s' successfully.\n", file->pref_name, d->name); + ntfs_log_quiet("Undeleted '%s:%s' successfully.\n", file->pref_name, d->name); else - Qprintf("Undeleted '%s' successfully.\n", file->pref_name); + ntfs_log_quiet("Undeleted '%s' successfully.\n", file->pref_name); } result = 1; free: @@ -1857,14 +1873,14 @@ static int scan_disk(ntfs_volume *vol) attr = ntfs_attr_open(vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0); if (!attr) { - Eprintf("ERROR: Couldn't open $MFT/$BITMAP: %s\n", strerror(errno)); + ntfs_log_perror("ERROR: Couldn't open $MFT/$BITMAP"); return -1; } bmpsize = attr->initialized_size; buffer = malloc(BUFSIZE); if (!buffer) { - Eprintf("ERROR: Couldn't allocate memory in scan_disk()\n"); + ntfs_log_error("ERROR: Couldn't allocate memory in scan_disk()\n"); results = -1; goto out; } @@ -1875,7 +1891,7 @@ static int scan_disk(ntfs_volume *vol) if (!opts.match_case) flags |= REG_ICASE; if (regcomp(&re, opts.match, flags)) { - Eprintf("ERROR: Couldn't create a regex.\n"); + ntfs_log_error("ERROR: Couldn't create a regex.\n"); goto out; } } @@ -1883,8 +1899,8 @@ static int scan_disk(ntfs_volume *vol) nr_mft_records = vol->mft_na->initialized_size >> vol->mft_record_size_bits; - Qprintf("Inode Flags %%age Date Size Filename\n"); - Qprintf("---------------------------------------------------------------\n"); + ntfs_log_quiet("Inode Flags %%age Date Size Filename\n"); + ntfs_log_quiet("---------------------------------------------------------------\n"); for (i = 0; i < bmpsize; i += BUFSIZE) { long long read_count = min((bmpsize - i), BUFSIZE); size = ntfs_attr_pread(attr, i, read_count, buffer); @@ -1900,7 +1916,7 @@ static int scan_disk(ntfs_volume *vol) continue; file = read_record(vol, (i+j)*8+k); if (!file) { - Eprintf("Couldn't read MFT Record %d.\n", (i+j)*8+k); + ntfs_log_error("Couldn't read MFT Record %d.\n", (i+j)*8+k); continue; } @@ -1924,10 +1940,10 @@ static int scan_disk(ntfs_volume *vol) so undelete file by regex */ if (opts.mode == MODE_UNDELETE) { if (!undelete_file(vol, file->inode)) - Vprintf("ERROR: Failed to undelete " + ntfs_log_verbose("ERROR: Failed to undelete " "inode %lli\n!", file->inode); - printf("\n"); + ntfs_log_info("\n"); } } if (((opts.percent == -1) && (percent > 0)) || @@ -1940,7 +1956,8 @@ skip: } } done: - Qprintf("\nFiles with potentially recoverable content: %d\n", results); + ntfs_log_quiet("\nFiles with potentially recoverable content: %d\n", + results); out: if (opts.match) regfree(&re); @@ -1976,19 +1993,19 @@ static int copy_mft(ntfs_volume *vol, long long mft_begin, long long mft_end) return 1; if (mft_end < mft_begin) { - Eprintf("Range to copy is backwards.\n"); + ntfs_log_error("Range to copy is backwards.\n"); return 1; } buffer = malloc(vol->mft_record_size); if (!buffer) { - Eprintf("Couldn't allocate memory in copy_mft()\n"); + ntfs_log_error("Couldn't allocate memory in copy_mft()\n"); return 1; } mft = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0); if (!mft) { - Eprintf("Couldn't open $MFT/$DATA: %s\n", strerror(errno)); + ntfs_log_perror("Couldn't open $MFT/$DATA"); goto free; } @@ -2002,7 +2019,7 @@ static int copy_mft(ntfs_volume *vol, long long mft_begin, long long mft_end) create_pathname(opts.dest, name, NULL, pathname, sizeof(pathname)); fd = open_file(pathname); if (fd < 0) { - Eprintf("Couldn't open output file '%s': %s\n", name, strerror(errno)); + ntfs_log_perror("Couldn't open output file '%s'", name); goto attr; } @@ -2017,18 +2034,19 @@ static int copy_mft(ntfs_volume *vol, long long mft_begin, long long mft_end) ntfs_log_debug("\tEnd: %8lld\n", mft_end); for (i = mft_begin; i <= mft_end; i++) { - if (ntfs_attr_pread(mft, vol->mft_record_size * i, vol->mft_record_size, buffer) < vol->mft_record_size) { - Eprintf("Couldn't read MFT Record %lld: %s.\n", i, strerror(errno)); + if (ntfs_attr_pread(mft, vol->mft_record_size * i, + vol->mft_record_size, buffer) < vol->mft_record_size) { + ntfs_log_perror("Couldn't read MFT Record %lld", i); goto close; } if (write_data(fd, buffer, vol->mft_record_size) < vol->mft_record_size) { - Eprintf("Write failed: %s\n", strerror(errno)); + ntfs_log_perror("Write failed"); goto close; } } - Vprintf("Read %lld MFT Records\n", mft_end - mft_begin + 1); + ntfs_log_verbose("Read %lld MFT Records\n", mft_end - mft_begin + 1); result = 0; close: close(fd); @@ -2053,17 +2071,19 @@ static int handle_undelete(ntfs_volume *vol) /* Check whether (an) inode(s) was specified or at least a regex! */ if (nr_entries == 0) { if (with_regex == 0) { - printf("ERROR: NO inode(s) AND NO match-regex specified!\n"); + ntfs_log_error("ERROR: NO inode(s) AND NO match-regex " + "specified!\n"); } else { avoid_duplicate_printing= 1; result = !scan_disk(vol); if (result) - Vprintf("ERROR: Failed to scan device '%s'.\n", opts.device); + ntfs_log_verbose("ERROR: Failed to scan device " + "'%s'.\n", opts.device); } } else { /* Normal undelete by specifying inode(s) */ - Qprintf("Inode Flags %%age Date Size Filename\n"); - Qprintf("---------------------------------------------------------------\n"); + ntfs_log_quiet("Inode Flags %%age Date Size Filename\n"); + ntfs_log_quiet("---------------------------------------------------------------\n"); /* loop all given inodes */ for (i = 0; i < nr_entries; i++) { @@ -2071,9 +2091,8 @@ static int handle_undelete(ntfs_volume *vol) /* Now undelete file */ result = !undelete_file(vol, inode); if (result) - Vprintf("ERROR: Failed to undelete " - "inode %lli\n!", - inode); + ntfs_log_verbose("ERROR: Failed to " + "undelete inode %lli\n!", inode); } } } @@ -2093,6 +2112,8 @@ int main(int argc, char *argv[]) ntfs_volume *vol; int result = 1; + ntfs_log_set_handler(ntfs_log_handler_outerr); + with_regex = 0; avoid_duplicate_printing = 0; @@ -2111,7 +2132,8 @@ int main(int argc, char *argv[]) case MODE_SCAN: result = !scan_disk(vol); if (result) - Vprintf("ERROR: Failed to scan device '%s'.\n", opts.device); + ntfs_log_verbose("ERROR: Failed to scan device '%s'.\n", + opts.device); break; /* Undelete-handling */ @@ -2123,8 +2145,8 @@ int main(int argc, char *argv[]) case MODE_COPY: result = !copy_mft(vol, opts.mft_begin, opts.mft_end); if (result) - Vprintf("ERROR: Failed to read MFT blocks %lld-%lld.\n", - opts.mft_begin, + ntfs_log_verbose("ERROR: Failed to read MFT blocks " + "%lld-%lld.\n", opts.mft_begin, min((vol->mft_na->initialized_size >> vol->mft_record_size_bits) , opts.mft_end)); break; From 8a363705cd6c43b6260ae4543cc5f72c3d6e2ddf Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 18:23:32 +0000 Subject: [PATCH 2665/2994] upgrade to use new logging change stderror messages to ntfs_log_perror --- ntfsprogs/ntfswipe.c | 252 +++++++++++++++++++++++-------------------- 1 file changed, 133 insertions(+), 119 deletions(-) diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 6f54af07..094d132c 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -2,7 +2,7 @@ * ntfswipe - Part of the Linux-NTFS project. * * Copyright (c) 2005 Anton Altaparmakov - * Copyright (c) 2002-2003 Richard Russon + * Copyright (c) 2002-2005 Richard Russon * Copyright (c) 2004 Yura Pakhuchiy * * This utility will overwrite unused space on an NTFS volume. @@ -55,14 +55,11 @@ #include "dir.h" #include "mst.h" #include "version.h" +#include "logging.h" static const char *EXEC_NAME = "ntfswipe"; static struct options opts; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) - /** * version - Print version information about the program * @@ -72,12 +69,12 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) */ static void version(void) { - printf("\n%s v%s (libntfs %s) - Overwrite the unused space on an NTFS " + ntfs_log_info("\n%s v%s (libntfs %s) - Overwrite the unused space on an NTFS " "Volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf("Copyright (c) 2002-2003 Richard Russon\n"); - printf("Copyright (c) 2004 Yura Pakhuchiy\n"); - printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + ntfs_log_info("Copyright (c) 2002-2005 Richard Russon\n"); + ntfs_log_info("Copyright (c) 2004 Yura Pakhuchiy\n"); + ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -89,7 +86,7 @@ static void version(void) */ static void usage(void) { - printf("\nUsage: %s [options] device\n" + ntfs_log_info("\nUsage: %s [options] device\n" " -i --info Show volume information (default)\n" "\n" " -d --directory Wipe directory indexes\n" @@ -111,7 +108,7 @@ static void usage(void) " -V --version Version information\n" " -h --help Print this help\n\n", EXEC_NAME); - printf("%s%s\n", ntfs_bugs, ntfs_home); + ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -144,7 +141,7 @@ static int parse_list(char *list, int **result) mem = malloc((count+1) * sizeof(int)); if (!mem) { - Eprintf("Couldn't allocate memory in parse_list().\n"); + ntfs_log_error("Couldn't allocate memory in parse_list().\n"); return 0; } @@ -156,13 +153,13 @@ static int parse_list(char *list, int **result) mem[i] = strtol(ptr, &end, 0); if (!end || (end == ptr) || ((*end != ',') && (*end != 0))) { - Eprintf("Invalid list '%s'\n", list); + ntfs_log_error("Invalid list '%s'\n", list); free(mem); return 0; } if ((mem[i] < 0) || (mem[i] > 255)) { - Eprintf("Bytes must be in range 0-255.\n"); + ntfs_log_error("Bytes must be in range 0-255.\n"); free(mem); return 0; } @@ -217,6 +214,7 @@ static int parse_options(int argc, char *argv[]) int err = 0; int ver = 0; int help = 0; + int levels = 0; opterr = 0; /* We'll handle the errors, thank you. */ @@ -269,6 +267,11 @@ static int parse_options(int argc, char *argv[]) break; case 'h': case '?': + if (strncmp (argv[optind-1], "--log-", 6) == 0) { + if (!ntfs_log_parse_option (argv[optind-1])) + err++; + break; + } help++; break; case 'l': @@ -285,6 +288,7 @@ static int parse_options(int argc, char *argv[]) break; case 'q': opts.quiet++; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 't': opts.tails++; @@ -294,44 +298,52 @@ static int parse_options(int argc, char *argv[]) break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; case 'V': ver++; break; default: if ((optopt == 'b') || (optopt == 'c')) { - Eprintf("Option '%s' requires an argument.\n", argv[optind-1]); + ntfs_log_error("Option '%s' requires an argument.\n", argv[optind-1]); } else { - Eprintf("Unknown option '%s'.\n", argv[optind-1]); + ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); } err++; break; } } + /* Make sure we're in sync with the log levels */ + levels = ntfs_log_get_levels(); + if (levels & NTFS_LOG_LEVEL_VERBOSE) + opts.verbose++; + if (!(levels & NTFS_LOG_LEVEL_QUIET)) + opts.quiet++; + if (help || ver) { opts.quiet = 0; } else { if (opts.device == NULL) { if (argc > 1) - Eprintf("You must specify exactly one device.\n"); + ntfs_log_error("You must specify exactly one device.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf("You may not use --quiet and --verbose at the same time.\n"); + ntfs_log_error("You may not use --quiet and --verbose at the same time.\n"); err++; } /* if (opts.info && (opts.unused || opts.tails || opts.mft || opts.directory)) { - Eprintf("You may not use any other options with --info.\n"); + ntfs_log_error("You may not use any other options with --info.\n"); err++; } */ if ((opts.count < 1) || (opts.count > 100)) { - Eprintf("The iteration count must be between 1 and 100.\n"); + ntfs_log_error("The iteration count must be between 1 and 100.\n"); err++; } @@ -342,7 +354,7 @@ static int parse_options(int argc, char *argv[]) opts.bytes[0] = 0; opts.bytes[1] = -1; } else { - Eprintf("Couldn't allocate memory for byte list.\n"); + ntfs_log_error("Couldn't allocate memory for byte list.\n"); err++; } } @@ -386,7 +398,7 @@ static s64 wipe_unused(ntfs_volume *vol, int byte, enum action act) if (act != act_info) { buffer = malloc(vol->cluster_size); if (!buffer) { - Eprintf("malloc failed\n"); + ntfs_log_error("malloc failed\n"); return -1; } memset(buffer, byte, vol->cluster_size); @@ -394,15 +406,15 @@ static s64 wipe_unused(ntfs_volume *vol, int byte, enum action act) for (i = 0; i < vol->nr_clusters; i++) { if (utils_cluster_in_use(vol, i)) { - //Vprintf("cluster %lld is in use\n", i); + //ntfs_log_verbose("cluster %lld is in use\n", i); continue; } if (act == act_wipe) { - //Vprintf("cluster %lld is not in use\n", i); + //ntfs_log_verbose("cluster %lld is not in use\n", i); result = ntfs_pwrite(vol->dev, vol->cluster_size * i, vol->cluster_size, buffer); if (result != vol->cluster_size) { - Eprintf("write failed\n"); + ntfs_log_error("write failed\n"); goto free; } } @@ -410,7 +422,7 @@ static s64 wipe_unused(ntfs_volume *vol, int byte, enum action act) total += vol->cluster_size; } - Qprintf("wipe_unused 0x%02x, %lld bytes\n", byte, (long long)total); + ntfs_log_quiet("wipe_unused 0x%02x, %lld bytes\n", byte, (long long)total); free: free(buffer); return total; @@ -462,8 +474,8 @@ static s64 wipe_compressed_attribute(ntfs_volume *vol, int byte, offset, 2, &block_size); block_size = le16_to_cpu(block_size); if (ret != 2) { - Vprintf("Internal error\n"); - Eprintf("ntfs_rl_pread failed"); + ntfs_log_verbose("Internal error\n"); + ntfs_log_error("ntfs_rl_pread failed"); return -1; } if (block_size == 0) { @@ -484,8 +496,8 @@ static s64 wipe_compressed_attribute(ntfs_volume *vol, int byte, } if (size < 0) { - Vprintf("Internal error\n"); - Eprintf("bug or damaged fs: we want " + ntfs_log_verbose("Internal error\n"); + ntfs_log_error("bug or damaged fs: we want " "allocate buffer size %lld bytes", size); return -1; } @@ -498,8 +510,8 @@ static s64 wipe_compressed_attribute(ntfs_volume *vol, int byte, buf = malloc(size); if (!buf) { - Vprintf("Not enough memory\n"); - Eprintf("Not enough memory to allocate " + ntfs_log_verbose("Not enough memory\n"); + ntfs_log_error("Not enough memory to allocate " "%lld bytes", size); return -1; } @@ -508,8 +520,8 @@ static s64 wipe_compressed_attribute(ntfs_volume *vol, int byte, ret = ntfs_rl_pwrite(vol, na->rl, offset, size, buf); free(buf); if (ret != size) { - Vprintf("Internal error\n"); - Eprintf("ntfs_rl_pwrite failed, offset %llu, " + ntfs_log_verbose("Internal error\n"); + ntfs_log_error("ntfs_rl_pwrite failed, offset %llu, " "size %lld, vcn %lld", offset, size, rlc->vcn); return -1; } @@ -551,16 +563,16 @@ static s64 wipe_attribute(ntfs_volume *vol, int byte, enum action act, buf = malloc(size); if (!buf) { - Vprintf("Not enough memory\n"); - Eprintf("Not enough memory to allocate %lld bytes", size); + ntfs_log_verbose("Not enough memory\n"); + ntfs_log_error("Not enough memory to allocate %lld bytes", size); return -1; } memset(buf, byte, size); wiped = ntfs_rl_pwrite(vol, na->rl, offset, size, buf); if (wiped == -1) { - Vprintf("Internal error\n"); - Eprintf("Couldn't wipe tail"); + ntfs_log_verbose("Internal error\n"); + ntfs_log_error("Couldn't wipe tail"); } free(buf); @@ -596,32 +608,32 @@ static s64 wipe_tails(ntfs_volume *vol, int byte, enum action act) for (inode_num = 16; inode_num < nr_mft_records; inode_num++) { s64 wiped; - Vprintf("Inode %lld - ", inode_num); + ntfs_log_verbose("Inode %lld - ", inode_num); ni = ntfs_inode_open(vol, inode_num); if (!ni) { - Vprintf("Could not open inode\n"); + ntfs_log_verbose("Could not open inode\n"); continue; } if (ni->mrec->base_mft_record) { - Vprintf("Not base mft record. Skipping\n"); + ntfs_log_verbose("Not base mft record. Skipping\n"); goto close_inode; } na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); if (!na) { - Vprintf("Couldn't open $DATA attribute\n"); + ntfs_log_verbose("Couldn't open $DATA attribute\n"); goto close_inode; } if (!NAttrNonResident(na)) { - Vprintf("Resident $DATA attribute. Skipping.\n"); + ntfs_log_verbose("Resident $DATA attribute. Skipping.\n"); goto close_attr; } if (ntfs_attr_map_whole_runlist(na)) { - Vprintf("Internal error\n"); - Eprintf("Can't map runlist (inode %lld)\n", inode_num); + ntfs_log_verbose("Internal error\n"); + ntfs_log_error("Can't map runlist (inode %lld)\n", inode_num); goto close_attr; } @@ -631,21 +643,21 @@ static s64 wipe_tails(ntfs_volume *vol, int byte, enum action act) wiped = wipe_attribute(vol, byte, act, na); if (wiped == -1) { - Eprintf(" (inode %lld)\n", inode_num); + ntfs_log_error(" (inode %lld)\n", inode_num); goto close_attr; } if (wiped) { - Vprintf("Wiped %llu bytes\n", wiped); + ntfs_log_verbose("Wiped %llu bytes\n", wiped); total += wiped; } else - Vprintf("Nothing to wipe\n"); + ntfs_log_verbose("Nothing to wipe\n"); close_attr: ntfs_attr_close(na); close_inode: ntfs_inode_close(ni); } - Qprintf("wipe_tails 0x%02x, %lld bytes\n", byte, total); + ntfs_log_quiet("wipe_tails 0x%02x, %lld bytes\n", byte, total); return total; } @@ -677,7 +689,7 @@ static s64 wipe_mft(ntfs_volume *vol, int byte, enum action act) buffer = malloc(vol->mft_record_size); if (!buffer) { - Eprintf("malloc failed\n"); + ntfs_log_error("malloc failed\n"); return -1; } @@ -689,7 +701,7 @@ static s64 wipe_mft(ntfs_volume *vol, int byte, enum action act) result = ntfs_attr_mst_pread(vol->mft_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); if (result != 1) { - Eprintf("error attr mst read %lld\n", + ntfs_log_error("error attr mst read %lld\n", (long long)i); total = -1; // XXX just negate result? goto free; @@ -699,7 +711,7 @@ static s64 wipe_mft(ntfs_volume *vol, int byte, enum action act) size = *((u32*) (buffer + 0x18)) - 4; if (act == act_info) { - //printf("mft %d\n", size); + //ntfs_log_info("mft %d\n", size); total += size; continue; } @@ -709,7 +721,7 @@ static s64 wipe_mft(ntfs_volume *vol, int byte, enum action act) result = ntfs_attr_mst_pwrite(vol->mft_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); if (result != 1) { - Eprintf("error attr mst write %lld\n", + ntfs_log_error("error attr mst write %lld\n", (long long)i); total = -1; goto free; @@ -727,7 +739,7 @@ static s64 wipe_mft(ntfs_volume *vol, int byte, enum action act) result = ntfs_attr_mst_pwrite(vol->mftmirr_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); if (result != 1) { - Eprintf("error attr mst write %lld\n", + ntfs_log_error("error attr mst write %lld\n", (long long)i); total = -1; goto free; @@ -768,7 +780,7 @@ static s64 wipe_mft(ntfs_volume *vol, int byte, enum action act) result = ntfs_attr_mst_pwrite(vol->mft_na, vol->mft_record_size * i, 1, vol->mft_record_size, buffer); if (result != 1) { - Eprintf("error attr mst write %lld\n", + ntfs_log_error("error attr mst write %lld\n", (long long)i); total = -1; goto free; @@ -778,7 +790,7 @@ static s64 wipe_mft(ntfs_volume *vol, int byte, enum action act) } } - Qprintf("wipe_mft 0x%02x, %lld bytes\n", byte, (long long)total); + ntfs_log_quiet("wipe_mft 0x%02x, %lld bytes\n", byte, (long long)total); free: free(buffer); return total; @@ -814,23 +826,23 @@ static s64 wipe_index_allocation(ntfs_volume *vol, int byte, enum action act bitmap = malloc(nab->data_size); if (!bitmap) { - Vprintf("malloc failed\n"); - Eprintf("Couldn't allocate %lld bytes", nab->data_size); + ntfs_log_verbose("malloc failed\n"); + ntfs_log_error("Couldn't allocate %lld bytes", nab->data_size); return -1; } if (ntfs_attr_pread(nab, 0, nab->data_size, bitmap) != nab->data_size) { - Vprintf("Internal error\n"); - Eprintf("Couldn't read $BITMAP"); + ntfs_log_verbose("Internal error\n"); + ntfs_log_error("Couldn't read $BITMAP"); total = -1; goto free_bitmap; } buf = malloc(indx_record_size); if (!buf) { - Vprintf("malloc failed\n"); - Eprintf("Couldn't allocate %u bytes", + ntfs_log_verbose("malloc failed\n"); + ntfs_log_error("Couldn't allocate %u bytes", (unsigned int)indx_record_size); total = -1; goto free_bitmap; @@ -844,8 +856,8 @@ static s64 wipe_index_allocation(ntfs_volume *vol, int byte, enum action act s64 ret = ntfs_rl_pread(vol, naa->rl, offset, indx_record_size, buf); if (ret != indx_record_size) { - Vprintf("ntfs_rl_pread failed\n"); - Eprintf("Couldn't read INDX record"); + ntfs_log_verbose("ntfs_rl_pread failed\n"); + ntfs_log_error("Couldn't read INDX record"); total = -1; goto free_buf; } @@ -853,12 +865,12 @@ static s64 wipe_index_allocation(ntfs_volume *vol, int byte, enum action act indx = (INDEX_ALLOCATION *) buf; if (ntfs_mst_post_read_fixup((NTFS_RECORD *)buf, indx_record_size)) - Eprintf("damaged fs: mst_post_read_fixup failed"); + ntfs_log_error("damaged fs: mst_post_read_fixup failed"); if ((le32_to_cpu(indx->index.allocated_size) + 0x18) != indx_record_size) { - Vprintf("Internal error\n"); - Eprintf("INDX record should be %u bytes", + ntfs_log_verbose("Internal error\n"); + ntfs_log_error("INDX record should be %u bytes", (unsigned int)indx_record_size); total = -1; goto free_buf; @@ -869,20 +881,20 @@ static s64 wipe_index_allocation(ntfs_volume *vol, int byte, enum action act memset(buf + wipe_offset, byte, wipe_size); if (ntfs_mst_pre_write_fixup((NTFS_RECORD *)indx, indx_record_size)) - Eprintf("damaged fs: mst_pre_write_protect failed"); + ntfs_log_error("damaged fs: mst_pre_write_protect failed"); if (opts.verbose > 1) - Vprintf("+"); + ntfs_log_verbose("+"); } else { wipe_size = indx_record_size; memset(buf, byte, wipe_size); if (opts.verbose > 1) - Vprintf("x"); + ntfs_log_verbose("x"); } wiped = ntfs_rl_pwrite(vol, naa->rl, offset, indx_record_size, buf); if (wiped != indx_record_size) { - Vprintf("ntfs_rl_pwrite failed\n"); - Eprintf("Couldn't wipe tail of INDX record"); + ntfs_log_verbose("ntfs_rl_pwrite failed\n"); + ntfs_log_error("Couldn't wipe tail of INDX record"); total = -1; goto free_buf; } @@ -896,7 +908,7 @@ static s64 wipe_index_allocation(ntfs_volume *vol, int byte, enum action act } } if ((opts.verbose > 1) && (wiped != -1)) - Vprintf("\n\t"); + ntfs_log_verbose("\n\t"); free_buf: free(buf); free_bitmap: @@ -916,15 +928,15 @@ static u32 get_indx_record_size(ntfs_attr *nar) u32 indx_record_size; if (ntfs_attr_pread(nar, 8, 4, &indx_record_size) != 4) { - Vprintf("Couldn't determine size of INDX record\n"); - Eprintf("ntfs_attr_pread failed"); + ntfs_log_verbose("Couldn't determine size of INDX record\n"); + ntfs_log_error("ntfs_attr_pread failed"); return 0; } indx_record_size = le32_to_cpu(indx_record_size); if (!indx_record_size) { - Vprintf("Internal error\n"); - Eprintf("INDX record should be 0"); + ntfs_log_verbose("Internal error\n"); + ntfs_log_error("INDX record should be 0"); } return indx_record_size; } @@ -961,51 +973,51 @@ static s64 wipe_directory(ntfs_volume *vol, int byte, enum action act) u32 indx_record_size; s64 wiped; - Vprintf("Inode %lld - ", inode_num); + ntfs_log_verbose("Inode %lld - ", inode_num); ni = ntfs_inode_open(vol, inode_num); if (!ni) { if (opts.verbose > 2) - Vprintf("Could not open inode\n"); + ntfs_log_verbose("Could not open inode\n"); else - Vprintf("\r"); + ntfs_log_verbose("\r"); continue; } if (ni->mrec->base_mft_record) { if (opts.verbose > 2) - Vprintf("Not base mft record. Skipping\n"); + ntfs_log_verbose("Not base mft record. Skipping\n"); else - Vprintf("\r"); + ntfs_log_verbose("\r"); goto close_inode; } naa = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4); if (!naa) { if (opts.verbose > 2) - Vprintf("Couldn't open $INDEX_ALLOCATION\n"); + ntfs_log_verbose("Couldn't open $INDEX_ALLOCATION\n"); else - Vprintf("\r"); + ntfs_log_verbose("\r"); goto close_inode; } if (!NAttrNonResident(naa)) { - Vprintf("Resident $INDEX_ALLOCATION\n"); - Eprintf("damaged fs: Resident $INDEX_ALLOCATION " + ntfs_log_verbose("Resident $INDEX_ALLOCATION\n"); + ntfs_log_error("damaged fs: Resident $INDEX_ALLOCATION " "(inode %lld)\n", inode_num); goto close_attr_allocation; } if (ntfs_attr_map_whole_runlist(naa)) { - Vprintf("Internal error\n"); - Eprintf("Can't map runlist for $INDEX_ALLOCATION " + ntfs_log_verbose("Internal error\n"); + ntfs_log_error("Can't map runlist for $INDEX_ALLOCATION " "(inode %lld)\n", inode_num); goto close_attr_allocation; } nab = ntfs_attr_open(ni, AT_BITMAP, NTFS_INDEX_I30, 4); if (!nab) { - Vprintf("Couldn't open $BITMAP\n"); - Eprintf("damaged fs: $INDEX_ALLOCATION is present, " + ntfs_log_verbose("Couldn't open $BITMAP\n"); + ntfs_log_error("damaged fs: $INDEX_ALLOCATION is present, " "but we can't open $BITMAP with same " "name (inode %lld)\n", inode_num); goto close_attr_allocation; @@ -1013,38 +1025,38 @@ static s64 wipe_directory(ntfs_volume *vol, int byte, enum action act) nar = ntfs_attr_open(ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4); if (!nar) { - Vprintf("Couldn't open $INDEX_ROOT\n"); - Eprintf("damaged fs: $INDEX_ALLOCATION is present, but " + ntfs_log_verbose("Couldn't open $INDEX_ROOT\n"); + ntfs_log_error("damaged fs: $INDEX_ALLOCATION is present, but " "we can't open $INDEX_ROOT with same name" " (inode %lld)\n", inode_num); goto close_attr_bitmap; } if (NAttrNonResident(nar)) { - Vprintf("Not resident $INDEX_ROOT\n"); - Eprintf("damaged fs: Not resident $INDEX_ROOT " + ntfs_log_verbose("Not resident $INDEX_ROOT\n"); + ntfs_log_error("damaged fs: Not resident $INDEX_ROOT " "(inode %lld)\n", inode_num); goto close_attr_root; } indx_record_size = get_indx_record_size(nar); if (!indx_record_size) { - Eprintf(" (inode %lld)\n", inode_num); + ntfs_log_error(" (inode %lld)\n", inode_num); goto close_attr_root; } wiped = wipe_index_allocation(vol, byte, act, naa, nab, indx_record_size); if (wiped == -1) { - Eprintf(" (inode %lld)\n", inode_num); + ntfs_log_error(" (inode %lld)\n", inode_num); goto close_attr_root; } if (wiped) { - Vprintf("Wiped %llu bytes\n", wiped); + ntfs_log_verbose("Wiped %llu bytes\n", wiped); total += wiped; } else - Vprintf("Nothing to wipe\n"); + ntfs_log_verbose("Nothing to wipe\n"); close_attr_root: ntfs_attr_close(nar); close_attr_bitmap: @@ -1055,7 +1067,7 @@ close_inode: ntfs_inode_close(ni); } - Qprintf("wipe_directory 0x%02x, %lld bytes\n", byte, total); + ntfs_log_quiet("wipe_directory 0x%02x, %lld bytes\n", byte, total); return total; } @@ -1091,7 +1103,7 @@ static s64 wipe_logfile(ntfs_volume *vol, int byte, enum action act if (!vol || (byte < 0)) return -1; - //Qprintf("wipe_logfile(not implemented) 0x%02x\n", byte); + //ntfs_log_quiet("wipe_logfile(not implemented) 0x%02x\n", byte); if ((ni = ntfs_inode_open(vol, FILE_LogFile)) == NULL) { ntfs_log_debug("Failed to open inode FILE_LogFile.\n"); @@ -1155,7 +1167,7 @@ static s64 wipe_logfile(ntfs_volume *vol, int byte, enum action act ntfs_attr_close(na); ntfs_inode_close(ni); - Qprintf("wipe_logfile 0x%02x, %lld bytes\n", byte, pos); + ntfs_log_quiet("wipe_logfile 0x%02x, %lld bytes\n", byte, pos); return pos; io_error_exit: @@ -1196,7 +1208,7 @@ static s64 wipe_pagefile(ntfs_volume *vol, int byte, enum action act if (!vol || (byte < 0)) return -1; - //Qprintf("wipe_pagefile(not implemented) 0x%02x\n", byte); + //ntfs_log_quiet("wipe_pagefile(not implemented) 0x%02x\n", byte); ni = ntfs_pathname_to_inode(vol, NULL, "pagefile.sys"); if (!ni) { @@ -1245,7 +1257,7 @@ static s64 wipe_pagefile(ntfs_volume *vol, int byte, enum action act ntfs_attr_close(na); ntfs_inode_close(ni); - Qprintf("wipe_pagefile 0x%02x, %lld bytes\n", byte, pos); + ntfs_log_quiet("wipe_pagefile 0x%02x, %lld bytes\n", byte, pos); return pos; io_error_exit: @@ -1272,33 +1284,33 @@ static void print_summary(void) int i; if (opts.noaction) - Qprintf("%s is in 'no-action' mode, it will NOT write to disk." + ntfs_log_quiet("%s is in 'no-action' mode, it will NOT write to disk." "\n\n", EXEC_NAME); - Qprintf("%s is about to wipe:\n", EXEC_NAME); + ntfs_log_quiet("%s is about to wipe:\n", EXEC_NAME); if (opts.unused) - Qprintf("\tunused disk space\n"); + ntfs_log_quiet("\tunused disk space\n"); if (opts.tails) - Qprintf("\tfile tails\n"); + ntfs_log_quiet("\tfile tails\n"); if (opts.mft) - Qprintf("\tunused mft areas\n"); + ntfs_log_quiet("\tunused mft areas\n"); if (opts.directory) - Qprintf("\tunused directory index space\n"); + ntfs_log_quiet("\tunused directory index space\n"); if (opts.logfile) - Qprintf("\tthe logfile (journal)\n"); + ntfs_log_quiet("\tthe logfile (journal)\n"); if (opts.pagefile) - Qprintf("\tthe pagefile (swap space)\n"); + ntfs_log_quiet("\tthe pagefile (swap space)\n"); - Qprintf("\n%s will overwrite these areas with: ", EXEC_NAME); + ntfs_log_quiet("\n%s will overwrite these areas with: ", EXEC_NAME); if (opts.bytes) { for (i = 0; opts.bytes[i] >= 0; i++) - Qprintf("0x%02x ", opts.bytes[i]); + ntfs_log_quiet("0x%02x ", opts.bytes[i]); } - Qprintf("\n"); + ntfs_log_quiet("\n"); if (opts.count > 1) - Qprintf("%s will repeat these operations %d times.\n", EXEC_NAME, opts.count); - Qprintf("\n"); + ntfs_log_quiet("%s will repeat these operations %d times.\n", EXEC_NAME, opts.count); + ntfs_log_quiet("\n"); } /** @@ -1317,6 +1329,8 @@ int main(int argc, char *argv[]) int i, j; enum action act = act_info; + ntfs_log_set_handler(ntfs_log_handler_outerr); + if (!parse_options(argc, argv)) return 1; @@ -1346,11 +1360,11 @@ int main(int argc, char *argv[]) /* Even if the output it quieted, you still get 5 seconds to abort. */ if ((act == act_wipe) && !opts.force) { - Qprintf("\n%s will begin in 5 seconds, press CTRL-C to abort.\n", EXEC_NAME); + ntfs_log_quiet("\n%s will begin in 5 seconds, press CTRL-C to abort.\n", EXEC_NAME); sleep(5); } - printf("\n"); + ntfs_log_info("\n"); for (i = 0; i < opts.count; i++) { int byte; s64 total = 0; @@ -1410,7 +1424,7 @@ int main(int argc, char *argv[]) break; } - printf("%lld bytes were wiped\n", (long long)total); + ntfs_log_info("%lld bytes were wiped\n", (long long)total); } result = 0; umount: From 325ab7c64dd6f14c4c2f37684d2055a6e56c219c Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 18:26:49 +0000 Subject: [PATCH 2666/2994] mistake parsing quiet --- ntfsprogs/ntfsinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index a911d338..c3cce857 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -206,7 +206,7 @@ static int parse_options(int argc, char *argv[]) break; case 'q': opts.quiet++; - ntfs_log_set_levels(NTFS_LOG_LEVEL_QUIET); + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 't': opts.notime++; From 9cf47594761e197d9f8c793354328025406c099b Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 18:39:52 +0000 Subject: [PATCH 2667/2994] upgrade to use new logging --- ntfsprogs/ntfsmove.c | 187 +++++++++++++++++++++++-------------------- 1 file changed, 102 insertions(+), 85 deletions(-) diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c index 62257e1a..6b2999af 100644 --- a/ntfsprogs/ntfsmove.c +++ b/ntfsprogs/ntfsmove.c @@ -46,14 +46,11 @@ #include "bitmap.h" #include "ntfsmove.h" #include "version.h" +#include "logging.h" static const char *EXEC_NAME = "ntfsmove"; static struct options opts; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) - /** * version - Print version information about the program * @@ -63,11 +60,11 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) */ static void version(void) { - printf("\n%s v%s (libntfs %s) - Move files and directories on an " + ntfs_log_info("\n%s v%s (libntfs %s) - Move files and directories on an " "NTFS volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf("Copyright (c) 2003 Richard Russon\n"); - printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + ntfs_log_info("Copyright (c) 2003 Richard Russon\n"); + ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -79,7 +76,7 @@ static void version(void) */ static void usage(void) { - printf("\nUsage: %s [options] device file\n" + ntfs_log_info("\nUsage: %s [options] device file\n" "\n" " -S --start Move to the start of the volume\n" " -B --best Move to the best place on the volume\n" @@ -94,7 +91,7 @@ static void usage(void) " -V --version Version information\n" " -v --verbose More output\n\n", EXEC_NAME); - printf("%s%s\n", ntfs_bugs, ntfs_home); + ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -128,6 +125,7 @@ static int parse_options(int argc, char **argv) int err = 0; int ver = 0; int help = 0; + int levels = 0; char *end = NULL; opterr = 0; /* We'll handle the errors, thank you. */ @@ -174,6 +172,11 @@ static int parse_options(int argc, char **argv) break; case 'h': case '?': + if (strncmp (argv[optind-1], "--log-", 6) == 0) { + if (!ntfs_log_parse_option (argv[optind-1])) + err++; + break; + } help++; break; case 'n': @@ -181,6 +184,7 @@ static int parse_options(int argc, char **argv) break; case 'q': opts.quiet++; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 'S': if (opts.location == 0) @@ -193,32 +197,40 @@ static int parse_options(int argc, char **argv) break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; default: - Eprintf("Unknown option '%s'.\n", argv[optind-1]); + ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); err++; break; } } + /* Make sure we're in sync with the log levels */ + levels = ntfs_log_get_levels(); + if (levels & NTFS_LOG_LEVEL_VERBOSE) + opts.verbose++; + if (!(levels & NTFS_LOG_LEVEL_QUIET)) + opts.quiet++; + if (help || ver) { opts.quiet = 0; } else { if ((opts.device == NULL) || (opts.file == NULL)) { if (argc > 1) - Eprintf("You must specify one device and one file.\n"); + ntfs_log_error("You must specify one device and one file.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf("You may not use --quiet and --verbose at the " + ntfs_log_error("You may not use --quiet and --verbose at the " "same time.\n"); err++; } if (opts.location == -1) { - Eprintf("You may only specify one location option: " + ntfs_log_error("You may only specify one location option: " "--start, --best, --end or --cluster\n"); err++; } else if (opts.location == 0) { @@ -249,7 +261,7 @@ static int ntfs_debug_runlist_dump2(const runlist *rl, int abbr, char *prefix) const char *lcn_str[5] = { "HOLE", "NOTMAP", "ENOENT", "EINVAL", "XXXX" }; if (!rl) { - printf(" Run list not present.\n"); + ntfs_log_info(" Run list not present.\n"); return 0; } @@ -259,7 +271,7 @@ static int ntfs_debug_runlist_dump2(const runlist *rl, int abbr, char *prefix) if (abbr) for (len = 0; rl[len].length; len++) ; - printf("%s VCN LCN len\n", prefix); + ntfs_log_info("%s VCN LCN len\n", prefix); for (i = 0; rl->length; i++, rl++) { LCN lcn = rl->lcn; @@ -267,7 +279,7 @@ static int ntfs_debug_runlist_dump2(const runlist *rl, int abbr, char *prefix) if (abbr) if (len > 20) { if ((i == abbr) && (len > (abbr*2))) - printf("%s ... ... ...\n", prefix); + ntfs_log_info("%s ... ... ...\n", prefix); if ((i > (abbr-1)) && (i < (len - (abbr-1)))) continue; } @@ -282,15 +294,15 @@ static int ntfs_debug_runlist_dump2(const runlist *rl, int abbr, char *prefix) j = 4; res = -1; } - printf("%s%8lld %8s %8lld\n", prefix, + ntfs_log_info("%s%8lld %8s %8lld\n", prefix, rl->vcn, lcn_str[j], rl->length); } else - printf("%s%8lld %8lld %8lld\n", prefix, + ntfs_log_info("%s%8lld %8lld %8lld\n", prefix, rl->vcn, rl->lcn, rl->length); } - printf("%s --------\n", prefix); - printf("%s %8lld\n", prefix, total); - printf("\n"); + ntfs_log_info("%s --------\n", prefix); + ntfs_log_info("%s %8lld\n", prefix, total); + ntfs_log_info("\n"); return res; } @@ -316,12 +328,12 @@ static int resize_nonres_attr(MFT_RECORD *m, ATTR_RECORD *a, const u32 new_size) ptr = (u8*) m; /* - printf("old_size = %d\n", old_size); - printf("new_size = %d\n", new_size); - printf("file_size = %d\n", file_size); - printf("this_attr = %d\n", this_attr); - printf("next_attr = %d\n", next_attr); - printf("tail_size = %d\n", tail_size); + ntfs_log_info("old_size = %d\n", old_size); + ntfs_log_info("new_size = %d\n", new_size); + ntfs_log_info("file_size = %d\n", file_size); + ntfs_log_info("this_attr = %d\n", this_attr); + ntfs_log_info("next_attr = %d\n", next_attr); + ntfs_log_info("tail_size = %d\n", tail_size); */ memmove(ptr + this_attr + new_size, ptr + next_attr, tail_size); @@ -357,12 +369,12 @@ static int calc_attr_length(ATTR_RECORD *rec, int runlength) static void dump_runs(u8 *buffer, int len) { int i; - printf("RUN: \e[01;31m"); + ntfs_log_info("RUN: \e[01;31m"); for (i = 0; i < len; i++) { - printf(" %02x", buffer[i]); + ntfs_log_info(" %02x", buffer[i]); } - printf("\e[0m\n"); + ntfs_log_info("\e[0m\n"); } #endif /* if 0 */ @@ -383,17 +395,17 @@ static runlist * find_unused(ntfs_volume *vol, s64 size, u64 loc int bit = 0; runlist *res = NULL; - //printf("find_unused\n"); + //ntfs_log_info("find_unused\n"); buffer = malloc(bufsize); if (!buffer) { - printf("!buffer\n"); + ntfs_log_info("!buffer\n"); return NULL; } - //printf("looking for space for %lld clusters\n", size); + //ntfs_log_info("looking for space for %lld clusters\n", size); clus = vol->lcnbmp_na->allocated_size / bufsize; - //printf("clus = %d\n", clus); + //ntfs_log_info("clus = %d\n", clus); for (i = 0; i < clus; i++) { int bytes_read, j; @@ -401,7 +413,7 @@ static runlist * find_unused(ntfs_volume *vol, s64 size, u64 loc bytes_read = ntfs_attr_pread(vol->lcnbmp_na, i*bufsize, bufsize, buffer); if (bytes_read != bufsize) { - printf("!read\n"); + ntfs_log_info("!read\n"); return NULL; } for (j = 0; j < bufsize*8; j++) { @@ -420,7 +432,7 @@ static runlist * find_unused(ntfs_volume *vol, s64 size, u64 loc goto done; } } else { - //printf("%d * %d\n", curr, count); + //ntfs_log_info("%d * %d\n", curr, count); curr = bit; count = 1; start = i*bufsize*8 + j; @@ -428,18 +440,18 @@ static runlist * find_unused(ntfs_volume *vol, s64 size, u64 loc } } done: - //printf("%d * %d\n", curr, count); + //ntfs_log_info("%d * %d\n", curr, count); free(buffer); if (res) { for (i = 0; i < size; i++) { if (utils_cluster_in_use(vol, res->lcn + i)) { - printf("ERROR cluster %lld in use\n", res->lcn + i); + ntfs_log_info("ERROR cluster %lld in use\n", res->lcn + i); } } } else { - printf("failed\n"); + ntfs_log_info("failed\n"); } return res; @@ -464,26 +476,26 @@ static int dont_move(ntfs_inode *ino) FILE_NAME_ATTR *name; if (utils_is_metadata(ino)) { - Eprintf("metadata\n"); + ntfs_log_error("metadata\n"); return 1; } rec = find_first_attribute(AT_ATTRIBUTE_LIST, ino->mrec); if (rec) { - Eprintf("attribute list\n"); + ntfs_log_error("attribute list\n"); return 1; } rec = find_first_attribute(AT_FILE_NAME, ino->mrec); if (!rec) { - Eprintf("extend inode\n"); + ntfs_log_error("extend inode\n"); return 1; } name = (FILE_NAME_ATTR*) ((u8*)rec + rec->value_offset); if (ntfs_names_are_equal(ntldr, 5, name->file_name, name->file_name_length, IGNORE_CASE, ino->vol->upcase, ino->vol->upcase_len)) { - Eprintf("ntldr\n"); + ntfs_log_error("ntldr\n"); return 1; } @@ -503,7 +515,7 @@ static int bitmap_alloc(ntfs_volume *vol, runlist_element *rl) res = ntfs_bitmap_set_run(vol->lcnbmp_na, rl->lcn, rl->length); if (res < 0) { - Eprintf("bitmap alloc returns %d\n", res); + ntfs_log_error("bitmap alloc returns %d\n", res); } return res; @@ -521,7 +533,7 @@ static int bitmap_free(ntfs_volume *vol, runlist_element *rl) res = ntfs_bitmap_clear_run(vol->lcnbmp_na, rl->lcn, rl->length); if (res < 0) { - Eprintf("bitmap free returns %d\n", res); + ntfs_log_error("bitmap free returns %d\n", res); } return res; @@ -541,26 +553,28 @@ static int data_copy(ntfs_volume *vol, runlist_element *from, runlist_element *t if ((from->length != to->length) || (from->lcn < 0) || (to->lcn < 0)) return -1; - //printf("data_copy: from 0x%llx to 0x%llx\n", from->lcn, to->lcn); + //ntfs_log_info("data_copy: from 0x%llx to 0x%llx\n", from->lcn, to->lcn); buffer = malloc(vol->cluster_size); if (!buffer) { - printf("!buffer\n"); + ntfs_log_info("!buffer\n"); return -1; } for (i = 0; i < from->length; i++) { - //printf("read cluster at %8lld\n", from->lcn+i); - res = ntfs_pread(vol->dev, (from->lcn+i) * vol->cluster_size, vol->cluster_size, buffer); + //ntfs_log_info("read cluster at %8lld\n", from->lcn+i); + res = ntfs_pread(vol->dev, (from->lcn+i) * vol->cluster_size, + vol->cluster_size, buffer); if (res != vol->cluster_size) { - Eprintf("!read\n"); + ntfs_log_error("!read\n"); res = -1; break; } - //printf("write cluster to %8lld\n", to->lcn+i); - res = ntfs_pwrite(vol->dev, (to->lcn+i) * vol->cluster_size, vol->cluster_size, buffer); + //ntfs_log_info("write cluster to %8lld\n", to->lcn+i); + res = ntfs_pwrite(vol->dev, (to->lcn+i) * vol->cluster_size, + vol->cluster_size, buffer); if (res != vol->cluster_size) { - Eprintf("!write %lld\n", res); + ntfs_log_error("!write %lld\n", res); res = -1; break; } @@ -589,41 +603,41 @@ static s64 move_runlist(ntfs_volume *vol, runlist_element *from, if (!vol || !from || !to) return -1; if (from->length != to->length) { - Eprintf("diffsizes\n"); + ntfs_log_error("diffsizes\n"); return -1; } if ((from->lcn < 0) || (to->lcn < 0)) { - Eprintf("invalid runs\n"); + ntfs_log_error("invalid runs\n"); return -1; } for (i = 0; i < from->length; i++) { if (!utils_cluster_in_use(vol, from->lcn+i)) { - Eprintf("from not in use\n"); + ntfs_log_error("from not in use\n"); return -1; } } for (i = 0; i < to->length; i++) { if (utils_cluster_in_use(vol, to->lcn+i)) { - Eprintf("to is in use\n"); + ntfs_log_error("to is in use\n"); return -1; } } if (bitmap_alloc(vol, to) < 0) { - Eprintf("cannot bitmap_alloc\n"); + ntfs_log_error("cannot bitmap_alloc\n"); return -1; } if (data_copy(vol, from, to) < 0) { - Eprintf("cannot data_copy\n"); + ntfs_log_error("cannot data_copy\n"); return -1; } if (bitmap_free(vol, from) < 0) { - Eprintf("cannot bitmap_free\n"); + ntfs_log_error("cannot bitmap_free\n"); return -1; } @@ -660,7 +674,7 @@ static s64 move_datarun(ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, // find empty space to = find_unused(vol, run->length, loc, flags); if (!to) { - Eprintf("!to\n"); + ntfs_log_error("!to\n"); return -1; } @@ -669,14 +683,15 @@ static s64 move_datarun(ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, // copy original runlist from = ntfs_mapping_pairs_decompress(vol, rec, NULL); if (!from) { - printf("!from\n"); + ntfs_log_info("!from\n"); return -1; } - printf("move %lld,%lld,%lld to %lld,%lld,%lld\n", run->vcn, run->lcn, run->length, to->vcn, to->lcn, to->length); + ntfs_log_info("move %lld,%lld,%lld to %lld,%lld,%lld\n", run->vcn, + run->lcn, run->length, to->vcn, to->lcn, to->length); need_from = ntfs_get_size_for_mapping_pairs(vol, from, 0); - printf("orig data run = %d bytes\n", need_from); + ntfs_log_info("orig data run = %d bytes\n", need_from); //ntfs_debug_runlist_dump2(from, 5, "\t"); @@ -690,23 +705,23 @@ static s64 move_datarun(ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, //ntfs_debug_runlist_dump2(from, 5, "\t"); need_to = ntfs_get_size_for_mapping_pairs(vol, from, 0); - printf("new data run = %d bytes\n", need_to); + ntfs_log_info("new data run = %d bytes\n", need_to); need_from = calc_attr_length(rec, need_from); need_to = calc_attr_length(rec, need_to); - printf("Before %d, after %d\n", need_from, need_to); + ntfs_log_info("Before %d, after %d\n", need_from, need_to); if (need_from != need_to) { if (resize_nonres_attr(ino->mrec, rec, need_to) < 0) { - printf("!resize\n"); + ntfs_log_info("!resize\n"); return -1; } } res = move_runlist(vol, run, to); if (res < 0) { - Eprintf("!move_runlist\n"); + ntfs_log_error("!move_runlist\n"); return -1; } @@ -721,7 +736,7 @@ static s64 move_datarun(ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, ntfs_inode_mark_dirty(ino); if (ntfs_inode_sync(ino) < 0) { - printf("!sync\n"); + ntfs_log_info("!sync\n"); return -1; } @@ -750,22 +765,22 @@ static s64 move_attribute(ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec, runs = ntfs_mapping_pairs_decompress(vol, rec, NULL); if (!runs) { - Eprintf("!runs\n"); + ntfs_log_error("!runs\n"); return -1; } //ntfs_debug_runlist_dump2(runs, 5, "\t"); - //printf(" VCN LCN Length\n"); + //ntfs_log_info(" VCN LCN Length\n"); for (i = 0; runs[i].length > 0; i++) { if (runs[i].lcn == LCN_RL_NOT_MAPPED) { continue; } res = move_datarun(vol, ino, rec, runs+i, loc, flags); - //printf(" %8lld %8lld %8lld\n", runs[i].vcn, runs[i].lcn, runs[i].length); + //ntfs_log_info(" %8lld %8lld %8lld\n", runs[i].vcn, runs[i].lcn, runs[i].length); if (res < 0) { - Eprintf("!move_datarun\n"); + ntfs_log_error("!move_datarun\n"); count = res; break; } @@ -791,18 +806,18 @@ static s64 move_file(ntfs_volume *vol, ntfs_inode *ino, u64 loc, int flags) buffer = malloc(MAX_PATH); if (!buffer) { - Eprintf("Out of memory\n"); + ntfs_log_error("Out of memory\n"); return -1; } utils_inode_get_name(ino, buffer, MAX_PATH); if (dont_move(ino)) { - Eprintf("can't move\n"); + ntfs_log_error("can't move\n"); return -1; } - printf("Moving %s\n", buffer); + ntfs_log_info("Moving %s\n", buffer); // NTFS_MOVE_LOC_BEST : assess how much space all the attributes will need, // find that space and pass the location to our children. @@ -812,10 +827,10 @@ static s64 move_file(ntfs_volume *vol, ntfs_inode *ino, u64 loc, int flags) while ((rec = find_attribute(AT_UNUSED, ctx))) { utils_attr_get_name(vol, rec, buffer, MAX_PATH); - printf("\tAttribute 0x%02x %s is ", rec->type, buffer); + ntfs_log_info("\tAttribute 0x%02x %s is ", rec->type, buffer); if (rec->non_resident) { - printf("non-resident. Moving it.\n"); + ntfs_log_info("non-resident. Moving it.\n"); res = move_attribute(vol, ino, rec, loc, flags); if (res < 0) { @@ -824,7 +839,7 @@ static s64 move_file(ntfs_volume *vol, ntfs_inode *ino, u64 loc, int flags) } count += res; } else { - printf("resident.\n\t\tSkipping it.\n"); + ntfs_log_info("resident.\n\t\tSkipping it.\n"); } } @@ -850,6 +865,8 @@ int main(int argc, char *argv[]) int result = 1; s64 count; + ntfs_log_set_handler(ntfs_log_handler_outerr); + if (!parse_options(argc, argv)) return 1; @@ -860,13 +877,13 @@ int main(int argc, char *argv[]) vol = utils_mount_volume(opts.device, flags, opts.force); if (!vol) { - printf("!vol\n"); + ntfs_log_info("!vol\n"); return 1; } inode = ntfs_pathname_to_inode(vol, NULL, opts.file); if (!inode) { - printf("!inode\n"); + ntfs_log_info("!inode\n"); return 1; } @@ -874,17 +891,17 @@ int main(int argc, char *argv[]) if ((count > 0) && (!opts.nodirty)) { if (ntfs_volume_write_flags(vol, vol->flags | VOLUME_IS_DIRTY) < 0) { - Eprintf("Couldn't mark volume dirty\n"); + ntfs_log_error("Couldn't mark volume dirty\n"); } - printf("Relocated %lld bytes\n", count); + ntfs_log_info("Relocated %lld bytes\n", count); } if (count >= 0) result = 0; if (result) - printf("failed\n"); + ntfs_log_info("failed\n"); else - printf("success\n"); + ntfs_log_info("success\n"); ntfs_inode_close(inode); ntfs_umount(vol, FALSE); From a009bf0b5a59ce7106ca55cecb965d0b3f6aa95a Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 18:57:06 +0000 Subject: [PATCH 2668/2994] perror -> ntfs_log_perror --- ntfsprogs/ntfsinfo.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index c3cce857..8df79672 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -633,17 +633,17 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) l = ntfs_get_attribute_value_length(attr); if (!l) { - perror("ntfs_get_attribute_value_length failed"); + ntfs_log_perror("ntfs_get_attribute_value_length failed"); return; } value = malloc(l); if (!value) { - perror("malloc failed"); + ntfs_log_perror("malloc failed"); return; } l = ntfs_get_attribute_value(vol, attr, value); if (!l) { - perror("ntfs_get_attribute_value failed"); + ntfs_log_perror("ntfs_get_attribute_value failed"); free(value); return; } @@ -675,7 +675,7 @@ static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol) printf("%s\n", name); free(name); } else - perror("ntfs_ucstombs failed"); + ntfs_log_perror("ntfs_ucstombs failed"); } else printf("unnamed\n"); } @@ -886,7 +886,7 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v data_size = sle64_to_cpu(attr->data_size); sec_desc_attr = malloc(data_size); if (!sec_desc_attr) { - perror("malloc failed"); + ntfs_log_perror("malloc failed"); free(rl); return; } @@ -1281,7 +1281,7 @@ static int get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, if (attr->name_length) { name = malloc(attr->name_length * sizeof(ntfschar)); if (!name) { - perror("malloc failed"); + ntfs_log_perror("malloc failed"); return -1; } memcpy(name, (u8 *)attr + attr->name_offset, @@ -1289,13 +1289,13 @@ static int get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, } ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) { - perror("ntfs_get_search_ctx failed"); + ntfs_log_perror("ntfs_get_search_ctx failed"); free(name); return -1; } if (ntfs_attr_lookup(AT_INDEX_ROOT, name, attr->name_length, 0, 0, NULL, 0, ctx)) { - perror("ntfs_attr_lookup failed"); + ntfs_log_perror("ntfs_attr_lookup failed"); ntfs_attr_put_search_ctx(ctx); free(name); return -1; @@ -1334,16 +1334,16 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) name = (ntfschar*)((u8*)attr + attr->name_offset); na = ntfs_attr_open(ni, AT_BITMAP, name, attr->name_length); if (!na) { - perror("ntfs_attr_open failed"); + ntfs_log_perror("ntfs_attr_open failed"); return; } bitmap = malloc(na->data_size); if (!bitmap) { - perror("malloc failed"); + ntfs_log_perror("malloc failed"); return; } if (ntfs_attr_pread(na, 0, na->data_size, bitmap) != na->data_size) { - perror("ntfs_attr_pread failed"); + ntfs_log_perror("ntfs_attr_pread failed"); free(bitmap); return; } @@ -1352,19 +1352,19 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, name, attr->name_length); if (!na) { - perror("ntfs_attr_open failed"); + ntfs_log_perror("ntfs_attr_open failed"); free(bitmap); return; } allocation = malloc(na->data_size); if (!allocation) { - perror("malloc failed"); + ntfs_log_perror("malloc failed"); free(bitmap); return; } if (ntfs_attr_pread(na, 0, na->data_size, allocation) != na->data_size) { - perror("ntfs_attr_pread failed"); + ntfs_log_perror("ntfs_attr_pread failed"); free(allocation); free(bitmap); return; @@ -1377,7 +1377,7 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) if (*byte & (1 << bit)) { if (ntfs_mst_post_read_fixup((NTFS_RECORD *) tmp_alloc, indx_record_size)) { - perror("Damaged INDX record"); + ntfs_log_perror("Damaged INDX record"); goto free; } entry = (INDEX_ENTRY *)((u8 *)tmp_alloc + le32_to_cpu( @@ -1552,13 +1552,13 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol) buf = malloc(data_size); if (!buf) { - perror("malloc failed"); + ntfs_log_perror("malloc failed"); free(rl); return; } bytes_read = ntfs_rl_pread(vol, rl, 0, data_size, buf); if (bytes_read != data_size) { - perror("ntfs_rl_pread failed"); + ntfs_log_perror("ntfs_rl_pread failed"); free(buf); free(rl); return; @@ -1566,7 +1566,7 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol) free(rl); ea = (EA_ATTR*)buf; } else { - perror("ntfs_mapping_pairs_decompress failed"); + ntfs_log_perror("ntfs_mapping_pairs_decompress failed"); return; } } else { From aa3807bc27b4e62d5d002517d7719de02b7ee857 Mon Sep 17 00:00:00 2001 From: flatcap Date: Fri, 28 Oct 2005 18:59:29 +0000 Subject: [PATCH 2669/2994] upgrade to use new logging (all logging to stderr) --- ntfsprogs/ntfscat.c | 67 ++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index 1b99f30d..ce59a268 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -50,11 +50,6 @@ static const char *EXEC_NAME = "ntfscat"; static struct options opts; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stderr, &opts.verbose, TRUE) -GEN_PRINTF(Qprintf, stderr, &opts.quiet, FALSE) -static GEN_PRINTF(Printf, stderr, NULL, FALSE) - /** * version - Print version information about the program * @@ -64,11 +59,11 @@ static GEN_PRINTF(Printf, stderr, NULL, FALSE) */ static void version(void) { - Printf("\n%s v%s (libntfs %s) - Concatenate files and print on the " + ntfs_log_info("\n%s v%s (libntfs %s) - Concatenate files and print on the " "standard output.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - Printf("Copyright (c) 2003 Richard Russon\n"); - Printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + ntfs_log_info("Copyright (c) 2003 Richard Russon\n"); + ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -80,7 +75,7 @@ static void version(void) */ static void usage(void) { - Printf("\nUsage: %s [options] device [file]\n\n" + ntfs_log_info("\nUsage: %s [options] device [file]\n\n" " -a, --attribute type Display this attribute type\n" " -n, --attribute-name name Display this attribute name\n" " -i, --inode num Display this inode\n\n" @@ -91,7 +86,7 @@ static void usage(void) " -v --verbose More output\n\n", //" -r --raw Display the compressed or encrypted file", EXEC_NAME); - Printf("%s%s\n", ntfs_bugs, ntfs_home); + ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -176,6 +171,7 @@ static int parse_options(int argc, char **argv) int err = 0; int ver = 0; int help = 0; + int levels = 0; ATTR_TYPES attr = AT_UNUSED; opterr = 0; /* We'll handle the errors, thank you. */ @@ -193,18 +189,18 @@ static int parse_options(int argc, char **argv) } else if (!opts.file) { opts.file = argv[optind-1]; } else { - Eprintf("You must specify exactly one file.\n"); + ntfs_log_error("You must specify exactly one file.\n"); err++; } break; case 'a': if (opts.attr != (ATTR_TYPES)-1) { - Eprintf("You must specify exactly one attribute.\n"); + ntfs_log_error("You must specify exactly one attribute.\n"); } else if (parse_attribute(optarg, &attr) > 0) { opts.attr = attr; break; } else { - Eprintf("Couldn't parse attribute.\n"); + ntfs_log_error("Couldn't parse attribute.\n"); } err++; break; @@ -213,15 +209,20 @@ static int parse_options(int argc, char **argv) break; case 'h': case '?': + if (strncmp (argv[optind-1], "--log-", 6) == 0) { + if (!ntfs_log_parse_option (argv[optind-1])) + err++; + break; + } help++; break; case 'i': if (opts.inode != -1) - Eprintf("You must specify exactly one inode.\n"); + ntfs_log_error("You must specify exactly one inode.\n"); else if (utils_parse_size(optarg, &opts.inode, FALSE)) break; else - Eprintf("Couldn't parse inode number.\n"); + ntfs_log_error("Couldn't parse inode number.\n"); err++; break; @@ -229,46 +230,54 @@ static int parse_options(int argc, char **argv) opts.attr_name_len = ntfs_mbstoucs(optarg, &opts.attr_name, 0); if (opts.attr_name_len < 0) { - Eprintf("Invalid attribute name '%s': %s\n", - optarg, strerror(errno)); + ntfs_log_perror("Invalid attribute name '%s'", optarg); usage(); } case 'q': opts.quiet++; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 'V': ver++; break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; default: - Eprintf("Unknown option '%s'.\n", argv[optind-1]); + ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); err++; break; } } + /* Make sure we're in sync with the log levels */ + levels = ntfs_log_get_levels(); + if (levels & NTFS_LOG_LEVEL_VERBOSE) + opts.verbose++; + if (!(levels & NTFS_LOG_LEVEL_QUIET)) + opts.quiet++; + if (help || ver) { opts.quiet = 0; } else { if (opts.device == NULL) { - Eprintf("You must specify a device.\n"); + ntfs_log_error("You must specify a device.\n"); err++; } else if (opts.file == NULL && opts.inode == -1) { - Eprintf("You must specify a file or inode " + ntfs_log_error("You must specify a file or inode " "with the -i option.\n"); err++; } else if (opts.file != NULL && opts.inode != -1) { - Eprintf("You can't specify both a file and inode.\n"); + ntfs_log_error("You can't specify both a file and inode.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf("You may not use --quiet and --verbose at the " + ntfs_log_error("You may not use --quiet and --verbose at the " "same time.\n"); err++; } @@ -324,7 +333,7 @@ static int cat(ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, attr = ntfs_attr_open(inode, type, name, namelen); if (!attr) { - Eprintf("Cannot find attribute type 0x%lx.\n", (long) type); + ntfs_log_error("Cannot find attribute type 0x%lx.\n", (long) type); free(buffer); return 1; } @@ -345,9 +354,9 @@ static int cat(ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, } else { bytes_read = ntfs_attr_pread(attr, offset, bufsize, buffer); } - //fprintf(stderr, "read %lld bytes\n", bytes_read); + //ntfs_log_info("read %lld bytes\n", bytes_read); if (bytes_read == -1) { - perror("ERROR: Couldn't read file"); + ntfs_log_perror("ERROR: Couldn't read file"); break; } if (!bytes_read) @@ -355,7 +364,7 @@ static int cat(ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type, written = fwrite(buffer, 1, bytes_read, stdout); if (written != bytes_read) { - perror("ERROR: Couldn't output all data!"); + ntfs_log_perror("ERROR: Couldn't output all data!"); break; } offset += bytes_read; @@ -381,6 +390,8 @@ int main(int argc, char *argv[]) ATTR_TYPES attr; int result = 1; + ntfs_log_set_handler(ntfs_log_handler_stderr); + if (!parse_options(argc, argv)) return 1; @@ -388,7 +399,7 @@ int main(int argc, char *argv[]) vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); if (!vol) { - perror("ERROR: couldn't mount volume"); + ntfs_log_perror("ERROR: couldn't mount volume"); return 1; } @@ -398,7 +409,7 @@ int main(int argc, char *argv[]) inode = ntfs_pathname_to_inode(vol, NULL, opts.file); if (!inode) { - perror("ERROR: Couldn't open inode"); + ntfs_log_perror("ERROR: Couldn't open inode"); return 1; } From 9d9272273785f9eea4e5219d94cf693f50572c76 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 28 Oct 2005 19:00:14 +0000 Subject: [PATCH 2670/2994] Rest fixes from A Costa --- ntfsprogs/ntfscp.8.in | 4 ++-- ntfsprogs/ntfsundelete.8.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in index ac64c207..c5cfa393 100644 --- a/ntfsprogs/ntfscp.8.in +++ b/ntfsprogs/ntfscp.8.in @@ -65,7 +65,7 @@ Suppress some debug/warning/error messages. Show the version number, copyright and license .BR ntfscp . .TP -.B \-v, \-\-vebose +.B \-v, \-\-verbose Display more debug/warning/error messages. .SH DATA STREAMS All data on NTFS is stored in streams, which can have names. A file can have more than one data streams, but exactly one must have no name. The size of a file is the size of its unnamed data stream. Usually when you don't specify stream name you are access to unnamed data stream. If you want access to named data stream you need to add ":stream_name" to the filename. For example: by opening "some.mp3:artist" you will open stream "artist" in "some.mp3". But windows usually prevent you from accessing to named data streams, so you need to use some program like FAR or utils from cygwin to access named data streams. @@ -91,7 +91,7 @@ was written by Yura Pakhuchiy. .B ntfscp and this manual page is based on .B ntfscat -and it's manaul page by Richard Russon, so many thanks to him. Information about named data streams was partly taken from +and its manual page by Richard Russon, so many thanks to him. Information about named data streams was partly taken from .B ntfsdoc. .SH DEDICATION With love to Marina Sapego. diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index 3dac76a3..a90c327a 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -78,7 +78,7 @@ display as being 0% recoverable. To recover a file .B ntfsundelete has to read the file's metadata. Unfortunately, this isn't always intact. -When a file is deleted, the metadata can be left in an inconsistant state. e.g. +When a file is deleted, the metadata can be left in an inconsistent state. e.g. the file size may be zero; the dates of the file may be set to the time it was deleted, or random. .br @@ -116,7 +116,7 @@ filled with this byte. The default is zeros. .B \-\-case When scanning an NTFS volume, any filename matching (using the .B \-\-match -option) is case\-insensitive. This option makes the maching case\-sensitive. +option) is case\-insensitive. This option makes the matching case\-sensitive. .TP .BI "\-c " range .br From 4e6dd9b97b73b5e8c327ecd19c64ad01e028b0cb Mon Sep 17 00:00:00 2001 From: flatcap Date: Sat, 29 Oct 2005 00:08:43 +0000 Subject: [PATCH 2671/2994] upgrade to use new logging change stderror messages to ntfs_log_perror --- ntfsprogs/cluster.c | 19 +++---- ntfsprogs/ntfscluster.c | 116 ++++++++++++++++++++++------------------ ntfsprogs/ntfslabel.c | 68 +++++++++++++---------- ntfsprogs/ntfsls.c | 42 ++++++++++----- 4 files changed, 144 insertions(+), 101 deletions(-) diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c index 288f74f6..96a4ad09 100644 --- a/ntfsprogs/cluster.c +++ b/ntfsprogs/cluster.c @@ -35,6 +35,7 @@ #include "cluster.h" #include "utils.h" +#include "logging.h" /** * cluster_find @@ -63,9 +64,9 @@ int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void if (!in_use) { if (c_begin == c_end) - Vprintf("cluster isn't in use\n"); + ntfs_log_verbose("cluster isn't in use\n"); else - Vprintf("clusters aren't in use\n"); + ntfs_log_verbose("clusters aren't in use\n"); return 0; } @@ -73,13 +74,13 @@ int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void m_ctx->flags_search = FEMR_IN_USE | FEMR_BASE_RECORD; while (mft_next_record(m_ctx) == 0) { - Qprintf("Inode: %llu\n", (unsigned long long) + ntfs_log_quiet("Inode: %llu\n", (unsigned long long) m_ctx->inode->mft_no); if (!(m_ctx->flags_match & FEMR_BASE_RECORD)) continue; - Vprintf("Inode: %llu\n", (unsigned long long) + ntfs_log_verbose("Inode: %llu\n", (unsigned long long) m_ctx->inode->mft_no); a_ctx = ntfs_attr_get_search_ctx(m_ctx->inode, NULL); @@ -87,19 +88,19 @@ int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void while ((rec = find_attribute(AT_UNUSED, a_ctx))) { if (!rec->non_resident) { - Vprintf("0x%02x skipped - attr is resident\n", a_ctx->attr->type); + ntfs_log_verbose("0x%02x skipped - attr is resident\n", a_ctx->attr->type); continue; } runs = ntfs_mapping_pairs_decompress(vol, a_ctx->attr, NULL); if (!runs) { - Eprintf("Couldn't read the data runs.\n"); + ntfs_log_error("Couldn't read the data runs.\n"); goto done; } - Vprintf("\t[0x%02X]\n", a_ctx->attr->type); + ntfs_log_verbose("\t[0x%02X]\n", a_ctx->attr->type); - Vprintf("\t\tVCN\tLCN\tLength\n"); + ntfs_log_verbose("\t\tVCN\tLCN\tLength\n"); for (j = 0; runs[j].length > 0; j++) { LCN a_begin = runs[j].lcn; LCN a_end = a_begin + runs[j].length - 1; @@ -107,7 +108,7 @@ int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void if (a_begin < 0) continue; // sparse, discontiguous, etc - Vprintf("\t\t%lld\t%lld-%lld (%lld)\n", + ntfs_log_verbose("\t\t%lld\t%lld-%lld (%lld)\n", (long long)runs[j].vcn, (long long)runs[j].lcn, (long long)(runs[j].lcn + diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 95301172..28ebe8e6 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -49,14 +49,11 @@ #include "dir.h" #include "cluster.h" #include "version.h" +#include "logging.h" static const char *EXEC_NAME = "ntfscluster"; static struct options opts; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) - /** * version - Print version information about the program * @@ -66,11 +63,11 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) */ static void version(void) { - printf("\n%s v%s (libntfs %s) - Find the owner of any given sector or " + ntfs_log_info("\n%s v%s (libntfs %s) - Find the owner of any given sector or " "cluster.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf("Copyright (c) 2002-2003 Richard Russon\n"); - printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + ntfs_log_info("Copyright (c) 2002-2003 Richard Russon\n"); + ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -82,7 +79,7 @@ static void version(void) */ static void usage(void) { - printf("\nUsage: %s [options] device\n" + ntfs_log_info("\nUsage: %s [options] device\n" " -i --info Print information about the volume (default)\n" "\n" " -c range --cluster range Look for objects in this range of clusters\n" @@ -97,7 +94,7 @@ static void usage(void) " -V --version Version information\n" " -h --help Print this help\n\n", EXEC_NAME); - printf("%s%s\n", ntfs_bugs, ntfs_home); + ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -131,6 +128,7 @@ static int parse_options(int argc, char **argv) int err = 0; int ver = 0; int help = 0; + int levels = 0; char *end = NULL; opterr = 0; /* We'll handle the errors, thank you. */ @@ -170,6 +168,11 @@ static int parse_options(int argc, char **argv) break; case 'h': case '?': + if (strncmp (argv[optind-1], "--log-", 6) == 0) { + if (!ntfs_log_parse_option (argv[optind-1])) + err++; + break; + } help++; break; case 'I': @@ -196,6 +199,7 @@ static int parse_options(int argc, char **argv) break; case 'q': opts.quiet++; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 's': if ((opts.action == act_none) && @@ -206,20 +210,28 @@ static int parse_options(int argc, char **argv) break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; case 'V': ver++; break; default: if ((optopt == 'c') || (optopt == 's')) - Eprintf("Option '%s' requires an argument.\n", argv[optind-1]); + ntfs_log_error("Option '%s' requires an argument.\n", argv[optind-1]); else - Eprintf("Unknown option '%s'.\n", argv[optind-1]); + ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); err++; break; } } + /* Make sure we're in sync with the log levels */ + levels = ntfs_log_get_levels(); + if (levels & NTFS_LOG_LEVEL_VERBOSE) + opts.verbose++; + if (!(levels & NTFS_LOG_LEVEL_QUIET)) + opts.quiet++; + if (help || ver) { opts.quiet = 0; } else { @@ -230,20 +242,20 @@ static int parse_options(int argc, char **argv) if (opts.device == NULL) { if (argc > 1) - Eprintf("You must specify exactly one device.\n"); + ntfs_log_error("You must specify exactly one device.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf("You may not use --quiet and --verbose at the same time.\n"); + ntfs_log_error("You may not use --quiet and --verbose at the same time.\n"); err++; } if (opts.action == act_error) { - Eprintf("You may only specify one action: --info, --cluster, --sector or --last.\n"); + ntfs_log_error("You may only specify one action: --info, --cluster, --sector or --last.\n"); err++; } else if (opts.range_begin > opts.range_end) { - Eprintf("The range must be in ascending order.\n"); + ntfs_log_error("The range must be in ascending order.\n"); err++; } } @@ -340,27 +352,27 @@ static int info(ntfs_volume *vol) t = mc >> cb; u = mc * 100 / b / e; - printf("bytes per sector : %llu\n", (unsigned long long)a); - printf("bytes per cluster : %llu\n", (unsigned long long)b); - printf("sectors per cluster : %llu\n", (unsigned long long)c); - printf("bytes per volume : %llu\n", (unsigned long long)d); - printf("sectors per volume : %llu\n", (unsigned long long)e); - printf("clusters per volume : %llu\n", (unsigned long long)f); - printf("initialized mft records : %llu\n", (unsigned long long)g); - printf("mft records in use : %llu\n", (unsigned long long)h); - printf("mft records percentage : %llu\n", (unsigned long long)i); - printf("bytes of free space : %llu\n", (unsigned long long)j); - printf("sectors of free space : %llu\n", (unsigned long long)k); - printf("clusters of free space : %llu\n", (unsigned long long)l); - printf("percentage free space : %llu\n", (unsigned long long)m); - printf("bytes of user data : %llu\n", (unsigned long long)n); - printf("sectors of user data : %llu\n", (unsigned long long)o); - printf("clusters of user data : %llu\n", (unsigned long long)p); - printf("percentage user data : %llu\n", (unsigned long long)q); - printf("bytes of metadata : %llu\n", (unsigned long long)r); - printf("sectors of metadata : %llu\n", (unsigned long long)s); - printf("clusters of metadata : %llu\n", (unsigned long long)t); - printf("percentage metadata : %llu\n", (unsigned long long)u); + ntfs_log_info("bytes per sector : %llu\n", (unsigned long long)a); + ntfs_log_info("bytes per cluster : %llu\n", (unsigned long long)b); + ntfs_log_info("sectors per cluster : %llu\n", (unsigned long long)c); + ntfs_log_info("bytes per volume : %llu\n", (unsigned long long)d); + ntfs_log_info("sectors per volume : %llu\n", (unsigned long long)e); + ntfs_log_info("clusters per volume : %llu\n", (unsigned long long)f); + ntfs_log_info("initialized mft records : %llu\n", (unsigned long long)g); + ntfs_log_info("mft records in use : %llu\n", (unsigned long long)h); + ntfs_log_info("mft records percentage : %llu\n", (unsigned long long)i); + ntfs_log_info("bytes of free space : %llu\n", (unsigned long long)j); + ntfs_log_info("sectors of free space : %llu\n", (unsigned long long)k); + ntfs_log_info("clusters of free space : %llu\n", (unsigned long long)l); + ntfs_log_info("percentage free space : %llu\n", (unsigned long long)m); + ntfs_log_info("bytes of user data : %llu\n", (unsigned long long)n); + ntfs_log_info("sectors of user data : %llu\n", (unsigned long long)o); + ntfs_log_info("clusters of user data : %llu\n", (unsigned long long)p); + ntfs_log_info("percentage user data : %llu\n", (unsigned long long)q); + ntfs_log_info("bytes of metadata : %llu\n", (unsigned long long)r); + ntfs_log_info("sectors of metadata : %llu\n", (unsigned long long)s); + ntfs_log_info("clusters of metadata : %llu\n", (unsigned long long)t); + ntfs_log_info("percentage metadata : %llu\n", (unsigned long long)u); return 0; } @@ -378,19 +390,19 @@ static int dump_file(ntfs_volume *vol, ntfs_inode *ino) utils_inode_get_name(ino, buffer, sizeof(buffer)); - printf("Dump: %s\n", buffer); + ntfs_log_info("Dump: %s\n", buffer); ctx = ntfs_attr_get_search_ctx(ino, NULL); while ((rec = find_attribute(AT_UNUSED, ctx))) { - printf(" 0x%02x - ", rec->type); + ntfs_log_info(" 0x%02x - ", rec->type); if (rec->non_resident) { - printf("non-resident\n"); + ntfs_log_info("non-resident\n"); runs = ntfs_mapping_pairs_decompress(vol, rec, NULL); if (runs) { - printf(" VCN LCN Length\n"); + ntfs_log_info(" VCN LCN Length\n"); for (i = 0; runs[i].length > 0; i++) { - printf(" %8lld %8lld %8lld\n", + ntfs_log_info(" %8lld %8lld %8lld\n", (long long)runs[i].vcn, (long long)runs[i].lcn, (long long) @@ -399,7 +411,7 @@ static int dump_file(ntfs_volume *vol, ntfs_inode *ino) free(runs); } } else { - printf("resident\n"); + ntfs_log_info("resident\n"); } } @@ -420,15 +432,15 @@ static int print_match(ntfs_inode *ino, ATTR_RECORD *attr, buffer = malloc(MAX_PATH); if (!buffer) { - Eprintf("!buffer\n"); + ntfs_log_error("!buffer\n"); return 1; } utils_inode_get_name(ino, buffer, MAX_PATH); - printf("Inode %llu %s", (unsigned long long)ino->mft_no, buffer); + ntfs_log_info("Inode %llu %s", (unsigned long long)ino->mft_no, buffer); utils_attr_get_name(ino->vol, attr, buffer, MAX_PATH); - printf("/%s\n", buffer); + ntfs_log_info("/%s\n", buffer); free(buffer); return 0; @@ -470,6 +482,8 @@ int main(int argc, char *argv[]) struct match m; int result = 1; + ntfs_log_set_handler(ntfs_log_handler_outerr); + if (!parse_options(argc, argv)) return 1; @@ -482,10 +496,10 @@ int main(int argc, char *argv[]) switch (opts.action) { case act_sector: if (opts.range_begin == opts.range_end) - Qprintf("Searching for sector %llu\n", + ntfs_log_quiet("Searching for sector %llu\n", (unsigned long long)opts.range_begin); else - Qprintf("Searching for sector range %llu-%llu\n", (unsigned long long)opts.range_begin, (unsigned long long)opts.range_end); + ntfs_log_quiet("Searching for sector range %llu-%llu\n", (unsigned long long)opts.range_begin, (unsigned long long)opts.range_end); /* Convert to clusters */ opts.range_begin >>= (vol->cluster_size_bits - vol->sector_size_bits); opts.range_end >>= (vol->cluster_size_bits - vol->sector_size_bits); @@ -493,10 +507,10 @@ int main(int argc, char *argv[]) break; case act_cluster: if (opts.range_begin == opts.range_end) - Qprintf("Searching for cluster %llu\n", + ntfs_log_quiet("Searching for cluster %llu\n", (unsigned long long)opts.range_begin); else - Qprintf("Searching for cluster range %llu-%llu\n", (unsigned long long)opts.range_begin, (unsigned long long)opts.range_end); + ntfs_log_quiet("Searching for cluster range %llu-%llu\n", (unsigned long long)opts.range_begin, (unsigned long long)opts.range_end); result = cluster_find(vol, opts.range_begin, opts.range_end, (cluster_cb*)&print_match, NULL); break; case act_file: @@ -510,7 +524,7 @@ int main(int argc, char *argv[]) result = dump_file(vol, ino); ntfs_inode_close(ino); } else { - Eprintf("Cannot open inode %llu\n", + ntfs_log_error("Cannot open inode %llu\n", (unsigned long long)opts.inode); } break; @@ -524,7 +538,7 @@ int main(int argc, char *argv[]) result = dump_file(vol, ino); ntfs_inode_close(ino); } else { - Eprintf("Cannot open inode %llu\n", + ntfs_log_error("Cannot open inode %llu\n", (unsigned long long) opts.inode); } diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 8067605d..72bfdfa1 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -48,6 +48,7 @@ #include "mft.h" #include "utils.h" #include "version.h" +#include "logging.h" static const char *EXEC_NAME = "ntfslabel"; @@ -60,10 +61,6 @@ static struct options { int noaction; /* Do not write to disk */ } opts; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) - /** * version - Print version information about the program * @@ -73,14 +70,14 @@ GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) */ static void version(void) { - printf("\n%s v%s (libntfs %s) - Display, or set, the label for an " + ntfs_log_info("\n%s v%s (libntfs %s) - Display, or set, the label for an " "NTFS Volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf("Copyright (c)\n"); - printf(" 2002 Matthew J. Fanto\n"); - printf(" 2002-2005 Anton Altaparmakov\n"); - printf(" 2002-2003 Richard Russon\n"); - printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + ntfs_log_info("Copyright (c)\n"); + ntfs_log_info(" 2002 Matthew J. Fanto\n"); + ntfs_log_info(" 2002-2005 Anton Altaparmakov\n"); + ntfs_log_info(" 2002-2003 Richard Russon\n"); + ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -92,7 +89,7 @@ static void version(void) */ static void usage(void) { - printf("\nUsage: %s [options] device [label]\n" + ntfs_log_info("\nUsage: %s [options] device [label]\n" " -n --no-action Do not write to disk\n" " -f --force Use less caution\n" " -q --quiet Less output\n" @@ -100,7 +97,7 @@ static void usage(void) " -V --version Display version information\n" " -h --help Display this help\n\n", EXEC_NAME); - printf("%s%s\n", ntfs_bugs, ntfs_home); + ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -129,6 +126,7 @@ static int parse_options(int argc, char *argv[]) int err = 0; int ver = 0; int help = 0; + int levels = 0; opterr = 0; /* We'll handle the errors, thank you. */ @@ -147,6 +145,11 @@ static int parse_options(int argc, char *argv[]) break; case 'h': case '?': + if (strncmp (argv[optind-1], "--log-", 6) == 0) { + if (!ntfs_log_parse_option (argv[optind-1])) + err++; + break; + } help++; break; case 'n': @@ -154,31 +157,40 @@ static int parse_options(int argc, char *argv[]) break; case 'q': opts.quiet++; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; case 'V': ver++; break; default: - Eprintf("Unknown option '%s'.\n", argv[optind-1]); + ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); err++; break; } } + /* Make sure we're in sync with the log levels */ + levels = ntfs_log_get_levels(); + if (levels & NTFS_LOG_LEVEL_VERBOSE) + opts.verbose++; + if (!(levels & NTFS_LOG_LEVEL_QUIET)) + opts.quiet++; + if (help || ver) { opts.quiet = 0; } else { if (opts.device == NULL) { if (argc > 1) - Eprintf("You must specify a device.\n"); + ntfs_log_error("You must specify a device.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf("You may not use --quiet and --verbose at " + ntfs_log_error("You may not use --quiet and --verbose at " "the same time.\n"); err++; } @@ -199,7 +211,7 @@ static int parse_options(int argc, char *argv[]) * @mnt_flags: mount flags of the device or 0 if not mounted * @mnt_point: mount point of the device or NULL * - * Print the label of the device @dev to stdout. + * Print the label of the device @dev. */ static int print_label(ntfs_volume *vol, unsigned long mnt_flags) { @@ -207,12 +219,12 @@ static int print_label(ntfs_volume *vol, unsigned long mnt_flags) //XXX significant? if ((mnt_flags & (NTFS_MF_MOUNTED | NTFS_MF_READONLY)) == NTFS_MF_MOUNTED) { - Eprintf("%s is mounted read-write, results may be " + ntfs_log_error("%s is mounted read-write, results may be " "unreliable.\n", opts.device); result = 1; } - printf("%s\n", vol->vol_name); + ntfs_log_info("%s\n", vol->vol_name); return result; } @@ -274,7 +286,7 @@ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, if (!(mnt_flags & NTFS_MF_ISROOT) || !(mnt_flags & NTFS_MF_READONLY)) { if (!force) { - fprintf(stderr, "Refusing to change label on " + ntfs_log_error("Refusing to change label on " "read-%s mounted device %s.\n", mnt_flags & NTFS_MF_READONLY ? "only" : "write", opts.device); @@ -284,13 +296,13 @@ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, } ctx = ntfs_attr_get_search_ctx(vol->vol_ni, NULL); if (!ctx) { - perror("Failed to get attribute search context"); + ntfs_log_perror("Failed to get attribute search context"); goto err_out; } if (ntfs_attr_lookup(AT_VOLUME_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { if (errno != ENOENT) { - perror("Lookup of $VOLUME_NAME attribute failed"); + ntfs_log_perror("Lookup of $VOLUME_NAME attribute failed"); goto err_out; } /* The volume name attribute does not exist. Need to add it. */ @@ -298,19 +310,19 @@ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, } else { a = ctx->attr; if (a->non_resident) { - fprintf(stderr, "Error: Attribute $VOLUME_NAME must be " + ntfs_log_error("Error: Attribute $VOLUME_NAME must be " "resident.\n"); goto err_out; } } label_len = ntfs_mbstoucs(label, &new_label, 0); if (label_len == -1) { - perror("Unable to convert label string to Unicode"); + ntfs_log_perror("Unable to convert label string to Unicode"); goto err_out; } label_len *= sizeof(ntfschar); if (label_len > 0x100) { - fprintf(stderr, "New label is too long. Maximum %u characters " + ntfs_log_error("New label is too long. Maximum %u characters " "allowed. Truncating excess characters.\n", (unsigned)(0x100 / sizeof(ntfschar))); label_len = 0x100; @@ -318,7 +330,7 @@ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, } if (a) { if (resize_resident_attribute_value(ctx->mrec, a, label_len)) { - perror("Error resizing resident attribute"); + ntfs_log_perror("Error resizing resident attribute"); goto err_out; } } else { @@ -327,7 +339,7 @@ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, u32 biu = le32_to_cpu(ctx->mrec->bytes_in_use); if (biu + asize > le32_to_cpu(ctx->mrec->bytes_allocated)) { errno = ENOSPC; - perror("Error adding resident attribute"); + ntfs_log_perror("Error adding resident attribute"); goto err_out; } a = ctx->attr; @@ -349,7 +361,7 @@ static int change_label(ntfs_volume *vol, unsigned long mnt_flags, char *label, } memcpy((u8*)a + le16_to_cpu(a->value_offset), new_label, label_len); if (!opts.noaction && ntfs_inode_sync(vol->vol_ni)) { - perror("Error writing MFT Record to disk"); + ntfs_log_perror("Error writing MFT Record to disk"); goto err_out; } result = 0; @@ -372,6 +384,8 @@ int main(int argc, char **argv) int result = 0; ntfs_volume *vol; + ntfs_log_set_handler(ntfs_log_handler_outerr); + if (!parse_options(argc, argv)) return 1; diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 08a4d53b..211467ea 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -52,6 +52,7 @@ #include "list.h" #include "ntfstime.h" #include "version.h" +#include "logging.h" static const char *EXEC_NAME = "ntfsls"; @@ -123,9 +124,10 @@ typedef struct { ntfs_volume *vol; } ntfsls_dirent; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) -GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) +static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, + const int name_len, const int name_type, + const s64 pos, const MFT_REF mref, + const unsigned dt_type); /** * version - Print version information about the program @@ -212,6 +214,7 @@ static int parse_options(int argc, char *argv[]) int err = 0; int ver = 0; int help = 0; + int levels = 0; opterr = 0; /* We'll handle the errors, thank you. */ @@ -235,13 +238,20 @@ static int parse_options(int argc, char *argv[]) break; case 'h': case '?': + if (strncmp (argv[optind-1], "--log-", 6) == 0) { + if (!ntfs_log_parse_option (argv[optind-1])) + err++; + break; + } help++; break; case 'q': opts.quiet++; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; case 'V': ver++; @@ -268,12 +278,19 @@ static int parse_options(int argc, char *argv[]) opts.recursive++; break; default: - Eprintf("Unknown option '%s'.\n", argv[optind - 1]); + ntfs_log_error("Unknown option '%s'.\n", argv[optind - 1]); err++; break; } } + /* Make sure we're in sync with the log levels */ + levels = ntfs_log_get_levels(); + if (levels & NTFS_LOG_LEVEL_VERBOSE) + opts.verbose++; + if (!(levels & NTFS_LOG_LEVEL_QUIET)) + opts.quiet++; + /* defaults to -a if -s is not specified */ if (!opts.system) opts.all++; @@ -283,13 +300,13 @@ static int parse_options(int argc, char *argv[]) else { if (opts.device == NULL) { if (argc > 1) - Eprintf("You must specify exactly one " + ntfs_log_error("You must specify exactly one " "device.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf("You may not use --quiet and --verbose at the " + ntfs_log_error("You may not use --quiet and --verbose at the " "same time.\n"); err++; } @@ -303,11 +320,6 @@ static int parse_options(int argc, char *argv[]) return (!err && !help && !ver); } -static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, - const int name_len, const int name_type, - const s64 pos, const MFT_REF mref, - const unsigned dt_type); - /** * free_dir - free one dir * @tofree: the dir to free @@ -422,7 +434,7 @@ static int readdir_recursive(ntfs_inode * ni, s64 * pos, ntfsls_dirent * dirent) subdir->name); if (!subdir->ni) { - Eprintf + ntfs_log_error ("ntfsls::readdir_recursive(): cannot get inode from pathname.\n"); result = -1; break; @@ -491,7 +503,7 @@ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, return -1; if (ntfs_ucstombs(name, name_len, &filename, MAX_PATH) < 0) { - Eprintf("Cannot represent filename in current locale.\n"); + ntfs_log_error("Cannot represent filename in current locale.\n"); goto free; } @@ -516,7 +528,7 @@ static int list_dir_entry(ntfsls_dirent * dirent, const ntfschar * name, dir = (struct dir *)calloc(1, sizeof(struct dir)); if (!dir) { - Eprintf("Failed to allocate for subdir.\n"); + ntfs_log_error("Failed to allocate for subdir.\n"); result = -1; goto free; } @@ -630,6 +642,8 @@ int main(int argc, char **argv) ntfs_inode *ni; ntfsls_dirent dirent; + ntfs_log_set_handler(ntfs_log_handler_outerr); + if (!parse_options(argc, argv)) { // FIXME: Print error... (AIA) return 1; From 2a8ae5c3fb621a205831406bb5667521a5e5fafc Mon Sep 17 00:00:00 2001 From: flatcap Date: Sat, 29 Oct 2005 01:05:11 +0000 Subject: [PATCH 2672/2994] upgrade to use new logging change stderror messages to ntfs_log_perror --- ntfsprogs/ntfscp.c | 102 ++++++++++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 44 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index d40e8417..043821a9 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -51,6 +51,7 @@ #include "dir.h" #include "debug.h" #include "version.h" +#include "logging.h" struct options { char *device; /* Device/File to work with */ @@ -69,11 +70,6 @@ static const char *EXEC_NAME = "ntfscp"; static struct options opts; volatile sig_atomic_t caught_terminate = 0; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stderr, &opts.verbose, TRUE) -GEN_PRINTF(Qprintf, stderr, &opts.quiet, FALSE) -static GEN_PRINTF(Printf, stderr, NULL, FALSE) - /** * version - Print version information about the program * @@ -83,10 +79,10 @@ static GEN_PRINTF(Printf, stderr, NULL, FALSE) */ static void version(void) { - Printf("\n%s v%s (libntfs %s) - Overwrite files on NTFS volume.\n\n", + ntfs_log_info("\n%s v%s (libntfs %s) - Overwrite files on NTFS volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - Printf("Copyright (c) 2004-2005 Yura Pakhuchiy\n"); - Printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + ntfs_log_info("Copyright (c) 2004-2005 Yura Pakhuchiy\n"); + ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -98,7 +94,7 @@ static void version(void) */ static void usage(void) { - Printf("\nUsage: %s [options] device src_file dest_file\n\n" + ntfs_log_info("\nUsage: %s [options] device src_file dest_file\n\n" " -a --attribute num Write to this attribute\n" " -i --inode Treat dest_file as inode number\n" " -f --force Use less caution\n" @@ -109,7 +105,7 @@ static void usage(void) " -V --version Version information\n" " -v --verbose More output\n\n", EXEC_NAME); - Printf("%s%s\n", ntfs_bugs, ntfs_home); + ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -142,6 +138,7 @@ static int parse_options(int argc, char **argv) int err = 0; int ver = 0; int help = 0; + int levels = 0; s64 attr; opts.device = NULL; @@ -163,20 +160,20 @@ static int parse_options(int argc, char **argv) } else if (!opts.dest_file) { opts.dest_file = argv[optind - 1]; } else { - Eprintf("You must specify exactly 2 files.\n"); + ntfs_log_error("You must specify exactly 2 files.\n"); err++; } break; case 'a': if (opts.attribute != AT_DATA) { - Eprintf("You can specify only 1 attribute.\n"); + ntfs_log_error("You can specify only 1 attribute.\n"); err++; break; } attr = strtol(optarg, &s, 0); if (*s) { - Eprintf("Couldn't parse attribute.\n"); + ntfs_log_error("Couldn't parse attribute.\n"); err++; } else opts.attribute = (ATTR_TYPES)attr; @@ -189,11 +186,16 @@ static int parse_options(int argc, char **argv) break; case 'h': case '?': + if (strncmp (argv[optind-1], "--log-", 6) == 0) { + if (!ntfs_log_parse_option (argv[optind-1])) + err++; + break; + } help++; break; case 'N': if (opts.attr_name) { - Eprintf("You can specify only one attribute " + ntfs_log_error("You can specify only one attribute " "name.\n"); err++; } else @@ -204,36 +206,45 @@ static int parse_options(int argc, char **argv) break; case 'q': opts.quiet++; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 'V': ver++; break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; default: - Eprintf("Unknown option '%s'.\n", argv[optind - 1]); + ntfs_log_error("Unknown option '%s'.\n", argv[optind - 1]); err++; break; } } + /* Make sure we're in sync with the log levels */ + levels = ntfs_log_get_levels(); + if (levels & NTFS_LOG_LEVEL_VERBOSE) + opts.verbose++; + if (!(levels & NTFS_LOG_LEVEL_QUIET)) + opts.quiet++; + if (help || ver) { opts.quiet = 0; } else { if (!opts.device) { - Eprintf("You must specify a device.\n"); + ntfs_log_error("You must specify a device.\n"); err++; } else if (!opts.src_file) { - Eprintf("You must specify a source file.\n"); + ntfs_log_error("You must specify a source file.\n"); err++; } else if (!opts.dest_file) { - Eprintf("You must specify a destination file.\n"); + ntfs_log_error("You must specify a destination file.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf("You may not use --quiet and --verbose at the " + ntfs_log_error("You may not use --quiet and --verbose at the " "same time.\n"); err++; } @@ -278,6 +289,8 @@ int main(int argc, char *argv[]) ntfschar *attr_name; int attr_name_len = 0; + ntfs_log_set_handler(ntfs_log_handler_stderr); + if (!parse_options(argc, argv)) return 1; @@ -285,12 +298,12 @@ int main(int argc, char *argv[]) /* Set SIGINT handler. */ if (signal(SIGINT, signal_handler) == SIG_ERR) { - perror("Failed to set SIGINT handler"); + ntfs_log_perror("Failed to set SIGINT handler"); return 1; } /* Set SIGTERM handler. */ if (signal(SIGTERM, signal_handler) == SIG_ERR) { - perror("Failed to set SIGTERM handler"); + ntfs_log_perror("Failed to set SIGTERM handler"); return 1; } @@ -299,7 +312,7 @@ int main(int argc, char *argv[]) vol = utils_mount_volume(opts.device, flags, opts.force); if (!vol) { - perror("ERROR: couldn't mount volume"); + ntfs_log_perror("ERROR: couldn't mount volume"); return 1; } @@ -309,16 +322,16 @@ int main(int argc, char *argv[]) { struct stat fst; if (stat(opts.src_file, &fst) == -1) { - perror("ERROR: Couldn't stat source file"); + ntfs_log_perror("ERROR: Couldn't stat source file"); goto umount; } new_size = fst.st_size; } - Vprintf("New file size: %lld\n", new_size); + ntfs_log_verbose("New file size: %lld\n", new_size); in = fopen(opts.src_file, "r"); if (!in) { - perror("ERROR: Couldn't open source file"); + ntfs_log_perror("ERROR: Couldn't open source file"); goto umount; } @@ -328,14 +341,14 @@ int main(int argc, char *argv[]) inode_num = strtoll(opts.dest_file, &s, 0); if (*s) { - Eprintf("ERROR: Couldn't parse inode number.\n"); + ntfs_log_error("ERROR: Couldn't parse inode number.\n"); goto close_src; } out = ntfs_inode_open(vol, inode_num); } else out = ntfs_pathname_to_inode(vol, NULL, opts.dest_file); if (!out) { - perror("ERROR: Couldn't open destination file"); + ntfs_log_perror("ERROR: Couldn't open destination file"); goto close_src; } if ((le16_to_cpu(out->mrec->flags) & MFT_RECORD_IS_DIRECTORY) && @@ -360,7 +373,7 @@ int main(int argc, char *argv[]) new_dest_file = malloc(strlen(opts.dest_file) + strlen(filename) + 2); if (!new_dest_file) { - perror("ERROR: malloc() failed"); + ntfs_log_perror("ERROR: malloc() failed"); goto close_dst; } strcpy(new_dest_file, opts.dest_file); @@ -370,7 +383,7 @@ int main(int argc, char *argv[]) out = ntfs_pathname_to_inode(vol, NULL, new_dest_file); free(new_dest_file); if (!out) { - perror("ERROR: Failed to open destination file"); + ntfs_log_perror("ERROR: Failed to open destination file"); goto close_src; } } @@ -379,7 +392,7 @@ int main(int argc, char *argv[]) attr_name = NULL; attr_name_len = ntfs_mbstoucs(opts.attr_name, &attr_name, 0); if (attr_name_len == -1) { - perror("ERROR: Failed to parse attribute name"); + ntfs_log_perror("ERROR: Failed to parse attribute name"); goto close_dst; } } else @@ -387,59 +400,59 @@ int main(int argc, char *argv[]) na = ntfs_attr_open(out, opts.attribute, attr_name, attr_name_len); if (!na) { if (errno != ENOENT) { - perror("ERROR: Couldn't open attribute"); + ntfs_log_perror("ERROR: Couldn't open attribute"); goto close_dst; } /* Requested attribute isn't present, add it. */ if (ntfs_attr_add(out, opts.attribute, attr_name, attr_name_len, NULL, 0)) { - perror("ERROR: Couldn't add attribute"); + ntfs_log_perror("ERROR: Couldn't add attribute"); goto close_dst; } na = ntfs_attr_open(out, opts.attribute, attr_name, attr_name_len); if (!na) { - perror("ERROR: Couldn't open just added attribute"); + ntfs_log_perror("ERROR: Couldn't open just added attribute"); goto close_dst; } } if (attr_name != AT_UNNAMED) free(attr_name); - Vprintf("Old file size: %lld\n", na->data_size); + ntfs_log_verbose("Old file size: %lld\n", na->data_size); if (na->data_size != new_size) { if (ntfs_attr_truncate(na, new_size)) { - perror("ERROR: Couldn't resize attribute"); + ntfs_log_perror("ERROR: Couldn't resize attribute"); goto close_attr; } } buf = malloc(NTFS_BUF_SIZE); if (!buf) { - perror("ERROR: malloc failed"); + ntfs_log_perror("ERROR: malloc failed"); goto close_attr; } - Vprintf("Starting write.\n"); + ntfs_log_verbose("Starting write.\n"); offset = 0; while (!feof(in)) { if (caught_terminate) { - printf("SIGTERM or SIGINT received. Aborting write.\n"); + ntfs_log_error("SIGTERM or SIGINT received. Aborting write.\n"); break; } br = fread(buf, 1, NTFS_BUF_SIZE, in); if (!br) { - if (!feof(in)) perror("ERROR: fread failed"); + if (!feof(in)) ntfs_log_perror("ERROR: fread failed"); break; } bw = ntfs_attr_pwrite(na, offset, br, buf); if (bw != br) { - perror("ERROR: ntfs_attr_pwrite failed"); + ntfs_log_perror("ERROR: ntfs_attr_pwrite failed"); break; } offset += bw; } - Vprintf("Syncing.\n"); + ntfs_log_verbose("Syncing.\n"); result = 0; free(buf); close_attr: @@ -447,16 +460,17 @@ close_attr: close_dst: while (ntfs_inode_close(out)) { if (errno != EBUSY) { - Eprintf("Sync failed. Run chkdsk.\n"); + ntfs_log_error("Sync failed. Run chkdsk.\n"); break; } - Eprintf("Device busy. Will retry sync after 3 seconds.\n"); + ntfs_log_error("Device busy. Will retry sync after 3 seconds.\n"); sleep(3); } close_src: fclose(in); umount: ntfs_umount(vol, FALSE); - Vprintf("Done.\n"); + ntfs_log_verbose("Done.\n"); return result; } + From 121d05deb6d53bedb948453b8eca622c6175d923 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 30 Oct 2005 16:12:22 +0000 Subject: [PATCH 2673/2994] add/update function comment blocks (ok, they need words, but it's a start) --- libntfs/attrib.c | 24 +++-- libntfs/bitmap.c | 74 +++++++++++-- libntfs/collate.c | 33 +++++- libntfs/compat.c | 11 +- libntfs/debug.c | 5 + libntfs/dir.c | 58 ++++++++-- libntfs/index.c | 59 +++++++++-- libntfs/inode.c | 45 ++++++-- libntfs/mft.c | 53 +++++++++- libntfs/rich.c | 25 ++++- libntfs/runlist.c | 121 ++++++++++++++++----- libntfs/security.c | 3 +- libntfs/tree.c | 259 +++++++++++++++++++++++++++++++++++++++------ libntfs/unistr.c | 33 +++++- libntfs/unix_io.c | 86 +++++++++++++-- libntfs/volume.c | 60 ++++++++--- 16 files changed, 799 insertions(+), 150 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index cf1a61d3..5465118e 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -59,7 +59,12 @@ ntfschar AT_UNNAMED[] = { const_cpu_to_le16('\0') }; /** - * ntfs_get_attribute_value_length + * ntfs_get_attribute_value_length - + * @a: + * + * Description... + * + * Returns: */ s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a) { @@ -77,7 +82,14 @@ s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a) } /** - * ntfs_get_attribute_value + * ntfs_get_attribute_value - + * @vol: + * @a: + * @b: + * + * Description... + * + * Returns: */ s64 ntfs_get_attribute_value(const ntfs_volume *vol, const ATTR_RECORD *a, u8 *b) @@ -245,8 +257,6 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, /* Already cleaned up code below, but still look for FIXME:... */ /** - * Internal: - * * __ntfs_attr_init - primary initialization of an ntfs attribute structure * @na: ntfs attribute to initialize * @ni: ntfs inode with which to initialize the ntfs attribute @@ -1476,8 +1486,6 @@ s64 ntfs_attr_mst_pwrite(ntfs_attr *na, const s64 pos, s64 bk_cnt, } /** - * Internal: - * * ntfs_attr_find - find (next) attribute in mft record * @type: attribute type to find * @name: attribute name to find (optional, i.e. NULL means don't care) @@ -1680,8 +1688,6 @@ static int ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, } /** - * Internal: - * * ntfs_external_attr_find - find an attribute in the attribute list of an inode * @type: attribute type to find * @name: attribute name to find (optional, i.e. NULL means don't care) @@ -2189,8 +2195,6 @@ int ntfs_attr_lookup(const ATTR_TYPES type, const ntfschar *name, } /** - * Internal: - * * ntfs_attr_init_search_ctx - initialize an attribute search context * @ctx: attribute search context to initialize * @ni: ntfs inode with which to initialize the search context diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index 5532c3ec..495f2bb6 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -228,7 +228,12 @@ int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) #include "rich.h" /** - * ntfs_bmp_rollback + * ntfs_bmp_rollback - + * @bmp: + * + * Description... + * + * Returns: */ int ntfs_bmp_rollback(struct ntfs_bmp *bmp) { @@ -252,7 +257,12 @@ int ntfs_bmp_rollback(struct ntfs_bmp *bmp) } /** - * ntfs_bmp_commit + * ntfs_bmp_commit - + * @bmp: + * + * Description... + * + * Returns: */ int ntfs_bmp_commit(struct ntfs_bmp *bmp) { @@ -301,7 +311,12 @@ int ntfs_bmp_commit(struct ntfs_bmp *bmp) } /** - * ntfs_bmp_free + * ntfs_bmp_free - + * @bmp: + * + * Description... + * + * Returns: */ void ntfs_bmp_free(struct ntfs_bmp *bmp) { @@ -317,7 +332,15 @@ void ntfs_bmp_free(struct ntfs_bmp *bmp) } /** - * ntfs_bmp_create + * ntfs_bmp_create - + * @inode: + * @type: + * @name: + * @name_len: + * + * Description... + * + * Returns: */ struct ntfs_bmp * ntfs_bmp_create(ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len) { @@ -349,7 +372,14 @@ struct ntfs_bmp * ntfs_bmp_create(ntfs_inode *inode, ATTR_TYPES type, ntfschar * } /** - * ntfs_bmp_add_data + * ntfs_bmp_add_data - + * @bmp: + * @vcn: + * @data: + * + * Description... + * + * Returns: */ int ntfs_bmp_add_data(struct ntfs_bmp *bmp, VCN vcn, u8 *data) { @@ -386,7 +416,13 @@ int ntfs_bmp_add_data(struct ntfs_bmp *bmp, VCN vcn, u8 *data) } /** - * ntfs_bmp_get_data + * ntfs_bmp_get_data - + * @bmp: + * @vcn: + * + * Description... + * + * Returns: */ u8 * ntfs_bmp_get_data(struct ntfs_bmp *bmp, VCN vcn) { @@ -430,7 +466,15 @@ u8 * ntfs_bmp_get_data(struct ntfs_bmp *bmp, VCN vcn) } /** - * ntfs_bmp_set_range + * ntfs_bmp_set_range - + * @bmp: + * @vcn: + * @length: + * @value: + * + * Description... + * + * Returns: */ int ntfs_bmp_set_range(struct ntfs_bmp *bmp, VCN vcn, s64 length, int value) { @@ -519,7 +563,12 @@ int ntfs_bmp_set_range(struct ntfs_bmp *bmp, VCN vcn, s64 length, int value) } /** - * ntfs_bmp_find_last_set + * ntfs_bmp_find_last_set - + * @bmp: + * + * Description... + * + * Returns: */ s64 ntfs_bmp_find_last_set(struct ntfs_bmp *bmp) { @@ -583,7 +632,14 @@ s64 ntfs_bmp_find_last_set(struct ntfs_bmp *bmp) } /** - * ntfs_bmp_find_space + * ntfs_bmp_find_space - + * @bmp: + * @start: + * @size: + * + * Description... + * + * Returns: */ int ntfs_bmp_find_space(struct ntfs_bmp *bmp, LCN start, long size) { diff --git a/libntfs/collate.c b/libntfs/collate.c index 7bc354a2..c961efc7 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -34,7 +34,16 @@ #include "logging.h" /** - * ntfs_collate_binary + * ntfs_collate_binary - + * @vol: unused + * @data1: + * @data1_len: + * @data2: + * @data2_len: + * + * Description... + * + * Returns: */ static int ntfs_collate_binary(ntfs_volume *vol __attribute__((unused)), const void *data1, const int data1_len, @@ -55,7 +64,16 @@ static int ntfs_collate_binary(ntfs_volume *vol __attribute__((unused)), } /** - * ntfs_collate_ntofs_ulong + * ntfs_collate_ntofs_ulong - + * @vol: unused + * @data1: + * @data1_len: + * @data2: + * @data2_len: + * + * Description... + * + * Returns: */ static int ntfs_collate_ntofs_ulong(ntfs_volume *vol __attribute__((unused)), const void *data1, const int data1_len, @@ -84,7 +102,16 @@ static int ntfs_collate_ntofs_ulong(ntfs_volume *vol __attribute__((unused)), } /** - * ntfs_collate_file_name + * ntfs_collate_file_name - + * @vol: + * @data1: + * @data1_len: unused + * @data2: + * @data2_len: unused + * + * Description... + * + * Returns: */ static int ntfs_collate_file_name(ntfs_volume *vol, const void *data1, const int data1_len __attribute__((unused)), diff --git a/libntfs/compat.c b/libntfs/compat.c index 636987d5..887b82ff 100644 --- a/libntfs/compat.c +++ b/libntfs/compat.c @@ -28,8 +28,17 @@ #include "compat.h" -// TODO: Add check for FFS in the configure script... (AIA) +/* TODO: Add check for FFS in the configure script... (AIA) */ + #ifndef HAVE_FFS +/** + * ffs - + * @x: + * + * Description... + * + * Returns: + */ int ffs(int x) { int r = 1; diff --git a/libntfs/debug.c b/libntfs/debug.c index 63eabbb1..c4443023 100644 --- a/libntfs/debug.c +++ b/libntfs/debug.c @@ -35,6 +35,11 @@ #ifndef NTFS_DISABLE_DEBUG_LOGGING /** * ntfs_debug_runlist_dump - Dump a runlist. + * @rl: + * + * Description... + * + * Returns: */ void ntfs_debug_runlist_dump(const runlist_element *rl) { diff --git a/libntfs/dir.c b/libntfs/dir.c index 4b1ab17d..170583e8 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -603,8 +603,6 @@ typedef enum { } INDEX_TYPE; /** - * Internal: - * * ntfs_filldir - ntfs specific filldir method * @dir_ni: ntfs inode of current directory * @pos: current position in directory @@ -646,8 +644,6 @@ static inline int ntfs_filldir(ntfs_inode *dir_ni, s64 *pos, u8 ivcn_bits, } /** - * Internal: - * * ntfs_mft_get_parent_ref - find mft reference of parent directory of an inode * @ni: ntfs inode whose parent directory to find * @@ -1519,7 +1515,12 @@ err_out: #include "rich.h" /** - * ntfs_dir_rollback + * ntfs_dir_rollback - + * @dir: + * + * Description... + * + * Returns: */ int ntfs_dir_rollback(struct ntfs_dir *dir) { @@ -1546,7 +1547,13 @@ int ntfs_dir_rollback(struct ntfs_dir *dir) } /** - * ntfs_dir_truncate + * ntfs_dir_truncate - + * @vol: + * @dir: + * + * Description... + * + * Returns: */ int ntfs_dir_truncate(ntfs_volume *vol, struct ntfs_dir *dir) { @@ -1693,7 +1700,12 @@ int ntfs_dir_truncate(ntfs_volume *vol, struct ntfs_dir *dir) } /** - * ntfs_dir_commit + * ntfs_dir_commit - + * @dir: + * + * Description... + * + * Returns: */ int ntfs_dir_commit(struct ntfs_dir *dir) { @@ -1725,7 +1737,12 @@ int ntfs_dir_commit(struct ntfs_dir *dir) } /** - * ntfs_dir_free + * ntfs_dir_free - + * @dir: + * + * Description... + * + * Returns: */ void ntfs_dir_free(struct ntfs_dir *dir) { @@ -1765,7 +1782,13 @@ void ntfs_dir_free(struct ntfs_dir *dir) } /** - * ntfs_dir_create + * ntfs_dir_create - + * @vol: + * @mft_num: + * + * Description... + * + * Returns: */ struct ntfs_dir * ntfs_dir_create(ntfs_volume *vol, MFT_REF mft_num) { @@ -1833,7 +1856,13 @@ struct ntfs_dir * ntfs_dir_create(ntfs_volume *vol, MFT_REF mft_num) } /** - * ntfs_dir_add + * ntfs_dir_add - + * @parent: + * @child: + * + * Description... + * + * Returns: */ void ntfs_dir_add(struct ntfs_dir *parent, struct ntfs_dir *child) { @@ -1854,7 +1883,14 @@ void ntfs_dir_add(struct ntfs_dir *parent, struct ntfs_dir *child) } /** - * ntfs_dir_find2 + * ntfs_dir_find2 - + * @dir: + * @name: + * @name_len: + * + * Description... + * + * Returns: */ struct ntfs_dir * ntfs_dir_find2(struct ntfs_dir *dir, ntfschar *name, int name_len) { diff --git a/libntfs/index.c b/libntfs/index.c index 2c0330d5..76250c3d 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -662,7 +662,12 @@ err_out: #include "rich.h" /** - * ntfs_ie_free + * ntfs_ie_free - + * @ie: + * + * Description... + * + * Returns: */ void ntfs_ie_free(INDEX_ENTRY *ie) { @@ -671,7 +676,11 @@ void ntfs_ie_free(INDEX_ENTRY *ie) } /** - * ntfs_ie_create + * ntfs_ie_create - + * + * Description... + * + * Returns: */ INDEX_ENTRY * ntfs_ie_create(void) { @@ -693,7 +702,12 @@ INDEX_ENTRY * ntfs_ie_create(void) } /** - * ntfs_ie_get_vcn + * ntfs_ie_get_vcn - + * @ie: + * + * Description... + * + * Returns: */ VCN ntfs_ie_get_vcn(INDEX_ENTRY *ie) { @@ -707,7 +721,12 @@ VCN ntfs_ie_get_vcn(INDEX_ENTRY *ie) } /** - * ntfs_ie_copy + * ntfs_ie_copy - + * @ie: + * + * Description... + * + * Returns: */ INDEX_ENTRY * ntfs_ie_copy(INDEX_ENTRY *ie) { @@ -726,7 +745,13 @@ INDEX_ENTRY * ntfs_ie_copy(INDEX_ENTRY *ie) } /** - * ntfs_ie_set_vcn + * ntfs_ie_set_vcn - + * @ie: + * @vcn: + * + * Description... + * + * Returns: */ INDEX_ENTRY * ntfs_ie_set_vcn(INDEX_ENTRY *ie, VCN vcn) { @@ -748,7 +773,12 @@ INDEX_ENTRY * ntfs_ie_set_vcn(INDEX_ENTRY *ie, VCN vcn) } /** - * ntfs_ie_remove_vcn + * ntfs_ie_remove_vcn - + * @ie: + * + * Description... + * + * Returns: */ INDEX_ENTRY * ntfs_ie_remove_vcn(INDEX_ENTRY *ie) { @@ -765,7 +795,15 @@ INDEX_ENTRY * ntfs_ie_remove_vcn(INDEX_ENTRY *ie) } /** - * ntfs_ie_set_name + * ntfs_ie_set_name - + * @ie: + * @name: + * @namelen: + * @nametype: + * + * Description... + * + * Returns: */ INDEX_ENTRY * ntfs_ie_set_name(INDEX_ENTRY *ie, ntfschar *name, int namelen, FILE_NAME_TYPE_FLAGS nametype) { @@ -853,7 +891,12 @@ INDEX_ENTRY * ntfs_ie_set_name(INDEX_ENTRY *ie, ntfschar *name, int namelen, FIL } /** - * ntfs_ie_remove_name + * ntfs_ie_remove_name - + * @ie: + * + * Description... + * + * Returns: */ INDEX_ENTRY * ntfs_ie_remove_name(INDEX_ENTRY *ie) { diff --git a/libntfs/inode.c b/libntfs/inode.c index 22008e9d..9e876e1e 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -50,9 +50,12 @@ #include "logging.h" /** - * Internal: + * __ntfs_inode_allocate - + * @vol: * - * __ntfs_inode_allocate - desc + * Description... + * + * Returns: */ static __inline__ ntfs_inode *__ntfs_inode_allocate(ntfs_volume *vol) { @@ -65,9 +68,12 @@ static __inline__ ntfs_inode *__ntfs_inode_allocate(ntfs_volume *vol) } /** - * Internal: + * ntfs_inode_allocate - + * @vol: * - * ntfs_inode_allocate - desc + * Description... + * + * Returns: */ ntfs_inode *ntfs_inode_allocate(ntfs_volume *vol) { @@ -75,9 +81,12 @@ ntfs_inode *ntfs_inode_allocate(ntfs_volume *vol) } /** - * Internal: + * __ntfs_inode_release - + * @ni: * - * __ntfs_inode_release - desc + * Description... + * + * Returns: */ static __inline__ int __ntfs_inode_release(ntfs_inode *ni) { @@ -1064,7 +1073,12 @@ put_err_out: #include "rich.h" /** - * ntfs_inode_close2 + * ntfs_inode_close2 - + * @ni: + * + * Description... + * + * Returns: */ int ntfs_inode_close2(ntfs_inode *ni) { @@ -1087,7 +1101,13 @@ int ntfs_inode_close2(ntfs_inode *ni) } /** - * ntfs_inode_open2 + * ntfs_inode_open2 - + * @vol: + * @mref: + * + * Description... + * + * Returns: */ ntfs_inode * ntfs_inode_open2(ntfs_volume *vol, const MFT_REF mref) { @@ -1136,8 +1156,13 @@ ntfs_inode * ntfs_inode_open2(ntfs_volume *vol, const MFT_REF mref) } /** - * ntfs_inode_open3 - * open a deleted inode + * ntfs_inode_open3 - + * @vol: + * @mref: + * + * Description... + * + * Returns: */ ntfs_inode * ntfs_inode_open3(ntfs_volume *vol, const MFT_REF mref) { diff --git a/libntfs/mft.c b/libntfs/mft.c index 3a2f72a8..43dca2d0 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -391,6 +391,14 @@ int ntfs_mft_record_format(const ntfs_volume *vol, const MFT_REF mref) static const char *es = " Leaving inconsistent metadata. Run chkdsk."; #endif +/** + * ntfs_ffz - + * @word: + * + * Description... + * + * Returns: + */ static inline unsigned int ntfs_ffz(unsigned int word) { return ffs(~word) - 1; @@ -1558,7 +1566,14 @@ sync_rollback: #include "rich.h" /** - * ntfs_mft_remove_attr + * ntfs_mft_remove_attr - + * @bmp: + * @inode: + * @type: + * + * Description... + * + * Returns: */ int ntfs_mft_remove_attr(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES type) { @@ -1617,7 +1632,15 @@ int ntfs_mft_remove_attr(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES typ } /** - * ntfs_mft_add_attr + * ntfs_mft_add_attr - + * @inode: + * @type: + * @data: + * @data_len: + * + * Description... + * + * Returns: */ ATTR_RECORD * ntfs_mft_add_attr(ntfs_inode *inode, ATTR_TYPES type, u8 *data, int data_len) { @@ -1687,7 +1710,17 @@ ATTR_RECORD * ntfs_mft_add_attr(ntfs_inode *inode, ATTR_TYPES type, u8 *data, in } /** - * ntfs_mft_resize_resident + * ntfs_mft_resize_resident - + * @inode: + * @type: + * @name: + * @name_len: + * @data: + * @data_len: + * + * Description... + * + * Returns: */ int ntfs_mft_resize_resident(ntfs_inode *inode, ATTR_TYPES type, ntfschar *name, int name_len, u8 *data, int data_len) { @@ -1786,7 +1819,12 @@ done: } /** - * ntfs_mft_free_space + * ntfs_mft_free_space - + * @dir: + * + * Description... + * + * Returns: */ int ntfs_mft_free_space(struct ntfs_dir *dir) { @@ -1805,7 +1843,12 @@ int ntfs_mft_free_space(struct ntfs_dir *dir) } /** - * ntfs_mft_add_index + * ntfs_mft_add_index - + * @dir: + * + * Description... + * + * Returns: */ int ntfs_mft_add_index(struct ntfs_dir *dir) { diff --git a/libntfs/rich.c b/libntfs/rich.c index cb7ec73c..bd3d4024 100644 --- a/libntfs/rich.c +++ b/libntfs/rich.c @@ -112,7 +112,13 @@ ATTR_RECORD * find_first_attribute(const ATTR_TYPES type, MFT_RECORD *mft) } /** - * ntfs_name_print + * ntfs_name_print - + * @name: + * @name_len: + * + * Description... + * + * Returns: */ void ntfs_name_print(ntfschar *name, int name_len) { @@ -128,7 +134,14 @@ void ntfs_name_print(ntfschar *name, int name_len) } /** - * utils_free_non_residents3 + * utils_free_non_residents3 - + * @bmp: + * @inode: + * @attr: + * + * Description... + * + * Returns: */ int utils_free_non_residents3(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECORD *attr) { @@ -165,7 +178,13 @@ int utils_free_non_residents3(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECO } /** - * utils_free_non_residents2 + * utils_free_non_residents2 - + * @inode: + * @bmp: + * + * Description... + * + * Returns: */ int utils_free_non_residents2(ntfs_inode *inode, struct ntfs_bmp *bmp) { diff --git a/libntfs/runlist.c b/libntfs/runlist.c index ac909c65..c5b9d869 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -47,9 +47,15 @@ #include "logging.h" /** - * Internal: - * * ntfs_rl_mm - runlist memmove + * @base: + * @dst: + * @src: + * @size: + * + * Description... + * + * Returns: */ static __inline__ void ntfs_rl_mm(runlist_element *base, int dst, int src, int size) @@ -59,9 +65,16 @@ static __inline__ void ntfs_rl_mm(runlist_element *base, int dst, int src, } /** - * Internal: - * * ntfs_rl_mc - runlist memory copy + * @dstbase: + * @dst: + * @srcbase: + * @src: + * @size: + * + * Description... + * + * Returns: */ static __inline__ void ntfs_rl_mc(runlist_element *dstbase, int dst, runlist_element *srcbase, int src, int size) @@ -71,8 +84,6 @@ static __inline__ void ntfs_rl_mc(runlist_element *dstbase, int dst, } /** - * Internal: - * * ntfs_rl_realloc - Reallocate memory for runlists * @rl: original runlist * @old_size: number of runlist elements in the original runlist @rl @@ -99,8 +110,6 @@ static __inline__ runlist_element *ntfs_rl_realloc(runlist_element *rl, } /** - * Internal: - * * ntfs_rl_are_mergeable - test if two runlists can be joined together * @dst: original runlist * @src: new runlist to test for mergeability with @dst @@ -138,8 +147,6 @@ static __inline__ BOOL ntfs_rl_are_mergeable(runlist_element *dst, } /** - * Internal: - * * __ntfs_rl_merge - merge two runlists without testing if they can be merged * @dst: original, destination runlist * @src: new runlist to merge with @dst @@ -155,8 +162,6 @@ static __inline__ void __ntfs_rl_merge(runlist_element *dst, } /** - * Internal: - * * ntfs_rl_append - append a runlist after a given element * @dst: original runlist to be worked on * @dsize: number of elements in @dst (including end marker) @@ -224,8 +229,6 @@ static __inline__ runlist_element *ntfs_rl_append(runlist_element *dst, } /** - * Internal: - * * ntfs_rl_insert - insert a runlist into another * @dst: original runlist to be worked on * @dsize: number of elements in @dst (including end marker) @@ -323,8 +326,6 @@ static __inline__ runlist_element *ntfs_rl_insert(runlist_element *dst, } /** - * Internal: - * * ntfs_rl_replace - overwrite a runlist element with another runlist * @dst: original runlist to be worked on * @dsize: number of elements in @dst (including end marker) @@ -407,8 +408,6 @@ static __inline__ runlist_element *ntfs_rl_replace(runlist_element *dst, } /** - * Internal: - * * ntfs_rl_split - insert a runlist into the centre of a hole * @dst: original runlist to be worked on * @dsize: number of elements in @dst (including end marker) @@ -1719,7 +1718,12 @@ s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl) } */ /** - * test_rl_dump_runlist + * test_rl_dump_runlist - + * @rl: + * + * Description... + * + * Returns: */ static void test_rl_dump_runlist(const runlist_element *rl) { @@ -1766,7 +1770,13 @@ static void test_rl_dump_runlist(const runlist_element *rl) } /** - * test_rl_runlists_merge + * test_rl_runlists_merge - + * @drl: + * @srl: + * + * Description... + * + * Returns: */ static runlist_element * test_rl_runlists_merge(runlist_element *drl, runlist_element *srl) { @@ -1786,7 +1796,14 @@ static runlist_element * test_rl_runlists_merge(runlist_element *drl, runlist_el } /** - * test_rl_read_buffer + * test_rl_read_buffer - + * @file: + * @buf: + * @bufsize: + * + * Description... + * + * Returns: */ static int test_rl_read_buffer(const char *file, u8 *buf, int bufsize) { @@ -1808,7 +1825,15 @@ static int test_rl_read_buffer(const char *file, u8 *buf, int bufsize) } /** - * test_rl_pure_src + * test_rl_pure_src - + * @contig: + * @multi: + * @vcn: + * @len: + * + * Description... + * + * Returns: */ static runlist_element * test_rl_pure_src(BOOL contig, BOOL multi, int vcn, int len) { @@ -1835,7 +1860,18 @@ static runlist_element * test_rl_pure_src(BOOL contig, BOOL multi, int vcn, int } /** - * test_rl_pure_test + * test_rl_pure_test - + * @test: + * @contig: + * @multi: + * @vcn: + * @len: + * @file: + * @size: + * + * Description... + * + * Returns: */ static void test_rl_pure_test(int test, BOOL contig, BOOL multi, int vcn, int len, runlist_element *file, int size) { @@ -1855,7 +1891,13 @@ static void test_rl_pure_test(int test, BOOL contig, BOOL multi, int vcn, int le } /** - * test_rl_pure + * test_rl_pure - + * @contig: + * @multi: + * + * Description... + * + * Returns: */ static void test_rl_pure(char *contig, char *multi) { @@ -1949,7 +1991,11 @@ static void test_rl_pure(char *contig, char *multi) } /** - * test_rl_zero + * test_rl_zero - + * + * Description... + * + * Returns: */ static void test_rl_zero(void) { @@ -1971,7 +2017,15 @@ static void test_rl_zero(void) } /** - * test_rl_frag_combine + * test_rl_frag_combine - + * @vol: + * @attr1: + * @attr2: + * @attr3: + * + * Description... + * + * Returns: */ static void test_rl_frag_combine(ntfs_volume *vol, ATTR_RECORD *attr1, ATTR_RECORD *attr2, ATTR_RECORD *attr3) { @@ -1999,7 +2053,12 @@ static void test_rl_frag_combine(ntfs_volume *vol, ATTR_RECORD *attr1, ATTR_RECO } /** - * test_rl_frag + * test_rl_frag - + * @test: + * + * Description... + * + * Returns: */ static void test_rl_frag(char *test) { @@ -2039,7 +2098,13 @@ out: } /** - * test_rl_main + * test_rl_main - + * @argc: + * @argv:[] + * + * Description... + * + * Returns: */ int test_rl_main(int argc, char *argv[]) { diff --git a/libntfs/security.c b/libntfs/security.c index 3e5bfaf8..75aef280 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -258,7 +258,8 @@ err_out: * * Returns: The same pointer it was given as a parameter (guid). */ -GUID *generate_guid(GUID *guid) { +GUID *generate_guid(GUID *guid) +{ int i; static u8 array[16]; diff --git a/libntfs/tree.c b/libntfs/tree.c index 7654e611..c7733587 100644 --- a/libntfs/tree.c +++ b/libntfs/tree.c @@ -42,7 +42,12 @@ #include "rich.h" /** - * ntfs_dt_free + * ntfs_dt_free - + * @dt: + * + * Description... + * + * Returns: */ void ntfs_dt_free(struct ntfs_dt *dt) { @@ -66,7 +71,12 @@ void ntfs_dt_free(struct ntfs_dt *dt) } /** - * ntfs_dt_rollback + * ntfs_dt_rollback - + * @dt: + * + * Description... + * + * Returns: */ int ntfs_dt_rollback(struct ntfs_dt *dt) { @@ -113,7 +123,12 @@ int ntfs_dt_rollback(struct ntfs_dt *dt) } /** - * ntfs_dt_commit + * ntfs_dt_commit - + * @dt: + * + * Description... + * + * Returns: */ int ntfs_dt_commit(struct ntfs_dt *dt) { @@ -171,7 +186,13 @@ int ntfs_dt_commit(struct ntfs_dt *dt) } /** - * ntfs_dt_create_children2 + * ntfs_dt_create_children2 - + * @dt: + * @count: + * + * Description... + * + * Returns: */ BOOL ntfs_dt_create_children2(struct ntfs_dt *dt, int count) { @@ -199,7 +220,13 @@ BOOL ntfs_dt_create_children2(struct ntfs_dt *dt, int count) } /** - * ntfs_dt_resize_children3 + * ntfs_dt_resize_children3 - + * @dt: + * @new: + * + * Description... + * + * Returns: */ BOOL ntfs_dt_resize_children3(struct ntfs_dt *dt, int new) { @@ -239,7 +266,12 @@ BOOL ntfs_dt_resize_children3(struct ntfs_dt *dt, int new) } /** - * ntfs_dt_root_count + * ntfs_dt_root_count - + * @dt: + * + * Description... + * + * Returns: */ int ntfs_dt_root_count(struct ntfs_dt *dt) { @@ -302,7 +334,12 @@ int ntfs_dt_root_count(struct ntfs_dt *dt) } /** - * ntfs_dt_alloc_count + * ntfs_dt_alloc_count - + * @dt: + * + * Description... + * + * Returns: */ int ntfs_dt_alloc_count(struct ntfs_dt *dt) { @@ -361,7 +398,13 @@ int ntfs_dt_alloc_count(struct ntfs_dt *dt) } /** - * ntfs_dt_initialise2 + * ntfs_dt_initialise2 - + * @vol: + * @dt: + * + * Description... + * + * Returns: */ int ntfs_dt_initialise2(ntfs_volume *vol, struct ntfs_dt *dt) { @@ -404,7 +447,14 @@ int ntfs_dt_initialise2(ntfs_volume *vol, struct ntfs_dt *dt) } /** - * ntfs_dt_create + * ntfs_dt_create - + * @dir: + * @parent: + * @vcn: + * + * Description... + * + * Returns: */ struct ntfs_dt * ntfs_dt_create(struct ntfs_dir *dir, struct ntfs_dt *parent, VCN vcn) { @@ -504,7 +554,11 @@ struct ntfs_dt * ntfs_dt_create(struct ntfs_dir *dir, struct ntfs_dt *parent, VC } /** - * ntfs_dt_find + * ntfs_dt_find - + * @dt: + * @name: + * @name_len: + * * find dt by name, return MFT_REF * maps dt's as necessary */ @@ -580,7 +634,12 @@ MFT_REF ntfs_dt_find(struct ntfs_dt *dt, ntfschar *name, int name_len) } /** - * ntfs_dt_find2 + * ntfs_dt_find2 - + * @dt: + * @name: + * @name_len: + * @index_num: + * * find dt by name, returns dt and index * maps dt's as necessary */ @@ -659,7 +718,12 @@ struct ntfs_dt * ntfs_dt_find2(struct ntfs_dt *dt, ntfschar *name, int name_len, } /** - * ntfs_dt_find3 + * ntfs_dt_find3 - + * @dt: + * @name: + * @name_len: + * @index_num: + * * find dt by name, returns dt and index * does not map new dt's */ @@ -720,7 +784,12 @@ struct ntfs_dt * ntfs_dt_find3(struct ntfs_dt *dt, ntfschar *name, int name_len, } /** - * ntfs_dt_find4 + * ntfs_dt_find4 - + * @dt: + * @name: + * @name_len: + * @index_num: + * * find successor to specified name, returns dt and index * maps dt's as necessary */ @@ -789,7 +858,9 @@ struct ntfs_dt * ntfs_dt_find4(struct ntfs_dt *dt, ntfschar *name, int name_len, } /** - * ntfs_dt_find_all + * ntfs_dt_find_all - + * @dt: + * * maps all dt's into memory */ void ntfs_dt_find_all(struct ntfs_dt *dt) @@ -816,7 +887,12 @@ void ntfs_dt_find_all(struct ntfs_dt *dt) } /** - * ntfs_dt_find_parent + * ntfs_dt_find_parent - + * @dt: + * + * Description... + * + * Returns: */ int ntfs_dt_find_parent(struct ntfs_dt *dt) { @@ -839,7 +915,12 @@ int ntfs_dt_find_parent(struct ntfs_dt *dt) } /** - * ntfs_dt_isroot + * ntfs_dt_isroot - + * @dt: + * + * Description... + * + * Returns: */ BOOL ntfs_dt_isroot(struct ntfs_dt *dt) { @@ -850,7 +931,12 @@ BOOL ntfs_dt_isroot(struct ntfs_dt *dt) } /** - * ntfs_dt_root_freespace + * ntfs_dt_root_freespace - + * @dt: + * + * Description... + * + * Returns: */ int ntfs_dt_root_freespace(struct ntfs_dt *dt) { @@ -871,7 +957,12 @@ int ntfs_dt_root_freespace(struct ntfs_dt *dt) } /** - * ntfs_dt_alloc_freespace + * ntfs_dt_alloc_freespace - + * @dt: + * + * Description... + * + * Returns: */ int ntfs_dt_alloc_freespace(struct ntfs_dt *dt) { @@ -892,7 +983,15 @@ int ntfs_dt_alloc_freespace(struct ntfs_dt *dt) } /** - * ntfs_dt_transfer + * ntfs_dt_transfer - + * @old: + * @new: + * @start: + * @count: + * + * Description... + * + * Returns: */ int ntfs_dt_transfer(struct ntfs_dt *old, struct ntfs_dt *new, int start, int count) { @@ -1042,7 +1141,14 @@ int ntfs_dt_transfer(struct ntfs_dt *old, struct ntfs_dt *new, int start, int co } /** - * ntfs_dt_alloc_insert + * ntfs_dt_alloc_insert - + * @dt: + * @first: + * @count: + * + * Description... + * + * Returns: */ int ntfs_dt_alloc_insert(struct ntfs_dt *dt, INDEX_ENTRY *first, int count) { @@ -1106,7 +1212,15 @@ int ntfs_dt_alloc_insert(struct ntfs_dt *dt, INDEX_ENTRY *first, int count) } /** - * ntfs_dt_alloc_insert2 + * ntfs_dt_alloc_insert2 - + * @dt: + * @before: + * @count: + * @bytes: + * + * Description... + * + * Returns: */ INDEX_ENTRY * ntfs_dt_alloc_insert2(struct ntfs_dt *dt, int before, int count, int bytes) { @@ -1173,7 +1287,14 @@ INDEX_ENTRY * ntfs_dt_alloc_insert2(struct ntfs_dt *dt, int before, int count, i } /** - * ntfs_dt_root_insert + * ntfs_dt_root_insert - + * @dt: + * @first: + * @count: + * + * Description... + * + * Returns: */ int ntfs_dt_root_insert(struct ntfs_dt *dt, INDEX_ENTRY *first, int count) { @@ -1187,7 +1308,14 @@ int ntfs_dt_root_insert(struct ntfs_dt *dt, INDEX_ENTRY *first, int count) } /** - * ntfs_dt_alloc_remove2 + * ntfs_dt_alloc_remove2 - + * @dt: + * @start: + * @count: + * + * Description... + * + * Returns: */ int ntfs_dt_alloc_remove2(struct ntfs_dt *dt, int start, int count) { @@ -1207,7 +1335,14 @@ int ntfs_dt_alloc_remove2(struct ntfs_dt *dt, int start, int count) } /** - * ntfs_dt_root_remove2 + * ntfs_dt_root_remove2 - + * @dt: + * @start: + * @count: + * + * Description... + * + * Returns: */ int ntfs_dt_root_remove2(struct ntfs_dt *dt, int start, int count) { @@ -1249,7 +1384,15 @@ int ntfs_dt_root_remove2(struct ntfs_dt *dt, int start, int count) } /** - * ntfs_dt_transfer2 + * ntfs_dt_transfer2 - + * @old: + * @new: + * @start: + * @count: + * + * Description... + * + * Returns: */ int ntfs_dt_transfer2(struct ntfs_dt *old, struct ntfs_dt *new, int start, int count) { @@ -1410,7 +1553,15 @@ int ntfs_dt_transfer2(struct ntfs_dt *old, struct ntfs_dt *new, int start, int c } /** - * ntfs_dt_root_replace + * ntfs_dt_root_replace - + * @del: + * @del_num: + * @del_ie: + * @suc_ie: + * + * Description... + * + * Returns: */ int ntfs_dt_root_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) { @@ -1490,7 +1641,15 @@ int ntfs_dt_root_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, } /** - * ntfs_dt_alloc_replace + * ntfs_dt_alloc_replace - + * @del: + * @del_num: + * @del_ie: + * @suc_ie: + * + * Description... + * + * Returns: */ BOOL ntfs_dt_alloc_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, INDEX_ENTRY *suc_ie) { @@ -1553,7 +1712,13 @@ BOOL ntfs_dt_alloc_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie } /** - * ntfs_dt_root_remove + * ntfs_dt_root_remove - + * @del: + * @del_num: + * + * Description... + * + * Returns: */ BOOL ntfs_dt_root_remove(struct ntfs_dt *del, int del_num) { @@ -1675,7 +1840,13 @@ BOOL ntfs_dt_root_remove(struct ntfs_dt *del, int del_num) } /** - * ntfs_dt_alloc_remove + * ntfs_dt_alloc_remove - + * @del: + * @del_num: + * + * Description... + * + * Returns: */ BOOL ntfs_dt_alloc_remove(struct ntfs_dt *del, int del_num) { @@ -1798,7 +1969,15 @@ BOOL ntfs_dt_alloc_remove(struct ntfs_dt *del, int del_num) } /** - * ntfs_dt_alloc_add + * ntfs_dt_alloc_add - + * @parent: + * @index_num: + * @ie: + * @child: + * + * Description... + * + * Returns: */ int ntfs_dt_alloc_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) { @@ -1887,7 +2066,15 @@ int ntfs_dt_alloc_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, st } /** - * ntfs_dt_root_add + * ntfs_dt_root_add - + * @parent: + * @index_num: + * @ie: + * @child: + * + * Description... + * + * Returns: */ int ntfs_dt_root_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, struct ntfs_dt *child) { @@ -1990,7 +2177,15 @@ int ntfs_dt_root_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, str } /** - * ntfs_dt_add2 + * ntfs_dt_add2 - + * @ie: + * @suc: + * @suc_num: + * @ded: + * + * Description... + * + * Returns: */ int ntfs_dt_add2(INDEX_ENTRY *ie, struct ntfs_dt *suc, int suc_num, struct ntfs_dt *ded) { diff --git a/libntfs/unistr.c b/libntfs/unistr.c index a8b91d20..f34355ff 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -123,7 +123,7 @@ BOOL ntfs_names_are_equal(const ntfschar *s1, size_t s1_len, */ int ntfs_names_collate(const ntfschar *name1, const u32 name1_len, const ntfschar *name2, const u32 name2_len, - const int err_val __attribute__((__unused__)), + const int err_val __attribute__((unused)), const IGNORE_CASE_BOOL ic, const ntfschar *upcase, const u32 upcase_len) { @@ -307,7 +307,15 @@ ntfschar *ntfs_ucsndup(const ntfschar *s, u32 maxlen) } /** - * ntfs_name_upcase + * ntfs_name_upcase - + * @name: + * @name_len: + * @upcase: + * @upcase_len: + * + * Description... + * + * Returns: */ void ntfs_name_upcase(ntfschar *name, u32 name_len, const ntfschar *upcase, const u32 upcase_len) @@ -321,7 +329,14 @@ void ntfs_name_upcase(ntfschar *name, u32 name_len, const ntfschar *upcase, } /** - * ntfs_file_value_upcase + * ntfs_file_value_upcase - + * @file_name_attr: + * @upcase: + * @upcase_len: + * + * Description... + * + * Returns: */ void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, const ntfschar *upcase, const u32 upcase_len) @@ -331,7 +346,17 @@ void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, } /** - * ntfs_file_values_compare + * ntfs_file_values_compare - + * @file_name_attr1: + * @file_name_attr2: + * @err_val: + * @ic: + * @upcase: + * @upcase_len: + * + * Description... + * + * Returns: */ int ntfs_file_values_compare(const FILE_NAME_ATTR *file_name_attr1, const FILE_NAME_ATTR *file_name_attr2, diff --git a/libntfs/unix_io.c b/libntfs/unix_io.c index a91b6431..8cc94c1f 100644 --- a/libntfs/unix_io.c +++ b/libntfs/unix_io.c @@ -67,7 +67,13 @@ #define DEV_FD(dev) (*(int *)dev->d_private) /** - * ntfs_device_unix_io_open + * ntfs_device_unix_io_open - + * @dev: + * @flags: + * + * Description... + * + * Returns: */ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags) { @@ -116,7 +122,12 @@ err_out: } /** - * ntfs_device_unix_io_close + * ntfs_device_unix_io_close - + * @dev: + * + * Description... + * + * Returns: */ static int ntfs_device_unix_io_close(struct ntfs_device *dev) { @@ -146,7 +157,14 @@ static int ntfs_device_unix_io_close(struct ntfs_device *dev) } /** - * ntfs_device_unix_io_seek + * ntfs_device_unix_io_seek - + * @dev: + * @offset: + * @whence: + * + * Description... + * + * Returns: */ static s64 ntfs_device_unix_io_seek(struct ntfs_device *dev, s64 offset, int whence) @@ -155,7 +173,14 @@ static s64 ntfs_device_unix_io_seek(struct ntfs_device *dev, s64 offset, } /** - * ntfs_device_unix_io_read + * ntfs_device_unix_io_read - + * @dev: + * @buf: + * @count: + * + * Description... + * + * Returns: */ static s64 ntfs_device_unix_io_read(struct ntfs_device *dev, void *buf, s64 count) @@ -164,7 +189,14 @@ static s64 ntfs_device_unix_io_read(struct ntfs_device *dev, void *buf, } /** - * ntfs_device_unix_io_write + * ntfs_device_unix_io_write - + * @dev: + * @buf: + * @count: + * + * Description... + * + * Returns: */ static s64 ntfs_device_unix_io_write(struct ntfs_device *dev, const void *buf, s64 count) @@ -178,7 +210,15 @@ static s64 ntfs_device_unix_io_write(struct ntfs_device *dev, const void *buf, } /** - * ntfs_device_unix_io_pread + * ntfs_device_unix_io_pread - + * @dev: + * @buf: + * @count: + * @offset: + * + * Description... + * + * Returns: */ static s64 ntfs_device_unix_io_pread(struct ntfs_device *dev, void *buf, s64 count, s64 offset) @@ -187,7 +227,15 @@ static s64 ntfs_device_unix_io_pread(struct ntfs_device *dev, void *buf, } /** - * ntfs_device_unix_io_pwrite + * ntfs_device_unix_io_pwrite - + * @dev: + * @buf: + * @count: + * @offset: + * + * Description... + * + * Returns: */ static s64 ntfs_device_unix_io_pwrite(struct ntfs_device *dev, const void *buf, s64 count, s64 offset) @@ -201,7 +249,12 @@ static s64 ntfs_device_unix_io_pwrite(struct ntfs_device *dev, const void *buf, } /** - * ntfs_device_unix_io_sync + * ntfs_device_unix_io_sync - + * @dev: + * + * Description... + * + * Returns: */ static int ntfs_device_unix_io_sync(struct ntfs_device *dev) { @@ -215,7 +268,13 @@ static int ntfs_device_unix_io_sync(struct ntfs_device *dev) } /** - * ntfs_device_unix_io_stat + * ntfs_device_unix_io_stat - + * @dev: + * @buf: + * + * Description... + * + * Returns: */ static int ntfs_device_unix_io_stat(struct ntfs_device *dev, struct stat *buf) { @@ -223,7 +282,14 @@ static int ntfs_device_unix_io_stat(struct ntfs_device *dev, struct stat *buf) } /** - * ntfs_device_unix_io_ioctl + * ntfs_device_unix_io_ioctl - + * @dev: + * @request: + * @argp: + * + * Description... + * + * Returns: */ static int ntfs_device_unix_io_ioctl(struct ntfs_device *dev, int request, void *argp) diff --git a/libntfs/volume.c b/libntfs/volume.c index fcbd36b0..598ae14e 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -68,6 +68,10 @@ /** * ntfs_volume_alloc - + * + * Description... + * + * Returns: */ ntfs_volume *ntfs_volume_alloc(void) { @@ -91,9 +95,12 @@ ntfs_volume *ntfs_volume_alloc(void) } /** - * Internal: - * * __ntfs_volume_release - + * @v: + * + * Description... + * + * Returns: */ static void __ntfs_volume_release(ntfs_volume *v) { @@ -134,8 +141,6 @@ static void __ntfs_volume_release(ntfs_volume *v) } /** - * Internal: - * * ntfs_mft_load - load the $MFT and setup the ntfs volume with it * @vol: ntfs volume whose $MFT to load * @@ -329,8 +334,6 @@ error_exit: } /** - * Internal: - * * ntfs_mftmirr_load - load the $MFTMirr and setup the ntfs volume with it * @vol: ntfs volume whose $MFTMirr to load * @@ -1266,8 +1269,6 @@ int ntfs_umount(ntfs_volume *vol, #ifndef HAVE_REALPATH /** - * Internal: - * * realpath - If there is no realpath on the system */ static char *realpath(const char *path, char *resolved_path) @@ -1277,9 +1278,8 @@ static char *realpath(const char *path, char *resolved_path) return resolved_path; } #endif + /** - * Internal: - * * ntfs_mntent_check - desc * * If you are wanting to use this, you actually wanted to use @@ -1606,7 +1606,14 @@ int utils_valid_device(const char *name, int force) } /** - * utils_mount_volume + * utils_mount_volume - + * @device: + * @flags: + * @force: + * + * Description... + * + * Returns: */ ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL force) { @@ -1653,7 +1660,12 @@ ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL f } /** - * ntfs_volume_commit + * ntfs_volume_commit - + * @vol: + * + * Description... + * + * Returns: */ int ntfs_volume_commit(ntfs_volume *vol) { @@ -1675,7 +1687,12 @@ int ntfs_volume_commit(ntfs_volume *vol) } /** - * ntfs_volume_rollback + * ntfs_volume_rollback - + * @vol: + * + * Description... + * + * Returns: */ int ntfs_volume_rollback(ntfs_volume *vol) { @@ -1696,7 +1713,13 @@ int ntfs_volume_rollback(ntfs_volume *vol) } /** - * ntfs_volume_umount2 + * ntfs_volume_umount2 - + * @vol: + * @force: + * + * Description... + * + * Returns: */ int ntfs_volume_umount2(ntfs_volume *vol, const BOOL force) { @@ -1725,7 +1748,14 @@ int ntfs_volume_umount2(ntfs_volume *vol, const BOOL force) } /** - * ntfs_volume_mount2 + * ntfs_volume_mount2 - + * @device: + * @flags: + * @force: + * + * Description... + * + * Returns: */ ntfs_volume * ntfs_volume_mount2(const char *device, unsigned long flags, BOOL force) { From ae42186cf59d49f323ede130fc1d3bab54f739c1 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 30 Oct 2005 22:41:20 +0000 Subject: [PATCH 2674/2994] utils_inode_get_name(): fix return value in case of success (the function always returned with failure beforehand) --- ntfsprogs/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index b412cc47..cc9d0fa2 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -525,7 +525,7 @@ int utils_inode_get_name(ntfs_inode *inode, char *buffer, int bufsize) ntfs_log_debug("Pathname: %s\n", buffer); - return 0; + return 1; } /** From e677d9ebf98b38c53ccd1ed9e23e627b9843be4c Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 30 Oct 2005 22:42:00 +0000 Subject: [PATCH 2675/2994] Fix GUID example --- include/ntfs/layout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 41aa1ecd..181253f9 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1096,7 +1096,7 @@ typedef struct { * twelve hexadecimal digits. GUIDs are Microsoft's implementation of the * distributed computing environment (DCE) universally unique identifier (UUID). * Example of a GUID: - * 1F010768-5A73-BC91-0010-A52216A7 + * 1F010768-5A73-BC91-0010-A52216A7227B */ typedef struct { u32 data1; /* The first eight hexadecimal digits of the GUID. */ From 370bea1395f6cdee33ed5da49d1689ea6a8cec5e Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 30 Oct 2005 22:53:38 +0000 Subject: [PATCH 2676/2994] ntfsinfo: figure out and dump index attribute types --- ChangeLog | 1 + include/ntfs/dir.h | 3 +- libntfs/dir.c | 2 + ntfsprogs/ntfsinfo.c | 139 ++++++++++++++++++++++++++++++++----------- 4 files changed, 110 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17fc59d5..5380b5f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -54,6 +54,7 @@ xx/xx/2005 - 1.12.2-WIP - Fix comment formats. (Yuval) - ntfsinfo and ntfsls follow the convention how other utilities read the device argument: no -d or --device option is needed. (Szaka) + - ntfsinfo: figure out and dump index attribute types. (Szaka) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index a274f80a..868b39af 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -32,7 +32,7 @@ #define MAX_PATH 1024 #endif -/* The little endian Unicode strings $I30, $SII, $SDH, $O, $Q +/* The little endian Unicode strings $I30, $SII, $SDH, $O, $Q, $R * as a global constant. */ extern ntfschar NTFS_INDEX_I30[5]; @@ -40,6 +40,7 @@ extern ntfschar NTFS_INDEX_SII[5]; extern ntfschar NTFS_INDEX_SDH[5]; extern ntfschar NTFS_INDEX_O[3]; extern ntfschar NTFS_INDEX_Q[3]; +extern ntfschar NTFS_INDEX_R[3]; extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni, const ntfschar *uname, const int uname_len); diff --git a/libntfs/dir.c b/libntfs/dir.c index 170583e8..467c2175 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -64,6 +64,8 @@ ntfschar NTFS_INDEX_O[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('O'), const_cpu_to_le16('\0') }; ntfschar NTFS_INDEX_Q[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('Q'), const_cpu_to_le16('\0') }; +ntfschar NTFS_INDEX_R[3] = { const_cpu_to_le16('$'), const_cpu_to_le16('R'), + const_cpu_to_le16('\0') }; /** * ntfs_inode_lookup_by_name - find an inode in a directory given its name diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 8df79672..f2b355bb 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -6,6 +6,7 @@ * Copyright (c) 2002-2005 Richard Russon * Copyright (c) 2004-2005 Yura Pakhuchiy * Copyright (c) 2005 Cristian Klein + * Copyright (c) 2003-2005 Szabolcs Szakacsits * * This utility will dump a file's attributes. * @@ -1110,12 +1111,23 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol) } } +typedef enum { + INDEX_ATTR_UNKNOWN, + INDEX_ATTR_DIRECTORY_I30, + INDEX_ATTR_SECURE_SII, + INDEX_ATTR_SECURE_SDH, + INDEX_ATTR_OBJID_O, + INDEX_ATTR_REPARSE_R, + INDEX_ATTR_QUOTA_O, + INDEX_ATTR_QUOTA_Q, +} INDEX_ATTR_TYPE; + /** * ntfs_dump_index_entries() * * dump sequence of index_entries and return number of entries dumped. */ -static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) +static int ntfs_dump_index_entries(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) { int numb_entries = 1; char *name = NULL; @@ -1145,12 +1157,12 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) break; switch (type) { - case(AT_FILE_NAME): + case(INDEX_ATTR_DIRECTORY_I30): ntfs_log_verbose("\t\tFILE record number:\t %llu\n", MREF_LE(entry->indexed_file)); if (opts.verbose) { printf("\t"); - ntfs_dump_flags(type, entry->key. + ntfs_dump_flags(AT_FILE_NAME, entry->key. file_name.file_attributes); printf("\t"); ntfs_dump_namespace(entry->key. @@ -1188,14 +1200,85 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, ATTR_TYPES type) return numb_entries; } +#define COMPARE_INDEX_NAMES(attr, name) \ + ntfs_names_are_equal((name), sizeof(name) / 2 - 1, \ + (ntfschar*)((char*)(attr) + le16_to_cpu((attr)->name_offset)), \ + (attr)->name_length, 0, NULL, 0) + +static int get_index_root(ntfs_inode *ni, ATTR_RECORD *attr, INDEX_ROOT *iroot); + +static INDEX_ATTR_TYPE get_index_attr_type(ntfs_inode *ni, ATTR_RECORD *attr, + INDEX_ROOT *index_root) +{ + char file_name[64]; + + if (!attr->name_length) + return INDEX_ATTR_UNKNOWN; + + if (index_root->type) { + if (index_root->type == AT_FILE_NAME) + return INDEX_ATTR_DIRECTORY_I30; + else + /* weird, this should be illegal */ + ntfs_log_error("Unknown index attribute type: 0x%0X\n", + index_root->type); + return INDEX_ATTR_UNKNOWN; + } + + if (utils_is_metadata(ni) <= 0) + return INDEX_ATTR_UNKNOWN; + if (utils_inode_get_name(ni, file_name, sizeof(file_name)) <= 0) + return INDEX_ATTR_UNKNOWN; + + if (COMPARE_INDEX_NAMES(attr, NTFS_INDEX_SDH)) + return INDEX_ATTR_SECURE_SDH; + else if (COMPARE_INDEX_NAMES(attr, NTFS_INDEX_SII)) + return INDEX_ATTR_SECURE_SII; + else if (COMPARE_INDEX_NAMES(attr, NTFS_INDEX_SII)) + return INDEX_ATTR_SECURE_SII; + else if (COMPARE_INDEX_NAMES(attr, NTFS_INDEX_Q)) + return INDEX_ATTR_QUOTA_Q; + else if (COMPARE_INDEX_NAMES(attr, NTFS_INDEX_R)) + return INDEX_ATTR_REPARSE_R; + else if (COMPARE_INDEX_NAMES(attr, NTFS_INDEX_O)) { + if (!strcmp(file_name, "/$Extend/$Quota")) + return INDEX_ATTR_QUOTA_O; + else + return INDEX_ATTR_OBJID_O; + } + + return INDEX_ATTR_UNKNOWN; +} + +static void ntfs_dump_index_attr_type(INDEX_ATTR_TYPE type) +{ + if (type == INDEX_ATTR_DIRECTORY_I30) + printf("DIRECTORY_I30"); + else if (type == INDEX_ATTR_SECURE_SDH) + printf("SECURE_SDH"); + else if (type == INDEX_ATTR_SECURE_SII) + printf("SECURE_SII"); + else if (type == INDEX_ATTR_OBJID_O) + printf("OBJID_O"); + else if (type == INDEX_ATTR_QUOTA_O) + printf("QUOTA_O"); + else if (type == INDEX_ATTR_QUOTA_Q) + printf("QUOTA_Q"); + else if (type == INDEX_ATTR_REPARSE_R) + printf("REPARSE_R"); + else + printf("UNKNOWN"); + printf("\n"); +} + /** * ntfs_dump_attr_index_root() * * dump the index_root attribute */ -static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) +static void ntfs_dump_attr_index_root(ATTR_RECORD *attr, ntfs_inode *ni) { - unsigned int type; + INDEX_ATTR_TYPE type; INDEX_ROOT *index_root = NULL; INDEX_ENTRY *entry; @@ -1222,22 +1305,10 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) printf("\tAttribute instance:\t %u\n", le16_to_cpu(attr->instance)); /* attr_type dumping */ + type = get_index_attr_type(ni, attr, index_root); printf("\tIndexed Attr Type:\t "); - type = le32_to_cpu(index_root->type); - if (type) { - if (index_root->type != AT_FILE_NAME) { - /* weird, this should be illgeal */ - printf("0x%0X\n", type); - ntfs_log_error("ntfsinfo error: Unknown Indexed Attr " - "Type: 0x%0X\n", type); - } else { - printf("file names\n"); - } - } else { - /* fixme: add some more index types */ - printf("unknown\n"); - } - + ntfs_dump_index_attr_type(type); + /* collation rule dumping */ printf("\tCollation Rule:\t\t %u\n", (unsigned int)le32_to_cpu(index_root->collation_rule)); @@ -1263,16 +1334,15 @@ static void ntfs_dump_attr_index_root(ATTR_RECORD *attr) le32_to_cpu(index_root->index.entries_offset) + 0x10); ntfs_log_verbose("\tDumping index block:"); printf("\tIndex entries total:\t %d\n", - ntfs_dump_index_entries(entry, index_root->type)); + ntfs_dump_index_entries(entry, type)); } /** - * ntfs_dump_attr_index_allocation() + * get_index_root() * - * determine size and type of INDX record + * determine size, type and the collation rule of INDX record */ -static int get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, - ATTR_TYPES *type, u32 *size) +static int get_index_root(ntfs_inode *ni, ATTR_RECORD *attr, INDEX_ROOT *iroot) { ntfs_attr_search_ctx *ctx; ntfschar *name = 0; @@ -1303,8 +1373,7 @@ static int get_type_and_size_of_indx(ntfs_inode *ni, ATTR_RECORD *attr, root = (INDEX_ROOT*)((u8*)ctx->attr + le16_to_cpu(ctx->attr->value_offset)); - *size = le32_to_cpu(root->index_block_size); - *type = root->type; + *iroot = *root; ntfs_attr_put_search_ctx(ctx); free(name); return 0; @@ -1319,8 +1388,8 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) { INDEX_ALLOCATION *allocation, *tmp_alloc; INDEX_ENTRY *entry; - ATTR_TYPES type; - u32 indx_record_size; + INDEX_ROOT index_root; + INDEX_ATTR_TYPE type; int total_entries = 0; int total_indx_blocks = 0; ntfs_attr *na; @@ -1328,8 +1397,10 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) int bit; ntfschar *name; - if (get_type_and_size_of_indx(ni, attr, &type, &indx_record_size)) + if (get_index_root(ni, attr, &index_root)) return; + + type = get_index_attr_type(ni, attr, &index_root); name = (ntfschar*)((u8*)attr + attr->name_offset); na = ntfs_attr_open(ni, AT_BITMAP, name, attr->name_length); @@ -1376,7 +1447,7 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) while ((u8 *)tmp_alloc < (u8 *)allocation + na->data_size) { if (*byte & (1 << bit)) { if (ntfs_mst_post_read_fixup((NTFS_RECORD *) tmp_alloc, - indx_record_size)) { + index_root.index_block_size)) { ntfs_log_perror("Damaged INDX record"); goto free; } @@ -1392,8 +1463,8 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni) total_entries += ntfs_dump_index_entries(entry, type); total_indx_blocks++; } - tmp_alloc = (INDEX_ALLOCATION *)((u8 *)tmp_alloc + - indx_record_size); + tmp_alloc = (INDEX_ALLOCATION *)((u8 *)tmp_alloc + + index_root.index_block_size); bit++; if (bit > 7) { bit = 0; @@ -1827,7 +1898,7 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) ntfs_dump_attr_data(ctx->attr, inode->vol); break; case AT_INDEX_ROOT: - ntfs_dump_attr_index_root(ctx->attr); + ntfs_dump_attr_index_root(ctx->attr, inode); break; case AT_INDEX_ALLOCATION: ntfs_dump_attr_index_allocation(ctx->attr, inode); From c47717581affa1a22878f2fdf5e0fa77cbb1e2f7 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 30 Oct 2005 23:31:44 +0000 Subject: [PATCH 2677/2994] dump index attribute keys --- ChangeLog | 1 + ntfsprogs/ntfsinfo.c | 55 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5380b5f4..ad4d223f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -55,6 +55,7 @@ xx/xx/2005 - 1.12.2-WIP - ntfsinfo and ntfsls follow the convention how other utilities read the device argument: no -d or --device option is needed. (Szaka) - ntfsinfo: figure out and dump index attribute types. (Szaka) + - ntfsinfo: dump index attribute keys. (Szaka) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index f2b355bb..53ed1c0d 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1122,6 +1122,58 @@ typedef enum { INDEX_ATTR_QUOTA_Q, } INDEX_ATTR_TYPE; +static void ntfs_dump_index_key(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) +{ + unsigned i; + char printable_GUID[37]; + + switch (type) { + case INDEX_ATTR_SECURE_SII: + ntfs_log_verbose("\t\tKey security id:\t %u\n", + le32_to_cpu(entry->key.sii.security_id)); + break; + case INDEX_ATTR_SECURE_SDH: + ntfs_log_verbose("\t\tKey hash:\t\t 0x%04x\n", + le32_to_cpu(entry->key.sdh.hash)); + ntfs_log_verbose("\t\tKey security id:\t %u\n", + le32_to_cpu(entry->key.sdh.security_id)); + break; + case INDEX_ATTR_OBJID_O: + ntfs_guid_to_mbs(&entry->key.object_id, printable_GUID); + ntfs_log_verbose("\t\tKey GUID:\t\t %s\n", printable_GUID); + break; + case INDEX_ATTR_REPARSE_R: + ntfs_log_verbose("\t\tKey reparse tag:\t 0x%04x\n", + le32_to_cpu(entry->key.reparse.reparse_tag)); + ntfs_log_verbose("\t\tKey file id:\t\t %llu\n", + le64_to_cpu(entry->key.reparse.file_id)); + break; + case INDEX_ATTR_QUOTA_O: + ntfs_log_verbose("\t\tKey revision:\t\t %u\n", + entry->key.sid.revision); + ntfs_log_verbose("\t\tKey sub authority count: %u\n", + entry->key.sid.sub_authority_count); + ntfs_log_verbose("\t\tKey ident. auth. high: %u\n", + le16_to_cpu(entry->key.sid. + identifier_authority.high_part)); + ntfs_log_verbose("\t\tKey ident. auth. low: %u\n", + le32_to_cpu(entry->key.sid. + identifier_authority.low_part)); + for (i = 0; i < entry->key.sid.sub_authority_count; i++) + ntfs_log_verbose("\t\tKey sub authority:\t %u\n", + le32_to_cpu(entry->key.sid.sub_authority)); + break; + case INDEX_ATTR_QUOTA_Q: + ntfs_log_verbose("\t\tKey owner id:\t\t %u\n", + le32_to_cpu(entry->key.owner_id)); + break; + default: + ntfs_log_verbose("\t\tKey is UNKNOWN: \t 0x%04x\n", + le32_to_cpu(type)); + break; + } +} + /** * ntfs_dump_index_entries() * @@ -1185,11 +1237,12 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) entry->key.file_name.allocated_size)); break; default: - // TODO: determine more attribute types ntfs_log_verbose("\t\tData offset:\t\t %u\n", le16_to_cpu(entry->data_offset)); ntfs_log_verbose("\t\tData length:\t\t %u\n", le16_to_cpu(entry->data_length)); + ntfs_dump_index_key(entry, type); + // TODO: dump index attribute data too break; } entry = (INDEX_ENTRY *)((u8 *)entry + From 9c2e3a8206ec4188c623a0a5c9251f0bf172bac9 Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 31 Oct 2005 01:15:12 +0000 Subject: [PATCH 2678/2994] add/update function comment blocks (ok, they need words, but it's a start) --- include/ntfs/attrib.h | 8 +- include/ntfs/bitmap.h | 2 +- include/ntfs/collate.h | 8 ++ include/ntfs/device.h | 9 +- include/ntfs/device_io.h | 3 + include/ntfs/dir.h | 2 +- include/ntfs/index.h | 2 +- include/ntfs/inode.h | 6 +- include/ntfs/layout.h | 251 +++++++++++++++++++++++++++------------ include/ntfs/lcnalloc.h | 3 + include/ntfs/list.h | 17 ++- include/ntfs/logfile.h | 21 ++-- include/ntfs/runlist.h | 3 +- include/ntfs/security.h | 2 +- include/ntfs/tree.h | 2 +- include/ntfs/types.h | 6 +- include/ntfs/volume.h | 12 +- libntfs/dir.c | 5 + libntfs/runlist.c | 2 +- libntfs/win32_io.c | 3 + 20 files changed, 259 insertions(+), 108 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 7f7a27ed..c681ab1a 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -38,7 +38,7 @@ typedef struct _ntfs_attr_search_ctx ntfs_attr_search_ctx; extern ntfschar AT_UNNAMED[]; /** - * ntfs_lcn_special_values - special return values for ntfs_*_vcn_to_lcn() + * enum ntfs_lcn_special_values - special return values for ntfs_*_vcn_to_lcn() * * Special return values for ntfs_rl_vcn_to_lcn() and ntfs_attr_vcn_to_lcn(). * @@ -53,7 +53,7 @@ typedef enum { } ntfs_lcn_special_values; /** - * ntfs_attr_search_ctx - search context used in attribute search functions + * struct ntfs_attr_search_ctx - search context used in attribute search functions * @mrec: buffer containing mft record to search * @attr: attribute record in @mrec where to begin/continue search * @is_first: if true lookup_attr() begins search with @attr, else after @attr @@ -126,7 +126,7 @@ static __inline__ int ntfs_attrs_walk(ntfs_attr_search_ctx *ctx) } /** - * ntfs_attr - ntfs in memory non-resident attribute structure + * struct ntfs_attr - ntfs in memory non-resident attribute structure * @rl: if not NULL, the decompressed runlist * @ni: base ntfs inode to which this attribute belongs * @type: attribute type @@ -184,7 +184,7 @@ struct _ntfs_attr { }; /** - * ntfs_attr_state_bits - bits for the state field in the ntfs_attr structure + * enum ntfs_attr_state_bits - bits for the state field in the ntfs_attr structure */ typedef enum { NA_Initialized, /* 1: structure is initialized. */ diff --git a/include/ntfs/bitmap.h b/include/ntfs/bitmap.h index ef8e77ba..1910cb52 100644 --- a/include/ntfs/bitmap.h +++ b/include/ntfs/bitmap.h @@ -138,7 +138,7 @@ static __inline__ int ntfs_bitmap_clear_bit(ntfs_attr *na, s64 bit) #include "inode.h" /** - * struct ntfs_bmp + * struct ntfs_bmp - * a cache for either dir/$BITMAP, $MFT/$BITMAP or $Bitmap/$DATA */ struct ntfs_bmp { diff --git a/include/ntfs/collate.h b/include/ntfs/collate.h index ee92e43d..2191ba59 100644 --- a/include/ntfs/collate.h +++ b/include/ntfs/collate.h @@ -29,6 +29,14 @@ #define NTFS_COLLATION_ERROR -2 +/** + * ntfs_is_collation_rule_supported - + * @cr: + * + * Description... + * + * Returns: + */ static inline BOOL ntfs_is_collation_rule_supported(COLLATION_RULES cr) { int i; diff --git a/include/ntfs/device.h b/include/ntfs/device.h index 4d4b323c..2a41bcf9 100644 --- a/include/ntfs/device.h +++ b/include/ntfs/device.h @@ -31,7 +31,8 @@ #include "support.h" #include "volume.h" -/* +/** + * enum ntfs_device_state_bits - * Defined bits for the state field in the ntfs_device structure. */ typedef enum { @@ -56,7 +57,8 @@ typedef enum { #define NDevSetDirty(nd) set_ndev_flag(nd, Dirty) #define NDevClearDirty(nd) clear_ndev_flag(nd, Dirty) -/* +/** + * struct ntfs_device - * The ntfs device structure defining all operations needed to access the low * level device underlying the ntfs volume. */ @@ -70,7 +72,8 @@ struct ntfs_device { struct stat; -/* +/** + * struct ntfs_device_operations - * The ntfs device operations defining all operations that can be performed on * the low level device described by an ntfs device structure. */ diff --git a/include/ntfs/device_io.h b/include/ntfs/device_io.h index 8737b871..76e84c79 100644 --- a/include/ntfs/device_io.h +++ b/include/ntfs/device_io.h @@ -37,6 +37,9 @@ #ifndef HDIO_GETGEO # define HDIO_GETGEO 0x10000301 +/** + * struct hd_geometry - + */ struct hd_geometry { unsigned char heads; unsigned char sectors; diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index 868b39af..49fc88fc 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -84,7 +84,7 @@ extern int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos, #ifdef NTFS_RICH /** - * struct ntfs_dir + * struct ntfs_dir - */ struct ntfs_dir { ntfs_volume *vol; diff --git a/include/ntfs/index.h b/include/ntfs/index.h index a86cb7d1..c34da33d 100644 --- a/include/ntfs/index.h +++ b/include/ntfs/index.h @@ -31,7 +31,7 @@ #include "mft.h" /** - * ntfs_index_context - + * struct ntfs_index_context - * @ni: inode containing the @entry described by this context * @name: name of the index described by this context * @name_len: length of the index name diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 0bc0fe6c..2091d557 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -32,7 +32,8 @@ typedef struct _ntfs_inode ntfs_inode; #include "support.h" #include "volume.h" -/* +/** + * enum ntfs_inode_state_bits - * Defined bits for the state field in the ntfs_inode structure. * (f) = files only, (d) = directories only */ @@ -108,7 +109,8 @@ typedef enum { #define NInoFileNameTestAndClearDirty(ni) \ test_and_clear_nino_flag(ni, FileNameDirty) -/* +/** + * struct _ntfs_inode - * The NTFS in-memory inode structure. It is just used as an extension to the * fields already provided in the VFS inode. */ diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 181253f9..4b5a9f45 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -43,7 +43,8 @@ * number of sectors/2 (integer divide), i.e. in the middle of the volume. */ -/* +/** + * struct BIOS_PARAMETER_BLOCK - * BIOS parameter block (bpb) structure. */ typedef struct { @@ -64,7 +65,8 @@ typedef struct { /* sizeof() = 25 (0x19) bytes */ } __attribute__((__packed__)) BIOS_PARAMETER_BLOCK; -/* +/** + * struct NTFS_BOOT_SECTOR - * NTFS boot sector structure. */ typedef struct { @@ -97,7 +99,8 @@ typedef struct { /* sizeof() = 512 (0x200) bytes */ } __attribute__((__packed__)) NTFS_BOOT_SECTOR; -/* +/** + * enum NTFS_RECORD_TYPES - * Magic identifiers present at the beginning of all ntfs record containing * records (like mft records for example). */ @@ -165,7 +168,8 @@ typedef enum { #define NTFS_BLOCK_SIZE 512 #define NTFS_BLOCK_SIZE_BITS 9 -/* +/** + * struct NTFS_RECORD - * The Update Sequence Array (usa) is an array of the u16 values which belong * to the end of each sector protected by the update sequence record in which * this array is contained. Note that the first entry is the Update Sequence @@ -192,7 +196,8 @@ typedef struct { minus 1. */ } __attribute__((__packed__)) NTFS_RECORD; -/* +/** + * enum NTFS_SYSTEM_FILES - * System files mft record numbers. All these files are always marked as used * in the bitmap attribute of the mft; presumably in order to avoid accidental * allocation for random other mft records. Also, the sequence number for each @@ -238,13 +243,13 @@ typedef enum { whether to allow opening a file or not. */ } NTFS_SYSTEM_FILES; -/* +/** + * enum MFT_RECORD_FLAGS - * These are the so far known MFT_RECORD_* flags (16-bit) which contain * information about the mft record in which they are present. * _4 and _8 are needed by $Extend sub-files (don't know what to * call them yet...) */ - typedef enum { MFT_RECORD_IN_USE = const_cpu_to_le16(0x0001), MFT_RECORD_IS_DIRECTORY = const_cpu_to_le16(0x0002), @@ -316,7 +321,8 @@ typedef u64 MFT_REF; #define ERR_MREF(x) ((u64)((s64)(x))) #define MREF_ERR(x) ((int)((s64)(x))) -/* +/** + * struct MFT_RECORD - * The mft record header present at the beginning of every record in the mft. * This is followed by a sequence of variable length attribute records which * is terminated by an attribute of type AT_END which is a truncated attribute @@ -392,7 +398,10 @@ typedef struct { */ } __attribute__((__packed__)) MFT_RECORD; -/* This is the version without the NTFS 3.1+ specific fields. */ +/** + * struct MFT_RECORD_OLD - + * This is the version without the NTFS 3.1+ specific fields. + */ typedef struct { /*Ofs*/ /* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ @@ -459,7 +468,8 @@ typedef struct { */ } __attribute__((__packed__)) MFT_RECORD_OLD; -/* +/** + * enum ATTR_TYPES - * System defined attributes (32-bit). Each attribute type has a corresponding * attribute name (Unicode string of maximum 64 character length) as described * by the attribute definitions present in the data attribute of the $AttrDef @@ -489,7 +499,8 @@ typedef enum { AT_END = const_cpu_to_le32(0xffffffff), } ATTR_TYPES; -/* +/** + * enum COLLATION_RULES - * The collation rules for sorting views/indexes/etc (32-bit). * * COLLATION_UNICODE_STRING - Collate Unicode strings by comparing their binary @@ -543,7 +554,8 @@ typedef enum { COLLATION_NTOFS_ULONGS = const_cpu_to_le32(19), } COLLATION_RULES; -/* +/** + * enum ATTR_DEF_FLAGS - * The flags (32-bit) describing attribute properties in the attribute * definition structure. FIXME: This information is based on Regis's * information and, according to him, it is not certain and probably @@ -578,7 +590,8 @@ typedef enum { resident. */ } ATTR_DEF_FLAGS; -/* +/** + * struct ATTR_DEF - * The data attribute of FILE_AttrDef contains a sequence of attribute * definitions for the NTFS volume. With this, it is supposed to be safe for an * older NTFS driver to mount a volume containing a newer NTFS version without @@ -601,7 +614,8 @@ typedef struct { /* sizeof() = 0xa0 or 160 bytes */ } __attribute__((__packed__)) ATTR_DEF; -/* +/** + * enum ATTR_FLAGS - * Attribute flags (16-bit). */ typedef enum { @@ -680,7 +694,8 @@ typedef enum { * clusters at the end. */ -/* +/** + * enum RESIDENT_ATTR_FLAGS - * Flags of resident attributes (8-bit). */ typedef enum { @@ -689,7 +704,8 @@ typedef enum { modifying the attribute). */ } __attribute__((__packed__)) RESIDENT_ATTR_FLAGS; -/* +/** + * struct ATTR_RECORD - * Attribute record header. Always aligned to 8-byte boundary. */ typedef struct { @@ -796,7 +812,8 @@ typedef struct { typedef ATTR_RECORD ATTR_REC; -/* +/** + * enum FILE_ATTR_FLAGS - * File attribute flags (32-bit). */ typedef enum { @@ -857,7 +874,8 @@ typedef enum { * 00:00:00 UTC and is stored as the number of 1-second intervals since then.) */ -/* +/** + * struct STANDARD_INFORMATION - * Attribute: Standard information (0x10). * * NOTE: Always resident. @@ -949,7 +967,8 @@ typedef struct { /* sizeof() = 72 bytes (NTFS 3.0) */ } __attribute__((__packed__)) STANDARD_INFORMATION; -/* +/** + * struct ATTR_LIST_ENTRY - * Attribute: Attribute list (0x20). * * - Can be either resident or non-resident. @@ -1015,7 +1034,8 @@ typedef struct { */ #define NTFS_MAX_NAME_LEN 255 -/* +/** + * enum FILE_NAME_TYPE_FLAGS - * Possible namespaces for filenames in ntfs (8-bit). */ typedef enum { @@ -1041,7 +1061,8 @@ typedef enum { record. */ } __attribute__((__packed__)) FILE_NAME_TYPE_FLAGS; -/* +/** + * struct FILE_NAME_ATTR - * Attribute: Filename (0x30). * * NOTE: Always resident. @@ -1089,7 +1110,8 @@ typedef struct { /* 42*/ ntfschar file_name[0]; /* File name in Unicode. */ } __attribute__((__packed__)) FILE_NAME_ATTR; -/* +/** + * struct GUID - * GUID structures store globally unique identifiers (GUID). A GUID is a * 128-bit value consisting of one group of eight hexadecimal digits, followed * by three groups of four hexadecimal digits each, followed by one group of @@ -1107,7 +1129,8 @@ typedef struct { final 12 hexadecimal digits. */ } __attribute__((__packed__)) GUID; -/* +/** + * struct OBJ_ID_INDEX_DATA - * FILE_Extend/$ObjId contains an index named $O. This index contains all * object_ids present on the volume as the index keys and the corresponding * mft_record numbers as the index entry data parts. The data part (defined @@ -1131,7 +1154,8 @@ typedef struct { } __attribute__((__packed__)); } __attribute__((__packed__)) OBJ_ID_INDEX_DATA; -/* +/** + * struct OBJECT_ID_ATTR - * Attribute: Object id (NTFS 3.0+) (0x40). * * NOTE: Always resident. @@ -1158,20 +1182,24 @@ typedef struct { } __attribute__((__packed__)); } __attribute__((__packed__)) OBJECT_ID_ATTR; -/* +#if 0 +/** + * enum IDENTIFIER_AUTHORITIES - * The pre-defined IDENTIFIER_AUTHORITIES used as SID_IDENTIFIER_AUTHORITY in * the SID structure (see below). */ -//typedef enum { /* SID string prefix. */ -// SECURITY_NULL_SID_AUTHORITY = {0, 0, 0, 0, 0, 0}, /* S-1-0 */ -// SECURITY_WORLD_SID_AUTHORITY = {0, 0, 0, 0, 0, 1}, /* S-1-1 */ -// SECURITY_LOCAL_SID_AUTHORITY = {0, 0, 0, 0, 0, 2}, /* S-1-2 */ -// SECURITY_CREATOR_SID_AUTHORITY = {0, 0, 0, 0, 0, 3}, /* S-1-3 */ -// SECURITY_NON_UNIQUE_AUTHORITY = {0, 0, 0, 0, 0, 4}, /* S-1-4 */ -// SECURITY_NT_SID_AUTHORITY = {0, 0, 0, 0, 0, 5}, /* S-1-5 */ -//} IDENTIFIER_AUTHORITIES; +typedef enum { /* SID string prefix. */ + SECURITY_NULL_SID_AUTHORITY = {0, 0, 0, 0, 0, 0}, /* S-1-0 */ + SECURITY_WORLD_SID_AUTHORITY = {0, 0, 0, 0, 0, 1}, /* S-1-1 */ + SECURITY_LOCAL_SID_AUTHORITY = {0, 0, 0, 0, 0, 2}, /* S-1-2 */ + SECURITY_CREATOR_SID_AUTHORITY = {0, 0, 0, 0, 0, 3}, /* S-1-3 */ + SECURITY_NON_UNIQUE_AUTHORITY = {0, 0, 0, 0, 0, 4}, /* S-1-4 */ + SECURITY_NT_SID_AUTHORITY = {0, 0, 0, 0, 0, 5}, /* S-1-5 */ +} IDENTIFIER_AUTHORITIES; +#endif -/* +/** + * enum RELATIVE_IDENTIFIERS - * These relative identifiers (RIDs) are used with the above identifier * authorities to make up universal well-known SIDs. * @@ -1301,7 +1329,8 @@ typedef union { u8 value[6]; /* Value as individual bytes. */ } __attribute__((__packed__)) SID_IDENTIFIER_AUTHORITY; -/* +/** + * struct SID - * The SID structure is a variable-length structure used to uniquely identify * users or groups. SID stands for security identifier. * @@ -1334,7 +1363,8 @@ typedef struct { u32 sub_authority[1]; /* At least one sub_authority. */ } __attribute__((__packed__)) SID; -/* +/** + * enum SID_CONSTANTS - * Current constants for SIDs. */ typedef enum { @@ -1344,7 +1374,8 @@ typedef enum { a future revision. */ } SID_CONSTANTS; -/* +/** + * enum ACE_TYPES - * The predefined ACE types (8-bit, see below). */ typedef enum { @@ -1372,7 +1403,8 @@ typedef enum { ACCESS_MAX_MS_ACE_TYPE = 8, } __attribute__((__packed__)) ACE_TYPES; -/* +/** + * enum ACE_FLAGS - * The ACE flags (8-bit) for audit and inheritance (see below). * * SUCCESSFUL_ACCESS_ACE_FLAG is only used with system audit and alarm ACE @@ -1396,7 +1428,8 @@ typedef enum { FAILED_ACCESS_ACE_FLAG = 0x80, } __attribute__((__packed__)) ACE_FLAGS; -/* +/** + * struct ACE_HEADER - * An ACE is an access-control entry in an access-control list (ACL). * An ACE defines access to an object for a specific user or group or defines * the types of access that generate system-administration messages or alarms @@ -1413,7 +1446,8 @@ typedef struct { u16 size; /* Size in bytes of the ACE. */ } __attribute__((__packed__)) ACE_HEADER; -/* +/** + * enum ACCESS_MASK - * The access mask (32-bit). Defines the access rights. */ typedef enum { @@ -1546,7 +1580,8 @@ typedef enum { GENERIC_READ = const_cpu_to_le32(0x80000000), } ACCESS_MASK; -/* +/** + * struct GENERIC_MAPPING - * The generic mapping array. Used to denote the mapping of each generic * access right to a specific access mask. * @@ -1563,7 +1598,8 @@ typedef struct { * The predefined ACE type structures are as defined below. */ -/* +/** + * struct ACCESS_DENIED_ACE - * ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE */ typedef struct { @@ -1577,7 +1613,8 @@ typedef struct { } __attribute__((__packed__)) ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE; -/* +/** + * enum OBJECT_ACE_FLAGS - * The object ACE flags (32-bit). */ typedef enum { @@ -1585,6 +1622,9 @@ typedef enum { ACE_INHERITED_OBJECT_TYPE_PRESENT = const_cpu_to_le32(2), } OBJECT_ACE_FLAGS; +/** + * struct ACCESS_ALLOWED_OBJECT_ACE - + */ typedef struct { /* 0 ACE_HEADER; -- Unfolded here as gcc doesn't like unnamed structs. */ ACE_TYPES type; /* Type of the ACE. */ @@ -1601,7 +1641,8 @@ typedef struct { SYSTEM_AUDIT_OBJECT_ACE, SYSTEM_ALARM_OBJECT_ACE; -/* +/** + * struct ACL - * An ACL is an access-control list (ACL). * An ACL starts with an ACL header structure, which specifies the size of * the ACL and the number of ACEs it contains. The ACL header is followed by @@ -1618,7 +1659,8 @@ typedef struct { /* sizeof() = 8 bytes */ } __attribute__((__packed__)) ACL; -/* +/** + * enum ACL_CONSTANTS - * Current constants for ACLs. */ typedef enum { @@ -1635,7 +1677,8 @@ typedef enum { MAX_ACL_REVISION = 4, } ACL_CONSTANTS; -/* +/** + * enum SECURITY_DESCRIPTOR_CONTROL - * The security descriptor control flags (16-bit). * * SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the @@ -1699,7 +1742,8 @@ typedef enum { SE_SELF_RELATIVE = const_cpu_to_le16(0x8000), } __attribute__((__packed__)) SECURITY_DESCRIPTOR_CONTROL; -/* +/** + * struct SECURITY_DESCRIPTOR_RELATIVE - * Self-relative security descriptor. Contains the owner and group SIDs as well * as the sacl and dacl ACLs inside the security descriptor itself. */ @@ -1725,7 +1769,8 @@ typedef struct { /* sizeof() = 0x14 bytes */ } __attribute__((__packed__)) SECURITY_DESCRIPTOR_RELATIVE; -/* +/** + * struct SECURITY_DESCRIPTOR - * Absolute security descriptor. Does not contain the owner and group SIDs, nor * the sacl and dacl ACLs inside the security descriptor. Instead, it contains * pointers to these structures in memory. Obviously, absolute security @@ -1753,7 +1798,8 @@ typedef struct { (unconditionally granting access) is specified. */ } __attribute__((__packed__)) SECURITY_DESCRIPTOR; -/* +/** + * enum SECURITY_DESCRIPTOR_CONSTANTS - * Current constants for security descriptors. */ typedef enum { @@ -1816,7 +1862,8 @@ typedef SECURITY_DESCRIPTOR_RELATIVE SECURITY_DESCRIPTOR_ATTR; * references an entry any more. */ -/* +/** + * struct SECURITY_DESCRIPTOR_HEADER - * This header precedes each security descriptor in the $SDS data stream. * This is also the index entry data part of both the $SII and $SDH indexes. */ @@ -1827,6 +1874,9 @@ typedef struct { u32 length; /* Size in bytes of this entry in $SDS stream. */ } __attribute__((__packed__)) SECURITY_DESCRIPTOR_HEADER; +/** + * struct SDH_INDEX_DATA - + */ typedef struct { u32 hash; /* Hash of the security descriptor. */ u32 security_id; /* The security_id assigned to the descriptor. */ @@ -1835,6 +1885,9 @@ typedef struct { u64 reserved_II; /* Padding - always unicode "II" */ } __attribute__((__packed__)) SDH_INDEX_DATA; +/** + * struct SII_INDEX_DATA - + */ typedef struct { u32 hash; /* Hash of the security descriptor. */ u32 security_id; /* The security_id assigned to the descriptor. */ @@ -1842,11 +1895,15 @@ typedef struct { u32 size_in_sds; /* Size of the descriptor in SDS data stream */ } __attribute__((__packed__)) SII_INDEX_DATA; +/** + * struct QUOTA_O_INDEX_DATA - + */ typedef struct { u64 owner_id; } __attribute__((__packed__)) QUOTA_O_INDEX_DATA; -/* +/** + * struct SDS_ENTRY - * The $SDS data stream contains the security descriptors, aligned on 16-byte * boundaries, sorted by security_id in a B+ tree. Security descriptors cannot * cross 256kib boundaries (this restriction is imposed by the Windows cache @@ -1868,7 +1925,8 @@ typedef struct { descriptor. */ } __attribute__((__packed__)) SDS_ENTRY; -/* +/** + * struct SII_INDEX_KEY - * The index entry key used in the $SII index. The collation type is * COLLATION_NTOFS_ULONG. */ @@ -1876,7 +1934,8 @@ typedef struct { u32 security_id; /* The security_id assigned to the descriptor. */ } __attribute__((__packed__)) SII_INDEX_KEY; -/* +/** + * struct SDH_INDEX_KEY - * The index entry key used in the $SDH index. The keys are sorted first by * hash and then by security_id. The collation rule is * COLLATION_NTOFS_SECURITY_HASH. @@ -1886,7 +1945,8 @@ typedef struct { u32 security_id; /* The security_id assigned to the descriptor. */ } __attribute__((__packed__)) SDH_INDEX_KEY; -/* +/** + * struct VOLUME_NAME - * Attribute: Volume name (0x60). * * NOTE: Always resident. @@ -1896,7 +1956,8 @@ typedef struct { ntfschar name[0]; /* The name of the volume in Unicode. */ } __attribute__((__packed__)) VOLUME_NAME; -/* +/** + * enum VOLUME_FLAGS - * Possible flags for the volume (16-bit). */ typedef enum { @@ -1910,7 +1971,8 @@ typedef enum { VOLUME_FLAGS_MASK = const_cpu_to_le16(0x803f), } __attribute__((__packed__)) VOLUME_FLAGS; -/* +/** + * struct VOLUME_INFORMATION - * Attribute: Volume information (0x70). * * NOTE: Always resident. @@ -1925,7 +1987,8 @@ typedef struct { VOLUME_FLAGS flags; /* Bit array of VOLUME_* flags. */ } __attribute__((__packed__)) VOLUME_INFORMATION; -/* +/** + * struct DATA_ATTR - * Attribute: Data attribute (0x80). * * NOTE: Can be resident or non-resident. @@ -1936,7 +1999,8 @@ typedef struct { u8 data[0]; /* The file's data contents. */ } __attribute__((__packed__)) DATA_ATTR; -/* +/** + * enum INDEX_HEADER_FLAGS - * Index header flags (8-bit). */ typedef enum { @@ -1958,7 +2022,8 @@ typedef enum { NODE_MASK = 1, /* Mask for accessing the *_NODE bits. */ } __attribute__((__packed__)) INDEX_HEADER_FLAGS; -/* +/** + * struct INDEX_HEADER - * This is the header for indexes, describing the INDEX_ENTRY records, which * follow the INDEX_HEADER. Together the index header and the index entries * make up a complete index. @@ -1986,7 +2051,8 @@ typedef struct { u8 reserved[3]; /* Reserved/align to 8-byte boundary. */ } __attribute__((__packed__)) INDEX_HEADER; -/* +/** + * struct INDEX_ROOT - * Attribute: Index root (0x90). * * NOTE: Always resident. @@ -2028,7 +2094,8 @@ typedef struct { following index entries. */ } __attribute__((__packed__)) INDEX_ROOT; -/* +/** + * struct INDEX_BLOCK - * Attribute: Index allocation (0xa0). * * NOTE: Always non-resident (doesn't make sense to be resident anyway!). @@ -2061,7 +2128,8 @@ typedef struct { typedef INDEX_BLOCK INDEX_ALLOCATION; -/* +/** + * struct REPARSE_INDEX_KEY - * The system file FILE_Extend/$Reparse contains an index named $R listing * all reparse points on the volume. The index entry keys are as defined * below. Note, that there is no index data associated with the index entries. @@ -2076,7 +2144,8 @@ typedef struct { reparse point attribute. */ } __attribute__((__packed__)) REPARSE_INDEX_KEY; -/* +/** + * enum QUOTA_FLAGS - * Quota flags (32-bit). */ typedef enum { @@ -2100,7 +2169,8 @@ typedef enum { QUOTA_FLAG_PENDING_DELETES = const_cpu_to_le32(0x00000800), } QUOTA_FLAGS; -/* +/** + * struct QUOTA_CONTROL_ENTRY - * The system file FILE_Extend/$Quota contains two indexes $O and $Q. Quotas * are on a per volume and per user basis. * @@ -2134,7 +2204,8 @@ typedef struct { defaults entry. */ } __attribute__((__packed__)) QUOTA_CONTROL_ENTRY; -/* +/** + * enum PREDEFINED_OWNER_IDS - * Predefined owner_id values (32-bit). */ typedef enum { @@ -2143,7 +2214,8 @@ typedef enum { QUOTA_FIRST_USER_ID = const_cpu_to_le32(0x00000100), } PREDEFINED_OWNER_IDS; -/* +/** + * enum INDEX_ENTRY_FLAGS - * Index entry flags (16-bit). */ typedef enum { @@ -2158,7 +2230,8 @@ typedef enum { INDEX_ENTRY_SPACE_FILLER = 0xffff, /* Just to force 16-bit width. */ } __attribute__((__packed__)) INDEX_ENTRY_FLAGS; -/* +/** + * struct INDEX_ENTRY_HEADER - * This the index entry header (see below). */ typedef struct { @@ -2185,7 +2258,8 @@ typedef struct { /* sizeof() = 16 bytes */ } __attribute__((__packed__)) INDEX_ENTRY_HEADER; -/* +/** + * struct INDEX_ENTRY - * This is an index entry. A sequence of such entries follows each INDEX_HEADER * structure. Together they make up a complete index. The index follows either * an index root attribute or an index allocation attribute. @@ -2251,7 +2325,8 @@ typedef struct { // where sizeof(VCN) can be hardcoded as 8 if wanted. */ } __attribute__((__packed__)) INDEX_ENTRY; -/* +/** + * struct BITMAP_ATTR - * Attribute: Bitmap (0xb0). * * Contains an array of bits (aka a bitfield). @@ -2265,7 +2340,8 @@ typedef struct { u8 bitmap[0]; /* Array of bits. */ } __attribute__((__packed__)) BITMAP_ATTR; -/* +/** + * enum PREDEFINED_REPARSE_TAGS - * The reparse point tag defines the type of the reparse point. It also * includes several flags, which further describe the reparse point. * @@ -2306,7 +2382,8 @@ typedef enum { IO_REPARSE_TAG_VALID_VALUES = const_cpu_to_le32(0xe000ffff), } PREDEFINED_REPARSE_TAGS; -/* +/** + * struct REPARSE_POINT - * Attribute: Reparse point (0xc0). * * NOTE: Can be resident or non-resident. @@ -2318,7 +2395,8 @@ typedef struct { u8 reparse_data[0]; /* Meaning depends on reparse_tag. */ } __attribute__((__packed__)) REPARSE_POINT; -/* +/** + * struct EA_INFORMATION - * Attribute: Extended attribute (EA) information (0xd0). * * NOTE: Always resident. @@ -2335,7 +2413,8 @@ typedef struct { attributes. */ } __attribute__((__packed__)) EA_INFORMATION; -/* +/** + * enum EA_FLAGS - * Extended attribute flags (8-bit). */ typedef enum { @@ -2345,7 +2424,8 @@ typedef enum { attributes. */ } __attribute__((__packed__)) EA_FLAGS; -/* +/** + * struct EA_ATTR - * Attribute: Extended attribute (EA) (0xe0). * * Like the attribute list and the index buffer list, the EA attribute value is @@ -2365,7 +2445,8 @@ typedef struct { follows the name. */ } __attribute__((__packed__)) EA_ATTR; -/* +/** + * struct PROPERTY_SET - * Attribute: Property set (0xf0). * * Intended to support Native Structure Storage (NSS) - a feature removed from @@ -2375,7 +2456,8 @@ typedef struct { /* Irrelevant as feature unused. */ } __attribute__((__packed__)) PROPERTY_SET; -/* +/** + * struct LOGGED_UTILITY_STREAM - * Attribute: Logged utility stream (0x100). * * NOTE: Can be resident or non-resident. @@ -2417,7 +2499,10 @@ typedef struct { * is invalid. */ -/* The header of the 0x100 attribute named "$EFS". */ +/** + * struct EFS_ATTR_HEADER - + * The header of the 0x100 attribute named "$EFS". + */ typedef struct { /* 0*/ u32 length; /* Length of EFS attribute in bytes. */ u32 state; /* Always 0? */ @@ -2435,11 +2520,17 @@ typedef struct { u32 reserved; /* Reserved. */ } __attribute__((__packed__)) EFS_ATTR_HEADER; +/** + * struct EFS_DF_ARRAY_HEADER - + */ typedef struct { u32 df_count; /* Number of data decryption/recovery fields in the array. */ } __attribute__((__packed__)) EFS_DF_ARRAY_HEADER; +/** + * struct EFS_DF_HEADER - + */ typedef struct { /* 0*/ u32 df_length; /* Length of this data decryption/recovery field in bytes. */ @@ -2451,6 +2542,9 @@ typedef struct { /* 16*/ u32 unknown1; /* always 0? Might be just padding. */ } __attribute__((__packed__)) EFS_DF_HEADER; +/** + * struct EFS_DF_CREDENTIAL_HEADER - + */ typedef struct { /* 0*/ u32 cred_length; /* Length of this credential in bytes. */ u32 sid_offset; /* Offset in bytes to the user's sid from start @@ -2492,6 +2586,9 @@ typedef struct { typedef EFS_DF_CREDENTIAL_HEADER EFS_DF_CRED_HEADER; +/** + * struct EFS_DF_CERTIFICATE_THUMBPRINT_HEADER - + */ typedef struct { /* 0*/ u32 thumbprint_offset; /* Offset in bytes to the thumbprint. */ u32 thumbprint_size; /* Size of thumbprint in bytes. */ diff --git a/include/ntfs/lcnalloc.h b/include/ntfs/lcnalloc.h index 0063b575..07ab020d 100644 --- a/include/ntfs/lcnalloc.h +++ b/include/ntfs/lcnalloc.h @@ -28,6 +28,9 @@ #include "runlist.h" #include "volume.h" +/** + * enum NTFS_CLUSTER_ALLOCATION_ZONES - + */ typedef enum { FIRST_ZONE = 0, /* For sanity checking. */ MFT_ZONE = 0, /* Allocate from $MFT zone. */ diff --git a/include/ntfs/list.h b/include/ntfs/list.h index 73041234..6a0188a6 100644 --- a/include/ntfs/list.h +++ b/include/ntfs/list.h @@ -22,7 +22,8 @@ #ifndef _NTFS_LIST_H #define _NTFS_LIST_H -/* +/** + * struct list_head - * Simple doubly linked list implementation. - Copied from Linux kernel * 2.4.2-ac18 into Linux-NTFS (with minor modifications). - AIA * @@ -32,7 +33,6 @@ * generate better code by using them directly rather than * using the generic single-entry routines. */ - struct list_head { struct list_head *next, *prev; }; @@ -46,7 +46,12 @@ struct list_head { (ptr)->next = (ptr); (ptr)->prev = (ptr); \ } while (0) -/* +/** + * __list_add - + * @new: + * @prev: + * @next: + * * Insert a new entry between two known consecutive entries. * * This is only for internal list manipulation where we know the prev/next @@ -87,7 +92,11 @@ static __inline__ void list_add_tail(struct list_head *new, struct list_head *he __list_add(new, head->prev, head); } -/* +/** + * __list_del - + * @prev: + * @next: + * * Delete a list entry by making the prev/next entries point to each other. * * This is only for internal list manipulation where we know the prev/next diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index 7bfe5d8f..622f050b 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -56,7 +56,8 @@ #define DefaultLogPageSize 4096 #define MinLogRecordPages 48 -/* +/** + * struct RESTART_PAGE_HEADER - * Log file restart page header (begins the restart area). */ typedef struct { @@ -113,7 +114,8 @@ enum { typedef le16 RESTART_AREA_FLAGS; -/* +/** + * struct RESTART_AREA - * Log file restart area record. The offset of this record is found by adding * the offset of the RESTART_PAGE_HEADER to the restart_area_offset value found * in it. See notes at restart_area_offset above. @@ -252,7 +254,8 @@ typedef struct { /* sizeof() = 48 (0x30) bytes */ } __attribute__((__packed__)) RESTART_AREA; -/* +/** + * struct LOG_CLIENT_RECORD - * Log client record. The offset of this record is found by adding the offset * of the RESTART_AREA to the client_array_offset value found in it. */ @@ -291,7 +294,8 @@ typedef struct { /* sizeof() = 160 (0xa0) bytes */ } __attribute__((__packed__)) LOG_CLIENT_RECORD; -/* +/** + * struct RECORD_PAGE_HEADER - * Log page record page header. Each log page begins with this header and is * followed by several LOG_RECORD structures, starting at offset 0x40 (the * size of this structure and the following update sequence array and then @@ -322,7 +326,8 @@ typedef struct { } __attribute__((__packed__)) header; } __attribute__((__packed__)) RECORD_PAGE_HEADER; -/* +/** + * enum LOG_RECORD_FLAGS - * Possible 16-bit flags for log records. (Or is it log record pages?) */ typedef enum { @@ -332,7 +337,8 @@ typedef enum { gcc knows to make the flags 16-bit. */ } __attribute__((__packed__)) LOG_RECORD_FLAGS; -/* +/** + * struct LOG_CLIENT_ID - * The log client id structure identifying a log client. */ typedef struct { @@ -340,7 +346,8 @@ typedef struct { u16 client_index; } __attribute__((__packed__)) LOG_CLIENT_ID; -/* +/** + * struct LOG_RECORD - * Log record header. Each log record seems to have a constant size of 0x70 * bytes. */ diff --git a/include/ntfs/runlist.h b/include/ntfs/runlist.h index 26c4a565..764d4c9a 100644 --- a/include/ntfs/runlist.h +++ b/include/ntfs/runlist.h @@ -32,7 +32,8 @@ typedef runlist_element runlist; #include "attrib.h" #include "volume.h" -/* +/** + * struct _runlist_element - * runlist_element - in memory vcn to lcn mapping array element * @vcn: starting vcn of the current array element * @lcn: starting lcn of the current array element diff --git a/include/ntfs/security.h b/include/ntfs/security.h index 3a579d97..e477eb12 100644 --- a/include/ntfs/security.h +++ b/include/ntfs/security.h @@ -33,7 +33,7 @@ extern char *ntfs_guid_to_mbs(const GUID *guid, char *guid_str); /** * ntfs_sid_is_valid - determine if a SID is valid - * @sid: [IN] SID for which to determine if it is valid + * @sid: SID for which to determine if it is valid * * Determine if the SID pointed to by @sid is valid. * diff --git a/include/ntfs/tree.h b/include/ntfs/tree.h index d7960663..4e2745c4 100644 --- a/include/ntfs/tree.h +++ b/include/ntfs/tree.h @@ -28,7 +28,7 @@ struct ntfs_dir; /** - * struct ntfs_dt + * struct ntfs_dt - */ struct ntfs_dt { struct ntfs_dir *dir; diff --git a/include/ntfs/types.h b/include/ntfs/types.h index fa49fc7a..e6dc111f 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -81,7 +81,8 @@ typedef sle64 leLSN; * As long as this file will be included after were fine. */ #ifndef _WINDEF_H -/* +/** + * enum BOOL - * These are just to make the code more readable... */ typedef enum { @@ -94,6 +95,9 @@ typedef enum { } BOOL; #endif /* defined _WINDEF_H */ +/** + * enum IGNORE_CASE_BOOL - + */ typedef enum { CASE_SENSITIVE = 0, IGNORE_CASE = 1, diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 715c0320..9ee4a137 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -43,6 +43,9 @@ /* Both under Cygwin and DJGPP we do not have MS_RDONLY, so we define it. */ #if !defined(MS_RDONLY) +/** + * enum MS_MOUNT - + */ typedef enum { MS_RDONLY = 1, } MS_MOUNT; @@ -57,7 +60,8 @@ typedef struct _ntfs_volume ntfs_volume; #include "inode.h" #include "attrib.h" -/* +/** + * enum ntfs_mount_flags - * Flags returned by the ntfs_check_if_mounted() function. */ typedef enum { @@ -68,7 +72,8 @@ typedef enum { extern int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags); -/* +/** + * enum ntfs_volume_state_bits - * Defined bits for the state field in the ntfs_volume structure. */ typedef enum { @@ -108,7 +113,8 @@ typedef enum { #define NTFS_BUF_SIZE 8192 -/* +/** + * struct _ntfs_volume - * ntfs_volume - structure describing an open volume in memory */ struct _ntfs_volume { diff --git a/libntfs/dir.c b/libntfs/dir.c index 467c2175..df6272a0 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -592,6 +592,7 @@ static const ntfschar dotdot[3] = { const_cpu_to_le16('.'), const_cpu_to_le16('\0') }; /* + * union index_union - * More helpers for ntfs_readdir(). */ typedef union { @@ -599,6 +600,10 @@ typedef union { INDEX_ALLOCATION *ia; } index_union __attribute__((__transparent_union__)); +/** + * enum INDEX_TYPE - + * More helpers for ntfs_readdir(). + */ typedef enum { INDEX_TYPE_ROOT, /* index root */ INDEX_TYPE_ALLOCATION, /* index allocation */ diff --git a/libntfs/runlist.c b/libntfs/runlist.c index c5b9d869..b055450b 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -2100,7 +2100,7 @@ out: /** * test_rl_main - * @argc: - * @argv:[] + * @argv: * * Description... * diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 95a53c3a..dcb20045 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -78,6 +78,9 @@ static LPFN_SETFILEPOINTEREX fnSetFilePointerEx = NULL; #define FNPOSTFIX "A" #endif +/** + * struct win32_fd - + */ typedef struct { HANDLE handle; s64 pos; /* Logical current position on the volume. */ From 63c4123bbbb7ebfadd79b0c43e4932087bfbb1b8 Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 31 Oct 2005 01:19:27 +0000 Subject: [PATCH 2679/2994] another comment --- libntfs/compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/compress.c b/libntfs/compress.c index abf44d0d..737186e3 100644 --- a/libntfs/compress.c +++ b/libntfs/compress.c @@ -48,7 +48,7 @@ #include "logging.h" /** - * ntfs_compression_constants - enum of constants used in the compression code + * enum ntfs_compression_constants - constants used in the compression code */ typedef enum { /* Token types and access mask. */ From 9f4b2b4a2c939050d1f9e7e2fb3a1ca2486cf0f8 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 1 Nov 2005 00:12:08 +0000 Subject: [PATCH 2680/2994] Fix NTFS version 3.x index entries creation. Everybody is MUCH happier now! Erik got this right in his patch, it got non-functional due to libntfs changes. --- ntfsprogs/mkntfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index f4cddb7e..57d3ac8e 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2767,7 +2767,7 @@ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, err = -ENOMEM; goto err_out; } - if (ntfs_attr_lookup(AT_INDEX_ROOT, name, name_size, 0, 0, + if (mkntfs_attr_lookup(AT_INDEX_ROOT, name, name_size, 0, 0, NULL, 0, ctx)) { err = EEXIST; goto err_out; From 80923d64ddc669eaaf3461e5466168d7068c4cd8 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 1 Nov 2005 19:56:08 +0000 Subject: [PATCH 2681/2994] Fix type of reserved_II in SDH_INDEX_DATA; resolve some magic constants --- include/ntfs/layout.h | 2 +- ntfsprogs/mkntfs.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 4b5a9f45..ea7efd70 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1882,7 +1882,7 @@ typedef struct { u32 security_id; /* The security_id assigned to the descriptor. */ u64 offset_in_sds; /* Offset of the descriptor in SDS data stream */ u32 size_in_sds; /* Size of the descriptor in SDS data stream */ - u64 reserved_II; /* Padding - always unicode "II" */ + u32 reserved_II; /* Padding - always unicode "II" */ } __attribute__((__packed__)) SDH_INDEX_DATA; /** diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 57d3ac8e..f4b6a7a3 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2871,8 +2871,10 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) { SII_INDEX_DATA *sii_data; sds_header = (SECURITY_DESCRIPTOR_HEADER*)sds; - sdh_size = cpu_to_le32(0x30); - sii_size = cpu_to_le32(0x28); + sdh_size = sizeof(INDEX_ENTRY_HEADER); + sdh_size += sizeof(SDH_INDEX_KEY) + sizeof(SDH_INDEX_DATA); + sii_size = sizeof(INDEX_ENTRY_HEADER); + sii_size += sizeof(SII_INDEX_KEY) + sizeof(SII_INDEX_DATA); idx_entry_sdh = (INDEX_ENTRY*)calloc(1, sizeof(INDEX_ENTRY)); idx_entry_sii = (INDEX_ENTRY*)calloc(1, sizeof(INDEX_ENTRY)); err = 0; @@ -2896,7 +2898,7 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) { sdh_data->offset_in_sds = sds_header->offset; sdh_data->size_in_sds = sds_header->length; - sdh_data->reserved_II = cpu_to_le64(0x00490049); + sdh_data->reserved_II = cpu_to_le32(0x00490049); //SII index entry idx_entry_sii->data_offset = cpu_to_le16(0x14); From 1a40e3d4cd83fa88f74f404f3cc791fa2484942f Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 1 Nov 2005 20:01:03 +0000 Subject: [PATCH 2682/2994] Add missing full stops; rename SDS to $SDS --- include/ntfs/layout.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index ea7efd70..d626ae94 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1880,9 +1880,9 @@ typedef struct { typedef struct { u32 hash; /* Hash of the security descriptor. */ u32 security_id; /* The security_id assigned to the descriptor. */ - u64 offset_in_sds; /* Offset of the descriptor in SDS data stream */ - u32 size_in_sds; /* Size of the descriptor in SDS data stream */ - u32 reserved_II; /* Padding - always unicode "II" */ + u64 offset_in_sds; /* Offset of the descriptor in $SDS data stream. */ + u32 size_in_sds; /* Size of the descriptor in $SDS data stream. */ + u32 reserved_II; /* Padding - always unicode "II". */ } __attribute__((__packed__)) SDH_INDEX_DATA; /** @@ -1891,8 +1891,8 @@ typedef struct { typedef struct { u32 hash; /* Hash of the security descriptor. */ u32 security_id; /* The security_id assigned to the descriptor. */ - u64 offset_in_sds; /* Offset of the descriptor in SDS data stream */ - u32 size_in_sds; /* Size of the descriptor in SDS data stream */ + u64 offset_in_sds; /* Offset of the descriptor in $SDS data stream. */ + u32 size_in_sds; /* Size of the descriptor in $SDS data stream. */ } __attribute__((__packed__)) SII_INDEX_DATA; /** @@ -2309,7 +2309,6 @@ typedef struct { control entry in the data part of the index. */ } __attribute__((__packed__)) key; - /* The (optional) index data is inserted here when creating. */ // VCN vcn; /* If INDEX_ENTRY_NODE bit in flags is set, the last // eight bytes of this index entry contain the virtual From c21d01fe7ff2c32d3346a0f6adfc2acd431af3f9 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 1 Nov 2005 20:18:27 +0000 Subject: [PATCH 2683/2994] fix type of owner_id in QUOTA_O_INDEX_DATA --- include/ntfs/layout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index d626ae94..3907bac7 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1899,7 +1899,7 @@ typedef struct { * struct QUOTA_O_INDEX_DATA - */ typedef struct { - u64 owner_id; + u32 owner_id; } __attribute__((__packed__)) QUOTA_O_INDEX_DATA; /** From b82289f526327779c0796f927b2e5f3906a3e417 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 1 Nov 2005 20:19:32 +0000 Subject: [PATCH 2684/2994] fix casting to quota's owner_id --- ntfsprogs/mkntfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index f4b6a7a3..4bc80c0c 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2993,7 +2993,7 @@ static int initialize_quota(MFT_RECORD *m) { idx_entry_q1->key_length = cpu_to_le16(0x04); idx_entry_q1->flags = cpu_to_le16(0x00); idx_entry_q1->reserved = cpu_to_le16(0x00); - idx_entry_q1->key.owner_id = cpu_to_le16(0x01); + idx_entry_q1->key.owner_id = cpu_to_le32(0x01); idx_entry_q1_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q1 + idx_entry_q1->data_offset); idx_entry_q1_data->version = cpu_to_le32(0x02); From 987f33e5dfc0d1ddec1a100d0df0b5d493a4a801 Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 1 Nov 2005 20:24:37 +0000 Subject: [PATCH 2685/2994] ntfs_ prefix generate_guid() --- include/ntfs/security.h | 2 +- libntfs/security.c | 4 ++-- ntfsprogs/mkntfs.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ntfs/security.h b/include/ntfs/security.h index e477eb12..608429e0 100644 --- a/include/ntfs/security.h +++ b/include/ntfs/security.h @@ -50,6 +50,6 @@ static __inline__ BOOL ntfs_sid_is_valid(const SID *sid) extern int ntfs_sid_to_mbs_size(const SID *sid); extern char *ntfs_sid_to_mbs(const SID *sid, char *sid_str, size_t sid_str_size); -extern GUID *generate_guid(GUID *guid); +extern GUID *ntfs_generate_guid(GUID *guid); #endif /* defined _NTFS_SECURITY_H */ diff --git a/libntfs/security.c b/libntfs/security.c index 75aef280..5d1bb11a 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -251,14 +251,14 @@ err_out: } /** - * generate_guid - generatates a random current guid. + * ntfs_generate_guid - generatates a random current guid. * @guid: a pointer to a GUID struct to hold the generated guid. * * perhaps not a very good random number generator though... * * Returns: The same pointer it was given as a parameter (guid). */ -GUID *generate_guid(GUID *guid) +GUID *ntfs_generate_guid(GUID *guid) { int i; diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 4bc80c0c..9e3e3848 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -4202,7 +4202,7 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) } if (!err && vol->major_ver>=3) { volume_obj_id=(OBJECT_ID_ATTR*)calloc(1,0x10); - volume_obj_id->object_id = *generate_guid(&volume_obj_id->object_id); + volume_obj_id->object_id = *ntfs_generate_guid(&volume_obj_id->object_id); err = add_attr_object_id(m, volume_obj_id, 0x10); } if (!err) From c10f046225cbe560d0310fa9163899151dbec7ab Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 1 Nov 2005 21:09:52 +0000 Subject: [PATCH 2686/2994] simplified ntfs_generate_guid() --- include/ntfs/security.h | 2 +- libntfs/security.c | 19 +++++++------------ ntfsprogs/mkntfs.c | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/include/ntfs/security.h b/include/ntfs/security.h index 608429e0..a61aabd7 100644 --- a/include/ntfs/security.h +++ b/include/ntfs/security.h @@ -50,6 +50,6 @@ static __inline__ BOOL ntfs_sid_is_valid(const SID *sid) extern int ntfs_sid_to_mbs_size(const SID *sid); extern char *ntfs_sid_to_mbs(const SID *sid, char *sid_str, size_t sid_str_size); -extern GUID *ntfs_generate_guid(GUID *guid); +extern void ntfs_generate_guid(GUID *guid); #endif /* defined _NTFS_SECURITY_H */ diff --git a/libntfs/security.c b/libntfs/security.c index 5d1bb11a..e95b64a6 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -252,26 +252,21 @@ err_out: /** * ntfs_generate_guid - generatates a random current guid. - * @guid: a pointer to a GUID struct to hold the generated guid. + * @guid: [OUT] pointer to a GUID struct to hold the generated guid. * * perhaps not a very good random number generator though... - * - * Returns: The same pointer it was given as a parameter (guid). */ -GUID *ntfs_generate_guid(GUID *guid) +void ntfs_generate_guid(GUID *guid) { - int i; - static u8 array[16]; + u8 *p = (u8 *)guid; - for (i = 0; i < 16; i++) { - array[i] = (u8)(random() & 0xFF); + for (i = 0; i < sizeof(GUID); i++) { + p[i] = (u8)(random() & 0xFF); if (i == 7) - array[7] = (array[7] & 0x0F) | 0x40; + p[7] = (p[7] & 0x0F) | 0x40; if (i == 8) - array[8] = (array[8] & 0x3F) | 0x80; + p[8] = (p[8] & 0x3F) | 0x80; } - memcpy(guid, array, sizeof(guid)); - return guid; } diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 9e3e3848..6470ffc7 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -4202,7 +4202,7 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) } if (!err && vol->major_ver>=3) { volume_obj_id=(OBJECT_ID_ATTR*)calloc(1,0x10); - volume_obj_id->object_id = *ntfs_generate_guid(&volume_obj_id->object_id); + ntfs_generate_guid(&volume_obj_id->object_id); err = add_attr_object_id(m, volume_obj_id, 0x10); } if (!err) From 8cfde9cdfd167da8cc7235eaada59cb3c6e68dab Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 1 Nov 2005 23:14:34 +0000 Subject: [PATCH 2687/2994] Fix $Quota::$O key sub authority dumping; dump authorities in hexa --- ntfsprogs/ntfsinfo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 53ed1c0d..46621a14 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1153,15 +1153,15 @@ static void ntfs_dump_index_key(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) entry->key.sid.revision); ntfs_log_verbose("\t\tKey sub authority count: %u\n", entry->key.sid.sub_authority_count); - ntfs_log_verbose("\t\tKey ident. auth. high: %u\n", + ntfs_log_verbose("\t\tKey ident. auth. high: 0x%04x\n", le16_to_cpu(entry->key.sid. identifier_authority.high_part)); - ntfs_log_verbose("\t\tKey ident. auth. low: %u\n", + ntfs_log_verbose("\t\tKey ident. auth. low: 0x%08x\n", le32_to_cpu(entry->key.sid. identifier_authority.low_part)); for (i = 0; i < entry->key.sid.sub_authority_count; i++) - ntfs_log_verbose("\t\tKey sub authority:\t %u\n", - le32_to_cpu(entry->key.sid.sub_authority)); + ntfs_log_verbose("\t\tKey sub authority:\t 0x%08x\n", + le32_to_cpu(entry->key.sid.sub_authority[i])); break; case INDEX_ATTR_QUOTA_Q: ntfs_log_verbose("\t\tKey owner id:\t\t %u\n", From 83b9eddfc989e21facac72b2afb1585a154747b9 Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 2 Nov 2005 17:34:08 +0000 Subject: [PATCH 2688/2994] provide some meaningful function descriptions --- libntfs/attrib.c | 6 ++--- libntfs/bitmap.c | 18 ++++++------- libntfs/collate.c | 6 ++--- libntfs/compat.c | 2 +- libntfs/dir.c | 20 +++++++-------- libntfs/index.c | 16 ++++++------ libntfs/inode.c | 12 ++++----- libntfs/mft.c | 12 ++++----- libntfs/rich.c | 6 ++--- libntfs/runlist.c | 20 +++++++-------- libntfs/tree.c | 64 +++++++++++++++++++++++------------------------ libntfs/unistr.c | 6 ++--- libntfs/unix_io.c | 20 +++++++-------- libntfs/volume.c | 14 +++++------ ntfsprogs/utils.c | 2 +- 15 files changed, 112 insertions(+), 112 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 5465118e..1bec4aeb 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -59,7 +59,7 @@ ntfschar AT_UNNAMED[] = { const_cpu_to_le16('\0') }; /** - * ntfs_get_attribute_value_length - + * ntfs_get_attribute_value_length - Find the length of an attribute * @a: * * Description... @@ -82,7 +82,7 @@ s64 ntfs_get_attribute_value_length(const ATTR_RECORD *a) } /** - * ntfs_get_attribute_value - + * ntfs_get_attribute_value - Get a copy of an attribute * @vol: * @a: * @b: @@ -2967,7 +2967,7 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, /* @val is mandatory. */ if (!val) { ntfs_log_trace("val is mandatory for always resident " - "atributes.\n"); + "attributes.\n"); errno = EINVAL; return -1; } diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index 495f2bb6..d3444d4d 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -228,7 +228,7 @@ int ntfs_bitmap_clear_run(ntfs_attr *na, s64 start_bit, s64 count) #include "rich.h" /** - * ntfs_bmp_rollback - + * ntfs_bmp_rollback - Discard the in-memory bitmap changes * @bmp: * * Description... @@ -257,7 +257,7 @@ int ntfs_bmp_rollback(struct ntfs_bmp *bmp) } /** - * ntfs_bmp_commit - + * ntfs_bmp_commit - Write the cached bitmap data to disk * @bmp: * * Description... @@ -311,7 +311,7 @@ int ntfs_bmp_commit(struct ntfs_bmp *bmp) } /** - * ntfs_bmp_free - + * ntfs_bmp_free - Destroy a bitmap object * @bmp: * * Description... @@ -332,7 +332,7 @@ void ntfs_bmp_free(struct ntfs_bmp *bmp) } /** - * ntfs_bmp_create - + * ntfs_bmp_create - Create a representation of a bitmap * @inode: * @type: * @name: @@ -372,7 +372,7 @@ struct ntfs_bmp * ntfs_bmp_create(ntfs_inode *inode, ATTR_TYPES type, ntfschar * } /** - * ntfs_bmp_add_data - + * ntfs_bmp_add_data - Add a bitmap block to the current cache * @bmp: * @vcn: * @data: @@ -416,7 +416,7 @@ int ntfs_bmp_add_data(struct ntfs_bmp *bmp, VCN vcn, u8 *data) } /** - * ntfs_bmp_get_data - + * ntfs_bmp_get_data - Ask for a bitmap block from the cache * @bmp: * @vcn: * @@ -466,7 +466,7 @@ u8 * ntfs_bmp_get_data(struct ntfs_bmp *bmp, VCN vcn) } /** - * ntfs_bmp_set_range - + * ntfs_bmp_set_range - Set a range of bits in the bitmap * @bmp: * @vcn: * @length: @@ -563,7 +563,7 @@ int ntfs_bmp_set_range(struct ntfs_bmp *bmp, VCN vcn, s64 length, int value) } /** - * ntfs_bmp_find_last_set - + * ntfs_bmp_find_last_set - Find the last set bit in the bitmap * @bmp: * * Description... @@ -632,7 +632,7 @@ s64 ntfs_bmp_find_last_set(struct ntfs_bmp *bmp) } /** - * ntfs_bmp_find_space - + * ntfs_bmp_find_space - Find an unused block of bits in a bitmap * @bmp: * @start: * @size: diff --git a/libntfs/collate.c b/libntfs/collate.c index c961efc7..cd365458 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -34,7 +34,7 @@ #include "logging.h" /** - * ntfs_collate_binary - + * ntfs_collate_binary - Which of two binary objects should be listed first * @vol: unused * @data1: * @data1_len: @@ -64,7 +64,7 @@ static int ntfs_collate_binary(ntfs_volume *vol __attribute__((unused)), } /** - * ntfs_collate_ntofs_ulong - + * ntfs_collate_ntofs_ulong - Which of two long ints should be listed first * @vol: unused * @data1: * @data1_len: @@ -102,7 +102,7 @@ static int ntfs_collate_ntofs_ulong(ntfs_volume *vol __attribute__((unused)), } /** - * ntfs_collate_file_name - + * ntfs_collate_file_name - Which of two filenames should be listed first * @vol: * @data1: * @data1_len: unused diff --git a/libntfs/compat.c b/libntfs/compat.c index 887b82ff..acdf4db7 100644 --- a/libntfs/compat.c +++ b/libntfs/compat.c @@ -32,7 +32,7 @@ #ifndef HAVE_FFS /** - * ffs - + * ffs - Find the first set bit in an int * @x: * * Description... diff --git a/libntfs/dir.c b/libntfs/dir.c index df6272a0..f79f518a 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1358,7 +1358,7 @@ search: /* * If hard link count is not equal to zero then we are done. In other * case there are no reference to this inode left, so we should free all - * non-resident atributes and mark inode as not in use. + * non-resident attributes and mark inode as not in use. */ if (ni->mrec->link_count) goto out; @@ -1372,13 +1372,13 @@ search: if (!rl) { err = errno; ntfs_log_error("Failed to decompress runlist. " - "Leaving inconsist metadata."); + "Leaving inconsistent metadata."); continue; } if (ntfs_cluster_free_from_rl(ni->vol, rl)) { err = errno; ntfs_log_error("Failed to free clusters. " - "Leaving inconsist metadata."); + "Leaving inconsistent metadata."); continue; } free(rl); @@ -1522,7 +1522,7 @@ err_out: #include "rich.h" /** - * ntfs_dir_rollback - + * ntfs_dir_rollback - Discard the in-memory directory changes * @dir: * * Description... @@ -1554,7 +1554,7 @@ int ntfs_dir_rollback(struct ntfs_dir *dir) } /** - * ntfs_dir_truncate - + * ntfs_dir_truncate - Shrink an index allocation * @vol: * @dir: * @@ -1707,7 +1707,7 @@ int ntfs_dir_truncate(ntfs_volume *vol, struct ntfs_dir *dir) } /** - * ntfs_dir_commit - + * ntfs_dir_commit - Write to disk the in-memory directory changes * @dir: * * Description... @@ -1744,7 +1744,7 @@ int ntfs_dir_commit(struct ntfs_dir *dir) } /** - * ntfs_dir_free - + * ntfs_dir_free - Destroy a directory object * @dir: * * Description... @@ -1789,7 +1789,7 @@ void ntfs_dir_free(struct ntfs_dir *dir) } /** - * ntfs_dir_create - + * ntfs_dir_create - Create a representation of a directory * @vol: * @mft_num: * @@ -1863,7 +1863,7 @@ struct ntfs_dir * ntfs_dir_create(ntfs_volume *vol, MFT_REF mft_num) } /** - * ntfs_dir_add - + * ntfs_dir_add - Add a directory to another as a child * @parent: * @child: * @@ -1890,7 +1890,7 @@ void ntfs_dir_add(struct ntfs_dir *parent, struct ntfs_dir *child) } /** - * ntfs_dir_find2 - + * ntfs_dir_find2 - Find a directory by name * @dir: * @name: * @name_len: diff --git a/libntfs/index.c b/libntfs/index.c index 76250c3d..c31ae7ae 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -662,7 +662,7 @@ err_out: #include "rich.h" /** - * ntfs_ie_free - + * ntfs_ie_free - Destroy an index entry object * @ie: * * Description... @@ -676,7 +676,7 @@ void ntfs_ie_free(INDEX_ENTRY *ie) } /** - * ntfs_ie_create - + * ntfs_ie_create - Create a representation of an directory index entry * * Description... * @@ -702,7 +702,7 @@ INDEX_ENTRY * ntfs_ie_create(void) } /** - * ntfs_ie_get_vcn - + * ntfs_ie_get_vcn - Get the VCN associated with an index entry * @ie: * * Description... @@ -721,7 +721,7 @@ VCN ntfs_ie_get_vcn(INDEX_ENTRY *ie) } /** - * ntfs_ie_copy - + * ntfs_ie_copy - Create a copy of an index entry * @ie: * * Description... @@ -745,7 +745,7 @@ INDEX_ENTRY * ntfs_ie_copy(INDEX_ENTRY *ie) } /** - * ntfs_ie_set_vcn - + * ntfs_ie_set_vcn - Set VCN associated with an index entry * @ie: * @vcn: * @@ -773,7 +773,7 @@ INDEX_ENTRY * ntfs_ie_set_vcn(INDEX_ENTRY *ie, VCN vcn) } /** - * ntfs_ie_remove_vcn - + * ntfs_ie_remove_vcn - Remove the VCN associated with an index entry * @ie: * * Description... @@ -795,7 +795,7 @@ INDEX_ENTRY * ntfs_ie_remove_vcn(INDEX_ENTRY *ie) } /** - * ntfs_ie_set_name - + * ntfs_ie_set_name - Associate a name with an index entry * @ie: * @name: * @namelen: @@ -891,7 +891,7 @@ INDEX_ENTRY * ntfs_ie_set_name(INDEX_ENTRY *ie, ntfschar *name, int namelen, FIL } /** - * ntfs_ie_remove_name - + * ntfs_ie_remove_name - Remove the name from an index-entry * @ie: * * Description... diff --git a/libntfs/inode.c b/libntfs/inode.c index 9e876e1e..b6291bba 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -50,7 +50,7 @@ #include "logging.h" /** - * __ntfs_inode_allocate - + * __ntfs_inode_allocate - Create and initialise an NTFS inode object * @vol: * * Description... @@ -68,7 +68,7 @@ static __inline__ ntfs_inode *__ntfs_inode_allocate(ntfs_volume *vol) } /** - * ntfs_inode_allocate - + * ntfs_inode_allocate - Create an NTFS inode object * @vol: * * Description... @@ -81,7 +81,7 @@ ntfs_inode *ntfs_inode_allocate(ntfs_volume *vol) } /** - * __ntfs_inode_release - + * __ntfs_inode_release - Destroy an NTFS inode object * @ni: * * Description... @@ -1073,7 +1073,7 @@ put_err_out: #include "rich.h" /** - * ntfs_inode_close2 - + * ntfs_inode_close2 - Close an inode, freeing any resources * @ni: * * Description... @@ -1101,7 +1101,7 @@ int ntfs_inode_close2(ntfs_inode *ni) } /** - * ntfs_inode_open2 - + * ntfs_inode_open2 - Open an inode and initialise it * @vol: * @mref: * @@ -1156,7 +1156,7 @@ ntfs_inode * ntfs_inode_open2(ntfs_volume *vol, const MFT_REF mref) } /** - * ntfs_inode_open3 - + * ntfs_inode_open3 - Open an inode and initialise it * @vol: * @mref: * diff --git a/libntfs/mft.c b/libntfs/mft.c index 43dca2d0..d33fb91e 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -392,7 +392,7 @@ static const char *es = " Leaving inconsistent metadata. Run chkdsk."; #endif /** - * ntfs_ffz - + * ntfs_ffz - Find the first unset (zero) bit in a word * @word: * * Description... @@ -1566,7 +1566,7 @@ sync_rollback: #include "rich.h" /** - * ntfs_mft_remove_attr - + * ntfs_mft_remove_attr - Remove an attribute from an MFT record * @bmp: * @inode: * @type: @@ -1632,7 +1632,7 @@ int ntfs_mft_remove_attr(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_TYPES typ } /** - * ntfs_mft_add_attr - + * ntfs_mft_add_attr - Add an attribute to an MFT record * @inode: * @type: * @data: @@ -1710,7 +1710,7 @@ ATTR_RECORD * ntfs_mft_add_attr(ntfs_inode *inode, ATTR_TYPES type, u8 *data, in } /** - * ntfs_mft_resize_resident - + * ntfs_mft_resize_resident - Resize a resident attribute in an MFT record * @inode: * @type: * @name: @@ -1819,7 +1819,7 @@ done: } /** - * ntfs_mft_free_space - + * ntfs_mft_free_space - Calculate the free space (bytes) in an MFT record * @dir: * * Description... @@ -1843,7 +1843,7 @@ int ntfs_mft_free_space(struct ntfs_dir *dir) } /** - * ntfs_mft_add_index - + * ntfs_mft_add_index - Add an index (directory) to an MFT record * @dir: * * Description... diff --git a/libntfs/rich.c b/libntfs/rich.c index bd3d4024..1921e9dc 100644 --- a/libntfs/rich.c +++ b/libntfs/rich.c @@ -112,7 +112,7 @@ ATTR_RECORD * find_first_attribute(const ATTR_TYPES type, MFT_RECORD *mft) } /** - * ntfs_name_print - + * ntfs_name_print - Send a Unicode name to the debug log * @name: * @name_len: * @@ -134,7 +134,7 @@ void ntfs_name_print(ntfschar *name, int name_len) } /** - * utils_free_non_residents3 - + * utils_free_non_residents3 - Free all the non-resident attributes of an inode * @bmp: * @inode: * @attr: @@ -178,7 +178,7 @@ int utils_free_non_residents3(struct ntfs_bmp *bmp, ntfs_inode *inode, ATTR_RECO } /** - * utils_free_non_residents2 - + * utils_free_non_residents2 - Find all the non-resident attributes of an inode * @inode: * @bmp: * diff --git a/libntfs/runlist.c b/libntfs/runlist.c index b055450b..22f46a1d 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -1718,7 +1718,7 @@ s64 ntfs_rl_get_compressed_size(ntfs_volume *vol, runlist *rl) } */ /** - * test_rl_dump_runlist - + * test_rl_dump_runlist - Runlist test: Display the contents of a runlist * @rl: * * Description... @@ -1770,7 +1770,7 @@ static void test_rl_dump_runlist(const runlist_element *rl) } /** - * test_rl_runlists_merge - + * test_rl_runlists_merge - Runlist test: Merge two runlists * @drl: * @srl: * @@ -1796,7 +1796,7 @@ static runlist_element * test_rl_runlists_merge(runlist_element *drl, runlist_el } /** - * test_rl_read_buffer - + * test_rl_read_buffer - Runlist test: Read a file containing a runlist * @file: * @buf: * @bufsize: @@ -1825,7 +1825,7 @@ static int test_rl_read_buffer(const char *file, u8 *buf, int bufsize) } /** - * test_rl_pure_src - + * test_rl_pure_src - Runlist test: Complicate the simple tests a little * @contig: * @multi: * @vcn: @@ -1860,7 +1860,7 @@ static runlist_element * test_rl_pure_src(BOOL contig, BOOL multi, int vcn, int } /** - * test_rl_pure_test - + * test_rl_pure_test - Runlist test: Perform tests using simple runlists * @test: * @contig: * @multi: @@ -1891,7 +1891,7 @@ static void test_rl_pure_test(int test, BOOL contig, BOOL multi, int vcn, int le } /** - * test_rl_pure - + * test_rl_pure - Runlist test: Create tests using simple runlists * @contig: * @multi: * @@ -1991,7 +1991,7 @@ static void test_rl_pure(char *contig, char *multi) } /** - * test_rl_zero - + * test_rl_zero - Runlist test: Merge a zero-length runlist * * Description... * @@ -2017,7 +2017,7 @@ static void test_rl_zero(void) } /** - * test_rl_frag_combine - + * test_rl_frag_combine - Runlist test: Perform tests using fragmented files * @vol: * @attr1: * @attr2: @@ -2053,7 +2053,7 @@ static void test_rl_frag_combine(ntfs_volume *vol, ATTR_RECORD *attr1, ATTR_RECO } /** - * test_rl_frag - + * test_rl_frag - Runlist test: Create tests using very fragmented files * @test: * * Description... @@ -2098,7 +2098,7 @@ out: } /** - * test_rl_main - + * test_rl_main - Runlist test: Program start (main) * @argc: * @argv: * diff --git a/libntfs/tree.c b/libntfs/tree.c index c7733587..9cb2d382 100644 --- a/libntfs/tree.c +++ b/libntfs/tree.c @@ -42,7 +42,7 @@ #include "rich.h" /** - * ntfs_dt_free - + * ntfs_dt_free - Destroy a directory-tree object * @dt: * * Description... @@ -71,7 +71,7 @@ void ntfs_dt_free(struct ntfs_dt *dt) } /** - * ntfs_dt_rollback - + * ntfs_dt_rollback - Discard the in-memory directory-tree changes * @dt: * * Description... @@ -123,7 +123,7 @@ int ntfs_dt_rollback(struct ntfs_dt *dt) } /** - * ntfs_dt_commit - + * ntfs_dt_commit - Write to disk the in-memory directory-tree changes * @dt: * * Description... @@ -186,7 +186,7 @@ int ntfs_dt_commit(struct ntfs_dt *dt) } /** - * ntfs_dt_create_children2 - + * ntfs_dt_create_children2 - Allocate space for the directory-tree's children * @dt: * @count: * @@ -220,7 +220,7 @@ BOOL ntfs_dt_create_children2(struct ntfs_dt *dt, int count) } /** - * ntfs_dt_resize_children3 - + * ntfs_dt_resize_children3 - Resize a directory-tree's children arrays * @dt: * @new: * @@ -266,7 +266,7 @@ BOOL ntfs_dt_resize_children3(struct ntfs_dt *dt, int new) } /** - * ntfs_dt_root_count - + * ntfs_dt_root_count - Count the index entries in an index root * @dt: * * Description... @@ -334,7 +334,7 @@ int ntfs_dt_root_count(struct ntfs_dt *dt) } /** - * ntfs_dt_alloc_count - + * ntfs_dt_alloc_count - Count the index entries in an index allocation * @dt: * * Description... @@ -398,7 +398,7 @@ int ntfs_dt_alloc_count(struct ntfs_dt *dt) } /** - * ntfs_dt_initialise2 - + * ntfs_dt_initialise2 - Setup a directory-tree object * @vol: * @dt: * @@ -447,7 +447,7 @@ int ntfs_dt_initialise2(ntfs_volume *vol, struct ntfs_dt *dt) } /** - * ntfs_dt_create - + * ntfs_dt_create - Create a representation of a directory index * @dir: * @parent: * @vcn: @@ -554,7 +554,7 @@ struct ntfs_dt * ntfs_dt_create(struct ntfs_dir *dir, struct ntfs_dt *parent, VC } /** - * ntfs_dt_find - + * ntfs_dt_find - Find an index entry by name * @dt: * @name: * @name_len: @@ -634,7 +634,7 @@ MFT_REF ntfs_dt_find(struct ntfs_dt *dt, ntfschar *name, int name_len) } /** - * ntfs_dt_find2 - + * ntfs_dt_find2 - Find an index entry by name * @dt: * @name: * @name_len: @@ -718,7 +718,7 @@ struct ntfs_dt * ntfs_dt_find2(struct ntfs_dt *dt, ntfschar *name, int name_len, } /** - * ntfs_dt_find3 - + * ntfs_dt_find3 - Find an index entry by name * @dt: * @name: * @name_len: @@ -784,7 +784,7 @@ struct ntfs_dt * ntfs_dt_find3(struct ntfs_dt *dt, ntfschar *name, int name_len, } /** - * ntfs_dt_find4 - + * ntfs_dt_find4 - Find an index entry by name * @dt: * @name: * @name_len: @@ -858,7 +858,7 @@ struct ntfs_dt * ntfs_dt_find4(struct ntfs_dt *dt, ntfschar *name, int name_len, } /** - * ntfs_dt_find_all - + * ntfs_dt_find_all - Recurse the directory-tree, mapping all elements * @dt: * * maps all dt's into memory @@ -887,7 +887,7 @@ void ntfs_dt_find_all(struct ntfs_dt *dt) } /** - * ntfs_dt_find_parent - + * ntfs_dt_find_parent - Find the index of ourself in the parent's array * @dt: * * Description... @@ -915,7 +915,7 @@ int ntfs_dt_find_parent(struct ntfs_dt *dt) } /** - * ntfs_dt_isroot - + * ntfs_dt_isroot - Does this directory-tree represent an index root * @dt: * * Description... @@ -931,7 +931,7 @@ BOOL ntfs_dt_isroot(struct ntfs_dt *dt) } /** - * ntfs_dt_root_freespace - + * ntfs_dt_root_freespace - Give the free space (bytes) in an index root * @dt: * * Description... @@ -957,7 +957,7 @@ int ntfs_dt_root_freespace(struct ntfs_dt *dt) } /** - * ntfs_dt_alloc_freespace - + * ntfs_dt_alloc_freespace - Give the free space (bytes) in an index allocation * @dt: * * Description... @@ -983,7 +983,7 @@ int ntfs_dt_alloc_freespace(struct ntfs_dt *dt) } /** - * ntfs_dt_transfer - + * ntfs_dt_transfer - Transfer several index entries between directory-trees * @old: * @new: * @start: @@ -1141,7 +1141,7 @@ int ntfs_dt_transfer(struct ntfs_dt *old, struct ntfs_dt *new, int start, int co } /** - * ntfs_dt_alloc_insert - + * ntfs_dt_alloc_insert - Insert an index entry into an index allocation * @dt: * @first: * @count: @@ -1212,7 +1212,7 @@ int ntfs_dt_alloc_insert(struct ntfs_dt *dt, INDEX_ENTRY *first, int count) } /** - * ntfs_dt_alloc_insert2 - + * ntfs_dt_alloc_insert2 - Insert an index entry into an index allocation * @dt: * @before: * @count: @@ -1287,7 +1287,7 @@ INDEX_ENTRY * ntfs_dt_alloc_insert2(struct ntfs_dt *dt, int before, int count, i } /** - * ntfs_dt_root_insert - + * ntfs_dt_root_insert - Insert an index entry into an index root * @dt: * @first: * @count: @@ -1308,7 +1308,7 @@ int ntfs_dt_root_insert(struct ntfs_dt *dt, INDEX_ENTRY *first, int count) } /** - * ntfs_dt_alloc_remove2 - + * ntfs_dt_alloc_remove2 - Remove an index entry from an index allocation * @dt: * @start: * @count: @@ -1335,7 +1335,7 @@ int ntfs_dt_alloc_remove2(struct ntfs_dt *dt, int start, int count) } /** - * ntfs_dt_root_remove2 - + * ntfs_dt_root_remove2 - Remove an index entry from an index root * @dt: * @start: * @count: @@ -1384,7 +1384,7 @@ int ntfs_dt_root_remove2(struct ntfs_dt *dt, int start, int count) } /** - * ntfs_dt_transfer2 - + * ntfs_dt_transfer2 - Transfer several index entries between directory-trees * @old: * @new: * @start: @@ -1553,7 +1553,7 @@ int ntfs_dt_transfer2(struct ntfs_dt *old, struct ntfs_dt *new, int start, int c } /** - * ntfs_dt_root_replace - + * ntfs_dt_root_replace - Replace an index entry in an index root * @del: * @del_num: * @del_ie: @@ -1641,7 +1641,7 @@ int ntfs_dt_root_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie, } /** - * ntfs_dt_alloc_replace - + * ntfs_dt_alloc_replace - Replace an index entry in an index allocation * @del: * @del_num: * @del_ie: @@ -1712,7 +1712,7 @@ BOOL ntfs_dt_alloc_replace(struct ntfs_dt *del, int del_num, INDEX_ENTRY *del_ie } /** - * ntfs_dt_root_remove - + * ntfs_dt_root_remove - Remove an index entry from an index root * @del: * @del_num: * @@ -1840,7 +1840,7 @@ BOOL ntfs_dt_root_remove(struct ntfs_dt *del, int del_num) } /** - * ntfs_dt_alloc_remove - + * ntfs_dt_alloc_remove - Remove an index entry from an index allocation * @del: * @del_num: * @@ -1969,7 +1969,7 @@ BOOL ntfs_dt_alloc_remove(struct ntfs_dt *del, int del_num) } /** - * ntfs_dt_alloc_add - + * ntfs_dt_alloc_add - Add an index entry to an index allocation * @parent: * @index_num: * @ie: @@ -2066,7 +2066,7 @@ int ntfs_dt_alloc_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, st } /** - * ntfs_dt_root_add - + * ntfs_dt_root_add - Add an index entry to an index root * @parent: * @index_num: * @ie: @@ -2177,7 +2177,7 @@ int ntfs_dt_root_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, str } /** - * ntfs_dt_add2 - + * ntfs_dt_add2 - Add an index entry to a directory-tree * @ie: * @suc: * @suc_num: diff --git a/libntfs/unistr.c b/libntfs/unistr.c index f34355ff..ed4adf80 100644 --- a/libntfs/unistr.c +++ b/libntfs/unistr.c @@ -307,7 +307,7 @@ ntfschar *ntfs_ucsndup(const ntfschar *s, u32 maxlen) } /** - * ntfs_name_upcase - + * ntfs_name_upcase - Map an Unicode name to its uppercase equivalent * @name: * @name_len: * @upcase: @@ -329,7 +329,7 @@ void ntfs_name_upcase(ntfschar *name, u32 name_len, const ntfschar *upcase, } /** - * ntfs_file_value_upcase - + * ntfs_file_value_upcase - Convert a filename to upper case * @file_name_attr: * @upcase: * @upcase_len: @@ -346,7 +346,7 @@ void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr, } /** - * ntfs_file_values_compare - + * ntfs_file_values_compare - Which of two filenames should be listed first * @file_name_attr1: * @file_name_attr2: * @err_val: diff --git a/libntfs/unix_io.c b/libntfs/unix_io.c index 8cc94c1f..9ee5f3de 100644 --- a/libntfs/unix_io.c +++ b/libntfs/unix_io.c @@ -67,7 +67,7 @@ #define DEV_FD(dev) (*(int *)dev->d_private) /** - * ntfs_device_unix_io_open - + * ntfs_device_unix_io_open - Open a device and lock it exclusively * @dev: * @flags: * @@ -122,7 +122,7 @@ err_out: } /** - * ntfs_device_unix_io_close - + * ntfs_device_unix_io_close - Close the device, releasing the lock * @dev: * * Description... @@ -157,7 +157,7 @@ static int ntfs_device_unix_io_close(struct ntfs_device *dev) } /** - * ntfs_device_unix_io_seek - + * ntfs_device_unix_io_seek - Seek to a place on the device * @dev: * @offset: * @whence: @@ -173,7 +173,7 @@ static s64 ntfs_device_unix_io_seek(struct ntfs_device *dev, s64 offset, } /** - * ntfs_device_unix_io_read - + * ntfs_device_unix_io_read - Read from the device, from the current location * @dev: * @buf: * @count: @@ -189,7 +189,7 @@ static s64 ntfs_device_unix_io_read(struct ntfs_device *dev, void *buf, } /** - * ntfs_device_unix_io_write - + * ntfs_device_unix_io_write - Write to the device, at the current location * @dev: * @buf: * @count: @@ -210,7 +210,7 @@ static s64 ntfs_device_unix_io_write(struct ntfs_device *dev, const void *buf, } /** - * ntfs_device_unix_io_pread - + * ntfs_device_unix_io_pread - Perform a positioned read from the device * @dev: * @buf: * @count: @@ -227,7 +227,7 @@ static s64 ntfs_device_unix_io_pread(struct ntfs_device *dev, void *buf, } /** - * ntfs_device_unix_io_pwrite - + * ntfs_device_unix_io_pwrite - Perform a positioned write to the device * @dev: * @buf: * @count: @@ -249,7 +249,7 @@ static s64 ntfs_device_unix_io_pwrite(struct ntfs_device *dev, const void *buf, } /** - * ntfs_device_unix_io_sync - + * ntfs_device_unix_io_sync - Flush any buffered changes to the device * @dev: * * Description... @@ -268,7 +268,7 @@ static int ntfs_device_unix_io_sync(struct ntfs_device *dev) } /** - * ntfs_device_unix_io_stat - + * ntfs_device_unix_io_stat - Get information about the device * @dev: * @buf: * @@ -282,7 +282,7 @@ static int ntfs_device_unix_io_stat(struct ntfs_device *dev, struct stat *buf) } /** - * ntfs_device_unix_io_ioctl - + * ntfs_device_unix_io_ioctl - Perform an ioctl on the device * @dev: * @request: * @argp: diff --git a/libntfs/volume.c b/libntfs/volume.c index 598ae14e..b8285d4d 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -67,7 +67,7 @@ #endif /** - * ntfs_volume_alloc - + * ntfs_volume_alloc - Create an NTFS volume object and initialise it * * Description... * @@ -95,7 +95,7 @@ ntfs_volume *ntfs_volume_alloc(void) } /** - * __ntfs_volume_release - + * __ntfs_volume_release - Destroy an NTFS volume object * @v: * * Description... @@ -1606,7 +1606,7 @@ int utils_valid_device(const char *name, int force) } /** - * utils_mount_volume - + * utils_mount_volume - Mount an NTFS volume * @device: * @flags: * @force: @@ -1660,7 +1660,7 @@ ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL f } /** - * ntfs_volume_commit - + * ntfs_volume_commit - Write to disk the in-memory volume changes * @vol: * * Description... @@ -1687,7 +1687,7 @@ int ntfs_volume_commit(ntfs_volume *vol) } /** - * ntfs_volume_rollback - + * ntfs_volume_rollback - Discard the in-memory volume changes * @vol: * * Description... @@ -1713,7 +1713,7 @@ int ntfs_volume_rollback(ntfs_volume *vol) } /** - * ntfs_volume_umount2 - + * ntfs_volume_umount2 - Unmount an NTFS volume, using the new directory support * @vol: * @force: * @@ -1748,7 +1748,7 @@ int ntfs_volume_umount2(ntfs_volume *vol, const BOOL force) } /** - * ntfs_volume_mount2 - + * ntfs_volume_mount2 - Mount an NTFS volume, using the new directory support * @device: * @flags: * @force: diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index cc9d0fa2..dbf6c276 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -165,7 +165,7 @@ int utils_valid_device(const char *name, int force) } /** - * utils_mount_volume + * utils_mount_volume - Mount an NTFS volume */ ntfs_volume * utils_mount_volume(const char *device, unsigned long flags, BOOL force) { From b2606af8abc16d156707b551b7705559412f4348 Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 2 Nov 2005 18:06:48 +0000 Subject: [PATCH 2689/2994] a few typos --- libntfs/attrib.c | 4 ++-- libntfs/collate.c | 2 +- libntfs/dir.c | 12 ++++++------ libntfs/index.c | 6 +++--- libntfs/logfile.c | 2 +- libntfs/volume.c | 4 ++-- ntfsprogs/mkntfs.c | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 1bec4aeb..309b5511 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -2130,7 +2130,7 @@ not_found: * If @type is AT_END, seek to the end of the base mft record ignoring the * attribute list completely and return -1 with errno set to ENOENT. AT_END is * not a valid attribute, its length is zero for example, thus it is safer to - * return error instead of success in this case. It should never ne needed to + * return error instead of success in this case. It should never be needed to * do this, but we implement the functionality because it allows for simpler * code inside ntfs_external_attr_find(). * @@ -3000,7 +3000,7 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type, /* Attribute can't be resident. */ is_resident = FALSE; } - /* Calculate atribute record size. */ + /* Calculate attribute record size. */ if (is_resident) attr_rec_size = offsetof(ATTR_RECORD, resident_end) + ((name_len * sizeof(ntfschar) + 7) & ~7) + diff --git a/libntfs/collate.c b/libntfs/collate.c index cd365458..57c13bfa 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -156,7 +156,7 @@ static ntfs_collate_func_t ntfs_do_collate0x1[4] = { * @data2_len: length in bytes of @data2 * * Collate the two data items @data1 and @data2 using the collation rule @cr - * and return -1, 0, ir 1 if @data1 is found, respectively, to collate before, + * and return -1, 0, or 1 if @data1 is found, respectively, to collate before, * to match, or to collate after @data2. * * For speed we use the collation rule @cr as an index into two tables of diff --git a/libntfs/dir.c b/libntfs/dir.c index f79f518a..3ba17a88 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1216,7 +1216,7 @@ err_out: ntfs_log_trace("Failed.\n"); if (ntfs_mft_record_free(ni->vol, ni)) ntfs_log_error("Failed to free MFT record. " - "Leaving inconsist metadata. Run chkdsk."); + "Leaving inconsistent metadata. Run chkdsk."); free(fn); free(si); errno = err; @@ -1386,20 +1386,20 @@ search: } if (errno != ENOENT) { err = errno; - ntfs_log_error("Atribute enumeration failed. " - "Probably leaving inconsist metadata."); + ntfs_log_error("Attribute enumeration failed. " + "Probably leaving inconsistent metadata."); } /* All extents should be attached after attribute walk. */ while (ni->nr_extents) if (ntfs_mft_record_free(ni->vol, *(ni->extent_nis))) { err = errno; ntfs_log_error("Failed to free extent MFT record. " - "Leaving inconsist metadata."); + "Leaving inconsistent metadata."); } if (ntfs_mft_record_free(ni->vol, ni)) { err = errno; ntfs_log_error("Failed to free base MFT record. " - "Leaving inconsist metadata."); + "Leaving inconsistent metadata."); } ni = NULL; out: @@ -1505,7 +1505,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) ntfs_log_trace("Done.\n"); return 0; rollback_failed: - ntfs_log_error("Rollback failed. Leaving inconsist metadata."); + ntfs_log_error("Rollback failed. Leaving inconsistent metadata."); err_out: ntfs_log_error("Failed.\n"); free(fn); diff --git a/libntfs/index.c b/libntfs/index.c index c31ae7ae..67136d94 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -109,7 +109,7 @@ void ntfs_index_ctx_put(ntfs_index_context *ictx) * ntfs_index_ctx_reinit - reinitialize an index context * @ictx: index context to reinitialize * - * Reintialize the index context @ictx so it can be used for ntfs_index_lookup. + * Reinitialize the index context @ictx so it can be used for ntfs_index_lookup. */ void ntfs_index_ctx_reinit(ntfs_index_context *ictx) { @@ -630,14 +630,14 @@ int ntfs_index_rm(ntfs_index_context *ictx) if (!na) { err = errno; ntfs_log_error("Failed to open INDEX_ROOT attribute. " - "Leaving inconsist metadata."); + "Leaving inconsistent metadata."); goto err_out; } if (ntfs_attr_truncate(na, new_index_length + offsetof( INDEX_ROOT, index))) { err = errno; ntfs_log_error("Failed to truncate INDEX_ROOT " - "attribute. Leaving inconsist " + "attribute. Leaving inconsistent " "metadata."); goto err_out; } diff --git a/libntfs/logfile.c b/libntfs/logfile.c index 9f67acc9..1c1e392c 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -339,7 +339,7 @@ err_out: * copy of the complete multi sector transfer deprotected page. On failure, * *@wrp is undefined. * - * Simillarly, if @lsn is not NULL, on succes *@lsn will be set to the current + * Similarly, if @lsn is not NULL, on success *@lsn will be set to the current * logfile lsn according to this restart page. On failure, *@lsn is undefined. * * The following error codes are defined: diff --git a/libntfs/volume.c b/libntfs/volume.c index b8285d4d..8cb65305 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -626,8 +626,8 @@ exit: * ntfs_hiberfile_open - Find and open '/hiberfil.sys' * @vol: An ntfs volume obtained from ntfs_mount * - * Return: inode Success, hibefil.sys is valid - * NULL hibefil.sys doesn't exist or some other error occurred + * Return: inode Success, hiberfil.sys is valid + * NULL hiberfil.sys doesn't exist or some other error occurred */ static ntfs_inode *ntfs_hiberfile_open(ntfs_volume *vol) { diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 6470ffc7..16d4cdc1 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1448,7 +1448,7 @@ static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, * If @type is AT_END, seek to the end of the base mft record ignoring the * attribute list completely and return -1 with errno set to ENOENT. AT_END is * not a valid attribute, its length is zero for example, thus it is safer to - * return error instead of success in this case. It should never ne needed to + * return error instead of success in this case. It should never be needed to * do this, but we implement the functionality because it allows for simpler * code inside ntfs_external_attr_find(). * From 0ffab99a56b426e2e75fa41e029c68e3c55cf4a1 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 2 Nov 2005 20:47:19 +0000 Subject: [PATCH 2690/2994] mkntfs: don't fill the last $MFT cluster with empty MFT records. This is needed to conform to Windows' format behavior for NTFS v3.1 --- ChangeLog | 2 ++ ntfsprogs/mkntfs.c | 40 +++++----------------------------------- 2 files changed, 7 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad4d223f..76037019 100644 --- a/ChangeLog +++ b/ChangeLog @@ -56,6 +56,8 @@ xx/xx/2005 - 1.12.2-WIP the device argument: no -d or --device option is needed. (Szaka) - ntfsinfo: figure out and dump index attribute types. (Szaka) - ntfsinfo: dump index attribute keys. (Szaka) + - mkntfs: don't fill the last $MFT cluster with empty MFT records. + This is needed to conform to Windows' format behavior. (Szaka) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 16d4cdc1..6b7d5e78 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3812,13 +3812,10 @@ static void mkntfs_initialize_bitmaps(void) for (i = opts.nr_clusters; i < lcn_bitmap_byte_size << 3; i++) ntfs_bit_set(lcn_bitmap, (u64)i, 1); /* - * Determine mft_size: (16 (1.2) or 28 (3.0+) mft records) or - * 1 cluster, which ever is bigger, rounded to multiples of cluster - * size + * Determine mft_size: (16 (1.2) or 28 (3.0+) mft records) */ - opts.mft_size = ((16 + 12 * (vol->major_ver >= 3)) * - vol->mft_record_size + vol->cluster_size - 1) - & ~(vol->cluster_size - 1); + opts.mft_size = ((16 + 12 * (vol->major_ver >= 3)) * + vol->mft_record_size); mkDprintf("MFT size = %i (0x%x) bytes\n", opts.mft_size, opts.mft_size); /* Determine mft bitmap size and allocate it. */ mft_bitmap_size = opts.mft_size / vol->mft_record_size; @@ -3903,8 +3900,8 @@ static void mkntfs_initialize_rl_mft(void) strerror(errno)); rl_mft[0].vcn = 0LL; rl_mft[0].lcn = opts.mft_lcn; - /* We already rounded mft size up to a cluster. */ - j = opts.mft_size / vol->cluster_size; + /* rounded up division by cluster size */ + j = (opts.mft_size + vol->cluster_size - 1 ) / vol->cluster_size; rl_mft[1].vcn = rl_mft[0].length = j; rl_mft[1].lcn = -1LL; rl_mft[1].length = 0LL; @@ -4278,7 +4275,6 @@ static void mkntfs_create_root_structures(void) MFT_RECORD *m; MFT_REF root_ref, extend_ref; int i, j, err; - unsigned mft_total_cluster_size; u8 *sd; FILE_ATTR_FLAGS extend_flags; VOLUME_FLAGS volume_flags = 0; @@ -4306,32 +4302,6 @@ static void mkntfs_create_root_structures(void) if ( i > 0 ) m->sequence_number = cpu_to_le16(i); if ( i == 0) m->sequence_number = cpu_to_le16(1); } - /* - * If a cluster contains more than the 16 (ntfs 1.2) or - * 28 (ntfs 3.0+) system files, fill the rest - * with empty, formatted records. - */ - mft_total_cluster_size = vol->cluster_size * - (((16 + 12 * (vol->major_ver >= 3) -1) - * vol->mft_record_size) / vol->cluster_size + 1); - if (mft_total_cluster_size > (16 + 12 * (vol->major_ver >= 3))* - vol->mft_record_size) { - for (i = 16 + 12 * (vol->major_ver >= 3); - i * vol->mft_record_size < mft_total_cluster_size; i++) - { - if (ntfs_mft_record_layout(vol, 0, m = - (MFT_RECORD *)(buf + i * vol->mft_record_size))) - err_exit("Error: Failed to layout mft" - " record.\n"); -#if 0 - if (!opts.quiet && opts.verbose > 1) - dump_mft_record((MFT_RECORD*)buf + - i * vol->mft_record_size); -#endif - m->flags = cpu_to_le16(0); - m->sequence_number = cpu_to_le16(i); - } - } /* * Create the 16 system files, adding the system information attribute * to each as well as marking them in use in the mft bitmap. From c4d66f6c8be1ef2bebee3557a32e7263b2155a34 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 2 Nov 2005 21:03:29 +0000 Subject: [PATCH 2691/2994] Don't create 'System Volume Information'. This is never created by format, it's either a side-effect of Distributed Link Tracking Client Service, System Recovery Service, Index Service, WinFS, etc. --- ntfsprogs/mkntfs.c | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 6b7d5e78..fada1e5a 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3812,9 +3812,9 @@ static void mkntfs_initialize_bitmaps(void) for (i = opts.nr_clusters; i < lcn_bitmap_byte_size << 3; i++) ntfs_bit_set(lcn_bitmap, (u64)i, 1); /* - * Determine mft_size: (16 (1.2) or 28 (3.0+) mft records) + * Determine mft_size: (16 (1.2) or 27 (3.0+) mft records) */ - opts.mft_size = ((16 + 12 * (vol->major_ver >= 3)) * + opts.mft_size = ((16 + 11 * (vol->major_ver >= 3)) * vol->mft_record_size); mkDprintf("MFT size = %i (0x%x) bytes\n", opts.mft_size, opts.mft_size); /* Determine mft bitmap size and allocate it. */ @@ -4289,7 +4289,7 @@ static void mkntfs_create_root_structures(void) * sequence numbers of each system file to equal the mft record number * of that file (only for $MFT is the sequence number 1 rather than 0). */ - for (i = 0; i < 16 + 12 * (vol->major_ver >= 3); i++) { + for (i = 0; i < 16 + 11 * (vol->major_ver >= 3); i++) { if (ntfs_mft_record_layout(vol, 0, m = (MFT_RECORD *)(buf + i * vol->mft_record_size))) err_exit("Error: Failed to layout mft record.\n"); @@ -4306,7 +4306,7 @@ static void mkntfs_create_root_structures(void) * Create the 16 system files, adding the system information attribute * to each as well as marking them in use in the mft bitmap. */ - for (i = 0; i < 16 + 12 * (vol->major_ver >= 3); i++) { + for (i = 0; i < 16 + 11 * (vol->major_ver >= 3); i++) { u32 file_attrs; m = (MFT_RECORD*)(buf + i * vol->mft_record_size); @@ -4347,9 +4347,6 @@ static void mkntfs_create_root_structures(void) add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); } - else if (i == 27) - add_attr_std_info(m, file_attrs, - cpu_to_le32(0x0102)); else add_attr_std_info(m, file_attrs, cpu_to_le32(0x00)); } @@ -4855,28 +4852,6 @@ static void mkntfs_create_root_structures(void) if (err < 0) err_exit("Couldn't create $Reparse: %s\n", strerror(-err)); - Vprintf("Creating System Volume Information (mft record 27)\n"); - m = (MFT_RECORD*)(buf + 27 * vol->mft_record_size); - m->flags |= MFT_RECORD_IS_DIRECTORY; - if (!err) - err = create_hardlink(index_block, root_ref, m, - MK_LE_MREF(27, 27), 0LL, 0LL, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | - FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, - "SYSTEM~1", FILE_NAME_DOS); - - if (!err) - err = create_hardlink(index_block, root_ref, m, - MK_LE_MREF(27, 27), 0LL, 0LL, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | - FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, - "System Volume Information", FILE_NAME_WIN32); - if (!err) - err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, - COLLATION_FILE_NAME, opts.index_block_size); - if (err < 0) - err_exit("Couldn't create 'System Volume Information'" - ": %s\n", strerror(-err)); } } From e71ca132c5e737ce008a8bff82bc78c211629599 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 2 Nov 2005 23:14:39 +0000 Subject: [PATCH 2692/2994] Create files in $Extend in the same order as 'format' does. This shouldn't actually matter but it makes ntfscmp happier and helps great deal to catch easily incorrectly created volumes. --- ntfsprogs/mkntfs.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index fada1e5a..1222c7f4 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -4794,34 +4794,14 @@ static void mkntfs_create_root_structures(void) if (vol->major_ver >= 3) { extend_flags = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | FILE_ATTR_DUP_VIEW_INDEX_PRESENT; - Vprintf("Creating $ObjId (mft record 24)\n"); + Vprintf("Creating $Quota (mft record 24)\n"); m = (MFT_RECORD*)(buf + 24 * vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; m->flags |= MFT_RECORD_IS_8; - if (!err) - err = create_hardlink_res((MFT_RECORD*)(buf + - 11 * vol->mft_record_size), extend_ref, - m, MK_LE_MREF(24, 24), 0LL, 0LL, - extend_flags, 0, 0, "$ObjId", - FILE_NAME_WIN32_AND_DOS); - - // FIXME: This should be IGNORE_CASE - if (!err) - err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, - COLLATION_NTOFS_ULONGS, opts.index_block_size); - if (!err) - err = initialize_objid(m, volume_obj_id->object_id, - MK_LE_MREF(FILE_Volume, FILE_Volume)); - if (err < 0) - err_exit("Couldn't create $ObjId: %s\n", strerror(-err)); - Vprintf("Creating $Quota (mft record 25)\n"); - m = (MFT_RECORD*)(buf + 25 * vol->mft_record_size); - m->flags |= MFT_RECORD_IS_4; - m->flags |= MFT_RECORD_IS_8; if (!err) err = create_hardlink_res((MFT_RECORD*)(buf + 11 * vol->mft_record_size), extend_ref, m, - MK_LE_MREF(25, 25), 0LL, 0LL, extend_flags + MK_LE_MREF(24, 24), 0LL, 0LL, extend_flags , 0, 0, "$Quota", FILE_NAME_WIN32_AND_DOS); // FIXME: This should be IGNORE_CASE if (!err) @@ -4835,6 +4815,26 @@ static void mkntfs_create_root_structures(void) err = initialize_quota(m); if (err < 0) err_exit("Couldn't create $Quota: %s\n", strerror(-err)); + Vprintf("Creating $ObjId (mft record 25)\n"); + m = (MFT_RECORD*)(buf + 25 * vol->mft_record_size); + m->flags |= MFT_RECORD_IS_4; + m->flags |= MFT_RECORD_IS_8; + if (!err) + err = create_hardlink_res((MFT_RECORD*)(buf + + 11 * vol->mft_record_size), extend_ref, + m, MK_LE_MREF(25, 25), 0LL, 0LL, + extend_flags, 0, 0, "$ObjId", + FILE_NAME_WIN32_AND_DOS); + + // FIXME: This should be IGNORE_CASE + if (!err) + err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, + COLLATION_NTOFS_ULONGS, opts.index_block_size); + if (!err) + err = initialize_objid(m, volume_obj_id->object_id, + MK_LE_MREF(FILE_Volume, FILE_Volume)); + if (err < 0) + err_exit("Couldn't create $ObjId: %s\n", strerror(-err)); Vprintf("Creating $Reparse (mft record 26)\n"); m = (MFT_RECORD*)(buf + 26 * vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; From 44b2d2333ca784e18750124f0f4937d3cb1d199f Mon Sep 17 00:00:00 2001 From: szaka Date: Thu, 3 Nov 2005 01:43:27 +0000 Subject: [PATCH 2693/2994] Dump $Quota:$O key SID according to the standard textual representation --- ntfsprogs/ntfsinfo.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 46621a14..1d113203 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1124,7 +1124,7 @@ typedef enum { static void ntfs_dump_index_key(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) { - unsigned i; + char *sid; char printable_GUID[37]; switch (type) { @@ -1149,19 +1149,9 @@ static void ntfs_dump_index_key(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) le64_to_cpu(entry->key.reparse.file_id)); break; case INDEX_ATTR_QUOTA_O: - ntfs_log_verbose("\t\tKey revision:\t\t %u\n", - entry->key.sid.revision); - ntfs_log_verbose("\t\tKey sub authority count: %u\n", - entry->key.sid.sub_authority_count); - ntfs_log_verbose("\t\tKey ident. auth. high: 0x%04x\n", - le16_to_cpu(entry->key.sid. - identifier_authority.high_part)); - ntfs_log_verbose("\t\tKey ident. auth. low: 0x%08x\n", - le32_to_cpu(entry->key.sid. - identifier_authority.low_part)); - for (i = 0; i < entry->key.sid.sub_authority_count; i++) - ntfs_log_verbose("\t\tKey sub authority:\t 0x%08x\n", - le32_to_cpu(entry->key.sid.sub_authority[i])); + sid = ntfs_sid_to_mbs(&entry->key.sid, NULL, 0); + ntfs_log_verbose("\t\tKey SID:\t\t %s\n", sid); + free(sid); break; case INDEX_ATTR_QUOTA_Q: ntfs_log_verbose("\t\tKey owner id:\t\t %u\n", From 9e9179b30717a1d2c06c4f752f2c17e755aea527 Mon Sep 17 00:00:00 2001 From: uvman Date: Thu, 3 Nov 2005 19:20:14 +0000 Subject: [PATCH 2694/2994] Comment format improvements --- include/ntfs/bitmap.h | 1 + include/ntfs/device.h | 3 + include/ntfs/inode.h | 8 +- include/ntfs/layout.h | 244 +++++++++++++++++++++-------------------- include/ntfs/list.h | 11 +- include/ntfs/logfile.h | 46 ++++---- include/ntfs/runlist.h | 3 +- include/ntfs/types.h | 3 +- include/ntfs/volume.h | 5 +- 9 files changed, 167 insertions(+), 157 deletions(-) diff --git a/include/ntfs/bitmap.h b/include/ntfs/bitmap.h index 1910cb52..c12a786a 100644 --- a/include/ntfs/bitmap.h +++ b/include/ntfs/bitmap.h @@ -139,6 +139,7 @@ static __inline__ int ntfs_bitmap_clear_bit(ntfs_attr *na, s64 bit) /** * struct ntfs_bmp - + * * a cache for either dir/$BITMAP, $MFT/$BITMAP or $Bitmap/$DATA */ struct ntfs_bmp { diff --git a/include/ntfs/device.h b/include/ntfs/device.h index 2a41bcf9..de91687c 100644 --- a/include/ntfs/device.h +++ b/include/ntfs/device.h @@ -33,6 +33,7 @@ /** * enum ntfs_device_state_bits - + * * Defined bits for the state field in the ntfs_device structure. */ typedef enum { @@ -59,6 +60,7 @@ typedef enum { /** * struct ntfs_device - + * * The ntfs device structure defining all operations needed to access the low * level device underlying the ntfs volume. */ @@ -74,6 +76,7 @@ struct stat; /** * struct ntfs_device_operations - + * * The ntfs device operations defining all operations that can be performed on * the low level device described by an ntfs device structure. */ diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 2091d557..98d3e84a 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -34,6 +34,7 @@ typedef struct _ntfs_inode ntfs_inode; /** * enum ntfs_inode_state_bits - + * * Defined bits for the state field in the ntfs_inode structure. * (f) = files only, (d) = directories only */ @@ -110,9 +111,10 @@ typedef enum { test_and_clear_nino_flag(ni, FileNameDirty) /** - * struct _ntfs_inode - - * The NTFS in-memory inode structure. It is just used as an extension to the - * fields already provided in the VFS inode. + * struct _ntfs_inode - The NTFS in-memory inode structure. + * + * It is just used as an extension to the fields already provided in the VFS + * inode. */ struct _ntfs_inode { u64 mft_no; /* Inode / mft record number. */ diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 3907bac7..2ff93567 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -44,8 +44,7 @@ */ /** - * struct BIOS_PARAMETER_BLOCK - - * BIOS parameter block (bpb) structure. + * struct BIOS_PARAMETER_BLOCK - BIOS parameter block (bpb) structure. */ typedef struct { u16 bytes_per_sector; /* Size of a sector in bytes. */ @@ -66,8 +65,7 @@ typedef struct { } __attribute__((__packed__)) BIOS_PARAMETER_BLOCK; /** - * struct NTFS_BOOT_SECTOR - - * NTFS boot sector structure. + * struct NTFS_BOOT_SECTOR - NTFS boot sector structure. */ typedef struct { u8 jump[3]; /* Irrelevant (jump to boot up code).*/ @@ -101,6 +99,7 @@ typedef struct { /** * enum NTFS_RECORD_TYPES - + * * Magic identifiers present at the beginning of all ntfs record containing * records (like mft records for example). */ @@ -170,6 +169,7 @@ typedef enum { /** * struct NTFS_RECORD - + * * The Update Sequence Array (usa) is an array of the u16 values which belong * to the end of each sector protected by the update sequence record in which * this array is contained. Note that the first entry is the Update Sequence @@ -197,12 +197,12 @@ typedef struct { } __attribute__((__packed__)) NTFS_RECORD; /** - * enum NTFS_SYSTEM_FILES - - * System files mft record numbers. All these files are always marked as used - * in the bitmap attribute of the mft; presumably in order to avoid accidental - * allocation for random other mft records. Also, the sequence number for each - * of the system files is always equal to their mft record number and it is - * never modified. + * enum NTFS_SYSTEM_FILES - System files mft record numbers. + * + * All these files are always marked as used in the bitmap attribute of the + * mft; presumably in order to avoid accidental allocation for random other + * mft records. Also, the sequence number for each of the system files is + * always equal to their mft record number and it is never modified. */ typedef enum { FILE_MFT = 0, /* Master file table (mft). Data attribute @@ -245,6 +245,7 @@ typedef enum { /** * enum MFT_RECORD_FLAGS - + * * These are the so far known MFT_RECORD_* flags (16-bit) which contain * information about the mft record in which they are present. * _4 and _8 are needed by $Extend sub-files (don't know what to @@ -322,7 +323,8 @@ typedef u64 MFT_REF; #define MREF_ERR(x) ((int)((s64)(x))) /** - * struct MFT_RECORD - + * struct MFT_RECORD - An MFT record layout (NTFS 3.1+) + * * The mft record header present at the beginning of every record in the mft. * This is followed by a sequence of variable length attribute records which * is terminated by an attribute of type AT_END which is a truncated attribute @@ -399,7 +401,8 @@ typedef struct { } __attribute__((__packed__)) MFT_RECORD; /** - * struct MFT_RECORD_OLD - + * struct MFT_RECORD_OLD - An MFT record layout (NTFS <=3.0) + * * This is the version without the NTFS 3.1+ specific fields. */ typedef struct { @@ -469,13 +472,15 @@ typedef struct { } __attribute__((__packed__)) MFT_RECORD_OLD; /** - * enum ATTR_TYPES - - * System defined attributes (32-bit). Each attribute type has a corresponding - * attribute name (Unicode string of maximum 64 character length) as described - * by the attribute definitions present in the data attribute of the $AttrDef - * system file. On NTFS 3.0 volumes the names are just as the types are named - * in the below enum exchanging AT_ for the dollar sign ($). If that isn't a - * revealing choice of symbol... (-; + * enum ATTR_TYPES - System defined attributes (32-bit). + * + * Each attribute type has a corresponding attribute name (Unicode string of + * maximum 64 character length) as described by the attribute definitions + * present in the data attribute of the $AttrDef system file. + * + * On NTFS 3.0 volumes the names are just as the types are named in the below + * enum exchanging AT_ for the dollar sign ($). If that isn't a revealing + * choice of symbol... (-; */ typedef enum { AT_UNUSED = const_cpu_to_le32( 0), @@ -500,8 +505,8 @@ typedef enum { } ATTR_TYPES; /** - * enum COLLATION_RULES - - * The collation rules for sorting views/indexes/etc (32-bit). + * enum COLLATION_RULES - The collation rules for sorting views/indexes/etc + * (32-bit). * * COLLATION_UNICODE_STRING - Collate Unicode strings by comparing their binary * Unicode values, except that when a character can be uppercased, the @@ -556,6 +561,7 @@ typedef enum { /** * enum ATTR_DEF_FLAGS - + * * The flags (32-bit) describing attribute properties in the attribute * definition structure. FIXME: This information is based on Regis's * information and, according to him, it is not certain and probably @@ -592,6 +598,7 @@ typedef enum { /** * struct ATTR_DEF - + * * The data attribute of FILE_AttrDef contains a sequence of attribute * definitions for the NTFS volume. With this, it is supposed to be safe for an * older NTFS driver to mount a volume containing a newer NTFS version without @@ -615,8 +622,7 @@ typedef struct { } __attribute__((__packed__)) ATTR_DEF; /** - * enum ATTR_FLAGS - - * Attribute flags (16-bit). + * enum ATTR_FLAGS - Attribute flags (16-bit). */ typedef enum { ATTR_IS_COMPRESSED = const_cpu_to_le16(0x0001), @@ -695,8 +701,7 @@ typedef enum { */ /** - * enum RESIDENT_ATTR_FLAGS - - * Flags of resident attributes (8-bit). + * enum RESIDENT_ATTR_FLAGS - Flags of resident attributes (8-bit). */ typedef enum { RESIDENT_ATTR_IS_INDEXED = 0x01, /* Attribute is referenced in an index @@ -705,8 +710,9 @@ typedef enum { } __attribute__((__packed__)) RESIDENT_ATTR_FLAGS; /** - * struct ATTR_RECORD - - * Attribute record header. Always aligned to 8-byte boundary. + * struct ATTR_RECORD - Attribute record header. + * + * Always aligned to 8-byte boundary. */ typedef struct { /*Ofs*/ @@ -813,8 +819,7 @@ typedef struct { typedef ATTR_RECORD ATTR_REC; /** - * enum FILE_ATTR_FLAGS - - * File attribute flags (32-bit). + * enum FILE_ATTR_FLAGS - File attribute flags (32-bit). */ typedef enum { /* @@ -875,8 +880,7 @@ typedef enum { */ /** - * struct STANDARD_INFORMATION - - * Attribute: Standard information (0x10). + * struct STANDARD_INFORMATION - Attribute: Standard information (0x10). * * NOTE: Always resident. * NOTE: Present in all base file records on a volume. @@ -968,8 +972,7 @@ typedef struct { } __attribute__((__packed__)) STANDARD_INFORMATION; /** - * struct ATTR_LIST_ENTRY - - * Attribute: Attribute list (0x20). + * struct ATTR_LIST_ENTRY - Attribute: Attribute list (0x20). * * - Can be either resident or non-resident. * - Value consists of a sequence of variable length, 8-byte aligned, @@ -1035,8 +1038,8 @@ typedef struct { #define NTFS_MAX_NAME_LEN 255 /** - * enum FILE_NAME_TYPE_FLAGS - - * Possible namespaces for filenames in ntfs (8-bit). + * enum FILE_NAME_TYPE_FLAGS - Possible namespaces for filenames in ntfs. + * (8-bit). */ typedef enum { FILE_NAME_POSIX = 0x00, @@ -1062,8 +1065,7 @@ typedef enum { } __attribute__((__packed__)) FILE_NAME_TYPE_FLAGS; /** - * struct FILE_NAME_ATTR - - * Attribute: Filename (0x30). + * struct FILE_NAME_ATTR - Attribute: Filename (0x30). * * NOTE: Always resident. * NOTE: All fields, except the parent_directory, are only updated when the @@ -1111,12 +1113,14 @@ typedef struct { } __attribute__((__packed__)) FILE_NAME_ATTR; /** - * struct GUID - - * GUID structures store globally unique identifiers (GUID). A GUID is a - * 128-bit value consisting of one group of eight hexadecimal digits, followed - * by three groups of four hexadecimal digits each, followed by one group of - * twelve hexadecimal digits. GUIDs are Microsoft's implementation of the - * distributed computing environment (DCE) universally unique identifier (UUID). + * struct GUID - GUID structures store globally unique identifiers (GUID). + * + * A GUID is a 128-bit value consisting of one group of eight hexadecimal + * digits, followed by three groups of four hexadecimal digits each, followed + * by one group of twelve hexadecimal digits. GUIDs are Microsoft's + * implementation of the distributed computing environment (DCE) universally + * unique identifier (UUID). + * * Example of a GUID: * 1F010768-5A73-BC91-0010-A52216A7227B */ @@ -1130,11 +1134,12 @@ typedef struct { } __attribute__((__packed__)) GUID; /** - * struct OBJ_ID_INDEX_DATA - - * FILE_Extend/$ObjId contains an index named $O. This index contains all - * object_ids present on the volume as the index keys and the corresponding - * mft_record numbers as the index entry data parts. The data part (defined - * below) also contains three other object_ids: + * struct OBJ_ID_INDEX_DATA - FILE_Extend/$ObjId contains an index named $O. + * + * This index contains all object_ids present on the volume as the index keys + * and the corresponding mft_record numbers as the index entry data parts. + * + * The data part (defined below) also contains three other object_ids: * birth_volume_id - object_id of FILE_Volume on which the file was first * created. Optional (i.e. can be zero). * birth_object_id - object_id of file when it was first created. Usually @@ -1155,8 +1160,7 @@ typedef struct { } __attribute__((__packed__)) OBJ_ID_INDEX_DATA; /** - * struct OBJECT_ID_ATTR - - * Attribute: Object id (NTFS 3.0+) (0x40). + * struct OBJECT_ID_ATTR - Attribute: Object id (NTFS 3.0+) (0x40). * * NOTE: Always resident. */ @@ -1185,6 +1189,7 @@ typedef struct { #if 0 /** * enum IDENTIFIER_AUTHORITIES - + * * The pre-defined IDENTIFIER_AUTHORITIES used as SID_IDENTIFIER_AUTHORITY in * the SID structure (see below). */ @@ -1200,6 +1205,7 @@ typedef enum { /* SID string prefix. */ /** * enum RELATIVE_IDENTIFIERS - + * * These relative identifiers (RIDs) are used with the above identifier * authorities to make up universal well-known SIDs. * @@ -1331,6 +1337,7 @@ typedef union { /** * struct SID - + * * The SID structure is a variable-length structure used to uniquely identify * users or groups. SID stands for security identifier. * @@ -1364,8 +1371,7 @@ typedef struct { } __attribute__((__packed__)) SID; /** - * enum SID_CONSTANTS - - * Current constants for SIDs. + * enum SID_CONSTANTS - Current constants for SIDs. */ typedef enum { SID_REVISION = 1, /* Current revision level. */ @@ -1375,8 +1381,7 @@ typedef enum { } SID_CONSTANTS; /** - * enum ACE_TYPES - - * The predefined ACE types (8-bit, see below). + * enum ACE_TYPES - The predefined ACE types (8-bit, see below). */ typedef enum { ACCESS_MIN_MS_ACE_TYPE = 0, @@ -1404,8 +1409,7 @@ typedef enum { } __attribute__((__packed__)) ACE_TYPES; /** - * enum ACE_FLAGS - - * The ACE flags (8-bit) for audit and inheritance (see below). + * enum ACE_FLAGS - The ACE flags (8-bit) for audit and inheritance. * * SUCCESSFUL_ACCESS_ACE_FLAG is only used with system audit and alarm ACE * types to indicate that a message is generated (in Windows!) for successful @@ -1430,6 +1434,7 @@ typedef enum { /** * struct ACE_HEADER - + * * An ACE is an access-control entry in an access-control list (ACL). * An ACE defines access to an object for a specific user or group or defines * the types of access that generate system-administration messages or alarms @@ -1447,8 +1452,9 @@ typedef struct { } __attribute__((__packed__)) ACE_HEADER; /** - * enum ACCESS_MASK - - * The access mask (32-bit). Defines the access rights. + * enum ACCESS_MASK - The access mask (32-bit). + * + * Defines the access rights. */ typedef enum { /* @@ -1582,6 +1588,7 @@ typedef enum { /** * struct GENERIC_MAPPING - + * * The generic mapping array. Used to denote the mapping of each generic * access right to a specific access mask. * @@ -1600,6 +1607,7 @@ typedef struct { /** * struct ACCESS_DENIED_ACE - + * * ACCESS_ALLOWED_ACE, ACCESS_DENIED_ACE, SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE */ typedef struct { @@ -1614,8 +1622,7 @@ typedef struct { SYSTEM_AUDIT_ACE, SYSTEM_ALARM_ACE; /** - * enum OBJECT_ACE_FLAGS - - * The object ACE flags (32-bit). + * enum OBJECT_ACE_FLAGS - The object ACE flags (32-bit). */ typedef enum { ACE_OBJECT_TYPE_PRESENT = const_cpu_to_le32(1), @@ -1642,8 +1649,8 @@ typedef struct { SYSTEM_ALARM_OBJECT_ACE; /** - * struct ACL - - * An ACL is an access-control list (ACL). + * struct ACL - An ACL is an access-control list (ACL). + * * An ACL starts with an ACL header structure, which specifies the size of * the ACL and the number of ACEs it contains. The ACL header is followed by * zero or more access control entries (ACEs). The ACL as well as each ACE @@ -1660,8 +1667,7 @@ typedef struct { } __attribute__((__packed__)) ACL; /** - * enum ACL_CONSTANTS - - * Current constants for ACLs. + * enum ACL_CONSTANTS - Current constants for ACLs. */ typedef enum { /* Current revision. */ @@ -1679,6 +1685,7 @@ typedef enum { /** * enum SECURITY_DESCRIPTOR_CONTROL - + * * The security descriptor control flags (16-bit). * * SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the @@ -1744,6 +1751,7 @@ typedef enum { /** * struct SECURITY_DESCRIPTOR_RELATIVE - + * * Self-relative security descriptor. Contains the owner and group SIDs as well * as the sacl and dacl ACLs inside the security descriptor itself. */ @@ -1770,12 +1778,14 @@ typedef struct { } __attribute__((__packed__)) SECURITY_DESCRIPTOR_RELATIVE; /** - * struct SECURITY_DESCRIPTOR - - * Absolute security descriptor. Does not contain the owner and group SIDs, nor - * the sacl and dacl ACLs inside the security descriptor. Instead, it contains - * pointers to these structures in memory. Obviously, absolute security - * descriptors are only useful for in memory representations of security - * descriptors. On disk, a self-relative security descriptor is used. + * struct SECURITY_DESCRIPTOR - Absolute security descriptor. + * + * Does not contain the owner and group SIDs, nor the sacl and dacl ACLs inside + * the security descriptor. Instead, it contains pointers to these structures + * in memory. Obviously, absolute security descriptors are only useful for in + * memory representations of security descriptors. + * + * On disk, a self-relative security descriptor is used. */ typedef struct { u8 revision; /* Revision level of the security descriptor. */ @@ -1800,6 +1810,7 @@ typedef struct { /** * enum SECURITY_DESCRIPTOR_CONSTANTS - + * * Current constants for security descriptors. */ typedef enum { @@ -1813,8 +1824,9 @@ typedef enum { } SECURITY_DESCRIPTOR_CONSTANTS; /* - * Attribute: Security descriptor (0x50). A standard self-relative security - * descriptor. + * Attribute: Security descriptor (0x50). + * + * A standard self-relative security descriptor. * * NOTE: Can be resident or non-resident. * NOTE: Not used in NTFS 3.0+, as security descriptors are stored centrally @@ -1864,6 +1876,7 @@ typedef SECURITY_DESCRIPTOR_RELATIVE SECURITY_DESCRIPTOR_ATTR; /** * struct SECURITY_DESCRIPTOR_HEADER - + * * This header precedes each security descriptor in the $SDS data stream. * This is also the index entry data part of both the $SII and $SDH indexes. */ @@ -1904,6 +1917,7 @@ typedef struct { /** * struct SDS_ENTRY - + * * The $SDS data stream contains the security descriptors, aligned on 16-byte * boundaries, sorted by security_id in a B+ tree. Security descriptors cannot * cross 256kib boundaries (this restriction is imposed by the Windows cache @@ -1926,19 +1940,19 @@ typedef struct { } __attribute__((__packed__)) SDS_ENTRY; /** - * struct SII_INDEX_KEY - - * The index entry key used in the $SII index. The collation type is - * COLLATION_NTOFS_ULONG. + * struct SII_INDEX_KEY - The index entry key used in the $SII index. + * + * The collation type is COLLATION_NTOFS_ULONG. */ typedef struct { u32 security_id; /* The security_id assigned to the descriptor. */ } __attribute__((__packed__)) SII_INDEX_KEY; /** - * struct SDH_INDEX_KEY - - * The index entry key used in the $SDH index. The keys are sorted first by - * hash and then by security_id. The collation rule is - * COLLATION_NTOFS_SECURITY_HASH. + * struct SDH_INDEX_KEY - The index entry key used in the $SDH index. + * + * The keys are sorted first by hash and then by security_id. + * The collation rule is COLLATION_NTOFS_SECURITY_HASH. */ typedef struct { u32 hash; /* Hash of the security descriptor. */ @@ -1946,8 +1960,7 @@ typedef struct { } __attribute__((__packed__)) SDH_INDEX_KEY; /** - * struct VOLUME_NAME - - * Attribute: Volume name (0x60). + * struct VOLUME_NAME - Attribute: Volume name (0x60). * * NOTE: Always resident. * NOTE: Present only in FILE_Volume. @@ -1957,8 +1970,7 @@ typedef struct { } __attribute__((__packed__)) VOLUME_NAME; /** - * enum VOLUME_FLAGS - - * Possible flags for the volume (16-bit). + * enum VOLUME_FLAGS - Possible flags for the volume (16-bit). */ typedef enum { VOLUME_IS_DIRTY = const_cpu_to_le16(0x0001), @@ -1972,8 +1984,7 @@ typedef enum { } __attribute__((__packed__)) VOLUME_FLAGS; /** - * struct VOLUME_INFORMATION - - * Attribute: Volume information (0x70). + * struct VOLUME_INFORMATION - Attribute: Volume information (0x70). * * NOTE: Always resident. * NOTE: Present only in FILE_Volume. @@ -1988,8 +1999,7 @@ typedef struct { } __attribute__((__packed__)) VOLUME_INFORMATION; /** - * struct DATA_ATTR - - * Attribute: Data attribute (0x80). + * struct DATA_ATTR - Attribute: Data attribute (0x80). * * NOTE: Can be resident or non-resident. * @@ -2000,8 +2010,7 @@ typedef struct { } __attribute__((__packed__)) DATA_ATTR; /** - * enum INDEX_HEADER_FLAGS - - * Index header flags (8-bit). + * enum INDEX_HEADER_FLAGS - Index header flags (8-bit). */ typedef enum { /* When index header is in an index root attribute: */ @@ -2024,6 +2033,7 @@ typedef enum { /** * struct INDEX_HEADER - + * * This is the header for indexes, describing the INDEX_ENTRY records, which * follow the INDEX_HEADER. Together the index header and the index entries * make up a complete index. @@ -2052,8 +2062,7 @@ typedef struct { } __attribute__((__packed__)) INDEX_HEADER; /** - * struct INDEX_ROOT - - * Attribute: Index root (0x90). + * struct INDEX_ROOT - Attribute: Index root (0x90). * * NOTE: Always resident. * @@ -2095,8 +2104,7 @@ typedef struct { } __attribute__((__packed__)) INDEX_ROOT; /** - * struct INDEX_BLOCK - - * Attribute: Index allocation (0xa0). + * struct INDEX_BLOCK - Attribute: Index allocation (0xa0). * * NOTE: Always non-resident (doesn't make sense to be resident anyway!). * @@ -2130,6 +2138,7 @@ typedef INDEX_BLOCK INDEX_ALLOCATION; /** * struct REPARSE_INDEX_KEY - + * * The system file FILE_Extend/$Reparse contains an index named $R listing * all reparse points on the volume. The index entry keys are as defined * below. Note, that there is no index data associated with the index entries. @@ -2145,8 +2154,7 @@ typedef struct { } __attribute__((__packed__)) REPARSE_INDEX_KEY; /** - * enum QUOTA_FLAGS - - * Quota flags (32-bit). + * enum QUOTA_FLAGS - Quota flags (32-bit). */ typedef enum { /* The user quota flags. Names explain meaning. */ @@ -2171,6 +2179,7 @@ typedef enum { /** * struct QUOTA_CONTROL_ENTRY - + * * The system file FILE_Extend/$Quota contains two indexes $O and $Q. Quotas * are on a per volume and per user basis. * @@ -2205,8 +2214,7 @@ typedef struct { } __attribute__((__packed__)) QUOTA_CONTROL_ENTRY; /** - * enum PREDEFINED_OWNER_IDS - - * Predefined owner_id values (32-bit). + * enum PREDEFINED_OWNER_IDS - Predefined owner_id values (32-bit). */ typedef enum { QUOTA_INVALID_ID = const_cpu_to_le32(0x00000000), @@ -2215,8 +2223,7 @@ typedef enum { } PREDEFINED_OWNER_IDS; /** - * enum INDEX_ENTRY_FLAGS - - * Index entry flags (16-bit). + * enum INDEX_ENTRY_FLAGS - Index entry flags (16-bit). */ typedef enum { INDEX_ENTRY_NODE = const_cpu_to_le16(1), /* This entry contains a @@ -2231,8 +2238,7 @@ typedef enum { } __attribute__((__packed__)) INDEX_ENTRY_FLAGS; /** - * struct INDEX_ENTRY_HEADER - - * This the index entry header (see below). + * struct INDEX_ENTRY_HEADER - This the index entry header (see below). */ typedef struct { /* 0*/ union { /* Only valid when INDEX_ENTRY_END is not set. */ @@ -2259,10 +2265,11 @@ typedef struct { } __attribute__((__packed__)) INDEX_ENTRY_HEADER; /** - * struct INDEX_ENTRY - - * This is an index entry. A sequence of such entries follows each INDEX_HEADER - * structure. Together they make up a complete index. The index follows either - * an index root attribute or an index allocation attribute. + * struct INDEX_ENTRY - This is an index entry. + * + * A sequence of such entries follows each INDEX_HEADER structure. Together + * they make up a complete index. The index follows either an index root + * attribute or an index allocation attribute. * * NOTE: Before NTFS 3.0 only filename attributes were indexed. */ @@ -2325,8 +2332,7 @@ typedef struct { } __attribute__((__packed__)) INDEX_ENTRY; /** - * struct BITMAP_ATTR - - * Attribute: Bitmap (0xb0). + * struct BITMAP_ATTR - Attribute: Bitmap (0xb0). * * Contains an array of bits (aka a bitfield). * @@ -2341,6 +2347,7 @@ typedef struct { /** * enum PREDEFINED_REPARSE_TAGS - + * * The reparse point tag defines the type of the reparse point. It also * includes several flags, which further describe the reparse point. * @@ -2382,8 +2389,7 @@ typedef enum { } PREDEFINED_REPARSE_TAGS; /** - * struct REPARSE_POINT - - * Attribute: Reparse point (0xc0). + * struct REPARSE_POINT - Attribute: Reparse point (0xc0). * * NOTE: Can be resident or non-resident. */ @@ -2395,8 +2401,7 @@ typedef struct { } __attribute__((__packed__)) REPARSE_POINT; /** - * struct EA_INFORMATION - - * Attribute: Extended attribute (EA) information (0xd0). + * struct EA_INFORMATION - Attribute: Extended attribute information (0xd0). * * NOTE: Always resident. */ @@ -2413,8 +2418,7 @@ typedef struct { } __attribute__((__packed__)) EA_INFORMATION; /** - * enum EA_FLAGS - - * Extended attribute flags (8-bit). + * enum EA_FLAGS - Extended attribute flags (8-bit). */ typedef enum { NEED_EA = 0x80, /* Indicate that the file to which the EA @@ -2424,8 +2428,7 @@ typedef enum { } __attribute__((__packed__)) EA_FLAGS; /** - * struct EA_ATTR - - * Attribute: Extended attribute (EA) (0xe0). + * struct EA_ATTR - Attribute: Extended attribute (EA) (0xe0). * * Like the attribute list and the index buffer list, the EA attribute value is * a sequence of EA_ATTR variable length records. @@ -2445,8 +2448,7 @@ typedef struct { } __attribute__((__packed__)) EA_ATTR; /** - * struct PROPERTY_SET - - * Attribute: Property set (0xf0). + * struct PROPERTY_SET - Attribute: Property set (0xf0). * * Intended to support Native Structure Storage (NSS) - a feature removed from * NTFS 3.0 during beta testing. @@ -2456,8 +2458,7 @@ typedef struct { } __attribute__((__packed__)) PROPERTY_SET; /** - * struct LOGGED_UTILITY_STREAM - - * Attribute: Logged utility stream (0x100). + * struct LOGGED_UTILITY_STREAM - Attribute: Logged utility stream (0x100). * * NOTE: Can be resident or non-resident. * @@ -2499,8 +2500,9 @@ typedef struct { */ /** - * struct EFS_ATTR_HEADER - - * The header of the 0x100 attribute named "$EFS". + * struct EFS_ATTR_HEADER - "$EFS" header. + * + * The header of the Logged utility stream (0x100) attribute named "$EFS". */ typedef struct { /* 0*/ u32 length; /* Length of EFS attribute in bytes. */ diff --git a/include/ntfs/list.h b/include/ntfs/list.h index 6a0188a6..9af28aa5 100644 --- a/include/ntfs/list.h +++ b/include/ntfs/list.h @@ -23,9 +23,10 @@ #define _NTFS_LIST_H /** - * struct list_head - - * Simple doubly linked list implementation. - Copied from Linux kernel - * 2.4.2-ac18 into Linux-NTFS (with minor modifications). - AIA + * struct list_head - Simple doubly linked list implementation. + * + * Copied from Linux kernel 2.4.2-ac18 into Linux-NTFS (with minor + * modifications). - AIA * * Some of the internal functions ("__xxx") are useful when * manipulating whole lists rather than single entries, as @@ -47,13 +48,11 @@ struct list_head { } while (0) /** - * __list_add - + * __list_add - Insert a new entry between two known consecutive entries. * @new: * @prev: * @next: * - * Insert a new entry between two known consecutive entries. - * * This is only for internal list manipulation where we know the prev/next * entries already! */ diff --git a/include/ntfs/logfile.h b/include/ntfs/logfile.h index 622f050b..8aadc8c1 100644 --- a/include/ntfs/logfile.h +++ b/include/ntfs/logfile.h @@ -57,8 +57,9 @@ #define MinLogRecordPages 48 /** - * struct RESTART_PAGE_HEADER - - * Log file restart page header (begins the restart area). + * struct RESTART_PAGE_HEADER - Log file restart page header. + * + * Begins the restart area. */ typedef struct { /*Ofs*/ @@ -115,10 +116,11 @@ enum { typedef le16 RESTART_AREA_FLAGS; /** - * struct RESTART_AREA - - * Log file restart area record. The offset of this record is found by adding - * the offset of the RESTART_PAGE_HEADER to the restart_area_offset value found - * in it. See notes at restart_area_offset above. + * struct RESTART_AREA - Log file restart area record. + * + * The offset of this record is found by adding the offset of the + * RESTART_PAGE_HEADER to the restart_area_offset value found in it. + * See notes at restart_area_offset above. */ typedef struct { /*Ofs*/ @@ -255,9 +257,10 @@ typedef struct { } __attribute__((__packed__)) RESTART_AREA; /** - * struct LOG_CLIENT_RECORD - - * Log client record. The offset of this record is found by adding the offset - * of the RESTART_AREA to the client_array_offset value found in it. + * struct LOG_CLIENT_RECORD - Log client record. + * + * The offset of this record is found by adding the offset of the + * RESTART_AREA to the client_array_offset value found in it. */ typedef struct { /*Ofs*/ @@ -295,11 +298,12 @@ typedef struct { } __attribute__((__packed__)) LOG_CLIENT_RECORD; /** - * struct RECORD_PAGE_HEADER - - * Log page record page header. Each log page begins with this header and is - * followed by several LOG_RECORD structures, starting at offset 0x40 (the - * size of this structure and the following update sequence array and then - * aligned to 8 byte boundary, but is this specified anywhere?). + * struct RECORD_PAGE_HEADER - Log page record page header. + * + * Each log page begins with this header and is followed by several LOG_RECORD + * structures, starting at offset 0x40 (the size of this structure and the + * following update sequence array and then aligned to 8 byte boundary, but is + * this specified anywhere?). */ typedef struct { /* 0 NTFS_RECORD; -- Unfolded here as gcc doesn't like unnamed structs. */ @@ -327,8 +331,9 @@ typedef struct { } __attribute__((__packed__)) RECORD_PAGE_HEADER; /** - * enum LOG_RECORD_FLAGS - - * Possible 16-bit flags for log records. (Or is it log record pages?) + * enum LOG_RECORD_FLAGS - Possible 16-bit flags for log records. + * + * (Or is it log record pages?) */ typedef enum { LOG_RECORD_MULTI_PAGE = const_cpu_to_le16(0x0001), /* ??? */ @@ -338,8 +343,7 @@ typedef enum { } __attribute__((__packed__)) LOG_RECORD_FLAGS; /** - * struct LOG_CLIENT_ID - - * The log client id structure identifying a log client. + * struct LOG_CLIENT_ID - The log client id structure identifying a log client. */ typedef struct { u16 seq_number; @@ -347,9 +351,9 @@ typedef struct { } __attribute__((__packed__)) LOG_CLIENT_ID; /** - * struct LOG_RECORD - - * Log record header. Each log record seems to have a constant size of 0x70 - * bytes. + * struct LOG_RECORD - Log record header. + * + * Each log record seems to have a constant size of 0x70 bytes. */ typedef struct { LSN this_lsn; diff --git a/include/ntfs/runlist.h b/include/ntfs/runlist.h index 764d4c9a..726a28dc 100644 --- a/include/ntfs/runlist.h +++ b/include/ntfs/runlist.h @@ -33,8 +33,7 @@ typedef runlist_element runlist; #include "volume.h" /** - * struct _runlist_element - - * runlist_element - in memory vcn to lcn mapping array element + * struct _runlist_element - in memory vcn to lcn mapping array element. * @vcn: starting vcn of the current array element * @lcn: starting lcn of the current array element * @length: length in clusters of the current array element diff --git a/include/ntfs/types.h b/include/ntfs/types.h index e6dc111f..00f83ccc 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -82,8 +82,7 @@ typedef sle64 leLSN; */ #ifndef _WINDEF_H /** - * enum BOOL - - * These are just to make the code more readable... + * enum BOOL - These are just to make the code more readable... */ typedef enum { FALSE = 0, diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 9ee4a137..323e4d1e 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -62,6 +62,7 @@ typedef struct _ntfs_volume ntfs_volume; /** * enum ntfs_mount_flags - + * * Flags returned by the ntfs_check_if_mounted() function. */ typedef enum { @@ -74,6 +75,7 @@ extern int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags); /** * enum ntfs_volume_state_bits - + * * Defined bits for the state field in the ntfs_volume structure. */ typedef enum { @@ -114,8 +116,7 @@ typedef enum { #define NTFS_BUF_SIZE 8192 /** - * struct _ntfs_volume - - * ntfs_volume - structure describing an open volume in memory + * struct _ntfs_volume - structure describing an open volume in memory. */ struct _ntfs_volume { union { From 5660554d88c9870ecfe176d5546aa5c8623a46b8 Mon Sep 17 00:00:00 2001 From: szaka Date: Thu, 3 Nov 2005 21:56:52 +0000 Subject: [PATCH 2695/2994] Set the the same $STANDARD_INFORMATION flags as format for NTFS 3.1 does --- ntfsprogs/mkntfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 1222c7f4..a9c563c3 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -4318,6 +4318,7 @@ static void mkntfs_create_root_structures(void) } file_attrs = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM; if (i == FILE_root) { + file_attrs |= FILE_ATTR_ARCHIVE; if (opts.disable_indexing) file_attrs |= FILE_ATTR_NOT_CONTENT_INDEXED; if (opts.enable_compression) @@ -4335,7 +4336,7 @@ static void mkntfs_create_root_structures(void) add_attr_std_info(m, file_attrs, cpu_to_le32(0x0100)); else if (i == 9) { - file_attrs |= FILE_ATTR_NOT_CONTENT_INDEXED; + file_attrs |= FILE_ATTR_DUP_VIEW_INDEX_PRESENT; add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); } @@ -4343,6 +4344,7 @@ static void mkntfs_create_root_structures(void) add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); else if (i ==24 || i == 25 || i == 26) { + file_attrs |= FILE_ATTR_ARCHIVE; file_attrs |= FILE_ATTR_DUP_VIEW_INDEX_PRESENT; add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); @@ -4793,7 +4795,7 @@ static void mkntfs_create_root_structures(void) // starting vith file 24 (ignoring file 16-23) if (vol->major_ver >= 3) { extend_flags = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | - FILE_ATTR_DUP_VIEW_INDEX_PRESENT; + FILE_ATTR_ARCHIVE | FILE_ATTR_DUP_VIEW_INDEX_PRESENT; Vprintf("Creating $Quota (mft record 24)\n"); m = (MFT_RECORD*)(buf + 24 * vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; From 5bbb43d94786c3cb82621287bd8f46db7fb18927 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 4 Nov 2005 22:43:10 +0000 Subject: [PATCH 2696/2994] fix really hard to trigger bug in ntfs_delete --- ChangeLog | 1 - libntfs/dir.c | 18 +++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76037019..76a3569b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -58,7 +58,6 @@ xx/xx/2005 - 1.12.2-WIP - ntfsinfo: dump index attribute keys. (Szaka) - mkntfs: don't fill the last $MFT cluster with empty MFT records. This is needed to conform to Windows' format behavior. (Szaka) - 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/dir.c b/libntfs/dir.c index 3ba17a88..6e61686f 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1241,6 +1241,7 @@ int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) ntfs_index_context *ictx = NULL; FILE_NAME_ATTR *fn = NULL; BOOL looking_for_dos_name = FALSE, looking_for_win32_name = FALSE; + BOOL case_sensitive_match = TRUE; int err = 0; ntfs_log_trace("Entering.\n"); @@ -1305,8 +1306,9 @@ search: ntfs_names_are_equal(fn->file_name, fn->file_name_length, name, name_len, (fn->file_name_type == - FILE_NAME_POSIX) ? CASE_SENSITIVE : IGNORE_CASE, - ni->vol->upcase, ni->vol->upcase_len)) { + FILE_NAME_POSIX || case_sensitive_match) ? + CASE_SENSITIVE : IGNORE_CASE, ni->vol->upcase, + ni->vol->upcase_len)) { if (fn->file_name_type == FILE_NAME_WIN32) { looking_for_dos_name = TRUE; ntfs_attr_reinit_search_ctx(actx); @@ -1317,8 +1319,18 @@ search: break; } } - if (errno) + if (errno) { + /* + * If case sensitive search failed, then try once again + * ignoring case. + */ + if (errno == ENOENT && case_sensitive_match) { + case_sensitive_match = FALSE; + ntfs_attr_reinit_search_ctx(actx); + goto search; + } goto err_out; + } /* Search for such FILE_NAME in index. */ ictx = ntfs_index_ctx_get(dir_ni, NTFS_INDEX_I30, 4); if (!ictx) From a41e58f8aa664b8bc5ffaae711e33a927f971c85 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sat, 5 Nov 2005 01:34:21 +0000 Subject: [PATCH 2697/2994] simplify a few things --- libntfs/bootsect.c | 3 +-- libntfs/volume.c | 18 +----------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index cf81bb10..3b625ef2 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -96,8 +96,7 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b, const BOOL silent __attribute /* Check sectors per cluster value is valid. */ ntfs_log_debug("Checking sectors per cluster... "); switch (b->bpb.sectors_per_cluster) { - case 1: case 2: case 4: case 8: case 16: - case 32: case 64: case 128: + case 1: case 2: case 4: case 8: case 16: case 32: case 64: case 128: break; default: goto not_ntfs; diff --git a/libntfs/volume.c b/libntfs/volume.c index 8cb65305..ca6dcd7e 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -75,23 +75,7 @@ */ ntfs_volume *ntfs_volume_alloc(void) { - ntfs_volume *vol; - - vol = (ntfs_volume*)calloc(1, sizeof(ntfs_volume)); - if (vol) { - vol->dev = NULL; - vol->vol_name = NULL; - vol->lcnbmp_ni = NULL; - vol->lcnbmp_na = NULL; - vol->mft_ni = NULL; - vol->mft_na = NULL; - vol->mftbmp_na = NULL; - vol->mftmirr_ni = NULL; - vol->mftmirr_na = NULL; - vol->upcase = NULL; - vol->attrdef = NULL; - } - return vol; + return calloc(1, sizeof(ntfs_volume)); } /** From 77cc19fd5d249c76b6a099455efbe28ec955554c Mon Sep 17 00:00:00 2001 From: flatcap Date: Sat, 5 Nov 2005 01:34:40 +0000 Subject: [PATCH 2698/2994] fix build warning --- libntfs/security.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/security.c b/libntfs/security.c index e95b64a6..62f9bedd 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -258,7 +258,7 @@ err_out: */ void ntfs_generate_guid(GUID *guid) { - int i; + unsigned int i; u8 *p = (u8 *)guid; for (i = 0; i < sizeof(GUID); i++) { From 0efe6a43f13092ccac1eac1ef957abae758e1b11 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sat, 5 Nov 2005 01:41:39 +0000 Subject: [PATCH 2699/2994] use new logging (not completely finished) much code tidying --- ntfsprogs/mkntfs.c | 996 +++++++++++++++++++++++---------------------- 1 file changed, 501 insertions(+), 495 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index a9c563c3..07b17649 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2,7 +2,7 @@ * mkntfs - Part of the Linux-NTFS project. * * Copyright (c) 2000-2005 Anton Altaparmakov - * Copyright (c) 2001-2003 Richard Russon + * Copyright (c) 2001-2005 Richard Russon * Copyright (c) 2002-2005 Szabolcs Szakacsits * Copyright (c) 2005 Erik Sornes * @@ -44,35 +44,31 @@ * Anton Altaparmakov */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #ifdef HAVE_UNISTD_H -# include +#include #endif #ifdef HAVE_STDLIB_H -# include +#include #endif #ifdef HAVE_STDIO_H -# include +#include #endif #ifdef HAVE_STDARG_H -# include +#include #endif #ifdef HAVE_STRING_H -# include +#include #endif #ifdef HAVE_ERRNO_H -# include +#include #endif #ifdef HAVE_TIME_H #include #endif -#ifdef HAVE_GETOPT_H -# include -#else - extern char *optarg; - extern int optind; -#endif #ifdef HAVE_SYS_STAT_H #include #endif @@ -82,6 +78,17 @@ #ifdef HAVE_FCNTL_H #include #endif +#ifdef HAVE_LIMITS_H +#include +#endif + +#ifdef HAVE_GETOPT_H +#include +#else + extern char *optarg; + extern int optind; +#endif + #ifdef HAVE_LINUX_MAJOR_H # include # ifndef MAJOR @@ -120,9 +127,6 @@ (M) <= SCSI_DISK7_MAJOR)) # endif #endif -#ifdef HAVE_LIMITS_H -#include -#endif #if defined(linux) && defined(_IO) && !defined(BLKSSZGET) # define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytes. */ @@ -145,9 +149,10 @@ #include "boot.h" #include "attrdef.h" #include "version.h" +#include "logging.h" #ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS -# error "No default device io operations! Cannot build mkntfs. \ +#error "No default device io operations! Cannot build mkntfs. \ You need to run ./configure without the --disable-default-device-io-ops \ switch if you want to be able to build the NTFS utilities." #endif @@ -157,7 +162,10 @@ switch if you want to be able to build the NTFS utilities." const char *EXEC_NAME = "mkntfs"; -/* Need these global so mkntfs_exit can access them. */ +/** + * global variables + * Need these global so mkntfs_exit can access them. + */ u8 *buf = NULL; u8 *buf2 = NULL; int buf2_size = 0; @@ -176,7 +184,10 @@ INDEX_ALLOCATION *index_block = NULL; ntfs_volume *vol; char *dev_name; -struct { +/** + * struct mkntfs_options + */ +struct mkntfs_options { long long part_start_sect; /* -p, start sector of partition on parent device */ long long nr_sectors; /* size of device in sectors */ @@ -229,42 +240,6 @@ struct { 00:00:00 UTC, Jan 1, 1970. */ } opts; -/** - * mkDprintf - debugging output (-vv); overridden by quiet (-q) - */ -__attribute__((format(printf, 1, 2))) -static void mkDprintf(const char *fmt, ...) -{ - va_list ap; - - if (!opts.quiet && opts.verbose > 1) { - printf("DEBUG: "); - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); - } -} - -/** - * Eprintf - error output; ignores quiet (-q) - */ -int Eprintf(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "ERROR: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - return 0; -} - -/* Generate code for Vprintf() function: Verbose output (-v). */ -GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) - -/* Generate code for Qprintf() function: Quietable output (if not -q). */ -GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) - /** * err_exit - error output and terminate; ignores quiet (-q) */ @@ -280,7 +255,6 @@ static void err_exit(const char *fmt, ...) va_end(ap); fprintf(stderr, "Aborting...\n"); exit(1); - } /** @@ -289,7 +263,7 @@ static void err_exit(const char *fmt, ...) static void copyright(void) { fprintf(stderr, "Copyright (c) 2000-2005 Anton Altaparmakov\n" - "Copyright (c) 2001-2003 Richard Russon\n" + "Copyright (c) 2001-2005 Richard Russon\n" "Create an NTFS volume on a user specified (block) " "device.\n"); } @@ -359,8 +333,8 @@ static void parse_options(int argc, char *argv[]) unsigned long u; char *s; -// Need to have: mft record size, index record size, mft size, -// logfile size, list of bad blocks, check for bad blocks, ... + /* Need to have: mft record size, index record size, mft size, */ + /* logfile size, list of bad blocks, check for bad blocks, ... */ if (argc && *argv) EXEC_NAME = *argv; fprintf(stderr, "%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, @@ -520,7 +494,7 @@ static void append_to_bad_blocks(unsigned long long block) /** * mkntfs_write */ -static __inline__ long long mkntfs_write(struct ntfs_device *dev, +static long long mkntfs_write(struct ntfs_device *dev, const void *b, long long count) { long long bytes_written, total; @@ -534,19 +508,19 @@ static __inline__ long long mkntfs_write(struct ntfs_device *dev, bytes_written = dev->d_ops->write(dev, b, count); if (bytes_written == -1LL) { retry = errno; - Eprintf("Error writing to %s: %s\n", vol->dev->d_name, + ntfs_log_error("Error writing to %s: %s\n", vol->dev->d_name, strerror(errno)); errno = retry; return bytes_written; - } else if (!bytes_written) - ++retry; - else { + } else if (!bytes_written) { + retry++; + } else { count -= bytes_written; total += bytes_written; } } while (count && retry < 3); if (count) - Eprintf("Failed to complete writing to %s after three retries." + ntfs_log_error("Failed to complete writing to %s after three retries." "\n", vol->dev->d_name); return total; } @@ -577,7 +551,8 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, *inited_size = 0LL; if (opts.no_action) return val_len; - total = delta = 0LL; + total = 0LL; + delta = 0LL; for (i = 0; rl[i].length; i++) { length = rl[i].length * vol->cluster_size; /* Don't write sparse runs. */ @@ -585,7 +560,7 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, total += length; if (!val) continue; - // TODO: Check that *val is really zero at pos and len. + /* TODO: Check that *val is really zero at pos and len. */ continue; } /* @@ -607,7 +582,7 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, length); if (bytes_written == -1LL) { retry = errno; - Eprintf("Error writing to %s: %s\n", + ntfs_log_error("Error writing to %s: %s\n", vol->dev->d_name, strerror(errno)); errno = retry; @@ -618,18 +593,19 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, total += bytes_written; if (inited_size) *inited_size += bytes_written; - } else - ++retry; + } else { + retry++; + } } while (length && retry < 3); if (length) { - Eprintf("Failed to complete writing to %s after three " + ntfs_log_error("Failed to complete writing to %s after three " "retries.\n", vol->dev->d_name); return total; } } if (delta) { int eo; - char *b = (char*)calloc(1, delta); + char *b = calloc(1, delta); if (!b) err_exit("Error allocating internal buffer: " "%s\n", strerror(errno)); @@ -724,23 +700,23 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) switch (type) { case AT_STANDARD_INFORMATION: - // TODO + /* TODO */ printf("%s\n", todo); return; case AT_ATTRIBUTE_LIST: - // TODO + /* TODO */ printf("%s\n", todo); return; case AT_FILE_NAME: - // TODO + /* TODO */ printf("%s\n", todo); return; case AT_OBJECT_ID: - // TODO + /* TODO */ printf("%s\n", todo); return; case AT_SECURITY_DESCRIPTOR: - // TODO + /* TODO */ printf("%s\n", todo); return; case AT_VOLUME_NAME: @@ -816,30 +792,30 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) printf(skip, "DATA"); return; case AT_INDEX_ROOT: - // TODO + /* TODO */ printf("%s\n", todo); return; case AT_INDEX_ALLOCATION: - // TODO + /* TODO */ printf("%s\n", todo); return; case AT_BITMAP: printf(skip, "BITMAP"); return; case AT_REPARSE_POINT: - // TODO + /* TODO */ printf("%s\n", todo); return; case AT_EA_INFORMATION: - // TODO + /* TODO */ printf("%s\n", don_t_know); return; case AT_EA: - // TODO + /* TODO */ printf("%s\n", don_t_know); return; case AT_LOGGED_UTILITY_STREAM: - // TODO + /* TODO */ printf("%s\n", don_t_know); return; default: @@ -880,7 +856,7 @@ static void dump_resident_attr(ATTR_RECORD *a) static void dump_mapping_pairs_array(char *b __attribute__((unused)), unsigned int max_len __attribute__((unused))) { - // TODO + /* TODO */ return; } @@ -945,18 +921,21 @@ static void dump_attr_record(ATTR_RECORD *a) if (le32_to_cpu(opts.attr_defs[i].type) >= u) break; if (opts.attr_defs[i].type) { -// printf("type = 0x%x\n", le32_to_cpu(opts.attr_defs[i].type)); -// { char *p = (char*)opts.attr_defs[i].name; -// printf("name = %c%c%c%c%c\n", *p, p[1], p[2], p[3], p[4]); -// } +#if 0 + printf("type = 0x%x\n", le32_to_cpu(opts.attr_defs[i].type)); + { char *p = (char*)opts.attr_defs[i].name; + printf("name = %c%c%c%c%c\n", *p, p[1], p[2], p[3], p[4]); + } +#endif if (ucstos(s, opts.attr_defs[i].name, sizeof(s)) == -1) { - Eprintf("Could not convert Unicode string to single " + ntfs_log_error("Could not convert Unicode string to single " "byte string in current locale.\n"); strncpy(s, "Error converting Unicode string", sizeof(s)); } - } else + } else { strncpy(s, "UNKNOWN_TYPE", sizeof(s)); + } printf("Attribute type = 0x%x (%s)\n", u, s); u = le32_to_cpu(a->length); printf("Length of resident part = %u (0x%x)\n", u, u); @@ -969,7 +948,7 @@ static void dump_attr_record(ATTR_RECORD *a) if (ucstos(s, (ntfschar*)((char*)a + cpu_to_le16(a->name_offset)), min(sizeof(s), a->name_length + 1U)) == -1) { - Eprintf("Could not convert Unicode string to single " + ntfs_log_error("Could not convert Unicode string to single " "byte string in current locale.\n"); strncpy(s, "Error converting Unicode string", sizeof(s)); @@ -978,9 +957,9 @@ static void dump_attr_record(ATTR_RECORD *a) printf("Name = %s\n", s); } printf("Attribute flags = 0x%x: ", le16_to_cpu(u)); - if (!u) + if (!u) { printf("NONE"); - else { + } else { int first = TRUE; if (u & ATTR_COMPRESSION_MASK) { if (u & ATTR_IS_COMPRESSED) { @@ -1100,7 +1079,7 @@ static int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) * appropriate codes exist for simplicity of parsing the return value. */ if (size != ((size + 7) & ~7)) { - Eprintf("make_room_for_attribute() received non 8-byte aligned" + ntfs_log_error("make_room_for_attribute() received non 8-byte aligned" "size.\n"); return -EINVAL; } @@ -1231,8 +1210,6 @@ err_end: } /** - * Internal: - * * ntfs_attr_find - find (next) attribute in mft record * @type: attribute type to find * @name: attribute name to find (optional, i.e. NULL means don't care) @@ -1317,9 +1294,10 @@ static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, if (ctx->is_first) { a = ctx->attr; ctx->is_first = FALSE; - } else + } else { a = (ATTR_RECORD*)((char*)ctx->attr + le32_to_cpu(ctx->attr->length)); + } for (;; a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length))) { if (p2n(a) < p2n(ctx->mrec) || (char*)a > (char*)ctx->mrec + le32_to_cpu(ctx->mrec->bytes_allocated)) @@ -1352,7 +1330,7 @@ static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, } else if (name && !ntfs_names_are_equal(name, name_len, (ntfschar*)((char*)a + le16_to_cpu(a->name_offset)), a->name_length, ic, upcase, upcase_len)) { - register int rc; + int rc; rc = ntfs_names_collate(name, name_len, (ntfschar*)((char*)a + @@ -1387,11 +1365,11 @@ static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, * unnamed. If no @val specified, we have found the attribute * and are done. */ - if (!val) + if (!val) { return 0; /* @val is present; compare values. */ - else { - register int rc; + } else { + int rc; rc = memcmp(val, (char*)a +le16_to_cpu(a->value_offset), min(val_len, @@ -1401,7 +1379,7 @@ static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, * value, there is no matching attribute. */ if (!rc) { - register u32 avl; + u32 avl; avl = le32_to_cpu(a->value_length); if (val_len == avl) return 0; @@ -1529,14 +1507,14 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, s64 bw = 0, inited_size; VCN highest_vcn; ntfschar *uname; -/* + /* if (base record) attr_lookup(); else -*/ + */ if (name_len) { i = (name_len + 1) * sizeof(ntfschar); - uname = (ntfschar*)calloc(1, i); + uname = calloc(1, i); if (!uname) return -errno; name_len = stoucs(uname, name, i); @@ -1544,17 +1522,18 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, free(uname); return -ENAMETOOLONG; } - } else + } else { uname = NULL; + } /* Check if the attribute is already there. */ ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { - Eprintf("Failed to allocate attribute search context.\n"); + ntfs_log_error("Failed to allocate attribute search context.\n"); err = -ENOMEM; goto err_out; } if (ic == IGNORE_CASE) { - Eprintf("FIXME: Hit unimplemented code path #1.\n"); + ntfs_log_error("FIXME: Hit unimplemented code path #1.\n"); err = -EOPNOTSUPP; goto err_out; } @@ -1563,29 +1542,29 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, goto err_out; } if (errno != ENOENT) { - Eprintf("Corrupt inode.\n"); + ntfs_log_error("Corrupt inode.\n"); err = -errno; goto err_out; } a = ctx->attr; if (flags & ATTR_COMPRESSION_MASK) { - Eprintf("Compressed attributes not supported yet.\n"); - // FIXME: Compress attribute into a temporary buffer, set - // val accordingly and save the compressed size. + ntfs_log_error("Compressed attributes not supported yet.\n"); + /* FIXME: Compress attribute into a temporary buffer, set */ + /* val accordingly and save the compressed size. */ err = -EOPNOTSUPP; goto err_out; } if (flags & (ATTR_IS_ENCRYPTED || ATTR_IS_SPARSE)) { - Eprintf("Encrypted/sparse attributes not supported yet.\n"); + ntfs_log_error("Encrypted/sparse attributes not supported yet.\n"); err = -EOPNOTSUPP; goto err_out; } if (flags & ATTR_COMPRESSION_MASK) { hdr_size = 72; - // FIXME: This compression stuff is all wrong. Never mind for - // now. (AIA) + /* FIXME: This compression stuff is all wrong. Never mind for */ + /* now. (AIA) */ if (val_len) - mpa_size = 0; //get_size_for_compressed_mapping_pairs(rl); + mpa_size = 0; /* get_size_for_compressed_mapping_pairs(rl); */ else mpa_size = 0; } else { @@ -1594,12 +1573,13 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0); if (mpa_size < 0) { err = -errno; - Eprintf("Failed to get size for mapping " + ntfs_log_error("Failed to get size for mapping " "pairs.\n"); goto err_out; } - } else + } else { mpa_size = 0; + } } /* Mapping pairs array and next attribute must be 8-byte aligned. */ asize = (((int)hdr_size + ((name_len + 7) & ~7) + mpa_size) + 7) & ~7; @@ -1608,37 +1588,38 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, highest_vcn += rl[i].length; /* Does the value fit inside the allocated size? */ if (highest_vcn * vol->cluster_size < val_len) { - Eprintf("BUG: Allocated size is smaller than data size!\n"); + ntfs_log_error("BUG: Allocated size is smaller than data size!\n"); err = -EINVAL; goto err_out; } err = make_room_for_attribute(m, (char*)a, asize); if (err == -ENOSPC) { - // FIXME: Make space! (AIA) - // can we make it non-resident? if yes, do that. - // does it fit now? yes -> do it. - // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? - // yes -> make non-resident - // does it fit now? yes -> do it. - // make all attributes non-resident - // does it fit now? yes -> do it. - // m is a base record? yes -> allocate extension record - // does the new attribute fit in there? yes -> do it. - // split up runlist into extents and place each in an extension - // record. - // FIXME: the check for needing extension records should be - // earlier on as it is very quick: asize > m->bytes_allocated? + /* + * FIXME: Make space! (AIA) + * can we make it non-resident? if yes, do that. + * does it fit now? yes -> do it. + * m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? + * yes -> make non-resident + * does it fit now? yes -> do it. + * make all attributes non-resident + * does it fit now? yes -> do it. + * m is a base record? yes -> allocate extension record + * does the new attribute fit in there? yes -> do it. + * split up runlist into extents and place each in an extension + * record. + * FIXME: the check for needing extension records should be + * earlier on as it is very quick: asize > m->bytes_allocated? + */ err = -EOPNOTSUPP; goto err_out; - } #ifdef DEBUG - else if (err == -EINVAL) { - fprintf(stderr, "BUG(): in insert_positioned_attribute_in_mft_" + } else if (err == -EINVAL) { + ntfs_log_error("BUG(): in insert_positioned_attribute_in_mft_" "record(): make_room_for_attribute() returned " "error: EINVAL!\n"); goto err_out; - } #endif + } a->type = type; a->length = cpu_to_le32(asize); a->non_resident = 1; @@ -1652,42 +1633,42 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, a->highest_vcn = cpu_to_le64(highest_vcn - 1LL); a->mapping_pairs_offset = cpu_to_le16(hdr_size + ((name_len + 7) & ~7)); memset(a->reserved1, 0, sizeof(a->reserved1)); - // FIXME: Allocated size depends on compression. + /* FIXME: Allocated size depends on compression. */ a->allocated_size = cpu_to_le64(highest_vcn * vol->cluster_size); a->data_size = cpu_to_le64(val_len); if (name_len) memcpy((char*)a + hdr_size, uname, name_len << 1); if (flags & ATTR_COMPRESSION_MASK) { if (flags & ATTR_COMPRESSION_MASK & ~ATTR_IS_COMPRESSED) { - Eprintf("Unknown compression format. Reverting to " + ntfs_log_error("Unknown compression format. Reverting to " "standard compression.\n"); a->flags &= ~ATTR_COMPRESSION_MASK; a->flags |= ATTR_IS_COMPRESSED; } a->compression_unit = 4; inited_size = val_len; - // FIXME: Set the compressed size. + /* FIXME: Set the compressed size. */ a->compressed_size = cpu_to_le64(0); - // FIXME: Write out the compressed data. - // FIXME: err = build_mapping_pairs_compressed(); + /* FIXME: Write out the compressed data. */ + /* FIXME: err = build_mapping_pairs_compressed(); */ err = -EOPNOTSUPP; } else { a->compression_unit = 0; bw = ntfs_rlwrite(vol->dev, rl, val, val_len, &inited_size); if (bw != val_len) - Eprintf("Error writing non-resident attribute value." + ntfs_log_error("Error writing non-resident attribute value." "\n"); err = ntfs_mapping_pairs_build(vol, (u8*)a + hdr_size + ((name_len + 7) & ~7), mpa_size, rl, 0, NULL); } a->initialized_size = cpu_to_le64(inited_size); if (err < 0 || bw != val_len) { - // FIXME: Handle error. - // deallocate clusters - // remove attribute + /* FIXME: Handle error. */ + /* deallocate clusters */ + /* remove attribute */ if (err >= 0) err = -EIO; - Eprintf("insert_positioned_attr_in_mft_record failed with " + ntfs_log_error("insert_positioned_attr_in_mft_record failed with " "error %i.\n", err < 0 ? err : (int)bw); } err_out: @@ -1714,14 +1695,14 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, runlist *rl = NULL; s64 bw = 0; ntfschar *uname; -/* + /* if (base record) attr_lookup(); else -*/ + */ if (name_len) { i = (name_len + 1) * sizeof(ntfschar); - uname = (ntfschar*)calloc(1, i); + uname = calloc(1, i); if (!uname) return -errno; name_len = stoucs(uname, name, i); @@ -1729,17 +1710,18 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, free(uname); return -ENAMETOOLONG; } - } else + } else { uname = AT_UNNAMED; + } /* Check if the attribute is already there. */ ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { - Eprintf("Failed to allocate attribute search context.\n"); + ntfs_log_error("Failed to allocate attribute search context.\n"); err = -ENOMEM; goto err_out; } if (ic == IGNORE_CASE) { - Eprintf("FIXME: Hit unimplemented code path #2.\n"); + ntfs_log_error("FIXME: Hit unimplemented code path #2.\n"); err = -EOPNOTSUPP; goto err_out; } @@ -1748,20 +1730,20 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, goto err_out; } if (errno != ENOENT) { - Eprintf("Corrupt inode.\n"); + ntfs_log_error("Corrupt inode.\n"); err = -errno; goto err_out; } a = ctx->attr; if (flags & ATTR_COMPRESSION_MASK) { - Eprintf("Compressed attributes not supported yet.\n"); - // FIXME: Compress attribute into a temporary buffer, set - // val accordingly and save the compressed size. + ntfs_log_error("Compressed attributes not supported yet.\n"); + /* FIXME: Compress attribute into a temporary buffer, set */ + /* val accordingly and save the compressed size. */ err = -EOPNOTSUPP; goto err_out; } if (flags & (ATTR_IS_ENCRYPTED || ATTR_IS_SPARSE)) { - Eprintf("Encrypted/sparse attributes not supported yet.\n"); + ntfs_log_error("Encrypted/sparse attributes not supported yet.\n"); err = -EOPNOTSUPP; goto err_out; } @@ -1770,18 +1752,19 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, vol->cluster_size - 1) / vol->cluster_size); if (!rl) { err = -errno; - Eprintf("Failed to allocate scattered clusters: %s\n", + ntfs_log_error("Failed to allocate scattered clusters: %s\n", strerror(-err)); goto err_out; } - } else + } else { rl = NULL; + } if (flags & ATTR_COMPRESSION_MASK) { hdr_size = 72; - // FIXME: This compression stuff is all wrong. Never mind for - // now. (AIA) + /* FIXME: This compression stuff is all wrong. Never mind for */ + /* now. (AIA) */ if (val_len) - mpa_size = 0; //get_size_for_compressed_mapping_pairs(rl); + mpa_size = 0; /* get_size_for_compressed_mapping_pairs(rl); */ else mpa_size = 0; } else { @@ -1790,42 +1773,44 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0); if (mpa_size < 0) { err = -errno; - Eprintf("Failed to get size for mapping " + ntfs_log_error("Failed to get size for mapping " "pairs.\n"); goto err_out; } - } else + } else { mpa_size = 0; + } } /* Mapping pairs array and next attribute must be 8-byte aligned. */ asize = (((int)hdr_size + ((name_len + 7) & ~7) + mpa_size) + 7) & ~7; err = make_room_for_attribute(m, (char*)a, asize); if (err == -ENOSPC) { - // FIXME: Make space! (AIA) - // can we make it non-resident? if yes, do that. - // does it fit now? yes -> do it. - // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? - // yes -> make non-resident - // does it fit now? yes -> do it. - // make all attributes non-resident - // does it fit now? yes -> do it. - // m is a base record? yes -> allocate extension record - // does the new attribute fit in there? yes -> do it. - // split up runlist into extents and place each in an extension - // record. - // FIXME: the check for needing extension records should be - // earlier on as it is very quick: asize > m->bytes_allocated? + /* + * FIXME: Make space! (AIA) + * can we make it non-resident? if yes, do that. + * does it fit now? yes -> do it. + * m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? + * yes -> make non-resident + * does it fit now? yes -> do it. + * make all attributes non-resident + * does it fit now? yes -> do it. + * m is a base record? yes -> allocate extension record + * does the new attribute fit in there? yes -> do it. + * split up runlist into extents and place each in an extension + * record. + * FIXME: the check for needing extension records should be + * earlier on as it is very quick: asize > m->bytes_allocated? + */ err = -EOPNOTSUPP; goto err_out; - } #ifdef DEBUG - else if (err == -EINVAL) { - fprintf(stderr, "BUG(): in insert_non_resident_attribute_in_" + } else if (err == -EINVAL) { + ntfs_log_error("BUG(): in insert_non_resident_attribute_in_" "mft_record(): make_room_for_attribute() " "returned error: EINVAL!\n"); goto err_out; - } #endif + } a->type = type; a->length = cpu_to_le32(asize); a->non_resident = 1; @@ -1841,7 +1826,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, a->highest_vcn = cpu_to_le64(rl[i].vcn - 1); a->mapping_pairs_offset = cpu_to_le16(hdr_size + ((name_len + 7) & ~7)); memset(a->reserved1, 0, sizeof(a->reserved1)); - // FIXME: Allocated size depends on compression. + /* FIXME: Allocated size depends on compression. */ a->allocated_size = cpu_to_le64((val_len + (vol->cluster_size - 1)) & ~(vol->cluster_size - 1)); a->data_size = cpu_to_le64(val_len); @@ -1850,33 +1835,33 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, memcpy((char*)a + hdr_size, uname, name_len << 1); if (flags & ATTR_COMPRESSION_MASK) { if (flags & ATTR_COMPRESSION_MASK & ~ATTR_IS_COMPRESSED) { - Eprintf("Unknown compression format. Reverting to " + ntfs_log_error("Unknown compression format. Reverting to " "standard compression.\n"); a->flags &= ~ATTR_COMPRESSION_MASK; a->flags |= ATTR_IS_COMPRESSED; } a->compression_unit = 4; - // FIXME: Set the compressed size. + /* FIXME: Set the compressed size. */ a->compressed_size = cpu_to_le64(0); - // FIXME: Write out the compressed data. - // FIXME: err = build_mapping_pairs_compressed(); + /* FIXME: Write out the compressed data. */ + /* FIXME: err = build_mapping_pairs_compressed(); */ err = -EOPNOTSUPP; } else { a->compression_unit = 0; bw = ntfs_rlwrite(vol->dev, rl, val, val_len, NULL); if (bw != val_len) - Eprintf("Error writing non-resident attribute value." + ntfs_log_error("Error writing non-resident attribute value." "\n"); err = ntfs_mapping_pairs_build(vol, (u8*)a + hdr_size + ((name_len + 7) & ~7), mpa_size, rl, 0, NULL); } if (err < 0 || bw != val_len) { - // FIXME: Handle error. - // deallocate clusters - // remove attribute + /* FIXME: Handle error. */ + /* deallocate clusters */ + /* remove attribute */ if (err >= 0) err = -EIO; - Eprintf("insert_non_resident_attr_in_mft_record failed with " + ntfs_log_error("insert_non_resident_attr_in_mft_record failed with " "error %lld.\n", (long long) (err < 0 ? err : bw)); } err_out: @@ -1903,14 +1888,14 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, ATTR_RECORD *a; int asize, err, i; ntfschar *uname; -/* + /* if (base record) mkntfs_attr_lookup(); else -*/ + */ if (name_len) { i = (name_len + 1) * sizeof(ntfschar); - uname = (ntfschar*)calloc(1, i); + uname = calloc(1, i); if (!uname) return -errno; name_len = stoucs(uname, name, i); @@ -1918,17 +1903,18 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, free(uname); return -ENAMETOOLONG; } - } else + } else { uname = AT_UNNAMED; + } /* Check if the attribute is already there. */ ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { - Eprintf("Failed to allocate attribute search context.\n"); + ntfs_log_error("Failed to allocate attribute search context.\n"); err = -ENOMEM; goto err_out; } if (ic == IGNORE_CASE) { - Eprintf("FIXME: Hit unimplemented code path #3.\n"); + ntfs_log_error("FIXME: Hit unimplemented code path #3.\n"); err = -EOPNOTSUPP; goto err_out; } @@ -1938,7 +1924,7 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, goto err_out; } if (errno != ENOENT) { - Eprintf("Corrupt inode.\n"); + ntfs_log_error("Corrupt inode.\n"); err = -errno; goto err_out; } @@ -1947,26 +1933,28 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, asize = ((24 + ((name_len + 7) & ~7) + val_len) + 7) & ~7; err = make_room_for_attribute(m, (char*)a, asize); if (err == -ENOSPC) { - // FIXME: Make space! (AIA) - // can we make it non-resident? if yes, do that. - // does it fit now? yes -> do it. - // m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? - // yes -> make non-resident - // does it fit now? yes -> do it. - // make all attributes non-resident - // does it fit now? yes -> do it. - // m is a base record? yes -> allocate extension record - // does the new attribute fit in there? yes -> do it. - // split up runlist into extents and place each in an extension - // record. - // FIXME: the check for needing extension records should be - // earlier on as it is very quick: asize > m->bytes_allocated? + /* + * FIXME: Make space! (AIA) + * can we make it non-resident? if yes, do that. + * does it fit now? yes -> do it. + * m's $DATA or $BITMAP+$INDEX_ALLOCATION resident? + * yes -> make non-resident + * does it fit now? yes -> do it. + * make all attributes non-resident + * does it fit now? yes -> do it. + * m is a base record? yes -> allocate extension record + * does the new attribute fit in there? yes -> do it. + * split up runlist into extents and place each in an extension + * record. + * FIXME: the check for needing extension records should be + * earlier on as it is very quick: asize > m->bytes_allocated? + */ err = -EOPNOTSUPP; goto err_out; } #ifdef DEBUG if (err == -EINVAL) { - fprintf(stderr, "BUG(): in insert_resident_attribute_in_mft_" + ntfs_log_error("BUG(): in insert_resident_attribute_in_mft_" "record(): make_room_for_attribute() returned " "error: EINVAL!\n"); goto err_out; @@ -2015,9 +2003,9 @@ static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags, si.last_mft_change_time = si.creation_time; si.last_access_time = si.creation_time; si.file_attributes = flags; /* already LE */ - if (vol->major_ver < 3) + if (vol->major_ver < 3) { memset(&si.reserved12, 0, sizeof(si.reserved12)); - else { + } else { si.maximum_versions = cpu_to_le32(0); si.version_number = cpu_to_le32(0); si.class_id = cpu_to_le32(0); @@ -2034,7 +2022,7 @@ static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags, err = insert_resident_attr_in_mft_record(m, AT_STANDARD_INFORMATION, NULL, 0, 0, 0, 0, (u8*)&si, sd_size); if (err < 0) - Eprintf("add_attr_std_info failed: %s\n", strerror(-err)); + ntfs_log_perror("add_attr_std_info failed"); return err; } @@ -2057,13 +2045,13 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, /* Check if the attribute is already there. */ ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { - Eprintf("Failed to allocate attribute search context.\n"); + ntfs_log_error("Failed to allocate attribute search context.\n"); return -ENOMEM; } if (mkntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { int eo = errno; - Eprintf("BUG: Standard information attribute not present in " + ntfs_log_error("BUG: Standard information attribute not present in " "file record\n"); ntfs_attr_put_search_ctx(ctx); return -eo; @@ -2072,7 +2060,7 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, le16_to_cpu(ctx->attr->value_offset)); i = (strlen(file_name) + 1) * sizeof(ntfschar); fn_size = sizeof(FILE_NAME_ATTR) + i; - fn = (FILE_NAME_ATTR*)malloc(fn_size); + fn = malloc(fn_size); if (!fn) { ntfs_attr_put_search_ctx(ctx); return -errno; @@ -2096,8 +2084,9 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, if (packed_ea_size) { fn->packed_ea_size = cpu_to_le16(packed_ea_size); fn->reserved = cpu_to_le16(0); - } else + } else { fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); + } fn->file_name_type = file_name_type; i = stoucs(fn->file_name, file_name, i); if (i < 1) { @@ -2115,7 +2104,7 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, 0, RESIDENT_ATTR_IS_INDEXED, (u8*)fn, fn_size); free(fn); if (i < 0) - Eprintf("add_attr_file_name failed: %s\n", strerror(-i)); + ntfs_log_error("add_attr_file_name failed: %s\n", strerror(-i)); return i; } @@ -2125,7 +2114,6 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, * add an object_id attribute to the mft record @m * return 0 on success or -errno on error */ - static int add_attr_object_id(MFT_RECORD *m, OBJECT_ID_ATTR *objid_attr, int objid_attr_len) { @@ -2142,9 +2130,8 @@ static int add_attr_object_id(MFT_RECORD *m, OBJECT_ID_ATTR *objid_attr, AT_OBJECT_ID, NULL, 0, 0, 0, 0, (u8*)objid_attr, objid_attr_len); if (err < 0) - Eprintf("add_attr_volume_id failed: %s\n", strerror(-err)); + ntfs_log_error("add_attr_volume_id failed: %s\n", strerror(-err)); return err; - } /** @@ -2170,7 +2157,7 @@ static int add_attr_sd(MFT_RECORD *m, const u8 *sd, const s64 sd_len) AT_SECURITY_DESCRIPTOR, NULL, 0, 0, 0, 0, sd, sd_len); if (err < 0) - Eprintf("add_attr_sd failed: %s\n", strerror(-err)); + ntfs_log_error("add_attr_sd failed: %s\n", strerror(-err)); return err; } @@ -2206,7 +2193,7 @@ static int add_attr_data(MFT_RECORD *m, const char *name, const u32 name_len, name_len, ic, flags, 0, val, val_len); if (err < 0) - Eprintf("add_attr_data failed: %s\n", strerror(-err)); + ntfs_log_error("add_attr_data failed: %s\n", strerror(-err)); return err; } @@ -2229,7 +2216,7 @@ static int add_attr_data_positioned(MFT_RECORD *m, const char *name, err = insert_positioned_attr_in_mft_record(m, AT_DATA, name, name_len, ic, flags, rl, val, val_len); if (err < 0) - Eprintf("add_attr_data_positioned failed: %s\n", + ntfs_log_error("add_attr_data_positioned failed: %s\n", strerror(-err)); return err; } @@ -2273,7 +2260,7 @@ static int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, 0, 0, (u8*)uname, len); free(uname); if (i < 0) - Eprintf("add_attr_vol_name failed: %s\n", strerror(-i)); + ntfs_log_error("add_attr_vol_name failed: %s\n", strerror(-i)); return i; } @@ -2295,7 +2282,7 @@ static int add_attr_vol_info(MFT_RECORD *m, const VOLUME_FLAGS flags, err = insert_resident_attr_in_mft_record(m, AT_VOLUME_INFORMATION, NULL, 0, 0, 0, 0, (u8*)&vi, sizeof(vi)); if (err < 0) - Eprintf("add_attr_vol_info failed: %s\n", strerror(-err)); + ntfs_log_error("add_attr_vol_info failed: %s\n", strerror(-err)); return err; } @@ -2315,14 +2302,14 @@ static int add_attr_index_root(MFT_RECORD *m, const char *name, int err, val_len; val_len = sizeof(INDEX_ROOT) + sizeof(INDEX_ENTRY_HEADER); - r = (INDEX_ROOT*)malloc(val_len); + r = malloc(val_len); if (!r) return -errno; r->type = indexed_attr_type == AT_FILE_NAME ? AT_FILE_NAME : 0; if (indexed_attr_type == AT_FILE_NAME && collation_rule != COLLATION_FILE_NAME) { free(r); - Eprintf("add_attr_index_root: indexed attribute is $FILE_NAME " + ntfs_log_error("add_attr_index_root: indexed attribute is $FILE_NAME " "but collation rule is not COLLATION_FILE_NAME.\n"); return -EINVAL; } @@ -2330,7 +2317,7 @@ static int add_attr_index_root(MFT_RECORD *m, const char *name, r->index_block_size = cpu_to_le32(index_block_size); if (index_block_size >= vol->cluster_size) { if (index_block_size % vol->cluster_size) { - Eprintf("add_attr_index_root: index block size is not " + ntfs_log_error("add_attr_index_root: index block size is not " "a multiple of the cluster size.\n"); free(r); return -EINVAL; @@ -2339,13 +2326,13 @@ static int add_attr_index_root(MFT_RECORD *m, const char *name, vol->cluster_size; } else /* if (vol->cluster_size > index_block_size) */ { if (index_block_size & (index_block_size - 1)) { - Eprintf("add_attr_index_root: index block size is not " + ntfs_log_error("add_attr_index_root: index block size is not " "a power of 2.\n"); free(r); return -EINVAL; } if (index_block_size < (u32)opts.sector_size) { - Eprintf("add_attr_index_root: index block size is " + ntfs_log_error("add_attr_index_root: index block size is " "smaller than the sector size.\n"); free(r); return -EINVAL; @@ -2376,7 +2363,7 @@ static int add_attr_index_root(MFT_RECORD *m, const char *name, name_len, ic, 0, 0, (u8*)r, val_len); free(r); if (err < 0) - Eprintf("add_attr_index_root failed: %s\n", strerror(-err)); + ntfs_log_error("add_attr_index_root failed: %s\n", strerror(-err)); return err; } @@ -2395,7 +2382,7 @@ static int add_attr_index_alloc(MFT_RECORD *m, const char *name, name, name_len, ic, 0, index_alloc_val, index_alloc_val_len); if (err < 0) - Eprintf("add_attr_index_alloc failed: %s\n", strerror(-err)); + ntfs_log_error("add_attr_index_alloc failed: %s\n", strerror(-err)); return err; } @@ -2420,7 +2407,7 @@ static int add_attr_bitmap(MFT_RECORD *m, const char *name, const u32 name_len, name_len, ic, 0, 0, bitmap, bitmap_len); if (err < 0) - Eprintf("add_attr_bitmap failed: %s\n", strerror(-err)); + ntfs_log_error("add_attr_bitmap failed: %s\n", strerror(-err)); return err; } @@ -2442,7 +2429,7 @@ static int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, err = insert_positioned_attr_in_mft_record(m, AT_BITMAP, name, name_len, ic, 0, rl, bitmap, bitmap_len); if (err < 0) - Eprintf("add_attr_bitmap_positioned failed: %s\n", + ntfs_log_error("add_attr_bitmap_positioned failed: %s\n", strerror(-err)); return err; } @@ -2472,7 +2459,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, if (name_len) { i = (name_len + 1) * sizeof(ntfschar); - uname = (ntfschar*)calloc(1, i); + uname = calloc(1, i); if (!uname) return -errno; name_len = stoucs(uname, name, i); @@ -2480,17 +2467,18 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, free(uname); return -ENAMETOOLONG; } - } else + } else { uname = NULL; + } /* Find the index root attribute. */ ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { - Eprintf("Failed to allocate attribute search context.\n"); + ntfs_log_error("Failed to allocate attribute search context.\n"); free(uname); return -ENOMEM; } if (ic == IGNORE_CASE) { - Eprintf("FIXME: Hit unimplemented code path #4.\n"); + ntfs_log_error("FIXME: Hit unimplemented code path #4.\n"); err = -EOPNOTSUPP; free(uname); goto err_out; @@ -2526,12 +2514,12 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, /* Setup header. */ ia_val->magic = magic_INDX; ia_val->usa_ofs = cpu_to_le16(sizeof(INDEX_ALLOCATION)); - if (index_block_size >= NTFS_BLOCK_SIZE) + if (index_block_size >= NTFS_BLOCK_SIZE) { ia_val->usa_count = cpu_to_le16(index_block_size / NTFS_BLOCK_SIZE + 1); - else { + } else { ia_val->usa_count = cpu_to_le16(1); - Qprintf("Sector size is bigger than index block size. Setting " + ntfs_log_quiet("Sector size is bigger than index block size. Setting " "usa_count to 1. If Windows\nchkdsk reports this as " "corruption, please email linux-ntfs-dev@lists.sf.net\n" "stating that you saw this message and that the file " @@ -2577,8 +2565,8 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, if (ntfs_resident_attr_value_resize(m, a, sizeof(INDEX_ROOT) - sizeof(INDEX_HEADER) + le32_to_cpu(r->index.allocated_size))) { - // TODO: Remove the added bitmap! - // Revert index root from index allocation. + /* TODO: Remove the added bitmap! */ + /* Revert index root from index allocation. */ err = -errno; goto err_out; } @@ -2588,7 +2576,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, err = ntfs_mst_pre_write_fixup((NTFS_RECORD*)ia_val, index_block_size); if (err) { err = -errno; - Eprintf("ntfs_mst_pre_write_fixup() failed in " + ntfs_log_error("ntfs_mst_pre_write_fixup() failed in " "upgrade_to_large_index.\n"); goto err_out; } @@ -2596,8 +2584,8 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, index_block_size); ntfs_mst_post_write_fixup((NTFS_RECORD*)ia_val); if (err) { - // TODO: Remove the added bitmap! - // Revert index root from index allocation. + /* TODO: Remove the added bitmap! */ + /* Revert index root from index allocation. */ goto err_out; } *idx = ia_val; @@ -2629,7 +2617,7 @@ static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *idx, * appropriate codes exist for simplicity of parsing the return value. */ if (size != ((size + 7) & ~7)) { - Eprintf("make_room_for_index_entry_in_index_block() received " + ntfs_log_error("make_room_for_index_entry_in_index_block() received " "non 8-byte aligned size.\n"); return -EINVAL; } @@ -2661,38 +2649,41 @@ static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *idx, return 0; } -/* +/** * ntfs_index_keys_compare * - * not alle types of COLLATION_RULES supported yet... + * not all types of COLLATION_RULES supported yet... * added as needed.. (remove this comment when all is added) */ static int ntfs_index_keys_compare(char *key1, char *key2, int key1_length,int key2_length, - COLLATION_RULES collation_rule) { - - int i, j; - - i=j=0; + COLLATION_RULES collation_rule) +{ + int i = 0; + int j = 0; if (collation_rule == COLLATION_NTOFS_ULONG) { -//i.e. $SII or $QUOTA-$Q + /* i.e. $SII or $QUOTA-$Q */ while ((j < min(key1_length, key2_length)) && (i == 0)) { - if (*(u32*)(key1 + j) < *(u32*)(key2 + j)) i = -1; - if (*(u32*)(key1 + j) > *(u32*)(key2 + j)) i = +1; + if (*(u32*)(key1 + j) < *(u32*)(key2 + j)) + i = -1; + if (*(u32*)(key1 + j) > *(u32*)(key2 + j)) + i = +1; if (*(u32*)(key1 + j) == *(u32*)(key2 + j)) { i = 0; j += 4; } } - if ((i == 0) && (key1_length > key2_length)) i = -1; - if ((i == 0) && (key1_length < key2_length)) i = +1; + if ((i == 0) && (key1_length > key2_length)) + i = -1; + if ((i == 0) && (key1_length < key2_length)) + i = +1; return i; } if (collation_rule == COLLATION_NTOFS_ULONGS) { -//i.e $OBJID-$O + /* i.e $OBJID-$O */ while ((j < min(key1_length, key2_length)) && (i == 0)) { if (bswap_32(*(u32*)(key1 + j)) < bswap_32(*(u32*)(key1 + j))) i = -1; @@ -2704,13 +2695,15 @@ static int ntfs_index_keys_compare(char *key1, char *key2, j += 4; } } - if ((i == 0) && (key1_length > key2_length)) i = -1; - if ((i == 0) && (key1_length < key2_length)) i = +1; + if ((i == 0) && (key1_length > key2_length)) + i = -1; + if ((i == 0) && (key1_length < key2_length)) + i = +1; return i; } if (collation_rule == COLLATION_NTOFS_SECURITY_HASH) { -//i.e. $SDH + /* i.e. $SDH */ if (((SDH_INDEX_KEY*)key1)->hash < ((SDH_INDEX_KEY*)key2)->hash) i = -1; if (((SDH_INDEX_KEY*)key1)->hash > @@ -2726,11 +2719,13 @@ static int ntfs_index_keys_compare(char *key1, char *key2, } return i; } - if (collation_rule == COLLATION_NTOFS_SID ) { -//i.e. $QUOTA-O + if (collation_rule == COLLATION_NTOFS_SID) { + /* i.e. $QUOTA-O */ i = memcmp(key1, key2, min(key1_length, key2_length)); - if ((i == 0) && (key1_length > key2_length)) i = -1; - if ((i == 0) && (key1_length < key2_length)) i = +1; + if ((i == 0) && (key1_length > key2_length)) + i = -1; + if ((i == 0) && (key1_length < key2_length)) + i = +1; return i; } @@ -2757,13 +2752,13 @@ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, err = 0; /* does it fit ?*/ - if ( vol->mft_record_size > idx_size + m->bytes_allocated ) + if (vol->mft_record_size > idx_size + m->bytes_allocated) return -ENOSPC; /* find the INDEX_ROOT attribute:*/ ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) { - Eprintf("Failed to allocate attribute search context.\n"); + ntfs_log_error("Failed to allocate attribute search context.\n"); err = -ENOMEM; goto err_out; } @@ -2795,10 +2790,9 @@ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, IGNORE_CASE, vol->upcase, vol->upcase_len); /* - * If @file_name collates before ie->key.file_name, - * there is no - * matching index entry. - */ + * If @file_name collates before ie->key.file_name, + * there is no matching index entry. + */ if (i == -1) break; /* If file names are not equal, continue search. */ @@ -2817,14 +2811,15 @@ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, if (i == -1) break; /* Complete match. Bugger. Can't insert. */ - /*if (!i) +#if 0 + if (!i) return -EEXIST; - */ +#endif do_next: idx_entry = (INDEX_ENTRY*)((char*)idx_entry + le16_to_cpu(idx_entry->length)); } - } else if (type == AT_UNUSED) { // case view + } else if (type == AT_UNUSED) { /* case view */ while ((char*)idx_entry < (char*)idx_end && !(idx_entry->flags & INDEX_ENTRY_END)) { i = ntfs_index_keys_compare((char*)idx_entry + 0x10, @@ -2838,13 +2833,15 @@ do_next: idx_entry = (INDEX_ENTRY*)((char*)idx_entry + le16_to_cpu(idx_entry->length)); } - } else return EINVAL; + } else { + return EINVAL; + } memmove((char*)idx_entry + idx_size, (char*)idx_entry, (char*)m + vol->mft_record_size - ((char*)idx_entry + idx_size)); memcpy((char*)idx_entry, (char*)idx, idx_size); - // adjusting various offsets etc... + /* adjusting various offsets etc... */ m->bytes_in_use += idx_size; a->length += idx_size; a->value_length += idx_size; @@ -2858,12 +2855,12 @@ err_out: } /** - * intialize_secure + * initialize_secure * * initializes $Secure's $SDH and $SII indexes from $SDS datastream */ -static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) { - +static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) +{ int err, sdh_size, sii_size; SECURITY_DESCRIPTOR_HEADER *sds_header; INDEX_ENTRY *idx_entry_sdh, *idx_entry_sii; @@ -2875,12 +2872,12 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) { sdh_size += sizeof(SDH_INDEX_KEY) + sizeof(SDH_INDEX_DATA); sii_size = sizeof(INDEX_ENTRY_HEADER); sii_size += sizeof(SII_INDEX_KEY) + sizeof(SII_INDEX_DATA); - idx_entry_sdh = (INDEX_ENTRY*)calloc(1, sizeof(INDEX_ENTRY)); - idx_entry_sii = (INDEX_ENTRY*)calloc(1, sizeof(INDEX_ENTRY)); + idx_entry_sdh = calloc(1, sizeof(INDEX_ENTRY)); + idx_entry_sii = calloc(1, sizeof(INDEX_ENTRY)); err = 0; - while ( (char*)sds_header < (char*)sds + sds_size) { - //SDH index entry + while ((char*)sds_header < (char*)sds + sds_size) { + /* SDH index entry */ idx_entry_sdh->data_offset = cpu_to_le16(0x18); idx_entry_sdh->data_length = cpu_to_le16(0x14); idx_entry_sdh->reservedV = cpu_to_le32(0x00); @@ -2900,7 +2897,7 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) { sdh_data->size_in_sds = sds_header->length; sdh_data->reserved_II = cpu_to_le32(0x00490049); - //SII index entry + /* SII index entry */ idx_entry_sii->data_offset = cpu_to_le16(0x14); idx_entry_sii->data_length = cpu_to_le16(0x14); idx_entry_sii->reservedV = cpu_to_le32(0x00); @@ -2937,13 +2934,13 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) { return err; } -/* +/** * initialize_quota * * initialize $Quota with the default quota index-entries. */ -static int initialize_quota(MFT_RECORD *m) { - +static int initialize_quota(MFT_RECORD *m) +{ int o_size, q1_size, q2_size, err; INDEX_ENTRY *idx_entry_o, *idx_entry_q1, *idx_entry_q2; QUOTA_O_INDEX_DATA *idx_entry_o_data; @@ -2953,9 +2950,9 @@ static int initialize_quota(MFT_RECORD *m) { q1_size = cpu_to_le32(0x48); q2_size = cpu_to_le32(0x58); - idx_entry_o = (INDEX_ENTRY*)calloc(1, o_size); - idx_entry_q1 = (INDEX_ENTRY*)calloc(1, q1_size); - idx_entry_q2 = (INDEX_ENTRY*)calloc(1, q2_size); + idx_entry_o = calloc(1, o_size); + idx_entry_q1 = calloc(1, q1_size); + idx_entry_q2 = calloc(1, q2_size); idx_entry_o->data_offset = cpu_to_le16(0x20); idx_entry_o->data_length = cpu_to_le16(0x04); @@ -2977,15 +2974,16 @@ static int initialize_quota(MFT_RECORD *m) { idx_entry_o_data = (QUOTA_O_INDEX_DATA*)((char*)idx_entry_o + idx_entry_o->data_offset); idx_entry_o_data->owner_id = QUOTA_FIRST_USER_ID; - // 20 00 00 00 padding after here on ntfs 3.1 ?? + /* 20 00 00 00 padding after here on ntfs 3.1 ?? */ err = insert_index_entry_in_res_dir_index(idx_entry_o, o_size, m, NTFS_INDEX_O, 2, AT_UNUSED); free(idx_entry_o); - if (err) return err; + if (err) + return err; - //q index entry nr. 1 + /* q index entry nr. 1 */ idx_entry_q1->data_offset = cpu_to_le16(0x14); idx_entry_q1->data_length = cpu_to_le16(0x30); idx_entry_q1->reservedV = cpu_to_le32(0x00); @@ -3010,9 +3008,10 @@ static int initialize_quota(MFT_RECORD *m) { q1_size, m, NTFS_INDEX_Q, 2, AT_UNUSED); free(idx_entry_q1); - if (err) return err; + if (err) + return err; - //q index entry nr. 2 + /* q index entry nr. 2 */ idx_entry_q2->data_offset = cpu_to_le16(0x14); idx_entry_q2->data_length = cpu_to_le16(0x40); idx_entry_q2->reservedV = cpu_to_le32(0x00); @@ -3047,26 +3046,25 @@ static int initialize_quota(MFT_RECORD *m) { free(idx_entry_q2); return err; - } -/* +/** * initialize_objid * * initialize $ObjId with the default index-entries. * It is one entry which belongs to $Volume. (W2k3) */ -static int initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) { - +static int initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) +{ int o_size, err; INDEX_ENTRY *idx_entry_o; OBJ_ID_INDEX_DATA *idx_entry_o_data; err = 0; o_size = cpu_to_le32(0x58); - idx_entry_o = (INDEX_ENTRY*)calloc(1, o_size); + idx_entry_o = calloc(1, o_size); - //o index entry + /* o index entry */ idx_entry_o->data_offset = cpu_to_le16(0x20); idx_entry_o->data_length = cpu_to_le16(0x38); idx_entry_o->reservedV = cpu_to_le32(0x00); @@ -3084,12 +3082,11 @@ static int initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) { err = insert_index_entry_in_res_dir_index(idx_entry_o, o_size, m, NTFS_INDEX_O, 2, AT_UNUSED); - if (idx_entry_o) free(idx_entry_o); + free(idx_entry_o); return err; } - /** * insert_file_link_in_dir_index * @@ -3123,11 +3120,11 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, while ((char*)ie < index_end && !(ie->flags & INDEX_ENTRY_END)) { /* #ifdef DEBUG - mkDprintf("file_name_attr1->file_name_length = %i\n", + ntfs_log_debug("file_name_attr1->file_name_length = %i\n", file_name->file_name_length); if (file_name->file_name_length) { char *__buf; - __buf = (char*)calloc(1, file_name->file_name_length + + __buf = calloc(1, file_name->file_name_length + 1); if (!__buf) err_exit("Failed to allocate internal buffer: " @@ -3135,16 +3132,16 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, i = ucstos(__buf, (ntfschar*)&file_name->file_name, file_name->file_name_length + 1); if (i == -1) - mkDprintf("Name contains non-displayable " + ntfs_log_debug("Name contains non-displayable " "Unicode characters.\n"); - mkDprintf("file_name_attr1->file_name = %s\n", __buf); + ntfs_log_debug("file_name_attr1->file_name = %s\n", __buf); free(__buf); } - mkDprintf("file_name_attr2->file_name_length = %i\n", + ntfs_log_debug("file_name_attr2->file_name_length = %i\n", ie->key.file_name.file_name_length); if (ie->key.file_name.file_name_length) { char *__buf; - __buf = (char*)calloc(1, + __buf = calloc(1, ie->key.file_name.file_name_length + 1); if (!__buf) err_exit("Failed to allocate internal buffer: " @@ -3152,9 +3149,9 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, i = ucstos(__buf, ie->key.file_name.file_name, ie->key.file_name.file_name_length + 1); if (i == -1) - mkDprintf("Name contains non-displayable " + ntfs_log_debug("Name contains non-displayable " "Unicode characters.\n"); - mkDprintf("file_name_attr2->file_name = %s\n", __buf); + ntfs_log_debug("file_name_attr2->file_name = %s\n", __buf); free(__buf); } #endif @@ -3195,7 +3192,7 @@ do_next: #ifdef DEBUG /* Next entry. */ if (!ie->length) { - mkDprintf("BUG: ie->length is zero, breaking out of " + ntfs_log_debug("BUG: ie->length is zero, breaking out of " "loop.\n"); break; } @@ -3205,7 +3202,7 @@ do_next: i = (sizeof(INDEX_ENTRY_HEADER) + file_name_size + 7) & ~7; err = make_room_for_index_entry_in_index_block(idx, ie, i); if (err) { - Eprintf("make_room_for_index_entry_in_index_block failed: " + ntfs_log_error("make_room_for_index_entry_in_index_block failed: " "%s\n", strerror(-err)); return err; } @@ -3246,12 +3243,12 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, /* Create the file_name attribute. */ i = (strlen(file_name) + 1) * sizeof(ntfschar); fn_size = sizeof(FILE_NAME_ATTR) + i; - fn = (FILE_NAME_ATTR*)malloc(fn_size); + fn = malloc(fn_size); if (!fn) return -errno; fn->parent_directory = ref_parent; - // FIXME: Is this correct? Or do we have to copy the creation_time - // from the std info? + /* FIXME: Is this correct? Or do we have to copy the creation_time */ + /* from the std info? */ fn->creation_time = utc2ntfs(time(NULL)); fn->last_data_change_time = fn->creation_time; fn->last_mft_change_time = fn->creation_time; @@ -3271,8 +3268,9 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, if (packed_ea_size) { fn->packed_ea_size = cpu_to_le16(packed_ea_size); fn->reserved = cpu_to_le16(0); - } else + } else { fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); + } fn->file_name_type = file_name_type; i = stoucs(fn->file_name, file_name, i); if (i < 1) { @@ -3289,7 +3287,7 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, /* Increment the link count of @m_file. */ i = le16_to_cpu(m_file->link_count); if (i == 0xffff) { - Eprintf("Too many hardlinks present already.\n"); + ntfs_log_error("Too many hardlinks present already.\n"); free(fn); return -EINVAL; } @@ -3298,7 +3296,7 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, i = insert_resident_attr_in_mft_record(m_file, AT_FILE_NAME, NULL, 0, 0, 0, RESIDENT_ATTR_IS_INDEXED, (u8*)fn, fn_size); if (i < 0) { - Eprintf("create_hardlink failed adding file name attribute: " + ntfs_log_error("create_hardlink failed adding file name attribute: " "%s\n", strerror(-i)); free(fn); /* Undo link count increment. */ @@ -3307,9 +3305,9 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, return i; } /* Insert the index entry for file_name in @idx. */ - //remmet ut kun for debugging + /* remmet ut kun for debugging */ idx_size = (fn_size + 7) & ~7; - idx_entry_new = (INDEX_ENTRY*)calloc(1, idx_size + 0x10); + idx_entry_new = calloc(1, idx_size + 0x10); idx_entry_new->indexed_file = ref_file; idx_entry_new->length = idx_size + 0x10; idx_entry_new->key_length = fn_size; @@ -3317,7 +3315,7 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, i = insert_index_entry_in_res_dir_index(idx_entry_new, idx_size + 0x10 , m_parent, NTFS_INDEX_I30, 4, AT_FILE_NAME); if (i < 0) { - Eprintf("create_hardlink failed inserting index entry: %s\n", + ntfs_log_error("create_hardlink failed inserting index entry: %s\n", strerror(-i)); /* FIXME: Remove the file name attribute from @m_file. */ free(fn); @@ -3356,12 +3354,12 @@ static int create_hardlink(INDEX_BLOCK *idx, const MFT_REF ref_parent, /* Create the file_name attribute. */ i = (strlen(file_name) + 1) * sizeof(ntfschar); fn_size = sizeof(FILE_NAME_ATTR) + i; - fn = (FILE_NAME_ATTR*)malloc(fn_size); + fn = malloc(fn_size); if (!fn) return -errno; fn->parent_directory = ref_parent; - // FIXME: Is this correct? Or do we have to copy the creation_time - // from the std info? + /* FIXME: Is this correct? Or do we have to copy the creation_time */ + /* from the std info? */ fn->creation_time = utc2ntfs(mkntfs_time()); fn->last_data_change_time = fn->creation_time; fn->last_mft_change_time = fn->creation_time; @@ -3377,8 +3375,9 @@ static int create_hardlink(INDEX_BLOCK *idx, const MFT_REF ref_parent, if (packed_ea_size) { fn->packed_ea_size = cpu_to_le16(packed_ea_size); fn->reserved = cpu_to_le16(0); - } else + } else { fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); + } fn->file_name_type = file_name_type; i = stoucs(fn->file_name, file_name, i); if (i < 1) { @@ -3395,7 +3394,7 @@ static int create_hardlink(INDEX_BLOCK *idx, const MFT_REF ref_parent, /* Increment the link count of @m_file. */ i = le16_to_cpu(m_file->link_count); if (i == 0xffff) { - Eprintf("Too many hardlinks present already.\n"); + ntfs_log_error("Too many hardlinks present already.\n"); free(fn); return -EINVAL; } @@ -3404,7 +3403,7 @@ static int create_hardlink(INDEX_BLOCK *idx, const MFT_REF ref_parent, i = insert_resident_attr_in_mft_record(m_file, AT_FILE_NAME, NULL, 0, 0, 0, RESIDENT_ATTR_IS_INDEXED, (u8*)fn, fn_size); if (i < 0) { - Eprintf("create_hardlink failed adding file name attribute: " + ntfs_log_error("create_hardlink failed adding file name attribute: " "%s\n", strerror(-i)); free(fn); /* Undo link count increment. */ @@ -3415,7 +3414,7 @@ static int create_hardlink(INDEX_BLOCK *idx, const MFT_REF ref_parent, /* Insert the index entry for file_name in @idx. */ i = insert_file_link_in_dir_index(idx, ref_file, fn, fn_size); if (i < 0) { - Eprintf("create_hardlink failed inserting index entry: %s\n", + ntfs_log_error("create_hardlink failed inserting index entry: %s\n", strerror(-i)); /* FIXME: Remove the file name attribute from @m_file. */ free(fn); @@ -3440,7 +3439,7 @@ static void init_options(void) opts.index_block_size = 4096; opts.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; opts.attr_defs_len = sizeof(attrdef_ntfs12_array); - //mkDprintf("Attr_defs table length = %u\n", opts.attr_defs_len); + /* ntfs_log_debug("Attr_defs table length = %u\n", opts.attr_defs_len); */ } /** @@ -3471,7 +3470,7 @@ static void mkntfs_exit(void) free(vol->upcase); if (vol->dev) { if (NDevOpen(vol->dev) && vol->dev->d_ops->close(vol->dev)) - Eprintf("Warning: Could not close %s: %s\n", + ntfs_log_error("Warning: Could not close %s: %s\n", vol->dev->d_name, strerror(errno)); ntfs_device_free(vol->dev); } @@ -3498,10 +3497,11 @@ static void mkntfs_open_partition(void) err_exit("Could not allocate memory for internal buffer.\n"); /* Open the device for reading or reading and writing. */ if (opts.no_action) { - Qprintf("Running in READ-ONLY mode!\n"); + ntfs_log_quiet("Running in READ-ONLY mode!\n"); i = O_RDONLY; - } else + } else { i = O_RDWR; + } if (vol->dev->d_ops->open(vol->dev, i)) { if (errno == ENOENT) err_exit("The device doesn't exist; did you specify " @@ -3515,7 +3515,7 @@ static void mkntfs_open_partition(void) vol->dev->d_name, strerror(errno)); } if (!S_ISBLK(sbuf.st_mode)) { - Eprintf("%s is not a block device.\n", vol->dev->d_name); + ntfs_log_error("%s is not a block device.\n", vol->dev->d_name); if (!opts.force) err_exit("Refusing to make a filesystem here!\n"); if (!opts.nr_sectors) { @@ -3537,29 +3537,28 @@ static void mkntfs_open_partition(void) opts.sector_size = 512; } } - fprintf(stderr, "mkntfs forced anyway.\n"); - } + ntfs_log_warning("mkntfs forced anyway.\n"); #ifdef HAVE_LINUX_MAJOR_H - else if ((IDE_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && + } else if ((IDE_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 64 == 0) || (SCSI_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 16 == 0)) { - Eprintf("%s is entire device, not just one partition.\n", + ntfs_log_error("%s is entire device, not just one partition.\n", vol->dev->d_name); if (!opts.force) err_exit("Refusing to make a filesystem here!\n"); - fprintf(stderr, "mkntfs forced anyway.\n"); - } + ntfs_log_warning("mkntfs forced anyway.\n"); #endif + } /* Make sure the file system is not mounted. */ - if (ntfs_check_if_mounted(vol->dev->d_name, &mnt_flags)) - Eprintf("Failed to determine whether %s is mounted: %s\n", + if (ntfs_check_if_mounted(vol->dev->d_name, &mnt_flags)) { + ntfs_log_error("Failed to determine whether %s is mounted: %s\n", vol->dev->d_name, strerror(errno)); - else if (mnt_flags & NTFS_MF_MOUNTED) { - Eprintf("%s is mounted.\n", vol->dev->d_name); + } else if (mnt_flags & NTFS_MF_MOUNTED) { + ntfs_log_error("%s is mounted.\n", vol->dev->d_name); if (!opts.force) err_exit("Refusing to make a filesystem here!\n"); - fprintf(stderr, "mkntfs forced anyway. Hope /etc/mtab is " + ntfs_log_warning("mkntfs forced anyway. Hope /etc/mtab is " "incorrect.\n"); } } @@ -3584,7 +3583,7 @@ static void mkntfs_override_phys_params(void) else #endif { - Eprintf("No sector size specified for %s and it could " + ntfs_log_error("No sector size specified for %s and it could " "not be obtained automatically.\n" "Assuming sector size is 512 bytes.\n", vol->dev->d_name); @@ -3597,7 +3596,7 @@ static void mkntfs_override_phys_params(void) err_exit("sector_size is invalid. It must be a power " "of two, and it must be\n greater or equal 256 and " "less than or equal 4096 bytes.\n"); - mkDprintf("sector size = %i bytes\n", opts.sector_size); + ntfs_log_debug("sector size = %i bytes\n", opts.sector_size); /* If user didn't specify the number of sectors, determine it now. */ if (!opts.nr_sectors) { opts.nr_sectors = ntfs_device_size_get(vol->dev, @@ -3607,7 +3606,7 @@ static void mkntfs_override_phys_params(void) "specify it manually.\n", vol->dev->d_name); } - mkDprintf("number of sectors = %lld (0x%llx)\n", opts.nr_sectors, + ntfs_log_debug("number of sectors = %lld (0x%llx)\n", opts.nr_sectors, opts.nr_sectors); /* * Reserve the last sector for the backup boot sector unless the @@ -3623,7 +3622,7 @@ static void mkntfs_override_phys_params(void) opts.part_start_sect = ntfs_device_partition_start_sector_get( vol->dev); if (opts.part_start_sect < 0) { - Eprintf("No partition start sector specified for %s " + ntfs_log_error("No partition start sector specified for %s " "and it could not\nbe obtained " "automatically. Setting it to 0.\n" "This will cause Windows not to be " @@ -3631,7 +3630,7 @@ static void mkntfs_override_phys_params(void) vol->dev->d_name); opts.part_start_sect = 0; } else if (opts.part_start_sect >> 32) { - Eprintf("No partition start sector specified for %s " + ntfs_log_error("No partition start sector specified for %s " "and the automatically\ndetermined " "value is too large. Setting it to 0." " This will cause Windows not\nto be " @@ -3639,16 +3638,17 @@ static void mkntfs_override_phys_params(void) vol->dev->d_name); opts.part_start_sect = 0; } - } else if (opts.part_start_sect >> 32) + } else if (opts.part_start_sect >> 32) { err_exit("Invalid partition start sector specified: %lli " "Maximum is 4294967295 (2^32-1).\n", opts.part_start_sect); + } /* If user didn't specify the sectors per track, determine it now. */ if (opts.sectors_per_track < 0) { opts.sectors_per_track = ntfs_device_sectors_per_track_get(vol->dev); if (opts.sectors_per_track < 0) { - Eprintf("No number of sectors per track specified for " + ntfs_log_error("No number of sectors per track specified for " "%s and\nit could not be obtained " "automatically. Setting it to 0. " "This will cause\nWindows not to be " @@ -3656,7 +3656,7 @@ static void mkntfs_override_phys_params(void) vol->dev->d_name); opts.sectors_per_track = 0; } else if (opts.sectors_per_track > 0xffff) { - Eprintf("No number of sectors per track specified for " + ntfs_log_error("No number of sectors per track specified for " "%s and the automatically\ndetermined " "value is too large. Setting it to 0." " This will cause Windows not\nto be " @@ -3664,22 +3664,23 @@ static void mkntfs_override_phys_params(void) vol->dev->d_name); opts.sectors_per_track = 0; } - } else if (opts.sectors_per_track > 0xffff) + } else if (opts.sectors_per_track > 0xffff) { err_exit("Invalid number of sectors per track specified: %i " "Maximum is 65535 (0xffff).\n", opts.sectors_per_track); + } /* If user didn't specify the number of heads, determine it now. */ if (opts.heads < 0) { opts.heads = ntfs_device_heads_get(vol->dev); if (opts.heads < 0) { - Eprintf("No number of heads specified for %s and it " + ntfs_log_error("No number of heads specified for %s and it " "could not\nbe obtained automatically." " Setting it to 0. This will cause " "Windows not to\nbe able to boot from " "this volume.\n", vol->dev->d_name); opts.heads = 0; } else if (opts.heads > 0xffff) { - Eprintf("No number of heads specified for %s and the " + ntfs_log_error("No number of heads specified for %s and the " "automatically\ndetermined value is " "too large. Setting it to 0. This " "will cause Windows not\nto be able " @@ -3687,9 +3688,10 @@ static void mkntfs_override_phys_params(void) vol->dev->d_name); opts.heads = 0; } - } else if (opts.heads > 0xffff) + } else if (opts.heads > 0xffff) { err_exit("Invalid number of heads specified: %i Maximum is " "65535 (0xffff).\n", opts.heads); + } /* If user didn't specify the volume size, determine it now. */ if (!opts.volume_size) opts.volume_size = opts.nr_sectors * opts.sector_size; @@ -3699,7 +3701,7 @@ static void mkntfs_override_phys_params(void) if (opts.volume_size < 1 << 20 /* 1MiB */) err_exit("Device is too small (%llikiB). Minimum NTFS volume " "size is 1MiB.\n", opts.volume_size / 1024); - mkDprintf("volume size = %llikiB\n", opts.volume_size / 1024); + ntfs_log_debug("volume size = %llikiB\n", opts.volume_size / 1024); /* If user didn't specify the cluster size, determine it now. */ if (!vol->cluster_size) { if (opts.volume_size <= 512LL << 20) /* <= 512MB */ @@ -3737,7 +3739,7 @@ static void mkntfs_override_phys_params(void) "to fit inside eight bits. (We do not support larger " "cluster sizes yet.)\n"); vol->cluster_size_bits = ffs(vol->cluster_size) - 1; - mkDprintf("cluster size = %u bytes\n", (unsigned int)vol->cluster_size); + ntfs_log_debug("cluster size = %u bytes\n", (unsigned int)vol->cluster_size); if (vol->cluster_size > 4096) { if (opts.enable_compression) { if (!opts.force) @@ -3749,7 +3751,7 @@ static void mkntfs_override_phys_params(void) "used by\nWindows.\n"); opts.enable_compression = 0; } - Qprintf("Warning: compression will be disabled on this volume " + ntfs_log_quiet("Warning: compression will be disabled on this volume " "because it is not\nsupported when the cluster " "size is above 4096 bytes. This is due to \n" "limitations in the compression algorithm used " @@ -3769,7 +3771,7 @@ static void mkntfs_override_phys_params(void) opts.volume_size / vol->cluster_size != opts.nr_clusters) err_exit("Illegal combination of volume/cluster/sector size " "and/or cluster/sector number.\n"); - mkDprintf("number of clusters = %llu (0x%llx)\n", opts.nr_clusters, + ntfs_log_debug("number of clusters = %llu (0x%llx)\n", opts.nr_clusters, opts.nr_clusters); /* Number of clusters must fit within 32 bits (Win2k limitation). */ if (opts.nr_clusters >> 32) { @@ -3799,9 +3801,9 @@ static void mkntfs_initialize_bitmaps(void) lcn_bitmap_byte_size = (lcn_bitmap_byte_size + 7) & ~7; i = (lcn_bitmap_byte_size + vol->cluster_size - 1) & ~(vol->cluster_size - 1); - mkDprintf("lcn_bitmap_byte_size = %i, allocated = %i\n", + ntfs_log_debug("lcn_bitmap_byte_size = %i, allocated = %i\n", lcn_bitmap_byte_size, i); - lcn_bitmap = (unsigned char *)calloc(1, lcn_bitmap_byte_size); + lcn_bitmap = calloc(1, lcn_bitmap_byte_size); if (!lcn_bitmap) err_exit("Failed to allocate internal buffer: %s", strerror(errno)); @@ -3816,21 +3818,21 @@ static void mkntfs_initialize_bitmaps(void) */ opts.mft_size = ((16 + 11 * (vol->major_ver >= 3)) * vol->mft_record_size); - mkDprintf("MFT size = %i (0x%x) bytes\n", opts.mft_size, opts.mft_size); + ntfs_log_debug("MFT size = %i (0x%x) bytes\n", opts.mft_size, opts.mft_size); /* Determine mft bitmap size and allocate it. */ mft_bitmap_size = opts.mft_size / vol->mft_record_size; /* Convert to bytes, at least one. */ mft_bitmap_byte_size = (mft_bitmap_size + 7) >> 3; /* Mft bitmap is allocated in multiples of 8 bytes. */ mft_bitmap_byte_size = (mft_bitmap_byte_size + 7) & ~7; - mkDprintf("mft_bitmap_size = %i, mft_bitmap_byte_size = %i\n", + ntfs_log_debug("mft_bitmap_size = %i, mft_bitmap_byte_size = %i\n", mft_bitmap_size, mft_bitmap_byte_size); - mft_bitmap = (unsigned char *)calloc(1, mft_bitmap_byte_size); + mft_bitmap = calloc(1, mft_bitmap_byte_size); if (!mft_bitmap) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); /* Create runlist for mft bitmap. */ - rl_mft_bmp = (runlist *)malloc(2 * sizeof(runlist)); + rl_mft_bmp = malloc(2 * sizeof(runlist)); if (!rl_mft_bmp) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -3869,7 +3871,7 @@ static void mkntfs_initialize_rl_mft(void) opts.mft_lcn = (16 * 1024 + vol->cluster_size - 1) / vol->cluster_size; } - mkDprintf("$MFT logical cluster number = 0x%llx\n", opts.mft_lcn); + ntfs_log_debug("$MFT logical cluster number = 0x%llx\n", opts.mft_lcn); /* Determine MFT zone size. */ opts.mft_zone_end = opts.nr_clusters; switch (opts.mft_zone_multiplier) { /* % of volume size in clusters */ @@ -3882,26 +3884,26 @@ static void mkntfs_initialize_rl_mft(void) case 2: opts.mft_zone_end = opts.mft_zone_end >> 2; /* 25% */ break; - /* case 1: */ + case 1: default: opts.mft_zone_end = opts.mft_zone_end >> 3; /* 12.5% */ break; } - mkDprintf("MFT zone size = %lldkiB\n", opts.mft_zone_end / 1024); + ntfs_log_debug("MFT zone size = %lldkiB\n", opts.mft_zone_end / 1024); /* * The mft zone begins with the mft data attribute, not at the beginning * of the device. */ opts.mft_zone_end += opts.mft_lcn; /* Create runlist for mft. */ - rl_mft = (runlist *)malloc(2 * sizeof(runlist)); + rl_mft = malloc(2 * sizeof(runlist)); if (!rl_mft) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); rl_mft[0].vcn = 0LL; rl_mft[0].lcn = opts.mft_lcn; /* rounded up division by cluster size */ - j = (opts.mft_size + vol->cluster_size - 1 ) / vol->cluster_size; + j = (opts.mft_size + vol->cluster_size - 1) / vol->cluster_size; rl_mft[1].vcn = rl_mft[0].length = j; rl_mft[1].lcn = -1LL; rl_mft[1].length = 0LL; @@ -3911,10 +3913,10 @@ static void mkntfs_initialize_rl_mft(void) /* Determine mftmirr_lcn (middle of volume). */ opts.mftmirr_lcn = (opts.nr_sectors * opts.sector_size >> 1) / vol->cluster_size; - mkDprintf("$MFTMirr logical cluster number = 0x%llx\n", + ntfs_log_debug("$MFTMirr logical cluster number = 0x%llx\n", opts.mftmirr_lcn); /* Create runlist for mft mirror. */ - rl_mftmirr = (runlist *)malloc(2 * sizeof(runlist)); + rl_mftmirr = malloc(2 * sizeof(runlist)); if (!rl_mftmirr) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -3935,7 +3937,7 @@ static void mkntfs_initialize_rl_mft(void) for (i = 0; i < j; i++) ntfs_bit_set(lcn_bitmap, opts.mftmirr_lcn + i, 1); opts.logfile_lcn = opts.mftmirr_lcn + j; - mkDprintf("$LogFile logical cluster number = 0x%llx\n", + ntfs_log_debug("$LogFile logical cluster number = 0x%llx\n", opts.logfile_lcn); } @@ -3949,7 +3951,7 @@ static void mkntfs_initialize_rl_logfile(void) int i, j; /* Create runlist for log file. */ - rl_logfile = (runlist *)malloc(2 * sizeof(runlist)); + rl_logfile = malloc(2 * sizeof(runlist)); if (!rl_logfile) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -3982,7 +3984,7 @@ static void mkntfs_initialize_rl_logfile(void) } opts.logfile_size = (opts.logfile_size + vol->cluster_size - 1) & ~(vol->cluster_size - 1); - mkDprintf("$LogFile (journal) size = %ikiB\n", + ntfs_log_debug("$LogFile (journal) size = %ikiB\n", opts.logfile_size / 1024); /* * FIXME: The 256kiB limit is arbitrary. Should find out what the real @@ -4009,7 +4011,7 @@ static void mkntfs_initialize_rl_boot(void) { int i, j; /* Create runlist for $Boot. */ - rl_boot = (runlist *)malloc(2 * sizeof(runlist)); + rl_boot = malloc(2 * sizeof(runlist)); if (!rl_boot) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -4036,7 +4038,7 @@ static void mkntfs_initialize_rl_boot(void) static void mkntfs_initialize_rl_bad(void) { /* Create runlist for $BadClus, $DATA named stream $Bad. */ - rl_bad = (runlist *)malloc(2 * sizeof(runlist)); + rl_bad = malloc(2 * sizeof(runlist)); if (!rl_bad) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); @@ -4050,7 +4052,7 @@ static void mkntfs_initialize_rl_bad(void) rl_bad[1].lcn = -1LL; rl_bad[1].length = 0LL; - // TODO: Mark bad blocks as such. + /* TODO: Mark bad blocks as such. */ } /** @@ -4069,13 +4071,13 @@ static void mkntfs_fill_device_with_zeroes(void) unsigned long long position, mid_clust; float progress_inc = (float)opts.nr_clusters / 100; - Qprintf("Initialising device with zeroes: 0%%"); + ntfs_log_quiet("Initialising device with zeroes: 0%%"); fflush(stdout); mid_clust = (opts.volume_size >> 1) / vol->cluster_size; for (position = 0; position < (unsigned long long)opts.nr_clusters; position++) { if (!(position % (int)(progress_inc+1))) { - Qprintf("\b\b\b\b%3.0f%%", position / + ntfs_log_quiet("\b\b\b\b%3.0f%%", position / progress_inc); fflush(stdout); } @@ -4096,7 +4098,7 @@ static void mkntfs_fill_device_with_zeroes(void) "file $Boot.\n"); /* Add the baddie to our bad blocks list. */ append_to_bad_blocks(position); - Qprintf("\nFound bad cluster (%lld). Adding to " + ntfs_log_quiet("\nFound bad cluster (%lld). Adding to " "list of bad blocks.\nInitialising " "device with zeroes: %3.0f%%", position, position / progress_inc); @@ -4106,7 +4108,7 @@ static void mkntfs_fill_device_with_zeroes(void) vol->cluster_size, SEEK_SET); } } - Qprintf("\b\b\b\b100%%"); + ntfs_log_quiet("\b\b\b\b100%%"); position = (opts.volume_size & (vol->cluster_size - 1)) / opts.sector_size; for (i = 0; (unsigned long)i < position; i++) { @@ -4126,7 +4128,7 @@ static void mkntfs_fill_device_with_zeroes(void) opts.sector_size, SEEK_CUR); } } - Qprintf(" - Done.\n"); + ntfs_log_quiet(" - Done.\n"); } /** @@ -4148,7 +4150,7 @@ static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, if (!ctx) err_exit("Failed to allocate attribute search context: %s\n", strerror(errno)); - // FIXME: This should be IGNORE_CASE! + /* FIXME: This should be IGNORE_CASE! */ if (mkntfs_attr_lookup(AT_INDEX_ALLOCATION, name, name_len, 0, 0, NULL, 0, ctx)) { ntfs_attr_put_search_ctx(ctx); @@ -4176,7 +4178,7 @@ static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, if (lw != i) err_exit("Error writing $INDEX_ALLOCATION.\n"); /* No more changes to @idx below here so no need for fixup: */ - // ntfs_mst_post_write_fixup((NTFS_RECORD*)idx); + /* ntfs_mst_post_write_fixup((NTFS_RECORD*)idx); */ } /** @@ -4187,7 +4189,7 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) int i, err; u8 *sd; - Vprintf("Creating $Volume (mft record 3)\n"); + ntfs_log_verbose("Creating $Volume (mft record 3)\n"); m = (MFT_RECORD*)(buf + 3 * vol->mft_record_size); err = create_hardlink(index_block, root_ref, m, MK_LE_MREF(FILE_Volume, FILE_Volume), 0LL, 0LL, @@ -4198,7 +4200,7 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) err = add_attr_sd(m, sd, i); } if (!err && vol->major_ver>=3) { - volume_obj_id=(OBJECT_ID_ATTR*)calloc(1,0x10); + volume_obj_id = calloc(1,0x10); ntfs_generate_guid(&volume_obj_id->object_id); err = add_attr_object_id(m, volume_obj_id, 0x10); } @@ -4209,7 +4211,7 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) strlen(vol->vol_name) : 0); if (!err) { if (fl & VOLUME_IS_DIRTY) - Qprintf("Setting the volume dirty so check disk runs " + ntfs_log_quiet("Setting the volume dirty so check disk runs " "on next reboot into Windows.\n"); err = add_attr_vol_info(m, fl, vol->major_ver, vol->minor_ver); } @@ -4228,7 +4230,7 @@ static int create_backup_boot_sector(u8 *buff) ssize_t bw; int size, _e; - Vprintf("Creating backup boot sector.\n"); + ntfs_log_verbose("Creating backup boot sector.\n"); /* * Write the first max(512, opts.sector_size) bytes from buf to the * last sector, but limit that to 8192 bytes of written data since that @@ -4253,9 +4255,9 @@ static int create_backup_boot_sector(u8 *buff) if (bw != -1LL || (bw == -1LL && _e != ENOSPC)) { err_exit("Couldn't write backup boot sector: %s\n", _s); bb_err: - Eprintf("Seek failed: %s\n", strerror(errno)); + ntfs_log_perror("Seek failed"); } - Eprintf("Couldn't write backup boot sector. This is due to a " + ntfs_log_error("Couldn't write backup boot sector. This is due to a " "limitation in the\nLinux kernel. This is not " "a major problem as Windows check disk will " "create the\nbackup boot sector when it " @@ -4279,7 +4281,7 @@ static void mkntfs_create_root_structures(void) FILE_ATTR_FLAGS extend_flags; VOLUME_FLAGS volume_flags = 0; - Qprintf("Creating NTFS volume structures.\n"); + ntfs_log_quiet("Creating NTFS volume structures.\n"); /* * Setup an empty mft record. Note, we can just give 0 as the mft * reference as we are creating an NTFS 1.2 volume for which the mft @@ -4299,8 +4301,10 @@ static void mkntfs_create_root_structures(void) i * vol->mft_record_size); #endif - if ( i > 0 ) m->sequence_number = cpu_to_le16(i); - if ( i == 0) m->sequence_number = cpu_to_le16(1); + if (i > 0) + m->sequence_number = cpu_to_le16(i); + if (i == 0) + m->sequence_number = cpu_to_le16(1); } /* * Create the 16 system files, adding the system information attribute @@ -4325,38 +4329,38 @@ static void mkntfs_create_root_structures(void) file_attrs |= FILE_ATTR_COMPRESSED; } - if (vol->major_ver < 3) + if (vol->major_ver < 3) { add_attr_std_info(m, file_attrs, - cpu_to_le32(0)); // dump_mft_record(m); - else { - // setting specific security_id flag and - // filepermissions for ntfs 3.x + cpu_to_le32(0)); /* dump_mft_record(m); */ + } else { + /* setting specific security_id flag and */ + /* filepermissions for ntfs 3.x */ if (i == 0 || i == 1 || i == 2 || i == 6 || i == 8 || - i == 10 ) + i == 10) { add_attr_std_info(m, file_attrs, cpu_to_le32(0x0100)); - else if (i == 9) { + } else if (i == 9) { file_attrs |= FILE_ATTR_DUP_VIEW_INDEX_PRESENT; add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); - } - else if (i == 11) + } else if (i == 11) { add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); - else if (i ==24 || i == 25 || i == 26) { + } else if (i ==24 || i == 25 || i == 26) { file_attrs |= FILE_ATTR_ARCHIVE; file_attrs |= FILE_ATTR_DUP_VIEW_INDEX_PRESENT; add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); + } else { + add_attr_std_info(m, file_attrs, + cpu_to_le32(0x00)); } - else add_attr_std_info(m, file_attrs, - cpu_to_le32(0x00)); } } /* The root directory mft reference. */ root_ref = MK_LE_MREF(FILE_root, FILE_root); extend_ref = MK_LE_MREF(11,11); - Vprintf("Creating root directory (mft record 5)\n"); + ntfs_log_verbose("Creating root directory (mft record 5)\n"); m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); m->flags |= MFT_RECORD_IS_DIRECTORY; m->link_count = cpu_to_le16(le16_to_cpu(m->link_count) + 1); @@ -4374,14 +4378,15 @@ static void mkntfs_create_root_structures(void) } else if (vol->major_ver == 3 && vol->minor_ver == 1) { init_root_sd_31(&sd, &i); err = add_attr_sd(m, sd, i); - } else + } else { err_exit("BUG: Unsupported NTFS version\n"); + } } - // FIXME: This should be IGNORE_CASE + /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, COLLATION_FILE_NAME, opts.index_block_size); - // FIXME: This should be IGNORE_CASE + /* FIXME: This should be IGNORE_CASE */ if (!err) err = upgrade_to_large_index(m, "$I30", 4, 0, &index_block); if (!err) { @@ -4406,9 +4411,9 @@ static void mkntfs_create_root_structures(void) if (err) err_exit("Couldn't create root directory: %s\n", strerror(-err)); - // dump_mft_record(m); + /* dump_mft_record(m); */ /* Add all other attributes, on a per-file basis for clarity. */ - Vprintf("Creating $MFT (mft record 0)\n"); + ntfs_log_verbose("Creating $MFT (mft record 0)\n"); m = (MFT_RECORD*)buf; err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mft, buf, opts.mft_size); @@ -4428,8 +4433,8 @@ static void mkntfs_create_root_structures(void) mft_bitmap, mft_bitmap_byte_size); if (err < 0) err_exit("Couldn't create $MFT: %s\n", strerror(-err)); - //dump_mft_record(m); - Vprintf("Creating $MFTMirr (mft record 1)\n"); + /* dump_mft_record(m); */ + ntfs_log_verbose("Creating $MFTMirr (mft record 1)\n"); m = (MFT_RECORD*)(buf + 1 * vol->mft_record_size); err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mftmirr, buf, rl_mftmirr[0].length * vol->cluster_size); @@ -4446,8 +4451,8 @@ static void mkntfs_create_root_structures(void) } if (err < 0) err_exit("Couldn't create $MFTMirr: %s\n", strerror(-err)); - //dump_mft_record(m); - Vprintf("Creating $LogFile (mft record 2)\n"); + /* dump_mft_record(m); */ + ntfs_log_verbose("Creating $LogFile (mft record 2)\n"); m = (MFT_RECORD*)(buf + 2 * vol->mft_record_size); buf2 = malloc(opts.logfile_size); if (!buf2) @@ -4470,9 +4475,9 @@ static void mkntfs_create_root_structures(void) } if (err < 0) err_exit("Couldn't create $LogFile: %s\n", strerror(-err)); - //dump_mft_record(m); + /* dump_mft_record(m); */ - Vprintf("Creating $AttrDef (mft record 4)\n"); + ntfs_log_verbose("Creating $AttrDef (mft record 4)\n"); m = (MFT_RECORD*)(buf + 4 * vol->mft_record_size); if (vol->major_ver < 3) buf2_size = 36000; @@ -4500,11 +4505,11 @@ static void mkntfs_create_root_structures(void) } if (err < 0) err_exit("Couldn't create $AttrDef: %s\n", strerror(-err)); - //dump_mft_record(m); - Vprintf("Creating $Bitmap (mft record 6)\n"); + /* dump_mft_record(m); */ + ntfs_log_verbose("Creating $Bitmap (mft record 6)\n"); m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); - // the data attribute of $Bitmap must be non-resident or otherwise - // windows 2003 will regard the volume as corrupt (ERSO) + /* the data attribute of $Bitmap must be non-resident or otherwise */ + /* windows 2003 will regard the volume as corrupt (ERSO) */ if (!err) err = insert_non_resident_attr_in_mft_record(m, AT_DATA, NULL, 0, @@ -4525,8 +4530,8 @@ static void mkntfs_create_root_structures(void) } if (err < 0) err_exit("Couldn't create $Bitmap: %s\n", strerror(-err)); - //dump_mft_record(m); - Vprintf("Creating $Boot (mft record 7)\n"); + /* dump_mft_record(m); */ + ntfs_log_verbose("Creating $Boot (mft record 7)\n"); m = (MFT_RECORD*)(buf + 7 * vol->mft_record_size); buf2 = calloc(1, 8192); if (!buf2) @@ -4544,12 +4549,12 @@ static void mkntfs_create_root_structures(void) opts.sector_size); bs->bpb.media_type = 0xf8; /* hard disk */ bs->bpb.sectors_per_track = cpu_to_le16(opts.sectors_per_track); - mkDprintf("sectors per track = %u (0x%x)\n", opts.sectors_per_track, + ntfs_log_debug("sectors per track = %u (0x%x)\n", opts.sectors_per_track, opts.sectors_per_track); bs->bpb.heads = cpu_to_le16(opts.heads); - mkDprintf("heads = %u (0x%x)\n", opts.heads, opts.heads); + ntfs_log_debug("heads = %u (0x%x)\n", opts.heads, opts.heads); bs->bpb.hidden_sectors = cpu_to_le32(opts.part_start_sect); - mkDprintf("hidden sectors = %llu (0x%llx)\n", opts.part_start_sect, + ntfs_log_debug("hidden sectors = %llu (0x%llx)\n", opts.part_start_sect, opts.part_start_sect); /* * If there are problems go back to bs->unused[0-3] and set them. See @@ -4558,10 +4563,10 @@ static void mkntfs_create_root_structures(void) bs->number_of_sectors = cpu_to_sle64(opts.nr_sectors); bs->mft_lcn = cpu_to_sle64(opts.mft_lcn); bs->mftmirr_lcn = cpu_to_sle64(opts.mftmirr_lcn); - if (vol->mft_record_size >= vol->cluster_size) + if (vol->mft_record_size >= vol->cluster_size) { bs->clusters_per_mft_record = vol->mft_record_size / vol->cluster_size; - else { + } else { bs->clusters_per_mft_record = -(ffs(vol->mft_record_size) - 1); if ((u32)(1 << -bs->clusters_per_mft_record) != vol->mft_record_size) @@ -4569,13 +4574,13 @@ static void mkntfs_create_root_structures(void) "is wrong (= 0x%x)\n", bs->clusters_per_mft_record); } - mkDprintf("clusters per mft record = %i (0x%x)\n", + ntfs_log_debug("clusters per mft record = %i (0x%x)\n", bs->clusters_per_mft_record, bs->clusters_per_mft_record); - if (opts.index_block_size >= (int)vol->cluster_size) + if (opts.index_block_size >= (int)vol->cluster_size) { bs->clusters_per_index_record = opts.index_block_size / vol->cluster_size; - else { + } else { bs->clusters_per_index_record = -(ffs(opts.index_block_size) - 1); if ((1 << -bs->clusters_per_index_record) != opts.index_block_size) @@ -4583,7 +4588,7 @@ static void mkntfs_create_root_structures(void) "is wrong (= 0x%x)\n", bs->clusters_per_index_record); } - mkDprintf("clusters per index block = %i (0x%x)\n", + ntfs_log_debug("clusters per index block = %i (0x%x)\n", bs->clusters_per_index_record, bs->clusters_per_index_record); /* Generate a 64-bit random number for the serial number. */ @@ -4614,8 +4619,8 @@ static void mkntfs_create_root_structures(void) if (create_backup_boot_sector(buf2)) { /* - * Pre-2.6 kernels couldn't access the last sector - * if it was odd hence we schedule chkdsk to create it. + * Pre-2.6 kernels couldn't access the last sector + * if it was odd hence we schedule chkdsk to create it. */ volume_flags |= VOLUME_IS_DIRTY; } @@ -4625,9 +4630,9 @@ static void mkntfs_create_root_structures(void) create_file_volume(m, root_ref, volume_flags); - Vprintf("Creating $BadClus (mft record 8)\n"); + ntfs_log_verbose("Creating $BadClus (mft record 8)\n"); m = (MFT_RECORD*)(buf + 8 * vol->mft_record_size); - // FIXME: This should be IGNORE_CASE + /* FIXME: This should be IGNORE_CASE */ /* Create a sparse named stream of size equal to the volume size. */ err = add_attr_data_positioned(m, "$Bad", 4, 0, 0, rl_bad, NULL, opts.nr_clusters * vol->cluster_size); @@ -4647,12 +4652,11 @@ static void mkntfs_create_root_structures(void) if (err < 0) err_exit("Couldn't create $BadClus: %s\n", strerror(-err)); - //dump_mft_record(m); - /* create $Quota (1.2) or $Secure (3.0+) - */ + /* dump_mft_record(m); */ + /* create $Quota (1.2) or $Secure (3.0+) */ - if (vol->major_ver < 3 ) { - Vprintf("Creating $Quota (mft record 9)\n"); + if (vol->major_ver < 3) { + ntfs_log_verbose("Creating $Quota (mft record 9)\n"); m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); if (!err) @@ -4669,7 +4673,7 @@ static void mkntfs_create_root_structures(void) err_exit("Couldn't create $Quota: %s\n", strerror(-err)); } else { - Vprintf("Creating $Secure (mft record 9)\n"); + ntfs_log_verbose("Creating $Secure (mft record 9)\n"); m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); m->flags |= MFT_RECORD_IS_8; if (!err) @@ -4683,17 +4687,17 @@ static void mkntfs_create_root_structures(void) if (vol->minor_ver == 0) { buf_sds_first_size = 0x1E0; buf_sds_size = 0x40000 + buf_sds_first_size; - buf_sds_init = (char*)calloc(1, + buf_sds_init = calloc(1, buf_sds_first_size); init_secure_30(buf_sds_init); } else { buf_sds_first_size = 0x240; buf_sds_size = 0x40000 + buf_sds_first_size; - buf_sds_init = (char*)calloc(1, + buf_sds_init = calloc(1, buf_sds_first_size); init_secure_31(buf_sds_init); } - buf_sds = (char*)calloc(1,buf_sds_size); + buf_sds = calloc(1,buf_sds_size); if (!buf_sds) err_exit("Failed to allocate internal buffer:" " %s\n", strerror(errno)); @@ -4704,12 +4708,12 @@ static void mkntfs_create_root_structures(void) err = add_attr_data(m, "$SDS", 4, 0, 0, (u8*)buf_sds, buf_sds_size); } - // FIXME: This should be IGNORE_CASE + /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$SDH", 4, 0, AT_UNUSED, COLLATION_NTOFS_SECURITY_HASH , opts.index_block_size); - // FIXME: This should be IGNORE_CASE + /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$SII", 4, 0, AT_UNUSED, COLLATION_NTOFS_ULONG, opts.index_block_size); @@ -4720,8 +4724,8 @@ static void mkntfs_create_root_structures(void) err_exit("Couldn't create $Secure: %s\n", strerror(-err)); } - //dump_mft_record(m); - Vprintf("Creating $UpCase (mft record 0xa)\n"); + /* dump_mft_record(m); */ + ntfs_log_verbose("Creating $UpCase (mft record 0xa)\n"); m = (MFT_RECORD*)(buf + 0xa * vol->mft_record_size); err = add_attr_data(m, NULL, 0, 0, 0, (u8*)vol->upcase, vol->upcase_len << 1); @@ -4739,10 +4743,10 @@ static void mkntfs_create_root_structures(void) } if (err < 0) err_exit("Couldn't create $UpCase: %s\n", strerror(-err)); - //dump_mft_record(m); + /* dump_mft_record(m); */ if (vol->major_ver < 3) { - Vprintf("Creating empty record, marked as in use " + ntfs_log_verbose("Creating empty record, marked as in use " "(mft record 11)\n"); m = (MFT_RECORD*)(buf + 11 * vol->mft_record_size); err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); @@ -4753,9 +4757,9 @@ static void mkntfs_create_root_structures(void) if (err < 0) err_exit("Couldn't create system file 11 (0x0b): %s\n", strerror(-err)); - //dump_mft_record(m); + /* dump_mft_record(m); */ } else { - Vprintf("Creating $Extend (mft record 11)\n"); + ntfs_log_verbose("Creating $Extend (mft record 11)\n"); /* * $Extends index must be resident. Otherwise, w2k3 will * regard the volume as corrupt. (ERSO) @@ -4769,7 +4773,7 @@ static void mkntfs_create_root_structures(void) FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, "$Extend", FILE_NAME_WIN32_AND_DOS); - // FIXME: This should be IGNORE_CASE + /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, COLLATION_FILE_NAME, opts.index_block_size); @@ -4779,7 +4783,7 @@ static void mkntfs_create_root_structures(void) } /* NTFS 1.2 reserved system files (mft records 0xc-0xf) */ for (i = 0xc; i < 0x10; i++) { - Vprintf("Creating system file (mft record 0x%x)\n", i); + ntfs_log_verbose("Creating system file (mft record 0x%x)\n", i); m = (MFT_RECORD*)(buf + i * vol->mft_record_size); err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); if (!err) { @@ -4789,14 +4793,14 @@ static void mkntfs_create_root_structures(void) if (err < 0) err_exit("Couldn't create system file %i (0x%x): %s\n", i, i, strerror(-err)); - //dump_mft_record(m); + /* dump_mft_record(m); */ } - // create systemfiles for ntfs volumes (3.1) - // starting vith file 24 (ignoring file 16-23) + /* create systemfiles for ntfs volumes (3.1) */ + /* starting vith file 24 (ignoring file 16-23) */ if (vol->major_ver >= 3) { extend_flags = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | FILE_ATTR_ARCHIVE | FILE_ATTR_DUP_VIEW_INDEX_PRESENT; - Vprintf("Creating $Quota (mft record 24)\n"); + ntfs_log_verbose("Creating $Quota (mft record 24)\n"); m = (MFT_RECORD*)(buf + 24 * vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; m->flags |= MFT_RECORD_IS_8; @@ -4805,11 +4809,11 @@ static void mkntfs_create_root_structures(void) 11 * vol->mft_record_size), extend_ref, m, MK_LE_MREF(24, 24), 0LL, 0LL, extend_flags , 0, 0, "$Quota", FILE_NAME_WIN32_AND_DOS); - // FIXME: This should be IGNORE_CASE + /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, COLLATION_NTOFS_SID, opts.index_block_size); - // FIXME: This should be IGNORE_CASE + /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$Q", 2, 0, AT_UNUSED, COLLATION_NTOFS_ULONG, opts.index_block_size); @@ -4817,7 +4821,7 @@ static void mkntfs_create_root_structures(void) err = initialize_quota(m); if (err < 0) err_exit("Couldn't create $Quota: %s\n", strerror(-err)); - Vprintf("Creating $ObjId (mft record 25)\n"); + ntfs_log_verbose("Creating $ObjId (mft record 25)\n"); m = (MFT_RECORD*)(buf + 25 * vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; m->flags |= MFT_RECORD_IS_8; @@ -4828,7 +4832,7 @@ static void mkntfs_create_root_structures(void) extend_flags, 0, 0, "$ObjId", FILE_NAME_WIN32_AND_DOS); - // FIXME: This should be IGNORE_CASE + /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, COLLATION_NTOFS_ULONGS, opts.index_block_size); @@ -4837,7 +4841,7 @@ static void mkntfs_create_root_structures(void) MK_LE_MREF(FILE_Volume, FILE_Volume)); if (err < 0) err_exit("Couldn't create $ObjId: %s\n", strerror(-err)); - Vprintf("Creating $Reparse (mft record 26)\n"); + ntfs_log_verbose("Creating $Reparse (mft record 26)\n"); m = (MFT_RECORD*)(buf + 26 * vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; m->flags |= MFT_RECORD_IS_8; @@ -4847,7 +4851,7 @@ static void mkntfs_create_root_structures(void) extend_ref, m, MK_LE_MREF(26, 26), 0LL, 0LL, extend_flags, 0, 0, "$Reparse", FILE_NAME_WIN32_AND_DOS); - // FIXME: This should be IGNORE_CASE + /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$R", 2, 0, AT_UNUSED, COLLATION_NTOFS_ULONGS, opts.index_block_size); @@ -4868,6 +4872,8 @@ int main(int argc, char **argv) MFT_RECORD *m; int i, err; + ntfs_log_set_handler(ntfs_log_handler_outerr); + /* Setup the correct locale for string output and conversion. */ utils_set_locale(); /* Initialize the random number generator with the current time. */ @@ -4879,7 +4885,7 @@ int main(int argc, char **argv) /* Register our exit function which will cleanup everything. */ err = atexit(&mkntfs_exit); if (err == -1) { - Eprintf("Could not set up exit() function because atexit() " + ntfs_log_error("Could not set up exit() function because atexit() " "failed. Aborting...\n"); mkntfs_exit(); exit(1); @@ -4890,7 +4896,7 @@ int main(int argc, char **argv) vol->mft_record_size_bits = 10; /* Length is in unicode characters. */ vol->upcase_len = 65536; - vol->upcase = (ntfschar*)malloc(vol->upcase_len * sizeof(ntfschar)); + vol->upcase = malloc(vol->upcase_len * sizeof(ntfschar)); if (!vol->upcase) err_exit("Could not allocate memory for internal buffer.\n"); init_upcase_table(vol->upcase, vol->upcase_len * sizeof(ntfschar)); @@ -4922,22 +4928,22 @@ int main(int argc, char **argv) mkntfs_fill_device_with_zeroes(); /* Create NTFS volume structures. */ mkntfs_create_root_structures(); -// - Do not step onto bad blocks!!! -// - If any bad blocks were specified or found, modify $BadClus, allocating the -// bad clusters in $Bitmap. -// - C&w bootsector backup bootsector (backup in last sector of the -// partition). -// - If NTFS 3.0+, c&w $Secure file and $Extend directory with the -// corresponding special files in it, i.e. $ObjId, $Quota, $Reparse, and -// $UsnJrnl. And others? Or not all necessary? -// - RE: Populate $root with the system files (and $Extend directory if -// applicable). Possibly should move this as far to the top as possible and -// update during each subsequent c&w of each system file. - Vprintf("Syncing root directory index record.\n"); + /* - Do not step onto bad blocks!!! */ + /* - If any bad blocks were specified or found, modify $BadClus, allocating the */ + /* bad clusters in $Bitmap. */ + /* - C&w bootsector backup bootsector (backup in last sector of the */ + /* partition). */ + /* - If NTFS 3.0+, c&w $Secure file and $Extend directory with the */ + /* corresponding special files in it, i.e. $ObjId, $Quota, $Reparse, and */ + /* $UsnJrnl. And others? Or not all necessary? */ + /* - RE: Populate $root with the system files (and $Extend directory if */ + /* applicable). Possibly should move this as far to the top as possible and */ + /* update during each subsequent c&w of each system file. */ + ntfs_log_verbose("Syncing root directory index record.\n"); mkntfs_sync_index_record(index_block, (MFT_RECORD*)(buf + 5 * vol->mft_record_size), NTFS_INDEX_I30, 4); - Vprintf("Syncing $Bitmap.\n"); + ntfs_log_verbose("Syncing $Bitmap.\n"); m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) @@ -4969,7 +4975,7 @@ int main(int argc, char **argv) * No need to sync $MFT/$BITMAP as that has never been modified since * its creation. */ - Vprintf("Syncing $MFT.\n"); + ntfs_log_verbose("Syncing $MFT.\n"); pos = opts.mft_lcn * vol->cluster_size; lw = 1; for (i = 0; i < opts.mft_size / (s32)vol->mft_record_size; i++) { @@ -4982,7 +4988,7 @@ int main(int argc, char **argv) "unknown error"); pos += vol->mft_record_size; } - Vprintf("Updating $MFTMirr.\n"); + ntfs_log_verbose("Updating $MFTMirr.\n"); pos = opts.mftmirr_lcn * vol->cluster_size; lw = 1; for (i = 0; i < rl_mftmirr[0].length * vol->cluster_size / @@ -5009,10 +5015,10 @@ int main(int argc, char **argv) "unknown error"); pos += vol->mft_record_size; } - Vprintf("Syncing device.\n"); + ntfs_log_verbose("Syncing device.\n"); if (vol->dev->d_ops->sync(vol->dev)) err_exit("Syncing device. FAILED: %s", strerror(errno)); - Qprintf("mkntfs completed successfully. Have a nice day.\n"); + ntfs_log_quiet("mkntfs completed successfully. Have a nice day.\n"); /* * Device is unlocked and closed by the registered exit function * mkntfs_exit(). From 559d3c54e4987cc047a3495b432d083db91e37ed Mon Sep 17 00:00:00 2001 From: flatcap Date: Sat, 5 Nov 2005 05:03:05 +0000 Subject: [PATCH 2700/2994] more tidying --- ntfsprogs/mkntfs.c | 273 +++++++++++++++++++++------------------------ 1 file changed, 128 insertions(+), 145 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 07b17649..56811c79 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -190,8 +190,8 @@ char *dev_name; struct mkntfs_options { long long part_start_sect; /* -p, start sector of partition on parent device */ - long long nr_sectors; /* size of device in sectors */ - long long nr_clusters; /* Note: Win2k treats clusters as + long long num_sectors; /* size of device in sectors */ + long long num_clusters; /* Note: Win2k treats clusters as 32-bit entities! */ long long volume_size; /* in bytes, or suffixed with k for kB, m or M for MB, or @@ -207,7 +207,7 @@ struct mkntfs_options { 1. */ long long mft_zone_end; /* Determined from volume_size and mft_zone_multiplier, in clusters. */ - long long nr_bad_blocks; /* Number of bad clusters. */ + long long num_bad_blocks; /* Number of bad clusters. */ long long *bad_blocks; /* Array of bad clusters. */ char *bad_blocks_filename; /* filename, file to read list of bad clusters from. */ @@ -455,7 +455,7 @@ static void parse_options(int argc, char *argv[]) if (*s || !u || (u >= ULONG_MAX && errno == ERANGE)) err_exit("Invalid number of sectors: %s\n", argv[optind - 1]); - opts.nr_sectors = u; + opts.num_sectors = u; } if (optind < argc) usage(); @@ -480,15 +480,15 @@ static void append_to_bad_blocks(unsigned long long block) { long long *new_buf; - if (!(opts.nr_bad_blocks & 15)) { - new_buf = realloc(opts.bad_blocks, (opts.nr_bad_blocks + 16) * + if (!(opts.num_bad_blocks & 15)) { + new_buf = realloc(opts.bad_blocks, (opts.num_bad_blocks + 16) * sizeof(long long)); if (!new_buf) err_exit("Reallocating memory for bad blocks list " - "failed: %s\n", strerror(errno)); + "failed: %s\n", strerror(errno)); opts.bad_blocks = new_buf; } - opts.bad_blocks[opts.nr_bad_blocks++] = block; + opts.bad_blocks[opts.num_bad_blocks++] = block; } /** @@ -508,8 +508,7 @@ static long long mkntfs_write(struct ntfs_device *dev, bytes_written = dev->d_ops->write(dev, b, count); if (bytes_written == -1LL) { retry = errno; - ntfs_log_error("Error writing to %s: %s\n", vol->dev->d_name, - strerror(errno)); + ntfs_log_perror("Error writing to %s", vol->dev->d_name); errno = retry; return bytes_written; } else if (!bytes_written) { @@ -582,9 +581,8 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, length); if (bytes_written == -1LL) { retry = errno; - ntfs_log_error("Error writing to %s: %s\n", - vol->dev->d_name, - strerror(errno)); + ntfs_log_perror("Error writing to %s", + vol->dev->d_name); errno = retry; return bytes_written; } @@ -952,7 +950,6 @@ static void dump_attr_record(ATTR_RECORD *a) "byte string in current locale.\n"); strncpy(s, "Error converting Unicode string", sizeof(s)); - } printf("Name = %s\n", s); } @@ -1079,7 +1076,7 @@ static int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) * appropriate codes exist for simplicity of parsing the return value. */ if (size != ((size + 7) & ~7)) { - ntfs_log_error("make_room_for_attribute() received non 8-byte aligned" + ntfs_log_error("make_room_for_attribute() received non 8-byte aligned " "size.\n"); return -EINVAL; } @@ -1149,7 +1146,7 @@ static runlist *allocate_scattered_clusters(s64 clusters) s64 prev_run_len = 0LL; char bit; - end = opts.nr_clusters; + end = opts.num_clusters; /* Loop until all clusters are allocated. */ while (clusters) { /* Loop in current zone until we run out of free clusters. */ @@ -1328,8 +1325,8 @@ static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, return -1; } } else if (name && !ntfs_names_are_equal(name, name_len, - (ntfschar*)((char*)a + le16_to_cpu(a->name_offset)), - a->name_length, ic, upcase, upcase_len)) { + (ntfschar*)((char*)a + le16_to_cpu(a->name_offset)), + a->name_length, ic, upcase, upcase_len)) { int rc; rc = ntfs_names_collate(name, name_len, @@ -1458,7 +1455,6 @@ static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, * The only exception to this is when @type is AT_END, in which case * @ctx->al_entry is set to NULL also (see above). * - * * The following error codes are defined: * ENOENT Attribute not found, not an error as such. * EINVAL Invalid arguments. @@ -1656,8 +1652,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, a->compression_unit = 0; bw = ntfs_rlwrite(vol->dev, rl, val, val_len, &inited_size); if (bw != val_len) - ntfs_log_error("Error writing non-resident attribute value." - "\n"); + ntfs_log_error("Error writing non-resident attribute value.\n"); err = ntfs_mapping_pairs_build(vol, (u8*)a + hdr_size + ((name_len + 7) & ~7), mpa_size, rl, 0, NULL); } @@ -1752,8 +1747,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, vol->cluster_size - 1) / vol->cluster_size); if (!rl) { err = -errno; - ntfs_log_error("Failed to allocate scattered clusters: %s\n", - strerror(-err)); + ntfs_log_perror("Failed to allocate scattered clusters"); goto err_out; } } else { @@ -1850,8 +1844,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, a->compression_unit = 0; bw = ntfs_rlwrite(vol->dev, rl, val, val_len, NULL); if (bw != val_len) - ntfs_log_error("Error writing non-resident attribute value." - "\n"); + ntfs_log_error("Error writing non-resident attribute value.\n"); err = ntfs_mapping_pairs_build(vol, (u8*)a + hdr_size + ((name_len + 7) & ~7), mpa_size, rl, 0, NULL); } @@ -1991,7 +1984,7 @@ err_out: * Return 0 on success or -errno on error. */ static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags, - u32 security_id) + u32 security_id) { STANDARD_INFORMATION si; int err, sd_size; @@ -2115,7 +2108,7 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, * return 0 on success or -errno on error */ static int add_attr_object_id(MFT_RECORD *m, OBJECT_ID_ATTR *objid_attr, - int objid_attr_len) + int objid_attr_len) { int err; @@ -2128,7 +2121,7 @@ static int add_attr_object_id(MFT_RECORD *m, OBJECT_ID_ATTR *objid_attr, else err = insert_resident_attr_in_mft_record(m, AT_OBJECT_ID, NULL, 0, 0, 0, 0, - (u8*)objid_attr, objid_attr_len); + (u8*)objid_attr, objid_attr_len); if (err < 0) ntfs_log_error("add_attr_volume_id failed: %s\n", strerror(-err)); return err; @@ -2305,7 +2298,7 @@ static int add_attr_index_root(MFT_RECORD *m, const char *name, r = malloc(val_len); if (!r) return -errno; - r->type = indexed_attr_type == AT_FILE_NAME ? AT_FILE_NAME : 0; + r->type = (indexed_attr_type == AT_FILE_NAME) ? AT_FILE_NAME : 0; if (indexed_attr_type == AT_FILE_NAME && collation_rule != COLLATION_FILE_NAME) { free(r); @@ -2324,7 +2317,7 @@ static int add_attr_index_root(MFT_RECORD *m, const char *name, } r->clusters_per_index_block = index_block_size / vol->cluster_size; - } else /* if (vol->cluster_size > index_block_size) */ { + } else { /* if (vol->cluster_size > index_block_size) */ if (index_block_size & (index_block_size - 1)) { ntfs_log_error("add_attr_index_root: index block size is not " "a power of 2.\n"); @@ -2333,7 +2326,7 @@ static int add_attr_index_root(MFT_RECORD *m, const char *name, } if (index_block_size < (u32)opts.sector_size) { ntfs_log_error("add_attr_index_root: index block size is " - "smaller than the sector size.\n"); + "smaller than the sector size.\n"); free(r); return -EINVAL; } @@ -2685,12 +2678,11 @@ static int ntfs_index_keys_compare(char *key1, char *key2, if (collation_rule == COLLATION_NTOFS_ULONGS) { /* i.e $OBJID-$O */ while ((j < min(key1_length, key2_length)) && (i == 0)) { - if (bswap_32(*(u32*)(key1 + j)) < - bswap_32(*(u32*)(key1 + j))) i = -1; - if (bswap_32(*(u32*)(key1 + j)) > - bswap_32(*(u32*)(key1 + j))) i = +1; - if (bswap_32(*(u32*)(key1 + j)) == - bswap_32(*(u32*)(key1 + j))) { + if (bswap_32(*(u32*)(key1 + j)) < bswap_32(*(u32*)(key1 + j))) + i = -1; + if (bswap_32(*(u32*)(key1 + j)) > bswap_32(*(u32*)(key1 + j))) + i = +1; + if (bswap_32(*(u32*)(key1 + j)) == bswap_32(*(u32*)(key1 + j))) { i = 0; j += 4; } @@ -2704,18 +2696,17 @@ static int ntfs_index_keys_compare(char *key1, char *key2, } if (collation_rule == COLLATION_NTOFS_SECURITY_HASH) { /* i.e. $SDH */ - if (((SDH_INDEX_KEY*)key1)->hash < - ((SDH_INDEX_KEY*)key2)->hash) i = -1; - if (((SDH_INDEX_KEY*)key1)->hash > - ((SDH_INDEX_KEY*)key2)->hash) i = +1; - if (((SDH_INDEX_KEY*)key1)->hash == - ((SDH_INDEX_KEY*)key2)->hash) { - if (((SDH_INDEX_KEY*)key1)->security_id < - ((SDH_INDEX_KEY*)key2)->security_id) i = -1; - if (((SDH_INDEX_KEY*)key1)->security_id > - ((SDH_INDEX_KEY*)key2)->security_id) i = +1; - if (((SDH_INDEX_KEY*)key1)->security_id == - ((SDH_INDEX_KEY*)key2)->security_id) i = 0; + if (((SDH_INDEX_KEY*)key1)->hash < ((SDH_INDEX_KEY*)key2)->hash) + i = -1; + if (((SDH_INDEX_KEY*)key1)->hash > ((SDH_INDEX_KEY*)key2)->hash) + i = +1; + if (((SDH_INDEX_KEY*)key1)->hash == ((SDH_INDEX_KEY*)key2)->hash) { + if (((SDH_INDEX_KEY*)key1)->security_id < ((SDH_INDEX_KEY*)key2)->security_id) + i = -1; + if (((SDH_INDEX_KEY*)key1)->security_id > ((SDH_INDEX_KEY*)key2)->security_id) + i = +1; + if (((SDH_INDEX_KEY*)key1)->security_id == ((SDH_INDEX_KEY*)key2)->security_id) + i = 0; } return i; } @@ -2741,7 +2732,7 @@ static int ntfs_index_keys_compare(char *key1, char *key2, */ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, u32 idx_size, MFT_RECORD *m, ntfschar *name, u32 name_size, - ATTR_TYPES type) + ATTR_TYPES type) { ntfs_attr_search_ctx *ctx; INDEX_HEADER *idx_header; @@ -2776,7 +2767,7 @@ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, idx_entry = (INDEX_ENTRY*)((char*)idx_header + le16_to_cpu((idx_header)->entries_offset)); idx_end = (INDEX_ENTRY*)((char*)idx_entry + - le32_to_cpu(idx_header->index_length)); + le32_to_cpu(idx_header->index_length)); /* * Loop until we exceed valid memory (corruption case) or until we * reach the last entry. @@ -2798,15 +2789,15 @@ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, /* If file names are not equal, continue search. */ if (i) goto do_next; - if (((FILE_NAME_ATTR*)&idx->key.file_name)->\ + if (((FILE_NAME_ATTR*)&idx->key.file_name)-> file_name_type != FILE_NAME_POSIX || idx_entry->key.file_name.file_name_type != FILE_NAME_POSIX) return -EEXIST; - i = ntfs_file_values_compare((FILE_NAME_ATTR*)&idx-> + i = ntfs_file_values_compare((FILE_NAME_ATTR*)&idx-> key.file_name, - (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, + (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, CASE_SENSITIVE, vol->upcase, vol->upcase_len); if (i == -1) break; @@ -2825,9 +2816,8 @@ do_next: i = ntfs_index_keys_compare((char*)idx_entry + 0x10, (char*)idx + 0x10, idx_entry->key_length, idx->key_length, collation_rule); - if (!i) { + if (!i) return -EEXIST; - } if (i == 1) break; idx_entry = (INDEX_ENTRY*)((char*)idx_entry + @@ -2913,17 +2903,15 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) sii_data->offset_in_sds = sds_header->offset; sii_data->size_in_sds = sds_header->length; if ((err = insert_index_entry_in_res_dir_index(idx_entry_sdh, - sdh_size, m, - NTFS_INDEX_SDH, 4, AT_UNUSED))) + sdh_size, m, NTFS_INDEX_SDH, 4, AT_UNUSED))) break; if ((err = insert_index_entry_in_res_dir_index(idx_entry_sii, - sii_size, m, - NTFS_INDEX_SII, 4, AT_UNUSED))) + sii_size, m, NTFS_INDEX_SII, 4, AT_UNUSED))) break; sds_header = (SECURITY_DESCRIPTOR_HEADER*)((char*)sds_header + (cpu_to_le32(sds_header->length + 0x0F) & - ~cpu_to_le32(0x0F))); + ~cpu_to_le32(0x0F))); if (!sds_header->length) break; } @@ -2968,11 +2956,11 @@ static int initialize_quota(MFT_RECORD *m) idx_entry_o->key.sid.identifier_authority.low_part = cpu_to_le32(0x05000000); idx_entry_o->key.sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); idx_entry_o->key.sid.sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); idx_entry_o_data = (QUOTA_O_INDEX_DATA*)((char*)idx_entry_o - + idx_entry_o->data_offset); + + idx_entry_o->data_offset); idx_entry_o_data->owner_id = QUOTA_FIRST_USER_ID; /* 20 00 00 00 padding after here on ntfs 3.1 ?? */ @@ -2983,7 +2971,7 @@ static int initialize_quota(MFT_RECORD *m) if (err) return err; - /* q index entry nr. 1 */ + /* q index entry num 1 */ idx_entry_q1->data_offset = cpu_to_le16(0x14); idx_entry_q1->data_length = cpu_to_le16(0x30); idx_entry_q1->reservedV = cpu_to_le32(0x00); @@ -2993,7 +2981,7 @@ static int initialize_quota(MFT_RECORD *m) idx_entry_q1->reserved = cpu_to_le16(0x00); idx_entry_q1->key.owner_id = cpu_to_le32(0x01); idx_entry_q1_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q1 - + idx_entry_q1->data_offset); + + idx_entry_q1->data_offset); idx_entry_q1_data->version = cpu_to_le32(0x02); idx_entry_q1_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; if (vol->minor_ver == 0) @@ -3011,7 +2999,7 @@ static int initialize_quota(MFT_RECORD *m) if (err) return err; - /* q index entry nr. 2 */ + /* q index entry num 2 */ idx_entry_q2->data_offset = cpu_to_le16(0x14); idx_entry_q2->data_length = cpu_to_le16(0x40); idx_entry_q2->reservedV = cpu_to_le32(0x00); @@ -3021,7 +3009,7 @@ static int initialize_quota(MFT_RECORD *m) idx_entry_q2->reserved = cpu_to_le16(0x00); idx_entry_q2->key.owner_id = QUOTA_FIRST_USER_ID; idx_entry_q2_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q2 - + idx_entry_q2->data_offset); + + idx_entry_q2->data_offset); idx_entry_q2_data->version = cpu_to_le32(0x02); idx_entry_q2_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; idx_entry_q2_data->bytes_used = cpu_to_le64(0x00); @@ -3036,7 +3024,7 @@ static int initialize_quota(MFT_RECORD *m) idx_entry_q2_data->sid.identifier_authority.low_part = cpu_to_le32(0x05000000); idx_entry_q2_data->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); idx_entry_q2_data->sid.sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); @@ -3074,7 +3062,7 @@ static int initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) idx_entry_o->reserved = cpu_to_le16(0x00); idx_entry_o->key.object_id = guid; idx_entry_o_data = (OBJ_ID_INDEX_DATA*)((char*)idx_entry_o - + idx_entry_o->data_offset); + + idx_entry_o->data_offset); idx_entry_o_data->mft_reference = mref; idx_entry_o_data->birth_volume_id = *zero_guid; idx_entry_o_data->birth_object_id = *zero_guid; @@ -3118,14 +3106,13 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, * reach the last entry. */ while ((char*)ie < index_end && !(ie->flags & INDEX_ENTRY_END)) { -/* +#if 0 #ifdef DEBUG ntfs_log_debug("file_name_attr1->file_name_length = %i\n", file_name->file_name_length); if (file_name->file_name_length) { char *__buf; - __buf = calloc(1, file_name->file_name_length + - 1); + __buf = calloc(1, file_name->file_name_length + 1); if (!__buf) err_exit("Failed to allocate internal buffer: " "%s\n", strerror(errno)); @@ -3141,8 +3128,7 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, ie->key.file_name.file_name_length); if (ie->key.file_name.file_name_length) { char *__buf; - __buf = calloc(1, - ie->key.file_name.file_name_length + 1); + __buf = calloc(1, ie->key.file_name.file_name_length + 1); if (!__buf) err_exit("Failed to allocate internal buffer: " "%s\n", strerror(errno)); @@ -3155,7 +3141,7 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, free(__buf); } #endif -*/ +#endif i = ntfs_file_values_compare(file_name, (FILE_NAME_ATTR*)&ie->key.file_name, 1, IGNORE_CASE, vol->upcase, vol->upcase_len); @@ -3192,8 +3178,7 @@ do_next: #ifdef DEBUG /* Next entry. */ if (!ie->length) { - ntfs_log_debug("BUG: ie->length is zero, breaking out of " - "loop.\n"); + ntfs_log_debug("BUG: ie->length is zero, breaking out of loop.\n"); break; } #endif @@ -3312,8 +3297,8 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, idx_entry_new->length = idx_size + 0x10; idx_entry_new->key_length = fn_size; memcpy((char*)idx_entry_new+0x10, (char*)fn, fn_size); - i = insert_index_entry_in_res_dir_index(idx_entry_new, idx_size + 0x10 - , m_parent, NTFS_INDEX_I30, 4, AT_FILE_NAME); + i = insert_index_entry_in_res_dir_index(idx_entry_new, idx_size + 0x10, + m_parent, NTFS_INDEX_I30, 4, AT_FILE_NAME); if (i < 0) { ntfs_log_error("create_hardlink failed inserting index entry: %s\n", strerror(-i)); @@ -3518,22 +3503,22 @@ static void mkntfs_open_partition(void) ntfs_log_error("%s is not a block device.\n", vol->dev->d_name); if (!opts.force) err_exit("Refusing to make a filesystem here!\n"); - if (!opts.nr_sectors) { + if (!opts.num_sectors) { if (!sbuf.st_size && !sbuf.st_blocks) err_exit("You must specify the number of " "sectors.\n"); if (opts.sector_size) { if (sbuf.st_size) - opts.nr_sectors = sbuf.st_size / + opts.num_sectors = sbuf.st_size / opts.sector_size; else - opts.nr_sectors = ((s64)sbuf.st_blocks + opts.num_sectors = ((s64)sbuf.st_blocks << 9) / opts.sector_size; } else { if (sbuf.st_size) - opts.nr_sectors = sbuf.st_size / 512; + opts.num_sectors = sbuf.st_size / 512; else - opts.nr_sectors = sbuf.st_blocks; + opts.num_sectors = sbuf.st_blocks; opts.sector_size = 512; } } @@ -3578,9 +3563,9 @@ static void mkntfs_override_phys_params(void) int _sect_size = 0; if (vol->dev->d_ops->ioctl(vol->dev, BLKSSZGET, &_sect_size) - >= 0) + >= 0) { opts.sector_size = _sect_size; - else + } else #endif { ntfs_log_error("No sector size specified for %s and it could " @@ -3598,16 +3583,16 @@ static void mkntfs_override_phys_params(void) "less than or equal 4096 bytes.\n"); ntfs_log_debug("sector size = %i bytes\n", opts.sector_size); /* If user didn't specify the number of sectors, determine it now. */ - if (!opts.nr_sectors) { - opts.nr_sectors = ntfs_device_size_get(vol->dev, + if (!opts.num_sectors) { + opts.num_sectors = ntfs_device_size_get(vol->dev, opts.sector_size); - if (opts.nr_sectors <= 0) + if (opts.num_sectors <= 0) err_exit("ntfs_device_size_get(%s) failed. Please " "specify it manually.\n", vol->dev->d_name); } - ntfs_log_debug("number of sectors = %lld (0x%llx)\n", opts.nr_sectors, - opts.nr_sectors); + ntfs_log_debug("number of sectors = %lld (0x%llx)\n", opts.num_sectors, + opts.num_sectors); /* * Reserve the last sector for the backup boot sector unless the * sector size is less than 512 bytes in which case reserve 512 bytes @@ -3616,7 +3601,7 @@ static void mkntfs_override_phys_params(void) i = 1; if (opts.sector_size < 512) i = 512 / opts.sector_size; - opts.nr_sectors -= i; + opts.num_sectors -= i; /* If user didn't specify the partition start sector, determine it. */ if (opts.part_start_sect < 0) { opts.part_start_sect = ntfs_device_partition_start_sector_get( @@ -3694,7 +3679,7 @@ static void mkntfs_override_phys_params(void) } /* If user didn't specify the volume size, determine it now. */ if (!opts.volume_size) - opts.volume_size = opts.nr_sectors * opts.sector_size; + opts.volume_size = opts.num_sectors * opts.sector_size; else if (opts.volume_size & (opts.sector_size - 1)) err_exit("volume_size is not a multiple of sector_size.\n"); /* Validate volume size. */ @@ -3758,23 +3743,23 @@ static void mkntfs_override_phys_params(void) "by Windows.\n"); } /* If user didn't specify the number of clusters, determine it now. */ - if (!opts.nr_clusters) - opts.nr_clusters = opts.volume_size / vol->cluster_size; + if (!opts.num_clusters) + opts.num_clusters = opts.volume_size / vol->cluster_size; /* - * Check the cluster_size and nr_sectors for consistency with - * sector_size and nr_sectors. And check both of these for consistency + * Check the cluster_size and num_sectors for consistency with + * sector_size and num_sectors. And check both of these for consistency * with volume_size. */ - if (opts.nr_clusters != (opts.nr_sectors * opts.sector_size) / + if (opts.num_clusters != (opts.num_sectors * opts.sector_size) / vol->cluster_size || - opts.volume_size / opts.sector_size != opts.nr_sectors || - opts.volume_size / vol->cluster_size != opts.nr_clusters) + opts.volume_size / opts.sector_size != opts.num_sectors || + opts.volume_size / vol->cluster_size != opts.num_clusters) err_exit("Illegal combination of volume/cluster/sector size " - "and/or cluster/sector number.\n"); - ntfs_log_debug("number of clusters = %llu (0x%llx)\n", opts.nr_clusters, - opts.nr_clusters); + "and/or cluster/sector number.\n"); + ntfs_log_debug("number of clusters = %llu (0x%llx)\n", opts.num_clusters, + opts.num_clusters); /* Number of clusters must fit within 32 bits (Win2k limitation). */ - if (opts.nr_clusters >> 32) { + if (opts.num_clusters >> 32) { if (vol->cluster_size >= 65536) err_exit("Device is too large to hold an NTFS volume " "(maximum size is 256TiB).\n"); @@ -3796,7 +3781,7 @@ static void mkntfs_initialize_bitmaps(void) int i, j; /* Determine lcn bitmap byte size and allocate it. */ - lcn_bitmap_byte_size = (opts.nr_clusters + 7) >> 3; + lcn_bitmap_byte_size = (opts.num_clusters + 7) >> 3; /* Needs to be multiple of 8 bytes. */ lcn_bitmap_byte_size = (lcn_bitmap_byte_size + 7) & ~7; i = (lcn_bitmap_byte_size + vol->cluster_size - 1) & @@ -3811,7 +3796,7 @@ static void mkntfs_initialize_bitmaps(void) * $Bitmap can overlap the end of the volume. Any bits in this region * must be set. This region also encompasses the backup boot sector. */ - for (i = opts.nr_clusters; i < lcn_bitmap_byte_size << 3; i++) + for (i = opts.num_clusters; i < lcn_bitmap_byte_size << 3; i++) ntfs_bit_set(lcn_bitmap, (u64)i, 1); /* * Determine mft_size: (16 (1.2) or 27 (3.0+) mft records) @@ -3873,7 +3858,7 @@ static void mkntfs_initialize_rl_mft(void) } ntfs_log_debug("$MFT logical cluster number = 0x%llx\n", opts.mft_lcn); /* Determine MFT zone size. */ - opts.mft_zone_end = opts.nr_clusters; + opts.mft_zone_end = opts.num_clusters; switch (opts.mft_zone_multiplier) { /* % of volume size in clusters */ case 4: opts.mft_zone_end = opts.mft_zone_end >> 1; /* 50% */ @@ -3911,7 +3896,7 @@ static void mkntfs_initialize_rl_mft(void) for (i = 0; i < j; i++) ntfs_bit_set(lcn_bitmap, opts.mft_lcn + i, 1); /* Determine mftmirr_lcn (middle of volume). */ - opts.mftmirr_lcn = (opts.nr_sectors * opts.sector_size >> 1) + opts.mftmirr_lcn = (opts.num_sectors * opts.sector_size >> 1) / vol->cluster_size; ntfs_log_debug("$MFTMirr logical cluster number = 0x%llx\n", opts.mftmirr_lcn); @@ -3973,7 +3958,7 @@ static void mkntfs_initialize_rl_logfile(void) opts.logfile_size = (opts.volume_size / 100) & ~(vol->cluster_size - 1); j = opts.logfile_size / vol->cluster_size; - while (rl_logfile[0].lcn + j >= opts.nr_clusters) { + while (rl_logfile[0].lcn + j >= opts.num_clusters) { /* * $Logfile would overflow volume. Need to make it smaller than * the standard size. It's ok as we are creating a non-standard @@ -4048,7 +4033,7 @@ static void mkntfs_initialize_rl_bad(void) * $BadClus named stream $Bad contains the whole volume as a single * sparse runlist entry. */ - rl_bad[1].vcn = rl_bad[0].length = opts.nr_clusters; + rl_bad[1].vcn = rl_bad[0].length = opts.num_clusters; rl_bad[1].lcn = -1LL; rl_bad[1].length = 0LL; @@ -4069,12 +4054,12 @@ static void mkntfs_fill_device_with_zeroes(void) int i; ssize_t bw; unsigned long long position, mid_clust; - float progress_inc = (float)opts.nr_clusters / 100; + float progress_inc = (float)opts.num_clusters / 100; ntfs_log_quiet("Initialising device with zeroes: 0%%"); fflush(stdout); mid_clust = (opts.volume_size >> 1) / vol->cluster_size; - for (position = 0; position < (unsigned long long)opts.nr_clusters; + for (position = 0; position < (unsigned long long)opts.num_clusters; position++) { if (!(position % (int)(progress_inc+1))) { ntfs_log_quiet("\b\b\b\b%3.0f%%", position / @@ -4239,7 +4224,7 @@ static int create_backup_boot_sector(u8 *buff) size = 512; if (size < opts.sector_size) size = opts.sector_size; - if (vol->dev->d_ops->seek(vol->dev, (opts.nr_sectors + 1) * + if (vol->dev->d_ops->seek(vol->dev, (opts.num_sectors + 1) * opts.sector_size - size, SEEK_SET) == (off_t)-1) goto bb_err; if (size > 8192) @@ -4331,7 +4316,7 @@ static void mkntfs_create_root_structures(void) if (vol->major_ver < 3) { add_attr_std_info(m, file_attrs, - cpu_to_le32(0)); /* dump_mft_record(m); */ + cpu_to_le32(0)); } else { /* setting specific security_id flag and */ /* filepermissions for ntfs 3.x */ @@ -4512,9 +4497,8 @@ static void mkntfs_create_root_structures(void) /* windows 2003 will regard the volume as corrupt (ERSO) */ if (!err) err = insert_non_resident_attr_in_mft_record(m, - AT_DATA, NULL, 0, - 0, 0, - lcn_bitmap, lcn_bitmap_byte_size); + AT_DATA, NULL, 0, 0, 0, + lcn_bitmap, lcn_bitmap_byte_size); if (!err) @@ -4539,7 +4523,7 @@ static void mkntfs_create_root_structures(void) strerror(errno)); memcpy(buf2, boot_array, sizeof(boot_array)); /* - * Create the boot sector into buf2. Note, that buf2 already is zeroed + * Create the boot sector in buf2. Note, that buf2 already is zeroed * in the boot sector section and that it has the NTFS OEM id/magic * already inserted, so no need to worry about these things. */ @@ -4560,7 +4544,7 @@ static void mkntfs_create_root_structures(void) * If there are problems go back to bs->unused[0-3] and set them. See * ../include/layout.h for details. */ - bs->number_of_sectors = cpu_to_sle64(opts.nr_sectors); + bs->number_of_sectors = cpu_to_sle64(opts.num_sectors); bs->mft_lcn = cpu_to_sle64(opts.mft_lcn); bs->mftmirr_lcn = cpu_to_sle64(opts.mftmirr_lcn); if (vol->mft_record_size >= vol->cluster_size) { @@ -4635,7 +4619,7 @@ static void mkntfs_create_root_structures(void) /* FIXME: This should be IGNORE_CASE */ /* Create a sparse named stream of size equal to the volume size. */ err = add_attr_data_positioned(m, "$Bad", 4, 0, 0, rl_bad, NULL, - opts.nr_clusters * vol->cluster_size); + opts.num_clusters * vol->cluster_size); if (!err) { err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); } @@ -4662,9 +4646,8 @@ static void mkntfs_create_root_structures(void) if (!err) err = create_hardlink(index_block, root_ref, m, MK_LE_MREF(9, 9), 0LL, 0LL, - FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0 - , 0, "$Quota", - FILE_NAME_WIN32_AND_DOS); + FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, + 0, "$Quota", FILE_NAME_WIN32_AND_DOS); if (!err) { init_system_file_sd(FILE_Secure, &sd, &i); err = add_attr_sd(m, sd, i); @@ -4687,14 +4670,12 @@ static void mkntfs_create_root_structures(void) if (vol->minor_ver == 0) { buf_sds_first_size = 0x1E0; buf_sds_size = 0x40000 + buf_sds_first_size; - buf_sds_init = calloc(1, - buf_sds_first_size); + buf_sds_init = calloc(1, buf_sds_first_size); init_secure_30(buf_sds_init); } else { buf_sds_first_size = 0x240; buf_sds_size = 0x40000 + buf_sds_first_size; - buf_sds_init = calloc(1, - buf_sds_first_size); + buf_sds_init = calloc(1, buf_sds_first_size); init_secure_31(buf_sds_init); } buf_sds = calloc(1,buf_sds_size); @@ -4718,11 +4699,10 @@ static void mkntfs_create_root_structures(void) err = add_attr_index_root(m, "$SII", 4, 0, AT_UNUSED, COLLATION_NTOFS_ULONG, opts.index_block_size); if (!err) - err =initialize_secure(buf_sds_init, buf_sds_first_size - , m); + err =initialize_secure(buf_sds_init, buf_sds_first_size, m); if (err < 0) err_exit("Couldn't create $Secure: %s\n", - strerror(-err)); + strerror(-err)); } /* dump_mft_record(m); */ ntfs_log_verbose("Creating $UpCase (mft record 0xa)\n"); @@ -4779,7 +4759,7 @@ static void mkntfs_create_root_structures(void) COLLATION_FILE_NAME, opts.index_block_size); if (err < 0) err_exit("Couldn't create $Extend: %s\n", - strerror(-err)); + strerror(-err)); } /* NTFS 1.2 reserved system files (mft records 0xc-0xf) */ for (i = 0xc; i < 0x10; i++) { @@ -4807,8 +4787,8 @@ static void mkntfs_create_root_structures(void) if (!err) err = create_hardlink_res((MFT_RECORD*)(buf + 11 * vol->mft_record_size), extend_ref, m, - MK_LE_MREF(24, 24), 0LL, 0LL, extend_flags - , 0, 0, "$Quota", FILE_NAME_WIN32_AND_DOS); + MK_LE_MREF(24, 24), 0LL, 0LL, extend_flags, + 0, 0, "$Quota", FILE_NAME_WIN32_AND_DOS); /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, @@ -4838,7 +4818,7 @@ static void mkntfs_create_root_structures(void) COLLATION_NTOFS_ULONGS, opts.index_block_size); if (!err) err = initialize_objid(m, volume_obj_id->object_id, - MK_LE_MREF(FILE_Volume, FILE_Volume)); + MK_LE_MREF(FILE_Volume, FILE_Volume)); if (err < 0) err_exit("Couldn't create $ObjId: %s\n", strerror(-err)); ntfs_log_verbose("Creating $Reparse (mft record 26)\n"); @@ -4928,17 +4908,20 @@ int main(int argc, char **argv) mkntfs_fill_device_with_zeroes(); /* Create NTFS volume structures. */ mkntfs_create_root_structures(); - /* - Do not step onto bad blocks!!! */ - /* - If any bad blocks were specified or found, modify $BadClus, allocating the */ - /* bad clusters in $Bitmap. */ - /* - C&w bootsector backup bootsector (backup in last sector of the */ - /* partition). */ - /* - If NTFS 3.0+, c&w $Secure file and $Extend directory with the */ - /* corresponding special files in it, i.e. $ObjId, $Quota, $Reparse, and */ - /* $UsnJrnl. And others? Or not all necessary? */ - /* - RE: Populate $root with the system files (and $Extend directory if */ - /* applicable). Possibly should move this as far to the top as possible and */ - /* update during each subsequent c&w of each system file. */ + + /* + * - Do not step onto bad blocks!!! + * - If any bad blocks were specified or found, modify $BadClus, allocating the + * bad clusters in $Bitmap. + * - C&w bootsector backup bootsector (backup in last sector of the + * partition). + * - If NTFS 3.0+, c&w $Secure file and $Extend directory with the + * corresponding special files in it, i.e. $ObjId, $Quota, $Reparse, and + * $UsnJrnl. And others? Or not all necessary? + * - RE: Populate $root with the system files (and $Extend directory if + * applicable). Possibly should move this as far to the top as possible and + * update during each subsequent c&w of each system file. + */ ntfs_log_verbose("Syncing root directory index record.\n"); mkntfs_sync_index_record(index_block, (MFT_RECORD*)(buf + 5 * vol->mft_record_size), NTFS_INDEX_I30, 4); From de5de5a9c32cba7c9e8b1ebe4f216026eb4d1ba2 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sat, 5 Nov 2005 06:11:42 +0000 Subject: [PATCH 2701/2994] global variables don't belong in opts highlight the global nature of the variables in their name --- ntfsprogs/mkntfs.c | 1102 ++++++++++++++++++++++---------------------- 1 file changed, 548 insertions(+), 554 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 56811c79..390d6184 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -166,80 +166,73 @@ const char *EXEC_NAME = "mkntfs"; * global variables * Need these global so mkntfs_exit can access them. */ -u8 *buf = NULL; -u8 *buf2 = NULL; -int buf2_size = 0; -char *buf_sds = NULL; -char *buf_sds_init = NULL; -int buf_sds_size = 0; -int buf_sds_first_size; -int mft_bitmap_size, mft_bitmap_byte_size; -u8 *mft_bitmap = NULL; -int lcn_bitmap_byte_size; -u8 *lcn_bitmap = NULL; -OBJECT_ID_ATTR *volume_obj_id; -runlist *rl_mft = NULL, *rl_mft_bmp = NULL, *rl_mftmirr = NULL; -runlist *rl_logfile = NULL, *rl_boot = NULL, *rl_bad = NULL, *rl_index; -INDEX_ALLOCATION *index_block = NULL; -ntfs_volume *vol; -char *dev_name; +u8 *g_buf = NULL; +u8 *g_buf2 = NULL; +int g_buf2_size = 0; +char *g_buf_sds = NULL; +char *g_buf_sds_init = NULL; +int g_buf_sds_size = 0; +int g_buf_sds_first_size = 0; +int g_mft_bitmap_size = 0; +int g_mft_bitmap_byte_size = 0; +u8 *g_mft_bitmap = NULL; +int g_lcn_bitmap_byte_size = 0; +u8 *g_lcn_bitmap = NULL; +OBJECT_ID_ATTR *g_volume_obj_id = NULL; +runlist *g_rl_mft = NULL; +runlist *g_rl_mft_bmp = NULL; +runlist *g_rl_mftmirr = NULL; +runlist *g_rl_logfile = NULL; +runlist *g_rl_boot = NULL; +runlist *g_rl_bad = NULL; +runlist *g_rl_index = NULL; +INDEX_ALLOCATION *g_index_block = NULL; +ntfs_volume *g_vol = NULL; + +/* globals demoted from mkntfs_options */ +long long g_num_clusters = 0; /* Note: Win2k treats clusters as 32-bit entities! */ +long long g_volume_size = 0; /* in bytes */ +int g_index_block_size = 0; /* in bytes */ +int g_mft_size = 0; /* The bigger of 16kB & one cluster */ +long long g_mft_lcn = 0; /* lcn of $MFT, $DATA attribute */ +long long g_mftmirr_lcn = 0; /* lcn of $MFTMirr, $DATA */ +long long g_logfile_lcn = 0; /* lcn of $LogFile, $DATA */ +int g_logfile_size = 0; /* in bytes, determined from volume_size */ +long long g_mft_zone_end = 0; /* Determined from volume_size and mft_zone_multiplier, in clusters */ +long long g_num_bad_blocks = 0; /* Number of bad clusters */ +long long *g_bad_blocks = NULL; /* Array of bad clusters */ +ATTR_DEF *g_attr_defs = NULL; /* filename, attribute defs */ +int g_attr_defs_len = 0; /* in bytes */ /** * struct mkntfs_options */ struct mkntfs_options { - long long part_start_sect; /* -p, start sector of partition on - parent device */ - long long num_sectors; /* size of device in sectors */ - long long num_clusters; /* Note: Win2k treats clusters as - 32-bit entities! */ - long long volume_size; /* in bytes, or suffixed - with k for kB, m or M for MB, or - g or G for GB, or t or T for TB */ - int index_block_size; /* in bytes. */ - int mft_size; /* The bigger of 16kB & one cluster. */ - long long mft_lcn; /* lcn of $MFT, $DATA attribute. */ - long long mftmirr_lcn; /* lcn of $MFTMirr, $DATA. */ - long long logfile_lcn; /* lcn of $LogFile, $DATA. */ - int logfile_size; /* in bytes, determined from - volume_size. */ - int mft_zone_multiplier; /* -z, value from 1 to 4. Default is - 1. */ - long long mft_zone_end; /* Determined from volume_size and - mft_zone_multiplier, in clusters. */ - long long num_bad_blocks; /* Number of bad clusters. */ - long long *bad_blocks; /* Array of bad clusters. */ - char *bad_blocks_filename; /* filename, file to read list of - bad clusters from. */ - ATTR_DEF *attr_defs; /* filename, attribute defs. */ - int attr_defs_len; /* in bytes */ - ntfschar *upcase; /* filename, upcase table. */ - u32 upcase_len; /* Determined automatically. */ - int sector_size; /* -s, in bytes, power of 2, default is - 512 bytes. */ - int sectors_per_track; /* -S, number of sectors per track on - device */ - int heads; /* -H, number of heads on device */ + char *dev_name; /* Name of the device, or file, to use */ + BOOL enable_compression; /* -C, enables compression of all files on the volume by default. */ + BOOL quick_format; /* -f or -Q, fast format, don't zero the volume first. */ + BOOL force; /* -F, force fs creation. */ + long heads; /* -H, number of heads on device */ + BOOL disable_indexing; /* -I, disables indexing of file contents on the volume by default. */ + BOOL no_action; /* -n, do not write to device, only display what would be done. */ + long long part_start_sect; /* -p, start sector of partition on parent device */ int quiet; /* -q, quiet execution. */ - int verbose; /* -v, verbose execution, given twice, - * really verbose execution (debug - * mode). */ - int force; /* -F, force fs creation. */ - int no_action; /* -n, do not write to device, only - display what would be done. */ - char check_bad_blocks; /* read-only test for bad - clusters. */ - char quick_format; /* -f or -Q, fast format, don't zero - the volume first. */ - char enable_compression; /* -C, enables compression of all files - on the volume by default. */ - char disable_indexing; /* -I, disables indexing of file - contents on the volume by default. */ - /* -V, print version and exit. */ - char use_epoch_time; /* -T, fake the time to be - 00:00:00 UTC, Jan 1, 1970. */ + long sector_size; /* -s, in bytes, power of 2, default is 512 bytes. */ + long sectors_per_track; /* -S, number of sectors per track on device */ + BOOL use_epoch_time; /* -T, fake the time to be 00:00:00 UTC, Jan 1, 1970. */ + long verbose; /* -v, verbose execution */ + long mft_zone_multiplier; /* -z, value from 1 to 4. Default is 1. */ + long long num_sectors; /* size of device in sectors */ + + /* As yet unreferenced */ + long cluster_size; /* -c, format with this cluster-size */ + u8 ver_major; /* -w, ntfs version to create */ + u8 ver_minor; + char *label; /* -L, volume label */ + BOOL debug; /* --debug, lots of extra logging */ } opts; + /** * err_exit - error output and terminate; ignores quiet (-q) */ @@ -264,6 +257,7 @@ static void copyright(void) { fprintf(stderr, "Copyright (c) 2000-2005 Anton Altaparmakov\n" "Copyright (c) 2001-2005 Richard Russon\n" + "Copyright (c) 2002-2005 Szabolcs Szakacsits\n" "Create an NTFS volume on a user specified (block) " "device.\n"); } @@ -348,7 +342,7 @@ static void parse_options(int argc, char *argv[]) l = strtol(optarg, &s, 0); if (l <= 0 || l > INT_MAX || *s) err_exit("Invalid cluster size.\n"); - vol->cluster_size = l; + g_vol->cluster_size = l; break; case 'f': case 'Q': @@ -387,29 +381,29 @@ static void parse_options(int argc, char *argv[]) break; case 'w': if (!strcmp(optarg , "1.2")) { - vol->major_ver = 1; - vol->minor_ver = 2; - opts.attr_defs = + g_vol->major_ver = 1; + g_vol->minor_ver = 2; + g_attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; - opts.attr_defs_len = + g_attr_defs_len = sizeof(attrdef_ntfs12_array); break; } if (!strcmp(optarg , "3.0")) { - vol->major_ver = 3; - vol->minor_ver = 0; - opts.attr_defs = + g_vol->major_ver = 3; + g_vol->minor_ver = 0; + g_attr_defs = (ATTR_DEF*)&attrdef_ntfs3x_array; - opts.attr_defs_len = + g_attr_defs_len = sizeof(attrdef_ntfs3x_array); break; } if (!strcmp(optarg , "3.1")) { - vol->major_ver = 3; - vol->minor_ver = 1; - opts.attr_defs = + g_vol->major_ver = 3; + g_vol->minor_ver = 1; + g_attr_defs = (ATTR_DEF*)&attrdef_ntfs3x_array; - opts.attr_defs_len = + g_attr_defs_len = sizeof(attrdef_ntfs3x_array); break; } @@ -433,7 +427,7 @@ static void parse_options(int argc, char *argv[]) opts.disable_indexing = 1; break; case 'L': - vol->vol_name = optarg; + g_vol->vol_name = optarg; break; case 'V': /* Version number already printed, so just exit. */ @@ -449,7 +443,7 @@ static void parse_options(int argc, char *argv[]) } if (optind == argc) usage(); - dev_name = argv[optind++]; + opts.dev_name = argv[optind++]; if (optind < argc) { u = strtoul(argv[optind++], &s, 0); if (*s || !u || (u >= ULONG_MAX && errno == ERANGE)) @@ -480,15 +474,15 @@ static void append_to_bad_blocks(unsigned long long block) { long long *new_buf; - if (!(opts.num_bad_blocks & 15)) { - new_buf = realloc(opts.bad_blocks, (opts.num_bad_blocks + 16) * + if (!(g_num_bad_blocks & 15)) { + new_buf = realloc(g_bad_blocks, (g_num_bad_blocks + 16) * sizeof(long long)); if (!new_buf) err_exit("Reallocating memory for bad blocks list " "failed: %s\n", strerror(errno)); - opts.bad_blocks = new_buf; + g_bad_blocks = new_buf; } - opts.bad_blocks[opts.num_bad_blocks++] = block; + g_bad_blocks[g_num_bad_blocks++] = block; } /** @@ -508,7 +502,7 @@ static long long mkntfs_write(struct ntfs_device *dev, bytes_written = dev->d_ops->write(dev, b, count); if (bytes_written == -1LL) { retry = errno; - ntfs_log_perror("Error writing to %s", vol->dev->d_name); + ntfs_log_perror("Error writing to %s", g_vol->dev->d_name); errno = retry; return bytes_written; } else if (!bytes_written) { @@ -520,7 +514,7 @@ static long long mkntfs_write(struct ntfs_device *dev, } while (count && retry < 3); if (count) ntfs_log_error("Failed to complete writing to %s after three retries." - "\n", vol->dev->d_name); + "\n", g_vol->dev->d_name); return total; } @@ -553,7 +547,7 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, total = 0LL; delta = 0LL; for (i = 0; rl[i].length; i++) { - length = rl[i].length * vol->cluster_size; + length = rl[i].length * g_vol->cluster_size; /* Don't write sparse runs. */ if (rl[i].lcn == -1) { total += length; @@ -572,7 +566,7 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, length = val_len - total; delta -= length; } - if (dev->d_ops->seek(dev, rl[i].lcn * vol->cluster_size, + if (dev->d_ops->seek(dev, rl[i].lcn * g_vol->cluster_size, SEEK_SET) == (off_t)-1) return -1LL; retry = 0; @@ -582,7 +576,7 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, if (bytes_written == -1LL) { retry = errno; ntfs_log_perror("Error writing to %s", - vol->dev->d_name); + g_vol->dev->d_name); errno = retry; return bytes_written; } @@ -597,7 +591,7 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, } while (length && retry < 3); if (length) { ntfs_log_error("Failed to complete writing to %s after three " - "retries.\n", vol->dev->d_name); + "retries.\n", g_vol->dev->d_name); return total; } } @@ -915,17 +909,17 @@ static void dump_attr_record(ATTR_RECORD *a) return; } u = le32_to_cpu(a->type); - for (i = 0; opts.attr_defs[i].type; i++) - if (le32_to_cpu(opts.attr_defs[i].type) >= u) + for (i = 0; g_attr_defs[i].type; i++) + if (le32_to_cpu(g_attr_defs[i].type) >= u) break; - if (opts.attr_defs[i].type) { + if (g_attr_defs[i].type) { #if 0 - printf("type = 0x%x\n", le32_to_cpu(opts.attr_defs[i].type)); - { char *p = (char*)opts.attr_defs[i].name; + printf("type = 0x%x\n", le32_to_cpu(g_attr_defs[i].type)); + { char *p = (char*)g_attr_defs[i].name; printf("name = %c%c%c%c%c\n", *p, p[1], p[2], p[3], p[4]); } #endif - if (ucstos(s, opts.attr_defs[i].name, sizeof(s)) == -1) { + if (ucstos(s, g_attr_defs[i].name, sizeof(s)) == -1) { ntfs_log_error("Could not convert Unicode string to single " "byte string in current locale.\n"); strncpy(s, "Error converting Unicode string", @@ -1118,7 +1112,7 @@ static void deallocate_scattered_clusters(const runlist *rl) continue; /* Deallocate the current run. */ for (j = rl[i].lcn; j < rl[i].lcn + rl[i].length; j++) - ntfs_bit_set(lcn_bitmap, j, 0); + ntfs_bit_set(g_lcn_bitmap, j, 0); } } @@ -1146,12 +1140,12 @@ static runlist *allocate_scattered_clusters(s64 clusters) s64 prev_run_len = 0LL; char bit; - end = opts.num_clusters; + end = g_num_clusters; /* Loop until all clusters are allocated. */ while (clusters) { /* Loop in current zone until we run out of free clusters. */ - for (lcn = opts.mft_zone_end; lcn < end; lcn++) { - bit = ntfs_bit_get_and_set(lcn_bitmap, lcn, 1); + for (lcn = g_mft_zone_end; lcn < end; lcn++) { + bit = ntfs_bit_get_and_set(g_lcn_bitmap, lcn, 1); if (bit) continue; /* @@ -1185,10 +1179,10 @@ static runlist *allocate_scattered_clusters(s64 clusters) } /* Switch to next zone, decreasing mft zone by factor 2. */ - end = opts.mft_zone_end; - opts.mft_zone_end >>= 1; + end = g_mft_zone_end; + g_mft_zone_end >>= 1; /* Have we run out of space on the volume? */ - if (opts.mft_zone_end <= 0) + if (g_mft_zone_end <= 0) goto err_end; } return rl; @@ -1281,8 +1275,8 @@ static int mkntfs_attr_find(const ATTR_TYPES type, const ntfschar *name, const u8 *val, const u32 val_len, ntfs_attr_search_ctx *ctx) { ATTR_RECORD *a; - ntfschar *upcase = vol->upcase; - u32 upcase_len = vol->upcase_len; + ntfschar *upcase = g_vol->upcase; + u32 upcase_len = g_vol->upcase_len; /* * Iterate over attributes in mft record starting at @ctx->attr, or the @@ -1566,7 +1560,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, } else { hdr_size = 64; if (val_len) { - mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0); + mpa_size = ntfs_get_size_for_mapping_pairs(g_vol, rl, 0); if (mpa_size < 0) { err = -errno; ntfs_log_error("Failed to get size for mapping " @@ -1583,7 +1577,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, for (i = 0, highest_vcn = 0LL; rl[i].length; i++) highest_vcn += rl[i].length; /* Does the value fit inside the allocated size? */ - if (highest_vcn * vol->cluster_size < val_len) { + if (highest_vcn * g_vol->cluster_size < val_len) { ntfs_log_error("BUG: Allocated size is smaller than data size!\n"); err = -EINVAL; goto err_out; @@ -1630,7 +1624,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, a->mapping_pairs_offset = cpu_to_le16(hdr_size + ((name_len + 7) & ~7)); memset(a->reserved1, 0, sizeof(a->reserved1)); /* FIXME: Allocated size depends on compression. */ - a->allocated_size = cpu_to_le64(highest_vcn * vol->cluster_size); + a->allocated_size = cpu_to_le64(highest_vcn * g_vol->cluster_size); a->data_size = cpu_to_le64(val_len); if (name_len) memcpy((char*)a + hdr_size, uname, name_len << 1); @@ -1650,10 +1644,10 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, err = -EOPNOTSUPP; } else { a->compression_unit = 0; - bw = ntfs_rlwrite(vol->dev, rl, val, val_len, &inited_size); + bw = ntfs_rlwrite(g_vol->dev, rl, val, val_len, &inited_size); if (bw != val_len) ntfs_log_error("Error writing non-resident attribute value.\n"); - err = ntfs_mapping_pairs_build(vol, (u8*)a + hdr_size + + err = ntfs_mapping_pairs_build(g_vol, (u8*)a + hdr_size + ((name_len + 7) & ~7), mpa_size, rl, 0, NULL); } a->initialized_size = cpu_to_le64(inited_size); @@ -1744,7 +1738,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, } if (val_len) { rl = allocate_scattered_clusters((val_len + - vol->cluster_size - 1) / vol->cluster_size); + g_vol->cluster_size - 1) / g_vol->cluster_size); if (!rl) { err = -errno; ntfs_log_perror("Failed to allocate scattered clusters"); @@ -1764,7 +1758,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, } else { hdr_size = 64; if (val_len) { - mpa_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0); + mpa_size = ntfs_get_size_for_mapping_pairs(g_vol, rl, 0); if (mpa_size < 0) { err = -errno; ntfs_log_error("Failed to get size for mapping " @@ -1821,8 +1815,8 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, a->mapping_pairs_offset = cpu_to_le16(hdr_size + ((name_len + 7) & ~7)); memset(a->reserved1, 0, sizeof(a->reserved1)); /* FIXME: Allocated size depends on compression. */ - a->allocated_size = cpu_to_le64((val_len + (vol->cluster_size - 1)) & - ~(vol->cluster_size - 1)); + a->allocated_size = cpu_to_le64((val_len + (g_vol->cluster_size - 1)) & + ~(g_vol->cluster_size - 1)); a->data_size = cpu_to_le64(val_len); a->initialized_size = cpu_to_le64(val_len); if (name_len) @@ -1842,10 +1836,10 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, err = -EOPNOTSUPP; } else { a->compression_unit = 0; - bw = ntfs_rlwrite(vol->dev, rl, val, val_len, NULL); + bw = ntfs_rlwrite(g_vol->dev, rl, val, val_len, NULL); if (bw != val_len) ntfs_log_error("Error writing non-resident attribute value.\n"); - err = ntfs_mapping_pairs_build(vol, (u8*)a + hdr_size + + err = ntfs_mapping_pairs_build(g_vol, (u8*)a + hdr_size + ((name_len + 7) & ~7), mpa_size, rl, 0, NULL); } if (err < 0 || bw != val_len) { @@ -1996,7 +1990,7 @@ static int add_attr_std_info(MFT_RECORD *m, const FILE_ATTR_FLAGS flags, si.last_mft_change_time = si.creation_time; si.last_access_time = si.creation_time; si.file_attributes = flags; /* already LE */ - if (vol->major_ver < 3) { + if (g_vol->major_ver < 3) { memset(&si.reserved12, 0, sizeof(si.reserved12)); } else { si.maximum_versions = cpu_to_le32(0); @@ -2308,16 +2302,16 @@ static int add_attr_index_root(MFT_RECORD *m, const char *name, } r->collation_rule = collation_rule; r->index_block_size = cpu_to_le32(index_block_size); - if (index_block_size >= vol->cluster_size) { - if (index_block_size % vol->cluster_size) { + if (index_block_size >= g_vol->cluster_size) { + if (index_block_size % g_vol->cluster_size) { ntfs_log_error("add_attr_index_root: index block size is not " "a multiple of the cluster size.\n"); free(r); return -EINVAL; } r->clusters_per_index_block = index_block_size / - vol->cluster_size; - } else { /* if (vol->cluster_size > index_block_size) */ + g_vol->cluster_size; + } else { /* if (g_vol->cluster_size > index_block_size) */ if (index_block_size & (index_block_size - 1)) { ntfs_log_error("add_attr_index_root: index block size is not " "a power of 2.\n"); @@ -2743,7 +2737,7 @@ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, err = 0; /* does it fit ?*/ - if (vol->mft_record_size > idx_size + m->bytes_allocated) + if (g_vol->mft_record_size > idx_size + m->bytes_allocated) return -ENOSPC; /* find the INDEX_ROOT attribute:*/ @@ -2779,7 +2773,7 @@ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, i = ntfs_file_values_compare( (FILE_NAME_ATTR*)&idx->key.file_name, (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, - IGNORE_CASE, vol->upcase, vol->upcase_len); + IGNORE_CASE, g_vol->upcase, g_vol->upcase_len); /* * If @file_name collates before ie->key.file_name, * there is no matching index entry. @@ -2798,7 +2792,7 @@ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, i = ntfs_file_values_compare((FILE_NAME_ATTR*)&idx-> key.file_name, (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, - CASE_SENSITIVE, vol->upcase, vol->upcase_len); + CASE_SENSITIVE, g_vol->upcase, g_vol->upcase_len); if (i == -1) break; /* Complete match. Bugger. Can't insert. */ @@ -2828,7 +2822,7 @@ do_next: } memmove((char*)idx_entry + idx_size, (char*)idx_entry, - (char*)m + vol->mft_record_size - + (char*)m + g_vol->mft_record_size - ((char*)idx_entry + idx_size)); memcpy((char*)idx_entry, (char*)idx, idx_size); /* adjusting various offsets etc... */ @@ -2984,7 +2978,7 @@ static int initialize_quota(MFT_RECORD *m) + idx_entry_q1->data_offset); idx_entry_q1_data->version = cpu_to_le32(0x02); idx_entry_q1_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; - if (vol->minor_ver == 0) + if (g_vol->minor_ver == 0) idx_entry_q1_data->flags |= QUOTA_FLAG_OUT_OF_DATE; idx_entry_q1_data->bytes_used = cpu_to_le64(0x00); idx_entry_q1_data->change_time = utc2ntfs(time(NULL)); @@ -3144,7 +3138,7 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, #endif i = ntfs_file_values_compare(file_name, (FILE_NAME_ATTR*)&ie->key.file_name, 1, - IGNORE_CASE, vol->upcase, vol->upcase_len); + IGNORE_CASE, g_vol->upcase, g_vol->upcase_len); /* * If @file_name collates before ie->key.file_name, there is no * matching index entry. @@ -3168,7 +3162,7 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, return -EEXIST; i = ntfs_file_values_compare(file_name, (FILE_NAME_ATTR*)&ie->key.file_name, 1, - CASE_SENSITIVE, vol->upcase, vol->upcase_len); + CASE_SENSITIVE, g_vol->upcase, g_vol->upcase_len); if (i == -1) break; /* Complete match. Bugger. Can't insert. */ @@ -3421,10 +3415,10 @@ static void init_options(void) opts.sectors_per_track = -1; opts.heads = -1; opts.part_start_sect = -1; - opts.index_block_size = 4096; - opts.attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; - opts.attr_defs_len = sizeof(attrdef_ntfs12_array); - /* ntfs_log_debug("Attr_defs table length = %u\n", opts.attr_defs_len); */ + g_index_block_size = 4096; + g_attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; + g_attr_defs_len = sizeof(attrdef_ntfs12_array); + /* ntfs_log_debug("Attr_defs table length = %u\n", g_attr_defs_len); */ } /** @@ -3432,34 +3426,34 @@ static void init_options(void) */ static void mkntfs_exit(void) { - free(index_block); - free(buf_sds_init); - free(buf_sds); - free(buf); - free(buf2); - free(lcn_bitmap); - free(mft_bitmap); - free(rl_mft); - free(rl_mft_bmp); - free(rl_mftmirr); - free(rl_logfile); - free(rl_boot); - free(rl_bad); - free(rl_index); - free(opts.bad_blocks); - if ((opts.attr_defs != (const ATTR_DEF*)attrdef_ntfs12_array) && - (opts.attr_defs != (const ATTR_DEF*)attrdef_ntfs3x_array)) - free(opts.attr_defs); - if (!vol) + free(g_index_block); + free(g_buf_sds_init); + free(g_buf_sds); + free(g_buf); + free(g_buf2); + free(g_lcn_bitmap); + free(g_mft_bitmap); + free(g_rl_mft); + free(g_rl_mft_bmp); + free(g_rl_mftmirr); + free(g_rl_logfile); + free(g_rl_boot); + free(g_rl_bad); + free(g_rl_index); + free(g_bad_blocks); + if ((g_attr_defs != (const ATTR_DEF*)attrdef_ntfs12_array) && + (g_attr_defs != (const ATTR_DEF*)attrdef_ntfs3x_array)) + free(g_attr_defs); + if (!g_vol) return; - free(vol->upcase); - if (vol->dev) { - if (NDevOpen(vol->dev) && vol->dev->d_ops->close(vol->dev)) + free(g_vol->upcase); + if (g_vol->dev) { + if (NDevOpen(g_vol->dev) && g_vol->dev->d_ops->close(g_vol->dev)) ntfs_log_error("Warning: Could not close %s: %s\n", - vol->dev->d_name, strerror(errno)); - ntfs_device_free(vol->dev); + g_vol->dev->d_name, strerror(errno)); + ntfs_device_free(g_vol->dev); } - free(vol); + free(g_vol); } /** @@ -3477,7 +3471,7 @@ static void mkntfs_open_partition(void) * Allocate and initialize an ntfs device structure and attach it to * the volume. */ - if (!(vol->dev = ntfs_device_alloc(dev_name, 0, + if (!(g_vol->dev = ntfs_device_alloc(opts.dev_name, 0, &ntfs_device_default_io_ops, NULL))) err_exit("Could not allocate memory for internal buffer.\n"); /* Open the device for reading or reading and writing. */ @@ -3487,20 +3481,20 @@ static void mkntfs_open_partition(void) } else { i = O_RDWR; } - if (vol->dev->d_ops->open(vol->dev, i)) { + if (g_vol->dev->d_ops->open(g_vol->dev, i)) { if (errno == ENOENT) err_exit("The device doesn't exist; did you specify " "it correctly?\n"); - err_exit("Could not open %s: %s\n", vol->dev->d_name, + err_exit("Could not open %s: %s\n", g_vol->dev->d_name, strerror(errno)); } /* Verify we are dealing with a block device. */ - if (vol->dev->d_ops->stat(vol->dev, &sbuf)) { + if (g_vol->dev->d_ops->stat(g_vol->dev, &sbuf)) { err_exit("Error getting information about %s: %s\n", - vol->dev->d_name, strerror(errno)); + g_vol->dev->d_name, strerror(errno)); } if (!S_ISBLK(sbuf.st_mode)) { - ntfs_log_error("%s is not a block device.\n", vol->dev->d_name); + ntfs_log_error("%s is not a block device.\n", g_vol->dev->d_name); if (!opts.force) err_exit("Refusing to make a filesystem here!\n"); if (!opts.num_sectors) { @@ -3529,18 +3523,18 @@ static void mkntfs_open_partition(void) (SCSI_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 16 == 0)) { ntfs_log_error("%s is entire device, not just one partition.\n", - vol->dev->d_name); + g_vol->dev->d_name); if (!opts.force) err_exit("Refusing to make a filesystem here!\n"); ntfs_log_warning("mkntfs forced anyway.\n"); #endif } /* Make sure the file system is not mounted. */ - if (ntfs_check_if_mounted(vol->dev->d_name, &mnt_flags)) { + if (ntfs_check_if_mounted(g_vol->dev->d_name, &mnt_flags)) { ntfs_log_error("Failed to determine whether %s is mounted: %s\n", - vol->dev->d_name, strerror(errno)); + g_vol->dev->d_name, strerror(errno)); } else if (mnt_flags & NTFS_MF_MOUNTED) { - ntfs_log_error("%s is mounted.\n", vol->dev->d_name); + ntfs_log_error("%s is mounted.\n", g_vol->dev->d_name); if (!opts.force) err_exit("Refusing to make a filesystem here!\n"); ntfs_log_warning("mkntfs forced anyway. Hope /etc/mtab is " @@ -3562,7 +3556,7 @@ static void mkntfs_override_phys_params(void) #ifdef BLKSSZGET int _sect_size = 0; - if (vol->dev->d_ops->ioctl(vol->dev, BLKSSZGET, &_sect_size) + if (g_vol->dev->d_ops->ioctl(g_vol->dev, BLKSSZGET, &_sect_size) >= 0) { opts.sector_size = _sect_size; } else @@ -3571,7 +3565,7 @@ static void mkntfs_override_phys_params(void) ntfs_log_error("No sector size specified for %s and it could " "not be obtained automatically.\n" "Assuming sector size is 512 bytes.\n", - vol->dev->d_name); + g_vol->dev->d_name); opts.sector_size = 512; } } @@ -3581,15 +3575,15 @@ static void mkntfs_override_phys_params(void) err_exit("sector_size is invalid. It must be a power " "of two, and it must be\n greater or equal 256 and " "less than or equal 4096 bytes.\n"); - ntfs_log_debug("sector size = %i bytes\n", opts.sector_size); + ntfs_log_debug("sector size = %ld bytes\n", opts.sector_size); /* If user didn't specify the number of sectors, determine it now. */ if (!opts.num_sectors) { - opts.num_sectors = ntfs_device_size_get(vol->dev, + opts.num_sectors = ntfs_device_size_get(g_vol->dev, opts.sector_size); if (opts.num_sectors <= 0) err_exit("ntfs_device_size_get(%s) failed. Please " "specify it manually.\n", - vol->dev->d_name); + g_vol->dev->d_name); } ntfs_log_debug("number of sectors = %lld (0x%llx)\n", opts.num_sectors, opts.num_sectors); @@ -3605,14 +3599,14 @@ static void mkntfs_override_phys_params(void) /* If user didn't specify the partition start sector, determine it. */ if (opts.part_start_sect < 0) { opts.part_start_sect = ntfs_device_partition_start_sector_get( - vol->dev); + g_vol->dev); if (opts.part_start_sect < 0) { ntfs_log_error("No partition start sector specified for %s " "and it could not\nbe obtained " "automatically. Setting it to 0.\n" "This will cause Windows not to be " "able to boot from this volume.\n", - vol->dev->d_name); + g_vol->dev->d_name); opts.part_start_sect = 0; } else if (opts.part_start_sect >> 32) { ntfs_log_error("No partition start sector specified for %s " @@ -3620,7 +3614,7 @@ static void mkntfs_override_phys_params(void) "value is too large. Setting it to 0." " This will cause Windows not\nto be " "able to boot from this volume.\n", - vol->dev->d_name); + g_vol->dev->d_name); opts.part_start_sect = 0; } } else if (opts.part_start_sect >> 32) { @@ -3631,14 +3625,14 @@ static void mkntfs_override_phys_params(void) /* If user didn't specify the sectors per track, determine it now. */ if (opts.sectors_per_track < 0) { opts.sectors_per_track = - ntfs_device_sectors_per_track_get(vol->dev); + ntfs_device_sectors_per_track_get(g_vol->dev); if (opts.sectors_per_track < 0) { ntfs_log_error("No number of sectors per track specified for " "%s and\nit could not be obtained " "automatically. Setting it to 0. " "This will cause\nWindows not to be " "able to boot from this volume.\n", - vol->dev->d_name); + g_vol->dev->d_name); opts.sectors_per_track = 0; } else if (opts.sectors_per_track > 0xffff) { ntfs_log_error("No number of sectors per track specified for " @@ -3646,23 +3640,23 @@ static void mkntfs_override_phys_params(void) "value is too large. Setting it to 0." " This will cause Windows not\nto be " "able to boot from this volume.\n", - vol->dev->d_name); + g_vol->dev->d_name); opts.sectors_per_track = 0; } } else if (opts.sectors_per_track > 0xffff) { - err_exit("Invalid number of sectors per track specified: %i " + err_exit("Invalid number of sectors per track specified: %ld " "Maximum is 65535 (0xffff).\n", opts.sectors_per_track); } /* If user didn't specify the number of heads, determine it now. */ if (opts.heads < 0) { - opts.heads = ntfs_device_heads_get(vol->dev); + opts.heads = ntfs_device_heads_get(g_vol->dev); if (opts.heads < 0) { ntfs_log_error("No number of heads specified for %s and it " "could not\nbe obtained automatically." " Setting it to 0. This will cause " "Windows not to\nbe able to boot from " - "this volume.\n", vol->dev->d_name); + "this volume.\n", g_vol->dev->d_name); opts.heads = 0; } else if (opts.heads > 0xffff) { ntfs_log_error("No number of heads specified for %s and the " @@ -3670,62 +3664,62 @@ static void mkntfs_override_phys_params(void) "too large. Setting it to 0. This " "will cause Windows not\nto be able " "to boot from this volume.\n", - vol->dev->d_name); + g_vol->dev->d_name); opts.heads = 0; } } else if (opts.heads > 0xffff) { - err_exit("Invalid number of heads specified: %i Maximum is " + err_exit("Invalid number of heads specified: %ld Maximum is " "65535 (0xffff).\n", opts.heads); } /* If user didn't specify the volume size, determine it now. */ - if (!opts.volume_size) - opts.volume_size = opts.num_sectors * opts.sector_size; - else if (opts.volume_size & (opts.sector_size - 1)) + if (!g_volume_size) + g_volume_size = opts.num_sectors * opts.sector_size; + else if (g_volume_size & (opts.sector_size - 1)) err_exit("volume_size is not a multiple of sector_size.\n"); /* Validate volume size. */ - if (opts.volume_size < 1 << 20 /* 1MiB */) + if (g_volume_size < 1 << 20 /* 1MiB */) err_exit("Device is too small (%llikiB). Minimum NTFS volume " - "size is 1MiB.\n", opts.volume_size / 1024); - ntfs_log_debug("volume size = %llikiB\n", opts.volume_size / 1024); + "size is 1MiB.\n", g_volume_size / 1024); + ntfs_log_debug("volume size = %llikiB\n", g_volume_size / 1024); /* If user didn't specify the cluster size, determine it now. */ - if (!vol->cluster_size) { - if (opts.volume_size <= 512LL << 20) /* <= 512MB */ - vol->cluster_size = 512; - else if (opts.volume_size <= 1LL << 30) /* ]512MB-1GB] */ - vol->cluster_size = 1024; - else if (opts.volume_size <= 2LL << 30) /* ]1GB-2GB] */ - vol->cluster_size = 2048; + if (!g_vol->cluster_size) { + if (g_volume_size <= 512LL << 20) /* <= 512MB */ + g_vol->cluster_size = 512; + else if (g_volume_size <= 1LL << 30) /* ]512MB-1GB] */ + g_vol->cluster_size = 1024; + else if (g_volume_size <= 2LL << 30) /* ]1GB-2GB] */ + g_vol->cluster_size = 2048; else - vol->cluster_size = 4096; + g_vol->cluster_size = 4096; /* For small volumes on devices with large sector sizes. */ - if (vol->cluster_size < (u32)opts.sector_size) - vol->cluster_size = opts.sector_size; + if (g_vol->cluster_size < (u32)opts.sector_size) + g_vol->cluster_size = opts.sector_size; /* * For huge volumes, grow the cluster size until the number of * clusters fits into 32 bits or the cluster size exceeds the * maximum limit of 64kiB. */ - while (opts.volume_size >> (ffs(vol->cluster_size) - 1 + 32)) { - vol->cluster_size <<= 1; - if (vol->cluster_size > 65536) + while (g_volume_size >> (ffs(g_vol->cluster_size) - 1 + 32)) { + g_vol->cluster_size <<= 1; + if (g_vol->cluster_size > 65536) err_exit("Device is too large to hold an NTFS " "volume (maximum size is " "256TiB).\n"); } } /* Validate cluster size. */ - if (vol->cluster_size & (vol->cluster_size - 1) || - vol->cluster_size < (u32)opts.sector_size || - vol->cluster_size > 128 * (u32)opts.sector_size || - vol->cluster_size > 65536) + if (g_vol->cluster_size & (g_vol->cluster_size - 1) || + g_vol->cluster_size < (u32)opts.sector_size || + g_vol->cluster_size > 128 * (u32)opts.sector_size || + g_vol->cluster_size > 65536) err_exit("Cluster_size is invalid. It must be a power of two, " "be at least\nthe same as sector_size, be maximum " "64kiB, and the sectors per cluster value has\n" "to fit inside eight bits. (We do not support larger " "cluster sizes yet.)\n"); - vol->cluster_size_bits = ffs(vol->cluster_size) - 1; - ntfs_log_debug("cluster size = %u bytes\n", (unsigned int)vol->cluster_size); - if (vol->cluster_size > 4096) { + g_vol->cluster_size_bits = ffs(g_vol->cluster_size) - 1; + ntfs_log_debug("cluster size = %u bytes\n", (unsigned int)g_vol->cluster_size); + if (g_vol->cluster_size > 4096) { if (opts.enable_compression) { if (!opts.force) err_exit("Cluster_size is above 4096 bytes " @@ -3743,24 +3737,24 @@ static void mkntfs_override_phys_params(void) "by Windows.\n"); } /* If user didn't specify the number of clusters, determine it now. */ - if (!opts.num_clusters) - opts.num_clusters = opts.volume_size / vol->cluster_size; + if (!g_num_clusters) + g_num_clusters = g_volume_size / g_vol->cluster_size; /* * Check the cluster_size and num_sectors for consistency with * sector_size and num_sectors. And check both of these for consistency * with volume_size. */ - if (opts.num_clusters != (opts.num_sectors * opts.sector_size) / - vol->cluster_size || - opts.volume_size / opts.sector_size != opts.num_sectors || - opts.volume_size / vol->cluster_size != opts.num_clusters) + if (g_num_clusters != (opts.num_sectors * opts.sector_size) / + g_vol->cluster_size || + g_volume_size / opts.sector_size != opts.num_sectors || + g_volume_size / g_vol->cluster_size != g_num_clusters) err_exit("Illegal combination of volume/cluster/sector size " "and/or cluster/sector number.\n"); - ntfs_log_debug("number of clusters = %llu (0x%llx)\n", opts.num_clusters, - opts.num_clusters); + ntfs_log_debug("number of clusters = %llu (0x%llx)\n", g_num_clusters, + g_num_clusters); /* Number of clusters must fit within 32 bits (Win2k limitation). */ - if (opts.num_clusters >> 32) { - if (vol->cluster_size >= 65536) + if (g_num_clusters >> 32) { + if (g_vol->cluster_size >= 65536) err_exit("Device is too large to hold an NTFS volume " "(maximum size is 256TiB).\n"); err_exit("Number of clusters exceeds 32 bits. Please try " @@ -3781,59 +3775,59 @@ static void mkntfs_initialize_bitmaps(void) int i, j; /* Determine lcn bitmap byte size and allocate it. */ - lcn_bitmap_byte_size = (opts.num_clusters + 7) >> 3; + g_lcn_bitmap_byte_size = (g_num_clusters + 7) >> 3; /* Needs to be multiple of 8 bytes. */ - lcn_bitmap_byte_size = (lcn_bitmap_byte_size + 7) & ~7; - i = (lcn_bitmap_byte_size + vol->cluster_size - 1) & - ~(vol->cluster_size - 1); - ntfs_log_debug("lcn_bitmap_byte_size = %i, allocated = %i\n", - lcn_bitmap_byte_size, i); - lcn_bitmap = calloc(1, lcn_bitmap_byte_size); - if (!lcn_bitmap) + g_lcn_bitmap_byte_size = (g_lcn_bitmap_byte_size + 7) & ~7; + i = (g_lcn_bitmap_byte_size + g_vol->cluster_size - 1) & + ~(g_vol->cluster_size - 1); + ntfs_log_debug("g_lcn_bitmap_byte_size = %i, allocated = %i\n", + g_lcn_bitmap_byte_size, i); + g_lcn_bitmap = calloc(1, g_lcn_bitmap_byte_size); + if (!g_lcn_bitmap) err_exit("Failed to allocate internal buffer: %s", strerror(errno)); /* * $Bitmap can overlap the end of the volume. Any bits in this region * must be set. This region also encompasses the backup boot sector. */ - for (i = opts.num_clusters; i < lcn_bitmap_byte_size << 3; i++) - ntfs_bit_set(lcn_bitmap, (u64)i, 1); + for (i = g_num_clusters; i < g_lcn_bitmap_byte_size << 3; i++) + ntfs_bit_set(g_lcn_bitmap, (u64)i, 1); /* * Determine mft_size: (16 (1.2) or 27 (3.0+) mft records) */ - opts.mft_size = ((16 + 11 * (vol->major_ver >= 3)) * - vol->mft_record_size); - ntfs_log_debug("MFT size = %i (0x%x) bytes\n", opts.mft_size, opts.mft_size); + g_mft_size = ((16 + 11 * (g_vol->major_ver >= 3)) * + g_vol->mft_record_size); + ntfs_log_debug("MFT size = %i (0x%x) bytes\n", g_mft_size, g_mft_size); /* Determine mft bitmap size and allocate it. */ - mft_bitmap_size = opts.mft_size / vol->mft_record_size; + g_mft_bitmap_size = g_mft_size / g_vol->mft_record_size; /* Convert to bytes, at least one. */ - mft_bitmap_byte_size = (mft_bitmap_size + 7) >> 3; + g_mft_bitmap_byte_size = (g_mft_bitmap_size + 7) >> 3; /* Mft bitmap is allocated in multiples of 8 bytes. */ - mft_bitmap_byte_size = (mft_bitmap_byte_size + 7) & ~7; - ntfs_log_debug("mft_bitmap_size = %i, mft_bitmap_byte_size = %i\n", - mft_bitmap_size, mft_bitmap_byte_size); - mft_bitmap = calloc(1, mft_bitmap_byte_size); - if (!mft_bitmap) + g_mft_bitmap_byte_size = (g_mft_bitmap_byte_size + 7) & ~7; + ntfs_log_debug("g_mft_bitmap_size = %i, g_mft_bitmap_byte_size = %i\n", + g_mft_bitmap_size, g_mft_bitmap_byte_size); + g_mft_bitmap = calloc(1, g_mft_bitmap_byte_size); + if (!g_mft_bitmap) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); /* Create runlist for mft bitmap. */ - rl_mft_bmp = malloc(2 * sizeof(runlist)); - if (!rl_mft_bmp) + g_rl_mft_bmp = malloc(2 * sizeof(runlist)); + if (!g_rl_mft_bmp) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - rl_mft_bmp[0].vcn = 0LL; + g_rl_mft_bmp[0].vcn = 0LL; /* Mft bitmap is right after $Boot's data. */ - j = (8192 + vol->cluster_size - 1) / vol->cluster_size; - rl_mft_bmp[0].lcn = j; + j = (8192 + g_vol->cluster_size - 1) / g_vol->cluster_size; + g_rl_mft_bmp[0].lcn = j; /* * Size is always one cluster, even though valid data size and * initialized data size are only 8 bytes. */ - rl_mft_bmp[1].vcn = rl_mft_bmp[0].length = 1LL; - rl_mft_bmp[1].lcn = -1LL; - rl_mft_bmp[1].length = 0LL; + g_rl_mft_bmp[1].vcn = g_rl_mft_bmp[0].length = 1LL; + g_rl_mft_bmp[1].lcn = -1LL; + g_rl_mft_bmp[1].length = 0LL; /* Allocate cluster for mft bitmap. */ - ntfs_bit_set(lcn_bitmap, (s64)j, 1); + ntfs_bit_set(g_lcn_bitmap, (s64)j, 1); } /** @@ -3846,67 +3840,67 @@ static void mkntfs_initialize_rl_mft(void) int i, j; /* If user didn't specify the mft lcn, determine it now. */ - if (!opts.mft_lcn) { + if (!g_mft_lcn) { /* * We start at the higher value out of 16kiB and just after the * mft bitmap. */ - opts.mft_lcn = rl_mft_bmp[0].lcn + rl_mft_bmp[0].length; - if (opts.mft_lcn * vol->cluster_size < 16 * 1024) - opts.mft_lcn = (16 * 1024 + vol->cluster_size - 1) / - vol->cluster_size; + g_mft_lcn = g_rl_mft_bmp[0].lcn + g_rl_mft_bmp[0].length; + if (g_mft_lcn * g_vol->cluster_size < 16 * 1024) + g_mft_lcn = (16 * 1024 + g_vol->cluster_size - 1) / + g_vol->cluster_size; } - ntfs_log_debug("$MFT logical cluster number = 0x%llx\n", opts.mft_lcn); + ntfs_log_debug("$MFT logical cluster number = 0x%llx\n", g_mft_lcn); /* Determine MFT zone size. */ - opts.mft_zone_end = opts.num_clusters; + g_mft_zone_end = g_num_clusters; switch (opts.mft_zone_multiplier) { /* % of volume size in clusters */ case 4: - opts.mft_zone_end = opts.mft_zone_end >> 1; /* 50% */ + g_mft_zone_end = g_mft_zone_end >> 1; /* 50% */ break; case 3: - opts.mft_zone_end = opts.mft_zone_end * 3 >> 3; /* 37.5% */ + g_mft_zone_end = g_mft_zone_end * 3 >> 3; /* 37.5% */ break; case 2: - opts.mft_zone_end = opts.mft_zone_end >> 2; /* 25% */ + g_mft_zone_end = g_mft_zone_end >> 2; /* 25% */ break; case 1: default: - opts.mft_zone_end = opts.mft_zone_end >> 3; /* 12.5% */ + g_mft_zone_end = g_mft_zone_end >> 3; /* 12.5% */ break; } - ntfs_log_debug("MFT zone size = %lldkiB\n", opts.mft_zone_end / 1024); + ntfs_log_debug("MFT zone size = %lldkiB\n", g_mft_zone_end / 1024); /* * The mft zone begins with the mft data attribute, not at the beginning * of the device. */ - opts.mft_zone_end += opts.mft_lcn; + g_mft_zone_end += g_mft_lcn; /* Create runlist for mft. */ - rl_mft = malloc(2 * sizeof(runlist)); - if (!rl_mft) + g_rl_mft = malloc(2 * sizeof(runlist)); + if (!g_rl_mft) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - rl_mft[0].vcn = 0LL; - rl_mft[0].lcn = opts.mft_lcn; + g_rl_mft[0].vcn = 0LL; + g_rl_mft[0].lcn = g_mft_lcn; /* rounded up division by cluster size */ - j = (opts.mft_size + vol->cluster_size - 1) / vol->cluster_size; - rl_mft[1].vcn = rl_mft[0].length = j; - rl_mft[1].lcn = -1LL; - rl_mft[1].length = 0LL; + j = (g_mft_size + g_vol->cluster_size - 1) / g_vol->cluster_size; + g_rl_mft[1].vcn = g_rl_mft[0].length = j; + g_rl_mft[1].lcn = -1LL; + g_rl_mft[1].length = 0LL; /* Allocate clusters for mft. */ for (i = 0; i < j; i++) - ntfs_bit_set(lcn_bitmap, opts.mft_lcn + i, 1); + ntfs_bit_set(g_lcn_bitmap, g_mft_lcn + i, 1); /* Determine mftmirr_lcn (middle of volume). */ - opts.mftmirr_lcn = (opts.num_sectors * opts.sector_size >> 1) - / vol->cluster_size; + g_mftmirr_lcn = (opts.num_sectors * opts.sector_size >> 1) + / g_vol->cluster_size; ntfs_log_debug("$MFTMirr logical cluster number = 0x%llx\n", - opts.mftmirr_lcn); + g_mftmirr_lcn); /* Create runlist for mft mirror. */ - rl_mftmirr = malloc(2 * sizeof(runlist)); - if (!rl_mftmirr) + g_rl_mftmirr = malloc(2 * sizeof(runlist)); + if (!g_rl_mftmirr) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - rl_mftmirr[0].vcn = 0LL; - rl_mftmirr[0].lcn = opts.mftmirr_lcn; + g_rl_mftmirr[0].vcn = 0LL; + g_rl_mftmirr[0].lcn = g_mftmirr_lcn; /* * The mft mirror is either 4kb (the first four records) or one cluster * in size, which ever is bigger. In either case, it contains a @@ -3914,16 +3908,16 @@ static void mkntfs_initialize_rl_mft(void) * the first four records (4kb) or the first cluster worth of records, * whichever is bigger). */ - j = (4 * vol->mft_record_size + vol->cluster_size - 1) / vol->cluster_size; - rl_mftmirr[1].vcn = rl_mftmirr[0].length = j; - rl_mftmirr[1].lcn = -1LL; - rl_mftmirr[1].length = 0LL; + j = (4 * g_vol->mft_record_size + g_vol->cluster_size - 1) / g_vol->cluster_size; + g_rl_mftmirr[1].vcn = g_rl_mftmirr[0].length = j; + g_rl_mftmirr[1].lcn = -1LL; + g_rl_mftmirr[1].length = 0LL; /* Allocate clusters for mft mirror. */ for (i = 0; i < j; i++) - ntfs_bit_set(lcn_bitmap, opts.mftmirr_lcn + i, 1); - opts.logfile_lcn = opts.mftmirr_lcn + j; + ntfs_bit_set(g_lcn_bitmap, g_mftmirr_lcn + i, 1); + g_logfile_lcn = g_mftmirr_lcn + j; ntfs_log_debug("$LogFile logical cluster number = 0x%llx\n", - opts.logfile_lcn); + g_logfile_lcn); } /** @@ -3936,55 +3930,55 @@ static void mkntfs_initialize_rl_logfile(void) int i, j; /* Create runlist for log file. */ - rl_logfile = malloc(2 * sizeof(runlist)); - if (!rl_logfile) + g_rl_logfile = malloc(2 * sizeof(runlist)); + if (!g_rl_logfile) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - rl_logfile[0].vcn = 0LL; - rl_logfile[0].lcn = opts.logfile_lcn; + g_rl_logfile[0].vcn = 0LL; + g_rl_logfile[0].lcn = g_logfile_lcn; /* * Determine logfile_size from volume_size (rounded up to a cluster), * making sure it does not overflow the end of the volume. */ - if (opts.volume_size < 2048LL * 1024) /* < 2MiB */ - opts.logfile_size = 256LL * 1024; /* -> 256kiB */ - else if (opts.volume_size < 4000000LL) /* < 4MB */ - opts.logfile_size = 512LL * 1024; /* -> 512kiB */ - else if (opts.volume_size <= 200LL * 1024 * 1024)/* < 200MiB */ - opts.logfile_size = 2048LL * 1024; /* -> 2MiB */ - else if (opts.volume_size >= 400LL << 20) /* > 400MiB */ - opts.logfile_size = 4 << 20; /* -> 4MiB */ + if (g_volume_size < 2048LL * 1024) /* < 2MiB */ + g_logfile_size = 256LL * 1024; /* -> 256kiB */ + else if (g_volume_size < 4000000LL) /* < 4MB */ + g_logfile_size = 512LL * 1024; /* -> 512kiB */ + else if (g_volume_size <= 200LL * 1024 * 1024)/* < 200MiB */ + g_logfile_size = 2048LL * 1024; /* -> 2MiB */ + else if (g_volume_size >= 400LL << 20) /* > 400MiB */ + g_logfile_size = 4 << 20; /* -> 4MiB */ else - opts.logfile_size = (opts.volume_size / 100) & - ~(vol->cluster_size - 1); - j = opts.logfile_size / vol->cluster_size; - while (rl_logfile[0].lcn + j >= opts.num_clusters) { + g_logfile_size = (g_volume_size / 100) & + ~(g_vol->cluster_size - 1); + j = g_logfile_size / g_vol->cluster_size; + while (g_rl_logfile[0].lcn + j >= g_num_clusters) { /* * $Logfile would overflow volume. Need to make it smaller than * the standard size. It's ok as we are creating a non-standard * volume anyway if it is that small. */ - opts.logfile_size >>= 1; - j = opts.logfile_size / vol->cluster_size; + g_logfile_size >>= 1; + j = g_logfile_size / g_vol->cluster_size; } - opts.logfile_size = (opts.logfile_size + vol->cluster_size - 1) & - ~(vol->cluster_size - 1); + g_logfile_size = (g_logfile_size + g_vol->cluster_size - 1) & + ~(g_vol->cluster_size - 1); ntfs_log_debug("$LogFile (journal) size = %ikiB\n", - opts.logfile_size / 1024); + g_logfile_size / 1024); /* * FIXME: The 256kiB limit is arbitrary. Should find out what the real * minimum requirement for Windows is so it doesn't blue screen. */ - if (opts.logfile_size < 256 << 10) + if (g_logfile_size < 256 << 10) err_exit("$LogFile would be created with invalid size. This " "is not allowed as it would cause Windows to " "blue screen and during boot.\n"); - rl_logfile[1].vcn = rl_logfile[0].length = j; - rl_logfile[1].lcn = -1LL; - rl_logfile[1].length = 0LL; + g_rl_logfile[1].vcn = g_rl_logfile[0].length = j; + g_rl_logfile[1].lcn = -1LL; + g_rl_logfile[1].length = 0LL; /* Allocate clusters for log file. */ for (i = 0; i < j; i++) - ntfs_bit_set(lcn_bitmap, opts.logfile_lcn + i, 1); + ntfs_bit_set(g_lcn_bitmap, g_logfile_lcn + i, 1); } /** @@ -3996,23 +3990,23 @@ static void mkntfs_initialize_rl_boot(void) { int i, j; /* Create runlist for $Boot. */ - rl_boot = malloc(2 * sizeof(runlist)); - if (!rl_boot) + g_rl_boot = malloc(2 * sizeof(runlist)); + if (!g_rl_boot) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - rl_boot[0].vcn = 0LL; - rl_boot[0].lcn = 0LL; + g_rl_boot[0].vcn = 0LL; + g_rl_boot[0].lcn = 0LL; /* * $Boot is always 8192 (0x2000) bytes or 1 cluster, whichever is * bigger. */ - j = (8192 + vol->cluster_size - 1) / vol->cluster_size; - rl_boot[1].vcn = rl_boot[0].length = j; - rl_boot[1].lcn = -1LL; - rl_boot[1].length = 0LL; + j = (8192 + g_vol->cluster_size - 1) / g_vol->cluster_size; + g_rl_boot[1].vcn = g_rl_boot[0].length = j; + g_rl_boot[1].lcn = -1LL; + g_rl_boot[1].length = 0LL; /* Allocate clusters for $Boot. */ for (i = 0; i < j; i++) - ntfs_bit_set(lcn_bitmap, 0LL + i, 1); + ntfs_bit_set(g_lcn_bitmap, 0LL + i, 1); } /** @@ -4023,19 +4017,19 @@ static void mkntfs_initialize_rl_boot(void) static void mkntfs_initialize_rl_bad(void) { /* Create runlist for $BadClus, $DATA named stream $Bad. */ - rl_bad = malloc(2 * sizeof(runlist)); - if (!rl_bad) + g_rl_bad = malloc(2 * sizeof(runlist)); + if (!g_rl_bad) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - rl_bad[0].vcn = 0LL; - rl_bad[0].lcn = -1LL; + g_rl_bad[0].vcn = 0LL; + g_rl_bad[0].lcn = -1LL; /* * $BadClus named stream $Bad contains the whole volume as a single * sparse runlist entry. */ - rl_bad[1].vcn = rl_bad[0].length = opts.num_clusters; - rl_bad[1].lcn = -1LL; - rl_bad[1].length = 0LL; + g_rl_bad[1].vcn = g_rl_bad[0].length = g_num_clusters; + g_rl_bad[1].lcn = -1LL; + g_rl_bad[1].length = 0LL; /* TODO: Mark bad blocks as such. */ } @@ -4054,20 +4048,20 @@ static void mkntfs_fill_device_with_zeroes(void) int i; ssize_t bw; unsigned long long position, mid_clust; - float progress_inc = (float)opts.num_clusters / 100; + float progress_inc = (float)g_num_clusters / 100; ntfs_log_quiet("Initialising device with zeroes: 0%%"); fflush(stdout); - mid_clust = (opts.volume_size >> 1) / vol->cluster_size; - for (position = 0; position < (unsigned long long)opts.num_clusters; + mid_clust = (g_volume_size >> 1) / g_vol->cluster_size; + for (position = 0; position < (unsigned long long)g_num_clusters; position++) { if (!(position % (int)(progress_inc+1))) { ntfs_log_quiet("\b\b\b\b%3.0f%%", position / progress_inc); fflush(stdout); } - bw = mkntfs_write(vol->dev, buf, vol->cluster_size); - if (bw != (ssize_t)vol->cluster_size) { + bw = mkntfs_write(g_vol->dev, g_buf, g_vol->cluster_size); + if (bw != (ssize_t)g_vol->cluster_size) { if (bw != -1 || errno != EIO) err_exit("This should not happen.\n"); if (!position) @@ -4075,9 +4069,9 @@ static void mkntfs_fill_device_with_zeroes(void) "Cannot create NTFS file " "system.\n"); if (position == mid_clust && - (vol->major_ver < 1 || - (vol->major_ver == 1 && - vol->minor_ver < 2))) + (g_vol->major_ver < 1 || + (g_vol->major_ver == 1 && + g_vol->minor_ver < 2))) err_exit("Error: Bad cluster found in " "location reserved for system " "file $Boot.\n"); @@ -4088,28 +4082,28 @@ static void mkntfs_fill_device_with_zeroes(void) "device with zeroes: %3.0f%%", position, position / progress_inc); /* Seek to next cluster. */ - vol->dev->d_ops->seek(vol->dev, + g_vol->dev->d_ops->seek(g_vol->dev, ((off_t)position + 1) * - vol->cluster_size, SEEK_SET); + g_vol->cluster_size, SEEK_SET); } } ntfs_log_quiet("\b\b\b\b100%%"); - position = (opts.volume_size & (vol->cluster_size - 1)) / + position = (g_volume_size & (g_vol->cluster_size - 1)) / opts.sector_size; for (i = 0; (unsigned long)i < position; i++) { - bw = mkntfs_write(vol->dev, buf, opts.sector_size); + bw = mkntfs_write(g_vol->dev, g_buf, opts.sector_size); if (bw != opts.sector_size) { if (bw != -1 || errno != EIO) err_exit("This should not happen.\n"); else if (i + 1ull == position && - (vol->major_ver >= 2 || - (vol->major_ver == 1 && - vol->minor_ver >= 2))) + (g_vol->major_ver >= 2 || + (g_vol->major_ver == 1 && + g_vol->minor_ver >= 2))) err_exit("Error: Bad cluster found in " "location reserved for system " "file $Boot.\n"); /* Seek to next sector. */ - vol->dev->d_ops->seek(vol->dev, + g_vol->dev->d_ops->seek(g_vol->dev, opts.sector_size, SEEK_CUR); } } @@ -4142,8 +4136,8 @@ static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n"); } a = ctx->attr; - rl_index = ntfs_mapping_pairs_decompress(vol, a, NULL); - if (!rl_index) { + g_rl_index = ntfs_mapping_pairs_decompress(g_vol, a, NULL); + if (!g_rl_index) { ntfs_attr_put_search_ctx(ctx); err_exit("Failed to decompress runlist of $INDEX_ALLOCATION " "attribute.\n"); @@ -4159,7 +4153,7 @@ static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, if (err) err_exit("ntfs_mst_pre_write_fixup() failed while " "syncing index block.\n"); - lw = ntfs_rlwrite(vol->dev, rl_index, (u8*)idx, i, NULL); + lw = ntfs_rlwrite(g_vol->dev, g_rl_index, (u8*)idx, i, NULL); if (lw != i) err_exit("Error writing $INDEX_ALLOCATION.\n"); /* No more changes to @idx below here so no need for fixup: */ @@ -4175,8 +4169,8 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) u8 *sd; ntfs_log_verbose("Creating $Volume (mft record 3)\n"); - m = (MFT_RECORD*)(buf + 3 * vol->mft_record_size); - err = create_hardlink(index_block, root_ref, m, + m = (MFT_RECORD*)(g_buf + 3 * g_vol->mft_record_size); + err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_Volume, FILE_Volume), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$Volume", FILE_NAME_WIN32_AND_DOS); @@ -4184,21 +4178,21 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) init_system_file_sd(FILE_Volume, &sd, &i); err = add_attr_sd(m, sd, i); } - if (!err && vol->major_ver>=3) { - volume_obj_id = calloc(1,0x10); - ntfs_generate_guid(&volume_obj_id->object_id); - err = add_attr_object_id(m, volume_obj_id, 0x10); + if (!err && g_vol->major_ver >= 3) { + g_volume_obj_id = calloc(1,0x10); + ntfs_generate_guid(&g_volume_obj_id->object_id); + err = add_attr_object_id(m, g_volume_obj_id, 0x10); } if (!err) err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); if (!err) - err = add_attr_vol_name(m, vol->vol_name, vol->vol_name ? - strlen(vol->vol_name) : 0); + err = add_attr_vol_name(m, g_vol->vol_name, g_vol->vol_name ? + strlen(g_vol->vol_name) : 0); if (!err) { if (fl & VOLUME_IS_DIRTY) ntfs_log_quiet("Setting the volume dirty so check disk runs " "on next reboot into Windows.\n"); - err = add_attr_vol_info(m, fl, vol->major_ver, vol->minor_ver); + err = add_attr_vol_info(m, fl, g_vol->major_ver, g_vol->minor_ver); } if (err < 0) err_exit("Couldn't create $Volume: %s\n", strerror(-err)); @@ -4211,9 +4205,9 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) */ static int create_backup_boot_sector(u8 *buff) { - const char *_s; + const char *s; ssize_t bw; - int size, _e; + int size, e; ntfs_log_verbose("Creating backup boot sector.\n"); /* @@ -4224,21 +4218,21 @@ static int create_backup_boot_sector(u8 *buff) size = 512; if (size < opts.sector_size) size = opts.sector_size; - if (vol->dev->d_ops->seek(vol->dev, (opts.num_sectors + 1) * + if (g_vol->dev->d_ops->seek(g_vol->dev, (opts.num_sectors + 1) * opts.sector_size - size, SEEK_SET) == (off_t)-1) goto bb_err; if (size > 8192) size = 8192; - bw = mkntfs_write(vol->dev, buff, size); + bw = mkntfs_write(g_vol->dev, buff, size); if (bw == size) return 0; - _e = errno; + e = errno; if (bw == -1LL) - _s = strerror(_e); + s = strerror(e); else - _s = "unknown error"; - if (bw != -1LL || (bw == -1LL && _e != ENOSPC)) { - err_exit("Couldn't write backup boot sector: %s\n", _s); + s = "unknown error"; + if (bw != -1LL || (bw == -1LL && e != ENOSPC)) { + err_exit("Couldn't write backup boot sector: %s\n", s); bb_err: ntfs_log_perror("Seek failed"); } @@ -4276,14 +4270,14 @@ static void mkntfs_create_root_structures(void) * sequence numbers of each system file to equal the mft record number * of that file (only for $MFT is the sequence number 1 rather than 0). */ - for (i = 0; i < 16 + 11 * (vol->major_ver >= 3); i++) { - if (ntfs_mft_record_layout(vol, 0, m = (MFT_RECORD *)(buf + - i * vol->mft_record_size))) + for (i = 0; i < 16 + 11 * (g_vol->major_ver >= 3); i++) { + if (ntfs_mft_record_layout(g_vol, 0, m = (MFT_RECORD *)(g_buf + + i * g_vol->mft_record_size))) err_exit("Error: Failed to layout mft record.\n"); #if 0 if (!opts.quiet && opts.verbose > 1) - dump_mft_record((MFT_RECORD*)buf + - i * vol->mft_record_size); + dump_mft_record((MFT_RECORD*)g_buf + + i * g_vol->mft_record_size); #endif if (i > 0) @@ -4295,15 +4289,15 @@ static void mkntfs_create_root_structures(void) * Create the 16 system files, adding the system information attribute * to each as well as marking them in use in the mft bitmap. */ - for (i = 0; i < 16 + 11 * (vol->major_ver >= 3); i++) { + for (i = 0; i < 16 + 11 * (g_vol->major_ver >= 3); i++) { u32 file_attrs; - m = (MFT_RECORD*)(buf + i * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + i * g_vol->mft_record_size); if (i < 16 || i > 23) { - if (vol->major_ver >= 3 && vol->minor_ver >= 1) + if (g_vol->major_ver >= 3 && g_vol->minor_ver >= 1) m->mft_record_number = cpu_to_le32(i); m->flags |= MFT_RECORD_IN_USE; - ntfs_bit_set(mft_bitmap, 0LL + i, 1); + ntfs_bit_set(g_mft_bitmap, 0LL + i, 1); } file_attrs = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM; if (i == FILE_root) { @@ -4314,7 +4308,7 @@ static void mkntfs_create_root_structures(void) file_attrs |= FILE_ATTR_COMPRESSED; } - if (vol->major_ver < 3) { + if (g_vol->major_ver < 3) { add_attr_std_info(m, file_attrs, cpu_to_le32(0)); } else { @@ -4331,7 +4325,7 @@ static void mkntfs_create_root_structures(void) } else if (i == 11) { add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); - } else if (i ==24 || i == 25 || i == 26) { + } else if (i == 24 || i == 25 || i == 26) { file_attrs |= FILE_ATTR_ARCHIVE; file_attrs |= FILE_ATTR_DUP_VIEW_INDEX_PRESENT; add_attr_std_info(m, file_attrs, @@ -4346,7 +4340,7 @@ static void mkntfs_create_root_structures(void) root_ref = MK_LE_MREF(FILE_root, FILE_root); extend_ref = MK_LE_MREF(11,11); ntfs_log_verbose("Creating root directory (mft record 5)\n"); - m = (MFT_RECORD*)(buf + 5 * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + 5 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_DIRECTORY; m->link_count = cpu_to_le16(le16_to_cpu(m->link_count) + 1); err = add_attr_file_name(m, root_ref, 0LL, 0LL, @@ -4354,13 +4348,13 @@ static void mkntfs_create_root_structures(void) FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, ".", FILE_NAME_WIN32_AND_DOS); if (!err) { - if (vol->major_ver == 1) { + if (g_vol->major_ver == 1) { init_system_file_sd(FILE_root, &sd, &i); err = add_attr_sd(m, sd, i); - } else if (vol->major_ver == 3 && vol->minor_ver == 0) { + } else if (g_vol->major_ver == 3 && g_vol->minor_ver == 0) { init_system_file_sd(FILE_root, &sd, &i); err = add_attr_sd(m, sd, i); - } else if (vol->major_ver == 3 && vol->minor_ver == 1) { + } else if (g_vol->major_ver == 3 && g_vol->minor_ver == 1) { init_root_sd_31(&sd, &i); err = add_attr_sd(m, sd, i); } else { @@ -4370,10 +4364,10 @@ static void mkntfs_create_root_structures(void) /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, - COLLATION_FILE_NAME, opts.index_block_size); + COLLATION_FILE_NAME, g_index_block_size); /* FIXME: This should be IGNORE_CASE */ if (!err) - err = upgrade_to_large_index(m, "$I30", 4, 0, &index_block); + err = upgrade_to_large_index(m, "$I30", 4, 0, &g_index_block); if (!err) { ntfs_attr_search_ctx *ctx; ctx = ntfs_attr_get_search_ctx(NULL, m); @@ -4387,7 +4381,7 @@ static void mkntfs_create_root_structures(void) err_exit("BUG: $FILE_NAME attribute not found.\n"); } a = ctx->attr; - err = insert_file_link_in_dir_index(index_block, root_ref, + err = insert_file_link_in_dir_index(g_index_block, root_ref, (FILE_NAME_ATTR*)((char*)a + le16_to_cpu(a->value_offset)), le32_to_cpu(a->value_length)); @@ -4399,38 +4393,38 @@ static void mkntfs_create_root_structures(void) /* dump_mft_record(m); */ /* Add all other attributes, on a per-file basis for clarity. */ ntfs_log_verbose("Creating $MFT (mft record 0)\n"); - m = (MFT_RECORD*)buf; - err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mft, buf, - opts.mft_size); + m = (MFT_RECORD*)g_buf; + err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_mft, g_buf, + g_mft_size); if (!err) - err = create_hardlink(index_block, root_ref, m, - MK_LE_MREF(FILE_MFT, 1), opts.mft_size, - opts.mft_size, FILE_ATTR_HIDDEN | + err = create_hardlink(g_index_block, root_ref, m, + MK_LE_MREF(FILE_MFT, 1), g_mft_size, + g_mft_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$MFT", FILE_NAME_WIN32_AND_DOS); - if (!err && vol->major_ver == 1) { + if (!err && g_vol->major_ver == 1) { init_system_file_sd(FILE_MFT, &sd, &i); err = add_attr_sd(m, sd, i); } /* mft_bitmap is not modified in mkntfs; no need to sync it later. */ if (!err) - err = add_attr_bitmap_positioned(m, NULL, 0, 0, rl_mft_bmp, - mft_bitmap, mft_bitmap_byte_size); + err = add_attr_bitmap_positioned(m, NULL, 0, 0, g_rl_mft_bmp, + g_mft_bitmap, g_mft_bitmap_byte_size); if (err < 0) err_exit("Couldn't create $MFT: %s\n", strerror(-err)); /* dump_mft_record(m); */ ntfs_log_verbose("Creating $MFTMirr (mft record 1)\n"); - m = (MFT_RECORD*)(buf + 1 * vol->mft_record_size); - err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_mftmirr, buf, - rl_mftmirr[0].length * vol->cluster_size); + m = (MFT_RECORD*)(g_buf + 1 * g_vol->mft_record_size); + err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_mftmirr, g_buf, + g_rl_mftmirr[0].length * g_vol->cluster_size); if (!err) - err = create_hardlink(index_block, root_ref, m, + err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_MFTMirr, FILE_MFTMirr), - rl_mftmirr[0].length * vol->cluster_size, - rl_mftmirr[0].length * vol->cluster_size, + g_rl_mftmirr[0].length * g_vol->cluster_size, + g_rl_mftmirr[0].length * g_vol->cluster_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$MFTMirr", FILE_NAME_WIN32_AND_DOS); - if (!err && vol->major_ver == 1) { + if (!err && g_vol->major_ver == 1) { init_system_file_sd(FILE_MFTMirr, &sd, &i); err = add_attr_sd(m, sd, i); } @@ -4438,23 +4432,23 @@ static void mkntfs_create_root_structures(void) err_exit("Couldn't create $MFTMirr: %s\n", strerror(-err)); /* dump_mft_record(m); */ ntfs_log_verbose("Creating $LogFile (mft record 2)\n"); - m = (MFT_RECORD*)(buf + 2 * vol->mft_record_size); - buf2 = malloc(opts.logfile_size); - if (!buf2) + m = (MFT_RECORD*)(g_buf + 2 * g_vol->mft_record_size); + g_buf2 = malloc(g_logfile_size); + if (!g_buf2) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - memset(buf2, -1, opts.logfile_size); - err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_logfile, buf2, - opts.logfile_size); - free(buf2); - buf2 = NULL; + memset(g_buf2, -1, g_logfile_size); + err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_logfile, g_buf2, + g_logfile_size); + free(g_buf2); + g_buf2 = NULL; if (!err) - err = create_hardlink(index_block, root_ref, m, + err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_LogFile, FILE_LogFile), - opts.logfile_size, opts.logfile_size, + g_logfile_size, g_logfile_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$LogFile", FILE_NAME_WIN32_AND_DOS); - if (!err && vol->major_ver == 1) { + if (!err && g_vol->major_ver == 1) { init_system_file_sd(FILE_LogFile, &sd, &i); err = add_attr_sd(m, sd, i); } @@ -4463,27 +4457,27 @@ static void mkntfs_create_root_structures(void) /* dump_mft_record(m); */ ntfs_log_verbose("Creating $AttrDef (mft record 4)\n"); - m = (MFT_RECORD*)(buf + 4 * vol->mft_record_size); - if (vol->major_ver < 3) - buf2_size = 36000; + m = (MFT_RECORD*)(g_buf + 4 * g_vol->mft_record_size); + if (g_vol->major_ver < 3) + g_buf2_size = 36000; else - buf2_size = opts.attr_defs_len; - buf2 = calloc(1, buf2_size); - if (!buf2) + g_buf2_size = g_attr_defs_len; + g_buf2 = calloc(1, g_buf2_size); + if (!g_buf2) err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - memcpy(buf2, opts.attr_defs, opts.attr_defs_len); - err = add_attr_data(m, NULL, 0, 0, 0, buf2, buf2_size); - free(buf2); - buf2 = NULL; + strerror(errno)); + memcpy(g_buf2, g_attr_defs, g_attr_defs_len); + err = add_attr_data(m, NULL, 0, 0, 0, g_buf2, g_buf2_size); + free(g_buf2); + g_buf2 = NULL; if (!err) - err = create_hardlink(index_block, root_ref, m, + err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_AttrDef, FILE_AttrDef), - (buf2_size + vol->cluster_size - 1) & - ~(vol->cluster_size - 1), buf2_size, + (g_buf2_size + g_vol->cluster_size - 1) & + ~(g_vol->cluster_size - 1), g_buf2_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$AttrDef", FILE_NAME_WIN32_AND_DOS); - buf2_size = 0; + g_buf2_size = 0; if (!err) { init_system_file_sd(FILE_AttrDef, &sd, &i); err = add_attr_sd(m, sd, i); @@ -4492,23 +4486,23 @@ static void mkntfs_create_root_structures(void) err_exit("Couldn't create $AttrDef: %s\n", strerror(-err)); /* dump_mft_record(m); */ ntfs_log_verbose("Creating $Bitmap (mft record 6)\n"); - m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + 6 * g_vol->mft_record_size); /* the data attribute of $Bitmap must be non-resident or otherwise */ /* windows 2003 will regard the volume as corrupt (ERSO) */ if (!err) err = insert_non_resident_attr_in_mft_record(m, AT_DATA, NULL, 0, 0, 0, - lcn_bitmap, lcn_bitmap_byte_size); + g_lcn_bitmap, g_lcn_bitmap_byte_size); if (!err) - err = create_hardlink(index_block, root_ref, m, + err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_Bitmap, FILE_Bitmap), - (lcn_bitmap_byte_size + vol->cluster_size - 1) & - ~(vol->cluster_size - 1), lcn_bitmap_byte_size, + (g_lcn_bitmap_byte_size + g_vol->cluster_size - 1) & + ~(g_vol->cluster_size - 1), g_lcn_bitmap_byte_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$Bitmap", FILE_NAME_WIN32_AND_DOS); - if (!err && vol->major_ver == 1) { + if (!err && g_vol->major_ver == 1) { init_system_file_sd(FILE_Bitmap, &sd, &i); err = add_attr_sd(m, sd, i); } @@ -4516,27 +4510,27 @@ static void mkntfs_create_root_structures(void) err_exit("Couldn't create $Bitmap: %s\n", strerror(-err)); /* dump_mft_record(m); */ ntfs_log_verbose("Creating $Boot (mft record 7)\n"); - m = (MFT_RECORD*)(buf + 7 * vol->mft_record_size); - buf2 = calloc(1, 8192); - if (!buf2) + m = (MFT_RECORD*)(g_buf + 7 * g_vol->mft_record_size); + g_buf2 = calloc(1, 8192); + if (!g_buf2) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - memcpy(buf2, boot_array, sizeof(boot_array)); + memcpy(g_buf2, boot_array, sizeof(boot_array)); /* - * Create the boot sector in buf2. Note, that buf2 already is zeroed + * Create the boot sector in g_buf2. Note, that g_buf2 is already zeroed * in the boot sector section and that it has the NTFS OEM id/magic * already inserted, so no need to worry about these things. */ - bs = (NTFS_BOOT_SECTOR*)buf2; + bs = (NTFS_BOOT_SECTOR*)g_buf2; bs->bpb.bytes_per_sector = cpu_to_le16(opts.sector_size); - bs->bpb.sectors_per_cluster = (u8)(vol->cluster_size / + bs->bpb.sectors_per_cluster = (u8)(g_vol->cluster_size / opts.sector_size); bs->bpb.media_type = 0xf8; /* hard disk */ bs->bpb.sectors_per_track = cpu_to_le16(opts.sectors_per_track); - ntfs_log_debug("sectors per track = %u (0x%x)\n", opts.sectors_per_track, + ntfs_log_debug("sectors per track = %ld (0x%lx)\n", opts.sectors_per_track, opts.sectors_per_track); bs->bpb.heads = cpu_to_le16(opts.heads); - ntfs_log_debug("heads = %u (0x%x)\n", opts.heads, opts.heads); + ntfs_log_debug("heads = %ld (0x%lx)\n", opts.heads, opts.heads); bs->bpb.hidden_sectors = cpu_to_le32(opts.part_start_sect); ntfs_log_debug("hidden sectors = %llu (0x%llx)\n", opts.part_start_sect, opts.part_start_sect); @@ -4545,15 +4539,15 @@ static void mkntfs_create_root_structures(void) * ../include/layout.h for details. */ bs->number_of_sectors = cpu_to_sle64(opts.num_sectors); - bs->mft_lcn = cpu_to_sle64(opts.mft_lcn); - bs->mftmirr_lcn = cpu_to_sle64(opts.mftmirr_lcn); - if (vol->mft_record_size >= vol->cluster_size) { - bs->clusters_per_mft_record = vol->mft_record_size / - vol->cluster_size; + bs->mft_lcn = cpu_to_sle64(g_mft_lcn); + bs->mftmirr_lcn = cpu_to_sle64(g_mftmirr_lcn); + if (g_vol->mft_record_size >= g_vol->cluster_size) { + bs->clusters_per_mft_record = g_vol->mft_record_size / + g_vol->cluster_size; } else { - bs->clusters_per_mft_record = -(ffs(vol->mft_record_size) - 1); + bs->clusters_per_mft_record = -(ffs(g_vol->mft_record_size) - 1); if ((u32)(1 << -bs->clusters_per_mft_record) != - vol->mft_record_size) + g_vol->mft_record_size) err_exit("BUG: calculated clusters_per_mft_record " "is wrong (= 0x%x)\n", bs->clusters_per_mft_record); @@ -4561,13 +4555,13 @@ static void mkntfs_create_root_structures(void) ntfs_log_debug("clusters per mft record = %i (0x%x)\n", bs->clusters_per_mft_record, bs->clusters_per_mft_record); - if (opts.index_block_size >= (int)vol->cluster_size) { - bs->clusters_per_index_record = opts.index_block_size / - vol->cluster_size; + if (g_index_block_size >= (int)g_vol->cluster_size) { + bs->clusters_per_index_record = g_index_block_size / + g_vol->cluster_size; } else { - bs->clusters_per_index_record = -(ffs(opts.index_block_size) - 1); + bs->clusters_per_index_record = -(ffs(g_index_block_size) - 1); if ((1 << -bs->clusters_per_index_record) != - opts.index_block_size) + g_index_block_size) err_exit("BUG: calculated clusters_per_index_record " "is wrong (= 0x%x)\n", bs->clusters_per_index_record); @@ -4586,12 +4580,12 @@ static void mkntfs_create_root_structures(void) /* Make sure the bootsector is ok. */ if (!ntfs_boot_sector_is_ntfs(bs, opts.verbose > 0 ? 0 : 1)) err_exit("FATAL: Generated boot sector is invalid!\n"); - err = add_attr_data_positioned(m, NULL, 0, 0, 0, rl_boot, buf2, 8192); + err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_boot, g_buf2, 8192); if (!err) - err = create_hardlink(index_block, root_ref, m, + err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_Boot, FILE_Boot), - (8192 + vol->cluster_size - 1) & - ~(vol->cluster_size - 1), 8192, + (8192 + g_vol->cluster_size - 1) & + ~(g_vol->cluster_size - 1), 8192, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$Boot", FILE_NAME_WIN32_AND_DOS); if (!err) { @@ -4601,7 +4595,7 @@ static void mkntfs_create_root_structures(void) if (err < 0) err_exit("Couldn't create $Boot: %s\n", strerror(-err)); - if (create_backup_boot_sector(buf2)) { + if (create_backup_boot_sector(g_buf2)) { /* * Pre-2.6 kernels couldn't access the last sector * if it was odd hence we schedule chkdsk to create it. @@ -4609,27 +4603,27 @@ static void mkntfs_create_root_structures(void) volume_flags |= VOLUME_IS_DIRTY; } - free(buf2); - buf2 = NULL; + free(g_buf2); + g_buf2 = NULL; create_file_volume(m, root_ref, volume_flags); ntfs_log_verbose("Creating $BadClus (mft record 8)\n"); - m = (MFT_RECORD*)(buf + 8 * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + 8 * g_vol->mft_record_size); /* FIXME: This should be IGNORE_CASE */ /* Create a sparse named stream of size equal to the volume size. */ - err = add_attr_data_positioned(m, "$Bad", 4, 0, 0, rl_bad, NULL, - opts.num_clusters * vol->cluster_size); + err = add_attr_data_positioned(m, "$Bad", 4, 0, 0, g_rl_bad, NULL, + g_num_clusters * g_vol->cluster_size); if (!err) { err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); } if (!err) { - err = create_hardlink(index_block, root_ref, m, + err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_BadClus, FILE_BadClus), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$BadClus", FILE_NAME_WIN32_AND_DOS); } - if (!err && vol->major_ver == 1) { + if (!err && g_vol->major_ver == 1) { init_system_file_sd(FILE_BadClus, &sd, &i); err = add_attr_sd(m, sd, i); } @@ -4639,12 +4633,12 @@ static void mkntfs_create_root_structures(void) /* dump_mft_record(m); */ /* create $Quota (1.2) or $Secure (3.0+) */ - if (vol->major_ver < 3) { + if (g_vol->major_ver < 3) { ntfs_log_verbose("Creating $Quota (mft record 9)\n"); - m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + 9 * g_vol->mft_record_size); err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); if (!err) - err = create_hardlink(index_block, root_ref, m, + err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(9, 9), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$Quota", FILE_NAME_WIN32_AND_DOS); @@ -4657,67 +4651,67 @@ static void mkntfs_create_root_structures(void) strerror(-err)); } else { ntfs_log_verbose("Creating $Secure (mft record 9)\n"); - m = (MFT_RECORD*)(buf + 9 * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + 9 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_8; if (!err) - err = create_hardlink(index_block, root_ref, m, + err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(9, 9), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | FILE_ATTR_DUP_VIEW_INDEX_PRESENT , 0, 0, "$Secure", FILE_NAME_WIN32_AND_DOS); if (!err) { - if (vol->minor_ver == 0) { - buf_sds_first_size = 0x1E0; - buf_sds_size = 0x40000 + buf_sds_first_size; - buf_sds_init = calloc(1, buf_sds_first_size); - init_secure_30(buf_sds_init); + if (g_vol->minor_ver == 0) { + g_buf_sds_first_size = 0x1E0; + g_buf_sds_size = 0x40000 + g_buf_sds_first_size; + g_buf_sds_init = calloc(1, g_buf_sds_first_size); + init_secure_30(g_buf_sds_init); } else { - buf_sds_first_size = 0x240; - buf_sds_size = 0x40000 + buf_sds_first_size; - buf_sds_init = calloc(1, buf_sds_first_size); - init_secure_31(buf_sds_init); + g_buf_sds_first_size = 0x240; + g_buf_sds_size = 0x40000 + g_buf_sds_first_size; + g_buf_sds_init = calloc(1, g_buf_sds_first_size); + init_secure_31(g_buf_sds_init); } - buf_sds = calloc(1,buf_sds_size); - if (!buf_sds) + g_buf_sds = calloc(1,g_buf_sds_size); + if (!g_buf_sds) err_exit("Failed to allocate internal buffer:" " %s\n", strerror(errno)); - memcpy((char*)buf_sds, (char*)buf_sds_init, - buf_sds_first_size); - memcpy((char*)buf_sds + 0x40000, (char*)buf_sds_init, - buf_sds_first_size); - err = add_attr_data(m, "$SDS", 4, 0, 0, (u8*)buf_sds, - buf_sds_size); + memcpy((char*)g_buf_sds, (char*)g_buf_sds_init, + g_buf_sds_first_size); + memcpy((char*)g_buf_sds + 0x40000, (char*)g_buf_sds_init, + g_buf_sds_first_size); + err = add_attr_data(m, "$SDS", 4, 0, 0, (u8*)g_buf_sds, + g_buf_sds_size); } /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$SDH", 4, 0, AT_UNUSED, COLLATION_NTOFS_SECURITY_HASH , - opts.index_block_size); + g_index_block_size); /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$SII", 4, 0, AT_UNUSED, - COLLATION_NTOFS_ULONG, opts.index_block_size); + COLLATION_NTOFS_ULONG, g_index_block_size); if (!err) - err =initialize_secure(buf_sds_init, buf_sds_first_size, m); + err = initialize_secure(g_buf_sds_init, g_buf_sds_first_size, m); if (err < 0) err_exit("Couldn't create $Secure: %s\n", strerror(-err)); } /* dump_mft_record(m); */ ntfs_log_verbose("Creating $UpCase (mft record 0xa)\n"); - m = (MFT_RECORD*)(buf + 0xa * vol->mft_record_size); - err = add_attr_data(m, NULL, 0, 0, 0, (u8*)vol->upcase, - vol->upcase_len << 1); + m = (MFT_RECORD*)(g_buf + 0xa * g_vol->mft_record_size); + err = add_attr_data(m, NULL, 0, 0, 0, (u8*)g_vol->upcase, + g_vol->upcase_len << 1); if (!err) - err = create_hardlink(index_block, root_ref, m, + err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_UpCase, FILE_UpCase), - ((vol->upcase_len << 1) + - vol->cluster_size - 1) & - ~(vol->cluster_size - 1), vol->upcase_len << 1, + ((g_vol->upcase_len << 1) + + g_vol->cluster_size - 1) & + ~(g_vol->cluster_size - 1), g_vol->upcase_len << 1, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$UpCase", FILE_NAME_WIN32_AND_DOS); - if (!err && vol->major_ver == 1) { + if (!err && g_vol->major_ver == 1) { init_system_file_sd(FILE_UpCase, &sd, &i); err = add_attr_sd(m, sd, i); } @@ -4725,10 +4719,10 @@ static void mkntfs_create_root_structures(void) err_exit("Couldn't create $UpCase: %s\n", strerror(-err)); /* dump_mft_record(m); */ - if (vol->major_ver < 3) { + if (g_vol->major_ver < 3) { ntfs_log_verbose("Creating empty record, marked as in use " "(mft record 11)\n"); - m = (MFT_RECORD*)(buf + 11 * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + 11 * g_vol->mft_record_size); err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); if (!err) { init_system_file_sd(11, &sd, &j); @@ -4744,10 +4738,10 @@ static void mkntfs_create_root_structures(void) * $Extends index must be resident. Otherwise, w2k3 will * regard the volume as corrupt. (ERSO) */ - m = (MFT_RECORD*)(buf + 11 * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + 11 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_DIRECTORY; if (!err) - err = create_hardlink(index_block, root_ref, m, + err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(11, 11), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, @@ -4756,7 +4750,7 @@ static void mkntfs_create_root_structures(void) /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, - COLLATION_FILE_NAME, opts.index_block_size); + COLLATION_FILE_NAME, g_index_block_size); if (err < 0) err_exit("Couldn't create $Extend: %s\n", strerror(-err)); @@ -4764,7 +4758,7 @@ static void mkntfs_create_root_structures(void) /* NTFS 1.2 reserved system files (mft records 0xc-0xf) */ for (i = 0xc; i < 0x10; i++) { ntfs_log_verbose("Creating system file (mft record 0x%x)\n", i); - m = (MFT_RECORD*)(buf + i * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + i * g_vol->mft_record_size); err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); if (!err) { init_system_file_sd(i, &sd, &j); @@ -4777,37 +4771,37 @@ static void mkntfs_create_root_structures(void) } /* create systemfiles for ntfs volumes (3.1) */ /* starting vith file 24 (ignoring file 16-23) */ - if (vol->major_ver >= 3) { + if (g_vol->major_ver >= 3) { extend_flags = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | FILE_ATTR_ARCHIVE | FILE_ATTR_DUP_VIEW_INDEX_PRESENT; ntfs_log_verbose("Creating $Quota (mft record 24)\n"); - m = (MFT_RECORD*)(buf + 24 * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + 24 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; m->flags |= MFT_RECORD_IS_8; if (!err) - err = create_hardlink_res((MFT_RECORD*)(buf + - 11 * vol->mft_record_size), extend_ref, m, + err = create_hardlink_res((MFT_RECORD*)(g_buf + + 11 * g_vol->mft_record_size), extend_ref, m, MK_LE_MREF(24, 24), 0LL, 0LL, extend_flags, 0, 0, "$Quota", FILE_NAME_WIN32_AND_DOS); /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, - COLLATION_NTOFS_SID, opts.index_block_size); + COLLATION_NTOFS_SID, g_index_block_size); /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$Q", 2, 0, AT_UNUSED, - COLLATION_NTOFS_ULONG, opts.index_block_size); + COLLATION_NTOFS_ULONG, g_index_block_size); if (!err) err = initialize_quota(m); if (err < 0) err_exit("Couldn't create $Quota: %s\n", strerror(-err)); ntfs_log_verbose("Creating $ObjId (mft record 25)\n"); - m = (MFT_RECORD*)(buf + 25 * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + 25 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; m->flags |= MFT_RECORD_IS_8; if (!err) - err = create_hardlink_res((MFT_RECORD*)(buf + - 11 * vol->mft_record_size), extend_ref, + err = create_hardlink_res((MFT_RECORD*)(g_buf + + 11 * g_vol->mft_record_size), extend_ref, m, MK_LE_MREF(25, 25), 0LL, 0LL, extend_flags, 0, 0, "$ObjId", FILE_NAME_WIN32_AND_DOS); @@ -4815,26 +4809,26 @@ static void mkntfs_create_root_structures(void) /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, - COLLATION_NTOFS_ULONGS, opts.index_block_size); + COLLATION_NTOFS_ULONGS, g_index_block_size); if (!err) - err = initialize_objid(m, volume_obj_id->object_id, + err = initialize_objid(m, g_volume_obj_id->object_id, MK_LE_MREF(FILE_Volume, FILE_Volume)); if (err < 0) err_exit("Couldn't create $ObjId: %s\n", strerror(-err)); ntfs_log_verbose("Creating $Reparse (mft record 26)\n"); - m = (MFT_RECORD*)(buf + 26 * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + 26 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; m->flags |= MFT_RECORD_IS_8; if (!err) - err = create_hardlink_res((MFT_RECORD*)(buf + - 11 * vol->mft_record_size), + err = create_hardlink_res((MFT_RECORD*)(g_buf + + 11 * g_vol->mft_record_size), extend_ref, m, MK_LE_MREF(26, 26), 0LL, 0LL, extend_flags, 0, 0, "$Reparse", FILE_NAME_WIN32_AND_DOS); /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$R", 2, 0, AT_UNUSED, - COLLATION_NTOFS_ULONGS, opts.index_block_size); + COLLATION_NTOFS_ULONGS, g_index_block_size); if (err < 0) err_exit("Couldn't create $Reparse: %s\n", strerror(-err)); @@ -4858,9 +4852,9 @@ int main(int argc, char **argv) utils_set_locale(); /* Initialize the random number generator with the current time. */ srandom(mkntfs_time()); - /* Allocate and initialize ntfs_volume structure vol. */ - vol = ntfs_volume_alloc(); - if (!vol) + /* Allocate and initialize ntfs_volume structure g_vol. */ + g_vol = ntfs_volume_alloc(); + if (!g_vol) err_exit("Could not allocate memory for internal buffer.\n"); /* Register our exit function which will cleanup everything. */ err = atexit(&mkntfs_exit); @@ -4870,16 +4864,16 @@ int main(int argc, char **argv) mkntfs_exit(); exit(1); } - vol->major_ver = 1; - vol->minor_ver = 2; - vol->mft_record_size = 1024; - vol->mft_record_size_bits = 10; + g_vol->major_ver = 1; + g_vol->minor_ver = 2; + g_vol->mft_record_size = 1024; + g_vol->mft_record_size_bits = 10; /* Length is in unicode characters. */ - vol->upcase_len = 65536; - vol->upcase = malloc(vol->upcase_len * sizeof(ntfschar)); - if (!vol->upcase) + g_vol->upcase_len = 65536; + g_vol->upcase = malloc(g_vol->upcase_len * sizeof(ntfschar)); + if (!g_vol->upcase) err_exit("Could not allocate memory for internal buffer.\n"); - init_upcase_table(vol->upcase, vol->upcase_len * sizeof(ntfschar)); + init_upcase_table(g_vol->upcase, g_vol->upcase_len * sizeof(ntfschar)); /* Initialize opts to zero / required values. */ init_options(); /* Parse command line options. */ @@ -4890,15 +4884,15 @@ int main(int argc, char **argv) mkntfs_override_phys_params(); /* Initialize $Bitmap and $MFT/$BITMAP related stuff. */ mkntfs_initialize_bitmaps(); - /* Initialize MFT & set opts.logfile_lcn. */ + /* Initialize MFT & set g_logfile_lcn. */ mkntfs_initialize_rl_mft(); /* Initialise $LogFile. */ mkntfs_initialize_rl_logfile(); /* Initialize $Boot. */ mkntfs_initialize_rl_boot(); /* Allocate a buffer large enough to hold the mft. */ - buf = calloc(1, opts.mft_size); - if (!buf) + g_buf = calloc(1, g_mft_size); + if (!g_buf) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); /* Create runlist for $BadClus, $DATA named stream $Bad. */ @@ -4923,11 +4917,11 @@ int main(int argc, char **argv) * update during each subsequent c&w of each system file. */ ntfs_log_verbose("Syncing root directory index record.\n"); - mkntfs_sync_index_record(index_block, (MFT_RECORD*)(buf + - 5 * vol->mft_record_size), NTFS_INDEX_I30, 4); + mkntfs_sync_index_record(g_index_block, (MFT_RECORD*)(g_buf + + 5 * g_vol->mft_record_size), NTFS_INDEX_I30, 4); ntfs_log_verbose("Syncing $Bitmap.\n"); - m = (MFT_RECORD*)(buf + 6 * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + 6 * g_vol->mft_record_size); ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) err_exit("Failed to allocate attribute search context: %s\n", @@ -4938,19 +4932,19 @@ int main(int argc, char **argv) } a = ctx->attr; if (a->non_resident) { - runlist *rl = ntfs_mapping_pairs_decompress(vol, a, NULL); + runlist *rl = ntfs_mapping_pairs_decompress(g_vol, a, NULL); ntfs_attr_put_search_ctx(ctx); if (!rl) err_exit("ntfs_mapping_pairs_decompress() failed\n"); - lw = ntfs_rlwrite(vol->dev, rl, lcn_bitmap, - lcn_bitmap_byte_size, NULL); + lw = ntfs_rlwrite(g_vol->dev, rl, g_lcn_bitmap, + g_lcn_bitmap_byte_size, NULL); err = errno; free(rl); - if (lw != lcn_bitmap_byte_size) + if (lw != g_lcn_bitmap_byte_size) err_exit("%s\n", lw == -1 ? strerror(err) : "unknown error"); } else { - memcpy((char*)a + le16_to_cpu(a->value_offset), lcn_bitmap, + memcpy((char*)a + le16_to_cpu(a->value_offset), g_lcn_bitmap, le32_to_cpu(a->value_length)); ntfs_attr_put_search_ctx(ctx); } @@ -4959,25 +4953,25 @@ int main(int argc, char **argv) * its creation. */ ntfs_log_verbose("Syncing $MFT.\n"); - pos = opts.mft_lcn * vol->cluster_size; + pos = g_mft_lcn * g_vol->cluster_size; lw = 1; - for (i = 0; i < opts.mft_size / (s32)vol->mft_record_size; i++) { + for (i = 0; i < g_mft_size / (s32)g_vol->mft_record_size; i++) { if (!opts.no_action) - lw = ntfs_mst_pwrite(vol->dev, pos, 1, - vol->mft_record_size, - buf + i * vol->mft_record_size); + lw = ntfs_mst_pwrite(g_vol->dev, pos, 1, + g_vol->mft_record_size, + g_buf + i * g_vol->mft_record_size); if (lw != 1) err_exit("%s\n", lw == -1 ? strerror(errno) : "unknown error"); - pos += vol->mft_record_size; + pos += g_vol->mft_record_size; } ntfs_log_verbose("Updating $MFTMirr.\n"); - pos = opts.mftmirr_lcn * vol->cluster_size; + pos = g_mftmirr_lcn * g_vol->cluster_size; lw = 1; - for (i = 0; i < rl_mftmirr[0].length * vol->cluster_size / - vol->mft_record_size; i++) { + for (i = 0; i < g_rl_mftmirr[0].length * g_vol->cluster_size / + g_vol->mft_record_size; i++) { u16 usn, *usnp; - m = (MFT_RECORD*)(buf + i * vol->mft_record_size); + m = (MFT_RECORD*)(g_buf + i * g_vol->mft_record_size); /* * Decrement the usn by one, so it becomes the same as the one * in $MFT once it is mst protected. - This is as we need the @@ -4990,16 +4984,16 @@ int main(int argc, char **argv) usn = 0xfffe; *usnp = cpu_to_le16(usn); if (!opts.no_action) - lw = ntfs_mst_pwrite(vol->dev, pos, 1, - vol->mft_record_size, - buf + i * vol->mft_record_size); + lw = ntfs_mst_pwrite(g_vol->dev, pos, 1, + g_vol->mft_record_size, + g_buf + i * g_vol->mft_record_size); if (lw != 1) err_exit("%s\n", lw == -1 ? strerror(errno) : "unknown error"); - pos += vol->mft_record_size; + pos += g_vol->mft_record_size; } ntfs_log_verbose("Syncing device.\n"); - if (vol->dev->d_ops->sync(vol->dev)) + if (g_vol->dev->d_ops->sync(g_vol->dev)) err_exit("Syncing device. FAILED: %s", strerror(errno)); ntfs_log_quiet("mkntfs completed successfully. Have a nice day.\n"); /* From 300f86ac21194fbfeeb954034234ab2d41ae3c4b Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 5 Nov 2005 22:54:43 +0000 Subject: [PATCH 2702/2994] * layout.h: update about special INTX files. * ntfsmount: implement readlink() and add support of symlinks, charcter and block devices to stat(). --- include/ntfs/inode.h | 2 + include/ntfs/layout.h | 23 +++++ libntfs/inode.c | 1 + ntfsprogs/ntfsmount.c | 206 ++++++++++++++++++++++++++++++++++-------- 4 files changed, 192 insertions(+), 40 deletions(-) diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 98d3e84a..2dde1afe 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -122,6 +122,8 @@ struct _ntfs_inode { ntfs_volume *vol; /* Pointer to the ntfs volume of this inode. */ unsigned long state; /* NTFS specific flags describing this inode. See ntfs_inode_state_bits above. */ + FILE_ATTR_FLAGS flags; /* Flags describing the file. + (Copy from STANDARD_INFORMATION) */ /* * Attribute list support (for use by the attribute lookup functions). * Setup during ntfs_open_inode() for all inodes with attribute lists. diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 2ff93567..b2dc2933 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -2608,4 +2608,27 @@ typedef struct { typedef EFS_DF_CERTIFICATE_THUMBPRINT_HEADER EFS_DF_CERT_THUMBPRINT_HEADER; +typedef enum { + INTX_SYMBOLIC_LINK = + const_cpu_to_le64(0x014B4E4C78746E49ULL), /* "IntxLNK\1" */ + INTX_CHARACTER_DEVICE = + const_cpu_to_le64(0x0052484378746E49ULL), /* "IntxCHR\0" */ + INTX_BLOCK_DEVICE = + const_cpu_to_le64(0x004B4C4278746E49ULL), /* "IntxBLK\0" */ +} INTX_FILE_TYPES; + +typedef struct { + INTX_FILE_TYPES magic; /* Intx file magic. */ + union { + /* For character and block devices. */ + struct { + u64 major; /* Major device number. */ + u64 minor; /* Minor device number. */ + void *device_end[0]; /* Marker for offsetof(). */ + } __attribute__((__packed__)); + /* For symbolic links. */ + ntfschar target[0]; + } __attribute__((__packed__)); +} __attribute__((__packed__)) INTX_FILE; + #endif /* defined _NTFS_LAYOUT_H */ diff --git a/libntfs/inode.c b/libntfs/inode.c index b6291bba..2ac28942 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -166,6 +166,7 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) NInoSetEncrypted(ni); if (std_info->file_attributes & FILE_ATTR_SPARSE_FILE) NInoSetSparse(ni); + ni->flags = std_info->file_attributes; ni->creation_time = ntfs2utc(std_info->creation_time); ni->last_data_change_time = ntfs2utc(std_info->last_data_change_time); ni->last_mft_change_time = ntfs2utc(std_info->last_mft_change_time); diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index b44fa868..6ac47667 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -292,47 +292,171 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) if (stream_name_len < 0) return stream_name_len; memset(stbuf, 0, sizeof(struct stat)); - if ((ni = ntfs_pathname_to_inode(vol, NULL, path))) { - if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY && - !stream_name_len) { - stbuf->st_mode = S_IFDIR | (0777 & ~ctx->dmask); - na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4); - if (na) { - stbuf->st_size = na->data_size; - stbuf->st_blocks = na->allocated_size >> - vol->sector_size_bits; - ntfs_attr_close(na); - } else { - stbuf->st_size = 0; - stbuf->st_blocks = 0; - } - stbuf->st_nlink = 1; /* Needed for correct find work. */ - } else { - stbuf->st_mode = S_IFREG | (0777 & ~ctx->fmask); - na = ntfs_attr_open(ni, AT_DATA, stream_name, - stream_name_len); - if (na) { - stbuf->st_size = na->data_size; - stbuf->st_blocks = na->allocated_size >> - vol->sector_size_bits; - ntfs_attr_close(na); - } else { - stbuf->st_size = 0; - stbuf->st_blocks = 0; - if (stream_name_len) - res = -ENOENT; - } - stbuf->st_nlink = le16_to_cpu(ni->mrec->link_count); - } - stbuf->st_uid = ctx->uid; - stbuf->st_gid = ctx->gid; - stbuf->st_ino = ni->mft_no; - stbuf->st_atime = ni->last_access_time; - stbuf->st_ctime = ni->last_mft_change_time; - stbuf->st_mtime = ni->last_data_change_time; - ntfs_inode_close(ni); - } else + ni = ntfs_pathname_to_inode(vol, NULL, path); + if (!ni) { res = -ENOENT; + goto exit; + } + if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY && !stream_name_len) { + /* Directory. */ + stbuf->st_mode = S_IFDIR | (0777 & ~ctx->dmask); + na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4); + if (na) { + stbuf->st_size = na->data_size; + stbuf->st_blocks = na->allocated_size >> + vol->sector_size_bits; + ntfs_attr_close(na); + } else { + stbuf->st_size = 0; + stbuf->st_blocks = 0; + } + stbuf->st_nlink = 1; /* Needed for correct find work. */ + } else { + /* Regular or INTX file. */ + stbuf->st_mode = S_IFREG; + na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); + if (na) { + /* Check whether it's special INTX file. */ + if ((ni->flags & FILE_ATTR_SYSTEM) && na->data_size <= + sizeof(INTX_FILE_TYPES) + sizeof( + ntfschar) * MAX_PATH && na->data_size > + sizeof(INTX_FILE_TYPES) && + !stream_name_len) { + INTX_FILE *intx_file; + + intx_file = malloc(na->data_size); + if (!intx_file) { + res = -errno; + ntfs_attr_close(na); + goto exit; + } + if (ntfs_attr_pread(na, 0, na->data_size, + intx_file) != na->data_size) { + res = -errno; + free(intx_file); + ntfs_attr_close(na); + goto exit; + } + if (intx_file->magic == INTX_BLOCK_DEVICE && + na->data_size == offsetof( + INTX_FILE, device_end)) { + stbuf->st_mode = S_IFBLK; + stbuf->st_rdev = makedev(le64_to_cpu( + intx_file->major), + le64_to_cpu( + intx_file->minor)); + } + if (intx_file->magic == INTX_CHARACTER_DEVICE && + na->data_size == offsetof( + INTX_FILE, device_end)) { + stbuf->st_mode = S_IFCHR; + stbuf->st_rdev = makedev(le64_to_cpu( + intx_file->major), + le64_to_cpu( + intx_file->minor)); + } + if (intx_file->magic == INTX_SYMBOLIC_LINK) + stbuf->st_mode = S_IFLNK; + free(intx_file); + } + stbuf->st_size = na->data_size; + stbuf->st_blocks = na->allocated_size >> + vol->sector_size_bits; + ntfs_attr_close(na); + } else { + stbuf->st_size = 0; + stbuf->st_blocks = 0; + if (stream_name_len) + res = -ENOENT; + } + stbuf->st_mode |= (0777 & ~ctx->fmask); + stbuf->st_nlink = le16_to_cpu(ni->mrec->link_count); + } + stbuf->st_uid = ctx->uid; + stbuf->st_gid = ctx->gid; + stbuf->st_ino = ni->mft_no; + stbuf->st_atime = ni->last_access_time; + stbuf->st_ctime = ni->last_mft_change_time; + stbuf->st_mtime = ni->last_data_change_time; +exit: + if (ni) + ntfs_inode_close(ni); + free(path); + if (stream_name_len) + free(stream_name); + return res; +} + +static int ntfs_fuse_readlink(const char *org_path, char *buf, size_t buf_size) +{ + char *path; + ntfschar *stream_name; + ntfs_inode *ni = NULL; + ntfs_attr *na = NULL; + INTX_FILE *intx_file = NULL; + int stream_name_len, res = 0; + + /* Get inode. */ + stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); + if (stream_name_len < 0) + return stream_name_len; + if (stream_name_len > 0) { + res = -EINVAL; + goto exit; + } + ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); + if (!ni) { + res = -errno; + goto exit; + } + /* Sanity checks. */ + if (!(ni->flags & FILE_ATTR_SYSTEM)) { + res = -EINVAL; + goto exit; + } + na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0); + if (!na) { + res = -errno; + goto exit; + } + if (na->data_size <= sizeof(INTX_FILE_TYPES)) { + res = -EINVAL; + goto exit; + } + if (na->data_size > sizeof(INTX_FILE_TYPES) + + sizeof(ntfschar) * MAX_PATH) { + res = -ENAMETOOLONG; + goto exit; + } + /* Receive file content. */ + intx_file = malloc(na->data_size); + if (!intx_file) { + res = -errno; + goto exit; + } + if (ntfs_attr_pread(na, 0, na->data_size, intx_file) != na->data_size) { + res = -errno; + goto exit; + } + /* Sanity check. */ + if (intx_file->magic != INTX_SYMBOLIC_LINK) { + res = -EINVAL; + goto exit; + } + /* Convert link from unicode to local encoding. */ + if (ntfs_ucstombs(intx_file->target, (na->data_size - + offsetof(INTX_FILE, target)) / sizeof(ntfschar), + &buf, buf_size) < 0) { + res = -errno; + goto exit; + } +exit: + if (intx_file) + free(intx_file); + if (na) + ntfs_attr_close(na); + if (ni) + ntfs_inode_close(ni); free(path); if (stream_name_len) free(stream_name); @@ -1150,6 +1274,7 @@ exit: static struct fuse_operations ntfs_fuse_oper = { .getattr = ntfs_fuse_getattr, + .readlink = ntfs_fuse_readlink, .readdir = ntfs_fuse_readdir, .open = ntfs_fuse_open, .read = ntfs_fuse_read, @@ -1518,6 +1643,7 @@ int main(int argc, char *argv[]) int ffd; utils_set_locale(); + ntfs_log_set_handler(ntfs_log_handler_stderr); signal(SIGINT, signal_handler); signal(SIGTERM, signal_handler); From ef9d593949a3c487853d709f1f8b84313026e169 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 6 Nov 2005 02:19:19 +0000 Subject: [PATCH 2703/2994] replace the command line parsing mkntfs now supports long options (e-11) --- ntfsprogs/mkntfs.c | 603 ++++++++++++++++++++++++++++----------------- 1 file changed, 377 insertions(+), 226 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 390d6184..f98d9117 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -216,15 +216,13 @@ struct mkntfs_options { BOOL disable_indexing; /* -I, disables indexing of file contents on the volume by default. */ BOOL no_action; /* -n, do not write to device, only display what would be done. */ long long part_start_sect; /* -p, start sector of partition on parent device */ - int quiet; /* -q, quiet execution. */ + BOOL quiet; /* -q, quiet execution. */ long sector_size; /* -s, in bytes, power of 2, default is 512 bytes. */ long sectors_per_track; /* -S, number of sectors per track on device */ BOOL use_epoch_time; /* -T, fake the time to be 00:00:00 UTC, Jan 1, 1970. */ - long verbose; /* -v, verbose execution */ + BOOL verbose; /* -v, verbose execution */ long mft_zone_multiplier; /* -z, value from 1 to 4. Default is 1. */ long long num_sectors; /* size of device in sectors */ - - /* As yet unreferenced */ long cluster_size; /* -c, format with this cluster-size */ u8 ver_major; /* -w, ntfs version to create */ u8 ver_minor; @@ -233,6 +231,357 @@ struct mkntfs_options { } opts; +/** + * mkntfs_license + */ +static void mkntfs_license(void) +{ + ntfs_log_info("%s", ntfs_gpl); +} + +/** + * mkntfs_usage + */ +static void mkntfs_usage(void) +{ + ntfs_log_info("\nUsage: %s [options] device [number-of-sectors]\n" + "\n" + "Basic options:\n" + " -f, --fast Perform a quick format\n" + " -Q, --quick Perform a quick format\n" + " -L, --label string Set the volume label\n" + " -C, --enable-compression Enable compression on the volume\n" + " -c, --cluster-size BYTES Specify the cluster size for the volume\n" + " -I, --no-indexing Disable indexing on the volume\n" + " -n, --no-action Do not write to disk\n" + "\n" + "Advanced options:\n" + " -s, --sector-size BYTES Specify the sector size for the device\n" + " -p, --partition-start SECTOR Specify the partition start sector\n" + " -H, --heads NUM Specify the number of heads\n" + " -S, --sectors-per-track NUM Specify the number of sectors per track\n" + " -z, --mft-zone-multiplier NUM Set the MFT zone multiplier\n" + " -T, --zero-time Fake the time to be 00:00 UTC, Jan 1, 1970\n" + " -w, --ntfs-version STRING NTFS version information\n" + " -F, --force Force execution despite errors\n" + "\n" + "Output options:\n" + " -q, --quiet Quiet execution\n" + " -v, --verbose Verbose execution\n" + " --debug Very verbose execution\n" + "\n" + "Help options:\n" + " -V, --version Display version\n" + " -l, --license Display licensing information\n" + " -h, --help Display this help\n" + "\n", basename(EXEC_NAME)); +} + +/** + * mkntfs_version + */ +static void mkntfs_version(void) +{ + ntfs_log_info("\n%s v%s (libntfs %s)\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); + ntfs_log_info("Create an NTFS volume on a user specified (block) device.\n\n"); + ntfs_log_info("Copyright (c) 2000-2005 Anton Altaparmakov\n"); + ntfs_log_info("Copyright (c) 2001-2005 Richard Russon\n"); + ntfs_log_info("Copyright (c) 2002-2005 Szabolcs Szakacsits\n"); + ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); +} + + +/** + * mkntfs_parse_long + */ +static BOOL mkntfs_parse_long(const char *string, const char *name, long *num) +{ + char *end = NULL; + long tmp; + + if (!string || !name || !num) + return FALSE; + + if (*num >= 0) { + ntfs_log_error("You may only specify the %s once.\n", name); + return FALSE; + } + + tmp = strtol(string, &end, 0); + if (end && *end) { + ntfs_log_error("Cannot understand the %s '%s'.\n", name, string); + return FALSE; + } else { + *num = tmp; + return TRUE; + } +} + +/** + * mkntfs_parse_llong + */ +static BOOL mkntfs_parse_llong(const char *string, const char *name, long long *num) +{ + char *end = NULL; + long long tmp; + + if (!string || !name || !num) + return FALSE; + + if (*num >= 0) { + ntfs_log_error("You may only specify the %s once.\n", name); + return FALSE; + } + + tmp = strtoll(string, &end, 0); + if (end && *end) { + ntfs_log_error("Cannot understand the %s '%s'.\n", name, string); + return FALSE; + } else { + *num = tmp; + return TRUE; + } +} + +/** + * mkntfs_init_options + */ +static void mkntfs_init_options(struct mkntfs_options *opts2) // XXX rename arg +{ + if (!opts2) + return; + + memset(opts2, 0, sizeof(*opts2)); + + /* Mark all the numeric options as "unset". */ + opts2->heads = -1; + opts2->part_start_sect = -1; + opts2->sector_size = -1; + opts2->sectors_per_track = -1; + opts2->mft_zone_multiplier = -1; + opts2->num_sectors = -1; + opts2->cluster_size = -1; +} + +/** + * mkntfs_parse_options + */ +static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options *opts2) +{ + static const char *sopt = "-c:CfFhH:IlL:np:qQs:S:TvVw:z:"; + static const struct option lopt[] = { + { "cluster-size", required_argument, NULL, 'c' }, + { "debug", no_argument, NULL, 'Z' }, + { "enable-compression", no_argument, NULL, 'C' }, + { "fast", no_argument, NULL, 'f' }, + { "force", no_argument, NULL, 'F' }, + { "heads", required_argument, NULL, 'H' }, + { "help", no_argument, NULL, 'h' }, + { "label", required_argument, NULL, 'L' }, + { "license", no_argument, NULL, 'l' }, + { "mft-zone-multiplier",required_argument, NULL, 'z' }, + { "no-action", no_argument, NULL, 'n' }, + { "no-indexing", no_argument, NULL, 'I' }, + { "ntfs-version", required_argument, NULL, 'w' }, + { "partition-start", required_argument, NULL, 'p' }, + { "quick", no_argument, NULL, 'Q' }, + { "quiet", no_argument, NULL, 'q' }, + { "sector-size", required_argument, NULL, 's' }, + { "sectors-per-track", required_argument, NULL, 'S' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { "zero-time", no_argument, NULL, 'T' }, + { NULL, 0, NULL, 0 } + }; + + char c = -1; + int lic = 0; + int err = 0; + int ver = 0; + int levels = 0; + + if (!argv || !opts2) { + ntfs_log_error("Internal error: invalid parameters to mkntfs_options.\n"); + return FALSE; + } + + opterr = 0; /* We'll handle the errors, thank you. */ + + while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != (char)-1) { + switch (c) { + case 1: /* A device, or a number of sectors */ + if (!opts2->dev_name) + opts2->dev_name = argv[optind-1]; + else if (!mkntfs_parse_llong(optarg, "number of sectors", &opts2->num_sectors)) + err++; + break; + case 'C': + opts2->enable_compression = TRUE; + break; + case 'c': + if (!mkntfs_parse_long(optarg, "cluster size", &opts2->cluster_size)) + err++; + break; + case 'F': + opts2->force = TRUE; + break; + case 'f': /* fast */ + case 'Q': /* quick */ + opts2->quick_format = TRUE; + break; + case 'H': + if (!mkntfs_parse_long(optarg, "heads", &opts2->heads)) + err++; + break; + case 'h': + err++; /* display help */ + break; + case 'I': + opts2->disable_indexing = TRUE; + break; + case 'L': + if (!opts2->label) { + opts2->label = argv[optind-1]; + } else { + ntfs_log_error("You may only specify the label once.\n"); + err++; + } + break; + case 'l': + lic++; /* display the license */ + break; + case 'n': + opts2->no_action = TRUE; + break; + case 'p': + if (!mkntfs_parse_llong(optarg, "partition start", &opts2->part_start_sect)) + err++; + break; + case 'q': + opts2->quiet = TRUE; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); + break; + case 's': + if (!mkntfs_parse_long(optarg, "sector size", &opts2->sector_size)) + err++; + break; + case 'S': + if (!mkntfs_parse_long(optarg, "sectors per track", &opts2->sectors_per_track)) + err++; + break; + case 'T': + opts2->use_epoch_time = TRUE; + break; + case 'v': + opts2->verbose = TRUE; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); + break; + case 'V': + ver++; /* display version info */ + break; + case 'w': /* ntfs-version */ + if ((opts2->ver_major == 0) && (opts2->ver_minor == 0)) { + if (strcmp(optarg , "1.2") == 0) { + opts2->ver_major = 1; + opts2->ver_minor = 2; + } else if (strcmp(optarg , "3.0") == 0) { + opts2->ver_major = 3; + opts2->ver_minor = 0; + } else if (strcmp(optarg , "3.1") == 0) { + opts2->ver_major = 3; + opts2->ver_minor = 1; + } else { + ntfs_log_error("NTFS version '%s' is not supported.\n", optarg); + err++; + } + } else { + ntfs_log_error("You may only specify the NTFS version once.\n"); + err++; + } + break; + case 'Z': /* debug - turn on everything */ + opts2->debug = TRUE; + opts2->verbose = TRUE; + opts2->quiet = FALSE; + ntfs_log_set_levels(NTFS_LOG_LEVEL_DEBUG | NTFS_LOG_LEVEL_TRACE | NTFS_LOG_LEVEL_VERBOSE | NTFS_LOG_LEVEL_QUIET); + break; + case 'z': + if (!mkntfs_parse_long(optarg, "mft zone multiplier", &opts2->mft_zone_multiplier)) + err++; + break; + default: + if (ntfs_log_parse_option (argv[optind-1])) + break; + if (optopt != '?') + ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); + err++; + break; + } + } + + /* Make sure we're in sync with the log levels */ + levels = ntfs_log_get_levels(); + if (levels & NTFS_LOG_LEVEL_VERBOSE) + opts2->verbose = TRUE; + if (!(levels & NTFS_LOG_LEVEL_QUIET)) + opts2->quiet = TRUE; + + if (!err && !ver && !lic) { + if (opts2->dev_name == NULL) { + if (argc > 1) + ntfs_log_error("You must specify a device.\n"); + err++; + } + + if (opts2->quiet && opts2->verbose) { + ntfs_log_error("You may not use --quiet and --verbose " + "at the same time.\n"); + err++; + } + } + + if (ver) + mkntfs_version(); + if (lic) + mkntfs_license(); + if (err) + mkntfs_usage(); + + return (!err && !ver && !lic); +} + +/** + * mkntfs_validate_options + */ +static BOOL mkntfs_validate_options(struct mkntfs_options *opts2 __attribute__((unused))) // XXX rename arg +{ +#if 0 + printf ("dev_name = %s\n", opts2->dev_name); + printf ("label = %s\n", opts2->label); + printf ("quick_format = %d\n", opts2->quick_format); + printf ("disable_indexing = %d\n", opts2->disable_indexing); + printf ("verbose = %ld\n", opts2->verbose); + printf ("ver_major = %d\n", opts2->ver_major); + printf ("ver_minor = %d\n", opts2->ver_minor); + printf ("enable_compression = %d\n", opts2->enable_compression); + printf ("heads = %ld\n", opts2->heads); + printf ("cluster_size = %ld\n", opts2->cluster_size); + printf ("mft_zone_multiplier = %ld\n", opts2->mft_zone_multiplier); + printf ("sectors_per_track = %ld\n", opts2->sectors_per_track); + printf ("use_epoch_time = %d\n", opts2->use_epoch_time); + printf ("num_sectors = %lld\n", opts2->num_sectors); + printf ("sector_size = %ld\n", opts2->sector_size); + printf ("part_start_sect = %lld\n", opts2->part_start_sect); + printf ("quiet = %d\n", opts2->quiet); + printf ("no_action = %d\n", opts2->no_action); + printf ("force = %d\n", opts2->force); + printf ("debug = %d\n", opts2->debug); +#endif + + return TRUE; +} + + /** * err_exit - error output and terminate; ignores quiet (-q) */ @@ -250,211 +599,6 @@ static void err_exit(const char *fmt, ...) exit(1); } -/** - * copyright - print copyright statements - */ -static void copyright(void) -{ - fprintf(stderr, "Copyright (c) 2000-2005 Anton Altaparmakov\n" - "Copyright (c) 2001-2005 Richard Russon\n" - "Copyright (c) 2002-2005 Szabolcs Szakacsits\n" - "Create an NTFS volume on a user specified (block) " - "device.\n"); -} - -/** - * license - print license statement - */ -static void license(void) -{ - fprintf(stderr, "%s", ntfs_gpl); -} - -/** - * usage - print a list of the parameters to the program - */ -__attribute__((noreturn)) -static void usage(void) -{ - copyright(); - fprintf(stderr, "Usage: %s [options] device " - "[number-of-sectors]\n" - " -s sector-size Specify the sector size " - "for the device\n" - " -p part-start-sect Specify the partition " - "start sector\n" - " -H heads Specify the number of " - "heads\n" - " -S sectors-per-track Specify the number of " - "sectors per track\n" - " -c cluster-size Specify the cluster " - "size for the volume\n" - " -L volume-label Set the volume label\n" - " -z mft-zone-multiplier Set the MFT zone " - "multiplier\n" - " -f Perform a quick format\n" - " -Q Perform a quick format\n" - " -C Enable compression on " - "the volume\n" - " -I Disable indexing on the " - "volume\n" - " -n Do not write to disk\n" - " -F Force execution despite " - "errors\n" - " -T Fake the time to be " - "00:00:00 UTC, Jan 1, 1970\n" - " -q Quiet execution\n" - " -v Verbose execution\n" - " -vv Very verbose execution\n" - " -V Display version \n" - " -w NTFS version " - "information\n" - " -l Display licensing " - "information\n" - " -h Display this help\n", - EXEC_NAME); - fprintf(stderr, "%s%s", ntfs_bugs, ntfs_home); - exit(1); -} - -/** - * parse_options - */ -static void parse_options(int argc, char *argv[]) -{ - int c; - long l; - unsigned long u; - char *s; - - /* Need to have: mft record size, index record size, mft size, */ - /* logfile size, list of bad blocks, check for bad blocks, ... */ - if (argc && *argv) - EXEC_NAME = *argv; - fprintf(stderr, "%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, - ntfs_libntfs_version()); - while ((c = getopt(argc, argv, "c:fH:h?np:qS:s:vz:CFTIL:QVlw:")) != EOF) - switch (c) { - case 'n': - opts.no_action = 1; - break; - case 'c': - l = strtol(optarg, &s, 0); - if (l <= 0 || l > INT_MAX || *s) - err_exit("Invalid cluster size.\n"); - g_vol->cluster_size = l; - break; - case 'f': - case 'Q': - opts.quick_format = 1; - break; - case 'p': - u = strtoul(optarg, &s, 0); - if ((u >= ULONG_MAX && errno == ERANGE) || *s) - err_exit("Invalid partition start sector.\n"); - opts.part_start_sect = u; - break; - case 'H': - l = strtol(optarg, &s, 0); - if (l <= 0 || l > INT_MAX || *s) - err_exit("Invalid number of heads.\n"); - opts.heads = l; - break; - case 'S': - l = strtol(optarg, &s, 0); - if (l <= 0 || l > INT_MAX || *s) - err_exit("Invalid number of sectors per " - "track.\n"); - opts.sectors_per_track = l; - break; - case 'q': - opts.quiet = 1; - break; - case 's': - l = strtol(optarg, &s, 0); - if (l <= 0 || l > INT_MAX || *s) - err_exit("Invalid sector size.\n"); - opts.sector_size = l; - break; - case 'v': - opts.verbose++; - break; - case 'w': - if (!strcmp(optarg , "1.2")) { - g_vol->major_ver = 1; - g_vol->minor_ver = 2; - g_attr_defs = - (ATTR_DEF*)&attrdef_ntfs12_array; - g_attr_defs_len = - sizeof(attrdef_ntfs12_array); - break; - } - if (!strcmp(optarg , "3.0")) { - g_vol->major_ver = 3; - g_vol->minor_ver = 0; - g_attr_defs = - (ATTR_DEF*)&attrdef_ntfs3x_array; - g_attr_defs_len = - sizeof(attrdef_ntfs3x_array); - break; - } - if (!strcmp(optarg , "3.1")) { - g_vol->major_ver = 3; - g_vol->minor_ver = 1; - g_attr_defs = - (ATTR_DEF*)&attrdef_ntfs3x_array; - g_attr_defs_len = - sizeof(attrdef_ntfs3x_array); - break; - } - err_exit("Ntfs version not supported.\n"); - case 'z': - l = strtol(optarg, &s, 0); - if (l < 1 || l > 4 || *s) - err_exit("Invalid MFT zone multiplier.\n"); - opts.mft_zone_multiplier = l; - break; - case 'C': - opts.enable_compression = 1; - break; - case 'F': - opts.force = 1; - break; - case 'T': - opts.use_epoch_time = 1; - break; - case 'I': - opts.disable_indexing = 1; - break; - case 'L': - g_vol->vol_name = optarg; - break; - case 'V': - /* Version number already printed, so just exit. */ - exit(0); - case 'l': - copyright(); - license(); - exit(0); - case 'h': - case '?': - default: - usage(); - } - if (optind == argc) - usage(); - opts.dev_name = argv[optind++]; - if (optind < argc) { - u = strtoul(argv[optind++], &s, 0); - if (*s || !u || (u >= ULONG_MAX && errno == ERANGE)) - err_exit("Invalid number of sectors: %s\n", - argv[optind - 1]); - opts.num_sectors = u; - } - if (optind < argc) - usage(); -} - /** * mkntfs_time */ @@ -3442,7 +3586,7 @@ static void mkntfs_exit(void) free(g_rl_index); free(g_bad_blocks); if ((g_attr_defs != (const ATTR_DEF*)attrdef_ntfs12_array) && - (g_attr_defs != (const ATTR_DEF*)attrdef_ntfs3x_array)) + (g_attr_defs != (const ATTR_DEF*)attrdef_ntfs3x_array)) free(g_attr_defs); if (!g_vol) return; @@ -3497,7 +3641,7 @@ static void mkntfs_open_partition(void) ntfs_log_error("%s is not a block device.\n", g_vol->dev->d_name); if (!opts.force) err_exit("Refusing to make a filesystem here!\n"); - if (!opts.num_sectors) { + if (opts.num_sectors < 0) { if (!sbuf.st_size && !sbuf.st_blocks) err_exit("You must specify the number of " "sectors.\n"); @@ -3552,13 +3696,13 @@ static void mkntfs_override_phys_params(void) int i; /* If user didn't specify the sector size, determine it now. */ - if (!opts.sector_size) { + if (opts.sector_size < 0) { #ifdef BLKSSZGET - int _sect_size = 0; + int sect_size = 0; - if (g_vol->dev->d_ops->ioctl(g_vol->dev, BLKSSZGET, &_sect_size) + if (g_vol->dev->d_ops->ioctl(g_vol->dev, BLKSSZGET, §_size) >= 0) { - opts.sector_size = _sect_size; + opts.sector_size = sect_size; } else #endif { @@ -3577,7 +3721,7 @@ static void mkntfs_override_phys_params(void) "less than or equal 4096 bytes.\n"); ntfs_log_debug("sector size = %ld bytes\n", opts.sector_size); /* If user didn't specify the number of sectors, determine it now. */ - if (!opts.num_sectors) { + if (opts.num_sectors < 0) { opts.num_sectors = ntfs_device_size_get(g_vol->dev, opts.sector_size); if (opts.num_sectors <= 0) @@ -3858,7 +4002,7 @@ static void mkntfs_initialize_rl_mft(void) g_mft_zone_end = g_mft_zone_end >> 1; /* 50% */ break; case 3: - g_mft_zone_end = g_mft_zone_end * 3 >> 3; /* 37.5% */ + g_mft_zone_end = g_mft_zone_end * 3 >> 3;/* 37.5% */ break; case 2: g_mft_zone_end = g_mft_zone_end >> 2; /* 25% */ @@ -4274,12 +4418,6 @@ static void mkntfs_create_root_structures(void) if (ntfs_mft_record_layout(g_vol, 0, m = (MFT_RECORD *)(g_buf + i * g_vol->mft_record_size))) err_exit("Error: Failed to layout mft record.\n"); -#if 0 - if (!opts.quiet && opts.verbose > 1) - dump_mft_record((MFT_RECORD*)g_buf + - i * g_vol->mft_record_size); -#endif - if (i > 0) m->sequence_number = cpu_to_le16(i); if (i == 0) @@ -4313,7 +4451,7 @@ static void mkntfs_create_root_structures(void) cpu_to_le32(0)); } else { /* setting specific security_id flag and */ - /* filepermissions for ntfs 3.x */ + /* file permissions for ntfs 3.x */ if (i == 0 || i == 1 || i == 2 || i == 6 || i == 8 || i == 10) { add_attr_std_info(m, file_attrs, @@ -4578,7 +4716,7 @@ static void mkntfs_create_root_structures(void) */ bs->checksum = cpu_to_le32(0); /* Make sure the bootsector is ok. */ - if (!ntfs_boot_sector_is_ntfs(bs, opts.verbose > 0 ? 0 : 1)) + if (!ntfs_boot_sector_is_ntfs(bs, !opts.debug)) err_exit("FATAL: Generated boot sector is invalid!\n"); err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_boot, g_buf2, 8192); if (!err) @@ -4876,8 +5014,21 @@ int main(int argc, char **argv) init_upcase_table(g_vol->upcase, g_vol->upcase_len * sizeof(ntfschar)); /* Initialize opts to zero / required values. */ init_options(); + mkntfs_init_options(&opts); /* Parse command line options. */ - parse_options(argc, argv); + if (!mkntfs_parse_options(argc, argv, &opts)) + exit(1); + mkntfs_validate_options(&opts); + + /* transfer some options to the volume */ + g_vol->vol_name = opts.label; // XXX when this be strdup, either free it, or call ntfs_umount + if (opts.ver_major && opts.ver_minor) { + g_vol->major_ver = opts.ver_major; + g_vol->minor_ver = opts.ver_minor; + } + if (opts.cluster_size >= 0) + g_vol->cluster_size = opts.cluster_size; + /* Open the partition. */ mkntfs_open_partition(); /* Decide on the sectors/tracks/heads/size, etc. */ From 09c562fdd32960178bf16e165c06672dc731678b Mon Sep 17 00:00:00 2001 From: uvman Date: Sun, 6 Nov 2005 14:15:38 +0000 Subject: [PATCH 2704/2994] Disclaim any copyright holding on layout.h --- include/ntfs/layout.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index b2dc2933..ca981a4d 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -3,7 +3,6 @@ * * Copyright (c) 2000-2005 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy - * Copyright (c) 2005 Yuval Fledel * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published From c09fc7ac81c3f1a0edcbfcf3ee5ab9a4f4e96e80 Mon Sep 17 00:00:00 2001 From: uvman Date: Sun, 6 Nov 2005 14:16:24 +0000 Subject: [PATCH 2705/2994] Add myself to the copyright list on win32_io.c --- libntfs/win32_io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index dcb20045..44e44d21 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -5,6 +5,7 @@ * * Copyright (c) 2003-2004 Lode Leroy * Copyright (c) 2003-2005 Anton Altaparmakov + * Copyright (c) 2004-2005 Yuval Fledel * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published From a0665cf5bd8f92f277017959ae232ac145c0e5e7 Mon Sep 17 00:00:00 2001 From: uvman Date: Sun, 6 Nov 2005 14:18:12 +0000 Subject: [PATCH 2706/2994] Add myself to the copyright list on ntfsinfo.c --- ntfsprogs/ntfsinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 1d113203..56963333 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -4,9 +4,10 @@ * Copyright (c) 2002-2004 Matthew J. Fanto * Copyright (c) 2002-2005 Anton Altaparmakov * Copyright (c) 2002-2005 Richard Russon + * Copyright (c) 2003-2005 Szabolcs Szakacsits + * Copyright (c) 2004-2005 Yuval Fledel * Copyright (c) 2004-2005 Yura Pakhuchiy * Copyright (c) 2005 Cristian Klein - * Copyright (c) 2003-2005 Szabolcs Szakacsits * * This utility will dump a file's attributes. * From d605234a3a4855272ba32d3a849aa4fbd4110236 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 6 Nov 2005 21:26:23 +0000 Subject: [PATCH 2707/2994] document new options --- ntfsprogs/mkntfs.8.in | 389 +++++++++++++++++++++++++++++------------- 1 file changed, 268 insertions(+), 121 deletions(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 600177e6..806283b2 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -1,5 +1,6 @@ .\" -*- nroff -*- .\" Copyright (c) 2001,2002 Anton Altaparmakov. All Rights Reserved. +.\" Copyright (c) 2005 Richard Russon. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" Adapted from e2fsprogs-1.19/misc/mke2fs.8.in by Theodore Ts'o. .\" @@ -9,70 +10,84 @@ mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system .SH SYNOPSIS .B mkntfs [ -.B \-s -.I sector-size +.I options ] +.B device [ -.B \-p -.I part-start-sect +.I number-of-sectors ] +.P +.B mkntfs [ -.B \-H -.I heads -] -[ -.B \-S -.I sectors-per-track +.B \-C ] [ .B \-c .I cluster-size ] [ +.B \-F +] +[ +.B \-f +] +[ +.B \-H +.I heads +] +[ +.B \-h +] +[ +.B \-I +] +[ .B \-L .I volume-label ] [ +.B \-l +] +[ +.B \-n +] +[ +.B \-p +.I part-start-sect +] +[ +.B \-Q +] +[ +.B \-q +] +[ +.B \-S +.I sectors-per-track +] +[ +.B \-s +.I sector-size +] +[ +.B \-T +] +[ +.B \-V +] +[ +.B \-v +] +[ +.B \-w +.I ntfs-version +] +[ .B \-z .I mft-zone-multiplier ] [ -.B \-f -| -.B \-Q -] -[ -.B -n -] -[ -.B \-q -] -[ -.B \-v -] -[ -.B \-vv -] -[ -.B \-C -] -[ -.B \-F -] -[ -.B \-T -] -[ -.B \-I -] -[ -.B \-V -] -[ -.B \-l -] -[ -.B \-h +.B \-\-debug ] .I device [ @@ -90,45 +105,62 @@ is the number of blocks on the device. If omitted, .B mkntfs automagically figures the file system size. .SH OPTIONS -.TP -.BI \-s " sector-size" -Specify the size of sectors in bytes. Valid sector size values are 256, 512, -1024, 2048 and 4096 bytes per sector. If omitted, +Below is a summary of all the options that .B mkntfs -attempts to determine the -.I sector-size -automatically and if that fails a default of 512 bytes per sector is used. +accepts. Nearly all options have two equivalent names. The short name is preceded by +.BR \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.BR \-fv +is equivalent to +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. .TP -.BI \-p " part-start-sect" -Specify the partition start sector. The maximum is 4294967295 (2^32-1). If -omitted, -.B mkntfs -attempts to determine -.I part-start-sect -automatically and if that fails a default of 0 is used. Note that -.I part-start-sect -is required for Windows to be able to boot from the created volume. + +.BR +.SS Basic options +.BR + +.B \-f +.br +.ns .TP -.BI \-H " heads" -Specify the number of heads. The maximum is 65535 (0xffff). If omitted, -.B mkntfs -attempts to determine the number of -.I heads -automatically and if that fails a default of 0 is used. Note that -.I heads -is required for Windows to be able to boot from the created volume. +.B \-\-fast +.br +.ns .TP -.BI \-S " sectors-per-track" -Specify the number of sectors per track. The maximum is 65535 (0xffff). If -omitted, -.B mkntfs -attempts to determine the number of -.I sectors-per-track -automatically and if that fails a default of 0 is used. Note that -.I sectors-per-track -is required for Windows to be able to boot from the created volume. +.B \-Q +.br +.ns .TP -.BI \-c " cluster-size" +.B \-\-quick +Perform quick (fast) format. This will skip both zeroing of the volume and bad sector +checking. +.TP + +.BI \-L " STRING" +.br +.ns +.TP +.BI \-\-label " STRING" +Set the volume label for the filesystem. +.TP + +.B \-C +.br +.ns +.TP +.B \-\-enable-compression +Enable compression on the volume. +.TP + +.BI \-c " BYTES" +.br +.ns +.TP +.BI \-\-cluster-size " BYTES" Specify the size of clusters in bytes. Valid cluster size values are powers of two, with at least 256, and at most 65536 bytes per cluster. If omitted, .B mkntfs @@ -144,17 +176,101 @@ Volume size Default cluster size 1GB - 2GB 2048 bytes 2GB + 4096 bytes .TE - Note that the default cluster size is set to be at least equal to the sector size as a cluster cannot be smaller than a sector. Also, note that values greater than 4096 have the side effect that compression is disabled on the volume (due to limitations in the NTFS compression algorithm currently in use by Windows). .TP -.BI \-L " volume-label" -Set the volume label for the filesystem. + +.B \-I +.br +.ns .TP -.BI \-z " mft-zone-multiplier" +.B \-\-disable-indexing +Disable content indexing on the volume. (This is only meaningful on +Windows 2000 and later. Windows NT 4.0 and earlier ignore this as they do +not implement content indexing at all.) +.TP + +.B \-n +.br +.ns +.TP +.B \-\-no-action +Causes +.B mkntfs +to not actually create a filesystem, but display what it would do if it were +to create a filesystem. All steps of the format are carried out except the +actual writing to the device. +.TP + +.BR +.SS Advanced options +.BR + +.BI \-s " BYTES" +.br +.ns +.TP +.BI \-\-sector-size " BYTES" +Specify the size of sectors in bytes. Valid sector size values are 256, 512, +1024, 2048 and 4096 bytes per sector. If omitted, +.B mkntfs +attempts to determine the +.I sector-size +automatically and if that fails a default of 512 bytes per sector is used. +.TP + +.BI \-p " SECTOR" +.br +.ns +.TP +.BI \-\-partition-start " SECTOR +Specify the partition start sector. The maximum is 4294967295 (2^32-1). If +omitted, +.B mkntfs +attempts to determine +.I part-start-sect +automatically and if that fails a default of 0 is used. Note that +.I part-start-sect +is required for Windows to be able to boot from the created volume. +.TP + +.BI \-H " NUM" +.br +.ns +.TP +.BI \-\-heads " NUM" +Specify the number of heads. The maximum is 65535 (0xffff). If omitted, +.B mkntfs +attempts to determine the number of +.I heads +automatically and if that fails a default of 0 is used. Note that +.I heads +is required for Windows to be able to boot from the created volume. +.TP + +.BI \-S " NUM" +.br +.ns +.TP +.BI \-\-sectors-per-track " NUM" +Specify the number of sectors per track. The maximum is 65535 (0xffff). If +omitted, +.B mkntfs +attempts to determine the number of +.I sectors-per-track +automatically and if that fails a default of 0 is used. Note that +.I sectors-per-track +is required for Windows to be able to boot from the created volume. +.TP + +.BI \-z " NUM" +.br +.ns +.TP +.BI \-\-mft-zone-multiplier " NUM" Set the MFT zone multiplier, which determines the size of the MFT zone to use on the volume. The MFT zone is the area at the beginning of the volume reserved for the master file table (MFT), which stores the on disk inodes (MFT records). @@ -176,69 +292,101 @@ multiplier (% of volume size) 4 50.0% .TE .TP -.B \-f -Same as -.BR \-Q . + +.B \-T +.br +.ns .TP -.B \-Q -Perform quick format. This will skip both zeroing of the volume and bad sector -checking. +.B \-\-zero-time +Fake the time to be 00:00:00 UTC, Jan 1, 1970 instead of the current system +time. This is only really useful for debugging purposes. .TP -.B \-n -Causes -.B mkntfs -to not actually create a filesystem, but display what it would do if it were -to create a filesystem. All steps of the format are carried out except the -actual writing to the device. + +.B \-w STRING +.br +.ns .TP -.B \-q -Quiet execution; only errors are written to stderr, no output to stdout -occurs at all. Useful if -.B mkntfs -is run in a script. -.TP -.B \-v -Verbose execution. -.TP -.B \-vv -Really verbose execution; includes the verbose output from the -.B \-v -option as well as additional output useful for debugging -.B mkntfs. -.TP -.B \-C -Enable compression on the volume. +.B \-\-ntfs-version STRING +Select the version of NTFS you wish to use. This can be one of "1.2", "3.0", or "3.1". .TP + .B \-F +.br +.ns +.TP +.B \-\-force Force .B mkntfs to run, even if the specified .I device is not a block special device, or appears to be mounted. .TP -.B \-T -Fake the time to be 00:00:00 UTC, Jan 1, 1970 instead of the current system -time. This is only really useful for debugging purposes. + +.BR +.SS Output options +.BR + +.B \-q +.br +.ns .TP -.B \-I -Disable content indexing on the volume. (This is only meaningful on -Windows 2000 and later. Windows NT 4.0 and earlier ignore this as they do -not implement content indexing at all.) +.B \-\-quiet +Quiet execution; only errors are written to stderr, no output to stdout +occurs at all. Useful if +.B mkntfs +is run in a script. .TP + +.B \-v +.br +.ns +.TP +.B \-\-verbose +Verbose execution. +.TP + +.B \-\-debug +Really verbose execution; includes the verbose output from the +.B \-v +option as well as additional output useful for debugging +.B mkntfs. +.TP + +.BR +.SS Help options +.BR + .B \-V +.br +.ns +.TP +.B \-\-version Print the version number of .B mkntfs and exit. .TP + .B \-l +.br +.ns +.TP +.B \-\-license Print the licensing information of .B mkntfs and exit. .TP + .B \-h +.br +.ns +.TP +.B \-\-help Print the usage information of .B mkntfs and exit. +.TP +.BR + .SH BUGS .B mkntfs writes the backup boot sector to the last sector of the block @@ -275,4 +423,3 @@ and rpm) and pre-compiled binary (i386 rpm and deb) form. .SH SEE ALSO .BR badblocks (8), .BR ntfsprogs (8) - From 2a2ecd2abdb8b01926b01ecd58349b9c607eb9aa Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 6 Nov 2005 21:40:26 +0000 Subject: [PATCH 2708/2994] parse_options - make sure it always spots missing options fix mem leak in upgrade_to_large_index fix bug - srandom called before options parsed start separating user-type things from lib-type things (e-22) --- ntfsprogs/mkntfs.c | 470 +++++++++++++++++++++++++++++---------------- 1 file changed, 306 insertions(+), 164 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index f98d9117..c7df587f 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -354,13 +354,13 @@ static void mkntfs_init_options(struct mkntfs_options *opts2) // XXX rename arg memset(opts2, 0, sizeof(*opts2)); /* Mark all the numeric options as "unset". */ + opts2->cluster_size = -1; opts2->heads = -1; + opts2->mft_zone_multiplier = -1; + opts2->num_sectors = -1; opts2->part_start_sect = -1; opts2->sector_size = -1; opts2->sectors_per_track = -1; - opts2->mft_zone_multiplier = -1; - opts2->num_sectors = -1; - opts2->cluster_size = -1; } /** @@ -512,8 +512,15 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * default: if (ntfs_log_parse_option (argv[optind-1])) break; - if (optopt != '?') + if (((optopt == 'c') || (optopt == 'H') || + (optopt == 'L') || (optopt == 'p') || + (optopt == 's') || (optopt == 'S') || + (optopt == 'w') || (optopt == 'z')) && + (!optarg)) { + ntfs_log_error("Option '%s' requires an argument.\n", argv[optind-1]); + } else if (optopt != '?') { ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); + } err++; break; } @@ -2626,6 +2633,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, err = -EINVAL; goto err_out; } + ntfs_attr_put_search_ctx(ctx); r = (INDEX_ROOT*)((char*)a + le16_to_cpu(a->value_offset)); re_end = (char*)r + le32_to_cpu(a->value_length); re_start = (char*)&r->index + le32_to_cpu(r->index.entries_offset); @@ -2722,8 +2730,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, *idx = ia_val; return 0; err_out: - if (ctx) - ntfs_attr_put_search_ctx(ctx); + ntfs_attr_put_search_ctx(ctx); free(ia_val); return err; } @@ -3550,54 +3557,46 @@ static int create_hardlink(INDEX_BLOCK *idx, const MFT_REF ref_parent, return 0; } -/** - * init_options - */ -static void init_options(void) -{ - memset(&opts, 0, sizeof(opts)); - opts.sectors_per_track = -1; - opts.heads = -1; - opts.part_start_sect = -1; - g_index_block_size = 4096; - g_attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; - g_attr_defs_len = sizeof(attrdef_ntfs12_array); - /* ntfs_log_debug("Attr_defs table length = %u\n", g_attr_defs_len); */ -} - /** * mkntfs_exit */ static void mkntfs_exit(void) { - free(g_index_block); - free(g_buf_sds_init); - free(g_buf_sds); - free(g_buf); - free(g_buf2); - free(g_lcn_bitmap); - free(g_mft_bitmap); - free(g_rl_mft); - free(g_rl_mft_bmp); - free(g_rl_mftmirr); - free(g_rl_logfile); - free(g_rl_boot); - free(g_rl_bad); - free(g_rl_index); - free(g_bad_blocks); - if ((g_attr_defs != (const ATTR_DEF*)attrdef_ntfs12_array) && - (g_attr_defs != (const ATTR_DEF*)attrdef_ntfs3x_array)) - free(g_attr_defs); - if (!g_vol) - return; - free(g_vol->upcase); - if (g_vol->dev) { - if (NDevOpen(g_vol->dev) && g_vol->dev->d_ops->close(g_vol->dev)) - ntfs_log_error("Warning: Could not close %s: %s\n", - g_vol->dev->d_name, strerror(errno)); - ntfs_device_free(g_vol->dev); + /* Close the volume */ + if (g_vol) { + if (g_vol->dev) { + if (NDevOpen(g_vol->dev) && g_vol->dev->d_ops->close(g_vol->dev)) + ntfs_log_perror("Warning: Could not close %s", g_vol->dev->d_name); + ntfs_device_free(g_vol->dev); + } + free(g_vol->upcase); + free(g_vol); + g_vol = NULL; + } + + /* Free any memory we've used */ + free(g_bad_blocks); g_bad_blocks = NULL; + free(g_buf); g_buf = NULL; + free(g_buf2); g_buf2 = NULL; + free(g_buf_sds); g_buf_sds = NULL; + free(g_buf_sds_init); g_buf_sds_init = NULL; + free(g_index_block); g_index_block = NULL; + free(g_lcn_bitmap); g_lcn_bitmap = NULL; + free(g_mft_bitmap); g_mft_bitmap = NULL; + free(g_rl_bad); g_rl_bad = NULL; + free(g_rl_boot); g_rl_boot = NULL; + free(g_rl_index); g_rl_index = NULL; + free(g_rl_logfile); g_rl_logfile = NULL; + free(g_rl_mft); g_rl_mft = NULL; + free(g_rl_mft_bmp); g_rl_mft_bmp = NULL; + free(g_rl_mftmirr); g_rl_mftmirr = NULL; + + /* Only free the attribute definitions, if we originally allocated them. */ + if ((g_attr_defs != (const ATTR_DEF*)attrdef_ntfs12_array) && + (g_attr_defs != (const ATTR_DEF*)attrdef_ntfs3x_array)) { + free(g_attr_defs); + g_attr_defs = NULL; } - free(g_vol); } /** @@ -3605,8 +3604,12 @@ static void mkntfs_exit(void) * * Note: Might not return. */ -static void mkntfs_open_partition(void) +static int mkntfs_open_partition(void) { + /* This function uses: + * g_vol + */ + int result = 1; int i; struct stat sbuf; unsigned long mnt_flags; @@ -3615,9 +3618,12 @@ static void mkntfs_open_partition(void) * Allocate and initialize an ntfs device structure and attach it to * the volume. */ - if (!(g_vol->dev = ntfs_device_alloc(opts.dev_name, 0, - &ntfs_device_default_io_ops, NULL))) - err_exit("Could not allocate memory for internal buffer.\n"); + g_vol->dev = ntfs_device_alloc(opts.dev_name, 0, &ntfs_device_default_io_ops, NULL); + if (!g_vol->dev) { + ntfs_log_perror("Could not create device"); + goto done; + } + /* Open the device for reading or reading and writing. */ if (opts.no_action) { ntfs_log_quiet("Running in READ-ONLY mode!\n"); @@ -3627,31 +3633,33 @@ static void mkntfs_open_partition(void) } if (g_vol->dev->d_ops->open(g_vol->dev, i)) { if (errno == ENOENT) - err_exit("The device doesn't exist; did you specify " - "it correctly?\n"); - err_exit("Could not open %s: %s\n", g_vol->dev->d_name, - strerror(errno)); + ntfs_log_error("The device doesn't exist; did you specify it correctly?\n"); + else + ntfs_log_perror("Could not open %s", g_vol->dev->d_name); + goto done; } /* Verify we are dealing with a block device. */ if (g_vol->dev->d_ops->stat(g_vol->dev, &sbuf)) { - err_exit("Error getting information about %s: %s\n", - g_vol->dev->d_name, strerror(errno)); + ntfs_log_perror("Error getting information about %s", g_vol->dev->d_name); + goto done; } + if (!S_ISBLK(sbuf.st_mode)) { ntfs_log_error("%s is not a block device.\n", g_vol->dev->d_name); - if (!opts.force) - err_exit("Refusing to make a filesystem here!\n"); - if (opts.num_sectors < 0) { - if (!sbuf.st_size && !sbuf.st_blocks) - err_exit("You must specify the number of " - "sectors.\n"); + if (!opts.force) { + ntfs_log_error("Refusing to make a filesystem here!\n"); + goto done; + } + if (!opts.num_sectors) { + if (!sbuf.st_size && !sbuf.st_blocks) { + ntfs_log_error("You must specify the number of sectors.\n"); + goto done; + } if (opts.sector_size) { if (sbuf.st_size) - opts.num_sectors = sbuf.st_size / - opts.sector_size; + opts.num_sectors = sbuf.st_size / opts.sector_size; else - opts.num_sectors = ((s64)sbuf.st_blocks - << 9) / opts.sector_size; + opts.num_sectors = ((s64)sbuf.st_blocks << 9) / opts.sector_size; } else { if (sbuf.st_size) opts.num_sectors = sbuf.st_size / 512; @@ -3662,28 +3670,29 @@ static void mkntfs_open_partition(void) } ntfs_log_warning("mkntfs forced anyway.\n"); #ifdef HAVE_LINUX_MAJOR_H - } else if ((IDE_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && - MINOR(sbuf.st_rdev) % 64 == 0) || - (SCSI_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && - MINOR(sbuf.st_rdev) % 16 == 0)) { - ntfs_log_error("%s is entire device, not just one partition.\n", - g_vol->dev->d_name); - if (!opts.force) - err_exit("Refusing to make a filesystem here!\n"); + } else if ((IDE_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 64 == 0) || (SCSI_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 16 == 0)) { + ntfs_log_error("%s is entire device, not just one partition.\n", g_vol->dev->d_name); + if (!opts.force) { + ntfs_log_error("Refusing to make a filesystem here!\n"); + goto done; + } ntfs_log_warning("mkntfs forced anyway.\n"); #endif } /* Make sure the file system is not mounted. */ if (ntfs_check_if_mounted(g_vol->dev->d_name, &mnt_flags)) { - ntfs_log_error("Failed to determine whether %s is mounted: %s\n", - g_vol->dev->d_name, strerror(errno)); + ntfs_log_perror("Failed to determine whether %s is mounted", g_vol->dev->d_name); } else if (mnt_flags & NTFS_MF_MOUNTED) { ntfs_log_error("%s is mounted.\n", g_vol->dev->d_name); - if (!opts.force) - err_exit("Refusing to make a filesystem here!\n"); - ntfs_log_warning("mkntfs forced anyway. Hope /etc/mtab is " - "incorrect.\n"); + if (!opts.force) { + ntfs_log_error("Refusing to make a filesystem here!\n"); + goto done; + } + ntfs_log_warning("mkntfs forced anyway. Hope /etc/mtab is incorrect.\n"); } + result = 0; +done: + return result; } /** @@ -3693,6 +3702,11 @@ static void mkntfs_open_partition(void) */ static void mkntfs_override_phys_params(void) { + /* This function uses: + * g_num_clusters + * g_vol + * g_volume_size + */ int i; /* If user didn't specify the sector size, determine it now. */ @@ -3700,10 +3714,10 @@ static void mkntfs_override_phys_params(void) #ifdef BLKSSZGET int sect_size = 0; - if (g_vol->dev->d_ops->ioctl(g_vol->dev, BLKSSZGET, §_size) - >= 0) { + if (g_vol->dev->d_ops->ioctl(g_vol->dev, BLKSSZGET, §_size) >= 0) { opts.sector_size = sect_size; } else + /* XXX UGLY */ #endif { ntfs_log_error("No sector size specified for %s and it could " @@ -3794,6 +3808,7 @@ static void mkntfs_override_phys_params(void) } /* If user didn't specify the number of heads, determine it now. */ if (opts.heads < 0) { + //XXX this will break if sizeof(int) != sizeof(long) -- signextend opts.heads = ntfs_device_heads_get(g_vol->dev); if (opts.heads < 0) { ntfs_log_error("No number of heads specified for %s and it " @@ -3916,6 +3931,17 @@ static void mkntfs_override_phys_params(void) */ static void mkntfs_initialize_bitmaps(void) { + /* This function uses: + * g_lcn_bitmap + * g_lcn_bitmap_byte_size + * g_mft_bitmap + * g_mft_bitmap_byte_size + * g_mft_bitmap_size + * g_mft_size + * g_num_clusters + * g_rl_mft_bmp + * g_vol + */ int i, j; /* Determine lcn bitmap byte size and allocate it. */ @@ -3981,6 +4007,19 @@ static void mkntfs_initialize_bitmaps(void) */ static void mkntfs_initialize_rl_mft(void) { + /* This function uses: + * g_lcn_bitmap + * g_logfile_lcn + * g_mft_lcn + * g_mftmirr_lcn + * g_mft_size + * g_mft_zone_end + * g_num_clusters + * g_rl_mft + * g_rl_mft_bmp + * g_rl_mftmirr + * g_vol + */ int i, j; /* If user didn't specify the mft lcn, determine it now. */ @@ -4071,6 +4110,15 @@ static void mkntfs_initialize_rl_mft(void) */ static void mkntfs_initialize_rl_logfile(void) { + /* This function uses: + * g_lcn_bitmap + * g_logfile_lcn + * g_logfile_size + * g_num_clusters + * g_rl_logfile + * g_vol + * g_volume_size + */ int i, j; /* Create runlist for log file. */ @@ -4132,6 +4180,11 @@ static void mkntfs_initialize_rl_logfile(void) */ static void mkntfs_initialize_rl_boot(void) { + /* This function uses: + * g_lcn_bitmap + * g_rl_boot + * g_vol + */ int i, j; /* Create runlist for $Boot. */ g_rl_boot = malloc(2 * sizeof(runlist)); @@ -4160,6 +4213,10 @@ static void mkntfs_initialize_rl_boot(void) */ static void mkntfs_initialize_rl_bad(void) { + /* This function uses: + * g_num_clusters + * g_rl_bad + */ /* Create runlist for $BadClus, $DATA named stream $Bad. */ g_rl_bad = malloc(2 * sizeof(runlist)); if (!g_rl_bad) @@ -4185,6 +4242,12 @@ static void mkntfs_initialize_rl_bad(void) */ static void mkntfs_fill_device_with_zeroes(void) { + /* This function uses: + * g_buf + * g_num_clusters + * g_vol + * g_volume_size + */ /* * If not quick format, fill the device with 0s. * FIXME: Except bad blocks! (AIA) @@ -4263,6 +4326,10 @@ static void mkntfs_fill_device_with_zeroes(void) static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, ntfschar* name, u32 name_len) { + /* This function uses: + * g_rl_index + * g_vol + */ int i, err; ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; @@ -4395,6 +4462,34 @@ bb_err: */ static void mkntfs_create_root_structures(void) { + /* This function uses: + * g_attr_defs + * g_attr_defs_len + * g_buf + * g_buf_sds + * g_buf_sds_first_size + * g_buf_sds_init + * g_buf_sds_size + * g_index_block + * g_index_block_size + * g_lcn_bitmap + * g_lcn_bitmap_byte_size + * g_logfile_size + * g_mft_bitmap + * g_mft_bitmap_byte_size + * g_mft_lcn + * g_mftmirr_lcn + * g_mft_size + * g_num_clusters + * g_rl_bad + * g_rl_boot + * g_rl_logfile + * g_rl_mft + * g_rl_mft_bmp + * g_rl_mftmirr + * g_vol + * g_volume_obj_id + */ NTFS_BOOT_SECTOR *bs; ATTR_RECORD *a; MFT_RECORD *m; @@ -4973,64 +5068,76 @@ static void mkntfs_create_root_structures(void) } } + /** - * main + * mkntfs_redirect */ -int main(int argc, char **argv) +static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg { - ntfs_attr_search_ctx *ctx; + int result = 1; + ntfs_attr_search_ctx *ctx = NULL; long long lw, pos; ATTR_RECORD *a; MFT_RECORD *m; int i, err; - ntfs_log_set_handler(ntfs_log_handler_outerr); + if (!opts2) { + ntfs_log_error("Internal error: invalid parameters to mkntfs_options.\n"); + goto done; + } - /* Setup the correct locale for string output and conversion. */ - utils_set_locale(); - /* Initialize the random number generator with the current time. */ - srandom(mkntfs_time()); - /* Allocate and initialize ntfs_volume structure g_vol. */ - g_vol = ntfs_volume_alloc(); - if (!g_vol) - err_exit("Could not allocate memory for internal buffer.\n"); /* Register our exit function which will cleanup everything. */ err = atexit(&mkntfs_exit); if (err == -1) { - ntfs_log_error("Could not set up exit() function because atexit() " - "failed. Aborting...\n"); - mkntfs_exit(); - exit(1); + ntfs_log_error("Could not set up exit() function because atexit() failed. Aborting...\n"); + goto done; } - g_vol->major_ver = 1; - g_vol->minor_ver = 2; - g_vol->mft_record_size = 1024; - g_vol->mft_record_size_bits = 10; - /* Length is in unicode characters. */ - g_vol->upcase_len = 65536; - g_vol->upcase = malloc(g_vol->upcase_len * sizeof(ntfschar)); - if (!g_vol->upcase) - err_exit("Could not allocate memory for internal buffer.\n"); - init_upcase_table(g_vol->upcase, g_vol->upcase_len * sizeof(ntfschar)); - /* Initialize opts to zero / required values. */ - init_options(); - mkntfs_init_options(&opts); - /* Parse command line options. */ - if (!mkntfs_parse_options(argc, argv, &opts)) - exit(1); - mkntfs_validate_options(&opts); - + + /* Initialize the random number generator with the current time. */ + srandom(mkntfs_time()); + + /* Allocate and initialize ntfs_volume structure g_vol. */ + g_vol = ntfs_volume_alloc(); + if (!g_vol) { + ntfs_log_perror("Could not create volume"); + goto done; + } + /* transfer some options to the volume */ - g_vol->vol_name = opts.label; // XXX when this be strdup, either free it, or call ntfs_umount + g_vol->vol_name = opts.label; // XXX when this is strdup, either free it, or call ntfs_umount if (opts.ver_major && opts.ver_minor) { g_vol->major_ver = opts.ver_major; g_vol->minor_ver = opts.ver_minor; + } else { + g_vol->major_ver = 1; + g_vol->minor_ver = 2; } if (opts.cluster_size >= 0) g_vol->cluster_size = opts.cluster_size; - /* Open the partition. */ - mkntfs_open_partition(); + g_vol->mft_record_size = 1024; + g_vol->mft_record_size_bits = 10; + + /* Length is in unicode characters. */ + g_vol->upcase_len = 65536; + g_vol->upcase = malloc(g_vol->upcase_len * sizeof(ntfschar)); + if (!g_vol->upcase) { + ntfs_log_perror("Could not create upcase structure"); + goto done; + } + init_upcase_table(g_vol->upcase, g_vol->upcase_len * sizeof(ntfschar)); + + /* Initialize opts to zero / required values. */ + g_index_block_size = 4096; + g_attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; + g_attr_defs_len = sizeof(attrdef_ntfs12_array); + /* ntfs_log_debug("Attr_defs table length = %u\n", g_attr_defs_len); */ + + if (mkntfs_open_partition()) /* Open the partition. */ + goto done; + + //-------------------------------------------------------------------------------- + /* Decide on the sectors/tracks/heads/size, etc. */ mkntfs_override_phys_params(); /* Initialize $Bitmap and $MFT/$BITMAP related stuff. */ @@ -5041,11 +5148,14 @@ int main(int argc, char **argv) mkntfs_initialize_rl_logfile(); /* Initialize $Boot. */ mkntfs_initialize_rl_boot(); + /* Allocate a buffer large enough to hold the mft. */ g_buf = calloc(1, g_mft_size); - if (!g_buf) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); + if (!g_buf) { + ntfs_log_perror("Could not create work space"); + goto done; + } + /* Create runlist for $BadClus, $DATA named stream $Bad. */ mkntfs_initialize_rl_bad(); /* If not quick format, fill the device with 0s. */ @@ -5068,37 +5178,42 @@ int main(int argc, char **argv) * update during each subsequent c&w of each system file. */ ntfs_log_verbose("Syncing root directory index record.\n"); - mkntfs_sync_index_record(g_index_block, (MFT_RECORD*)(g_buf + - 5 * g_vol->mft_record_size), NTFS_INDEX_I30, 4); + mkntfs_sync_index_record(g_index_block, (MFT_RECORD*)(g_buf + 5 * g_vol->mft_record_size), NTFS_INDEX_I30, 4); ntfs_log_verbose("Syncing $Bitmap.\n"); m = (MFT_RECORD*)(g_buf + 6 * g_vol->mft_record_size); + ctx = ntfs_attr_get_search_ctx(NULL, m); - if (!ctx) - err_exit("Failed to allocate attribute search context: %s\n", - strerror(errno)); - if (mkntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { - ntfs_attr_put_search_ctx(ctx); - err_exit("BUG: $DATA attribute not found.\n"); + if (!ctx) { + ntfs_log_perror("Could not create an attribute search context"); + goto done; } + + if (mkntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + ntfs_log_error("BUG: $DATA attribute not found.\n"); + goto done; + } + a = ctx->attr; if (a->non_resident) { runlist *rl = ntfs_mapping_pairs_decompress(g_vol, a, NULL); - ntfs_attr_put_search_ctx(ctx); - if (!rl) - err_exit("ntfs_mapping_pairs_decompress() failed\n"); - lw = ntfs_rlwrite(g_vol->dev, rl, g_lcn_bitmap, - g_lcn_bitmap_byte_size, NULL); + if (!rl) { + ntfs_log_error("ntfs_mapping_pairs_decompress() failed\n"); + goto done; + } + lw = ntfs_rlwrite(g_vol->dev, rl, g_lcn_bitmap, g_lcn_bitmap_byte_size, NULL); err = errno; free(rl); - if (lw != g_lcn_bitmap_byte_size) - err_exit("%s\n", lw == -1 ? strerror(err) : - "unknown error"); + if (lw != g_lcn_bitmap_byte_size) { + ntfs_log_error("%s\n", lw == -1 ? strerror(err) : "unknown error"); + goto done; + } } else { - memcpy((char*)a + le16_to_cpu(a->value_offset), g_lcn_bitmap, - le32_to_cpu(a->value_length)); - ntfs_attr_put_search_ctx(ctx); + memcpy((char*)a + le16_to_cpu(a->value_offset), g_lcn_bitmap, le32_to_cpu(a->value_length)); } + + //-------------------------------------------------------------------------------- + /* * No need to sync $MFT/$BITMAP as that has never been modified since * its creation. @@ -5108,19 +5223,17 @@ int main(int argc, char **argv) lw = 1; for (i = 0; i < g_mft_size / (s32)g_vol->mft_record_size; i++) { if (!opts.no_action) - lw = ntfs_mst_pwrite(g_vol->dev, pos, 1, - g_vol->mft_record_size, - g_buf + i * g_vol->mft_record_size); - if (lw != 1) - err_exit("%s\n", lw == -1 ? strerror(errno) : - "unknown error"); + lw = ntfs_mst_pwrite(g_vol->dev, pos, 1, g_vol->mft_record_size, g_buf + i * g_vol->mft_record_size); + if (lw != 1) { + ntfs_log_error("%s\n", lw == -1 ? strerror(errno) : "unknown error"); + goto done; + } pos += g_vol->mft_record_size; } ntfs_log_verbose("Updating $MFTMirr.\n"); pos = g_mftmirr_lcn * g_vol->cluster_size; lw = 1; - for (i = 0; i < g_rl_mftmirr[0].length * g_vol->cluster_size / - g_vol->mft_record_size; i++) { + for (i = 0; i < g_rl_mftmirr[0].length * g_vol->cluster_size / g_vol->mft_record_size; i++) { u16 usn, *usnp; m = (MFT_RECORD*)(g_buf + i * g_vol->mft_record_size); /* @@ -5135,22 +5248,51 @@ int main(int argc, char **argv) usn = 0xfffe; *usnp = cpu_to_le16(usn); if (!opts.no_action) - lw = ntfs_mst_pwrite(g_vol->dev, pos, 1, - g_vol->mft_record_size, - g_buf + i * g_vol->mft_record_size); - if (lw != 1) - err_exit("%s\n", lw == -1 ? strerror(errno) : - "unknown error"); + lw = ntfs_mst_pwrite(g_vol->dev, pos, 1, g_vol->mft_record_size, g_buf + i * g_vol->mft_record_size); + if (lw != 1) { + ntfs_log_error("%s\n", lw == -1 ? strerror(errno) : "unknown error"); + goto done; + } pos += g_vol->mft_record_size; } ntfs_log_verbose("Syncing device.\n"); - if (g_vol->dev->d_ops->sync(g_vol->dev)) - err_exit("Syncing device. FAILED: %s", strerror(errno)); + if (g_vol->dev->d_ops->sync(g_vol->dev)) { + ntfs_log_error("Syncing device. FAILED"); + goto done; + } ntfs_log_quiet("mkntfs completed successfully. Have a nice day.\n"); - /* - * Device is unlocked and closed by the registered exit function - * mkntfs_exit(). - */ - return 0; + result = 0; +done: + ntfs_attr_put_search_ctx(ctx); + mkntfs_exit(); /* Device is unlocked and closed here */ + return result; +} + + +/** + * main - Begin here + * + * Start from here. + * + * Return: 0 Success, the program worked + * 1 Error, something went wrong + */ +int main(int argc, char *argv[]) +{ + int result = 1; + + ntfs_log_set_handler(ntfs_log_handler_outerr); + utils_set_locale(); + + mkntfs_init_options(&opts); /* Set up the options */ + + if (!mkntfs_parse_options(argc, argv, &opts)) /* Read the command line options */ + goto done; + if (!mkntfs_validate_options(&opts)) /* Validate those options */ + goto done; + + result = mkntfs_redirect(&opts); +done: + return result; } From 23a84fe825692d7b1900e1c8d793d6252fe2a9b7 Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 7 Nov 2005 04:53:28 +0000 Subject: [PATCH 2709/2994] use ntfs_mbstoucs and ntfs_ucstombs (library) instead of stoucs and ucstos (local) fix a few latent bugs where unicode string lengths were handled --- ntfsprogs/mkntfs.c | 208 +++++++++++++-------------------------------- 1 file changed, 61 insertions(+), 147 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index c7df587f..63bad586 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -762,71 +762,6 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, return total; } -/** - * ucstos - convert unicode-character string to ASCII - * @dest: points to buffer to receive the converted string - * @src: points to string to convert - * @maxlen: size of @dest buffer in bytes - * - * Return the number of characters written to @dest, not including the - * terminating null byte. If a unicode character was encountered which could - * not be converted -1 is returned. - */ -static int ucstos(char *dest, const ntfschar *src, int maxlen) -{ - ntfschar u; - int i; - - /* Need one byte for null terminator. */ - maxlen--; - for (i = 0; i < maxlen; i++) { - u = le16_to_cpu(src[i]); - if (!u) - break; - if (u & 0xff00) - return -1; - dest[i] = u & 0xff; - } - dest[i] = 0; - return i; -} - -/** - * stoucs - convert ASCII string to unicode-character string - * @dest: points to buffer to receive the converted string - * @src: points to string to convert - * @maxlen: size of @dest buffer in bytes - * - * Return the number of characters written to @dest, not including the - * terminating null unicode character. - * - * If @maxlen is less than the size of a single unicode character we cannot - * write the terminating null unicode character and hence return -1 with errno - * set to EINVAL. - */ -static int stoucs(ntfschar *dest, const char *src, int maxlen) -{ - char c; - int i; - - if (maxlen < (int)sizeof(ntfschar)) { - errno = EINVAL; - return -1; - } - /* Convert maxlen from bytes to unicode characters. */ - maxlen /= sizeof(ntfschar); - /* Need space for null terminator. */ - maxlen--; - for (i = 0; i < maxlen; i++) { - c = src[i]; - if (!c) - break; - dest[i] = cpu_to_le16(c); - } - dest[i] = cpu_to_le16('\0'); - return i; -} - /** * dump_resident_attr_val * @@ -838,7 +773,7 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) "type yet."; const char *skip = "Skipping display of $%s attribute value.\n"; const char *todo = "This is still work in progress."; - char *b; + char *b = NULL; int i, j; switch (type) { @@ -865,12 +800,8 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) case AT_VOLUME_NAME: printf("Volume name length = %i\n", (unsigned int)val_len); if (val_len) { - b = calloc(1, val_len); - if (!b) - err_exit("Failed to allocate internal buffer: " - "%s\n", strerror(errno)); - i = ucstos(b, (ntfschar*)val, val_len); - if (i == -1) + i = ntfs_ucstombs((ntfschar*)val, val_len, &b, 0); + if (i < 0) printf("Volume name contains non-displayable " "Unicode characters.\n"); printf("Volume name = %s\n", b); @@ -1070,7 +1001,7 @@ static void dump_attr_record(ATTR_RECORD *a) printf("name = %c%c%c%c%c\n", *p, p[1], p[2], p[3], p[4]); } #endif - if (ucstos(s, g_attr_defs[i].name, sizeof(s)) == -1) { + if (ntfs_ucstombs(g_attr_defs[i].name, 0x40, (char**)&s, sizeof(s)) < 0) { ntfs_log_error("Could not convert Unicode string to single " "byte string in current locale.\n"); strncpy(s, "Error converting Unicode string", @@ -1088,9 +1019,8 @@ static void dump_attr_record(ATTR_RECORD *a) cpu_to_le16(a->name_offset)); u = a->flags; if (a->name_length) { - if (ucstos(s, (ntfschar*)((char*)a + - cpu_to_le16(a->name_offset)), - min(sizeof(s), a->name_length + 1U)) == -1) { + if (ntfs_ucstombs((ntfschar*)((char*)a + cpu_to_le16(a->name_offset)), + min(sizeof(s), a->name_length + 1U), (char**)&s, sizeof(s)) < 0) { ntfs_log_error("Could not convert Unicode string to single " "byte string in current locale.\n"); strncpy(s, "Error converting Unicode string", @@ -1647,24 +1577,21 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, int asize, mpa_size, err, i; s64 bw = 0, inited_size; VCN highest_vcn; - ntfschar *uname; + ntfschar *uname = NULL; + int uname_len = 0; /* if (base record) attr_lookup(); else */ - if (name_len) { - i = (name_len + 1) * sizeof(ntfschar); - uname = calloc(1, i); - if (!uname) + if (name) { + uname_len = ntfs_mbstoucs(name, &uname, 0); + if (uname_len < 0) return -errno; - name_len = stoucs(uname, name, i); - if (name_len > 0xff) { + if (uname_len > 0xff) { free(uname); return -ENAMETOOLONG; } - } else { - uname = NULL; } /* Check if the attribute is already there. */ ctx = ntfs_attr_get_search_ctx(NULL, m); @@ -1678,7 +1605,7 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, err = -EOPNOTSUPP; goto err_out; } - if (!mkntfs_attr_lookup(type, uname, name_len, ic, 0, NULL, 0, ctx)) { + if (!mkntfs_attr_lookup(type, uname, uname_len, ic, 0, NULL, 0, ctx)) { err = -EEXIST; goto err_out; } @@ -1834,19 +1761,18 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, int asize, mpa_size, err, i; runlist *rl = NULL; s64 bw = 0; - ntfschar *uname; + ntfschar *uname = NULL; + int uname_len = 0; /* if (base record) attr_lookup(); else */ - if (name_len) { - i = (name_len + 1) * sizeof(ntfschar); - uname = calloc(1, i); - if (!uname) + if (name) { + uname_len = ntfs_mbstoucs(name, &uname, 0); + if (uname_len < 0) return -errno; - name_len = stoucs(uname, name, i); - if (name_len > 0xff) { + if (uname_len > 0xff) { free(uname); return -ENAMETOOLONG; } @@ -1865,7 +1791,7 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, err = -EOPNOTSUPP; goto err_out; } - if (!mkntfs_attr_lookup(type, uname, name_len, ic, 0, NULL, 0, ctx)) { + if (!mkntfs_attr_lookup(type, uname, uname_len, ic, 0, NULL, 0, ctx)) { err = -EEXIST; goto err_out; } @@ -2024,20 +1950,19 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, { ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; - int asize, err, i; - ntfschar *uname; + int asize, err; + ntfschar *uname = NULL; + int uname_len = 0; /* if (base record) mkntfs_attr_lookup(); else */ - if (name_len) { - i = (name_len + 1) * sizeof(ntfschar); - uname = calloc(1, i); - if (!uname) + if (name) { + uname_len = ntfs_mbstoucs(name, &uname, 0); + if (uname_len < 0) return -errno; - name_len = stoucs(uname, name, i); - if (name_len > 0xff) { + if (uname_len > 0xff) { free(uname); return -ENAMETOOLONG; } @@ -2056,7 +1981,7 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, err = -EOPNOTSUPP; goto err_out; } - if (!mkntfs_attr_lookup(type, uname, name_len, ic, 0, val, val_len, + if (!mkntfs_attr_lookup(type, uname, uname_len, ic, 0, val, val_len, ctx)) { err = -EEXIST; goto err_out; @@ -2179,6 +2104,7 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, STANDARD_INFORMATION *si; FILE_NAME_ATTR *fn; int i, fn_size; + ntfschar *uname; /* Check if the attribute is already there. */ ctx = ntfs_attr_get_search_ctx(NULL, m); @@ -2226,7 +2152,8 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); } fn->file_name_type = file_name_type; - i = stoucs(fn->file_name, file_name, i); + uname = fn->file_name; + i = ntfs_mbstoucs(file_name, &uname, i); if (i < 1) { free(fn); return -EINVAL; @@ -2371,31 +2298,23 @@ static int add_attr_data_positioned(MFT_RECORD *m, const char *name, * Return 0 on success or -errno on error. */ static int add_attr_vol_name(MFT_RECORD *m, const char *vol_name, - const int vol_name_len) + const int vol_name_len __attribute__((unused))) { - ntfschar *uname; - int i, len; + ntfschar *uname = NULL; + int uname_len = 0; + int i; - if (vol_name_len) { - len = (vol_name_len + 1) * sizeof(ntfschar); - uname = calloc(1, len); - if (!uname) + if (vol_name) { + uname_len = ntfs_mbstoucs(vol_name, &uname, 0); + if (uname_len < 0) return -errno; - i = (stoucs(uname, vol_name, len) + 1) * sizeof(ntfschar); - if (!i) { - free(uname); - return -EINVAL; - } - if (i > 0xff) { + if (uname_len > 0xff) { free(uname); return -ENAMETOOLONG; } - } else { - uname = NULL; - len = 0; } i = insert_resident_attr_in_mft_record(m, AT_VOLUME_NAME, NULL, 0, 0, - 0, 0, (u8*)uname, len); + 0, 0, (u8*)uname, uname_len*sizeof(ntfschar)); free(uname); if (i < 0) ntfs_log_error("add_attr_vol_name failed: %s\n", strerror(-i)); @@ -2590,18 +2509,17 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, INDEX_ROOT *r; INDEX_ENTRY *re; INDEX_ALLOCATION *ia_val = NULL; - ntfschar *uname; + ntfschar *uname = NULL; + int uname_len = 0; u8 bmp[8]; char *re_start, *re_end; int i, err, index_block_size; - if (name_len) { - i = (name_len + 1) * sizeof(ntfschar); - uname = calloc(1, i); - if (!uname) + if (name) { + uname_len = ntfs_mbstoucs(name, &uname, 0); + if (uname_len < 0) return -errno; - name_len = stoucs(uname, name, i); - if (name_len > 0xff) { + if (uname_len > 0xff) { free(uname); return -ENAMETOOLONG; } @@ -2621,7 +2539,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, free(uname); goto err_out; } - err = mkntfs_attr_lookup(AT_INDEX_ROOT, uname, name_len, ic, 0, NULL, 0, + err = mkntfs_attr_lookup(AT_INDEX_ROOT, uname, uname_len, ic, 0, NULL, 0, ctx); free(uname); if (err) { @@ -3256,14 +3174,10 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, ntfs_log_debug("file_name_attr1->file_name_length = %i\n", file_name->file_name_length); if (file_name->file_name_length) { - char *__buf; - __buf = calloc(1, file_name->file_name_length + 1); - if (!__buf) - err_exit("Failed to allocate internal buffer: " - "%s\n", strerror(errno)); - i = ucstos(__buf, (ntfschar*)&file_name->file_name, - file_name->file_name_length + 1); - if (i == -1) + char *__buf = NULL; + i = ntfs_ucstombs((ntfschar*)&file_name->file_name, + file_name->file_name_length, &__buf, 0); + if (i < 0) ntfs_log_debug("Name contains non-displayable " "Unicode characters.\n"); ntfs_log_debug("file_name_attr1->file_name = %s\n", __buf); @@ -3272,14 +3186,10 @@ static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, MFT_REF file_ref, ntfs_log_debug("file_name_attr2->file_name_length = %i\n", ie->key.file_name.file_name_length); if (ie->key.file_name.file_name_length) { - char *__buf; - __buf = calloc(1, ie->key.file_name.file_name_length + 1); - if (!__buf) - err_exit("Failed to allocate internal buffer: " - "%s\n", strerror(errno)); - i = ucstos(__buf, ie->key.file_name.file_name, - ie->key.file_name.file_name_length + 1); - if (i == -1) + char *__buf = NULL; + i = ntfs_ucstombs(ie->key.file_name.file_name, + ie->key.file_name.file_name_length + 1, &__buf, 0); + if (i < 0) ntfs_log_debug("Name contains non-displayable " "Unicode characters.\n"); ntfs_log_debug("file_name_attr2->file_name = %s\n", __buf); @@ -3369,6 +3279,7 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, FILE_NAME_ATTR *fn; int i, fn_size, idx_size; INDEX_ENTRY *idx_entry_new; + ntfschar *uname; /* Create the file_name attribute. */ i = (strlen(file_name) + 1) * sizeof(ntfschar); @@ -3402,7 +3313,8 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); } fn->file_name_type = file_name_type; - i = stoucs(fn->file_name, file_name, i); + uname = fn->file_name; + i = ntfs_mbstoucs(file_name, &uname, i); if (i < 1) { free(fn); return -EINVAL; @@ -3480,6 +3392,7 @@ static int create_hardlink(INDEX_BLOCK *idx, const MFT_REF ref_parent, { FILE_NAME_ATTR *fn; int i, fn_size; + ntfschar *uname; /* Create the file_name attribute. */ i = (strlen(file_name) + 1) * sizeof(ntfschar); @@ -3509,7 +3422,8 @@ static int create_hardlink(INDEX_BLOCK *idx, const MFT_REF ref_parent, fn->reparse_point_tag = cpu_to_le32(reparse_point_tag); } fn->file_name_type = file_name_type; - i = stoucs(fn->file_name, file_name, i); + uname = fn->file_name; + i = ntfs_mbstoucs(file_name, &uname, i); if (i < 1) { free(fn); return -EINVAL; From a732881c5e823c80fa000eb5aa7a1db98de21d93 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 7 Nov 2005 20:37:07 +0000 Subject: [PATCH 2710/2994] see changelog --- ChangeLog | 9 ++++++ include/ntfs/attrib.h | 20 ++++++------ include/ntfs/inode.h | 17 +--------- include/ntfs/layout.h | 7 +++-- libntfs/attrib.c | 15 +++++---- libntfs/dir.c | 14 +++------ libntfs/inode.c | 68 +++++++++++++++++----------------------- libntfs/mft.c | 3 +- ntfsprogs/ntfsmount.8.in | 6 ++-- ntfsprogs/ntfsmount.c | 49 +++++++++++++++++++---------- 10 files changed, 103 insertions(+), 105 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76a3569b..5d1efc22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -58,6 +58,15 @@ xx/xx/2005 - 1.12.2-WIP - ntfsinfo: dump index attribute keys. (Szaka) - mkntfs: don't fill the last $MFT cluster with empty MFT records. This is needed to conform to Windows' format behavior. (Szaka) + - Add @flags field to struct ntfs_inode. Remove NIno{Sparse,Compressed, + Encrypted}, update all users to use @(ntfs_inode)->flags. (Yura) + - Make @(ntfs_inode)->data_size and @(ntfs_inode)->allocated_size to + always contain valid value. (Yura) + - Always set correct file size and attributes in ntfs_link(). (Yura) + - Add info about Interix special files (symbolic links, character and + block devices, FIFOs and sockets) to layout.h. Teech ntfsmount to + handle them. (Yura) + - Fix allocated data size for resident attributes. (Yura) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index c681ab1a..51f24ee4 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -203,30 +203,30 @@ typedef enum { #define NAttrSetNonResident(na) set_nattr_flag(na, NonResident) #define NAttrClearNonResident(na) clear_nattr_flag(na, NonResident) -#define GenNAttrIno(flag) \ -static inline int NAttr##flag(ntfs_attr *na) \ +#define GenNAttrIno(func_name,flag) \ +static inline int NAttr##func_name(ntfs_attr *na) \ { \ if (na->type == AT_DATA && na->name == AT_UNNAMED) \ - return NIno##flag(na->ni); \ + return (na->ni->flags & FILE_ATTR_##flag); \ return 0; \ } \ -static inline void NAttrSet##flag(ntfs_attr *na) \ +static inline void NAttrSet##func_name(ntfs_attr *na) \ { \ if (na->type == AT_DATA && na->name == AT_UNNAMED) \ - NInoSet##flag(na->ni); \ + na->ni->flags |= FILE_ATTR_##flag; \ else \ ntfs_log_trace("BUG! Should be called only for "\ "unnamed data attribute.\n"); \ } \ -static inline void NAttrClear##flag(ntfs_attr *na) \ +static inline void NAttrClear##func_name(ntfs_attr *na) \ { \ if (na->type == AT_DATA && na->name == AT_UNNAMED) \ - NInoClear##flag(na->ni); \ + na->ni->flags &= ~FILE_ATTR_##flag; \ } -GenNAttrIno(Compressed) -GenNAttrIno(Encrypted) -GenNAttrIno(Sparse) +GenNAttrIno(Compressed, COMPRESSED) +GenNAttrIno(Encrypted, ENCRYPTED) +GenNAttrIno(Sparse, SPARSE_FILE) /* * Union of all known attribute values. For convenience. Used in the attr diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 2dde1afe..22d35c89 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -45,9 +45,6 @@ typedef enum { NI_AttrList, /* 1: Mft record contains an attribute list. */ NI_AttrListDirty, /* 1: Attribute list needs to be written to the mft record and then to disk. */ - NI_Compressed, /* 1: Inode is compressed. */ - NI_Encrypted, /* 1: Inode is encrypted. */ - NI_Sparse, /* 1: Inode is sparse. */ NI_FileNameDirty, /* 1: FILE_NAME attributes need to be updated in the index. */ } ntfs_inode_state_bits; @@ -87,18 +84,6 @@ typedef enum { #define NInoAttrListTestAndSetDirty(ni) test_and_set_nino_al_flag(ni, Dirty) #define NInoAttrListTestAndClearDirty(ni) test_and_clear_nino_al_flag(ni, Dirty) -#define NInoCompressed(ni) test_nino_flag(ni, Compressed) -#define NInoSetCompressed(ni) set_nino_flag(ni, Compressed) -#define NInoClearCompressed(ni) clear_nino_flag(ni, Compressed) - -#define NInoEncrypted(ni) test_nino_flag(ni, Encrypted) -#define NInoSetEncrypted(ni) set_nino_flag(ni, Encrypted) -#define NInoClearEncrypted(ni) clear_nino_flag(ni, Encrypted) - -#define NInoSparse(ni) test_nino_flag(ni, Sparse) -#define NInoSetSparse(ni) set_nino_flag(ni, Sparse) -#define NInoClearSparse(ni) clear_nino_flag(ni, Sparse) - #define NInoFileNameDirty(ni) \ test_nino_flag(ni, FileNameDirty) #define NInoFileNameSetDirty(ni) \ @@ -148,7 +133,7 @@ struct _ntfs_inode { void *private_data; /* ntfs_dt containing this inode */ int ref_count; - /* Below 2 fields needed to update indexes. They valid if != -1. */ + /* Below fields are valid only for base inode. */ s64 data_size; s64 allocated_size; diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index ca981a4d..351aeb71 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -852,9 +852,10 @@ typedef enum { is used to obtain all flags that are valid for reading. */ FILE_ATTR_VALID_SET_FLAGS = const_cpu_to_le32(0x000031a7), /* FILE_ATTR_VALID_SET_FLAGS masks out the old DOS VolId, the - F_A_DEVICE, F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT, - F_A_COMPRESSED and F_A_ENCRYPTED and preserves the rest. This mask - is used to to obtain all flags that are valid for setting. */ + FILE_ATTR_DEVICE, FILE_ATTR_DIRECTORY, FILE_ATTR_SPARSE_FILE, + FILE_ATTR_REPARSE_POINT, FILE_ATRE_COMPRESSED and FILE_ATTR_ENCRYPTED + and preserves the rest. This mask is used to to obtain all flags that + are valid for setting. */ /* * These flags are only present in the FILE_NAME attribute (in the diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 309b5511..72fe9c4a 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -409,9 +409,8 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type, s64 l = le32_to_cpu(a->value_length); ntfs_attr_init(na, FALSE, a->flags & ATTR_IS_COMPRESSED, a->flags & ATTR_IS_ENCRYPTED, - a->flags & ATTR_IS_SPARSE, l, l, l, - cs ? sle64_to_cpu(a->compressed_size) : 0, - cs ? a->compression_unit : 0); + a->flags & ATTR_IS_SPARSE, (l + 7) & ~7, l, l, + cs ? (l + 7) & ~7 : 0, 0); } ntfs_attr_put_search_ctx(ctx); return na; @@ -3702,10 +3701,10 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize) if (!ntfs_resident_attr_value_resize(ctx->mrec, ctx->attr, newsize)) { /* Update the ntfs attribute structure, too. */ - na->allocated_size = na->data_size = - na->initialized_size = newsize; + na->data_size = na->initialized_size = newsize; + na->allocated_size = (newsize + 7) & ~7; if (NAttrCompressed(na) || NAttrSparse(na)) - na->compressed_size = newsize; + na->compressed_size = na->allocated_size; goto resize_done; } /* Error! If not enough space, just continue. */ @@ -4027,8 +4026,8 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) NAttrClearCompressed(na); NAttrClearSparse(na); NAttrClearEncrypted(na); - na->allocated_size = na->initialized_size = na->compressed_size = - na->data_size; + na->initialized_size = na->data_size; + na->allocated_size = na->compressed_size = (na->data_size + 7) & ~7; na->compression_block_size = 0; na->compression_block_size_bits = na->compression_block_clusters = 0; return 0; diff --git a/libntfs/dir.c b/libntfs/dir.c index 6e61686f..f822bee7 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1465,8 +1465,11 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) le16_to_cpu(dir_ni->mrec->sequence_number)); fn->file_name_length = name_len; fn->file_name_type = FILE_NAME_POSIX; + fn->file_attributes = ni->flags; if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) - fn->file_attributes = FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; + fn->file_attributes |= FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; + fn->allocated_size = cpu_to_sle64(ni->allocated_size); + fn->data_size = cpu_to_sle64(ni->data_size); fn->creation_time = utc2ntfs(ni->creation_time); fn->last_data_change_time = utc2ntfs(ni->last_data_change_time); fn->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); @@ -1502,15 +1505,6 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) /* Increment hard links count. */ ni->mrec->link_count = cpu_to_le16(le16_to_cpu( ni->mrec->link_count) + 1); - /* - * Do not set attributes and file size, instead of this mark filenames - * dirty to force attribute and size update during sync. - * NOTE: File size may will be not updated and not all attributes will - * be set, but it is acceptable since windows driver does not update - * all file names when one of the hard links changed. - * FIXME: It will be nice to update them all. - */ - NInoFileNameSetDirty(ni); /* Done! */ ntfs_inode_mark_dirty(ni); free(fn); diff --git a/libntfs/inode.c b/libntfs/inode.c index 2ac28942..bca5c3a1 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -145,8 +145,6 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) goto err_out; } ni->mft_no = MREF(mref); - ni->data_size = -1; - ni->allocated_size = -1; ctx = ntfs_attr_get_search_ctx(ni, NULL); if (!ctx) goto err_out; @@ -160,12 +158,6 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) } std_info = (STANDARD_INFORMATION *)((u8 *)ctx->attr + le16_to_cpu(ctx->attr->value_offset)); - if (std_info->file_attributes & FILE_ATTR_COMPRESSED) - NInoSetCompressed(ni); - if (std_info->file_attributes & FILE_ATTR_ENCRYPTED) - NInoSetEncrypted(ni); - if (std_info->file_attributes & FILE_ATTR_SPARSE_FILE) - NInoSetSparse(ni); ni->flags = std_info->file_attributes; ni->creation_time = ntfs2utc(std_info->creation_time); ni->last_data_change_time = ntfs2utc(std_info->last_data_change_time); @@ -176,9 +168,8 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) ctx)) { if (errno != ENOENT) goto put_err_out; - /* Attribute list attribute not present so we are done. */ - ntfs_attr_put_search_ctx(ctx); - return ni; + /* Attribute list attribute does not present. */ + goto get_size; } NInoSetAttrList(ni); l = ntfs_get_attribute_value_length(ctx->attr); @@ -199,6 +190,27 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref) err = EIO; goto put_err_out; } +get_size: + if (ntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { + if (errno != ENOENT) + goto put_err_out; + /* Directory or special file. */ + ni->data_size = ni->allocated_size = 0; + } else { + if (ctx->attr->non_resident) { + ni->data_size = sle64_to_cpu(ctx->attr->data_size); + if (ctx->attr->flags & + (ATTR_IS_COMPRESSED & ATTR_IS_SPARSE)) + ni->allocated_size = sle64_to_cpu( + ctx->attr->compressed_size); + else + ni->allocated_size = sle64_to_cpu( + ctx->attr->allocated_size); + } else { + ni->data_size = le32_to_cpu(ctx->attr->value_length); + ni->allocated_size = (ni->data_size + 7) & ~7; + } + } ntfs_attr_put_search_ctx(ctx); return ni; put_err_out: @@ -475,18 +487,7 @@ static int ntfs_inode_sync_standard_information(ntfs_inode *ni) } std_info = (STANDARD_INFORMATION *)((u8 *)ctx->attr + le16_to_cpu(ctx->attr->value_offset)); - if (NInoCompressed(ni)) - std_info->file_attributes |= FILE_ATTR_COMPRESSED; - else - std_info->file_attributes &= ~FILE_ATTR_COMPRESSED; - if (NInoEncrypted(ni)) - std_info->file_attributes |= FILE_ATTR_ENCRYPTED; - else - std_info->file_attributes &= ~FILE_ATTR_ENCRYPTED; - if (NInoSparse(ni)) - std_info->file_attributes |= FILE_ATTR_SPARSE_FILE; - else - std_info->file_attributes &= ~FILE_ATTR_SPARSE_FILE; + std_info->file_attributes = ni->flags; std_info->creation_time = utc2ntfs(ni->creation_time); std_info->last_data_change_time = utc2ntfs(ni->last_data_change_time); std_info->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); @@ -562,22 +563,11 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni) } /* Update flags and file size. */ fn = (FILE_NAME_ATTR *)ictx->data; - if (NInoCompressed(ni)) - fn->file_attributes |= FILE_ATTR_COMPRESSED; - else - fn->file_attributes &= ~FILE_ATTR_COMPRESSED; - if (NInoEncrypted(ni)) - fn->file_attributes |= FILE_ATTR_ENCRYPTED; - else - fn->file_attributes &= ~FILE_ATTR_ENCRYPTED; - if (NInoSparse(ni)) - fn->file_attributes |= FILE_ATTR_SPARSE_FILE; - else - fn->file_attributes &= ~FILE_ATTR_SPARSE_FILE; - if (ni->allocated_size != -1) - fn->allocated_size = cpu_to_sle64(ni->allocated_size); - if (ni->data_size != -1) - fn->data_size = cpu_to_sle64(ni->data_size); + fn->file_attributes = + (fn->file_attributes & ~FILE_ATTR_VALID_FLAGS) | + (ni->flags & FILE_ATTR_VALID_FLAGS); + fn->allocated_size = cpu_to_sle64(ni->allocated_size); + fn->data_size = cpu_to_sle64(ni->data_size); fn->creation_time = utc2ntfs(ni->creation_time); fn->last_data_change_time = utc2ntfs(ni->last_data_change_time); fn->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); diff --git a/libntfs/mft.c b/libntfs/mft.c index d33fb91e..32974328 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -1459,7 +1459,8 @@ mft_rec_already_initialized: /* Make sure the allocated inode is written out to disk later. */ ntfs_inode_mark_dirty(ni); /* Initialize time, allocated and data size in ntfs_inode struct. */ - ni->data_size = ni->allocated_size = -1; + ni->data_size = ni->allocated_size = 0; + ni->flags = 0; ni->creation_time = ni->last_data_change_time = ni->last_mft_change_time = ni->last_access_time = time(NULL); diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 68b94b7a..c1625e6c 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -22,9 +22,11 @@ is recommended, but not mandatory. .TP .B Fully implemented ntfsmount features are: -* Read-only access to normal, sparse and compressed files. +* Read-write access to normal and sparse files. -* Overwrite normal and sparse files *with* changes to size. +* Read-only access to compressed files. + +* Access to special Interix files (symlinks, devices, FIFOs). * List/Read/Write/Add/Remove named data streams. diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 6ac47667..1925da85 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -312,13 +312,40 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) } stbuf->st_nlink = 1; /* Needed for correct find work. */ } else { - /* Regular or INTX file. */ + /* Regular or Interix (INTX) file. */ stbuf->st_mode = S_IFREG; - na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len); - if (na) { - /* Check whether it's special INTX file. */ - if ((ni->flags & FILE_ATTR_SYSTEM) && na->data_size <= - sizeof(INTX_FILE_TYPES) + sizeof( + stbuf->st_size = ni->data_size; + stbuf->st_blocks = ni->allocated_size >> vol->sector_size_bits; + stbuf->st_mode |= (0777 & ~ctx->fmask); + stbuf->st_nlink = le16_to_cpu(ni->mrec->link_count); + if (ni->flags & FILE_ATTR_SYSTEM || stream_name_len) { + na = ntfs_attr_open(ni, AT_DATA, stream_name, + stream_name_len); + if (!na) { + if (stream_name_len) + res = -ENOENT; + goto exit; + } + if (stream_name_len) { + stbuf->st_size = na->data_size; + stbuf->st_blocks = na->allocated_size >> + vol->sector_size_bits; + } + /* Check whether it's Interix fifo or socket. */ + if (!(ni->flags & FILE_ATTR_HIDDEN) && + !stream_name_len) { + /* FIFO. */ + if (na->data_size == 0) + stbuf->st_mode = S_IFIFO; + /* Socket link. */ + if (na->data_size == 1) + stbuf->st_mode = S_IFSOCK; + } + /* + * Check wheter it's Interix symbolic link, block or + * character device. + */ + if (na->data_size <= sizeof(INTX_FILE_TYPES) + sizeof( ntfschar) * MAX_PATH && na->data_size > sizeof(INTX_FILE_TYPES) && !stream_name_len) { @@ -359,18 +386,8 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) stbuf->st_mode = S_IFLNK; free(intx_file); } - stbuf->st_size = na->data_size; - stbuf->st_blocks = na->allocated_size >> - vol->sector_size_bits; ntfs_attr_close(na); - } else { - stbuf->st_size = 0; - stbuf->st_blocks = 0; - if (stream_name_len) - res = -ENOENT; } - stbuf->st_mode |= (0777 & ~ctx->fmask); - stbuf->st_nlink = le16_to_cpu(ni->mrec->link_count); } stbuf->st_uid = ctx->uid; stbuf->st_gid = ctx->gid; From 594c23aff0859d0934a14d7cbf8b62ff74dcb2b5 Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 7 Nov 2005 20:49:18 +0000 Subject: [PATCH 2711/2994] ntfsclone: check available free space on the destination --- ChangeLog | 2 ++ configure.ac | 5 +++-- ntfsprogs/ntfsclone.c | 29 ++++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d1efc22..d9437578 100644 --- a/ChangeLog +++ b/ChangeLog @@ -67,6 +67,8 @@ xx/xx/2005 - 1.12.2-WIP block devices, FIFOs and sockets) to layout.h. Teech ntfsmount to handle them. (Yura) - Fix allocated data size for resident attributes. (Yura) + - ntfsclone: check available free space on the destination before + starting to clone or restore. (Szaka) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/configure.ac b/configure.ac index 03b85204..1754521f 100644 --- a/configure.ac +++ b/configure.ac @@ -311,8 +311,9 @@ AC_CHECK_HEADERS([ctype.h fcntl.h libintl.h limits.h locale.h mntent.h \ stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h strings.h \ errno.h time.h unistd.h utime.h wchar.h getopt.h features.h endian.h \ byteswap.h sys/byteorder.h sys/endian.h sys/param.h sys/ioctl.h \ - sys/mount.h sys/stat.h sys/types.h sys/vfs.h linux/major.h linux/fd.h \ - linux/hdreg.h machine/endian.h gcrypt.h windows.h gnutls/pkcs12.h]) + sys/mount.h sys/stat.h sys/types.h sys/vfs.h sys/statvfs.h \ + linux/major.h linux/fd.h linux/hdreg.h machine/endian.h gcrypt.h \ + windows.h gnutls/pkcs12.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index b95c477b..c6ee044f 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -34,7 +34,10 @@ #include #endif #ifdef HAVE_SYS_VFS_H -# include +#include +#endif +#ifdef HAVE_SYS_STATVFS_H +#include #endif #ifdef HAVE_FCNTL_H #include @@ -1444,6 +1447,28 @@ static void ignore_bad_clusters(ntfs_walk_clusters_ctx *image) perr_exit("ntfs_inode_close failed for $BadClus"); } +static void check_dest_free_space(u64 src_bytes) +{ + u64 dest_bytes; + struct statvfs stvfs; + + if (opt.save_image || opt.metadata_only || opt.blkdev_out || opt.std_out) + return; + + if (fstatvfs(fd_out, &stvfs) == -1) { + Printf("WARNING: Unknown free space on the destination: %s\n", + strerror(errno)); + return; + } + + dest_bytes = stvfs.f_bsize * stvfs.f_bfree; + + if (dest_bytes < src_bytes) + err_exit("Destination has no enough free space: %llu MB < %llu" + " MB\n", rounded_up_division(dest_bytes, NTFS_MBYTE), + rounded_up_division(src_bytes, NTFS_MBYTE)); +} + int main(int argc, char **argv) { ntfs_walk_clusters_ctx image; @@ -1504,6 +1529,8 @@ int main(int argc, char **argv) compare_bitmaps(&lcn_bitmap); print_disk_usage(vol->cluster_size, vol->nr_clusters, image.inuse); + check_dest_free_space(vol->cluster_size * image.inuse); + ignore_bad_clusters(&image); if (opt.save_image) From da654b420734c7db80e0bddc046c71de51ccba6a Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 7 Nov 2005 21:13:31 +0000 Subject: [PATCH 2712/2994] shortened opt.metadata_only to opt.metadata --- ntfsprogs/ntfsclone.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index c6ee044f..ee63abb1 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -95,7 +95,7 @@ struct { int overwrite; int std_out; int blkdev_out; /* output file is block device */ - int metadata_only; + int metadata; /* metadata only cloning */ int ignore_fs_check; int rescue; int save_image; @@ -304,7 +304,7 @@ static void parse_options(int argc, char **argv) case '?': usage(); case 'm': - opt.metadata_only++; + opt.metadata++; break; case 'O': opt.overwrite++; @@ -344,18 +344,18 @@ static void parse_options(int argc, char **argv) usage(); } - if (opt.metadata_only && opt.save_image) + if (opt.metadata && opt.save_image) err_exit("Saving only metadata to an image is not " "supported!\n"); - if (opt.metadata_only && opt.restore_image) + if (opt.metadata && opt.restore_image) err_exit("Restoring only metadata from an image is not " "supported!\n"); - if (opt.metadata_only && opt.std_out) + if (opt.metadata && opt.std_out) err_exit("Cloning only metadata to stdout isn't supported!\n"); - if (opt.ignore_fs_check && !opt.metadata_only) + if (opt.ignore_fs_check && !opt.metadata) err_exit("Filesystem check can be ignored only for metadata " "cloning!\n"); @@ -377,7 +377,7 @@ static void parse_options(int argc, char **argv) if (S_ISBLK(st.st_mode)) { opt.blkdev_out = 1; - if (opt.metadata_only) + if (opt.metadata) err_exit("Cloning only metadata to a " "block device isn't supported!\n"); } @@ -589,7 +589,7 @@ static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl) { s64 i, len; /* number of clusters to copy */ - if (opt.std_out || !opt.metadata_only) + if (opt.std_out || !opt.metadata) return; if (!(len = is_critical_metadata(image, rl))) @@ -822,7 +822,7 @@ static void walk_runs(struct ntfs_walk_cluster *walk) walk->image->inuse += lcn_length; } - if (!wipe && !opt.std_out && opt.metadata_only && + if (!wipe && !opt.std_out && opt.metadata && walk->image->ni->mft_no == FILE_LogFile && walk->image->ctx->attr->type == AT_DATA) clone_logfile_parts(walk->image, rl); @@ -1452,7 +1452,7 @@ static void check_dest_free_space(u64 src_bytes) u64 dest_bytes; struct statvfs stvfs; - if (opt.save_image || opt.metadata_only || opt.blkdev_out || opt.std_out) + if (opt.save_image || opt.metadata || opt.blkdev_out || opt.std_out) return; if (fstatvfs(fd_out, &stvfs) == -1) { @@ -1538,7 +1538,7 @@ int main(int argc, char **argv) /* FIXME: save backup boot sector */ - if (opt.std_out || !opt.metadata_only) { + if (opt.std_out || !opt.metadata) { s64 nr_clusters_to_save = image.inuse; if (opt.std_out && !opt.save_image) nr_clusters_to_save = vol->nr_clusters; From caa0bf5c4be8067e23320c075c0e2ce1d31a582a Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 7 Nov 2005 21:38:58 +0000 Subject: [PATCH 2713/2994] metadata cloning: wipe metadata timestamps too --- ntfsprogs/ntfsclone.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index ee63abb1..6a0790c2 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -717,9 +717,6 @@ static void wipe_timestamps(ntfs_walk_clusters_ctx *image) { ATTR_RECORD *a = image->ctx->attr; - if (image->ni->mft_no <= LAST_METADATA_INODE) - return; - if (a->type == AT_FILE_NAME) WIPE_TIMESTAMPS(FILE_NAME_ATTR, a); From 1e3ce5d1dd99a352e6829b8e24787ccc2bfafb4b Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 7 Nov 2005 22:22:43 +0000 Subject: [PATCH 2714/2994] FILE_ATTR_DUP_VIEW_INDEX_PRESENT is also present in $STANDARD_INFORMATION on 3.x volumes --- include/ntfs/layout.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 351aeb71..cce72fc2 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -858,8 +858,8 @@ typedef enum { are valid for setting. */ /* - * These flags are only present in the FILE_NAME attribute (in the - * field file_attributes). + * FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT is only present in the + * FILE_NAME attribute (in the field file_attributes). */ FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT = const_cpu_to_le32(0x10000000), /* This is a copy of the corresponding bit from the mft record, telling From c1fb378985cfc1b5fdd262587cdf564183c7046e Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 7 Nov 2005 22:28:46 +0000 Subject: [PATCH 2715/2994] VIEW_INDEX is also present in $STANDARD_INFORMATION --- ntfsprogs/ntfsinfo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 56963333..c2c32190 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -489,10 +489,10 @@ static void ntfs_dump_flags(ATTR_TYPES type, u32 flags) printf(" FILE_NAME_INDEX"); flags &= ~FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; } - if (flags & FILE_ATTR_DUP_VIEW_INDEX_PRESENT) { - printf(" VIEW_INDEX"); - flags &= ~FILE_ATTR_DUP_VIEW_INDEX_PRESENT; - } + } + if (flags & FILE_ATTR_DUP_VIEW_INDEX_PRESENT) { + printf(" VIEW_INDEX"); + flags &= ~FILE_ATTR_DUP_VIEW_INDEX_PRESENT; } if (flags) printf(" UNKNOWN: 0x%x", (unsigned int)le32_to_cpu(flags)); From 53446b07f88cf3b0a20618c7ecc2ca6dbaba0cc1 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 8 Nov 2005 15:15:37 +0000 Subject: [PATCH 2716/2994] - Change @type parameter for ntfs_create() to be dev_t rather than internal NTFS_DT_* constants. - Teech ntfs_create() to create FIFOs and sockets. --- ChangeLog | 2 ++ include/ntfs/dir.h | 2 +- libntfs/dir.c | 37 ++++++++++++++++++++++++++----------- ntfsprogs/ntfsmount.c | 17 +++++++++++------ 4 files changed, 40 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9437578..6a358524 100644 --- a/ChangeLog +++ b/ChangeLog @@ -69,6 +69,8 @@ xx/xx/2005 - 1.12.2-WIP - Fix allocated data size for resident attributes. (Yura) - ntfsclone: check available free space on the destination before starting to clone or restore. (Szaka) + - Change @type parameter for ntfs_create() to be dev_t rather than + internal NTFS_DT_* constants. (Yura) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index 49fc88fc..d15c0424 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -49,7 +49,7 @@ extern ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent, const char *pathname); extern ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, - const unsigned type); + dev_t type); extern int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len); extern int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, diff --git a/libntfs/dir.c b/libntfs/dir.c index f822bee7..f5dd2428 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -34,6 +34,9 @@ #ifdef HAVE_STRING_H #include #endif +#ifdef HAVE_SYS_STAT_H +#include +#endif #include "types.h" #include "debug.h" @@ -1069,20 +1072,24 @@ err_out: } /** - * ntfs_create - create file or directory on ntfs volume + * ntfs_create - create object on ntfs volume * @dir_ni: ntfs inode for directory in which create new object * @name: unicode name of new object * @name_len: length of the name in unicode characters * @type: type of the object to create * - * @type can be either NTFS_DT_REG to create regular file or NTFS_DT_DIR to - * create directory, other valuer are invalid. + * @type can be: + * S_IFREG to create regular file + * S_IFDIR to create directory + * S_IFIFO to create FIFO + * S_IFSOCK to create socket + * other valuer are invalid. * - * Return opened ntfs inode that describes created file on success or NULL + * Return opened ntfs inode that describes created object on success or NULL * on error with errno set to the error code. */ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, - const unsigned type) + dev_t type) { ntfs_inode *ni; FILE_NAME_ATTR *fn = NULL; @@ -1091,8 +1098,9 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, ntfs_log_trace("Entering.\n"); /* Sanity checks. */ - if (!dir_ni || !name || !name_len || - (type != NTFS_DT_REG && type != NTFS_DT_DIR)) { + if (!dir_ni || !name || !name_len || (type != S_IFREG && + type != S_IFDIR && type != S_IFIFO && + type != S_IFSOCK)) { ntfs_log_error("Invalid arguments."); return NULL; } @@ -1117,6 +1125,10 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, si->last_data_change_time = utc2ntfs(ni->last_data_change_time); si->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); si->last_access_time = utc2ntfs(ni->last_access_time); + if (type == S_IFSOCK || type == S_IFIFO) { + si->file_attributes = FILE_ATTR_SYSTEM; + ni->flags = FILE_ATTR_SYSTEM; + } /* Add STANDARD_INFORMATION to inode. */ if (ntfs_attr_add(ni, AT_STANDARD_INFORMATION, AT_UNNAMED, 0, (u8*)si, si_len)) { @@ -1124,7 +1136,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, ntfs_log_error("Failed to add STANDARD_INFORMATION attribute."); goto err_out; } - if (type == NTFS_DT_DIR) { + if (type == S_IFDIR) { INDEX_ROOT *ir = NULL; INDEX_ENTRY *ie; int ir_len, index_len; @@ -1164,7 +1176,8 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, } } else { /* Add DATA attribute to inode. */ - if (ntfs_attr_add(ni, AT_DATA, AT_UNNAMED, 0, NULL, 0)) { + if (ntfs_attr_add(ni, AT_DATA, AT_UNNAMED, 0, NULL, + (type == S_IFSOCK) ? 1 : 0)) { err = errno; ntfs_log_error("Failed to add DATA attribute."); goto err_out; @@ -1182,8 +1195,10 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, le16_to_cpu(dir_ni->mrec->sequence_number)); fn->file_name_length = name_len; fn->file_name_type = FILE_NAME_POSIX; - if (type == NTFS_DT_DIR) + if (type == S_IFDIR) fn->file_attributes = FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; + if (type == S_IFIFO || type == S_IFSOCK) + fn->file_attributes = FILE_ATTR_SYSTEM; fn->creation_time = utc2ntfs(ni->creation_time); fn->last_data_change_time = utc2ntfs(ni->last_data_change_time); fn->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); @@ -1204,7 +1219,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, } /* Set hard links count and directory flag. */ ni->mrec->link_count = cpu_to_le16(1); - if (type == NTFS_DT_DIR) + if (type == S_IFDIR) ni->mrec->flags |= MFT_RECORD_IS_DIRECTORY; ntfs_inode_mark_dirty(ni); /* Done! */ diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 1925da85..7ae3318a 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -316,7 +316,6 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) stbuf->st_mode = S_IFREG; stbuf->st_size = ni->data_size; stbuf->st_blocks = ni->allocated_size >> vol->sector_size_bits; - stbuf->st_mode |= (0777 & ~ctx->fmask); stbuf->st_nlink = le16_to_cpu(ni->mrec->link_count); if (ni->flags & FILE_ATTR_SYSTEM || stream_name_len) { na = ntfs_attr_open(ni, AT_DATA, stream_name, @@ -388,6 +387,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf) } ntfs_attr_close(na); } + stbuf->st_mode |= (0777 & ~ctx->fmask); } stbuf->st_uid = ctx->uid; stbuf->st_gid = ctx->gid; @@ -703,7 +703,7 @@ static int ntfs_fuse_chmod(const char *path, return -EOPNOTSUPP; } -static int ntfs_fuse_create(const char *org_path, const unsigned type) +static int ntfs_fuse_create(const char *org_path, dev_t type) { char *name; ntfschar *uname = NULL; @@ -759,7 +759,7 @@ static int ntfs_fuse_create_stream(const char *path, * If such file does not exist, create it and try once * again to add stream to it. */ - res = ntfs_fuse_create(path, NTFS_DT_REG); + res = ntfs_fuse_create(path, S_IFREG); if (!res) return ntfs_fuse_create_stream(path, stream_name, stream_name_len); @@ -783,16 +783,21 @@ static int ntfs_fuse_mknod(const char *org_path, mode_t mode, int stream_name_len; int res = 0; - if (mode && !(mode & S_IFREG)) + if (mode && !(mode & (S_IFREG | S_IFIFO | S_IFSOCK))) return -EOPNOTSUPP; stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); if (stream_name_len < 0) return stream_name_len; + if (stream_name_len && mode && !(mode & S_IFREG)) { + res = -EINVAL; + goto exit; + } if (!stream_name_len) - res = ntfs_fuse_create(path, NTFS_DT_REG); + res = ntfs_fuse_create(path, mode & S_IFMT); else res = ntfs_fuse_create_stream(path, stream_name, stream_name_len); +exit: free(path); if (stream_name_len) free(stream_name); @@ -963,7 +968,7 @@ static int ntfs_fuse_mkdir(const char *path, { if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; /* n/a for named data streams. */ - return ntfs_fuse_create(path, NTFS_DT_DIR); + return ntfs_fuse_create(path, S_IFDIR); } static int ntfs_fuse_rmdir(const char *path) From 2c3dfcba27c2869e487ad4f93356f37a101efe4f Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 8 Nov 2005 16:13:17 +0000 Subject: [PATCH 2717/2994] Teech ntfs_create() to create Interix charcter and block devices. Add @dev parameter to ntfs_create() for this. --- ChangeLog | 3 +++ include/ntfs/dir.h | 2 +- libntfs/dir.c | 52 ++++++++++++++++++++++++++++++++++++++----- ntfsprogs/ntfsmount.c | 16 ++++++------- 4 files changed, 58 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a358524..d689c476 100644 --- a/ChangeLog +++ b/ChangeLog @@ -71,6 +71,9 @@ xx/xx/2005 - 1.12.2-WIP starting to clone or restore. (Szaka) - Change @type parameter for ntfs_create() to be dev_t rather than internal NTFS_DT_* constants. (Yura) + - Teech ntfs_create() to create special Interix files (charcter and + block devices, FIFOs and sockets). Add @dev parameter to ntfs_create() + for this. (Yura) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index d15c0424..c6170e4f 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -49,7 +49,7 @@ extern ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent, const char *pathname); extern ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, - dev_t type); + dev_t type, dev_t dev); extern int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len); extern int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, diff --git a/libntfs/dir.c b/libntfs/dir.c index f5dd2428..2e0009f4 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1077,19 +1077,25 @@ err_out: * @name: unicode name of new object * @name_len: length of the name in unicode characters * @type: type of the object to create + * @dev: major and minor device numbers (obtained from makedev()) * * @type can be: * S_IFREG to create regular file * S_IFDIR to create directory + * S_IFBLK to create block device + * S_IFCHR to create character device * S_IFIFO to create FIFO * S_IFSOCK to create socket * other valuer are invalid. * + * @dev is only used if @type is S_IFBLK or S_IFCHR, in other cases it's value + * is ignored. + * * Return opened ntfs inode that describes created object on success or NULL * on error with errno set to the error code. */ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, - dev_t type) + dev_t type, dev_t dev) { ntfs_inode *ni; FILE_NAME_ATTR *fn = NULL; @@ -1100,7 +1106,8 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, /* Sanity checks. */ if (!dir_ni || !name || !name_len || (type != S_IFREG && type != S_IFDIR && type != S_IFIFO && - type != S_IFSOCK)) { + type != S_IFSOCK && type != S_IFCHR && + type != S_IFBLK)) { ntfs_log_error("Invalid arguments."); return NULL; } @@ -1125,7 +1132,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, si->last_data_change_time = utc2ntfs(ni->last_data_change_time); si->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); si->last_access_time = utc2ntfs(ni->last_access_time); - if (type == S_IFSOCK || type == S_IFIFO) { + if (type != S_IFREG && type != S_IFDIR) { si->file_attributes = FILE_ATTR_SYSTEM; ni->flags = FILE_ATTR_SYSTEM; } @@ -1175,13 +1182,46 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, goto err_out; } } else { + INTX_FILE *data; + int data_len; + + switch (type) { + case S_IFBLK: + case S_IFCHR: + data_len = offsetof(INTX_FILE, device_end); + data = malloc(data_len); + if (!data) { + err = errno; + ntfs_log_error("Not enough memory for " + "content of DATA " + "attribute.\n"); + goto err_out; + } + data->major = cpu_to_le64(major(dev)); + data->minor = cpu_to_le64(minor(dev)); + if (type == S_IFBLK) + data->magic = INTX_BLOCK_DEVICE; + if (type == S_IFCHR) + data->magic = INTX_CHARACTER_DEVICE; + break; + case S_IFSOCK: + data = NULL; + data_len = 1; + break; + default: + data = NULL; + data_len = 0; + break; + } /* Add DATA attribute to inode. */ - if (ntfs_attr_add(ni, AT_DATA, AT_UNNAMED, 0, NULL, - (type == S_IFSOCK) ? 1 : 0)) { + if (ntfs_attr_add(ni, AT_DATA, AT_UNNAMED, 0, (u8*)data, + data_len)) { err = errno; ntfs_log_error("Failed to add DATA attribute."); goto err_out; } + if (data) + free(data); } /* Create FILE_NAME attribute. */ fn_len = sizeof(FILE_NAME_ATTR) + name_len * sizeof(ntfschar); @@ -1197,7 +1237,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, fn->file_name_type = FILE_NAME_POSIX; if (type == S_IFDIR) fn->file_attributes = FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; - if (type == S_IFIFO || type == S_IFSOCK) + if (type != S_IFREG && type != S_IFDIR) fn->file_attributes = FILE_ATTR_SYSTEM; fn->creation_time = utc2ntfs(ni->creation_time); fn->last_data_change_time = utc2ntfs(ni->last_data_change_time); diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 7ae3318a..dd523fb2 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -703,7 +703,7 @@ static int ntfs_fuse_chmod(const char *path, return -EOPNOTSUPP; } -static int ntfs_fuse_create(const char *org_path, dev_t type) +static int ntfs_fuse_create(const char *org_path, dev_t type, dev_t dev) { char *name; ntfschar *uname = NULL; @@ -732,7 +732,7 @@ static int ntfs_fuse_create(const char *org_path, dev_t type) goto exit; } /* Create object specified in @type. */ - ni = ntfs_create(dir_ni, uname, uname_len, type); + ni = ntfs_create(dir_ni, uname, uname_len, type, dev); if (ni) ntfs_inode_close(ni); else @@ -759,7 +759,7 @@ static int ntfs_fuse_create_stream(const char *path, * If such file does not exist, create it and try once * again to add stream to it. */ - res = ntfs_fuse_create(path, S_IFREG); + res = ntfs_fuse_create(path, S_IFREG, 0); if (!res) return ntfs_fuse_create_stream(path, stream_name, stream_name_len); @@ -775,15 +775,15 @@ static int ntfs_fuse_create_stream(const char *path, return res; } -static int ntfs_fuse_mknod(const char *org_path, mode_t mode, - dev_t dev __attribute__((unused))) +static int ntfs_fuse_mknod(const char *org_path, mode_t mode, dev_t dev) { char *path = NULL; ntfschar *stream_name; int stream_name_len; int res = 0; - if (mode && !(mode & (S_IFREG | S_IFIFO | S_IFSOCK))) + if (mode && !(mode & + (S_IFREG | S_IFIFO | S_IFSOCK | S_IFCHR | S_IFBLK))) return -EOPNOTSUPP; stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); if (stream_name_len < 0) @@ -793,7 +793,7 @@ static int ntfs_fuse_mknod(const char *org_path, mode_t mode, goto exit; } if (!stream_name_len) - res = ntfs_fuse_create(path, mode & S_IFMT); + res = ntfs_fuse_create(path, mode & S_IFMT, dev); else res = ntfs_fuse_create_stream(path, stream_name, stream_name_len); @@ -968,7 +968,7 @@ static int ntfs_fuse_mkdir(const char *path, { if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; /* n/a for named data streams. */ - return ntfs_fuse_create(path, S_IFDIR); + return ntfs_fuse_create(path, S_IFDIR, 0); } static int ntfs_fuse_rmdir(const char *path) From 1254b2951cf5a2da3ab38ad271ad6092c01c6db6 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 8 Nov 2005 19:49:52 +0000 Subject: [PATCH 2718/2994] Fix stupidness introduced in latest changesets. Thanks to Yuval for comments. --- ChangeLog | 2 +- libntfs/dir.c | 14 +++++++------- ntfsprogs/ntfsmount.c | 5 +---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index d689c476..610774ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -71,7 +71,7 @@ xx/xx/2005 - 1.12.2-WIP starting to clone or restore. (Szaka) - Change @type parameter for ntfs_create() to be dev_t rather than internal NTFS_DT_* constants. (Yura) - - Teech ntfs_create() to create special Interix files (charcter and + - Teach ntfs_create() to create special Interix files (charcter and block devices, FIFOs and sockets). Add @dev parameter to ntfs_create() for this. (Yura) diff --git a/libntfs/dir.c b/libntfs/dir.c index 2e0009f4..811f6fef 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1086,7 +1086,7 @@ err_out: * S_IFCHR to create character device * S_IFIFO to create FIFO * S_IFSOCK to create socket - * other valuer are invalid. + * other values are invalid. * * @dev is only used if @type is S_IFBLK or S_IFCHR, in other cases it's value * is ignored. @@ -1132,7 +1132,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, si->last_data_change_time = utc2ntfs(ni->last_data_change_time); si->last_mft_change_time = utc2ntfs(ni->last_mft_change_time); si->last_access_time = utc2ntfs(ni->last_access_time); - if (type != S_IFREG && type != S_IFDIR) { + if (!S_ISREG(type) && !S_ISDIR(type)) { si->file_attributes = FILE_ATTR_SYSTEM; ni->flags = FILE_ATTR_SYSTEM; } @@ -1143,7 +1143,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, ntfs_log_error("Failed to add STANDARD_INFORMATION attribute."); goto err_out; } - if (type == S_IFDIR) { + if (S_ISDIR(type)) { INDEX_ROOT *ir = NULL; INDEX_ENTRY *ie; int ir_len, index_len; @@ -1208,7 +1208,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, data = NULL; data_len = 1; break; - default: + default: /* FIFO or regular file. */ data = NULL; data_len = 0; break; @@ -1235,9 +1235,9 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, le16_to_cpu(dir_ni->mrec->sequence_number)); fn->file_name_length = name_len; fn->file_name_type = FILE_NAME_POSIX; - if (type == S_IFDIR) + if (S_ISDIR(type)) fn->file_attributes = FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; - if (type != S_IFREG && type != S_IFDIR) + if (!S_ISREG(type) && !S_ISDIR(type)) fn->file_attributes = FILE_ATTR_SYSTEM; fn->creation_time = utc2ntfs(ni->creation_time); fn->last_data_change_time = utc2ntfs(ni->last_data_change_time); @@ -1259,7 +1259,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, } /* Set hard links count and directory flag. */ ni->mrec->link_count = cpu_to_le16(1); - if (type == S_IFDIR) + if (S_ISDIR(type)) ni->mrec->flags |= MFT_RECORD_IS_DIRECTORY; ntfs_inode_mark_dirty(ni); /* Done! */ diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index dd523fb2..0b5a8c67 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -782,13 +782,10 @@ static int ntfs_fuse_mknod(const char *org_path, mode_t mode, dev_t dev) int stream_name_len; int res = 0; - if (mode && !(mode & - (S_IFREG | S_IFIFO | S_IFSOCK | S_IFCHR | S_IFBLK))) - return -EOPNOTSUPP; stream_name_len = ntfs_fuse_parse_path(org_path, &path, &stream_name); if (stream_name_len < 0) return stream_name_len; - if (stream_name_len && mode && !(mode & S_IFREG)) { + if (stream_name_len && !S_ISREG(mode)) { res = -EINVAL; goto exit; } From 6e9be81f5524125f39edb2bba5bb9bbe2c688466 Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 10 Nov 2005 03:20:27 +0000 Subject: [PATCH 2719/2994] -u now just means undelete -i, --inodes takes a range of inodes to be recovered tidy usage remove interactive option (it wasn't implemented) --- ntfsprogs/ntfsundelete.c | 73 ++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c index 25cdbee6..ed88f322 100644 --- a/ntfsprogs/ntfsundelete.c +++ b/ntfsprogs/ntfsundelete.c @@ -239,29 +239,30 @@ static void version(void) static void usage(void) { ntfs_log_info("\nUsage: %s [options] device\n" - " -s --scan Scan for files (default)\n" - " -p num --percentage num Minimum percentage recoverable\n" - " -m pattern --match pattern Only work on files with matching names\n" - " -C --case Case sensitive matching\n" - " -S range --size range Match files of this size\n" - " -t since --time since Last referenced since this time\n" + " -s, --scan Scan for files (default)\n" + " -p, --percentage NUM Minimum percentage recoverable\n" + " -m, --match PATTERN Only work on files with matching names\n" + " -C, --case Case sensitive matching\n" + " -S, --size RANGE Match files of this size\n" + " -t, --time SINCE Last referenced since this time\n" "\n" - " -i --interactive Interactive mode\n" - " -u [nums] --undelete [nums] Undelete mode: if specified, so undelete these\n" - " -o file --output file Save with this filename\n" - " -O --optimistic Undelete in-use clusters as well\n" - " -d dir --destination dir Destination directory\n" - " -b num --byte num Fill missing parts with this byte\n" - " -T --truncate Truncate 100%% recoverable file to exact size.\n" - " -P --parent Show parent directory\n" + " -u, --undelete Undelete mode\n" + " -i, --inodes RANGE Recover these inodes\n" + //" -I, --interactive Interactive mode\n" + " -o, --output FILE Save with this filename\n" + " -O, --optimistic Undelete in-use clusters as well\n" + " -d, --destination DIR Destination directory\n" + " -b, --byte NUM Fill missing parts with this byte\n" + " -T, --truncate Truncate 100%% recoverable file to exact size.\n" + " -P, --parent Show parent directory\n" "\n" - " -c range --copy range Write a range of MFT records to a file\n" + " -c, --copy RANGE Write a range of MFT records to a file\n" "\n" - " -f --force Use less caution\n" - " -q --quiet Less output\n" - " -v --verbose More output\n" - " -V --version Display version information\n" - " -h --help Display this help\n\n", + " -f, --force Use less caution\n" + " -q, --quiet Less output\n" + " -v, --verbose More output\n" + " -V, --version Display version information\n" + " -h, --help Display this help\n\n", EXEC_NAME); ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } @@ -423,26 +424,27 @@ static int parse_time(const char *value, time_t *since) */ static int parse_options(int argc, char *argv[]) { - static const char *sopt = "-b:Cc:d:fhi?m:o:OPp:sS:t:Tu::qvV"; + static const char *sopt = "-b:Cc:d:fh?i:m:o:OPp:sS:t:TuqvV"; static const struct option lopt[] = { { "byte", required_argument, NULL, 'b' }, { "case", no_argument, NULL, 'C' }, { "copy", required_argument, NULL, 'c' }, { "destination", required_argument, NULL, 'd' }, { "force", no_argument, NULL, 'f' }, - { "interactive", no_argument, NULL, 'i' }, { "help", no_argument, NULL, 'h' }, + { "inodes", required_argument, NULL, 'i' }, + //{ "interactive", no_argument, NULL, 'I' }, { "match", required_argument, NULL, 'm' }, - { "output", required_argument, NULL, 'o' }, { "optimistic", no_argument, NULL, 'O' }, + { "output", required_argument, NULL, 'o' }, + { "parent", no_argument, NULL, 'P' }, { "percentage", required_argument, NULL, 'p' }, + { "quiet", no_argument, NULL, 'q' }, { "scan", no_argument, NULL, 's' }, { "size", required_argument, NULL, 'S' }, - { "parent", no_argument, NULL, 'P' }, { "time", required_argument, NULL, 't' }, { "truncate", no_argument, NULL, 'T' }, - { "undelete", optional_argument, NULL, 'u' }, - { "quiet", no_argument, NULL, 'q' }, + { "undelete", no_argument, NULL, 'u' }, { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 } @@ -505,13 +507,18 @@ static int parse_options(int argc, char *argv[]) break; case 'h': case '?': - if (strncmp (argv[optind-1], "--log-", 6) == 0) { - if (!ntfs_log_parse_option (argv[optind-1])) - err++; + if (ntfs_log_parse_option (argv[optind-1])) break; - } help++; break; + case 'i': + end = NULL; + /* parse inodes */ + if (parse_inode_arg() == -1) + err++; + if (end && *end) + err++; + break; case 'm': if (!opts.match) { if (!transform(optarg, &opts.match)) { @@ -585,13 +592,7 @@ static int parse_options(int argc, char *argv[]) break; case 'u': if (opts.mode == MODE_NONE) { - end = NULL; opts.mode = MODE_UNDELETE; - /* parse inodes */ - if (parse_inode_arg() == -1) - err++; - if (end && *end) - err++; } else { opts.mode = MODE_ERROR; } From 1b5590613265bcd03f1bc1165742546713e4a6a1 Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 10 Nov 2005 03:20:47 +0000 Subject: [PATCH 2720/2994] -u now just means undelete -i, --inodes takes a range of inodes to be recovered remove interactive option (it wasn't implemented) --- ntfsprogs/ntfsundelete.8.in | 63 ++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index a90c327a..9af80533 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -1,4 +1,4 @@ -.\" Copyright (c) 2002 Richard Russon. All Rights Reserved. +.\" Copyright (c) 2002-2005 Richard Russon. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" .TH NTFSUNDELETE 8 "June 2002" "ntfsprogs version @VERSION@" @@ -101,11 +101,11 @@ is equivalent to .BR "\-f \-v" . Long named options can be abbreviated to any unique prefix of their name. .TP -.BI "\-b " num +.BI "\-b " NUM .br .ns .TP -.BI "\-\-byte " num +.BI "\-\-byte " NUM If any clusters of the file cannot be recovered, the missing parts will be filled with this byte. The default is zeros. .TP @@ -118,11 +118,11 @@ When scanning an NTFS volume, any filename matching (using the .B \-\-match option) is case\-insensitive. This option makes the matching case\-sensitive. .TP -.BI "\-c " range +.BI "\-c " RANGE .br .ns .TP -.BI "\-\-copy " range +.BI "\-\-copy " RANGE This wizard's option will write a block of MFT FILE records to a file. The default file is .I mft @@ -133,11 +133,11 @@ and .B \-\-destination options. .TP -.BI "\-d " dir +.BI "\-d " DIR .br .ns .TP -.BI "\-\-destination " dir +.BI "\-\-destination " DIR This option controls where to put the output file of the .B \-\-undelete and @@ -159,19 +159,21 @@ file. Use this option with caution. .B \-\-help Show a list of options with a brief description of each one. .TP -.B \-i +.BI "\-i " RANGE .br .ns .TP -.B \-\-interactive -Switches the interactive mode, meaning that for each undeleting of a file -the user will be asked. +.BI "\-\-inodes " RANGE +Recover the files with these inode numbers. +.I RANGE +can be a single inode number, several numbers separated by commas "," or a +range separated by a dash "-". .TP -.BI "\-m " pattern +.BI "\-m " PATTERN .br .ns .TP -.BI "\-\-match " pattern +.BI "\-\-match " PATTERN Filter the output by only looking for matching filenames. The pattern can include the wildcards '?', match exactly one character or '*', match zero or more characters. By default the matching is case\-insensitive. To make the search @@ -179,22 +181,22 @@ case sensitive, use the .B \-\-case option. .TP -.BI "\-o " file +.BI "\-o " FILE .br .ns .TP -.BI "\-\-output " file +.BI "\-\-output " FILE Use this option to set name of output file that .B \-\-undelete or .B \-\-copy will create. .TP -.BI "\-p " num +.BI "\-p " NUM .br .ns .TP -.BI "\-\-percentage " num +.BI "\-\-percentage " NUM Filter the output of the .B \-\-scan option, by only matching files with a certain amount of recoverable content. @@ -248,11 +250,11 @@ The percentage field shows how much of the file can potentially be recovered. .sp .br .RE -.BI "\-S " range +.BI "\-S " RANGE .br .ns .TP -.BI "\-\-size " range +.BI "\-\-size " RANGE Filter the output of the .B \-\-scan option, by looking for a particular range of file sizes. The range may be @@ -260,11 +262,11 @@ specified as two numbers separated by a '\-'. The sizes may be abbreviated using the suffixes k, m, g, t, for kilobytes, megabytes, gigabytes and terabytes respectively. .TP -.BI "\-t " since +.BI "\-t " SINCE .br .ns .TP -.BI "\-\-time " since +.BI "\-\-time " SINCE Filter the output of the .B \-\-scan option. Only match files that have been altered since this time. The time must @@ -282,15 +284,18 @@ is confident about the size of a deleted file, then it will restore the file to exactly that size. The default behaviour is to round up the size to the nearest cluster (which will be a multiple of 512 bytes). .TP -.BI "\-u " [nums] +.BI "\-u " .br .ns .TP -.BI "\-\-undelete " [nums] -where is optional. Recover the files either by matching the -regular expression of option -m or by the given nums, which are the -inode numbers. You can specify more than one inode by separating with -"," or a range of inodes by using "-". This option can be combined with +.BI "\-\-undelete " +Select +.B undelete +mode. You can specify the files to be recovered using by using +.B --match +or +.B --inodes +options. This option can be combined with .BR \-\-output , .BR \-\-destination , and @@ -345,14 +350,14 @@ Look for deleted files altered in the last two days Undelete inodes 2, 5 and 100 to 131 of device /dev/sda1 .RS .sp -.B ntfsundelete /dev/sda1 -u 2,5,100-131 +.B ntfsundelete /dev/sda1 -u -i 2,5,100-131 .sp .RE Undelete inode number 3689, call the file 'work.doc' and put it in the user's home directory. .RS .sp -.B ntfsundelete /dev/hda1 \-u 3689 \-o work.doc \-d ~ +.B ntfsundelete /dev/hda1 \-u -i 3689 \-o work.doc \-d ~ .sp .RE Save MFT Records 3689 to 3690 to a file 'debug' From 3666ce3d2c1b0eeb4e7b34683017b1ff457b5f95 Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 10 Nov 2005 03:22:42 +0000 Subject: [PATCH 2721/2994] ntfsundelete options fix --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 610774ae..610a1b67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -74,6 +74,8 @@ xx/xx/2005 - 1.12.2-WIP - Teach ntfs_create() to create special Interix files (charcter and block devices, FIFOs and sockets). Add @dev parameter to ntfs_create() for this. (Yura) + - Fix the -u option in ntfsundelete. Instead of a confusing optional + parameter, there's a new option -i with a required parameter (Rich) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. From 247753251d4f81b31f91183ffb406749014ca11b Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 10 Nov 2005 05:13:57 +0000 Subject: [PATCH 2722/2994] quiet, verbose, debug don't need to be options num_clusters, index_block_size, attr_defs(_len) moved to volume --- ntfsprogs/mkntfs.c | 160 ++++++++++++++++++--------------------------- 1 file changed, 62 insertions(+), 98 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 63bad586..0495f97b 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -190,9 +190,7 @@ INDEX_ALLOCATION *g_index_block = NULL; ntfs_volume *g_vol = NULL; /* globals demoted from mkntfs_options */ -long long g_num_clusters = 0; /* Note: Win2k treats clusters as 32-bit entities! */ long long g_volume_size = 0; /* in bytes */ -int g_index_block_size = 0; /* in bytes */ int g_mft_size = 0; /* The bigger of 16kB & one cluster */ long long g_mft_lcn = 0; /* lcn of $MFT, $DATA attribute */ long long g_mftmirr_lcn = 0; /* lcn of $MFTMirr, $DATA */ @@ -201,8 +199,6 @@ int g_logfile_size = 0; /* in bytes, determined from volume_size */ long long g_mft_zone_end = 0; /* Determined from volume_size and mft_zone_multiplier, in clusters */ long long g_num_bad_blocks = 0; /* Number of bad clusters */ long long *g_bad_blocks = NULL; /* Array of bad clusters */ -ATTR_DEF *g_attr_defs = NULL; /* filename, attribute defs */ -int g_attr_defs_len = 0; /* in bytes */ /** * struct mkntfs_options @@ -216,18 +212,15 @@ struct mkntfs_options { BOOL disable_indexing; /* -I, disables indexing of file contents on the volume by default. */ BOOL no_action; /* -n, do not write to device, only display what would be done. */ long long part_start_sect; /* -p, start sector of partition on parent device */ - BOOL quiet; /* -q, quiet execution. */ long sector_size; /* -s, in bytes, power of 2, default is 512 bytes. */ long sectors_per_track; /* -S, number of sectors per track on device */ BOOL use_epoch_time; /* -T, fake the time to be 00:00:00 UTC, Jan 1, 1970. */ - BOOL verbose; /* -v, verbose execution */ long mft_zone_multiplier; /* -z, value from 1 to 4. Default is 1. */ long long num_sectors; /* size of device in sectors */ long cluster_size; /* -c, format with this cluster-size */ u8 ver_major; /* -w, ntfs version to create */ u8 ver_minor; char *label; /* -L, volume label */ - BOOL debug; /* --debug, lots of extra logging */ } opts; @@ -398,7 +391,6 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * int lic = 0; int err = 0; int ver = 0; - int levels = 0; if (!argv || !opts2) { ntfs_log_error("Internal error: invalid parameters to mkntfs_options.\n"); @@ -458,8 +450,7 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * err++; break; case 'q': - opts2->quiet = TRUE; - ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET | NTFS_LOG_LEVEL_VERBOSE); break; case 's': if (!mkntfs_parse_long(optarg, "sector size", &opts2->sector_size)) @@ -473,8 +464,7 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * opts2->use_epoch_time = TRUE; break; case 'v': - opts2->verbose = TRUE; - ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); + ntfs_log_set_levels(NTFS_LOG_LEVEL_QUIET | NTFS_LOG_LEVEL_VERBOSE); break; case 'V': ver++; /* display version info */ @@ -500,9 +490,6 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * } break; case 'Z': /* debug - turn on everything */ - opts2->debug = TRUE; - opts2->verbose = TRUE; - opts2->quiet = FALSE; ntfs_log_set_levels(NTFS_LOG_LEVEL_DEBUG | NTFS_LOG_LEVEL_TRACE | NTFS_LOG_LEVEL_VERBOSE | NTFS_LOG_LEVEL_QUIET); break; case 'z': @@ -526,25 +513,12 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * } } - /* Make sure we're in sync with the log levels */ - levels = ntfs_log_get_levels(); - if (levels & NTFS_LOG_LEVEL_VERBOSE) - opts2->verbose = TRUE; - if (!(levels & NTFS_LOG_LEVEL_QUIET)) - opts2->quiet = TRUE; - if (!err && !ver && !lic) { if (opts2->dev_name == NULL) { if (argc > 1) ntfs_log_error("You must specify a device.\n"); err++; } - - if (opts2->quiet && opts2->verbose) { - ntfs_log_error("You may not use --quiet and --verbose " - "at the same time.\n"); - err++; - } } if (ver) @@ -567,7 +541,6 @@ static BOOL mkntfs_validate_options(struct mkntfs_options *opts2 __attribute__(( printf ("label = %s\n", opts2->label); printf ("quick_format = %d\n", opts2->quick_format); printf ("disable_indexing = %d\n", opts2->disable_indexing); - printf ("verbose = %ld\n", opts2->verbose); printf ("ver_major = %d\n", opts2->ver_major); printf ("ver_minor = %d\n", opts2->ver_minor); printf ("enable_compression = %d\n", opts2->enable_compression); @@ -579,10 +552,8 @@ static BOOL mkntfs_validate_options(struct mkntfs_options *opts2 __attribute__(( printf ("num_sectors = %lld\n", opts2->num_sectors); printf ("sector_size = %ld\n", opts2->sector_size); printf ("part_start_sect = %lld\n", opts2->part_start_sect); - printf ("quiet = %d\n", opts2->quiet); printf ("no_action = %d\n", opts2->no_action); printf ("force = %d\n", opts2->force); - printf ("debug = %d\n", opts2->debug); #endif return TRUE; @@ -762,6 +733,7 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, return total; } + /** * dump_resident_attr_val * @@ -991,17 +963,17 @@ static void dump_attr_record(ATTR_RECORD *a) return; } u = le32_to_cpu(a->type); - for (i = 0; g_attr_defs[i].type; i++) - if (le32_to_cpu(g_attr_defs[i].type) >= u) + for (i = 0; g_vol->attrdef[i].type; i++) + if (le32_to_cpu(g_vol->attrdef[i].type) >= u) break; - if (g_attr_defs[i].type) { + if (g_vol->attrdef[i].type) { #if 0 - printf("type = 0x%x\n", le32_to_cpu(g_attr_defs[i].type)); - { char *p = (char*)g_attr_defs[i].name; + printf("type = 0x%x\n", le32_to_cpu(g_vol->attrdef[i].type)); + { char *p = (char*)g_vol->attrdef[i].name; printf("name = %c%c%c%c%c\n", *p, p[1], p[2], p[3], p[4]); } #endif - if (ntfs_ucstombs(g_attr_defs[i].name, 0x40, (char**)&s, sizeof(s)) < 0) { + if (ntfs_ucstombs(g_vol->attrdef[i].name, 0x40, (char**)&s, sizeof(s)) < 0) { ntfs_log_error("Could not convert Unicode string to single " "byte string in current locale.\n"); strncpy(s, "Error converting Unicode string", @@ -1123,6 +1095,7 @@ static void dump_mft_record(MFT_RECORD *m) printf("-- End of attributes. --\n"); } + /** * make_room_for_attribute - make room for an attribute inside an mft record * @m: mft record @@ -1136,7 +1109,7 @@ static void dump_mft_record(MFT_RECORD *m) * -ENOSPC There is not enough space available to complete * operation. The caller has to make space before calling * this. - * -EINVAL Can only occur if mkntfs was compiled with -DEBUG. Means + * -EINVAL Can only occur if mkntfs was compiled with -DDEBUG. Means * the input parameters were faulty. */ static int make_room_for_attribute(MFT_RECORD *m, char *pos, const u32 size) @@ -1221,7 +1194,7 @@ static runlist *allocate_scattered_clusters(s64 clusters) s64 prev_run_len = 0LL; char bit; - end = g_num_clusters; + end = g_vol->nr_clusters; /* Loop until all clusters are allocated. */ while (clusters) { /* Loop in current zone until we run out of free clusters. */ @@ -2048,6 +2021,7 @@ err_out: return err; } + /** * add_attr_std_info * @@ -2491,6 +2465,7 @@ static int add_attr_bitmap_positioned(MFT_RECORD *m, const char *name, return err; } + /** * upgrade_to_large_index * @@ -3483,6 +3458,11 @@ static void mkntfs_exit(void) ntfs_log_perror("Warning: Could not close %s", g_vol->dev->d_name); ntfs_device_free(g_vol->dev); } + /* Only free the attribute definitions, if we originally allocated them. */ + if ((g_vol->attrdef != (const ATTR_DEF*)attrdef_ntfs12_array) && + (g_vol->attrdef != (const ATTR_DEF*)attrdef_ntfs3x_array)) { + free(g_vol->attrdef); + } free(g_vol->upcase); free(g_vol); g_vol = NULL; @@ -3504,15 +3484,9 @@ static void mkntfs_exit(void) free(g_rl_mft); g_rl_mft = NULL; free(g_rl_mft_bmp); g_rl_mft_bmp = NULL; free(g_rl_mftmirr); g_rl_mftmirr = NULL; - - /* Only free the attribute definitions, if we originally allocated them. */ - if ((g_attr_defs != (const ATTR_DEF*)attrdef_ntfs12_array) && - (g_attr_defs != (const ATTR_DEF*)attrdef_ntfs3x_array)) { - free(g_attr_defs); - g_attr_defs = NULL; - } } + /** * mkntfs_open_partition - * @@ -3617,7 +3591,6 @@ done: static void mkntfs_override_phys_params(void) { /* This function uses: - * g_num_clusters * g_vol * g_volume_size */ @@ -3810,23 +3783,23 @@ static void mkntfs_override_phys_params(void) "by Windows.\n"); } /* If user didn't specify the number of clusters, determine it now. */ - if (!g_num_clusters) - g_num_clusters = g_volume_size / g_vol->cluster_size; + if (!g_vol->nr_clusters) + g_vol->nr_clusters = g_volume_size / g_vol->cluster_size; /* * Check the cluster_size and num_sectors for consistency with * sector_size and num_sectors. And check both of these for consistency * with volume_size. */ - if (g_num_clusters != (opts.num_sectors * opts.sector_size) / + if (g_vol->nr_clusters != (opts.num_sectors * opts.sector_size) / g_vol->cluster_size || g_volume_size / opts.sector_size != opts.num_sectors || - g_volume_size / g_vol->cluster_size != g_num_clusters) + g_volume_size / g_vol->cluster_size != g_vol->nr_clusters) err_exit("Illegal combination of volume/cluster/sector size " "and/or cluster/sector number.\n"); - ntfs_log_debug("number of clusters = %llu (0x%llx)\n", g_num_clusters, - g_num_clusters); + ntfs_log_debug("number of clusters = %llu (0x%llx)\n", g_vol->nr_clusters, + g_vol->nr_clusters); /* Number of clusters must fit within 32 bits (Win2k limitation). */ - if (g_num_clusters >> 32) { + if (g_vol->nr_clusters >> 32) { if (g_vol->cluster_size >= 65536) err_exit("Device is too large to hold an NTFS volume " "(maximum size is 256TiB).\n"); @@ -3852,14 +3825,13 @@ static void mkntfs_initialize_bitmaps(void) * g_mft_bitmap_byte_size * g_mft_bitmap_size * g_mft_size - * g_num_clusters * g_rl_mft_bmp * g_vol */ int i, j; /* Determine lcn bitmap byte size and allocate it. */ - g_lcn_bitmap_byte_size = (g_num_clusters + 7) >> 3; + g_lcn_bitmap_byte_size = (g_vol->nr_clusters + 7) >> 3; /* Needs to be multiple of 8 bytes. */ g_lcn_bitmap_byte_size = (g_lcn_bitmap_byte_size + 7) & ~7; i = (g_lcn_bitmap_byte_size + g_vol->cluster_size - 1) & @@ -3874,7 +3846,7 @@ static void mkntfs_initialize_bitmaps(void) * $Bitmap can overlap the end of the volume. Any bits in this region * must be set. This region also encompasses the backup boot sector. */ - for (i = g_num_clusters; i < g_lcn_bitmap_byte_size << 3; i++) + for (i = g_vol->nr_clusters; i < g_lcn_bitmap_byte_size << 3; i++) ntfs_bit_set(g_lcn_bitmap, (u64)i, 1); /* * Determine mft_size: (16 (1.2) or 27 (3.0+) mft records) @@ -3928,7 +3900,6 @@ static void mkntfs_initialize_rl_mft(void) * g_mftmirr_lcn * g_mft_size * g_mft_zone_end - * g_num_clusters * g_rl_mft * g_rl_mft_bmp * g_rl_mftmirr @@ -3949,7 +3920,7 @@ static void mkntfs_initialize_rl_mft(void) } ntfs_log_debug("$MFT logical cluster number = 0x%llx\n", g_mft_lcn); /* Determine MFT zone size. */ - g_mft_zone_end = g_num_clusters; + g_mft_zone_end = g_vol->nr_clusters; switch (opts.mft_zone_multiplier) { /* % of volume size in clusters */ case 4: g_mft_zone_end = g_mft_zone_end >> 1; /* 50% */ @@ -4028,7 +3999,6 @@ static void mkntfs_initialize_rl_logfile(void) * g_lcn_bitmap * g_logfile_lcn * g_logfile_size - * g_num_clusters * g_rl_logfile * g_vol * g_volume_size @@ -4047,18 +4017,18 @@ static void mkntfs_initialize_rl_logfile(void) * making sure it does not overflow the end of the volume. */ if (g_volume_size < 2048LL * 1024) /* < 2MiB */ - g_logfile_size = 256LL * 1024; /* -> 256kiB */ + g_logfile_size = 256LL * 1024; /* -> 256kiB */ else if (g_volume_size < 4000000LL) /* < 4MB */ - g_logfile_size = 512LL * 1024; /* -> 512kiB */ - else if (g_volume_size <= 200LL * 1024 * 1024)/* < 200MiB */ - g_logfile_size = 2048LL * 1024; /* -> 2MiB */ - else if (g_volume_size >= 400LL << 20) /* > 400MiB */ + g_logfile_size = 512LL * 1024; /* -> 512kiB */ + else if (g_volume_size <= 200LL * 1024 * 1024) /* < 200MiB */ + g_logfile_size = 2048LL * 1024; /* -> 2MiB */ + else if (g_volume_size >= 400LL << 20) /* > 400MiB */ g_logfile_size = 4 << 20; /* -> 4MiB */ else g_logfile_size = (g_volume_size / 100) & ~(g_vol->cluster_size - 1); j = g_logfile_size / g_vol->cluster_size; - while (g_rl_logfile[0].lcn + j >= g_num_clusters) { + while (g_rl_logfile[0].lcn + j >= g_vol->nr_clusters) { /* * $Logfile would overflow volume. Need to make it smaller than * the standard size. It's ok as we are creating a non-standard @@ -4128,7 +4098,6 @@ static void mkntfs_initialize_rl_boot(void) static void mkntfs_initialize_rl_bad(void) { /* This function uses: - * g_num_clusters * g_rl_bad */ /* Create runlist for $BadClus, $DATA named stream $Bad. */ @@ -4142,7 +4111,7 @@ static void mkntfs_initialize_rl_bad(void) * $BadClus named stream $Bad contains the whole volume as a single * sparse runlist entry. */ - g_rl_bad[1].vcn = g_rl_bad[0].length = g_num_clusters; + g_rl_bad[1].vcn = g_rl_bad[0].length = g_vol->nr_clusters; g_rl_bad[1].lcn = -1LL; g_rl_bad[1].length = 0LL; @@ -4158,7 +4127,6 @@ static void mkntfs_fill_device_with_zeroes(void) { /* This function uses: * g_buf - * g_num_clusters * g_vol * g_volume_size */ @@ -4169,12 +4137,12 @@ static void mkntfs_fill_device_with_zeroes(void) int i; ssize_t bw; unsigned long long position, mid_clust; - float progress_inc = (float)g_num_clusters / 100; + float progress_inc = (float)g_vol->nr_clusters / 100; ntfs_log_quiet("Initialising device with zeroes: 0%%"); fflush(stdout); mid_clust = (g_volume_size >> 1) / g_vol->cluster_size; - for (position = 0; position < (unsigned long long)g_num_clusters; + for (position = 0; position < (unsigned long long)g_vol->nr_clusters; position++) { if (!(position % (int)(progress_inc+1))) { ntfs_log_quiet("\b\b\b\b%3.0f%%", position / @@ -4285,6 +4253,7 @@ static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, /* ntfs_mst_post_write_fixup((NTFS_RECORD*)idx); */ } + /** * create_file_volume - */ @@ -4377,15 +4346,12 @@ bb_err: static void mkntfs_create_root_structures(void) { /* This function uses: - * g_attr_defs - * g_attr_defs_len * g_buf * g_buf_sds * g_buf_sds_first_size * g_buf_sds_init * g_buf_sds_size * g_index_block - * g_index_block_size * g_lcn_bitmap * g_lcn_bitmap_byte_size * g_logfile_size @@ -4394,7 +4360,6 @@ static void mkntfs_create_root_structures(void) * g_mft_lcn * g_mftmirr_lcn * g_mft_size - * g_num_clusters * g_rl_bad * g_rl_boot * g_rl_logfile @@ -4511,7 +4476,7 @@ static void mkntfs_create_root_structures(void) /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, - COLLATION_FILE_NAME, g_index_block_size); + COLLATION_FILE_NAME, g_vol->indx_record_size); /* FIXME: This should be IGNORE_CASE */ if (!err) err = upgrade_to_large_index(m, "$I30", 4, 0, &g_index_block); @@ -4608,12 +4573,12 @@ static void mkntfs_create_root_structures(void) if (g_vol->major_ver < 3) g_buf2_size = 36000; else - g_buf2_size = g_attr_defs_len; + g_buf2_size = g_vol->attrdef_len; g_buf2 = calloc(1, g_buf2_size); if (!g_buf2) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - memcpy(g_buf2, g_attr_defs, g_attr_defs_len); + memcpy(g_buf2, g_vol->attrdef, g_vol->attrdef_len); // XXX why do we need a special buffer for this? err = add_attr_data(m, NULL, 0, 0, 0, g_buf2, g_buf2_size); free(g_buf2); g_buf2 = NULL; @@ -4702,13 +4667,12 @@ static void mkntfs_create_root_structures(void) ntfs_log_debug("clusters per mft record = %i (0x%x)\n", bs->clusters_per_mft_record, bs->clusters_per_mft_record); - if (g_index_block_size >= (int)g_vol->cluster_size) { - bs->clusters_per_index_record = g_index_block_size / + if (g_vol->indx_record_size >= g_vol->cluster_size) { + bs->clusters_per_index_record = g_vol->indx_record_size / g_vol->cluster_size; } else { - bs->clusters_per_index_record = -(ffs(g_index_block_size) - 1); - if ((1 << -bs->clusters_per_index_record) != - g_index_block_size) + bs->clusters_per_index_record = -g_vol->indx_record_size_bits; + if ((1 << -bs->clusters_per_index_record) != (s32)g_vol->indx_record_size) err_exit("BUG: calculated clusters_per_index_record " "is wrong (= 0x%x)\n", bs->clusters_per_index_record); @@ -4725,7 +4689,7 @@ static void mkntfs_create_root_structures(void) */ bs->checksum = cpu_to_le32(0); /* Make sure the bootsector is ok. */ - if (!ntfs_boot_sector_is_ntfs(bs, !opts.debug)) + if (!ntfs_boot_sector_is_ntfs(bs, TRUE)) err_exit("FATAL: Generated boot sector is invalid!\n"); err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_boot, g_buf2, 8192); if (!err) @@ -4760,7 +4724,7 @@ static void mkntfs_create_root_structures(void) /* FIXME: This should be IGNORE_CASE */ /* Create a sparse named stream of size equal to the volume size. */ err = add_attr_data_positioned(m, "$Bad", 4, 0, 0, g_rl_bad, NULL, - g_num_clusters * g_vol->cluster_size); + g_vol->nr_clusters * g_vol->cluster_size); if (!err) { err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); } @@ -4834,11 +4798,11 @@ static void mkntfs_create_root_structures(void) if (!err) err = add_attr_index_root(m, "$SDH", 4, 0, AT_UNUSED, COLLATION_NTOFS_SECURITY_HASH , - g_index_block_size); + g_vol->indx_record_size); /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$SII", 4, 0, AT_UNUSED, - COLLATION_NTOFS_ULONG, g_index_block_size); + COLLATION_NTOFS_ULONG, g_vol->indx_record_size); if (!err) err = initialize_secure(g_buf_sds_init, g_buf_sds_first_size, m); if (err < 0) @@ -4897,7 +4861,7 @@ static void mkntfs_create_root_structures(void) /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, - COLLATION_FILE_NAME, g_index_block_size); + COLLATION_FILE_NAME, g_vol->indx_record_size); if (err < 0) err_exit("Couldn't create $Extend: %s\n", strerror(-err)); @@ -4933,11 +4897,11 @@ static void mkntfs_create_root_structures(void) /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, - COLLATION_NTOFS_SID, g_index_block_size); + COLLATION_NTOFS_SID, g_vol->indx_record_size); /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$Q", 2, 0, AT_UNUSED, - COLLATION_NTOFS_ULONG, g_index_block_size); + COLLATION_NTOFS_ULONG, g_vol->indx_record_size); if (!err) err = initialize_quota(m); if (err < 0) @@ -4956,7 +4920,7 @@ static void mkntfs_create_root_structures(void) /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, - COLLATION_NTOFS_ULONGS, g_index_block_size); + COLLATION_NTOFS_ULONGS, g_vol->indx_record_size); if (!err) err = initialize_objid(m, g_volume_obj_id->object_id, MK_LE_MREF(FILE_Volume, FILE_Volume)); @@ -4975,7 +4939,7 @@ static void mkntfs_create_root_structures(void) /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$R", 2, 0, AT_UNUSED, - COLLATION_NTOFS_ULONGS, g_index_block_size); + COLLATION_NTOFS_ULONGS, g_vol->indx_record_size); if (err < 0) err_exit("Couldn't create $Reparse: %s\n", strerror(-err)); @@ -5029,7 +4993,7 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg if (opts.cluster_size >= 0) g_vol->cluster_size = opts.cluster_size; - g_vol->mft_record_size = 1024; + g_vol->mft_record_size = 1024; g_vol->mft_record_size_bits = 10; /* Length is in unicode characters. */ @@ -5041,11 +5005,11 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg } init_upcase_table(g_vol->upcase, g_vol->upcase_len * sizeof(ntfschar)); - /* Initialize opts to zero / required values. */ - g_index_block_size = 4096; - g_attr_defs = (ATTR_DEF*)&attrdef_ntfs12_array; - g_attr_defs_len = sizeof(attrdef_ntfs12_array); - /* ntfs_log_debug("Attr_defs table length = %u\n", g_attr_defs_len); */ + g_vol->indx_record_size = 4096; + g_vol->indx_record_size_bits = 12; + + g_vol->attrdef = (ATTR_DEF*)&attrdef_ntfs12_array; + g_vol->attrdef_len = sizeof(attrdef_ntfs12_array); if (mkntfs_open_partition()) /* Open the partition. */ goto done; From 1b49db1f65e345d64c066657b2a632acd05251d7 Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 10 Nov 2005 05:27:45 +0000 Subject: [PATCH 2723/2994] turn on progress logging by default --- libntfs/logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/logging.c b/libntfs/logging.c index 8889da33..c265a6ae 100644 --- a/libntfs/logging.c +++ b/libntfs/logging.c @@ -75,7 +75,7 @@ static struct ntfs_logging ntfs_log = { #endif NTFS_LOG_LEVEL_INFO | NTFS_LOG_LEVEL_QUIET | NTFS_LOG_LEVEL_WARNING | NTFS_LOG_LEVEL_ERROR | NTFS_LOG_LEVEL_PERROR | NTFS_LOG_LEVEL_CRITICAL | - NTFS_LOG_LEVEL_REASON, + NTFS_LOG_LEVEL_REASON | NTFS_LOG_LEVEL_PROGRESS, NTFS_LOG_FLAG_ONLYNAME, #ifdef DEBUG ntfs_log_handler_outerr From f45436a9df0bc50cf7300b975dc7d0d7ab694451 Mon Sep 17 00:00:00 2001 From: flatcap Date: Thu, 10 Nov 2005 05:28:33 +0000 Subject: [PATCH 2724/2994] send progress bar to the progress log (quietable by --quiet) --- ntfsprogs/mkntfs.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 0495f97b..de0ff100 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -450,7 +450,7 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * err++; break; case 'q': - ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET | NTFS_LOG_LEVEL_VERBOSE); + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET | NTFS_LOG_LEVEL_VERBOSE | NTFS_LOG_LEVEL_PROGRESS); break; case 's': if (!mkntfs_parse_long(optarg, "sector size", &opts2->sector_size)) @@ -464,7 +464,7 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * opts2->use_epoch_time = TRUE; break; case 'v': - ntfs_log_set_levels(NTFS_LOG_LEVEL_QUIET | NTFS_LOG_LEVEL_VERBOSE); + ntfs_log_set_levels(NTFS_LOG_LEVEL_QUIET | NTFS_LOG_LEVEL_VERBOSE | NTFS_LOG_LEVEL_PROGRESS); break; case 'V': ver++; /* display version info */ @@ -4139,15 +4139,13 @@ static void mkntfs_fill_device_with_zeroes(void) unsigned long long position, mid_clust; float progress_inc = (float)g_vol->nr_clusters / 100; - ntfs_log_quiet("Initialising device with zeroes: 0%%"); - fflush(stdout); + ntfs_log_progress("Initialising device with zeroes: 0%%"); mid_clust = (g_volume_size >> 1) / g_vol->cluster_size; for (position = 0; position < (unsigned long long)g_vol->nr_clusters; position++) { if (!(position % (int)(progress_inc+1))) { - ntfs_log_quiet("\b\b\b\b%3.0f%%", position / + ntfs_log_progress("\b\b\b\b%3.0f%%", position / progress_inc); - fflush(stdout); } bw = mkntfs_write(g_vol->dev, g_buf, g_vol->cluster_size); if (bw != (ssize_t)g_vol->cluster_size) { @@ -4176,7 +4174,7 @@ static void mkntfs_fill_device_with_zeroes(void) g_vol->cluster_size, SEEK_SET); } } - ntfs_log_quiet("\b\b\b\b100%%"); + ntfs_log_progress("\b\b\b\b100%%"); position = (g_volume_size & (g_vol->cluster_size - 1)) / opts.sector_size; for (i = 0; (unsigned long)i < position; i++) { @@ -4196,7 +4194,7 @@ static void mkntfs_fill_device_with_zeroes(void) opts.sector_size, SEEK_CUR); } } - ntfs_log_quiet(" - Done.\n"); + ntfs_log_progress(" - Done.\n"); } /** From 4652ad72c6411e134e142d4a5d95f8ef60c54050 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 10 Nov 2005 18:13:15 +0000 Subject: [PATCH 2725/2994] * implement symblic link creation in ntfs_create * rename ntfs_create -> __ntfs_create. add wrapers ntfs_create{_symlink,_device} * ntfsmount: implement .symlink * ntfsmount: fix readdir to emulate . and .. when needed --- ChangeLog | 8 +++-- include/ntfs/dir.h | 8 ++++- libntfs/dir.c | 68 ++++++++++++++++++++++++++++++++++++++----- ntfsprogs/ntfsmount.c | 47 +++++++++++++++++++++++++----- 4 files changed, 113 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 610a1b67..152d226d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -71,9 +71,11 @@ xx/xx/2005 - 1.12.2-WIP starting to clone or restore. (Szaka) - Change @type parameter for ntfs_create() to be dev_t rather than internal NTFS_DT_* constants. (Yura) - - Teach ntfs_create() to create special Interix files (charcter and - block devices, FIFOs and sockets). Add @dev parameter to ntfs_create() - for this. (Yura) + - New APIs (dir.[ch]): + ntfs_create_device() for Interix block and character devices + creation. + ntfs_crate_symlink() for Interix symbolic links creation. (Yura) + - Teach ntfs_create() to create Interix FIFOs and sockets. (Yura) - Fix the -u option in ntfsundelete. Instead of a confusing optional parameter, there's a new option -i with a required parameter (Rich) diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index c6170e4f..8b56c669 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -49,9 +49,15 @@ extern ntfs_inode *ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent, const char *pathname); extern ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, - dev_t type, dev_t dev); + dev_t type); +extern ntfs_inode *ntfs_create_device(ntfs_inode *dir_ni, + ntfschar *name, u8 name_len, dev_t type, dev_t dev); +extern ntfs_inode *ntfs_create_symlink(ntfs_inode *dir_ni, + ntfschar *name, u8 name_len, ntfschar *target, u8 target_len); + extern int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len); + extern int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len); diff --git a/libntfs/dir.c b/libntfs/dir.c index 811f6fef..8696bde5 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1072,18 +1072,23 @@ err_out: } /** - * ntfs_create - create object on ntfs volume + * __ntfs_create - create object on ntfs volume * @dir_ni: ntfs inode for directory in which create new object * @name: unicode name of new object * @name_len: length of the name in unicode characters * @type: type of the object to create * @dev: major and minor device numbers (obtained from makedev()) + * @target: target in unicode (only for symlinks) + * @target_len: length of target in unicode charcters + * + * Internal, use ntfs_create{_device,_symlink} wrappers instead. * * @type can be: * S_IFREG to create regular file * S_IFDIR to create directory * S_IFBLK to create block device * S_IFCHR to create character device + * S_IFLNK to create symbolic link * S_IFIFO to create FIFO * S_IFSOCK to create socket * other values are invalid. @@ -1094,8 +1099,9 @@ err_out: * Return opened ntfs inode that describes created object on success or NULL * on error with errno set to the error code. */ -ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, - dev_t type, dev_t dev) +static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, + ntfschar *name, u8 name_len, dev_t type, dev_t dev, + ntfschar *target, u8 target_len) { ntfs_inode *ni; FILE_NAME_ATTR *fn = NULL; @@ -1104,10 +1110,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, ntfs_log_trace("Entering.\n"); /* Sanity checks. */ - if (!dir_ni || !name || !name_len || (type != S_IFREG && - type != S_IFDIR && type != S_IFIFO && - type != S_IFSOCK && type != S_IFCHR && - type != S_IFBLK)) { + if (!dir_ni || !name || !name_len) { ntfs_log_error("Invalid arguments."); return NULL; } @@ -1204,6 +1207,21 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, if (type == S_IFCHR) data->magic = INTX_CHARACTER_DEVICE; break; + case S_IFLNK: + data_len = sizeof(INTX_FILE_TYPES) + + target_len * sizeof(ntfschar); + data = malloc(data_len); + if (!data) { + err = errno; + ntfs_log_error("Not enough memory for " + "content of DATA " + "attribute.\n"); + goto err_out; + } + data->magic = INTX_SYMBOLIC_LINK; + memcpy(data->target, target, + target_len * sizeof(ntfschar)); + break; case S_IFSOCK: data = NULL; data_len = 1; @@ -1278,6 +1296,42 @@ err_out: return NULL; } +/** + * Some wrappers around __ntfs_create() ... + */ + +ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, + dev_t type) +{ + if (type != S_IFREG && type != S_IFDIR && type != S_IFIFO && + type != S_IFSOCK) { + ntfs_log_error("Invalid arguments."); + return NULL; + } + return __ntfs_create(dir_ni, name, name_len, type, 0, NULL, 0); +} + +ntfs_inode *ntfs_create_device(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, + dev_t type, dev_t dev) +{ + if (type != S_IFCHR && type != S_IFBLK) { + ntfs_log_error("Invalid arguments."); + return NULL; + } + return __ntfs_create(dir_ni, name, name_len, type, dev, NULL, 0); +} + +ntfs_inode *ntfs_create_symlink(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, + ntfschar *target, u8 target_len) +{ + if (!target || !target_len) { + ntfs_log_error("Invalid arguments."); + return NULL; + } + return __ntfs_create(dir_ni, name, name_len, S_IFLNK, 0, + target, target_len); +} + /** * ntfs_delete - delete file or directory from ntfs volume * @ni: ntfs inode for object to delte diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 0b5a8c67..6cbe2117 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -516,6 +516,9 @@ static int ntfs_fuse_readdir(const char *path, void *buf, ni = ntfs_pathname_to_inode(vol, NULL, path); if (!ni) return -errno; + if (!strcmp(path, "/")) + filler(buf, ".", NULL, 0); + filler(buf, "..", NULL, 0); if (ntfs_readdir(ni, &pos, &fill_ctx, (ntfs_filldir_t)ntfs_fuse_filler)) err = -errno; @@ -703,13 +706,14 @@ static int ntfs_fuse_chmod(const char *path, return -EOPNOTSUPP; } -static int ntfs_fuse_create(const char *org_path, dev_t type, dev_t dev) +static int ntfs_fuse_create(const char *org_path, dev_t type, dev_t dev, + const char *target) { char *name; - ntfschar *uname = NULL; + ntfschar *uname = NULL, *utarget = NULL; ntfs_inode *dir_ni = NULL, *ni; char *path; - int res = 0, uname_len; + int res = 0, uname_len, utarget_len; path = strdup(org_path); if (!path) @@ -732,7 +736,25 @@ static int ntfs_fuse_create(const char *org_path, dev_t type, dev_t dev) goto exit; } /* Create object specified in @type. */ - ni = ntfs_create(dir_ni, uname, uname_len, type, dev); + switch (type) { + case S_IFCHR: + case S_IFBLK: + ni = ntfs_create_device(dir_ni, uname, uname_len, type, + dev); + break; + case S_IFLNK: + utarget_len = ntfs_mbstoucs(target, &utarget, 0); + if (utarget_len < 0) { + res = -errno; + goto exit; + } + ni = ntfs_create_symlink(dir_ni, uname, uname_len, + utarget, utarget_len); + break; + default: + ni = ntfs_create(dir_ni, uname, uname_len, type); + break; + } if (ni) ntfs_inode_close(ni); else @@ -741,6 +763,8 @@ exit: free(uname); if (dir_ni) ntfs_inode_close(dir_ni); + if (utarget) + free(utarget); free(path); return res; } @@ -759,7 +783,7 @@ static int ntfs_fuse_create_stream(const char *path, * If such file does not exist, create it and try once * again to add stream to it. */ - res = ntfs_fuse_create(path, S_IFREG, 0); + res = ntfs_fuse_create(path, S_IFREG, 0, NULL); if (!res) return ntfs_fuse_create_stream(path, stream_name, stream_name_len); @@ -790,7 +814,7 @@ static int ntfs_fuse_mknod(const char *org_path, mode_t mode, dev_t dev) goto exit; } if (!stream_name_len) - res = ntfs_fuse_create(path, mode & S_IFMT, dev); + res = ntfs_fuse_create(path, mode & S_IFMT, dev, NULL); else res = ntfs_fuse_create_stream(path, stream_name, stream_name_len); @@ -801,6 +825,14 @@ exit: return res; } +static int ntfs_fuse_symlink(const char *to, const char *from) +{ + if (strchr(from, ':') && /* n/a for named data streams. */ + ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) + return -EINVAL; + return ntfs_fuse_create(from, S_IFLNK, 0, to); +} + static int ntfs_fuse_link(const char *old_path, const char *new_path) { char *name; @@ -965,7 +997,7 @@ static int ntfs_fuse_mkdir(const char *path, { if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; /* n/a for named data streams. */ - return ntfs_fuse_create(path, S_IFDIR, 0); + return ntfs_fuse_create(path, S_IFDIR, 0, NULL); } static int ntfs_fuse_rmdir(const char *path) @@ -1302,6 +1334,7 @@ static struct fuse_operations ntfs_fuse_oper = { .statfs = ntfs_fuse_statfs, .chmod = ntfs_fuse_chmod, .mknod = ntfs_fuse_mknod, + .symlink = ntfs_fuse_symlink, .link = ntfs_fuse_link, .unlink = ntfs_fuse_unlink, .rename = ntfs_fuse_rename, From c832d4b2e29701bcf51c4ab90107b005fbd2100e Mon Sep 17 00:00:00 2001 From: szaka Date: Thu, 10 Nov 2005 20:24:07 +0000 Subject: [PATCH 2726/2994] remove ObjectID creation and all related code: ObjectID's are created and managed based on (mostly) DLT Service requests, format doesn't care about them --- ntfsprogs/mkntfs.c | 74 ---------------------------------------------- 1 file changed, 74 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index de0ff100..0a7322d9 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -178,7 +178,6 @@ int g_mft_bitmap_byte_size = 0; u8 *g_mft_bitmap = NULL; int g_lcn_bitmap_byte_size = 0; u8 *g_lcn_bitmap = NULL; -OBJECT_ID_ATTR *g_volume_obj_id = NULL; runlist *g_rl_mft = NULL; runlist *g_rl_mft_bmp = NULL; runlist *g_rl_mftmirr = NULL; @@ -2147,32 +2146,6 @@ static int add_attr_file_name(MFT_RECORD *m, const MFT_REF parent_dir, return i; } -/** - * add_attr_object_id - * - * add an object_id attribute to the mft record @m - * return 0 on success or -errno on error - */ -static int add_attr_object_id(MFT_RECORD *m, OBJECT_ID_ATTR *objid_attr, - int objid_attr_len) -{ - int err; - - /* Does it fit? NO: create non-resident. YES: create resident. */ - if (le32_to_cpu(m->bytes_in_use) + 24 + objid_attr_len > - le32_to_cpu(m->bytes_allocated)) - err = insert_non_resident_attr_in_mft_record(m, - AT_OBJECT_ID, NULL, 0, 0, 0, (u8*)objid_attr, - objid_attr_len); - else - err = insert_resident_attr_in_mft_record(m, - AT_OBJECT_ID, NULL, 0, 0, 0, 0, - (u8*)objid_attr, objid_attr_len); - if (err < 0) - ntfs_log_error("add_attr_volume_id failed: %s\n", strerror(-err)); - return err; -} - /** * add_attr_sd * @@ -3074,45 +3047,6 @@ static int initialize_quota(MFT_RECORD *m) return err; } -/** - * initialize_objid - * - * initialize $ObjId with the default index-entries. - * It is one entry which belongs to $Volume. (W2k3) - */ -static int initialize_objid(MFT_RECORD *m, GUID guid, const MFT_REF mref) -{ - int o_size, err; - INDEX_ENTRY *idx_entry_o; - OBJ_ID_INDEX_DATA *idx_entry_o_data; - - err = 0; - o_size = cpu_to_le32(0x58); - idx_entry_o = calloc(1, o_size); - - /* o index entry */ - idx_entry_o->data_offset = cpu_to_le16(0x20); - idx_entry_o->data_length = cpu_to_le16(0x38); - idx_entry_o->reservedV = cpu_to_le32(0x00); - idx_entry_o->length = cpu_to_le16(0x58); - idx_entry_o->key_length = cpu_to_le16(0x10); - idx_entry_o->flags = cpu_to_le16(0x00); - idx_entry_o->reserved = cpu_to_le16(0x00); - idx_entry_o->key.object_id = guid; - idx_entry_o_data = (OBJ_ID_INDEX_DATA*)((char*)idx_entry_o - + idx_entry_o->data_offset); - idx_entry_o_data->mft_reference = mref; - idx_entry_o_data->birth_volume_id = *zero_guid; - idx_entry_o_data->birth_object_id = *zero_guid; - idx_entry_o_data->domain_id = *zero_guid; - err = insert_index_entry_in_res_dir_index(idx_entry_o, - o_size, m, - NTFS_INDEX_O, 2, AT_UNUSED); - free(idx_entry_o); - - return err; -} - /** * insert_file_link_in_dir_index * @@ -4270,11 +4204,6 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) init_system_file_sd(FILE_Volume, &sd, &i); err = add_attr_sd(m, sd, i); } - if (!err && g_vol->major_ver >= 3) { - g_volume_obj_id = calloc(1,0x10); - ntfs_generate_guid(&g_volume_obj_id->object_id); - err = add_attr_object_id(m, g_volume_obj_id, 0x10); - } if (!err) err = add_attr_data(m, NULL, 0, 0, 0, NULL, 0); if (!err) @@ -4919,9 +4848,6 @@ static void mkntfs_create_root_structures(void) if (!err) err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, COLLATION_NTOFS_ULONGS, g_vol->indx_record_size); - if (!err) - err = initialize_objid(m, g_volume_obj_id->object_id, - MK_LE_MREF(FILE_Volume, FILE_Volume)); if (err < 0) err_exit("Couldn't create $ObjId: %s\n", strerror(-err)); ntfs_log_verbose("Creating $Reparse (mft record 26)\n"); From 77a559752173005c87c3d143fbbdeb4d98f99007 Mon Sep 17 00:00:00 2001 From: szaka Date: Thu, 10 Nov 2005 20:54:00 +0000 Subject: [PATCH 2727/2994] Restore correct V3.1 $AttrDef creation which got last by the recent command line parsing rewrite. Thanks to ntfscmp for catching this! :) --- ntfsprogs/mkntfs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 0a7322d9..5e9cec49 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -4932,8 +4932,13 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg g_vol->indx_record_size = 4096; g_vol->indx_record_size_bits = 12; - g_vol->attrdef = (ATTR_DEF*)&attrdef_ntfs12_array; - g_vol->attrdef_len = sizeof(attrdef_ntfs12_array); + if (g_vol->major_ver < 3) { + g_vol->attrdef = (ATTR_DEF*)&attrdef_ntfs12_array; + g_vol->attrdef_len = sizeof(attrdef_ntfs12_array); + } else { + g_vol->attrdef = (ATTR_DEF*)&attrdef_ntfs3x_array; + g_vol->attrdef_len = sizeof(attrdef_ntfs3x_array); + } if (mkntfs_open_partition()) /* Open the partition. */ goto done; From 3c2c988f9649efd73a73b88c3e6dbbfddd9f75d4 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 10 Nov 2005 21:26:41 +0000 Subject: [PATCH 2728/2994] That was ntfsmount bug with '.' and '..', no need for a workaround. --- ntfsprogs/ntfsmount.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 6cbe2117..dd466c95 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -494,7 +494,8 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx, MREF(mref), strerror(errno)); return 0; } - if (MREF(mref) >= FILE_first_user || ctx->show_sys_files) + if (MREF(mref) == FILE_root || MREF(mref) >= FILE_first_user || + ctx->show_sys_files) fill_ctx->filler(fill_ctx->buf, filename, NULL, 0); free(filename); return 0; @@ -516,9 +517,6 @@ static int ntfs_fuse_readdir(const char *path, void *buf, ni = ntfs_pathname_to_inode(vol, NULL, path); if (!ni) return -errno; - if (!strcmp(path, "/")) - filler(buf, ".", NULL, 0); - filler(buf, "..", NULL, 0); if (ntfs_readdir(ni, &pos, &fill_ctx, (ntfs_filldir_t)ntfs_fuse_filler)) err = -errno; From 0d651e54d3d8a174d8148b01701b9bc06d660b0f Mon Sep 17 00:00:00 2001 From: uvman Date: Fri, 11 Nov 2005 23:35:56 +0000 Subject: [PATCH 2729/2994] Give a better name to MFT_RECORD_IS_8 and rename FILE_ATTR_DUP_* to match this meaning. --- include/ntfs/layout.h | 56 ++++++++++++++++++++++++++++--------------- libntfs/dir.c | 7 +++--- ntfsprogs/mkntfs.c | 28 ++++++++++------------ ntfsprogs/ntfsinfo.c | 12 ++++++---- ntfsprogs/ntfsrm.c | 2 +- 5 files changed, 61 insertions(+), 44 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index cce72fc2..4557d849 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -247,15 +247,22 @@ typedef enum { * * These are the so far known MFT_RECORD_* flags (16-bit) which contain * information about the mft record in which they are present. - * _4 and _8 are needed by $Extend sub-files (don't know what to - * call them yet...) + * + * MFT_RECORD_IS_4 exists on all $Extend sub-files. + * It seems that it marks it is a metadata file with MFT record >24, however, + * it is unknown if it is limited to metadata files only. + * + * MFT_RECORD_IS_VIEW_INDEX exists on every metafile with a non directory + * index, that means an INDEX_ROOT and an INDEX_ALLOCATION with a name other + * than "$I30". It is unknown if it is limited to metadata files only. */ typedef enum { - MFT_RECORD_IN_USE = const_cpu_to_le16(0x0001), - MFT_RECORD_IS_DIRECTORY = const_cpu_to_le16(0x0002), - MFT_RECORD_IS_4 = const_cpu_to_le16(0x0004), - MFT_RECORD_IS_8 = const_cpu_to_le16(0x0008), - MFT_REC_SPACE_FILLER = 0xffff /* Just to make flags 16-bit. */ + MFT_RECORD_IN_USE = const_cpu_to_le16(0x0001), + MFT_RECORD_IS_DIRECTORY = const_cpu_to_le16(0x0002), + MFT_RECORD_IS_4 = const_cpu_to_le16(0x0004), + MFT_RECORD_IS_VIEW_INDEX = const_cpu_to_le16(0x0008), + MFT_REC_SPACE_FILLER = 0xffff, /* Just to make flags + 16-bit. */ } __attribute__((__packed__)) MFT_RECORD_FLAGS; /* @@ -857,19 +864,30 @@ typedef enum { and preserves the rest. This mask is used to to obtain all flags that are valid for setting. */ - /* - * FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT is only present in the - * FILE_NAME attribute (in the field file_attributes). + /** + * FILE_ATTR_I30_INDEX_PRESENT - Is it a directory? + * + * This is a copy of the MFT_RECORD_IS_DIRECTORY bit from the mft + * record, telling us whether this is a directory or not, i.e. whether + * it has an index root attribute named "$I30" or not. + * + * This flag is only present in the FILE_NAME attribute (in the + * file_attributes field). */ - FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT = const_cpu_to_le32(0x10000000), - /* This is a copy of the corresponding bit from the mft record, telling - us whether this is a directory or not, i.e. whether it has an - index root attribute or not. */ - FILE_ATTR_DUP_VIEW_INDEX_PRESENT = const_cpu_to_le32(0x20000000), - /* This is a copy of the corresponding bit from the mft record, telling - us whether this file has a view index present (eg. object id index, - quota index, one of the security indexes or the encrypting file - system related indexes). */ + FILE_ATTR_I30_INDEX_PRESENT = const_cpu_to_le32(0x10000000), + + /** + * FILE_ATTR_VIEW_INDEX_PRESENT - Does have a non-directory index? + * + * This is a copy of the MFT_RECORD_IS_VIEW_INDEX bit from the mft + * record, telling us whether this file has a view index present (eg. + * object id index, quota index, one of the security indexes and the + * reparse points index). + * + * This flag is only present in the $STANDARD_INFORMATION and + * $FILE_NAME attributes. + */ + FILE_ATTR_VIEW_INDEX_PRESENT = const_cpu_to_le32(0x20000000), } __attribute__((__packed__)) FILE_ATTR_FLAGS; /* diff --git a/libntfs/dir.c b/libntfs/dir.c index 8696bde5..37b1fcff 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -643,8 +643,7 @@ static inline int ntfs_filldir(ntfs_inode *dir_ni, s64 *pos, u8 ivcn_bits, /* Skip root directory self reference entry. */ if (MREF_LE(ie->indexed_file) == FILE_root) return 0; - if (ie->key.file_name.file_attributes & - FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) + if (ie->key.file_name.file_attributes & FILE_ATTR_I30_INDEX_PRESENT) dt_type = NTFS_DT_DIR; else dt_type = NTFS_DT_REG; @@ -1254,7 +1253,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, fn->file_name_length = name_len; fn->file_name_type = FILE_NAME_POSIX; if (S_ISDIR(type)) - fn->file_attributes = FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; + fn->file_attributes = FILE_ATTR_I30_INDEX_PRESENT; if (!S_ISREG(type) && !S_ISDIR(type)) fn->file_attributes = FILE_ATTR_SYSTEM; fn->creation_time = utc2ntfs(ni->creation_time); @@ -1576,7 +1575,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) fn->file_name_type = FILE_NAME_POSIX; fn->file_attributes = ni->flags; if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) - fn->file_attributes |= FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; + fn->file_attributes |= FILE_ATTR_I30_INDEX_PRESENT; fn->allocated_size = cpu_to_sle64(ni->allocated_size); fn->data_size = cpu_to_sle64(ni->data_size); fn->creation_time = utc2ntfs(ni->creation_time); diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 5e9cec49..0829fc8b 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -4358,7 +4358,7 @@ static void mkntfs_create_root_structures(void) add_attr_std_info(m, file_attrs, cpu_to_le32(0x0100)); } else if (i == 9) { - file_attrs |= FILE_ATTR_DUP_VIEW_INDEX_PRESENT; + file_attrs |= FILE_ATTR_VIEW_INDEX_PRESENT; add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); } else if (i == 11) { @@ -4366,7 +4366,7 @@ static void mkntfs_create_root_structures(void) cpu_to_le32(0x0101)); } else if (i == 24 || i == 25 || i == 26) { file_attrs |= FILE_ATTR_ARCHIVE; - file_attrs |= FILE_ATTR_DUP_VIEW_INDEX_PRESENT; + file_attrs |= FILE_ATTR_VIEW_INDEX_PRESENT; add_attr_std_info(m, file_attrs, cpu_to_le32(0x0101)); } else { @@ -4384,8 +4384,8 @@ static void mkntfs_create_root_structures(void) m->link_count = cpu_to_le16(le16_to_cpu(m->link_count) + 1); err = add_attr_file_name(m, root_ref, 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | - FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, 0, 0, - ".", FILE_NAME_WIN32_AND_DOS); + FILE_ATTR_I30_INDEX_PRESENT, 0, 0, ".", + FILE_NAME_WIN32_AND_DOS); if (!err) { if (g_vol->major_ver == 1) { init_system_file_sd(FILE_root, &sd, &i); @@ -4690,14 +4690,13 @@ static void mkntfs_create_root_structures(void) } else { ntfs_log_verbose("Creating $Secure (mft record 9)\n"); m = (MFT_RECORD*)(g_buf + 9 * g_vol->mft_record_size); - m->flags |= MFT_RECORD_IS_8; + m->flags |= MFT_RECORD_IS_VIEW_INDEX; if (!err) err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(9, 9), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | - FILE_ATTR_DUP_VIEW_INDEX_PRESENT - , 0, 0, "$Secure", - FILE_NAME_WIN32_AND_DOS); + FILE_ATTR_VIEW_INDEX_PRESENT, 0, 0, + "$Secure", FILE_NAME_WIN32_AND_DOS); if (!err) { if (g_vol->minor_ver == 0) { g_buf_sds_first_size = 0x1E0; @@ -4782,9 +4781,8 @@ static void mkntfs_create_root_structures(void) err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(11, 11), 0LL, 0LL, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | - FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT, - 0, 0, "$Extend", - FILE_NAME_WIN32_AND_DOS); + FILE_ATTR_I30_INDEX_PRESENT, 0, 0, + "$Extend", FILE_NAME_WIN32_AND_DOS); /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, @@ -4811,11 +4809,11 @@ static void mkntfs_create_root_structures(void) /* starting vith file 24 (ignoring file 16-23) */ if (g_vol->major_ver >= 3) { extend_flags = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | - FILE_ATTR_ARCHIVE | FILE_ATTR_DUP_VIEW_INDEX_PRESENT; + FILE_ATTR_ARCHIVE | FILE_ATTR_VIEW_INDEX_PRESENT; ntfs_log_verbose("Creating $Quota (mft record 24)\n"); m = (MFT_RECORD*)(g_buf + 24 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; - m->flags |= MFT_RECORD_IS_8; + m->flags |= MFT_RECORD_IS_VIEW_INDEX; if (!err) err = create_hardlink_res((MFT_RECORD*)(g_buf + 11 * g_vol->mft_record_size), extend_ref, m, @@ -4836,7 +4834,7 @@ static void mkntfs_create_root_structures(void) ntfs_log_verbose("Creating $ObjId (mft record 25)\n"); m = (MFT_RECORD*)(g_buf + 25 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; - m->flags |= MFT_RECORD_IS_8; + m->flags |= MFT_RECORD_IS_VIEW_INDEX; if (!err) err = create_hardlink_res((MFT_RECORD*)(g_buf + 11 * g_vol->mft_record_size), extend_ref, @@ -4853,7 +4851,7 @@ static void mkntfs_create_root_structures(void) ntfs_log_verbose("Creating $Reparse (mft record 26)\n"); m = (MFT_RECORD*)(g_buf + 26 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; - m->flags |= MFT_RECORD_IS_8; + m->flags |= MFT_RECORD_IS_VIEW_INDEX; if (!err) err = create_hardlink_res((MFT_RECORD*)(g_buf + 11 * g_vol->mft_record_size), diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index c2c32190..bdb5e6b5 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -484,15 +484,17 @@ static void ntfs_dump_flags(ATTR_TYPES type, u32 flags) printf(" ENCRYPTED"); flags &= ~FILE_ATTR_ENCRYPTED; } + /* We know that FILE_ATTR_I30_INDEX_PRESENT only exists on $FILE_NAME, + and in case we are wrong, let it appear as UNKNOWN */ if (type == AT_FILE_NAME) { - if (flags & FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) { - printf(" FILE_NAME_INDEX"); - flags &= ~FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT; + if (flags & FILE_ATTR_I30_INDEX_PRESENT) { + printf(" I30_INDEX"); + flags &= ~FILE_ATTR_I30_INDEX_PRESENT; } } - if (flags & FILE_ATTR_DUP_VIEW_INDEX_PRESENT) { + if (flags & FILE_ATTR_VIEW_INDEX_PRESENT) { printf(" VIEW_INDEX"); - flags &= ~FILE_ATTR_DUP_VIEW_INDEX_PRESENT; + flags &= ~FILE_ATTR_VIEW_INDEX_PRESENT; } if (flags) printf(" UNKNOWN: 0x%x", (unsigned int)le32_to_cpu(flags)); diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index 09ad67ec..db5f93a3 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -381,7 +381,7 @@ static BOOL utils_pathname_to_inode2(ntfs_volume *vol, struct ntfs_dir *parent, ntfs_log_debug("dt = %p, data_len = %d, parent = %p\n", dt, dt->data_len, dt->parent); //printf("dt's flags = 0x%08x\n", dt->children[dt_num]->key.file_name.file_attributes); - if (dt->children[dt_num]->key.file_name.file_attributes == FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT) { + if (dt->children[dt_num]->key.file_name.file_attributes == FILE_ATTR_I30_INDEX_PRESENT) { //printf("DIR\n"); child = ntfs_dir_create(dir->vol, dt->children[dt_num]->indexed_file); //printf("child = %p (%lld)\n", child, MREF(dt->children[dt_num]->indexed_file)); From 4137f63c7aadc4dc527a35aa2488695f2130de4b Mon Sep 17 00:00:00 2001 From: uvman Date: Fri, 11 Nov 2005 23:55:14 +0000 Subject: [PATCH 2730/2994] Report the MFT record flags properly in ntfsinfo. --- ChangeLog | 5 ++++- ntfsprogs/ntfsinfo.c | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 152d226d..954162be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -77,7 +77,10 @@ xx/xx/2005 - 1.12.2-WIP ntfs_crate_symlink() for Interix symbolic links creation. (Yura) - Teach ntfs_create() to create Interix FIFOs and sockets. (Yura) - Fix the -u option in ntfsundelete. Instead of a confusing optional - parameter, there's a new option -i with a required parameter (Rich) + parameter, there's a new option -i with a required parameter. (Rich) + - Make ntfsinfo report the MFT record flags properly, this includes + the less encountered flags, and reporting the in_use flag instead of + inverting it to unused. (Yuval) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index bdb5e6b5..cf86293e 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1875,15 +1875,25 @@ static void ntfs_dump_inode_general_info(ntfs_inode *inode) printf("MFT record Flags:\t\t "); if (inode_flags) { - if (!(MFT_RECORD_IN_USE & inode_flags)) { - printf("DELETED "); + if (MFT_RECORD_IN_USE & inode_flags) { + printf("IN_USE "); + inode_flags &= ~MFT_RECORD_IN_USE; } if (MFT_RECORD_IS_DIRECTORY & inode_flags) { printf("DIRECTORY "); + inode_flags &= ~MFT_RECORD_IS_DIRECTORY; } - if (~(MFT_RECORD_IN_USE | MFT_RECORD_IS_DIRECTORY) & inode_flags) { + /* The meaning of IS_4 is illusive but not its existence. */ + if (MFT_RECORD_IS_4 & inode_flags) { + printf("IS_4 "); + inode_flags &= ~MFT_RECORD_IS_4; + } + if (MFT_RECORD_IS_VIEW_INDEX & inode_flags) { + printf("VIEW_INDEX "); + inode_flags &= ~MFT_RECORD_IS_VIEW_INDEX; + } + if (inode_flags) printf("UNKNOWN:0x%04hx",inode_flags); - } } else { printf("none"); } From fc103ec4b07f424cf0fc1a344197258e9a6eef3c Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 12 Nov 2005 12:59:20 +0000 Subject: [PATCH 2731/2994] output cosmetic change; explicit check for /$Extend/$ObjId in get_index_attr_type() --- ntfsprogs/ntfsinfo.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index cf86293e..3b705806 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -497,7 +497,7 @@ static void ntfs_dump_flags(ATTR_TYPES type, u32 flags) flags &= ~FILE_ATTR_VIEW_INDEX_PRESENT; } if (flags) - printf(" UNKNOWN: 0x%x", (unsigned int)le32_to_cpu(flags)); + printf(" UNKNOWN: 0x%04x", (unsigned int)le32_to_cpu(flags)); printf("\n"); } @@ -1251,8 +1251,6 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) (ntfschar*)((char*)(attr) + le16_to_cpu((attr)->name_offset)), \ (attr)->name_length, 0, NULL, 0) -static int get_index_root(ntfs_inode *ni, ATTR_RECORD *attr, INDEX_ROOT *iroot); - static INDEX_ATTR_TYPE get_index_attr_type(ntfs_inode *ni, ATTR_RECORD *attr, INDEX_ROOT *index_root) { @@ -1289,7 +1287,7 @@ static INDEX_ATTR_TYPE get_index_attr_type(ntfs_inode *ni, ATTR_RECORD *attr, else if (COMPARE_INDEX_NAMES(attr, NTFS_INDEX_O)) { if (!strcmp(file_name, "/$Extend/$Quota")) return INDEX_ATTR_QUOTA_O; - else + else if (!strcmp(file_name, "/$Extend/$ObjId")) return INDEX_ATTR_OBJID_O; } @@ -1893,7 +1891,7 @@ static void ntfs_dump_inode_general_info(ntfs_inode *inode) inode_flags &= ~MFT_RECORD_IS_VIEW_INDEX; } if (inode_flags) - printf("UNKNOWN:0x%04hx",inode_flags); + printf("UNKNOWN: 0x%04hx", inode_flags); } else { printf("none"); } From 7b68432c72455a7eb3364fb56f05e035e550a1d0 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 12 Nov 2005 15:35:51 +0000 Subject: [PATCH 2732/2994] Name consistently the same $SDS, $SDH and $SII fields --- include/ntfs/layout.h | 11 +++-------- ntfsprogs/mkntfs.c | 8 ++++---- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 4557d849..45b5890b 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1911,20 +1911,15 @@ typedef struct { typedef struct { u32 hash; /* Hash of the security descriptor. */ u32 security_id; /* The security_id assigned to the descriptor. */ - u64 offset_in_sds; /* Offset of the descriptor in $SDS data stream. */ - u32 size_in_sds; /* Size of the descriptor in $SDS data stream. */ + u64 offset; /* Byte offset of this entry in the $SDS stream. */ + u32 length; /* Size in bytes of this entry in $SDS stream. */ u32 reserved_II; /* Padding - always unicode "II". */ } __attribute__((__packed__)) SDH_INDEX_DATA; /** * struct SII_INDEX_DATA - */ -typedef struct { - u32 hash; /* Hash of the security descriptor. */ - u32 security_id; /* The security_id assigned to the descriptor. */ - u64 offset_in_sds; /* Offset of the descriptor in $SDS data stream. */ - u32 size_in_sds; /* Size of the descriptor in $SDS data stream. */ -} __attribute__((__packed__)) SII_INDEX_DATA; +typedef SECURITY_DESCRIPTOR_HEADER SII_INDEX_DATA; /** * struct QUOTA_O_INDEX_DATA - diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 0829fc8b..e89f03b9 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2893,9 +2893,9 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) sdh_data->hash = sds_header->hash; sdh_data->security_id = sds_header->security_id; - sdh_data->offset_in_sds = sds_header->offset; + sdh_data->offset = sds_header->offset; - sdh_data->size_in_sds = sds_header->length; + sdh_data->length = sds_header->length; sdh_data->reserved_II = cpu_to_le32(0x00490049); /* SII index entry */ @@ -2911,8 +2911,8 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) idx_entry_sii->data_offset); sii_data->hash = sds_header->hash; sii_data->security_id = sds_header->security_id; - sii_data->offset_in_sds = sds_header->offset; - sii_data->size_in_sds = sds_header->length; + sii_data->offset = sds_header->offset; + sii_data->length = sds_header->length; if ((err = insert_index_entry_in_res_dir_index(idx_entry_sdh, sdh_size, m, NTFS_INDEX_SDH, 4, AT_UNUSED))) break; From f480d3f8adb42f1b8140ed92b388db1aab06d8bb Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 12 Nov 2005 20:52:38 +0000 Subject: [PATCH 2733/2994] Log also what actually fails, not only the reason --- ntfsprogs/mkntfs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index e89f03b9..e3d0e5f1 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -5010,7 +5010,8 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg err = errno; free(rl); if (lw != g_lcn_bitmap_byte_size) { - ntfs_log_error("%s\n", lw == -1 ? strerror(err) : "unknown error"); + ntfs_log_error("ntfs_rlwrite: %s\n", lw == -1 ? + strerror(err) : "unknown error"); goto done; } } else { @@ -5030,7 +5031,8 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg if (!opts.no_action) lw = ntfs_mst_pwrite(g_vol->dev, pos, 1, g_vol->mft_record_size, g_buf + i * g_vol->mft_record_size); if (lw != 1) { - ntfs_log_error("%s\n", lw == -1 ? strerror(errno) : "unknown error"); + ntfs_log_error("ntfs_mst_pwrite: %s\n", lw == -1 ? + strerror(errno) : "unknown error"); goto done; } pos += g_vol->mft_record_size; @@ -5055,7 +5057,8 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg if (!opts.no_action) lw = ntfs_mst_pwrite(g_vol->dev, pos, 1, g_vol->mft_record_size, g_buf + i * g_vol->mft_record_size); if (lw != 1) { - ntfs_log_error("%s\n", lw == -1 ? strerror(errno) : "unknown error"); + ntfs_log_error("ntfs_mst_pwrite: %s\n", lw == -1 ? + strerror(errno) : "unknown error"); goto done; } pos += g_vol->mft_record_size; From 3e459eb92361a8e8e629fb020fb87f6b711af741 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 13 Nov 2005 02:38:17 +0000 Subject: [PATCH 2734/2994] mkntfs: fix segfault when volume has more than 2^31 clusters --- ChangeLog | 1 + ntfsprogs/mkntfs.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 954162be..f8104354 100644 --- a/ChangeLog +++ b/ChangeLog @@ -81,6 +81,7 @@ xx/xx/2005 - 1.12.2-WIP - Make ntfsinfo report the MFT record flags properly, this includes the less encountered flags, and reporting the in_use flag instead of inverting it to unused. (Yuval) + - mkntfs: fix segfault when volume had more than 2^31 clusters. (Szaka) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index e3d0e5f1..2f9d2297 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3762,7 +3762,7 @@ static void mkntfs_initialize_bitmaps(void) * g_rl_mft_bmp * g_vol */ - int i, j; + u64 i; /* Determine lcn bitmap byte size and allocate it. */ g_lcn_bitmap_byte_size = (g_vol->nr_clusters + 7) >> 3; @@ -3770,7 +3770,7 @@ static void mkntfs_initialize_bitmaps(void) g_lcn_bitmap_byte_size = (g_lcn_bitmap_byte_size + 7) & ~7; i = (g_lcn_bitmap_byte_size + g_vol->cluster_size - 1) & ~(g_vol->cluster_size - 1); - ntfs_log_debug("g_lcn_bitmap_byte_size = %i, allocated = %i\n", + ntfs_log_debug("g_lcn_bitmap_byte_size = %i, allocated = %llu\n", g_lcn_bitmap_byte_size, i); g_lcn_bitmap = calloc(1, g_lcn_bitmap_byte_size); if (!g_lcn_bitmap) @@ -3780,8 +3780,8 @@ static void mkntfs_initialize_bitmaps(void) * $Bitmap can overlap the end of the volume. Any bits in this region * must be set. This region also encompasses the backup boot sector. */ - for (i = g_vol->nr_clusters; i < g_lcn_bitmap_byte_size << 3; i++) - ntfs_bit_set(g_lcn_bitmap, (u64)i, 1); + for (i = g_vol->nr_clusters; i < (u64)g_lcn_bitmap_byte_size << 3; i++) + ntfs_bit_set(g_lcn_bitmap, i, 1); /* * Determine mft_size: (16 (1.2) or 27 (3.0+) mft records) */ @@ -3807,8 +3807,8 @@ static void mkntfs_initialize_bitmaps(void) strerror(errno)); g_rl_mft_bmp[0].vcn = 0LL; /* Mft bitmap is right after $Boot's data. */ - j = (8192 + g_vol->cluster_size - 1) / g_vol->cluster_size; - g_rl_mft_bmp[0].lcn = j; + i = (8192 + g_vol->cluster_size - 1) / g_vol->cluster_size; + g_rl_mft_bmp[0].lcn = i; /* * Size is always one cluster, even though valid data size and * initialized data size are only 8 bytes. @@ -3817,7 +3817,7 @@ static void mkntfs_initialize_bitmaps(void) g_rl_mft_bmp[1].lcn = -1LL; g_rl_mft_bmp[1].length = 0LL; /* Allocate cluster for mft bitmap. */ - ntfs_bit_set(g_lcn_bitmap, (s64)j, 1); + ntfs_bit_set(g_lcn_bitmap, i, 1); } /** From 6cd1ea6e752203b3fa1031c2a1e5d154016e27d5 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 13 Nov 2005 19:25:05 +0000 Subject: [PATCH 2735/2994] ntfs_device_mount(): explain a bit better what fails and how --- libntfs/volume.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libntfs/volume.c b/libntfs/volume.c index ca6dcd7e..1f27b516 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -787,8 +787,8 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) if (l == -1) ntfs_log_perror("Failed to read $MFT"); else { - ntfs_log_debug("Length of data not equal expected " - "length.\n"); + ntfs_log_debug("Failed to read $MFT, unexpected length " + "(%d != %lld).\n", vol->mftmirr_size, l); errno = EIO; } goto error_exit; @@ -799,8 +799,9 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) if (l == -1) ntfs_log_perror("Failed to read $MFTMirr"); else { - ntfs_log_debug("Length of data not equal expected " - "length.\n"); + ntfs_log_debug("Failed to read $MFTMirr, unexpected " + "length (%d != %lld).\n", + vol->mftmirr_size, l); errno = EIO; } goto error_exit; From 7b6a5ef21db02fbf02964577f44674d16a4b5e16 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 13 Nov 2005 20:04:29 +0000 Subject: [PATCH 2736/2994] Fix fs creation with 32 and 64 kB cluster size; also if only one cluster contains all system files then fill the rest of it with empty, formatted records as 'format' also does --- ntfsprogs/mkntfs.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 2f9d2297..4638d1fc 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3783,10 +3783,13 @@ static void mkntfs_initialize_bitmaps(void) for (i = g_vol->nr_clusters; i < (u64)g_lcn_bitmap_byte_size << 3; i++) ntfs_bit_set(g_lcn_bitmap, i, 1); /* - * Determine mft_size: (16 (1.2) or 27 (3.0+) mft records) + * Determine mft_size: (16 (1.2) or 27 (3.0+) mft records) or + * one cluster, whichever is bigger. */ g_mft_size = ((16 + 11 * (g_vol->major_ver >= 3)) * g_vol->mft_record_size); + if (g_mft_size < (s32)g_vol->cluster_size) + g_mft_size = g_vol->cluster_size; ntfs_log_debug("MFT size = %i (0x%x) bytes\n", g_mft_size, g_mft_size); /* Determine mft bitmap size and allocate it. */ g_mft_bitmap_size = g_mft_size / g_vol->mft_record_size; @@ -4304,8 +4307,10 @@ static void mkntfs_create_root_structures(void) u8 *sd; FILE_ATTR_FLAGS extend_flags; VOLUME_FLAGS volume_flags = 0; + int nr_sysfiles; ntfs_log_quiet("Creating NTFS volume structures.\n"); + nr_sysfiles = g_vol->major_ver < 3 ? 16 : 27; /* * Setup an empty mft record. Note, we can just give 0 as the mft * reference as we are creating an NTFS 1.2 volume for which the mft @@ -4315,20 +4320,34 @@ static void mkntfs_create_root_structures(void) * sequence numbers of each system file to equal the mft record number * of that file (only for $MFT is the sequence number 1 rather than 0). */ - for (i = 0; i < 16 + 11 * (g_vol->major_ver >= 3); i++) { + for (i = 0; i < nr_sysfiles; i++) { if (ntfs_mft_record_layout(g_vol, 0, m = (MFT_RECORD *)(g_buf + i * g_vol->mft_record_size))) - err_exit("Error: Failed to layout mft record.\n"); + err_exit("Failed to layout system mft records.\n"); if (i > 0) m->sequence_number = cpu_to_le16(i); if (i == 0) m->sequence_number = cpu_to_le16(1); } + /* + * If only one cluster contains all system files then + * fill the rest of it with empty, formatted records. + */ + if (nr_sysfiles * (s32)g_vol->mft_record_size < g_mft_size) { + for (i = nr_sysfiles; + i * (s32)g_vol->mft_record_size < g_mft_size; i++) { + m = (MFT_RECORD *)(g_buf + i * g_vol->mft_record_size); + if (ntfs_mft_record_layout(g_vol, 0, m)) + err_exit("Failed to layout mft record.\n"); + m->flags = cpu_to_le16(0); + m->sequence_number = cpu_to_le16(i); + } + } /* * Create the 16 system files, adding the system information attribute * to each as well as marking them in use in the mft bitmap. */ - for (i = 0; i < 16 + 11 * (g_vol->major_ver >= 3); i++) { + for (i = 0; i < nr_sysfiles; i++) { u32 file_attrs; m = (MFT_RECORD*)(g_buf + i * g_vol->mft_record_size); @@ -4452,6 +4471,7 @@ static void mkntfs_create_root_structures(void) if (err < 0) err_exit("Couldn't create $MFT: %s\n", strerror(-err)); /* dump_mft_record(m); */ + ntfs_log_verbose("Creating $MFTMirr (mft record 1)\n"); m = (MFT_RECORD*)(g_buf + 1 * g_vol->mft_record_size); err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_mftmirr, g_buf, From 2db620bda1b0b352a64e6c69f914ae718138c4dd Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 13 Nov 2005 21:48:35 +0000 Subject: [PATCH 2737/2994] ntfsclone: check the available free space for --save-image too --- ChangeLog | 10 +++++----- ntfsprogs/ntfsclone.c | 7 +++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index f8104354..0aeab41e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -54,10 +54,10 @@ xx/xx/2005 - 1.12.2-WIP - Fix comment formats. (Yuval) - ntfsinfo and ntfsls follow the convention how other utilities read the device argument: no -d or --device option is needed. (Szaka) - - ntfsinfo: figure out and dump index attribute types. (Szaka) - - ntfsinfo: dump index attribute keys. (Szaka) - - mkntfs: don't fill the last $MFT cluster with empty MFT records. - This is needed to conform to Windows' format behavior. (Szaka) + - ntfsinfo: dump index attribute types and keys. (Szaka) + - mkntfs: don't fill the last $MFT cluster with empty MFT records if + the cluster size <= 16 kB. This is needed to conform to Windows' + format behavior. (Szaka) - Add @flags field to struct ntfs_inode. Remove NIno{Sparse,Compressed, Encrypted}, update all users to use @(ntfs_inode)->flags. (Yura) - Make @(ntfs_inode)->data_size and @(ntfs_inode)->allocated_size to @@ -68,7 +68,7 @@ xx/xx/2005 - 1.12.2-WIP handle them. (Yura) - Fix allocated data size for resident attributes. (Yura) - ntfsclone: check available free space on the destination before - starting to clone or restore. (Szaka) + starting to clone, image or restore. (Szaka) - Change @type parameter for ntfs_create() to be dev_t rather than internal NTFS_DT_* constants. (Yura) - New APIs (dir.[ch]): diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 6a0790c2..fd3b90ef 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1449,9 +1449,12 @@ static void check_dest_free_space(u64 src_bytes) u64 dest_bytes; struct statvfs stvfs; - if (opt.save_image || opt.metadata || opt.blkdev_out || opt.std_out) + if (opt.metadata || opt.blkdev_out || opt.std_out) return; - + /* + * TODO: save_image needs a bit more space than src_bytes + * due to the free space encoding overhead. + */ if (fstatvfs(fd_out, &stvfs) == -1) { Printf("WARNING: Unknown free space on the destination: %s\n", strerror(errno)); From f7f2bf570d6125f0e0d32534bc99de16c40a41fe Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 13 Nov 2005 22:40:19 +0000 Subject: [PATCH 2738/2994] initialize_secure(): fix segfault when non-allocated objects were referenced (thanks to ef) --- ntfsprogs/mkntfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 4638d1fc..a28bec7b 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2878,6 +2878,8 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) err = 0; while ((char*)sds_header < (char*)sds + sds_size) { + if (!sds_header->length) + break; /* SDH index entry */ idx_entry_sdh->data_offset = cpu_to_le16(0x18); idx_entry_sdh->data_length = cpu_to_le16(0x14); @@ -2923,8 +2925,6 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) sds_header = (SECURITY_DESCRIPTOR_HEADER*)((char*)sds_header + (cpu_to_le32(sds_header->length + 0x0F) & ~cpu_to_le32(0x0F))); - if (!sds_header->length) - break; } free(idx_entry_sdh); From 632b146410d89305382e9fe66266ce1029ec14f9 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 14 Nov 2005 00:17:19 +0000 Subject: [PATCH 2739/2994] Add @from_vcn parameter to ntfs_attr_update_mapping_pairs, update all users to submit it, thus write speed to very fragmented files dramatically increased, while write speed to low fragmented files stayed at approximately same level. --- ChangeLog | 6 ++++- include/ntfs/attrib.h | 2 +- libntfs/attrib.c | 55 ++++++++++++++++++++++++++++++++++--------- 3 files changed, 50 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0aeab41e..9b398730 100644 --- a/ChangeLog +++ b/ChangeLog @@ -81,7 +81,11 @@ xx/xx/2005 - 1.12.2-WIP - Make ntfsinfo report the MFT record flags properly, this includes the less encountered flags, and reporting the in_use flag instead of inverting it to unused. (Yuval) - - mkntfs: fix segfault when volume had more than 2^31 clusters. (Szaka) + - mkntfs: fix segfault when volume had more than 2^31 clusters. (Szaka) + - Add @from_vcn parameter to ntfs_attr_update_mapping_pairs, update all + users to submit it, thus write speed to very fragmented files + dramatically increased, while write speed to low fragmented files + stayed at approximately same level. (Yura) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index 51f24ee4..d0d68b19 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -309,7 +309,7 @@ extern int ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, extern int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni); extern int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx, int extra); -extern int ntfs_attr_update_mapping_pairs(ntfs_attr *na); +extern int ntfs_attr_update_mapping_pairs(ntfs_attr *na, VCN from_vcn); extern int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 72fe9c4a..5cf5a85d 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -916,6 +916,7 @@ rl_err_out: s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) { s64 written, to_write, ofs, total, old_initialized_size, old_data_size; + VCN update_from = -1; ntfs_volume *vol; ntfs_attr_search_ctx *ctx = NULL; runlist_element *rl; @@ -1202,6 +1203,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) } na->rl = rl; need_to.update_mapping_pairs = 1; + if (update_from == -1) + update_from = from_vcn; rl = ntfs_attr_find_vcn(na, cur_vcn); if (!rl) { /* @@ -1300,7 +1303,7 @@ done: ntfs_attr_put_search_ctx(ctx); /* Update mapping pairs if needed. */ if (need_to.update_mapping_pairs) - ntfs_attr_update_mapping_pairs(na); + ntfs_attr_update_mapping_pairs(na, update_from); /* Finally, return the number of bytes written. */ return total; rl_err_out: @@ -1353,7 +1356,7 @@ err_out: ntfs_attr_put_search_ctx(ctx); /* Update mapping pairs if needed. */ if (need_to.update_mapping_pairs) - ntfs_attr_update_mapping_pairs(na); + ntfs_attr_update_mapping_pairs(na, update_from); /* Restore original data_size if needed. */ if (need_to.undo_data_size && ntfs_attr_truncate(na, old_data_size)) ntfs_log_trace("Failed to restore data_size.\n"); @@ -4037,6 +4040,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) /** * ntfs_attr_update_mapping_pairs - update mapping pairs for ntfs attribute * @na: non-resident ntfs open attribute for which we need update + * @from_vcn: update runlist starting this VCN * * Build mapping pairs from na->runlist and write them to the disk. Also, this * function updates sparse bit and allocates/frees space for compressed_size, @@ -4047,7 +4051,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) * ENOMEM - Not enough memory to complete operation. * ENOSPC - There is no enough space in base mft to resize $ATTRIBUTE_LIST. */ -int ntfs_attr_update_mapping_pairs(ntfs_attr *na) +int ntfs_attr_update_mapping_pairs(ntfs_attr *na, VCN from_vcn) { ntfs_attr_search_ctx *ctx; ntfs_inode *ni, *base_ni; @@ -4090,9 +4094,35 @@ retry: stop_vcn = 0; finished_build = FALSE; while (!ntfs_attr_lookup(na->type, na->name, na->name_len, - CASE_SENSITIVE, 0, NULL, 0, ctx)) { + CASE_SENSITIVE, from_vcn, NULL, 0, ctx)) { a = ctx->attr; m = ctx->mrec; + /* + * If runlist is updating not from the beginning, then set + * @stop_vcn properly, i.e. to the lowest vcn of record that + * contain @from_vcn. Also we do not need @from_vcn anymore, + * set it to 0 to make ntfs_attr_lookup enumerate attributes. + */ + if (from_vcn) { + LCN first_lcn; + + stop_vcn = sle64_to_cpu(a->lowest_vcn); + from_vcn = 0; + /* + * Check whether the first run we need to update is + * the last run in runlist, if so, then deallocate + * all attrubute extents starting this one. + */ + first_lcn = ntfs_rl_vcn_to_lcn(na->rl, stop_vcn); + if (first_lcn == LCN_EINVAL) { + ntfs_log_trace("BUG! Incorrect runlist.\n"); + err = EIO; + goto put_err_out; + } + if (first_lcn == LCN_ENOENT || + first_lcn == LCN_RL_NOT_MAPPED) + finished_build = TRUE; + } /* * Check whether we finished mapping pairs build, if so mark @@ -4319,10 +4349,11 @@ retry: finished_build = TRUE; if (!finished_build && errno != ENOSPC) { err = errno; - ntfs_log_trace("BUG! Mapping pairs build failed. Please " - "run chkdsk and if that doesn't find " - "any errors please report you saw this " - "message to linux-ntfs-dev@lists.sf.net.\n"); + ntfs_log_trace("BUG! Mapping pairs build failed. " + "Please run chkdsk and if that doesn't " + "find any errors please report you saw " + "this message to " + "linux-ntfs-dev@lists.sf.net.\n"); goto put_err_out; } a->highest_vcn = cpu_to_sle64(stop_vcn - 1); @@ -4518,7 +4549,7 @@ static int ntfs_non_resident_attr_shrink(ntfs_attr *na, const s64 newsize) } /* Write mapping pairs for new runlist. */ - if (ntfs_attr_update_mapping_pairs(na)) { + if (ntfs_attr_update_mapping_pairs(na, first_free_vcn)) { err = errno; ntfs_log_trace("Eeek! Mapping pairs update failed. Leaving " "inconstant metadata. Run chkdsk.\n"); @@ -4734,7 +4765,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize) na->rl = rln; /* Write mapping pairs for new runlist. */ - if (ntfs_attr_update_mapping_pairs(na)) { + if (ntfs_attr_update_mapping_pairs(na, na->allocated_size >> + vol->cluster_size_bits)) { err = errno; ntfs_log_trace("Eeek! Mapping pairs update failed.\n"); goto rollback; @@ -4818,7 +4850,8 @@ rollback: "failed.\n"); } else { /* Restore mapping pairs. */ - if (ntfs_attr_update_mapping_pairs(na)) { + if (ntfs_attr_update_mapping_pairs(na, na->allocated_size >> + vol->cluster_size_bits)) { ntfs_log_trace("Eeek! Couldn't restore old mapping pairs. " "Rollback failed.\n"); } From 0e808deef18ffa5d88a2a431b92a88ce67184912 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 14 Nov 2005 12:19:39 +0000 Subject: [PATCH 2740/2994] * update ntfsmount to new logging, remove all #ifdef #DEBUG, add debug option * ntfsmount: enable kernel_cache for fuse >= 2.4.0 by default * ntfscp fix style in code introduced by Rich --- ntfsprogs/ntfscp.c | 43 +++++---- ntfsprogs/ntfsmount.8.in | 2 +- ntfsprogs/ntfsmount.c | 189 ++++++++++++++++++++++----------------- 3 files changed, 131 insertions(+), 103 deletions(-) diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 043821a9..6a7b16cf 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -79,8 +79,8 @@ volatile sig_atomic_t caught_terminate = 0; */ static void version(void) { - ntfs_log_info("\n%s v%s (libntfs %s) - Overwrite files on NTFS volume.\n\n", - EXEC_NAME, VERSION, ntfs_libntfs_version()); + ntfs_log_info("\n%s v%s (libntfs %s) - Overwrite files on NTFS " + "volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); ntfs_log_info("Copyright (c) 2004-2005 Yura Pakhuchiy\n"); ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -160,13 +160,15 @@ static int parse_options(int argc, char **argv) } else if (!opts.dest_file) { opts.dest_file = argv[optind - 1]; } else { - ntfs_log_error("You must specify exactly 2 files.\n"); + ntfs_log_error("You must specify exactly two " + "files.\n"); err++; } break; case 'a': if (opts.attribute != AT_DATA) { - ntfs_log_error("You can specify only 1 attribute.\n"); + ntfs_log_error("You can specify only one " + "attribute.\n"); err++; break; } @@ -186,8 +188,8 @@ static int parse_options(int argc, char **argv) break; case 'h': case '?': - if (strncmp (argv[optind-1], "--log-", 6) == 0) { - if (!ntfs_log_parse_option (argv[optind-1])) + if (strncmp(argv[optind - 1], "--log-", 6) == 0) { + if (!ntfs_log_parse_option(argv[optind - 1])) err++; break; } @@ -195,8 +197,8 @@ static int parse_options(int argc, char **argv) break; case 'N': if (opts.attr_name) { - ntfs_log_error("You can specify only one attribute " - "name.\n"); + ntfs_log_error("You can specify only one " + "attribute name.\n"); err++; } else opts.attr_name = argv[optind - 1]; @@ -216,7 +218,8 @@ static int parse_options(int argc, char **argv) ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; default: - ntfs_log_error("Unknown option '%s'.\n", argv[optind - 1]); + ntfs_log_error("Unknown option '%s'.\n", + argv[optind - 1]); err++; break; } @@ -239,13 +242,14 @@ static int parse_options(int argc, char **argv) ntfs_log_error("You must specify a source file.\n"); err++; } else if (!opts.dest_file) { - ntfs_log_error("You must specify a destination file.\n"); + ntfs_log_error("You must specify a destination " + "file.\n"); err++; } if (opts.quiet && opts.verbose) { - ntfs_log_error("You may not use --quiet and --verbose at the " - "same time.\n"); + ntfs_log_error("You may not use --quiet and --verbose " + "at the same time.\n"); err++; } } @@ -383,7 +387,8 @@ int main(int argc, char *argv[]) out = ntfs_pathname_to_inode(vol, NULL, new_dest_file); free(new_dest_file); if (!out) { - ntfs_log_perror("ERROR: Failed to open destination file"); + ntfs_log_perror("ERROR: Failed to open destination " + "file"); goto close_src; } } @@ -392,7 +397,8 @@ int main(int argc, char *argv[]) attr_name = NULL; attr_name_len = ntfs_mbstoucs(opts.attr_name, &attr_name, 0); if (attr_name_len == -1) { - ntfs_log_perror("ERROR: Failed to parse attribute name"); + ntfs_log_perror("ERROR: Failed to parse attribute " + "name"); goto close_dst; } } else @@ -412,7 +418,8 @@ int main(int argc, char *argv[]) na = ntfs_attr_open(out, opts.attribute, attr_name, attr_name_len); if (!na) { - ntfs_log_perror("ERROR: Couldn't open just added attribute"); + ntfs_log_perror("ERROR: Couldn't open just added " + "attribute"); goto close_dst; } } @@ -437,7 +444,8 @@ int main(int argc, char *argv[]) offset = 0; while (!feof(in)) { if (caught_terminate) { - ntfs_log_error("SIGTERM or SIGINT received. Aborting write.\n"); + ntfs_log_error("SIGTERM or SIGINT received. " + "Aborting write.\n"); break; } br = fread(buf, 1, NTFS_BUF_SIZE, in); @@ -463,7 +471,7 @@ close_dst: ntfs_log_error("Sync failed. Run chkdsk.\n"); break; } - ntfs_log_error("Device busy. Will retry sync after 3 seconds.\n"); + ntfs_log_error("Device busy. Will retry sync in 3 seconds.\n"); sleep(3); } close_src: @@ -473,4 +481,3 @@ umount: ntfs_log_verbose("Done.\n"); return result; } - diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index c1625e6c..249077bc 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -92,7 +92,7 @@ configuration option described in the previous section. .TP .B kernel_cache -(NOTE: Work only with FUSE-2.3.0) +(NOTE: Only for FUSE 2.3.0, with FUSE >= 2.4.0 on by default) This option disables flushing the cache of the file contents on every open(). This should only be enabled on filesystems, where the file data is never changed externally (not through the mounted FUSE diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index dd466c95..1f99a413 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -96,6 +96,7 @@ typedef struct { BOOL show_sys_files; BOOL succeed_chmod; BOOL force; + BOOL debug; } ntfs_fuse_context_t; typedef enum { @@ -117,10 +118,6 @@ static const char *EXEC_NAME = "ntfsmount"; static char def_opts[] = "default_permissions,allow_other,"; static ntfs_fuse_context_t *ctx; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stderr, &opts.verbose, TRUE) -GEN_PRINTF(Qprintf, stderr, &opts.quiet, FALSE) - static long ntfs_fuse_get_nr_free_mft_records(ntfs_volume *vol) { u8 *buf; @@ -490,8 +487,8 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx, if (name_type == FILE_NAME_DOS) return 0; if (ntfs_ucstombs(name, name_len, &filename, 0) < 0) { - Eprintf("Skipping unrepresentable file (inode %lld): %s\n", - MREF(mref), strerror(errno)); + ntfs_log_error("Skipping unrepresentable file (inode %lld): " + "%s\n", MREF(mref), strerror(errno)); return 0; } if (MREF(mref) == FILE_root || MREF(mref) >= FILE_first_user || @@ -586,8 +583,8 @@ static int ntfs_fuse_read(const char *org_path, char *buf, size_t size, while (size) { res = ntfs_attr_pread(na, offset, size, buf); if (res < (s64)size) - Eprintf("ntfs_attr_pread returned less bytes than " - "requested.\n"); + ntfs_log_error("ntfs_attr_pread returned less bytes " + "than requested.\n"); if (res <= 0) { res = -errno; goto exit; @@ -601,7 +598,7 @@ exit: if (na) ntfs_attr_close(na); if (ni && ntfs_inode_close(ni)) - perror("Failed to close inode"); + ntfs_log_perror("Failed to close inode"); free(path); if (stream_name_len) free(stream_name); @@ -635,8 +632,8 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, while (size) { res = ntfs_attr_pwrite(na, offset, size, buf); if (res < (s64)size) - Eprintf("ntfs_attr_pwrite returned less bytes than " - "requested.\n"); + ntfs_log_error("ntfs_attr_pwrite returned less bytes " + "than requested.\n"); if (res <= 0) { res = -errno; goto exit; @@ -651,7 +648,7 @@ exit: if (na) ntfs_attr_close(na); if (ni && ntfs_inode_close(ni)) - perror("Failed to close inode"); + ntfs_log_perror("Failed to close inode"); free(path); if (stream_name_len) free(stream_name); @@ -687,7 +684,7 @@ static int ntfs_fuse_truncate(const char *org_path, off_t size) ntfs_attr_close(na); exit: if (ni && ntfs_inode_close(ni)) - perror("Failed to close inode"); + ntfs_log_perror("Failed to close inode"); free(path); if (stream_name_len) free(stream_name); @@ -793,7 +790,7 @@ static int ntfs_fuse_create_stream(const char *path, if (ntfs_attr_add(ni, AT_DATA, stream_name, stream_name_len, NULL, 0)) res = -errno; if (ntfs_inode_close(ni)) - perror("Failed to close inode"); + ntfs_log_perror("Failed to close inode"); return res; } @@ -953,7 +950,7 @@ static int ntfs_fuse_rm_stream(const char *path, ntfschar *stream_name, } exit: if (ntfs_inode_close(ni)) - perror("Failed to close inode"); + ntfs_log_perror("Failed to close inode"); return res; } @@ -1029,7 +1026,7 @@ static int ntfs_fuse_utime(const char *path, struct utimbuf *buf) NInoFileNameSetDirty(ni); NInoSetDirty(ni); if (ntfs_inode_close(ni)) - perror("Failed to close inode"); + ntfs_log_perror("Failed to close inode"); return 0; } @@ -1097,7 +1094,7 @@ exit: if (actx) ntfs_attr_put_search_ctx(actx); ntfs_inode_close(ni); - fprintf(stderr, "return %d\n", ret); + ntfs_log_debug("return %d\n", ret); return ret; } @@ -1213,7 +1210,7 @@ exit: ntfs_attr_close(na); free(lename); if (ntfs_inode_close(ni)) - perror("Failed to close inode"); + ntfs_log_perror("Failed to close inode"); return res; } @@ -1272,7 +1269,7 @@ exit: ntfs_attr_close(na); free(lename); if (ntfs_inode_close(ni)) - perror("Failed to close inode"); + ntfs_log_perror("Failed to close inode"); return res; } @@ -1315,7 +1312,7 @@ exit: ntfs_attr_close(na); free(lename); if (ntfs_inode_close(ni)) - perror("Failed to close inode"); + ntfs_log_perror("Failed to close inode"); return res; } @@ -1351,7 +1348,7 @@ static int ntfs_fuse_init(void) { ctx = malloc(sizeof(ntfs_fuse_context_t)); if (!ctx) { - perror("malloc failed"); + ntfs_log_perror("malloc failed"); return -1; } *ctx = (ntfs_fuse_context_t) { @@ -1371,7 +1368,7 @@ static int ntfs_fuse_mount(const char *device) vol = utils_mount_volume(device, (ctx->ro) ? MS_RDONLY : 0, ctx->force); if (!vol) { - Eprintf("Mount failed.\n"); + ntfs_log_error("Mount failed.\n"); return -1; } ctx->vol = vol; @@ -1381,9 +1378,9 @@ static int ntfs_fuse_mount(const char *device) static void ntfs_fuse_destroy(void) { if (ctx->vol) { - printf("Unmounting: %s\n", ctx->vol->vol_name); + ntfs_log_debug("Unmounting: %s\n", ctx->vol->vol_name); if (ntfs_umount(ctx->vol, FALSE)) - perror("Failed to unmount volume"); + ntfs_log_perror("Failed to unmount volume"); } free(ctx); } @@ -1406,13 +1403,13 @@ static char *parse_mount_options(const char *org_options) */ ret = malloc(strlen(def_opts) + strlen(org_options) + 9 + PATH_MAX); if (!ret) { - perror("malloc failed"); + ntfs_log_perror("malloc failed"); return NULL; } *ret = 0; options = strdup(org_options); if (!options) { - perror("strdump failed"); + ntfs_log_perror("strdump failed"); return NULL; } s = options; @@ -1420,97 +1417,102 @@ static char *parse_mount_options(const char *org_options) opt = strsep(&val, "="); if (!strcmp(opt, "ro")) { /* Read-only mount. */ if (val) { - Eprintf("'ro' option should not have value.\n"); - goto err_exit; - } - ctx->ro = TRUE; - strcat(ret, "ro,"); -#ifdef DEBUG - } else if (!strcmp(opt, "fake_rw")) { - if (val) { - Eprintf("'fake_rw' option should not have " + ntfs_log_error("'ro' option should not have " "value.\n"); goto err_exit; } ctx->ro = TRUE; -#endif + strcat(ret, "ro,"); + } else if (!strcmp(opt, "fake_rw")) { + if (val) { + ntfs_log_error("'fake_rw' option should not " + "have value.\n"); + goto err_exit; + } + ctx->ro = TRUE; } else if (!strcmp(opt, "fsname")) { /* Filesystem name. */ /* * We need this to be able to check whether filesystem * mounted or not. */ - Eprintf("'fsname' is unsupported option.\n"); + ntfs_log_error("'fsname' is unsupported option.\n"); goto err_exit; } else if (!strcmp(opt, "no_def_opts")) { if (val) { - Eprintf("'no_def_opts' option should not have " - "value.\n"); + ntfs_log_error("'no_def_opts' option should " + "not have value.\n"); goto err_exit; } no_def_opts = TRUE; /* Don't add default options. */ } else if (!strcmp(opt, "umask")) { if (!val) { - Eprintf("'umask' option should have value.\n"); + ntfs_log_error("'umask' option should have " + "value.\n"); goto err_exit; } sscanf(val, "%i", &ctx->fmask); ctx->dmask = ctx->fmask; } else if (!strcmp(opt, "fmask")) { if (!val) { - Eprintf("'fmask' option should have value.\n"); + ntfs_log_error("'fmask' option should have " + "value.\n"); goto err_exit; } sscanf(val, "%i", &ctx->fmask); } else if (!strcmp(opt, "dmask")) { if (!val) { - Eprintf("'dmask' option should have value.\n"); + ntfs_log_error("'dmask' option should have " + "value.\n"); goto err_exit; } sscanf(val, "%i", &ctx->dmask); } else if (!strcmp(opt, "uid")) { if (!val) { - Eprintf("'uid' option should have value.\n"); + ntfs_log_error("'uid' option should have " + "value.\n"); goto err_exit; } sscanf(val, "%i", &ctx->uid); } else if (!strcmp(opt, "gid")) { if (!val) { - Eprintf("'gid' option should have value.\n"); + ntfs_log_error("'gid' option should have " + "value.\n"); goto err_exit; } sscanf(val, "%i", &ctx->gid); } else if (!strcmp(opt, "show_sys_files")) { if (val) { - Eprintf("'show_sys_files' option should not " - "have value.\n"); + ntfs_log_error("'show_sys_files' option should " + "not have value.\n"); goto err_exit; } ctx->show_sys_files = TRUE; } else if (!strcmp(opt, "succeed_chmod")) { if (val) { - Eprintf("'succeed_chmod' option should not " - "have value.\n"); + ntfs_log_error("'succeed_chmod' option should " + "not have value.\n"); goto err_exit; } ctx->succeed_chmod = TRUE; } else if (!strcmp(opt, "force")) { if (val) { - Eprintf("'force' option should not " + ntfs_log_error("'force' option should not " "have value.\n"); goto err_exit; } ctx->force = TRUE; } else if (!strcmp(opt, "locale")) { if (!val) { - Eprintf("'locale' option should have value.\n"); + ntfs_log_error("'locale' option should have " + "value.\n"); goto err_exit; } if (!setlocale(LC_ALL, val)) - Eprintf("Failed to set locale to %s. " + ntfs_log_error("Failed to set locale to %s. " "Continue anyway.\n", val); } else if (!strcmp(opt, "streams_interface")) { if (!val) { - Eprintf("'streams_interface' option " + ntfs_log_error("'streams_interface' option " "should have value.\n"); goto err_exit; } @@ -1521,12 +1523,26 @@ static char *parse_mount_options(const char *org_options) else if (!strcmp(val, "windows")) ctx->streams = NF_STREAMS_INTERFACE_WINDOWS; else { - Eprintf("Invalid named data streams access " - "interface.\n"); + ntfs_log_error("Invalid named data streams " + "access interface.\n"); goto err_exit; } } else if (!strcmp(opt, "noauto")) { /* Don't pass noauto option to fuse. */ + } else if (!strcmp(opt, "debug")) { + if (val) { + ntfs_log_error("'debug' option should not have " + "value.\n"); + goto err_exit; + } + ctx->debug = TRUE; + ntfs_log_set_levels(NTFS_LOG_LEVEL_DEBUG); + ntfs_log_set_levels(NTFS_LOG_LEVEL_TRACE); + } else if (!strcmp(opt, "remount")) { + ntfs_log_error("Remounting is not supported at present." + " You have to umount volume and then " + "mount it once again.\n"); + goto err_exit; } else { /* Probably FUSE option. */ strcat(ret, opt); if (val) { @@ -1551,16 +1567,16 @@ err_exit: static void usage(void) { - Eprintf("\n%s v%s (libntfs %s) - NTFS module for FUSE.\n\n", + ntfs_log_info("\n%s v%s (libntfs %s) - NTFS module for FUSE.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - Eprintf("Copyright (c) 2005 Yura Pakhuchiy\n\n"); - Eprintf("usage: %s device mount_point [-o options]\n\n", + ntfs_log_info("Copyright (c) 2005 Yura Pakhuchiy\n\n"); + ntfs_log_info("usage: %s device mount_point [-o options]\n\n", EXEC_NAME); - Eprintf("Possible options are:\n\tdefault_permissions\n\tallow_other\n" - "\tkernel_cache\n\tlarge_read\n\tdirect_io\n\tmax_read\n\t" - "force\n\tro\n\tno_def_opts\n\tumask\n\tfmask\n\tdmask\n\t" - "uid\n\tgid\n\tshow_sys_files\n\tsucceed_chmod\n\tlocale\n\n"); - Eprintf("Default options are: \"%s\".\n", def_opts); + ntfs_log_info("ntfsmount options are:\n\tforce\n\tno_def_opts\n\tumask" + "\n\tfmask\n\tdmask\n\tuid\n\tgid\n\tshow_sys_files\n\t" + "succeed_chmod\n\tlocale\n\tstreams_interface\n" + "Also look into FUSE documentation about it options.\n\n"); + ntfs_log_info("Default options are: \"%s\".\n", def_opts); } #ifndef HAVE_REALPATH @@ -1608,7 +1624,7 @@ static int parse_options(int argc, char *argv[]) if (!opts.device) { opts.device = malloc(PATH_MAX + 1); if (!opts.device) { - perror("malloc"); + ntfs_log_perror("malloc"); err++; break; } @@ -1616,7 +1632,7 @@ static int parse_options(int argc, char *argv[]) if (argv[optind - 1][0] != '/') { if (!realpath(argv[optind - 1], opts.device)) { - perror("realpath"); + ntfs_log_perror("realpath"); free(opts.device); opts.device = NULL; err++; @@ -1627,8 +1643,8 @@ static int parse_options(int argc, char *argv[]) } else if (!opts.mnt_point) opts.mnt_point = argv[optind - 1]; else { - Eprintf("You must specify exactly one device " - "and exactly one mount " + ntfs_log_error("You must specify exactly one " + "device and exactly one mount " "point.\n"); err++; } @@ -1637,7 +1653,7 @@ static int parse_options(int argc, char *argv[]) if (!opts.options) opts.options = argv[optind - 1]; else { - Eprintf("You must specify exactly one " + ntfs_log_error("You must specify exactly one " "set of options.\n"); err++; } @@ -1653,7 +1669,8 @@ static int parse_options(int argc, char *argv[]) opts.verbose++; break; default: - Eprintf("Unknown option '%s'.\n", argv[optind - 1]); + ntfs_log_error("Unknown option '%s'.\n", + argv[optind - 1]); err++; break; } @@ -1663,19 +1680,19 @@ static int parse_options(int argc, char *argv[]) opts.quiet = 0; } else { if (!opts.device) { - Eprintf("No mount point specified.\n"); + ntfs_log_error("No mount point specified.\n"); err++; } if (!opts.mnt_point) { if (argc > 1) - Eprintf("No mount point specified.\n"); + ntfs_log_error("No mount point specified.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf("You may not use --quiet and --verbose at " - "the same time.\n"); + ntfs_log_error("You may not use --quiet and --verbose " + "at the same time.\n"); err++; } } @@ -1720,32 +1737,36 @@ int main(int argc, char *argv[]) /* Create filesystem. */ ffd = fuse_mount(opts.mnt_point, parsed_options); if (ffd == -1) { - Eprintf("fuse_mount failed.\n"); + ntfs_log_error("fuse_mount failed.\n"); ntfs_fuse_destroy(); return 5; } free(parsed_options); -#ifndef DEBUG - fh = fuse_new(ffd, "use_ino", &ntfs_fuse_oper, sizeof(ntfs_fuse_oper)); + if (!ctx->debug) { +#if FUSE_MINOR_VERSION >= 4 + fh = fuse_new(ffd, "use_ino,kernel_cache", &ntfs_fuse_oper, + sizeof(ntfs_fuse_oper)); #else - fh = fuse_new(ffd, "debug,use_ino" , &ntfs_fuse_oper, - sizeof(ntfs_fuse_oper)); + fh = fuse_new(ffd, "use_ino", &ntfs_fuse_oper, + sizeof(ntfs_fuse_oper)); #endif + } else + fh = fuse_new(ffd, "debug,use_ino" , &ntfs_fuse_oper, + sizeof(ntfs_fuse_oper)); + if (!fh) { - Eprintf("fuse_new failed.\n"); + ntfs_log_error("fuse_new failed.\n"); close(ffd); fuse_unmount(opts.mnt_point); ntfs_fuse_destroy(); return 6; } -#ifndef DEBUG - if (daemon(0, 0)) - Eprintf("Failed to daemonize.\n"); -#endif - printf("Mounted: %s\n", ctx->vol->vol_name); + if (!ctx->debug && daemon(0, 0)) + ntfs_log_error("Failed to daemonize.\n"); + ntfs_log_info("Mounted: %s\n", ctx->vol->vol_name); /* Main loop. */ if (fuse_loop(fh)) - Eprintf("fuse_loop failed.\n"); + ntfs_log_error("fuse_loop failed.\n"); /* Destroy. */ fuse_destroy(fh); close(ffd); From f7fe30a0aab006ec0e07e7267206fbb102562df7 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 14 Nov 2005 15:31:23 +0000 Subject: [PATCH 2741/2994] Automatically update access and change time in ntfs_attr_p{read,write} and ntfs_attr_truncate. --- ChangeLog | 2 ++ libntfs/attrib.c | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b398730..a687443a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -86,6 +86,8 @@ xx/xx/2005 - 1.12.2-WIP users to submit it, thus write speed to very fragmented files dramatically increased, while write speed to low fragmented files stayed at approximately same level. (Yura) + - Automatically update access and change time in ntfs_attr_p{read,write} + and ntfs_attr_truncate. (Yura) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 5cf5a85d..5e5111d4 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -55,6 +55,7 @@ #include "compress.h" #include "bitmap.h" #include "logging.h" +#include "ntfstime.h" ntfschar AT_UNNAMED[] = { const_cpu_to_le16('\0') }; @@ -769,6 +770,12 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) errno = EACCES; return -1; } + /* Update access time if accessing unnamed data attribute. */ + if (na->type == AT_DATA && na->name == AT_UNNAMED) { + na->ni->last_access_time = time(NULL); + NInoFileNameSetDirty(na->ni); + NInoSetDirty(na->ni); + } if (!count) return 0; /* Truncate reads beyond end of attribute. */ @@ -951,6 +958,13 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) errno = EOPNOTSUPP; return -1; } + /* Update time if writing to unnamed data attribute. */ + if (na->type == AT_DATA && na->name == AT_UNNAMED) { + na->ni->last_data_change_time = time(NULL); + na->ni->last_mft_change_time = time(NULL); + NInoFileNameSetDirty(na->ni); + NInoSetDirty(na->ni); + } if (!count) return 0; /* If the write reaches beyond the end, extend the attribute. */ @@ -4915,9 +4929,10 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) ret = ntfs_non_resident_attr_shrink(na, newsize); } else ret = ntfs_resident_attr_resize(na, newsize); - /* Set FILE_NAME dirty flag, to update file length in the index. */ + /* Set FILE_NAME dirty flag, to update length and time in the index. */ if (na->type == AT_DATA && na->name == AT_UNNAMED) { - NInoFileNameSetDirty(na->ni); + na->ni->last_data_change_time = time(NULL); + na->ni->last_mft_change_time = time(NULL); na->ni->data_size = na->data_size; /* * If attribute sparse or compressed then allocated size in @@ -4928,6 +4943,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) na->ni->allocated_size = na->compressed_size; else na->ni->allocated_size = na->allocated_size; + NInoFileNameSetDirty(na->ni); } return ret; } From ae643af3cd1fe08c50cb78ebfc40451335a4cd2b Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 15 Nov 2005 01:00:22 +0000 Subject: [PATCH 2742/2994] Update QUOTA_CONTROL_ENTRY and QUOTA_O_INDEX_DATA description --- include/ntfs/layout.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 45b5890b..06c12998 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1921,13 +1921,6 @@ typedef struct { */ typedef SECURITY_DESCRIPTOR_HEADER SII_INDEX_DATA; -/** - * struct QUOTA_O_INDEX_DATA - - */ -typedef struct { - u32 owner_id; -} __attribute__((__packed__)) QUOTA_O_INDEX_DATA; - /** * struct SDS_ENTRY - * @@ -2221,11 +2214,27 @@ typedef struct { s64 threshold; /* Soft quota (-1 if not limited). */ s64 limit; /* Hard quota (-1 if not limited). */ s64 exceeded_time; /* How long the soft quota has been exceeded. */ +/* The below field is NOT present for the quota defaults entry. */ SID sid; /* The SID of the user/object associated with - this quota entry. Equals zero for the quota - defaults entry. */ + this quota entry. If this field is missing + then the INDEX_ENTRY is padded with zeros + to multiply of 8 which are not counted in + the data_length field. If the sid is present + then this structure is padded with zeros to + multiply of 8 and the padding is counted in + the INDEX_ENTRY's data_length. */ } __attribute__((__packed__)) QUOTA_CONTROL_ENTRY; +/** + * struct QUOTA_O_INDEX_DATA - + */ +typedef struct { + u32 owner_id; + u32 unknown; /* Always 32. Seems to be padding and it's not + counted in the INDEX_ENTRY's data_length. + This field shouldn't be really here. */ +} __attribute__((__packed__)) QUOTA_O_INDEX_DATA; + /** * enum PREDEFINED_OWNER_IDS - Predefined owner_id values (32-bit). */ From 025768668b7e59f1eae69b38c0b211c4f5cbe85b Mon Sep 17 00:00:00 2001 From: szaka Date: Tue, 15 Nov 2005 01:02:12 +0000 Subject: [PATCH 2743/2994] Pad QUOTA_O_INDEX_DATA with the magic 32 value. --- ntfsprogs/mkntfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index a28bec7b..81c61830 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2973,7 +2973,8 @@ static int initialize_quota(MFT_RECORD *m) idx_entry_o_data = (QUOTA_O_INDEX_DATA*)((char*)idx_entry_o + idx_entry_o->data_offset); idx_entry_o_data->owner_id = QUOTA_FIRST_USER_ID; - /* 20 00 00 00 padding after here on ntfs 3.1 ?? */ + /* 20 00 00 00 padding after here on ntfs 3.1. 3.0 is unchecked. */ + idx_entry_o_data->unknown = cpu_to_le32(32); err = insert_index_entry_in_res_dir_index(idx_entry_o, o_size, m, From 03e481e3494c84e3ad2a5dc7fa83e10d56c0756f Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 15 Nov 2005 04:14:37 +0000 Subject: [PATCH 2744/2994] tidy 8 variables whose scope was quite limited --- ntfsprogs/mkntfs.c | 160 +++++++++++++++++++++++---------------------- 1 file changed, 83 insertions(+), 77 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 81c61830..dc6528e4 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -167,13 +167,6 @@ const char *EXEC_NAME = "mkntfs"; * Need these global so mkntfs_exit can access them. */ u8 *g_buf = NULL; -u8 *g_buf2 = NULL; -int g_buf2_size = 0; -char *g_buf_sds = NULL; -char *g_buf_sds_init = NULL; -int g_buf_sds_size = 0; -int g_buf_sds_first_size = 0; -int g_mft_bitmap_size = 0; int g_mft_bitmap_byte_size = 0; u8 *g_mft_bitmap = NULL; int g_lcn_bitmap_byte_size = 0; @@ -184,11 +177,8 @@ runlist *g_rl_mftmirr = NULL; runlist *g_rl_logfile = NULL; runlist *g_rl_boot = NULL; runlist *g_rl_bad = NULL; -runlist *g_rl_index = NULL; INDEX_ALLOCATION *g_index_block = NULL; ntfs_volume *g_vol = NULL; - -/* globals demoted from mkntfs_options */ long long g_volume_size = 0; /* in bytes */ int g_mft_size = 0; /* The bigger of 16kB & one cluster */ long long g_mft_lcn = 0; /* lcn of $MFT, $DATA attribute */ @@ -1183,7 +1173,7 @@ static void deallocate_scattered_clusters(const runlist *rl) * TODO: We should be returning the size as well, but for mkntfs this is not * necessary. */ -static runlist *allocate_scattered_clusters(s64 clusters) +static runlist * allocate_scattered_clusters(s64 clusters) { runlist *rl = NULL, *rlt; VCN vcn = 0LL; @@ -3406,15 +3396,11 @@ static void mkntfs_exit(void) /* Free any memory we've used */ free(g_bad_blocks); g_bad_blocks = NULL; free(g_buf); g_buf = NULL; - free(g_buf2); g_buf2 = NULL; - free(g_buf_sds); g_buf_sds = NULL; - free(g_buf_sds_init); g_buf_sds_init = NULL; free(g_index_block); g_index_block = NULL; free(g_lcn_bitmap); g_lcn_bitmap = NULL; free(g_mft_bitmap); g_mft_bitmap = NULL; free(g_rl_bad); g_rl_bad = NULL; free(g_rl_boot); g_rl_boot = NULL; - free(g_rl_index); g_rl_index = NULL; free(g_rl_logfile); g_rl_logfile = NULL; free(g_rl_mft); g_rl_mft = NULL; free(g_rl_mft_bmp); g_rl_mft_bmp = NULL; @@ -3758,12 +3744,12 @@ static void mkntfs_initialize_bitmaps(void) * g_lcn_bitmap_byte_size * g_mft_bitmap * g_mft_bitmap_byte_size - * g_mft_bitmap_size * g_mft_size * g_rl_mft_bmp * g_vol */ u64 i; + int mft_bitmap_size; /* Determine lcn bitmap byte size and allocate it. */ g_lcn_bitmap_byte_size = (g_vol->nr_clusters + 7) >> 3; @@ -3793,13 +3779,13 @@ static void mkntfs_initialize_bitmaps(void) g_mft_size = g_vol->cluster_size; ntfs_log_debug("MFT size = %i (0x%x) bytes\n", g_mft_size, g_mft_size); /* Determine mft bitmap size and allocate it. */ - g_mft_bitmap_size = g_mft_size / g_vol->mft_record_size; + mft_bitmap_size = g_mft_size / g_vol->mft_record_size; /* Convert to bytes, at least one. */ - g_mft_bitmap_byte_size = (g_mft_bitmap_size + 7) >> 3; + g_mft_bitmap_byte_size = (mft_bitmap_size + 7) >> 3; /* Mft bitmap is allocated in multiples of 8 bytes. */ g_mft_bitmap_byte_size = (g_mft_bitmap_byte_size + 7) & ~7; - ntfs_log_debug("g_mft_bitmap_size = %i, g_mft_bitmap_byte_size = %i\n", - g_mft_bitmap_size, g_mft_bitmap_byte_size); + ntfs_log_debug("mft_bitmap_size = %i, g_mft_bitmap_byte_size = %i\n", + mft_bitmap_size, g_mft_bitmap_byte_size); g_mft_bitmap = calloc(1, g_mft_bitmap_byte_size); if (!g_mft_bitmap) err_exit("Failed to allocate internal buffer: %s\n", @@ -4139,19 +4125,20 @@ static void mkntfs_fill_device_with_zeroes(void) * mkntfs_sync_index_record * * (ERSO) made a function out of this, but the reason for doing that - * disapeared during coding.... + * disappeared during coding.... */ static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, ntfschar* name, u32 name_len) { /* This function uses: - * g_rl_index * g_vol */ int i, err; ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; long long lw; + runlist *rl_index = NULL; + i = 5 * sizeof(ntfschar); ctx = ntfs_attr_get_search_ctx(NULL, m); @@ -4165,24 +4152,28 @@ static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n"); } a = ctx->attr; - g_rl_index = ntfs_mapping_pairs_decompress(g_vol, a, NULL); - if (!g_rl_index) { + rl_index = ntfs_mapping_pairs_decompress(g_vol, a, NULL); + if (!rl_index) { ntfs_attr_put_search_ctx(ctx); err_exit("Failed to decompress runlist of $INDEX_ALLOCATION " "attribute.\n"); } if (sle64_to_cpu(a->initialized_size) < i) { ntfs_attr_put_search_ctx(ctx); + free(rl_index); err_exit("BUG: $INDEX_ALLOCATION attribute too short.\n"); } ntfs_attr_put_search_ctx(ctx); i = sizeof(INDEX_BLOCK) - sizeof(INDEX_HEADER) + le32_to_cpu(idx->index.allocated_size); err = ntfs_mst_pre_write_fixup((NTFS_RECORD*)idx, i); - if (err) + if (err) { + free(rl_index); err_exit("ntfs_mst_pre_write_fixup() failed while " "syncing index block.\n"); - lw = ntfs_rlwrite(g_vol->dev, g_rl_index, (u8*)idx, i, NULL); + } + lw = ntfs_rlwrite(g_vol->dev, rl_index, (u8*)idx, i, NULL); + free(rl_index); if (lw != i) err_exit("Error writing $INDEX_ALLOCATION.\n"); /* No more changes to @idx below here so no need for fixup: */ @@ -4278,10 +4269,6 @@ static void mkntfs_create_root_structures(void) { /* This function uses: * g_buf - * g_buf_sds - * g_buf_sds_first_size - * g_buf_sds_init - * g_buf_sds_size * g_index_block * g_lcn_bitmap * g_lcn_bitmap_byte_size @@ -4309,6 +4296,12 @@ static void mkntfs_create_root_structures(void) FILE_ATTR_FLAGS extend_flags; VOLUME_FLAGS volume_flags = 0; int nr_sysfiles; + u8 *buf2 = NULL; + int buf2_size = 0; + int buf_sds_first_size = 0; + int buf_sds_size = 0; + char *buf_sds_init = NULL; + char *buf_sds = NULL; ntfs_log_quiet("Creating NTFS volume structures.\n"); nr_sysfiles = g_vol->major_ver < 3 ? 16 : 27; @@ -4493,15 +4486,15 @@ static void mkntfs_create_root_structures(void) /* dump_mft_record(m); */ ntfs_log_verbose("Creating $LogFile (mft record 2)\n"); m = (MFT_RECORD*)(g_buf + 2 * g_vol->mft_record_size); - g_buf2 = malloc(g_logfile_size); - if (!g_buf2) + buf2 = malloc(g_logfile_size); + if (!buf2) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - memset(g_buf2, -1, g_logfile_size); - err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_logfile, g_buf2, + memset(buf2, -1, g_logfile_size); + err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_logfile, buf2, g_logfile_size); - free(g_buf2); - g_buf2 = NULL; + free(buf2); + buf2 = NULL; if (!err) err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_LogFile, FILE_LogFile), @@ -4519,25 +4512,25 @@ static void mkntfs_create_root_structures(void) ntfs_log_verbose("Creating $AttrDef (mft record 4)\n"); m = (MFT_RECORD*)(g_buf + 4 * g_vol->mft_record_size); if (g_vol->major_ver < 3) - g_buf2_size = 36000; + buf2_size = 36000; else - g_buf2_size = g_vol->attrdef_len; - g_buf2 = calloc(1, g_buf2_size); - if (!g_buf2) + buf2_size = g_vol->attrdef_len; + buf2 = calloc(1, buf2_size); + if (!buf2) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - memcpy(g_buf2, g_vol->attrdef, g_vol->attrdef_len); // XXX why do we need a special buffer for this? - err = add_attr_data(m, NULL, 0, 0, 0, g_buf2, g_buf2_size); - free(g_buf2); - g_buf2 = NULL; + memcpy(buf2, g_vol->attrdef, g_vol->attrdef_len); // XXX why do we need a special buffer for this? + err = add_attr_data(m, NULL, 0, 0, 0, buf2, buf2_size); + free(buf2); + buf2 = NULL; if (!err) err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_AttrDef, FILE_AttrDef), - (g_buf2_size + g_vol->cluster_size - 1) & - ~(g_vol->cluster_size - 1), g_buf2_size, + (buf2_size + g_vol->cluster_size - 1) & + ~(g_vol->cluster_size - 1), buf2_size, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$AttrDef", FILE_NAME_WIN32_AND_DOS); - g_buf2_size = 0; + buf2_size = 0; if (!err) { init_system_file_sd(FILE_AttrDef, &sd, &i); err = add_attr_sd(m, sd, i); @@ -4571,17 +4564,17 @@ static void mkntfs_create_root_structures(void) /* dump_mft_record(m); */ ntfs_log_verbose("Creating $Boot (mft record 7)\n"); m = (MFT_RECORD*)(g_buf + 7 * g_vol->mft_record_size); - g_buf2 = calloc(1, 8192); - if (!g_buf2) + buf2 = calloc(1, 8192); + if (!buf2) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - memcpy(g_buf2, boot_array, sizeof(boot_array)); + memcpy(buf2, boot_array, sizeof(boot_array)); /* - * Create the boot sector in g_buf2. Note, that g_buf2 is already zeroed + * Create the boot sector in buf2. Note, that buf2 is already zeroed * in the boot sector section and that it has the NTFS OEM id/magic * already inserted, so no need to worry about these things. */ - bs = (NTFS_BOOT_SECTOR*)g_buf2; + bs = (NTFS_BOOT_SECTOR*)buf2; bs->bpb.bytes_per_sector = cpu_to_le16(opts.sector_size); bs->bpb.sectors_per_cluster = (u8)(g_vol->cluster_size / opts.sector_size); @@ -4607,10 +4600,12 @@ static void mkntfs_create_root_structures(void) } else { bs->clusters_per_mft_record = -(ffs(g_vol->mft_record_size) - 1); if ((u32)(1 << -bs->clusters_per_mft_record) != - g_vol->mft_record_size) + g_vol->mft_record_size) { + free(buf2); err_exit("BUG: calculated clusters_per_mft_record " "is wrong (= 0x%x)\n", bs->clusters_per_mft_record); + } } ntfs_log_debug("clusters per mft record = %i (0x%x)\n", bs->clusters_per_mft_record, @@ -4620,10 +4615,12 @@ static void mkntfs_create_root_structures(void) g_vol->cluster_size; } else { bs->clusters_per_index_record = -g_vol->indx_record_size_bits; - if ((1 << -bs->clusters_per_index_record) != (s32)g_vol->indx_record_size) + if ((1 << -bs->clusters_per_index_record) != (s32)g_vol->indx_record_size) { + free(buf2); err_exit("BUG: calculated clusters_per_index_record " "is wrong (= 0x%x)\n", bs->clusters_per_index_record); + } } ntfs_log_debug("clusters per index block = %i (0x%x)\n", bs->clusters_per_index_record, @@ -4637,9 +4634,11 @@ static void mkntfs_create_root_structures(void) */ bs->checksum = cpu_to_le32(0); /* Make sure the bootsector is ok. */ - if (!ntfs_boot_sector_is_ntfs(bs, TRUE)) + if (!ntfs_boot_sector_is_ntfs(bs, TRUE)) { + free(buf2); err_exit("FATAL: Generated boot sector is invalid!\n"); - err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_boot, g_buf2, 8192); + } + err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_boot, buf2, 8192); if (!err) err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_Boot, FILE_Boot), @@ -4651,10 +4650,12 @@ static void mkntfs_create_root_structures(void) init_system_file_sd(FILE_Boot, &sd, &i); err = add_attr_sd(m, sd, i); } - if (err < 0) + if (err < 0) { + free(buf2); err_exit("Couldn't create $Boot: %s\n", strerror(-err)); + } - if (create_backup_boot_sector(g_buf2)) { + if (create_backup_boot_sector(buf2)) { /* * Pre-2.6 kernels couldn't access the last sector * if it was odd hence we schedule chkdsk to create it. @@ -4662,8 +4663,8 @@ static void mkntfs_create_root_structures(void) volume_flags |= VOLUME_IS_DIRTY; } - free(g_buf2); - g_buf2 = NULL; + free(buf2); + buf2 = NULL; create_file_volume(m, root_ref, volume_flags); @@ -4720,26 +4721,28 @@ static void mkntfs_create_root_structures(void) "$Secure", FILE_NAME_WIN32_AND_DOS); if (!err) { if (g_vol->minor_ver == 0) { - g_buf_sds_first_size = 0x1E0; - g_buf_sds_size = 0x40000 + g_buf_sds_first_size; - g_buf_sds_init = calloc(1, g_buf_sds_first_size); - init_secure_30(g_buf_sds_init); + buf_sds_first_size = 0x1E0; + buf_sds_size = 0x40000 + buf_sds_first_size; + buf_sds_init = calloc(1, buf_sds_first_size); + init_secure_30(buf_sds_init); } else { - g_buf_sds_first_size = 0x240; - g_buf_sds_size = 0x40000 + g_buf_sds_first_size; - g_buf_sds_init = calloc(1, g_buf_sds_first_size); - init_secure_31(g_buf_sds_init); + buf_sds_first_size = 0x240; + buf_sds_size = 0x40000 + buf_sds_first_size; + buf_sds_init = calloc(1, buf_sds_first_size); + init_secure_31(buf_sds_init); } - g_buf_sds = calloc(1,g_buf_sds_size); - if (!g_buf_sds) + buf_sds = calloc(1,buf_sds_size); + if (!buf_sds) { + free(buf_sds_init); err_exit("Failed to allocate internal buffer:" " %s\n", strerror(errno)); - memcpy((char*)g_buf_sds, (char*)g_buf_sds_init, - g_buf_sds_first_size); - memcpy((char*)g_buf_sds + 0x40000, (char*)g_buf_sds_init, - g_buf_sds_first_size); - err = add_attr_data(m, "$SDS", 4, 0, 0, (u8*)g_buf_sds, - g_buf_sds_size); + } + memcpy(buf_sds, buf_sds_init, buf_sds_first_size); + memcpy(buf_sds + 0x40000, buf_sds_init, + buf_sds_first_size); + err = add_attr_data(m, "$SDS", 4, 0, 0, (u8*)buf_sds, + buf_sds_size); + free(buf_sds); } /* FIXME: This should be IGNORE_CASE */ if (!err) @@ -4751,7 +4754,10 @@ static void mkntfs_create_root_structures(void) err = add_attr_index_root(m, "$SII", 4, 0, AT_UNUSED, COLLATION_NTOFS_ULONG, g_vol->indx_record_size); if (!err) - err = initialize_secure(g_buf_sds_init, g_buf_sds_first_size, m); + err = initialize_secure(buf_sds_init, buf_sds_first_size, m); + + free (buf_sds_init); + buf_sds_init = NULL; if (err < 0) err_exit("Couldn't create $Secure: %s\n", strerror(-err)); From fd63d57947f5d282dee32e9c92cca626f74a9bbb Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 15 Nov 2005 14:48:10 +0000 Subject: [PATCH 2745/2994] *ahem* zero isn't true --- ntfsprogs/mkntfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index dc6528e4..4df74f6e 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -4932,7 +4932,7 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg /* transfer some options to the volume */ g_vol->vol_name = opts.label; // XXX when this is strdup, either free it, or call ntfs_umount - if (opts.ver_major && opts.ver_minor) { + if (opts.ver_major) { g_vol->major_ver = opts.ver_major; g_vol->minor_ver = opts.ver_minor; } else { From 56c8393be04c8b114ea9c90c7fd07a727e40b60d Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 15 Nov 2005 16:24:23 +0000 Subject: [PATCH 2746/2994] fix memleak in create_hardlink_res transfer ownership of attrdef and vol_name to the volume --- ntfsprogs/mkntfs.c | 70 ++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 4df74f6e..e0bd1c97 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3260,12 +3260,14 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, ntfs_log_error("create_hardlink failed inserting index entry: %s\n", strerror(-i)); /* FIXME: Remove the file name attribute from @m_file. */ + free(idx_entry_new); free(fn); /* Undo link count increment. */ m_file->link_count = cpu_to_le16( le16_to_cpu(m_file->link_count) - 1); return i; } + free(idx_entry_new); free(fn); return 0; } @@ -3383,11 +3385,8 @@ static void mkntfs_exit(void) ntfs_log_perror("Warning: Could not close %s", g_vol->dev->d_name); ntfs_device_free(g_vol->dev); } - /* Only free the attribute definitions, if we originally allocated them. */ - if ((g_vol->attrdef != (const ATTR_DEF*)attrdef_ntfs12_array) && - (g_vol->attrdef != (const ATTR_DEF*)attrdef_ntfs3x_array)) { - free(g_vol->attrdef); - } + free(g_vol->vol_name); + free(g_vol->attrdef); free(g_vol->upcase); free(g_vol); g_vol = NULL; @@ -3514,7 +3513,7 @@ static void mkntfs_override_phys_params(void) /* This function uses: * g_vol * g_volume_size - */ + */ int i; /* If user didn't specify the sector size, determine it now. */ @@ -4288,16 +4287,17 @@ static void mkntfs_create_root_structures(void) * g_volume_obj_id */ NTFS_BOOT_SECTOR *bs; - ATTR_RECORD *a; MFT_RECORD *m; - MFT_REF root_ref, extend_ref; - int i, j, err; + MFT_REF root_ref; + MFT_REF extend_ref; + int i; + int j; + int err; u8 *sd; FILE_ATTR_FLAGS extend_flags; VOLUME_FLAGS volume_flags = 0; int nr_sysfiles; u8 *buf2 = NULL; - int buf2_size = 0; int buf_sds_first_size = 0; int buf_sds_size = 0; char *buf_sds_init = NULL; @@ -4328,7 +4328,7 @@ static void mkntfs_create_root_structures(void) * fill the rest of it with empty, formatted records. */ if (nr_sysfiles * (s32)g_vol->mft_record_size < g_mft_size) { - for (i = nr_sysfiles; + for (i = nr_sysfiles; i * (s32)g_vol->mft_record_size < g_mft_size; i++) { m = (MFT_RECORD *)(g_buf + i * g_vol->mft_record_size); if (ntfs_mft_record_layout(g_vol, 0, m)) @@ -4422,6 +4422,7 @@ static void mkntfs_create_root_structures(void) err = upgrade_to_large_index(m, "$I30", 4, 0, &g_index_block); if (!err) { ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; ctx = ntfs_attr_get_search_ctx(NULL, m); if (!ctx) err_exit("Failed to allocate attribute search " @@ -4511,26 +4512,15 @@ static void mkntfs_create_root_structures(void) ntfs_log_verbose("Creating $AttrDef (mft record 4)\n"); m = (MFT_RECORD*)(g_buf + 4 * g_vol->mft_record_size); - if (g_vol->major_ver < 3) - buf2_size = 36000; - else - buf2_size = g_vol->attrdef_len; - buf2 = calloc(1, buf2_size); - if (!buf2) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); - memcpy(buf2, g_vol->attrdef, g_vol->attrdef_len); // XXX why do we need a special buffer for this? - err = add_attr_data(m, NULL, 0, 0, 0, buf2, buf2_size); - free(buf2); - buf2 = NULL; + + err = add_attr_data(m, NULL, 0, 0, 0, (u8*)g_vol->attrdef, g_vol->attrdef_len); if (!err) err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_AttrDef, FILE_AttrDef), - (buf2_size + g_vol->cluster_size - 1) & - ~(g_vol->cluster_size - 1), buf2_size, + (g_vol->attrdef_len + g_vol->cluster_size - 1) & + ~(g_vol->cluster_size - 1), g_vol->attrdef_len, FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0, "$AttrDef", FILE_NAME_WIN32_AND_DOS); - buf2_size = 0; if (!err) { init_system_file_sd(FILE_AttrDef, &sd, &i); err = add_attr_sd(m, sd, i); @@ -4931,7 +4921,14 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg } /* transfer some options to the volume */ - g_vol->vol_name = opts.label; // XXX when this is strdup, either free it, or call ntfs_umount + if (opts.label) { + g_vol->vol_name = strdup(opts.label); + if (!g_vol->vol_name) { + ntfs_log_perror("Could not copy volume name"); + goto done; + } + } + if (opts.ver_major) { g_vol->major_ver = opts.ver_major; g_vol->minor_ver = opts.ver_minor; @@ -4958,11 +4955,22 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg g_vol->indx_record_size_bits = 12; if (g_vol->major_ver < 3) { - g_vol->attrdef = (ATTR_DEF*)&attrdef_ntfs12_array; - g_vol->attrdef_len = sizeof(attrdef_ntfs12_array); + g_vol->attrdef = calloc(1, 36000); + if (g_vol->attrdef) { + memcpy(g_vol->attrdef, attrdef_ntfs12_array, sizeof(attrdef_ntfs12_array)); + g_vol->attrdef_len = 36000; + } } else { - g_vol->attrdef = (ATTR_DEF*)&attrdef_ntfs3x_array; - g_vol->attrdef_len = sizeof(attrdef_ntfs3x_array); + g_vol->attrdef = malloc(sizeof(attrdef_ntfs3x_array)); + if (g_vol->attrdef) { + memcpy(g_vol->attrdef, attrdef_ntfs3x_array, sizeof(attrdef_ntfs3x_array)); + g_vol->attrdef_len = sizeof(attrdef_ntfs3x_array); + } + } + + if (!g_vol->attrdef) { + ntfs_log_perror("Could not create attrdef structure"); + goto done; } if (mkntfs_open_partition()) /* Open the partition. */ From e58a468d0c659cf2b89f44a36958a9c28949a015 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 15 Nov 2005 16:31:40 +0000 Subject: [PATCH 2747/2994] * Fix bug with updating atime on read-only volumes. (Thanks to Szaka and Anton) * Add MS_NOATIME to ntfs_mount. (By Yuval's request) --- ChangeLog | 1 + include/ntfs/volume.h | 13 +++++++++---- libntfs/attrib.c | 5 +++-- libntfs/volume.c | 36 ++++++++++++++++++++---------------- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index a687443a..3b4687ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -88,6 +88,7 @@ xx/xx/2005 - 1.12.2-WIP stayed at approximately same level. (Yura) - Automatically update access and change time in ntfs_attr_p{read,write} and ntfs_attr_truncate. (Yura) + - Add support of MS_NOATIME flag to ntfs_mount(). (Yura) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 323e4d1e..285b156e 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -82,6 +82,7 @@ typedef enum { NV_ReadOnly, /* 1: Volume is read-only. */ NV_CaseSensitive, /* 1: Volume is mounted case-sensitive. */ NV_LogFileEmpty, /* 1: $logFile journal is empty. */ + NV_NoATime, /* 1: Do not update access time. */ } ntfs_volume_state_bits; #define test_nvol_flag(nv, flag) test_bit(NV_##flag, (nv)->state) @@ -100,11 +101,15 @@ typedef enum { #define NVolSetLogFileEmpty(nv) set_nvol_flag(nv, LogFileEmpty) #define NVolClearLogFileEmpty(nv) clear_nvol_flag(nv, LogFileEmpty) +#define NVolNoATime(nv) test_nvol_flag(nv, NoATime) +#define NVolSetNoATime(nv) set_nvol_flag(nv, NoATime) +#define NVolClearNoATime(nv) clear_nvol_flag(nv, NoATime) + /* * NTFS version 1.1 and 1.2 are used by Windows NT4. * NTFS version 2.x is used by Windows 2000 Beta * NTFS version 3.0 is used by Windows 2000. - * NTFS version 3.1 is used by Windows XP, Windows Server 2003 and Longhorn. + * NTFS version 3.1 is used by Windows XP, 2003 and Vista. */ #define NTFS_V1_1(major, minor) ((major) == 1 && (minor) == 1) @@ -200,13 +205,13 @@ struct _ntfs_volume { extern ntfs_volume *ntfs_volume_alloc(void); extern ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, - unsigned long rwflag); + unsigned long flags); extern ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, - unsigned long rwflag); + unsigned long flags); extern int ntfs_device_umount(ntfs_volume *vol, const BOOL force); -extern ntfs_volume *ntfs_mount(const char *name, unsigned long rwflag); +extern ntfs_volume *ntfs_mount(const char *name, unsigned long flags); extern int ntfs_umount(ntfs_volume *vol, const BOOL force); extern int ntfs_version_is_supported(ntfs_volume *vol); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 5e5111d4..4b1094e8 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -770,8 +770,10 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) errno = EACCES; return -1; } + vol = na->ni->vol; /* Update access time if accessing unnamed data attribute. */ - if (na->type == AT_DATA && na->name == AT_UNNAMED) { + if (!NVolReadOnly(vol) && !NVolNoATime(vol) && na->type == AT_DATA && + na->name == AT_UNNAMED) { na->ni->last_access_time = time(NULL); NInoFileNameSetDirty(na->ni); NInoSetDirty(na->ni); @@ -784,7 +786,6 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) return 0; count = na->data_size - pos; } - vol = na->ni->vol; /* If it is a resident attribute, get the value from the mft record. */ if (!NAttrNonResident(na)) { ntfs_attr_search_ctx *ctx; diff --git a/libntfs/volume.c b/libntfs/volume.c index 1f27b516..d3f4d169 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -384,7 +384,7 @@ error_exit: /** * ntfs_volume_startup - allocate and setup an ntfs volume * @dev: device to open - * @rwflag: optional mount flags + * @flags: optional mount flags * * Load, verify, and parse bootsector; load and setup $MFT and $MFTMirr. After * calling this function, the volume is setup sufficiently to call all read @@ -393,7 +393,7 @@ error_exit: * Return the allocated volume structure on success and NULL on error with * errno set to the error code. */ -ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) +ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long flags) { LCN mft_zone_size, mft_lcn; s64 br; @@ -429,8 +429,10 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long rwflag) } ntfs_upcase_table_build(vol->upcase, vol->upcase_len * sizeof(ntfschar)); - if ((rwflag & MS_RDONLY) == MS_RDONLY) + if (flags & MS_RDONLY) NVolSetReadOnly(vol); + if (flags & MS_NOATIME) + NVolSetNoATime(vol); ntfs_log_debug("Reading bootsector... "); if (dev->d_ops->open(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) { ntfs_log_debug(FAILED); @@ -730,15 +732,16 @@ out: /** * ntfs_device_mount - open ntfs volume * @dev: device to open - * @rwflag: optional mount flags + * @flags: optional mount flags * * This function mounts an ntfs volume. @dev should describe the device which * to mount as the ntfs volume. * - * @rwflags is an optional second parameter. The same flags are used as for - * the mount system call (man 2 mount). Currently only the following flag - * is implemented: + * @flags is an optional second parameter. The same flags are used as for + * the mount system call (man 2 mount). Currently only the following flags + * are implemented: * MS_RDONLY - mount volume read-only + * MS_NOATIME - do not update access time * * The function opens the device @dev and verifies that it contains a valid * bootsector. Then, it allocates an ntfs_volume structure and initializes @@ -749,7 +752,7 @@ out: * Return the allocated volume structure on success and NULL on error with * errno set to the error code. */ -ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) +ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags) { s64 l; #ifndef NTFS_DISABLE_DEBUG_LOGGING @@ -767,7 +770,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) int i, j, eo; u32 u; - vol = ntfs_volume_startup(dev, rwflag); + vol = ntfs_volume_startup(dev, flags); if (!vol) { ntfs_log_perror("Failed to startup volume"); return NULL; @@ -1101,7 +1104,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long rwflag) * Check for dirty logfile and hibernated Windows. * We care only about read-write mounts. */ - if (!(rwflag & MS_RDONLY)) { + if (!(flags & MS_RDONLY)) { if (ntfs_volume_check_logfile(vol) < 0) goto error_exit; if (ntfs_volume_check_hiberfile(vol) < 0) @@ -1125,15 +1128,16 @@ error_exit: /** * ntfs_mount - open ntfs volume * @name: name of device/file to open - * @rwflag: optional mount flags + * @flags: optional mount flags * * This function mounts an ntfs volume. @name should contain the name of the * device/file to mount as the ntfs volume. * - * @rwflags is an optional second parameter. The same flags are used as for - * the mount system call (man 2 mount). Currently only the following flag - * is implemented: + * @flags is an optional second parameter. The same flags are used as for + * the mount system call (man 2 mount). Currently only the following flags + * are implemented: * MS_RDONLY - mount volume read-only + * MS_NOATIME - do not update access time * * The function opens the device or file @name and verifies that it contains a * valid bootsector. Then, it allocates an ntfs_volume structure and initializes @@ -1148,7 +1152,7 @@ error_exit: * soon as the function returns. */ ntfs_volume *ntfs_mount(const char *name __attribute__((unused)), - unsigned long rwflag __attribute__((unused))) + unsigned long flags __attribute__((unused))) { #ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS struct ntfs_device *dev; @@ -1159,7 +1163,7 @@ ntfs_volume *ntfs_mount(const char *name __attribute__((unused)), if (!dev) return NULL; /* Call ntfs_device_mount() to do the actual mount. */ - vol = ntfs_device_mount(dev, rwflag); + vol = ntfs_device_mount(dev, flags); if (!vol) { int eo = errno; ntfs_device_free(dev); From 52669676324c5b61260b2fbeb0cecf917e9956dc Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 15 Nov 2005 16:41:39 +0000 Subject: [PATCH 2748/2994] ntfsmount: pass MS_NOATIME flag to ntfs_mount, let VFS care about access time. --- ntfsprogs/ntfsmount.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 1f99a413..02075f80 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1366,7 +1366,8 @@ static int ntfs_fuse_mount(const char *device) { ntfs_volume *vol; - vol = utils_mount_volume(device, (ctx->ro) ? MS_RDONLY : 0, ctx->force); + vol = utils_mount_volume(device, ((ctx->ro) ? MS_RDONLY : 0) | + MS_NOATIME, ctx->force); if (!vol) { ntfs_log_error("Mount failed.\n"); return -1; From 1b856b5451b35b5b68850c3f054dd6f8c16be455 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 16 Nov 2005 00:13:10 +0000 Subject: [PATCH 2749/2994] Dump $Secure $SDH and $SII, $Quota $O and $R index attribute data; Fix printf field width specifiers --- ntfsprogs/ntfsinfo.c | 88 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 3b705806..205846c6 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -497,7 +497,7 @@ static void ntfs_dump_flags(ATTR_TYPES type, u32 flags) flags &= ~FILE_ATTR_VIEW_INDEX_PRESENT; } if (flags) - printf(" UNKNOWN: 0x%04x", (unsigned int)le32_to_cpu(flags)); + printf(" UNKNOWN: 0x%08x", (unsigned int)le32_to_cpu(flags)); printf("\n"); } @@ -1136,7 +1136,7 @@ static void ntfs_dump_index_key(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) le32_to_cpu(entry->key.sii.security_id)); break; case INDEX_ATTR_SECURE_SDH: - ntfs_log_verbose("\t\tKey hash:\t\t 0x%04x\n", + ntfs_log_verbose("\t\tKey hash:\t\t 0x%08x\n", le32_to_cpu(entry->key.sdh.hash)); ntfs_log_verbose("\t\tKey security id:\t %u\n", le32_to_cpu(entry->key.sdh.security_id)); @@ -1146,7 +1146,7 @@ static void ntfs_dump_index_key(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) ntfs_log_verbose("\t\tKey GUID:\t\t %s\n", printable_GUID); break; case INDEX_ATTR_REPARSE_R: - ntfs_log_verbose("\t\tKey reparse tag:\t 0x%04x\n", + ntfs_log_verbose("\t\tKey reparse tag:\t 0x%08x\n", le32_to_cpu(entry->key.reparse.reparse_tag)); ntfs_log_verbose("\t\tKey file id:\t\t %llu\n", le64_to_cpu(entry->key.reparse.file_id)); @@ -1161,7 +1161,85 @@ static void ntfs_dump_index_key(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) le32_to_cpu(entry->key.owner_id)); break; default: - ntfs_log_verbose("\t\tKey is UNKNOWN: \t 0x%04x\n", + ntfs_log_verbose("\t\tIndex attr type is UNKNOWN: \t 0x%08x\n", + le32_to_cpu(type)); + break; + } +} + +typedef union { + SII_INDEX_DATA sii; /* $SII index data in $Secure */ + SDH_INDEX_DATA sdh; /* $SDH index data in $Secure */ + QUOTA_O_INDEX_DATA quota_o; /* $O index data in $Quota */ + QUOTA_CONTROL_ENTRY quota_q; /* $Q index data in $Quota */ +} __attribute__((__packed__)) INDEX_ENTRY_DATA; + +static void ntfs_dump_index_data(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) +{ + INDEX_ENTRY_DATA *data; + + data = (INDEX_ENTRY_DATA *)((u8 *)entry + entry->data_offset); + + switch (type) { + case INDEX_ATTR_SECURE_SII: + ntfs_log_verbose("\t\tHash:\t\t\t 0x%08x\n", + le32_to_cpu(data->sii.hash)); + ntfs_log_verbose("\t\tSecurity id:\t\t %u\n", + le32_to_cpu(data->sii.security_id)); + ntfs_log_verbose("\t\tOffset in $SDS:\t\t %llu\n", + le64_to_cpu(data->sii.offset)); + ntfs_log_verbose("\t\tLength in $SDS:\t\t %u\n", + le32_to_cpu(data->sii.length)); + break; + case INDEX_ATTR_SECURE_SDH: + ntfs_log_verbose("\t\tHash:\t\t\t 0x%08x\n", + le32_to_cpu(data->sdh.hash)); + ntfs_log_verbose("\t\tSecurity id:\t\t %u\n", + le32_to_cpu(data->sdh.security_id)); + ntfs_log_verbose("\t\tOffset in $SDS:\t\t %llu\n", + le64_to_cpu(data->sdh.offset)); + ntfs_log_verbose("\t\tLength in $SDS:\t\t %u\n", + le32_to_cpu(data->sdh.length)); + ntfs_log_verbose("\t\tUnknown (padding):\t 0x%08x\n", + le32_to_cpu(data->sdh.reserved_II)); + break; + case INDEX_ATTR_OBJID_O: + /* TODO */ + break; + case INDEX_ATTR_REPARSE_R: + /* TODO */ + break; + case INDEX_ATTR_QUOTA_O: + ntfs_log_verbose("\t\tOwner id:\t\t %u\n", + le32_to_cpu(data->quota_o.owner_id)); + ntfs_log_verbose("\t\tUnknown:\t\t %u\n", + le32_to_cpu(data->quota_o.unknown)); + break; + case INDEX_ATTR_QUOTA_Q: + ntfs_log_verbose("\t\tVersion:\t\t %u\n", + le32_to_cpu(data->quota_q.version)); + ntfs_log_verbose("\t\tQuota flags:\t\t 0x%08x\n", + le32_to_cpu(data->quota_q.flags)); + ntfs_log_verbose("\t\tBytes used:\t\t %llu\n", + le64_to_cpu(data->quota_q.bytes_used)); + ntfs_log_verbose("\t\tLast changed:\t\t %s", + ntfsinfo_time_to_str( + data->quota_q.change_time)); + ntfs_log_verbose("\t\tThreshold:\t\t %lld\n", + le64_to_cpu(data->quota_q.threshold)); + ntfs_log_verbose("\t\tLimit:\t\t\t %lld\n", + le64_to_cpu(data->quota_q.limit)); + ntfs_log_verbose("\t\tExceeded time:\t\t %lld\n", + le64_to_cpu(data->quota_q.exceeded_time)); + if (entry->data_length > 48) { + char *sid; + sid = ntfs_sid_to_mbs(&data->quota_q.sid, NULL, 0); + ntfs_log_verbose("\t\tOwner SID:\t\t %s\n", sid); + free(sid); + } + break; + default: + ntfs_log_verbose("\t\tIndex attr type is UNKNOWN: \t 0x%08x\n", le32_to_cpu(type)); break; } @@ -1235,7 +1313,7 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) ntfs_log_verbose("\t\tData length:\t\t %u\n", le16_to_cpu(entry->data_length)); ntfs_dump_index_key(entry, type); - // TODO: dump index attribute data too + ntfs_dump_index_data(entry, type); break; } entry = (INDEX_ENTRY *)((u8 *)entry + From 94e1647414f3b140bafb1f7e1e7e1cd7c04a9d91 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 16 Nov 2005 00:17:53 +0000 Subject: [PATCH 2750/2994] More comments on SDH_INDEX_DATA's reserved_II field --- include/ntfs/layout.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 06c12998..b564426e 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1913,7 +1913,8 @@ typedef struct { u32 security_id; /* The security_id assigned to the descriptor. */ u64 offset; /* Byte offset of this entry in the $SDS stream. */ u32 length; /* Size in bytes of this entry in $SDS stream. */ - u32 reserved_II; /* Padding - always unicode "II". */ + u32 reserved_II; /* Padding - always unicode "II" or zero. This field + isn't counted in INDEX_ENTRY's data_length. */ } __attribute__((__packed__)) SDH_INDEX_DATA; /** From 354c6442a97f59559e5082058eac3cc1f83ae229 Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 16 Nov 2005 02:55:16 +0000 Subject: [PATCH 2751/2994] a handful more of subjective cleanups --- ntfsprogs/mkntfs.c | 76 ++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index e0bd1c97..9a8241d9 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1208,15 +1208,18 @@ static runlist * allocate_scattered_clusters(s64 clusters) vcn++; } else { rl[rlpos].vcn = vcn++; - rl[rlpos].lcn = prev_lcn = lcn; - rl[rlpos].length = prev_run_len = 1LL; + rl[rlpos].lcn = lcn; + prev_lcn = lcn; + rl[rlpos].length = 1LL; + prev_run_len = 1LL; rlpos++; } /* Done? */ if (!--clusters) { /* Add terminator element and return. */ rl[rlpos].vcn = vcn; - rl[rlpos].lcn = rl[rlpos].length = 0LL; + rl[rlpos].lcn = 0LL; + rl[rlpos].length = 0LL; return rl; } @@ -2647,7 +2650,7 @@ static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *idx, * ntfs_index_keys_compare * * not all types of COLLATION_RULES supported yet... - * added as needed.. (remove this comment when all is added) + * added as needed.. (remove this comment when all are added) */ static int ntfs_index_keys_compare(char *key1, char *key2, int key1_length,int key2_length, @@ -3478,7 +3481,8 @@ static int mkntfs_open_partition(void) } ntfs_log_warning("mkntfs forced anyway.\n"); #ifdef HAVE_LINUX_MAJOR_H - } else if ((IDE_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 64 == 0) || (SCSI_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 16 == 0)) { + } else if ((IDE_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 64 == 0) || + (SCSI_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 16 == 0)) { ntfs_log_error("%s is entire device, not just one partition.\n", g_vol->dev->d_name); if (!opts.force) { ntfs_log_error("Refusing to make a filesystem here!\n"); @@ -3802,7 +3806,8 @@ static void mkntfs_initialize_bitmaps(void) * Size is always one cluster, even though valid data size and * initialized data size are only 8 bytes. */ - g_rl_mft_bmp[1].vcn = g_rl_mft_bmp[0].length = 1LL; + g_rl_mft_bmp[1].vcn = 1LL; + g_rl_mft_bmp[0].length = 1LL; g_rl_mft_bmp[1].lcn = -1LL; g_rl_mft_bmp[1].length = 0LL; /* Allocate cluster for mft bitmap. */ @@ -3874,7 +3879,8 @@ static void mkntfs_initialize_rl_mft(void) g_rl_mft[0].lcn = g_mft_lcn; /* rounded up division by cluster size */ j = (g_mft_size + g_vol->cluster_size - 1) / g_vol->cluster_size; - g_rl_mft[1].vcn = g_rl_mft[0].length = j; + g_rl_mft[1].vcn = j; + g_rl_mft[0].length = j; g_rl_mft[1].lcn = -1LL; g_rl_mft[1].length = 0LL; /* Allocate clusters for mft. */ @@ -3900,7 +3906,8 @@ static void mkntfs_initialize_rl_mft(void) * whichever is bigger). */ j = (4 * g_vol->mft_record_size + g_vol->cluster_size - 1) / g_vol->cluster_size; - g_rl_mftmirr[1].vcn = g_rl_mftmirr[0].length = j; + g_rl_mftmirr[1].vcn = j; + g_rl_mftmirr[0].length = j; g_rl_mftmirr[1].lcn = -1LL; g_rl_mftmirr[1].length = 0LL; /* Allocate clusters for mft mirror. */ @@ -3972,7 +3979,8 @@ static void mkntfs_initialize_rl_logfile(void) err_exit("$LogFile would be created with invalid size. This " "is not allowed as it would cause Windows to " "blue screen and during boot.\n"); - g_rl_logfile[1].vcn = g_rl_logfile[0].length = j; + g_rl_logfile[1].vcn = j; + g_rl_logfile[0].length = j; g_rl_logfile[1].lcn = -1LL; g_rl_logfile[1].length = 0LL; /* Allocate clusters for log file. */ @@ -4005,7 +4013,8 @@ static void mkntfs_initialize_rl_boot(void) * bigger. */ j = (8192 + g_vol->cluster_size - 1) / g_vol->cluster_size; - g_rl_boot[1].vcn = g_rl_boot[0].length = j; + g_rl_boot[1].vcn = j; + g_rl_boot[0].length = j; g_rl_boot[1].lcn = -1LL; g_rl_boot[1].length = 0LL; /* Allocate clusters for $Boot. */ @@ -4034,7 +4043,8 @@ static void mkntfs_initialize_rl_bad(void) * $BadClus named stream $Bad contains the whole volume as a single * sparse runlist entry. */ - g_rl_bad[1].vcn = g_rl_bad[0].length = g_vol->nr_clusters; + g_rl_bad[1].vcn = g_vol->nr_clusters; + g_rl_bad[0].length = g_vol->nr_clusters; g_rl_bad[1].lcn = -1LL; g_rl_bad[1].length = 0LL; @@ -4259,6 +4269,7 @@ bb_err: return -1; } + /** * mkntfs_create_root_structures - * @@ -4297,7 +4308,7 @@ static void mkntfs_create_root_structures(void) FILE_ATTR_FLAGS extend_flags; VOLUME_FLAGS volume_flags = 0; int nr_sysfiles; - u8 *buf2 = NULL; + u8 *buf_log = NULL; int buf_sds_first_size = 0; int buf_sds_size = 0; char *buf_sds_init = NULL; @@ -4403,10 +4414,10 @@ static void mkntfs_create_root_structures(void) if (g_vol->major_ver == 1) { init_system_file_sd(FILE_root, &sd, &i); err = add_attr_sd(m, sd, i); - } else if (g_vol->major_ver == 3 && g_vol->minor_ver == 0) { + } else if (NTFS_V3_0(g_vol->major_ver, g_vol->minor_ver) { init_system_file_sd(FILE_root, &sd, &i); err = add_attr_sd(m, sd, i); - } else if (g_vol->major_ver == 3 && g_vol->minor_ver == 1) { + } else if (NTFS_V3_1(g_vol->major_ver, g_vol->minor_ver) { init_root_sd_31(&sd, &i); err = add_attr_sd(m, sd, i); } else { @@ -4487,15 +4498,15 @@ static void mkntfs_create_root_structures(void) /* dump_mft_record(m); */ ntfs_log_verbose("Creating $LogFile (mft record 2)\n"); m = (MFT_RECORD*)(g_buf + 2 * g_vol->mft_record_size); - buf2 = malloc(g_logfile_size); - if (!buf2) + buf_log = malloc(g_logfile_size); + if (!buf_log) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - memset(buf2, -1, g_logfile_size); - err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_logfile, buf2, + memset(buf_log, -1, g_logfile_size); + err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_logfile, buf_log, g_logfile_size); - free(buf2); - buf2 = NULL; + free(buf_log); + buf_log = NULL; if (!err) err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_LogFile, FILE_LogFile), @@ -4552,19 +4563,19 @@ static void mkntfs_create_root_structures(void) if (err < 0) err_exit("Couldn't create $Bitmap: %s\n", strerror(-err)); /* dump_mft_record(m); */ + ntfs_log_verbose("Creating $Boot (mft record 7)\n"); m = (MFT_RECORD*)(g_buf + 7 * g_vol->mft_record_size); - buf2 = calloc(1, 8192); - if (!buf2) + bs = calloc(1, 8192); + if (!bs) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); - memcpy(buf2, boot_array, sizeof(boot_array)); + memcpy(bs, boot_array, sizeof(boot_array)); /* - * Create the boot sector in buf2. Note, that buf2 is already zeroed + * Create the boot sector in bs. Note, that bs is already zeroed * in the boot sector section and that it has the NTFS OEM id/magic * already inserted, so no need to worry about these things. */ - bs = (NTFS_BOOT_SECTOR*)buf2; bs->bpb.bytes_per_sector = cpu_to_le16(opts.sector_size); bs->bpb.sectors_per_cluster = (u8)(g_vol->cluster_size / opts.sector_size); @@ -4591,7 +4602,7 @@ static void mkntfs_create_root_structures(void) bs->clusters_per_mft_record = -(ffs(g_vol->mft_record_size) - 1); if ((u32)(1 << -bs->clusters_per_mft_record) != g_vol->mft_record_size) { - free(buf2); + free(bs); err_exit("BUG: calculated clusters_per_mft_record " "is wrong (= 0x%x)\n", bs->clusters_per_mft_record); @@ -4606,7 +4617,7 @@ static void mkntfs_create_root_structures(void) } else { bs->clusters_per_index_record = -g_vol->indx_record_size_bits; if ((1 << -bs->clusters_per_index_record) != (s32)g_vol->indx_record_size) { - free(buf2); + free(bs); err_exit("BUG: calculated clusters_per_index_record " "is wrong (= 0x%x)\n", bs->clusters_per_index_record); @@ -4625,10 +4636,10 @@ static void mkntfs_create_root_structures(void) bs->checksum = cpu_to_le32(0); /* Make sure the bootsector is ok. */ if (!ntfs_boot_sector_is_ntfs(bs, TRUE)) { - free(buf2); + free(bs); err_exit("FATAL: Generated boot sector is invalid!\n"); } - err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_boot, buf2, 8192); + err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_boot, (u8*)bs, 8192); if (!err) err = create_hardlink(g_index_block, root_ref, m, MK_LE_MREF(FILE_Boot, FILE_Boot), @@ -4641,11 +4652,11 @@ static void mkntfs_create_root_structures(void) err = add_attr_sd(m, sd, i); } if (err < 0) { - free(buf2); + free(bs); err_exit("Couldn't create $Boot: %s\n", strerror(-err)); } - if (create_backup_boot_sector(buf2)) { + if (create_backup_boot_sector((u8*)bs)) { /* * Pre-2.6 kernels couldn't access the last sector * if it was odd hence we schedule chkdsk to create it. @@ -4653,8 +4664,7 @@ static void mkntfs_create_root_structures(void) volume_flags |= VOLUME_IS_DIRTY; } - free(buf2); - buf2 = NULL; + free(bs); create_file_volume(m, root_ref, volume_flags); From 418da4bd4bc82c583667b6ec7aa08dc1df1a9518 Mon Sep 17 00:00:00 2001 From: flatcap Date: Wed, 16 Nov 2005 02:58:49 +0000 Subject: [PATCH 2752/2994] it came from space (and ate my brackets) --- ntfsprogs/mkntfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 9a8241d9..809601cc 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -4414,10 +4414,10 @@ static void mkntfs_create_root_structures(void) if (g_vol->major_ver == 1) { init_system_file_sd(FILE_root, &sd, &i); err = add_attr_sd(m, sd, i); - } else if (NTFS_V3_0(g_vol->major_ver, g_vol->minor_ver) { + } else if (NTFS_V3_0(g_vol->major_ver, g_vol->minor_ver)) { init_system_file_sd(FILE_root, &sd, &i); err = add_attr_sd(m, sd, i); - } else if (NTFS_V3_1(g_vol->major_ver, g_vol->minor_ver) { + } else if (NTFS_V3_1(g_vol->major_ver, g_vol->minor_ver)) { init_root_sd_31(&sd, &i); err = add_attr_sd(m, sd, i); } else { From fadcc0df7c6b07402f7c7ad946d27d15f6ad1391 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 16 Nov 2005 16:27:27 +0000 Subject: [PATCH 2753/2994] Do not update time for system files (inode number < FILE_first_user) in ntfs_attr_p{read,write}. Who cares about them, but this solves segfault during umount. --- libntfs/attrib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 4b1094e8..859cb054 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -772,7 +772,8 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) } vol = na->ni->vol; /* Update access time if accessing unnamed data attribute. */ - if (!NVolReadOnly(vol) && !NVolNoATime(vol) && na->type == AT_DATA && + if (!NVolReadOnly(vol) && !NVolNoATime(vol) && na->ni->mft_no >= + FILE_first_user && na->type == AT_DATA && na->name == AT_UNNAMED) { na->ni->last_access_time = time(NULL); NInoFileNameSetDirty(na->ni); @@ -960,7 +961,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) return -1; } /* Update time if writing to unnamed data attribute. */ - if (na->type == AT_DATA && na->name == AT_UNNAMED) { + if (na->ni->mft_no >= FILE_first_user && na->type == AT_DATA && + na->name == AT_UNNAMED) { na->ni->last_data_change_time = time(NULL); na->ni->last_mft_change_time = time(NULL); NInoFileNameSetDirty(na->ni); From f7b087b07d082166372b73c02c6c94e1ef2ae05a Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 16 Nov 2005 17:09:12 +0000 Subject: [PATCH 2754/2994] it seems that atime updates in fuse a broken, handle them ourselves --- ntfsprogs/ntfsmount.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 02075f80..ad3cb2c6 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -97,6 +97,7 @@ typedef struct { BOOL succeed_chmod; BOOL force; BOOL debug; + BOOL noatime; } ntfs_fuse_context_t; typedef enum { @@ -1367,7 +1368,7 @@ static int ntfs_fuse_mount(const char *device) ntfs_volume *vol; vol = utils_mount_volume(device, ((ctx->ro) ? MS_RDONLY : 0) | - MS_NOATIME, ctx->force); + ((ctx->noatime) ? MS_NOATIME : 0), ctx->force); if (!vol) { ntfs_log_error("Mount failed.\n"); return -1; @@ -1424,6 +1425,14 @@ static char *parse_mount_options(const char *org_options) } ctx->ro = TRUE; strcat(ret, "ro,"); + } else if (!strcmp(opt, "noatime")) { + if (val) { + ntfs_log_error("'noatime' option should not " + "have value.\n"); + goto err_exit; + } + ctx->noatime = TRUE; + strcat(ret, "noatime,"); /* Duplicate it for FUSE. */ } else if (!strcmp(opt, "fake_rw")) { if (val) { ntfs_log_error("'fake_rw' option should not " From 1e14b996c09ba1927116002a8e8bfb8d8f1c271d Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 16 Nov 2005 21:36:20 +0000 Subject: [PATCH 2755/2994] - fixed -T/--zero-time for 3.x volumes - reordered initialization of $Quota indexes - added ntfs_calloc() - fixed all missing memory allocation error handlings in initialize_quota() --- ntfsprogs/mkntfs.c | 166 +++++++++++++++++++++++++-------------------- 1 file changed, 94 insertions(+), 72 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 809601cc..15afa86d 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -576,6 +576,20 @@ static time_t mkntfs_time(void) return 0; } +/** + * mkntfs_calloc + */ +static void *ntfs_calloc(size_t nmemb, size_t size) +{ + void *p; + + p = calloc(nmemb, size); + if (!p) + ntfs_log_perror("Failed to calloc() %lld bytes", + (long long)nmemb * size); + return p; +} + /** * append_to_bad_blocks * @@ -2937,14 +2951,87 @@ static int initialize_quota(MFT_RECORD *m) INDEX_ENTRY *idx_entry_o, *idx_entry_q1, *idx_entry_q2; QUOTA_O_INDEX_DATA *idx_entry_o_data; QUOTA_CONTROL_ENTRY *idx_entry_q1_data, *idx_entry_q2_data; + err = 0; - o_size = cpu_to_le32(0x28); + + /* q index entry num 1 */ q1_size = cpu_to_le32(0x48); - q2_size = cpu_to_le32(0x58); + idx_entry_q1 = ntfs_calloc(1, q1_size); + if (!idx_entry_q1) + return errno; + + idx_entry_q1->data_offset = cpu_to_le16(0x14); + idx_entry_q1->data_length = cpu_to_le16(0x30); + idx_entry_q1->reservedV = cpu_to_le32(0x00); + idx_entry_q1->length = cpu_to_le16(0x48); + idx_entry_q1->key_length = cpu_to_le16(0x04); + idx_entry_q1->flags = cpu_to_le16(0x00); + idx_entry_q1->reserved = cpu_to_le16(0x00); + idx_entry_q1->key.owner_id = cpu_to_le32(0x01); + idx_entry_q1_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q1 + + idx_entry_q1->data_offset); + idx_entry_q1_data->version = cpu_to_le32(0x02); + idx_entry_q1_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; + if (g_vol->minor_ver == 0) + idx_entry_q1_data->flags |= QUOTA_FLAG_OUT_OF_DATE; + idx_entry_q1_data->bytes_used = cpu_to_le64(0x00); + idx_entry_q1_data->change_time = utc2ntfs(mkntfs_time()); + idx_entry_q1_data->threshold = cpu_to_sle64(-0x01); + idx_entry_q1_data->limit = cpu_to_sle64(-0x01); + idx_entry_q1_data->exceeded_time = cpu_to_sle64(0x00); - idx_entry_o = calloc(1, o_size); - idx_entry_q1 = calloc(1, q1_size); - idx_entry_q2 = calloc(1, q2_size); + err = insert_index_entry_in_res_dir_index(idx_entry_q1, + q1_size, m, + NTFS_INDEX_Q, 2, AT_UNUSED); + free(idx_entry_q1); + if (err) + return err; + + /* q index entry num 2 */ + q2_size = cpu_to_le32(0x58); + idx_entry_q2 = ntfs_calloc(1, q2_size); + if (!idx_entry_q2) + return errno; + + idx_entry_q2->data_offset = cpu_to_le16(0x14); + idx_entry_q2->data_length = cpu_to_le16(0x40); + idx_entry_q2->reservedV = cpu_to_le32(0x00); + idx_entry_q2->length = cpu_to_le16(0x58); + idx_entry_q2->key_length = cpu_to_le16(0x04); + idx_entry_q2->flags = cpu_to_le16(0x00); + idx_entry_q2->reserved = cpu_to_le16(0x00); + idx_entry_q2->key.owner_id = QUOTA_FIRST_USER_ID; + idx_entry_q2_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q2 + + idx_entry_q2->data_offset); + idx_entry_q2_data->version = cpu_to_le32(0x02); + idx_entry_q2_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; + idx_entry_q2_data->bytes_used = cpu_to_le64(0x00); + idx_entry_q2_data->change_time = utc2ntfs(mkntfs_time());; + idx_entry_q2_data->threshold = cpu_to_sle64(-0x01); + idx_entry_q2_data->limit = cpu_to_sle64(-0x01); + idx_entry_q2_data->exceeded_time = cpu_to_sle64(0x00); + idx_entry_q2_data->sid.revision = 1; + idx_entry_q2_data->sid.sub_authority_count = 2; + idx_entry_q2_data->sid.identifier_authority.high_part = + cpu_to_le16(0x0000); + idx_entry_q2_data->sid.identifier_authority.low_part = + cpu_to_le32(0x05000000); + idx_entry_q2_data->sid.sub_authority[0] = + cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + idx_entry_q2_data->sid.sub_authority[1] = + cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + + err = insert_index_entry_in_res_dir_index(idx_entry_q2, + q2_size, m, + NTFS_INDEX_Q, 2, AT_UNUSED); + free(idx_entry_q2); + if (err) + return err; + + o_size = cpu_to_le32(0x28); + idx_entry_o = ntfs_calloc(1, o_size); + if (!idx_entry_o) + return errno; idx_entry_o->data_offset = cpu_to_le16(0x20); idx_entry_o->data_length = cpu_to_le16(0x04); @@ -2973,70 +3060,6 @@ static int initialize_quota(MFT_RECORD *m) o_size, m, NTFS_INDEX_O, 2, AT_UNUSED); free(idx_entry_o); - if (err) - return err; - - /* q index entry num 1 */ - idx_entry_q1->data_offset = cpu_to_le16(0x14); - idx_entry_q1->data_length = cpu_to_le16(0x30); - idx_entry_q1->reservedV = cpu_to_le32(0x00); - idx_entry_q1->length = cpu_to_le16(0x48); - idx_entry_q1->key_length = cpu_to_le16(0x04); - idx_entry_q1->flags = cpu_to_le16(0x00); - idx_entry_q1->reserved = cpu_to_le16(0x00); - idx_entry_q1->key.owner_id = cpu_to_le32(0x01); - idx_entry_q1_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q1 - + idx_entry_q1->data_offset); - idx_entry_q1_data->version = cpu_to_le32(0x02); - idx_entry_q1_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; - if (g_vol->minor_ver == 0) - idx_entry_q1_data->flags |= QUOTA_FLAG_OUT_OF_DATE; - idx_entry_q1_data->bytes_used = cpu_to_le64(0x00); - idx_entry_q1_data->change_time = utc2ntfs(time(NULL)); - idx_entry_q1_data->threshold = cpu_to_sle64(-0x01); - idx_entry_q1_data->limit = cpu_to_sle64(-0x01); - idx_entry_q1_data->exceeded_time = cpu_to_sle64(0x00); - - err = insert_index_entry_in_res_dir_index(idx_entry_q1, - q1_size, m, - NTFS_INDEX_Q, 2, AT_UNUSED); - free(idx_entry_q1); - if (err) - return err; - - /* q index entry num 2 */ - idx_entry_q2->data_offset = cpu_to_le16(0x14); - idx_entry_q2->data_length = cpu_to_le16(0x40); - idx_entry_q2->reservedV = cpu_to_le32(0x00); - idx_entry_q2->length = cpu_to_le16(0x58); - idx_entry_q2->key_length = cpu_to_le16(0x04); - idx_entry_q2->flags = cpu_to_le16(0x00); - idx_entry_q2->reserved = cpu_to_le16(0x00); - idx_entry_q2->key.owner_id = QUOTA_FIRST_USER_ID; - idx_entry_q2_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q2 - + idx_entry_q2->data_offset); - idx_entry_q2_data->version = cpu_to_le32(0x02); - idx_entry_q2_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; - idx_entry_q2_data->bytes_used = cpu_to_le64(0x00); - idx_entry_q2_data->change_time = utc2ntfs(time(NULL));; - idx_entry_q2_data->threshold = cpu_to_sle64(-0x01); - idx_entry_q2_data->limit = cpu_to_sle64(-0x01); - idx_entry_q2_data->exceeded_time = cpu_to_sle64(0x00); - idx_entry_q2_data->sid.revision = 1; - idx_entry_q2_data->sid.sub_authority_count = 2; - idx_entry_q2_data->sid.identifier_authority.high_part = - cpu_to_le16(0x0000); - idx_entry_q2_data->sid.identifier_authority.low_part = - cpu_to_le32(0x05000000); - idx_entry_q2_data->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - idx_entry_q2_data->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - - err = insert_index_entry_in_res_dir_index(idx_entry_q2, - q2_size, m, - NTFS_INDEX_Q, 2, AT_UNUSED); - free(idx_entry_q2); return err; } @@ -3191,9 +3214,8 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, if (!fn) return -errno; fn->parent_directory = ref_parent; - /* FIXME: Is this correct? Or do we have to copy the creation_time */ - /* from the std info? */ - fn->creation_time = utc2ntfs(time(NULL)); + /* FIXME: copy the creation_time from the std info */ + fn->creation_time = utc2ntfs(mkntfs_time()); fn->last_data_change_time = fn->creation_time; fn->last_mft_change_time = fn->creation_time; fn->last_access_time = fn->creation_time; From e4cb2b5a4eed17057b6600c4328bc05233bc9f36 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 16 Nov 2005 22:07:48 +0000 Subject: [PATCH 2756/2994] - switched all calloc() calls to ntfs_calloc() - fixed all missing ntfs_calloc() error checking --- ntfsprogs/mkntfs.c | 57 +++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 15afa86d..147562ab 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -722,10 +722,9 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, } if (delta) { int eo; - char *b = calloc(1, delta); + char *b = ntfs_calloc(1, delta); if (!b) - err_exit("Error allocating internal buffer: " - "%s\n", strerror(errno)); + exit(1); bytes_written = mkntfs_write(dev, b, delta); eo = errno; free(b); @@ -2518,7 +2517,7 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, err = add_attr_bitmap(m, name, name_len, ic, bmp, sizeof(bmp)); if (err) goto err_out; - ia_val = calloc(1, index_block_size); + ia_val = ntfs_calloc(1, index_block_size); if (!ia_val) { err = -errno; goto err_out; @@ -2880,8 +2879,14 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) sdh_size += sizeof(SDH_INDEX_KEY) + sizeof(SDH_INDEX_DATA); sii_size = sizeof(INDEX_ENTRY_HEADER); sii_size += sizeof(SII_INDEX_KEY) + sizeof(SII_INDEX_DATA); - idx_entry_sdh = calloc(1, sizeof(INDEX_ENTRY)); - idx_entry_sii = calloc(1, sizeof(INDEX_ENTRY)); + idx_entry_sdh = ntfs_calloc(1, sizeof(INDEX_ENTRY)); + if (!idx_entry_sdh) + return -errno; + idx_entry_sii = ntfs_calloc(1, sizeof(INDEX_ENTRY)); + if (!idx_entry_sii) { + free(idx_entry_sdh); + return -errno; + } err = 0; while ((char*)sds_header < (char*)sds + sds_size) { @@ -3274,7 +3279,9 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, /* Insert the index entry for file_name in @idx. */ /* remmet ut kun for debugging */ idx_size = (fn_size + 7) & ~7; - idx_entry_new = calloc(1, idx_size + 0x10); + idx_entry_new = ntfs_calloc(1, idx_size + 0x10); + if (!idx_entry_new) + return -errno; idx_entry_new->indexed_file = ref_file; idx_entry_new->length = idx_size + 0x10; idx_entry_new->key_length = fn_size; @@ -3784,10 +3791,9 @@ static void mkntfs_initialize_bitmaps(void) ~(g_vol->cluster_size - 1); ntfs_log_debug("g_lcn_bitmap_byte_size = %i, allocated = %llu\n", g_lcn_bitmap_byte_size, i); - g_lcn_bitmap = calloc(1, g_lcn_bitmap_byte_size); + g_lcn_bitmap = ntfs_calloc(1, g_lcn_bitmap_byte_size); if (!g_lcn_bitmap) - err_exit("Failed to allocate internal buffer: %s", - strerror(errno)); + exit(1); /* * $Bitmap can overlap the end of the volume. Any bits in this region * must be set. This region also encompasses the backup boot sector. @@ -3811,10 +3817,9 @@ static void mkntfs_initialize_bitmaps(void) g_mft_bitmap_byte_size = (g_mft_bitmap_byte_size + 7) & ~7; ntfs_log_debug("mft_bitmap_size = %i, g_mft_bitmap_byte_size = %i\n", mft_bitmap_size, g_mft_bitmap_byte_size); - g_mft_bitmap = calloc(1, g_mft_bitmap_byte_size); + g_mft_bitmap = ntfs_calloc(1, g_mft_bitmap_byte_size); if (!g_mft_bitmap) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); + exit(1); /* Create runlist for mft bitmap. */ g_rl_mft_bmp = malloc(2 * sizeof(runlist)); if (!g_rl_mft_bmp) @@ -4588,10 +4593,9 @@ static void mkntfs_create_root_structures(void) ntfs_log_verbose("Creating $Boot (mft record 7)\n"); m = (MFT_RECORD*)(g_buf + 7 * g_vol->mft_record_size); - bs = calloc(1, 8192); + bs = ntfs_calloc(1, 8192); if (!bs) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); + exit(1); memcpy(bs, boot_array, sizeof(boot_array)); /* * Create the boot sector in bs. Note, that bs is already zeroed @@ -4745,19 +4749,22 @@ static void mkntfs_create_root_structures(void) if (g_vol->minor_ver == 0) { buf_sds_first_size = 0x1E0; buf_sds_size = 0x40000 + buf_sds_first_size; - buf_sds_init = calloc(1, buf_sds_first_size); + buf_sds_init = ntfs_calloc(1, buf_sds_first_size); + if (!buf_sds_init) + exit(1); init_secure_30(buf_sds_init); } else { buf_sds_first_size = 0x240; buf_sds_size = 0x40000 + buf_sds_first_size; - buf_sds_init = calloc(1, buf_sds_first_size); + buf_sds_init = ntfs_calloc(1, buf_sds_first_size); + if (!buf_sds_init) + exit(1); init_secure_31(buf_sds_init); } - buf_sds = calloc(1,buf_sds_size); + buf_sds = ntfs_calloc(1,buf_sds_size); if (!buf_sds) { free(buf_sds_init); - err_exit("Failed to allocate internal buffer:" - " %s\n", strerror(errno)); + exit(1); } memcpy(buf_sds, buf_sds_init, buf_sds_first_size); memcpy(buf_sds + 0x40000, buf_sds_init, @@ -4987,7 +4994,7 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg g_vol->indx_record_size_bits = 12; if (g_vol->major_ver < 3) { - g_vol->attrdef = calloc(1, 36000); + g_vol->attrdef = ntfs_calloc(1, 36000); if (g_vol->attrdef) { memcpy(g_vol->attrdef, attrdef_ntfs12_array, sizeof(attrdef_ntfs12_array)); g_vol->attrdef_len = 36000; @@ -5022,11 +5029,9 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg mkntfs_initialize_rl_boot(); /* Allocate a buffer large enough to hold the mft. */ - g_buf = calloc(1, g_mft_size); - if (!g_buf) { - ntfs_log_perror("Could not create work space"); + g_buf = ntfs_calloc(1, g_mft_size); + if (!g_buf) goto done; - } /* Create runlist for $BadClus, $DATA named stream $Bad. */ mkntfs_initialize_rl_bad(); From 2367a06b6e268f02286f6f3ce54ced5bd864a17c Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 17 Nov 2005 18:00:58 +0000 Subject: [PATCH 2757/2994] Rework time updates, more close to like windows does. Still do not update for / because of sync problems. --- include/ntfs/inode.h | 3 +++ libntfs/attrib.c | 33 +++++++++++++-------------------- libntfs/inode.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 20 deletions(-) diff --git a/include/ntfs/inode.h b/include/ntfs/inode.h index 22d35c89..e43f6932 100644 --- a/include/ntfs/inode.h +++ b/include/ntfs/inode.h @@ -171,6 +171,9 @@ static __inline__ void ntfs_inode_mark_dirty(ntfs_inode *ni) NInoSetDirty(ni->base_ni); } +extern void ntfs_inode_update_atime(ntfs_inode *ni); +extern void ntfs_inode_update_time(ntfs_inode *ni); + extern int ntfs_inode_sync(ntfs_inode *ni); extern int ntfs_inode_add_attrlist(ntfs_inode *ni); diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 859cb054..0282cdea 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -55,7 +55,6 @@ #include "compress.h" #include "bitmap.h" #include "logging.h" -#include "ntfstime.h" ntfschar AT_UNNAMED[] = { const_cpu_to_le16('\0') }; @@ -771,14 +770,10 @@ s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) return -1; } vol = na->ni->vol; - /* Update access time if accessing unnamed data attribute. */ - if (!NVolReadOnly(vol) && !NVolNoATime(vol) && na->ni->mft_no >= - FILE_first_user && na->type == AT_DATA && - na->name == AT_UNNAMED) { - na->ni->last_access_time = time(NULL); - NInoFileNameSetDirty(na->ni); - NInoSetDirty(na->ni); - } + /* Update access time if needed. */ + if (na->type == AT_DATA || na->type == AT_INDEX_ROOT || + na->type == AT_INDEX_ALLOCATION) + ntfs_inode_update_atime(na->ni); if (!count) return 0; /* Truncate reads beyond end of attribute. */ @@ -960,14 +955,10 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) errno = EOPNOTSUPP; return -1; } - /* Update time if writing to unnamed data attribute. */ - if (na->ni->mft_no >= FILE_first_user && na->type == AT_DATA && - na->name == AT_UNNAMED) { - na->ni->last_data_change_time = time(NULL); - na->ni->last_mft_change_time = time(NULL); - NInoFileNameSetDirty(na->ni); - NInoSetDirty(na->ni); - } + /* Update access and change times if needed. */ + if (na->type == AT_DATA || na->type == AT_INDEX_ROOT || + na->type == AT_INDEX_ALLOCATION) + ntfs_inode_update_time(na->ni); if (!count) return 0; /* If the write reaches beyond the end, extend the attribute. */ @@ -4932,10 +4923,8 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) ret = ntfs_non_resident_attr_shrink(na, newsize); } else ret = ntfs_resident_attr_resize(na, newsize); - /* Set FILE_NAME dirty flag, to update length and time in the index. */ + /* Set FILE_NAME dirty flag, to update file length in the index. */ if (na->type == AT_DATA && na->name == AT_UNNAMED) { - na->ni->last_data_change_time = time(NULL); - na->ni->last_mft_change_time = time(NULL); na->ni->data_size = na->data_size; /* * If attribute sparse or compressed then allocated size in @@ -4948,5 +4937,9 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize) na->ni->allocated_size = na->allocated_size; NInoFileNameSetDirty(na->ni); } + /* Update access and change times if needed. */ + if (na->type == AT_DATA || na->type == AT_INDEX_ROOT || + na->type == AT_INDEX_ALLOCATION) + ntfs_inode_update_time(na->ni); return ret; } diff --git a/libntfs/inode.c b/libntfs/inode.c index bca5c3a1..6410f397 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -1058,6 +1058,45 @@ put_err_out: return -1; } +/** + * ntfs_inode_update_atime - update access time for ntfs inode + * @ni: ntfs inode for which update access time + * + * This function usually get called when user read not metadata from inode. + * Do not update time for system files. + */ +void ntfs_inode_update_atime(ntfs_inode *ni) +{ + if (!NVolReadOnly(ni->vol) && !NVolNoATime(ni->vol) && (ni->mft_no >= + FILE_first_user /*|| ni->mft_no == FILE_root*/)) { + ni->last_access_time = time(NULL); + NInoFileNameSetDirty(ni); + NInoSetDirty(ni); + } +} + +/** + * ntfs_inode_update_time - update all times for ntfs inode + * @ni: ntfs inode for which udpate times + * + * This function updates last access, mft and data change times. Usually + * get called when user write not metadata to inode. Do not update time for + * system files. + */ +void ntfs_inode_update_time(ntfs_inode *ni) +{ + if (!NVolReadOnly(ni->vol) && !NVolNoATime(ni->vol) && (ni->mft_no >= + FILE_first_user /*|| ni->mft_no == FILE_root*/)) { + time_t now; + + now = time(NULL); + ni->last_access_time = now; + ni->last_data_change_time = now; + ni->last_mft_change_time = now; + NInoFileNameSetDirty(ni); + NInoSetDirty(ni); + } +} #ifdef NTFS_RICH From d311052205bc01ddd588bdd0a2586f7349aeda67 Mon Sep 17 00:00:00 2001 From: szaka Date: Fri, 18 Nov 2005 00:14:05 +0000 Subject: [PATCH 2758/2994] Create files with sequence numbers starting from 1 in $Extend --- ntfsprogs/mkntfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 147562ab..a9afb78c 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -4873,7 +4873,7 @@ static void mkntfs_create_root_structures(void) if (!err) err = create_hardlink_res((MFT_RECORD*)(g_buf + 11 * g_vol->mft_record_size), extend_ref, m, - MK_LE_MREF(24, 24), 0LL, 0LL, extend_flags, + MK_LE_MREF(24, 1), 0LL, 0LL, extend_flags, 0, 0, "$Quota", FILE_NAME_WIN32_AND_DOS); /* FIXME: This should be IGNORE_CASE */ if (!err) @@ -4894,7 +4894,7 @@ static void mkntfs_create_root_structures(void) if (!err) err = create_hardlink_res((MFT_RECORD*)(g_buf + 11 * g_vol->mft_record_size), extend_ref, - m, MK_LE_MREF(25, 25), 0LL, 0LL, + m, MK_LE_MREF(25, 1), 0LL, 0LL, extend_flags, 0, 0, "$ObjId", FILE_NAME_WIN32_AND_DOS); @@ -4911,7 +4911,7 @@ static void mkntfs_create_root_structures(void) if (!err) err = create_hardlink_res((MFT_RECORD*)(g_buf + 11 * g_vol->mft_record_size), - extend_ref, m, MK_LE_MREF(26, 26), + extend_ref, m, MK_LE_MREF(26, 1), 0LL, 0LL, extend_flags, 0, 0, "$Reparse", FILE_NAME_WIN32_AND_DOS); /* FIXME: This should be IGNORE_CASE */ From 3db9973bcfbcdfe1eeba411b70541b51977e92c4 Mon Sep 17 00:00:00 2001 From: szaka Date: Fri, 18 Nov 2005 00:24:45 +0000 Subject: [PATCH 2759/2994] ntfsclone: --metadata also wipes out the timestamps in the $I30 and in the /$Extend/$Quota:$Q index root attributes --- ChangeLog | 2 ++ ntfsprogs/ntfsclone.c | 46 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3b4687ed..79b1d74c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -89,6 +89,8 @@ xx/xx/2005 - 1.12.2-WIP - Automatically update access and change time in ntfs_attr_p{read,write} and ntfs_attr_truncate. (Yura) - Add support of MS_NOATIME flag to ntfs_mount(). (Yura) + - ntfsclone: --metadata also wipes out the timestamps in the $I30 and + in the /$Extend/$Quota:$Q index root attributes. (Szaka) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index fd3b90ef..1bfd8052 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -66,6 +66,7 @@ #include "mft.h" #include "bitmap.h" #include "inode.h" +#include "dir.h" #include "runlist.h" #include "utils.h" #include "version.h" @@ -699,10 +700,50 @@ static void restore_image(void) } } +static void wipe_index_root_timestamps(ATTR_RECORD *attr) +{ + INDEX_ENTRY *entry; + INDEX_ROOT *iroot; + + iroot = (INDEX_ROOT *)((u8 *)attr + le16_to_cpu(attr->value_offset)); + entry = (INDEX_ENTRY *)((u8 *)iroot + + le32_to_cpu(iroot->index.entries_offset) + 0x10); + + while (!(entry->flags & INDEX_ENTRY_END)) { + + if (iroot->type == AT_FILE_NAME) { + + entry->key.file_name.creation_time = 0; + entry->key.file_name.last_access_time = 0; + entry->key.file_name.last_data_change_time = 0; + entry->key.file_name.last_mft_change_time = 0; + + } else if (ntfs_names_are_equal(NTFS_INDEX_Q, + sizeof(NTFS_INDEX_Q) / 2 - 1, + (ntfschar *)((char *)attr + + le16_to_cpu(attr->name_offset)), + attr->name_length, 0, NULL, 0)) { + + QUOTA_CONTROL_ENTRY *quota_q; + + quota_q = (QUOTA_CONTROL_ENTRY *)((u8 *)entry + + entry->data_offset); + /* + * FIXME: no guarantee it's indeed /$Extend/$Quota:$Q + * till we only check for quota version 2 ... + */ + if (le32_to_cpu(quota_q->version) == 2) + quota_q->change_time = 0; + } + + entry = (INDEX_ENTRY*)((u8*)entry + le16_to_cpu(entry->length)); + } +} + #define WIPE_TIMESTAMPS(atype, attr) \ do { \ atype *ats; \ - ats = (atype *)((char*)(attr) + (attr)->value_offset); \ + ats = (atype *)((char *)(attr) + (attr)->value_offset); \ \ ats->creation_time = 0; \ ats->last_data_change_time = 0; \ @@ -722,6 +763,9 @@ static void wipe_timestamps(ntfs_walk_clusters_ctx *image) else if (a->type == AT_STANDARD_INFORMATION) WIPE_TIMESTAMPS(STANDARD_INFORMATION, a); + + else if (a->type == AT_INDEX_ROOT) + wipe_index_root_timestamps(a); } static void wipe_resident_data(ntfs_walk_clusters_ctx *image) From e90fdddc0822c1f99d203c047a2f7cdc1f18677d Mon Sep 17 00:00:00 2001 From: szaka Date: Fri, 18 Nov 2005 00:29:36 +0000 Subject: [PATCH 2760/2994] - added INDEX_ATTR_DIRECTORY_I30 timestamps dumping - ntfs_dump_index_entries(): reformatted switch to fit the used code style - ntfs_dump_index_entries(): removed redundant opts.verbose check - whitespace cleanup --- ntfsprogs/ntfsinfo.c | 81 ++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 205846c6..e5a13d47 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1167,7 +1167,7 @@ static void ntfs_dump_index_key(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) } } -typedef union { +typedef union { SII_INDEX_DATA sii; /* $SII index data in $Secure */ SDH_INDEX_DATA sdh; /* $SDH index data in $Secure */ QUOTA_O_INDEX_DATA quota_o; /* $O index data in $Quota */ @@ -1280,41 +1280,50 @@ static int ntfs_dump_index_entries(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type) break; switch (type) { - case(INDEX_ATTR_DIRECTORY_I30): - ntfs_log_verbose("\t\tFILE record number:\t %llu\n", - MREF_LE(entry->indexed_file)); - if (opts.verbose) { - printf("\t"); - ntfs_dump_flags(AT_FILE_NAME, entry->key. - file_name.file_attributes); - printf("\t"); - ntfs_dump_namespace(entry->key. - file_name.file_name_type); - } - ntfs_ucstombs(entry->key.file_name.file_name, - entry->key.file_name.file_name_length, - &name, 0); - ntfs_log_verbose("\t\tName:\t\t\t %s\n", name); - free(name); - name = NULL; - ntfs_log_verbose("\t\tParent directory:\t %lld\n", - MREF_LE(entry-> - key.file_name.parent_directory)); - ntfs_log_verbose("\t\tData size:\t\t %lld\n", - sle64_to_cpu( - entry->key.file_name.data_size)); - ntfs_log_verbose("\t\tAllocated size:\t\t %lld\n", - sle64_to_cpu( - entry->key.file_name.allocated_size)); - break; - default: - ntfs_log_verbose("\t\tData offset:\t\t %u\n", - le16_to_cpu(entry->data_offset)); - ntfs_log_verbose("\t\tData length:\t\t %u\n", - le16_to_cpu(entry->data_length)); - ntfs_dump_index_key(entry, type); - ntfs_dump_index_data(entry, type); - break; + case(INDEX_ATTR_DIRECTORY_I30): + ntfs_log_verbose("\t\tFILE record number:\t %llu\n", + MREF_LE(entry->indexed_file)); + printf("\t"); + ntfs_dump_flags(AT_FILE_NAME, entry->key. + file_name.file_attributes); + printf("\t"); + ntfs_dump_namespace(entry->key. + file_name.file_name_type); + ntfs_ucstombs(entry->key.file_name.file_name, + entry->key.file_name.file_name_length, + &name, 0); + ntfs_log_verbose("\t\tName:\t\t\t %s\n", name); + free(name); + name = NULL; + ntfs_log_verbose("\t\tParent directory:\t %lld\n", + MREF_LE(entry-> + key.file_name.parent_directory)); + ntfs_log_verbose("\t\tCreation time:\t\t %s", + ntfsinfo_time_to_str( + entry->key.file_name.creation_time)); + ntfs_log_verbose("\t\tData change time:\t %s", + ntfsinfo_time_to_str( + entry->key.file_name.last_data_change_time)); + ntfs_log_verbose("\t\tMFT change time:\t %s", + ntfsinfo_time_to_str( + entry->key.file_name.last_mft_change_time)); + ntfs_log_verbose("\t\tAccess time:\t\t %s", + ntfsinfo_time_to_str( + entry->key.file_name.last_access_time)); + ntfs_log_verbose("\t\tData size:\t\t %lld\n", + sle64_to_cpu(entry->key.file_name.data_size)); + ntfs_log_verbose("\t\tAllocated size:\t\t %lld\n", + sle64_to_cpu( + entry->key.file_name.allocated_size)); + break; + default: + ntfs_log_verbose("\t\tData offset:\t\t %u\n", + le16_to_cpu(entry->data_offset)); + ntfs_log_verbose("\t\tData length:\t\t %u\n", + le16_to_cpu(entry->data_length)); + ntfs_dump_index_key(entry, type); + ntfs_dump_index_data(entry, type); + break; } entry = (INDEX_ENTRY *)((u8 *)entry + le16_to_cpu(entry->length)); From a55ac531e471df1b63154a657c6bb35f5a2e47c4 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 18 Nov 2005 15:56:31 +0000 Subject: [PATCH 2761/2994] typo fix. Thanks Yuval. --- libntfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index 6410f397..dbe835ea 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -1077,7 +1077,7 @@ void ntfs_inode_update_atime(ntfs_inode *ni) /** * ntfs_inode_update_time - update all times for ntfs inode - * @ni: ntfs inode for which udpate times + * @ni: ntfs inode for which update times * * This function updates last access, mft and data change times. Usually * get called when user write not metadata to inode. Do not update time for From 2bc1f13f996687435c11bc1f95ac15509315901f Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 18 Nov 2005 16:18:18 +0000 Subject: [PATCH 2762/2994] fix stupid bug in / filename syncing. reenable atime updates for /. --- libntfs/inode.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libntfs/inode.c b/libntfs/inode.c index dbe835ea..389fbaa3 100644 --- a/libntfs/inode.c +++ b/libntfs/inode.c @@ -574,7 +574,8 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni) fn->last_access_time = utc2ntfs(ni->last_access_time); ntfs_index_entry_mark_dirty(ictx); ntfs_index_ctx_put(ictx); - ntfs_inode_close(index_ni); + if (ni != index_ni) + ntfs_inode_close(index_ni); } /* Check for real error occurred. */ if (errno != ENOENT) { @@ -1068,7 +1069,7 @@ put_err_out: void ntfs_inode_update_atime(ntfs_inode *ni) { if (!NVolReadOnly(ni->vol) && !NVolNoATime(ni->vol) && (ni->mft_no >= - FILE_first_user /*|| ni->mft_no == FILE_root*/)) { + FILE_first_user || ni->mft_no == FILE_root)) { ni->last_access_time = time(NULL); NInoFileNameSetDirty(ni); NInoSetDirty(ni); @@ -1086,7 +1087,7 @@ void ntfs_inode_update_atime(ntfs_inode *ni) void ntfs_inode_update_time(ntfs_inode *ni) { if (!NVolReadOnly(ni->vol) && !NVolNoATime(ni->vol) && (ni->mft_no >= - FILE_first_user /*|| ni->mft_no == FILE_root*/)) { + FILE_first_user || ni->mft_no == FILE_root)) { time_t now; now = time(NULL); From 8ee10753ce263ebc0f273d6a38ccdefe5042e4dc Mon Sep 17 00:00:00 2001 From: flatcap Date: Sat, 19 Nov 2005 14:55:51 +0000 Subject: [PATCH 2763/2994] move a useful ioctl here, from mkntfs --- include/ntfs/device.h | 1 + libntfs/device.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/include/ntfs/device.h b/include/ntfs/device.h index de91687c..ecadb070 100644 --- a/include/ntfs/device.h +++ b/include/ntfs/device.h @@ -117,5 +117,6 @@ extern s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size); extern s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev); extern int ntfs_device_heads_get(struct ntfs_device *dev); extern int ntfs_device_sectors_per_track_get(struct ntfs_device *dev); +extern int ntfs_device_sector_size_get(struct ntfs_device *dev); #endif /* defined _NTFS_DEVICE_H */ diff --git a/libntfs/device.c b/libntfs/device.c index 419752a4..7f2689bf 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -72,6 +72,9 @@ #if defined(linux) && !defined(HDIO_GETGEO) #define HDIO_GETGEO 0x0301 /* Get device geometry. */ #endif +#if defined(linux) && defined(_IO) && !defined(BLKSSZGET) +# define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytes. */ +#endif /** * ntfs_device_alloc - allocate an ntfs device structure and pre-initialize it @@ -638,3 +641,36 @@ int ntfs_device_sectors_per_track_get(struct ntfs_device *dev) #endif return -1; } +/** + * ntfs_device_sector_size_get - get sector size of a device + * @dev: open device + * + * On success, return the sector size in bytes of the device @dev. + * On error return -1 with errno set to the error code. + * + * The following error codes are defined: + * EINVAL Input parameter error + * EOPNOTSUPP System does not support HDIO_GETGEO ioctl + * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO + */ +int ntfs_device_sector_size_get(struct ntfs_device *dev) +{ + if (!dev) { + errno = EINVAL; + return -1; + } +#ifdef BLKSSZGET + { + int sect_size = 0; + + if (!dev->d_ops->ioctl(dev, BLKSSZGET, §_size)) { + ntfs_log_debug("BLKSSZGET sector size = %d bytes\n", sect_size); + return sect_size; + } + } +#else + errno = EOPNOTSUPP; +#endif + return -1; +} + From 80a2ddee092bcbad38a35331e5a4d980968cb9fa Mon Sep 17 00:00:00 2001 From: flatcap Date: Sat, 19 Nov 2005 14:56:24 +0000 Subject: [PATCH 2764/2994] moved ioctl to device.c remove g_volume_size (unnecessary) Reworked mkntfs_override_phys_params: Split up complicated error expressions Made error messages more legible Demoted some errors to warnings Factored out the "Windows won't boot" message --- ntfsprogs/mkntfs.c | 368 +++++++++++++++++++++++---------------------- 1 file changed, 192 insertions(+), 176 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index a9afb78c..b1330504 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -72,9 +72,6 @@ #ifdef HAVE_SYS_STAT_H #include #endif -#ifdef HAVE_SYS_IOCTL_H -#include -#endif #ifdef HAVE_FCNTL_H #include #endif @@ -128,10 +125,6 @@ # endif #endif -#if defined(linux) && defined(_IO) && !defined(BLKSSZGET) -# define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytes. */ -#endif - #include "security.h" #include "types.h" #include "attrib.h" @@ -179,7 +172,6 @@ runlist *g_rl_boot = NULL; runlist *g_rl_bad = NULL; INDEX_ALLOCATION *g_index_block = NULL; ntfs_volume *g_vol = NULL; -long long g_volume_size = 0; /* in bytes */ int g_mft_size = 0; /* The bigger of 16kB & one cluster */ long long g_mft_lcn = 0; /* lcn of $MFT, $DATA attribute */ long long g_mftmirr_lcn = 0; /* lcn of $MFTMirr, $DATA */ @@ -3538,230 +3530,249 @@ done: /** * mkntfs_override_phys_params - - * - * Note: Might not return. */ -static void mkntfs_override_phys_params(void) +static BOOL mkntfs_override_phys_params(ntfs_volume *vol) { - /* This function uses: - * g_vol - * g_volume_size - */ int i; + s64 volume_size; + BOOL winboot = TRUE; /* If user didn't specify the sector size, determine it now. */ if (opts.sector_size < 0) { -#ifdef BLKSSZGET - int sect_size = 0; - - if (g_vol->dev->d_ops->ioctl(g_vol->dev, BLKSSZGET, §_size) >= 0) { - opts.sector_size = sect_size; - } else - /* XXX UGLY */ -#endif - { - ntfs_log_error("No sector size specified for %s and it could " - "not be obtained automatically.\n" - "Assuming sector size is 512 bytes.\n", - g_vol->dev->d_name); + opts.sector_size = ntfs_device_sector_size_get(vol->dev); + if (opts.sector_size < 0) { + ntfs_log_warning("The sector size was not specified " + "for %s and it could not be obtained " + "automatically. It has been set to 512 " + "bytes.\n", vol->dev->d_name); opts.sector_size = 512; } } + /* Validate sector size. */ - if ((opts.sector_size - 1) & opts.sector_size || - opts.sector_size < 256 || opts.sector_size > 4096) - err_exit("sector_size is invalid. It must be a power " - "of two, and it must be\n greater or equal 256 and " - "less than or equal 4096 bytes.\n"); + if ((opts.sector_size - 1) & opts.sector_size) { + ntfs_log_error("The sector size is invalid. It must be a " + "power of two, e.g. 512, 1024.\n"); + return FALSE; + } + if (opts.sector_size < 256 || opts.sector_size > 4096) { + ntfs_log_error("The sector size is invalid. The minimum size " + "if 256 bytes and the maximum is 4096 bytes.\n"); + return FALSE; + } ntfs_log_debug("sector size = %ld bytes\n", opts.sector_size); + /* If user didn't specify the number of sectors, determine it now. */ if (opts.num_sectors < 0) { - opts.num_sectors = ntfs_device_size_get(g_vol->dev, - opts.sector_size); - if (opts.num_sectors <= 0) - err_exit("ntfs_device_size_get(%s) failed. Please " - "specify it manually.\n", - g_vol->dev->d_name); + opts.num_sectors = ntfs_device_size_get(vol->dev, opts.sector_size); + if (opts.num_sectors <= 0) { + ntfs_log_error("Couldn't determine the size of %s. " + "Please specify the number of sectors " + "manually.\n", vol->dev->d_name); + return FALSE; + } } ntfs_log_debug("number of sectors = %lld (0x%llx)\n", opts.num_sectors, - opts.num_sectors); + opts.num_sectors); + /* * Reserve the last sector for the backup boot sector unless the * sector size is less than 512 bytes in which case reserve 512 bytes - * worth of secstors. + * worth of sectors. */ i = 1; if (opts.sector_size < 512) i = 512 / opts.sector_size; opts.num_sectors -= i; + /* If user didn't specify the partition start sector, determine it. */ if (opts.part_start_sect < 0) { - opts.part_start_sect = ntfs_device_partition_start_sector_get( - g_vol->dev); + opts.part_start_sect = ntfs_device_partition_start_sector_get(vol->dev); if (opts.part_start_sect < 0) { - ntfs_log_error("No partition start sector specified for %s " - "and it could not\nbe obtained " - "automatically. Setting it to 0.\n" - "This will cause Windows not to be " - "able to boot from this volume.\n", - g_vol->dev->d_name); + ntfs_log_warning("The partition start sector was not " + "specified for %s and it could not be obtained " + "automatically. It has been set to 0.\n", + vol->dev->d_name); opts.part_start_sect = 0; + winboot = FALSE; } else if (opts.part_start_sect >> 32) { - ntfs_log_error("No partition start sector specified for %s " - "and the automatically\ndetermined " - "value is too large. Setting it to 0." - " This will cause Windows not\nto be " - "able to boot from this volume.\n", - g_vol->dev->d_name); + ntfs_log_warning("The partition start sector specified " + "for %s and the automatically determined value " + "is too large. It has been set to 0.\n", + vol->dev->d_name); opts.part_start_sect = 0; + winboot = FALSE; } } else if (opts.part_start_sect >> 32) { - err_exit("Invalid partition start sector specified: %lli " - "Maximum is 4294967295 (2^32-1).\n", - opts.part_start_sect); + ntfs_log_error("Invalid partition start sector. Maximum is " + "4294967295 (2^32-1).\n"); + return FALSE; } + /* If user didn't specify the sectors per track, determine it now. */ if (opts.sectors_per_track < 0) { - opts.sectors_per_track = - ntfs_device_sectors_per_track_get(g_vol->dev); + opts.sectors_per_track = ntfs_device_sectors_per_track_get(vol->dev); if (opts.sectors_per_track < 0) { - ntfs_log_error("No number of sectors per track specified for " - "%s and\nit could not be obtained " - "automatically. Setting it to 0. " - "This will cause\nWindows not to be " - "able to boot from this volume.\n", - g_vol->dev->d_name); + ntfs_log_warning("The number of sectors per track was " + "not specified for %s and it could not be " + "obtained automatically. It has been set to " + "0.\n", vol->dev->d_name); opts.sectors_per_track = 0; - } else if (opts.sectors_per_track > 0xffff) { - ntfs_log_error("No number of sectors per track specified for " - "%s and the automatically\ndetermined " - "value is too large. Setting it to 0." - " This will cause Windows not\nto be " - "able to boot from this volume.\n", - g_vol->dev->d_name); + winboot = FALSE; + } else if (opts.sectors_per_track > 65535) { + ntfs_log_warning("The number of sectors per track was " + "not specified for %s and the automatically " + "determined value is too large. It has been " + "set to 0.\n", vol->dev->d_name); opts.sectors_per_track = 0; + winboot = FALSE; } - } else if (opts.sectors_per_track > 0xffff) { - err_exit("Invalid number of sectors per track specified: %ld " - "Maximum is 65535 (0xffff).\n", - opts.sectors_per_track); + } else if (opts.sectors_per_track > 65535) { + ntfs_log_error("Invalid number of sectors per track. Maximum " + "is 65535.\n"); + return FALSE; } + /* If user didn't specify the number of heads, determine it now. */ if (opts.heads < 0) { - //XXX this will break if sizeof(int) != sizeof(long) -- signextend - opts.heads = ntfs_device_heads_get(g_vol->dev); + opts.heads = ntfs_device_heads_get(vol->dev); if (opts.heads < 0) { - ntfs_log_error("No number of heads specified for %s and it " - "could not\nbe obtained automatically." - " Setting it to 0. This will cause " - "Windows not to\nbe able to boot from " - "this volume.\n", g_vol->dev->d_name); + ntfs_log_warning("The number of heads was not " + "specified for %s and it could not be obtained " + "automatically. It has been set to 0.\n", + vol->dev->d_name); opts.heads = 0; - } else if (opts.heads > 0xffff) { - ntfs_log_error("No number of heads specified for %s and the " - "automatically\ndetermined value is " - "too large. Setting it to 0. This " - "will cause Windows not\nto be able " - "to boot from this volume.\n", - g_vol->dev->d_name); + winboot = FALSE; + } else if (opts.heads > 65535) { + ntfs_log_warning("The number of heads was not " + "specified for %s and the automatically " + "determined value is too large. It has been " + "set to 0.\n", vol->dev->d_name); opts.heads = 0; + winboot = FALSE; } - } else if (opts.heads > 0xffff) { - err_exit("Invalid number of heads specified: %ld Maximum is " - "65535 (0xffff).\n", opts.heads); + } else if (opts.heads > 65535) { + ntfs_log_error("Invalid number of heads. Maximum is 65535.\n"); + return FALSE; } - /* If user didn't specify the volume size, determine it now. */ - if (!g_volume_size) - g_volume_size = opts.num_sectors * opts.sector_size; - else if (g_volume_size & (opts.sector_size - 1)) - err_exit("volume_size is not a multiple of sector_size.\n"); + + volume_size = opts.num_sectors * opts.sector_size; + /* Validate volume size. */ - if (g_volume_size < 1 << 20 /* 1MiB */) - err_exit("Device is too small (%llikiB). Minimum NTFS volume " - "size is 1MiB.\n", g_volume_size / 1024); - ntfs_log_debug("volume size = %llikiB\n", g_volume_size / 1024); + if (volume_size < (1 << 20)) { /* 1MiB */ + ntfs_log_error("Device is too small (%llikiB). Minimum NTFS " + "volume size is 1MiB.\n", volume_size / 1024); + return FALSE; + } + ntfs_log_debug("volume size = %llikiB\n", volume_size / 1024); + /* If user didn't specify the cluster size, determine it now. */ - if (!g_vol->cluster_size) { - if (g_volume_size <= 512LL << 20) /* <= 512MB */ - g_vol->cluster_size = 512; - else if (g_volume_size <= 1LL << 30) /* ]512MB-1GB] */ - g_vol->cluster_size = 1024; - else if (g_volume_size <= 2LL << 30) /* ]1GB-2GB] */ - g_vol->cluster_size = 2048; + if (!vol->cluster_size) { + if (volume_size <= 512LL << 20) /* <= 512MB */ + vol->cluster_size = 512; + else if (volume_size <= 1LL << 30) /* ]512MB-1GB] */ + vol->cluster_size = 1024; + else if (volume_size <= 2LL << 30) /* ]1GB-2GB] */ + vol->cluster_size = 2048; else - g_vol->cluster_size = 4096; + vol->cluster_size = 4096; /* For small volumes on devices with large sector sizes. */ - if (g_vol->cluster_size < (u32)opts.sector_size) - g_vol->cluster_size = opts.sector_size; + if (vol->cluster_size < (u32)opts.sector_size) + vol->cluster_size = opts.sector_size; /* * For huge volumes, grow the cluster size until the number of * clusters fits into 32 bits or the cluster size exceeds the * maximum limit of 64kiB. */ - while (g_volume_size >> (ffs(g_vol->cluster_size) - 1 + 32)) { - g_vol->cluster_size <<= 1; - if (g_vol->cluster_size > 65536) - err_exit("Device is too large to hold an NTFS " - "volume (maximum size is " - "256TiB).\n"); + while (volume_size >> (ffs(vol->cluster_size) - 1 + 32)) { + vol->cluster_size <<= 1; + if (vol->cluster_size > 65535) { + ntfs_log_error("Device is too large to hold an " + "NTFS volume (maximum size is 256TiB).\n"); + return FALSE; + } } + ntfs_log_quiet("Cluster size has been automatically set to %d " + "bytes.\n", vol->cluster_size); } + /* Validate cluster size. */ - if (g_vol->cluster_size & (g_vol->cluster_size - 1) || - g_vol->cluster_size < (u32)opts.sector_size || - g_vol->cluster_size > 128 * (u32)opts.sector_size || - g_vol->cluster_size > 65536) - err_exit("Cluster_size is invalid. It must be a power of two, " - "be at least\nthe same as sector_size, be maximum " - "64kiB, and the sectors per cluster value has\n" - "to fit inside eight bits. (We do not support larger " - "cluster sizes yet.)\n"); - g_vol->cluster_size_bits = ffs(g_vol->cluster_size) - 1; - ntfs_log_debug("cluster size = %u bytes\n", (unsigned int)g_vol->cluster_size); - if (g_vol->cluster_size > 4096) { + if (vol->cluster_size & (vol->cluster_size - 1)) { + ntfs_log_error("The cluster size is invalid. It must be a " + "power of two, e.g. 1024, 4096.\n"); + return FALSE; + } + if (vol->cluster_size < (u32)opts.sector_size) { + ntfs_log_error("The cluster size is invalid. It must be equal " + "to, or larger than, the sector size.\n"); + return FALSE; + } + if (vol->cluster_size > 128 * (u32)opts.sector_size) { + ntfs_log_error("The cluster size is invalid. It cannot be " + "more that 128 times the size of the sector size.\n"); + return FALSE; + } + if (vol->cluster_size > 65536) { + ntfs_log_error("The cluster size is invalid. The maximum " + "cluster size is 65536 bytes (64kiB).\n"); + return FALSE; + } + + vol->cluster_size_bits = ffs(vol->cluster_size) - 1; + ntfs_log_debug("cluster size = %u bytes\n", (unsigned int)vol->cluster_size); + if (vol->cluster_size > 4096) { if (opts.enable_compression) { - if (!opts.force) - err_exit("Cluster_size is above 4096 bytes " - "and compression is " - "requested.\nThis is not " - "possible due to limitations " - "in the compression algorithm " - "used by\nWindows.\n"); + if (!opts.force) { + ntfs_log_error("Windows cannot use compression " + "when the cluster size is larger than " + "4096 bytes.\n"); + return FALSE; + } opts.enable_compression = 0; } - ntfs_log_quiet("Warning: compression will be disabled on this volume " - "because it is not\nsupported when the cluster " - "size is above 4096 bytes. This is due to \n" - "limitations in the compression algorithm used " - "by Windows.\n"); + ntfs_log_warning("Windows cannot use compression when the " + "cluster size is larger than 4096 bytes. Compression " + "has been disabled for this volume.\n"); } - /* If user didn't specify the number of clusters, determine it now. */ - if (!g_vol->nr_clusters) - g_vol->nr_clusters = g_volume_size / g_vol->cluster_size; + + vol->nr_clusters = volume_size / vol->cluster_size; + /* * Check the cluster_size and num_sectors for consistency with * sector_size and num_sectors. And check both of these for consistency * with volume_size. */ - if (g_vol->nr_clusters != (opts.num_sectors * opts.sector_size) / - g_vol->cluster_size || - g_volume_size / opts.sector_size != opts.num_sectors || - g_volume_size / g_vol->cluster_size != g_vol->nr_clusters) - err_exit("Illegal combination of volume/cluster/sector size " - "and/or cluster/sector number.\n"); - ntfs_log_debug("number of clusters = %llu (0x%llx)\n", g_vol->nr_clusters, - g_vol->nr_clusters); - /* Number of clusters must fit within 32 bits (Win2k limitation). */ - if (g_vol->nr_clusters >> 32) { - if (g_vol->cluster_size >= 65536) - err_exit("Device is too large to hold an NTFS volume " - "(maximum size is 256TiB).\n"); - err_exit("Number of clusters exceeds 32 bits. Please try " - "again with a larger\ncluster size or leave " - "the cluster size unspecified and the " - "smallest possible\ncluster size for the size " - "of the device will be used.\n"); + if ((vol->nr_clusters != ((opts.num_sectors * opts.sector_size) / vol->cluster_size) || + (volume_size / opts.sector_size) != opts.num_sectors || + (volume_size / vol->cluster_size) != vol->nr_clusters)) { + // XXX is this code reachable? + ntfs_log_error("Illegal combination of volume/cluster/sector size and/or cluster/sector number.\n"); + return FALSE; } + ntfs_log_debug("number of clusters = %llu (0x%llx)\n", vol->nr_clusters, vol->nr_clusters); + + /* Number of clusters must fit within 32 bits (Win2k limitation). */ + if (vol->nr_clusters >> 32) { + if (vol->cluster_size >= 65536) { + ntfs_log_error("Device is too large to hold an NTFS " + "volume (maximum size is 256TiB).\n"); + return FALSE; + } + ntfs_log_error("Number of clusters exceeds 32 bits. Please " + "try again with a larger\ncluster size or leave the " + "cluster size unspecified and the smallest possible " + "cluster size for the size of the device will be used.\n"); + return FALSE; + } + + if (!winboot) { + ntfs_log_warning("To boot from a device, Windows needs the " + "'partition start sector', the 'sectors per track' and " + "the 'number of heads' to be set.\n"); + ntfs_log_warning("Windows will not be able to boot from this " + "device.\n"); + } + return TRUE; } /** @@ -3958,31 +3969,34 @@ static void mkntfs_initialize_rl_logfile(void) * g_logfile_size * g_rl_logfile * g_vol - * g_volume_size */ int i, j; + u64 volume_size; /* Create runlist for log file. */ g_rl_logfile = malloc(2 * sizeof(runlist)); if (!g_rl_logfile) err_exit("Failed to allocate internal buffer: %s\n", strerror(errno)); + + volume_size = g_vol->nr_clusters << g_vol->cluster_size_bits; + g_rl_logfile[0].vcn = 0LL; g_rl_logfile[0].lcn = g_logfile_lcn; /* * Determine logfile_size from volume_size (rounded up to a cluster), * making sure it does not overflow the end of the volume. */ - if (g_volume_size < 2048LL * 1024) /* < 2MiB */ + if (volume_size < 2048LL * 1024) /* < 2MiB */ g_logfile_size = 256LL * 1024; /* -> 256kiB */ - else if (g_volume_size < 4000000LL) /* < 4MB */ + else if (volume_size < 4000000LL) /* < 4MB */ g_logfile_size = 512LL * 1024; /* -> 512kiB */ - else if (g_volume_size <= 200LL * 1024 * 1024) /* < 200MiB */ + else if (volume_size <= 200LL * 1024 * 1024) /* < 200MiB */ g_logfile_size = 2048LL * 1024; /* -> 2MiB */ - else if (g_volume_size >= 400LL << 20) /* > 400MiB */ + else if (volume_size >= 400LL << 20) /* > 400MiB */ g_logfile_size = 4 << 20; /* -> 4MiB */ else - g_logfile_size = (g_volume_size / 100) & + g_logfile_size = (volume_size / 100) & ~(g_vol->cluster_size - 1); j = g_logfile_size / g_vol->cluster_size; while (g_rl_logfile[0].lcn + j >= g_vol->nr_clusters) { @@ -4088,7 +4102,6 @@ static void mkntfs_fill_device_with_zeroes(void) /* This function uses: * g_buf * g_vol - * g_volume_size */ /* * If not quick format, fill the device with 0s. @@ -4098,9 +4111,12 @@ static void mkntfs_fill_device_with_zeroes(void) ssize_t bw; unsigned long long position, mid_clust; float progress_inc = (float)g_vol->nr_clusters / 100; + u64 volume_size; + + volume_size = g_vol->nr_clusters << g_vol->cluster_size_bits; ntfs_log_progress("Initialising device with zeroes: 0%%"); - mid_clust = (g_volume_size >> 1) / g_vol->cluster_size; + mid_clust = (volume_size >> 1) / g_vol->cluster_size; for (position = 0; position < (unsigned long long)g_vol->nr_clusters; position++) { if (!(position % (int)(progress_inc+1))) { @@ -4135,7 +4151,7 @@ static void mkntfs_fill_device_with_zeroes(void) } } ntfs_log_progress("\b\b\b\b100%%"); - position = (g_volume_size & (g_vol->cluster_size - 1)) / + position = (volume_size & (g_vol->cluster_size - 1)) / opts.sector_size; for (i = 0; (unsigned long)i < position; i++) { bw = mkntfs_write(g_vol->dev, g_buf, opts.sector_size); @@ -4296,7 +4312,6 @@ bb_err: return -1; } - /** * mkntfs_create_root_structures - * @@ -4322,7 +4337,6 @@ static void mkntfs_create_root_structures(void) * g_rl_mft_bmp * g_rl_mftmirr * g_vol - * g_volume_obj_id */ NTFS_BOOT_SECTOR *bs; MFT_RECORD *m; @@ -5018,7 +5032,9 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg //-------------------------------------------------------------------------------- /* Decide on the sectors/tracks/heads/size, etc. */ - mkntfs_override_phys_params(); + if (!mkntfs_override_phys_params(g_vol)) + goto done; + /* Initialize $Bitmap and $MFT/$BITMAP related stuff. */ mkntfs_initialize_bitmaps(); /* Initialize MFT & set g_logfile_lcn. */ From 03fa945ee079e8245a1f71e79e5c94716b7b7aee Mon Sep 17 00:00:00 2001 From: flatcap Date: Sat, 19 Nov 2005 16:44:36 +0000 Subject: [PATCH 2765/2994] banish the e-word --- ntfsprogs/mkntfs.c | 409 +++++++++++++++++++++++++++------------------ 1 file changed, 243 insertions(+), 166 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index b1330504..abb07035 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -157,7 +157,6 @@ const char *EXEC_NAME = "mkntfs"; /** * global variables - * Need these global so mkntfs_exit can access them. */ u8 *g_buf = NULL; int g_mft_bitmap_byte_size = 0; @@ -541,23 +540,6 @@ static BOOL mkntfs_validate_options(struct mkntfs_options *opts2 __attribute__(( } -/** - * err_exit - error output and terminate; ignores quiet (-q) - */ -__attribute__((noreturn)) -__attribute__((format(printf, 1, 2))) -static void err_exit(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "ERROR: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "Aborting...\n"); - exit(1); -} - /** * mkntfs_time */ @@ -587,19 +569,22 @@ static void *ntfs_calloc(size_t nmemb, size_t size) * * Note: Might not return. */ -static void append_to_bad_blocks(unsigned long long block) +static BOOL append_to_bad_blocks(unsigned long long block) { long long *new_buf; if (!(g_num_bad_blocks & 15)) { new_buf = realloc(g_bad_blocks, (g_num_bad_blocks + 16) * sizeof(long long)); - if (!new_buf) - err_exit("Reallocating memory for bad blocks list " - "failed: %s\n", strerror(errno)); + if (!new_buf) { + ntfs_log_perror("Reallocating memory for bad blocks " + "list failed"); + return FALSE; + } g_bad_blocks = new_buf; } g_bad_blocks[g_num_bad_blocks++] = block; + return TRUE; } /** @@ -716,7 +701,7 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, int eo; char *b = ntfs_calloc(1, delta); if (!b) - exit(1); + return -1; bytes_written = mkntfs_write(dev, b, delta); eo = errno; free(b); @@ -1693,8 +1678,10 @@ static int insert_positioned_attr_in_mft_record(MFT_RECORD *m, } else { a->compression_unit = 0; bw = ntfs_rlwrite(g_vol->dev, rl, val, val_len, &inited_size); - if (bw != val_len) + if (bw != val_len) { ntfs_log_error("Error writing non-resident attribute value.\n"); + return -errno; + } err = ntfs_mapping_pairs_build(g_vol, (u8*)a + hdr_size + ((name_len + 7) & ~7), mpa_size, rl, 0, NULL); } @@ -1884,8 +1871,10 @@ static int insert_non_resident_attr_in_mft_record(MFT_RECORD *m, } else { a->compression_unit = 0; bw = ntfs_rlwrite(g_vol->dev, rl, val, val_len, NULL); - if (bw != val_len) + if (bw != val_len) { ntfs_log_error("Error writing non-resident attribute value.\n"); + return -errno; + } err = ntfs_mapping_pairs_build(g_vol, (u8*)a + hdr_size + ((name_len + 7) & ~7), mpa_size, rl, 0, NULL); } @@ -2729,8 +2718,9 @@ static int ntfs_index_keys_compare(char *key1, char *key2, return i; } - err_exit("ntfs_index_keys_compare called without supported " + ntfs_log_critical("ntfs_index_keys_compare called without supported " "collation rule.\n"); + return 0; /* Claim they're equal. What else can we do? */ } /** @@ -3398,9 +3388,9 @@ static int create_hardlink(INDEX_BLOCK *idx, const MFT_REF ref_parent, } /** - * mkntfs_exit + * mkntfs_cleanup */ -static void mkntfs_exit(void) +static void mkntfs_cleanup(void) { /* Close the volume */ if (g_vol) { @@ -3780,7 +3770,7 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) * * Note: Might not return. */ -static void mkntfs_initialize_bitmaps(void) +static BOOL mkntfs_initialize_bitmaps(void) { /* This function uses: * g_lcn_bitmap @@ -3804,7 +3794,7 @@ static void mkntfs_initialize_bitmaps(void) g_lcn_bitmap_byte_size, i); g_lcn_bitmap = ntfs_calloc(1, g_lcn_bitmap_byte_size); if (!g_lcn_bitmap) - exit(1); + return FALSE; /* * $Bitmap can overlap the end of the volume. Any bits in this region * must be set. This region also encompasses the backup boot sector. @@ -3830,15 +3820,16 @@ static void mkntfs_initialize_bitmaps(void) mft_bitmap_size, g_mft_bitmap_byte_size); g_mft_bitmap = ntfs_calloc(1, g_mft_bitmap_byte_size); if (!g_mft_bitmap) - exit(1); + return FALSE; /* Create runlist for mft bitmap. */ g_rl_mft_bmp = malloc(2 * sizeof(runlist)); - if (!g_rl_mft_bmp) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); + if (!g_rl_mft_bmp) { + ntfs_log_perror("Failed to allocate internal buffer"); + return FALSE; + } g_rl_mft_bmp[0].vcn = 0LL; /* Mft bitmap is right after $Boot's data. */ - i = (8192 + g_vol->cluster_size - 1) / g_vol->cluster_size; + i = (8192 + g_vol->cluster_size - 1) / g_vol->cluster_size; //XXX hardcoded size for $Boot g_rl_mft_bmp[0].lcn = i; /* * Size is always one cluster, even though valid data size and @@ -3850,6 +3841,7 @@ static void mkntfs_initialize_bitmaps(void) g_rl_mft_bmp[1].length = 0LL; /* Allocate cluster for mft bitmap. */ ntfs_bit_set(g_lcn_bitmap, i, 1); + return TRUE; } /** @@ -3857,7 +3849,7 @@ static void mkntfs_initialize_bitmaps(void) * * Note: Might not return. */ -static void mkntfs_initialize_rl_mft(void) +static BOOL mkntfs_initialize_rl_mft(void) { /* This function uses: * g_lcn_bitmap @@ -3910,9 +3902,10 @@ static void mkntfs_initialize_rl_mft(void) g_mft_zone_end += g_mft_lcn; /* Create runlist for mft. */ g_rl_mft = malloc(2 * sizeof(runlist)); - if (!g_rl_mft) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); + if (!g_rl_mft) { + ntfs_log_perror("Failed to allocate internal buffer"); + return FALSE; + } g_rl_mft[0].vcn = 0LL; g_rl_mft[0].lcn = g_mft_lcn; /* rounded up division by cluster size */ @@ -3931,9 +3924,10 @@ static void mkntfs_initialize_rl_mft(void) g_mftmirr_lcn); /* Create runlist for mft mirror. */ g_rl_mftmirr = malloc(2 * sizeof(runlist)); - if (!g_rl_mftmirr) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); + if (!g_rl_mftmirr) { + ntfs_log_perror("Failed to allocate internal buffer"); + return FALSE; + } g_rl_mftmirr[0].vcn = 0LL; g_rl_mftmirr[0].lcn = g_mftmirr_lcn; /* @@ -3954,6 +3948,7 @@ static void mkntfs_initialize_rl_mft(void) g_logfile_lcn = g_mftmirr_lcn + j; ntfs_log_debug("$LogFile logical cluster number = 0x%llx\n", g_logfile_lcn); + return TRUE; } /** @@ -3961,7 +3956,7 @@ static void mkntfs_initialize_rl_mft(void) * * Note: Might not return. */ -static void mkntfs_initialize_rl_logfile(void) +static BOOL mkntfs_initialize_rl_logfile(void) { /* This function uses: * g_lcn_bitmap @@ -3975,9 +3970,10 @@ static void mkntfs_initialize_rl_logfile(void) /* Create runlist for log file. */ g_rl_logfile = malloc(2 * sizeof(runlist)); - if (!g_rl_logfile) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); + if (!g_rl_logfile) { + ntfs_log_perror("Failed to allocate internal buffer"); + return FALSE; + } volume_size = g_vol->nr_clusters << g_vol->cluster_size_bits; @@ -4016,10 +4012,12 @@ static void mkntfs_initialize_rl_logfile(void) * FIXME: The 256kiB limit is arbitrary. Should find out what the real * minimum requirement for Windows is so it doesn't blue screen. */ - if (g_logfile_size < 256 << 10) - err_exit("$LogFile would be created with invalid size. This " - "is not allowed as it would cause Windows to " - "blue screen and during boot.\n"); + if (g_logfile_size < 256 << 10) { + ntfs_log_error("$LogFile would be created with invalid size. " + "This is not allowed as it would cause Windows " + "to blue screen and during boot.\n"); + return FALSE; + } g_rl_logfile[1].vcn = j; g_rl_logfile[0].length = j; g_rl_logfile[1].lcn = -1LL; @@ -4027,6 +4025,7 @@ static void mkntfs_initialize_rl_logfile(void) /* Allocate clusters for log file. */ for (i = 0; i < j; i++) ntfs_bit_set(g_lcn_bitmap, g_logfile_lcn + i, 1); + return TRUE; } /** @@ -4034,7 +4033,7 @@ static void mkntfs_initialize_rl_logfile(void) * * Note: Might not return. */ -static void mkntfs_initialize_rl_boot(void) +static BOOL mkntfs_initialize_rl_boot(void) { /* This function uses: * g_lcn_bitmap @@ -4044,9 +4043,10 @@ static void mkntfs_initialize_rl_boot(void) int i, j; /* Create runlist for $Boot. */ g_rl_boot = malloc(2 * sizeof(runlist)); - if (!g_rl_boot) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); + if (!g_rl_boot) { + ntfs_log_perror("Failed to allocate internal buffer"); + return FALSE; + } g_rl_boot[0].vcn = 0LL; g_rl_boot[0].lcn = 0LL; /* @@ -4061,6 +4061,7 @@ static void mkntfs_initialize_rl_boot(void) /* Allocate clusters for $Boot. */ for (i = 0; i < j; i++) ntfs_bit_set(g_lcn_bitmap, 0LL + i, 1); + return TRUE; } /** @@ -4068,16 +4069,17 @@ static void mkntfs_initialize_rl_boot(void) * * Note: Might not return. */ -static void mkntfs_initialize_rl_bad(void) +static BOOL mkntfs_initialize_rl_bad(void) { /* This function uses: * g_rl_bad */ /* Create runlist for $BadClus, $DATA named stream $Bad. */ g_rl_bad = malloc(2 * sizeof(runlist)); - if (!g_rl_bad) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); + if (!g_rl_bad) { + ntfs_log_perror("Failed to allocate internal buffer"); + return FALSE; + } g_rl_bad[0].vcn = 0LL; g_rl_bad[0].lcn = -1LL; /* @@ -4090,6 +4092,7 @@ static void mkntfs_initialize_rl_bad(void) g_rl_bad[1].length = 0LL; /* TODO: Mark bad blocks as such. */ + return TRUE; } /** @@ -4097,7 +4100,7 @@ static void mkntfs_initialize_rl_bad(void) * * Note: Might not return. */ -static void mkntfs_fill_device_with_zeroes(void) +static BOOL mkntfs_fill_device_with_zeroes(void) { /* This function uses: * g_buf @@ -4125,21 +4128,28 @@ static void mkntfs_fill_device_with_zeroes(void) } bw = mkntfs_write(g_vol->dev, g_buf, g_vol->cluster_size); if (bw != (ssize_t)g_vol->cluster_size) { - if (bw != -1 || errno != EIO) - err_exit("This should not happen.\n"); - if (!position) - err_exit("Error: Cluster zero is bad. " + if (bw != -1 || errno != EIO) { + ntfs_log_error("This should not happen.\n"); + return FALSE; + } + if (!position) { + ntfs_log_error("Error: Cluster zero is bad. " "Cannot create NTFS file " "system.\n"); + return FALSE; + } if (position == mid_clust && (g_vol->major_ver < 1 || (g_vol->major_ver == 1 && - g_vol->minor_ver < 2))) - err_exit("Error: Bad cluster found in " + g_vol->minor_ver < 2))) { + ntfs_log_error("Error: Bad cluster found in " "location reserved for system " "file $Boot.\n"); + return FALSE; + } /* Add the baddie to our bad blocks list. */ - append_to_bad_blocks(position); + if (!append_to_bad_blocks(position)) + return FALSE; ntfs_log_quiet("\nFound bad cluster (%lld). Adding to " "list of bad blocks.\nInitialising " "device with zeroes: %3.0f%%", position, @@ -4156,21 +4166,25 @@ static void mkntfs_fill_device_with_zeroes(void) for (i = 0; (unsigned long)i < position; i++) { bw = mkntfs_write(g_vol->dev, g_buf, opts.sector_size); if (bw != opts.sector_size) { - if (bw != -1 || errno != EIO) - err_exit("This should not happen.\n"); - else if (i + 1ull == position && + if (bw != -1 || errno != EIO) { + ntfs_log_error("This should not happen.\n"); + return FALSE; + } else if (i + 1ull == position && (g_vol->major_ver >= 2 || (g_vol->major_ver == 1 && - g_vol->minor_ver >= 2))) - err_exit("Error: Bad cluster found in " + g_vol->minor_ver >= 2))) { + ntfs_log_error("Error: Bad cluster found in " "location reserved for system " "file $Boot.\n"); + return FALSE; + } /* Seek to next sector. */ g_vol->dev->d_ops->seek(g_vol->dev, opts.sector_size, SEEK_CUR); } } ntfs_log_progress(" - Done.\n"); + return TRUE; } /** @@ -4179,7 +4193,7 @@ static void mkntfs_fill_device_with_zeroes(void) * (ERSO) made a function out of this, but the reason for doing that * disappeared during coding.... */ -static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, +static BOOL mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, ntfschar* name, u32 name_len) { /* This function uses: @@ -4193,27 +4207,30 @@ static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, i = 5 * sizeof(ntfschar); ctx = ntfs_attr_get_search_ctx(NULL, m); - - if (!ctx) - err_exit("Failed to allocate attribute search context: %s\n", - strerror(errno)); + if (!ctx) { + ntfs_log_perror("Failed to allocate attribute search context"); + return FALSE; + } /* FIXME: This should be IGNORE_CASE! */ if (mkntfs_attr_lookup(AT_INDEX_ALLOCATION, name, name_len, 0, 0, NULL, 0, ctx)) { ntfs_attr_put_search_ctx(ctx); - err_exit("BUG: $INDEX_ALLOCATION attribute not found.\n"); + ntfs_log_error("BUG: $INDEX_ALLOCATION attribute not found.\n"); + return FALSE; } a = ctx->attr; rl_index = ntfs_mapping_pairs_decompress(g_vol, a, NULL); if (!rl_index) { ntfs_attr_put_search_ctx(ctx); - err_exit("Failed to decompress runlist of $INDEX_ALLOCATION " + ntfs_log_error("Failed to decompress runlist of $INDEX_ALLOCATION " "attribute.\n"); + return FALSE; } if (sle64_to_cpu(a->initialized_size) < i) { ntfs_attr_put_search_ctx(ctx); free(rl_index); - err_exit("BUG: $INDEX_ALLOCATION attribute too short.\n"); + ntfs_log_error("BUG: $INDEX_ALLOCATION attribute too short.\n"); + return FALSE; } ntfs_attr_put_search_ctx(ctx); i = sizeof(INDEX_BLOCK) - sizeof(INDEX_HEADER) + @@ -4221,22 +4238,26 @@ static void mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, err = ntfs_mst_pre_write_fixup((NTFS_RECORD*)idx, i); if (err) { free(rl_index); - err_exit("ntfs_mst_pre_write_fixup() failed while " + ntfs_log_error("ntfs_mst_pre_write_fixup() failed while " "syncing index block.\n"); + return FALSE; } lw = ntfs_rlwrite(g_vol->dev, rl_index, (u8*)idx, i, NULL); free(rl_index); - if (lw != i) - err_exit("Error writing $INDEX_ALLOCATION.\n"); + if (lw != i) { + ntfs_log_error("Error writing $INDEX_ALLOCATION.\n"); + return FALSE; + } /* No more changes to @idx below here so no need for fixup: */ /* ntfs_mst_post_write_fixup((NTFS_RECORD*)idx); */ + return TRUE; } /** * create_file_volume - */ -static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) +static BOOL create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) { int i, err; u8 *sd; @@ -4262,8 +4283,11 @@ static void create_file_volume(MFT_RECORD *m, MFT_REF root_ref, VOLUME_FLAGS fl) "on next reboot into Windows.\n"); err = add_attr_vol_info(m, fl, g_vol->major_ver, g_vol->minor_ver); } - if (err < 0) - err_exit("Couldn't create $Volume: %s\n", strerror(-err)); + if (err < 0) { + ntfs_log_error("Couldn't create $Volume: %s\n", strerror(-err)); + return FALSE; + } + return TRUE; } /** @@ -4287,8 +4311,10 @@ static int create_backup_boot_sector(u8 *buff) if (size < opts.sector_size) size = opts.sector_size; if (g_vol->dev->d_ops->seek(g_vol->dev, (opts.num_sectors + 1) * - opts.sector_size - size, SEEK_SET) == (off_t)-1) + opts.sector_size - size, SEEK_SET) == (off_t)-1) { + ntfs_log_perror("Seek failed"); goto bb_err; + } if (size > 8192) size = 8192; bw = mkntfs_write(g_vol->dev, buff, size); @@ -4300,10 +4326,10 @@ static int create_backup_boot_sector(u8 *buff) else s = "unknown error"; if (bw != -1LL || (bw == -1LL && e != ENOSPC)) { - err_exit("Couldn't write backup boot sector: %s\n", s); -bb_err: - ntfs_log_perror("Seek failed"); + ntfs_log_critical("Couldn't write backup boot sector: %s\n", s); + return -1; } +bb_err: ntfs_log_error("Couldn't write backup boot sector. This is due to a " "limitation in the\nLinux kernel. This is not " "a major problem as Windows check disk will " @@ -4317,7 +4343,7 @@ bb_err: * * Note: Might not return. */ -static void mkntfs_create_root_structures(void) +static BOOL mkntfs_create_root_structures(void) { /* This function uses: * g_buf @@ -4368,8 +4394,10 @@ static void mkntfs_create_root_structures(void) */ for (i = 0; i < nr_sysfiles; i++) { if (ntfs_mft_record_layout(g_vol, 0, m = (MFT_RECORD *)(g_buf + - i * g_vol->mft_record_size))) - err_exit("Failed to layout system mft records.\n"); + i * g_vol->mft_record_size))) { + ntfs_log_error("Failed to layout system mft records.\n"); + return FALSE; + } if (i > 0) m->sequence_number = cpu_to_le16(i); if (i == 0) @@ -4383,8 +4411,10 @@ static void mkntfs_create_root_structures(void) for (i = nr_sysfiles; i * (s32)g_vol->mft_record_size < g_mft_size; i++) { m = (MFT_RECORD *)(g_buf + i * g_vol->mft_record_size); - if (ntfs_mft_record_layout(g_vol, 0, m)) - err_exit("Failed to layout mft record.\n"); + if (ntfs_mft_record_layout(g_vol, 0, m)) { + ntfs_log_error("Failed to layout mft record.\n"); + return FALSE; + } m->flags = cpu_to_le16(0); m->sequence_number = cpu_to_le16(i); } @@ -4462,7 +4492,8 @@ static void mkntfs_create_root_structures(void) init_root_sd_31(&sd, &i); err = add_attr_sd(m, sd, i); } else { - err_exit("BUG: Unsupported NTFS version\n"); + ntfs_log_error("BUG: Unsupported NTFS version\n"); + return FALSE; } } /* FIXME: This should be IGNORE_CASE */ @@ -4476,14 +4507,16 @@ static void mkntfs_create_root_structures(void) ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; ctx = ntfs_attr_get_search_ctx(NULL, m); - if (!ctx) - err_exit("Failed to allocate attribute search " - "context: %s\n", strerror(errno)); + if (!ctx) { + ntfs_log_perror("Failed to allocate attribute search context"); + return FALSE; + } /* There is exactly one file name so this is ok. */ if (mkntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL, 0, ctx)) { ntfs_attr_put_search_ctx(ctx); - err_exit("BUG: $FILE_NAME attribute not found.\n"); + ntfs_log_error("BUG: $FILE_NAME attribute not found.\n"); + return FALSE; } a = ctx->attr; err = insert_file_link_in_dir_index(g_index_block, root_ref, @@ -4492,9 +4525,11 @@ static void mkntfs_create_root_structures(void) le32_to_cpu(a->value_length)); ntfs_attr_put_search_ctx(ctx); } - if (err) - err_exit("Couldn't create root directory: %s\n", - strerror(-err)); + if (err) { + ntfs_log_error("Couldn't create root directory: %s\n", + strerror(-err)); + return FALSE; + } /* dump_mft_record(m); */ /* Add all other attributes, on a per-file basis for clarity. */ ntfs_log_verbose("Creating $MFT (mft record 0)\n"); @@ -4515,8 +4550,10 @@ static void mkntfs_create_root_structures(void) if (!err) err = add_attr_bitmap_positioned(m, NULL, 0, 0, g_rl_mft_bmp, g_mft_bitmap, g_mft_bitmap_byte_size); - if (err < 0) - err_exit("Couldn't create $MFT: %s\n", strerror(-err)); + if (err < 0) { + ntfs_log_error("Couldn't create $MFT: %s\n", strerror(-err)); + return FALSE; + } /* dump_mft_record(m); */ ntfs_log_verbose("Creating $MFTMirr (mft record 1)\n"); @@ -4534,15 +4571,18 @@ static void mkntfs_create_root_structures(void) init_system_file_sd(FILE_MFTMirr, &sd, &i); err = add_attr_sd(m, sd, i); } - if (err < 0) - err_exit("Couldn't create $MFTMirr: %s\n", strerror(-err)); + if (err < 0) { + ntfs_log_error("Couldn't create $MFTMirr: %s\n", strerror(-err)); + return FALSE; + } /* dump_mft_record(m); */ ntfs_log_verbose("Creating $LogFile (mft record 2)\n"); m = (MFT_RECORD*)(g_buf + 2 * g_vol->mft_record_size); buf_log = malloc(g_logfile_size); - if (!buf_log) - err_exit("Failed to allocate internal buffer: %s\n", - strerror(errno)); + if (!buf_log) { + ntfs_log_perror("Failed to allocate internal buffer"); + return FALSE; + } memset(buf_log, -1, g_logfile_size); err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_logfile, buf_log, g_logfile_size); @@ -4558,8 +4598,10 @@ static void mkntfs_create_root_structures(void) init_system_file_sd(FILE_LogFile, &sd, &i); err = add_attr_sd(m, sd, i); } - if (err < 0) - err_exit("Couldn't create $LogFile: %s\n", strerror(-err)); + if (err < 0) { + ntfs_log_error("Couldn't create $LogFile: %s\n", strerror(-err)); + return FALSE; + } /* dump_mft_record(m); */ ntfs_log_verbose("Creating $AttrDef (mft record 4)\n"); @@ -4577,8 +4619,10 @@ static void mkntfs_create_root_structures(void) init_system_file_sd(FILE_AttrDef, &sd, &i); err = add_attr_sd(m, sd, i); } - if (err < 0) - err_exit("Couldn't create $AttrDef: %s\n", strerror(-err)); + if (err < 0) { + ntfs_log_error("Couldn't create $AttrDef: %s\n", strerror(-err)); + return FALSE; + } /* dump_mft_record(m); */ ntfs_log_verbose("Creating $Bitmap (mft record 6)\n"); m = (MFT_RECORD*)(g_buf + 6 * g_vol->mft_record_size); @@ -4601,15 +4645,17 @@ static void mkntfs_create_root_structures(void) init_system_file_sd(FILE_Bitmap, &sd, &i); err = add_attr_sd(m, sd, i); } - if (err < 0) - err_exit("Couldn't create $Bitmap: %s\n", strerror(-err)); + if (err < 0) { + ntfs_log_error("Couldn't create $Bitmap: %s\n", strerror(-err)); + return FALSE; + } /* dump_mft_record(m); */ ntfs_log_verbose("Creating $Boot (mft record 7)\n"); m = (MFT_RECORD*)(g_buf + 7 * g_vol->mft_record_size); bs = ntfs_calloc(1, 8192); if (!bs) - exit(1); + return FALSE; memcpy(bs, boot_array, sizeof(boot_array)); /* * Create the boot sector in bs. Note, that bs is already zeroed @@ -4643,9 +4689,10 @@ static void mkntfs_create_root_structures(void) if ((u32)(1 << -bs->clusters_per_mft_record) != g_vol->mft_record_size) { free(bs); - err_exit("BUG: calculated clusters_per_mft_record " + ntfs_log_error("BUG: calculated clusters_per_mft_record " "is wrong (= 0x%x)\n", bs->clusters_per_mft_record); + return FALSE; } } ntfs_log_debug("clusters per mft record = %i (0x%x)\n", @@ -4658,9 +4705,10 @@ static void mkntfs_create_root_structures(void) bs->clusters_per_index_record = -g_vol->indx_record_size_bits; if ((1 << -bs->clusters_per_index_record) != (s32)g_vol->indx_record_size) { free(bs); - err_exit("BUG: calculated clusters_per_index_record " + ntfs_log_error("BUG: calculated clusters_per_index_record " "is wrong (= 0x%x)\n", bs->clusters_per_index_record); + return FALSE; } } ntfs_log_debug("clusters per index block = %i (0x%x)\n", @@ -4677,7 +4725,8 @@ static void mkntfs_create_root_structures(void) /* Make sure the bootsector is ok. */ if (!ntfs_boot_sector_is_ntfs(bs, TRUE)) { free(bs); - err_exit("FATAL: Generated boot sector is invalid!\n"); + ntfs_log_error("FATAL: Generated boot sector is invalid!\n"); + return FALSE; } err = add_attr_data_positioned(m, NULL, 0, 0, 0, g_rl_boot, (u8*)bs, 8192); if (!err) @@ -4693,7 +4742,8 @@ static void mkntfs_create_root_structures(void) } if (err < 0) { free(bs); - err_exit("Couldn't create $Boot: %s\n", strerror(-err)); + ntfs_log_error("Couldn't create $Boot: %s\n", strerror(-err)); + return FALSE; } if (create_backup_boot_sector((u8*)bs)) { @@ -4706,7 +4756,8 @@ static void mkntfs_create_root_structures(void) free(bs); - create_file_volume(m, root_ref, volume_flags); + if (!create_file_volume(m, root_ref, volume_flags)) + return FALSE; ntfs_log_verbose("Creating $BadClus (mft record 8)\n"); m = (MFT_RECORD*)(g_buf + 8 * g_vol->mft_record_size); @@ -4727,8 +4778,10 @@ static void mkntfs_create_root_structures(void) init_system_file_sd(FILE_BadClus, &sd, &i); err = add_attr_sd(m, sd, i); } - if (err < 0) - err_exit("Couldn't create $BadClus: %s\n", strerror(-err)); + if (err < 0) { + ntfs_log_error("Couldn't create $BadClus: %s\n", strerror(-err)); + return FALSE; + } /* dump_mft_record(m); */ /* create $Quota (1.2) or $Secure (3.0+) */ @@ -4746,9 +4799,11 @@ static void mkntfs_create_root_structures(void) init_system_file_sd(FILE_Secure, &sd, &i); err = add_attr_sd(m, sd, i); } - if (err < 0) - err_exit("Couldn't create $Quota: %s\n", + if (err < 0) { + ntfs_log_error("Couldn't create $Quota: %s\n", strerror(-err)); + return FALSE; + } } else { ntfs_log_verbose("Creating $Secure (mft record 9)\n"); m = (MFT_RECORD*)(g_buf + 9 * g_vol->mft_record_size); @@ -4765,20 +4820,20 @@ static void mkntfs_create_root_structures(void) buf_sds_size = 0x40000 + buf_sds_first_size; buf_sds_init = ntfs_calloc(1, buf_sds_first_size); if (!buf_sds_init) - exit(1); + return FALSE; init_secure_30(buf_sds_init); } else { buf_sds_first_size = 0x240; buf_sds_size = 0x40000 + buf_sds_first_size; buf_sds_init = ntfs_calloc(1, buf_sds_first_size); if (!buf_sds_init) - exit(1); + return FALSE; init_secure_31(buf_sds_init); } buf_sds = ntfs_calloc(1,buf_sds_size); if (!buf_sds) { free(buf_sds_init); - exit(1); + return FALSE; } memcpy(buf_sds, buf_sds_init, buf_sds_first_size); memcpy(buf_sds + 0x40000, buf_sds_init, @@ -4801,9 +4856,11 @@ static void mkntfs_create_root_structures(void) free (buf_sds_init); buf_sds_init = NULL; - if (err < 0) - err_exit("Couldn't create $Secure: %s\n", + if (err < 0) { + ntfs_log_error("Couldn't create $Secure: %s\n", strerror(-err)); + return FALSE; + } } /* dump_mft_record(m); */ ntfs_log_verbose("Creating $UpCase (mft record 0xa)\n"); @@ -4822,8 +4879,10 @@ static void mkntfs_create_root_structures(void) init_system_file_sd(FILE_UpCase, &sd, &i); err = add_attr_sd(m, sd, i); } - if (err < 0) - err_exit("Couldn't create $UpCase: %s\n", strerror(-err)); + if (err < 0) { + ntfs_log_error("Couldn't create $UpCase: %s\n", strerror(-err)); + return FALSE; + } /* dump_mft_record(m); */ if (g_vol->major_ver < 3) { @@ -4835,9 +4894,11 @@ static void mkntfs_create_root_structures(void) init_system_file_sd(11, &sd, &j); err = add_attr_sd(m, sd, j); } - if (err < 0) - err_exit("Couldn't create system file 11 (0x0b): %s\n", + if (err < 0) { + ntfs_log_error("Couldn't create system file 11 (0x0b): %s\n", strerror(-err)); + return FALSE; + } /* dump_mft_record(m); */ } else { ntfs_log_verbose("Creating $Extend (mft record 11)\n"); @@ -4857,9 +4918,11 @@ static void mkntfs_create_root_structures(void) if (!err) err = add_attr_index_root(m, "$I30", 4, 0, AT_FILE_NAME, COLLATION_FILE_NAME, g_vol->indx_record_size); - if (err < 0) - err_exit("Couldn't create $Extend: %s\n", + if (err < 0) { + ntfs_log_error("Couldn't create $Extend: %s\n", strerror(-err)); + return FALSE; + } } /* NTFS 1.2 reserved system files (mft records 0xc-0xf) */ for (i = 0xc; i < 0x10; i++) { @@ -4870,9 +4933,11 @@ static void mkntfs_create_root_structures(void) init_system_file_sd(i, &sd, &j); err = add_attr_sd(m, sd, j); } - if (err < 0) - err_exit("Couldn't create system file %i (0x%x): %s\n", + if (err < 0) { + ntfs_log_error("Couldn't create system file %i (0x%x): %s\n", i, i, strerror(-err)); + return FALSE; + } /* dump_mft_record(m); */ } /* create systemfiles for ntfs volumes (3.1) */ @@ -4899,8 +4964,10 @@ static void mkntfs_create_root_structures(void) COLLATION_NTOFS_ULONG, g_vol->indx_record_size); if (!err) err = initialize_quota(m); - if (err < 0) - err_exit("Couldn't create $Quota: %s\n", strerror(-err)); + if (err < 0) { + ntfs_log_error("Couldn't create $Quota: %s\n", strerror(-err)); + return FALSE; + } ntfs_log_verbose("Creating $ObjId (mft record 25)\n"); m = (MFT_RECORD*)(g_buf + 25 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; @@ -4916,8 +4983,10 @@ static void mkntfs_create_root_structures(void) if (!err) err = add_attr_index_root(m, "$O", 2, 0, AT_UNUSED, COLLATION_NTOFS_ULONGS, g_vol->indx_record_size); - if (err < 0) - err_exit("Couldn't create $ObjId: %s\n", strerror(-err)); + if (err < 0) { + ntfs_log_error("Couldn't create $ObjId: %s\n", strerror(-err)); + return FALSE; + } ntfs_log_verbose("Creating $Reparse (mft record 26)\n"); m = (MFT_RECORD*)(g_buf + 26 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; @@ -4932,10 +5001,13 @@ static void mkntfs_create_root_structures(void) if (!err) err = add_attr_index_root(m, "$R", 2, 0, AT_UNUSED, COLLATION_NTOFS_ULONGS, g_vol->indx_record_size); - if (err < 0) - err_exit("Couldn't create $Reparse: %s\n", + if (err < 0) { + ntfs_log_error("Couldn't create $Reparse: %s\n", strerror(-err)); + return FALSE; + } } + return TRUE; } @@ -4956,13 +5028,6 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg goto done; } - /* Register our exit function which will cleanup everything. */ - err = atexit(&mkntfs_exit); - if (err == -1) { - ntfs_log_error("Could not set up exit() function because atexit() failed. Aborting...\n"); - goto done; - } - /* Initialize the random number generator with the current time. */ srandom(mkntfs_time()); @@ -5026,23 +5091,29 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg goto done; } - if (mkntfs_open_partition()) /* Open the partition. */ + /* Open the partition. */ + if (mkntfs_open_partition()) goto done; - //-------------------------------------------------------------------------------- - /* Decide on the sectors/tracks/heads/size, etc. */ if (!mkntfs_override_phys_params(g_vol)) goto done; /* Initialize $Bitmap and $MFT/$BITMAP related stuff. */ - mkntfs_initialize_bitmaps(); + if (!mkntfs_initialize_bitmaps()) + goto done; + /* Initialize MFT & set g_logfile_lcn. */ - mkntfs_initialize_rl_mft(); + if (!mkntfs_initialize_rl_mft()) + goto done; + /* Initialise $LogFile. */ - mkntfs_initialize_rl_logfile(); + if (!mkntfs_initialize_rl_logfile()) + goto done; + /* Initialize $Boot. */ - mkntfs_initialize_rl_boot(); + if (!mkntfs_initialize_rl_boot()) + goto done; /* Allocate a buffer large enough to hold the mft. */ g_buf = ntfs_calloc(1, g_mft_size); @@ -5050,12 +5121,18 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg goto done; /* Create runlist for $BadClus, $DATA named stream $Bad. */ - mkntfs_initialize_rl_bad(); + if (!mkntfs_initialize_rl_bad()) + goto done; + /* If not quick format, fill the device with 0s. */ - if (!opts.quick_format) - mkntfs_fill_device_with_zeroes(); + if (!opts.quick_format) { + if (!mkntfs_fill_device_with_zeroes()) + goto done; + } + /* Create NTFS volume structures. */ - mkntfs_create_root_structures(); + if (!mkntfs_create_root_structures()) + goto done; /* * - Do not step onto bad blocks!!! @@ -5071,7 +5148,9 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg * update during each subsequent c&w of each system file. */ ntfs_log_verbose("Syncing root directory index record.\n"); - mkntfs_sync_index_record(g_index_block, (MFT_RECORD*)(g_buf + 5 * g_vol->mft_record_size), NTFS_INDEX_I30, 4); + if (!mkntfs_sync_index_record(g_index_block, (MFT_RECORD*)(g_buf + 5 * + g_vol->mft_record_size), NTFS_INDEX_I30, 4)) + goto done; ntfs_log_verbose("Syncing $Bitmap.\n"); m = (MFT_RECORD*)(g_buf + 6 * g_vol->mft_record_size); @@ -5106,8 +5185,6 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg memcpy((char*)a + le16_to_cpu(a->value_offset), g_lcn_bitmap, le32_to_cpu(a->value_length)); } - //-------------------------------------------------------------------------------- - /* * No need to sync $MFT/$BITMAP as that has never been modified since * its creation. @@ -5160,7 +5237,7 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg result = 0; done: ntfs_attr_put_search_ctx(ctx); - mkntfs_exit(); /* Device is unlocked and closed here */ + mkntfs_cleanup(); /* Device is unlocked and closed here */ return result; } From 68a9bdd3a25fd0c740f80a5b52770ee382037cbe Mon Sep 17 00:00:00 2001 From: flatcap Date: Sat, 19 Nov 2005 16:54:28 +0000 Subject: [PATCH 2766/2994] every function returns --- ntfsprogs/mkntfs.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index abb07035..da8b1e08 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -566,8 +566,6 @@ static void *ntfs_calloc(size_t nmemb, size_t size) /** * append_to_bad_blocks - * - * Note: Might not return. */ static BOOL append_to_bad_blocks(unsigned long long block) { @@ -633,8 +631,6 @@ static long long mkntfs_write(struct ntfs_device *dev, * * Return the number of bytes written (minus padding) or -1 on error. Errno * will be set to the error code. - * - * Note: Might not return. */ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, const u8 *val, const s64 val_len, s64 *inited_size) @@ -715,8 +711,6 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, /** * dump_resident_attr_val - * - * Note: Might not return. */ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) { @@ -3423,8 +3417,6 @@ static void mkntfs_cleanup(void) /** * mkntfs_open_partition - - * - * Note: Might not return. */ static int mkntfs_open_partition(void) { @@ -3767,8 +3759,6 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) /** * mkntfs_initialize_bitmaps - - * - * Note: Might not return. */ static BOOL mkntfs_initialize_bitmaps(void) { @@ -3846,8 +3836,6 @@ static BOOL mkntfs_initialize_bitmaps(void) /** * mkntfs_initialize_rl_mft - - * - * Note: Might not return. */ static BOOL mkntfs_initialize_rl_mft(void) { @@ -3953,8 +3941,6 @@ static BOOL mkntfs_initialize_rl_mft(void) /** * mkntfs_initialize_rl_logfile - - * - * Note: Might not return. */ static BOOL mkntfs_initialize_rl_logfile(void) { @@ -4030,8 +4016,6 @@ static BOOL mkntfs_initialize_rl_logfile(void) /** * mkntfs_initialize_rl_boot - - * - * Note: Might not return. */ static BOOL mkntfs_initialize_rl_boot(void) { @@ -4066,8 +4050,6 @@ static BOOL mkntfs_initialize_rl_boot(void) /** * mkntfs_initialize_rl_bad - - * - * Note: Might not return. */ static BOOL mkntfs_initialize_rl_bad(void) { @@ -4097,8 +4079,6 @@ static BOOL mkntfs_initialize_rl_bad(void) /** * mkntfs_fill_device_with_zeroes - - * - * Note: Might not return. */ static BOOL mkntfs_fill_device_with_zeroes(void) { @@ -4340,8 +4320,6 @@ bb_err: /** * mkntfs_create_root_structures - - * - * Note: Might not return. */ static BOOL mkntfs_create_root_structures(void) { From 927cd331d8208358d685052c356d63e936569dc2 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 20 Nov 2005 00:06:11 +0000 Subject: [PATCH 2767/2994] Create files with sequence numbers starting from 1 in $Extend (part 2) --- ntfsprogs/mkntfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index da8b1e08..e3331f06 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -4376,10 +4376,10 @@ static BOOL mkntfs_create_root_structures(void) ntfs_log_error("Failed to layout system mft records.\n"); return FALSE; } - if (i > 0) - m->sequence_number = cpu_to_le16(i); - if (i == 0) + if (i == 0 || i > 23) m->sequence_number = cpu_to_le16(1); + else + m->sequence_number = cpu_to_le16(i); } /* * If only one cluster contains all system files then @@ -4946,6 +4946,7 @@ static BOOL mkntfs_create_root_structures(void) ntfs_log_error("Couldn't create $Quota: %s\n", strerror(-err)); return FALSE; } + ntfs_log_verbose("Creating $ObjId (mft record 25)\n"); m = (MFT_RECORD*)(g_buf + 25 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; @@ -4965,6 +4966,7 @@ static BOOL mkntfs_create_root_structures(void) ntfs_log_error("Couldn't create $ObjId: %s\n", strerror(-err)); return FALSE; } + ntfs_log_verbose("Creating $Reparse (mft record 26)\n"); m = (MFT_RECORD*)(g_buf + 26 * g_vol->mft_record_size); m->flags |= MFT_RECORD_IS_4; From d7f102b6709c086b137a4f83f7feafef7bb6db8a Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 20 Nov 2005 00:18:09 +0000 Subject: [PATCH 2768/2994] fix typo --- ntfsprogs/mkntfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index e3331f06..79f67ca9 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3539,7 +3539,7 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) } if (opts.sector_size < 256 || opts.sector_size > 4096) { ntfs_log_error("The sector size is invalid. The minimum size " - "if 256 bytes and the maximum is 4096 bytes.\n"); + "is 256 bytes and the maximum is 4096 bytes.\n"); return FALSE; } ntfs_log_debug("sector size = %ld bytes\n", opts.sector_size); From 14821aa976c0e15138e91da067cc27ba2f7e5027 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 20 Nov 2005 11:21:54 +0000 Subject: [PATCH 2769/2994] remove my temporaray code/comments --- ntfsprogs/mkntfs.c | 141 ++++++++------------------------------------- 1 file changed, 23 insertions(+), 118 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 79f67ca9..8074b2ca 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -319,7 +319,7 @@ static BOOL mkntfs_parse_llong(const char *string, const char *name, long long * /** * mkntfs_init_options */ -static void mkntfs_init_options(struct mkntfs_options *opts2) // XXX rename arg +static void mkntfs_init_options(struct mkntfs_options *opts2) { if (!opts2) return; @@ -511,34 +511,6 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * return (!err && !ver && !lic); } -/** - * mkntfs_validate_options - */ -static BOOL mkntfs_validate_options(struct mkntfs_options *opts2 __attribute__((unused))) // XXX rename arg -{ -#if 0 - printf ("dev_name = %s\n", opts2->dev_name); - printf ("label = %s\n", opts2->label); - printf ("quick_format = %d\n", opts2->quick_format); - printf ("disable_indexing = %d\n", opts2->disable_indexing); - printf ("ver_major = %d\n", opts2->ver_major); - printf ("ver_minor = %d\n", opts2->ver_minor); - printf ("enable_compression = %d\n", opts2->enable_compression); - printf ("heads = %ld\n", opts2->heads); - printf ("cluster_size = %ld\n", opts2->cluster_size); - printf ("mft_zone_multiplier = %ld\n", opts2->mft_zone_multiplier); - printf ("sectors_per_track = %ld\n", opts2->sectors_per_track); - printf ("use_epoch_time = %d\n", opts2->use_epoch_time); - printf ("num_sectors = %lld\n", opts2->num_sectors); - printf ("sector_size = %ld\n", opts2->sector_size); - printf ("part_start_sect = %lld\n", opts2->part_start_sect); - printf ("no_action = %d\n", opts2->no_action); - printf ("force = %d\n", opts2->force); -#endif - - return TRUE; -} - /** * mkntfs_time @@ -602,7 +574,7 @@ static long long mkntfs_write(struct ntfs_device *dev, bytes_written = dev->d_ops->write(dev, b, count); if (bytes_written == -1LL) { retry = errno; - ntfs_log_perror("Error writing to %s", g_vol->dev->d_name); + ntfs_log_perror("Error writing to %s", dev->d_name); errno = retry; return bytes_written; } else if (!bytes_written) { @@ -614,7 +586,7 @@ static long long mkntfs_write(struct ntfs_device *dev, } while (count && retry < 3); if (count) ntfs_log_error("Failed to complete writing to %s after three retries." - "\n", g_vol->dev->d_name); + "\n", dev->d_name); return total; } @@ -674,7 +646,7 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, if (bytes_written == -1LL) { retry = errno; ntfs_log_perror("Error writing to %s", - g_vol->dev->d_name); + dev->d_name); errno = retry; return bytes_written; } @@ -689,7 +661,7 @@ static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl, } while (length && retry < 3); if (length) { ntfs_log_error("Failed to complete writing to %s after three " - "retries.\n", g_vol->dev->d_name); + "retries.\n", dev->d_name); return total; } } @@ -3418,12 +3390,9 @@ static void mkntfs_cleanup(void) /** * mkntfs_open_partition - */ -static int mkntfs_open_partition(void) +static BOOL mkntfs_open_partition(ntfs_volume *vol) { - /* This function uses: - * g_vol - */ - int result = 1; + BOOL result = FALSE; int i; struct stat sbuf; unsigned long mnt_flags; @@ -3432,8 +3401,8 @@ static int mkntfs_open_partition(void) * Allocate and initialize an ntfs device structure and attach it to * the volume. */ - g_vol->dev = ntfs_device_alloc(opts.dev_name, 0, &ntfs_device_default_io_ops, NULL); - if (!g_vol->dev) { + vol->dev = ntfs_device_alloc(opts.dev_name, 0, &ntfs_device_default_io_ops, NULL); + if (!vol->dev) { ntfs_log_perror("Could not create device"); goto done; } @@ -3445,21 +3414,21 @@ static int mkntfs_open_partition(void) } else { i = O_RDWR; } - if (g_vol->dev->d_ops->open(g_vol->dev, i)) { + if (vol->dev->d_ops->open(vol->dev, i)) { if (errno == ENOENT) ntfs_log_error("The device doesn't exist; did you specify it correctly?\n"); else - ntfs_log_perror("Could not open %s", g_vol->dev->d_name); + ntfs_log_perror("Could not open %s", vol->dev->d_name); goto done; } /* Verify we are dealing with a block device. */ - if (g_vol->dev->d_ops->stat(g_vol->dev, &sbuf)) { - ntfs_log_perror("Error getting information about %s", g_vol->dev->d_name); + if (vol->dev->d_ops->stat(vol->dev, &sbuf)) { + ntfs_log_perror("Error getting information about %s", vol->dev->d_name); goto done; } if (!S_ISBLK(sbuf.st_mode)) { - ntfs_log_error("%s is not a block device.\n", g_vol->dev->d_name); + ntfs_log_error("%s is not a block device.\n", vol->dev->d_name); if (!opts.force) { ntfs_log_error("Refusing to make a filesystem here!\n"); goto done; @@ -3486,7 +3455,7 @@ static int mkntfs_open_partition(void) #ifdef HAVE_LINUX_MAJOR_H } else if ((IDE_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 64 == 0) || (SCSI_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 16 == 0)) { - ntfs_log_error("%s is entire device, not just one partition.\n", g_vol->dev->d_name); + ntfs_log_error("%s is entire device, not just one partition.\n", vol->dev->d_name); if (!opts.force) { ntfs_log_error("Refusing to make a filesystem here!\n"); goto done; @@ -3495,17 +3464,17 @@ static int mkntfs_open_partition(void) #endif } /* Make sure the file system is not mounted. */ - if (ntfs_check_if_mounted(g_vol->dev->d_name, &mnt_flags)) { - ntfs_log_perror("Failed to determine whether %s is mounted", g_vol->dev->d_name); + if (ntfs_check_if_mounted(vol->dev->d_name, &mnt_flags)) { + ntfs_log_perror("Failed to determine whether %s is mounted", vol->dev->d_name); } else if (mnt_flags & NTFS_MF_MOUNTED) { - ntfs_log_error("%s is mounted.\n", g_vol->dev->d_name); + ntfs_log_error("%s is mounted.\n", vol->dev->d_name); if (!opts.force) { ntfs_log_error("Refusing to make a filesystem here!\n"); goto done; } ntfs_log_warning("mkntfs forced anyway. Hope /etc/mtab is incorrect.\n"); } - result = 0; + result = TRUE; done: return result; } @@ -3727,7 +3696,7 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) if ((vol->nr_clusters != ((opts.num_sectors * opts.sector_size) / vol->cluster_size) || (volume_size / opts.sector_size) != opts.num_sectors || (volume_size / vol->cluster_size) != vol->nr_clusters)) { - // XXX is this code reachable? + /* XXX is this code reachable? */ ntfs_log_error("Illegal combination of volume/cluster/sector size and/or cluster/sector number.\n"); return FALSE; } @@ -3762,15 +3731,6 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) */ static BOOL mkntfs_initialize_bitmaps(void) { - /* This function uses: - * g_lcn_bitmap - * g_lcn_bitmap_byte_size - * g_mft_bitmap - * g_mft_bitmap_byte_size - * g_mft_size - * g_rl_mft_bmp - * g_vol - */ u64 i; int mft_bitmap_size; @@ -3819,7 +3779,7 @@ static BOOL mkntfs_initialize_bitmaps(void) } g_rl_mft_bmp[0].vcn = 0LL; /* Mft bitmap is right after $Boot's data. */ - i = (8192 + g_vol->cluster_size - 1) / g_vol->cluster_size; //XXX hardcoded size for $Boot + i = (8192 + g_vol->cluster_size - 1) / g_vol->cluster_size; g_rl_mft_bmp[0].lcn = i; /* * Size is always one cluster, even though valid data size and @@ -3839,18 +3799,6 @@ static BOOL mkntfs_initialize_bitmaps(void) */ static BOOL mkntfs_initialize_rl_mft(void) { - /* This function uses: - * g_lcn_bitmap - * g_logfile_lcn - * g_mft_lcn - * g_mftmirr_lcn - * g_mft_size - * g_mft_zone_end - * g_rl_mft - * g_rl_mft_bmp - * g_rl_mftmirr - * g_vol - */ int i, j; /* If user didn't specify the mft lcn, determine it now. */ @@ -3944,13 +3892,6 @@ static BOOL mkntfs_initialize_rl_mft(void) */ static BOOL mkntfs_initialize_rl_logfile(void) { - /* This function uses: - * g_lcn_bitmap - * g_logfile_lcn - * g_logfile_size - * g_rl_logfile - * g_vol - */ int i, j; u64 volume_size; @@ -4019,11 +3960,6 @@ static BOOL mkntfs_initialize_rl_logfile(void) */ static BOOL mkntfs_initialize_rl_boot(void) { - /* This function uses: - * g_lcn_bitmap - * g_rl_boot - * g_vol - */ int i, j; /* Create runlist for $Boot. */ g_rl_boot = malloc(2 * sizeof(runlist)); @@ -4053,9 +3989,6 @@ static BOOL mkntfs_initialize_rl_boot(void) */ static BOOL mkntfs_initialize_rl_bad(void) { - /* This function uses: - * g_rl_bad - */ /* Create runlist for $BadClus, $DATA named stream $Bad. */ g_rl_bad = malloc(2 * sizeof(runlist)); if (!g_rl_bad) { @@ -4082,10 +4015,6 @@ static BOOL mkntfs_initialize_rl_bad(void) */ static BOOL mkntfs_fill_device_with_zeroes(void) { - /* This function uses: - * g_buf - * g_vol - */ /* * If not quick format, fill the device with 0s. * FIXME: Except bad blocks! (AIA) @@ -4176,9 +4105,6 @@ static BOOL mkntfs_fill_device_with_zeroes(void) static BOOL mkntfs_sync_index_record(INDEX_ALLOCATION* idx, MFT_RECORD* m, ntfschar* name, u32 name_len) { - /* This function uses: - * g_vol - */ int i, err; ntfs_attr_search_ctx *ctx; ATTR_RECORD *a; @@ -4323,25 +4249,6 @@ bb_err: */ static BOOL mkntfs_create_root_structures(void) { - /* This function uses: - * g_buf - * g_index_block - * g_lcn_bitmap - * g_lcn_bitmap_byte_size - * g_logfile_size - * g_mft_bitmap - * g_mft_bitmap_byte_size - * g_mft_lcn - * g_mftmirr_lcn - * g_mft_size - * g_rl_bad - * g_rl_boot - * g_rl_logfile - * g_rl_mft - * g_rl_mft_bmp - * g_rl_mftmirr - * g_vol - */ NTFS_BOOT_SECTOR *bs; MFT_RECORD *m; MFT_REF root_ref; @@ -4994,7 +4901,7 @@ static BOOL mkntfs_create_root_structures(void) /** * mkntfs_redirect */ -static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg +static int mkntfs_redirect(struct mkntfs_options *opts2) { int result = 1; ntfs_attr_search_ctx *ctx = NULL; @@ -5072,7 +4979,7 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) // XXX rename arg } /* Open the partition. */ - if (mkntfs_open_partition()) + if (!mkntfs_open_partition(g_vol)) goto done; /* Decide on the sectors/tracks/heads/size, etc. */ @@ -5241,8 +5148,6 @@ int main(int argc, char *argv[]) if (!mkntfs_parse_options(argc, argv, &opts)) /* Read the command line options */ goto done; - if (!mkntfs_validate_options(&opts)) /* Validate those options */ - goto done; result = mkntfs_redirect(&opts); done: From 0f7ee235ed1d239aef7cb5c157891cafc266d1b5 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 20 Nov 2005 11:34:30 +0000 Subject: [PATCH 2770/2994] comments for unions --- include/ntfs/attrib.h | 7 ++++--- include/ntfs/layout.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/ntfs/attrib.h b/include/ntfs/attrib.h index d0d68b19..a12cf917 100644 --- a/include/ntfs/attrib.h +++ b/include/ntfs/attrib.h @@ -228,9 +228,10 @@ GenNAttrIno(Compressed, COMPRESSED) GenNAttrIno(Encrypted, ENCRYPTED) GenNAttrIno(Sparse, SPARSE_FILE) -/* - * Union of all known attribute values. For convenience. Used in the attr - * structure. +/** + * union attr_val - Union of all known attribute values + * + * For convenience. Used in the attr structure. */ typedef union { u8 _default; /* Unnamed u8 to serve as default when just using diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index b564426e..c4e78752 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1340,8 +1340,8 @@ typedef enum { /* Identifier authority. */ * (Built-in domain) S-1-5-0x20 */ -/* - * The SID_IDENTIFIER_AUTHORITY is a 48-bit value used in the SID structure. +/** + * union SID_IDENTIFIER_AUTHORITY - A 48-bit value used in the SID structure * * NOTE: This is stored as a big endian number. */ From abf0cfba5dfb9723d3419c8a2a55cfc622f8f5be Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 20 Nov 2005 14:15:33 +0000 Subject: [PATCH 2771/2994] use new logging --- ntfsprogs/ntfsdump_logfile.c | 192 +++++++++++++++++----------------- ntfsprogs/ntfsfix.c | 162 +++++++++++++++++------------ ntfsprogs/ntfsmftalloc.c | 131 ++++++++++------------- ntfsprogs/ntfsrm.c | 195 +++++++++++++++++++---------------- ntfsprogs/ntfstruncate.c | 87 ++++++---------- 5 files changed, 379 insertions(+), 388 deletions(-) diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c index c91edf5c..d6500379 100644 --- a/ntfsprogs/ntfsdump_logfile.c +++ b/ntfsprogs/ntfsdump_logfile.c @@ -70,6 +70,7 @@ #include "mst.h" #include "utils.h" #include "version.h" +#include "logging.h" typedef struct { BOOL is_volume; @@ -87,8 +88,6 @@ typedef struct { }; } logfile_file; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) - /** * logfile_close */ @@ -98,15 +97,15 @@ static int logfile_close(logfile_file *logfile) if (logfile->na) ntfs_attr_close(logfile->na); if (logfile->ni && ntfs_inode_close(logfile->ni)) - Eprintf("Warning: Failed to close $LogFile (inode %i):" - " %s\n", FILE_LogFile, strerror(errno)); + ntfs_log_perror("Warning: Failed to close $LogFile " + "(inode %i)", FILE_LogFile); if (ntfs_umount(logfile->vol, 0)) - Eprintf("Warning: Failed to umount %s: %s\n", - logfile->filename, strerror(errno)); + ntfs_log_perror("Warning: Failed to umount %s", + logfile->filename); } else { if (close(logfile->fd)) - Eprintf("Warning: Failed to close file %s: %s\n", - logfile->filename, strerror(errno)); + ntfs_log_perror("Warning: Failed to close file %s", + logfile->filename); } return 0; } @@ -130,17 +129,17 @@ static void device_err_exit(ntfs_volume *vol, ntfs_inode *ni, if (na) ntfs_attr_close(na); if (ni && ntfs_inode_close(ni)) - Eprintf("Warning: Failed to close $LogFile (inode %i): %s\n", - FILE_LogFile, strerror(errno)); + ntfs_log_perror("Warning: Failed to close $LogFile (inode %i)", + FILE_LogFile); if (ntfs_umount(vol, 0)) - Eprintf("Warning: Failed to umount: %s\n", strerror(errno)); + ntfs_log_perror("Warning: Failed to umount"); fprintf(stderr, "ERROR: "); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); - Eprintf("Aborting...\n"); + ntfs_log_error("Aborting...\n"); exit(1); } @@ -160,7 +159,7 @@ static void log_err_exit(u8 *buf, const char *fmt, ...) vfprintf(stderr, fmt, ap); va_end(ap); - Eprintf("Aborting...\n"); + ntfs_log_error("Aborting...\n"); exit(1); } @@ -170,7 +169,7 @@ static void log_err_exit(u8 *buf, const char *fmt, ...) __attribute__((noreturn)) static void usage(const char *exec_name) { - Eprintf("%s v%s (libntfs %s) - Interpret and display information " + ntfs_log_error("%s v%s (libntfs %s) - Interpret and display information " "about the journal\n($LogFile) of an NTFS volume.\n" "Copyright (c) 2000-2005 Anton Altaparmakov.\n" "%s is free software, released under the GNU General " @@ -202,7 +201,7 @@ static int logfile_open(BOOL is_volume, const char *filename, if (!vol) log_err_exit(NULL, "Failed to mount %s: %s\n", filename, strerror(errno)); - printf("Mounted NTFS volume %s (NTFS v%i.%i) on device %s.\n", + ntfs_log_info("Mounted NTFS volume %s (NTFS v%i.%i) on device %s.\n", vol->vol_name ? vol->vol_name : "", vol->major_ver, vol->minor_ver, filename); if (ntfs_version_is_supported(vol)) @@ -265,13 +264,13 @@ static int logfile_pread(logfile_file *logfile, int ofs, int count, u8 *buf) br = (int)ntfs_attr_pread(logfile->na, ofs, count, buf); } else { if (lseek(logfile->fd, ofs, SEEK_SET)==-1) { - Eprintf("Could not seek to offset %u\n", ofs); + ntfs_log_error("Could not seek to offset %u\n", ofs); return 0; } br = read(logfile->fd, buf, count); } if (br != count) { - Eprintf("Only %d out of %d bytes read starting at %d\n", + ntfs_log_error("Only %d out of %d bytes read starting at %d\n", br, count, ofs); } return br; @@ -340,29 +339,35 @@ static void restart_header_sanity(RESTART_PAGE_HEADER *rstr, u8 *buf) "yet.\n"); } +/** + * dump_restart_areas_header + */ static void dump_restart_areas_header(RESTART_PAGE_HEADER *rstr) { - printf("\nRestart page header:\n"); - printf("magic = %s\n", ntfs_is_rstr_record(rstr->magic) ? "RSTR" : + ntfs_log_info("\nRestart page header:\n"); + ntfs_log_info("magic = %s\n", ntfs_is_rstr_record(rstr->magic) ? "RSTR" : "CHKD"); - printf("usa_ofs = %u (0x%x)\n", le16_to_cpu(rstr->usa_ofs), + ntfs_log_info("usa_ofs = %u (0x%x)\n", le16_to_cpu(rstr->usa_ofs), le16_to_cpu(rstr->usa_ofs)); - printf("usa_count = %u (0x%x)\n", le16_to_cpu(rstr->usa_count), + ntfs_log_info("usa_count = %u (0x%x)\n", le16_to_cpu(rstr->usa_count), le16_to_cpu(rstr->usa_count)); - printf("chkdsk_lsn = %lli (0x%llx)\n", + ntfs_log_info("chkdsk_lsn = %lli (0x%llx)\n", (long long)sle64_to_cpu(rstr->chkdsk_lsn), (unsigned long long)sle64_to_cpu(rstr->chkdsk_lsn)); - printf("system_page_size = %u (0x%x)\n", + ntfs_log_info("system_page_size = %u (0x%x)\n", (unsigned int)le32_to_cpu(rstr->system_page_size), (unsigned int)le32_to_cpu(rstr->system_page_size)); - printf("log_page_size = %u (0x%x)\n", + ntfs_log_info("log_page_size = %u (0x%x)\n", (unsigned int)le32_to_cpu(rstr->log_page_size), (unsigned int)le32_to_cpu(rstr->log_page_size)); - printf("restart_offset = %u (0x%x)\n", + ntfs_log_info("restart_offset = %u (0x%x)\n", le16_to_cpu(rstr->restart_area_offset), le16_to_cpu(rstr->restart_area_offset)); } +/** + * dump_restart_areas_area + */ static void dump_restart_areas_area(RESTART_PAGE_HEADER *rstr) { LOG_CLIENT_RECORD *lcr; @@ -371,40 +376,40 @@ static void dump_restart_areas_area(RESTART_PAGE_HEADER *rstr) ra = (RESTART_AREA*)((u8*)rstr + le16_to_cpu(rstr->restart_area_offset)); - printf("current_lsn = %lli (0x%llx)\n", + ntfs_log_info("current_lsn = %lli (0x%llx)\n", (long long)sle64_to_cpu(ra->current_lsn), (unsigned long long)sle64_to_cpu(ra->current_lsn)); - printf("log_clients = %u (0x%x)\n", le16_to_cpu(ra->log_clients), + ntfs_log_info("log_clients = %u (0x%x)\n", le16_to_cpu(ra->log_clients), le16_to_cpu(ra->log_clients)); - printf("client_free_list = %i (0x%x)\n", + ntfs_log_info("client_free_list = %i (0x%x)\n", (s16)le16_to_cpu(ra->client_free_list), le16_to_cpu(ra->client_free_list)); - printf("client_in_use_list = %i (0x%x)\n", + ntfs_log_info("client_in_use_list = %i (0x%x)\n", (s16)le16_to_cpu(ra->client_in_use_list), le16_to_cpu(ra->client_in_use_list)); - printf("flags = 0x%.4x\n", le16_to_cpu(ra->flags)); - printf("seq_number_bits = %u (0x%x)\n", + ntfs_log_info("flags = 0x%.4x\n", le16_to_cpu(ra->flags)); + ntfs_log_info("seq_number_bits = %u (0x%x)\n", (unsigned int)le32_to_cpu(ra->seq_number_bits), (unsigned int)le32_to_cpu(ra->seq_number_bits)); - printf("restart_area_length = %u (0x%x)\n", + ntfs_log_info("restart_area_length = %u (0x%x)\n", le16_to_cpu(ra->restart_area_length), le16_to_cpu(ra->restart_area_length)); - printf("client_array_offset = %u (0x%x)\n", + ntfs_log_info("client_array_offset = %u (0x%x)\n", le16_to_cpu(ra->client_array_offset), le16_to_cpu(ra->client_array_offset)); - printf("file_size = %lli (0x%llx)\n", + ntfs_log_info("file_size = %lli (0x%llx)\n", (long long)sle64_to_cpu(ra->file_size), (unsigned long long)sle64_to_cpu(ra->file_size)); - printf("last_lsn_data_length = %u (0x%x)\n", + ntfs_log_info("last_lsn_data_length = %u (0x%x)\n", (unsigned int)le32_to_cpu(ra->last_lsn_data_length), (unsigned int)le32_to_cpu(ra->last_lsn_data_length)); - printf("log_record_header_length = %u (0x%x)\n", + ntfs_log_info("log_record_header_length = %u (0x%x)\n", le16_to_cpu(ra->log_record_header_length), le16_to_cpu(ra->log_record_header_length)); - printf("log_page_data_offset = %u (0x%x)\n", + ntfs_log_info("log_page_data_offset = %u (0x%x)\n", le16_to_cpu(ra->log_page_data_offset), le16_to_cpu(ra->log_page_data_offset)); - printf("restart_log_open_count = %u (0x%x)\n", + ntfs_log_info("restart_log_open_count = %u (0x%x)\n", (unsigned)le32_to_cpu(ra->restart_log_open_count), (unsigned)le32_to_cpu(ra->restart_log_open_count)); lcr = (LOG_CLIENT_RECORD*)((u8*)ra + @@ -412,24 +417,24 @@ static void dump_restart_areas_area(RESTART_PAGE_HEADER *rstr) for (client = 0; client < le16_to_cpu(ra->log_clients); client++) { char *client_name; - printf("\nLog client record number %i:\n", client + 1); - printf("oldest_lsn = %lli (0x%llx)\n", + ntfs_log_info("\nLog client record number %i:\n", client + 1); + ntfs_log_info("oldest_lsn = %lli (0x%llx)\n", (long long)sle64_to_cpu(lcr->oldest_lsn), (unsigned long long) sle64_to_cpu(lcr->oldest_lsn)); - printf("client_restart_lsn = %lli (0x%llx)\n", (long long) + ntfs_log_info("client_restart_lsn = %lli (0x%llx)\n", (long long) sle64_to_cpu(lcr->client_restart_lsn), (unsigned long long) sle64_to_cpu(lcr->client_restart_lsn)); - printf("prev_client = %i (0x%x)\n", + ntfs_log_info("prev_client = %i (0x%x)\n", (s16)le16_to_cpu(lcr->prev_client), le16_to_cpu(lcr->prev_client)); - printf("next_client = %i (0x%x)\n", + ntfs_log_info("next_client = %i (0x%x)\n", (s16)le16_to_cpu(lcr->next_client), le16_to_cpu(lcr->next_client)); - printf("seq_number = %u (0x%x)\n", le16_to_cpu(lcr->seq_number), + ntfs_log_info("seq_number = %u (0x%x)\n", le16_to_cpu(lcr->seq_number), le16_to_cpu(lcr->seq_number)); - printf("client_name_length = %u (0x%x)\n", + ntfs_log_info("client_name_length = %u (0x%x)\n", (unsigned int)le32_to_cpu(lcr->client_name_length) / 2, (unsigned int)le32_to_cpu(lcr->client_name_length) / 2); if (le32_to_cpu(lcr->client_name_length)) { @@ -437,12 +442,12 @@ static void dump_restart_areas_area(RESTART_PAGE_HEADER *rstr) if (ntfs_ucstombs(lcr->client_name, le32_to_cpu(lcr->client_name_length) / 2, &client_name, 0) < 0) { - perror("Failed to convert log client name"); + ntfs_log_perror("Failed to convert log client name"); client_name = strdup(""); } } else client_name = strdup(""); - printf("client_name = %s\n", client_name); + ntfs_log_info("client_name = %s\n", client_name); free(client_name); /* * Log client records are fixed size so we can simply use the @@ -473,7 +478,7 @@ rstr_pass_loc: "detected in restart page header. Cannot " "handle this yet.\n"); if (pass == 1) - printf("$LogFile version %i.%i.\n", + ntfs_log_info("$LogFile version %i.%i.\n", sle16_to_cpu(rstr->major_ver), sle16_to_cpu(rstr->minor_ver)); else /* if (pass == 2) */ { @@ -511,10 +516,10 @@ rstr_pass_loc: "yet.\n"); } /* The restart page header is in rstr and it is mst deprotected. */ - printf("\n%s restart page:\n", pass == 1 ? "1st" : "2nd"); + ntfs_log_info("\n%s restart page:\n", pass == 1 ? "1st" : "2nd"); dump_restart_areas_header(rstr); - printf("\nRestart area:\n"); + ntfs_log_info("\nRestart area:\n"); dump_restart_areas_area(rstr); skip_rstr_pass: @@ -533,55 +538,55 @@ skip_rstr_pass: static void dump_log_record(LOG_RECORD *lr) { unsigned int i; - printf("this lsn = 0x%llx\n", + ntfs_log_info("this lsn = 0x%llx\n", (unsigned long long)le64_to_cpu(lr->this_lsn)); - printf("client previous lsn = 0x%llx\n", (unsigned long long) + ntfs_log_info("client previous lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(lr->client_previous_lsn)); - printf("client undo next lsn = 0x%llx\n", (unsigned long long) + ntfs_log_info("client undo next lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(lr->client_undo_next_lsn)); - printf("client data length = 0x%x\n", + ntfs_log_info("client data length = 0x%x\n", (unsigned int)le32_to_cpu(lr->client_data_length)); - printf("client_id.seq_number = 0x%x\n", + ntfs_log_info("client_id.seq_number = 0x%x\n", le16_to_cpu(lr->client_id.seq_number)); - printf("client_id.client_index = 0x%x\n", + ntfs_log_info("client_id.client_index = 0x%x\n", le16_to_cpu(lr->client_id.client_index)); - printf("record type = 0x%x\n", + ntfs_log_info("record type = 0x%x\n", (unsigned int)le32_to_cpu(lr->record_type)); - printf("transaction_id = 0x%x\n", + ntfs_log_info("transaction_id = 0x%x\n", (unsigned int)le32_to_cpu(lr->transaction_id)); - printf("flags = 0x%x:", lr->flags); + ntfs_log_info("flags = 0x%x:", lr->flags); if (!lr->flags) - printf(" NONE\n"); + ntfs_log_info(" NONE\n"); else { int _b = 0; if (lr->flags & LOG_RECORD_MULTI_PAGE) { - printf(" LOG_RECORD_MULTI_PAGE"); + ntfs_log_info(" LOG_RECORD_MULTI_PAGE"); _b = 1; } if (lr->flags & ~LOG_RECORD_MULTI_PAGE) { if (_b) - printf(" |"); - printf(" Unknown flags"); + ntfs_log_info(" |"); + ntfs_log_info(" Unknown flags"); } - printf("\n"); + ntfs_log_info("\n"); } - printf("redo_operation = 0x%x\n", le16_to_cpu(lr->redo_operation)); - printf("undo_operation = 0x%x\n", le16_to_cpu(lr->undo_operation)); - printf("redo_offset = 0x%x\n", le16_to_cpu(lr->redo_offset)); - printf("redo_length = 0x%x\n", le16_to_cpu(lr->redo_length)); - printf("undo_offset = 0x%x\n", le16_to_cpu(lr->undo_offset)); - printf("undo_length = 0x%x\n", le16_to_cpu(lr->undo_length)); - printf("target_attribute = 0x%x\n", le16_to_cpu(lr->target_attribute)); - printf("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); - printf("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); - printf("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); - printf("target_vcn = 0x%llx\n", + ntfs_log_info("redo_operation = 0x%x\n", le16_to_cpu(lr->redo_operation)); + ntfs_log_info("undo_operation = 0x%x\n", le16_to_cpu(lr->undo_operation)); + ntfs_log_info("redo_offset = 0x%x\n", le16_to_cpu(lr->redo_offset)); + ntfs_log_info("redo_length = 0x%x\n", le16_to_cpu(lr->redo_length)); + ntfs_log_info("undo_offset = 0x%x\n", le16_to_cpu(lr->undo_offset)); + ntfs_log_info("undo_length = 0x%x\n", le16_to_cpu(lr->undo_length)); + ntfs_log_info("target_attribute = 0x%x\n", le16_to_cpu(lr->target_attribute)); + ntfs_log_info("lcns_to_follow = 0x%x\n", le16_to_cpu(lr->lcns_to_follow)); + ntfs_log_info("record_offset = 0x%x\n", le16_to_cpu(lr->record_offset)); + ntfs_log_info("attribute_offset = 0x%x\n", le16_to_cpu(lr->attribute_offset)); + ntfs_log_info("target_vcn = 0x%llx\n", (unsigned long long)sle64_to_cpu(lr->target_vcn)); if (le16_to_cpu(lr->lcns_to_follow) > 0) - printf("Array of lcns:\n"); + ntfs_log_info("Array of lcns:\n"); for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++) - printf("lcn_list[%u].lcn = 0x%llx\n", i, (unsigned long long) + ntfs_log_info("lcn_list[%u].lcn = 0x%llx\n", i, (unsigned long long) sle64_to_cpu(lr->lcn_list[i].lcn)); } @@ -600,7 +605,7 @@ rcrd_pass_loc: rcrd = (RECORD_PAGE_HEADER*)((u8*)rcrd + page_size); if ((u8*)rcrd + page_size > buf + buf_size) return; - printf("\nLog record page number %i", pass); + ntfs_log_info("\nLog record page number %i", pass); if (!ntfs_is_rcrd_record(rcrd->magic) && !ntfs_is_chkd_record(rcrd->magic)) { unsigned int i; @@ -616,17 +621,17 @@ rcrd_pass_loc: } else puts(":"); /* Dump log record page */ - printf("magic = %s\n", ntfs_is_rcrd_record(rcrd->magic) ? "RCRD" : + ntfs_log_info("magic = %s\n", ntfs_is_rcrd_record(rcrd->magic) ? "RCRD" : "CHKD"); // TODO: I am here... (AIA) - printf("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long) + ntfs_log_info("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd->copy.last_lsn)); - printf("flags = 0x%x\n", (unsigned int)le32_to_cpu(rcrd->flags)); - printf("page count = %i\n", le16_to_cpu(rcrd->page_count)); - printf("page position = %i\n", le16_to_cpu(rcrd->page_position)); - printf("header.next_record_offset = 0x%llx\n", (unsigned long long) + ntfs_log_info("flags = 0x%x\n", (unsigned int)le32_to_cpu(rcrd->flags)); + ntfs_log_info("page count = %i\n", le16_to_cpu(rcrd->page_count)); + ntfs_log_info("page position = %i\n", le16_to_cpu(rcrd->page_position)); + ntfs_log_info("header.next_record_offset = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd->header.packed.next_record_offset)); - printf("header.last_end_lsn = 0x%llx\n", (unsigned long long) + ntfs_log_info("header.last_end_lsn = 0x%llx\n", (unsigned long long) le64_to_cpu(rcrd->header.packed.last_end_lsn)); /* * Where does the 0x40 come from? Is it just usa_offset + @@ -635,7 +640,7 @@ rcrd_pass_loc: lr = (LOG_RECORD*)((u8*)rcrd + 0x40); client = 0; do { - printf("\nLog record %i:\n", client); + ntfs_log_info("\nLog record %i:\n", client); dump_log_record(lr); client++; lr = (LOG_RECORD*)((u8*)lr + 0x70); @@ -658,7 +663,9 @@ int main(int argc, char **argv) logfile_file logfile; u8 *buf; - printf("\n"); + ntfs_log_set_handler(ntfs_log_handler_outerr); + + ntfs_log_info("\n"); if (argc < 2 || argc > 3) /* print usage and exit */ usage(argv[0]); @@ -686,14 +693,13 @@ int main(int argc, char **argv) if (logfile.data_size <= buf_size) buf_size = logfile.data_size; else - Eprintf("Warning: $LogFile is too big. " + ntfs_log_error("Warning: $LogFile is too big. " "Only analysing the first 64MiB.\n"); /* For simplicity we read all of $LogFile/$DATA into memory. */ buf = malloc(buf_size); if (!buf) { - Eprintf("Failed to allocate buffer for file data: %s\n", - strerror(errno)); + ntfs_log_perror("Failed to allocate buffer for file data"); logfile_close(&logfile); exit(1); } @@ -743,20 +749,20 @@ int main(int argc, char **argv) * Second, verify the restart area itself. */ // TODO: Implement this. - Eprintf("Warning: Sanity checking of restart area not implemented " + ntfs_log_error("Warning: Sanity checking of restart area not implemented " "yet.\n"); /* * Third and last, verify the array of log client records. */ // TODO: Implement this. - Eprintf("Warning: Sanity checking of array of log client records not " + ntfs_log_error("Warning: Sanity checking of array of log client records not " "implemented yet.\n"); /* * Dump the restart headers & areas. */ rcrd = (RECORD_PAGE_HEADER*)dump_restart_areas(rstr, buf, page_size); - printf("\n\nFinished with restart pages. " + ntfs_log_info("\n\nFinished with restart pages. " "Beginning with log pages.\n"); /* diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 1a63bf5f..791100d3 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -74,6 +74,7 @@ #include "logfile.h" #include "utils.h" #include "version.h" +#include "logging.h" #ifdef NO_NTFS_DEVICE_DEFAULT_IO_OPS # error "No default device io operations! Cannot build ntfsfix. \ @@ -81,13 +82,9 @@ You need to run ./configure without the --disable-default-device-io-ops \ switch if you want to be able to build the NTFS utilities." #endif -GEN_PRINTF(Eprintf, stdout, NULL, FALSE) -GEN_PRINTF(Vprintf, stdout, NULL, FALSE) -GEN_PRINTF(Qprintf, stdout, NULL, FALSE) - static const char *EXEC_NAME = "ntfsfix"; -static const char *OK = "OK"; -static const char *FAILED = "FAILED"; +static const char *OK = "OK\n"; +static const char *FAILED = "FAILED\n"; static BOOL vol_is_dirty = FALSE; static BOOL journal_is_empty = FALSE; @@ -95,10 +92,13 @@ struct { char *volume; } opt; +/** + * usage + */ __attribute__((noreturn)) static int usage(void) { - printf("%s v%s (libntfs %s)\n" + ntfs_log_info("%s v%s (libntfs %s)\n" "\n" "Usage: %s [options] device\n" " Attempt to fix an NTFS partition.\n" @@ -109,28 +109,34 @@ static int usage(void) "For example: %s /dev/hda6\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version(), EXEC_NAME, EXEC_NAME); - printf("%s%s", ntfs_bugs, ntfs_home); + ntfs_log_info("%s%s", ntfs_bugs, ntfs_home); exit(1); } +/** + * version + */ __attribute__((noreturn)) static void version(void) { - printf("%s v%s\n\n" + ntfs_log_info("%s v%s\n\n" "Attempt to fix an NTFS partition.\n\n" "Copyright (c) 2000-2003 Anton Altaparmakov.\n\n", EXEC_NAME, VERSION); - printf("%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home); + ntfs_log_info("%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home); exit(1); } +/** + * parse_options + */ static void parse_options(int argc, char **argv) { char c; static const char *sopt = "-hV"; static const struct option lopt[] = { - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 } }; @@ -142,7 +148,7 @@ static void parse_options(int argc, char **argv) if (!opt.volume) opt.volume = argv[optind - 1]; else { - printf("ERROR: Too many arguments.\n"); + ntfs_log_info("ERROR: Too many arguments.\n"); usage(); } break; @@ -152,17 +158,20 @@ static void parse_options(int argc, char **argv) case 'V': version(); default: - printf("ERROR: Unknown option '%s'.\n", argv[optind - 1]); + ntfs_log_info("ERROR: Unknown option '%s'.\n", argv[optind - 1]); usage(); } } if (opt.volume == NULL) { - printf("ERROR: You must specify a device.\n"); + ntfs_log_info("ERROR: You must specify a device.\n"); usage(); } } +/** + * OLD_ntfs_volume_set_flags + */ static int OLD_ntfs_volume_set_flags(ntfs_volume *vol, const u16 flags) { MFT_RECORD *m = NULL; @@ -233,6 +242,9 @@ err_exit: return ret; } +/** + * set_dirty_flag + */ static int set_dirty_flag(ntfs_volume *vol) { u16 flags; @@ -240,7 +252,7 @@ static int set_dirty_flag(ntfs_volume *vol) if (vol_is_dirty == TRUE) return 0; - printf("Setting required flags on partition... "); + ntfs_log_info("Setting required flags on partition... "); /* * Set chkdsk flag, i.e. mark the partition dirty so chkdsk will run * and fix it for us. @@ -250,15 +262,18 @@ static int set_dirty_flag(ntfs_volume *vol) if (vol->major_ver >= 2) flags |= VOLUME_MOUNTED_ON_NT4; if (OLD_ntfs_volume_set_flags(vol, flags)) { - puts(FAILED); - fprintf(stderr, "Error setting volume flags.\n"); + ntfs_log_info(FAILED); + ntfs_log_error("Error setting volume flags.\n"); return -1; } - puts(OK); + ntfs_log_info(OK); vol_is_dirty = TRUE; return 0; } +/** + * set_dirty_flag_mount + */ static int set_dirty_flag_mount(ntfs_volume *vol) { u16 flags; @@ -266,7 +281,7 @@ static int set_dirty_flag_mount(ntfs_volume *vol) if (vol_is_dirty == TRUE) return 0; - printf("Setting required flags on partition... "); + ntfs_log_info("Setting required flags on partition... "); /* * Set chkdsk flag, i.e. mark the partition dirty so chkdsk will run * and fix it for us. @@ -276,31 +291,37 @@ static int set_dirty_flag_mount(ntfs_volume *vol) if (vol->major_ver >= 2) flags |= VOLUME_MOUNTED_ON_NT4; if (ntfs_volume_write_flags(vol, flags)) { - puts(FAILED); - fprintf(stderr, "Error setting volume flags.\n"); + ntfs_log_info(FAILED); + ntfs_log_error("Error setting volume flags.\n"); return -1; } - puts(OK); + ntfs_log_info(OK); vol_is_dirty = TRUE; return 0; } +/** + * empty_journal + */ static int empty_journal(ntfs_volume *vol) { if (journal_is_empty == TRUE) return 0; - printf("Going to empty the journal ($LogFile)... "); + ntfs_log_info("Going to empty the journal ($LogFile)... "); if (ntfs_logfile_reset(vol)) { - puts(FAILED); - perror("Failed to reset $LogFile"); + ntfs_log_info(FAILED); + ntfs_log_perror("Failed to reset $LogFile"); return -1; } - puts(OK); + ntfs_log_info(OK); journal_is_empty = TRUE; return 0; } +/** + * fix_mftmirr + */ static int fix_mftmirr(ntfs_volume *vol) { s64 l, br; @@ -308,44 +329,44 @@ static int fix_mftmirr(ntfs_volume *vol) int i, ret = -1; /* failure */ BOOL done; - puts("\nProcessing $MFT and $MFTMirr... "); + ntfs_log_info("\nProcessing $MFT and $MFTMirr...\n"); /* Load data from $MFT and $MFTMirr and compare the contents. */ m = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); if (!m) { - perror("Failed to allocate memory"); + ntfs_log_perror("Failed to allocate memory"); return -1; } m2 = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits); if (!m2) { - perror("Failed to allocate memory"); + ntfs_log_perror("Failed to allocate memory"); free(m); return -1; } - printf("Reading $MFT... "); + ntfs_log_info("Reading $MFT... "); l = ntfs_attr_mst_pread(vol->mft_na, 0, vol->mftmirr_size, vol->mft_record_size, m); if (l != vol->mftmirr_size) { - puts(FAILED); + ntfs_log_info(FAILED); if (l != -1) errno = EIO; - perror("Failed to read $MFT"); + ntfs_log_perror("Failed to read $MFT"); goto error_exit; } - puts(OK); + ntfs_log_info(OK); - printf("Reading $MFTMirr... "); + ntfs_log_info("Reading $MFTMirr... "); l = ntfs_attr_mst_pread(vol->mftmirr_na, 0, vol->mftmirr_size, vol->mft_record_size, m2); if (l != vol->mftmirr_size) { - puts(FAILED); + ntfs_log_info(FAILED); if (l != -1) errno = EIO; - perror("Failed to read $MFTMirr"); + ntfs_log_perror("Failed to read $MFTMirr"); goto error_exit; } - puts(OK); + ntfs_log_info(OK); /* * FIXME: Need to actually check the $MFTMirr for being real. Otherwise @@ -359,7 +380,7 @@ static int fix_mftmirr(ntfs_volume *vol) * MD disk and if yes then bomb out right at the start of the program? */ - printf("Comparing $MFTMirr to $MFT... "); + ntfs_log_info("Comparing $MFTMirr to $MFT... "); done = FALSE; for (i = 0; i < vol->mftmirr_size; ++i) { const char *ESTR[12] = { "$MFT", "$MFTMirr", "$LogFile", @@ -375,22 +396,22 @@ static int fix_mftmirr(ntfs_volume *vol) s = "mft record"; if (ntfs_is_baad_recordp(m + i * vol->mft_record_size)) { - puts("FAILED"); - fprintf(stderr, "$MFT error: Incomplete multi sector " + ntfs_log_info("FAILED"); + ntfs_log_error("$MFT error: Incomplete multi sector " "transfer detected in %s.\nCannot " "handle this yet. )-:\n", s); goto error_exit; } if (!ntfs_is_mft_recordp(m + i * vol->mft_record_size)) { - puts("FAILED"); - fprintf(stderr, "$MFT error: Invalid mft record for " + ntfs_log_info("FAILED"); + ntfs_log_error("$MFT error: Invalid mft record for " "%s.\nCannot handle this yet. )-:\n", s); goto error_exit; } if (ntfs_is_baad_recordp(m2 + i * vol->mft_record_size)) { - puts("FAILED"); - fprintf(stderr, "$MFTMirr error: Incomplete multi " + ntfs_log_info("FAILED"); + ntfs_log_error("$MFTMirr error: Incomplete multi " "sector transfer detected in %s.\n", s); goto error_exit; } @@ -400,20 +421,20 @@ static int fix_mftmirr(ntfs_volume *vol) (u8*)m + i * vol->mft_record_size)))) { if (!done) { done = TRUE; - puts(FAILED); - printf("Correcting differences in $MFTMirr..."); + ntfs_log_info(FAILED); + ntfs_log_info("Correcting differences in $MFTMirr..."); } br = ntfs_mft_record_write(vol, i, (MFT_RECORD*)(m + i * vol->mft_record_size)); if (br) { - puts(FAILED); - perror("Error correcting $MFTMirr"); + ntfs_log_info(FAILED); + ntfs_log_perror("Error correcting $MFTMirr"); goto error_exit; } } } - puts(OK); - printf("Processing of $MFT and $MFTMirr completed successfully.\n"); + ntfs_log_info(OK); + ntfs_log_info("Processing of $MFT and $MFTMirr completed successfully.\n"); ret = 0; error_exit: free(m); @@ -421,26 +442,29 @@ error_exit: return ret; } +/** + * fix_mount + */ static int fix_mount(void) { int ret = -1; /* failure */ ntfs_volume *vol; struct ntfs_device *dev; - printf("Attempting to correct errors... "); + ntfs_log_info("Attempting to correct errors... "); dev = ntfs_device_alloc(opt.volume, 0, &ntfs_device_default_io_ops, NULL); if (!dev) { - puts(FAILED); - perror("Failed to allocate device"); + ntfs_log_info(FAILED); + ntfs_log_perror("Failed to allocate device"); return -1; } vol = ntfs_volume_startup(dev, 0); if (!vol) { - puts(FAILED); - perror("Failed to startup volume"); - fprintf(stderr, "Volume is corrupt. You should run chkdsk.\n"); + ntfs_log_info(FAILED); + ntfs_log_perror("Failed to startup volume"); + ntfs_log_error("Volume is corrupt. You should run chkdsk.\n"); ntfs_device_free(dev); return -1; } @@ -473,41 +497,43 @@ int main(int argc, char **argv) int ret = 1; /* failure */ BOOL force = FALSE; + ntfs_log_set_handler(ntfs_log_handler_outerr); + parse_options(argc, argv); if (!ntfs_check_if_mounted(opt.volume, &mnt_flags)) { if ((mnt_flags & NTFS_MF_MOUNTED) && !(mnt_flags & NTFS_MF_READONLY) && !force) { - fprintf(stderr, "Refusing to operate on read-write " + ntfs_log_error("Refusing to operate on read-write " "mounted device %s.\n", opt.volume); exit(1); } } else - fprintf(stderr, "Failed to determine whether %s is mounted: " - "%s\n", opt.volume, strerror(errno)); + ntfs_log_perror("Failed to determine whether %s is mounted", + opt.volume); /* Attempt a full mount first. */ - printf("Mounting volume... "); + ntfs_log_info("Mounting volume... "); vol = ntfs_mount(opt.volume, 0); if (vol) { - puts(OK); - printf("Processing of $MFT and $MFTMirr completed " + ntfs_log_info(OK); + ntfs_log_info("Processing of $MFT and $MFTMirr completed " "successfully.\n"); } else { - puts(FAILED); + ntfs_log_info(FAILED); if (fix_mount() < 0) exit(1); vol = ntfs_mount(opt.volume, 0); if (!vol) { - perror("Remount failed"); + ntfs_log_perror("Remount failed"); exit(1); } } /* Check NTFS version is ok for us (in $Volume) */ - printf("NTFS volume version is %i.%i.\n", vol->major_ver, + ntfs_log_info("NTFS volume version is %i.%i.\n", vol->major_ver, vol->minor_ver); if (ntfs_version_is_supported(vol)) { - fprintf(stderr, "Error: Unknown NTFS version.\n"); + ntfs_log_error("Error: Unknown NTFS version.\n"); goto error_exit; } @@ -527,7 +553,7 @@ int main(int argc, char **argv) /* FIXME: Should we be marking the quota out of date, too? */ /* That's all for now! */ - printf("NTFS partition %s was processed successfully.\n", + ntfs_log_info("NTFS partition %s was processed successfully.\n", vol->dev->d_name); /* Set return code to 0. */ ret = 0; diff --git a/ntfsprogs/ntfsmftalloc.c b/ntfsprogs/ntfsmftalloc.c index 155d8706..c10899e9 100644 --- a/ntfsprogs/ntfsmftalloc.c +++ b/ntfsprogs/ntfsmftalloc.c @@ -64,6 +64,7 @@ #include "mft.h" #include "utils.h" #include "version.h" +#include "logging.h" static const char *EXEC_NAME = "ntfsmftalloc"; @@ -88,42 +89,6 @@ static struct { /* -V, print version and exit. */ } opts; -/** - * mkDprintf - debugging output (-vv); overridden by quiet (-q) - */ -__attribute__((format(printf, 1, 2))) -static void mkDprintf(const char *fmt, ...) -{ - va_list ap; - - if (!opts.quiet && opts.verbose > 1) { - printf("DEBUG: "); - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); - } -} - -/** - * Eprintf - error output; ignores quiet (-q) - */ -int Eprintf(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "ERROR: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - return 0; -} - -/* Generate code for Vprintf() function: Verbose output (-v). */ -GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) - -/* Generate code for Qprintf() function: Quietable output (if not -q). */ -GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) - /** * err_exit - error output and terminate; ignores quiet (-q) */ @@ -146,7 +111,7 @@ static void err_exit(const char *fmt, ...) */ static void copyright(void) { - fprintf(stderr, "Copyright (c) 2004-2005 Anton Altaparmakov\n" + ntfs_log_info("Copyright (c) 2004-2005 Anton Altaparmakov\n" "Allocate and initialize a base or an extent mft " "record. If a base mft record\nis not specified, a " "base mft record is allocated and initialized. " @@ -160,7 +125,7 @@ static void copyright(void) */ static void license(void) { - fprintf(stderr, "%s", ntfs_gpl); + ntfs_log_info("%s", ntfs_gpl); } /** @@ -170,7 +135,7 @@ __attribute__((noreturn)) static void usage(void) { copyright(); - fprintf(stderr, "Usage: %s [options] device [base-mft-record]\n" + ntfs_log_info("Usage: %s [options] device [base-mft-record]\n" " -n Do not write to disk\n" " -f Force execution despite errors\n" " -q Quiet execution\n" @@ -179,7 +144,7 @@ static void usage(void) " -V Display version information\n" " -l Display licensing information\n" " -h Display this help\n", EXEC_NAME); - fprintf(stderr, "%s%s", ntfs_bugs, ntfs_home); + ntfs_log_info("%s%s", ntfs_bugs, ntfs_home); exit(1); } @@ -194,9 +159,9 @@ static void parse_options(int argc, char *argv[]) if (argc && *argv) EXEC_NAME = *argv; - fprintf(stderr, "%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, + ntfs_log_info("%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - while ((c = getopt(argc, argv, "fh?nqvVl")) != EOF) + while ((c = getopt(argc, argv, "fh?nqvVl")) != EOF) { switch (c) { case 'f': opts.force = 1; @@ -206,9 +171,11 @@ static void parse_options(int argc, char *argv[]) break; case 'q': opts.quiet = 1; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; case 'V': /* Version number already printed, so just exit. */ @@ -222,11 +189,17 @@ static void parse_options(int argc, char *argv[]) default: usage(); } + } + + if (opts.verbose > 1) + ntfs_log_set_levels(NTFS_LOG_LEVEL_DEBUG | NTFS_LOG_LEVEL_TRACE | + NTFS_LOG_LEVEL_VERBOSE | NTFS_LOG_LEVEL_QUIET); + if (optind == argc) usage(); /* Get the device. */ dev_name = argv[optind++]; - mkDprintf("device name = %s\n", dev_name); + ntfs_log_verbose("device name = %s\n", dev_name); if (optind != argc) { /* Get the base mft record number. */ ll = strtoll(argv[optind++], &s, 0); @@ -234,7 +207,7 @@ static void parse_options(int argc, char *argv[]) err_exit("Invalid base mft record number: %s\n", argv[optind - 1]); base_mft_no = ll; - mkDprintf("base mft record number = 0x%llx\n", (long long)ll); + ntfs_log_verbose("base mft record number = 0x%llx\n", (long long)ll); } if (optind != argc) usage(); @@ -249,46 +222,46 @@ static void dump_mft_record(MFT_RECORD *m) unsigned int u; MFT_REF r; - printf("-- Beginning dump of mft record. --\n"); + ntfs_log_info("-- Beginning dump of mft record. --\n"); u = le32_to_cpu(m->magic); - printf("Mft record signature (magic) = %c%c%c%c\n", u & 0xff, + ntfs_log_info("Mft record signature (magic) = %c%c%c%c\n", u & 0xff, u >> 8 & 0xff, u >> 16 & 0xff, u >> 24 & 0xff); u = le16_to_cpu(m->usa_ofs); - printf("Update sequence array offset = %u (0x%x)\n", u, u); - printf("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); - printf("$LogFile sequence number (lsn) = %llu\n", + ntfs_log_info("Update sequence array offset = %u (0x%x)\n", u, u); + ntfs_log_info("Update sequence array size = %u\n", le16_to_cpu(m->usa_count)); + ntfs_log_info("$LogFile sequence number (lsn) = %llu\n", (unsigned long long)le64_to_cpu(m->lsn)); - printf("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); - printf("Reference (hard link) count = %u\n", + ntfs_log_info("Sequence number = %u\n", le16_to_cpu(m->sequence_number)); + ntfs_log_info("Reference (hard link) count = %u\n", le16_to_cpu(m->link_count)); u = le16_to_cpu(m->attrs_offset); - printf("First attribute offset = %u (0x%x)\n", u, u); - printf("Flags = %u: ", le16_to_cpu(m->flags)); + ntfs_log_info("First attribute offset = %u (0x%x)\n", u, u); + ntfs_log_info("Flags = %u: ", le16_to_cpu(m->flags)); if (m->flags & MFT_RECORD_IN_USE) - printf("MFT_RECORD_IN_USE"); + ntfs_log_info("MFT_RECORD_IN_USE"); else - printf("MFT_RECORD_NOT_IN_USE"); + ntfs_log_info("MFT_RECORD_NOT_IN_USE"); if (m->flags & MFT_RECORD_IS_DIRECTORY) - printf(" | MFT_RECORD_IS_DIRECTORY"); - printf("\n"); + ntfs_log_info(" | MFT_RECORD_IS_DIRECTORY"); + ntfs_log_info("\n"); u = le32_to_cpu(m->bytes_in_use); - printf("Bytes in use = %u (0x%x)\n", u, u); + ntfs_log_info("Bytes in use = %u (0x%x)\n", u, u); u = le32_to_cpu(m->bytes_allocated); - printf("Bytes allocated = %u (0x%x)\n", u, u); + ntfs_log_info("Bytes allocated = %u (0x%x)\n", u, u); r = le64_to_cpu(m->base_mft_record); - printf("Base mft record reference:\n\tMft record number = %llu\n\t" + ntfs_log_info("Base mft record reference:\n\tMft record number = %llu\n\t" "Sequence number = %u\n", (unsigned long long)MREF(r), MSEQNO(r)); - printf("Next attribute instance = %u\n", + ntfs_log_info("Next attribute instance = %u\n", le16_to_cpu(m->next_attr_instance)); a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset)); - printf("-- Beginning dump of attributes within mft record. --\n"); + ntfs_log_info("-- Beginning dump of attributes within mft record. --\n"); while ((char*)a < (char*)m + le32_to_cpu(m->bytes_in_use)) { if (a->type == AT_END) break; a = (ATTR_RECORD*)((char*)a + le32_to_cpu(a->length)); }; - printf("-- End of attributes. --\n"); + ntfs_log_info("-- End of attributes. --\n"); } /** @@ -303,13 +276,12 @@ static void ntfsmftalloc_exit(void) ni = base_ni; /* Close the inode. */ if (ni && ntfs_inode_close(ni)) { - fprintf(stderr, "Warning: Failed to close inode 0x%llx: %s\n", - (long long)ni->mft_no, strerror(errno)); + ntfs_log_perror("Warning: Failed to close inode 0x%llx", + (long long)ni->mft_no); } /* Unmount the volume. */ if (ntfs_umount(vol, 0) == -1) - fprintf(stderr, "Warning: Could not umount %s: %s\n", dev_name, - strerror(errno)); + ntfs_log_perror("Warning: Could not umount %s", dev_name); } /** @@ -320,6 +292,8 @@ int main(int argc, char **argv) unsigned long mnt_flags, ul; int err; + ntfs_log_set_handler(ntfs_log_handler_outerr); + /* Initialize opts to zero / required values. */ memset(&opts, 0, sizeof(opts)); /* Parse command line options. */ @@ -327,18 +301,18 @@ int main(int argc, char **argv) utils_set_locale(); /* Make sure the file system is not mounted. */ if (ntfs_check_if_mounted(dev_name, &mnt_flags)) - Eprintf("Failed to determine whether %s is mounted: %s\n", + ntfs_log_error("Failed to determine whether %s is mounted: %s\n", dev_name, strerror(errno)); else if (mnt_flags & NTFS_MF_MOUNTED) { - Eprintf("%s is mounted.\n", dev_name); + ntfs_log_error("%s is mounted.\n", dev_name); if (!opts.force) err_exit("Refusing to run!\n"); - fprintf(stderr, "ntfsmftalloc forced anyway. Hope /etc/mtab " + ntfs_log_error("ntfsmftalloc forced anyway. Hope /etc/mtab " "is incorrect.\n"); } /* Mount the device. */ if (opts.no_action) { - Qprintf("Running in READ-ONLY mode!\n"); + ntfs_log_quiet("Running in READ-ONLY mode!\n"); ul = MS_RDONLY; } else ul = 0; @@ -348,7 +322,7 @@ int main(int argc, char **argv) /* Register our exit function which will unlock and close the device. */ err = atexit(&ntfsmftalloc_exit); if (err == -1) { - Eprintf("Could not set up exit() function because atexit() " + ntfs_log_error("Could not set up exit() function because atexit() " "failed: %s Aborting...\n", strerror(errno)); ntfsmftalloc_exit(); exit(1); @@ -365,14 +339,14 @@ int main(int argc, char **argv) if (!ni) err_exit("Failed to allocate mft record: %s\n", strerror(errno)); - printf("Allocated %s mft record 0x%llx", base_ni ? "extent" : "base", + ntfs_log_info("Allocated %s mft record 0x%llx", base_ni ? "extent" : "base", (long long)ni->mft_no); if (base_ni) - printf(" with base mft record 0x%llx", + ntfs_log_info(" with base mft record 0x%llx", (long long)base_mft_no); - printf(".\n"); + ntfs_log_info(".\n"); if (!opts.quiet && opts.verbose > 1) { - mkDprintf("Dumping allocated mft record 0x%llx:\n", + ntfs_log_verbose("Dumping allocated mft record 0x%llx:\n", (long long)ni->mft_no); dump_mft_record(ni->mrec); } @@ -388,9 +362,8 @@ int main(int argc, char **argv) /* Disable our ntfsmftalloc_exit() handler. */ success = TRUE; if (err == -1) - fprintf(stderr, "Warning: Failed to umount %s: %s\n", dev_name, - strerror(errno)); + ntfs_log_perror("Warning: Failed to umount %s", dev_name); else - Qprintf("ntfsmftalloc completed successfully.\n"); + ntfs_log_quiet("ntfsmftalloc completed successfully.\n"); return 0; } diff --git a/ntfsprogs/ntfsrm.c b/ntfsprogs/ntfsrm.c index db5f93a3..b5e853d8 100644 --- a/ntfsprogs/ntfsrm.c +++ b/ntfsprogs/ntfsrm.c @@ -66,10 +66,10 @@ static const char *space_line = " */ static void version(void) { - printf("\n%s v%s (libntfs %s) - Delete files from an NTFS volume.\n\n", + ntfs_log_info("\n%s v%s (libntfs %s) - Delete files from an NTFS volume.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - printf("Copyright (c) 2004 Richard Russon\n"); - printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + ntfs_log_info("Copyright (c) 2004 Richard Russon\n"); + ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -81,7 +81,7 @@ static void version(void) */ static void usage(void) { - printf("\nUsage: %s [options] device file\n" + ntfs_log_info("\nUsage: %s [options] device file\n" "\n" " -r --recursive Delete files in subdirectories\n" " -i --interactive Ask before deleting files\n" @@ -96,7 +96,7 @@ static void usage(void) " -V --version Version information\n" " -v --verbose More output\n\n", EXEC_NAME); - printf("%s%s\n", ntfs_bugs, ntfs_home); + ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -130,6 +130,7 @@ static int parse_options(int argc, char **argv) int err = 0; int ver = 0; int help = 0; + int levels = 0; opterr = 0; /* We'll handle the errors, thank you. */ @@ -154,6 +155,11 @@ static int parse_options(int argc, char **argv) break; case 'h': case '?': + if (strncmp (argv[optind-1], "--log-", 6) == 0) { + if (!ntfs_log_parse_option (argv[optind-1])) + err++; + break; + } help++; break; case 'i': @@ -164,6 +170,7 @@ static int parse_options(int argc, char **argv) break; case 'q': opts.quiet++; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 'R': case 'r': @@ -174,6 +181,7 @@ static int parse_options(int argc, char **argv) break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; default: ntfs_log_error("Unknown option '%s'.\n", argv[optind-1]); @@ -182,6 +190,13 @@ static int parse_options(int argc, char **argv) } } + /* Make sure we're in sync with the log levels */ + levels = ntfs_log_get_levels(); + if (levels & NTFS_LOG_LEVEL_VERBOSE) + opts.verbose++; + if (!(levels & NTFS_LOG_LEVEL_QUIET)) + opts.quiet++; + if (help || ver) { opts.quiet = 0; } else { @@ -217,9 +232,9 @@ static void ntfs_dir_print(struct ntfs_dir *dir, int indent) if (!dir) return; - printf("%.*s%p ", indent, space_line, dir); + ntfs_log_info("%.*s%p ", indent, space_line, dir); ntfs_name_print(dir->name, dir->name_len); - printf("\n"); + ntfs_log_info("\n"); for (i = 0; i < dir->child_count; i++) { ntfs_dir_print(dir->children[i], indent + 4); @@ -237,7 +252,7 @@ static void ntfs_dt_print(struct ntfs_dt *dt, int indent) if (!dt) return; - printf("%.*s%p (%d)\n", indent, space_line, dt, dt->child_count); + ntfs_log_info("%.*s%p (%d)\n", indent, space_line, dt, dt->child_count); for (i = 0; i < dt->child_count; i++) { ntfs_dt_print(dt->sub_nodes[i], indent + 4); @@ -359,32 +374,32 @@ static BOOL utils_pathname_to_inode2(ntfs_volume *vol, struct ntfs_dir *parent, goto close; } - //printf("looking for %s in dir %lld\n", p, MREF(dir->mft_num)); - //printf("dir: index = %p, children = %p, inode = %p, iroot = %p, ialloc = %p, count = %d\n", dir->index, dir->children, dir->inode, dir->iroot, dir->ialloc, dir->child_count); + //ntfs_log_info("looking for %s in dir %lld\n", p, MREF(dir->mft_num)); + //ntfs_log_info("dir: index = %p, children = %p, inode = %p, iroot = %p, ialloc = %p, count = %d\n", dir->index, dir->children, dir->inode, dir->iroot, dir->ialloc, dir->child_count); //if (dir->parent) if (q) { ntfs_log_trace("q\n"); child = ntfs_dir_find2(dir, unicode, len); if (!child) { - printf("can't find %s in %s\n", p, pathname); + ntfs_log_info("can't find %s in %s\n", p, pathname); goto close; } } else { ntfs_log_trace("!q dir->index = %p, %d\n", dir->index, dir->index->data_len); - //printf("file: %s\n", p); + //ntfs_log_info("file: %s\n", p); dt = ntfs_dt_find2(dir->index, unicode, len, &dt_num); if (!dt) { - printf("can't find %s in %s (2)\n", p, pathname); + ntfs_log_info("can't find %s in %s (2)\n", p, pathname); goto close; } ntfs_log_debug("dt = %p, data_len = %d, parent = %p\n", dt, dt->data_len, dt->parent); - //printf("dt's flags = 0x%08x\n", dt->children[dt_num]->key.file_name.file_attributes); + //ntfs_log_info("dt's flags = 0x%08x\n", dt->children[dt_num]->key.file_name.file_attributes); if (dt->children[dt_num]->key.file_name.file_attributes == FILE_ATTR_I30_INDEX_PRESENT) { - //printf("DIR\n"); + //ntfs_log_info("DIR\n"); child = ntfs_dir_create(dir->vol, dt->children[dt_num]->indexed_file); - //printf("child = %p (%lld)\n", child, MREF(dt->children[dt_num]->indexed_file)); + //ntfs_log_info("child = %p (%lld)\n", child, MREF(dt->children[dt_num]->indexed_file)); if (child) { child->index = ntfs_dt_create(child, NULL, -1); ntfs_dir_add(dir, child); @@ -395,14 +410,14 @@ static BOOL utils_pathname_to_inode2(ntfs_volume *vol, struct ntfs_dir *parent, if (dt->inodes[dt_num] == NULL) { dt->inodes[dt_num] = ntfs_inode_open(dir->vol, dt->children[dt_num]->indexed_file); if (!dt->inodes[dt_num]) { - printf("Can't open inode %lld\n", MREF(dt->children[dt_num]->indexed_file)); + ntfs_log_info("Can't open inode %lld\n", MREF(dt->children[dt_num]->indexed_file)); goto close; } dt->inodes[dt_num]->ref_count = 2; dt->inodes[dt_num]->private_data = dt; } - //printf("dt = %p,%d\n", dt, dt_num); + //ntfs_log_info("dt = %p,%d\n", dt, dt_num); break; } @@ -419,7 +434,7 @@ static BOOL utils_pathname_to_inode2(ntfs_volume *vol, struct ntfs_dir *parent, found->inode = dt->inodes[dt_num]; found->mref = found->inode->mft_no; result = TRUE; - //printf("dir %p, dt %p, num %d, ino %p, %lld\n", dir, dt, dt_num, dt->inodes[dt_num], MREF(found->inode->mft_no)); + //ntfs_log_info("dir %p, dt %p, num %d, ino %p, %lld\n", dir, dt, dt_num, dt->inodes[dt_num], MREF(found->inode->mft_no)); close: free(ascii); // from strdup free(unicode); @@ -440,7 +455,7 @@ static s64 ntfs_mft_find_free_entry(ntfs_volume *vol) ntfs_log_trace ("\n"); recs = vol->mft_na->initialized_size >> vol->mft_record_size_bits; - //printf("mft contains %lld records\n", recs); + //ntfs_log_info("mft contains %lld records\n", recs); for (i = 24; i < recs; i++) { if (utils_mftrec_in_use(vol, i) == 0) return i; @@ -475,7 +490,7 @@ static int ntfs_mft_set_inuse6(ntfs_inode *inode, struct ntfs_bmp *bmp, BOOL inu NInoSetDirty(inode); - printf("Modified: inode %lld MFT_RECORD header\n", inode->mft_no); + ntfs_log_info("Modified: inode %lld MFT_RECORD header\n", inode->mft_no); return 0; } @@ -520,7 +535,7 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) del_ie = del->children[del_num]; //utils_dump_mem(del_ie, 0, del_ie->length, DM_DEFAULTS); - //printf("\n"); + //ntfs_log_info("\n"); /* * If the key is not in a leaf node, then replace it with its successor. @@ -530,38 +545,38 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) /* for (i = 0; i < top->child_count; i++) { par_ie = top->children[i]; - file = &par_ie->key.file_name; printf("\ttop node, key %d: ", i); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); - printf("\tvcn = %lld\n", ntfs_ie_get_vcn(par_ie)); + file = &par_ie->key.file_name; ntfs_log_info("\ttop node, key %d: ", i); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_info("\n"); + ntfs_log_info("\tvcn = %lld\n", ntfs_ie_get_vcn(par_ie)); } */ if (del->header->flags & INDEX_NODE) { - printf("Replace key with its successor:\n"); + ntfs_log_info("Replace key with its successor:\n"); vcn = ntfs_ie_get_vcn(del_ie); - //printf("vcn = %lld\n", vcn); + //ntfs_log_info("vcn = %lld\n", vcn); suc = ntfs_dt_find4(find_dir->index, uname, name_len, &suc_num); - //printf("succ = %p, index = %d\n", suc, suc_num); - //printf("\n"); + //ntfs_log_info("succ = %p, index = %d\n", suc, suc_num); + //ntfs_log_info("\n"); suc_ie = ntfs_ie_copy(suc->children[suc_num]); //utils_dump_mem(suc_ie, 0, suc_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); - //printf("\n"); + //ntfs_log_info("\n"); suc_ie = ntfs_ie_set_vcn(suc_ie, vcn); //utils_dump_mem(suc_ie, 0, suc_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); - //printf("\n"); + //ntfs_log_info("\n"); - file = &del_ie->key.file_name; printf("\trep name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); - file = &suc_ie->key.file_name; printf("\tsuc name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); + file = &del_ie->key.file_name; ntfs_log_info("\trep name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_info("\n"); + file = &suc_ie->key.file_name; ntfs_log_info("\tsuc name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_info("\n"); //utils_dump_mem(del->data, 0, del->data_len, DM_BLUE|DM_GREEN|DM_INDENT); if (ntfs_dt_isroot(del)) res = ntfs_dt_root_replace(del, del_num, del_ie, suc_ie); else res = ntfs_dt_alloc_replace(del, del_num, del_ie, suc_ie); - //printf("\n"); + //ntfs_log_info("\n"); //utils_dump_mem(del->data, 0, del->data_len, DM_BLUE|DM_GREEN|DM_INDENT); ntfs_ie_free(suc_ie); @@ -581,10 +596,10 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) * If this step creates an empty node, we have more to do. */ - printf("\n"); - printf("Delete key:\n"); + ntfs_log_info("\n"); + ntfs_log_info("Delete key:\n"); - file = &del->children[del_num]->key.file_name; printf("\tdel name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); + file = &del->children[del_num]->key.file_name; ntfs_log_info("\tdel name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_info("\n"); //utils_dump_mem(del->data, 0, del->header->index_length+24, DM_BLUE|DM_GREEN|DM_INDENT); // XXX if del->child_count == 2, we could skip this step @@ -593,7 +608,7 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) ntfs_dt_root_remove(del, del_num); else ntfs_dt_alloc_remove(del, del_num); - //printf("\n"); + //ntfs_log_info("\n"); //utils_dump_mem(del->data, 0, del->header->index_length+24, DM_BLUE|DM_GREEN|DM_INDENT); if (del->child_count > 1) // XXX ntfs_dt_empty (dt), ntfs_dt_full (dt, new) @@ -607,8 +622,8 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) */ // find the key nearest the root which has no descendants - printf("\n"); - printf("Find childless parent:\n"); + ntfs_log_info("\n"); + ntfs_log_info("Find childless parent:\n"); #if 0 for (par = del->parent, old = par; par; old = par, par = par->parent) { if (par->child_count > 1) @@ -617,20 +632,20 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) } #endif - printf("del = %p, parent = %p\n", del, del->parent); + ntfs_log_info("del = %p, parent = %p\n", del, del->parent); par = del->parent; par_num = ntfs_dt_find_parent(del); //utils_dump_mem(par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); - printf("par = %p, par->parent = %p, num = %d\n", par, par->parent, par_num); + ntfs_log_info("par = %p, par->parent = %p, num = %d\n", par, par->parent, par_num); par_num = 0; // TEMP if (par) { file = &par->children[par_num]->key.file_name; - printf("\tpar name: "); + ntfs_log_info("\tpar name: "); ntfs_name_print(file->file_name, file->file_name_length); - printf("\n"); + ntfs_log_info("\n"); } if (par == NULL) { @@ -639,35 +654,35 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) } //ntfs_dt_print(top, 0); - printf("\n"); + ntfs_log_info("\n"); //utils_dump_mem(par->data, 0, par->data_len, DM_BLUE|DM_GREEN|DM_INDENT); - //printf("\n"); + //ntfs_log_info("\n"); /* for (i = 0; i < top->child_count; i++) { par_ie = top->children[i]; - file = &par_ie->key.file_name; printf("\ttop node, key %d: ", i); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); - printf("\tvcn = %lld\n", ntfs_ie_get_vcn(par_ie)); + file = &par_ie->key.file_name; ntfs_log_info("\ttop node, key %d: ", i); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_info("\n"); + ntfs_log_info("\tvcn = %lld\n", ntfs_ie_get_vcn(par_ie)); } */ // find if parent has left siblings if (par->children[par_num]->flags & INDEX_ENTRY_END) { - printf("Swap the children of the parent and its left sibling\n"); + ntfs_log_info("Swap the children of the parent and its left sibling\n"); par_ie = par->children[par_num]; vcn = ntfs_ie_get_vcn(par_ie); - //printf("\toffset = %d\n", (u8*)par_ie - par->data); printf("\tflags = %d\n", par_ie->flags); printf("\tvcn = %lld\n", vcn); printf("\tlength = %d\n", par_ie->length); + //ntfs_log_info("\toffset = %d\n", (u8*)par_ie - par->data); ntfs_log_info("\tflags = %d\n", par_ie->flags); ntfs_log_info("\tvcn = %lld\n", vcn); ntfs_log_info("\tlength = %d\n", par_ie->length); //utils_dump_mem(par_ie, 0, par_ie->length, DM_DEFAULTS); - //printf("\n"); + //ntfs_log_info("\n"); - //printf("\toffset = %d\n", (u8*)par_ie - par->data); printf("\tflags = %d\n", par_ie->flags); printf("\tvcn = %lld\n", vcn); printf("\tlength = %d\n", par_ie->length); + //ntfs_log_info("\toffset = %d\n", (u8*)par_ie - par->data); ntfs_log_info("\tflags = %d\n", par_ie->flags); ntfs_log_info("\tvcn = %lld\n", vcn); ntfs_log_info("\tlength = %d\n", par_ie->length); //utils_dump_mem(par_ie, 0, par_ie->length, DM_DEFAULTS); - //printf("\n"); + //ntfs_log_info("\n"); - file = &par->children[par_num] ->key.file_name; printf("\tpar name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); - file = &par->children[par_num-1]->key.file_name; printf("\tsib name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); + file = &par->children[par_num] ->key.file_name; ntfs_log_info("\tpar name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_info("\n"); + file = &par->children[par_num-1]->key.file_name; ntfs_log_info("\tsib name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_info("\n"); old = par->sub_nodes[par_num]; par->sub_nodes[par_num] = par->sub_nodes[par_num-1]; @@ -682,28 +697,28 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) par_num--; if (ntfs_dt_isroot(par)) - printf("Modified: inode %lld, $INDEX_ROOT\n", par->dir->inode->mft_no); + ntfs_log_info("Modified: inode %lld, $INDEX_ROOT\n", par->dir->inode->mft_no); else - printf("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", par->dir->inode->mft_no, par->vcn, par->vcn + (par->dir->index_size>>9) - 1); + ntfs_log_info("Modified: inode %lld, $INDEX_ALLOCATION vcn %lld-%lld\n", par->dir->inode->mft_no, par->vcn, par->vcn + (par->dir->index_size>>9) - 1); } //ntfs_dt_print(top, 0); - //printf("\n"); + //ntfs_log_info("\n"); //utils_dump_mem(par->data, 0, par->data_len, DM_DEFAULTS); // unhook and hold onto the ded dt's - printf("\n"); - printf("Remove parent\n"); + ntfs_log_info("\n"); + ntfs_log_info("Remove parent\n"); - file = &par->children[par_num]->key.file_name; printf("\tpar name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); + file = &par->children[par_num]->key.file_name; ntfs_log_info("\tpar name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_info("\n"); add_ie = ntfs_ie_copy(par->children[par_num]); add_ie = ntfs_ie_remove_vcn(add_ie); if (!add_ie) goto done; - //printf("\n"); + //ntfs_log_info("\n"); //utils_dump_mem(add_ie, 0, add_ie->length, DM_BLUE|DM_GREEN|DM_INDENT); ded = par->sub_nodes[par_num]; @@ -713,44 +728,44 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) #if 0 for (i = 0; i < par->child_count; i++) { par_ie = par->children[i]; - file = &par_ie->key.file_name; printf("\tdel node, key %d: ", i); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); - printf("\tvcn = %lld\n", ntfs_ie_get_vcn(par_ie)); + file = &par_ie->key.file_name; ntfs_log_info("\tdel node, key %d: ", i); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_info("\n"); + ntfs_log_info("\tvcn = %lld\n", ntfs_ie_get_vcn(par_ie)); } #endif #if 1 - //printf("PAR: %p,%d\n", par, par_num); + //ntfs_log_info("PAR: %p,%d\n", par, par_num); if (ntfs_dt_isroot(par)) ntfs_dt_root_remove(par, par_num); else ntfs_dt_alloc_remove(par, par_num); #endif - //printf("count = %d\n", par->child_count); + //ntfs_log_info("count = %d\n", par->child_count); //utils_dump_mem(par->data, 0, par->data_len, DM_DEFAULTS); - //printf("0x%x\n", (u8*)par->children[0] - par->data); + //ntfs_log_info("0x%x\n", (u8*)par->children[0] - par->data); #if 0 for (i = 0; i < par->child_count; i++) { par_ie = par->children[i]; - file = &par_ie->key.file_name; printf("\tadd node, key %d: ", i); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); - printf("\tvcn = %lld\n", ntfs_ie_get_vcn(par_ie)); + file = &par_ie->key.file_name; ntfs_log_info("\tadd node, key %d: ", i); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_info("\n"); + ntfs_log_info("\tvcn = %lld\n", ntfs_ie_get_vcn(par_ie)); } #endif //ntfs_dt_print(top, 0); - printf("\n"); - printf("Add childless parent\n"); + ntfs_log_info("\n"); + ntfs_log_info("Add childless parent\n"); - file = &add_ie->key.file_name; printf("\tadd name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); + file = &add_ie->key.file_name; ntfs_log_info("\tadd name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_info("\n"); suc = NULL; suc_num = -1; suc = ntfs_dt_find4(top, file->file_name, file->file_name_length, &suc_num); - //printf("SUC: %p, %d\n", suc, suc_num); + //ntfs_log_info("SUC: %p, %d\n", suc, suc_num); if (!suc) goto done; - file = &suc->children[suc_num]->key.file_name; printf("\tsuc name: "); ntfs_name_print(file->file_name, file->file_name_length); printf("\n"); + file = &suc->children[suc_num]->key.file_name; ntfs_log_info("\tsuc name: "); ntfs_name_print(file->file_name, file->file_name_length); ntfs_log_info("\n"); // insert key into successor // if any new nodes are needed, reuse the preserved nodes @@ -766,14 +781,14 @@ static int ntfs_file_remove(ntfs_volume *vol, struct ntfs_dt *del, int del_num) // XXX reduce size of alloc // XXX if ded, don't write it back, just update bitmap - printf("empty\n"); + ntfs_log_info("empty\n"); goto done; freedts: - printf("\twhole dir is empty\n"); + ntfs_log_info("\twhole dir is empty\n"); commit: - //printf("commit\n"); + //ntfs_log_info("commit\n"); done: return 0; @@ -813,8 +828,8 @@ static int ntfs_file_remove2(ntfs_volume *vol, struct ntfs_dt *dt, int dt_num) if (0) ntfs_volume_rollback(vol); - if (0) printf("last mft = %lld\n", ntfs_bmp_find_last_set(bmp_mft)); - if (0) printf("last vol = %lld\n", ntfs_bmp_find_last_set(bmp_vol)); + if (0) ntfs_log_info("last mft = %lld\n", ntfs_bmp_find_last_set(bmp_mft)); + if (0) ntfs_log_info("last vol = %lld\n", ntfs_bmp_find_last_set(bmp_vol)); return 0; } @@ -855,9 +870,9 @@ static int ntfs_file_add2(ntfs_volume *vol, char *filename) filename = ptr + 1; } - printf("looking for %s\n", dirname); + ntfs_log_info("looking for %s\n", dirname); if (utils_pathname_to_inode2(vol, NULL, dirname, &find) == FALSE) { - printf("!inode\n"); + ntfs_log_info("!inode\n"); return 0; } @@ -868,10 +883,10 @@ static int ntfs_file_add2(ntfs_volume *vol, char *filename) if (uname_len < 0) goto close; - printf("new inode %lld\n", new_num); + ntfs_log_info("new inode %lld\n", new_num); ino = ntfs_inode_open3(vol, new_num); if (!ino) { - printf("!ino\n"); + ntfs_log_info("!ino\n"); goto close; } @@ -936,7 +951,7 @@ static int ntfs_file_add2(ntfs_volume *vol, char *filename) ie = ntfs_ie_create(); ie = ntfs_ie_set_name(ie, uname, uname_len, FILE_NAME_POSIX); if (!ie) { - printf("!ie\n"); + ntfs_log_info("!ie\n"); goto close; } @@ -1005,10 +1020,10 @@ int main(int argc, char *argv[]) utils_set_locale(); #if 0 - printf("sizeof(ntfs_bmp) = %d\n", sizeof(struct ntfs_bmp)); - printf("sizeof(ntfs_dt) = %d\n", sizeof(struct ntfs_dt)); - printf("sizeof(ntfs_dir) = %d\n", sizeof(struct ntfs_dir)); - printf("\n"); + ntfs_log_info("sizeof(ntfs_bmp) = %d\n", sizeof(struct ntfs_bmp)); + ntfs_log_info("sizeof(ntfs_dt) = %d\n", sizeof(struct ntfs_dt)); + ntfs_log_info("sizeof(ntfs_dir) = %d\n", sizeof(struct ntfs_dir)); + ntfs_log_info("\n"); #endif if (opts.noaction) @@ -1018,20 +1033,20 @@ int main(int argc, char *argv[]) //ntfs_log_set_levels (NTFS_LOG_LEVEL_DEBUG); vol = ntfs_volume_mount2(opts.device, flags, opts.force); if (!vol) { - printf("!vol\n"); + ntfs_log_info("!vol\n"); goto done; } #if 0 if (utils_pathname_to_inode2(vol, NULL, opts.file, &find) == FALSE) { - printf("!inode\n"); + ntfs_log_info("!inode\n"); goto done; } inode = find.inode; #endif - //printf("inode = %lld\n", inode->mft_no); + //ntfs_log_info("inode = %lld\n", inode->mft_no); if (0) result = ntfs_file_remove2(vol, find.dt, find.dt_index); if (1) result = ntfs_file_add2(vol, opts.file); diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c index 04530913..531c366f 100644 --- a/ntfsprogs/ntfstruncate.c +++ b/ntfsprogs/ntfstruncate.c @@ -66,6 +66,7 @@ #include "utils.h" #include "attrdef.h" #include "version.h" +#include "logging.h" const char *EXEC_NAME = "ntfstruncate"; @@ -96,42 +97,6 @@ struct { /* -V, print version and exit. */ } opts; -/** - * mkDprintf - debugging output (-vv); overridden by quiet (-q) - */ -__attribute__((format(printf, 1, 2))) -static void mkDprintf(const char *fmt, ...) -{ - va_list ap; - - if (!opts.quiet && opts.verbose > 1) { - printf("DEBUG: "); - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); - } -} - -/** - * Eprintf - error output; ignores quiet (-q) - */ -int Eprintf(const char *fmt, ...) -{ - va_list ap; - - fprintf(stderr, "ERROR: "); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - return 0; -} - -/* Generate code for Vprintf() function: Verbose output (-v). */ -GEN_PRINTF(Vprintf, stdout, &opts.verbose, TRUE) - -/* Generate code for Qprintf() function: Quietable output (if not -q). */ -GEN_PRINTF(Qprintf, stdout, &opts.quiet, FALSE) - /** * err_exit - error output and terminate; ignores quiet (-q) */ @@ -216,9 +181,11 @@ static void parse_options(int argc, char *argv[]) break; case 'q': opts.quiet = 1; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; case 'V': /* Version number already printed, so just exit. */ @@ -235,9 +202,13 @@ static void parse_options(int argc, char *argv[]) if (optind == argc) usage(); + if (opts.verbose > 1) + ntfs_log_set_levels(NTFS_LOG_LEVEL_DEBUG | NTFS_LOG_LEVEL_TRACE | + NTFS_LOG_LEVEL_VERBOSE | NTFS_LOG_LEVEL_QUIET); + /* Get the device. */ dev_name = argv[optind++]; - mkDprintf("device name = %s\n", dev_name); + ntfs_log_verbose("device name = %s\n", dev_name); if (optind == argc) usage(); @@ -247,7 +218,7 @@ static void parse_options(int argc, char *argv[]) if (*s || !ll || (ll >= LLONG_MAX && errno == ERANGE)) err_exit("Invalid inode number: %s\n", argv[optind - 1]); inode = ll; - mkDprintf("inode = %lli\n", (long long)inode); + ntfs_log_verbose("inode = %lli\n", (long long)inode); if (optind == argc) usage(); @@ -287,11 +258,11 @@ static void parse_options(int argc, char *argv[]) attr_name_len = 0; } } - mkDprintf("attribute type = 0x%x\n", (unsigned int)attr_type); + ntfs_log_verbose("attribute type = 0x%x\n", (unsigned int)attr_type); if (attr_name == AT_UNNAMED) - mkDprintf("attribute name = \"\" (UNNAMED)\n"); + ntfs_log_verbose("attribute name = \"\" (UNNAMED)\n"); else - mkDprintf("attribute name = \"%s\" (length %u Unicode " + ntfs_log_verbose("attribute name = \"%s\" (length %u Unicode " "characters)\n", s2, (unsigned int)attr_name_len); @@ -300,7 +271,7 @@ static void parse_options(int argc, char *argv[]) if (*s2 || ll < 0 || (ll >= LLONG_MAX && errno == ERANGE)) err_exit("Invalid new length: %s\n", s); new_len = ll; - mkDprintf("new length = %lli\n", new_len); + ntfs_log_verbose("new length = %lli\n", new_len); } /** @@ -580,7 +551,7 @@ static void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) // printf("name = %c%c%c%c%c\n", *p, p[1], p[2], p[3], p[4]); // } if (ucstos(s, attr_defs[i].name, sizeof(s)) == -1) { - Eprintf("Could not convert Unicode string to single " + ntfs_log_error("Could not convert Unicode string to single " "byte string in current locale.\n"); strncpy(s, "Error converting Unicode string", sizeof(s)); @@ -600,7 +571,7 @@ static void dump_attr_record(MFT_RECORD *m, ATTR_RECORD *a) cpu_to_le16(a->name_offset)), min((int)sizeof(s), a->name_length + 1)) == -1) { - Eprintf("Could not convert Unicode string to single " + ntfs_log_error("Could not convert Unicode string to single " "byte string in current locale.\n"); strncpy(s, "Error converting Unicode string", sizeof(s)); @@ -717,14 +688,13 @@ static void ntfstruncate_exit(void) ntfs_attr_close(na); /* Close the inode. */ if (ni && ntfs_inode_close(ni)) { - fprintf(stderr, "Warning: Failed to close inode %lli: %s\n", - (long long)inode, strerror(errno)); + ntfs_log_perror("Warning: Failed to close inode %lli", + (long long)inode); } /* Unmount the volume. */ err = ntfs_umount(vol, 0); if (err == -1) - fprintf(stderr, "Warning: Could not umount %s: %s\n", dev_name, - strerror(errno)); + ntfs_log_perror("Warning: Could not umount %s", dev_name); /* Free the attribute name if it exists. */ if (attr_name && attr_name != AT_UNNAMED) free(attr_name); @@ -738,6 +708,8 @@ int main(int argc, char **argv) unsigned long mnt_flags, ul; int err; + ntfs_log_set_handler(ntfs_log_handler_outerr); + /* Initialize opts to zero / required values. */ memset(&opts, 0, sizeof(opts)); @@ -754,10 +726,10 @@ int main(int argc, char **argv) /* Make sure the file system is not mounted. */ if (ntfs_check_if_mounted(dev_name, &mnt_flags)) - Eprintf("Failed to determine whether %s is mounted: %s\n", - dev_name, strerror(errno)); + ntfs_log_perror("Failed to determine whether %s is mounted", + dev_name); else if (mnt_flags & NTFS_MF_MOUNTED) { - Eprintf("%s is mounted.\n", dev_name); + ntfs_log_error("%s is mounted.\n", dev_name); if (!opts.force) err_exit("Refusing to run!\n"); fprintf(stderr, "ntfstruncate forced anyway. Hope /etc/mtab " @@ -766,7 +738,7 @@ int main(int argc, char **argv) /* Mount the device. */ if (opts.no_action) { - Qprintf("Running in READ-ONLY mode!\n"); + ntfs_log_quiet("Running in READ-ONLY mode!\n"); ul = MS_RDONLY; } else ul = 0; @@ -777,7 +749,7 @@ int main(int argc, char **argv) /* Register our exit function which will unlock and close the device. */ err = atexit(&ntfstruncate_exit); if (err == -1) { - Eprintf("Could not set up exit() function because atexit() " + ntfs_log_error("Could not set up exit() function because atexit() " "failed: %s Aborting...\n", strerror(errno)); ntfstruncate_exit(); exit(1); @@ -796,7 +768,7 @@ int main(int argc, char **argv) (unsigned int)attr_type, strerror(errno)); if (!opts.quiet && opts.verbose > 1) { - mkDprintf("Dumping mft record before calling " + ntfs_log_verbose("Dumping mft record before calling " "ntfs_attr_truncate():\n"); dump_mft_record(ni->mrec); } @@ -808,7 +780,7 @@ int main(int argc, char **argv) (unsigned int)attr_type, strerror(errno)); if (!opts.quiet && opts.verbose > 1) { - mkDprintf("Dumping mft record after calling " + ntfs_log_verbose("Dumping mft record after calling " "ntfs_attr_truncate():\n"); dump_mft_record(ni->mrec); } @@ -826,8 +798,7 @@ int main(int argc, char **argv) /* Unmount the volume. */ err = ntfs_umount(vol, 0); if (err == -1) - fprintf(stderr, "Warning: Failed to umount %s: %s\n", dev_name, - strerror(errno)); + ntfs_log_perror("Warning: Failed to umount %s", dev_name); /* Free the attribute name if it exists. */ if (attr_name && attr_name != AT_UNNAMED) @@ -836,7 +807,7 @@ int main(int argc, char **argv) /* Finally, disable our ntfstruncate_exit() handler. */ success = TRUE; - Qprintf("ntfstruncate completed successfully. Have a nice day.\n"); + ntfs_log_quiet("ntfstruncate completed successfully. Have a nice day.\n"); return 0; } From af6f7606e407c022911a7d6fca1503aa83720c18 Mon Sep 17 00:00:00 2001 From: flatcap Date: Mon, 21 Nov 2005 21:25:14 +0000 Subject: [PATCH 2772/2994] tidy evil roff usage add/document missing options add missing authors standardise program usage() standardise options look update download and contact details --- ntfsprogs/mkntfs.8.in | 273 +++++++++++------------------------- ntfsprogs/mkntfs.c | 3 +- ntfsprogs/ntfscat.8.in | 147 +++++++++---------- ntfsprogs/ntfscat.c | 16 +-- ntfsprogs/ntfsclone.8.in | 165 +++++++++++----------- ntfsprogs/ntfscluster.8.in | 105 ++++++-------- ntfsprogs/ntfscluster.c | 22 +-- ntfsprogs/ntfscp.8.in | 91 +++++++----- ntfsprogs/ntfscp.c | 18 +-- ntfsprogs/ntfsfix.8.in | 86 ++++++++---- ntfsprogs/ntfsinfo.8.in | 94 ++++++++++--- ntfsprogs/ntfsinfo.c | 18 +-- ntfsprogs/ntfslabel.8.in | 88 +++++++++--- ntfsprogs/ntfslabel.c | 12 +- ntfsprogs/ntfsls.8.in | 92 ++++++++---- ntfsprogs/ntfsls.c | 26 ++-- ntfsprogs/ntfsmount.8.in | 152 ++++++++++---------- ntfsprogs/ntfsmount.c | 1 + ntfsprogs/ntfsprogs.8.in | 31 ++-- ntfsprogs/ntfsresize.8.in | 138 ++++++++++-------- ntfsprogs/ntfsundelete.8.in | 190 +++++++++---------------- 21 files changed, 898 insertions(+), 870 deletions(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 806283b2..633f9b75 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -1,21 +1,13 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2001,2002 Anton Altaparmakov. All Rights Reserved. -.\" Copyright (c) 2005 Richard Russon. All Rights Reserved. +.\" Copyright (c) 2001,2002 Anton Altaparmakov. +.\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. -.\" Adapted from e2fsprogs-1.19/misc/mke2fs.8.in by Theodore Ts'o. .\" -.TH MKNTFS 8 "June 2005" "ntfsprogs version @VERSION@" +.TH MKNTFS 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system .SH SYNOPSIS .B mkntfs -[ -.I options -] -.B device -[ -.I number-of-sectors -] +[\fIoptions\fR] \fIdevice \fR[\fInumber\-of\-sectors\fR] .P .B mkntfs [ @@ -23,7 +15,7 @@ mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system ] [ .B \-c -.I cluster-size +.I cluster\-size ] [ .B \-F @@ -43,7 +35,7 @@ mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system ] [ .B \-L -.I volume-label +.I volume\-label ] [ .B \-l @@ -53,7 +45,7 @@ mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system ] [ .B \-p -.I part-start-sect +.I part\-start\-sect ] [ .B \-Q @@ -63,11 +55,11 @@ mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system ] [ .B \-S -.I sectors-per-track +.I sectors\-per\-track ] [ .B \-s -.I sector-size +.I sector\-size ] [ .B \-T @@ -80,18 +72,18 @@ mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system ] [ .B \-w -.I ntfs-version +.I ntfs\-version ] [ .B \-z -.I mft-zone-multiplier +.I mft\-zone\-multiplier ] [ .B \-\-debug ] .I device [ -.I number-of-sectors +.I number\-of\-sectors ] .SH DESCRIPTION .B mkntfs @@ -100,148 +92,93 @@ a disk partition). .I device is the special file corresponding to the device (e.g .IR /dev/hdXX ). -.I number-of-sectors +.I number\-of\-sectors is the number of blocks on the device. If omitted, .B mkntfs automagically figures the file system size. .SH OPTIONS Below is a summary of all the options that .B mkntfs -accepts. Nearly all options have two equivalent names. The short name is preceded by -.BR \- +accepts. Nearly all options have two equivalent names. The short name is +preceded by +.B \- and the long name is preceded by .BR \-\- . Any single letter options, that don't take an argument, can be combined into a single command, e.g. -.BR \-fv +.B \-fv is equivalent to .BR "\-f \-v" . Long named options can be abbreviated to any unique prefix of their name. -.TP - -.BR .SS Basic options -.BR - -.B \-f -.br -.ns .TP -.B \-\-fast -.br -.ns +\fB\-f\fR, \fB\-\-fast\fR, \fB\-Q\fR, \fB\-\-quick\fR +Perform quick (fast) format. This will skip both zeroing of the volume and bad +sector checking. .TP -.B \-Q -.br -.ns -.TP -.B \-\-quick -Perform quick (fast) format. This will skip both zeroing of the volume and bad sector -checking. -.TP - -.BI \-L " STRING" -.br -.ns -.TP -.BI \-\-label " STRING" +\fB\-L\fR, \fB\-\-label\fR STRING Set the volume label for the filesystem. .TP - -.B \-C -.br -.ns -.TP -.B \-\-enable-compression +\fB\-C\fR, \fB\-\-enable\-compression\fR Enable compression on the volume. .TP - -.BI \-c " BYTES" -.br -.ns -.TP -.BI \-\-cluster-size " BYTES" +\fB\-c\fR, \fB\-\-cluster\-size\fR BYTES Specify the size of clusters in bytes. Valid cluster size values are powers of two, with at least 256, and at most 65536 bytes per cluster. If omitted, .B mkntfs -determines the -.I cluster-size +determines the +.I cluster\-size from the volume size. The value is determined as follows: .TS +box; lB lB lB l l r. Volume size Default cluster size -0 - 512MB 512 bytes -512MB - 1GB 1024 bytes -1GB - 2GB 2048 bytes +0 \- 512MB 512 bytes +512MB \- 1GB 1024 bytes +1GB \- 2GB 2048 bytes 2GB + 4096 bytes .TE +.sp +.sp Note that the default cluster size is set to be at least equal to the sector size as a cluster cannot be smaller than a sector. Also, note that values greater than 4096 have the side effect that compression is disabled on the volume (due to limitations in the NTFS compression algorithm currently in use by Windows). .TP - -.B \-I -.br -.ns -.TP -.B \-\-disable-indexing +\fB\-I\fR, \fB\-\-no\-indexing\fR Disable content indexing on the volume. (This is only meaningful on Windows 2000 and later. Windows NT 4.0 and earlier ignore this as they do not implement content indexing at all.) .TP - -.B \-n -.br -.ns -.TP -.B \-\-no-action +\fB\-n\fR, \fB\-\-no\-action\fR Causes .B mkntfs to not actually create a filesystem, but display what it would do if it were to create a filesystem. All steps of the format are carried out except the actual writing to the device. -.TP - -.BR .SS Advanced options -.BR - -.BI \-s " BYTES" -.br -.ns .TP -.BI \-\-sector-size " BYTES" +\fB\-s\fR, \fB\-\-sector\-size\fR BYTES Specify the size of sectors in bytes. Valid sector size values are 256, 512, 1024, 2048 and 4096 bytes per sector. If omitted, .B mkntfs attempts to determine the -.I sector-size +.I sector\-size automatically and if that fails a default of 512 bytes per sector is used. .TP - -.BI \-p " SECTOR" -.br -.ns -.TP -.BI \-\-partition-start " SECTOR -Specify the partition start sector. The maximum is 4294967295 (2^32-1). If +\fB\-p\fR, \fB\-\-partition\-start\fR SECTOR +Specify the partition start sector. The maximum is 4294967295 (2^32\-1). If omitted, .B mkntfs attempts to determine -.I part-start-sect +.I part\-start\-sect automatically and if that fails a default of 0 is used. Note that -.I part-start-sect +.I part\-start\-sect is required for Windows to be able to boot from the created volume. .TP - -.BI \-H " NUM" -.br -.ns -.TP -.BI \-\-heads " NUM" +\fB\-H\fR, \fB\-\-heads\fR NUM Specify the number of heads. The maximum is 65535 (0xffff). If omitted, .B mkntfs attempts to determine the number of @@ -250,27 +187,17 @@ automatically and if that fails a default of 0 is used. Note that .I heads is required for Windows to be able to boot from the created volume. .TP - -.BI \-S " NUM" -.br -.ns -.TP -.BI \-\-sectors-per-track " NUM" +\fB\-S\fR, \fB\-\-sectors\-per\-track\fR NUM Specify the number of sectors per track. The maximum is 65535 (0xffff). If omitted, .B mkntfs attempts to determine the number of -.I sectors-per-track +.I sectors\-per\-track automatically and if that fails a default of 0 is used. Note that -.I sectors-per-track +.I sectors\-per\-track is required for Windows to be able to boot from the created volume. .TP - -.BI \-z " NUM" -.br -.ns -.TP -.BI \-\-mft-zone-multiplier " NUM" +\fB\-z\fR, \fB\-\-mft\-zone\-multiplier\fR NUM Set the MFT zone multiplier, which determines the size of the MFT zone to use on the volume. The MFT zone is the area at the beginning of the volume reserved for the master file table (MFT), which stores the on disk inodes (MFT records). @@ -281,6 +208,7 @@ the MFT zone is resized on the fly as required during operation of the NTFS driver but choosing a good value will reduce fragmentation. Valid values are 1, 2, 3 and 4. The values have the following meaning: .TS +box; lB lB lB lB c l. @@ -291,102 +219,52 @@ multiplier (% of volume size) 3 37.5% 4 50.0% .TE +.sp .TP - -.B \-T -.br -.ns -.TP -.B \-\-zero-time +\fB\-T\fR, \fB\-\-zero\-time\fR Fake the time to be 00:00:00 UTC, Jan 1, 1970 instead of the current system time. This is only really useful for debugging purposes. .TP - -.B \-w STRING -.br -.ns +\fB\-w\fR, \fB\-\-ntfs\-version\fR STRING +Select the version of NTFS you wish to use. This can be one of "1.2", "3.0", +or "3.1". .TP -.B \-\-ntfs-version STRING -Select the version of NTFS you wish to use. This can be one of "1.2", "3.0", or "3.1". -.TP - -.B \-F -.br -.ns -.TP -.B \-\-force +\fB\-F\fR, \fB\-\-force\fR Force .B mkntfs to run, even if the specified .I device is not a block special device, or appears to be mounted. -.TP - -.BR .SS Output options -.BR - -.B \-q -.br -.ns .TP -.B \-\-quiet +\fB\-q\fR, \fB\-\-quiet\fR Quiet execution; only errors are written to stderr, no output to stdout occurs at all. Useful if .B mkntfs is run in a script. .TP - -.B \-v -.br -.ns -.TP -.B \-\-verbose +\fB\-v\fR, \fB\-\-verbose\fR Verbose execution. .TP - -.B \-\-debug +\fB\-\-debug\fR Really verbose execution; includes the verbose output from the .B \-v option as well as additional output useful for debugging .B mkntfs. -.TP - -.BR .SS Help options -.BR - -.B \-V -.br -.ns .TP -.B \-\-version +\fB\-V\fR, \fB\-\-version\fR Print the version number of .B mkntfs and exit. .TP - -.B \-l -.br -.ns -.TP -.B \-\-license +\fB\-l\fR, \fB\-\-license\fR Print the licensing information of .B mkntfs and exit. .TP - -.B \-h -.br -.ns -.TP -.B \-\-help -Print the usage information of -.B mkntfs -and exit. -.TP -.BR - +\fB\-h\fR, \fB\-\-help\fR +Show a list of options with a brief description of each one. .SH BUGS .B mkntfs writes the backup boot sector to the last sector of the block @@ -396,7 +274,7 @@ up to and including todays 2.4.18) either only report an even number of sectors when the sector size is below 1024 bytes, which is the case for most hard drives today (512 bytes sector size) or they return the correct number but accessing the last sector fails. Either way, this means that when a partition -has an odd number of 512-byte sectors, the last sector is either not reported +has an odd number of 512\-byte sectors, the last sector is either not reported to us at all or it is not writable by us and hence the created NTFS volume will either have the backup boot sector placed one sector ahead of where it should be or it cannot be written at all. For this reason, @@ -406,20 +284,33 @@ runs automatically and creates a copy of the backup boot sector in the correct location. This also has the benefit of catching any bugs in .B mkntfs as check disk would find any corrupt structures and repair them, as well as -report them. - If you do see any problems reported, please report the messages -to the author. +report them. +.sp +If you find a bug please send an email describing the problem to the +development team: .br -There may be other bugs. Please, report them to the author. -.SH AUTHOR -This version of +.nh +linux\-ntfs\-dev@lists.sourceforge.net +.hy +.SH AUTHORS .B mkntfs -has been written by Anton Altaparmakov (if that fails, use -). +was written by Anton Altaparmakov, Richard Russon and Szabolcs Szakacsits, with +contributions from Erik Sornes. .SH AVAILABILITY .B mkntfs -is part of the ntfsprogs package and is available for download from -http://sourceforge.net/project/showfiles.php?group_id=13956 in source (tar ball -and rpm) and pre-compiled binary (i386 rpm and deb) form. +is part of the +.B ntfsprogs +package and is available from: +.br +.nh +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +The manual pages are available online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man +.hy .SH SEE ALSO .BR badblocks (8), .BR ntfsprogs (8) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 8074b2ca..2879c177 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -222,7 +222,7 @@ static void mkntfs_usage(void) "Basic options:\n" " -f, --fast Perform a quick format\n" " -Q, --quick Perform a quick format\n" - " -L, --label string Set the volume label\n" + " -L, --label STRING Set the volume label\n" " -C, --enable-compression Enable compression on the volume\n" " -c, --cluster-size BYTES Specify the cluster size for the volume\n" " -I, --no-indexing Disable indexing on the volume\n" @@ -248,6 +248,7 @@ static void mkntfs_usage(void) " -l, --license Display licensing information\n" " -h, --help Display this help\n" "\n", basename(EXEC_NAME)); + ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } /** diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in index 038d07e3..dd480eef 100644 --- a/ntfsprogs/ntfscat.8.in +++ b/ntfsprogs/ntfscat.8.in @@ -1,19 +1,14 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2003 Richard Russon. All Rights Reserved. +.\" Copyright (c) 2003\-2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCAT 8 "October 2005" "ntfsprogs version @VERSION@" +.TH NTFSCAT 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME ntfscat \- print NTFS files and streams on the standard output .SH SYNOPSIS -.B ntfscat -[ -.I options -] -.B device file +[\fIoptions\fR] \fIdevice \fR[\fIfile\fR] .SH DESCRIPTION .B ntfscat -will read a file or stream from an NTFS volume and display the contents +will read a file or stream from an NTFS volume and display the contents on the standard output. .PP The case of the filename passed to @@ -22,94 +17,73 @@ is ignored. .SH OPTIONS Below is a summary of all the options that .B ntfscat -accepts. All options have two equivalent names. The short name is preceded by -.BR \- +accepts. Nearly all options have two equivalent names. The short name is +preceded by +.B \- and the long name is preceded by .BR \-\- . Any single letter options, that don't take an argument, can be combined into a single command, e.g. -.BR \-fv +.B \-fv is equivalent to .BR "\-f \-v" . Long named options can be abbreviated to any unique prefix of their name. .TP -.B "\-a " type -.br -.ns -.TP -.B "\-\-attribute " type +\fB\-a\fR, \fB\-\-attribute\fR TYPE Display the contents of a particular attribute type. By default, the unnamed -$DATA attribute will be shown. The attribute can be specified by a number +$DATA attribute will be shown. The attribute can be specified by a number in decimal or hexadecimal, or by name. .TS +box; lB lB lB l l l. Hex Decimal Name -0x10 16 "$STANDARD_INFORMATION", -0x20 32 "$ATTRIBUTE_LIST", -0x30 48 "$FILE_NAME", -0x40 64 "$OBJECT_ID", -0x50 80 "$SECURITY_DESCRIPTOR", -0x60 96 "$VOLUME_NAME", -0x70 112 "$VOLUME_INFORMATION", -0x80 128 "$DATA", -0x90 144 "$INDEX_ROOT", -0xA0 160 "$INDEX_ALLOCATION", -0xB0 176 "$BITMAP", -0xC0 192 "$REPARSE_POINT", -0xD0 208 "$EA_INFORMATION", -0xE0 224 "$EA", -0xF0 240 "$PROPERTY_SET", -0x100 256 "$LOGGED_UTILITY_STREAM", +0x10 16 "$STANDARD_INFORMATION" +0x20 32 "$ATTRIBUTE_LIST" +0x30 48 "$FILE_NAME" +0x40 64 "$OBJECT_ID" +0x50 80 "$SECURITY_DESCRIPTOR" +0x60 96 "$VOLUME_NAME" +0x70 112 "$VOLUME_INFORMATION" +0x80 128 "$DATA" +0x90 144 "$INDEX_ROOT" +0xA0 160 "$INDEX_ALLOCATION" +0xB0 176 "$BITMAP" +0xC0 192 "$REPARSE_POINT" +0xD0 208 "$EA_INFORMATION" +0xE0 224 "$EA" +0xF0 240 "$PROPERTY_SET" +0x100 256 "$LOGGED_UTILITY_STREAM" .TE -.br +.sp +.sp .B Notes -.br The attribute names may be given without the leading $ symbol. .br -If you use the $ symbol, you must escape it from the shell. +If you use the $ symbol, you must quote the name to prevent the shell +interpreting the name. .TP -.B "\-n " name -.br -.ns -.TP -.B "\-\-attribute-name " name +\fB\-n\fR, \fB\-\-attribute\-name\fR NAME Display this named attribute, stream. .TP -.B "\-i " num -.br -.ns -.TP -.B "\-\-inode " num +\fB\-i\fR, \fB\-\-inode\fR NUM Specify a file by its inode number instead of its name. .TP -.B \-h -.br -.ns +\fB\-f\fR, \fB\-\-force\fR +This will override some sensible defaults, such as not using a mounted volume. +Use this option with caution. .TP -.B \-\-help +\fB\-h\fR, \fB\-\-help\fR Show a list of options with a brief description of each one. .TP -.B \-q -.br -.ns -.TP -.B \-\-quiet +\fB\-q\fR, \fB\-\-quiet\fR Suppress some debug/warning/error messages. .TP -.B \-V -.br -.ns -.TP -.B \-\-version +\fB\-V\fR, \fB\-\-version\fR Show the version number, copyright and license .BR ntfscat . .TP -.B \-v -.br -.ns -.TP -.B \-\-verbose +\fB\-v\fR, \fB\-\-verbose\fR Display more debug/warning/error messages. .SH EXAMPLES Display the contents of a file in the root of an NTFS volume. @@ -122,31 +96,42 @@ Display the contents of a file in a subdirectory of an NTFS volume. .RS .sp .B ntfscat /dev/hda1 /winnt/system32/drivers/etc/hosts -.RE .sp +.RE Display the contents of the $INDEX_ROOT attribute of the root directory (inode 5). .RS .sp .B ntfscat /dev/hda1 \-a INDEX_ROOT \-i 5 | hexdump \-C +.sp .RE -.SH KNOWN ISSUES -There are no known problems. If you think you had found any then -please report it to -.nh - -.hy -.SH AUTHOR -.B ntfscat -was written by Richard Russon (FlatCap) -.SH AVAILABILITY -.B ntfscat -is part of the ntfsprogs package and is available from +.SH BUGS +There are no known problems with +.BR ntfscat . +If you find a bug please send an email describing the problem to the +development team: .br .nh -http://linux\-ntfs.sourceforge.net/downloads.html +linux\-ntfs\-dev@lists.sourceforge.net +.hy +.SH AUTHORS +.B ntfscat +was written by Richard Russon, Anton Altaparmakov and Szabolcs Szakacsits. +.SH AVAILABILITY +.B ntfscat +is part of the +.B ntfsprogs +package and is available from: +.br +.nh +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +The manual pages are available online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man .hy .SH SEE ALSO .BR ntfsls (8), .BR ntfsprogs (8) - diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c index ce59a268..f210f64a 100644 --- a/ntfsprogs/ntfscat.c +++ b/ntfsprogs/ntfscat.c @@ -76,14 +76,14 @@ static void version(void) static void usage(void) { ntfs_log_info("\nUsage: %s [options] device [file]\n\n" - " -a, --attribute type Display this attribute type\n" - " -n, --attribute-name name Display this attribute name\n" - " -i, --inode num Display this inode\n\n" - " -f --force Use less caution\n" - " -h --help Print this help\n" - " -q --quiet Less output\n" - " -V --version Version information\n" - " -v --verbose More output\n\n", + " -a, --attribute TYPE Display this attribute type\n" + " -n, --attribute-name NAME Display this attribute name\n" + " -i, --inode NUM Display this inode\n\n" + " -f, --force Use less caution\n" + " -h, --help Print this help\n" + " -q, --quiet Less output\n" + " -V, --version Version information\n" + " -v, --verbose More output\n\n", //" -r --raw Display the compressed or encrypted file", EXEC_NAME); ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index c86fdaff..8c161173 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -1,11 +1,9 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2003 Richard Russon -.\" Copyright (c) 2003-2005 Szabolcs Szakacsits -.\" Copyright (c) 2004 Per Olofsson -.\" All Rights Reserved. +.\" Copyright (c) 2003\-2005 Richard Russon. +.\" Copyright (c) 2003\-2005 Szabolcs Szakacsits. +.\" Copyright (c) 2004 Per Olofsson. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLONE 8 "Sep 2005" "ntfsprogs version @VERSION@" +.TH NTFSCLONE 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME ntfsclone \- Efficiently clone, image, restore or rescue an NTFS .SH SYNOPSIS @@ -13,11 +11,11 @@ ntfsclone \- Efficiently clone, image, restore or rescue an NTFS [\fIOPTIONS\fR] .I SOURCE .br -.B ntfsclone \-\-save-image +.B ntfsclone \-\-save\-image [\fIOPTIONS\fR] .I SOURCE .br -.B ntfsclone \-\-restore-image +.B ntfsclone \-\-restore\-image [\fIOPTIONS\fR] .I SOURCE .br @@ -33,42 +31,40 @@ copies only the used data. Unused disk space becomes zero (cloning to sparse file), encoded with control codes (saving in special image format), left unchanged (cloning to a disk/partition) or filled with zeros (cloning to standard output). - .B ntfsclone can be useful to make backups, an exact snapshot of an NTFS filesystem and restore it later on, or for developers to test NTFS read/write functionality, troubleshoot/investigate users' issues using the clone without the risk of destroying the original filesystem. - -The clone, if not using the special image format, is an exact copy of the original -NTFS filesystem from sector to sector thus it can be also mounted +The clone, if not using the special image format, is an exact copy of the +original NTFS filesystem from sector to sector thus it can be also mounted just like the original NTFS filesystem. For example if you clone to a file and the kernel has loopback device and NTFS support then the file can be mounted as .RS .sp .B mount \-t ntfs \-o loop ntfsclone.img /mnt/ntfsclone -.SH SPARSE FILES -A file is sparse if it has unallocated blocks (holes). The reported size of such -files are always higher than the disk space consumed by them. -The -.BR du +.sp +.RE +.SS Sparse Files +A file is sparse if it has unallocated blocks (holes). The reported size of +such files are always higher than the disk space consumed by them. The +.B du command can tell the real disk space used by a sparse file. The holes are always read as zeros. All major Linux filesystem like, ext2, ext3, reiserfs, Reiser4, JFS and XFS, supports -sparse files but for example the ISO 9600 CD-ROM filesystem doesn't. -.SH HANDLING LARGE SPARSE FILES +sparse files but for example the ISO 9600 CD\-ROM filesystem doesn't. +.SS Handling Large Sparse Files As of today Linux provides inadequate support for managing (tar, cp, gzip, gunzip, bzip2, bunzip2, cat, etc) large sparse files. The only main Linux filesystem having support for efficient sparse file handling is XFS by the XFS_IOC_GETBMAPX -.BR ioctl\fR. +.BR ioctl . However none of the common utilities supports it. This means when you tar, cp, gzip, bzip2, etc a large sparse file they will always read the entire file, even if you use the "sparse support" options. - .BR bzip2 compresses large sparse files much better than .BR gzip @@ -76,8 +72,7 @@ but it does so also much slower. Moreover neither of them handles large sparse files efficiently during uncompression from disk space usage point of view. - -At present the most efficient way, both speed and space-wise, to +At present the most efficient way, both speed and space\-wise, to compress and uncompress large sparse files by common tools is using .BR tar @@ -86,16 +81,16 @@ with the options (handle sparse files "efficiently") and .B \-j (filter the archive through bzip2). Although -.BR tar +.B tar still reads and analyses the entire file, it doesn't pass on the large data blocks having only zeros to filters and it also avoids writing large amount of zeros to the disk needlessly. But since -.BR tar +.B tar can't create an archive from the standard input, you can't do this -in-place by just reading -.BR ntfsclone +in\-place by just reading +.B ntfsclone standard output. -.SH THE SPECIAL IMAGE FORMAT +.SS The Special Image Format It's also possible, actually it's recommended, to save an NTFS filesystem to a special image format. Instead of representing unallocated blocks as holes, they are @@ -105,7 +100,6 @@ filesystem images over the network and similar, and can be used as a replacement for Ghost or Partition Image if it is combined with other tools. The downside is that you can't mount the image directly, you need to restore it first. - To save an image using the special image format, use the .B \-s or the @@ -118,21 +112,19 @@ option. Note that you can restore images from standard input by using '\-' as the .I SOURCE file. -.SH METADATA-ONLY CLONING +.SS Metadata\-only Cloning One of the features of -.BR ntfsclone +.B ntfsclone is that, it can also save only the NTFS metadata using the option .B \-m or .B \-\-metadata and the clone still will be -mountable. In this case all non-metadata file content will be lost and +mountable. In this case all non\-metadata file content will be lost and reading them back will result always zeros. - -The metadata-only image can be compressed very -well, usually to not more than 1-3 MB thus it's relatively easy to transfer +The metadata\-only image can be compressed very +well, usually to not more than 1\-3 MB thus it's relatively easy to transfer for investigation, troubleshooting. - In this mode of ntfsclone, .B NONE of the user's data is saved, including the resident user's data @@ -140,47 +132,50 @@ embedded into metadata. All is filled with zeros. Moreover all the file timestamps, deleted and unused spaces inside the metadata are filled with zeros. Thus this mode is inappropriate for example for forensic analyses. - Please note, filenames are not wiped out. They might contain sensitive information, so think twice before sending such an image to anybody. .SH OPTIONS Below is a summary of all the options that .B ntfsclone -accepts. All options have two equivalent names. The short name is preceded by -.BR \- +accepts. Nearly all options have two equivalent names. The short name is +preceded by +.B \- and the long name is preceded by .BR \-\- . Any single letter options, that don't take an argument, can be combined into a single command, e.g. -.BR \-fm +.B \-fv is equivalent to -.BR "\-f \-m" . +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. .TP -.BI "\-o, \-\-output " FILE -Clone NTFS to the non-existent -.I FILE\fR. If +\fB\-o\fR, \fB\-\-output\fR FILE +Clone NTFS to the non\-existent +.IR FILE . +If .I FILE -is '-' then clone to the +is '\-' then clone to the standard output. .TP -.BI "\-O, \-\-overwrite " FILE +\fB\-O\fR, \fB\-\-overwrite\fR FILE Clone NTFS to -.I FILE\fR, overwriting if exists. +.IR FILE , +overwriting if exists. .TP -.B \-s, \-\-save\-image +\fB\-s\fR, \fB\-\-save\-image\fR Save to the special image format. This is the most efficient way space and -speed-wise if imaging is done to the standard output, e.g. for image +speed\-wise if imaging is done to the standard output, e.g. for image compression, encryption or streaming through a network. .TP -.B \-r, \-\-restore\-image +\fB\-r\fR, \fB\-\-restore\-image\fR Restore from the special image format specified by -.I SOURCE\fR. +.I SOURCE . If the .I SOURCE is '\-' then the image is read from the standard input. .TP -.B \-\-rescue +\fB\-\-rescue\fR Ignore disk read errors so disks having bad sectors, e.g. dying disks, can be rescued the most efficiently way, with minimal stress on them. Ntfsclone works at the lowest, sector level in this mode too thus more data can be rescued. @@ -191,23 +186,23 @@ beginning of such sectors are marked by "BadSectoR\\0". Clone .B ONLY METADATA (for NTFS experts). Moreover only cloning to a file is allowed. -You can't metadata-only clone to a device, image or standard output. +You can't metadata\-only clone to a device, image or standard output. .TP -.B \-\-ignore\-fs\-check +\fB\-\-ignore\-fs\-check\fR Ignore the result of the filesystem consistency check. This option is allowed to be used only with the -.BR --metadata +\fB\-m\fR, \fB\-\-metadata\fR option, for the safety of user's data. The clusters which cause the inconsistency are saved too. .TP -.B \-f, \-\-force +\fB\-f\fR, \fB\-\-force\fR Forces ntfsclone to proceed if the filesystem is marked "dirty" for consistency check. .TP -.B \-h, \-\-help +\fB\-h\fR, \fB\-\-help\fR Show a list of options with a brief description of each one. .SH EXIT CODES -The exit code is 0 on success, non-zero otherwise. +The exit code is 0 on success, non\-zero otherwise. .SH EXAMPLES Save an NTFS to a file in the special image format .RS @@ -218,13 +213,13 @@ Save an NTFS to a file in the special image format Restore an NTFS from a special image file to its original partition .RS .sp -.B ntfsclone \-\-restore-image \-\-overwrite /dev/hda1 backup.img +.B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 backup.img .sp .RE Save an NTFS into a compressed image. .RS .sp -.B ntfsclone \-\-save-image \-o \- /dev/hda1 | gzip \-c > backup.img.gz +.B ntfsclone \-\-save\-image \-o \- /dev/hda1 | gzip \-c > backup.img.gz .sp .RE Restore an NTFS volume from a compressed image file @@ -232,13 +227,13 @@ Restore an NTFS volume from a compressed image file .sp .B gunzip \-c backup.img.gz | \\\\ .br -.B ntfsclone \-\-restore-image \-\-overwrite /dev/hda1 \- +.B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \- .sp .RE Backup an NTFS volume to a remote host, using ssh. .RS .sp -.B ntfsclone \-\-save-image \-\-output \- /dev/hda1 | \\\\ +.B ntfsclone \-\-save\-image \-\-output \- /dev/hda1 | \\\\ .br .B gzip \-c | ssh host 'cat > backup.img.gz' .sp @@ -246,9 +241,9 @@ Backup an NTFS volume to a remote host, using ssh. Restore an NTFS volume from a remote host via ssh. .RS .sp -.B ssh host 'cat backup.img.gz' | gunzip -c | \\\\ +.B ssh host 'cat backup.img.gz' | gunzip \-c | \\\\ .br -.B ntfsclone \-\-restore-image \-\-overwrite /dev/hda1 \- +.B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \- .sp .RE Stream an image from a web server and restore it to a partition @@ -259,10 +254,10 @@ Stream an image from a web server and restore it to a partition .B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \- .sp .RE -Clone an NTFS volume to a non-existent file +Clone an NTFS volume to a non\-existent file .RS .sp -.B ntfsclone \-\-output ntfs-clone.img /dev/hda1 +.B ntfsclone \-\-output ntfs\-clone.img /dev/hda1 .sp .RE Pack NTFS metadata for NTFS experts @@ -271,30 +266,43 @@ Pack NTFS metadata for NTFS experts .B ntfsclone \-\-metadata \-\-output ntfsmeta.img /dev/hda1 .br .B tar \-cjSf ntfsmeta.img.tar.bz2 ntfsmeta.img -.SH KNOWN ISSUES -This program has no known bugs. If you think you have found one then -please send an email to +.sp +.RE +.SH BUGS +There are no known problems with +.BR ntfsclone . +If you find a bug please send an email describing the problem to the +development team: +.br .nh -. - +linux\-ntfs\-dev@lists.sourceforge.net +.hy +.sp Sometimes it might appear ntfsclone froze if the clone is on ReiserFS -and even CTRL-C won't stop it. This is not a bug in ntfsclone, however +and even CTRL\-C won't stop it. This is not a bug in ntfsclone, however it's due to ReiserFS being extremely inefficient creating large sparse files and not handling signals during this operation. This ReiserFS problem was improved in kernel 2.4.22. XFS, JFS and ext3 don't have this problem. .hy -.SH AUTHOR +.SH AUTHORS .B ntfsclone -was written by Szabolcs Szakacsits . - -Special image format support was added by Per Olofsson . +was written by Szabolcs Szakacsits and Anton Altaparmakov, with contributions +from Per Olofsson. .SH AVAILABILITY .B ntfsclone -is part of the ntfsprogs package and is available from +is part of the +.B ntfsprogs +package and is available from: .br .nh -http://linux\-ntfs.sourceforge.net/downloads.html +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +The manual pages are available online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man .hy .SH SEE ALSO .BR ntfsresize (8) @@ -302,4 +310,3 @@ http://linux\-ntfs.sourceforge.net/downloads.html .BR xfs_copy (8) .BR debugreiserfs (8) .BR e2image (8) - diff --git a/ntfsprogs/ntfscluster.8.in b/ntfsprogs/ntfscluster.8.in index 763e7b47..629e8779 100644 --- a/ntfsprogs/ntfscluster.8.in +++ b/ntfsprogs/ntfscluster.8.in @@ -1,15 +1,12 @@ -.\" Copyright (c) 2003 Richard Russon. All Rights Reserved. +.\" Copyright (c) 2003\-2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLUSTER 8 "September 2003" "ntfsprogs version @VERSION@" +.TH NTFSCLUSTER 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME ntfscluster \- identify files in a specified region of an NTFS volume. .SH SYNOPSIS .B ntfscluster -[ -.I options -] -.B device +[\fIoptions\fR] \fIdevice\fR .SH DESCRIPTION .B ntfscluster has three modes of operation: @@ -21,8 +18,8 @@ and .PP The default mode, .I info -is currently not implemented. It will display general information about the NTFS -volume when it is working. +is currently not implemented. It will display general information about the +NTFS volume when it is working. .SS Sector .PP The @@ -39,72 +36,51 @@ mode of operation. .SH OPTIONS Below is a summary of all the options that .B ntfscluster -accepts. All options have two equivalent names. The short name is preceded by -.BR \- +accepts. Nearly all options have two equivalent names. The short name is +preceded by +.B \- and the long name is preceded by .BR \-\- . Any single letter options, that don't take an argument, can be combined into a single command, e.g. -.BR \-fv +.B \-fv is equivalent to .BR "\-f \-v" . Long named options can be abbreviated to any unique prefix of their name. .TP -.BI "\-c " range -.br -.ns -.TP -.BI "\-\-cluster " range +\fB\-c\fR, \fB\-\-cluster\fR RANGE Any files whose data is in this range of clusters will be displayed. .TP -.B \-f -.br -.ns +\fB\-F\fR, \fB\-\-filename\fR NAME +Show information about this file. .TP -.B \-\-force +\fB\-f\fR, \fB\-\-force\fR This will override some sensible defaults, such as not working with a mounted volume. Use this option with caution. .TP -.B \-\-help +\fB\-h\fR, \fB\-\-help\fR Show a list of options with a brief description of each one. .TP -.B \-i -.br -.ns +\fB\-I\fR, \fB\-\-inode\fR NUM +Show information about this inode. .TP -.B \-\-info +\fB\-i\fR, \fB\-\-info\fR This option is not yet implemented. .TP -.BI \-q -.br -.ns -.TP -.BI \-\-quiet +\fB\-q\fR, \fB\-\-quiet\fR Reduce the amount of output to a minimum. Naturally, it doesn't make sense to combine this option with .TP -.B \-s -.br -.ns -.TP -.B \-\-sector +\fB\-s\fR, \fB\-\-sector\fR RANGE Any files whose data is in this range of sectors will be displayed. .TP -.B \-v -.br -.ns -.TP -.B \-\-verbose +\fB\-v\fR, \fB\-\-verbose\fR Increase the amount of output that .B ntfscluster prints. .TP -.B \-V -.br -.ns -.TP -.B \-\-version -Show the version number, copyright and license +\fB\-V\fR, \fB\-\-version\fR +Show the version number, copyright and license for .BR ntfscluster . .SH EXAMPLES Get some information about the volume /dev/hda1. @@ -116,27 +92,38 @@ Get some information about the volume /dev/hda1. Look for files in the first 500 clusters of /dev/hda1. .RS .sp -.B ntfscluster -c 0-500 /dev/hda1 +.B ntfscluster \-c 0\-500 /dev/hda1 .sp +.RE .SH BUGS The .I info -mode isn't implemented yet. This program is quite limited, but it has no known -bugs. If you find one, please send an email to -.nh - -.hy -.SH AUTHOR +mode isn't implemented yet. .B ntfscluster -was written by Richard Russon (FlatCap) -.SH AVAILABILITY -.B ntfscluster -is part of the ntfsprogs package and is available from +is quite limited, but it has no known bugs. If you find a bug please send an +email describing the problem to the development team: .br .nh -http://linux\-ntfs.sourceforge.net/downloads.html +linux\-ntfs\-dev@lists.sourceforge.net +.hy +.SH AUTHORS +.B ntfscluster +was written by Richard Russon, with contributions from Anton Altaparmakov. +.SH AVAILABILITY +.B ntfscluster +is part of the +.B ntfsprogs +package and is available from: +.br +.nh +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +The manual pages are available online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man .hy .SH SEE ALSO .BR ntfsinfo (8), .BR ntfsprogs (8) - diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c index 28ebe8e6..be51b1c9 100644 --- a/ntfsprogs/ntfscluster.c +++ b/ntfsprogs/ntfscluster.c @@ -80,19 +80,19 @@ static void version(void) static void usage(void) { ntfs_log_info("\nUsage: %s [options] device\n" - " -i --info Print information about the volume (default)\n" + " -i, --info Print information about the volume (default)\n" "\n" - " -c range --cluster range Look for objects in this range of clusters\n" - " -s range --sector range Look for objects in this range of sectors\n" - " -I num --inode num Show information about this inode\n" - " -F name --filename name Show information about this file\n" - /* " -l --last Find the last file on the volume\n" */ + " -c, --cluster RANGE Look for objects in this range of clusters\n" + " -s, --sector RANGE Look for objects in this range of sectors\n" + " -I, --inode NUM Show information about this inode\n" + " -F, --filename NAME Show information about this file\n" + /* " -l, --last Find the last file on the volume\n" */ "\n" - " -f --force Use less caution\n" - " -q --quiet Less output\n" - " -v --verbose More output\n" - " -V --version Version information\n" - " -h --help Print this help\n\n", + " -f, --force Use less caution\n" + " -q, --quiet Less output\n" + " -v, --verbose More output\n" + " -V, --version Version information\n" + " -h, --help Print this help\n\n", EXEC_NAME); ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in index c5cfa393..7ae6230a 100644 --- a/ntfsprogs/ntfscp.8.in +++ b/ntfsprogs/ntfscp.8.in @@ -1,12 +1,13 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2004-2005 Yura Pakhuchiy. All Rights Reserved. +.\" Copyright (c) 2004\-2005 Yura Pakhuchiy. +.\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCP 8 "October 2005" "ntfsprogs version @VERSION@" +.TH NTFSCP 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME ntfscp \- overwrite file on an NTFS volume. .SH SYNOPSIS -.BI "ntfscp [" options "] device source_file destination" +.B ntfscp +[\fIoptions\fR] \fIdevice source_file destination\fR .SH DESCRIPTION .B ntfscp will overwrite file on an NTFS volume. At present @@ -19,89 +20,109 @@ is directory specified by name then .B source_file is copied into this directory, in case if .B destination -is directory and specified by inode number then unnamed data attribute is created for this inode and +is directory and specified by inode number then unnamed data attribute is +created for this inode and .B source_file -is copied into it (WARNING: it's unusual to have unnamed data streams in the directories, think twice before specifying directory by inode number). +is copied into it (WARNING: it's unusual to have unnamed data streams in the +directories, think twice before specifying directory by inode number). .SH OPTIONS Below is a summary of all the options that .B ntfscp -accepts. All options have two equivalent names. The short name is preceded by -.BR \- +accepts. Nearly all options have two equivalent names. The short name is +preceded by +.B \- and the long name is preceded by .BR \-\- . Any single letter options, that don't take an argument, can be combined into a single command, e.g. -.BR \-fv +.B \-fv is equivalent to .BR "\-f \-v" . Long named options can be abbreviated to any unique prefix of their name. .TP -.BI "\-a, \-\-attribute " number +\fB\-a\fR, \fB\-\-attribute\fR NUM Write to this attribute. .TP -.B \-i, \-\-inode +\fB\-i\fR, \fB\-\-inode\fR Treat .I destination as inode number. .TP -.BI "\-N, \-\-attr-name " name +\fB\-N\fR, \fB\-\-attr\-name\fR NAME Write to attribute with this name. .TP -.B -n, --no-action +\fB\-n\fR, \fB\-\-no\-action\fR Use this option to make a test run before doing the real copy operation. -Volume will be opened read-only and no write will be done. +Volume will be opened read\-only and no write will be done. .TP -.B \-f, \-\-force +\fB\-f\fR, \fB\-\-force\fR This will override some sensible defaults, such as not working with a mounted volume. Use this option with caution. .TP -.B \-h, \-\-help +\fB\-h\fR, \fB\-\-help\fR Show a list of options with a brief description of each one. .TP -.B \-q, \-\-quiet +\fB\-q\fR, \fB\-\-quiet\fR Suppress some debug/warning/error messages. .TP -.B \-V, \-\-version +\fB\-V\fR, \fB\-\-version\fR Show the version number, copyright and license .BR ntfscp . .TP -.B \-v, \-\-verbose +\fB\-v\fR, \fB\-\-verbose\fR Display more debug/warning/error messages. .SH DATA STREAMS -All data on NTFS is stored in streams, which can have names. A file can have more than one data streams, but exactly one must have no name. The size of a file is the size of its unnamed data stream. Usually when you don't specify stream name you are access to unnamed data stream. If you want access to named data stream you need to add ":stream_name" to the filename. For example: by opening "some.mp3:artist" you will open stream "artist" in "some.mp3". But windows usually prevent you from accessing to named data streams, so you need to use some program like FAR or utils from cygwin to access named data streams. +All data on NTFS is stored in streams, which can have names. A file can have +more than one data streams, but exactly one must have no name. The size of a +file is the size of its unnamed data stream. Usually when you don't specify +stream name you are access to unnamed data stream. If you want access to named +data stream you need to add ":stream_name" to the filename. For example: by +opening "some.mp3:artist" you will open stream "artist" in "some.mp3". But +windows usually prevent you from accessing to named data streams, so you need +to use some program like FAR or utils from cygwin to access named data streams. .SH EXAMPLES -Copy new_boot.ini from /home/user as boot.ini to the root of an /dev/hda1 NTFS volume: +Copy new_boot.ini from /home/user as boot.ini to the root of an /dev/hda1 NTFS +volume: .RS .sp .B ntfscp /dev/hda1 /home/user/new_boot.ini boot.ini .sp .RE -Copy myfile to C:\\some\\path\\myfile:stream (assume that /dev/hda1 letter in windows is C): +Copy myfile to C:\\some\\path\\myfile:stream (assume that /dev/hda1 letter in +windows is C): .RS .sp -.B ntfscp -N stream /dev/hda1 myfile /some/path +.B ntfscp \-N stream /dev/hda1 myfile /some/path +.sp +.RE .SH BUGS -No bugs are known at present. If you find any bugs, please send an email to +There are no known problems with +.BR ntfscp . +If you find a bug please send an email describing the problem to the +development team: +.br .nh -. +linux\-ntfs\-dev@lists.sourceforge.net .hy -.SH AUTHOR +.SH AUTHORS .B ntfscp -was written by Yura Pakhuchiy. -.B ntfscp -and this manual page is based on -.B ntfscat -and its manual page by Richard Russon, so many thanks to him. Information about named data streams was partly taken from -.B ntfsdoc. +was written by Yura Pakhuchiy, with contributions from Anton Altaparmakov. .SH DEDICATION With love to Marina Sapego. .SH AVAILABILITY .B ntfscp -is part of the ntfsprogs package and is available from +is part of the +.B ntfsprogs +package and is available from: .br .nh -http://linux\-ntfs.sourceforge.net/downloads.html. +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +The manual pages are available online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man .hy .SH SEE ALSO .BR ntfsprogs (8) - diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c index 6a7b16cf..6b852e39 100644 --- a/ntfsprogs/ntfscp.c +++ b/ntfsprogs/ntfscp.c @@ -95,15 +95,15 @@ static void version(void) static void usage(void) { ntfs_log_info("\nUsage: %s [options] device src_file dest_file\n\n" - " -a --attribute num Write to this attribute\n" - " -i --inode Treat dest_file as inode number\n" - " -f --force Use less caution\n" - " -h --help Print this help\n" - " -N --attr-name name Write to attribute with this name\n" - " -n --no-action Do not write to disk\n" - " -q --quiet Less output\n" - " -V --version Version information\n" - " -v --verbose More output\n\n", + " -a, --attribute NUM Write to this attribute\n" + " -i, --inode Treat dest_file as inode number\n" + " -f, --force Use less caution\n" + " -h, --help Print this help\n" + " -N, --attr-name NAME Write to attribute with this name\n" + " -n, --no-action Do not write to disk\n" + " -q, --quiet Less output\n" + " -V, --version Version information\n" + " -v, --verbose More output\n\n", EXEC_NAME); ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index 8b828114..d95a1fb9 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -1,44 +1,74 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" First parameter, NAME, should be all caps -.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection -.\" other parameters are allowed: see man(7), man(1) -.TH NTFSFIX 8 "July 2005" "ntfsprogs version @VERSION@" -.\" Please adjust this date whenever revising the manpage. +.\" Copyright (c) 2004 Szabolcs Szakacsits. +.\" Copyright (c) 2005 Richard Russon. +.\" This file may be copied under the terms of the GNU Public License. .\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp insert n+1 empty lines -.\" for manpage-specific macros, see man(7) +.TH NTFSFIX 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME ntfsfix \- fix common errors and force Windows to check NTFS .SH SYNOPSIS .B ntfsfix -.I device +[\fIoptions\fR] \fIdevice\fR .SH DESCRIPTION -\fBntfsfix\fP is a utility that fixes some common NTFS problems. -\fBntfsfix\fP is \fBNOT\fP a Linux -version of chkdsk. It only repairs some fundamental NTFS inconsistencies, -resets the NTFS journal file and schedules an NTFS consistency check for -the first boot into Windows. +.B ntfsfix +is a utility that fixes some common NTFS problems. +.B ntfsfix +is +.B NOT +a Linux version of chkdsk. It only repairs some fundamental NTFS +inconsistencies, resets the NTFS journal file and schedules an NTFS consistency +check for the first boot into Windows. .sp You may run .B ntfsfix on an NTFS volume if you think it's damaged and it can't be mounted. -.SH AUTHOR -The original ntfsfix manual page was written by David Martínez Moreno - and rewritten -by Szabolcs Szakacsits to reflect the current role of +.SH OPTIONS +Below is a summary of all the options that +.B ntfsfix +accepts. Nearly all options have two equivalent names. The short name is +preceded by +.B \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.B \-fv +is equivalent to +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. +.TP +\fB\-h\fR, \fB\-\-help\fR +Show a list of options with a brief description of each one. +.TP +\fB\-V\fR, \fB\-\-version\fR +Show the version number, copyright and license +.SH BUGS +There are no known problems with +.BR ntfsfix . +If you find a bug please send an email describing the problem to the +development team: +.br +.nh +linux\-ntfs\-dev@lists.sourceforge.net +.hy +.SH AUTHORS +.B ntfsfix +was written by Anton Altaparmakov. .B ntfsfix. .SH AVAILABILITY .B ntfsfix -is part of the ntfsprogs package and is available from -http://linux-ntfs.sourceforge.net/. +is part of the +.B ntfsprogs +package and is available from: +.br +.nh +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +The manual pages are available online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man +.hy .SH SEE ALSO .BR mkntfs (8), .BR ntfsprogs (8) diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index efebca26..91dc1fe2 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -1,35 +1,95 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2002-2004 Anton Altaparmakov. All Rights Reserved. +.\" Copyright (c) 2002\-2004 Anton Altaparmakov. +.\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSINFO 8 "Feb 2004" "ntfsprogs version @VERSION@" +.TH NTFSINFO 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME ntfsinfo \- dump a file's attributes .SH SYNOPSIS .B ntfsinfo -.I -i inode-number -.I -F path-filename -.I -m -.I device +[\fIoptions\fR] \fIdevice\fR .SH DESCRIPTION .B ntfsinfo will dump the attributes of inode -.I inode-number +.I inode\-number or the file -.I path-filename +.I path\-filename and/or information about the mft ( -.I -m +.I \-m option). Run ntfsinfo without arguments for a full list of options. -.PP -.SH AUTHOR +.SH OPTIONS +Below is a summary of all the options that .B ntfsinfo -was written by Matthew J. Fanto (mattjf@uncompiled.com) and largely rewritten -by Yuval Fledel with a little help from Anton Altaparmakov. +accepts. Nearly all options have two equivalent names. The short name is +preceded by +.B \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.B \-fv +is equivalent to +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. +.TP +\fB\-F\fR, \fB\-\-file\fR FILE +Show information about this file +.TP +\fB\-f\fR, \fB\-\-force\fR +This will override some sensible defaults, such as not overwriting an existing +file. Use this option with caution. +.TP +\fB\-h\fR, \fB\-\-help\fR +Show a list of options with a brief description of each one. +.TP +\fB\-i\fR, \fB\-\-inode\fR NUM +Show information about this inode. +.TP +\fB\-m\fR, \fB\-\-mft\fR +Show information about the volume. +.TP +\fB\-q\fR, \fB\-\-quiet\fR +Produce less output. +.TP +\fB\-t\fR, \fB\-\-notime\fR +Do not display timestamps in the output. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Increase the amount of output that +.B ntfsinfo +prints. +.TP +\fB\-V\fR, \fB\-\-version\fR +Show the version number, copyright and license for +.BR ntfsundelete . +.SH BUGS +There are no known problems with +.BR ntfsinfo . +If you find a bug please send an email describing the problem to the +development team: +.br +.nh +linux\-ntfs\-dev@lists.sourceforge.net +.hy +.SH AUTHORS +.B ntfsinfo +was written by Matthew J. Fanto, Anton Altaparmakov, Richard Russon, Szabolcs +Szakacsits, Yuval Fledel, Yura Pakhuchiy and Cristian Klein. .SH AVAILABILITY .B ntfsinfo -is part of the ntfsprogs package and is available from -http://linux-ntfs.sourceforge.net/. +is part of the +.B ntfsprogs +package and is available from: +.br +.nh +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +The manual pages are available online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man +.hy .SH SEE ALSO .BR ntfsprogs (8) - diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index e5a13d47..9acbba4f 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -124,16 +124,16 @@ static void version(void) static void usage(void) { printf("\nUsage: %s [options] device\n" - " -i num --inode num Display information about this inode\n" - " -F file --file file Display information about this file (absolute path)\n" - " -m --mft Dump information about the volume\n" - " -t --notime Don't report timestamps\n" + " -i, --inode NUM Display information about this inode\n" + " -F, --file FILE Display information about this file (absolute path)\n" + " -m, --mft Dump information about the volume\n" + " -t, --notime Don't report timestamps\n" "\n" - " -f --force Use less caution\n" - " -q --quiet Less output\n" - " -v --verbose More output\n" - " -V --version Display version information\n" - " -h --help Display this help\n\n", + " -f, --force Use less caution\n" + " -q, --quiet Less output\n" + " -v, --verbose More output\n" + " -V, --version Display version information\n" + " -h, --help Display this help\n\n", EXEC_NAME); printf("%s%s\n", ntfs_bugs, ntfs_home); } diff --git a/ntfsprogs/ntfslabel.8.in b/ntfsprogs/ntfslabel.8.in index b647cf4f..137c46fc 100644 --- a/ntfsprogs/ntfslabel.8.in +++ b/ntfsprogs/ntfslabel.8.in @@ -1,36 +1,32 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2002-2004 Anton Altaparmakov. All Rights Reserved. +.\" Copyright (c) 2002\-2004 Anton Altaparmakov. +.\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. -.\" Adapted from e2fsprogs-1.26/misc/e2label.8.in by Theodore Ts'o. .\" -.TH NTFSLABEL 8 "April 2002" "ntfsprogs version @VERSION@" +.TH NTFSLABEL 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME ntfslabel \- display/change the label on an ntfs file system .SH SYNOPSIS .B ntfslabel -.I device -[ -.I new-label -] +[\fIoptions\fR] \fIdevice \fR[\fInew\-label\fR] .SH DESCRIPTION .B ntfslabel will display or change the file system label on the ntfs file system located on .IR device . .PP If the optional argument -.I new-label +.I new\-label is not present, .B ntfslabel will simply display the current file system label. .PP If the optional argument -.I new-label +.I new\-label is present, then .B ntfslabel will set the file system label to be -.IR new-label . +.IR new\-label . NTFS file system labels can be at most 128 Unicode characters long; if -.I new-label +.I new\-label is longer than 128 Unicode characters, .B ntfslabel will truncate it and print a warning message. @@ -40,16 +36,70 @@ It is also possible to set the file system label using the option of .BR mkntfs (8) during creation of the file system. -.PP -.SH AUTHOR +.SH OPTIONS +Below is a summary of all the options that .B ntfslabel -was written by Matthew J. Fanto (mattjf@uncompiled.com). This man page was -written by Anton Altaparmakov (aia21@cantab.net). +accepts. Nearly all options have two equivalent names. The short name is +preceded by +.B \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.B \-fv +is equivalent to +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. +.TP +\fB\-f\fR, \fB\-\-force\fR +This will override some sensible defaults, such as not working with a mounted +volume. Use this option with caution. +.TP +\fB\-h\fR, \fB\-\-help\fR +Show a list of options with a brief description of each one. +.TP +\fB\-n\fR, \fB\-\-no\-action\fR +Don't actually write to disk. +.TP +\fB\-q\fR, \fB\-\-quiet\fR +Reduce the amount of output to a minimum. +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Increase the amount of output that +.B ntfslabel +prints. +.TP +\fB\-V\fR, \fB\-\-version\fR +Show the version number, copyright and license for +.BR ntfslabel . +.SH BUGS +There are no known problems with +.BR ntfslabel . +If you find a bug please send an email describing the problem to the +development team: +.br +.nh +linux\-ntfs\-dev@lists.sourceforge.net +.hy +.SH AUTHORS +.B ntfslabel +was written by Matthew J. Fanto, with contributions from Anton Altaparmakov and +Richard Russon. .SH AVAILABILITY .B ntfslabel -is part of the ntfsprogs package and is available from -http://linux-ntfs.sourceforge.net/. +is part of the +.B ntfsprogs +package and is available from: +.br +.nh +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +The manual pages are available online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man +.hy .SH SEE ALSO .BR mkntfs (8), .BR ntfsprogs (8) - diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c index 72bfdfa1..9d016698 100644 --- a/ntfsprogs/ntfslabel.c +++ b/ntfsprogs/ntfslabel.c @@ -90,12 +90,12 @@ static void version(void) static void usage(void) { ntfs_log_info("\nUsage: %s [options] device [label]\n" - " -n --no-action Do not write to disk\n" - " -f --force Use less caution\n" - " -q --quiet Less output\n" - " -v --verbose More output\n" - " -V --version Display version information\n" - " -h --help Display this help\n\n", + " -n, --no-action Do not write to disk\n" + " -f, --force Use less caution\n" + " -q, --quiet Less output\n" + " -v, --verbose More output\n" + " -V, --version Display version information\n" + " -h, --help Display this help\n\n", EXEC_NAME); ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index f4fe8611..74c07e62 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -1,12 +1,15 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2003 Anton Altaparmakov. All Rights Reserved. +.\" Copyright (c) 2003 Anton Altaparmakov. +.\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSLS 8 "October 2005" "ntfsprogs version @VERSION@" +.TH NTFSLS 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME ntfsls \- list directory contents on an NTFS filesystem .SH SYNOPSIS .B ntfsls +[\fIoptions\fR] \fIdevice\fR +.sp +.B ntfsls [ .B \-a | @@ -25,8 +28,6 @@ ntfsls \- list directory contents on an NTFS filesystem [ .B \-h | -.B \-? -| .B \-\-help ] [ @@ -70,7 +71,7 @@ ntfsls \- list directory contents on an NTFS filesystem | .B \-\-dos ] -.I DEVICE +.I device .SH DESCRIPTION .B ntfsls is used to list information about the files specified by the @@ -81,66 +82,97 @@ is the special file corresponding to the device (e.g .IR /dev/hdXX ) or an NTFS image file. .SH OPTIONS +Below is a summary of all the options that +.B ntfsls +accepts. Nearly all options have two equivalent names. The short name is +preceded by +.B \- +and the long name is preceded by +.BR \-\- . +Any single letter options, that don't take an argument, can be combined into a +single command, e.g. +.B \-fv +is equivalent to +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. .TP -.B \-a, \-\-all +\fB\-a\fR, \fB\-\-all\fR Display all files. If this option is not specified file names in the POSIX namespace will not be displayed. .TP -.B \-F, \-\-classify +\fB\-F\fR, \fB\-\-classify\fR Append indicator (one of */=@|) to entries. .TP -.B \-f, \-\-force +\fB\-f\fR, \fB\-\-force\fR Force execution. For example necessary to run on an NTFS partition stored in a normal file. .TP -.B \-h, \-?, \-\-help +\fB\-h\fR, \fB\-\-help\fR Print the usage information of .B ntfsls and exit. .TP -.B \-i, \-\-inode +\fB\-i\fR, \fB\-\-inode\fR Print inode number of each file. This is the MFT reference number in NTFS terminology. .TP -.B \-l, \-\-long +\fB\-l\fR, \fB\-\-long\fR Use a long listing format. .TP -.B \-p, \-\-path +\fB\-p\fR, \fB\-\-path\fR PATH The directory whose contents to list or the file (including the path) about which to display information. .TP -.B \-q, \-\-quiet +\fB\-q\fR, \fB\-\-quiet\fR Suppress some debug/warning/error messages. .TP -.B \-s, \-\-system +\fB\-R\fR, \fB\-\-recursive\fR +Show the contents of all directories beneath the specified directory. +.TP +\fB\-s\fR, \fB\-\-system\fR Unless this options is specified, all files beginning with a dollar sign character will not be listed as these files are usually system files. .TP -.B \-V, \-\-version +.B \-v, \-\-verbose +\fB\-v\fR, \fB\-\-verbose\fR +Display more debug/warning/error messages. +.TP +\fB\-V\fR, \fB\-\-version\fR Print the version number of .B ntfsls and exit. .TP -.B \-v, \-\-verbose -Display more debug/warning/error messages. -.TP -.B \-x, \-\-dos +\fB\-x\fR, \fB\-\-dos\fR Display short file names, i.e. files in the DOS namespace, instead of long file names, i.e. files in the WIN32 namespace. .SH BUGS -We are not aware of any bugs. If you find a bug, please report it to -. Thank you. -.SH AUTHOR +There are no known problems with +.BR ntfsls . +If you find a bug please send an email describing the problem to the +development team: +.br +.nh +linux\-ntfs\-dev@lists.sourceforge.net +.hy +.SH AUTHORS This version of .B ntfsls -has been written by Lode Leroy and enhanced by -Anton Altaparmakov . This man page has been written by -Anton Altaparmakov. +was written by Lode Leroy, Anton Altaparmakov, Richard Russon, Carmelo Kintana +and Giang Nguyen. .SH AVAILABILITY .B ntfsls -is part of the ntfsprogs package and is available for download from -http://sourceforge.net/project/showfiles.php?group_id=13956 in source (tar ball -and rpm) and pre-compiled binary (i386 rpm and deb) form. +is part of the +.B ntfsprogs +package and is available from: +.br +.nh +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +The manual pages are available online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man +.hy .SH SEE ALSO .BR ntfsprogs (8) - diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c index 211467ea..046c5604 100644 --- a/ntfsprogs/ntfsls.c +++ b/ntfsprogs/ntfsls.c @@ -160,19 +160,19 @@ static void usage(void) { printf("\nUsage: %s [options] device\n" "\n" - " -a --all Display all files\n" - " -F --classify Display classification\n" - " -f --force Use less caution\n" - " -h -? --help Display this help\n" - " -i --inode Display inode numbers\n" - " -l --long Display long info\n" - " -p PATH --path PATH Directory whose contents to list\n" - " -q --quiet Less output\n" - " -R --recursive Recursively list subdirectories\n" - " -s --system Display system files\n" - " -V --version Display version information\n" - " -v --verbose More output\n" - " -x --dos Use short (DOS 8.3) names\n" + " -a, --all Display all files\n" + " -F, --classify Display classification\n" + " -f, --force Use less caution\n" + " -h, --help Display this help\n" + " -i, --inode Display inode numbers\n" + " -l, --long Display long info\n" + " -p, --path PATH Directory whose contents to list\n" + " -q, --quiet Less output\n" + " -R, --recursive Recursively list subdirectories\n" + " -s, --system Display system files\n" + " -V, --version Display version information\n" + " -v, --verbose More output\n" + " -x, --dos Use short (DOS 8.3) names\n" "\n", EXEC_NAME); diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 249077bc..d84d899a 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -1,8 +1,8 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2005 Yura Pakhuchiy. All Rights Reserved. +.\" Copyright (c) 2005 Yura Pakhuchiy. +.\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSMOUNT 8 "October 2005" "ntfsprogs version @VERSION@" +.TH NTFSMOUNT 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME ntfsmount \- NTFS module for FUSE. .SH SYNOPSIS @@ -18,30 +18,24 @@ You need to compile it, .B xattr is recommended, but not mandatory. -.sp .TP .B Fully implemented ntfsmount features are: - -* Read-write access to normal and sparse files. - -* Read-only access to compressed files. - -* Access to special Interix files (symlinks, devices, FIFOs). - -* List/Read/Write/Add/Remove named data streams. - +\(bu Read\-write access to normal and sparse files. +.br +\(bu Read\-only access to compressed files. +.br +\(bu Access to special Interix files (symlinks, devices, FIFOs). +.br +\(bu List/Read/Write/Add/Remove named data streams. .TP .B Partly implemented features: - -* Create/Delete/Move files and directories. - -* Hard link files. - +\(bu Create/Delete/Move files and directories. +.br +\(bu Hard link files. .SH OPTIONS Below is a summary of all the options that .B ntfsmount accepts. - .TP .B uid=, gid=, umask= Provide default owner, group, and access mode mask. @@ -50,30 +44,27 @@ default, the files/directories are owned by user that mounted volume and he/she has read and write permissions, as well as browse permission for directories. No one else has any access permissions. I.e. the mode on all files is by -default rw------- and for directories rwx------, a +default rw\-\-\-\-\-\-\- and for directories rwx\-\-\-\-\-\-, a consequence of the default fmask=0177 and dmask=0077. Using a umask of zero will grant all permissions to everyone, i.e. all files and directories will have mode rwxrwxrwx. - .TP .B fmask=, dmask= Instead of specifying umask which applies both to files and directories, fmask applies only to files and mask only to directories. - .TP .B show_sys_files If show_sys_files is specified, show the system files in directory listings. Otherwise the default behaviour is to hide the system files. Note that even when show_sys_files is specified, "$MFT" -may will not be visible due to bugs/mis-features in glibc. +may will not be visible due to bugs/mis\-features in glibc. Further, note that irrespective of show_sys_files, all files are accessible by name, i.e. you can always do -"ls -l '$UpCase'" for example to specifically show the +"ls \-l '$UpCase'" for example to specifically show the system file containing the Unicode upcase table. - .TP .B default_permissions By default FUSE doesn't check file access permissions, the @@ -82,14 +73,12 @@ the underlying file access mechanism (e.g. in case of network filesystems). This option enables permission checking, restricting access based on file mode. This is option is usually useful together with the 'allow_other' mount option. - .TP .B allow_other This option overrides the security measure restricting file access to the user mounting the filesystem. This option is by default only allowed to root, but this restriction can be removed with a configuration option described in the previous section. - .TP .B kernel_cache (NOTE: Only for FUSE 2.3.0, with FUSE >= 2.4.0 on by default) @@ -98,61 +87,65 @@ every open(). This should only be enabled on filesystems, where the file data is never changed externally (not through the mounted FUSE filesystem). Thus it is not suitable for network filesystems and other "intermediate" filesystems. - NOTE: if this option is not specified (and neither 'direct_io') data is still cached after the open(), so a read() system call will not always initiate a read operation. - .TP .B large_read Issue large read requests. This can improve performance for some filesystems, but can also degrade performance. This option is only useful on 2.4.X kernels, as on 2.6 kernels requests size is automatically determined for optimum performance. - .TP .B direct_io This option disables the use of page cache (file content cache) in the kernel for this filesystem. This has several affects: - - Each read() or write() system call will initiate one or more read or write operations, data will not be cached in the kernel. - - The return value of the read() and write() system calls will correspond to the return values of the read and write operations. This is useful for example if the file size is not known in advance (before reading it). - .TP .B max_read= With this option the maximum size of read operations can be set. The default is infinite. Note that the size of read requests is limited anyway to 32 pages (which is 128kbyte on i386). - .TP .B force Force mount even if errors occurred. Use this option only if you know what are you doing and don't cry about data loss. - .TP .B ro -Mount filesystem read-only. - +Mount filesystem read\-only. .TP .B no_def_opts By default ntfsmount acts as "default_permissions,allow_other" was passed to it, this option cancel this behaviour. - .TP .B succeed_chmod Don't change any permissions and don't return error on chmod operation. - .TP .B locale= You can set locale with this option. It's useful if locale enviroment variables are not set before partitions from /etc/fstab had been mounted. - +.TP +.B streams_interface= +This option controls how the user can access named data streams. It can be set +to, one of +.BR none ", " windows " or " xattr . +If the option is set to +.BR "none" , +the user will have no access to the named data streams. If it's set to +.BR "windows" , +then the user can access them just like in Windows (eg. cat file:stream). +If it's set to +.BR "xattr" , +then the named data streams are mapped to xattrs and user can manipulate them +using +.B {get,set}fattr +utilities. .SH DATA STREAMS All data on NTFS is stored in streams, which can have names. A file can have more than one data streams, but exactly one must have no name. @@ -172,87 +165,88 @@ can use your preferred utils to access them. You can even delete them using You can list all named data streams by getting "ntfs.streams.list" extended attribute. NOTE: The last feature is unique for NTFS FUSE module and maybe will be never supported by kernel driver. - .SH EXAMPLES -Mount /dev/hda1 to /mnt/ntfs-fuse using ntfsmount: +Mount /dev/hda1 to /mnt/ntfs\-fuse using ntfsmount: .RS .sp -.B ntfsmount /dev/hda1 /mnt/ntfs-fuse +.B ntfsmount /dev/hda1 /mnt/ntfs\-fuse .sp .RE - -Read-only mount /dev/hda5 to /home/user/mnt and make user with uid 1000 to be +Read\-only mount /dev/hda5 to /home/user/mnt and make user with uid 1000 to be owner of all files: .RS .sp -.B ntfsmount /dev/hda5 /home/user/mnt -o ro,uid=1000 +.B ntfsmount /dev/hda5 /home/user/mnt \-o ro,uid=1000 .sp .RE - /etc/fstab entry for above: .RS .sp -.B /dev/hda5 /home/user/mnt ntfs-fuse ro,uid=1000 0 0 +.B /dev/hda5 /home/user/mnt ntfs\-fuse ro,uid=1000 0 0 .sp .RE - -Umount /mnt/ntfs-fuse: +Umount /mnt/ntfs\-fuse: .RS .sp -.B fusermount -u /mnt/ntfs-fuse +.B fusermount \-u /mnt/ntfs\-fuse .sp .RE - Cat "artist" named data stream of "some.mp3": .RS .sp .B cat some.mp3:artist .sp .RE - Write "Sympho Black Metal" to "genre" named data stream of "some.mp3": .RS .sp .B echo Sympho Black Metal > some.mp3:genre .sp .RE - Remove "album" named data stream from "some.mp3": .RS .sp .B rm some.mp3:album .sp .RE - List all named data streams for "some.mp3": .RS .sp -.B getfattr -n ntfs.streams.list some.mp3 - +.B getfattr \-n ntfs.streams.list some.mp3 +.sp +.RE .SH BUGS -No bugs are known at present. If you find any bugs, please send an email to -.nh -. -.hy - -.SH AUTHOR -.B ntfsmount -was written by Yura Pakhuchiy. This manual page use information from Documentation/filesystems/ntfs.txt from linux kernel source, and from README from FUSE. - -.SH DEDICATION -With love to Marina Sapego. - -.SH THANKS -Many thanks to Miklos Szeredi for advice and answers about FUSE. - -.SH AVAILABILITY -.B ntfsmount -is part of the ntfsprogs package and is available from +There are no known problems with +.BR ntfsmount . +If you find a bug please send an email describing the problem to the +development team: .br .nh -http://linux\-ntfs.sourceforge.net/downloads.html. +linux\-ntfs\-dev@lists.sourceforge.net +.hy +.SH AUTHORS +.B ntfsmount +was written by Yura Pakhuchiy, with contributions from Anton Altaparmakov. +.SH DEDICATION +With love to Marina Sapego. +.SH THANKS +Many thanks to Miklos Szeredi for advice and answers about FUSE. +.SH AVAILABILITY +.B ntfsmount +is part of the +.B ntfsprogs +package and is available from: +.br +.nh +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +The manual pages are available online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man .hy - .SH SEE ALSO -.BR "ntfsprogs" (8), " attr" (5), " getfattr" (1) - +.BR ntfsprogs (8), +.BR attr (5), +.BR getfattr (1) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index ad3cb2c6..64d0cbf6 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1587,6 +1587,7 @@ static void usage(void) "succeed_chmod\n\tlocale\n\tstreams_interface\n" "Also look into FUSE documentation about it options.\n\n"); ntfs_log_info("Default options are: \"%s\".\n", def_opts); + ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } #ifndef HAVE_REALPATH diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index 502675df..8fc797b6 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -1,16 +1,15 @@ -.\" Copyright (c) 2002 Richard Russon. All Rights Reserved. -.\" Copyright (c) 2002-2003 Anton Altaparmakov. All Rights Reserved. -.\" Copyright (c) 2005 Szabolcs Szakacsits. All Rights Reserved. +.\" Copyright (c) 2002\-2005 Richard Russon. +.\" Copyright (c) 2002\-2003 Anton Altaparmakov. +.\" Copyright (c) 2005 Szabolcs Szakacsits. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSPROGS 8 "June 2005" "ntfsprogs version @VERSION@" +.TH NTFSPROGS 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME ntfsprogs \- several tools for doing neat things with NTFS partitions .SH OVERVIEW .B ntfsprogs is a suite of NTFS utilities based around a shared library. The tools are available for free and come with full source code. - .SH TOOLS .SS mkntfs .PP @@ -20,7 +19,6 @@ available for free and come with full source code. .PP .BR ntfscat (8) : Dump a file's contents to the standard output. -.PP .SS ntfsclone .PP .BR ntfsclone (8) @@ -63,18 +61,25 @@ or directories within it. .PP .BR ntfsundelete (8) : Recover deleted files from an NTFS partition. - .SH AUTHORS .PP -The tools have been written by Anton Altaparmakov, Richard Russon, Matthew Fanto, Szabolcs Szakacsits, Lode Leroy, Yuval Fledel and Yura Pakhuchiy. - +The tools were written by Anton Altaparmakov, Carmelo Kintana, Cristian Klein, +Erik Sornes, Giang Nguyen, Holger Ohmacht, Lode Leroy, Matthew J. Fanto, Per +Olofsson, Richard Russon, Szabolcs Szakacsits, Yura Pakhuchiy and Yuval Fledel. .SH AVAILABILITY The .B ntfsprogs -can be downloaded from http://linux-ntfs.sourceforge.net/downloads.html +can be downloaded from: .br -These manual pages can be viewed online at http://linux-ntfs.sourceforge.net/man/ntfsprogs.html - +.nh +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +These manual pages can be viewed online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man +.hy .SH SEE ALSO -.BR libntfs-gnomevfs (8) +.BR libntfs\-gnomevfs (8) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index cef18d0e..196896b5 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -1,13 +1,14 @@ -.\" -*- nroff -*- -.\" Copyright 2002-2005 by Szabolcs Szakacsits All Rights Reserved. +.\" Copyright (c) 2002\-2005 Szabolcs Szakacsits. +.\" Copyright (c) 2005 Richard Russon. +.\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSRESIZE 8 "Sep 2005" "ntfsprogs version @VERSION@" +.TH NTFSRESIZE 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME ntfsresize \- resize an NTFS filesystem without data loss .SH SYNOPSIS .B ntfsresize [\fIOPTIONS\fR] -.B --info +.B \-\-info .I DEVICE .br .B ntfsresize @@ -19,7 +20,7 @@ The .B ntfsresize program safely resizes Windows XP, Windows Server 2003, Windows 2000, Windows NT4 and Longhorn NTFS filesystems without data loss. All NTFS versions are -supported, used by 32-bit and 64-bit Windows. +supported, used by 32\-bit and 64\-bit Windows. .B Defragmentation is NOT required prior to resizing because the program can relocate any data if needed, without risking data integrity. @@ -33,17 +34,19 @@ bytes. The .I SIZE parameter may have one of the optional modifiers -\fBk\fR, \fBM\fR, \fBG\fR, which means the +.BR k , +.BR M , +.BR G , +which means the .I SIZE -parameter is given in kilo-, mega- or gigabytes respectively. +parameter is given in kilo\-, mega\- or gigabytes respectively. .B Ntfsresize conforms to the SI, ATA, IEEE standards and the disk manufacturers by using k=10^3, M=10^6 and G=10^9. - If both -.B --info +.B \-\-info and -.B --size +.B \-\-size are omitted then the NTFS filesystem will be enlarged to the underlying .I DEVICE @@ -67,7 +70,7 @@ It's a good practice making REGULAR BACKUPS of your valuable data, especially before using ANY partitioning tools. To do so for NTFS, you could use .BR ntfsclone (8). Don't forget to save the partition table as well! -.SH SHRINKAGE +.SS Shrinkage If you wish to shrink an NTFS partition, first use .B ntfsresize to shrink the size of the filesystem. Then you could use @@ -77,7 +80,7 @@ partition and recreating it with the smaller size. Do not make the partition smaller than the new size of NTFS otherwise you won't be able to boot. If you did so notwithstanding then just recreate the partition to be as large as NTFS. -.SH ENLARGEMENT +.SS Enlargement To enlarge an NTFS filesystem, first you must enlarge the size of the underlying partition. This can be done using .BR fdisk (8) @@ -86,31 +89,32 @@ Make sure it will not overlap with an other existing partition. Then you may use .B ntfsresize to enlarge the size of the filesystem. -.SH PARTITIONING +.SS Partitioning When recreating the partition by a disk partitioning tool, make sure you create it at the same starting sector and with the same partition type as before. Otherwise you won't be able to access your filesystem. Use the 'u' fdisk command to switch to the reliable sector unit from the default cylinder one. - Also make sure you set the bootable flag for the partition if it existed before. Failing to do so you might not be able to boot your computer from the disk. .SH OPTIONS Below is a summary of all the options that .B ntfsresize -accepts. All options have two equivalent names. The short name is preceded by -.BR \- +accepts. Nearly all options have two equivalent names. The short name is +preceded by +.B \- and the long name is preceded by .BR \-\- . Any single letter options, that don't take an argument, can be combined into a single command, e.g. -.BR \-fi +.B \-fv is equivalent to -.BR "\-f \-i". +.BR "\-f \-v" . +Long named options can be abbreviated to any unique prefix of their name. .TP -.B -i, --info +\fB\-i\fR, \fB\-\-info\fR By using this option ntfsresize will determine the theoretically smallest shrunken filesystem size supported. Most of the time the result is the space already used on the filesystem. Ntfsresize will refuse shrinking to a @@ -118,30 +122,31 @@ smaller size than what you got by this option and depending on several factors it might be unable to shrink very close to this theoretical size. Although the integrity of your data should be never in risk, it's still strongly recommended to make a test run by using the -.B --no-action +\fB\-n\fR, \fB\-\-no\-action\fR option before real resizing. - Practically the smallest shrunken size generally is -at around "used space" + (20-200 MB). Please also take into account -that Windows might need about 50-100 MB free space left to boot safely. - +at around "used space" + (20\-200 MB). Please also take into account +that Windows might need about 50\-100 MB free space left to boot safely. This option never causes any changes to the filesystem, the partition is -opened read-only. +opened read\-only. .TP -.B -s, --size \fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR] -Resize filesystem to \fIsize\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes. -The optional modifiers \fBk\fR, \fBM\fR, \fBG\fR mean the +\fB\-s\fR, \fB\-\-size\fR SIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR] +Resize filesystem to \fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes. +The optional modifiers +.BR k , +.BR M , +.B G +mean the .I SIZE -parameter is given in kilo-, mega- or gigabytes respectively. +parameter is given in kilo\-, mega\- or gigabytes respectively. Conforming to standards, k=10^3, M=10^6 and G=10^9. Use this option with -.B --no-action +.B \-\-no\-action first. .TP -.B -f, --force +\fB\-f\fR, \fB\-\-force\fR Forces ntfsresize to proceed with the resize operation even if the filesystem is marked for consistency check. - Please note, ntfsresize always marks the filesystem for consistency check before a real resize operation and it leaves that way for extra @@ -150,45 +155,50 @@ use this option. If you need to resize several times without booting into Windows between each resizing steps then you must use this option. .TP -.B -n, --no-action +.B \-n, \-\-no\-action Use this option to make a test run before doing the real resize operation. -Volume will be opened read-only and +Volume will be opened read\-only and .B ntfsresize displays what it would do if it were to resize the filesystem. Continue with the real resizing only if the test run passed. .TP -.B -b, --bad-sectors +\fB\-b\fR, \fB\-\-bad\-sectors\fR Support disks having hardware errors, bad sectors with those .B ntfsresize would refuse to work by default. - Prior using this option, it's strongly recommended to make a backup by .BR ntfsclone (8) -using the --rescue option, then running 'chkdsk /f /r volume:' on Windows +using the \-\-rescue option, then running 'chkdsk /f /r volume:' on Windows from the command line. If the disk guarantee is still valid then replace it. It's defected. Please also note, that no software can repair these type of hardware errors. The most what they can do is to work around the permanent defects. - This option doesn't have any effect if the disk is flawless. .TP -.B -P, --no-progress-bar +\fB\-P\fR, \fB\-\-no\-progress\-bar\fR Don't show progress bars. .TP -.B -v, --verbose +\fB\-v\fR, \fB\-\-verbose\fR More output. .TP -.B -h, --help +\fB\-V\fR, \fB\-\-version\fR +Print the version number of +.B ntfsresize +and exit. +.TP +\fB\-h\fR, \fB\-\-help\fR Display help and exit. .SH EXIT CODES -The exit code is 0 on success, non-zero otherwise. -.SH KNOWN ISSUES +The exit code is 0 on success, non\-zero otherwise. +.SH BUGS No reliability problem is known. If you need help please try the Ntfsresize FAQ first (see below) and if you don't find your answer then send your question, comment or bug report to -. No subscription is needed -but the mailing list is moderated and it can take a short time -to approve your post. +the development team: +.br +.nh +linux\-ntfs\-dev@lists.sourceforge.net +.hy .PP There are a few very rarely met restrictions at present: filesystems having unknown bad sectors, relocation @@ -219,10 +229,10 @@ ntfsresize never touches the partition table at all. By changing the 'Disk Access Mode' to LBA in the BIOS makes booting work again, most of the time. You can find more information about this issue in the Troubleshooting section of the below referred Ntfsresize FAQ. -.SH AUTHOR -.B Ntfsresize -has been written by -Szabolcs Szakacsits . +.SH AUTHORS +.B ntfsresize +was written by Szabolcs Szakacsits, with contributions from Anton Altaparmakov +and Richard Russon. .SH ACKNOWLEDGEMENT Many thanks to Anton Altaparmakov and Richard Russon for libntfs, the excellent documentation and comments, @@ -231,21 +241,34 @@ at the University of Granada for their continuous and highly valuable help, furthermore to Erik Meade, Martin Fick, Sandro Hawke, Dave Croal, Lorrin Nelson, Geert Hendrickx, Robert Bjorkman and Richard Burdick for beta testing the relocation support, to Florian Eyben, Fritz Oppliger, -Richard Ebling, Sid-Ahmed Touati, Jan Kiszka, Benjamin Redelings, Christopher +Richard Ebling, Sid\-Ahmed Touati, Jan Kiszka, Benjamin Redelings, Christopher Haney, Ryan Durk, Ralf Beyer for the valued contributions and to Theodore Ts'o whose .BR resize2fs (8) man page originally formed the basis of this page. .SH AVAILABILITY -.B Ntfsresize -is part of the -.BR ntfsprogs (8) -package and is available from -http://linux-ntfs.sourceforge.net/ as source and precompiled binary. +.B ntfsresize +is part of the +.B ntfsprogs +package and is available from: +.br +.nh +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +The manual pages are available online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man +.hy +.sp .B Ntfsresize related news, example of usage, troubleshooting, statically linked binary and -FAQ (frequently asked questions) is maintained at +FAQ (frequently asked questions) are maintained at: +.br +.nh http://mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html +.hy .SH SEE ALSO .BR fdisk (8), .BR cfdisk (8), @@ -255,4 +278,3 @@ http://mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html .BR ntfsclone (8), .BR mkntfs (8), .BR ntfsprogs (8) - diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index 9af80533..852d4c5c 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -1,15 +1,12 @@ -.\" Copyright (c) 2002-2005 Richard Russon. All Rights Reserved. +.\" Copyright (c) 2002\-2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSUNDELETE 8 "June 2002" "ntfsprogs version @VERSION@" +.TH NTFSUNDELETE 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME ntfsundelete \- recover a deleted file from an NTFS volume. .SH SYNOPSIS .B ntfsundelete -[ -.I options -] -.B device +[\fIoptions\fR] \fIdevice\fR .SH DESCRIPTION .B ntfsundelete has three modes of operation: @@ -27,8 +24,8 @@ will print a list giving the inode number, name and size. .PP The .I undelete -mode takes the files either matching the regular expression (option -m) -or specified by the inode-expressions and recovers as much of the data +mode takes the files either matching the regular expression (option \-m) +or specified by the inode\-expressions and recovers as much of the data as possible. It saves the result to another location. Partly for safety, but mostly because NTFS write support isn't finished. .SS Copy @@ -90,39 +87,28 @@ correct last modified date, or something unexpected. .SH OPTIONS Below is a summary of all the options that .B ntfsundelete -accepts. All options have two equivalent names. The short name is preceded by -.BR \- +accepts. Nearly all options have two equivalent names. The short name is +preceded by +.B \- and the long name is preceded by .BR \-\- . Any single letter options, that don't take an argument, can be combined into a single command, e.g. -.BR \-fv +.B \-fv is equivalent to .BR "\-f \-v" . Long named options can be abbreviated to any unique prefix of their name. .TP -.BI "\-b " NUM -.br -.ns -.TP -.BI "\-\-byte " NUM +\fB\-b\fR, \fB\-\-byte\fR NUM If any clusters of the file cannot be recovered, the missing parts will be filled with this byte. The default is zeros. .TP -.B \-C -.br -.ns -.TP -.B \-\-case +\fB\-C\fR, \fB\-\-case\fR When scanning an NTFS volume, any filename matching (using the .B \-\-match option) is case\-insensitive. This option makes the matching case\-sensitive. .TP -.BI "\-c " RANGE -.br -.ns -.TP -.BI "\-\-copy " RANGE +\fB\-c\fR, \fB\-\-copy\fR RANGE This wizard's option will write a block of MFT FILE records to a file. The default file is .I mft @@ -133,89 +119,59 @@ and .B \-\-destination options. .TP -.BI "\-d " DIR -.br -.ns -.TP -.BI "\-\-destination " DIR +\fB\-d\fR, \fB\-\-destination\fR DIR This option controls where to put the output file of the .B \-\-undelete and .B \-\-copy options. .TP -.B \-f -.br -.ns -.TP -.B \-\-force +\fB\-f\fR, \fB\-\-force\fR This will override some sensible defaults, such as not overwriting an existing file. Use this option with caution. .TP -.B \-h -.br -.ns -.TP -.B \-\-help +\fB\-h\fR, \fB\-\-help\fR Show a list of options with a brief description of each one. .TP -.BI "\-i " RANGE -.br -.ns -.TP -.BI "\-\-inodes " RANGE +\fB\-i\fR, \fB\-\-inodes\fR RANGE Recover the files with these inode numbers. .I RANGE can be a single inode number, several numbers separated by commas "," or a -range separated by a dash "-". +range separated by a dash "\-". .TP -.BI "\-m " PATTERN -.br -.ns -.TP -.BI "\-\-match " PATTERN -Filter the output by only looking for matching filenames. The pattern can include the -wildcards '?', match exactly one character or '*', match zero or more -characters. By default the matching is case\-insensitive. To make the search -case sensitive, use the +\fB\-m\fR, \fB\-\-match\fR PATTERN +Filter the output by only looking for matching filenames. The pattern can +include the wildcards '?', match exactly one character or '*', match zero or +more characters. By default the matching is case\-insensitive. To make the +search case sensitive, use the .B \-\-case option. .TP -.BI "\-o " FILE -.br -.ns +\fB\-O\fR, \fB\-\-optimistic\fR +Recover parts of the file even if they are currently marked as in use. .TP -.BI "\-\-output " FILE +\fB\-o\fR, \fB\-\-output\fR FILE Use this option to set name of output file that .B \-\-undelete or .B \-\-copy will create. .TP -.BI "\-p " NUM -.br -.ns +\fB\-P\fR, \fB\-\-parent\fR +Display the parent directory of a deleted file. .TP -.BI "\-\-percentage " NUM +\fB\-p\fR, \fB\-\-percentage\fR NUM Filter the output of the .B \-\-scan option, by only matching files with a certain amount of recoverable content. .B Please read the caveats section for more details. .TP -.BI \-q -.br -.ns -.TP -.BI \-\-quiet +\fB\-q\fR, \fB\-\-quiet\fR Reduce the amount of output to a minimum. Naturally, it doesn't make sense to combine this option with .BR \-\-scan . .TP -.B \-s -.br -.ns -.TP -.B \-\-scan +\fB\-s\fR, \fB\-\-scan\fR Search through an NTFS volume and print a list of files that could be recovered. This is the default action of .BR ntfsundelete . @@ -232,29 +188,23 @@ The output of scan will be: .sp .nf Inode Flags %age Date Size Filename - 6038 FN.. 93% 2002-07-17 26629 thesis.doc + 6038 FN.. 93% 2002\-07\-17 26629 thesis.doc .fi .TS +box; lB lB l l. Flag Description F/D File/Directory -N/R (Non-)Resident data stream +N/R (Non\-)Resident data stream C/E Compressed/Encrypted data stream ! Missing attributes .TE -.RS .sp -.br +.sp The percentage field shows how much of the file can potentially be recovered. -.sp -.br -.RE -.BI "\-S " RANGE -.br -.ns .TP -.BI "\-\-size " RANGE +\fB\-S\fR, \fB\-\-size\fR RANGE Filter the output of the .B \-\-scan option, by looking for a particular range of file sizes. The range may be @@ -262,39 +212,27 @@ specified as two numbers separated by a '\-'. The sizes may be abbreviated using the suffixes k, m, g, t, for kilobytes, megabytes, gigabytes and terabytes respectively. .TP -.BI "\-t " SINCE -.br -.ns -.TP -.BI "\-\-time " SINCE +\fB\-t\fR, \fB\-\-time\fR SINCE Filter the output of the .B \-\-scan option. Only match files that have been altered since this time. The time must be given as number using a suffix of d, w, m, y for days, weeks, months or years ago. .TP -.BI \-T -.br -.ns -.TP -.BI \-\-truncate +\fB\-T\fR, \fB\-\-truncate\fR If -.BR ntfsundelete +.B ntfsundelete is confident about the size of a deleted file, then it will restore the file to exactly that size. The default behaviour is to round up the size to the nearest cluster (which will be a multiple of 512 bytes). .TP -.BI "\-u " -.br -.ns -.TP -.BI "\-\-undelete " +\fB\-u\fR, \fB\-\-undelete\fR Select .B undelete mode. You can specify the files to be recovered using by using -.B --match +.B \-\-match or -.B --inodes +.B \-\-inodes options. This option can be combined with .BR \-\-output , .BR \-\-destination , @@ -305,21 +243,13 @@ When the file is recovered it will be given its original name, unless the .B "\-\-output" option is used. .TP -.B \-v -.br -.ns -.TP -.B \-\-verbose +\fB\-v\fR, \fB\-\-verbose\fR Increase the amount of output that .B ntfsundelete prints. .TP -.B \-V -.br -.ns -.TP -.B \-\-version -Show the version number, copyright and license +\fB\-V\fR, \fB\-\-version\fR +Show the version number, copyright and license for .BR ntfsundelete . .SH EXAMPLES Look for deleted files on /dev/hda1. @@ -331,7 +261,7 @@ Look for deleted files on /dev/hda1. Look for deleted documents on /dev/hda1. .RS .sp -.B ntfsundelete /dev/hda1 -s \-m '*.doc' +.B ntfsundelete /dev/hda1 \-s \-m '*.doc' .sp .RE Look for deleted files between 5000 and 6000000 bytes, with at least 90% of the @@ -350,38 +280,50 @@ Look for deleted files altered in the last two days Undelete inodes 2, 5 and 100 to 131 of device /dev/sda1 .RS .sp -.B ntfsundelete /dev/sda1 -u -i 2,5,100-131 +.B ntfsundelete /dev/sda1 \-u \-i 2,5,100\-131 .sp .RE Undelete inode number 3689, call the file 'work.doc' and put it in the user's home directory. .RS .sp -.B ntfsundelete /dev/hda1 \-u -i 3689 \-o work.doc \-d ~ +.B ntfsundelete /dev/hda1 \-u \-i 3689 \-o work.doc \-d ~ .sp .RE Save MFT Records 3689 to 3690 to a file 'debug' .RS .sp .B ntfsundelete /dev/hda1 \-c 3689\-3690 \-o debug +.sp .RE .SH BUGS -There are some small limitations to this program, but currently no known bugs. -If you find one, please send an email to +There are some small limitations to +.BR ntfsundelete , +but currently no known bugs. If you find a bug please send an email describing +the problem to the development team: +.br .nh - +linux\-ntfs\-dev@lists.sourceforge.net .hy .SH AUTHORS .B ntfsundelete -was written by Richard Russon (FlatCap) and Holger Ohmacht. +was written by Richard Russon and Holger Ohmacht, with contributions from Anton +Altaparmakov. .SH AVAILABILITY .B ntfsundelete -is part of the ntfsprogs package and is available from +is part of the +.B ntfsprogs +package and is available from: .br .nh -http://linux\-ntfs.sourceforge.net/downloads.html +http://www.linux\-ntfs.org/content/view/19/37 +.hy +.sp +The manual pages are available online at: +.br +.nh +http://wiki.linux\-ntfs.org/doku.php?id=man .hy .SH SEE ALSO .BR ntfsinfo (8), .BR ntfsprogs (8) - From c7c229bd15bc7f83d1a9eab021bbf596dbbe82e8 Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 22 Nov 2005 00:17:23 +0000 Subject: [PATCH 2773/2994] more minor manual mending --- ntfsprogs/mkntfs.8.in | 2 +- ntfsprogs/ntfsclone.8.in | 92 +++++++++++++++---------------- ntfsprogs/ntfscp.8.in | 2 +- ntfsprogs/ntfsfix.8.in | 6 +-- ntfsprogs/ntfsls.8.in | 5 +- ntfsprogs/ntfsmount.8.in | 17 ++++-- ntfsprogs/ntfsprogs.8.in | 2 +- ntfsprogs/ntfsresize.8.in | 105 ++++++++++++++++++------------------ ntfsprogs/ntfsundelete.8.in | 4 +- 9 files changed, 121 insertions(+), 114 deletions(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 633f9b75..faf86720 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -8,7 +8,7 @@ mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system .SH SYNOPSIS .B mkntfs [\fIoptions\fR] \fIdevice \fR[\fInumber\-of\-sectors\fR] -.P +.PP .B mkntfs [ .B \-C diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 8c161173..6a46f51b 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -24,12 +24,12 @@ ntfsclone \- Efficiently clone, image, restore or rescue an NTFS .I SOURCE .SH DESCRIPTION .B ntfsclone -will efficiently clone (copy, save, backup, restore) or rescue an NTFS -filesystem to a sparse file, image, device (partition) or standard output. +will efficiently clone (copy, save, backup, restore) or rescue an NTFS +filesystem to a sparse file, image, device (partition) or standard output. It works at disk sector level and -copies only the used data. Unused disk space becomes zero (cloning to +copies only the used data. Unused disk space becomes zero (cloning to sparse file), encoded with control codes (saving in special image format), -left unchanged (cloning to a disk/partition) or +left unchanged (cloning to a disk/partition) or filled with zeros (cloning to standard output). .B ntfsclone can be useful to make backups, an exact snapshot of an NTFS filesystem @@ -55,31 +55,31 @@ The holes are always read as zeros. All major Linux filesystem like, ext2, ext3, reiserfs, Reiser4, JFS and XFS, supports sparse files but for example the ISO 9600 CD\-ROM filesystem doesn't. .SS Handling Large Sparse Files -As of today Linux provides inadequate support for managing (tar, -cp, gzip, gunzip, bzip2, bunzip2, cat, etc) large sparse files. +As of today Linux provides inadequate support for managing (tar, +cp, gzip, gunzip, bzip2, bunzip2, cat, etc) large sparse files. The only main Linux filesystem -having support for efficient sparse file handling is XFS by the -XFS_IOC_GETBMAPX +having support for efficient sparse file handling is XFS by the +XFS_IOC_GETBMAPX .BR ioctl . However none of the common utilities supports it. -This means when you tar, cp, gzip, bzip2, etc a large sparse file -they will always read the entire file, even if you use the "sparse support" -options. -.BR bzip2 -compresses large sparse files much better than -.BR gzip -but it does so +This means when you tar, cp, gzip, bzip2, etc a large sparse file +they will always read the entire file, even if you use the "sparse support" +options. +.B bzip2 +compresses large sparse files much better than +.B gzip +but it does so also much slower. Moreover neither of them handles large sparse -files efficiently during uncompression from disk space usage point -of view. +files efficiently during uncompression from disk space usage point +of view. At present the most efficient way, both speed and space\-wise, to -compress and uncompress large sparse files by common tools -is using -.BR tar -with the options -.B \-S +compress and uncompress large sparse files by common tools +is using +.B tar +with the options +.B \-S (handle sparse files "efficiently") and -.B \-j +.B \-j (filter the archive through bzip2). Although .B tar still reads and analyses the entire file, it doesn't pass on the @@ -87,12 +87,12 @@ large data blocks having only zeros to filters and it also avoids writing large amount of zeros to the disk needlessly. But since .B tar can't create an archive from the standard input, you can't do this -in\-place by just reading +in\-place by just reading .B ntfsclone standard output. .SS The Special Image Format -It's also possible, actually it's recommended, to save an NTFS filesystem -to a special image format. +It's also possible, actually it's recommended, to save an NTFS filesystem +to a special image format. Instead of representing unallocated blocks as holes, they are encoded using control codes. Thus, the image saves space without requiring sparse file support. The image format is ideal for streaming @@ -109,7 +109,7 @@ option. To restore an image, use the or the .B \-\-restore\-image option. Note that you can restore images from standard input by -using '\-' as the +using '\-' as the .I SOURCE file. .SS Metadata\-only Cloning @@ -126,7 +126,7 @@ The metadata\-only image can be compressed very well, usually to not more than 1\-3 MB thus it's relatively easy to transfer for investigation, troubleshooting. In this mode of ntfsclone, -.B NONE +.B NONE of the user's data is saved, including the resident user's data embedded into metadata. All is filled with zeros. Moreover all the file timestamps, deleted and unused spaces inside @@ -151,21 +151,21 @@ is equivalent to Long named options can be abbreviated to any unique prefix of their name. .TP \fB\-o\fR, \fB\-\-output\fR FILE -Clone NTFS to the non\-existent +Clone NTFS to the non\-existent .IR FILE . -If -.I FILE -is '\-' then clone to the +If +.I FILE +is '\-' then clone to the standard output. .TP \fB\-O\fR, \fB\-\-overwrite\fR FILE -Clone NTFS to +Clone NTFS to .IR FILE , overwriting if exists. .TP \fB\-s\fR, \fB\-\-save\-image\fR Save to the special image format. This is the most efficient way space and -speed\-wise if imaging is done to the standard output, e.g. for image +speed\-wise if imaging is done to the standard output, e.g. for image compression, encryption or streaming through a network. .TP \fB\-r\fR, \fB\-\-restore\-image\fR @@ -178,31 +178,31 @@ is '\-' then the image is read from the standard input. \fB\-\-rescue\fR Ignore disk read errors so disks having bad sectors, e.g. dying disks, can be rescued the most efficiently way, with minimal stress on them. Ntfsclone works -at the lowest, sector level in this mode too thus more data can be rescued. -The contents of the unreadable sectors are filled by character '?' and the +at the lowest, sector level in this mode too thus more data can be rescued. +The contents of the unreadable sectors are filled by character '?' and the beginning of such sectors are marked by "BadSectoR\\0". .TP -.B \-m, \-\-metadata -Clone +\fB\-m\fR, \fB\-\-metadata\fR +Clone .B ONLY METADATA (for NTFS experts). Moreover only cloning to a file is allowed. You can't metadata\-only clone to a device, image or standard output. .TP \fB\-\-ignore\-fs\-check\fR Ignore the result of the filesystem consistency check. This option is allowed -to be used only with the -\fB\-m\fR, \fB\-\-metadata\fR -option, for the safety of user's data. The clusters which cause the +to be used only with the +.B \-\-metadata +option, for the safety of user's data. The clusters which cause the inconsistency are saved too. .TP \fB\-f\fR, \fB\-\-force\fR -Forces ntfsclone to proceed if the filesystem is marked +Forces ntfsclone to proceed if the filesystem is marked "dirty" for consistency check. .TP \fB\-h\fR, \fB\-\-help\fR Show a list of options with a brief description of each one. .SH EXIT CODES -The exit code is 0 on success, non\-zero otherwise. +The exit code is 0 on success, non\-zero otherwise. .SH EXAMPLES Save an NTFS to a file in the special image format .RS @@ -213,7 +213,7 @@ Save an NTFS to a file in the special image format Restore an NTFS from a special image file to its original partition .RS .sp -.B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 backup.img +.B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 backup.img .sp .RE Save an NTFS into a compressed image. @@ -278,9 +278,9 @@ development team: linux\-ntfs\-dev@lists.sourceforge.net .hy .sp -Sometimes it might appear ntfsclone froze if the clone is on ReiserFS +Sometimes it might appear ntfsclone froze if the clone is on ReiserFS and even CTRL\-C won't stop it. This is not a bug in ntfsclone, however -it's due to ReiserFS being extremely inefficient creating large +it's due to ReiserFS being extremely inefficient creating large sparse files and not handling signals during this operation. This ReiserFS problem was improved in kernel 2.4.22. XFS, JFS and ext3 don't have this problem. diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in index 7ae6230a..a9af11f8 100644 --- a/ntfsprogs/ntfscp.8.in +++ b/ntfsprogs/ntfscp.8.in @@ -24,7 +24,7 @@ is directory and specified by inode number then unnamed data attribute is created for this inode and .B source_file is copied into it (WARNING: it's unusual to have unnamed data streams in the -directories, think twice before specifying directory by inode number). +directories, think twice before specifying directory by inode number). .SH OPTIONS Below is a summary of all the options that .B ntfscp diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index d95a1fb9..0585dbf6 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -10,7 +10,7 @@ ntfsfix \- fix common errors and force Windows to check NTFS [\fIoptions\fR] \fIdevice\fR .SH DESCRIPTION .B ntfsfix -is a utility that fixes some common NTFS problems. +is a utility that fixes some common NTFS problems. .B ntfsfix is .B NOT @@ -18,8 +18,8 @@ a Linux version of chkdsk. It only repairs some fundamental NTFS inconsistencies, resets the NTFS journal file and schedules an NTFS consistency check for the first boot into Windows. .sp -You may run -.B ntfsfix +You may run +.B ntfsfix on an NTFS volume if you think it's damaged and it can't be mounted. .SH OPTIONS Below is a summary of all the options that diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index 74c07e62..17ef59f9 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -79,7 +79,7 @@ is used to list information about the files specified by the option (the root directory by default). .I DEVICE is the special file corresponding to the device (e.g -.IR /dev/hdXX ) +.IR /dev/hdXX ) or an NTFS image file. .SH OPTIONS Below is a summary of all the options that @@ -108,7 +108,7 @@ Force execution. For example necessary to run on an NTFS partition stored in a normal file. .TP \fB\-h\fR, \fB\-\-help\fR -Print the usage information of +Print the usage information of .B ntfsls and exit. .TP @@ -133,7 +133,6 @@ Show the contents of all directories beneath the specified directory. Unless this options is specified, all files beginning with a dollar sign character will not be listed as these files are usually system files. .TP -.B \-v, \-\-verbose \fB\-v\fR, \fB\-\-verbose\fR Display more debug/warning/error messages. .TP diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index d84d899a..37888398 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -6,7 +6,11 @@ .SH NAME ntfsmount \- NTFS module for FUSE. .SH SYNOPSIS -.BI "ntfsmount " device " " mount_point " [\-o " options "]" +.B ntfsmount +.I device mount_point +[ +.B \-o options +] .SH DESCRIPTION .B ntfsmount is a @@ -134,14 +138,17 @@ are not set before partitions from /etc/fstab had been mounted. .B streams_interface= This option controls how the user can access named data streams. It can be set to, one of -.BR none ", " windows " or " xattr . +.BR none , +.B windows +or +.BR xattr . If the option is set to -.BR "none" , +.BR none , the user will have no access to the named data streams. If it's set to -.BR "windows" , +.BR windows , then the user can access them just like in Windows (eg. cat file:stream). If it's set to -.BR "xattr" , +.BR xattr , then the named data streams are mapped to xattrs and user can manipulate them using .B {get,set}fattr diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index 8fc797b6..d349fcba 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -34,7 +34,7 @@ available for free and come with full source code. .SS ntfsfix .PP .BR ntfsfix (8) -: Check and fix some common errors, clear the LogFile and make Windows +: Check and fix some common errors, clear the LogFile and make Windows perform a thorough check next time it boots. .SS ntfsinfo .PP diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 196896b5..3cfc7f8b 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -8,7 +8,7 @@ ntfsresize \- resize an NTFS filesystem without data loss .SH SYNOPSIS .B ntfsresize [\fIOPTIONS\fR] -.B \-\-info +.B \-\-info .I DEVICE .br .B ntfsresize @@ -18,11 +18,11 @@ ntfsresize \- resize an NTFS filesystem without data loss .SH DESCRIPTION The .B ntfsresize -program safely resizes Windows XP, Windows Server 2003, Windows 2000, Windows +program safely resizes Windows XP, Windows Server 2003, Windows 2000, Windows NT4 and Longhorn NTFS filesystems without data loss. All NTFS versions are supported, used by 32\-bit and 64\-bit Windows. -.B Defragmentation is NOT required prior to resizing -because the program can relocate any data if needed, without risking data +.B Defragmentation is NOT required prior to resizing +because the program can relocate any data if needed, without risking data integrity. .PP Ntfsresize can be used to shrink or enlarge any NTFS filesystem located @@ -43,13 +43,13 @@ parameter is given in kilo\-, mega\- or gigabytes respectively. .B Ntfsresize conforms to the SI, ATA, IEEE standards and the disk manufacturers by using k=10^3, M=10^6 and G=10^9. -If both +If both .B \-\-info and .B \-\-size -are omitted then the -NTFS filesystem will be enlarged to the underlying -.I DEVICE +are omitted then the +NTFS filesystem will be enlarged to the underlying +.I DEVICE size. .PP To resize a filesystem on a partition, you must resize BOTH the filesystem @@ -60,15 +60,15 @@ doesn't manipulate the size of the partitions, hence to do that you must use a disk partitioning tool as well, for example .BR fdisk (8). Alternatively you could use one of the many user friendly partitioners that -uses +uses .B ntfsresize internally, like Mandriva's DiskDrake, QTParted, SUSE/Novell's YaST Partitioner, IBM's EVMS, GParted or Debian/Ubuntu's Partman. .PP .B IMPORTANT! -It's a good practice making REGULAR BACKUPS of your valuable data, especially +It's a good practice making REGULAR BACKUPS of your valuable data, especially before using ANY partitioning tools. To do so for NTFS, you could use -.BR ntfsclone (8). +.BR ntfsclone (8). Don't forget to save the partition table as well! .SS Shrinkage If you wish to shrink an NTFS partition, first use @@ -77,12 +77,12 @@ to shrink the size of the filesystem. Then you could use .BR fdisk (8) to shrink the size of the partition by deleting the partition and recreating it with the smaller size. -Do not make the partition smaller than the new size of -NTFS otherwise you won't be able to boot. If you did so notwithstanding +Do not make the partition smaller than the new size of +NTFS otherwise you won't be able to boot. If you did so notwithstanding then just recreate the partition to be as large as NTFS. .SS Enlargement To enlarge an NTFS filesystem, first you must enlarge the size of the -underlying partition. This can be done using +underlying partition. This can be done using .BR fdisk (8) by deleting the partition and recreating it with a larger size. Make sure it will not overlap with an other existing partition. @@ -91,10 +91,10 @@ Then you may use to enlarge the size of the filesystem. .SS Partitioning When recreating the partition by a disk partitioning tool, -make sure you create it at the same +make sure you create it at the same starting sector and with the same partition type as before. Otherwise you won't be able to access your filesystem. Use the 'u' -fdisk command to switch to the reliable sector unit from the +fdisk command to switch to the reliable sector unit from the default cylinder one. Also make sure you set the bootable flag for the partition if it existed before. Failing to do so you might not be able to boot your @@ -115,17 +115,18 @@ is equivalent to Long named options can be abbreviated to any unique prefix of their name. .TP \fB\-i\fR, \fB\-\-info\fR -By using this option ntfsresize will determine the theoretically smallest -shrunken filesystem size supported. Most of the time the result is the space -already used on the filesystem. Ntfsresize will refuse shrinking to a -smaller size than what you got by this option and depending on several +By using this option ntfsresize will determine the theoretically smallest +shrunken filesystem size supported. Most of the time the result is the space +already used on the filesystem. Ntfsresize will refuse shrinking to a +smaller size than what you got by this option and depending on several factors it might be unable to shrink very close to this theoretical size. Although the integrity of your data should be never in risk, it's still strongly recommended to make a test run by using the +.TP \fB\-n\fR, \fB\-\-no\-action\fR -option before real resizing. +option before real resizing. Practically the smallest shrunken size generally is -at around "used space" + (20\-200 MB). Please also take into account +at around "used space" + (20\-200 MB). Please also take into account that Windows might need about 50\-100 MB free space left to boot safely. This option never causes any changes to the filesystem, the partition is opened read\-only. @@ -146,11 +147,11 @@ first. .TP \fB\-f\fR, \fB\-\-force\fR Forces ntfsresize to proceed with the resize operation even if the filesystem -is marked for consistency check. +is marked for consistency check. Please note, ntfsresize always marks the filesystem -for consistency check before a real resize operation -and it leaves that way for extra -safety. Thus if NTFS was marked by ntfsresize then it's safe to +for consistency check before a real resize operation +and it leaves that way for extra +safety. Thus if NTFS was marked by ntfsresize then it's safe to use this option. If you need to resize several times without booting into Windows between each resizing steps then you must use this option. @@ -159,19 +160,19 @@ resizing steps then you must use this option. Use this option to make a test run before doing the real resize operation. Volume will be opened read\-only and .B ntfsresize -displays what it would do if it were to resize the filesystem. +displays what it would do if it were to resize the filesystem. Continue with the real resizing only if the test run passed. .TP \fB\-b\fR, \fB\-\-bad\-sectors\fR Support disks having hardware errors, bad sectors with those .B ntfsresize -would refuse to work by default. +would refuse to work by default. Prior using this option, it's strongly recommended to make a backup by .BR ntfsclone (8) -using the \-\-rescue option, then running 'chkdsk /f /r volume:' on Windows +using the \-\-rescue option, then running 'chkdsk /f /r volume:' on Windows from the command line. If the disk guarantee is still valid then replace it. It's defected. Please also note, that no software can repair these type of -hardware errors. The most what they can do is to work around the permanent +hardware errors. The most what they can do is to work around the permanent defects. This option doesn't have any effect if the disk is flawless. .TP @@ -189,44 +190,44 @@ and exit. \fB\-h\fR, \fB\-\-help\fR Display help and exit. .SH EXIT CODES -The exit code is 0 on success, non\-zero otherwise. +The exit code is 0 on success, non\-zero otherwise. .SH BUGS -No reliability problem is known. If you need -help please try the Ntfsresize FAQ first (see below) and if you -don't find your answer then send your question, comment or bug report to +No reliability problem is known. If you need +help please try the Ntfsresize FAQ first (see below) and if you +don't find your answer then send your question, comment or bug report to the development team: .br .nh linux\-ntfs\-dev@lists.sourceforge.net .hy .PP -There are a few very rarely met restrictions at present: filesystems having +There are a few very rarely met restrictions at present: filesystems having unknown bad sectors, relocation of the first MFT extent and resizing into the middle of a $MFTMirr extent -aren't supported yet. These cases are detected and -resizing is restricted to a safe size or the closest safe +aren't supported yet. These cases are detected and +resizing is restricted to a safe size or the closest safe size is displayed. .PP .B Ntfsresize schedules an NTFS consistency check and after the first boot into Windows you must see -.B chkdsk +.B chkdsk running on a blue background. This is intentional and no need to worry about it. Windows may force a quick reboot after the consistency check. -Moreover after repartitioning your disk and depending on the +Moreover after repartitioning your disk and depending on the hardware configuration, the Windows message .B System Settings Change may also appear. Just acknowledge it and reboot again. .PP -The disk geometry handling semantic (HDIO_GETGEO ioctl) has changed -in an incompatible way in Linux 2.6 kernels and this triggered multitudinous +The disk geometry handling semantic (HDIO_GETGEO ioctl) has changed +in an incompatible way in Linux 2.6 kernels and this triggered multitudinous partition table corruptions resulting in unbootable Windows systems, even if -NTFS was consistent, if +NTFS was consistent, if .BR parted (8) -was involved in some way. This problem was often attributed to ntfsresize -but in fact it's completely independent of NTFS thus ntfsresize. Moreover +was involved in some way. This problem was often attributed to ntfsresize +but in fact it's completely independent of NTFS thus ntfsresize. Moreover ntfsresize never touches the partition table at all. By changing -the 'Disk Access Mode' to LBA in the BIOS makes booting work +the 'Disk Access Mode' to LBA in the BIOS makes booting work again, most of the time. You can find more information about this issue in the Troubleshooting section of the below referred Ntfsresize FAQ. .SH AUTHORS @@ -235,15 +236,15 @@ was written by Szabolcs Szakacsits, with contributions from Anton Altaparmakov and Richard Russon. .SH ACKNOWLEDGEMENT Many thanks to Anton Altaparmakov and Richard Russon -for libntfs, the excellent documentation and comments, -to Gergely Madarasz, Dewey M. Sasser and Miguel Lastra and his colleagues -at the University of Granada for their continuous and highly valuable help, -furthermore to Erik Meade, Martin Fick, Sandro Hawke, Dave Croal, -Lorrin Nelson, Geert Hendrickx, Robert Bjorkman and Richard Burdick +for libntfs, the excellent documentation and comments, +to Gergely Madarasz, Dewey M. Sasser and Miguel Lastra and his colleagues +at the University of Granada for their continuous and highly valuable help, +furthermore to Erik Meade, Martin Fick, Sandro Hawke, Dave Croal, +Lorrin Nelson, Geert Hendrickx, Robert Bjorkman and Richard Burdick for beta testing the relocation support, to Florian Eyben, Fritz Oppliger, Richard Ebling, Sid\-Ahmed Touati, Jan Kiszka, Benjamin Redelings, Christopher Haney, Ryan Durk, Ralf Beyer for the valued -contributions and to Theodore Ts'o whose +contributions and to Theodore Ts'o whose .BR resize2fs (8) man page originally formed the basis of this page. .SH AVAILABILITY @@ -263,7 +264,7 @@ http://wiki.linux\-ntfs.org/doku.php?id=man .hy .sp .B Ntfsresize -related news, example of usage, troubleshooting, statically linked binary and +related news, example of usage, troubleshooting, statically linked binary and FAQ (frequently asked questions) are maintained at: .br .nh diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index 852d4c5c..2cee5a70 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -231,7 +231,7 @@ Select .B undelete mode. You can specify the files to be recovered using by using .B \-\-match -or +or .B \-\-inodes options. This option can be combined with .BR \-\-output , @@ -240,7 +240,7 @@ and .BR \-\-byte . .sp When the file is recovered it will be given its original name, unless the -.B "\-\-output" +.B \-\-output option is used. .TP \fB\-v\fR, \fB\-\-verbose\fR From 493b3a6bcd13410cca77f0275e0f0d583bd87515 Mon Sep 17 00:00:00 2001 From: flatcap Date: Tue, 22 Nov 2005 01:14:36 +0000 Subject: [PATCH 2774/2994] minor corrections --- ntfsprogs/ntfsmount.8.in | 40 ++++++++++++++++++++++------------------ ntfsprogs/ntfsmount.c | 2 +- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 37888398..119eafe6 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -154,24 +154,28 @@ using .B {get,set}fattr utilities. .SH DATA STREAMS -All data on NTFS is stored in streams, which can have names. -A file can have more than one data streams, but exactly one must have no name. -The size of a file is the size of its unnamed data stream. -Usually when you don't specify stream name you are access to the unnamed data -stream. -If you want access to named data stream you need to add ":stream_name" to the -filename. For example: by opening "some.mp3:artist" you will open stream -"artist" in "some.mp3". -But windows usually prevent you from accessing to named data streams, -so you need to use some program like FAR or utils from cygwin to access named -data streams. +All data on NTFS is stored in streams. Every file has exactly one unnamed +data stream and can have many named data streams. The size of a file is the +size of its unnamed data stream. By default, +.B ntfsmount +will only read the unnamed data stream. +.PP +By using the options "streams_interface=windows", you will be able to read +any named data streams, simply by specifying the stream's name after a colon. +For example: +.RS .sp -NTFS FUSE module don't prevent you from accessing to named data streams so you -can use your preferred utils to access them. You can even delete them using -.B rm. -You can list all named data streams by getting "ntfs.streams.list" extended -attribute. NOTE: The last feature is unique for NTFS FUSE module and maybe -will be never supported by kernel driver. +cat some.mp3:artist +.sp +.RE +Windows applications don't, consistently, allow you to read named data +streams, so you are recommended to use tools like FAR, or utils from Cygwin. +.PP +Named data streams act like normals files, so you can read from them, write to +them and even delete them (using rm). You can list all the named data streams +a file has by getting the "ntfs.streams.list" extended attribute. NOTE: This +list feature is unique to the NTFS FUSE module and may never be supported by the +kernel driver. .SH EXAMPLES Mount /dev/hda1 to /mnt/ntfs\-fuse using ntfsmount: .RS @@ -233,7 +237,7 @@ linux\-ntfs\-dev@lists.sourceforge.net .hy .SH AUTHORS .B ntfsmount -was written by Yura Pakhuchiy, with contributions from Anton Altaparmakov. +was written by Yura Pakhuchiy, with contributions from Yuval Fledel. .SH DEDICATION With love to Marina Sapego. .SH THANKS diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 64d0cbf6..1138422f 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1,8 +1,8 @@ /** * ntfsmount - Part of the Linux-NTFS project. * - * Copyright (c) 2005 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2005 Yuval Fledel * * NTFS module for FUSE. * From a0b6ee09883cea1bd41614652bfe7283450d8cc9 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 23 Nov 2005 09:13:43 +0000 Subject: [PATCH 2775/2994] CIA test commit --- test/runlist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/test/runlist.c b/test/runlist.c index 330751d0..11fcf2d6 100644 --- a/test/runlist.c +++ b/test/runlist.c @@ -5,3 +5,4 @@ int main (int argc, char *argv[]) { return test_rl_main (argc, argv); } + From eee85bf430b5cdb55ce4c3d0f8884262364f07b3 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 23 Nov 2005 09:15:01 +0000 Subject: [PATCH 2776/2994] revert last commit and test multiline commit message. --- test/runlist.c | 1 - 1 file changed, 1 deletion(-) diff --git a/test/runlist.c b/test/runlist.c index 11fcf2d6..330751d0 100644 --- a/test/runlist.c +++ b/test/runlist.c @@ -5,4 +5,3 @@ int main (int argc, char *argv[]) { return test_rl_main (argc, argv); } - From c960ae5994d957749e6245ab3a43f0ba1e3fad68 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 23 Nov 2005 09:16:10 +0000 Subject: [PATCH 2777/2994] one more test --- test/runlist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/test/runlist.c b/test/runlist.c index 330751d0..11fcf2d6 100644 --- a/test/runlist.c +++ b/test/runlist.c @@ -5,3 +5,4 @@ int main (int argc, char *argv[]) { return test_rl_main (argc, argv); } + From 398004a863f0966b29a6cd1cb64dd46fe5ca45eb Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 23 Nov 2005 09:17:13 +0000 Subject: [PATCH 2778/2994] cool! it works as expected --- test/runlist.c | 1 - 1 file changed, 1 deletion(-) diff --git a/test/runlist.c b/test/runlist.c index 11fcf2d6..330751d0 100644 --- a/test/runlist.c +++ b/test/runlist.c @@ -5,4 +5,3 @@ int main (int argc, char *argv[]) { return test_rl_main (argc, argv); } - From ce1aabed3b13a34f090550632e585995880e43dd Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 24 Nov 2005 14:23:38 +0000 Subject: [PATCH 2779/2994] FreeBSD and Cygwin do not know about MS_NOATIME too. Fix this. --- include/ntfs/volume.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index 285b156e..c3c36cb4 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -41,13 +41,17 @@ #include #endif -/* Both under Cygwin and DJGPP we do not have MS_RDONLY, so we define it. */ +/* + * Under Cygwin, DJGPP and FreeBSD we do not have MS_RDONLY and MS_NOATIME, + * so we define them ourselves. + */ #if !defined(MS_RDONLY) /** * enum MS_MOUNT - */ typedef enum { MS_RDONLY = 1, + MS_NOATIME, } MS_MOUNT; #endif From e0787d09836a87ea867ad1e6e4b9f2162947b9fe Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 24 Nov 2005 15:06:11 +0000 Subject: [PATCH 2780/2994] ntfsmount: Mark information about free MFT records and clusters outdate after write operations everywhere. --- ntfsprogs/ntfsmount.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 1138422f..62d54036 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -814,6 +814,8 @@ static int ntfs_fuse_mknod(const char *org_path, mode_t mode, dev_t dev) else res = ntfs_fuse_create_stream(path, stream_name, stream_name_len); + /* Mark information about free MFT record and clusters outdate. */ + ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); exit: free(path); if (stream_name_len) @@ -826,6 +828,8 @@ static int ntfs_fuse_symlink(const char *to, const char *from) if (strchr(from, ':') && /* n/a for named data streams. */ ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; + /* Mark information about free MFT record and clusters outdate. */ + ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); return ntfs_fuse_create(from, S_IFLNK, 0, to); } @@ -869,6 +873,8 @@ static int ntfs_fuse_link(const char *old_path, const char *new_path) res = -EIO; goto exit; } + /* Mark information about free MFT record and clusters outdate. */ + ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); /* Create hard link. */ if (ntfs_link(ni, dir_ni, uname, uname_len)) res = -errno; @@ -969,6 +975,8 @@ static int ntfs_fuse_unlink(const char *org_path) res = ntfs_fuse_rm(path); else res = ntfs_fuse_rm_stream(path, stream_name, stream_name_len); + /* Mark information about free MFT record and clusters outdate. */ + ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); free(path); if (stream_name_len) free(stream_name); @@ -993,6 +1001,8 @@ static int ntfs_fuse_mkdir(const char *path, { if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; /* n/a for named data streams. */ + /* Mark information about free MFT record and clusters outdate. */ + ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); return ntfs_fuse_create(path, S_IFDIR, 0, NULL); } @@ -1000,6 +1010,8 @@ static int ntfs_fuse_rmdir(const char *path) { if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; /* n/a for named data streams. */ + /* Mark information about free MFT record and clusters outdate. */ + ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); return ntfs_fuse_rm(path); } @@ -1245,6 +1257,8 @@ static int ntfs_fuse_setxattr(const char *path, const char *name, res = -EEXIST; goto exit; } + /* Mark information about free MFT record and clusters outdate. */ + ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); if (!na) { if (flags == XATTR_REPLACE) { res = -ENODATA; @@ -1304,6 +1318,8 @@ static int ntfs_fuse_removexattr(const char *path, const char *name) res = -ENODATA; goto exit; } + /* Mark information about free MFT record and clusters outdate. */ + ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); if (ntfs_attr_rm(na)) res = -errno; else From 25c31eb40b62237a53870b5695bc8df66086e63e Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 25 Nov 2005 14:31:29 +0000 Subject: [PATCH 2781/2994] ntfsmount: add static inline to mark free space outdated (Thanks Szaka) --- ntfsprogs/ntfsmount.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 62d54036..c7b6de71 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -183,6 +183,12 @@ static long ntfs_fuse_get_nr_free_clusters(ntfs_volume *vol) return nr_free; } +static __inline__ void ntfs_fuse_mark_free_space_outdate() +{ + /* Mark information about free MFT record and clusters outdate. */ + ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); +} + /** * ntfs_fuse_statfs - return information about mounted NTFS volume * @path: ignored (but fuse requires it) @@ -645,7 +651,7 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size, } res = total; exit: - ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + ntfs_fuse_mark_free_space_outdate(); if (na) ntfs_attr_close(na); if (ni && ntfs_inode_close(ni)) @@ -681,7 +687,7 @@ static int ntfs_fuse_truncate(const char *org_path, off_t size) goto exit; } res = ntfs_attr_truncate(na, size); - ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + ntfs_fuse_mark_free_space_outdate(); ntfs_attr_close(na); exit: if (ni && ntfs_inode_close(ni)) @@ -814,8 +820,7 @@ static int ntfs_fuse_mknod(const char *org_path, mode_t mode, dev_t dev) else res = ntfs_fuse_create_stream(path, stream_name, stream_name_len); - /* Mark information about free MFT record and clusters outdate. */ - ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + ntfs_fuse_mark_free_space_outdate(); exit: free(path); if (stream_name_len) @@ -828,8 +833,7 @@ static int ntfs_fuse_symlink(const char *to, const char *from) if (strchr(from, ':') && /* n/a for named data streams. */ ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; - /* Mark information about free MFT record and clusters outdate. */ - ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + ntfs_fuse_mark_free_space_outdate(); return ntfs_fuse_create(from, S_IFLNK, 0, to); } @@ -873,8 +877,7 @@ static int ntfs_fuse_link(const char *old_path, const char *new_path) res = -EIO; goto exit; } - /* Mark information about free MFT record and clusters outdate. */ - ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + ntfs_fuse_mark_free_space_outdate(); /* Create hard link. */ if (ntfs_link(ni, dir_ni, uname, uname_len)) res = -errno; @@ -975,8 +978,7 @@ static int ntfs_fuse_unlink(const char *org_path) res = ntfs_fuse_rm(path); else res = ntfs_fuse_rm_stream(path, stream_name, stream_name_len); - /* Mark information about free MFT record and clusters outdate. */ - ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + ntfs_fuse_mark_free_space_outdate(); free(path); if (stream_name_len) free(stream_name); @@ -1001,8 +1003,7 @@ static int ntfs_fuse_mkdir(const char *path, { if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; /* n/a for named data streams. */ - /* Mark information about free MFT record and clusters outdate. */ - ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + ntfs_fuse_mark_free_space_outdate(); return ntfs_fuse_create(path, S_IFDIR, 0, NULL); } @@ -1010,8 +1011,7 @@ static int ntfs_fuse_rmdir(const char *path) { if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; /* n/a for named data streams. */ - /* Mark information about free MFT record and clusters outdate. */ - ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + ntfs_fuse_mark_free_space_outdate(); return ntfs_fuse_rm(path); } @@ -1257,8 +1257,7 @@ static int ntfs_fuse_setxattr(const char *path, const char *name, res = -EEXIST; goto exit; } - /* Mark information about free MFT record and clusters outdate. */ - ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + ntfs_fuse_mark_free_space_outdate(); if (!na) { if (flags == XATTR_REPLACE) { res = -ENODATA; @@ -1318,8 +1317,7 @@ static int ntfs_fuse_removexattr(const char *path, const char *name) res = -ENODATA; goto exit; } - /* Mark information about free MFT record and clusters outdate. */ - ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); + ntfs_fuse_mark_free_space_outdate(); if (ntfs_attr_rm(na)) res = -errno; else From c5bceb84de56f5dabb222e0ac38674bd8abf095a Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 26 Nov 2005 01:08:12 +0000 Subject: [PATCH 2782/2994] ntfs_get_attribute_value(): report in error what's the non-zero attribute flags --- libntfs/attrib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 0282cdea..a086cd29 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -105,8 +105,8 @@ s64 ntfs_get_attribute_value(const ntfs_volume *vol, } /* Complex attribute? */ if (a->flags) { - ntfs_log_debug("Encountered non-zero attribute flags. Cannot handle " - "this yet.\n"); + ntfs_log_error("Non-zero (%04x) attribute flags. Cannot handle " + "this yet.\n", le16_to_cpu(a->flags)); errno = EOPNOTSUPP; return 0; } From 7e9f1270e2014550669481939cb759e205188f29 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 26 Nov 2005 01:46:20 +0000 Subject: [PATCH 2783/2994] clean up --- ntfsprogs/ntfsprogs.8.in | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index d349fcba..615f459d 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -3,7 +3,7 @@ .\" Copyright (c) 2005 Szabolcs Szakacsits. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSPROGS 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH NTFSPROGS 8 "2005\-11\-26" "ntfsprogs version @VERSION@" .SH NAME ntfsprogs \- several tools for doing neat things with NTFS partitions .SH OVERVIEW @@ -11,56 +11,44 @@ ntfsprogs \- several tools for doing neat things with NTFS partitions is a suite of NTFS utilities based around a shared library. The tools are available for free and come with full source code. .SH TOOLS -.SS mkntfs .PP .BR mkntfs (8) -: Format a partition using NTFS. -.SS ntfscat +\- Format a partition using NTFS. .PP .BR ntfscat (8) -: Dump a file's contents to the standard output. -.SS ntfsclone +\- Dump a file's contents to the standard output. .PP .BR ntfsclone (8) -: Efficiently clone, create, restore or rescue an image of an NTFS partition. -.SS ntfscluster +\- Efficiently clone, create, restore or rescue an image of an NTFS partition. .PP .BR ntfscluster (8) -: Locate the owner of any given sector or cluster on an NTFS partition. -.SS ntfscp +\- Locate the owner of any given sector or cluster on an NTFS partition. .PP .BR ntfscp (8) -: Overwrite file on an NTFS partition. -.SS ntfsfix +\- Overwrite file on an NTFS partition. .PP .BR ntfsfix (8) -: Check and fix some common errors, clear the LogFile and make Windows +\- Check and fix some common errors, clear the LogFile and make Windows perform a thorough check next time it boots. -.SS ntfsinfo .PP .BR ntfsinfo (8) -: Show some information about an NTFS partition or one of the files +\- Show some information about an NTFS partition or one of the files or directories within it. -.SS ntfslabel .PP .BR ntfslabel (8) -: Show, or set, an NTFS partition's volume label. -.SS ntfsls +\- Show, or set, an NTFS partition's volume label. .PP .BR ntfsls (8) -: List information about files in a directory residing on an NTFS partition. -.SS ntfsmount +\- List information about files in a directory residing on an NTFS partition. .PP .BR ntfsmount (8) -: NTFS module for FUSE. -.SS ntfsresize +\- NTFS module for FUSE. .PP .BR ntfsresize (8) -: Resize an NTFS partition without losing data. -.SS ntfsundelete +\- Resize an NTFS partition without losing data. .PP .BR ntfsundelete (8) -: Recover deleted files from an NTFS partition. +\- Recover deleted files from an NTFS partition. .SH AUTHORS .PP The tools were written by Anton Altaparmakov, Carmelo Kintana, Cristian Klein, From f1a50e9bd8daaba53de621f3b3a4ae62bc6fdfc9 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 26 Nov 2005 17:58:17 +0000 Subject: [PATCH 2784/2994] Removed old logging macro usage --- ntfsprogs/ntfscmp.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c index f123ddd7..11a6c09b 100644 --- a/ntfsprogs/ntfscmp.c +++ b/ntfsprogs/ntfscmp.c @@ -63,10 +63,6 @@ struct progress_bar { #define PERR_PREFIX ERR_PREFIX "(%d): " #define NERR_PREFIX ERR_PREFIX ": " -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stdout, &opt.verbose, TRUE) -GEN_PRINTF(Qprintf, stdout, NULL, FALSE) - __attribute__((format(printf, 2, 3))) static void perr_printf(int newline, const char *fmt, ...) { @@ -484,7 +480,7 @@ static void cmp_attribute_data(ntfs_attr *na1, ntfs_attr *na2) print_na(na1); printf("abrupt length: %lld != %lld ", na1->data_size, na2->data_size); - Vprintf("(count: %lld != %lld)", count1, count2); + printf("(count: %lld != %lld)", count1, count2); puts(""); return; } @@ -510,7 +506,8 @@ static void cmp_attribute_data(ntfs_attr *na1, ntfs_attr *na2) if (memcmp(buf1, buf2, count1)) { print_na(na1); printf("content"); - Vprintf(" (len = %lld)", count1); + if (opt.verbose) + printf(" (len = %lld)", count1); printf(": DIFFER\n"); return; } @@ -557,10 +554,13 @@ close_attribs: static void vprint_attribute(ATTR_TYPES atype, char *name) { - Vprintf("0x%x", atype); + if (!opt.verbose) + return; + + printf("0x%x", atype); if (name) - Vprintf(":%s", name); - Vprintf(" "); + printf(":%s", name); + printf(" "); } static void print_attributes(ntfs_inode *ni, @@ -569,10 +569,13 @@ static void print_attributes(ntfs_inode *ni, char *name1, char *name2) { - Vprintf("Walking inode %llu attributes: ", inumber(ni)); + if (!opt.verbose) + return; + + printf("Walking inode %llu attributes: ", inumber(ni)); vprint_attribute(atype1, name1); vprint_attribute(atype2, name2); - Vprintf("\n"); + printf("\n"); } static int new_name(ntfs_attr_search_ctx *ctx, char *prev_name) From 71c5c068b5fc67b89d714ee65f580f547a3c06c4 Mon Sep 17 00:00:00 2001 From: flatcap Date: Sat, 26 Nov 2005 23:53:22 +0000 Subject: [PATCH 2785/2994] use the new logging add a few function comments (to help folding) --- ntfsprogs/ntfsdecrypt.c | 272 ++++++++++++++++++++++++---------------- 1 file changed, 163 insertions(+), 109 deletions(-) diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 3f145bf4..3fe1ed77 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -74,8 +74,8 @@ typedef gcry_sexp_t ntfs_rsa_private_key; -/* - * List of crypto algorithms used by EFS (32-bit values). +/** + * enum NTFS_CRYPTO_ALGORITHMS - List of crypto algorithms used by EFS (32 bit) * * To choose which one is used in Windows, create or set the REG_DWORD registry * key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EFS\ @@ -96,7 +96,9 @@ typedef enum { CALG_AES_256 = const_cpu_to_le32(0x6610), } NTFS_CRYPTO_ALGORITHMS; -/* Decrypted, in-memory file encryption key. */ +/** + * struct ntfs_fek - Decrypted, in-memory file encryption key. + */ typedef struct { gcry_cipher_hd_t gcry_cipher_hd; u32 alg_id; @@ -127,11 +129,6 @@ struct options { static const char *EXEC_NAME = "ntfsdecrypt"; static struct options opts; -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stderr, &opts.verbose, TRUE) -GEN_PRINTF(Qprintf, stderr, &opts.quiet, FALSE) -static GEN_PRINTF(Printf, stderr, NULL, FALSE) - static ntfschar EFS[5] = { const_cpu_to_le16('$'), const_cpu_to_le16('E'), const_cpu_to_le16('F'), const_cpu_to_le16('S'), const_cpu_to_le16('\0') @@ -146,12 +143,12 @@ static ntfschar EFS[5] = { */ static void version(void) { - Printf("\n%s v%s (libntfs %s) - Decrypt files and print on the " + ntfs_log_info("\n%s v%s (libntfs %s) - Decrypt files and print on the " "standard output.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - Printf("Copyright (c) 2005 Yuval Fledel\n"); - Printf("Copyright (c) 2005 Anton Altaparmakov\n"); - Printf("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); + ntfs_log_info("Copyright (c) 2005 Yuval Fledel\n"); + ntfs_log_info("Copyright (c) 2005 Anton Altaparmakov\n"); + ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } /** @@ -163,7 +160,7 @@ static void version(void) */ static void usage(void) { - Printf("\nUsage: %s [options] -k name.pfx device [file]\n\n" + ntfs_log_info("\nUsage: %s [options] -k name.pfx device [file]\n\n" " -i, --inode num Display this inode\n\n" " -k --keyfile name.pfx Use file name as the user's private key file.\n" " -f --force Use less caution\n" @@ -172,7 +169,7 @@ static void usage(void) " -V --version Version information\n" " -v --verbose More output\n\n", EXEC_NAME); - Printf("%s%s\n", ntfs_bugs, ntfs_home); + ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } /** @@ -215,7 +212,8 @@ static int parse_options(int argc, char **argv) else if (!opts.file) opts.file = argv[optind - 1]; else { - Eprintf("You must specify exactly one file.\n"); + ntfs_log_error("You must specify exactly one " + "file.\n"); err++; } break; @@ -230,32 +228,35 @@ static int parse_options(int argc, char **argv) if (!opts.keyfile) opts.keyfile = argv[optind - 1]; else { - Eprintf("You must specify exactly one " + ntfs_log_error("You must specify exactly one " "key file.\n"); err++; } break; case 'i': if (opts.inode != -1) - Eprintf("You must specify exactly one " + ntfs_log_error("You must specify exactly one " "inode.\n"); else if (utils_parse_size(optarg, &opts.inode, FALSE)) break; else - Eprintf("Couldn't parse inode number.\n"); + ntfs_log_error("Couldn't parse inode number.\n"); err++; break; case 'q': opts.quiet++; + ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET); break; case 'V': ver++; break; case 'v': opts.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; default: - Eprintf("Unknown option '%s'.\n", argv[optind - 1]); + ntfs_log_error("Unknown option '%s'.\n", + argv[optind - 1]); err++; break; } @@ -263,24 +264,26 @@ static int parse_options(int argc, char **argv) if (help || ver) { opts.quiet = 0; + ntfs_log_set_levels(NTFS_LOG_LEVEL_QUIET); } else { if (!opts.keyfile) { - Eprintf("You must specify a key file.\n"); + ntfs_log_error("You must specify a key file.\n"); err++; } else if (opts.device == NULL) { - Eprintf("You must specify a device.\n"); + ntfs_log_error("You must specify a device.\n"); err++; } else if (opts.file == NULL && opts.inode == -1) { - Eprintf("You must specify a file or inode with the -i " - "option.\n"); + ntfs_log_error("You must specify a file or inode with " + "the -i option.\n"); err++; } else if (opts.file != NULL && opts.inode != -1) { - Eprintf("You can't specify both a file and inode.\n"); + ntfs_log_error("You can't specify both a file and " + "inode.\n"); err++; } if (opts.quiet && opts.verbose) { - Eprintf("You may not use --quiet and --verbose at the " - "same time.\n"); + ntfs_log_error("You may not use --quiet and --verbose " + "at the same time.\n"); err++; } } @@ -293,6 +296,9 @@ static int parse_options(int argc, char **argv) return (!err && !help && !ver); } +/** + * ntfs_pkcs12_load_pfxfile + */ static int ntfs_pkcs12_load_pfxfile(const char *keyfile, u8 **pfx, unsigned *pfx_size) { @@ -300,32 +306,33 @@ static int ntfs_pkcs12_load_pfxfile(const char *keyfile, u8 **pfx, struct stat key_stat; if (!keyfile || !pfx || !pfx_size) { - fprintf(stderr, "You have to specify the key file, a pointer " + ntfs_log_error("You have to specify the key file, a pointer " "to hold the key file contents, and a pointer " - "to hold the size of the key file contents."); + "to hold the size of the key file contents.\n"); return -1; } f = open(keyfile, O_RDONLY); if (f == -1) { - perror("Failed to open key file"); + ntfs_log_perror("Failed to open key file"); return -1; } if (fstat(f, &key_stat) == -1) { - perror("Failed to stat key file"); + ntfs_log_perror("Failed to stat key file"); goto file_out; } if (!S_ISREG(key_stat.st_mode)) { - fprintf(stderr, "Key file is not a regular file, cannot read " - "it."); + ntfs_log_error("Key file is not a regular file, cannot read " + "it.\n"); goto file_out; } if (!key_stat.st_size) { - fprintf(stderr, "Key file has zero size."); + ntfs_log_error("Key file has zero size.\n"); goto file_out; } *pfx = malloc(key_stat.st_size + 1); if (!*pfx) { - perror("Failed to allocate buffer for key file contents"); + ntfs_log_perror("Failed to allocate buffer for key file " + "contents"); goto file_out; } to_read = key_stat.st_size; @@ -333,7 +340,7 @@ static int ntfs_pkcs12_load_pfxfile(const char *keyfile, u8 **pfx, do { br = read(f, *pfx + total, to_read); if (br == -1) { - perror("Failed to read from key file"); + ntfs_log_perror("Failed to read from key file"); goto free_out; } if (!br) @@ -353,25 +360,31 @@ file_out: return -1; } +/** + * ntfs_crypto_init + */ static int ntfs_crypto_init(void) { int err; /* Initialize gcrypt library. Note: Must come before GNU TLS init. */ if (gcry_control(GCRYCTL_DISABLE_SECMEM, 0) != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to initialize the gcrypt library.\n"); + ntfs_log_error("Failed to initialize the gcrypt library.\n"); return -1; } /* Initialize GNU TLS library. Note: Must come after libgcrypt init. */ err = gnutls_global_init(); if (err < 0) { - fprintf(stderr, "Failed to initialize GNU TLS library: %s\n", + ntfs_log_error("Failed to initialize GNU TLS library: %s\n", gnutls_strerror(err)); return -1; } return 0; } +/** + * ntfs_crypto_deinit + */ static void ntfs_crypto_deinit(void) { gnutls_global_deinit(); @@ -382,6 +395,9 @@ static void ntfs_crypto_deinit(void) } } +/** + * ntfs_rsa_private_key_import_from_gnutls + */ static ntfs_rsa_private_key ntfs_rsa_private_key_import_from_gnutls( gnutls_x509_privkey_t priv_key) { @@ -394,7 +410,7 @@ static ntfs_rsa_private_key ntfs_rsa_private_key_import_from_gnutls( /* Extract the RSA parameters from the GNU TLS private key. */ if (gnutls_x509_privkey_export_rsa_raw(priv_key, &rd[0], &rd[1], &rd[2], &rd[3], &rd[4], &rd[5])) { - fprintf(stderr, "Failed to export rsa parameters. (Is the " + ntfs_log_error("Failed to export rsa parameters. (Is the " "key an RSA private key?)\n"); return NULL; } @@ -402,7 +418,7 @@ static ntfs_rsa_private_key ntfs_rsa_private_key_import_from_gnutls( for (i = 0; i < 6; i++) { if (gcry_mpi_scan(&rm[i], GCRYMPI_FMT_USG, rd[i].data, rd[i].size, &tmp_size) != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to convert RSA parameter %i " + ntfs_log_error("Failed to convert RSA parameter %i " "to mpi format (size %d)\n", i, rd[i].size); rsa_key = NULL; @@ -422,7 +438,7 @@ static ntfs_rsa_private_key ntfs_rsa_private_key_import_from_gnutls( "(private-key(rsa(n%m)(e%m)(d%m)(p%m)(q%m)(u%m)))", rm[0], rm[1], rm[2], rm[4], rm[3], rm[5]) != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to build RSA private key s-exp.\n"); + ntfs_log_error("Failed to build RSA private key s-exp.\n"); rsa_key = NULL; } /* Release the no longer needed mpi values. */ @@ -431,6 +447,9 @@ static ntfs_rsa_private_key ntfs_rsa_private_key_import_from_gnutls( return (ntfs_rsa_private_key)rsa_key; } +/** + * ntfs_pkcs12_extract_rsa_key + */ static ntfs_rsa_private_key ntfs_pkcs12_extract_rsa_key(u8 *pfx, int pfx_size, char *password) { @@ -444,7 +463,7 @@ static ntfs_rsa_private_key ntfs_pkcs12_extract_rsa_key(u8 *pfx, int pfx_size, /* Create a pkcs12 structure. */ err = gnutls_pkcs12_init(&pkcs12); if (err) { - fprintf(stderr, "Failed to initialize PKCS#12 structure: %s\n", + ntfs_log_error("Failed to initialize PKCS#12 structure: %s\n", gnutls_strerror(err)); return NULL; } @@ -453,7 +472,7 @@ static ntfs_rsa_private_key ntfs_pkcs12_extract_rsa_key(u8 *pfx, int pfx_size, dpfx.size = pfx_size; err = gnutls_pkcs12_import(pkcs12, &dpfx, GNUTLS_X509_FMT_DER, 0); if (err) { - fprintf(stderr, "Failed to convert the PFX file from DER to " + ntfs_log_error("Failed to convert the PFX file from DER to " "native PKCS#12 format: %s\n", gnutls_strerror(err)); goto out; @@ -473,14 +492,14 @@ retry_verify: password = NULL; goto retry_verify; } - fprintf(stderr, "Failed to verify the MAC (%s). Is the " + ntfs_log_error("Failed to verify the MAC (%s). Is the " "password correct?\n", gnutls_strerror(err)); goto out; } for (bag_index = 0; ; bag_index++) { err = gnutls_pkcs12_bag_init(&bag); if (err) { - fprintf(stderr, "Failed to initialize PKCS#12 Bag " + ntfs_log_error("Failed to initialize PKCS#12 Bag " "structure: %s\n", gnutls_strerror(err)); goto out; @@ -489,7 +508,7 @@ retry_verify: if (err) { if (err == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) break; - fprintf(stderr, "Failed to obtain Bag from PKCS#12 " + ntfs_log_error("Failed to obtain Bag from PKCS#12 " "structure: %s\n", gnutls_strerror(err)); goto bag_out; @@ -497,13 +516,13 @@ retry_verify: check_again: err = gnutls_pkcs12_bag_get_count(bag); if (err < 0) { - fprintf(stderr, "Failed to obtain Bag count: %s\n", + ntfs_log_error("Failed to obtain Bag count: %s\n", gnutls_strerror(err)); goto bag_out; } err = gnutls_pkcs12_bag_get_type(bag, 0); if (err < 0) { - fprintf(stderr, "Failed to determine Bag type: %s\n", + ntfs_log_error("Failed to determine Bag type: %s\n", gnutls_strerror(err)); goto bag_out; } @@ -514,13 +533,13 @@ check_again: case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: err = gnutls_pkcs12_bag_get_data(bag, 0, &dkey); if (err < 0) { - fprintf(stderr, "Failed to obtain Bag data: " + ntfs_log_error("Failed to obtain Bag data: " "%s\n", gnutls_strerror(err)); goto bag_out; } err = gnutls_x509_privkey_init(&pkey); if (err) { - fprintf(stderr, "Failed to initialized " + ntfs_log_error("Failed to initialized " "private key structure: %s\n", gnutls_strerror(err)); goto bag_out; @@ -529,7 +548,7 @@ check_again: err = gnutls_x509_privkey_import_pkcs8(pkey, &dkey, GNUTLS_X509_FMT_DER, password, flags); if (err) { - fprintf(stderr, "Failed to convert private " + ntfs_log_error("Failed to convert private " "key from DER to GNU TLS " "format: %s\n", gnutls_strerror(err)); @@ -549,12 +568,14 @@ check_again: */ char *buf = malloc(8192); size_t bufsize = 8192; - err = gnutls_x509_privkey_export_pkcs8(pkey, GNUTLS_X509_FMT_PEM, "", GNUTLS_PKCS_PLAIN, buf, &bufsize); + err = gnutls_x509_privkey_export_pkcs8(pkey, + GNUTLS_X509_FMT_PEM, "", GNUTLS_PKCS_PLAIN, buf, + &bufsize); if (err) { - fprintf(stderr, "eek1\n"); + ntfs_log_error("eek1\n"); exit(1); } - fprintf(stderr, "%s\n", buf); + ntfs_log_error("%s\n", buf); free(buf); #endif /* Convert the private key to our internal format. */ @@ -563,7 +584,7 @@ check_again: case GNUTLS_BAG_ENCRYPTED: err = gnutls_pkcs12_bag_decrypt(bag, password); if (err) { - fprintf(stderr, "Failed to decrypt Bag: %s\n", + ntfs_log_error("Failed to decrypt Bag: %s\n", gnutls_strerror(err)); goto bag_out; } @@ -583,6 +604,9 @@ out: return rsa_key; } +/** + * ntfs_rsa_private_key_release + */ static void ntfs_rsa_private_key_release(ntfs_rsa_private_key rsa_key) { gcry_sexp_release((gcry_sexp_t)rsa_key); @@ -608,11 +632,11 @@ static inline void ntfs_buffer_reverse(u8 *buf, unsigned buf_size) } #ifndef HAVE_STRNLEN -/** +/** * strnlen - strnlen is a gnu extension so emulate it if not present - */ + */ static size_t strnlen(const char *s, size_t maxlen) -{ +{ const char *p, *end; /* Look for a '\0' character. */ @@ -640,7 +664,7 @@ static unsigned ntfs_raw_fek_decrypt(u8 *fek, u32 fek_size, /* Convert the FEK to internal MPI format. */ err = gcry_mpi_scan(&fek_mpi, GCRYMPI_FMT_USG, fek, fek_size, NULL); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to convert file encryption key to " + ntfs_log_error("Failed to convert file encryption key to " "internal MPI format: %s\n", gcry_strerror(err)); return 0; @@ -650,7 +674,7 @@ static unsigned ntfs_raw_fek_decrypt(u8 *fek, u32 fek_size, "(enc-val (flags) (rsa (a %m)))", fek_mpi); gcry_mpi_release(fek_mpi); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to create internal S-expression of " + ntfs_log_error("Failed to create internal S-expression of " "the file encryption key: %s\n", gcry_strerror(err)); return 0; @@ -659,7 +683,7 @@ static unsigned ntfs_raw_fek_decrypt(u8 *fek, u32 fek_size, err = gcry_pk_decrypt(&fek_sexp2, fek_sexp, (gcry_sexp_t)rsa_key); gcry_sexp_release(fek_sexp); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to decrypt the file encryption key: " + ntfs_log_error("Failed to decrypt the file encryption key: " "%s\n", gcry_strerror(err)); return 0; } @@ -667,7 +691,7 @@ static unsigned ntfs_raw_fek_decrypt(u8 *fek, u32 fek_size, fek_sexp = gcry_sexp_find_token(fek_sexp2, "value", 0); gcry_sexp_release(fek_sexp2); if (!fek_sexp) { - fprintf(stderr, "Failed to find the decrypted file encryption " + ntfs_log_error("Failed to find the decrypted file encryption " "key in the internal S-expression.\n"); return 0; } @@ -675,7 +699,7 @@ static unsigned ntfs_raw_fek_decrypt(u8 *fek, u32 fek_size, fek_mpi = gcry_sexp_nth_mpi(fek_sexp, 1, GCRYMPI_FMT_USG); gcry_sexp_release(fek_sexp); if (!fek_mpi) { - fprintf(stderr, "Failed to convert the decrypted file " + ntfs_log_error("Failed to convert the decrypted file " "encryption key S-expression to internal MPI " "format.\n"); return 0; @@ -684,7 +708,7 @@ static unsigned ntfs_raw_fek_decrypt(u8 *fek, u32 fek_size, err = gcry_mpi_print(GCRYMPI_FMT_USG, fek, fek_size, &size, fek_mpi); gcry_mpi_release(fek_mpi); if (err != GPG_ERR_NO_ERROR || !size) { - fprintf(stderr, "Failed to convert decrypted file encryption " + ntfs_log_error("Failed to convert decrypted file encryption " "key from internal MPI format to binary data: " "%s\n", gcry_strerror(err)); return 0; @@ -695,7 +719,7 @@ static unsigned ntfs_raw_fek_decrypt(u8 *fek, u32 fek_size, */ padding = strnlen((char *)fek, size) + 1; if (padding > size) { - fprintf(stderr, "Failed to remove PKCS#1 padding from " + ntfs_log_error("Failed to remove PKCS#1 padding from " "decrypted file encryption key.\n"); return 0; } @@ -723,7 +747,7 @@ static gcry_error_t ntfs_desx_key_expand(const u8 *src, u32 *des_key, err = gcry_md_open(&hd1, GCRY_MD_MD5, 0); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to open MD5 digest.\n"); + ntfs_log_error("Failed to open MD5 digest.\n"); return err; } /* Hash the on-disk key. */ @@ -731,7 +755,7 @@ static gcry_error_t ntfs_desx_key_expand(const u8 *src, u32 *des_key, /* Copy the current hash for efficiency. */ err = gcry_md_copy(&hd2, hd1); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to copy MD5 digest object.\n"); + ntfs_log_error("Failed to copy MD5 digest object.\n"); goto out; } /* Hash with the first salt and store the result. */ @@ -755,7 +779,7 @@ out: * @context: pointer to a variable of type ntfs_desx_ctx * @key: the 128 bit DES-X-MS128 key, concated with the DES handle * @keylen: must always be 16 - * + * * This is the libgcrypt set_key implementation for DES-X-MS128. */ static gcry_err_code_t ntfs_desx_setkey(void *context, const u8 *key, @@ -766,27 +790,27 @@ static gcry_err_code_t ntfs_desx_setkey(void *context, const u8 *key, u8 des_key[8]; if (keylen != 16) { - fprintf(stderr, "Key length for desx must be 16.\n"); + ntfs_log_error("Key length for desx must be 16.\n"); return GPG_ERR_INV_KEYLEN; } err = gcry_cipher_open(&ctx->gcry_cipher_hd, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to open des cipher (error 0x%x).\n", + ntfs_log_error("Failed to open des cipher (error 0x%x).\n", err); return err; } err = ntfs_desx_key_expand(key, (u32*)des_key, &ctx->out_whitening, &ctx->in_whitening); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to expand desx key (error 0x%x).\n", + ntfs_log_error("Failed to expand desx key (error 0x%x).\n", err); gcry_cipher_close(ctx->gcry_cipher_hd); return err; } err = gcry_cipher_setkey(ctx->gcry_cipher_hd, des_key, sizeof(des_key)); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to set des key (error 0x%x).\n", err); + ntfs_log_error("Failed to set des key (error 0x%x).\n", err); gcry_cipher_close(ctx->gcry_cipher_hd); return err; } @@ -799,6 +823,9 @@ static gcry_err_code_t ntfs_desx_setkey(void *context, const u8 *key, return GPG_ERR_NO_ERROR; } +/** + * ntfs_desx_decrypt + */ static void ntfs_desx_decrypt(void *context, u8 *outbuf, const u8 *inbuf) { ntfs_desx_ctx *ctx = context; @@ -806,12 +833,12 @@ static void ntfs_desx_decrypt(void *context, u8 *outbuf, const u8 *inbuf) err = gcry_cipher_reset(ctx->gcry_cipher_hd); if (err != GPG_ERR_NO_ERROR) - fprintf(stderr, "Failed to reset des cipher (error 0x%x).\n", + ntfs_log_error("Failed to reset des cipher (error 0x%x).\n", err); *(u64*)outbuf = *(const u64*)inbuf ^ ctx->out_whitening; err = gcry_cipher_encrypt(ctx->gcry_cipher_hd, outbuf, 8, NULL, 0); if (err != GPG_ERR_NO_ERROR) - fprintf(stderr, "Des decryption failed (error 0x%x).\n", err); + ntfs_log_error("Des decryption failed (error 0x%x).\n", err); *(u64*)outbuf ^= ctx->in_whitening; } @@ -829,6 +856,9 @@ static gcry_cipher_spec_t ntfs_desx_cipher = { #ifdef DO_CRYPTO_TESTS /* Do not remove this test code from this file! AIA */ +/** + * ntfs_desx_key_expand_test + */ static BOOL ntfs_desx_key_expand_test(void) { const u8 known_desx_on_disk_key[16] = { @@ -862,11 +892,14 @@ static BOOL ntfs_desx_key_expand_test(void) *(u64*)known_out_whitening && test_in_whitening == *(u64*)known_in_whitening; - fprintf(stderr, "Testing whether ntfs_desx_key_expand() works: %s\n", + ntfs_log_error("Testing whether ntfs_desx_key_expand() works: %s\n", res ? "SUCCESS" : "FAILED"); return res; } +/** + * ntfs_des_test + */ static BOOL ntfs_des_test(void) { const u8 known_des_key[8] = { @@ -886,14 +919,14 @@ static BOOL ntfs_des_test(void) err = gcry_cipher_open(&gcry_cipher_hd, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to open des cipher (error 0x%x).\n", + ntfs_log_error("Failed to open des cipher (error 0x%x).\n", err); return FALSE; } err = gcry_cipher_setkey(gcry_cipher_hd, known_des_key, sizeof(known_des_key)); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to set des key (error 0x%x.\n", err); + ntfs_log_error("Failed to set des key (error 0x%x.\n", err); gcry_cipher_close(gcry_cipher_hd); return FALSE; } @@ -905,24 +938,30 @@ static BOOL ntfs_des_test(void) sizeof(known_des_encrypted_data)); gcry_cipher_close(gcry_cipher_hd); if (err) { - fprintf(stderr, "Failed to des decrypt test data (error " + ntfs_log_error("Failed to des decrypt test data (error " "0x%x).\n", err); return FALSE; } res = !memcmp(test_decrypted_data, known_decrypted_data, sizeof(known_decrypted_data)); - fprintf(stderr, "Testing whether des decryption works: %s\n", + ntfs_log_error("Testing whether des decryption works: %s\n", res ? "SUCCESS" : "FAILED"); return res; } #else /* !defined(DO_CRYPTO_TESTS) */ +/** + * ntfs_desx_key_expand_test + */ static inline BOOL ntfs_desx_key_expand_test(void) { return TRUE; } +/** + * ntfs_des_test + */ static inline BOOL ntfs_des_test(void) { return TRUE; @@ -930,6 +969,9 @@ static inline BOOL ntfs_des_test(void) #endif /* !defined(DO_CRYPTO_TESTS) */ +/** + * ntfs_fek_import_from_raw + */ static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, unsigned fek_size __attribute__((unused))) { @@ -939,7 +981,7 @@ static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, // TODO: Sanity checking of sizes and offsets. key_size = le32_to_cpup(fek_buf); - //fprintf(stderr, "key_size 0x%x\n", key_size); + //ntfs_log_debug("key_size 0x%x\n", key_size); fek = malloc(((((sizeof(*fek) + 7) & ~7) + key_size + 7) & ~7) + sizeof(gcry_cipher_hd_t)); if (!fek) { @@ -947,7 +989,7 @@ static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, return NULL; } fek->alg_id = *(u32*)(fek_buf + 8); - //fprintf(stderr, "alg_id 0x%x\n", le32_to_cpu(fek->alg_id)); + //ntfs_log_debug("alg_id 0x%x\n", le32_to_cpu(fek->alg_id)); fek->key_data = (u8*)fek + ((sizeof(*fek) + 7) & ~7); memcpy(fek->key_data, fek_buf + 16, key_size); fek->des_gcry_cipher_hd_ptr = NULL; @@ -964,7 +1006,7 @@ static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, &ntfs_desx_algorithm_id, &ntfs_desx_module); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to register desx " + ntfs_log_error("Failed to register desx " "cipher: %s\n", gcry_strerror(err)); err = EINVAL; @@ -986,11 +1028,11 @@ static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, wanted_key_size = 8; gcry_algo = GCRY_CIPHER_DES; if (fek->alg_id == CALG_DES) - fprintf(stderr, "DES is not supported at present"); + ntfs_log_error("DES is not supported at present\n"); else - fprintf(stderr, "Unknown crypto algorithm 0x%x", + ntfs_log_error("Unknown crypto algorithm 0x%x\n", le32_to_cpu(fek->alg_id)); - fprintf(stderr, ". Please email linux-ntfs-dev@lists." + ntfs_log_error(". Please email linux-ntfs-dev@lists." "sourceforge.net and say that you saw this " "message. We will then try to implement " "support for this algorithm.\n"); @@ -998,7 +1040,7 @@ static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, goto out; } if (key_size != wanted_key_size) { - fprintf(stderr, "%s key of %u bytes but needed size is %u " + ntfs_log_error("%s key of %u bytes but needed size is %u " "bytes, assuming corrupt key. Aborting.\n", gcry_cipher_algo_name(gcry_algo), (unsigned)key_size, (unsigned)wanted_key_size); @@ -1008,14 +1050,14 @@ static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, err = gcry_cipher_open(&fek->gcry_cipher_hd, gcry_algo, GCRY_CIPHER_MODE_CBC, 0); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "gcry_cipher_open() failed: %s\n", + ntfs_log_error("gcry_cipher_open() failed: %s\n", gcry_strerror(err)); err = EINVAL; goto out; } err = gcry_cipher_setkey(fek->gcry_cipher_hd, fek->key_data, key_size); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "gcry_cipher_setkey() failed: %s\n", + ntfs_log_error("gcry_cipher_setkey() failed: %s\n", gcry_strerror(err)); gcry_cipher_close(fek->gcry_cipher_hd); err = EINVAL; @@ -1028,6 +1070,9 @@ out: return NULL; } +/** + * ntfs_fek_release + */ static void ntfs_fek_release(ntfs_fek *fek) { if (fek->des_gcry_cipher_hd_ptr) @@ -1036,6 +1081,9 @@ static void ntfs_fek_release(ntfs_fek *fek) free(fek); } +/** + * ntfs_df_array_fek_get + */ static ntfs_fek *ntfs_df_array_fek_get(EFS_DF_ARRAY_HEADER *df_array, ntfs_rsa_private_key rsa_key) { @@ -1064,10 +1112,10 @@ static ntfs_fek *ntfs_df_array_fek_get(EFS_DF_ARRAY_HEADER *df_array, fek = ntfs_fek_import_from_raw(fek_buf, fek_size); if (fek) return fek; - fprintf(stderr, "Failed to convert the decrypted file " + ntfs_log_error("Failed to convert the decrypted file " "encryption key to internal format.\n"); } else - fprintf(stderr, "Failed to decrypt the file " + ntfs_log_error("Failed to decrypt the file " "encryption key.\n"); df_header = (EFS_DF_HEADER*)((u8*)df_header + le32_to_cpu(df_header->df_length)); @@ -1089,17 +1137,17 @@ static ntfs_fek *ntfs_inode_fek_get(ntfs_inode *inode, /* Obtain the $EFS contents. */ na = ntfs_attr_open(inode, AT_LOGGED_UTILITY_STREAM, EFS, 4); if (!na) { - perror("Failed to open $EFS attribute"); + ntfs_log_perror("Failed to open $EFS attribute"); return NULL; } efs = malloc(na->data_size); if (!efs) { - perror("Failed to allocate internal buffer"); + ntfs_log_perror("Failed to allocate internal buffer"); ntfs_attr_close(na); return NULL; } if (ntfs_attr_pread(na, 0, na->data_size, efs) != na->data_size) { - perror("Failed to read $EFS attribute"); + ntfs_log_perror("Failed to read $EFS attribute"); free(efs); ntfs_attr_close(na); return NULL; @@ -1120,13 +1168,16 @@ static ntfs_fek *ntfs_inode_fek_get(ntfs_inode *inode, return fek; } +/** + * ntfs_fek_decrypt_sector + */ static int ntfs_fek_decrypt_sector(ntfs_fek *fek, u8 *data, const u64 offset) { gcry_error_t err; err = gcry_cipher_reset(fek->gcry_cipher_hd); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Failed to reset cipher: %s\n", + ntfs_log_error("Failed to reset cipher: %s\n", gcry_strerror(err)); return -1; } @@ -1138,7 +1189,7 @@ static int ntfs_fek_decrypt_sector(ntfs_fek *fek, u8 *data, const u64 offset) */ err = gcry_cipher_decrypt(fek->gcry_cipher_hd, data, 512, NULL, 0); if (err != GPG_ERR_NO_ERROR) { - fprintf(stderr, "Decryption failed: %s\n", gcry_strerror(err)); + ntfs_log_error("Decryption failed: %s\n", gcry_strerror(err)); return -1; } /* Apply the IV. */ @@ -1153,9 +1204,9 @@ static int ntfs_fek_decrypt_sector(ntfs_fek *fek, u8 *data, const u64 offset) } /** - * cat + * ntfs_cat_decrypt + * TODO: */ -// TODO: static int ntfs_cat_decrypt(ntfs_inode *inode, ntfs_fek *fek) { int bufsize = 512; @@ -1170,7 +1221,7 @@ static int ntfs_cat_decrypt(ntfs_inode *inode, ntfs_fek *fek) return 1; attr = ntfs_attr_open(inode, AT_DATA, NULL, 0); if (!attr) { - Eprintf("Cannot cat a directory.\n"); + ntfs_log_error("Cannot cat a directory.\n"); free(buffer); return 1; } @@ -1188,23 +1239,24 @@ static int ntfs_cat_decrypt(ntfs_inode *inode, ntfs_fek *fek) while (total > 0) { bytes_read = ntfs_attr_pread(attr, offset, 512, buffer); if (bytes_read == -1) { - perror("ERROR: Couldn't read file"); + ntfs_log_perror("ERROR: Couldn't read file"); break; } if (!bytes_read) break; if ((i = ntfs_fek_decrypt_sector(fek, buffer, offset)) < bytes_read) { - perror("ERROR: Couldn't decrypt all data!"); - Eprintf("%u/%lld/%lld/%lld\n", i, (long long)bytes_read, - (long long)offset, (long long)total); + ntfs_log_perror("ERROR: Couldn't decrypt all data!"); + ntfs_log_error("%u/%lld/%lld/%lld\n", i, + (long long)bytes_read, (long long)offset, + (long long)total); break; } if (bytes_read > total) bytes_read = total; written = fwrite(buffer, 1, bytes_read, stdout); if (written != bytes_read) { - perror("ERROR: Couldn't output all data!"); + ntfs_log_perror("ERROR: Couldn't output all data!"); break; } offset += bytes_read; @@ -1237,18 +1289,20 @@ int main(int argc, char *argv[]) unsigned pfx_size; int res; + ntfs_log_set_handler(ntfs_log_handler_stderr); + if (!parse_options(argc, argv)) return 1; utils_set_locale(); /* Initialize crypto in ntfs. */ if (ntfs_crypto_init()) { - fprintf(stderr, "Failed to initialize crypto. Aborting.\n"); + ntfs_log_error("Failed to initialize crypto. Aborting.\n"); return 1; } /* Load the PKCS#12 (.pfx) file containing the user's private key. */ if (ntfs_pkcs12_load_pfxfile(opts.keyfile, &pfx_buf, &pfx_size)) { - fprintf(stderr, "Failed to load key file. Aborting.\n"); + ntfs_log_error("Failed to load key file. Aborting.\n"); ntfs_crypto_deinit(); return 1; } @@ -1256,7 +1310,7 @@ int main(int argc, char *argv[]) password = getpass("Enter the password with which the private key was " "encrypted: "); if (!password) { - perror("Failed to obtain user password"); + ntfs_log_perror("Failed to obtain user password"); free(pfx_buf); ntfs_crypto_deinit(); return 1; @@ -1268,7 +1322,7 @@ int main(int argc, char *argv[]) /* No longer need the pfx file contents. */ free(pfx_buf); if (!rsa_key) { - fprintf(stderr, "Failed to extract the private RSA key. Did " + ntfs_log_error("Failed to extract the private RSA key. Did " "you perhaps mistype the password?\n"); ntfs_crypto_deinit(); return 1; @@ -1276,7 +1330,7 @@ int main(int argc, char *argv[]) /* Mount the ntfs volume. */ vol = utils_mount_volume(opts.device, MS_RDONLY, opts.force); if (!vol) { - fprintf(stderr, "Failed to mount ntfs volume. Aborting.\n"); + ntfs_log_error("Failed to mount ntfs volume. Aborting.\n"); ntfs_rsa_private_key_release(rsa_key); ntfs_crypto_deinit(); return 1; @@ -1287,7 +1341,7 @@ int main(int argc, char *argv[]) else inode = ntfs_pathname_to_inode(vol, NULL, opts.file); if (!inode) { - fprintf(stderr, "Failed to open encrypted file. Aborting.\n"); + ntfs_log_error("Failed to open encrypted file. Aborting.\n"); ntfs_umount(vol, FALSE); ntfs_rsa_private_key_release(rsa_key); ntfs_crypto_deinit(); @@ -1300,7 +1354,7 @@ int main(int argc, char *argv[]) res = ntfs_cat_decrypt(inode, fek); ntfs_fek_release(fek); } else { - fprintf(stderr, "Failed to obtain file encryption key. " + ntfs_log_error("Failed to obtain file encryption key. " "Aborting.\n"); res = 1; } From 93fabaf0c4de162407b70f5a2f37f6e1ad304e11 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 27 Nov 2005 11:38:06 +0000 Subject: [PATCH 2786/2994] Removed usage of the old logging macros --- ntfsprogs/ntfsresize.c | 64 +++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 1aa66db0..ea0d3d14 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -206,10 +206,6 @@ s64 max_free_cluster_range = 0; #define NTFS_MAX_CLUSTER_SIZE (65536) -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, stdout, &opt.verbose, TRUE) -GEN_PRINTF(Qprintf, stdout, NULL, FALSE) - static s64 rounded_up_division(s64 numer, s64 denom) { return (numer + (denom - 1)) / denom; @@ -492,15 +488,16 @@ static int parse_options(int argc, char **argv) break; case 'v': opt.verbose++; + ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE); break; case 'V': ver++; break; default: if (optopt == 's') { - Eprintf("Option '%s' requires an argument.\n", argv[optind-1]); + printf("Option '%s' requires an argument.\n", argv[optind-1]); } else { - Eprintf("Unknown option '%s'.\n", argv[optind-1]); + printf("Unknown option '%s'.\n", argv[optind-1]); } err++; break; @@ -510,13 +507,13 @@ static int parse_options(int argc, char **argv) if (!help && !ver) { if (opt.volume == NULL) { if (argc > 1) - Eprintf("You must specify exactly one device.\n"); + printf("You must specify exactly one device.\n"); err++; } if (opt.info) { opt.ro_flag = MS_RDONLY; if (opt.bytes) { - Eprintf(NERR_PREFIX "Options --info and --size " + printf(NERR_PREFIX "Options --info and --size " "can't be used together.\n"); usage(); } @@ -605,9 +602,9 @@ static int rl_items(runlist *rl) static void dump_run(runlist_element *r) { - Vprintf(" %8lld %8lld (0x%08llx) %lld\n", (long long)r->vcn, - (long long)r->lcn, (long long)r->lcn, - (long long)r->length); + ntfs_log_verbose(" %8lld %8lld (0x%08llx) %lld\n", (long long)r->vcn, + (long long)r->lcn, (long long)r->lcn, + (long long)r->length); } static void dump_runlist(runlist *rl) @@ -1150,7 +1147,7 @@ static void rl_fixup(runlist **rl) if (tmp->lcn == LCN_RL_NOT_MAPPED) { s64 unmapped_len = tmp->length; - Vprintf("Skip unmapped run at the beginning ...\n"); + ntfs_log_verbose("Skip unmapped run at the beginning ...\n"); if (!tmp->length) err_exit("Empty unmapped runlist! Please report!\n"); @@ -1161,7 +1158,7 @@ static void rl_fixup(runlist **rl) for (tmp = *rl; tmp->length; tmp++) { if (tmp->lcn == LCN_RL_NOT_MAPPED) { - Vprintf("Skip unmapped run at the end ...\n"); + ntfs_log_verbose("Skip unmapped run at the end ...\n"); if (tmp[1].length) err_exit("Unmapped runlist in the middle! " @@ -1201,28 +1198,29 @@ static void replace_attribute_runlist(ntfs_volume *vol, s64 remains_size; char *next_attr; - Vprintf("Enlarging attribute header ...\n"); + ntfs_log_verbose("Enlarging attribute header ...\n"); mp_size = (mp_size + 7) & ~7; - Vprintf("Old mp size : %d\n", l); - Vprintf("New mp size : %d\n", mp_size); - Vprintf("Bytes in use : %u\n", (unsigned int) - le32_to_cpu(ctx->mrec->bytes_in_use)); + ntfs_log_verbose("Old mp size : %d\n", l); + ntfs_log_verbose("New mp size : %d\n", mp_size); + ntfs_log_verbose("Bytes in use : %u\n", (unsigned int) + le32_to_cpu(ctx->mrec->bytes_in_use)); next_attr = (char *)a + le16_to_cpu(a->length); l = mp_size - l; - Vprintf("Bytes in use new : %u\n", l + (unsigned int) - le32_to_cpu(ctx->mrec->bytes_in_use)); - Vprintf("Bytes allocated : %u\n", (unsigned int) - le32_to_cpu(ctx->mrec->bytes_allocated)); + ntfs_log_verbose("Bytes in use new : %u\n", l + (unsigned int) + le32_to_cpu(ctx->mrec->bytes_in_use)); + ntfs_log_verbose("Bytes allocated : %u\n", (unsigned int) + le32_to_cpu(ctx->mrec->bytes_allocated)); remains_size = le32_to_cpu(ctx->mrec->bytes_in_use); remains_size -= (next_attr - (char *)ctx->mrec); - Vprintf("increase : %d\n", l); - Vprintf("shift : %lld\n", (long long)remains_size); + ntfs_log_verbose("increase : %d\n", l); + ntfs_log_verbose("shift : %lld\n", + (long long)remains_size); if (le32_to_cpu(ctx->mrec->bytes_in_use) + l > le32_to_cpu(ctx->mrec->bytes_allocated)) @@ -1322,8 +1320,8 @@ static int find_free_cluster(struct bitmap *bm, } if (rle->length < items && rle->length < max_free_cluster_range) { max_free_cluster_range = rle->length; - Vprintf("Max free range: %7lld \n", - (long long)max_free_cluster_range); + ntfs_log_verbose("Max free range: %7lld \n", + (long long)max_free_cluster_range); } pos = rle->lcn + items; if (pos == nr_vol_clusters) @@ -1370,7 +1368,7 @@ static runlist *alloc_cluster(struct bitmap *bm, rl_set(rl + runs, vcn, -1LL, 0LL); if (runs > 1) { - Vprintf("Multi-run allocation: \n"); + ntfs_log_verbose("Multi-run allocation: \n"); dump_runlist(rl); } return rl; @@ -1511,7 +1509,7 @@ static void rl_split_run(runlist **rl, int run, s64 pos) rl_set(rle_new, rle->vcn, rle->lcn, len_head); rl_set(rle_new + 1, rle->vcn + len_head, rle->lcn + len_head, len_tail); - Vprintf("Splitting run at cluster %lld:\n", (long long)pos); + ntfs_log_verbose("Splitting run at cluster %lld:\n", (long long)pos); dump_run(rle); dump_run(rle_new); dump_run(rle_new + 1); free(*rl); @@ -1574,8 +1572,8 @@ static void relocate_run(ntfs_resize_t *resize, runlist **rl, int run) resize->mref, lcn_length); /* FIXME: check $MFTMirr DATA isn't multi-run (or support it) */ - Vprintf("Relocate inode %7llu:0x%x:%08lld:0x%08llx --> 0x%08llx\n", - (unsigned long long)resize->mref, + ntfs_log_verbose("Relocate inode %7llu:0x%x:%08lld:0x%08llx --> " + "0x%08llx\n", (unsigned long long)resize->mref, (unsigned int)le32_to_cpu(resize->ctx->attr->type), (long long)lcn_length, (unsigned long long)lcn, (unsigned long long)relocate_rl->lcn); @@ -2037,7 +2035,7 @@ static int check_bad_sectors(ntfs_volume *vol) runlist *rl; s64 i, badclusters = 0; - Vprintf("Checking for bad sectors ...\n"); + ntfs_log_verbose("Checking for bad sectors ...\n"); lookup_data_attr(vol, FILE_BadClus, "$Bad", &ctx); @@ -2058,7 +2056,7 @@ static int check_bad_sectors(ntfs_volume *vol) continue; badclusters += rl[i].length; - Vprintf("Bad cluster: %8lld - %lld\n", rl[i].lcn, + ntfs_log_verbose("Bad cluster: %8lld - %lld\n", rl[i].lcn, rl[i].lcn + rl[i].length - 1); } @@ -2395,6 +2393,8 @@ int main(int argc, char **argv) s64 device_size; /* in bytes */ ntfs_volume *vol; + ntfs_log_set_handler(ntfs_log_handler_outerr); + printf("%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); From f827828d5caad00ca7cc824153836d16041bdc03 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 27 Nov 2005 11:51:10 +0000 Subject: [PATCH 2787/2994] All errors go to stdout either directly or by redirection from stderr --- ntfsprogs/ntfsresize.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index ea0d3d14..e8927972 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -523,10 +523,8 @@ static int parse_options(int argc, char **argv) /* Redirect stderr to stdout, note fflush()es are essential! */ fflush(stdout); fflush(stderr); - if (dup2(STDOUT_FILENO, STDERR_FILENO) == -1) { - perror("Failed to redirect stderr to stdout"); - exit(1); - } + if (dup2(STDOUT_FILENO, STDERR_FILENO) == -1) + perr_exit("Failed to redirect stderr to stdout"); fflush(stdout); fflush(stderr); From c940df90793bb979a479aaa12648d10fbabc3cb9 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 27 Nov 2005 12:31:39 +0000 Subject: [PATCH 2788/2994] remove usage of old logging macros --- ntfsprogs/ntfsclone.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 1bfd8052..d5e963ea 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -176,10 +176,16 @@ struct { #define read_all(f, p, n) io_all((f), (p), (n), 0) #define write_all(f, p, n) io_all((f), (p), (n), 1) -GEN_PRINTF(Eprintf, stderr, NULL, FALSE) -GEN_PRINTF(Vprintf, msg_out, &opt.verbose, TRUE) -GEN_PRINTF(Qprintf, msg_out, &opt.quiet, FALSE) -static GEN_PRINTF(Printf, msg_out, NULL, FALSE) +__attribute__((format(printf, 1, 2))) +static void Printf(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(msg_out, fmt, ap); + va_end(ap); + fflush(msg_out); +} __attribute__((format(printf, 1, 2))) static void perr_printf(const char *fmt, ...) @@ -241,7 +247,7 @@ static int perr_exit(const char *fmt, ...) __attribute__((noreturn)) static void usage(void) { - Eprintf("\nUsage: %s [OPTIONS] SOURCE\n" + fprintf(stderr, "\nUsage: %s [OPTIONS] SOURCE\n" " Efficiently clone NTFS to a sparse file, image, device or standard output.\n" "\n" " -o, --output FILE Clone NTFS to the non-existent FILE\n" @@ -260,7 +266,7 @@ static void usage(void) " If FILE is '-' then send the image to the standard output. If SOURCE is '-'\n" " and --restore-image is used then read the image from the standard input.\n" "\n", EXEC_NAME); - Eprintf("%s%s", ntfs_bugs, ntfs_home); + fprintf(stderr, "%s%s", ntfs_bugs, ntfs_home); exit(1); } @@ -1521,8 +1527,8 @@ int main(int argc, char **argv) unsigned int wiped_total = 0; /* print to stderr, stdout can be an NTFS image ... */ - Eprintf("%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, - ntfs_libntfs_version()); + fprintf(stderr, "%s v%s (libntfs %s)\n", EXEC_NAME, VERSION, + ntfs_libntfs_version()); msg_out = stderr; parse_options(argc, argv); From 22ff6e8c41e235b74d42b8af2fbeb066cd268687 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 27 Nov 2005 12:35:29 +0000 Subject: [PATCH 2789/2994] remove old, unused logging macros --- ntfsprogs/utils.h | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h index 95091590..480b03d0 100644 --- a/ntfsprogs/utils.h +++ b/ntfsprogs/utils.h @@ -42,41 +42,6 @@ extern const char *ntfs_bugs; extern const char *ntfs_home; extern const char *ntfs_gpl; -#define DEC_PRINTF(NAME) \ - int NAME(const char *format, ...) \ - __attribute__((format(printf, 1, 2))); - -#define GEN_PRINTF(NAME, STREAM, CONTROL, TRIGGER) \ - __attribute__((format(printf, 1, 2))) \ - int NAME(const char *format, ...) \ - { \ - int ret, olderr = errno, *control = (CONTROL); \ - va_list args; \ - \ - if (!(STREAM)) \ - return -1; \ - if (control && \ - ((*control && !(TRIGGER)) || (!*control && (TRIGGER)))) \ - return -1; \ - \ - va_start(args, format); \ - ret = vfprintf((STREAM), format, args); \ - va_end(args); \ - errno = olderr; \ - return ret; \ - } - - -/* utils.c's utilities require the following functions implemented. - * Example of implementation is: - * GEN_PRINTF(Eprintf, stderr, NULL, FALSE) - * GEN_PRINTF(Vprintf, stderr, &opts.verbose, TRUE) - * GEN_PRINTF(Qprintf, stderr, &opts.quiet, FALSE) - */ -extern DEC_PRINTF(Eprintf) -extern DEC_PRINTF(Vprintf) -extern DEC_PRINTF(Qprintf) - int utils_set_locale(void); int utils_parse_size(const char *value, s64 *size, BOOL scale); int utils_parse_range(const char *string, s64 *start, s64 *finish, BOOL scale); From 1a6c6417d907f7f4c4e332192b585b7e69081008 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 27 Nov 2005 15:26:02 +0000 Subject: [PATCH 2790/2994] improve readability --- ntfsprogs/ntfsmount.8.in | 47 ++++++++++------------------------------ 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 119eafe6..9a45fb6b 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -2,26 +2,16 @@ .\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSMOUNT 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH NTFSMOUNT 8 "2005\-11\-27" "ntfsprogs version @VERSION@" .SH NAME ntfsmount \- NTFS module for FUSE. .SH SYNOPSIS .B ntfsmount .I device mount_point -[ -.B \-o options -] +[\fB\-o options\fR] .SH DESCRIPTION -.B ntfsmount -is a -.B FUSE -module that rely on -.B libntfs. -You need -.B FUSE -to compile it, -.B xattr -is recommended, but not mandatory. +\fBntfsmount\fR is a \fBFUSE\fR module that rely on \fBlibntfs\fR. You need +\fBFUSE\fR to compile it, \fBxattr\fR is recommended, but not mandatory. .TP .B Fully implemented ntfsmount features are: \(bu Read\-write access to normal and sparse files. @@ -37,9 +27,7 @@ is recommended, but not mandatory. .br \(bu Hard link files. .SH OPTIONS -Below is a summary of all the options that -.B ntfsmount -accepts. +Below is a summary of all the options that \fBntfsmount\fR accepts. .TP .B uid=, gid=, umask= Provide default owner, group, and access mode mask. @@ -137,28 +125,17 @@ are not set before partitions from /etc/fstab had been mounted. .TP .B streams_interface= This option controls how the user can access named data streams. It can be set -to, one of -.BR none , -.B windows -or -.BR xattr . -If the option is set to -.BR none , -the user will have no access to the named data streams. If it's set to -.BR windows , -then the user can access them just like in Windows (eg. cat file:stream). -If it's set to -.BR xattr , -then the named data streams are mapped to xattrs and user can manipulate them -using -.B {get,set}fattr +to, one of \fBnone\fR, \fBwindows\fR or \fBxattr\fR. If the option is set to +\fBnone\fR, the user will have no access to the named data streams. If it's set +to \fBwindows\fR, then the user can access them just like in Windows (eg. cat +file:stream). If it's set to \fBxattr\fR, then the named data streams are +mapped to xattrs and user can manipulate them using \fB{get,set}fattr\fR utilities. .SH DATA STREAMS All data on NTFS is stored in streams. Every file has exactly one unnamed data stream and can have many named data streams. The size of a file is the -size of its unnamed data stream. By default, -.B ntfsmount -will only read the unnamed data stream. +size of its unnamed data stream. By default, \fBntfsmount\fR will only read +the unnamed data stream. .PP By using the options "streams_interface=windows", you will be able to read any named data streams, simply by specifying the stream's name after a colon. From 8afff2c7e25d120fb4a09cce8083dda4aed9dc64 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 27 Nov 2005 15:26:39 +0000 Subject: [PATCH 2791/2994] minor fix to usage output --- ntfsprogs/ntfsmount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index c7b6de71..ea6ad13e 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1599,8 +1599,8 @@ static void usage(void) ntfs_log_info("ntfsmount options are:\n\tforce\n\tno_def_opts\n\tumask" "\n\tfmask\n\tdmask\n\tuid\n\tgid\n\tshow_sys_files\n\t" "succeed_chmod\n\tlocale\n\tstreams_interface\n" - "Also look into FUSE documentation about it options.\n\n"); - ntfs_log_info("Default options are: \"%s\".\n", def_opts); + "Also look into FUSE documentation about it options.\n"); + ntfs_log_info("Default options are: \"%s\".\n\n", def_opts); ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } From 8298b35bc88cd724220f4816d11420ab69794942 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 27 Nov 2005 16:50:45 +0000 Subject: [PATCH 2792/2994] use ntfstime.h instead of time.h --- ntfsprogs/ntfsmount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index ea6ad13e..0419704c 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -51,7 +51,6 @@ #include #endif #include -#include #ifdef HAVE_SETXATTR #include @@ -66,6 +65,7 @@ #include "index.h" #include "utils.h" #include "version.h" +#include "ntfstime.h" #ifndef PATH_MAX #define PATH_MAX 4096 From c705170a5fcd1f79813660ffa94cd2e265ecf705 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 29 Nov 2005 17:57:53 +0000 Subject: [PATCH 2793/2994] ntfsmount: Add FreeBSD support. --- ntfsprogs/ntfsmount.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 0419704c..beb73e08 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -71,6 +71,14 @@ #define PATH_MAX 4096 #endif +#ifdef __FreeBSD__ +#undef FUSE_USE_VERSION +#define FUSE_USE_VERSION 25 +typedef struct statvfs nf_statfs; +#else +typedef struct statfs nf_statfs; +#endif /* __FreeBSD__ */ + typedef struct { fuse_fill_dir_t filler; void *buf; @@ -183,7 +191,7 @@ static long ntfs_fuse_get_nr_free_clusters(ntfs_volume *vol) return nr_free; } -static __inline__ void ntfs_fuse_mark_free_space_outdate() +static __inline__ void ntfs_fuse_mark_free_space_outdate(void) { /* Mark information about free MFT record and clusters outdate. */ ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); @@ -207,7 +215,7 @@ static __inline__ void ntfs_fuse_mark_free_space_outdate() * Return 0 on success or -errno on error. */ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), - struct statfs *sfs) + nf_statfs *sfs) { long size; ntfs_volume *vol; @@ -215,8 +223,10 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), vol = ctx->vol; if (!vol) return -ENODEV; +#ifndef __FreeBSD__ /* Type of filesystem. */ sfs->f_type = NTFS_SB_MAGIC; +#endif /* Optimal transfer block size. */ sfs->f_bsize = vol->cluster_size; /* @@ -239,7 +249,11 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), size = 0; sfs->f_ffree = size; /* Maximum length of filenames. */ +#ifndef __FreeBSD__ sfs->f_namelen = NTFS_MAX_NAME_LEN; +#else + sfs->f_namemax = NTFS_MAX_NAME_LEN; +#endif return 0; } From 172a8bbe4f0bd47e24354392d4c5f0cde3afa5e7 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 29 Nov 2005 18:00:06 +0000 Subject: [PATCH 2794/2994] oops, should do FUSE_USE_VERSION magic before including --- ntfsprogs/ntfsmount.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index beb73e08..7dfc1ec4 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -24,6 +24,11 @@ #include "config.h" +#ifdef __FreeBSD__ +#undef FUSE_USE_VERSION +#define FUSE_USE_VERSION 25 +#endif /* __FreeBSD__ */ + #include #ifdef HAVE_STDIO_H #include @@ -72,8 +77,6 @@ #endif #ifdef __FreeBSD__ -#undef FUSE_USE_VERSION -#define FUSE_USE_VERSION 25 typedef struct statvfs nf_statfs; #else typedef struct statfs nf_statfs; @@ -226,7 +229,7 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), #ifndef __FreeBSD__ /* Type of filesystem. */ sfs->f_type = NTFS_SB_MAGIC; -#endif +#endif /* __FreeBSD__ */ /* Optimal transfer block size. */ sfs->f_bsize = vol->cluster_size; /* @@ -253,7 +256,7 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), sfs->f_namelen = NTFS_MAX_NAME_LEN; #else sfs->f_namemax = NTFS_MAX_NAME_LEN; -#endif +#endif /* __FreeBSD__ */ return 0; } From bb864c9f981f9296bd678e9471a3b52607ea7e02 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 29 Nov 2005 18:03:28 +0000 Subject: [PATCH 2795/2994] update --- ntfsprogs/ntfsmount.8.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 9a45fb6b..9a7eb453 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -13,7 +13,7 @@ ntfsmount \- NTFS module for FUSE. \fBntfsmount\fR is a \fBFUSE\fR module that rely on \fBlibntfs\fR. You need \fBFUSE\fR to compile it, \fBxattr\fR is recommended, but not mandatory. .TP -.B Fully implemented ntfsmount features are: +.B Fully implemented ntfsmount features: \(bu Read\-write access to normal and sparse files. .br \(bu Read\-only access to compressed files. @@ -21,6 +21,8 @@ ntfsmount \- NTFS module for FUSE. \(bu Access to special Interix files (symlinks, devices, FIFOs). .br \(bu List/Read/Write/Add/Remove named data streams. +.br +\(bu Supports Linux and FreeBSD. .TP .B Partly implemented features: \(bu Create/Delete/Move files and directories. From 69240e3c50e43bee46086e6b33b5d37b2361ff0b Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 29 Nov 2005 20:47:44 +0000 Subject: [PATCH 2796/2994] Require FUSE-2.5.0 for FreeBSD --- configure.ac | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 1754521f..d33a5df9 100644 --- a/configure.ac +++ b/configure.ac @@ -204,14 +204,27 @@ AM_CONDITIONAL(ENABLE_GNOME_VFS, $compile_gnome_vfs) # Autodetect whether to build FUSE module or not. compile_fuse_module=false if test "$enable_fuse_module" != "no"; then - PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.3.0, [ compile_fuse_module=true ], - [ - if test "$enable_fuse_module" = "yes"; then - AC_MSG_ERROR([Linux-NTFS FUSE module requires FUSE version >= 2.3.0.]) - else - AC_MSG_WARN([Linux-NTFS FUSE module requires FUSE version >= 2.3.0.]) - fi - ]) + case "$target_os" in + linux*) + PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.3.0, [ compile_fuse_module=true ], + [ + if test "$enable_fuse_module" = "yes"; then + AC_MSG_ERROR([ntfsmount requires FUSE version >= 2.3.0.]) + else + AC_MSG_WARN([ntfsmount requires FUSE version >= 2.3.0.]) + fi + ]);; + freebsd*) + PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.5.0, [ compile_fuse_module=true ], + [ + if test "$enable_fuse_module" = "yes"; then + AC_MSG_ERROR([ntfsmount requires FUSE version >= 2.5.0.]) + else + AC_MSG_WARN([ntfsmount requires FUSE version >= 2.5.0.]) + fi + ]);; + *) AC_MSG_ERROR([ntfsmount can be built only under Linux and FreeBSD.]);; + esac fi AM_CONDITIONAL(ENABLE_FUSE_MODULE, $compile_fuse_module) From 3001c88d64ef6bd3fb5efd8d4afb651a0b1a737c Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 30 Nov 2005 16:54:11 +0000 Subject: [PATCH 2797/2994] Easier FreeBSD support, allow FUSE >= 2.3 for FreeBSD --- configure.ac | 6 +++--- ntfsprogs/ntfsmount.c | 15 +-------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index d33a5df9..41edbdb7 100644 --- a/configure.ac +++ b/configure.ac @@ -215,12 +215,12 @@ if test "$enable_fuse_module" != "no"; then fi ]);; freebsd*) - PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.5.0, [ compile_fuse_module=true ], + PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.3.0, [ compile_fuse_module=true ], [ if test "$enable_fuse_module" = "yes"; then - AC_MSG_ERROR([ntfsmount requires FUSE version >= 2.5.0.]) + AC_MSG_ERROR([ntfsmount requires FUSE version >= 2.3.0.]) else - AC_MSG_WARN([ntfsmount requires FUSE version >= 2.5.0.]) + AC_MSG_WARN([ntfsmount requires FUSE version >= 2.3.0.]) fi ]);; *) AC_MSG_ERROR([ntfsmount can be built only under Linux and FreeBSD.]);; diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 7dfc1ec4..e20e9c87 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -24,11 +24,6 @@ #include "config.h" -#ifdef __FreeBSD__ -#undef FUSE_USE_VERSION -#define FUSE_USE_VERSION 25 -#endif /* __FreeBSD__ */ - #include #ifdef HAVE_STDIO_H #include @@ -76,12 +71,6 @@ #define PATH_MAX 4096 #endif -#ifdef __FreeBSD__ -typedef struct statvfs nf_statfs; -#else -typedef struct statfs nf_statfs; -#endif /* __FreeBSD__ */ - typedef struct { fuse_fill_dir_t filler; void *buf; @@ -218,7 +207,7 @@ static __inline__ void ntfs_fuse_mark_free_space_outdate(void) * Return 0 on success or -errno on error. */ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), - nf_statfs *sfs) + struct statfs *sfs) { long size; ntfs_volume *vol; @@ -226,10 +215,8 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), vol = ctx->vol; if (!vol) return -ENODEV; -#ifndef __FreeBSD__ /* Type of filesystem. */ sfs->f_type = NTFS_SB_MAGIC; -#endif /* __FreeBSD__ */ /* Optimal transfer block size. */ sfs->f_bsize = vol->cluster_size; /* From 77fb717ef3cfe7085f5a364418e9ea09a1c68a87 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 30 Nov 2005 16:58:03 +0000 Subject: [PATCH 2798/2994] Fix warnings on FreeBSD --- ntfsprogs/ntfsmount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index e20e9c87..97bb0a66 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -87,8 +87,8 @@ typedef struct { int state; long free_clusters; long free_mft; - uid_t uid; - gid_t gid; + unsigned int uid; + unsigned int gid; mode_t fmask; mode_t dmask; ntfs_fuse_streams_interface streams; From d4872f5045d3ff760e3156795e9aa8e070fd2e3d Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 1 Dec 2005 13:15:49 +0000 Subject: [PATCH 2799/2994] ntfsmount: Mount point is optional parameter --- ntfsprogs/ntfsmount.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 97bb0a66..410ea4da 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1713,12 +1713,6 @@ static int parse_options(int argc, char *argv[]) err++; } - if (!opts.mnt_point) { - if (argc > 1) - ntfs_log_error("No mount point specified.\n"); - err++; - } - if (opts.quiet && opts.verbose) { ntfs_log_error("You may not use --quiet and --verbose " "at the same time.\n"); From eb1ab436d85f42c2525173060f83ff365c0ea4ae Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 1 Dec 2005 13:16:34 +0000 Subject: [PATCH 2800/2994] update --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 79b1d74c..1b9c045f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -91,6 +91,7 @@ xx/xx/2005 - 1.12.2-WIP - Add support of MS_NOATIME flag to ntfs_mount(). (Yura) - ntfsclone: --metadata also wipes out the timestamps in the $I30 and in the /$Extend/$Quota:$Q index root attributes. (Szaka) + - ntfsmount: Add FreeBSD support. (Yura) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. From 01787c8c548331b944873bf441e1316442a1e288 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 1 Dec 2005 20:44:18 +0000 Subject: [PATCH 2801/2994] update site --- README | 2 +- libntfs/libntfs-gnomevfs.8.in | 4 ++-- ntfsprogs.spec.in | 2 +- ntfsprogs/utils.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README b/README index 17ad7c1b..53b38536 100644 --- a/README +++ b/README @@ -22,7 +22,7 @@ The Linux-NTFS ntfsprogs package currently consists of the NTFS library (ntfsprogs). The Linux-NTFS home page is at: - http://linux-ntfs.sourceforge.net/ + http://www.linux-ntfs.org/ The SourceForge.net Linux-NTFS project page is at: http://sourceforge.net/projects/linux-ntfs/ diff --git a/libntfs/libntfs-gnomevfs.8.in b/libntfs/libntfs-gnomevfs.8.in index f365d61c..77c283fb 100644 --- a/libntfs/libntfs-gnomevfs.8.in +++ b/libntfs/libntfs-gnomevfs.8.in @@ -103,9 +103,9 @@ The .BR ntfsprogs package which contains the .BR libntfs-gnomevfs -module can be downloaded from http://linux-ntfs.sourceforge.net/downloads.html +module can be downloaded from http://www.linux-ntfs.org/content/view/19/37/ .BR -These manual pages can be viewed online at http://linux-ntfs.sourceforge.net/man/ntfsprogs.html +These manual pages can be viewed online at http://man.linux-ntfs.org/ntfsprogs.8.html .SH SEE ALSO .BR ntfsprogs (8) diff --git a/ntfsprogs.spec.in b/ntfsprogs.spec.in index d0b06308..f5374642 100644 --- a/ntfsprogs.spec.in +++ b/ntfsprogs.spec.in @@ -17,7 +17,7 @@ Packager : Anton Altaparmakov License : GPL Group : System Environment/Base %description -The Linux-NTFS project (http://linux-ntfs.sf.net/) aims to bring full support +The Linux-NTFS project (http://www.linux-ntfs.org/) aims to bring full support for the NTFS filesystem to the Linux operating system. The ntfsprogs package currently consists of a static library and utilities such as mkntfs, ntfscat, ntfsls, ntfsresize, and ntfsundelete (for a full list of included utilities diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index dbf6c276..abc2cd3c 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -73,7 +73,7 @@ #include "logging.h" const char *ntfs_bugs = "Developers' email address: linux-ntfs-dev@lists.sourceforge.net\n"; -const char *ntfs_home = "Linux NTFS homepage: http://linux-ntfs.sourceforge.net\n"; +const char *ntfs_home = "Linux NTFS homepage: http://www.linux-ntfs.org\n"; const char *ntfs_gpl = "This program is free software, released under the GNU " "General Public License\nand you are welcome to redistribute it under " "certain conditions. It comes with\nABSOLUTELY NO WARRANTY; for " From 96e6c648609a2776a94541d2b21c61d754df1d7c Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Thu, 1 Dec 2005 20:46:03 +0000 Subject: [PATCH 2802/2994] fix error message --- ntfsprogs/ntfsmount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 410ea4da..754693b7 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1709,7 +1709,7 @@ static int parse_options(int argc, char *argv[]) opts.quiet = 0; } else { if (!opts.device) { - ntfs_log_error("No mount point specified.\n"); + ntfs_log_error("No device specified.\n"); err++; } From e47ed2e41300aa773ab31586e20b7a83637d6763 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 2 Dec 2005 17:09:41 +0000 Subject: [PATCH 2803/2994] more warning fixes --- ntfsprogs/ntfsmount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 754693b7..b025af1b 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -89,8 +89,8 @@ typedef struct { long free_mft; unsigned int uid; unsigned int gid; - mode_t fmask; - mode_t dmask; + unsigned int fmask; + unsigned int dmask; ntfs_fuse_streams_interface streams; BOOL ro; BOOL show_sys_files; From d6cb8dd55dc4c504ae0032e5d6bdf50fa7695048 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Fri, 2 Dec 2005 17:32:34 +0000 Subject: [PATCH 2804/2994] require FUSE-2.4.2 under FreeBSD, because eariler versions have problems with readdir --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 41edbdb7..f795b013 100644 --- a/configure.ac +++ b/configure.ac @@ -215,12 +215,12 @@ if test "$enable_fuse_module" != "no"; then fi ]);; freebsd*) - PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.3.0, [ compile_fuse_module=true ], + PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.4.2, [ compile_fuse_module=true ], [ if test "$enable_fuse_module" = "yes"; then - AC_MSG_ERROR([ntfsmount requires FUSE version >= 2.3.0.]) + AC_MSG_ERROR([ntfsmount requires FUSE version >= 2.4.2 under FreeBSD, because earlier versions have problems with readdir.]) else - AC_MSG_WARN([ntfsmount requires FUSE version >= 2.3.0.]) + AC_MSG_WARN([ntfsmount requires FUSE version >= 2.4.2 under FreeBSD, because earlier versions have problems with readdir.]) fi ]);; *) AC_MSG_ERROR([ntfsmount can be built only under Linux and FreeBSD.]);; From 9d6a1cd081f7537feda3cbd84ec74df26bb27e62 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 3 Dec 2005 16:18:15 +0000 Subject: [PATCH 2805/2994] minor fixes to comments --- libntfs/dir.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libntfs/dir.c b/libntfs/dir.c index 37b1fcff..ecdf00bd 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1080,7 +1080,7 @@ err_out: * @target: target in unicode (only for symlinks) * @target_len: length of target in unicode charcters * - * Internal, use ntfs_create{_device,_symlink} wrappers instead. + * Internal, use ntfs_create{,_device,_symlink} wrappers instead. * * @type can be: * S_IFREG to create regular file @@ -1092,8 +1092,11 @@ err_out: * S_IFSOCK to create socket * other values are invalid. * - * @dev is only used if @type is S_IFBLK or S_IFCHR, in other cases it's value - * is ignored. + * @dev is used only if @type is S_IFBLK or S_IFCHR, in other cases its value + * ignored. + * + * @target and @target_len are used only if @type is S_IFLNK, in other cases + * their value ignored. * * Return opened ntfs inode that describes created object on success or NULL * on error with errno set to the error code. @@ -1338,8 +1341,8 @@ ntfs_inode *ntfs_create_symlink(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, * @name: unicode name of the object to delete * @name_len: length of the name in unicode characters * - * @ni is always closed after using of this function (even if it failed), - * user do not need to call ntfs_inode_close himself. + * @ni is always closed after the call to this function (even if it failed), + * user does not need to call ntfs_inode_close himself. * * Return 0 on success or -1 on error with errno set to the error code. */ From de23d9f540798d0eeb3bb12398946b31416be547 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 3 Dec 2005 16:40:20 +0000 Subject: [PATCH 2806/2994] determine to where pass kernel_cache option without #if's --- ntfsprogs/ntfsmount.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index b025af1b..b178875f 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1766,13 +1766,13 @@ int main(int argc, char *argv[]) } free(parsed_options); if (!ctx->debug) { -#if FUSE_MINOR_VERSION >= 4 - fh = fuse_new(ffd, "use_ino,kernel_cache", &ntfs_fuse_oper, - sizeof(ntfs_fuse_oper)); -#else - fh = fuse_new(ffd, "use_ino", &ntfs_fuse_oper, - sizeof(ntfs_fuse_oper)); -#endif + if (fuse_is_lib_option("kernel_cache")) + fh = fuse_new(ffd, "use_ino,kernel_cache", + &ntfs_fuse_oper, + sizeof(ntfs_fuse_oper)); + else + fh = fuse_new(ffd, "use_ino", &ntfs_fuse_oper, + sizeof(ntfs_fuse_oper)); } else fh = fuse_new(ffd, "debug,use_ino" , &ntfs_fuse_oper, sizeof(ntfs_fuse_oper)); From df8ce8fd425d272a1abafbcb054b86dd4beb0c87 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 3 Dec 2005 18:04:44 +0000 Subject: [PATCH 2807/2994] dir.c::ntfs_delete(): Fix bug with deletion hard links to directories. See comment to ntfs_link() if care for why we support this case. --- ChangeLog | 1 + libntfs/dir.c | 55 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b9c045f..1baf0975 100644 --- a/ChangeLog +++ b/ChangeLog @@ -92,6 +92,7 @@ xx/xx/2005 - 1.12.2-WIP - ntfsclone: --metadata also wipes out the timestamps in the $I30 and in the /$Extend/$Quota:$Q index root attributes. (Szaka) - ntfsmount: Add FreeBSD support. (Yura) + - ntfsmount: Fix bug with moving non-empty directories. (Yura) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/dir.c b/libntfs/dir.c index ecdf00bd..13f69b51 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1365,25 +1365,6 @@ int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) ni = ni->base_ni; if (dir_ni->nr_extents == -1) dir_ni = dir_ni->base_ni; - /* If deleting directory check it to be empty. */ - if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) { - ntfs_attr *na; - - na = ntfs_attr_open(ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4); - if (!na) { - ntfs_log_error("Corrupt directory or library bug."); - errno = EIO; - goto err_out; - } - if (na->data_size != sizeof(INDEX_ROOT) + - sizeof(INDEX_ENTRY_HEADER)) { - ntfs_attr_close(na); - ntfs_log_error("Directory is not empty."); - errno = ENOTEMPTY; - goto err_out; - } - ntfs_attr_close(na); - } /* * Search for FILE_NAME attribute with such name. If it's in POSIX or * WIN32_AND_DOS namespace, then simply remove it from index and inode. @@ -1442,6 +1423,34 @@ search: } goto err_out; } + /* If deleting directory check it to be empty. */ + if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) { + ntfs_attr *na; + + na = ntfs_attr_open(ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4); + if (!na) { + ntfs_log_error("Corrupt directory or library bug."); + errno = EIO; + goto err_out; + } + /* + * Do not allow non-empty directory deletion if hard links count + * is 1 or 2 (in case if one of the names in DOS namespace and + * another in WIN32 namespace). + */ + if ((na->data_size != sizeof(INDEX_ROOT) + sizeof( + INDEX_ENTRY_HEADER)) && (le16_to_cpu( + ni->mrec->link_count) == 1 || + (le16_to_cpu(ni->mrec->link_count) == 2 && + (fn->file_name_type == FILE_NAME_WIN32 || + fn->file_name_type == FILE_NAME_DOS)))) { + ntfs_attr_close(na); + ntfs_log_error("Directory is not empty."); + errno = ENOTEMPTY; + goto err_out; + } + ntfs_attr_close(na); + } /* Search for such FILE_NAME in index. */ ictx = ntfs_index_ctx_get(dir_ni, NTFS_INDEX_I30, 4); if (!ictx) @@ -1481,7 +1490,7 @@ search: /* * If hard link count is not equal to zero then we are done. In other * case there are no reference to this inode left, so we should free all - * non-resident attributes and mark inode as not in use. + * non-resident attributes and mark all MFT record as not in use. */ if (ni->mrec->link_count) goto out; @@ -1551,6 +1560,12 @@ err_out: * @name: unicode name of the new link * @name_len: length of the name in unicode characters * + * NOTE: At present we allow creating hardlinks to directories, we use them + * in a temporary state during rename. But it's defenitely bad idea to have + * hard links to directories as a result of operation. + * FIXME: Create internal __ntfs_link that allows hard links to a directories + * and external ntfs_link that do not. Write ntfs_rename that uses __ntfs_link. + * * Return 0 on success or -1 on error with errno set to the error code. */ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) From 04ebd8256d9061234d5c8a6266ad65fa9dc48cfc Mon Sep 17 00:00:00 2001 From: flatcap Date: Sun, 4 Dec 2005 22:42:51 +0000 Subject: [PATCH 2808/2994] The addition of one hundred and forty-five linefeeds. Thanks Yura! --- libntfs/attrib.c | 2 +- libntfs/collate.c | 6 +-- libntfs/dir.c | 54 +++++++++++------------ libntfs/index.c | 50 ++++++++++----------- libntfs/logfile.c | 50 ++++++++++----------- libntfs/mft.c | 107 ++++++++++++++++++++++----------------------- libntfs/runlist.c | 2 +- libntfs/tree.c | 4 +- libntfs/unix_io.c | 2 +- libntfs/win32_io.c | 2 +- 10 files changed, 139 insertions(+), 140 deletions(-) diff --git a/libntfs/attrib.c b/libntfs/attrib.c index a086cd29..9a525a5f 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1204,7 +1204,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) if (ntfs_cluster_free_from_rl(vol, rlc)) { ntfs_log_trace("Failed to free just " "allocated clusters. Leaving " - "inconstant metadata. Run chkdsk"); + "inconstant metadata. Run chkdsk\n"); } errno = eo; goto err_out; diff --git a/libntfs/collate.c b/libntfs/collate.c index 57c13bfa..2cab50f3 100644 --- a/libntfs/collate.c +++ b/libntfs/collate.c @@ -59,7 +59,7 @@ static int ntfs_collate_binary(ntfs_volume *vol __attribute__((unused)), else rc = 1; } - ntfs_log_trace("Done, returning %i.", rc); + ntfs_log_trace("Done, returning %i.\n", rc); return rc; } @@ -84,7 +84,7 @@ static int ntfs_collate_ntofs_ulong(ntfs_volume *vol __attribute__((unused)), ntfs_log_trace("Entering.\n"); if (data1_len != data2_len || data1_len != 4) { - ntfs_log_error("data1_len or/and data2_len not equal to 4."); + ntfs_log_error("data1_len or/and data2_len not equal to 4.\n"); return NTFS_COLLATION_ERROR; } d1 = le32_to_cpup(data1); @@ -172,7 +172,7 @@ int ntfs_collate(ntfs_volume *vol, COLLATION_RULES cr, ntfs_log_trace("Entering.\n"); if (!vol || !data1 || !data2 || data1_len < 0 || data2_len < 0) { - ntfs_log_error("Invalid arguments passed."); + ntfs_log_error("Invalid arguments passed.\n"); return NTFS_COLLATION_ERROR; } /* diff --git a/libntfs/dir.c b/libntfs/dir.c index 13f69b51..3a0c5ea8 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -1113,13 +1113,13 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, ntfs_log_trace("Entering.\n"); /* Sanity checks. */ if (!dir_ni || !name || !name_len) { - ntfs_log_error("Invalid arguments."); + ntfs_log_error("Invalid arguments.\n"); return NULL; } /* Allocate MFT record for new file. */ ni = ntfs_mft_record_alloc(dir_ni->vol, NULL); if (!ni) { - ntfs_log_error("Failed to allocate new MFT record."); + ntfs_log_error("Failed to allocate new MFT record.\n"); return NULL; } /* @@ -1130,7 +1130,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, si = calloc(1, si_len); if (!si) { err = errno; - ntfs_log_error("Not enough memory."); + ntfs_log_error("Not enough memory.\n"); goto err_out; } si->creation_time = utc2ntfs(ni->creation_time); @@ -1145,7 +1145,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, if (ntfs_attr_add(ni, AT_STANDARD_INFORMATION, AT_UNNAMED, 0, (u8*)si, si_len)) { err = errno; - ntfs_log_error("Failed to add STANDARD_INFORMATION attribute."); + ntfs_log_error("Failed to add STANDARD_INFORMATION attribute.\n"); goto err_out; } if (S_ISDIR(type)) { @@ -1159,7 +1159,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, ir = calloc(1, ir_len); if (!ir) { err = errno; - ntfs_log_error("Not enough memory."); + ntfs_log_error("Not enough memory.\n"); goto err_out; } ir->type = AT_FILE_NAME; @@ -1183,7 +1183,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, if (ntfs_attr_add(ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4, (u8*)ir, ir_len)) { err = errno; free(ir); - ntfs_log_error("Failed to add INDEX_ROOT attribute."); + ntfs_log_error("Failed to add INDEX_ROOT attribute.\n"); goto err_out; } } else { @@ -1237,7 +1237,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, if (ntfs_attr_add(ni, AT_DATA, AT_UNNAMED, 0, (u8*)data, data_len)) { err = errno; - ntfs_log_error("Failed to add DATA attribute."); + ntfs_log_error("Failed to add DATA attribute.\n"); goto err_out; } if (data) @@ -1248,7 +1248,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, fn = calloc(1, fn_len); if (!fn) { err = errno; - ntfs_log_error("Not enough memory."); + ntfs_log_error("Not enough memory.\n"); goto err_out; } fn->parent_directory = MK_LE_MREF(dir_ni->mft_no, @@ -1267,14 +1267,14 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, /* Add FILE_NAME attribute to inode. */ if (ntfs_attr_add(ni, AT_FILE_NAME, AT_UNNAMED, 0, (u8*)fn, fn_len)) { err = errno; - ntfs_log_error("Failed to add FILE_NAME attribute."); + ntfs_log_error("Failed to add FILE_NAME attribute.\n"); goto err_out; } /* Add FILE_NAME attribute to index. */ if (ntfs_index_add_filename(dir_ni, fn, MK_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number)))) { err = errno; - ntfs_log_error("Failed to add entry to the index."); + ntfs_log_error("Failed to add entry to the index.\n"); goto err_out; } /* Set hard links count and directory flag. */ @@ -1291,7 +1291,7 @@ err_out: ntfs_log_trace("Failed.\n"); if (ntfs_mft_record_free(ni->vol, ni)) ntfs_log_error("Failed to free MFT record. " - "Leaving inconsistent metadata. Run chkdsk."); + "Leaving inconsistent metadata. Run chkdsk.\n"); free(fn); free(si); errno = err; @@ -1307,7 +1307,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, { if (type != S_IFREG && type != S_IFDIR && type != S_IFIFO && type != S_IFSOCK) { - ntfs_log_error("Invalid arguments."); + ntfs_log_error("Invalid arguments.\n"); return NULL; } return __ntfs_create(dir_ni, name, name_len, type, 0, NULL, 0); @@ -1317,7 +1317,7 @@ ntfs_inode *ntfs_create_device(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, dev_t type, dev_t dev) { if (type != S_IFCHR && type != S_IFBLK) { - ntfs_log_error("Invalid arguments."); + ntfs_log_error("Invalid arguments.\n"); return NULL; } return __ntfs_create(dir_ni, name, name_len, type, dev, NULL, 0); @@ -1327,7 +1327,7 @@ ntfs_inode *ntfs_create_symlink(ntfs_inode *dir_ni, ntfschar *name, u8 name_len, ntfschar *target, u8 target_len) { if (!target || !target_len) { - ntfs_log_error("Invalid arguments."); + ntfs_log_error("Invalid arguments.\n"); return NULL; } return __ntfs_create(dir_ni, name, name_len, S_IFLNK, 0, @@ -1357,7 +1357,7 @@ int ntfs_delete(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) ntfs_log_trace("Entering.\n"); if (!ni || !dir_ni || !name || !name_len) { - ntfs_log_error("Invalid arguments."); + ntfs_log_error("Invalid arguments.\n"); errno = EINVAL; goto err_out; } @@ -1429,7 +1429,7 @@ search: na = ntfs_attr_open(ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4); if (!na) { - ntfs_log_error("Corrupt directory or library bug."); + ntfs_log_error("Corrupt directory or library bug.\n"); errno = EIO; goto err_out; } @@ -1445,7 +1445,7 @@ search: (fn->file_name_type == FILE_NAME_WIN32 || fn->file_name_type == FILE_NAME_DOS)))) { ntfs_attr_close(na); - ntfs_log_error("Directory is not empty."); + ntfs_log_error("Directory is not empty.\n"); errno = ENOTEMPTY; goto err_out; } @@ -1504,13 +1504,13 @@ search: if (!rl) { err = errno; ntfs_log_error("Failed to decompress runlist. " - "Leaving inconsistent metadata."); + "Leaving inconsistent metadata.\n"); continue; } if (ntfs_cluster_free_from_rl(ni->vol, rl)) { err = errno; ntfs_log_error("Failed to free clusters. " - "Leaving inconsistent metadata."); + "Leaving inconsistent metadata.\n"); continue; } free(rl); @@ -1519,19 +1519,19 @@ search: if (errno != ENOENT) { err = errno; ntfs_log_error("Attribute enumeration failed. " - "Probably leaving inconsistent metadata."); + "Probably leaving inconsistent metadata.\n"); } /* All extents should be attached after attribute walk. */ while (ni->nr_extents) if (ntfs_mft_record_free(ni->vol, *(ni->extent_nis))) { err = errno; ntfs_log_error("Failed to free extent MFT record. " - "Leaving inconsistent metadata."); + "Leaving inconsistent metadata.\n"); } if (ntfs_mft_record_free(ni->vol, ni)) { err = errno; ntfs_log_error("Failed to free base MFT record. " - "Leaving inconsistent metadata."); + "Leaving inconsistent metadata.\n"); } ni = NULL; out: @@ -1576,7 +1576,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) ntfs_log_trace("Entering.\n"); if (!ni || !dir_ni || !name || !name_len) { err = errno; - ntfs_log_error("Invalid arguments."); + ntfs_log_error("Invalid arguments.\n"); goto err_out; } /* Create FILE_NAME attribute. */ @@ -1584,7 +1584,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) fn = calloc(1, fn_len); if (!fn) { err = errno; - ntfs_log_error("Not enough memory."); + ntfs_log_error("Not enough memory.\n"); goto err_out; } fn->parent_directory = MK_LE_MREF(dir_ni->mft_no, @@ -1605,7 +1605,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) if (ntfs_index_add_filename(dir_ni, fn, MK_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number)))) { err = errno; - ntfs_log_error("Failed to add entry to the index."); + ntfs_log_error("Failed to add entry to the index.\n"); goto err_out; } /* Add FILE_NAME attribute to inode. */ @@ -1613,7 +1613,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) ntfs_index_context *ictx; err = errno; - ntfs_log_error("Failed to add FILE_NAME attribute."); + ntfs_log_error("Failed to add FILE_NAME attribute.\n"); /* Try to remove just added attribute from index. */ ictx = ntfs_index_ctx_get(dir_ni, NTFS_INDEX_I30, 4); if (!ictx) @@ -1637,7 +1637,7 @@ int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len) ntfs_log_trace("Done.\n"); return 0; rollback_failed: - ntfs_log_error("Rollback failed. Leaving inconsistent metadata."); + ntfs_log_error("Rollback failed. Leaving inconsistent metadata.\n"); err_out: ntfs_log_error("Failed.\n"); free(fn); diff --git a/libntfs/index.c b/libntfs/index.c index 67136d94..0bd8ac90 100644 --- a/libntfs/index.c +++ b/libntfs/index.c @@ -95,7 +95,7 @@ void ntfs_index_ctx_put(ntfs_index_context *ictx) 1, ictx->block_size, ictx->ia) != 1) ntfs_log_error("Failed to write out " - "index block."); + "index block.\n"); } /* Free resources. */ free(ictx->ia); @@ -127,7 +127,7 @@ void ntfs_index_ctx_reinit(ntfs_index_context *ictx) 1, ictx->block_size, ictx->ia) != 1) ntfs_log_error("Failed to write out " - "index block."); + "index block.\n"); } /* Free resources. */ free(ictx->ia); @@ -206,7 +206,7 @@ int ntfs_index_lookup(const void *key, const int key_len, if (err) { if (errno == ENOENT) { ntfs_log_error("Index root attribute missing in inode " - "0x%llx.", ni->mft_no); + "0x%llx.\n", ni->mft_no); err = EIO; } else err = errno; @@ -222,7 +222,7 @@ int ntfs_index_lookup(const void *key, const int key_len, cr = ir->collation_rule; if (!ntfs_is_collation_rule_supported(cr)) { ntfs_log_error("Index uses unsupported collation rule 0x%x. " - "Aborting lookup.", (unsigned)le32_to_cpu(cr)); + "Aborting lookup.\n", (unsigned)le32_to_cpu(cr)); err = EOPNOTSUPP; goto err_out; } @@ -272,7 +272,7 @@ done: le16_to_cpu(ie->key_length)); if (rc == NTFS_COLLATION_ERROR) { ntfs_log_error("Collation error. Probably filename " - "contain invalid characters."); + "contain invalid characters.\n"); err = ERANGE; goto err_out; } @@ -312,14 +312,14 @@ done: if (!na) { ntfs_log_error("No index allocation attribute but index entry " "requires one. Inode 0x%llx is corrupt or " - "library bug.", ni->mft_no); + "library bug.\n", ni->mft_no); goto err_out; } /* Allocate memory to store index block. */ ia = malloc(ictx->block_size); if (!ia) { ntfs_log_error("Not enough memory to allocate buffer for index" - " allocation."); + " allocation.\n"); err = ENOMEM; goto err_out; } @@ -328,20 +328,20 @@ descend_into_child_node: /* Read index allocation block. */ if (ntfs_attr_mst_pread(na, vcn << vol->cluster_size_bits, 1, ictx->block_size, ia) != 1) { - ntfs_log_error("Failed to read index allocation."); + ntfs_log_error("Failed to read index allocation.\n"); goto err_out; } /* Catch multi sector transfer fixup errors. */ if (!ntfs_is_indx_record(ia->magic)) { ntfs_log_error("Index record with vcn 0x%llx is corrupt. " - "Corrupt inode 0x%llx. Run chkdsk.", + "Corrupt inode 0x%llx. Run chkdsk.\n", (long long)vcn, ni->mft_no); goto err_out; } if (sle64_to_cpu(ia->index_block_vcn) != vcn) { ntfs_log_error("Actual VCN (0x%llx) of index buffer is " "different from expected VCN (0x%llx). Inode " - "0x%llx is corrupt or driver bug.", + "0x%llx is corrupt or driver bug.\n", (unsigned long long) sle64_to_cpu(ia->index_block_vcn), (unsigned long long)vcn, ni->mft_no); @@ -351,7 +351,7 @@ descend_into_child_node: ntfs_log_error("Index buffer (VCN 0x%llx) of inode 0x%llx has " "a size (%u) differing from the index " "specified size (%u). Inode is corrupt or " - "driver bug.", (unsigned long long)vcn, + "driver bug.\n", (unsigned long long)vcn, ni->mft_no, (unsigned) le32_to_cpu(ia->index.allocated_size) + 0x18, (unsigned)ictx->block_size); @@ -360,7 +360,7 @@ descend_into_child_node: index_end = (u8*)&ia->index + le32_to_cpu(ia->index.index_length); if (index_end > (u8*)ia + ictx->block_size) { ntfs_log_error("Size of index buffer (VCN 0x%llx) of inode " - "0x%llx exceeds maximum size.", + "0x%llx exceeds maximum size.\n", (unsigned long long)vcn, ni->mft_no); goto err_out; } @@ -378,7 +378,7 @@ descend_into_child_node: sizeof(INDEX_ENTRY_HEADER) > index_end || (u8*)ie + le16_to_cpu(ie->length) > index_end) { ntfs_log_error("Index entry out of bounds in inode " - "0x%llx.", ni->mft_no); + "0x%llx.\n", ni->mft_no); goto err_out; } /* @@ -406,7 +406,7 @@ ia_done: le16_to_cpu(ie->key_length)); if (rc == NTFS_COLLATION_ERROR) { ntfs_log_error("Collation error. Probably filename " - "contain invalid characters."); + "contain invalid characters.\n"); err = ERANGE; goto err_out; } @@ -436,14 +436,14 @@ ia_done: } if ((ia->index.flags & NODE_MASK) == LEAF_NODE) { ntfs_log_error("Index entry with child node found in a leaf " - "node in inode 0x%llx.", ni->mft_no); + "node in inode 0x%llx.\n", ni->mft_no); goto err_out; } /* Child node present, descend into it. */ vcn = sle64_to_cpup((sle64*)((u8*)ie + le16_to_cpu(ie->length) - 8)); if (vcn >= 0) goto descend_into_child_node; - ntfs_log_error("Negative child node vcn in inode 0x%llx.", ni->mft_no); + ntfs_log_error("Negative child node vcn in inode 0x%llx.\n", ni->mft_no); err_out: if (na) ntfs_attr_close(na); @@ -455,7 +455,7 @@ err_out: errno = err; return -1; idx_err_out: - ntfs_log_error("Corrupt index. Aborting lookup."); + ntfs_log_error("Corrupt index. Aborting lookup.\n"); goto err_out; } @@ -479,7 +479,7 @@ int ntfs_index_add_filename(ntfs_inode *ni, FILE_NAME_ATTR *fn, MFT_REF mref) ntfs_log_trace("Entering.\n"); if (!ni || !fn) { - ntfs_log_error("Invalid arguments."); + ntfs_log_error("Invalid arguments.\n"); errno = EINVAL; return -1; } @@ -493,12 +493,12 @@ retry: /* Find place where insert new entry. */ if (!ntfs_index_lookup(fn, fn_size, ictx)) { err = EEXIST; - ntfs_log_error("Index already have such entry."); + ntfs_log_error("Index already have such entry.\n"); goto err_out; } if (errno != ENOENT) { err = errno; - ntfs_log_error("Failed to find place where to insert new entry."); + ntfs_log_error("Failed to find place where to insert new entry.\n"); goto err_out; } /* Some setup. */ @@ -520,14 +520,14 @@ retry: ictx->name_len); if (!na) { err = errno; - ntfs_log_error("Failed to open INDEX_ROOT."); + ntfs_log_error("Failed to open INDEX_ROOT.\n"); goto err_out; } if (ntfs_attr_truncate(na, allocated_size + offsetof( INDEX_ROOT, index))) { err = EOPNOTSUPP; ntfs_attr_close(na); - ntfs_log_error("Failed to truncate INDEX_ROOT."); + ntfs_log_error("Failed to truncate INDEX_ROOT.\n"); goto err_out; } ntfs_attr_close(na); @@ -590,7 +590,7 @@ int ntfs_index_rm(ntfs_index_context *ictx) ntfs_log_trace("Entering.\n"); if (!ictx || (!ictx->ia && !ictx->ir) || ictx->entry->flags & INDEX_ENTRY_END) { - ntfs_log_error("Invalid arguments."); + ntfs_log_error("Invalid arguments.\n"); err = EINVAL; goto err_out; } @@ -630,7 +630,7 @@ int ntfs_index_rm(ntfs_index_context *ictx) if (!na) { err = errno; ntfs_log_error("Failed to open INDEX_ROOT attribute. " - "Leaving inconsistent metadata."); + "Leaving inconsistent metadata.\n"); goto err_out; } if (ntfs_attr_truncate(na, new_index_length + offsetof( @@ -638,7 +638,7 @@ int ntfs_index_rm(ntfs_index_context *ictx) err = errno; ntfs_log_error("Failed to truncate INDEX_ROOT " "attribute. Leaving inconsistent " - "metadata."); + "metadata.\n"); goto err_out; } ntfs_attr_close(na); diff --git a/libntfs/logfile.c b/libntfs/logfile.c index 1c1e392c..a429ce68 100644 --- a/libntfs/logfile.c +++ b/libntfs/logfile.c @@ -70,7 +70,7 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) logfile_system_page_size & (logfile_system_page_size - 1) || logfile_log_page_size & (logfile_log_page_size - 1)) { - ntfs_log_error("$LogFile uses unsupported page size."); + ntfs_log_error("$LogFile uses unsupported page size.\n"); return FALSE; } /* @@ -79,7 +79,7 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) */ if (pos && pos != logfile_system_page_size) { ntfs_log_error("Found restart area in incorrect " - "position in $LogFile."); + "position in $LogFile.\n"); return FALSE; } /* We only know how to handle version 1.1. */ @@ -87,7 +87,7 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) sle16_to_cpu(rp->minor_ver) != 1) { ntfs_log_error("$LogFile version %i.%i is not " "supported. (This driver supports version " - "1.1 only.)", (int)sle16_to_cpu(rp->major_ver), + "1.1 only.)\n", (int)sle16_to_cpu(rp->major_ver), (int)sle16_to_cpu(rp->minor_ver)); return FALSE; } @@ -103,7 +103,7 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) usa_count = 1 + (logfile_system_page_size >> NTFS_BLOCK_SIZE_BITS); if (usa_count != le16_to_cpu(rp->usa_count)) { ntfs_log_error("$LogFile restart page specifies " - "inconsistent update sequence array count."); + "inconsistent update sequence array count.\n"); return FALSE; } /* Verify the position of the update sequence array. */ @@ -112,7 +112,7 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos) if (usa_ofs < sizeof(RESTART_PAGE_HEADER) || usa_end > NTFS_BLOCK_SIZE - sizeof(u16)) { ntfs_log_error("$LogFile restart page specifies " - "inconsistent update sequence array offset."); + "inconsistent update sequence array offset.\n"); return FALSE; } skip_usa_checks: @@ -127,7 +127,7 @@ skip_usa_checks: ra_ofs < sizeof(RESTART_PAGE_HEADER)) || ra_ofs > logfile_system_page_size) { ntfs_log_error("$LogFile restart page specifies " - "inconsistent restart area offset."); + "inconsistent restart area offset.\n"); return FALSE; } /* @@ -136,7 +136,7 @@ skip_usa_checks: */ if (!ntfs_is_chkd_record(rp->magic) && sle64_to_cpu(rp->chkdsk_lsn)) { ntfs_log_error("$LogFile restart page is not modified " - "by chkdsk but a chkdsk LSN is specified."); + "by chkdsk but a chkdsk LSN is specified.\n"); return FALSE; } ntfs_log_trace("Done.\n"); @@ -174,7 +174,7 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) if (ra_ofs + offsetof(RESTART_AREA, file_size) > NTFS_BLOCK_SIZE - sizeof(u16)) { ntfs_log_error("$LogFile restart area specifies " - "inconsistent file offset."); + "inconsistent file offset.\n"); return FALSE; } /* @@ -189,7 +189,7 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) ra_ofs + ca_ofs > (u16)(NTFS_BLOCK_SIZE - sizeof(u16))) { ntfs_log_error("$LogFile restart area specifies " - "inconsistent client array offset."); + "inconsistent client array offset.\n"); return FALSE; } /* @@ -206,7 +206,7 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) ntfs_log_error("$LogFile restart area is out of bounds " "of the system page size specified by the " "restart page header and/or the specified " - "restart area length is inconsistent."); + "restart area length is inconsistent.\n"); return FALSE; } /* @@ -221,7 +221,7 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) le16_to_cpu(ra->client_in_use_list) >= le16_to_cpu(ra->log_clients))) { ntfs_log_error("$LogFile restart area specifies " - "overflowing client free and/or in use lists."); + "overflowing client free and/or in use lists.\n"); return FALSE; } /* @@ -236,21 +236,21 @@ static BOOL ntfs_check_restart_area(RESTART_PAGE_HEADER *rp) } if (le32_to_cpu(ra->seq_number_bits) != (u32)(67 - fs_bits)) { ntfs_log_error("$LogFile restart area specifies " - "inconsistent sequence number bits."); + "inconsistent sequence number bits.\n"); return FALSE; } /* The log record header length must be a multiple of 8. */ if (((le16_to_cpu(ra->log_record_header_length) + 7) & ~7) != le16_to_cpu(ra->log_record_header_length)) { ntfs_log_error("$LogFile restart area specifies " - "inconsistent log record header length."); + "inconsistent log record header length.\n"); return FALSE; } /* Ditto for the log page data offset. */ if (((le16_to_cpu(ra->log_page_data_offset) + 7) & ~7) != le16_to_cpu(ra->log_page_data_offset)) { ntfs_log_error("$LogFile restart area specifies " - "inconsistent log page data offset."); + "inconsistent log page data offset.\n"); return FALSE; } ntfs_log_trace("Done.\n"); @@ -316,7 +316,7 @@ check_list: ntfs_log_trace("Done.\n"); return TRUE; err_out: - ntfs_log_error("$LogFile log client array is corrupt."); + ntfs_log_error("$LogFile log client array is corrupt.\n"); return FALSE; } @@ -374,7 +374,7 @@ static int ntfs_check_and_load_restart_page(ntfs_attr *log_na, trp = malloc(le32_to_cpu(rp->system_page_size)); if (!trp) { ntfs_log_error("Failed to allocate memory for $LogFile " - "restart page buffer."); + "restart page buffer.\n"); return ENOMEM; } /* @@ -389,7 +389,7 @@ static int ntfs_check_and_load_restart_page(ntfs_attr *log_na, le32_to_cpu(rp->system_page_size)) { err = errno; ntfs_log_error("Failed to read whole restart page into the " - "buffer."); + "buffer.\n"); if (err != ENOMEM) err = EIO; goto err_out; @@ -410,7 +410,7 @@ static int ntfs_check_and_load_restart_page(ntfs_attr *log_na, le16_to_cpu(ra->restart_area_length) > NTFS_BLOCK_SIZE - (int)sizeof(u16)) { ntfs_log_error("Multi sector transfer error " - "detected in $LogFile restart page."); + "detected in $LogFile restart page.\n"); err = EINVAL; goto err_out; } @@ -496,13 +496,13 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na, RESTART_PAGE_HEADER **rp) */ if (size < log_page_size * 2 || (size - log_page_size * 2) >> log_page_bits < MinLogRecordPages) { - ntfs_log_error("$LogFile is too small."); + ntfs_log_error("$LogFile is too small.\n"); return FALSE; } /* Allocate memory for restart page. */ kaddr = malloc(NTFS_BLOCK_SIZE); if (!kaddr) { - ntfs_log_error("Not enough memory."); + ntfs_log_error("Not enough memory.\n"); return FALSE; } /* @@ -520,7 +520,7 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na, RESTART_PAGE_HEADER **rp) if (ntfs_attr_pread(log_na, pos, NTFS_BLOCK_SIZE, kaddr) != NTFS_BLOCK_SIZE) { ntfs_log_error("Failed to read first NTFS_BLOCK_SIZE " - "bytes of potential restart page."); + "bytes of potential restart page.\n"); goto err_out; } @@ -593,9 +593,9 @@ is_empty: } if (!rstr1_ph) { if (rstr2_ph) - ntfs_log_error("BUG: rstr2_ph isn't NULL!"); + ntfs_log_error("BUG: rstr2_ph isn't NULL!\n"); ntfs_log_error("Did not find any restart pages in " - "$LogFile and it was not empty."); + "$LogFile and it was not empty.\n"); return FALSE; } /* If both restart pages were found, use the more recent one. */ @@ -662,7 +662,7 @@ BOOL ntfs_is_logfile_clean(ntfs_attr *log_na, RESTART_PAGE_HEADER *rp) return TRUE; } if (!rp) { - ntfs_log_error("Restart page header is NULL."); + ntfs_log_error("Restart page header is NULL.\n"); return FALSE; } if (!ntfs_is_rstr_record(rp->magic) && @@ -670,7 +670,7 @@ BOOL ntfs_is_logfile_clean(ntfs_attr *log_na, RESTART_PAGE_HEADER *rp) ntfs_log_error("Restart page buffer is invalid. This is " "probably a bug in that the $LogFile should " "have been consistency checked before calling " - "this function."); + "this function.\n"); return FALSE; } diff --git a/libntfs/mft.c b/libntfs/mft.c index 32974328..68c1fca6 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -481,7 +481,7 @@ static int ntfs_mft_bitmap_find_free_rec(ntfs_volume *vol, ntfs_inode *base_ni) ll = ntfs_attr_pread(mftbmp_na, ofs, size, buf); if (ll < 0) { ntfs_log_error("Failed to read mft bitmap " - "attribute, aborting."); + "attribute, aborting.\n"); free(buf); return -1; } @@ -582,7 +582,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) vol->cluster_size_bits); if (!rl || !rl->length || rl->lcn < 0) { ntfs_log_error("Failed to determine last allocated " - "cluster of mft bitmap attribute."); + "cluster of mft bitmap attribute.\n"); if (rl) errno = EIO; return -1; @@ -595,7 +595,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) */ ret = (int)ntfs_attr_pread(lcnbmp_na, lcn >> 3, 1, &b); if (ret < 0) { - ntfs_log_error("Failed to read from lcn bitmap."); + ntfs_log_error("Failed to read from lcn bitmap.\n"); return -1; } ntfs_log_debug("Read %i byte%s.\n", ret, ret == 1 ? "" : "s"); @@ -606,7 +606,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) ret = (int)ntfs_attr_pwrite(lcnbmp_na, lcn >> 3, 1, &b); if (ret < 1) { ntfs_log_error("Failed to write to lcn " - "bitmap."); + "bitmap.\n"); if (!ret) errno = EIO; return -1; @@ -621,17 +621,17 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) rl2 = ntfs_cluster_alloc(vol, rl[1].vcn, 1, lcn, DATA_ZONE); if (!rl2) { ntfs_log_error("Failed to allocate a cluster for " - "the mft bitmap."); + "the mft bitmap.\n"); return -1; } rl = ntfs_runlists_merge(mftbmp_na->rl, rl2); if (!rl) { ret = errno; ntfs_log_error("Failed to merge runlists for mft " - "bitmap."); + "bitmap.\n"); if (ntfs_cluster_free_from_rl(vol, rl2)) ntfs_log_error("Failed to deallocate " - "cluster.%s", es); + "cluster.%s\n", es); free(rl2); errno = ret; return -1; @@ -649,13 +649,13 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) */ ctx = ntfs_attr_get_search_ctx(mftbmp_na->ni, NULL); if (!ctx) { - ntfs_log_error("Failed to get search context."); + ntfs_log_error("Failed to get search context.\n"); goto undo_alloc; } if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, mftbmp_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { ntfs_log_error("Failed to find last attribute extent of " - "mft bitmap attribute."); + "mft bitmap attribute.\n"); goto undo_alloc; } m = ctx->mrec; @@ -664,7 +664,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) rl2 = ntfs_attr_find_vcn(mftbmp_na, ll); if (!rl2 || !rl2->length) { ntfs_log_error("Failed to determine previous last " - "allocated cluster of mft bitmap attribute."); + "allocated cluster of mft bitmap attribute.\n"); if (rl2) errno = EIO; goto undo_alloc; @@ -673,7 +673,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll); if (mp_size <= 0) { ntfs_log_error("Get size for mapping pairs failed for " - "mft bitmap attribute extent."); + "mft bitmap attribute extent.\n"); goto undo_alloc; } /* Expand the attribute record if necessary. */ @@ -682,14 +682,14 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) le16_to_cpu(a->mapping_pairs_offset))) { if (errno != ENOSPC) { ntfs_log_error("Failed to resize attribute " - "record for mft bitmap attribute."); + "record for mft bitmap attribute.\n"); goto undo_alloc; } // TODO: Deal with this by moving this extent to a new mft // record or by starting a new extent in a new mft record. ntfs_log_error("Not enough space in this mft record to " "accommodate extended mft bitmap attribute " - "extent. Cannot handle this yet."); + "extent. Cannot handle this yet.\n"); errno = EOPNOTSUPP; goto undo_alloc; } @@ -699,7 +699,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) le16_to_cpu(a->mapping_pairs_offset), mp_size, rl2, ll, NULL)) { ntfs_log_error("Failed to build mapping pairs array for " - "mft bitmap attribute."); + "mft bitmap attribute.\n"); errno = EIO; goto undo_alloc; } @@ -719,7 +719,7 @@ static int ntfs_mft_bitmap_extend_allocation(ntfs_volume *vol) if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, mftbmp_na->name_len, 0, 0, NULL, 0, ctx)) { ntfs_log_error("Failed to find first attribute " - "extent of mft bitmap attribute."); + "extent of mft bitmap attribute.\n"); goto restore_undo_alloc; } a = ctx->attr; @@ -736,7 +736,7 @@ restore_undo_alloc: if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, mftbmp_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { ntfs_log_error("Failed to find last attribute extent of " - "mft bitmap attribute.%s", es); + "mft bitmap attribute.%s\n", es); ntfs_attr_put_search_ctx(ctx); mftbmp_na->allocated_size += vol->cluster_size; /* @@ -764,18 +764,17 @@ undo_alloc: } /* Deallocate the cluster. */ if (ntfs_bitmap_clear_bit(lcnbmp_na, lcn)) - ntfs_log_error("Failed to free cluster.%s", es); + ntfs_log_error("Failed to free cluster.%s\n", es); if (status.mp_rebuilt) { if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu(a->mapping_pairs_offset), old_alen - le16_to_cpu(a->mapping_pairs_offset), rl2, ll, NULL)) ntfs_log_error("Failed to restore mapping " - "pairs array.%s", es); + "pairs array.%s\n", es); if (ntfs_attr_record_resize(m, a, old_alen)) ntfs_log_error("Failed to restore attribute " - "record.%s", - es); + "record.%s\n", es); ntfs_inode_mark_dirty(ctx->ntfs_ino); } if (ctx) @@ -807,13 +806,13 @@ static int ntfs_mft_bitmap_extend_initialized(ntfs_volume *vol) mftbmp_na = vol->mftbmp_na; ctx = ntfs_attr_get_search_ctx(mftbmp_na->ni, NULL); if (!ctx) { - ntfs_log_error("Failed to get search context."); + ntfs_log_error("Failed to get search context.\n"); return -1; } if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, mftbmp_na->name_len, 0, 0, NULL, 0, ctx)) { ntfs_log_error("Failed to find first attribute extent of " - "mft bitmap attribute."); + "mft bitmap attribute.\n"); err = errno; goto put_err_out; } @@ -836,20 +835,20 @@ static int ntfs_mft_bitmap_extend_initialized(ntfs_volume *vol) ntfs_log_debug("Wrote eight initialized bytes to mft bitmap.\n"); return 0; } - ntfs_log_error("Failed to write to mft bitmap."); + ntfs_log_error("Failed to write to mft bitmap.\n"); err = errno; if (ll >= 0) err = EIO; /* Try to recover from the error. */ ctx = ntfs_attr_get_search_ctx(mftbmp_na->ni, NULL); if (!ctx) { - ntfs_log_error("Failed to get search context.%s", es); + ntfs_log_error("Failed to get search context.%s\n", es); goto err_out; } if (ntfs_attr_lookup(mftbmp_na->type, mftbmp_na->name, mftbmp_na->name_len, 0, 0, NULL, 0, ctx)) { ntfs_log_error("Failed to find first attribute extent of " - "mft bitmap attribute.%s", es); + "mft bitmap attribute.%s\n", es); put_err_out: ntfs_attr_put_search_ctx(ctx); goto err_out; @@ -911,7 +910,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) (mft_na->allocated_size - 1) >> vol->cluster_size_bits); if (!rl || !rl->length || rl->lcn < 0) { ntfs_log_error("Failed to determine last allocated " - "cluster of mft data attribute."); + "cluster of mft data attribute.\n"); if (rl) errno = EIO; return -1; @@ -936,7 +935,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) if (errno != ENOSPC || nr == min_nr) { ntfs_log_error("Failed to allocate the minimal " "number of clusters (%lli) for the " - "mft data attribute.", (long long)nr); + "mft data attribute.\n", (long long)nr); return -1; } /* @@ -952,10 +951,10 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) if (!rl) { err = errno; ntfs_log_error("Failed to merge runlists for mft data " - "attribute."); + "attribute.\n"); if (ntfs_cluster_free_from_rl(vol, rl2)) ntfs_log_error("Failed to deallocate clusters " - "from the mft data attribute.%s", es); + "from the mft data attribute.%s\n", es); free(rl2); errno = err; return -1; @@ -968,13 +967,13 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) /* Update the attribute record as well. */ ctx = ntfs_attr_get_search_ctx(mft_na->ni, NULL); if (!ctx) { - ntfs_log_error("Failed to get search context."); + ntfs_log_error("Failed to get search context.\n"); goto undo_alloc; } if (ntfs_attr_lookup(mft_na->type, mft_na->name, mft_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { ntfs_log_error("Failed to find last attribute extent of " - "mft data attribute."); + "mft data attribute.\n"); goto undo_alloc; } m = ctx->mrec; @@ -983,7 +982,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) rl2 = ntfs_attr_find_vcn(mft_na, ll); if (!rl2 || !rl2->length) { ntfs_log_error("Failed to determine previous last " - "allocated cluster of mft data attribute."); + "allocated cluster of mft data attribute.\n"); if (rl2) errno = EIO; goto undo_alloc; @@ -992,7 +991,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) mp_size = ntfs_get_size_for_mapping_pairs(vol, rl2, ll); if (mp_size <= 0) { ntfs_log_error("Get size for mapping pairs failed for " - "mft data attribute extent."); + "mft data attribute extent.\n"); goto undo_alloc; } /* Expand the attribute record if necessary. */ @@ -1001,7 +1000,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) mp_size + le16_to_cpu(a->mapping_pairs_offset))) { if (errno != ENOSPC) { ntfs_log_error("Failed to resize attribute " - "record for mft data attribute."); + "record for mft data attribute.\n"); goto undo_alloc; } // TODO: Deal with this by moving this extent to a new mft @@ -1011,7 +1010,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) // question. ntfs_log_error("Not enough space in this mft record to " "accommodate extended mft data attribute " - "extent. Cannot handle this yet."); + "extent. Cannot handle this yet.\n"); errno = EOPNOTSUPP; goto undo_alloc; } @@ -1023,7 +1022,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) (u8*)a + le16_to_cpu(a->mapping_pairs_offset), mp_size, rl2, ll, NULL)) { ntfs_log_error("Failed to build mapping pairs array of " - "mft data attribute."); + "mft data attribute.\n"); errno = EIO; goto undo_alloc; } @@ -1045,7 +1044,7 @@ static int ntfs_mft_data_extend_allocation(ntfs_volume *vol) if (ntfs_attr_lookup(mft_na->type, mft_na->name, mft_na->name_len, 0, 0, NULL, 0, ctx)) { ntfs_log_error("Failed to find first attribute " - "extent of mft data attribute."); + "extent of mft data attribute.\n"); goto restore_undo_alloc; } a = ctx->attr; @@ -1062,7 +1061,7 @@ restore_undo_alloc: if (ntfs_attr_lookup(mft_na->type, mft_na->name, mft_na->name_len, 0, rl[1].vcn, NULL, 0, ctx)) { ntfs_log_error("Failed to find last attribute extent of " - "mft data attribute.%s", es); + "mft data attribute.%s\n", es); ntfs_attr_put_search_ctx(ctx); mft_na->allocated_size += nr << vol->cluster_size_bits; /* @@ -1080,20 +1079,20 @@ undo_alloc: err = errno; if (ntfs_cluster_free(vol, mft_na, old_last_vcn, -1) < 0) ntfs_log_error("Failed to free clusters from mft data " - "attribute.%s", es); + "attribute.%s\n", es); if (ntfs_rl_truncate(&mft_na->rl, old_last_vcn)) ntfs_log_error("Failed to truncate mft data attribute " - "runlist.%s", es); + "runlist.%s\n", es); if (mp_rebuilt) { if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu(a->mapping_pairs_offset), old_alen - le16_to_cpu(a->mapping_pairs_offset), rl2, ll, NULL)) ntfs_log_error("Failed to restore mapping pairs " - "array.%s", es); + "array.%s\n", es); if (ntfs_attr_record_resize(m, a, old_alen)) ntfs_log_error("Failed to restore attribute " - "record.%s", es); + "record.%s\n", es); ntfs_inode_mark_dirty(ctx->ntfs_ino); } if (ctx) @@ -1198,7 +1197,7 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, ntfs_inode *base_ni) if (base_ni) ntfs_log_trace("Entering (allocating an extent mft record for " - "base mft record 0x%llx).", + "base mft record 0x%llx).\n", (long long)base_ni->mft_no); else ntfs_log_trace("Entering (allocating a base mft record).\n"); @@ -1275,7 +1274,7 @@ found_free_rec: /* @bit is the found free mft record, allocate it in the mft bitmap. */ ntfs_log_debug("At found_free_rec.\n"); if (ntfs_bitmap_set_bit(mftbmp_na, bit)) { - ntfs_log_error("Failed to allocate bit in mft bitmap."); + ntfs_log_error("Failed to allocate bit in mft bitmap.\n"); goto err_out; } ntfs_log_debug("Set bit 0x%llx in mft bitmap.\n", (long long)bit); @@ -1325,20 +1324,20 @@ found_free_rec: ntfs_log_debug("Initializing mft record 0x%llx.\n", (long long)ll2); err = ntfs_mft_record_format(vol, ll2); if (err) { - ntfs_log_error("Failed to format mft record."); + ntfs_log_error("Failed to format mft record.\n"); goto undo_data_init; } } /* Update the mft data attribute record to reflect the new sizes. */ ctx = ntfs_attr_get_search_ctx(mft_na->ni, NULL); if (!ctx) { - ntfs_log_error("Failed to get search context."); + ntfs_log_error("Failed to get search context.\n"); goto undo_data_init; } if (ntfs_attr_lookup(mft_na->type, mft_na->name, mft_na->name_len, 0, 0, NULL, 0, ctx)) { ntfs_log_error("Failed to find first attribute extent of " - "mft data attribute."); + "mft data attribute.\n"); ntfs_attr_put_search_ctx(ctx); goto undo_data_init; } @@ -1370,12 +1369,12 @@ mft_rec_already_initialized: m = (MFT_RECORD*)malloc(vol->mft_record_size); if (!m) { ntfs_log_error("Failed to allocate buffer for mft " - "record."); + "record.\n"); goto undo_mftbmp_alloc; } if (ntfs_mft_record_read(vol, bit, m)) { err = errno; - ntfs_log_error("Failed to read mft record."); + ntfs_log_error("Failed to read mft record.\n"); free(m); errno = err; goto undo_mftbmp_alloc; @@ -1385,7 +1384,7 @@ mft_rec_already_initialized: ntfs_log_error("Mft record 0x%llx was marked unused in " "mft bitmap but is marked used itself. " "Corrupt filesystem or library bug! " - "Run chkdsk immediately!", (long long)bit); + "Run chkdsk immediately!\n", (long long)bit); free(m); errno = EIO; goto undo_mftbmp_alloc; @@ -1394,7 +1393,7 @@ mft_rec_already_initialized: usn = *(u16*)((u8*)m + le16_to_cpu(m->usa_ofs)); if (ntfs_mft_record_layout(vol, bit, m)) { err = errno; - ntfs_log_error("Failed to re-format mft record."); + ntfs_log_error("Failed to re-format mft record.\n"); free(m); errno = err; goto undo_mftbmp_alloc; @@ -1410,7 +1409,7 @@ mft_rec_already_initialized: ni = ntfs_inode_allocate(vol); if (!ni) { err = errno; - ntfs_log_error("Failed to allocate buffer for inode."); + ntfs_log_error("Failed to allocate buffer for inode.\n"); free(m); errno = err; goto undo_mftbmp_alloc; @@ -1441,7 +1440,7 @@ mft_rec_already_initialized: err = errno; ntfs_log_error("Failed to allocate " "buffer for extent inodes " - "array."); + "array.\n"); free(m); free(ni); errno = err; @@ -1477,7 +1476,7 @@ undo_data_init: undo_mftbmp_alloc: err = errno; if (ntfs_bitmap_clear_bit(mftbmp_na, bit)) - ntfs_log_error("Failed to clear bit in mft bitmap.%s", es); + ntfs_log_error("Failed to clear bit in mft bitmap.%s\n", es); errno = err; err_out: if (!errno) diff --git a/libntfs/runlist.c b/libntfs/runlist.c index 22f46a1d..85d96881 100644 --- a/libntfs/runlist.c +++ b/libntfs/runlist.c @@ -912,7 +912,7 @@ mpa_err: rlpos++; } else if (deltaxcn > max_cluster) { ntfs_log_debug("Corrupt attribute. deltaxcn = " - "0x%llx, max_cluster = 0x%llx", + "0x%llx, max_cluster = 0x%llx\n", (long long)deltaxcn, (long long)max_cluster); goto mpa_err; diff --git a/libntfs/tree.c b/libntfs/tree.c index 9cb2d382..9dc5ef87 100644 --- a/libntfs/tree.c +++ b/libntfs/tree.c @@ -2000,7 +2000,7 @@ int ntfs_dt_alloc_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, st ntfs_log_debug("need %d, have %d\n", need, space); if (need > space) { - ntfs_log_debug("no room"); + ntfs_log_debug("no room\n"); return 0; } @@ -2101,7 +2101,7 @@ int ntfs_dt_root_add(struct ntfs_dt *parent, int index_num, INDEX_ENTRY *ie, str ntfs_log_debug("need %d, have %d\n", need, space); if (need > space) { - ntfs_log_debug("no room"); + ntfs_log_debug("no room\n"); return -1; } diff --git a/libntfs/unix_io.c b/libntfs/unix_io.c index 9ee5f3de..0b702ba1 100644 --- a/libntfs/unix_io.c +++ b/libntfs/unix_io.c @@ -104,7 +104,7 @@ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags) flk.l_start = flk.l_len = 0LL; if (fcntl(DEV_FD(dev), F_SETLK, &flk)) { err = errno; - ntfs_log_debug("ntfs_device_unix_io_open: Could not lock %s for %s", + ntfs_log_debug("ntfs_device_unix_io_open: Could not lock %s for %s\n", dev->d_name, NDevReadOnly(dev) ? "reading" : "writing"); if (close(DEV_FD(dev))) ntfs_log_perror("ntfs_device_unix_io_open: Warning: Could not " diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index 44e44d21..a24abb3e 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -701,7 +701,7 @@ static BOOL ntfs_device_win32_find_partition(HANDLE handle, DWORD partition_id, err = GetLastError(); free(drive_layout); if (err != ERROR_INSUFFICIENT_BUFFER) { - ntfs_log_trace("GetDriveLayout failed."); + ntfs_log_trace("GetDriveLayout failed.\n"); errno = ntfs_w32error_to_errno(err); return FALSE; } From ca689776fa8357593d7e0ce6b9c6d495765fc5f4 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 7 Dec 2005 21:04:37 +0000 Subject: [PATCH 2809/2994] Fix --info option description which got broken by a white space cleanup --- ntfsprogs/ntfsresize.8.in | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 3cfc7f8b..ed7ef7f4 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSRESIZE 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH NTFSRESIZE 8 "2005\-12\-08" "ntfsprogs version @VERSION@" .SH NAME ntfsresize \- resize an NTFS filesystem without data loss .SH SYNOPSIS @@ -122,9 +122,7 @@ smaller size than what you got by this option and depending on several factors it might be unable to shrink very close to this theoretical size. Although the integrity of your data should be never in risk, it's still strongly recommended to make a test run by using the -.TP -\fB\-n\fR, \fB\-\-no\-action\fR -option before real resizing. +\fB\-\-no\-action\fR option before real resizing. Practically the smallest shrunken size generally is at around "used space" + (20\-200 MB). Please also take into account that Windows might need about 50\-100 MB free space left to boot safely. From 58e93f46e004eff0aaa58e47eb8d0c6f87dc6bb7 Mon Sep 17 00:00:00 2001 From: szaka Date: Wed, 7 Dec 2005 21:52:46 +0000 Subject: [PATCH 2810/2994] Restore more formatting, etc issues broken by white space, etc cleanups --- ntfsprogs/ntfsclone.8.in | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 6a46f51b..9176af21 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -3,7 +3,7 @@ .\" Copyright (c) 2004 Per Olofsson. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLONE 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH NTFSCLONE 8 "2005\-12\-08" "ntfsprogs version @VERSION@" .SH NAME ntfsclone \- Efficiently clone, image, restore or rescue an NTFS .SH SYNOPSIS @@ -31,11 +31,13 @@ copies only the used data. Unused disk space becomes zero (cloning to sparse file), encoded with control codes (saving in special image format), left unchanged (cloning to a disk/partition) or filled with zeros (cloning to standard output). + .B ntfsclone can be useful to make backups, an exact snapshot of an NTFS filesystem and restore it later on, or for developers to test NTFS read/write functionality, troubleshoot/investigate users' issues using the clone without the risk of destroying the original filesystem. + The clone, if not using the special image format, is an exact copy of the original NTFS filesystem from sector to sector thus it can be also mounted just like the original NTFS filesystem. @@ -60,22 +62,24 @@ cp, gzip, gunzip, bzip2, bunzip2, cat, etc) large sparse files. The only main Linux filesystem having support for efficient sparse file handling is XFS by the XFS_IOC_GETBMAPX -.BR ioctl . +.BR ioctl (2) . However none of the common utilities supports it. This means when you tar, cp, gzip, bzip2, etc a large sparse file they will always read the entire file, even if you use the "sparse support" options. -.B bzip2 + +.BR bzip2 (1) compresses large sparse files much better than -.B gzip +.BR gzip (1) but it does so also much slower. Moreover neither of them handles large sparse files efficiently during uncompression from disk space usage point of view. + At present the most efficient way, both speed and space\-wise, to compress and uncompress large sparse files by common tools is using -.B tar +.BR tar (1) with the options .B \-S (handle sparse files "efficiently") and @@ -100,6 +104,7 @@ filesystem images over the network and similar, and can be used as a replacement for Ghost or Partition Image if it is combined with other tools. The downside is that you can't mount the image directly, you need to restore it first. + To save an image using the special image format, use the .B \-s or the @@ -122,9 +127,11 @@ or and the clone still will be mountable. In this case all non\-metadata file content will be lost and reading them back will result always zeros. + The metadata\-only image can be compressed very well, usually to not more than 1\-3 MB thus it's relatively easy to transfer for investigation, troubleshooting. + In this mode of ntfsclone, .B NONE of the user's data is saved, including the resident user's data @@ -132,6 +139,7 @@ embedded into metadata. All is filled with zeros. Moreover all the file timestamps, deleted and unused spaces inside the metadata are filled with zeros. Thus this mode is inappropriate for example for forensic analyses. + Please note, filenames are not wiped out. They might contain sensitive information, so think twice before sending such an image to anybody. @@ -142,12 +150,12 @@ accepts. Nearly all options have two equivalent names. The short name is preceded by .B \- and the long name is preceded by -.BR \-\- . +.B \-\- . Any single letter options, that don't take an argument, can be combined into a single command, e.g. .B \-fv is equivalent to -.BR "\-f \-v" . +.B "\-f \-v" . Long named options can be abbreviated to any unique prefix of their name. .TP \fB\-o\fR, \fB\-\-output\fR FILE @@ -268,7 +276,7 @@ Pack NTFS metadata for NTFS experts .B tar \-cjSf ntfsmeta.img.tar.bz2 ntfsmeta.img .sp .RE -.SH BUGS +.SH KNOWN ISSUES There are no known problems with .BR ntfsclone . If you find a bug please send an email describing the problem to the @@ -287,8 +295,8 @@ XFS, JFS and ext3 don't have this problem. .hy .SH AUTHORS .B ntfsclone -was written by Szabolcs Szakacsits and Anton Altaparmakov, with contributions -from Per Olofsson. +was written by Szabolcs Szakacsits with contributions from Per Olofsson +(special image format support) and Anton Altaparmakov. .SH AVAILABILITY .B ntfsclone is part of the From eba747ac936418b50c63fbf586be5d1fe95d8e12 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 18 Dec 2005 16:27:20 +0000 Subject: [PATCH 2811/2994] * Add NTFS_DEV_LIST define. Use it everywhere instead of linux-ntfs-dev@lists.sf.net. * Replace all ntfs_log_trace where we ask to send mail to us with ntfs_log_error --- include/ntfs/support.h | 5 +++++ libntfs/attrib.c | 40 ++++++++++++++++++++-------------------- libntfs/dir.c | 24 ++++++++++++------------ libntfs/mft.c | 13 ++++++------- ntfsprogs/mkntfs.c | 11 ++++++----- ntfsprogs/ntfsdecrypt.c | 5 ++--- ntfsprogs/ntfsinfo.c | 4 ++-- ntfsprogs/ntfsresize.c | 4 ++-- ntfsprogs/utils.c | 2 +- 9 files changed, 56 insertions(+), 52 deletions(-) diff --git a/include/ntfs/support.h b/include/ntfs/support.h index 1c295672..76114d6a 100644 --- a/include/ntfs/support.h +++ b/include/ntfs/support.h @@ -30,6 +30,11 @@ #include #endif +/* + * Our mailing list. Use this define to prevent typos in email address. + */ +#define NTFS_DEV_LIST "linux-ntfs-dev@lists.sf.net" + /* * Generic macro to convert pointers to values for comparison purposes. */ diff --git a/libntfs/attrib.c b/libntfs/attrib.c index 9a525a5f..4e3612da 100644 --- a/libntfs/attrib.c +++ b/libntfs/attrib.c @@ -1220,9 +1220,9 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) * @cur_vcn, because we missed it during * instantiating of the hole. */ - ntfs_log_trace("BUG! Failed to find run after " + ntfs_log_error("BUG! Failed to find run after " "instantiating. Please report " - "to the linux-ntfs-dev@lists.sf.net.\n"); + "to the %s.\n", NTFS_DEV_LIST); errno = EIO; goto err_out; } @@ -1231,9 +1231,9 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b) rl++; /* Now LCN shoudn't be less than 0. */ if (rl->lcn < 0) { - ntfs_log_trace("BUG! LCN is lesser than 0. Please " - "report to the " - "linux-ntfs-dev@lists.sf.net.\n"); + ntfs_log_error("BUG! LCN is lesser than 0. " + "Please report to the %s.\n", + NTFS_DEV_LIST); errno = EIO; goto err_out; } @@ -3969,9 +3969,9 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx) * Bug, because ntfs_attr_record_resize should not fail (we * already checked that attribute fits MFT record). */ - ntfs_log_trace("BUG! Failed to resize attribute record. Please " - "report to the linux-ntfs-dev@lists.sf.net. " - "Aborting...\n"); + ntfs_log_error("BUG! Failed to resize attribute record. " + "Please report to the %s. Aborting...\n", + NTFS_DEV_LIST); errno = EIO; return -1; } @@ -4327,11 +4327,12 @@ retry: if (ntfs_attr_record_resize(m, a, le16_to_cpu(a->mapping_pairs_offset) + mp_size)) { - ntfs_log_trace("BUG! Ran out of space in mft record. " - "Please run chkdsk and if that " - "doesn't find any errors please " - "report you saw this message to " - "linux-ntfs-dev@lists.sf.net.\n"); + ntfs_log_error("BUG! Ran out of space in mft " + "record. Please run chkdsk and " + "if that doesn't find any " + "errors please report you saw " + "this message to %s.\n", + NTFS_DEV_LIST); err = EIO; goto put_err_out; } @@ -4357,11 +4358,10 @@ retry: finished_build = TRUE; if (!finished_build && errno != ENOSPC) { err = errno; - ntfs_log_trace("BUG! Mapping pairs build failed. " + ntfs_log_error("BUG! Mapping pairs build failed. " "Please run chkdsk and if that doesn't " "find any errors please report you saw " - "this message to " - "linux-ntfs-dev@lists.sf.net.\n"); + "this message to %s.\n", NTFS_DEV_LIST); goto put_err_out; } a->highest_vcn = cpu_to_sle64(stop_vcn - 1); @@ -4452,10 +4452,10 @@ retry: stop_vcn, &stop_vcn); if (err < 0 && errno != ENOSPC) { err = errno; - ntfs_log_trace("BUG! Mapping pairs build failed. Please " - "run chkdsk and if that doesn't find " - "any errors please report you saw this " - "message to linux-ntfs-dev@lists.sf.net.\n"); + ntfs_log_error("BUG! Mapping pairs build failed. " + "Please run chkdsk and if that doesn't " + "find any errors please report you saw " + "this message to %s.\n", NTFS_DEV_LIST); if (ntfs_mft_record_free(na->ni->vol, ni)) ntfs_log_trace("Couldn't free MFT record.\n"); goto put_err_out; diff --git a/libntfs/dir.c b/libntfs/dir.c index 3a0c5ea8..851ce568 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -193,12 +193,12 @@ found_it: IGNORE_CASE, vol->upcase, vol->upcase_len)) { /* Only one case insensitive matching name allowed. */ if (mref) { - ntfs_log_debug("Found already cached mft reference " - "in phase 1. Please run " - "chkdsk and if that doesn't " - "find any errors please report " - "you saw this message to " - "linux-ntfs-dev@lists.sf.net.\n"); + ntfs_log_error("Found already cached mft " + "reference in phase 1. Please " + "run chkdsk and if that doesn't" + " find any errors please report" + " you saw this message to %s\n", + NTFS_DEV_LIST); goto put_err_out; } mref = le64_to_cpu(ie->indexed_file); @@ -386,12 +386,12 @@ found_it2: IGNORE_CASE, vol->upcase, vol->upcase_len)) { /* Only one case insensitive matching name allowed. */ if (mref) { - ntfs_log_debug("Found already cached mft reference " - "in phase 2. Please run " - "chkdsk and if that doesn't " - "find any errors please report " - "you saw this message to " - "linux-ntfs-dev@lists.sf.net.\n"); + ntfs_log_error("Found already cached mft " + "reference in phase 2. Please " + "run chkdsk and if that doesn't" + " find any errors please report" + " you saw this message to %s\n", + NTFS_DEV_LIST); goto close_err_out; } mref = le64_to_cpu(ie->indexed_file); diff --git a/libntfs/mft.c b/libntfs/mft.c index 68c1fca6..afe9a1be 100644 --- a/libntfs/mft.c +++ b/libntfs/mft.c @@ -315,13 +315,12 @@ int ntfs_mft_record_layout(const ntfs_volume *vol, const MFT_REF mref, NTFS_BLOCK_SIZE + 1); else { mrec->usa_count = cpu_to_le16(1); - ntfs_log_debug("Sector size is bigger than MFT record size. " - "Setting usa_count to 1. If Windows\n"); - ntfs_log_debug("chkdsk reports this as corruption, please email " - "linux-ntfs-dev@lists.sf.net\n"); - ntfs_log_debug("stating that you saw this message and that the " - "file system created was corrupt.\n"); - ntfs_log_debug("Thank you.\n"); + ntfs_log_error("Sector size is bigger than MFT record size. " + "Setting usa_count to 1. If Windows chkdsk " + "reports this as corruption, please email %s " + "stating that you saw this message and that " + "the file system created was corrupt. " + "Thank you.\n", NTFS_DEV_LIST); } /* Set the update sequence number to 1. */ *(u16*)((u8*)mrec + le16_to_cpu(mrec->usa_ofs)) = cpu_to_le16(1); diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 2879c177..c0040f2c 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -2478,11 +2478,12 @@ static int upgrade_to_large_index(MFT_RECORD *m, const char *name, NTFS_BLOCK_SIZE + 1); } else { ia_val->usa_count = cpu_to_le16(1); - ntfs_log_quiet("Sector size is bigger than index block size. Setting " - "usa_count to 1. If Windows\nchkdsk reports this as " - "corruption, please email linux-ntfs-dev@lists.sf.net\n" - "stating that you saw this message and that the file " - "system created was corrupt.\nThank you."); + ntfs_log_error("Sector size is bigger than index block size. " + "Setting usa_count to 1. If Windows chkdsk " + "reports this as corruption, please email %s " + "stating that you saw this message and that " + "the filesystem created was corrupt. " + "Thank you.", NTFS_DEV_LIST); } /* Set USN to 1. */ *(u16*)((char*)ia_val + le16_to_cpu(ia_val->usa_ofs)) = diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c index 3fe1ed77..d7cdaf0b 100644 --- a/ntfsprogs/ntfsdecrypt.c +++ b/ntfsprogs/ntfsdecrypt.c @@ -1032,10 +1032,9 @@ static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, else ntfs_log_error("Unknown crypto algorithm 0x%x\n", le32_to_cpu(fek->alg_id)); - ntfs_log_error(". Please email linux-ntfs-dev@lists." - "sourceforge.net and say that you saw this " + ntfs_log_error(". Please email %s and say that you saw this " "message. We will then try to implement " - "support for this algorithm.\n"); + "support for this algorithm.\n", NTFS_DEV_LIST); err = EOPNOTSUPP; goto out; } diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 9acbba4f..c60cfb67 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1871,8 +1871,8 @@ static void ntfs_hex_dump(void *buf,unsigned int length) static void ntfs_dump_attr_unknown(ATTR_RECORD *attr) { printf("Dumping unknown attribute type 0x%X.\n" - "--Please report this to linux-ntfs-dev@lists.sourceforge.net--\n", - (unsigned int)le32_to_cpu(attr->type)); + "--Please report this to %s--\n", + (unsigned int)le32_to_cpu(attr->type), NTFS_DEV_LIST); printf("\tResident size:\t\t %u\n",(unsigned int)le32_to_cpu(attr->length)); diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index e8927972..36745eea 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2039,11 +2039,11 @@ static int check_bad_sectors(ntfs_volume *vol) if (NInoAttrList(ctx->ntfs_ino)) err_exit("Hopelessly many bad sectors! Please report to " - "linux-ntfs-dev@lists.sf.net\n"); + "%s\n", NTFS_DEV_LIST); if (!ctx->attr->non_resident) err_exit("Resident attribute in $BadClust! Please report to " - "linux-ntfs-dev@lists.sf.net\n"); + "%s\n", NTFS_DEV_LIST); if (!(rl = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL))) perr_exit("Decompressing $BadClust:$Bad mapping pairs failed"); diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c index abc2cd3c..2be2bc53 100644 --- a/ntfsprogs/utils.c +++ b/ntfsprogs/utils.c @@ -72,7 +72,7 @@ #include "version.h" #include "logging.h" -const char *ntfs_bugs = "Developers' email address: linux-ntfs-dev@lists.sourceforge.net\n"; +const char *ntfs_bugs = "Developers' email address: "NTFS_DEV_LIST"\n"; const char *ntfs_home = "Linux NTFS homepage: http://www.linux-ntfs.org\n"; const char *ntfs_gpl = "This program is free software, released under the GNU " "General Public License\nand you are welcome to redistribute it under " From d003694463cc30cd016bccecfcdb35dbcd30e451 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 7 Jan 2006 06:26:43 +0000 Subject: [PATCH 2812/2994] Fix more formatting broken by somebody's "cleanup" --- ntfsprogs/ntfsresize.8.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index ed7ef7f4..559a24cd 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -123,9 +123,11 @@ factors it might be unable to shrink very close to this theoretical size. Although the integrity of your data should be never in risk, it's still strongly recommended to make a test run by using the \fB\-\-no\-action\fR option before real resizing. + Practically the smallest shrunken size generally is at around "used space" + (20\-200 MB). Please also take into account that Windows might need about 50\-100 MB free space left to boot safely. + This option never causes any changes to the filesystem, the partition is opened read\-only. .TP From a79dc381b7921d665dc0ef9a29ea27439b2001d0 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 7 Jan 2006 08:20:33 +0000 Subject: [PATCH 2813/2994] ntfsinfo: dump $Secure:$SDS in verbose mode --- ChangeLog | 1 + ntfsprogs/ntfsinfo.c | 185 +++++++++++++++++++++++++++++++------------ 2 files changed, 137 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1baf0975..4c2c74a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -93,6 +93,7 @@ xx/xx/2005 - 1.12.2-WIP in the /$Extend/$Quota:$Q index root attributes. (Szaka) - ntfsmount: Add FreeBSD support. (Yura) - ntfsmount: Fix bug with moving non-empty directories. (Yura) + - ntfsinfo: dump $Secure:$SDS in verbose mode. (Szaka) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index c60cfb67..9ab8763a 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -817,15 +817,15 @@ static void ntfs_dump_attr_object_id(ATTR_RECORD *attr,ntfs_volume *vol) /** * ntfs_dump_acl * - * given an acl, print it in a beautiful & lovley way. + * given an acl, print it in a beautiful & lovely way. */ -static void ntfs_dump_acl(const char *prefix,ACL *acl) +static void ntfs_dump_acl(const char *prefix, ACL *acl) { unsigned int i; u16 ace_count; ACCESS_ALLOWED_ACE *ace; - printf("%sRevision\t %u\n",prefix,acl->revision); + printf("%sRevision\t %u\n", prefix, acl->revision); /* don't recalc le16_to_cpu every iteration (minor speedup on big-endians */ ace_count = le16_to_cpu(acl->ace_count); @@ -834,7 +834,7 @@ static void ntfs_dump_acl(const char *prefix,ACL *acl) ace = (ACCESS_ALLOWED_ACE *)((char *)acl + 8); /* iterate through ACE's */ - for (i=1;iflags), (unsigned int)le32_to_cpu(ace->mask)); /* get a SID string */ sid = ntfs_sid_to_mbs(&ace->sid, NULL, 0); - printf("%s\t\t SID: %s\n",prefix,sid); + printf("%s\t\t SID: %s\n", prefix, sid); free(sid); /* proceed to next ACE */ @@ -867,6 +867,54 @@ static void ntfs_dump_acl(const char *prefix,ACL *acl) } } + +static void ntfs_dump_security_descriptor(SECURITY_DESCRIPTOR_ATTR *sec_desc, + const char *indent) +{ + char *sid; + + printf("%s\tRevision:\t\t %u\n", indent, sec_desc->revision); + + /* TODO: parse the flags */ + printf("%s\tFlags:\t\t\t 0x%0x\n", indent, sec_desc->control); + + sid = ntfs_sid_to_mbs((SID *)((char *)sec_desc + + le32_to_cpu(sec_desc->owner)), NULL, 0); + printf("%s\tOwner SID:\t\t %s\n", indent, sid); + free(sid); + + sid = ntfs_sid_to_mbs((SID *)((char *)sec_desc + + le32_to_cpu(sec_desc->group)), NULL, 0); + printf("%s\tGroup SID:\t\t %s\n", indent, sid); + free(sid); + + printf("%s\tSystem ACL:\t\t ", indent); + if (sec_desc->control & SE_SACL_PRESENT) { + if (sec_desc->control & SE_SACL_DEFAULTED) { + printf("defaulted"); + } + printf("\n"); + ntfs_dump_acl(indent ? "\t\t\t" : "\t\t", + (ACL *)((char *)sec_desc + + le32_to_cpu(sec_desc->sacl))); + } else { + printf("missing\n"); + } + + printf("%s\tDiscretionary ACL:\t ", indent); + if (sec_desc->control & SE_DACL_PRESENT) { + if (sec_desc->control & SE_SACL_DEFAULTED) { + printf("defaulted"); + } + printf("\n"); + ntfs_dump_acl(indent ? "\t\t\t" : "\t\t", + (ACL *)((char *)sec_desc + + le32_to_cpu(sec_desc->dacl))); + } else { + printf("missing\n"); + } +} + /** * ntfs_dump_security_descriptor() * @@ -875,7 +923,6 @@ static void ntfs_dump_acl(const char *prefix,ACL *acl) static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *vol) { SECURITY_DESCRIPTOR_ATTR *sec_desc_attr; - char *sid; printf("Dumping attribute $SECURITY_DESCRIPTOR (0x50)\n"); @@ -914,46 +961,10 @@ static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *v le16_to_cpu(attr->value_offset)); } - printf("\tRevision:\t\t %u\n",sec_desc_attr->revision); - - /* TODO: parse the flags */ - printf("\tFlags:\t\t\t 0x%0x\n",sec_desc_attr->control); - - sid = ntfs_sid_to_mbs((SID *)((char *)sec_desc_attr + - le32_to_cpu(sec_desc_attr->owner)), NULL, 0); - printf("\tOwner SID:\t\t %s\n",sid); - free(sid); - - sid = ntfs_sid_to_mbs((SID *)((char *)sec_desc_attr + - le32_to_cpu(sec_desc_attr->group)), NULL, 0); - printf("\tGroup SID:\t\t %s\n",sid); - free(sid); - - printf("\tSystem ACL:\t\t "); - if (sec_desc_attr->control & SE_SACL_PRESENT) { - if (sec_desc_attr->control & SE_SACL_DEFAULTED) { - printf("defaulted"); - } - printf("\n"); - ntfs_dump_acl("\t\t",(ACL *)((char *)sec_desc_attr + - le32_to_cpu(sec_desc_attr->sacl))); - } else { - printf("missing\n"); - } - - printf("\tDiscretionary ACL:\t\t "); - if (sec_desc_attr->control & SE_DACL_PRESENT) { - if (sec_desc_attr->control & SE_SACL_DEFAULTED) { - printf("Defaulted"); - } - printf("\n"); - ntfs_dump_acl("\t\t",(ACL *)((char *)sec_desc_attr + - le32_to_cpu(sec_desc_attr->dacl))); - } else { - printf("missing\n"); - } - - if (attr->non_resident) free(sec_desc_attr); + ntfs_dump_security_descriptor(sec_desc_attr, ""); + + if (attr->non_resident) + free(sec_desc_attr); } /** @@ -1037,13 +1048,86 @@ static void ntfs_dump_attr_volume_information(ATTR_RECORD *attr) vol_information->flags & (0xFFFF - VOLUME_FLAGS_MASK)); } +static ntfschar NTFS_DATA_SDS[5] = { const_cpu_to_le16('$'), + const_cpu_to_le16('S'), const_cpu_to_le16('D'), + const_cpu_to_le16('S'), const_cpu_to_le16('\0') }; + +static void ntfs_dump_sds_entry(SECURITY_DESCRIPTOR_HEADER *sds) +{ + SECURITY_DESCRIPTOR_RELATIVE *sd; + + ntfs_log_verbose("\t\tHash:\t\t\t 0x%08x\n", le32_to_cpu(sds->hash)); + ntfs_log_verbose("\t\tSecurity id:\t\t %u\n", + le32_to_cpu(sds->security_id)); + ntfs_log_verbose("\t\tOffset:\t\t\t %llu\n", le64_to_cpu(sds->offset)); + ntfs_log_verbose("\t\tLength:\t\t\t %u\n", le32_to_cpu(sds->length)); + + sd = (SECURITY_DESCRIPTOR_RELATIVE *)((char *)sds + + sizeof(SECURITY_DESCRIPTOR_HEADER)); + + ntfs_dump_security_descriptor(sd, "\t"); +} + +static void ntfs_dump_sds(ATTR_RECORD *attr, ntfs_inode *ni) +{ + SECURITY_DESCRIPTOR_HEADER *sds, *sd; + ntfs_attr *na; + ntfschar *name; + int name_len; + u64 inode; + + inode = ni->mft_no; + if (ni->nr_extents < 0) + inode = ni->base_ni->mft_no; + if (FILE_Secure != inode) + return; + + name_len = le16_to_cpu(attr->name_length); + if (!name_len) + return; + + name = (ntfschar *)((u8 *)attr + le16_to_cpu(attr->name_offset)); + if (!ntfs_names_are_equal(NTFS_DATA_SDS, sizeof(NTFS_DATA_SDS) / 2 - 1, + name, name_len, 0, NULL, 0)) + return; + + na = ntfs_attr_open(ni, AT_DATA, name, name_len); + if (!na) { + ntfs_log_perror("ntfs_attr_open failed"); + return; + } + sds = malloc(na->data_size); + if (!sds) { + ntfs_log_perror("malloc failed"); + return; + } + if (ntfs_attr_pread(na, 0, na->data_size, sds) != na->data_size) { + ntfs_log_perror("ntfs_attr_pread failed"); + free(sds); + return; + } + ntfs_attr_close(na); + + sd = sds; + + while (sd->length && sd->length != 32 && sd->hash) { + ntfs_dump_sds_entry(sd); + sd = (SECURITY_DESCRIPTOR_HEADER *)((char *)sd + + (cpu_to_le32(sd->length + 0x0F) & + ~cpu_to_le32(0x0F))); + } + + free(sds); +} /** * ntfs_dump_data_attr() * * dump some info about the data attribute */ -static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol) +static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_inode *ni) { + ntfs_volume *vol = ni->vol; + printf("Dumping attribute $DATA (0x80) related info\n"); /* Dump stream name */ @@ -1112,6 +1196,9 @@ static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_volume *vol) /* TODO: parse the flags */ printf("\tResidence Flags:\t 0x%02hhx\n", attr->resident_flags); } + + if (opts.verbose) + ntfs_dump_sds(attr, ni); } typedef enum { @@ -2036,7 +2123,7 @@ static void ntfs_dump_file_attributes(ntfs_inode *inode) ntfs_dump_attr_volume_information(ctx->attr); break; case AT_DATA: - ntfs_dump_attr_data(ctx->attr, inode->vol); + ntfs_dump_attr_data(ctx->attr, inode); break; case AT_INDEX_ROOT: ntfs_dump_attr_index_root(ctx->attr, inode); From 283db0a99e665e3d1a0f64f449729e42a971483a Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 7 Jan 2006 08:31:09 +0000 Subject: [PATCH 2814/2994] Don't create SDS entries which aren't needed --- ntfsprogs/mkntfs.c | 2 +- ntfsprogs/sd.c | 266 --------------------------------------------- 2 files changed, 1 insertion(+), 267 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index c0040f2c..b4ac7707 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -4710,7 +4710,7 @@ static BOOL mkntfs_create_root_structures(void) return FALSE; init_secure_30(buf_sds_init); } else { - buf_sds_first_size = 0x240; + buf_sds_first_size = 0xFC; buf_sds_size = 0x40000 + buf_sds_first_size; buf_sds_init = ntfs_calloc(1, buf_sds_first_size); if (!buf_sds_init) diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c index a9c5f82f..26c69aab 100644 --- a/ntfsprogs/sd.c +++ b/ntfsprogs/sd.c @@ -1025,272 +1025,6 @@ void init_secure_31(char *sd_val) sid->sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); -/* - * security descriptor #3 - */ - //header - sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80); - sds->hash = cpu_to_le32(0x0A9F9B62); - sds->security_id = cpu_to_le32(0x0102); - sds->offset = cpu_to_le64(0x0100); - sds->length = cpu_to_le32(0x60); - - //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + - sizeof(SECURITY_DESCRIPTOR_HEADER)); - sd->revision = 0x01; - sd->alignment = 0x00; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x30); - sd->group = cpu_to_le32(0x40); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); - - //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); - acl->revision = 0x02; - acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x1C); - acl->ace_count = cpu_to_le16(0x01); - acl->alignment2 = 0x00; - - //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - ace->type = 0x00; - ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; - ace->size = cpu_to_le16(0x14); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_LIST_DIRECTORY | FILE_WRITE_DATA | - FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | - FILE_TRAVERSE | FILE_DELETE_CHILD | - FILE_READ_ATTRIBUTES; - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - - //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - - //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - -/* - * security descriptor #4 - */ - //header - sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80 + 0x60); - sds->hash = cpu_to_le32(0x0A9F9562); - sds->security_id = cpu_to_le32(0x0103); - sds->offset = cpu_to_le64(0x0160); - sds->length = cpu_to_le32(0x60); - - //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + - sizeof(SECURITY_DESCRIPTOR_HEADER)); - sd->revision = 0x01; - sd->alignment = 0x00; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x30); - sd->group = cpu_to_le32(0x40); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); - - //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); - acl->revision = 0x02; - acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x1C); - acl->ace_count = cpu_to_le16(0x01); - acl->alignment2 = 0x00; - - //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_LIST_DIRECTORY | FILE_WRITE_DATA | - FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | - FILE_TRAVERSE | FILE_DELETE_CHILD | - FILE_READ_ATTRIBUTES; - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - - //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x01; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - -/* - * security descriptor #5 - */ - //header - sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80 + - 0x60 + 0x60); - sds->hash = cpu_to_le32(0x453F0A2E); - sds->security_id = cpu_to_le32(0x0104); - sds->offset = cpu_to_le64(0x01C0); - sds->length = cpu_to_le32(0x78); - - //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + - sizeof(SECURITY_DESCRIPTOR_HEADER)); - sd->revision = 0x01; - sd->alignment = 0x00; - sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); - - //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); - acl->revision = 0x02; - acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(0x02); - acl->alignment2 = 0x00; - - //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x18); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_LIST_DIRECTORY | FILE_WRITE_DATA | - FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | - FILE_TRAVERSE | FILE_DELETE_CHILD | - FILE_READ_ATTRIBUTES; - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x02; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); - ace->type = 0x00; - ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | - FILE_LIST_DIRECTORY | FILE_WRITE_DATA | - FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | - FILE_TRAVERSE | FILE_DELETE_CHILD | - FILE_READ_ATTRIBUTES; - ace->sid.revision = 0x01; - ace->sid.sub_authority_count = 0x01; - /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ - ace->sid.identifier_authority.value[0] = 0; - ace->sid.identifier_authority.value[1] = 0; - ace->sid.identifier_authority.value[2] = 0; - ace->sid.identifier_authority.value[3] = 0; - ace->sid.identifier_authority.value[4] = 0; - ace->sid.identifier_authority.value[5] = 5; - ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - - //owner sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); - sid->revision = 0x01; - sid->sub_authority_count = 0x02; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - - //group sid - sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); - sid->revision = 0x01; - sid->sub_authority_count = 0x01; - // SECURITY_NT_SID_AUTHORITY (S-1-5) - sid->identifier_authority.value[0] = 0; - sid->identifier_authority.value[1] = 0; - sid->identifier_authority.value[2] = 0; - sid->identifier_authority.value[3] = 0; - sid->identifier_authority.value[4] = 0; - sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - return; } From 98c16f8ae003c58a18de0c7c019cae8985f7fa66 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 7 Jan 2006 09:29:29 +0000 Subject: [PATCH 2815/2994] Change the NTFS version short option from the cryptic -w to -N --- ntfsprogs/mkntfs.8.in | 16 ++++++------- ntfsprogs/mkntfs.c | 55 ++++++++++++++++++++++--------------------- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index faf86720..1fe7e41e 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -44,6 +44,10 @@ mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system .B \-n ] [ +.B \-N +.I ntfs\-version +] +[ .B \-p .I part\-start\-sect ] @@ -71,10 +75,6 @@ mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system .B \-v ] [ -.B \-w -.I ntfs\-version -] -[ .B \-z .I mft\-zone\-multiplier ] @@ -160,6 +160,10 @@ to create a filesystem. All steps of the format are carried out except the actual writing to the device. .SS Advanced options .TP +\fB\-N\fR, \fB\-\-ntfs\-version\fR STRING +Select the version of NTFS you wish to use. This can be one of "1.2", "3.0", +or "3.1". +.TP \fB\-s\fR, \fB\-\-sector\-size\fR BYTES Specify the size of sectors in bytes. Valid sector size values are 256, 512, 1024, 2048 and 4096 bytes per sector. If omitted, @@ -225,10 +229,6 @@ multiplier (% of volume size) Fake the time to be 00:00:00 UTC, Jan 1, 1970 instead of the current system time. This is only really useful for debugging purposes. .TP -\fB\-w\fR, \fB\-\-ntfs\-version\fR STRING -Select the version of NTFS you wish to use. This can be one of "1.2", "3.0", -or "3.1". -.TP \fB\-F\fR, \fB\-\-force\fR Force .B mkntfs diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index b4ac7707..9c10739a 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2005 Anton Altaparmakov * Copyright (c) 2001-2005 Richard Russon - * Copyright (c) 2002-2005 Szabolcs Szakacsits + * Copyright (c) 2002-2006 Szabolcs Szakacsits * Copyright (c) 2005 Erik Sornes * * This utility will create an NTFS 1.2, 3.0 or 3.1 volume on a user @@ -198,7 +198,7 @@ struct mkntfs_options { long mft_zone_multiplier; /* -z, value from 1 to 4. Default is 1. */ long long num_sectors; /* size of device in sectors */ long cluster_size; /* -c, format with this cluster-size */ - u8 ver_major; /* -w, ntfs version to create */ + u8 ver_major; /* -N, ntfs version to create */ u8 ver_minor; char *label; /* -L, volume label */ } opts; @@ -235,7 +235,7 @@ static void mkntfs_usage(void) " -S, --sectors-per-track NUM Specify the number of sectors per track\n" " -z, --mft-zone-multiplier NUM Set the MFT zone multiplier\n" " -T, --zero-time Fake the time to be 00:00 UTC, Jan 1, 1970\n" - " -w, --ntfs-version STRING NTFS version information\n" + " -N, --ntfs-version VERSION NTFS version: 3.1 or 1.2 (default)\n" " -F, --force Force execution despite errors\n" "\n" "Output options:\n" @@ -260,7 +260,8 @@ static void mkntfs_version(void) ntfs_log_info("Create an NTFS volume on a user specified (block) device.\n\n"); ntfs_log_info("Copyright (c) 2000-2005 Anton Altaparmakov\n"); ntfs_log_info("Copyright (c) 2001-2005 Richard Russon\n"); - ntfs_log_info("Copyright (c) 2002-2005 Szabolcs Szakacsits\n"); + ntfs_log_info("Copyright (c) 2002-2006 Szabolcs Szakacsits\n"); + ntfs_log_info("Copyright (c) 2005 Erik Sornes\n"); ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home); } @@ -342,7 +343,7 @@ static void mkntfs_init_options(struct mkntfs_options *opts2) */ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options *opts2) { - static const char *sopt = "-c:CfFhH:IlL:np:qQs:S:TvVw:z:"; + static const char *sopt = "-c:CfFhH:IlL:nN:p:qQs:S:TvVz:"; static const struct option lopt[] = { { "cluster-size", required_argument, NULL, 'c' }, { "debug", no_argument, NULL, 'Z' }, @@ -356,7 +357,7 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * { "mft-zone-multiplier",required_argument, NULL, 'z' }, { "no-action", no_argument, NULL, 'n' }, { "no-indexing", no_argument, NULL, 'I' }, - { "ntfs-version", required_argument, NULL, 'w' }, + { "ntfs-version", required_argument, NULL, 'N' }, { "partition-start", required_argument, NULL, 'p' }, { "quick", no_argument, NULL, 'Q' }, { "quiet", no_argument, NULL, 'q' }, @@ -426,6 +427,26 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * case 'n': opts2->no_action = TRUE; break; + case 'N': /* ntfs-version */ + if ((opts2->ver_major == 0) && (opts2->ver_minor == 0)) { + if (strcmp(optarg , "1.2") == 0) { + opts2->ver_major = 1; + opts2->ver_minor = 2; + } else if (strcmp(optarg , "3.0") == 0) { + opts2->ver_major = 3; + opts2->ver_minor = 0; + } else if (strcmp(optarg , "3.1") == 0) { + opts2->ver_major = 3; + opts2->ver_minor = 1; + } else { + ntfs_log_error("NTFS version '%s' is invalid.\n", optarg); + err++; + } + } else { + ntfs_log_error("You may only specify the NTFS version once.\n"); + err++; + } + break; case 'p': if (!mkntfs_parse_llong(optarg, "partition start", &opts2->part_start_sect)) err++; @@ -450,26 +471,6 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * case 'V': ver++; /* display version info */ break; - case 'w': /* ntfs-version */ - if ((opts2->ver_major == 0) && (opts2->ver_minor == 0)) { - if (strcmp(optarg , "1.2") == 0) { - opts2->ver_major = 1; - opts2->ver_minor = 2; - } else if (strcmp(optarg , "3.0") == 0) { - opts2->ver_major = 3; - opts2->ver_minor = 0; - } else if (strcmp(optarg , "3.1") == 0) { - opts2->ver_major = 3; - opts2->ver_minor = 1; - } else { - ntfs_log_error("NTFS version '%s' is not supported.\n", optarg); - err++; - } - } else { - ntfs_log_error("You may only specify the NTFS version once.\n"); - err++; - } - break; case 'Z': /* debug - turn on everything */ ntfs_log_set_levels(NTFS_LOG_LEVEL_DEBUG | NTFS_LOG_LEVEL_TRACE | NTFS_LOG_LEVEL_VERBOSE | NTFS_LOG_LEVEL_QUIET); break; @@ -483,7 +484,7 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * if (((optopt == 'c') || (optopt == 'H') || (optopt == 'L') || (optopt == 'p') || (optopt == 's') || (optopt == 'S') || - (optopt == 'w') || (optopt == 'z')) && + (optopt == 'N') || (optopt == 'z')) && (!optarg)) { ntfs_log_error("Option '%s' requires an argument.\n", argv[optind-1]); } else if (optopt != '?') { From 67c087d77f921589ae8414eb501066cbcbf5208e Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 7 Jan 2006 15:30:19 +0000 Subject: [PATCH 2816/2994] Version 3.0 isn't supported (wasn't checked) --- ntfsprogs/mkntfs.8.in | 26 +++++++++++++++----------- ntfsprogs/mkntfs.c | 6 ++++-- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 1fe7e41e..9560f9c9 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -4,7 +4,7 @@ .\" .TH MKNTFS 8 "2005\-11\-21" "ntfsprogs version @VERSION@" .SH NAME -mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system +mkntfs \- create an NTFS file system .SH SYNOPSIS .B mkntfs [\fIoptions\fR] \fIdevice \fR[\fInumber\-of\-sectors\fR] @@ -87,8 +87,8 @@ mkntfs \- create an NTFS 1.2 (Windows NT/2000/XP) file system ] .SH DESCRIPTION .B mkntfs -is used to create an NTFS 1.2 (Windows NT 4.0) file system on a device (usually -a disk partition). +is used to create an NTFS file system on a device (usually a disk partition) +or file. .I device is the special file corresponding to the device (e.g .IR /dev/hdXX ). @@ -147,10 +147,13 @@ greater than 4096 have the side effect that compression is disabled on the volume (due to limitations in the NTFS compression algorithm currently in use by Windows). .TP -\fB\-I\fR, \fB\-\-no\-indexing\fR -Disable content indexing on the volume. (This is only meaningful on -Windows 2000 and later. Windows NT 4.0 and earlier ignore this as they do -not implement content indexing at all.) +\fB\-N\fR, \fB\-\-ntfs\-version\fR STRING +Select the version of NTFS you wish to create. This can be "1.2" +(Windows NT 4.0) or "3.1" (Windows XP, Server 2003 and Vista). +Versions are upwards compatible and Windows 2000, which uses version "3.0", +can read/write both. + +If this option is omitted then version "1.2" is used. .TP \fB\-n\fR, \fB\-\-no\-action\fR Causes @@ -160,10 +163,6 @@ to create a filesystem. All steps of the format are carried out except the actual writing to the device. .SS Advanced options .TP -\fB\-N\fR, \fB\-\-ntfs\-version\fR STRING -Select the version of NTFS you wish to use. This can be one of "1.2", "3.0", -or "3.1". -.TP \fB\-s\fR, \fB\-\-sector\-size\fR BYTES Specify the size of sectors in bytes. Valid sector size values are 256, 512, 1024, 2048 and 4096 bytes per sector. If omitted, @@ -229,6 +228,11 @@ multiplier (% of volume size) Fake the time to be 00:00:00 UTC, Jan 1, 1970 instead of the current system time. This is only really useful for debugging purposes. .TP +\fB\-I\fR, \fB\-\-no\-indexing\fR +Disable content indexing on the volume. (This is only meaningful on +Windows 2000 and later. Windows NT 4.0 and earlier ignore this as they do +not implement content indexing at all.) +.TP \fB\-F\fR, \fB\-\-force\fR Force .B mkntfs diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 9c10739a..a8f7c51b 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -6,7 +6,7 @@ * Copyright (c) 2002-2006 Szabolcs Szakacsits * Copyright (c) 2005 Erik Sornes * - * This utility will create an NTFS 1.2, 3.0 or 3.1 volume on a user + * This utility will create an NTFS 1.2 or 3.1 volume on a user * specified (block) device. * * Some things (option handling and determination of mount status) have been @@ -432,10 +432,12 @@ static BOOL mkntfs_parse_options(int argc, char *argv[], struct mkntfs_options * if (strcmp(optarg , "1.2") == 0) { opts2->ver_major = 1; opts2->ver_minor = 2; +/* + FIXME: version 3.0 was not checked } else if (strcmp(optarg , "3.0") == 0) { opts2->ver_major = 3; opts2->ver_minor = 0; - } else if (strcmp(optarg , "3.1") == 0) { +*/ } else if (strcmp(optarg , "3.1") == 0) { opts2->ver_major = 3; opts2->ver_minor = 1; } else { From 36add45fe7b6a0e8a889e1123d3911ee5cb34821 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sat, 7 Jan 2006 16:00:21 +0000 Subject: [PATCH 2817/2994] Fix build under systems other than Linux and FreeBSD. --- configure.ac | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f795b013..40ab5956 100644 --- a/configure.ac +++ b/configure.ac @@ -223,7 +223,13 @@ if test "$enable_fuse_module" != "no"; then AC_MSG_WARN([ntfsmount requires FUSE version >= 2.4.2 under FreeBSD, because earlier versions have problems with readdir.]) fi ]);; - *) AC_MSG_ERROR([ntfsmount can be built only under Linux and FreeBSD.]);; + *) + if test "$enable_fuse_module" = "yes"; then + AC_MSG_ERROR([ntfsmount can be built only under Linux and FreeBSD.]) + else + AC_MSG_WARN([ntfsmount can be built only under Linux and FreeBSD.]) + fi + ;; esac fi AM_CONDITIONAL(ENABLE_FUSE_MODULE, $compile_fuse_module) From 68290078e1a90b8555cef722646836a413ac8456 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 7 Jan 2006 18:41:38 +0000 Subject: [PATCH 2818/2994] Revert to the unambiguous update dates for all manual pages --- ntfsprogs/mkntfs.8.in | 5 +++-- ntfsprogs/ntfscat.8.in | 2 +- ntfsprogs/ntfsclone.8.in | 2 +- ntfsprogs/ntfscluster.8.in | 2 +- ntfsprogs/ntfscp.8.in | 2 +- ntfsprogs/ntfsfix.8.in | 2 +- ntfsprogs/ntfsinfo.8.in | 2 +- ntfsprogs/ntfslabel.8.in | 2 +- ntfsprogs/ntfsls.8.in | 2 +- ntfsprogs/ntfsmount.8.in | 2 +- ntfsprogs/ntfsprogs.8.in | 2 +- ntfsprogs/ntfsresize.8.in | 2 +- ntfsprogs/ntfsundelete.8.in | 2 +- 13 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 9560f9c9..c751c343 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -1,8 +1,9 @@ -.\" Copyright (c) 2001,2002 Anton Altaparmakov. +.\" Copyright (c) 2001\-2002 Anton Altaparmakov. .\" Copyright (c) 2005 Richard Russon. +.\" Copyright (c) 2005\-2006 Szabolcs Szakacsits. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH MKNTFS 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH MKNTFS 8 "January 2006" "ntfsprogs version @VERSION@" .SH NAME mkntfs \- create an NTFS file system .SH SYNOPSIS diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in index dd480eef..997058bd 100644 --- a/ntfsprogs/ntfscat.8.in +++ b/ntfsprogs/ntfscat.8.in @@ -1,7 +1,7 @@ .\" Copyright (c) 2003\-2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCAT 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH NTFSCAT 8 "November 2005" "ntfsprogs version @VERSION@" .SH NAME ntfscat \- print NTFS files and streams on the standard output .SH SYNOPSIS diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 9176af21..f62ee750 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -3,7 +3,7 @@ .\" Copyright (c) 2004 Per Olofsson. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLONE 8 "2005\-12\-08" "ntfsprogs version @VERSION@" +.TH NTFSCLONE 8 "December 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsclone \- Efficiently clone, image, restore or rescue an NTFS .SH SYNOPSIS diff --git a/ntfsprogs/ntfscluster.8.in b/ntfsprogs/ntfscluster.8.in index 629e8779..2ed2c1e0 100644 --- a/ntfsprogs/ntfscluster.8.in +++ b/ntfsprogs/ntfscluster.8.in @@ -1,7 +1,7 @@ .\" Copyright (c) 2003\-2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLUSTER 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH NTFSCLUSTER 8 "November 2005" "ntfsprogs version @VERSION@" .SH NAME ntfscluster \- identify files in a specified region of an NTFS volume. .SH SYNOPSIS diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in index a9af11f8..bb5febdf 100644 --- a/ntfsprogs/ntfscp.8.in +++ b/ntfsprogs/ntfscp.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCP 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH NTFSCP 8 "November 2005" "ntfsprogs version @VERSION@" .SH NAME ntfscp \- overwrite file on an NTFS volume. .SH SYNOPSIS diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index 0585dbf6..47a9754e 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSFIX 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH NTFSFIX 8 "November 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsfix \- fix common errors and force Windows to check NTFS .SH SYNOPSIS diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index 91dc1fe2..9d2abdf2 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSINFO 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH NTFSINFO 8 "November 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsinfo \- dump a file's attributes .SH SYNOPSIS diff --git a/ntfsprogs/ntfslabel.8.in b/ntfsprogs/ntfslabel.8.in index 137c46fc..a4b62a58 100644 --- a/ntfsprogs/ntfslabel.8.in +++ b/ntfsprogs/ntfslabel.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSLABEL 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH NTFSLABEL 8 "November 2005" "ntfsprogs version @VERSION@" .SH NAME ntfslabel \- display/change the label on an ntfs file system .SH SYNOPSIS diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index 17ef59f9..7d629ab5 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSLS 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH NTFSLS 8 "November 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsls \- list directory contents on an NTFS filesystem .SH SYNOPSIS diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 9a7eb453..1c4d5eea 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSMOUNT 8 "2005\-11\-27" "ntfsprogs version @VERSION@" +.TH NTFSMOUNT 8 "November 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsmount \- NTFS module for FUSE. .SH SYNOPSIS diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index 615f459d..796eaf4f 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -3,7 +3,7 @@ .\" Copyright (c) 2005 Szabolcs Szakacsits. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSPROGS 8 "2005\-11\-26" "ntfsprogs version @VERSION@" +.TH NTFSPROGS 8 "November 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsprogs \- several tools for doing neat things with NTFS partitions .SH OVERVIEW diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 559a24cd..59840872 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -2,7 +2,7 @@ .\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSRESIZE 8 "2005\-12\-08" "ntfsprogs version @VERSION@" +.TH NTFSRESIZE 8 "December 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsresize \- resize an NTFS filesystem without data loss .SH SYNOPSIS diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index 2cee5a70..29717350 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -1,7 +1,7 @@ .\" Copyright (c) 2002\-2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSUNDELETE 8 "2005\-11\-21" "ntfsprogs version @VERSION@" +.TH NTFSUNDELETE 8 "November 2005" "ntfsprogs version @VERSION@" .SH NAME ntfsundelete \- recover a deleted file from an NTFS volume. .SH SYNOPSIS From 6b36031ff477f47f84a7258f265fba0e979c41bb Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 7 Jan 2006 22:21:25 +0000 Subject: [PATCH 2819/2994] More manual reverts, updates --- ntfsprogs/ntfsclone.8.in | 22 +++++++++++----------- ntfsprogs/ntfsfix.8.in | 10 +++++----- ntfsprogs/ntfsresize.8.in | 11 ++++++++--- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index f62ee750..6c03fb9b 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -1,9 +1,9 @@ .\" Copyright (c) 2003\-2005 Richard Russon. -.\" Copyright (c) 2003\-2005 Szabolcs Szakacsits. +.\" Copyright (c) 2003\-2006 Szabolcs Szakacsits. .\" Copyright (c) 2004 Per Olofsson. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSCLONE 8 "December 2005" "ntfsprogs version @VERSION@" +.TH NTFSCLONE 8 "January 2006" "ntfsprogs version @VERSION@" .SH NAME ntfsclone \- Efficiently clone, image, restore or rescue an NTFS .SH SYNOPSIS @@ -51,7 +51,7 @@ NTFS support then the file can be mounted as .SS Sparse Files A file is sparse if it has unallocated blocks (holes). The reported size of such files are always higher than the disk space consumed by them. The -.B du +.BR du command can tell the real disk space used by a sparse file. The holes are always read as zeros. All major Linux filesystem like, ext2, ext3, reiserfs, Reiser4, JFS and XFS, supports @@ -85,14 +85,14 @@ with the options (handle sparse files "efficiently") and .B \-j (filter the archive through bzip2). Although -.B tar +.BR tar still reads and analyses the entire file, it doesn't pass on the large data blocks having only zeros to filters and it also avoids writing large amount of zeros to the disk needlessly. But since -.B tar +.BR tar can't create an archive from the standard input, you can't do this in\-place by just reading -.B ntfsclone +.BR ntfsclone standard output. .SS The Special Image Format It's also possible, actually it's recommended, to save an NTFS filesystem @@ -119,7 +119,7 @@ using '\-' as the file. .SS Metadata\-only Cloning One of the features of -.B ntfsclone +.BR ntfsclone is that, it can also save only the NTFS metadata using the option .B \-m or @@ -178,8 +178,8 @@ compression, encryption or streaming through a network. .TP \fB\-r\fR, \fB\-\-restore\-image\fR Restore from the special image format specified by -.I SOURCE . -If the +.I SOURCE +argument. If the .I SOURCE is '\-' then the image is read from the standard input. .TP @@ -279,8 +279,8 @@ Pack NTFS metadata for NTFS experts .SH KNOWN ISSUES There are no known problems with .BR ntfsclone . -If you find a bug please send an email describing the problem to the -development team: +If you think you have found a problem then please send an email describing it +to the development team: .br .nh linux\-ntfs\-dev@lists.sourceforge.net diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index 47a9754e..42e53053 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -1,8 +1,8 @@ -.\" Copyright (c) 2004 Szabolcs Szakacsits. +.\" Copyright (c) 2005-2006 Szabolcs Szakacsits. .\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSFIX 8 "November 2005" "ntfsprogs version @VERSION@" +.TH NTFSFIX 8 "January 2006" "ntfsprogs version @VERSION@" .SH NAME ntfsfix \- fix common errors and force Windows to check NTFS .SH SYNOPSIS @@ -20,7 +20,8 @@ check for the first boot into Windows. .sp You may run .B ntfsfix -on an NTFS volume if you think it's damaged and it can't be mounted. +on an NTFS volume if you think it was damaged by Windows or some other way +and it can't be mounted. .SH OPTIONS Below is a summary of all the options that .B ntfsfix @@ -52,8 +53,7 @@ linux\-ntfs\-dev@lists.sourceforge.net .hy .SH AUTHORS .B ntfsfix -was written by Anton Altaparmakov. -.B ntfsfix. +was written by Anton Altaparmakov, with contributions from Szabolcs Szakacsits. .SH AVAILABILITY .B ntfsfix is part of the diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 59840872..965df66d 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -1,8 +1,8 @@ -.\" Copyright (c) 2002\-2005 Szabolcs Szakacsits. +.\" Copyright (c) 2002\-2006 Szabolcs Szakacsits. .\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSRESIZE 8 "December 2005" "ntfsprogs version @VERSION@" +.TH NTFSRESIZE 8 "January 2006" "ntfsprogs version @VERSION@" .SH NAME ntfsresize \- resize an NTFS filesystem without data loss .SH SYNOPSIS @@ -43,6 +43,7 @@ parameter is given in kilo\-, mega\- or gigabytes respectively. .B Ntfsresize conforms to the SI, ATA, IEEE standards and the disk manufacturers by using k=10^3, M=10^6 and G=10^9. + If both .B \-\-info and @@ -96,6 +97,7 @@ starting sector and with the same partition type as before. Otherwise you won't be able to access your filesystem. Use the 'u' fdisk command to switch to the reliable sector unit from the default cylinder one. + Also make sure you set the bootable flag for the partition if it existed before. Failing to do so you might not be able to boot your computer from the disk. @@ -148,6 +150,7 @@ first. \fB\-f\fR, \fB\-\-force\fR Forces ntfsresize to proceed with the resize operation even if the filesystem is marked for consistency check. + Please note, ntfsresize always marks the filesystem for consistency check before a real resize operation and it leaves that way for extra @@ -167,6 +170,7 @@ Continue with the real resizing only if the test run passed. Support disks having hardware errors, bad sectors with those .B ntfsresize would refuse to work by default. + Prior using this option, it's strongly recommended to make a backup by .BR ntfsclone (8) using the \-\-rescue option, then running 'chkdsk /f /r volume:' on Windows @@ -174,6 +178,7 @@ from the command line. If the disk guarantee is still valid then replace it. It's defected. Please also note, that no software can repair these type of hardware errors. The most what they can do is to work around the permanent defects. + This option doesn't have any effect if the disk is flawless. .TP \fB\-P\fR, \fB\-\-no\-progress\-bar\fR @@ -191,7 +196,7 @@ and exit. Display help and exit. .SH EXIT CODES The exit code is 0 on success, non\-zero otherwise. -.SH BUGS +.SH KNOWN ISSUES No reliability problem is known. If you need help please try the Ntfsresize FAQ first (see below) and if you don't find your answer then send your question, comment or bug report to From 1df657f193dc1fcbfda2aa06b370a450e83420b2 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 8 Jan 2006 13:30:42 +0000 Subject: [PATCH 2820/2994] Removed legacy ntfsfix comments, it still kept confusing people --- README | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/README b/README index 53b38536..5afcf195 100644 --- a/README +++ b/README @@ -71,7 +71,7 @@ NTFS library Provides common NTFS access functions to the ntfsprogs and other foreign open source applications. Note, that the library is still under development -and a lot of functionality is not yet included. +and not all functionality is included yet. NTFS Gnome VFS module ===================== @@ -84,19 +84,13 @@ module in practice see man 8 libntfs-gnomevfs. NTFS utilities ============== -The ntfsprogs will eventually include utilities for doing all required tasks -to NTFS partitions. In general, just run a utility without any command line +The ntfsprogs includes utilities for doing all required tasks to NTFS +partitions. In general, just run a utility without any command line options to display the version number and usage syntax. The following utilities are so far implemented: -NtfsFix - Attempt to fix an NTFS partition that has been damaged by the old -Linux NTFS driver. Note that you should run it every time after you have used -the old Linux NTFS driver to write to an NTFS partition to prevent massive data -corruption from happening when Windows mounts the partition. -IMPORTANT: Run this only *after* unmounting the partition in Linux but *before* -rebooting into Windows NT/2000 or you *will* suffer! - You have been warned! -See man 8 ntfsfix for details. +ntfsfix - Attempt to fix an NTFS partition and force Windows to check NTFS. mkntfs - Format a partition with the NTFS filesystem. See man 8 mkntfs for command line options. From dc22f3e142bc06fded936812aaaa68a1ea3d3d7b Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 8 Jan 2006 14:54:55 +0000 Subject: [PATCH 2821/2994] Adjust $LogFile size for 3.1 volumes which got much bigger (the small $LogFile became a performance bootleneck for the increasingly faster disks) --- ntfsprogs/mkntfs.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index a8f7c51b..09b569e1 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3921,11 +3921,30 @@ static BOOL mkntfs_initialize_rl_logfile(void) g_logfile_size = 512LL * 1024; /* -> 512kiB */ else if (volume_size <= 200LL * 1024 * 1024) /* < 200MiB */ g_logfile_size = 2048LL * 1024; /* -> 2MiB */ - else if (volume_size >= 400LL << 20) /* > 400MiB */ - g_logfile_size = 4 << 20; /* -> 4MiB */ - else - g_logfile_size = (volume_size / 100) & - ~(g_vol->cluster_size - 1); + else if (g_vol->major_ver < 3) { + if (volume_size >= 400LL << 20) /* > 400MiB */ + g_logfile_size = 4 << 20; /* -> 4MiB */ + else + g_logfile_size = (volume_size / 100) & + ~(g_vol->cluster_size - 1); + } else { + /* + * FIXME: The $LogFile size is 64 MiB upwards from 12GiB but + * the "200" divider below apparently approximates "100" or + * some other walue as the volume size decreases. For example: + * Volume size LogFile size Ratio + * 8799808 46048 191.100 + * 8603248 45072 190.877 + * 7341704 38768 189.375 + * 6144828 32784 187.433 + * 4192932 23024 182.111 + */ + if (volume_size >= 12LL << 30) /* > 12GiB */ + g_logfile_size = 64 << 20; /* -> 64MiB */ + else + g_logfile_size = (volume_size / 200) & + ~(g_vol->cluster_size - 1); + } j = g_logfile_size / g_vol->cluster_size; while (g_rl_logfile[0].lcn + j >= g_vol->nr_clusters) { /* From a88f330d2bd6a45e14f49d5dff115ff751ad9d5c Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 8 Jan 2006 15:12:19 +0000 Subject: [PATCH 2822/2994] Fix some typos --- ntfsprogs/mkntfs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 09b569e1..7a31ce34 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3230,7 +3230,6 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, return i; } /* Insert the index entry for file_name in @idx. */ - /* remmet ut kun for debugging */ idx_size = (fn_size + 7) & ~7; idx_entry_new = ntfs_calloc(1, idx_size + 0x10); if (!idx_entry_new) @@ -3931,7 +3930,7 @@ static BOOL mkntfs_initialize_rl_logfile(void) /* * FIXME: The $LogFile size is 64 MiB upwards from 12GiB but * the "200" divider below apparently approximates "100" or - * some other walue as the volume size decreases. For example: + * some other value as the volume size decreases. For example: * Volume size LogFile size Ratio * 8799808 46048 191.100 * 8603248 45072 190.877 @@ -4051,7 +4050,7 @@ static BOOL mkntfs_fill_device_with_zeroes(void) volume_size = g_vol->nr_clusters << g_vol->cluster_size_bits; - ntfs_log_progress("Initialising device with zeroes: 0%%"); + ntfs_log_progress("Initializing device with zeroes: 0%%"); mid_clust = (volume_size >> 1) / g_vol->cluster_size; for (position = 0; position < (unsigned long long)g_vol->nr_clusters; position++) { @@ -4084,7 +4083,7 @@ static BOOL mkntfs_fill_device_with_zeroes(void) if (!append_to_bad_blocks(position)) return FALSE; ntfs_log_quiet("\nFound bad cluster (%lld). Adding to " - "list of bad blocks.\nInitialising " + "list of bad blocks.\nInitializing " "device with zeroes: %3.0f%%", position, position / progress_inc); /* Seek to next cluster. */ @@ -4850,7 +4849,7 @@ static BOOL mkntfs_create_root_structures(void) /* dump_mft_record(m); */ } /* create systemfiles for ntfs volumes (3.1) */ - /* starting vith file 24 (ignoring file 16-23) */ + /* starting with file 24 (ignoring file 16-23) */ if (g_vol->major_ver >= 3) { extend_flags = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM | FILE_ATTR_ARCHIVE | FILE_ATTR_VIEW_INDEX_PRESENT; @@ -5018,7 +5017,7 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) if (!mkntfs_initialize_rl_mft()) goto done; - /* Initialise $LogFile. */ + /* Initialize $LogFile. */ if (!mkntfs_initialize_rl_logfile()) goto done; From e975db6fd59698ad12bfefae489ddd6e01d68cc5 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 8 Jan 2006 15:53:27 +0000 Subject: [PATCH 2823/2994] should fix build under Solaris --- include/ntfs/dir.h | 7 ++++++- include/ntfs/volume.h | 21 +++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index 8b56c669..2483dc0c 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -2,7 +2,7 @@ * dir.h - Exports for directory handling. Part of the Linux-NTFS project. * * Copyright (c) 2002 Anton Altaparmakov - * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2005-2006 Yura Pakhuchiy * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or @@ -74,6 +74,11 @@ extern int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, #define NTFS_DT_SOCK 12 #define NTFS_DT_WHT 14 +/* DJGPP do not know about this. */ +#ifndef S_IFREG + +#endif + /* * This is the "ntfs_filldir" function type, used by ntfs_readdir() to let * the caller specify what kind of dirent layout it wants to have. diff --git a/include/ntfs/volume.h b/include/ntfs/volume.h index c3c36cb4..c884f494 100644 --- a/include/ntfs/volume.h +++ b/include/ntfs/volume.h @@ -2,7 +2,7 @@ * volume.h - Exports for NTFS volume handling. Part of the Linux-NTFS project. * * Copyright (c) 2000-2004 Anton Altaparmakov - * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2005-2006 Yura Pakhuchiy * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or @@ -45,14 +45,19 @@ * Under Cygwin, DJGPP and FreeBSD we do not have MS_RDONLY and MS_NOATIME, * so we define them ourselves. */ -#if !defined(MS_RDONLY) -/** - * enum MS_MOUNT - +#ifndef MS_RDONLY +#define MS_RDONLY 1 +#endif +/* + * Solaris defines MS_RDONLY but not MS_NOATIME thus we need to carefully + * define MS_NOATIME. */ -typedef enum { - MS_RDONLY = 1, - MS_NOATIME, -} MS_MOUNT; +#ifndef MS_NOATIME +#if (MS_RDONLY != 1) +# define MS_NOATIME 1 +#else +# define MS_NOATIME 2 +#endif #endif /* Forward declaration */ From ff72ed61413aebac5a06d5376a111567e198ffe2 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Sun, 8 Jan 2006 15:56:03 +0000 Subject: [PATCH 2824/2994] Oops, by accident commited incomplete stuff to dir.h --- include/ntfs/dir.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index 2483dc0c..8b56c669 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -2,7 +2,7 @@ * dir.h - Exports for directory handling. Part of the Linux-NTFS project. * * Copyright (c) 2002 Anton Altaparmakov - * Copyright (c) 2005-2006 Yura Pakhuchiy + * Copyright (c) 2005 Yura Pakhuchiy * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or @@ -74,11 +74,6 @@ extern int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, #define NTFS_DT_SOCK 12 #define NTFS_DT_WHT 14 -/* DJGPP do not know about this. */ -#ifndef S_IFREG - -#endif - /* * This is the "ntfs_filldir" function type, used by ntfs_readdir() to let * the caller specify what kind of dirent layout it wants to have. From 35aa4a725b0115fb5dbb43eb3d1a6bf64d768d8c Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 8 Jan 2006 20:57:00 +0000 Subject: [PATCH 2825/2994] Fix URL to the manual pages on the web --- ntfsprogs/mkntfs.8.in | 2 +- ntfsprogs/ntfscat.8.in | 2 +- ntfsprogs/ntfsclone.8.in | 2 +- ntfsprogs/ntfscluster.8.in | 2 +- ntfsprogs/ntfscp.8.in | 2 +- ntfsprogs/ntfsfix.8.in | 2 +- ntfsprogs/ntfsinfo.8.in | 2 +- ntfsprogs/ntfslabel.8.in | 2 +- ntfsprogs/ntfsls.8.in | 2 +- ntfsprogs/ntfsmount.8.in | 2 +- ntfsprogs/ntfsprogs.8.in | 2 +- ntfsprogs/ntfsresize.8.in | 2 +- ntfsprogs/ntfsundelete.8.in | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index c751c343..46399062 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -314,7 +314,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .SH SEE ALSO .BR badblocks (8), diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in index 997058bd..1d7a599d 100644 --- a/ntfsprogs/ntfscat.8.in +++ b/ntfsprogs/ntfscat.8.in @@ -130,7 +130,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .SH SEE ALSO .BR ntfsls (8), diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 6c03fb9b..40467573 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -310,7 +310,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .SH SEE ALSO .BR ntfsresize (8) diff --git a/ntfsprogs/ntfscluster.8.in b/ntfsprogs/ntfscluster.8.in index 2ed2c1e0..035fb8f0 100644 --- a/ntfsprogs/ntfscluster.8.in +++ b/ntfsprogs/ntfscluster.8.in @@ -122,7 +122,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .SH SEE ALSO .BR ntfsinfo (8), diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in index bb5febdf..4b826df1 100644 --- a/ntfsprogs/ntfscp.8.in +++ b/ntfsprogs/ntfscp.8.in @@ -122,7 +122,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .SH SEE ALSO .BR ntfsprogs (8) diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index 42e53053..fd2b198e 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -67,7 +67,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .SH SEE ALSO .BR mkntfs (8), diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index 9d2abdf2..191a5fc2 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -89,7 +89,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .SH SEE ALSO .BR ntfsprogs (8) diff --git a/ntfsprogs/ntfslabel.8.in b/ntfsprogs/ntfslabel.8.in index a4b62a58..18ced4b5 100644 --- a/ntfsprogs/ntfslabel.8.in +++ b/ntfsprogs/ntfslabel.8.in @@ -98,7 +98,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .SH SEE ALSO .BR mkntfs (8), diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index 7d629ab5..f31970c7 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -171,7 +171,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .SH SEE ALSO .BR ntfsprogs (8) diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 1c4d5eea..64187196 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -234,7 +234,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .SH SEE ALSO .BR ntfsprogs (8), diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index 796eaf4f..030a275e 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -66,7 +66,7 @@ http://www.linux\-ntfs.org/content/view/19/37 These manual pages can be viewed online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .SH SEE ALSO .BR libntfs\-gnomevfs (8) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index 965df66d..fcf76f73 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -265,7 +265,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .sp .B Ntfsresize diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index 29717350..a7f4e54f 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -322,7 +322,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://wiki.linux\-ntfs.org/doku.php?id=man +http://man.linux-ntfs.org/ntfsprogs.8.html .hy .SH SEE ALSO .BR ntfsinfo (8), From 6f05bf0407ab5066609de7fc1a60acd2d596f315 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 8 Jan 2006 21:01:23 +0000 Subject: [PATCH 2826/2994] Refer by the sort URL to the manual pages --- ntfsprogs/mkntfs.8.in | 2 +- ntfsprogs/ntfscat.8.in | 2 +- ntfsprogs/ntfsclone.8.in | 2 +- ntfsprogs/ntfscluster.8.in | 2 +- ntfsprogs/ntfscp.8.in | 2 +- ntfsprogs/ntfsfix.8.in | 2 +- ntfsprogs/ntfsinfo.8.in | 2 +- ntfsprogs/ntfslabel.8.in | 2 +- ntfsprogs/ntfsls.8.in | 2 +- ntfsprogs/ntfsmount.8.in | 2 +- ntfsprogs/ntfsprogs.8.in | 2 +- ntfsprogs/ntfsresize.8.in | 2 +- ntfsprogs/ntfsundelete.8.in | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 46399062..645d3357 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -314,7 +314,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .SH SEE ALSO .BR badblocks (8), diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in index 1d7a599d..5cb0a56b 100644 --- a/ntfsprogs/ntfscat.8.in +++ b/ntfsprogs/ntfscat.8.in @@ -130,7 +130,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .SH SEE ALSO .BR ntfsls (8), diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index 40467573..a665a893 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -310,7 +310,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .SH SEE ALSO .BR ntfsresize (8) diff --git a/ntfsprogs/ntfscluster.8.in b/ntfsprogs/ntfscluster.8.in index 035fb8f0..408116cb 100644 --- a/ntfsprogs/ntfscluster.8.in +++ b/ntfsprogs/ntfscluster.8.in @@ -122,7 +122,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .SH SEE ALSO .BR ntfsinfo (8), diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in index 4b826df1..8be3d850 100644 --- a/ntfsprogs/ntfscp.8.in +++ b/ntfsprogs/ntfscp.8.in @@ -122,7 +122,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .SH SEE ALSO .BR ntfsprogs (8) diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in index fd2b198e..aba1e92d 100644 --- a/ntfsprogs/ntfsfix.8.in +++ b/ntfsprogs/ntfsfix.8.in @@ -67,7 +67,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .SH SEE ALSO .BR mkntfs (8), diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in index 191a5fc2..e54daee1 100644 --- a/ntfsprogs/ntfsinfo.8.in +++ b/ntfsprogs/ntfsinfo.8.in @@ -89,7 +89,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .SH SEE ALSO .BR ntfsprogs (8) diff --git a/ntfsprogs/ntfslabel.8.in b/ntfsprogs/ntfslabel.8.in index 18ced4b5..e398412b 100644 --- a/ntfsprogs/ntfslabel.8.in +++ b/ntfsprogs/ntfslabel.8.in @@ -98,7 +98,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .SH SEE ALSO .BR mkntfs (8), diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in index f31970c7..b7470411 100644 --- a/ntfsprogs/ntfsls.8.in +++ b/ntfsprogs/ntfsls.8.in @@ -171,7 +171,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .SH SEE ALSO .BR ntfsprogs (8) diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 64187196..3be84959 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -234,7 +234,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .SH SEE ALSO .BR ntfsprogs (8), diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in index 030a275e..e584717f 100644 --- a/ntfsprogs/ntfsprogs.8.in +++ b/ntfsprogs/ntfsprogs.8.in @@ -66,7 +66,7 @@ http://www.linux\-ntfs.org/content/view/19/37 These manual pages can be viewed online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .SH SEE ALSO .BR libntfs\-gnomevfs (8) diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in index fcf76f73..2bd3925e 100644 --- a/ntfsprogs/ntfsresize.8.in +++ b/ntfsprogs/ntfsresize.8.in @@ -265,7 +265,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .sp .B Ntfsresize diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in index a7f4e54f..79a477a2 100644 --- a/ntfsprogs/ntfsundelete.8.in +++ b/ntfsprogs/ntfsundelete.8.in @@ -322,7 +322,7 @@ http://www.linux\-ntfs.org/content/view/19/37 The manual pages are available online at: .br .nh -http://man.linux-ntfs.org/ntfsprogs.8.html +http://man.linux-ntfs.org/ .hy .SH SEE ALSO .BR ntfsinfo (8), From 53883b3fde5a422be5a9078163ffeecf87753189 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 14 Jan 2006 00:54:51 +0000 Subject: [PATCH 2827/2994] Fix off-by-one in ACL dumping, one ACE was missed --- ChangeLog | 1 + ntfsprogs/ntfsinfo.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4c2c74a7..aa965621 100644 --- a/ChangeLog +++ b/ChangeLog @@ -94,6 +94,7 @@ xx/xx/2005 - 1.12.2-WIP - ntfsmount: Add FreeBSD support. (Yura) - ntfsmount: Fix bug with moving non-empty directories. (Yura) - ntfsinfo: dump $Secure:$SDS in verbose mode. (Szaka) + - ntfsinfo: fix off-by-one in ACL dumping, one ACE was missed. (Szaka) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 9ab8763a..266b894e 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -4,7 +4,7 @@ * Copyright (c) 2002-2004 Matthew J. Fanto * Copyright (c) 2002-2005 Anton Altaparmakov * Copyright (c) 2002-2005 Richard Russon - * Copyright (c) 2003-2005 Szabolcs Szakacsits + * Copyright (c) 2003-2006 Szabolcs Szakacsits * Copyright (c) 2004-2005 Yuval Fledel * Copyright (c) 2004-2005 Yura Pakhuchiy * Copyright (c) 2005 Cristian Klein @@ -834,7 +834,7 @@ static void ntfs_dump_acl(const char *prefix, ACL *acl) ace = (ACCESS_ALLOWED_ACE *)((char *)acl + 8); /* iterate through ACE's */ - for (i = 1; i < ace_count; i++) { + for (i = 1; i <= ace_count; i++) { const char *ace_type; char *sid; From 6616612ea683c908d3b2adf925618b0582e41b8a Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 15 Jan 2006 12:55:04 +0000 Subject: [PATCH 2828/2994] Set the size of the $SECURITY_DESCRIPTOR of the root directory appropriately and as 'format' also does (the extra space was unused garbage) --- ntfsprogs/sd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c index 26c69aab..0407b9dc 100644 --- a/ntfsprogs/sd.c +++ b/ntfsprogs/sd.c @@ -217,9 +217,8 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) ACCESS_ALLOWED_ACE *ace; SID *sid; - static char sd_array[0x1200]; - //char* sd_val = NULL; - *sd_val_len = 0x1200; + static char sd_array[0x1030]; + *sd_val_len = 0x1030; *sd_val = (u8*)&sd_array; //security descriptor relative From c66e2729871227e9fb68e278aa5c0661a833e3ef Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Tue, 24 Jan 2006 16:57:47 +0000 Subject: [PATCH 2829/2994] update about direct_io --- ntfsprogs/ntfsmount.8.in | 1 + 1 file changed, 1 insertion(+) diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 3be84959..73e6d6df 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -92,6 +92,7 @@ useful on 2.4.X kernels, as on 2.6 kernels requests size is automatically determined for optimum performance. .TP .B direct_io +(NOTE: Only for FUSE 2.3.0) This option disables the use of page cache (file content cache) in the kernel for this filesystem. This has several affects: - Each read() or write() system call will initiate one or more From 8410f3b00b91f263ccae96a6165ae94eb7f1c1c4 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 25 Jan 2006 23:36:09 +0000 Subject: [PATCH 2830/2994] minor change --- ntfsprogs/ntfsmount.8.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index 73e6d6df..e3d53cf4 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -154,8 +154,8 @@ streams, so you are recommended to use tools like FAR, or utils from Cygwin. Named data streams act like normals files, so you can read from them, write to them and even delete them (using rm). You can list all the named data streams a file has by getting the "ntfs.streams.list" extended attribute. NOTE: This -list feature is unique to the NTFS FUSE module and may never be supported by the -kernel driver. +list feature is unique to the \fBntfsmount\fR and may never be supported by the +\fBkernel driver\fR. .SH EXAMPLES Mount /dev/hda1 to /mnt/ntfs\-fuse using ntfsmount: .RS From bbb3e160ddc4e841ded1bfc8a573e5e315c7a723 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 27 Jan 2006 12:29:40 +0000 Subject: [PATCH 2831/2994] Update TODO with config.h sort out needed... --- TODO.include | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TODO.include b/TODO.include index 230e83f4..5e8dba03 100644 --- a/TODO.include +++ b/TODO.include @@ -5,3 +5,7 @@ Add usnjrnl.h (copy from kernel driver): Finish logfile.h: in particular, add: - more about the $LogFile on disk structures + +Remove ifdef HAVE_CONFIG_H and make config.h compulsory. Further, place +config.h in include/ntfs/config.h at least when distributing (make install, +make dist, make rpm). From 0130863e72a9e0e7bb864d796029300f2ac2d952 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 29 Jan 2006 01:24:24 +0000 Subject: [PATCH 2832/2994] Improved dumping SDS entries: stop at bogus values instead of crashing and don't stop at empty entries --- ntfsprogs/ntfsinfo.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 266b894e..34481ec9 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1110,7 +1110,15 @@ static void ntfs_dump_sds(ATTR_RECORD *attr, ntfs_inode *ni) sd = sds; - while (sd->length && sd->length != 32 && sd->hash) { + /* + * FIXME: The right way is based on the indexes, so we couldn't + * miss real entries. For now, dump until it makes sense. + */ + while (sd->length && sd->hash && + le64_to_cpu(sd->offset) < (u64)na->data_size && + le32_to_cpu(sd->length) < (u64)na->data_size && + le64_to_cpu(sd->offset) + + le32_to_cpu(sd->length) < (u64)na->data_size) { ntfs_dump_sds_entry(sd); sd = (SECURITY_DESCRIPTOR_HEADER *)((char *)sd + (cpu_to_le32(sd->length + 0x0F) & From 770aded28daf95a4adca42aaf5830b89364356a7 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 29 Jan 2006 14:07:45 +0000 Subject: [PATCH 2833/2994] Define S_IFLNK and S_IFSOCK for djgpp (Christophe) --- libntfs/dir.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libntfs/dir.c b/libntfs/dir.c index 851ce568..d4c74bf4 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -38,6 +38,19 @@ #include #endif +#ifdef HAVE_SYS_SYSMACROS_H +#include +#endif + +#ifdef DJGPP +#ifndef S_IFLNK +#define S_IFLNK 0xa000 +#endif +#ifndef S_IFSOCK +#define S_IFSOCK 0xc000 +#endif +#endif + #include "types.h" #include "debug.h" #include "attrib.h" From 541f7ade3260e16959a04ad67d0fc2ce76ef7a5f Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 29 Jan 2006 14:09:57 +0000 Subject: [PATCH 2834/2994] Check for sys/sysmacros to get major and minor definitions (Christophe) --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 40ab5956..518f5ab8 100644 --- a/configure.ac +++ b/configure.ac @@ -330,7 +330,7 @@ AC_CHECK_HEADERS([ctype.h fcntl.h libintl.h limits.h locale.h mntent.h \ stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h strings.h \ errno.h time.h unistd.h utime.h wchar.h getopt.h features.h endian.h \ byteswap.h sys/byteorder.h sys/endian.h sys/param.h sys/ioctl.h \ - sys/mount.h sys/stat.h sys/types.h sys/vfs.h sys/statvfs.h \ + sys/mount.h sys/stat.h sys/types.h sys/vfs.h sys/statvfs.h sys/sysmacros.h \ linux/major.h linux/fd.h linux/hdreg.h machine/endian.h gcrypt.h \ windows.h gnutls/pkcs12.h]) From ead758ed7ce01c0d03a63602ba4c24de1a271fa7 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 30 Jan 2006 21:53:42 +0000 Subject: [PATCH 2835/2994] ntfsmount: Rename "succeed_chmod" -> "silent". Do not return error on chown too. --- ChangeLog | 2 ++ ntfsprogs/ntfsmount.8.in | 8 ++++---- ntfsprogs/ntfsmount.c | 30 +++++++++++++++++++++--------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa965621..62f16b73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -95,6 +95,8 @@ xx/xx/2005 - 1.12.2-WIP - ntfsmount: Fix bug with moving non-empty directories. (Yura) - ntfsinfo: dump $Secure:$SDS in verbose mode. (Szaka) - ntfsinfo: fix off-by-one in ACL dumping, one ACE was missed. (Szaka) + - ntfsmount: Rename "succeed_chmod" -> "silent". Do not return error + on chown too. (Yura) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsmount.8.in b/ntfsprogs/ntfsmount.8.in index e3d53cf4..0bde2c4d 100644 --- a/ntfsprogs/ntfsmount.8.in +++ b/ntfsprogs/ntfsmount.8.in @@ -1,8 +1,8 @@ -.\" Copyright (c) 2005 Yura Pakhuchiy. +.\" Copyright (c) 2005-2006 Yura Pakhuchiy. .\" Copyright (c) 2005 Richard Russon. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH NTFSMOUNT 8 "November 2005" "ntfsprogs version @VERSION@" +.TH NTFSMOUNT 8 "January 2006" "ntfsprogs version @VERSION@" .SH NAME ntfsmount \- NTFS module for FUSE. .SH SYNOPSIS @@ -119,8 +119,8 @@ Mount filesystem read\-only. By default ntfsmount acts as "default_permissions,allow_other" was passed to it, this option cancel this behaviour. .TP -.B succeed_chmod -Don't change any permissions and don't return error on chmod operation. +.B silent +Do nothing on chmod and chown operations, but do not return error. .TP .B locale= You can set locale with this option. It's useful if locale enviroment variables diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index b178875f..43edeb1f 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -1,7 +1,7 @@ /** * ntfsmount - Part of the Linux-NTFS project. * - * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2005-2006 Yura Pakhuchiy * Copyright (c) 2005 Yuval Fledel * * NTFS module for FUSE. @@ -94,7 +94,7 @@ typedef struct { ntfs_fuse_streams_interface streams; BOOL ro; BOOL show_sys_files; - BOOL succeed_chmod; + BOOL silent; BOOL force; BOOL debug; BOOL noatime; @@ -707,7 +707,17 @@ static int ntfs_fuse_chmod(const char *path, { if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) return -EINVAL; /* n/a for named data streams. */ - if (ctx->succeed_chmod) + if (ctx->silent) + return 0; + return -EOPNOTSUPP; +} + +static int ntfs_fuse_chown(const char *path, uid_t uid __attribute__((unused)), + gid_t gid __attribute__((unused))) +{ + if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) + return -EINVAL; /* n/a for named data streams. */ + if (ctx->silent) return 0; return -EOPNOTSUPP; } @@ -1347,6 +1357,7 @@ static struct fuse_operations ntfs_fuse_oper = { .truncate = ntfs_fuse_truncate, .statfs = ntfs_fuse_statfs, .chmod = ntfs_fuse_chmod, + .chown = ntfs_fuse_chown, .mknod = ntfs_fuse_mknod, .symlink = ntfs_fuse_symlink, .link = ntfs_fuse_link, @@ -1515,13 +1526,13 @@ static char *parse_mount_options(const char *org_options) goto err_exit; } ctx->show_sys_files = TRUE; - } else if (!strcmp(opt, "succeed_chmod")) { + } else if (!strcmp(opt, "silent")) { if (val) { - ntfs_log_error("'succeed_chmod' option should " + ntfs_log_error("'silent' option should " "not have value.\n"); goto err_exit; } - ctx->succeed_chmod = TRUE; + ctx->silent = TRUE; } else if (!strcmp(opt, "force")) { if (val) { ntfs_log_error("'force' option should not " @@ -1597,13 +1608,14 @@ static void usage(void) { ntfs_log_info("\n%s v%s (libntfs %s) - NTFS module for FUSE.\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); - ntfs_log_info("Copyright (c) 2005 Yura Pakhuchiy\n\n"); + ntfs_log_info("Copyright (c) 2005-2006 Yura Pakhuchiy\n\n"); ntfs_log_info("usage: %s device mount_point [-o options]\n\n", EXEC_NAME); ntfs_log_info("ntfsmount options are:\n\tforce\n\tno_def_opts\n\tumask" "\n\tfmask\n\tdmask\n\tuid\n\tgid\n\tshow_sys_files\n\t" - "succeed_chmod\n\tlocale\n\tstreams_interface\n" - "Also look into FUSE documentation about it options.\n"); + "silent\n\tlocale\n\tstreams_interface\n" + "Also look into FUSE documentation about it options " + "(NOTE: not all FUSE options are supported by ntfsmount).\n"); ntfs_log_info("Default options are: \"%s\".\n\n", def_opts); ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home); } From e2450ad61ae70a53778da3abbc8a61429365a519 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 30 Jan 2006 22:10:31 +0000 Subject: [PATCH 2836/2994] tidy up djgpp S_IF{SOCK,LNK} fix --- include/ntfs/dir.h | 24 ++++++++++++++++++++++-- libntfs/dir.c | 11 +---------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/include/ntfs/dir.h b/include/ntfs/dir.h index 8b56c669..8e81a4ff 100644 --- a/include/ntfs/dir.h +++ b/include/ntfs/dir.h @@ -2,7 +2,7 @@ * dir.h - Exports for directory handling. Part of the Linux-NTFS project. * * Copyright (c) 2002 Anton Altaparmakov - * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2005-2006 Yura Pakhuchiy * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or @@ -32,7 +32,27 @@ #define MAX_PATH 1024 #endif -/* The little endian Unicode strings $I30, $SII, $SDH, $O, $Q, $R +/* + * We do not have these under DJGPP, so define our version that do not conflict + * with other S_IFs defined under DJGPP. + */ +#ifdef DJGPP +#ifndef S_IFLNK +#define S_IFLNK 0120000 +#endif +#ifndef S_ISLNK +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +#endif +#ifndef S_IFSOCK +#define S_IFSOCK 0140000 +#endif +#ifndef S_ISSOCK +#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +#endif +#endif + +/* + * The little endian Unicode strings $I30, $SII, $SDH, $O, $Q, $R * as a global constant. */ extern ntfschar NTFS_INDEX_I30[5]; diff --git a/libntfs/dir.c b/libntfs/dir.c index d4c74bf4..00b04b1a 100644 --- a/libntfs/dir.c +++ b/libntfs/dir.c @@ -2,7 +2,7 @@ * dir.c - Directory handling code. Part of the Linux-NTFS project. * * Copyright (c) 2002-2005 Anton Altaparmakov - * Copyright (c) 2005 Yura Pakhuchiy + * Copyright (c) 2005-2006 Yura Pakhuchiy * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or @@ -42,15 +42,6 @@ #include #endif -#ifdef DJGPP -#ifndef S_IFLNK -#define S_IFLNK 0xa000 -#endif -#ifndef S_IFSOCK -#define S_IFSOCK 0xc000 -#endif -#endif - #include "types.h" #include "debug.h" #include "attrib.h" From 63f5ddb8c26d304c8a02e2328466a14b029e0256 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 1 Feb 2006 17:37:34 +0000 Subject: [PATCH 2837/2994] ntfsmount: Support FUSE versions from 2.3.0 to 2.5.1 under Linux and 2.5.X under FreeBSD. Warning tested only under FUSE-2.4.1. Will test under FUSE-2.5.1 at home. --- configure.ac | 6 +++--- ntfsprogs/Makefile.am | 2 +- ntfsprogs/ntfsmount.c | 30 +++++++++++++++++++++++++----- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 518f5ab8..4ec27be4 100644 --- a/configure.ac +++ b/configure.ac @@ -215,12 +215,12 @@ if test "$enable_fuse_module" != "no"; then fi ]);; freebsd*) - PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.4.2, [ compile_fuse_module=true ], + PKG_CHECK_MODULES(FUSE_MODULE, fuse >= 2.5.0, [ compile_fuse_module=true ], [ if test "$enable_fuse_module" = "yes"; then - AC_MSG_ERROR([ntfsmount requires FUSE version >= 2.4.2 under FreeBSD, because earlier versions have problems with readdir.]) + AC_MSG_ERROR([ntfsmount requires FUSE version >= 2.5.0 under FreeBSD.]) else - AC_MSG_WARN([ntfsmount requires FUSE version >= 2.4.2 under FreeBSD, because earlier versions have problems with readdir.]) + AC_MSG_WARN([ntfsmount requires FUSE version >= 2.5.0 under FreeBSD.]) fi ]);; *) diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am index aef3c517..d5c61da9 100644 --- a/ntfsprogs/Makefile.am +++ b/ntfsprogs/Makefile.am @@ -92,7 +92,7 @@ if ENABLE_FUSE_MODULE ntfsmount_SOURCES = ntfsmount.c utils.c utils.h ntfsmount_LDADD = $(AM_LIBS) $(FUSE_MODULE_LIBS) ntfsmount_LDFLAGS = $(AM_LFLAGS) -ntfsmount_CFLAGS = $(FUSE_MODULE_CFLAGS) -DFUSE_USE_VERSION=22 +ntfsmount_CFLAGS = $(FUSE_MODULE_CFLAGS) -DFUSE_USE_VERSION=25 endif # We don't distribute these diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 43edeb1f..ed02b5c7 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -207,7 +207,11 @@ static __inline__ void ntfs_fuse_mark_free_space_outdate(void) * Return 0 on success or -errno on error. */ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), +#if FUSE_VERSION >= 25 + struct statvfs *sfs) +#else struct statfs *sfs) +#endif { long size; ntfs_volume *vol; @@ -219,6 +223,9 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), sfs->f_type = NTFS_SB_MAGIC; /* Optimal transfer block size. */ sfs->f_bsize = vol->cluster_size; +#if FUSE_VERSION >= 25 + sfs->f_frsize = vol->cluster_size; +#endif /* * Total data blocks in file system in units of f_bsize and since * inodes are also stored in data blocs ($MFT is a file) this is just @@ -239,11 +246,11 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), size = 0; sfs->f_ffree = size; /* Maximum length of filenames. */ -#ifndef __FreeBSD__ - sfs->f_namelen = NTFS_MAX_NAME_LEN; -#else +#if FUSE_VERSION >= 25 sfs->f_namemax = NTFS_MAX_NAME_LEN; -#endif /* __FreeBSD__ */ +#else + sfs->f_namelen = NTFS_MAX_NAME_LEN; +#endif return 0; } @@ -1741,8 +1748,11 @@ static int parse_options(int argc, char *argv[]) int main(int argc, char *argv[]) { char *parsed_options; +#if FUSE_VERSION >= 25 + struct fuse_args margs = FUSE_ARGS_INIT(0, NULL); +#endif struct fuse *fh; - int ffd; + int ffd = 0; utils_set_locale(); ntfs_log_set_handler(ntfs_log_handler_stderr); @@ -1770,7 +1780,17 @@ int main(int argc, char *argv[]) } free(opts.device); /* Create filesystem. */ +#if FUSE_VERSION >= 25 + if ((fuse_opt_add_arg(&margs, "") == -1 || + fuse_opt_add_arg(&margs, "-o") == -1 || + fuse_opt_add_arg(&margs, parsed_options) == -1)) + ffd = -1; + if (ffd != -1) + ffd = fuse_mount(opts.mnt_point, &margs); + fuse_opt_free_args(&margs); +#else ffd = fuse_mount(opts.mnt_point, parsed_options); +#endif if (ffd == -1) { ntfs_log_error("fuse_mount failed.\n"); ntfs_fuse_destroy(); From c11567824a79483962d3d085cf722872a33efc08 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 1 Feb 2006 18:24:58 +0000 Subject: [PATCH 2838/2994] ntfsmount: fix ls output in case some files can not be accessed due to windows named data streams accees interface --- ntfsprogs/ntfsmount.c | 59 ++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index ed02b5c7..80eccb34 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -119,6 +119,25 @@ static const char *EXEC_NAME = "ntfsmount"; static char def_opts[] = "default_permissions,allow_other,"; static ntfs_fuse_context_t *ctx; +static __inline__ void ntfs_fuse_mark_free_space_outdate(void) +{ + /* Mark information about free MFT record and clusters outdate. */ + ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); +} + +/** + * ntfs_fuse_is_named_data_stream - check path to be to named data stream + * @path: path to check + * + * Rerturn 1 if path is to named data stream or 0 otherwise. + */ +static __inline__ int ntfs_fuse_is_named_data_stream(const char *path) +{ + if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) + return 1; + return 0; +} + static long ntfs_fuse_get_nr_free_mft_records(ntfs_volume *vol) { u8 *buf; @@ -183,12 +202,6 @@ static long ntfs_fuse_get_nr_free_clusters(ntfs_volume *vol) return nr_free; } -static __inline__ void ntfs_fuse_mark_free_space_outdate(void) -{ - /* Mark information about free MFT record and clusters outdate. */ - ctx->state |= (NF_FreeClustersOutdate | NF_FreeMFTOutdate); -} - /** * ntfs_fuse_statfs - return information about mounted NTFS volume * @path: ignored (but fuse requires it) @@ -509,6 +522,13 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx, "%s\n", MREF(mref), strerror(errno)); return 0; } + if (ntfs_fuse_is_named_data_stream(filename)) { + ntfs_log_error("Unable to access '%s' (inode %lld) with " + "current named streams access interface.\n", + filename, MREF(mref)); + free(filename); + return 0; + } if (MREF(mref) == FILE_root || MREF(mref) >= FILE_first_user || ctx->show_sys_files) fill_ctx->filler(fill_ctx->buf, filename, NULL, 0); @@ -712,7 +732,7 @@ exit: static int ntfs_fuse_chmod(const char *path, mode_t mode __attribute__((unused))) { - if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) + if (ntfs_fuse_is_named_data_stream(path)) return -EINVAL; /* n/a for named data streams. */ if (ctx->silent) return 0; @@ -722,7 +742,7 @@ static int ntfs_fuse_chmod(const char *path, static int ntfs_fuse_chown(const char *path, uid_t uid __attribute__((unused)), gid_t gid __attribute__((unused))) { - if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) + if (ntfs_fuse_is_named_data_stream(path)) return -EINVAL; /* n/a for named data streams. */ if (ctx->silent) return 0; @@ -851,9 +871,8 @@ exit: static int ntfs_fuse_symlink(const char *to, const char *from) { - if (strchr(from, ':') && /* n/a for named data streams. */ - ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) - return -EINVAL; + if (ntfs_fuse_is_named_data_stream(from)) + return -EINVAL; /* n/a for named data streams. */ ntfs_fuse_mark_free_space_outdate(); return ntfs_fuse_create(from, S_IFLNK, 0, to); } @@ -866,12 +885,10 @@ static int ntfs_fuse_link(const char *old_path, const char *new_path) char *path; int res = 0, uname_len; - if (strchr(old_path, ':') && /* n/a for named data streams. */ - ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) - return -EINVAL; - if (strchr(new_path, ':') && /* n/a for named data streams. */ - ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) - return -EINVAL; + if (ntfs_fuse_is_named_data_stream(old_path)) + return -EINVAL; /* n/a for named data streams. */ + if (ntfs_fuse_is_named_data_stream(new_path)) + return -EINVAL; /* n/a for named data streams. */ path = strdup(new_path); if (!path) return -errno; @@ -1022,7 +1039,7 @@ static int ntfs_fuse_rename(const char *old_path, const char *new_path) static int ntfs_fuse_mkdir(const char *path, mode_t mode __attribute__((unused))) { - if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) + if (ntfs_fuse_is_named_data_stream(path)) return -EINVAL; /* n/a for named data streams. */ ntfs_fuse_mark_free_space_outdate(); return ntfs_fuse_create(path, S_IFDIR, 0, NULL); @@ -1030,7 +1047,7 @@ static int ntfs_fuse_mkdir(const char *path, static int ntfs_fuse_rmdir(const char *path) { - if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) + if (ntfs_fuse_is_named_data_stream(path)) return -EINVAL; /* n/a for named data streams. */ ntfs_fuse_mark_free_space_outdate(); return ntfs_fuse_rm(path); @@ -1040,8 +1057,8 @@ static int ntfs_fuse_utime(const char *path, struct utimbuf *buf) { ntfs_inode *ni; - if (strchr(path, ':') && ctx->streams == NF_STREAMS_INTERFACE_WINDOWS) - return 0; /* Unable to change time for named data streams. */ + if (ntfs_fuse_is_named_data_stream(path)) + return -EINVAL; /* n/a for named data streams. */ ni = ntfs_pathname_to_inode(ctx->vol, NULL, path); if (!ni) return -errno; From ad13b7869773f5db2816b78ad165fbed7a4b55df Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Wed, 1 Feb 2006 23:55:07 +0000 Subject: [PATCH 2839/2994] ntfsmount: fix 25 API compatibility --- ntfsprogs/ntfsmount.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 80eccb34..3ca482b0 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -232,8 +232,6 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), vol = ctx->vol; if (!vol) return -ENODEV; - /* Type of filesystem. */ - sfs->f_type = NTFS_SB_MAGIC; /* Optimal transfer block size. */ sfs->f_bsize = vol->cluster_size; #if FUSE_VERSION >= 25 @@ -1814,6 +1812,24 @@ int main(int argc, char *argv[]) return 5; } free(parsed_options); +#if FUSE_VERSION >= 25 + fh = (struct fuse *)1; /* Cast anything except NULL to handle errors. */ + margs = (struct fuse_args)FUSE_ARGS_INIT(0, NULL); + if (fuse_opt_add_arg(&margs, "") == -1 || + fuse_opt_add_arg(&margs, "-o") == -1) + fh = NULL; + if (!ctx->debug) { + if (fuse_opt_add_arg(&margs, "use_ino,kernel_cache") == -1) + fh = NULL; + } else { + if (fuse_opt_add_arg(&margs, "use_ino,debug") == -1) + fh = NULL; + } + if (fh) + fh = fuse_new(ffd, &margs , &ntfs_fuse_oper, + sizeof(ntfs_fuse_oper)); + fuse_opt_free_args(&margs); +#else if (!ctx->debug) { if (fuse_is_lib_option("kernel_cache")) fh = fuse_new(ffd, "use_ino,kernel_cache", @@ -1825,7 +1841,7 @@ int main(int argc, char *argv[]) } else fh = fuse_new(ffd, "debug,use_ino" , &ntfs_fuse_oper, sizeof(ntfs_fuse_oper)); - +#endif if (!fh) { ntfs_log_error("fuse_new failed.\n"); close(ffd); From e0c2231543b511c820d955c1f46af55cb1a240fe Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 2 Feb 2006 13:57:00 +0000 Subject: [PATCH 2840/2994] Fix stupid bug in libntfs/bitmap.c::ntfs_bitmap_set_bits_in_run() which caused bits to not be cleared or set if the first bit in the run was not a multiple of eight. (Anton) --- ChangeLog | 9 ++++++--- libntfs/bitmap.c | 9 ++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 62f16b73..ac100332 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,11 @@ -xx/xx/2005 - 1.12.2-WIP +02/01/2006 - 1.13.0 - Lots and lots and lots of fixes and enhancements. - Temporarily disable use of the legal ansi character checking in libntfs/unistr.c::ntfs_names_collate() pending a proper fix at some point. (Anton) - Rewrite gcc version detection logic using the -dumpversion option. Tested on various OS and architectures and gcc versions from 2.95 to - 4.0.1 with some weird ones like 3.5-blah thrown in, too. (Anton) + 4.0.2 with some weird ones like 3.5-blah thrown in, too. (Anton) - Fix bogus le16_to_cpu() which should be le32_to_cpu() when accessing the attribute list entry attribute type in some places in libntfs/attrib.c. (Anton) @@ -64,7 +64,7 @@ xx/xx/2005 - 1.12.2-WIP always contain valid value. (Yura) - Always set correct file size and attributes in ntfs_link(). (Yura) - Add info about Interix special files (symbolic links, character and - block devices, FIFOs and sockets) to layout.h. Teech ntfsmount to + block devices, FIFOs and sockets) to layout.h. Teach ntfsmount to handle them. (Yura) - Fix allocated data size for resident attributes. (Yura) - ntfsclone: check available free space on the destination before @@ -97,6 +97,9 @@ xx/xx/2005 - 1.12.2-WIP - ntfsinfo: fix off-by-one in ACL dumping, one ACE was missed. (Szaka) - ntfsmount: Rename "succeed_chmod" -> "silent". Do not return error on chown too. (Yura) + - Fix stupid bug in libntfs/bitmap.c::ntfs_bitmap_set_bits_in_run() + which caused bits to not be cleared or set if the first bit in the + run was not a multiple of eight. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index d3444d4d..6e034b68 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -162,7 +162,14 @@ static __inline__ int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, /* Update counters. */ tmp = (bufsize - firstbyte - lastbyte) << 3; - firstbyte = 0; + if (firstbyte) { + firstbyte = 0; + /* + * Re-set the partial first byte so a subsequent write + * of the buffer does not have stale, incorrect bits. + */ + *buf = value ? 0xff : 0; + } start_bit += tmp; count -= tmp; if (bufsize > (tmp = (count + 7) >> 3)) From e236c14c4a510c09346934865c904f36747131c9 Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 2 Feb 2006 14:40:53 +0000 Subject: [PATCH 2841/2994] Prepare for next release. --- NEWS | 13 +++++++------ README | 2 +- TODO.libntfs | 8 +++++++- TODO.ntfsprogs | 7 +++++++ libntfs/bitmap.c | 2 +- ntfsprogs/mkntfs.8.in | 4 ++-- ntfsprogs/mkntfs.c | 11 ++++++----- 7 files changed, 31 insertions(+), 16 deletions(-) diff --git a/NEWS b/NEWS index b022148b..c5fa1a32 100644 --- a/NEWS +++ b/NEWS @@ -1,19 +1,23 @@ Current news ============ +mkntfs now creates NTFS 3.1 (Windows XP) volumes by default. The old NTFS 1.2 +format is now deprecated and whilst it can still be specified using a command +line option, it will be removed in a future release. + ntfsmount can create/delete/move files and directories! It is not a full implementation, thus sometimes it will say 'Operation is not supported', nothing bad will happen to user data in this case. (Yura Pakhuchiy) +Older news +========== + Add new utility: ntfsmount. It is a FUSE module that uses on libntfs. So, you need FUSE 2.3 to compile it. This module supports file overwrite including changing the file size and can read/write/add/remove named data streams via "file:stream" interface and list them via "ntfs.streams.list" extended attribute (this only if xattr support is enabled). (Yura Pakhuchiy) -Older news -========== - Attribute resize code for normal and sparse files is completed. Thus, ntfscp should always successfully overwrite any normal or sparse file even if file size is changed. (Yura Pakhuchiy) @@ -38,9 +42,6 @@ this modifies the command line options a little as well as the returned output so applications using ntfsresize might need modifications before they will work with the updated ntfsresize. (Szakacsits Szabolcs) -ntfsprogs now should ./configure and compile cleanly on SuSE as well as RedHat -Linux. - ntfsprogs ("make libs" only) now compiles on FreeBSD, NetBSD, Windows (Cygwin), and DOS (DJGPP). Thanks to Christophe Grenier for DOS and FreeBSD testing and fixes and to Lode Leroy for Windows testing and fixes. diff --git a/README b/README index 5afcf195..f3cdfb7d 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ Linux-NTFS The Linux-NTFS project aims to bring full support for the NTFS filesystem to the Linux operating system. -Linux-NTFS is copyright (c) 2000-2005 Anton Altaparmakov. +Linux-NTFS is copyright (c) 2000-2006 Anton Altaparmakov. All of the contents of the Linux-NTFS project are free software, released under the GNU General Public License and you are welcome to redistribute them under diff --git a/TODO.libntfs b/TODO.libntfs index a528dedb..92d0db0c 100644 --- a/TODO.libntfs +++ b/TODO.libntfs @@ -20,7 +20,13 @@ - write ntfs_index_{rm_from,add_to,create,rm}() - detect presence of usnjrnl and if present and mounting rw, re-stamp it (see - current ntfs wip driver) + current ntfs driver for example in 2.6.15 kernel) + +- fix support for large sector sizes by changing the logical device block size + to the sector size in the ntfs volume (it ought to work without doing this as + we do byte-aligned i/o anyway) but it would be good to change in case a + previous mount left the block size to larger value and we expect 512 bytes as + that would be incredibly inefficient ******************* * MEDIUM priority * diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs index 25807171..5b01b392 100644 --- a/TODO.ntfsprogs +++ b/TODO.ntfsprogs @@ -8,6 +8,13 @@ Thanks, * mkntfs * ********** +- Correct support for creating volumes with larger sector sizes (mft record + size, cluster size, and index block size must be >= sector size), so for 1k, + 2k, and 4k sectors, we need to set the default mft record, cluster, and index + block size to be at least the sector size. +- Correct the odd last partition sector not being accessible under 2.4 kernels + by setting the device block size to the sector size (default is 1k on 2.4 + kernels and they can't cope with partial sectors). - Got a report that creating a floppy with mkntfs failed. Difference between this floppy and the floppy created by the special tool found on the net was said to be that the bitmap is 256kib on the special floppy while mkntfs will diff --git a/libntfs/bitmap.c b/libntfs/bitmap.c index 6e034b68..d0ec229f 100644 --- a/libntfs/bitmap.c +++ b/libntfs/bitmap.c @@ -1,7 +1,7 @@ /** * bitmap.c - Bitmap handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2002-2004 Anton Altaparmakov + * Copyright (c) 2002-2006 Anton Altaparmakov * Copyright (c) 2004-2005 Richard Russon * * This program/include file is free software; you can redistribute it and/or diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 645d3357..85662599 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -1,4 +1,4 @@ -.\" Copyright (c) 2001\-2002 Anton Altaparmakov. +.\" Copyright (c) 2001\-2006 Anton Altaparmakov. .\" Copyright (c) 2005 Richard Russon. .\" Copyright (c) 2005\-2006 Szabolcs Szakacsits. .\" This file may be copied under the terms of the GNU Public License. @@ -154,7 +154,7 @@ Select the version of NTFS you wish to create. This can be "1.2" Versions are upwards compatible and Windows 2000, which uses version "3.0", can read/write both. -If this option is omitted then version "1.2" is used. +If this option is omitted then version "3.1" is used. .TP \fB\-n\fR, \fB\-\-no\-action\fR Causes diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 7a31ce34..b6c1c6d4 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -1,7 +1,7 @@ /** * mkntfs - Part of the Linux-NTFS project. * - * Copyright (c) 2000-2005 Anton Altaparmakov + * Copyright (c) 2000-2006 Anton Altaparmakov * Copyright (c) 2001-2005 Richard Russon * Copyright (c) 2002-2006 Szabolcs Szakacsits * Copyright (c) 2005 Erik Sornes @@ -235,7 +235,7 @@ static void mkntfs_usage(void) " -S, --sectors-per-track NUM Specify the number of sectors per track\n" " -z, --mft-zone-multiplier NUM Set the MFT zone multiplier\n" " -T, --zero-time Fake the time to be 00:00 UTC, Jan 1, 1970\n" - " -N, --ntfs-version VERSION NTFS version: 3.1 or 1.2 (default)\n" + " -N, --ntfs-version VERSION NTFS version: 3.1 (default) or 1.2 (old)\n" " -F, --force Force execution despite errors\n" "\n" "Output options:\n" @@ -258,7 +258,7 @@ static void mkntfs_version(void) { ntfs_log_info("\n%s v%s (libntfs %s)\n\n", EXEC_NAME, VERSION, ntfs_libntfs_version()); ntfs_log_info("Create an NTFS volume on a user specified (block) device.\n\n"); - ntfs_log_info("Copyright (c) 2000-2005 Anton Altaparmakov\n"); + ntfs_log_info("Copyright (c) 2000-2006 Anton Altaparmakov\n"); ntfs_log_info("Copyright (c) 2001-2005 Richard Russon\n"); ntfs_log_info("Copyright (c) 2002-2006 Szabolcs Szakacsits\n"); ntfs_log_info("Copyright (c) 2005 Erik Sornes\n"); @@ -4961,8 +4961,9 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) g_vol->major_ver = opts.ver_major; g_vol->minor_ver = opts.ver_minor; } else { - g_vol->major_ver = 1; - g_vol->minor_ver = 2; + /* Create NTFS 3.1 (Windows XP) volumes by default. */ + g_vol->major_ver = 3; + g_vol->minor_ver = 1; } if (opts.cluster_size >= 0) g_vol->cluster_size = opts.cluster_size; From 90a6130039992fe71788ec01fb9678678100b8a6 Mon Sep 17 00:00:00 2001 From: antona Date: Thu, 2 Feb 2006 14:55:22 +0000 Subject: [PATCH 2842/2994] Update version number for the release 1.13.0. --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 4ec27be4..4e0b44b8 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # configure.ac - Source file to generate "./configure" to prepare package for # compilation. # -# Copyright (c) 2000-2005 Anton Altaparmakov +# Copyright (c) 2000-2006 Anton Altaparmakov # Copyright (c) 2003 Jan Kratochvil # # This program/include file is free software; you can redistribute it and/or @@ -22,7 +22,7 @@ # AC_PREREQ(2.59) -AC_INIT([ntfsprogs],[1.12.2-WIP],[linux-ntfs-dev@lists.sourceforge.net]) +AC_INIT([ntfsprogs],[1.13.0],[linux-ntfs-dev@lists.sourceforge.net]) # # Before making a release, the LTVERSION string should be modified. From 4b0fb6faffa0120f88fbeff92abfc39b640187ed Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 3 Feb 2006 09:03:09 +0000 Subject: [PATCH 2843/2994] Add VOLUME_CHDSK_UNDERWAY flag to volume flags (layout.h). Thanks to Szaka for the information. --- include/ntfs/layout.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index c4e78752..43fed781 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1986,6 +1986,7 @@ typedef enum { VOLUME_MOUNTED_ON_NT4 = const_cpu_to_le16(0x0008), VOLUME_DELETE_USN_UNDERWAY = const_cpu_to_le16(0x0010), VOLUME_REPAIR_OBJECT_ID = const_cpu_to_le16(0x0020), + VOLUME_CHKDSK_UNDERWAY = const_cpu_to_le16(0x4000), VOLUME_MODIFIED_BY_CHKDSK = const_cpu_to_le16(0x8000), VOLUME_FLAGS_MASK = const_cpu_to_le16(0x803f), } __attribute__((__packed__)) VOLUME_FLAGS; From 29ed836b4b4f8c1400362c42cd5f5a6471b9fa5d Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 3 Feb 2006 09:23:03 +0000 Subject: [PATCH 2844/2994] Update VOLUME_FLAGS_MASK, too. --- include/ntfs/layout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index 43fed781..f9f3ea7c 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -1988,7 +1988,7 @@ typedef enum { VOLUME_REPAIR_OBJECT_ID = const_cpu_to_le16(0x0020), VOLUME_CHKDSK_UNDERWAY = const_cpu_to_le16(0x4000), VOLUME_MODIFIED_BY_CHKDSK = const_cpu_to_le16(0x8000), - VOLUME_FLAGS_MASK = const_cpu_to_le16(0x803f), + VOLUME_FLAGS_MASK = const_cpu_to_le16(0xc03f), } __attribute__((__packed__)) VOLUME_FLAGS; /** From e57cc4521a8bc988b50c503bf936e886d6e81e82 Mon Sep 17 00:00:00 2001 From: szaka Date: Fri, 3 Feb 2006 18:44:13 +0000 Subject: [PATCH 2845/2994] Add CHKDSK_UNDERWAY to ntfsinfo --- ntfsprogs/ntfsinfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 34481ec9..3ddbb072 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -1036,6 +1036,8 @@ static void ntfs_dump_attr_volume_information(ATTR_RECORD *attr) printf("DEL_USN "); if (vol_information->flags & VOLUME_REPAIR_OBJECT_ID) printf("REPAIR_OBJID "); + if (vol_information->flags & VOLUME_CHKDSK_UNDERWAY) + printf("CHKDSK_UNDERWAY "); if (vol_information->flags & VOLUME_MODIFIED_BY_CHKDSK) printf("MOD_BY_CHKDSK "); if (vol_information->flags & VOLUME_FLAGS_MASK) { From af9fd39611530713284f5b78c6148ace37a4b1e3 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 3 Feb 2006 22:19:17 +0000 Subject: [PATCH 2846/2994] Wheee! Lots of last minute fixes and enhancements. - Compiler warning fixes for gnome-vfs and fuse modules. (Anton) - Change volume mounting (actually device opening) to happen with O_EXCL bit set so at least on Linux no one can change the device block size under our feet. (Anton) - Change volume mounting and mkntfs to set the device block size to the sector size using BLKBSZSET ioctl (Linux only). This should be optimal for performance and should fixes the bug of not being able to create the backup boot sector if the number of sectors on the device is odd, the sector size is 512 bytes, and the kernel is 2.4. (Anton) - Enforce cluster size, mft record size, and index record size to be at least equal to the sector size and verify they are still valid and in particular display a warning message if the volume will not be mountable by the kernel driver (it requires mft record size and index record size to be below or equal to the system page size which we determine using sysconf()). (Anton) --- ChangeLog | 14 +++ NEWS | 26 ----- configure.ac | 2 +- include/ntfs/device.h | 3 +- include/ntfs/device_io.h | 13 ++- libntfs/bootsect.c | 3 +- libntfs/device.c | 47 +++++++- libntfs/gnome-vfs-method.c | 6 +- libntfs/unix_io.c | 19 ++-- libntfs/volume.c | 9 +- libntfs/win32_io.c | 8 +- ntfsprogs/mkntfs.8.in | 20 ---- ntfsprogs/mkntfs.c | 228 +++++++++++++++++++++---------------- ntfsprogs/ntfsmount.c | 12 +- 14 files changed, 238 insertions(+), 172 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac100332..a81e35f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -100,6 +100,20 @@ - Fix stupid bug in libntfs/bitmap.c::ntfs_bitmap_set_bits_in_run() which caused bits to not be cleared or set if the first bit in the run was not a multiple of eight. (Anton) + - Change volume mounting (actually device opening) to happen with + O_EXCL bit set so at least on Linux no one can change the device + block size under our feet. (Anton) + - Change volume mounting and mkntfs to set the device block size to the + sector size using BLKBSZSET ioctl (Linux only). This should be + optimal for performance and should fixes the bug of not being able to + create the backup boot sector if the number of sectors on the device + is odd, the sector size is 512 bytes, and the kernel is 2.4. (Anton) + - Enforce cluster size, mft record size, and index record size to be at + least equal to the sector size and verify they are still valid and in + particular display a warning message if the volume will not be + mountable by the kernel driver (it requires mft record size and index + record size to be below or equal to the system page size which we + determine using sysconf()). (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/NEWS b/NEWS index c5fa1a32..0f51ea3a 100644 --- a/NEWS +++ b/NEWS @@ -18,30 +18,4 @@ changing the file size and can read/write/add/remove named data streams via "file:stream" interface and list them via "ntfs.streams.list" extended attribute (this only if xattr support is enabled). (Yura Pakhuchiy) -Attribute resize code for normal and sparse files is completed. Thus, ntfscp -should always successfully overwrite any normal or sparse file even if file -size is changed. (Yura Pakhuchiy) - Moved back from BitKeeper to CVS on SF.net. - -ntfsprogs should now work completely on Windows 2000 and XP (Cygwin). -mkntfs does not create bootable volumes when on Windows. Volumes are locked -when using a R/W utility in order to prevent data corruption. (Yuval Fledel, -Anton Altaparmakov) - -ntfsinfo has been extended and now provides much more detailed information as -well as being able to resolve a path/filename instead of requiring the inode -number. (Yuval Fledel, Anton Altaparmakov) - -mkntfs now creates bootable ntfs volumes so you can install Windows on an -ntfs volume created with mkntfs and Windows will manage to boot afterwards. - -ntfsresize now supports relocation which generally means you are now able to -resize to any size you like (as long as there is enough free space). Note, -this modifies the command line options a little as well as the returned output -so applications using ntfsresize might need modifications before they will -work with the updated ntfsresize. (Szakacsits Szabolcs) - -ntfsprogs ("make libs" only) now compiles on FreeBSD, NetBSD, Windows (Cygwin), -and DOS (DJGPP). Thanks to Christophe Grenier for DOS and FreeBSD testing -and fixes and to Lode Leroy for Windows testing and fixes. diff --git a/configure.ac b/configure.ac index 4e0b44b8..269655aa 100644 --- a/configure.ac +++ b/configure.ac @@ -358,7 +358,7 @@ AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF AC_CHECK_FUNCS([atexit dup2 fdatasync getopt_long hasmntopt mbsinit memmove \ memset realpath regcomp setlocale setxattr strcasecmp strchr strdup \ - strerror strnlen strtol strtoul utime]) + strerror strnlen strtol strtoul sysconf utime]) # Makefiles to be created by configure. AC_CONFIG_FILES([ diff --git a/include/ntfs/device.h b/include/ntfs/device.h index ecadb070..304445ff 100644 --- a/include/ntfs/device.h +++ b/include/ntfs/device.h @@ -1,7 +1,7 @@ /* * device.h - Exports for low level device io. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2000-2006 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -118,5 +118,6 @@ extern s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev); extern int ntfs_device_heads_get(struct ntfs_device *dev); extern int ntfs_device_sectors_per_track_get(struct ntfs_device *dev); extern int ntfs_device_sector_size_get(struct ntfs_device *dev); +extern int ntfs_device_block_size_set(struct ntfs_device *dev, int block_size); #endif /* defined _NTFS_DEVICE_H */ diff --git a/include/ntfs/device_io.h b/include/ntfs/device_io.h index 76e84c79..6665b680 100644 --- a/include/ntfs/device_io.h +++ b/include/ntfs/device_io.h @@ -1,7 +1,7 @@ /* * device_io.h - Exports for default device io. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2004 Anton Altaparmakov + * Copyright (c) 2000-2006 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -36,7 +36,7 @@ #else /* __CYGWIN32__ */ #ifndef HDIO_GETGEO -# define HDIO_GETGEO 0x10000301 +# define HDIO_GETGEO 0x301 /** * struct hd_geometry - */ @@ -48,13 +48,16 @@ struct hd_geometry { }; #endif #ifndef BLKGETSIZE -# define BLKGETSIZE 0x10001260 +# define BLKGETSIZE 0x1260 #endif #ifndef BLKSSZGET -# define BLKSSZGET 0x10001268 +# define BLKSSZGET 0x1268 #endif #ifndef BLKGETSIZE64 -# define BLKGETSIZE64 0x10001272 +# define BLKGETSIZE64 0x80041272 +#endif +#ifndef BLKBSZSET +# define BLKBSZSET 0x40041271 #endif /* On Cygwin; use Win32 low level device operations. */ diff --git a/libntfs/bootsect.c b/libntfs/bootsect.c index 3b625ef2..93d95ff4 100644 --- a/libntfs/bootsect.c +++ b/libntfs/bootsect.c @@ -1,7 +1,7 @@ /** * bootsect.c - Boot sector handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2005 Anton Altaparmakov + * Copyright (c) 2000-2006 Anton Altaparmakov * Copyright (c) 2005 Yura Pakhuchiy * * This program/include file is free software; you can redistribute it and/or @@ -270,4 +270,3 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs) vol->mftmirr_size = vol->cluster_size / vol->mft_record_size; return 0; } - diff --git a/libntfs/device.c b/libntfs/device.c index 7f2689bf..968c2076 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -1,7 +1,7 @@ /** * device.c - Low level device io functions. Part of the Linux-NTFS project. * - * Copyright (c) 2004 Anton Altaparmakov + * Copyright (c) 2004-2006 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -50,6 +50,9 @@ #ifdef HAVE_SYS_IOCTL_H #include #endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif #ifdef HAVE_LINUX_FD_H #include #endif @@ -75,6 +78,9 @@ #if defined(linux) && defined(_IO) && !defined(BLKSSZGET) # define BLKSSZGET _IO(0x12,104) /* Get device sector size in bytes. */ #endif +#if defined(linux) && defined(_IO) && !defined(BLKBSZSET) +# define BLKBSZSET _IOW(0x12,113,size_t) /* Set device block size in bytes. */ +#endif /** * ntfs_device_alloc - allocate an ntfs device structure and pre-initialize it @@ -641,6 +647,7 @@ int ntfs_device_sectors_per_track_get(struct ntfs_device *dev) #endif return -1; } + /** * ntfs_device_sector_size_get - get sector size of a device * @dev: open device @@ -650,8 +657,8 @@ int ntfs_device_sectors_per_track_get(struct ntfs_device *dev) * * The following error codes are defined: * EINVAL Input parameter error - * EOPNOTSUPP System does not support HDIO_GETGEO ioctl - * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO + * EOPNOTSUPP System does not support BLKSSZGET ioctl + * ENOTTY @dev is a file or a device not supporting BLKSSZGET */ int ntfs_device_sector_size_get(struct ntfs_device *dev) { @@ -674,3 +681,37 @@ int ntfs_device_sector_size_get(struct ntfs_device *dev) return -1; } +/** + * ntfs_device_block_size_set - set block size of a device + * @dev: open device + * @block_size: block size to set @dev to + * + * On success, return 0. + * On error return -1 with errno set to the error code. + * + * The following error codes are defined: + * EINVAL Input parameter error + * EOPNOTSUPP System does not support HDIO_GETGEO ioctl + * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO + */ +int ntfs_device_block_size_set(struct ntfs_device *dev, int block_size) +{ + if (!dev) { + errno = EINVAL; + return -1; + } +#ifdef BLKBSZSET + { + size_t s_block_size = block_size; + if (!dev->d_ops->ioctl(dev, BLKBSZSET, &s_block_size)) { + ntfs_log_debug("Used BLKBSZSET to set block size to " + "%d bytes\n", block_size); + return 0; + } + } +#else + errno = EOPNOTSUPP; +#endif + return -1; +} + diff --git a/libntfs/gnome-vfs-method.c b/libntfs/gnome-vfs-method.c index 49def0a7..28e5d8b7 100644 --- a/libntfs/gnome-vfs-method.c +++ b/libntfs/gnome-vfs-method.c @@ -3,7 +3,7 @@ * libntfs. Part of the Linux-NTFS project. * * Copyright (c) 2003 Jan Kratochvil - * Copyright (c) 2003-2005 Anton Altaparmakov + * Copyright (c) 2003-2006 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -659,7 +659,7 @@ static GnomeVFSResult libntfs_gnomevfs_seek(GnomeVFSMethod *method, static GnomeVFSResult libntfs_gnomevfs_tell(GnomeVFSMethod *method, GnomeVFSMethodHandle *method_handle, - GnomeVFSFileOffset *offset_return) + GnomeVFSFileSize *offset_return) { GnomeVFSResult errvfsresult; struct libntfs_file *libntfs_file; @@ -676,7 +676,7 @@ static GnomeVFSResult libntfs_gnomevfs_tell(GnomeVFSMethod *method, return errvfsresult; *offset_return = libntfs_file->pos; - g_assert(*offset_return == libntfs_file->pos); + g_assert((s64)*offset_return == libntfs_file->pos); return errvfsresult; } diff --git a/libntfs/unix_io.c b/libntfs/unix_io.c index 0b702ba1..6ff72e2b 100644 --- a/libntfs/unix_io.c +++ b/libntfs/unix_io.c @@ -1,7 +1,7 @@ /** * unix_io.c - Unix style disk io functions. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2003 Anton Altaparmakov + * Copyright (c) 2000-2006 Anton Altaparmakov * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -60,12 +60,13 @@ #include "device.h" #include "logging.h" -#if defined(linux) && defined(_IO) && !defined(BLKGETSIZE) -# define BLKGETSIZE _IO(0x12,96) /* Get device size in 512byte blocks. */ -#endif - #define DEV_FD(dev) (*(int *)dev->d_private) +/* Define to nothing if not present on this system. */ +#ifndef O_EXCL +# define O_EXCL 0 +#endif + /** * ntfs_device_unix_io_open - Open a device and lock it exclusively * @dev: @@ -86,8 +87,12 @@ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags) } if (!(dev->d_private = malloc(sizeof(int)))) return -1; - /* Open the device/file obtaining the file descriptor. */ - if ((*(int *)dev->d_private = open(dev->d_name, flags)) == -1) { + /* + * Open the device/file obtaining the file descriptor for exclusive + * access. + */ + *(int*)dev->d_private = open(dev->d_name, flags | O_EXCL); + if (*(int*)dev->d_private == -1) { err = errno; goto err_out; } diff --git a/libntfs/volume.c b/libntfs/volume.c index d3f4d169..9e08c24c 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -1,7 +1,7 @@ /** * volume.c - NTFS volume handling code. Part of the Linux-NTFS project. * - * Copyright (c) 2000-2005 Anton Altaparmakov + * Copyright (c) 2000-2006 Anton Altaparmakov * Copyright (c) 2002-2005 Szabolcs Szakacsits * Copyright (c) 2004-2005 Richard Russon * @@ -467,7 +467,12 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long flags) } free(bs); bs = NULL; - + /* Now set the device block size to the sector size. */ + if (ntfs_device_block_size_set(vol->dev, vol->sector_size)) + ntfs_log_debug("Failed to set the device block size to the " + "sector size. This may affect performance " + "but should be harmless otherwise. Error: " + "%s\n", strerror(errno)); /* * We now initialize the cluster allocator. * diff --git a/libntfs/win32_io.c b/libntfs/win32_io.c index a24abb3e..c7a3e8e8 100644 --- a/libntfs/win32_io.c +++ b/libntfs/win32_io.c @@ -4,7 +4,7 @@ * Part of the Linux-NTFS project. * * Copyright (c) 2003-2004 Lode Leroy - * Copyright (c) 2003-2005 Anton Altaparmakov + * Copyright (c) 2003-2006 Anton Altaparmakov * Copyright (c) 2004-2005 Yuval Fledel * * This program/include file is free software; you can redistribute it and/or @@ -1433,6 +1433,12 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request, case BLKSSZGET: ntfs_log_debug("BLKSSZGET detected.\n"); return ntfs_win32_blksszget(dev, (int *)argp); +#endif +#ifdef BLKBSZSET + case BLKBSZSET: + ntfs_log_debug("BLKBSZSET detected.\n"); + /* Nothing to do on Windows. */ + return 0; #endif default: ntfs_log_debug("unimplemented ioctl %d.\n", request); diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 85662599..4da7b1de 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -271,26 +271,6 @@ and exit. \fB\-h\fR, \fB\-\-help\fR Show a list of options with a brief description of each one. .SH BUGS -.B mkntfs -writes the backup boot sector to the last sector of the block -.I device -being formatted. However, current versions of the Linux kernel (all versions -up to and including todays 2.4.18) either only report an even number of sectors -when the sector size is below 1024 bytes, which is the case for most hard -drives today (512 bytes sector size) or they return the correct number but -accessing the last sector fails. Either way, this means that when a partition -has an odd number of 512\-byte sectors, the last sector is either not reported -to us at all or it is not writable by us and hence the created NTFS volume -will either have the backup boot sector placed one sector ahead of where it -should be or it cannot be written at all. For this reason, -.B mkntfs -marks the NTFS volume dirty, so that when you reboot into Windows, check disk -runs automatically and creates a copy of the backup boot sector in the correct -location. This also has the benefit of catching any bugs in -.B mkntfs -as check disk would find any corrupt structures and repair them, as well as -report them. -.sp If you find a bug please send an email describing the problem to the development team: .br diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index b6c1c6d4..ce8d08ae 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -171,7 +171,7 @@ runlist *g_rl_boot = NULL; runlist *g_rl_bad = NULL; INDEX_ALLOCATION *g_index_block = NULL; ntfs_volume *g_vol = NULL; -int g_mft_size = 0; /* The bigger of 16kB & one cluster */ +int g_mft_size = 0; long long g_mft_lcn = 0; /* lcn of $MFT, $DATA attribute */ long long g_mftmirr_lcn = 0; /* lcn of $MFTMirr, $DATA */ long long g_logfile_lcn = 0; /* lcn of $LogFile, $DATA */ @@ -3457,8 +3457,10 @@ static BOOL mkntfs_open_partition(ntfs_volume *vol) } ntfs_log_warning("mkntfs forced anyway.\n"); #ifdef HAVE_LINUX_MAJOR_H - } else if ((IDE_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 64 == 0) || - (SCSI_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && MINOR(sbuf.st_rdev) % 16 == 0)) { + } else if ((IDE_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && + MINOR(sbuf.st_rdev) % 64 == 0) || + (SCSI_DISK_MAJOR(MAJOR(sbuf.st_rdev)) && + MINOR(sbuf.st_rdev) % 16 == 0)) { ntfs_log_error("%s is entire device, not just one partition.\n", vol->dev->d_name); if (!opts.force) { ntfs_log_error("Refusing to make a filesystem here!\n"); @@ -3484,12 +3486,13 @@ done: } /** - * mkntfs_override_phys_params - + * mkntfs_override_vol_params - */ -static BOOL mkntfs_override_phys_params(ntfs_volume *vol) +static BOOL mkntfs_override_vol_params(ntfs_volume *vol) { - int i; s64 volume_size; + long page_size; + int i; BOOL winboot = TRUE; /* If user didn't specify the sector size, determine it now. */ @@ -3503,7 +3506,6 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) opts.sector_size = 512; } } - /* Validate sector size. */ if ((opts.sector_size - 1) & opts.sector_size) { ntfs_log_error("The sector size is invalid. It must be a " @@ -3516,10 +3518,17 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) return FALSE; } ntfs_log_debug("sector size = %ld bytes\n", opts.sector_size); - + /* Now set the device block size to the sector size. */ + if (ntfs_device_block_size_set(vol->dev, opts.sector_size)) + ntfs_log_debug("Failed to set the device block size to the " + "sector size. This may cause problems when " + "creating the backup boot sector and also may " + "affect performance but should be harmless " + "otherwise. Error: %s\n", strerror(errno)); /* If user didn't specify the number of sectors, determine it now. */ if (opts.num_sectors < 0) { - opts.num_sectors = ntfs_device_size_get(vol->dev, opts.sector_size); + opts.num_sectors = ntfs_device_size_get(vol->dev, + opts.sector_size); if (opts.num_sectors <= 0) { ntfs_log_error("Couldn't determine the size of %s. " "Please specify the number of sectors " @@ -3528,8 +3537,7 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) } } ntfs_log_debug("number of sectors = %lld (0x%llx)\n", opts.num_sectors, - opts.num_sectors); - + opts.num_sectors); /* * Reserve the last sector for the backup boot sector unless the * sector size is less than 512 bytes in which case reserve 512 bytes @@ -3539,10 +3547,10 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) if (opts.sector_size < 512) i = 512 / opts.sector_size; opts.num_sectors -= i; - /* If user didn't specify the partition start sector, determine it. */ if (opts.part_start_sect < 0) { - opts.part_start_sect = ntfs_device_partition_start_sector_get(vol->dev); + opts.part_start_sect = ntfs_device_partition_start_sector_get( + vol->dev); if (opts.part_start_sect < 0) { ntfs_log_warning("The partition start sector was not " "specified for %s and it could not be obtained " @@ -3563,10 +3571,10 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) "4294967295 (2^32-1).\n"); return FALSE; } - /* If user didn't specify the sectors per track, determine it now. */ if (opts.sectors_per_track < 0) { - opts.sectors_per_track = ntfs_device_sectors_per_track_get(vol->dev); + opts.sectors_per_track = ntfs_device_sectors_per_track_get( + vol->dev); if (opts.sectors_per_track < 0) { ntfs_log_warning("The number of sectors per track was " "not specified for %s and it could not be " @@ -3587,7 +3595,6 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) "is 65535.\n"); return FALSE; } - /* If user didn't specify the number of heads, determine it now. */ if (opts.heads < 0) { opts.heads = ntfs_device_heads_get(vol->dev); @@ -3610,17 +3617,14 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) ntfs_log_error("Invalid number of heads. Maximum is 65535.\n"); return FALSE; } - volume_size = opts.num_sectors * opts.sector_size; - /* Validate volume size. */ if (volume_size < (1 << 20)) { /* 1MiB */ - ntfs_log_error("Device is too small (%llikiB). Minimum NTFS " - "volume size is 1MiB.\n", volume_size / 1024); + ntfs_log_error("Device is too small (%llikiB). Minimum NTFS " + "volume size is 1MiB.\n", volume_size / 1024); return FALSE; } ntfs_log_debug("volume size = %llikiB\n", volume_size / 1024); - /* If user didn't specify the cluster size, determine it now. */ if (!vol->cluster_size) { if (volume_size <= 512LL << 20) /* <= 512MB */ @@ -3643,28 +3647,29 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) vol->cluster_size <<= 1; if (vol->cluster_size > 65535) { ntfs_log_error("Device is too large to hold an " - "NTFS volume (maximum size is 256TiB).\n"); + "NTFS volume (maximum size is " + "256TiB).\n"); return FALSE; } } ntfs_log_quiet("Cluster size has been automatically set to %d " - "bytes.\n", vol->cluster_size); + "bytes.\n", vol->cluster_size); } - /* Validate cluster size. */ if (vol->cluster_size & (vol->cluster_size - 1)) { ntfs_log_error("The cluster size is invalid. It must be a " - "power of two, e.g. 1024, 4096.\n"); + "power of two, e.g. 1024, 4096.\n"); return FALSE; } if (vol->cluster_size < (u32)opts.sector_size) { ntfs_log_error("The cluster size is invalid. It must be equal " - "to, or larger than, the sector size.\n"); + "to, or larger than, the sector size.\n"); return FALSE; } if (vol->cluster_size > 128 * (u32)opts.sector_size) { ntfs_log_error("The cluster size is invalid. It cannot be " - "more that 128 times the size of the sector size.\n"); + "more that 128 times the size of the sector " + "size.\n"); return FALSE; } if (vol->cluster_size > 65536) { @@ -3672,60 +3677,109 @@ static BOOL mkntfs_override_phys_params(ntfs_volume *vol) "cluster size is 65536 bytes (64kiB).\n"); return FALSE; } - vol->cluster_size_bits = ffs(vol->cluster_size) - 1; - ntfs_log_debug("cluster size = %u bytes\n", (unsigned int)vol->cluster_size); + ntfs_log_debug("cluster size = %u bytes\n", + (unsigned int)vol->cluster_size); if (vol->cluster_size > 4096) { if (opts.enable_compression) { if (!opts.force) { ntfs_log_error("Windows cannot use compression " - "when the cluster size is larger than " - "4096 bytes.\n"); + "when the cluster size is " + "larger than 4096 bytes.\n"); return FALSE; } opts.enable_compression = 0; } ntfs_log_warning("Windows cannot use compression when the " - "cluster size is larger than 4096 bytes. Compression " - "has been disabled for this volume.\n"); + "cluster size is larger than 4096 bytes. " + "Compression has been disabled for this " + "volume.\n"); } - vol->nr_clusters = volume_size / vol->cluster_size; - /* * Check the cluster_size and num_sectors for consistency with * sector_size and num_sectors. And check both of these for consistency * with volume_size. */ - if ((vol->nr_clusters != ((opts.num_sectors * opts.sector_size) / vol->cluster_size) || - (volume_size / opts.sector_size) != opts.num_sectors || - (volume_size / vol->cluster_size) != vol->nr_clusters)) { + if ((vol->nr_clusters != ((opts.num_sectors * opts.sector_size) / + vol->cluster_size) || + (volume_size / opts.sector_size) != opts.num_sectors || + (volume_size / vol->cluster_size) != + vol->nr_clusters)) { /* XXX is this code reachable? */ - ntfs_log_error("Illegal combination of volume/cluster/sector size and/or cluster/sector number.\n"); + ntfs_log_error("Illegal combination of volume/cluster/sector " + "size and/or cluster/sector number.\n"); return FALSE; } - ntfs_log_debug("number of clusters = %llu (0x%llx)\n", vol->nr_clusters, vol->nr_clusters); - + ntfs_log_debug("number of clusters = %llu (0x%llx)\n", + vol->nr_clusters, vol->nr_clusters); /* Number of clusters must fit within 32 bits (Win2k limitation). */ if (vol->nr_clusters >> 32) { if (vol->cluster_size >= 65536) { ntfs_log_error("Device is too large to hold an NTFS " - "volume (maximum size is 256TiB).\n"); + "volume (maximum size is 256TiB).\n"); return FALSE; } ntfs_log_error("Number of clusters exceeds 32 bits. Please " - "try again with a larger\ncluster size or leave the " - "cluster size unspecified and the smallest possible " - "cluster size for the size of the device will be used.\n"); + "try again with a larger\ncluster size or " + "leave the cluster size unspecified and the " + "smallest possible cluster size for the size " + "of the device will be used.\n"); return FALSE; } - + page_size = sysconf(_SC_PAGESIZE); + if (page_size < 0) + page_size = sysconf(_SC_PAGE_SIZE); + if (page_size >= 0) + ntfs_log_debug("System page size is %li bytes.\n", page_size); + else { + ntfs_log_warning("Failed to determine system page size. " + "Assuming safe default of 4096 bytes.\n"); + page_size = 4096; + } + /* + * Set the mft record size. By default this is 1024 but it has to be + * at least as big as a sector and not bigger than a page on the system + * or the NTFS kernel driver will not be able to mount the volume. + * TODO: The mft record size should be user specifiable just like the + * "inode size" can be specified on other Linux/Unix file systems. + */ + vol->mft_record_size = 1024; + if (vol->mft_record_size < vol->sector_size) + vol->mft_record_size = vol->sector_size; + if (vol->mft_record_size > (unsigned long)page_size) + ntfs_log_warning("Mft record size (%u bytes) exceeds system " + "page size (%li bytes). You will not be able " + "to mount this volume using the NTFS kernel " + "driver.\n", (unsigned)vol->mft_record_size, + page_size); + vol->mft_record_size_bits = ffs(vol->mft_record_size) - 1; + ntfs_log_debug("mft record size = %u bytes\n", + (unsigned)vol->mft_record_size); + /* + * Set the index record size. By default this is 4096 but it has to be + * at least as big as a sector and not bigger than a page on the system + * or the NTFS kernel driver will not be able to mount the volume. + * FIXME: Should we make the index record size to be user specifiable? + */ + vol->indx_record_size = 4096; + if (vol->indx_record_size < vol->sector_size) + vol->indx_record_size = vol->sector_size; + if (vol->indx_record_size > (unsigned long)page_size) + ntfs_log_warning("Index record size (%u bytes) exceeds system " + "page size (%li bytes). You will not be able " + "to mount this volume using the NTFS kernel " + "driver.\n", vol->indx_record_size, page_size); + vol->indx_record_size_bits = ffs(vol->indx_record_size) - 1; + ntfs_log_debug("index record size = %u bytes\n", + (unsigned)vol->indx_record_size); if (!winboot) { ntfs_log_warning("To boot from a device, Windows needs the " - "'partition start sector', the 'sectors per track' and " - "the 'number of heads' to be set.\n"); + "'partition start sector', the 'sectors per " + "track' and the 'number of heads' to be " + "set.\n"); ntfs_log_warning("Windows will not be able to boot from this " - "device.\n"); + "device.\n"); } return TRUE; } @@ -3759,6 +3813,11 @@ static BOOL mkntfs_initialize_bitmaps(void) * Determine mft_size: (16 (1.2) or 27 (3.0+) mft records) or * one cluster, whichever is bigger. */ + if (g_vol->major_ver >= 3) + g_mft_size = 27; + else + g_mft_size = 16; + g_mft_size *= g_vol->mft_record_size; g_mft_size = ((16 + 11 * (g_vol->major_ver >= 3)) * g_vol->mft_record_size); if (g_mft_size < (s32)g_vol->cluster_size) @@ -4254,16 +4313,17 @@ static int create_backup_boot_sector(u8 *buff) s = strerror(e); else s = "unknown error"; - if (bw != -1LL || (bw == -1LL && e != ENOSPC)) { + /* At least some 2.4 kernels return EIO instead of ENOSPC. */ + if (bw != -1LL || (bw == -1LL && e != ENOSPC && e != EIO)) { ntfs_log_critical("Couldn't write backup boot sector: %s\n", s); return -1; } bb_err: ntfs_log_error("Couldn't write backup boot sector. This is due to a " - "limitation in the\nLinux kernel. This is not " - "a major problem as Windows check disk will " - "create the\nbackup boot sector when it " - "is run on your next boot into Windows.\n"); + "limitation in the\nLinux kernel. This is not a major " + "problem as Windows check disk will create the\n" + "backup boot sector when it is run on your next boot " + "into Windows.\n"); return -1; } @@ -4653,20 +4713,17 @@ static BOOL mkntfs_create_root_structures(void) ntfs_log_error("Couldn't create $Boot: %s\n", strerror(-err)); return FALSE; } - if (create_backup_boot_sector((u8*)bs)) { /* - * Pre-2.6 kernels couldn't access the last sector - * if it was odd hence we schedule chkdsk to create it. + * Pre-2.6 kernels couldn't access the last sector if it was + * odd and we failed to set the device block size to the sector + * size, hence we schedule chkdsk to create it. */ volume_flags |= VOLUME_IS_DIRTY; } - free(bs); - if (!create_file_volume(m, root_ref, volume_flags)) return FALSE; - ntfs_log_verbose("Creating $BadClus (mft record 8)\n"); m = (MFT_RECORD*)(g_buf + 8 * g_vol->mft_record_size); /* FIXME: This should be IGNORE_CASE */ @@ -4937,18 +4994,15 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) ntfs_log_error("Internal error: invalid parameters to mkntfs_options.\n"); goto done; } - /* Initialize the random number generator with the current time. */ srandom(mkntfs_time()); - /* Allocate and initialize ntfs_volume structure g_vol. */ g_vol = ntfs_volume_alloc(); if (!g_vol) { ntfs_log_perror("Could not create volume"); goto done; } - - /* transfer some options to the volume */ + /* Transfer some options to the volume. */ if (opts.label) { g_vol->vol_name = strdup(opts.label); if (!g_vol->vol_name) { @@ -4956,7 +5010,6 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) goto done; } } - if (opts.ver_major) { g_vol->major_ver = opts.ver_major; g_vol->minor_ver = opts.ver_minor; @@ -4967,10 +5020,6 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) } if (opts.cluster_size >= 0) g_vol->cluster_size = opts.cluster_size; - - g_vol->mft_record_size = 1024; - g_vol->mft_record_size_bits = 10; - /* Length is in unicode characters. */ g_vol->upcase_len = 65536; g_vol->upcase = malloc(g_vol->upcase_len * sizeof(ntfschar)); @@ -4979,84 +5028,73 @@ static int mkntfs_redirect(struct mkntfs_options *opts2) goto done; } init_upcase_table(g_vol->upcase, g_vol->upcase_len * sizeof(ntfschar)); - - g_vol->indx_record_size = 4096; - g_vol->indx_record_size_bits = 12; - if (g_vol->major_ver < 3) { g_vol->attrdef = ntfs_calloc(1, 36000); if (g_vol->attrdef) { - memcpy(g_vol->attrdef, attrdef_ntfs12_array, sizeof(attrdef_ntfs12_array)); + memcpy(g_vol->attrdef, attrdef_ntfs12_array, + sizeof(attrdef_ntfs12_array)); g_vol->attrdef_len = 36000; } } else { g_vol->attrdef = malloc(sizeof(attrdef_ntfs3x_array)); if (g_vol->attrdef) { - memcpy(g_vol->attrdef, attrdef_ntfs3x_array, sizeof(attrdef_ntfs3x_array)); + memcpy(g_vol->attrdef, attrdef_ntfs3x_array, + sizeof(attrdef_ntfs3x_array)); g_vol->attrdef_len = sizeof(attrdef_ntfs3x_array); } } - if (!g_vol->attrdef) { ntfs_log_perror("Could not create attrdef structure"); goto done; } - /* Open the partition. */ if (!mkntfs_open_partition(g_vol)) goto done; - - /* Decide on the sectors/tracks/heads/size, etc. */ - if (!mkntfs_override_phys_params(g_vol)) + /* + * Decide on the sector size, cluster size, mft record and index record + * sizes as well as the number of sectors/tracks/heads/size, etc. + */ + if (!mkntfs_override_vol_params(g_vol)) goto done; - /* Initialize $Bitmap and $MFT/$BITMAP related stuff. */ if (!mkntfs_initialize_bitmaps()) goto done; - /* Initialize MFT & set g_logfile_lcn. */ if (!mkntfs_initialize_rl_mft()) goto done; - /* Initialize $LogFile. */ if (!mkntfs_initialize_rl_logfile()) goto done; - /* Initialize $Boot. */ if (!mkntfs_initialize_rl_boot()) goto done; - /* Allocate a buffer large enough to hold the mft. */ g_buf = ntfs_calloc(1, g_mft_size); if (!g_buf) goto done; - /* Create runlist for $BadClus, $DATA named stream $Bad. */ if (!mkntfs_initialize_rl_bad()) goto done; - /* If not quick format, fill the device with 0s. */ if (!opts.quick_format) { if (!mkntfs_fill_device_with_zeroes()) goto done; } - /* Create NTFS volume structures. */ if (!mkntfs_create_root_structures()) goto done; - /* * - Do not step onto bad blocks!!! - * - If any bad blocks were specified or found, modify $BadClus, allocating the - * bad clusters in $Bitmap. + * - If any bad blocks were specified or found, modify $BadClus, + * allocating the bad clusters in $Bitmap. * - C&w bootsector backup bootsector (backup in last sector of the * partition). * - If NTFS 3.0+, c&w $Secure file and $Extend directory with the - * corresponding special files in it, i.e. $ObjId, $Quota, $Reparse, and - * $UsnJrnl. And others? Or not all necessary? + * corresponding special files in it, i.e. $ObjId, $Quota, $Reparse, + * and $UsnJrnl. And others? Or not all necessary? * - RE: Populate $root with the system files (and $Extend directory if - * applicable). Possibly should move this as far to the top as possible and - * update during each subsequent c&w of each system file. + * applicable). Possibly should move this as far to the top as + * possible and update during each subsequent c&w of each system file. */ ntfs_log_verbose("Syncing root directory index record.\n"); if (!mkntfs_sync_index_record(g_index_block, (MFT_RECORD*)(g_buf + 5 * diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index 3ca482b0..fbadfa4f 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -220,7 +220,7 @@ static long ntfs_fuse_get_nr_free_clusters(ntfs_volume *vol) * Return 0 on success or -errno on error. */ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), -#if FUSE_VERSION >= 25 +#if defined(FUSE_VERSION) && (FUSE_VERSION >= 25) struct statvfs *sfs) #else struct statfs *sfs) @@ -234,7 +234,7 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), return -ENODEV; /* Optimal transfer block size. */ sfs->f_bsize = vol->cluster_size; -#if FUSE_VERSION >= 25 +#if defined(FUSE_VERSION) && (FUSE_VERSION >= 25) sfs->f_frsize = vol->cluster_size; #endif /* @@ -257,7 +257,7 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)), size = 0; sfs->f_ffree = size; /* Maximum length of filenames. */ -#if FUSE_VERSION >= 25 +#if defined(FUSE_VERSION) && (FUSE_VERSION >= 25) sfs->f_namemax = NTFS_MAX_NAME_LEN; #else sfs->f_namelen = NTFS_MAX_NAME_LEN; @@ -1763,7 +1763,7 @@ static int parse_options(int argc, char *argv[]) int main(int argc, char *argv[]) { char *parsed_options; -#if FUSE_VERSION >= 25 +#if defined(FUSE_VERSION) && (FUSE_VERSION >= 25) struct fuse_args margs = FUSE_ARGS_INIT(0, NULL); #endif struct fuse *fh; @@ -1795,7 +1795,7 @@ int main(int argc, char *argv[]) } free(opts.device); /* Create filesystem. */ -#if FUSE_VERSION >= 25 +#if defined(FUSE_VERSION) && (FUSE_VERSION >= 25) if ((fuse_opt_add_arg(&margs, "") == -1 || fuse_opt_add_arg(&margs, "-o") == -1 || fuse_opt_add_arg(&margs, parsed_options) == -1)) @@ -1812,7 +1812,7 @@ int main(int argc, char *argv[]) return 5; } free(parsed_options); -#if FUSE_VERSION >= 25 +#if defined(FUSE_VERSION) && (FUSE_VERSION >= 25) fh = (struct fuse *)1; /* Cast anything except NULL to handle errors. */ margs = (struct fuse_args)FUSE_ARGS_INIT(0, NULL); if (fuse_opt_add_arg(&margs, "") == -1 || From 135282539b83f33735746939cd0c4fb99f78db3b Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 3 Feb 2006 23:11:35 +0000 Subject: [PATCH 2847/2994] Fixes to previous commit. --- include/ntfs/device.h | 5 +++++ libntfs/device.c | 9 ++++++--- libntfs/unix_io.c | 5 ++++- ntfsprogs/mkntfs.c | 11 ++++++----- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/include/ntfs/device.h b/include/ntfs/device.h index 304445ff..eeadf13e 100644 --- a/include/ntfs/device.h +++ b/include/ntfs/device.h @@ -40,6 +40,7 @@ typedef enum { ND_Open, /* 1: Device is open. */ ND_ReadOnly, /* 1: Device is read-only. */ ND_Dirty, /* 1: Device is dirty, needs sync. */ + ND_Block, /* 1: Device is a block device. */ } ntfs_device_state_bits; #define test_ndev_flag(nd, flag) test_bit(ND_##flag, (nd)->d_state) @@ -58,6 +59,10 @@ typedef enum { #define NDevSetDirty(nd) set_ndev_flag(nd, Dirty) #define NDevClearDirty(nd) clear_ndev_flag(nd, Dirty) +#define NDevBlock(nd) test_ndev_flag(nd, Block) +#define NDevSetBlock(nd) set_ndev_flag(nd, Block) +#define NDevClearBlock(nd) clear_ndev_flag(nd, Block) + /** * struct ntfs_device - * diff --git a/libntfs/device.c b/libntfs/device.c index 968c2076..27bdf5e0 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -671,7 +671,8 @@ int ntfs_device_sector_size_get(struct ntfs_device *dev) int sect_size = 0; if (!dev->d_ops->ioctl(dev, BLKSSZGET, §_size)) { - ntfs_log_debug("BLKSSZGET sector size = %d bytes\n", sect_size); + ntfs_log_debug("BLKSSZGET sector size = %d bytes\n", + sect_size); return sect_size; } } @@ -705,13 +706,15 @@ int ntfs_device_block_size_set(struct ntfs_device *dev, int block_size) size_t s_block_size = block_size; if (!dev->d_ops->ioctl(dev, BLKBSZSET, &s_block_size)) { ntfs_log_debug("Used BLKBSZSET to set block size to " - "%d bytes\n", block_size); + "%d bytes.\n", block_size); return 0; } + /* If not a block device, pretend it was successful. */ + if (!NDevBlock(dev)) + return 0; } #else errno = EOPNOTSUPP; #endif return -1; } - diff --git a/libntfs/unix_io.c b/libntfs/unix_io.c index 6ff72e2b..5cfbeee0 100644 --- a/libntfs/unix_io.c +++ b/libntfs/unix_io.c @@ -79,6 +79,7 @@ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags) { struct flock flk; + struct stat sbuf; int err; if (NDevOpen(dev)) { @@ -116,6 +117,9 @@ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags) "close %s", dev->d_name); goto err_out; } + /* Determine if device is a block device or not, ignoring errors. */ + if (!fstat(DEV_FD(dev), &sbuf) && S_ISBLK(sbuf.st_mode)) + NDevSetBlock(dev); /* Set our open flag. */ NDevSetOpen(dev); return 0; @@ -317,4 +321,3 @@ struct ntfs_device_operations ntfs_device_unix_io_ops = { .stat = ntfs_device_unix_io_stat, .ioctl = ntfs_device_unix_io_ioctl, }; - diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index ce8d08ae..7a5afd05 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3745,8 +3745,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol) * "inode size" can be specified on other Linux/Unix file systems. */ vol->mft_record_size = 1024; - if (vol->mft_record_size < vol->sector_size) - vol->mft_record_size = vol->sector_size; + if (vol->mft_record_size < opts.sector_size) + vol->mft_record_size = opts.sector_size; if (vol->mft_record_size > (unsigned long)page_size) ntfs_log_warning("Mft record size (%u bytes) exceeds system " "page size (%li bytes). You will not be able " @@ -3763,8 +3763,8 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol) * FIXME: Should we make the index record size to be user specifiable? */ vol->indx_record_size = 4096; - if (vol->indx_record_size < vol->sector_size) - vol->indx_record_size = vol->sector_size; + if (vol->indx_record_size < opts.sector_size) + vol->indx_record_size = opts.sector_size; if (vol->indx_record_size > (unsigned long)page_size) ntfs_log_warning("Index record size (%u bytes) exceeds system " "page size (%li bytes). You will not be able " @@ -3893,7 +3893,8 @@ static BOOL mkntfs_initialize_rl_mft(void) g_mft_zone_end = g_mft_zone_end >> 3; /* 12.5% */ break; } - ntfs_log_debug("MFT zone size = %lldkiB\n", g_mft_zone_end / 1024); + ntfs_log_debug("MFT zone size = %lldkiB\n", g_mft_zone_end << + g_vol->cluster_size_bits >> 10 /* >> 10 == / 1024 */); /* * The mft zone begins with the mft data attribute, not at the beginning * of the device. From 3dc68c060214b999da66b4caffc6a0fd405f695e Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 3 Feb 2006 23:25:24 +0000 Subject: [PATCH 2848/2994] Fix a warning. --- ntfsprogs/mkntfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 7a5afd05..8153b7f0 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3745,7 +3745,7 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol) * "inode size" can be specified on other Linux/Unix file systems. */ vol->mft_record_size = 1024; - if (vol->mft_record_size < opts.sector_size) + if (vol->mft_record_size < (u32)opts.sector_size) vol->mft_record_size = opts.sector_size; if (vol->mft_record_size > (unsigned long)page_size) ntfs_log_warning("Mft record size (%u bytes) exceeds system " @@ -3763,7 +3763,7 @@ static BOOL mkntfs_override_vol_params(ntfs_volume *vol) * FIXME: Should we make the index record size to be user specifiable? */ vol->indx_record_size = 4096; - if (vol->indx_record_size < opts.sector_size) + if (vol->indx_record_size < (u32)opts.sector_size) vol->indx_record_size = opts.sector_size; if (vol->indx_record_size > (unsigned long)page_size) ntfs_log_warning("Index record size (%u bytes) exceeds system " From 4d64cb21e7cd5b300dbd33f6dc4091ce9494c73e Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 3 Feb 2006 23:40:39 +0000 Subject: [PATCH 2849/2994] Fixes for OSX. --- configure.ac | 20 +++++++++---------- libntfs/device.c | 3 ++- ntfsprogs/mkntfs.c | 49 ++++++++++++++++++++++++---------------------- 3 files changed, 38 insertions(+), 34 deletions(-) diff --git a/configure.ac b/configure.ac index 269655aa..081b13dc 100644 --- a/configure.ac +++ b/configure.ac @@ -326,13 +326,13 @@ AC_SUBST(AUTODIRS) # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([ctype.h fcntl.h libintl.h limits.h locale.h mntent.h \ - stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h strings.h \ - errno.h time.h unistd.h utime.h wchar.h getopt.h features.h endian.h \ - byteswap.h sys/byteorder.h sys/endian.h sys/param.h sys/ioctl.h \ - sys/mount.h sys/stat.h sys/types.h sys/vfs.h sys/statvfs.h sys/sysmacros.h \ - linux/major.h linux/fd.h linux/hdreg.h machine/endian.h gcrypt.h \ - windows.h gnutls/pkcs12.h]) +AC_CHECK_HEADERS([ctype.h fcntl.h libgen.h libintl.h limits.h locale.h \ + mntent.h stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h \ + strings.h errno.h time.h unistd.h utime.h wchar.h getopt.h features.h \ + endian.h byteswap.h sys/byteorder.h sys/endian.h sys/param.h \ + sys/ioctl.h sys/mount.h sys/stat.h sys/types.h sys/vfs.h \ + sys/statvfs.h sys/sysmacros.h linux/major.h linux/fd.h linux/hdreg.h \ + machine/endian.h gcrypt.h windows.h gnutls/pkcs12.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL @@ -356,9 +356,9 @@ AC_FUNC_STAT AC_FUNC_STRFTIME AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF -AC_CHECK_FUNCS([atexit dup2 fdatasync getopt_long hasmntopt mbsinit memmove \ - memset realpath regcomp setlocale setxattr strcasecmp strchr strdup \ - strerror strnlen strtol strtoul sysconf utime]) +AC_CHECK_FUNCS([atexit basename dup2 fdatasync getopt_long hasmntopt mbsinit \ + memmove memset realpath regcomp setlocale setxattr strcasecmp strchr \ + strdup strerror strnlen strtol strtoul sysconf utime]) # Makefiles to be created by configure. AC_CONFIG_FILES([ diff --git a/libntfs/device.c b/libntfs/device.c index 27bdf5e0..7203d71a 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -695,7 +695,8 @@ int ntfs_device_sector_size_get(struct ntfs_device *dev) * EOPNOTSUPP System does not support HDIO_GETGEO ioctl * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO */ -int ntfs_device_block_size_set(struct ntfs_device *dev, int block_size) +int ntfs_device_block_size_set(struct ntfs_device *dev, + int block_size __attribute__((unused))) { if (!dev) { errno = EINVAL; diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 8153b7f0..a749dbcb 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -78,6 +78,9 @@ #ifdef HAVE_LIMITS_H #include #endif +#ifdef HAVE_LIBGEN_H +#include +#endif #ifdef HAVE_GETOPT_H #include @@ -153,37 +156,37 @@ switch if you want to be able to build the NTFS utilities." /* Page size on ia32. Can change to 8192 on Alpha. */ #define NTFS_PAGE_SIZE 4096 -const char *EXEC_NAME = "mkntfs"; +static char *EXEC_NAME = "mkntfs"; /** * global variables */ -u8 *g_buf = NULL; -int g_mft_bitmap_byte_size = 0; -u8 *g_mft_bitmap = NULL; -int g_lcn_bitmap_byte_size = 0; -u8 *g_lcn_bitmap = NULL; -runlist *g_rl_mft = NULL; -runlist *g_rl_mft_bmp = NULL; -runlist *g_rl_mftmirr = NULL; -runlist *g_rl_logfile = NULL; -runlist *g_rl_boot = NULL; -runlist *g_rl_bad = NULL; -INDEX_ALLOCATION *g_index_block = NULL; -ntfs_volume *g_vol = NULL; -int g_mft_size = 0; -long long g_mft_lcn = 0; /* lcn of $MFT, $DATA attribute */ -long long g_mftmirr_lcn = 0; /* lcn of $MFTMirr, $DATA */ -long long g_logfile_lcn = 0; /* lcn of $LogFile, $DATA */ -int g_logfile_size = 0; /* in bytes, determined from volume_size */ -long long g_mft_zone_end = 0; /* Determined from volume_size and mft_zone_multiplier, in clusters */ -long long g_num_bad_blocks = 0; /* Number of bad clusters */ -long long *g_bad_blocks = NULL; /* Array of bad clusters */ +static u8 *g_buf = NULL; +static int g_mft_bitmap_byte_size = 0; +static u8 *g_mft_bitmap = NULL; +static int g_lcn_bitmap_byte_size = 0; +static u8 *g_lcn_bitmap = NULL; +static runlist *g_rl_mft = NULL; +static runlist *g_rl_mft_bmp = NULL; +static runlist *g_rl_mftmirr = NULL; +static runlist *g_rl_logfile = NULL; +static runlist *g_rl_boot = NULL; +static runlist *g_rl_bad = NULL; +static INDEX_ALLOCATION *g_index_block = NULL; +static ntfs_volume *g_vol = NULL; +static int g_mft_size = 0; +static long long g_mft_lcn = 0; /* lcn of $MFT, $DATA attribute */ +static long long g_mftmirr_lcn = 0; /* lcn of $MFTMirr, $DATA */ +static long long g_logfile_lcn = 0; /* lcn of $LogFile, $DATA */ +static int g_logfile_size = 0; /* in bytes, determined from volume_size */ +static long long g_mft_zone_end = 0; /* Determined from volume_size and mft_zone_multiplier, in clusters */ +static long long g_num_bad_blocks = 0; /* Number of bad clusters */ +static long long *g_bad_blocks = NULL; /* Array of bad clusters */ /** * struct mkntfs_options */ -struct mkntfs_options { +static struct mkntfs_options { char *dev_name; /* Name of the device, or file, to use */ BOOL enable_compression; /* -C, enables compression of all files on the volume by default. */ BOOL quick_format; /* -f or -Q, fast format, don't zero the volume first. */ From 584ca613efd17f983c74fcc0724634f87d44d4ee Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 3 Feb 2006 23:52:55 +0000 Subject: [PATCH 2850/2994] Fix a Linux warning after a fix for OSX. --- ntfsprogs/mkntfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index a749dbcb..81227635 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -156,7 +156,7 @@ switch if you want to be able to build the NTFS utilities." /* Page size on ia32. Can change to 8192 on Alpha. */ #define NTFS_PAGE_SIZE 4096 -static char *EXEC_NAME = "mkntfs"; +static char EXEC_NAME[] = "mkntfs"; /** * global variables From 3420b5faec6c761e78a003779f07764d43845fd2 Mon Sep 17 00:00:00 2001 From: antona Date: Fri, 3 Feb 2006 23:55:40 +0000 Subject: [PATCH 2851/2994] Another fix for OSX. --- libntfs/device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libntfs/device.c b/libntfs/device.c index 7203d71a..f52080f1 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -715,6 +715,9 @@ int ntfs_device_block_size_set(struct ntfs_device *dev, return 0; } #else + /* If not a block device, pretend it was successful. */ + if (!NDevBlock(dev)) + return 0; errno = EOPNOTSUPP; #endif return -1; From e5a3006f4701dfd310b6e96cc67aeb9a8ee030f3 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 4 Feb 2006 02:42:42 +0000 Subject: [PATCH 2852/2994] Only use O_EXCL if mounting r/w. --- include/ntfs/layout.h | 2 +- libntfs/unix_io.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/ntfs/layout.h b/include/ntfs/layout.h index f9f3ea7c..d2fa1a41 100644 --- a/include/ntfs/layout.h +++ b/include/ntfs/layout.h @@ -524,7 +524,7 @@ typedef enum { * unistr.c::ntfs_collate_names() and unistr.c::legal_ansi_char_array[] * for what I mean but COLLATION_UNICODE_STRING would not give any special * treatment to any characters at all, but this is speculation. - * COLLATION_NTOFS_ULONG - Sorting is done according to ascending u32 key + * COLLATION_NTOFS_ULONG - Sorting is done according to ascending u32 key * values. E.g. used for $SII index in FILE_Secure, which sorts by * security_id (u32). * COLLATION_NTOFS_SID - Sorting is done according to ascending SID values. diff --git a/libntfs/unix_io.c b/libntfs/unix_io.c index 5cfbeee0..ee8d35db 100644 --- a/libntfs/unix_io.c +++ b/libntfs/unix_io.c @@ -90,9 +90,11 @@ static int ntfs_device_unix_io_open(struct ntfs_device *dev, int flags) return -1; /* * Open the device/file obtaining the file descriptor for exclusive - * access. + * access (but only if mounting r/w). */ - *(int*)dev->d_private = open(dev->d_name, flags | O_EXCL); + if ((flags & O_RDWR) == O_RDWR) + flags |= O_EXCL; + *(int*)dev->d_private = open(dev->d_name, flags); if (*(int*)dev->d_private == -1) { err = errno; goto err_out; From 952d221711095bc6803b5cefb49a3893f71d787b Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 4 Feb 2006 05:42:59 +0000 Subject: [PATCH 2853/2994] Tons of bug fixes to mkntfs. --- ChangeLog | 5 +- ntfsprogs/mkntfs.c | 437 +++++++++++++++++++++------------------------ ntfsprogs/sd.c | 380 ++++++++++++++++++++------------------- 3 files changed, 396 insertions(+), 426 deletions(-) diff --git a/ChangeLog b/ChangeLog index a81e35f1..7b36bd61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -101,8 +101,8 @@ which caused bits to not be cleared or set if the first bit in the run was not a multiple of eight. (Anton) - Change volume mounting (actually device opening) to happen with - O_EXCL bit set so at least on Linux no one can change the device - block size under our feet. (Anton) + O_EXCL bit set, but only for r/w opening so at least on Linux no one + can change the device block size under our feet. (Anton) - Change volume mounting and mkntfs to set the device block size to the sector size using BLKBSZSET ioctl (Linux only). This should be optimal for performance and should fixes the bug of not being able to @@ -114,6 +114,7 @@ mountable by the kernel driver (it requires mft record size and index record size to be below or equal to the system page size which we determine using sysconf()). (Anton) + - Fix tons of bugs in mkntfs. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index 81227635..ac811847 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -791,6 +791,9 @@ static void dump_resident_attr_val(ATTR_TYPES type, char *val, u32 val_len) return; case AT_INDEX_ROOT: /* TODO */ + printf("collation_rule %u\n", le32_to_cpu(((INDEX_ROOT*)val)->collation_rule)); + printf("index.entries_offset %u\n", le32_to_cpu(((INDEX_ROOT*)val)->index.entries_offset)); + printf("index.index_length %u\n", le32_to_cpu(((INDEX_ROOT*)val)->index.index_length)); printf("%s\n", todo); return; case AT_INDEX_ALLOCATION: @@ -909,7 +912,7 @@ static void dump_attr_record(ATTR_RECORD *a) printf("-- Beginning dump of attribute record. --\n"); if (a->type == AT_END) { printf("Attribute type = 0x%x ($END)\n", - (unsigned int)le32_to_cpu(AT_END)); + (unsigned int)const_le32_to_cpu(AT_END)); u = le32_to_cpu(a->length); printf("Length of resident part = %u (0x%x)\n", u, u); return; @@ -1959,8 +1962,8 @@ static int insert_resident_attr_in_mft_record(MFT_RECORD *m, a->length = cpu_to_le32(asize); a->non_resident = 0; a->name_length = name_len; - a->name_offset = cpu_to_le16(24); - a->flags = cpu_to_le16(flags); + a->name_offset = const_cpu_to_le16(24); + a->flags = flags; a->instance = m->next_attr_instance; m->next_attr_instance = cpu_to_le16((le16_to_cpu(m->next_attr_instance) + 1) & 0xffff); @@ -2305,24 +2308,24 @@ static int add_attr_index_root(MFT_RECORD *m, const char *name, opts.sector_size; } memset(&r->reserved, 0, sizeof(r->reserved)); - r->index.entries_offset = cpu_to_le32(sizeof(INDEX_HEADER)); - r->index.index_length = cpu_to_le32(sizeof(INDEX_HEADER) + + r->index.entries_offset = const_cpu_to_le32(sizeof(INDEX_HEADER)); + r->index.index_length = const_cpu_to_le32(sizeof(INDEX_HEADER) + sizeof(INDEX_ENTRY_HEADER)); r->index.allocated_size = r->index.index_length; r->index.flags = SMALL_INDEX; memset(&r->index.reserved, 0, sizeof(r->index.reserved)); - e = (INDEX_ENTRY_HEADER*)((char*)&r->index + + e = (INDEX_ENTRY_HEADER*)((u8*)&r->index + le32_to_cpu(r->index.entries_offset)); /* * No matter whether this is a file index or a view as this is a * termination entry, hence no key value / data is associated with it * at all. Thus, we just need the union to be all zero. */ - e->indexed_file = cpu_to_le64(0LL); - e->length = cpu_to_le16(sizeof(INDEX_ENTRY_HEADER)); - e->key_length = cpu_to_le16(0); + e->indexed_file = const_cpu_to_le64(0LL); + e->length = const_cpu_to_le16(sizeof(INDEX_ENTRY_HEADER)); + e->key_length = const_cpu_to_le16(0); e->flags = INDEX_ENTRY_END; - e->reserved = cpu_to_le16(0); + e->reserved = const_cpu_to_le16(0); err = insert_resident_attr_in_mft_record(m, AT_INDEX_ROOT, name, name_len, ic, 0, 0, (u8*)r, val_len); free(r); @@ -2620,80 +2623,72 @@ static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *idx, * not all types of COLLATION_RULES supported yet... * added as needed.. (remove this comment when all are added) */ -static int ntfs_index_keys_compare(char *key1, char *key2, - int key1_length,int key2_length, - COLLATION_RULES collation_rule) +static int ntfs_index_keys_compare(u8 *key1, u8 *key2, int key1_length, + int key2_length, COLLATION_RULES collation_rule) { - int i = 0; - int j = 0; + u32 u1, u2; + int i; if (collation_rule == COLLATION_NTOFS_ULONG) { /* i.e. $SII or $QUOTA-$Q */ - while ((j < min(key1_length, key2_length)) && (i == 0)) { - if (*(u32*)(key1 + j) < *(u32*)(key2 + j)) - i = -1; - if (*(u32*)(key1 + j) > *(u32*)(key2 + j)) - i = +1; - if (*(u32*)(key1 + j) == *(u32*)(key2 + j)) { - i = 0; - j += 4; - } - } - if ((i == 0) && (key1_length > key2_length)) - i = -1; - if ((i == 0) && (key1_length < key2_length)) - i = +1; - - return i; + u1 = le32_to_cpup(key1); + u2 = le32_to_cpup(key2); + if (u1 < u2) + return -1; + if (u1 > u2) + return 1; + /* u1 == u2 */ + return 0; } - if (collation_rule == COLLATION_NTOFS_ULONGS) { /* i.e $OBJID-$O */ - while ((j < min(key1_length, key2_length)) && (i == 0)) { - if (bswap_32(*(u32*)(key1 + j)) < bswap_32(*(u32*)(key1 + j))) - i = -1; - if (bswap_32(*(u32*)(key1 + j)) > bswap_32(*(u32*)(key1 + j))) - i = +1; - if (bswap_32(*(u32*)(key1 + j)) == bswap_32(*(u32*)(key1 + j))) { - i = 0; - j += 4; - } + i = 0; + while (i < min(key1_length, key2_length)) { + u1 = le32_to_cpup(key1 + i); + u2 = le32_to_cpup(key2 + i); + if (u1 < u2) + return -1; + if (u1 > u2) + return 1; + /* u1 == u2 */ + i += sizeof(u32); } - if ((i == 0) && (key1_length > key2_length)) - i = -1; - if ((i == 0) && (key1_length < key2_length)) - i = +1; - - return i; + if (key1_length < key2_length) + return -1; + if (key1_length > key2_length) + return 1; + return 0; } if (collation_rule == COLLATION_NTOFS_SECURITY_HASH) { /* i.e. $SDH */ - if (((SDH_INDEX_KEY*)key1)->hash < ((SDH_INDEX_KEY*)key2)->hash) - i = -1; - if (((SDH_INDEX_KEY*)key1)->hash > ((SDH_INDEX_KEY*)key2)->hash) - i = +1; - if (((SDH_INDEX_KEY*)key1)->hash == ((SDH_INDEX_KEY*)key2)->hash) { - if (((SDH_INDEX_KEY*)key1)->security_id < ((SDH_INDEX_KEY*)key2)->security_id) - i = -1; - if (((SDH_INDEX_KEY*)key1)->security_id > ((SDH_INDEX_KEY*)key2)->security_id) - i = +1; - if (((SDH_INDEX_KEY*)key1)->security_id == ((SDH_INDEX_KEY*)key2)->security_id) - i = 0; - } - return i; + u1 = le32_to_cpu(((SDH_INDEX_KEY*)key1)->hash); + u2 = le32_to_cpu(((SDH_INDEX_KEY*)key2)->hash); + if (u1 < u2) + return -1; + if (u1 > u2) + return 1; + /* u1 == u2 */ + u1 = le32_to_cpu(((SDH_INDEX_KEY*)key1)->security_id); + u2 = le32_to_cpu(((SDH_INDEX_KEY*)key2)->security_id); + if (u1 < u2) + return -1; + if (u1 > u2) + return 1; + return 0; } if (collation_rule == COLLATION_NTOFS_SID) { /* i.e. $QUOTA-O */ i = memcmp(key1, key2, min(key1_length, key2_length)); - if ((i == 0) && (key1_length > key2_length)) - i = -1; - if ((i == 0) && (key1_length < key2_length)) - i = +1; - + if (!i) { + if (key1_length < key2_length) + return -1; + if (key1_length > key2_length) + return 1; + } return i; } ntfs_log_critical("ntfs_index_keys_compare called without supported " - "collation rule.\n"); + "collation rule.\n"); return 0; /* Claim they're equal. What else can we do? */ } @@ -2703,9 +2698,8 @@ static int ntfs_index_keys_compare(char *key1, char *key2, * i.e. insert an index_entry in some named index_root * simplified search method, works for mkntfs */ -static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, - u32 idx_size, MFT_RECORD *m, ntfschar *name, u32 name_size, - ATTR_TYPES type) +static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, u32 idx_size, + MFT_RECORD *m, ntfschar *name, u32 name_size, ATTR_TYPES type) { ntfs_attr_search_ctx *ctx; INDEX_HEADER *idx_header; @@ -2716,43 +2710,42 @@ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, err = 0; /* does it fit ?*/ - if (g_vol->mft_record_size > idx_size + m->bytes_allocated) + if (g_vol->mft_record_size > idx_size + le32_to_cpu(m->bytes_allocated)) return -ENOSPC; - /* find the INDEX_ROOT attribute:*/ ctx = ntfs_attr_get_search_ctx(NULL, m); - if (!ctx) { - ntfs_log_error("Failed to allocate attribute search context.\n"); + if (!ctx) { + ntfs_log_error("Failed to allocate attribute search " + "context.\n"); err = -ENOMEM; goto err_out; } - if (mkntfs_attr_lookup(AT_INDEX_ROOT, name, name_size, 0, 0, - NULL, 0, ctx)) { - err = EEXIST; + if (mkntfs_attr_lookup(AT_INDEX_ROOT, name, name_size, 0, 0, NULL, 0, + ctx)) { + err = -EEXIST; goto err_out; } /* found attribute */ a = (ATTR_RECORD*)ctx->attr; - collation_rule = ((INDEX_ROOT*)((char*)a + - le16_to_cpu(a->value_offset)))->collation_rule; - idx_header = (INDEX_HEADER*)((char*)a + le16_to_cpu(a->value_offset) - + le16_to_cpu(0x10)); - idx_entry = (INDEX_ENTRY*)((char*)idx_header + - le16_to_cpu((idx_header)->entries_offset)); - idx_end = (INDEX_ENTRY*)((char*)idx_entry + - le32_to_cpu(idx_header->index_length)); + collation_rule = ((INDEX_ROOT*)((u8*)a + + le16_to_cpu(a->value_offset)))->collation_rule; + idx_header = (INDEX_HEADER*)((u8*)a + le16_to_cpu(a->value_offset) + + 0x10); + idx_entry = (INDEX_ENTRY*)((u8*)idx_header + + le32_to_cpu(idx_header->entries_offset)); + idx_end = (INDEX_ENTRY*)((u8*)idx_entry + + le32_to_cpu(idx_header->index_length)); /* * Loop until we exceed valid memory (corruption case) or until we * reach the last entry. */ - if (type == AT_FILE_NAME) { - while ((char*)idx_entry < (char*)idx_end && - !(idx_entry->flags & INDEX_ENTRY_END)) { - i = ntfs_file_values_compare( - (FILE_NAME_ATTR*)&idx->key.file_name, - (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, - IGNORE_CASE, g_vol->upcase, g_vol->upcase_len); + while (((u8*)idx_entry < (u8*)idx_end) && + !(idx_entry->flags & INDEX_ENTRY_END)) { + i = ntfs_file_values_compare(&idx->key.file_name, + &idx_entry->key.file_name, 1, + IGNORE_CASE, g_vol->upcase, + g_vol->upcase_len); /* * If @file_name collates before ie->key.file_name, * there is no matching index entry. @@ -2762,55 +2755,53 @@ static int insert_index_entry_in_res_dir_index(INDEX_ENTRY *idx, /* If file names are not equal, continue search. */ if (i) goto do_next; - if (((FILE_NAME_ATTR*)&idx->key.file_name)-> - file_name_type != FILE_NAME_POSIX || - idx_entry->key.file_name.file_name_type - != FILE_NAME_POSIX) - return -EEXIST; - - i = ntfs_file_values_compare((FILE_NAME_ATTR*)&idx-> - key.file_name, - (FILE_NAME_ATTR*)&idx_entry->key.file_name, 1, - CASE_SENSITIVE, g_vol->upcase, g_vol->upcase_len); + if (idx->key.file_name.file_name_type != + FILE_NAME_POSIX || + idx_entry->key.file_name.file_name_type + != FILE_NAME_POSIX) + return -EEXIST; + i = ntfs_file_values_compare(&idx->key.file_name, + &idx_entry->key.file_name, 1, + CASE_SENSITIVE, g_vol->upcase, + g_vol->upcase_len); + if (!i) + return -EEXIST; if (i == -1) break; - /* Complete match. Bugger. Can't insert. */ -#if 0 - if (!i) - return -EEXIST; -#endif do_next: - idx_entry = (INDEX_ENTRY*)((char*)idx_entry + - le16_to_cpu(idx_entry->length)); + idx_entry = (INDEX_ENTRY*)((u8*)idx_entry + + le16_to_cpu(idx_entry->length)); } } else if (type == AT_UNUSED) { /* case view */ - while ((char*)idx_entry < (char*)idx_end && !(idx_entry->flags - & INDEX_ENTRY_END)) { - i = ntfs_index_keys_compare((char*)idx_entry + 0x10, - (char*)idx + 0x10, - idx_entry->key_length, idx->key_length, collation_rule); + while (((u8*)idx_entry < (u8*)idx_end) && + !(idx_entry->flags & INDEX_ENTRY_END)) { + i = ntfs_index_keys_compare((u8*)idx + 0x10, + (u8*)idx_entry + 0x10, + le16_to_cpu(idx->key_length), + le16_to_cpu(idx_entry->key_length), + collation_rule); if (!i) return -EEXIST; - if (i == 1) + if (i == -1) break; - idx_entry = (INDEX_ENTRY*)((char*)idx_entry + - le16_to_cpu(idx_entry->length)); + idx_entry = (INDEX_ENTRY*)((u8*)idx_entry + + le16_to_cpu(idx_entry->length)); } } else { - return EINVAL; + return -EINVAL; } - - memmove((char*)idx_entry + idx_size, (char*)idx_entry, - (char*)m + g_vol->mft_record_size - - ((char*)idx_entry + idx_size)); - memcpy((char*)idx_entry, (char*)idx, idx_size); - /* adjusting various offsets etc... */ - m->bytes_in_use += idx_size; - a->length += idx_size; - a->value_length += idx_size; - ((INDEX_HEADER*)idx_header)->index_length += idx_size; - ((INDEX_HEADER*)idx_header)->allocated_size += idx_size; - + memmove((u8*)idx_entry + idx_size, (u8*)idx_entry, + le32_to_cpu(m->bytes_in_use) - + ((u8*)idx_entry - (u8*)m)); + memcpy((u8*)idx_entry, (u8*)idx, idx_size); + /* Adjust various offsets, etc... */ + m->bytes_in_use = cpu_to_le32(le32_to_cpu(m->bytes_in_use) + idx_size); + a->length = cpu_to_le32(le32_to_cpu(a->length) + idx_size); + a->value_length = cpu_to_le32(le32_to_cpu(a->value_length) + idx_size); + idx_header->index_length = cpu_to_le32( + le32_to_cpu(idx_header->index_length) + idx_size); + idx_header->allocated_size = cpu_to_le32( + le32_to_cpu(idx_header->allocated_size) + idx_size); err_out: if (ctx) ntfs_attr_put_search_ctx(ctx); @@ -2849,55 +2840,49 @@ static int initialize_secure(char *sds, u32 sds_size, MFT_RECORD *m) if (!sds_header->length) break; /* SDH index entry */ - idx_entry_sdh->data_offset = cpu_to_le16(0x18); - idx_entry_sdh->data_length = cpu_to_le16(0x14); - idx_entry_sdh->reservedV = cpu_to_le32(0x00); - idx_entry_sdh->length = cpu_to_le16(0x30); - idx_entry_sdh->key_length = cpu_to_le16(0x08); - idx_entry_sdh->flags = cpu_to_le16(0x00); - idx_entry_sdh->reserved = cpu_to_le16(0x00); + idx_entry_sdh->data_offset = const_cpu_to_le16(0x18); + idx_entry_sdh->data_length = const_cpu_to_le16(0x14); + idx_entry_sdh->reservedV = const_cpu_to_le32(0x00); + idx_entry_sdh->length = const_cpu_to_le16(0x30); + idx_entry_sdh->key_length = const_cpu_to_le16(0x08); + idx_entry_sdh->flags = const_cpu_to_le16(0x00); + idx_entry_sdh->reserved = const_cpu_to_le16(0x00); idx_entry_sdh->key.sdh.hash = sds_header->hash; idx_entry_sdh->key.sdh.security_id = sds_header->security_id; - sdh_data = (SDH_INDEX_DATA*)((char*)idx_entry_sdh + - idx_entry_sdh->data_offset); + sdh_data = (SDH_INDEX_DATA*)((u8*)idx_entry_sdh + + le16_to_cpu(idx_entry_sdh->data_offset)); sdh_data->hash = sds_header->hash; sdh_data->security_id = sds_header->security_id; - sdh_data->offset = sds_header->offset; - sdh_data->length = sds_header->length; - sdh_data->reserved_II = cpu_to_le32(0x00490049); + sdh_data->reserved_II = const_cpu_to_le32(0x00490049); /* SII index entry */ - idx_entry_sii->data_offset = cpu_to_le16(0x14); - idx_entry_sii->data_length = cpu_to_le16(0x14); - idx_entry_sii->reservedV = cpu_to_le32(0x00); - idx_entry_sii->length = cpu_to_le16(0x28); - idx_entry_sii->key_length = cpu_to_le16(0x04); - idx_entry_sii->flags = cpu_to_le16(0x00); - idx_entry_sii->reserved = cpu_to_le16(0x00); + idx_entry_sii->data_offset = const_cpu_to_le16(0x14); + idx_entry_sii->data_length = const_cpu_to_le16(0x14); + idx_entry_sii->reservedV = const_cpu_to_le32(0x00); + idx_entry_sii->length = const_cpu_to_le16(0x28); + idx_entry_sii->key_length = const_cpu_to_le16(0x04); + idx_entry_sii->flags = const_cpu_to_le16(0x00); + idx_entry_sii->reserved = const_cpu_to_le16(0x00); idx_entry_sii->key.sii.security_id = sds_header->security_id; - sii_data = (SII_INDEX_DATA*)((char*)idx_entry_sii + - idx_entry_sii->data_offset); + sii_data = (SII_INDEX_DATA*)((u8*)idx_entry_sii + + le16_to_cpu(idx_entry_sii->data_offset)); sii_data->hash = sds_header->hash; sii_data->security_id = sds_header->security_id; sii_data->offset = sds_header->offset; sii_data->length = sds_header->length; if ((err = insert_index_entry_in_res_dir_index(idx_entry_sdh, - sdh_size, m, NTFS_INDEX_SDH, 4, AT_UNUSED))) + sdh_size, m, NTFS_INDEX_SDH, 4, AT_UNUSED))) break; - if ((err = insert_index_entry_in_res_dir_index(idx_entry_sii, - sii_size, m, NTFS_INDEX_SII, 4, AT_UNUSED))) + sii_size, m, NTFS_INDEX_SII, 4, AT_UNUSED))) break; - sds_header = (SECURITY_DESCRIPTOR_HEADER*)((char*)sds_header + - (cpu_to_le32(sds_header->length + 0x0F) & - ~cpu_to_le32(0x0F))); + sds_header = (SECURITY_DESCRIPTOR_HEADER*)((u8*)sds_header + + ((le32_to_cpu(sds_header->length) + 15) & ~15)); } - free(idx_entry_sdh); free(idx_entry_sii); - return err; } @@ -2914,112 +2899,100 @@ static int initialize_quota(MFT_RECORD *m) QUOTA_CONTROL_ENTRY *idx_entry_q1_data, *idx_entry_q2_data; err = 0; - /* q index entry num 1 */ - q1_size = cpu_to_le32(0x48); + q1_size = 0x48; idx_entry_q1 = ntfs_calloc(1, q1_size); if (!idx_entry_q1) return errno; - - idx_entry_q1->data_offset = cpu_to_le16(0x14); - idx_entry_q1->data_length = cpu_to_le16(0x30); - idx_entry_q1->reservedV = cpu_to_le32(0x00); - idx_entry_q1->length = cpu_to_le16(0x48); - idx_entry_q1->key_length = cpu_to_le16(0x04); - idx_entry_q1->flags = cpu_to_le16(0x00); - idx_entry_q1->reserved = cpu_to_le16(0x00); - idx_entry_q1->key.owner_id = cpu_to_le32(0x01); + idx_entry_q1->data_offset = const_cpu_to_le16(0x14); + idx_entry_q1->data_length = const_cpu_to_le16(0x30); + idx_entry_q1->reservedV = const_cpu_to_le32(0x00); + idx_entry_q1->length = const_cpu_to_le16(0x48); + idx_entry_q1->key_length = const_cpu_to_le16(0x04); + idx_entry_q1->flags = const_cpu_to_le16(0x00); + idx_entry_q1->reserved = const_cpu_to_le16(0x00); + idx_entry_q1->key.owner_id = const_cpu_to_le32(0x01); idx_entry_q1_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q1 - + idx_entry_q1->data_offset); - idx_entry_q1_data->version = cpu_to_le32(0x02); + + le16_to_cpu(idx_entry_q1->data_offset)); + idx_entry_q1_data->version = const_cpu_to_le32(0x02); idx_entry_q1_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; if (g_vol->minor_ver == 0) idx_entry_q1_data->flags |= QUOTA_FLAG_OUT_OF_DATE; - idx_entry_q1_data->bytes_used = cpu_to_le64(0x00); + idx_entry_q1_data->bytes_used = const_cpu_to_le64(0x00); idx_entry_q1_data->change_time = utc2ntfs(mkntfs_time()); - idx_entry_q1_data->threshold = cpu_to_sle64(-0x01); - idx_entry_q1_data->limit = cpu_to_sle64(-0x01); - idx_entry_q1_data->exceeded_time = cpu_to_sle64(0x00); - - err = insert_index_entry_in_res_dir_index(idx_entry_q1, - q1_size, m, - NTFS_INDEX_Q, 2, AT_UNUSED); + idx_entry_q1_data->threshold = const_cpu_to_le64((s64)-1); + idx_entry_q1_data->limit = const_cpu_to_le64((s64)-1); + idx_entry_q1_data->exceeded_time = const_cpu_to_le64(0x00); + err = insert_index_entry_in_res_dir_index(idx_entry_q1, q1_size, m, + NTFS_INDEX_Q, 2, AT_UNUSED); free(idx_entry_q1); if (err) return err; - /* q index entry num 2 */ - q2_size = cpu_to_le32(0x58); + q2_size = 0x58; idx_entry_q2 = ntfs_calloc(1, q2_size); if (!idx_entry_q2) return errno; - - idx_entry_q2->data_offset = cpu_to_le16(0x14); - idx_entry_q2->data_length = cpu_to_le16(0x40); - idx_entry_q2->reservedV = cpu_to_le32(0x00); - idx_entry_q2->length = cpu_to_le16(0x58); - idx_entry_q2->key_length = cpu_to_le16(0x04); - idx_entry_q2->flags = cpu_to_le16(0x00); - idx_entry_q2->reserved = cpu_to_le16(0x00); + idx_entry_q2->data_offset = const_cpu_to_le16(0x14); + idx_entry_q2->data_length = const_cpu_to_le16(0x40); + idx_entry_q2->reservedV = const_cpu_to_le32(0x00); + idx_entry_q2->length = const_cpu_to_le16(0x58); + idx_entry_q2->key_length = const_cpu_to_le16(0x04); + idx_entry_q2->flags = const_cpu_to_le16(0x00); + idx_entry_q2->reserved = const_cpu_to_le16(0x00); idx_entry_q2->key.owner_id = QUOTA_FIRST_USER_ID; idx_entry_q2_data = (QUOTA_CONTROL_ENTRY*)((char*)idx_entry_q2 - + idx_entry_q2->data_offset); - idx_entry_q2_data->version = cpu_to_le32(0x02); + + le16_to_cpu(idx_entry_q2->data_offset)); + idx_entry_q2_data->version = const_cpu_to_le32(0x02); idx_entry_q2_data->flags = QUOTA_FLAG_DEFAULT_LIMITS; - idx_entry_q2_data->bytes_used = cpu_to_le64(0x00); + idx_entry_q2_data->bytes_used = const_cpu_to_le64(0x00); idx_entry_q2_data->change_time = utc2ntfs(mkntfs_time());; - idx_entry_q2_data->threshold = cpu_to_sle64(-0x01); - idx_entry_q2_data->limit = cpu_to_sle64(-0x01); - idx_entry_q2_data->exceeded_time = cpu_to_sle64(0x00); + idx_entry_q2_data->threshold = const_cpu_to_le64((s64)-1); + idx_entry_q2_data->limit = const_cpu_to_le64((s64)-1); + idx_entry_q2_data->exceeded_time = const_cpu_to_le64(0x00); idx_entry_q2_data->sid.revision = 1; idx_entry_q2_data->sid.sub_authority_count = 2; idx_entry_q2_data->sid.identifier_authority.high_part = - cpu_to_le16(0x0000); + const_cpu_to_le16(0x0000); idx_entry_q2_data->sid.identifier_authority.low_part = - cpu_to_le32(0x05000000); + const_cpu_to_le32(0x05000000); idx_entry_q2_data->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); idx_entry_q2_data->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); - - err = insert_index_entry_in_res_dir_index(idx_entry_q2, - q2_size, m, - NTFS_INDEX_Q, 2, AT_UNUSED); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + err = insert_index_entry_in_res_dir_index(idx_entry_q2, q2_size, m, + NTFS_INDEX_Q, 2, AT_UNUSED); free(idx_entry_q2); if (err) return err; - - o_size = cpu_to_le32(0x28); + o_size = 0x28; idx_entry_o = ntfs_calloc(1, o_size); if (!idx_entry_o) return errno; - - idx_entry_o->data_offset = cpu_to_le16(0x20); - idx_entry_o->data_length = cpu_to_le16(0x04); - idx_entry_o->reservedV = cpu_to_le32(0x00); - idx_entry_o->length = cpu_to_le16(0x28); - idx_entry_o->key_length = cpu_to_le16(0x10); - idx_entry_o->flags = cpu_to_le16(0x00); - idx_entry_o->reserved = cpu_to_le16(0x00); + idx_entry_o->data_offset = const_cpu_to_le16(0x20); + idx_entry_o->data_length = const_cpu_to_le16(0x04); + idx_entry_o->reservedV = const_cpu_to_le32(0x00); + idx_entry_o->length = const_cpu_to_le16(0x28); + idx_entry_o->key_length = const_cpu_to_le16(0x10); + idx_entry_o->flags = const_cpu_to_le16(0x00); + idx_entry_o->reserved = const_cpu_to_le16(0x00); idx_entry_o->key.sid.revision = 0x01; idx_entry_o->key.sid.sub_authority_count = 0x02; idx_entry_o->key.sid.identifier_authority.high_part = - cpu_to_le16(0x0000); + const_cpu_to_le16(0x0000); idx_entry_o->key.sid.identifier_authority.low_part = - cpu_to_le32(0x05000000); + const_cpu_to_le32(0x05000000); idx_entry_o->key.sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); idx_entry_o->key.sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); idx_entry_o_data = (QUOTA_O_INDEX_DATA*)((char*)idx_entry_o - + idx_entry_o->data_offset); + + le16_to_cpu(idx_entry_o->data_offset)); idx_entry_o_data->owner_id = QUOTA_FIRST_USER_ID; /* 20 00 00 00 padding after here on ntfs 3.1. 3.0 is unchecked. */ - idx_entry_o_data->unknown = cpu_to_le32(32); - - err = insert_index_entry_in_res_dir_index(idx_entry_o, - o_size, m, - NTFS_INDEX_O, 2, AT_UNUSED); + idx_entry_o_data->unknown = const_cpu_to_le32(32); + err = insert_index_entry_in_res_dir_index(idx_entry_o, o_size, m, + NTFS_INDEX_O, 2, AT_UNUSED); free(idx_entry_o); return err; @@ -3238,11 +3211,11 @@ static int create_hardlink_res(MFT_RECORD *m_parent, const MFT_REF ref_parent, if (!idx_entry_new) return -errno; idx_entry_new->indexed_file = ref_file; - idx_entry_new->length = idx_size + 0x10; - idx_entry_new->key_length = fn_size; - memcpy((char*)idx_entry_new+0x10, (char*)fn, fn_size); + idx_entry_new->length = cpu_to_le16(idx_size + 0x10); + idx_entry_new->key_length = cpu_to_le16(fn_size); + memcpy((u8*)idx_entry_new + 0x10, (u8*)fn, fn_size); i = insert_index_entry_in_res_dir_index(idx_entry_new, idx_size + 0x10, - m_parent, NTFS_INDEX_I30, 4, AT_FILE_NAME); + m_parent, NTFS_INDEX_I30, 4, AT_FILE_NAME); if (i < 0) { ntfs_log_error("create_hardlink failed inserting index entry: %s\n", strerror(-i)); @@ -4754,7 +4727,6 @@ static BOOL mkntfs_create_root_structures(void) /* dump_mft_record(m); */ /* create $Quota (1.2) or $Secure (3.0+) */ - if (g_vol->major_ver < 3) { ntfs_log_verbose("Creating $Quota (mft record 9)\n"); m = (MFT_RECORD*)(g_buf + 9 * g_vol->mft_record_size); @@ -4799,22 +4771,22 @@ static BOOL mkntfs_create_root_structures(void) return FALSE; init_secure_31(buf_sds_init); } - buf_sds = ntfs_calloc(1,buf_sds_size); + buf_sds = ntfs_calloc(1, buf_sds_size); if (!buf_sds) { free(buf_sds_init); return FALSE; } memcpy(buf_sds, buf_sds_init, buf_sds_first_size); memcpy(buf_sds + 0x40000, buf_sds_init, - buf_sds_first_size); + buf_sds_first_size); err = add_attr_data(m, "$SDS", 4, 0, 0, (u8*)buf_sds, - buf_sds_size); + buf_sds_size); free(buf_sds); } /* FIXME: This should be IGNORE_CASE */ if (!err) err = add_attr_index_root(m, "$SDH", 4, 0, AT_UNUSED, - COLLATION_NTOFS_SECURITY_HASH , + COLLATION_NTOFS_SECURITY_HASH, g_vol->indx_record_size); /* FIXME: This should be IGNORE_CASE */ if (!err) @@ -4981,7 +4953,6 @@ static BOOL mkntfs_create_root_structures(void) return TRUE; } - /** * mkntfs_redirect */ diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c index 0407b9dc..0e4ce809 100644 --- a/ntfsprogs/sd.c +++ b/ntfsprogs/sd.c @@ -48,15 +48,15 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; if (sys_file_no == FILE_root) { *sd_val_len = 0x50; - sd->owner = cpu_to_le32(0x30); - sd->group = cpu_to_le32(0x40); + sd->owner = const_cpu_to_le32(0x30); + sd->group = const_cpu_to_le32(0x40); } else { *sd_val_len = 0x68; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); + sd->owner = const_cpu_to_le32(0x48); + sd->group = const_cpu_to_le32(0x58); } - sd->sacl = cpu_to_le32(0); - sd->dacl = cpu_to_le32(0x14); + sd->sacl = const_cpu_to_le32(0); + sd->dacl = const_cpu_to_le32(0x14); /* * Now at offset 0x14, as specified in the security descriptor, we have * the DACL. @@ -65,13 +65,13 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) acl->revision = 2; acl->alignment1 = 0; if (sys_file_no == FILE_root) { - acl->size = cpu_to_le16(0x1c); - acl->ace_count = cpu_to_le16(1); + acl->size = const_cpu_to_le16(0x1c); + acl->ace_count = const_cpu_to_le16(1); } else { - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(2); + acl->size = const_cpu_to_le16(0x34); + acl->ace_count = const_cpu_to_le16(2); } - acl->alignment2 = cpu_to_le16(0); + acl->alignment2 = const_cpu_to_le16(0); /* * Now at offset 0x1c, just after the DACL's ACL, we have the first * ACE of the DACL. The type of the ACE is access allowed. @@ -82,7 +82,7 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) aa_ace->flags = CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE; else aa_ace->flags = 0; - aa_ace->size = cpu_to_le16(0x14); + aa_ace->size = const_cpu_to_le16(0x14); switch (sys_file_no) { case FILE_MFT: case FILE_MFTMirr: case FILE_LogFile: case FILE_AttrDef: case FILE_Bitmap: case FILE_Boot: @@ -115,13 +115,13 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) /* SECURITY_WORLD_SID_AUTHORITY (S-1-1) */ aa_ace->sid.identifier_authority.value[5] = 1; aa_ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_WORLD_RID); + const_cpu_to_le32(SECURITY_WORLD_RID); /* This is S-1-1-0, the WORLD_SID. */ } else { /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ aa_ace->sid.identifier_authority.value[5] = 5; aa_ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); } /* * Now at offset 0x30 within security descriptor, just after the first @@ -134,7 +134,7 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) le16_to_cpu(aa_ace->size)); aa_ace->type = ACCESS_ALLOWED_ACE_TYPE; aa_ace->flags = 0; - aa_ace->size = cpu_to_le16(0x18); + aa_ace->size = const_cpu_to_le16(0x18); switch (sys_file_no) { case FILE_MFT: case FILE_MFTMirr: case FILE_LogFile: case FILE_AttrDef: @@ -163,9 +163,9 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) aa_ace->sid.identifier_authority.value[4] = 0; aa_ace->sid.identifier_authority.value[5] = 5; aa_ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); aa_ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); /* Now at offset 0x48 into the security descriptor. */ } /* As specified in the security descriptor, we now have the owner SID.*/ @@ -179,8 +179,8 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) sid->identifier_authority.value[3] = 0; sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + sid->sub_authority[0] = const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); /* * Now at offset 0x40 or 0x58 (root directory and the other system * files, respectively) into the security descriptor, as specified in @@ -196,18 +196,18 @@ void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len) sid->identifier_authority.value[3] = 0; sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; - sid->sub_authority[0] = cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); - sid->sub_authority[1] = cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + sid->sub_authority[0] = const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + sid->sub_authority[1] = const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); } /** * init_root_sd_31 (ERSO) * creates the security_descriptor for the root folder on ntfs 3.1. - * It is very long ; lot's av ACE's at first, then large pieces of zero's + * It is very long; lots of ACE's at first, then large pieces of zeroes; * the owner user/group is near the end. On a partition created with * w2k3 the owner user/group at the end is surrounded by 'garbage', which I * yet do not understand. Here I have replaced the 'garbage' with - * zero's, which seems to work. Chkdsk does not add the 'garbage', nor alter + * zeros, which seems to work. Chkdsk does not add the 'garbage', nor alter * this security descriptor in any way. */ void init_root_sd_31(u8 **sd_val, int *sd_val_len) @@ -222,28 +222,28 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) *sd_val = (u8*)&sd_array; //security descriptor relative - sd = (SECURITY_DESCRIPTOR_RELATIVE*)&sd_array; + sd = (SECURITY_DESCRIPTOR_RELATIVE*)sd_array; sd->revision = 0x01; sd->alignment = 0x00; sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x1014); - sd->group = cpu_to_le32(0x1024); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); + sd->owner = const_cpu_to_le32(0x1014); + sd->group = const_cpu_to_le32(0x1024); + sd->sacl = const_cpu_to_le32(0x00); + sd->dacl = const_cpu_to_le32(0x14); //acl - acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); + acl = (ACL*)((u8*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); acl->revision = 0x02; acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x1000); - acl->ace_count = cpu_to_le16(0x07); - acl->alignment2 = cpu_to_le16(0x00); + acl->size = const_cpu_to_le16(0x1000); + acl->ace_count = const_cpu_to_le16(0x07); + acl->alignment2 = const_cpu_to_le16(0x00); //ace1 - ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); + ace = (ACCESS_ALLOWED_ACE*)((u8*)acl + sizeof(ACL)); ace->type = 0x00; ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; - ace->size = cpu_to_le16(0x18); + ace->size = const_cpu_to_le16(0x18); ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | FILE_LIST_DIRECTORY | FILE_WRITE_DATA | FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | @@ -260,15 +260,15 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace = (ACCESS_ALLOWED_ACE*)((u8*)ace + le16_to_cpu(ace->size)); ace->type = 0x00; ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; - ace->size = cpu_to_le16(0x14); + ace->size = const_cpu_to_le16(0x14); ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | FILE_LIST_DIRECTORY | FILE_WRITE_DATA | FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | @@ -284,15 +284,15 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); //ace3 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace = (ACCESS_ALLOWED_ACE*)((u8*)ace + le16_to_cpu(ace->size)); ace->type = 0x00; ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | - INHERIT_ONLY_ACE; - ace->size = cpu_to_le16(0x14); - ace->mask = cpu_to_le32(0x10000000); + INHERIT_ONLY_ACE; + ace->size = const_cpu_to_le16(0x14); + ace->mask = const_cpu_to_le32(0x10000000); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x01; /* SECURITY_CREATOR_SID_AUTHORITY (S-1-3) */ @@ -303,14 +303,14 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 3; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_CREATOR_OWNER_RID); + const_cpu_to_le32(SECURITY_CREATOR_OWNER_RID); //ace4 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace = (ACCESS_ALLOWED_ACE*)((u8*)ace + le16_to_cpu(ace->size)); ace->type = 0x00; ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x1200A9); + ace->size = const_cpu_to_le16(0x18); + ace->mask = const_cpu_to_le32(0x1200A9); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x02; /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ @@ -321,16 +321,16 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_USERS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_USERS); //ace5 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le16_to_cpu(ace->size)); ace->type = 0x00; ace->flags = CONTAINER_INHERIT_ACE; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x04); + ace->size = const_cpu_to_le16(0x18); + ace->mask = const_cpu_to_le32(0x04); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x02; /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ @@ -341,16 +341,16 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_USERS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_USERS); //ace6 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace = (ACCESS_ALLOWED_ACE*)((u8*)ace + le16_to_cpu(ace->size)); ace->type = 0x00; ace->flags = CONTAINER_INHERIT_ACE | INHERIT_ONLY_ACE; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x02); + ace->size = const_cpu_to_le16(0x18); + ace->mask = const_cpu_to_le32(0x02); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x02; /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ @@ -361,16 +361,16 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_USERS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_USERS); //ace7 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace = (ACCESS_ALLOWED_ACE*)((u8*)ace + le16_to_cpu(ace->size)); ace->type = 0x00; ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = cpu_to_le32(0x1200A9); + ace->size = const_cpu_to_le16(0x14); + ace->mask = const_cpu_to_le32(0x1200A9); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x01; /* SECURITY_WORLD_SID_AUTHORITY (S-1-1) */ @@ -381,7 +381,7 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 1; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_WORLD_RID); + const_cpu_to_le32(SECURITY_WORLD_RID); //owner sid sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); @@ -395,9 +395,9 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //group sid sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); @@ -411,8 +411,7 @@ void init_root_sd_31(u8 **sd_val, int *sd_val_len) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); - + const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); } /** @@ -436,35 +435,35 @@ void init_secure_30(char *sd_val) */ //header sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val); - sds->hash = cpu_to_le32(0xF80312F0); - sds->security_id = cpu_to_le32(0x0100); - sds->offset = cpu_to_le64(0x00); - sds->length = cpu_to_le32(0x7C); + sds->hash = const_cpu_to_le32(0xF80312F0); + sds->security_id = const_cpu_to_le32(0x0100); + sds->offset = const_cpu_to_le64(0x00); + sds->length = const_cpu_to_le32(0x7C); //security descriptor relative sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + sizeof(SECURITY_DESCRIPTOR_HEADER)); sd->revision = 0x01; sd->alignment = 0x00; sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); + sd->owner = const_cpu_to_le32(0x48); + sd->group = const_cpu_to_le32(0x58); + sd->sacl = const_cpu_to_le32(0x00); + sd->dacl = const_cpu_to_le32(0x14); //acl acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); acl->revision = 0x02; acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(0x02); + acl->size = const_cpu_to_le16(0x34); + acl->ace_count = const_cpu_to_le16(0x02); acl->alignment2 = 0x00; //ace1 ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); ace->type = 0x00; ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = cpu_to_le32(0x120089); + ace->size = const_cpu_to_le16(0x14); + ace->mask = const_cpu_to_le32(0x120089); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x01; /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ @@ -475,14 +474,14 @@ void init_secure_30(char *sd_val) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le16_to_cpu(ace->size)); ace->type = 0x00; ace->flags = 0x00; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x120089); + ace->size = const_cpu_to_le16(0x18); + ace->mask = const_cpu_to_le32(0x120089); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x02; /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ @@ -493,9 +492,9 @@ void init_secure_30(char *sd_val) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //owner sid sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); @@ -509,9 +508,9 @@ void init_secure_30(char *sd_val) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //group sid sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); @@ -525,19 +524,19 @@ void init_secure_30(char *sd_val) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); /* * security descriptor #2 */ //header sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80); - sds->hash = cpu_to_le32(0xB32451); - sds->security_id = cpu_to_le32(0x0101); - sds->offset = cpu_to_le64(0x80); - sds->length = cpu_to_le32(0x7C); + sds->hash = const_cpu_to_le32(0xB32451); + sds->security_id = const_cpu_to_le32(0x0101); + sds->offset = const_cpu_to_le64(0x80); + sds->length = const_cpu_to_le32(0x7C); //security descriptor relative sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + @@ -545,25 +544,25 @@ void init_secure_30(char *sd_val) sd->revision = 0x01; sd->alignment = 0x00; sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); + sd->owner = const_cpu_to_le32(0x48); + sd->group = const_cpu_to_le32(0x58); + sd->sacl = const_cpu_to_le32(0x00); + sd->dacl = const_cpu_to_le32(0x14); //acl acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); acl->revision = 0x02; acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(0x02); + acl->size = const_cpu_to_le16(0x34); + acl->ace_count = const_cpu_to_le16(0x02); acl->alignment2 = 0x00; //ace1 ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); ace->type = 0x00; ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = cpu_to_le32(0x12019F); + ace->size = const_cpu_to_le16(0x14); + ace->mask = const_cpu_to_le32(0x12019F); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x01; /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ @@ -574,14 +573,14 @@ void init_secure_30(char *sd_val) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le16_to_cpu(ace->size)); ace->type = 0x00; ace->flags = 0x00; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x12019F); + ace->size = const_cpu_to_le16(0x18); + ace->mask = const_cpu_to_le32(0x12019F); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x02; /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ @@ -592,9 +591,9 @@ void init_secure_30(char *sd_val) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //owner sid sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); @@ -608,9 +607,9 @@ void init_secure_30(char *sd_val) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //group sid sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); @@ -624,19 +623,19 @@ void init_secure_30(char *sd_val) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); /* * security descriptor #3 */ //header sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80); - sds->hash = cpu_to_le32(0x0A9F9562); - sds->security_id = cpu_to_le32(0x0102); - sds->offset = cpu_to_le64(0x0100); - sds->length = cpu_to_le32(0x60); + sds->hash = const_cpu_to_le32(0x0A9F9562); + sds->security_id = const_cpu_to_le32(0x0102); + sds->offset = const_cpu_to_le64(0x0100); + sds->length = const_cpu_to_le32(0x60); //security descriptor relative sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + @@ -644,24 +643,24 @@ void init_secure_30(char *sd_val) sd->revision = 0x01; sd->alignment = 0x00; sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x30); - sd->group = cpu_to_le32(0x40); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); + sd->owner = const_cpu_to_le32(0x30); + sd->group = const_cpu_to_le32(0x40); + sd->sacl = const_cpu_to_le32(0x00); + sd->dacl = const_cpu_to_le32(0x14); //acl acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); acl->revision = 0x02; acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x1C); - acl->ace_count = cpu_to_le16(0x01); + acl->size = const_cpu_to_le16(0x1C); + acl->ace_count = const_cpu_to_le16(0x01); acl->alignment2 = 0x00; //ace1 ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); ace->type = 0x00; ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); + ace->size = const_cpu_to_le16(0x14); ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | FILE_LIST_DIRECTORY | FILE_WRITE_DATA | FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | @@ -677,7 +676,7 @@ void init_secure_30(char *sd_val) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); //owner sid sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); @@ -691,9 +690,9 @@ void init_secure_30(char *sd_val) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //group sid sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); sid->revision = 0x01; @@ -706,17 +705,17 @@ void init_secure_30(char *sd_val) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); /* * security descriptor #4 */ //header sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80 + 0x80 + 0x60); - sds->hash = cpu_to_le32(0x453F0A2E); - sds->security_id = cpu_to_le32(0x0103); - sds->offset = cpu_to_le64(0x0160); - sds->length = cpu_to_le32(0x78); + sds->hash = const_cpu_to_le32(0x453F0A2E); + sds->security_id = const_cpu_to_le32(0x0103); + sds->offset = const_cpu_to_le64(0x0160); + sds->length = const_cpu_to_le32(0x78); //security descriptor relative sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + @@ -724,24 +723,24 @@ void init_secure_30(char *sd_val) sd->revision = 0x01; sd->alignment = 0x00; sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); + sd->owner = const_cpu_to_le32(0x48); + sd->group = const_cpu_to_le32(0x58); + sd->sacl = const_cpu_to_le32(0x00); + sd->dacl = const_cpu_to_le32(0x14); //acl acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); acl->revision = 0x02; acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(0x02); + acl->size = const_cpu_to_le16(0x34); + acl->ace_count = const_cpu_to_le16(0x02); acl->alignment2 = 0x00; //ace1 ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); ace->type = 0x00; ace->flags = 0x00; - ace->size = cpu_to_le16(0x18); + ace->size = const_cpu_to_le16(0x18); ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | FILE_LIST_DIRECTORY | FILE_WRITE_DATA | FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | @@ -757,14 +756,14 @@ void init_secure_30(char *sd_val) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le16_to_cpu(ace->size)); ace->type = 0x00; ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); + ace->size = const_cpu_to_le16(0x14); ace->mask = STANDARD_RIGHTS_ALL | FILE_WRITE_ATTRIBUTES | FILE_LIST_DIRECTORY | FILE_WRITE_DATA | FILE_ADD_SUBDIRECTORY | FILE_READ_EA | FILE_WRITE_EA | @@ -780,7 +779,7 @@ void init_secure_30(char *sd_val) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); //owner sid sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); @@ -794,9 +793,9 @@ void init_secure_30(char *sd_val) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //group sid sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); @@ -810,7 +809,7 @@ void init_secure_30(char *sd_val) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); return; } @@ -836,35 +835,35 @@ void init_secure_31(char *sd_val) */ //header sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val); - sds->hash = cpu_to_le32(0xF80312F0); - sds->security_id = cpu_to_le32(0x0100); - sds->offset = cpu_to_le64(0x00); - sds->length = cpu_to_le32(0x7C); + sds->hash = const_cpu_to_le32(0xF80312F0); + sds->security_id = const_cpu_to_le32(0x0100); + sds->offset = const_cpu_to_le64(0x00); + sds->length = const_cpu_to_le32(0x7C); //security descriptor relative sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + - sizeof(SECURITY_DESCRIPTOR_HEADER)); + sizeof(SECURITY_DESCRIPTOR_HEADER)); sd->revision = 0x01; sd->alignment = 0x00; sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); + sd->owner = const_cpu_to_le32(0x48); + sd->group = const_cpu_to_le32(0x58); + sd->sacl = const_cpu_to_le32(0x00); + sd->dacl = const_cpu_to_le32(0x14); //acl acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); acl->revision = 0x02; acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(0x02); + acl->size = const_cpu_to_le16(0x34); + acl->ace_count = const_cpu_to_le16(0x02); acl->alignment2 = 0x00; //ace1 ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); ace->type = 0x00; ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = cpu_to_le32(0x120089); + ace->size = const_cpu_to_le16(0x14); + ace->mask = const_cpu_to_le32(0x120089); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x01; /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ @@ -875,13 +874,13 @@ void init_secure_31(char *sd_val) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le32_to_cpu(ace->size)); + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le16_to_cpu(ace->size)); ace->type = 0x00; ace->flags = 0x00; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x120089); + ace->size = const_cpu_to_le16(0x18); + ace->mask = const_cpu_to_le32(0x120089); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x02; /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ @@ -892,9 +891,9 @@ void init_secure_31(char *sd_val) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //owner sid sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); @@ -908,9 +907,9 @@ void init_secure_31(char *sd_val) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //group sid sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); sid->revision = 0x01; @@ -923,18 +922,18 @@ void init_secure_31(char *sd_val) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); /* * security descriptor #2 */ //header sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80); - sds->hash = cpu_to_le32(0xB32451); - sds->security_id = cpu_to_le32(0x0101); - sds->offset = cpu_to_le64(0x80); - sds->length = cpu_to_le32(0x7C); + sds->hash = const_cpu_to_le32(0xB32451); + sds->security_id = const_cpu_to_le32(0x0101); + sds->offset = const_cpu_to_le64(0x80); + sds->length = const_cpu_to_le32(0x7C); //security descriptor relative sd = (SECURITY_DESCRIPTOR_RELATIVE*)((char*)sds + @@ -942,25 +941,25 @@ void init_secure_31(char *sd_val) sd->revision = 0x01; sd->alignment = 0x00; sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT; - sd->owner = cpu_to_le32(0x48); - sd->group = cpu_to_le32(0x58); - sd->sacl = cpu_to_le32(0x00); - sd->dacl = cpu_to_le32(0x14); + sd->owner = const_cpu_to_le32(0x48); + sd->group = const_cpu_to_le32(0x58); + sd->sacl = const_cpu_to_le32(0x00); + sd->dacl = const_cpu_to_le32(0x14); //acl acl = (ACL*)((char*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE)); acl->revision = 0x02; acl->alignment1 = 0x00; - acl->size = cpu_to_le16(0x34); - acl->ace_count = cpu_to_le16(0x02); + acl->size = const_cpu_to_le16(0x34); + acl->ace_count = const_cpu_to_le16(0x02); acl->alignment2 = 0x00; //ace1 ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL)); ace->type = 0x00; ace->flags = 0x00; - ace->size = cpu_to_le16(0x14); - ace->mask = cpu_to_le32(0x12019F); + ace->size = const_cpu_to_le16(0x14); + ace->mask = const_cpu_to_le32(0x12019F); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x01; /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ @@ -971,13 +970,13 @@ void init_secure_31(char *sd_val) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); + const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID); //ace2 - ace = (ACCESS_ALLOWED_ACE*)((char*)ace + ace->size); + ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le16_to_cpu(ace->size)); ace->type = 0x00; ace->flags = 0x00; - ace->size = cpu_to_le16(0x18); - ace->mask = cpu_to_le32(0x12019F); + ace->size = const_cpu_to_le16(0x18); + ace->mask = const_cpu_to_le32(0x12019F); ace->sid.revision = 0x01; ace->sid.sub_authority_count = 0x02; /* SECURITY_NT_SID_AUTHORITY (S-1-5) */ @@ -988,9 +987,9 @@ void init_secure_31(char *sd_val) ace->sid.identifier_authority.value[4] = 0; ace->sid.identifier_authority.value[5] = 5; ace->sid.sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); ace->sid.sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //owner sid sid = (SID*)((char*)sd + le32_to_cpu(sd->owner)); @@ -1004,9 +1003,9 @@ void init_secure_31(char *sd_val) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); //group sid sid = (SID*)((char*)sd + le32_to_cpu(sd->group)); @@ -1020,10 +1019,9 @@ void init_secure_31(char *sd_val) sid->identifier_authority.value[4] = 0; sid->identifier_authority.value[5] = 5; sid->sub_authority[0] = - cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); + const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID); sid->sub_authority[1] = - cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); + const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS); return; } - From cd948e75c0f9c0402ad2f0d6ff376e57b11ab534 Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 4 Feb 2006 06:06:04 +0000 Subject: [PATCH 2854/2994] Fix upcase table to be little endian. With this bug fixed the volumes produced by mkntfs on little and big endian machines are identical (except for the volume serial number - probably ought to standardize that when using the -T switch). --- ntfsprogs/upcase.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c index 505e7275..a967cdd0 100644 --- a/ntfsprogs/upcase.c +++ b/ntfsprogs/upcase.c @@ -2,9 +2,7 @@ * upcase - Part of the Linux-NTFS project. * * Copyright (c) 2001 Richard Russon - * Copyright (c) 2001-2004 Anton Altaparmakov - * - * Modified for mkntfs inclusion 9 June 2001 by Anton Altaparmakov. + * Copyright (c) 2001-2006 Anton Altaparmakov * * 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 @@ -28,6 +26,7 @@ #include #endif +#include "endians.h" #include "types.h" #include "upcase.h" @@ -74,8 +73,9 @@ void init_upcase_table(ntfschar *uc, u32 uc_len) }; int i, r; - memset((char*)uc, 0, uc_len); + memset(uc, 0, uc_len); uc_len >>= 1; + /* Generate the upcase table in cpu byte order. */ for (i = 0; (u32)i < uc_len; i++) uc[i] = i; for (r = 0; uc_run_table[r][0]; r++) @@ -86,5 +86,7 @@ void init_upcase_table(ntfschar *uc, u32 uc_len) uc[i + 1]--; for (r = 0; uc_byte_table[r][0]; r++) uc[uc_byte_table[r][0]] = uc_byte_table[r][1]; + /* Convert the upcase table from cpu byte order to little endian. */ + for (i = 0; (u32)i < uc_len; i++) + uc[i] = cpu_to_le16(uc[i]); } - From ca37cdb7f86b246eba5d6a4b572a706dd3c5c3af Mon Sep 17 00:00:00 2001 From: antona Date: Sat, 4 Feb 2006 06:11:28 +0000 Subject: [PATCH 2855/2994] Don't do it at the end and do it as we go along instead as I am already doing in the kernel driver. --- ntfsprogs/upcase.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ntfsprogs/upcase.c b/ntfsprogs/upcase.c index a967cdd0..113686cd 100644 --- a/ntfsprogs/upcase.c +++ b/ntfsprogs/upcase.c @@ -75,18 +75,16 @@ void init_upcase_table(ntfschar *uc, u32 uc_len) memset(uc, 0, uc_len); uc_len >>= 1; - /* Generate the upcase table in cpu byte order. */ + /* Generate the little endian Unicode upcase table used by ntfs. */ for (i = 0; (u32)i < uc_len; i++) - uc[i] = i; + uc[i] = cpu_to_le16(i); for (r = 0; uc_run_table[r][0]; r++) for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) - uc[i] += uc_run_table[r][2]; + uc[i] = cpu_to_le16(le16_to_cpu(uc[i]) + + uc_run_table[r][2]); for (r = 0; uc_dup_table[r][0]; r++) for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) - uc[i + 1]--; + uc[i + 1] = cpu_to_le16(le16_to_cpu(uc[i + 1]) - 1); for (r = 0; uc_byte_table[r][0]; r++) - uc[uc_byte_table[r][0]] = uc_byte_table[r][1]; - /* Convert the upcase table from cpu byte order to little endian. */ - for (i = 0; (u32)i < uc_len; i++) - uc[i] = cpu_to_le16(uc[i]); + uc[uc_byte_table[r][0]] = cpu_to_le16(uc_byte_table[r][1]); } From c47236819d079d90f309bb3d18348d5f18fb8c1c Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 4 Feb 2006 13:34:37 +0000 Subject: [PATCH 2856/2994] Explain EBUSY if volume opening failed --- ntfsprogs/ntfsresize.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 36745eea..fa5fc437 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -104,6 +104,10 @@ static const char *unclean_journal_msg = "using this software! Note, if you have run chkdsk previously then boot\n" "Windows again which will automatically initialize the journal correctly.\n"; +static const char *opened_volue_msg = +"This software has detected that the NTFS volume is already opened by another\n" +"software thus it refuses to progress to preserve data consistency.\n"; + static const char *bad_sectors_warning_msg = "****************************************************************************\n" "* WARNING: The disk has bad sector. This means physical damage on the disk *\n" @@ -2260,6 +2264,8 @@ static ntfs_volume *mount_volume(void) printf("%s", hibernated_volume_msg); else if (err == EOPNOTSUPP) printf("%s", unclean_journal_msg); + else if (err == EBUSY) + printf("%s", opened_volue_msg); exit(1); } From 9d511393777a86f04902d69384c78cc3a1f6b32e Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 4 Feb 2006 13:39:19 +0000 Subject: [PATCH 2857/2994] Fix typo --- ntfsprogs/ntfsresize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index fa5fc437..f1606eea 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -104,7 +104,7 @@ static const char *unclean_journal_msg = "using this software! Note, if you have run chkdsk previously then boot\n" "Windows again which will automatically initialize the journal correctly.\n"; -static const char *opened_volue_msg = +static const char *opened_volume_msg = "This software has detected that the NTFS volume is already opened by another\n" "software thus it refuses to progress to preserve data consistency.\n"; @@ -2265,7 +2265,7 @@ static ntfs_volume *mount_volume(void) else if (err == EOPNOTSUPP) printf("%s", unclean_journal_msg); else if (err == EBUSY) - printf("%s", opened_volue_msg); + printf("%s", opened_volume_msg); exit(1); } From aaf7b25015cc07c220df6372a6489ab04de83d51 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 4 Feb 2006 19:24:14 +0000 Subject: [PATCH 2858/2994] fix ntfs_device_sector_size_get() description --- libntfs/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libntfs/device.c b/libntfs/device.c index f52080f1..929a02f5 100644 --- a/libntfs/device.c +++ b/libntfs/device.c @@ -692,8 +692,8 @@ int ntfs_device_sector_size_get(struct ntfs_device *dev) * * The following error codes are defined: * EINVAL Input parameter error - * EOPNOTSUPP System does not support HDIO_GETGEO ioctl - * ENOTTY @dev is a file or a device not supporting HDIO_GETGEO + * EOPNOTSUPP System does not support BLKBSZSET ioctl + * ENOTTY @dev is a file or a device not supporting BLKBSZSET */ int ntfs_device_block_size_set(struct ntfs_device *dev, int block_size __attribute__((unused))) From a8a29084b516377931976de71d5afbc0eda492d3 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 4 Feb 2006 19:53:22 +0000 Subject: [PATCH 2859/2994] Remove old, redundant g_mft_size calculation --- ntfsprogs/mkntfs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c index ac811847..ce606f80 100644 --- a/ntfsprogs/mkntfs.c +++ b/ntfsprogs/mkntfs.c @@ -3794,8 +3794,6 @@ static BOOL mkntfs_initialize_bitmaps(void) else g_mft_size = 16; g_mft_size *= g_vol->mft_record_size; - g_mft_size = ((16 + 11 * (g_vol->major_ver >= 3)) * - g_vol->mft_record_size); if (g_mft_size < (s32)g_vol->cluster_size) g_mft_size = g_vol->cluster_size; ntfs_log_debug("MFT size = %i (0x%x) bytes\n", g_mft_size, g_mft_size); From fb244d7c70a1284465f5e284bb57e017d7921c8e Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 4 Feb 2006 22:56:13 +0000 Subject: [PATCH 2860/2994] Explain the tons of mkntfs bugs --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7b36bd61..bfa0a5a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -114,7 +114,7 @@ mountable by the kernel driver (it requires mft record size and index record size to be below or equal to the system page size which we determine using sysconf()). (Anton) - - Fix tons of bugs in mkntfs. (Anton) + - Fix tons of big-endian bugs in mkntfs. (Anton) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. From c0e546199548c99c9d7fb06d37d1b7ffb9cbcc90 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 4 Feb 2006 23:21:48 +0000 Subject: [PATCH 2861/2994] Credit Erik Sornes for implementing NTFS 3.x version support for mkntfs --- CREDITS | 3 ++- ntfsprogs/mkntfs.8.in | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CREDITS b/CREDITS index 1bfffcd5..7f49cfd1 100644 --- a/CREDITS +++ b/CREDITS @@ -29,7 +29,8 @@ Per Olofsson Yura Pakhuchiy Yuri Per Richard Russon -Szakacsits Szabolcs +Erik Sřrnes +Szabolcs Szakacsits Also, various code snippets and especially the autoconf/automake automated configuration, compilation and installation system have been ripped shamelessly diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in index 4da7b1de..d1efefee 100644 --- a/ntfsprogs/mkntfs.8.in +++ b/ntfsprogs/mkntfs.8.in @@ -279,8 +279,7 @@ linux\-ntfs\-dev@lists.sourceforge.net .hy .SH AUTHORS .B mkntfs -was written by Anton Altaparmakov, Richard Russon and Szabolcs Szakacsits, with -contributions from Erik Sornes. +was written by Anton Altaparmakov, Richard Russon, Erik Sornes and Szabolcs Szakacsits. .SH AVAILABILITY .B mkntfs is part of the From fefc3e51959d00e6e976546622f418c59070b2c2 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 5 Feb 2006 16:39:35 +0000 Subject: [PATCH 2862/2994] ntfsresize, ntfsclone: always use MS_NOATIME --- ChangeLog | 1 + ntfsprogs/ntfsclone.c | 2 +- ntfsprogs/ntfsresize.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index bfa0a5a5..12ae5c69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -115,6 +115,7 @@ record size to be below or equal to the system page size which we determine using sysconf()). (Anton) - Fix tons of big-endian bugs in mkntfs. (Anton) + - ntfsresize, ntfsclone: always use MS_NOATIME. (Szaka) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index d5e963ea..c8ddab12 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1603,7 +1603,7 @@ int main(int argc, char **argv) /* 'force' again mount for dirty volumes (e.g. after resize). FIXME: use mount flags to avoid potential side-effects in future */ opt.force++; - mount_volume(0); + mount_volume(MS_NOATIME); free(lcn_bitmap.bm); setup_lcn_bitmap(); diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index f1606eea..1e597c8a 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2251,7 +2251,7 @@ static ntfs_volume *mount_volume(void) "You must 'umount' it first.\n", opt.volume); } - if (!(vol = ntfs_mount(opt.volume, opt.ro_flag))) { + if (!(vol = ntfs_mount(opt.volume, opt.ro_flag | MS_NOATIME))) { int err = errno; From 31fac08864947447a45f38c4f12497c0a65c2717 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 5 Feb 2006 18:56:04 +0000 Subject: [PATCH 2863/2994] Dump MFT Record Header fields which weren't yet --- ntfsprogs/ntfsinfo.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c index 3ddbb072..b6bfb6c9 100644 --- a/ntfsprogs/ntfsinfo.c +++ b/ntfsprogs/ntfsinfo.c @@ -2046,14 +2046,20 @@ static void ntfs_dump_inode_general_info(ntfs_inode *inode) printf("Dumping Inode #%llu\n",(long long)inode->mft_no); + printf("Update Sequence Offset:\t %hu\n", + le16_to_cpu(inode->mrec->usa_ofs)); printf("Update Sequence Array Count:\t %hu\n", le16_to_cpu(inode->mrec->usa_count)); - printf("$LogFile seqNum for this Inode:\t 0x%llx\n", + printf("Update Sequence Number:\t %hu\n", + *(u16*)((u8*)inode->mrec + le16_to_cpu(inode->mrec->usa_ofs))); + printf("$LogFile Sequence Number:\t 0x%llx\n", (signed long long int)sle64_to_cpu(inode->mrec->lsn)); - printf("Number of times reused:\t\t %hu\n", + printf("MFT Record Sequence Number:\t %hu\n", (short unsigned int)le16_to_cpu(inode->mrec->sequence_number)); printf("Number of hard links:\t\t %hu\n", le16_to_cpu(inode->mrec->link_count)); + printf("First attribute offset:\t %hu\n", + le16_to_cpu(inode->mrec->attrs_offset)); printf("MFT record Flags:\t\t "); if (inode_flags) { @@ -2090,7 +2096,7 @@ static void ntfs_dump_inode_general_info(ntfs_inode *inode) printf("base MFT record:\t\t %llu\n", MREF_LE(inode->mrec->base_mft_record)); } - printf("Next Attribute Instance Num\t %hu\n", + printf("Next Attribute Instance:\t %hu\n", le16_to_cpu(inode->mrec->next_attr_instance)); } From 16b8bc1fd45e73f4849778c11cad37ba7ef64028 Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 5 Feb 2006 19:35:20 +0000 Subject: [PATCH 2864/2994] Write MFT records with the same USN during metadata cloning. This eases ntfsclone self-regression, which itself is going to validate other codes --- ntfsprogs/ntfsclone.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index c8ddab12..1013cc01 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -1006,6 +1006,19 @@ static void wipe_unused_mft(ntfs_inode *ni) wiped_unused_mft += wipe_data((char *)m, sizeof(MFT_RECORD), unused); } +static void mft_record_write_with_same_usn(ntfs_volume *volume, ntfs_inode *ni) +{ + u16 usn, *usnp; + + usnp = (u16 *)((char *)ni->mrec + le16_to_cpu(ni->mrec->usa_ofs)); + usn = le16_to_cpup(usnp); + if (usn-- <= 1) + usn = 0xfffe; + *usnp = cpu_to_le16(usn); + + if (ntfs_mft_record_write(volume, ni->mft_no, ni->mrec)) + perr_exit("ntfs_mft_record_write"); +} static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) { @@ -1049,8 +1062,7 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) if (wipe) { wipe_unused_mft(ni); wipe_unused_mft_data(ni); - if (ntfs_mft_record_write(volume, ni->mft_no, ni->mrec)) - perr_exit("ntfs_mft_record_write"); + mft_record_write_with_same_usn(volume, ni); } } @@ -1079,8 +1091,7 @@ static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk) out: if (wipe) { wipe_unused_mft_data(ni); - if (ntfs_mft_record_write(volume, ni->mft_no, ni->mrec)) - perr_exit("ntfs_mft_record_write"); + mft_record_write_with_same_usn(volume, ni); } if (ntfs_inode_close(ni)) From fae8feea651c54b6aea63f695c8de07463ed9a5f Mon Sep 17 00:00:00 2001 From: szaka Date: Sun, 5 Feb 2006 22:10:01 +0000 Subject: [PATCH 2865/2994] Explain dirty volume --- ntfsprogs/ntfsclone.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c index 1013cc01..58b796d2 100644 --- a/ntfsprogs/ntfsclone.c +++ b/ntfsprogs/ntfsclone.c @@ -88,6 +88,10 @@ static const char *bad_sectors_warning_msg = "* Use the --rescue option to efficiently save as much data as possible! *\n" "*************************************************************************\n"; +static const char *dirty_volume_msg = +"Volume '%s' is scheduled for a check or it was shutdown \n" +"uncleanly. Please boot Windows or use the --force option to progress.\n"; + struct { int verbose; int quiet; @@ -1215,8 +1219,7 @@ static void mount_volume(unsigned long new_mntflag) if (vol->flags & VOLUME_IS_DIRTY) if (opt.force-- <= 0) - err_exit("Volume is dirty. Run chkdsk and " - "please try again (or see -f option).\n"); + err_exit(dirty_volume_msg, opt.volume); if (NTFS_MAX_CLUSTER_SIZE < vol->cluster_size) err_exit("Cluster size %u is too large!\n", From 1e05dd5d9a9cff7dc295cfa9b7010afb922a3c19 Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 6 Feb 2006 00:48:23 +0000 Subject: [PATCH 2866/2994] Note tar brokenness, update examples --- ntfsprogs/ntfsclone.8.in | 49 ++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in index a665a893..09e24f97 100644 --- a/ntfsprogs/ntfsclone.8.in +++ b/ntfsprogs/ntfsclone.8.in @@ -78,7 +78,7 @@ of view. At present the most efficient way, both speed and space\-wise, to compress and uncompress large sparse files by common tools -is using +would be using .BR tar (1) with the options .B \-S @@ -93,7 +93,11 @@ writing large amount of zeros to the disk needlessly. But since can't create an archive from the standard input, you can't do this in\-place by just reading .BR ntfsclone -standard output. +standard output. Even more sadly, using this \-S option results +serious data loss since the end of 2004 and the GNU +.BR tar +maintainers don't care about releasing fixed versions until the +present day. .SS The Special Image Format It's also possible, actually it's recommended, to save an NTFS filesystem to a special image format. @@ -129,7 +133,7 @@ mountable. In this case all non\-metadata file content will be lost and reading them back will result always zeros. The metadata\-only image can be compressed very -well, usually to not more than 1\-3 MB thus it's relatively easy to transfer +well, usually to not more than 1\-8 MB thus it's easy to transfer for investigation, troubleshooting. In this mode of ntfsclone, @@ -212,25 +216,31 @@ Show a list of options with a brief description of each one. .SH EXIT CODES The exit code is 0 on success, non\-zero otherwise. .SH EXAMPLES -Save an NTFS to a file in the special image format +Clone NTFS on /dev/hda1 to /dev/hdc1: +.RS +.sp +.B ntfsclone \-\-overwrite /dev/hdc1 /dev/hda1 +.sp +.RE +Save an NTFS to a file in the special image format: .RS .sp .B ntfsclone \-\-save\-image \-\-output backup.img /dev/hda1 .sp .RE -Restore an NTFS from a special image file to its original partition +Restore an NTFS from a special image file to its original partition: .RS .sp .B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 backup.img .sp .RE -Save an NTFS into a compressed image. +Save an NTFS into a compressed image file: .RS .sp .B ntfsclone \-\-save\-image \-o \- /dev/hda1 | gzip \-c > backup.img.gz .sp .RE -Restore an NTFS volume from a compressed image file +Restore an NTFS volume from a compressed image file: .RS .sp .B gunzip \-c backup.img.gz | \\\\ @@ -238,7 +248,8 @@ Restore an NTFS volume from a compressed image file .B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \- .sp .RE -Backup an NTFS volume to a remote host, using ssh. +Backup an NTFS volume to a remote host, using ssh. Please note, that +ssh may ask for a password! .RS .sp .B ntfsclone \-\-save\-image \-\-output \- /dev/hda1 | \\\\ @@ -246,7 +257,8 @@ Backup an NTFS volume to a remote host, using ssh. .B gzip \-c | ssh host 'cat > backup.img.gz' .sp .RE -Restore an NTFS volume from a remote host via ssh. +Restore an NTFS volume from a remote host via ssh. Please note, that +ssh may ask for a password! .RS .sp .B ssh host 'cat backup.img.gz' | gunzip \-c | \\\\ @@ -254,7 +266,7 @@ Restore an NTFS volume from a remote host via ssh. .B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \- .sp .RE -Stream an image from a web server and restore it to a partition +Stream an image file from a web server and restore it to a partition: .RS .sp .B wget \-qO \- http://server/backup.img | \\\\ @@ -262,18 +274,28 @@ Stream an image from a web server and restore it to a partition .B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \- .sp .RE -Clone an NTFS volume to a non\-existent file +Clone an NTFS volume to a non\-existent file: .RS .sp .B ntfsclone \-\-output ntfs\-clone.img /dev/hda1 .sp .RE -Pack NTFS metadata for NTFS experts +Pack NTFS metadata for NTFS experts. Please note that bzip2 runs +very long but results usually at least 10 times smaller archives +than gzip. .RS .sp .B ntfsclone \-\-metadata \-\-output ntfsmeta.img /dev/hda1 .br -.B tar \-cjSf ntfsmeta.img.tar.bz2 ntfsmeta.img +.B bzip2 ntfsmeta.img +.sp +.RE +Unpacking NTFS metadata into a sparse file: +.RS +.sp +.B bunzip2 \-c ntfsmeta.img.bz2 | \\\\ +.br +.B cp \-\-sparse=always /proc/self/fd/0 ntfsmeta.img .sp .RE .SH KNOWN ISSUES @@ -281,7 +303,6 @@ There are no known problems with .BR ntfsclone . If you think you have found a problem then please send an email describing it to the development team: -.br .nh linux\-ntfs\-dev@lists.sourceforge.net .hy From f599394450d42ec2d7923c50e302dfaa95ff194e Mon Sep 17 00:00:00 2001 From: szaka Date: Mon, 6 Feb 2006 01:05:01 +0000 Subject: [PATCH 2867/2994] Shorten 'ntfsprogs version @VERSION@' to only 'ntfsprogs @VERSION@' in the headers so it won't overwrite/overlap so easily with the update time in the center if the @VERSION@ is too long (e.g. -WIP--